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

The API

\n

This is the documentation for the xCALLY MOTION API.

\n

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

\n

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

\n

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

\n

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

\n
GET /api/users\n
\n

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

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

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

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

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

\n

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

\n

Security and Authentication

\n

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

\n

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

\n

Basic authentication

\n

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

\n

Example:

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

OAuth access token

\n

The xCALLY API supports OAuth authorization flows.

\n

OAuth access tokens also permit client-side API requests.

\n

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

\n

Example:

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

API Key

\n

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

\n

Example:

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

Request Format

\n

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

\n

Response Format

\n

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

\n

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

\n

200 range

\n

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

\n

400 range

\n

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

\n

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

\n

500 range

\n

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

\n

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

\n

Data Types

\n

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

\n

ID integers

\n

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

\n

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

\n

Time stamps

\n

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

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

The API

\n

This is the documentation for the xCALLY MOTION API.

\n

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

\n

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

\n

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

\n

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

\n
GET /api/users\n
\n

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

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

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

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

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

\n

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

\n

Security and Authentication

\n

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

\n

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

\n

Basic authentication

\n

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

\n

Example:

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

OAuth access token

\n

The xCALLY API supports OAuth authorization flows.

\n

OAuth access tokens also permit client-side API requests.

\n

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

\n

Example:

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

API Key

\n

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

\n

Example:

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

Request Format

\n

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

\n

Response Format

\n

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

\n

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

\n

200 range

\n

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

\n

400 range

\n

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

\n

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

\n

500 range

\n

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

\n

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

\n

Data Types

\n

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

\n

ID integers

\n

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

\n

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

\n

Time stamps

\n

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

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

The API

\n

This is the documentation for the xCALLY MOTION API.

\n

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

\n

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

\n

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

\n

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

\n
GET /api/users\n
\n

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

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

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

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

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

\n

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

\n

Security and Authentication

\n

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

\n

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

\n

Basic authentication

\n

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

\n

Example:

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

OAuth access token

\n

The xCALLY API supports OAuth authorization flows.

\n

OAuth access tokens also permit client-side API requests.

\n

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

\n

Example:

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

API Key

\n

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

\n

Example:

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

Request Format

\n

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

\n

Response Format

\n

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

\n

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

\n

200 range

\n

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

\n

400 range

\n

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

\n

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

\n

500 range

\n

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

\n

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

\n

Data Types

\n

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

\n

ID integers

\n

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

\n

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

\n

Time stamps

\n

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

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

The API

\n

This is the documentation for the xCALLY MOTION API.

\n

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

\n

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

\n

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

\n

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

\n
GET /api/users\n
\n

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

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

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

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

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

\n

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

\n

Security and Authentication

\n

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

\n

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

\n

Basic authentication

\n

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

\n

Example:

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

OAuth access token

\n

The xCALLY API supports OAuth authorization flows.

\n

OAuth access tokens also permit client-side API requests.

\n

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

\n

Example:

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

API Key

\n

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

\n

Example:

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

Request Format

\n

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

\n

Response Format

\n

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

\n

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

\n

200 range

\n

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

\n

400 range

\n

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

\n

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

\n

500 range

\n

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

\n

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

\n

Data Types

\n

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

\n

ID integers

\n

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

\n

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

\n

Time stamps

\n

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

\n" }, "template": { "withGenerator": false, "withCompare": false, "forceLanguage": "en" }, "sampleUrl": false, "defaultVersion": "0.0.0", "apidoc": "0.3.0", "generator": { "name": "apidoc", "time": "2020-08-27T16:29:25.594Z", "url": "http://apidocjs.com", "version": "0.19.0" } } diff --git a/server/api/action/action.attributes.js b/server/api/action/action.attributes.js index 822414a..0b8d4cf 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 _0xe9c1=['integration','motionbar','script','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','VIRTUAL','getDataValue','action','STRING','contactManager'];(function(_0x3868a2,_0x3bffa5){var _0x801165=function(_0x3af77c){while(--_0x3af77c){_0x3868a2['push'](_0x3868a2['shift']());}};_0x801165(++_0x3bffa5);}(_0xe9c1,0x192));var _0x1e9c=function(_0x3fbe2f,_0x5d0383){_0x3fbe2f=_0x3fbe2f-0x0;var _0x1bb161=_0xe9c1[_0x3fbe2f];return _0x1bb161;};'use strict';var Sequelize=require(_0x1e9c('0x0'));module['exports']={'name':{'type':Sequelize[_0x1e9c('0x1')],'get':function(_0x50b067){return this[_0x1e9c('0x2')](_0x1e9c('0x3'));}},'action':{'type':Sequelize[_0x1e9c('0x4')],'allowNull':![],'validate':{'isIn':{'args':[[_0x1e9c('0x5'),_0x1e9c('0x6'),_0x1e9c('0x7'),'jscripty','urlForward','browser','bot',_0x1e9c('0x8')]],'msg':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'}},'comment':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'},'data1':{'type':Sequelize[_0x1e9c('0x4')](0x1000),'comment':_0x1e9c('0x9')},'data2':{'type':Sequelize[_0x1e9c('0x4')](0x1000),'comment':_0x1e9c('0xa')},'data3':{'type':Sequelize[_0x1e9c('0x4')](0x1000),'comment':'motionbar[NULL,NULL,WinAppArguments]'},'data4':{'type':Sequelize[_0x1e9c('0x4')](0x1000)},'data5':{'type':Sequelize[_0x1e9c('0x4')](0x1000)},'data6':{'type':Sequelize[_0x1e9c('0x4')]},'data7':{'type':Sequelize[_0x1e9c('0xb')]}}; \ No newline at end of file +var _0x0b63=['motionbar[NULL,NULL,WinAppArguments]','TEXT','sequelize','exports','getDataValue','STRING','contactManager','jscripty','urlForward','browser','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20urlForward[URL]'];(function(_0x4f7a97,_0x14f986){var _0x2d97cb=function(_0x4323b6){while(--_0x4323b6){_0x4f7a97['push'](_0x4f7a97['shift']());}};_0x2d97cb(++_0x14f986);}(_0x0b63,0x198));var _0x30b6=function(_0x105ecd,_0x487b6d){_0x105ecd=_0x105ecd-0x0;var _0x2c0164=_0x0b63[_0x105ecd];return _0x2c0164;};'use strict';var Sequelize=require(_0x30b6('0x0'));module[_0x30b6('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x3c06dd){return this[_0x30b6('0x2')]('action');}},'action':{'type':Sequelize[_0x30b6('0x3')],'allowNull':![],'validate':{'isIn':{'args':[[_0x30b6('0x4'),'integration','motionbar',_0x30b6('0x5'),_0x30b6('0x6'),_0x30b6('0x7'),_0x30b6('0x8'),_0x30b6('0x9')]],'msg':_0x30b6('0xa')}},'comment':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'},'data1':{'type':Sequelize[_0x30b6('0x3')](0x1000),'comment':'contactManager[ListId],\x20integration[intName(zendesk)],\x20motionbar[Popup(0),URL(1),WinApp(2)],\x20urlForward[GET,POST],\x20browser[TemplateId(0),URL(1)]'},'data2':{'type':Sequelize['STRING'](0x1000),'comment':_0x30b6('0xb')},'data3':{'type':Sequelize[_0x30b6('0x3')](0x1000),'comment':_0x30b6('0xc')},'data4':{'type':Sequelize[_0x30b6('0x3')](0x1000)},'data5':{'type':Sequelize[_0x30b6('0x3')](0x1000)},'data6':{'type':Sequelize[_0x30b6('0x3')]},'data7':{'type':Sequelize[_0x30b6('0xd')]}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index b092dcc..cb44c33 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 _0xcff4=['querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','then','error','name','Action','find','catch','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js'];(function(_0x51f233,_0x48c6b4){var _0x2a19bf=function(_0x145e03){while(--_0x145e03){_0x51f233['push'](_0x51f233['shift']());}};_0x2a19bf(++_0x48c6b4);}(_0xcff4,0x18d));var _0x4cff=function(_0x25f2f8,_0x44c2ef){_0x25f2f8=_0x25f2f8-0x0;var _0x206cc1=_0xcff4[_0x25f2f8];return _0x206cc1;};'use strict';var pdf=require(_0x4cff('0x0'));var emlformat=require(_0x4cff('0x1'));var rimraf=require(_0x4cff('0x2'));var zipdir=require(_0x4cff('0x3'));var jsonpatch=require(_0x4cff('0x4'));var rp=require(_0x4cff('0x5'));var moment=require(_0x4cff('0x6'));var BPromise=require(_0x4cff('0x7'));var Mustache=require('mustache');var util=require(_0x4cff('0x8'));var path=require(_0x4cff('0x9'));var sox=require(_0x4cff('0xa'));var csv=require(_0x4cff('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x4cff('0xc'));var squel=require(_0x4cff('0xd'));var crypto=require(_0x4cff('0xe'));var jsforce=require(_0x4cff('0xf'));var deskjs=require(_0x4cff('0x10'));var toCsv=require(_0x4cff('0xb'));var querystring=require(_0x4cff('0x11'));var Papa=require(_0x4cff('0x12'));var Redis=require('ioredis');var authService=require(_0x4cff('0x13'));var qs=require(_0x4cff('0x14'));var as=require(_0x4cff('0x15'));var hardwareService=require(_0x4cff('0x16'));var logger=require(_0x4cff('0x17'))(_0x4cff('0x18'));var utils=require(_0x4cff('0x19'));var config=require('../../config/environment');var db=require(_0x4cff('0x1a'))['db'];function respondWithStatusCode(_0x46e80e,_0x2a3d5a){_0x2a3d5a=_0x2a3d5a||0xcc;return function(_0x43e4e3){if(_0x43e4e3){return _0x46e80e[_0x4cff('0x1b')](_0x2a3d5a);}return _0x46e80e[_0x4cff('0x1c')](_0x2a3d5a)[_0x4cff('0x1d')]();};}function respondWithResult(_0x3ef59b,_0x145463){_0x145463=_0x145463||0xc8;return function(_0x572f33){if(_0x572f33){return _0x3ef59b[_0x4cff('0x1c')](_0x145463)[_0x4cff('0x1e')](_0x572f33);}};}function respondWithFilteredResult(_0x1d475e,_0x4db8ef){return function(_0x269d79){if(_0x269d79){var _0xea3002=_0x269d79[_0x4cff('0x1f')],_0xc89d6f=_0x4db8ef[_0x4cff('0x20')],_0x2d97a4=_0x4db8ef[_0x4cff('0x20')]+_0x4db8ef[_0x4cff('0x21')],_0x16a730;if(_0x2d97a4>=_0xea3002){_0x2d97a4=_0xea3002;_0x16a730=0xc8;}else{_0x16a730=0xce;}_0x1d475e[_0x4cff('0x1c')](_0x16a730);return _0x1d475e[_0x4cff('0x22')](_0x4cff('0x23'),_0xc89d6f+'-'+_0x2d97a4+'/'+_0xea3002)[_0x4cff('0x1e')](_0x269d79);}return null;};}function patchUpdates(_0x259276){return function(_0x56bdee){try{jsonpatch['apply'](_0x56bdee,_0x259276,!![]);}catch(_0x242e2a){return BPromise[_0x4cff('0x24')](_0x242e2a);}return _0x56bdee[_0x4cff('0x25')]();};}function saveUpdates(_0xe6f0c6,_0x414b82){return function(_0x153428){if(_0x153428){return _0x153428[_0x4cff('0x26')](_0xe6f0c6)[_0x4cff('0x27')](function(_0x17cce8){return _0x17cce8;});}return null;};}function removeEntity(_0x247625,_0x424ffb){return function(_0x5ac8c2){if(_0x5ac8c2){return _0x5ac8c2['destroy']()[_0x4cff('0x27')](function(){_0x247625['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x500d01,_0x58b274){return function(_0x414775){if(!_0x414775){_0x500d01[_0x4cff('0x1b')](0x194);}return _0x414775;};}function handleError(_0x1730d6,_0x35bbe3){_0x35bbe3=_0x35bbe3||0x1f4;return function(_0x4967f8){logger[_0x4cff('0x28')](_0x4967f8['stack']);if(_0x4967f8[_0x4cff('0x29')]){delete _0x4967f8[_0x4cff('0x29')];}_0x1730d6[_0x4cff('0x1c')](_0x35bbe3)['send'](_0x4967f8);};}exports[_0x4cff('0x26')]=function(_0x5f4fbe,_0x819164){if(_0x5f4fbe['body']['id']){delete _0x5f4fbe['body']['id'];}return db[_0x4cff('0x2a')][_0x4cff('0x2b')]({'where':{'id':_0x5f4fbe['params']['id']}})[_0x4cff('0x27')](handleEntityNotFound(_0x819164,null))[_0x4cff('0x27')](saveUpdates(_0x5f4fbe['body'],null))['then'](respondWithResult(_0x819164,null))[_0x4cff('0x2c')](handleError(_0x819164,null));};exports['destroy']=function(_0x1b788f,_0x1b1a49){return db[_0x4cff('0x2a')][_0x4cff('0x2b')]({'where':{'id':_0x1b788f[_0x4cff('0x2d')]['id']}})[_0x4cff('0x27')](handleEntityNotFound(_0x1b1a49,null))[_0x4cff('0x27')](removeEntity(_0x1b1a49,null))[_0x4cff('0x2c')](handleError(_0x1b1a49,null));}; \ No newline at end of file +var _0x9d68=['../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','limit','Content-Range','reject','save','update','then','destroy','sendStatus','error','stack','name','send','body','params','catch','Action','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x11e2b0,_0x386c82){var _0x1b9672=function(_0x51096d){while(--_0x51096d){_0x11e2b0['push'](_0x11e2b0['shift']());}};_0x1b9672(++_0x386c82);}(_0x9d68,0xce));var _0x89d6=function(_0x2070da,_0x45e586){_0x2070da=_0x2070da-0x0;var _0x4f9fe1=_0x9d68[_0x2070da];return _0x4f9fe1;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x89d6('0x0'));var rimraf=require(_0x89d6('0x1'));var zipdir=require(_0x89d6('0x2'));var jsonpatch=require(_0x89d6('0x3'));var rp=require(_0x89d6('0x4'));var moment=require('moment');var BPromise=require(_0x89d6('0x5'));var Mustache=require(_0x89d6('0x6'));var util=require(_0x89d6('0x7'));var path=require(_0x89d6('0x8'));var sox=require('sox');var csv=require(_0x89d6('0x9'));var ejs=require(_0x89d6('0xa'));var fs=require('fs');var _=require(_0x89d6('0xb'));var squel=require(_0x89d6('0xc'));var crypto=require(_0x89d6('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x89d6('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x89d6('0xf'));var Redis=require(_0x89d6('0x10'));var authService=require(_0x89d6('0x11'));var qs=require(_0x89d6('0x12'));var as=require(_0x89d6('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x89d6('0x14'))(_0x89d6('0x15'));var utils=require(_0x89d6('0x16'));var config=require(_0x89d6('0x17'));var db=require(_0x89d6('0x18'))['db'];function respondWithStatusCode(_0x15507c,_0x19f5dd){_0x19f5dd=_0x19f5dd||0xcc;return function(_0x17caa9){if(_0x17caa9){return _0x15507c['sendStatus'](_0x19f5dd);}return _0x15507c[_0x89d6('0x19')](_0x19f5dd)[_0x89d6('0x1a')]();};}function respondWithResult(_0x257461,_0x32c760){_0x32c760=_0x32c760||0xc8;return function(_0x31bf6f){if(_0x31bf6f){return _0x257461[_0x89d6('0x19')](_0x32c760)[_0x89d6('0x1b')](_0x31bf6f);}};}function respondWithFilteredResult(_0xa13a62,_0x429876){return function(_0x18e9e8){if(_0x18e9e8){var _0xcf13fc=_0x18e9e8[_0x89d6('0x1c')],_0x4403a0=_0x429876['offset'],_0x5ea07c=_0x429876['offset']+_0x429876[_0x89d6('0x1d')],_0x376e30;if(_0x5ea07c>=_0xcf13fc){_0x5ea07c=_0xcf13fc;_0x376e30=0xc8;}else{_0x376e30=0xce;}_0xa13a62[_0x89d6('0x19')](_0x376e30);return _0xa13a62['set'](_0x89d6('0x1e'),_0x4403a0+'-'+_0x5ea07c+'/'+_0xcf13fc)['json'](_0x18e9e8);}return null;};}function patchUpdates(_0x216d48){return function(_0xd8cc77){try{jsonpatch['apply'](_0xd8cc77,_0x216d48,!![]);}catch(_0x5ec196){return BPromise[_0x89d6('0x1f')](_0x5ec196);}return _0xd8cc77[_0x89d6('0x20')]();};}function saveUpdates(_0x572b4a,_0xff4044){return function(_0x482e94){if(_0x482e94){return _0x482e94[_0x89d6('0x21')](_0x572b4a)[_0x89d6('0x22')](function(_0x48c880){return _0x48c880;});}return null;};}function removeEntity(_0xfa821a,_0x7c2a4){return function(_0x536952){if(_0x536952){return _0x536952[_0x89d6('0x23')]()[_0x89d6('0x22')](function(){_0xfa821a[_0x89d6('0x19')](0xcc)[_0x89d6('0x1a')]();});}};}function handleEntityNotFound(_0x3b6846,_0x18fc03){return function(_0xb7c744){if(!_0xb7c744){_0x3b6846[_0x89d6('0x24')](0x194);}return _0xb7c744;};}function handleError(_0x2059e9,_0x3e206a){_0x3e206a=_0x3e206a||0x1f4;return function(_0x5d5d49){logger[_0x89d6('0x25')](_0x5d5d49[_0x89d6('0x26')]);if(_0x5d5d49[_0x89d6('0x27')]){delete _0x5d5d49[_0x89d6('0x27')];}_0x2059e9[_0x89d6('0x19')](_0x3e206a)[_0x89d6('0x28')](_0x5d5d49);};}exports[_0x89d6('0x21')]=function(_0x38649b,_0x4cdfa6){if(_0x38649b[_0x89d6('0x29')]['id']){delete _0x38649b[_0x89d6('0x29')]['id'];}return db['Action']['find']({'where':{'id':_0x38649b[_0x89d6('0x2a')]['id']}})[_0x89d6('0x22')](handleEntityNotFound(_0x4cdfa6,null))[_0x89d6('0x22')](saveUpdates(_0x38649b['body'],null))['then'](respondWithResult(_0x4cdfa6,null))[_0x89d6('0x2b')](handleError(_0x4cdfa6,null));};exports[_0x89d6('0x23')]=function(_0x23757c,_0x4233ee){return db[_0x89d6('0x2c')]['find']({'where':{'id':_0x23757c[_0x89d6('0x2a')]['id']}})['then'](handleEntityNotFound(_0x4233ee,null))[_0x89d6('0x22')](removeEntity(_0x4233ee,null))[_0x89d6('0x2b')](handleError(_0x4233ee,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 2f93dcb..0db1a32 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 _0x3411=['../../config/environment','define','Action','tools_actions','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x4bc599,_0x401afb){var _0x36cd63=function(_0x267060){while(--_0x267060){_0x4bc599['push'](_0x4bc599['shift']());}};_0x36cd63(++_0x401afb);}(_0x3411,0x160));var _0x1341=function(_0x51a9bb,_0x2f60a7){_0x51a9bb=_0x51a9bb-0x0;var _0x348400=_0x3411[_0x51a9bb];return _0x348400;};'use strict';var _=require(_0x1341('0x0'));var util=require(_0x1341('0x1'));var logger=require(_0x1341('0x2'))(_0x1341('0x3'));var moment=require(_0x1341('0x4'));var BPromise=require('bluebird');var rp=require(_0x1341('0x5'));var fs=require('fs');var path=require(_0x1341('0x6'));var rimraf=require(_0x1341('0x7'));var config=require(_0x1341('0x8'));var attributes=require('./action.attributes');module['exports']=function(_0x2e3db0,_0xcbf1d0){return _0x2e3db0[_0x1341('0x9')](_0x1341('0xa'),attributes,{'tableName':_0x1341('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8907=['tools_actions','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment','./action.attributes','Action'];(function(_0x4765ea,_0x19a9f5){var _0x28207a=function(_0x4ff9b0){while(--_0x4ff9b0){_0x4765ea['push'](_0x4765ea['shift']());}};_0x28207a(++_0x19a9f5);}(_0x8907,0x105));var _0x7890=function(_0x3936b7,_0x2c2110){_0x3936b7=_0x3936b7-0x0;var _0x1333db=_0x8907[_0x3936b7];return _0x1333db;};'use strict';var _=require(_0x7890('0x0'));var util=require(_0x7890('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x7890('0x2'));var rp=require(_0x7890('0x3'));var fs=require('fs');var path=require(_0x7890('0x4'));var rimraf=require(_0x7890('0x5'));var config=require(_0x7890('0x6'));var attributes=require(_0x7890('0x7'));module['exports']=function(_0x2d7751,_0x5310ea){return _0x2d7751['define'](_0x7890('0x8'),attributes,{'tableName':_0x7890('0x9'),'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 4674623..1eb76f3 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 _0xcb91=['stringify','error','code','message','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s'];(function(_0xf4c45a,_0xe90f7){var _0x6d293=function(_0x1eef5d){while(--_0x1eef5d){_0xf4c45a['push'](_0xf4c45a['shift']());}};_0x6d293(++_0xe90f7);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x166e96,_0x55191d){_0x166e96=_0x166e96-0x0;var _0x553d73=_0xcb91[_0x166e96];return _0x553d73;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1cb9('0x0'));var BPromise=require(_0x1cb9('0x1'));var rs=require(_0x1cb9('0x2'));var fs=require('fs');var Redis=require(_0x1cb9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1cb9('0x4'));var logger=require(_0x1cb9('0x5'))('rpc');var config=require(_0x1cb9('0x6'));var jayson=require(_0x1cb9('0x7'));var client=jayson['client'][_0x1cb9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3f7deb,_0x4ffe20,_0x38737d){return new BPromise(function(_0x12567c,_0x59d1be){return client[_0x1cb9('0x9')](_0x3f7deb,_0x38737d)['then'](function(_0x567139){logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,_0x1cb9('0xc'));logger[_0x1cb9('0xd')](_0x1cb9('0xe'),_0x4ffe20,'request\x20sent',JSON[_0x1cb9('0xf')](_0x567139));if(_0x567139[_0x1cb9('0x10')]){if(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x11')]===0x1f4){logger[_0x1cb9('0x10')]('Action,\x20%s,\x20%s',_0x4ffe20,_0x567139['error']['message']);return _0x59d1be(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x567139['error'][_0x1cb9('0x12')]);return _0x12567c(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}else{logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,'request\x20sent');_0x12567c(_0x567139['result'][_0x1cb9('0x12')]);}})[_0x1cb9('0x13')](function(_0x3904b7){logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x3904b7);_0x59d1be(_0x3904b7);});});} \ No newline at end of file +var _0xb7e7=['Action,\x20%s,\x20%s','debug','Action,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','then','info'];(function(_0x38d0c1,_0x18b29e){var _0x326e15=function(_0x46f232){while(--_0x46f232){_0x38d0c1['push'](_0x38d0c1['shift']());}};_0x326e15(++_0x18b29e);}(_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 moment=require(_0x7b7e('0x1'));var BPromise=require('bluebird');var rs=require(_0x7b7e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7b7e('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x7b7e('0x4'))(_0x7b7e('0x5'));var config=require(_0x7b7e('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7b7e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x372bde,_0x7f87e0,_0x55ce81){return new BPromise(function(_0x42b871,_0x223587){return client[_0x7b7e('0x8')](_0x372bde,_0x55ce81)[_0x7b7e('0x9')](function(_0x148964){logger[_0x7b7e('0xa')](_0x7b7e('0xb'),_0x7f87e0,'request\x20sent');logger[_0x7b7e('0xc')](_0x7b7e('0xd'),_0x7f87e0,_0x7b7e('0xe'),JSON[_0x7b7e('0xf')](_0x148964));if(_0x148964[_0x7b7e('0x10')]){if(_0x148964[_0x7b7e('0x10')][_0x7b7e('0x11')]===0x1f4){logger[_0x7b7e('0x10')](_0x7b7e('0xb'),_0x7f87e0,_0x148964['error'][_0x7b7e('0x12')]);return _0x223587(_0x148964[_0x7b7e('0x10')]['message']);}logger[_0x7b7e('0x10')]('Action,\x20%s,\x20%s',_0x7f87e0,_0x148964['error'][_0x7b7e('0x12')]);return _0x42b871(_0x148964[_0x7b7e('0x10')][_0x7b7e('0x12')]);}else{logger[_0x7b7e('0xa')](_0x7b7e('0xb'),_0x7f87e0,'request\x20sent');_0x42b871(_0x148964['result'][_0x7b7e('0x12')]);}})[_0x7b7e('0x13')](function(_0x27f999){logger[_0x7b7e('0x10')](_0x7b7e('0xb'),_0x7f87e0,_0x27f999);_0x223587(_0x27f999);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index fe68c7f..0ec1dd8 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 _0xc14c=['destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','put','/:id','isAuthenticated','update'];(function(_0x5dc098,_0x1fc061){var _0x187d9c=function(_0x1eddca){while(--_0x1eddca){_0x5dc098['push'](_0x5dc098['shift']());}};_0x187d9c(++_0x1fc061);}(_0xc14c,0x1cf));var _0xcc14=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xc14c[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0xcc14('0x0'));var util=require(_0xcc14('0x1'));var path=require(_0xcc14('0x2'));var timeout=require(_0xcc14('0x3'));var express=require(_0xcc14('0x4'));var router=express[_0xcc14('0x5')]();var auth=require(_0xcc14('0x6'));var interaction=require(_0xcc14('0x7'));var config=require(_0xcc14('0x8'));var controller=require('./action.controller');router[_0xcc14('0x9')](_0xcc14('0xa'),auth[_0xcc14('0xb')](),controller[_0xcc14('0xc')]);router['delete']('/:id',auth[_0xcc14('0xb')](),controller[_0xcc14('0xd')]);module['exports']=router; \ No newline at end of file +var _0x98a1=['path','express','Router','../../components/auth/service','../../components/interaction/service','./action.controller','put','/:id','isAuthenticated','update','delete','destroy','exports','multer','util'];(function(_0x27925e,_0x56b325){var _0x43e197=function(_0x336181){while(--_0x336181){_0x27925e['push'](_0x27925e['shift']());}};_0x43e197(++_0x56b325);}(_0x98a1,0x1cf));var _0x198a=function(_0x13a6a4,_0x2b4fd6){_0x13a6a4=_0x13a6a4-0x0;var _0x1dd518=_0x98a1[_0x13a6a4];return _0x1dd518;};'use strict';var multer=require(_0x198a('0x0'));var util=require(_0x198a('0x1'));var path=require(_0x198a('0x2'));var timeout=require('connect-timeout');var express=require(_0x198a('0x3'));var router=express[_0x198a('0x4')]();var auth=require(_0x198a('0x5'));var interaction=require(_0x198a('0x6'));var config=require('../../config/environment');var controller=require(_0x198a('0x7'));router[_0x198a('0x8')](_0x198a('0x9'),auth[_0x198a('0xa')](),controller[_0x198a('0xb')]);router[_0x198a('0xc')](_0x198a('0x9'),auth[_0x198a('0xa')](),controller[_0x198a('0xd')]);module[_0x198a('0xe')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index 986b762..63d78f6 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 _0x219f=['STRING','TEXT','sequelize','exports'];(function(_0x1bea94,_0x264b1f){var _0x7d1695=function(_0xef1ca5){while(--_0xef1ca5){_0x1bea94['push'](_0x1bea94['shift']());}};_0x7d1695(++_0x264b1f);}(_0x219f,0xb2));var _0xf219=function(_0x1ae2b2,_0x18f2e2){_0x1ae2b2=_0x1ae2b2-0x0;var _0x4c1746=_0x219f[_0x1ae2b2];return _0x4c1746;};'use strict';var Sequelize=require(_0xf219('0x0'));module[_0xf219('0x1')]={'name':{'type':Sequelize[_0xf219('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xf219('0x2')]},'parent':{'type':Sequelize[_0xf219('0x2')]},'table':{'type':Sequelize[_0xf219('0x2')]},'conditions':{'type':Sequelize[_0xf219('0x3')]},'joins':{'type':Sequelize[_0xf219('0x3')]}}; \ No newline at end of file +var _0xd263=['TEXT','exports','STRING'];(function(_0x4e1156,_0x2b860b){var _0x266ba3=function(_0x93d5a){while(--_0x93d5a){_0x4e1156['push'](_0x4e1156['shift']());}};_0x266ba3(++_0x2b860b);}(_0xd263,0x1db));var _0x3d26=function(_0x25ce4f,_0xad7194){_0x25ce4f=_0x25ce4f-0x0;var _0x3de67c=_0xd263[_0x25ce4f];return _0x3de67c;};'use strict';var Sequelize=require('sequelize');module[_0x3d26('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x3d26('0x1')]},'parent':{'type':Sequelize[_0x3d26('0x1')]},'table':{'type':Sequelize[_0x3d26('0x1')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0x3d26('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index 26348e6..9e5a65c 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 _0x1b31=['index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','merge','VIRTUAL','AnalyticCustomReport','count','include','findAll','rows','catch','params','length','includeAll','options','body','get','role','user','Reports','UserProfileSection','find','userProfileId','autoAssociation','create','CustomReports','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','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','operator','field','condition','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','table','MetricId','metric','function','replace','format','groupBy','group','DESC','alias','joins','parse','parentKey','foreignTable','foreignKey','conditions','toString','sequelize','QueryTypes','SELECT','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','select','from','orderBy','clone','Limited\x20Query:','output','web','fullPath','%s-%s.%s','generate','csv','custom','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','COUNT(*)','run','runReport','%s.%s\x20=\x20%s.%s','debug','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','limit','set','Content-Range','reject','save','update','then','destroy','stack','name','send'];(function(_0x460590,_0xb2d2ab){var _0x123854=function(_0x30e0da){while(--_0x30e0da){_0x460590['push'](_0x460590['shift']());}};_0x123854(++_0xb2d2ab);}(_0x1b31,0x7e));var _0x11b3=function(_0x267f1a,_0x48953c){_0x267f1a=_0x267f1a-0x0;var _0x54da21=_0x1b31[_0x267f1a];return _0x54da21;};'use strict';var pdf=require(_0x11b3('0x0'));var emlformat=require(_0x11b3('0x1'));var rimraf=require(_0x11b3('0x2'));var zipdir=require(_0x11b3('0x3'));var jsonpatch=require(_0x11b3('0x4'));var rp=require(_0x11b3('0x5'));var moment=require(_0x11b3('0x6'));var BPromise=require(_0x11b3('0x7'));var Mustache=require(_0x11b3('0x8'));var util=require('util');var path=require(_0x11b3('0x9'));var sox=require(_0x11b3('0xa'));var csv=require(_0x11b3('0xb'));var ejs=require(_0x11b3('0xc'));var fs=require('fs');var _=require(_0x11b3('0xd'));var squel=require(_0x11b3('0xe'));var crypto=require('crypto');var jsforce=require(_0x11b3('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x11b3('0xb'));var querystring=require(_0x11b3('0x10'));var Papa=require('papaparse');var Redis=require(_0x11b3('0x11'));var authService=require(_0x11b3('0x12'));var qs=require(_0x11b3('0x13'));var as=require(_0x11b3('0x14'));var hardwareService=require(_0x11b3('0x15'));var logger=require(_0x11b3('0x16'))(_0x11b3('0x17'));var utils=require(_0x11b3('0x18'));var config=require(_0x11b3('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xf5401c,_0x5bd020){_0x5bd020=_0x5bd020||0xcc;return function(_0x1b83bc){if(_0x1b83bc){return _0xf5401c[_0x11b3('0x1a')](_0x5bd020);}return _0xf5401c[_0x11b3('0x1b')](_0x5bd020)[_0x11b3('0x1c')]();};}function respondWithResult(_0x2cb113,_0x516839){_0x516839=_0x516839||0xc8;return function(_0x2d59e1){if(_0x2d59e1){return _0x2cb113['status'](_0x516839)[_0x11b3('0x1d')](_0x2d59e1);}};}function respondWithFilteredResult(_0x5ee968,_0x3e90da){return function(_0x3ca712){if(_0x3ca712){var _0x20c956=_0x3ca712['count'],_0x47897e=_0x3e90da['offset'],_0x2aed94=_0x3e90da[_0x11b3('0x1e')]+_0x3e90da[_0x11b3('0x1f')],_0x3b92f8;if(_0x2aed94>=_0x20c956){_0x2aed94=_0x20c956;_0x3b92f8=0xc8;}else{_0x3b92f8=0xce;}_0x5ee968['status'](_0x3b92f8);return _0x5ee968[_0x11b3('0x20')](_0x11b3('0x21'),_0x47897e+'-'+_0x2aed94+'/'+_0x20c956)[_0x11b3('0x1d')](_0x3ca712);}return null;};}function patchUpdates(_0x3d0cd3){return function(_0x30e851){try{jsonpatch['apply'](_0x30e851,_0x3d0cd3,!![]);}catch(_0x48001d){return BPromise[_0x11b3('0x22')](_0x48001d);}return _0x30e851[_0x11b3('0x23')]();};}function saveUpdates(_0x494c44,_0x2c9a09){return function(_0x26e485){if(_0x26e485){return _0x26e485[_0x11b3('0x24')](_0x494c44)[_0x11b3('0x25')](function(_0x37da93){return _0x37da93;});}return null;};}function removeEntity(_0x117c2c,_0x1598ed){return function(_0x16e774){if(_0x16e774){return _0x16e774['destroy']()[_0x11b3('0x25')](function(){var _0x48d288=_0x16e774['get']({'plain':!![]});var _0xdbe55d='CustomReports';return db['UserProfileResource'][_0x11b3('0x26')]({'where':{'type':_0xdbe55d,'resourceId':_0x48d288['id']}})[_0x11b3('0x25')](function(){return _0x16e774;});})[_0x11b3('0x25')](function(){_0x117c2c['status'](0xcc)[_0x11b3('0x1c')]();});}};}function handleEntityNotFound(_0x5c52c7,_0x1e3f48){return function(_0x455aef){if(!_0x455aef){_0x5c52c7[_0x11b3('0x1a')](0x194);}return _0x455aef;};}function handleError(_0x1daa65,_0x5e3b71){_0x5e3b71=_0x5e3b71||0x1f4;return function(_0x5f4c84){logger['error'](_0x5f4c84[_0x11b3('0x27')]);if(_0x5f4c84['name']){delete _0x5f4c84[_0x11b3('0x28')];}_0x1daa65['status'](_0x5e3b71)[_0x11b3('0x29')](_0x5f4c84);};}exports[_0x11b3('0x2a')]=function(_0x476f68,_0xdb7902){var _0x2f1ac6={},_0x196116={},_0x26a378={'count':0x0,'rows':[]};var _0x13d9ed=_[_0x11b3('0x2b')](db['AnalyticCustomReport'][_0x11b3('0x2c')],function(_0x41a8e9){return{'name':_0x41a8e9[_0x11b3('0x2d')],'type':_0x41a8e9[_0x11b3('0x2e')][_0x11b3('0x2f')]};});_0x196116[_0x11b3('0x30')]=_[_0x11b3('0x2b')](_0x13d9ed,_0x11b3('0x28'));_0x196116[_0x11b3('0x31')]=_[_0x11b3('0x32')](_0x476f68[_0x11b3('0x31')]);_0x196116[_0x11b3('0x33')]=_[_0x11b3('0x34')](_0x196116[_0x11b3('0x30')],_0x196116[_0x11b3('0x31')]);_0x2f1ac6[_0x11b3('0x35')]=_[_0x11b3('0x34')](_0x196116['model'],qs[_0x11b3('0x36')](_0x476f68[_0x11b3('0x31')]['fields']));_0x2f1ac6[_0x11b3('0x35')]=_0x2f1ac6[_0x11b3('0x35')]['length']?_0x2f1ac6[_0x11b3('0x35')]:_0x196116[_0x11b3('0x30')];if(!_0x476f68[_0x11b3('0x31')]['hasOwnProperty'](_0x11b3('0x37'))){_0x2f1ac6['limit']=qs[_0x11b3('0x1f')](_0x476f68[_0x11b3('0x31')]['limit']);_0x2f1ac6['offset']=qs['offset'](_0x476f68['query'][_0x11b3('0x1e')]);}_0x2f1ac6[_0x11b3('0x38')]=qs[_0x11b3('0x39')](_0x476f68[_0x11b3('0x31')][_0x11b3('0x39')]);_0x2f1ac6[_0x11b3('0x3a')]=qs[_0x11b3('0x33')](_[_0x11b3('0x3b')](_0x476f68['query'],_0x196116[_0x11b3('0x33')]));if(_0x476f68['query']['filter']){_0x2f1ac6['where']=_[_0x11b3('0x3c')](_0x2f1ac6[_0x11b3('0x3a')],{'$or':_[_0x11b3('0x2b')](_0x13d9ed,function(_0x10562d){if(_0x10562d[_0x11b3('0x2e')]!==_0x11b3('0x3d')){var _0x3536ca={};_0x3536ca[_0x10562d[_0x11b3('0x28')]]={'$like':'%'+_0x476f68[_0x11b3('0x31')]['filter']+'%'};return _0x3536ca;}})});}_0x2f1ac6=_[_0x11b3('0x3c')]({},_0x2f1ac6,_0x476f68['options']);var _0x1b09d1={'where':_0x2f1ac6['where']};return db[_0x11b3('0x3e')][_0x11b3('0x3f')](_0x1b09d1)[_0x11b3('0x25')](function(_0x26a918){_0x26a378[_0x11b3('0x3f')]=_0x26a918;if(_0x476f68[_0x11b3('0x31')]['includeAll']){_0x2f1ac6[_0x11b3('0x40')]=[{'all':!![]}];}return db[_0x11b3('0x3e')][_0x11b3('0x41')](_0x2f1ac6);})[_0x11b3('0x25')](function(_0x41624f){_0x26a378[_0x11b3('0x42')]=_0x41624f;return _0x26a378;})[_0x11b3('0x25')](respondWithFilteredResult(_0xdb7902,_0x2f1ac6))[_0x11b3('0x43')](handleError(_0xdb7902,null));};exports['show']=function(_0x10f7ba,_0x33135f){var _0x27bdc7={'raw':![],'where':{'id':_0x10f7ba[_0x11b3('0x44')]['id']}},_0x5954c6={};_0x5954c6[_0x11b3('0x30')]=_[_0x11b3('0x32')](db[_0x11b3('0x3e')][_0x11b3('0x2c')]);_0x5954c6[_0x11b3('0x31')]=_['keys'](_0x10f7ba[_0x11b3('0x31')]);_0x5954c6['filters']=_['intersection'](_0x5954c6[_0x11b3('0x30')],_0x5954c6[_0x11b3('0x31')]);_0x27bdc7['attributes']=_[_0x11b3('0x34')](_0x5954c6[_0x11b3('0x30')],qs[_0x11b3('0x36')](_0x10f7ba[_0x11b3('0x31')][_0x11b3('0x36')]));_0x27bdc7['attributes']=_0x27bdc7[_0x11b3('0x35')][_0x11b3('0x45')]?_0x27bdc7['attributes']:_0x5954c6[_0x11b3('0x30')];if(_0x10f7ba[_0x11b3('0x31')][_0x11b3('0x46')]){_0x27bdc7[_0x11b3('0x40')]=[{'all':!![]}];}_0x27bdc7=_[_0x11b3('0x3c')]({},_0x27bdc7,_0x10f7ba[_0x11b3('0x47')]);return db['AnalyticCustomReport']['find'](_0x27bdc7)[_0x11b3('0x25')](handleEntityNotFound(_0x33135f,null))[_0x11b3('0x25')](respondWithResult(_0x33135f,null))['catch'](handleError(_0x33135f,null));};exports['create']=function(_0x44c7bd,_0x149abe){return db[_0x11b3('0x3e')]['create'](_0x44c7bd[_0x11b3('0x48')],{})[_0x11b3('0x25')](function(_0x460b50){var _0x12cc90=_0x44c7bd['user'][_0x11b3('0x49')]({'plain':!![]});if(!_0x12cc90)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x12cc90[_0x11b3('0x4a')]===_0x11b3('0x4b')){var _0x334888=_0x460b50['get']({'plain':!![]});var _0x365c1d=_0x11b3('0x4c');return db[_0x11b3('0x4d')][_0x11b3('0x4e')]({'where':{'name':_0x365c1d,'userProfileId':_0x12cc90[_0x11b3('0x4f')]},'raw':!![]})['then'](function(_0x5f3290){if(_0x5f3290&&_0x5f3290[_0x11b3('0x50')]===0x0){return db['UserProfileResource'][_0x11b3('0x51')]({'name':_0x334888[_0x11b3('0x28')],'resourceId':_0x334888['id'],'type':_0x11b3('0x52'),'sectionId':_0x5f3290['id']},{})[_0x11b3('0x25')](function(){return _0x460b50;});}else{return _0x460b50;}})[_0x11b3('0x43')](function(_0x36e9e1){logger[_0x11b3('0x53')](_0x11b3('0x54'),_0x36e9e1);throw _0x36e9e1;});}return _0x460b50;})[_0x11b3('0x25')](respondWithResult(_0x149abe,0xc9))[_0x11b3('0x43')](handleError(_0x149abe,null));};exports[_0x11b3('0x24')]=function(_0x1ae886,_0x478de5){if(_0x1ae886[_0x11b3('0x48')]['id']){delete _0x1ae886[_0x11b3('0x48')]['id'];}return db[_0x11b3('0x3e')][_0x11b3('0x4e')]({'where':{'id':_0x1ae886['params']['id']}})['then'](handleEntityNotFound(_0x478de5,null))['then'](saveUpdates(_0x1ae886[_0x11b3('0x48')],null))['then'](respondWithResult(_0x478de5,null))[_0x11b3('0x43')](handleError(_0x478de5,null));};exports[_0x11b3('0x26')]=function(_0x4357fa,_0x3f943c){return db[_0x11b3('0x3e')][_0x11b3('0x4e')]({'where':{'id':_0x4357fa[_0x11b3('0x44')]['id']}})[_0x11b3('0x25')](handleEntityNotFound(_0x3f943c,null))['then'](removeEntity(_0x3f943c,null))[_0x11b3('0x43')](handleError(_0x3f943c,null));};exports[_0x11b3('0x55')]=function(_0x54c1c1,_0x46c046){var _0x23f386=0xa;var _0x2d8779=[_0x11b3('0x56'),_0x11b3('0x57'),_0x11b3('0x58'),_0x11b3('0x59')];var _0x37dd42={'SUM':_0x11b3('0x5a'),'COUNT':_0x11b3('0x5b'),'COUNT DISTINCT':_0x11b3('0x5c'),'MAX':_0x11b3('0x5d'),'MIN':_0x11b3('0x5e'),'AVG':_0x11b3('0x5f'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x11b3('0x60'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x30f081={'SEC_TO_TIME':_0x11b3('0x61'),'DATE':_0x11b3('0x62'),'HOUR':_0x11b3('0x63'),'ROUND':_0x11b3('0x64'),'UNIX_TIMESTAMP':_0x11b3('0x65')};var _0xb6396a=function(_0x327feb){return!_[_0x11b3('0x66')]([_0x11b3('0x67'),_0x11b3('0x68'),_0x11b3('0x69'),_0x11b3('0x6a')],_0x327feb);};var _0x133228=function(_0x2511aa){if(!_0x2511aa||!_0x2511aa[_0x11b3('0x6b')]['length']){return'';}for(var _0x48af38='(',_0x3f85ff=0x0;_0x3f85ff<_0x2511aa[_0x11b3('0x6b')][_0x11b3('0x45')];_0x3f85ff+=0x1){_0x3f85ff>0x0&&(_0x48af38+='\x20'+_0x2511aa[_0x11b3('0x6c')]+'\x20');_0x48af38+=_0x2511aa['rules'][_0x3f85ff]['group']?_0x133228(_0x2511aa[_0x11b3('0x6b')][_0x3f85ff]['group']):_0x2511aa[_0x11b3('0x6b')][_0x3f85ff][_0x11b3('0x6d')]+'\x20'+_0x2511aa[_0x11b3('0x6b')][_0x3f85ff][_0x11b3('0x6e')]+(_0xb6396a(_0x2511aa[_0x11b3('0x6b')][_0x3f85ff]['condition'])?'\x20'+_0x2511aa[_0x11b3('0x6b')][_0x3f85ff]['value']:'');}return _0x48af38+')';};var _0x3f9353={'where':{'id':_0x54c1c1['params']['id']}},_0x1d5da2,_0x1c208d,_0x1a1c59,_0xe9674d,_0x5c39c9;_0x3f9353=_[_0x11b3('0x3c')]({},_0x3f9353,_0x54c1c1[_0x11b3('0x47')]);return db[_0x11b3('0x3e')][_0x11b3('0x4e')](_0x3f9353)['then'](function(_0x1ec1b5){if(_0x1ec1b5){_0x1d5da2=_0x1ec1b5;return _0x1ec1b5[_0x11b3('0x6f')]();}return null;})[_0x11b3('0x25')](function(_0xa087c5){if(_0xa087c5){if(!_0xa087c5[_0x11b3('0x45')]){throw new db[(_0x11b3('0x70'))][(_0x11b3('0x71'))](_0x11b3('0x72'),0x193);}_0x1c208d=_0xa087c5;return db[_0x11b3('0x73')][_0x11b3('0x41')]({'raw':!![]});}return null;})[_0x11b3('0x25')](function(_0x573fbe){if(_0x573fbe){_0x1a1c59=_[_0x11b3('0x74')](_0x573fbe,'id');var _0x5e7a5b;var _0xe27e39=squel['select']();_0xe27e39['from'](_0x1d5da2[_0x11b3('0x75')]);for(var _0x6bbed6=0x0;_0x6bbed6<_0x1c208d[_0x11b3('0x45')];_0x6bbed6+=0x1){_0x5e7a5b=_0x1c208d[_0x6bbed6][_0x11b3('0x76')]?_0x1a1c59[_0x1c208d[_0x6bbed6]['MetricId']][_0x11b3('0x77')]:_0x1c208d[_0x6bbed6]['field'];_0x5e7a5b=_0x1c208d[_0x6bbed6][_0x11b3('0x78')]?_[_0x11b3('0x79')](_0x37dd42[_0x1c208d[_0x6bbed6][_0x11b3('0x78')]],'%s',_0x5e7a5b):_0x5e7a5b;_0x5e7a5b=_0x1c208d[_0x6bbed6]['format']?_['replace'](_0x30f081[_0x1c208d[_0x6bbed6][_0x11b3('0x7a')]],'%s',_0x5e7a5b):_0x5e7a5b;if(_0x1c208d[_0x6bbed6][_0x11b3('0x7b')]){_0xe27e39[_0x11b3('0x7c')](_0x5e7a5b);}_0x1c208d[_0x6bbed6]['orderBy']&&_0xe27e39[_0x11b3('0x38')](_0x5e7a5b,_0x1c208d[_0x6bbed6]['orderBy']===_0x11b3('0x7d')?![]:!![]);_0xe27e39[_0x11b3('0x6d')](_0x5e7a5b,_0x1c208d[_0x6bbed6][_0x11b3('0x7e')]||_0x5e7a5b);}if(_0x1d5da2['joins']){_0x1d5da2[_0x11b3('0x7f')]=JSON[_0x11b3('0x80')](_0x1d5da2[_0x11b3('0x7f')]);for(var _0x421f80=0x0;_0x421f80<_0x1d5da2[_0x11b3('0x7f')]['length'];_0x421f80+=0x1){if(_0x1d5da2[_0x11b3('0x7f')][_0x421f80][_0x11b3('0x2e')]&&_[_0x11b3('0x66')](_0x2d8779,_0x1d5da2[_0x11b3('0x7f')][_0x421f80][_0x11b3('0x2e')])&&_0x1d5da2[_0x11b3('0x7f')][_0x421f80][_0x11b3('0x81')]&&_0x1d5da2['joins'][_0x421f80][_0x11b3('0x82')]&&_0x1d5da2[_0x11b3('0x7f')][_0x421f80][_0x11b3('0x83')]){_0xe27e39[_0x1d5da2['joins'][_0x421f80][_0x11b3('0x2e')]](_0x1d5da2[_0x11b3('0x7f')][_0x421f80][_0x11b3('0x82')],null,util[_0x11b3('0x7a')]('%s.%s\x20=\x20%s.%s',_0x1d5da2['table'],_0x1d5da2[_0x11b3('0x7f')][_0x421f80][_0x11b3('0x81')],_0x1d5da2[_0x11b3('0x7f')][_0x421f80][_0x11b3('0x82')],_0x1d5da2[_0x11b3('0x7f')][_0x421f80]['foreignKey']));}}}if(_0x1d5da2['conditions']){_0x1d5da2[_0x11b3('0x84')]=JSON[_0x11b3('0x80')](_0x1d5da2[_0x11b3('0x84')]);_0xe27e39[_0x11b3('0x3a')](_0x133228(_0x1d5da2[_0x11b3('0x84')][_0x11b3('0x7c')]));}_0x5c39c9=_0xe27e39['clone']();_0xe27e39[_0x11b3('0x1f')](_0x23f386);_0xe27e39[_0x11b3('0x1e')](0x0);logger['debug']('Limited\x20Query:',_0xe27e39[_0x11b3('0x85')]());return db[_0x11b3('0x86')][_0x11b3('0x31')](_0xe27e39[_0x11b3('0x85')](),{'type':db[_0x11b3('0x86')][_0x11b3('0x87')][_0x11b3('0x88')]});}})[_0x11b3('0x25')](respondWithResult(_0x46c046,null))[_0x11b3('0x43')](handleError(_0x46c046,null));};function runReport(_0x123d86,_0x112332,_0x438b8f){var _0xc6726e=_0x112332[_0x11b3('0x28')];var _0x30a3bb=0xa;var _0x2cde6e=[_0x11b3('0x56'),_0x11b3('0x57'),_0x11b3('0x58'),_0x11b3('0x59')];var _0x2aa810={'SUM':_0x11b3('0x5a'),'COUNT':_0x11b3('0x5b'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0x11b3('0x5e'),'AVG':_0x11b3('0x5f'),'GROUP_CONCAT':_0x11b3('0x89'),'GROUP_CONCAT ASC':_0x11b3('0x60'),'GROUP_CONCAT DESC':_0x11b3('0x8a')};var _0x3cbeb5={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x11b3('0x62'),'HOUR':_0x11b3('0x63'),'ROUND':_0x11b3('0x64'),'UNIX_TIMESTAMP':_0x11b3('0x65')};var _0x36c3d0=function(_0x32dd58){return!_['includes']([_0x11b3('0x67'),_0x11b3('0x68'),_0x11b3('0x69'),_0x11b3('0x6a')],_0x32dd58);};var _0x40dae9=function(_0x595723){if(!_0x595723||!_0x595723[_0x11b3('0x6b')][_0x11b3('0x45')]){return'';}for(var _0x3306f1='(',_0x31d588=0x0;_0x31d588<_0x595723[_0x11b3('0x6b')][_0x11b3('0x45')];_0x31d588+=0x1){_0x31d588>0x0&&(_0x3306f1+='\x20'+_0x595723[_0x11b3('0x6c')]+'\x20');_0x3306f1+=_0x595723[_0x11b3('0x6b')][_0x31d588]['group']?_0x40dae9(_0x595723['rules'][_0x31d588]['group']):_0x595723[_0x11b3('0x6b')][_0x31d588][_0x11b3('0x6d')]+'\x20'+_0x595723[_0x11b3('0x6b')][_0x31d588][_0x11b3('0x6e')]+(_0x36c3d0(_0x595723[_0x11b3('0x6b')][_0x31d588][_0x11b3('0x6e')])?'\x20'+_0x595723['rules'][_0x31d588]['value']:'');}return _0x3306f1+')';};var _0x41efa3={'where':{'id':_0x123d86['id']}},_0x2d4aec,_0x3a5ae8,_0x126a71,_0x5f2f4b,_0x56234c;_0x41efa3=_['merge']({},_0x41efa3,_0x438b8f);return db[_0x11b3('0x3e')][_0x11b3('0x4e')](_0x41efa3)['then'](function(_0x49f2e1){if(_0x49f2e1){_0x2d4aec=_0x49f2e1;return _0x49f2e1[_0x11b3('0x6f')]();}return null;})['then'](function(_0x6f26d7){if(_0x6f26d7){if(!_0x6f26d7[_0x11b3('0x45')]){throw new db[(_0x11b3('0x70'))][(_0x11b3('0x71'))](_0x11b3('0x72'),0x193);}_0x3a5ae8=_0x6f26d7;return db['AnalyticMetric'][_0x11b3('0x41')]({'raw':!![]});}return null;})[_0x11b3('0x25')](function(_0x533ff5){if(_0x533ff5){_0x126a71=_[_0x11b3('0x74')](_0x533ff5,'id');var _0x55c138;var _0x53ae4d=squel[_0x11b3('0x8b')]();_0x53ae4d[_0x11b3('0x8c')](_0x2d4aec['table']);for(var _0x54b6d6=0x0;_0x54b6d6<_0x3a5ae8[_0x11b3('0x45')];_0x54b6d6+=0x1){_0x55c138=_0x3a5ae8[_0x54b6d6][_0x11b3('0x76')]?_0x126a71[_0x3a5ae8[_0x54b6d6]['MetricId']][_0x11b3('0x77')]:_0x3a5ae8[_0x54b6d6][_0x11b3('0x6d')];_0x55c138=_0x3a5ae8[_0x54b6d6][_0x11b3('0x78')]?_[_0x11b3('0x79')](_0x2aa810[_0x3a5ae8[_0x54b6d6][_0x11b3('0x78')]],'%s',_0x55c138):_0x55c138;_0x55c138=_0x3a5ae8[_0x54b6d6]['format']?_[_0x11b3('0x79')](_0x3cbeb5[_0x3a5ae8[_0x54b6d6][_0x11b3('0x7a')]],'%s',_0x55c138):_0x55c138;if(_0x3a5ae8[_0x54b6d6][_0x11b3('0x7b')]){_0x53ae4d[_0x11b3('0x7c')](_0x55c138);}_0x3a5ae8[_0x54b6d6][_0x11b3('0x8d')]&&_0x53ae4d[_0x11b3('0x38')](_0x55c138,_0x3a5ae8[_0x54b6d6][_0x11b3('0x8d')]==='DESC'?![]:!![]);_0x53ae4d[_0x11b3('0x6d')](_0x55c138,_0x3a5ae8[_0x54b6d6][_0x11b3('0x7e')]||_0x55c138);}if(_0x2d4aec[_0x11b3('0x7f')]){_0x2d4aec[_0x11b3('0x7f')]=JSON[_0x11b3('0x80')](_0x2d4aec[_0x11b3('0x7f')]);for(var _0x27203e=0x0;_0x27203e<_0x2d4aec[_0x11b3('0x7f')][_0x11b3('0x45')];_0x27203e+=0x1){if(_0x2d4aec['joins'][_0x27203e][_0x11b3('0x2e')]&&_['includes'](_0x2cde6e,_0x2d4aec[_0x11b3('0x7f')][_0x27203e]['type'])&&_0x2d4aec['joins'][_0x27203e][_0x11b3('0x81')]&&_0x2d4aec[_0x11b3('0x7f')][_0x27203e][_0x11b3('0x82')]&&_0x2d4aec['joins'][_0x27203e][_0x11b3('0x83')]){_0x53ae4d[_0x2d4aec['joins'][_0x27203e]['type']](_0x2d4aec[_0x11b3('0x7f')][_0x27203e][_0x11b3('0x82')],null,util['format']('%s.%s\x20=\x20%s.%s',_0x2d4aec[_0x11b3('0x75')],_0x2d4aec[_0x11b3('0x7f')][_0x27203e]['parentKey'],_0x2d4aec[_0x11b3('0x7f')][_0x27203e][_0x11b3('0x82')],_0x2d4aec['joins'][_0x27203e]['foreignKey']));}}}if(_0x2d4aec['conditions']){_0x2d4aec[_0x11b3('0x84')]=JSON[_0x11b3('0x80')](_0x2d4aec[_0x11b3('0x84')]);_0x53ae4d[_0x11b3('0x3a')](_0x40dae9(_0x2d4aec['conditions'][_0x11b3('0x7c')]));}_0x56234c=_0x53ae4d[_0x11b3('0x8e')]();_0x53ae4d[_0x11b3('0x1f')](_0x30a3bb);_0x53ae4d[_0x11b3('0x1e')](0x0);logger['debug'](_0x11b3('0x8f'),_0x53ae4d[_0x11b3('0x85')]());return db[_0x11b3('0x86')][_0x11b3('0x31')](_0x53ae4d[_0x11b3('0x85')](),{'type':db[_0x11b3('0x86')][_0x11b3('0x87')]['SELECT']});}})[_0x11b3('0x25')](function(_0x224576){if(!_0x224576['length']){throw new db['Sequelize'][(_0x11b3('0x71'))]('No\x20available\x20data',0xcc);}if(_0x112332[_0x11b3('0x90')]===_0x11b3('0x91')){return null;}var _0x4ce360=_[_0x11b3('0x3c')](_0x112332,{'name':_0x112332[_0x11b3('0x92')]||_0x112332[_0x11b3('0x28')]||_0x2d4aec[_0x11b3('0x28')],'basename':_0xc6726e,'savename':util[_0x11b3('0x7a')](_0x11b3('0x93'),_0x112332[_0x11b3('0x28')]||_0x2d4aec['name'],require('randomstring')[_0x11b3('0x94')](0x4),_0x112332[_0x11b3('0x90')]||_0x11b3('0x95')),'reportId':_0x2d4aec['id'],'reportType':_0x11b3('0x96')});return db['AnalyticExtractedReport']['create'](_0x4ce360,{'raw':!![]});})[_0x11b3('0x25')](function(_0x5cb1ed){if(_0x2d4aec[_0x11b3('0x75')]===_0x11b3('0x97')){_0x56234c['where'](_0x2d4aec[_0x11b3('0x75')]+_0x11b3('0x98'),_0x112332[_0x11b3('0x99')],_0x112332[_0x11b3('0x9a')]);}else{_0x56234c[_0x11b3('0x3a')](_0x2d4aec[_0x11b3('0x75')]+_0x11b3('0x9b'),_0x112332[_0x11b3('0x99')],_0x112332[_0x11b3('0x9a')]);}if(_0x5cb1ed){logger[_0x11b3('0x9c')](_0x11b3('0x9d'),_0x56234c[_0x11b3('0x85')]());require(_0x11b3('0x9e'))[_0x11b3('0x9f')](path[_0x11b3('0x56')](__dirname,_0x11b3('0xa0'),_0x5cb1ed[_0x11b3('0x90')]),[_0x5cb1ed['id'],_0x56234c[_0x11b3('0x85')](),path[_0x11b3('0x56')](__dirname,_0x11b3('0xa1'),_0x5cb1ed[_0x11b3('0xa2')]),_0xc6726e]);return _0x5cb1ed;}else{var _0x25aeea=squel[_0x11b3('0x8b')]();_0x25aeea[_0x11b3('0x8c')]('('+_0x56234c[_0x11b3('0x85')]()+')','countTable');_0x25aeea['field'](_0x11b3('0xa3'),_0x11b3('0x3f'));_0x56234c[_0x11b3('0x1f')](_0x112332[_0x11b3('0x1f')]||_0x30a3bb);_0x56234c[_0x11b3('0x1e')](_0x112332[_0x11b3('0x1e')]||0x0);return db[_0x11b3('0x86')][_0x11b3('0x31')](_0x25aeea[_0x11b3('0x85')](),{'type':db[_0x11b3('0x86')]['QueryTypes'][_0x11b3('0x88')]})[_0x11b3('0x25')](function(_0x59b334){if(!_0x59b334[_0x11b3('0x45')]){_0x5f2f4b=0x0;}else{_0x5f2f4b=_0x59b334[0x0]['count']||0x0;}return db[_0x11b3('0x86')][_0x11b3('0x31')](_0x56234c[_0x11b3('0x85')](),{'type':db[_0x11b3('0x86')]['QueryTypes'][_0x11b3('0x88')]});})[_0x11b3('0x25')](function(_0x1f63e8){return{'rows':_0x1f63e8||[],'count':_0x5f2f4b};});}});}exports[_0x11b3('0xa4')]=function(_0x340ebd,_0x215693){return runReport(_0x340ebd[_0x11b3('0x44')],_0x340ebd['query'],_0x340ebd[_0x11b3('0x47')])[_0x11b3('0x25')](respondWithResult(_0x215693,null))[_0x11b3('0x43')](handleError(_0x215693,null));};exports[_0x11b3('0xa5')]=runReport;exports[_0x11b3('0x31')]=function(_0x1a45b8,_0x4da79e){var _0x295f65=0xa;var _0x29bffa=[_0x11b3('0x56'),_0x11b3('0x57'),_0x11b3('0x58'),_0x11b3('0x59')];var _0x3c36d2={'SUM':'SUM(%s)','COUNT':_0x11b3('0x5b'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0x11b3('0x5e'),'AVG':_0x11b3('0x5f'),'GROUP_CONCAT':_0x11b3('0x89'),'GROUP_CONCAT ASC':_0x11b3('0x60'),'GROUP_CONCAT DESC':_0x11b3('0x8a')};var _0x44e52e={'SEC_TO_TIME':_0x11b3('0x61'),'DATE':_0x11b3('0x62'),'HOUR':_0x11b3('0x63'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x11b3('0x65')};var _0x53f219=function(_0x49c1d8){return!_[_0x11b3('0x66')]([_0x11b3('0x67'),'IS\x20NOT\x20NULL',_0x11b3('0x69'),_0x11b3('0x6a')],_0x49c1d8);};var _0x426a98=function(_0x257bbe){if(!_0x257bbe||!_0x257bbe[_0x11b3('0x6b')][_0x11b3('0x45')]){return'';}for(var _0x456d3e='(',_0x36725c=0x0;_0x36725c<_0x257bbe[_0x11b3('0x6b')][_0x11b3('0x45')];_0x36725c+=0x1){_0x36725c>0x0&&(_0x456d3e+='\x20'+_0x257bbe['operator']+'\x20');_0x456d3e+=_0x257bbe[_0x11b3('0x6b')][_0x36725c][_0x11b3('0x7c')]?_0x426a98(_0x257bbe['rules'][_0x36725c][_0x11b3('0x7c')]):_0x257bbe['rules'][_0x36725c][_0x11b3('0x6d')]+'\x20'+_0x257bbe[_0x11b3('0x6b')][_0x36725c][_0x11b3('0x6e')]+(_0x53f219(_0x257bbe[_0x11b3('0x6b')][_0x36725c]['condition'])?'\x20'+_0x257bbe[_0x11b3('0x6b')][_0x36725c]['value']:'');}return _0x456d3e+')';};var _0x6e8a47={'where':{'id':_0x1a45b8[_0x11b3('0x44')]['id']}},_0x467ed4,_0x5e1159,_0x4d2557,_0x3f5fea,_0x37369c;_0x6e8a47=_[_0x11b3('0x3c')]({},_0x6e8a47,_0x1a45b8[_0x11b3('0x47')]);return db[_0x11b3('0x3e')][_0x11b3('0x4e')](_0x6e8a47)[_0x11b3('0x25')](function(_0x103526){if(_0x103526){_0x467ed4=_0x103526;return _0x103526[_0x11b3('0x6f')]();}return null;})[_0x11b3('0x25')](function(_0x129be2){if(_0x129be2){if(!_0x129be2[_0x11b3('0x45')]){throw new db[(_0x11b3('0x70'))][(_0x11b3('0x71'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x5e1159=_0x129be2;return db[_0x11b3('0x73')][_0x11b3('0x41')]({'raw':!![]});}return null;})[_0x11b3('0x25')](function(_0x307e18){if(_0x307e18){_0x4d2557=_['keyBy'](_0x307e18,'id');var _0x446bfd;var _0x298ea6=squel[_0x11b3('0x8b')]();_0x298ea6['from'](_0x467ed4[_0x11b3('0x75')]);for(var _0x49cbfb=0x0;_0x49cbfb<_0x5e1159[_0x11b3('0x45')];_0x49cbfb+=0x1){_0x446bfd=_0x5e1159[_0x49cbfb][_0x11b3('0x76')]?_0x4d2557[_0x5e1159[_0x49cbfb][_0x11b3('0x76')]]['metric']:_0x5e1159[_0x49cbfb][_0x11b3('0x6d')];_0x446bfd=_0x5e1159[_0x49cbfb][_0x11b3('0x78')]?_[_0x11b3('0x79')](_0x3c36d2[_0x5e1159[_0x49cbfb][_0x11b3('0x78')]],'%s',_0x446bfd):_0x446bfd;_0x446bfd=_0x5e1159[_0x49cbfb]['format']?_[_0x11b3('0x79')](_0x44e52e[_0x5e1159[_0x49cbfb][_0x11b3('0x7a')]],'%s',_0x446bfd):_0x446bfd;if(_0x5e1159[_0x49cbfb][_0x11b3('0x7b')]){_0x298ea6[_0x11b3('0x7c')](_0x446bfd);}_0x5e1159[_0x49cbfb][_0x11b3('0x8d')]&&_0x298ea6[_0x11b3('0x38')](_0x446bfd,_0x5e1159[_0x49cbfb][_0x11b3('0x8d')]===_0x11b3('0x7d')?![]:!![]);_0x298ea6[_0x11b3('0x6d')](_0x446bfd,_0x5e1159[_0x49cbfb][_0x11b3('0x7e')]||_0x446bfd);}if(_0x467ed4[_0x11b3('0x7f')]){_0x467ed4[_0x11b3('0x7f')]=JSON[_0x11b3('0x80')](_0x467ed4[_0x11b3('0x7f')]);for(var _0x25bf1d=0x0;_0x25bf1d<_0x467ed4['joins'][_0x11b3('0x45')];_0x25bf1d+=0x1){if(_0x467ed4[_0x11b3('0x7f')][_0x25bf1d]['type']&&_[_0x11b3('0x66')](_0x29bffa,_0x467ed4[_0x11b3('0x7f')][_0x25bf1d][_0x11b3('0x2e')])&&_0x467ed4[_0x11b3('0x7f')][_0x25bf1d][_0x11b3('0x81')]&&_0x467ed4[_0x11b3('0x7f')][_0x25bf1d][_0x11b3('0x82')]&&_0x467ed4[_0x11b3('0x7f')][_0x25bf1d]['foreignKey']){_0x298ea6[_0x467ed4[_0x11b3('0x7f')][_0x25bf1d][_0x11b3('0x2e')]](_0x467ed4[_0x11b3('0x7f')][_0x25bf1d][_0x11b3('0x82')],null,util[_0x11b3('0x7a')](_0x11b3('0xa6'),_0x467ed4[_0x11b3('0x75')],_0x467ed4[_0x11b3('0x7f')][_0x25bf1d]['parentKey'],_0x467ed4[_0x11b3('0x7f')][_0x25bf1d][_0x11b3('0x82')],_0x467ed4[_0x11b3('0x7f')][_0x25bf1d]['foreignKey']));}}}if(_0x467ed4[_0x11b3('0x84')]){_0x467ed4[_0x11b3('0x84')]=JSON[_0x11b3('0x80')](_0x467ed4[_0x11b3('0x84')]);_0x298ea6[_0x11b3('0x3a')](_0x426a98(_0x467ed4[_0x11b3('0x84')][_0x11b3('0x7c')]));}_0x37369c=_0x298ea6['clone']();_0x298ea6[_0x11b3('0x1f')](_0x295f65);_0x298ea6[_0x11b3('0x1e')](0x0);logger[_0x11b3('0xa7')]('Limited\x20Query:',_0x298ea6[_0x11b3('0x85')]());return db[_0x11b3('0x86')][_0x11b3('0x31')](_0x298ea6[_0x11b3('0x85')](),{'type':db[_0x11b3('0x86')]['QueryTypes'][_0x11b3('0x88')]});}})[_0x11b3('0x25')](function(){return{'sql':_0x37369c[_0x11b3('0x85')]()};})[_0x11b3('0x25')](respondWithResult(_0x4da79e,null))[_0x11b3('0x43')](handleError(_0x4da79e,null));}; \ No newline at end of file +var _0xb138=['end','json','count','offset','limit','status','set','apply','reject','save','update','destroy','then','get','UserProfileResource','sendStatus','error','stack','name','send','index','map','AnalyticCustomReport','rawAttributes','fieldName','type','key','query','keys','intersection','attributes','model','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','rows','catch','show','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','CustomReports','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','join','right_join','cross_join','COUNT(%s)','COUNT(DISTINCT\x20%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','SEC_TO_TIME(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','condition','value','getFields','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','findAll','select','table','MetricId','metric','field','function','format','groupBy','group','orderBy','DESC','alias','joins','parse','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','parentKey','conditions','clone','debug','toString','sequelize','SELECT','left_join','SUM(%s)','MAX(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','ValidationErrorItem','keyBy','from','replace','Limited\x20Query:','QueryTypes','output','fullPath','%s-%s.%s','randomstring','csv','custom','AnalyticExtractedReport','cdr','.createdAt\x20BETWEEN\x20?\x20AND\x20?','endDate','info','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','COUNT(*)','run','runReport','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb'];(function(_0x82129b,_0x484ae9){var _0x2ae5dc=function(_0x299e34){while(--_0x299e34){_0x82129b['push'](_0x82129b['shift']());}};_0x2ae5dc(++_0x484ae9);}(_0xb138,0x1dd));var _0x8b13=function(_0x39c341,_0x2f47ff){_0x39c341=_0x39c341-0x0;var _0x58f61e=_0xb138[_0x39c341];return _0x58f61e;};'use strict';var pdf=require(_0x8b13('0x0'));var emlformat=require(_0x8b13('0x1'));var rimraf=require(_0x8b13('0x2'));var zipdir=require(_0x8b13('0x3'));var jsonpatch=require(_0x8b13('0x4'));var rp=require(_0x8b13('0x5'));var moment=require(_0x8b13('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x8b13('0x7'));var util=require(_0x8b13('0x8'));var path=require(_0x8b13('0x9'));var sox=require('sox');var csv=require(_0x8b13('0xa'));var ejs=require(_0x8b13('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x8b13('0xc'));var crypto=require(_0x8b13('0xd'));var jsforce=require(_0x8b13('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x8b13('0xa'));var querystring=require(_0x8b13('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8b13('0x10'));var qs=require(_0x8b13('0x11'));var as=require(_0x8b13('0x12'));var hardwareService=require(_0x8b13('0x13'));var logger=require(_0x8b13('0x14'))('api');var utils=require(_0x8b13('0x15'));var config=require(_0x8b13('0x16'));var db=require(_0x8b13('0x17'))['db'];function respondWithStatusCode(_0x3f79d5,_0xb227e0){_0xb227e0=_0xb227e0||0xcc;return function(_0x1893b1){if(_0x1893b1){return _0x3f79d5['sendStatus'](_0xb227e0);}return _0x3f79d5['status'](_0xb227e0)[_0x8b13('0x18')]();};}function respondWithResult(_0x130a6f,_0x5f12b5){_0x5f12b5=_0x5f12b5||0xc8;return function(_0x51a935){if(_0x51a935){return _0x130a6f['status'](_0x5f12b5)[_0x8b13('0x19')](_0x51a935);}};}function respondWithFilteredResult(_0x407ef4,_0xf29086){return function(_0x2c615a){if(_0x2c615a){var _0x13f956=_0x2c615a[_0x8b13('0x1a')],_0x542357=_0xf29086[_0x8b13('0x1b')],_0x1c6c99=_0xf29086[_0x8b13('0x1b')]+_0xf29086[_0x8b13('0x1c')],_0xea7881;if(_0x1c6c99>=_0x13f956){_0x1c6c99=_0x13f956;_0xea7881=0xc8;}else{_0xea7881=0xce;}_0x407ef4[_0x8b13('0x1d')](_0xea7881);return _0x407ef4[_0x8b13('0x1e')]('Content-Range',_0x542357+'-'+_0x1c6c99+'/'+_0x13f956)['json'](_0x2c615a);}return null;};}function patchUpdates(_0xae4966){return function(_0x335709){try{jsonpatch[_0x8b13('0x1f')](_0x335709,_0xae4966,!![]);}catch(_0x9c03b4){return BPromise[_0x8b13('0x20')](_0x9c03b4);}return _0x335709[_0x8b13('0x21')]();};}function saveUpdates(_0x559442,_0x1e8a48){return function(_0x3c4d4f){if(_0x3c4d4f){return _0x3c4d4f[_0x8b13('0x22')](_0x559442)['then'](function(_0x51dd1d){return _0x51dd1d;});}return null;};}function removeEntity(_0xe73329,_0xcb7621){return function(_0x4f9902){if(_0x4f9902){return _0x4f9902[_0x8b13('0x23')]()[_0x8b13('0x24')](function(){var _0x37ca5f=_0x4f9902[_0x8b13('0x25')]({'plain':!![]});var _0xc05d5c='CustomReports';return db[_0x8b13('0x26')][_0x8b13('0x23')]({'where':{'type':_0xc05d5c,'resourceId':_0x37ca5f['id']}})['then'](function(){return _0x4f9902;});})[_0x8b13('0x24')](function(){_0xe73329['status'](0xcc)[_0x8b13('0x18')]();});}};}function handleEntityNotFound(_0x325d68,_0x54786a){return function(_0x3f1756){if(!_0x3f1756){_0x325d68[_0x8b13('0x27')](0x194);}return _0x3f1756;};}function handleError(_0x4f8e58,_0x134c5e){_0x134c5e=_0x134c5e||0x1f4;return function(_0x14a739){logger[_0x8b13('0x28')](_0x14a739[_0x8b13('0x29')]);if(_0x14a739[_0x8b13('0x2a')]){delete _0x14a739['name'];}_0x4f8e58[_0x8b13('0x1d')](_0x134c5e)[_0x8b13('0x2b')](_0x14a739);};}exports[_0x8b13('0x2c')]=function(_0x1511bf,_0x114b01){var _0x2bb51d={},_0x5ab161={},_0x35fdca={'count':0x0,'rows':[]};var _0xfec033=_[_0x8b13('0x2d')](db[_0x8b13('0x2e')][_0x8b13('0x2f')],function(_0x29946e){return{'name':_0x29946e[_0x8b13('0x30')],'type':_0x29946e[_0x8b13('0x31')][_0x8b13('0x32')]};});_0x5ab161['model']=_[_0x8b13('0x2d')](_0xfec033,_0x8b13('0x2a'));_0x5ab161[_0x8b13('0x33')]=_[_0x8b13('0x34')](_0x1511bf['query']);_0x5ab161['filters']=_[_0x8b13('0x35')](_0x5ab161['model'],_0x5ab161['query']);_0x2bb51d[_0x8b13('0x36')]=_['intersection'](_0x5ab161[_0x8b13('0x37')],qs[_0x8b13('0x38')](_0x1511bf[_0x8b13('0x33')][_0x8b13('0x38')]));_0x2bb51d[_0x8b13('0x36')]=_0x2bb51d[_0x8b13('0x36')][_0x8b13('0x39')]?_0x2bb51d[_0x8b13('0x36')]:_0x5ab161[_0x8b13('0x37')];if(!_0x1511bf[_0x8b13('0x33')]['hasOwnProperty'](_0x8b13('0x3a'))){_0x2bb51d[_0x8b13('0x1c')]=qs[_0x8b13('0x1c')](_0x1511bf[_0x8b13('0x33')][_0x8b13('0x1c')]);_0x2bb51d[_0x8b13('0x1b')]=qs[_0x8b13('0x1b')](_0x1511bf[_0x8b13('0x33')]['offset']);}_0x2bb51d[_0x8b13('0x3b')]=qs['sort'](_0x1511bf[_0x8b13('0x33')][_0x8b13('0x3c')]);_0x2bb51d[_0x8b13('0x3d')]=qs[_0x8b13('0x3e')](_[_0x8b13('0x3f')](_0x1511bf[_0x8b13('0x33')],_0x5ab161['filters']));if(_0x1511bf['query'][_0x8b13('0x40')]){_0x2bb51d['where']=_[_0x8b13('0x41')](_0x2bb51d['where'],{'$or':_[_0x8b13('0x2d')](_0xfec033,function(_0x3a8e06){if(_0x3a8e06[_0x8b13('0x31')]!==_0x8b13('0x42')){var _0x3a221d={};_0x3a221d[_0x3a8e06['name']]={'$like':'%'+_0x1511bf['query'][_0x8b13('0x40')]+'%'};return _0x3a221d;}})});}_0x2bb51d=_['merge']({},_0x2bb51d,_0x1511bf[_0x8b13('0x43')]);var _0x9f2d81={'where':_0x2bb51d['where']};return db[_0x8b13('0x2e')][_0x8b13('0x1a')](_0x9f2d81)[_0x8b13('0x24')](function(_0x81b931){_0x35fdca[_0x8b13('0x1a')]=_0x81b931;if(_0x1511bf[_0x8b13('0x33')][_0x8b13('0x44')]){_0x2bb51d['include']=[{'all':!![]}];}return db['AnalyticCustomReport']['findAll'](_0x2bb51d);})[_0x8b13('0x24')](function(_0x16ec3){_0x35fdca[_0x8b13('0x45')]=_0x16ec3;return _0x35fdca;})[_0x8b13('0x24')](respondWithFilteredResult(_0x114b01,_0x2bb51d))[_0x8b13('0x46')](handleError(_0x114b01,null));};exports[_0x8b13('0x47')]=function(_0x492f7d,_0x4342db){var _0x50e535={'raw':![],'where':{'id':_0x492f7d['params']['id']}},_0x13d0ef={};_0x13d0ef[_0x8b13('0x37')]=_[_0x8b13('0x34')](db[_0x8b13('0x2e')][_0x8b13('0x2f')]);_0x13d0ef[_0x8b13('0x33')]=_[_0x8b13('0x34')](_0x492f7d[_0x8b13('0x33')]);_0x13d0ef['filters']=_['intersection'](_0x13d0ef['model'],_0x13d0ef[_0x8b13('0x33')]);_0x50e535[_0x8b13('0x36')]=_[_0x8b13('0x35')](_0x13d0ef[_0x8b13('0x37')],qs['fields'](_0x492f7d['query'][_0x8b13('0x38')]));_0x50e535['attributes']=_0x50e535[_0x8b13('0x36')][_0x8b13('0x39')]?_0x50e535[_0x8b13('0x36')]:_0x13d0ef[_0x8b13('0x37')];if(_0x492f7d[_0x8b13('0x33')]['includeAll']){_0x50e535[_0x8b13('0x48')]=[{'all':!![]}];}_0x50e535=_[_0x8b13('0x41')]({},_0x50e535,_0x492f7d[_0x8b13('0x43')]);return db[_0x8b13('0x2e')][_0x8b13('0x49')](_0x50e535)[_0x8b13('0x24')](handleEntityNotFound(_0x4342db,null))[_0x8b13('0x24')](respondWithResult(_0x4342db,null))[_0x8b13('0x46')](handleError(_0x4342db,null));};exports[_0x8b13('0x4a')]=function(_0x518298,_0x46d096){return db['AnalyticCustomReport'][_0x8b13('0x4a')](_0x518298[_0x8b13('0x4b')],{})[_0x8b13('0x24')](function(_0x5d9ddb){var _0x148efb=_0x518298[_0x8b13('0x4c')][_0x8b13('0x25')]({'plain':!![]});if(!_0x148efb)throw new Error(_0x8b13('0x4d'));if(_0x148efb[_0x8b13('0x4e')]===_0x8b13('0x4c')){var _0x453cd4=_0x5d9ddb['get']({'plain':!![]});var _0x2c8594='Reports';return db[_0x8b13('0x4f')][_0x8b13('0x49')]({'where':{'name':_0x2c8594,'userProfileId':_0x148efb[_0x8b13('0x50')]},'raw':!![]})[_0x8b13('0x24')](function(_0x2be640){if(_0x2be640&&_0x2be640[_0x8b13('0x51')]===0x0){return db[_0x8b13('0x26')][_0x8b13('0x4a')]({'name':_0x453cd4[_0x8b13('0x2a')],'resourceId':_0x453cd4['id'],'type':_0x8b13('0x52'),'sectionId':_0x2be640['id']},{})[_0x8b13('0x24')](function(){return _0x5d9ddb;});}else{return _0x5d9ddb;}})[_0x8b13('0x46')](function(_0xd55f3b){logger[_0x8b13('0x28')](_0x8b13('0x53'),_0xd55f3b);throw _0xd55f3b;});}return _0x5d9ddb;})[_0x8b13('0x24')](respondWithResult(_0x46d096,0xc9))[_0x8b13('0x46')](handleError(_0x46d096,null));};exports['update']=function(_0x1699c6,_0x20e89c){if(_0x1699c6['body']['id']){delete _0x1699c6[_0x8b13('0x4b')]['id'];}return db[_0x8b13('0x2e')][_0x8b13('0x49')]({'where':{'id':_0x1699c6[_0x8b13('0x54')]['id']}})[_0x8b13('0x24')](handleEntityNotFound(_0x20e89c,null))[_0x8b13('0x24')](saveUpdates(_0x1699c6[_0x8b13('0x4b')],null))[_0x8b13('0x24')](respondWithResult(_0x20e89c,null))[_0x8b13('0x46')](handleError(_0x20e89c,null));};exports[_0x8b13('0x23')]=function(_0x16f9fb,_0x450b47){return db[_0x8b13('0x2e')][_0x8b13('0x49')]({'where':{'id':_0x16f9fb[_0x8b13('0x54')]['id']}})['then'](handleEntityNotFound(_0x450b47,null))[_0x8b13('0x24')](removeEntity(_0x450b47,null))[_0x8b13('0x46')](handleError(_0x450b47,null));};exports['preview']=function(_0x11e8af,_0x73aba5){var _0x237e45=0xa;var _0x46c595=[_0x8b13('0x55'),'left_join',_0x8b13('0x56'),_0x8b13('0x57')];var _0x46850a={'SUM':'SUM(%s)','COUNT':_0x8b13('0x58'),'COUNT DISTINCT':_0x8b13('0x59'),'MAX':'MAX(%s)','MIN':_0x8b13('0x5a'),'AVG':_0x8b13('0x5b'),'GROUP_CONCAT':_0x8b13('0x5c'),'GROUP_CONCAT ASC':_0x8b13('0x5d'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x13c8bd={'SEC_TO_TIME':_0x8b13('0x5e'),'DATE':'DATE(%s)','HOUR':_0x8b13('0x5f'),'ROUND':_0x8b13('0x60'),'UNIX_TIMESTAMP':_0x8b13('0x61')};var _0x23a63c=function(_0x5d05cb){return!_[_0x8b13('0x62')]([_0x8b13('0x63'),_0x8b13('0x64'),_0x8b13('0x65'),_0x8b13('0x66')],_0x5d05cb);};var _0x2fff4e=function(_0x571e89){if(!_0x571e89||!_0x571e89[_0x8b13('0x67')][_0x8b13('0x39')]){return'';}for(var _0x445283='(',_0x4f2bcc=0x0;_0x4f2bcc<_0x571e89[_0x8b13('0x67')][_0x8b13('0x39')];_0x4f2bcc+=0x1){_0x4f2bcc>0x0&&(_0x445283+='\x20'+_0x571e89[_0x8b13('0x68')]+'\x20');_0x445283+=_0x571e89[_0x8b13('0x67')][_0x4f2bcc]['group']?_0x2fff4e(_0x571e89['rules'][_0x4f2bcc]['group']):_0x571e89['rules'][_0x4f2bcc]['field']+'\x20'+_0x571e89[_0x8b13('0x67')][_0x4f2bcc][_0x8b13('0x69')]+(_0x23a63c(_0x571e89['rules'][_0x4f2bcc][_0x8b13('0x69')])?'\x20'+_0x571e89['rules'][_0x4f2bcc][_0x8b13('0x6a')]:'');}return _0x445283+')';};var _0x2d2fa3={'where':{'id':_0x11e8af['params']['id']}},_0x42790f,_0x22c4d4,_0x43f12a,_0x2ff9c3,_0xa7c7d5;_0x2d2fa3=_[_0x8b13('0x41')]({},_0x2d2fa3,_0x11e8af['options']);return db[_0x8b13('0x2e')][_0x8b13('0x49')](_0x2d2fa3)[_0x8b13('0x24')](function(_0x11a4ba){if(_0x11a4ba){_0x42790f=_0x11a4ba;return _0x11a4ba[_0x8b13('0x6b')]();}return null;})[_0x8b13('0x24')](function(_0x10f1bf){if(_0x10f1bf){if(!_0x10f1bf['length']){throw new db[(_0x8b13('0x6c'))]['ValidationErrorItem'](_0x8b13('0x6d'),0x193);}_0x22c4d4=_0x10f1bf;return db[_0x8b13('0x6e')][_0x8b13('0x6f')]({'raw':!![]});}return null;})[_0x8b13('0x24')](function(_0x177a64){if(_0x177a64){_0x43f12a=_['keyBy'](_0x177a64,'id');var _0x52b546;var _0x319923=squel[_0x8b13('0x70')]();_0x319923['from'](_0x42790f[_0x8b13('0x71')]);for(var _0x43dfcc=0x0;_0x43dfcc<_0x22c4d4[_0x8b13('0x39')];_0x43dfcc+=0x1){_0x52b546=_0x22c4d4[_0x43dfcc]['MetricId']?_0x43f12a[_0x22c4d4[_0x43dfcc][_0x8b13('0x72')]][_0x8b13('0x73')]:_0x22c4d4[_0x43dfcc][_0x8b13('0x74')];_0x52b546=_0x22c4d4[_0x43dfcc][_0x8b13('0x75')]?_['replace'](_0x46850a[_0x22c4d4[_0x43dfcc][_0x8b13('0x75')]],'%s',_0x52b546):_0x52b546;_0x52b546=_0x22c4d4[_0x43dfcc][_0x8b13('0x76')]?_['replace'](_0x13c8bd[_0x22c4d4[_0x43dfcc][_0x8b13('0x76')]],'%s',_0x52b546):_0x52b546;if(_0x22c4d4[_0x43dfcc][_0x8b13('0x77')]){_0x319923[_0x8b13('0x78')](_0x52b546);}_0x22c4d4[_0x43dfcc][_0x8b13('0x79')]&&_0x319923[_0x8b13('0x3b')](_0x52b546,_0x22c4d4[_0x43dfcc][_0x8b13('0x79')]===_0x8b13('0x7a')?![]:!![]);_0x319923[_0x8b13('0x74')](_0x52b546,_0x22c4d4[_0x43dfcc][_0x8b13('0x7b')]||_0x52b546);}if(_0x42790f[_0x8b13('0x7c')]){_0x42790f[_0x8b13('0x7c')]=JSON[_0x8b13('0x7d')](_0x42790f[_0x8b13('0x7c')]);for(var _0x1db235=0x0;_0x1db235<_0x42790f['joins'][_0x8b13('0x39')];_0x1db235+=0x1){if(_0x42790f['joins'][_0x1db235][_0x8b13('0x31')]&&_[_0x8b13('0x62')](_0x46c595,_0x42790f[_0x8b13('0x7c')][_0x1db235][_0x8b13('0x31')])&&_0x42790f['joins'][_0x1db235]['parentKey']&&_0x42790f[_0x8b13('0x7c')][_0x1db235][_0x8b13('0x7e')]&&_0x42790f['joins'][_0x1db235][_0x8b13('0x7f')]){_0x319923[_0x42790f[_0x8b13('0x7c')][_0x1db235][_0x8b13('0x31')]](_0x42790f[_0x8b13('0x7c')][_0x1db235][_0x8b13('0x7e')],null,util[_0x8b13('0x76')](_0x8b13('0x80'),_0x42790f[_0x8b13('0x71')],_0x42790f[_0x8b13('0x7c')][_0x1db235][_0x8b13('0x81')],_0x42790f['joins'][_0x1db235][_0x8b13('0x7e')],_0x42790f[_0x8b13('0x7c')][_0x1db235]['foreignKey']));}}}if(_0x42790f[_0x8b13('0x82')]){_0x42790f[_0x8b13('0x82')]=JSON['parse'](_0x42790f[_0x8b13('0x82')]);_0x319923[_0x8b13('0x3d')](_0x2fff4e(_0x42790f[_0x8b13('0x82')][_0x8b13('0x78')]));}_0xa7c7d5=_0x319923[_0x8b13('0x83')]();_0x319923[_0x8b13('0x1c')](_0x237e45);_0x319923[_0x8b13('0x1b')](0x0);logger[_0x8b13('0x84')]('Limited\x20Query:',_0x319923[_0x8b13('0x85')]());return db[_0x8b13('0x86')][_0x8b13('0x33')](_0x319923['toString'](),{'type':db[_0x8b13('0x86')]['QueryTypes'][_0x8b13('0x87')]});}})[_0x8b13('0x24')](respondWithResult(_0x73aba5,null))[_0x8b13('0x46')](handleError(_0x73aba5,null));};function runReport(_0x40fefa,_0xc74525,_0x281d9e){var _0x41cefe=_0xc74525[_0x8b13('0x2a')];var _0xc73698=0xa;var _0x2ae970=['join',_0x8b13('0x88'),_0x8b13('0x56'),_0x8b13('0x57')];var _0xc76c8b={'SUM':_0x8b13('0x89'),'COUNT':_0x8b13('0x58'),'COUNT DISTINCT':_0x8b13('0x59'),'MAX':_0x8b13('0x8a'),'MIN':_0x8b13('0x5a'),'AVG':_0x8b13('0x5b'),'GROUP_CONCAT':_0x8b13('0x5c'),'GROUP_CONCAT ASC':_0x8b13('0x5d'),'GROUP_CONCAT DESC':_0x8b13('0x8b')};var _0x4bb71a={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x8b13('0x8c'),'HOUR':'HOUR(%s)','ROUND':_0x8b13('0x60'),'UNIX_TIMESTAMP':_0x8b13('0x61')};var _0x57c9af=function(_0x5319a1){return!_[_0x8b13('0x62')]([_0x8b13('0x63'),_0x8b13('0x64'),_0x8b13('0x65'),_0x8b13('0x66')],_0x5319a1);};var _0x5b8abf=function(_0x2b0aca){if(!_0x2b0aca||!_0x2b0aca['rules'][_0x8b13('0x39')]){return'';}for(var _0x268bb6='(',_0x4dec2f=0x0;_0x4dec2f<_0x2b0aca[_0x8b13('0x67')][_0x8b13('0x39')];_0x4dec2f+=0x1){_0x4dec2f>0x0&&(_0x268bb6+='\x20'+_0x2b0aca[_0x8b13('0x68')]+'\x20');_0x268bb6+=_0x2b0aca[_0x8b13('0x67')][_0x4dec2f][_0x8b13('0x78')]?_0x5b8abf(_0x2b0aca['rules'][_0x4dec2f][_0x8b13('0x78')]):_0x2b0aca[_0x8b13('0x67')][_0x4dec2f][_0x8b13('0x74')]+'\x20'+_0x2b0aca['rules'][_0x4dec2f][_0x8b13('0x69')]+(_0x57c9af(_0x2b0aca['rules'][_0x4dec2f][_0x8b13('0x69')])?'\x20'+_0x2b0aca[_0x8b13('0x67')][_0x4dec2f][_0x8b13('0x6a')]:'');}return _0x268bb6+')';};var _0x30cadc={'where':{'id':_0x40fefa['id']}},_0x229009,_0xe70f1b,_0x441173,_0x2bd0ed,_0x42ea3a;_0x30cadc=_[_0x8b13('0x41')]({},_0x30cadc,_0x281d9e);return db['AnalyticCustomReport'][_0x8b13('0x49')](_0x30cadc)[_0x8b13('0x24')](function(_0x179c84){if(_0x179c84){_0x229009=_0x179c84;return _0x179c84[_0x8b13('0x6b')]();}return null;})[_0x8b13('0x24')](function(_0x52e7d6){if(_0x52e7d6){if(!_0x52e7d6[_0x8b13('0x39')]){throw new db[(_0x8b13('0x6c'))][(_0x8b13('0x8d'))](_0x8b13('0x6d'),0x193);}_0xe70f1b=_0x52e7d6;return db[_0x8b13('0x6e')][_0x8b13('0x6f')]({'raw':!![]});}return null;})['then'](function(_0x24005e){if(_0x24005e){_0x441173=_[_0x8b13('0x8e')](_0x24005e,'id');var _0x556a92;var _0x1b3a1b=squel['select']();_0x1b3a1b[_0x8b13('0x8f')](_0x229009['table']);for(var _0x135053=0x0;_0x135053<_0xe70f1b[_0x8b13('0x39')];_0x135053+=0x1){_0x556a92=_0xe70f1b[_0x135053][_0x8b13('0x72')]?_0x441173[_0xe70f1b[_0x135053][_0x8b13('0x72')]][_0x8b13('0x73')]:_0xe70f1b[_0x135053][_0x8b13('0x74')];_0x556a92=_0xe70f1b[_0x135053][_0x8b13('0x75')]?_[_0x8b13('0x90')](_0xc76c8b[_0xe70f1b[_0x135053]['function']],'%s',_0x556a92):_0x556a92;_0x556a92=_0xe70f1b[_0x135053][_0x8b13('0x76')]?_[_0x8b13('0x90')](_0x4bb71a[_0xe70f1b[_0x135053]['format']],'%s',_0x556a92):_0x556a92;if(_0xe70f1b[_0x135053][_0x8b13('0x77')]){_0x1b3a1b[_0x8b13('0x78')](_0x556a92);}_0xe70f1b[_0x135053]['orderBy']&&_0x1b3a1b[_0x8b13('0x3b')](_0x556a92,_0xe70f1b[_0x135053][_0x8b13('0x79')]===_0x8b13('0x7a')?![]:!![]);_0x1b3a1b[_0x8b13('0x74')](_0x556a92,_0xe70f1b[_0x135053][_0x8b13('0x7b')]||_0x556a92);}if(_0x229009['joins']){_0x229009['joins']=JSON[_0x8b13('0x7d')](_0x229009[_0x8b13('0x7c')]);for(var _0x312f17=0x0;_0x312f17<_0x229009[_0x8b13('0x7c')][_0x8b13('0x39')];_0x312f17+=0x1){if(_0x229009[_0x8b13('0x7c')][_0x312f17][_0x8b13('0x31')]&&_[_0x8b13('0x62')](_0x2ae970,_0x229009[_0x8b13('0x7c')][_0x312f17][_0x8b13('0x31')])&&_0x229009[_0x8b13('0x7c')][_0x312f17][_0x8b13('0x81')]&&_0x229009[_0x8b13('0x7c')][_0x312f17][_0x8b13('0x7e')]&&_0x229009[_0x8b13('0x7c')][_0x312f17][_0x8b13('0x7f')]){_0x1b3a1b[_0x229009['joins'][_0x312f17][_0x8b13('0x31')]](_0x229009['joins'][_0x312f17][_0x8b13('0x7e')],null,util[_0x8b13('0x76')](_0x8b13('0x80'),_0x229009[_0x8b13('0x71')],_0x229009[_0x8b13('0x7c')][_0x312f17][_0x8b13('0x81')],_0x229009[_0x8b13('0x7c')][_0x312f17]['foreignTable'],_0x229009[_0x8b13('0x7c')][_0x312f17]['foreignKey']));}}}if(_0x229009[_0x8b13('0x82')]){_0x229009[_0x8b13('0x82')]=JSON['parse'](_0x229009['conditions']);_0x1b3a1b[_0x8b13('0x3d')](_0x5b8abf(_0x229009[_0x8b13('0x82')][_0x8b13('0x78')]));}_0x42ea3a=_0x1b3a1b[_0x8b13('0x83')]();_0x1b3a1b[_0x8b13('0x1c')](_0xc73698);_0x1b3a1b[_0x8b13('0x1b')](0x0);logger['debug'](_0x8b13('0x91'),_0x1b3a1b[_0x8b13('0x85')]());return db['sequelize']['query'](_0x1b3a1b['toString'](),{'type':db[_0x8b13('0x86')][_0x8b13('0x92')][_0x8b13('0x87')]});}})[_0x8b13('0x24')](function(_0x44b19b){if(!_0x44b19b[_0x8b13('0x39')]){throw new db[(_0x8b13('0x6c'))][(_0x8b13('0x8d'))]('No\x20available\x20data',0xcc);}if(_0xc74525[_0x8b13('0x93')]==='web'){return null;}var _0x3a7bc9=_['merge'](_0xc74525,{'name':_0xc74525[_0x8b13('0x94')]||_0xc74525[_0x8b13('0x2a')]||_0x229009['name'],'basename':_0x41cefe,'savename':util[_0x8b13('0x76')](_0x8b13('0x95'),_0xc74525[_0x8b13('0x2a')]||_0x229009[_0x8b13('0x2a')],require(_0x8b13('0x96'))['generate'](0x4),_0xc74525[_0x8b13('0x93')]||_0x8b13('0x97')),'reportId':_0x229009['id'],'reportType':_0x8b13('0x98')});return db[_0x8b13('0x99')]['create'](_0x3a7bc9,{'raw':!![]});})[_0x8b13('0x24')](function(_0x52b6f1){if(_0x229009[_0x8b13('0x71')]===_0x8b13('0x9a')){_0x42ea3a[_0x8b13('0x3d')](_0x229009['table']+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0xc74525['startDate'],_0xc74525['endDate']);}else{_0x42ea3a[_0x8b13('0x3d')](_0x229009['table']+_0x8b13('0x9b'),_0xc74525['startDate'],_0xc74525[_0x8b13('0x9c')]);}if(_0x52b6f1){logger[_0x8b13('0x9d')](_0x8b13('0x9e'),_0x42ea3a[_0x8b13('0x85')]());require(_0x8b13('0x9f'))[_0x8b13('0xa0')](path[_0x8b13('0x55')](__dirname,_0x8b13('0xa1'),_0x52b6f1[_0x8b13('0x93')]),[_0x52b6f1['id'],_0x42ea3a[_0x8b13('0x85')](),path[_0x8b13('0x55')](__dirname,_0x8b13('0xa2'),_0x52b6f1[_0x8b13('0xa3')]),_0x41cefe]);return _0x52b6f1;}else{var _0x54811f=squel[_0x8b13('0x70')]();_0x54811f['from']('('+_0x42ea3a['toString']()+')','countTable');_0x54811f[_0x8b13('0x74')](_0x8b13('0xa4'),_0x8b13('0x1a'));_0x42ea3a[_0x8b13('0x1c')](_0xc74525['limit']||_0xc73698);_0x42ea3a[_0x8b13('0x1b')](_0xc74525['offset']||0x0);return db[_0x8b13('0x86')][_0x8b13('0x33')](_0x54811f['toString'](),{'type':db[_0x8b13('0x86')][_0x8b13('0x92')][_0x8b13('0x87')]})['then'](function(_0x1cc3a8){if(!_0x1cc3a8[_0x8b13('0x39')]){_0x2bd0ed=0x0;}else{_0x2bd0ed=_0x1cc3a8[0x0][_0x8b13('0x1a')]||0x0;}return db[_0x8b13('0x86')][_0x8b13('0x33')](_0x42ea3a[_0x8b13('0x85')](),{'type':db[_0x8b13('0x86')][_0x8b13('0x92')][_0x8b13('0x87')]});})[_0x8b13('0x24')](function(_0x2329e2){return{'rows':_0x2329e2||[],'count':_0x2bd0ed};});}});}exports[_0x8b13('0xa5')]=function(_0x1fd2cd,_0x35171e){return runReport(_0x1fd2cd[_0x8b13('0x54')],_0x1fd2cd[_0x8b13('0x33')],_0x1fd2cd['options'])[_0x8b13('0x24')](respondWithResult(_0x35171e,null))[_0x8b13('0x46')](handleError(_0x35171e,null));};exports[_0x8b13('0xa6')]=runReport;exports['query']=function(_0x22e0f5,_0x4a3e4b){var _0x3d1737=0xa;var _0x1e104d=[_0x8b13('0x55'),'left_join',_0x8b13('0x56'),_0x8b13('0x57')];var _0x506ab2={'SUM':'SUM(%s)','COUNT':_0x8b13('0x58'),'COUNT DISTINCT':_0x8b13('0x59'),'MAX':'MAX(%s)','MIN':_0x8b13('0x5a'),'AVG':_0x8b13('0x5b'),'GROUP_CONCAT':_0x8b13('0x5c'),'GROUP_CONCAT ASC':_0x8b13('0x5d'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0xfb71ff={'SEC_TO_TIME':_0x8b13('0x5e'),'DATE':_0x8b13('0x8c'),'HOUR':'HOUR(%s)','ROUND':_0x8b13('0x60'),'UNIX_TIMESTAMP':_0x8b13('0x61')};var _0x4c8846=function(_0x1404db){return!_['includes']([_0x8b13('0x63'),_0x8b13('0x64'),'IS\x20EMPTY','IS\x20NOT\x20EMPTY'],_0x1404db);};var _0x40f21e=function(_0x30892a){if(!_0x30892a||!_0x30892a[_0x8b13('0x67')][_0x8b13('0x39')]){return'';}for(var _0x446ba4='(',_0x2fb2cc=0x0;_0x2fb2cc<_0x30892a[_0x8b13('0x67')][_0x8b13('0x39')];_0x2fb2cc+=0x1){_0x2fb2cc>0x0&&(_0x446ba4+='\x20'+_0x30892a[_0x8b13('0x68')]+'\x20');_0x446ba4+=_0x30892a[_0x8b13('0x67')][_0x2fb2cc][_0x8b13('0x78')]?_0x40f21e(_0x30892a['rules'][_0x2fb2cc][_0x8b13('0x78')]):_0x30892a[_0x8b13('0x67')][_0x2fb2cc]['field']+'\x20'+_0x30892a[_0x8b13('0x67')][_0x2fb2cc]['condition']+(_0x4c8846(_0x30892a[_0x8b13('0x67')][_0x2fb2cc][_0x8b13('0x69')])?'\x20'+_0x30892a[_0x8b13('0x67')][_0x2fb2cc]['value']:'');}return _0x446ba4+')';};var _0x46bc13={'where':{'id':_0x22e0f5[_0x8b13('0x54')]['id']}},_0x169609,_0xbd12b2,_0x3e0cf8,_0x117b27,_0x58bc60;_0x46bc13=_[_0x8b13('0x41')]({},_0x46bc13,_0x22e0f5[_0x8b13('0x43')]);return db[_0x8b13('0x2e')][_0x8b13('0x49')](_0x46bc13)[_0x8b13('0x24')](function(_0x57a094){if(_0x57a094){_0x169609=_0x57a094;return _0x57a094[_0x8b13('0x6b')]();}return null;})[_0x8b13('0x24')](function(_0x1ccd09){if(_0x1ccd09){if(!_0x1ccd09[_0x8b13('0x39')]){throw new db['Sequelize'][(_0x8b13('0x8d'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0xbd12b2=_0x1ccd09;return db['AnalyticMetric'][_0x8b13('0x6f')]({'raw':!![]});}return null;})[_0x8b13('0x24')](function(_0x4d98b2){if(_0x4d98b2){_0x3e0cf8=_[_0x8b13('0x8e')](_0x4d98b2,'id');var _0x4bb94f;var _0x38cbc5=squel['select']();_0x38cbc5[_0x8b13('0x8f')](_0x169609[_0x8b13('0x71')]);for(var _0x41bb5e=0x0;_0x41bb5e<_0xbd12b2[_0x8b13('0x39')];_0x41bb5e+=0x1){_0x4bb94f=_0xbd12b2[_0x41bb5e][_0x8b13('0x72')]?_0x3e0cf8[_0xbd12b2[_0x41bb5e][_0x8b13('0x72')]][_0x8b13('0x73')]:_0xbd12b2[_0x41bb5e][_0x8b13('0x74')];_0x4bb94f=_0xbd12b2[_0x41bb5e][_0x8b13('0x75')]?_['replace'](_0x506ab2[_0xbd12b2[_0x41bb5e][_0x8b13('0x75')]],'%s',_0x4bb94f):_0x4bb94f;_0x4bb94f=_0xbd12b2[_0x41bb5e][_0x8b13('0x76')]?_['replace'](_0xfb71ff[_0xbd12b2[_0x41bb5e][_0x8b13('0x76')]],'%s',_0x4bb94f):_0x4bb94f;if(_0xbd12b2[_0x41bb5e][_0x8b13('0x77')]){_0x38cbc5[_0x8b13('0x78')](_0x4bb94f);}_0xbd12b2[_0x41bb5e]['orderBy']&&_0x38cbc5[_0x8b13('0x3b')](_0x4bb94f,_0xbd12b2[_0x41bb5e][_0x8b13('0x79')]===_0x8b13('0x7a')?![]:!![]);_0x38cbc5[_0x8b13('0x74')](_0x4bb94f,_0xbd12b2[_0x41bb5e]['alias']||_0x4bb94f);}if(_0x169609[_0x8b13('0x7c')]){_0x169609[_0x8b13('0x7c')]=JSON[_0x8b13('0x7d')](_0x169609[_0x8b13('0x7c')]);for(var _0x2a44a7=0x0;_0x2a44a7<_0x169609[_0x8b13('0x7c')][_0x8b13('0x39')];_0x2a44a7+=0x1){if(_0x169609[_0x8b13('0x7c')][_0x2a44a7][_0x8b13('0x31')]&&_[_0x8b13('0x62')](_0x1e104d,_0x169609[_0x8b13('0x7c')][_0x2a44a7]['type'])&&_0x169609[_0x8b13('0x7c')][_0x2a44a7][_0x8b13('0x81')]&&_0x169609['joins'][_0x2a44a7][_0x8b13('0x7e')]&&_0x169609['joins'][_0x2a44a7][_0x8b13('0x7f')]){_0x38cbc5[_0x169609[_0x8b13('0x7c')][_0x2a44a7][_0x8b13('0x31')]](_0x169609[_0x8b13('0x7c')][_0x2a44a7][_0x8b13('0x7e')],null,util[_0x8b13('0x76')](_0x8b13('0x80'),_0x169609[_0x8b13('0x71')],_0x169609[_0x8b13('0x7c')][_0x2a44a7][_0x8b13('0x81')],_0x169609[_0x8b13('0x7c')][_0x2a44a7][_0x8b13('0x7e')],_0x169609[_0x8b13('0x7c')][_0x2a44a7][_0x8b13('0x7f')]));}}}if(_0x169609[_0x8b13('0x82')]){_0x169609[_0x8b13('0x82')]=JSON[_0x8b13('0x7d')](_0x169609[_0x8b13('0x82')]);_0x38cbc5[_0x8b13('0x3d')](_0x40f21e(_0x169609[_0x8b13('0x82')]['group']));}_0x58bc60=_0x38cbc5[_0x8b13('0x83')]();_0x38cbc5['limit'](_0x3d1737);_0x38cbc5[_0x8b13('0x1b')](0x0);logger['debug'](_0x8b13('0x91'),_0x38cbc5['toString']());return db[_0x8b13('0x86')]['query'](_0x38cbc5[_0x8b13('0x85')](),{'type':db[_0x8b13('0x86')][_0x8b13('0x92')]['SELECT']});}})[_0x8b13('0x24')](function(){return{'sql':_0x58bc60[_0x8b13('0x85')]()};})[_0x8b13('0x24')](respondWithResult(_0x4a3e4b,null))[_0x8b13('0x46')](handleError(_0x4a3e4b,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 31849c3..e98cdfd 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 _0xea26=['moment','bluebird','request-promise','path','rimraf','exports','define','AnalyticCustomReport','analytics_custom_reports','lodash','../../config/logger','api'];(function(_0xf34109,_0x380779){var _0x570bfc=function(_0x1ad086){while(--_0x1ad086){_0xf34109['push'](_0xf34109['shift']());}};_0x570bfc(++_0x380779);}(_0xea26,0x8d));var _0x6ea2=function(_0x38c596,_0x520267){_0x38c596=_0x38c596-0x0;var _0x1c095f=_0xea26[_0x38c596];return _0x1c095f;};'use strict';var _=require(_0x6ea2('0x0'));var util=require('util');var logger=require(_0x6ea2('0x1'))(_0x6ea2('0x2'));var moment=require(_0x6ea2('0x3'));var BPromise=require(_0x6ea2('0x4'));var rp=require(_0x6ea2('0x5'));var fs=require('fs');var path=require(_0x6ea2('0x6'));var rimraf=require(_0x6ea2('0x7'));var config=require('../../config/environment');var attributes=require('./analyticCustomReport.attributes');module[_0x6ea2('0x8')]=function(_0x327ecb,_0x17d75b){return _0x327ecb[_0x6ea2('0x9')](_0x6ea2('0xa'),attributes,{'tableName':_0x6ea2('0xb'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9c77=['define','AnalyticCustomReport','analytics_custom_reports','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticCustomReport.attributes'];(function(_0x77912,_0x613ff5){var _0x112538=function(_0x5f7633){while(--_0x5f7633){_0x77912['push'](_0x77912['shift']());}};_0x112538(++_0x613ff5);}(_0x9c77,0x12e));var _0x79c7=function(_0x21e70b,_0x5765b6){_0x21e70b=_0x21e70b-0x0;var _0x2bda98=_0x9c77[_0x21e70b];return _0x2bda98;};'use strict';var _=require(_0x79c7('0x0'));var util=require(_0x79c7('0x1'));var logger=require(_0x79c7('0x2'))('api');var moment=require(_0x79c7('0x3'));var BPromise=require(_0x79c7('0x4'));var rp=require(_0x79c7('0x5'));var fs=require('fs');var path=require(_0x79c7('0x6'));var rimraf=require(_0x79c7('0x7'));var config=require(_0x79c7('0x8'));var attributes=require(_0x79c7('0x9'));module['exports']=function(_0x2ff80d,_0x209e13){return _0x2ff80d[_0x79c7('0xa')](_0x79c7('0xb'),attributes,{'tableName':_0x79c7('0xc'),'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 444a2b7..f6b684b 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 _0x7844=['moment','../../mysqldb','../../config/logger','rpc','../../config/environment','request','then','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','util'];(function(_0x3e224a,_0x112ec2){var _0x3028bc=function(_0x5d3324){while(--_0x5d3324){_0x3e224a['push'](_0x3e224a['shift']());}};_0x3028bc(++_0x112ec2);}(_0x7844,0x19d));var _0x4784=function(_0x3ba8c2,_0x3a10ef){_0x3ba8c2=_0x3ba8c2-0x0;var _0x3f8dd5=_0x7844[_0x3ba8c2];return _0x3f8dd5;};'use strict';var _=require('lodash');var util=require(_0x4784('0x0'));var moment=require(_0x4784('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4784('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x4784('0x3'))(_0x4784('0x4'));var config=require(_0x4784('0x5'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xb2cde,_0x144e8c,_0x122125){return new BPromise(function(_0x267e12,_0x19084a){return client[_0x4784('0x6')](_0xb2cde,_0x122125)[_0x4784('0x7')](function(_0x88d20){logger['info'](_0x4784('0x8'),_0x144e8c,_0x4784('0x9'));logger[_0x4784('0xa')](_0x4784('0xb'),_0x144e8c,_0x4784('0x9'),JSON[_0x4784('0xc')](_0x88d20));if(_0x88d20[_0x4784('0xd')]){if(_0x88d20[_0x4784('0xd')][_0x4784('0xe')]===0x1f4){logger['error'](_0x4784('0x8'),_0x144e8c,_0x88d20[_0x4784('0xd')][_0x4784('0xf')]);return _0x19084a(_0x88d20[_0x4784('0xd')]['message']);}logger[_0x4784('0xd')](_0x4784('0x8'),_0x144e8c,_0x88d20[_0x4784('0xd')]['message']);return _0x267e12(_0x88d20[_0x4784('0xd')][_0x4784('0xf')]);}else{logger[_0x4784('0x10')]('AnalyticCustomReport,\x20%s,\x20%s',_0x144e8c,'request\x20sent');_0x267e12(_0x88d20['result']['message']);}})[_0x4784('0x11')](function(_0x118817){logger[_0x4784('0xd')](_0x4784('0x8'),_0x144e8c,_0x118817);_0x19084a(_0x118817);});});} \ No newline at end of file +var _0x9429=['request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','request','then','info','AnalyticCustomReport,\x20%s,\x20%s'];(function(_0x36daf3,_0x2ea0dd){var _0x3e4e26=function(_0x31999a){while(--_0x31999a){_0x36daf3['push'](_0x36daf3['shift']());}};_0x3e4e26(++_0x2ea0dd);}(_0x9429,0x157));var _0x9942=function(_0x462e81,_0x34d956){_0x462e81=_0x462e81-0x0;var _0x40e113=_0x9429[_0x462e81];return _0x40e113;};'use strict';var _=require(_0x9942('0x0'));var util=require(_0x9942('0x1'));var moment=require('moment');var BPromise=require(_0x9942('0x2'));var rs=require(_0x9942('0x3'));var fs=require('fs');var Redis=require(_0x9942('0x4'));var db=require(_0x9942('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x9942('0x6'));var config=require(_0x9942('0x7'));var jayson=require(_0x9942('0x8'));var client=jayson[_0x9942('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x33caa1,_0x530ab7,_0x5b4feb){return new BPromise(function(_0x47b626,_0x138547){return client[_0x9942('0xa')](_0x33caa1,_0x5b4feb)[_0x9942('0xb')](function(_0x188f7c){logger[_0x9942('0xc')](_0x9942('0xd'),_0x530ab7,_0x9942('0xe'));logger[_0x9942('0xf')](_0x9942('0x10'),_0x530ab7,_0x9942('0xe'),JSON['stringify'](_0x188f7c));if(_0x188f7c['error']){if(_0x188f7c[_0x9942('0x11')][_0x9942('0x12')]===0x1f4){logger[_0x9942('0x11')](_0x9942('0xd'),_0x530ab7,_0x188f7c[_0x9942('0x11')][_0x9942('0x13')]);return _0x138547(_0x188f7c[_0x9942('0x11')][_0x9942('0x13')]);}logger[_0x9942('0x11')]('AnalyticCustomReport,\x20%s,\x20%s',_0x530ab7,_0x188f7c[_0x9942('0x11')][_0x9942('0x13')]);return _0x47b626(_0x188f7c[_0x9942('0x11')][_0x9942('0x13')]);}else{logger[_0x9942('0xc')](_0x9942('0xd'),_0x530ab7,_0x9942('0xe'));_0x47b626(_0x188f7c[_0x9942('0x14')]['message']);}})['catch'](function(_0x4b3456){logger['error']('AnalyticCustomReport,\x20%s,\x20%s',_0x530ab7,_0x4b3456);_0x138547(_0x4b3456);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 79b436f..75cc7c6 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 _0xdaf6=['post','create','update','delete','exports','multer','path','express','Router','../../components/auth/service','../../config/environment','./analyticCustomReport.controller','get','isAuthenticated','index','/:id','show','/:id/preview','preview','/:id/run','run','/:id/query','query'];(function(_0x420b24,_0x382adc){var _0x4da552=function(_0x4e1623){while(--_0x4e1623){_0x420b24['push'](_0x420b24['shift']());}};_0x4da552(++_0x382adc);}(_0xdaf6,0xa6));var _0x6daf=function(_0x43ee7e,_0x78e09b){_0x43ee7e=_0x43ee7e-0x0;var _0x22d326=_0xdaf6[_0x43ee7e];return _0x22d326;};'use strict';var multer=require(_0x6daf('0x0'));var util=require('util');var path=require(_0x6daf('0x1'));var timeout=require('connect-timeout');var express=require(_0x6daf('0x2'));var router=express[_0x6daf('0x3')]();var auth=require(_0x6daf('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x6daf('0x5'));var controller=require(_0x6daf('0x6'));router[_0x6daf('0x7')]('/',auth[_0x6daf('0x8')](),controller[_0x6daf('0x9')]);router[_0x6daf('0x7')](_0x6daf('0xa'),auth[_0x6daf('0x8')](),controller[_0x6daf('0xb')]);router[_0x6daf('0x7')](_0x6daf('0xc'),auth[_0x6daf('0x8')](),controller[_0x6daf('0xd')]);router[_0x6daf('0x7')](_0x6daf('0xe'),auth['isAuthenticated'](),controller[_0x6daf('0xf')]);router[_0x6daf('0x7')](_0x6daf('0x10'),auth[_0x6daf('0x8')](),controller[_0x6daf('0x11')]);router[_0x6daf('0x12')]('/',auth[_0x6daf('0x8')](),controller[_0x6daf('0x13')]);router['put'](_0x6daf('0xa'),auth['isAuthenticated'](),controller[_0x6daf('0x14')]);router[_0x6daf('0x15')]('/:id',auth[_0x6daf('0x8')](),controller['destroy']);module[_0x6daf('0x16')]=router; \ No newline at end of file +var _0x2856=['./analyticCustomReport.controller','isAuthenticated','index','/:id','show','/:id/preview','preview','get','/:id/query','query','post','create','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x535a47,_0x36c699){var _0xd3a444=function(_0x1dd5ce){while(--_0x1dd5ce){_0x535a47['push'](_0x535a47['shift']());}};_0xd3a444(++_0x36c699);}(_0x2856,0x88));var _0x6285=function(_0x567ec0,_0x676a8e){_0x567ec0=_0x567ec0-0x0;var _0x109c75=_0x2856[_0x567ec0];return _0x109c75;};'use strict';var multer=require('multer');var util=require(_0x6285('0x0'));var path=require(_0x6285('0x1'));var timeout=require(_0x6285('0x2'));var express=require(_0x6285('0x3'));var router=express[_0x6285('0x4')]();var auth=require(_0x6285('0x5'));var interaction=require(_0x6285('0x6'));var config=require(_0x6285('0x7'));var controller=require(_0x6285('0x8'));router['get']('/',auth[_0x6285('0x9')](),controller[_0x6285('0xa')]);router['get'](_0x6285('0xb'),auth[_0x6285('0x9')](),controller[_0x6285('0xc')]);router['get'](_0x6285('0xd'),auth[_0x6285('0x9')](),controller[_0x6285('0xe')]);router[_0x6285('0xf')]('/:id/run',auth[_0x6285('0x9')](),controller['run']);router[_0x6285('0xf')](_0x6285('0x10'),auth['isAuthenticated'](),controller[_0x6285('0x11')]);router[_0x6285('0x12')]('/',auth['isAuthenticated'](),controller[_0x6285('0x13')]);router['put'](_0x6285('0xb'),auth['isAuthenticated'](),controller[_0x6285('0x14')]);router[_0x6285('0x15')](_0x6285('0xb'),auth[_0x6285('0x9')](),controller[_0x6285('0x16')]);module[_0x6285('0x17')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index 755e93e..96b93b8 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 _0xabbb=['STRING','TEXT'];(function(_0xea9dd8,_0x45dc1c){var _0x18a0b0=function(_0x5bcbad){while(--_0x5bcbad){_0xea9dd8['push'](_0xea9dd8['shift']());}};_0x18a0b0(++_0x45dc1c);}(_0xabbb,0x1d2));var _0xbabb=function(_0xb6baf0,_0x2b9cce){_0xb6baf0=_0xb6baf0-0x0;var _0x2f3c36=_0xabbb[_0xb6baf0];return _0x2f3c36;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xbabb('0x0')]},'parent':{'type':Sequelize[_0xbabb('0x0')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0xbabb('0x1')]}}; \ No newline at end of file +var _0xde35=['STRING','TEXT','sequelize','exports'];(function(_0x3a7bd7,_0x10a063){var _0x5a7e87=function(_0x522215){while(--_0x522215){_0x3a7bd7['push'](_0x3a7bd7['shift']());}};_0x5a7e87(++_0x10a063);}(_0xde35,0x106));var _0x5de3=function(_0x18e9ed,_0x553855){_0x18e9ed=_0x18e9ed-0x0;var _0x48e91d=_0xde35[_0x18e9ed];return _0x48e91d;};'use strict';var Sequelize=require(_0x5de3('0x0'));module[_0x5de3('0x1')]={'name':{'type':Sequelize[_0x5de3('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x5de3('0x2')]},'parent':{'type':Sequelize[_0x5de3('0x2')]},'table':{'type':Sequelize[_0x5de3('0x2')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0x5de3('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index 5d8ae19..d47882a 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 _0x141b=['ROUND(%s)','includes','IS\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','keyBy','select','from','table','MetricId','metric','replace','function','format','groupBy','orderBy','order','DESC','alias','joins','parse','parentKey','foreignTable','%s.%s\x20=\x20%s.%s','foreignKey','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','COUNT(DISTINCT\x20%s)','MAX(%s)','SEC_TO_TIME(%s)','UNIX_TIMESTAMP(%s)','IS\x20NOT\x20NULL','AnalyticMetric','No\x20available\x20data','output','fullPath','%s-%s.%s','randomstring','generate','csv','default','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','endDate','info','Run\x20Query:','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','run','runReport','cross_join','html-pdf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','apply','reject','update','then','destroy','UserProfileResource','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','where','pick','merge','VIRTUAL','filter','options','AnalyticDefaultReport','count','includeAll','include','findAll','catch','params','find','create','body','user','get','Reports','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','left_join','right_join','SUM(%s)','COUNT(%s)','MIN(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','HOUR(%s)'];(function(_0x43bfcb,_0x54034c){var _0x34ab56=function(_0x495fe8){while(--_0x495fe8){_0x43bfcb['push'](_0x43bfcb['shift']());}};_0x34ab56(++_0x54034c);}(_0x141b,0xee));var _0xb141=function(_0x3a499b,_0x142412){_0x3a499b=_0x3a499b-0x0;var _0x3367fc=_0x141b[_0x3a499b];return _0x3367fc;};'use strict';var pdf=require(_0xb141('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xb141('0x1'));var moment=require(_0xb141('0x2'));var BPromise=require(_0xb141('0x3'));var Mustache=require(_0xb141('0x4'));var util=require(_0xb141('0x5'));var path=require(_0xb141('0x6'));var sox=require(_0xb141('0x7'));var csv=require(_0xb141('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xb141('0x9'));var squel=require(_0xb141('0xa'));var crypto=require(_0xb141('0xb'));var jsforce=require(_0xb141('0xc'));var deskjs=require(_0xb141('0xd'));var toCsv=require(_0xb141('0x8'));var querystring=require(_0xb141('0xe'));var Papa=require(_0xb141('0xf'));var Redis=require(_0xb141('0x10'));var authService=require(_0xb141('0x11'));var qs=require(_0xb141('0x12'));var as=require(_0xb141('0x13'));var hardwareService=require(_0xb141('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0xb141('0x15'));var config=require(_0xb141('0x16'));var db=require(_0xb141('0x17'))['db'];function respondWithStatusCode(_0x478440,_0x356401){_0x356401=_0x356401||0xcc;return function(_0x412751){if(_0x412751){return _0x478440[_0xb141('0x18')](_0x356401);}return _0x478440['status'](_0x356401)[_0xb141('0x19')]();};}function respondWithResult(_0x378215,_0x4ede7b){_0x4ede7b=_0x4ede7b||0xc8;return function(_0x571239){if(_0x571239){return _0x378215[_0xb141('0x1a')](_0x4ede7b)[_0xb141('0x1b')](_0x571239);}};}function respondWithFilteredResult(_0x7601a6,_0x27dba9){return function(_0x1ccbb4){if(_0x1ccbb4){var _0x14b0cb=_0x1ccbb4['count'],_0x26acd3=_0x27dba9['offset'],_0xe80f4e=_0x27dba9[_0xb141('0x1c')]+_0x27dba9['limit'],_0x3d588d;if(_0xe80f4e>=_0x14b0cb){_0xe80f4e=_0x14b0cb;_0x3d588d=0xc8;}else{_0x3d588d=0xce;}_0x7601a6[_0xb141('0x1a')](_0x3d588d);return _0x7601a6['set']('Content-Range',_0x26acd3+'-'+_0xe80f4e+'/'+_0x14b0cb)['json'](_0x1ccbb4);}return null;};}function patchUpdates(_0x1350f8){return function(_0x2c5993){try{jsonpatch[_0xb141('0x1d')](_0x2c5993,_0x1350f8,!![]);}catch(_0x51820e){return BPromise[_0xb141('0x1e')](_0x51820e);}return _0x2c5993['save']();};}function saveUpdates(_0x1b3518,_0x450328){return function(_0x522e22){if(_0x522e22){return _0x522e22[_0xb141('0x1f')](_0x1b3518)[_0xb141('0x20')](function(_0x3849f0){return _0x3849f0;});}return null;};}function removeEntity(_0x37a640,_0x3f6344){return function(_0x346012){if(_0x346012){return _0x346012[_0xb141('0x21')]()['then'](function(){var _0x304a69=_0x346012['get']({'plain':!![]});var _0x5cd4fa='DefaultReports';return db[_0xb141('0x22')][_0xb141('0x21')]({'where':{'type':_0x5cd4fa,'resourceId':_0x304a69['id']}})[_0xb141('0x20')](function(){return _0x346012;});})[_0xb141('0x20')](function(){_0x37a640[_0xb141('0x1a')](0xcc)[_0xb141('0x19')]();});}};}function handleEntityNotFound(_0x1c9775,_0x498ef2){return function(_0x450006){if(!_0x450006){_0x1c9775[_0xb141('0x18')](0x194);}return _0x450006;};}function handleError(_0x15e17a,_0x570068){_0x570068=_0x570068||0x1f4;return function(_0x483f8f){logger[_0xb141('0x23')](_0x483f8f[_0xb141('0x24')]);if(_0x483f8f[_0xb141('0x25')]){delete _0x483f8f[_0xb141('0x25')];}_0x15e17a[_0xb141('0x1a')](_0x570068)[_0xb141('0x26')](_0x483f8f);};}exports['index']=function(_0x5abba7,_0x5aee43){var _0xef82e0={},_0x29eb00={},_0x40b3de={'count':0x0,'rows':[]};var _0x216684=_[_0xb141('0x27')](db['AnalyticDefaultReport'][_0xb141('0x28')],function(_0x124e41){return{'name':_0x124e41[_0xb141('0x29')],'type':_0x124e41[_0xb141('0x2a')][_0xb141('0x2b')]};});_0x29eb00[_0xb141('0x2c')]=_[_0xb141('0x27')](_0x216684,_0xb141('0x25'));_0x29eb00['query']=_[_0xb141('0x2d')](_0x5abba7[_0xb141('0x2e')]);_0x29eb00[_0xb141('0x2f')]=_['intersection'](_0x29eb00['model'],_0x29eb00[_0xb141('0x2e')]);_0xef82e0['attributes']=_[_0xb141('0x30')](_0x29eb00[_0xb141('0x2c')],qs[_0xb141('0x31')](_0x5abba7['query']['fields']));_0xef82e0[_0xb141('0x32')]=_0xef82e0[_0xb141('0x32')][_0xb141('0x33')]?_0xef82e0[_0xb141('0x32')]:_0x29eb00[_0xb141('0x2c')];if(!_0x5abba7[_0xb141('0x2e')][_0xb141('0x34')](_0xb141('0x35'))){_0xef82e0[_0xb141('0x36')]=qs[_0xb141('0x36')](_0x5abba7[_0xb141('0x2e')][_0xb141('0x36')]);_0xef82e0['offset']=qs[_0xb141('0x1c')](_0x5abba7['query']['offset']);}_0xef82e0['order']=qs[_0xb141('0x37')](_0x5abba7[_0xb141('0x2e')][_0xb141('0x37')]);_0xef82e0[_0xb141('0x38')]=qs[_0xb141('0x2f')](_[_0xb141('0x39')](_0x5abba7[_0xb141('0x2e')],_0x29eb00['filters']));if(_0x5abba7[_0xb141('0x2e')]['filter']){_0xef82e0[_0xb141('0x38')]=_[_0xb141('0x3a')](_0xef82e0[_0xb141('0x38')],{'$or':_[_0xb141('0x27')](_0x216684,function(_0x2039b8){if(_0x2039b8['type']!==_0xb141('0x3b')){var _0x260c34={};_0x260c34[_0x2039b8['name']]={'$like':'%'+_0x5abba7[_0xb141('0x2e')][_0xb141('0x3c')]+'%'};return _0x260c34;}})});}_0xef82e0=_['merge']({},_0xef82e0,_0x5abba7[_0xb141('0x3d')]);var _0x133900={'where':_0xef82e0[_0xb141('0x38')]};return db[_0xb141('0x3e')][_0xb141('0x3f')](_0x133900)[_0xb141('0x20')](function(_0x5504c1){_0x40b3de[_0xb141('0x3f')]=_0x5504c1;if(_0x5abba7[_0xb141('0x2e')][_0xb141('0x40')]){_0xef82e0[_0xb141('0x41')]=[{'all':!![]}];}return db[_0xb141('0x3e')][_0xb141('0x42')](_0xef82e0);})[_0xb141('0x20')](function(_0x5e0410){_0x40b3de['rows']=_0x5e0410;return _0x40b3de;})[_0xb141('0x20')](respondWithFilteredResult(_0x5aee43,_0xef82e0))[_0xb141('0x43')](handleError(_0x5aee43,null));};exports['show']=function(_0x57380a,_0xcd0577){var _0x3896ab={'raw':!![],'where':{'id':_0x57380a[_0xb141('0x44')]['id']}},_0x1f0909={};_0x1f0909[_0xb141('0x2c')]=_[_0xb141('0x2d')](db[_0xb141('0x3e')]['rawAttributes']);_0x1f0909[_0xb141('0x2e')]=_[_0xb141('0x2d')](_0x57380a[_0xb141('0x2e')]);_0x1f0909['filters']=_[_0xb141('0x30')](_0x1f0909[_0xb141('0x2c')],_0x1f0909[_0xb141('0x2e')]);_0x3896ab['attributes']=_[_0xb141('0x30')](_0x1f0909[_0xb141('0x2c')],qs[_0xb141('0x31')](_0x57380a[_0xb141('0x2e')][_0xb141('0x31')]));_0x3896ab['attributes']=_0x3896ab[_0xb141('0x32')][_0xb141('0x33')]?_0x3896ab[_0xb141('0x32')]:_0x1f0909[_0xb141('0x2c')];if(_0x57380a['query'][_0xb141('0x40')]){_0x3896ab[_0xb141('0x41')]=[{'all':!![]}];}_0x3896ab=_['merge']({},_0x3896ab,_0x57380a[_0xb141('0x3d')]);return db[_0xb141('0x3e')][_0xb141('0x45')](_0x3896ab)[_0xb141('0x20')](handleEntityNotFound(_0xcd0577,null))['then'](respondWithResult(_0xcd0577,null))[_0xb141('0x43')](handleError(_0xcd0577,null));};exports[_0xb141('0x46')]=function(_0x3cbcf5,_0x7e01a5){return db['AnalyticDefaultReport'][_0xb141('0x46')](_0x3cbcf5[_0xb141('0x47')],{})[_0xb141('0x20')](function(_0xc85c8d){var _0x40ef97=_0x3cbcf5[_0xb141('0x48')]['get']({'plain':!![]});if(!_0x40ef97)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x40ef97['role']==='user'){var _0x201cf3=_0xc85c8d[_0xb141('0x49')]({'plain':!![]});var _0x3e9045=_0xb141('0x4a');return db[_0xb141('0x4b')][_0xb141('0x45')]({'where':{'name':_0x3e9045,'userProfileId':_0x40ef97[_0xb141('0x4c')]},'raw':!![]})['then'](function(_0x1a55bb){if(_0x1a55bb&&_0x1a55bb['autoAssociation']===0x0){return db['UserProfileResource'][_0xb141('0x46')]({'name':_0x201cf3[_0xb141('0x25')],'resourceId':_0x201cf3['id'],'type':'DefaultReports','sectionId':_0x1a55bb['id']},{})[_0xb141('0x20')](function(){return _0xc85c8d;});}else{return _0xc85c8d;}})['catch'](function(_0x39c0b9){logger[_0xb141('0x23')](_0xb141('0x4d'),_0x39c0b9);throw _0x39c0b9;});}return _0xc85c8d;})[_0xb141('0x20')](respondWithResult(_0x7e01a5,0xc9))['catch'](handleError(_0x7e01a5,null));};exports[_0xb141('0x1f')]=function(_0x3af39a,_0x550ed3){if(_0x3af39a['body']['id']){delete _0x3af39a[_0xb141('0x47')]['id'];}return db[_0xb141('0x3e')]['find']({'where':{'id':_0x3af39a[_0xb141('0x44')]['id']}})[_0xb141('0x20')](handleEntityNotFound(_0x550ed3,null))[_0xb141('0x20')](saveUpdates(_0x3af39a[_0xb141('0x47')],null))[_0xb141('0x20')](respondWithResult(_0x550ed3,null))[_0xb141('0x43')](handleError(_0x550ed3,null));};exports[_0xb141('0x21')]=function(_0x8b8f37,_0x2a6de2){return db[_0xb141('0x3e')]['find']({'where':{'id':_0x8b8f37[_0xb141('0x44')]['id']}})['then'](handleEntityNotFound(_0x2a6de2,null))[_0xb141('0x20')](removeEntity(_0x2a6de2,null))[_0xb141('0x43')](handleError(_0x2a6de2,null));};exports[_0xb141('0x4e')]=function(_0x5078be,_0x2a8f88){var _0x49acaf=0xa;var _0x22596a=[_0xb141('0x4f'),_0xb141('0x50'),_0xb141('0x51'),'cross_join'];var _0x54c99a={'SUM':_0xb141('0x52'),'COUNT':_0xb141('0x53'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0xb141('0x54'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xb141('0x55'),'GROUP_CONCAT ASC':_0xb141('0x56'),'GROUP_CONCAT DESC':_0xb141('0x57')};var _0x30a940={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xb141('0x58'),'HOUR':_0xb141('0x59'),'ROUND':_0xb141('0x5a'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x42cf14=function(_0x12539c){return!_[_0xb141('0x5b')]([_0xb141('0x5c'),'IS\x20NOT\x20NULL',_0xb141('0x5d'),_0xb141('0x5e')],_0x12539c);};var _0x44527c=function(_0x1f502a){if(!_0x1f502a||!_0x1f502a[_0xb141('0x5f')][_0xb141('0x33')]){return'';}for(var _0x28de9c='(',_0xb44b2e=0x0;_0xb44b2e<_0x1f502a[_0xb141('0x5f')][_0xb141('0x33')];_0xb44b2e+=0x1){_0xb44b2e>0x0&&(_0x28de9c+='\x20'+_0x1f502a[_0xb141('0x60')]+'\x20');_0x28de9c+=_0x1f502a[_0xb141('0x5f')][_0xb44b2e][_0xb141('0x61')]?_0x44527c(_0x1f502a[_0xb141('0x5f')][_0xb44b2e][_0xb141('0x61')]):_0x1f502a[_0xb141('0x5f')][_0xb44b2e][_0xb141('0x62')]+'\x20'+_0x1f502a['rules'][_0xb44b2e][_0xb141('0x63')]+(_0x42cf14(_0x1f502a['rules'][_0xb44b2e]['condition'])?'\x20'+_0x1f502a[_0xb141('0x5f')][_0xb44b2e][_0xb141('0x64')]:'');}return _0x28de9c+')';};var _0x5bfc24={'where':{'id':_0x5078be['params']['id']}},_0x320c2b,_0x2205cd,_0x25d066,_0x11eba2,_0x145419;_0x5bfc24=_['merge']({},_0x5bfc24,_0x5078be[_0xb141('0x3d')]);return db[_0xb141('0x3e')][_0xb141('0x45')](_0x5bfc24)[_0xb141('0x20')](function(_0xc596b){if(_0xc596b){_0x320c2b=_0xc596b;return _0xc596b[_0xb141('0x65')]();}return null;})[_0xb141('0x20')](function(_0x58a5e9){if(_0x58a5e9){if(!_0x58a5e9[_0xb141('0x33')]){throw new db[(_0xb141('0x66'))][(_0xb141('0x67'))](_0xb141('0x68'),0x193);}_0x2205cd=_0x58a5e9;return db['AnalyticMetric'][_0xb141('0x42')]({'raw':!![]});}return null;})[_0xb141('0x20')](function(_0x2c143c){if(_0x2c143c){_0x25d066=_[_0xb141('0x69')](_0x2c143c,'id');var _0x453c4e;var _0xd750c6=squel[_0xb141('0x6a')]();_0xd750c6[_0xb141('0x6b')](_0x320c2b[_0xb141('0x6c')]);for(var _0x549ffb=0x0;_0x549ffb<_0x2205cd[_0xb141('0x33')];_0x549ffb+=0x1){_0x453c4e=_0x2205cd[_0x549ffb][_0xb141('0x6d')]?_0x25d066[_0x2205cd[_0x549ffb][_0xb141('0x6d')]][_0xb141('0x6e')]:_0x2205cd[_0x549ffb][_0xb141('0x62')];_0x453c4e=_0x2205cd[_0x549ffb]['function']?_[_0xb141('0x6f')](_0x54c99a[_0x2205cd[_0x549ffb][_0xb141('0x70')]],'%s',_0x453c4e):_0x453c4e;_0x453c4e=_0x2205cd[_0x549ffb]['format']?_[_0xb141('0x6f')](_0x30a940[_0x2205cd[_0x549ffb][_0xb141('0x71')]],'%s',_0x453c4e):_0x453c4e;if(_0x2205cd[_0x549ffb][_0xb141('0x72')]){_0xd750c6['group'](_0x453c4e);}_0x2205cd[_0x549ffb][_0xb141('0x73')]&&_0xd750c6[_0xb141('0x74')](_0x453c4e,_0x2205cd[_0x549ffb][_0xb141('0x73')]===_0xb141('0x75')?![]:!![]);_0xd750c6[_0xb141('0x62')](_0x453c4e,_0x2205cd[_0x549ffb][_0xb141('0x76')]||_0x453c4e);}if(_0x320c2b[_0xb141('0x77')]){_0x320c2b['joins']=JSON[_0xb141('0x78')](_0x320c2b[_0xb141('0x77')]);for(var _0x1f8e2c=0x0;_0x1f8e2c<_0x320c2b[_0xb141('0x77')][_0xb141('0x33')];_0x1f8e2c+=0x1){if(_0x320c2b[_0xb141('0x77')][_0x1f8e2c][_0xb141('0x2a')]&&_[_0xb141('0x5b')](_0x22596a,_0x320c2b[_0xb141('0x77')][_0x1f8e2c][_0xb141('0x2a')])&&_0x320c2b[_0xb141('0x77')][_0x1f8e2c][_0xb141('0x79')]&&_0x320c2b['joins'][_0x1f8e2c][_0xb141('0x7a')]&&_0x320c2b[_0xb141('0x77')][_0x1f8e2c]['foreignKey']){_0xd750c6[_0x320c2b['joins'][_0x1f8e2c][_0xb141('0x2a')]](_0x320c2b[_0xb141('0x77')][_0x1f8e2c]['foreignTable'],null,util[_0xb141('0x71')](_0xb141('0x7b'),_0x320c2b['table'],_0x320c2b[_0xb141('0x77')][_0x1f8e2c][_0xb141('0x79')],_0x320c2b['joins'][_0x1f8e2c][_0xb141('0x7a')],_0x320c2b[_0xb141('0x77')][_0x1f8e2c][_0xb141('0x7c')]));}}}if(_0x320c2b['conditions']){_0x320c2b[_0xb141('0x7d')]=JSON[_0xb141('0x78')](_0x320c2b['conditions']);_0xd750c6[_0xb141('0x38')](_0x44527c(_0x320c2b['conditions'][_0xb141('0x61')]));}_0x145419=_0xd750c6[_0xb141('0x7e')]();_0xd750c6['limit'](_0x49acaf);_0xd750c6[_0xb141('0x1c')](0x0);logger[_0xb141('0x7f')](_0xb141('0x80'),_0xd750c6[_0xb141('0x81')]());return db['sequelize'][_0xb141('0x2e')](_0xd750c6[_0xb141('0x81')](),{'type':db[_0xb141('0x82')][_0xb141('0x83')][_0xb141('0x84')]});}})[_0xb141('0x20')](respondWithResult(_0x2a8f88,null))['catch'](handleError(_0x2a8f88,null));};function runReport(_0x354fd8,_0x387364,_0x19c465){var _0x586550=_0x387364[_0xb141('0x25')];var _0x5d7448=0xa;var _0x56d1ac=[_0xb141('0x4f'),_0xb141('0x50'),'right_join','cross_join'];var _0x2009eb={'SUM':'SUM(%s)','COUNT':_0xb141('0x53'),'COUNT DISTINCT':_0xb141('0x85'),'MAX':_0xb141('0x86'),'MIN':_0xb141('0x54'),'AVG':'AVG(%s)','GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x417dbe={'SEC_TO_TIME':_0xb141('0x87'),'DATE':'DATE(%s)','HOUR':_0xb141('0x59'),'ROUND':_0xb141('0x5a'),'UNIX_TIMESTAMP':_0xb141('0x88')};var _0x3ffdf7=function(_0x5563d2){return!_[_0xb141('0x5b')]([_0xb141('0x5c'),_0xb141('0x89'),_0xb141('0x5d'),_0xb141('0x5e')],_0x5563d2);};var _0x2e9f8b=function(_0x26279c){if(!_0x26279c||!_0x26279c[_0xb141('0x5f')]['length']){return'';}for(var _0x4068bd='(',_0x26b5a5=0x0;_0x26b5a5<_0x26279c[_0xb141('0x5f')]['length'];_0x26b5a5+=0x1){_0x26b5a5>0x0&&(_0x4068bd+='\x20'+_0x26279c['operator']+'\x20');_0x4068bd+=_0x26279c['rules'][_0x26b5a5][_0xb141('0x61')]?_0x2e9f8b(_0x26279c[_0xb141('0x5f')][_0x26b5a5]['group']):_0x26279c[_0xb141('0x5f')][_0x26b5a5][_0xb141('0x62')]+'\x20'+_0x26279c[_0xb141('0x5f')][_0x26b5a5]['condition']+(_0x3ffdf7(_0x26279c[_0xb141('0x5f')][_0x26b5a5]['condition'])?'\x20'+_0x26279c[_0xb141('0x5f')][_0x26b5a5][_0xb141('0x64')]:'');}return _0x4068bd+')';};var _0x1597ab={'where':{'id':_0x354fd8['id']}},_0x13cb11,_0x3f69f1,_0x25864b,_0x25aad9,_0x362e9a;_0x1597ab=_[_0xb141('0x3a')]({},_0x1597ab,_0x19c465);return db[_0xb141('0x3e')]['find'](_0x1597ab)[_0xb141('0x20')](function(_0x312c25){if(_0x312c25){_0x13cb11=_0x312c25;return _0x312c25[_0xb141('0x65')]();}return null;})[_0xb141('0x20')](function(_0x82ad27){if(_0x82ad27){if(!_0x82ad27[_0xb141('0x33')]){throw new db['Sequelize']['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x3f69f1=_0x82ad27;return db[_0xb141('0x8a')]['findAll']({'raw':!![]});}return null;})['then'](function(_0x1259c7){if(_0x1259c7){_0x25864b=_[_0xb141('0x69')](_0x1259c7,'id');var _0x53b42f;var _0x18f9c6=squel['select']();_0x18f9c6[_0xb141('0x6b')](_0x13cb11[_0xb141('0x6c')]);for(var _0x5e239c=0x0;_0x5e239c<_0x3f69f1[_0xb141('0x33')];_0x5e239c+=0x1){_0x53b42f=_0x3f69f1[_0x5e239c][_0xb141('0x6d')]?_0x25864b[_0x3f69f1[_0x5e239c][_0xb141('0x6d')]][_0xb141('0x6e')]:_0x3f69f1[_0x5e239c]['field'];_0x53b42f=_0x3f69f1[_0x5e239c][_0xb141('0x70')]?_[_0xb141('0x6f')](_0x2009eb[_0x3f69f1[_0x5e239c][_0xb141('0x70')]],'%s',_0x53b42f):_0x53b42f;_0x53b42f=_0x3f69f1[_0x5e239c][_0xb141('0x71')]?_[_0xb141('0x6f')](_0x417dbe[_0x3f69f1[_0x5e239c][_0xb141('0x71')]],'%s',_0x53b42f):_0x53b42f;if(_0x3f69f1[_0x5e239c]['groupBy']){_0x18f9c6[_0xb141('0x61')](_0x53b42f);}_0x3f69f1[_0x5e239c]['orderBy']&&_0x18f9c6[_0xb141('0x74')](_0x53b42f,_0x3f69f1[_0x5e239c]['orderBy']===_0xb141('0x75')?![]:!![]);_0x18f9c6[_0xb141('0x62')](_0x53b42f,_0x3f69f1[_0x5e239c][_0xb141('0x76')]||_0x53b42f);}if(_0x13cb11[_0xb141('0x77')]){_0x13cb11[_0xb141('0x77')]=JSON['parse'](_0x13cb11[_0xb141('0x77')]);for(var _0x361e13=0x0;_0x361e13<_0x13cb11[_0xb141('0x77')][_0xb141('0x33')];_0x361e13+=0x1){if(_0x13cb11[_0xb141('0x77')][_0x361e13][_0xb141('0x2a')]&&_[_0xb141('0x5b')](_0x56d1ac,_0x13cb11['joins'][_0x361e13]['type'])&&_0x13cb11['joins'][_0x361e13][_0xb141('0x79')]&&_0x13cb11[_0xb141('0x77')][_0x361e13][_0xb141('0x7a')]&&_0x13cb11['joins'][_0x361e13][_0xb141('0x7c')]){_0x18f9c6[_0x13cb11[_0xb141('0x77')][_0x361e13][_0xb141('0x2a')]](_0x13cb11[_0xb141('0x77')][_0x361e13]['foreignTable'],null,util[_0xb141('0x71')](_0xb141('0x7b'),_0x13cb11[_0xb141('0x6c')],_0x13cb11[_0xb141('0x77')][_0x361e13][_0xb141('0x79')],_0x13cb11[_0xb141('0x77')][_0x361e13][_0xb141('0x7a')],_0x13cb11['joins'][_0x361e13][_0xb141('0x7c')]));}}}if(_0x13cb11[_0xb141('0x7d')]){_0x13cb11[_0xb141('0x7d')]=JSON[_0xb141('0x78')](_0x13cb11[_0xb141('0x7d')]);_0x18f9c6[_0xb141('0x38')](_0x2e9f8b(_0x13cb11['conditions']['group']));}_0x362e9a=_0x18f9c6['clone']();_0x18f9c6[_0xb141('0x36')](_0x5d7448);_0x18f9c6[_0xb141('0x1c')](0x0);logger['debug'](_0xb141('0x80'),_0x18f9c6[_0xb141('0x81')]());return db[_0xb141('0x82')]['query'](_0x18f9c6[_0xb141('0x81')](),{'type':db[_0xb141('0x82')][_0xb141('0x83')][_0xb141('0x84')]});}})[_0xb141('0x20')](function(_0x5bdfe2){if(!_0x5bdfe2[_0xb141('0x33')]){throw new db[(_0xb141('0x66'))][(_0xb141('0x67'))](_0xb141('0x8b'),0xcc);}if(_0x387364[_0xb141('0x8c')]==='web'){return null;}var _0x2c5c00=_['merge'](_0x387364,{'name':_0x387364[_0xb141('0x8d')]||_0x387364[_0xb141('0x25')]||_0x13cb11[_0xb141('0x25')],'basename':_0x586550,'savename':util[_0xb141('0x71')](_0xb141('0x8e'),_0x387364[_0xb141('0x25')]||_0x13cb11['name'],require(_0xb141('0x8f'))[_0xb141('0x90')](0x4),_0x387364[_0xb141('0x8c')]||_0xb141('0x91')),'reportId':_0x13cb11['id'],'reportType':_0xb141('0x92')});return db[_0xb141('0x93')][_0xb141('0x46')](_0x2c5c00,{'raw':!![]});})['then'](function(_0x29b051){if(_0x13cb11[_0xb141('0x6c')]===_0xb141('0x94')){_0x362e9a['where'](_0x13cb11[_0xb141('0x6c')]+_0xb141('0x95'),_0x387364[_0xb141('0x96')],_0x387364['endDate']);}else{_0x362e9a['where'](_0x13cb11[_0xb141('0x6c')]+_0xb141('0x97'),_0x387364[_0xb141('0x96')],_0x387364[_0xb141('0x98')]);}if(_0x29b051){logger[_0xb141('0x99')](_0xb141('0x9a'),_0x362e9a[_0xb141('0x81')]());require('child_process')[_0xb141('0x9b')](path[_0xb141('0x4f')](__dirname,_0xb141('0x9c'),_0x29b051[_0xb141('0x8c')]),[_0x29b051['id'],_0x362e9a[_0xb141('0x81')](),path[_0xb141('0x4f')](__dirname,_0xb141('0x9d'),_0x29b051[_0xb141('0x9e')]),_0x586550]);return _0x29b051;}else{var _0x7b4ccb=squel[_0xb141('0x6a')]();_0x7b4ccb[_0xb141('0x6b')]('('+_0x362e9a[_0xb141('0x81')]()+')',_0xb141('0x9f'));_0x7b4ccb[_0xb141('0x62')](_0xb141('0xa0'),_0xb141('0x3f'));_0x362e9a['limit'](_0x387364[_0xb141('0x36')]||_0x5d7448);_0x362e9a[_0xb141('0x1c')](_0x387364[_0xb141('0x1c')]||0x0);return db[_0xb141('0x82')][_0xb141('0x2e')](_0x7b4ccb[_0xb141('0x81')](),{'type':db[_0xb141('0x82')][_0xb141('0x83')]['SELECT']})[_0xb141('0x20')](function(_0x29ce4c){if(!_0x29ce4c[_0xb141('0x33')]){_0x25aad9=0x0;}else{_0x25aad9=_0x29ce4c[0x0]['count']||0x0;}return db[_0xb141('0x82')]['query'](_0x362e9a[_0xb141('0x81')](),{'type':db[_0xb141('0x82')]['QueryTypes']['SELECT']});})[_0xb141('0x20')](function(_0x173595){return{'rows':_0x173595||[],'count':_0x25aad9};});}});}exports[_0xb141('0xa1')]=function(_0xd7cda3,_0x4bf458){return runReport(_0xd7cda3[_0xb141('0x44')],_0xd7cda3[_0xb141('0x2e')],_0xd7cda3['options'])[_0xb141('0x20')](respondWithResult(_0x4bf458,null))[_0xb141('0x43')](handleError(_0x4bf458,null));};exports[_0xb141('0xa2')]=runReport;exports[_0xb141('0x2e')]=function(_0x2682cb,_0x34ac44){var _0xcd6a45=0xa;var _0x20dea8=[_0xb141('0x4f'),_0xb141('0x50'),_0xb141('0x51'),_0xb141('0xa3')];var _0x264baa={'SUM':'SUM(%s)','COUNT':_0xb141('0x53'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0xb141('0x54'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xb141('0x55'),'GROUP_CONCAT ASC':_0xb141('0x56'),'GROUP_CONCAT DESC':_0xb141('0x57')};var _0x47dfe7={'SEC_TO_TIME':_0xb141('0x87'),'DATE':_0xb141('0x58'),'HOUR':_0xb141('0x59'),'ROUND':_0xb141('0x5a'),'UNIX_TIMESTAMP':_0xb141('0x88')};var _0x13dbe3=function(_0x1cf068){return!_[_0xb141('0x5b')]([_0xb141('0x5c'),_0xb141('0x89'),'IS\x20EMPTY','IS\x20NOT\x20EMPTY'],_0x1cf068);};var _0x4042d9=function(_0x34f38c){if(!_0x34f38c||!_0x34f38c[_0xb141('0x5f')][_0xb141('0x33')]){return'';}for(var _0xbc8d04='(',_0x51e711=0x0;_0x51e711<_0x34f38c['rules'][_0xb141('0x33')];_0x51e711+=0x1){_0x51e711>0x0&&(_0xbc8d04+='\x20'+_0x34f38c[_0xb141('0x60')]+'\x20');_0xbc8d04+=_0x34f38c[_0xb141('0x5f')][_0x51e711][_0xb141('0x61')]?_0x4042d9(_0x34f38c['rules'][_0x51e711][_0xb141('0x61')]):_0x34f38c[_0xb141('0x5f')][_0x51e711][_0xb141('0x62')]+'\x20'+_0x34f38c[_0xb141('0x5f')][_0x51e711][_0xb141('0x63')]+(_0x13dbe3(_0x34f38c[_0xb141('0x5f')][_0x51e711][_0xb141('0x63')])?'\x20'+_0x34f38c[_0xb141('0x5f')][_0x51e711]['value']:'');}return _0xbc8d04+')';};var _0x1f245d={'where':{'id':_0x2682cb[_0xb141('0x44')]['id']}},_0x4188fd,_0x3b7d06,_0x16b8c6,_0x219aaa,_0x11fd13;_0x1f245d=_[_0xb141('0x3a')]({},_0x1f245d,_0x2682cb[_0xb141('0x3d')]);return db[_0xb141('0x3e')][_0xb141('0x45')](_0x1f245d)[_0xb141('0x20')](function(_0xd4a258){if(_0xd4a258){_0x4188fd=_0xd4a258;return _0xd4a258[_0xb141('0x65')]();}return null;})[_0xb141('0x20')](function(_0x522af9){if(_0x522af9){if(!_0x522af9['length']){throw new db['Sequelize']['ValidationErrorItem'](_0xb141('0x68'),0x193);}_0x3b7d06=_0x522af9;return db[_0xb141('0x8a')]['findAll']({'raw':!![]});}return null;})[_0xb141('0x20')](function(_0x38e9c6){if(_0x38e9c6){_0x16b8c6=_[_0xb141('0x69')](_0x38e9c6,'id');var _0x2627e2;var _0x444d5f=squel[_0xb141('0x6a')]();_0x444d5f[_0xb141('0x6b')](_0x4188fd[_0xb141('0x6c')]);for(var _0x27917c=0x0;_0x27917c<_0x3b7d06[_0xb141('0x33')];_0x27917c+=0x1){_0x2627e2=_0x3b7d06[_0x27917c]['MetricId']?_0x16b8c6[_0x3b7d06[_0x27917c][_0xb141('0x6d')]]['metric']:_0x3b7d06[_0x27917c][_0xb141('0x62')];_0x2627e2=_0x3b7d06[_0x27917c]['function']?_[_0xb141('0x6f')](_0x264baa[_0x3b7d06[_0x27917c][_0xb141('0x70')]],'%s',_0x2627e2):_0x2627e2;_0x2627e2=_0x3b7d06[_0x27917c][_0xb141('0x71')]?_[_0xb141('0x6f')](_0x47dfe7[_0x3b7d06[_0x27917c][_0xb141('0x71')]],'%s',_0x2627e2):_0x2627e2;if(_0x3b7d06[_0x27917c]['groupBy']){_0x444d5f['group'](_0x2627e2);}_0x3b7d06[_0x27917c][_0xb141('0x73')]&&_0x444d5f['order'](_0x2627e2,_0x3b7d06[_0x27917c][_0xb141('0x73')]==='DESC'?![]:!![]);_0x444d5f[_0xb141('0x62')](_0x2627e2,_0x3b7d06[_0x27917c][_0xb141('0x76')]||_0x2627e2);}if(_0x4188fd['joins']){_0x4188fd['joins']=JSON[_0xb141('0x78')](_0x4188fd[_0xb141('0x77')]);for(var _0x3261b4=0x0;_0x3261b4<_0x4188fd['joins']['length'];_0x3261b4+=0x1){if(_0x4188fd['joins'][_0x3261b4][_0xb141('0x2a')]&&_['includes'](_0x20dea8,_0x4188fd['joins'][_0x3261b4][_0xb141('0x2a')])&&_0x4188fd[_0xb141('0x77')][_0x3261b4][_0xb141('0x79')]&&_0x4188fd[_0xb141('0x77')][_0x3261b4]['foreignTable']&&_0x4188fd[_0xb141('0x77')][_0x3261b4][_0xb141('0x7c')]){_0x444d5f[_0x4188fd[_0xb141('0x77')][_0x3261b4]['type']](_0x4188fd[_0xb141('0x77')][_0x3261b4]['foreignTable'],null,util[_0xb141('0x71')](_0xb141('0x7b'),_0x4188fd['table'],_0x4188fd[_0xb141('0x77')][_0x3261b4][_0xb141('0x79')],_0x4188fd['joins'][_0x3261b4][_0xb141('0x7a')],_0x4188fd[_0xb141('0x77')][_0x3261b4][_0xb141('0x7c')]));}}}if(_0x4188fd[_0xb141('0x7d')]){_0x4188fd[_0xb141('0x7d')]=JSON[_0xb141('0x78')](_0x4188fd['conditions']);_0x444d5f[_0xb141('0x38')](_0x4042d9(_0x4188fd[_0xb141('0x7d')]['group']));}_0x11fd13=_0x444d5f[_0xb141('0x7e')]();_0x444d5f[_0xb141('0x36')](_0xcd6a45);_0x444d5f['offset'](0x0);logger[_0xb141('0x7f')](_0xb141('0x80'),_0x444d5f['toString']());return db[_0xb141('0x82')][_0xb141('0x2e')](_0x444d5f[_0xb141('0x81')](),{'type':db[_0xb141('0x82')][_0xb141('0x83')]['SELECT']});}})['then'](function(){return{'sql':_0x11fd13[_0xb141('0x81')]()};})['then'](respondWithResult(_0x34ac44,null))['catch'](handleError(_0x34ac44,null));}; \ No newline at end of file +var _0x8273=['include','catch','show','params','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Reports','UserProfileSection','DefaultReports','find','preview','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','SEC_TO_TIME(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','findAll','from','table','MetricId','metric','function','format','groupBy','orderBy','DESC','alias','joins','parse','includes','foreignTable','%s.%s\x20=\x20%s.%s','parentKey','foreignKey','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','join','left_join','right_join','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','IS\x20EMPTY','keyBy','select','replace','No\x20available\x20data','web','fullPath','%s-%s.%s','generate','csv','default','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','output','../../files/reports','savename','countTable','SELECT','run','runReport','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','apply','reject','save','update','then','get','UserProfileResource','destroy','error','stack','name','index','AnalyticDefaultReport','rawAttributes','fieldName','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','merge','where','type','VIRTUAL','filter','options','includeAll'];(function(_0x289803,_0x593ea6){var _0x13b42c=function(_0x2c3ff0){while(--_0x2c3ff0){_0x289803['push'](_0x289803['shift']());}};_0x13b42c(++_0x593ea6);}(_0x8273,0x103));var _0x3827=function(_0x1977cc,_0x1fa9ca){_0x1977cc=_0x1977cc-0x0;var _0x514755=_0x8273[_0x1977cc];return _0x514755;};'use strict';var pdf=require(_0x3827('0x0'));var emlformat=require(_0x3827('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x3827('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3827('0x3'));var moment=require(_0x3827('0x4'));var BPromise=require(_0x3827('0x5'));var Mustache=require(_0x3827('0x6'));var util=require(_0x3827('0x7'));var path=require('path');var sox=require(_0x3827('0x8'));var csv=require(_0x3827('0x9'));var ejs=require(_0x3827('0xa'));var fs=require('fs');var _=require(_0x3827('0xb'));var squel=require(_0x3827('0xc'));var crypto=require('crypto');var jsforce=require(_0x3827('0xd'));var deskjs=require(_0x3827('0xe'));var toCsv=require(_0x3827('0x9'));var querystring=require(_0x3827('0xf'));var Papa=require('papaparse');var Redis=require(_0x3827('0x10'));var authService=require(_0x3827('0x11'));var qs=require(_0x3827('0x12'));var as=require(_0x3827('0x13'));var hardwareService=require(_0x3827('0x14'));var logger=require(_0x3827('0x15'))(_0x3827('0x16'));var utils=require('../../config/utils');var config=require(_0x3827('0x17'));var db=require(_0x3827('0x18'))['db'];function respondWithStatusCode(_0x34ff7c,_0x5eb69e){_0x5eb69e=_0x5eb69e||0xcc;return function(_0x45b2c3){if(_0x45b2c3){return _0x34ff7c[_0x3827('0x19')](_0x5eb69e);}return _0x34ff7c[_0x3827('0x1a')](_0x5eb69e)[_0x3827('0x1b')]();};}function respondWithResult(_0x5be61a,_0x390507){_0x390507=_0x390507||0xc8;return function(_0x44c38c){if(_0x44c38c){return _0x5be61a[_0x3827('0x1a')](_0x390507)['json'](_0x44c38c);}};}function respondWithFilteredResult(_0x1a69d5,_0xb52a1e){return function(_0x4ddcb7){if(_0x4ddcb7){var _0xef2c1f=_0x4ddcb7[_0x3827('0x1c')],_0x2a4ac7=_0xb52a1e[_0x3827('0x1d')],_0x3011c9=_0xb52a1e['offset']+_0xb52a1e[_0x3827('0x1e')],_0x3389d6;if(_0x3011c9>=_0xef2c1f){_0x3011c9=_0xef2c1f;_0x3389d6=0xc8;}else{_0x3389d6=0xce;}_0x1a69d5[_0x3827('0x1a')](_0x3389d6);return _0x1a69d5[_0x3827('0x1f')]('Content-Range',_0x2a4ac7+'-'+_0x3011c9+'/'+_0xef2c1f)['json'](_0x4ddcb7);}return null;};}function patchUpdates(_0x45c1cf){return function(_0x4e921a){try{jsonpatch[_0x3827('0x20')](_0x4e921a,_0x45c1cf,!![]);}catch(_0x22b8ec){return BPromise[_0x3827('0x21')](_0x22b8ec);}return _0x4e921a[_0x3827('0x22')]();};}function saveUpdates(_0x2711c4,_0x16c1bd){return function(_0x876c9f){if(_0x876c9f){return _0x876c9f[_0x3827('0x23')](_0x2711c4)['then'](function(_0x57b0ea){return _0x57b0ea;});}return null;};}function removeEntity(_0x22beb0,_0x150bc1){return function(_0x374118){if(_0x374118){return _0x374118['destroy']()[_0x3827('0x24')](function(){var _0xb6eb68=_0x374118[_0x3827('0x25')]({'plain':!![]});var _0x2604f7='DefaultReports';return db[_0x3827('0x26')][_0x3827('0x27')]({'where':{'type':_0x2604f7,'resourceId':_0xb6eb68['id']}})['then'](function(){return _0x374118;});})['then'](function(){_0x22beb0[_0x3827('0x1a')](0xcc)[_0x3827('0x1b')]();});}};}function handleEntityNotFound(_0x433abd,_0x42c3a9){return function(_0x5a5c06){if(!_0x5a5c06){_0x433abd['sendStatus'](0x194);}return _0x5a5c06;};}function handleError(_0x210db5,_0x50908e){_0x50908e=_0x50908e||0x1f4;return function(_0x526372){logger[_0x3827('0x28')](_0x526372[_0x3827('0x29')]);if(_0x526372[_0x3827('0x2a')]){delete _0x526372['name'];}_0x210db5[_0x3827('0x1a')](_0x50908e)['send'](_0x526372);};}exports[_0x3827('0x2b')]=function(_0x223c84,_0x5aed58){var _0x2e3eef={},_0x56a592={},_0x2b28bf={'count':0x0,'rows':[]};var _0xa9131a=_['map'](db[_0x3827('0x2c')][_0x3827('0x2d')],function(_0x23dd16){return{'name':_0x23dd16[_0x3827('0x2e')],'type':_0x23dd16['type'][_0x3827('0x2f')]};});_0x56a592[_0x3827('0x30')]=_[_0x3827('0x31')](_0xa9131a,_0x3827('0x2a'));_0x56a592[_0x3827('0x32')]=_['keys'](_0x223c84['query']);_0x56a592[_0x3827('0x33')]=_[_0x3827('0x34')](_0x56a592[_0x3827('0x30')],_0x56a592[_0x3827('0x32')]);_0x2e3eef[_0x3827('0x35')]=_[_0x3827('0x34')](_0x56a592['model'],qs[_0x3827('0x36')](_0x223c84[_0x3827('0x32')][_0x3827('0x36')]));_0x2e3eef[_0x3827('0x35')]=_0x2e3eef['attributes'][_0x3827('0x37')]?_0x2e3eef[_0x3827('0x35')]:_0x56a592[_0x3827('0x30')];if(!_0x223c84[_0x3827('0x32')][_0x3827('0x38')](_0x3827('0x39'))){_0x2e3eef[_0x3827('0x1e')]=qs[_0x3827('0x1e')](_0x223c84[_0x3827('0x32')][_0x3827('0x1e')]);_0x2e3eef[_0x3827('0x1d')]=qs['offset'](_0x223c84[_0x3827('0x32')][_0x3827('0x1d')]);}_0x2e3eef[_0x3827('0x3a')]=qs['sort'](_0x223c84[_0x3827('0x32')][_0x3827('0x3b')]);_0x2e3eef['where']=qs[_0x3827('0x33')](_['pick'](_0x223c84['query'],_0x56a592[_0x3827('0x33')]));if(_0x223c84[_0x3827('0x32')]['filter']){_0x2e3eef['where']=_[_0x3827('0x3c')](_0x2e3eef[_0x3827('0x3d')],{'$or':_['map'](_0xa9131a,function(_0xaa6c66){if(_0xaa6c66[_0x3827('0x3e')]!==_0x3827('0x3f')){var _0x32d42c={};_0x32d42c[_0xaa6c66[_0x3827('0x2a')]]={'$like':'%'+_0x223c84['query'][_0x3827('0x40')]+'%'};return _0x32d42c;}})});}_0x2e3eef=_[_0x3827('0x3c')]({},_0x2e3eef,_0x223c84[_0x3827('0x41')]);var _0x178079={'where':_0x2e3eef['where']};return db[_0x3827('0x2c')][_0x3827('0x1c')](_0x178079)['then'](function(_0x4857ba){_0x2b28bf[_0x3827('0x1c')]=_0x4857ba;if(_0x223c84[_0x3827('0x32')][_0x3827('0x42')]){_0x2e3eef[_0x3827('0x43')]=[{'all':!![]}];}return db[_0x3827('0x2c')]['findAll'](_0x2e3eef);})[_0x3827('0x24')](function(_0x5c3df1){_0x2b28bf['rows']=_0x5c3df1;return _0x2b28bf;})['then'](respondWithFilteredResult(_0x5aed58,_0x2e3eef))[_0x3827('0x44')](handleError(_0x5aed58,null));};exports[_0x3827('0x45')]=function(_0x38cef2,_0x4886fb){var _0x3fbb48={'raw':!![],'where':{'id':_0x38cef2[_0x3827('0x46')]['id']}},_0x59e9db={};_0x59e9db[_0x3827('0x30')]=_['keys'](db[_0x3827('0x2c')][_0x3827('0x2d')]);_0x59e9db['query']=_['keys'](_0x38cef2[_0x3827('0x32')]);_0x59e9db['filters']=_['intersection'](_0x59e9db['model'],_0x59e9db[_0x3827('0x32')]);_0x3fbb48['attributes']=_[_0x3827('0x34')](_0x59e9db[_0x3827('0x30')],qs[_0x3827('0x36')](_0x38cef2[_0x3827('0x32')][_0x3827('0x36')]));_0x3fbb48['attributes']=_0x3fbb48[_0x3827('0x35')]['length']?_0x3fbb48[_0x3827('0x35')]:_0x59e9db[_0x3827('0x30')];if(_0x38cef2[_0x3827('0x32')][_0x3827('0x42')]){_0x3fbb48[_0x3827('0x43')]=[{'all':!![]}];}_0x3fbb48=_[_0x3827('0x3c')]({},_0x3fbb48,_0x38cef2['options']);return db[_0x3827('0x2c')]['find'](_0x3fbb48)[_0x3827('0x24')](handleEntityNotFound(_0x4886fb,null))['then'](respondWithResult(_0x4886fb,null))['catch'](handleError(_0x4886fb,null));};exports[_0x3827('0x47')]=function(_0x287bfe,_0x266cb4){return db[_0x3827('0x2c')][_0x3827('0x47')](_0x287bfe[_0x3827('0x48')],{})[_0x3827('0x24')](function(_0xb7f27c){var _0x2f7785=_0x287bfe['user'][_0x3827('0x25')]({'plain':!![]});if(!_0x2f7785)throw new Error(_0x3827('0x49'));if(_0x2f7785[_0x3827('0x4a')]===_0x3827('0x4b')){var _0x18ecfb=_0xb7f27c[_0x3827('0x25')]({'plain':!![]});var _0x300be2=_0x3827('0x4c');return db[_0x3827('0x4d')]['find']({'where':{'name':_0x300be2,'userProfileId':_0x2f7785['userProfileId']},'raw':!![]})['then'](function(_0x199262){if(_0x199262&&_0x199262['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x18ecfb['name'],'resourceId':_0x18ecfb['id'],'type':_0x3827('0x4e'),'sectionId':_0x199262['id']},{})[_0x3827('0x24')](function(){return _0xb7f27c;});}else{return _0xb7f27c;}})[_0x3827('0x44')](function(_0x541055){logger[_0x3827('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x541055);throw _0x541055;});}return _0xb7f27c;})['then'](respondWithResult(_0x266cb4,0xc9))[_0x3827('0x44')](handleError(_0x266cb4,null));};exports[_0x3827('0x23')]=function(_0x1d470c,_0x1664b8){if(_0x1d470c[_0x3827('0x48')]['id']){delete _0x1d470c['body']['id'];}return db[_0x3827('0x2c')][_0x3827('0x4f')]({'where':{'id':_0x1d470c[_0x3827('0x46')]['id']}})[_0x3827('0x24')](handleEntityNotFound(_0x1664b8,null))[_0x3827('0x24')](saveUpdates(_0x1d470c[_0x3827('0x48')],null))[_0x3827('0x24')](respondWithResult(_0x1664b8,null))[_0x3827('0x44')](handleError(_0x1664b8,null));};exports[_0x3827('0x27')]=function(_0x228c2a,_0x3a6ab4){return db[_0x3827('0x2c')]['find']({'where':{'id':_0x228c2a['params']['id']}})[_0x3827('0x24')](handleEntityNotFound(_0x3a6ab4,null))[_0x3827('0x24')](removeEntity(_0x3a6ab4,null))['catch'](handleError(_0x3a6ab4,null));};exports[_0x3827('0x50')]=function(_0x4135bc,_0x48f1c2){var _0x3b87ea=0xa;var _0x13a23e=['join','left_join','right_join',_0x3827('0x51')];var _0x196479={'SUM':_0x3827('0x52'),'COUNT':_0x3827('0x53'),'COUNT DISTINCT':_0x3827('0x54'),'MAX':_0x3827('0x55'),'MIN':_0x3827('0x56'),'AVG':_0x3827('0x57'),'GROUP_CONCAT':_0x3827('0x58'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x331c6a={'SEC_TO_TIME':_0x3827('0x59'),'DATE':'DATE(%s)','HOUR':_0x3827('0x5a'),'ROUND':_0x3827('0x5b'),'UNIX_TIMESTAMP':_0x3827('0x5c')};var _0x35106f=function(_0x4b9ce6){return!_['includes']([_0x3827('0x5d'),_0x3827('0x5e'),'IS\x20EMPTY',_0x3827('0x5f')],_0x4b9ce6);};var _0x1a0fb8=function(_0x282d74){if(!_0x282d74||!_0x282d74['rules'][_0x3827('0x37')]){return'';}for(var _0x2811df='(',_0x377297=0x0;_0x377297<_0x282d74[_0x3827('0x60')]['length'];_0x377297+=0x1){_0x377297>0x0&&(_0x2811df+='\x20'+_0x282d74[_0x3827('0x61')]+'\x20');_0x2811df+=_0x282d74[_0x3827('0x60')][_0x377297][_0x3827('0x62')]?_0x1a0fb8(_0x282d74['rules'][_0x377297][_0x3827('0x62')]):_0x282d74[_0x3827('0x60')][_0x377297][_0x3827('0x63')]+'\x20'+_0x282d74[_0x3827('0x60')][_0x377297][_0x3827('0x64')]+(_0x35106f(_0x282d74[_0x3827('0x60')][_0x377297][_0x3827('0x64')])?'\x20'+_0x282d74[_0x3827('0x60')][_0x377297][_0x3827('0x65')]:'');}return _0x2811df+')';};var _0x5c22f8={'where':{'id':_0x4135bc[_0x3827('0x46')]['id']}},_0x423b01,_0x595d3,_0x74ab1e,_0x193683,_0xcd8849;_0x5c22f8=_[_0x3827('0x3c')]({},_0x5c22f8,_0x4135bc[_0x3827('0x41')]);return db[_0x3827('0x2c')]['find'](_0x5c22f8)[_0x3827('0x24')](function(_0x5a11cf){if(_0x5a11cf){_0x423b01=_0x5a11cf;return _0x5a11cf[_0x3827('0x66')]();}return null;})['then'](function(_0x2ceff1){if(_0x2ceff1){if(!_0x2ceff1['length']){throw new db[(_0x3827('0x67'))][(_0x3827('0x68'))](_0x3827('0x69'),0x193);}_0x595d3=_0x2ceff1;return db[_0x3827('0x6a')][_0x3827('0x6b')]({'raw':!![]});}return null;})[_0x3827('0x24')](function(_0x76315d){if(_0x76315d){_0x74ab1e=_['keyBy'](_0x76315d,'id');var _0x1db37c;var _0x265a67=squel['select']();_0x265a67[_0x3827('0x6c')](_0x423b01[_0x3827('0x6d')]);for(var _0x5dbc8b=0x0;_0x5dbc8b<_0x595d3[_0x3827('0x37')];_0x5dbc8b+=0x1){_0x1db37c=_0x595d3[_0x5dbc8b][_0x3827('0x6e')]?_0x74ab1e[_0x595d3[_0x5dbc8b][_0x3827('0x6e')]][_0x3827('0x6f')]:_0x595d3[_0x5dbc8b]['field'];_0x1db37c=_0x595d3[_0x5dbc8b][_0x3827('0x70')]?_['replace'](_0x196479[_0x595d3[_0x5dbc8b][_0x3827('0x70')]],'%s',_0x1db37c):_0x1db37c;_0x1db37c=_0x595d3[_0x5dbc8b][_0x3827('0x71')]?_['replace'](_0x331c6a[_0x595d3[_0x5dbc8b][_0x3827('0x71')]],'%s',_0x1db37c):_0x1db37c;if(_0x595d3[_0x5dbc8b][_0x3827('0x72')]){_0x265a67[_0x3827('0x62')](_0x1db37c);}_0x595d3[_0x5dbc8b]['orderBy']&&_0x265a67[_0x3827('0x3a')](_0x1db37c,_0x595d3[_0x5dbc8b][_0x3827('0x73')]===_0x3827('0x74')?![]:!![]);_0x265a67['field'](_0x1db37c,_0x595d3[_0x5dbc8b][_0x3827('0x75')]||_0x1db37c);}if(_0x423b01[_0x3827('0x76')]){_0x423b01[_0x3827('0x76')]=JSON[_0x3827('0x77')](_0x423b01['joins']);for(var _0x5126bc=0x0;_0x5126bc<_0x423b01['joins'][_0x3827('0x37')];_0x5126bc+=0x1){if(_0x423b01[_0x3827('0x76')][_0x5126bc][_0x3827('0x3e')]&&_[_0x3827('0x78')](_0x13a23e,_0x423b01[_0x3827('0x76')][_0x5126bc][_0x3827('0x3e')])&&_0x423b01[_0x3827('0x76')][_0x5126bc]['parentKey']&&_0x423b01[_0x3827('0x76')][_0x5126bc][_0x3827('0x79')]&&_0x423b01[_0x3827('0x76')][_0x5126bc]['foreignKey']){_0x265a67[_0x423b01[_0x3827('0x76')][_0x5126bc][_0x3827('0x3e')]](_0x423b01[_0x3827('0x76')][_0x5126bc][_0x3827('0x79')],null,util['format'](_0x3827('0x7a'),_0x423b01['table'],_0x423b01[_0x3827('0x76')][_0x5126bc][_0x3827('0x7b')],_0x423b01['joins'][_0x5126bc][_0x3827('0x79')],_0x423b01[_0x3827('0x76')][_0x5126bc][_0x3827('0x7c')]));}}}if(_0x423b01[_0x3827('0x7d')]){_0x423b01[_0x3827('0x7d')]=JSON[_0x3827('0x77')](_0x423b01[_0x3827('0x7d')]);_0x265a67[_0x3827('0x3d')](_0x1a0fb8(_0x423b01['conditions'][_0x3827('0x62')]));}_0xcd8849=_0x265a67[_0x3827('0x7e')]();_0x265a67[_0x3827('0x1e')](_0x3b87ea);_0x265a67[_0x3827('0x1d')](0x0);logger[_0x3827('0x7f')](_0x3827('0x80'),_0x265a67[_0x3827('0x81')]());return db[_0x3827('0x82')][_0x3827('0x32')](_0x265a67[_0x3827('0x81')](),{'type':db[_0x3827('0x82')][_0x3827('0x83')]['SELECT']});}})[_0x3827('0x24')](respondWithResult(_0x48f1c2,null))['catch'](handleError(_0x48f1c2,null));};function runReport(_0x4c454e,_0x46346f,_0xb38da6){var _0x35a8e1=_0x46346f['name'];var _0x5ed765=0xa;var _0x296752=[_0x3827('0x84'),_0x3827('0x85'),_0x3827('0x86'),_0x3827('0x51')];var _0x1d2014={'SUM':_0x3827('0x52'),'COUNT':_0x3827('0x53'),'COUNT DISTINCT':_0x3827('0x54'),'MAX':_0x3827('0x55'),'MIN':_0x3827('0x56'),'AVG':'AVG(%s)','GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x3827('0x87'),'GROUP_CONCAT DESC':_0x3827('0x88')};var _0x804725={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x3827('0x89'),'HOUR':_0x3827('0x5a'),'ROUND':_0x3827('0x5b'),'UNIX_TIMESTAMP':_0x3827('0x5c')};var _0xdc3f9a=function(_0x2d59f6){return!_[_0x3827('0x78')]([_0x3827('0x5d'),_0x3827('0x5e'),_0x3827('0x8a'),_0x3827('0x5f')],_0x2d59f6);};var _0x2a1141=function(_0x59c8d6){if(!_0x59c8d6||!_0x59c8d6[_0x3827('0x60')][_0x3827('0x37')]){return'';}for(var _0x406321='(',_0x4d13bd=0x0;_0x4d13bd<_0x59c8d6['rules']['length'];_0x4d13bd+=0x1){_0x4d13bd>0x0&&(_0x406321+='\x20'+_0x59c8d6[_0x3827('0x61')]+'\x20');_0x406321+=_0x59c8d6[_0x3827('0x60')][_0x4d13bd][_0x3827('0x62')]?_0x2a1141(_0x59c8d6[_0x3827('0x60')][_0x4d13bd]['group']):_0x59c8d6['rules'][_0x4d13bd][_0x3827('0x63')]+'\x20'+_0x59c8d6[_0x3827('0x60')][_0x4d13bd][_0x3827('0x64')]+(_0xdc3f9a(_0x59c8d6[_0x3827('0x60')][_0x4d13bd][_0x3827('0x64')])?'\x20'+_0x59c8d6[_0x3827('0x60')][_0x4d13bd]['value']:'');}return _0x406321+')';};var _0x547b69={'where':{'id':_0x4c454e['id']}},_0x307aa4,_0x566cc1,_0xa059d1,_0x1ada1a,_0x4e7ba7;_0x547b69=_[_0x3827('0x3c')]({},_0x547b69,_0xb38da6);return db[_0x3827('0x2c')][_0x3827('0x4f')](_0x547b69)['then'](function(_0xf8995e){if(_0xf8995e){_0x307aa4=_0xf8995e;return _0xf8995e[_0x3827('0x66')]();}return null;})['then'](function(_0xf9d07a){if(_0xf9d07a){if(!_0xf9d07a['length']){throw new db[(_0x3827('0x67'))]['ValidationErrorItem'](_0x3827('0x69'),0x193);}_0x566cc1=_0xf9d07a;return db[_0x3827('0x6a')][_0x3827('0x6b')]({'raw':!![]});}return null;})['then'](function(_0x37cd96){if(_0x37cd96){_0xa059d1=_[_0x3827('0x8b')](_0x37cd96,'id');var _0xbdd25f;var _0x15a619=squel[_0x3827('0x8c')]();_0x15a619[_0x3827('0x6c')](_0x307aa4[_0x3827('0x6d')]);for(var _0x55c177=0x0;_0x55c177<_0x566cc1[_0x3827('0x37')];_0x55c177+=0x1){_0xbdd25f=_0x566cc1[_0x55c177][_0x3827('0x6e')]?_0xa059d1[_0x566cc1[_0x55c177][_0x3827('0x6e')]][_0x3827('0x6f')]:_0x566cc1[_0x55c177][_0x3827('0x63')];_0xbdd25f=_0x566cc1[_0x55c177][_0x3827('0x70')]?_[_0x3827('0x8d')](_0x1d2014[_0x566cc1[_0x55c177][_0x3827('0x70')]],'%s',_0xbdd25f):_0xbdd25f;_0xbdd25f=_0x566cc1[_0x55c177]['format']?_[_0x3827('0x8d')](_0x804725[_0x566cc1[_0x55c177][_0x3827('0x71')]],'%s',_0xbdd25f):_0xbdd25f;if(_0x566cc1[_0x55c177][_0x3827('0x72')]){_0x15a619[_0x3827('0x62')](_0xbdd25f);}_0x566cc1[_0x55c177][_0x3827('0x73')]&&_0x15a619[_0x3827('0x3a')](_0xbdd25f,_0x566cc1[_0x55c177][_0x3827('0x73')]===_0x3827('0x74')?![]:!![]);_0x15a619['field'](_0xbdd25f,_0x566cc1[_0x55c177][_0x3827('0x75')]||_0xbdd25f);}if(_0x307aa4['joins']){_0x307aa4[_0x3827('0x76')]=JSON[_0x3827('0x77')](_0x307aa4[_0x3827('0x76')]);for(var _0x1de4bf=0x0;_0x1de4bf<_0x307aa4['joins']['length'];_0x1de4bf+=0x1){if(_0x307aa4['joins'][_0x1de4bf][_0x3827('0x3e')]&&_[_0x3827('0x78')](_0x296752,_0x307aa4[_0x3827('0x76')][_0x1de4bf][_0x3827('0x3e')])&&_0x307aa4[_0x3827('0x76')][_0x1de4bf]['parentKey']&&_0x307aa4[_0x3827('0x76')][_0x1de4bf][_0x3827('0x79')]&&_0x307aa4[_0x3827('0x76')][_0x1de4bf][_0x3827('0x7c')]){_0x15a619[_0x307aa4[_0x3827('0x76')][_0x1de4bf]['type']](_0x307aa4[_0x3827('0x76')][_0x1de4bf][_0x3827('0x79')],null,util[_0x3827('0x71')](_0x3827('0x7a'),_0x307aa4[_0x3827('0x6d')],_0x307aa4[_0x3827('0x76')][_0x1de4bf]['parentKey'],_0x307aa4[_0x3827('0x76')][_0x1de4bf][_0x3827('0x79')],_0x307aa4['joins'][_0x1de4bf][_0x3827('0x7c')]));}}}if(_0x307aa4['conditions']){_0x307aa4[_0x3827('0x7d')]=JSON['parse'](_0x307aa4[_0x3827('0x7d')]);_0x15a619[_0x3827('0x3d')](_0x2a1141(_0x307aa4['conditions']['group']));}_0x4e7ba7=_0x15a619[_0x3827('0x7e')]();_0x15a619['limit'](_0x5ed765);_0x15a619[_0x3827('0x1d')](0x0);logger[_0x3827('0x7f')](_0x3827('0x80'),_0x15a619[_0x3827('0x81')]());return db['sequelize'][_0x3827('0x32')](_0x15a619[_0x3827('0x81')](),{'type':db['sequelize']['QueryTypes']['SELECT']});}})[_0x3827('0x24')](function(_0x23664e){if(!_0x23664e[_0x3827('0x37')]){throw new db['Sequelize']['ValidationErrorItem'](_0x3827('0x8e'),0xcc);}if(_0x46346f['output']===_0x3827('0x8f')){return null;}var _0x3f816e=_[_0x3827('0x3c')](_0x46346f,{'name':_0x46346f[_0x3827('0x90')]||_0x46346f[_0x3827('0x2a')]||_0x307aa4[_0x3827('0x2a')],'basename':_0x35a8e1,'savename':util['format'](_0x3827('0x91'),_0x46346f['name']||_0x307aa4[_0x3827('0x2a')],require('randomstring')[_0x3827('0x92')](0x4),_0x46346f['output']||_0x3827('0x93')),'reportId':_0x307aa4['id'],'reportType':_0x3827('0x94')});return db['AnalyticExtractedReport']['create'](_0x3f816e,{'raw':!![]});})[_0x3827('0x24')](function(_0x4b99ec){if(_0x307aa4[_0x3827('0x6d')]===_0x3827('0x95')){_0x4e7ba7[_0x3827('0x3d')](_0x307aa4[_0x3827('0x6d')]+_0x3827('0x96'),_0x46346f['startDate'],_0x46346f[_0x3827('0x97')]);}else{_0x4e7ba7[_0x3827('0x3d')](_0x307aa4[_0x3827('0x6d')]+_0x3827('0x98'),_0x46346f['startDate'],_0x46346f[_0x3827('0x97')]);}if(_0x4b99ec){logger[_0x3827('0x99')](_0x3827('0x9a'),_0x4e7ba7[_0x3827('0x81')]());require(_0x3827('0x9b'))['fork'](path[_0x3827('0x84')](__dirname,'../../components/export/',_0x4b99ec[_0x3827('0x9c')]),[_0x4b99ec['id'],_0x4e7ba7['toString'](),path[_0x3827('0x84')](__dirname,_0x3827('0x9d'),_0x4b99ec[_0x3827('0x9e')]),_0x35a8e1]);return _0x4b99ec;}else{var _0x611b98=squel[_0x3827('0x8c')]();_0x611b98[_0x3827('0x6c')]('('+_0x4e7ba7[_0x3827('0x81')]()+')',_0x3827('0x9f'));_0x611b98[_0x3827('0x63')]('COUNT(*)',_0x3827('0x1c'));_0x4e7ba7[_0x3827('0x1e')](_0x46346f['limit']||_0x5ed765);_0x4e7ba7[_0x3827('0x1d')](_0x46346f[_0x3827('0x1d')]||0x0);return db['sequelize']['query'](_0x611b98[_0x3827('0x81')](),{'type':db[_0x3827('0x82')][_0x3827('0x83')][_0x3827('0xa0')]})[_0x3827('0x24')](function(_0x2749c5){if(!_0x2749c5[_0x3827('0x37')]){_0x1ada1a=0x0;}else{_0x1ada1a=_0x2749c5[0x0]['count']||0x0;}return db[_0x3827('0x82')][_0x3827('0x32')](_0x4e7ba7['toString'](),{'type':db[_0x3827('0x82')][_0x3827('0x83')]['SELECT']});})[_0x3827('0x24')](function(_0xff81b0){return{'rows':_0xff81b0||[],'count':_0x1ada1a};});}});}exports[_0x3827('0xa1')]=function(_0x4a4ae8,_0x186e3e){return runReport(_0x4a4ae8['params'],_0x4a4ae8[_0x3827('0x32')],_0x4a4ae8[_0x3827('0x41')])[_0x3827('0x24')](respondWithResult(_0x186e3e,null))[_0x3827('0x44')](handleError(_0x186e3e,null));};exports[_0x3827('0xa2')]=runReport;exports[_0x3827('0x32')]=function(_0xa08d5b,_0x4ffc15){var _0x44e42b=0xa;var _0x563d64=[_0x3827('0x84'),_0x3827('0x85'),_0x3827('0x86'),_0x3827('0x51')];var _0x23dae3={'SUM':'SUM(%s)','COUNT':_0x3827('0x53'),'COUNT DISTINCT':_0x3827('0x54'),'MAX':_0x3827('0x55'),'MIN':'MIN(%s)','AVG':_0x3827('0x57'),'GROUP_CONCAT':_0x3827('0x58'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x565bd3={'SEC_TO_TIME':_0x3827('0x59'),'DATE':_0x3827('0x89'),'HOUR':'HOUR(%s)','ROUND':_0x3827('0x5b'),'UNIX_TIMESTAMP':_0x3827('0x5c')};var _0xdea99d=function(_0x4b7496){return!_[_0x3827('0x78')]([_0x3827('0x5d'),_0x3827('0x5e'),_0x3827('0x8a'),'IS\x20NOT\x20EMPTY'],_0x4b7496);};var _0x12bfb9=function(_0xa3a35a){if(!_0xa3a35a||!_0xa3a35a['rules'][_0x3827('0x37')]){return'';}for(var _0x5ab1c2='(',_0x400d1b=0x0;_0x400d1b<_0xa3a35a['rules'][_0x3827('0x37')];_0x400d1b+=0x1){_0x400d1b>0x0&&(_0x5ab1c2+='\x20'+_0xa3a35a[_0x3827('0x61')]+'\x20');_0x5ab1c2+=_0xa3a35a[_0x3827('0x60')][_0x400d1b][_0x3827('0x62')]?_0x12bfb9(_0xa3a35a[_0x3827('0x60')][_0x400d1b][_0x3827('0x62')]):_0xa3a35a['rules'][_0x400d1b][_0x3827('0x63')]+'\x20'+_0xa3a35a[_0x3827('0x60')][_0x400d1b][_0x3827('0x64')]+(_0xdea99d(_0xa3a35a[_0x3827('0x60')][_0x400d1b]['condition'])?'\x20'+_0xa3a35a[_0x3827('0x60')][_0x400d1b]['value']:'');}return _0x5ab1c2+')';};var _0x7fe5dc={'where':{'id':_0xa08d5b[_0x3827('0x46')]['id']}},_0x466031,_0x484436,_0x189199,_0x3a6492,_0x10a56a;_0x7fe5dc=_['merge']({},_0x7fe5dc,_0xa08d5b[_0x3827('0x41')]);return db['AnalyticDefaultReport']['find'](_0x7fe5dc)[_0x3827('0x24')](function(_0xa5e1fe){if(_0xa5e1fe){_0x466031=_0xa5e1fe;return _0xa5e1fe[_0x3827('0x66')]();}return null;})[_0x3827('0x24')](function(_0x6c5051){if(_0x6c5051){if(!_0x6c5051[_0x3827('0x37')]){throw new db[(_0x3827('0x67'))][(_0x3827('0x68'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x484436=_0x6c5051;return db[_0x3827('0x6a')]['findAll']({'raw':!![]});}return null;})[_0x3827('0x24')](function(_0x4dd3c4){if(_0x4dd3c4){_0x189199=_['keyBy'](_0x4dd3c4,'id');var _0x5e6e33;var _0x5d0d10=squel[_0x3827('0x8c')]();_0x5d0d10[_0x3827('0x6c')](_0x466031[_0x3827('0x6d')]);for(var _0x32f83b=0x0;_0x32f83b<_0x484436['length'];_0x32f83b+=0x1){_0x5e6e33=_0x484436[_0x32f83b]['MetricId']?_0x189199[_0x484436[_0x32f83b]['MetricId']][_0x3827('0x6f')]:_0x484436[_0x32f83b][_0x3827('0x63')];_0x5e6e33=_0x484436[_0x32f83b]['function']?_[_0x3827('0x8d')](_0x23dae3[_0x484436[_0x32f83b][_0x3827('0x70')]],'%s',_0x5e6e33):_0x5e6e33;_0x5e6e33=_0x484436[_0x32f83b]['format']?_[_0x3827('0x8d')](_0x565bd3[_0x484436[_0x32f83b][_0x3827('0x71')]],'%s',_0x5e6e33):_0x5e6e33;if(_0x484436[_0x32f83b][_0x3827('0x72')]){_0x5d0d10['group'](_0x5e6e33);}_0x484436[_0x32f83b][_0x3827('0x73')]&&_0x5d0d10[_0x3827('0x3a')](_0x5e6e33,_0x484436[_0x32f83b]['orderBy']===_0x3827('0x74')?![]:!![]);_0x5d0d10[_0x3827('0x63')](_0x5e6e33,_0x484436[_0x32f83b][_0x3827('0x75')]||_0x5e6e33);}if(_0x466031['joins']){_0x466031['joins']=JSON[_0x3827('0x77')](_0x466031[_0x3827('0x76')]);for(var _0x584423=0x0;_0x584423<_0x466031['joins'][_0x3827('0x37')];_0x584423+=0x1){if(_0x466031[_0x3827('0x76')][_0x584423][_0x3827('0x3e')]&&_['includes'](_0x563d64,_0x466031[_0x3827('0x76')][_0x584423][_0x3827('0x3e')])&&_0x466031[_0x3827('0x76')][_0x584423]['parentKey']&&_0x466031['joins'][_0x584423][_0x3827('0x79')]&&_0x466031[_0x3827('0x76')][_0x584423][_0x3827('0x7c')]){_0x5d0d10[_0x466031[_0x3827('0x76')][_0x584423][_0x3827('0x3e')]](_0x466031[_0x3827('0x76')][_0x584423]['foreignTable'],null,util[_0x3827('0x71')](_0x3827('0x7a'),_0x466031['table'],_0x466031[_0x3827('0x76')][_0x584423][_0x3827('0x7b')],_0x466031[_0x3827('0x76')][_0x584423][_0x3827('0x79')],_0x466031['joins'][_0x584423][_0x3827('0x7c')]));}}}if(_0x466031[_0x3827('0x7d')]){_0x466031[_0x3827('0x7d')]=JSON[_0x3827('0x77')](_0x466031[_0x3827('0x7d')]);_0x5d0d10[_0x3827('0x3d')](_0x12bfb9(_0x466031[_0x3827('0x7d')][_0x3827('0x62')]));}_0x10a56a=_0x5d0d10['clone']();_0x5d0d10[_0x3827('0x1e')](_0x44e42b);_0x5d0d10[_0x3827('0x1d')](0x0);logger[_0x3827('0x7f')]('Limited\x20Query:',_0x5d0d10[_0x3827('0x81')]());return db[_0x3827('0x82')][_0x3827('0x32')](_0x5d0d10[_0x3827('0x81')](),{'type':db[_0x3827('0x82')][_0x3827('0x83')][_0x3827('0xa0')]});}})[_0x3827('0x24')](function(){return{'sql':_0x10a56a[_0x3827('0x81')]()};})[_0x3827('0x24')](respondWithResult(_0x4ffc15,null))[_0x3827('0x44')](handleError(_0x4ffc15,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 7c351dd..7d9bf1e 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 _0x7b40=['rimraf','./analyticDefaultReport.attributes','define','analytics_default_reports','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x7b40,0x7c));var _0x07b4=function(_0x5e2e72,_0x17455e){_0x5e2e72=_0x5e2e72-0x0;var _0x40d6ec=_0x7b40[_0x5e2e72];return _0x40d6ec;};'use strict';var _=require(_0x07b4('0x0'));var util=require(_0x07b4('0x1'));var logger=require(_0x07b4('0x2'))(_0x07b4('0x3'));var moment=require(_0x07b4('0x4'));var BPromise=require(_0x07b4('0x5'));var rp=require(_0x07b4('0x6'));var fs=require('fs');var path=require(_0x07b4('0x7'));var rimraf=require(_0x07b4('0x8'));var config=require('../../config/environment');var attributes=require(_0x07b4('0x9'));module['exports']=function(_0x2e7f47,_0xd45f4d){return _0x2e7f47[_0x07b4('0xa')]('AnalyticDefaultReport',attributes,{'tableName':_0x07b4('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0a67=['analytics_default_reports','lodash','util','../../config/logger','api','bluebird','path','rimraf','exports','define','AnalyticDefaultReport'];(function(_0x3f5932,_0x296f11){var _0x3b3690=function(_0x3e8e79){while(--_0x3e8e79){_0x3f5932['push'](_0x3f5932['shift']());}};_0x3b3690(++_0x296f11);}(_0x0a67,0x1c4));var _0x70a6=function(_0x57317a,_0x5b8e9e){_0x57317a=_0x57317a-0x0;var _0x58329a=_0x0a67[_0x57317a];return _0x58329a;};'use strict';var _=require(_0x70a6('0x0'));var util=require(_0x70a6('0x1'));var logger=require(_0x70a6('0x2'))(_0x70a6('0x3'));var moment=require('moment');var BPromise=require(_0x70a6('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x70a6('0x5'));var rimraf=require(_0x70a6('0x6'));var config=require('../../config/environment');var attributes=require('./analyticDefaultReport.attributes');module[_0x70a6('0x7')]=function(_0x4581a6,_0x590819){return _0x4581a6[_0x70a6('0x8')](_0x70a6('0x9'),attributes,{'tableName':_0x70a6('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 32b29b8..b25f186 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 _0x35a9=['util','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','code','error','AnalyticDefaultReport,\x20%s,\x20%s','message','result','catch'];(function(_0x33f3dd,_0x50c4a7){var _0x438811=function(_0x244a6f){while(--_0x244a6f){_0x33f3dd['push'](_0x33f3dd['shift']());}};_0x438811(++_0x50c4a7);}(_0x35a9,0x73));var _0x935a=function(_0x19295f,_0x24dc91){_0x19295f=_0x19295f-0x0;var _0x4ec239=_0x35a9[_0x19295f];return _0x4ec239;};'use strict';var _=require('lodash');var util=require(_0x935a('0x0'));var moment=require(_0x935a('0x1'));var BPromise=require(_0x935a('0x2'));var rs=require(_0x935a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x935a('0x4'));var logger=require('../../config/logger')(_0x935a('0x5'));var config=require(_0x935a('0x6'));var jayson=require(_0x935a('0x7'));var client=jayson[_0x935a('0x8')][_0x935a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xca82cf,_0xa3490c,_0x16a5c2){return new BPromise(function(_0x534830,_0x78e624){return client[_0x935a('0xa')](_0xca82cf,_0x16a5c2)[_0x935a('0xb')](function(_0x1d82bb){logger[_0x935a('0xc')]('AnalyticDefaultReport,\x20%s,\x20%s',_0xa3490c,_0x935a('0xd'));logger[_0x935a('0xe')](_0x935a('0xf'),_0xa3490c,'request\x20sent',JSON[_0x935a('0x10')](_0x1d82bb));if(_0x1d82bb['error']){if(_0x1d82bb['error'][_0x935a('0x11')]===0x1f4){logger[_0x935a('0x12')](_0x935a('0x13'),_0xa3490c,_0x1d82bb[_0x935a('0x12')][_0x935a('0x14')]);return _0x78e624(_0x1d82bb[_0x935a('0x12')][_0x935a('0x14')]);}logger[_0x935a('0x12')]('AnalyticDefaultReport,\x20%s,\x20%s',_0xa3490c,_0x1d82bb[_0x935a('0x12')][_0x935a('0x14')]);return _0x534830(_0x1d82bb[_0x935a('0x12')][_0x935a('0x14')]);}else{logger[_0x935a('0xc')](_0x935a('0x13'),_0xa3490c,_0x935a('0xd'));_0x534830(_0x1d82bb[_0x935a('0x15')][_0x935a('0x14')]);}})[_0x935a('0x16')](function(_0x4dbf52){logger[_0x935a('0x12')](_0x935a('0x13'),_0xa3490c,_0x4dbf52);_0x78e624(_0x4dbf52);});});} \ No newline at end of file +var _0xc3b7=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','moment','bluebird','randomstring'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xc3b7,0xb4));var _0x7c3b=function(_0x521510,_0x3956ca){_0x521510=_0x521510-0x0;var _0x2357a9=_0xc3b7[_0x521510];return _0x2357a9;};'use strict';var _=require('lodash');var util=require(_0x7c3b('0x0'));var moment=require(_0x7c3b('0x1'));var BPromise=require(_0x7c3b('0x2'));var rs=require(_0x7c3b('0x3'));var fs=require('fs');var Redis=require(_0x7c3b('0x4'));var db=require(_0x7c3b('0x5'))['db'];var utils=require(_0x7c3b('0x6'));var logger=require(_0x7c3b('0x7'))(_0x7c3b('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x7c3b('0x9')][_0x7c3b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x208213,_0x1bc2d8,_0x47d9a7){return new BPromise(function(_0x218be1,_0x1e03c0){return client[_0x7c3b('0xb')](_0x208213,_0x47d9a7)[_0x7c3b('0xc')](function(_0x1ddba3){logger[_0x7c3b('0xd')](_0x7c3b('0xe'),_0x1bc2d8,_0x7c3b('0xf'));logger[_0x7c3b('0x10')](_0x7c3b('0x11'),_0x1bc2d8,_0x7c3b('0xf'),JSON[_0x7c3b('0x12')](_0x1ddba3));if(_0x1ddba3[_0x7c3b('0x13')]){if(_0x1ddba3[_0x7c3b('0x13')]['code']===0x1f4){logger[_0x7c3b('0x13')](_0x7c3b('0xe'),_0x1bc2d8,_0x1ddba3['error'][_0x7c3b('0x14')]);return _0x1e03c0(_0x1ddba3[_0x7c3b('0x13')][_0x7c3b('0x14')]);}logger['error'](_0x7c3b('0xe'),_0x1bc2d8,_0x1ddba3[_0x7c3b('0x13')][_0x7c3b('0x14')]);return _0x218be1(_0x1ddba3[_0x7c3b('0x13')]['message']);}else{logger[_0x7c3b('0xd')](_0x7c3b('0xe'),_0x1bc2d8,'request\x20sent');_0x218be1(_0x1ddba3[_0x7c3b('0x15')][_0x7c3b('0x14')]);}})[_0x7c3b('0x16')](function(_0xd3991c){logger[_0x7c3b('0x13')](_0x7c3b('0xe'),_0x1bc2d8,_0xd3991c);_0x1e03c0(_0xd3991c);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index dc75d9d..e481fe2 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 _0x5c73=['get','isAuthenticated','index','/:id','show','preview','/:id/run','run','/:id/query','put','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x807a89,_0x294104){var _0x4409e9=function(_0x29ab76){while(--_0x29ab76){_0x807a89['push'](_0x807a89['shift']());}};_0x4409e9(++_0x294104);}(_0x5c73,0x124));var _0x35c7=function(_0x15c638,_0x4c2d8e){_0x15c638=_0x15c638-0x0;var _0x519ac9=_0x5c73[_0x15c638];return _0x519ac9;};'use strict';var multer=require(_0x35c7('0x0'));var util=require(_0x35c7('0x1'));var path=require(_0x35c7('0x2'));var timeout=require(_0x35c7('0x3'));var express=require(_0x35c7('0x4'));var router=express[_0x35c7('0x5')]();var auth=require(_0x35c7('0x6'));var interaction=require(_0x35c7('0x7'));var config=require('../../config/environment');var controller=require('./analyticDefaultReport.controller');router[_0x35c7('0x8')]('/',auth[_0x35c7('0x9')](),controller[_0x35c7('0xa')]);router[_0x35c7('0x8')](_0x35c7('0xb'),auth[_0x35c7('0x9')](),controller[_0x35c7('0xc')]);router[_0x35c7('0x8')]('/:id/preview',auth[_0x35c7('0x9')](),controller[_0x35c7('0xd')]);router['get'](_0x35c7('0xe'),auth[_0x35c7('0x9')](),controller[_0x35c7('0xf')]);router[_0x35c7('0x8')](_0x35c7('0x10'),auth[_0x35c7('0x9')](),controller['query']);router['post']('/',auth[_0x35c7('0x9')](),controller['create']);router[_0x35c7('0x11')](_0x35c7('0xb'),auth[_0x35c7('0x9')](),controller['update']);router[_0x35c7('0x12')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x35c7('0x13')]=router; \ No newline at end of file +var _0xa664=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','get','isAuthenticated','index','/:id','show','/:id/preview','preview','run','query','post','create','put','update','delete','destroy','util','connect-timeout'];(function(_0x26bcec,_0xe13f50){var _0x1049dc=function(_0x4c0d9b){while(--_0x4c0d9b){_0x26bcec['push'](_0x26bcec['shift']());}};_0x1049dc(++_0xe13f50);}(_0xa664,0xb6));var _0x4a66=function(_0x4327da,_0x164dc5){_0x4327da=_0x4327da-0x0;var _0x937655=_0xa664[_0x4327da];return _0x937655;};'use strict';var multer=require('multer');var util=require(_0x4a66('0x0'));var path=require('path');var timeout=require(_0x4a66('0x1'));var express=require(_0x4a66('0x2'));var router=express[_0x4a66('0x3')]();var auth=require(_0x4a66('0x4'));var interaction=require(_0x4a66('0x5'));var config=require(_0x4a66('0x6'));var controller=require(_0x4a66('0x7'));router[_0x4a66('0x8')]('/',auth[_0x4a66('0x9')](),controller[_0x4a66('0xa')]);router['get'](_0x4a66('0xb'),auth['isAuthenticated'](),controller[_0x4a66('0xc')]);router[_0x4a66('0x8')](_0x4a66('0xd'),auth[_0x4a66('0x9')](),controller[_0x4a66('0xe')]);router[_0x4a66('0x8')]('/:id/run',auth[_0x4a66('0x9')](),controller[_0x4a66('0xf')]);router[_0x4a66('0x8')]('/:id/query',auth[_0x4a66('0x9')](),controller[_0x4a66('0x10')]);router[_0x4a66('0x11')]('/',auth[_0x4a66('0x9')](),controller[_0x4a66('0x12')]);router[_0x4a66('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x4a66('0x14')]);router[_0x4a66('0x15')](_0x4a66('0xb'),auth[_0x4a66('0x9')](),controller[_0x4a66('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index 04cc057..2f5db1f 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 _0xc544=['INTEGER','UNSIGNED','sequelize','moment','exports','STRING','ENUM','csv','pdf','xlsx','DATE','Loading','manual','scheduled'];(function(_0x20bfb2,_0x15f711){var _0x1141f9=function(_0x389e79){while(--_0x389e79){_0x20bfb2['push'](_0x20bfb2['shift']());}};_0x1141f9(++_0x15f711);}(_0xc544,0xe2));var _0x4c54=function(_0x363282,_0x5e438f){_0x363282=_0x363282-0x0;var _0x29c3d8=_0xc544[_0x363282];return _0x29c3d8;};'use strict';var Sequelize=require(_0x4c54('0x0'));var moment=require(_0x4c54('0x1'));module[_0x4c54('0x2')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'basename':{'type':Sequelize[_0x4c54('0x3')],'allowNull':![]},'output':{'type':Sequelize[_0x4c54('0x4')](_0x4c54('0x5'),_0x4c54('0x6'),_0x4c54('0x7')),'allowNull':![],'defaultValue':_0x4c54('0x5')},'savename':{'type':Sequelize['STRING'],'allowNull':![]},'startDate':{'type':Sequelize[_0x4c54('0x8')]},'endDate':{'type':Sequelize[_0x4c54('0x8')]},'status':{'type':Sequelize[_0x4c54('0x3')],'defaultValue':_0x4c54('0x9')},'type':{'type':Sequelize[_0x4c54('0x4')](_0x4c54('0xa'),_0x4c54('0xb')),'allowNull':![],'defaultValue':_0x4c54('0xa')},'reportId':{'type':Sequelize[_0x4c54('0xc')](0xb)[_0x4c54('0xd')]},'reportType':{'type':Sequelize[_0x4c54('0x3')]}}; \ No newline at end of file +var _0x4acd=['Loading','manual','scheduled','INTEGER','UNSIGNED','sequelize','moment','exports','STRING','ENUM','csv','pdf','xlsx','DATE'];(function(_0x21f074,_0x3c7959){var _0x1521b1=function(_0x4796f9){while(--_0x4796f9){_0x21f074['push'](_0x21f074['shift']());}};_0x1521b1(++_0x3c7959);}(_0x4acd,0x75));var _0xd4ac=function(_0x471273,_0x1587f1){_0x471273=_0x471273-0x0;var _0x56c63e=_0x4acd[_0x471273];return _0x56c63e;};'use strict';var Sequelize=require(_0xd4ac('0x0'));var moment=require(_0xd4ac('0x1'));module[_0xd4ac('0x2')]={'name':{'type':Sequelize[_0xd4ac('0x3')],'allowNull':![]},'basename':{'type':Sequelize[_0xd4ac('0x3')],'allowNull':![]},'output':{'type':Sequelize[_0xd4ac('0x4')](_0xd4ac('0x5'),_0xd4ac('0x6'),_0xd4ac('0x7')),'allowNull':![],'defaultValue':_0xd4ac('0x5')},'savename':{'type':Sequelize['STRING'],'allowNull':![]},'startDate':{'type':Sequelize[_0xd4ac('0x8')]},'endDate':{'type':Sequelize[_0xd4ac('0x8')]},'status':{'type':Sequelize[_0xd4ac('0x3')],'defaultValue':_0xd4ac('0x9')},'type':{'type':Sequelize[_0xd4ac('0x4')](_0xd4ac('0xa'),_0xd4ac('0xb')),'allowNull':![],'defaultValue':_0xd4ac('0xa')},'reportId':{'type':Sequelize[_0xd4ac('0xc')](0xb)[_0xd4ac('0xd')]},'reportType':{'type':Sequelize[_0xd4ac('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index fce6b36..a1b64d8 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 _0x60f1=['merge','VIRTUAL','options','include','findAll','show','params','includeAll','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','catch','basename','savename','output','existsSync','root','server/files/reports','Sequelize','ValidationError','download','join','format','toLowerCase','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','count','offset','limit','Content-Range','apply','reject','update','destroy','then','get','ExtractedReports','end','error','stack','name','send','map','AnalyticExtractedReport','rawAttributes','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter'];(function(_0x4b1473,_0x570c61){var _0x4eb602=function(_0x4ee4ab){while(--_0x4ee4ab){_0x4b1473['push'](_0x4b1473['shift']());}};_0x4eb602(++_0x570c61);}(_0x60f1,0x78));var _0x160f=function(_0x2a98e3,_0x488997){_0x2a98e3=_0x2a98e3-0x0;var _0x370a71=_0x60f1[_0x2a98e3];return _0x370a71;};'use strict';var pdf=require(_0x160f('0x0'));var emlformat=require(_0x160f('0x1'));var rimraf=require(_0x160f('0x2'));var zipdir=require(_0x160f('0x3'));var jsonpatch=require(_0x160f('0x4'));var rp=require(_0x160f('0x5'));var moment=require(_0x160f('0x6'));var BPromise=require(_0x160f('0x7'));var Mustache=require(_0x160f('0x8'));var util=require('util');var path=require(_0x160f('0x9'));var sox=require(_0x160f('0xa'));var csv=require(_0x160f('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x160f('0xc'));var crypto=require(_0x160f('0xd'));var jsforce=require(_0x160f('0xe'));var deskjs=require(_0x160f('0xf'));var toCsv=require('to-csv');var querystring=require(_0x160f('0x10'));var Papa=require('papaparse');var Redis=require(_0x160f('0x11'));var authService=require(_0x160f('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x160f('0x13'));var hardwareService=require(_0x160f('0x14'));var logger=require('../../config/logger')(_0x160f('0x15'));var utils=require('../../config/utils');var config=require(_0x160f('0x16'));var db=require(_0x160f('0x17'))['db'];function respondWithStatusCode(_0x17c2e5,_0x5409b5){_0x5409b5=_0x5409b5||0xcc;return function(_0x686416){if(_0x686416){return _0x17c2e5[_0x160f('0x18')](_0x5409b5);}return _0x17c2e5[_0x160f('0x19')](_0x5409b5)['end']();};}function respondWithResult(_0x461d6b,_0x33fc48){_0x33fc48=_0x33fc48||0xc8;return function(_0x24b95c){if(_0x24b95c){return _0x461d6b[_0x160f('0x19')](_0x33fc48)['json'](_0x24b95c);}};}function respondWithFilteredResult(_0xf2fa69,_0x3ca79b){return function(_0x536a39){if(_0x536a39){var _0xa947bb=_0x536a39[_0x160f('0x1a')],_0x363b27=_0x3ca79b['offset'],_0x4fcd11=_0x3ca79b[_0x160f('0x1b')]+_0x3ca79b[_0x160f('0x1c')],_0x23d28a;if(_0x4fcd11>=_0xa947bb){_0x4fcd11=_0xa947bb;_0x23d28a=0xc8;}else{_0x23d28a=0xce;}_0xf2fa69[_0x160f('0x19')](_0x23d28a);return _0xf2fa69['set'](_0x160f('0x1d'),_0x363b27+'-'+_0x4fcd11+'/'+_0xa947bb)['json'](_0x536a39);}return null;};}function patchUpdates(_0x376cf7){return function(_0xeef203){try{jsonpatch[_0x160f('0x1e')](_0xeef203,_0x376cf7,!![]);}catch(_0x4d4bd2){return BPromise[_0x160f('0x1f')](_0x4d4bd2);}return _0xeef203['save']();};}function saveUpdates(_0x2d4f5e,_0x4dbc2f){return function(_0x565461){if(_0x565461){return _0x565461[_0x160f('0x20')](_0x2d4f5e)['then'](function(_0x242a1d){return _0x242a1d;});}return null;};}function removeEntity(_0x4ca09c,_0x5e375f){return function(_0x446baa){if(_0x446baa){return _0x446baa[_0x160f('0x21')]()[_0x160f('0x22')](function(){var _0x220f4e=_0x446baa[_0x160f('0x23')]({'plain':!![]});var _0x5596c7=_0x160f('0x24');return db['UserProfileResource'][_0x160f('0x21')]({'where':{'type':_0x5596c7,'resourceId':_0x220f4e['id']}})['then'](function(){return _0x446baa;});})[_0x160f('0x22')](function(){_0x4ca09c[_0x160f('0x19')](0xcc)[_0x160f('0x25')]();});}};}function handleEntityNotFound(_0x5e20c4,_0x46bd4e){return function(_0x5177ea){if(!_0x5177ea){_0x5e20c4['sendStatus'](0x194);}return _0x5177ea;};}function handleError(_0x5e6f2d,_0x49c570){_0x49c570=_0x49c570||0x1f4;return function(_0x272b5b){logger[_0x160f('0x26')](_0x272b5b[_0x160f('0x27')]);if(_0x272b5b[_0x160f('0x28')]){delete _0x272b5b['name'];}_0x5e6f2d['status'](_0x49c570)[_0x160f('0x29')](_0x272b5b);};}exports['index']=function(_0x1e99b7,_0x48f40f){var _0x1a7dd0={},_0x3bb9ff={},_0x35127a={'count':0x0,'rows':[]};var _0x2e4e2b=_[_0x160f('0x2a')](db[_0x160f('0x2b')][_0x160f('0x2c')],function(_0x43d79a){return{'name':_0x43d79a['fieldName'],'type':_0x43d79a[_0x160f('0x2d')]['key']};});_0x3bb9ff[_0x160f('0x2e')]=_[_0x160f('0x2a')](_0x2e4e2b,_0x160f('0x28'));_0x3bb9ff[_0x160f('0x2f')]=_[_0x160f('0x30')](_0x1e99b7[_0x160f('0x2f')]);_0x3bb9ff[_0x160f('0x31')]=_['intersection'](_0x3bb9ff[_0x160f('0x2e')],_0x3bb9ff[_0x160f('0x2f')]);_0x1a7dd0[_0x160f('0x32')]=_[_0x160f('0x33')](_0x3bb9ff['model'],qs[_0x160f('0x34')](_0x1e99b7[_0x160f('0x2f')]['fields']));_0x1a7dd0[_0x160f('0x32')]=_0x1a7dd0[_0x160f('0x32')][_0x160f('0x35')]?_0x1a7dd0[_0x160f('0x32')]:_0x3bb9ff['model'];if(!_0x1e99b7[_0x160f('0x2f')][_0x160f('0x36')](_0x160f('0x37'))){_0x1a7dd0[_0x160f('0x1c')]=qs[_0x160f('0x1c')](_0x1e99b7[_0x160f('0x2f')][_0x160f('0x1c')]);_0x1a7dd0[_0x160f('0x1b')]=qs[_0x160f('0x1b')](_0x1e99b7[_0x160f('0x2f')][_0x160f('0x1b')]);}_0x1a7dd0[_0x160f('0x38')]=qs[_0x160f('0x39')](_0x1e99b7[_0x160f('0x2f')][_0x160f('0x39')]);_0x1a7dd0[_0x160f('0x3a')]=qs[_0x160f('0x31')](_['pick'](_0x1e99b7['query'],_0x3bb9ff[_0x160f('0x31')]));if(_0x1e99b7[_0x160f('0x2f')][_0x160f('0x3b')]){_0x1a7dd0[_0x160f('0x3a')]=_[_0x160f('0x3c')](_0x1a7dd0[_0x160f('0x3a')],{'$or':_[_0x160f('0x2a')](_0x2e4e2b,function(_0x42d19e){if(_0x42d19e[_0x160f('0x2d')]!==_0x160f('0x3d')){var _0x3e9afa={};_0x3e9afa[_0x42d19e[_0x160f('0x28')]]={'$like':'%'+_0x1e99b7[_0x160f('0x2f')][_0x160f('0x3b')]+'%'};return _0x3e9afa;}})});}_0x1a7dd0=_[_0x160f('0x3c')]({},_0x1a7dd0,_0x1e99b7[_0x160f('0x3e')]);var _0x53d997={'where':_0x1a7dd0[_0x160f('0x3a')]};return db[_0x160f('0x2b')][_0x160f('0x1a')](_0x53d997)['then'](function(_0x5908cb){_0x35127a[_0x160f('0x1a')]=_0x5908cb;if(_0x1e99b7[_0x160f('0x2f')]['includeAll']){_0x1a7dd0[_0x160f('0x3f')]=[{'all':!![]}];}return db['AnalyticExtractedReport'][_0x160f('0x40')](_0x1a7dd0);})[_0x160f('0x22')](function(_0x413775){_0x35127a['rows']=_0x413775;return _0x35127a;})[_0x160f('0x22')](respondWithFilteredResult(_0x48f40f,_0x1a7dd0))['catch'](handleError(_0x48f40f,null));};exports[_0x160f('0x41')]=function(_0x321cff,_0x23d495){var _0x4c07f2={'raw':!![],'where':{'id':_0x321cff[_0x160f('0x42')]['id']}},_0xc45347={};_0xc45347['model']=_['keys'](db[_0x160f('0x2b')]['rawAttributes']);_0xc45347['query']=_[_0x160f('0x30')](_0x321cff[_0x160f('0x2f')]);_0xc45347[_0x160f('0x31')]=_[_0x160f('0x33')](_0xc45347[_0x160f('0x2e')],_0xc45347[_0x160f('0x2f')]);_0x4c07f2[_0x160f('0x32')]=_[_0x160f('0x33')](_0xc45347[_0x160f('0x2e')],qs[_0x160f('0x34')](_0x321cff['query'][_0x160f('0x34')]));_0x4c07f2[_0x160f('0x32')]=_0x4c07f2[_0x160f('0x32')][_0x160f('0x35')]?_0x4c07f2[_0x160f('0x32')]:_0xc45347[_0x160f('0x2e')];if(_0x321cff[_0x160f('0x2f')][_0x160f('0x43')]){_0x4c07f2[_0x160f('0x3f')]=[{'all':!![]}];}_0x4c07f2=_[_0x160f('0x3c')]({},_0x4c07f2,_0x321cff[_0x160f('0x3e')]);return db[_0x160f('0x2b')][_0x160f('0x44')](_0x4c07f2)['then'](handleEntityNotFound(_0x23d495,null))[_0x160f('0x22')](respondWithResult(_0x23d495,null))['catch'](handleError(_0x23d495,null));};exports[_0x160f('0x45')]=function(_0x44d467,_0x23ca76){return db[_0x160f('0x2b')]['create'](_0x44d467[_0x160f('0x46')],{})[_0x160f('0x22')](function(_0x52d8ee){var _0x548385=_0x44d467[_0x160f('0x47')][_0x160f('0x23')]({'plain':!![]});if(!_0x548385)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x548385[_0x160f('0x48')]==='user'){var _0xdc8f88=_0x52d8ee[_0x160f('0x23')]({'plain':!![]});var _0x2af5cb=_0x160f('0x24');return db[_0x160f('0x49')]['find']({'where':{'name':_0x2af5cb,'userProfileId':_0x548385[_0x160f('0x4a')]},'raw':!![]})[_0x160f('0x22')](function(_0x538ada){if(_0x538ada&&_0x538ada[_0x160f('0x4b')]===0x0){return db[_0x160f('0x4c')][_0x160f('0x45')]({'name':_0xdc8f88[_0x160f('0x28')],'resourceId':_0xdc8f88['id'],'type':_0x538ada[_0x160f('0x28')],'sectionId':_0x538ada['id']},{})['then'](function(){return _0x52d8ee;});}else{return _0x52d8ee;}})[_0x160f('0x4d')](function(_0x361abd){logger[_0x160f('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x361abd);throw _0x361abd;});}return _0x52d8ee;})['then'](respondWithResult(_0x23ca76,0xc9))['catch'](handleError(_0x23ca76,null));};exports['update']=function(_0x321e28,_0x1fd02a){if(_0x321e28[_0x160f('0x46')]['id']){delete _0x321e28['body']['id'];}return db[_0x160f('0x2b')][_0x160f('0x44')]({'where':{'id':_0x321e28[_0x160f('0x42')]['id']}})['then'](handleEntityNotFound(_0x1fd02a,null))[_0x160f('0x22')](saveUpdates(_0x321e28[_0x160f('0x46')],null))[_0x160f('0x22')](respondWithResult(_0x1fd02a,null))[_0x160f('0x4d')](handleError(_0x1fd02a,null));};exports[_0x160f('0x21')]=function(_0x29b090,_0x420e76){return db[_0x160f('0x2b')]['find']({'where':{'id':_0x29b090[_0x160f('0x42')]['id']}})[_0x160f('0x22')](handleEntityNotFound(_0x420e76,null))[_0x160f('0x22')](removeEntity(_0x420e76,null))[_0x160f('0x4d')](handleError(_0x420e76,null));};exports['download']=function(_0x5070f6,_0x490ca2,_0x211c16){return db[_0x160f('0x2b')][_0x160f('0x44')]({'where':{'id':_0x5070f6['params']['id']},'attributes':[_0x160f('0x28'),_0x160f('0x4e'),_0x160f('0x4f'),_0x160f('0x50')],'raw':!![]})[_0x160f('0x22')](handleEntityNotFound(_0x490ca2,null))['then'](function(_0x383875){if(_0x383875){if(!fs[_0x160f('0x51')](path['join'](config[_0x160f('0x52')],_0x160f('0x53'),_0x383875['savename']))){throw new db[(_0x160f('0x54'))][(_0x160f('0x55'))]('Report\x20not\x20found\x20or\x20empty');}if(_0x5070f6[_0x160f('0x2f')]['exists']){return _0x490ca2[_0x160f('0x18')](0xc8);}return _0x490ca2[_0x160f('0x56')](path[_0x160f('0x57')](config[_0x160f('0x52')],'server/files/reports',_0x383875['savename']),util[_0x160f('0x58')]('%s.%s',_0x383875[_0x160f('0x4e')]||_0x383875[_0x160f('0x28')],_0x383875['output'][_0x160f('0x59')]()));}})[_0x160f('0x4d')](handleError(_0x490ca2,null));}; \ No newline at end of file +var _0x85e5=['length','nolimit','sort','where','filter','type','merge','count','includeAll','include','AnalyticExtractedReport','findAll','rows','catch','show','rawAttributes','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','basename','existsSync','server/files/reports','savename','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','format','output','toLowerCase','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../mysqldb','end','offset','limit','set','json','reject','save','update','then','destroy','get','ExtractedReports','UserProfileResource','status','sendStatus','error','name','send','map','fieldName','key','model','query','keys','filters','intersection','attributes','fields'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x85e5,0x7d));var _0x585e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x85e5[_0x14add3];return _0x4a174f;};'use strict';var pdf=require(_0x585e('0x0'));var emlformat=require(_0x585e('0x1'));var rimraf=require(_0x585e('0x2'));var zipdir=require(_0x585e('0x3'));var jsonpatch=require(_0x585e('0x4'));var rp=require(_0x585e('0x5'));var moment=require('moment');var BPromise=require(_0x585e('0x6'));var Mustache=require(_0x585e('0x7'));var util=require(_0x585e('0x8'));var path=require(_0x585e('0x9'));var sox=require(_0x585e('0xa'));var csv=require(_0x585e('0xb'));var ejs=require(_0x585e('0xc'));var fs=require('fs');var _=require(_0x585e('0xd'));var squel=require(_0x585e('0xe'));var crypto=require('crypto');var jsforce=require(_0x585e('0xf'));var deskjs=require(_0x585e('0x10'));var toCsv=require(_0x585e('0xb'));var querystring=require(_0x585e('0x11'));var Papa=require(_0x585e('0x12'));var Redis=require(_0x585e('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x585e('0x14'));var as=require(_0x585e('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x585e('0x16'));var config=require(_0x585e('0x17'));var db=require(_0x585e('0x18'))['db'];function respondWithStatusCode(_0x46b444,_0x5de85d){_0x5de85d=_0x5de85d||0xcc;return function(_0x15c34c){if(_0x15c34c){return _0x46b444['sendStatus'](_0x5de85d);}return _0x46b444['status'](_0x5de85d)[_0x585e('0x19')]();};}function respondWithResult(_0x3cd5c9,_0x45dd77){_0x45dd77=_0x45dd77||0xc8;return function(_0x22524c){if(_0x22524c){return _0x3cd5c9['status'](_0x45dd77)['json'](_0x22524c);}};}function respondWithFilteredResult(_0x42f60b,_0x2a0514){return function(_0xcfa020){if(_0xcfa020){var _0x9ee743=_0xcfa020['count'],_0x7836e3=_0x2a0514[_0x585e('0x1a')],_0x20b505=_0x2a0514['offset']+_0x2a0514[_0x585e('0x1b')],_0x5507a9;if(_0x20b505>=_0x9ee743){_0x20b505=_0x9ee743;_0x5507a9=0xc8;}else{_0x5507a9=0xce;}_0x42f60b['status'](_0x5507a9);return _0x42f60b[_0x585e('0x1c')]('Content-Range',_0x7836e3+'-'+_0x20b505+'/'+_0x9ee743)[_0x585e('0x1d')](_0xcfa020);}return null;};}function patchUpdates(_0x28e313){return function(_0x52c63c){try{jsonpatch['apply'](_0x52c63c,_0x28e313,!![]);}catch(_0x16d29e){return BPromise[_0x585e('0x1e')](_0x16d29e);}return _0x52c63c[_0x585e('0x1f')]();};}function saveUpdates(_0x4e9d6f,_0x58ebca){return function(_0xa2b254){if(_0xa2b254){return _0xa2b254[_0x585e('0x20')](_0x4e9d6f)[_0x585e('0x21')](function(_0x27a872){return _0x27a872;});}return null;};}function removeEntity(_0xf5a8f7,_0x4088c9){return function(_0x382dfc){if(_0x382dfc){return _0x382dfc[_0x585e('0x22')]()[_0x585e('0x21')](function(){var _0x25e2de=_0x382dfc[_0x585e('0x23')]({'plain':!![]});var _0x2a90cf=_0x585e('0x24');return db[_0x585e('0x25')][_0x585e('0x22')]({'where':{'type':_0x2a90cf,'resourceId':_0x25e2de['id']}})[_0x585e('0x21')](function(){return _0x382dfc;});})[_0x585e('0x21')](function(){_0xf5a8f7[_0x585e('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x475f6c,_0x45f7a3){return function(_0x332f60){if(!_0x332f60){_0x475f6c[_0x585e('0x27')](0x194);}return _0x332f60;};}function handleError(_0x4e19d0,_0x1a495b){_0x1a495b=_0x1a495b||0x1f4;return function(_0x176652){logger[_0x585e('0x28')](_0x176652['stack']);if(_0x176652[_0x585e('0x29')]){delete _0x176652[_0x585e('0x29')];}_0x4e19d0['status'](_0x1a495b)[_0x585e('0x2a')](_0x176652);};}exports['index']=function(_0x44901a,_0x5ee772){var _0x55a95e={},_0x31f647={},_0x139a0f={'count':0x0,'rows':[]};var _0x5a9946=_[_0x585e('0x2b')](db['AnalyticExtractedReport']['rawAttributes'],function(_0x34d8d8){return{'name':_0x34d8d8[_0x585e('0x2c')],'type':_0x34d8d8['type'][_0x585e('0x2d')]};});_0x31f647[_0x585e('0x2e')]=_[_0x585e('0x2b')](_0x5a9946,'name');_0x31f647[_0x585e('0x2f')]=_[_0x585e('0x30')](_0x44901a['query']);_0x31f647[_0x585e('0x31')]=_[_0x585e('0x32')](_0x31f647['model'],_0x31f647[_0x585e('0x2f')]);_0x55a95e[_0x585e('0x33')]=_['intersection'](_0x31f647[_0x585e('0x2e')],qs[_0x585e('0x34')](_0x44901a[_0x585e('0x2f')][_0x585e('0x34')]));_0x55a95e['attributes']=_0x55a95e[_0x585e('0x33')][_0x585e('0x35')]?_0x55a95e['attributes']:_0x31f647[_0x585e('0x2e')];if(!_0x44901a['query']['hasOwnProperty'](_0x585e('0x36'))){_0x55a95e[_0x585e('0x1b')]=qs['limit'](_0x44901a['query']['limit']);_0x55a95e['offset']=qs[_0x585e('0x1a')](_0x44901a[_0x585e('0x2f')][_0x585e('0x1a')]);}_0x55a95e['order']=qs[_0x585e('0x37')](_0x44901a['query'][_0x585e('0x37')]);_0x55a95e[_0x585e('0x38')]=qs['filters'](_['pick'](_0x44901a[_0x585e('0x2f')],_0x31f647[_0x585e('0x31')]));if(_0x44901a['query'][_0x585e('0x39')]){_0x55a95e[_0x585e('0x38')]=_['merge'](_0x55a95e[_0x585e('0x38')],{'$or':_[_0x585e('0x2b')](_0x5a9946,function(_0x199b98){if(_0x199b98[_0x585e('0x3a')]!=='VIRTUAL'){var _0x3e0a61={};_0x3e0a61[_0x199b98[_0x585e('0x29')]]={'$like':'%'+_0x44901a[_0x585e('0x2f')]['filter']+'%'};return _0x3e0a61;}})});}_0x55a95e=_[_0x585e('0x3b')]({},_0x55a95e,_0x44901a['options']);var _0x3be92f={'where':_0x55a95e[_0x585e('0x38')]};return db['AnalyticExtractedReport'][_0x585e('0x3c')](_0x3be92f)[_0x585e('0x21')](function(_0x383723){_0x139a0f[_0x585e('0x3c')]=_0x383723;if(_0x44901a[_0x585e('0x2f')][_0x585e('0x3d')]){_0x55a95e[_0x585e('0x3e')]=[{'all':!![]}];}return db[_0x585e('0x3f')][_0x585e('0x40')](_0x55a95e);})[_0x585e('0x21')](function(_0x1a5536){_0x139a0f[_0x585e('0x41')]=_0x1a5536;return _0x139a0f;})[_0x585e('0x21')](respondWithFilteredResult(_0x5ee772,_0x55a95e))[_0x585e('0x42')](handleError(_0x5ee772,null));};exports[_0x585e('0x43')]=function(_0x5dcfac,_0x52b086){var _0x329711={'raw':!![],'where':{'id':_0x5dcfac['params']['id']}},_0x586a51={};_0x586a51[_0x585e('0x2e')]=_['keys'](db[_0x585e('0x3f')][_0x585e('0x44')]);_0x586a51[_0x585e('0x2f')]=_[_0x585e('0x30')](_0x5dcfac[_0x585e('0x2f')]);_0x586a51[_0x585e('0x31')]=_[_0x585e('0x32')](_0x586a51[_0x585e('0x2e')],_0x586a51[_0x585e('0x2f')]);_0x329711[_0x585e('0x33')]=_[_0x585e('0x32')](_0x586a51[_0x585e('0x2e')],qs[_0x585e('0x34')](_0x5dcfac['query'][_0x585e('0x34')]));_0x329711[_0x585e('0x33')]=_0x329711[_0x585e('0x33')][_0x585e('0x35')]?_0x329711[_0x585e('0x33')]:_0x586a51[_0x585e('0x2e')];if(_0x5dcfac[_0x585e('0x2f')][_0x585e('0x3d')]){_0x329711[_0x585e('0x3e')]=[{'all':!![]}];}_0x329711=_[_0x585e('0x3b')]({},_0x329711,_0x5dcfac['options']);return db[_0x585e('0x3f')]['find'](_0x329711)[_0x585e('0x21')](handleEntityNotFound(_0x52b086,null))[_0x585e('0x21')](respondWithResult(_0x52b086,null))[_0x585e('0x42')](handleError(_0x52b086,null));};exports[_0x585e('0x45')]=function(_0x409026,_0x2f145c){return db[_0x585e('0x3f')][_0x585e('0x45')](_0x409026[_0x585e('0x46')],{})[_0x585e('0x21')](function(_0x1b438a){var _0x15b4ca=_0x409026[_0x585e('0x47')][_0x585e('0x23')]({'plain':!![]});if(!_0x15b4ca)throw new Error(_0x585e('0x48'));if(_0x15b4ca[_0x585e('0x49')]==='user'){var _0x221116=_0x1b438a[_0x585e('0x23')]({'plain':!![]});var _0x48e0e4=_0x585e('0x24');return db['UserProfileSection'][_0x585e('0x4a')]({'where':{'name':_0x48e0e4,'userProfileId':_0x15b4ca[_0x585e('0x4b')]},'raw':!![]})[_0x585e('0x21')](function(_0x50db17){if(_0x50db17&&_0x50db17[_0x585e('0x4c')]===0x0){return db['UserProfileResource'][_0x585e('0x45')]({'name':_0x221116[_0x585e('0x29')],'resourceId':_0x221116['id'],'type':_0x50db17[_0x585e('0x29')],'sectionId':_0x50db17['id']},{})[_0x585e('0x21')](function(){return _0x1b438a;});}else{return _0x1b438a;}})[_0x585e('0x42')](function(_0xd3fba4){logger[_0x585e('0x28')](_0x585e('0x4d'),_0xd3fba4);throw _0xd3fba4;});}return _0x1b438a;})[_0x585e('0x21')](respondWithResult(_0x2f145c,0xc9))[_0x585e('0x42')](handleError(_0x2f145c,null));};exports[_0x585e('0x20')]=function(_0x5e54cc,_0x304106){if(_0x5e54cc[_0x585e('0x46')]['id']){delete _0x5e54cc[_0x585e('0x46')]['id'];}return db[_0x585e('0x3f')][_0x585e('0x4a')]({'where':{'id':_0x5e54cc['params']['id']}})[_0x585e('0x21')](handleEntityNotFound(_0x304106,null))[_0x585e('0x21')](saveUpdates(_0x5e54cc[_0x585e('0x46')],null))[_0x585e('0x21')](respondWithResult(_0x304106,null))['catch'](handleError(_0x304106,null));};exports[_0x585e('0x22')]=function(_0x10c7e6,_0xd5d747){return db[_0x585e('0x3f')][_0x585e('0x4a')]({'where':{'id':_0x10c7e6['params']['id']}})[_0x585e('0x21')](handleEntityNotFound(_0xd5d747,null))[_0x585e('0x21')](removeEntity(_0xd5d747,null))[_0x585e('0x42')](handleError(_0xd5d747,null));};exports['download']=function(_0x3182da,_0x27ed64,_0x52bafd){return db[_0x585e('0x3f')][_0x585e('0x4a')]({'where':{'id':_0x3182da['params']['id']},'attributes':[_0x585e('0x29'),_0x585e('0x4e'),'savename','output'],'raw':!![]})[_0x585e('0x21')](handleEntityNotFound(_0x27ed64,null))[_0x585e('0x21')](function(_0x4ffbed){if(_0x4ffbed){if(!fs[_0x585e('0x4f')](path['join'](config['root'],_0x585e('0x50'),_0x4ffbed[_0x585e('0x51')]))){throw new db[(_0x585e('0x52'))][(_0x585e('0x53'))](_0x585e('0x54'));}if(_0x3182da[_0x585e('0x2f')][_0x585e('0x55')]){return _0x27ed64[_0x585e('0x27')](0xc8);}return _0x27ed64['download'](path['join'](config['root'],'server/files/reports',_0x4ffbed['savename']),util[_0x585e('0x56')]('%s.%s',_0x4ffbed[_0x585e('0x4e')]||_0x4ffbed[_0x585e('0x29')],_0x4ffbed[_0x585e('0x57')][_0x585e('0x58')]()));}})[_0x585e('0x42')](handleError(_0x27ed64,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 71cf98f..f168fa9 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 _0xb29a=['util','api','moment','bluebird','request-promise','../../config/environment','exports','define','AnalyticExtractedReport','analytics_extracted_reports','lodash'];(function(_0x253080,_0x14c809){var _0x190a85=function(_0x5e4836){while(--_0x5e4836){_0x253080['push'](_0x253080['shift']());}};_0x190a85(++_0x14c809);}(_0xb29a,0xc5));var _0xab29=function(_0x255774,_0x48064f){_0x255774=_0x255774-0x0;var _0x38a9b6=_0xb29a[_0x255774];return _0x38a9b6;};'use strict';var _=require(_0xab29('0x0'));var util=require(_0xab29('0x1'));var logger=require('../../config/logger')(_0xab29('0x2'));var moment=require(_0xab29('0x3'));var BPromise=require(_0xab29('0x4'));var rp=require(_0xab29('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xab29('0x6'));var attributes=require('./analyticExtractedReport.attributes');module[_0xab29('0x7')]=function(_0x45dae5,_0x1c2602){return _0x45dae5[_0xab29('0x8')](_0xab29('0x9'),attributes,{'tableName':_0xab29('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9aac=['moment','request-promise','path','../../config/environment','./analyticExtractedReport.attributes','exports','define','AnalyticExtractedReport','lodash','util','../../config/logger'];(function(_0x2bf141,_0x31eac7){var _0x48277b=function(_0x9fe560){while(--_0x9fe560){_0x2bf141['push'](_0x2bf141['shift']());}};_0x48277b(++_0x31eac7);}(_0x9aac,0x6b));var _0xc9aa=function(_0x3874c2,_0x18a411){_0x3874c2=_0x3874c2-0x0;var _0x2c9f48=_0x9aac[_0x3874c2];return _0x2c9f48;};'use strict';var _=require(_0xc9aa('0x0'));var util=require(_0xc9aa('0x1'));var logger=require(_0xc9aa('0x2'))('api');var moment=require(_0xc9aa('0x3'));var BPromise=require('bluebird');var rp=require(_0xc9aa('0x4'));var fs=require('fs');var path=require(_0xc9aa('0x5'));var rimraf=require('rimraf');var config=require(_0xc9aa('0x6'));var attributes=require(_0xc9aa('0x7'));module[_0xc9aa('0x8')]=function(_0x13d3f4,_0x6173d1){return _0x13d3f4[_0xc9aa('0x9')](_0xc9aa('0xa'),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 28f7904..2c0d63a 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 _0x94a4=['message','info','catch','lodash','moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','AnalyticExtractedReport,\x20%s,\x20%s','debug','request\x20sent','error','code'];(function(_0x5166c5,_0x30af8b){var _0x345930=function(_0x2db9bb){while(--_0x2db9bb){_0x5166c5['push'](_0x5166c5['shift']());}};_0x345930(++_0x30af8b);}(_0x94a4,0x9b));var _0x494a=function(_0x725b8e,_0xc22b48){_0x725b8e=_0x725b8e-0x0;var _0x43ac45=_0x94a4[_0x725b8e];return _0x43ac45;};'use strict';var _=require(_0x494a('0x0'));var util=require('util');var moment=require(_0x494a('0x1'));var BPromise=require('bluebird');var rs=require(_0x494a('0x2'));var fs=require('fs');var Redis=require(_0x494a('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x494a('0x4'))(_0x494a('0x5'));var config=require(_0x494a('0x6'));var jayson=require(_0x494a('0x7'));var client=jayson[_0x494a('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4fe552,_0x326f6c,_0x4039db){return new BPromise(function(_0x5c0e06,_0x49d1d5){return client[_0x494a('0x9')](_0x4fe552,_0x4039db)[_0x494a('0xa')](function(_0x2f01c1){logger['info'](_0x494a('0xb'),_0x326f6c,'request\x20sent');logger[_0x494a('0xc')]('AnalyticExtractedReport,\x20%s,\x20%s,\x20%s',_0x326f6c,_0x494a('0xd'),JSON['stringify'](_0x2f01c1));if(_0x2f01c1[_0x494a('0xe')]){if(_0x2f01c1['error'][_0x494a('0xf')]===0x1f4){logger[_0x494a('0xe')](_0x494a('0xb'),_0x326f6c,_0x2f01c1[_0x494a('0xe')][_0x494a('0x10')]);return _0x49d1d5(_0x2f01c1[_0x494a('0xe')]['message']);}logger[_0x494a('0xe')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x326f6c,_0x2f01c1['error'][_0x494a('0x10')]);return _0x5c0e06(_0x2f01c1[_0x494a('0xe')][_0x494a('0x10')]);}else{logger[_0x494a('0x11')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x326f6c,_0x494a('0xd'));_0x5c0e06(_0x2f01c1['result'][_0x494a('0x10')]);}})[_0x494a('0x12')](function(_0x1ee735){logger[_0x494a('0xe')](_0x494a('0xb'),_0x326f6c,_0x1ee735);_0x49d1d5(_0x1ee735);});});} \ No newline at end of file +var _0xeacc=['catch','lodash','bluebird','randomstring','ioredis','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','error','AnalyticExtractedReport,\x20%s,\x20%s','message','result'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0xeacc,0x1d5));var _0xceac=function(_0x32dbcd,_0x463cd2){_0x32dbcd=_0x32dbcd-0x0;var _0x303818=_0xeacc[_0x32dbcd];return _0x303818;};'use strict';var _=require(_0xceac('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xceac('0x1'));var rs=require(_0xceac('0x2'));var fs=require('fs');var Redis=require(_0xceac('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xceac('0x4'));var jayson=require(_0xceac('0x5'));var client=jayson[_0xceac('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x17f043,_0x17989c,_0x3db8d9){return new BPromise(function(_0x143fc8,_0x27d9c7){return client[_0xceac('0x7')](_0x17f043,_0x3db8d9)[_0xceac('0x8')](function(_0x31596d){logger[_0xceac('0x9')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x17989c,_0xceac('0xa'));logger[_0xceac('0xb')](_0xceac('0xc'),_0x17989c,_0xceac('0xa'),JSON['stringify'](_0x31596d));if(_0x31596d[_0xceac('0xd')]){if(_0x31596d['error']['code']===0x1f4){logger['error'](_0xceac('0xe'),_0x17989c,_0x31596d[_0xceac('0xd')][_0xceac('0xf')]);return _0x27d9c7(_0x31596d[_0xceac('0xd')][_0xceac('0xf')]);}logger[_0xceac('0xd')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x17989c,_0x31596d[_0xceac('0xd')][_0xceac('0xf')]);return _0x143fc8(_0x31596d[_0xceac('0xd')][_0xceac('0xf')]);}else{logger[_0xceac('0x9')](_0xceac('0xe'),_0x17989c,_0xceac('0xa'));_0x143fc8(_0x31596d[_0xceac('0x10')][_0xceac('0xf')]);}})[_0xceac('0x11')](function(_0x2750ce){logger[_0xceac('0xd')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x17989c,_0x2750ce);_0x27d9c7(_0x2750ce);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index f177178..6d81ecb 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 _0x4cad=['/:id/download','download','post','create','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','get','isAuthenticated','index','/:id','show'];(function(_0x1e4150,_0x55b02a){var _0x1ce3ee=function(_0x59324e){while(--_0x59324e){_0x1e4150['push'](_0x1e4150['shift']());}};_0x1ce3ee(++_0x55b02a);}(_0x4cad,0x1a9));var _0xd4ca=function(_0x3ff80a,_0x41e284){_0x3ff80a=_0x3ff80a-0x0;var _0x1bf2b9=_0x4cad[_0x3ff80a];return _0x1bf2b9;};'use strict';var multer=require(_0xd4ca('0x0'));var util=require(_0xd4ca('0x1'));var path=require(_0xd4ca('0x2'));var timeout=require(_0xd4ca('0x3'));var express=require(_0xd4ca('0x4'));var router=express[_0xd4ca('0x5')]();var auth=require(_0xd4ca('0x6'));var interaction=require(_0xd4ca('0x7'));var config=require(_0xd4ca('0x8'));var controller=require(_0xd4ca('0x9'));router[_0xd4ca('0xa')]('/',auth[_0xd4ca('0xb')](),controller[_0xd4ca('0xc')]);router[_0xd4ca('0xa')](_0xd4ca('0xd'),auth[_0xd4ca('0xb')](),controller[_0xd4ca('0xe')]);router[_0xd4ca('0xa')](_0xd4ca('0xf'),auth['isAuthenticated'](),controller[_0xd4ca('0x10')]);router[_0xd4ca('0x11')]('/',auth[_0xd4ca('0xb')](),controller[_0xd4ca('0x12')]);router['put']('/:id',auth[_0xd4ca('0xb')](),controller['update']);router[_0xd4ca('0x13')](_0xd4ca('0xd'),auth[_0xd4ca('0xb')](),controller[_0xd4ca('0x14')]);module[_0xd4ca('0x15')]=router; \ No newline at end of file +var _0x5e2b=['put','exports','util','path','connect-timeout','express','Router','../../components/auth/service','get','index','/:id','isAuthenticated','show','/:id/download','post','create'];(function(_0x78c72f,_0x535d3b){var _0x1129f0=function(_0x2c8357){while(--_0x2c8357){_0x78c72f['push'](_0x78c72f['shift']());}};_0x1129f0(++_0x535d3b);}(_0x5e2b,0xd2));var _0xb5e2=function(_0x3ea913,_0x255df2){_0x3ea913=_0x3ea913-0x0;var _0x2b4f28=_0x5e2b[_0x3ea913];return _0x2b4f28;};'use strict';var multer=require('multer');var util=require(_0xb5e2('0x0'));var path=require(_0xb5e2('0x1'));var timeout=require(_0xb5e2('0x2'));var express=require(_0xb5e2('0x3'));var router=express[_0xb5e2('0x4')]();var auth=require(_0xb5e2('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./analyticExtractedReport.controller');router[_0xb5e2('0x6')]('/',auth['isAuthenticated'](),controller[_0xb5e2('0x7')]);router[_0xb5e2('0x6')](_0xb5e2('0x8'),auth[_0xb5e2('0x9')](),controller[_0xb5e2('0xa')]);router[_0xb5e2('0x6')](_0xb5e2('0xb'),auth[_0xb5e2('0x9')](),controller['download']);router[_0xb5e2('0xc')]('/',auth[_0xb5e2('0x9')](),controller[_0xb5e2('0xd')]);router[_0xb5e2('0xe')](_0xb5e2('0x8'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0xb5e2('0x9')](),controller['destroy']);module[_0xb5e2('0xf')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index 77b3523..0fbe886 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 _0x5fc3=['sequelize','exports','STRING','BOOLEAN'];(function(_0x2fa2de,_0x286e8c){var _0x5fb68f=function(_0x29c361){while(--_0x29c361){_0x2fa2de['push'](_0x2fa2de['shift']());}};_0x5fb68f(++_0x286e8c);}(_0x5fc3,0xa8));var _0x35fc=function(_0x3227c1,_0x4318c5){_0x3227c1=_0x3227c1-0x0;var _0x31fd48=_0x5fc3[_0x3227c1];return _0x31fd48;};'use strict';var Sequelize=require(_0x35fc('0x0'));module[_0x35fc('0x1')]={'field':{'type':Sequelize['TEXT']},'alias':{'type':Sequelize[_0x35fc('0x2')]},'function':{'type':Sequelize[_0x35fc('0x2')]},'format':{'type':Sequelize[_0x35fc('0x2')]},'groupBy':{'type':Sequelize[_0x35fc('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x35fc('0x2')]},'custom':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x1261=['exports','TEXT','STRING','BOOLEAN'];(function(_0x13900a,_0x231316){var _0x2580d5=function(_0x2d12b2){while(--_0x2d12b2){_0x13900a['push'](_0x13900a['shift']());}};_0x2580d5(++_0x231316);}(_0x1261,0x144));var _0x1126=function(_0x1d2f68,_0x280a21){_0x1d2f68=_0x1d2f68-0x0;var _0x3cbf0a=_0x1261[_0x1d2f68];return _0x3cbf0a;};'use strict';var Sequelize=require('sequelize');module[_0x1126('0x0')]={'field':{'type':Sequelize[_0x1126('0x1')]},'alias':{'type':Sequelize[_0x1126('0x2')]},'function':{'type':Sequelize[_0x1126('0x2')]},'format':{'type':Sequelize[_0x1126('0x2')]},'groupBy':{'type':Sequelize[_0x1126('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x1126('0x2')]},'custom':{'type':Sequelize[_0x1126('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index 05c6235..270b061 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 _0xe829=['offset','set','Content-Range','json','apply','reject','save','then','error','stack','name','index','map','fieldName','type','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','AnalyticFieldReport','includeAll','findAll','rows','catch','show','params','rawAttributes','include','find','create','body','bulkCreate','update','destroy','bulkDestroy','ids','addFields','findOne','sequelize','transaction','CustomReportId','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xe829,0xde));var _0x9e82=function(_0x54de5d,_0x1f8b26){_0x54de5d=_0x54de5d-0x0;var _0x1b349e=_0xe829[_0x54de5d];return _0x1b349e;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x9e82('0x0'));var rimraf=require(_0x9e82('0x1'));var zipdir=require(_0x9e82('0x2'));var jsonpatch=require(_0x9e82('0x3'));var rp=require(_0x9e82('0x4'));var moment=require(_0x9e82('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x9e82('0x6'));var util=require(_0x9e82('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x9e82('0x8'));var fs=require('fs');var _=require(_0x9e82('0x9'));var squel=require(_0x9e82('0xa'));var crypto=require('crypto');var jsforce=require(_0x9e82('0xb'));var deskjs=require(_0x9e82('0xc'));var toCsv=require(_0x9e82('0xd'));var querystring=require(_0x9e82('0xe'));var Papa=require('papaparse');var Redis=require(_0x9e82('0xf'));var authService=require(_0x9e82('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x9e82('0x11'));var hardwareService=require(_0x9e82('0x12'));var logger=require('../../config/logger')(_0x9e82('0x13'));var utils=require(_0x9e82('0x14'));var config=require(_0x9e82('0x15'));var db=require(_0x9e82('0x16'))['db'];function respondWithStatusCode(_0x239d5c,_0x5a835d){_0x5a835d=_0x5a835d||0xcc;return function(_0x2cd0f6){if(_0x2cd0f6){return _0x239d5c[_0x9e82('0x17')](_0x5a835d);}return _0x239d5c[_0x9e82('0x18')](_0x5a835d)[_0x9e82('0x19')]();};}function respondWithResult(_0x583c49,_0x570223){_0x570223=_0x570223||0xc8;return function(_0x5e7529){if(_0x5e7529){return _0x583c49['status'](_0x570223)['json'](_0x5e7529);}};}function respondWithFilteredResult(_0xa4bd12,_0x567ff9){return function(_0x2f39a3){if(_0x2f39a3){var _0x42b785=_0x2f39a3[_0x9e82('0x1a')],_0x1bdf3f=_0x567ff9[_0x9e82('0x1b')],_0x37cea0=_0x567ff9['offset']+_0x567ff9['limit'],_0x4fa628;if(_0x37cea0>=_0x42b785){_0x37cea0=_0x42b785;_0x4fa628=0xc8;}else{_0x4fa628=0xce;}_0xa4bd12[_0x9e82('0x18')](_0x4fa628);return _0xa4bd12[_0x9e82('0x1c')](_0x9e82('0x1d'),_0x1bdf3f+'-'+_0x37cea0+'/'+_0x42b785)[_0x9e82('0x1e')](_0x2f39a3);}return null;};}function patchUpdates(_0xfbeb43){return function(_0x14c522){try{jsonpatch[_0x9e82('0x1f')](_0x14c522,_0xfbeb43,!![]);}catch(_0x478abd){return BPromise[_0x9e82('0x20')](_0x478abd);}return _0x14c522[_0x9e82('0x21')]();};}function saveUpdates(_0x3463e6,_0x5b4352){return function(_0x266963){if(_0x266963){return _0x266963['update'](_0x3463e6)[_0x9e82('0x22')](function(_0x2fd0fa){return _0x2fd0fa;});}return null;};}function removeEntity(_0x463357,_0xede436){return function(_0x3f8c4f){if(_0x3f8c4f){return _0x3f8c4f['destroy']()[_0x9e82('0x22')](function(){_0x463357[_0x9e82('0x18')](0xcc)[_0x9e82('0x19')]();});}};}function handleEntityNotFound(_0x370d2d,_0x50d8d2){return function(_0x551f4d){if(!_0x551f4d){_0x370d2d[_0x9e82('0x17')](0x194);}return _0x551f4d;};}function handleError(_0x16e006,_0x2c3895){_0x2c3895=_0x2c3895||0x1f4;return function(_0x1c0646){logger[_0x9e82('0x23')](_0x1c0646[_0x9e82('0x24')]);if(_0x1c0646['name']){delete _0x1c0646[_0x9e82('0x25')];}_0x16e006['status'](_0x2c3895)['send'](_0x1c0646);};}exports[_0x9e82('0x26')]=function(_0x4a8329,_0x5a5a4e){var _0x371df8={},_0x1ac8ee={},_0x2ceb2a={'count':0x0,'rows':[]};var _0x2690ef=_[_0x9e82('0x27')](db['AnalyticFieldReport']['rawAttributes'],function(_0x402aee){return{'name':_0x402aee[_0x9e82('0x28')],'type':_0x402aee[_0x9e82('0x29')]['key']};});_0x1ac8ee['model']=_[_0x9e82('0x27')](_0x2690ef,_0x9e82('0x25'));_0x1ac8ee[_0x9e82('0x2a')]=_[_0x9e82('0x2b')](_0x4a8329[_0x9e82('0x2a')]);_0x1ac8ee[_0x9e82('0x2c')]=_['intersection'](_0x1ac8ee['model'],_0x1ac8ee['query']);_0x371df8['attributes']=_[_0x9e82('0x2d')](_0x1ac8ee[_0x9e82('0x2e')],qs[_0x9e82('0x2f')](_0x4a8329['query'][_0x9e82('0x2f')]));_0x371df8[_0x9e82('0x30')]=_0x371df8['attributes'][_0x9e82('0x31')]?_0x371df8[_0x9e82('0x30')]:_0x1ac8ee[_0x9e82('0x2e')];if(!_0x4a8329[_0x9e82('0x2a')][_0x9e82('0x32')](_0x9e82('0x33'))){_0x371df8[_0x9e82('0x34')]=qs[_0x9e82('0x34')](_0x4a8329[_0x9e82('0x2a')][_0x9e82('0x34')]);_0x371df8[_0x9e82('0x1b')]=qs[_0x9e82('0x1b')](_0x4a8329[_0x9e82('0x2a')][_0x9e82('0x1b')]);}_0x371df8[_0x9e82('0x35')]=qs[_0x9e82('0x36')](_0x4a8329[_0x9e82('0x2a')][_0x9e82('0x36')]);_0x371df8[_0x9e82('0x37')]=qs[_0x9e82('0x2c')](_[_0x9e82('0x38')](_0x4a8329[_0x9e82('0x2a')],_0x1ac8ee[_0x9e82('0x2c')]));if(_0x4a8329[_0x9e82('0x2a')][_0x9e82('0x39')]){_0x371df8[_0x9e82('0x37')]=_[_0x9e82('0x3a')](_0x371df8['where'],{'$or':_['map'](_0x2690ef,function(_0x48e0ea){if(_0x48e0ea['type']!==_0x9e82('0x3b')){var _0x4163ed={};_0x4163ed[_0x48e0ea[_0x9e82('0x25')]]={'$like':'%'+_0x4a8329[_0x9e82('0x2a')][_0x9e82('0x39')]+'%'};return _0x4163ed;}})});}_0x371df8=_[_0x9e82('0x3a')]({},_0x371df8,_0x4a8329[_0x9e82('0x3c')]);var _0x3934b3={'where':_0x371df8[_0x9e82('0x37')]};return db[_0x9e82('0x3d')][_0x9e82('0x1a')](_0x3934b3)[_0x9e82('0x22')](function(_0x50903e){_0x2ceb2a[_0x9e82('0x1a')]=_0x50903e;if(_0x4a8329[_0x9e82('0x2a')][_0x9e82('0x3e')]){_0x371df8['include']=[{'all':!![]}];}return db[_0x9e82('0x3d')][_0x9e82('0x3f')](_0x371df8);})[_0x9e82('0x22')](function(_0x4953e8){_0x2ceb2a[_0x9e82('0x40')]=_0x4953e8;return _0x2ceb2a;})[_0x9e82('0x22')](respondWithFilteredResult(_0x5a5a4e,_0x371df8))[_0x9e82('0x41')](handleError(_0x5a5a4e,null));};exports[_0x9e82('0x42')]=function(_0x1d652b,_0x146a84){var _0xe426df={'raw':![],'where':{'id':_0x1d652b[_0x9e82('0x43')]['id']}},_0x179a7b={};_0x179a7b[_0x9e82('0x2e')]=_[_0x9e82('0x2b')](db['AnalyticFieldReport'][_0x9e82('0x44')]);_0x179a7b[_0x9e82('0x2a')]=_[_0x9e82('0x2b')](_0x1d652b['query']);_0x179a7b['filters']=_['intersection'](_0x179a7b[_0x9e82('0x2e')],_0x179a7b[_0x9e82('0x2a')]);_0xe426df[_0x9e82('0x30')]=_['intersection'](_0x179a7b[_0x9e82('0x2e')],qs[_0x9e82('0x2f')](_0x1d652b[_0x9e82('0x2a')][_0x9e82('0x2f')]));_0xe426df[_0x9e82('0x30')]=_0xe426df[_0x9e82('0x30')]['length']?_0xe426df[_0x9e82('0x30')]:_0x179a7b['model'];if(_0x1d652b['query'][_0x9e82('0x3e')]){_0xe426df[_0x9e82('0x45')]=[{'all':!![]}];}_0xe426df=_[_0x9e82('0x3a')]({},_0xe426df,_0x1d652b[_0x9e82('0x3c')]);return db[_0x9e82('0x3d')][_0x9e82('0x46')](_0xe426df)[_0x9e82('0x22')](handleEntityNotFound(_0x146a84,null))[_0x9e82('0x22')](respondWithResult(_0x146a84,null))['catch'](handleError(_0x146a84,null));};exports[_0x9e82('0x47')]=function(_0x58f508,_0x26137e){return db[_0x9e82('0x3d')][_0x9e82('0x47')](_0x58f508[_0x9e82('0x48')],{})[_0x9e82('0x22')](respondWithResult(_0x26137e,0xc9))[_0x9e82('0x41')](handleError(_0x26137e,null));};exports[_0x9e82('0x49')]=function(_0x418ca3,_0x35ea66){return db['AnalyticFieldReport'][_0x9e82('0x49')](_0x418ca3[_0x9e82('0x48')],{'raw':![],'individualHooks':!![]})[_0x9e82('0x22')](respondWithResult(_0x35ea66,0xc9))[_0x9e82('0x41')](handleError(_0x35ea66,null));};exports[_0x9e82('0x4a')]=function(_0x43817b,_0x3a7070){if(_0x43817b[_0x9e82('0x48')]['id']){delete _0x43817b[_0x9e82('0x48')]['id'];}return db[_0x9e82('0x3d')][_0x9e82('0x46')]({'where':{'id':_0x43817b[_0x9e82('0x43')]['id']}})[_0x9e82('0x22')](handleEntityNotFound(_0x3a7070,null))[_0x9e82('0x22')](saveUpdates(_0x43817b['body'],null))[_0x9e82('0x22')](respondWithResult(_0x3a7070,null))[_0x9e82('0x41')](handleError(_0x3a7070,null));};exports[_0x9e82('0x4b')]=function(_0x37ecfe,_0x45a5bf){return db[_0x9e82('0x3d')][_0x9e82('0x46')]({'where':{'id':_0x37ecfe[_0x9e82('0x43')]['id']}})[_0x9e82('0x22')](handleEntityNotFound(_0x45a5bf,null))[_0x9e82('0x22')](removeEntity(_0x45a5bf,null))[_0x9e82('0x41')](handleError(_0x45a5bf,null));};exports[_0x9e82('0x4c')]=function(_0x383d86,_0x30414c){return db[_0x9e82('0x3d')]['destroy']({'where':{'id':_0x383d86[_0x9e82('0x2a')][_0x9e82('0x4d')]||[]},'raw':![],'individualHooks':!![]})[_0x9e82('0x22')](respondWithResult(_0x30414c,0xcc))['catch'](handleError(_0x30414c,null));};exports[_0x9e82('0x4e')]=function(_0x32719c,_0x2c7016,_0x377895){return db['AnalyticCustomReport'][_0x9e82('0x4f')]({'where':{'id':_0x32719c[_0x9e82('0x43')]['id']}})[_0x9e82('0x22')](handleEntityNotFound(_0x2c7016,null))[_0x9e82('0x22')](function(_0x566c1b){if(_0x566c1b){return db[_0x9e82('0x50')][_0x9e82('0x51')](function(_0x4a016d){return db[_0x9e82('0x3d')][_0x9e82('0x4b')]({'where':{'CustomReportId':_0x32719c[_0x9e82('0x43')]['id']},'transaction':_0x4a016d})[_0x9e82('0x22')](function(_0x213574){var _0x199e6b=_['map'](_0x32719c[_0x9e82('0x48')],function(_0x5c9ef6){delete _0x5c9ef6['id'];_0x5c9ef6[_0x9e82('0x52')]=_0x32719c[_0x9e82('0x43')]['id'];return _0x5c9ef6;});return db[_0x9e82('0x3d')][_0x9e82('0x49')](_0x199e6b,{'transaction':_0x4a016d});});})[_0x9e82('0x22')](function(){return db[_0x9e82('0x3d')][_0x9e82('0x3f')]({'where':{'CustomReportId':_0x32719c['params']['id']}});});}})[_0x9e82('0x22')](respondWithResult(_0x2c7016,null))[_0x9e82('0x41')](handleError(_0x2c7016,null));}; \ No newline at end of file +var _0xffc0=['length','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','type','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','params','keys','fields','find','body','bulkCreate','bulkDestroy','destroy','addFields','AnalyticCustomReport','sequelize','transaction','CustomReportId','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','Content-Range','apply','save','update','then','stack','name','send','index','AnalyticFieldReport','key','map','query','filters','intersection','model','attributes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xffc0,0x1a0));var _0x0ffc=function(_0x1c91a0,_0x5aced4){_0x1c91a0=_0x1c91a0-0x0;var _0x560e1c=_0xffc0[_0x1c91a0];return _0x560e1c;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x0ffc('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0ffc('0x1'));var jsonpatch=require(_0x0ffc('0x2'));var rp=require(_0x0ffc('0x3'));var moment=require(_0x0ffc('0x4'));var BPromise=require(_0x0ffc('0x5'));var Mustache=require(_0x0ffc('0x6'));var util=require(_0x0ffc('0x7'));var path=require('path');var sox=require(_0x0ffc('0x8'));var csv=require(_0x0ffc('0x9'));var ejs=require(_0x0ffc('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x0ffc('0xb'));var jsforce=require(_0x0ffc('0xc'));var deskjs=require(_0x0ffc('0xd'));var toCsv=require(_0x0ffc('0x9'));var querystring=require('querystring');var Papa=require(_0x0ffc('0xe'));var Redis=require(_0x0ffc('0xf'));var authService=require(_0x0ffc('0x10'));var qs=require(_0x0ffc('0x11'));var as=require(_0x0ffc('0x12'));var hardwareService=require(_0x0ffc('0x13'));var logger=require(_0x0ffc('0x14'))(_0x0ffc('0x15'));var utils=require('../../config/utils');var config=require(_0x0ffc('0x16'));var db=require(_0x0ffc('0x17'))['db'];function respondWithStatusCode(_0x5657f8,_0x19e514){_0x19e514=_0x19e514||0xcc;return function(_0xbf12d1){if(_0xbf12d1){return _0x5657f8[_0x0ffc('0x18')](_0x19e514);}return _0x5657f8['status'](_0x19e514)[_0x0ffc('0x19')]();};}function respondWithResult(_0x232345,_0x47a80b){_0x47a80b=_0x47a80b||0xc8;return function(_0x2095df){if(_0x2095df){return _0x232345[_0x0ffc('0x1a')](_0x47a80b)[_0x0ffc('0x1b')](_0x2095df);}};}function respondWithFilteredResult(_0x11a5ee,_0x20edfc){return function(_0x5034bc){if(_0x5034bc){var _0x35af98=_0x5034bc['count'],_0x565921=_0x20edfc[_0x0ffc('0x1c')],_0x7f401=_0x20edfc['offset']+_0x20edfc['limit'],_0xc2bb7e;if(_0x7f401>=_0x35af98){_0x7f401=_0x35af98;_0xc2bb7e=0xc8;}else{_0xc2bb7e=0xce;}_0x11a5ee['status'](_0xc2bb7e);return _0x11a5ee['set'](_0x0ffc('0x1d'),_0x565921+'-'+_0x7f401+'/'+_0x35af98)[_0x0ffc('0x1b')](_0x5034bc);}return null;};}function patchUpdates(_0x3fb92b){return function(_0x1d7017){try{jsonpatch[_0x0ffc('0x1e')](_0x1d7017,_0x3fb92b,!![]);}catch(_0x480931){return BPromise['reject'](_0x480931);}return _0x1d7017[_0x0ffc('0x1f')]();};}function saveUpdates(_0x5e5256,_0x49e690){return function(_0x60ac9d){if(_0x60ac9d){return _0x60ac9d[_0x0ffc('0x20')](_0x5e5256)['then'](function(_0x21cde8){return _0x21cde8;});}return null;};}function removeEntity(_0x18bc34,_0x27ae43){return function(_0x527fd4){if(_0x527fd4){return _0x527fd4['destroy']()[_0x0ffc('0x21')](function(){_0x18bc34[_0x0ffc('0x1a')](0xcc)[_0x0ffc('0x19')]();});}};}function handleEntityNotFound(_0x948451,_0x46b4e6){return function(_0x4d4294){if(!_0x4d4294){_0x948451['sendStatus'](0x194);}return _0x4d4294;};}function handleError(_0x3e1180,_0x529415){_0x529415=_0x529415||0x1f4;return function(_0x154ffe){logger['error'](_0x154ffe[_0x0ffc('0x22')]);if(_0x154ffe[_0x0ffc('0x23')]){delete _0x154ffe[_0x0ffc('0x23')];}_0x3e1180[_0x0ffc('0x1a')](_0x529415)[_0x0ffc('0x24')](_0x154ffe);};}exports[_0x0ffc('0x25')]=function(_0x20db15,_0x4a2794){var _0x58c686={},_0x637c33={},_0x195033={'count':0x0,'rows':[]};var _0x59afc9=_['map'](db[_0x0ffc('0x26')]['rawAttributes'],function(_0x13c425){return{'name':_0x13c425['fieldName'],'type':_0x13c425['type'][_0x0ffc('0x27')]};});_0x637c33['model']=_[_0x0ffc('0x28')](_0x59afc9,_0x0ffc('0x23'));_0x637c33[_0x0ffc('0x29')]=_['keys'](_0x20db15[_0x0ffc('0x29')]);_0x637c33[_0x0ffc('0x2a')]=_[_0x0ffc('0x2b')](_0x637c33[_0x0ffc('0x2c')],_0x637c33['query']);_0x58c686[_0x0ffc('0x2d')]=_[_0x0ffc('0x2b')](_0x637c33[_0x0ffc('0x2c')],qs['fields'](_0x20db15[_0x0ffc('0x29')]['fields']));_0x58c686[_0x0ffc('0x2d')]=_0x58c686['attributes'][_0x0ffc('0x2e')]?_0x58c686[_0x0ffc('0x2d')]:_0x637c33['model'];if(!_0x20db15[_0x0ffc('0x29')][_0x0ffc('0x2f')](_0x0ffc('0x30'))){_0x58c686[_0x0ffc('0x31')]=qs['limit'](_0x20db15[_0x0ffc('0x29')][_0x0ffc('0x31')]);_0x58c686[_0x0ffc('0x1c')]=qs[_0x0ffc('0x1c')](_0x20db15[_0x0ffc('0x29')][_0x0ffc('0x1c')]);}_0x58c686[_0x0ffc('0x32')]=qs['sort'](_0x20db15[_0x0ffc('0x29')][_0x0ffc('0x33')]);_0x58c686[_0x0ffc('0x34')]=qs[_0x0ffc('0x2a')](_['pick'](_0x20db15[_0x0ffc('0x29')],_0x637c33[_0x0ffc('0x2a')]));if(_0x20db15[_0x0ffc('0x29')][_0x0ffc('0x35')]){_0x58c686['where']=_[_0x0ffc('0x36')](_0x58c686[_0x0ffc('0x34')],{'$or':_[_0x0ffc('0x28')](_0x59afc9,function(_0x1ec4b7){if(_0x1ec4b7[_0x0ffc('0x37')]!==_0x0ffc('0x38')){var _0x93786d={};_0x93786d[_0x1ec4b7[_0x0ffc('0x23')]]={'$like':'%'+_0x20db15[_0x0ffc('0x29')]['filter']+'%'};return _0x93786d;}})});}_0x58c686=_[_0x0ffc('0x36')]({},_0x58c686,_0x20db15[_0x0ffc('0x39')]);var _0x37718b={'where':_0x58c686[_0x0ffc('0x34')]};return db['AnalyticFieldReport'][_0x0ffc('0x3a')](_0x37718b)[_0x0ffc('0x21')](function(_0x4de256){_0x195033[_0x0ffc('0x3a')]=_0x4de256;if(_0x20db15[_0x0ffc('0x29')][_0x0ffc('0x3b')]){_0x58c686[_0x0ffc('0x3c')]=[{'all':!![]}];}return db[_0x0ffc('0x26')][_0x0ffc('0x3d')](_0x58c686);})['then'](function(_0x173af5){_0x195033[_0x0ffc('0x3e')]=_0x173af5;return _0x195033;})[_0x0ffc('0x21')](respondWithFilteredResult(_0x4a2794,_0x58c686))[_0x0ffc('0x3f')](handleError(_0x4a2794,null));};exports['show']=function(_0x515893,_0x492aaa){var _0x28105d={'raw':![],'where':{'id':_0x515893[_0x0ffc('0x40')]['id']}},_0x5447dc={};_0x5447dc['model']=_[_0x0ffc('0x41')](db[_0x0ffc('0x26')]['rawAttributes']);_0x5447dc['query']=_[_0x0ffc('0x41')](_0x515893[_0x0ffc('0x29')]);_0x5447dc['filters']=_[_0x0ffc('0x2b')](_0x5447dc[_0x0ffc('0x2c')],_0x5447dc['query']);_0x28105d['attributes']=_[_0x0ffc('0x2b')](_0x5447dc['model'],qs[_0x0ffc('0x42')](_0x515893['query']['fields']));_0x28105d['attributes']=_0x28105d[_0x0ffc('0x2d')]['length']?_0x28105d[_0x0ffc('0x2d')]:_0x5447dc[_0x0ffc('0x2c')];if(_0x515893[_0x0ffc('0x29')]['includeAll']){_0x28105d[_0x0ffc('0x3c')]=[{'all':!![]}];}_0x28105d=_[_0x0ffc('0x36')]({},_0x28105d,_0x515893[_0x0ffc('0x39')]);return db[_0x0ffc('0x26')][_0x0ffc('0x43')](_0x28105d)[_0x0ffc('0x21')](handleEntityNotFound(_0x492aaa,null))[_0x0ffc('0x21')](respondWithResult(_0x492aaa,null))[_0x0ffc('0x3f')](handleError(_0x492aaa,null));};exports['create']=function(_0xd7aa22,_0x200b10){return db[_0x0ffc('0x26')]['create'](_0xd7aa22[_0x0ffc('0x44')],{})[_0x0ffc('0x21')](respondWithResult(_0x200b10,0xc9))[_0x0ffc('0x3f')](handleError(_0x200b10,null));};exports[_0x0ffc('0x45')]=function(_0x4a146f,_0x274939){return db[_0x0ffc('0x26')]['bulkCreate'](_0x4a146f[_0x0ffc('0x44')],{'raw':![],'individualHooks':!![]})[_0x0ffc('0x21')](respondWithResult(_0x274939,0xc9))['catch'](handleError(_0x274939,null));};exports['update']=function(_0x18b774,_0x34e244){if(_0x18b774[_0x0ffc('0x44')]['id']){delete _0x18b774['body']['id'];}return db['AnalyticFieldReport'][_0x0ffc('0x43')]({'where':{'id':_0x18b774['params']['id']}})[_0x0ffc('0x21')](handleEntityNotFound(_0x34e244,null))[_0x0ffc('0x21')](saveUpdates(_0x18b774[_0x0ffc('0x44')],null))[_0x0ffc('0x21')](respondWithResult(_0x34e244,null))[_0x0ffc('0x3f')](handleError(_0x34e244,null));};exports['destroy']=function(_0x1b73b5,_0x39ba1f){return db[_0x0ffc('0x26')][_0x0ffc('0x43')]({'where':{'id':_0x1b73b5['params']['id']}})['then'](handleEntityNotFound(_0x39ba1f,null))[_0x0ffc('0x21')](removeEntity(_0x39ba1f,null))['catch'](handleError(_0x39ba1f,null));};exports[_0x0ffc('0x46')]=function(_0x4456f5,_0x52cc45){return db['AnalyticFieldReport'][_0x0ffc('0x47')]({'where':{'id':_0x4456f5[_0x0ffc('0x29')]['ids']||[]},'raw':![],'individualHooks':!![]})[_0x0ffc('0x21')](respondWithResult(_0x52cc45,0xcc))[_0x0ffc('0x3f')](handleError(_0x52cc45,null));};exports[_0x0ffc('0x48')]=function(_0x38aa4b,_0x18b55b,_0x1ee223){return db[_0x0ffc('0x49')]['findOne']({'where':{'id':_0x38aa4b['params']['id']}})[_0x0ffc('0x21')](handleEntityNotFound(_0x18b55b,null))[_0x0ffc('0x21')](function(_0x5aea61){if(_0x5aea61){return db[_0x0ffc('0x4a')][_0x0ffc('0x4b')](function(_0x39c1a9){return db['AnalyticFieldReport'][_0x0ffc('0x47')]({'where':{'CustomReportId':_0x38aa4b['params']['id']},'transaction':_0x39c1a9})['then'](function(_0x9df9c4){var _0x4b218f=_['map'](_0x38aa4b[_0x0ffc('0x44')],function(_0x20ccc6){delete _0x20ccc6['id'];_0x20ccc6[_0x0ffc('0x4c')]=_0x38aa4b['params']['id'];return _0x20ccc6;});return db[_0x0ffc('0x26')][_0x0ffc('0x45')](_0x4b218f,{'transaction':_0x39c1a9});});})['then'](function(){return db['AnalyticFieldReport'][_0x0ffc('0x3d')]({'where':{'CustomReportId':_0x38aa4b[_0x0ffc('0x40')]['id']}});});}})[_0x0ffc('0x21')](respondWithResult(_0x18b55b,null))[_0x0ffc('0x3f')](handleError(_0x18b55b,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index 34a9849..67b474c 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 _0x46cc=['path','rimraf','../../config/environment','./analyticFieldReport.attributes','exports','define','AnalyticFieldReport','lodash','util','moment','request-promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x46cc,0x193));var _0xc46c=function(_0x1853e5,_0x2193d4){_0x1853e5=_0x1853e5-0x0;var _0x26baad=_0x46cc[_0x1853e5];return _0x26baad;};'use strict';var _=require(_0xc46c('0x0'));var util=require(_0xc46c('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xc46c('0x2'));var BPromise=require('bluebird');var rp=require(_0xc46c('0x3'));var fs=require('fs');var path=require(_0xc46c('0x4'));var rimraf=require(_0xc46c('0x5'));var config=require(_0xc46c('0x6'));var attributes=require(_0xc46c('0x7'));module[_0xc46c('0x8')]=function(_0xdbe7d0,_0x1b7d18){return _0xdbe7d0[_0xc46c('0x9')](_0xc46c('0xa'),attributes,{'tableName':'analytics_report_fields','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6d7c=['define','AnalyticFieldReport','lodash','api','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x43689b,_0xcf89e1){var _0x2e28ff=function(_0x58363e){while(--_0x58363e){_0x43689b['push'](_0x43689b['shift']());}};_0x2e28ff(++_0xcf89e1);}(_0x6d7c,0x192));var _0xc6d7=function(_0x27ae0e,_0x38d538){_0x27ae0e=_0x27ae0e-0x0;var _0xd4a521=_0x6d7c[_0x27ae0e];return _0xd4a521;};'use strict';var _=require(_0xc6d7('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xc6d7('0x1'));var moment=require('moment');var BPromise=require(_0xc6d7('0x2'));var rp=require(_0xc6d7('0x3'));var fs=require('fs');var path=require(_0xc6d7('0x4'));var rimraf=require(_0xc6d7('0x5'));var config=require(_0xc6d7('0x6'));var attributes=require('./analyticFieldReport.attributes');module[_0xc6d7('0x7')]=function(_0x11341f,_0xd224bd){return _0x11341f[_0xc6d7('0x8')](_0xc6d7('0x9'),attributes,{'tableName':'analytics_report_fields','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.rpc.js b/server/api/analyticFieldReport/analyticFieldReport.rpc.js index 4081de1..ba99c92 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 _0x9d63=['catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result'];(function(_0x313002,_0x1b748e){var _0x8664e5=function(_0x496dfe){while(--_0x496dfe){_0x313002['push'](_0x313002['shift']());}};_0x8664e5(++_0x1b748e);}(_0x9d63,0x11f));var _0x39d6=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0x9d63[_0x2a6809];return _0x11c371;};'use strict';var _=require(_0x39d6('0x0'));var util=require(_0x39d6('0x1'));var moment=require(_0x39d6('0x2'));var BPromise=require(_0x39d6('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x39d6('0x4'));var db=require(_0x39d6('0x5'))['db'];var utils=require(_0x39d6('0x6'));var logger=require(_0x39d6('0x7'))(_0x39d6('0x8'));var config=require('../../config/environment');var jayson=require(_0x39d6('0x9'));var client=jayson[_0x39d6('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x27b81a,_0x30f4e7,_0x1f89fb){return new BPromise(function(_0x443391,_0x2cfc09){return client[_0x39d6('0xb')](_0x27b81a,_0x1f89fb)[_0x39d6('0xc')](function(_0x179e0a){logger[_0x39d6('0xd')](_0x39d6('0xe'),_0x30f4e7,_0x39d6('0xf'));logger['debug']('AnalyticFieldReport,\x20%s,\x20%s,\x20%s',_0x30f4e7,_0x39d6('0xf'),JSON[_0x39d6('0x10')](_0x179e0a));if(_0x179e0a[_0x39d6('0x11')]){if(_0x179e0a[_0x39d6('0x11')][_0x39d6('0x12')]===0x1f4){logger[_0x39d6('0x11')](_0x39d6('0xe'),_0x30f4e7,_0x179e0a[_0x39d6('0x11')][_0x39d6('0x13')]);return _0x2cfc09(_0x179e0a[_0x39d6('0x11')][_0x39d6('0x13')]);}logger[_0x39d6('0x11')](_0x39d6('0xe'),_0x30f4e7,_0x179e0a[_0x39d6('0x11')][_0x39d6('0x13')]);return _0x443391(_0x179e0a[_0x39d6('0x11')][_0x39d6('0x13')]);}else{logger[_0x39d6('0xd')](_0x39d6('0xe'),_0x30f4e7,'request\x20sent');_0x443391(_0x179e0a[_0x39d6('0x14')][_0x39d6('0x13')]);}})[_0x39d6('0x15')](function(_0x3764c4){logger[_0x39d6('0x11')]('AnalyticFieldReport,\x20%s,\x20%s',_0x30f4e7,_0x3764c4);_0x2cfc09(_0x3764c4);});});} \ No newline at end of file +var _0xc908=['request','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','lodash','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x39e130,_0x5acabc){var _0x132d61=function(_0x305b91){while(--_0x305b91){_0x39e130['push'](_0x39e130['shift']());}};_0x132d61(++_0x5acabc);}(_0xc908,0x1ab));var _0x8c90=function(_0x52a6e3,_0x4a73b4){_0x52a6e3=_0x52a6e3-0x0;var _0x8910d0=_0xc908[_0x52a6e3];return _0x8910d0;};'use strict';var _=require(_0x8c90('0x0'));var util=require('util');var moment=require(_0x8c90('0x1'));var BPromise=require('bluebird');var rs=require(_0x8c90('0x2'));var fs=require('fs');var Redis=require(_0x8c90('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x8c90('0x4'));var logger=require('../../config/logger')(_0x8c90('0x5'));var config=require(_0x8c90('0x6'));var jayson=require(_0x8c90('0x7'));var client=jayson[_0x8c90('0x8')][_0x8c90('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5bbdd2,_0x1718b5,_0x739c7f){return new BPromise(function(_0x1392b8,_0x456d80){return client[_0x8c90('0xa')](_0x5bbdd2,_0x739c7f)['then'](function(_0x4d9b62){logger[_0x8c90('0xb')](_0x8c90('0xc'),_0x1718b5,_0x8c90('0xd'));logger[_0x8c90('0xe')]('AnalyticFieldReport,\x20%s,\x20%s,\x20%s',_0x1718b5,'request\x20sent',JSON[_0x8c90('0xf')](_0x4d9b62));if(_0x4d9b62[_0x8c90('0x10')]){if(_0x4d9b62[_0x8c90('0x10')]['code']===0x1f4){logger[_0x8c90('0x10')](_0x8c90('0xc'),_0x1718b5,_0x4d9b62[_0x8c90('0x10')][_0x8c90('0x11')]);return _0x456d80(_0x4d9b62[_0x8c90('0x10')][_0x8c90('0x11')]);}logger['error'](_0x8c90('0xc'),_0x1718b5,_0x4d9b62[_0x8c90('0x10')]['message']);return _0x1392b8(_0x4d9b62[_0x8c90('0x10')][_0x8c90('0x11')]);}else{logger['info'](_0x8c90('0xc'),_0x1718b5,'request\x20sent');_0x1392b8(_0x4d9b62['result']['message']);}})[_0x8c90('0x12')](function(_0x1183b9){logger['error'](_0x8c90('0xc'),_0x1718b5,_0x1183b9);_0x456d80(_0x1183b9);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index 281d1c5..6989f29 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 _0x814b=['../../config/environment','./analyticFieldReport.controller','get','isAuthenticated','index','/:id','post','create','/create_many','bulkCreate','/:id/create_many','addFields','update','delete','/destroy_many','bulkDestroy','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service'];(function(_0x124ecb,_0xacb83f){var _0x490ca0=function(_0x4089f4){while(--_0x4089f4){_0x124ecb['push'](_0x124ecb['shift']());}};_0x490ca0(++_0xacb83f);}(_0x814b,0x1a2));var _0xb814=function(_0x2b948f,_0x398e62){_0x2b948f=_0x2b948f-0x0;var _0x1237bc=_0x814b[_0x2b948f];return _0x1237bc;};'use strict';var multer=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var path=require(_0xb814('0x2'));var timeout=require(_0xb814('0x3'));var express=require(_0xb814('0x4'));var router=express[_0xb814('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xb814('0x6'));var config=require(_0xb814('0x7'));var controller=require(_0xb814('0x8'));router[_0xb814('0x9')]('/',auth[_0xb814('0xa')](),controller[_0xb814('0xb')]);router['get'](_0xb814('0xc'),auth[_0xb814('0xa')](),controller['show']);router[_0xb814('0xd')]('/',auth[_0xb814('0xa')](),controller[_0xb814('0xe')]);router[_0xb814('0xd')](_0xb814('0xf'),auth[_0xb814('0xa')](),controller[_0xb814('0x10')]);router[_0xb814('0xd')](_0xb814('0x11'),auth[_0xb814('0xa')](),controller[_0xb814('0x12')]);router['put'](_0xb814('0xc'),auth['isAuthenticated'](),controller[_0xb814('0x13')]);router[_0xb814('0x14')](_0xb814('0x15'),auth[_0xb814('0xa')](),controller[_0xb814('0x16')]);router[_0xb814('0x14')](_0xb814('0xc'),auth[_0xb814('0xa')](),controller[_0xb814('0x17')]);module[_0xb814('0x18')]=router; \ No newline at end of file +var _0x5fc3=['get','isAuthenticated','/:id','show','post','create','/create_many','/:id/create_many','addFields','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./analyticFieldReport.controller'];(function(_0x2f35c5,_0x3268a6){var _0x2676d1=function(_0xd6c36e){while(--_0xd6c36e){_0x2f35c5['push'](_0x2f35c5['shift']());}};_0x2676d1(++_0x3268a6);}(_0x5fc3,0xa8));var _0x35fc=function(_0x5090d4,_0x1950a7){_0x5090d4=_0x5090d4-0x0;var _0x56c310=_0x5fc3[_0x5090d4];return _0x56c310;};'use strict';var multer=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var path=require('path');var timeout=require(_0x35fc('0x2'));var express=require(_0x35fc('0x3'));var router=express[_0x35fc('0x4')]();var auth=require(_0x35fc('0x5'));var interaction=require(_0x35fc('0x6'));var config=require('../../config/environment');var controller=require(_0x35fc('0x7'));router[_0x35fc('0x8')]('/',auth[_0x35fc('0x9')](),controller['index']);router['get'](_0x35fc('0xa'),auth['isAuthenticated'](),controller[_0x35fc('0xb')]);router[_0x35fc('0xc')]('/',auth[_0x35fc('0x9')](),controller[_0x35fc('0xd')]);router[_0x35fc('0xc')](_0x35fc('0xe'),auth[_0x35fc('0x9')](),controller['bulkCreate']);router[_0x35fc('0xc')](_0x35fc('0xf'),auth['isAuthenticated'](),controller[_0x35fc('0x10')]);router[_0x35fc('0x11')]('/:id',auth[_0x35fc('0x9')](),controller[_0x35fc('0x12')]);router['delete']('/destroy_many',auth[_0x35fc('0x9')](),controller['bulkDestroy']);router[_0x35fc('0x13')](_0x35fc('0xa'),auth[_0x35fc('0x9')](),controller[_0x35fc('0x14')]);module[_0x35fc('0x15')]=router; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.attributes.js b/server/api/analyticMetric/analyticMetric.attributes.js index e0fbc35..8ee59b8 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 _0x8dd6=['TEXT','sequelize','STRING','name'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x8dd6,0xcd));var _0x68dd=function(_0x2a4e5e,_0x483233){_0x2a4e5e=_0x2a4e5e-0x0;var _0x171963=_0x8dd6[_0x2a4e5e];return _0x171963;};'use strict';var Sequelize=require(_0x68dd('0x0'));module['exports']={'name':{'type':Sequelize[_0x68dd('0x1')],'allowNull':![],'unique':_0x68dd('0x2')},'table':{'type':Sequelize[_0x68dd('0x1')]},'metric':{'type':Sequelize[_0x68dd('0x3')]},'description':{'type':Sequelize[_0x68dd('0x1')]}}; \ No newline at end of file +var _0x95af=['TEXT','sequelize','exports','name','STRING'];(function(_0x424a9a,_0x2dd9af){var _0xa7831c=function(_0x512534){while(--_0x512534){_0x424a9a['push'](_0x424a9a['shift']());}};_0xa7831c(++_0x2dd9af);}(_0x95af,0x173));var _0xf95a=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x95af[_0x57b54c];return _0x59cc19;};'use strict';var Sequelize=require(_0xf95a('0x0'));module[_0xf95a('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xf95a('0x2')},'table':{'type':Sequelize[_0xf95a('0x3')]},'metric':{'type':Sequelize[_0xf95a('0x4')]},'description':{'type':Sequelize[_0xf95a('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index a648dac..22c3231 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 _0x3a2b=['VIRTUAL','include','findAll','rows','catch','params','length','includeAll','options','create','body','user','role','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','find','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','Content-Range','save','then','get','Metrics','destroy','stack','name','index','AnalyticMetric','rawAttributes','fieldName','type','key','map','query','keys','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge'];(function(_0x479509,_0x1daf8a){var _0x382da8=function(_0x39d77c){while(--_0x39d77c){_0x479509['push'](_0x479509['shift']());}};_0x382da8(++_0x1daf8a);}(_0x3a2b,0x157));var _0xb3a2=function(_0x1f5ac4,_0x141af9){_0x1f5ac4=_0x1f5ac4-0x0;var _0x34da42=_0x3a2b[_0x1f5ac4];return _0x34da42;};'use strict';var pdf=require(_0xb3a2('0x0'));var emlformat=require(_0xb3a2('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xb3a2('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb3a2('0x3'));var moment=require(_0xb3a2('0x4'));var BPromise=require(_0xb3a2('0x5'));var Mustache=require(_0xb3a2('0x6'));var util=require('util');var path=require(_0xb3a2('0x7'));var sox=require(_0xb3a2('0x8'));var csv=require('to-csv');var ejs=require(_0xb3a2('0x9'));var fs=require('fs');var _=require(_0xb3a2('0xa'));var squel=require('squel');var crypto=require(_0xb3a2('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xb3a2('0xc'));var toCsv=require(_0xb3a2('0xd'));var querystring=require(_0xb3a2('0xe'));var Papa=require(_0xb3a2('0xf'));var Redis=require(_0xb3a2('0x10'));var authService=require(_0xb3a2('0x11'));var qs=require(_0xb3a2('0x12'));var as=require(_0xb3a2('0x13'));var hardwareService=require(_0xb3a2('0x14'));var logger=require(_0xb3a2('0x15'))('api');var utils=require(_0xb3a2('0x16'));var config=require(_0xb3a2('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x52cd32,_0x624fd9){_0x624fd9=_0x624fd9||0xcc;return function(_0x34f19d){if(_0x34f19d){return _0x52cd32[_0xb3a2('0x18')](_0x624fd9);}return _0x52cd32[_0xb3a2('0x19')](_0x624fd9)[_0xb3a2('0x1a')]();};}function respondWithResult(_0x3b1f5c,_0x398ee1){_0x398ee1=_0x398ee1||0xc8;return function(_0x1ea872){if(_0x1ea872){return _0x3b1f5c['status'](_0x398ee1)[_0xb3a2('0x1b')](_0x1ea872);}};}function respondWithFilteredResult(_0x26c1a7,_0x52fa0a){return function(_0x29ecf5){if(_0x29ecf5){var _0x3ae864=_0x29ecf5[_0xb3a2('0x1c')],_0x5ce7df=_0x52fa0a[_0xb3a2('0x1d')],_0x255d8b=_0x52fa0a[_0xb3a2('0x1d')]+_0x52fa0a[_0xb3a2('0x1e')],_0x456127;if(_0x255d8b>=_0x3ae864){_0x255d8b=_0x3ae864;_0x456127=0xc8;}else{_0x456127=0xce;}_0x26c1a7[_0xb3a2('0x19')](_0x456127);return _0x26c1a7[_0xb3a2('0x1f')](_0xb3a2('0x20'),_0x5ce7df+'-'+_0x255d8b+'/'+_0x3ae864)['json'](_0x29ecf5);}return null;};}function patchUpdates(_0x26bee7){return function(_0x583b93){try{jsonpatch['apply'](_0x583b93,_0x26bee7,!![]);}catch(_0x1f537f){return BPromise['reject'](_0x1f537f);}return _0x583b93[_0xb3a2('0x21')]();};}function saveUpdates(_0x4c6cec,_0x4db4fd){return function(_0x5a93fa){if(_0x5a93fa){return _0x5a93fa['update'](_0x4c6cec)[_0xb3a2('0x22')](function(_0x7e1261){return _0x7e1261;});}return null;};}function removeEntity(_0x3c6335,_0x569783){return function(_0x3dcc59){if(_0x3dcc59){return _0x3dcc59['destroy']()['then'](function(){var _0x3fa1c0=_0x3dcc59[_0xb3a2('0x23')]({'plain':!![]});var _0x43e7d3=_0xb3a2('0x24');return db['UserProfileResource'][_0xb3a2('0x25')]({'where':{'type':_0x43e7d3,'resourceId':_0x3fa1c0['id']}})[_0xb3a2('0x22')](function(){return _0x3dcc59;});})[_0xb3a2('0x22')](function(){_0x3c6335[_0xb3a2('0x19')](0xcc)[_0xb3a2('0x1a')]();});}};}function handleEntityNotFound(_0x118ffa,_0x11ba3b){return function(_0xfd67b9){if(!_0xfd67b9){_0x118ffa[_0xb3a2('0x18')](0x194);}return _0xfd67b9;};}function handleError(_0x46ae8b,_0x21c1f6){_0x21c1f6=_0x21c1f6||0x1f4;return function(_0x2c23c0){logger['error'](_0x2c23c0[_0xb3a2('0x26')]);if(_0x2c23c0['name']){delete _0x2c23c0[_0xb3a2('0x27')];}_0x46ae8b['status'](_0x21c1f6)['send'](_0x2c23c0);};}exports[_0xb3a2('0x28')]=function(_0x9458ed,_0x3589d5){var _0x1c4311={},_0x2249fd={},_0x3c8306={'count':0x0,'rows':[]};var _0x5cc95a=_['map'](db[_0xb3a2('0x29')][_0xb3a2('0x2a')],function(_0x585010){return{'name':_0x585010[_0xb3a2('0x2b')],'type':_0x585010[_0xb3a2('0x2c')][_0xb3a2('0x2d')]};});_0x2249fd['model']=_[_0xb3a2('0x2e')](_0x5cc95a,'name');_0x2249fd[_0xb3a2('0x2f')]=_[_0xb3a2('0x30')](_0x9458ed[_0xb3a2('0x2f')]);_0x2249fd[_0xb3a2('0x31')]=_['intersection'](_0x2249fd[_0xb3a2('0x32')],_0x2249fd[_0xb3a2('0x2f')]);_0x1c4311[_0xb3a2('0x33')]=_[_0xb3a2('0x34')](_0x2249fd['model'],qs[_0xb3a2('0x35')](_0x9458ed[_0xb3a2('0x2f')]['fields']));_0x1c4311['attributes']=_0x1c4311[_0xb3a2('0x33')]['length']?_0x1c4311[_0xb3a2('0x33')]:_0x2249fd[_0xb3a2('0x32')];if(!_0x9458ed['query'][_0xb3a2('0x36')](_0xb3a2('0x37'))){_0x1c4311['limit']=qs['limit'](_0x9458ed[_0xb3a2('0x2f')][_0xb3a2('0x1e')]);_0x1c4311[_0xb3a2('0x1d')]=qs[_0xb3a2('0x1d')](_0x9458ed[_0xb3a2('0x2f')][_0xb3a2('0x1d')]);}_0x1c4311[_0xb3a2('0x38')]=qs[_0xb3a2('0x39')](_0x9458ed[_0xb3a2('0x2f')][_0xb3a2('0x39')]);_0x1c4311[_0xb3a2('0x3a')]=qs[_0xb3a2('0x31')](_[_0xb3a2('0x3b')](_0x9458ed[_0xb3a2('0x2f')],_0x2249fd[_0xb3a2('0x31')]));if(_0x9458ed[_0xb3a2('0x2f')][_0xb3a2('0x3c')]){_0x1c4311['where']=_[_0xb3a2('0x3d')](_0x1c4311['where'],{'$or':_[_0xb3a2('0x2e')](_0x5cc95a,function(_0x55575c){if(_0x55575c[_0xb3a2('0x2c')]!==_0xb3a2('0x3e')){var _0x240ef3={};_0x240ef3[_0x55575c['name']]={'$like':'%'+_0x9458ed[_0xb3a2('0x2f')][_0xb3a2('0x3c')]+'%'};return _0x240ef3;}})});}_0x1c4311=_[_0xb3a2('0x3d')]({},_0x1c4311,_0x9458ed['options']);var _0xe7259={'where':_0x1c4311[_0xb3a2('0x3a')]};return db['AnalyticMetric'][_0xb3a2('0x1c')](_0xe7259)['then'](function(_0x34707c){_0x3c8306[_0xb3a2('0x1c')]=_0x34707c;if(_0x9458ed[_0xb3a2('0x2f')]['includeAll']){_0x1c4311[_0xb3a2('0x3f')]=[{'all':!![]}];}return db[_0xb3a2('0x29')][_0xb3a2('0x40')](_0x1c4311);})['then'](function(_0x3d279c){_0x3c8306[_0xb3a2('0x41')]=_0x3d279c;return _0x3c8306;})['then'](respondWithFilteredResult(_0x3589d5,_0x1c4311))[_0xb3a2('0x42')](handleError(_0x3589d5,null));};exports['show']=function(_0x5c42e9,_0xf78d7a){var _0xf45a6e={'raw':!![],'where':{'id':_0x5c42e9[_0xb3a2('0x43')]['id']}},_0x20cd8a={};_0x20cd8a[_0xb3a2('0x32')]=_[_0xb3a2('0x30')](db[_0xb3a2('0x29')][_0xb3a2('0x2a')]);_0x20cd8a[_0xb3a2('0x2f')]=_[_0xb3a2('0x30')](_0x5c42e9['query']);_0x20cd8a['filters']=_[_0xb3a2('0x34')](_0x20cd8a[_0xb3a2('0x32')],_0x20cd8a[_0xb3a2('0x2f')]);_0xf45a6e['attributes']=_[_0xb3a2('0x34')](_0x20cd8a[_0xb3a2('0x32')],qs['fields'](_0x5c42e9[_0xb3a2('0x2f')][_0xb3a2('0x35')]));_0xf45a6e[_0xb3a2('0x33')]=_0xf45a6e[_0xb3a2('0x33')][_0xb3a2('0x44')]?_0xf45a6e[_0xb3a2('0x33')]:_0x20cd8a[_0xb3a2('0x32')];if(_0x5c42e9[_0xb3a2('0x2f')][_0xb3a2('0x45')]){_0xf45a6e[_0xb3a2('0x3f')]=[{'all':!![]}];}_0xf45a6e=_[_0xb3a2('0x3d')]({},_0xf45a6e,_0x5c42e9[_0xb3a2('0x46')]);return db[_0xb3a2('0x29')]['find'](_0xf45a6e)[_0xb3a2('0x22')](handleEntityNotFound(_0xf78d7a,null))[_0xb3a2('0x22')](respondWithResult(_0xf78d7a,null))[_0xb3a2('0x42')](handleError(_0xf78d7a,null));};exports['create']=function(_0x3a3c77,_0x26f30b){return db[_0xb3a2('0x29')][_0xb3a2('0x47')](_0x3a3c77[_0xb3a2('0x48')],{})[_0xb3a2('0x22')](function(_0x8a2e9){var _0x52d085=_0x3a3c77[_0xb3a2('0x49')][_0xb3a2('0x23')]({'plain':!![]});if(!_0x52d085)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x52d085[_0xb3a2('0x4a')]===_0xb3a2('0x49')){var _0x9055a1=_0x8a2e9[_0xb3a2('0x23')]({'plain':!![]});var _0x2d4162=_0xb3a2('0x24');return db['UserProfileSection']['find']({'where':{'name':_0x2d4162,'userProfileId':_0x52d085[_0xb3a2('0x4b')]},'raw':!![]})[_0xb3a2('0x22')](function(_0x2f0431){if(_0x2f0431&&_0x2f0431[_0xb3a2('0x4c')]===0x0){return db[_0xb3a2('0x4d')][_0xb3a2('0x47')]({'name':_0x9055a1['name'],'resourceId':_0x9055a1['id'],'type':_0x2f0431[_0xb3a2('0x27')],'sectionId':_0x2f0431['id']},{})[_0xb3a2('0x22')](function(){return _0x8a2e9;});}else{return _0x8a2e9;}})[_0xb3a2('0x42')](function(_0x30bd05){logger['error'](_0xb3a2('0x4e'),_0x30bd05);throw _0x30bd05;});}return _0x8a2e9;})[_0xb3a2('0x22')](respondWithResult(_0x26f30b,0xc9))[_0xb3a2('0x42')](handleError(_0x26f30b,null));};exports[_0xb3a2('0x4f')]=function(_0x14867b,_0x6305fc){if(_0x14867b[_0xb3a2('0x48')]['id']){delete _0x14867b[_0xb3a2('0x48')]['id'];}return db['AnalyticMetric'][_0xb3a2('0x50')]({'where':{'id':_0x14867b['params']['id']}})[_0xb3a2('0x22')](handleEntityNotFound(_0x6305fc,null))[_0xb3a2('0x22')](saveUpdates(_0x14867b[_0xb3a2('0x48')],null))[_0xb3a2('0x22')](respondWithResult(_0x6305fc,null))[_0xb3a2('0x42')](handleError(_0x6305fc,null));};exports['destroy']=function(_0x5026b5,_0x8d2094){return db['AnalyticMetric'][_0xb3a2('0x50')]({'where':{'id':_0x5026b5[_0xb3a2('0x43')]['id']}})['then'](handleEntityNotFound(_0x8d2094,null))[_0xb3a2('0x22')](removeEntity(_0x8d2094,null))[_0xb3a2('0x42')](handleError(_0x8d2094,null));}; \ No newline at end of file +var _0x4d72=['request-promise','bluebird','mustache','util','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','then','Metrics','UserProfileResource','destroy','error','stack','name','map','AnalyticMetric','type','model','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','where','pick','filter','VIRTUAL','merge','options','include','catch','params','keys','rawAttributes','includeAll','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','html-pdf','fast-json-patch'];(function(_0x3cf270,_0x37e185){var _0x12ef61=function(_0x275f87){while(--_0x275f87){_0x3cf270['push'](_0x3cf270['shift']());}};_0x12ef61(++_0x37e185);}(_0x4d72,0x132));var _0x24d7=function(_0x23de2e,_0x4688d2){_0x23de2e=_0x23de2e-0x0;var _0x5d5876=_0x4d72[_0x23de2e];return _0x5d5876;};'use strict';var pdf=require(_0x24d7('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x24d7('0x1'));var rp=require(_0x24d7('0x2'));var moment=require('moment');var BPromise=require(_0x24d7('0x3'));var Mustache=require(_0x24d7('0x4'));var util=require(_0x24d7('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x24d7('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x24d7('0x7'));var squel=require(_0x24d7('0x8'));var crypto=require(_0x24d7('0x9'));var jsforce=require(_0x24d7('0xa'));var deskjs=require(_0x24d7('0xb'));var toCsv=require('to-csv');var querystring=require(_0x24d7('0xc'));var Papa=require(_0x24d7('0xd'));var Redis=require(_0x24d7('0xe'));var authService=require(_0x24d7('0xf'));var qs=require(_0x24d7('0x10'));var as=require(_0x24d7('0x11'));var hardwareService=require(_0x24d7('0x12'));var logger=require(_0x24d7('0x13'))(_0x24d7('0x14'));var utils=require(_0x24d7('0x15'));var config=require('../../config/environment');var db=require(_0x24d7('0x16'))['db'];function respondWithStatusCode(_0x59b40e,_0x4a369a){_0x4a369a=_0x4a369a||0xcc;return function(_0x4104f){if(_0x4104f){return _0x59b40e[_0x24d7('0x17')](_0x4a369a);}return _0x59b40e[_0x24d7('0x18')](_0x4a369a)[_0x24d7('0x19')]();};}function respondWithResult(_0xa6114e,_0x4d84b0){_0x4d84b0=_0x4d84b0||0xc8;return function(_0x42b932){if(_0x42b932){return _0xa6114e[_0x24d7('0x18')](_0x4d84b0)[_0x24d7('0x1a')](_0x42b932);}};}function respondWithFilteredResult(_0x2011d1,_0x292e4a){return function(_0x453423){if(_0x453423){var _0x1c78ab=_0x453423[_0x24d7('0x1b')],_0x5c71b7=_0x292e4a[_0x24d7('0x1c')],_0x2698a4=_0x292e4a[_0x24d7('0x1c')]+_0x292e4a[_0x24d7('0x1d')],_0x2e6731;if(_0x2698a4>=_0x1c78ab){_0x2698a4=_0x1c78ab;_0x2e6731=0xc8;}else{_0x2e6731=0xce;}_0x2011d1[_0x24d7('0x18')](_0x2e6731);return _0x2011d1['set'](_0x24d7('0x1e'),_0x5c71b7+'-'+_0x2698a4+'/'+_0x1c78ab)[_0x24d7('0x1a')](_0x453423);}return null;};}function patchUpdates(_0x291417){return function(_0x4161d2){try{jsonpatch[_0x24d7('0x1f')](_0x4161d2,_0x291417,!![]);}catch(_0x4a753d){return BPromise[_0x24d7('0x20')](_0x4a753d);}return _0x4161d2[_0x24d7('0x21')]();};}function saveUpdates(_0x1c1042,_0x21209b){return function(_0x2339ff){if(_0x2339ff){return _0x2339ff[_0x24d7('0x22')](_0x1c1042)[_0x24d7('0x23')](function(_0x54670a){return _0x54670a;});}return null;};}function removeEntity(_0x50a21f,_0x30feaf){return function(_0x4c01b1){if(_0x4c01b1){return _0x4c01b1['destroy']()['then'](function(){var _0x5c0e0c=_0x4c01b1['get']({'plain':!![]});var _0x2d4a95=_0x24d7('0x24');return db[_0x24d7('0x25')][_0x24d7('0x26')]({'where':{'type':_0x2d4a95,'resourceId':_0x5c0e0c['id']}})[_0x24d7('0x23')](function(){return _0x4c01b1;});})['then'](function(){_0x50a21f[_0x24d7('0x18')](0xcc)[_0x24d7('0x19')]();});}};}function handleEntityNotFound(_0xc83048,_0x560a69){return function(_0x59bf71){if(!_0x59bf71){_0xc83048[_0x24d7('0x17')](0x194);}return _0x59bf71;};}function handleError(_0x515676,_0x114290){_0x114290=_0x114290||0x1f4;return function(_0x4b093c){logger[_0x24d7('0x27')](_0x4b093c[_0x24d7('0x28')]);if(_0x4b093c[_0x24d7('0x29')]){delete _0x4b093c[_0x24d7('0x29')];}_0x515676[_0x24d7('0x18')](_0x114290)['send'](_0x4b093c);};}exports['index']=function(_0x3bb93c,_0x53c08f){var _0x8210cb={},_0x564641={},_0x340473={'count':0x0,'rows':[]};var _0x249eb4=_[_0x24d7('0x2a')](db[_0x24d7('0x2b')]['rawAttributes'],function(_0x3af7b9){return{'name':_0x3af7b9['fieldName'],'type':_0x3af7b9[_0x24d7('0x2c')]['key']};});_0x564641[_0x24d7('0x2d')]=_['map'](_0x249eb4,'name');_0x564641[_0x24d7('0x2e')]=_['keys'](_0x3bb93c[_0x24d7('0x2e')]);_0x564641[_0x24d7('0x2f')]=_['intersection'](_0x564641['model'],_0x564641[_0x24d7('0x2e')]);_0x8210cb[_0x24d7('0x30')]=_[_0x24d7('0x31')](_0x564641[_0x24d7('0x2d')],qs['fields'](_0x3bb93c['query'][_0x24d7('0x32')]));_0x8210cb['attributes']=_0x8210cb['attributes']['length']?_0x8210cb[_0x24d7('0x30')]:_0x564641[_0x24d7('0x2d')];if(!_0x3bb93c[_0x24d7('0x2e')][_0x24d7('0x33')](_0x24d7('0x34'))){_0x8210cb[_0x24d7('0x1d')]=qs['limit'](_0x3bb93c['query'][_0x24d7('0x1d')]);_0x8210cb[_0x24d7('0x1c')]=qs[_0x24d7('0x1c')](_0x3bb93c['query'][_0x24d7('0x1c')]);}_0x8210cb[_0x24d7('0x35')]=qs['sort'](_0x3bb93c['query']['sort']);_0x8210cb[_0x24d7('0x36')]=qs[_0x24d7('0x2f')](_[_0x24d7('0x37')](_0x3bb93c[_0x24d7('0x2e')],_0x564641['filters']));if(_0x3bb93c['query'][_0x24d7('0x38')]){_0x8210cb[_0x24d7('0x36')]=_['merge'](_0x8210cb[_0x24d7('0x36')],{'$or':_[_0x24d7('0x2a')](_0x249eb4,function(_0x134dae){if(_0x134dae[_0x24d7('0x2c')]!==_0x24d7('0x39')){var _0x5c5299={};_0x5c5299[_0x134dae[_0x24d7('0x29')]]={'$like':'%'+_0x3bb93c[_0x24d7('0x2e')][_0x24d7('0x38')]+'%'};return _0x5c5299;}})});}_0x8210cb=_[_0x24d7('0x3a')]({},_0x8210cb,_0x3bb93c[_0x24d7('0x3b')]);var _0x3982df={'where':_0x8210cb['where']};return db[_0x24d7('0x2b')][_0x24d7('0x1b')](_0x3982df)[_0x24d7('0x23')](function(_0x40c5e0){_0x340473[_0x24d7('0x1b')]=_0x40c5e0;if(_0x3bb93c['query']['includeAll']){_0x8210cb[_0x24d7('0x3c')]=[{'all':!![]}];}return db[_0x24d7('0x2b')]['findAll'](_0x8210cb);})[_0x24d7('0x23')](function(_0x1b2c88){_0x340473['rows']=_0x1b2c88;return _0x340473;})[_0x24d7('0x23')](respondWithFilteredResult(_0x53c08f,_0x8210cb))[_0x24d7('0x3d')](handleError(_0x53c08f,null));};exports['show']=function(_0x18ab63,_0x5da10d){var _0x8c5bc={'raw':!![],'where':{'id':_0x18ab63[_0x24d7('0x3e')]['id']}},_0xda0e55={};_0xda0e55[_0x24d7('0x2d')]=_[_0x24d7('0x3f')](db[_0x24d7('0x2b')][_0x24d7('0x40')]);_0xda0e55[_0x24d7('0x2e')]=_[_0x24d7('0x3f')](_0x18ab63[_0x24d7('0x2e')]);_0xda0e55[_0x24d7('0x2f')]=_['intersection'](_0xda0e55['model'],_0xda0e55[_0x24d7('0x2e')]);_0x8c5bc[_0x24d7('0x30')]=_[_0x24d7('0x31')](_0xda0e55[_0x24d7('0x2d')],qs['fields'](_0x18ab63[_0x24d7('0x2e')][_0x24d7('0x32')]));_0x8c5bc['attributes']=_0x8c5bc['attributes']['length']?_0x8c5bc[_0x24d7('0x30')]:_0xda0e55['model'];if(_0x18ab63['query'][_0x24d7('0x41')]){_0x8c5bc['include']=[{'all':!![]}];}_0x8c5bc=_['merge']({},_0x8c5bc,_0x18ab63['options']);return db[_0x24d7('0x2b')][_0x24d7('0x42')](_0x8c5bc)['then'](handleEntityNotFound(_0x5da10d,null))['then'](respondWithResult(_0x5da10d,null))[_0x24d7('0x3d')](handleError(_0x5da10d,null));};exports[_0x24d7('0x43')]=function(_0x244c4f,_0x545fc6){return db[_0x24d7('0x2b')][_0x24d7('0x43')](_0x244c4f[_0x24d7('0x44')],{})[_0x24d7('0x23')](function(_0x4a8174){var _0x57c8fc=_0x244c4f['user'][_0x24d7('0x45')]({'plain':!![]});if(!_0x57c8fc)throw new Error(_0x24d7('0x46'));if(_0x57c8fc[_0x24d7('0x47')]===_0x24d7('0x48')){var _0x2c2442=_0x4a8174[_0x24d7('0x45')]({'plain':!![]});var _0x4c8213=_0x24d7('0x24');return db[_0x24d7('0x49')][_0x24d7('0x42')]({'where':{'name':_0x4c8213,'userProfileId':_0x57c8fc[_0x24d7('0x4a')]},'raw':!![]})['then'](function(_0xd6b482){if(_0xd6b482&&_0xd6b482[_0x24d7('0x4b')]===0x0){return db[_0x24d7('0x25')]['create']({'name':_0x2c2442[_0x24d7('0x29')],'resourceId':_0x2c2442['id'],'type':_0xd6b482[_0x24d7('0x29')],'sectionId':_0xd6b482['id']},{})['then'](function(){return _0x4a8174;});}else{return _0x4a8174;}})[_0x24d7('0x3d')](function(_0x47034b){logger[_0x24d7('0x27')](_0x24d7('0x4c'),_0x47034b);throw _0x47034b;});}return _0x4a8174;})['then'](respondWithResult(_0x545fc6,0xc9))[_0x24d7('0x3d')](handleError(_0x545fc6,null));};exports['update']=function(_0x4b3892,_0x189e42){if(_0x4b3892[_0x24d7('0x44')]['id']){delete _0x4b3892[_0x24d7('0x44')]['id'];}return db[_0x24d7('0x2b')][_0x24d7('0x42')]({'where':{'id':_0x4b3892[_0x24d7('0x3e')]['id']}})[_0x24d7('0x23')](handleEntityNotFound(_0x189e42,null))[_0x24d7('0x23')](saveUpdates(_0x4b3892[_0x24d7('0x44')],null))[_0x24d7('0x23')](respondWithResult(_0x189e42,null))[_0x24d7('0x3d')](handleError(_0x189e42,null));};exports['destroy']=function(_0x257b62,_0x1e8b79){return db[_0x24d7('0x2b')][_0x24d7('0x42')]({'where':{'id':_0x257b62[_0x24d7('0x3e')]['id']}})['then'](handleEntityNotFound(_0x1e8b79,null))[_0x24d7('0x23')](removeEntity(_0x1e8b79,null))[_0x24d7('0x3d')](handleError(_0x1e8b79,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index b051e97..dcb0b89 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 _0x680f=['lodash','../../config/logger','moment','bluebird','request-promise','AnalyticMetric','analytics_metrics'];(function(_0x1e4360,_0x930b9b){var _0x31e6b4=function(_0x49dd8e){while(--_0x49dd8e){_0x1e4360['push'](_0x1e4360['shift']());}};_0x31e6b4(++_0x930b9b);}(_0x680f,0xaf));var _0xf680=function(_0xb5adad,_0x2e59a2){_0xb5adad=_0xb5adad-0x0;var _0x3558b4=_0x680f[_0xb5adad];return _0x3558b4;};'use strict';var _=require(_0xf680('0x0'));var util=require('util');var logger=require(_0xf680('0x1'))('api');var moment=require(_0xf680('0x2'));var BPromise=require(_0xf680('0x3'));var rp=require(_0xf680('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./analyticMetric.attributes');module['exports']=function(_0x1d0bb1,_0x359ce0){return _0x1d0bb1['define'](_0xf680('0x5'),attributes,{'tableName':_0xf680('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x11a3=['AnalyticMetric','analytics_metrics','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./analyticMetric.attributes','exports','define'];(function(_0x2ea9c6,_0x59f7f1){var _0x1d7ad4=function(_0x63da89){while(--_0x63da89){_0x2ea9c6['push'](_0x2ea9c6['shift']());}};_0x1d7ad4(++_0x59f7f1);}(_0x11a3,0xd2));var _0x311a=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0x11a3[_0x16b9ed];return _0x66b1f8;};'use strict';var _=require(_0x311a('0x0'));var util=require(_0x311a('0x1'));var logger=require(_0x311a('0x2'))(_0x311a('0x3'));var moment=require('moment');var BPromise=require(_0x311a('0x4'));var rp=require(_0x311a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x311a('0x6'));var config=require(_0x311a('0x7'));var attributes=require(_0x311a('0x8'));module[_0x311a('0x9')]=function(_0x382f1d,_0x225825){return _0x382f1d[_0x311a('0xa')](_0x311a('0xb'),attributes,{'tableName':_0x311a('0xc'),'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 0a4cc04..e1a62bc 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 _0xcff0=['error','code','AnalyticMetric,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','AnalyticMetric,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x154ba2,_0x3696d5){var _0x5ef18b=function(_0x2a3214){while(--_0x2a3214){_0x154ba2['push'](_0x154ba2['shift']());}};_0x5ef18b(++_0x3696d5);}(_0xcff0,0x1be));var _0x0cff=function(_0x33dcdb,_0xeb82ad){_0x33dcdb=_0x33dcdb-0x0;var _0x409cc7=_0xcff0[_0x33dcdb];return _0x409cc7;};'use strict';var _=require(_0x0cff('0x0'));var util=require(_0x0cff('0x1'));var moment=require(_0x0cff('0x2'));var BPromise=require(_0x0cff('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0cff('0x4'));var db=require(_0x0cff('0x5'))['db'];var utils=require(_0x0cff('0x6'));var logger=require(_0x0cff('0x7'))(_0x0cff('0x8'));var config=require(_0x0cff('0x9'));var jayson=require(_0x0cff('0xa'));var client=jayson['client'][_0x0cff('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1f99ab,_0x2e6590,_0x484ae4){return new BPromise(function(_0x5963fe,_0x39a10b){return client[_0x0cff('0xc')](_0x1f99ab,_0x484ae4)['then'](function(_0x22867a){logger[_0x0cff('0xd')]('AnalyticMetric,\x20%s,\x20%s',_0x2e6590,'request\x20sent');logger['debug'](_0x0cff('0xe'),_0x2e6590,_0x0cff('0xf'),JSON['stringify'](_0x22867a));if(_0x22867a[_0x0cff('0x10')]){if(_0x22867a[_0x0cff('0x10')][_0x0cff('0x11')]===0x1f4){logger[_0x0cff('0x10')](_0x0cff('0x12'),_0x2e6590,_0x22867a[_0x0cff('0x10')]['message']);return _0x39a10b(_0x22867a[_0x0cff('0x10')][_0x0cff('0x13')]);}logger[_0x0cff('0x10')](_0x0cff('0x12'),_0x2e6590,_0x22867a[_0x0cff('0x10')]['message']);return _0x5963fe(_0x22867a[_0x0cff('0x10')]['message']);}else{logger[_0x0cff('0xd')]('AnalyticMetric,\x20%s,\x20%s',_0x2e6590,'request\x20sent');_0x5963fe(_0x22867a[_0x0cff('0x14')][_0x0cff('0x13')]);}})[_0x0cff('0x15')](function(_0x3e23ba){logger[_0x0cff('0x10')](_0x0cff('0x12'),_0x2e6590,_0x3e23ba);_0x39a10b(_0x3e23ba);});});} \ No newline at end of file +var _0xef6a=['info','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','error','code','AnalyticMetric,\x20%s,\x20%s','message','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0xef6a,0x134));var _0xaef6=function(_0x5a776b,_0x46f785){_0x5a776b=_0x5a776b-0x0;var _0xbbef59=_0xef6a[_0x5a776b];return _0xbbef59;};'use strict';var _=require('lodash');var util=require(_0xaef6('0x0'));var moment=require(_0xaef6('0x1'));var BPromise=require(_0xaef6('0x2'));var rs=require(_0xaef6('0x3'));var fs=require('fs');var Redis=require(_0xaef6('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xaef6('0x5'));var logger=require(_0xaef6('0x6'))(_0xaef6('0x7'));var config=require(_0xaef6('0x8'));var jayson=require(_0xaef6('0x9'));var client=jayson[_0xaef6('0xa')][_0xaef6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3d4855,_0x53c66d,_0x5166f0){return new BPromise(function(_0x11a6a4,_0x3ca7ea){return client[_0xaef6('0xc')](_0x3d4855,_0x5166f0)[_0xaef6('0xd')](function(_0x123d44){logger[_0xaef6('0xe')]('AnalyticMetric,\x20%s,\x20%s',_0x53c66d,_0xaef6('0xf'));logger[_0xaef6('0x10')](_0xaef6('0x11'),_0x53c66d,_0xaef6('0xf'),JSON['stringify'](_0x123d44));if(_0x123d44[_0xaef6('0x12')]){if(_0x123d44[_0xaef6('0x12')][_0xaef6('0x13')]===0x1f4){logger[_0xaef6('0x12')](_0xaef6('0x14'),_0x53c66d,_0x123d44['error'][_0xaef6('0x15')]);return _0x3ca7ea(_0x123d44[_0xaef6('0x12')]['message']);}logger[_0xaef6('0x12')](_0xaef6('0x14'),_0x53c66d,_0x123d44[_0xaef6('0x12')]['message']);return _0x11a6a4(_0x123d44[_0xaef6('0x12')][_0xaef6('0x15')]);}else{logger[_0xaef6('0xe')]('AnalyticMetric,\x20%s,\x20%s',_0x53c66d,_0xaef6('0xf'));_0x11a6a4(_0x123d44['result'][_0xaef6('0x15')]);}})[_0xaef6('0x16')](function(_0x2c32b7){logger[_0xaef6('0x12')](_0xaef6('0x14'),_0x53c66d,_0x2c32b7);_0x3ca7ea(_0x2c32b7);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index f558022..f3a8d6e 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 _0x7880=['Router','../../components/auth/service','../../config/environment','./analyticMetric.controller','get','isAuthenticated','index','/:id','show','post','create','update','delete','destroy','util','path','connect-timeout','express'];(function(_0x4b935a,_0x327ee3){var _0xa298f0=function(_0x3e07c2){while(--_0x3e07c2){_0x4b935a['push'](_0x4b935a['shift']());}};_0xa298f0(++_0x327ee3);}(_0x7880,0x1f4));var _0x0788=function(_0x577f71,_0x3a8951){_0x577f71=_0x577f71-0x0;var _0xfec7c2=_0x7880[_0x577f71];return _0xfec7c2;};'use strict';var multer=require('multer');var util=require(_0x0788('0x0'));var path=require(_0x0788('0x1'));var timeout=require(_0x0788('0x2'));var express=require(_0x0788('0x3'));var router=express[_0x0788('0x4')]();var auth=require(_0x0788('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0788('0x6'));var controller=require(_0x0788('0x7'));router[_0x0788('0x8')]('/',auth[_0x0788('0x9')](),controller[_0x0788('0xa')]);router[_0x0788('0x8')](_0x0788('0xb'),auth[_0x0788('0x9')](),controller[_0x0788('0xc')]);router[_0x0788('0xd')]('/',auth['isAuthenticated'](),controller[_0x0788('0xe')]);router['put'](_0x0788('0xb'),auth['isAuthenticated'](),controller[_0x0788('0xf')]);router[_0x0788('0x10')](_0x0788('0xb'),auth[_0x0788('0x9')](),controller[_0x0788('0x11')]);module['exports']=router; \ No newline at end of file +var _0x6d38=['path','connect-timeout','../../components/auth/service','../../config/environment','./analyticMetric.controller','get','index','/:id','isAuthenticated','create','put','update','delete','destroy','exports','util'];(function(_0x354b62,_0x5b6b27){var _0x455471=function(_0x29fdcd){while(--_0x29fdcd){_0x354b62['push'](_0x354b62['shift']());}};_0x455471(++_0x5b6b27);}(_0x6d38,0x1ef));var _0x86d3=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x6d38[_0x17d9e3];return _0x14192d;};'use strict';var multer=require('multer');var util=require(_0x86d3('0x0'));var path=require(_0x86d3('0x1'));var timeout=require(_0x86d3('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x86d3('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x86d3('0x4'));var controller=require(_0x86d3('0x5'));router[_0x86d3('0x6')]('/',auth['isAuthenticated'](),controller[_0x86d3('0x7')]);router[_0x86d3('0x6')](_0x86d3('0x8'),auth[_0x86d3('0x9')](),controller['show']);router['post']('/',auth[_0x86d3('0x9')](),controller[_0x86d3('0xa')]);router[_0x86d3('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x86d3('0xc')]);router[_0x86d3('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x86d3('0xe')]);module[_0x86d3('0xf')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index 38e2a35..869235c 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 _0xdf55=['sequelize','exports','TEXT'];(function(_0x30a208,_0x1e2d6d){var _0x5f2755=function(_0x468f0c){while(--_0x468f0c){_0x30a208['push'](_0x30a208['shift']());}};_0x5f2755(++_0x1e2d6d);}(_0xdf55,0x153));var _0x5df5=function(_0xc66c50,_0x4dfbc1){_0xc66c50=_0xc66c50-0x0;var _0x48bc6f=_0xdf55[_0xc66c50];return _0x48bc6f;};'use strict';var Sequelize=require(_0x5df5('0x0'));module[_0x5df5('0x1')]={'tree':{'type':Sequelize[_0x5df5('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xd61c=['TEXT'];(function(_0x33d1cc,_0x40c787){var _0x375288=function(_0x29e2c6){while(--_0x29e2c6){_0x33d1cc['push'](_0x33d1cc['shift']());}};_0x375288(++_0x40c787);}(_0xd61c,0x19f));var _0xcd61=function(_0x59c563,_0x11127b){_0x59c563=_0x59c563-0x0;var _0x5c28ff=_0xd61c[_0x59c563];return _0x5c28ff;};'use strict';var Sequelize=require('sequelize');module['exports']={'tree':{'type':Sequelize[_0xcd61('0x0')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index 81fb421..fd36d7e 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 _0x36ee=['nolimit','order','sort','pick','where','merge','type','filter','options','includeAll','include','findAll','catch','show','params','keys','find','create','body','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','AnalyticTreeReport','map','query','filters','intersection','model','attributes','fields','length','hasOwnProperty'];(function(_0x481d24,_0x3e348d){var _0x48872c=function(_0x1ca2cb){while(--_0x1ca2cb){_0x481d24['push'](_0x481d24['shift']());}};_0x48872c(++_0x3e348d);}(_0x36ee,0xe8));var _0xe36e=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x36ee[_0x2dafbe];return _0x58a45a;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xe36e('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe36e('0x1'));var rp=require(_0xe36e('0x2'));var moment=require(_0xe36e('0x3'));var BPromise=require(_0xe36e('0x4'));var Mustache=require(_0xe36e('0x5'));var util=require(_0xe36e('0x6'));var path=require(_0xe36e('0x7'));var sox=require(_0xe36e('0x8'));var csv=require(_0xe36e('0x9'));var ejs=require(_0xe36e('0xa'));var fs=require('fs');var _=require(_0xe36e('0xb'));var squel=require(_0xe36e('0xc'));var crypto=require('crypto');var jsforce=require(_0xe36e('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xe36e('0x9'));var querystring=require(_0xe36e('0xe'));var Papa=require(_0xe36e('0xf'));var Redis=require('ioredis');var authService=require(_0xe36e('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xe36e('0x11'));var hardwareService=require(_0xe36e('0x12'));var logger=require(_0xe36e('0x13'))(_0xe36e('0x14'));var utils=require(_0xe36e('0x15'));var config=require(_0xe36e('0x16'));var db=require(_0xe36e('0x17'))['db'];function respondWithStatusCode(_0x265473,_0x4fbdb2){_0x4fbdb2=_0x4fbdb2||0xcc;return function(_0x32981d){if(_0x32981d){return _0x265473[_0xe36e('0x18')](_0x4fbdb2);}return _0x265473[_0xe36e('0x19')](_0x4fbdb2)[_0xe36e('0x1a')]();};}function respondWithResult(_0x5c3f3c,_0x3e264a){_0x3e264a=_0x3e264a||0xc8;return function(_0x521afa){if(_0x521afa){return _0x5c3f3c['status'](_0x3e264a)[_0xe36e('0x1b')](_0x521afa);}};}function respondWithFilteredResult(_0x300f21,_0x26fb37){return function(_0x278135){if(_0x278135){var _0xd6828e=_0x278135[_0xe36e('0x1c')],_0x924cd5=_0x26fb37[_0xe36e('0x1d')],_0x2096f6=_0x26fb37['offset']+_0x26fb37[_0xe36e('0x1e')],_0x39bae8;if(_0x2096f6>=_0xd6828e){_0x2096f6=_0xd6828e;_0x39bae8=0xc8;}else{_0x39bae8=0xce;}_0x300f21[_0xe36e('0x19')](_0x39bae8);return _0x300f21['set'](_0xe36e('0x1f'),_0x924cd5+'-'+_0x2096f6+'/'+_0xd6828e)['json'](_0x278135);}return null;};}function patchUpdates(_0x471400){return function(_0x303784){try{jsonpatch['apply'](_0x303784,_0x471400,!![]);}catch(_0x472825){return BPromise[_0xe36e('0x20')](_0x472825);}return _0x303784[_0xe36e('0x21')]();};}function saveUpdates(_0x597331,_0x21e95e){return function(_0x21bcf9){if(_0x21bcf9){return _0x21bcf9[_0xe36e('0x22')](_0x597331)[_0xe36e('0x23')](function(_0x2c4e30){return _0x2c4e30;});}return null;};}function removeEntity(_0x360b95,_0x4f438a){return function(_0xd71137){if(_0xd71137){return _0xd71137[_0xe36e('0x24')]()[_0xe36e('0x23')](function(){_0x360b95[_0xe36e('0x19')](0xcc)[_0xe36e('0x1a')]();});}};}function handleEntityNotFound(_0x53e13a,_0x598a7a){return function(_0x4749a8){if(!_0x4749a8){_0x53e13a[_0xe36e('0x18')](0x194);}return _0x4749a8;};}function handleError(_0xb0cd85,_0xb32195){_0xb32195=_0xb32195||0x1f4;return function(_0x31c12c){logger[_0xe36e('0x25')](_0x31c12c[_0xe36e('0x26')]);if(_0x31c12c['name']){delete _0x31c12c[_0xe36e('0x27')];}_0xb0cd85[_0xe36e('0x19')](_0xb32195)[_0xe36e('0x28')](_0x31c12c);};}exports[_0xe36e('0x29')]=function(_0x5e58d8,_0x2d757c){var _0x5a3133={},_0xf7b02e={},_0x5993de={'count':0x0,'rows':[]};var _0x19f001=_['map'](db[_0xe36e('0x2a')]['rawAttributes'],function(_0x3b1045){return{'name':_0x3b1045['fieldName'],'type':_0x3b1045['type']['key']};});_0xf7b02e['model']=_[_0xe36e('0x2b')](_0x19f001,_0xe36e('0x27'));_0xf7b02e['query']=_['keys'](_0x5e58d8[_0xe36e('0x2c')]);_0xf7b02e[_0xe36e('0x2d')]=_[_0xe36e('0x2e')](_0xf7b02e[_0xe36e('0x2f')],_0xf7b02e[_0xe36e('0x2c')]);_0x5a3133[_0xe36e('0x30')]=_['intersection'](_0xf7b02e[_0xe36e('0x2f')],qs[_0xe36e('0x31')](_0x5e58d8['query'][_0xe36e('0x31')]));_0x5a3133[_0xe36e('0x30')]=_0x5a3133[_0xe36e('0x30')][_0xe36e('0x32')]?_0x5a3133[_0xe36e('0x30')]:_0xf7b02e[_0xe36e('0x2f')];if(!_0x5e58d8[_0xe36e('0x2c')][_0xe36e('0x33')](_0xe36e('0x34'))){_0x5a3133[_0xe36e('0x1e')]=qs[_0xe36e('0x1e')](_0x5e58d8['query'][_0xe36e('0x1e')]);_0x5a3133['offset']=qs['offset'](_0x5e58d8[_0xe36e('0x2c')]['offset']);}_0x5a3133[_0xe36e('0x35')]=qs[_0xe36e('0x36')](_0x5e58d8[_0xe36e('0x2c')][_0xe36e('0x36')]);_0x5a3133['where']=qs['filters'](_[_0xe36e('0x37')](_0x5e58d8[_0xe36e('0x2c')],_0xf7b02e[_0xe36e('0x2d')]));if(_0x5e58d8[_0xe36e('0x2c')]['filter']){_0x5a3133[_0xe36e('0x38')]=_[_0xe36e('0x39')](_0x5a3133[_0xe36e('0x38')],{'$or':_['map'](_0x19f001,function(_0x2c58d1){if(_0x2c58d1[_0xe36e('0x3a')]!=='VIRTUAL'){var _0x40cbe5={};_0x40cbe5[_0x2c58d1[_0xe36e('0x27')]]={'$like':'%'+_0x5e58d8[_0xe36e('0x2c')][_0xe36e('0x3b')]+'%'};return _0x40cbe5;}})});}_0x5a3133=_[_0xe36e('0x39')]({},_0x5a3133,_0x5e58d8[_0xe36e('0x3c')]);var _0x130edb={'where':_0x5a3133[_0xe36e('0x38')]};return db[_0xe36e('0x2a')][_0xe36e('0x1c')](_0x130edb)[_0xe36e('0x23')](function(_0x39dd9b){_0x5993de[_0xe36e('0x1c')]=_0x39dd9b;if(_0x5e58d8['query'][_0xe36e('0x3d')]){_0x5a3133[_0xe36e('0x3e')]=[{'all':!![]}];}return db[_0xe36e('0x2a')][_0xe36e('0x3f')](_0x5a3133);})[_0xe36e('0x23')](function(_0x4d133b){_0x5993de['rows']=_0x4d133b;return _0x5993de;})[_0xe36e('0x23')](respondWithFilteredResult(_0x2d757c,_0x5a3133))[_0xe36e('0x40')](handleError(_0x2d757c,null));};exports[_0xe36e('0x41')]=function(_0x537e1a,_0x27caff){var _0x34a1ba={'raw':!![],'where':{'id':_0x537e1a[_0xe36e('0x42')]['id']}},_0xff4f63={};_0xff4f63['model']=_[_0xe36e('0x43')](db[_0xe36e('0x2a')]['rawAttributes']);_0xff4f63[_0xe36e('0x2c')]=_['keys'](_0x537e1a[_0xe36e('0x2c')]);_0xff4f63[_0xe36e('0x2d')]=_[_0xe36e('0x2e')](_0xff4f63[_0xe36e('0x2f')],_0xff4f63[_0xe36e('0x2c')]);_0x34a1ba['attributes']=_[_0xe36e('0x2e')](_0xff4f63[_0xe36e('0x2f')],qs[_0xe36e('0x31')](_0x537e1a[_0xe36e('0x2c')][_0xe36e('0x31')]));_0x34a1ba[_0xe36e('0x30')]=_0x34a1ba['attributes'][_0xe36e('0x32')]?_0x34a1ba[_0xe36e('0x30')]:_0xff4f63[_0xe36e('0x2f')];if(_0x537e1a[_0xe36e('0x2c')][_0xe36e('0x3d')]){_0x34a1ba['include']=[{'all':!![]}];}_0x34a1ba=_[_0xe36e('0x39')]({},_0x34a1ba,_0x537e1a[_0xe36e('0x3c')]);return db[_0xe36e('0x2a')][_0xe36e('0x44')](_0x34a1ba)[_0xe36e('0x23')](handleEntityNotFound(_0x27caff,null))[_0xe36e('0x23')](respondWithResult(_0x27caff,null))[_0xe36e('0x40')](handleError(_0x27caff,null));};exports[_0xe36e('0x45')]=function(_0x43c2d4,_0x52e744){return db['AnalyticTreeReport'][_0xe36e('0x45')](_0x43c2d4['body'],{})[_0xe36e('0x23')](respondWithResult(_0x52e744,0xc9))[_0xe36e('0x40')](handleError(_0x52e744,null));};exports[_0xe36e('0x22')]=function(_0x25aa09,_0x51641c){if(_0x25aa09[_0xe36e('0x46')]['id']){delete _0x25aa09[_0xe36e('0x46')]['id'];}return db['AnalyticTreeReport'][_0xe36e('0x44')]({'where':{'id':_0x25aa09[_0xe36e('0x42')]['id']}})[_0xe36e('0x23')](handleEntityNotFound(_0x51641c,null))[_0xe36e('0x23')](saveUpdates(_0x25aa09[_0xe36e('0x46')],null))[_0xe36e('0x23')](respondWithResult(_0x51641c,null))[_0xe36e('0x40')](handleError(_0x51641c,null));};exports[_0xe36e('0x24')]=function(_0x17555e,_0x3a99aa){return db[_0xe36e('0x2a')][_0xe36e('0x44')]({'where':{'id':_0x17555e[_0xe36e('0x42')]['id']}})[_0xe36e('0x23')](handleEntityNotFound(_0x3a99aa,null))[_0xe36e('0x23')](removeEntity(_0x3a99aa,null))['catch'](handleError(_0x3a99aa,null));}; \ No newline at end of file +var _0xe5b5=['request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','status','end','json','offset','limit','Content-Range','apply','save','update','then','destroy','stack','name','send','index','map','AnalyticTreeReport','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','count','include','rows','catch','show','params','includeAll','create','body','find','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x151ea1,_0xda3805){var _0xc7629c=function(_0x3703c7){while(--_0x3703c7){_0x151ea1['push'](_0x151ea1['shift']());}};_0xc7629c(++_0xda3805);}(_0xe5b5,0x12b));var _0x5e5b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xe5b5[_0x20a584];return _0x4b41a8;};'use strict';var pdf=require(_0x5e5b('0x0'));var emlformat=require(_0x5e5b('0x1'));var rimraf=require(_0x5e5b('0x2'));var zipdir=require(_0x5e5b('0x3'));var jsonpatch=require(_0x5e5b('0x4'));var rp=require(_0x5e5b('0x5'));var moment=require(_0x5e5b('0x6'));var BPromise=require(_0x5e5b('0x7'));var Mustache=require(_0x5e5b('0x8'));var util=require(_0x5e5b('0x9'));var path=require(_0x5e5b('0xa'));var sox=require(_0x5e5b('0xb'));var csv=require(_0x5e5b('0xc'));var ejs=require(_0x5e5b('0xd'));var fs=require('fs');var _=require(_0x5e5b('0xe'));var squel=require(_0x5e5b('0xf'));var crypto=require(_0x5e5b('0x10'));var jsforce=require(_0x5e5b('0x11'));var deskjs=require(_0x5e5b('0x12'));var toCsv=require(_0x5e5b('0xc'));var querystring=require(_0x5e5b('0x13'));var Papa=require(_0x5e5b('0x14'));var Redis=require(_0x5e5b('0x15'));var authService=require('../../components/auth/service');var qs=require(_0x5e5b('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5e5b('0x17'));var logger=require(_0x5e5b('0x18'))(_0x5e5b('0x19'));var utils=require(_0x5e5b('0x1a'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5ebf65,_0x310f71){_0x310f71=_0x310f71||0xcc;return function(_0x18434e){if(_0x18434e){return _0x5ebf65[_0x5e5b('0x1b')](_0x310f71);}return _0x5ebf65[_0x5e5b('0x1c')](_0x310f71)[_0x5e5b('0x1d')]();};}function respondWithResult(_0x1e3483,_0x2e331d){_0x2e331d=_0x2e331d||0xc8;return function(_0x49edd0){if(_0x49edd0){return _0x1e3483[_0x5e5b('0x1c')](_0x2e331d)[_0x5e5b('0x1e')](_0x49edd0);}};}function respondWithFilteredResult(_0x4ff37b,_0x227417){return function(_0x578c14){if(_0x578c14){var _0x4e9509=_0x578c14['count'],_0x13a1cb=_0x227417[_0x5e5b('0x1f')],_0x444435=_0x227417['offset']+_0x227417[_0x5e5b('0x20')],_0xaf9ace;if(_0x444435>=_0x4e9509){_0x444435=_0x4e9509;_0xaf9ace=0xc8;}else{_0xaf9ace=0xce;}_0x4ff37b[_0x5e5b('0x1c')](_0xaf9ace);return _0x4ff37b['set'](_0x5e5b('0x21'),_0x13a1cb+'-'+_0x444435+'/'+_0x4e9509)[_0x5e5b('0x1e')](_0x578c14);}return null;};}function patchUpdates(_0x2281c8){return function(_0x538074){try{jsonpatch[_0x5e5b('0x22')](_0x538074,_0x2281c8,!![]);}catch(_0x3f1103){return BPromise['reject'](_0x3f1103);}return _0x538074[_0x5e5b('0x23')]();};}function saveUpdates(_0x1aa0c2,_0x3c488e){return function(_0x2d8252){if(_0x2d8252){return _0x2d8252[_0x5e5b('0x24')](_0x1aa0c2)[_0x5e5b('0x25')](function(_0x93df5c){return _0x93df5c;});}return null;};}function removeEntity(_0x37552c,_0x4a78e3){return function(_0x512e46){if(_0x512e46){return _0x512e46[_0x5e5b('0x26')]()[_0x5e5b('0x25')](function(){_0x37552c[_0x5e5b('0x1c')](0xcc)[_0x5e5b('0x1d')]();});}};}function handleEntityNotFound(_0x2e38ed,_0x28cd95){return function(_0x135c6c){if(!_0x135c6c){_0x2e38ed[_0x5e5b('0x1b')](0x194);}return _0x135c6c;};}function handleError(_0x161599,_0x26bc02){_0x26bc02=_0x26bc02||0x1f4;return function(_0x1788fd){logger['error'](_0x1788fd[_0x5e5b('0x27')]);if(_0x1788fd[_0x5e5b('0x28')]){delete _0x1788fd[_0x5e5b('0x28')];}_0x161599['status'](_0x26bc02)[_0x5e5b('0x29')](_0x1788fd);};}exports[_0x5e5b('0x2a')]=function(_0x5ee866,_0x13ff91){var _0x21c74b={},_0x39ce16={},_0x36b595={'count':0x0,'rows':[]};var _0x31af09=_[_0x5e5b('0x2b')](db[_0x5e5b('0x2c')][_0x5e5b('0x2d')],function(_0x3f6b25){return{'name':_0x3f6b25[_0x5e5b('0x2e')],'type':_0x3f6b25[_0x5e5b('0x2f')][_0x5e5b('0x30')]};});_0x39ce16['model']=_['map'](_0x31af09,_0x5e5b('0x28'));_0x39ce16[_0x5e5b('0x31')]=_[_0x5e5b('0x32')](_0x5ee866[_0x5e5b('0x31')]);_0x39ce16[_0x5e5b('0x33')]=_['intersection'](_0x39ce16[_0x5e5b('0x34')],_0x39ce16['query']);_0x21c74b[_0x5e5b('0x35')]=_[_0x5e5b('0x36')](_0x39ce16[_0x5e5b('0x34')],qs[_0x5e5b('0x37')](_0x5ee866['query'][_0x5e5b('0x37')]));_0x21c74b[_0x5e5b('0x35')]=_0x21c74b['attributes'][_0x5e5b('0x38')]?_0x21c74b[_0x5e5b('0x35')]:_0x39ce16[_0x5e5b('0x34')];if(!_0x5ee866[_0x5e5b('0x31')][_0x5e5b('0x39')](_0x5e5b('0x3a'))){_0x21c74b[_0x5e5b('0x20')]=qs[_0x5e5b('0x20')](_0x5ee866['query'][_0x5e5b('0x20')]);_0x21c74b[_0x5e5b('0x1f')]=qs[_0x5e5b('0x1f')](_0x5ee866[_0x5e5b('0x31')][_0x5e5b('0x1f')]);}_0x21c74b[_0x5e5b('0x3b')]=qs['sort'](_0x5ee866['query'][_0x5e5b('0x3c')]);_0x21c74b[_0x5e5b('0x3d')]=qs[_0x5e5b('0x33')](_['pick'](_0x5ee866[_0x5e5b('0x31')],_0x39ce16[_0x5e5b('0x33')]));if(_0x5ee866[_0x5e5b('0x31')][_0x5e5b('0x3e')]){_0x21c74b['where']=_[_0x5e5b('0x3f')](_0x21c74b[_0x5e5b('0x3d')],{'$or':_['map'](_0x31af09,function(_0x5ad9a6){if(_0x5ad9a6[_0x5e5b('0x2f')]!==_0x5e5b('0x40')){var _0xee3e6f={};_0xee3e6f[_0x5ad9a6['name']]={'$like':'%'+_0x5ee866[_0x5e5b('0x31')]['filter']+'%'};return _0xee3e6f;}})});}_0x21c74b=_['merge']({},_0x21c74b,_0x5ee866[_0x5e5b('0x41')]);var _0x2bcfaa={'where':_0x21c74b[_0x5e5b('0x3d')]};return db[_0x5e5b('0x2c')][_0x5e5b('0x42')](_0x2bcfaa)[_0x5e5b('0x25')](function(_0x2c1eb1){_0x36b595[_0x5e5b('0x42')]=_0x2c1eb1;if(_0x5ee866[_0x5e5b('0x31')]['includeAll']){_0x21c74b[_0x5e5b('0x43')]=[{'all':!![]}];}return db[_0x5e5b('0x2c')]['findAll'](_0x21c74b);})[_0x5e5b('0x25')](function(_0x4b54b0){_0x36b595[_0x5e5b('0x44')]=_0x4b54b0;return _0x36b595;})[_0x5e5b('0x25')](respondWithFilteredResult(_0x13ff91,_0x21c74b))[_0x5e5b('0x45')](handleError(_0x13ff91,null));};exports[_0x5e5b('0x46')]=function(_0x1659d5,_0xbe8b1d){var _0x371550={'raw':!![],'where':{'id':_0x1659d5[_0x5e5b('0x47')]['id']}},_0x24d81f={};_0x24d81f[_0x5e5b('0x34')]=_[_0x5e5b('0x32')](db['AnalyticTreeReport'][_0x5e5b('0x2d')]);_0x24d81f[_0x5e5b('0x31')]=_[_0x5e5b('0x32')](_0x1659d5['query']);_0x24d81f[_0x5e5b('0x33')]=_[_0x5e5b('0x36')](_0x24d81f['model'],_0x24d81f[_0x5e5b('0x31')]);_0x371550[_0x5e5b('0x35')]=_['intersection'](_0x24d81f[_0x5e5b('0x34')],qs['fields'](_0x1659d5['query']['fields']));_0x371550[_0x5e5b('0x35')]=_0x371550['attributes'][_0x5e5b('0x38')]?_0x371550['attributes']:_0x24d81f[_0x5e5b('0x34')];if(_0x1659d5[_0x5e5b('0x31')][_0x5e5b('0x48')]){_0x371550[_0x5e5b('0x43')]=[{'all':!![]}];}_0x371550=_[_0x5e5b('0x3f')]({},_0x371550,_0x1659d5[_0x5e5b('0x41')]);return db[_0x5e5b('0x2c')]['find'](_0x371550)['then'](handleEntityNotFound(_0xbe8b1d,null))[_0x5e5b('0x25')](respondWithResult(_0xbe8b1d,null))['catch'](handleError(_0xbe8b1d,null));};exports['create']=function(_0x4e83eb,_0x249922){return db['AnalyticTreeReport'][_0x5e5b('0x49')](_0x4e83eb[_0x5e5b('0x4a')],{})[_0x5e5b('0x25')](respondWithResult(_0x249922,0xc9))[_0x5e5b('0x45')](handleError(_0x249922,null));};exports[_0x5e5b('0x24')]=function(_0x192445,_0x4fd265){if(_0x192445[_0x5e5b('0x4a')]['id']){delete _0x192445[_0x5e5b('0x4a')]['id'];}return db['AnalyticTreeReport'][_0x5e5b('0x4b')]({'where':{'id':_0x192445['params']['id']}})[_0x5e5b('0x25')](handleEntityNotFound(_0x4fd265,null))[_0x5e5b('0x25')](saveUpdates(_0x192445[_0x5e5b('0x4a')],null))[_0x5e5b('0x25')](respondWithResult(_0x4fd265,null))['catch'](handleError(_0x4fd265,null));};exports[_0x5e5b('0x26')]=function(_0x1c4efe,_0x4f4ea3){return db[_0x5e5b('0x2c')][_0x5e5b('0x4b')]({'where':{'id':_0x1c4efe[_0x5e5b('0x47')]['id']}})[_0x5e5b('0x25')](handleEntityNotFound(_0x4f4ea3,null))[_0x5e5b('0x25')](removeEntity(_0x4f4ea3,null))[_0x5e5b('0x45')](handleError(_0x4f4ea3,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 1cae187..de48c18 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 _0x7382=['AnalyticTreeReport','util','path','rimraf','../../config/environment','./analyticTreeReport.attributes','exports','define'];(function(_0x11e8fa,_0x1edbc3){var _0xd1ddde=function(_0x454b37){while(--_0x454b37){_0x11e8fa['push'](_0x11e8fa['shift']());}};_0xd1ddde(++_0x1edbc3);}(_0x7382,0x111));var _0x2738=function(_0x328fc8,_0x7d633a){_0x328fc8=_0x328fc8-0x0;var _0x2ba955=_0x7382[_0x328fc8];return _0x2ba955;};'use strict';var _=require('lodash');var util=require(_0x2738('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x2738('0x1'));var rimraf=require(_0x2738('0x2'));var config=require(_0x2738('0x3'));var attributes=require(_0x2738('0x4'));module[_0x2738('0x5')]=function(_0x5bb77c,_0x1958d2){return _0x5bb77c[_0x2738('0x6')](_0x2738('0x7'),attributes,{'tableName':'analytics_report_trees','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc74c=['exports','AnalyticTreeReport','analytics_report_trees','lodash','util','moment','bluebird','path','rimraf','../../config/environment','./analyticTreeReport.attributes'];(function(_0x5a6761,_0x180bb4){var _0x2ba5e9=function(_0x36a404){while(--_0x36a404){_0x5a6761['push'](_0x5a6761['shift']());}};_0x2ba5e9(++_0x180bb4);}(_0xc74c,0x163));var _0xcc74=function(_0x135e93,_0xe4942b){_0x135e93=_0x135e93-0x0;var _0x42515e=_0xc74c[_0x135e93];return _0x42515e;};'use strict';var _=require(_0xcc74('0x0'));var util=require(_0xcc74('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xcc74('0x2'));var BPromise=require(_0xcc74('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcc74('0x4'));var rimraf=require(_0xcc74('0x5'));var config=require(_0xcc74('0x6'));var attributes=require(_0xcc74('0x7'));module[_0xcc74('0x8')]=function(_0x23c249,_0x425b73){return _0x23c249['define'](_0xcc74('0x9'),attributes,{'tableName':_0xcc74('0xa'),'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 e143a5e..c9b5261 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 _0xd31d=['../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x2e904a,_0x50c221){var _0x153445=function(_0x2d1d1e){while(--_0x2d1d1e){_0x2e904a['push'](_0x2e904a['shift']());}};_0x153445(++_0x50c221);}(_0xd31d,0x84));var _0xdd31=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0xd31d[_0x9aada2];return _0x196dff;};'use strict';var _=require(_0xdd31('0x0'));var util=require(_0xdd31('0x1'));var moment=require(_0xdd31('0x2'));var BPromise=require('bluebird');var rs=require(_0xdd31('0x3'));var fs=require('fs');var Redis=require(_0xdd31('0x4'));var db=require(_0xdd31('0x5'))['db'];var utils=require(_0xdd31('0x6'));var logger=require('../../config/logger')(_0xdd31('0x7'));var config=require(_0xdd31('0x8'));var jayson=require(_0xdd31('0x9'));var client=jayson[_0xdd31('0xa')][_0xdd31('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x528b39,_0x156053,_0x34d697){return new BPromise(function(_0x1f3bb9,_0x2e94ff){return client[_0xdd31('0xc')](_0x528b39,_0x34d697)['then'](function(_0x587cf5){logger[_0xdd31('0xd')](_0xdd31('0xe'),_0x156053,_0xdd31('0xf'));logger[_0xdd31('0x10')](_0xdd31('0x11'),_0x156053,_0xdd31('0xf'),JSON[_0xdd31('0x12')](_0x587cf5));if(_0x587cf5[_0xdd31('0x13')]){if(_0x587cf5[_0xdd31('0x13')][_0xdd31('0x14')]===0x1f4){logger[_0xdd31('0x13')](_0xdd31('0xe'),_0x156053,_0x587cf5['error'][_0xdd31('0x15')]);return _0x2e94ff(_0x587cf5[_0xdd31('0x13')][_0xdd31('0x15')]);}logger[_0xdd31('0x13')](_0xdd31('0xe'),_0x156053,_0x587cf5[_0xdd31('0x13')][_0xdd31('0x15')]);return _0x1f3bb9(_0x587cf5['error'][_0xdd31('0x15')]);}else{logger[_0xdd31('0xd')](_0xdd31('0xe'),_0x156053,'request\x20sent');_0x1f3bb9(_0x587cf5[_0xdd31('0x16')][_0xdd31('0x15')]);}})['catch'](function(_0x4a91d1){logger[_0xdd31('0x13')](_0xdd31('0xe'),_0x156053,_0x4a91d1);_0x2e94ff(_0x4a91d1);});});} \ No newline at end of file +var _0xbe94=['http','then','info','AnalyticTreeReport,\x20%s,\x20%s','error','code','message','request\x20sent','result','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','client'];(function(_0x4c6025,_0x2bcef9){var _0x49d25b=function(_0x4e16d7){while(--_0x4e16d7){_0x4c6025['push'](_0x4c6025['shift']());}};_0x49d25b(++_0x2bcef9);}(_0xbe94,0x1c9));var _0x4be9=function(_0x2ce92d,_0x31aa5e){_0x2ce92d=_0x2ce92d-0x0;var _0x3feeaf=_0xbe94[_0x2ce92d];return _0x3feeaf;};'use strict';var _=require(_0x4be9('0x0'));var util=require('util');var moment=require(_0x4be9('0x1'));var BPromise=require(_0x4be9('0x2'));var rs=require(_0x4be9('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4be9('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x4be9('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4be9('0x6')][_0x4be9('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2e4083,_0x2226a8,_0x222df8){return new BPromise(function(_0x36babf,_0x3e7083){return client['request'](_0x2e4083,_0x222df8)[_0x4be9('0x8')](function(_0x590101){logger[_0x4be9('0x9')](_0x4be9('0xa'),_0x2226a8,'request\x20sent');logger['debug']('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x2226a8,'request\x20sent',JSON['stringify'](_0x590101));if(_0x590101[_0x4be9('0xb')]){if(_0x590101[_0x4be9('0xb')][_0x4be9('0xc')]===0x1f4){logger[_0x4be9('0xb')](_0x4be9('0xa'),_0x2226a8,_0x590101['error'][_0x4be9('0xd')]);return _0x3e7083(_0x590101[_0x4be9('0xb')][_0x4be9('0xd')]);}logger[_0x4be9('0xb')](_0x4be9('0xa'),_0x2226a8,_0x590101[_0x4be9('0xb')][_0x4be9('0xd')]);return _0x36babf(_0x590101[_0x4be9('0xb')]['message']);}else{logger[_0x4be9('0x9')]('AnalyticTreeReport,\x20%s,\x20%s',_0x2226a8,_0x4be9('0xe'));_0x36babf(_0x590101[_0x4be9('0xf')][_0x4be9('0xd')]);}})['catch'](function(_0x5ec1c6){logger[_0x4be9('0xb')](_0x4be9('0xa'),_0x2226a8,_0x5ec1c6);_0x3e7083(_0x5ec1c6);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index 7c2eab1..92db0bd 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 _0x2aaf=['Router','../../components/auth/service','./analyticTreeReport.controller','get','isAuthenticated','/:id','show','put','update','delete','destroy','multer','util','path','express'];(function(_0x27fad1,_0x1e26c1){var _0x3edb5e=function(_0x131e88){while(--_0x131e88){_0x27fad1['push'](_0x27fad1['shift']());}};_0x3edb5e(++_0x1e26c1);}(_0x2aaf,0xce));var _0xf2aa=function(_0x33ee9c,_0x4b36cd){_0x33ee9c=_0x33ee9c-0x0;var _0x118541=_0x2aaf[_0x33ee9c];return _0x118541;};'use strict';var multer=require(_0xf2aa('0x0'));var util=require(_0xf2aa('0x1'));var path=require(_0xf2aa('0x2'));var timeout=require('connect-timeout');var express=require(_0xf2aa('0x3'));var router=express[_0xf2aa('0x4')]();var auth=require(_0xf2aa('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf2aa('0x6'));router[_0xf2aa('0x7')]('/',auth[_0xf2aa('0x8')](),controller['index']);router['get'](_0xf2aa('0x9'),auth[_0xf2aa('0x8')](),controller[_0xf2aa('0xa')]);router['post']('/',auth[_0xf2aa('0x8')](),controller['create']);router[_0xf2aa('0xb')](_0xf2aa('0x9'),auth['isAuthenticated'](),controller[_0xf2aa('0xc')]);router[_0xf2aa('0xd')](_0xf2aa('0x9'),auth[_0xf2aa('0x8')](),controller[_0xf2aa('0xe')]);module['exports']=router; \ No newline at end of file +var _0x5e56=['get','isAuthenticated','index','show','post','create','put','/:id','update','delete','multer','util','connect-timeout','Router','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x5e56,0xe7));var _0x65e5=function(_0x8e20ce,_0x46eee7){_0x8e20ce=_0x8e20ce-0x0;var _0x2571a2=_0x5e56[_0x8e20ce];return _0x2571a2;};'use strict';var multer=require(_0x65e5('0x0'));var util=require(_0x65e5('0x1'));var path=require('path');var timeout=require(_0x65e5('0x2'));var express=require('express');var router=express[_0x65e5('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x65e5('0x4'));var config=require(_0x65e5('0x5'));var controller=require(_0x65e5('0x6'));router[_0x65e5('0x7')]('/',auth[_0x65e5('0x8')](),controller[_0x65e5('0x9')]);router[_0x65e5('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x65e5('0xa')]);router[_0x65e5('0xb')]('/',auth['isAuthenticated'](),controller[_0x65e5('0xc')]);router[_0x65e5('0xd')](_0x65e5('0xe'),auth[_0x65e5('0x8')](),controller[_0x65e5('0xf')]);router[_0x65e5('0x10')](_0x65e5('0xe'),auth[_0x65e5('0x8')](),controller['destroy']);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 738a774..79583ff 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 _0xbcc5=['exports','STRING','sequelize'];(function(_0x19afe9,_0x3072d5){var _0x27644e=function(_0x1f9f80){while(--_0x1f9f80){_0x19afe9['push'](_0x19afe9['shift']());}};_0x27644e(++_0x3072d5);}(_0xbcc5,0x7d));var _0x5bcc=function(_0x19f790,_0x1d65fd){_0x19f790=_0x19f790-0x0;var _0x3f3bc7=_0xbcc5[_0x19f790];return _0x3f3bc7;};'use strict';var Sequelize=require(_0x5bcc('0x0'));module[_0x5bcc('0x1')]={'name':{'type':Sequelize[_0x5bcc('0x2')]},'basename':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x4e26=['exports','STRING','sequelize'];(function(_0x44714c,_0x2ac454){var _0x57d4d5=function(_0x5aca44){while(--_0x5aca44){_0x44714c['push'](_0x44714c['shift']());}};_0x57d4d5(++_0x2ac454);}(_0x4e26,0x1af));var _0x64e2=function(_0x35ed36,_0x1aeae6){_0x35ed36=_0x35ed36-0x0;var _0x71392f=_0x4e26[_0x35ed36];return _0x71392f;};'use strict';var Sequelize=require(_0x64e2('0x0'));module[_0x64e2('0x1')]={'name':{'type':Sequelize[_0x64e2('0x2')]},'basename':{'type':Sequelize[_0x64e2('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 56f6970..c3b87b4 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 _0x01ff=['include','findAll','catch','show','params','keys','omit','updatedAt','body','create','find','file','originalname','basename','filename','mimetype','download','findOne','join','root','server/files/attachments/','html-pdf','eml-format','request-promise','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','offset','limit','Content-Range','apply','update','then','destroy','end','error','stack','name','index','map','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','options','Attachment','count','includeAll'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x01ff,0x1dd));var _0xf01f=function(_0xc9c94b,_0x27a331){_0xc9c94b=_0xc9c94b-0x0;var _0x40b439=_0x01ff[_0xc9c94b];return _0x40b439;};'use strict';var pdf=require(_0xf01f('0x0'));var emlformat=require(_0xf01f('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xf01f('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xf01f('0x3'));var path=require('path');var sox=require(_0xf01f('0x4'));var csv=require(_0xf01f('0x5'));var ejs=require(_0xf01f('0x6'));var fs=require('fs');var _=require(_0xf01f('0x7'));var squel=require(_0xf01f('0x8'));var crypto=require(_0xf01f('0x9'));var jsforce=require(_0xf01f('0xa'));var deskjs=require(_0xf01f('0xb'));var toCsv=require(_0xf01f('0x5'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xf01f('0xc'));var qs=require(_0xf01f('0xd'));var as=require(_0xf01f('0xe'));var hardwareService=require(_0xf01f('0xf'));var logger=require(_0xf01f('0x10'))(_0xf01f('0x11'));var utils=require(_0xf01f('0x12'));var config=require('../../config/environment');var db=require(_0xf01f('0x13'))['db'];function respondWithStatusCode(_0x9b9fd6,_0x505e96){_0x505e96=_0x505e96||0xcc;return function(_0x5781c1){if(_0x5781c1){return _0x9b9fd6[_0xf01f('0x14')](_0x505e96);}return _0x9b9fd6[_0xf01f('0x15')](_0x505e96)['end']();};}function respondWithResult(_0x363fd1,_0x2c5cf6){_0x2c5cf6=_0x2c5cf6||0xc8;return function(_0x4e2f37){if(_0x4e2f37){return _0x363fd1[_0xf01f('0x15')](_0x2c5cf6)[_0xf01f('0x16')](_0x4e2f37);}};}function respondWithFilteredResult(_0x3757e5,_0x108ef9){return function(_0x288262){if(_0x288262){var _0x1cf424=_0x288262['count'],_0x542ed5=_0x108ef9[_0xf01f('0x17')],_0x290928=_0x108ef9['offset']+_0x108ef9[_0xf01f('0x18')],_0x1164cb;if(_0x290928>=_0x1cf424){_0x290928=_0x1cf424;_0x1164cb=0xc8;}else{_0x1164cb=0xce;}_0x3757e5[_0xf01f('0x15')](_0x1164cb);return _0x3757e5['set'](_0xf01f('0x19'),_0x542ed5+'-'+_0x290928+'/'+_0x1cf424)[_0xf01f('0x16')](_0x288262);}return null;};}function patchUpdates(_0x48a3ac){return function(_0x3eab17){try{jsonpatch[_0xf01f('0x1a')](_0x3eab17,_0x48a3ac,!![]);}catch(_0x523021){return BPromise['reject'](_0x523021);}return _0x3eab17['save']();};}function saveUpdates(_0x16c130,_0x1a1563){return function(_0x42bdd7){if(_0x42bdd7){return _0x42bdd7[_0xf01f('0x1b')](_0x16c130)[_0xf01f('0x1c')](function(_0x465d5f){return _0x465d5f;});}return null;};}function removeEntity(_0x5cd5ab,_0x47e99f){return function(_0x3f9851){if(_0x3f9851){return _0x3f9851[_0xf01f('0x1d')]()[_0xf01f('0x1c')](function(){_0x5cd5ab['status'](0xcc)[_0xf01f('0x1e')]();});}};}function handleEntityNotFound(_0x5e7e6b,_0x17daa4){return function(_0x1fe5f8){if(!_0x1fe5f8){_0x5e7e6b[_0xf01f('0x14')](0x194);}return _0x1fe5f8;};}function handleError(_0x8c4a4b,_0x2980b8){_0x2980b8=_0x2980b8||0x1f4;return function(_0x4e68b5){logger[_0xf01f('0x1f')](_0x4e68b5[_0xf01f('0x20')]);if(_0x4e68b5[_0xf01f('0x21')]){delete _0x4e68b5[_0xf01f('0x21')];}_0x8c4a4b[_0xf01f('0x15')](_0x2980b8)['send'](_0x4e68b5);};}exports[_0xf01f('0x22')]=function(_0x52c6a4,_0x492ffc){var _0x4fdec0={},_0x248522={},_0x3aaaa3={'count':0x0,'rows':[]};var _0x298a0d=_[_0xf01f('0x23')](db['Attachment']['rawAttributes'],function(_0x194b50){return{'name':_0x194b50[_0xf01f('0x24')],'type':_0x194b50[_0xf01f('0x25')]['key']};});_0x248522[_0xf01f('0x26')]=_[_0xf01f('0x23')](_0x298a0d,'name');_0x248522[_0xf01f('0x27')]=_['keys'](_0x52c6a4[_0xf01f('0x27')]);_0x248522[_0xf01f('0x28')]=_[_0xf01f('0x29')](_0x248522['model'],_0x248522['query']);_0x4fdec0[_0xf01f('0x2a')]=_[_0xf01f('0x29')](_0x248522[_0xf01f('0x26')],qs[_0xf01f('0x2b')](_0x52c6a4[_0xf01f('0x27')][_0xf01f('0x2b')]));_0x4fdec0['attributes']=_0x4fdec0['attributes'][_0xf01f('0x2c')]?_0x4fdec0[_0xf01f('0x2a')]:_0x248522[_0xf01f('0x26')];if(!_0x52c6a4[_0xf01f('0x27')][_0xf01f('0x2d')]('nolimit')){_0x4fdec0[_0xf01f('0x18')]=qs[_0xf01f('0x18')](_0x52c6a4[_0xf01f('0x27')][_0xf01f('0x18')]);_0x4fdec0[_0xf01f('0x17')]=qs[_0xf01f('0x17')](_0x52c6a4['query'][_0xf01f('0x17')]);}_0x4fdec0[_0xf01f('0x2e')]=qs[_0xf01f('0x2f')](_0x52c6a4[_0xf01f('0x27')][_0xf01f('0x2f')]);_0x4fdec0[_0xf01f('0x30')]=qs[_0xf01f('0x28')](_['pick'](_0x52c6a4[_0xf01f('0x27')],_0x248522[_0xf01f('0x28')]));if(_0x52c6a4['query'][_0xf01f('0x31')]){_0x4fdec0[_0xf01f('0x30')]=_[_0xf01f('0x32')](_0x4fdec0[_0xf01f('0x30')],{'$or':_[_0xf01f('0x23')](_0x298a0d,function(_0x52ba4c){if(_0x52ba4c['type']!=='VIRTUAL'){var _0x44cc2b={};_0x44cc2b[_0x52ba4c['name']]={'$like':'%'+_0x52c6a4[_0xf01f('0x27')][_0xf01f('0x31')]+'%'};return _0x44cc2b;}})});}_0x4fdec0=_[_0xf01f('0x32')]({},_0x4fdec0,_0x52c6a4[_0xf01f('0x33')]);var _0x56e0f4={'where':_0x4fdec0[_0xf01f('0x30')]};return db[_0xf01f('0x34')][_0xf01f('0x35')](_0x56e0f4)[_0xf01f('0x1c')](function(_0x29df28){_0x3aaaa3[_0xf01f('0x35')]=_0x29df28;if(_0x52c6a4[_0xf01f('0x27')][_0xf01f('0x36')]){_0x4fdec0[_0xf01f('0x37')]=[{'all':!![]}];}return db['Attachment'][_0xf01f('0x38')](_0x4fdec0);})[_0xf01f('0x1c')](function(_0x3957b7){_0x3aaaa3['rows']=_0x3957b7;return _0x3aaaa3;})['then'](respondWithFilteredResult(_0x492ffc,_0x4fdec0))[_0xf01f('0x39')](handleError(_0x492ffc,null));};exports[_0xf01f('0x3a')]=function(_0x5fd325,_0x6f4382){var _0xa3cd92={'raw':!![],'where':{'id':_0x5fd325['params']['id']}},_0x1e165c={};_0x1e165c[_0xf01f('0x26')]=_['keys'](db[_0xf01f('0x34')]['rawAttributes']);_0x1e165c[_0xf01f('0x27')]=_['keys'](_0x5fd325['query']);_0x1e165c[_0xf01f('0x28')]=_[_0xf01f('0x29')](_0x1e165c[_0xf01f('0x26')],_0x1e165c['query']);_0xa3cd92[_0xf01f('0x2a')]=_[_0xf01f('0x29')](_0x1e165c['model'],qs[_0xf01f('0x2b')](_0x5fd325[_0xf01f('0x27')][_0xf01f('0x2b')]));_0xa3cd92[_0xf01f('0x2a')]=_0xa3cd92[_0xf01f('0x2a')][_0xf01f('0x2c')]?_0xa3cd92[_0xf01f('0x2a')]:_0x1e165c[_0xf01f('0x26')];if(_0x5fd325['query'][_0xf01f('0x36')]){_0xa3cd92[_0xf01f('0x37')]=[{'all':!![]}];}_0xa3cd92=_[_0xf01f('0x32')]({},_0xa3cd92,_0x5fd325['options']);return db[_0xf01f('0x34')]['find'](_0xa3cd92)[_0xf01f('0x1c')](handleEntityNotFound(_0x6f4382,null))['then'](respondWithResult(_0x6f4382,null))['catch'](handleError(_0x6f4382,null));};exports['clone']=function(_0x3f9bbe,_0x582fa0){var _0x4ec348={'where':{'id':_0x3f9bbe[_0xf01f('0x3b')]['id']}},_0x5bbaae={};_0x5bbaae[_0xf01f('0x26')]=_[_0xf01f('0x3c')](db['Attachment']['rawAttributes']);_0x4ec348['attributes']=_[_0xf01f('0x29')](_0x5bbaae[_0xf01f('0x26')],qs['fields'](_0x3f9bbe[_0xf01f('0x27')]['fields']));_0x4ec348[_0xf01f('0x2a')]=_0x4ec348[_0xf01f('0x2a')][_0xf01f('0x2c')]?_0x4ec348[_0xf01f('0x2a')]:_0x5bbaae[_0xf01f('0x26')];if(_0x3f9bbe[_0xf01f('0x27')][_0xf01f('0x36')]){_0x4ec348[_0xf01f('0x37')]=[{'all':!![]}];}_0x4ec348=_[_0xf01f('0x32')]({},_0x4ec348,_0x3f9bbe['options']);return db[_0xf01f('0x34')]['find'](_0x4ec348)['then'](handleEntityNotFound(_0x582fa0,null))[_0xf01f('0x1c')](function(_0x2a4c31){if(_0x2a4c31){var _0x17f752=_0x2a4c31['get']({'plain':!![]});_0x17f752=qs[_0xf01f('0x3d')](_0x17f752,['id','createdAt',_0xf01f('0x3e')]);_0x3f9bbe[_0xf01f('0x3f')]=_[_0xf01f('0x3d')](_0x3f9bbe['body'],['id','createdAt','updatedAt']);return db['Attachment'][_0xf01f('0x40')](_[_0xf01f('0x32')](_0x17f752,_0x3f9bbe[_0xf01f('0x3f')]),{'include':_0x3f9bbe['query'][_0xf01f('0x36')]?[{'all':!![]}]:undefined});}})['then'](respondWithResult(_0x582fa0,0xc9))['catch'](handleError(_0x582fa0,null));};exports[_0xf01f('0x1b')]=function(_0x594c7c,_0x12a9a3){if(_0x594c7c[_0xf01f('0x3f')]['id']){delete _0x594c7c[_0xf01f('0x3f')]['id'];}return db['Attachment'][_0xf01f('0x41')]({'where':{'id':_0x594c7c[_0xf01f('0x3b')]['id']}})['then'](handleEntityNotFound(_0x12a9a3,null))[_0xf01f('0x1c')](saveUpdates(_0x594c7c[_0xf01f('0x3f')],null))[_0xf01f('0x1c')](respondWithResult(_0x12a9a3,null))[_0xf01f('0x39')](handleError(_0x12a9a3,null));};exports[_0xf01f('0x1d')]=function(_0x1920aa,_0x98c4be){return db['Attachment'][_0xf01f('0x41')]({'where':{'id':_0x1920aa['params']['id']}})[_0xf01f('0x1c')](handleEntityNotFound(_0x98c4be,null))[_0xf01f('0x1c')](removeEntity(_0x98c4be,null))[_0xf01f('0x39')](handleError(_0x98c4be,null));};exports[_0xf01f('0x40')]=function(_0x5f37f6,_0x2912c2,_0x17543b){_0x5f37f6['body']['name']=_0x5f37f6[_0xf01f('0x42')][_0xf01f('0x43')];_0x5f37f6[_0xf01f('0x3f')][_0xf01f('0x44')]=_0x5f37f6[_0xf01f('0x42')][_0xf01f('0x45')];_0x5f37f6['body'][_0xf01f('0x25')]=_0x5f37f6[_0xf01f('0x42')][_0xf01f('0x46')];return db[_0xf01f('0x34')][_0xf01f('0x40')](_0x5f37f6[_0xf01f('0x3f')])['then'](respondWithResult(_0x2912c2,0xc9))[_0xf01f('0x39')](handleError(_0x2912c2,null));};exports[_0xf01f('0x47')]=function(_0x4bf9b7,_0x286f04,_0x3fdc82){return db[_0xf01f('0x34')][_0xf01f('0x48')]({'where':{'id':_0x4bf9b7[_0xf01f('0x3b')]['id']},'raw':!![]})[_0xf01f('0x1c')](handleEntityNotFound(_0x286f04,null))[_0xf01f('0x1c')](function(_0x4424f4){if(_0x4424f4){return _0x286f04[_0xf01f('0x47')](path[_0xf01f('0x49')](config[_0xf01f('0x4a')],_0xf01f('0x4b'),_0x4424f4[_0xf01f('0x44')]));}})[_0xf01f('0x39')](handleError(_0x286f04,null));}; \ No newline at end of file +var _0x1412=['server/files/attachments/','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','reject','save','update','then','stack','name','send','map','Attachment','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','findAll','rows','catch','show','params','includeAll','include','clone','options','find','omit','createdAt','body','updatedAt','create','destroy','file','originalname','basename','mimetype','download','findOne','join','root'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x1412,0x155));var _0x2141=function(_0x4de846,_0x45ce1f){_0x4de846=_0x4de846-0x0;var _0xba0d5e=_0x1412[_0x4de846];return _0xba0d5e;};'use strict';var pdf=require(_0x2141('0x0'));var emlformat=require(_0x2141('0x1'));var rimraf=require(_0x2141('0x2'));var zipdir=require(_0x2141('0x3'));var jsonpatch=require(_0x2141('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x2141('0x5'));var Mustache=require('mustache');var util=require(_0x2141('0x6'));var path=require(_0x2141('0x7'));var sox=require(_0x2141('0x8'));var csv=require(_0x2141('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x2141('0xa'));var squel=require(_0x2141('0xb'));var crypto=require(_0x2141('0xc'));var jsforce=require(_0x2141('0xd'));var deskjs=require(_0x2141('0xe'));var toCsv=require(_0x2141('0x9'));var querystring=require(_0x2141('0xf'));var Papa=require('papaparse');var Redis=require(_0x2141('0x10'));var authService=require(_0x2141('0x11'));var qs=require(_0x2141('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2141('0x13'));var logger=require('../../config/logger')(_0x2141('0x14'));var utils=require(_0x2141('0x15'));var config=require(_0x2141('0x16'));var db=require(_0x2141('0x17'))['db'];function respondWithStatusCode(_0x5d72d6,_0x257836){_0x257836=_0x257836||0xcc;return function(_0x5b6643){if(_0x5b6643){return _0x5d72d6[_0x2141('0x18')](_0x257836);}return _0x5d72d6['status'](_0x257836)[_0x2141('0x19')]();};}function respondWithResult(_0x1bb507,_0x4d175f){_0x4d175f=_0x4d175f||0xc8;return function(_0x431611){if(_0x431611){return _0x1bb507[_0x2141('0x1a')](_0x4d175f)[_0x2141('0x1b')](_0x431611);}};}function respondWithFilteredResult(_0x390f6c,_0x15eff7){return function(_0x4d30ed){if(_0x4d30ed){var _0x44ff04=_0x4d30ed[_0x2141('0x1c')],_0x1df536=_0x15eff7[_0x2141('0x1d')],_0x5a1411=_0x15eff7[_0x2141('0x1d')]+_0x15eff7[_0x2141('0x1e')],_0x2be253;if(_0x5a1411>=_0x44ff04){_0x5a1411=_0x44ff04;_0x2be253=0xc8;}else{_0x2be253=0xce;}_0x390f6c[_0x2141('0x1a')](_0x2be253);return _0x390f6c[_0x2141('0x1f')]('Content-Range',_0x1df536+'-'+_0x5a1411+'/'+_0x44ff04)[_0x2141('0x1b')](_0x4d30ed);}return null;};}function patchUpdates(_0x11c6dd){return function(_0x313a14){try{jsonpatch['apply'](_0x313a14,_0x11c6dd,!![]);}catch(_0x3a2a04){return BPromise[_0x2141('0x20')](_0x3a2a04);}return _0x313a14[_0x2141('0x21')]();};}function saveUpdates(_0x31597a,_0x256578){return function(_0x1afb91){if(_0x1afb91){return _0x1afb91[_0x2141('0x22')](_0x31597a)['then'](function(_0x337fcb){return _0x337fcb;});}return null;};}function removeEntity(_0x2f3797,_0x4685af){return function(_0x1f3c41){if(_0x1f3c41){return _0x1f3c41['destroy']()[_0x2141('0x23')](function(){_0x2f3797[_0x2141('0x1a')](0xcc)[_0x2141('0x19')]();});}};}function handleEntityNotFound(_0x2d1df1,_0x598b8e){return function(_0x1801c7){if(!_0x1801c7){_0x2d1df1[_0x2141('0x18')](0x194);}return _0x1801c7;};}function handleError(_0x32b09d,_0x33bc07){_0x33bc07=_0x33bc07||0x1f4;return function(_0x872ae8){logger['error'](_0x872ae8[_0x2141('0x24')]);if(_0x872ae8[_0x2141('0x25')]){delete _0x872ae8['name'];}_0x32b09d['status'](_0x33bc07)[_0x2141('0x26')](_0x872ae8);};}exports['index']=function(_0x58e03e,_0x52dacb){var _0x2f22d6={},_0x2635c4={},_0x4eb306={'count':0x0,'rows':[]};var _0x34a666=_[_0x2141('0x27')](db[_0x2141('0x28')][_0x2141('0x29')],function(_0x82fd49){return{'name':_0x82fd49[_0x2141('0x2a')],'type':_0x82fd49[_0x2141('0x2b')][_0x2141('0x2c')]};});_0x2635c4[_0x2141('0x2d')]=_[_0x2141('0x27')](_0x34a666,_0x2141('0x25'));_0x2635c4[_0x2141('0x2e')]=_[_0x2141('0x2f')](_0x58e03e[_0x2141('0x2e')]);_0x2635c4[_0x2141('0x30')]=_[_0x2141('0x31')](_0x2635c4[_0x2141('0x2d')],_0x2635c4[_0x2141('0x2e')]);_0x2f22d6[_0x2141('0x32')]=_['intersection'](_0x2635c4[_0x2141('0x2d')],qs[_0x2141('0x33')](_0x58e03e[_0x2141('0x2e')][_0x2141('0x33')]));_0x2f22d6[_0x2141('0x32')]=_0x2f22d6[_0x2141('0x32')][_0x2141('0x34')]?_0x2f22d6['attributes']:_0x2635c4[_0x2141('0x2d')];if(!_0x58e03e[_0x2141('0x2e')]['hasOwnProperty'](_0x2141('0x35'))){_0x2f22d6[_0x2141('0x1e')]=qs[_0x2141('0x1e')](_0x58e03e[_0x2141('0x2e')]['limit']);_0x2f22d6['offset']=qs[_0x2141('0x1d')](_0x58e03e[_0x2141('0x2e')][_0x2141('0x1d')]);}_0x2f22d6[_0x2141('0x36')]=qs[_0x2141('0x37')](_0x58e03e[_0x2141('0x2e')]['sort']);_0x2f22d6[_0x2141('0x38')]=qs[_0x2141('0x30')](_['pick'](_0x58e03e['query'],_0x2635c4[_0x2141('0x30')]));if(_0x58e03e['query'][_0x2141('0x39')]){_0x2f22d6[_0x2141('0x38')]=_[_0x2141('0x3a')](_0x2f22d6[_0x2141('0x38')],{'$or':_[_0x2141('0x27')](_0x34a666,function(_0x403168){if(_0x403168[_0x2141('0x2b')]!==_0x2141('0x3b')){var _0xa485d8={};_0xa485d8[_0x403168['name']]={'$like':'%'+_0x58e03e[_0x2141('0x2e')][_0x2141('0x39')]+'%'};return _0xa485d8;}})});}_0x2f22d6=_[_0x2141('0x3a')]({},_0x2f22d6,_0x58e03e['options']);var _0x1fb113={'where':_0x2f22d6[_0x2141('0x38')]};return db[_0x2141('0x28')]['count'](_0x1fb113)[_0x2141('0x23')](function(_0x131244){_0x4eb306['count']=_0x131244;if(_0x58e03e['query']['includeAll']){_0x2f22d6['include']=[{'all':!![]}];}return db[_0x2141('0x28')][_0x2141('0x3c')](_0x2f22d6);})[_0x2141('0x23')](function(_0x383f16){_0x4eb306[_0x2141('0x3d')]=_0x383f16;return _0x4eb306;})[_0x2141('0x23')](respondWithFilteredResult(_0x52dacb,_0x2f22d6))[_0x2141('0x3e')](handleError(_0x52dacb,null));};exports[_0x2141('0x3f')]=function(_0x502e97,_0x1f816f){var _0xfc0cb1={'raw':!![],'where':{'id':_0x502e97[_0x2141('0x40')]['id']}},_0x45ad69={};_0x45ad69[_0x2141('0x2d')]=_[_0x2141('0x2f')](db[_0x2141('0x28')][_0x2141('0x29')]);_0x45ad69[_0x2141('0x2e')]=_[_0x2141('0x2f')](_0x502e97[_0x2141('0x2e')]);_0x45ad69[_0x2141('0x30')]=_[_0x2141('0x31')](_0x45ad69[_0x2141('0x2d')],_0x45ad69[_0x2141('0x2e')]);_0xfc0cb1['attributes']=_[_0x2141('0x31')](_0x45ad69['model'],qs[_0x2141('0x33')](_0x502e97[_0x2141('0x2e')][_0x2141('0x33')]));_0xfc0cb1[_0x2141('0x32')]=_0xfc0cb1[_0x2141('0x32')]['length']?_0xfc0cb1[_0x2141('0x32')]:_0x45ad69[_0x2141('0x2d')];if(_0x502e97['query'][_0x2141('0x41')]){_0xfc0cb1[_0x2141('0x42')]=[{'all':!![]}];}_0xfc0cb1=_[_0x2141('0x3a')]({},_0xfc0cb1,_0x502e97['options']);return db[_0x2141('0x28')]['find'](_0xfc0cb1)[_0x2141('0x23')](handleEntityNotFound(_0x1f816f,null))[_0x2141('0x23')](respondWithResult(_0x1f816f,null))[_0x2141('0x3e')](handleError(_0x1f816f,null));};exports[_0x2141('0x43')]=function(_0x318ba6,_0xf2b787){var _0x101d1c={'where':{'id':_0x318ba6[_0x2141('0x40')]['id']}},_0x46ab67={};_0x46ab67[_0x2141('0x2d')]=_[_0x2141('0x2f')](db[_0x2141('0x28')][_0x2141('0x29')]);_0x101d1c[_0x2141('0x32')]=_['intersection'](_0x46ab67[_0x2141('0x2d')],qs[_0x2141('0x33')](_0x318ba6[_0x2141('0x2e')][_0x2141('0x33')]));_0x101d1c[_0x2141('0x32')]=_0x101d1c[_0x2141('0x32')]['length']?_0x101d1c[_0x2141('0x32')]:_0x46ab67[_0x2141('0x2d')];if(_0x318ba6[_0x2141('0x2e')][_0x2141('0x41')]){_0x101d1c[_0x2141('0x42')]=[{'all':!![]}];}_0x101d1c=_[_0x2141('0x3a')]({},_0x101d1c,_0x318ba6[_0x2141('0x44')]);return db[_0x2141('0x28')][_0x2141('0x45')](_0x101d1c)['then'](handleEntityNotFound(_0xf2b787,null))[_0x2141('0x23')](function(_0x2a2372){if(_0x2a2372){var _0x5ba6ab=_0x2a2372['get']({'plain':!![]});_0x5ba6ab=qs[_0x2141('0x46')](_0x5ba6ab,['id',_0x2141('0x47'),'updatedAt']);_0x318ba6[_0x2141('0x48')]=_[_0x2141('0x46')](_0x318ba6[_0x2141('0x48')],['id',_0x2141('0x47'),_0x2141('0x49')]);return db[_0x2141('0x28')][_0x2141('0x4a')](_[_0x2141('0x3a')](_0x5ba6ab,_0x318ba6[_0x2141('0x48')]),{'include':_0x318ba6[_0x2141('0x2e')]['includeAll']?[{'all':!![]}]:undefined});}})[_0x2141('0x23')](respondWithResult(_0xf2b787,0xc9))[_0x2141('0x3e')](handleError(_0xf2b787,null));};exports[_0x2141('0x22')]=function(_0x5ba112,_0x2f8641){if(_0x5ba112['body']['id']){delete _0x5ba112['body']['id'];}return db[_0x2141('0x28')][_0x2141('0x45')]({'where':{'id':_0x5ba112['params']['id']}})[_0x2141('0x23')](handleEntityNotFound(_0x2f8641,null))[_0x2141('0x23')](saveUpdates(_0x5ba112['body'],null))[_0x2141('0x23')](respondWithResult(_0x2f8641,null))[_0x2141('0x3e')](handleError(_0x2f8641,null));};exports[_0x2141('0x4b')]=function(_0xb68473,_0x1e863e){return db['Attachment']['find']({'where':{'id':_0xb68473[_0x2141('0x40')]['id']}})[_0x2141('0x23')](handleEntityNotFound(_0x1e863e,null))[_0x2141('0x23')](removeEntity(_0x1e863e,null))[_0x2141('0x3e')](handleError(_0x1e863e,null));};exports[_0x2141('0x4a')]=function(_0x2d4617,_0x5dab5b,_0x33df6a){_0x2d4617[_0x2141('0x48')]['name']=_0x2d4617[_0x2141('0x4c')][_0x2141('0x4d')];_0x2d4617[_0x2141('0x48')][_0x2141('0x4e')]=_0x2d4617[_0x2141('0x4c')]['filename'];_0x2d4617[_0x2141('0x48')]['type']=_0x2d4617[_0x2141('0x4c')][_0x2141('0x4f')];return db[_0x2141('0x28')][_0x2141('0x4a')](_0x2d4617['body'])[_0x2141('0x23')](respondWithResult(_0x5dab5b,0xc9))[_0x2141('0x3e')](handleError(_0x5dab5b,null));};exports[_0x2141('0x50')]=function(_0x3b59f0,_0x3db6ae,_0x458679){return db[_0x2141('0x28')][_0x2141('0x51')]({'where':{'id':_0x3b59f0[_0x2141('0x40')]['id']},'raw':!![]})[_0x2141('0x23')](handleEntityNotFound(_0x3db6ae,null))[_0x2141('0x23')](function(_0x10ad3b){if(_0x10ad3b){return _0x3db6ae[_0x2141('0x50')](path[_0x2141('0x52')](config[_0x2141('0x53')],_0x2141('0x54'),_0x10ad3b[_0x2141('0x4e')]));}})[_0x2141('0x3e')](handleError(_0x3db6ae,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 95fd5fc..adf7839 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 _0xb5fa=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./attachment.attributes','exports','Attachment','attachments','lodash','util','../../config/logger','api'];(function(_0xa0e439,_0x4564ba){var _0x47d3c2=function(_0x3ad73b){while(--_0x3ad73b){_0xa0e439['push'](_0xa0e439['shift']());}};_0x47d3c2(++_0x4564ba);}(_0xb5fa,0xf8));var _0xab5f=function(_0x254753,_0x3b8712){_0x254753=_0x254753-0x0;var _0x5cea99=_0xb5fa[_0x254753];return _0x5cea99;};'use strict';var _=require(_0xab5f('0x0'));var util=require(_0xab5f('0x1'));var logger=require(_0xab5f('0x2'))(_0xab5f('0x3'));var moment=require(_0xab5f('0x4'));var BPromise=require(_0xab5f('0x5'));var rp=require(_0xab5f('0x6'));var fs=require('fs');var path=require(_0xab5f('0x7'));var rimraf=require(_0xab5f('0x8'));var config=require(_0xab5f('0x9'));var attributes=require(_0xab5f('0xa'));module[_0xab5f('0xb')]=function(_0x52f546,_0x4b40ca){return _0x52f546['define'](_0xab5f('0xc'),attributes,{'tableName':_0xab5f('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcf37=['util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./attachment.attributes','exports','attachments'];(function(_0x49c018,_0xdee1bf){var _0x1abb71=function(_0x21ec51){while(--_0x21ec51){_0x49c018['push'](_0x49c018['shift']());}};_0x1abb71(++_0xdee1bf);}(_0xcf37,0xdc));var _0x7cf3=function(_0x4f52ff,_0x39013a){_0x4f52ff=_0x4f52ff-0x0;var _0x2374f6=_0xcf37[_0x4f52ff];return _0x2374f6;};'use strict';var _=require('lodash');var util=require(_0x7cf3('0x0'));var logger=require(_0x7cf3('0x1'))(_0x7cf3('0x2'));var moment=require(_0x7cf3('0x3'));var BPromise=require(_0x7cf3('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7cf3('0x5'));var rimraf=require(_0x7cf3('0x6'));var config=require(_0x7cf3('0x7'));var attributes=require(_0x7cf3('0x8'));module[_0x7cf3('0x9')]=function(_0x48c7cf,_0x488938){return _0x48c7cf['define']('Attachment',attributes,{'tableName':_0x7cf3('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/attachment/attachment.rpc.js b/server/api/attachment/attachment.rpc.js index 79c7fe9..59a577f 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 _0x45e8=['result','Attachment','create','body','raw','CreateAttachment','catch','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','request','then','info','Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x4a9cbb,_0x512bb3){var _0x44c8cc=function(_0xdadf1){while(--_0xdadf1){_0x4a9cbb['push'](_0x4a9cbb['shift']());}};_0x44c8cc(++_0x512bb3);}(_0x45e8,0x89));var _0x845e=function(_0x5d9295,_0x5f5bc6){_0x5d9295=_0x5d9295-0x0;var _0x4f2534=_0x45e8[_0x5d9295];return _0x4f2534;};'use strict';var _=require('lodash');var util=require(_0x845e('0x0'));var moment=require(_0x845e('0x1'));var BPromise=require('bluebird');var rs=require(_0x845e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x845e('0x3'))['db'];var utils=require(_0x845e('0x4'));var logger=require('../../config/logger')(_0x845e('0x5'));var config=require(_0x845e('0x6'));var jayson=require(_0x845e('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x478bf1,_0x154e89,_0x4e960c){return new BPromise(function(_0xbf164c,_0x1e0f5d){return client[_0x845e('0x8')](_0x478bf1,_0x4e960c)[_0x845e('0x9')](function(_0x1e6fcf){logger[_0x845e('0xa')](_0x845e('0xb'),_0x154e89,_0x845e('0xc'));logger[_0x845e('0xd')](_0x845e('0xe'),_0x154e89,_0x845e('0xc'),JSON[_0x845e('0xf')](_0x1e6fcf));if(_0x1e6fcf[_0x845e('0x10')]){if(_0x1e6fcf[_0x845e('0x10')][_0x845e('0x11')]===0x1f4){logger[_0x845e('0x10')](_0x845e('0xb'),_0x154e89,_0x1e6fcf[_0x845e('0x10')][_0x845e('0x12')]);return _0x1e0f5d(_0x1e6fcf['error'][_0x845e('0x12')]);}logger['error'](_0x845e('0xb'),_0x154e89,_0x1e6fcf[_0x845e('0x10')][_0x845e('0x12')]);return _0xbf164c(_0x1e6fcf[_0x845e('0x10')]['message']);}else{logger[_0x845e('0xa')](_0x845e('0xb'),_0x154e89,_0x845e('0xc'));_0xbf164c(_0x1e6fcf[_0x845e('0x13')][_0x845e('0x12')]);}})['catch'](function(_0x2d995c){logger[_0x845e('0x10')](_0x845e('0xb'),_0x154e89,_0x2d995c);_0x1e0f5d(_0x2d995c);});});}exports['CreateAttachment']=function(_0x32fb27){var _0x40929f=this;return new Promise(function(_0xe00833,_0x436ca4){return db[_0x845e('0x14')][_0x845e('0x15')](_0x32fb27[_0x845e('0x16')],{'raw':_0x32fb27['options']?_0x32fb27['options'][_0x845e('0x17')]===undefined?!![]:![]:!![]})[_0x845e('0x9')](function(_0x221d60){logger[_0x845e('0xa')](_0x845e('0x18'),_0x32fb27);logger[_0x845e('0xd')]('CreateAttachment',_0x32fb27,JSON[_0x845e('0xf')](_0x221d60));_0xe00833(_0x221d60);})[_0x845e('0x19')](function(_0x46602c){logger[_0x845e('0x10')](_0x845e('0x18'),_0x46602c[_0x845e('0x12')],_0x32fb27);_0x436ca4(_0x40929f[_0x845e('0x10')](0x1f4,_0x46602c[_0x845e('0x12')]));});});}; \ No newline at end of file +var _0xcc97=['options','raw','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','Attachment,\x20%s,\x20%s','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','CreateAttachment','Attachment','create','body'];(function(_0x4dbba7,_0x34d6d1){var _0x43ef83=function(_0x27acf1){while(--_0x27acf1){_0x4dbba7['push'](_0x4dbba7['shift']());}};_0x43ef83(++_0x34d6d1);}(_0xcc97,0x142));var _0x7cc9=function(_0x1ef408,_0x3b10fc){_0x1ef408=_0x1ef408-0x0;var _0x3a42c2=_0xcc97[_0x1ef408];return _0x3a42c2;};'use strict';var _=require(_0x7cc9('0x0'));var util=require(_0x7cc9('0x1'));var moment=require('moment');var BPromise=require(_0x7cc9('0x2'));var rs=require(_0x7cc9('0x3'));var fs=require('fs');var Redis=require(_0x7cc9('0x4'));var db=require(_0x7cc9('0x5'))['db'];var utils=require(_0x7cc9('0x6'));var logger=require(_0x7cc9('0x7'))(_0x7cc9('0x8'));var config=require(_0x7cc9('0x9'));var jayson=require(_0x7cc9('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xd12cba,_0x3a22d5,_0x67cd2){return new BPromise(function(_0x1a4d45,_0x571d79){return client[_0x7cc9('0xb')](_0xd12cba,_0x67cd2)[_0x7cc9('0xc')](function(_0x5a2862){logger[_0x7cc9('0xd')](_0x7cc9('0xe'),_0x3a22d5,'request\x20sent');logger[_0x7cc9('0xf')](_0x7cc9('0x10'),_0x3a22d5,'request\x20sent',JSON[_0x7cc9('0x11')](_0x5a2862));if(_0x5a2862[_0x7cc9('0x12')]){if(_0x5a2862[_0x7cc9('0x12')]['code']===0x1f4){logger[_0x7cc9('0x12')](_0x7cc9('0xe'),_0x3a22d5,_0x5a2862[_0x7cc9('0x12')][_0x7cc9('0x13')]);return _0x571d79(_0x5a2862['error'][_0x7cc9('0x13')]);}logger[_0x7cc9('0x12')](_0x7cc9('0xe'),_0x3a22d5,_0x5a2862[_0x7cc9('0x12')][_0x7cc9('0x13')]);return _0x1a4d45(_0x5a2862['error']['message']);}else{logger[_0x7cc9('0xd')](_0x7cc9('0xe'),_0x3a22d5,_0x7cc9('0x14'));_0x1a4d45(_0x5a2862[_0x7cc9('0x15')][_0x7cc9('0x13')]);}})['catch'](function(_0x4e1cd0){logger[_0x7cc9('0x12')]('Attachment,\x20%s,\x20%s',_0x3a22d5,_0x4e1cd0);_0x571d79(_0x4e1cd0);});});}exports[_0x7cc9('0x16')]=function(_0x4d938c){var _0x193543=this;return new Promise(function(_0xa1b714,_0x1b8b0e){return db[_0x7cc9('0x17')][_0x7cc9('0x18')](_0x4d938c[_0x7cc9('0x19')],{'raw':_0x4d938c[_0x7cc9('0x1a')]?_0x4d938c['options'][_0x7cc9('0x1b')]===undefined?!![]:![]:!![]})[_0x7cc9('0xc')](function(_0x443e1d){logger[_0x7cc9('0xd')](_0x7cc9('0x16'),_0x4d938c);logger[_0x7cc9('0xf')](_0x7cc9('0x16'),_0x4d938c,JSON[_0x7cc9('0x11')](_0x443e1d));_0xa1b714(_0x443e1d);})[_0x7cc9('0x1c')](function(_0x21fc2c){logger['error'](_0x7cc9('0x16'),_0x21fc2c[_0x7cc9('0x13')],_0x4d938c);_0x1b8b0e(_0x193543['error'](0x1f4,_0x21fc2c['message']));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index b6513d6..6a00a8a 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 _0x39d7=['%s-%s','now','originalname','replace','file','create','put','update','delete','destroy','exports','multer','util','path','express','Router','../../components/interaction/service','get','isAuthenticated','index','/:id','download','post','clone','diskStorage','join','root','server/files/attachments/','format'];(function(_0x4c030e,_0x250028){var _0x225b6c=function(_0x59223e){while(--_0x59223e){_0x4c030e['push'](_0x4c030e['shift']());}};_0x225b6c(++_0x250028);}(_0x39d7,0x12d));var _0x739d=function(_0x18ca41,_0x4b407f){_0x18ca41=_0x18ca41-0x0;var _0x4eb2e6=_0x39d7[_0x18ca41];return _0x4eb2e6;};'use strict';var multer=require(_0x739d('0x0'));var util=require(_0x739d('0x1'));var path=require(_0x739d('0x2'));var timeout=require('connect-timeout');var express=require(_0x739d('0x3'));var router=express[_0x739d('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x739d('0x5'));var config=require('../../config/environment');var controller=require('./attachment.controller');router[_0x739d('0x6')]('/',auth[_0x739d('0x7')](),controller[_0x739d('0x8')]);router['get'](_0x739d('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x739d('0x6')]('/:id/download',auth[_0x739d('0x7')](),controller[_0x739d('0xa')]);router[_0x739d('0xb')]('/:id/clone',auth['isAuthenticated'](),controller[_0x739d('0xc')]);var upload=multer({'storage':multer[_0x739d('0xd')]({'destination':function(_0x10bbb1,_0x39dbcd,_0x286c83){_0x286c83(null,path[_0x739d('0xe')](config[_0x739d('0xf')],_0x739d('0x10')));},'filename':function(_0x17f479,_0xb2dc6b,_0x24dc90){_0x24dc90(null,util[_0x739d('0x11')](_0x739d('0x12'),Date[_0x739d('0x13')](),_0xb2dc6b[_0x739d('0x14')][_0x739d('0x15')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x739d('0xb')]('/',upload['single'](_0x739d('0x16')),controller[_0x739d('0x17')]);router[_0x739d('0x18')](_0x739d('0x9'),auth['isAuthenticated'](),controller[_0x739d('0x19')]);router[_0x739d('0x1a')]('/:id',auth[_0x739d('0x7')](),controller[_0x739d('0x1b')]);module[_0x739d('0x1c')]=router; \ No newline at end of file +var _0x4658=['Router','../../components/interaction/service','get','isAuthenticated','index','/:id','show','/:id/download','post','/:id/clone','clone','join','root','format','originalname','file','create','put','delete','exports','multer','util','path','connect-timeout'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x4658,0x74));var _0x8465=function(_0x25b2a0,_0x54ab5b){_0x25b2a0=_0x25b2a0-0x0;var _0x2b7513=_0x4658[_0x25b2a0];return _0x2b7513;};'use strict';var multer=require(_0x8465('0x0'));var util=require(_0x8465('0x1'));var path=require(_0x8465('0x2'));var timeout=require(_0x8465('0x3'));var express=require('express');var router=express[_0x8465('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x8465('0x5'));var config=require('../../config/environment');var controller=require('./attachment.controller');router[_0x8465('0x6')]('/',auth[_0x8465('0x7')](),controller[_0x8465('0x8')]);router['get'](_0x8465('0x9'),auth[_0x8465('0x7')](),controller[_0x8465('0xa')]);router[_0x8465('0x6')](_0x8465('0xb'),auth['isAuthenticated'](),controller['download']);router[_0x8465('0xc')](_0x8465('0xd'),auth[_0x8465('0x7')](),controller[_0x8465('0xe')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3cf0c8,_0x313f8f,_0x1d147b){_0x1d147b(null,path[_0x8465('0xf')](config[_0x8465('0x10')],'server/files/attachments/'));},'filename':function(_0x2503d5,_0x1252a6,_0x3d6563){_0x3d6563(null,util[_0x8465('0x11')]('%s-%s',Date['now'](),_0x1252a6[_0x8465('0x12')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x8465('0xc')]('/',upload['single'](_0x8465('0x13')),controller[_0x8465('0x14')]);router[_0x8465('0x15')]('/:id',auth[_0x8465('0x7')](),controller['update']);router[_0x8465('0x16')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x8465('0x17')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index 343b4b6..4e9080a 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 _0xfe4d=['then','User','find','value','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blocked','minutes','clearBlockUser','getLicense','catch','passport','passport-google-oauth20','Strategy','moment','../../mysqldb','../../config/environment','signToken','../../config/utils','login','authenticate','profile','callback','google','/login','use','clientID','Setting','findOne','allowedLoginAttempts','blockDuration'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xfe4d,0x178));var _0xdfe4=function(_0x5c8736,_0x2a2a03){_0x5c8736=_0x5c8736-0x0;var _0x142bdb=_0xfe4d[_0x5c8736];return _0x142bdb;};'use strict';var _=require('lodash');var passport=require(_0xdfe4('0x0'));var GoogleStrategy=require(_0xdfe4('0x1'))[_0xdfe4('0x2')];var moment=require(_0xdfe4('0x3'));var db=require(_0xdfe4('0x4'))['db'];var config=require(_0xdfe4('0x5'));var signToken=require('../../components/auth/service')[_0xdfe4('0x6')];var utils=require(_0xdfe4('0x7'));exports[_0xdfe4('0x8')]=passport[_0xdfe4('0x9')]('google',{'failureRedirect':'/login','scope':[_0xdfe4('0xa'),'email'],'session':![]});exports[_0xdfe4('0xb')]=passport[_0xdfe4('0x9')](_0xdfe4('0xc'),{'failureRedirect':_0xdfe4('0xd'),'session':![]});passport[_0xdfe4('0xe')](new GoogleStrategy({'clientID':config[_0xdfe4('0xc')]?config[_0xdfe4('0xc')][_0xdfe4('0xf')]:'id','clientSecret':config[_0xdfe4('0xc')]?config[_0xdfe4('0xc')]['clientSecret']:'secret','callbackURL':config[_0xdfe4('0xc')]?config[_0xdfe4('0xc')]['callbackURL']:''},function(_0x4d0874,_0x483507,_0x31ba1a,_0xfa972e){var _0x5449aa,_0x4cf903;return db[_0xdfe4('0x10')][_0xdfe4('0x11')]({'where':{'id':0x1},'attributes':[_0xdfe4('0x12'),_0xdfe4('0x13')],'raw':!![]})[_0xdfe4('0x14')](function(_0x51e4e7){_0x5449aa=_0x51e4e7;return db[_0xdfe4('0x15')][_0xdfe4('0x16')]({'where':{'email':_['map'](_0x31ba1a['emails'],_0xdfe4('0x17')),'role':{'$or':[_0xdfe4('0x18'),_0xdfe4('0x19'),_0xdfe4('0x1a')]}}});})[_0xdfe4('0x14')](function(_0x1f4d45){_0x4cf903=_0x1f4d45;if(_0x4cf903){if(_0x4cf903['disabled']){return _0xfa972e(_0xdfe4('0x1b'));}else if(_0x5449aa[_0xdfe4('0x13')]>0x0){if(_0x4cf903[_0xdfe4('0x1c')]){if(moment(_0x4cf903['blockedAt'])['add'](_0x5449aa[_0xdfe4('0x13')],_0xdfe4('0x1d'))>moment()){return _0xfa972e(_0xdfe4('0x1b'));}else{return utils[_0xdfe4('0x1e')](_0x4cf903,0x0,![],null)[_0xdfe4('0x14')](function(){return utils['getLicense'](_0x4cf903);})[_0xdfe4('0x14')](function(){return _0xfa972e(null,_0x4cf903);});}}else{return utils[_0xdfe4('0x1f')](_0x4cf903)[_0xdfe4('0x14')](function(){return _0xfa972e(null,_0x4cf903);});}}else{return utils['getLicense'](_0x4cf903)[_0xdfe4('0x14')](function(){return _0xfa972e(null,_0x4cf903);});}}return _0xfa972e(_0xdfe4('0x1b'));})[_0xdfe4('0x20')](function(_0x463142){_0xfa972e(_0x463142);});})); \ No newline at end of file +var _0xfa48=['add','minutes','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','clearBlockUser','getLicense','catch','lodash','passport','passport-google-oauth20','Strategy','../../config/environment','../../components/auth/service','signToken','authenticate','google','callback','/login','use','clientID','clientSecret','secret','callbackURL','Setting','findOne','allowedLoginAttempts','find','value','admin','user','then','blockDuration','blocked','blockedAt'];(function(_0x8e2977,_0x22ad61){var _0x164de1=function(_0x583241){while(--_0x583241){_0x8e2977['push'](_0x8e2977['shift']());}};_0x164de1(++_0x22ad61);}(_0xfa48,0xab));var _0x8fa4=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xfa48[_0x2bf141];return _0x48277b;};'use strict';var _=require(_0x8fa4('0x0'));var passport=require(_0x8fa4('0x1'));var GoogleStrategy=require(_0x8fa4('0x2'))[_0x8fa4('0x3')];var moment=require('moment');var db=require('../../mysqldb')['db'];var config=require(_0x8fa4('0x4'));var signToken=require(_0x8fa4('0x5'))[_0x8fa4('0x6')];var utils=require('../../config/utils');exports['login']=passport[_0x8fa4('0x7')](_0x8fa4('0x8'),{'failureRedirect':'/login','scope':['profile','email'],'session':![]});exports[_0x8fa4('0x9')]=passport[_0x8fa4('0x7')](_0x8fa4('0x8'),{'failureRedirect':_0x8fa4('0xa'),'session':![]});passport[_0x8fa4('0xb')](new GoogleStrategy({'clientID':config[_0x8fa4('0x8')]?config[_0x8fa4('0x8')][_0x8fa4('0xc')]:'id','clientSecret':config[_0x8fa4('0x8')]?config[_0x8fa4('0x8')][_0x8fa4('0xd')]:_0x8fa4('0xe'),'callbackURL':config[_0x8fa4('0x8')]?config['google'][_0x8fa4('0xf')]:''},function(_0xc61ca6,_0x2e6f94,_0x56ae6f,_0x4ba59b){var _0x4d5078,_0xcbcdb6;return db[_0x8fa4('0x10')][_0x8fa4('0x11')]({'where':{'id':0x1},'attributes':[_0x8fa4('0x12'),'blockDuration'],'raw':!![]})['then'](function(_0x3050c0){_0x4d5078=_0x3050c0;return db['User'][_0x8fa4('0x13')]({'where':{'email':_['map'](_0x56ae6f['emails'],_0x8fa4('0x14')),'role':{'$or':[_0x8fa4('0x15'),_0x8fa4('0x16'),'agent']}}});})[_0x8fa4('0x17')](function(_0x4616ce){_0xcbcdb6=_0x4616ce;if(_0xcbcdb6){if(_0xcbcdb6['disabled']){return _0x4ba59b('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else if(_0x4d5078[_0x8fa4('0x18')]>0x0){if(_0xcbcdb6[_0x8fa4('0x19')]){if(moment(_0xcbcdb6[_0x8fa4('0x1a')])[_0x8fa4('0x1b')](_0x4d5078[_0x8fa4('0x18')],_0x8fa4('0x1c'))>moment()){return _0x4ba59b(_0x8fa4('0x1d'));}else{return utils[_0x8fa4('0x1e')](_0xcbcdb6,0x0,![],null)[_0x8fa4('0x17')](function(){return utils[_0x8fa4('0x1f')](_0xcbcdb6);})[_0x8fa4('0x17')](function(){return _0x4ba59b(null,_0xcbcdb6);});}}else{return utils[_0x8fa4('0x1f')](_0xcbcdb6)[_0x8fa4('0x17')](function(){return _0x4ba59b(null,_0xcbcdb6);});}}else{return utils[_0x8fa4('0x1f')](_0xcbcdb6)[_0x8fa4('0x17')](function(){return _0x4ba59b(null,_0xcbcdb6);});}}return _0x4ba59b(_0x8fa4('0x1d'));})[_0x8fa4('0x20')](function(_0x53e762){_0x4ba59b(_0x53e762);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index 583cefb..218526c 100644 --- a/server/api/authGoogle/index.js +++ b/server/api/authGoogle/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x25a3=['isMiddleware','express','passport','Router','../user/user.controller.js','get','login','callback'];(function(_0x24875d,_0x4fb24d){var _0x181471=function(_0x4ecd6d){while(--_0x4ecd6d){_0x24875d['push'](_0x24875d['shift']());}};_0x181471(++_0x4fb24d);}(_0x25a3,0x121));var _0x325a=function(_0x3c67e4,_0xedd28b){_0x3c67e4=_0x3c67e4-0x0;var _0x1a348b=_0x25a3[_0x3c67e4];return _0x1a348b;};'use strict';var express=require(_0x325a('0x0'));var passport=require(_0x325a('0x1'));var router=express[_0x325a('0x2')]();var controller=require('./authGoogle.controller');var userController=require(_0x325a('0x3'));var authService=require('../../components/auth/service');router[_0x325a('0x4')]('/',controller[_0x325a('0x5')]);router[_0x325a('0x4')]('/callback',controller[_0x325a('0x6')],authService[_0x325a('0x7')],userController[_0x325a('0x5')],authService['setTokenCookie']);module['exports']=router; \ No newline at end of file +var _0x50c1=['exports','express','./authGoogle.controller','../user/user.controller.js','../../components/auth/service','get','login','/callback','callback','isMiddleware'];(function(_0x43776a,_0x4eb74c){var _0x18eb8f=function(_0x319afb){while(--_0x319afb){_0x43776a['push'](_0x43776a['shift']());}};_0x18eb8f(++_0x4eb74c);}(_0x50c1,0x1a5));var _0x150c=function(_0x15af69,_0x580bc1){_0x15af69=_0x15af69-0x0;var _0xf2684e=_0x50c1[_0x15af69];return _0xf2684e;};'use strict';var express=require(_0x150c('0x0'));var passport=require('passport');var router=express['Router']();var controller=require(_0x150c('0x1'));var userController=require(_0x150c('0x2'));var authService=require(_0x150c('0x3'));router[_0x150c('0x4')]('/',controller[_0x150c('0x5')]);router[_0x150c('0x4')](_0x150c('0x6'),controller[_0x150c('0x7')],authService[_0x150c('0x8')],userController['login'],authService['setTokenCookie']);module[_0x150c('0x9')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index 1b8355f..5c4dab4 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 _0x5664=['token','now','securePassword','password','resetPasswordToken','Password\x20reset!','use','util','passport','passport-local','Strategy','lodash','randomstring','moment','../../mysqldb','../../config/utils','client','http','Setting','findOne','blockDuration','name','salt','role','disabled','blocked','blockedAt','then','authenticate','loginAttempts','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','add','minutes','clearBlockUser','allowedLoginAttempts','getLicense','catch','MailAccount','find','MailServerOut','Smtp','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','service','host','port','secure','auth','user','pass','merge','format','\x22%s\x22\x20<%s>','email','request','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','status','send','test','login','local','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','forgot','body','generate','trim','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','save','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','http://','headers','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','reset','User','params'];(function(_0x127c3c,_0x4d3b3b){var _0x9902ac=function(_0x37162b){while(--_0x37162b){_0x127c3c['push'](_0x127c3c['shift']());}};_0x9902ac(++_0x4d3b3b);}(_0x5664,0x1ab));var _0x4566=function(_0x437d7f,_0x1feb46){_0x437d7f=_0x437d7f-0x0;var _0x31058c=_0x5664[_0x437d7f];return _0x31058c;};'use strict';var util=require(_0x4566('0x0'));var passport=require(_0x4566('0x1'));var LocalStrategy=require(_0x4566('0x2'))[_0x4566('0x3')];var jayson=require('jayson/promise');var _=require(_0x4566('0x4'));var rs=require(_0x4566('0x5'));var moment=require(_0x4566('0x6'));var db=require(_0x4566('0x7'))['db'];var authService=require('../../components/auth/service');var utils=require(_0x4566('0x8'));var client=jayson[_0x4566('0x9')][_0x4566('0xa')]({'port':0x232b});function localAuthenticate(_0x3b21e6,_0x5320b5,_0x30afd1,_0xd07cf0){var _0x563977,_0x2e9886;return db[_0x4566('0xb')][_0x4566('0xc')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x4566('0xd')],'raw':!![]})['then'](function(_0x36aea5){_0x563977=_0x36aea5;return _0x3b21e6[_0x4566('0xc')]({'attributes':['id',_0x4566('0xe'),'password',_0x4566('0xf'),_0x4566('0x10'),_0x4566('0x11'),_0x4566('0x12'),_0x4566('0x13'),'loginAttempts'],'where':{'name':_0x5320b5,'role':{'$or':['admin','user','agent']}}});})[_0x4566('0x14')](function(_0x644877){if(!_0x644877||_0x644877&&_0x644877[_0x4566('0xe')]!==_0x5320b5){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x2e9886=_0x644877;return _0x2e9886;}})['then'](function(){_0x2e9886[_0x4566('0x15')](_0x30afd1,function(_0x40df03,_0x45dbfe){var _0x3c337d=_0x2e9886[_0x4566('0x16')]+0x1;if(_0x40df03){return _0xd07cf0(_0x40df03);}else if(!_0x45dbfe){if(_0x2e9886[_0x4566('0x11')]){return _0xd07cf0(null,![],{'message':_0x4566('0x17')});}else if(_0x563977['allowedLoginAttempts']>0x0){if(_0x2e9886['blocked']){if(_0x563977['blockDuration']>0x0){if(moment(_0x2e9886[_0x4566('0x13')])[_0x4566('0x18')](_0x563977[_0x4566('0xd')],_0x4566('0x19'))>moment()){return _0xd07cf0(null,![],{'message':_0x4566('0x17')});}else{return utils[_0x4566('0x1a')](_0x2e9886,_0x3c337d,![],null)[_0x4566('0x14')](function(){return _0xd07cf0(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}else{return _0xd07cf0(null,![],{'message':_0x4566('0x17')});}}else{if(_0x3c337d>=_0x563977[_0x4566('0x1b')]){return utils['clearBlockUser'](_0x2e9886,0x0,!![],moment())[_0x4566('0x14')](function(){return _0xd07cf0(null,![],{'message':_0x4566('0x17')});});}else{return utils[_0x4566('0x1a')](_0x2e9886,_0x3c337d,![],null)[_0x4566('0x14')](function(){return _0xd07cf0(null,![],{'message':_0x4566('0x17')});});}}}else{return _0xd07cf0(null,![],{'message':_0x4566('0x17')});}}else{if(_0x2e9886[_0x4566('0x11')]){return _0xd07cf0(null,![],{'message':_0x4566('0x17')});}else if(_0x563977[_0x4566('0x1b')]>0x0){if(_0x2e9886[_0x4566('0x12')]){if(_0x563977['blockDuration']>0x0){if(moment(_0x2e9886['blockedAt'])[_0x4566('0x18')](_0x563977['blockDuration'],_0x4566('0x19'))>moment()){return _0xd07cf0(null,![],{'message':_0x4566('0x17')});}else{return utils[_0x4566('0x1a')](_0x2e9886,0x0,![],null)[_0x4566('0x14')](function(){return utils[_0x4566('0x1c')](_0x2e9886);})[_0x4566('0x14')](function(){return _0xd07cf0(null,_0x2e9886);});}}else{return _0xd07cf0(null,![],{'message':_0x4566('0x17')});}}else{return utils[_0x4566('0x1a')](_0x2e9886,0x0,![],null)[_0x4566('0x14')](function(){return utils[_0x4566('0x1c')](_0x2e9886);})[_0x4566('0x14')](function(){return _0xd07cf0(null,_0x2e9886);})[_0x4566('0x1d')](function(_0x5b7153){return _0xd07cf0(null,![],_0x5b7153);});}}else{if(_0x2e9886[_0x4566('0x12')]){return _0xd07cf0(null,![],{'message':_0x4566('0x17')});}else{return utils['getLicense'](_0x2e9886)[_0x4566('0x14')](function(){return _0xd07cf0(null,_0x2e9886);});}}}});})['catch'](function(_0xade498){return _0xd07cf0(null,![],_0xade498);});}function sendServiceMail(_0x2cf5aa){return db[_0x4566('0x1e')][_0x4566('0x1f')]({'where':{'service':!![]},'attributes':['id',_0x4566('0xe'),'email'],'include':[{'model':db[_0x4566('0x20')],'as':_0x4566('0x21')}]})['then'](function(_0x3d7fc6){if(!_0x3d7fc6){throw new Error(_0x4566('0x22'));}var _0x3b55ea={'tls':{'rejectUnauthorized':![]}};if(_0x3d7fc6[_0x4566('0x21')]['service']){_0x3b55ea[_0x4566('0x23')]=_0x3d7fc6['Smtp'][_0x4566('0x23')];}else{_0x3b55ea[_0x4566('0x24')]=_0x3d7fc6[_0x4566('0x21')]['host'];_0x3b55ea[_0x4566('0x25')]=_0x3d7fc6[_0x4566('0x21')][_0x4566('0x25')];_0x3b55ea[_0x4566('0x26')]=_0x3d7fc6['Smtp'][_0x4566('0x26')];}if(_0x3d7fc6['Smtp']['authentication']){_0x3b55ea[_0x4566('0x27')]={'user':_0x3d7fc6['Smtp'][_0x4566('0x28')],'pass':_0x3d7fc6['Smtp'][_0x4566('0x29')]};}var _0x22a11d={'account':_0x3b55ea,'message':_[_0x4566('0x2a')]({'from':util[_0x4566('0x2b')](_0x4566('0x2c'),_0x3d7fc6[_0x4566('0xe')],_0x3d7fc6[_0x4566('0x2d')]||_0x3d7fc6[_0x4566('0x21')][_0x4566('0x28')])},_0x2cf5aa)};return client[_0x4566('0x2e')](_0x4566('0x2f'),_0x22a11d);})[_0x4566('0x14')](function(_0xf17b73){if(_0xf17b73[_0x4566('0x30')]){throw new Error(util['format'](_0x4566('0x31'),_0xf17b73['error'][_0x4566('0x32')]||JSON[_0x4566('0x33')](_0xf17b73[_0x4566('0x30')])));}return!![];});}function handleError(_0x149813,_0x289b7f,_0x3bfaa8){return _0x149813[_0x4566('0x34')](_0x289b7f||0x1f4)[_0x4566('0x35')]({'message':_0x3bfaa8?_0x3bfaa8[_0x4566('0x32')]||_0x3bfaa8:''});}function checkPasswordPattern(_0x28ff51,_0x15b0e5,_0x20dfeb){if(_0x20dfeb){var _0x3fc9e2=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3fc9e2[_0x4566('0x36')](_0x15b0e5)){return _0x28ff51;}else{throw new Error('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x28ff51;}}exports[_0x4566('0x37')]=function(_0x2e9095,_0x560c31,_0x12aae6){passport['authenticate'](_0x4566('0x38'),function(_0x18a79c,_0x2dcd1a,_0x358814){var _0x23137e=_0x18a79c||_0x358814;if(_0x23137e){return handleError(_0x560c31,0x191,_0x23137e);}if(!_0x2dcd1a){return handleError(_0x560c31,0x194,{'message':_0x4566('0x39')});}else{var _0x119c70={'payload':{'id':_0x2dcd1a['id'],'role':_0x2dcd1a['role']},'options':{'expiresIn':0x15180}};return authService[_0x4566('0x3a')](_0x119c70)[_0x4566('0x14')](function(_0x2bc966){_0x560c31['json']({'id':_0x2dcd1a['id'],'token':_0x2bc966,'statusCall':'','isAlreadyLogged':_0x2dcd1a['online']});});}})(_0x2e9095,_0x560c31,_0x12aae6);};exports[_0x4566('0x3b')]=function(_0xedf24,_0xa09232,_0x1f0cdd){if(!_0xedf24[_0x4566('0x3c')][_0x4566('0x2d')]){return handleError(_0xa09232,0x1f4,{'message':'Email\x20parameter\x20is\x20missing'});}var _0x30c495=rs[_0x4566('0x3d')]();_0xedf24[_0x4566('0x3c')][_0x4566('0x2d')]=_0xedf24[_0x4566('0x3c')][_0x4566('0x2d')][_0x4566('0x3e')]()['toLowerCase']();var _0x3977d2;return db['Setting']['findOne']({'where':{'id':0x1},'attributes':[_0x4566('0x1b'),'blockDuration'],'raw':!![]})[_0x4566('0x14')](function(_0x214e51){_0x3977d2=_0x214e51;return db['User'][_0x4566('0x1f')]({'where':{'email':_0xedf24['body'][_0x4566('0x2d')]}});})[_0x4566('0x14')](function(_0x3e0826){if(!_0x3e0826){throw new Error(_0x4566('0x3f'));}if(_0x3e0826[_0x4566('0x11')]){throw new Error(_0x4566('0x40'));}if(_0x3e0826[_0x4566('0x12')]){if(moment(_0x3e0826[_0x4566('0x13')])['add'](_0x3977d2[_0x4566('0xd')],_0x4566('0x19'))>moment()){throw new Error(_0x4566('0x41'));}else{_0x3e0826[_0x4566('0x12')]=![];_0x3e0826[_0x4566('0x13')]=null;}}_0x3e0826['resetPasswordToken']=_0x30c495;_0x3e0826['resetPasswordExpires']=Date['now']()+0x36ee80;return _0x3e0826[_0x4566('0x42')]();})[_0x4566('0x14')](function(){return sendServiceMail({'to':_0xedf24['body']['email'],'subject':_0x4566('0x43'),'text':_0x4566('0x44')+_0x4566('0x45')+_0x4566('0x46')+_0xedf24[_0x4566('0x47')]['host']+_0x4566('0x48')+_0x30c495+'\x0a\x0a'+_0x4566('0x49')});})[_0x4566('0x14')](function(){_0xa09232['status'](0xc8)[_0x4566('0x35')]({'message':'Reset\x20Email\x20sent!'});})[_0x4566('0x1d')](function(_0x5c0dcc){return handleError(_0xa09232,0x1f4,_0x5c0dcc);});};exports[_0x4566('0x4a')]=function(_0x1ba99b,_0x43aa05,_0x1240ab){var _0x5acbc7;return db[_0x4566('0x4b')][_0x4566('0x1f')]({'where':{'resetPasswordToken':_0x1ba99b[_0x4566('0x4c')][_0x4566('0x4d')],'resetPasswordExpires':{'$gt':Date[_0x4566('0x4e')]()}}})['then'](function(_0x2aa043){_0x5acbc7=_0x2aa043;if(!_0x5acbc7){throw new Error('Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.');}return db[_0x4566('0xb')]['findOne']({'attributes':['id',_0x4566('0x4f')]});})[_0x4566('0x14')](function(_0x490ac8){return checkPasswordPattern(_0x490ac8,_0x1ba99b['body'][_0x4566('0x50')],_0x490ac8[_0x4566('0x4f')]);})[_0x4566('0x14')](function(){_0x5acbc7['password']=_0x1ba99b[_0x4566('0x3c')][_0x4566('0x50')];_0x5acbc7[_0x4566('0x51')]=null;_0x5acbc7['resetPasswordExpires']=null;return _0x5acbc7[_0x4566('0x42')]();})[_0x4566('0x14')](function(){_0x43aa05['status'](0xc8)[_0x4566('0x35')]({'message':_0x4566('0x52')});})[_0x4566('0x1d')](function(_0x11d980){return handleError(_0x43aa05,0x1f4,_0x11d980);});};passport[_0x4566('0x53')](new LocalStrategy({'usernameField':_0x4566('0xe'),'passwordField':_0x4566('0x50')},function(_0x5145bf,_0x2938e9,_0x2ac98a){return localAuthenticate(db['User'],_0x5145bf,_0x2938e9,_0x2ac98a);})); \ No newline at end of file +var _0x8b97=['blocked','loginAttempts','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','blockedAt','minutes','clearBlockUser','add','getLicense','MailAccount','find','email','MailServerOut','Smtp','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','service','host','port','secure','authentication','auth','pass','merge','format','\x22%s\x22\x20<%s>','request','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','stringify','status','test','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','online','forgot','body','Email\x20parameter\x20is\x20missing','generate','toLowerCase','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','now','save','http://','headers','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','send','Reset\x20Email\x20sent!','params','token','securePassword','Password\x20reset!','use','util','passport-local','Strategy','jayson/promise','lodash','randomstring','moment','../../components/auth/service','../../config/utils','http','Setting','findOne','allowedLoginAttempts','blockDuration','then','name','password','role','disabled'];(function(_0x349f2d,_0x54e372){var _0x1e91a5=function(_0x1a6fae){while(--_0x1a6fae){_0x349f2d['push'](_0x349f2d['shift']());}};_0x1e91a5(++_0x54e372);}(_0x8b97,0x1d9));var _0x78b9=function(_0x33104a,_0x59f93a){_0x33104a=_0x33104a-0x0;var _0x179c69=_0x8b97[_0x33104a];return _0x179c69;};'use strict';var util=require(_0x78b9('0x0'));var passport=require('passport');var LocalStrategy=require(_0x78b9('0x1'))[_0x78b9('0x2')];var jayson=require(_0x78b9('0x3'));var _=require(_0x78b9('0x4'));var rs=require(_0x78b9('0x5'));var moment=require(_0x78b9('0x6'));var db=require('../../mysqldb')['db'];var authService=require(_0x78b9('0x7'));var utils=require(_0x78b9('0x8'));var client=jayson['client'][_0x78b9('0x9')]({'port':0x232b});function localAuthenticate(_0x1de137,_0x4b59e4,_0x2fed3b,_0x226007){var _0x1fc7e,_0x1500f6;return db[_0x78b9('0xa')][_0x78b9('0xb')]({'where':{'id':0x1},'attributes':[_0x78b9('0xc'),_0x78b9('0xd')],'raw':!![]})[_0x78b9('0xe')](function(_0x59e4e0){_0x1fc7e=_0x59e4e0;return _0x1de137[_0x78b9('0xb')]({'attributes':['id',_0x78b9('0xf'),_0x78b9('0x10'),'salt',_0x78b9('0x11'),_0x78b9('0x12'),_0x78b9('0x13'),'blockedAt',_0x78b9('0x14')],'where':{'name':_0x4b59e4,'role':{'$or':[_0x78b9('0x15'),_0x78b9('0x16'),_0x78b9('0x17')]}}});})[_0x78b9('0xe')](function(_0x2ca12a){if(!_0x2ca12a||_0x2ca12a&&_0x2ca12a[_0x78b9('0xf')]!==_0x4b59e4){throw new Error(_0x78b9('0x18'));}else{_0x1500f6=_0x2ca12a;return _0x1500f6;}})[_0x78b9('0xe')](function(){_0x1500f6[_0x78b9('0x19')](_0x2fed3b,function(_0x16bf6c,_0x2c715e){var _0x1f93ae=_0x1500f6[_0x78b9('0x14')]+0x1;if(_0x16bf6c){return _0x226007(_0x16bf6c);}else if(!_0x2c715e){if(_0x1500f6[_0x78b9('0x12')]){return _0x226007(null,![],{'message':_0x78b9('0x18')});}else if(_0x1fc7e[_0x78b9('0xc')]>0x0){if(_0x1500f6[_0x78b9('0x13')]){if(_0x1fc7e[_0x78b9('0xd')]>0x0){if(moment(_0x1500f6[_0x78b9('0x1a')])['add'](_0x1fc7e[_0x78b9('0xd')],_0x78b9('0x1b'))>moment()){return _0x226007(null,![],{'message':_0x78b9('0x18')});}else{return utils[_0x78b9('0x1c')](_0x1500f6,_0x1f93ae,![],null)[_0x78b9('0xe')](function(){return _0x226007(null,![],{'message':_0x78b9('0x18')});});}}else{return _0x226007(null,![],{'message':_0x78b9('0x18')});}}else{if(_0x1f93ae>=_0x1fc7e[_0x78b9('0xc')]){return utils['clearBlockUser'](_0x1500f6,0x0,!![],moment())['then'](function(){return _0x226007(null,![],{'message':_0x78b9('0x18')});});}else{return utils[_0x78b9('0x1c')](_0x1500f6,_0x1f93ae,![],null)['then'](function(){return _0x226007(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}}else{return _0x226007(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x1500f6[_0x78b9('0x12')]){return _0x226007(null,![],{'message':_0x78b9('0x18')});}else if(_0x1fc7e[_0x78b9('0xc')]>0x0){if(_0x1500f6[_0x78b9('0x13')]){if(_0x1fc7e[_0x78b9('0xd')]>0x0){if(moment(_0x1500f6[_0x78b9('0x1a')])[_0x78b9('0x1d')](_0x1fc7e['blockDuration'],_0x78b9('0x1b'))>moment()){return _0x226007(null,![],{'message':_0x78b9('0x18')});}else{return utils[_0x78b9('0x1c')](_0x1500f6,0x0,![],null)[_0x78b9('0xe')](function(){return utils[_0x78b9('0x1e')](_0x1500f6);})[_0x78b9('0xe')](function(){return _0x226007(null,_0x1500f6);});}}else{return _0x226007(null,![],{'message':_0x78b9('0x18')});}}else{return utils[_0x78b9('0x1c')](_0x1500f6,0x0,![],null)['then'](function(){return utils[_0x78b9('0x1e')](_0x1500f6);})[_0x78b9('0xe')](function(){return _0x226007(null,_0x1500f6);})['catch'](function(_0x4a07dc){return _0x226007(null,![],_0x4a07dc);});}}else{if(_0x1500f6[_0x78b9('0x13')]){return _0x226007(null,![],{'message':_0x78b9('0x18')});}else{return utils[_0x78b9('0x1e')](_0x1500f6)['then'](function(){return _0x226007(null,_0x1500f6);});}}}});})['catch'](function(_0x10ea13){return _0x226007(null,![],_0x10ea13);});}function sendServiceMail(_0x48be6d){return db[_0x78b9('0x1f')][_0x78b9('0x20')]({'where':{'service':!![]},'attributes':['id','name',_0x78b9('0x21')],'include':[{'model':db[_0x78b9('0x22')],'as':_0x78b9('0x23')}]})['then'](function(_0x3e05bf){if(!_0x3e05bf){throw new Error(_0x78b9('0x24'));}var _0x109ecc={'tls':{'rejectUnauthorized':![]}};if(_0x3e05bf[_0x78b9('0x23')][_0x78b9('0x25')]){_0x109ecc[_0x78b9('0x25')]=_0x3e05bf[_0x78b9('0x23')][_0x78b9('0x25')];}else{_0x109ecc[_0x78b9('0x26')]=_0x3e05bf[_0x78b9('0x23')]['host'];_0x109ecc[_0x78b9('0x27')]=_0x3e05bf[_0x78b9('0x23')][_0x78b9('0x27')];_0x109ecc[_0x78b9('0x28')]=_0x3e05bf[_0x78b9('0x23')][_0x78b9('0x28')];}if(_0x3e05bf[_0x78b9('0x23')][_0x78b9('0x29')]){_0x109ecc[_0x78b9('0x2a')]={'user':_0x3e05bf['Smtp'][_0x78b9('0x16')],'pass':_0x3e05bf[_0x78b9('0x23')][_0x78b9('0x2b')]};}var _0x21852d={'account':_0x109ecc,'message':_[_0x78b9('0x2c')]({'from':util[_0x78b9('0x2d')](_0x78b9('0x2e'),_0x3e05bf['name'],_0x3e05bf[_0x78b9('0x21')]||_0x3e05bf[_0x78b9('0x23')][_0x78b9('0x16')])},_0x48be6d)};return client[_0x78b9('0x2f')](_0x78b9('0x30'),_0x21852d);})[_0x78b9('0xe')](function(_0x37c5ca){if(_0x37c5ca[_0x78b9('0x31')]){throw new Error(util[_0x78b9('0x2d')](_0x78b9('0x32'),_0x37c5ca[_0x78b9('0x31')]['message']||JSON[_0x78b9('0x33')](_0x37c5ca[_0x78b9('0x31')])));}return!![];});}function handleError(_0x58fd14,_0x593f0c,_0x29ec59){return _0x58fd14[_0x78b9('0x34')](_0x593f0c||0x1f4)['send']({'message':_0x29ec59?_0x29ec59['message']||_0x29ec59:''});}function checkPasswordPattern(_0x363b51,_0x2e3498,_0x163e9f){if(_0x163e9f){var _0x6bb7d5=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x6bb7d5[_0x78b9('0x35')](_0x2e3498)){return _0x363b51;}else{throw new Error(_0x78b9('0x36'));}}else{return _0x363b51;}}exports['login']=function(_0x3285a0,_0x1b9e15,_0x526748){passport[_0x78b9('0x19')]('local',function(_0x48ad35,_0x1b8c9b,_0x127cf3){var _0x12914b=_0x48ad35||_0x127cf3;if(_0x12914b){return handleError(_0x1b9e15,0x191,_0x12914b);}if(!_0x1b8c9b){return handleError(_0x1b9e15,0x194,{'message':_0x78b9('0x37')});}else{var _0x249e6c={'payload':{'id':_0x1b8c9b['id'],'role':_0x1b8c9b[_0x78b9('0x11')]},'options':{'expiresIn':0x15180}};return authService[_0x78b9('0x38')](_0x249e6c)['then'](function(_0x324583){_0x1b9e15[_0x78b9('0x39')]({'id':_0x1b8c9b['id'],'token':_0x324583,'statusCall':'','isAlreadyLogged':_0x1b8c9b[_0x78b9('0x3a')]});});}})(_0x3285a0,_0x1b9e15,_0x526748);};exports[_0x78b9('0x3b')]=function(_0x3344d0,_0x3d6ab9,_0x5aca9d){if(!_0x3344d0[_0x78b9('0x3c')][_0x78b9('0x21')]){return handleError(_0x3d6ab9,0x1f4,{'message':_0x78b9('0x3d')});}var _0x16293f=rs[_0x78b9('0x3e')]();_0x3344d0['body'][_0x78b9('0x21')]=_0x3344d0[_0x78b9('0x3c')][_0x78b9('0x21')]['trim']()[_0x78b9('0x3f')]();var _0x2683a7;return db[_0x78b9('0xa')][_0x78b9('0xb')]({'where':{'id':0x1},'attributes':[_0x78b9('0xc'),'blockDuration'],'raw':!![]})['then'](function(_0x1a9477){_0x2683a7=_0x1a9477;return db[_0x78b9('0x40')]['find']({'where':{'email':_0x3344d0[_0x78b9('0x3c')][_0x78b9('0x21')]}});})[_0x78b9('0xe')](function(_0x2c695c){if(!_0x2c695c){throw new Error(_0x78b9('0x41'));}if(_0x2c695c[_0x78b9('0x12')]){throw new Error(_0x78b9('0x42'));}if(_0x2c695c[_0x78b9('0x13')]){if(moment(_0x2c695c['blockedAt'])['add'](_0x2683a7[_0x78b9('0xd')],'minutes')>moment()){throw new Error('The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.');}else{_0x2c695c['blocked']=![];_0x2c695c[_0x78b9('0x1a')]=null;}}_0x2c695c[_0x78b9('0x43')]=_0x16293f;_0x2c695c[_0x78b9('0x44')]=Date[_0x78b9('0x45')]()+0x36ee80;return _0x2c695c[_0x78b9('0x46')]();})['then'](function(){return sendServiceMail({'to':_0x3344d0[_0x78b9('0x3c')]['email'],'subject':'xCally\x20Motion\x20Password\x20Reset','text':'You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a'+'Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a'+_0x78b9('0x47')+_0x3344d0[_0x78b9('0x48')][_0x78b9('0x26')]+_0x78b9('0x49')+_0x16293f+'\x0a\x0a'+_0x78b9('0x4a')});})[_0x78b9('0xe')](function(){_0x3d6ab9[_0x78b9('0x34')](0xc8)[_0x78b9('0x4b')]({'message':_0x78b9('0x4c')});})['catch'](function(_0x5cb230){return handleError(_0x3d6ab9,0x1f4,_0x5cb230);});};exports['reset']=function(_0x49ee9e,_0x40d991,_0x3edd33){var _0x4222b0;return db[_0x78b9('0x40')][_0x78b9('0x20')]({'where':{'resetPasswordToken':_0x49ee9e[_0x78b9('0x4d')][_0x78b9('0x4e')],'resetPasswordExpires':{'$gt':Date['now']()}}})['then'](function(_0x546b7a){_0x4222b0=_0x546b7a;if(!_0x4222b0){throw new Error('Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.');}return db[_0x78b9('0xa')]['findOne']({'attributes':['id','securePassword']});})[_0x78b9('0xe')](function(_0x2af939){return checkPasswordPattern(_0x2af939,_0x49ee9e['body'][_0x78b9('0x10')],_0x2af939[_0x78b9('0x4f')]);})[_0x78b9('0xe')](function(){_0x4222b0[_0x78b9('0x10')]=_0x49ee9e[_0x78b9('0x3c')][_0x78b9('0x10')];_0x4222b0['resetPasswordToken']=null;_0x4222b0['resetPasswordExpires']=null;return _0x4222b0[_0x78b9('0x46')]();})['then'](function(){_0x40d991['status'](0xc8)[_0x78b9('0x4b')]({'message':_0x78b9('0x50')});})['catch'](function(_0x24af9f){return handleError(_0x40d991,0x1f4,_0x24af9f);});};passport[_0x78b9('0x51')](new LocalStrategy({'usernameField':_0x78b9('0xf'),'passwordField':'password'},function(_0x5348e8,_0x20ed93,_0x2d42e7){return localAuthenticate(db[_0x78b9('0x40')],_0x5348e8,_0x20ed93,_0x2d42e7);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 5d27535..6c2985b 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 _0x8636=['exports','Router','./authLocal.controller','post','login','/forgot','forgot','/reset/:token','reset'];(function(_0x46e114,_0x34049a){var _0x29cf07=function(_0x43efe2){while(--_0x43efe2){_0x46e114['push'](_0x46e114['shift']());}};_0x29cf07(++_0x34049a);}(_0x8636,0xc7));var _0x6863=function(_0xfc7019,_0x277c9e){_0xfc7019=_0xfc7019-0x0;var _0x2af8f4=_0x8636[_0xfc7019];return _0x2af8f4;};'use strict';var express=require('express');var router=express[_0x6863('0x0')]();var controller=require(_0x6863('0x1'));router[_0x6863('0x2')]('/',controller[_0x6863('0x3')]);router[_0x6863('0x2')](_0x6863('0x4'),controller[_0x6863('0x5')]);router[_0x6863('0x2')](_0x6863('0x6'),controller[_0x6863('0x7')]);module[_0x6863('0x8')]=router; \ No newline at end of file +var _0x6327=['/reset/:token','exports','Router','./authLocal.controller','post','/forgot','forgot'];(function(_0xfc406a,_0x4479e1){var _0x395473=function(_0x1fe8b6){while(--_0x1fe8b6){_0xfc406a['push'](_0xfc406a['shift']());}};_0x395473(++_0x4479e1);}(_0x6327,0x191));var _0x7632=function(_0x4defd6,_0x37bbd3){_0x4defd6=_0x4defd6-0x0;var _0x4c9276=_0x6327[_0x4defd6];return _0x4c9276;};'use strict';var express=require('express');var router=express[_0x7632('0x0')]();var controller=require(_0x7632('0x1'));router[_0x7632('0x2')]('/',controller['login']);router['post'](_0x7632('0x3'),controller[_0x7632('0x4')]);router['post'](_0x7632('0x5'),controller['reset']);module[_0x7632('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 8d19756..659f215 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 _0x7d96=['STRING','BOOLEAN','INTEGER','sequelize','exports'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x7d96,0xe4));var _0x67d9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7d96[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x67d9('0x0'));module[_0x67d9('0x1')]={'name':{'type':Sequelize[_0x67d9('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0x67d9('0x2')]},'description':{'type':Sequelize[_0x67d9('0x2')]},'status':{'type':Sequelize[_0x67d9('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x67d9('0x4')],'defaultValue':0xa}}; \ No newline at end of file +var _0x5341=['INTEGER','sequelize','exports','STRING'];(function(_0x23c709,_0x59b223){var _0x1e7265=function(_0x4a0b2e){while(--_0x4a0b2e){_0x23c709['push'](_0x23c709['shift']());}};_0x1e7265(++_0x59b223);}(_0x5341,0x91));var _0x1534=function(_0x3cc741,_0x1ee2b8){_0x3cc741=_0x3cc741-0x0;var _0x5d13e0=_0x5341[_0x3cc741];return _0x5d13e0;};'use strict';var Sequelize=require(_0x1534('0x0'));module[_0x1534('0x1')]={'name':{'type':Sequelize[_0x1534('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0x1534('0x2')]},'description':{'type':Sequelize[_0x1534('0x2')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timeout':{'type':Sequelize[_0x1534('0x3')],'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 aea115f..b0c96a8 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 _0xc60d=['then','end','error','stack','name','index','map','Automation','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','params','rawAttributes','find','create','body','addConditions','Condition','ids','omit','getConditions','findOne','limit','addActions','Action','getActions','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','sox','to-csv','lodash','squel','crypto','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','reject','save','update'];(function(_0x2d299b,_0x298102){var _0x4a1b80=function(_0x3e2d56){while(--_0x3e2d56){_0x2d299b['push'](_0x2d299b['shift']());}};_0x4a1b80(++_0x298102);}(_0xc60d,0xcb));var _0xdc60=function(_0x2c4cee,_0xed54d6){_0x2c4cee=_0x2c4cee-0x0;var _0x4cad54=_0xc60d[_0x2c4cee];return _0x4cad54;};'use strict';var pdf=require(_0xdc60('0x0'));var emlformat=require(_0xdc60('0x1'));var rimraf=require(_0xdc60('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xdc60('0x3'));var rp=require('request-promise');var moment=require(_0xdc60('0x4'));var BPromise=require(_0xdc60('0x5'));var Mustache=require(_0xdc60('0x6'));var util=require('util');var path=require('path');var sox=require(_0xdc60('0x7'));var csv=require(_0xdc60('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xdc60('0x9'));var squel=require(_0xdc60('0xa'));var crypto=require(_0xdc60('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xdc60('0xc'));var toCsv=require(_0xdc60('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xdc60('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xdc60('0xe'));var as=require(_0xdc60('0xf'));var hardwareService=require(_0xdc60('0x10'));var logger=require(_0xdc60('0x11'))('api');var utils=require(_0xdc60('0x12'));var config=require(_0xdc60('0x13'));var db=require(_0xdc60('0x14'))['db'];function respondWithStatusCode(_0x1faf08,_0x2b1c86){_0x2b1c86=_0x2b1c86||0xcc;return function(_0x3a1be3){if(_0x3a1be3){return _0x1faf08[_0xdc60('0x15')](_0x2b1c86);}return _0x1faf08['status'](_0x2b1c86)['end']();};}function respondWithResult(_0x207ef8,_0x59720b){_0x59720b=_0x59720b||0xc8;return function(_0x4a4875){if(_0x4a4875){return _0x207ef8[_0xdc60('0x16')](_0x59720b)[_0xdc60('0x17')](_0x4a4875);}};}function respondWithFilteredResult(_0x520ae7,_0x933cba){return function(_0x630b57){if(_0x630b57){var _0x4dfa01=_0x630b57[_0xdc60('0x18')],_0x2d7e9a=_0x933cba[_0xdc60('0x19')],_0x544c87=_0x933cba[_0xdc60('0x19')]+_0x933cba['limit'],_0x3a0276;if(_0x544c87>=_0x4dfa01){_0x544c87=_0x4dfa01;_0x3a0276=0xc8;}else{_0x3a0276=0xce;}_0x520ae7[_0xdc60('0x16')](_0x3a0276);return _0x520ae7[_0xdc60('0x1a')](_0xdc60('0x1b'),_0x2d7e9a+'-'+_0x544c87+'/'+_0x4dfa01)[_0xdc60('0x17')](_0x630b57);}return null;};}function patchUpdates(_0x33f50f){return function(_0x58a675){try{jsonpatch['apply'](_0x58a675,_0x33f50f,!![]);}catch(_0x548a77){return BPromise[_0xdc60('0x1c')](_0x548a77);}return _0x58a675[_0xdc60('0x1d')]();};}function saveUpdates(_0x3f6a7e,_0x21ae9f){return function(_0x33d5eb){if(_0x33d5eb){return _0x33d5eb[_0xdc60('0x1e')](_0x3f6a7e)[_0xdc60('0x1f')](function(_0x4b26a8){return _0x4b26a8;});}return null;};}function removeEntity(_0x3fa3a0,_0x246db6){return function(_0x38729a){if(_0x38729a){return _0x38729a['destroy']()[_0xdc60('0x1f')](function(){_0x3fa3a0[_0xdc60('0x16')](0xcc)[_0xdc60('0x20')]();});}};}function handleEntityNotFound(_0x3b4910,_0x4395f6){return function(_0x103c1f){if(!_0x103c1f){_0x3b4910['sendStatus'](0x194);}return _0x103c1f;};}function handleError(_0x22c0d7,_0x540084){_0x540084=_0x540084||0x1f4;return function(_0x29d337){logger[_0xdc60('0x21')](_0x29d337[_0xdc60('0x22')]);if(_0x29d337[_0xdc60('0x23')]){delete _0x29d337[_0xdc60('0x23')];}_0x22c0d7['status'](_0x540084)['send'](_0x29d337);};}exports[_0xdc60('0x24')]=function(_0x42b9d6,_0x2e5ad6){var _0xee179a={},_0xd34368={},_0x274ff2={'count':0x0,'rows':[]};var _0x4b7c66=_[_0xdc60('0x25')](db[_0xdc60('0x26')]['rawAttributes'],function(_0x2ad323){return{'name':_0x2ad323['fieldName'],'type':_0x2ad323[_0xdc60('0x27')]['key']};});_0xd34368['model']=_[_0xdc60('0x25')](_0x4b7c66,_0xdc60('0x23'));_0xd34368[_0xdc60('0x28')]=_[_0xdc60('0x29')](_0x42b9d6[_0xdc60('0x28')]);_0xd34368[_0xdc60('0x2a')]=_[_0xdc60('0x2b')](_0xd34368[_0xdc60('0x2c')],_0xd34368[_0xdc60('0x28')]);_0xee179a[_0xdc60('0x2d')]=_['intersection'](_0xd34368['model'],qs['fields'](_0x42b9d6['query'][_0xdc60('0x2e')]));_0xee179a['attributes']=_0xee179a[_0xdc60('0x2d')][_0xdc60('0x2f')]?_0xee179a[_0xdc60('0x2d')]:_0xd34368[_0xdc60('0x2c')];if(!_0x42b9d6[_0xdc60('0x28')][_0xdc60('0x30')](_0xdc60('0x31'))){_0xee179a['limit']=qs['limit'](_0x42b9d6[_0xdc60('0x28')]['limit']);_0xee179a[_0xdc60('0x19')]=qs[_0xdc60('0x19')](_0x42b9d6[_0xdc60('0x28')][_0xdc60('0x19')]);}_0xee179a[_0xdc60('0x32')]=qs[_0xdc60('0x33')](_0x42b9d6[_0xdc60('0x28')]['sort']);_0xee179a[_0xdc60('0x34')]=qs[_0xdc60('0x2a')](_[_0xdc60('0x35')](_0x42b9d6[_0xdc60('0x28')],_0xd34368[_0xdc60('0x2a')]));if(_0x42b9d6[_0xdc60('0x28')]['filter']){_0xee179a['where']=_[_0xdc60('0x36')](_0xee179a[_0xdc60('0x34')],{'$or':_[_0xdc60('0x25')](_0x4b7c66,function(_0x323511){if(_0x323511[_0xdc60('0x27')]!==_0xdc60('0x37')){var _0x19f79e={};_0x19f79e[_0x323511[_0xdc60('0x23')]]={'$like':'%'+_0x42b9d6[_0xdc60('0x28')][_0xdc60('0x38')]+'%'};return _0x19f79e;}})});}_0xee179a=_[_0xdc60('0x36')]({},_0xee179a,_0x42b9d6[_0xdc60('0x39')]);var _0x320545={'where':_0xee179a[_0xdc60('0x34')]};return db[_0xdc60('0x26')][_0xdc60('0x18')](_0x320545)[_0xdc60('0x1f')](function(_0x502951){_0x274ff2[_0xdc60('0x18')]=_0x502951;if(_0x42b9d6[_0xdc60('0x28')][_0xdc60('0x3a')]){_0xee179a[_0xdc60('0x3b')]=[{'all':!![]}];}return db[_0xdc60('0x26')][_0xdc60('0x3c')](_0xee179a);})['then'](function(_0x402c4c){_0x274ff2[_0xdc60('0x3d')]=_0x402c4c;return _0x274ff2;})[_0xdc60('0x1f')](respondWithFilteredResult(_0x2e5ad6,_0xee179a))[_0xdc60('0x3e')](handleError(_0x2e5ad6,null));};exports['show']=function(_0x6aa02e,_0x161280){var _0x388435={'raw':![],'where':{'id':_0x6aa02e[_0xdc60('0x3f')]['id']}},_0x3d32f2={};_0x3d32f2[_0xdc60('0x2c')]=_[_0xdc60('0x29')](db['Automation'][_0xdc60('0x40')]);_0x3d32f2[_0xdc60('0x28')]=_[_0xdc60('0x29')](_0x6aa02e[_0xdc60('0x28')]);_0x3d32f2[_0xdc60('0x2a')]=_[_0xdc60('0x2b')](_0x3d32f2[_0xdc60('0x2c')],_0x3d32f2['query']);_0x388435[_0xdc60('0x2d')]=_['intersection'](_0x3d32f2[_0xdc60('0x2c')],qs[_0xdc60('0x2e')](_0x6aa02e[_0xdc60('0x28')][_0xdc60('0x2e')]));_0x388435[_0xdc60('0x2d')]=_0x388435[_0xdc60('0x2d')][_0xdc60('0x2f')]?_0x388435[_0xdc60('0x2d')]:_0x3d32f2[_0xdc60('0x2c')];if(_0x6aa02e['query'][_0xdc60('0x3a')]){_0x388435['include']=[{'all':!![]}];}_0x388435=_[_0xdc60('0x36')]({},_0x388435,_0x6aa02e[_0xdc60('0x39')]);return db[_0xdc60('0x26')][_0xdc60('0x41')](_0x388435)[_0xdc60('0x1f')](handleEntityNotFound(_0x161280,null))[_0xdc60('0x1f')](respondWithResult(_0x161280,null))[_0xdc60('0x3e')](handleError(_0x161280,null));};exports[_0xdc60('0x42')]=function(_0x56ac9d,_0x5e48fd){return db[_0xdc60('0x26')]['create'](_0x56ac9d[_0xdc60('0x43')],{})[_0xdc60('0x1f')](respondWithResult(_0x5e48fd,0xc9))[_0xdc60('0x3e')](handleError(_0x5e48fd,null));};exports[_0xdc60('0x1e')]=function(_0x29c84a,_0x40185b){if(_0x29c84a['body']['id']){delete _0x29c84a['body']['id'];}return db[_0xdc60('0x26')][_0xdc60('0x41')]({'where':{'id':_0x29c84a['params']['id']}})['then'](handleEntityNotFound(_0x40185b,null))[_0xdc60('0x1f')](saveUpdates(_0x29c84a['body'],null))[_0xdc60('0x1f')](respondWithResult(_0x40185b,null))[_0xdc60('0x3e')](handleError(_0x40185b,null));};exports['destroy']=function(_0x1124bb,_0x32ccf8){return db[_0xdc60('0x26')][_0xdc60('0x41')]({'where':{'id':_0x1124bb[_0xdc60('0x3f')]['id']}})[_0xdc60('0x1f')](handleEntityNotFound(_0x32ccf8,null))['then'](removeEntity(_0x32ccf8,null))[_0xdc60('0x3e')](handleError(_0x32ccf8,null));};exports[_0xdc60('0x44')]=function(_0xce2f9a,_0x3d9126,_0x158c00){return db[_0xdc60('0x45')][_0xdc60('0x41')]({'where':{'id':_0xce2f9a['params']['id']}})[_0xdc60('0x1f')](handleEntityNotFound(_0x3d9126,null))[_0xdc60('0x1f')](function(_0x7ab559){if(_0x7ab559){return _0x7ab559[_0xdc60('0x44')](_0xce2f9a[_0xdc60('0x43')][_0xdc60('0x46')],_[_0xdc60('0x47')](_0xce2f9a[_0xdc60('0x43')],[_0xdc60('0x46'),'id'])||{});}})[_0xdc60('0x1f')](respondWithResult(_0x3d9126,null))[_0xdc60('0x3e')](handleError(_0x3d9126,null));};exports[_0xdc60('0x48')]=function(_0x1c4bbb,_0x5da584,_0x3d0c08){var _0x3a0cb0={};var _0x2e4f2e={};var _0x46e778;var _0x22e045;return db[_0xdc60('0x26')][_0xdc60('0x49')]({'where':{'id':_0x1c4bbb[_0xdc60('0x3f')]['id']}})[_0xdc60('0x1f')](handleEntityNotFound(_0x5da584,null))[_0xdc60('0x1f')](function(_0x58136b){if(_0x58136b){_0x46e778=_0x58136b;_0x2e4f2e[_0xdc60('0x2c')]=_['keys'](db['Condition']['rawAttributes']);_0x2e4f2e['query']=_[_0xdc60('0x29')](_0x1c4bbb[_0xdc60('0x28')]);_0x2e4f2e[_0xdc60('0x2a')]=_[_0xdc60('0x2b')](_0x2e4f2e[_0xdc60('0x2c')],_0x2e4f2e[_0xdc60('0x28')]);_0x3a0cb0[_0xdc60('0x2d')]=_['intersection'](_0x2e4f2e[_0xdc60('0x2c')],qs['fields'](_0x1c4bbb[_0xdc60('0x28')][_0xdc60('0x2e')]));_0x3a0cb0[_0xdc60('0x2d')]=_0x3a0cb0['attributes'][_0xdc60('0x2f')]?_0x3a0cb0['attributes']:_0x2e4f2e[_0xdc60('0x2c')];_0x3a0cb0[_0xdc60('0x32')]=qs[_0xdc60('0x33')](_0x1c4bbb['query'][_0xdc60('0x33')]);_0x3a0cb0['where']=qs['filters'](_[_0xdc60('0x35')](_0x1c4bbb[_0xdc60('0x28')],_0x2e4f2e[_0xdc60('0x2a')]));if(_0x1c4bbb[_0xdc60('0x28')][_0xdc60('0x38')]){_0x3a0cb0[_0xdc60('0x34')]=_[_0xdc60('0x36')](_0x3a0cb0['where'],{'$or':_[_0xdc60('0x25')](_0x3a0cb0[_0xdc60('0x2d')],function(_0x3737a8){var _0x1908e5={};_0x1908e5[_0x3737a8]={'$like':'%'+_0x1c4bbb[_0xdc60('0x28')][_0xdc60('0x38')]+'%'};return _0x1908e5;})});}_0x3a0cb0=_[_0xdc60('0x36')]({},_0x3a0cb0,_0x1c4bbb['options']);return _0x46e778[_0xdc60('0x48')](_0x3a0cb0);}})[_0xdc60('0x1f')](function(_0x39811f){if(_0x39811f){_0x22e045=_0x39811f['length'];if(!_0x1c4bbb[_0xdc60('0x28')][_0xdc60('0x30')]('nolimit')){_0x3a0cb0[_0xdc60('0x4a')]=qs[_0xdc60('0x4a')](_0x1c4bbb[_0xdc60('0x28')][_0xdc60('0x4a')]);_0x3a0cb0[_0xdc60('0x19')]=qs['offset'](_0x1c4bbb[_0xdc60('0x28')]['offset']);}return _0x46e778[_0xdc60('0x48')](_0x3a0cb0);}})[_0xdc60('0x1f')](function(_0x1d30c2){if(_0x1d30c2){return _0x1d30c2?{'count':_0x22e045,'rows':_0x1d30c2}:null;}})[_0xdc60('0x1f')](respondWithResult(_0x5da584,null))[_0xdc60('0x3e')](handleError(_0x5da584,null));};exports[_0xdc60('0x4b')]=function(_0x434fbc,_0x2a2de4,_0x1c1400){return db[_0xdc60('0x4c')]['find']({'where':{'id':_0x434fbc[_0xdc60('0x3f')]['id']}})[_0xdc60('0x1f')](handleEntityNotFound(_0x2a2de4,null))[_0xdc60('0x1f')](function(_0x17aa9a){if(_0x17aa9a){return _0x17aa9a[_0xdc60('0x4b')](_0x434fbc[_0xdc60('0x43')][_0xdc60('0x46')],_[_0xdc60('0x47')](_0x434fbc[_0xdc60('0x43')],[_0xdc60('0x46'),'id'])||{});}})[_0xdc60('0x1f')](respondWithResult(_0x2a2de4,null))[_0xdc60('0x3e')](handleError(_0x2a2de4,null));};exports[_0xdc60('0x4d')]=function(_0x38aeaf,_0x314f1c,_0x4a5f89){var _0x4df928={};var _0x260067={};var _0x2970a9;var _0x2e5dc4;return db[_0xdc60('0x26')][_0xdc60('0x49')]({'where':{'id':_0x38aeaf[_0xdc60('0x3f')]['id']}})[_0xdc60('0x1f')](handleEntityNotFound(_0x314f1c,null))[_0xdc60('0x1f')](function(_0x18a366){if(_0x18a366){_0x2970a9=_0x18a366;_0x260067[_0xdc60('0x2c')]=_[_0xdc60('0x29')](db[_0xdc60('0x4c')]['rawAttributes']);_0x260067[_0xdc60('0x28')]=_['keys'](_0x38aeaf[_0xdc60('0x28')]);_0x260067[_0xdc60('0x2a')]=_['intersection'](_0x260067['model'],_0x260067['query']);_0x4df928['attributes']=_[_0xdc60('0x2b')](_0x260067[_0xdc60('0x2c')],qs[_0xdc60('0x2e')](_0x38aeaf['query'][_0xdc60('0x2e')]));_0x4df928[_0xdc60('0x2d')]=_0x4df928['attributes'][_0xdc60('0x2f')]?_0x4df928[_0xdc60('0x2d')]:_0x260067[_0xdc60('0x2c')];_0x4df928['order']=qs['sort'](_0x38aeaf['query']['sort']);_0x4df928['where']=qs[_0xdc60('0x2a')](_['pick'](_0x38aeaf['query'],_0x260067[_0xdc60('0x2a')]));if(_0x38aeaf[_0xdc60('0x28')][_0xdc60('0x38')]){_0x4df928['where']=_[_0xdc60('0x36')](_0x4df928[_0xdc60('0x34')],{'$or':_[_0xdc60('0x25')](_0x4df928[_0xdc60('0x2d')],function(_0x864f8f){var _0x344e97={};_0x344e97[_0x864f8f]={'$like':'%'+_0x38aeaf[_0xdc60('0x28')]['filter']+'%'};return _0x344e97;})});}_0x4df928=_[_0xdc60('0x36')]({},_0x4df928,_0x38aeaf[_0xdc60('0x39')]);return _0x2970a9[_0xdc60('0x4d')](_0x4df928);}})[_0xdc60('0x1f')](function(_0x32bd7d){if(_0x32bd7d){_0x2e5dc4=_0x32bd7d[_0xdc60('0x2f')];if(!_0x38aeaf[_0xdc60('0x28')][_0xdc60('0x30')](_0xdc60('0x31'))){_0x4df928[_0xdc60('0x4a')]=qs[_0xdc60('0x4a')](_0x38aeaf['query'][_0xdc60('0x4a')]);_0x4df928[_0xdc60('0x19')]=qs[_0xdc60('0x19')](_0x38aeaf['query'][_0xdc60('0x19')]);}return _0x2970a9['getActions'](_0x4df928);}})[_0xdc60('0x1f')](function(_0x94ae20){if(_0x94ae20){return _0x94ae20?{'count':_0x2e5dc4,'rows':_0x94ae20}:null;}})[_0xdc60('0x1f')](respondWithResult(_0x314f1c,null))[_0xdc60('0x3e')](handleError(_0x314f1c,null));}; \ No newline at end of file +var _0xb7be=['key','model','map','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','options','includeAll','include','then','catch','show','params','length','merge','find','create','body','addConditions','Condition','omit','getConditions','findOne','addActions','ids','getActions','Action','pick','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','status','json','count','offset','limit','set','apply','update','destroy','end','sendStatus','error','name','index','Automation','rawAttributes','fieldName','type'];(function(_0x2078e5,_0x5931cf){var _0x14a1e3=function(_0x470baa){while(--_0x470baa){_0x2078e5['push'](_0x2078e5['shift']());}};_0x14a1e3(++_0x5931cf);}(_0xb7be,0x1ac));var _0xeb7b=function(_0x3d41d7,_0x34c1bb){_0x3d41d7=_0x3d41d7-0x0;var _0x47af32=_0xb7be[_0x3d41d7];return _0x47af32;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xeb7b('0x0'));var rimraf=require(_0xeb7b('0x1'));var zipdir=require(_0xeb7b('0x2'));var jsonpatch=require(_0xeb7b('0x3'));var rp=require(_0xeb7b('0x4'));var moment=require(_0xeb7b('0x5'));var BPromise=require(_0xeb7b('0x6'));var Mustache=require(_0xeb7b('0x7'));var util=require(_0xeb7b('0x8'));var path=require(_0xeb7b('0x9'));var sox=require(_0xeb7b('0xa'));var csv=require(_0xeb7b('0xb'));var ejs=require(_0xeb7b('0xc'));var fs=require('fs');var _=require(_0xeb7b('0xd'));var squel=require('squel');var crypto=require(_0xeb7b('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xeb7b('0xf'));var toCsv=require(_0xeb7b('0xb'));var querystring=require(_0xeb7b('0x10'));var Papa=require(_0xeb7b('0x11'));var Redis=require(_0xeb7b('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xeb7b('0x13'));var hardwareService=require(_0xeb7b('0x14'));var logger=require(_0xeb7b('0x15'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3db099,_0x9d84c9){_0x9d84c9=_0x9d84c9||0xcc;return function(_0x14d384){if(_0x14d384){return _0x3db099['sendStatus'](_0x9d84c9);}return _0x3db099[_0xeb7b('0x16')](_0x9d84c9)['end']();};}function respondWithResult(_0x1eb032,_0x5f3634){_0x5f3634=_0x5f3634||0xc8;return function(_0x3cc982){if(_0x3cc982){return _0x1eb032[_0xeb7b('0x16')](_0x5f3634)[_0xeb7b('0x17')](_0x3cc982);}};}function respondWithFilteredResult(_0x43c295,_0x26d135){return function(_0x48ca07){if(_0x48ca07){var _0x2db65b=_0x48ca07[_0xeb7b('0x18')],_0x12d992=_0x26d135[_0xeb7b('0x19')],_0x124171=_0x26d135[_0xeb7b('0x19')]+_0x26d135[_0xeb7b('0x1a')],_0x4884aa;if(_0x124171>=_0x2db65b){_0x124171=_0x2db65b;_0x4884aa=0xc8;}else{_0x4884aa=0xce;}_0x43c295[_0xeb7b('0x16')](_0x4884aa);return _0x43c295[_0xeb7b('0x1b')]('Content-Range',_0x12d992+'-'+_0x124171+'/'+_0x2db65b)[_0xeb7b('0x17')](_0x48ca07);}return null;};}function patchUpdates(_0x32e36d){return function(_0xfc9426){try{jsonpatch[_0xeb7b('0x1c')](_0xfc9426,_0x32e36d,!![]);}catch(_0x13af0c){return BPromise['reject'](_0x13af0c);}return _0xfc9426['save']();};}function saveUpdates(_0x25dd34,_0x3e9fb9){return function(_0x2cd38f){if(_0x2cd38f){return _0x2cd38f[_0xeb7b('0x1d')](_0x25dd34)['then'](function(_0x173fcf){return _0x173fcf;});}return null;};}function removeEntity(_0x27a4d2,_0x51ac4d){return function(_0x3b3d9a){if(_0x3b3d9a){return _0x3b3d9a[_0xeb7b('0x1e')]()['then'](function(){_0x27a4d2[_0xeb7b('0x16')](0xcc)[_0xeb7b('0x1f')]();});}};}function handleEntityNotFound(_0x3e8ec2,_0x330542){return function(_0x1ff3db){if(!_0x1ff3db){_0x3e8ec2[_0xeb7b('0x20')](0x194);}return _0x1ff3db;};}function handleError(_0x12c196,_0x4c5425){_0x4c5425=_0x4c5425||0x1f4;return function(_0x4e9989){logger[_0xeb7b('0x21')](_0x4e9989['stack']);if(_0x4e9989['name']){delete _0x4e9989[_0xeb7b('0x22')];}_0x12c196[_0xeb7b('0x16')](_0x4c5425)['send'](_0x4e9989);};}exports[_0xeb7b('0x23')]=function(_0x10075b,_0x212783){var _0x200723={},_0xbc6141={},_0x2bdeb5={'count':0x0,'rows':[]};var _0x1f0610=_['map'](db[_0xeb7b('0x24')][_0xeb7b('0x25')],function(_0x383d80){return{'name':_0x383d80[_0xeb7b('0x26')],'type':_0x383d80[_0xeb7b('0x27')][_0xeb7b('0x28')]};});_0xbc6141[_0xeb7b('0x29')]=_[_0xeb7b('0x2a')](_0x1f0610,_0xeb7b('0x22'));_0xbc6141['query']=_[_0xeb7b('0x2b')](_0x10075b[_0xeb7b('0x2c')]);_0xbc6141[_0xeb7b('0x2d')]=_[_0xeb7b('0x2e')](_0xbc6141[_0xeb7b('0x29')],_0xbc6141[_0xeb7b('0x2c')]);_0x200723[_0xeb7b('0x2f')]=_['intersection'](_0xbc6141[_0xeb7b('0x29')],qs[_0xeb7b('0x30')](_0x10075b[_0xeb7b('0x2c')][_0xeb7b('0x30')]));_0x200723[_0xeb7b('0x2f')]=_0x200723[_0xeb7b('0x2f')]['length']?_0x200723[_0xeb7b('0x2f')]:_0xbc6141['model'];if(!_0x10075b[_0xeb7b('0x2c')][_0xeb7b('0x31')](_0xeb7b('0x32'))){_0x200723[_0xeb7b('0x1a')]=qs[_0xeb7b('0x1a')](_0x10075b[_0xeb7b('0x2c')][_0xeb7b('0x1a')]);_0x200723[_0xeb7b('0x19')]=qs[_0xeb7b('0x19')](_0x10075b[_0xeb7b('0x2c')][_0xeb7b('0x19')]);}_0x200723[_0xeb7b('0x33')]=qs[_0xeb7b('0x34')](_0x10075b[_0xeb7b('0x2c')][_0xeb7b('0x34')]);_0x200723[_0xeb7b('0x35')]=qs['filters'](_['pick'](_0x10075b[_0xeb7b('0x2c')],_0xbc6141[_0xeb7b('0x2d')]));if(_0x10075b[_0xeb7b('0x2c')][_0xeb7b('0x36')]){_0x200723[_0xeb7b('0x35')]=_['merge'](_0x200723[_0xeb7b('0x35')],{'$or':_[_0xeb7b('0x2a')](_0x1f0610,function(_0x59906a){if(_0x59906a[_0xeb7b('0x27')]!==_0xeb7b('0x37')){var _0x55166d={};_0x55166d[_0x59906a[_0xeb7b('0x22')]]={'$like':'%'+_0x10075b['query'][_0xeb7b('0x36')]+'%'};return _0x55166d;}})});}_0x200723=_['merge']({},_0x200723,_0x10075b[_0xeb7b('0x38')]);var _0x5cb621={'where':_0x200723['where']};return db[_0xeb7b('0x24')][_0xeb7b('0x18')](_0x5cb621)['then'](function(_0x1b458e){_0x2bdeb5[_0xeb7b('0x18')]=_0x1b458e;if(_0x10075b[_0xeb7b('0x2c')][_0xeb7b('0x39')]){_0x200723[_0xeb7b('0x3a')]=[{'all':!![]}];}return db[_0xeb7b('0x24')]['findAll'](_0x200723);})[_0xeb7b('0x3b')](function(_0x324f3f){_0x2bdeb5['rows']=_0x324f3f;return _0x2bdeb5;})['then'](respondWithFilteredResult(_0x212783,_0x200723))[_0xeb7b('0x3c')](handleError(_0x212783,null));};exports[_0xeb7b('0x3d')]=function(_0x27d748,_0x39a506){var _0x36dca7={'raw':![],'where':{'id':_0x27d748[_0xeb7b('0x3e')]['id']}},_0x1f6015={};_0x1f6015[_0xeb7b('0x29')]=_[_0xeb7b('0x2b')](db[_0xeb7b('0x24')][_0xeb7b('0x25')]);_0x1f6015[_0xeb7b('0x2c')]=_[_0xeb7b('0x2b')](_0x27d748[_0xeb7b('0x2c')]);_0x1f6015[_0xeb7b('0x2d')]=_[_0xeb7b('0x2e')](_0x1f6015[_0xeb7b('0x29')],_0x1f6015[_0xeb7b('0x2c')]);_0x36dca7[_0xeb7b('0x2f')]=_['intersection'](_0x1f6015[_0xeb7b('0x29')],qs[_0xeb7b('0x30')](_0x27d748['query'][_0xeb7b('0x30')]));_0x36dca7[_0xeb7b('0x2f')]=_0x36dca7[_0xeb7b('0x2f')][_0xeb7b('0x3f')]?_0x36dca7[_0xeb7b('0x2f')]:_0x1f6015[_0xeb7b('0x29')];if(_0x27d748[_0xeb7b('0x2c')][_0xeb7b('0x39')]){_0x36dca7['include']=[{'all':!![]}];}_0x36dca7=_[_0xeb7b('0x40')]({},_0x36dca7,_0x27d748['options']);return db[_0xeb7b('0x24')][_0xeb7b('0x41')](_0x36dca7)[_0xeb7b('0x3b')](handleEntityNotFound(_0x39a506,null))[_0xeb7b('0x3b')](respondWithResult(_0x39a506,null))['catch'](handleError(_0x39a506,null));};exports[_0xeb7b('0x42')]=function(_0x18185b,_0x5ae0de){return db[_0xeb7b('0x24')]['create'](_0x18185b[_0xeb7b('0x43')],{})[_0xeb7b('0x3b')](respondWithResult(_0x5ae0de,0xc9))[_0xeb7b('0x3c')](handleError(_0x5ae0de,null));};exports[_0xeb7b('0x1d')]=function(_0x478ff1,_0x535054){if(_0x478ff1[_0xeb7b('0x43')]['id']){delete _0x478ff1[_0xeb7b('0x43')]['id'];}return db[_0xeb7b('0x24')][_0xeb7b('0x41')]({'where':{'id':_0x478ff1[_0xeb7b('0x3e')]['id']}})['then'](handleEntityNotFound(_0x535054,null))[_0xeb7b('0x3b')](saveUpdates(_0x478ff1['body'],null))[_0xeb7b('0x3b')](respondWithResult(_0x535054,null))[_0xeb7b('0x3c')](handleError(_0x535054,null));};exports[_0xeb7b('0x1e')]=function(_0x1082f5,_0x188319){return db[_0xeb7b('0x24')][_0xeb7b('0x41')]({'where':{'id':_0x1082f5[_0xeb7b('0x3e')]['id']}})[_0xeb7b('0x3b')](handleEntityNotFound(_0x188319,null))[_0xeb7b('0x3b')](removeEntity(_0x188319,null))[_0xeb7b('0x3c')](handleError(_0x188319,null));};exports[_0xeb7b('0x44')]=function(_0x3cf14c,_0xb22458,_0x1cea2c){return db[_0xeb7b('0x45')][_0xeb7b('0x41')]({'where':{'id':_0x3cf14c['params']['id']}})['then'](handleEntityNotFound(_0xb22458,null))['then'](function(_0x1a88fd){if(_0x1a88fd){return _0x1a88fd['addConditions'](_0x3cf14c['body']['ids'],_[_0xeb7b('0x46')](_0x3cf14c[_0xeb7b('0x43')],['ids','id'])||{});}})[_0xeb7b('0x3b')](respondWithResult(_0xb22458,null))[_0xeb7b('0x3c')](handleError(_0xb22458,null));};exports[_0xeb7b('0x47')]=function(_0x4ccdf4,_0x1c611b,_0x545140){var _0x4164de={};var _0x131c25={};var _0x21fef5;var _0x415976;return db[_0xeb7b('0x24')][_0xeb7b('0x48')]({'where':{'id':_0x4ccdf4[_0xeb7b('0x3e')]['id']}})[_0xeb7b('0x3b')](handleEntityNotFound(_0x1c611b,null))[_0xeb7b('0x3b')](function(_0x44a8b6){if(_0x44a8b6){_0x21fef5=_0x44a8b6;_0x131c25[_0xeb7b('0x29')]=_['keys'](db[_0xeb7b('0x45')][_0xeb7b('0x25')]);_0x131c25[_0xeb7b('0x2c')]=_['keys'](_0x4ccdf4['query']);_0x131c25[_0xeb7b('0x2d')]=_[_0xeb7b('0x2e')](_0x131c25['model'],_0x131c25[_0xeb7b('0x2c')]);_0x4164de[_0xeb7b('0x2f')]=_[_0xeb7b('0x2e')](_0x131c25[_0xeb7b('0x29')],qs['fields'](_0x4ccdf4[_0xeb7b('0x2c')]['fields']));_0x4164de[_0xeb7b('0x2f')]=_0x4164de[_0xeb7b('0x2f')][_0xeb7b('0x3f')]?_0x4164de[_0xeb7b('0x2f')]:_0x131c25[_0xeb7b('0x29')];_0x4164de['order']=qs[_0xeb7b('0x34')](_0x4ccdf4[_0xeb7b('0x2c')][_0xeb7b('0x34')]);_0x4164de[_0xeb7b('0x35')]=qs[_0xeb7b('0x2d')](_['pick'](_0x4ccdf4['query'],_0x131c25[_0xeb7b('0x2d')]));if(_0x4ccdf4[_0xeb7b('0x2c')][_0xeb7b('0x36')]){_0x4164de[_0xeb7b('0x35')]=_[_0xeb7b('0x40')](_0x4164de[_0xeb7b('0x35')],{'$or':_[_0xeb7b('0x2a')](_0x4164de[_0xeb7b('0x2f')],function(_0x34b22e){var _0x43a236={};_0x43a236[_0x34b22e]={'$like':'%'+_0x4ccdf4['query']['filter']+'%'};return _0x43a236;})});}_0x4164de=_[_0xeb7b('0x40')]({},_0x4164de,_0x4ccdf4['options']);return _0x21fef5[_0xeb7b('0x47')](_0x4164de);}})[_0xeb7b('0x3b')](function(_0x12637d){if(_0x12637d){_0x415976=_0x12637d[_0xeb7b('0x3f')];if(!_0x4ccdf4['query'][_0xeb7b('0x31')]('nolimit')){_0x4164de[_0xeb7b('0x1a')]=qs[_0xeb7b('0x1a')](_0x4ccdf4[_0xeb7b('0x2c')][_0xeb7b('0x1a')]);_0x4164de['offset']=qs[_0xeb7b('0x19')](_0x4ccdf4[_0xeb7b('0x2c')]['offset']);}return _0x21fef5['getConditions'](_0x4164de);}})['then'](function(_0x3bd591){if(_0x3bd591){return _0x3bd591?{'count':_0x415976,'rows':_0x3bd591}:null;}})['then'](respondWithResult(_0x1c611b,null))['catch'](handleError(_0x1c611b,null));};exports[_0xeb7b('0x49')]=function(_0x1273db,_0x2d2144,_0x376fe6){return db['Action'][_0xeb7b('0x41')]({'where':{'id':_0x1273db[_0xeb7b('0x3e')]['id']}})[_0xeb7b('0x3b')](handleEntityNotFound(_0x2d2144,null))[_0xeb7b('0x3b')](function(_0x41414b){if(_0x41414b){return _0x41414b[_0xeb7b('0x49')](_0x1273db[_0xeb7b('0x43')][_0xeb7b('0x4a')],_[_0xeb7b('0x46')](_0x1273db['body'],[_0xeb7b('0x4a'),'id'])||{});}})['then'](respondWithResult(_0x2d2144,null))[_0xeb7b('0x3c')](handleError(_0x2d2144,null));};exports[_0xeb7b('0x4b')]=function(_0x924f66,_0x1e1461,_0x48ab65){var _0x1c0df7={};var _0x1e3e00={};var _0x13a6f1;var _0x3c2b6d;return db[_0xeb7b('0x24')]['findOne']({'where':{'id':_0x924f66[_0xeb7b('0x3e')]['id']}})['then'](handleEntityNotFound(_0x1e1461,null))[_0xeb7b('0x3b')](function(_0x568e34){if(_0x568e34){_0x13a6f1=_0x568e34;_0x1e3e00[_0xeb7b('0x29')]=_[_0xeb7b('0x2b')](db[_0xeb7b('0x4c')][_0xeb7b('0x25')]);_0x1e3e00[_0xeb7b('0x2c')]=_['keys'](_0x924f66[_0xeb7b('0x2c')]);_0x1e3e00[_0xeb7b('0x2d')]=_[_0xeb7b('0x2e')](_0x1e3e00[_0xeb7b('0x29')],_0x1e3e00[_0xeb7b('0x2c')]);_0x1c0df7[_0xeb7b('0x2f')]=_[_0xeb7b('0x2e')](_0x1e3e00[_0xeb7b('0x29')],qs[_0xeb7b('0x30')](_0x924f66['query']['fields']));_0x1c0df7['attributes']=_0x1c0df7[_0xeb7b('0x2f')]['length']?_0x1c0df7[_0xeb7b('0x2f')]:_0x1e3e00[_0xeb7b('0x29')];_0x1c0df7[_0xeb7b('0x33')]=qs[_0xeb7b('0x34')](_0x924f66[_0xeb7b('0x2c')][_0xeb7b('0x34')]);_0x1c0df7['where']=qs[_0xeb7b('0x2d')](_[_0xeb7b('0x4d')](_0x924f66[_0xeb7b('0x2c')],_0x1e3e00[_0xeb7b('0x2d')]));if(_0x924f66['query'][_0xeb7b('0x36')]){_0x1c0df7['where']=_['merge'](_0x1c0df7[_0xeb7b('0x35')],{'$or':_[_0xeb7b('0x2a')](_0x1c0df7[_0xeb7b('0x2f')],function(_0x4fdd86){var _0x557d35={};_0x557d35[_0x4fdd86]={'$like':'%'+_0x924f66['query'][_0xeb7b('0x36')]+'%'};return _0x557d35;})});}_0x1c0df7=_[_0xeb7b('0x40')]({},_0x1c0df7,_0x924f66['options']);return _0x13a6f1['getActions'](_0x1c0df7);}})[_0xeb7b('0x3b')](function(_0x4df835){if(_0x4df835){_0x3c2b6d=_0x4df835[_0xeb7b('0x3f')];if(!_0x924f66[_0xeb7b('0x2c')][_0xeb7b('0x31')]('nolimit')){_0x1c0df7[_0xeb7b('0x1a')]=qs[_0xeb7b('0x1a')](_0x924f66[_0xeb7b('0x2c')][_0xeb7b('0x1a')]);_0x1c0df7[_0xeb7b('0x19')]=qs[_0xeb7b('0x19')](_0x924f66[_0xeb7b('0x2c')][_0xeb7b('0x19')]);}return _0x13a6f1[_0xeb7b('0x4b')](_0x1c0df7);}})[_0xeb7b('0x3b')](function(_0x3105c5){if(_0x3105c5){return _0x3105c5?{'count':_0x3c2b6d,'rows':_0x3105c5}:null;}})['then'](respondWithResult(_0x1e1461,null))[_0xeb7b('0x3c')](handleError(_0x1e1461,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index 46e82ca..4a03dad 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 _0x0d31=['request-promise','path','rimraf','../../config/environment','./automation.attributes','define','tools_automations','api','moment'];(function(_0x37e629,_0x47100e){var _0x21e4a5=function(_0x5ca638){while(--_0x5ca638){_0x37e629['push'](_0x37e629['shift']());}};_0x21e4a5(++_0x47100e);}(_0x0d31,0x178));var _0x10d3=function(_0x56899b,_0x80fce){_0x56899b=_0x56899b-0x0;var _0x47d591=_0x0d31[_0x56899b];return _0x47d591;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x10d3('0x0'));var moment=require(_0x10d3('0x1'));var BPromise=require('bluebird');var rp=require(_0x10d3('0x2'));var fs=require('fs');var path=require(_0x10d3('0x3'));var rimraf=require(_0x10d3('0x4'));var config=require(_0x10d3('0x5'));var attributes=require(_0x10d3('0x6'));module['exports']=function(_0x430db2,_0x711166){return _0x430db2[_0x10d3('0x7')]('Automation',attributes,{'tableName':_0x10d3('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc931=['bluebird','request-promise','path','rimraf','../../config/environment','./automation.attributes','exports','define','Automation','lodash','util','api','moment'];(function(_0x3c8b46,_0x34e053){var _0x4bf0a8=function(_0x4fd53f){while(--_0x4fd53f){_0x3c8b46['push'](_0x3c8b46['shift']());}};_0x4bf0a8(++_0x34e053);}(_0xc931,0x19c));var _0x1c93=function(_0x5cc4ec,_0x2830a2){_0x5cc4ec=_0x5cc4ec-0x0;var _0x389e8e=_0xc931[_0x5cc4ec];return _0x389e8e;};'use strict';var _=require(_0x1c93('0x0'));var util=require(_0x1c93('0x1'));var logger=require('../../config/logger')(_0x1c93('0x2'));var moment=require(_0x1c93('0x3'));var BPromise=require(_0x1c93('0x4'));var rp=require(_0x1c93('0x5'));var fs=require('fs');var path=require(_0x1c93('0x6'));var rimraf=require(_0x1c93('0x7'));var config=require(_0x1c93('0x8'));var attributes=require(_0x1c93('0x9'));module[_0x1c93('0xa')]=function(_0x523781,_0x394ae1){return _0x523781[_0x1c93('0xb')](_0x1c93('0xc'),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 c972eb9..0964585 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 _0x6029=['moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','client','http','request','info','Automation,\x20%s,\x20%s','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','util'];(function(_0x96f74c,_0xfc30a4){var _0x379222=function(_0x1bbde9){while(--_0x1bbde9){_0x96f74c['push'](_0x96f74c['shift']());}};_0x379222(++_0xfc30a4);}(_0x6029,0x18f));var _0x9602=function(_0x50c752,_0x4b521b){_0x50c752=_0x50c752-0x0;var _0x5d5b63=_0x6029[_0x50c752];return _0x5d5b63;};'use strict';var _=require('lodash');var util=require(_0x9602('0x0'));var moment=require(_0x9602('0x1'));var BPromise=require(_0x9602('0x2'));var rs=require(_0x9602('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9602('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x9602('0x5'))('rpc');var config=require(_0x9602('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x9602('0x7')][_0x9602('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4e8d9d,_0x3bec3f,_0xf0b797){return new BPromise(function(_0x2f4c26,_0x9c9b38){return client[_0x9602('0x9')](_0x4e8d9d,_0xf0b797)['then'](function(_0xdad35){logger[_0x9602('0xa')](_0x9602('0xb'),_0x3bec3f,_0x9602('0xc'));logger[_0x9602('0xd')](_0x9602('0xe'),_0x3bec3f,_0x9602('0xc'),JSON['stringify'](_0xdad35));if(_0xdad35['error']){if(_0xdad35['error'][_0x9602('0xf')]===0x1f4){logger[_0x9602('0x10')](_0x9602('0xb'),_0x3bec3f,_0xdad35[_0x9602('0x10')][_0x9602('0x11')]);return _0x9c9b38(_0xdad35[_0x9602('0x10')][_0x9602('0x11')]);}logger[_0x9602('0x10')](_0x9602('0xb'),_0x3bec3f,_0xdad35[_0x9602('0x10')][_0x9602('0x11')]);return _0x2f4c26(_0xdad35[_0x9602('0x10')][_0x9602('0x11')]);}else{logger[_0x9602('0xa')](_0x9602('0xb'),_0x3bec3f,_0x9602('0xc'));_0x2f4c26(_0xdad35[_0x9602('0x12')][_0x9602('0x11')]);}})[_0x9602('0x13')](function(_0x112dff){logger[_0x9602('0x10')]('Automation,\x20%s,\x20%s',_0x3bec3f,_0x112dff);_0x9c9b38(_0x112dff);});});} \ No newline at end of file +var _0x1fbe=['bluebird','ioredis','../../mysqldb','../../config/logger','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'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x1fbe,0xef));var _0xe1fb=function(_0x320839,_0x3a18a5){_0x320839=_0x320839-0x0;var _0x29387e=_0x1fbe[_0x320839];return _0x29387e;};'use strict';var _=require(_0xe1fb('0x0'));var util=require(_0xe1fb('0x1'));var moment=require(_0xe1fb('0x2'));var BPromise=require(_0xe1fb('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe1fb('0x4'));var db=require(_0xe1fb('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xe1fb('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xe1fb('0x7'));var client=jayson[_0xe1fb('0x8')][_0xe1fb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5b1b99,_0x2fa8a1,_0x49bb0c){return new BPromise(function(_0x17ded9,_0x4c28b8){return client[_0xe1fb('0xa')](_0x5b1b99,_0x49bb0c)[_0xe1fb('0xb')](function(_0x3fe2b0){logger[_0xe1fb('0xc')](_0xe1fb('0xd'),_0x2fa8a1,_0xe1fb('0xe'));logger[_0xe1fb('0xf')](_0xe1fb('0x10'),_0x2fa8a1,_0xe1fb('0xe'),JSON[_0xe1fb('0x11')](_0x3fe2b0));if(_0x3fe2b0['error']){if(_0x3fe2b0[_0xe1fb('0x12')][_0xe1fb('0x13')]===0x1f4){logger[_0xe1fb('0x12')](_0xe1fb('0xd'),_0x2fa8a1,_0x3fe2b0[_0xe1fb('0x12')][_0xe1fb('0x14')]);return _0x4c28b8(_0x3fe2b0[_0xe1fb('0x12')][_0xe1fb('0x14')]);}logger[_0xe1fb('0x12')](_0xe1fb('0xd'),_0x2fa8a1,_0x3fe2b0['error']['message']);return _0x17ded9(_0x3fe2b0[_0xe1fb('0x12')][_0xe1fb('0x14')]);}else{logger[_0xe1fb('0xc')](_0xe1fb('0xd'),_0x2fa8a1,'request\x20sent');_0x17ded9(_0x3fe2b0['result'][_0xe1fb('0x14')]);}})[_0xe1fb('0x15')](function(_0x1de365){logger[_0xe1fb('0x12')](_0xe1fb('0xd'),_0x2fa8a1,_0x1de365);_0x4c28b8(_0x1de365);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index e70958b..e4feb2b 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 _0xa095=['getActions','post','create','addConditions','addActions','update','delete','destroy','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','/:id/conditions','getConditions','/:id/actions'];(function(_0x5666b6,_0x1cde2b){var _0x3a9efd=function(_0x55f163){while(--_0x55f163){_0x5666b6['push'](_0x5666b6['shift']());}};_0x3a9efd(++_0x1cde2b);}(_0xa095,0x7c));var _0x5a09=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0xa095[_0x13d07a];return _0x5ee0ee;};'use strict';var multer=require(_0x5a09('0x0'));var util=require(_0x5a09('0x1'));var path=require('path');var timeout=require(_0x5a09('0x2'));var express=require('express');var router=express[_0x5a09('0x3')]();var auth=require(_0x5a09('0x4'));var interaction=require(_0x5a09('0x5'));var config=require(_0x5a09('0x6'));var controller=require('./automation.controller');router[_0x5a09('0x7')]('/',auth[_0x5a09('0x8')](),controller[_0x5a09('0x9')]);router[_0x5a09('0x7')](_0x5a09('0xa'),auth['isAuthenticated'](),controller['show']);router['get'](_0x5a09('0xb'),auth[_0x5a09('0x8')](),controller[_0x5a09('0xc')]);router[_0x5a09('0x7')](_0x5a09('0xd'),auth[_0x5a09('0x8')](),controller[_0x5a09('0xe')]);router[_0x5a09('0xf')]('/',auth[_0x5a09('0x8')](),controller[_0x5a09('0x10')]);router[_0x5a09('0xf')](_0x5a09('0xb'),auth['isAuthenticated'](),controller[_0x5a09('0x11')]);router[_0x5a09('0xf')](_0x5a09('0xd'),auth['isAuthenticated'](),controller[_0x5a09('0x12')]);router['put'](_0x5a09('0xa'),auth[_0x5a09('0x8')](),controller[_0x5a09('0x13')]);router[_0x5a09('0x14')](_0x5a09('0xa'),auth['isAuthenticated'](),controller[_0x5a09('0x15')]);module[_0x5a09('0x16')]=router; \ No newline at end of file +var _0xb368=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./automation.controller','isAuthenticated','index','get','getConditions','getActions','create','post','/:id/conditions','addConditions','addActions','put','/:id','update','delete','destroy','exports'];(function(_0x4eb269,_0x3cd1b6){var _0x1597b8=function(_0x527f9d){while(--_0x527f9d){_0x4eb269['push'](_0x4eb269['shift']());}};_0x1597b8(++_0x3cd1b6);}(_0xb368,0x68));var _0x8b36=function(_0x50ce5e,_0x1418ea){_0x50ce5e=_0x50ce5e-0x0;var _0x5929fc=_0xb368[_0x50ce5e];return _0x5929fc;};'use strict';var multer=require(_0x8b36('0x0'));var util=require(_0x8b36('0x1'));var path=require(_0x8b36('0x2'));var timeout=require(_0x8b36('0x3'));var express=require(_0x8b36('0x4'));var router=express[_0x8b36('0x5')]();var auth=require(_0x8b36('0x6'));var interaction=require(_0x8b36('0x7'));var config=require(_0x8b36('0x8'));var controller=require(_0x8b36('0x9'));router['get']('/',auth[_0x8b36('0xa')](),controller[_0x8b36('0xb')]);router['get']('/:id',auth[_0x8b36('0xa')](),controller['show']);router[_0x8b36('0xc')]('/:id/conditions',auth[_0x8b36('0xa')](),controller[_0x8b36('0xd')]);router[_0x8b36('0xc')]('/:id/actions',auth[_0x8b36('0xa')](),controller[_0x8b36('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x8b36('0xf')]);router[_0x8b36('0x10')](_0x8b36('0x11'),auth[_0x8b36('0xa')](),controller[_0x8b36('0x12')]);router['post']('/:id/actions',auth['isAuthenticated'](),controller[_0x8b36('0x13')]);router[_0x8b36('0x14')](_0x8b36('0x15'),auth[_0x8b36('0xa')](),controller[_0x8b36('0x16')]);router[_0x8b36('0x17')](_0x8b36('0x15'),auth[_0x8b36('0xa')](),controller[_0x8b36('0x18')]);module[_0x8b36('0x19')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index 80f25c8..f8bef40 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 _0x2198=['INTEGER','UNSIGNED','Max\x20200\x20calls.','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','always','never','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','STRING','ENUM','BOOLEAN'];(function(_0x1035ab,_0x2f9249){var _0x451ef1=function(_0x179cbb){while(--_0x179cbb){_0x1035ab['push'](_0x1035ab['shift']());}};_0x451ef1(++_0x2f9249);}(_0x2198,0x131));var _0x8219=function(_0x3cc621,_0x2e6c1c){_0x3cc621=_0x3cc621-0x0;var _0x2a2e85=_0x2198[_0x3cc621];return _0x2a2e85;};'use strict';var Sequelize=require(_0x8219('0x0'));module[_0x8219('0x1')]={'name':{'type':Sequelize[_0x8219('0x2')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x8219('0x3')]('ivr'),'allowNull':![],'defaultValue':'ivr'},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x8219('0x4')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'limitCalls':{'type':Sequelize[_0x8219('0x5')](0x4)[_0x8219('0x6')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x8219('0x7')},'dialOriginateCallerIdName':{'type':Sequelize[_0x8219('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x8219('0x2')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0x8219('0x6')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8219('0x8')},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x8219('0x6')],'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':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0x8219('0x5')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0x8219('0x5')](0x5)[_0x8219('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8219('0x9')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x8219('0x5')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0x8219('0xa')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x8219('0x5')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8219('0xb')},'dialGlobalMaxRetry':{'type':Sequelize[_0x8219('0x5')](0x3)[_0x8219('0x6')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x8219('0xc')},'dialTimezone':{'type':Sequelize[_0x8219('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x8219('0x2')],'defaultValue':'07:00-22:00,*,*,*'},'dialCheckDuplicateType':{'type':Sequelize[_0x8219('0x3')](_0x8219('0xd'),_0x8219('0xe'),'onlyIfOpen'),'defaultValue':_0x8219('0xd')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x8219('0xf')},'dialAMDInitialSilence':{'type':Sequelize[_0x8219('0x5')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x8219('0x10')},'dialAMDGreeting':{'type':Sequelize[_0x8219('0x5')](0x9)[_0x8219('0x6')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x8219('0x5')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x8219('0x11')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0x8219('0x6')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x8219('0x12')},'dialAMDMinWordLength':{'type':Sequelize[_0x8219('0x5')](0x9)[_0x8219('0x6')],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x8219('0x5')](0x9)[_0x8219('0x6')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x8219('0x13')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x8219('0x5')](0x9)[_0x8219('0x6')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0x8219('0x6')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x8219('0x14')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x8219('0x5')](0x9)[_0x8219('0x6')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x8219('0x15')},'dialOrderByScheduledAt':{'type':Sequelize[_0x8219('0x3')](_0x8219('0x16'),'ASC'),'defaultValue':'DESC'},'dialPrefix':{'type':Sequelize[_0x8219('0x2')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x8219('0x5')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize[_0x8219('0x5')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x8219('0x17')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x8219('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8219('0x18')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x8219('0x5')](0x5)[_0x8219('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8219('0x19')},'dialDropMaxRetry':{'type':Sequelize[_0x8219('0x5')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize[_0x8219('0x5')](0x5)[_0x8219('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8219('0x1a')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x8219('0x5')](0x5)[_0x8219('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8219('0x1b')},'dialMachineMaxRetry':{'type':Sequelize[_0x8219('0x5')](0x3)[_0x8219('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8219('0x1c')},'dialMachineRetryFrequency':{'type':Sequelize[_0x8219('0x5')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x8219('0x5')](0x3)[_0x8219('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8219('0x1d')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x8219('0x5')](0x5)[_0x8219('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8219('0x1e')}}; \ No newline at end of file +var _0xaf9c=['AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','ivr','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Max\x20200\x20calls.','STRING','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','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)','ENUM','always','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)'];(function(_0x589cfb,_0x101df9){var _0x29570c=function(_0x27ad68){while(--_0x27ad68){_0x589cfb['push'](_0x589cfb['shift']());}};_0x29570c(++_0x101df9);}(_0xaf9c,0x199));var _0xcaf9=function(_0x138d06,_0x33edf2){_0x138d06=_0x138d06-0x0;var _0x1a01eb=_0xaf9c[_0x138d06];return _0x1a01eb;};'use strict';var Sequelize=require(_0xcaf9('0x0'));module[_0xcaf9('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0xcaf9('0x2')),'allowNull':![],'defaultValue':_0xcaf9('0x2')},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0xcaf9('0x3')],'defaultValue':0x0,'comment':_0xcaf9('0x4')},'limitCalls':{'type':Sequelize[_0xcaf9('0x5')](0x4)[_0xcaf9('0x6')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0xcaf9('0x7')},'dialOriginateCallerIdName':{'type':Sequelize[_0xcaf9('0x8')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0xcaf9('0x6')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xcaf9('0x9')},'dialCongestionMaxRetry':{'type':Sequelize[_0xcaf9('0x5')](0x3)[_0xcaf9('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xcaf9('0xa')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xcaf9('0x5')](0x5)[_0xcaf9('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xcaf9('0xb')},'dialBusyMaxRetry':{'type':Sequelize[_0xcaf9('0x5')](0x3)[_0xcaf9('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xcaf9('0xc')},'dialBusyRetryFrequency':{'type':Sequelize[_0xcaf9('0x5')](0x5)[_0xcaf9('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xcaf9('0xd')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xcaf9('0x5')](0x3)[_0xcaf9('0x6')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xcaf9('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xcaf9('0x6')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0xcaf9('0x8')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':'07:00-22:00,*,*,*'},'dialCheckDuplicateType':{'type':Sequelize[_0xcaf9('0xe')](_0xcaf9('0xf'),'never','onlyIfOpen'),'defaultValue':_0xcaf9('0xf')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0xcaf9('0x5')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xcaf9('0x10')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xcaf9('0x5')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xcaf9('0x11')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xcaf9('0x5')](0x9)[_0xcaf9('0x6')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xcaf9('0x12')},'dialAMDMinWordLength':{'type':Sequelize[_0xcaf9('0x5')](0x9)[_0xcaf9('0x6')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xcaf9('0x13')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xcaf9('0x14')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xcaf9('0x5')](0x9)[_0xcaf9('0x6')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xcaf9('0x15')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0xcaf9('0x6')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xcaf9('0x16')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xcaf9('0x5')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xcaf9('0x17')},'dialOrderByScheduledAt':{'type':Sequelize[_0xcaf9('0xe')](_0xcaf9('0x18'),_0xcaf9('0x19')),'defaultValue':_0xcaf9('0x18')},'dialPrefix':{'type':Sequelize[_0xcaf9('0x8')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xcaf9('0x5')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xcaf9('0x1a')},'dialCutDigit':{'type':Sequelize[_0xcaf9('0x5')](0x3)[_0xcaf9('0x6')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xcaf9('0x5')](0x3)[_0xcaf9('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xcaf9('0x1b')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xcaf9('0x5')](0x5)[_0xcaf9('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0xcaf9('0x5')](0x3)[_0xcaf9('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xcaf9('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xcaf9('0x1c')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xcaf9('0x5')](0x3)[_0xcaf9('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xcaf9('0x5')](0x5)[_0xcaf9('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xcaf9('0x1d')},'dialMachineMaxRetry':{'type':Sequelize[_0xcaf9('0x5')](0x3)[_0xcaf9('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xcaf9('0x1e')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xcaf9('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xcaf9('0x1f')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xcaf9('0x5')](0x3)[_0xcaf9('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xcaf9('0x20')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xcaf9('0x5')](0x5)[_0xcaf9('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xcaf9('0x21')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index da941bb..ce2ec75 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 _0x5b02=['name','index','map','Campaign','rawAttributes','fieldName','type','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','merge','VIRTUAL','filter','options','include','findAll','catch','show','params','includeAll','find','body','user','get','autoAssociation','create','error','clone','omit','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','getHoppers','findOne','CmHopper','pick','rows','getHopperHistories','CampaignId','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','addLists','ids','spread','dialCheckDuplicateType','always','into','cm_hopper','fromQuery','phone','ContactId','ListId','select','field','scheduledAt','CmListId','toString','NOW()','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','onlyIfOpen','COALESCE(phone,\x27\x27)','sequelize','all','removeLists','getBlackLists','CmList','addBlackLists','insert','cm_hopper_black','removeBlackLists','html-pdf','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','reject','save','update','then','IvrCampaigns','UserProfileResource','stack'];(function(_0x5d3fbc,_0x3d0609){var _0x3186c7=function(_0x6001a7){while(--_0x6001a7){_0x5d3fbc['push'](_0x5d3fbc['shift']());}};_0x3186c7(++_0x3d0609);}(_0x5b02,0xe9));var _0x25b0=function(_0x5a3daf,_0x34c209){_0x5a3daf=_0x5a3daf-0x0;var _0x18509b=_0x5b02[_0x5a3daf];return _0x18509b;};'use strict';var pdf=require(_0x25b0('0x0'));var emlformat=require(_0x25b0('0x1'));var rimraf=require(_0x25b0('0x2'));var zipdir=require(_0x25b0('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x25b0('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x25b0('0x5'));var util=require(_0x25b0('0x6'));var path=require(_0x25b0('0x7'));var sox=require(_0x25b0('0x8'));var csv=require(_0x25b0('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x25b0('0xa'));var squel=require(_0x25b0('0xb'));var crypto=require('crypto');var jsforce=require(_0x25b0('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x25b0('0xd'));var Papa=require(_0x25b0('0xe'));var Redis=require(_0x25b0('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x25b0('0x10'));var as=require(_0x25b0('0x11'));var hardwareService=require(_0x25b0('0x12'));var logger=require(_0x25b0('0x13'))(_0x25b0('0x14'));var utils=require(_0x25b0('0x15'));var config=require(_0x25b0('0x16'));var db=require(_0x25b0('0x17'))['db'];function respondWithStatusCode(_0x193c2b,_0x1d3178){_0x1d3178=_0x1d3178||0xcc;return function(_0x184452){if(_0x184452){return _0x193c2b[_0x25b0('0x18')](_0x1d3178);}return _0x193c2b[_0x25b0('0x19')](_0x1d3178)[_0x25b0('0x1a')]();};}function respondWithResult(_0x1ceeb1,_0x42cc07){_0x42cc07=_0x42cc07||0xc8;return function(_0x293203){if(_0x293203){return _0x1ceeb1[_0x25b0('0x19')](_0x42cc07)[_0x25b0('0x1b')](_0x293203);}};}function respondWithFilteredResult(_0x3b89e7,_0x40071c){return function(_0x5ac18d){if(_0x5ac18d){var _0x51542b=_0x5ac18d[_0x25b0('0x1c')],_0xfe1ea6=_0x40071c[_0x25b0('0x1d')],_0x4b2357=_0x40071c[_0x25b0('0x1d')]+_0x40071c['limit'],_0xa8280a;if(_0x4b2357>=_0x51542b){_0x4b2357=_0x51542b;_0xa8280a=0xc8;}else{_0xa8280a=0xce;}_0x3b89e7[_0x25b0('0x19')](_0xa8280a);return _0x3b89e7[_0x25b0('0x1e')](_0x25b0('0x1f'),_0xfe1ea6+'-'+_0x4b2357+'/'+_0x51542b)[_0x25b0('0x1b')](_0x5ac18d);}return null;};}function patchUpdates(_0xe750bf){return function(_0x25872d){try{jsonpatch['apply'](_0x25872d,_0xe750bf,!![]);}catch(_0x348d36){return BPromise[_0x25b0('0x20')](_0x348d36);}return _0x25872d[_0x25b0('0x21')]();};}function saveUpdates(_0x1507b5,_0x1dc691){return function(_0xea4162){if(_0xea4162){return _0xea4162[_0x25b0('0x22')](_0x1507b5)[_0x25b0('0x23')](function(_0x7bdaf9){return _0x7bdaf9;});}return null;};}function removeEntity(_0x35939f,_0x2b2eda){return function(_0x3ce1da){if(_0x3ce1da){return _0x3ce1da['destroy']()[_0x25b0('0x23')](function(){var _0x16623c=_0x3ce1da['get']({'plain':!![]});var _0x2d7c17=_0x25b0('0x24');return db[_0x25b0('0x25')]['destroy']({'where':{'type':_0x2d7c17,'resourceId':_0x16623c['id']}})['then'](function(){return _0x3ce1da;});})['then'](function(){_0x35939f[_0x25b0('0x19')](0xcc)[_0x25b0('0x1a')]();});}};}function handleEntityNotFound(_0x99bd3a,_0x24f847){return function(_0xdbb459){if(!_0xdbb459){_0x99bd3a[_0x25b0('0x18')](0x194);}return _0xdbb459;};}function handleError(_0x40268a,_0x75ce7a){_0x75ce7a=_0x75ce7a||0x1f4;return function(_0x22e024){logger['error'](_0x22e024[_0x25b0('0x26')]);if(_0x22e024[_0x25b0('0x27')]){delete _0x22e024['name'];}_0x40268a['status'](_0x75ce7a)['send'](_0x22e024);};}exports[_0x25b0('0x28')]=function(_0x3f0a54,_0x251fad){var _0x105129={},_0x214377={},_0x3285ae={'count':0x0,'rows':[]};var _0x12676b=_[_0x25b0('0x29')](db[_0x25b0('0x2a')][_0x25b0('0x2b')],function(_0x1e217c){return{'name':_0x1e217c[_0x25b0('0x2c')],'type':_0x1e217c[_0x25b0('0x2d')]['key']};});_0x214377['model']=_[_0x25b0('0x29')](_0x12676b,'name');_0x214377['query']=_[_0x25b0('0x2e')](_0x3f0a54[_0x25b0('0x2f')]);_0x214377[_0x25b0('0x30')]=_[_0x25b0('0x31')](_0x214377[_0x25b0('0x32')],_0x214377['query']);_0x105129[_0x25b0('0x33')]=_[_0x25b0('0x31')](_0x214377['model'],qs[_0x25b0('0x34')](_0x3f0a54[_0x25b0('0x2f')]['fields']));_0x105129[_0x25b0('0x33')]=_0x105129['attributes'][_0x25b0('0x35')]?_0x105129[_0x25b0('0x33')]:_0x214377[_0x25b0('0x32')];if(!_0x3f0a54[_0x25b0('0x2f')][_0x25b0('0x36')](_0x25b0('0x37'))){_0x105129[_0x25b0('0x38')]=qs[_0x25b0('0x38')](_0x3f0a54[_0x25b0('0x2f')]['limit']);_0x105129[_0x25b0('0x1d')]=qs[_0x25b0('0x1d')](_0x3f0a54[_0x25b0('0x2f')][_0x25b0('0x1d')]);}_0x105129[_0x25b0('0x39')]=qs[_0x25b0('0x3a')](_0x3f0a54[_0x25b0('0x2f')][_0x25b0('0x3a')]);_0x105129[_0x25b0('0x3b')]=qs[_0x25b0('0x30')](_['pick'](_0x3f0a54[_0x25b0('0x2f')],_0x214377[_0x25b0('0x30')]));if(_0x3f0a54[_0x25b0('0x2f')]['filter']){_0x105129[_0x25b0('0x3b')]=_[_0x25b0('0x3c')](_0x105129[_0x25b0('0x3b')],{'$or':_[_0x25b0('0x29')](_0x12676b,function(_0x17f67c){if(_0x17f67c[_0x25b0('0x2d')]!==_0x25b0('0x3d')){var _0x391493={};_0x391493[_0x17f67c['name']]={'$like':'%'+_0x3f0a54['query'][_0x25b0('0x3e')]+'%'};return _0x391493;}})});}_0x105129=_[_0x25b0('0x3c')]({},_0x105129,_0x3f0a54[_0x25b0('0x3f')]);var _0x52c0af={'where':_0x105129[_0x25b0('0x3b')]};return db['Campaign'][_0x25b0('0x1c')](_0x52c0af)[_0x25b0('0x23')](function(_0xbd0db5){_0x3285ae[_0x25b0('0x1c')]=_0xbd0db5;if(_0x3f0a54[_0x25b0('0x2f')]['includeAll']){_0x105129[_0x25b0('0x40')]=[{'all':!![]}];}return db[_0x25b0('0x2a')][_0x25b0('0x41')](_0x105129);})[_0x25b0('0x23')](function(_0x428799){_0x3285ae['rows']=_0x428799;return _0x3285ae;})[_0x25b0('0x23')](respondWithFilteredResult(_0x251fad,_0x105129))[_0x25b0('0x42')](handleError(_0x251fad,null));};exports[_0x25b0('0x43')]=function(_0x44c400,_0x35fc00){var _0x1adf8d={'raw':![],'where':{'id':_0x44c400[_0x25b0('0x44')]['id']}},_0x51deba={};_0x51deba[_0x25b0('0x32')]=_[_0x25b0('0x2e')](db[_0x25b0('0x2a')]['rawAttributes']);_0x51deba[_0x25b0('0x2f')]=_['keys'](_0x44c400[_0x25b0('0x2f')]);_0x51deba[_0x25b0('0x30')]=_[_0x25b0('0x31')](_0x51deba[_0x25b0('0x32')],_0x51deba['query']);_0x1adf8d[_0x25b0('0x33')]=_[_0x25b0('0x31')](_0x51deba[_0x25b0('0x32')],qs['fields'](_0x44c400[_0x25b0('0x2f')][_0x25b0('0x34')]));_0x1adf8d[_0x25b0('0x33')]=_0x1adf8d[_0x25b0('0x33')][_0x25b0('0x35')]?_0x1adf8d[_0x25b0('0x33')]:_0x51deba[_0x25b0('0x32')];if(_0x44c400['query'][_0x25b0('0x45')]){_0x1adf8d[_0x25b0('0x40')]=[{'all':!![]}];}_0x1adf8d=_[_0x25b0('0x3c')]({},_0x1adf8d,_0x44c400['options']);return db[_0x25b0('0x2a')][_0x25b0('0x46')](_0x1adf8d)[_0x25b0('0x23')](handleEntityNotFound(_0x35fc00,null))[_0x25b0('0x23')](respondWithResult(_0x35fc00,null))[_0x25b0('0x42')](handleError(_0x35fc00,null));};exports['create']=function(_0x1e8a8d,_0x1cf933){return db[_0x25b0('0x2a')]['create'](_0x1e8a8d[_0x25b0('0x47')],{})[_0x25b0('0x23')](function(_0x1fea01){var _0x1d6d55=_0x1e8a8d[_0x25b0('0x48')][_0x25b0('0x49')]({'plain':!![]});if(!_0x1d6d55)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1d6d55['role']==='user'){var _0x1eb908=_0x1fea01['get']({'plain':!![]});var _0x48bc07=_0x25b0('0x24');return db['UserProfileSection'][_0x25b0('0x46')]({'where':{'name':_0x48bc07,'userProfileId':_0x1d6d55['userProfileId']},'raw':!![]})['then'](function(_0x394e52){if(_0x394e52&&_0x394e52[_0x25b0('0x4a')]===0x0){return db[_0x25b0('0x25')][_0x25b0('0x4b')]({'name':_0x1eb908[_0x25b0('0x27')],'resourceId':_0x1eb908['id'],'type':_0x394e52[_0x25b0('0x27')],'sectionId':_0x394e52['id']},{})[_0x25b0('0x23')](function(){return _0x1fea01;});}else{return _0x1fea01;}})[_0x25b0('0x42')](function(_0x2e68ad){logger[_0x25b0('0x4c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2e68ad);throw _0x2e68ad;});}return _0x1fea01;})['then'](respondWithResult(_0x1cf933,0xc9))['catch'](handleError(_0x1cf933,null));};exports[_0x25b0('0x4d')]=function(_0xa45e87,_0x2a28fb){var _0x422d9d={'where':{'id':_0xa45e87[_0x25b0('0x44')]['id']}},_0x14db4c={};_0x14db4c[_0x25b0('0x32')]=_['keys'](db[_0x25b0('0x2a')]['rawAttributes']);_0x422d9d[_0x25b0('0x33')]=_['intersection'](_0x14db4c['model'],qs[_0x25b0('0x34')](_0xa45e87['query']['fields']));_0x422d9d[_0x25b0('0x33')]=_0x422d9d[_0x25b0('0x33')][_0x25b0('0x35')]?_0x422d9d[_0x25b0('0x33')]:_0x14db4c[_0x25b0('0x32')];if(_0xa45e87[_0x25b0('0x2f')][_0x25b0('0x45')]){_0x422d9d[_0x25b0('0x40')]=[{'all':!![]}];}_0x422d9d=_[_0x25b0('0x3c')]({},_0x422d9d,_0xa45e87[_0x25b0('0x3f')]);return db['Campaign']['find'](_0x422d9d)[_0x25b0('0x23')](handleEntityNotFound(_0x2a28fb,null))[_0x25b0('0x23')](function(_0x47a13d){if(_0x47a13d){var _0xef5172=_0x47a13d[_0x25b0('0x49')]({'plain':!![]});_0xef5172=qs[_0x25b0('0x4e')](_0xef5172,['id',_0x25b0('0x4f'),_0x25b0('0x50')]);_0xa45e87['body']=_[_0x25b0('0x4e')](_0xa45e87[_0x25b0('0x47')],['id',_0x25b0('0x4f'),'updatedAt']);return db[_0x25b0('0x2a')][_0x25b0('0x4b')](_[_0x25b0('0x3c')](_0xef5172,_0xa45e87[_0x25b0('0x47')]),{'include':_0xa45e87[_0x25b0('0x2f')][_0x25b0('0x45')]?[{'all':!![]}]:undefined})[_0x25b0('0x23')](function(_0x2ccf0c){var _0x28682b=_0xa45e87[_0x25b0('0x48')][_0x25b0('0x49')]({'plain':!![]});if(!_0x28682b)throw new Error(_0x25b0('0x51'));if(_0x28682b[_0x25b0('0x52')]===_0x25b0('0x48')){var _0x561634=_0x2ccf0c[_0x25b0('0x49')]({'plain':!![]});var _0x4592bf='IvrCampaigns';return db[_0x25b0('0x53')]['find']({'where':{'name':_0x4592bf,'userProfileId':_0x28682b[_0x25b0('0x54')]},'raw':!![]})[_0x25b0('0x23')](function(_0x4cd91f){if(_0x4cd91f&&_0x4cd91f[_0x25b0('0x4a')]===0x0){return db[_0x25b0('0x25')][_0x25b0('0x4b')]({'name':_0x561634['name'],'resourceId':_0x561634['id'],'type':_0x4cd91f[_0x25b0('0x27')],'sectionId':_0x4cd91f['id']},{})['then'](function(){return _0x2ccf0c;});}else{return _0x2ccf0c;}})[_0x25b0('0x42')](function(_0x257f20){logger['error'](_0x25b0('0x55'),_0x257f20);throw _0x257f20;});}return _0x2ccf0c;});}})[_0x25b0('0x23')](respondWithResult(_0x2a28fb,0xc9))['catch'](handleError(_0x2a28fb,null));};exports[_0x25b0('0x22')]=function(_0x5b1aef,_0x5e7724){if(_0x5b1aef['body']['id']){delete _0x5b1aef[_0x25b0('0x47')]['id'];}return db[_0x25b0('0x2a')][_0x25b0('0x46')]({'where':{'id':_0x5b1aef['params']['id']}})[_0x25b0('0x23')](handleEntityNotFound(_0x5e7724,null))[_0x25b0('0x23')](saveUpdates(_0x5b1aef[_0x25b0('0x47')],null))[_0x25b0('0x23')](respondWithResult(_0x5e7724,null))[_0x25b0('0x42')](handleError(_0x5e7724,null));};exports[_0x25b0('0x56')]=function(_0x1568f4,_0x452f19){return db[_0x25b0('0x2a')][_0x25b0('0x46')]({'where':{'id':_0x1568f4[_0x25b0('0x44')]['id']}})[_0x25b0('0x23')](handleEntityNotFound(_0x452f19,null))[_0x25b0('0x23')](removeEntity(_0x452f19,null))[_0x25b0('0x42')](handleError(_0x452f19,null));};exports[_0x25b0('0x57')]=function(_0x1f418e,_0x19fa5c,_0x5ab1bb){var _0x24a32b={'raw':!![],'where':{}};var _0x4daaab={};var _0x210ae3={'count':0x0,'rows':[]};return db[_0x25b0('0x2a')][_0x25b0('0x58')]({'where':{'id':_0x1f418e[_0x25b0('0x44')]['id']}})['then'](handleEntityNotFound(_0x19fa5c,null))[_0x25b0('0x23')](function(_0x646457){if(_0x646457){_0x4daaab[_0x25b0('0x32')]=_[_0x25b0('0x2e')](db[_0x25b0('0x59')][_0x25b0('0x2b')]);_0x4daaab['query']=_['keys'](_0x1f418e[_0x25b0('0x2f')]);_0x4daaab['filters']=_[_0x25b0('0x31')](_0x4daaab[_0x25b0('0x32')],_0x4daaab[_0x25b0('0x2f')]);_0x24a32b['attributes']=_[_0x25b0('0x31')](_0x4daaab[_0x25b0('0x32')],qs[_0x25b0('0x34')](_0x1f418e[_0x25b0('0x2f')]['fields']));_0x24a32b[_0x25b0('0x33')]=_0x24a32b[_0x25b0('0x33')][_0x25b0('0x35')]?_0x24a32b['attributes']:_0x4daaab[_0x25b0('0x32')];if(!_0x1f418e[_0x25b0('0x2f')][_0x25b0('0x36')](_0x25b0('0x37'))){_0x24a32b[_0x25b0('0x38')]=qs[_0x25b0('0x38')](_0x1f418e[_0x25b0('0x2f')][_0x25b0('0x38')]);_0x24a32b['offset']=qs[_0x25b0('0x1d')](_0x1f418e[_0x25b0('0x2f')][_0x25b0('0x1d')]);}_0x24a32b[_0x25b0('0x39')]=qs['sort'](_0x1f418e['query'][_0x25b0('0x3a')]);_0x24a32b[_0x25b0('0x3b')]=qs[_0x25b0('0x30')](_[_0x25b0('0x5a')](_0x1f418e['query'],_0x4daaab[_0x25b0('0x30')]));_0x24a32b[_0x25b0('0x3b')]['CampaignId']=_0x646457['id'];if(_0x1f418e[_0x25b0('0x2f')][_0x25b0('0x3e')]){_0x24a32b['where']=_['merge'](_0x24a32b[_0x25b0('0x3b')],{'$or':_[_0x25b0('0x29')](_0x24a32b[_0x25b0('0x33')],function(_0x2ea20e){var _0x112ac6={};_0x112ac6[_0x2ea20e]={'$like':'%'+_0x1f418e[_0x25b0('0x2f')][_0x25b0('0x3e')]+'%'};return _0x112ac6;})});}_0x24a32b=_[_0x25b0('0x3c')]({},_0x24a32b,_0x1f418e[_0x25b0('0x3f')]);return db[_0x25b0('0x59')][_0x25b0('0x1c')]({'where':_0x24a32b[_0x25b0('0x3b')]})[_0x25b0('0x23')](function(_0x51867c){_0x210ae3[_0x25b0('0x1c')]=_0x51867c;if(_0x1f418e['query'][_0x25b0('0x45')]){_0x24a32b[_0x25b0('0x40')]=[{'all':!![]}];}return db['CmHopper'][_0x25b0('0x41')](_0x24a32b);})[_0x25b0('0x23')](function(_0x2e1bef){_0x210ae3[_0x25b0('0x5b')]=_0x2e1bef;return _0x210ae3;});}})[_0x25b0('0x23')](respondWithFilteredResult(_0x19fa5c,_0x24a32b))[_0x25b0('0x42')](handleError(_0x19fa5c,null));};exports[_0x25b0('0x5c')]=function(_0x3f6b41,_0x2e729f,_0xd5351e){var _0x36252f={'raw':!![],'where':{}};var _0x581e22={};var _0x4de403={'count':0x0,'rows':[]};return db[_0x25b0('0x2a')][_0x25b0('0x58')]({'where':{'id':_0x3f6b41['params']['id']}})['then'](handleEntityNotFound(_0x2e729f,null))[_0x25b0('0x23')](function(_0x516dc5){if(_0x516dc5){_0x581e22[_0x25b0('0x32')]=_[_0x25b0('0x2e')](db['CmHopperHistory'][_0x25b0('0x2b')]);_0x581e22[_0x25b0('0x2f')]=_['keys'](_0x3f6b41[_0x25b0('0x2f')]);_0x581e22[_0x25b0('0x30')]=_[_0x25b0('0x31')](_0x581e22[_0x25b0('0x32')],_0x581e22[_0x25b0('0x2f')]);_0x36252f['attributes']=_['intersection'](_0x581e22[_0x25b0('0x32')],qs['fields'](_0x3f6b41['query']['fields']));_0x36252f[_0x25b0('0x33')]=_0x36252f[_0x25b0('0x33')][_0x25b0('0x35')]?_0x36252f['attributes']:_0x581e22['model'];if(!_0x3f6b41[_0x25b0('0x2f')][_0x25b0('0x36')]('nolimit')){_0x36252f['limit']=qs['limit'](_0x3f6b41[_0x25b0('0x2f')][_0x25b0('0x38')]);_0x36252f[_0x25b0('0x1d')]=qs[_0x25b0('0x1d')](_0x3f6b41['query'][_0x25b0('0x1d')]);}_0x36252f[_0x25b0('0x39')]=qs[_0x25b0('0x3a')](_0x3f6b41[_0x25b0('0x2f')][_0x25b0('0x3a')]);_0x36252f[_0x25b0('0x3b')]=qs[_0x25b0('0x30')](_[_0x25b0('0x5a')](_0x3f6b41[_0x25b0('0x2f')],_0x581e22[_0x25b0('0x30')]));_0x36252f[_0x25b0('0x3b')][_0x25b0('0x5d')]=_0x516dc5['id'];if(_0x3f6b41[_0x25b0('0x2f')][_0x25b0('0x3e')]){_0x36252f[_0x25b0('0x3b')]=_[_0x25b0('0x3c')](_0x36252f[_0x25b0('0x3b')],{'$or':_[_0x25b0('0x29')](_0x36252f['attributes'],function(_0x5b0091){var _0x14ac78={};_0x14ac78[_0x5b0091]={'$like':'%'+_0x3f6b41['query'][_0x25b0('0x3e')]+'%'};return _0x14ac78;})});}_0x36252f=_['merge']({},_0x36252f,_0x3f6b41['options']);return db['CmHopperHistory']['count']({'where':_0x36252f['where']})[_0x25b0('0x23')](function(_0x10e42a){_0x4de403[_0x25b0('0x1c')]=_0x10e42a;if(_0x3f6b41['query'][_0x25b0('0x45')]){_0x36252f[_0x25b0('0x40')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x25b0('0x41')](_0x36252f);})[_0x25b0('0x23')](function(_0x26b73e){_0x4de403[_0x25b0('0x5b')]=_0x26b73e;return _0x4de403;});}})[_0x25b0('0x23')](respondWithFilteredResult(_0x2e729f,_0x36252f))[_0x25b0('0x42')](handleError(_0x2e729f,null));};exports[_0x25b0('0x5e')]=function(_0x1bfafe,_0x16d442,_0x476a66){var _0x289c16={'raw':!![],'where':{}};var _0x116f56={};var _0x112a28={'count':0x0,'rows':[]};return db[_0x25b0('0x2a')][_0x25b0('0x58')]({'where':{'id':_0x1bfafe[_0x25b0('0x44')]['id']}})[_0x25b0('0x23')](handleEntityNotFound(_0x16d442,null))['then'](function(_0x2e6b99){if(_0x2e6b99){_0x116f56[_0x25b0('0x32')]=_[_0x25b0('0x2e')](db[_0x25b0('0x5f')][_0x25b0('0x2b')]);_0x116f56['query']=_[_0x25b0('0x2e')](_0x1bfafe['query']);_0x116f56[_0x25b0('0x30')]=_['intersection'](_0x116f56['model'],_0x116f56[_0x25b0('0x2f')]);_0x289c16['attributes']=_[_0x25b0('0x31')](_0x116f56[_0x25b0('0x32')],qs['fields'](_0x1bfafe[_0x25b0('0x2f')][_0x25b0('0x34')]));_0x289c16[_0x25b0('0x33')]=_0x289c16[_0x25b0('0x33')]['length']?_0x289c16[_0x25b0('0x33')]:_0x116f56[_0x25b0('0x32')];if(!_0x1bfafe[_0x25b0('0x2f')]['hasOwnProperty'](_0x25b0('0x37'))){_0x289c16[_0x25b0('0x38')]=qs[_0x25b0('0x38')](_0x1bfafe[_0x25b0('0x2f')][_0x25b0('0x38')]);_0x289c16['offset']=qs['offset'](_0x1bfafe[_0x25b0('0x2f')][_0x25b0('0x1d')]);}_0x289c16[_0x25b0('0x39')]=qs[_0x25b0('0x3a')](_0x1bfafe[_0x25b0('0x2f')][_0x25b0('0x3a')]);_0x289c16[_0x25b0('0x3b')]=qs[_0x25b0('0x30')](_[_0x25b0('0x5a')](_0x1bfafe[_0x25b0('0x2f')],_0x116f56[_0x25b0('0x30')]));_0x289c16[_0x25b0('0x3b')][_0x25b0('0x5d')]=_0x2e6b99['id'];if(_0x1bfafe['query'][_0x25b0('0x3e')]){_0x289c16['where']=_[_0x25b0('0x3c')](_0x289c16[_0x25b0('0x3b')],{'$or':_[_0x25b0('0x29')](_0x289c16[_0x25b0('0x33')],function(_0x837602){var _0x65610={};_0x65610[_0x837602]={'$like':'%'+_0x1bfafe['query'][_0x25b0('0x3e')]+'%'};return _0x65610;})});}_0x289c16=_['merge']({},_0x289c16,_0x1bfafe[_0x25b0('0x3f')]);return db['CmHopperFinal'][_0x25b0('0x1c')]({'where':_0x289c16[_0x25b0('0x3b')]})[_0x25b0('0x23')](function(_0x5f8934){_0x112a28[_0x25b0('0x1c')]=_0x5f8934;if(_0x1bfafe[_0x25b0('0x2f')]['includeAll']){_0x289c16['include']=[{'all':!![]}];}return db[_0x25b0('0x5f')][_0x25b0('0x41')](_0x289c16);})[_0x25b0('0x23')](function(_0x3010d0){_0x112a28['rows']=_0x3010d0;return _0x112a28;});}})[_0x25b0('0x23')](respondWithFilteredResult(_0x16d442,_0x289c16))[_0x25b0('0x42')](handleError(_0x16d442,null));};exports[_0x25b0('0x60')]=function(_0x130ef5,_0x595e96,_0x2b20e8){var _0xc6c16b={'raw':!![],'where':{}};var _0x52bcb7={};var _0xd3cba0={'count':0x0,'rows':[]};return db[_0x25b0('0x2a')][_0x25b0('0x58')]({'where':{'id':_0x130ef5[_0x25b0('0x44')]['id']}})[_0x25b0('0x23')](handleEntityNotFound(_0x595e96,null))[_0x25b0('0x23')](function(_0x2949d2){if(_0x2949d2){_0x52bcb7[_0x25b0('0x32')]=_[_0x25b0('0x2e')](db[_0x25b0('0x61')]['rawAttributes']);_0x52bcb7[_0x25b0('0x2f')]=_['keys'](_0x130ef5[_0x25b0('0x2f')]);_0x52bcb7[_0x25b0('0x30')]=_[_0x25b0('0x31')](_0x52bcb7[_0x25b0('0x32')],_0x52bcb7[_0x25b0('0x2f')]);_0xc6c16b['attributes']=_[_0x25b0('0x31')](_0x52bcb7[_0x25b0('0x32')],qs[_0x25b0('0x34')](_0x130ef5[_0x25b0('0x2f')][_0x25b0('0x34')]));_0xc6c16b['attributes']=_0xc6c16b['attributes'][_0x25b0('0x35')]?_0xc6c16b[_0x25b0('0x33')]:_0x52bcb7[_0x25b0('0x32')];if(!_0x130ef5[_0x25b0('0x2f')]['hasOwnProperty'](_0x25b0('0x37'))){_0xc6c16b['limit']=qs[_0x25b0('0x38')](_0x130ef5[_0x25b0('0x2f')][_0x25b0('0x38')]);_0xc6c16b[_0x25b0('0x1d')]=qs[_0x25b0('0x1d')](_0x130ef5[_0x25b0('0x2f')][_0x25b0('0x1d')]);}_0xc6c16b[_0x25b0('0x39')]=qs[_0x25b0('0x3a')](_0x130ef5['query'][_0x25b0('0x3a')]);_0xc6c16b['where']=qs[_0x25b0('0x30')](_[_0x25b0('0x5a')](_0x130ef5[_0x25b0('0x2f')],_0x52bcb7[_0x25b0('0x30')]));_0xc6c16b[_0x25b0('0x3b')]['CampaignId']=_0x2949d2['id'];if(_0x130ef5[_0x25b0('0x2f')][_0x25b0('0x3e')]){_0xc6c16b[_0x25b0('0x3b')]=_[_0x25b0('0x3c')](_0xc6c16b['where'],{'$or':_['map'](_0xc6c16b[_0x25b0('0x33')],function(_0x45b728){var _0x2b3c95={};_0x2b3c95[_0x45b728]={'$like':'%'+_0x130ef5[_0x25b0('0x2f')]['filter']+'%'};return _0x2b3c95;})});}_0xc6c16b=_['merge']({},_0xc6c16b,_0x130ef5[_0x25b0('0x3f')]);return db['CmHopperBlack'][_0x25b0('0x1c')]({'where':_0xc6c16b[_0x25b0('0x3b')]})[_0x25b0('0x23')](function(_0x107814){_0xd3cba0[_0x25b0('0x1c')]=_0x107814;if(_0x130ef5['query'][_0x25b0('0x45')]){_0xc6c16b[_0x25b0('0x40')]=[{'all':!![]}];}return db[_0x25b0('0x61')]['findAll'](_0xc6c16b);})[_0x25b0('0x23')](function(_0x31908d){_0xd3cba0[_0x25b0('0x5b')]=_0x31908d;return _0xd3cba0;});}})['then'](respondWithFilteredResult(_0x595e96,_0xc6c16b))[_0x25b0('0x42')](handleError(_0x595e96,null));};exports['getLists']=function(_0x508ef3,_0x401907,_0xcb86ba){var _0x584acd={};var _0x17cd9e={};var _0x4e663b;var _0x35d3f5;return db['Campaign']['findOne']({'where':{'id':_0x508ef3[_0x25b0('0x44')]['id']}})[_0x25b0('0x23')](handleEntityNotFound(_0x401907,null))[_0x25b0('0x23')](function(_0x4539bf){if(_0x4539bf){_0x4e663b=_0x4539bf;_0x17cd9e['model']=_[_0x25b0('0x2e')](db['CmList'][_0x25b0('0x2b')]);_0x17cd9e[_0x25b0('0x2f')]=_[_0x25b0('0x2e')](_0x508ef3[_0x25b0('0x2f')]);_0x17cd9e[_0x25b0('0x30')]=_[_0x25b0('0x31')](_0x17cd9e[_0x25b0('0x32')],_0x17cd9e[_0x25b0('0x2f')]);_0x584acd[_0x25b0('0x33')]=_['intersection'](_0x17cd9e[_0x25b0('0x32')],qs[_0x25b0('0x34')](_0x508ef3[_0x25b0('0x2f')][_0x25b0('0x34')]));_0x584acd[_0x25b0('0x33')]=_0x584acd[_0x25b0('0x33')][_0x25b0('0x35')]?_0x584acd[_0x25b0('0x33')]:_0x17cd9e[_0x25b0('0x32')];_0x584acd['order']=qs['sort'](_0x508ef3[_0x25b0('0x2f')][_0x25b0('0x3a')]);_0x584acd[_0x25b0('0x3b')]=qs[_0x25b0('0x30')](_[_0x25b0('0x5a')](_0x508ef3[_0x25b0('0x2f')],_0x17cd9e[_0x25b0('0x30')]));if(_0x508ef3[_0x25b0('0x2f')][_0x25b0('0x3e')]){_0x584acd[_0x25b0('0x3b')]=_[_0x25b0('0x3c')](_0x584acd['where'],{'$or':_[_0x25b0('0x29')](_0x584acd[_0x25b0('0x33')],function(_0x38534c){var _0x4db8a4={};_0x4db8a4[_0x38534c]={'$like':'%'+_0x508ef3[_0x25b0('0x2f')][_0x25b0('0x3e')]+'%'};return _0x4db8a4;})});}_0x584acd=_[_0x25b0('0x3c')]({},_0x584acd,_0x508ef3['options']);return _0x4e663b[_0x25b0('0x62')](_0x584acd);}})[_0x25b0('0x23')](function(_0x59a505){if(_0x59a505){_0x35d3f5=_0x59a505[_0x25b0('0x35')];if(!_0x508ef3[_0x25b0('0x2f')]['hasOwnProperty'](_0x25b0('0x37'))){_0x584acd[_0x25b0('0x38')]=qs[_0x25b0('0x38')](_0x508ef3[_0x25b0('0x2f')]['limit']);_0x584acd[_0x25b0('0x1d')]=qs[_0x25b0('0x1d')](_0x508ef3[_0x25b0('0x2f')][_0x25b0('0x1d')]);}return _0x4e663b[_0x25b0('0x62')](_0x584acd);}})[_0x25b0('0x23')](function(_0x391778){if(_0x391778){return _0x391778?{'count':_0x35d3f5,'rows':_0x391778}:null;}})[_0x25b0('0x23')](respondWithResult(_0x401907,null))[_0x25b0('0x42')](handleError(_0x401907,null));};exports[_0x25b0('0x63')]=function(_0x570ceb,_0x547f76,_0x3a2bed){var _0x5e1ac6,_0x357887;return db[_0x25b0('0x2a')][_0x25b0('0x46')]({'where':{'id':_0x570ceb[_0x25b0('0x44')]['id']}})['then'](handleEntityNotFound(_0x547f76,null))[_0x25b0('0x23')](function(_0x43a751){if(_0x43a751){_0x357887=_0x43a751;return _0x43a751['addLists'](_0x570ceb[_0x25b0('0x47')][_0x25b0('0x64')],_[_0x25b0('0x4e')](_0x570ceb[_0x25b0('0x47')],[_0x25b0('0x64'),'id'])||{});}return null;})[_0x25b0('0x65')](function(_0x74a656){var _0x37e91b;_0x5e1ac6=_0x74a656||[];var _0x230ec6=[];if(_0x74a656){for(var _0x586995=0x0;_0x586995<_0x74a656[_0x25b0('0x35')];_0x586995+=0x1){var _0xce464=_0x74a656[_0x586995]['get']({'plain':!![]});_0x357887[_0x25b0('0x66')]=_0x570ceb[_0x25b0('0x47')][_0x25b0('0x66')]?_0x570ceb[_0x25b0('0x47')][_0x25b0('0x66')]:_0x357887[_0x25b0('0x66')];switch(_0x357887[_0x25b0('0x66')]){case _0x25b0('0x67'):_0x37e91b=squel['insert']()[_0x25b0('0x68')](_0x25b0('0x69'))[_0x25b0('0x6a')]([_0x25b0('0x6b'),'scheduledAt',_0x25b0('0x6c'),_0x25b0('0x6d'),_0x25b0('0x5d'),_0x25b0('0x4f'),_0x25b0('0x50')],squel[_0x25b0('0x6e')]()[_0x25b0('0x6f')](_0x25b0('0x6b'),'phone')[_0x25b0('0x6f')]('NOW()',_0x25b0('0x70'))[_0x25b0('0x6f')]('id','ContactId')['field'](_0xce464[_0x25b0('0x71')]['toString'](),_0x25b0('0x6d'))[_0x25b0('0x6f')](_0x570ceb[_0x25b0('0x44')]['id'][_0x25b0('0x72')](),'CampaignId')[_0x25b0('0x6f')](_0x25b0('0x73'),_0x25b0('0x4f'))[_0x25b0('0x6f')](_0x25b0('0x73'),'updatedAt')[_0x25b0('0x74')](_0x25b0('0x75'))[_0x25b0('0x3b')](_0x25b0('0x76'))[_0x25b0('0x3b')](_0x25b0('0x77'),_0xce464['CmListId']['toString']())[_0x25b0('0x3b')](_0x25b0('0x78'))[_0x25b0('0x3b')]('phone\x20NOT\x20IN\x20(?)',squel[_0x25b0('0x6e')]()[_0x25b0('0x6f')](_0x25b0('0x79'))[_0x25b0('0x74')](_0x25b0('0x7a'))['where'](_0x25b0('0x7b'),_0x570ceb[_0x25b0('0x44')]['id'][_0x25b0('0x72')]()))['where'](_0x25b0('0x7c'),squel[_0x25b0('0x6e')]()[_0x25b0('0x6f')]('COALESCE(phone,\x27\x27)')[_0x25b0('0x74')]('cm_hopper')[_0x25b0('0x3b')]('CampaignId\x20=\x20?',_0x570ceb[_0x25b0('0x44')]['id'][_0x25b0('0x72')]())))[_0x25b0('0x72')]();break;case _0x25b0('0x7d'):_0x37e91b=squel['insert']()['into'](_0x25b0('0x69'))[_0x25b0('0x6a')]([_0x25b0('0x6b'),'scheduledAt','ContactId',_0x25b0('0x6d'),'CampaignId',_0x25b0('0x4f'),'updatedAt'],squel[_0x25b0('0x6e')]()[_0x25b0('0x6f')]('phone',_0x25b0('0x6b'))[_0x25b0('0x6f')](_0x25b0('0x73'),'scheduledAt')['field']('id',_0x25b0('0x6c'))['field'](_0xce464['CmListId']['toString'](),_0x25b0('0x6d'))[_0x25b0('0x6f')](_0x570ceb[_0x25b0('0x44')]['id'][_0x25b0('0x72')](),_0x25b0('0x5d'))[_0x25b0('0x6f')]('NOW()','createdAt')[_0x25b0('0x6f')]('NOW()',_0x25b0('0x50'))[_0x25b0('0x74')](_0x25b0('0x75'))[_0x25b0('0x3b')](_0x25b0('0x76'))['where']('ListId\x20=\x20?',_0xce464[_0x25b0('0x71')][_0x25b0('0x72')]())[_0x25b0('0x3b')](_0x25b0('0x78'))[_0x25b0('0x3b')](_0x25b0('0x7c'),squel[_0x25b0('0x6e')]()[_0x25b0('0x6f')](_0x25b0('0x7e'))['from'](_0x25b0('0x69'))['where'](_0x25b0('0x7b'),_0x570ceb[_0x25b0('0x44')]['id'][_0x25b0('0x72')]())))['toString']();break;default:_0x37e91b=squel['insert']()[_0x25b0('0x68')](_0x25b0('0x69'))['fromQuery'](['phone',_0x25b0('0x70'),'ContactId',_0x25b0('0x6d'),'CampaignId','createdAt',_0x25b0('0x50')],squel['select']()['field'](_0x25b0('0x6b'),_0x25b0('0x6b'))[_0x25b0('0x6f')](_0x25b0('0x73'),_0x25b0('0x70'))[_0x25b0('0x6f')]('id','ContactId')['field'](_0xce464[_0x25b0('0x71')][_0x25b0('0x72')](),_0x25b0('0x6d'))[_0x25b0('0x6f')](_0x570ceb[_0x25b0('0x44')]['id']['toString'](),'CampaignId')[_0x25b0('0x6f')](_0x25b0('0x73'),_0x25b0('0x4f'))[_0x25b0('0x6f')](_0x25b0('0x73'),_0x25b0('0x50'))['from'](_0x25b0('0x75'))['where'](_0x25b0('0x76'))[_0x25b0('0x3b')](_0x25b0('0x77'),_0xce464['CmListId']['toString']())['where'](_0x25b0('0x78')))[_0x25b0('0x72')]();}_0x230ec6['push'](db[_0x25b0('0x7f')]['query'](_0x37e91b));}return BPromise[_0x25b0('0x80')](_0x230ec6);}})[_0x25b0('0x23')](function(){return _0x5e1ac6;})[_0x25b0('0x23')](respondWithResult(_0x547f76,null))[_0x25b0('0x42')](handleError(_0x547f76,null));};exports[_0x25b0('0x81')]=function(_0x3ec4d3,_0xddc1dd,_0x4cc93e){return db[_0x25b0('0x2a')][_0x25b0('0x46')]({'where':{'id':_0x3ec4d3['params']['id']}})[_0x25b0('0x23')](handleEntityNotFound(_0xddc1dd,null))['then'](function(_0x175554){if(_0x175554){return _0x175554[_0x25b0('0x81')](_0x3ec4d3[_0x25b0('0x2f')][_0x25b0('0x64')]);}})['then'](function(_0x59f251){if(_0x59f251){return db[_0x25b0('0x59')][_0x25b0('0x56')]({'where':{'ListId':_0x3ec4d3['query'][_0x25b0('0x64')],'CampaignId':_0x3ec4d3['params']['id']}})[_0x25b0('0x23')](function(){return _0x59f251;});}})[_0x25b0('0x23')](respondWithStatusCode(_0xddc1dd,null))[_0x25b0('0x42')](handleError(_0xddc1dd,null));};exports[_0x25b0('0x82')]=function(_0x401cbd,_0x593684,_0x4f3a26){var _0x3094eb={'raw':!![],'where':{}};var _0xc35dde={};var _0x539c7d={'count':0x0,'rows':[]};return db[_0x25b0('0x2a')]['findOne']({'where':{'id':_0x401cbd['params']['id']}})[_0x25b0('0x23')](handleEntityNotFound(_0x593684,null))[_0x25b0('0x23')](function(_0x552a7b){if(_0x552a7b){_0xc35dde[_0x25b0('0x32')]=_[_0x25b0('0x2e')](db[_0x25b0('0x83')][_0x25b0('0x2b')]);_0xc35dde['query']=_[_0x25b0('0x2e')](_0x401cbd['query']);_0xc35dde[_0x25b0('0x30')]=_[_0x25b0('0x31')](_0xc35dde[_0x25b0('0x32')],_0xc35dde[_0x25b0('0x2f')]);_0x3094eb[_0x25b0('0x33')]=_[_0x25b0('0x31')](_0xc35dde[_0x25b0('0x32')],qs[_0x25b0('0x34')](_0x401cbd[_0x25b0('0x2f')][_0x25b0('0x34')]));_0x3094eb[_0x25b0('0x33')]=_0x3094eb[_0x25b0('0x33')][_0x25b0('0x35')]?_0x3094eb[_0x25b0('0x33')]:_0xc35dde[_0x25b0('0x32')];if(!_0x401cbd[_0x25b0('0x2f')][_0x25b0('0x36')](_0x25b0('0x37'))){_0x3094eb[_0x25b0('0x38')]=qs['limit'](_0x401cbd[_0x25b0('0x2f')]['limit']);_0x3094eb[_0x25b0('0x1d')]=qs['offset'](_0x401cbd['query'][_0x25b0('0x1d')]);}_0x3094eb[_0x25b0('0x39')]=qs['sort'](_0x401cbd[_0x25b0('0x2f')]['sort']);_0x3094eb[_0x25b0('0x3b')]=qs[_0x25b0('0x30')](_['pick'](_0x401cbd['query'],_0xc35dde[_0x25b0('0x30')]));_0x3094eb['where'][_0x25b0('0x5d')]=_0x552a7b['id'];if(_0x401cbd['query'][_0x25b0('0x3e')]){_0x3094eb[_0x25b0('0x3b')]=_['merge'](_0x3094eb[_0x25b0('0x3b')],{'$or':_[_0x25b0('0x29')](_0x3094eb[_0x25b0('0x33')],function(_0x285e35){var _0x24d95d={};_0x24d95d[_0x285e35]={'$like':'%'+_0x401cbd[_0x25b0('0x2f')][_0x25b0('0x3e')]+'%'};return _0x24d95d;})});}_0x3094eb=_[_0x25b0('0x3c')]({},_0x3094eb,_0x401cbd[_0x25b0('0x3f')]);return db[_0x25b0('0x83')][_0x25b0('0x1c')]({'where':_0x3094eb['where']})[_0x25b0('0x23')](function(_0x4fc1ff){_0x539c7d[_0x25b0('0x1c')]=_0x4fc1ff;if(_0x401cbd['query']['includeAll']){_0x3094eb[_0x25b0('0x40')]=[{'all':!![]}];}return db[_0x25b0('0x83')][_0x25b0('0x41')](_0x3094eb);})[_0x25b0('0x23')](function(_0x9cdb65){_0x539c7d[_0x25b0('0x5b')]=_0x9cdb65;return _0x539c7d;});}})['then'](respondWithFilteredResult(_0x593684,_0x3094eb))[_0x25b0('0x42')](handleError(_0x593684,null));};exports[_0x25b0('0x84')]=function(_0x4977f1,_0x350f71,_0x183063){var _0x2ee488,_0x56b823;return db[_0x25b0('0x2a')][_0x25b0('0x46')]({'where':{'id':_0x4977f1['params']['id']}})[_0x25b0('0x23')](handleEntityNotFound(_0x350f71,null))['then'](function(_0x38a7a6){if(_0x38a7a6){_0x56b823=_0x38a7a6;return _0x38a7a6[_0x25b0('0x84')](_0x4977f1[_0x25b0('0x47')][_0x25b0('0x64')],_[_0x25b0('0x4e')](_0x4977f1[_0x25b0('0x47')],[_0x25b0('0x64'),'id'])||{});}return null;})[_0x25b0('0x65')](function(_0x55f507){var _0x38cff8;_0x2ee488=_0x55f507||[];var _0x59f3ba=[];if(_0x55f507){for(var _0x4281a5=0x0;_0x4281a5<_0x55f507[_0x25b0('0x35')];_0x4281a5+=0x1){var _0x589e59=_0x55f507[_0x4281a5]['get']({'plain':!![]});_0x38cff8=squel[_0x25b0('0x85')]()[_0x25b0('0x68')](_0x25b0('0x86'))[_0x25b0('0x6a')]([_0x25b0('0x6b'),'ContactId',_0x25b0('0x6d'),_0x25b0('0x5d'),'createdAt',_0x25b0('0x50')],squel['select']()[_0x25b0('0x6f')](_0x25b0('0x6b'),_0x25b0('0x6b'))[_0x25b0('0x6f')]('id',_0x25b0('0x6c'))[_0x25b0('0x6f')](_0x589e59[_0x25b0('0x71')][_0x25b0('0x72')](),_0x25b0('0x6d'))[_0x25b0('0x6f')](_0x4977f1[_0x25b0('0x44')]['id'][_0x25b0('0x72')](),_0x25b0('0x5d'))['field'](_0x25b0('0x73'),'createdAt')[_0x25b0('0x6f')](_0x25b0('0x73'),_0x25b0('0x50'))[_0x25b0('0x74')]('cm_contacts')[_0x25b0('0x3b')](_0x25b0('0x76'))[_0x25b0('0x3b')](_0x25b0('0x77'),_0x589e59[_0x25b0('0x71')]['toString']())[_0x25b0('0x3b')](_0x25b0('0x78')))[_0x25b0('0x72')]();_0x59f3ba['push'](db[_0x25b0('0x7f')][_0x25b0('0x2f')](_0x38cff8));}return BPromise[_0x25b0('0x80')](_0x59f3ba);}})['then'](function(){return _0x2ee488;})[_0x25b0('0x23')](respondWithResult(_0x350f71,null))['catch'](handleError(_0x350f71,null));};exports[_0x25b0('0x87')]=function(_0x1ba258,_0x45f989,_0x1a78e7){return db[_0x25b0('0x2a')][_0x25b0('0x46')]({'where':{'id':_0x1ba258[_0x25b0('0x44')]['id']}})['then'](handleEntityNotFound(_0x45f989,null))[_0x25b0('0x23')](function(_0x1da85c){if(_0x1da85c){return _0x1da85c[_0x25b0('0x87')](_0x1ba258[_0x25b0('0x2f')]['ids']);}})[_0x25b0('0x23')](function(_0x1bb37b){if(_0x1bb37b){return db[_0x25b0('0x61')]['destroy']({'where':{'ListId':_0x1ba258[_0x25b0('0x2f')][_0x25b0('0x64')],'CampaignId':_0x1ba258[_0x25b0('0x44')]['id']}})['then'](function(){return _0x1bb37b;});}})[_0x25b0('0x23')](respondWithStatusCode(_0x45f989,null))['catch'](handleError(_0x45f989,null));}; \ No newline at end of file +var _0x1339=['get','IvrCampaigns','sendStatus','name','send','map','fieldName','key','model','keys','query','filters','attributes','fields','length','hasOwnProperty','limit','order','sort','where','filter','merge','type','VIRTUAL','options','Campaign','includeAll','include','rows','catch','show','rawAttributes','intersection','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','updatedAt','omit','createdAt','role','userProfileId','UserProfileResource','update','findOne','CmHopper','pick','CampaignId','findAll','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','nolimit','getHopperBlacks','CmHopperBlack','CmList','getLists','addLists','ids','dialCheckDuplicateType','into','cm_hopper','fromQuery','scheduledAt','ContactId','ListId','phone','field','CmListId','toString','NOW()','from','cm_contacts','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','select','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','ListId\x20=\x20?','insert','sequelize','all','removeLists','getBlackLists','addBlackLists','push','removeBlackLists','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','end','status','json','count','offset','Content-Range','save','then','destroy'];(function(_0x164798,_0x29e959){var _0xc5da=function(_0x30e86f){while(--_0x30e86f){_0x164798['push'](_0x164798['shift']());}};_0xc5da(++_0x29e959);}(_0x1339,0x1ed));var _0x9133=function(_0x27c301,_0x448707){_0x27c301=_0x27c301-0x0;var _0x39944a=_0x1339[_0x27c301];return _0x39944a;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x9133('0x0'));var zipdir=require(_0x9133('0x1'));var jsonpatch=require(_0x9133('0x2'));var rp=require(_0x9133('0x3'));var moment=require(_0x9133('0x4'));var BPromise=require(_0x9133('0x5'));var Mustache=require(_0x9133('0x6'));var util=require(_0x9133('0x7'));var path=require('path');var sox=require(_0x9133('0x8'));var csv=require(_0x9133('0x9'));var ejs=require(_0x9133('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x9133('0xb'));var crypto=require(_0x9133('0xc'));var jsforce=require(_0x9133('0xd'));var deskjs=require(_0x9133('0xe'));var toCsv=require(_0x9133('0x9'));var querystring=require(_0x9133('0xf'));var Papa=require(_0x9133('0x10'));var Redis=require(_0x9133('0x11'));var authService=require(_0x9133('0x12'));var qs=require(_0x9133('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9133('0x14'));var logger=require(_0x9133('0x15'))(_0x9133('0x16'));var utils=require(_0x9133('0x17'));var config=require(_0x9133('0x18'));var db=require(_0x9133('0x19'))['db'];function respondWithStatusCode(_0x5ef6b5,_0xb64550){_0xb64550=_0xb64550||0xcc;return function(_0x7cc59e){if(_0x7cc59e){return _0x5ef6b5['sendStatus'](_0xb64550);}return _0x5ef6b5['status'](_0xb64550)[_0x9133('0x1a')]();};}function respondWithResult(_0x4bf947,_0x22132a){_0x22132a=_0x22132a||0xc8;return function(_0x439e1a){if(_0x439e1a){return _0x4bf947[_0x9133('0x1b')](_0x22132a)[_0x9133('0x1c')](_0x439e1a);}};}function respondWithFilteredResult(_0x31847a,_0x4327b3){return function(_0x49cc5d){if(_0x49cc5d){var _0x13f8fc=_0x49cc5d[_0x9133('0x1d')],_0x1e23ce=_0x4327b3[_0x9133('0x1e')],_0x4f4f14=_0x4327b3[_0x9133('0x1e')]+_0x4327b3['limit'],_0x28ffcb;if(_0x4f4f14>=_0x13f8fc){_0x4f4f14=_0x13f8fc;_0x28ffcb=0xc8;}else{_0x28ffcb=0xce;}_0x31847a[_0x9133('0x1b')](_0x28ffcb);return _0x31847a['set'](_0x9133('0x1f'),_0x1e23ce+'-'+_0x4f4f14+'/'+_0x13f8fc)['json'](_0x49cc5d);}return null;};}function patchUpdates(_0x115ee8){return function(_0x1d6d0b){try{jsonpatch['apply'](_0x1d6d0b,_0x115ee8,!![]);}catch(_0x38dd60){return BPromise['reject'](_0x38dd60);}return _0x1d6d0b[_0x9133('0x20')]();};}function saveUpdates(_0x57af5e,_0x5e4f0c){return function(_0x2f7354){if(_0x2f7354){return _0x2f7354['update'](_0x57af5e)[_0x9133('0x21')](function(_0x4c1088){return _0x4c1088;});}return null;};}function removeEntity(_0x5d4608,_0x4c846e){return function(_0x2e99a1){if(_0x2e99a1){return _0x2e99a1[_0x9133('0x22')]()['then'](function(){var _0x448f8b=_0x2e99a1[_0x9133('0x23')]({'plain':!![]});var _0xff08d5=_0x9133('0x24');return db['UserProfileResource'][_0x9133('0x22')]({'where':{'type':_0xff08d5,'resourceId':_0x448f8b['id']}})['then'](function(){return _0x2e99a1;});})[_0x9133('0x21')](function(){_0x5d4608[_0x9133('0x1b')](0xcc)[_0x9133('0x1a')]();});}};}function handleEntityNotFound(_0x14c1cb,_0x4483ef){return function(_0xe829b){if(!_0xe829b){_0x14c1cb[_0x9133('0x25')](0x194);}return _0xe829b;};}function handleError(_0x313d43,_0x1b6b3e){_0x1b6b3e=_0x1b6b3e||0x1f4;return function(_0x46050b){logger['error'](_0x46050b['stack']);if(_0x46050b[_0x9133('0x26')]){delete _0x46050b[_0x9133('0x26')];}_0x313d43[_0x9133('0x1b')](_0x1b6b3e)[_0x9133('0x27')](_0x46050b);};}exports['index']=function(_0x4ecd9e,_0x3e2404){var _0x45966d={},_0x188c49={},_0x26d351={'count':0x0,'rows':[]};var _0x390f50=_[_0x9133('0x28')](db['Campaign']['rawAttributes'],function(_0x5a27c1){return{'name':_0x5a27c1[_0x9133('0x29')],'type':_0x5a27c1['type'][_0x9133('0x2a')]};});_0x188c49[_0x9133('0x2b')]=_['map'](_0x390f50,_0x9133('0x26'));_0x188c49['query']=_[_0x9133('0x2c')](_0x4ecd9e[_0x9133('0x2d')]);_0x188c49[_0x9133('0x2e')]=_['intersection'](_0x188c49[_0x9133('0x2b')],_0x188c49[_0x9133('0x2d')]);_0x45966d[_0x9133('0x2f')]=_['intersection'](_0x188c49[_0x9133('0x2b')],qs[_0x9133('0x30')](_0x4ecd9e[_0x9133('0x2d')]['fields']));_0x45966d[_0x9133('0x2f')]=_0x45966d[_0x9133('0x2f')][_0x9133('0x31')]?_0x45966d[_0x9133('0x2f')]:_0x188c49['model'];if(!_0x4ecd9e[_0x9133('0x2d')][_0x9133('0x32')]('nolimit')){_0x45966d[_0x9133('0x33')]=qs[_0x9133('0x33')](_0x4ecd9e[_0x9133('0x2d')][_0x9133('0x33')]);_0x45966d[_0x9133('0x1e')]=qs[_0x9133('0x1e')](_0x4ecd9e[_0x9133('0x2d')][_0x9133('0x1e')]);}_0x45966d[_0x9133('0x34')]=qs[_0x9133('0x35')](_0x4ecd9e[_0x9133('0x2d')]['sort']);_0x45966d[_0x9133('0x36')]=qs[_0x9133('0x2e')](_['pick'](_0x4ecd9e[_0x9133('0x2d')],_0x188c49[_0x9133('0x2e')]));if(_0x4ecd9e[_0x9133('0x2d')][_0x9133('0x37')]){_0x45966d[_0x9133('0x36')]=_[_0x9133('0x38')](_0x45966d['where'],{'$or':_['map'](_0x390f50,function(_0x33c05b){if(_0x33c05b[_0x9133('0x39')]!==_0x9133('0x3a')){var _0x112514={};_0x112514[_0x33c05b[_0x9133('0x26')]]={'$like':'%'+_0x4ecd9e[_0x9133('0x2d')][_0x9133('0x37')]+'%'};return _0x112514;}})});}_0x45966d=_[_0x9133('0x38')]({},_0x45966d,_0x4ecd9e[_0x9133('0x3b')]);var _0x5a3f73={'where':_0x45966d[_0x9133('0x36')]};return db[_0x9133('0x3c')][_0x9133('0x1d')](_0x5a3f73)[_0x9133('0x21')](function(_0x3df6ca){_0x26d351['count']=_0x3df6ca;if(_0x4ecd9e[_0x9133('0x2d')][_0x9133('0x3d')]){_0x45966d[_0x9133('0x3e')]=[{'all':!![]}];}return db[_0x9133('0x3c')]['findAll'](_0x45966d);})[_0x9133('0x21')](function(_0x1293f1){_0x26d351[_0x9133('0x3f')]=_0x1293f1;return _0x26d351;})[_0x9133('0x21')](respondWithFilteredResult(_0x3e2404,_0x45966d))[_0x9133('0x40')](handleError(_0x3e2404,null));};exports[_0x9133('0x41')]=function(_0x3b2287,_0x4ca1a3){var _0x7f6cd9={'raw':![],'where':{'id':_0x3b2287['params']['id']}},_0x5e0fde={};_0x5e0fde[_0x9133('0x2b')]=_[_0x9133('0x2c')](db[_0x9133('0x3c')][_0x9133('0x42')]);_0x5e0fde[_0x9133('0x2d')]=_[_0x9133('0x2c')](_0x3b2287[_0x9133('0x2d')]);_0x5e0fde[_0x9133('0x2e')]=_[_0x9133('0x43')](_0x5e0fde['model'],_0x5e0fde[_0x9133('0x2d')]);_0x7f6cd9[_0x9133('0x2f')]=_[_0x9133('0x43')](_0x5e0fde['model'],qs['fields'](_0x3b2287[_0x9133('0x2d')][_0x9133('0x30')]));_0x7f6cd9['attributes']=_0x7f6cd9[_0x9133('0x2f')][_0x9133('0x31')]?_0x7f6cd9[_0x9133('0x2f')]:_0x5e0fde[_0x9133('0x2b')];if(_0x3b2287[_0x9133('0x2d')]['includeAll']){_0x7f6cd9[_0x9133('0x3e')]=[{'all':!![]}];}_0x7f6cd9=_[_0x9133('0x38')]({},_0x7f6cd9,_0x3b2287[_0x9133('0x3b')]);return db['Campaign'][_0x9133('0x44')](_0x7f6cd9)[_0x9133('0x21')](handleEntityNotFound(_0x4ca1a3,null))['then'](respondWithResult(_0x4ca1a3,null))['catch'](handleError(_0x4ca1a3,null));};exports[_0x9133('0x45')]=function(_0x2cd935,_0x4446fe){return db[_0x9133('0x3c')][_0x9133('0x45')](_0x2cd935[_0x9133('0x46')],{})[_0x9133('0x21')](function(_0x21177a){var _0x23f134=_0x2cd935[_0x9133('0x47')][_0x9133('0x23')]({'plain':!![]});if(!_0x23f134)throw new Error(_0x9133('0x48'));if(_0x23f134['role']==='user'){var _0xf2e098=_0x21177a['get']({'plain':!![]});var _0x43ef4f=_0x9133('0x24');return db[_0x9133('0x49')][_0x9133('0x44')]({'where':{'name':_0x43ef4f,'userProfileId':_0x23f134['userProfileId']},'raw':!![]})[_0x9133('0x21')](function(_0x25750f){if(_0x25750f&&_0x25750f[_0x9133('0x4a')]===0x0){return db['UserProfileResource'][_0x9133('0x45')]({'name':_0xf2e098[_0x9133('0x26')],'resourceId':_0xf2e098['id'],'type':_0x25750f[_0x9133('0x26')],'sectionId':_0x25750f['id']},{})['then'](function(){return _0x21177a;});}else{return _0x21177a;}})[_0x9133('0x40')](function(_0x4f7b1e){logger[_0x9133('0x4b')](_0x9133('0x4c'),_0x4f7b1e);throw _0x4f7b1e;});}return _0x21177a;})[_0x9133('0x21')](respondWithResult(_0x4446fe,0xc9))[_0x9133('0x40')](handleError(_0x4446fe,null));};exports['clone']=function(_0x4a346c,_0x2f09f6){var _0x213e3d={'where':{'id':_0x4a346c[_0x9133('0x4d')]['id']}},_0x20b1fe={};_0x20b1fe[_0x9133('0x2b')]=_['keys'](db['Campaign'][_0x9133('0x42')]);_0x213e3d[_0x9133('0x2f')]=_['intersection'](_0x20b1fe[_0x9133('0x2b')],qs[_0x9133('0x30')](_0x4a346c['query']['fields']));_0x213e3d['attributes']=_0x213e3d[_0x9133('0x2f')]['length']?_0x213e3d[_0x9133('0x2f')]:_0x20b1fe[_0x9133('0x2b')];if(_0x4a346c[_0x9133('0x2d')][_0x9133('0x3d')]){_0x213e3d['include']=[{'all':!![]}];}_0x213e3d=_[_0x9133('0x38')]({},_0x213e3d,_0x4a346c['options']);return db[_0x9133('0x3c')][_0x9133('0x44')](_0x213e3d)[_0x9133('0x21')](handleEntityNotFound(_0x2f09f6,null))[_0x9133('0x21')](function(_0x3b9927){if(_0x3b9927){var _0x3534bf=_0x3b9927['get']({'plain':!![]});_0x3534bf=qs['omit'](_0x3534bf,['id','createdAt',_0x9133('0x4e')]);_0x4a346c[_0x9133('0x46')]=_[_0x9133('0x4f')](_0x4a346c['body'],['id',_0x9133('0x50'),_0x9133('0x4e')]);return db[_0x9133('0x3c')][_0x9133('0x45')](_[_0x9133('0x38')](_0x3534bf,_0x4a346c[_0x9133('0x46')]),{'include':_0x4a346c[_0x9133('0x2d')][_0x9133('0x3d')]?[{'all':!![]}]:undefined})['then'](function(_0x464954){var _0x4ebeaf=_0x4a346c[_0x9133('0x47')]['get']({'plain':!![]});if(!_0x4ebeaf)throw new Error(_0x9133('0x48'));if(_0x4ebeaf[_0x9133('0x51')]==='user'){var _0x540b02=_0x464954[_0x9133('0x23')]({'plain':!![]});var _0x12c4d9=_0x9133('0x24');return db[_0x9133('0x49')][_0x9133('0x44')]({'where':{'name':_0x12c4d9,'userProfileId':_0x4ebeaf[_0x9133('0x52')]},'raw':!![]})[_0x9133('0x21')](function(_0x161938){if(_0x161938&&_0x161938[_0x9133('0x4a')]===0x0){return db[_0x9133('0x53')][_0x9133('0x45')]({'name':_0x540b02['name'],'resourceId':_0x540b02['id'],'type':_0x161938[_0x9133('0x26')],'sectionId':_0x161938['id']},{})['then'](function(){return _0x464954;});}else{return _0x464954;}})[_0x9133('0x40')](function(_0x217dc5){logger[_0x9133('0x4b')](_0x9133('0x4c'),_0x217dc5);throw _0x217dc5;});}return _0x464954;});}})[_0x9133('0x21')](respondWithResult(_0x2f09f6,0xc9))['catch'](handleError(_0x2f09f6,null));};exports[_0x9133('0x54')]=function(_0x1f0ca7,_0x19339e){if(_0x1f0ca7[_0x9133('0x46')]['id']){delete _0x1f0ca7['body']['id'];}return db[_0x9133('0x3c')][_0x9133('0x44')]({'where':{'id':_0x1f0ca7[_0x9133('0x4d')]['id']}})[_0x9133('0x21')](handleEntityNotFound(_0x19339e,null))['then'](saveUpdates(_0x1f0ca7['body'],null))[_0x9133('0x21')](respondWithResult(_0x19339e,null))[_0x9133('0x40')](handleError(_0x19339e,null));};exports[_0x9133('0x22')]=function(_0xeecd28,_0x28cc46){return db[_0x9133('0x3c')]['find']({'where':{'id':_0xeecd28[_0x9133('0x4d')]['id']}})[_0x9133('0x21')](handleEntityNotFound(_0x28cc46,null))[_0x9133('0x21')](removeEntity(_0x28cc46,null))[_0x9133('0x40')](handleError(_0x28cc46,null));};exports['getHoppers']=function(_0x47342a,_0x54ddcd,_0x77596){var _0x2730c8={'raw':!![],'where':{}};var _0x32192b={};var _0x39b46d={'count':0x0,'rows':[]};return db[_0x9133('0x3c')][_0x9133('0x55')]({'where':{'id':_0x47342a[_0x9133('0x4d')]['id']}})[_0x9133('0x21')](handleEntityNotFound(_0x54ddcd,null))['then'](function(_0x23bd83){if(_0x23bd83){_0x32192b[_0x9133('0x2b')]=_[_0x9133('0x2c')](db[_0x9133('0x56')][_0x9133('0x42')]);_0x32192b['query']=_['keys'](_0x47342a['query']);_0x32192b[_0x9133('0x2e')]=_[_0x9133('0x43')](_0x32192b[_0x9133('0x2b')],_0x32192b['query']);_0x2730c8[_0x9133('0x2f')]=_[_0x9133('0x43')](_0x32192b[_0x9133('0x2b')],qs[_0x9133('0x30')](_0x47342a[_0x9133('0x2d')][_0x9133('0x30')]));_0x2730c8[_0x9133('0x2f')]=_0x2730c8[_0x9133('0x2f')]['length']?_0x2730c8[_0x9133('0x2f')]:_0x32192b[_0x9133('0x2b')];if(!_0x47342a['query'][_0x9133('0x32')]('nolimit')){_0x2730c8[_0x9133('0x33')]=qs[_0x9133('0x33')](_0x47342a[_0x9133('0x2d')][_0x9133('0x33')]);_0x2730c8[_0x9133('0x1e')]=qs['offset'](_0x47342a[_0x9133('0x2d')][_0x9133('0x1e')]);}_0x2730c8[_0x9133('0x34')]=qs[_0x9133('0x35')](_0x47342a['query'][_0x9133('0x35')]);_0x2730c8[_0x9133('0x36')]=qs[_0x9133('0x2e')](_[_0x9133('0x57')](_0x47342a[_0x9133('0x2d')],_0x32192b[_0x9133('0x2e')]));_0x2730c8[_0x9133('0x36')][_0x9133('0x58')]=_0x23bd83['id'];if(_0x47342a[_0x9133('0x2d')][_0x9133('0x37')]){_0x2730c8[_0x9133('0x36')]=_['merge'](_0x2730c8[_0x9133('0x36')],{'$or':_[_0x9133('0x28')](_0x2730c8[_0x9133('0x2f')],function(_0x12ae5f){var _0x5dac5c={};_0x5dac5c[_0x12ae5f]={'$like':'%'+_0x47342a[_0x9133('0x2d')]['filter']+'%'};return _0x5dac5c;})});}_0x2730c8=_[_0x9133('0x38')]({},_0x2730c8,_0x47342a[_0x9133('0x3b')]);return db[_0x9133('0x56')]['count']({'where':_0x2730c8[_0x9133('0x36')]})[_0x9133('0x21')](function(_0x2d1cf6){_0x39b46d['count']=_0x2d1cf6;if(_0x47342a[_0x9133('0x2d')][_0x9133('0x3d')]){_0x2730c8['include']=[{'all':!![]}];}return db[_0x9133('0x56')][_0x9133('0x59')](_0x2730c8);})[_0x9133('0x21')](function(_0x5255ff){_0x39b46d[_0x9133('0x3f')]=_0x5255ff;return _0x39b46d;});}})['then'](respondWithFilteredResult(_0x54ddcd,_0x2730c8))[_0x9133('0x40')](handleError(_0x54ddcd,null));};exports[_0x9133('0x5a')]=function(_0x64e16,_0x4ac03e,_0x2bd590){var _0x54f9ad={'raw':!![],'where':{}};var _0x405854={};var _0x2840b1={'count':0x0,'rows':[]};return db[_0x9133('0x3c')][_0x9133('0x55')]({'where':{'id':_0x64e16[_0x9133('0x4d')]['id']}})[_0x9133('0x21')](handleEntityNotFound(_0x4ac03e,null))[_0x9133('0x21')](function(_0x3b854d){if(_0x3b854d){_0x405854['model']=_[_0x9133('0x2c')](db[_0x9133('0x5b')][_0x9133('0x42')]);_0x405854[_0x9133('0x2d')]=_[_0x9133('0x2c')](_0x64e16['query']);_0x405854[_0x9133('0x2e')]=_[_0x9133('0x43')](_0x405854[_0x9133('0x2b')],_0x405854[_0x9133('0x2d')]);_0x54f9ad['attributes']=_[_0x9133('0x43')](_0x405854['model'],qs[_0x9133('0x30')](_0x64e16[_0x9133('0x2d')][_0x9133('0x30')]));_0x54f9ad[_0x9133('0x2f')]=_0x54f9ad['attributes'][_0x9133('0x31')]?_0x54f9ad[_0x9133('0x2f')]:_0x405854[_0x9133('0x2b')];if(!_0x64e16[_0x9133('0x2d')][_0x9133('0x32')]('nolimit')){_0x54f9ad['limit']=qs['limit'](_0x64e16['query'][_0x9133('0x33')]);_0x54f9ad[_0x9133('0x1e')]=qs[_0x9133('0x1e')](_0x64e16['query'][_0x9133('0x1e')]);}_0x54f9ad[_0x9133('0x34')]=qs[_0x9133('0x35')](_0x64e16[_0x9133('0x2d')][_0x9133('0x35')]);_0x54f9ad['where']=qs[_0x9133('0x2e')](_['pick'](_0x64e16[_0x9133('0x2d')],_0x405854[_0x9133('0x2e')]));_0x54f9ad[_0x9133('0x36')][_0x9133('0x58')]=_0x3b854d['id'];if(_0x64e16[_0x9133('0x2d')]['filter']){_0x54f9ad[_0x9133('0x36')]=_[_0x9133('0x38')](_0x54f9ad[_0x9133('0x36')],{'$or':_['map'](_0x54f9ad[_0x9133('0x2f')],function(_0x4b5eb0){var _0x17c084={};_0x17c084[_0x4b5eb0]={'$like':'%'+_0x64e16[_0x9133('0x2d')][_0x9133('0x37')]+'%'};return _0x17c084;})});}_0x54f9ad=_[_0x9133('0x38')]({},_0x54f9ad,_0x64e16[_0x9133('0x3b')]);return db[_0x9133('0x5b')]['count']({'where':_0x54f9ad[_0x9133('0x36')]})[_0x9133('0x21')](function(_0x2484e9){_0x2840b1[_0x9133('0x1d')]=_0x2484e9;if(_0x64e16[_0x9133('0x2d')][_0x9133('0x3d')]){_0x54f9ad['include']=[{'all':!![]}];}return db['CmHopperHistory'][_0x9133('0x59')](_0x54f9ad);})[_0x9133('0x21')](function(_0x52e741){_0x2840b1[_0x9133('0x3f')]=_0x52e741;return _0x2840b1;});}})['then'](respondWithFilteredResult(_0x4ac03e,_0x54f9ad))[_0x9133('0x40')](handleError(_0x4ac03e,null));};exports[_0x9133('0x5c')]=function(_0x55a0f1,_0x38dfab,_0x3fc48f){var _0xb85c21={'raw':!![],'where':{}};var _0x554ecb={};var _0x37f3bc={'count':0x0,'rows':[]};return db['Campaign'][_0x9133('0x55')]({'where':{'id':_0x55a0f1[_0x9133('0x4d')]['id']}})['then'](handleEntityNotFound(_0x38dfab,null))[_0x9133('0x21')](function(_0x1d47c9){if(_0x1d47c9){_0x554ecb[_0x9133('0x2b')]=_[_0x9133('0x2c')](db[_0x9133('0x5d')]['rawAttributes']);_0x554ecb['query']=_[_0x9133('0x2c')](_0x55a0f1[_0x9133('0x2d')]);_0x554ecb['filters']=_[_0x9133('0x43')](_0x554ecb[_0x9133('0x2b')],_0x554ecb['query']);_0xb85c21[_0x9133('0x2f')]=_[_0x9133('0x43')](_0x554ecb[_0x9133('0x2b')],qs[_0x9133('0x30')](_0x55a0f1[_0x9133('0x2d')][_0x9133('0x30')]));_0xb85c21[_0x9133('0x2f')]=_0xb85c21[_0x9133('0x2f')]['length']?_0xb85c21[_0x9133('0x2f')]:_0x554ecb['model'];if(!_0x55a0f1['query'][_0x9133('0x32')](_0x9133('0x5e'))){_0xb85c21[_0x9133('0x33')]=qs[_0x9133('0x33')](_0x55a0f1[_0x9133('0x2d')][_0x9133('0x33')]);_0xb85c21[_0x9133('0x1e')]=qs['offset'](_0x55a0f1[_0x9133('0x2d')][_0x9133('0x1e')]);}_0xb85c21[_0x9133('0x34')]=qs['sort'](_0x55a0f1[_0x9133('0x2d')]['sort']);_0xb85c21[_0x9133('0x36')]=qs[_0x9133('0x2e')](_[_0x9133('0x57')](_0x55a0f1[_0x9133('0x2d')],_0x554ecb[_0x9133('0x2e')]));_0xb85c21[_0x9133('0x36')][_0x9133('0x58')]=_0x1d47c9['id'];if(_0x55a0f1[_0x9133('0x2d')][_0x9133('0x37')]){_0xb85c21['where']=_[_0x9133('0x38')](_0xb85c21[_0x9133('0x36')],{'$or':_[_0x9133('0x28')](_0xb85c21[_0x9133('0x2f')],function(_0x496c00){var _0x21e85d={};_0x21e85d[_0x496c00]={'$like':'%'+_0x55a0f1['query'][_0x9133('0x37')]+'%'};return _0x21e85d;})});}_0xb85c21=_['merge']({},_0xb85c21,_0x55a0f1['options']);return db[_0x9133('0x5d')]['count']({'where':_0xb85c21[_0x9133('0x36')]})['then'](function(_0x5388e7){_0x37f3bc['count']=_0x5388e7;if(_0x55a0f1[_0x9133('0x2d')]['includeAll']){_0xb85c21[_0x9133('0x3e')]=[{'all':!![]}];}return db['CmHopperFinal'][_0x9133('0x59')](_0xb85c21);})[_0x9133('0x21')](function(_0x8cad68){_0x37f3bc[_0x9133('0x3f')]=_0x8cad68;return _0x37f3bc;});}})[_0x9133('0x21')](respondWithFilteredResult(_0x38dfab,_0xb85c21))[_0x9133('0x40')](handleError(_0x38dfab,null));};exports[_0x9133('0x5f')]=function(_0x35716b,_0x259698,_0xe9a042){var _0x40950e={'raw':!![],'where':{}};var _0x59098c={};var _0x5481e6={'count':0x0,'rows':[]};return db[_0x9133('0x3c')][_0x9133('0x55')]({'where':{'id':_0x35716b[_0x9133('0x4d')]['id']}})[_0x9133('0x21')](handleEntityNotFound(_0x259698,null))[_0x9133('0x21')](function(_0x17b3fc){if(_0x17b3fc){_0x59098c[_0x9133('0x2b')]=_[_0x9133('0x2c')](db[_0x9133('0x60')][_0x9133('0x42')]);_0x59098c[_0x9133('0x2d')]=_['keys'](_0x35716b[_0x9133('0x2d')]);_0x59098c[_0x9133('0x2e')]=_[_0x9133('0x43')](_0x59098c[_0x9133('0x2b')],_0x59098c[_0x9133('0x2d')]);_0x40950e[_0x9133('0x2f')]=_[_0x9133('0x43')](_0x59098c[_0x9133('0x2b')],qs[_0x9133('0x30')](_0x35716b[_0x9133('0x2d')][_0x9133('0x30')]));_0x40950e[_0x9133('0x2f')]=_0x40950e[_0x9133('0x2f')][_0x9133('0x31')]?_0x40950e['attributes']:_0x59098c[_0x9133('0x2b')];if(!_0x35716b[_0x9133('0x2d')][_0x9133('0x32')](_0x9133('0x5e'))){_0x40950e[_0x9133('0x33')]=qs['limit'](_0x35716b[_0x9133('0x2d')][_0x9133('0x33')]);_0x40950e[_0x9133('0x1e')]=qs[_0x9133('0x1e')](_0x35716b[_0x9133('0x2d')][_0x9133('0x1e')]);}_0x40950e[_0x9133('0x34')]=qs[_0x9133('0x35')](_0x35716b[_0x9133('0x2d')]['sort']);_0x40950e[_0x9133('0x36')]=qs[_0x9133('0x2e')](_[_0x9133('0x57')](_0x35716b[_0x9133('0x2d')],_0x59098c['filters']));_0x40950e[_0x9133('0x36')][_0x9133('0x58')]=_0x17b3fc['id'];if(_0x35716b[_0x9133('0x2d')][_0x9133('0x37')]){_0x40950e['where']=_[_0x9133('0x38')](_0x40950e['where'],{'$or':_[_0x9133('0x28')](_0x40950e['attributes'],function(_0x4f4109){var _0x45f939={};_0x45f939[_0x4f4109]={'$like':'%'+_0x35716b['query'][_0x9133('0x37')]+'%'};return _0x45f939;})});}_0x40950e=_[_0x9133('0x38')]({},_0x40950e,_0x35716b[_0x9133('0x3b')]);return db[_0x9133('0x60')][_0x9133('0x1d')]({'where':_0x40950e[_0x9133('0x36')]})[_0x9133('0x21')](function(_0x52af69){_0x5481e6[_0x9133('0x1d')]=_0x52af69;if(_0x35716b[_0x9133('0x2d')][_0x9133('0x3d')]){_0x40950e[_0x9133('0x3e')]=[{'all':!![]}];}return db['CmHopperBlack'][_0x9133('0x59')](_0x40950e);})[_0x9133('0x21')](function(_0x5a45e6){_0x5481e6[_0x9133('0x3f')]=_0x5a45e6;return _0x5481e6;});}})[_0x9133('0x21')](respondWithFilteredResult(_0x259698,_0x40950e))[_0x9133('0x40')](handleError(_0x259698,null));};exports['getLists']=function(_0x5263b1,_0x48dc14,_0x11197e){var _0x37dacd={};var _0x50255b={};var _0x220665;var _0x2d1c6f;return db[_0x9133('0x3c')][_0x9133('0x55')]({'where':{'id':_0x5263b1[_0x9133('0x4d')]['id']}})['then'](handleEntityNotFound(_0x48dc14,null))['then'](function(_0xc7a8bc){if(_0xc7a8bc){_0x220665=_0xc7a8bc;_0x50255b[_0x9133('0x2b')]=_[_0x9133('0x2c')](db[_0x9133('0x61')]['rawAttributes']);_0x50255b['query']=_[_0x9133('0x2c')](_0x5263b1[_0x9133('0x2d')]);_0x50255b['filters']=_[_0x9133('0x43')](_0x50255b[_0x9133('0x2b')],_0x50255b['query']);_0x37dacd[_0x9133('0x2f')]=_[_0x9133('0x43')](_0x50255b[_0x9133('0x2b')],qs[_0x9133('0x30')](_0x5263b1[_0x9133('0x2d')][_0x9133('0x30')]));_0x37dacd[_0x9133('0x2f')]=_0x37dacd['attributes'][_0x9133('0x31')]?_0x37dacd['attributes']:_0x50255b['model'];_0x37dacd[_0x9133('0x34')]=qs[_0x9133('0x35')](_0x5263b1[_0x9133('0x2d')]['sort']);_0x37dacd['where']=qs[_0x9133('0x2e')](_['pick'](_0x5263b1[_0x9133('0x2d')],_0x50255b['filters']));if(_0x5263b1[_0x9133('0x2d')][_0x9133('0x37')]){_0x37dacd[_0x9133('0x36')]=_['merge'](_0x37dacd[_0x9133('0x36')],{'$or':_['map'](_0x37dacd['attributes'],function(_0xbfd6b2){var _0x1c3cf7={};_0x1c3cf7[_0xbfd6b2]={'$like':'%'+_0x5263b1[_0x9133('0x2d')]['filter']+'%'};return _0x1c3cf7;})});}_0x37dacd=_[_0x9133('0x38')]({},_0x37dacd,_0x5263b1[_0x9133('0x3b')]);return _0x220665[_0x9133('0x62')](_0x37dacd);}})[_0x9133('0x21')](function(_0x216dbf){if(_0x216dbf){_0x2d1c6f=_0x216dbf['length'];if(!_0x5263b1['query']['hasOwnProperty'](_0x9133('0x5e'))){_0x37dacd[_0x9133('0x33')]=qs[_0x9133('0x33')](_0x5263b1[_0x9133('0x2d')][_0x9133('0x33')]);_0x37dacd[_0x9133('0x1e')]=qs[_0x9133('0x1e')](_0x5263b1[_0x9133('0x2d')][_0x9133('0x1e')]);}return _0x220665[_0x9133('0x62')](_0x37dacd);}})['then'](function(_0x365502){if(_0x365502){return _0x365502?{'count':_0x2d1c6f,'rows':_0x365502}:null;}})[_0x9133('0x21')](respondWithResult(_0x48dc14,null))['catch'](handleError(_0x48dc14,null));};exports['addLists']=function(_0x4740df,_0x17bc67,_0x7109d0){var _0x465d6d,_0x2b5d5c;return db['Campaign']['find']({'where':{'id':_0x4740df[_0x9133('0x4d')]['id']}})[_0x9133('0x21')](handleEntityNotFound(_0x17bc67,null))[_0x9133('0x21')](function(_0x45261c){if(_0x45261c){_0x2b5d5c=_0x45261c;return _0x45261c[_0x9133('0x63')](_0x4740df[_0x9133('0x46')][_0x9133('0x64')],_[_0x9133('0x4f')](_0x4740df[_0x9133('0x46')],[_0x9133('0x64'),'id'])||{});}return null;})['spread'](function(_0x2b3ee5){var _0x35a970;_0x465d6d=_0x2b3ee5||[];var _0x169d25=[];if(_0x2b3ee5){for(var _0x1b6ca9=0x0;_0x1b6ca9<_0x2b3ee5[_0x9133('0x31')];_0x1b6ca9+=0x1){var _0x1d6fb4=_0x2b3ee5[_0x1b6ca9]['get']({'plain':!![]});_0x2b5d5c[_0x9133('0x65')]=_0x4740df[_0x9133('0x46')][_0x9133('0x65')]?_0x4740df[_0x9133('0x46')][_0x9133('0x65')]:_0x2b5d5c[_0x9133('0x65')];switch(_0x2b5d5c[_0x9133('0x65')]){case'always':_0x35a970=squel['insert']()[_0x9133('0x66')](_0x9133('0x67'))[_0x9133('0x68')](['phone',_0x9133('0x69'),_0x9133('0x6a'),_0x9133('0x6b'),'CampaignId',_0x9133('0x50'),'updatedAt'],squel['select']()['field']('phone',_0x9133('0x6c'))[_0x9133('0x6d')]('NOW()',_0x9133('0x69'))['field']('id',_0x9133('0x6a'))['field'](_0x1d6fb4[_0x9133('0x6e')][_0x9133('0x6f')](),_0x9133('0x6b'))[_0x9133('0x6d')](_0x4740df[_0x9133('0x4d')]['id'][_0x9133('0x6f')](),_0x9133('0x58'))[_0x9133('0x6d')](_0x9133('0x70'),_0x9133('0x50'))[_0x9133('0x6d')](_0x9133('0x70'),'updatedAt')[_0x9133('0x71')](_0x9133('0x72'))[_0x9133('0x36')](_0x9133('0x73'))[_0x9133('0x36')]('ListId\x20=\x20?',_0x1d6fb4[_0x9133('0x6e')][_0x9133('0x6f')]())[_0x9133('0x36')](_0x9133('0x74'))[_0x9133('0x36')](_0x9133('0x75'),squel[_0x9133('0x76')]()['field'](_0x9133('0x77'))[_0x9133('0x71')](_0x9133('0x78'))[_0x9133('0x36')](_0x9133('0x79'),_0x4740df['params']['id']['toString']()))['where'](_0x9133('0x75'),squel[_0x9133('0x76')]()[_0x9133('0x6d')](_0x9133('0x7a'))[_0x9133('0x71')](_0x9133('0x67'))[_0x9133('0x36')](_0x9133('0x79'),_0x4740df['params']['id'][_0x9133('0x6f')]())))[_0x9133('0x6f')]();break;case'onlyIfOpen':_0x35a970=squel['insert']()[_0x9133('0x66')](_0x9133('0x67'))[_0x9133('0x68')](['phone','scheduledAt','ContactId',_0x9133('0x6b'),'CampaignId','createdAt',_0x9133('0x4e')],squel[_0x9133('0x76')]()[_0x9133('0x6d')](_0x9133('0x6c'),_0x9133('0x6c'))[_0x9133('0x6d')](_0x9133('0x70'),_0x9133('0x69'))['field']('id',_0x9133('0x6a'))['field'](_0x1d6fb4['CmListId'][_0x9133('0x6f')](),_0x9133('0x6b'))[_0x9133('0x6d')](_0x4740df['params']['id'][_0x9133('0x6f')](),_0x9133('0x58'))[_0x9133('0x6d')](_0x9133('0x70'),'createdAt')[_0x9133('0x6d')](_0x9133('0x70'),'updatedAt')['from'](_0x9133('0x72'))[_0x9133('0x36')](_0x9133('0x73'))[_0x9133('0x36')](_0x9133('0x7b'),_0x1d6fb4['CmListId'][_0x9133('0x6f')]())['where'](_0x9133('0x74'))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0x9133('0x76')]()[_0x9133('0x6d')]('COALESCE(phone,\x27\x27)')[_0x9133('0x71')](_0x9133('0x67'))['where'](_0x9133('0x79'),_0x4740df[_0x9133('0x4d')]['id'][_0x9133('0x6f')]())))[_0x9133('0x6f')]();break;default:_0x35a970=squel[_0x9133('0x7c')]()[_0x9133('0x66')](_0x9133('0x67'))[_0x9133('0x68')]([_0x9133('0x6c'),_0x9133('0x69'),_0x9133('0x6a'),_0x9133('0x6b'),_0x9133('0x58'),_0x9133('0x50'),_0x9133('0x4e')],squel[_0x9133('0x76')]()['field'](_0x9133('0x6c'),'phone')[_0x9133('0x6d')](_0x9133('0x70'),_0x9133('0x69'))[_0x9133('0x6d')]('id',_0x9133('0x6a'))[_0x9133('0x6d')](_0x1d6fb4['CmListId'][_0x9133('0x6f')](),'ListId')[_0x9133('0x6d')](_0x4740df[_0x9133('0x4d')]['id']['toString'](),_0x9133('0x58'))[_0x9133('0x6d')](_0x9133('0x70'),_0x9133('0x50'))[_0x9133('0x6d')](_0x9133('0x70'),_0x9133('0x4e'))[_0x9133('0x71')](_0x9133('0x72'))[_0x9133('0x36')](_0x9133('0x73'))[_0x9133('0x36')]('ListId\x20=\x20?',_0x1d6fb4[_0x9133('0x6e')][_0x9133('0x6f')]())['where'](_0x9133('0x74')))['toString']();}_0x169d25['push'](db[_0x9133('0x7d')][_0x9133('0x2d')](_0x35a970));}return BPromise[_0x9133('0x7e')](_0x169d25);}})['then'](function(){return _0x465d6d;})[_0x9133('0x21')](respondWithResult(_0x17bc67,null))['catch'](handleError(_0x17bc67,null));};exports[_0x9133('0x7f')]=function(_0x3a34f0,_0x2b3df1,_0x2f1030){return db['Campaign'][_0x9133('0x44')]({'where':{'id':_0x3a34f0['params']['id']}})['then'](handleEntityNotFound(_0x2b3df1,null))[_0x9133('0x21')](function(_0x545d54){if(_0x545d54){return _0x545d54['removeLists'](_0x3a34f0[_0x9133('0x2d')]['ids']);}})[_0x9133('0x21')](function(_0x555e53){if(_0x555e53){return db[_0x9133('0x56')]['destroy']({'where':{'ListId':_0x3a34f0[_0x9133('0x2d')][_0x9133('0x64')],'CampaignId':_0x3a34f0[_0x9133('0x4d')]['id']}})['then'](function(){return _0x555e53;});}})[_0x9133('0x21')](respondWithStatusCode(_0x2b3df1,null))[_0x9133('0x40')](handleError(_0x2b3df1,null));};exports[_0x9133('0x80')]=function(_0x22c96c,_0x338a5e,_0x129671){var _0x2bc853={'raw':!![],'where':{}};var _0x4ea0df={};var _0x4ab2e3={'count':0x0,'rows':[]};return db[_0x9133('0x3c')][_0x9133('0x55')]({'where':{'id':_0x22c96c['params']['id']}})[_0x9133('0x21')](handleEntityNotFound(_0x338a5e,null))['then'](function(_0x123bbf){if(_0x123bbf){_0x4ea0df['model']=_[_0x9133('0x2c')](db['CmList'][_0x9133('0x42')]);_0x4ea0df['query']=_['keys'](_0x22c96c[_0x9133('0x2d')]);_0x4ea0df['filters']=_[_0x9133('0x43')](_0x4ea0df[_0x9133('0x2b')],_0x4ea0df[_0x9133('0x2d')]);_0x2bc853['attributes']=_[_0x9133('0x43')](_0x4ea0df['model'],qs[_0x9133('0x30')](_0x22c96c[_0x9133('0x2d')][_0x9133('0x30')]));_0x2bc853[_0x9133('0x2f')]=_0x2bc853[_0x9133('0x2f')][_0x9133('0x31')]?_0x2bc853[_0x9133('0x2f')]:_0x4ea0df['model'];if(!_0x22c96c[_0x9133('0x2d')]['hasOwnProperty'](_0x9133('0x5e'))){_0x2bc853[_0x9133('0x33')]=qs['limit'](_0x22c96c['query'][_0x9133('0x33')]);_0x2bc853[_0x9133('0x1e')]=qs[_0x9133('0x1e')](_0x22c96c[_0x9133('0x2d')][_0x9133('0x1e')]);}_0x2bc853[_0x9133('0x34')]=qs[_0x9133('0x35')](_0x22c96c[_0x9133('0x2d')][_0x9133('0x35')]);_0x2bc853[_0x9133('0x36')]=qs[_0x9133('0x2e')](_[_0x9133('0x57')](_0x22c96c['query'],_0x4ea0df[_0x9133('0x2e')]));_0x2bc853[_0x9133('0x36')][_0x9133('0x58')]=_0x123bbf['id'];if(_0x22c96c[_0x9133('0x2d')][_0x9133('0x37')]){_0x2bc853[_0x9133('0x36')]=_[_0x9133('0x38')](_0x2bc853['where'],{'$or':_[_0x9133('0x28')](_0x2bc853['attributes'],function(_0x1ea320){var _0x4a59a8={};_0x4a59a8[_0x1ea320]={'$like':'%'+_0x22c96c[_0x9133('0x2d')]['filter']+'%'};return _0x4a59a8;})});}_0x2bc853=_[_0x9133('0x38')]({},_0x2bc853,_0x22c96c[_0x9133('0x3b')]);return db[_0x9133('0x61')][_0x9133('0x1d')]({'where':_0x2bc853['where']})[_0x9133('0x21')](function(_0x32e7c5){_0x4ab2e3[_0x9133('0x1d')]=_0x32e7c5;if(_0x22c96c[_0x9133('0x2d')]['includeAll']){_0x2bc853['include']=[{'all':!![]}];}return db[_0x9133('0x61')][_0x9133('0x59')](_0x2bc853);})[_0x9133('0x21')](function(_0x4af4c1){_0x4ab2e3[_0x9133('0x3f')]=_0x4af4c1;return _0x4ab2e3;});}})[_0x9133('0x21')](respondWithFilteredResult(_0x338a5e,_0x2bc853))[_0x9133('0x40')](handleError(_0x338a5e,null));};exports[_0x9133('0x81')]=function(_0x294911,_0x530ed9,_0x1324d4){var _0x54ed64,_0x24aa59;return db[_0x9133('0x3c')][_0x9133('0x44')]({'where':{'id':_0x294911[_0x9133('0x4d')]['id']}})[_0x9133('0x21')](handleEntityNotFound(_0x530ed9,null))[_0x9133('0x21')](function(_0x46451e){if(_0x46451e){_0x24aa59=_0x46451e;return _0x46451e[_0x9133('0x81')](_0x294911[_0x9133('0x46')]['ids'],_[_0x9133('0x4f')](_0x294911[_0x9133('0x46')],[_0x9133('0x64'),'id'])||{});}return null;})['spread'](function(_0x1f6d30){var _0x5e20b1;_0x54ed64=_0x1f6d30||[];var _0x5eea9f=[];if(_0x1f6d30){for(var _0x5eb514=0x0;_0x5eb514<_0x1f6d30['length'];_0x5eb514+=0x1){var _0x41f31a=_0x1f6d30[_0x5eb514][_0x9133('0x23')]({'plain':!![]});_0x5e20b1=squel[_0x9133('0x7c')]()[_0x9133('0x66')]('cm_hopper_black')[_0x9133('0x68')]([_0x9133('0x6c'),'ContactId',_0x9133('0x6b'),'CampaignId',_0x9133('0x50'),_0x9133('0x4e')],squel[_0x9133('0x76')]()[_0x9133('0x6d')]('phone','phone')['field']('id',_0x9133('0x6a'))['field'](_0x41f31a[_0x9133('0x6e')]['toString'](),'ListId')[_0x9133('0x6d')](_0x294911[_0x9133('0x4d')]['id'][_0x9133('0x6f')](),_0x9133('0x58'))[_0x9133('0x6d')](_0x9133('0x70'),_0x9133('0x50'))['field']('NOW()','updatedAt')[_0x9133('0x71')](_0x9133('0x72'))['where'](_0x9133('0x73'))[_0x9133('0x36')]('ListId\x20=\x20?',_0x41f31a['CmListId'][_0x9133('0x6f')]())[_0x9133('0x36')](_0x9133('0x74')))['toString']();_0x5eea9f[_0x9133('0x82')](db['sequelize'][_0x9133('0x2d')](_0x5e20b1));}return BPromise[_0x9133('0x7e')](_0x5eea9f);}})[_0x9133('0x21')](function(){return _0x54ed64;})[_0x9133('0x21')](respondWithResult(_0x530ed9,null))['catch'](handleError(_0x530ed9,null));};exports[_0x9133('0x83')]=function(_0x2eb045,_0x4450f0,_0x5de163){return db[_0x9133('0x3c')][_0x9133('0x44')]({'where':{'id':_0x2eb045[_0x9133('0x4d')]['id']}})[_0x9133('0x21')](handleEntityNotFound(_0x4450f0,null))[_0x9133('0x21')](function(_0x24d14b){if(_0x24d14b){return _0x24d14b[_0x9133('0x83')](_0x2eb045[_0x9133('0x2d')][_0x9133('0x64')]);}})[_0x9133('0x21')](function(_0x608f89){if(_0x608f89){return db[_0x9133('0x60')][_0x9133('0x22')]({'where':{'ListId':_0x2eb045[_0x9133('0x2d')][_0x9133('0x64')],'CampaignId':_0x2eb045[_0x9133('0x4d')]['id']}})['then'](function(){return _0x608f89;});}})['then'](respondWithStatusCode(_0x4450f0,null))[_0x9133('0x40')](handleError(_0x4450f0,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index f63962f..c2aa0f6 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 _0x8bcb=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','Campaign','campaigns','lodash','../../config/logger','api'];(function(_0x3ed0d5,_0x5f0e1f){var _0x5e4563=function(_0x1517ea){while(--_0x1517ea){_0x3ed0d5['push'](_0x3ed0d5['shift']());}};_0x5e4563(++_0x5f0e1f);}(_0x8bcb,0x1c4));var _0xb8bc=function(_0x3a53f2,_0x2e5f6f){_0x3a53f2=_0x3a53f2-0x0;var _0x1033bf=_0x8bcb[_0x3a53f2];return _0x1033bf;};'use strict';var _=require(_0xb8bc('0x0'));var util=require('util');var logger=require(_0xb8bc('0x1'))(_0xb8bc('0x2'));var moment=require(_0xb8bc('0x3'));var BPromise=require(_0xb8bc('0x4'));var rp=require(_0xb8bc('0x5'));var fs=require('fs');var path=require(_0xb8bc('0x6'));var rimraf=require(_0xb8bc('0x7'));var config=require(_0xb8bc('0x8'));var attributes=require('./campaign.attributes');module[_0xb8bc('0x9')]=function(_0x2541ea,_0x4e1e80){return _0x2541ea[_0xb8bc('0xa')](_0xb8bc('0xb'),attributes,{'tableName':_0xb8bc('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf494=['exports','Campaign','lodash','util','api','bluebird','request-promise','path','../../config/environment','./campaign.attributes'];(function(_0x405426,_0xecd678){var _0x5bcf2f=function(_0x2ee7b1){while(--_0x2ee7b1){_0x405426['push'](_0x405426['shift']());}};_0x5bcf2f(++_0xecd678);}(_0xf494,0x7a));var _0x4f49=function(_0x5eec52,_0x3351d9){_0x5eec52=_0x5eec52-0x0;var _0x31a3ea=_0xf494[_0x5eec52];return _0x31a3ea;};'use strict';var _=require(_0x4f49('0x0'));var util=require(_0x4f49('0x1'));var logger=require('../../config/logger')(_0x4f49('0x2'));var moment=require('moment');var BPromise=require(_0x4f49('0x3'));var rp=require(_0x4f49('0x4'));var fs=require('fs');var path=require(_0x4f49('0x5'));var rimraf=require('rimraf');var config=require(_0x4f49('0x6'));var attributes=require(_0x4f49('0x7'));module[_0x4f49('0x8')]=function(_0x126546,_0xdb8d88){return _0x126546['define'](_0x4f49('0x9'),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 a74c63a..95df394 100644 --- a/server/api/campaign/campaign.rpc.js +++ b/server/api/campaign/campaign.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['catch','GetCampaign','findAll','raw','options','where','attributes','limit','map','include','model','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x76fd56,_0x18ffbc){var _0x3aa596=function(_0x9c1529){while(--_0x9c1529){_0x76fd56['push'](_0x76fd56['shift']());}};_0x3aa596(++_0x18ffbc);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('Campaign,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});}exports[_0x7995('0x18')]=function(_0x291317){var _0x1e1415=this;return new Promise(function(_0x37a7d4,_0x4faa60){return db['Campaign'][_0x7995('0x19')]({'raw':_0x291317['options']?_0x291317['options'][_0x7995('0x1a')]===undefined?!![]:![]:!![],'where':_0x291317[_0x7995('0x1b')]?_0x291317['options'][_0x7995('0x1c')]||null:null,'attributes':_0x291317['options']?_0x291317['options'][_0x7995('0x1d')]||null:null,'limit':_0x291317[_0x7995('0x1b')]?_0x291317[_0x7995('0x1b')][_0x7995('0x1e')]||null:null,'include':_0x291317[_0x7995('0x1b')]?_0x291317[_0x7995('0x1b')]['include']?_[_0x7995('0x1f')](_0x291317[_0x7995('0x1b')][_0x7995('0x20')],function(_0x285437){return{'model':db[_0x285437[_0x7995('0x21')]],'as':_0x285437['as'],'attributes':_0x285437[_0x7995('0x1d')],'include':_0x285437[_0x7995('0x20')]?_[_0x7995('0x1f')](_0x285437['include'],function(_0x39df42){return{'model':db[_0x39df42[_0x7995('0x21')]],'as':_0x39df42['as'],'attributes':_0x39df42[_0x7995('0x1d')],'include':_0x39df42[_0x7995('0x20')]?_[_0x7995('0x1f')](_0x39df42[_0x7995('0x20')],function(_0x56691a){return{'model':db[_0x56691a[_0x7995('0x21')]],'as':_0x56691a['as'],'attributes':_0x56691a['attributes']};}):[]};}):[]};}):[]:[]})[_0x7995('0xc')](function(_0x49bc7e){logger[_0x7995('0xd')](_0x7995('0x18'),_0x291317);logger[_0x7995('0x10')]('GetCampaign',_0x291317,JSON[_0x7995('0x12')](_0x49bc7e));_0x37a7d4(_0x49bc7e);})['catch'](function(_0x456a28){logger[_0x7995('0x13')](_0x7995('0x18'),_0x456a28['message'],_0x291317);_0x4faa60(_0x1e1415['error'](0x1f4,_0x456a28['message']));});});}; \ No newline at end of file +var _0x9957=['catch','GetCampaign','findAll','raw','options','where','attributes','limit','map','include','model','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x5b5c8c,_0xb1bcf7){var _0x43a2d1=function(_0x3bc454){while(--_0x3bc454){_0x5b5c8c['push'](_0x5b5c8c['shift']());}};_0x43a2d1(++_0xb1bcf7);}(_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});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('Campaign,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});}exports[_0x7995('0x18')]=function(_0x291317){var _0x1e1415=this;return new Promise(function(_0x37a7d4,_0x4faa60){return db['Campaign'][_0x7995('0x19')]({'raw':_0x291317['options']?_0x291317['options'][_0x7995('0x1a')]===undefined?!![]:![]:!![],'where':_0x291317[_0x7995('0x1b')]?_0x291317['options'][_0x7995('0x1c')]||null:null,'attributes':_0x291317['options']?_0x291317['options'][_0x7995('0x1d')]||null:null,'limit':_0x291317[_0x7995('0x1b')]?_0x291317[_0x7995('0x1b')][_0x7995('0x1e')]||null:null,'include':_0x291317[_0x7995('0x1b')]?_0x291317[_0x7995('0x1b')]['include']?_[_0x7995('0x1f')](_0x291317[_0x7995('0x1b')][_0x7995('0x20')],function(_0x285437){return{'model':db[_0x285437[_0x7995('0x21')]],'as':_0x285437['as'],'attributes':_0x285437[_0x7995('0x1d')],'include':_0x285437[_0x7995('0x20')]?_[_0x7995('0x1f')](_0x285437['include'],function(_0x39df42){return{'model':db[_0x39df42[_0x7995('0x21')]],'as':_0x39df42['as'],'attributes':_0x39df42[_0x7995('0x1d')],'include':_0x39df42[_0x7995('0x20')]?_[_0x7995('0x1f')](_0x39df42[_0x7995('0x20')],function(_0x56691a){return{'model':db[_0x56691a[_0x7995('0x21')]],'as':_0x56691a['as'],'attributes':_0x56691a['attributes']};}):[]};}):[]};}):[]:[]})[_0x7995('0xc')](function(_0x49bc7e){logger[_0x7995('0xd')](_0x7995('0x18'),_0x291317);logger[_0x7995('0x10')]('GetCampaign',_0x291317,JSON[_0x7995('0x12')](_0x49bc7e));_0x37a7d4(_0x49bc7e);})['catch'](function(_0x456a28){logger[_0x7995('0x13')](_0x7995('0x18'),_0x456a28['message'],_0x291317);_0x4faa60(_0x1e1415['error'](0x1f4,_0x456a28['message']));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index dda7f3f..633762c 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 _0x986b=['/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','/:id/hopper_black','/:id/lists','getLists','getBlackLists','post','/:id/clone','/:id/blacklists','addBlackLists','put','delete','destroy','removeLists','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./campaign.controller','isAuthenticated','index','get','/:id','show','/:id/hoppers','getHoppers'];(function(_0x4aee99,_0x4edf86){var _0x259039=function(_0xfee06b){while(--_0xfee06b){_0x4aee99['push'](_0x4aee99['shift']());}};_0x259039(++_0x4edf86);}(_0x986b,0xd0));var _0xb986=function(_0x59a8fc,_0x237b8c){_0x59a8fc=_0x59a8fc-0x0;var _0x3319c0=_0x986b[_0x59a8fc];return _0x3319c0;};'use strict';var multer=require(_0xb986('0x0'));var util=require(_0xb986('0x1'));var path=require(_0xb986('0x2'));var timeout=require(_0xb986('0x3'));var express=require(_0xb986('0x4'));var router=express[_0xb986('0x5')]();var auth=require(_0xb986('0x6'));var interaction=require(_0xb986('0x7'));var config=require('../../config/environment');var controller=require(_0xb986('0x8'));router['get']('/',auth[_0xb986('0x9')](),controller[_0xb986('0xa')]);router[_0xb986('0xb')](_0xb986('0xc'),auth[_0xb986('0x9')](),controller[_0xb986('0xd')]);router[_0xb986('0xb')](_0xb986('0xe'),auth[_0xb986('0x9')](),controller[_0xb986('0xf')]);router['get'](_0xb986('0x10'),auth[_0xb986('0x9')](),controller[_0xb986('0x11')]);router[_0xb986('0xb')](_0xb986('0x12'),auth[_0xb986('0x9')](),controller['getHopperFinals']);router[_0xb986('0xb')](_0xb986('0x13'),auth[_0xb986('0x9')](),controller['getHopperBlacks']);router[_0xb986('0xb')](_0xb986('0x14'),auth[_0xb986('0x9')](),controller[_0xb986('0x15')]);router[_0xb986('0xb')]('/:id/blacklists',auth['isAuthenticated'](),controller[_0xb986('0x16')]);router['post']('/',auth[_0xb986('0x9')](),controller['create']);router[_0xb986('0x17')](_0xb986('0x18'),auth[_0xb986('0x9')](),controller['clone']);router[_0xb986('0x17')](_0xb986('0x14'),auth[_0xb986('0x9')](),controller['addLists']);router[_0xb986('0x17')](_0xb986('0x19'),auth['isAuthenticated'](),controller[_0xb986('0x1a')]);router[_0xb986('0x1b')](_0xb986('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xb986('0x1c')](_0xb986('0xc'),auth[_0xb986('0x9')](),controller[_0xb986('0x1d')]);router[_0xb986('0x1c')](_0xb986('0x14'),auth['isAuthenticated'](),controller[_0xb986('0x1e')]);router['delete']('/:id/blacklists',auth[_0xb986('0x9')](),controller['removeBlackLists']);module[_0xb986('0x1f')]=router; \ No newline at end of file +var _0x6c57=['connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./campaign.controller','isAuthenticated','/:id','show','get','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','getLists','getBlackLists','post','create','/:id/lists','addLists','/:id/blacklists','addBlackLists','put','update','delete','destroy','removeLists','removeBlackLists','exports','multer','util','path'];(function(_0x1d6faf,_0x25e7e6){var _0x5efa5b=function(_0x423da2){while(--_0x423da2){_0x1d6faf['push'](_0x1d6faf['shift']());}};_0x5efa5b(++_0x25e7e6);}(_0x6c57,0xc9));var _0x76c5=function(_0x2f2360,_0x151089){_0x2f2360=_0x2f2360-0x0;var _0x1cc8d3=_0x6c57[_0x2f2360];return _0x1cc8d3;};'use strict';var multer=require(_0x76c5('0x0'));var util=require(_0x76c5('0x1'));var path=require(_0x76c5('0x2'));var timeout=require(_0x76c5('0x3'));var express=require('express');var router=express[_0x76c5('0x4')]();var auth=require(_0x76c5('0x5'));var interaction=require(_0x76c5('0x6'));var config=require(_0x76c5('0x7'));var controller=require(_0x76c5('0x8'));router['get']('/',auth[_0x76c5('0x9')](),controller['index']);router['get'](_0x76c5('0xa'),auth[_0x76c5('0x9')](),controller[_0x76c5('0xb')]);router[_0x76c5('0xc')]('/:id/hoppers',auth['isAuthenticated'](),controller['getHoppers']);router[_0x76c5('0xc')](_0x76c5('0xd'),auth['isAuthenticated'](),controller[_0x76c5('0xe')]);router[_0x76c5('0xc')](_0x76c5('0xf'),auth[_0x76c5('0x9')](),controller[_0x76c5('0x10')]);router[_0x76c5('0xc')](_0x76c5('0x11'),auth['isAuthenticated'](),controller[_0x76c5('0x12')]);router['get']('/:id/lists',auth['isAuthenticated'](),controller[_0x76c5('0x13')]);router[_0x76c5('0xc')]('/:id/blacklists',auth[_0x76c5('0x9')](),controller[_0x76c5('0x14')]);router[_0x76c5('0x15')]('/',auth[_0x76c5('0x9')](),controller[_0x76c5('0x16')]);router[_0x76c5('0x15')]('/:id/clone',auth['isAuthenticated'](),controller['clone']);router[_0x76c5('0x15')](_0x76c5('0x17'),auth['isAuthenticated'](),controller[_0x76c5('0x18')]);router[_0x76c5('0x15')](_0x76c5('0x19'),auth['isAuthenticated'](),controller[_0x76c5('0x1a')]);router[_0x76c5('0x1b')](_0x76c5('0xa'),auth[_0x76c5('0x9')](),controller[_0x76c5('0x1c')]);router[_0x76c5('0x1d')]('/:id',auth[_0x76c5('0x9')](),controller[_0x76c5('0x1e')]);router[_0x76c5('0x1d')](_0x76c5('0x17'),auth[_0x76c5('0x9')](),controller[_0x76c5('0x1f')]);router[_0x76c5('0x1d')](_0x76c5('0x19'),auth[_0x76c5('0x9')](),controller[_0x76c5('0x20')]);module[_0x76c5('0x21')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index 7c575c7..3116fe4 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 _0x1d87=['TEXT','getDataValue','key','sequelize','exports','STRING'];(function(_0x46e077,_0x174e84){var _0x47a34f=function(_0x3085b0){while(--_0x3085b0){_0x46e077['push'](_0x46e077['shift']());}};_0x47a34f(++_0x174e84);}(_0x1d87,0x147));var _0x71d8=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0x1d87[_0x54d4fe];return _0x1ab5bb;};'use strict';var Sequelize=require(_0x71d8('0x0'));module[_0x71d8('0x1')]={'key':{'type':Sequelize[_0x71d8('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0x71d8('0x3')],'allowNull':![]},'description':{'type':Sequelize[_0x71d8('0x2')]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x71d8('0x4')](_0x71d8('0x5'));}}}; \ No newline at end of file +var _0x2ab0=['TEXT','getDataValue','key','sequelize','STRING'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x2ab0,0x14d));var _0x02ab=function(_0x54d4a8,_0x585a59){_0x54d4a8=_0x54d4a8-0x0;var _0x3b321b=_0x2ab0[_0x54d4a8];return _0x3b321b;};'use strict';var Sequelize=require(_0x02ab('0x0'));module['exports']={'key':{'type':Sequelize[_0x02ab('0x1')],'allowNull':![]},'value':{'type':Sequelize[_0x02ab('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x02ab('0x1')]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x02ab('0x3')](_0x02ab('0x4'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 5743963..4d26414 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 _0x34e8=['filters','intersection','attributes','fields','length','order','sort','pick','filter','where','merge','options','include','findAll','catch','show','includeAll','find','body','params','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','The\x20inserted\x20key\x20already\x20exists.','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','then','CannedAnswers','destroy','sendStatus','error','stack','name','map','CannedAnswer','rawAttributes','fieldName','type','key','model','keys','query'];(function(_0x3c4d94,_0x15153a){var _0x10e0c7=function(_0x10b8d3){while(--_0x10b8d3){_0x3c4d94['push'](_0x3c4d94['shift']());}};_0x10e0c7(++_0x15153a);}(_0x34e8,0x12c));var _0x834e=function(_0x131b28,_0x1df6db){_0x131b28=_0x131b28-0x0;var _0x318ac8=_0x34e8[_0x131b28];return _0x318ac8;};'use strict';var pdf=require(_0x834e('0x0'));var emlformat=require(_0x834e('0x1'));var rimraf=require(_0x834e('0x2'));var zipdir=require(_0x834e('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x834e('0x4'));var moment=require(_0x834e('0x5'));var BPromise=require(_0x834e('0x6'));var Mustache=require(_0x834e('0x7'));var util=require(_0x834e('0x8'));var path=require(_0x834e('0x9'));var sox=require(_0x834e('0xa'));var csv=require('to-csv');var ejs=require(_0x834e('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x834e('0xc'));var crypto=require(_0x834e('0xd'));var jsforce=require(_0x834e('0xe'));var deskjs=require(_0x834e('0xf'));var toCsv=require(_0x834e('0x10'));var querystring=require(_0x834e('0x11'));var Papa=require(_0x834e('0x12'));var Redis=require(_0x834e('0x13'));var authService=require(_0x834e('0x14'));var qs=require(_0x834e('0x15'));var as=require(_0x834e('0x16'));var hardwareService=require(_0x834e('0x17'));var logger=require(_0x834e('0x18'))(_0x834e('0x19'));var utils=require(_0x834e('0x1a'));var config=require(_0x834e('0x1b'));var db=require(_0x834e('0x1c'))['db'];function respondWithStatusCode(_0x538bb3,_0x5e5b6d){_0x5e5b6d=_0x5e5b6d||0xcc;return function(_0x6cd9b9){if(_0x6cd9b9){return _0x538bb3['sendStatus'](_0x5e5b6d);}return _0x538bb3[_0x834e('0x1d')](_0x5e5b6d)[_0x834e('0x1e')]();};}function respondWithResult(_0x28e659,_0x21cc0a){_0x21cc0a=_0x21cc0a||0xc8;return function(_0x50e860){if(_0x50e860){return _0x28e659[_0x834e('0x1d')](_0x21cc0a)[_0x834e('0x1f')](_0x50e860);}};}function respondWithFilteredResult(_0x57274a,_0x316205){return function(_0x4a9cdc){if(_0x4a9cdc){var _0x38a8cd=_0x4a9cdc[_0x834e('0x20')],_0x36d443=_0x316205[_0x834e('0x21')],_0x478afe=_0x316205['offset']+_0x316205[_0x834e('0x22')],_0x43ac41;if(_0x478afe>=_0x38a8cd){_0x478afe=_0x38a8cd;_0x43ac41=0xc8;}else{_0x43ac41=0xce;}_0x57274a[_0x834e('0x1d')](_0x43ac41);return _0x57274a[_0x834e('0x23')](_0x834e('0x24'),_0x36d443+'-'+_0x478afe+'/'+_0x38a8cd)[_0x834e('0x1f')](_0x4a9cdc);}return null;};}function patchUpdates(_0x254677){return function(_0x1dd214){try{jsonpatch['apply'](_0x1dd214,_0x254677,!![]);}catch(_0x2545b4){return BPromise[_0x834e('0x25')](_0x2545b4);}return _0x1dd214[_0x834e('0x26')]();};}function saveUpdates(_0x325a99,_0x4ab05d){return function(_0x45a630){if(_0x45a630){return _0x45a630[_0x834e('0x27')](_0x325a99)['then'](function(_0x1b4bdf){return _0x1b4bdf;});}return null;};}function removeEntity(_0x28d687,_0x8d406e){return function(_0x5c55ca){if(_0x5c55ca){return _0x5c55ca['destroy']()[_0x834e('0x28')](function(){var _0x34563b=_0x5c55ca['get']({'plain':!![]});var _0x25ee1d=_0x834e('0x29');return db['UserProfileResource'][_0x834e('0x2a')]({'where':{'type':_0x25ee1d,'resourceId':_0x34563b['id']}})[_0x834e('0x28')](function(){return _0x5c55ca;});})[_0x834e('0x28')](function(){_0x28d687['status'](0xcc)[_0x834e('0x1e')]();});}};}function handleEntityNotFound(_0x3e310f,_0x5e1cc5){return function(_0x5bef62){if(!_0x5bef62){_0x3e310f[_0x834e('0x2b')](0x194);}return _0x5bef62;};}function handleError(_0x508a1d,_0x2826ec){_0x2826ec=_0x2826ec||0x1f4;return function(_0x3f1b0b){logger[_0x834e('0x2c')](_0x3f1b0b[_0x834e('0x2d')]);if(_0x3f1b0b[_0x834e('0x2e')]){delete _0x3f1b0b[_0x834e('0x2e')];}_0x508a1d['status'](_0x2826ec)['send'](_0x3f1b0b);};}exports['index']=function(_0x58c1d7,_0x2c7a8d){var _0x567cea={},_0x106d6a={},_0x5dacc1={'count':0x0,'rows':[]};var _0xb5bc06=_[_0x834e('0x2f')](db[_0x834e('0x30')][_0x834e('0x31')],function(_0x4551f5){return{'name':_0x4551f5[_0x834e('0x32')],'type':_0x4551f5[_0x834e('0x33')][_0x834e('0x34')]};});_0x106d6a[_0x834e('0x35')]=_['map'](_0xb5bc06,_0x834e('0x2e'));_0x106d6a['query']=_[_0x834e('0x36')](_0x58c1d7[_0x834e('0x37')]);_0x106d6a[_0x834e('0x38')]=_[_0x834e('0x39')](_0x106d6a[_0x834e('0x35')],_0x106d6a[_0x834e('0x37')]);_0x567cea[_0x834e('0x3a')]=_[_0x834e('0x39')](_0x106d6a[_0x834e('0x35')],qs[_0x834e('0x3b')](_0x58c1d7['query'][_0x834e('0x3b')]));_0x567cea[_0x834e('0x3a')]=_0x567cea[_0x834e('0x3a')][_0x834e('0x3c')]?_0x567cea['attributes']:_0x106d6a[_0x834e('0x35')];if(!_0x58c1d7[_0x834e('0x37')]['hasOwnProperty']('nolimit')){_0x567cea['limit']=qs[_0x834e('0x22')](_0x58c1d7[_0x834e('0x37')][_0x834e('0x22')]);_0x567cea[_0x834e('0x21')]=qs[_0x834e('0x21')](_0x58c1d7[_0x834e('0x37')]['offset']);}_0x567cea[_0x834e('0x3d')]=qs['sort'](_0x58c1d7[_0x834e('0x37')][_0x834e('0x3e')]);_0x567cea['where']=qs[_0x834e('0x38')](_[_0x834e('0x3f')](_0x58c1d7['query'],_0x106d6a['filters']));if(_0x58c1d7[_0x834e('0x37')][_0x834e('0x40')]){_0x567cea[_0x834e('0x41')]=_[_0x834e('0x42')](_0x567cea[_0x834e('0x41')],{'$or':_['map'](_0xb5bc06,function(_0x1c5ed6){if(_0x1c5ed6['type']!=='VIRTUAL'){var _0x1b2edf={};_0x1b2edf[_0x1c5ed6['name']]={'$like':'%'+_0x58c1d7[_0x834e('0x37')][_0x834e('0x40')]+'%'};return _0x1b2edf;}})});}_0x567cea=_[_0x834e('0x42')]({},_0x567cea,_0x58c1d7[_0x834e('0x43')]);var _0x2b7933={'where':_0x567cea['where']};return db[_0x834e('0x30')][_0x834e('0x20')](_0x2b7933)[_0x834e('0x28')](function(_0x58c5fb){_0x5dacc1[_0x834e('0x20')]=_0x58c5fb;if(_0x58c1d7[_0x834e('0x37')]['includeAll']){_0x567cea[_0x834e('0x44')]=[{'all':!![]}];}return db['CannedAnswer'][_0x834e('0x45')](_0x567cea);})[_0x834e('0x28')](function(_0x4a18bb){_0x5dacc1['rows']=_0x4a18bb;return _0x5dacc1;})[_0x834e('0x28')](respondWithFilteredResult(_0x2c7a8d,_0x567cea))[_0x834e('0x46')](handleError(_0x2c7a8d,null));};exports[_0x834e('0x47')]=function(_0xbc1571,_0x8ad264){var _0x23feea={'raw':!![],'where':{'id':_0xbc1571['params']['id']}},_0x195204={};_0x195204[_0x834e('0x35')]=_['keys'](db[_0x834e('0x30')]['rawAttributes']);_0x195204[_0x834e('0x37')]=_['keys'](_0xbc1571[_0x834e('0x37')]);_0x195204[_0x834e('0x38')]=_['intersection'](_0x195204[_0x834e('0x35')],_0x195204[_0x834e('0x37')]);_0x23feea[_0x834e('0x3a')]=_[_0x834e('0x39')](_0x195204[_0x834e('0x35')],qs[_0x834e('0x3b')](_0xbc1571[_0x834e('0x37')][_0x834e('0x3b')]));_0x23feea[_0x834e('0x3a')]=_0x23feea[_0x834e('0x3a')]['length']?_0x23feea[_0x834e('0x3a')]:_0x195204[_0x834e('0x35')];if(_0xbc1571['query'][_0x834e('0x48')]){_0x23feea[_0x834e('0x44')]=[{'all':!![]}];}_0x23feea=_[_0x834e('0x42')]({},_0x23feea,_0xbc1571[_0x834e('0x43')]);return db[_0x834e('0x30')][_0x834e('0x49')](_0x23feea)['then'](handleEntityNotFound(_0x8ad264,null))['then'](respondWithResult(_0x8ad264,null))[_0x834e('0x46')](handleError(_0x8ad264,null));};exports[_0x834e('0x27')]=function(_0x30568e,_0x40ff5a){if(_0x30568e[_0x834e('0x4a')]['id']){delete _0x30568e[_0x834e('0x4a')]['id'];}return db[_0x834e('0x30')][_0x834e('0x49')]({'where':{'id':_0x30568e[_0x834e('0x4b')]['id']}})[_0x834e('0x28')](handleEntityNotFound(_0x40ff5a,null))[_0x834e('0x28')](saveUpdates(_0x30568e[_0x834e('0x4a')],null))[_0x834e('0x28')](respondWithResult(_0x40ff5a,null))[_0x834e('0x46')](handleError(_0x40ff5a,null));};exports[_0x834e('0x2a')]=function(_0x1a3855,_0x3df078){return db[_0x834e('0x30')][_0x834e('0x49')]({'where':{'id':_0x1a3855[_0x834e('0x4b')]['id']}})['then'](handleEntityNotFound(_0x3df078,null))[_0x834e('0x28')](removeEntity(_0x3df078,null))[_0x834e('0x46')](handleError(_0x3df078,null));};exports['create']=function(_0x3c00a3,_0x3b0988){var _0x55d491={'key':_0x3c00a3[_0x834e('0x4a')][_0x834e('0x34')]};if(_0x3c00a3[_0x834e('0x4a')][_0x834e('0x4c')]){_0x55d491[_0x834e('0x4c')]=_0x3c00a3[_0x834e('0x4a')][_0x834e('0x4c')];}else if(_0x3c00a3['body'][_0x834e('0x4d')]){_0x55d491[_0x834e('0x4d')]=_0x3c00a3[_0x834e('0x4a')][_0x834e('0x4d')];}else if(_0x3c00a3[_0x834e('0x4a')][_0x834e('0x4e')]){_0x55d491[_0x834e('0x4e')]=_0x3c00a3[_0x834e('0x4a')]['OpenchannelAccountId'];}else if(_0x3c00a3[_0x834e('0x4a')]['ChatWebsiteId']){_0x55d491[_0x834e('0x4f')]=_0x3c00a3['body'][_0x834e('0x4f')];}return db['CannedAnswer']['find']({'where':_0x55d491})[_0x834e('0x28')](function(_0x3e1bee){if(_0x3e1bee){throw new db['Sequelize']['ValidationError'](_0x834e('0x50'));}return db[_0x834e('0x30')][_0x834e('0x51')](_0x3c00a3[_0x834e('0x4a')]);})[_0x834e('0x28')](function(_0x315858){var _0x3d3f2b=_0x3c00a3[_0x834e('0x52')]['get']({'plain':!![]});if(!_0x3d3f2b)throw new Error(_0x834e('0x53'));if(_0x3d3f2b[_0x834e('0x54')]==='user'){var _0x281342=_0x315858['get']({'plain':!![]});return db[_0x834e('0x55')][_0x834e('0x49')]({'where':{'name':'CannedAnswers','userProfileId':_0x3d3f2b[_0x834e('0x56')]},'raw':!![]})[_0x834e('0x28')](function(_0x2de29a){if(_0x2de29a&&_0x2de29a[_0x834e('0x57')]===0x0){return db['UserProfileResource'][_0x834e('0x51')]({'name':_0x281342[_0x834e('0x2e')],'resourceId':_0x281342['id'],'type':_0x2de29a[_0x834e('0x2e')],'sectionId':_0x2de29a['id']},{})['then'](function(){return _0x315858;});}else{return _0x315858;}})[_0x834e('0x46')](function(_0x1fcae9){logger[_0x834e('0x2c')](_0x834e('0x58'),_0x1fcae9);throw _0x1fcae9;});}return _0x315858;})[_0x834e('0x28')](respondWithResult(_0x3b0988,0xc9))[_0x834e('0x46')](handleError(_0x3b0988,null));}; \ No newline at end of file +var _0x34e8=['filters','intersection','attributes','fields','length','order','sort','pick','filter','where','merge','options','include','findAll','catch','show','includeAll','find','body','params','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','The\x20inserted\x20key\x20already\x20exists.','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','then','CannedAnswers','destroy','sendStatus','error','stack','name','map','CannedAnswer','rawAttributes','fieldName','type','key','model','keys','query'];(function(_0x2015f5,_0x480a79){var _0x285b59=function(_0x1a0df6){while(--_0x1a0df6){_0x2015f5['push'](_0x2015f5['shift']());}};_0x285b59(++_0x480a79);}(_0x34e8,0x12c));var _0x834e=function(_0x2ed54f,_0x463da9){_0x2ed54f=_0x2ed54f-0x0;var _0x37ab08=_0x34e8[_0x2ed54f];return _0x37ab08;};'use strict';var pdf=require(_0x834e('0x0'));var emlformat=require(_0x834e('0x1'));var rimraf=require(_0x834e('0x2'));var zipdir=require(_0x834e('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x834e('0x4'));var moment=require(_0x834e('0x5'));var BPromise=require(_0x834e('0x6'));var Mustache=require(_0x834e('0x7'));var util=require(_0x834e('0x8'));var path=require(_0x834e('0x9'));var sox=require(_0x834e('0xa'));var csv=require('to-csv');var ejs=require(_0x834e('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x834e('0xc'));var crypto=require(_0x834e('0xd'));var jsforce=require(_0x834e('0xe'));var deskjs=require(_0x834e('0xf'));var toCsv=require(_0x834e('0x10'));var querystring=require(_0x834e('0x11'));var Papa=require(_0x834e('0x12'));var Redis=require(_0x834e('0x13'));var authService=require(_0x834e('0x14'));var qs=require(_0x834e('0x15'));var as=require(_0x834e('0x16'));var hardwareService=require(_0x834e('0x17'));var logger=require(_0x834e('0x18'))(_0x834e('0x19'));var utils=require(_0x834e('0x1a'));var config=require(_0x834e('0x1b'));var db=require(_0x834e('0x1c'))['db'];function respondWithStatusCode(_0x538bb3,_0x5e5b6d){_0x5e5b6d=_0x5e5b6d||0xcc;return function(_0x6cd9b9){if(_0x6cd9b9){return _0x538bb3['sendStatus'](_0x5e5b6d);}return _0x538bb3[_0x834e('0x1d')](_0x5e5b6d)[_0x834e('0x1e')]();};}function respondWithResult(_0x28e659,_0x21cc0a){_0x21cc0a=_0x21cc0a||0xc8;return function(_0x50e860){if(_0x50e860){return _0x28e659[_0x834e('0x1d')](_0x21cc0a)[_0x834e('0x1f')](_0x50e860);}};}function respondWithFilteredResult(_0x57274a,_0x316205){return function(_0x4a9cdc){if(_0x4a9cdc){var _0x38a8cd=_0x4a9cdc[_0x834e('0x20')],_0x36d443=_0x316205[_0x834e('0x21')],_0x478afe=_0x316205['offset']+_0x316205[_0x834e('0x22')],_0x43ac41;if(_0x478afe>=_0x38a8cd){_0x478afe=_0x38a8cd;_0x43ac41=0xc8;}else{_0x43ac41=0xce;}_0x57274a[_0x834e('0x1d')](_0x43ac41);return _0x57274a[_0x834e('0x23')](_0x834e('0x24'),_0x36d443+'-'+_0x478afe+'/'+_0x38a8cd)[_0x834e('0x1f')](_0x4a9cdc);}return null;};}function patchUpdates(_0x254677){return function(_0x1dd214){try{jsonpatch['apply'](_0x1dd214,_0x254677,!![]);}catch(_0x2545b4){return BPromise[_0x834e('0x25')](_0x2545b4);}return _0x1dd214[_0x834e('0x26')]();};}function saveUpdates(_0x325a99,_0x4ab05d){return function(_0x45a630){if(_0x45a630){return _0x45a630[_0x834e('0x27')](_0x325a99)['then'](function(_0x1b4bdf){return _0x1b4bdf;});}return null;};}function removeEntity(_0x28d687,_0x8d406e){return function(_0x5c55ca){if(_0x5c55ca){return _0x5c55ca['destroy']()[_0x834e('0x28')](function(){var _0x34563b=_0x5c55ca['get']({'plain':!![]});var _0x25ee1d=_0x834e('0x29');return db['UserProfileResource'][_0x834e('0x2a')]({'where':{'type':_0x25ee1d,'resourceId':_0x34563b['id']}})[_0x834e('0x28')](function(){return _0x5c55ca;});})[_0x834e('0x28')](function(){_0x28d687['status'](0xcc)[_0x834e('0x1e')]();});}};}function handleEntityNotFound(_0x3e310f,_0x5e1cc5){return function(_0x5bef62){if(!_0x5bef62){_0x3e310f[_0x834e('0x2b')](0x194);}return _0x5bef62;};}function handleError(_0x508a1d,_0x2826ec){_0x2826ec=_0x2826ec||0x1f4;return function(_0x3f1b0b){logger[_0x834e('0x2c')](_0x3f1b0b[_0x834e('0x2d')]);if(_0x3f1b0b[_0x834e('0x2e')]){delete _0x3f1b0b[_0x834e('0x2e')];}_0x508a1d['status'](_0x2826ec)['send'](_0x3f1b0b);};}exports['index']=function(_0x58c1d7,_0x2c7a8d){var _0x567cea={},_0x106d6a={},_0x5dacc1={'count':0x0,'rows':[]};var _0xb5bc06=_[_0x834e('0x2f')](db[_0x834e('0x30')][_0x834e('0x31')],function(_0x4551f5){return{'name':_0x4551f5[_0x834e('0x32')],'type':_0x4551f5[_0x834e('0x33')][_0x834e('0x34')]};});_0x106d6a[_0x834e('0x35')]=_['map'](_0xb5bc06,_0x834e('0x2e'));_0x106d6a['query']=_[_0x834e('0x36')](_0x58c1d7[_0x834e('0x37')]);_0x106d6a[_0x834e('0x38')]=_[_0x834e('0x39')](_0x106d6a[_0x834e('0x35')],_0x106d6a[_0x834e('0x37')]);_0x567cea[_0x834e('0x3a')]=_[_0x834e('0x39')](_0x106d6a[_0x834e('0x35')],qs[_0x834e('0x3b')](_0x58c1d7['query'][_0x834e('0x3b')]));_0x567cea[_0x834e('0x3a')]=_0x567cea[_0x834e('0x3a')][_0x834e('0x3c')]?_0x567cea['attributes']:_0x106d6a[_0x834e('0x35')];if(!_0x58c1d7[_0x834e('0x37')]['hasOwnProperty']('nolimit')){_0x567cea['limit']=qs[_0x834e('0x22')](_0x58c1d7[_0x834e('0x37')][_0x834e('0x22')]);_0x567cea[_0x834e('0x21')]=qs[_0x834e('0x21')](_0x58c1d7[_0x834e('0x37')]['offset']);}_0x567cea[_0x834e('0x3d')]=qs['sort'](_0x58c1d7[_0x834e('0x37')][_0x834e('0x3e')]);_0x567cea['where']=qs[_0x834e('0x38')](_[_0x834e('0x3f')](_0x58c1d7['query'],_0x106d6a['filters']));if(_0x58c1d7[_0x834e('0x37')][_0x834e('0x40')]){_0x567cea[_0x834e('0x41')]=_[_0x834e('0x42')](_0x567cea[_0x834e('0x41')],{'$or':_['map'](_0xb5bc06,function(_0x1c5ed6){if(_0x1c5ed6['type']!=='VIRTUAL'){var _0x1b2edf={};_0x1b2edf[_0x1c5ed6['name']]={'$like':'%'+_0x58c1d7[_0x834e('0x37')][_0x834e('0x40')]+'%'};return _0x1b2edf;}})});}_0x567cea=_[_0x834e('0x42')]({},_0x567cea,_0x58c1d7[_0x834e('0x43')]);var _0x2b7933={'where':_0x567cea['where']};return db[_0x834e('0x30')][_0x834e('0x20')](_0x2b7933)[_0x834e('0x28')](function(_0x58c5fb){_0x5dacc1[_0x834e('0x20')]=_0x58c5fb;if(_0x58c1d7[_0x834e('0x37')]['includeAll']){_0x567cea[_0x834e('0x44')]=[{'all':!![]}];}return db['CannedAnswer'][_0x834e('0x45')](_0x567cea);})[_0x834e('0x28')](function(_0x4a18bb){_0x5dacc1['rows']=_0x4a18bb;return _0x5dacc1;})[_0x834e('0x28')](respondWithFilteredResult(_0x2c7a8d,_0x567cea))[_0x834e('0x46')](handleError(_0x2c7a8d,null));};exports[_0x834e('0x47')]=function(_0xbc1571,_0x8ad264){var _0x23feea={'raw':!![],'where':{'id':_0xbc1571['params']['id']}},_0x195204={};_0x195204[_0x834e('0x35')]=_['keys'](db[_0x834e('0x30')]['rawAttributes']);_0x195204[_0x834e('0x37')]=_['keys'](_0xbc1571[_0x834e('0x37')]);_0x195204[_0x834e('0x38')]=_['intersection'](_0x195204[_0x834e('0x35')],_0x195204[_0x834e('0x37')]);_0x23feea[_0x834e('0x3a')]=_[_0x834e('0x39')](_0x195204[_0x834e('0x35')],qs[_0x834e('0x3b')](_0xbc1571[_0x834e('0x37')][_0x834e('0x3b')]));_0x23feea[_0x834e('0x3a')]=_0x23feea[_0x834e('0x3a')]['length']?_0x23feea[_0x834e('0x3a')]:_0x195204[_0x834e('0x35')];if(_0xbc1571['query'][_0x834e('0x48')]){_0x23feea[_0x834e('0x44')]=[{'all':!![]}];}_0x23feea=_[_0x834e('0x42')]({},_0x23feea,_0xbc1571[_0x834e('0x43')]);return db[_0x834e('0x30')][_0x834e('0x49')](_0x23feea)['then'](handleEntityNotFound(_0x8ad264,null))['then'](respondWithResult(_0x8ad264,null))[_0x834e('0x46')](handleError(_0x8ad264,null));};exports[_0x834e('0x27')]=function(_0x30568e,_0x40ff5a){if(_0x30568e[_0x834e('0x4a')]['id']){delete _0x30568e[_0x834e('0x4a')]['id'];}return db[_0x834e('0x30')][_0x834e('0x49')]({'where':{'id':_0x30568e[_0x834e('0x4b')]['id']}})[_0x834e('0x28')](handleEntityNotFound(_0x40ff5a,null))[_0x834e('0x28')](saveUpdates(_0x30568e[_0x834e('0x4a')],null))[_0x834e('0x28')](respondWithResult(_0x40ff5a,null))[_0x834e('0x46')](handleError(_0x40ff5a,null));};exports[_0x834e('0x2a')]=function(_0x1a3855,_0x3df078){return db[_0x834e('0x30')][_0x834e('0x49')]({'where':{'id':_0x1a3855[_0x834e('0x4b')]['id']}})['then'](handleEntityNotFound(_0x3df078,null))[_0x834e('0x28')](removeEntity(_0x3df078,null))[_0x834e('0x46')](handleError(_0x3df078,null));};exports['create']=function(_0x3c00a3,_0x3b0988){var _0x55d491={'key':_0x3c00a3[_0x834e('0x4a')][_0x834e('0x34')]};if(_0x3c00a3[_0x834e('0x4a')][_0x834e('0x4c')]){_0x55d491[_0x834e('0x4c')]=_0x3c00a3[_0x834e('0x4a')][_0x834e('0x4c')];}else if(_0x3c00a3['body'][_0x834e('0x4d')]){_0x55d491[_0x834e('0x4d')]=_0x3c00a3[_0x834e('0x4a')][_0x834e('0x4d')];}else if(_0x3c00a3[_0x834e('0x4a')][_0x834e('0x4e')]){_0x55d491[_0x834e('0x4e')]=_0x3c00a3[_0x834e('0x4a')]['OpenchannelAccountId'];}else if(_0x3c00a3[_0x834e('0x4a')]['ChatWebsiteId']){_0x55d491[_0x834e('0x4f')]=_0x3c00a3['body'][_0x834e('0x4f')];}return db['CannedAnswer']['find']({'where':_0x55d491})[_0x834e('0x28')](function(_0x3e1bee){if(_0x3e1bee){throw new db['Sequelize']['ValidationError'](_0x834e('0x50'));}return db[_0x834e('0x30')][_0x834e('0x51')](_0x3c00a3[_0x834e('0x4a')]);})[_0x834e('0x28')](function(_0x315858){var _0x3d3f2b=_0x3c00a3[_0x834e('0x52')]['get']({'plain':!![]});if(!_0x3d3f2b)throw new Error(_0x834e('0x53'));if(_0x3d3f2b[_0x834e('0x54')]==='user'){var _0x281342=_0x315858['get']({'plain':!![]});return db[_0x834e('0x55')][_0x834e('0x49')]({'where':{'name':'CannedAnswers','userProfileId':_0x3d3f2b[_0x834e('0x56')]},'raw':!![]})[_0x834e('0x28')](function(_0x2de29a){if(_0x2de29a&&_0x2de29a[_0x834e('0x57')]===0x0){return db['UserProfileResource'][_0x834e('0x51')]({'name':_0x281342[_0x834e('0x2e')],'resourceId':_0x281342['id'],'type':_0x2de29a[_0x834e('0x2e')],'sectionId':_0x2de29a['id']},{})['then'](function(){return _0x315858;});}else{return _0x315858;}})[_0x834e('0x46')](function(_0x1fcae9){logger[_0x834e('0x2c')](_0x834e('0x58'),_0x1fcae9);throw _0x1fcae9;});}return _0x315858;})[_0x834e('0x28')](respondWithResult(_0x3b0988,0xc9))[_0x834e('0x46')](handleError(_0x3b0988,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index fba02b1..8557bb7 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 _0x8ce3=['lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cannedAnswer.attributes','CannedAnswer','tools_canned_answers','utf8mb4'];(function(_0x2af59c,_0x8ac7d8){var _0x2c9b17=function(_0x30b641){while(--_0x30b641){_0x2af59c['push'](_0x2af59c['shift']());}};_0x2c9b17(++_0x8ac7d8);}(_0x8ce3,0xc3));var _0x38ce=function(_0x108d63,_0x14491b){_0x108d63=_0x108d63-0x0;var _0x51d6df=_0x8ce3[_0x108d63];return _0x51d6df;};'use strict';var _=require(_0x38ce('0x0'));var util=require(_0x38ce('0x1'));var logger=require('../../config/logger')(_0x38ce('0x2'));var moment=require(_0x38ce('0x3'));var BPromise=require(_0x38ce('0x4'));var rp=require(_0x38ce('0x5'));var fs=require('fs');var path=require(_0x38ce('0x6'));var rimraf=require(_0x38ce('0x7'));var config=require(_0x38ce('0x8'));var attributes=require(_0x38ce('0x9'));module['exports']=function(_0x372f86,_0xb24f4c){return _0x372f86['define'](_0x38ce('0xa'),attributes,{'tableName':_0x38ce('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x38ce('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xb19d=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cannedAnswer.attributes','exports','CannedAnswer','tools_canned_answers','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x20278a,_0x1911c5){var _0x1a60df=function(_0x509be3){while(--_0x509be3){_0x20278a['push'](_0x20278a['shift']());}};_0x1a60df(++_0x1911c5);}(_0xb19d,0x8b));var _0xdb19=function(_0x4b2436,_0x452299){_0x4b2436=_0x4b2436-0x0;var _0x4f5ab2=_0xb19d[_0x4b2436];return _0x4f5ab2;};'use strict';var _=require(_0xdb19('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xdb19('0x1'));var moment=require(_0xdb19('0x2'));var BPromise=require(_0xdb19('0x3'));var rp=require(_0xdb19('0x4'));var fs=require('fs');var path=require(_0xdb19('0x5'));var rimraf=require(_0xdb19('0x6'));var config=require(_0xdb19('0x7'));var attributes=require(_0xdb19('0x8'));module[_0xdb19('0x9')]=function(_0x54124f,_0x3d32ce){return _0x54124f['define'](_0xdb19('0xa'),attributes,{'tableName':_0xdb19('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xdb19('0xc'),'collate':_0xdb19('0xd')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index f61a7ea..1a687a3 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 _0xdcc7=['jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','CannedAnswer,\x20%s,\x20%s','message','result','catch','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment'];(function(_0xef4ef0,_0x3c72f9){var _0x39b60b=function(_0x1d824c){while(--_0x1d824c){_0xef4ef0['push'](_0xef4ef0['shift']());}};_0x39b60b(++_0x3c72f9);}(_0xdcc7,0x1c7));var _0x7dcc=function(_0x40220a,_0x22feb1){_0x40220a=_0x40220a-0x0;var _0x3903cc=_0xdcc7[_0x40220a];return _0x3903cc;};'use strict';var _=require('lodash');var util=require(_0x7dcc('0x0'));var moment=require(_0x7dcc('0x1'));var BPromise=require('bluebird');var rs=require(_0x7dcc('0x2'));var fs=require('fs');var Redis=require(_0x7dcc('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x7dcc('0x4'));var logger=require(_0x7dcc('0x5'))('rpc');var config=require(_0x7dcc('0x6'));var jayson=require(_0x7dcc('0x7'));var client=jayson[_0x7dcc('0x8')][_0x7dcc('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2dd162,_0x9311f7,_0xf50f44){return new BPromise(function(_0x39b76d,_0x152df7){return client[_0x7dcc('0xa')](_0x2dd162,_0xf50f44)[_0x7dcc('0xb')](function(_0x2f35da){logger[_0x7dcc('0xc')]('CannedAnswer,\x20%s,\x20%s',_0x9311f7,_0x7dcc('0xd'));logger[_0x7dcc('0xe')]('CannedAnswer,\x20%s,\x20%s,\x20%s',_0x9311f7,_0x7dcc('0xd'),JSON[_0x7dcc('0xf')](_0x2f35da));if(_0x2f35da[_0x7dcc('0x10')]){if(_0x2f35da['error'][_0x7dcc('0x11')]===0x1f4){logger[_0x7dcc('0x10')](_0x7dcc('0x12'),_0x9311f7,_0x2f35da['error'][_0x7dcc('0x13')]);return _0x152df7(_0x2f35da[_0x7dcc('0x10')]['message']);}logger[_0x7dcc('0x10')](_0x7dcc('0x12'),_0x9311f7,_0x2f35da[_0x7dcc('0x10')][_0x7dcc('0x13')]);return _0x39b76d(_0x2f35da[_0x7dcc('0x10')][_0x7dcc('0x13')]);}else{logger[_0x7dcc('0xc')](_0x7dcc('0x12'),_0x9311f7,_0x7dcc('0xd'));_0x39b76d(_0x2f35da[_0x7dcc('0x14')]['message']);}})[_0x7dcc('0x15')](function(_0x300f54){logger['error']('CannedAnswer,\x20%s,\x20%s',_0x9311f7,_0x300f54);_0x152df7(_0x300f54);});});} \ No newline at end of file +var _0x3b9d=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','info','CannedAnswer,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','moment'];(function(_0x15d18f,_0x126b0e){var _0xd12bf7=function(_0x19e661){while(--_0x19e661){_0x15d18f['push'](_0x15d18f['shift']());}};_0xd12bf7(++_0x126b0e);}(_0x3b9d,0x1e1));var _0xd3b9=function(_0xe38486,_0x32c37b){_0xe38486=_0xe38486-0x0;var _0x1a4621=_0x3b9d[_0xe38486];return _0x1a4621;};'use strict';var _=require(_0xd3b9('0x0'));var util=require('util');var moment=require(_0xd3b9('0x1'));var BPromise=require(_0xd3b9('0x2'));var rs=require(_0xd3b9('0x3'));var fs=require('fs');var Redis=require(_0xd3b9('0x4'));var db=require(_0xd3b9('0x5'))['db'];var utils=require(_0xd3b9('0x6'));var logger=require(_0xd3b9('0x7'))('rpc');var config=require(_0xd3b9('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd3b9('0x9')][_0xd3b9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4ca058,_0x4cc780,_0x15f421){return new BPromise(function(_0x3bd90e,_0x17273e){return client[_0xd3b9('0xb')](_0x4ca058,_0x15f421)['then'](function(_0x59461e){logger[_0xd3b9('0xc')](_0xd3b9('0xd'),_0x4cc780,_0xd3b9('0xe'));logger[_0xd3b9('0xf')]('CannedAnswer,\x20%s,\x20%s,\x20%s',_0x4cc780,_0xd3b9('0xe'),JSON['stringify'](_0x59461e));if(_0x59461e[_0xd3b9('0x10')]){if(_0x59461e[_0xd3b9('0x10')][_0xd3b9('0x11')]===0x1f4){logger[_0xd3b9('0x10')](_0xd3b9('0xd'),_0x4cc780,_0x59461e[_0xd3b9('0x10')][_0xd3b9('0x12')]);return _0x17273e(_0x59461e[_0xd3b9('0x10')][_0xd3b9('0x12')]);}logger[_0xd3b9('0x10')](_0xd3b9('0xd'),_0x4cc780,_0x59461e[_0xd3b9('0x10')][_0xd3b9('0x12')]);return _0x3bd90e(_0x59461e[_0xd3b9('0x10')][_0xd3b9('0x12')]);}else{logger[_0xd3b9('0xc')](_0xd3b9('0xd'),_0x4cc780,_0xd3b9('0xe'));_0x3bd90e(_0x59461e[_0xd3b9('0x13')][_0xd3b9('0x12')]);}})[_0xd3b9('0x14')](function(_0x4818a9){logger['error']('CannedAnswer,\x20%s,\x20%s',_0x4cc780,_0x4818a9);_0x17273e(_0x4818a9);});});} \ No newline at end of file diff --git a/server/api/cannedAnswer/index.js b/server/api/cannedAnswer/index.js index 308e451..ce75dfb 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 _0xb1ed=['create','put','delete','destroy','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cannedAnswer.controller','get','isAuthenticated','/:id','show','post'];(function(_0x458709,_0x1981ea){var _0x48cbd7=function(_0x358194){while(--_0x358194){_0x458709['push'](_0x458709['shift']());}};_0x48cbd7(++_0x1981ea);}(_0xb1ed,0x8b));var _0xdb1e=function(_0x38b2d9,_0x19fd42){_0x38b2d9=_0x38b2d9-0x0;var _0x23a3e1=_0xb1ed[_0x38b2d9];return _0x23a3e1;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xdb1e('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xdb1e('0x1')]();var auth=require(_0xdb1e('0x2'));var interaction=require(_0xdb1e('0x3'));var config=require(_0xdb1e('0x4'));var controller=require(_0xdb1e('0x5'));router[_0xdb1e('0x6')]('/',auth[_0xdb1e('0x7')](),controller['index']);router[_0xdb1e('0x6')](_0xdb1e('0x8'),auth['isAuthenticated'](),controller[_0xdb1e('0x9')]);router[_0xdb1e('0xa')]('/',auth['isAuthenticated'](),controller[_0xdb1e('0xb')]);router[_0xdb1e('0xc')](_0xdb1e('0x8'),auth[_0xdb1e('0x7')](),controller['update']);router[_0xdb1e('0xd')](_0xdb1e('0x8'),auth[_0xdb1e('0x7')](),controller[_0xdb1e('0xe')]);module['exports']=router; \ No newline at end of file +var _0x059d=['create','put','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./cannedAnswer.controller','get','index','/:id','show','post','isAuthenticated'];(function(_0x2dab56,_0x1e6b8f){var _0x2df5c9=function(_0x103e24){while(--_0x103e24){_0x2dab56['push'](_0x2dab56['shift']());}};_0x2df5c9(++_0x1e6b8f);}(_0x059d,0x1b9));var _0xd059=function(_0x4be4e1,_0x5619bf){_0x4be4e1=_0x4be4e1-0x0;var _0x319455=_0x059d[_0x4be4e1];return _0x319455;};'use strict';var multer=require(_0xd059('0x0'));var util=require(_0xd059('0x1'));var path=require(_0xd059('0x2'));var timeout=require(_0xd059('0x3'));var express=require(_0xd059('0x4'));var router=express[_0xd059('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xd059('0x6'));var config=require(_0xd059('0x7'));var controller=require(_0xd059('0x8'));router[_0xd059('0x9')]('/',auth['isAuthenticated'](),controller[_0xd059('0xa')]);router[_0xd059('0x9')](_0xd059('0xb'),auth['isAuthenticated'](),controller[_0xd059('0xc')]);router[_0xd059('0xd')]('/',auth[_0xd059('0xe')](),controller[_0xd059('0xf')]);router[_0xd059('0x10')](_0xd059('0xb'),auth['isAuthenticated'](),controller['update']);router[_0xd059('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xd059('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index e8aeac2..41672cf 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 _0x85ae=['1970-01-01\x2000:00:01','STRING','INTEGER','sequelize'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0x85ae,0x1ab));var _0xe85a=function(_0x4d8b36,_0x247487){_0x4d8b36=_0x4d8b36-0x0;var _0x16b9d0=_0x85ae[_0x4d8b36];return _0x16b9d0;};'use strict';var Sequelize=require(_0xe85a('0x0'));module['exports']={'calldate':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':_0xe85a('0x1')},'clid':{'type':Sequelize[_0xe85a('0x2')]},'src':{'type':Sequelize[_0xe85a('0x2')]},'dst':{'type':Sequelize[_0xe85a('0x2')]},'dcontext':{'type':Sequelize[_0xe85a('0x2')]},'channel':{'type':Sequelize[_0xe85a('0x2')]},'dstchannel':{'type':Sequelize[_0xe85a('0x2')]},'lastapp':{'type':Sequelize[_0xe85a('0x2')]},'lastdata':{'type':Sequelize[_0xe85a('0x2')]},'duration':{'type':Sequelize[_0xe85a('0x3')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0xe85a('0x3')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xe85a('0x2')]},'amaflags':{'type':Sequelize[_0xe85a('0x3')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0xe85a('0x2')]},'uniqueid':{'type':Sequelize[_0xe85a('0x2')]},'linkedid':{'type':Sequelize['STRING']},'sequence':{'type':Sequelize[_0xe85a('0x2')]},'peeraccount':{'type':Sequelize[_0xe85a('0x2')]},'type':{'type':Sequelize['STRING']},'tag':{'type':Sequelize[_0xe85a('0x2')]}}; \ No newline at end of file +var _0xad16=['1970-01-01\x2000:00:01','STRING','INTEGER','sequelize','exports','DATE'];(function(_0x1676c0,_0x4507a0){var _0x54e283=function(_0x295190){while(--_0x295190){_0x1676c0['push'](_0x1676c0['shift']());}};_0x54e283(++_0x4507a0);}(_0xad16,0xe1));var _0x6ad1=function(_0x2019b2,_0x3bfe5b){_0x2019b2=_0x2019b2-0x0;var _0x5e5e4c=_0xad16[_0x2019b2];return _0x5e5e4c;};'use strict';var Sequelize=require(_0x6ad1('0x0'));module[_0x6ad1('0x1')]={'calldate':{'type':Sequelize[_0x6ad1('0x2')],'allowNull':![],'defaultValue':_0x6ad1('0x3')},'clid':{'type':Sequelize[_0x6ad1('0x4')]},'src':{'type':Sequelize[_0x6ad1('0x4')]},'dst':{'type':Sequelize['STRING']},'dcontext':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x6ad1('0x4')]},'dstchannel':{'type':Sequelize[_0x6ad1('0x4')]},'lastapp':{'type':Sequelize[_0x6ad1('0x4')]},'lastdata':{'type':Sequelize[_0x6ad1('0x4')]},'duration':{'type':Sequelize[_0x6ad1('0x5')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x6ad1('0x5')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x6ad1('0x4')]},'amaflags':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x6ad1('0x4')]},'userfield':{'type':Sequelize[_0x6ad1('0x4')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0x6ad1('0x4')]},'sequence':{'type':Sequelize[_0x6ad1('0x4')]},'peeraccount':{'type':Sequelize[_0x6ad1('0x4')]},'type':{'type':Sequelize[_0x6ad1('0x4')]},'tag':{'type':Sequelize[_0x6ad1('0x4')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index 556ab55..479c5f4 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 _0x3e9e=['describe','html-pdf','rimraf','bluebird','mustache','util','path','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','Cdr','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','findAll','rows','catch','show','includeAll','include','find','create','body','params'];(function(_0x165a7a,_0x4e11f1){var _0x3d17c2=function(_0x1ea275){while(--_0x1ea275){_0x165a7a['push'](_0x165a7a['shift']());}};_0x3d17c2(++_0x4e11f1);}(_0x3e9e,0x91));var _0xe3e9=function(_0x163168,_0xce23a2){_0x163168=_0x163168-0x0;var _0xa26b25=_0x3e9e[_0x163168];return _0xa26b25;};'use strict';var pdf=require(_0xe3e9('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xe3e9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xe3e9('0x2'));var Mustache=require(_0xe3e9('0x3'));var util=require(_0xe3e9('0x4'));var path=require(_0xe3e9('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xe3e9('0x6'));var fs=require('fs');var _=require(_0xe3e9('0x7'));var squel=require(_0xe3e9('0x8'));var crypto=require(_0xe3e9('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xe3e9('0xa'));var toCsv=require('to-csv');var querystring=require(_0xe3e9('0xb'));var Papa=require(_0xe3e9('0xc'));var Redis=require('ioredis');var authService=require(_0xe3e9('0xd'));var qs=require(_0xe3e9('0xe'));var as=require(_0xe3e9('0xf'));var hardwareService=require(_0xe3e9('0x10'));var logger=require(_0xe3e9('0x11'))(_0xe3e9('0x12'));var utils=require(_0xe3e9('0x13'));var config=require('../../config/environment');var db=require(_0xe3e9('0x14'))['db'];function respondWithStatusCode(_0x3ecf5d,_0x2c13b1){_0x2c13b1=_0x2c13b1||0xcc;return function(_0x25d278){if(_0x25d278){return _0x3ecf5d[_0xe3e9('0x15')](_0x2c13b1);}return _0x3ecf5d[_0xe3e9('0x16')](_0x2c13b1)[_0xe3e9('0x17')]();};}function respondWithResult(_0xc5777a,_0x1a6434){_0x1a6434=_0x1a6434||0xc8;return function(_0x118b26){if(_0x118b26){return _0xc5777a[_0xe3e9('0x16')](_0x1a6434)[_0xe3e9('0x18')](_0x118b26);}};}function respondWithFilteredResult(_0x3e0cb6,_0xb4dda){return function(_0x5cc81d){if(_0x5cc81d){var _0x580cf2=_0x5cc81d[_0xe3e9('0x19')],_0x55ebec=_0xb4dda[_0xe3e9('0x1a')],_0xe35294=_0xb4dda['offset']+_0xb4dda[_0xe3e9('0x1b')],_0x44ecb2;if(_0xe35294>=_0x580cf2){_0xe35294=_0x580cf2;_0x44ecb2=0xc8;}else{_0x44ecb2=0xce;}_0x3e0cb6[_0xe3e9('0x16')](_0x44ecb2);return _0x3e0cb6[_0xe3e9('0x1c')](_0xe3e9('0x1d'),_0x55ebec+'-'+_0xe35294+'/'+_0x580cf2)['json'](_0x5cc81d);}return null;};}function patchUpdates(_0x5cefcb){return function(_0x3207ab){try{jsonpatch[_0xe3e9('0x1e')](_0x3207ab,_0x5cefcb,!![]);}catch(_0x5f1caa){return BPromise[_0xe3e9('0x1f')](_0x5f1caa);}return _0x3207ab[_0xe3e9('0x20')]();};}function saveUpdates(_0x929f4d,_0x6e6fb1){return function(_0x5b1fa9){if(_0x5b1fa9){return _0x5b1fa9['update'](_0x929f4d)[_0xe3e9('0x21')](function(_0x572b3e){return _0x572b3e;});}return null;};}function removeEntity(_0x1211e3,_0x9baa24){return function(_0x2a7c0f){if(_0x2a7c0f){return _0x2a7c0f[_0xe3e9('0x22')]()[_0xe3e9('0x21')](function(){_0x1211e3['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5f321b,_0xaf7ee){return function(_0x436f30){if(!_0x436f30){_0x5f321b[_0xe3e9('0x15')](0x194);}return _0x436f30;};}function handleError(_0x3c8fc1,_0x4aa2f7){_0x4aa2f7=_0x4aa2f7||0x1f4;return function(_0x5305bc){logger[_0xe3e9('0x23')](_0x5305bc[_0xe3e9('0x24')]);if(_0x5305bc[_0xe3e9('0x25')]){delete _0x5305bc[_0xe3e9('0x25')];}_0x3c8fc1[_0xe3e9('0x16')](_0x4aa2f7)[_0xe3e9('0x26')](_0x5305bc);};}exports[_0xe3e9('0x27')]=function(_0x131667,_0x2febad){var _0xe12d68={},_0x6c3690={},_0x28a7ec={'count':0x0,'rows':[]};var _0x342bd5=_['map'](db[_0xe3e9('0x28')][_0xe3e9('0x29')],function(_0x327fee){return{'name':_0x327fee['fieldName'],'type':_0x327fee[_0xe3e9('0x2a')][_0xe3e9('0x2b')]};});_0x6c3690[_0xe3e9('0x2c')]=_['map'](_0x342bd5,_0xe3e9('0x25'));_0x6c3690[_0xe3e9('0x2d')]=_[_0xe3e9('0x2e')](_0x131667[_0xe3e9('0x2d')]);_0x6c3690[_0xe3e9('0x2f')]=_[_0xe3e9('0x30')](_0x6c3690['model'],_0x6c3690['query']);_0xe12d68[_0xe3e9('0x31')]=_['intersection'](_0x6c3690[_0xe3e9('0x2c')],qs[_0xe3e9('0x32')](_0x131667[_0xe3e9('0x2d')]['fields']));_0xe12d68[_0xe3e9('0x31')]=_0xe12d68[_0xe3e9('0x31')][_0xe3e9('0x33')]?_0xe12d68[_0xe3e9('0x31')]:_0x6c3690[_0xe3e9('0x2c')];if(!_0x131667['query'][_0xe3e9('0x34')](_0xe3e9('0x35'))){_0xe12d68[_0xe3e9('0x1b')]=qs[_0xe3e9('0x1b')](_0x131667['query'][_0xe3e9('0x1b')]);_0xe12d68[_0xe3e9('0x1a')]=qs['offset'](_0x131667['query'][_0xe3e9('0x1a')]);}_0xe12d68['order']=qs[_0xe3e9('0x36')](_0x131667[_0xe3e9('0x2d')][_0xe3e9('0x36')]);_0xe12d68[_0xe3e9('0x37')]=qs['filters'](_[_0xe3e9('0x38')](_0x131667[_0xe3e9('0x2d')],_0x6c3690['filters']));if(_0x131667[_0xe3e9('0x2d')][_0xe3e9('0x39')]){_0xe12d68[_0xe3e9('0x37')]=_[_0xe3e9('0x3a')](_0xe12d68['where'],{'$or':_['map'](_0x342bd5,function(_0x46ceca){if(_0x46ceca[_0xe3e9('0x2a')]!==_0xe3e9('0x3b')){var _0x13ae2c={};_0x13ae2c[_0x46ceca['name']]={'$like':'%'+_0x131667['query'][_0xe3e9('0x39')]+'%'};return _0x13ae2c;}})});}_0xe12d68=_[_0xe3e9('0x3a')]({},_0xe12d68,_0x131667[_0xe3e9('0x3c')]);var _0xb9062c={'where':_0xe12d68['where']};return db[_0xe3e9('0x28')][_0xe3e9('0x19')](_0xb9062c)[_0xe3e9('0x21')](function(_0x26d8a7){_0x28a7ec[_0xe3e9('0x19')]=_0x26d8a7;if(_0x131667[_0xe3e9('0x2d')]['includeAll']){_0xe12d68['include']=[{'all':!![]}];}return db[_0xe3e9('0x28')][_0xe3e9('0x3d')](_0xe12d68);})[_0xe3e9('0x21')](function(_0x101120){_0x28a7ec[_0xe3e9('0x3e')]=_0x101120;return _0x28a7ec;})[_0xe3e9('0x21')](respondWithFilteredResult(_0x2febad,_0xe12d68))[_0xe3e9('0x3f')](handleError(_0x2febad,null));};exports[_0xe3e9('0x40')]=function(_0x4da888,_0x7f0410){var _0x4a7021={'raw':!![],'where':{'id':_0x4da888['params']['id']}},_0x3534dc={};_0x3534dc[_0xe3e9('0x2c')]=_[_0xe3e9('0x2e')](db[_0xe3e9('0x28')]['rawAttributes']);_0x3534dc['query']=_[_0xe3e9('0x2e')](_0x4da888[_0xe3e9('0x2d')]);_0x3534dc[_0xe3e9('0x2f')]=_[_0xe3e9('0x30')](_0x3534dc[_0xe3e9('0x2c')],_0x3534dc[_0xe3e9('0x2d')]);_0x4a7021[_0xe3e9('0x31')]=_[_0xe3e9('0x30')](_0x3534dc[_0xe3e9('0x2c')],qs[_0xe3e9('0x32')](_0x4da888[_0xe3e9('0x2d')][_0xe3e9('0x32')]));_0x4a7021[_0xe3e9('0x31')]=_0x4a7021['attributes'][_0xe3e9('0x33')]?_0x4a7021['attributes']:_0x3534dc[_0xe3e9('0x2c')];if(_0x4da888[_0xe3e9('0x2d')][_0xe3e9('0x41')]){_0x4a7021[_0xe3e9('0x42')]=[{'all':!![]}];}_0x4a7021=_['merge']({},_0x4a7021,_0x4da888[_0xe3e9('0x3c')]);return db[_0xe3e9('0x28')][_0xe3e9('0x43')](_0x4a7021)['then'](handleEntityNotFound(_0x7f0410,null))[_0xe3e9('0x21')](respondWithResult(_0x7f0410,null))[_0xe3e9('0x3f')](handleError(_0x7f0410,null));};exports['create']=function(_0x4c54d0,_0x5ade1f){return db[_0xe3e9('0x28')][_0xe3e9('0x44')](_0x4c54d0[_0xe3e9('0x45')],{})[_0xe3e9('0x21')](respondWithResult(_0x5ade1f,0xc9))[_0xe3e9('0x3f')](handleError(_0x5ade1f,null));};exports['update']=function(_0x3ac886,_0x1628a3){if(_0x3ac886[_0xe3e9('0x45')]['id']){delete _0x3ac886['body']['id'];}return db[_0xe3e9('0x28')][_0xe3e9('0x43')]({'where':{'id':_0x3ac886[_0xe3e9('0x46')]['id']}})[_0xe3e9('0x21')](handleEntityNotFound(_0x1628a3,null))[_0xe3e9('0x21')](saveUpdates(_0x3ac886['body'],null))['then'](respondWithResult(_0x1628a3,null))[_0xe3e9('0x3f')](handleError(_0x1628a3,null));};exports[_0xe3e9('0x22')]=function(_0x37ceed,_0x33b2c3){return db[_0xe3e9('0x28')][_0xe3e9('0x43')]({'where':{'id':_0x37ceed['params']['id']}})[_0xe3e9('0x21')](handleEntityNotFound(_0x33b2c3,null))['then'](removeEntity(_0x33b2c3,null))[_0xe3e9('0x3f')](handleError(_0x33b2c3,null));};exports[_0xe3e9('0x47')]=function(_0xb651d9,_0x3115c2){return db['Cdr']['describe']()[_0xe3e9('0x21')](respondWithResult(_0x3115c2,null))[_0xe3e9('0x3f')](handleError(_0x3115c2,null));}; \ No newline at end of file +var _0x2637=['bluebird','util','path','sox','to-csv','ejs','jsforce','desk.js','querystring','../../components/parsers/qs','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','set','apply','reject','save','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','sort','where','filter','VIRTUAL','merge','options','then','includeAll','include','findAll','rows','show','params','Cdr','length','catch','create','body','find','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x22b8a3,_0x2a79a7){var _0x199a0c=function(_0x544c66){while(--_0x544c66){_0x22b8a3['push'](_0x22b8a3['shift']());}};_0x199a0c(++_0x2a79a7);}(_0x2637,0x158));var _0x7263=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0x2637[_0x1928c9];return _0x51b5fb;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x7263('0x0'));var rimraf=require(_0x7263('0x1'));var zipdir=require(_0x7263('0x2'));var jsonpatch=require(_0x7263('0x3'));var rp=require(_0x7263('0x4'));var moment=require(_0x7263('0x5'));var BPromise=require(_0x7263('0x6'));var Mustache=require('mustache');var util=require(_0x7263('0x7'));var path=require(_0x7263('0x8'));var sox=require(_0x7263('0x9'));var csv=require(_0x7263('0xa'));var ejs=require(_0x7263('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7263('0xc'));var deskjs=require(_0x7263('0xd'));var toCsv=require('to-csv');var querystring=require(_0x7263('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x7263('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x7263('0x10'));var config=require(_0x7263('0x11'));var db=require(_0x7263('0x12'))['db'];function respondWithStatusCode(_0x2cb8f5,_0x5691f8){_0x5691f8=_0x5691f8||0xcc;return function(_0x5a99b5){if(_0x5a99b5){return _0x2cb8f5[_0x7263('0x13')](_0x5691f8);}return _0x2cb8f5[_0x7263('0x14')](_0x5691f8)[_0x7263('0x15')]();};}function respondWithResult(_0x5a3b17,_0x4c8022){_0x4c8022=_0x4c8022||0xc8;return function(_0x10f917){if(_0x10f917){return _0x5a3b17[_0x7263('0x14')](_0x4c8022)[_0x7263('0x16')](_0x10f917);}};}function respondWithFilteredResult(_0x3a2a00,_0x34f7f8){return function(_0x2475c7){if(_0x2475c7){var _0xf0d7a1=_0x2475c7[_0x7263('0x17')],_0x1d734e=_0x34f7f8[_0x7263('0x18')],_0x44d3fb=_0x34f7f8[_0x7263('0x18')]+_0x34f7f8['limit'],_0x30967c;if(_0x44d3fb>=_0xf0d7a1){_0x44d3fb=_0xf0d7a1;_0x30967c=0xc8;}else{_0x30967c=0xce;}_0x3a2a00[_0x7263('0x14')](_0x30967c);return _0x3a2a00[_0x7263('0x19')]('Content-Range',_0x1d734e+'-'+_0x44d3fb+'/'+_0xf0d7a1)[_0x7263('0x16')](_0x2475c7);}return null;};}function patchUpdates(_0x1bd13c){return function(_0x4ad7e6){try{jsonpatch[_0x7263('0x1a')](_0x4ad7e6,_0x1bd13c,!![]);}catch(_0x49e297){return BPromise[_0x7263('0x1b')](_0x49e297);}return _0x4ad7e6[_0x7263('0x1c')]();};}function saveUpdates(_0x5cef0c,_0x589ed4){return function(_0x5d2083){if(_0x5d2083){return _0x5d2083['update'](_0x5cef0c)['then'](function(_0x483fb8){return _0x483fb8;});}return null;};}function removeEntity(_0x536bb1,_0x198ca8){return function(_0x264425){if(_0x264425){return _0x264425['destroy']()['then'](function(){_0x536bb1[_0x7263('0x14')](0xcc)[_0x7263('0x15')]();});}};}function handleEntityNotFound(_0x55d295,_0x5db886){return function(_0x564f00){if(!_0x564f00){_0x55d295[_0x7263('0x13')](0x194);}return _0x564f00;};}function handleError(_0x50c0f2,_0x311247){_0x311247=_0x311247||0x1f4;return function(_0x4c0388){logger[_0x7263('0x1d')](_0x4c0388[_0x7263('0x1e')]);if(_0x4c0388[_0x7263('0x1f')]){delete _0x4c0388[_0x7263('0x1f')];}_0x50c0f2[_0x7263('0x14')](_0x311247)[_0x7263('0x20')](_0x4c0388);};}exports[_0x7263('0x21')]=function(_0x25d334,_0x254540){var _0x53b7e8={},_0x2c7f6a={},_0x55448e={'count':0x0,'rows':[]};var _0x223ec6=_[_0x7263('0x22')](db['Cdr'][_0x7263('0x23')],function(_0xb8621b){return{'name':_0xb8621b[_0x7263('0x24')],'type':_0xb8621b[_0x7263('0x25')][_0x7263('0x26')]};});_0x2c7f6a[_0x7263('0x27')]=_['map'](_0x223ec6,_0x7263('0x1f'));_0x2c7f6a[_0x7263('0x28')]=_[_0x7263('0x29')](_0x25d334[_0x7263('0x28')]);_0x2c7f6a[_0x7263('0x2a')]=_[_0x7263('0x2b')](_0x2c7f6a['model'],_0x2c7f6a[_0x7263('0x28')]);_0x53b7e8[_0x7263('0x2c')]=_[_0x7263('0x2b')](_0x2c7f6a['model'],qs[_0x7263('0x2d')](_0x25d334['query'][_0x7263('0x2d')]));_0x53b7e8['attributes']=_0x53b7e8[_0x7263('0x2c')]['length']?_0x53b7e8[_0x7263('0x2c')]:_0x2c7f6a['model'];if(!_0x25d334['query'][_0x7263('0x2e')](_0x7263('0x2f'))){_0x53b7e8['limit']=qs[_0x7263('0x30')](_0x25d334[_0x7263('0x28')]['limit']);_0x53b7e8[_0x7263('0x18')]=qs['offset'](_0x25d334['query']['offset']);}_0x53b7e8['order']=qs['sort'](_0x25d334['query'][_0x7263('0x31')]);_0x53b7e8[_0x7263('0x32')]=qs['filters'](_['pick'](_0x25d334[_0x7263('0x28')],_0x2c7f6a[_0x7263('0x2a')]));if(_0x25d334[_0x7263('0x28')][_0x7263('0x33')]){_0x53b7e8['where']=_['merge'](_0x53b7e8['where'],{'$or':_[_0x7263('0x22')](_0x223ec6,function(_0x65ab25){if(_0x65ab25[_0x7263('0x25')]!==_0x7263('0x34')){var _0x2691f6={};_0x2691f6[_0x65ab25['name']]={'$like':'%'+_0x25d334['query'][_0x7263('0x33')]+'%'};return _0x2691f6;}})});}_0x53b7e8=_[_0x7263('0x35')]({},_0x53b7e8,_0x25d334[_0x7263('0x36')]);var _0x54b9ab={'where':_0x53b7e8['where']};return db['Cdr']['count'](_0x54b9ab)[_0x7263('0x37')](function(_0x40fef3){_0x55448e[_0x7263('0x17')]=_0x40fef3;if(_0x25d334['query'][_0x7263('0x38')]){_0x53b7e8[_0x7263('0x39')]=[{'all':!![]}];}return db['Cdr'][_0x7263('0x3a')](_0x53b7e8);})[_0x7263('0x37')](function(_0x174ced){_0x55448e[_0x7263('0x3b')]=_0x174ced;return _0x55448e;})[_0x7263('0x37')](respondWithFilteredResult(_0x254540,_0x53b7e8))['catch'](handleError(_0x254540,null));};exports[_0x7263('0x3c')]=function(_0xd8a94e,_0x484578){var _0x15f437={'raw':!![],'where':{'id':_0xd8a94e[_0x7263('0x3d')]['id']}},_0x56d687={};_0x56d687[_0x7263('0x27')]=_[_0x7263('0x29')](db[_0x7263('0x3e')][_0x7263('0x23')]);_0x56d687['query']=_[_0x7263('0x29')](_0xd8a94e[_0x7263('0x28')]);_0x56d687[_0x7263('0x2a')]=_['intersection'](_0x56d687[_0x7263('0x27')],_0x56d687[_0x7263('0x28')]);_0x15f437[_0x7263('0x2c')]=_[_0x7263('0x2b')](_0x56d687[_0x7263('0x27')],qs[_0x7263('0x2d')](_0xd8a94e[_0x7263('0x28')][_0x7263('0x2d')]));_0x15f437['attributes']=_0x15f437[_0x7263('0x2c')][_0x7263('0x3f')]?_0x15f437[_0x7263('0x2c')]:_0x56d687[_0x7263('0x27')];if(_0xd8a94e[_0x7263('0x28')][_0x7263('0x38')]){_0x15f437['include']=[{'all':!![]}];}_0x15f437=_[_0x7263('0x35')]({},_0x15f437,_0xd8a94e[_0x7263('0x36')]);return db['Cdr']['find'](_0x15f437)[_0x7263('0x37')](handleEntityNotFound(_0x484578,null))[_0x7263('0x37')](respondWithResult(_0x484578,null))[_0x7263('0x40')](handleError(_0x484578,null));};exports['create']=function(_0x143668,_0x1dcef9){return db[_0x7263('0x3e')][_0x7263('0x41')](_0x143668[_0x7263('0x42')],{})[_0x7263('0x37')](respondWithResult(_0x1dcef9,0xc9))[_0x7263('0x40')](handleError(_0x1dcef9,null));};exports['update']=function(_0x22d1dc,_0x43af0b){if(_0x22d1dc[_0x7263('0x42')]['id']){delete _0x22d1dc['body']['id'];}return db[_0x7263('0x3e')][_0x7263('0x43')]({'where':{'id':_0x22d1dc[_0x7263('0x3d')]['id']}})[_0x7263('0x37')](handleEntityNotFound(_0x43af0b,null))[_0x7263('0x37')](saveUpdates(_0x22d1dc[_0x7263('0x42')],null))[_0x7263('0x37')](respondWithResult(_0x43af0b,null))['catch'](handleError(_0x43af0b,null));};exports[_0x7263('0x44')]=function(_0x4ab68f,_0x290a2e){return db[_0x7263('0x3e')][_0x7263('0x43')]({'where':{'id':_0x4ab68f[_0x7263('0x3d')]['id']}})[_0x7263('0x37')](handleEntityNotFound(_0x290a2e,null))[_0x7263('0x37')](removeEntity(_0x290a2e,null))[_0x7263('0x40')](handleError(_0x290a2e,null));};exports[_0x7263('0x45')]=function(_0x5f3be6,_0x19fc38){return db[_0x7263('0x3e')]['describe']()[_0x7263('0x37')](respondWithResult(_0x19fc38,null))[_0x7263('0x40')](handleError(_0x19fc38,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 0ee6878..524b715 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 _0xf61e=['src','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cdr.attributes','exports','define','cdr','accountcode','disposition','dst'];(function(_0x136619,_0x31c9b2){var _0x38c4a5=function(_0x10b74d){while(--_0x10b74d){_0x136619['push'](_0x136619['shift']());}};_0x38c4a5(++_0x31c9b2);}(_0xf61e,0x191));var _0xef61=function(_0x53cb2a,_0x38da33){_0x53cb2a=_0x53cb2a-0x0;var _0x361471=_0xf61e[_0x53cb2a];return _0x361471;};'use strict';var _=require(_0xef61('0x0'));var util=require(_0xef61('0x1'));var logger=require(_0xef61('0x2'))(_0xef61('0x3'));var moment=require(_0xef61('0x4'));var BPromise=require(_0xef61('0x5'));var rp=require(_0xef61('0x6'));var fs=require('fs');var path=require(_0xef61('0x7'));var rimraf=require(_0xef61('0x8'));var config=require(_0xef61('0x9'));var attributes=require(_0xef61('0xa'));module[_0xef61('0xb')]=function(_0x5b00b2,_0x9e17f4){return _0x5b00b2[_0xef61('0xc')]('Cdr',attributes,{'tableName':_0xef61('0xd'),'paranoid':![],'indexes':[{'name':_0xef61('0xe'),'fields':[_0xef61('0xe')]},{'name':'calldate','fields':['calldate']},{'name':_0xef61('0xf'),'fields':[_0xef61('0xf')]},{'name':_0xef61('0x10'),'fields':[_0xef61('0x10')]},{'name':_0xef61('0x11'),'fields':[_0xef61('0x11')]},{'name':_0xef61('0x12'),'fields':[_0xef61('0x12')]}],'timestamps':![]});}; \ No newline at end of file +var _0x4819=['cdr','accountcode','calldate','disposition','dst','src','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cdr.attributes','Cdr'];(function(_0x434e7b,_0x31ab4d){var _0x5deed2=function(_0x1a1cf2){while(--_0x1a1cf2){_0x434e7b['push'](_0x434e7b['shift']());}};_0x5deed2(++_0x31ab4d);}(_0x4819,0xcd));var _0x9481=function(_0x4534e3,_0x56de6e){_0x4534e3=_0x4534e3-0x0;var _0x50c3a3=_0x4819[_0x4534e3];return _0x50c3a3;};'use strict';var _=require('lodash');var util=require(_0x9481('0x0'));var logger=require(_0x9481('0x1'))(_0x9481('0x2'));var moment=require(_0x9481('0x3'));var BPromise=require(_0x9481('0x4'));var rp=require(_0x9481('0x5'));var fs=require('fs');var path=require(_0x9481('0x6'));var rimraf=require(_0x9481('0x7'));var config=require(_0x9481('0x8'));var attributes=require(_0x9481('0x9'));module['exports']=function(_0x4d9e3a,_0x5def07){return _0x4d9e3a['define'](_0x9481('0xa'),attributes,{'tableName':_0x9481('0xb'),'paranoid':![],'indexes':[{'name':_0x9481('0xc'),'fields':[_0x9481('0xc')]},{'name':_0x9481('0xd'),'fields':['calldate']},{'name':_0x9481('0xe'),'fields':['disposition']},{'name':_0x9481('0xf'),'fields':['dst']},{'name':_0x9481('0x10'),'fields':[_0x9481('0x10')]},{'name':_0x9481('0x11'),'fields':[_0x9481('0x11')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index e2f82a4..defc3a9 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 _0x87c5=['ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Cdr,\x20%s,\x20%s','result','util','moment','bluebird','randomstring'];(function(_0x3f6e6c,_0x3bf609){var _0x2f24cc=function(_0x542f22){while(--_0x542f22){_0x3f6e6c['push'](_0x3f6e6c['shift']());}};_0x2f24cc(++_0x3bf609);}(_0x87c5,0xee));var _0x587c=function(_0x47fd66,_0x11f24c){_0x47fd66=_0x47fd66-0x0;var _0x273556=_0x87c5[_0x47fd66];return _0x273556;};'use strict';var _=require('lodash');var util=require(_0x587c('0x0'));var moment=require(_0x587c('0x1'));var BPromise=require(_0x587c('0x2'));var rs=require(_0x587c('0x3'));var fs=require('fs');var Redis=require(_0x587c('0x4'));var db=require(_0x587c('0x5'))['db'];var utils=require(_0x587c('0x6'));var logger=require('../../config/logger')(_0x587c('0x7'));var config=require(_0x587c('0x8'));var jayson=require(_0x587c('0x9'));var client=jayson[_0x587c('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5cef10,_0x57dd90,_0x504699){return new BPromise(function(_0x36940d,_0x305b37){return client[_0x587c('0xb')](_0x5cef10,_0x504699)[_0x587c('0xc')](function(_0x5004be){logger['info']('Cdr,\x20%s,\x20%s',_0x57dd90,_0x587c('0xd'));logger[_0x587c('0xe')](_0x587c('0xf'),_0x57dd90,_0x587c('0xd'),JSON[_0x587c('0x10')](_0x5004be));if(_0x5004be[_0x587c('0x11')]){if(_0x5004be['error'][_0x587c('0x12')]===0x1f4){logger[_0x587c('0x11')]('Cdr,\x20%s,\x20%s',_0x57dd90,_0x5004be['error'][_0x587c('0x13')]);return _0x305b37(_0x5004be[_0x587c('0x11')]['message']);}logger['error'](_0x587c('0x14'),_0x57dd90,_0x5004be['error'][_0x587c('0x13')]);return _0x36940d(_0x5004be[_0x587c('0x11')][_0x587c('0x13')]);}else{logger['info'](_0x587c('0x14'),_0x57dd90,_0x587c('0xd'));_0x36940d(_0x5004be[_0x587c('0x15')][_0x587c('0x13')]);}})['catch'](function(_0x34b9c8){logger[_0x587c('0x11')](_0x587c('0x14'),_0x57dd90,_0x34b9c8);_0x305b37(_0x34b9c8);});});} \ No newline at end of file +var _0xc822=['lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','client','http','request','then','info','Cdr,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result'];(function(_0x30b829,_0x9d7556){var _0xd430b9=function(_0x5c9811){while(--_0x5c9811){_0x30b829['push'](_0x30b829['shift']());}};_0xd430b9(++_0x9d7556);}(_0xc822,0xf7));var _0x2c82=function(_0x291f8b,_0x3b5591){_0x291f8b=_0x291f8b-0x0;var _0x275171=_0xc822[_0x291f8b];return _0x275171;};'use strict';var _=require(_0x2c82('0x0'));var util=require(_0x2c82('0x1'));var moment=require('moment');var BPromise=require(_0x2c82('0x2'));var rs=require(_0x2c82('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2c82('0x4'))['db'];var utils=require(_0x2c82('0x5'));var logger=require('../../config/logger')(_0x2c82('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x2c82('0x7')][_0x2c82('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x55aa27,_0xe50514,_0x3230fe){return new BPromise(function(_0x1ad0f4,_0x3b3301){return client[_0x2c82('0x9')](_0x55aa27,_0x3230fe)[_0x2c82('0xa')](function(_0x511908){logger[_0x2c82('0xb')](_0x2c82('0xc'),_0xe50514,_0x2c82('0xd'));logger['debug']('Cdr,\x20%s,\x20%s,\x20%s',_0xe50514,_0x2c82('0xd'),JSON[_0x2c82('0xe')](_0x511908));if(_0x511908[_0x2c82('0xf')]){if(_0x511908[_0x2c82('0xf')][_0x2c82('0x10')]===0x1f4){logger[_0x2c82('0xf')](_0x2c82('0xc'),_0xe50514,_0x511908[_0x2c82('0xf')][_0x2c82('0x11')]);return _0x3b3301(_0x511908[_0x2c82('0xf')][_0x2c82('0x11')]);}logger[_0x2c82('0xf')](_0x2c82('0xc'),_0xe50514,_0x511908[_0x2c82('0xf')][_0x2c82('0x11')]);return _0x1ad0f4(_0x511908[_0x2c82('0xf')][_0x2c82('0x11')]);}else{logger[_0x2c82('0xb')](_0x2c82('0xc'),_0xe50514,_0x2c82('0xd'));_0x1ad0f4(_0x511908[_0x2c82('0x12')][_0x2c82('0x11')]);}})['catch'](function(_0x3cf63c){logger[_0x2c82('0xf')]('Cdr,\x20%s,\x20%s',_0xe50514,_0x3cf63c);_0x3b3301(_0x3cf63c);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index 3a94944..b4f2d41 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 _0x0802=['multer','util','path','connect-timeout','Router','../../components/auth/service','./cdr.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create','put','delete','destroy'];(function(_0x2d66d2,_0xdf2cd0){var _0x24217a=function(_0x2df2d4){while(--_0x2df2d4){_0x2d66d2['push'](_0x2d66d2['shift']());}};_0x24217a(++_0xdf2cd0);}(_0x0802,0x144));var _0x2080=function(_0x28a089,_0xd50422){_0x28a089=_0x28a089-0x0;var _0x322e37=_0x0802[_0x28a089];return _0x322e37;};'use strict';var multer=require(_0x2080('0x0'));var util=require(_0x2080('0x1'));var path=require(_0x2080('0x2'));var timeout=require(_0x2080('0x3'));var express=require('express');var router=express[_0x2080('0x4')]();var auth=require(_0x2080('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x2080('0x6'));router[_0x2080('0x7')]('/',auth[_0x2080('0x8')](),controller[_0x2080('0x9')]);router[_0x2080('0x7')](_0x2080('0xa'),auth[_0x2080('0x8')](),controller[_0x2080('0xb')]);router[_0x2080('0x7')](_0x2080('0xc'),auth[_0x2080('0x8')](),controller[_0x2080('0xd')]);router['post']('/',auth[_0x2080('0x8')](),controller[_0x2080('0xe')]);router[_0x2080('0xf')]('/:id',auth[_0x2080('0x8')](),controller['update']);router[_0x2080('0x10')](_0x2080('0xc'),auth[_0x2080('0x8')](),controller[_0x2080('0x11')]);module['exports']=router; \ No newline at end of file +var _0x66b8=['exports','multer','path','connect-timeout','express','Router','../../components/interaction/service','get','isAuthenticated','/describe','/:id','show','post','create','put','delete','destroy'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0x66b8,0x122));var _0x866b=function(_0x25e7cb,_0x3579b7){_0x25e7cb=_0x25e7cb-0x0;var _0x375d92=_0x66b8[_0x25e7cb];return _0x375d92;};'use strict';var multer=require(_0x866b('0x0'));var util=require('util');var path=require(_0x866b('0x1'));var timeout=require(_0x866b('0x2'));var express=require(_0x866b('0x3'));var router=express[_0x866b('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x866b('0x5'));var config=require('../../config/environment');var controller=require('./cdr.controller');router[_0x866b('0x6')]('/',auth[_0x866b('0x7')](),controller['index']);router[_0x866b('0x6')](_0x866b('0x8'),auth['isAuthenticated'](),controller['describe']);router[_0x866b('0x6')](_0x866b('0x9'),auth[_0x866b('0x7')](),controller[_0x866b('0xa')]);router[_0x866b('0xb')]('/',auth[_0x866b('0x7')](),controller[_0x866b('0xc')]);router[_0x866b('0xd')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x866b('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x866b('0xf')]);module[_0x866b('0x10')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index 5a67a6f..553f601 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 _0x99cf=['STRING','*,*,*,*','sequelize','noop'];(function(_0x249c3f,_0x86aebc){var _0x3a9c12=function(_0x55c1fd){while(--_0x55c1fd){_0x249c3f['push'](_0x249c3f['shift']());}};_0x3a9c12(++_0x86aebc);}(_0x99cf,0x66));var _0xf99c=function(_0x55fd56,_0x1ce5d0){_0x55fd56=_0x55fd56-0x0;var _0x1da532=_0x99cf[_0x55fd56];return _0x1da532;};'use strict';var Sequelize=require(_0xf99c('0x0'));module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xf99c('0x1')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xf99c('0x2')]},'interval':{'type':Sequelize[_0xf99c('0x2')],'defaultValue':_0xf99c('0x3')}}; \ No newline at end of file +var _0x693b=['STRING','noop','TEXT','INTEGER'];(function(_0x22a9a3,_0x58a93f){var _0x37fc91=function(_0x5af66e){while(--_0x5af66e){_0x22a9a3['push'](_0x22a9a3['shift']());}};_0x37fc91(++_0x58a93f);}(_0x693b,0x13b));var _0xb693=function(_0x3d3126,_0x1c22ac){_0x3d3126=_0x3d3126-0x0;var _0x589a05=_0x693b[_0x3d3126];return _0x589a05;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize[_0xb693('0x0')],'allowNull':![]},'app':{'type':Sequelize[_0xb693('0x1')],'allowNull':![],'defaultValue':_0xb693('0x2')},'appdata':{'type':Sequelize[_0xb693('0x3')]()},'description':{'type':Sequelize[_0xb693('0x1')]},'interval':{'type':Sequelize[_0xb693('0x1')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 9bb9d3a..ddecaf2 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 _0x5a43=['limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','show','params','model','keys','ChatApplication','query','intersection','attributes','length','includeAll','merge','find','catch','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','sendStatus','status','end','json','count','offset'];(function(_0x5bf420,_0x2d068d){var _0x1c5255=function(_0x4964a2){while(--_0x4964a2){_0x5bf420['push'](_0x5bf420['shift']());}};_0x1c5255(++_0x2d068d);}(_0x5a43,0x193));var _0x35a4=function(_0x5eff97,_0x2a97b7){_0x5eff97=_0x5eff97-0x0;var _0x11a173=_0x5a43[_0x5eff97];return _0x11a173;};'use strict';var pdf=require(_0x35a4('0x0'));var emlformat=require(_0x35a4('0x1'));var rimraf=require(_0x35a4('0x2'));var zipdir=require(_0x35a4('0x3'));var jsonpatch=require(_0x35a4('0x4'));var rp=require('request-promise');var moment=require(_0x35a4('0x5'));var BPromise=require(_0x35a4('0x6'));var Mustache=require('mustache');var util=require(_0x35a4('0x7'));var path=require(_0x35a4('0x8'));var sox=require(_0x35a4('0x9'));var csv=require('to-csv');var ejs=require(_0x35a4('0xa'));var fs=require('fs');var _=require(_0x35a4('0xb'));var squel=require(_0x35a4('0xc'));var crypto=require(_0x35a4('0xd'));var jsforce=require(_0x35a4('0xe'));var deskjs=require(_0x35a4('0xf'));var toCsv=require('to-csv');var querystring=require(_0x35a4('0x10'));var Papa=require('papaparse');var Redis=require(_0x35a4('0x11'));var authService=require(_0x35a4('0x12'));var qs=require(_0x35a4('0x13'));var as=require(_0x35a4('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x35a4('0x15'))('api');var utils=require(_0x35a4('0x16'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x811d3d,_0x3581a7){_0x3581a7=_0x3581a7||0xcc;return function(_0x1277c2){if(_0x1277c2){return _0x811d3d[_0x35a4('0x17')](_0x3581a7);}return _0x811d3d[_0x35a4('0x18')](_0x3581a7)[_0x35a4('0x19')]();};}function respondWithResult(_0x118f7b,_0x138eb2){_0x138eb2=_0x138eb2||0xc8;return function(_0x2bc013){if(_0x2bc013){return _0x118f7b[_0x35a4('0x18')](_0x138eb2)[_0x35a4('0x1a')](_0x2bc013);}};}function respondWithFilteredResult(_0x3babb9,_0x505bfe){return function(_0xb23ef8){if(_0xb23ef8){var _0x4a22c4=_0xb23ef8[_0x35a4('0x1b')],_0x225b62=_0x505bfe['offset'],_0x253051=_0x505bfe[_0x35a4('0x1c')]+_0x505bfe[_0x35a4('0x1d')],_0x2ef73d;if(_0x253051>=_0x4a22c4){_0x253051=_0x4a22c4;_0x2ef73d=0xc8;}else{_0x2ef73d=0xce;}_0x3babb9[_0x35a4('0x18')](_0x2ef73d);return _0x3babb9[_0x35a4('0x1e')](_0x35a4('0x1f'),_0x225b62+'-'+_0x253051+'/'+_0x4a22c4)[_0x35a4('0x1a')](_0xb23ef8);}return null;};}function patchUpdates(_0x7dcce7){return function(_0x2edb50){try{jsonpatch[_0x35a4('0x20')](_0x2edb50,_0x7dcce7,!![]);}catch(_0x4d8b17){return BPromise[_0x35a4('0x21')](_0x4d8b17);}return _0x2edb50[_0x35a4('0x22')]();};}function saveUpdates(_0x3afb94,_0x40b368){return function(_0x4d5367){if(_0x4d5367){return _0x4d5367[_0x35a4('0x23')](_0x3afb94)[_0x35a4('0x24')](function(_0x3f0b2e){return _0x3f0b2e;});}return null;};}function removeEntity(_0x5a1b64,_0x6d478d){return function(_0x598af8){if(_0x598af8){return _0x598af8[_0x35a4('0x25')]()['then'](function(){_0x5a1b64[_0x35a4('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0xf5f15e,_0x3201cb){return function(_0x43eb15){if(!_0x43eb15){_0xf5f15e[_0x35a4('0x17')](0x194);}return _0x43eb15;};}function handleError(_0x5c9727,_0xec4374){_0xec4374=_0xec4374||0x1f4;return function(_0x5ab469){logger['error'](_0x5ab469[_0x35a4('0x26')]);if(_0x5ab469['name']){delete _0x5ab469[_0x35a4('0x27')];}_0x5c9727[_0x35a4('0x18')](_0xec4374)['send'](_0x5ab469);};}exports[_0x35a4('0x28')]=function(_0x58c4e8,_0x568556){var _0x13a38d={'raw':!![],'where':{'id':_0x58c4e8[_0x35a4('0x29')]['id']}},_0x34b548={};_0x34b548[_0x35a4('0x2a')]=_[_0x35a4('0x2b')](db[_0x35a4('0x2c')]['rawAttributes']);_0x34b548[_0x35a4('0x2d')]=_['keys'](_0x58c4e8[_0x35a4('0x2d')]);_0x34b548['filters']=_[_0x35a4('0x2e')](_0x34b548[_0x35a4('0x2a')],_0x34b548[_0x35a4('0x2d')]);_0x13a38d[_0x35a4('0x2f')]=_[_0x35a4('0x2e')](_0x34b548[_0x35a4('0x2a')],qs['fields'](_0x58c4e8['query']['fields']));_0x13a38d[_0x35a4('0x2f')]=_0x13a38d['attributes'][_0x35a4('0x30')]?_0x13a38d[_0x35a4('0x2f')]:_0x34b548[_0x35a4('0x2a')];if(_0x58c4e8[_0x35a4('0x2d')][_0x35a4('0x31')]){_0x13a38d['include']=[{'all':!![]}];}_0x13a38d=_[_0x35a4('0x32')]({},_0x13a38d,_0x58c4e8['options']);return db[_0x35a4('0x2c')][_0x35a4('0x33')](_0x13a38d)[_0x35a4('0x24')](handleEntityNotFound(_0x568556,null))[_0x35a4('0x24')](respondWithResult(_0x568556,null))[_0x35a4('0x34')](handleError(_0x568556,null));};exports[_0x35a4('0x23')]=function(_0x12af38,_0x3e47fc){if(_0x12af38['body']['id']){delete _0x12af38[_0x35a4('0x35')]['id'];}return db[_0x35a4('0x2c')][_0x35a4('0x33')]({'where':{'id':_0x12af38[_0x35a4('0x29')]['id']}})[_0x35a4('0x24')](handleEntityNotFound(_0x3e47fc,null))[_0x35a4('0x24')](saveUpdates(_0x12af38[_0x35a4('0x35')],null))[_0x35a4('0x24')](respondWithResult(_0x3e47fc,null))['catch'](handleError(_0x3e47fc,null));};exports['destroy']=function(_0x2ac870,_0x2c1d62){return db['ChatApplication'][_0x35a4('0x33')]({'where':{'id':_0x2ac870[_0x35a4('0x29')]['id']}})[_0x35a4('0x24')](handleEntityNotFound(_0x2c1d62,null))[_0x35a4('0x24')](removeEntity(_0x2c1d62,null))[_0x35a4('0x34')](handleError(_0x2c1d62,null));}; \ No newline at end of file +var _0x5df9=['mustache','util','path','to-csv','ejs','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','set','Content-Range','reject','save','update','then','destroy','error','stack','name','show','ChatApplication','rawAttributes','query','filters','intersection','model','attributes','fields','length','includeAll','include','merge','options','find','catch','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x41cfa3,_0x24aa86){var _0x27e755=function(_0x3daaa0){while(--_0x3daaa0){_0x41cfa3['push'](_0x41cfa3['shift']());}};_0x27e755(++_0x24aa86);}(_0x5df9,0x11c));var _0x95df=function(_0x24ee39,_0x526111){_0x24ee39=_0x24ee39-0x0;var _0x4913bc=_0x5df9[_0x24ee39];return _0x4913bc;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x95df('0x0'));var rimraf=require(_0x95df('0x1'));var zipdir=require(_0x95df('0x2'));var jsonpatch=require(_0x95df('0x3'));var rp=require(_0x95df('0x4'));var moment=require(_0x95df('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x95df('0x6'));var util=require(_0x95df('0x7'));var path=require(_0x95df('0x8'));var sox=require('sox');var csv=require(_0x95df('0x9'));var ejs=require(_0x95df('0xa'));var fs=require('fs');var _=require(_0x95df('0xb'));var squel=require('squel');var crypto=require(_0x95df('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x95df('0x9'));var querystring=require(_0x95df('0xd'));var Papa=require(_0x95df('0xe'));var Redis=require(_0x95df('0xf'));var authService=require(_0x95df('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x95df('0x11'));var hardwareService=require(_0x95df('0x12'));var logger=require(_0x95df('0x13'))(_0x95df('0x14'));var utils=require(_0x95df('0x15'));var config=require(_0x95df('0x16'));var db=require(_0x95df('0x17'))['db'];function respondWithStatusCode(_0x24321b,_0x53fbbb){_0x53fbbb=_0x53fbbb||0xcc;return function(_0x3a40ac){if(_0x3a40ac){return _0x24321b[_0x95df('0x18')](_0x53fbbb);}return _0x24321b['status'](_0x53fbbb)[_0x95df('0x19')]();};}function respondWithResult(_0x3e6b65,_0x2c39f6){_0x2c39f6=_0x2c39f6||0xc8;return function(_0x31cf44){if(_0x31cf44){return _0x3e6b65[_0x95df('0x1a')](_0x2c39f6)[_0x95df('0x1b')](_0x31cf44);}};}function respondWithFilteredResult(_0x2b1e09,_0x1acbe0){return function(_0xf4c335){if(_0xf4c335){var _0x12e313=_0xf4c335[_0x95df('0x1c')],_0x24aabd=_0x1acbe0[_0x95df('0x1d')],_0x402e23=_0x1acbe0[_0x95df('0x1d')]+_0x1acbe0['limit'],_0x28df5c;if(_0x402e23>=_0x12e313){_0x402e23=_0x12e313;_0x28df5c=0xc8;}else{_0x28df5c=0xce;}_0x2b1e09['status'](_0x28df5c);return _0x2b1e09[_0x95df('0x1e')](_0x95df('0x1f'),_0x24aabd+'-'+_0x402e23+'/'+_0x12e313)[_0x95df('0x1b')](_0xf4c335);}return null;};}function patchUpdates(_0xf73735){return function(_0x2753bd){try{jsonpatch['apply'](_0x2753bd,_0xf73735,!![]);}catch(_0x9ab5bd){return BPromise[_0x95df('0x20')](_0x9ab5bd);}return _0x2753bd[_0x95df('0x21')]();};}function saveUpdates(_0x2ab328,_0x30c7aa){return function(_0xe6676c){if(_0xe6676c){return _0xe6676c[_0x95df('0x22')](_0x2ab328)[_0x95df('0x23')](function(_0x11f724){return _0x11f724;});}return null;};}function removeEntity(_0x29ba00,_0x177d7c){return function(_0x4ca15d){if(_0x4ca15d){return _0x4ca15d[_0x95df('0x24')]()[_0x95df('0x23')](function(){_0x29ba00[_0x95df('0x1a')](0xcc)[_0x95df('0x19')]();});}};}function handleEntityNotFound(_0x28a71d,_0x270577){return function(_0x46fdff){if(!_0x46fdff){_0x28a71d[_0x95df('0x18')](0x194);}return _0x46fdff;};}function handleError(_0x50c9d5,_0x406111){_0x406111=_0x406111||0x1f4;return function(_0x132319){logger[_0x95df('0x25')](_0x132319[_0x95df('0x26')]);if(_0x132319['name']){delete _0x132319[_0x95df('0x27')];}_0x50c9d5[_0x95df('0x1a')](_0x406111)['send'](_0x132319);};}exports[_0x95df('0x28')]=function(_0x3a35c4,_0x324e83){var _0x26948d={'raw':!![],'where':{'id':_0x3a35c4['params']['id']}},_0x37d35b={};_0x37d35b['model']=_['keys'](db[_0x95df('0x29')][_0x95df('0x2a')]);_0x37d35b[_0x95df('0x2b')]=_['keys'](_0x3a35c4[_0x95df('0x2b')]);_0x37d35b[_0x95df('0x2c')]=_[_0x95df('0x2d')](_0x37d35b[_0x95df('0x2e')],_0x37d35b[_0x95df('0x2b')]);_0x26948d[_0x95df('0x2f')]=_[_0x95df('0x2d')](_0x37d35b['model'],qs[_0x95df('0x30')](_0x3a35c4[_0x95df('0x2b')][_0x95df('0x30')]));_0x26948d['attributes']=_0x26948d[_0x95df('0x2f')][_0x95df('0x31')]?_0x26948d[_0x95df('0x2f')]:_0x37d35b[_0x95df('0x2e')];if(_0x3a35c4['query'][_0x95df('0x32')]){_0x26948d[_0x95df('0x33')]=[{'all':!![]}];}_0x26948d=_[_0x95df('0x34')]({},_0x26948d,_0x3a35c4[_0x95df('0x35')]);return db[_0x95df('0x29')][_0x95df('0x36')](_0x26948d)[_0x95df('0x23')](handleEntityNotFound(_0x324e83,null))[_0x95df('0x23')](respondWithResult(_0x324e83,null))[_0x95df('0x37')](handleError(_0x324e83,null));};exports[_0x95df('0x22')]=function(_0x355551,_0x4e481c){if(_0x355551[_0x95df('0x38')]['id']){delete _0x355551[_0x95df('0x38')]['id'];}return db['ChatApplication']['find']({'where':{'id':_0x355551[_0x95df('0x39')]['id']}})[_0x95df('0x23')](handleEntityNotFound(_0x4e481c,null))[_0x95df('0x23')](saveUpdates(_0x355551[_0x95df('0x38')],null))['then'](respondWithResult(_0x4e481c,null))[_0x95df('0x37')](handleError(_0x4e481c,null));};exports[_0x95df('0x24')]=function(_0x232f48,_0x26b14e){return db[_0x95df('0x29')]['find']({'where':{'id':_0x232f48[_0x95df('0x39')]['id']}})['then'](handleEntityNotFound(_0x26b14e,null))[_0x95df('0x23')](removeEntity(_0x26b14e,null))[_0x95df('0x37')](handleError(_0x26b14e,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 5548976..30037ae 100644 --- a/server/api/chatApplication/chatApplication.model.js +++ b/server/api/chatApplication/chatApplication.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['define','ChatApplication','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./chatApplication.attributes','exports'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xa9e0[_0x5b561d];return _0x431060;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'chat_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x0a9e('0xb')});}; \ No newline at end of file +var _0xa9e0=['define','ChatApplication','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./chatApplication.attributes','exports'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0xa9e0[_0x4ea69d];return _0x5318e0;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'chat_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x0a9e('0xb')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index ed21ab5..6cacdf0 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 _0xda13=['then','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','http','request'];(function(_0x501d8f,_0x4312e1){var _0x2f76ae=function(_0x5becaf){while(--_0x5becaf){_0x501d8f['push'](_0x501d8f['shift']());}};_0x2f76ae(++_0x4312e1);}(_0xda13,0x199));var _0x3da1=function(_0xfc5a04,_0xb77332){_0xfc5a04=_0xfc5a04-0x0;var _0x24b690=_0xda13[_0xfc5a04];return _0x24b690;};'use strict';var _=require('lodash');var util=require(_0x3da1('0x0'));var moment=require(_0x3da1('0x1'));var BPromise=require(_0x3da1('0x2'));var rs=require(_0x3da1('0x3'));var fs=require('fs');var Redis=require(_0x3da1('0x4'));var db=require(_0x3da1('0x5'))['db'];var utils=require(_0x3da1('0x6'));var logger=require('../../config/logger')(_0x3da1('0x7'));var config=require('../../config/environment');var jayson=require(_0x3da1('0x8'));var client=jayson['client'][_0x3da1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x528e19,_0x1bf1aa,_0xf4b1f8){return new BPromise(function(_0x10fec5,_0x38ae98){return client[_0x3da1('0xa')](_0x528e19,_0xf4b1f8)[_0x3da1('0xb')](function(_0x5c4886){logger['info'](_0x3da1('0xc'),_0x1bf1aa,_0x3da1('0xd'));logger[_0x3da1('0xe')](_0x3da1('0xf'),_0x1bf1aa,_0x3da1('0xd'),JSON[_0x3da1('0x10')](_0x5c4886));if(_0x5c4886[_0x3da1('0x11')]){if(_0x5c4886[_0x3da1('0x11')]['code']===0x1f4){logger['error'](_0x3da1('0xc'),_0x1bf1aa,_0x5c4886[_0x3da1('0x11')][_0x3da1('0x12')]);return _0x38ae98(_0x5c4886[_0x3da1('0x11')]['message']);}logger[_0x3da1('0x11')]('ChatApplication,\x20%s,\x20%s',_0x1bf1aa,_0x5c4886[_0x3da1('0x11')][_0x3da1('0x12')]);return _0x10fec5(_0x5c4886['error']['message']);}else{logger[_0x3da1('0x13')](_0x3da1('0xc'),_0x1bf1aa,_0x3da1('0xd'));_0x10fec5(_0x5c4886[_0x3da1('0x14')]['message']);}})['catch'](function(_0x1415be){logger[_0x3da1('0x11')](_0x3da1('0xc'),_0x1bf1aa,_0x1415be);_0x38ae98(_0x1415be);});});} \ No newline at end of file +var _0x13b8=['../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','debug','ChatApplication,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','ChatApplication,\x20%s,\x20%s','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x12b0c8,_0x424f36){var _0x2a0ad8=function(_0x4f329a){while(--_0x4f329a){_0x12b0c8['push'](_0x12b0c8['shift']());}};_0x2a0ad8(++_0x424f36);}(_0x13b8,0x119));var _0x813b=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0x13b8[_0x1ddedd];return _0xa3e1ac;};'use strict';var _=require('lodash');var util=require(_0x813b('0x0'));var moment=require(_0x813b('0x1'));var BPromise=require('bluebird');var rs=require(_0x813b('0x2'));var fs=require('fs');var Redis=require(_0x813b('0x3'));var db=require(_0x813b('0x4'))['db'];var utils=require(_0x813b('0x5'));var logger=require(_0x813b('0x6'))(_0x813b('0x7'));var config=require('../../config/environment');var jayson=require(_0x813b('0x8'));var client=jayson[_0x813b('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5b798b,_0x3040d6,_0x54f3d7){return new BPromise(function(_0x1706c8,_0x33eb57){return client[_0x813b('0xa')](_0x5b798b,_0x54f3d7)[_0x813b('0xb')](function(_0x619bc8){logger[_0x813b('0xc')]('ChatApplication,\x20%s,\x20%s',_0x3040d6,'request\x20sent');logger[_0x813b('0xd')](_0x813b('0xe'),_0x3040d6,_0x813b('0xf'),JSON['stringify'](_0x619bc8));if(_0x619bc8[_0x813b('0x10')]){if(_0x619bc8[_0x813b('0x10')][_0x813b('0x11')]===0x1f4){logger[_0x813b('0x10')](_0x813b('0x12'),_0x3040d6,_0x619bc8['error']['message']);return _0x33eb57(_0x619bc8[_0x813b('0x10')][_0x813b('0x13')]);}logger['error'](_0x813b('0x12'),_0x3040d6,_0x619bc8[_0x813b('0x10')][_0x813b('0x13')]);return _0x1706c8(_0x619bc8['error'][_0x813b('0x13')]);}else{logger[_0x813b('0xc')]('ChatApplication,\x20%s,\x20%s',_0x3040d6,_0x813b('0xf'));_0x1706c8(_0x619bc8[_0x813b('0x14')]['message']);}})[_0x813b('0x15')](function(_0x59726e){logger[_0x813b('0x10')](_0x813b('0x12'),_0x3040d6,_0x59726e);_0x33eb57(_0x59726e);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 49766da..6c7967f 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 _0x71be=['path','connect-timeout','Router','../../components/interaction/service','../../config/environment','get','/:id','show','put','isAuthenticated','update','delete','destroy','multer','util'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x71be,0x1b1));var _0xe71b=function(_0x24259d,_0x64a194){_0x24259d=_0x24259d-0x0;var _0x5a701=_0x71be[_0x24259d];return _0x5a701;};'use strict';var multer=require(_0xe71b('0x0'));var util=require(_0xe71b('0x1'));var path=require(_0xe71b('0x2'));var timeout=require(_0xe71b('0x3'));var express=require('express');var router=express[_0xe71b('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xe71b('0x5'));var config=require(_0xe71b('0x6'));var controller=require('./chatApplication.controller');router[_0xe71b('0x7')](_0xe71b('0x8'),auth['isAuthenticated'](),controller[_0xe71b('0x9')]);router[_0xe71b('0xa')](_0xe71b('0x8'),auth[_0xe71b('0xb')](),controller[_0xe71b('0xc')]);router[_0xe71b('0xd')](_0xe71b('0x8'),auth[_0xe71b('0xb')](),controller[_0xe71b('0xe')]);module['exports']=router; \ No newline at end of file +var _0xb27e=['express','Router','../../components/auth/service','../../components/interaction/service','./chatApplication.controller','get','isAuthenticated','show','put','/:id','destroy','exports','multer','util'];(function(_0x449a12,_0xe8bfb6){var _0x123296=function(_0x4f57aa){while(--_0x4f57aa){_0x449a12['push'](_0x449a12['shift']());}};_0x123296(++_0xe8bfb6);}(_0xb27e,0x8a));var _0xeb27=function(_0x815dce,_0x162eb8){_0x815dce=_0x815dce-0x0;var _0x517c1c=_0xb27e[_0x815dce];return _0x517c1c;};'use strict';var multer=require(_0xeb27('0x0'));var util=require(_0xeb27('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xeb27('0x2'));var router=express[_0xeb27('0x3')]();var auth=require(_0xeb27('0x4'));var interaction=require(_0xeb27('0x5'));var config=require('../../config/environment');var controller=require(_0xeb27('0x6'));router[_0xeb27('0x7')]('/:id',auth[_0xeb27('0x8')](),controller[_0xeb27('0x9')]);router[_0xeb27('0xa')](_0xeb27('0xb'),auth[_0xeb27('0x8')](),controller['update']);router['delete'](_0xeb27('0xb'),auth[_0xeb27('0x8')](),controller[_0xeb27('0xc')]);module[_0xeb27('0xd')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index fadb09b..91d7a60 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 _0x4ef5=['sequelize','STRING','BOOLEAN'];(function(_0x433a86,_0x175b5c){var _0x23000c=function(_0x4b1fa0){while(--_0x4b1fa0){_0x433a86['push'](_0x433a86['shift']());}};_0x23000c(++_0x175b5c);}(_0x4ef5,0x153));var _0x54ef=function(_0x99a019,_0x3bb6fa){_0x99a019=_0x99a019-0x0;var _0x197564=_0x4ef5[_0x99a019];return _0x197564;};'use strict';var Sequelize=require(_0x54ef('0x0'));module['exports']={'name':{'type':Sequelize[_0x54ef('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x54ef('0x1')]},'write':{'type':Sequelize[_0x54ef('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0x39ed=['sequelize','STRING','BOOLEAN'];(function(_0x44947b,_0x3fdd29){var _0x572e1a=function(_0x47632b){while(--_0x47632b){_0x44947b['push'](_0x44947b['shift']());}};_0x572e1a(++_0x3fdd29);}(_0x39ed,0x8d));var _0xd39e=function(_0x2890be,_0x5c0393){_0x2890be=_0x2890be-0x0;var _0xbcbffb=_0x39ed[_0x2890be];return _0xbcbffb;};'use strict';var Sequelize=require(_0xd39e('0x0'));module['exports']={'name':{'type':Sequelize[_0xd39e('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xd39e('0x1')]},'write':{'type':Sequelize[_0xd39e('0x2')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index 593454a..f70f9c4 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 _0xffe1=['findAll','rows','show','params','find','create','body','describe','getUnread','toInteger','addMembers','ids','omit','findOne','pick','getMembers','hasOwnProperty','nolimit','removeMembers','addMessage','ChatGroupId','ChatInternalMessage','$gte','format','YYYY-MM-DD\x20HH:mm:ss','getMessages','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','ChatGroup,\x20%s,\x20%s','ChatGroup,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','stack','name','index','map','ChatGroup','rawAttributes','fieldName','type','key','keys','filters','intersection','model','query','attributes','fields','length','order','sort','where','filter','merge','VIRTUAL','options','then','include'];(function(_0x57d13b,_0x52d8cb){var _0x467696=function(_0x153000){while(--_0x153000){_0x57d13b['push'](_0x57d13b['shift']());}};_0x467696(++_0x52d8cb);}(_0xffe1,0x1d2));var _0x1ffe=function(_0x34a7f2,_0x241d91){_0x34a7f2=_0x34a7f2-0x0;var _0x62e5b1=_0xffe1[_0x34a7f2];return _0x62e5b1;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x1ffe('0x0'));var rimraf=require(_0x1ffe('0x1'));var zipdir=require(_0x1ffe('0x2'));var jsonpatch=require(_0x1ffe('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x1ffe('0x4'));var util=require(_0x1ffe('0x5'));var path=require(_0x1ffe('0x6'));var sox=require(_0x1ffe('0x7'));var csv=require(_0x1ffe('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x1ffe('0x9'));var squel=require(_0x1ffe('0xa'));var crypto=require(_0x1ffe('0xb'));var jsforce=require(_0x1ffe('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x1ffe('0xd'));var Redis=require(_0x1ffe('0xe'));var authService=require(_0x1ffe('0xf'));var qs=require(_0x1ffe('0x10'));var as=require(_0x1ffe('0x11'));var hardwareService=require(_0x1ffe('0x12'));var logger=require(_0x1ffe('0x13'))(_0x1ffe('0x14'));var utils=require(_0x1ffe('0x15'));var config=require(_0x1ffe('0x16'));var db=require('../../mysqldb')['db'];config[_0x1ffe('0x17')]=_[_0x1ffe('0x18')](config[_0x1ffe('0x17')],{'host':_0x1ffe('0x19'),'port':0x18eb});var socket=require(_0x1ffe('0x1a'))(new Redis(config[_0x1ffe('0x17')]));require(_0x1ffe('0x1b'))['register'](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x1ffe('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x20221d,_0x5a62a,_0x2db73e){if(_0x2db73e){var _0x28a1ea=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x28a1ea[_0x1ffe('0x1d')](_0x5a62a)){return _0x20221d;}else{throw new db[(_0x1ffe('0x1e'))][(_0x1ffe('0x1f'))](_0x1ffe('0x20'));}}else{return _0x20221d;}}function respondWithRpcPromise(_0x49df46,_0x247f7c,_0x5982fe,_0x2ab9be){return new BPromise(function(_0x1d0a99,_0xe878f1){var _0x37c96e=_0x2ab9be||client;return _0x37c96e[_0x1ffe('0x21')](_0x49df46,_0x5982fe)['then'](function(_0xb2c0b1){logger['info'](_0x1ffe('0x22'),_0x247f7c,'request\x20sent');logger['debug'](_0x1ffe('0x23'),_0x247f7c,_0x1ffe('0x24'),JSON[_0x1ffe('0x25')](_0xb2c0b1));if(_0xb2c0b1['error']){if(_0xb2c0b1[_0x1ffe('0x26')][_0x1ffe('0x27')]===0x1f4){logger[_0x1ffe('0x26')](_0x1ffe('0x22'),_0x247f7c,_0xb2c0b1[_0x1ffe('0x26')][_0x1ffe('0x28')]);return _0xe878f1(_0xb2c0b1[_0x1ffe('0x26')][_0x1ffe('0x28')]);}logger[_0x1ffe('0x26')](_0x1ffe('0x22'),_0x247f7c,_0xb2c0b1[_0x1ffe('0x26')][_0x1ffe('0x28')]);return _0x1d0a99(_0xb2c0b1[_0x1ffe('0x26')]['message']);}else{logger[_0x1ffe('0x29')]('ChatGroup,\x20%s,\x20%s',_0x247f7c,_0x1ffe('0x24'));_0x1d0a99(_0xb2c0b1[_0x1ffe('0x2a')][_0x1ffe('0x28')]);}})[_0x1ffe('0x2b')](function(_0x422add){logger['error']('ChatGroup,\x20%s,\x20%s',_0x247f7c,_0x422add);_0xe878f1(_0x422add);});});}function respondWithStatusCode(_0x57c302,_0x430888){_0x430888=_0x430888||0xcc;return function(_0x2ae488){if(_0x2ae488){return _0x57c302[_0x1ffe('0x2c')](_0x430888);}return _0x57c302[_0x1ffe('0x2d')](_0x430888)[_0x1ffe('0x2e')]();};}function respondWithResult(_0x500fbc,_0x2468d4){_0x2468d4=_0x2468d4||0xc8;return function(_0x145393){if(_0x145393){return _0x500fbc[_0x1ffe('0x2d')](_0x2468d4)[_0x1ffe('0x2f')](_0x145393);}};}function respondWithFilteredResult(_0x5a9d0e,_0x33da1d){return function(_0x197d56){if(_0x197d56){var _0x13437a=_0x197d56[_0x1ffe('0x30')],_0x335846=_0x33da1d[_0x1ffe('0x31')],_0x67bc77=_0x33da1d['offset']+_0x33da1d[_0x1ffe('0x32')],_0x5e278e;if(_0x67bc77>=_0x13437a){_0x67bc77=_0x13437a;_0x5e278e=0xc8;}else{_0x5e278e=0xce;}_0x5a9d0e[_0x1ffe('0x2d')](_0x5e278e);return _0x5a9d0e[_0x1ffe('0x33')](_0x1ffe('0x34'),_0x335846+'-'+_0x67bc77+'/'+_0x13437a)[_0x1ffe('0x2f')](_0x197d56);}return null;};}function patchUpdates(_0x369579){return function(_0x5435c5){try{jsonpatch[_0x1ffe('0x35')](_0x5435c5,_0x369579,!![]);}catch(_0x57d87e){return BPromise[_0x1ffe('0x36')](_0x57d87e);}return _0x5435c5[_0x1ffe('0x37')]();};}function saveUpdates(_0x2d1246,_0x40c89b){return function(_0x2aa087){if(_0x2aa087){return _0x2aa087[_0x1ffe('0x38')](_0x2d1246)['then'](function(_0x5f1a9b){return _0x5f1a9b;});}return null;};}function removeEntity(_0x1bddd7,_0x335335){return function(_0x44d3b0){if(_0x44d3b0){return _0x44d3b0[_0x1ffe('0x39')]()['then'](function(){_0x1bddd7[_0x1ffe('0x2d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e76c9,_0x31c435){return function(_0xfde619){if(!_0xfde619){_0x5e76c9[_0x1ffe('0x2c')](0x194);}return _0xfde619;};}function handleError(_0x1df086,_0x7b5dd){_0x7b5dd=_0x7b5dd||0x1f4;return function(_0x5ca66d){logger['error'](_0x5ca66d[_0x1ffe('0x3a')]);if(_0x5ca66d[_0x1ffe('0x3b')]){delete _0x5ca66d['name'];}_0x1df086[_0x1ffe('0x2d')](_0x7b5dd)['send'](_0x5ca66d);};}exports[_0x1ffe('0x3c')]=function(_0x4bcafc,_0x2bc95d){var _0x598fff={},_0x2b8b43={},_0x1b2c5b={'count':0x0,'rows':[]};var _0x5b8345=_[_0x1ffe('0x3d')](db[_0x1ffe('0x3e')][_0x1ffe('0x3f')],function(_0x45af59){return{'name':_0x45af59[_0x1ffe('0x40')],'type':_0x45af59[_0x1ffe('0x41')][_0x1ffe('0x42')]};});_0x2b8b43['model']=_['map'](_0x5b8345,_0x1ffe('0x3b'));_0x2b8b43['query']=_[_0x1ffe('0x43')](_0x4bcafc['query']);_0x2b8b43[_0x1ffe('0x44')]=_[_0x1ffe('0x45')](_0x2b8b43[_0x1ffe('0x46')],_0x2b8b43[_0x1ffe('0x47')]);_0x598fff[_0x1ffe('0x48')]=_[_0x1ffe('0x45')](_0x2b8b43[_0x1ffe('0x46')],qs[_0x1ffe('0x49')](_0x4bcafc[_0x1ffe('0x47')][_0x1ffe('0x49')]));_0x598fff[_0x1ffe('0x48')]=_0x598fff[_0x1ffe('0x48')][_0x1ffe('0x4a')]?_0x598fff[_0x1ffe('0x48')]:_0x2b8b43[_0x1ffe('0x46')];if(!_0x4bcafc[_0x1ffe('0x47')]['hasOwnProperty']('nolimit')){_0x598fff[_0x1ffe('0x32')]=qs[_0x1ffe('0x32')](_0x4bcafc[_0x1ffe('0x47')][_0x1ffe('0x32')]);_0x598fff[_0x1ffe('0x31')]=qs['offset'](_0x4bcafc[_0x1ffe('0x47')][_0x1ffe('0x31')]);}_0x598fff[_0x1ffe('0x4b')]=qs[_0x1ffe('0x4c')](_0x4bcafc[_0x1ffe('0x47')][_0x1ffe('0x4c')]);_0x598fff[_0x1ffe('0x4d')]=qs[_0x1ffe('0x44')](_['pick'](_0x4bcafc['query'],_0x2b8b43['filters']));if(_0x4bcafc[_0x1ffe('0x47')][_0x1ffe('0x4e')]){_0x598fff[_0x1ffe('0x4d')]=_[_0x1ffe('0x4f')](_0x598fff[_0x1ffe('0x4d')],{'$or':_['map'](_0x5b8345,function(_0x230bc9){if(_0x230bc9[_0x1ffe('0x41')]!==_0x1ffe('0x50')){var _0x49b102={};_0x49b102[_0x230bc9['name']]={'$like':'%'+_0x4bcafc['query']['filter']+'%'};return _0x49b102;}})});}_0x598fff=_[_0x1ffe('0x4f')]({},_0x598fff,_0x4bcafc[_0x1ffe('0x51')]);var _0x5d3b87={'where':_0x598fff[_0x1ffe('0x4d')]};return db[_0x1ffe('0x3e')][_0x1ffe('0x30')](_0x5d3b87)[_0x1ffe('0x52')](function(_0x53c920){_0x1b2c5b[_0x1ffe('0x30')]=_0x53c920;if(_0x4bcafc[_0x1ffe('0x47')]['includeAll']){_0x598fff[_0x1ffe('0x53')]=[{'all':!![]}];}return db[_0x1ffe('0x3e')][_0x1ffe('0x54')](_0x598fff);})[_0x1ffe('0x52')](function(_0x5ba1f4){_0x1b2c5b[_0x1ffe('0x55')]=_0x5ba1f4;return _0x1b2c5b;})['then'](respondWithFilteredResult(_0x2bc95d,_0x598fff))[_0x1ffe('0x2b')](handleError(_0x2bc95d,null));};exports[_0x1ffe('0x56')]=function(_0x36f0d3,_0x428856){var _0x4b0a53={'raw':!![],'where':{'id':_0x36f0d3[_0x1ffe('0x57')]['id']}},_0x4dbd1a={};_0x4dbd1a[_0x1ffe('0x46')]=_[_0x1ffe('0x43')](db[_0x1ffe('0x3e')][_0x1ffe('0x3f')]);_0x4dbd1a[_0x1ffe('0x47')]=_[_0x1ffe('0x43')](_0x36f0d3['query']);_0x4dbd1a['filters']=_[_0x1ffe('0x45')](_0x4dbd1a[_0x1ffe('0x46')],_0x4dbd1a[_0x1ffe('0x47')]);_0x4b0a53[_0x1ffe('0x48')]=_[_0x1ffe('0x45')](_0x4dbd1a[_0x1ffe('0x46')],qs[_0x1ffe('0x49')](_0x36f0d3['query'][_0x1ffe('0x49')]));_0x4b0a53[_0x1ffe('0x48')]=_0x4b0a53['attributes'][_0x1ffe('0x4a')]?_0x4b0a53[_0x1ffe('0x48')]:_0x4dbd1a[_0x1ffe('0x46')];if(_0x36f0d3[_0x1ffe('0x47')]['includeAll']){_0x4b0a53[_0x1ffe('0x53')]=[{'all':!![]}];}_0x4b0a53=_['merge']({},_0x4b0a53,_0x36f0d3['options']);return db[_0x1ffe('0x3e')][_0x1ffe('0x58')](_0x4b0a53)['then'](handleEntityNotFound(_0x428856,null))[_0x1ffe('0x52')](respondWithResult(_0x428856,null))[_0x1ffe('0x2b')](handleError(_0x428856,null));};exports[_0x1ffe('0x59')]=function(_0x5f4de4,_0x23f481){return db[_0x1ffe('0x3e')][_0x1ffe('0x59')](_0x5f4de4['body'],{})[_0x1ffe('0x52')](respondWithResult(_0x23f481,0xc9))['catch'](handleError(_0x23f481,null));};exports[_0x1ffe('0x38')]=function(_0x18351c,_0x461746){if(_0x18351c[_0x1ffe('0x5a')]['id']){delete _0x18351c[_0x1ffe('0x5a')]['id'];}return db[_0x1ffe('0x3e')][_0x1ffe('0x58')]({'where':{'id':_0x18351c[_0x1ffe('0x57')]['id']}})[_0x1ffe('0x52')](handleEntityNotFound(_0x461746,null))[_0x1ffe('0x52')](saveUpdates(_0x18351c[_0x1ffe('0x5a')],null))['then'](respondWithResult(_0x461746,null))['catch'](handleError(_0x461746,null));};exports[_0x1ffe('0x39')]=function(_0x2c6f25,_0x57c96f){return db['ChatGroup'][_0x1ffe('0x58')]({'where':{'id':_0x2c6f25['params']['id']}})['then'](handleEntityNotFound(_0x57c96f,null))[_0x1ffe('0x52')](removeEntity(_0x57c96f,null))[_0x1ffe('0x2b')](handleError(_0x57c96f,null));};exports[_0x1ffe('0x5b')]=function(_0x154970,_0x3e2aea){return db[_0x1ffe('0x3e')]['describe']()[_0x1ffe('0x52')](respondWithResult(_0x3e2aea,null))[_0x1ffe('0x2b')](handleError(_0x3e2aea,null));};exports[_0x1ffe('0x5c')]=function(_0x5d1b11,_0xec389c,_0x1db611){return db['ChatInternalMessage'][_0x1ffe('0x30')]({'where':{'ChatGroupId':_0x5d1b11['params']['id'],'ToId':_0x5d1b11['user']['id'],'read':![]}})[_0x1ffe('0x52')](function(_0x5b66bc){return{'id':_[_0x1ffe('0x5d')](_0x5d1b11[_0x1ffe('0x57')]['id']),'count':_0x5b66bc};})[_0x1ffe('0x52')](respondWithResult(_0xec389c,null))[_0x1ffe('0x2b')](handleError(_0xec389c,null));};exports[_0x1ffe('0x5e')]=function(_0x109bce,_0x35715e,_0x570c04){return db[_0x1ffe('0x3e')]['find']({'where':{'id':_0x109bce[_0x1ffe('0x57')]['id']}})[_0x1ffe('0x52')](handleEntityNotFound(_0x35715e,null))[_0x1ffe('0x52')](function(_0x7e8bd5){if(_0x7e8bd5){return _0x7e8bd5[_0x1ffe('0x5e')](_0x109bce[_0x1ffe('0x5a')][_0x1ffe('0x5f')],_[_0x1ffe('0x60')](_0x109bce[_0x1ffe('0x5a')],[_0x1ffe('0x5f'),'id'])||{});}})[_0x1ffe('0x52')](respondWithResult(_0x35715e,null))[_0x1ffe('0x2b')](handleError(_0x35715e,null));};exports['getMembers']=function(_0x1ea0af,_0x59919d,_0x920253){var _0x3c5d42={};var _0x5b8e4d={};var _0x5df296;var _0x225405;return db[_0x1ffe('0x3e')][_0x1ffe('0x61')]({'where':{'id':_0x1ea0af['params']['id']}})[_0x1ffe('0x52')](handleEntityNotFound(_0x59919d,null))[_0x1ffe('0x52')](function(_0x5b521a){if(_0x5b521a){_0x5df296=_0x5b521a;_0x5b8e4d[_0x1ffe('0x46')]=_[_0x1ffe('0x43')](db['User']['rawAttributes']);_0x5b8e4d[_0x1ffe('0x47')]=_[_0x1ffe('0x43')](_0x1ea0af[_0x1ffe('0x47')]);_0x5b8e4d[_0x1ffe('0x44')]=_[_0x1ffe('0x45')](_0x5b8e4d[_0x1ffe('0x46')],_0x5b8e4d[_0x1ffe('0x47')]);_0x3c5d42[_0x1ffe('0x48')]=_['intersection'](_0x5b8e4d['model'],qs[_0x1ffe('0x49')](_0x1ea0af[_0x1ffe('0x47')][_0x1ffe('0x49')]));_0x3c5d42[_0x1ffe('0x48')]=_0x3c5d42[_0x1ffe('0x48')]['length']?_0x3c5d42['attributes']:_0x5b8e4d[_0x1ffe('0x46')];_0x3c5d42[_0x1ffe('0x4b')]=qs[_0x1ffe('0x4c')](_0x1ea0af[_0x1ffe('0x47')]['sort']);_0x3c5d42[_0x1ffe('0x4d')]=qs[_0x1ffe('0x44')](_[_0x1ffe('0x62')](_0x1ea0af[_0x1ffe('0x47')],_0x5b8e4d[_0x1ffe('0x44')]));if(_0x1ea0af[_0x1ffe('0x47')][_0x1ffe('0x4e')]){_0x3c5d42[_0x1ffe('0x4d')]=_['merge'](_0x3c5d42[_0x1ffe('0x4d')],{'$or':_[_0x1ffe('0x3d')](_0x3c5d42[_0x1ffe('0x48')],function(_0x32f025){var _0x2a5e54={};_0x2a5e54[_0x32f025]={'$like':'%'+_0x1ea0af[_0x1ffe('0x47')]['filter']+'%'};return _0x2a5e54;})});}_0x3c5d42=_[_0x1ffe('0x4f')]({},_0x3c5d42,_0x1ea0af[_0x1ffe('0x51')]);return _0x5df296[_0x1ffe('0x63')](_0x3c5d42);}})[_0x1ffe('0x52')](function(_0x317b2e){if(_0x317b2e){_0x225405=_0x317b2e['length'];if(!_0x1ea0af[_0x1ffe('0x47')][_0x1ffe('0x64')](_0x1ffe('0x65'))){_0x3c5d42['limit']=qs['limit'](_0x1ea0af[_0x1ffe('0x47')][_0x1ffe('0x32')]);_0x3c5d42[_0x1ffe('0x31')]=qs[_0x1ffe('0x31')](_0x1ea0af[_0x1ffe('0x47')][_0x1ffe('0x31')]);}return _0x5df296[_0x1ffe('0x63')](_0x3c5d42);}})['then'](function(_0x5a4181){if(_0x5a4181){return _0x5a4181?{'count':_0x225405,'rows':_0x5a4181}:null;}})[_0x1ffe('0x52')](respondWithResult(_0x59919d,null))[_0x1ffe('0x2b')](handleError(_0x59919d,null));};exports[_0x1ffe('0x66')]=function(_0x3dfe1a,_0x256e58,_0x24f7fb){return db['ChatGroup'][_0x1ffe('0x58')]({'where':{'id':_0x3dfe1a[_0x1ffe('0x57')]['id']}})[_0x1ffe('0x52')](handleEntityNotFound(_0x256e58,null))[_0x1ffe('0x52')](function(_0x290c0b){if(_0x290c0b){return _0x290c0b[_0x1ffe('0x66')](_0x3dfe1a[_0x1ffe('0x47')][_0x1ffe('0x5f')]);}})[_0x1ffe('0x52')](respondWithStatusCode(_0x256e58,null))[_0x1ffe('0x2b')](handleError(_0x256e58,null));};exports[_0x1ffe('0x67')]=function(_0x2b50cc,_0x1bd923,_0x5ede3f){if(_0x2b50cc[_0x1ffe('0x5a')]['id']){delete _0x2b50cc[_0x1ffe('0x5a')]['id'];}return db[_0x1ffe('0x3e')][_0x1ffe('0x58')]({'where':{'id':_0x2b50cc[_0x1ffe('0x57')]['id']}})[_0x1ffe('0x52')](handleEntityNotFound(_0x1bd923,null))[_0x1ffe('0x52')](function(_0x406183){if(_0x406183){_0x2b50cc[_0x1ffe('0x5a')][_0x1ffe('0x68')]=_0x406183['id'];return db['ChatInternalMessage']['create'](_0x2b50cc[_0x1ffe('0x5a')]);}})['then'](respondWithResult(_0x1bd923,null))[_0x1ffe('0x2b')](handleError(_0x1bd923,null));};exports['getMessages']=function(_0x439ff8,_0x30f2b1,_0x2e269a){var _0x31b1d6={};var _0x127cc3={};var _0xea93e6;var _0x3e233c;return db[_0x1ffe('0x3e')][_0x1ffe('0x61')]({'where':{'id':_0x439ff8[_0x1ffe('0x57')]['id']}})[_0x1ffe('0x52')](handleEntityNotFound(_0x30f2b1,null))[_0x1ffe('0x52')](function(_0x2c7e51){if(_0x2c7e51){_0xea93e6=_0x2c7e51;_0x127cc3[_0x1ffe('0x46')]=_[_0x1ffe('0x43')](db[_0x1ffe('0x69')]['rawAttributes']);_0x127cc3[_0x1ffe('0x47')]=_['keys'](_0x439ff8[_0x1ffe('0x47')]);_0x127cc3[_0x1ffe('0x44')]=_[_0x1ffe('0x45')](_0x127cc3[_0x1ffe('0x46')],_0x127cc3[_0x1ffe('0x47')]);_0x31b1d6[_0x1ffe('0x48')]=_[_0x1ffe('0x45')](_0x127cc3['model'],qs[_0x1ffe('0x49')](_0x439ff8[_0x1ffe('0x47')][_0x1ffe('0x49')]));_0x31b1d6[_0x1ffe('0x48')]=_0x31b1d6[_0x1ffe('0x48')][_0x1ffe('0x4a')]?_0x31b1d6[_0x1ffe('0x48')]:_0x127cc3['model'];_0x31b1d6[_0x1ffe('0x4b')]=qs[_0x1ffe('0x4c')](_0x439ff8[_0x1ffe('0x47')][_0x1ffe('0x4c')]);_0x31b1d6[_0x1ffe('0x4d')]=qs[_0x1ffe('0x44')](_['pick'](_0x439ff8['query'],_0x127cc3['filters']));if(_0x439ff8['query'][_0x1ffe('0x4e')]){_0x31b1d6[_0x1ffe('0x4d')]=_[_0x1ffe('0x4f')](_0x31b1d6[_0x1ffe('0x4d')],{'$or':_['map'](_0x31b1d6[_0x1ffe('0x48')],function(_0x2d96f9){var _0x2a484f={};_0x2a484f[_0x2d96f9]={'$like':'%'+_0x439ff8[_0x1ffe('0x47')][_0x1ffe('0x4e')]+'%'};return _0x2a484f;})});}if(_0x439ff8['query'][_0x1ffe('0x6a')]){var _0x3b5967=_0x439ff8[_0x1ffe('0x47')]['$gte']['split'](',');var _0x22e1f4={};_0x22e1f4[_0x3b5967[0x0]]={'$gte':moment(_0x3b5967[0x1])[_0x1ffe('0x6b')](_0x1ffe('0x6c'))};_0x31b1d6[_0x1ffe('0x4d')]=_['merge'](_0x31b1d6[_0x1ffe('0x4d')],_0x22e1f4);}_0x31b1d6=_[_0x1ffe('0x4f')]({},_0x31b1d6,_0x439ff8[_0x1ffe('0x51')]);return _0xea93e6[_0x1ffe('0x6d')](_0x31b1d6);}})['then'](function(_0x22a07c){if(_0x22a07c){_0x3e233c=_0x22a07c['length'];if(!_0x439ff8['query'][_0x1ffe('0x64')](_0x1ffe('0x65'))){_0x31b1d6['limit']=qs['limit'](_0x439ff8[_0x1ffe('0x47')][_0x1ffe('0x32')]);_0x31b1d6[_0x1ffe('0x31')]=qs[_0x1ffe('0x31')](_0x439ff8[_0x1ffe('0x47')][_0x1ffe('0x31')]);}return _0xea93e6[_0x1ffe('0x6d')](_0x31b1d6);}})['then'](function(_0x26af72){if(_0x26af72){return _0x26af72?{'count':_0x3e233c,'rows':_0x26af72}:null;}})['then'](respondWithResult(_0x30f2b1,null))['catch'](handleError(_0x30f2b1,null));}; \ No newline at end of file +var _0x512f=['findAll','rows','show','params','keys','length','include','merge','create','body','find','ChatInternalMessage','toInteger','addMembers','ids','omit','getMembers','findOne','sort','removeMembers','getMessages','order','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','nolimit','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','register','jayson/promise','client','http','Sequelize','info','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','ChatGroup,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','count','offset','limit','apply','save','then','destroy','stack','name','send','index','rawAttributes','type','key','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','where','pick','filter','VIRTUAL','options','ChatGroup','includeAll'];(function(_0x1e3d0f,_0x91f49){var _0x482801=function(_0x556d7b){while(--_0x556d7b){_0x1e3d0f['push'](_0x1e3d0f['shift']());}};_0x482801(++_0x91f49);}(_0x512f,0x153));var _0xf512=function(_0x51ed62,_0x574379){_0x51ed62=_0x51ed62-0x0;var _0x34aee3=_0x512f[_0x51ed62];return _0x34aee3;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xf512('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf512('0x1'));var jsonpatch=require(_0xf512('0x2'));var rp=require(_0xf512('0x3'));var moment=require(_0xf512('0x4'));var BPromise=require(_0xf512('0x5'));var Mustache=require(_0xf512('0x6'));var util=require('util');var path=require(_0xf512('0x7'));var sox=require(_0xf512('0x8'));var csv=require(_0xf512('0x9'));var ejs=require(_0xf512('0xa'));var fs=require('fs');var _=require(_0xf512('0xb'));var squel=require(_0xf512('0xc'));var crypto=require('crypto');var jsforce=require(_0xf512('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xf512('0x9'));var querystring=require(_0xf512('0xe'));var Papa=require(_0xf512('0xf'));var Redis=require(_0xf512('0x10'));var authService=require(_0xf512('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xf512('0x12'));var hardwareService=require(_0xf512('0x13'));var logger=require(_0xf512('0x14'))(_0xf512('0x15'));var utils=require('../../config/utils');var config=require(_0xf512('0x16'));var db=require(_0xf512('0x17'))['db'];config[_0xf512('0x18')]=_[_0xf512('0x19')](config[_0xf512('0x18')],{'host':_0xf512('0x1a'),'port':0x18eb});var socket=require(_0xf512('0x1b'))(new Redis(config['redis']));require(_0xf512('0x1c'))[_0xf512('0x1d')](socket);var jayson=require(_0xf512('0x1e'));var client=jayson[_0xf512('0x1f')][_0xf512('0x20')]({'port':0x232a});function checkPasswordPattern(_0xce2403,_0x851e9e,_0xddad4e){if(_0xddad4e){var _0x128299=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x128299['test'](_0x851e9e)){return _0xce2403;}else{throw new db[(_0xf512('0x21'))]['ValidationError']('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0xce2403;}}function respondWithRpcPromise(_0x2ab29b,_0x9777c3,_0x5c58cc,_0x118c70){return new BPromise(function(_0x2edb81,_0x1a943c){var _0xb88e9b=_0x118c70||client;return _0xb88e9b['request'](_0x2ab29b,_0x5c58cc)['then'](function(_0x460fba){logger[_0xf512('0x22')]('ChatGroup,\x20%s,\x20%s',_0x9777c3,_0xf512('0x23'));logger[_0xf512('0x24')](_0xf512('0x25'),_0x9777c3,_0xf512('0x23'),JSON[_0xf512('0x26')](_0x460fba));if(_0x460fba[_0xf512('0x27')]){if(_0x460fba[_0xf512('0x27')]['code']===0x1f4){logger['error'](_0xf512('0x28'),_0x9777c3,_0x460fba[_0xf512('0x27')][_0xf512('0x29')]);return _0x1a943c(_0x460fba[_0xf512('0x27')]['message']);}logger['error']('ChatGroup,\x20%s,\x20%s',_0x9777c3,_0x460fba[_0xf512('0x27')]['message']);return _0x2edb81(_0x460fba[_0xf512('0x27')][_0xf512('0x29')]);}else{logger[_0xf512('0x22')](_0xf512('0x28'),_0x9777c3,_0xf512('0x23'));_0x2edb81(_0x460fba[_0xf512('0x2a')][_0xf512('0x29')]);}})[_0xf512('0x2b')](function(_0x17790a){logger[_0xf512('0x27')](_0xf512('0x28'),_0x9777c3,_0x17790a);_0x1a943c(_0x17790a);});});}function respondWithStatusCode(_0x4b6712,_0x22a37b){_0x22a37b=_0x22a37b||0xcc;return function(_0x3ed84e){if(_0x3ed84e){return _0x4b6712[_0xf512('0x2c')](_0x22a37b);}return _0x4b6712[_0xf512('0x2d')](_0x22a37b)[_0xf512('0x2e')]();};}function respondWithResult(_0x10226b,_0x3a4800){_0x3a4800=_0x3a4800||0xc8;return function(_0x33c255){if(_0x33c255){return _0x10226b[_0xf512('0x2d')](_0x3a4800)[_0xf512('0x2f')](_0x33c255);}};}function respondWithFilteredResult(_0x291ecf,_0x5dbba7){return function(_0x549cbd){if(_0x549cbd){var _0x5d1d1e=_0x549cbd[_0xf512('0x30')],_0x1b41c5=_0x5dbba7[_0xf512('0x31')],_0x379f58=_0x5dbba7[_0xf512('0x31')]+_0x5dbba7[_0xf512('0x32')],_0x4a29dc;if(_0x379f58>=_0x5d1d1e){_0x379f58=_0x5d1d1e;_0x4a29dc=0xc8;}else{_0x4a29dc=0xce;}_0x291ecf[_0xf512('0x2d')](_0x4a29dc);return _0x291ecf['set']('Content-Range',_0x1b41c5+'-'+_0x379f58+'/'+_0x5d1d1e)[_0xf512('0x2f')](_0x549cbd);}return null;};}function patchUpdates(_0x3b8b3b){return function(_0x2081d6){try{jsonpatch[_0xf512('0x33')](_0x2081d6,_0x3b8b3b,!![]);}catch(_0x13b762){return BPromise['reject'](_0x13b762);}return _0x2081d6[_0xf512('0x34')]();};}function saveUpdates(_0x414438,_0x1ffffe){return function(_0x4bd81b){if(_0x4bd81b){return _0x4bd81b['update'](_0x414438)[_0xf512('0x35')](function(_0x505b45){return _0x505b45;});}return null;};}function removeEntity(_0x34929f,_0x170f1d){return function(_0xb1d156){if(_0xb1d156){return _0xb1d156[_0xf512('0x36')]()[_0xf512('0x35')](function(){_0x34929f[_0xf512('0x2d')](0xcc)[_0xf512('0x2e')]();});}};}function handleEntityNotFound(_0x3c3864,_0x5418de){return function(_0x24dbfe){if(!_0x24dbfe){_0x3c3864['sendStatus'](0x194);}return _0x24dbfe;};}function handleError(_0x256c8b,_0x4582d3){_0x4582d3=_0x4582d3||0x1f4;return function(_0x11407f){logger[_0xf512('0x27')](_0x11407f[_0xf512('0x37')]);if(_0x11407f[_0xf512('0x38')]){delete _0x11407f[_0xf512('0x38')];}_0x256c8b[_0xf512('0x2d')](_0x4582d3)[_0xf512('0x39')](_0x11407f);};}exports[_0xf512('0x3a')]=function(_0x3d387d,_0x3244ce){var _0x22eaf3={},_0x301cd0={},_0x425492={'count':0x0,'rows':[]};var _0x42679b=_['map'](db['ChatGroup'][_0xf512('0x3b')],function(_0x1519de){return{'name':_0x1519de['fieldName'],'type':_0x1519de[_0xf512('0x3c')][_0xf512('0x3d')]};});_0x301cd0[_0xf512('0x3e')]=_[_0xf512('0x3f')](_0x42679b,_0xf512('0x38'));_0x301cd0[_0xf512('0x40')]=_['keys'](_0x3d387d[_0xf512('0x40')]);_0x301cd0[_0xf512('0x41')]=_[_0xf512('0x42')](_0x301cd0[_0xf512('0x3e')],_0x301cd0[_0xf512('0x40')]);_0x22eaf3[_0xf512('0x43')]=_[_0xf512('0x42')](_0x301cd0['model'],qs[_0xf512('0x44')](_0x3d387d[_0xf512('0x40')][_0xf512('0x44')]));_0x22eaf3[_0xf512('0x43')]=_0x22eaf3[_0xf512('0x43')]['length']?_0x22eaf3[_0xf512('0x43')]:_0x301cd0[_0xf512('0x3e')];if(!_0x3d387d[_0xf512('0x40')][_0xf512('0x45')]('nolimit')){_0x22eaf3[_0xf512('0x32')]=qs['limit'](_0x3d387d[_0xf512('0x40')]['limit']);_0x22eaf3[_0xf512('0x31')]=qs[_0xf512('0x31')](_0x3d387d[_0xf512('0x40')][_0xf512('0x31')]);}_0x22eaf3['order']=qs['sort'](_0x3d387d[_0xf512('0x40')]['sort']);_0x22eaf3[_0xf512('0x46')]=qs[_0xf512('0x41')](_[_0xf512('0x47')](_0x3d387d[_0xf512('0x40')],_0x301cd0[_0xf512('0x41')]));if(_0x3d387d[_0xf512('0x40')][_0xf512('0x48')]){_0x22eaf3[_0xf512('0x46')]=_['merge'](_0x22eaf3[_0xf512('0x46')],{'$or':_[_0xf512('0x3f')](_0x42679b,function(_0x4f75e0){if(_0x4f75e0[_0xf512('0x3c')]!==_0xf512('0x49')){var _0x383dec={};_0x383dec[_0x4f75e0[_0xf512('0x38')]]={'$like':'%'+_0x3d387d[_0xf512('0x40')][_0xf512('0x48')]+'%'};return _0x383dec;}})});}_0x22eaf3=_['merge']({},_0x22eaf3,_0x3d387d[_0xf512('0x4a')]);var _0x53677f={'where':_0x22eaf3[_0xf512('0x46')]};return db[_0xf512('0x4b')]['count'](_0x53677f)[_0xf512('0x35')](function(_0x23c3e1){_0x425492['count']=_0x23c3e1;if(_0x3d387d[_0xf512('0x40')][_0xf512('0x4c')]){_0x22eaf3['include']=[{'all':!![]}];}return db[_0xf512('0x4b')][_0xf512('0x4d')](_0x22eaf3);})[_0xf512('0x35')](function(_0x192608){_0x425492[_0xf512('0x4e')]=_0x192608;return _0x425492;})[_0xf512('0x35')](respondWithFilteredResult(_0x3244ce,_0x22eaf3))['catch'](handleError(_0x3244ce,null));};exports[_0xf512('0x4f')]=function(_0x498889,_0x249788){var _0x53ab14={'raw':!![],'where':{'id':_0x498889[_0xf512('0x50')]['id']}},_0x350be7={};_0x350be7[_0xf512('0x3e')]=_[_0xf512('0x51')](db[_0xf512('0x4b')][_0xf512('0x3b')]);_0x350be7['query']=_[_0xf512('0x51')](_0x498889['query']);_0x350be7[_0xf512('0x41')]=_[_0xf512('0x42')](_0x350be7[_0xf512('0x3e')],_0x350be7['query']);_0x53ab14[_0xf512('0x43')]=_[_0xf512('0x42')](_0x350be7[_0xf512('0x3e')],qs[_0xf512('0x44')](_0x498889[_0xf512('0x40')]['fields']));_0x53ab14[_0xf512('0x43')]=_0x53ab14[_0xf512('0x43')][_0xf512('0x52')]?_0x53ab14[_0xf512('0x43')]:_0x350be7[_0xf512('0x3e')];if(_0x498889[_0xf512('0x40')]['includeAll']){_0x53ab14[_0xf512('0x53')]=[{'all':!![]}];}_0x53ab14=_[_0xf512('0x54')]({},_0x53ab14,_0x498889[_0xf512('0x4a')]);return db['ChatGroup']['find'](_0x53ab14)['then'](handleEntityNotFound(_0x249788,null))[_0xf512('0x35')](respondWithResult(_0x249788,null))['catch'](handleError(_0x249788,null));};exports[_0xf512('0x55')]=function(_0x22fb21,_0x1e0b91){return db[_0xf512('0x4b')]['create'](_0x22fb21[_0xf512('0x56')],{})[_0xf512('0x35')](respondWithResult(_0x1e0b91,0xc9))['catch'](handleError(_0x1e0b91,null));};exports['update']=function(_0x11fba7,_0x4e7dbc){if(_0x11fba7['body']['id']){delete _0x11fba7[_0xf512('0x56')]['id'];}return db[_0xf512('0x4b')]['find']({'where':{'id':_0x11fba7[_0xf512('0x50')]['id']}})[_0xf512('0x35')](handleEntityNotFound(_0x4e7dbc,null))['then'](saveUpdates(_0x11fba7[_0xf512('0x56')],null))['then'](respondWithResult(_0x4e7dbc,null))[_0xf512('0x2b')](handleError(_0x4e7dbc,null));};exports[_0xf512('0x36')]=function(_0x52f4da,_0x44c8a3){return db[_0xf512('0x4b')][_0xf512('0x57')]({'where':{'id':_0x52f4da['params']['id']}})[_0xf512('0x35')](handleEntityNotFound(_0x44c8a3,null))['then'](removeEntity(_0x44c8a3,null))[_0xf512('0x2b')](handleError(_0x44c8a3,null));};exports['describe']=function(_0x338893,_0x29c377){return db[_0xf512('0x4b')]['describe']()[_0xf512('0x35')](respondWithResult(_0x29c377,null))[_0xf512('0x2b')](handleError(_0x29c377,null));};exports['getUnread']=function(_0x1add85,_0x5b957b,_0x128ef8){return db[_0xf512('0x58')][_0xf512('0x30')]({'where':{'ChatGroupId':_0x1add85['params']['id'],'ToId':_0x1add85['user']['id'],'read':![]}})[_0xf512('0x35')](function(_0x227558){return{'id':_[_0xf512('0x59')](_0x1add85['params']['id']),'count':_0x227558};})[_0xf512('0x35')](respondWithResult(_0x5b957b,null))['catch'](handleError(_0x5b957b,null));};exports['addMembers']=function(_0x343108,_0x471ed9,_0x3dd16a){return db['ChatGroup'][_0xf512('0x57')]({'where':{'id':_0x343108[_0xf512('0x50')]['id']}})[_0xf512('0x35')](handleEntityNotFound(_0x471ed9,null))[_0xf512('0x35')](function(_0xd3428e){if(_0xd3428e){return _0xd3428e[_0xf512('0x5a')](_0x343108[_0xf512('0x56')][_0xf512('0x5b')],_[_0xf512('0x5c')](_0x343108[_0xf512('0x56')],[_0xf512('0x5b'),'id'])||{});}})['then'](respondWithResult(_0x471ed9,null))[_0xf512('0x2b')](handleError(_0x471ed9,null));};exports[_0xf512('0x5d')]=function(_0xcf83ce,_0x28ee54,_0x330803){var _0x4f1cbc={};var _0x56d810={};var _0x51392d;var _0x4d126e;return db[_0xf512('0x4b')][_0xf512('0x5e')]({'where':{'id':_0xcf83ce[_0xf512('0x50')]['id']}})[_0xf512('0x35')](handleEntityNotFound(_0x28ee54,null))['then'](function(_0x4edfce){if(_0x4edfce){_0x51392d=_0x4edfce;_0x56d810['model']=_[_0xf512('0x51')](db['User'][_0xf512('0x3b')]);_0x56d810[_0xf512('0x40')]=_[_0xf512('0x51')](_0xcf83ce[_0xf512('0x40')]);_0x56d810[_0xf512('0x41')]=_[_0xf512('0x42')](_0x56d810[_0xf512('0x3e')],_0x56d810[_0xf512('0x40')]);_0x4f1cbc[_0xf512('0x43')]=_['intersection'](_0x56d810[_0xf512('0x3e')],qs[_0xf512('0x44')](_0xcf83ce[_0xf512('0x40')][_0xf512('0x44')]));_0x4f1cbc[_0xf512('0x43')]=_0x4f1cbc[_0xf512('0x43')][_0xf512('0x52')]?_0x4f1cbc[_0xf512('0x43')]:_0x56d810['model'];_0x4f1cbc['order']=qs[_0xf512('0x5f')](_0xcf83ce['query'][_0xf512('0x5f')]);_0x4f1cbc[_0xf512('0x46')]=qs[_0xf512('0x41')](_[_0xf512('0x47')](_0xcf83ce['query'],_0x56d810[_0xf512('0x41')]));if(_0xcf83ce[_0xf512('0x40')][_0xf512('0x48')]){_0x4f1cbc[_0xf512('0x46')]=_[_0xf512('0x54')](_0x4f1cbc[_0xf512('0x46')],{'$or':_[_0xf512('0x3f')](_0x4f1cbc['attributes'],function(_0x24d4a6){var _0x382473={};_0x382473[_0x24d4a6]={'$like':'%'+_0xcf83ce['query'][_0xf512('0x48')]+'%'};return _0x382473;})});}_0x4f1cbc=_[_0xf512('0x54')]({},_0x4f1cbc,_0xcf83ce[_0xf512('0x4a')]);return _0x51392d[_0xf512('0x5d')](_0x4f1cbc);}})[_0xf512('0x35')](function(_0x188aae){if(_0x188aae){_0x4d126e=_0x188aae['length'];if(!_0xcf83ce[_0xf512('0x40')]['hasOwnProperty']('nolimit')){_0x4f1cbc[_0xf512('0x32')]=qs[_0xf512('0x32')](_0xcf83ce[_0xf512('0x40')][_0xf512('0x32')]);_0x4f1cbc['offset']=qs[_0xf512('0x31')](_0xcf83ce[_0xf512('0x40')][_0xf512('0x31')]);}return _0x51392d['getMembers'](_0x4f1cbc);}})['then'](function(_0x26d1f5){if(_0x26d1f5){return _0x26d1f5?{'count':_0x4d126e,'rows':_0x26d1f5}:null;}})['then'](respondWithResult(_0x28ee54,null))['catch'](handleError(_0x28ee54,null));};exports[_0xf512('0x60')]=function(_0x525669,_0xfc4db9,_0x4df839){return db[_0xf512('0x4b')]['find']({'where':{'id':_0x525669[_0xf512('0x50')]['id']}})[_0xf512('0x35')](handleEntityNotFound(_0xfc4db9,null))[_0xf512('0x35')](function(_0x6c5cbb){if(_0x6c5cbb){return _0x6c5cbb[_0xf512('0x60')](_0x525669[_0xf512('0x40')][_0xf512('0x5b')]);}})['then'](respondWithStatusCode(_0xfc4db9,null))['catch'](handleError(_0xfc4db9,null));};exports['addMessage']=function(_0x236280,_0x40511e,_0x2ed071){if(_0x236280['body']['id']){delete _0x236280[_0xf512('0x56')]['id'];}return db['ChatGroup'][_0xf512('0x57')]({'where':{'id':_0x236280[_0xf512('0x50')]['id']}})['then'](handleEntityNotFound(_0x40511e,null))['then'](function(_0x1e050f){if(_0x1e050f){_0x236280['body']['ChatGroupId']=_0x1e050f['id'];return db[_0xf512('0x58')]['create'](_0x236280[_0xf512('0x56')]);}})[_0xf512('0x35')](respondWithResult(_0x40511e,null))['catch'](handleError(_0x40511e,null));};exports[_0xf512('0x61')]=function(_0x521949,_0x4d5d3d,_0x4c44a8){var _0x23dcf4={};var _0x311eb2={};var _0x51b86f;var _0x26efc8;return db[_0xf512('0x4b')][_0xf512('0x5e')]({'where':{'id':_0x521949[_0xf512('0x50')]['id']}})[_0xf512('0x35')](handleEntityNotFound(_0x4d5d3d,null))[_0xf512('0x35')](function(_0x512205){if(_0x512205){_0x51b86f=_0x512205;_0x311eb2[_0xf512('0x3e')]=_[_0xf512('0x51')](db[_0xf512('0x58')][_0xf512('0x3b')]);_0x311eb2[_0xf512('0x40')]=_[_0xf512('0x51')](_0x521949['query']);_0x311eb2['filters']=_[_0xf512('0x42')](_0x311eb2[_0xf512('0x3e')],_0x311eb2['query']);_0x23dcf4[_0xf512('0x43')]=_[_0xf512('0x42')](_0x311eb2[_0xf512('0x3e')],qs['fields'](_0x521949[_0xf512('0x40')][_0xf512('0x44')]));_0x23dcf4[_0xf512('0x43')]=_0x23dcf4[_0xf512('0x43')][_0xf512('0x52')]?_0x23dcf4[_0xf512('0x43')]:_0x311eb2[_0xf512('0x3e')];_0x23dcf4[_0xf512('0x62')]=qs['sort'](_0x521949['query']['sort']);_0x23dcf4['where']=qs['filters'](_[_0xf512('0x47')](_0x521949[_0xf512('0x40')],_0x311eb2[_0xf512('0x41')]));if(_0x521949['query']['filter']){_0x23dcf4[_0xf512('0x46')]=_[_0xf512('0x54')](_0x23dcf4[_0xf512('0x46')],{'$or':_[_0xf512('0x3f')](_0x23dcf4['attributes'],function(_0xca19af){var _0x1c52fa={};_0x1c52fa[_0xca19af]={'$like':'%'+_0x521949[_0xf512('0x40')][_0xf512('0x48')]+'%'};return _0x1c52fa;})});}if(_0x521949[_0xf512('0x40')][_0xf512('0x63')]){var _0x15e852=_0x521949[_0xf512('0x40')][_0xf512('0x63')][_0xf512('0x64')](',');var _0xead51c={};_0xead51c[_0x15e852[0x0]]={'$gte':moment(_0x15e852[0x1])[_0xf512('0x65')](_0xf512('0x66'))};_0x23dcf4[_0xf512('0x46')]=_[_0xf512('0x54')](_0x23dcf4['where'],_0xead51c);}_0x23dcf4=_[_0xf512('0x54')]({},_0x23dcf4,_0x521949[_0xf512('0x4a')]);return _0x51b86f['getMessages'](_0x23dcf4);}})[_0xf512('0x35')](function(_0x213415){if(_0x213415){_0x26efc8=_0x213415[_0xf512('0x52')];if(!_0x521949['query'][_0xf512('0x45')](_0xf512('0x67'))){_0x23dcf4[_0xf512('0x32')]=qs[_0xf512('0x32')](_0x521949[_0xf512('0x40')][_0xf512('0x32')]);_0x23dcf4['offset']=qs[_0xf512('0x31')](_0x521949[_0xf512('0x40')][_0xf512('0x31')]);}return _0x51b86f[_0xf512('0x61')](_0x23dcf4);}})['then'](function(_0x2614a2){if(_0x2614a2){return _0x2614a2?{'count':_0x26efc8,'rows':_0x2614a2}:null;}})['then'](respondWithResult(_0x4d5d3d,null))[_0xf512('0x2b')](handleError(_0x4d5d3d,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index 3feb4c0..923356a 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 _0x2ef3=['setMaxListeners','save','update','emit','hook','exports','events','../../mysqldb','ChatGroup'];(function(_0x23c2c3,_0x27ecc8){var _0x41e09f=function(_0x5e6873){while(--_0x5e6873){_0x23c2c3['push'](_0x23c2c3['shift']());}};_0x41e09f(++_0x27ecc8);}(_0x2ef3,0xba));var _0x32ef=function(_0x5ab036,_0x1a39ce){_0x5ab036=_0x5ab036-0x0;var _0x52555c=_0x2ef3[_0x5ab036];return _0x52555c;};'use strict';var EventEmitter=require(_0x32ef('0x0'));var ChatGroup=require(_0x32ef('0x1'))['db'][_0x32ef('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x32ef('0x3')](0x0);var events={'afterCreate':_0x32ef('0x4'),'afterUpdate':_0x32ef('0x5'),'afterDestroy':'remove'};function emitEvent(_0x38f865){return function(_0x38b7f3,_0x524ab6,_0x402857){ChatGroupEvents[_0x32ef('0x6')](_0x38f865+':'+_0x38b7f3['id'],_0x38b7f3);ChatGroupEvents['emit'](_0x38f865,_0x38b7f3);_0x402857(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatGroup[_0x32ef('0x7')](e,emitEvent(event));}}module[_0x32ef('0x8')]=ChatGroupEvents; \ No newline at end of file +var _0x2ef3=['setMaxListeners','save','update','emit','hook','exports','events','../../mysqldb','ChatGroup'];(function(_0x115b95,_0xa1f8b9){var _0x460b3d=function(_0x510c02){while(--_0x510c02){_0x115b95['push'](_0x115b95['shift']());}};_0x460b3d(++_0xa1f8b9);}(_0x2ef3,0xba));var _0x32ef=function(_0x26036e,_0x24de36){_0x26036e=_0x26036e-0x0;var _0x39be9=_0x2ef3[_0x26036e];return _0x39be9;};'use strict';var EventEmitter=require(_0x32ef('0x0'));var ChatGroup=require(_0x32ef('0x1'))['db'][_0x32ef('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x32ef('0x3')](0x0);var events={'afterCreate':_0x32ef('0x4'),'afterUpdate':_0x32ef('0x5'),'afterDestroy':'remove'};function emitEvent(_0x38f865){return function(_0x38b7f3,_0x524ab6,_0x402857){ChatGroupEvents[_0x32ef('0x6')](_0x38f865+':'+_0x38b7f3['id'],_0x38b7f3);ChatGroupEvents['emit'](_0x38f865,_0x38b7f3);_0x402857(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatGroup[_0x32ef('0x7')](e,emitEvent(event));}}module[_0x32ef('0x8')]=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index edf5638..ff756c1 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 _0xd1f9=['./chatGroup.attributes','define','ChatGroup','chat_groups','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd1f9,0x88));var _0x9d1f=function(_0x35825e,_0x657421){_0x35825e=_0x35825e-0x0;var _0x4f4d90=_0xd1f9[_0x35825e];return _0x4f4d90;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x9d1f('0x0'))(_0x9d1f('0x1'));var moment=require(_0x9d1f('0x2'));var BPromise=require(_0x9d1f('0x3'));var rp=require(_0x9d1f('0x4'));var fs=require('fs');var path=require(_0x9d1f('0x5'));var rimraf=require(_0x9d1f('0x6'));var config=require(_0x9d1f('0x7'));var attributes=require(_0x9d1f('0x8'));module['exports']=function(_0x3c4bad,_0x1a72d8){return _0x3c4bad[_0x9d1f('0x9')](_0x9d1f('0xa'),attributes,{'tableName':_0x9d1f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x86f4=['exports','define','ChatGroup','chat_groups','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x4413a1,_0x55a868){var _0x184cf3=function(_0x52db9b){while(--_0x52db9b){_0x4413a1['push'](_0x4413a1['shift']());}};_0x184cf3(++_0x55a868);}(_0x86f4,0x18a));var _0x486f=function(_0x3080c5,_0x118736){_0x3080c5=_0x3080c5-0x0;var _0x5f3318=_0x86f4[_0x3080c5];return _0x5f3318;};'use strict';var _=require(_0x486f('0x0'));var util=require(_0x486f('0x1'));var logger=require(_0x486f('0x2'))(_0x486f('0x3'));var moment=require(_0x486f('0x4'));var BPromise=require(_0x486f('0x5'));var rp=require(_0x486f('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x486f('0x7'));var config=require(_0x486f('0x8'));var attributes=require('./chatGroup.attributes');module[_0x486f('0x9')]=function(_0x1adb27,_0x39f767){return _0x1adb27[_0x486f('0xa')](_0x486f('0xb'),attributes,{'tableName':_0x486f('0xc'),'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 d689214..995c3e1 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 _0x9b18=['redis','defaults','localhost','./chatGroup.socket','register','request','info','ChatGroup,\x20%s,\x20%s','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http'];(function(_0x49cd43,_0x43b2a1){var _0x172e50=function(_0x1170ca){while(--_0x1170ca){_0x49cd43['push'](_0x49cd43['shift']());}};_0x172e50(++_0x43b2a1);}(_0x9b18,0x13c));var _0x89b1=function(_0xbb14db,_0x3ee8c6){_0xbb14db=_0xbb14db-0x0;var _0x36bed7=_0x9b18[_0xbb14db];return _0x36bed7;};'use strict';var _=require(_0x89b1('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x89b1('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x89b1('0x2'));var db=require(_0x89b1('0x3'))['db'];var utils=require(_0x89b1('0x4'));var logger=require(_0x89b1('0x5'))('rpc');var config=require(_0x89b1('0x6'));var jayson=require(_0x89b1('0x7'));var client=jayson['client'][_0x89b1('0x8')]({'port':0x232a});config[_0x89b1('0x9')]=_[_0x89b1('0xa')](config[_0x89b1('0x9')],{'host':_0x89b1('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x89b1('0x9')]));require(_0x89b1('0xc'))[_0x89b1('0xd')](socket);function respondWithRpcPromise(_0x31be37,_0x1e8fa1,_0x332470){return new BPromise(function(_0xac8c28,_0x313365){return client[_0x89b1('0xe')](_0x31be37,_0x332470)['then'](function(_0x218b01){logger[_0x89b1('0xf')](_0x89b1('0x10'),_0x1e8fa1,'request\x20sent');logger[_0x89b1('0x11')](_0x89b1('0x12'),_0x1e8fa1,'request\x20sent',JSON[_0x89b1('0x13')](_0x218b01));if(_0x218b01[_0x89b1('0x14')]){if(_0x218b01[_0x89b1('0x14')][_0x89b1('0x15')]===0x1f4){logger[_0x89b1('0x14')]('ChatGroup,\x20%s,\x20%s',_0x1e8fa1,_0x218b01[_0x89b1('0x14')][_0x89b1('0x16')]);return _0x313365(_0x218b01[_0x89b1('0x14')][_0x89b1('0x16')]);}logger[_0x89b1('0x14')](_0x89b1('0x10'),_0x1e8fa1,_0x218b01['error'][_0x89b1('0x16')]);return _0xac8c28(_0x218b01[_0x89b1('0x14')][_0x89b1('0x16')]);}else{logger[_0x89b1('0xf')]('ChatGroup,\x20%s,\x20%s',_0x1e8fa1,'request\x20sent');_0xac8c28(_0x218b01[_0x89b1('0x17')][_0x89b1('0x16')]);}})[_0x89b1('0x18')](function(_0x51ae62){logger[_0x89b1('0x14')](_0x89b1('0x10'),_0x1e8fa1,_0x51ae62);_0x313365(_0x51ae62);});});} \ No newline at end of file +var _0xd9d7=['request','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','defaults','redis','socket.io-emitter','./chatGroup.socket','register'];(function(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0xd9d7,0x184));var _0x7d9d=function(_0x5a7282,_0xa6e195){_0x5a7282=_0x5a7282-0x0;var _0x4928ec=_0xd9d7[_0x5a7282];return _0x4928ec;};'use strict';var _=require(_0x7d9d('0x0'));var util=require(_0x7d9d('0x1'));var moment=require('moment');var BPromise=require(_0x7d9d('0x2'));var rs=require(_0x7d9d('0x3'));var fs=require('fs');var Redis=require(_0x7d9d('0x4'));var db=require(_0x7d9d('0x5'))['db'];var utils=require(_0x7d9d('0x6'));var logger=require(_0x7d9d('0x7'))(_0x7d9d('0x8'));var config=require('../../config/environment');var jayson=require(_0x7d9d('0x9'));var client=jayson[_0x7d9d('0xa')][_0x7d9d('0xb')]({'port':0x232a});config['redis']=_[_0x7d9d('0xc')](config[_0x7d9d('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x7d9d('0xe'))(new Redis(config[_0x7d9d('0xd')]));require(_0x7d9d('0xf'))[_0x7d9d('0x10')](socket);function respondWithRpcPromise(_0x1eb818,_0x12af9a,_0x15f2fc){return new BPromise(function(_0x373d74,_0x4d7c72){return client[_0x7d9d('0x11')](_0x1eb818,_0x15f2fc)[_0x7d9d('0x12')](function(_0x1cbb6f){logger[_0x7d9d('0x13')](_0x7d9d('0x14'),_0x12af9a,_0x7d9d('0x15'));logger[_0x7d9d('0x16')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0x12af9a,_0x7d9d('0x15'),JSON[_0x7d9d('0x17')](_0x1cbb6f));if(_0x1cbb6f[_0x7d9d('0x18')]){if(_0x1cbb6f[_0x7d9d('0x18')][_0x7d9d('0x19')]===0x1f4){logger[_0x7d9d('0x18')](_0x7d9d('0x14'),_0x12af9a,_0x1cbb6f['error'][_0x7d9d('0x1a')]);return _0x4d7c72(_0x1cbb6f['error'][_0x7d9d('0x1a')]);}logger[_0x7d9d('0x18')](_0x7d9d('0x14'),_0x12af9a,_0x1cbb6f[_0x7d9d('0x18')][_0x7d9d('0x1a')]);return _0x373d74(_0x1cbb6f[_0x7d9d('0x18')][_0x7d9d('0x1a')]);}else{logger[_0x7d9d('0x13')](_0x7d9d('0x14'),_0x12af9a,'request\x20sent');_0x373d74(_0x1cbb6f['result']['message']);}})['catch'](function(_0x8755b3){logger[_0x7d9d('0x18')](_0x7d9d('0x14'),_0x12af9a,_0x8755b3);_0x4d7c72(_0x8755b3);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 79d1971..a96dfb0 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 _0xd466=['update','removeListener','register','length','chatGroup:','./chatGroup.events','save','remove'];(function(_0x26a7d1,_0x20d6b2){var _0xb55047=function(_0x3d280b){while(--_0x3d280b){_0x26a7d1['push'](_0x26a7d1['shift']());}};_0xb55047(++_0x20d6b2);}(_0xd466,0x1dd));var _0x6d46=function(_0x16bfb0,_0x572237){_0x16bfb0=_0x16bfb0-0x0;var _0x1bd329=_0xd466[_0x16bfb0];return _0x1bd329;};'use strict';var ChatGroupEvents=require(_0x6d46('0x0'));var events=[_0x6d46('0x1'),_0x6d46('0x2'),_0x6d46('0x3')];function createListener(_0x215f4d,_0x5a1dd6){return function(_0x5557c7){_0x5a1dd6['emit'](_0x215f4d,_0x5557c7);};}function removeListener(_0x2cccef,_0x59e604){return function(){ChatGroupEvents[_0x6d46('0x4')](_0x2cccef,_0x59e604);};}exports[_0x6d46('0x5')]=function(_0x47387b){for(var _0x4c162e=0x0,_0x36f786=events[_0x6d46('0x6')];_0x4c162e<_0x36f786;_0x4c162e++){var _0x4cc29e=events[_0x4c162e];var _0x3909da=createListener(_0x6d46('0x7')+_0x4cc29e,_0x47387b);ChatGroupEvents['on'](_0x4cc29e,_0x3909da);}}; \ No newline at end of file +var _0xa120=['remove','update','emit','removeListener','length','chatGroup:','save'];(function(_0x329664,_0x130748){var _0x4e346e=function(_0x172b0d){while(--_0x172b0d){_0x329664['push'](_0x329664['shift']());}};_0x4e346e(++_0x130748);}(_0xa120,0x141));var _0x0a12=function(_0x2d822f,_0x3ae74b){_0x2d822f=_0x2d822f-0x0;var _0x549e39=_0xa120[_0x2d822f];return _0x549e39;};'use strict';var ChatGroupEvents=require('./chatGroup.events');var events=[_0x0a12('0x0'),_0x0a12('0x1'),_0x0a12('0x2')];function createListener(_0x5c295e,_0x387c99){return function(_0x24a648){_0x387c99[_0x0a12('0x3')](_0x5c295e,_0x24a648);};}function removeListener(_0x558bf4,_0xe7fdcb){return function(){ChatGroupEvents[_0x0a12('0x4')](_0x558bf4,_0xe7fdcb);};}exports['register']=function(_0x555986){for(var _0x60bc5=0x0,_0x420199=events[_0x0a12('0x5')];_0x60bc5<_0x420199;_0x60bc5++){var _0x5f0db2=events[_0x60bc5];var _0x373e95=createListener(_0x0a12('0x6')+_0x5f0db2,_0x555986);ChatGroupEvents['on'](_0x5f0db2,_0x373e95);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 6c14e0a..8ab51bc 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 _0xac64=['create','addMessage','put','update','delete','destroy','removeMembers','exports','multer','util','path','connect-timeout','express','../../config/environment','./chatGroup.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/unread','getUnread','/:id/members','getMembers','/:id/messages','getMessages','post'];(function(_0x5b4e46,_0xe6008d){var _0x5a229f=function(_0x13e01a){while(--_0x13e01a){_0x5b4e46['push'](_0x5b4e46['shift']());}};_0x5a229f(++_0xe6008d);}(_0xac64,0x1c8));var _0x4ac6=function(_0x25c1a5,_0x599dc9){_0x25c1a5=_0x25c1a5-0x0;var _0x3abc0a=_0xac64[_0x25c1a5];return _0x3abc0a;};'use strict';var multer=require(_0x4ac6('0x0'));var util=require(_0x4ac6('0x1'));var path=require(_0x4ac6('0x2'));var timeout=require(_0x4ac6('0x3'));var express=require(_0x4ac6('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x4ac6('0x5'));var controller=require(_0x4ac6('0x6'));router[_0x4ac6('0x7')]('/',auth[_0x4ac6('0x8')](),controller['index']);router[_0x4ac6('0x7')](_0x4ac6('0x9'),auth[_0x4ac6('0x8')](),controller[_0x4ac6('0xa')]);router[_0x4ac6('0x7')](_0x4ac6('0xb'),auth[_0x4ac6('0x8')](),controller[_0x4ac6('0xc')]);router['get'](_0x4ac6('0xd'),auth[_0x4ac6('0x8')](),controller[_0x4ac6('0xe')]);router[_0x4ac6('0x7')](_0x4ac6('0xf'),auth[_0x4ac6('0x8')](),controller[_0x4ac6('0x10')]);router[_0x4ac6('0x7')](_0x4ac6('0x11'),auth['isAuthenticated'](),controller[_0x4ac6('0x12')]);router[_0x4ac6('0x13')]('/',auth['isAuthenticated'](),controller[_0x4ac6('0x14')]);router['post'](_0x4ac6('0xf'),auth['isAuthenticated'](),controller['addMembers']);router[_0x4ac6('0x13')](_0x4ac6('0x11'),auth[_0x4ac6('0x8')](),controller[_0x4ac6('0x15')]);router[_0x4ac6('0x16')]('/:id',auth[_0x4ac6('0x8')](),controller[_0x4ac6('0x17')]);router[_0x4ac6('0x18')]('/:id',auth[_0x4ac6('0x8')](),controller[_0x4ac6('0x19')]);router[_0x4ac6('0x18')](_0x4ac6('0xf'),auth['isAuthenticated'](),controller[_0x4ac6('0x1a')]);module[_0x4ac6('0x1b')]=router; \ No newline at end of file +var _0x83c4=['multer','util','Router','../../components/auth/service','../../components/interaction/service','isAuthenticated','get','/describe','describe','/:id','getUnread','/:id/members','getMembers','getMessages','post','addMembers','/:id/messages','addMessage','put','delete','destroy','removeMembers'];(function(_0x199478,_0x9cc29e){var _0x2c169e=function(_0x515016){while(--_0x515016){_0x199478['push'](_0x199478['shift']());}};_0x2c169e(++_0x9cc29e);}(_0x83c4,0x176));var _0x483c=function(_0x3cd8d0,_0x435c73){_0x3cd8d0=_0x3cd8d0-0x0;var _0x240b5c=_0x83c4[_0x3cd8d0];return _0x240b5c;};'use strict';var multer=require(_0x483c('0x0'));var util=require(_0x483c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x483c('0x2')]();var auth=require(_0x483c('0x3'));var interaction=require(_0x483c('0x4'));var config=require('../../config/environment');var controller=require('./chatGroup.controller');router['get']('/',auth[_0x483c('0x5')](),controller['index']);router[_0x483c('0x6')](_0x483c('0x7'),auth[_0x483c('0x5')](),controller[_0x483c('0x8')]);router['get'](_0x483c('0x9'),auth[_0x483c('0x5')](),controller['show']);router['get']('/:id/unread',auth[_0x483c('0x5')](),controller[_0x483c('0xa')]);router[_0x483c('0x6')](_0x483c('0xb'),auth[_0x483c('0x5')](),controller[_0x483c('0xc')]);router[_0x483c('0x6')]('/:id/messages',auth[_0x483c('0x5')](),controller[_0x483c('0xd')]);router['post']('/',auth[_0x483c('0x5')](),controller['create']);router[_0x483c('0xe')](_0x483c('0xb'),auth[_0x483c('0x5')](),controller[_0x483c('0xf')]);router[_0x483c('0xe')](_0x483c('0x10'),auth[_0x483c('0x5')](),controller[_0x483c('0x11')]);router[_0x483c('0x12')](_0x483c('0x9'),auth[_0x483c('0x5')](),controller['update']);router[_0x483c('0x13')](_0x483c('0x9'),auth[_0x483c('0x5')](),controller[_0x483c('0x14')]);router['delete'](_0x483c('0xb'),auth[_0x483c('0x5')](),controller[_0x483c('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index 4dba36e..5e837df 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 _0x66aa=['ENUM','star','thumb','TEXT','STRING','DATE','long','out','sequelize','exports','BOOLEAN','INTEGER'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x66aa,0xbc));var _0xa66a=function(_0x550465,_0x180361){_0x550465=_0x550465-0x0;var _0xc71cb6=_0x66aa[_0x550465];return _0xc71cb6;};'use strict';var Sequelize=require(_0xa66a('0x0'));module[_0xa66a('0x1')]={'closed':{'type':Sequelize[_0xa66a('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0xa66a('0x3')]},'ratingType':{'type':Sequelize[_0xa66a('0x4')](_0xa66a('0x5'),_0xa66a('0x6')),'defaultValue':_0xa66a('0x5')},'ratingMessage':{'type':Sequelize['TEXT']},'pathTranscript':{'type':Sequelize[_0xa66a('0x7')]},'mailTranscript':{'type':Sequelize[_0xa66a('0x8')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0xa66a('0x9')]},'disposition':{'type':Sequelize[_0xa66a('0x8')]},'note':{'type':Sequelize[_0xa66a('0x8')]},'browserName':{'type':Sequelize[_0xa66a('0x8')]},'browserVersion':{'type':Sequelize['STRING']},'osName':{'type':Sequelize[_0xa66a('0x8')]},'osVersion':{'type':Sequelize[_0xa66a('0x8')]},'deviceModel':{'type':Sequelize['STRING']},'deviceVendor':{'type':Sequelize[_0xa66a('0x8')]},'deviceType':{'type':Sequelize[_0xa66a('0x8')]},'referer':{'type':Sequelize[_0xa66a('0x7')]},'customerIp':{'type':Sequelize[_0xa66a('0x8')]},'formData':{'type':Sequelize[_0xa66a('0x7')](_0xa66a('0xa'))},'read1stAt':{'type':Sequelize[_0xa66a('0x9')]},'lastMsgAt':{'type':Sequelize[_0xa66a('0x9')]},'lastMsgDirection':{'type':Sequelize[_0xa66a('0x4')]('in',_0xa66a('0xb')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0xa66a('0x8')]},'customerPort':{'type':Sequelize[_0xa66a('0x8')]}}; \ No newline at end of file +var _0x5709=['STRING','long','out','sequelize','exports','BOOLEAN','ENUM','star','thumb','TEXT','DATE'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x5709,0x158));var _0x9570=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5709[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x9570('0x0'));module[_0x9570('0x1')]={'closed':{'type':Sequelize[_0x9570('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize['INTEGER']},'ratingType':{'type':Sequelize[_0x9570('0x3')](_0x9570('0x4'),_0x9570('0x5')),'defaultValue':'star'},'ratingMessage':{'type':Sequelize[_0x9570('0x6')]},'pathTranscript':{'type':Sequelize['TEXT']},'mailTranscript':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x9570('0x7')]},'disposition':{'type':Sequelize[_0x9570('0x8')]},'note':{'type':Sequelize[_0x9570('0x8')]},'browserName':{'type':Sequelize[_0x9570('0x8')]},'browserVersion':{'type':Sequelize[_0x9570('0x8')]},'osName':{'type':Sequelize[_0x9570('0x8')]},'osVersion':{'type':Sequelize[_0x9570('0x8')]},'deviceModel':{'type':Sequelize[_0x9570('0x8')]},'deviceVendor':{'type':Sequelize['STRING']},'deviceType':{'type':Sequelize['STRING']},'referer':{'type':Sequelize[_0x9570('0x6')]},'customerIp':{'type':Sequelize[_0x9570('0x8')]},'formData':{'type':Sequelize[_0x9570('0x6')](_0x9570('0x9'))},'read1stAt':{'type':Sequelize[_0x9570('0x7')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x9570('0x3')]('in',_0x9570('0xa')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x9570('0x8')]},'customerPort':{'type':Sequelize[_0x9570('0x8')]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index b465524..9ce4f8b 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 _0x84e7=['request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','register','jayson/promise','client','http','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','ChatInteraction,\x20%s,\x20%s','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','sendStatus','status','json','count','offset','limit','set','save','update','destroy','end','name','send','Users','map','TagIds','Tags','split','push','index','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','nolimit','order','sort','pick','select','field','color','from','tools_tags','u.fullname','ui.ChatInteractionId','left_join','users','u.id\x20=\x20ui.UserId','chat_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','chat_websites','a.id\x20=\x20i.ChatWebsiteId','chat_messages','me.ChatInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','parseSearch','search','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','start','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','text','body','keys','some','compact','isEmpty','ChatWebsiteId','i.ChatWebsiteId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','where','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','tag','isArray','filter','replace','\x27\x27\x27\x27','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','journey','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','i.ChatWebsiteId\x20IS\x20NULL','sequelize','toString','merge','ChatInteraction','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.lastName','Contact.lastName','c.email','Contact.email','Contact.phone','c.mobile','Contact.fax','o.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.ChatInteractionId\x20IN\x20?','groupBy','ChatInteractionId','all','rows','show','params','rawAttributes','include','options','create','describe','customUpdate','abandon','entity\x20not\x20found','Interaction\x20already\x20assigned','closed','disposition','file','originalname','basename','filename','mimetype','Attachment','findOne','Unauthorized','attachId','download','join','root','server/files/attachments/','close','mailTranscript','format','now','pathTranscript','ChatMessage','Messages','ChatWebsite','CmContact','agentAlias','customer','%s%d','Visitor','agentIdentifier','website_alias','agent_alias','alias','fullname','System','agent_fullname','[%s]\x20%s:\x20%s\x0a','direction','secret','appendFileSync','MailAccount','MailServerOut','Smtp','service','port','secure','authentication','SendMail','\x22%s\x22\x20<%s>','email','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','getMessages','hasOwnProperty','YYYY-MM-DD\x20HH:mm:ss','findAll','setTags','ids','omit','spread','Tag','emit','chatInteractionTags:save','removeTags','unix','tmp','server','files','attachments','transcript-%d-%s.zip','Account','get','mkdirSync','10px','40px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Chat','YYYY-MM-DD','Owner','N.A.','closedAt','browserName','osName','customerIp','customerPort','tail','existsSync','pipe','out','lastName','renderFile','views','downloadInteraction.html','toFile','.pdf','log','err','eml-format','rimraf','fast-json-patch'];(function(_0x414039,_0x556090){var _0x47919f=function(_0x4209c9){while(--_0x4209c9){_0x414039['push'](_0x414039['shift']());}};_0x47919f(++_0x556090);}(_0x84e7,0x122));var _0x784e=function(_0x5c426e,_0x2f19e3){_0x5c426e=_0x5c426e-0x0;var _0xc0fe6c=_0x84e7[_0x5c426e];return _0xc0fe6c;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x784e('0x0'));var rimraf=require(_0x784e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x784e('0x2'));var rp=require(_0x784e('0x3'));var moment=require('moment');var BPromise=require(_0x784e('0x4'));var Mustache=require(_0x784e('0x5'));var util=require(_0x784e('0x6'));var path=require(_0x784e('0x7'));var sox=require(_0x784e('0x8'));var csv=require(_0x784e('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x784e('0xa'));var squel=require('squel');var crypto=require(_0x784e('0xb'));var jsforce=require(_0x784e('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x784e('0x9'));var querystring=require(_0x784e('0xd'));var Papa=require(_0x784e('0xe'));var Redis=require(_0x784e('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x784e('0x10'));var hardwareService=require(_0x784e('0x11'));var logger=require(_0x784e('0x12'))(_0x784e('0x13'));var utils=require('../../config/utils');var config=require(_0x784e('0x14'));var db=require(_0x784e('0x15'))['db'];config[_0x784e('0x16')]=_[_0x784e('0x17')](config[_0x784e('0x16')],{'host':_0x784e('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x784e('0x16')]));require('./chatInteraction.socket')[_0x784e('0x19')](socket);var jayson=require(_0x784e('0x1a'));var client=jayson[_0x784e('0x1b')][_0x784e('0x1c')]({'port':0x232b});var client9004=jayson[_0x784e('0x1b')][_0x784e('0x1c')]({'port':0x232c});function checkPasswordPattern(_0x947397,_0x39abb5,_0x8a90cf){if(_0x8a90cf){var _0x567eb9=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x567eb9['test'](_0x39abb5)){return _0x947397;}else{throw new db[(_0x784e('0x1d'))][(_0x784e('0x1e'))](_0x784e('0x1f'));}}else{return _0x947397;}}function respondWithRpcPromise(_0x25281f,_0x3ac83,_0x19072b,_0x1dc568){return new BPromise(function(_0x504ebf,_0x2524d0){var _0x285ddd=_0x1dc568||client;return _0x285ddd[_0x784e('0x20')](_0x25281f,_0x19072b)[_0x784e('0x21')](function(_0x440cd6){logger[_0x784e('0x22')](_0x784e('0x23'),_0x3ac83,'request\x20sent');logger['debug'](_0x784e('0x24'),_0x3ac83,'request\x20sent',JSON[_0x784e('0x25')](_0x440cd6));if(_0x440cd6[_0x784e('0x26')]){if(_0x440cd6['error']['code']===0x1f4){logger[_0x784e('0x26')](_0x784e('0x23'),_0x3ac83,_0x440cd6[_0x784e('0x26')][_0x784e('0x27')]);return _0x2524d0(_0x440cd6['error']['message']);}logger['error'](_0x784e('0x23'),_0x3ac83,_0x440cd6[_0x784e('0x26')]['message']);return _0x504ebf(_0x440cd6[_0x784e('0x26')]['message']);}else{logger[_0x784e('0x22')]('ChatInteraction,\x20%s,\x20%s',_0x3ac83,_0x784e('0x28'));_0x504ebf(_0x440cd6[_0x784e('0x29')][_0x784e('0x27')]);}})[_0x784e('0x2a')](function(_0x5cb14f){logger[_0x784e('0x26')](_0x784e('0x23'),_0x3ac83,_0x5cb14f);_0x2524d0(_0x5cb14f);});});}function respondWithStatusCode(_0x12a246,_0x2def08){_0x2def08=_0x2def08||0xcc;return function(_0x54e558){if(_0x54e558){return _0x12a246[_0x784e('0x2b')](_0x2def08);}return _0x12a246[_0x784e('0x2c')](_0x2def08)['end']();};}function respondWithResult(_0x5cb5a3,_0x3c30b7){_0x3c30b7=_0x3c30b7||0xc8;return function(_0x40c31b){if(_0x40c31b){return _0x5cb5a3[_0x784e('0x2c')](_0x3c30b7)[_0x784e('0x2d')](_0x40c31b);}};}function respondWithFilteredResult(_0x2e8a79,_0x294a75){return function(_0x150757){if(_0x150757){var _0x14768f=_0x150757[_0x784e('0x2e')],_0x42bdfb=_0x294a75[_0x784e('0x2f')],_0x2e18d6=_0x294a75[_0x784e('0x2f')]+_0x294a75[_0x784e('0x30')],_0x328b70;if(_0x2e18d6>=_0x14768f){_0x2e18d6=_0x14768f;_0x328b70=0xc8;}else{_0x328b70=0xce;}_0x2e8a79['status'](_0x328b70);return _0x2e8a79[_0x784e('0x31')]('Content-Range',_0x42bdfb+'-'+_0x2e18d6+'/'+_0x14768f)[_0x784e('0x2d')](_0x150757);}return null;};}function patchUpdates(_0x14bb3b){return function(_0x14547a){try{jsonpatch['apply'](_0x14547a,_0x14bb3b,!![]);}catch(_0x18d8f4){return BPromise['reject'](_0x18d8f4);}return _0x14547a[_0x784e('0x32')]();};}function saveUpdates(_0x3525d6,_0x4fc7b3){return function(_0x23b3b0){if(_0x23b3b0){return _0x23b3b0[_0x784e('0x33')](_0x3525d6)['then'](function(_0x58744f){return _0x58744f;});}return null;};}function removeEntity(_0x444d1e,_0x360e5f){return function(_0x425722){if(_0x425722){return _0x425722[_0x784e('0x34')]()[_0x784e('0x21')](function(){_0x444d1e['status'](0xcc)[_0x784e('0x35')]();});}};}function handleEntityNotFound(_0xcbc600,_0x5bb0a6){return function(_0x3c95da){if(!_0x3c95da){_0xcbc600['sendStatus'](0x194);}return _0x3c95da;};}function handleError(_0x4adb1f,_0x582355){_0x582355=_0x582355||0x1f4;return function(_0x177e54){logger[_0x784e('0x26')](_0x177e54['stack']);if(_0x177e54[_0x784e('0x36')]){delete _0x177e54[_0x784e('0x36')];}_0x4adb1f[_0x784e('0x2c')](_0x582355)[_0x784e('0x37')](_0x177e54);};}function getInteractionUsers(_0x1351ef,_0x244727){return new BPromise(function(_0x4c4e59,_0x5f006b){try{if(_0x244727[_0x1351ef['id']]){_0x1351ef[_0x784e('0x38')]=_[_0x784e('0x39')](_0x244727[_0x1351ef['id']],function(_0x509d95){return{'id':_0x509d95['id'],'fullname':_0x509d95['fullname']};});}}catch(_0x48afec){_0x5f006b(_0x48afec);}_0x4c4e59(_0x1351ef);});}function getInteractionTags(_0x35608e,_0x1facf9){return new BPromise(function(_0x4f1cc0,_0x3fa668){try{if(_0x35608e[_0x784e('0x3a')]){_0x35608e[_0x784e('0x3b')]=[];_0x35608e['TagIds'][_0x784e('0x3c')](',')['forEach'](function(_0x1b0d7a){_0x35608e['Tags'][_0x784e('0x3d')](_0x1facf9[_0x1b0d7a]);});}delete _0x35608e[_0x784e('0x3a')];}catch(_0x5512bd){_0x3fa668(_0x5512bd);}_0x4f1cc0(_0x35608e);});}function updateChatInteraction(_0x4d08ee,_0x1c0aca,_0x459fe2){return new BPromise(function(_0xa2ed54,_0x58fb50){return getInteractionUsers(_0x4d08ee,_0x459fe2)[_0x784e('0x21')](function(_0x3d68e6){return getInteractionTags(_0x3d68e6,_0x1c0aca);})[_0x784e('0x21')](function(_0x1e90bb){_0xa2ed54(_0x1e90bb);})['catch'](function(_0x444300){_0x58fb50(_0x444300);});});}exports[_0x784e('0x3e')]=function(_0x48d0f0,_0x580663){var _0x45dd9d={},_0x39cf7a={},_0x258a2a={'count':0x0,'rows':[]};var _0x18436e=_[_0x784e('0x39')](db['ChatInteraction']['rawAttributes'],function(_0x5e0a18){return{'name':_0x5e0a18[_0x784e('0x3f')],'type':_0x5e0a18[_0x784e('0x40')][_0x784e('0x41')]};});_0x39cf7a[_0x784e('0x42')]=_[_0x784e('0x39')](_0x18436e,'name');_0x39cf7a['query']=_['keys'](_0x48d0f0[_0x784e('0x43')]);_0x39cf7a[_0x784e('0x44')]=_['intersection'](_0x39cf7a[_0x784e('0x42')],_0x39cf7a[_0x784e('0x43')]);_0x45dd9d['attributes']=_[_0x784e('0x45')](_0x39cf7a[_0x784e('0x42')],qs[_0x784e('0x46')](_0x48d0f0[_0x784e('0x43')][_0x784e('0x46')]));_0x45dd9d[_0x784e('0x47')]=_0x45dd9d[_0x784e('0x47')][_0x784e('0x48')]?_0x45dd9d['attributes']:_0x39cf7a[_0x784e('0x42')];if(!_0x48d0f0[_0x784e('0x43')]['hasOwnProperty'](_0x784e('0x49'))){_0x45dd9d[_0x784e('0x30')]=qs[_0x784e('0x30')](_0x48d0f0[_0x784e('0x43')][_0x784e('0x30')]);_0x45dd9d[_0x784e('0x2f')]=qs[_0x784e('0x2f')](_0x48d0f0[_0x784e('0x43')][_0x784e('0x2f')]);}_0x45dd9d[_0x784e('0x4a')]=qs['sort'](_0x48d0f0[_0x784e('0x43')][_0x784e('0x4b')]);_0x45dd9d['where']=qs['filters'](_[_0x784e('0x4c')](_0x48d0f0['query'],_0x39cf7a[_0x784e('0x44')]));var _0x52f7a6=[];var _0x3f0804=squel[_0x784e('0x4d')]()[_0x784e('0x4e')]('id')[_0x784e('0x4e')]('name')['field'](_0x784e('0x4f'))[_0x784e('0x50')](_0x784e('0x51'));var _0x43e88e=squel[_0x784e('0x4d')]()['field']('u.id')[_0x784e('0x4e')](_0x784e('0x52'))['field'](_0x784e('0x53'))[_0x784e('0x50')]('user_has_chat_interactions','ui')[_0x784e('0x54')](_0x784e('0x55'),'u',_0x784e('0x56'));var _0x24a260=squel['select']()['from'](_0x784e('0x57'),'i')['left_join']('cm_contacts','c',_0x784e('0x58'))[_0x784e('0x54')](_0x784e('0x55'),'o',_0x784e('0x59'))[_0x784e('0x54')](_0x784e('0x5a'),'a',_0x784e('0x5b'))['left_join'](_0x784e('0x5c'),'me',_0x784e('0x5d'))['left_join']('chat_interaction_has_tags','it','it.ChatInteractionId\x20=\x20i.id')[_0x784e('0x54')](_0x784e('0x51'),'t',_0x784e('0x5e'));var _0x3969c8=squel[_0x784e('0x5f')]();var _0x4d28d1=[];var _0x3d0b7d=squel[_0x784e('0x5f')]();var _0x13a1bf;if(_0x48d0f0[_0x784e('0x43')]['search']){_0x13a1bf=as[_0x784e('0x60')](_0x48d0f0['query'][_0x784e('0x61')]);var _0x191cda=_0x13a1bf[_0x784e('0x62')];for(var _0xffdfdb=0x0;_0xffdfdb<_0x13a1bf[_0x784e('0x63')][_0x784e('0x48')];_0xffdfdb++){var _0x4ee806=_0x13a1bf[_0x784e('0x63')][_0xffdfdb];var _0x5f50e8='i';var _0x420f13=_[_0x784e('0x64')](_0x18436e,[_0x784e('0x36'),_0x4ee806[_0x784e('0x4e')]]);if(!_0x420f13){switch(_0x4ee806[_0x784e('0x4e')]){case _0x784e('0x65'):if(_0x4ee806[_0x784e('0x66')]==0x1){_0x24a260[_0x784e('0x67')]('`'+_0x4ee806[_0x784e('0x4e')]+_0x784e('0x68'));}else{_0x24a260[_0x784e('0x67')]('`'+_0x4ee806[_0x784e('0x4e')]+_0x784e('0x69'));}break;case _0x784e('0x6a'):if(_0x4ee806[_0x784e('0x6b')]===_0x784e('0x6c')){if(_0x4ee806[_0x784e('0x66')][_0x784e('0x3c')]('\x20')['length']>0x1){_0x3969c8[_0x191cda](_0x784e('0x6d'),qs['getFullTextValue'](_0x4ee806[_0x784e('0x66')]),null);}else{var _0x4bec2f='%'+_0x4ee806[_0x784e('0x66')]+'%';_0x3969c8[_0x191cda](_0x784e('0x6e'),_0x4bec2f,_0x4bec2f,_0x4bec2f);}}else{_0x420f13=_[_0x784e('0x64')](_0x18436e,[_0x784e('0x36'),_0x784e('0x6f')]);_0x4ee806['field']=_0x784e('0x6f');_0x5b36af=as[_0x784e('0x70')](_0x5f50e8,_0x420f13[_0x784e('0x40')],_0x4ee806);_0x3969c8[_0x191cda](_0x5b36af['text'],_0x5b36af['value'][_0x784e('0x71')],_0x5b36af[_0x784e('0x66')]['end']);}break;case'Tag':var _0x58fb7f=_0x4ee806[_0x784e('0x66')][_0x784e('0x3c')](',')[_0x784e('0x39')](function(_0x1c7821){return Number(_0x1c7821);});_0x58fb7f[_0x784e('0x72')](function(_0x5475a4){_0x3d0b7d['or'](_0x784e('0x73'),'%,'+_0x5475a4+',%');});_0x4d28d1=_[_0x784e('0x74')](_0x4d28d1,_0x58fb7f);break;case _0x784e('0x75'):if(_0x4ee806[_0x784e('0x6b')]===_0x784e('0x6c')){_0x3969c8[_0x191cda](_0x784e('0x76'),'%'+_0x4ee806[_0x784e('0x66')]+'%',null);}else{_0x420f13=_[_0x784e('0x64')](_0x18436e,['name','UserId']);_0x4ee806[_0x784e('0x4e')]=_0x784e('0x77');_0x5b36af=as['buildExpression'](_0x5f50e8,_0x420f13[_0x784e('0x40')],_0x4ee806);_0x3969c8[_0x191cda](_0x5b36af[_0x784e('0x78')],_0x5b36af[_0x784e('0x66')][_0x784e('0x71')],_0x5b36af['value'][_0x784e('0x35')]);}break;case _0x784e('0x79'):_0x5b36af=as[_0x784e('0x70')]('me',null,_0x4ee806);_0x3969c8[_0x191cda](_0x5b36af[_0x784e('0x78')],_0x5b36af['value']['start'],_0x5b36af['value'][_0x784e('0x35')]);break;}}else{var _0x5b36af=as['buildExpression'](_0x5f50e8,_0x420f13[_0x784e('0x40')],_0x4ee806);_0x3969c8[_0x191cda](_0x5b36af['text'],_0x5b36af['value'][_0x784e('0x71')],_0x5b36af[_0x784e('0x66')]['end']);}}}else{var _0x5f54c8=_(_0x48d0f0['query'])[_0x784e('0x7a')]()[_0x784e('0x39')](function(_0x57012b){return _[_0x784e('0x7b')](_0x18436e,[_0x784e('0x36'),_0x57012b])?_0x57012b:undefined;})[_0x784e('0x7c')]()[_0x784e('0x66')]();if(!_[_0x784e('0x7d')](_0x5f54c8)){_0x5f54c8['forEach'](function(_0x8cf4c9){if(_0x8cf4c9===_0x784e('0x7e')){_0x24a260['where'](_0x784e('0x7f'),[][_0x784e('0x80')](_0x48d0f0[_0x784e('0x43')][_0x8cf4c9]));}else if(_0x8cf4c9===_0x784e('0x81')){var _0x4da231=JSON[_0x784e('0x82')](_0x48d0f0['query'][_0x8cf4c9])[_0x784e('0x83')];var _0x1e29a4=JSON[_0x784e('0x82')](_0x48d0f0['query'][_0x8cf4c9])[_0x784e('0x84')];_0x24a260[_0x784e('0x85')](_0x784e('0x86'),_0x4da231,_0x1e29a4);}else{if(_0x48d0f0['query'][_0x8cf4c9]===_0x784e('0x87')){_0x24a260[_0x784e('0x85')]('i.'+_0x8cf4c9+_0x784e('0x88'));}else{_0x24a260[_0x784e('0x85')]('i.'+_0x8cf4c9+_0x784e('0x89'),_0x48d0f0['query'][_0x8cf4c9]);}}});}if(_0x48d0f0[_0x784e('0x43')][_0x784e('0x8a')]){if(_0x48d0f0['query']['read']==0x1){_0x24a260[_0x784e('0x67')](_0x784e('0x8b'));}else{_0x24a260[_0x784e('0x67')]('`unreadMessages`\x20>\x200');}}if(_0x48d0f0[_0x784e('0x43')][_0x784e('0x8c')]){_0x4d28d1=_[_0x784e('0x8d')](_0x48d0f0[_0x784e('0x43')][_0x784e('0x8c')])?_0x48d0f0[_0x784e('0x43')][_0x784e('0x8c')]:new Array(_0x48d0f0['query']['tag']);_0x4d28d1[_0x784e('0x72')](function(_0x56d2f2){_0x3d0b7d['or'](_0x784e('0x73'),'%,'+_0x56d2f2+',%');});}if(_0x48d0f0[_0x784e('0x43')][_0x784e('0x8e')]){var _0x4e6f25=_0x48d0f0[_0x784e('0x43')][_0x784e('0x8e')][_0x784e('0x8f')]('\x5c','\x5c\x5c')[_0x784e('0x8f')]('\x27\x27',_0x784e('0x90'));if(qs[_0x784e('0x91')](_0x4e6f25)){_0x3969c8['or'](_0x784e('0x92'),_0x4e6f25+'%');}else{_0x3969c8['or'](_0x784e('0x93'),qs[_0x784e('0x94')](_0x4e6f25))['or'](_0x784e('0x95'),_0x4e6f25+'%');}}}_0x24a260[_0x784e('0x85')](_0x3969c8);_0x24a260[_0x784e('0x96')](_0x784e('0x97'));var _0x3e6787={'type':db[_0x784e('0x1d')][_0x784e('0x98')][_0x784e('0x99')],'raw':!![]};var _0x188caa=_0x24a260[_0x784e('0x9a')]();_0x188caa[_0x784e('0x4e')](_0x784e('0x97'));_0x188caa['field'](_0x784e('0x9b'),_0x784e('0x65'));if(_0x45dd9d[_0x784e('0x4a')]){_0x45dd9d[_0x784e('0x4a')][_0x784e('0x72')](function(_0x18b88a){_0x24a260['order']('i.'+_0x18b88a[0x0],_0x18b88a[0x1]===_0x784e('0x9c')?![]:!![]);});}if(!_['isEmpty'](_0x4d28d1)){_0x24a260[_0x784e('0x67')](_0x3d0b7d);_0x188caa['where']('t.id\x20IN\x20?',_0x4d28d1);}BPromise['resolve']()[_0x784e('0x21')](function(){if(!_0x13a1bf){if(_0x48d0f0[_0x784e('0x43')][_0x784e('0x7e')]||_0x48d0f0[_0x784e('0x43')][_0x784e('0x9d')])return;_0x188caa[_0x784e('0x85')]('i.ChatWebsiteId\x20IS\x20NOT\x20NULL');_0x24a260[_0x784e('0x85')](_0x784e('0x9e'));return;}return _0x48d0f0[_0x784e('0x9f')]['getChatWebsites']({'attributes':['id'],'raw':!![]})[_0x784e('0x21')](function(_0x2d0136){if(_[_0x784e('0x7d')](_0x2d0136)){_0x188caa[_0x784e('0x85')](_0x784e('0xa0'));_0x24a260[_0x784e('0x85')](_0x784e('0xa0'));}else{_0x188caa['where']('i.ChatWebsiteId\x20IN\x20?',_[_0x784e('0x39')](_0x2d0136,'id'));_0x24a260[_0x784e('0x85')](_0x784e('0x7f'),_[_0x784e('0x39')](_0x2d0136,'id'));}});})[_0x784e('0x21')](function(){db[_0x784e('0xa1')][_0x784e('0x43')](_0x188caa[_0x784e('0xa2')](),_0x3e6787)[_0x784e('0x21')](function(_0x16dcfc){_0x258a2a['count']=_0x16dcfc[_0x784e('0x48')];if(_0x258a2a['count']===0x0)return[];return db['sequelize'][_0x784e('0x43')](_0x3f0804[_0x784e('0xa2')](),_0x3e6787)[_0x784e('0x21')](function(_0x426273){_0x52f7a6=_['keyBy'](_0x426273,'id');_0x3e6787=_[_0x784e('0xa3')](_0x3e6787,{'model':db[_0x784e('0xa4')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x48d0f0[_0x784e('0x43')]['fields']){_0x45dd9d[_0x784e('0x47')][_0x784e('0x72')](function(_0x271d6d){_0x24a260[_0x784e('0x4e')]('i.'+_0x271d6d);});}else{_0x24a260[_0x784e('0x4e')](_0x784e('0x9b'),_0x784e('0x65'));_0x24a260[_0x784e('0x4e')]('a.key',_0x784e('0xa5'));_0x24a260['field'](_0x784e('0xa6'),_0x784e('0xa7'));_0x24a260[_0x784e('0x4e')](_0x784e('0xa8'));_0x24a260[_0x784e('0x4e')]('c.firstName','Contact.firstName');_0x24a260[_0x784e('0x4e')](_0x784e('0xa9'),_0x784e('0xaa'));_0x24a260[_0x784e('0x4e')](_0x784e('0xab'),_0x784e('0xac'));_0x24a260[_0x784e('0x4e')]('c.phone',_0x784e('0xad'));_0x24a260['field'](_0x784e('0xae'),'Contact.mobile');_0x24a260[_0x784e('0x4e')]('c.fax',_0x784e('0xaf'));_0x24a260[_0x784e('0x4e')](_0x784e('0xb0'),'Owner.fullname');_0x24a260['field']('o.internal',_0x784e('0xb1'));_0x24a260[_0x784e('0x4e')](_0x784e('0xb2'),_0x784e('0x3a'));}_0x24a260[_0x784e('0x30')](_0x45dd9d[_0x784e('0x30')]);_0x24a260[_0x784e('0x2f')](_0x45dd9d[_0x784e('0x2f')]);return db[_0x784e('0xa1')]['query'](_0x24a260[_0x784e('0xa2')](),_0x3e6787);})['then'](function(_0x2c5d99){_0x43e88e[_0x784e('0x85')](_0x784e('0xb3'),_[_0x784e('0x39')](_0x2c5d99,'id'));return db[_0x784e('0xa1')]['query'](_0x43e88e[_0x784e('0xa2')](),_0x3e6787)[_0x784e('0x21')](function(_0x47b959){var _0x42e193=_[_0x784e('0xb4')](_0x47b959,_0x784e('0xb5'));var _0x10bb48=[];_0x2c5d99[_0x784e('0x72')](function(_0x3fe83b){_0x10bb48[_0x784e('0x3d')](updateChatInteraction(_0x3fe83b,_0x52f7a6,_0x42e193));});return BPromise[_0x784e('0xb6')](_0x10bb48);});});})[_0x784e('0x21')](function(_0x4dc8ed){_0x258a2a[_0x784e('0xb7')]=_0x4dc8ed;return _0x258a2a;})['then'](respondWithFilteredResult(_0x580663,_0x45dd9d));})[_0x784e('0x2a')](handleError(_0x580663,null));};exports[_0x784e('0xb8')]=function(_0x4c0a56,_0x4db23f){var _0x3716b1={'raw':![],'where':{'id':_0x4c0a56[_0x784e('0xb9')]['id']}},_0x544406={};_0x544406[_0x784e('0x42')]=_[_0x784e('0x7a')](db['ChatInteraction'][_0x784e('0xba')]);_0x544406[_0x784e('0x43')]=_['keys'](_0x4c0a56[_0x784e('0x43')]);_0x544406[_0x784e('0x44')]=_[_0x784e('0x45')](_0x544406[_0x784e('0x42')],_0x544406[_0x784e('0x43')]);_0x3716b1['attributes']=_['intersection'](_0x544406[_0x784e('0x42')],qs[_0x784e('0x46')](_0x4c0a56[_0x784e('0x43')][_0x784e('0x46')]));_0x3716b1['attributes']=_0x3716b1[_0x784e('0x47')]['length']?_0x3716b1[_0x784e('0x47')]:_0x544406[_0x784e('0x42')];if(_0x4c0a56[_0x784e('0x43')]['includeAll']){_0x3716b1[_0x784e('0xbb')]=[{'all':!![]}];}_0x3716b1=_['merge']({},_0x3716b1,_0x4c0a56[_0x784e('0xbc')]);return db[_0x784e('0xa4')][_0x784e('0x64')](_0x3716b1)[_0x784e('0x21')](handleEntityNotFound(_0x4db23f,null))[_0x784e('0x21')](respondWithResult(_0x4db23f,null))[_0x784e('0x2a')](handleError(_0x4db23f,null));};exports[_0x784e('0xbd')]=function(_0x143e3e,_0x44a131){return db[_0x784e('0xa4')][_0x784e('0xbd')](_0x143e3e[_0x784e('0x79')],{})['then'](respondWithResult(_0x44a131,0xc9))[_0x784e('0x2a')](handleError(_0x44a131,null));};exports[_0x784e('0x33')]=function(_0x997e6f,_0x3e1d59){if(_0x997e6f[_0x784e('0x79')]['id']){delete _0x997e6f[_0x784e('0x79')]['id'];}return db[_0x784e('0xa4')]['find']({'where':{'id':_0x997e6f[_0x784e('0xb9')]['id']}})[_0x784e('0x21')](handleEntityNotFound(_0x3e1d59,null))[_0x784e('0x21')](saveUpdates(_0x997e6f[_0x784e('0x79')],null))['then'](respondWithResult(_0x3e1d59,null))[_0x784e('0x2a')](handleError(_0x3e1d59,null));};exports[_0x784e('0x34')]=function(_0x2e8657,_0x375f92){return db[_0x784e('0xa4')][_0x784e('0x64')]({'where':{'id':_0x2e8657[_0x784e('0xb9')]['id']}})[_0x784e('0x21')](handleEntityNotFound(_0x375f92,null))[_0x784e('0x21')](removeEntity(_0x375f92,null))[_0x784e('0x2a')](handleError(_0x375f92,null));};exports[_0x784e('0xbe')]=function(_0x567da5,_0x1db77c){return db['ChatInteraction'][_0x784e('0xbe')]()['then'](respondWithResult(_0x1db77c,null))[_0x784e('0x2a')](handleError(_0x1db77c,null));};exports[_0x784e('0xbf')]=function(_0x274573,_0x46c1fe){if(_0x274573['body']['id']){delete _0x274573[_0x784e('0x79')]['id'];}return db['ChatInteraction']['find']({'where':{'id':_0x274573[_0x784e('0xb9')]['id']}})[_0x784e('0x21')](handleEntityNotFound(_0x46c1fe,null))[_0x784e('0x21')](saveUpdates(_0x274573['body'],null))[_0x784e('0x21')](respondWithResult(_0x46c1fe,null))[_0x784e('0x2a')](handleError(_0x46c1fe,null));};exports[_0x784e('0xc0')]=function(_0x211b16,_0x210fbc,_0x5d28e7){if(_0x211b16['body']['id']){delete _0x211b16[_0x784e('0x79')]['id'];}return db[_0x784e('0xa4')][_0x784e('0x64')]({'where':{'id':_0x211b16[_0x784e('0xb9')]['id']}})[_0x784e('0x21')](function(_0x4b530d){if(!_0x4b530d){logger[_0x784e('0x26')]('abandonInteraction,\x20%s,\x20%s,\x20%s',_0x784e('0xc0'),0x194,_0x784e('0xc1'));_0x210fbc[_0x784e('0x2b')](0x194);}else{if(_0x4b530d[_0x784e('0x77')]){throw new db['Sequelize'][(_0x784e('0x1e'))](_0x784e('0xc2'));}}return _0x4b530d;})['then'](function(_0x251ad8){if(_0x251ad8){return _0x251ad8['update']({'closed':_0x211b16[_0x784e('0x79')][_0x784e('0xc3')],'disposition':_0x211b16['body'][_0x784e('0xc4')]})[_0x784e('0x21')](function(_0x4adffa){return _0x4adffa;});}})[_0x784e('0x21')](function(_0x218ac1){return respondWithRpcPromise('AbandonInteraction',_0x784e('0xc0'),_0x211b16[_0x784e('0x79')],client9004);})['then'](respondWithResult(_0x210fbc,null))[_0x784e('0x2a')](handleError(_0x210fbc,null));};exports['attachmentUpload']=function(_0x1b4413,_0x375bf6,_0x29de9b){_0x1b4413[_0x784e('0x79')]['name']=_0x1b4413[_0x784e('0xc5')][_0x784e('0xc6')];_0x1b4413[_0x784e('0x79')][_0x784e('0xc7')]=_0x1b4413[_0x784e('0xc5')][_0x784e('0xc8')];_0x1b4413[_0x784e('0x79')][_0x784e('0x40')]=_0x1b4413[_0x784e('0xc5')][_0x784e('0xc9')];return db[_0x784e('0xca')][_0x784e('0xbd')](_0x1b4413[_0x784e('0x79')])[_0x784e('0x21')](respondWithResult(_0x375bf6,0xc9))[_0x784e('0x2a')](handleError(_0x375bf6,null));};exports['attachmentDownload']=function(_0x17cb46,_0x6e417f,_0xd82ecf){return db['ChatInteraction'][_0x784e('0xcb')]({'where':{'id':_0x17cb46[_0x784e('0xb9')]['id']},'raw':!![]})[_0x784e('0x21')](handleEntityNotFound(_0x6e417f,null))[_0x784e('0x21')](function(_0x20c569){if(_0x20c569){if(_0x20c569[_0x784e('0xc3')]){return _0x6e417f[_0x784e('0x2c')](0x193)[_0x784e('0x2d')]({'status':0x193,'message':_0x784e('0xcc')});}return db[_0x784e('0xca')][_0x784e('0xcb')]({'where':{'id':_0x17cb46[_0x784e('0x43')][_0x784e('0xcd')]},'raw':!![]})[_0x784e('0x21')](handleEntityNotFound(_0x6e417f,null));}})['then'](function(_0x24385d){if(_0x24385d){return _0x6e417f[_0x784e('0xce')](path[_0x784e('0xcf')](config[_0x784e('0xd0')],_0x784e('0xd1'),_0x24385d['basename']));}})[_0x784e('0x2a')](handleError(_0x6e417f,null));};exports[_0x784e('0xd2')]=function(_0x56ad37,_0x4e2f35){var _0x2b4d65=null;var _0x158ba4=null;var _0x52977d=null;var _0x449460=null;if(_0x56ad37[_0x784e('0x79')]['id']){delete _0x56ad37[_0x784e('0x79')]['id'];}if(_0x56ad37['body'][_0x784e('0xd3')]){_0x449460=path[_0x784e('0xcf')](config[_0x784e('0xd0')],'server/files/chat/upload/',util[_0x784e('0xd4')]('transcript-%s.txt',Date[_0x784e('0xd5')]()));_0x56ad37[_0x784e('0x79')][_0x784e('0xd6')]=_0x449460;}return db[_0x784e('0xa4')][_0x784e('0x64')]({'where':{'id':_0x56ad37['params']['id']},'include':[{'model':db[_0x784e('0xd7')],'as':_0x784e('0xd8'),'include':[{'model':db['User'],'as':'User'}]}]})[_0x784e('0x21')](handleEntityNotFound(_0x4e2f35,null))[_0x784e('0x21')](saveUpdates(_0x56ad37[_0x784e('0x79')],null))[_0x784e('0x21')](function(_0x5916b6){if(_0x5916b6){_0x2b4d65=_0x5916b6;return db[_0x784e('0xd9')]['find']({'where':{'id':_0x2b4d65[_0x784e('0x7e')]}});}})[_0x784e('0x21')](function(_0x28c66b){if(_0x28c66b){_0x52977d=_0x28c66b;return db[_0x784e('0xda')][_0x784e('0x64')]({'where':{'id':_0x2b4d65[_0x784e('0x6f')]}});}})['then'](function(_0x22efbd){if(_0x22efbd){_0x158ba4=_0x22efbd;if(_0x449460){var _0x115245=null;for(var _0x4213bc=0x1;_0x4213bc<_0x2b4d65['Messages'][_0x784e('0x48')];++_0x4213bc){_0x115245=_0x2b4d65[_0x784e('0xd8')][_0x4213bc];var _0x348cc2=_0x115245['UserId']?util[_0x784e('0xd4')]('%s%d',_0x52977d[_0x784e('0xdb')],_0x115245[_0x784e('0x77')]):'System';var _0x362592=_0x56ad37[_0x784e('0x79')][_0x784e('0xdc')]||util['format'](_0x784e('0xdd'),_0x784e('0xde'),_0x115245[_0x784e('0x6f')]);switch(_0x52977d[_0x784e('0xdf')]){case _0x784e('0xe0'):_0x348cc2=_0x115245['UserId']?util['format'](_0x784e('0xdd'),_0x52977d[_0x784e('0xdb')],_0x115245[_0x784e('0x77')]):'System';break;case _0x784e('0xe1'):_0x348cc2=_0x115245[_0x784e('0x77')]?_0x115245['User'][_0x784e('0xe2')]||_0x115245[_0x784e('0x75')][_0x784e('0xe3')]:_0x784e('0xe4');break;case _0x784e('0xe5'):_0x348cc2=_0x115245[_0x784e('0x77')]?_0x115245[_0x784e('0x75')]['fullname']:_0x784e('0xe4');break;default:_0x348cc2=_0x115245[_0x784e('0x77')]?util[_0x784e('0xd4')]('%s%d',_0x52977d[_0x784e('0xdb')],_0x115245[_0x784e('0x77')]):_0x784e('0xe4');}var _0x20f070=util[_0x784e('0xd4')](_0x784e('0xe6'),moment(_0x115245['createdAt'])[_0x784e('0xd4')]('MM/DD/YYYY\x20HH:mm:ss'),_0x115245[_0x784e('0xe7')]==='in'?_0x362592:_0x348cc2,_0x115245[_0x784e('0x79')]);if(!_0x115245[_0x784e('0xe8')]){fs[_0x784e('0xe9')](_0x449460,_0x20f070);}}return db[_0x784e('0xea')][_0x784e('0xcb')]({'where':{'service':!![]},'include':[{'model':db[_0x784e('0xeb')],'as':_0x784e('0xec'),'raw':!![]}]});}}})['then'](function(_0x152614){if(_0x152614&&_0x152614[_0x784e('0xec')]&&_0x56ad37['body']){var _0x355f0f={'tls':{'rejectUnauthorized':![]}};if(_0x152614[_0x784e('0xec')][_0x784e('0xed')]){_0x355f0f[_0x784e('0xed')]=_0x152614['Smtp'][_0x784e('0xed')];}else{_0x355f0f['host']=_0x152614[_0x784e('0xec')]['host'];_0x355f0f[_0x784e('0xee')]=_0x152614['Smtp']['port'];_0x355f0f[_0x784e('0xef')]=_0x152614[_0x784e('0xec')][_0x784e('0xef')];}if(_0x152614[_0x784e('0xec')][_0x784e('0xf0')]){_0x355f0f['auth']={'user':_0x152614[_0x784e('0xec')][_0x784e('0x9f')],'pass':_0x152614['Smtp']['pass']};}return respondWithRpcPromise(_0x784e('0xf1'),'sendMail',{'account':_0x355f0f,'message':{'from':util['format'](_0x784e('0xf2'),_0x152614[_0x784e('0x36')],_0x152614[_0x784e('0xf3')]||_0x152614['Smtp'][_0x784e('0x9f')]),'to':_0x56ad37['body'][_0x784e('0xd3')],'subject':_0x784e('0xf4'),'text':util[_0x784e('0xd4')](_0x784e('0xf5'),_0x56ad37['body'][_0x784e('0xd3')]),'attachments':[{'path':_0x449460}]}})[_0x784e('0x21')](function(){return _0x2b4d65;})[_0x784e('0x2a')](function(_0x15a912){console[_0x784e('0x26')](_0x15a912);});}else{return _0x2b4d65;}})['then'](respondWithStatusCode(_0x4e2f35,0xc8))[_0x784e('0x2a')](handleError(_0x4e2f35,null));};exports[_0x784e('0xf6')]=function(_0x1e2ecd,_0x55f3dc,_0x1fa868){return db[_0x784e('0xd7')][_0x784e('0x64')]({'where':{'id':_0x1e2ecd['params']['id']}})['then'](handleEntityNotFound(_0x55f3dc,null))[_0x784e('0x21')](function(_0x206185){if(_0x206185){return _0x206185[_0x784e('0xf6')](_0x1e2ecd[_0x784e('0x79')]['ids'],_['omit'](_0x1e2ecd['body'],['ids','id'])||{});}})[_0x784e('0x21')](respondWithResult(_0x55f3dc,null))[_0x784e('0x2a')](handleError(_0x55f3dc,null));};exports[_0x784e('0xf7')]=function(_0x58945d,_0x552963,_0x1949d4){var _0xae4c88={'raw':![],'where':{}};var _0x2777ba={};var _0x50908e={'count':0x0,'rows':[]};return db[_0x784e('0xa4')][_0x784e('0xcb')]({'where':{'id':_0x58945d[_0x784e('0xb9')]['id']}})[_0x784e('0x21')](handleEntityNotFound(_0x552963,null))['then'](function(_0x2b8e81){if(_0x2b8e81){_0x2777ba[_0x784e('0x42')]=_[_0x784e('0x7a')](db['ChatMessage'][_0x784e('0xba')]);_0x2777ba[_0x784e('0x43')]=_[_0x784e('0x7a')](_0x58945d[_0x784e('0x43')]);_0x2777ba[_0x784e('0x44')]=_[_0x784e('0x45')](_0x2777ba[_0x784e('0x42')],_0x2777ba[_0x784e('0x43')]);_0xae4c88[_0x784e('0x47')]=_[_0x784e('0x45')](_0x2777ba[_0x784e('0x42')],qs['fields'](_0x58945d['query'][_0x784e('0x46')]));_0xae4c88[_0x784e('0x47')]=_0xae4c88['attributes'][_0x784e('0x48')]?_0xae4c88[_0x784e('0x47')]:_0x2777ba[_0x784e('0x42')];if(!_0x58945d[_0x784e('0x43')][_0x784e('0xf8')](_0x784e('0x49'))){_0xae4c88['limit']=qs[_0x784e('0x30')](_0x58945d[_0x784e('0x43')][_0x784e('0x30')]);_0xae4c88[_0x784e('0x2f')]=qs['offset'](_0x58945d['query'][_0x784e('0x2f')]);}_0xae4c88[_0x784e('0x4a')]=qs[_0x784e('0x4b')](_0x58945d[_0x784e('0x43')]['sort']);_0xae4c88[_0x784e('0x85')]=qs[_0x784e('0x44')](_[_0x784e('0x4c')](_0x58945d[_0x784e('0x43')],_0x2777ba[_0x784e('0x44')]));_0xae4c88['where'][_0x784e('0xb5')]=_0x2b8e81['id'];if(_0x58945d[_0x784e('0x43')][_0x784e('0x8e')]){_0xae4c88[_0x784e('0x85')]=_[_0x784e('0xa3')](_0xae4c88[_0x784e('0x85')],{'$or':_[_0x784e('0x39')](_0xae4c88[_0x784e('0x47')],function(_0x4052c7){var _0x32305f={};_0x32305f[_0x4052c7]={'$like':'%'+_0x58945d[_0x784e('0x43')][_0x784e('0x8e')]+'%'};return _0x32305f;})});}if(_0x58945d[_0x784e('0x43')][_0x784e('0x83')]){var _0x2aba31=_0x58945d[_0x784e('0x43')]['$gte']['split'](',');var _0x20da90={};_0x20da90[_0x2aba31[0x0]]={'$gte':moment(_0x2aba31[0x1])[_0x784e('0xd4')](_0x784e('0xf9'))};_0xae4c88[_0x784e('0x85')]=_['merge'](_0xae4c88[_0x784e('0x85')],_0x20da90);}_0xae4c88=_[_0x784e('0xa3')]({},_0xae4c88,_0x58945d[_0x784e('0xbc')]);return db[_0x784e('0xd7')][_0x784e('0x2e')]({'where':_0xae4c88[_0x784e('0x85')]})[_0x784e('0x21')](function(_0x417abe){_0x50908e[_0x784e('0x2e')]=_0x417abe;if(_0x58945d[_0x784e('0x43')]['includeAll']){_0xae4c88[_0x784e('0xbb')]=[{'all':!![]}];}return db[_0x784e('0xd7')][_0x784e('0xfa')](_0xae4c88);})[_0x784e('0x21')](function(_0x1b57ac){_0x50908e['rows']=_0x1b57ac;return _0x50908e;});}})[_0x784e('0x21')](respondWithFilteredResult(_0x552963,_0xae4c88))[_0x784e('0x2a')](handleError(_0x552963,null));};exports['getMyMessages']=function(_0x5c9408,_0x8c778f,_0x40767b){var _0x5bf447={'where':{}},_0x2ade01={},_0x248ea9={'count':0x0,'rows':[]};return db[_0x784e('0xa4')][_0x784e('0xcb')]({'where':{'id':_0x5c9408[_0x784e('0xb9')]['id']}})[_0x784e('0x21')](handleEntityNotFound(_0x8c778f,null))[_0x784e('0x21')](function(_0x14f194){if(_0x14f194){_0x2ade01[_0x784e('0x42')]=_[_0x784e('0x7a')](db[_0x784e('0xd7')]['rawAttributes']);_0x2ade01['query']=_[_0x784e('0x7a')](_0x5c9408[_0x784e('0x43')]);_0x2ade01[_0x784e('0x44')]=_['intersection'](_0x2ade01['model'],_0x2ade01[_0x784e('0x43')]);_0x5bf447[_0x784e('0x47')]=_[_0x784e('0x45')](_0x2ade01[_0x784e('0x42')],qs[_0x784e('0x46')](_0x5c9408[_0x784e('0x43')]['fields']));_0x5bf447[_0x784e('0x47')]=_0x5bf447['attributes'][_0x784e('0x48')]?_0x5bf447[_0x784e('0x47')]:_0x2ade01['model'];if(!_0x5c9408[_0x784e('0x43')][_0x784e('0xf8')]('nolimit')){_0x5bf447['limit']=qs[_0x784e('0x30')](_0x5c9408[_0x784e('0x43')]['limit']);_0x5bf447[_0x784e('0x2f')]=qs[_0x784e('0x2f')](_0x5c9408[_0x784e('0x43')]['offset']);}_0x5bf447[_0x784e('0x4a')]=qs[_0x784e('0x4b')](_0x5c9408['query'][_0x784e('0x4b')]);_0x5bf447[_0x784e('0x85')]=qs[_0x784e('0x44')](_['pick'](_0x5c9408['query'],_0x2ade01[_0x784e('0x44')]));_0x5bf447[_0x784e('0x85')][_0x784e('0xb5')]=_0x14f194['id'];if(_0x5c9408[_0x784e('0x43')][_0x784e('0x8e')]){_0x5bf447[_0x784e('0x85')]=_[_0x784e('0xa3')](_0x5bf447['where'],{'$or':_['map'](_0x5bf447['attributes'],function(_0x52fa6d){var _0x2e5384={};_0x2e5384[_0x52fa6d]={'$like':'%'+_0x5c9408[_0x784e('0x43')][_0x784e('0x8e')]+'%'};return _0x2e5384;})});}_0x5bf447[_0x784e('0x85')][_0x784e('0xe8')]=![];if(_0x5c9408['query']['id']){_0x5bf447[_0x784e('0x85')]['id']={'$gt':_0x5c9408['query']['id']};}_0x5bf447=_[_0x784e('0xa3')]({},_0x5bf447,_0x5c9408[_0x784e('0xbc')]);return db[_0x784e('0xd7')][_0x784e('0x2e')]({'where':_0x5bf447[_0x784e('0x85')]})['then'](function(_0xfb33d){_0x248ea9[_0x784e('0x2e')]=_0xfb33d;_0x5bf447['include']=[];if(_0x5c9408['query']['includeAgent']){_0x5bf447[_0x784e('0xbb')][_0x784e('0x3d')]({'model':db[_0x784e('0x75')],'as':_0x784e('0x75'),'attributes':['id',_0x784e('0xe3'),_0x784e('0xe2')]});}if(_0x5c9408['query']['includeAll']){_0x5bf447[_0x784e('0xbb')]=[{'all':!![]}];}return db[_0x784e('0xd7')]['findAll'](_0x5bf447);})[_0x784e('0x21')](function(_0x4cbd1b){_0x248ea9[_0x784e('0xb7')]=_0x4cbd1b;return _0x248ea9;});}})[_0x784e('0x21')](respondWithFilteredResult(_0x8c778f,_0x5bf447))[_0x784e('0x2a')](handleError(_0x8c778f,null));};exports['addTags']=function(_0x3dc0e2,_0x225c9a,_0x3f325f){return db[_0x784e('0xa4')][_0x784e('0x64')]({'where':{'id':_0x3dc0e2[_0x784e('0xb9')]['id']}})['then'](handleEntityNotFound(_0x225c9a,null))['then'](function(_0x64c755){if(_0x64c755){return _0x64c755[_0x784e('0xfb')](_0x3dc0e2[_0x784e('0x79')][_0x784e('0xfc')],_[_0x784e('0xfd')](_0x3dc0e2[_0x784e('0x79')],['ids','id'])||{})[_0x784e('0xfe')](function(){return db[_0x784e('0xff')]['findAll']({'attributes':['id',_0x784e('0x36'),'color'],'where':{'id':_0x3dc0e2[_0x784e('0x79')][_0x784e('0xfc')]}});})[_0x784e('0x21')](function(_0x43485c){socket[_0x784e('0x100')](_0x784e('0x101'),{'id':Number(_0x3dc0e2[_0x784e('0xb9')]['id']),'tags':_0x43485c||[]});return{'id':Number(_0x3dc0e2[_0x784e('0xb9')]['id']),'tags':_0x43485c||[]};});}})['then'](respondWithResult(_0x225c9a,null))[_0x784e('0x2a')](handleError(_0x225c9a,null));};exports[_0x784e('0x102')]=function(_0x20ff96,_0x291c9b,_0x3885a2){return db['ChatInteraction'][_0x784e('0x64')]({'where':{'id':_0x20ff96['params']['id']}})['then'](handleEntityNotFound(_0x291c9b,null))[_0x784e('0x21')](function(_0x28819e){if(_0x28819e){return _0x28819e[_0x784e('0x102')](_0x20ff96[_0x784e('0x43')][_0x784e('0xfc')]);}})[_0x784e('0x21')](respondWithStatusCode(_0x291c9b,null))['catch'](handleError(_0x291c9b,null));};exports[_0x784e('0xce')]=function(_0x32b484,_0x345b53){var _0x803011=moment()[_0x784e('0x103')]()[_0x784e('0xa2')]();var _0x5a35ae=path[_0x784e('0xcf')](config[_0x784e('0xd0')],'server','files',_0x784e('0x104'));var _0xc8ffee=path[_0x784e('0xcf')](config[_0x784e('0xd0')],_0x784e('0x105'),_0x784e('0x106'),_0x784e('0x107'));var _0x568cd5=path['join'](_0x5a35ae,_0x803011);var _0x1dba3c=util[_0x784e('0xd4')](_0x784e('0x108'),_0x32b484[_0x784e('0xb9')]['id'],_0x803011);var _0x42b7de=path[_0x784e('0xcf')](_0x5a35ae,_0x1dba3c);var _0x1f3dfa=[];_0x1f3dfa['push']({'model':db['User'],'as':_0x784e('0x75'),'attributes':['id',_0x784e('0xe3')],'raw':!![]});_0x1f3dfa[_0x784e('0x3d')]({'model':db['CmContact'],'as':_0x784e('0x6a'),'attributes':['id','firstName','lastName'],'raw':!![]});if(_0x32b484[_0x784e('0x43')][_0x784e('0x107')]){_0x1f3dfa[_0x784e('0x3d')]({'model':db[_0x784e('0xca')],'as':_0x784e('0xca'),'raw':!![]});}var _0x46e3a0=[{'model':db[_0x784e('0xd7')],'as':_0x784e('0xd8'),'attributes':['id',_0x784e('0x79'),_0x784e('0x81'),'direction','secret','read'],'include':_0x1f3dfa}];_0x46e3a0[_0x784e('0x3d')]({'model':db[_0x784e('0xd9')],'as':_0x784e('0x109'),'attributes':['id','name']});_0x46e3a0[_0x784e('0x3d')]({'model':db[_0x784e('0x75')],'as':'Owner','attributes':['id',_0x784e('0xe3')]});return db['ChatInteraction'][_0x784e('0x64')]({'where':{'id':_0x32b484[_0x784e('0xb9')]['id']},'include':_0x46e3a0})[_0x784e('0x21')](handleEntityNotFound(_0x345b53,null))[_0x784e('0x21')](function(_0x338594){if(_0x338594){var _0x2dbe7a=_0x338594[_0x784e('0x10a')]({'plain':!![]});fs[_0x784e('0x10b')](_0x568cd5);var _0x2ff394={'format':'A4','border':_0x784e('0x10c'),'header':{'height':_0x784e('0x10d'),'contents':{'first':_0x784e('0x10e')}},'footer':{'height':'30px','contents':{'default':util[_0x784e('0xd4')](_0x784e('0x10f'),util[_0x784e('0xd4')]('%s\x20#%d',_0x784e('0x110'),_0x2dbe7a['id']),moment()[_0x784e('0xd4')](_0x784e('0x111'))['toString']())}}};var _0x43960e={'channel':'Chat','account':_0x2dbe7a['Account'][_0x784e('0x36')],'agent':_0x2dbe7a[_0x784e('0x112')]?_0x2dbe7a[_0x784e('0x112')][_0x784e('0xe3')]:_0x784e('0x113'),'createdAt':moment(_0x2dbe7a[_0x784e('0x81')])[_0x784e('0xd4')](_0x784e('0xf9'))[_0x784e('0xa2')](),'closedAt':_0x2dbe7a[_0x784e('0xc3')]?moment(_0x2dbe7a[_0x784e('0x114')])[_0x784e('0xd4')](_0x784e('0xf9'))[_0x784e('0xa2')]():'','disposition':_0x2dbe7a[_0x784e('0xc4')],'chatInfo':{'browser':_0x2dbe7a[_0x784e('0x115')],'os':_0x2dbe7a[_0x784e('0x116')],'referer':_0x2dbe7a['referer'],'customerIp':_0x2dbe7a[_0x784e('0x117')],'customerPort':_0x2dbe7a[_0x784e('0x118')]?_0x2dbe7a['customerPort']:_0x784e('0x113')},'messages':_(_0x2dbe7a['Messages'])[_0x784e('0x119')]()[_0x784e('0x8e')]({'secret':![]})[_0x784e('0x39')](function(_0x46603a){if(_0x46603a['Attachment']){var _0x504a52=path[_0x784e('0xcf')](_0xc8ffee,_0x46603a[_0x784e('0xca')][_0x784e('0xc7')]);if(fs[_0x784e('0x11a')](_0x504a52)){fs['createReadStream'](_0x504a52)[_0x784e('0x11b')](fs['createWriteStream'](path[_0x784e('0xcf')](_0x568cd5,_0x46603a[_0x784e('0xca')][_0x784e('0xc7')])));}}return{'date':moment(_0x46603a['createdAt'])[_0x784e('0xd4')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'sender':_0x46603a[_0x784e('0xe7')]===_0x784e('0x11c')?_0x46603a[_0x784e('0x75')]?_0x46603a['User'][_0x784e('0xe3')]:'System':_0x46603a[_0x784e('0x6a')]['firstName']+(_0x46603a[_0x784e('0x6a')][_0x784e('0x11d')]?'\x20'+_0x46603a[_0x784e('0x6a')][_0x784e('0x11d')]:''),'body':_0x46603a[_0x784e('0xca')]?_0x46603a[_0x784e('0xca')][_0x784e('0xc7')]:_0x46603a[_0x784e('0x79')],'direction':_0x46603a[_0x784e('0xe7')]===_0x784e('0x11c')?'A':'C','secret':_0x46603a['secret'],'read':_0x46603a[_0x784e('0x8a')],'attachment':_0x46603a[_0x784e('0xca')]};})[_0x784e('0x66')]()};return ejs[_0x784e('0x11e')](path[_0x784e('0xcf')](config[_0x784e('0xd0')],_0x784e('0x105'),_0x784e('0x11f'),_0x784e('0x120')),{'interaction':_0x43960e})[_0x784e('0x21')](function(_0x2dfe52){return new BPromise(function(_0x2a9812,_0x200814){pdf[_0x784e('0xbd')](_0x2dfe52,_0x2ff394)[_0x784e('0x121')](path[_0x784e('0xcf')](_0x568cd5,'transcript-'+_0x2dbe7a['id']+'-'+_0x803011+_0x784e('0x122')),function(_0x4689e7,_0x506588){if(_0x4689e7)return _0x200814(_0x4689e7);_0x2a9812(_0x506588);});});})['then'](function(){return new BPromise(function(_0x222523,_0x2d261c){zipdir(_0x568cd5,{'saveTo':_0x42b7de},function(_0x4e8662,_0x117c2e){if(_0x4e8662)return _0x2d261c(_0x4e8662);return _0x222523(_0x117c2e);});})[_0x784e('0x21')](function(){return new BPromise(function(_0x4fa6c3,_0x1b709c){rimraf(_0x568cd5,function(_0x27c406){if(_0x27c406)_0x1b709c(_0x27c406);return _0x4fa6c3();});});})['then'](function(){return _0x345b53[_0x784e('0xce')](_0x42b7de,_0x1dba3c,function(_0x153fab){if(_0x153fab){console[_0x784e('0x123')](_0x784e('0x124'),_0x153fab);}else{fs['unlinkSync'](_0x42b7de);}});});});}else{return _0x345b53[_0x784e('0x2b')](0xc8);}})[_0x784e('0x2a')](handleError(_0x345b53,null));}; \ No newline at end of file +var _0x53ec=['abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','Interaction\x20already\x20assigned','disposition','AbandonInteraction','file','originalname','basename','mimetype','Attachment','attachmentDownload','findOne','Unauthorized','attachId','download','join','root','server/files/chat/upload/','now','pathTranscript','Messages','User','ChatWebsite','CmContact','format','%s%d','agentAlias','System','customer','agentIdentifier','website_alias','agent_alias','alias','fullname','agent_fullname','[%s]\x20%s:\x20%s\x0a','MM/DD/YYYY\x20HH:mm:ss','direction','appendFileSync','MailAccount','MailServerOut','Smtp','service','host','port','secure','auth','pass','sendMail','email','mailTranscript','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ChatMessage','ids','getMessages','YYYY-MM-DD\x20HH:mm:ss','findAll','getMyMessages','secret','includeAgent','addTags','setTags','omit','spread','color','emit','removeTags','unix','server','files','attachments','transcript-%d-%s.zip','lastName','Account','Owner','get','mkdirSync','30px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','%s\x20#%d','Chat','YYYY-MM-DD','N.A.','closed','closedAt','osName','referer','customerIp','customerPort','tail','existsSync','createReadStream','pipe','createWriteStream','out','renderFile','downloadInteraction.html','toFile','transcript-','.pdf','log','err','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../mysqldb','redis','defaults','./chatInteraction.socket','register','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','status','json','count','offset','set','apply','reject','save','update','destroy','sendStatus','name','send','Users','map','TagIds','Tags','split','forEach','index','fieldName','type','key','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','select','field','tools_tags','u.id','u.fullname','ui.ChatInteractionId','from','user_has_chat_interactions','users','chat_interactions','left_join','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','chat_websites','a.id\x20=\x20i.ChatWebsiteId','chat_messages','me.ChatInteractionId\x20=\x20i.id','it.ChatInteractionId\x20=\x20i.id','expr','parseSearch','sqlOperator','find','unreadMessages','`\x20=\x200','having','`\x20>\x200','Contact','operator','$substring','value','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','end','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','text','start','body','keys','some','compact','isEmpty','i.ChatWebsiteId\x20IN\x20?','createdAt','$gte','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','\x27\x27\x27\x27','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','SELECT','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','t.id\x20IN\x20?','resolve','ChatWebsiteId','journey','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','i.ChatWebsiteId\x20IS\x20NULL','toString','sequelize','merge','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.lastName','Contact.lastName','Contact.email','c.phone','Contact.phone','c.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.ChatInteractionId\x20IN\x20?','ChatInteractionId','push','all','rows','params','ChatInteraction','rawAttributes','includeAll','include','options','create','describe','customUpdate','abandon'];(function(_0x30fe13,_0x208435){var _0x4f6c29=function(_0x16864c){while(--_0x16864c){_0x30fe13['push'](_0x30fe13['shift']());}};_0x4f6c29(++_0x208435);}(_0x53ec,0x192));var _0xc53e=function(_0x1c0781,_0x4a19f1){_0x1c0781=_0x1c0781-0x0;var _0x1f577e=_0x53ec[_0x1c0781];return _0x1f577e;};'use strict';var pdf=require(_0xc53e('0x0'));var emlformat=require(_0xc53e('0x1'));var rimraf=require(_0xc53e('0x2'));var zipdir=require(_0xc53e('0x3'));var jsonpatch=require(_0xc53e('0x4'));var rp=require(_0xc53e('0x5'));var moment=require('moment');var BPromise=require(_0xc53e('0x6'));var Mustache=require('mustache');var util=require(_0xc53e('0x7'));var path=require(_0xc53e('0x8'));var sox=require('sox');var csv=require(_0xc53e('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xc53e('0xa'));var squel=require(_0xc53e('0xb'));var crypto=require('crypto');var jsforce=require(_0xc53e('0xc'));var deskjs=require(_0xc53e('0xd'));var toCsv=require(_0xc53e('0x9'));var querystring=require(_0xc53e('0xe'));var Papa=require(_0xc53e('0xf'));var Redis=require(_0xc53e('0x10'));var authService=require(_0xc53e('0x11'));var qs=require(_0xc53e('0x12'));var as=require(_0xc53e('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xc53e('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xc53e('0x15'))['db'];config[_0xc53e('0x16')]=_[_0xc53e('0x17')](config[_0xc53e('0x16')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc53e('0x16')]));require(_0xc53e('0x18'))[_0xc53e('0x19')](socket);var jayson=require(_0xc53e('0x1a'));var client=jayson[_0xc53e('0x1b')][_0xc53e('0x1c')]({'port':0x232b});var client9004=jayson[_0xc53e('0x1b')][_0xc53e('0x1c')]({'port':0x232c});function checkPasswordPattern(_0x455e4d,_0x2ad6eb,_0x5b0a88){if(_0x5b0a88){var _0x8a522e=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x8a522e[_0xc53e('0x1d')](_0x2ad6eb)){return _0x455e4d;}else{throw new db[(_0xc53e('0x1e'))][(_0xc53e('0x1f'))](_0xc53e('0x20'));}}else{return _0x455e4d;}}function respondWithRpcPromise(_0x270c78,_0x164016,_0x2d4ebb,_0x3b550e){return new BPromise(function(_0x5d1098,_0x546fab){var _0x35b7b2=_0x3b550e||client;return _0x35b7b2[_0xc53e('0x21')](_0x270c78,_0x2d4ebb)[_0xc53e('0x22')](function(_0x2e85df){logger[_0xc53e('0x23')](_0xc53e('0x24'),_0x164016,_0xc53e('0x25'));logger[_0xc53e('0x26')](_0xc53e('0x27'),_0x164016,_0xc53e('0x25'),JSON[_0xc53e('0x28')](_0x2e85df));if(_0x2e85df[_0xc53e('0x29')]){if(_0x2e85df[_0xc53e('0x29')]['code']===0x1f4){logger['error']('ChatInteraction,\x20%s,\x20%s',_0x164016,_0x2e85df[_0xc53e('0x29')][_0xc53e('0x2a')]);return _0x546fab(_0x2e85df[_0xc53e('0x29')][_0xc53e('0x2a')]);}logger[_0xc53e('0x29')]('ChatInteraction,\x20%s,\x20%s',_0x164016,_0x2e85df['error'][_0xc53e('0x2a')]);return _0x5d1098(_0x2e85df['error'][_0xc53e('0x2a')]);}else{logger[_0xc53e('0x23')](_0xc53e('0x24'),_0x164016,_0xc53e('0x25'));_0x5d1098(_0x2e85df[_0xc53e('0x2b')]['message']);}})[_0xc53e('0x2c')](function(_0x4b9f6a){logger['error']('ChatInteraction,\x20%s,\x20%s',_0x164016,_0x4b9f6a);_0x546fab(_0x4b9f6a);});});}function respondWithStatusCode(_0x3c5056,_0x57a1f5){_0x57a1f5=_0x57a1f5||0xcc;return function(_0x28240a){if(_0x28240a){return _0x3c5056['sendStatus'](_0x57a1f5);}return _0x3c5056[_0xc53e('0x2d')](_0x57a1f5)['end']();};}function respondWithResult(_0x5ce216,_0x8f0ee6){_0x8f0ee6=_0x8f0ee6||0xc8;return function(_0x6a62b0){if(_0x6a62b0){return _0x5ce216[_0xc53e('0x2d')](_0x8f0ee6)[_0xc53e('0x2e')](_0x6a62b0);}};}function respondWithFilteredResult(_0x6415f6,_0xf97d78){return function(_0x3280fe){if(_0x3280fe){var _0x2a2ca9=_0x3280fe[_0xc53e('0x2f')],_0x4ace0b=_0xf97d78['offset'],_0x437893=_0xf97d78[_0xc53e('0x30')]+_0xf97d78['limit'],_0x311835;if(_0x437893>=_0x2a2ca9){_0x437893=_0x2a2ca9;_0x311835=0xc8;}else{_0x311835=0xce;}_0x6415f6[_0xc53e('0x2d')](_0x311835);return _0x6415f6[_0xc53e('0x31')]('Content-Range',_0x4ace0b+'-'+_0x437893+'/'+_0x2a2ca9)['json'](_0x3280fe);}return null;};}function patchUpdates(_0x3cd8a1){return function(_0x42efad){try{jsonpatch[_0xc53e('0x32')](_0x42efad,_0x3cd8a1,!![]);}catch(_0x30d037){return BPromise[_0xc53e('0x33')](_0x30d037);}return _0x42efad[_0xc53e('0x34')]();};}function saveUpdates(_0x40a8db,_0x168d25){return function(_0x4ffddc){if(_0x4ffddc){return _0x4ffddc[_0xc53e('0x35')](_0x40a8db)[_0xc53e('0x22')](function(_0x19020b){return _0x19020b;});}return null;};}function removeEntity(_0x17ad32,_0x1eca5b){return function(_0x12b32c){if(_0x12b32c){return _0x12b32c[_0xc53e('0x36')]()[_0xc53e('0x22')](function(){_0x17ad32[_0xc53e('0x2d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e395c,_0x48d7d0){return function(_0x1059f3){if(!_0x1059f3){_0x3e395c[_0xc53e('0x37')](0x194);}return _0x1059f3;};}function handleError(_0x5e9377,_0x37452a){_0x37452a=_0x37452a||0x1f4;return function(_0x154f8b){logger[_0xc53e('0x29')](_0x154f8b['stack']);if(_0x154f8b[_0xc53e('0x38')]){delete _0x154f8b[_0xc53e('0x38')];}_0x5e9377[_0xc53e('0x2d')](_0x37452a)[_0xc53e('0x39')](_0x154f8b);};}function getInteractionUsers(_0xeaec72,_0x143101){return new BPromise(function(_0x312c1b,_0x482085){try{if(_0x143101[_0xeaec72['id']]){_0xeaec72[_0xc53e('0x3a')]=_[_0xc53e('0x3b')](_0x143101[_0xeaec72['id']],function(_0x2db711){return{'id':_0x2db711['id'],'fullname':_0x2db711['fullname']};});}}catch(_0x70b6c3){_0x482085(_0x70b6c3);}_0x312c1b(_0xeaec72);});}function getInteractionTags(_0x5e8ab7,_0xaa00cd){return new BPromise(function(_0x15052d,_0x40c4f5){try{if(_0x5e8ab7[_0xc53e('0x3c')]){_0x5e8ab7[_0xc53e('0x3d')]=[];_0x5e8ab7['TagIds'][_0xc53e('0x3e')](',')[_0xc53e('0x3f')](function(_0x4a5529){_0x5e8ab7['Tags']['push'](_0xaa00cd[_0x4a5529]);});}delete _0x5e8ab7['TagIds'];}catch(_0x1e2ea3){_0x40c4f5(_0x1e2ea3);}_0x15052d(_0x5e8ab7);});}function updateChatInteraction(_0x9c3816,_0x49bd2c,_0x460ee6){return new BPromise(function(_0x574983,_0x55d07d){return getInteractionUsers(_0x9c3816,_0x460ee6)['then'](function(_0x255794){return getInteractionTags(_0x255794,_0x49bd2c);})['then'](function(_0x502ece){_0x574983(_0x502ece);})[_0xc53e('0x2c')](function(_0x53a82f){_0x55d07d(_0x53a82f);});});}exports[_0xc53e('0x40')]=function(_0x360af9,_0x49f204){var _0x19869a={},_0x3a4ebc={},_0x509a04={'count':0x0,'rows':[]};var _0x2ebce7=_['map'](db['ChatInteraction']['rawAttributes'],function(_0x4efee5){return{'name':_0x4efee5[_0xc53e('0x41')],'type':_0x4efee5[_0xc53e('0x42')][_0xc53e('0x43')]};});_0x3a4ebc['model']=_[_0xc53e('0x3b')](_0x2ebce7,_0xc53e('0x38'));_0x3a4ebc['query']=_['keys'](_0x360af9[_0xc53e('0x44')]);_0x3a4ebc[_0xc53e('0x45')]=_[_0xc53e('0x46')](_0x3a4ebc['model'],_0x3a4ebc[_0xc53e('0x44')]);_0x19869a[_0xc53e('0x47')]=_[_0xc53e('0x46')](_0x3a4ebc[_0xc53e('0x48')],qs[_0xc53e('0x49')](_0x360af9[_0xc53e('0x44')][_0xc53e('0x49')]));_0x19869a['attributes']=_0x19869a[_0xc53e('0x47')][_0xc53e('0x4a')]?_0x19869a[_0xc53e('0x47')]:_0x3a4ebc['model'];if(!_0x360af9[_0xc53e('0x44')][_0xc53e('0x4b')](_0xc53e('0x4c'))){_0x19869a[_0xc53e('0x4d')]=qs[_0xc53e('0x4d')](_0x360af9[_0xc53e('0x44')]['limit']);_0x19869a[_0xc53e('0x30')]=qs[_0xc53e('0x30')](_0x360af9[_0xc53e('0x44')]['offset']);}_0x19869a[_0xc53e('0x4e')]=qs[_0xc53e('0x4f')](_0x360af9[_0xc53e('0x44')][_0xc53e('0x4f')]);_0x19869a[_0xc53e('0x50')]=qs[_0xc53e('0x45')](_[_0xc53e('0x51')](_0x360af9[_0xc53e('0x44')],_0x3a4ebc[_0xc53e('0x45')]));var _0x430512=[];var _0x4dbf11=squel[_0xc53e('0x52')]()[_0xc53e('0x53')]('id')[_0xc53e('0x53')](_0xc53e('0x38'))[_0xc53e('0x53')]('color')['from'](_0xc53e('0x54'));var _0x51f034=squel[_0xc53e('0x52')]()['field'](_0xc53e('0x55'))[_0xc53e('0x53')](_0xc53e('0x56'))['field'](_0xc53e('0x57'))[_0xc53e('0x58')](_0xc53e('0x59'),'ui')['left_join'](_0xc53e('0x5a'),'u','u.id\x20=\x20ui.UserId');var _0x2be75c=squel[_0xc53e('0x52')]()['from'](_0xc53e('0x5b'),'i')[_0xc53e('0x5c')]('cm_contacts','c',_0xc53e('0x5d'))[_0xc53e('0x5c')](_0xc53e('0x5a'),'o',_0xc53e('0x5e'))[_0xc53e('0x5c')](_0xc53e('0x5f'),'a',_0xc53e('0x60'))[_0xc53e('0x5c')](_0xc53e('0x61'),'me',_0xc53e('0x62'))[_0xc53e('0x5c')]('chat_interaction_has_tags','it',_0xc53e('0x63'))['left_join'](_0xc53e('0x54'),'t','t.id\x20=\x20it.TagId');var _0x45914c=squel[_0xc53e('0x64')]();var _0x5228e7=[];var _0xfc2fab=squel[_0xc53e('0x64')]();var _0x9c0112;if(_0x360af9[_0xc53e('0x44')]['search']){_0x9c0112=as[_0xc53e('0x65')](_0x360af9[_0xc53e('0x44')]['search']);var _0x5ea1da=_0x9c0112[_0xc53e('0x66')];for(var _0x51db9a=0x0;_0x51db9a<_0x9c0112['conditions']['length'];_0x51db9a++){var _0x23a4ee=_0x9c0112['conditions'][_0x51db9a];var _0x32b390='i';var _0x4ee995=_[_0xc53e('0x67')](_0x2ebce7,[_0xc53e('0x38'),_0x23a4ee[_0xc53e('0x53')]]);if(!_0x4ee995){switch(_0x23a4ee[_0xc53e('0x53')]){case _0xc53e('0x68'):if(_0x23a4ee['value']==0x1){_0x2be75c['having']('`'+_0x23a4ee[_0xc53e('0x53')]+_0xc53e('0x69'));}else{_0x2be75c[_0xc53e('0x6a')]('`'+_0x23a4ee[_0xc53e('0x53')]+_0xc53e('0x6b'));}break;case _0xc53e('0x6c'):if(_0x23a4ee[_0xc53e('0x6d')]===_0xc53e('0x6e')){if(_0x23a4ee[_0xc53e('0x6f')][_0xc53e('0x3e')]('\x20')[_0xc53e('0x4a')]>0x1){_0x45914c[_0x5ea1da](_0xc53e('0x70'),qs[_0xc53e('0x71')](_0x23a4ee['value']),null);}else{var _0xb4ef48='%'+_0x23a4ee['value']+'%';_0x45914c[_0x5ea1da](_0xc53e('0x72'),_0xb4ef48,_0xb4ef48,_0xb4ef48);}}else{_0x4ee995=_[_0xc53e('0x67')](_0x2ebce7,[_0xc53e('0x38'),_0xc53e('0x73')]);_0x23a4ee[_0xc53e('0x53')]=_0xc53e('0x73');_0x22f311=as[_0xc53e('0x74')](_0x32b390,_0x4ee995[_0xc53e('0x42')],_0x23a4ee);_0x45914c[_0x5ea1da](_0x22f311['text'],_0x22f311['value']['start'],_0x22f311[_0xc53e('0x6f')][_0xc53e('0x75')]);}break;case _0xc53e('0x76'):var _0x25e4b6=_0x23a4ee[_0xc53e('0x6f')][_0xc53e('0x3e')](',')[_0xc53e('0x3b')](function(_0x5a9596){return Number(_0x5a9596);});_0x25e4b6['forEach'](function(_0x5961bb){_0xfc2fab['or'](_0xc53e('0x77'),'%,'+_0x5961bb+',%');});_0x5228e7=_[_0xc53e('0x78')](_0x5228e7,_0x25e4b6);break;case'User':if(_0x23a4ee[_0xc53e('0x6d')]===_0xc53e('0x6e')){_0x45914c[_0x5ea1da](_0xc53e('0x79'),'%'+_0x23a4ee[_0xc53e('0x6f')]+'%',null);}else{_0x4ee995=_[_0xc53e('0x67')](_0x2ebce7,[_0xc53e('0x38'),'UserId']);_0x23a4ee['field']=_0xc53e('0x7a');_0x22f311=as[_0xc53e('0x74')](_0x32b390,_0x4ee995[_0xc53e('0x42')],_0x23a4ee);_0x45914c[_0x5ea1da](_0x22f311[_0xc53e('0x7b')],_0x22f311[_0xc53e('0x6f')][_0xc53e('0x7c')],_0x22f311['value'][_0xc53e('0x75')]);}break;case _0xc53e('0x7d'):_0x22f311=as[_0xc53e('0x74')]('me',null,_0x23a4ee);_0x45914c[_0x5ea1da](_0x22f311[_0xc53e('0x7b')],_0x22f311['value'][_0xc53e('0x7c')],_0x22f311[_0xc53e('0x6f')][_0xc53e('0x75')]);break;}}else{var _0x22f311=as[_0xc53e('0x74')](_0x32b390,_0x4ee995[_0xc53e('0x42')],_0x23a4ee);_0x45914c[_0x5ea1da](_0x22f311['text'],_0x22f311[_0xc53e('0x6f')][_0xc53e('0x7c')],_0x22f311[_0xc53e('0x6f')][_0xc53e('0x75')]);}}}else{var _0x548d63=_(_0x360af9['query'])[_0xc53e('0x7e')]()[_0xc53e('0x3b')](function(_0x21f9cb){return _[_0xc53e('0x7f')](_0x2ebce7,['name',_0x21f9cb])?_0x21f9cb:undefined;})[_0xc53e('0x80')]()['value']();if(!_[_0xc53e('0x81')](_0x548d63)){_0x548d63['forEach'](function(_0x107bca){if(_0x107bca==='ChatWebsiteId'){_0x2be75c[_0xc53e('0x50')](_0xc53e('0x82'),[]['concat'](_0x360af9[_0xc53e('0x44')][_0x107bca]));}else if(_0x107bca===_0xc53e('0x83')){var _0x4d13a0=JSON['parse'](_0x360af9[_0xc53e('0x44')][_0x107bca])[_0xc53e('0x84')];var _0x529555=JSON['parse'](_0x360af9[_0xc53e('0x44')][_0x107bca])['$lte'];_0x2be75c[_0xc53e('0x50')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x4d13a0,_0x529555);}else{if(_0x360af9[_0xc53e('0x44')][_0x107bca]===_0xc53e('0x85')){_0x2be75c[_0xc53e('0x50')]('i.'+_0x107bca+_0xc53e('0x86'));}else{_0x2be75c[_0xc53e('0x50')]('i.'+_0x107bca+_0xc53e('0x87'),_0x360af9[_0xc53e('0x44')][_0x107bca]);}}});}if(_0x360af9[_0xc53e('0x44')][_0xc53e('0x88')]){if(_0x360af9[_0xc53e('0x44')]['read']==0x1){_0x2be75c[_0xc53e('0x6a')]('`unreadMessages`\x20=\x200');}else{_0x2be75c[_0xc53e('0x6a')](_0xc53e('0x89'));}}if(_0x360af9[_0xc53e('0x44')][_0xc53e('0x8a')]){_0x5228e7=_[_0xc53e('0x8b')](_0x360af9[_0xc53e('0x44')][_0xc53e('0x8a')])?_0x360af9[_0xc53e('0x44')][_0xc53e('0x8a')]:new Array(_0x360af9[_0xc53e('0x44')]['tag']);_0x5228e7[_0xc53e('0x3f')](function(_0x52dcc7){_0xfc2fab['or'](_0xc53e('0x77'),'%,'+_0x52dcc7+',%');});}if(_0x360af9[_0xc53e('0x44')][_0xc53e('0x8c')]){var _0x5afe77=_0x360af9[_0xc53e('0x44')][_0xc53e('0x8c')][_0xc53e('0x8d')]('\x5c','\x5c\x5c')[_0xc53e('0x8d')]('\x27\x27',_0xc53e('0x8e'));if(qs['isNumeric'](_0x5afe77)){_0x45914c['or'](_0xc53e('0x8f'),_0x5afe77+'%');}else{_0x45914c['or'](_0xc53e('0x90'),qs['getFullTextValue'](_0x5afe77))['or'](_0xc53e('0x91'),_0x5afe77+'%');}}}_0x2be75c[_0xc53e('0x50')](_0x45914c);_0x2be75c[_0xc53e('0x92')]('i.id');var _0x35b6dc={'type':db[_0xc53e('0x1e')]['QueryTypes'][_0xc53e('0x93')],'raw':!![]};var _0x4699b7=_0x2be75c['clone']();_0x4699b7['field'](_0xc53e('0x94'));_0x4699b7['field'](_0xc53e('0x95'),_0xc53e('0x68'));if(_0x19869a[_0xc53e('0x4e')]){_0x19869a['order'][_0xc53e('0x3f')](function(_0x2dd747){_0x2be75c[_0xc53e('0x4e')]('i.'+_0x2dd747[0x0],_0x2dd747[0x1]==='DESC'?![]:!![]);});}if(!_[_0xc53e('0x81')](_0x5228e7)){_0x2be75c[_0xc53e('0x6a')](_0xfc2fab);_0x4699b7[_0xc53e('0x50')](_0xc53e('0x96'),_0x5228e7);}BPromise[_0xc53e('0x97')]()['then'](function(){if(!_0x9c0112){if(_0x360af9[_0xc53e('0x44')][_0xc53e('0x98')]||_0x360af9[_0xc53e('0x44')][_0xc53e('0x99')])return;_0x4699b7[_0xc53e('0x50')](_0xc53e('0x9a'));_0x2be75c[_0xc53e('0x50')](_0xc53e('0x9a'));return;}return _0x360af9[_0xc53e('0x9b')]['getChatWebsites']({'attributes':['id'],'raw':!![]})[_0xc53e('0x22')](function(_0x29c941){if(_[_0xc53e('0x81')](_0x29c941)){_0x4699b7[_0xc53e('0x50')](_0xc53e('0x9c'));_0x2be75c[_0xc53e('0x50')](_0xc53e('0x9c'));}else{_0x4699b7[_0xc53e('0x50')](_0xc53e('0x82'),_['map'](_0x29c941,'id'));_0x2be75c[_0xc53e('0x50')](_0xc53e('0x82'),_[_0xc53e('0x3b')](_0x29c941,'id'));}});})[_0xc53e('0x22')](function(){db['sequelize'][_0xc53e('0x44')](_0x4699b7[_0xc53e('0x9d')](),_0x35b6dc)[_0xc53e('0x22')](function(_0x92c9bc){_0x509a04['count']=_0x92c9bc[_0xc53e('0x4a')];if(_0x509a04[_0xc53e('0x2f')]===0x0)return[];return db[_0xc53e('0x9e')][_0xc53e('0x44')](_0x4dbf11[_0xc53e('0x9d')](),_0x35b6dc)[_0xc53e('0x22')](function(_0x2ca499){_0x430512=_['keyBy'](_0x2ca499,'id');_0x35b6dc=_[_0xc53e('0x9f')](_0x35b6dc,{'model':db['ChatInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x360af9[_0xc53e('0x44')][_0xc53e('0x49')]){_0x19869a[_0xc53e('0x47')]['forEach'](function(_0x7c56eb){_0x2be75c[_0xc53e('0x53')]('i.'+_0x7c56eb);});}else{_0x2be75c[_0xc53e('0x53')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xc53e('0x68'));_0x2be75c[_0xc53e('0x53')](_0xc53e('0xa0'),'Account.key');_0x2be75c[_0xc53e('0x53')](_0xc53e('0xa1'),_0xc53e('0xa2'));_0x2be75c[_0xc53e('0x53')](_0xc53e('0xa3'));_0x2be75c['field']('c.firstName','Contact.firstName');_0x2be75c[_0xc53e('0x53')](_0xc53e('0xa4'),_0xc53e('0xa5'));_0x2be75c[_0xc53e('0x53')]('c.email',_0xc53e('0xa6'));_0x2be75c['field'](_0xc53e('0xa7'),_0xc53e('0xa8'));_0x2be75c[_0xc53e('0x53')](_0xc53e('0xa9'),'Contact.mobile');_0x2be75c[_0xc53e('0x53')](_0xc53e('0xaa'),_0xc53e('0xab'));_0x2be75c[_0xc53e('0x53')](_0xc53e('0xac'),_0xc53e('0xad'));_0x2be75c[_0xc53e('0x53')](_0xc53e('0xae'),_0xc53e('0xaf'));_0x2be75c[_0xc53e('0x53')](_0xc53e('0xb0'),_0xc53e('0x3c'));}_0x2be75c[_0xc53e('0x4d')](_0x19869a[_0xc53e('0x4d')]);_0x2be75c[_0xc53e('0x30')](_0x19869a[_0xc53e('0x30')]);return db[_0xc53e('0x9e')][_0xc53e('0x44')](_0x2be75c[_0xc53e('0x9d')](),_0x35b6dc);})[_0xc53e('0x22')](function(_0x625c01){_0x51f034[_0xc53e('0x50')](_0xc53e('0xb1'),_[_0xc53e('0x3b')](_0x625c01,'id'));return db[_0xc53e('0x9e')]['query'](_0x51f034[_0xc53e('0x9d')](),_0x35b6dc)['then'](function(_0x441f1c){var _0x3a80a5=_['groupBy'](_0x441f1c,_0xc53e('0xb2'));var _0x3f8010=[];_0x625c01[_0xc53e('0x3f')](function(_0x2c10e0){_0x3f8010[_0xc53e('0xb3')](updateChatInteraction(_0x2c10e0,_0x430512,_0x3a80a5));});return BPromise[_0xc53e('0xb4')](_0x3f8010);});});})[_0xc53e('0x22')](function(_0x3635c1){_0x509a04[_0xc53e('0xb5')]=_0x3635c1;return _0x509a04;})['then'](respondWithFilteredResult(_0x49f204,_0x19869a));})[_0xc53e('0x2c')](handleError(_0x49f204,null));};exports['show']=function(_0x41e475,_0x132b1b){var _0xb9b1c7={'raw':![],'where':{'id':_0x41e475[_0xc53e('0xb6')]['id']}},_0x69e664={};_0x69e664[_0xc53e('0x48')]=_[_0xc53e('0x7e')](db[_0xc53e('0xb7')][_0xc53e('0xb8')]);_0x69e664[_0xc53e('0x44')]=_[_0xc53e('0x7e')](_0x41e475[_0xc53e('0x44')]);_0x69e664[_0xc53e('0x45')]=_['intersection'](_0x69e664[_0xc53e('0x48')],_0x69e664['query']);_0xb9b1c7[_0xc53e('0x47')]=_[_0xc53e('0x46')](_0x69e664[_0xc53e('0x48')],qs[_0xc53e('0x49')](_0x41e475['query']['fields']));_0xb9b1c7[_0xc53e('0x47')]=_0xb9b1c7[_0xc53e('0x47')][_0xc53e('0x4a')]?_0xb9b1c7[_0xc53e('0x47')]:_0x69e664['model'];if(_0x41e475['query'][_0xc53e('0xb9')]){_0xb9b1c7[_0xc53e('0xba')]=[{'all':!![]}];}_0xb9b1c7=_[_0xc53e('0x9f')]({},_0xb9b1c7,_0x41e475[_0xc53e('0xbb')]);return db[_0xc53e('0xb7')][_0xc53e('0x67')](_0xb9b1c7)['then'](handleEntityNotFound(_0x132b1b,null))[_0xc53e('0x22')](respondWithResult(_0x132b1b,null))[_0xc53e('0x2c')](handleError(_0x132b1b,null));};exports[_0xc53e('0xbc')]=function(_0x2d8703,_0x1ba18b){return db['ChatInteraction'][_0xc53e('0xbc')](_0x2d8703[_0xc53e('0x7d')],{})[_0xc53e('0x22')](respondWithResult(_0x1ba18b,0xc9))[_0xc53e('0x2c')](handleError(_0x1ba18b,null));};exports[_0xc53e('0x35')]=function(_0x451ad3,_0x3db03c){if(_0x451ad3[_0xc53e('0x7d')]['id']){delete _0x451ad3[_0xc53e('0x7d')]['id'];}return db[_0xc53e('0xb7')][_0xc53e('0x67')]({'where':{'id':_0x451ad3[_0xc53e('0xb6')]['id']}})[_0xc53e('0x22')](handleEntityNotFound(_0x3db03c,null))['then'](saveUpdates(_0x451ad3[_0xc53e('0x7d')],null))[_0xc53e('0x22')](respondWithResult(_0x3db03c,null))['catch'](handleError(_0x3db03c,null));};exports[_0xc53e('0x36')]=function(_0x4ee56b,_0x5e5458){return db[_0xc53e('0xb7')]['find']({'where':{'id':_0x4ee56b[_0xc53e('0xb6')]['id']}})['then'](handleEntityNotFound(_0x5e5458,null))[_0xc53e('0x22')](removeEntity(_0x5e5458,null))['catch'](handleError(_0x5e5458,null));};exports[_0xc53e('0xbd')]=function(_0x376d94,_0x10ad32){return db['ChatInteraction'][_0xc53e('0xbd')]()['then'](respondWithResult(_0x10ad32,null))[_0xc53e('0x2c')](handleError(_0x10ad32,null));};exports[_0xc53e('0xbe')]=function(_0x1c3cb2,_0x1fd95d){if(_0x1c3cb2[_0xc53e('0x7d')]['id']){delete _0x1c3cb2[_0xc53e('0x7d')]['id'];}return db[_0xc53e('0xb7')][_0xc53e('0x67')]({'where':{'id':_0x1c3cb2[_0xc53e('0xb6')]['id']}})[_0xc53e('0x22')](handleEntityNotFound(_0x1fd95d,null))['then'](saveUpdates(_0x1c3cb2['body'],null))[_0xc53e('0x22')](respondWithResult(_0x1fd95d,null))['catch'](handleError(_0x1fd95d,null));};exports[_0xc53e('0xbf')]=function(_0xbc960,_0x14baae,_0x2b9785){if(_0xbc960[_0xc53e('0x7d')]['id']){delete _0xbc960[_0xc53e('0x7d')]['id'];}return db[_0xc53e('0xb7')][_0xc53e('0x67')]({'where':{'id':_0xbc960['params']['id']}})[_0xc53e('0x22')](function(_0x4e46bf){if(!_0x4e46bf){logger[_0xc53e('0x29')](_0xc53e('0xc0'),_0xc53e('0xbf'),0x194,_0xc53e('0xc1'));_0x14baae[_0xc53e('0x37')](0x194);}else{if(_0x4e46bf[_0xc53e('0x7a')]){throw new db[(_0xc53e('0x1e'))]['ValidationError'](_0xc53e('0xc2'));}}return _0x4e46bf;})[_0xc53e('0x22')](function(_0x2e09c4){if(_0x2e09c4){return _0x2e09c4[_0xc53e('0x35')]({'closed':_0xbc960[_0xc53e('0x7d')]['closed'],'disposition':_0xbc960[_0xc53e('0x7d')][_0xc53e('0xc3')]})['then'](function(_0x5253b1){return _0x5253b1;});}})[_0xc53e('0x22')](function(_0x495f8b){return respondWithRpcPromise(_0xc53e('0xc4'),_0xc53e('0xbf'),_0xbc960['body'],client9004);})['then'](respondWithResult(_0x14baae,null))[_0xc53e('0x2c')](handleError(_0x14baae,null));};exports['attachmentUpload']=function(_0x204208,_0x4d43e1,_0x25d604){_0x204208[_0xc53e('0x7d')][_0xc53e('0x38')]=_0x204208[_0xc53e('0xc5')][_0xc53e('0xc6')];_0x204208['body'][_0xc53e('0xc7')]=_0x204208['file']['filename'];_0x204208[_0xc53e('0x7d')][_0xc53e('0x42')]=_0x204208[_0xc53e('0xc5')][_0xc53e('0xc8')];return db[_0xc53e('0xc9')][_0xc53e('0xbc')](_0x204208[_0xc53e('0x7d')])[_0xc53e('0x22')](respondWithResult(_0x4d43e1,0xc9))[_0xc53e('0x2c')](handleError(_0x4d43e1,null));};exports[_0xc53e('0xca')]=function(_0x2b619d,_0x1826c,_0x55581a){return db[_0xc53e('0xb7')][_0xc53e('0xcb')]({'where':{'id':_0x2b619d[_0xc53e('0xb6')]['id']},'raw':!![]})[_0xc53e('0x22')](handleEntityNotFound(_0x1826c,null))[_0xc53e('0x22')](function(_0x5454bf){if(_0x5454bf){if(_0x5454bf['closed']){return _0x1826c[_0xc53e('0x2d')](0x193)[_0xc53e('0x2e')]({'status':0x193,'message':_0xc53e('0xcc')});}return db[_0xc53e('0xc9')][_0xc53e('0xcb')]({'where':{'id':_0x2b619d[_0xc53e('0x44')][_0xc53e('0xcd')]},'raw':!![]})[_0xc53e('0x22')](handleEntityNotFound(_0x1826c,null));}})[_0xc53e('0x22')](function(_0x368bbe){if(_0x368bbe){return _0x1826c[_0xc53e('0xce')](path[_0xc53e('0xcf')](config[_0xc53e('0xd0')],'server/files/attachments/',_0x368bbe[_0xc53e('0xc7')]));}})[_0xc53e('0x2c')](handleError(_0x1826c,null));};exports['close']=function(_0x17807d,_0x447e0e){var _0xba355d=null;var _0x5ae94b=null;var _0x51bf4e=null;var _0x3deddc=null;if(_0x17807d[_0xc53e('0x7d')]['id']){delete _0x17807d[_0xc53e('0x7d')]['id'];}if(_0x17807d[_0xc53e('0x7d')]['mailTranscript']){_0x3deddc=path[_0xc53e('0xcf')](config[_0xc53e('0xd0')],_0xc53e('0xd1'),util['format']('transcript-%s.txt',Date[_0xc53e('0xd2')]()));_0x17807d[_0xc53e('0x7d')][_0xc53e('0xd3')]=_0x3deddc;}return db['ChatInteraction'][_0xc53e('0x67')]({'where':{'id':_0x17807d[_0xc53e('0xb6')]['id']},'include':[{'model':db['ChatMessage'],'as':_0xc53e('0xd4'),'include':[{'model':db[_0xc53e('0xd5')],'as':_0xc53e('0xd5')}]}]})[_0xc53e('0x22')](handleEntityNotFound(_0x447e0e,null))[_0xc53e('0x22')](saveUpdates(_0x17807d['body'],null))[_0xc53e('0x22')](function(_0xbe15d2){if(_0xbe15d2){_0xba355d=_0xbe15d2;return db[_0xc53e('0xd6')]['find']({'where':{'id':_0xba355d['ChatWebsiteId']}});}})[_0xc53e('0x22')](function(_0x30e362){if(_0x30e362){_0x51bf4e=_0x30e362;return db[_0xc53e('0xd7')][_0xc53e('0x67')]({'where':{'id':_0xba355d[_0xc53e('0x73')]}});}})['then'](function(_0xaf4f2f){if(_0xaf4f2f){_0x5ae94b=_0xaf4f2f;if(_0x3deddc){var _0x531092=null;for(var _0x22ee61=0x1;_0x22ee61<_0xba355d[_0xc53e('0xd4')][_0xc53e('0x4a')];++_0x22ee61){_0x531092=_0xba355d[_0xc53e('0xd4')][_0x22ee61];var _0x3b6672=_0x531092[_0xc53e('0x7a')]?util[_0xc53e('0xd8')](_0xc53e('0xd9'),_0x51bf4e[_0xc53e('0xda')],_0x531092['UserId']):_0xc53e('0xdb');var _0x219b1e=_0x17807d[_0xc53e('0x7d')][_0xc53e('0xdc')]||util[_0xc53e('0xd8')](_0xc53e('0xd9'),'Visitor',_0x531092[_0xc53e('0x73')]);switch(_0x51bf4e[_0xc53e('0xdd')]){case _0xc53e('0xde'):_0x3b6672=_0x531092[_0xc53e('0x7a')]?util[_0xc53e('0xd8')](_0xc53e('0xd9'),_0x51bf4e[_0xc53e('0xda')],_0x531092[_0xc53e('0x7a')]):'System';break;case _0xc53e('0xdf'):_0x3b6672=_0x531092['UserId']?_0x531092[_0xc53e('0xd5')][_0xc53e('0xe0')]||_0x531092[_0xc53e('0xd5')][_0xc53e('0xe1')]:'System';break;case _0xc53e('0xe2'):_0x3b6672=_0x531092[_0xc53e('0x7a')]?_0x531092[_0xc53e('0xd5')][_0xc53e('0xe1')]:_0xc53e('0xdb');break;default:_0x3b6672=_0x531092[_0xc53e('0x7a')]?util[_0xc53e('0xd8')](_0xc53e('0xd9'),_0x51bf4e[_0xc53e('0xda')],_0x531092[_0xc53e('0x7a')]):_0xc53e('0xdb');}var _0x144fd0=util[_0xc53e('0xd8')](_0xc53e('0xe3'),moment(_0x531092[_0xc53e('0x83')])[_0xc53e('0xd8')](_0xc53e('0xe4')),_0x531092[_0xc53e('0xe5')]==='in'?_0x219b1e:_0x3b6672,_0x531092['body']);if(!_0x531092['secret']){fs[_0xc53e('0xe6')](_0x3deddc,_0x144fd0);}}return db[_0xc53e('0xe7')][_0xc53e('0xcb')]({'where':{'service':!![]},'include':[{'model':db[_0xc53e('0xe8')],'as':_0xc53e('0xe9'),'raw':!![]}]});}}})[_0xc53e('0x22')](function(_0x2933f0){if(_0x2933f0&&_0x2933f0[_0xc53e('0xe9')]&&_0x17807d[_0xc53e('0x7d')]){var _0x34b63b={'tls':{'rejectUnauthorized':![]}};if(_0x2933f0[_0xc53e('0xe9')]['service']){_0x34b63b[_0xc53e('0xea')]=_0x2933f0['Smtp'][_0xc53e('0xea')];}else{_0x34b63b[_0xc53e('0xeb')]=_0x2933f0[_0xc53e('0xe9')]['host'];_0x34b63b[_0xc53e('0xec')]=_0x2933f0[_0xc53e('0xe9')][_0xc53e('0xec')];_0x34b63b[_0xc53e('0xed')]=_0x2933f0[_0xc53e('0xe9')][_0xc53e('0xed')];}if(_0x2933f0[_0xc53e('0xe9')]['authentication']){_0x34b63b[_0xc53e('0xee')]={'user':_0x2933f0[_0xc53e('0xe9')][_0xc53e('0x9b')],'pass':_0x2933f0[_0xc53e('0xe9')][_0xc53e('0xef')]};}return respondWithRpcPromise('SendMail',_0xc53e('0xf0'),{'account':_0x34b63b,'message':{'from':util[_0xc53e('0xd8')]('\x22%s\x22\x20<%s>',_0x2933f0[_0xc53e('0x38')],_0x2933f0[_0xc53e('0xf1')]||_0x2933f0['Smtp'][_0xc53e('0x9b')]),'to':_0x17807d[_0xc53e('0x7d')][_0xc53e('0xf2')],'subject':_0xc53e('0xf3'),'text':util['format'](_0xc53e('0xf4'),_0x17807d[_0xc53e('0x7d')]['mailTranscript']),'attachments':[{'path':_0x3deddc}]}})[_0xc53e('0x22')](function(){return _0xba355d;})[_0xc53e('0x2c')](function(_0x503976){console[_0xc53e('0x29')](_0x503976);});}else{return _0xba355d;}})[_0xc53e('0x22')](respondWithStatusCode(_0x447e0e,0xc8))[_0xc53e('0x2c')](handleError(_0x447e0e,null));};exports[_0xc53e('0xf5')]=function(_0x440af2,_0x13010a,_0x1535bd){return db[_0xc53e('0xf6')][_0xc53e('0x67')]({'where':{'id':_0x440af2['params']['id']}})[_0xc53e('0x22')](handleEntityNotFound(_0x13010a,null))[_0xc53e('0x22')](function(_0x4494f7){if(_0x4494f7){return _0x4494f7['addMessage'](_0x440af2[_0xc53e('0x7d')][_0xc53e('0xf7')],_['omit'](_0x440af2[_0xc53e('0x7d')],[_0xc53e('0xf7'),'id'])||{});}})[_0xc53e('0x22')](respondWithResult(_0x13010a,null))[_0xc53e('0x2c')](handleError(_0x13010a,null));};exports[_0xc53e('0xf8')]=function(_0x258b57,_0x479d8d,_0x3b7fdc){var _0x4a7323={'raw':![],'where':{}};var _0x492de7={};var _0x109a05={'count':0x0,'rows':[]};return db[_0xc53e('0xb7')]['findOne']({'where':{'id':_0x258b57[_0xc53e('0xb6')]['id']}})['then'](handleEntityNotFound(_0x479d8d,null))[_0xc53e('0x22')](function(_0x1c6891){if(_0x1c6891){_0x492de7['model']=_[_0xc53e('0x7e')](db[_0xc53e('0xf6')]['rawAttributes']);_0x492de7[_0xc53e('0x44')]=_[_0xc53e('0x7e')](_0x258b57[_0xc53e('0x44')]);_0x492de7[_0xc53e('0x45')]=_[_0xc53e('0x46')](_0x492de7[_0xc53e('0x48')],_0x492de7[_0xc53e('0x44')]);_0x4a7323[_0xc53e('0x47')]=_['intersection'](_0x492de7['model'],qs['fields'](_0x258b57['query'][_0xc53e('0x49')]));_0x4a7323[_0xc53e('0x47')]=_0x4a7323[_0xc53e('0x47')][_0xc53e('0x4a')]?_0x4a7323['attributes']:_0x492de7[_0xc53e('0x48')];if(!_0x258b57[_0xc53e('0x44')][_0xc53e('0x4b')](_0xc53e('0x4c'))){_0x4a7323['limit']=qs[_0xc53e('0x4d')](_0x258b57[_0xc53e('0x44')][_0xc53e('0x4d')]);_0x4a7323[_0xc53e('0x30')]=qs['offset'](_0x258b57[_0xc53e('0x44')]['offset']);}_0x4a7323[_0xc53e('0x4e')]=qs['sort'](_0x258b57['query'][_0xc53e('0x4f')]);_0x4a7323[_0xc53e('0x50')]=qs[_0xc53e('0x45')](_['pick'](_0x258b57[_0xc53e('0x44')],_0x492de7['filters']));_0x4a7323['where'][_0xc53e('0xb2')]=_0x1c6891['id'];if(_0x258b57['query']['filter']){_0x4a7323['where']=_[_0xc53e('0x9f')](_0x4a7323[_0xc53e('0x50')],{'$or':_[_0xc53e('0x3b')](_0x4a7323[_0xc53e('0x47')],function(_0x25fa2e){var _0x32b416={};_0x32b416[_0x25fa2e]={'$like':'%'+_0x258b57['query']['filter']+'%'};return _0x32b416;})});}if(_0x258b57[_0xc53e('0x44')]['$gte']){var _0x594927=_0x258b57[_0xc53e('0x44')][_0xc53e('0x84')][_0xc53e('0x3e')](',');var _0x412981={};_0x412981[_0x594927[0x0]]={'$gte':moment(_0x594927[0x1])[_0xc53e('0xd8')](_0xc53e('0xf9'))};_0x4a7323[_0xc53e('0x50')]=_[_0xc53e('0x9f')](_0x4a7323[_0xc53e('0x50')],_0x412981);}_0x4a7323=_[_0xc53e('0x9f')]({},_0x4a7323,_0x258b57['options']);return db['ChatMessage']['count']({'where':_0x4a7323[_0xc53e('0x50')]})[_0xc53e('0x22')](function(_0x4d7ddb){_0x109a05[_0xc53e('0x2f')]=_0x4d7ddb;if(_0x258b57[_0xc53e('0x44')][_0xc53e('0xb9')]){_0x4a7323['include']=[{'all':!![]}];}return db[_0xc53e('0xf6')][_0xc53e('0xfa')](_0x4a7323);})['then'](function(_0x4cf17e){_0x109a05[_0xc53e('0xb5')]=_0x4cf17e;return _0x109a05;});}})['then'](respondWithFilteredResult(_0x479d8d,_0x4a7323))['catch'](handleError(_0x479d8d,null));};exports[_0xc53e('0xfb')]=function(_0x11bc0b,_0xdb2068,_0x3cb142){var _0x4944a1={'where':{}},_0x2bc545={},_0x199165={'count':0x0,'rows':[]};return db[_0xc53e('0xb7')][_0xc53e('0xcb')]({'where':{'id':_0x11bc0b[_0xc53e('0xb6')]['id']}})['then'](handleEntityNotFound(_0xdb2068,null))[_0xc53e('0x22')](function(_0x392756){if(_0x392756){_0x2bc545['model']=_[_0xc53e('0x7e')](db[_0xc53e('0xf6')][_0xc53e('0xb8')]);_0x2bc545['query']=_['keys'](_0x11bc0b[_0xc53e('0x44')]);_0x2bc545[_0xc53e('0x45')]=_[_0xc53e('0x46')](_0x2bc545['model'],_0x2bc545[_0xc53e('0x44')]);_0x4944a1[_0xc53e('0x47')]=_['intersection'](_0x2bc545[_0xc53e('0x48')],qs[_0xc53e('0x49')](_0x11bc0b[_0xc53e('0x44')][_0xc53e('0x49')]));_0x4944a1[_0xc53e('0x47')]=_0x4944a1[_0xc53e('0x47')]['length']?_0x4944a1['attributes']:_0x2bc545[_0xc53e('0x48')];if(!_0x11bc0b['query'][_0xc53e('0x4b')]('nolimit')){_0x4944a1[_0xc53e('0x4d')]=qs[_0xc53e('0x4d')](_0x11bc0b[_0xc53e('0x44')]['limit']);_0x4944a1[_0xc53e('0x30')]=qs['offset'](_0x11bc0b[_0xc53e('0x44')]['offset']);}_0x4944a1[_0xc53e('0x4e')]=qs[_0xc53e('0x4f')](_0x11bc0b[_0xc53e('0x44')][_0xc53e('0x4f')]);_0x4944a1[_0xc53e('0x50')]=qs[_0xc53e('0x45')](_[_0xc53e('0x51')](_0x11bc0b[_0xc53e('0x44')],_0x2bc545['filters']));_0x4944a1[_0xc53e('0x50')]['ChatInteractionId']=_0x392756['id'];if(_0x11bc0b[_0xc53e('0x44')]['filter']){_0x4944a1[_0xc53e('0x50')]=_[_0xc53e('0x9f')](_0x4944a1[_0xc53e('0x50')],{'$or':_[_0xc53e('0x3b')](_0x4944a1[_0xc53e('0x47')],function(_0x41dca4){var _0x453ba7={};_0x453ba7[_0x41dca4]={'$like':'%'+_0x11bc0b[_0xc53e('0x44')][_0xc53e('0x8c')]+'%'};return _0x453ba7;})});}_0x4944a1['where'][_0xc53e('0xfc')]=![];if(_0x11bc0b['query']['id']){_0x4944a1['where']['id']={'$gt':_0x11bc0b[_0xc53e('0x44')]['id']};}_0x4944a1=_[_0xc53e('0x9f')]({},_0x4944a1,_0x11bc0b[_0xc53e('0xbb')]);return db[_0xc53e('0xf6')]['count']({'where':_0x4944a1[_0xc53e('0x50')]})[_0xc53e('0x22')](function(_0x3ab673){_0x199165[_0xc53e('0x2f')]=_0x3ab673;_0x4944a1['include']=[];if(_0x11bc0b['query'][_0xc53e('0xfd')]){_0x4944a1[_0xc53e('0xba')][_0xc53e('0xb3')]({'model':db[_0xc53e('0xd5')],'as':'User','attributes':['id',_0xc53e('0xe1'),_0xc53e('0xe0')]});}if(_0x11bc0b['query']['includeAll']){_0x4944a1[_0xc53e('0xba')]=[{'all':!![]}];}return db[_0xc53e('0xf6')]['findAll'](_0x4944a1);})[_0xc53e('0x22')](function(_0xe8a41b){_0x199165[_0xc53e('0xb5')]=_0xe8a41b;return _0x199165;});}})[_0xc53e('0x22')](respondWithFilteredResult(_0xdb2068,_0x4944a1))['catch'](handleError(_0xdb2068,null));};exports[_0xc53e('0xfe')]=function(_0x51e2f1,_0x9f90c5,_0x4c6d54){return db[_0xc53e('0xb7')]['find']({'where':{'id':_0x51e2f1[_0xc53e('0xb6')]['id']}})[_0xc53e('0x22')](handleEntityNotFound(_0x9f90c5,null))[_0xc53e('0x22')](function(_0x296925){if(_0x296925){return _0x296925[_0xc53e('0xff')](_0x51e2f1[_0xc53e('0x7d')][_0xc53e('0xf7')],_[_0xc53e('0x100')](_0x51e2f1[_0xc53e('0x7d')],[_0xc53e('0xf7'),'id'])||{})[_0xc53e('0x101')](function(){return db[_0xc53e('0x76')][_0xc53e('0xfa')]({'attributes':['id','name',_0xc53e('0x102')],'where':{'id':_0x51e2f1[_0xc53e('0x7d')]['ids']}});})[_0xc53e('0x22')](function(_0x286b76){socket[_0xc53e('0x103')]('chatInteractionTags:save',{'id':Number(_0x51e2f1['params']['id']),'tags':_0x286b76||[]});return{'id':Number(_0x51e2f1[_0xc53e('0xb6')]['id']),'tags':_0x286b76||[]};});}})[_0xc53e('0x22')](respondWithResult(_0x9f90c5,null))[_0xc53e('0x2c')](handleError(_0x9f90c5,null));};exports[_0xc53e('0x104')]=function(_0x475412,_0x5ef4b6,_0x4e2e66){return db[_0xc53e('0xb7')][_0xc53e('0x67')]({'where':{'id':_0x475412['params']['id']}})['then'](handleEntityNotFound(_0x5ef4b6,null))['then'](function(_0x542644){if(_0x542644){return _0x542644[_0xc53e('0x104')](_0x475412[_0xc53e('0x44')][_0xc53e('0xf7')]);}})[_0xc53e('0x22')](respondWithStatusCode(_0x5ef4b6,null))[_0xc53e('0x2c')](handleError(_0x5ef4b6,null));};exports[_0xc53e('0xce')]=function(_0x54772a,_0x2c8826){var _0x5e9fd5=moment()[_0xc53e('0x105')]()[_0xc53e('0x9d')]();var _0xe9a291=path[_0xc53e('0xcf')](config['root'],_0xc53e('0x106'),'files','tmp');var _0x4e8f9f=path[_0xc53e('0xcf')](config[_0xc53e('0xd0')],_0xc53e('0x106'),_0xc53e('0x107'),_0xc53e('0x108'));var _0x789649=path[_0xc53e('0xcf')](_0xe9a291,_0x5e9fd5);var _0x26e985=util[_0xc53e('0xd8')](_0xc53e('0x109'),_0x54772a['params']['id'],_0x5e9fd5);var _0x5854d1=path[_0xc53e('0xcf')](_0xe9a291,_0x26e985);var _0xe03c8d=[];_0xe03c8d['push']({'model':db[_0xc53e('0xd5')],'as':_0xc53e('0xd5'),'attributes':['id',_0xc53e('0xe1')],'raw':!![]});_0xe03c8d[_0xc53e('0xb3')]({'model':db[_0xc53e('0xd7')],'as':_0xc53e('0x6c'),'attributes':['id','firstName',_0xc53e('0x10a')],'raw':!![]});if(_0x54772a[_0xc53e('0x44')][_0xc53e('0x108')]){_0xe03c8d[_0xc53e('0xb3')]({'model':db['Attachment'],'as':_0xc53e('0xc9'),'raw':!![]});}var _0x838b3f=[{'model':db[_0xc53e('0xf6')],'as':_0xc53e('0xd4'),'attributes':['id','body',_0xc53e('0x83'),_0xc53e('0xe5'),_0xc53e('0xfc'),_0xc53e('0x88')],'include':_0xe03c8d}];_0x838b3f[_0xc53e('0xb3')]({'model':db[_0xc53e('0xd6')],'as':_0xc53e('0x10b'),'attributes':['id','name']});_0x838b3f[_0xc53e('0xb3')]({'model':db[_0xc53e('0xd5')],'as':_0xc53e('0x10c'),'attributes':['id',_0xc53e('0xe1')]});return db[_0xc53e('0xb7')]['find']({'where':{'id':_0x54772a['params']['id']},'include':_0x838b3f})[_0xc53e('0x22')](handleEntityNotFound(_0x2c8826,null))['then'](function(_0x1336fe){if(_0x1336fe){var _0x457996=_0x1336fe[_0xc53e('0x10d')]({'plain':!![]});fs[_0xc53e('0x10e')](_0x789649);var _0x33b6af={'format':'A4','border':'10px','header':{'height':'40px','contents':{'first':'\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20'}},'footer':{'height':_0xc53e('0x10f'),'contents':{'default':util[_0xc53e('0xd8')](_0xc53e('0x110'),util[_0xc53e('0xd8')](_0xc53e('0x111'),_0xc53e('0x112'),_0x457996['id']),moment()[_0xc53e('0xd8')](_0xc53e('0x113'))['toString']())}}};var _0x4c517d={'channel':_0xc53e('0x112'),'account':_0x457996[_0xc53e('0x10b')][_0xc53e('0x38')],'agent':_0x457996[_0xc53e('0x10c')]?_0x457996[_0xc53e('0x10c')][_0xc53e('0xe1')]:_0xc53e('0x114'),'createdAt':moment(_0x457996[_0xc53e('0x83')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0xc53e('0x9d')](),'closedAt':_0x457996[_0xc53e('0x115')]?moment(_0x457996[_0xc53e('0x116')])[_0xc53e('0xd8')](_0xc53e('0xf9'))[_0xc53e('0x9d')]():'','disposition':_0x457996[_0xc53e('0xc3')],'chatInfo':{'browser':_0x457996['browserName'],'os':_0x457996[_0xc53e('0x117')],'referer':_0x457996[_0xc53e('0x118')],'customerIp':_0x457996[_0xc53e('0x119')],'customerPort':_0x457996[_0xc53e('0x11a')]?_0x457996[_0xc53e('0x11a')]:_0xc53e('0x114')},'messages':_(_0x457996[_0xc53e('0xd4')])[_0xc53e('0x11b')]()[_0xc53e('0x8c')]({'secret':![]})['map'](function(_0x413e7e){if(_0x413e7e[_0xc53e('0xc9')]){var _0x3297fb=path['join'](_0x4e8f9f,_0x413e7e[_0xc53e('0xc9')][_0xc53e('0xc7')]);if(fs[_0xc53e('0x11c')](_0x3297fb)){fs[_0xc53e('0x11d')](_0x3297fb)[_0xc53e('0x11e')](fs[_0xc53e('0x11f')](path['join'](_0x789649,_0x413e7e[_0xc53e('0xc9')][_0xc53e('0xc7')])));}}return{'date':moment(_0x413e7e['createdAt'])[_0xc53e('0xd8')](_0xc53e('0xf9'))['toString'](),'sender':_0x413e7e['direction']==='out'?_0x413e7e[_0xc53e('0xd5')]?_0x413e7e['User'][_0xc53e('0xe1')]:_0xc53e('0xdb'):_0x413e7e[_0xc53e('0x6c')]['firstName']+(_0x413e7e[_0xc53e('0x6c')][_0xc53e('0x10a')]?'\x20'+_0x413e7e[_0xc53e('0x6c')][_0xc53e('0x10a')]:''),'body':_0x413e7e[_0xc53e('0xc9')]?_0x413e7e[_0xc53e('0xc9')][_0xc53e('0xc7')]:_0x413e7e[_0xc53e('0x7d')],'direction':_0x413e7e[_0xc53e('0xe5')]===_0xc53e('0x120')?'A':'C','secret':_0x413e7e[_0xc53e('0xfc')],'read':_0x413e7e[_0xc53e('0x88')],'attachment':_0x413e7e[_0xc53e('0xc9')]};})[_0xc53e('0x6f')]()};return ejs[_0xc53e('0x121')](path[_0xc53e('0xcf')](config['root'],'server','views',_0xc53e('0x122')),{'interaction':_0x4c517d})[_0xc53e('0x22')](function(_0x22f4fd){return new BPromise(function(_0x10cfd4,_0x5a3d46){pdf[_0xc53e('0xbc')](_0x22f4fd,_0x33b6af)[_0xc53e('0x123')](path['join'](_0x789649,_0xc53e('0x124')+_0x457996['id']+'-'+_0x5e9fd5+_0xc53e('0x125')),function(_0x3c7c94,_0x509c97){if(_0x3c7c94)return _0x5a3d46(_0x3c7c94);_0x10cfd4(_0x509c97);});});})[_0xc53e('0x22')](function(){return new BPromise(function(_0x29f9d6,_0x569e18){zipdir(_0x789649,{'saveTo':_0x5854d1},function(_0x201e03,_0x36171c){if(_0x201e03)return _0x569e18(_0x201e03);return _0x29f9d6(_0x36171c);});})['then'](function(){return new BPromise(function(_0x386ca8,_0x46f381){rimraf(_0x789649,function(_0x104b1a){if(_0x104b1a)_0x46f381(_0x104b1a);return _0x386ca8();});});})['then'](function(){return _0x2c8826[_0xc53e('0xce')](_0x5854d1,_0x26e985,function(_0x5231dc){if(_0x5231dc){console[_0xc53e('0x126')](_0xc53e('0x127'),_0x5231dc);}else{fs[_0xc53e('0x128')](_0x5854d1);}});});});}else{return _0x2c8826[_0xc53e('0x37')](0xc8);}})[_0xc53e('0x2c')](handleError(_0x2c8826,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index bc213d7..cd064f8 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 _0x9108=['remove','getUsers','then','Users','map','setDataValue','length','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatInteraction','ChatMessage','setMaxListeners','save'];(function(_0x1a65ac,_0x2f682c){var _0x1fea57=function(_0x2a22db){while(--_0x2a22db){_0x1a65ac['push'](_0x1a65ac['shift']());}};_0x1fea57(++_0x2f682c);}(_0x9108,0x1d6));var _0x8910=function(_0x1428a7,_0x17f607){_0x1428a7=_0x1428a7-0x0;var _0xcabdf2=_0x9108[_0x1428a7];return _0xcabdf2;};'use strict';var EventEmitter=require(_0x8910('0x0'));var ChatInteraction=require(_0x8910('0x1'))['db'][_0x8910('0x2')];var ChatMessage=require(_0x8910('0x1'))['db'][_0x8910('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x8910('0x4')](0x0);var events={'afterCreate':_0x8910('0x5'),'afterUpdate':'update','afterDestroy':_0x8910('0x6')};function emitEvent(_0x236ac3){return function(_0x133c27,_0x5b5f39,_0x39147){_0x133c27[_0x8910('0x7')]({'attributes':['id'],'raw':!![]})[_0x8910('0x8')](function(_0x3c0c67){_0x133c27['setDataValue'](_0x8910('0x9'),_0x3c0c67[_0x8910('0xa')](function(_0x142b0f){return{'id':_0x142b0f['id']};}));return ChatMessage['findAll']({'where':{'ChatInteractionId':_0x133c27['id'],'direction':'in','read':![]},'raw':!![]});})[_0x8910('0x8')](function(_0x5a6bec){_0x133c27[_0x8910('0xb')]('unreadMessages',_0x5a6bec[_0x8910('0xc')]);ChatInteractionEvents[_0x8910('0xd')](_0x236ac3+':'+_0x133c27['id'],_0x133c27);ChatInteractionEvents[_0x8910('0xd')](_0x236ac3,_0x133c27);_0x39147(null);})['catch'](_0x39147(null));};}for(var e in events){if(events[_0x8910('0xe')](e)){var event=events[e];ChatInteraction[_0x8910('0xf')](e,emitEvent(event));}}module[_0x8910('0x10')]=ChatInteractionEvents; \ No newline at end of file +var _0x7471=['hasOwnProperty','hook','events','../../mysqldb','ChatMessage','save','update','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','catch'];(function(_0x353b78,_0x517995){var _0x453fa7=function(_0x5eba6d){while(--_0x5eba6d){_0x353b78['push'](_0x353b78['shift']());}};_0x453fa7(++_0x517995);}(_0x7471,0xbd));var _0x1747=function(_0x5c42c2,_0x24ae2b){_0x5c42c2=_0x5c42c2-0x0;var _0x4bfa5d=_0x7471[_0x5c42c2];return _0x4bfa5d;};'use strict';var EventEmitter=require(_0x1747('0x0'));var ChatInteraction=require(_0x1747('0x1'))['db']['ChatInteraction'];var ChatMessage=require('../../mysqldb')['db'][_0x1747('0x2')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x1747('0x3'),'afterUpdate':_0x1747('0x4'),'afterDestroy':'remove'};function emitEvent(_0x459672){return function(_0xf46215,_0xfd1400,_0x4d426e){_0xf46215[_0x1747('0x5')]({'attributes':['id'],'raw':!![]})[_0x1747('0x6')](function(_0x1f2c7d){_0xf46215[_0x1747('0x7')](_0x1747('0x8'),_0x1f2c7d[_0x1747('0x9')](function(_0x5c61ea){return{'id':_0x5c61ea['id']};}));return ChatMessage[_0x1747('0xa')]({'where':{'ChatInteractionId':_0xf46215['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x584c2d){_0xf46215['setDataValue'](_0x1747('0xb'),_0x584c2d[_0x1747('0xc')]);ChatInteractionEvents[_0x1747('0xd')](_0x459672+':'+_0xf46215['id'],_0xf46215);ChatInteractionEvents[_0x1747('0xd')](_0x459672,_0xf46215);_0x4d426e(null);})[_0x1747('0xe')](_0x4d426e(null));};}for(var e in events){if(events[_0x1747('0xf')](e)){var event=events[e];ChatInteraction[_0x1747('0x10')](e,emitEvent(event));}}module['exports']=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index d395daf..724ddf9 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 _0x72eb=['closed','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatInteraction.attributes','exports','define','chat_interactions','changed'];(function(_0x19318e,_0x46c067){var _0x425540=function(_0xb4e055){while(--_0xb4e055){_0x19318e['push'](_0x19318e['shift']());}};_0x425540(++_0x46c067);}(_0x72eb,0x1b3));var _0xb72e=function(_0x58f3ed,_0x157a58){_0x58f3ed=_0x58f3ed-0x0;var _0x5e6ba1=_0x72eb[_0x58f3ed];return _0x5e6ba1;};'use strict';var _=require(_0xb72e('0x0'));var util=require(_0xb72e('0x1'));var logger=require(_0xb72e('0x2'))(_0xb72e('0x3'));var moment=require(_0xb72e('0x4'));var BPromise=require(_0xb72e('0x5'));var rp=require(_0xb72e('0x6'));var fs=require('fs');var path=require(_0xb72e('0x7'));var rimraf=require(_0xb72e('0x8'));var config=require(_0xb72e('0x9'));var attributes=require(_0xb72e('0xa'));module[_0xb72e('0xb')]=function(_0x2e6f26,_0x47a760){return _0x2e6f26[_0xb72e('0xc')]('ChatInteraction',attributes,{'tableName':_0xb72e('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x39a962,_0x1cb308,_0x1a1aaa){if(_0x39a962[_0xb72e('0xe')](_0xb72e('0xf'))){_0x39a962['closedAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x1a1aaa(null,_0x39a962);}},'charset':_0xb72e('0x10'),'collate':_0xb72e('0x11')});}; \ No newline at end of file +var _0x4af7=['request-promise','path','rimraf','exports','define','chat_interactions','closed','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment'];(function(_0x65ff6c,_0x4c2da3){var _0x238215=function(_0x485ddf){while(--_0x485ddf){_0x65ff6c['push'](_0x65ff6c['shift']());}};_0x238215(++_0x4c2da3);}(_0x4af7,0x136));var _0x74af=function(_0x2b4448,_0x5bcc69){_0x2b4448=_0x2b4448-0x0;var _0xb4b465=_0x4af7[_0x2b4448];return _0xb4b465;};'use strict';var _=require(_0x74af('0x0'));var util=require(_0x74af('0x1'));var logger=require(_0x74af('0x2'))(_0x74af('0x3'));var moment=require(_0x74af('0x4'));var BPromise=require('bluebird');var rp=require(_0x74af('0x5'));var fs=require('fs');var path=require(_0x74af('0x6'));var rimraf=require(_0x74af('0x7'));var config=require('../../config/environment');var attributes=require('./chatInteraction.attributes');module[_0x74af('0x8')]=function(_0x33576e,_0x3ce1a1){return _0x33576e[_0x74af('0x9')]('ChatInteraction',attributes,{'tableName':_0x74af('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x36fe38,_0xa2ee04,_0x30dfb9){if(_0x36fe38['changed'](_0x74af('0xb'))){_0x36fe38['closedAt']=moment()['format'](_0x74af('0xc'));}_0x30dfb9(null,_0x36fe38);}},'charset':_0x74af('0xd'),'collate':_0x74af('0xe')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 48e2a74..e1d94f4 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 _0xd5f5=['../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','./chatInteraction.socket','register','request','then','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatInteraction,\x20%s,\x20%s','message','result','catch','UpdateChatInteraction','ChatInteraction','update','body','raw','options','where','info','find','addTags','ids','omit','spread','AddTags','lodash','util','moment','randomstring','../../mysqldb','../../config/utils'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xd5f5,0xc2));var _0x5d5f=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xd5f5[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0x5d5f('0x0'));var util=require(_0x5d5f('0x1'));var moment=require(_0x5d5f('0x2'));var BPromise=require('bluebird');var rs=require(_0x5d5f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5d5f('0x4'))['db'];var utils=require(_0x5d5f('0x5'));var logger=require(_0x5d5f('0x6'))(_0x5d5f('0x7'));var config=require(_0x5d5f('0x8'));var jayson=require(_0x5d5f('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x5d5f('0xa')]=_[_0x5d5f('0xb')](config[_0x5d5f('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x5d5f('0xc'))[_0x5d5f('0xd')](socket);function respondWithRpcPromise(_0x102447,_0x5ca965,_0x5df523){return new BPromise(function(_0x292fab,_0x42effe){return client[_0x5d5f('0xe')](_0x102447,_0x5df523)[_0x5d5f('0xf')](function(_0x5c88e3){logger['info']('ChatInteraction,\x20%s,\x20%s',_0x5ca965,_0x5d5f('0x10'));logger[_0x5d5f('0x11')](_0x5d5f('0x12'),_0x5ca965,'request\x20sent',JSON[_0x5d5f('0x13')](_0x5c88e3));if(_0x5c88e3[_0x5d5f('0x14')]){if(_0x5c88e3[_0x5d5f('0x14')][_0x5d5f('0x15')]===0x1f4){logger[_0x5d5f('0x14')](_0x5d5f('0x16'),_0x5ca965,_0x5c88e3['error'][_0x5d5f('0x17')]);return _0x42effe(_0x5c88e3['error'][_0x5d5f('0x17')]);}logger[_0x5d5f('0x14')]('ChatInteraction,\x20%s,\x20%s',_0x5ca965,_0x5c88e3['error'][_0x5d5f('0x17')]);return _0x292fab(_0x5c88e3['error']['message']);}else{logger['info']('ChatInteraction,\x20%s,\x20%s',_0x5ca965,_0x5d5f('0x10'));_0x292fab(_0x5c88e3[_0x5d5f('0x18')][_0x5d5f('0x17')]);}})[_0x5d5f('0x19')](function(_0x2a2d05){logger[_0x5d5f('0x14')]('ChatInteraction,\x20%s,\x20%s',_0x5ca965,_0x2a2d05);_0x42effe(_0x2a2d05);});});}exports[_0x5d5f('0x1a')]=function(_0x8bd3a9){var _0x423e9f=this;return new Promise(function(_0x370218,_0x203e31){return db[_0x5d5f('0x1b')][_0x5d5f('0x1c')](_0x8bd3a9[_0x5d5f('0x1d')],{'raw':_0x8bd3a9['options']?_0x8bd3a9['options'][_0x5d5f('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x8bd3a9[_0x5d5f('0x1f')]?_0x8bd3a9[_0x5d5f('0x1f')][_0x5d5f('0x20')]||null:null,'attributes':_0x8bd3a9[_0x5d5f('0x1f')]?_0x8bd3a9[_0x5d5f('0x1f')]['attributes']||null:null,'limit':_0x8bd3a9[_0x5d5f('0x1f')]?_0x8bd3a9[_0x5d5f('0x1f')]['limit']||null:null})['then'](function(_0x3402c1){logger[_0x5d5f('0x21')](_0x5d5f('0x1a'),_0x8bd3a9);logger[_0x5d5f('0x11')](_0x5d5f('0x1a'),_0x8bd3a9,JSON[_0x5d5f('0x13')](_0x3402c1));_0x370218(_0x3402c1);})[_0x5d5f('0x19')](function(_0x131fc0){logger[_0x5d5f('0x14')](_0x5d5f('0x1a'),_0x131fc0[_0x5d5f('0x17')],_0x8bd3a9);_0x203e31(_0x423e9f['error'](0x1f4,_0x131fc0[_0x5d5f('0x17')]));});});};exports['AddTagsToChatInteraction']=function(_0x4c495f){return new Promise(function(_0x672981,_0x208bfe){return db[_0x5d5f('0x1b')][_0x5d5f('0x22')]({'where':_0x4c495f[_0x5d5f('0x1f')]?_0x4c495f[_0x5d5f('0x1f')]['where']||null:null})[_0x5d5f('0xf')](function(_0x428b63){if(_0x428b63){return _0x428b63[_0x5d5f('0x23')](_0x4c495f[_0x5d5f('0x1d')][_0x5d5f('0x24')],_[_0x5d5f('0x25')](_0x4c495f[_0x5d5f('0x1d')],[_0x5d5f('0x24'),'id'])||{});}})[_0x5d5f('0x26')](function(_0x223289){logger[_0x5d5f('0x21')](_0x5d5f('0x27'),_0x4c495f);logger[_0x5d5f('0x11')](_0x5d5f('0x27'),_0x4c495f,JSON[_0x5d5f('0x13')](_0x223289));_0x672981(_0x223289);})[_0x5d5f('0x19')](function(_0x112702){logger[_0x5d5f('0x14')](_0x5d5f('0x27'),_0x112702[_0x5d5f('0x17')],_0x4c495f);_0x208bfe(_this[_0x5d5f('0x14')](0x1f4,_0x112702[_0x5d5f('0x17')]));});});}; \ No newline at end of file +var _0x9493=['then','stringify','AddTagsToChatInteraction','addTags','omit','ids','spread','AddTags','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','error','code','ChatInteraction,\x20%s,\x20%s','message','info','result','catch','UpdateChatInteraction','ChatInteraction','update','body','options','where','attributes'];(function(_0x36bac4,_0x2fd44b){var _0x46b285=function(_0x1d7d5d){while(--_0x1d7d5d){_0x36bac4['push'](_0x36bac4['shift']());}};_0x46b285(++_0x2fd44b);}(_0x9493,0x10a));var _0x3949=function(_0x4ecd85,_0x341c2b){_0x4ecd85=_0x4ecd85-0x0;var _0x16d784=_0x9493[_0x4ecd85];return _0x16d784;};'use strict';var _=require(_0x3949('0x0'));var util=require(_0x3949('0x1'));var moment=require(_0x3949('0x2'));var BPromise=require('bluebird');var rs=require(_0x3949('0x3'));var fs=require('fs');var Redis=require(_0x3949('0x4'));var db=require(_0x3949('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x3949('0x6'))(_0x3949('0x7'));var config=require(_0x3949('0x8'));var jayson=require(_0x3949('0x9'));var client=jayson[_0x3949('0xa')][_0x3949('0xb')]({'port':0x232a});config[_0x3949('0xc')]=_[_0x3949('0xd')](config['redis'],{'host':_0x3949('0xe'),'port':0x18eb});var socket=require(_0x3949('0xf'))(new Redis(config[_0x3949('0xc')]));require('./chatInteraction.socket')[_0x3949('0x10')](socket);function respondWithRpcPromise(_0x785236,_0x436518,_0x3b578d){return new BPromise(function(_0x35d199,_0x309054){return client[_0x3949('0x11')](_0x785236,_0x3b578d)['then'](function(_0x3ae2e9){logger['info']('ChatInteraction,\x20%s,\x20%s',_0x436518,_0x3949('0x12'));logger[_0x3949('0x13')](_0x3949('0x14'),_0x436518,_0x3949('0x12'),JSON['stringify'](_0x3ae2e9));if(_0x3ae2e9[_0x3949('0x15')]){if(_0x3ae2e9[_0x3949('0x15')][_0x3949('0x16')]===0x1f4){logger[_0x3949('0x15')]('ChatInteraction,\x20%s,\x20%s',_0x436518,_0x3ae2e9[_0x3949('0x15')]['message']);return _0x309054(_0x3ae2e9[_0x3949('0x15')]['message']);}logger[_0x3949('0x15')](_0x3949('0x17'),_0x436518,_0x3ae2e9['error'][_0x3949('0x18')]);return _0x35d199(_0x3ae2e9[_0x3949('0x15')][_0x3949('0x18')]);}else{logger[_0x3949('0x19')](_0x3949('0x17'),_0x436518,'request\x20sent');_0x35d199(_0x3ae2e9[_0x3949('0x1a')][_0x3949('0x18')]);}})[_0x3949('0x1b')](function(_0x38307c){logger[_0x3949('0x15')](_0x3949('0x17'),_0x436518,_0x38307c);_0x309054(_0x38307c);});});}exports[_0x3949('0x1c')]=function(_0xa0d5d2){var _0x20c5f3=this;return new Promise(function(_0x23d03d,_0x2b2549){return db[_0x3949('0x1d')][_0x3949('0x1e')](_0xa0d5d2[_0x3949('0x1f')],{'raw':_0xa0d5d2[_0x3949('0x20')]?_0xa0d5d2['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xa0d5d2[_0x3949('0x20')]?_0xa0d5d2[_0x3949('0x20')][_0x3949('0x21')]||null:null,'attributes':_0xa0d5d2[_0x3949('0x20')]?_0xa0d5d2[_0x3949('0x20')][_0x3949('0x22')]||null:null,'limit':_0xa0d5d2[_0x3949('0x20')]?_0xa0d5d2['options']['limit']||null:null})[_0x3949('0x23')](function(_0x13f29e){logger[_0x3949('0x19')]('UpdateChatInteraction',_0xa0d5d2);logger[_0x3949('0x13')]('UpdateChatInteraction',_0xa0d5d2,JSON[_0x3949('0x24')](_0x13f29e));_0x23d03d(_0x13f29e);})[_0x3949('0x1b')](function(_0x5cef42){logger[_0x3949('0x15')](_0x3949('0x1c'),_0x5cef42[_0x3949('0x18')],_0xa0d5d2);_0x2b2549(_0x20c5f3['error'](0x1f4,_0x5cef42['message']));});});};exports[_0x3949('0x25')]=function(_0x5a09cc){return new Promise(function(_0x34ef33,_0x451a99){return db[_0x3949('0x1d')]['find']({'where':_0x5a09cc['options']?_0x5a09cc[_0x3949('0x20')][_0x3949('0x21')]||null:null})[_0x3949('0x23')](function(_0x318643){if(_0x318643){return _0x318643[_0x3949('0x26')](_0x5a09cc[_0x3949('0x1f')]['ids'],_[_0x3949('0x27')](_0x5a09cc['body'],[_0x3949('0x28'),'id'])||{});}})[_0x3949('0x29')](function(_0x43bd22){logger[_0x3949('0x19')](_0x3949('0x2a'),_0x5a09cc);logger[_0x3949('0x13')](_0x3949('0x2a'),_0x5a09cc,JSON[_0x3949('0x24')](_0x43bd22));_0x34ef33(_0x43bd22);})['catch'](function(_0x19dfe7){logger[_0x3949('0x15')]('AddTags',_0x19dfe7[_0x3949('0x18')],_0x5a09cc);_0x451a99(_this[_0x3949('0x15')](0x1f4,_0x19dfe7[_0x3949('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 4a6c0c0..eb756ba 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 _0xbdef=['update','emit','removeListener','register','chatInteraction:','./chatInteraction.events','save','remove'];(function(_0x4cba56,_0x5b2c44){var _0x3cc9f3=function(_0x5bb80a){while(--_0x5bb80a){_0x4cba56['push'](_0x4cba56['shift']());}};_0x3cc9f3(++_0x5b2c44);}(_0xbdef,0xcd));var _0xfbde=function(_0x127116,_0x2f5d05){_0x127116=_0x127116-0x0;var _0x48acf8=_0xbdef[_0x127116];return _0x48acf8;};'use strict';var ChatInteractionEvents=require(_0xfbde('0x0'));var events=[_0xfbde('0x1'),_0xfbde('0x2'),_0xfbde('0x3')];function createListener(_0x31a40d,_0x30332b){return function(_0x14a01d){_0x30332b[_0xfbde('0x4')](_0x31a40d,_0x14a01d);};}function removeListener(_0x424397,_0xc7356e){return function(){ChatInteractionEvents[_0xfbde('0x5')](_0x424397,_0xc7356e);};}exports[_0xfbde('0x6')]=function(_0x25a0e4){for(var _0x498551=0x0,_0x2fb1c6=events['length'];_0x498551<_0x2fb1c6;_0x498551++){var _0x3ba851=events[_0x498551];var _0x1acd42=createListener(_0xfbde('0x7')+_0x3ba851,_0x25a0e4);ChatInteractionEvents['on'](_0x3ba851,_0x1acd42);}}; \ No newline at end of file +var _0x7ee8=['remove','emit','removeListener','register','length','chatInteraction:','./chatInteraction.events','save'];(function(_0x225b9c,_0x348668){var _0x450264=function(_0x3e8113){while(--_0x3e8113){_0x225b9c['push'](_0x225b9c['shift']());}};_0x450264(++_0x348668);}(_0x7ee8,0x9e));var _0x87ee=function(_0x45fb76,_0x35fd5d){_0x45fb76=_0x45fb76-0x0;var _0x338556=_0x7ee8[_0x45fb76];return _0x338556;};'use strict';var ChatInteractionEvents=require(_0x87ee('0x0'));var events=[_0x87ee('0x1'),_0x87ee('0x2'),'update'];function createListener(_0x724d82,_0x2ae514){return function(_0x5694f1){_0x2ae514[_0x87ee('0x3')](_0x724d82,_0x5694f1);};}function removeListener(_0x357508,_0x582da4){return function(){ChatInteractionEvents[_0x87ee('0x4')](_0x357508,_0x582da4);};}exports[_0x87ee('0x5')]=function(_0x41b96c){for(var _0xc8950d=0x0,_0x5ba6cc=events[_0x87ee('0x6')];_0xc8950d<_0x5ba6cc;_0xc8950d++){var _0x4222f9=events[_0xc8950d];var _0x509dca=createListener(_0x87ee('0x7')+_0x4222f9,_0x41b96c);ChatInteractionEvents['on'](_0x4222f9,_0x509dca);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index ec0ce1b..e133c61 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 _0x4ac6=['put','tracked','chatinteraction:update','/:id/custom_update','customUpdate','/:id/abandon','/:id/close','delete','chat','removeTags','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInteraction.controller','isAuthenticated','index','get','/describe','/:id','isChatInteractionAuthorized','attachmentDownload','/:id/messages','getMessages','/:id/my_messages','getMyMessages','download','post','create','diskStorage','join','root','server/files/attachments/','format','now','replace','/:id/attachment_upload','single','file','addMessage','/:id/tags','chatinteraction:addtags'];(function(_0x256664,_0x4b7963){var _0x520773=function(_0x2d006d){while(--_0x2d006d){_0x256664['push'](_0x256664['shift']());}};_0x520773(++_0x4b7963);}(_0x4ac6,0x1a9));var _0x64ac=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4ac6[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x64ac('0x0'));var util=require(_0x64ac('0x1'));var path=require(_0x64ac('0x2'));var timeout=require(_0x64ac('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x64ac('0x4'));var interaction=require(_0x64ac('0x5'));var config=require(_0x64ac('0x6'));var controller=require(_0x64ac('0x7'));router['get']('/',auth[_0x64ac('0x8')](),controller[_0x64ac('0x9')]);router[_0x64ac('0xa')](_0x64ac('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0x64ac('0xa')](_0x64ac('0xc'),auth[_0x64ac('0xd')](),controller['show']);router[_0x64ac('0xa')]('/:id/attachment_download',auth['isChatInteractionAuthorized'](),controller[_0x64ac('0xe')]);router[_0x64ac('0xa')](_0x64ac('0xf'),auth[_0x64ac('0x8')](),controller[_0x64ac('0x10')]);router[_0x64ac('0xa')](_0x64ac('0x11'),auth['isChatInteractionAuthorized'](),controller[_0x64ac('0x12')]);router[_0x64ac('0xa')]('/:id/download',auth[_0x64ac('0x8')](),controller[_0x64ac('0x13')]);router[_0x64ac('0x14')]('/',auth[_0x64ac('0x8')](),controller[_0x64ac('0x15')]);var upload=multer({'storage':multer[_0x64ac('0x16')]({'destination':function(_0x48b378,_0x5c0c8e,_0x9d68ce){_0x9d68ce(null,path[_0x64ac('0x17')](config[_0x64ac('0x18')],_0x64ac('0x19')));},'filename':function(_0x5c6b64,_0x5a56f8,_0x1be4cf){_0x1be4cf(null,util[_0x64ac('0x1a')]('%s-%s',Date[_0x64ac('0x1b')](),_0x5a56f8['originalname'][_0x64ac('0x1c')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x64ac('0x14')](_0x64ac('0x1d'),upload[_0x64ac('0x1e')](_0x64ac('0x1f')),controller['attachmentUpload']);router[_0x64ac('0x14')]('/:id/messages',auth[_0x64ac('0xd')](),controller[_0x64ac('0x20')]);router[_0x64ac('0x14')](_0x64ac('0x21'),auth[_0x64ac('0x8')](),interaction['tracked']('chat',_0x64ac('0x22')),controller['addTags']);router[_0x64ac('0x23')]('/:id',auth[_0x64ac('0x8')](),interaction[_0x64ac('0x24')]('chat',_0x64ac('0x25')),controller['update']);router[_0x64ac('0x23')](_0x64ac('0x26'),controller[_0x64ac('0x27')]);router[_0x64ac('0x23')](_0x64ac('0x28'),auth[_0x64ac('0xd')](),controller['abandon']);router[_0x64ac('0x23')](_0x64ac('0x29'),controller['close']);router[_0x64ac('0x2a')](_0x64ac('0xc'),auth[_0x64ac('0x8')](),interaction[_0x64ac('0x24')](_0x64ac('0x2b'),'chatinteraction:destroy'),controller['destroy']);router[_0x64ac('0x2a')](_0x64ac('0x21'),auth['isAuthenticated'](),controller[_0x64ac('0x2c')]);module[_0x64ac('0x2d')]=router; \ No newline at end of file +var _0x9785=['/:id','isChatInteractionAuthorized','show','attachmentDownload','/:id/messages','/:id/my_messages','/:id/download','download','post','create','diskStorage','join','server/files/attachments/','%s-%s','originalname','replace','single','file','attachmentUpload','addMessage','tracked','chat','chatinteraction:addtags','addTags','put','chatinteraction:update','update','/:id/custom_update','customUpdate','/:id/abandon','abandon','/:id/close','close','delete','chatinteraction:destroy','destroy','/:id/tags','removeTags','multer','path','connect-timeout','Router','../../components/auth/service','../../config/environment','get','index','/describe','isAuthenticated','describe'];(function(_0x52b072,_0x1cf944){var _0x1d7f9b=function(_0x39caee){while(--_0x39caee){_0x52b072['push'](_0x52b072['shift']());}};_0x1d7f9b(++_0x1cf944);}(_0x9785,0xea));var _0x5978=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9785[_0x3b380d];return _0x54502b;};'use strict';var multer=require(_0x5978('0x0'));var util=require('util');var path=require(_0x5978('0x1'));var timeout=require(_0x5978('0x2'));var express=require('express');var router=express[_0x5978('0x3')]();var auth=require(_0x5978('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x5978('0x5'));var controller=require('./chatInteraction.controller');router[_0x5978('0x6')]('/',auth['isAuthenticated'](),controller[_0x5978('0x7')]);router['get'](_0x5978('0x8'),auth[_0x5978('0x9')](),controller[_0x5978('0xa')]);router['get'](_0x5978('0xb'),auth[_0x5978('0xc')](),controller[_0x5978('0xd')]);router['get']('/:id/attachment_download',auth[_0x5978('0xc')](),controller[_0x5978('0xe')]);router[_0x5978('0x6')](_0x5978('0xf'),auth[_0x5978('0x9')](),controller['getMessages']);router[_0x5978('0x6')](_0x5978('0x10'),auth[_0x5978('0xc')](),controller['getMyMessages']);router[_0x5978('0x6')](_0x5978('0x11'),auth[_0x5978('0x9')](),controller[_0x5978('0x12')]);router[_0x5978('0x13')]('/',auth[_0x5978('0x9')](),controller[_0x5978('0x14')]);var upload=multer({'storage':multer[_0x5978('0x15')]({'destination':function(_0x42edc6,_0x361fd9,_0x5ded5d){_0x5ded5d(null,path[_0x5978('0x16')](config['root'],_0x5978('0x17')));},'filename':function(_0x13de90,_0x10773d,_0x12f174){_0x12f174(null,util['format'](_0x5978('0x18'),Date['now'](),_0x10773d[_0x5978('0x19')][_0x5978('0x1a')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post']('/:id/attachment_upload',upload[_0x5978('0x1b')](_0x5978('0x1c')),controller[_0x5978('0x1d')]);router['post'](_0x5978('0xf'),auth[_0x5978('0xc')](),controller[_0x5978('0x1e')]);router[_0x5978('0x13')]('/:id/tags',auth[_0x5978('0x9')](),interaction[_0x5978('0x1f')](_0x5978('0x20'),_0x5978('0x21')),controller[_0x5978('0x22')]);router[_0x5978('0x23')]('/:id',auth[_0x5978('0x9')](),interaction['tracked'](_0x5978('0x20'),_0x5978('0x24')),controller[_0x5978('0x25')]);router[_0x5978('0x23')](_0x5978('0x26'),controller[_0x5978('0x27')]);router[_0x5978('0x23')](_0x5978('0x28'),auth[_0x5978('0xc')](),controller[_0x5978('0x29')]);router[_0x5978('0x23')](_0x5978('0x2a'),controller[_0x5978('0x2b')]);router[_0x5978('0x2c')](_0x5978('0xb'),auth[_0x5978('0x9')](),interaction['tracked'](_0x5978('0x20'),_0x5978('0x2d')),controller[_0x5978('0x2e')]);router[_0x5978('0x2c')](_0x5978('0x2f'),auth[_0x5978('0x9')](),controller[_0x5978('0x30')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index 1e26556..be08e6d 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 _0x2ef3=['sequelize','exports','TEXT','medium','BOOLEAN','INTEGER'];(function(_0x304dd4,_0x5eb14a){var _0x6929fc=function(_0x1069e0){while(--_0x1069e0){_0x304dd4['push'](_0x304dd4['shift']());}};_0x6929fc(++_0x5eb14a);}(_0x2ef3,0xba));var _0x32ef=function(_0x1a8505,_0x4a69f4){_0x1a8505=_0x1a8505-0x0;var _0x19858c=_0x2ef3[_0x1a8505];return _0x19858c;};'use strict';var Sequelize=require(_0x32ef('0x0'));module[_0x32ef('0x1')]={'body':{'type':Sequelize[_0x32ef('0x2')](_0x32ef('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x32ef('0x4')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x32ef('0x5')]}}; \ No newline at end of file +var _0x1a85=['BOOLEAN','TEXT','medium'];(function(_0x2d8d69,_0x8e47ff){var _0x39ae22=function(_0xd7935e){while(--_0xd7935e){_0x2d8d69['push'](_0x2d8d69['shift']());}};_0x39ae22(++_0x8e47ff);}(_0x1a85,0x178));var _0x51a8=function(_0x4f7b43,_0x119c22){_0x4f7b43=_0x4f7b43-0x0;var _0x2fcdf3=_0x1a85[_0x4f7b43];return _0x2fcdf3;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0x51a8('0x0')](_0x51a8('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x51a8('0x2')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index 2ef31b2..cd18ede 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 _0x268b=['createdAt','FromId','ToId','read','-createdAt','all','eml-format','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','redis','socket.io-emitter','register','end','status','count','offset','limit','set','Content-Range','json','reject','save','destroy','then','error','stack','name','send','index','map','ChatInternalMessage','rawAttributes','type','key','model','query','filters','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','include','rows','catch','params','keys','intersection','fields','find','create','body','update','describe','get','messages','lastMessageAt','lastMessage','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','agent','admin','user','role','internal','online','lastLoginAt','-online','VoiceQueue','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','autoAssociation','findAll','isEmpty','resourceId','push'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x268b,0xdc));var _0xb268=function(_0x5a7618,_0x3f44c2){_0x5a7618=_0x5a7618-0x0;var _0x12dc65=_0x268b[_0x5a7618];return _0x12dc65;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xb268('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb268('0x1'));var jsonpatch=require(_0xb268('0x2'));var rp=require('request-promise');var moment=require(_0xb268('0x3'));var BPromise=require(_0xb268('0x4'));var Mustache=require('mustache');var util=require(_0xb268('0x5'));var path=require(_0xb268('0x6'));var sox=require(_0xb268('0x7'));var csv=require(_0xb268('0x8'));var ejs=require(_0xb268('0x9'));var fs=require('fs');var _=require(_0xb268('0xa'));var squel=require(_0xb268('0xb'));var crypto=require(_0xb268('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xb268('0xd'));var toCsv=require(_0xb268('0x8'));var querystring=require(_0xb268('0xe'));var Papa=require(_0xb268('0xf'));var Redis=require(_0xb268('0x10'));var authService=require(_0xb268('0x11'));var qs=require(_0xb268('0x12'));var as=require(_0xb268('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb268('0x14'))(_0xb268('0x15'));var utils=require('../../config/utils');var config=require(_0xb268('0x16'));var db=require(_0xb268('0x17'))['db'];config['redis']=_['defaults'](config[_0xb268('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0xb268('0x19'))(new Redis(config['redis']));require('./chatInternalMessage.socket')[_0xb268('0x1a')](socket);function respondWithStatusCode(_0x3c6203,_0x2c1bc8){_0x2c1bc8=_0x2c1bc8||0xcc;return function(_0x3d9ec0){if(_0x3d9ec0){return _0x3c6203['sendStatus'](_0x2c1bc8);}return _0x3c6203['status'](_0x2c1bc8)[_0xb268('0x1b')]();};}function respondWithResult(_0x27ba7e,_0xba6b8){_0xba6b8=_0xba6b8||0xc8;return function(_0x42c5d2){if(_0x42c5d2){return _0x27ba7e[_0xb268('0x1c')](_0xba6b8)['json'](_0x42c5d2);}};}function respondWithFilteredResult(_0x5a4452,_0x207356){return function(_0x4430f9){if(_0x4430f9){var _0x5b9546=_0x4430f9[_0xb268('0x1d')],_0x215c74=_0x207356['offset'],_0x9114ae=_0x207356[_0xb268('0x1e')]+_0x207356[_0xb268('0x1f')],_0x29f531;if(_0x9114ae>=_0x5b9546){_0x9114ae=_0x5b9546;_0x29f531=0xc8;}else{_0x29f531=0xce;}_0x5a4452[_0xb268('0x1c')](_0x29f531);return _0x5a4452[_0xb268('0x20')](_0xb268('0x21'),_0x215c74+'-'+_0x9114ae+'/'+_0x5b9546)[_0xb268('0x22')](_0x4430f9);}return null;};}function patchUpdates(_0x167138){return function(_0x143f48){try{jsonpatch['apply'](_0x143f48,_0x167138,!![]);}catch(_0x2795a4){return BPromise[_0xb268('0x23')](_0x2795a4);}return _0x143f48[_0xb268('0x24')]();};}function saveUpdates(_0x27f10d,_0x212b40){return function(_0x1f1863){if(_0x1f1863){return _0x1f1863['update'](_0x27f10d)['then'](function(_0x3c7149){return _0x3c7149;});}return null;};}function removeEntity(_0x38e8ab,_0x6734e8){return function(_0xd9f567){if(_0xd9f567){return _0xd9f567[_0xb268('0x25')]()[_0xb268('0x26')](function(){_0x38e8ab['status'](0xcc)[_0xb268('0x1b')]();});}};}function handleEntityNotFound(_0x555d94,_0x53eb2b){return function(_0x351bcd){if(!_0x351bcd){_0x555d94['sendStatus'](0x194);}return _0x351bcd;};}function handleError(_0x5acaad,_0x481c25){_0x481c25=_0x481c25||0x1f4;return function(_0x51ba2e){logger[_0xb268('0x27')](_0x51ba2e[_0xb268('0x28')]);if(_0x51ba2e[_0xb268('0x29')]){delete _0x51ba2e[_0xb268('0x29')];}_0x5acaad[_0xb268('0x1c')](_0x481c25)[_0xb268('0x2a')](_0x51ba2e);};}exports[_0xb268('0x2b')]=function(_0x2941fb,_0xdfbc74){var _0x4444bc={},_0x3e7c6d={},_0x3313fe={'count':0x0,'rows':[]};var _0x574550=_[_0xb268('0x2c')](db[_0xb268('0x2d')][_0xb268('0x2e')],function(_0x2818a3){return{'name':_0x2818a3['fieldName'],'type':_0x2818a3[_0xb268('0x2f')][_0xb268('0x30')]};});_0x3e7c6d[_0xb268('0x31')]=_['map'](_0x574550,_0xb268('0x29'));_0x3e7c6d[_0xb268('0x32')]=_['keys'](_0x2941fb[_0xb268('0x32')]);_0x3e7c6d[_0xb268('0x33')]=_['intersection'](_0x3e7c6d[_0xb268('0x31')],_0x3e7c6d[_0xb268('0x32')]);_0x4444bc[_0xb268('0x34')]=_['intersection'](_0x3e7c6d[_0xb268('0x31')],qs['fields'](_0x2941fb[_0xb268('0x32')]['fields']));_0x4444bc[_0xb268('0x34')]=_0x4444bc[_0xb268('0x34')][_0xb268('0x35')]?_0x4444bc[_0xb268('0x34')]:_0x3e7c6d[_0xb268('0x31')];if(!_0x2941fb['query'][_0xb268('0x36')](_0xb268('0x37'))){_0x4444bc['limit']=qs['limit'](_0x2941fb[_0xb268('0x32')][_0xb268('0x1f')]);_0x4444bc[_0xb268('0x1e')]=qs[_0xb268('0x1e')](_0x2941fb[_0xb268('0x32')][_0xb268('0x1e')]);}_0x4444bc['order']=qs[_0xb268('0x38')](_0x2941fb[_0xb268('0x32')][_0xb268('0x38')]);_0x4444bc[_0xb268('0x39')]=qs[_0xb268('0x33')](_[_0xb268('0x3a')](_0x2941fb[_0xb268('0x32')],_0x3e7c6d[_0xb268('0x33')]));if(_0x2941fb[_0xb268('0x32')][_0xb268('0x3b')]){_0x4444bc['where']=_[_0xb268('0x3c')](_0x4444bc[_0xb268('0x39')],{'$or':_['map'](_0x574550,function(_0x1a9775){if(_0x1a9775[_0xb268('0x2f')]!=='VIRTUAL'){var _0x48c73c={};_0x48c73c[_0x1a9775['name']]={'$like':'%'+_0x2941fb['query'][_0xb268('0x3b')]+'%'};return _0x48c73c;}})});}_0x4444bc=_['merge']({},_0x4444bc,_0x2941fb[_0xb268('0x3d')]);var _0x2d47eb={'where':_0x4444bc[_0xb268('0x39')]};return db[_0xb268('0x2d')]['count'](_0x2d47eb)[_0xb268('0x26')](function(_0x538a1e){_0x3313fe[_0xb268('0x1d')]=_0x538a1e;if(_0x2941fb[_0xb268('0x32')][_0xb268('0x3e')]){_0x4444bc[_0xb268('0x3f')]=[{'all':!![]}];}return db['ChatInternalMessage']['findAll'](_0x4444bc);})[_0xb268('0x26')](function(_0x4c2405){_0x3313fe[_0xb268('0x40')]=_0x4c2405;return _0x3313fe;})[_0xb268('0x26')](respondWithFilteredResult(_0xdfbc74,_0x4444bc))[_0xb268('0x41')](handleError(_0xdfbc74,null));};exports['show']=function(_0x47c5c7,_0xd4a7eb){var _0x5d1d6b={'raw':!![],'where':{'id':_0x47c5c7[_0xb268('0x42')]['id']}},_0x45f270={};_0x45f270[_0xb268('0x31')]=_['keys'](db[_0xb268('0x2d')][_0xb268('0x2e')]);_0x45f270[_0xb268('0x32')]=_[_0xb268('0x43')](_0x47c5c7[_0xb268('0x32')]);_0x45f270['filters']=_['intersection'](_0x45f270['model'],_0x45f270['query']);_0x5d1d6b[_0xb268('0x34')]=_[_0xb268('0x44')](_0x45f270['model'],qs[_0xb268('0x45')](_0x47c5c7[_0xb268('0x32')]['fields']));_0x5d1d6b['attributes']=_0x5d1d6b[_0xb268('0x34')][_0xb268('0x35')]?_0x5d1d6b[_0xb268('0x34')]:_0x45f270[_0xb268('0x31')];if(_0x47c5c7[_0xb268('0x32')][_0xb268('0x3e')]){_0x5d1d6b['include']=[{'all':!![]}];}_0x5d1d6b=_['merge']({},_0x5d1d6b,_0x47c5c7[_0xb268('0x3d')]);return db['ChatInternalMessage'][_0xb268('0x46')](_0x5d1d6b)[_0xb268('0x26')](handleEntityNotFound(_0xd4a7eb,null))[_0xb268('0x26')](respondWithResult(_0xd4a7eb,null))[_0xb268('0x41')](handleError(_0xd4a7eb,null));};exports['create']=function(_0x518c05,_0x28cc4c){return db[_0xb268('0x2d')][_0xb268('0x47')](_0x518c05[_0xb268('0x48')],{})['then'](respondWithResult(_0x28cc4c,0xc9))[_0xb268('0x41')](handleError(_0x28cc4c,null));};exports[_0xb268('0x49')]=function(_0x2f994b,_0x12a374){if(_0x2f994b[_0xb268('0x48')]['id']){delete _0x2f994b['body']['id'];}return db['ChatInternalMessage']['find']({'where':{'id':_0x2f994b[_0xb268('0x42')]['id']}})['then'](handleEntityNotFound(_0x12a374,null))[_0xb268('0x26')](saveUpdates(_0x2f994b[_0xb268('0x48')],null))['then'](respondWithResult(_0x12a374,null))[_0xb268('0x41')](handleError(_0x12a374,null));};exports[_0xb268('0x25')]=function(_0x2ad973,_0x22b402){return db[_0xb268('0x2d')][_0xb268('0x46')]({'where':{'id':_0x2ad973[_0xb268('0x42')]['id']}})[_0xb268('0x26')](handleEntityNotFound(_0x22b402,null))['then'](removeEntity(_0x22b402,null))[_0xb268('0x41')](handleError(_0x22b402,null));};exports[_0xb268('0x4a')]=function(_0x3155ee,_0x2df65e){return db['ChatInternalMessage'][_0xb268('0x4a')]()[_0xb268('0x26')](respondWithResult(_0x2df65e,null))['catch'](handleError(_0x2df65e,null));};function wrapUser(_0x93e589){return function(_0x3945ad){var _0x4117bb=_0x93e589[_0xb268('0x4b')]({'plain':!![]});_0x4117bb[_0xb268('0x4c')]=[];if(_0x3945ad){_0x4117bb[_0xb268('0x4d')]=_0x3945ad['createdAt'];_0x4117bb[_0xb268('0x4e')]=_0x3945ad;}else{_0x4117bb[_0xb268('0x4d')]=moment(0x0)[_0xb268('0x4f')](_0xb268('0x50'));_0x4117bb['lastMessage']={};}return _0x4117bb;};}exports[_0xb268('0x51')]=function(_0x4d6a52,_0x37e554,_0x28fb83){var _0x41f7a7=[];return db[_0xb268('0x52')]['findAll']({'where':{'role':[_0xb268('0x53'),_0xb268('0x54'),_0xb268('0x55')]},'attributes':['id','fullname',_0xb268('0x29'),_0xb268('0x56'),'userpic',_0xb268('0x57'),_0xb268('0x58'),_0xb268('0x59'),'allowmessenger','showWebBar'],'order':qs[_0xb268('0x38')](_0xb268('0x5a')),'include':[{'model':db[_0xb268('0x5b')],'as':_0xb268('0x5c'),'attributes':['id','name',_0xb268('0x2f')],'through':{'attributes':[]}}]})[_0xb268('0x26')](function(_0x59ae04){if(_0x59ae04){var _0x31e41d=_0x4d6a52[_0xb268('0x55')]['get']({'plain':!![]});if(!_0x31e41d)throw new Error(_0xb268('0x5d'));if(_0x31e41d['role']===_0xb268('0x55')){return db[_0xb268('0x5e')]['find']({'where':{'name':_0xb268('0x5f'),'userProfileId':_0x31e41d['userProfileId']},'raw':!![]})[_0xb268('0x26')](function(_0x4f1871){if(_0x4f1871){if(_0x4f1871[_0xb268('0x60')]===0x0){return db['UserProfileResource'][_0xb268('0x61')]({'where':{'sectionId':_0x4f1871['id']},'raw':!![]})['then'](function(_0x224562){var _0x181e51=[];if(_[_0xb268('0x62')](_0x224562)){_0x181e51=_[_0xb268('0x3b')](_0x59ae04,function(_0x249db8){if(_0x249db8[_0xb268('0x56')]!==_0xb268('0x53')){return _0x249db8;}});return _0x181e51;}else{for(var _0x38c3a6=0x0;_0x38c3a6<_0x59ae04[_0xb268('0x35')];_0x38c3a6++){var _0x339208=_0x59ae04[_0x38c3a6];if(_0x339208[_0xb268('0x56')]===_0xb268('0x53')){var _0x527d0f=_[_0xb268('0x46')](_0x224562,function(_0x388303){return _0x388303[_0xb268('0x63')]===_0x339208['id'];});if(_0x527d0f)_0x181e51['push'](_0x339208);}else{_0x181e51[_0xb268('0x64')](_0x339208);}}return _0x181e51;}});}else{return _0x59ae04;}}else{var _0x1a6b61=_[_0xb268('0x3b')](_0x59ae04,function(_0x3a07ed){if(_0x3a07ed[_0xb268('0x56')]!==_0xb268('0x53')){return _0x3a07ed;}});return _0x1a6b61;}});}else{return _0x59ae04;}}})[_0xb268('0x26')](function(_0x40b982){var _0x4807d6=[];if(_0x40b982){_0x41f7a7=_0x40b982;for(var _0x201ab9=0x0;_0x201ab9<_0x40b982[_0xb268('0x35')];_0x201ab9+=0x1){_0x41f7a7[_0x201ab9][_0xb268('0x4c')]=[];_0x4807d6[_0xb268('0x64')](db[_0xb268('0x2d')]['find']({'where':{'FromId':[_0x4d6a52['user']['id'],_0x40b982[_0x201ab9]['id']],'ToId':[_0x4d6a52[_0xb268('0x55')]['id'],_0x40b982[_0x201ab9]['id']],'ChatGroupId':null},'attributes':['id',_0xb268('0x65'),_0xb268('0x66'),_0xb268('0x67'),_0xb268('0x68'),'body'],'order':qs[_0xb268('0x38')](_0xb268('0x69')),'limit':0x1,'offset':0x0,'raw':!![]})[_0xb268('0x26')](wrapUser(_0x40b982[_0x201ab9])));}return BPromise[_0xb268('0x6a')](_0x4807d6);}return[];})[_0xb268('0x26')](function(_0x5091f9){return{'rows':_0x5091f9,'count':_0x5091f9[_0xb268('0x35')]};})[_0xb268('0x26')](respondWithResult(_0x37e554,null))[_0xb268('0x41')](handleError(_0x37e554,null));}; \ No newline at end of file +var _0x5533=['moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./chatInternalMessage.socket','register','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','sendStatus','stack','name','send','index','map','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','ChatInternalMessage','rows','show','params','rawAttributes','includeAll','include','find','catch','create','body','update','describe','get','messages','lastMessageAt','createdAt','lastMessage','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','agent','user','fullname','role','userpic','internal','allowmessenger','VoiceQueue','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','userProfileId','autoAssociation','UserProfileResource','isEmpty','resourceId','push','FromId','ToId','-createdAt','all','html-pdf','rimraf','request-promise'];(function(_0x5f16c0,_0x37ba0b){var _0xb35357=function(_0x461e95){while(--_0x461e95){_0x5f16c0['push'](_0x5f16c0['shift']());}};_0xb35357(++_0x37ba0b);}(_0x5533,0x6d));var _0x3553=function(_0x146295,_0x21f208){_0x146295=_0x146295-0x0;var _0x485c27=_0x5533[_0x146295];return _0x485c27;};'use strict';var pdf=require(_0x3553('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x3553('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x3553('0x2'));var moment=require(_0x3553('0x3'));var BPromise=require(_0x3553('0x4'));var Mustache=require(_0x3553('0x5'));var util=require(_0x3553('0x6'));var path=require(_0x3553('0x7'));var sox=require(_0x3553('0x8'));var csv=require(_0x3553('0x9'));var ejs=require(_0x3553('0xa'));var fs=require('fs');var _=require(_0x3553('0xb'));var squel=require('squel');var crypto=require(_0x3553('0xc'));var jsforce=require(_0x3553('0xd'));var deskjs=require(_0x3553('0xe'));var toCsv=require(_0x3553('0x9'));var querystring=require(_0x3553('0xf'));var Papa=require(_0x3553('0x10'));var Redis=require(_0x3553('0x11'));var authService=require(_0x3553('0x12'));var qs=require(_0x3553('0x13'));var as=require(_0x3553('0x14'));var hardwareService=require(_0x3553('0x15'));var logger=require('../../config/logger')(_0x3553('0x16'));var utils=require('../../config/utils');var config=require(_0x3553('0x17'));var db=require(_0x3553('0x18'))['db'];config[_0x3553('0x19')]=_[_0x3553('0x1a')](config[_0x3553('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x3553('0x1b'))(new Redis(config[_0x3553('0x19')]));require(_0x3553('0x1c'))[_0x3553('0x1d')](socket);function respondWithStatusCode(_0x321831,_0x299f60){_0x299f60=_0x299f60||0xcc;return function(_0x1065ec){if(_0x1065ec){return _0x321831['sendStatus'](_0x299f60);}return _0x321831['status'](_0x299f60)[_0x3553('0x1e')]();};}function respondWithResult(_0x1eb96d,_0x4a87d9){_0x4a87d9=_0x4a87d9||0xc8;return function(_0x1e0c69){if(_0x1e0c69){return _0x1eb96d[_0x3553('0x1f')](_0x4a87d9)[_0x3553('0x20')](_0x1e0c69);}};}function respondWithFilteredResult(_0x2fa062,_0x563a4f){return function(_0x422207){if(_0x422207){var _0xa6ee32=_0x422207[_0x3553('0x21')],_0x3ded1b=_0x563a4f[_0x3553('0x22')],_0x4c13e4=_0x563a4f[_0x3553('0x22')]+_0x563a4f[_0x3553('0x23')],_0x5b4bce;if(_0x4c13e4>=_0xa6ee32){_0x4c13e4=_0xa6ee32;_0x5b4bce=0xc8;}else{_0x5b4bce=0xce;}_0x2fa062[_0x3553('0x1f')](_0x5b4bce);return _0x2fa062[_0x3553('0x24')](_0x3553('0x25'),_0x3ded1b+'-'+_0x4c13e4+'/'+_0xa6ee32)[_0x3553('0x20')](_0x422207);}return null;};}function patchUpdates(_0x29df77){return function(_0x3281c8){try{jsonpatch[_0x3553('0x26')](_0x3281c8,_0x29df77,!![]);}catch(_0x2a6602){return BPromise[_0x3553('0x27')](_0x2a6602);}return _0x3281c8[_0x3553('0x28')]();};}function saveUpdates(_0x3b7712,_0x400d54){return function(_0x550ca1){if(_0x550ca1){return _0x550ca1['update'](_0x3b7712)[_0x3553('0x29')](function(_0x5801b5){return _0x5801b5;});}return null;};}function removeEntity(_0x177332,_0x11c6bf){return function(_0xb682a9){if(_0xb682a9){return _0xb682a9[_0x3553('0x2a')]()[_0x3553('0x29')](function(){_0x177332['status'](0xcc)[_0x3553('0x1e')]();});}};}function handleEntityNotFound(_0x1e59d8,_0x22ffa1){return function(_0xf88fde){if(!_0xf88fde){_0x1e59d8[_0x3553('0x2b')](0x194);}return _0xf88fde;};}function handleError(_0x2980ad,_0x1b66e6){_0x1b66e6=_0x1b66e6||0x1f4;return function(_0x2444a7){logger['error'](_0x2444a7[_0x3553('0x2c')]);if(_0x2444a7[_0x3553('0x2d')]){delete _0x2444a7[_0x3553('0x2d')];}_0x2980ad[_0x3553('0x1f')](_0x1b66e6)[_0x3553('0x2e')](_0x2444a7);};}exports[_0x3553('0x2f')]=function(_0x52b2ad,_0x50b28e){var _0x864c8={},_0x33096e={},_0x54de8e={'count':0x0,'rows':[]};var _0x5b1ec7=_[_0x3553('0x30')](db['ChatInternalMessage']['rawAttributes'],function(_0x18fe7e){return{'name':_0x18fe7e[_0x3553('0x31')],'type':_0x18fe7e[_0x3553('0x32')][_0x3553('0x33')]};});_0x33096e[_0x3553('0x34')]=_['map'](_0x5b1ec7,'name');_0x33096e[_0x3553('0x35')]=_[_0x3553('0x36')](_0x52b2ad[_0x3553('0x35')]);_0x33096e[_0x3553('0x37')]=_[_0x3553('0x38')](_0x33096e[_0x3553('0x34')],_0x33096e[_0x3553('0x35')]);_0x864c8[_0x3553('0x39')]=_[_0x3553('0x38')](_0x33096e[_0x3553('0x34')],qs[_0x3553('0x3a')](_0x52b2ad[_0x3553('0x35')]['fields']));_0x864c8['attributes']=_0x864c8[_0x3553('0x39')][_0x3553('0x3b')]?_0x864c8[_0x3553('0x39')]:_0x33096e['model'];if(!_0x52b2ad[_0x3553('0x35')][_0x3553('0x3c')]('nolimit')){_0x864c8[_0x3553('0x23')]=qs[_0x3553('0x23')](_0x52b2ad['query'][_0x3553('0x23')]);_0x864c8[_0x3553('0x22')]=qs[_0x3553('0x22')](_0x52b2ad['query']['offset']);}_0x864c8[_0x3553('0x3d')]=qs[_0x3553('0x3e')](_0x52b2ad[_0x3553('0x35')]['sort']);_0x864c8[_0x3553('0x3f')]=qs[_0x3553('0x37')](_[_0x3553('0x40')](_0x52b2ad[_0x3553('0x35')],_0x33096e['filters']));if(_0x52b2ad['query'][_0x3553('0x41')]){_0x864c8[_0x3553('0x3f')]=_[_0x3553('0x42')](_0x864c8['where'],{'$or':_['map'](_0x5b1ec7,function(_0x69c917){if(_0x69c917['type']!==_0x3553('0x43')){var _0x5b70ad={};_0x5b70ad[_0x69c917[_0x3553('0x2d')]]={'$like':'%'+_0x52b2ad[_0x3553('0x35')]['filter']+'%'};return _0x5b70ad;}})});}_0x864c8=_[_0x3553('0x42')]({},_0x864c8,_0x52b2ad[_0x3553('0x44')]);var _0x5c1192={'where':_0x864c8[_0x3553('0x3f')]};return db[_0x3553('0x45')]['count'](_0x5c1192)[_0x3553('0x29')](function(_0x19de20){_0x54de8e[_0x3553('0x21')]=_0x19de20;if(_0x52b2ad[_0x3553('0x35')]['includeAll']){_0x864c8['include']=[{'all':!![]}];}return db[_0x3553('0x45')]['findAll'](_0x864c8);})['then'](function(_0x2f7e03){_0x54de8e[_0x3553('0x46')]=_0x2f7e03;return _0x54de8e;})[_0x3553('0x29')](respondWithFilteredResult(_0x50b28e,_0x864c8))['catch'](handleError(_0x50b28e,null));};exports[_0x3553('0x47')]=function(_0x1ed31c,_0x29686d){var _0x29b83b={'raw':!![],'where':{'id':_0x1ed31c[_0x3553('0x48')]['id']}},_0x412ba2={};_0x412ba2[_0x3553('0x34')]=_['keys'](db[_0x3553('0x45')][_0x3553('0x49')]);_0x412ba2[_0x3553('0x35')]=_[_0x3553('0x36')](_0x1ed31c['query']);_0x412ba2[_0x3553('0x37')]=_[_0x3553('0x38')](_0x412ba2[_0x3553('0x34')],_0x412ba2[_0x3553('0x35')]);_0x29b83b[_0x3553('0x39')]=_[_0x3553('0x38')](_0x412ba2[_0x3553('0x34')],qs[_0x3553('0x3a')](_0x1ed31c[_0x3553('0x35')][_0x3553('0x3a')]));_0x29b83b['attributes']=_0x29b83b[_0x3553('0x39')][_0x3553('0x3b')]?_0x29b83b[_0x3553('0x39')]:_0x412ba2[_0x3553('0x34')];if(_0x1ed31c[_0x3553('0x35')][_0x3553('0x4a')]){_0x29b83b[_0x3553('0x4b')]=[{'all':!![]}];}_0x29b83b=_[_0x3553('0x42')]({},_0x29b83b,_0x1ed31c['options']);return db[_0x3553('0x45')][_0x3553('0x4c')](_0x29b83b)[_0x3553('0x29')](handleEntityNotFound(_0x29686d,null))[_0x3553('0x29')](respondWithResult(_0x29686d,null))[_0x3553('0x4d')](handleError(_0x29686d,null));};exports['create']=function(_0x373763,_0x407577){return db['ChatInternalMessage'][_0x3553('0x4e')](_0x373763[_0x3553('0x4f')],{})[_0x3553('0x29')](respondWithResult(_0x407577,0xc9))[_0x3553('0x4d')](handleError(_0x407577,null));};exports[_0x3553('0x50')]=function(_0x419836,_0x7947e2){if(_0x419836[_0x3553('0x4f')]['id']){delete _0x419836[_0x3553('0x4f')]['id'];}return db['ChatInternalMessage']['find']({'where':{'id':_0x419836[_0x3553('0x48')]['id']}})[_0x3553('0x29')](handleEntityNotFound(_0x7947e2,null))['then'](saveUpdates(_0x419836[_0x3553('0x4f')],null))[_0x3553('0x29')](respondWithResult(_0x7947e2,null))['catch'](handleError(_0x7947e2,null));};exports[_0x3553('0x2a')]=function(_0x2ed5a0,_0x2b92aa){return db[_0x3553('0x45')][_0x3553('0x4c')]({'where':{'id':_0x2ed5a0[_0x3553('0x48')]['id']}})[_0x3553('0x29')](handleEntityNotFound(_0x2b92aa,null))['then'](removeEntity(_0x2b92aa,null))[_0x3553('0x4d')](handleError(_0x2b92aa,null));};exports['describe']=function(_0x33d26f,_0x519ef){return db[_0x3553('0x45')][_0x3553('0x51')]()[_0x3553('0x29')](respondWithResult(_0x519ef,null))[_0x3553('0x4d')](handleError(_0x519ef,null));};function wrapUser(_0xf0c019){return function(_0x53210d){var _0x3d3c70=_0xf0c019[_0x3553('0x52')]({'plain':!![]});_0x3d3c70[_0x3553('0x53')]=[];if(_0x53210d){_0x3d3c70[_0x3553('0x54')]=_0x53210d[_0x3553('0x55')];_0x3d3c70[_0x3553('0x56')]=_0x53210d;}else{_0x3d3c70[_0x3553('0x54')]=moment(0x0)[_0x3553('0x57')](_0x3553('0x58'));_0x3d3c70[_0x3553('0x56')]={};}return _0x3d3c70;};}exports[_0x3553('0x59')]=function(_0xf036e2,_0x8dafd,_0x51c417){var _0x2d5d49=[];return db['User']['findAll']({'where':{'role':[_0x3553('0x5a'),'admin',_0x3553('0x5b')]},'attributes':['id',_0x3553('0x5c'),_0x3553('0x2d'),_0x3553('0x5d'),_0x3553('0x5e'),_0x3553('0x5f'),'online','lastLoginAt',_0x3553('0x60'),'showWebBar'],'order':qs[_0x3553('0x3e')]('-online'),'include':[{'model':db[_0x3553('0x61')],'as':_0x3553('0x62'),'attributes':['id',_0x3553('0x2d'),_0x3553('0x32')],'through':{'attributes':[]}}]})[_0x3553('0x29')](function(_0x4ee3a1){if(_0x4ee3a1){var _0x2a0660=_0xf036e2['user'][_0x3553('0x52')]({'plain':!![]});if(!_0x2a0660)throw new Error(_0x3553('0x63'));if(_0x2a0660[_0x3553('0x5d')]===_0x3553('0x5b')){return db[_0x3553('0x64')][_0x3553('0x4c')]({'where':{'name':_0x3553('0x65'),'userProfileId':_0x2a0660[_0x3553('0x66')]},'raw':!![]})['then'](function(_0xc3e137){if(_0xc3e137){if(_0xc3e137[_0x3553('0x67')]===0x0){return db[_0x3553('0x68')]['findAll']({'where':{'sectionId':_0xc3e137['id']},'raw':!![]})[_0x3553('0x29')](function(_0x55134c){var _0x43f43e=[];if(_[_0x3553('0x69')](_0x55134c)){_0x43f43e=_[_0x3553('0x41')](_0x4ee3a1,function(_0x2486b0){if(_0x2486b0[_0x3553('0x5d')]!==_0x3553('0x5a')){return _0x2486b0;}});return _0x43f43e;}else{for(var _0x250dbc=0x0;_0x250dbc<_0x4ee3a1['length'];_0x250dbc++){var _0x485541=_0x4ee3a1[_0x250dbc];if(_0x485541[_0x3553('0x5d')]===_0x3553('0x5a')){var _0x4c5a97=_[_0x3553('0x4c')](_0x55134c,function(_0x38f6a3){return _0x38f6a3[_0x3553('0x6a')]===_0x485541['id'];});if(_0x4c5a97)_0x43f43e[_0x3553('0x6b')](_0x485541);}else{_0x43f43e[_0x3553('0x6b')](_0x485541);}}return _0x43f43e;}});}else{return _0x4ee3a1;}}else{var _0x102b04=_[_0x3553('0x41')](_0x4ee3a1,function(_0x1cd351){if(_0x1cd351[_0x3553('0x5d')]!=='agent'){return _0x1cd351;}});return _0x102b04;}});}else{return _0x4ee3a1;}}})[_0x3553('0x29')](function(_0x1d255b){var _0x4975cf=[];if(_0x1d255b){_0x2d5d49=_0x1d255b;for(var _0x178255=0x0;_0x178255<_0x1d255b['length'];_0x178255+=0x1){_0x2d5d49[_0x178255][_0x3553('0x53')]=[];_0x4975cf[_0x3553('0x6b')](db['ChatInternalMessage'][_0x3553('0x4c')]({'where':{'FromId':[_0xf036e2[_0x3553('0x5b')]['id'],_0x1d255b[_0x178255]['id']],'ToId':[_0xf036e2[_0x3553('0x5b')]['id'],_0x1d255b[_0x178255]['id']],'ChatGroupId':null},'attributes':['id',_0x3553('0x55'),_0x3553('0x6c'),_0x3553('0x6d'),'read',_0x3553('0x4f')],'order':qs[_0x3553('0x3e')](_0x3553('0x6e')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x3553('0x29')](wrapUser(_0x1d255b[_0x178255])));}return BPromise[_0x3553('0x6f')](_0x4975cf);}return[];})['then'](function(_0x28de23){return{'rows':_0x28de23,'count':_0x28de23['length']};})[_0x3553('0x29')](respondWithResult(_0x8dafd,null))['catch'](handleError(_0x8dafd,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 26af012..9545b54 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 _0x8f1f=['events','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x79d22a,_0x1bff4c){var _0x157b3e=function(_0x2ac641){while(--_0x2ac641){_0x79d22a['push'](_0x79d22a['shift']());}};_0x157b3e(++_0x1bff4c);}(_0x8f1f,0xe1));var _0xf8f1=function(_0x2eb41e,_0x2bdf4c){_0x2eb41e=_0x2eb41e-0x0;var _0x493e89=_0x8f1f[_0x2eb41e];return _0x493e89;};'use strict';var EventEmitter=require(_0xf8f1('0x0'));var ChatInternalMessage=require('../../mysqldb')['db']['ChatInternalMessage'];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0xf8f1('0x1')](0x0);var events={'afterCreate':_0xf8f1('0x2'),'afterUpdate':_0xf8f1('0x3'),'afterDestroy':_0xf8f1('0x4')};function emitEvent(_0x2a5ef6){return function(_0x1d2233,_0x2c6a47,_0x1b973e){ChatInternalMessageEvents['emit'](_0x2a5ef6+':'+_0x1d2233['id'],_0x1d2233);ChatInternalMessageEvents[_0xf8f1('0x5')](_0x2a5ef6,_0x1d2233);_0x1b973e(null);};}for(var e in events){if(events[_0xf8f1('0x6')](e)){var event=events[e];ChatInternalMessage[_0xf8f1('0x7')](e,emitEvent(event));}}module[_0xf8f1('0x8')]=ChatInternalMessageEvents; \ No newline at end of file +var _0x1629=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatInternalMessage','setMaxListeners','update'];(function(_0x270b8c,_0x43bf26){var _0x5a76df=function(_0xc35bea){while(--_0xc35bea){_0x270b8c['push'](_0x270b8c['shift']());}};_0x5a76df(++_0x43bf26);}(_0x1629,0x1d8));var _0x9162=function(_0x1ac76a,_0x587cc0){_0x1ac76a=_0x1ac76a-0x0;var _0x4c35de=_0x1629[_0x1ac76a];return _0x4c35de;};'use strict';var EventEmitter=require(_0x9162('0x0'));var ChatInternalMessage=require(_0x9162('0x1'))['db'][_0x9162('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x9162('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x9162('0x4'),'afterDestroy':'remove'};function emitEvent(_0x5380c8){return function(_0x16bc88,_0x2a8dc1,_0x5b82dc){ChatInternalMessageEvents['emit'](_0x5380c8+':'+_0x16bc88['id'],_0x16bc88);ChatInternalMessageEvents[_0x9162('0x5')](_0x5380c8,_0x16bc88);_0x5b82dc(null);};}for(var e in events){if(events[_0x9162('0x6')](e)){var event=events[e];ChatInternalMessage[_0x9162('0x7')](e,emitEvent(event));}}module[_0x9162('0x8')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index 2b286e5..4a52695 100644 --- a/server/api/chatInternalMessage/chatInternalMessage.model.js +++ b/server/api/chatInternalMessage/chatInternalMessage.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['define','ChatInternalMessage','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./chatInternalMessage.attributes','exports'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xa9e0[_0x2bf141];return _0x48277b;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'chat_internal_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x0a9e('0xb')});}; \ No newline at end of file +var _0xd8b0=['define','chat_internal_messages','utf8mb4','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x1558c5,_0x475df6){var _0x342224=function(_0x358564){while(--_0x358564){_0x1558c5['push'](_0x1558c5['shift']());}};_0x342224(++_0x475df6);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./chatInternalMessage.attributes');module['exports']=function(_0x3f8b6f,_0x227c63){return _0x3f8b6f[_0x0d8b('0x7')]('ChatInternalMessage',attributes,{'tableName':_0x0d8b('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x0d8b('0x9'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index 99a7dd1..1bab5af 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 _0xaa08=['ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash','util','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./chatInternalMessage.socket','then','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x573ced,_0x5ac1b1){var _0x609179=function(_0x272cd2){while(--_0x272cd2){_0x573ced['push'](_0x573ced['shift']());}};_0x609179(++_0x5ac1b1);}(_0xaa08,0xaf));var _0x8aa0=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xaa08[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0x8aa0('0x0'));var util=require(_0x8aa0('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8aa0('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x8aa0('0x3'));var logger=require('../../config/logger')(_0x8aa0('0x4'));var config=require(_0x8aa0('0x5'));var jayson=require(_0x8aa0('0x6'));var client=jayson[_0x8aa0('0x7')][_0x8aa0('0x8')]({'port':0x232a});config[_0x8aa0('0x9')]=_['defaults'](config[_0x8aa0('0x9')],{'host':_0x8aa0('0xa'),'port':0x18eb});var socket=require(_0x8aa0('0xb'))(new Redis(config[_0x8aa0('0x9')]));require(_0x8aa0('0xc'))['register'](socket);function respondWithRpcPromise(_0x40757f,_0x2470c0,_0x4d1094){return new BPromise(function(_0x46a411,_0x2e642a){return client['request'](_0x40757f,_0x4d1094)[_0x8aa0('0xd')](function(_0x1727cc){logger['info'](_0x8aa0('0xe'),_0x2470c0,_0x8aa0('0xf'));logger[_0x8aa0('0x10')](_0x8aa0('0x11'),_0x2470c0,'request\x20sent',JSON[_0x8aa0('0x12')](_0x1727cc));if(_0x1727cc['error']){if(_0x1727cc['error']['code']===0x1f4){logger[_0x8aa0('0x13')](_0x8aa0('0xe'),_0x2470c0,_0x1727cc['error'][_0x8aa0('0x14')]);return _0x2e642a(_0x1727cc[_0x8aa0('0x13')][_0x8aa0('0x14')]);}logger['error'](_0x8aa0('0xe'),_0x2470c0,_0x1727cc[_0x8aa0('0x13')][_0x8aa0('0x14')]);return _0x46a411(_0x1727cc[_0x8aa0('0x13')]['message']);}else{logger[_0x8aa0('0x15')]('ChatInternalMessage,\x20%s,\x20%s',_0x2470c0,_0x8aa0('0xf'));_0x46a411(_0x1727cc[_0x8aa0('0x16')][_0x8aa0('0x14')]);}})[_0x8aa0('0x17')](function(_0x4ee64c){logger[_0x8aa0('0x13')](_0x8aa0('0xe'),_0x2470c0,_0x4ee64c);_0x2e642a(_0x4ee64c);});});} \ No newline at end of file +var _0x0717=['redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','then','info','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','ChatInternalMessage,\x20%s,\x20%s','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x455fde,_0x21c122){var _0x399fdb=function(_0xf2ba79){while(--_0xf2ba79){_0x455fde['push'](_0x455fde['shift']());}};_0x399fdb(++_0x21c122);}(_0x0717,0xf8));var _0x7071=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x0717[_0x618414];return _0x21c19a;};'use strict';var _=require(_0x7071('0x0'));var util=require(_0x7071('0x1'));var moment=require('moment');var BPromise=require(_0x7071('0x2'));var rs=require(_0x7071('0x3'));var fs=require('fs');var Redis=require(_0x7071('0x4'));var db=require(_0x7071('0x5'))['db'];var utils=require(_0x7071('0x6'));var logger=require(_0x7071('0x7'))(_0x7071('0x8'));var config=require(_0x7071('0x9'));var jayson=require(_0x7071('0xa'));var client=jayson[_0x7071('0xb')][_0x7071('0xc')]({'port':0x232a});config[_0x7071('0xd')]=_[_0x7071('0xe')](config[_0x7071('0xd')],{'host':_0x7071('0xf'),'port':0x18eb});var socket=require(_0x7071('0x10'))(new Redis(config[_0x7071('0xd')]));require(_0x7071('0x11'))[_0x7071('0x12')](socket);function respondWithRpcPromise(_0x53a3cd,_0x2d910e,_0x8e708b){return new BPromise(function(_0xbe178b,_0x13fb3a){return client['request'](_0x53a3cd,_0x8e708b)[_0x7071('0x13')](function(_0x1176d2){logger[_0x7071('0x14')]('ChatInternalMessage,\x20%s,\x20%s',_0x2d910e,'request\x20sent');logger[_0x7071('0x15')](_0x7071('0x16'),_0x2d910e,_0x7071('0x17'),JSON[_0x7071('0x18')](_0x1176d2));if(_0x1176d2[_0x7071('0x19')]){if(_0x1176d2[_0x7071('0x19')]['code']===0x1f4){logger[_0x7071('0x19')](_0x7071('0x1a'),_0x2d910e,_0x1176d2[_0x7071('0x19')][_0x7071('0x1b')]);return _0x13fb3a(_0x1176d2['error'][_0x7071('0x1b')]);}logger[_0x7071('0x19')]('ChatInternalMessage,\x20%s,\x20%s',_0x2d910e,_0x1176d2['error'][_0x7071('0x1b')]);return _0xbe178b(_0x1176d2[_0x7071('0x19')][_0x7071('0x1b')]);}else{logger['info']('ChatInternalMessage,\x20%s,\x20%s',_0x2d910e,'request\x20sent');_0xbe178b(_0x1176d2[_0x7071('0x1c')]['message']);}})['catch'](function(_0x1ebbff){logger[_0x7071('0x19')](_0x7071('0x1a'),_0x2d910e,_0x1ebbff);_0x13fb3a(_0x1ebbff);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index 92a1b46..1295ba0 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 _0xe2cc=['./chatInternalMessage.events','save','emit','removeListener','register','length','chatInternalMessage:'];(function(_0x1e841a,_0x91d3a6){var _0xff04de=function(_0x425caa){while(--_0x425caa){_0x1e841a['push'](_0x1e841a['shift']());}};_0xff04de(++_0x91d3a6);}(_0xe2cc,0x69));var _0xce2c=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe2cc[_0x14add3];return _0x4a174f;};'use strict';var ChatInternalMessageEvents=require(_0xce2c('0x0'));var events=[_0xce2c('0x1'),'remove','update'];function createListener(_0x3e19dc,_0x1e5b84){return function(_0x2279d5){_0x1e5b84[_0xce2c('0x2')](_0x3e19dc,_0x2279d5);};}function removeListener(_0x25e41a,_0x1a7c4e){return function(){ChatInternalMessageEvents[_0xce2c('0x3')](_0x25e41a,_0x1a7c4e);};}exports[_0xce2c('0x4')]=function(_0x592e10){for(var _0x51e5d0=0x0,_0x14bb4e=events[_0xce2c('0x5')];_0x51e5d0<_0x14bb4e;_0x51e5d0++){var _0x23f678=events[_0x51e5d0];var _0x29632b=createListener(_0xce2c('0x6')+_0x23f678,_0x592e10);ChatInternalMessageEvents['on'](_0x23f678,_0x29632b);}}; \ No newline at end of file +var _0xdab2=['register','length','chatInternalMessage:','./chatInternalMessage.events','save','update','removeListener'];(function(_0x381af1,_0xeda6d2){var _0xe541f7=function(_0x132c81){while(--_0x132c81){_0x381af1['push'](_0x381af1['shift']());}};_0xe541f7(++_0xeda6d2);}(_0xdab2,0x130));var _0x2dab=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdab2[_0x3dd15e];return _0x231fd0;};'use strict';var ChatInternalMessageEvents=require(_0x2dab('0x0'));var events=[_0x2dab('0x1'),'remove',_0x2dab('0x2')];function createListener(_0x2aa420,_0x37079c){return function(_0x16ac06){_0x37079c['emit'](_0x2aa420,_0x16ac06);};}function removeListener(_0x2078be,_0x2480cb){return function(){ChatInternalMessageEvents[_0x2dab('0x3')](_0x2078be,_0x2480cb);};}exports[_0x2dab('0x4')]=function(_0x4562bb){for(var _0x1421d5=0x0,_0x11da80=events[_0x2dab('0x5')];_0x1421d5<_0x11da80;_0x1421d5++){var _0x218d6b=events[_0x1421d5];var _0x188cef=createListener(_0x2dab('0x6')+_0x218d6b,_0x4562bb);ChatInternalMessageEvents['on'](_0x218d6b,_0x188cef);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index fb255ee..4d46b7d 100644 --- a/server/api/chatInternalMessage/index.js +++ b/server/api/chatInternalMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['put','update','delete','destroy','exports','multer','util','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','index','get','/describe','describe','isAuthenticated','getUsers','/:id','show','post'];(function(_0x585c44,_0x53e2fe){var _0x2e1a9d=function(_0x55deeb){while(--_0x55deeb){_0x585c44['push'](_0x585c44['shift']());}};_0x2e1a9d(++_0x53e2fe);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var auth=require(_0x0d8b('0x3'));var interaction=require(_0x0d8b('0x4'));var config=require(_0x0d8b('0x5'));var controller=require(_0x0d8b('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x0d8b('0x7')]);router[_0x0d8b('0x8')](_0x0d8b('0x9'),auth['isAuthenticated'](),controller[_0x0d8b('0xa')]);router[_0x0d8b('0x8')]('/users',auth[_0x0d8b('0xb')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0x8')](_0x0d8b('0xd'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')]('/',auth[_0x0d8b('0xb')](),controller['create']);router[_0x0d8b('0x10')]('/:id',controller[_0x0d8b('0x11')]);router[_0x0d8b('0x12')](_0x0d8b('0xd'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x13')]);module[_0x0d8b('0x14')]=router; \ No newline at end of file +var _0x70e0=['exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','describe','/users','isAuthenticated','getUsers','/:id','post','create','put','update','delete','destroy'];(function(_0x4d1804,_0x2e0418){var _0x30fe25=function(_0x2a7bd8){while(--_0x2a7bd8){_0x4d1804['push'](_0x4d1804['shift']());}};_0x30fe25(++_0x2e0418);}(_0x70e0,0x17b));var _0x070e=function(_0x2f62a6,_0xcbf98c){_0x2f62a6=_0x2f62a6-0x0;var _0x4b02c1=_0x70e0[_0x2f62a6];return _0x4b02c1;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var auth=require(_0x070e('0x4'));var interaction=require(_0x070e('0x5'));var config=require(_0x070e('0x6'));var controller=require('./chatInternalMessage.controller');router[_0x070e('0x7')]('/',auth['isAuthenticated'](),controller[_0x070e('0x8')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x070e('0x9')]);router[_0x070e('0x7')](_0x070e('0xa'),auth[_0x070e('0xb')](),controller[_0x070e('0xc')]);router[_0x070e('0x7')](_0x070e('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x070e('0xe')]('/',auth[_0x070e('0xb')](),controller[_0x070e('0xf')]);router[_0x070e('0x10')](_0x070e('0xd'),controller[_0x070e('0x11')]);router[_0x070e('0x12')](_0x070e('0xd'),auth[_0x070e('0xb')](),controller[_0x070e('0x13')]);module[_0x070e('0x14')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index 9fa92ce..7d90ea9 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 _0xa291=['ENUM','out','sequelize','medium','BOOLEAN'];(function(_0x18f216,_0xeff4e5){var _0x18be09=function(_0x2a146e){while(--_0x2a146e){_0x18f216['push'](_0x18f216['shift']());}};_0x18be09(++_0xeff4e5);}(_0xa291,0x98));var _0x1a29=function(_0x1b51ea,_0x394fd9){_0x1b51ea=_0x1b51ea-0x0;var _0x18bbdc=_0xa291[_0x1b51ea];return _0x18bbdc;};'use strict';var Sequelize=require(_0x1a29('0x0'));module['exports']={'body':{'type':Sequelize['TEXT'](_0x1a29('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x1a29('0x2')],'defaultValue':![]},'secret':{'type':Sequelize[_0x1a29('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x1a29('0x3')]('in',_0x1a29('0x4')),'defaultValue':_0x1a29('0x4'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0x8dc1=['DATE','sequelize','BOOLEAN','ENUM','out'];(function(_0x55dd40,_0x481006){var _0x37a983=function(_0x3ecde3){while(--_0x3ecde3){_0x55dd40['push'](_0x55dd40['shift']());}};_0x37a983(++_0x481006);}(_0x8dc1,0xa1));var _0x18dc=function(_0x32e59e,_0x252469){_0x32e59e=_0x32e59e-0x0;var _0x4a621d=_0x8dc1[_0x32e59e];return _0x4a621d;};'use strict';var Sequelize=require(_0x18dc('0x0'));module['exports']={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x18dc('0x1')],'defaultValue':![]},'secret':{'type':Sequelize[_0x18dc('0x1')],'defaultValue':![]},'direction':{'type':Sequelize[_0x18dc('0x2')]('in',_0x18dc('0x3')),'defaultValue':_0x18dc('0x3'),'allowNull':![]},'readAt':{'type':Sequelize[_0x18dc('0x4')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index e6b1646..6b328f1 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 _0x5e36=['rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../mysqldb','redis','localhost','socket.io-emitter','./chatMessage.socket','register','jayson/promise','client','http','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','ChatMessage,\x20%s,\x20%s','debug','stringify','error','message','info','request\x20sent','catch','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','update','then','destroy','end','name','send','index','rawAttributes','fieldName','type','key','model','map','query','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','where','pick','filters','merge','VIRTUAL','filter','options','ChatMessage','includeAll','params','keys','intersection','find','create','body','../../config/logger','chat-interactions','chat','read','readAt','UserId','user','CmContact','get','ChatInteraction','isNil','read1stAt','format','YYYY-MM-DD\x20HH:mm:ss','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','manual','interface','SIP/%s','channel','accept','EventManager','acceptmessage','parse','interaction','formData','ChatInteractionId','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','html-pdf'];(function(_0x13c528,_0x1eabc6){var _0x5baf89=function(_0x18b2e7){while(--_0x18b2e7){_0x13c528['push'](_0x13c528['shift']());}};_0x5baf89(++_0x1eabc6);}(_0x5e36,0x15e));var _0x65e3=function(_0x30ad96,_0x4f74ef){_0x30ad96=_0x30ad96-0x0;var _0x34d451=_0x5e36[_0x30ad96];return _0x34d451;};'use strict';var pdf=require(_0x65e3('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x65e3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x65e3('0x2'));var rp=require(_0x65e3('0x3'));var moment=require(_0x65e3('0x4'));var BPromise=require(_0x65e3('0x5'));var Mustache=require(_0x65e3('0x6'));var util=require('util');var path=require(_0x65e3('0x7'));var sox=require(_0x65e3('0x8'));var csv=require(_0x65e3('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x65e3('0xa'));var squel=require(_0x65e3('0xb'));var crypto=require(_0x65e3('0xc'));var jsforce=require(_0x65e3('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x65e3('0x9'));var querystring=require('querystring');var Papa=require(_0x65e3('0xe'));var Redis=require(_0x65e3('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x65e3('0x10'));var as=require(_0x65e3('0x11'));var hardwareService=require(_0x65e3('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x65e3('0x13'));var config=require('../../config/environment');var db=require(_0x65e3('0x14'))['db'];config[_0x65e3('0x15')]=_['defaults'](config['redis'],{'host':_0x65e3('0x16'),'port':0x18eb});var socket=require(_0x65e3('0x17'))(new Redis(config[_0x65e3('0x15')]));require(_0x65e3('0x18'))[_0x65e3('0x19')](socket);var jayson=require(_0x65e3('0x1a'));var client=jayson[_0x65e3('0x1b')][_0x65e3('0x1c')]({'port':0x232c});var client9002=jayson['client'][_0x65e3('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x3ca461,_0x5e7e61,_0xd3a557){if(_0xd3a557){var _0x359691=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x359691['test'](_0x5e7e61)){return _0x3ca461;}else{throw new db['Sequelize'][(_0x65e3('0x1d'))](_0x65e3('0x1e'));}}else{return _0x3ca461;}}function respondWithRpcPromise(_0x471810,_0x239801,_0x1be0f6,_0x2e47fd){return new BPromise(function(_0x208c68,_0x3ea090){var _0x2bb14d=_0x2e47fd||client;return _0x2bb14d[_0x65e3('0x1f')](_0x471810,_0x1be0f6)['then'](function(_0x2792d3){logger['info'](_0x65e3('0x20'),_0x239801,'request\x20sent');logger[_0x65e3('0x21')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x239801,'request\x20sent',JSON[_0x65e3('0x22')](_0x2792d3));if(_0x2792d3[_0x65e3('0x23')]){if(_0x2792d3[_0x65e3('0x23')]['code']===0x1f4){logger[_0x65e3('0x23')](_0x65e3('0x20'),_0x239801,_0x2792d3[_0x65e3('0x23')][_0x65e3('0x24')]);return _0x3ea090(_0x2792d3['error'][_0x65e3('0x24')]);}logger[_0x65e3('0x23')](_0x65e3('0x20'),_0x239801,_0x2792d3[_0x65e3('0x23')][_0x65e3('0x24')]);return _0x208c68(_0x2792d3[_0x65e3('0x23')][_0x65e3('0x24')]);}else{logger[_0x65e3('0x25')](_0x65e3('0x20'),_0x239801,_0x65e3('0x26'));_0x208c68(_0x2792d3['result'][_0x65e3('0x24')]);}})[_0x65e3('0x27')](function(_0x1df94f){logger['error'](_0x65e3('0x20'),_0x239801,_0x1df94f);_0x3ea090(_0x1df94f);});});}function respondWithStatusCode(_0x35fe89,_0x2fac2e){_0x2fac2e=_0x2fac2e||0xcc;return function(_0x24899a){if(_0x24899a){return _0x35fe89[_0x65e3('0x28')](_0x2fac2e);}return _0x35fe89['status'](_0x2fac2e)['end']();};}function respondWithResult(_0xca1a5f,_0x480825){_0x480825=_0x480825||0xc8;return function(_0x5631ed){if(_0x5631ed){return _0xca1a5f[_0x65e3('0x29')](_0x480825)[_0x65e3('0x2a')](_0x5631ed);}};}function respondWithFilteredResult(_0x1eba49,_0x122aeb){return function(_0x5913ba){if(_0x5913ba){var _0x329208=_0x5913ba[_0x65e3('0x2b')],_0x340e72=_0x122aeb['offset'],_0x1fda61=_0x122aeb[_0x65e3('0x2c')]+_0x122aeb['limit'],_0x2282b4;if(_0x1fda61>=_0x329208){_0x1fda61=_0x329208;_0x2282b4=0xc8;}else{_0x2282b4=0xce;}_0x1eba49[_0x65e3('0x29')](_0x2282b4);return _0x1eba49[_0x65e3('0x2d')](_0x65e3('0x2e'),_0x340e72+'-'+_0x1fda61+'/'+_0x329208)[_0x65e3('0x2a')](_0x5913ba);}return null;};}function patchUpdates(_0x435a67){return function(_0x33f689){try{jsonpatch[_0x65e3('0x2f')](_0x33f689,_0x435a67,!![]);}catch(_0x29d381){return BPromise[_0x65e3('0x30')](_0x29d381);}return _0x33f689['save']();};}function saveUpdates(_0x1bc5e2,_0x2c8872){return function(_0x3c78b3){if(_0x3c78b3){return _0x3c78b3[_0x65e3('0x31')](_0x1bc5e2)[_0x65e3('0x32')](function(_0x5dbd76){return _0x5dbd76;});}return null;};}function removeEntity(_0xd27968,_0x1c45e1){return function(_0x5d0aad){if(_0x5d0aad){return _0x5d0aad[_0x65e3('0x33')]()['then'](function(){_0xd27968['status'](0xcc)[_0x65e3('0x34')]();});}};}function handleEntityNotFound(_0x18e957,_0x577046){return function(_0x49d7e8){if(!_0x49d7e8){_0x18e957['sendStatus'](0x194);}return _0x49d7e8;};}function handleError(_0x28614a,_0x256cd4){_0x256cd4=_0x256cd4||0x1f4;return function(_0x51cc3c){logger[_0x65e3('0x23')](_0x51cc3c['stack']);if(_0x51cc3c[_0x65e3('0x35')]){delete _0x51cc3c[_0x65e3('0x35')];}_0x28614a[_0x65e3('0x29')](_0x256cd4)[_0x65e3('0x36')](_0x51cc3c);};}exports[_0x65e3('0x37')]=function(_0xab7144,_0x47d148){var _0x70606f={},_0x577a09={},_0x28872b={'count':0x0,'rows':[]};var _0x23904d=_['map'](db['ChatMessage'][_0x65e3('0x38')],function(_0x214a37){return{'name':_0x214a37[_0x65e3('0x39')],'type':_0x214a37[_0x65e3('0x3a')][_0x65e3('0x3b')]};});_0x577a09[_0x65e3('0x3c')]=_[_0x65e3('0x3d')](_0x23904d,_0x65e3('0x35'));_0x577a09['query']=_['keys'](_0xab7144[_0x65e3('0x3e')]);_0x577a09['filters']=_['intersection'](_0x577a09[_0x65e3('0x3c')],_0x577a09['query']);_0x70606f['attributes']=_['intersection'](_0x577a09['model'],qs[_0x65e3('0x3f')](_0xab7144[_0x65e3('0x3e')][_0x65e3('0x3f')]));_0x70606f[_0x65e3('0x40')]=_0x70606f[_0x65e3('0x40')][_0x65e3('0x41')]?_0x70606f[_0x65e3('0x40')]:_0x577a09['model'];if(!_0xab7144['query'][_0x65e3('0x42')](_0x65e3('0x43'))){_0x70606f[_0x65e3('0x44')]=qs[_0x65e3('0x44')](_0xab7144[_0x65e3('0x3e')][_0x65e3('0x44')]);_0x70606f[_0x65e3('0x2c')]=qs[_0x65e3('0x2c')](_0xab7144['query'][_0x65e3('0x2c')]);}_0x70606f['order']=qs[_0x65e3('0x45')](_0xab7144['query'][_0x65e3('0x45')]);_0x70606f[_0x65e3('0x46')]=qs['filters'](_[_0x65e3('0x47')](_0xab7144[_0x65e3('0x3e')],_0x577a09[_0x65e3('0x48')]));if(_0xab7144[_0x65e3('0x3e')]['filter']){_0x70606f[_0x65e3('0x46')]=_[_0x65e3('0x49')](_0x70606f[_0x65e3('0x46')],{'$or':_[_0x65e3('0x3d')](_0x23904d,function(_0x12d26a){if(_0x12d26a['type']!==_0x65e3('0x4a')){var _0x31f7ad={};_0x31f7ad[_0x12d26a['name']]={'$like':'%'+_0xab7144['query'][_0x65e3('0x4b')]+'%'};return _0x31f7ad;}})});}_0x70606f=_[_0x65e3('0x49')]({},_0x70606f,_0xab7144[_0x65e3('0x4c')]);var _0x45d9b4={'where':_0x70606f[_0x65e3('0x46')]};return db[_0x65e3('0x4d')][_0x65e3('0x2b')](_0x45d9b4)[_0x65e3('0x32')](function(_0x12de23){_0x28872b['count']=_0x12de23;if(_0xab7144[_0x65e3('0x3e')][_0x65e3('0x4e')]){_0x70606f['include']=[{'all':!![]}];}return db[_0x65e3('0x4d')]['findAll'](_0x70606f);})[_0x65e3('0x32')](function(_0x146143){_0x28872b['rows']=_0x146143;return _0x28872b;})[_0x65e3('0x32')](respondWithFilteredResult(_0x47d148,_0x70606f))[_0x65e3('0x27')](handleError(_0x47d148,null));};exports['show']=function(_0x3f480e,_0x41670f){var _0x18926f={'raw':!![],'where':{'id':_0x3f480e[_0x65e3('0x4f')]['id']}},_0x465d84={};_0x465d84[_0x65e3('0x3c')]=_[_0x65e3('0x50')](db['ChatMessage']['rawAttributes']);_0x465d84['query']=_[_0x65e3('0x50')](_0x3f480e[_0x65e3('0x3e')]);_0x465d84[_0x65e3('0x48')]=_[_0x65e3('0x51')](_0x465d84[_0x65e3('0x3c')],_0x465d84['query']);_0x18926f[_0x65e3('0x40')]=_['intersection'](_0x465d84['model'],qs[_0x65e3('0x3f')](_0x3f480e['query'][_0x65e3('0x3f')]));_0x18926f[_0x65e3('0x40')]=_0x18926f[_0x65e3('0x40')][_0x65e3('0x41')]?_0x18926f['attributes']:_0x465d84['model'];if(_0x3f480e[_0x65e3('0x3e')][_0x65e3('0x4e')]){_0x18926f['include']=[{'all':!![]}];}_0x18926f=_['merge']({},_0x18926f,_0x3f480e[_0x65e3('0x4c')]);return db[_0x65e3('0x4d')][_0x65e3('0x52')](_0x18926f)[_0x65e3('0x32')](handleEntityNotFound(_0x41670f,null))['then'](respondWithResult(_0x41670f,null))[_0x65e3('0x27')](handleError(_0x41670f,null));};exports[_0x65e3('0x53')]=function(_0x415a4d,_0x567766){return db[_0x65e3('0x4d')][_0x65e3('0x53')](_0x415a4d['body'],{})[_0x65e3('0x32')](respondWithResult(_0x567766,0xc9))[_0x65e3('0x27')](handleError(_0x567766,null));};exports['update']=function(_0x5a01c8,_0x1ce294){if(_0x5a01c8[_0x65e3('0x54')]['id']){delete _0x5a01c8[_0x65e3('0x54')]['id'];}return db[_0x65e3('0x4d')][_0x65e3('0x52')]({'where':{'id':_0x5a01c8[_0x65e3('0x4f')]['id']}})[_0x65e3('0x32')](handleEntityNotFound(_0x1ce294,null))[_0x65e3('0x32')](saveUpdates(_0x5a01c8[_0x65e3('0x54')],null))[_0x65e3('0x32')](respondWithResult(_0x1ce294,null))[_0x65e3('0x27')](handleError(_0x1ce294,null));};exports[_0x65e3('0x33')]=function(_0x9a071a,_0xefea7b){return db['ChatMessage'][_0x65e3('0x52')]({'where':{'id':_0x9a071a[_0x65e3('0x4f')]['id']}})[_0x65e3('0x32')](handleEntityNotFound(_0xefea7b,null))[_0x65e3('0x32')](removeEntity(_0xefea7b,null))['catch'](handleError(_0xefea7b,null));};exports['describe']=function(_0x31c4f6,_0xf38aff){return db[_0x65e3('0x4d')]['describe']()[_0x65e3('0x32')](respondWithResult(_0xf38aff,null))['catch'](handleError(_0xf38aff,null));};var interaction_log=require(_0x65e3('0x55'))(_0x65e3('0x56'));exports['accept']=function(_0x27c6ea,_0x26bf3c,_0x111169){var _0x25780b={'channel':_0x65e3('0x57')};if(_0x27c6ea[_0x65e3('0x54')]['id']){delete _0x27c6ea[_0x65e3('0x54')]['id'];}_0x27c6ea[_0x65e3('0x54')][_0x65e3('0x58')]=!![];_0x27c6ea[_0x65e3('0x54')][_0x65e3('0x59')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x27c6ea[_0x65e3('0x54')][_0x65e3('0x5a')]=_0x27c6ea['body'][_0x65e3('0x5a')]||_0x27c6ea[_0x65e3('0x5b')]['id'];return db['ChatMessage'][_0x65e3('0x52')]({'where':{'id':_0x27c6ea[_0x65e3('0x4f')]['id'],'UserId':null},'include':[{'model':db[_0x65e3('0x5c')],'as':'Contact'}]})[_0x65e3('0x32')](handleEntityNotFound(_0x26bf3c,null))[_0x65e3('0x32')](saveUpdates(_0x27c6ea[_0x65e3('0x54')],null))[_0x65e3('0x32')](function(_0x9e449){if(_0x9e449){_0x25780b[_0x65e3('0x24')]=_0x9e449[_0x65e3('0x5d')]({'plain':!![]});return db[_0x65e3('0x5e')][_0x65e3('0x52')]({'where':{'id':_0x9e449['ChatInteractionId']}});}return null;})[_0x65e3('0x32')](handleEntityNotFound(_0x26bf3c,null))[_0x65e3('0x32')](function(_0x5dbeb8){if(_0x5dbeb8){return _0x5dbeb8[_0x65e3('0x31')]({'UserId':_0x27c6ea[_0x65e3('0x54')][_0x65e3('0x5a')],'read1stAt':_[_0x65e3('0x5f')](_0x5dbeb8[_0x65e3('0x60')])?moment()[_0x65e3('0x61')](_0x65e3('0x62')):undefined});}return null;})[_0x65e3('0x32')](function(_0x949bf9){if(_0x949bf9){_0x25780b['interaction']=_0x949bf9[_0x65e3('0x5d')]({'plain':!![]});interaction_log[_0x65e3('0x25')](_0x65e3('0x63'),_0x27c6ea['user']['id'],_0x27c6ea[_0x65e3('0x5b')][_0x65e3('0x35')],_0x27c6ea['user'][_0x65e3('0x64')],_0x25780b['interaction']['id'],_0x27c6ea[_0x65e3('0x54')]?JSON[_0x65e3('0x22')](_0x27c6ea[_0x65e3('0x54')]):_0x65e3('0x65'));return respondWithRpcPromise(_0x65e3('0x66'),'acceptMessage',_0x25780b);}return null;})[_0x65e3('0x32')](function(_0x57dfe0){if(_0x57dfe0){if(_0x27c6ea[_0x65e3('0x54')][_0x65e3('0x67')]){_0x25780b[_0x65e3('0x24')][_0x65e3('0x68')]=util[_0x65e3('0x61')](_0x65e3('0x69'),_0x27c6ea[_0x65e3('0x5b')][_0x65e3('0x35')]);_0x25780b[_0x65e3('0x24')][_0x65e3('0x6a')]=_0x25780b[_0x65e3('0x6a')];_0x25780b['message']['event']=_0x65e3('0x6b');return respondWithRpcPromise('EventManager',_0x65e3('0x6c'),{'event':_0x65e3('0x6d'),'message':_[_0x65e3('0x49')](_0x25780b[_0x65e3('0x24')],JSON[_0x65e3('0x6e')](_0x25780b[_0x65e3('0x6f')][_0x65e3('0x70')]))},client9002)[_0x65e3('0x32')](function(){return _0x25780b;});}return _0x25780b;}return null;})['then'](respondWithResult(_0x26bf3c,null))['catch'](handleError(_0x26bf3c,null));};var interaction_log=require(_0x65e3('0x55'))('chat-interactions');exports['reject']=function(_0x4d8597,_0x7cdbac,_0x53ef27){var _0x2dfe5b={'agent':{},'channel':_0x65e3('0x57')};if(_0x4d8597[_0x65e3('0x54')]['id']){delete _0x4d8597[_0x65e3('0x54')]['id'];}_0x4d8597['body'][_0x65e3('0x5a')]=_0x4d8597[_0x65e3('0x54')]['UserId']||_0x4d8597[_0x65e3('0x5b')]['id'];_0x2dfe5b['agent']['id']=_0x4d8597[_0x65e3('0x54')][_0x65e3('0x5a')];return db[_0x65e3('0x4d')]['find']({'where':{'id':_0x4d8597[_0x65e3('0x4f')]['id'],'UserId':null}})[_0x65e3('0x32')](handleEntityNotFound(_0x7cdbac,null))[_0x65e3('0x32')](function(_0x45be13){if(_0x45be13){_0x2dfe5b['message']=_0x45be13[_0x65e3('0x5d')]({'plain':!![]});return db[_0x65e3('0x5e')][_0x65e3('0x52')]({'where':{'id':_0x45be13[_0x65e3('0x71')]}});}return null;})[_0x65e3('0x32')](handleEntityNotFound(_0x7cdbac,null))[_0x65e3('0x32')](function(_0x3b43c4){if(_0x3b43c4){_0x2dfe5b['interaction']=_0x3b43c4['get']({'plain':!![]});interaction_log[_0x65e3('0x25')](_0x65e3('0x72'),_0x4d8597[_0x65e3('0x5b')]['id'],_0x4d8597[_0x65e3('0x5b')][_0x65e3('0x35')],_0x4d8597[_0x65e3('0x5b')][_0x65e3('0x64')],_0x2dfe5b['interaction']['id'],_0x4d8597[_0x65e3('0x54')]?JSON[_0x65e3('0x22')](_0x4d8597['body']):_0x65e3('0x65'));return respondWithRpcPromise(_0x65e3('0x73'),_0x65e3('0x74'),_0x2dfe5b);}return null;})[_0x65e3('0x32')](function(_0x2bd7a8){if(_0x2bd7a8){_0x2bd7a8[_0x65e3('0x24')][_0x65e3('0x68')]=util[_0x65e3('0x61')]('SIP/%s',_0x4d8597[_0x65e3('0x5b')][_0x65e3('0x35')]);_0x2bd7a8[_0x65e3('0x24')]['channel']=_0x2dfe5b[_0x65e3('0x6a')];_0x2bd7a8[_0x65e3('0x24')]['event']='reject';respondWithRpcPromise(_0x65e3('0x6c'),_0x65e3('0x6c'),{'event':'rejectmessage','message':_0x2bd7a8[_0x65e3('0x24')]},client9002);return _0x2dfe5b;}return null;})['then'](respondWithResult(_0x7cdbac,null))[_0x65e3('0x27')](handleError(_0x7cdbac,null));}; \ No newline at end of file +var _0x1c1f=['params','find','create','body','describe','chat-interactions','accept','chat','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','Contact','get','ChatInteraction','ChatInteractionId','update','read1stAt','role','interaction','null','acceptMessage','manual','interface','SIP/%s','channel','EventManager','acceptmessage','parse','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','rejectmessage','html-pdf','eml-format','fast-json-patch','request-promise','bluebird','util','path','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','sendStatus','status','end','count','offset','set','Content-Range','json','apply','save','destroy','stack','name','map','ChatMessage','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','limit','order','sort','pick','where','VIRTUAL','filter','merge','includeAll','include','findAll','rows','catch'];(function(_0x1ce3cc,_0x4f0bfa){var _0x1de825=function(_0x28fa0b){while(--_0x28fa0b){_0x1ce3cc['push'](_0x1ce3cc['shift']());}};_0x1de825(++_0x4f0bfa);}(_0x1c1f,0x116));var _0xf1c1=function(_0x59c301,_0x359c50){_0x59c301=_0x59c301-0x0;var _0x3866b9=_0x1c1f[_0x59c301];return _0x3866b9;};'use strict';var pdf=require(_0xf1c1('0x0'));var emlformat=require(_0xf1c1('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xf1c1('0x2'));var rp=require(_0xf1c1('0x3'));var moment=require('moment');var BPromise=require(_0xf1c1('0x4'));var Mustache=require('mustache');var util=require(_0xf1c1('0x5'));var path=require(_0xf1c1('0x6'));var sox=require('sox');var csv=require(_0xf1c1('0x7'));var ejs=require(_0xf1c1('0x8'));var fs=require('fs');var _=require(_0xf1c1('0x9'));var squel=require(_0xf1c1('0xa'));var crypto=require('crypto');var jsforce=require(_0xf1c1('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xf1c1('0x7'));var querystring=require(_0xf1c1('0xc'));var Papa=require(_0xf1c1('0xd'));var Redis=require(_0xf1c1('0xe'));var authService=require(_0xf1c1('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xf1c1('0x10'));var hardwareService=require(_0xf1c1('0x11'));var logger=require(_0xf1c1('0x12'))(_0xf1c1('0x13'));var utils=require(_0xf1c1('0x14'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0xf1c1('0x15')]=_[_0xf1c1('0x16')](config[_0xf1c1('0x15')],{'host':_0xf1c1('0x17'),'port':0x18eb});var socket=require(_0xf1c1('0x18'))(new Redis(config[_0xf1c1('0x15')]));require(_0xf1c1('0x19'))[_0xf1c1('0x1a')](socket);var jayson=require(_0xf1c1('0x1b'));var client=jayson[_0xf1c1('0x1c')]['http']({'port':0x232c});var client9002=jayson['client'][_0xf1c1('0x1d')]({'port':0x232a});function checkPasswordPattern(_0xbc8ae2,_0x304e16,_0x12799a){if(_0x12799a){var _0x5bfc68=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5bfc68[_0xf1c1('0x1e')](_0x304e16)){return _0xbc8ae2;}else{throw new db[(_0xf1c1('0x1f'))][(_0xf1c1('0x20'))](_0xf1c1('0x21'));}}else{return _0xbc8ae2;}}function respondWithRpcPromise(_0x34df96,_0x17efc6,_0xbe1d21,_0x4ecf20){return new BPromise(function(_0x321c9e,_0xb28cba){var _0x3c402b=_0x4ecf20||client;return _0x3c402b[_0xf1c1('0x22')](_0x34df96,_0xbe1d21)[_0xf1c1('0x23')](function(_0x2d500c){logger[_0xf1c1('0x24')](_0xf1c1('0x25'),_0x17efc6,_0xf1c1('0x26'));logger[_0xf1c1('0x27')](_0xf1c1('0x28'),_0x17efc6,_0xf1c1('0x26'),JSON[_0xf1c1('0x29')](_0x2d500c));if(_0x2d500c[_0xf1c1('0x2a')]){if(_0x2d500c['error'][_0xf1c1('0x2b')]===0x1f4){logger[_0xf1c1('0x2a')](_0xf1c1('0x25'),_0x17efc6,_0x2d500c[_0xf1c1('0x2a')][_0xf1c1('0x2c')]);return _0xb28cba(_0x2d500c['error'][_0xf1c1('0x2c')]);}logger[_0xf1c1('0x2a')](_0xf1c1('0x25'),_0x17efc6,_0x2d500c['error'][_0xf1c1('0x2c')]);return _0x321c9e(_0x2d500c[_0xf1c1('0x2a')][_0xf1c1('0x2c')]);}else{logger['info']('ChatMessage,\x20%s,\x20%s',_0x17efc6,_0xf1c1('0x26'));_0x321c9e(_0x2d500c['result'][_0xf1c1('0x2c')]);}})['catch'](function(_0x41d6a8){logger['error']('ChatMessage,\x20%s,\x20%s',_0x17efc6,_0x41d6a8);_0xb28cba(_0x41d6a8);});});}function respondWithStatusCode(_0x1670c9,_0x1e92ce){_0x1e92ce=_0x1e92ce||0xcc;return function(_0x24fcf7){if(_0x24fcf7){return _0x1670c9[_0xf1c1('0x2d')](_0x1e92ce);}return _0x1670c9[_0xf1c1('0x2e')](_0x1e92ce)[_0xf1c1('0x2f')]();};}function respondWithResult(_0x15509e,_0x46814d){_0x46814d=_0x46814d||0xc8;return function(_0x26e3f2){if(_0x26e3f2){return _0x15509e['status'](_0x46814d)['json'](_0x26e3f2);}};}function respondWithFilteredResult(_0x299618,_0x1c6556){return function(_0x377349){if(_0x377349){var _0x5b2972=_0x377349[_0xf1c1('0x30')],_0x4fc6a7=_0x1c6556['offset'],_0x26467d=_0x1c6556[_0xf1c1('0x31')]+_0x1c6556['limit'],_0xfa4a95;if(_0x26467d>=_0x5b2972){_0x26467d=_0x5b2972;_0xfa4a95=0xc8;}else{_0xfa4a95=0xce;}_0x299618[_0xf1c1('0x2e')](_0xfa4a95);return _0x299618[_0xf1c1('0x32')](_0xf1c1('0x33'),_0x4fc6a7+'-'+_0x26467d+'/'+_0x5b2972)[_0xf1c1('0x34')](_0x377349);}return null;};}function patchUpdates(_0x1cf20a){return function(_0x5c0a08){try{jsonpatch[_0xf1c1('0x35')](_0x5c0a08,_0x1cf20a,!![]);}catch(_0x5c6c9a){return BPromise['reject'](_0x5c6c9a);}return _0x5c0a08[_0xf1c1('0x36')]();};}function saveUpdates(_0x27d209,_0x367bcd){return function(_0x567c5e){if(_0x567c5e){return _0x567c5e['update'](_0x27d209)['then'](function(_0x4c02e6){return _0x4c02e6;});}return null;};}function removeEntity(_0x1f24fe,_0x400835){return function(_0x2c6e66){if(_0x2c6e66){return _0x2c6e66[_0xf1c1('0x37')]()[_0xf1c1('0x23')](function(){_0x1f24fe[_0xf1c1('0x2e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4b0213,_0x2c73b2){return function(_0x3d44d2){if(!_0x3d44d2){_0x4b0213[_0xf1c1('0x2d')](0x194);}return _0x3d44d2;};}function handleError(_0x47eace,_0x756d87){_0x756d87=_0x756d87||0x1f4;return function(_0x50d059){logger[_0xf1c1('0x2a')](_0x50d059[_0xf1c1('0x38')]);if(_0x50d059[_0xf1c1('0x39')]){delete _0x50d059[_0xf1c1('0x39')];}_0x47eace[_0xf1c1('0x2e')](_0x756d87)['send'](_0x50d059);};}exports['index']=function(_0x4b2e5c,_0x120cb4){var _0x5ac8c7={},_0x24bf8f={},_0x35a24f={'count':0x0,'rows':[]};var _0x262460=_[_0xf1c1('0x3a')](db[_0xf1c1('0x3b')][_0xf1c1('0x3c')],function(_0x31055b){return{'name':_0x31055b[_0xf1c1('0x3d')],'type':_0x31055b['type'][_0xf1c1('0x3e')]};});_0x24bf8f[_0xf1c1('0x3f')]=_[_0xf1c1('0x3a')](_0x262460,_0xf1c1('0x39'));_0x24bf8f[_0xf1c1('0x40')]=_[_0xf1c1('0x41')](_0x4b2e5c[_0xf1c1('0x40')]);_0x24bf8f[_0xf1c1('0x42')]=_['intersection'](_0x24bf8f[_0xf1c1('0x3f')],_0x24bf8f[_0xf1c1('0x40')]);_0x5ac8c7[_0xf1c1('0x43')]=_[_0xf1c1('0x44')](_0x24bf8f[_0xf1c1('0x3f')],qs[_0xf1c1('0x45')](_0x4b2e5c[_0xf1c1('0x40')]['fields']));_0x5ac8c7['attributes']=_0x5ac8c7[_0xf1c1('0x43')]['length']?_0x5ac8c7[_0xf1c1('0x43')]:_0x24bf8f['model'];if(!_0x4b2e5c[_0xf1c1('0x40')][_0xf1c1('0x46')](_0xf1c1('0x47'))){_0x5ac8c7[_0xf1c1('0x48')]=qs[_0xf1c1('0x48')](_0x4b2e5c[_0xf1c1('0x40')][_0xf1c1('0x48')]);_0x5ac8c7[_0xf1c1('0x31')]=qs['offset'](_0x4b2e5c[_0xf1c1('0x40')][_0xf1c1('0x31')]);}_0x5ac8c7[_0xf1c1('0x49')]=qs[_0xf1c1('0x4a')](_0x4b2e5c[_0xf1c1('0x40')][_0xf1c1('0x4a')]);_0x5ac8c7['where']=qs[_0xf1c1('0x42')](_[_0xf1c1('0x4b')](_0x4b2e5c[_0xf1c1('0x40')],_0x24bf8f[_0xf1c1('0x42')]));if(_0x4b2e5c[_0xf1c1('0x40')]['filter']){_0x5ac8c7[_0xf1c1('0x4c')]=_['merge'](_0x5ac8c7['where'],{'$or':_[_0xf1c1('0x3a')](_0x262460,function(_0x3fe889){if(_0x3fe889['type']!==_0xf1c1('0x4d')){var _0x4566fa={};_0x4566fa[_0x3fe889['name']]={'$like':'%'+_0x4b2e5c['query'][_0xf1c1('0x4e')]+'%'};return _0x4566fa;}})});}_0x5ac8c7=_[_0xf1c1('0x4f')]({},_0x5ac8c7,_0x4b2e5c['options']);var _0x604141={'where':_0x5ac8c7[_0xf1c1('0x4c')]};return db[_0xf1c1('0x3b')][_0xf1c1('0x30')](_0x604141)[_0xf1c1('0x23')](function(_0x1f4721){_0x35a24f[_0xf1c1('0x30')]=_0x1f4721;if(_0x4b2e5c[_0xf1c1('0x40')][_0xf1c1('0x50')]){_0x5ac8c7[_0xf1c1('0x51')]=[{'all':!![]}];}return db[_0xf1c1('0x3b')][_0xf1c1('0x52')](_0x5ac8c7);})['then'](function(_0x242173){_0x35a24f[_0xf1c1('0x53')]=_0x242173;return _0x35a24f;})['then'](respondWithFilteredResult(_0x120cb4,_0x5ac8c7))[_0xf1c1('0x54')](handleError(_0x120cb4,null));};exports['show']=function(_0x5b7681,_0x1cf04d){var _0x101aa9={'raw':!![],'where':{'id':_0x5b7681[_0xf1c1('0x55')]['id']}},_0x49228c={};_0x49228c[_0xf1c1('0x3f')]=_[_0xf1c1('0x41')](db[_0xf1c1('0x3b')][_0xf1c1('0x3c')]);_0x49228c[_0xf1c1('0x40')]=_[_0xf1c1('0x41')](_0x5b7681[_0xf1c1('0x40')]);_0x49228c['filters']=_[_0xf1c1('0x44')](_0x49228c[_0xf1c1('0x3f')],_0x49228c[_0xf1c1('0x40')]);_0x101aa9['attributes']=_[_0xf1c1('0x44')](_0x49228c[_0xf1c1('0x3f')],qs[_0xf1c1('0x45')](_0x5b7681[_0xf1c1('0x40')][_0xf1c1('0x45')]));_0x101aa9['attributes']=_0x101aa9['attributes']['length']?_0x101aa9[_0xf1c1('0x43')]:_0x49228c[_0xf1c1('0x3f')];if(_0x5b7681[_0xf1c1('0x40')][_0xf1c1('0x50')]){_0x101aa9['include']=[{'all':!![]}];}_0x101aa9=_['merge']({},_0x101aa9,_0x5b7681['options']);return db['ChatMessage'][_0xf1c1('0x56')](_0x101aa9)[_0xf1c1('0x23')](handleEntityNotFound(_0x1cf04d,null))[_0xf1c1('0x23')](respondWithResult(_0x1cf04d,null))[_0xf1c1('0x54')](handleError(_0x1cf04d,null));};exports[_0xf1c1('0x57')]=function(_0x507b0d,_0x33ea5d){return db[_0xf1c1('0x3b')][_0xf1c1('0x57')](_0x507b0d[_0xf1c1('0x58')],{})[_0xf1c1('0x23')](respondWithResult(_0x33ea5d,0xc9))[_0xf1c1('0x54')](handleError(_0x33ea5d,null));};exports['update']=function(_0x594fe8,_0x55de28){if(_0x594fe8[_0xf1c1('0x58')]['id']){delete _0x594fe8['body']['id'];}return db['ChatMessage'][_0xf1c1('0x56')]({'where':{'id':_0x594fe8[_0xf1c1('0x55')]['id']}})[_0xf1c1('0x23')](handleEntityNotFound(_0x55de28,null))['then'](saveUpdates(_0x594fe8[_0xf1c1('0x58')],null))['then'](respondWithResult(_0x55de28,null))[_0xf1c1('0x54')](handleError(_0x55de28,null));};exports[_0xf1c1('0x37')]=function(_0x3bc992,_0x1c5b5a){return db[_0xf1c1('0x3b')][_0xf1c1('0x56')]({'where':{'id':_0x3bc992[_0xf1c1('0x55')]['id']}})['then'](handleEntityNotFound(_0x1c5b5a,null))[_0xf1c1('0x23')](removeEntity(_0x1c5b5a,null))['catch'](handleError(_0x1c5b5a,null));};exports[_0xf1c1('0x59')]=function(_0x295a68,_0x11f097){return db[_0xf1c1('0x3b')]['describe']()[_0xf1c1('0x23')](respondWithResult(_0x11f097,null))[_0xf1c1('0x54')](handleError(_0x11f097,null));};var interaction_log=require(_0xf1c1('0x12'))(_0xf1c1('0x5a'));exports[_0xf1c1('0x5b')]=function(_0xfee71b,_0x38f8b3,_0x454487){var _0x1855fa={'channel':_0xf1c1('0x5c')};if(_0xfee71b[_0xf1c1('0x58')]['id']){delete _0xfee71b[_0xf1c1('0x58')]['id'];}_0xfee71b[_0xf1c1('0x58')][_0xf1c1('0x5d')]=!![];_0xfee71b[_0xf1c1('0x58')][_0xf1c1('0x5e')]=moment()[_0xf1c1('0x5f')](_0xf1c1('0x60'));_0xfee71b[_0xf1c1('0x58')]['UserId']=_0xfee71b[_0xf1c1('0x58')][_0xf1c1('0x61')]||_0xfee71b[_0xf1c1('0x62')]['id'];return db[_0xf1c1('0x3b')][_0xf1c1('0x56')]({'where':{'id':_0xfee71b['params']['id'],'UserId':null},'include':[{'model':db[_0xf1c1('0x63')],'as':_0xf1c1('0x64')}]})['then'](handleEntityNotFound(_0x38f8b3,null))['then'](saveUpdates(_0xfee71b[_0xf1c1('0x58')],null))[_0xf1c1('0x23')](function(_0x46f7e7){if(_0x46f7e7){_0x1855fa[_0xf1c1('0x2c')]=_0x46f7e7[_0xf1c1('0x65')]({'plain':!![]});return db[_0xf1c1('0x66')][_0xf1c1('0x56')]({'where':{'id':_0x46f7e7[_0xf1c1('0x67')]}});}return null;})[_0xf1c1('0x23')](handleEntityNotFound(_0x38f8b3,null))[_0xf1c1('0x23')](function(_0x5575e1){if(_0x5575e1){return _0x5575e1[_0xf1c1('0x68')]({'UserId':_0xfee71b[_0xf1c1('0x58')][_0xf1c1('0x61')],'read1stAt':_['isNil'](_0x5575e1[_0xf1c1('0x69')])?moment()[_0xf1c1('0x5f')](_0xf1c1('0x60')):undefined});}return null;})[_0xf1c1('0x23')](function(_0x2b86bc){if(_0x2b86bc){_0x1855fa['interaction']=_0x2b86bc[_0xf1c1('0x65')]({'plain':!![]});interaction_log[_0xf1c1('0x24')]('[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0xfee71b[_0xf1c1('0x62')]['id'],_0xfee71b[_0xf1c1('0x62')][_0xf1c1('0x39')],_0xfee71b[_0xf1c1('0x62')][_0xf1c1('0x6a')],_0x1855fa[_0xf1c1('0x6b')]['id'],_0xfee71b[_0xf1c1('0x58')]?JSON[_0xf1c1('0x29')](_0xfee71b[_0xf1c1('0x58')]):_0xf1c1('0x6c'));return respondWithRpcPromise('AcceptMessage',_0xf1c1('0x6d'),_0x1855fa);}return null;})[_0xf1c1('0x23')](function(_0x5d67a0){if(_0x5d67a0){if(_0xfee71b[_0xf1c1('0x58')][_0xf1c1('0x6e')]){_0x1855fa[_0xf1c1('0x2c')][_0xf1c1('0x6f')]=util['format'](_0xf1c1('0x70'),_0xfee71b['user'][_0xf1c1('0x39')]);_0x1855fa['message'][_0xf1c1('0x71')]=_0x1855fa[_0xf1c1('0x71')];_0x1855fa['message']['event']='accept';return respondWithRpcPromise(_0xf1c1('0x72'),'EventManager',{'event':_0xf1c1('0x73'),'message':_[_0xf1c1('0x4f')](_0x1855fa[_0xf1c1('0x2c')],JSON[_0xf1c1('0x74')](_0x1855fa['interaction']['formData']))},client9002)[_0xf1c1('0x23')](function(){return _0x1855fa;});}return _0x1855fa;}return null;})['then'](respondWithResult(_0x38f8b3,null))[_0xf1c1('0x54')](handleError(_0x38f8b3,null));};var interaction_log=require(_0xf1c1('0x12'))(_0xf1c1('0x5a'));exports['reject']=function(_0x56a727,_0x5e8075,_0x4d74ad){var _0x10ac36={'agent':{},'channel':'chat'};if(_0x56a727[_0xf1c1('0x58')]['id']){delete _0x56a727[_0xf1c1('0x58')]['id'];}_0x56a727[_0xf1c1('0x58')][_0xf1c1('0x61')]=_0x56a727[_0xf1c1('0x58')]['UserId']||_0x56a727['user']['id'];_0x10ac36['agent']['id']=_0x56a727[_0xf1c1('0x58')][_0xf1c1('0x61')];return db['ChatMessage'][_0xf1c1('0x56')]({'where':{'id':_0x56a727[_0xf1c1('0x55')]['id'],'UserId':null}})[_0xf1c1('0x23')](handleEntityNotFound(_0x5e8075,null))[_0xf1c1('0x23')](function(_0x133f02){if(_0x133f02){_0x10ac36['message']=_0x133f02[_0xf1c1('0x65')]({'plain':!![]});return db[_0xf1c1('0x66')]['find']({'where':{'id':_0x133f02[_0xf1c1('0x67')]}});}return null;})[_0xf1c1('0x23')](handleEntityNotFound(_0x5e8075,null))['then'](function(_0x49df3c){if(_0x49df3c){_0x10ac36[_0xf1c1('0x6b')]=_0x49df3c[_0xf1c1('0x65')]({'plain':!![]});interaction_log['info'](_0xf1c1('0x75'),_0x56a727[_0xf1c1('0x62')]['id'],_0x56a727['user'][_0xf1c1('0x39')],_0x56a727[_0xf1c1('0x62')]['role'],_0x10ac36[_0xf1c1('0x6b')]['id'],_0x56a727[_0xf1c1('0x58')]?JSON['stringify'](_0x56a727[_0xf1c1('0x58')]):_0xf1c1('0x6c'));return respondWithRpcPromise(_0xf1c1('0x76'),_0xf1c1('0x77'),_0x10ac36);}return null;})[_0xf1c1('0x23')](function(_0x14c476){if(_0x14c476){_0x14c476['message']['interface']=util[_0xf1c1('0x5f')](_0xf1c1('0x70'),_0x56a727[_0xf1c1('0x62')][_0xf1c1('0x39')]);_0x14c476[_0xf1c1('0x2c')][_0xf1c1('0x71')]=_0x10ac36[_0xf1c1('0x71')];_0x14c476[_0xf1c1('0x2c')]['event']='reject';respondWithRpcPromise(_0xf1c1('0x72'),_0xf1c1('0x72'),{'event':_0xf1c1('0x78'),'message':_0x14c476['message']},client9002);return _0x10ac36;}return null;})[_0xf1c1('0x23')](respondWithResult(_0x5e8075,null))[_0xf1c1('0x54')](handleError(_0x5e8075,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 1d9cd32..c4a25bb 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 _0x1b71=['update','remove','emit','exports','../../mysqldb','setMaxListeners','save'];(function(_0x396443,_0x43da32){var _0xdea6d1=function(_0x3b3f29){while(--_0x3b3f29){_0x396443['push'](_0x396443['shift']());}};_0xdea6d1(++_0x43da32);}(_0x1b71,0xa5));var _0x11b7=function(_0x2676cd,_0x8431b3){_0x2676cd=_0x2676cd-0x0;var _0x15f1f6=_0x1b71[_0x2676cd];return _0x15f1f6;};'use strict';var EventEmitter=require('events');var ChatMessage=require(_0x11b7('0x0'))['db']['ChatMessage'];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x11b7('0x1')](0x0);var events={'afterCreate':_0x11b7('0x2'),'afterUpdate':_0x11b7('0x3'),'afterDestroy':_0x11b7('0x4')};function emitEvent(_0x597e0d){return function(_0x22059a,_0x5e8b29,_0x3c0565){ChatMessageEvents[_0x11b7('0x5')](_0x597e0d+':'+_0x22059a['id'],_0x22059a);ChatMessageEvents[_0x11b7('0x5')](_0x597e0d,_0x22059a);_0x3c0565(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatMessage['hook'](e,emitEvent(event));}}module[_0x11b7('0x6')]=ChatMessageEvents; \ No newline at end of file +var _0xb551=['remove','emit','hook','exports','../../mysqldb','setMaxListeners','save'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0xb551,0x66));var _0x1b55=function(_0x57b485,_0x45816e){_0x57b485=_0x57b485-0x0;var _0x52c89c=_0xb551[_0x57b485];return _0x52c89c;};'use strict';var EventEmitter=require('events');var ChatMessage=require(_0x1b55('0x0'))['db']['ChatMessage'];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x1b55('0x1')](0x0);var events={'afterCreate':_0x1b55('0x2'),'afterUpdate':'update','afterDestroy':_0x1b55('0x3')};function emitEvent(_0x366c3c){return function(_0x4febf8,_0x463649,_0x1955e9){ChatMessageEvents[_0x1b55('0x4')](_0x366c3c+':'+_0x4febf8['id'],_0x4febf8);ChatMessageEvents[_0x1b55('0x4')](_0x366c3c,_0x4febf8);_0x1955e9(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatMessage[_0x1b55('0x5')](e,emitEvent(event));}}module[_0x1b55('0x6')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index ca8c45e..747ef18 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 _0xf078=['define','ChatMessage','body','FULLTEXT','direction','toLowerCase','out','secret','findOne','ChatInteractionId','then','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','bluebird','path','../../config/environment','./chatMessage.attributes','exports'];(function(_0x5a0688,_0x4e1028){var _0x57477f=function(_0xe1f67d){while(--_0xe1f67d){_0x5a0688['push'](_0x5a0688['shift']());}};_0x57477f(++_0x4e1028);}(_0xf078,0xc7));var _0x8f07=function(_0x3efdec,_0x187e4c){_0x3efdec=_0x3efdec-0x0;var _0x438d01=_0xf078[_0x3efdec];return _0x438d01;};'use strict';var _=require(_0x8f07('0x0'));var util=require(_0x8f07('0x1'));var logger=require('../../config/logger')(_0x8f07('0x2'));var moment=require('moment');var BPromise=require(_0x8f07('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8f07('0x4'));var rimraf=require('rimraf');var config=require(_0x8f07('0x5'));var attributes=require(_0x8f07('0x6'));module[_0x8f07('0x7')]=function(_0x365def,_0x26fdb5){return _0x365def[_0x8f07('0x8')](_0x8f07('0x9'),attributes,{'tableName':'chat_messages','paranoid':![],'indexes':[{'name':'fti_chat_messages','fields':[_0x8f07('0xa')],'type':_0x8f07('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x290323,_0x2f349a,_0x2bef53){var _0x17a2d9=_0x365def['models'];var _0x3b7566=_0x290323['get']({'plain':!![]});if(_0x3b7566[_0x8f07('0xc')][_0x8f07('0xd')]()==='in'||_0x3b7566[_0x8f07('0xc')][_0x8f07('0xd')]()===_0x8f07('0xe')&&!_0x3b7566[_0x8f07('0xf')]&&!_['isNil'](_0x3b7566['UserId'])){_0x17a2d9['ChatInteraction'][_0x8f07('0x10')]({'where':{'id':_0x3b7566[_0x8f07('0x11')]}})[_0x8f07('0x12')](function(_0x5c581c){if(_0x5c581c){_0x5c581c['update']({'lastMsgAt':_0x3b7566['createdAt'],'lastMsgDirection':_0x3b7566[_0x8f07('0xc')][_0x8f07('0xd')]()});}})[_0x8f07('0x13')](function(_0x27fe86){console[_0x8f07('0x14')](_0x27fe86);});}_0x2bef53();}},'charset':_0x8f07('0x15'),'collate':_0x8f07('0x16')});}; \ No newline at end of file +var _0x6fae=['FULLTEXT','models','get','direction','toLowerCase','secret','isNil','ChatInteraction','findOne','ChatInteractionId','then','update','createdAt','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./chatMessage.attributes','exports','define','ChatMessage','chat_messages','fti_chat_messages','body'];(function(_0x2dd827,_0x9f634d){var _0x132c64=function(_0x3ed7ec){while(--_0x3ed7ec){_0x2dd827['push'](_0x2dd827['shift']());}};_0x132c64(++_0x9f634d);}(_0x6fae,0xab));var _0xe6fa=function(_0x1d737b,_0x2e7578){_0x1d737b=_0x1d737b-0x0;var _0x2be0eb=_0x6fae[_0x1d737b];return _0x2be0eb;};'use strict';var _=require(_0xe6fa('0x0'));var util=require(_0xe6fa('0x1'));var logger=require(_0xe6fa('0x2'))(_0xe6fa('0x3'));var moment=require('moment');var BPromise=require(_0xe6fa('0x4'));var rp=require(_0xe6fa('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe6fa('0x6'));var config=require(_0xe6fa('0x7'));var attributes=require(_0xe6fa('0x8'));module[_0xe6fa('0x9')]=function(_0x44b453,_0x12ea20){return _0x44b453[_0xe6fa('0xa')](_0xe6fa('0xb'),attributes,{'tableName':_0xe6fa('0xc'),'paranoid':![],'indexes':[{'name':_0xe6fa('0xd'),'fields':[_0xe6fa('0xe')],'type':_0xe6fa('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4269f4,_0x5516b5,_0x2b22f2){var _0x429063=_0x44b453[_0xe6fa('0x10')];var _0x4c8def=_0x4269f4[_0xe6fa('0x11')]({'plain':!![]});if(_0x4c8def[_0xe6fa('0x12')]['toLowerCase']()==='in'||_0x4c8def[_0xe6fa('0x12')][_0xe6fa('0x13')]()==='out'&&!_0x4c8def[_0xe6fa('0x14')]&&!_[_0xe6fa('0x15')](_0x4c8def['UserId'])){_0x429063[_0xe6fa('0x16')][_0xe6fa('0x17')]({'where':{'id':_0x4c8def[_0xe6fa('0x18')]}})[_0xe6fa('0x19')](function(_0x160531){if(_0x160531){_0x160531[_0xe6fa('0x1a')]({'lastMsgAt':_0x4c8def[_0xe6fa('0x1b')],'lastMsgDirection':_0x4c8def[_0xe6fa('0x12')][_0xe6fa('0x13')]()});}})['catch'](function(_0x5c7432){console[_0xe6fa('0x1c')](_0x5c7432);});}_0x2b22f2();}},'charset':_0xe6fa('0x1d'),'collate':_0xe6fa('0x1e')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index 2c5f888..cc3fac1 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 _0xdd21=['CreateChatMessage','ChatMessage','create','body','options','raw','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./chatMessage.socket','register','then','ChatMessage,\x20%s,\x20%s','debug','ChatMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0xdd21,0x138));var _0x1dd2=function(_0x3cee8b,_0x428932){_0x3cee8b=_0x3cee8b-0x0;var _0x44af17=_0xdd21[_0x3cee8b];return _0x44af17;};'use strict';var _=require(_0x1dd2('0x0'));var util=require(_0x1dd2('0x1'));var moment=require('moment');var BPromise=require(_0x1dd2('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1dd2('0x3'));var db=require(_0x1dd2('0x4'))['db'];var utils=require(_0x1dd2('0x5'));var logger=require('../../config/logger')(_0x1dd2('0x6'));var config=require(_0x1dd2('0x7'));var jayson=require(_0x1dd2('0x8'));var client=jayson[_0x1dd2('0x9')][_0x1dd2('0xa')]({'port':0x232a});config[_0x1dd2('0xb')]=_['defaults'](config[_0x1dd2('0xb')],{'host':_0x1dd2('0xc'),'port':0x18eb});var socket=require(_0x1dd2('0xd'))(new Redis(config['redis']));require(_0x1dd2('0xe'))[_0x1dd2('0xf')](socket);function respondWithRpcPromise(_0x3e6417,_0x5e9fa7,_0x232786){return new BPromise(function(_0x48a513,_0x4c9d2a){return client['request'](_0x3e6417,_0x232786)[_0x1dd2('0x10')](function(_0x116feb){logger['info'](_0x1dd2('0x11'),_0x5e9fa7,'request\x20sent');logger[_0x1dd2('0x12')](_0x1dd2('0x13'),_0x5e9fa7,_0x1dd2('0x14'),JSON[_0x1dd2('0x15')](_0x116feb));if(_0x116feb['error']){if(_0x116feb[_0x1dd2('0x16')][_0x1dd2('0x17')]===0x1f4){logger[_0x1dd2('0x16')]('ChatMessage,\x20%s,\x20%s',_0x5e9fa7,_0x116feb['error'][_0x1dd2('0x18')]);return _0x4c9d2a(_0x116feb[_0x1dd2('0x16')][_0x1dd2('0x18')]);}logger[_0x1dd2('0x16')]('ChatMessage,\x20%s,\x20%s',_0x5e9fa7,_0x116feb[_0x1dd2('0x16')]['message']);return _0x48a513(_0x116feb[_0x1dd2('0x16')][_0x1dd2('0x18')]);}else{logger[_0x1dd2('0x19')](_0x1dd2('0x11'),_0x5e9fa7,_0x1dd2('0x14'));_0x48a513(_0x116feb[_0x1dd2('0x1a')][_0x1dd2('0x18')]);}})[_0x1dd2('0x1b')](function(_0x5cf3d7){logger['error'](_0x1dd2('0x11'),_0x5e9fa7,_0x5cf3d7);_0x4c9d2a(_0x5cf3d7);});});}exports[_0x1dd2('0x1c')]=function(_0x11d37d){var _0x597a3d=this;return new Promise(function(_0x1f1e5d,_0x4318e3){return db[_0x1dd2('0x1d')][_0x1dd2('0x1e')](_0x11d37d[_0x1dd2('0x1f')],{'raw':_0x11d37d[_0x1dd2('0x20')]?_0x11d37d['options'][_0x1dd2('0x21')]===undefined?!![]:![]:!![]})[_0x1dd2('0x10')](function(_0x4ea6a2){logger[_0x1dd2('0x19')](_0x1dd2('0x1c'),_0x11d37d);logger[_0x1dd2('0x12')](_0x1dd2('0x1c'),_0x11d37d,JSON[_0x1dd2('0x15')](_0x4ea6a2));_0x1f1e5d(_0x4ea6a2);})[_0x1dd2('0x1b')](function(_0x4d06c9){logger['error'](_0x1dd2('0x1c'),_0x4d06c9[_0x1dd2('0x18')],_0x11d37d);_0x4318e3(_0x597a3d[_0x1dd2('0x16')](0x1f4,_0x4d06c9[_0x1dd2('0x18')]));});});}; \ No newline at end of file +var _0xdd9c=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','ChatMessage,\x20%s,\x20%s','debug','ChatMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateChatMessage','ChatMessage','create','options','raw','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x3ff6fe,_0x3fb6fb){var _0x46b649=function(_0x5bb713){while(--_0x5bb713){_0x3ff6fe['push'](_0x3ff6fe['shift']());}};_0x46b649(++_0x3fb6fb);}(_0xdd9c,0x185));var _0xcdd9=function(_0x429db9,_0x18c23b){_0x429db9=_0x429db9-0x0;var _0x9a0701=_0xdd9c[_0x429db9];return _0x9a0701;};'use strict';var _=require(_0xcdd9('0x0'));var util=require(_0xcdd9('0x1'));var moment=require(_0xcdd9('0x2'));var BPromise=require(_0xcdd9('0x3'));var rs=require(_0xcdd9('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcdd9('0x5'))['db'];var utils=require(_0xcdd9('0x6'));var logger=require(_0xcdd9('0x7'))(_0xcdd9('0x8'));var config=require(_0xcdd9('0x9'));var jayson=require(_0xcdd9('0xa'));var client=jayson[_0xcdd9('0xb')][_0xcdd9('0xc')]({'port':0x232a});config[_0xcdd9('0xd')]=_[_0xcdd9('0xe')](config[_0xcdd9('0xd')],{'host':_0xcdd9('0xf'),'port':0x18eb});var socket=require(_0xcdd9('0x10'))(new Redis(config[_0xcdd9('0xd')]));require('./chatMessage.socket')[_0xcdd9('0x11')](socket);function respondWithRpcPromise(_0x35b1d1,_0x4bac44,_0xcc6132){return new BPromise(function(_0x51b87f,_0x1bda86){return client[_0xcdd9('0x12')](_0x35b1d1,_0xcc6132)[_0xcdd9('0x13')](function(_0x555c39){logger[_0xcdd9('0x14')](_0xcdd9('0x15'),_0x4bac44,'request\x20sent');logger[_0xcdd9('0x16')](_0xcdd9('0x17'),_0x4bac44,_0xcdd9('0x18'),JSON[_0xcdd9('0x19')](_0x555c39));if(_0x555c39[_0xcdd9('0x1a')]){if(_0x555c39['error'][_0xcdd9('0x1b')]===0x1f4){logger[_0xcdd9('0x1a')]('ChatMessage,\x20%s,\x20%s',_0x4bac44,_0x555c39[_0xcdd9('0x1a')]['message']);return _0x1bda86(_0x555c39['error'][_0xcdd9('0x1c')]);}logger[_0xcdd9('0x1a')](_0xcdd9('0x15'),_0x4bac44,_0x555c39[_0xcdd9('0x1a')][_0xcdd9('0x1c')]);return _0x51b87f(_0x555c39[_0xcdd9('0x1a')][_0xcdd9('0x1c')]);}else{logger[_0xcdd9('0x14')]('ChatMessage,\x20%s,\x20%s',_0x4bac44,_0xcdd9('0x18'));_0x51b87f(_0x555c39[_0xcdd9('0x1d')]['message']);}})[_0xcdd9('0x1e')](function(_0xd112b2){logger['error'](_0xcdd9('0x15'),_0x4bac44,_0xd112b2);_0x1bda86(_0xd112b2);});});}exports[_0xcdd9('0x1f')]=function(_0x3029d4){var _0x179141=this;return new Promise(function(_0xd54f0c,_0x27b342){return db[_0xcdd9('0x20')][_0xcdd9('0x21')](_0x3029d4['body'],{'raw':_0x3029d4[_0xcdd9('0x22')]?_0x3029d4['options'][_0xcdd9('0x23')]===undefined?!![]:![]:!![]})[_0xcdd9('0x13')](function(_0x12b9c5){logger['info'](_0xcdd9('0x1f'),_0x3029d4);logger[_0xcdd9('0x16')](_0xcdd9('0x1f'),_0x3029d4,JSON[_0xcdd9('0x19')](_0x12b9c5));_0xd54f0c(_0x12b9c5);})[_0xcdd9('0x1e')](function(_0x2f4c34){logger[_0xcdd9('0x1a')]('CreateChatMessage',_0x2f4c34[_0xcdd9('0x1c')],_0x3029d4);_0x27b342(_0x179141[_0xcdd9('0x1a')](0x1f4,_0x2f4c34['message']));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 834506a..664e4de 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 _0x2675=['register','length','chatMessage:','./chatMessage.events','emit','removeListener'];(function(_0x2c7dc6,_0x3c4ce0){var _0x10002b=function(_0x26f390){while(--_0x26f390){_0x2c7dc6['push'](_0x2c7dc6['shift']());}};_0x10002b(++_0x3c4ce0);}(_0x2675,0x75));var _0x5267=function(_0x10b04c,_0x13a741){_0x10b04c=_0x10b04c-0x0;var _0x455125=_0x2675[_0x10b04c];return _0x455125;};'use strict';var ChatMessageEvents=require(_0x5267('0x0'));var events=['save','remove','update'];function createListener(_0x1da342,_0x2ae442){return function(_0x57c95a){_0x2ae442[_0x5267('0x1')](_0x1da342,_0x57c95a);};}function removeListener(_0x36bdf0,_0x4e2548){return function(){ChatMessageEvents[_0x5267('0x2')](_0x36bdf0,_0x4e2548);};}exports[_0x5267('0x3')]=function(_0x4bd042){for(var _0x10f92c=0x0,_0x20f065=events[_0x5267('0x4')];_0x10f92c<_0x20f065;_0x10f92c++){var _0x527c16=events[_0x10f92c];var _0x9e0a27=createListener(_0x5267('0x5')+_0x527c16,_0x4bd042);ChatMessageEvents['on'](_0x527c16,_0x9e0a27);}}; \ No newline at end of file +var _0xafc4=['register','length','chatMessage:','./chatMessage.events','remove','emit'];(function(_0x4a82ac,_0x1fb931){var _0x58ee97=function(_0xc7050a){while(--_0xc7050a){_0x4a82ac['push'](_0x4a82ac['shift']());}};_0x58ee97(++_0x1fb931);}(_0xafc4,0x69));var _0x4afc=function(_0x14329c,_0x551c21){_0x14329c=_0x14329c-0x0;var _0x1b971d=_0xafc4[_0x14329c];return _0x1b971d;};'use strict';var ChatMessageEvents=require(_0x4afc('0x0'));var events=['save',_0x4afc('0x1'),'update'];function createListener(_0x10aede,_0x11789f){return function(_0x20e443){_0x11789f[_0x4afc('0x2')](_0x10aede,_0x20e443);};}function removeListener(_0x4d9dbd,_0x49f417){return function(){ChatMessageEvents['removeListener'](_0x4d9dbd,_0x49f417);};}exports[_0x4afc('0x3')]=function(_0x471d45){for(var _0x16953b=0x0,_0x1bb281=events[_0x4afc('0x4')];_0x16953b<_0x1bb281;_0x16953b++){var _0xaf053d=events[_0x16953b];var _0x5e1e29=createListener(_0x4afc('0x5')+_0xaf053d,_0x471d45);ChatMessageEvents['on'](_0xaf053d,_0x5e1e29);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index 470970c..9ae78ff 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 _0x7eed=['get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','/:id/accept','accept','/:id/reject','delete','destroy','multer','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./chatMessage.controller'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x7eed,0x186));var _0xd7ee=function(_0x45b771,_0x2caece){_0x45b771=_0x45b771-0x0;var _0x7ef73d=_0x7eed[_0x45b771];return _0x7ef73d;};'use strict';var multer=require(_0xd7ee('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xd7ee('0x1'));var express=require('express');var router=express[_0xd7ee('0x2')]();var auth=require(_0xd7ee('0x3'));var interaction=require(_0xd7ee('0x4'));var config=require('../../config/environment');var controller=require(_0xd7ee('0x5'));router[_0xd7ee('0x6')]('/',auth[_0xd7ee('0x7')](),controller[_0xd7ee('0x8')]);router[_0xd7ee('0x6')](_0xd7ee('0x9'),auth[_0xd7ee('0x7')](),controller[_0xd7ee('0xa')]);router[_0xd7ee('0x6')](_0xd7ee('0xb'),auth[_0xd7ee('0x7')](),controller[_0xd7ee('0xc')]);router[_0xd7ee('0xd')]('/',auth[_0xd7ee('0x7')](),interaction['tracked']('chat','chatmessage:create'),controller[_0xd7ee('0xe')]);router[_0xd7ee('0xf')](_0xd7ee('0xb'),controller[_0xd7ee('0x10')]);router[_0xd7ee('0xf')](_0xd7ee('0x11'),auth[_0xd7ee('0x7')](),controller[_0xd7ee('0x12')]);router[_0xd7ee('0xf')](_0xd7ee('0x13'),auth[_0xd7ee('0x7')](),controller['reject']);router[_0xd7ee('0x14')](_0xd7ee('0xb'),auth[_0xd7ee('0x7')](),controller[_0xd7ee('0x15')]);module['exports']=router; \ No newline at end of file +var _0x60d5=['exports','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatMessage.controller','get','index','isAuthenticated','describe','/:id','show','post','tracked','chat','chatmessage:create','create','put','update','accept','/:id/reject','delete','destroy'];(function(_0x3755c2,_0x4bfe03){var _0x448d3c=function(_0x1f32a9){while(--_0x1f32a9){_0x3755c2['push'](_0x3755c2['shift']());}};_0x448d3c(++_0x4bfe03);}(_0x60d5,0x1c3));var _0x560d=function(_0x40c180,_0x15c523){_0x40c180=_0x40c180-0x0;var _0xe3bc06=_0x60d5[_0x40c180];return _0xe3bc06;};'use strict';var multer=require('multer');var util=require(_0x560d('0x0'));var path=require('path');var timeout=require(_0x560d('0x1'));var express=require('express');var router=express[_0x560d('0x2')]();var auth=require(_0x560d('0x3'));var interaction=require(_0x560d('0x4'));var config=require(_0x560d('0x5'));var controller=require(_0x560d('0x6'));router[_0x560d('0x7')]('/',auth['isAuthenticated'](),controller[_0x560d('0x8')]);router[_0x560d('0x7')]('/describe',auth[_0x560d('0x9')](),controller[_0x560d('0xa')]);router[_0x560d('0x7')](_0x560d('0xb'),auth[_0x560d('0x9')](),controller[_0x560d('0xc')]);router[_0x560d('0xd')]('/',auth['isAuthenticated'](),interaction[_0x560d('0xe')](_0x560d('0xf'),_0x560d('0x10')),controller[_0x560d('0x11')]);router[_0x560d('0x12')](_0x560d('0xb'),controller[_0x560d('0x13')]);router[_0x560d('0x12')]('/:id/accept',auth[_0x560d('0x9')](),controller[_0x560d('0x14')]);router[_0x560d('0x12')](_0x560d('0x15'),auth[_0x560d('0x9')](),controller['reject']);router[_0x560d('0x16')](_0x560d('0xb'),auth['isAuthenticated'](),controller[_0x560d('0x17')]);module[_0x560d('0x18')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index 723b25d..d98fed9 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 _0xbb24=['sequelize','exports','TEXT'];(function(_0x1b9635,_0x2a8b42){var _0x1280fc=function(_0x1f4916){while(--_0x1f4916){_0x1b9635['push'](_0x1b9635['shift']());}};_0x1280fc(++_0x2a8b42);}(_0xbb24,0x1c5));var _0x4bb2=function(_0x5f4a5a,_0x532d79){_0x5f4a5a=_0x5f4a5a-0x0;var _0x3419a3=_0xbb24[_0x5f4a5a];return _0x3419a3;};'use strict';var Sequelize=require(_0x4bb2('0x0'));module[_0x4bb2('0x1')]={'body':{'type':Sequelize[_0x4bb2('0x2')]('medium'),'allowNull':![]}}; \ No newline at end of file +var _0x7cdb=['medium','sequelize','exports','TEXT'];(function(_0x46b22a,_0x5bf83a){var _0x44c2e8=function(_0x21b6fc){while(--_0x21b6fc){_0x46b22a['push'](_0x46b22a['shift']());}};_0x44c2e8(++_0x5bf83a);}(_0x7cdb,0x16d));var _0xb7cd=function(_0x36af14,_0x504dbe){_0x36af14=_0x36af14-0x0;var _0x266416=_0x7cdb[_0x36af14];return _0x266416;};'use strict';var Sequelize=require(_0xb7cd('0x0'));module[_0xb7cd('0x1')]={'body':{'type':Sequelize[_0xb7cd('0x2')](_0xb7cd('0x3')),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index 85550d1..cb1885a 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 _0xde99=['ChatOfflineMessage','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','offset','order','sort','where','pick','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','find','create','body','describe','html-pdf','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','map'];(function(_0x1beef3,_0x57c4b8){var _0x5af964=function(_0x36f463){while(--_0x36f463){_0x1beef3['push'](_0x1beef3['shift']());}};_0x5af964(++_0x57c4b8);}(_0xde99,0x6c));var _0x9de9=function(_0x5a7b0e,_0x4794cf){_0x5a7b0e=_0x5a7b0e-0x0;var _0x452a68=_0xde99[_0x5a7b0e];return _0x452a68;};'use strict';var pdf=require(_0x9de9('0x0'));var emlformat=require(_0x9de9('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x9de9('0x2'));var jsonpatch=require(_0x9de9('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x9de9('0x4'));var Mustache=require(_0x9de9('0x5'));var util=require(_0x9de9('0x6'));var path=require(_0x9de9('0x7'));var sox=require('sox');var csv=require(_0x9de9('0x8'));var ejs=require(_0x9de9('0x9'));var fs=require('fs');var _=require(_0x9de9('0xa'));var squel=require('squel');var crypto=require(_0x9de9('0xb'));var jsforce=require(_0x9de9('0xc'));var deskjs=require(_0x9de9('0xd'));var toCsv=require('to-csv');var querystring=require(_0x9de9('0xe'));var Papa=require(_0x9de9('0xf'));var Redis=require(_0x9de9('0x10'));var authService=require(_0x9de9('0x11'));var qs=require(_0x9de9('0x12'));var as=require(_0x9de9('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9de9('0x14'))(_0x9de9('0x15'));var utils=require(_0x9de9('0x16'));var config=require(_0x9de9('0x17'));var db=require(_0x9de9('0x18'))['db'];function respondWithStatusCode(_0x48c129,_0x38197f){_0x38197f=_0x38197f||0xcc;return function(_0x7742f3){if(_0x7742f3){return _0x48c129[_0x9de9('0x19')](_0x38197f);}return _0x48c129[_0x9de9('0x1a')](_0x38197f)[_0x9de9('0x1b')]();};}function respondWithResult(_0x3b105d,_0x2b6e27){_0x2b6e27=_0x2b6e27||0xc8;return function(_0x187ced){if(_0x187ced){return _0x3b105d[_0x9de9('0x1a')](_0x2b6e27)[_0x9de9('0x1c')](_0x187ced);}};}function respondWithFilteredResult(_0x4ff010,_0x4e254b){return function(_0x335046){if(_0x335046){var _0x66e191=_0x335046['count'],_0xcdae91=_0x4e254b['offset'],_0x327be5=_0x4e254b['offset']+_0x4e254b[_0x9de9('0x1d')],_0x1e4337;if(_0x327be5>=_0x66e191){_0x327be5=_0x66e191;_0x1e4337=0xc8;}else{_0x1e4337=0xce;}_0x4ff010[_0x9de9('0x1a')](_0x1e4337);return _0x4ff010[_0x9de9('0x1e')](_0x9de9('0x1f'),_0xcdae91+'-'+_0x327be5+'/'+_0x66e191)[_0x9de9('0x1c')](_0x335046);}return null;};}function patchUpdates(_0x1ff4d0){return function(_0x404354){try{jsonpatch['apply'](_0x404354,_0x1ff4d0,!![]);}catch(_0x32e323){return BPromise[_0x9de9('0x20')](_0x32e323);}return _0x404354[_0x9de9('0x21')]();};}function saveUpdates(_0x14a01f,_0x29e723){return function(_0x41732e){if(_0x41732e){return _0x41732e[_0x9de9('0x22')](_0x14a01f)[_0x9de9('0x23')](function(_0x20ecd3){return _0x20ecd3;});}return null;};}function removeEntity(_0x15a555,_0xec659){return function(_0x57da9f){if(_0x57da9f){return _0x57da9f[_0x9de9('0x24')]()[_0x9de9('0x23')](function(){_0x15a555[_0x9de9('0x1a')](0xcc)[_0x9de9('0x1b')]();});}};}function handleEntityNotFound(_0x3e8bd8,_0x4971c1){return function(_0x3c97af){if(!_0x3c97af){_0x3e8bd8[_0x9de9('0x19')](0x194);}return _0x3c97af;};}function handleError(_0x3cb601,_0x1c10e9){_0x1c10e9=_0x1c10e9||0x1f4;return function(_0x49106c){logger[_0x9de9('0x25')](_0x49106c[_0x9de9('0x26')]);if(_0x49106c[_0x9de9('0x27')]){delete _0x49106c[_0x9de9('0x27')];}_0x3cb601[_0x9de9('0x1a')](_0x1c10e9)[_0x9de9('0x28')](_0x49106c);};}exports['index']=function(_0x5ed09c,_0x38bdac){var _0x4446b5={},_0x517a43={},_0x23cd45={'count':0x0,'rows':[]};var _0x171773=_[_0x9de9('0x29')](db[_0x9de9('0x2a')][_0x9de9('0x2b')],function(_0x59d201){return{'name':_0x59d201[_0x9de9('0x2c')],'type':_0x59d201[_0x9de9('0x2d')][_0x9de9('0x2e')]};});_0x517a43['model']=_[_0x9de9('0x29')](_0x171773,_0x9de9('0x27'));_0x517a43[_0x9de9('0x2f')]=_[_0x9de9('0x30')](_0x5ed09c[_0x9de9('0x2f')]);_0x517a43[_0x9de9('0x31')]=_[_0x9de9('0x32')](_0x517a43[_0x9de9('0x33')],_0x517a43[_0x9de9('0x2f')]);_0x4446b5[_0x9de9('0x34')]=_[_0x9de9('0x32')](_0x517a43[_0x9de9('0x33')],qs['fields'](_0x5ed09c[_0x9de9('0x2f')][_0x9de9('0x35')]));_0x4446b5[_0x9de9('0x34')]=_0x4446b5[_0x9de9('0x34')][_0x9de9('0x36')]?_0x4446b5[_0x9de9('0x34')]:_0x517a43[_0x9de9('0x33')];if(!_0x5ed09c['query'][_0x9de9('0x37')]('nolimit')){_0x4446b5[_0x9de9('0x1d')]=qs[_0x9de9('0x1d')](_0x5ed09c[_0x9de9('0x2f')]['limit']);_0x4446b5[_0x9de9('0x38')]=qs[_0x9de9('0x38')](_0x5ed09c[_0x9de9('0x2f')][_0x9de9('0x38')]);}_0x4446b5[_0x9de9('0x39')]=qs[_0x9de9('0x3a')](_0x5ed09c[_0x9de9('0x2f')][_0x9de9('0x3a')]);_0x4446b5[_0x9de9('0x3b')]=qs[_0x9de9('0x31')](_[_0x9de9('0x3c')](_0x5ed09c[_0x9de9('0x2f')],_0x517a43[_0x9de9('0x31')]));if(_0x5ed09c[_0x9de9('0x2f')]['filter']){_0x4446b5[_0x9de9('0x3b')]=_[_0x9de9('0x3d')](_0x4446b5[_0x9de9('0x3b')],{'$or':_[_0x9de9('0x29')](_0x171773,function(_0xde06a7){if(_0xde06a7[_0x9de9('0x2d')]!==_0x9de9('0x3e')){var _0x1f99d7={};_0x1f99d7[_0xde06a7['name']]={'$like':'%'+_0x5ed09c[_0x9de9('0x2f')]['filter']+'%'};return _0x1f99d7;}})});}_0x4446b5=_[_0x9de9('0x3d')]({},_0x4446b5,_0x5ed09c[_0x9de9('0x3f')]);var _0x397203={'where':_0x4446b5['where']};return db[_0x9de9('0x2a')][_0x9de9('0x40')](_0x397203)[_0x9de9('0x23')](function(_0x27b272){_0x23cd45[_0x9de9('0x40')]=_0x27b272;if(_0x5ed09c[_0x9de9('0x2f')][_0x9de9('0x41')]){_0x4446b5[_0x9de9('0x42')]=[{'all':!![]}];}return db[_0x9de9('0x2a')][_0x9de9('0x43')](_0x4446b5);})[_0x9de9('0x23')](function(_0x56dc24){_0x23cd45[_0x9de9('0x44')]=_0x56dc24;return _0x23cd45;})[_0x9de9('0x23')](respondWithFilteredResult(_0x38bdac,_0x4446b5))[_0x9de9('0x45')](handleError(_0x38bdac,null));};exports[_0x9de9('0x46')]=function(_0x2040df,_0x57bd23){var _0x4d3c79={'raw':!![],'where':{'id':_0x2040df['params']['id']}},_0x50f25c={};_0x50f25c[_0x9de9('0x33')]=_[_0x9de9('0x30')](db[_0x9de9('0x2a')][_0x9de9('0x2b')]);_0x50f25c[_0x9de9('0x2f')]=_['keys'](_0x2040df['query']);_0x50f25c['filters']=_['intersection'](_0x50f25c[_0x9de9('0x33')],_0x50f25c['query']);_0x4d3c79[_0x9de9('0x34')]=_[_0x9de9('0x32')](_0x50f25c[_0x9de9('0x33')],qs[_0x9de9('0x35')](_0x2040df[_0x9de9('0x2f')][_0x9de9('0x35')]));_0x4d3c79['attributes']=_0x4d3c79[_0x9de9('0x34')][_0x9de9('0x36')]?_0x4d3c79[_0x9de9('0x34')]:_0x50f25c[_0x9de9('0x33')];if(_0x2040df['query'][_0x9de9('0x41')]){_0x4d3c79['include']=[{'all':!![]}];}_0x4d3c79=_[_0x9de9('0x3d')]({},_0x4d3c79,_0x2040df[_0x9de9('0x3f')]);return db[_0x9de9('0x2a')][_0x9de9('0x47')](_0x4d3c79)[_0x9de9('0x23')](handleEntityNotFound(_0x57bd23,null))[_0x9de9('0x23')](respondWithResult(_0x57bd23,null))['catch'](handleError(_0x57bd23,null));};exports['create']=function(_0x108ff4,_0x24b9c0){return db[_0x9de9('0x2a')][_0x9de9('0x48')](_0x108ff4[_0x9de9('0x49')],{})['then'](respondWithResult(_0x24b9c0,0xc9))[_0x9de9('0x45')](handleError(_0x24b9c0,null));};exports['update']=function(_0x44370e,_0x1236d4){if(_0x44370e['body']['id']){delete _0x44370e['body']['id'];}return db[_0x9de9('0x2a')][_0x9de9('0x47')]({'where':{'id':_0x44370e['params']['id']}})[_0x9de9('0x23')](handleEntityNotFound(_0x1236d4,null))[_0x9de9('0x23')](saveUpdates(_0x44370e[_0x9de9('0x49')],null))[_0x9de9('0x23')](respondWithResult(_0x1236d4,null))[_0x9de9('0x45')](handleError(_0x1236d4,null));};exports[_0x9de9('0x24')]=function(_0x306c67,_0x3b6a67){return db[_0x9de9('0x2a')]['find']({'where':{'id':_0x306c67['params']['id']}})[_0x9de9('0x23')](handleEntityNotFound(_0x3b6a67,null))[_0x9de9('0x23')](removeEntity(_0x3b6a67,null))[_0x9de9('0x45')](handleError(_0x3b6a67,null));};exports['describe']=function(_0x366b5e,_0x15ffe2){return db[_0x9de9('0x2a')][_0x9de9('0x4a')]()[_0x9de9('0x23')](respondWithResult(_0x15ffe2,null))['catch'](handleError(_0x15ffe2,null));}; \ No newline at end of file +var _0xb0e1=['request-promise','moment','util','sox','ejs','lodash','squel','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','reject','save','then','destroy','end','error','stack','name','send','index','map','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','where','VIRTUAL','merge','options','includeAll','ChatOfflineMessage','findAll','rows','catch','params','keys','rawAttributes','include','find','create','body','describe','html-pdf','eml-format','zip-dir','fast-json-patch'];(function(_0x40c182,_0x3b3c04){var _0x5d046b=function(_0x27404a){while(--_0x27404a){_0x40c182['push'](_0x40c182['shift']());}};_0x5d046b(++_0x3b3c04);}(_0xb0e1,0x1a6));var _0x1b0e=function(_0x5e4edf,_0x16a6ff){_0x5e4edf=_0x5e4edf-0x0;var _0x422db6=_0xb0e1[_0x5e4edf];return _0x422db6;};'use strict';var pdf=require(_0x1b0e('0x0'));var emlformat=require(_0x1b0e('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x1b0e('0x2'));var jsonpatch=require(_0x1b0e('0x3'));var rp=require(_0x1b0e('0x4'));var moment=require(_0x1b0e('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x1b0e('0x6'));var path=require('path');var sox=require(_0x1b0e('0x7'));var csv=require('to-csv');var ejs=require(_0x1b0e('0x8'));var fs=require('fs');var _=require(_0x1b0e('0x9'));var squel=require(_0x1b0e('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x1b0e('0xb'));var toCsv=require(_0x1b0e('0xc'));var querystring=require(_0x1b0e('0xd'));var Papa=require(_0x1b0e('0xe'));var Redis=require('ioredis');var authService=require(_0x1b0e('0xf'));var qs=require(_0x1b0e('0x10'));var as=require(_0x1b0e('0x11'));var hardwareService=require(_0x1b0e('0x12'));var logger=require(_0x1b0e('0x13'))('api');var utils=require(_0x1b0e('0x14'));var config=require(_0x1b0e('0x15'));var db=require(_0x1b0e('0x16'))['db'];function respondWithStatusCode(_0x1d77f8,_0x497e9c){_0x497e9c=_0x497e9c||0xcc;return function(_0x3c6964){if(_0x3c6964){return _0x1d77f8[_0x1b0e('0x17')](_0x497e9c);}return _0x1d77f8[_0x1b0e('0x18')](_0x497e9c)['end']();};}function respondWithResult(_0x49d546,_0x39202b){_0x39202b=_0x39202b||0xc8;return function(_0x14ebf6){if(_0x14ebf6){return _0x49d546[_0x1b0e('0x18')](_0x39202b)[_0x1b0e('0x19')](_0x14ebf6);}};}function respondWithFilteredResult(_0x45eea0,_0x2c94c1){return function(_0xab44b3){if(_0xab44b3){var _0x1cb753=_0xab44b3[_0x1b0e('0x1a')],_0xae860f=_0x2c94c1[_0x1b0e('0x1b')],_0x531fbf=_0x2c94c1[_0x1b0e('0x1b')]+_0x2c94c1[_0x1b0e('0x1c')],_0x4e13a4;if(_0x531fbf>=_0x1cb753){_0x531fbf=_0x1cb753;_0x4e13a4=0xc8;}else{_0x4e13a4=0xce;}_0x45eea0[_0x1b0e('0x18')](_0x4e13a4);return _0x45eea0[_0x1b0e('0x1d')](_0x1b0e('0x1e'),_0xae860f+'-'+_0x531fbf+'/'+_0x1cb753)['json'](_0xab44b3);}return null;};}function patchUpdates(_0x16765a){return function(_0x2e8cc9){try{jsonpatch['apply'](_0x2e8cc9,_0x16765a,!![]);}catch(_0x125198){return BPromise[_0x1b0e('0x1f')](_0x125198);}return _0x2e8cc9[_0x1b0e('0x20')]();};}function saveUpdates(_0x4c71fe,_0x61c563){return function(_0x1df538){if(_0x1df538){return _0x1df538['update'](_0x4c71fe)[_0x1b0e('0x21')](function(_0x1a1aaa){return _0x1a1aaa;});}return null;};}function removeEntity(_0x302c1e,_0x5a387b){return function(_0x35435f){if(_0x35435f){return _0x35435f[_0x1b0e('0x22')]()['then'](function(){_0x302c1e[_0x1b0e('0x18')](0xcc)[_0x1b0e('0x23')]();});}};}function handleEntityNotFound(_0x29832e,_0x3f5cc5){return function(_0x238c0a){if(!_0x238c0a){_0x29832e[_0x1b0e('0x17')](0x194);}return _0x238c0a;};}function handleError(_0x250e46,_0x4d26c0){_0x4d26c0=_0x4d26c0||0x1f4;return function(_0x1397fa){logger[_0x1b0e('0x24')](_0x1397fa[_0x1b0e('0x25')]);if(_0x1397fa[_0x1b0e('0x26')]){delete _0x1397fa[_0x1b0e('0x26')];}_0x250e46[_0x1b0e('0x18')](_0x4d26c0)[_0x1b0e('0x27')](_0x1397fa);};}exports[_0x1b0e('0x28')]=function(_0x2c631f,_0x1a3a6f){var _0xc9a2a2={},_0x3d2967={},_0x56722f={'count':0x0,'rows':[]};var _0x5789f3=_[_0x1b0e('0x29')](db['ChatOfflineMessage']['rawAttributes'],function(_0x4ac91a){return{'name':_0x4ac91a['fieldName'],'type':_0x4ac91a[_0x1b0e('0x2a')]['key']};});_0x3d2967[_0x1b0e('0x2b')]=_[_0x1b0e('0x29')](_0x5789f3,'name');_0x3d2967[_0x1b0e('0x2c')]=_['keys'](_0x2c631f['query']);_0x3d2967[_0x1b0e('0x2d')]=_[_0x1b0e('0x2e')](_0x3d2967[_0x1b0e('0x2b')],_0x3d2967['query']);_0xc9a2a2[_0x1b0e('0x2f')]=_['intersection'](_0x3d2967[_0x1b0e('0x2b')],qs[_0x1b0e('0x30')](_0x2c631f[_0x1b0e('0x2c')][_0x1b0e('0x30')]));_0xc9a2a2[_0x1b0e('0x2f')]=_0xc9a2a2['attributes'][_0x1b0e('0x31')]?_0xc9a2a2['attributes']:_0x3d2967[_0x1b0e('0x2b')];if(!_0x2c631f[_0x1b0e('0x2c')][_0x1b0e('0x32')]('nolimit')){_0xc9a2a2[_0x1b0e('0x1c')]=qs[_0x1b0e('0x1c')](_0x2c631f[_0x1b0e('0x2c')][_0x1b0e('0x1c')]);_0xc9a2a2[_0x1b0e('0x1b')]=qs['offset'](_0x2c631f[_0x1b0e('0x2c')]['offset']);}_0xc9a2a2[_0x1b0e('0x33')]=qs[_0x1b0e('0x34')](_0x2c631f[_0x1b0e('0x2c')]['sort']);_0xc9a2a2['where']=qs[_0x1b0e('0x2d')](_[_0x1b0e('0x35')](_0x2c631f[_0x1b0e('0x2c')],_0x3d2967[_0x1b0e('0x2d')]));if(_0x2c631f[_0x1b0e('0x2c')]['filter']){_0xc9a2a2[_0x1b0e('0x36')]=_['merge'](_0xc9a2a2[_0x1b0e('0x36')],{'$or':_[_0x1b0e('0x29')](_0x5789f3,function(_0x1c3f3e){if(_0x1c3f3e[_0x1b0e('0x2a')]!==_0x1b0e('0x37')){var _0x5aefc8={};_0x5aefc8[_0x1c3f3e[_0x1b0e('0x26')]]={'$like':'%'+_0x2c631f['query']['filter']+'%'};return _0x5aefc8;}})});}_0xc9a2a2=_[_0x1b0e('0x38')]({},_0xc9a2a2,_0x2c631f[_0x1b0e('0x39')]);var _0x436948={'where':_0xc9a2a2[_0x1b0e('0x36')]};return db['ChatOfflineMessage'][_0x1b0e('0x1a')](_0x436948)['then'](function(_0x41cf55){_0x56722f[_0x1b0e('0x1a')]=_0x41cf55;if(_0x2c631f[_0x1b0e('0x2c')][_0x1b0e('0x3a')]){_0xc9a2a2['include']=[{'all':!![]}];}return db[_0x1b0e('0x3b')][_0x1b0e('0x3c')](_0xc9a2a2);})[_0x1b0e('0x21')](function(_0x31f616){_0x56722f[_0x1b0e('0x3d')]=_0x31f616;return _0x56722f;})['then'](respondWithFilteredResult(_0x1a3a6f,_0xc9a2a2))[_0x1b0e('0x3e')](handleError(_0x1a3a6f,null));};exports['show']=function(_0x4e76d0,_0x51be7f){var _0x4f1d62={'raw':!![],'where':{'id':_0x4e76d0[_0x1b0e('0x3f')]['id']}},_0x6f6898={};_0x6f6898[_0x1b0e('0x2b')]=_[_0x1b0e('0x40')](db[_0x1b0e('0x3b')][_0x1b0e('0x41')]);_0x6f6898['query']=_[_0x1b0e('0x40')](_0x4e76d0[_0x1b0e('0x2c')]);_0x6f6898[_0x1b0e('0x2d')]=_[_0x1b0e('0x2e')](_0x6f6898['model'],_0x6f6898[_0x1b0e('0x2c')]);_0x4f1d62[_0x1b0e('0x2f')]=_[_0x1b0e('0x2e')](_0x6f6898[_0x1b0e('0x2b')],qs[_0x1b0e('0x30')](_0x4e76d0[_0x1b0e('0x2c')][_0x1b0e('0x30')]));_0x4f1d62[_0x1b0e('0x2f')]=_0x4f1d62[_0x1b0e('0x2f')][_0x1b0e('0x31')]?_0x4f1d62[_0x1b0e('0x2f')]:_0x6f6898[_0x1b0e('0x2b')];if(_0x4e76d0['query'][_0x1b0e('0x3a')]){_0x4f1d62[_0x1b0e('0x42')]=[{'all':!![]}];}_0x4f1d62=_[_0x1b0e('0x38')]({},_0x4f1d62,_0x4e76d0[_0x1b0e('0x39')]);return db['ChatOfflineMessage'][_0x1b0e('0x43')](_0x4f1d62)[_0x1b0e('0x21')](handleEntityNotFound(_0x51be7f,null))[_0x1b0e('0x21')](respondWithResult(_0x51be7f,null))[_0x1b0e('0x3e')](handleError(_0x51be7f,null));};exports[_0x1b0e('0x44')]=function(_0x314b58,_0x233ebb){return db[_0x1b0e('0x3b')][_0x1b0e('0x44')](_0x314b58[_0x1b0e('0x45')],{})[_0x1b0e('0x21')](respondWithResult(_0x233ebb,0xc9))['catch'](handleError(_0x233ebb,null));};exports['update']=function(_0x2b08f0,_0x1d338d){if(_0x2b08f0[_0x1b0e('0x45')]['id']){delete _0x2b08f0[_0x1b0e('0x45')]['id'];}return db[_0x1b0e('0x3b')][_0x1b0e('0x43')]({'where':{'id':_0x2b08f0[_0x1b0e('0x3f')]['id']}})['then'](handleEntityNotFound(_0x1d338d,null))[_0x1b0e('0x21')](saveUpdates(_0x2b08f0[_0x1b0e('0x45')],null))['then'](respondWithResult(_0x1d338d,null))[_0x1b0e('0x3e')](handleError(_0x1d338d,null));};exports[_0x1b0e('0x22')]=function(_0x4010f4,_0x46f946){return db[_0x1b0e('0x3b')][_0x1b0e('0x43')]({'where':{'id':_0x4010f4['params']['id']}})[_0x1b0e('0x21')](handleEntityNotFound(_0x46f946,null))['then'](removeEntity(_0x46f946,null))[_0x1b0e('0x3e')](handleError(_0x46f946,null));};exports[_0x1b0e('0x46')]=function(_0x54a578,_0x1b853a){return db[_0x1b0e('0x3b')][_0x1b0e('0x46')]()[_0x1b0e('0x21')](respondWithResult(_0x1b853a,null))[_0x1b0e('0x3e')](handleError(_0x1b853a,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index 2ef72d1..9ea0485 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 _0xd2ea=['./chatOfflineMessage.attributes','exports','define','ChatOfflineMessage','chat_offline_messages','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x557708,_0xef7aa6){var _0x4a4840=function(_0x41fb1b){while(--_0x41fb1b){_0x557708['push'](_0x557708['shift']());}};_0x4a4840(++_0xef7aa6);}(_0xd2ea,0x15f));var _0xad2e=function(_0x5c0f90,_0xcbe32d){_0x5c0f90=_0x5c0f90-0x0;var _0x5375bf=_0xd2ea[_0x5c0f90];return _0x5375bf;};'use strict';var _=require(_0xad2e('0x0'));var util=require(_0xad2e('0x1'));var logger=require(_0xad2e('0x2'))(_0xad2e('0x3'));var moment=require(_0xad2e('0x4'));var BPromise=require('bluebird');var rp=require(_0xad2e('0x5'));var fs=require('fs');var path=require(_0xad2e('0x6'));var rimraf=require(_0xad2e('0x7'));var config=require(_0xad2e('0x8'));var attributes=require(_0xad2e('0x9'));module[_0xad2e('0xa')]=function(_0x29e97f,_0x592e8b){return _0x29e97f[_0xad2e('0xb')](_0xad2e('0xc'),attributes,{'tableName':_0xad2e('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xad2e('0xe')});}; \ No newline at end of file +var _0x2dae=['lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatOfflineMessage.attributes','exports','define','ChatOfflineMessage','chat_offline_messages','utf8mb4','utf8mb4_unicode_ci'];(function(_0x52b81f,_0x34f71b){var _0x315b8d=function(_0x425e45){while(--_0x425e45){_0x52b81f['push'](_0x52b81f['shift']());}};_0x315b8d(++_0x34f71b);}(_0x2dae,0xc3));var _0xe2da=function(_0x11ca63,_0xea9f9c){_0x11ca63=_0x11ca63-0x0;var _0x41f1f6=_0x2dae[_0x11ca63];return _0x41f1f6;};'use strict';var _=require(_0xe2da('0x0'));var util=require('util');var logger=require(_0xe2da('0x1'))(_0xe2da('0x2'));var moment=require(_0xe2da('0x3'));var BPromise=require(_0xe2da('0x4'));var rp=require(_0xe2da('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe2da('0x6'));var config=require(_0xe2da('0x7'));var attributes=require(_0xe2da('0x8'));module[_0xe2da('0x9')]=function(_0x523c60,_0x3e3e25){return _0x523c60[_0xe2da('0xa')](_0xe2da('0xb'),attributes,{'tableName':_0xe2da('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe2da('0xd'),'collate':_0xe2da('0xe')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index e59cdd5..20072c7 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 _0xd202=['jayson/promise','client','http','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0xe3cd53,_0x588d2d){var _0x22f7bf=function(_0x2b50d){while(--_0x2b50d){_0xe3cd53['push'](_0xe3cd53['shift']());}};_0x22f7bf(++_0x588d2d);}(_0xd202,0xe2));var _0x2d20=function(_0xc4001c,_0x1bf8f0){_0xc4001c=_0xc4001c-0x0;var _0x49f7bc=_0xd202[_0xc4001c];return _0x49f7bc;};'use strict';var _=require(_0x2d20('0x0'));var util=require(_0x2d20('0x1'));var moment=require(_0x2d20('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2d20('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x2d20('0x4'));var logger=require(_0x2d20('0x5'))(_0x2d20('0x6'));var config=require(_0x2d20('0x7'));var jayson=require(_0x2d20('0x8'));var client=jayson[_0x2d20('0x9')][_0x2d20('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3783a8,_0x5b0703,_0x39ab48){return new BPromise(function(_0x173c16,_0x48413c){return client['request'](_0x3783a8,_0x39ab48)['then'](function(_0x7b6438){logger['info'](_0x2d20('0xb'),_0x5b0703,_0x2d20('0xc'));logger[_0x2d20('0xd')]('ChatOfflineMessage,\x20%s,\x20%s,\x20%s',_0x5b0703,_0x2d20('0xc'),JSON['stringify'](_0x7b6438));if(_0x7b6438['error']){if(_0x7b6438[_0x2d20('0xe')]['code']===0x1f4){logger['error'](_0x2d20('0xb'),_0x5b0703,_0x7b6438[_0x2d20('0xe')][_0x2d20('0xf')]);return _0x48413c(_0x7b6438[_0x2d20('0xe')][_0x2d20('0xf')]);}logger[_0x2d20('0xe')](_0x2d20('0xb'),_0x5b0703,_0x7b6438[_0x2d20('0xe')]['message']);return _0x173c16(_0x7b6438[_0x2d20('0xe')][_0x2d20('0xf')]);}else{logger['info'](_0x2d20('0xb'),_0x5b0703,_0x2d20('0xc'));_0x173c16(_0x7b6438[_0x2d20('0x10')][_0x2d20('0xf')]);}})[_0x2d20('0x11')](function(_0x3ca400){logger[_0x2d20('0xe')](_0x2d20('0xb'),_0x5b0703,_0x3ca400);_0x48413c(_0x3ca400);});});} \ No newline at end of file +var _0x6372=['code','message','info','catch','util','moment','randomstring','rpc','../../config/environment','http','request','then','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x49c057,_0xc808ed){var _0xd8f0e6=function(_0x5b9042){while(--_0x5b9042){_0x49c057['push'](_0x49c057['shift']());}};_0xd8f0e6(++_0xc808ed);}(_0x6372,0x82));var _0x2637=function(_0xd4c36a,_0x4d6600){_0xd4c36a=_0xd4c36a-0x0;var _0xd9fc71=_0x6372[_0xd4c36a];return _0xd9fc71;};'use strict';var _=require('lodash');var util=require(_0x2637('0x0'));var moment=require(_0x2637('0x1'));var BPromise=require('bluebird');var rs=require(_0x2637('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x2637('0x3'));var config=require(_0x2637('0x4'));var jayson=require('jayson/promise');var client=jayson['client'][_0x2637('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x5dd156,_0x4a9902,_0x6144d4){return new BPromise(function(_0x4b60d7,_0x2cbca2){return client[_0x2637('0x6')](_0x5dd156,_0x6144d4)[_0x2637('0x7')](function(_0xdc6403){logger['info'](_0x2637('0x8'),_0x4a9902,_0x2637('0x9'));logger[_0x2637('0xa')](_0x2637('0xb'),_0x4a9902,'request\x20sent',JSON[_0x2637('0xc')](_0xdc6403));if(_0xdc6403[_0x2637('0xd')]){if(_0xdc6403[_0x2637('0xd')][_0x2637('0xe')]===0x1f4){logger[_0x2637('0xd')](_0x2637('0x8'),_0x4a9902,_0xdc6403['error'][_0x2637('0xf')]);return _0x2cbca2(_0xdc6403[_0x2637('0xd')][_0x2637('0xf')]);}logger[_0x2637('0xd')]('ChatOfflineMessage,\x20%s,\x20%s',_0x4a9902,_0xdc6403[_0x2637('0xd')]['message']);return _0x4b60d7(_0xdc6403['error'][_0x2637('0xf')]);}else{logger[_0x2637('0x10')](_0x2637('0x8'),_0x4a9902,_0x2637('0x9'));_0x4b60d7(_0xdc6403['result'][_0x2637('0xf')]);}})[_0x2637('0x11')](function(_0x130a5b){logger[_0x2637('0xd')](_0x2637('0x8'),_0x4a9902,_0x130a5b);_0x2cbca2(_0x130a5b);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index 90c28ef..4cd954e 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 _0x363b=['util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated','index','/describe','/:id','post','put','update','delete','destroy','exports'];(function(_0x19ae3c,_0x36ef3a){var _0x5e155a=function(_0x568d89){while(--_0x568d89){_0x19ae3c['push'](_0x19ae3c['shift']());}};_0x5e155a(++_0x36ef3a);}(_0x363b,0xbe));var _0xb363=function(_0x44061b,_0x225ccf){_0x44061b=_0x44061b-0x0;var _0x2893b4=_0x363b[_0x44061b];return _0x2893b4;};'use strict';var multer=require('multer');var util=require(_0xb363('0x0'));var path=require(_0xb363('0x1'));var timeout=require(_0xb363('0x2'));var express=require(_0xb363('0x3'));var router=express['Router']();var auth=require(_0xb363('0x4'));var interaction=require(_0xb363('0x5'));var config=require(_0xb363('0x6'));var controller=require(_0xb363('0x7'));router[_0xb363('0x8')]('/',auth[_0xb363('0x9')](),controller[_0xb363('0xa')]);router[_0xb363('0x8')](_0xb363('0xb'),auth['isAuthenticated'](),controller['describe']);router['get'](_0xb363('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xb363('0xd')]('/',auth[_0xb363('0x9')](),controller['create']);router[_0xb363('0xe')]('/:id',auth[_0xb363('0x9')](),controller[_0xb363('0xf')]);router[_0xb363('0x10')](_0xb363('0xc'),auth[_0xb363('0x9')](),controller[_0xb363('0x11')]);module[_0xb363('0x12')]=router; \ No newline at end of file +var _0x99e3=['/:id','show','post','create','update','delete','destroy','multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','/describe','isAuthenticated'];(function(_0x1ba43c,_0x5bd2e8){var _0x2f60eb=function(_0x349dff){while(--_0x349dff){_0x1ba43c['push'](_0x1ba43c['shift']());}};_0x2f60eb(++_0x5bd2e8);}(_0x99e3,0x6d));var _0x399e=function(_0x269598,_0x1a18db){_0x269598=_0x269598-0x0;var _0x987db4=_0x99e3[_0x269598];return _0x987db4;};'use strict';var multer=require(_0x399e('0x0'));var util=require(_0x399e('0x1'));var path=require('path');var timeout=require(_0x399e('0x2'));var express=require(_0x399e('0x3'));var router=express[_0x399e('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x399e('0x5'));var config=require(_0x399e('0x6'));var controller=require(_0x399e('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x399e('0x8'),auth[_0x399e('0x9')](),controller['describe']);router['get'](_0x399e('0xa'),auth[_0x399e('0x9')](),controller[_0x399e('0xb')]);router[_0x399e('0xc')]('/',auth[_0x399e('0x9')](),controller[_0x399e('0xd')]);router['put'](_0x399e('0xa'),auth[_0x399e('0x9')](),controller[_0x399e('0xe')]);router[_0x399e('0xf')](_0x399e('0xa'),auth[_0x399e('0x9')](),controller[_0x399e('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index 210c44b..e6843ea 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 _0x3bc1=['mouseOver','timeout','INTEGER','sequelize','exports','STRING','ENUM'];(function(_0x28312b,_0x560437){var _0x2ce97c=function(_0x1127b9){while(--_0x1127b9){_0x28312b['push'](_0x28312b['shift']());}};_0x2ce97c(++_0x560437);}(_0x3bc1,0xf8));var _0x13bc=function(_0xa1c6de,_0x2ced73){_0xa1c6de=_0xa1c6de-0x0;var _0x56f97e=_0x3bc1[_0xa1c6de];return _0x56f97e;};'use strict';var Sequelize=require(_0x13bc('0x0'));module[_0x13bc('0x1')]={'name':{'type':Sequelize[_0x13bc('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x13bc('0x3')](_0x13bc('0x4'),_0x13bc('0x5')),'defaultValue':_0x13bc('0x4')},'selector':{'type':Sequelize[_0x13bc('0x2')]},'timeout':{'type':Sequelize[_0x13bc('0x6')]}}; \ No newline at end of file +var _0x5901=['exports','STRING','ENUM','mouseOver','INTEGER','sequelize'];(function(_0x92091c,_0x81ab2c){var _0x3dc03a=function(_0x286115){while(--_0x286115){_0x92091c['push'](_0x92091c['shift']());}};_0x3dc03a(++_0x81ab2c);}(_0x5901,0x113));var _0x1590=function(_0x522919,_0xd083b0){_0x522919=_0x522919-0x0;var _0x410629=_0x5901[_0x522919];return _0x410629;};'use strict';var Sequelize=require(_0x1590('0x0'));module[_0x1590('0x1')]={'name':{'type':Sequelize[_0x1590('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x1590('0x3')](_0x1590('0x4'),'timeout'),'defaultValue':'mouseOver'},'selector':{'type':Sequelize[_0x1590('0x2')]},'timeout':{'type':Sequelize[_0x1590('0x5')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index 1a43cc8..1d56de5 100644 --- a/server/api/chatProactiveAction/chatProactiveAction.controller.js +++ b/server/api/chatProactiveAction/chatProactiveAction.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../mysqldb','sendStatus','end','status','json','count','offset','limit','Content-Range','apply','reject','save','update','then','error','name','send','params','model','keys','rawAttributes','query','filters','intersection','attributes','length','includeAll','include','merge','options','catch','create','ChatProactiveAction','body','find','destroy','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','to-csv','ejs'];(function(_0x21ce7a,_0x33bc32){var _0x222227=function(_0x52bb72){while(--_0x52bb72){_0x21ce7a['push'](_0x21ce7a['shift']());}};_0x222227(++_0x33bc32);}(_0x9c44,0x178));var _0x49c4=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0x9c44[_0x36c5b0];return _0xf19333;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x49c4('0x0'));var zipdir=require(_0x49c4('0x1'));var jsonpatch=require(_0x49c4('0x2'));var rp=require(_0x49c4('0x3'));var moment=require(_0x49c4('0x4'));var BPromise=require(_0x49c4('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x49c4('0x6'));var sox=require('sox');var csv=require(_0x49c4('0x7'));var ejs=require(_0x49c4('0x8'));var fs=require('fs');var _=require(_0x49c4('0x9'));var squel=require(_0x49c4('0xa'));var crypto=require(_0x49c4('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x49c4('0xc'));var toCsv=require(_0x49c4('0x7'));var querystring=require(_0x49c4('0xd'));var Papa=require(_0x49c4('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x49c4('0xf'));var as=require(_0x49c4('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x49c4('0x11'))(_0x49c4('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x49c4('0x13'))['db'];function respondWithStatusCode(_0x6d1b08,_0x5487cd){_0x5487cd=_0x5487cd||0xcc;return function(_0x7df3a9){if(_0x7df3a9){return _0x6d1b08[_0x49c4('0x14')](_0x5487cd);}return _0x6d1b08['status'](_0x5487cd)[_0x49c4('0x15')]();};}function respondWithResult(_0x280996,_0x21f15a){_0x21f15a=_0x21f15a||0xc8;return function(_0x2decee){if(_0x2decee){return _0x280996[_0x49c4('0x16')](_0x21f15a)[_0x49c4('0x17')](_0x2decee);}};}function respondWithFilteredResult(_0x75ea8,_0x3de397){return function(_0x58d177){if(_0x58d177){var _0x3acd06=_0x58d177[_0x49c4('0x18')],_0x141003=_0x3de397['offset'],_0x13a2db=_0x3de397[_0x49c4('0x19')]+_0x3de397[_0x49c4('0x1a')],_0x81e831;if(_0x13a2db>=_0x3acd06){_0x13a2db=_0x3acd06;_0x81e831=0xc8;}else{_0x81e831=0xce;}_0x75ea8['status'](_0x81e831);return _0x75ea8['set'](_0x49c4('0x1b'),_0x141003+'-'+_0x13a2db+'/'+_0x3acd06)[_0x49c4('0x17')](_0x58d177);}return null;};}function patchUpdates(_0x3addb2){return function(_0x59f29b){try{jsonpatch[_0x49c4('0x1c')](_0x59f29b,_0x3addb2,!![]);}catch(_0x50b151){return BPromise[_0x49c4('0x1d')](_0x50b151);}return _0x59f29b[_0x49c4('0x1e')]();};}function saveUpdates(_0xe31fcc,_0x291526){return function(_0x382040){if(_0x382040){return _0x382040[_0x49c4('0x1f')](_0xe31fcc)[_0x49c4('0x20')](function(_0x46e475){return _0x46e475;});}return null;};}function removeEntity(_0x2197d2,_0x578447){return function(_0x527126){if(_0x527126){return _0x527126['destroy']()[_0x49c4('0x20')](function(){_0x2197d2['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2263ae,_0x15581b){return function(_0x26c640){if(!_0x26c640){_0x2263ae[_0x49c4('0x14')](0x194);}return _0x26c640;};}function handleError(_0x4811c4,_0x5850f2){_0x5850f2=_0x5850f2||0x1f4;return function(_0x180276){logger[_0x49c4('0x21')](_0x180276['stack']);if(_0x180276[_0x49c4('0x22')]){delete _0x180276[_0x49c4('0x22')];}_0x4811c4[_0x49c4('0x16')](_0x5850f2)[_0x49c4('0x23')](_0x180276);};}exports['show']=function(_0x543ea2,_0x449960){var _0x53c199={'raw':!![],'where':{'id':_0x543ea2[_0x49c4('0x24')]['id']}},_0x3800b7={};_0x3800b7[_0x49c4('0x25')]=_[_0x49c4('0x26')](db['ChatProactiveAction'][_0x49c4('0x27')]);_0x3800b7[_0x49c4('0x28')]=_[_0x49c4('0x26')](_0x543ea2[_0x49c4('0x28')]);_0x3800b7[_0x49c4('0x29')]=_[_0x49c4('0x2a')](_0x3800b7[_0x49c4('0x25')],_0x3800b7[_0x49c4('0x28')]);_0x53c199[_0x49c4('0x2b')]=_[_0x49c4('0x2a')](_0x3800b7[_0x49c4('0x25')],qs['fields'](_0x543ea2['query']['fields']));_0x53c199[_0x49c4('0x2b')]=_0x53c199[_0x49c4('0x2b')][_0x49c4('0x2c')]?_0x53c199[_0x49c4('0x2b')]:_0x3800b7[_0x49c4('0x25')];if(_0x543ea2['query'][_0x49c4('0x2d')]){_0x53c199[_0x49c4('0x2e')]=[{'all':!![]}];}_0x53c199=_[_0x49c4('0x2f')]({},_0x53c199,_0x543ea2[_0x49c4('0x30')]);return db['ChatProactiveAction']['find'](_0x53c199)[_0x49c4('0x20')](handleEntityNotFound(_0x449960,null))[_0x49c4('0x20')](respondWithResult(_0x449960,null))[_0x49c4('0x31')](handleError(_0x449960,null));};exports[_0x49c4('0x32')]=function(_0xd38540,_0x4a0c7a){return db[_0x49c4('0x33')][_0x49c4('0x32')](_0xd38540[_0x49c4('0x34')],{})['then'](respondWithResult(_0x4a0c7a,0xc9))['catch'](handleError(_0x4a0c7a,null));};exports[_0x49c4('0x1f')]=function(_0x1991e9,_0x3bec0a){if(_0x1991e9[_0x49c4('0x34')]['id']){delete _0x1991e9[_0x49c4('0x34')]['id'];}return db[_0x49c4('0x33')][_0x49c4('0x35')]({'where':{'id':_0x1991e9[_0x49c4('0x24')]['id']}})[_0x49c4('0x20')](handleEntityNotFound(_0x3bec0a,null))['then'](saveUpdates(_0x1991e9[_0x49c4('0x34')],null))['then'](respondWithResult(_0x3bec0a,null))[_0x49c4('0x31')](handleError(_0x3bec0a,null));};exports[_0x49c4('0x36')]=function(_0x2625a6,_0x1c2830){return db['ChatProactiveAction'][_0x49c4('0x35')]({'where':{'id':_0x2625a6[_0x49c4('0x24')]['id']}})[_0x49c4('0x20')](handleEntityNotFound(_0x1c2830,null))['then'](removeEntity(_0x1c2830,null))[_0x49c4('0x31')](handleError(_0x1c2830,null));}; \ No newline at end of file +var _0x0713=['update','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','count','offset','limit','status','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','show','params','model','keys','ChatProactiveAction','rawAttributes','query','attributes','intersection','fields','includeAll','include','merge','options','find','catch','create','body'];(function(_0x3d918b,_0x451cd6){var _0x83edf9=function(_0x3a03a5){while(--_0x3a03a5){_0x3d918b['push'](_0x3d918b['shift']());}};_0x83edf9(++_0x451cd6);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x3071('0x0'));var zipdir=require(_0x3071('0x1'));var jsonpatch=require(_0x3071('0x2'));var rp=require(_0x3071('0x3'));var moment=require(_0x3071('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x3071('0x5'));var util=require(_0x3071('0x6'));var path=require(_0x3071('0x7'));var sox=require(_0x3071('0x8'));var csv=require(_0x3071('0x9'));var ejs=require(_0x3071('0xa'));var fs=require('fs');var _=require(_0x3071('0xb'));var squel=require(_0x3071('0xc'));var crypto=require(_0x3071('0xd'));var jsforce=require(_0x3071('0xe'));var deskjs=require(_0x3071('0xf'));var toCsv=require(_0x3071('0x9'));var querystring=require(_0x3071('0x10'));var Papa=require('papaparse');var Redis=require(_0x3071('0x11'));var authService=require(_0x3071('0x12'));var qs=require(_0x3071('0x13'));var as=require(_0x3071('0x14'));var hardwareService=require(_0x3071('0x15'));var logger=require('../../config/logger')(_0x3071('0x16'));var utils=require(_0x3071('0x17'));var config=require(_0x3071('0x18'));var db=require(_0x3071('0x19'))['db'];function respondWithStatusCode(_0xa0c1,_0x4a8cc7){_0x4a8cc7=_0x4a8cc7||0xcc;return function(_0x5330a8){if(_0x5330a8){return _0xa0c1[_0x3071('0x1a')](_0x4a8cc7);}return _0xa0c1['status'](_0x4a8cc7)[_0x3071('0x1b')]();};}function respondWithResult(_0x44fbae,_0x5d4883){_0x5d4883=_0x5d4883||0xc8;return function(_0x104e73){if(_0x104e73){return _0x44fbae['status'](_0x5d4883)[_0x3071('0x1c')](_0x104e73);}};}function respondWithFilteredResult(_0x45c93b,_0x1271d0){return function(_0x1f14e1){if(_0x1f14e1){var _0x1caa5d=_0x1f14e1[_0x3071('0x1d')],_0x2a6a4b=_0x1271d0[_0x3071('0x1e')],_0x157a47=_0x1271d0['offset']+_0x1271d0[_0x3071('0x1f')],_0x11bdc9;if(_0x157a47>=_0x1caa5d){_0x157a47=_0x1caa5d;_0x11bdc9=0xc8;}else{_0x11bdc9=0xce;}_0x45c93b[_0x3071('0x20')](_0x11bdc9);return _0x45c93b[_0x3071('0x21')](_0x3071('0x22'),_0x2a6a4b+'-'+_0x157a47+'/'+_0x1caa5d)[_0x3071('0x1c')](_0x1f14e1);}return null;};}function patchUpdates(_0x17aee2){return function(_0x105bbb){try{jsonpatch[_0x3071('0x23')](_0x105bbb,_0x17aee2,!![]);}catch(_0x502a16){return BPromise[_0x3071('0x24')](_0x502a16);}return _0x105bbb[_0x3071('0x25')]();};}function saveUpdates(_0xd3e23d,_0x56c267){return function(_0xb8f4e3){if(_0xb8f4e3){return _0xb8f4e3['update'](_0xd3e23d)[_0x3071('0x26')](function(_0x43128c){return _0x43128c;});}return null;};}function removeEntity(_0x3762d8,_0x457b57){return function(_0x33090c){if(_0x33090c){return _0x33090c[_0x3071('0x27')]()[_0x3071('0x26')](function(){_0x3762d8[_0x3071('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x481a51,_0x2ce48a){return function(_0xb05b1d){if(!_0xb05b1d){_0x481a51[_0x3071('0x1a')](0x194);}return _0xb05b1d;};}function handleError(_0x13df9f,_0x2793ef){_0x2793ef=_0x2793ef||0x1f4;return function(_0x44b45f){logger[_0x3071('0x28')](_0x44b45f[_0x3071('0x29')]);if(_0x44b45f[_0x3071('0x2a')]){delete _0x44b45f['name'];}_0x13df9f[_0x3071('0x20')](_0x2793ef)[_0x3071('0x2b')](_0x44b45f);};}exports[_0x3071('0x2c')]=function(_0x4d5c4b,_0x4fb1ca){var _0x28792d={'raw':!![],'where':{'id':_0x4d5c4b[_0x3071('0x2d')]['id']}},_0x163604={};_0x163604[_0x3071('0x2e')]=_[_0x3071('0x2f')](db[_0x3071('0x30')][_0x3071('0x31')]);_0x163604[_0x3071('0x32')]=_[_0x3071('0x2f')](_0x4d5c4b[_0x3071('0x32')]);_0x163604['filters']=_['intersection'](_0x163604[_0x3071('0x2e')],_0x163604[_0x3071('0x32')]);_0x28792d[_0x3071('0x33')]=_[_0x3071('0x34')](_0x163604[_0x3071('0x2e')],qs[_0x3071('0x35')](_0x4d5c4b[_0x3071('0x32')][_0x3071('0x35')]));_0x28792d['attributes']=_0x28792d['attributes']['length']?_0x28792d[_0x3071('0x33')]:_0x163604[_0x3071('0x2e')];if(_0x4d5c4b['query'][_0x3071('0x36')]){_0x28792d[_0x3071('0x37')]=[{'all':!![]}];}_0x28792d=_[_0x3071('0x38')]({},_0x28792d,_0x4d5c4b[_0x3071('0x39')]);return db['ChatProactiveAction'][_0x3071('0x3a')](_0x28792d)[_0x3071('0x26')](handleEntityNotFound(_0x4fb1ca,null))[_0x3071('0x26')](respondWithResult(_0x4fb1ca,null))[_0x3071('0x3b')](handleError(_0x4fb1ca,null));};exports[_0x3071('0x3c')]=function(_0x2068ce,_0x3c55c){return db[_0x3071('0x30')]['create'](_0x2068ce[_0x3071('0x3d')],{})['then'](respondWithResult(_0x3c55c,0xc9))['catch'](handleError(_0x3c55c,null));};exports[_0x3071('0x3e')]=function(_0xa3a7ae,_0x54d9c3){if(_0xa3a7ae[_0x3071('0x3d')]['id']){delete _0xa3a7ae[_0x3071('0x3d')]['id'];}return db[_0x3071('0x30')][_0x3071('0x3a')]({'where':{'id':_0xa3a7ae[_0x3071('0x2d')]['id']}})[_0x3071('0x26')](handleEntityNotFound(_0x54d9c3,null))['then'](saveUpdates(_0xa3a7ae[_0x3071('0x3d')],null))[_0x3071('0x26')](respondWithResult(_0x54d9c3,null))['catch'](handleError(_0x54d9c3,null));};exports[_0x3071('0x27')]=function(_0x5b1392,_0x28f855){return db[_0x3071('0x30')]['find']({'where':{'id':_0x5b1392['params']['id']}})[_0x3071('0x26')](handleEntityNotFound(_0x28f855,null))[_0x3071('0x26')](removeEntity(_0x28f855,null))[_0x3071('0x3b')](handleError(_0x28f855,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index d1c8c8f..912640d 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 _0xc09d=['../../config/environment','./chatProactiveAction.attributes','exports','define','ChatProactiveAction','moment','bluebird','request-promise','path','rimraf'];(function(_0x269ee8,_0x477226){var _0x4d98bd=function(_0x20d4c4){while(--_0x20d4c4){_0x269ee8['push'](_0x269ee8['shift']());}};_0x4d98bd(++_0x477226);}(_0xc09d,0x1c7));var _0xdc09=function(_0xb33b8b,_0x4bb4e7){_0xb33b8b=_0xb33b8b-0x0;var _0x5f0129=_0xc09d[_0xb33b8b];return _0x5f0129;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xdc09('0x0'));var BPromise=require(_0xdc09('0x1'));var rp=require(_0xdc09('0x2'));var fs=require('fs');var path=require(_0xdc09('0x3'));var rimraf=require(_0xdc09('0x4'));var config=require(_0xdc09('0x5'));var attributes=require(_0xdc09('0x6'));module[_0xdc09('0x7')]=function(_0xaf1d4,_0x23a0fa){return _0xaf1d4[_0xdc09('0x8')](_0xdc09('0x9'),attributes,{'tableName':'chat_proactive_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb0c5=['define','ChatProactiveAction','chat_proactive_actions','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','exports'];(function(_0x5d6cdc,_0xed2b86){var _0x453c27=function(_0x27df76){while(--_0x27df76){_0x5d6cdc['push'](_0x5d6cdc['shift']());}};_0x453c27(++_0xed2b86);}(_0xb0c5,0xdb));var _0x5b0c=function(_0x29ea21,_0x4fe786){_0x29ea21=_0x29ea21-0x0;var _0x1fc113=_0xb0c5[_0x29ea21];return _0x1fc113;};'use strict';var _=require(_0x5b0c('0x0'));var util=require(_0x5b0c('0x1'));var logger=require(_0x5b0c('0x2'))(_0x5b0c('0x3'));var moment=require(_0x5b0c('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x5b0c('0x5'));var rimraf=require(_0x5b0c('0x6'));var config=require(_0x5b0c('0x7'));var attributes=require('./chatProactiveAction.attributes');module[_0x5b0c('0x8')]=function(_0x47707f,_0x2f0857){return _0x47707f[_0x5b0c('0x9')](_0x5b0c('0xa'),attributes,{'tableName':_0x5b0c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.rpc.js b/server/api/chatProactiveAction/chatProactiveAction.rpc.js index 3e6d7d9..c0ac01a 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 _0xfe88=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','client','http','request','then','info','ChatProactiveAction,\x20%s,\x20%s','stringify','error','message','request\x20sent','lodash'];(function(_0x219183,_0x82dc3c){var _0x48f381=function(_0x392188){while(--_0x392188){_0x219183['push'](_0x219183['shift']());}};_0x48f381(++_0x82dc3c);}(_0xfe88,0x167));var _0x8fe8=function(_0x18959e,_0x24e830){_0x18959e=_0x18959e-0x0;var _0x308aba=_0xfe88[_0x18959e];return _0x308aba;};'use strict';var _=require(_0x8fe8('0x0'));var util=require('util');var moment=require(_0x8fe8('0x1'));var BPromise=require(_0x8fe8('0x2'));var rs=require(_0x8fe8('0x3'));var fs=require('fs');var Redis=require(_0x8fe8('0x4'));var db=require(_0x8fe8('0x5'))['db'];var utils=require(_0x8fe8('0x6'));var logger=require('../../config/logger')(_0x8fe8('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x8fe8('0x8')][_0x8fe8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1a0796,_0x2946d7,_0x181598){return new BPromise(function(_0x2e6448,_0x1c746b){return client[_0x8fe8('0xa')](_0x1a0796,_0x181598)[_0x8fe8('0xb')](function(_0x57f0e1){logger[_0x8fe8('0xc')](_0x8fe8('0xd'),_0x2946d7,'request\x20sent');logger['debug']('ChatProactiveAction,\x20%s,\x20%s,\x20%s',_0x2946d7,'request\x20sent',JSON[_0x8fe8('0xe')](_0x57f0e1));if(_0x57f0e1[_0x8fe8('0xf')]){if(_0x57f0e1[_0x8fe8('0xf')]['code']===0x1f4){logger[_0x8fe8('0xf')](_0x8fe8('0xd'),_0x2946d7,_0x57f0e1[_0x8fe8('0xf')][_0x8fe8('0x10')]);return _0x1c746b(_0x57f0e1[_0x8fe8('0xf')][_0x8fe8('0x10')]);}logger['error'](_0x8fe8('0xd'),_0x2946d7,_0x57f0e1[_0x8fe8('0xf')][_0x8fe8('0x10')]);return _0x2e6448(_0x57f0e1[_0x8fe8('0xf')][_0x8fe8('0x10')]);}else{logger[_0x8fe8('0xc')](_0x8fe8('0xd'),_0x2946d7,_0x8fe8('0x11'));_0x2e6448(_0x57f0e1['result'][_0x8fe8('0x10')]);}})['catch'](function(_0x4b55a7){logger[_0x8fe8('0xf')](_0x8fe8('0xd'),_0x2946d7,_0x4b55a7);_0x1c746b(_0x4b55a7);});});} \ No newline at end of file +var _0xe661=['message','result','catch','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','request','then','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0xe661,0x1f0));var _0x1e66=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xe661[_0x1facfa];return _0x9ec701;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1e66('0x0'))['db'];var utils=require(_0x1e66('0x1'));var logger=require(_0x1e66('0x2'))(_0x1e66('0x3'));var config=require(_0x1e66('0x4'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3f4312,_0x569a83,_0x564437){return new BPromise(function(_0x2eb142,_0x5376e6){return client[_0x1e66('0x5')](_0x3f4312,_0x564437)[_0x1e66('0x6')](function(_0xf3cff5){logger[_0x1e66('0x7')](_0x1e66('0x8'),_0x569a83,_0x1e66('0x9'));logger['debug'](_0x1e66('0xa'),_0x569a83,'request\x20sent',JSON[_0x1e66('0xb')](_0xf3cff5));if(_0xf3cff5['error']){if(_0xf3cff5[_0x1e66('0xc')][_0x1e66('0xd')]===0x1f4){logger[_0x1e66('0xc')](_0x1e66('0x8'),_0x569a83,_0xf3cff5['error'][_0x1e66('0xe')]);return _0x5376e6(_0xf3cff5[_0x1e66('0xc')]['message']);}logger[_0x1e66('0xc')](_0x1e66('0x8'),_0x569a83,_0xf3cff5[_0x1e66('0xc')]['message']);return _0x2eb142(_0xf3cff5[_0x1e66('0xc')]['message']);}else{logger[_0x1e66('0x7')](_0x1e66('0x8'),_0x569a83,_0x1e66('0x9'));_0x2eb142(_0xf3cff5[_0x1e66('0xf')][_0x1e66('0xe')]);}})[_0x1e66('0x10')](function(_0x2f5430){logger['error']('ChatProactiveAction,\x20%s,\x20%s',_0x569a83,_0x2f5430);_0x5376e6(_0x2f5430);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 66b9e99..a05d79b 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 _0xb574=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../config/environment','get','isAuthenticated','post','put'];(function(_0x6f976,_0x3a3fb4){var _0x587cb7=function(_0x358599){while(--_0x358599){_0x6f976['push'](_0x6f976['shift']());}};_0x587cb7(++_0x3a3fb4);}(_0xb574,0x17b));var _0x4b57=function(_0x26885c,_0x5aeb56){_0x26885c=_0x26885c-0x0;var _0x2067b4=_0xb574[_0x26885c];return _0x2067b4;};'use strict';var multer=require(_0x4b57('0x0'));var util=require(_0x4b57('0x1'));var path=require(_0x4b57('0x2'));var timeout=require(_0x4b57('0x3'));var express=require(_0x4b57('0x4'));var router=express[_0x4b57('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x4b57('0x6'));var controller=require('./chatProactiveAction.controller');router[_0x4b57('0x7')]('/:id',auth[_0x4b57('0x8')](),controller['show']);router[_0x4b57('0x9')]('/',auth['isAuthenticated'](),controller['create']);router[_0x4b57('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x4b57('0xb')]);router[_0x4b57('0xc')]('/:id',auth[_0x4b57('0x8')](),controller[_0x4b57('0xd')]);module[_0x4b57('0xe')]=router; \ No newline at end of file +var _0x83ad=['update','delete','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','get','isAuthenticated','show','post','/:id'];(function(_0x3fd455,_0x1f7c5b){var _0x1c259f=function(_0x2da88a){while(--_0x2da88a){_0x3fd455['push'](_0x3fd455['shift']());}};_0x1c259f(++_0x1f7c5b);}(_0x83ad,0x1df));var _0xd83a=function(_0x417b73,_0x4dc044){_0x417b73=_0x417b73-0x0;var _0x2ca8bc=_0x83ad[_0x417b73];return _0x2ca8bc;};'use strict';var multer=require(_0xd83a('0x0'));var util=require(_0xd83a('0x1'));var path=require(_0xd83a('0x2'));var timeout=require('connect-timeout');var express=require(_0xd83a('0x3'));var router=express[_0xd83a('0x4')]();var auth=require(_0xd83a('0x5'));var interaction=require(_0xd83a('0x6'));var config=require(_0xd83a('0x7'));var controller=require(_0xd83a('0x8'));router[_0xd83a('0x9')]('/:id',auth[_0xd83a('0xa')](),controller[_0xd83a('0xb')]);router[_0xd83a('0xc')]('/',auth[_0xd83a('0xa')](),controller['create']);router['put'](_0xd83a('0xd'),auth[_0xd83a('0xa')](),controller[_0xd83a('0xe')]);router[_0xd83a('0xf')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xd83a('0x10')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index b8388a7..20eec15 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 _0xdffe=['sequelize','exports','STRING','INTEGER','ENUM','rrmemory','beepall','roundrobin'];(function(_0x2ce709,_0x41ab1e){var _0x908e80=function(_0x1a6675){while(--_0x1a6675){_0x2ce709['push'](_0x2ce709['shift']());}};_0x908e80(++_0x41ab1e);}(_0xdffe,0x108));var _0xedff=function(_0x371b36,_0x8606f7){_0x371b36=_0x371b36-0x0;var _0x449638=_0xdffe[_0x371b36];return _0x449638;};'use strict';var Sequelize=require(_0xedff('0x0'));module[_0xedff('0x1')]={'name':{'type':Sequelize[_0xedff('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xedff('0x2')]},'timeout':{'type':Sequelize[_0xedff('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xedff('0x4')](_0xedff('0x5'),_0xedff('0x6'),_0xedff('0x7'))}}; \ No newline at end of file +var _0xd5be=['ENUM','beepall','exports','STRING','name','INTEGER'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xd5be,0x134));var _0xed5b=function(_0x35ea44,_0x314ac5){_0x35ea44=_0x35ea44-0x0;var _0x432f30=_0xd5be[_0x35ea44];return _0x432f30;};'use strict';var Sequelize=require('sequelize');module[_0xed5b('0x0')]={'name':{'type':Sequelize[_0xed5b('0x1')],'unique':_0xed5b('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xed5b('0x1')]},'timeout':{'type':Sequelize[_0xed5b('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xed5b('0x4')]('rrmemory',_0xed5b('0x5'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 4d8ad69..f083200 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 _0x6657=['merge','type','VIRTUAL','filter','options','includeAll','include','rows','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','getMembers','findOne','order','pick','ChatQueueId','UserChatQueue','User','findAndCountAll','UserId','chatPause','updatedAt','createdAt','format','%s/%s','getTeams','nolimit','addTeams','ids','Team','findAll','Agents','online','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userChatQueue:save','removeTeams','select','field','from','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','toString','SELECT','every','includes','all','union','compact','userChatQueue:remove','addAgents','omit','spread','removeAgents','isArray','getAgents','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','redis','localhost','./chatQueue.socket','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info','ChatQueue,\x20%s,\x20%s','request\x20sent','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','ChatQueues','name','send','index','map','ChatQueue','rawAttributes','fieldName','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','sort','where','filters'];(function(_0x336c02,_0x2d2355){var _0x4c8b60=function(_0x5b60c2){while(--_0x5b60c2){_0x336c02['push'](_0x336c02['shift']());}};_0x4c8b60(++_0x2d2355);}(_0x6657,0x17f));var _0x7665=function(_0x3b626c,_0x59535b){_0x3b626c=_0x3b626c-0x0;var _0x5274ef=_0x6657[_0x3b626c];return _0x5274ef;};'use strict';var pdf=require(_0x7665('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x7665('0x1'));var zipdir=require(_0x7665('0x2'));var jsonpatch=require(_0x7665('0x3'));var rp=require(_0x7665('0x4'));var moment=require('moment');var BPromise=require(_0x7665('0x5'));var Mustache=require(_0x7665('0x6'));var util=require(_0x7665('0x7'));var path=require(_0x7665('0x8'));var sox=require(_0x7665('0x9'));var csv=require(_0x7665('0xa'));var ejs=require(_0x7665('0xb'));var fs=require('fs');var _=require(_0x7665('0xc'));var squel=require('squel');var crypto=require(_0x7665('0xd'));var jsforce=require(_0x7665('0xe'));var deskjs=require(_0x7665('0xf'));var toCsv=require(_0x7665('0xa'));var querystring=require(_0x7665('0x10'));var Papa=require(_0x7665('0x11'));var Redis=require(_0x7665('0x12'));var authService=require(_0x7665('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x7665('0x14'));var hardwareService=require(_0x7665('0x15'));var logger=require(_0x7665('0x16'))('api');var utils=require(_0x7665('0x17'));var config=require('../../config/environment');var db=require(_0x7665('0x18'))['db'];config[_0x7665('0x19')]=_['defaults'](config[_0x7665('0x19')],{'host':_0x7665('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7665('0x19')]));require(_0x7665('0x1b'))['register'](socket);var jayson=require(_0x7665('0x1c'));var client=jayson[_0x7665('0x1d')][_0x7665('0x1e')]({'port':0x232a});function checkPasswordPattern(_0x3bc95e,_0x2719c0,_0x331d8c){if(_0x331d8c){var _0x308e5c=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x308e5c[_0x7665('0x1f')](_0x2719c0)){return _0x3bc95e;}else{throw new db[(_0x7665('0x20'))][(_0x7665('0x21'))](_0x7665('0x22'));}}else{return _0x3bc95e;}}function respondWithRpcPromise(_0xf730b0,_0x34dc39,_0x34e7a8,_0x2dab51){return new BPromise(function(_0xa3f5d4,_0x522944){var _0x30dedb=_0x2dab51||client;return _0x30dedb[_0x7665('0x23')](_0xf730b0,_0x34e7a8)['then'](function(_0x32b37a){logger[_0x7665('0x24')](_0x7665('0x25'),_0x34dc39,_0x7665('0x26'));logger['debug'](_0x7665('0x27'),_0x34dc39,_0x7665('0x26'),JSON[_0x7665('0x28')](_0x32b37a));if(_0x32b37a[_0x7665('0x29')]){if(_0x32b37a[_0x7665('0x29')]['code']===0x1f4){logger[_0x7665('0x29')]('ChatQueue,\x20%s,\x20%s',_0x34dc39,_0x32b37a[_0x7665('0x29')][_0x7665('0x2a')]);return _0x522944(_0x32b37a['error']['message']);}logger[_0x7665('0x29')](_0x7665('0x25'),_0x34dc39,_0x32b37a['error'][_0x7665('0x2a')]);return _0xa3f5d4(_0x32b37a[_0x7665('0x29')][_0x7665('0x2a')]);}else{logger['info']('ChatQueue,\x20%s,\x20%s',_0x34dc39,'request\x20sent');_0xa3f5d4(_0x32b37a['result'][_0x7665('0x2a')]);}})[_0x7665('0x2b')](function(_0x1129c1){logger['error'](_0x7665('0x25'),_0x34dc39,_0x1129c1);_0x522944(_0x1129c1);});});}function respondWithStatusCode(_0x383d06,_0x50bfa5){_0x50bfa5=_0x50bfa5||0xcc;return function(_0x56b6e8){if(_0x56b6e8){return _0x383d06[_0x7665('0x2c')](_0x50bfa5);}return _0x383d06[_0x7665('0x2d')](_0x50bfa5)[_0x7665('0x2e')]();};}function respondWithResult(_0x23e167,_0x240ee3){_0x240ee3=_0x240ee3||0xc8;return function(_0x3bcb70){if(_0x3bcb70){return _0x23e167['status'](_0x240ee3)[_0x7665('0x2f')](_0x3bcb70);}};}function respondWithFilteredResult(_0x55d046,_0x56d62c){return function(_0x634ebb){if(_0x634ebb){var _0x7425af=_0x634ebb[_0x7665('0x30')],_0x43797a=_0x56d62c[_0x7665('0x31')],_0x34476b=_0x56d62c[_0x7665('0x31')]+_0x56d62c[_0x7665('0x32')],_0x264b6e;if(_0x34476b>=_0x7425af){_0x34476b=_0x7425af;_0x264b6e=0xc8;}else{_0x264b6e=0xce;}_0x55d046[_0x7665('0x2d')](_0x264b6e);return _0x55d046[_0x7665('0x33')](_0x7665('0x34'),_0x43797a+'-'+_0x34476b+'/'+_0x7425af)[_0x7665('0x2f')](_0x634ebb);}return null;};}function patchUpdates(_0x3430a0){return function(_0x42ec7f){try{jsonpatch[_0x7665('0x35')](_0x42ec7f,_0x3430a0,!![]);}catch(_0x28be7c){return BPromise[_0x7665('0x36')](_0x28be7c);}return _0x42ec7f[_0x7665('0x37')]();};}function saveUpdates(_0x588a27,_0x17aec3){return function(_0xd93b75){if(_0xd93b75){return _0xd93b75[_0x7665('0x38')](_0x588a27)[_0x7665('0x39')](function(_0x2bf617){return _0x2bf617;});}return null;};}function removeEntity(_0x2e91f7,_0x4da120){return function(_0x3a7a39){if(_0x3a7a39){return _0x3a7a39[_0x7665('0x3a')]()[_0x7665('0x39')](function(){var _0x1899ad=_0x3a7a39[_0x7665('0x3b')]({'plain':!![]});var _0x495704=_0x7665('0x3c');return db['UserProfileResource'][_0x7665('0x3a')]({'where':{'type':_0x495704,'resourceId':_0x1899ad['id']}})['then'](function(){return _0x3a7a39;});})[_0x7665('0x39')](function(){_0x2e91f7[_0x7665('0x2d')](0xcc)[_0x7665('0x2e')]();});}};}function handleEntityNotFound(_0x2f03bb,_0x3eea5a){return function(_0x3c0ef1){if(!_0x3c0ef1){_0x2f03bb['sendStatus'](0x194);}return _0x3c0ef1;};}function handleError(_0x33f582,_0x3dfab1){_0x3dfab1=_0x3dfab1||0x1f4;return function(_0x99ff2f){logger[_0x7665('0x29')](_0x99ff2f['stack']);if(_0x99ff2f[_0x7665('0x3d')]){delete _0x99ff2f[_0x7665('0x3d')];}_0x33f582[_0x7665('0x2d')](_0x3dfab1)[_0x7665('0x3e')](_0x99ff2f);};}exports[_0x7665('0x3f')]=function(_0x5f4fbf,_0x16d694){var _0x341098={},_0x80529c={},_0x12e605={'count':0x0,'rows':[]};var _0xa67544=_[_0x7665('0x40')](db[_0x7665('0x41')][_0x7665('0x42')],function(_0x42777b){return{'name':_0x42777b[_0x7665('0x43')],'type':_0x42777b['type']['key']};});_0x80529c[_0x7665('0x44')]=_[_0x7665('0x40')](_0xa67544,'name');_0x80529c['query']=_[_0x7665('0x45')](_0x5f4fbf[_0x7665('0x46')]);_0x80529c['filters']=_[_0x7665('0x47')](_0x80529c[_0x7665('0x44')],_0x80529c[_0x7665('0x46')]);_0x341098[_0x7665('0x48')]=_[_0x7665('0x47')](_0x80529c[_0x7665('0x44')],qs[_0x7665('0x49')](_0x5f4fbf[_0x7665('0x46')][_0x7665('0x49')]));_0x341098[_0x7665('0x48')]=_0x341098[_0x7665('0x48')][_0x7665('0x4a')]?_0x341098[_0x7665('0x48')]:_0x80529c[_0x7665('0x44')];if(!_0x5f4fbf['query'][_0x7665('0x4b')]('nolimit')){_0x341098[_0x7665('0x32')]=qs[_0x7665('0x32')](_0x5f4fbf[_0x7665('0x46')][_0x7665('0x32')]);_0x341098[_0x7665('0x31')]=qs['offset'](_0x5f4fbf[_0x7665('0x46')][_0x7665('0x31')]);}_0x341098['order']=qs[_0x7665('0x4c')](_0x5f4fbf['query'][_0x7665('0x4c')]);_0x341098[_0x7665('0x4d')]=qs[_0x7665('0x4e')](_['pick'](_0x5f4fbf['query'],_0x80529c[_0x7665('0x4e')]));if(_0x5f4fbf[_0x7665('0x46')]['filter']){_0x341098[_0x7665('0x4d')]=_[_0x7665('0x4f')](_0x341098[_0x7665('0x4d')],{'$or':_[_0x7665('0x40')](_0xa67544,function(_0x2e38d1){if(_0x2e38d1[_0x7665('0x50')]!==_0x7665('0x51')){var _0x453904={};_0x453904[_0x2e38d1[_0x7665('0x3d')]]={'$like':'%'+_0x5f4fbf[_0x7665('0x46')][_0x7665('0x52')]+'%'};return _0x453904;}})});}_0x341098=_['merge']({},_0x341098,_0x5f4fbf[_0x7665('0x53')]);var _0x5a21ee={'where':_0x341098[_0x7665('0x4d')]};return db[_0x7665('0x41')][_0x7665('0x30')](_0x5a21ee)[_0x7665('0x39')](function(_0x543425){_0x12e605[_0x7665('0x30')]=_0x543425;if(_0x5f4fbf[_0x7665('0x46')][_0x7665('0x54')]){_0x341098[_0x7665('0x55')]=[{'all':!![]}];}return db[_0x7665('0x41')]['findAll'](_0x341098);})[_0x7665('0x39')](function(_0x5044ac){_0x12e605[_0x7665('0x56')]=_0x5044ac;return _0x12e605;})[_0x7665('0x39')](respondWithFilteredResult(_0x16d694,_0x341098))['catch'](handleError(_0x16d694,null));};exports['show']=function(_0x9d5c0b,_0x3b111f){var _0x4296c1={'raw':!![],'where':{'id':_0x9d5c0b['params']['id']}},_0x45c845={};_0x45c845['model']=_[_0x7665('0x45')](db['ChatQueue'][_0x7665('0x42')]);_0x45c845[_0x7665('0x46')]=_[_0x7665('0x45')](_0x9d5c0b['query']);_0x45c845[_0x7665('0x4e')]=_[_0x7665('0x47')](_0x45c845[_0x7665('0x44')],_0x45c845[_0x7665('0x46')]);_0x4296c1[_0x7665('0x48')]=_[_0x7665('0x47')](_0x45c845[_0x7665('0x44')],qs[_0x7665('0x49')](_0x9d5c0b[_0x7665('0x46')][_0x7665('0x49')]));_0x4296c1[_0x7665('0x48')]=_0x4296c1[_0x7665('0x48')][_0x7665('0x4a')]?_0x4296c1[_0x7665('0x48')]:_0x45c845['model'];if(_0x9d5c0b['query'][_0x7665('0x54')]){_0x4296c1[_0x7665('0x55')]=[{'all':!![]}];}_0x4296c1=_['merge']({},_0x4296c1,_0x9d5c0b['options']);return db['ChatQueue'][_0x7665('0x57')](_0x4296c1)[_0x7665('0x39')](handleEntityNotFound(_0x3b111f,null))[_0x7665('0x39')](respondWithResult(_0x3b111f,null))[_0x7665('0x2b')](handleError(_0x3b111f,null));};exports[_0x7665('0x58')]=function(_0x11137c,_0x36151b){return db[_0x7665('0x41')][_0x7665('0x58')](_0x11137c[_0x7665('0x59')],{})['then'](function(_0x49513c){var _0x21471d=_0x11137c[_0x7665('0x5a')][_0x7665('0x3b')]({'plain':!![]});if(!_0x21471d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x21471d[_0x7665('0x5b')]==='user'){var _0x17bbbe=_0x49513c[_0x7665('0x3b')]({'plain':!![]});var _0x3d056c=_0x7665('0x3c');return db[_0x7665('0x5c')][_0x7665('0x57')]({'where':{'name':_0x3d056c,'userProfileId':_0x21471d[_0x7665('0x5d')]},'raw':!![]})[_0x7665('0x39')](function(_0x3a6ce8){if(_0x3a6ce8&&_0x3a6ce8[_0x7665('0x5e')]===0x0){return db[_0x7665('0x5f')]['create']({'name':_0x17bbbe[_0x7665('0x3d')],'resourceId':_0x17bbbe['id'],'type':_0x3a6ce8[_0x7665('0x3d')],'sectionId':_0x3a6ce8['id']},{})[_0x7665('0x39')](function(){return _0x49513c;});}else{return _0x49513c;}})[_0x7665('0x2b')](function(_0x2f11bb){logger[_0x7665('0x29')](_0x7665('0x60'),_0x2f11bb);throw _0x2f11bb;});}return _0x49513c;})[_0x7665('0x39')](respondWithResult(_0x36151b,0xc9))['catch'](handleError(_0x36151b,null));};exports['update']=function(_0x7d8623,_0x2c5896){if(_0x7d8623[_0x7665('0x59')]['id']){delete _0x7d8623[_0x7665('0x59')]['id'];}return db[_0x7665('0x41')][_0x7665('0x57')]({'where':{'id':_0x7d8623['params']['id']}})[_0x7665('0x39')](handleEntityNotFound(_0x2c5896,null))[_0x7665('0x39')](saveUpdates(_0x7d8623[_0x7665('0x59')],null))[_0x7665('0x39')](respondWithResult(_0x2c5896,null))[_0x7665('0x2b')](handleError(_0x2c5896,null));};exports[_0x7665('0x3a')]=function(_0x59c97b,_0x345dbd){return db[_0x7665('0x41')][_0x7665('0x57')]({'where':{'id':_0x59c97b[_0x7665('0x61')]['id']}})['then'](handleEntityNotFound(_0x345dbd,null))[_0x7665('0x39')](removeEntity(_0x345dbd,null))[_0x7665('0x2b')](handleError(_0x345dbd,null));};exports[_0x7665('0x62')]=function(_0x5c0469,_0x41e903){return db['ChatQueue'][_0x7665('0x62')]()[_0x7665('0x39')](respondWithResult(_0x41e903,null))['catch'](handleError(_0x41e903,null));};exports[_0x7665('0x63')]=function(_0x58c138,_0x295197,_0x35d4ea){var _0x59403b={'raw':!![],'where':{}},_0x2af15f={},_0x4d4b4b;return db['ChatQueue'][_0x7665('0x64')]({'where':{'id':_0x58c138[_0x7665('0x61')]['id']}})['then'](handleEntityNotFound(_0x295197,null))['then'](function(_0x3fe1ab){if(_0x3fe1ab){_0x4d4b4b=_0x3fe1ab['get']({'plain':!![]});_0x2af15f[_0x7665('0x44')]=_[_0x7665('0x45')](db['UserChatQueue']['rawAttributes']);_0x2af15f[_0x7665('0x46')]=_[_0x7665('0x45')](_0x58c138[_0x7665('0x46')]);_0x2af15f[_0x7665('0x4e')]=_[_0x7665('0x47')](_0x2af15f[_0x7665('0x44')],_0x2af15f[_0x7665('0x46')]);_0x59403b['attributes']=_[_0x7665('0x47')](_0x2af15f[_0x7665('0x44')],qs[_0x7665('0x49')](_0x58c138[_0x7665('0x46')][_0x7665('0x49')]));_0x59403b[_0x7665('0x48')]=_0x59403b[_0x7665('0x48')]['length']?_0x59403b['attributes']:_0x2af15f[_0x7665('0x44')];if(!_0x58c138['query'][_0x7665('0x4b')]('nolimit')){_0x59403b[_0x7665('0x32')]=qs[_0x7665('0x32')](_0x58c138[_0x7665('0x46')]['limit']);_0x59403b[_0x7665('0x31')]=qs[_0x7665('0x31')](_0x58c138['query']['offset']);}_0x59403b[_0x7665('0x65')]=qs[_0x7665('0x4c')](_0x58c138[_0x7665('0x46')][_0x7665('0x4c')]);_0x59403b[_0x7665('0x4d')]=qs[_0x7665('0x4e')](_[_0x7665('0x66')](_0x58c138[_0x7665('0x46')],_0x2af15f['filters']));_0x59403b['where'][_0x7665('0x67')]=_0x3fe1ab['id'];if(_0x58c138[_0x7665('0x46')]['filter']){_0x59403b[_0x7665('0x4d')]=_['merge'](_0x59403b['where'],{'$or':_[_0x7665('0x40')](_0x59403b[_0x7665('0x48')],function(_0x3fd193){var _0x1a6ffa={};_0x1a6ffa[_0x3fd193]={'$like':'%'+_0x58c138[_0x7665('0x46')]['filter']+'%'};return _0x1a6ffa;})});}_0x59403b=_['merge']({},_0x59403b,_0x58c138['options']);return db[_0x7665('0x68')]['findAll'](_0x59403b);}})[_0x7665('0x39')](function(_0x5f5af2){if(_0x5f5af2){return db[_0x7665('0x69')][_0x7665('0x6a')]({'where':{'id':_[_0x7665('0x40')](_0x5f5af2,_0x7665('0x6b')),'role':'agent'},'attributes':['id','name',_0x7665('0x6c'),_0x7665('0x6d'),_0x7665('0x6e')]});}})[_0x7665('0x39')](function(_0x3b9fd9){if(_0x3b9fd9){return{'count':_0x3b9fd9[_0x7665('0x30')],'rows':_[_0x7665('0x40')](_0x3b9fd9[_0x7665('0x56')],function(_0x29e238){return{'membername':_0x29e238[_0x7665('0x3d')],'UserId':_0x29e238['id'],'queue_name':_0x4d4b4b['name'],'ChatQueueId':_0x4d4b4b['id'],'interface':util[_0x7665('0x6f')](_0x7665('0x70'),'SIP',_0x29e238[_0x7665('0x3d')]),'penalty':0x0,'paused':_0x29e238['chatPause'],'createdAt':_0x29e238['createdAt'],'updatedAt':_0x29e238['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x295197,_0x59403b))['catch'](handleError(_0x295197,null));};exports[_0x7665('0x71')]=function(_0x39408b,_0x506c71,_0x2d6309){var _0xd98de7={};var _0x291e43={};var _0x253763;var _0x4a51e3;return db[_0x7665('0x41')][_0x7665('0x64')]({'where':{'id':_0x39408b['params']['id']}})[_0x7665('0x39')](handleEntityNotFound(_0x506c71,null))[_0x7665('0x39')](function(_0x3b6cba){if(_0x3b6cba){_0x253763=_0x3b6cba;_0x291e43['model']=_[_0x7665('0x45')](db['Team']['rawAttributes']);_0x291e43[_0x7665('0x46')]=_[_0x7665('0x45')](_0x39408b[_0x7665('0x46')]);_0x291e43[_0x7665('0x4e')]=_['intersection'](_0x291e43[_0x7665('0x44')],_0x291e43[_0x7665('0x46')]);_0xd98de7[_0x7665('0x48')]=_[_0x7665('0x47')](_0x291e43[_0x7665('0x44')],qs[_0x7665('0x49')](_0x39408b[_0x7665('0x46')][_0x7665('0x49')]));_0xd98de7[_0x7665('0x48')]=_0xd98de7[_0x7665('0x48')][_0x7665('0x4a')]?_0xd98de7[_0x7665('0x48')]:_0x291e43[_0x7665('0x44')];_0xd98de7[_0x7665('0x65')]=qs['sort'](_0x39408b[_0x7665('0x46')][_0x7665('0x4c')]);_0xd98de7[_0x7665('0x4d')]=qs[_0x7665('0x4e')](_['pick'](_0x39408b[_0x7665('0x46')],_0x291e43[_0x7665('0x4e')]));if(_0x39408b['query'][_0x7665('0x52')]){_0xd98de7[_0x7665('0x4d')]=_['merge'](_0xd98de7[_0x7665('0x4d')],{'$or':_[_0x7665('0x40')](_0xd98de7[_0x7665('0x48')],function(_0x4b6fc7){var _0xd8a3f6={};_0xd8a3f6[_0x4b6fc7]={'$like':'%'+_0x39408b[_0x7665('0x46')][_0x7665('0x52')]+'%'};return _0xd8a3f6;})});}_0xd98de7=_[_0x7665('0x4f')]({},_0xd98de7,_0x39408b['options']);return _0x253763[_0x7665('0x71')](_0xd98de7);}})[_0x7665('0x39')](function(_0x509904){if(_0x509904){_0x4a51e3=_0x509904[_0x7665('0x4a')];if(!_0x39408b[_0x7665('0x46')][_0x7665('0x4b')](_0x7665('0x72'))){_0xd98de7[_0x7665('0x32')]=qs['limit'](_0x39408b[_0x7665('0x46')][_0x7665('0x32')]);_0xd98de7[_0x7665('0x31')]=qs[_0x7665('0x31')](_0x39408b['query'][_0x7665('0x31')]);}return _0x253763['getTeams'](_0xd98de7);}})[_0x7665('0x39')](function(_0x4f3a38){if(_0x4f3a38){return _0x4f3a38?{'count':_0x4a51e3,'rows':_0x4f3a38}:null;}})[_0x7665('0x39')](respondWithResult(_0x506c71,null))[_0x7665('0x2b')](handleError(_0x506c71,null));};exports[_0x7665('0x73')]=function(_0x1ff3ed,_0x1986cf,_0xb074a7){var _0x2e6c4b=_0x1ff3ed[_0x7665('0x59')][_0x7665('0x74')];return db[_0x7665('0x75')][_0x7665('0x76')]({'where':{'id':_0x2e6c4b},'attributes':['id'],'include':[{'model':db[_0x7665('0x69')],'as':_0x7665('0x77'),'attributes':['id','name',_0x7665('0x78'),'voicePause','interface'],'raw':!![]}]})[_0x7665('0x39')](function(_0x15ef32){if(_0x15ef32){var _0x2c125f=_[_0x7665('0x79')](_0x15ef32,function(_0x1a1729){var _0x1e617f=_0x1a1729[_0x7665('0x3b')]({'plain':!![]});return _0x1e617f[_0x7665('0x77')];});return db[_0x7665('0x41')]['find']({'where':{'id':_0x1ff3ed[_0x7665('0x61')]['id']}})[_0x7665('0x39')](function(_0x3a5993){return db[_0x7665('0x7a')][_0x7665('0x7b')](function(_0x442d83){return _0x3a5993['addTeams'](_0x2e6c4b,{'transaction':_0x442d83})[_0x7665('0x39')](function(){return BPromise[_0x7665('0x7c')](_0x2c125f,function(_0x22867d){return db[_0x7665('0x68')][_0x7665('0x7d')]({'where':{'UserId':_0x22867d['id'],'ChatQueueId':_0x1ff3ed[_0x7665('0x61')]['id']},'transaction':_0x442d83});});})['then'](function(){_0x2c125f[_0x7665('0x7e')](function(_0x6949dc){socket[_0x7665('0x7f')](_0x7665('0x80'),{'UserId':_0x6949dc['id'],'ChatQueueId':_0x3a5993['id']});});});});});}})[_0x7665('0x39')](respondWithStatusCode(_0x1986cf,null))[_0x7665('0x2b')](handleError(_0x1986cf,null));};exports[_0x7665('0x81')]=function(_0x3992ff,_0x3c7306,_0x132170){return db[_0x7665('0x75')]['findAll']({'where':{'id':_0x3992ff[_0x7665('0x46')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0x7665('0x77'),'attributes':['id'],'raw':!![]}]})[_0x7665('0x39')](handleEntityNotFound(_0x3c7306,null))[_0x7665('0x39')](function(_0x3817e8){var _0x2c4204=_[_0x7665('0x40')](_0x3817e8,'id');var _0x2b36c0=[];var _0xe6c095=[];var _0x23a3a9=squel[_0x7665('0x82')]();_0x23a3a9[_0x7665('0x83')]('tq.TeamId')[_0x7665('0x84')](_0x7665('0x85'),'tq')[_0x7665('0x86')](_0x7665('0x87'),'ut',_0x7665('0x88'))['where']('ChatQueueId\x20=\x20?',_0x3992ff[_0x7665('0x61')]['id']);for(var _0x5a4701=0x0;_0x5a4701<_0x3817e8[_0x7665('0x4a')];_0x5a4701+=0x1){let _0x1971fc=_0x3817e8[_0x5a4701];for(var _0x5a9413=0x0;_0x5a9413<_0x1971fc[_0x7665('0x77')][_0x7665('0x4a')];_0x5a9413+=0x1){let _0x523d9b=_0x1971fc[_0x7665('0x77')][_0x5a9413];var _0x275a1e=_0x23a3a9[_0x7665('0x89')]();_0x275a1e[_0x7665('0x4d')](_0x7665('0x8a'),_0x523d9b['id']);_0xe6c095[_0x7665('0x8b')](db['sequelize'][_0x7665('0x46')](_0x275a1e[_0x7665('0x8c')](),{'type':db[_0x7665('0x7a')]['QueryTypes'][_0x7665('0x8d')]})[_0x7665('0x39')](function(_0x4f20f4){if(_0x4f20f4[_0x7665('0x4a')]===0x1){return _0x523d9b['id'];}else{var _0x182657=_[_0x7665('0x8e')](_['map'](_0x4f20f4,'TeamId'),function(_0x530132){return _[_0x7665('0x8f')](_0x2c4204,_0x530132);});if(_0x182657){return _0x523d9b['id'];}}}));}}return BPromise[_0x7665('0x90')](_0xe6c095)[_0x7665('0x39')](function(_0x3f2e83){_0x2b36c0=_(_0x2b36c0)[_0x7665('0x91')](_0x3f2e83)[_0x7665('0x92')]()['value']();return db[_0x7665('0x41')][_0x7665('0x57')]({'where':{'id':_0x3992ff['params']['id']}})[_0x7665('0x39')](function(_0xde8c1){return db['sequelize']['transaction'](function(_0x2fbb83){return _0xde8c1[_0x7665('0x81')](_0x3992ff[_0x7665('0x46')][_0x7665('0x74')],{'transaction':_0x2fbb83})[_0x7665('0x39')](function(){if(!_['isEmpty'](_0x2b36c0)){return _0xde8c1['removeAgents'](_0x2b36c0,{'transaction':_0x2fbb83});}})[_0x7665('0x39')](function(){_0x2b36c0[_0x7665('0x7e')](function(_0x188c1a){socket['emit'](_0x7665('0x93'),{'UserId':_0x188c1a,'ChatQueueId':_0xde8c1['id']});});});});});});})[_0x7665('0x39')](respondWithStatusCode(_0x3c7306,null))[_0x7665('0x2b')](handleError(_0x3c7306,null));};exports[_0x7665('0x94')]=function(_0x940d64,_0x5831af,_0x55fc37){return db[_0x7665('0x41')]['find']({'where':{'id':_0x940d64[_0x7665('0x61')]['id']}})[_0x7665('0x39')](handleEntityNotFound(_0x5831af,null))[_0x7665('0x39')](function(_0x215037){if(_0x215037){return _0x215037[_0x7665('0x94')](_0x940d64['body'][_0x7665('0x74')],_[_0x7665('0x95')](_0x940d64[_0x7665('0x59')],[_0x7665('0x74'),'id'])||{})[_0x7665('0x96')](function(_0x1d8394){for(var _0x51da59=0x0;_0x51da59<_0x940d64['body']['ids'][_0x7665('0x4a')];_0x51da59+=0x1){socket[_0x7665('0x7f')](_0x7665('0x80'),{'UserId':_0x940d64[_0x7665('0x59')][_0x7665('0x74')][_0x51da59],'ChatQueueId':_0x940d64[_0x7665('0x61')]['id']});}return _0x1d8394;});}})[_0x7665('0x39')](respondWithResult(_0x5831af,null))[_0x7665('0x2b')](handleError(_0x5831af,null));};exports[_0x7665('0x97')]=function(_0x168ff9,_0x3d25d8,_0x324a6f){return db[_0x7665('0x41')][_0x7665('0x57')]({'where':{'id':_0x168ff9[_0x7665('0x61')]['id']}})[_0x7665('0x39')](handleEntityNotFound(_0x3d25d8,null))[_0x7665('0x39')](function(_0x245c6d){if(_0x245c6d){return _0x245c6d[_0x7665('0x97')](_0x168ff9[_0x7665('0x46')][_0x7665('0x74')])[_0x7665('0x39')](function(){if(_[_0x7665('0x98')](_0x168ff9[_0x7665('0x46')][_0x7665('0x74')])){for(var _0x4d93ef=0x0;_0x4d93ef<_0x168ff9['query']['ids']['length'];_0x4d93ef+=0x1){socket[_0x7665('0x7f')](_0x7665('0x93'),{'UserId':Number(_0x168ff9[_0x7665('0x46')][_0x7665('0x74')][_0x4d93ef]),'ChatQueueId':Number(_0x168ff9['params']['id'])});}}else{socket[_0x7665('0x7f')](_0x7665('0x93'),{'UserId':Number(_0x168ff9[_0x7665('0x46')]['ids']),'ChatQueueId':Number(_0x168ff9[_0x7665('0x61')]['id'])});}});}})[_0x7665('0x39')](respondWithStatusCode(_0x3d25d8,null))[_0x7665('0x2b')](handleError(_0x3d25d8,null));};exports[_0x7665('0x99')]=function(_0x3d46e1,_0x1776d5,_0x2a42a2){var _0x5469b0={};var _0x4cb2b8={};var _0x5ec428;var _0x4f0c08;return db[_0x7665('0x41')][_0x7665('0x64')]({'where':{'id':_0x3d46e1[_0x7665('0x61')]['id']}})[_0x7665('0x39')](handleEntityNotFound(_0x1776d5,null))[_0x7665('0x39')](function(_0x212273){if(_0x212273){_0x5ec428=_0x212273;_0x4cb2b8[_0x7665('0x44')]=_[_0x7665('0x45')](db['User'][_0x7665('0x42')]);_0x4cb2b8[_0x7665('0x46')]=_[_0x7665('0x45')](_0x3d46e1[_0x7665('0x46')]);_0x4cb2b8[_0x7665('0x4e')]=_[_0x7665('0x47')](_0x4cb2b8[_0x7665('0x44')],_0x4cb2b8[_0x7665('0x46')]);_0x5469b0[_0x7665('0x48')]=_[_0x7665('0x47')](_0x4cb2b8[_0x7665('0x44')],qs['fields'](_0x3d46e1[_0x7665('0x46')][_0x7665('0x49')]));_0x5469b0[_0x7665('0x48')]=_0x5469b0[_0x7665('0x48')]['length']?_0x5469b0[_0x7665('0x48')]:_0x4cb2b8['model'];_0x5469b0[_0x7665('0x65')]=qs[_0x7665('0x4c')](_0x3d46e1[_0x7665('0x46')][_0x7665('0x4c')]);_0x5469b0[_0x7665('0x4d')]=qs[_0x7665('0x4e')](_[_0x7665('0x66')](_0x3d46e1[_0x7665('0x46')],_0x4cb2b8[_0x7665('0x4e')]));if(_0x3d46e1[_0x7665('0x46')]['filter']){_0x5469b0[_0x7665('0x4d')]=_[_0x7665('0x4f')](_0x5469b0['where'],{'$or':_[_0x7665('0x40')](_0x5469b0['attributes'],function(_0x7b321b){var _0x16c86f={};_0x16c86f[_0x7b321b]={'$like':'%'+_0x3d46e1[_0x7665('0x46')][_0x7665('0x52')]+'%'};return _0x16c86f;})});}_0x5469b0=_['merge']({},_0x5469b0,_0x3d46e1[_0x7665('0x53')]);return _0x5ec428[_0x7665('0x99')](_0x5469b0);}})[_0x7665('0x39')](function(_0x208965){if(_0x208965){_0x4f0c08=_0x208965[_0x7665('0x4a')];if(!_0x3d46e1['query'][_0x7665('0x4b')](_0x7665('0x72'))){_0x5469b0[_0x7665('0x32')]=qs[_0x7665('0x32')](_0x3d46e1[_0x7665('0x46')][_0x7665('0x32')]);_0x5469b0[_0x7665('0x31')]=qs[_0x7665('0x31')](_0x3d46e1[_0x7665('0x46')][_0x7665('0x31')]);}return _0x5ec428[_0x7665('0x99')](_0x5469b0);}})[_0x7665('0x39')](function(_0x8e1a92){if(_0x8e1a92){return _0x8e1a92?{'count':_0x4f0c08,'rows':_0x8e1a92}:null;}})[_0x7665('0x39')](respondWithResult(_0x1776d5,null))[_0x7665('0x2b')](handleError(_0x1776d5,null));}; \ No newline at end of file +var _0xcd05=['UserChatQueue','length','ChatQueueId','findAndCountAll','UserId','agent','chatPause','updatedAt','createdAt','SIP','getTeams','addTeams','ids','Team','User','Agents','online','voicePause','interface','flatMap','transaction','findOrCreate','forEach','emit','removeTeams','select','tq.TeamId','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','toString','SELECT','every','TeamId','all','union','value','isEmpty','addAgents','omit','spread','removeAgents','isArray','userChatQueue:remove','getAgents','html-pdf','fast-json-patch','request-promise','moment','bluebird','util','path','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','jayson/promise','client','test','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','end','json','count','offset','limit','set','Content-Range','save','ChatQueues','UserProfileResource','destroy','sendStatus','stack','name','send','index','map','ChatQueue','fieldName','key','query','keys','intersection','attributes','model','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','type','VIRTUAL','merge','options','include','findAll','rows','show','params','rawAttributes','fields','includeAll','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getMembers','findOne'];(function(_0x2afaf3,_0x4ebf7a){var _0xf45003=function(_0x1db360){while(--_0x1db360){_0x2afaf3['push'](_0x2afaf3['shift']());}};_0xf45003(++_0x4ebf7a);}(_0xcd05,0x163));var _0x5cd0=function(_0x406115,_0x19f7a1){_0x406115=_0x406115-0x0;var _0xbbabdb=_0xcd05[_0x406115];return _0xbbabdb;};'use strict';var pdf=require(_0x5cd0('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x5cd0('0x1'));var rp=require(_0x5cd0('0x2'));var moment=require(_0x5cd0('0x3'));var BPromise=require(_0x5cd0('0x4'));var Mustache=require('mustache');var util=require(_0x5cd0('0x5'));var path=require(_0x5cd0('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x5cd0('0x7'));var squel=require(_0x5cd0('0x8'));var crypto=require(_0x5cd0('0x9'));var jsforce=require(_0x5cd0('0xa'));var deskjs=require(_0x5cd0('0xb'));var toCsv=require(_0x5cd0('0xc'));var querystring=require(_0x5cd0('0xd'));var Papa=require('papaparse');var Redis=require(_0x5cd0('0xe'));var authService=require(_0x5cd0('0xf'));var qs=require(_0x5cd0('0x10'));var as=require(_0x5cd0('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5cd0('0x12'))(_0x5cd0('0x13'));var utils=require(_0x5cd0('0x14'));var config=require(_0x5cd0('0x15'));var db=require(_0x5cd0('0x16'))['db'];config[_0x5cd0('0x17')]=_[_0x5cd0('0x18')](config[_0x5cd0('0x17')],{'host':_0x5cd0('0x19'),'port':0x18eb});var socket=require(_0x5cd0('0x1a'))(new Redis(config['redis']));require('./chatQueue.socket')['register'](socket);var jayson=require(_0x5cd0('0x1b'));var client=jayson[_0x5cd0('0x1c')]['http']({'port':0x232a});function checkPasswordPattern(_0x170f58,_0x5b1d94,_0x2991d2){if(_0x2991d2){var _0xd1d12b=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xd1d12b[_0x5cd0('0x1d')](_0x5b1d94)){return _0x170f58;}else{throw new db['Sequelize']['ValidationError'](_0x5cd0('0x1e'));}}else{return _0x170f58;}}function respondWithRpcPromise(_0x1f84ef,_0x156947,_0x49577b,_0x57d81d){return new BPromise(function(_0x4b7dac,_0x1847dd){var _0x106c1e=_0x57d81d||client;return _0x106c1e['request'](_0x1f84ef,_0x49577b)[_0x5cd0('0x1f')](function(_0x19554c){logger[_0x5cd0('0x20')](_0x5cd0('0x21'),_0x156947,_0x5cd0('0x22'));logger[_0x5cd0('0x23')](_0x5cd0('0x24'),_0x156947,_0x5cd0('0x22'),JSON[_0x5cd0('0x25')](_0x19554c));if(_0x19554c[_0x5cd0('0x26')]){if(_0x19554c[_0x5cd0('0x26')][_0x5cd0('0x27')]===0x1f4){logger[_0x5cd0('0x26')](_0x5cd0('0x21'),_0x156947,_0x19554c['error']['message']);return _0x1847dd(_0x19554c[_0x5cd0('0x26')]['message']);}logger[_0x5cd0('0x26')](_0x5cd0('0x21'),_0x156947,_0x19554c[_0x5cd0('0x26')][_0x5cd0('0x28')]);return _0x4b7dac(_0x19554c[_0x5cd0('0x26')][_0x5cd0('0x28')]);}else{logger[_0x5cd0('0x20')]('ChatQueue,\x20%s,\x20%s',_0x156947,'request\x20sent');_0x4b7dac(_0x19554c[_0x5cd0('0x29')][_0x5cd0('0x28')]);}})[_0x5cd0('0x2a')](function(_0x189fa8){logger['error'](_0x5cd0('0x21'),_0x156947,_0x189fa8);_0x1847dd(_0x189fa8);});});}function respondWithStatusCode(_0x14ab5c,_0x364d53){_0x364d53=_0x364d53||0xcc;return function(_0x53a6cf){if(_0x53a6cf){return _0x14ab5c['sendStatus'](_0x364d53);}return _0x14ab5c[_0x5cd0('0x2b')](_0x364d53)[_0x5cd0('0x2c')]();};}function respondWithResult(_0x5a2123,_0x246525){_0x246525=_0x246525||0xc8;return function(_0x4020d1){if(_0x4020d1){return _0x5a2123[_0x5cd0('0x2b')](_0x246525)[_0x5cd0('0x2d')](_0x4020d1);}};}function respondWithFilteredResult(_0x3c80d1,_0x243d2e){return function(_0x31b9d1){if(_0x31b9d1){var _0x55b7a9=_0x31b9d1[_0x5cd0('0x2e')],_0x412f1e=_0x243d2e[_0x5cd0('0x2f')],_0x1621f9=_0x243d2e[_0x5cd0('0x2f')]+_0x243d2e[_0x5cd0('0x30')],_0x1b88ac;if(_0x1621f9>=_0x55b7a9){_0x1621f9=_0x55b7a9;_0x1b88ac=0xc8;}else{_0x1b88ac=0xce;}_0x3c80d1[_0x5cd0('0x2b')](_0x1b88ac);return _0x3c80d1[_0x5cd0('0x31')](_0x5cd0('0x32'),_0x412f1e+'-'+_0x1621f9+'/'+_0x55b7a9)['json'](_0x31b9d1);}return null;};}function patchUpdates(_0x107abf){return function(_0x3fb346){try{jsonpatch['apply'](_0x3fb346,_0x107abf,!![]);}catch(_0x46c808){return BPromise['reject'](_0x46c808);}return _0x3fb346[_0x5cd0('0x33')]();};}function saveUpdates(_0x1f4613,_0x4c7c97){return function(_0x42974c){if(_0x42974c){return _0x42974c['update'](_0x1f4613)[_0x5cd0('0x1f')](function(_0x28a69f){return _0x28a69f;});}return null;};}function removeEntity(_0xa1b351,_0x570ed5){return function(_0x392d90){if(_0x392d90){return _0x392d90['destroy']()[_0x5cd0('0x1f')](function(){var _0x1a4855=_0x392d90['get']({'plain':!![]});var _0x3c42de=_0x5cd0('0x34');return db[_0x5cd0('0x35')][_0x5cd0('0x36')]({'where':{'type':_0x3c42de,'resourceId':_0x1a4855['id']}})[_0x5cd0('0x1f')](function(){return _0x392d90;});})['then'](function(){_0xa1b351['status'](0xcc)[_0x5cd0('0x2c')]();});}};}function handleEntityNotFound(_0x445a08,_0x4ea62f){return function(_0x158539){if(!_0x158539){_0x445a08[_0x5cd0('0x37')](0x194);}return _0x158539;};}function handleError(_0x306b97,_0x44360b){_0x44360b=_0x44360b||0x1f4;return function(_0xcc93d2){logger['error'](_0xcc93d2[_0x5cd0('0x38')]);if(_0xcc93d2[_0x5cd0('0x39')]){delete _0xcc93d2[_0x5cd0('0x39')];}_0x306b97[_0x5cd0('0x2b')](_0x44360b)[_0x5cd0('0x3a')](_0xcc93d2);};}exports[_0x5cd0('0x3b')]=function(_0x3e8caa,_0x1dc8e4){var _0xd12dfa={},_0x149a94={},_0x33a3aa={'count':0x0,'rows':[]};var _0xd84453=_[_0x5cd0('0x3c')](db[_0x5cd0('0x3d')]['rawAttributes'],function(_0x48c7e9){return{'name':_0x48c7e9[_0x5cd0('0x3e')],'type':_0x48c7e9['type'][_0x5cd0('0x3f')]};});_0x149a94['model']=_[_0x5cd0('0x3c')](_0xd84453,_0x5cd0('0x39'));_0x149a94[_0x5cd0('0x40')]=_[_0x5cd0('0x41')](_0x3e8caa[_0x5cd0('0x40')]);_0x149a94['filters']=_[_0x5cd0('0x42')](_0x149a94['model'],_0x149a94['query']);_0xd12dfa[_0x5cd0('0x43')]=_[_0x5cd0('0x42')](_0x149a94[_0x5cd0('0x44')],qs['fields'](_0x3e8caa[_0x5cd0('0x40')]['fields']));_0xd12dfa[_0x5cd0('0x43')]=_0xd12dfa['attributes']['length']?_0xd12dfa[_0x5cd0('0x43')]:_0x149a94[_0x5cd0('0x44')];if(!_0x3e8caa[_0x5cd0('0x40')][_0x5cd0('0x45')](_0x5cd0('0x46'))){_0xd12dfa['limit']=qs[_0x5cd0('0x30')](_0x3e8caa[_0x5cd0('0x40')][_0x5cd0('0x30')]);_0xd12dfa[_0x5cd0('0x2f')]=qs['offset'](_0x3e8caa[_0x5cd0('0x40')][_0x5cd0('0x2f')]);}_0xd12dfa[_0x5cd0('0x47')]=qs[_0x5cd0('0x48')](_0x3e8caa[_0x5cd0('0x40')]['sort']);_0xd12dfa[_0x5cd0('0x49')]=qs[_0x5cd0('0x4a')](_[_0x5cd0('0x4b')](_0x3e8caa[_0x5cd0('0x40')],_0x149a94[_0x5cd0('0x4a')]));if(_0x3e8caa['query'][_0x5cd0('0x4c')]){_0xd12dfa[_0x5cd0('0x49')]=_['merge'](_0xd12dfa['where'],{'$or':_[_0x5cd0('0x3c')](_0xd84453,function(_0x455792){if(_0x455792[_0x5cd0('0x4d')]!==_0x5cd0('0x4e')){var _0xa01ab={};_0xa01ab[_0x455792['name']]={'$like':'%'+_0x3e8caa['query'][_0x5cd0('0x4c')]+'%'};return _0xa01ab;}})});}_0xd12dfa=_[_0x5cd0('0x4f')]({},_0xd12dfa,_0x3e8caa[_0x5cd0('0x50')]);var _0x49ba84={'where':_0xd12dfa[_0x5cd0('0x49')]};return db['ChatQueue'][_0x5cd0('0x2e')](_0x49ba84)[_0x5cd0('0x1f')](function(_0x2f2a70){_0x33a3aa['count']=_0x2f2a70;if(_0x3e8caa[_0x5cd0('0x40')]['includeAll']){_0xd12dfa[_0x5cd0('0x51')]=[{'all':!![]}];}return db[_0x5cd0('0x3d')][_0x5cd0('0x52')](_0xd12dfa);})[_0x5cd0('0x1f')](function(_0x4b0b86){_0x33a3aa[_0x5cd0('0x53')]=_0x4b0b86;return _0x33a3aa;})['then'](respondWithFilteredResult(_0x1dc8e4,_0xd12dfa))[_0x5cd0('0x2a')](handleError(_0x1dc8e4,null));};exports[_0x5cd0('0x54')]=function(_0x1ba52e,_0x15f300){var _0x5692b9={'raw':!![],'where':{'id':_0x1ba52e[_0x5cd0('0x55')]['id']}},_0x1c36fc={};_0x1c36fc['model']=_['keys'](db[_0x5cd0('0x3d')][_0x5cd0('0x56')]);_0x1c36fc[_0x5cd0('0x40')]=_[_0x5cd0('0x41')](_0x1ba52e['query']);_0x1c36fc[_0x5cd0('0x4a')]=_[_0x5cd0('0x42')](_0x1c36fc[_0x5cd0('0x44')],_0x1c36fc[_0x5cd0('0x40')]);_0x5692b9[_0x5cd0('0x43')]=_[_0x5cd0('0x42')](_0x1c36fc[_0x5cd0('0x44')],qs[_0x5cd0('0x57')](_0x1ba52e[_0x5cd0('0x40')][_0x5cd0('0x57')]));_0x5692b9['attributes']=_0x5692b9[_0x5cd0('0x43')]['length']?_0x5692b9[_0x5cd0('0x43')]:_0x1c36fc[_0x5cd0('0x44')];if(_0x1ba52e[_0x5cd0('0x40')][_0x5cd0('0x58')]){_0x5692b9[_0x5cd0('0x51')]=[{'all':!![]}];}_0x5692b9=_['merge']({},_0x5692b9,_0x1ba52e[_0x5cd0('0x50')]);return db[_0x5cd0('0x3d')]['find'](_0x5692b9)[_0x5cd0('0x1f')](handleEntityNotFound(_0x15f300,null))['then'](respondWithResult(_0x15f300,null))[_0x5cd0('0x2a')](handleError(_0x15f300,null));};exports['create']=function(_0x57cdc5,_0x4c292f){return db[_0x5cd0('0x3d')][_0x5cd0('0x59')](_0x57cdc5[_0x5cd0('0x5a')],{})[_0x5cd0('0x1f')](function(_0x4b2e2e){var _0x141c21=_0x57cdc5[_0x5cd0('0x5b')][_0x5cd0('0x5c')]({'plain':!![]});if(!_0x141c21)throw new Error(_0x5cd0('0x5d'));if(_0x141c21[_0x5cd0('0x5e')]===_0x5cd0('0x5b')){var _0x30a5b5=_0x4b2e2e['get']({'plain':!![]});var _0x3e1ad4=_0x5cd0('0x34');return db[_0x5cd0('0x5f')][_0x5cd0('0x60')]({'where':{'name':_0x3e1ad4,'userProfileId':_0x141c21[_0x5cd0('0x61')]},'raw':!![]})[_0x5cd0('0x1f')](function(_0x40b928){if(_0x40b928&&_0x40b928['autoAssociation']===0x0){return db[_0x5cd0('0x35')][_0x5cd0('0x59')]({'name':_0x30a5b5[_0x5cd0('0x39')],'resourceId':_0x30a5b5['id'],'type':_0x40b928[_0x5cd0('0x39')],'sectionId':_0x40b928['id']},{})[_0x5cd0('0x1f')](function(){return _0x4b2e2e;});}else{return _0x4b2e2e;}})[_0x5cd0('0x2a')](function(_0x512f4d){logger['error'](_0x5cd0('0x62'),_0x512f4d);throw _0x512f4d;});}return _0x4b2e2e;})['then'](respondWithResult(_0x4c292f,0xc9))[_0x5cd0('0x2a')](handleError(_0x4c292f,null));};exports['update']=function(_0x460a9b,_0x13f0cd){if(_0x460a9b['body']['id']){delete _0x460a9b[_0x5cd0('0x5a')]['id'];}return db[_0x5cd0('0x3d')][_0x5cd0('0x60')]({'where':{'id':_0x460a9b['params']['id']}})[_0x5cd0('0x1f')](handleEntityNotFound(_0x13f0cd,null))[_0x5cd0('0x1f')](saveUpdates(_0x460a9b['body'],null))[_0x5cd0('0x1f')](respondWithResult(_0x13f0cd,null))[_0x5cd0('0x2a')](handleError(_0x13f0cd,null));};exports[_0x5cd0('0x36')]=function(_0x31b67a,_0x3fe7c2){return db[_0x5cd0('0x3d')][_0x5cd0('0x60')]({'where':{'id':_0x31b67a[_0x5cd0('0x55')]['id']}})['then'](handleEntityNotFound(_0x3fe7c2,null))[_0x5cd0('0x1f')](removeEntity(_0x3fe7c2,null))[_0x5cd0('0x2a')](handleError(_0x3fe7c2,null));};exports['describe']=function(_0x50f556,_0x37dcb3){return db[_0x5cd0('0x3d')]['describe']()[_0x5cd0('0x1f')](respondWithResult(_0x37dcb3,null))[_0x5cd0('0x2a')](handleError(_0x37dcb3,null));};exports[_0x5cd0('0x63')]=function(_0x1c42c7,_0x3bab2a,_0xfb5e9f){var _0x4b379d={'raw':!![],'where':{}},_0x5359fa={},_0x3bd4e9;return db[_0x5cd0('0x3d')][_0x5cd0('0x64')]({'where':{'id':_0x1c42c7['params']['id']}})[_0x5cd0('0x1f')](handleEntityNotFound(_0x3bab2a,null))[_0x5cd0('0x1f')](function(_0x357e1a){if(_0x357e1a){_0x3bd4e9=_0x357e1a[_0x5cd0('0x5c')]({'plain':!![]});_0x5359fa[_0x5cd0('0x44')]=_[_0x5cd0('0x41')](db[_0x5cd0('0x65')][_0x5cd0('0x56')]);_0x5359fa[_0x5cd0('0x40')]=_[_0x5cd0('0x41')](_0x1c42c7[_0x5cd0('0x40')]);_0x5359fa[_0x5cd0('0x4a')]=_[_0x5cd0('0x42')](_0x5359fa[_0x5cd0('0x44')],_0x5359fa[_0x5cd0('0x40')]);_0x4b379d[_0x5cd0('0x43')]=_[_0x5cd0('0x42')](_0x5359fa[_0x5cd0('0x44')],qs[_0x5cd0('0x57')](_0x1c42c7['query'][_0x5cd0('0x57')]));_0x4b379d['attributes']=_0x4b379d[_0x5cd0('0x43')][_0x5cd0('0x66')]?_0x4b379d[_0x5cd0('0x43')]:_0x5359fa[_0x5cd0('0x44')];if(!_0x1c42c7['query']['hasOwnProperty']('nolimit')){_0x4b379d[_0x5cd0('0x30')]=qs[_0x5cd0('0x30')](_0x1c42c7['query']['limit']);_0x4b379d[_0x5cd0('0x2f')]=qs[_0x5cd0('0x2f')](_0x1c42c7[_0x5cd0('0x40')][_0x5cd0('0x2f')]);}_0x4b379d['order']=qs[_0x5cd0('0x48')](_0x1c42c7[_0x5cd0('0x40')][_0x5cd0('0x48')]);_0x4b379d['where']=qs[_0x5cd0('0x4a')](_['pick'](_0x1c42c7['query'],_0x5359fa[_0x5cd0('0x4a')]));_0x4b379d[_0x5cd0('0x49')][_0x5cd0('0x67')]=_0x357e1a['id'];if(_0x1c42c7['query'][_0x5cd0('0x4c')]){_0x4b379d[_0x5cd0('0x49')]=_[_0x5cd0('0x4f')](_0x4b379d[_0x5cd0('0x49')],{'$or':_[_0x5cd0('0x3c')](_0x4b379d[_0x5cd0('0x43')],function(_0x54c17c){var _0x129702={};_0x129702[_0x54c17c]={'$like':'%'+_0x1c42c7[_0x5cd0('0x40')][_0x5cd0('0x4c')]+'%'};return _0x129702;})});}_0x4b379d=_[_0x5cd0('0x4f')]({},_0x4b379d,_0x1c42c7[_0x5cd0('0x50')]);return db[_0x5cd0('0x65')][_0x5cd0('0x52')](_0x4b379d);}})['then'](function(_0x431fb5){if(_0x431fb5){return db['User'][_0x5cd0('0x68')]({'where':{'id':_[_0x5cd0('0x3c')](_0x431fb5,_0x5cd0('0x69')),'role':_0x5cd0('0x6a')},'attributes':['id',_0x5cd0('0x39'),_0x5cd0('0x6b'),_0x5cd0('0x6c'),_0x5cd0('0x6d')]});}})['then'](function(_0x12699c){if(_0x12699c){return{'count':_0x12699c[_0x5cd0('0x2e')],'rows':_['map'](_0x12699c['rows'],function(_0x56a67e){return{'membername':_0x56a67e[_0x5cd0('0x39')],'UserId':_0x56a67e['id'],'queue_name':_0x3bd4e9[_0x5cd0('0x39')],'ChatQueueId':_0x3bd4e9['id'],'interface':util['format']('%s/%s',_0x5cd0('0x6e'),_0x56a67e[_0x5cd0('0x39')]),'penalty':0x0,'paused':_0x56a67e[_0x5cd0('0x6b')],'createdAt':_0x56a67e['createdAt'],'updatedAt':_0x56a67e[_0x5cd0('0x6c')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x3bab2a,_0x4b379d))[_0x5cd0('0x2a')](handleError(_0x3bab2a,null));};exports['getTeams']=function(_0x4416c9,_0x1f1ee5,_0x1955b2){var _0x11fdb9={};var _0x248e91={};var _0x48f97a;var _0xcc11bb;return db[_0x5cd0('0x3d')][_0x5cd0('0x64')]({'where':{'id':_0x4416c9['params']['id']}})[_0x5cd0('0x1f')](handleEntityNotFound(_0x1f1ee5,null))[_0x5cd0('0x1f')](function(_0x3678b1){if(_0x3678b1){_0x48f97a=_0x3678b1;_0x248e91[_0x5cd0('0x44')]=_[_0x5cd0('0x41')](db['Team']['rawAttributes']);_0x248e91['query']=_[_0x5cd0('0x41')](_0x4416c9[_0x5cd0('0x40')]);_0x248e91[_0x5cd0('0x4a')]=_['intersection'](_0x248e91[_0x5cd0('0x44')],_0x248e91[_0x5cd0('0x40')]);_0x11fdb9['attributes']=_['intersection'](_0x248e91[_0x5cd0('0x44')],qs[_0x5cd0('0x57')](_0x4416c9['query']['fields']));_0x11fdb9[_0x5cd0('0x43')]=_0x11fdb9[_0x5cd0('0x43')]['length']?_0x11fdb9[_0x5cd0('0x43')]:_0x248e91[_0x5cd0('0x44')];_0x11fdb9[_0x5cd0('0x47')]=qs[_0x5cd0('0x48')](_0x4416c9['query'][_0x5cd0('0x48')]);_0x11fdb9['where']=qs[_0x5cd0('0x4a')](_[_0x5cd0('0x4b')](_0x4416c9[_0x5cd0('0x40')],_0x248e91[_0x5cd0('0x4a')]));if(_0x4416c9[_0x5cd0('0x40')][_0x5cd0('0x4c')]){_0x11fdb9[_0x5cd0('0x49')]=_[_0x5cd0('0x4f')](_0x11fdb9['where'],{'$or':_[_0x5cd0('0x3c')](_0x11fdb9[_0x5cd0('0x43')],function(_0x47782f){var _0x5c8674={};_0x5c8674[_0x47782f]={'$like':'%'+_0x4416c9[_0x5cd0('0x40')][_0x5cd0('0x4c')]+'%'};return _0x5c8674;})});}_0x11fdb9=_[_0x5cd0('0x4f')]({},_0x11fdb9,_0x4416c9[_0x5cd0('0x50')]);return _0x48f97a[_0x5cd0('0x6f')](_0x11fdb9);}})['then'](function(_0x3a7b54){if(_0x3a7b54){_0xcc11bb=_0x3a7b54[_0x5cd0('0x66')];if(!_0x4416c9[_0x5cd0('0x40')]['hasOwnProperty'](_0x5cd0('0x46'))){_0x11fdb9[_0x5cd0('0x30')]=qs['limit'](_0x4416c9[_0x5cd0('0x40')]['limit']);_0x11fdb9['offset']=qs[_0x5cd0('0x2f')](_0x4416c9[_0x5cd0('0x40')][_0x5cd0('0x2f')]);}return _0x48f97a['getTeams'](_0x11fdb9);}})[_0x5cd0('0x1f')](function(_0xabd06c){if(_0xabd06c){return _0xabd06c?{'count':_0xcc11bb,'rows':_0xabd06c}:null;}})['then'](respondWithResult(_0x1f1ee5,null))[_0x5cd0('0x2a')](handleError(_0x1f1ee5,null));};exports[_0x5cd0('0x70')]=function(_0x12f1af,_0xc7afeb,_0x4e70a4){var _0x41e053=_0x12f1af[_0x5cd0('0x5a')][_0x5cd0('0x71')];return db[_0x5cd0('0x72')]['findAll']({'where':{'id':_0x41e053},'attributes':['id'],'include':[{'model':db[_0x5cd0('0x73')],'as':_0x5cd0('0x74'),'attributes':['id','name',_0x5cd0('0x75'),_0x5cd0('0x76'),_0x5cd0('0x77')],'raw':!![]}]})[_0x5cd0('0x1f')](function(_0x53f3c3){if(_0x53f3c3){var _0x2b9dea=_[_0x5cd0('0x78')](_0x53f3c3,function(_0x10863c){var _0x285364=_0x10863c[_0x5cd0('0x5c')]({'plain':!![]});return _0x285364[_0x5cd0('0x74')];});return db['ChatQueue'][_0x5cd0('0x60')]({'where':{'id':_0x12f1af['params']['id']}})['then'](function(_0x1548d1){return db['sequelize'][_0x5cd0('0x79')](function(_0x4e5299){return _0x1548d1[_0x5cd0('0x70')](_0x41e053,{'transaction':_0x4e5299})[_0x5cd0('0x1f')](function(){return BPromise['each'](_0x2b9dea,function(_0xcb2824){return db[_0x5cd0('0x65')][_0x5cd0('0x7a')]({'where':{'UserId':_0xcb2824['id'],'ChatQueueId':_0x12f1af[_0x5cd0('0x55')]['id']},'transaction':_0x4e5299});});})[_0x5cd0('0x1f')](function(){_0x2b9dea[_0x5cd0('0x7b')](function(_0x146a1a){socket[_0x5cd0('0x7c')]('userChatQueue:save',{'UserId':_0x146a1a['id'],'ChatQueueId':_0x1548d1['id']});});});});});}})[_0x5cd0('0x1f')](respondWithStatusCode(_0xc7afeb,null))['catch'](handleError(_0xc7afeb,null));};exports[_0x5cd0('0x7d')]=function(_0x515cf9,_0x4e4efc,_0x44d4ab){return db[_0x5cd0('0x72')][_0x5cd0('0x52')]({'where':{'id':_0x515cf9['query']['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0x5cd0('0x74'),'attributes':['id'],'raw':!![]}]})[_0x5cd0('0x1f')](handleEntityNotFound(_0x4e4efc,null))[_0x5cd0('0x1f')](function(_0x1fe1ae){var _0x2e76dc=_[_0x5cd0('0x3c')](_0x1fe1ae,'id');var _0x1fb716=[];var _0x356754=[];var _0x58f167=squel[_0x5cd0('0x7e')]();_0x58f167['field'](_0x5cd0('0x7f'))['from'](_0x5cd0('0x80'),'tq')[_0x5cd0('0x81')](_0x5cd0('0x82'),'ut',_0x5cd0('0x83'))[_0x5cd0('0x49')](_0x5cd0('0x84'),_0x515cf9[_0x5cd0('0x55')]['id']);for(var _0x121f79=0x0;_0x121f79<_0x1fe1ae[_0x5cd0('0x66')];_0x121f79+=0x1){let _0x57c9ab=_0x1fe1ae[_0x121f79];for(var _0x7bc46b=0x0;_0x7bc46b<_0x57c9ab[_0x5cd0('0x74')][_0x5cd0('0x66')];_0x7bc46b+=0x1){let _0xa0c6c7=_0x57c9ab[_0x5cd0('0x74')][_0x7bc46b];var _0x330000=_0x58f167[_0x5cd0('0x85')]();_0x330000['where'](_0x5cd0('0x86'),_0xa0c6c7['id']);_0x356754[_0x5cd0('0x87')](db[_0x5cd0('0x88')][_0x5cd0('0x40')](_0x330000[_0x5cd0('0x89')](),{'type':db['sequelize']['QueryTypes'][_0x5cd0('0x8a')]})['then'](function(_0x476090){if(_0x476090['length']===0x1){return _0xa0c6c7['id'];}else{var _0x441680=_[_0x5cd0('0x8b')](_[_0x5cd0('0x3c')](_0x476090,_0x5cd0('0x8c')),function(_0x938d37){return _['includes'](_0x2e76dc,_0x938d37);});if(_0x441680){return _0xa0c6c7['id'];}}}));}}return BPromise[_0x5cd0('0x8d')](_0x356754)[_0x5cd0('0x1f')](function(_0x4b7ea8){_0x1fb716=_(_0x1fb716)[_0x5cd0('0x8e')](_0x4b7ea8)['compact']()[_0x5cd0('0x8f')]();return db['ChatQueue'][_0x5cd0('0x60')]({'where':{'id':_0x515cf9['params']['id']}})['then'](function(_0x3b2bdd){return db[_0x5cd0('0x88')][_0x5cd0('0x79')](function(_0x9e18c6){return _0x3b2bdd[_0x5cd0('0x7d')](_0x515cf9[_0x5cd0('0x40')][_0x5cd0('0x71')],{'transaction':_0x9e18c6})[_0x5cd0('0x1f')](function(){if(!_[_0x5cd0('0x90')](_0x1fb716)){return _0x3b2bdd['removeAgents'](_0x1fb716,{'transaction':_0x9e18c6});}})[_0x5cd0('0x1f')](function(){_0x1fb716['forEach'](function(_0x33a89f){socket[_0x5cd0('0x7c')]('userChatQueue:remove',{'UserId':_0x33a89f,'ChatQueueId':_0x3b2bdd['id']});});});});});});})[_0x5cd0('0x1f')](respondWithStatusCode(_0x4e4efc,null))[_0x5cd0('0x2a')](handleError(_0x4e4efc,null));};exports[_0x5cd0('0x91')]=function(_0x262e54,_0x10a9b2,_0x3c266e){return db[_0x5cd0('0x3d')][_0x5cd0('0x60')]({'where':{'id':_0x262e54['params']['id']}})[_0x5cd0('0x1f')](handleEntityNotFound(_0x10a9b2,null))[_0x5cd0('0x1f')](function(_0x164424){if(_0x164424){return _0x164424[_0x5cd0('0x91')](_0x262e54[_0x5cd0('0x5a')][_0x5cd0('0x71')],_[_0x5cd0('0x92')](_0x262e54[_0x5cd0('0x5a')],[_0x5cd0('0x71'),'id'])||{})[_0x5cd0('0x93')](function(_0x2ac3c8){for(var _0x2e87e8=0x0;_0x2e87e8<_0x262e54[_0x5cd0('0x5a')][_0x5cd0('0x71')][_0x5cd0('0x66')];_0x2e87e8+=0x1){socket[_0x5cd0('0x7c')]('userChatQueue:save',{'UserId':_0x262e54[_0x5cd0('0x5a')][_0x5cd0('0x71')][_0x2e87e8],'ChatQueueId':_0x262e54['params']['id']});}return _0x2ac3c8;});}})[_0x5cd0('0x1f')](respondWithResult(_0x10a9b2,null))[_0x5cd0('0x2a')](handleError(_0x10a9b2,null));};exports[_0x5cd0('0x94')]=function(_0x470db1,_0x220f18,_0x13e6f0){return db[_0x5cd0('0x3d')]['find']({'where':{'id':_0x470db1[_0x5cd0('0x55')]['id']}})['then'](handleEntityNotFound(_0x220f18,null))['then'](function(_0x1e74fc){if(_0x1e74fc){return _0x1e74fc[_0x5cd0('0x94')](_0x470db1[_0x5cd0('0x40')]['ids'])[_0x5cd0('0x1f')](function(){if(_[_0x5cd0('0x95')](_0x470db1[_0x5cd0('0x40')][_0x5cd0('0x71')])){for(var _0x4f67e0=0x0;_0x4f67e0<_0x470db1[_0x5cd0('0x40')][_0x5cd0('0x71')][_0x5cd0('0x66')];_0x4f67e0+=0x1){socket[_0x5cd0('0x7c')](_0x5cd0('0x96'),{'UserId':Number(_0x470db1[_0x5cd0('0x40')][_0x5cd0('0x71')][_0x4f67e0]),'ChatQueueId':Number(_0x470db1[_0x5cd0('0x55')]['id'])});}}else{socket['emit'](_0x5cd0('0x96'),{'UserId':Number(_0x470db1[_0x5cd0('0x40')][_0x5cd0('0x71')]),'ChatQueueId':Number(_0x470db1[_0x5cd0('0x55')]['id'])});}});}})[_0x5cd0('0x1f')](respondWithStatusCode(_0x220f18,null))['catch'](handleError(_0x220f18,null));};exports[_0x5cd0('0x97')]=function(_0x4e6c10,_0x4a6d2c,_0x3a705d){var _0x4f3554={};var _0x152be3={};var _0x4e55d8;var _0x54dca3;return db[_0x5cd0('0x3d')][_0x5cd0('0x64')]({'where':{'id':_0x4e6c10[_0x5cd0('0x55')]['id']}})['then'](handleEntityNotFound(_0x4a6d2c,null))['then'](function(_0x27e6d3){if(_0x27e6d3){_0x4e55d8=_0x27e6d3;_0x152be3[_0x5cd0('0x44')]=_[_0x5cd0('0x41')](db[_0x5cd0('0x73')][_0x5cd0('0x56')]);_0x152be3[_0x5cd0('0x40')]=_[_0x5cd0('0x41')](_0x4e6c10[_0x5cd0('0x40')]);_0x152be3['filters']=_[_0x5cd0('0x42')](_0x152be3[_0x5cd0('0x44')],_0x152be3[_0x5cd0('0x40')]);_0x4f3554[_0x5cd0('0x43')]=_['intersection'](_0x152be3[_0x5cd0('0x44')],qs[_0x5cd0('0x57')](_0x4e6c10[_0x5cd0('0x40')][_0x5cd0('0x57')]));_0x4f3554[_0x5cd0('0x43')]=_0x4f3554[_0x5cd0('0x43')][_0x5cd0('0x66')]?_0x4f3554[_0x5cd0('0x43')]:_0x152be3[_0x5cd0('0x44')];_0x4f3554['order']=qs[_0x5cd0('0x48')](_0x4e6c10[_0x5cd0('0x40')][_0x5cd0('0x48')]);_0x4f3554[_0x5cd0('0x49')]=qs[_0x5cd0('0x4a')](_['pick'](_0x4e6c10['query'],_0x152be3['filters']));if(_0x4e6c10[_0x5cd0('0x40')][_0x5cd0('0x4c')]){_0x4f3554[_0x5cd0('0x49')]=_[_0x5cd0('0x4f')](_0x4f3554[_0x5cd0('0x49')],{'$or':_['map'](_0x4f3554[_0x5cd0('0x43')],function(_0x3e1aa5){var _0x4d6f54={};_0x4d6f54[_0x3e1aa5]={'$like':'%'+_0x4e6c10['query'][_0x5cd0('0x4c')]+'%'};return _0x4d6f54;})});}_0x4f3554=_['merge']({},_0x4f3554,_0x4e6c10[_0x5cd0('0x50')]);return _0x4e55d8['getAgents'](_0x4f3554);}})[_0x5cd0('0x1f')](function(_0x3188c8){if(_0x3188c8){_0x54dca3=_0x3188c8['length'];if(!_0x4e6c10[_0x5cd0('0x40')][_0x5cd0('0x45')](_0x5cd0('0x46'))){_0x4f3554[_0x5cd0('0x30')]=qs[_0x5cd0('0x30')](_0x4e6c10[_0x5cd0('0x40')][_0x5cd0('0x30')]);_0x4f3554['offset']=qs[_0x5cd0('0x2f')](_0x4e6c10[_0x5cd0('0x40')]['offset']);}return _0x4e55d8[_0x5cd0('0x97')](_0x4f3554);}})[_0x5cd0('0x1f')](function(_0x334875){if(_0x334875){return _0x334875?{'count':_0x54dca3,'rows':_0x334875}:null;}})[_0x5cd0('0x1f')](respondWithResult(_0x4a6d2c,null))[_0x5cd0('0x2a')](handleError(_0x4a6d2c,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index 76c911d..e736ec7 100644 --- a/server/api/chatQueue/chatQueue.events.js +++ b/server/api/chatQueue/chatQueue.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['hasOwnProperty','hook','events','ChatQueue','setMaxListeners','save','remove','emit'];(function(_0x356594,_0x2b8657){var _0x3c47cd=function(_0x3f3e90){while(--_0x3f3e90){_0x356594['push'](_0x356594['shift']());}};_0x3c47cd(++_0x2b8657);}(_0xb10b,0x12a));var _0xbb10=function(_0x5aabcb,_0x219fbd){_0x5aabcb=_0x5aabcb-0x0;var _0x4b6e71=_0xb10b[_0x5aabcb];return _0x4b6e71;};'use strict';var EventEmitter=require(_0xbb10('0x0'));var ChatQueue=require('../../mysqldb')['db'][_0xbb10('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0xbb10('0x2')](0x0);var events={'afterCreate':_0xbb10('0x3'),'afterUpdate':'update','afterDestroy':_0xbb10('0x4')};function emitEvent(_0x9bbed){return function(_0x460981,_0x22320e,_0x49baf4){ChatQueueEvents[_0xbb10('0x5')](_0x9bbed+':'+_0x460981['id'],_0x460981);ChatQueueEvents['emit'](_0x9bbed,_0x460981);_0x49baf4(null);};}for(var e in events){if(events[_0xbb10('0x6')](e)){var event=events[e];ChatQueue[_0xbb10('0x7')](e,emitEvent(event));}}module['exports']=ChatQueueEvents; \ No newline at end of file +var _0xadb5=['update','emit','hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners','save'];(function(_0x3cea78,_0x4a6751){var _0x33b66b=function(_0x1f45cd){while(--_0x1f45cd){_0x3cea78['push'](_0x3cea78['shift']());}};_0x33b66b(++_0x4a6751);}(_0xadb5,0xad));var _0x5adb=function(_0x22c63c,_0x1951aa){_0x22c63c=_0x22c63c-0x0;var _0x1b93b6=_0xadb5[_0x22c63c];return _0x1b93b6;};'use strict';var EventEmitter=require('events');var ChatQueue=require(_0x5adb('0x0'))['db']['ChatQueue'];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x5adb('0x1')](0x0);var events={'afterCreate':_0x5adb('0x2'),'afterUpdate':_0x5adb('0x3'),'afterDestroy':'remove'};function emitEvent(_0x248dc6){return function(_0x31457,_0x2e3ef4,_0x4cb1d1){ChatQueueEvents[_0x5adb('0x4')](_0x248dc6+':'+_0x31457['id'],_0x31457);ChatQueueEvents[_0x5adb('0x4')](_0x248dc6,_0x31457);_0x4cb1d1(null);};}for(var e in events){if(events[_0x5adb('0x5')](e)){var event=events[e];ChatQueue[_0x5adb('0x6')](e,emitEvent(event));}}module[_0x5adb('0x7')]=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index f5febdd..93fa92d 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 _0x5b46=['../../config/environment','ChatQueue','chat_queues','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x1589dd,_0x2b9d22){var _0x1bddd1=function(_0x3687f8){while(--_0x3687f8){_0x1589dd['push'](_0x1589dd['shift']());}};_0x1bddd1(++_0x2b9d22);}(_0x5b46,0x99));var _0x65b4=function(_0x4dbbda,_0x13ebb9){_0x4dbbda=_0x4dbbda-0x0;var _0x279353=_0x5b46[_0x4dbbda];return _0x279353;};'use strict';var _=require(_0x65b4('0x0'));var util=require('util');var logger=require(_0x65b4('0x1'))('api');var moment=require(_0x65b4('0x2'));var BPromise=require(_0x65b4('0x3'));var rp=require(_0x65b4('0x4'));var fs=require('fs');var path=require(_0x65b4('0x5'));var rimraf=require(_0x65b4('0x6'));var config=require(_0x65b4('0x7'));var attributes=require('./chatQueue.attributes');module['exports']=function(_0x33376d,_0x538dae){return _0x33376d['define'](_0x65b4('0x8'),attributes,{'tableName':_0x65b4('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa672=['define','ChatQueue','chat_queues','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./chatQueue.attributes','exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xa672,0x1ed));var _0x2a67=function(_0x5ddaac,_0x2697a8){_0x5ddaac=_0x5ddaac-0x0;var _0x2a9c58=_0xa672[_0x5ddaac];return _0x2a9c58;};'use strict';var _=require(_0x2a67('0x0'));var util=require(_0x2a67('0x1'));var logger=require(_0x2a67('0x2'))(_0x2a67('0x3'));var moment=require(_0x2a67('0x4'));var BPromise=require('bluebird');var rp=require(_0x2a67('0x5'));var fs=require('fs');var path=require(_0x2a67('0x6'));var rimraf=require(_0x2a67('0x7'));var config=require(_0x2a67('0x8'));var attributes=require(_0x2a67('0x9'));module[_0x2a67('0xa')]=function(_0x534515,_0x4fcbfb){return _0x534515[_0x2a67('0xb')](_0x2a67('0xc'),attributes,{'tableName':_0x2a67('0xd'),'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 eec5f4a..b175c4f 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 _0xcf37=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','localhost','socket.io-emitter','./chatQueue.socket','register','request','then','info','ChatQueue,\x20%s,\x20%s','debug','request\x20sent','error','message','result','catch','GetChatQueue','ChatQueue','findAll','options','attributes','include','model','map','stringify','ShowChatQueue','raw','where','util','moment'];(function(_0x3e8d8c,_0x1d4fdc){var _0x390bed=function(_0x56097e){while(--_0x56097e){_0x3e8d8c['push'](_0x3e8d8c['shift']());}};_0x390bed(++_0x1d4fdc);}(_0xcf37,0xdc));var _0x7cf3=function(_0x116074,_0x5387fb){_0x116074=_0x116074-0x0;var _0x50eb48=_0xcf37[_0x116074];return _0x50eb48;};'use strict';var _=require('lodash');var util=require(_0x7cf3('0x0'));var moment=require(_0x7cf3('0x1'));var BPromise=require(_0x7cf3('0x2'));var rs=require(_0x7cf3('0x3'));var fs=require('fs');var Redis=require(_0x7cf3('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7cf3('0x5'));var logger=require(_0x7cf3('0x6'))(_0x7cf3('0x7'));var config=require(_0x7cf3('0x8'));var jayson=require(_0x7cf3('0x9'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_['defaults'](config[_0x7cf3('0xa')],{'host':_0x7cf3('0xb'),'port':0x18eb});var socket=require(_0x7cf3('0xc'))(new Redis(config['redis']));require(_0x7cf3('0xd'))[_0x7cf3('0xe')](socket);function respondWithRpcPromise(_0x242ffc,_0x2acdde,_0x364a7a){return new BPromise(function(_0x23fe46,_0x53212b){return client[_0x7cf3('0xf')](_0x242ffc,_0x364a7a)[_0x7cf3('0x10')](function(_0x3e9ec1){logger[_0x7cf3('0x11')](_0x7cf3('0x12'),_0x2acdde,'request\x20sent');logger[_0x7cf3('0x13')]('ChatQueue,\x20%s,\x20%s,\x20%s',_0x2acdde,_0x7cf3('0x14'),JSON['stringify'](_0x3e9ec1));if(_0x3e9ec1[_0x7cf3('0x15')]){if(_0x3e9ec1[_0x7cf3('0x15')]['code']===0x1f4){logger[_0x7cf3('0x15')](_0x7cf3('0x12'),_0x2acdde,_0x3e9ec1[_0x7cf3('0x15')][_0x7cf3('0x16')]);return _0x53212b(_0x3e9ec1['error'][_0x7cf3('0x16')]);}logger['error'](_0x7cf3('0x12'),_0x2acdde,_0x3e9ec1[_0x7cf3('0x15')][_0x7cf3('0x16')]);return _0x23fe46(_0x3e9ec1[_0x7cf3('0x15')][_0x7cf3('0x16')]);}else{logger[_0x7cf3('0x11')]('ChatQueue,\x20%s,\x20%s',_0x2acdde,'request\x20sent');_0x23fe46(_0x3e9ec1[_0x7cf3('0x17')][_0x7cf3('0x16')]);}})[_0x7cf3('0x18')](function(_0x59cbd3){logger[_0x7cf3('0x15')](_0x7cf3('0x12'),_0x2acdde,_0x59cbd3);_0x53212b(_0x59cbd3);});});}exports[_0x7cf3('0x19')]=function(_0x27ef8d){var _0x369e30=this;return new Promise(function(_0x50cea8,_0x2175c1){return db[_0x7cf3('0x1a')][_0x7cf3('0x1b')]({'raw':_0x27ef8d[_0x7cf3('0x1c')]?_0x27ef8d[_0x7cf3('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x27ef8d[_0x7cf3('0x1c')]?_0x27ef8d[_0x7cf3('0x1c')]['where']||null:null,'attributes':_0x27ef8d['options']?_0x27ef8d['options'][_0x7cf3('0x1d')]||null:null,'limit':_0x27ef8d['options']?_0x27ef8d[_0x7cf3('0x1c')]['limit']||null:null,'include':_0x27ef8d[_0x7cf3('0x1c')]?_0x27ef8d['options'][_0x7cf3('0x1e')]?_['map'](_0x27ef8d[_0x7cf3('0x1c')][_0x7cf3('0x1e')],function(_0x146664){return{'model':db[_0x146664[_0x7cf3('0x1f')]],'as':_0x146664['as'],'attributes':_0x146664[_0x7cf3('0x1d')],'include':_0x146664[_0x7cf3('0x1e')]?_[_0x7cf3('0x20')](_0x146664[_0x7cf3('0x1e')],function(_0x835dd){return{'model':db[_0x835dd['model']],'as':_0x835dd['as'],'attributes':_0x835dd['attributes'],'include':_0x835dd[_0x7cf3('0x1e')]?_[_0x7cf3('0x20')](_0x835dd[_0x7cf3('0x1e')],function(_0x5b8732){return{'model':db[_0x5b8732[_0x7cf3('0x1f')]],'as':_0x5b8732['as'],'attributes':_0x5b8732[_0x7cf3('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x142671){logger[_0x7cf3('0x11')](_0x7cf3('0x19'),_0x27ef8d);logger[_0x7cf3('0x13')](_0x7cf3('0x19'),_0x27ef8d,JSON[_0x7cf3('0x21')](_0x142671));_0x50cea8(_0x142671);})[_0x7cf3('0x18')](function(_0x422582){logger[_0x7cf3('0x15')](_0x7cf3('0x19'),_0x422582['message'],_0x27ef8d);_0x2175c1(_0x369e30[_0x7cf3('0x15')](0x1f4,_0x422582['message']));});});};exports[_0x7cf3('0x22')]=function(_0x7fc6c0){var _0x35f397=this;return new Promise(function(_0x4a5e8a,_0x30bbf5){return db[_0x7cf3('0x1a')]['find']({'raw':_0x7fc6c0[_0x7cf3('0x1c')]?_0x7fc6c0[_0x7cf3('0x1c')][_0x7cf3('0x23')]===undefined?!![]:![]:!![],'where':_0x7fc6c0[_0x7cf3('0x1c')]?_0x7fc6c0[_0x7cf3('0x1c')][_0x7cf3('0x24')]||null:null,'attributes':_0x7fc6c0['options']?_0x7fc6c0[_0x7cf3('0x1c')][_0x7cf3('0x1d')]||null:null,'include':_0x7fc6c0[_0x7cf3('0x1c')]?_0x7fc6c0[_0x7cf3('0x1c')]['include']?_[_0x7cf3('0x20')](_0x7fc6c0[_0x7cf3('0x1c')][_0x7cf3('0x1e')],function(_0x1fc74f){return{'model':db[_0x1fc74f[_0x7cf3('0x1f')]],'as':_0x1fc74f['as'],'attributes':_0x1fc74f[_0x7cf3('0x1d')],'include':_0x1fc74f[_0x7cf3('0x1e')]?_[_0x7cf3('0x20')](_0x1fc74f[_0x7cf3('0x1e')],function(_0x32ea10){return{'model':db[_0x32ea10['model']],'as':_0x32ea10['as'],'attributes':_0x32ea10['attributes'],'include':_0x32ea10['include']?_[_0x7cf3('0x20')](_0x32ea10[_0x7cf3('0x1e')],function(_0xb63c82){return{'model':db[_0xb63c82[_0x7cf3('0x1f')]],'as':_0xb63c82['as'],'attributes':_0xb63c82[_0x7cf3('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x7cf3('0x10')](function(_0x2c7f87){logger[_0x7cf3('0x11')](_0x7cf3('0x22'),_0x7fc6c0);logger['debug']('ShowChatQueue',_0x7fc6c0,JSON[_0x7cf3('0x21')](_0x2c7f87));_0x4a5e8a(_0x2c7f87);})['catch'](function(_0x487e73){logger[_0x7cf3('0x15')]('ShowChatQueue',_0x487e73[_0x7cf3('0x16')],_0x7fc6c0);_0x30bbf5(_0x35f397[_0x7cf3('0x15')](0x1f4,_0x487e73['message']));});});}; \ No newline at end of file +var _0x8ce3=['where','attributes','limit','map','include','model','info','GetChatQueue','stringify','ShowChatQueue','find','raw','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','redis','defaults','localhost','./chatQueue.socket','register','request','then','ChatQueue,\x20%s,\x20%s','debug','ChatQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','ChatQueue','findAll','options'];(function(_0x28014d,_0x383e2f){var _0x2572cc=function(_0x17aabd){while(--_0x17aabd){_0x28014d['push'](_0x28014d['shift']());}};_0x2572cc(++_0x383e2f);}(_0x8ce3,0x1b9));var _0x38ce=function(_0x28eedc,_0x176917){_0x28eedc=_0x28eedc-0x0;var _0x575e59=_0x8ce3[_0x28eedc];return _0x575e59;};'use strict';var _=require('lodash');var util=require(_0x38ce('0x0'));var moment=require(_0x38ce('0x1'));var BPromise=require(_0x38ce('0x2'));var rs=require(_0x38ce('0x3'));var fs=require('fs');var Redis=require(_0x38ce('0x4'));var db=require(_0x38ce('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x38ce('0x6'))(_0x38ce('0x7'));var config=require(_0x38ce('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0x38ce('0x9')]=_[_0x38ce('0xa')](config[_0x38ce('0x9')],{'host':_0x38ce('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x38ce('0x9')]));require(_0x38ce('0xc'))[_0x38ce('0xd')](socket);function respondWithRpcPromise(_0x1ab267,_0x34e46c,_0x55baeb){return new BPromise(function(_0x3af019,_0x3ebfa8){return client[_0x38ce('0xe')](_0x1ab267,_0x55baeb)[_0x38ce('0xf')](function(_0x3e7c12){logger['info'](_0x38ce('0x10'),_0x34e46c,'request\x20sent');logger[_0x38ce('0x11')](_0x38ce('0x12'),_0x34e46c,'request\x20sent',JSON['stringify'](_0x3e7c12));if(_0x3e7c12[_0x38ce('0x13')]){if(_0x3e7c12[_0x38ce('0x13')][_0x38ce('0x14')]===0x1f4){logger[_0x38ce('0x13')](_0x38ce('0x10'),_0x34e46c,_0x3e7c12[_0x38ce('0x13')]['message']);return _0x3ebfa8(_0x3e7c12[_0x38ce('0x13')][_0x38ce('0x15')]);}logger[_0x38ce('0x13')](_0x38ce('0x10'),_0x34e46c,_0x3e7c12[_0x38ce('0x13')][_0x38ce('0x15')]);return _0x3af019(_0x3e7c12[_0x38ce('0x13')][_0x38ce('0x15')]);}else{logger['info'](_0x38ce('0x10'),_0x34e46c,'request\x20sent');_0x3af019(_0x3e7c12[_0x38ce('0x16')]['message']);}})[_0x38ce('0x17')](function(_0xeeaea1){logger['error'](_0x38ce('0x10'),_0x34e46c,_0xeeaea1);_0x3ebfa8(_0xeeaea1);});});}exports['GetChatQueue']=function(_0x43ba83){var _0x53db82=this;return new Promise(function(_0xbe1781,_0x239870){return db[_0x38ce('0x18')][_0x38ce('0x19')]({'raw':_0x43ba83[_0x38ce('0x1a')]?_0x43ba83[_0x38ce('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x43ba83[_0x38ce('0x1a')]?_0x43ba83[_0x38ce('0x1a')][_0x38ce('0x1b')]||null:null,'attributes':_0x43ba83[_0x38ce('0x1a')]?_0x43ba83['options'][_0x38ce('0x1c')]||null:null,'limit':_0x43ba83[_0x38ce('0x1a')]?_0x43ba83['options'][_0x38ce('0x1d')]||null:null,'include':_0x43ba83[_0x38ce('0x1a')]?_0x43ba83[_0x38ce('0x1a')]['include']?_[_0x38ce('0x1e')](_0x43ba83['options'][_0x38ce('0x1f')],function(_0x17078b){return{'model':db[_0x17078b[_0x38ce('0x20')]],'as':_0x17078b['as'],'attributes':_0x17078b[_0x38ce('0x1c')],'include':_0x17078b[_0x38ce('0x1f')]?_[_0x38ce('0x1e')](_0x17078b[_0x38ce('0x1f')],function(_0x4bf539){return{'model':db[_0x4bf539[_0x38ce('0x20')]],'as':_0x4bf539['as'],'attributes':_0x4bf539[_0x38ce('0x1c')],'include':_0x4bf539['include']?_['map'](_0x4bf539[_0x38ce('0x1f')],function(_0xf29eb2){return{'model':db[_0xf29eb2[_0x38ce('0x20')]],'as':_0xf29eb2['as'],'attributes':_0xf29eb2[_0x38ce('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x38ce('0xf')](function(_0x3f173e){logger[_0x38ce('0x21')](_0x38ce('0x22'),_0x43ba83);logger[_0x38ce('0x11')](_0x38ce('0x22'),_0x43ba83,JSON[_0x38ce('0x23')](_0x3f173e));_0xbe1781(_0x3f173e);})['catch'](function(_0x1156fc){logger['error'](_0x38ce('0x22'),_0x1156fc[_0x38ce('0x15')],_0x43ba83);_0x239870(_0x53db82[_0x38ce('0x13')](0x1f4,_0x1156fc['message']));});});};exports[_0x38ce('0x24')]=function(_0xd02425){var _0x331505=this;return new Promise(function(_0x3173bc,_0x50ce8c){return db[_0x38ce('0x18')][_0x38ce('0x25')]({'raw':_0xd02425[_0x38ce('0x1a')]?_0xd02425[_0x38ce('0x1a')][_0x38ce('0x26')]===undefined?!![]:![]:!![],'where':_0xd02425[_0x38ce('0x1a')]?_0xd02425[_0x38ce('0x1a')][_0x38ce('0x1b')]||null:null,'attributes':_0xd02425[_0x38ce('0x1a')]?_0xd02425[_0x38ce('0x1a')][_0x38ce('0x1c')]||null:null,'include':_0xd02425[_0x38ce('0x1a')]?_0xd02425[_0x38ce('0x1a')][_0x38ce('0x1f')]?_[_0x38ce('0x1e')](_0xd02425[_0x38ce('0x1a')]['include'],function(_0xada46d){return{'model':db[_0xada46d['model']],'as':_0xada46d['as'],'attributes':_0xada46d['attributes'],'include':_0xada46d['include']?_[_0x38ce('0x1e')](_0xada46d[_0x38ce('0x1f')],function(_0x308ea8){return{'model':db[_0x308ea8['model']],'as':_0x308ea8['as'],'attributes':_0x308ea8['attributes'],'include':_0x308ea8[_0x38ce('0x1f')]?_[_0x38ce('0x1e')](_0x308ea8[_0x38ce('0x1f')],function(_0x1abefc){return{'model':db[_0x1abefc[_0x38ce('0x20')]],'as':_0x1abefc['as'],'attributes':_0x1abefc[_0x38ce('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x24dae0){logger['info'](_0x38ce('0x24'),_0xd02425);logger[_0x38ce('0x11')](_0x38ce('0x24'),_0xd02425,JSON[_0x38ce('0x23')](_0x24dae0));_0x3173bc(_0x24dae0);})[_0x38ce('0x17')](function(_0x54e1e3){logger['error'](_0x38ce('0x24'),_0x54e1e3[_0x38ce('0x15')],_0xd02425);_0x50ce8c(_0x331505['error'](0x1f4,_0x54e1e3[_0x38ce('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index df85484..7d7d1bf 100644 --- a/server/api/chatQueue/chatQueue.socket.js +++ b/server/api/chatQueue/chatQueue.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0b0e=['chatQueue:','./chatQueue.events','remove','emit','removeListener','register'];(function(_0x4e198c,_0x243476){var _0x1e2ef2=function(_0x524934){while(--_0x524934){_0x4e198c['push'](_0x4e198c['shift']());}};_0x1e2ef2(++_0x243476);}(_0x0b0e,0x187));var _0xe0b0=function(_0x5734e1,_0x3e1d75){_0x5734e1=_0x5734e1-0x0;var _0x22c784=_0x0b0e[_0x5734e1];return _0x22c784;};'use strict';var ChatQueueEvents=require(_0xe0b0('0x0'));var events=['save',_0xe0b0('0x1'),'update'];function createListener(_0x7e5a8a,_0xdf715e){return function(_0x3b5e2b){_0xdf715e[_0xe0b0('0x2')](_0x7e5a8a,_0x3b5e2b);};}function removeListener(_0x28040c,_0x38a058){return function(){ChatQueueEvents[_0xe0b0('0x3')](_0x28040c,_0x38a058);};}exports[_0xe0b0('0x4')]=function(_0x30e20d){for(var _0x28e40f=0x0,_0x219b1c=events['length'];_0x28e40f<_0x219b1c;_0x28e40f++){var _0x50be7f=events[_0x28e40f];var _0x11effc=createListener(_0xe0b0('0x5')+_0x50be7f,_0x30e20d);ChatQueueEvents['on'](_0x50be7f,_0x11effc);}}; \ No newline at end of file +var _0x0b0e=['chatQueue:','./chatQueue.events','remove','emit','removeListener','register'];(function(_0x45f2e8,_0x46345c){var _0x4dba6f=function(_0x59b87c){while(--_0x59b87c){_0x45f2e8['push'](_0x45f2e8['shift']());}};_0x4dba6f(++_0x46345c);}(_0x0b0e,0x187));var _0xe0b0=function(_0x378720,_0xa711f1){_0x378720=_0x378720-0x0;var _0x47920a=_0x0b0e[_0x378720];return _0x47920a;};'use strict';var ChatQueueEvents=require(_0xe0b0('0x0'));var events=['save',_0xe0b0('0x1'),'update'];function createListener(_0x7e5a8a,_0xdf715e){return function(_0x3b5e2b){_0xdf715e[_0xe0b0('0x2')](_0x7e5a8a,_0x3b5e2b);};}function removeListener(_0x28040c,_0x38a058){return function(){ChatQueueEvents[_0xe0b0('0x3')](_0x28040c,_0x38a058);};}exports[_0xe0b0('0x4')]=function(_0x30e20d){for(var _0x28e40f=0x0,_0x219b1c=events['length'];_0x28e40f<_0x219b1c;_0x28e40f++){var _0x50be7f=events[_0x28e40f];var _0x11effc=createListener(_0xe0b0('0x5')+_0x50be7f,_0x30e20d);ChatQueueEvents['on'](_0x50be7f,_0x11effc);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index 8b1a0d7..88262df 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 _0x0965=['getAgents','post','create','addTeams','addAgents','put','update','delete','destroy','removeTeams','removeAgents','exports','multer','path','connect-timeout','express','Router','../../components/interaction/service','index','get','/describe','isAuthenticated','describe','/:id','/:id/members','getMembers','/:id/teams','getTeams','/:id/users'];(function(_0x2be91d,_0x595d2d){var _0xb3a0a7=function(_0x5b1532){while(--_0x5b1532){_0x2be91d['push'](_0x2be91d['shift']());}};_0xb3a0a7(++_0x595d2d);}(_0x0965,0x111));var _0x5096=function(_0x510be5,_0x268fba){_0x510be5=_0x510be5-0x0;var _0x2a32ae=_0x0965[_0x510be5];return _0x2a32ae;};'use strict';var multer=require(_0x5096('0x0'));var util=require('util');var path=require(_0x5096('0x1'));var timeout=require(_0x5096('0x2'));var express=require(_0x5096('0x3'));var router=express[_0x5096('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x5096('0x5'));var config=require('../../config/environment');var controller=require('./chatQueue.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x5096('0x6')]);router[_0x5096('0x7')](_0x5096('0x8'),auth[_0x5096('0x9')](),controller[_0x5096('0xa')]);router[_0x5096('0x7')](_0x5096('0xb'),auth[_0x5096('0x9')](),controller['show']);router['get'](_0x5096('0xc'),auth[_0x5096('0x9')](),controller[_0x5096('0xd')]);router[_0x5096('0x7')](_0x5096('0xe'),auth[_0x5096('0x9')](),controller[_0x5096('0xf')]);router[_0x5096('0x7')](_0x5096('0x10'),auth[_0x5096('0x9')](),controller[_0x5096('0x11')]);router[_0x5096('0x12')]('/',auth['isAuthenticated'](),controller[_0x5096('0x13')]);router['post'](_0x5096('0xe'),auth['isAuthenticated'](),controller[_0x5096('0x14')]);router[_0x5096('0x12')](_0x5096('0x10'),auth[_0x5096('0x9')](),controller[_0x5096('0x15')]);router[_0x5096('0x16')](_0x5096('0xb'),auth[_0x5096('0x9')](),controller[_0x5096('0x17')]);router[_0x5096('0x18')]('/:id',auth[_0x5096('0x9')](),controller[_0x5096('0x19')]);router[_0x5096('0x18')](_0x5096('0xe'),auth['isAuthenticated'](),controller[_0x5096('0x1a')]);router[_0x5096('0x18')](_0x5096('0x10'),auth[_0x5096('0x9')](),controller[_0x5096('0x1b')]);module[_0x5096('0x1c')]=router; \ No newline at end of file +var _0x9bd5=['addAgents','put','/:id','update','delete','destroy','removeTeams','removeAgents','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueue.controller','isAuthenticated','index','get','/describe','describe','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams'];(function(_0x4b5fe8,_0x22a8eb){var _0x1e80ad=function(_0x5d8809){while(--_0x5d8809){_0x4b5fe8['push'](_0x4b5fe8['shift']());}};_0x1e80ad(++_0x22a8eb);}(_0x9bd5,0x182));var _0x59bd=function(_0x317c02,_0x38583a){_0x317c02=_0x317c02-0x0;var _0x30a5b2=_0x9bd5[_0x317c02];return _0x30a5b2;};'use strict';var multer=require(_0x59bd('0x0'));var util=require('util');var path=require(_0x59bd('0x1'));var timeout=require('connect-timeout');var express=require(_0x59bd('0x2'));var router=express[_0x59bd('0x3')]();var auth=require(_0x59bd('0x4'));var interaction=require(_0x59bd('0x5'));var config=require(_0x59bd('0x6'));var controller=require(_0x59bd('0x7'));router['get']('/',auth[_0x59bd('0x8')](),controller[_0x59bd('0x9')]);router[_0x59bd('0xa')](_0x59bd('0xb'),auth['isAuthenticated'](),controller[_0x59bd('0xc')]);router['get']('/:id',auth[_0x59bd('0x8')](),controller['show']);router[_0x59bd('0xa')]('/:id/members',auth[_0x59bd('0x8')](),controller[_0x59bd('0xd')]);router[_0x59bd('0xa')](_0x59bd('0xe'),auth['isAuthenticated'](),controller[_0x59bd('0xf')]);router['get'](_0x59bd('0x10'),auth[_0x59bd('0x8')](),controller[_0x59bd('0x11')]);router[_0x59bd('0x12')]('/',auth[_0x59bd('0x8')](),controller['create']);router[_0x59bd('0x12')](_0x59bd('0xe'),auth[_0x59bd('0x8')](),controller[_0x59bd('0x13')]);router[_0x59bd('0x12')](_0x59bd('0x10'),auth[_0x59bd('0x8')](),controller[_0x59bd('0x14')]);router[_0x59bd('0x15')](_0x59bd('0x16'),auth[_0x59bd('0x8')](),controller[_0x59bd('0x17')]);router[_0x59bd('0x18')](_0x59bd('0x16'),auth['isAuthenticated'](),controller[_0x59bd('0x19')]);router['delete'](_0x59bd('0xe'),auth[_0x59bd('0x8')](),controller[_0x59bd('0x1a')]);router[_0x59bd('0x18')](_0x59bd('0x10'),auth['isAuthenticated'](),controller[_0x59bd('0x1b')]);module[_0x59bd('0x1c')]=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index 183c5bf..1d30966 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 _0xf76d=['sequelize','STRING','DATE','moment'];(function(_0x723288,_0x361804){var _0x45fecf=function(_0x39fbe1){while(--_0x39fbe1){_0x723288['push'](_0x723288['shift']());}};_0x45fecf(++_0x361804);}(_0xf76d,0x18f));var _0xdf76=function(_0x53cf8e,_0x3d290f){_0x53cf8e=_0x53cf8e-0x0;var _0x459197=_0xf76d[_0x53cf8e];return _0x459197;};'use strict';var moment=require(_0xdf76('0x0'));var Sequelize=require(_0xdf76('0x1'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xdf76('0x2')]},'joinAt':{'type':Sequelize[_0xdf76('0x3')]},'leaveAt':{'type':Sequelize[_0xdf76('0x3')]},'acceptAt':{'type':Sequelize[_0xdf76('0x3')]},'exitAt':{'type':Sequelize[_0xdf76('0x3')]},'reason':{'type':Sequelize[_0xdf76('0x2')]}}; \ No newline at end of file +var _0x4597=['STRING','DATE','moment','exports'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x4597,0x82));var _0x7459=function(_0xb9ddce,_0x524945){_0xb9ddce=_0xb9ddce-0x0;var _0x246755=_0x4597[_0xb9ddce];return _0x246755;};'use strict';var moment=require(_0x7459('0x0'));var Sequelize=require('sequelize');module[_0x7459('0x1')]={'uniqueid':{'type':Sequelize[_0x7459('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x7459('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x7459('0x3')]},'acceptAt':{'type':Sequelize[_0x7459('0x3')]},'exitAt':{'type':Sequelize[_0x7459('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index 9a51bff..e7c9f48 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 _0xa5a2=['update','then','destroy','sendStatus','error','name','index','map','ChatQueueReport','type','key','query','keys','filters','intersection','model','fields','length','attributes','hasOwnProperty','limit','order','sort','where','pick','filter','merge','options','includeAll','include','rows','catch','show','rawAttributes','find','create','body','params','describe','eml-format','rimraf','zip-dir','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','set','apply','save'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0xa5a2,0xb5));var _0x2a5a=function(_0x38467c,_0x2d3490){_0x38467c=_0x38467c-0x0;var _0x1d09cd=_0xa5a2[_0x38467c];return _0x1d09cd;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x2a5a('0x0'));var rimraf=require(_0x2a5a('0x1'));var zipdir=require(_0x2a5a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x2a5a('0x3'));var Mustache=require(_0x2a5a('0x4'));var util=require(_0x2a5a('0x5'));var path=require(_0x2a5a('0x6'));var sox=require(_0x2a5a('0x7'));var csv=require(_0x2a5a('0x8'));var ejs=require(_0x2a5a('0x9'));var fs=require('fs');var _=require(_0x2a5a('0xa'));var squel=require(_0x2a5a('0xb'));var crypto=require('crypto');var jsforce=require(_0x2a5a('0xc'));var deskjs=require(_0x2a5a('0xd'));var toCsv=require(_0x2a5a('0x8'));var querystring=require('querystring');var Papa=require(_0x2a5a('0xe'));var Redis=require('ioredis');var authService=require(_0x2a5a('0xf'));var qs=require(_0x2a5a('0x10'));var as=require(_0x2a5a('0x11'));var hardwareService=require(_0x2a5a('0x12'));var logger=require(_0x2a5a('0x13'))(_0x2a5a('0x14'));var utils=require(_0x2a5a('0x15'));var config=require(_0x2a5a('0x16'));var db=require(_0x2a5a('0x17'))['db'];function respondWithStatusCode(_0x5582e5,_0x19bb3c){_0x19bb3c=_0x19bb3c||0xcc;return function(_0x5c47b7){if(_0x5c47b7){return _0x5582e5['sendStatus'](_0x19bb3c);}return _0x5582e5[_0x2a5a('0x18')](_0x19bb3c)[_0x2a5a('0x19')]();};}function respondWithResult(_0x441b50,_0x37d3ff){_0x37d3ff=_0x37d3ff||0xc8;return function(_0x167fd3){if(_0x167fd3){return _0x441b50[_0x2a5a('0x18')](_0x37d3ff)[_0x2a5a('0x1a')](_0x167fd3);}};}function respondWithFilteredResult(_0x9aac47,_0x514424){return function(_0x31daa2){if(_0x31daa2){var _0x3fcb2e=_0x31daa2[_0x2a5a('0x1b')],_0xdd9dbe=_0x514424[_0x2a5a('0x1c')],_0x9f6734=_0x514424[_0x2a5a('0x1c')]+_0x514424['limit'],_0x572ac4;if(_0x9f6734>=_0x3fcb2e){_0x9f6734=_0x3fcb2e;_0x572ac4=0xc8;}else{_0x572ac4=0xce;}_0x9aac47[_0x2a5a('0x18')](_0x572ac4);return _0x9aac47[_0x2a5a('0x1d')]('Content-Range',_0xdd9dbe+'-'+_0x9f6734+'/'+_0x3fcb2e)['json'](_0x31daa2);}return null;};}function patchUpdates(_0x36d023){return function(_0x463fa1){try{jsonpatch[_0x2a5a('0x1e')](_0x463fa1,_0x36d023,!![]);}catch(_0x367802){return BPromise['reject'](_0x367802);}return _0x463fa1[_0x2a5a('0x1f')]();};}function saveUpdates(_0x367ee8,_0x2d0c4c){return function(_0x447fc3){if(_0x447fc3){return _0x447fc3[_0x2a5a('0x20')](_0x367ee8)[_0x2a5a('0x21')](function(_0x13503e){return _0x13503e;});}return null;};}function removeEntity(_0xbe8409,_0x2f5c24){return function(_0x5ea7da){if(_0x5ea7da){return _0x5ea7da[_0x2a5a('0x22')]()[_0x2a5a('0x21')](function(){_0xbe8409[_0x2a5a('0x18')](0xcc)[_0x2a5a('0x19')]();});}};}function handleEntityNotFound(_0x2c6b5d,_0x44678d){return function(_0x15e1d0){if(!_0x15e1d0){_0x2c6b5d[_0x2a5a('0x23')](0x194);}return _0x15e1d0;};}function handleError(_0xc584d6,_0x52d2bf){_0x52d2bf=_0x52d2bf||0x1f4;return function(_0x3a6d02){logger[_0x2a5a('0x24')](_0x3a6d02['stack']);if(_0x3a6d02[_0x2a5a('0x25')]){delete _0x3a6d02[_0x2a5a('0x25')];}_0xc584d6[_0x2a5a('0x18')](_0x52d2bf)['send'](_0x3a6d02);};}exports[_0x2a5a('0x26')]=function(_0xe5fee3,_0x3235fe){var _0x5eff85={},_0x1c6b57={},_0x3868b1={'count':0x0,'rows':[]};var _0x43d4a3=_[_0x2a5a('0x27')](db[_0x2a5a('0x28')]['rawAttributes'],function(_0x609aee){return{'name':_0x609aee['fieldName'],'type':_0x609aee[_0x2a5a('0x29')][_0x2a5a('0x2a')]};});_0x1c6b57['model']=_[_0x2a5a('0x27')](_0x43d4a3,_0x2a5a('0x25'));_0x1c6b57[_0x2a5a('0x2b')]=_[_0x2a5a('0x2c')](_0xe5fee3[_0x2a5a('0x2b')]);_0x1c6b57[_0x2a5a('0x2d')]=_[_0x2a5a('0x2e')](_0x1c6b57[_0x2a5a('0x2f')],_0x1c6b57[_0x2a5a('0x2b')]);_0x5eff85['attributes']=_['intersection'](_0x1c6b57['model'],qs[_0x2a5a('0x30')](_0xe5fee3['query']['fields']));_0x5eff85['attributes']=_0x5eff85['attributes'][_0x2a5a('0x31')]?_0x5eff85[_0x2a5a('0x32')]:_0x1c6b57[_0x2a5a('0x2f')];if(!_0xe5fee3[_0x2a5a('0x2b')][_0x2a5a('0x33')]('nolimit')){_0x5eff85[_0x2a5a('0x34')]=qs[_0x2a5a('0x34')](_0xe5fee3[_0x2a5a('0x2b')][_0x2a5a('0x34')]);_0x5eff85[_0x2a5a('0x1c')]=qs['offset'](_0xe5fee3['query']['offset']);}_0x5eff85[_0x2a5a('0x35')]=qs[_0x2a5a('0x36')](_0xe5fee3[_0x2a5a('0x2b')][_0x2a5a('0x36')]);_0x5eff85[_0x2a5a('0x37')]=qs[_0x2a5a('0x2d')](_[_0x2a5a('0x38')](_0xe5fee3[_0x2a5a('0x2b')],_0x1c6b57[_0x2a5a('0x2d')]));if(_0xe5fee3['query'][_0x2a5a('0x39')]){_0x5eff85[_0x2a5a('0x37')]=_[_0x2a5a('0x3a')](_0x5eff85[_0x2a5a('0x37')],{'$or':_[_0x2a5a('0x27')](_0x43d4a3,function(_0x168ed0){if(_0x168ed0[_0x2a5a('0x29')]!=='VIRTUAL'){var _0x5b52d6={};_0x5b52d6[_0x168ed0[_0x2a5a('0x25')]]={'$like':'%'+_0xe5fee3[_0x2a5a('0x2b')]['filter']+'%'};return _0x5b52d6;}})});}_0x5eff85=_[_0x2a5a('0x3a')]({},_0x5eff85,_0xe5fee3[_0x2a5a('0x3b')]);var _0x47ca95={'where':_0x5eff85[_0x2a5a('0x37')]};return db[_0x2a5a('0x28')][_0x2a5a('0x1b')](_0x47ca95)[_0x2a5a('0x21')](function(_0x3bfe58){_0x3868b1[_0x2a5a('0x1b')]=_0x3bfe58;if(_0xe5fee3['query'][_0x2a5a('0x3c')]){_0x5eff85[_0x2a5a('0x3d')]=[{'all':!![]}];}return db[_0x2a5a('0x28')]['findAll'](_0x5eff85);})['then'](function(_0x33bcb9){_0x3868b1[_0x2a5a('0x3e')]=_0x33bcb9;return _0x3868b1;})['then'](respondWithFilteredResult(_0x3235fe,_0x5eff85))[_0x2a5a('0x3f')](handleError(_0x3235fe,null));};exports[_0x2a5a('0x40')]=function(_0x464d0a,_0xcedf1e){var _0x4b7903={'raw':!![],'where':{'id':_0x464d0a['params']['id']}},_0x3a75db={};_0x3a75db[_0x2a5a('0x2f')]=_[_0x2a5a('0x2c')](db[_0x2a5a('0x28')][_0x2a5a('0x41')]);_0x3a75db['query']=_[_0x2a5a('0x2c')](_0x464d0a['query']);_0x3a75db[_0x2a5a('0x2d')]=_[_0x2a5a('0x2e')](_0x3a75db['model'],_0x3a75db[_0x2a5a('0x2b')]);_0x4b7903[_0x2a5a('0x32')]=_[_0x2a5a('0x2e')](_0x3a75db[_0x2a5a('0x2f')],qs['fields'](_0x464d0a[_0x2a5a('0x2b')][_0x2a5a('0x30')]));_0x4b7903['attributes']=_0x4b7903[_0x2a5a('0x32')]['length']?_0x4b7903[_0x2a5a('0x32')]:_0x3a75db[_0x2a5a('0x2f')];if(_0x464d0a['query']['includeAll']){_0x4b7903['include']=[{'all':!![]}];}_0x4b7903=_[_0x2a5a('0x3a')]({},_0x4b7903,_0x464d0a[_0x2a5a('0x3b')]);return db['ChatQueueReport'][_0x2a5a('0x42')](_0x4b7903)[_0x2a5a('0x21')](handleEntityNotFound(_0xcedf1e,null))[_0x2a5a('0x21')](respondWithResult(_0xcedf1e,null))['catch'](handleError(_0xcedf1e,null));};exports[_0x2a5a('0x43')]=function(_0x57beb0,_0x41c15b){return db[_0x2a5a('0x28')][_0x2a5a('0x43')](_0x57beb0[_0x2a5a('0x44')],{})[_0x2a5a('0x21')](respondWithResult(_0x41c15b,0xc9))[_0x2a5a('0x3f')](handleError(_0x41c15b,null));};exports[_0x2a5a('0x20')]=function(_0x57d3d0,_0x421858){if(_0x57d3d0['body']['id']){delete _0x57d3d0['body']['id'];}return db[_0x2a5a('0x28')][_0x2a5a('0x42')]({'where':{'id':_0x57d3d0[_0x2a5a('0x45')]['id']}})[_0x2a5a('0x21')](handleEntityNotFound(_0x421858,null))[_0x2a5a('0x21')](saveUpdates(_0x57d3d0[_0x2a5a('0x44')],null))[_0x2a5a('0x21')](respondWithResult(_0x421858,null))['catch'](handleError(_0x421858,null));};exports[_0x2a5a('0x22')]=function(_0x2eb525,_0x5ca8f9){return db[_0x2a5a('0x28')]['find']({'where':{'id':_0x2eb525[_0x2a5a('0x45')]['id']}})['then'](handleEntityNotFound(_0x5ca8f9,null))[_0x2a5a('0x21')](removeEntity(_0x5ca8f9,null))['catch'](handleError(_0x5ca8f9,null));};exports[_0x2a5a('0x46')]=function(_0x29a76d,_0x5048ed){return db[_0x2a5a('0x28')][_0x2a5a('0x46')]()[_0x2a5a('0x21')](respondWithResult(_0x5048ed,null))[_0x2a5a('0x3f')](handleError(_0x5048ed,null));}; \ No newline at end of file +var _0x265a=['rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','findAll','rows','catch','show','include','find','create','body','params','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','status','end','json','offset','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','ChatQueueReport'];(function(_0x2f1aeb,_0x1e452f){var _0x321cc3=function(_0xf43abc){while(--_0xf43abc){_0x2f1aeb['push'](_0x2f1aeb['shift']());}};_0x321cc3(++_0x1e452f);}(_0x265a,0xf9));var _0xa265=function(_0x35dfeb,_0x1172fb){_0x35dfeb=_0x35dfeb-0x0;var _0x517908=_0x265a[_0x35dfeb];return _0x517908;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xa265('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa265('0x1'));var jsonpatch=require(_0xa265('0x2'));var rp=require(_0xa265('0x3'));var moment=require(_0xa265('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xa265('0x5'));var path=require(_0xa265('0x6'));var sox=require(_0xa265('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xa265('0x8'));var crypto=require('crypto');var jsforce=require(_0xa265('0x9'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xa265('0xa'));var Papa=require(_0xa265('0xb'));var Redis=require(_0xa265('0xc'));var authService=require(_0xa265('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0xa265('0xe'));var hardwareService=require(_0xa265('0xf'));var logger=require('../../config/logger')(_0xa265('0x10'));var utils=require(_0xa265('0x11'));var config=require('../../config/environment');var db=require(_0xa265('0x12'))['db'];function respondWithStatusCode(_0x228cf4,_0x102d71){_0x102d71=_0x102d71||0xcc;return function(_0x28017d){if(_0x28017d){return _0x228cf4['sendStatus'](_0x102d71);}return _0x228cf4[_0xa265('0x13')](_0x102d71)[_0xa265('0x14')]();};}function respondWithResult(_0x52cc02,_0x5ee1c3){_0x5ee1c3=_0x5ee1c3||0xc8;return function(_0xc6561f){if(_0xc6561f){return _0x52cc02['status'](_0x5ee1c3)[_0xa265('0x15')](_0xc6561f);}};}function respondWithFilteredResult(_0x5a9c3b,_0x21b631){return function(_0x4f39a5){if(_0x4f39a5){var _0x608415=_0x4f39a5['count'],_0x403349=_0x21b631[_0xa265('0x16')],_0x35d1d2=_0x21b631[_0xa265('0x16')]+_0x21b631['limit'],_0x5a882f;if(_0x35d1d2>=_0x608415){_0x35d1d2=_0x608415;_0x5a882f=0xc8;}else{_0x5a882f=0xce;}_0x5a9c3b[_0xa265('0x13')](_0x5a882f);return _0x5a9c3b[_0xa265('0x17')](_0xa265('0x18'),_0x403349+'-'+_0x35d1d2+'/'+_0x608415)['json'](_0x4f39a5);}return null;};}function patchUpdates(_0xed7467){return function(_0x110685){try{jsonpatch[_0xa265('0x19')](_0x110685,_0xed7467,!![]);}catch(_0x187409){return BPromise[_0xa265('0x1a')](_0x187409);}return _0x110685[_0xa265('0x1b')]();};}function saveUpdates(_0x50d66f,_0x1f592d){return function(_0x418d6b){if(_0x418d6b){return _0x418d6b[_0xa265('0x1c')](_0x50d66f)[_0xa265('0x1d')](function(_0x3cd647){return _0x3cd647;});}return null;};}function removeEntity(_0x1e41eb,_0x164beb){return function(_0x898caf){if(_0x898caf){return _0x898caf[_0xa265('0x1e')]()[_0xa265('0x1d')](function(){_0x1e41eb[_0xa265('0x13')](0xcc)[_0xa265('0x14')]();});}};}function handleEntityNotFound(_0x4fce7c,_0x248e0){return function(_0x41cd84){if(!_0x41cd84){_0x4fce7c[_0xa265('0x1f')](0x194);}return _0x41cd84;};}function handleError(_0x8c44c4,_0x1cad61){_0x1cad61=_0x1cad61||0x1f4;return function(_0x3775c0){logger[_0xa265('0x20')](_0x3775c0[_0xa265('0x21')]);if(_0x3775c0['name']){delete _0x3775c0[_0xa265('0x22')];}_0x8c44c4[_0xa265('0x13')](_0x1cad61)[_0xa265('0x23')](_0x3775c0);};}exports[_0xa265('0x24')]=function(_0x51590c,_0x291bd3){var _0x4dc362={},_0x5e70d0={},_0xd25e8d={'count':0x0,'rows':[]};var _0x5a02e1=_[_0xa265('0x25')](db[_0xa265('0x26')][_0xa265('0x27')],function(_0x17d541){return{'name':_0x17d541['fieldName'],'type':_0x17d541[_0xa265('0x28')][_0xa265('0x29')]};});_0x5e70d0[_0xa265('0x2a')]=_['map'](_0x5a02e1,_0xa265('0x22'));_0x5e70d0[_0xa265('0x2b')]=_[_0xa265('0x2c')](_0x51590c[_0xa265('0x2b')]);_0x5e70d0[_0xa265('0x2d')]=_['intersection'](_0x5e70d0[_0xa265('0x2a')],_0x5e70d0['query']);_0x4dc362[_0xa265('0x2e')]=_[_0xa265('0x2f')](_0x5e70d0[_0xa265('0x2a')],qs[_0xa265('0x30')](_0x51590c[_0xa265('0x2b')][_0xa265('0x30')]));_0x4dc362['attributes']=_0x4dc362[_0xa265('0x2e')][_0xa265('0x31')]?_0x4dc362['attributes']:_0x5e70d0[_0xa265('0x2a')];if(!_0x51590c[_0xa265('0x2b')][_0xa265('0x32')](_0xa265('0x33'))){_0x4dc362['limit']=qs[_0xa265('0x34')](_0x51590c[_0xa265('0x2b')][_0xa265('0x34')]);_0x4dc362[_0xa265('0x16')]=qs[_0xa265('0x16')](_0x51590c['query'][_0xa265('0x16')]);}_0x4dc362['order']=qs[_0xa265('0x35')](_0x51590c['query'][_0xa265('0x35')]);_0x4dc362[_0xa265('0x36')]=qs[_0xa265('0x2d')](_[_0xa265('0x37')](_0x51590c[_0xa265('0x2b')],_0x5e70d0[_0xa265('0x2d')]));if(_0x51590c[_0xa265('0x2b')][_0xa265('0x38')]){_0x4dc362[_0xa265('0x36')]=_[_0xa265('0x39')](_0x4dc362['where'],{'$or':_[_0xa265('0x25')](_0x5a02e1,function(_0x4833fe){if(_0x4833fe[_0xa265('0x28')]!==_0xa265('0x3a')){var _0x2b4878={};_0x2b4878[_0x4833fe[_0xa265('0x22')]]={'$like':'%'+_0x51590c[_0xa265('0x2b')][_0xa265('0x38')]+'%'};return _0x2b4878;}})});}_0x4dc362=_[_0xa265('0x39')]({},_0x4dc362,_0x51590c[_0xa265('0x3b')]);var _0x2ed93f={'where':_0x4dc362[_0xa265('0x36')]};return db[_0xa265('0x26')][_0xa265('0x3c')](_0x2ed93f)[_0xa265('0x1d')](function(_0x4b7f41){_0xd25e8d[_0xa265('0x3c')]=_0x4b7f41;if(_0x51590c[_0xa265('0x2b')][_0xa265('0x3d')]){_0x4dc362['include']=[{'all':!![]}];}return db[_0xa265('0x26')][_0xa265('0x3e')](_0x4dc362);})[_0xa265('0x1d')](function(_0x1973b0){_0xd25e8d[_0xa265('0x3f')]=_0x1973b0;return _0xd25e8d;})[_0xa265('0x1d')](respondWithFilteredResult(_0x291bd3,_0x4dc362))[_0xa265('0x40')](handleError(_0x291bd3,null));};exports[_0xa265('0x41')]=function(_0x446584,_0x5a4967){var _0x4b4919={'raw':!![],'where':{'id':_0x446584['params']['id']}},_0x27855a={};_0x27855a['model']=_[_0xa265('0x2c')](db[_0xa265('0x26')]['rawAttributes']);_0x27855a[_0xa265('0x2b')]=_[_0xa265('0x2c')](_0x446584[_0xa265('0x2b')]);_0x27855a[_0xa265('0x2d')]=_[_0xa265('0x2f')](_0x27855a['model'],_0x27855a['query']);_0x4b4919[_0xa265('0x2e')]=_[_0xa265('0x2f')](_0x27855a['model'],qs['fields'](_0x446584[_0xa265('0x2b')][_0xa265('0x30')]));_0x4b4919['attributes']=_0x4b4919[_0xa265('0x2e')][_0xa265('0x31')]?_0x4b4919[_0xa265('0x2e')]:_0x27855a[_0xa265('0x2a')];if(_0x446584['query'][_0xa265('0x3d')]){_0x4b4919[_0xa265('0x42')]=[{'all':!![]}];}_0x4b4919=_[_0xa265('0x39')]({},_0x4b4919,_0x446584[_0xa265('0x3b')]);return db[_0xa265('0x26')][_0xa265('0x43')](_0x4b4919)['then'](handleEntityNotFound(_0x5a4967,null))[_0xa265('0x1d')](respondWithResult(_0x5a4967,null))[_0xa265('0x40')](handleError(_0x5a4967,null));};exports[_0xa265('0x44')]=function(_0x5b51ad,_0x35d1b2){return db['ChatQueueReport'][_0xa265('0x44')](_0x5b51ad['body'],{})[_0xa265('0x1d')](respondWithResult(_0x35d1b2,0xc9))[_0xa265('0x40')](handleError(_0x35d1b2,null));};exports[_0xa265('0x1c')]=function(_0x4053ba,_0x126a55){if(_0x4053ba[_0xa265('0x45')]['id']){delete _0x4053ba['body']['id'];}return db[_0xa265('0x26')]['find']({'where':{'id':_0x4053ba[_0xa265('0x46')]['id']}})[_0xa265('0x1d')](handleEntityNotFound(_0x126a55,null))['then'](saveUpdates(_0x4053ba[_0xa265('0x45')],null))[_0xa265('0x1d')](respondWithResult(_0x126a55,null))[_0xa265('0x40')](handleError(_0x126a55,null));};exports[_0xa265('0x1e')]=function(_0x372f4a,_0x23d285){return db['ChatQueueReport'][_0xa265('0x43')]({'where':{'id':_0x372f4a[_0xa265('0x46')]['id']}})[_0xa265('0x1d')](handleEntityNotFound(_0x23d285,null))[_0xa265('0x1d')](removeEntity(_0x23d285,null))['catch'](handleError(_0x23d285,null));};exports['describe']=function(_0x3975b4,_0x43b4f8){return db['ChatQueueReport'][_0xa265('0x47')]()[_0xa265('0x1d')](respondWithResult(_0x43b4f8,null))[_0xa265('0x40')](handleError(_0x43b4f8,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index fa0e1e8..9485dd5 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 _0x49f2=['request-promise','path','rimraf','../../config/environment','./chatQueueReport.attributes','exports','ChatQueueReport','report_chat_queue','uniqueid','lodash','../../config/logger','api','moment','bluebird'];(function(_0x47c087,_0x4e6592){var _0xb35aad=function(_0x15823e){while(--_0x15823e){_0x47c087['push'](_0x47c087['shift']());}};_0xb35aad(++_0x4e6592);}(_0x49f2,0x6b));var _0x249f=function(_0x5d7644,_0x33f99a){_0x5d7644=_0x5d7644-0x0;var _0x33eafd=_0x49f2[_0x5d7644];return _0x33eafd;};'use strict';var _=require(_0x249f('0x0'));var util=require('util');var logger=require(_0x249f('0x1'))(_0x249f('0x2'));var moment=require(_0x249f('0x3'));var BPromise=require(_0x249f('0x4'));var rp=require(_0x249f('0x5'));var fs=require('fs');var path=require(_0x249f('0x6'));var rimraf=require(_0x249f('0x7'));var config=require(_0x249f('0x8'));var attributes=require(_0x249f('0x9'));module[_0x249f('0xa')]=function(_0x3f53d8,_0x4b1d4){return _0x3f53d8['define'](_0x249f('0xb'),attributes,{'tableName':_0x249f('0xc'),'paranoid':![],'indexes':[{'name':_0x249f('0xd'),'fields':[_0x249f('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6787=['request-promise','path','../../config/environment','./chatQueueReport.attributes','define','ChatQueueReport','uniqueid','lodash','util','../../config/logger','moment','bluebird'];(function(_0x36d25b,_0x5e1be2){var _0x3fc99e=function(_0x2ea250){while(--_0x2ea250){_0x36d25b['push'](_0x36d25b['shift']());}};_0x3fc99e(++_0x5e1be2);}(_0x6787,0x1db));var _0x7678=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0x6787[_0x311c35];return _0x5cc50c;};'use strict';var _=require(_0x7678('0x0'));var util=require(_0x7678('0x1'));var logger=require(_0x7678('0x2'))('api');var moment=require(_0x7678('0x3'));var BPromise=require(_0x7678('0x4'));var rp=require(_0x7678('0x5'));var fs=require('fs');var path=require(_0x7678('0x6'));var rimraf=require('rimraf');var config=require(_0x7678('0x7'));var attributes=require(_0x7678('0x8'));module['exports']=function(_0xa5f13a,_0x5f5d74){return _0xa5f13a[_0x7678('0x9')](_0x7678('0xa'),attributes,{'tableName':'report_chat_queue','paranoid':![],'indexes':[{'name':_0x7678('0xb'),'fields':[_0x7678('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index 004ba5f..8308a24 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 _0xc522=['options','CreateChatQueueReport','UpdateChatQueueReport','ChatQueueReport','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','body'];(function(_0x176b56,_0x59a871){var _0x1174b7=function(_0xf20f5f){while(--_0xf20f5f){_0x176b56['push'](_0x176b56['shift']());}};_0x1174b7(++_0x59a871);}(_0xc522,0x11d));var _0x2c52=function(_0x4f3217,_0x1e5627){_0x4f3217=_0x4f3217-0x0;var _0xf7d884=_0xc522[_0x4f3217];return _0xf7d884;};'use strict';var _=require(_0x2c52('0x0'));var util=require(_0x2c52('0x1'));var moment=require(_0x2c52('0x2'));var BPromise=require(_0x2c52('0x3'));var rs=require(_0x2c52('0x4'));var fs=require('fs');var Redis=require(_0x2c52('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x2c52('0x6'));var logger=require(_0x2c52('0x7'))(_0x2c52('0x8'));var config=require(_0x2c52('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x2c52('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x16a91b,_0x54e93f,_0x4dfb53){return new BPromise(function(_0x2a837d,_0x2b79f9){return client[_0x2c52('0xb')](_0x16a91b,_0x4dfb53)[_0x2c52('0xc')](function(_0x46d3c8){logger[_0x2c52('0xd')](_0x2c52('0xe'),_0x54e93f,_0x2c52('0xf'));logger[_0x2c52('0x10')](_0x2c52('0x11'),_0x54e93f,_0x2c52('0xf'),JSON[_0x2c52('0x12')](_0x46d3c8));if(_0x46d3c8[_0x2c52('0x13')]){if(_0x46d3c8[_0x2c52('0x13')][_0x2c52('0x14')]===0x1f4){logger[_0x2c52('0x13')]('ChatQueueReport,\x20%s,\x20%s',_0x54e93f,_0x46d3c8[_0x2c52('0x13')][_0x2c52('0x15')]);return _0x2b79f9(_0x46d3c8[_0x2c52('0x13')][_0x2c52('0x15')]);}logger['error']('ChatQueueReport,\x20%s,\x20%s',_0x54e93f,_0x46d3c8['error'][_0x2c52('0x15')]);return _0x2a837d(_0x46d3c8[_0x2c52('0x13')][_0x2c52('0x15')]);}else{logger['info'](_0x2c52('0xe'),_0x54e93f,'request\x20sent');_0x2a837d(_0x46d3c8[_0x2c52('0x16')][_0x2c52('0x15')]);}})[_0x2c52('0x17')](function(_0xda0eb){logger[_0x2c52('0x13')](_0x2c52('0xe'),_0x54e93f,_0xda0eb);_0x2b79f9(_0xda0eb);});});}exports['CreateChatQueueReport']=function(_0x372f04){var _0xa492ba=this;return new Promise(function(_0x59a8fc,_0x588f32){return db['ChatQueueReport']['create'](_0x372f04[_0x2c52('0x18')],{'raw':_0x372f04[_0x2c52('0x19')]?_0x372f04[_0x2c52('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x2c52('0xc')](function(_0x4471b7){logger['info'](_0x2c52('0x1a'),_0x372f04);logger[_0x2c52('0x10')](_0x2c52('0x1a'),_0x372f04,JSON[_0x2c52('0x12')](_0x4471b7));_0x59a8fc(_0x4471b7);})['catch'](function(_0xd8f771){logger['error'](_0x2c52('0x1a'),_0xd8f771['message'],_0x372f04);_0x588f32(_0xa492ba['error'](0x1f4,_0xd8f771[_0x2c52('0x15')]));});});};exports[_0x2c52('0x1b')]=function(_0x1fca72){var _0x3f272b=this;return new Promise(function(_0x2b36d6,_0x29e0c6){return db[_0x2c52('0x1c')]['update'](_0x1fca72[_0x2c52('0x18')],{'raw':_0x1fca72[_0x2c52('0x19')]?_0x1fca72[_0x2c52('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1fca72[_0x2c52('0x19')]?_0x1fca72[_0x2c52('0x19')]['where']||null:null,'attributes':_0x1fca72['options']?_0x1fca72[_0x2c52('0x19')][_0x2c52('0x1d')]||null:null,'limit':_0x1fca72[_0x2c52('0x19')]?_0x1fca72[_0x2c52('0x19')][_0x2c52('0x1e')]||null:null})['then'](function(_0x3ad739){logger[_0x2c52('0xd')]('UpdateChatQueueReport',_0x1fca72);logger[_0x2c52('0x10')](_0x2c52('0x1b'),_0x1fca72,JSON[_0x2c52('0x12')](_0x3ad739));_0x2b36d6(_0x3ad739);})['catch'](function(_0x171e90){logger[_0x2c52('0x13')]('UpdateChatQueueReport',_0x171e90[_0x2c52('0x15')],_0x1fca72);_0x29e0c6(_0x3f272b[_0x2c52('0x13')](0x1f4,_0x171e90[_0x2c52('0x15')]));});});}; \ No newline at end of file +var _0xbb01=['stringify','update','where','attributes','limit','UpdateChatQueueReport','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','ChatQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','result','ChatQueueReport','create','body','options','raw','CreateChatQueueReport'];(function(_0xf80b3,_0x25d5f3){var _0x10c489=function(_0x3c5aee){while(--_0x3c5aee){_0xf80b3['push'](_0xf80b3['shift']());}};_0x10c489(++_0x25d5f3);}(_0xbb01,0x1c9));var _0x1bb0=function(_0x3f4891,_0x4e6f62){_0x3f4891=_0x3f4891-0x0;var _0x54f2d8=_0xbb01[_0x3f4891];return _0x54f2d8;};'use strict';var _=require(_0x1bb0('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x1bb0('0x1'));var rs=require(_0x1bb0('0x2'));var fs=require('fs');var Redis=require(_0x1bb0('0x3'));var db=require(_0x1bb0('0x4'))['db'];var utils=require(_0x1bb0('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x1bb0('0x6'));var jayson=require(_0x1bb0('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5733fa,_0x465f5b,_0x5dfa47){return new BPromise(function(_0x1ca564,_0x197440){return client['request'](_0x5733fa,_0x5dfa47)[_0x1bb0('0x8')](function(_0x328d48){logger[_0x1bb0('0x9')](_0x1bb0('0xa'),_0x465f5b,_0x1bb0('0xb'));logger['debug'](_0x1bb0('0xc'),_0x465f5b,_0x1bb0('0xb'),JSON['stringify'](_0x328d48));if(_0x328d48[_0x1bb0('0xd')]){if(_0x328d48[_0x1bb0('0xd')][_0x1bb0('0xe')]===0x1f4){logger['error'](_0x1bb0('0xa'),_0x465f5b,_0x328d48['error'][_0x1bb0('0xf')]);return _0x197440(_0x328d48[_0x1bb0('0xd')][_0x1bb0('0xf')]);}logger[_0x1bb0('0xd')]('ChatQueueReport,\x20%s,\x20%s',_0x465f5b,_0x328d48[_0x1bb0('0xd')]['message']);return _0x1ca564(_0x328d48[_0x1bb0('0xd')]['message']);}else{logger['info'](_0x1bb0('0xa'),_0x465f5b,_0x1bb0('0xb'));_0x1ca564(_0x328d48[_0x1bb0('0x10')][_0x1bb0('0xf')]);}})['catch'](function(_0x26bc0d){logger[_0x1bb0('0xd')](_0x1bb0('0xa'),_0x465f5b,_0x26bc0d);_0x197440(_0x26bc0d);});});}exports['CreateChatQueueReport']=function(_0x5ee357){var _0x2d18d3=this;return new Promise(function(_0x484dc3,_0x4d3d98){return db[_0x1bb0('0x11')][_0x1bb0('0x12')](_0x5ee357[_0x1bb0('0x13')],{'raw':_0x5ee357[_0x1bb0('0x14')]?_0x5ee357[_0x1bb0('0x14')][_0x1bb0('0x15')]===undefined?!![]:![]:!![]})[_0x1bb0('0x8')](function(_0x2521bd){logger[_0x1bb0('0x9')](_0x1bb0('0x16'),_0x5ee357);logger['debug'](_0x1bb0('0x16'),_0x5ee357,JSON[_0x1bb0('0x17')](_0x2521bd));_0x484dc3(_0x2521bd);})['catch'](function(_0x434337){logger[_0x1bb0('0xd')](_0x1bb0('0x16'),_0x434337[_0x1bb0('0xf')],_0x5ee357);_0x4d3d98(_0x2d18d3[_0x1bb0('0xd')](0x1f4,_0x434337[_0x1bb0('0xf')]));});});};exports['UpdateChatQueueReport']=function(_0x155886){var _0x5836ba=this;return new Promise(function(_0x34137e,_0x2e670e){return db[_0x1bb0('0x11')][_0x1bb0('0x18')](_0x155886[_0x1bb0('0x13')],{'raw':_0x155886['options']?_0x155886[_0x1bb0('0x14')][_0x1bb0('0x15')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x155886[_0x1bb0('0x14')]?_0x155886[_0x1bb0('0x14')][_0x1bb0('0x19')]||null:null,'attributes':_0x155886[_0x1bb0('0x14')]?_0x155886[_0x1bb0('0x14')][_0x1bb0('0x1a')]||null:null,'limit':_0x155886['options']?_0x155886[_0x1bb0('0x14')][_0x1bb0('0x1b')]||null:null})[_0x1bb0('0x8')](function(_0x28dcd6){logger['info'](_0x1bb0('0x1c'),_0x155886);logger['debug'](_0x1bb0('0x1c'),_0x155886,JSON[_0x1bb0('0x17')](_0x28dcd6));_0x34137e(_0x28dcd6);})[_0x1bb0('0x1d')](function(_0x2662ff){logger[_0x1bb0('0xd')](_0x1bb0('0x1c'),_0x2662ff[_0x1bb0('0xf')],_0x155886);_0x2e670e(_0x5836ba[_0x1bb0('0xd')](0x1f4,_0x2662ff[_0x1bb0('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index f6ce871..457ff62 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 _0x5f7d=['isAuthenticated','index','/describe','show','post','create','put','/:id','update','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x55aa81,_0x4c6cbb){var _0x579bae=function(_0x1eab42){while(--_0x1eab42){_0x55aa81['push'](_0x55aa81['shift']());}};_0x579bae(++_0x4c6cbb);}(_0x5f7d,0x173));var _0xd5f7=function(_0x2dcbdf,_0x2a134f){_0x2dcbdf=_0x2dcbdf-0x0;var _0x3fe4f1=_0x5f7d[_0x2dcbdf];return _0x3fe4f1;};'use strict';var multer=require(_0xd5f7('0x0'));var util=require(_0xd5f7('0x1'));var path=require('path');var timeout=require(_0xd5f7('0x2'));var express=require(_0xd5f7('0x3'));var router=express[_0xd5f7('0x4')]();var auth=require(_0xd5f7('0x5'));var interaction=require(_0xd5f7('0x6'));var config=require(_0xd5f7('0x7'));var controller=require('./chatQueueReport.controller');router[_0xd5f7('0x8')]('/',auth[_0xd5f7('0x9')](),controller[_0xd5f7('0xa')]);router[_0xd5f7('0x8')](_0xd5f7('0xb'),auth[_0xd5f7('0x9')](),controller['describe']);router['get']('/:id',auth[_0xd5f7('0x9')](),controller[_0xd5f7('0xc')]);router[_0xd5f7('0xd')]('/',auth[_0xd5f7('0x9')](),controller[_0xd5f7('0xe')]);router[_0xd5f7('0xf')](_0xd5f7('0x10'),auth[_0xd5f7('0x9')](),controller[_0xd5f7('0x11')]);router['delete'](_0xd5f7('0x10'),auth[_0xd5f7('0x9')](),controller['destroy']);module[_0xd5f7('0x12')]=router; \ No newline at end of file +var _0x7345=['describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','isAuthenticated','get','/describe'];(function(_0x3db339,_0x22df2c){var _0x17777f=function(_0xc759de){while(--_0xc759de){_0x3db339['push'](_0x3db339['shift']());}};_0x17777f(++_0x22df2c);}(_0x7345,0xfc));var _0x5734=function(_0x3b0da4,_0x4cf22d){_0x3b0da4=_0x3b0da4-0x0;var _0x52daf0=_0x7345[_0x3b0da4];return _0x52daf0;};'use strict';var multer=require(_0x5734('0x0'));var util=require(_0x5734('0x1'));var path=require('path');var timeout=require(_0x5734('0x2'));var express=require(_0x5734('0x3'));var router=express[_0x5734('0x4')]();var auth=require(_0x5734('0x5'));var interaction=require(_0x5734('0x6'));var config=require(_0x5734('0x7'));var controller=require(_0x5734('0x8'));router['get']('/',auth[_0x5734('0x9')](),controller['index']);router[_0x5734('0xa')](_0x5734('0xb'),auth['isAuthenticated'](),controller[_0x5734('0xc')]);router[_0x5734('0xa')](_0x5734('0xd'),auth[_0x5734('0x9')](),controller[_0x5734('0xe')]);router[_0x5734('0xf')]('/',auth['isAuthenticated'](),controller[_0x5734('0x10')]);router[_0x5734('0x11')]('/:id',auth[_0x5734('0x9')](),controller[_0x5734('0x12')]);router[_0x5734('0x13')](_0x5734('0xd'),auth[_0x5734('0x9')](),controller[_0x5734('0x14')]);module[_0x5734('0x15')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index 2b3371f..af98d64 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 _0xe43c=['account','agent','queue','DATE','NOW','sequelize','exports','STRING','ENUM'];(function(_0x390caf,_0x53b3f2){var _0x26f502=function(_0x3e55ce){while(--_0x3e55ce){_0x390caf['push'](_0x390caf['shift']());}};_0x26f502(++_0x53b3f2);}(_0xe43c,0x188));var _0xce43=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xe43c[_0x42cae2];return _0x5f256f;};'use strict';var moment=require('moment');var Sequelize=require(_0xce43('0x0'));module[_0xce43('0x1')]={'uniqueid':{'type':Sequelize[_0xce43('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xce43('0x3')](_0xce43('0x4'),_0xce43('0x5'),_0xce43('0x6')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0xce43('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xce43('0x8')]}}; \ No newline at end of file +var _0xe3c2=['ENUM','account','agent','queue','DATE','NOW','moment','STRING'];(function(_0x4727f1,_0x2ff773){var _0x2977ce=function(_0x29be89){while(--_0x29be89){_0x4727f1['push'](_0x4727f1['shift']());}};_0x2977ce(++_0x2ff773);}(_0xe3c2,0x1c6));var _0x2e3c=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0xe3c2[_0x5c351c];return _0x26f3b3;};'use strict';var moment=require(_0x2e3c('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x2e3c('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x2e3c('0x2')](_0x2e3c('0x3'),_0x2e3c('0x4'),_0x2e3c('0x5')),'allowNull':![],'defaultValue':_0x2e3c('0x5')},'transferredAt':{'type':Sequelize[_0x2e3c('0x6')],'allowNull':![],'defaultValue':Sequelize[_0x2e3c('0x7')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index 7736713..4a59d64 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 _0x14f3=['model','map','query','filters','intersection','fields','attributes','length','hasOwnProperty','limit','order','sort','where','pick','filter','merge','VIRTUAL','ChatTransferReport','then','includeAll','findAll','catch','show','params','keys','rawAttributes','include','options','create','body','find','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','status','end','json','count','offset','set','Content-Range','apply','save','update','destroy','stack','name','send','index','type','key'];(function(_0x5dbc49,_0x152d91){var _0x124b24=function(_0x55a1f0){while(--_0x55a1f0){_0x5dbc49['push'](_0x5dbc49['shift']());}};_0x124b24(++_0x152d91);}(_0x14f3,0x69));var _0x314f=function(_0x4991d4,_0x33bd78){_0x4991d4=_0x4991d4-0x0;var _0x3d49ab=_0x14f3[_0x4991d4];return _0x3d49ab;};'use strict';var pdf=require(_0x314f('0x0'));var emlformat=require(_0x314f('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x314f('0x2'));var jsonpatch=require(_0x314f('0x3'));var rp=require(_0x314f('0x4'));var moment=require(_0x314f('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x314f('0x6'));var util=require(_0x314f('0x7'));var path=require('path');var sox=require(_0x314f('0x8'));var csv=require(_0x314f('0x9'));var ejs=require(_0x314f('0xa'));var fs=require('fs');var _=require(_0x314f('0xb'));var squel=require(_0x314f('0xc'));var crypto=require(_0x314f('0xd'));var jsforce=require(_0x314f('0xe'));var deskjs=require(_0x314f('0xf'));var toCsv=require(_0x314f('0x9'));var querystring=require('querystring');var Papa=require(_0x314f('0x10'));var Redis=require(_0x314f('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x314f('0x12'));var hardwareService=require(_0x314f('0x13'));var logger=require(_0x314f('0x14'))(_0x314f('0x15'));var utils=require(_0x314f('0x16'));var config=require(_0x314f('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3c61b4,_0x4851ca){_0x4851ca=_0x4851ca||0xcc;return function(_0x4cd76a){if(_0x4cd76a){return _0x3c61b4['sendStatus'](_0x4851ca);}return _0x3c61b4[_0x314f('0x18')](_0x4851ca)[_0x314f('0x19')]();};}function respondWithResult(_0x2bcb3d,_0xe21cb0){_0xe21cb0=_0xe21cb0||0xc8;return function(_0x41353e){if(_0x41353e){return _0x2bcb3d[_0x314f('0x18')](_0xe21cb0)[_0x314f('0x1a')](_0x41353e);}};}function respondWithFilteredResult(_0x4d8a03,_0x554678){return function(_0x2eb1a4){if(_0x2eb1a4){var _0x55a41a=_0x2eb1a4[_0x314f('0x1b')],_0x4e394c=_0x554678[_0x314f('0x1c')],_0xb4678e=_0x554678[_0x314f('0x1c')]+_0x554678['limit'],_0x5b56a8;if(_0xb4678e>=_0x55a41a){_0xb4678e=_0x55a41a;_0x5b56a8=0xc8;}else{_0x5b56a8=0xce;}_0x4d8a03['status'](_0x5b56a8);return _0x4d8a03[_0x314f('0x1d')](_0x314f('0x1e'),_0x4e394c+'-'+_0xb4678e+'/'+_0x55a41a)[_0x314f('0x1a')](_0x2eb1a4);}return null;};}function patchUpdates(_0x617f00){return function(_0x1836d7){try{jsonpatch[_0x314f('0x1f')](_0x1836d7,_0x617f00,!![]);}catch(_0x17541e){return BPromise['reject'](_0x17541e);}return _0x1836d7[_0x314f('0x20')]();};}function saveUpdates(_0x430c16,_0x1d7a58){return function(_0x468690){if(_0x468690){return _0x468690[_0x314f('0x21')](_0x430c16)['then'](function(_0x3d0914){return _0x3d0914;});}return null;};}function removeEntity(_0xe84bbb,_0x5c8159){return function(_0x11b4fe){if(_0x11b4fe){return _0x11b4fe[_0x314f('0x22')]()['then'](function(){_0xe84bbb[_0x314f('0x18')](0xcc)[_0x314f('0x19')]();});}};}function handleEntityNotFound(_0x33c657,_0x598240){return function(_0x44efdf){if(!_0x44efdf){_0x33c657['sendStatus'](0x194);}return _0x44efdf;};}function handleError(_0x3b8da6,_0x5ce0cf){_0x5ce0cf=_0x5ce0cf||0x1f4;return function(_0x391fca){logger['error'](_0x391fca[_0x314f('0x23')]);if(_0x391fca[_0x314f('0x24')]){delete _0x391fca[_0x314f('0x24')];}_0x3b8da6[_0x314f('0x18')](_0x5ce0cf)[_0x314f('0x25')](_0x391fca);};}exports[_0x314f('0x26')]=function(_0x5d4832,_0x488f02){var _0x3b551e={},_0x16217f={},_0x5c7651={'count':0x0,'rows':[]};var _0x3feca1=_['map'](db['ChatTransferReport']['rawAttributes'],function(_0x27a27b){return{'name':_0x27a27b['fieldName'],'type':_0x27a27b[_0x314f('0x27')][_0x314f('0x28')]};});_0x16217f[_0x314f('0x29')]=_[_0x314f('0x2a')](_0x3feca1,_0x314f('0x24'));_0x16217f[_0x314f('0x2b')]=_['keys'](_0x5d4832[_0x314f('0x2b')]);_0x16217f[_0x314f('0x2c')]=_[_0x314f('0x2d')](_0x16217f[_0x314f('0x29')],_0x16217f[_0x314f('0x2b')]);_0x3b551e['attributes']=_[_0x314f('0x2d')](_0x16217f[_0x314f('0x29')],qs[_0x314f('0x2e')](_0x5d4832['query'][_0x314f('0x2e')]));_0x3b551e['attributes']=_0x3b551e[_0x314f('0x2f')][_0x314f('0x30')]?_0x3b551e[_0x314f('0x2f')]:_0x16217f['model'];if(!_0x5d4832['query'][_0x314f('0x31')]('nolimit')){_0x3b551e[_0x314f('0x32')]=qs[_0x314f('0x32')](_0x5d4832[_0x314f('0x2b')][_0x314f('0x32')]);_0x3b551e[_0x314f('0x1c')]=qs['offset'](_0x5d4832[_0x314f('0x2b')][_0x314f('0x1c')]);}_0x3b551e[_0x314f('0x33')]=qs[_0x314f('0x34')](_0x5d4832['query'][_0x314f('0x34')]);_0x3b551e[_0x314f('0x35')]=qs[_0x314f('0x2c')](_[_0x314f('0x36')](_0x5d4832['query'],_0x16217f[_0x314f('0x2c')]));if(_0x5d4832[_0x314f('0x2b')][_0x314f('0x37')]){_0x3b551e['where']=_[_0x314f('0x38')](_0x3b551e['where'],{'$or':_[_0x314f('0x2a')](_0x3feca1,function(_0x33471f){if(_0x33471f[_0x314f('0x27')]!==_0x314f('0x39')){var _0x46de00={};_0x46de00[_0x33471f[_0x314f('0x24')]]={'$like':'%'+_0x5d4832['query'][_0x314f('0x37')]+'%'};return _0x46de00;}})});}_0x3b551e=_[_0x314f('0x38')]({},_0x3b551e,_0x5d4832['options']);var _0x3cca3c={'where':_0x3b551e[_0x314f('0x35')]};return db[_0x314f('0x3a')][_0x314f('0x1b')](_0x3cca3c)[_0x314f('0x3b')](function(_0x10dc0d){_0x5c7651[_0x314f('0x1b')]=_0x10dc0d;if(_0x5d4832[_0x314f('0x2b')][_0x314f('0x3c')]){_0x3b551e['include']=[{'all':!![]}];}return db[_0x314f('0x3a')][_0x314f('0x3d')](_0x3b551e);})['then'](function(_0x310a3b){_0x5c7651['rows']=_0x310a3b;return _0x5c7651;})[_0x314f('0x3b')](respondWithFilteredResult(_0x488f02,_0x3b551e))[_0x314f('0x3e')](handleError(_0x488f02,null));};exports[_0x314f('0x3f')]=function(_0x3fd234,_0x198c5d){var _0x4ef96b={'raw':!![],'where':{'id':_0x3fd234[_0x314f('0x40')]['id']}},_0x3c4d2e={};_0x3c4d2e[_0x314f('0x29')]=_[_0x314f('0x41')](db[_0x314f('0x3a')][_0x314f('0x42')]);_0x3c4d2e[_0x314f('0x2b')]=_['keys'](_0x3fd234[_0x314f('0x2b')]);_0x3c4d2e[_0x314f('0x2c')]=_[_0x314f('0x2d')](_0x3c4d2e[_0x314f('0x29')],_0x3c4d2e['query']);_0x4ef96b[_0x314f('0x2f')]=_[_0x314f('0x2d')](_0x3c4d2e['model'],qs[_0x314f('0x2e')](_0x3fd234[_0x314f('0x2b')][_0x314f('0x2e')]));_0x4ef96b[_0x314f('0x2f')]=_0x4ef96b[_0x314f('0x2f')]['length']?_0x4ef96b[_0x314f('0x2f')]:_0x3c4d2e[_0x314f('0x29')];if(_0x3fd234['query'][_0x314f('0x3c')]){_0x4ef96b[_0x314f('0x43')]=[{'all':!![]}];}_0x4ef96b=_[_0x314f('0x38')]({},_0x4ef96b,_0x3fd234[_0x314f('0x44')]);return db[_0x314f('0x3a')]['find'](_0x4ef96b)[_0x314f('0x3b')](handleEntityNotFound(_0x198c5d,null))[_0x314f('0x3b')](respondWithResult(_0x198c5d,null))[_0x314f('0x3e')](handleError(_0x198c5d,null));};exports[_0x314f('0x45')]=function(_0x3ae3f9,_0xacc8b6){return db[_0x314f('0x3a')][_0x314f('0x45')](_0x3ae3f9[_0x314f('0x46')],{})['then'](respondWithResult(_0xacc8b6,0xc9))['catch'](handleError(_0xacc8b6,null));};exports[_0x314f('0x21')]=function(_0x535ec8,_0xe809af){if(_0x535ec8['body']['id']){delete _0x535ec8[_0x314f('0x46')]['id'];}return db[_0x314f('0x3a')][_0x314f('0x47')]({'where':{'id':_0x535ec8[_0x314f('0x40')]['id']}})[_0x314f('0x3b')](handleEntityNotFound(_0xe809af,null))[_0x314f('0x3b')](saveUpdates(_0x535ec8[_0x314f('0x46')],null))[_0x314f('0x3b')](respondWithResult(_0xe809af,null))[_0x314f('0x3e')](handleError(_0xe809af,null));};exports['destroy']=function(_0x2f8a06,_0x452a02){return db[_0x314f('0x3a')][_0x314f('0x47')]({'where':{'id':_0x2f8a06[_0x314f('0x40')]['id']}})[_0x314f('0x3b')](handleEntityNotFound(_0x452a02,null))[_0x314f('0x3b')](removeEntity(_0x452a02,null))[_0x314f('0x3e')](handleError(_0x452a02,null));};exports[_0x314f('0x48')]=function(_0x367bc9,_0x23629e){return db['ChatTransferReport'][_0x314f('0x48')]()[_0x314f('0x3b')](respondWithResult(_0x23629e,null))[_0x314f('0x3e')](handleError(_0x23629e,null));}; \ No newline at end of file +var _0x81d1=['../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','count','offset','set','Content-Range','json','apply','save','update','then','destroy','error','stack','name','send','ChatTransferReport','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','map','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','html-pdf','fast-json-patch','request-promise','moment','util','path','sox','ejs','lodash','crypto','jsforce','to-csv','querystring','ioredis','../../components/parsers/qs'];(function(_0x422ca7,_0x2349aa){var _0x3b5972=function(_0x1c4b68){while(--_0x1c4b68){_0x422ca7['push'](_0x422ca7['shift']());}};_0x3b5972(++_0x2349aa);}(_0x81d1,0x111));var _0x181d=function(_0xc82d1a,_0x145c50){_0xc82d1a=_0xc82d1a-0x0;var _0x32fad2=_0x81d1[_0xc82d1a];return _0x32fad2;};'use strict';var pdf=require(_0x181d('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x181d('0x1'));var rp=require(_0x181d('0x2'));var moment=require(_0x181d('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x181d('0x4'));var path=require(_0x181d('0x5'));var sox=require(_0x181d('0x6'));var csv=require('to-csv');var ejs=require(_0x181d('0x7'));var fs=require('fs');var _=require(_0x181d('0x8'));var squel=require('squel');var crypto=require(_0x181d('0x9'));var jsforce=require(_0x181d('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x181d('0xb'));var querystring=require(_0x181d('0xc'));var Papa=require('papaparse');var Redis=require(_0x181d('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x181d('0xe'));var as=require(_0x181d('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x181d('0x10'))(_0x181d('0x11'));var utils=require(_0x181d('0x12'));var config=require('../../config/environment');var db=require(_0x181d('0x13'))['db'];function respondWithStatusCode(_0x33802f,_0x30bd28){_0x30bd28=_0x30bd28||0xcc;return function(_0x35528f){if(_0x35528f){return _0x33802f[_0x181d('0x14')](_0x30bd28);}return _0x33802f[_0x181d('0x15')](_0x30bd28)[_0x181d('0x16')]();};}function respondWithResult(_0x1cc467,_0x331221){_0x331221=_0x331221||0xc8;return function(_0x485859){if(_0x485859){return _0x1cc467[_0x181d('0x15')](_0x331221)['json'](_0x485859);}};}function respondWithFilteredResult(_0x5c5c35,_0x527d3b){return function(_0xadadb9){if(_0xadadb9){var _0xff2746=_0xadadb9[_0x181d('0x17')],_0x3962e5=_0x527d3b[_0x181d('0x18')],_0x3ba0e3=_0x527d3b['offset']+_0x527d3b['limit'],_0x4a57dc;if(_0x3ba0e3>=_0xff2746){_0x3ba0e3=_0xff2746;_0x4a57dc=0xc8;}else{_0x4a57dc=0xce;}_0x5c5c35[_0x181d('0x15')](_0x4a57dc);return _0x5c5c35[_0x181d('0x19')](_0x181d('0x1a'),_0x3962e5+'-'+_0x3ba0e3+'/'+_0xff2746)[_0x181d('0x1b')](_0xadadb9);}return null;};}function patchUpdates(_0xad11e4){return function(_0x5e9fbf){try{jsonpatch[_0x181d('0x1c')](_0x5e9fbf,_0xad11e4,!![]);}catch(_0xc68dc5){return BPromise['reject'](_0xc68dc5);}return _0x5e9fbf[_0x181d('0x1d')]();};}function saveUpdates(_0x429c31,_0xa5c6f7){return function(_0x1d7930){if(_0x1d7930){return _0x1d7930[_0x181d('0x1e')](_0x429c31)[_0x181d('0x1f')](function(_0x4adb37){return _0x4adb37;});}return null;};}function removeEntity(_0x5bb7c4,_0x3e3cbc){return function(_0x135824){if(_0x135824){return _0x135824[_0x181d('0x20')]()[_0x181d('0x1f')](function(){_0x5bb7c4[_0x181d('0x15')](0xcc)[_0x181d('0x16')]();});}};}function handleEntityNotFound(_0x3d25b9,_0xff8473){return function(_0x4086ae){if(!_0x4086ae){_0x3d25b9[_0x181d('0x14')](0x194);}return _0x4086ae;};}function handleError(_0x1a42a1,_0x17ca53){_0x17ca53=_0x17ca53||0x1f4;return function(_0x590ad5){logger[_0x181d('0x21')](_0x590ad5[_0x181d('0x22')]);if(_0x590ad5['name']){delete _0x590ad5[_0x181d('0x23')];}_0x1a42a1['status'](_0x17ca53)[_0x181d('0x24')](_0x590ad5);};}exports['index']=function(_0x5debb9,_0x3bc5e3){var _0x937bba={},_0x5cb649={},_0x27bce8={'count':0x0,'rows':[]};var _0xa6f7d9=_['map'](db[_0x181d('0x25')]['rawAttributes'],function(_0x34afe3){return{'name':_0x34afe3[_0x181d('0x26')],'type':_0x34afe3['type'][_0x181d('0x27')]};});_0x5cb649[_0x181d('0x28')]=_['map'](_0xa6f7d9,_0x181d('0x23'));_0x5cb649[_0x181d('0x29')]=_[_0x181d('0x2a')](_0x5debb9['query']);_0x5cb649[_0x181d('0x2b')]=_[_0x181d('0x2c')](_0x5cb649[_0x181d('0x28')],_0x5cb649[_0x181d('0x29')]);_0x937bba[_0x181d('0x2d')]=_[_0x181d('0x2c')](_0x5cb649[_0x181d('0x28')],qs[_0x181d('0x2e')](_0x5debb9['query']['fields']));_0x937bba[_0x181d('0x2d')]=_0x937bba[_0x181d('0x2d')][_0x181d('0x2f')]?_0x937bba[_0x181d('0x2d')]:_0x5cb649[_0x181d('0x28')];if(!_0x5debb9[_0x181d('0x29')][_0x181d('0x30')](_0x181d('0x31'))){_0x937bba[_0x181d('0x32')]=qs['limit'](_0x5debb9['query'][_0x181d('0x32')]);_0x937bba[_0x181d('0x18')]=qs[_0x181d('0x18')](_0x5debb9['query'][_0x181d('0x18')]);}_0x937bba[_0x181d('0x33')]=qs[_0x181d('0x34')](_0x5debb9['query'][_0x181d('0x34')]);_0x937bba['where']=qs['filters'](_[_0x181d('0x35')](_0x5debb9[_0x181d('0x29')],_0x5cb649['filters']));if(_0x5debb9[_0x181d('0x29')][_0x181d('0x36')]){_0x937bba[_0x181d('0x37')]=_[_0x181d('0x38')](_0x937bba['where'],{'$or':_[_0x181d('0x39')](_0xa6f7d9,function(_0x13de94){if(_0x13de94[_0x181d('0x3a')]!==_0x181d('0x3b')){var _0x3591ca={};_0x3591ca[_0x13de94[_0x181d('0x23')]]={'$like':'%'+_0x5debb9[_0x181d('0x29')][_0x181d('0x36')]+'%'};return _0x3591ca;}})});}_0x937bba=_[_0x181d('0x38')]({},_0x937bba,_0x5debb9[_0x181d('0x3c')]);var _0x1520e4={'where':_0x937bba['where']};return db[_0x181d('0x25')][_0x181d('0x17')](_0x1520e4)['then'](function(_0x563f81){_0x27bce8[_0x181d('0x17')]=_0x563f81;if(_0x5debb9[_0x181d('0x29')][_0x181d('0x3d')]){_0x937bba[_0x181d('0x3e')]=[{'all':!![]}];}return db[_0x181d('0x25')][_0x181d('0x3f')](_0x937bba);})[_0x181d('0x1f')](function(_0x50f500){_0x27bce8[_0x181d('0x40')]=_0x50f500;return _0x27bce8;})['then'](respondWithFilteredResult(_0x3bc5e3,_0x937bba))[_0x181d('0x41')](handleError(_0x3bc5e3,null));};exports[_0x181d('0x42')]=function(_0x4a43f8,_0x3c2fef){var _0x43663b={'raw':!![],'where':{'id':_0x4a43f8[_0x181d('0x43')]['id']}},_0x5899f8={};_0x5899f8[_0x181d('0x28')]=_[_0x181d('0x2a')](db[_0x181d('0x25')]['rawAttributes']);_0x5899f8[_0x181d('0x29')]=_[_0x181d('0x2a')](_0x4a43f8[_0x181d('0x29')]);_0x5899f8['filters']=_[_0x181d('0x2c')](_0x5899f8[_0x181d('0x28')],_0x5899f8[_0x181d('0x29')]);_0x43663b['attributes']=_[_0x181d('0x2c')](_0x5899f8['model'],qs['fields'](_0x4a43f8[_0x181d('0x29')]['fields']));_0x43663b[_0x181d('0x2d')]=_0x43663b[_0x181d('0x2d')]['length']?_0x43663b[_0x181d('0x2d')]:_0x5899f8[_0x181d('0x28')];if(_0x4a43f8[_0x181d('0x29')][_0x181d('0x3d')]){_0x43663b['include']=[{'all':!![]}];}_0x43663b=_[_0x181d('0x38')]({},_0x43663b,_0x4a43f8[_0x181d('0x3c')]);return db[_0x181d('0x25')][_0x181d('0x44')](_0x43663b)[_0x181d('0x1f')](handleEntityNotFound(_0x3c2fef,null))['then'](respondWithResult(_0x3c2fef,null))[_0x181d('0x41')](handleError(_0x3c2fef,null));};exports[_0x181d('0x45')]=function(_0x1d43e7,_0x29844a){return db[_0x181d('0x25')][_0x181d('0x45')](_0x1d43e7[_0x181d('0x46')],{})[_0x181d('0x1f')](respondWithResult(_0x29844a,0xc9))[_0x181d('0x41')](handleError(_0x29844a,null));};exports[_0x181d('0x1e')]=function(_0x74c370,_0x2a1196){if(_0x74c370[_0x181d('0x46')]['id']){delete _0x74c370['body']['id'];}return db['ChatTransferReport']['find']({'where':{'id':_0x74c370['params']['id']}})[_0x181d('0x1f')](handleEntityNotFound(_0x2a1196,null))[_0x181d('0x1f')](saveUpdates(_0x74c370[_0x181d('0x46')],null))[_0x181d('0x1f')](respondWithResult(_0x2a1196,null))[_0x181d('0x41')](handleError(_0x2a1196,null));};exports['destroy']=function(_0x248613,_0x47e9e0){return db[_0x181d('0x25')][_0x181d('0x44')]({'where':{'id':_0x248613['params']['id']}})[_0x181d('0x1f')](handleEntityNotFound(_0x47e9e0,null))[_0x181d('0x1f')](removeEntity(_0x47e9e0,null))[_0x181d('0x41')](handleError(_0x47e9e0,null));};exports[_0x181d('0x47')]=function(_0x31f741,_0x13e543){return db[_0x181d('0x25')]['describe']()[_0x181d('0x1f')](respondWithResult(_0x13e543,null))['catch'](handleError(_0x13e543,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index c0da54d..506899b 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 _0xa395=['util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./chatTransferReport.attributes','exports','define','uniqueid','lodash'];(function(_0x2bd18c,_0x479977){var _0x3be350=function(_0x4c7d96){while(--_0x4c7d96){_0x2bd18c['push'](_0x2bd18c['shift']());}};_0x3be350(++_0x479977);}(_0xa395,0x14f));var _0x5a39=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0xa395[_0x2a6809];return _0x11c371;};'use strict';var _=require(_0x5a39('0x0'));var util=require(_0x5a39('0x1'));var logger=require(_0x5a39('0x2'))('api');var moment=require(_0x5a39('0x3'));var BPromise=require(_0x5a39('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5a39('0x5'));var rimraf=require(_0x5a39('0x6'));var config=require(_0x5a39('0x7'));var attributes=require(_0x5a39('0x8'));module[_0x5a39('0x9')]=function(_0x178b5f,_0x261187){return _0x178b5f[_0x5a39('0xa')]('ChatTransferReport',attributes,{'tableName':'report_chat_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x5a39('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xbdfe=['report_chat_transfer','uniqueid','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./chatTransferReport.attributes','define'];(function(_0xa22c2d,_0x6502b1){var _0x5a6f36=function(_0x366424){while(--_0x366424){_0xa22c2d['push'](_0xa22c2d['shift']());}};_0x5a6f36(++_0x6502b1);}(_0xbdfe,0xbd));var _0xebdf=function(_0x38aeea,_0x57522a){_0x38aeea=_0x38aeea-0x0;var _0x5e8d2c=_0xbdfe[_0x38aeea];return _0x5e8d2c;};'use strict';var _=require('lodash');var util=require(_0xebdf('0x0'));var logger=require(_0xebdf('0x1'))(_0xebdf('0x2'));var moment=require('moment');var BPromise=require(_0xebdf('0x3'));var rp=require(_0xebdf('0x4'));var fs=require('fs');var path=require(_0xebdf('0x5'));var rimraf=require(_0xebdf('0x6'));var config=require('../../config/environment');var attributes=require(_0xebdf('0x7'));module['exports']=function(_0xeec16d,_0x1b51a3){return _0xeec16d[_0xebdf('0x8')]('ChatTransferReport',attributes,{'tableName':_0xebdf('0x9'),'paranoid':![],'indexes':[{'name':_0xebdf('0xa'),'fields':[_0xebdf('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index f2aca55..e308ca2 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 _0x207e=['error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','ChatTransferReport,\x20%s,\x20%s','ChatTransferReport,\x20%s,\x20%s,\x20%s'];(function(_0x5f4cbe,_0x454b60){var _0x68e362=function(_0x499c05){while(--_0x499c05){_0x5f4cbe['push'](_0x5f4cbe['shift']());}};_0x68e362(++_0x454b60);}(_0x207e,0x1bf));var _0xe207=function(_0x50f3e8,_0x57ddec){_0x50f3e8=_0x50f3e8-0x0;var _0x4797a6=_0x207e[_0x50f3e8];return _0x4797a6;};'use strict';var _=require(_0xe207('0x0'));var util=require(_0xe207('0x1'));var moment=require(_0xe207('0x2'));var BPromise=require('bluebird');var rs=require(_0xe207('0x3'));var fs=require('fs');var Redis=require(_0xe207('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xe207('0x5'));var logger=require(_0xe207('0x6'))(_0xe207('0x7'));var config=require(_0xe207('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xe207('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x36b204,_0x48a94f,_0x1f2386){return new BPromise(function(_0x34ac77,_0x8e4633){return client[_0xe207('0xa')](_0x36b204,_0x1f2386)[_0xe207('0xb')](function(_0x547e19){logger[_0xe207('0xc')](_0xe207('0xd'),_0x48a94f,'request\x20sent');logger['debug'](_0xe207('0xe'),_0x48a94f,'request\x20sent',JSON['stringify'](_0x547e19));if(_0x547e19[_0xe207('0xf')]){if(_0x547e19[_0xe207('0xf')][_0xe207('0x10')]===0x1f4){logger[_0xe207('0xf')]('ChatTransferReport,\x20%s,\x20%s',_0x48a94f,_0x547e19[_0xe207('0xf')]['message']);return _0x8e4633(_0x547e19[_0xe207('0xf')]['message']);}logger[_0xe207('0xf')]('ChatTransferReport,\x20%s,\x20%s',_0x48a94f,_0x547e19['error'][_0xe207('0x11')]);return _0x34ac77(_0x547e19['error'][_0xe207('0x11')]);}else{logger[_0xe207('0xc')](_0xe207('0xd'),_0x48a94f,_0xe207('0x12'));_0x34ac77(_0x547e19[_0xe207('0x13')][_0xe207('0x11')]);}})[_0xe207('0x14')](function(_0x4b0e7c){logger[_0xe207('0xf')]('ChatTransferReport,\x20%s,\x20%s',_0x48a94f,_0x4b0e7c);_0x8e4633(_0x4b0e7c);});});} \ No newline at end of file +var _0xb0bc=['result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','ChatTransferReport,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x3abca6,_0x484cde){var _0x347757=function(_0x4bb092){while(--_0x4bb092){_0x3abca6['push'](_0x3abca6['shift']());}};_0x347757(++_0x484cde);}(_0xb0bc,0xf2));var _0xcb0b=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xb0bc[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xcb0b('0x0'));var util=require(_0xcb0b('0x1'));var moment=require(_0xcb0b('0x2'));var BPromise=require(_0xcb0b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcb0b('0x4'));var db=require(_0xcb0b('0x5'))['db'];var utils=require(_0xcb0b('0x6'));var logger=require(_0xcb0b('0x7'))(_0xcb0b('0x8'));var config=require(_0xcb0b('0x9'));var jayson=require(_0xcb0b('0xa'));var client=jayson[_0xcb0b('0xb')][_0xcb0b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x259d8b,_0x386d72,_0x271c9f){return new BPromise(function(_0x655787,_0x27fcc6){return client[_0xcb0b('0xd')](_0x259d8b,_0x271c9f)[_0xcb0b('0xe')](function(_0x923f2c){logger[_0xcb0b('0xf')](_0xcb0b('0x10'),_0x386d72,_0xcb0b('0x11'));logger['debug'](_0xcb0b('0x12'),_0x386d72,_0xcb0b('0x11'),JSON['stringify'](_0x923f2c));if(_0x923f2c[_0xcb0b('0x13')]){if(_0x923f2c[_0xcb0b('0x13')][_0xcb0b('0x14')]===0x1f4){logger[_0xcb0b('0x13')]('ChatTransferReport,\x20%s,\x20%s',_0x386d72,_0x923f2c[_0xcb0b('0x13')]['message']);return _0x27fcc6(_0x923f2c['error'][_0xcb0b('0x15')]);}logger[_0xcb0b('0x13')](_0xcb0b('0x10'),_0x386d72,_0x923f2c[_0xcb0b('0x13')][_0xcb0b('0x15')]);return _0x655787(_0x923f2c['error'][_0xcb0b('0x15')]);}else{logger[_0xcb0b('0xf')](_0xcb0b('0x10'),_0x386d72,_0xcb0b('0x11'));_0x655787(_0x923f2c[_0xcb0b('0x16')]['message']);}})[_0xcb0b('0x17')](function(_0x44bab8){logger[_0xcb0b('0x13')](_0xcb0b('0x10'),_0x386d72,_0x44bab8);_0x27fcc6(_0x44bab8);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index a839712..a5b4a4b 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 _0xb10b=['../../config/environment','./chatTransferReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create','update','delete','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service'];(function(_0x123623,_0x9694e2){var _0x3b00d1=function(_0x7e48e0){while(--_0x7e48e0){_0x123623['push'](_0x123623['shift']());}};_0x3b00d1(++_0x9694e2);}(_0xb10b,0x12a));var _0xbb10=function(_0x5c918d,_0x1ca4a7){_0x5c918d=_0x5c918d-0x0;var _0x3c4d98=_0xb10b[_0x5c918d];return _0x3c4d98;};'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 +var _0x0b0e=['multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatTransferReport.controller','get','isAuthenticated','index','/describe','/:id','show','create','delete','exports'];(function(_0x2c04c6,_0x582725){var _0x5c4d9f=function(_0x3ab5e7){while(--_0x3ab5e7){_0x2c04c6['push'](_0x2c04c6['shift']());}};_0x5c4d9f(++_0x582725);}(_0x0b0e,0x187));var _0xe0b0=function(_0x3fe042,_0x1106f7){_0x3fe042=_0x3fe042-0x0;var _0x7d4a1f=_0x0b0e[_0x3fe042];return _0x7d4a1f;};'use strict';var multer=require(_0xe0b0('0x0'));var util=require('util');var path=require(_0xe0b0('0x1'));var timeout=require('connect-timeout');var express=require(_0xe0b0('0x2'));var router=express[_0xe0b0('0x3')]();var auth=require(_0xe0b0('0x4'));var interaction=require(_0xe0b0('0x5'));var config=require(_0xe0b0('0x6'));var controller=require(_0xe0b0('0x7'));router[_0xe0b0('0x8')]('/',auth[_0xe0b0('0x9')](),controller[_0xe0b0('0xa')]);router[_0xe0b0('0x8')](_0xe0b0('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0xe0b0('0x8')](_0xe0b0('0xc'),auth[_0xe0b0('0x9')](),controller[_0xe0b0('0xd')]);router['post']('/',auth[_0xe0b0('0x9')](),controller[_0xe0b0('0xe')]);router['put'](_0xe0b0('0xc'),auth[_0xe0b0('0x9')](),controller['update']);router[_0xe0b0('0xf')](_0xe0b0('0xc'),auth[_0xe0b0('0x9')](),controller['destroy']);module[_0xe0b0('0x10')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index 83349b8..80aa202 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 _0xb344=['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.','Skip','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','alternate','System','mandatoryDispositionPauseId','sequelize','randomstring','exports','STRING','address','Agent','#9f946a','#ffffff','BOOLEAN','ENUM','rounded','squared','Chat','Send','Contact\x20us','INTEGER','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Feedback','star','thumb','stringify','input','name','text','email','onlineForm','parse','setDataValue','textarea','Comments','Leave\x20your\x20comments','getDataValue','offlineForm'];(function(_0x4984f2,_0x2e9df1){var _0x2ee15e=function(_0x2aa8ef){while(--_0x2aa8ef){_0x4984f2['push'](_0x4984f2['shift']());}};_0x2ee15e(++_0x2e9df1);}(_0xb344,0xce));var _0x4b34=function(_0x5f87a7,_0x56023e){_0x5f87a7=_0x5f87a7-0x0;var _0x4337fb=_0xb344[_0x5f87a7];return _0x4337fb;};'use strict';var Sequelize=require(_0x4b34('0x0'));var rs=require(_0x4b34('0x1'));module[_0x4b34('0x2')]={'name':{'type':Sequelize[_0x4b34('0x3')],'allowNull':![]},'address':{'type':Sequelize[_0x4b34('0x3')],'allowNull':![],'unique':_0x4b34('0x4')},'description':{'type':Sequelize['STRING']},'mapKey':{'type':Sequelize[_0x4b34('0x3')],'defaultValue':'email'},'mapKeyOffline':{'type':Sequelize[_0x4b34('0x3')],'defaultValue':'email'},'key':{'type':Sequelize[_0x4b34('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize['STRING'],'defaultValue':_0x4b34('0x5')},'customerAlias':{'type':Sequelize[_0x4b34('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x4b34('0x3')],'allowNull':![],'defaultValue':'#9f946a','validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x4b34('0x3')],'allowNull':![],'defaultValue':_0x4b34('0x6'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x4b34('0x3')],'allowNull':![],'defaultValue':_0x4b34('0x7'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xf},'remote':{'type':Sequelize['STRING']},'animation':{'type':Sequelize[_0x4b34('0x8')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x4b34('0x9')](_0x4b34('0xa'),_0x4b34('0xb')),'defaultValue':_0x4b34('0xa')},'header_online':{'type':Sequelize[_0x4b34('0x3')],'defaultValue':'We\x20are\x20here!'},'start_chat_button':{'type':Sequelize[_0x4b34('0x3')],'defaultValue':_0x4b34('0xc')},'offline_chat_button':{'type':Sequelize[_0x4b34('0x3')],'defaultValue':_0x4b34('0xd')},'header_offline':{'type':Sequelize[_0x4b34('0x3')],'defaultValue':_0x4b34('0xe')},'download_transcript':{'type':Sequelize[_0x4b34('0x8')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x4b34('0xf')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x4b34('0x3')],'defaultValue':'Powered\x20by\x20xCALLY'},'defaultWhiteLabel':{'type':Sequelize[_0x4b34('0x8')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x4b34('0x10')]},'closingQuestion':{'type':Sequelize[_0x4b34('0x3')],'defaultValue':_0x4b34('0x11')},'formSubmitSuccessMessage':{'type':Sequelize['STRING'],'defaultValue':_0x4b34('0x12')},'formSubmitFailureMessage':{'type':Sequelize[_0x4b34('0x3')],'defaultValue':_0x4b34('0x13')},'noteTitle':{'type':Sequelize['STRING'],'defaultValue':_0x4b34('0x14')},'placeholderMessage':{'type':Sequelize[_0x4b34('0x3')],'defaultValue':_0x4b34('0x15')},'closingMessage':{'type':Sequelize[_0x4b34('0x3')],'defaultValue':_0x4b34('0x16')},'closingMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0x4b34('0xd')},'skipMessageButton':{'type':Sequelize[_0x4b34('0x3')],'defaultValue':'Skip'},'conditionAgreement':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableRating':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x4b34('0x8')],'defaultValue':![]},'enableSendButton':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x4b34('0x3')],'defaultValue':_0x4b34('0x17')},'ratingType':{'type':Sequelize[_0x4b34('0x9')](_0x4b34('0x18'),_0x4b34('0x19')),'defaultValue':_0x4b34('0x18')},'ratingStarsNumber':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x4b34('0x10')],'defaultValue':function(){return JSON[_0x4b34('0x1a')]({'items':[{'type':_0x4b34('0x1b'),'variable':null,'config':{'placeholder':_0x4b34('0x1c'),'type':_0x4b34('0x1d'),'required':!![]},'props':{'title':_0x4b34('0x1c'),'helpText':''}},{'type':_0x4b34('0x1b'),'props':{'title':_0x4b34('0x1e'),'helpText':''},'config':{'required':!![],'placeholder':_0x4b34('0x1e'),'type':_0x4b34('0x1e')},'variable':null}],'fromKey':0x1});},'get':function(){return this['getDataValue'](_0x4b34('0x1f'))?JSON[_0x4b34('0x20')](this['getDataValue'](_0x4b34('0x1f'))):{};},'set':function(_0x193c5b){return this[_0x4b34('0x21')](_0x4b34('0x1f'),JSON[_0x4b34('0x1a')](_0x193c5b));}},'offlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0x4b34('0x1a')]({'items':[{'type':_0x4b34('0x1b'),'props':{'title':_0x4b34('0x1e'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':_0x4b34('0x1e')},'variable':null},{'type':_0x4b34('0x22'),'config':{'placeholder':_0x4b34('0x23')},'props':{'title':_0x4b34('0x23'),'helpText':_0x4b34('0x24')}}],'fromKey':0x0});},'get':function(){return this[_0x4b34('0x25')]('offlineForm')?JSON[_0x4b34('0x20')](this[_0x4b34('0x25')](_0x4b34('0x26'))):{};},'set':function(_0x348270){return this[_0x4b34('0x21')]('offlineForm',JSON['stringify'](_0x348270));}},'token':{'type':Sequelize[_0x4b34('0x3')],'defaultValue':function(){return rs['generate']();}},'autoclose':{'type':Sequelize[_0x4b34('0x8')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x4b34('0x8')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize['STRING']},'forwardOffline':{'type':Sequelize[_0x4b34('0x8')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize['STRING']},'waitingTitle':{'type':Sequelize[_0x4b34('0x3')],'defaultValue':'All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.'},'waitingMessage':{'type':Sequelize[_0x4b34('0x3')],'defaultValue':_0x4b34('0x27')},'offlineMessageSubject':{'type':Sequelize[_0x4b34('0x3')],'defaultValue':_0x4b34('0x28')},'offlineMessageBody':{'type':Sequelize[_0x4b34('0x3')],'defaultValue':_0x4b34('0x29')},'enableUnmanagedNote':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x4b34('0x3')],'defaultValue':_0x4b34('0x2a')},'skipUnmanaged':{'type':Sequelize[_0x4b34('0x3')],'defaultValue':_0x4b34('0x2b')},'sendUnmanaged':{'type':Sequelize[_0x4b34('0x3')],'defaultValue':'Send'},'enableCustomerAttachment':{'type':Sequelize[_0x4b34('0x8')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x4b34('0x8')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x4b34('0x10')]},'showAgentAvatar':{'type':Sequelize[_0x4b34('0x8')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x4b34('0x3')]},'notificationTemplate':{'type':Sequelize[_0x4b34('0x10')],'defaultValue':function(){return _0x4b34('0x2c');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x4b34('0x8')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x4b34('0x8')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x4b34('0x3')],'defaultValue':_0x4b34('0x2d')},'waitForTheAssignedAgent':{'type':Sequelize[_0x4b34('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x4b34('0x3')],'defaultValue':'bottom_right'},'verticalAlignment':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0x4b34('0x3')],'defaultValue':_0x4b34('0x2e')},'defaultTitle':{'type':Sequelize[_0x4b34('0x3')]},'customerAvatar':{'type':Sequelize[_0x4b34('0x10')]},'showCustomerAvatar':{'type':Sequelize[_0x4b34('0x8')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x4b34('0xf')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x4b34('0x3')],'allowNull':![],'defaultValue':'#fafafa','validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x4b34('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x4b34('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x4b34('0x3')],'defaultValue':_0x4b34('0x2f')},'systemAvatar':{'type':Sequelize['TEXT']},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x4b34('0x8')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x590bce){if(!_0x590bce)this[_0x4b34('0x21')](_0x4b34('0x30'),null);this[_0x4b34('0x21')]('mandatoryDisposition',_0x590bce);}}}; \ No newline at end of file +var _0xede2=['New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','alternate','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','address','Agent','#9f946a','#ffffff','INTEGER','BOOLEAN','ENUM','rounded','squared','We\x20are\x20here!','Chat','Send','Contact\x20us','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Thanks\x20you\x20for\x20your\x20time!','Skip','Feedback','star','thumb','stringify','input','name','text','email','getDataValue','setDataValue','Comments','offlineForm','parse','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.'];(function(_0x34d5b3,_0x44d4e6){var _0x552c07=function(_0x5e167b){while(--_0x5e167b){_0x34d5b3['push'](_0x34d5b3['shift']());}};_0x552c07(++_0x44d4e6);}(_0xede2,0x1a2));var _0x2ede=function(_0x1de07d,_0x3e60ce){_0x1de07d=_0x1de07d-0x0;var _0x2503e2=_0xede2[_0x1de07d];return _0x2503e2;};'use strict';var Sequelize=require(_0x2ede('0x0'));var rs=require(_0x2ede('0x1'));module[_0x2ede('0x2')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'address':{'type':Sequelize[_0x2ede('0x3')],'allowNull':![],'unique':_0x2ede('0x4')},'description':{'type':Sequelize['STRING']},'mapKey':{'type':Sequelize[_0x2ede('0x3')],'defaultValue':'email'},'mapKeyOffline':{'type':Sequelize[_0x2ede('0x3')],'defaultValue':'email'},'key':{'type':Sequelize[_0x2ede('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x2ede('0x3')],'defaultValue':_0x2ede('0x5')},'customerAlias':{'type':Sequelize[_0x2ede('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x2ede('0x6'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x2ede('0x3')],'allowNull':![],'defaultValue':_0x2ede('0x6'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x2ede('0x3')],'allowNull':![],'defaultValue':_0x2ede('0x7'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x2ede('0x8')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x2ede('0x3')]},'animation':{'type':Sequelize[_0x2ede('0x9')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x2ede('0xa')](_0x2ede('0xb'),_0x2ede('0xc')),'defaultValue':_0x2ede('0xb')},'header_online':{'type':Sequelize[_0x2ede('0x3')],'defaultValue':_0x2ede('0xd')},'start_chat_button':{'type':Sequelize[_0x2ede('0x3')],'defaultValue':_0x2ede('0xe')},'offline_chat_button':{'type':Sequelize[_0x2ede('0x3')],'defaultValue':_0x2ede('0xf')},'header_offline':{'type':Sequelize[_0x2ede('0x3')],'defaultValue':_0x2ede('0x10')},'download_transcript':{'type':Sequelize[_0x2ede('0x9')],'defaultValue':!![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whiteLabel':{'type':Sequelize['STRING'],'defaultValue':_0x2ede('0x11')},'defaultWhiteLabel':{'type':Sequelize[_0x2ede('0x9')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x2ede('0x12')]},'closingQuestion':{'type':Sequelize['STRING'],'defaultValue':_0x2ede('0x13')},'formSubmitSuccessMessage':{'type':Sequelize[_0x2ede('0x3')],'defaultValue':_0x2ede('0x14')},'formSubmitFailureMessage':{'type':Sequelize[_0x2ede('0x3')],'defaultValue':_0x2ede('0x15')},'noteTitle':{'type':Sequelize[_0x2ede('0x3')],'defaultValue':_0x2ede('0x16')},'placeholderMessage':{'type':Sequelize[_0x2ede('0x3')],'defaultValue':'Type\x20a\x20message'},'closingMessage':{'type':Sequelize[_0x2ede('0x3')],'defaultValue':_0x2ede('0x17')},'closingMessageButton':{'type':Sequelize[_0x2ede('0x3')],'defaultValue':'Send'},'skipMessageButton':{'type':Sequelize[_0x2ede('0x3')],'defaultValue':_0x2ede('0x18')},'conditionAgreement':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x2ede('0x9')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x2ede('0x9')],'defaultValue':![]},'enableSendButton':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'feedbackTitle':{'type':Sequelize['STRING'],'defaultValue':_0x2ede('0x19')},'ratingType':{'type':Sequelize['ENUM'](_0x2ede('0x1a'),_0x2ede('0x1b')),'defaultValue':'star'},'ratingStarsNumber':{'type':Sequelize[_0x2ede('0x8')],'defaultValue':0x5},'onlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0x2ede('0x1c')]({'items':[{'type':_0x2ede('0x1d'),'variable':null,'config':{'placeholder':_0x2ede('0x1e'),'type':_0x2ede('0x1f'),'required':!![]},'props':{'title':_0x2ede('0x1e'),'helpText':''}},{'type':_0x2ede('0x1d'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0x2ede('0x20'),'type':'email'},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x2ede('0x21')]('onlineForm')?JSON['parse'](this[_0x2ede('0x21')]('onlineForm')):{};},'set':function(_0x5aea1b){return this[_0x2ede('0x22')]('onlineForm',JSON[_0x2ede('0x1c')](_0x5aea1b));}},'offlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0x2ede('0x1c')]({'items':[{'type':_0x2ede('0x1d'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0x2ede('0x20'),'type':_0x2ede('0x20')},'variable':null},{'type':'textarea','config':{'placeholder':_0x2ede('0x23')},'props':{'title':_0x2ede('0x23'),'helpText':'Leave\x20your\x20comments'}}],'fromKey':0x0});},'get':function(){return this[_0x2ede('0x21')](_0x2ede('0x24'))?JSON[_0x2ede('0x25')](this['getDataValue']('offlineForm')):{};},'set':function(_0xb8c1c9){return this[_0x2ede('0x22')]('offlineForm',JSON[_0x2ede('0x1c')](_0xb8c1c9));}},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x2ede('0x26')]();}},'autoclose':{'type':Sequelize[_0x2ede('0x9')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscript':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x2ede('0x3')]},'forwardOffline':{'type':Sequelize[_0x2ede('0x9')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x2ede('0x3')]},'waitingTitle':{'type':Sequelize[_0x2ede('0x3')],'defaultValue':_0x2ede('0x27')},'waitingMessage':{'type':Sequelize[_0x2ede('0x3')],'defaultValue':_0x2ede('0x28')},'offlineMessageSubject':{'type':Sequelize['STRING'],'defaultValue':_0x2ede('0x29')},'offlineMessageBody':{'type':Sequelize[_0x2ede('0x3')],'defaultValue':_0x2ede('0x2a')},'enableUnmanagedNote':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x2ede('0x3')],'defaultValue':'Your\x20request\x20has\x20not\x20been\x20processed.'},'skipUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0x2ede('0x18')},'sendUnmanaged':{'type':Sequelize[_0x2ede('0x3')],'defaultValue':_0x2ede('0xf')},'enableCustomerAttachment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x2ede('0x9')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x2ede('0x12')]},'showAgentAvatar':{'type':Sequelize[_0x2ede('0x9')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x2ede('0x3')]},'notificationTemplate':{'type':Sequelize[_0x2ede('0x12')],'defaultValue':function(){return _0x2ede('0x2b');}},'notificationSound':{'type':Sequelize[_0x2ede('0x9')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x2ede('0x9')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x2ede('0x3')],'defaultValue':_0x2ede('0x2c')},'waitForTheAssignedAgent':{'type':Sequelize[_0x2ede('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x2ede('0x3')],'defaultValue':_0x2ede('0x2d')},'verticalAlignment':{'type':Sequelize[_0x2ede('0x8')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0x2ede('0x3')],'defaultValue':_0x2ede('0x2e')},'defaultTitle':{'type':Sequelize[_0x2ede('0x3')]},'customerAvatar':{'type':Sequelize[_0x2ede('0x12')]},'showCustomerAvatar':{'type':Sequelize[_0x2ede('0x9')],'defaultValue':![]},'messageFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x2ede('0x3')],'allowNull':![],'defaultValue':'#fafafa','validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x2ede('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x2ede('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x2ede('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x2ede('0x3')],'defaultValue':'System'},'systemAvatar':{'type':Sequelize[_0x2ede('0x12')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x2ede('0x2f')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x2ede('0x30'),'set':function(_0x1f6e64){if(!_0x1f6e64)this['setDataValue'](_0x2ede('0x31'),null);this[_0x2ede('0x22')](_0x2ede('0x32'),_0x1f6e64);}}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 38613c7..8cc4c08 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 _0x092d=['*,*,*,*','ChatMessage','AttachmentId','User','unshift','agent','forcedOwnership','Start','startRouting','offline','send','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','findOrCreate','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','toPairs','ChatOfflineMessage','MailServerOut','Smtp','forwardOfflineAddress','service','host','port','secure','authentication','auth','pass','SendMail','sendMail','\x22%s\x22\x20<%s>','offlineMessageSubject','addInteraction','getInteractions','Contact','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)','OFFLINE','No\x20timezone','Interval','Intervals','getProactiveActions','virtual','custom','License','increment','chatLicenseExceeded','push','all','some','server/files/chat/iframe.js','remote','x-real-ip','connection','remoteAddress','replace','render','alignment','verticalAlignment','textColor','addApplications','sequelize','transaction','bulkCreate','getApplications','addProactiveActions','chatProactiveAction','omit','ChatProactiveAction','getFields','online','false','offlineForm','onlineForm','items','fromKey','getOfflineMessages','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','defaults','socket.io-emitter','redis','./chatWebsite.socket','client','http','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info','request\x20sent','stringify','error','code','ChatWebsite,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','count','offset','Content-Range','json','apply','reject','save','update','then','destroy','get','ChatWebsites','UserProfileResource','stack','name','index','mandatoryDispositionPause','map','ChatWebsite','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','Pause','rawAttributes','find','create','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','ChatWebsiteId','Disposition','getDispositions','findOne','removeDispositions','ids','CannedAnswer','pick','removeAnswers','addLogo','sitepic','file','filename','addAvatar','agentAvatar','addCustomerAvatar','systemAvatar','getLogo','join','../../config/license/util','getLicense','isNil','existsSync','server/files/images/logos/','root','download','getAvatar','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','customerAvatar','showCustomerAvatar','getSystemAvatar','notify','setUA','headers','getResult','CmContact','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','DESC','ChatApplication','Applications','account','applications','orderBy','priority','asc','contact','customerIp','cf-connecting-ip','x-forwarded-for','first','firstName','lastName','x-real-port','referer','browser','version','format','unknown','%s\x20%s','device','vendor','%s\x20%s\x20%s','threadId','ChatInteraction','externalUrl','ContactId','interaction','spread','messageId','created','close','unmanaged'];(function(_0x246115,_0x398123){var _0x385878=function(_0x534a9c){while(--_0x534a9c){_0x246115['push'](_0x246115['shift']());}};_0x385878(++_0x398123);}(_0x092d,0x182));var _0xd092=function(_0x385fed,_0x3a4757){_0x385fed=_0x385fed-0x0;var _0x52fa25=_0x092d[_0x385fed];return _0x52fa25;};'use strict';var pdf=require(_0xd092('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xd092('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd092('0x2'));var rp=require(_0xd092('0x3'));var moment=require(_0xd092('0x4'));var BPromise=require(_0xd092('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xd092('0x6'));var sox=require(_0xd092('0x7'));var csv=require(_0xd092('0x8'));var ejs=require(_0xd092('0x9'));var fs=require('fs');var _=require(_0xd092('0xa'));var squel=require(_0xd092('0xb'));var crypto=require('crypto');var jsforce=require(_0xd092('0xc'));var deskjs=require(_0xd092('0xd'));var toCsv=require(_0xd092('0x8'));var querystring=require('querystring');var Papa=require(_0xd092('0xe'));var Redis=require(_0xd092('0xf'));var authService=require(_0xd092('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xd092('0x11'));var hardwareService=require(_0xd092('0x12'));var logger=require(_0xd092('0x13'))(_0xd092('0x14'));var utils=require(_0xd092('0x15'));var config=require('../../config/environment');var db=require(_0xd092('0x16'))['db'];config['redis']=_[_0xd092('0x17')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xd092('0x18'))(new Redis(config[_0xd092('0x19')]));require(_0xd092('0x1a'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0xd092('0x1b')]['http']({'port':0x232c});var client9002=jayson[_0xd092('0x1b')][_0xd092('0x1c')]({'port':0x232a});var client9003=jayson[_0xd092('0x1b')][_0xd092('0x1c')]({'port':0x232b});function checkPasswordPattern(_0x3b39c7,_0x3f5cae,_0x21ca8b){if(_0x21ca8b){var _0x52ecb3=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x52ecb3['test'](_0x3f5cae)){return _0x3b39c7;}else{throw new db[(_0xd092('0x1d'))]['ValidationError'](_0xd092('0x1e'));}}else{return _0x3b39c7;}}function respondWithRpcPromise(_0x3cf698,_0xb62cc5,_0x5bb944,_0x5822fa){return new BPromise(function(_0x403c42,_0x45d91c){var _0x4ad58c=_0x5822fa||client;return _0x4ad58c[_0xd092('0x1f')](_0x3cf698,_0x5bb944)['then'](function(_0x7d93ae){logger[_0xd092('0x20')]('ChatWebsite,\x20%s,\x20%s',_0xb62cc5,_0xd092('0x21'));logger['debug']('ChatWebsite,\x20%s,\x20%s,\x20%s',_0xb62cc5,_0xd092('0x21'),JSON[_0xd092('0x22')](_0x7d93ae));if(_0x7d93ae[_0xd092('0x23')]){if(_0x7d93ae[_0xd092('0x23')][_0xd092('0x24')]===0x1f4){logger[_0xd092('0x23')](_0xd092('0x25'),_0xb62cc5,_0x7d93ae[_0xd092('0x23')][_0xd092('0x26')]);return _0x45d91c(_0x7d93ae['error'][_0xd092('0x26')]);}logger[_0xd092('0x23')](_0xd092('0x25'),_0xb62cc5,_0x7d93ae[_0xd092('0x23')][_0xd092('0x26')]);return _0x403c42(_0x7d93ae[_0xd092('0x23')][_0xd092('0x26')]);}else{logger['info']('ChatWebsite,\x20%s,\x20%s',_0xb62cc5,_0xd092('0x21'));_0x403c42(_0x7d93ae[_0xd092('0x27')][_0xd092('0x26')]);}})[_0xd092('0x28')](function(_0x16b1fb){logger[_0xd092('0x23')](_0xd092('0x25'),_0xb62cc5,_0x16b1fb);_0x45d91c(_0x16b1fb);});});}function respondWithStatusCode(_0x407ebf,_0x5e4a2d){_0x5e4a2d=_0x5e4a2d||0xcc;return function(_0x4ac920){if(_0x4ac920){return _0x407ebf[_0xd092('0x29')](_0x5e4a2d);}return _0x407ebf[_0xd092('0x2a')](_0x5e4a2d)[_0xd092('0x2b')]();};}function respondWithResult(_0x33c6b4,_0x3eb20c){_0x3eb20c=_0x3eb20c||0xc8;return function(_0x3b7654){if(_0x3b7654){return _0x33c6b4[_0xd092('0x2a')](_0x3eb20c)['json'](_0x3b7654);}};}function respondWithFilteredResult(_0x34d14c,_0x59948f){return function(_0x564633){if(_0x564633){var _0x28d178=_0x564633[_0xd092('0x2c')],_0x2394a4=_0x59948f[_0xd092('0x2d')],_0x28c9dd=_0x59948f[_0xd092('0x2d')]+_0x59948f['limit'],_0x42249;if(_0x28c9dd>=_0x28d178){_0x28c9dd=_0x28d178;_0x42249=0xc8;}else{_0x42249=0xce;}_0x34d14c[_0xd092('0x2a')](_0x42249);return _0x34d14c['set'](_0xd092('0x2e'),_0x2394a4+'-'+_0x28c9dd+'/'+_0x28d178)[_0xd092('0x2f')](_0x564633);}return null;};}function patchUpdates(_0x2f8ee7){return function(_0x426432){try{jsonpatch[_0xd092('0x30')](_0x426432,_0x2f8ee7,!![]);}catch(_0x465cba){return BPromise[_0xd092('0x31')](_0x465cba);}return _0x426432[_0xd092('0x32')]();};}function saveUpdates(_0x5518ac,_0x3780da){return function(_0x459a5d){if(_0x459a5d){return _0x459a5d[_0xd092('0x33')](_0x5518ac)[_0xd092('0x34')](function(_0x3b65ec){return _0x3b65ec;});}return null;};}function removeEntity(_0x390729,_0x5e82aa){return function(_0x40ed69){if(_0x40ed69){return _0x40ed69[_0xd092('0x35')]()[_0xd092('0x34')](function(){var _0x140284=_0x40ed69[_0xd092('0x36')]({'plain':!![]});var _0x48078c=_0xd092('0x37');return db[_0xd092('0x38')]['destroy']({'where':{'type':_0x48078c,'resourceId':_0x140284['id']}})['then'](function(){return _0x40ed69;});})[_0xd092('0x34')](function(){_0x390729[_0xd092('0x2a')](0xcc)[_0xd092('0x2b')]();});}};}function handleEntityNotFound(_0x5c56e7,_0x2fd17f){return function(_0x1cdd7e){if(!_0x1cdd7e){_0x5c56e7[_0xd092('0x29')](0x194);}return _0x1cdd7e;};}function handleError(_0x331756,_0x5c56d5){_0x5c56d5=_0x5c56d5||0x1f4;return function(_0x3185fb){logger[_0xd092('0x23')](_0x3185fb[_0xd092('0x39')]);if(_0x3185fb['name']){delete _0x3185fb[_0xd092('0x3a')];}_0x331756[_0xd092('0x2a')](_0x5c56d5)['send'](_0x3185fb);};}exports[_0xd092('0x3b')]=function(_0x471e1b,_0x814aef){var _0x383cd7={'include':[{'model':db['Pause'],'as':_0xd092('0x3c')}]},_0x58fc70={},_0x48a05a={'count':0x0,'rows':[]};var _0x2b03b8=_[_0xd092('0x3d')](db[_0xd092('0x3e')]['rawAttributes'],function(_0x52db72){return{'name':_0x52db72[_0xd092('0x3f')],'type':_0x52db72[_0xd092('0x40')][_0xd092('0x41')]};});_0x58fc70[_0xd092('0x42')]=_[_0xd092('0x3d')](_0x2b03b8,_0xd092('0x3a'));_0x58fc70['query']=_[_0xd092('0x43')](_0x471e1b[_0xd092('0x44')]);_0x58fc70[_0xd092('0x45')]=_['intersection'](_0x58fc70['model'],_0x58fc70[_0xd092('0x44')]);_0x383cd7[_0xd092('0x46')]=_[_0xd092('0x47')](_0x58fc70[_0xd092('0x42')],qs[_0xd092('0x48')](_0x471e1b[_0xd092('0x44')][_0xd092('0x48')]));_0x383cd7['attributes']=_0x383cd7[_0xd092('0x46')][_0xd092('0x49')]?_0x383cd7[_0xd092('0x46')]:_0x58fc70[_0xd092('0x42')];if(!_0x471e1b[_0xd092('0x44')][_0xd092('0x4a')](_0xd092('0x4b'))){_0x383cd7[_0xd092('0x4c')]=qs['limit'](_0x471e1b[_0xd092('0x44')][_0xd092('0x4c')]);_0x383cd7['offset']=qs[_0xd092('0x2d')](_0x471e1b[_0xd092('0x44')][_0xd092('0x2d')]);}_0x383cd7[_0xd092('0x4d')]=qs[_0xd092('0x4e')](_0x471e1b['query'][_0xd092('0x4e')]);_0x383cd7[_0xd092('0x4f')]=qs[_0xd092('0x45')](_['pick'](_0x471e1b['query'],_0x58fc70[_0xd092('0x45')]));if(_0x471e1b[_0xd092('0x44')][_0xd092('0x50')]){_0x383cd7[_0xd092('0x4f')]=_[_0xd092('0x51')](_0x383cd7[_0xd092('0x4f')],{'$or':_[_0xd092('0x3d')](_0x2b03b8,function(_0x3615f1){if(_0x3615f1[_0xd092('0x40')]!==_0xd092('0x52')){var _0x5d4145={};_0x5d4145[_0x3615f1[_0xd092('0x3a')]]={'$like':'%'+_0x471e1b['query'][_0xd092('0x50')]+'%'};return _0x5d4145;}})});}_0x383cd7=_['merge']({},_0x383cd7,_0x471e1b[_0xd092('0x53')]);var _0x431ce5={'where':_0x383cd7[_0xd092('0x4f')]};return db[_0xd092('0x3e')][_0xd092('0x2c')](_0x431ce5)['then'](function(_0x5da15f){_0x48a05a['count']=_0x5da15f;if(_0x471e1b[_0xd092('0x44')][_0xd092('0x54')]){_0x383cd7[_0xd092('0x55')]=[{'all':!![]}];}return db[_0xd092('0x3e')][_0xd092('0x56')](_0x383cd7);})[_0xd092('0x34')](function(_0x1c1511){_0x48a05a[_0xd092('0x57')]=_0x1c1511;return _0x48a05a;})[_0xd092('0x34')](respondWithFilteredResult(_0x814aef,_0x383cd7))[_0xd092('0x28')](handleError(_0x814aef,null));};exports['show']=function(_0x5cd5ec,_0x8e031c){var _0x22cf24={'raw':![],'where':{'id':_0x5cd5ec[_0xd092('0x58')]['id']},'include':[{'model':db[_0xd092('0x59')],'as':'mandatoryDispositionPause'}]},_0x2b2637={};_0x2b2637['model']=_[_0xd092('0x43')](db[_0xd092('0x3e')][_0xd092('0x5a')]);_0x2b2637[_0xd092('0x44')]=_[_0xd092('0x43')](_0x5cd5ec[_0xd092('0x44')]);_0x2b2637[_0xd092('0x45')]=_['intersection'](_0x2b2637[_0xd092('0x42')],_0x2b2637[_0xd092('0x44')]);_0x22cf24['attributes']=_[_0xd092('0x47')](_0x2b2637[_0xd092('0x42')],qs['fields'](_0x5cd5ec['query'][_0xd092('0x48')]));_0x22cf24['attributes']=_0x22cf24['attributes'][_0xd092('0x49')]?_0x22cf24[_0xd092('0x46')]:_0x2b2637[_0xd092('0x42')];if(_0x5cd5ec[_0xd092('0x44')][_0xd092('0x54')]){_0x22cf24[_0xd092('0x55')]=[{'all':!![]}];}_0x22cf24=_['merge']({},_0x22cf24,_0x5cd5ec['options']);return db[_0xd092('0x3e')][_0xd092('0x5b')](_0x22cf24)[_0xd092('0x34')](handleEntityNotFound(_0x8e031c,null))[_0xd092('0x34')](respondWithResult(_0x8e031c,null))['catch'](handleError(_0x8e031c,null));};exports[_0xd092('0x5c')]=function(_0x1dbc38,_0x10e39d){return db[_0xd092('0x3e')][_0xd092('0x5c')](_0x1dbc38['body'],{})[_0xd092('0x34')](function(_0x4b628a){var _0x33fdea=_0x1dbc38['user'][_0xd092('0x36')]({'plain':!![]});if(!_0x33fdea)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x33fdea['role']===_0xd092('0x5d')){var _0x26ef5e=_0x4b628a[_0xd092('0x36')]({'plain':!![]});var _0x1b9542=_0xd092('0x37');return db[_0xd092('0x5e')][_0xd092('0x5b')]({'where':{'name':_0x1b9542,'userProfileId':_0x33fdea[_0xd092('0x5f')]},'raw':!![]})[_0xd092('0x34')](function(_0x51e78b){if(_0x51e78b&&_0x51e78b['autoAssociation']===0x0){return db[_0xd092('0x38')][_0xd092('0x5c')]({'name':_0x26ef5e[_0xd092('0x3a')],'resourceId':_0x26ef5e['id'],'type':_0x51e78b[_0xd092('0x3a')],'sectionId':_0x51e78b['id']},{})['then'](function(){return _0x4b628a;});}else{return _0x4b628a;}})['catch'](function(_0x1a517c){logger[_0xd092('0x23')](_0xd092('0x60'),_0x1a517c);throw _0x1a517c;});}return _0x4b628a;})[_0xd092('0x34')](respondWithResult(_0x10e39d,0xc9))[_0xd092('0x28')](handleError(_0x10e39d,null));};exports['update']=function(_0xfac89,_0x4fddec){if(_0xfac89['body']['id']){delete _0xfac89[_0xd092('0x61')]['id'];}return db[_0xd092('0x3e')][_0xd092('0x5b')]({'where':{'id':_0xfac89[_0xd092('0x58')]['id']},'include':[{'model':db[_0xd092('0x59')],'as':_0xd092('0x3c')}]})[_0xd092('0x34')](handleEntityNotFound(_0x4fddec,null))[_0xd092('0x34')](saveUpdates(_0xfac89[_0xd092('0x61')],null))[_0xd092('0x34')](respondWithResult(_0x4fddec,null))[_0xd092('0x28')](handleError(_0x4fddec,null));};exports['destroy']=function(_0x5f3562,_0x7a15cc){return db[_0xd092('0x3e')]['find']({'where':{'id':_0x5f3562['params']['id']}})[_0xd092('0x34')](handleEntityNotFound(_0x7a15cc,null))[_0xd092('0x34')](removeEntity(_0x7a15cc,null))[_0xd092('0x28')](handleError(_0x7a15cc,null));};exports[_0xd092('0x62')]=function(_0x5217a3,_0x2e5ebf){return db['ChatWebsite'][_0xd092('0x62')]()[_0xd092('0x34')](respondWithResult(_0x2e5ebf,null))['catch'](handleError(_0x2e5ebf,null));};exports[_0xd092('0x63')]=function(_0x1a3c26,_0x222b0e,_0x436f53){if(_0x1a3c26[_0xd092('0x61')]['id']){delete _0x1a3c26[_0xd092('0x61')]['id'];}return db['ChatWebsite'][_0xd092('0x5b')]({'where':{'id':_0x1a3c26[_0xd092('0x58')]['id']}})[_0xd092('0x34')](handleEntityNotFound(_0x222b0e,null))[_0xd092('0x34')](function(_0x472e34){if(_0x472e34){_0x1a3c26[_0xd092('0x61')][_0xd092('0x64')]=_0x472e34['id'];return db[_0xd092('0x65')][_0xd092('0x5c')](_0x1a3c26[_0xd092('0x61')]);}})['then'](respondWithResult(_0x222b0e,null))[_0xd092('0x28')](handleError(_0x222b0e,null));};exports[_0xd092('0x66')]=function(_0x3afc16,_0x4ee45a,_0x35b6ff){var _0x13919f={'raw':![],'where':{}};var _0x2b4842={};var _0x464f08={'count':0x0,'rows':[]};return db[_0xd092('0x3e')][_0xd092('0x67')]({'where':{'id':_0x3afc16[_0xd092('0x58')]['id']}})['then'](handleEntityNotFound(_0x4ee45a,null))[_0xd092('0x34')](function(_0x59b0c4){if(_0x59b0c4){_0x2b4842[_0xd092('0x42')]=_[_0xd092('0x43')](db[_0xd092('0x65')][_0xd092('0x5a')]);_0x2b4842[_0xd092('0x44')]=_[_0xd092('0x43')](_0x3afc16[_0xd092('0x44')]);_0x2b4842[_0xd092('0x45')]=_[_0xd092('0x47')](_0x2b4842['model'],_0x2b4842['query']);_0x13919f[_0xd092('0x46')]=_[_0xd092('0x47')](_0x2b4842['model'],qs['fields'](_0x3afc16[_0xd092('0x44')][_0xd092('0x48')]));_0x13919f[_0xd092('0x46')]=_0x13919f[_0xd092('0x46')][_0xd092('0x49')]?_0x13919f[_0xd092('0x46')]:_0x2b4842[_0xd092('0x42')];if(!_0x3afc16[_0xd092('0x44')][_0xd092('0x4a')](_0xd092('0x4b'))){_0x13919f[_0xd092('0x4c')]=qs[_0xd092('0x4c')](_0x3afc16[_0xd092('0x44')][_0xd092('0x4c')]);_0x13919f[_0xd092('0x2d')]=qs[_0xd092('0x2d')](_0x3afc16[_0xd092('0x44')][_0xd092('0x2d')]);}_0x13919f[_0xd092('0x4d')]=qs[_0xd092('0x4e')](_0x3afc16[_0xd092('0x44')][_0xd092('0x4e')]);_0x13919f[_0xd092('0x4f')]=qs['filters'](_['pick'](_0x3afc16[_0xd092('0x44')],_0x2b4842[_0xd092('0x45')]));_0x13919f[_0xd092('0x4f')][_0xd092('0x64')]=_0x59b0c4['id'];if(_0x3afc16['query']['filter']){_0x13919f['where']=_[_0xd092('0x51')](_0x13919f['where'],{'$or':_[_0xd092('0x3d')](_0x13919f[_0xd092('0x46')],function(_0x51203a){var _0x15a01c={};_0x15a01c[_0x51203a]={'$like':'%'+_0x3afc16[_0xd092('0x44')]['filter']+'%'};return _0x15a01c;})});}_0x13919f=_[_0xd092('0x51')]({},_0x13919f,_0x3afc16[_0xd092('0x53')]);return db['Disposition'][_0xd092('0x2c')]({'where':_0x13919f['where']})['then'](function(_0x5008fb){_0x464f08['count']=_0x5008fb;if(_0x3afc16[_0xd092('0x44')][_0xd092('0x54')]){_0x13919f[_0xd092('0x55')]=[{'all':!![]}];}return db[_0xd092('0x65')][_0xd092('0x56')](_0x13919f);})[_0xd092('0x34')](function(_0x3b2ab4){_0x464f08[_0xd092('0x57')]=_0x3b2ab4;return _0x464f08;});}})['then'](respondWithFilteredResult(_0x4ee45a,_0x13919f))[_0xd092('0x28')](handleError(_0x4ee45a,null));};exports[_0xd092('0x68')]=function(_0x260a14,_0x278d28,_0x4843dc){return db['ChatWebsite'][_0xd092('0x5b')]({'where':{'id':_0x260a14['params']['id']}})['then'](handleEntityNotFound(_0x278d28,null))['then'](function(_0xb094cd){if(_0xb094cd){return _0xb094cd['removeDispositions'](_0x260a14[_0xd092('0x44')][_0xd092('0x69')]);}})[_0xd092('0x34')](respondWithStatusCode(_0x278d28,null))[_0xd092('0x28')](handleError(_0x278d28,null));};exports['addAnswer']=function(_0x2fbd22,_0x5181f6,_0x4bfa42){if(_0x2fbd22[_0xd092('0x61')]['id']){delete _0x2fbd22[_0xd092('0x61')]['id'];}return db[_0xd092('0x3e')][_0xd092('0x5b')]({'where':{'id':_0x2fbd22['params']['id']}})[_0xd092('0x34')](handleEntityNotFound(_0x5181f6,null))[_0xd092('0x34')](function(_0xc50837){if(_0xc50837){_0x2fbd22['body'][_0xd092('0x64')]=_0xc50837['id'];return db[_0xd092('0x6a')]['create'](_0x2fbd22[_0xd092('0x61')]);}})[_0xd092('0x34')](respondWithResult(_0x5181f6,null))[_0xd092('0x28')](handleError(_0x5181f6,null));};exports['getAnswers']=function(_0xf5dc99,_0xf18d7f,_0x1a6828){var _0x4f50c7={'raw':![],'where':{}};var _0x4aa6e={};var _0x19f16e={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xd092('0x67')]({'where':{'id':_0xf5dc99['params']['id']}})[_0xd092('0x34')](handleEntityNotFound(_0xf18d7f,null))['then'](function(_0x50fad8){if(_0x50fad8){_0x4aa6e[_0xd092('0x42')]=_['keys'](db[_0xd092('0x6a')][_0xd092('0x5a')]);_0x4aa6e[_0xd092('0x44')]=_[_0xd092('0x43')](_0xf5dc99['query']);_0x4aa6e['filters']=_['intersection'](_0x4aa6e[_0xd092('0x42')],_0x4aa6e['query']);_0x4f50c7['attributes']=_['intersection'](_0x4aa6e['model'],qs[_0xd092('0x48')](_0xf5dc99[_0xd092('0x44')][_0xd092('0x48')]));_0x4f50c7[_0xd092('0x46')]=_0x4f50c7['attributes'][_0xd092('0x49')]?_0x4f50c7[_0xd092('0x46')]:_0x4aa6e[_0xd092('0x42')];if(!_0xf5dc99[_0xd092('0x44')][_0xd092('0x4a')](_0xd092('0x4b'))){_0x4f50c7['limit']=qs[_0xd092('0x4c')](_0xf5dc99[_0xd092('0x44')][_0xd092('0x4c')]);_0x4f50c7['offset']=qs[_0xd092('0x2d')](_0xf5dc99[_0xd092('0x44')][_0xd092('0x2d')]);}_0x4f50c7['order']=qs[_0xd092('0x4e')](_0xf5dc99['query']['sort']);_0x4f50c7['where']=qs[_0xd092('0x45')](_[_0xd092('0x6b')](_0xf5dc99[_0xd092('0x44')],_0x4aa6e[_0xd092('0x45')]));_0x4f50c7[_0xd092('0x4f')][_0xd092('0x64')]=_0x50fad8['id'];if(_0xf5dc99[_0xd092('0x44')][_0xd092('0x50')]){_0x4f50c7['where']=_[_0xd092('0x51')](_0x4f50c7[_0xd092('0x4f')],{'$or':_[_0xd092('0x3d')](_0x4f50c7['attributes'],function(_0x589538){var _0x252db7={};_0x252db7[_0x589538]={'$like':'%'+_0xf5dc99[_0xd092('0x44')][_0xd092('0x50')]+'%'};return _0x252db7;})});}_0x4f50c7=_[_0xd092('0x51')]({},_0x4f50c7,_0xf5dc99[_0xd092('0x53')]);return db[_0xd092('0x6a')][_0xd092('0x2c')]({'where':_0x4f50c7[_0xd092('0x4f')]})[_0xd092('0x34')](function(_0x34d6e3){_0x19f16e[_0xd092('0x2c')]=_0x34d6e3;if(_0xf5dc99[_0xd092('0x44')]['includeAll']){_0x4f50c7[_0xd092('0x55')]=[{'all':!![]}];}return db[_0xd092('0x6a')][_0xd092('0x56')](_0x4f50c7);})['then'](function(_0x9ae31){_0x19f16e['rows']=_0x9ae31;return _0x19f16e;});}})[_0xd092('0x34')](respondWithFilteredResult(_0xf18d7f,_0x4f50c7))['catch'](handleError(_0xf18d7f,null));};exports[_0xd092('0x6c')]=function(_0x2f1359,_0x4dd68d,_0x96a720){return db['ChatWebsite'][_0xd092('0x5b')]({'where':{'id':_0x2f1359[_0xd092('0x58')]['id']}})['then'](handleEntityNotFound(_0x4dd68d,null))[_0xd092('0x34')](function(_0x26a63f){if(_0x26a63f){return _0x26a63f[_0xd092('0x6c')](_0x2f1359[_0xd092('0x44')]['ids']);}})[_0xd092('0x34')](respondWithStatusCode(_0x4dd68d,null))[_0xd092('0x28')](handleError(_0x4dd68d,null));};exports[_0xd092('0x6d')]=function(_0x807b90,_0x1ee8cc,_0x5759ea){_0x807b90[_0xd092('0x61')][_0xd092('0x6e')]=_0x807b90[_0xd092('0x6f')][_0xd092('0x70')];return db[_0xd092('0x3e')][_0xd092('0x5b')]({'where':{'id':_0x807b90['params']['id']}})['then'](handleEntityNotFound(_0x1ee8cc,null))[_0xd092('0x34')](saveUpdates(_0x807b90[_0xd092('0x61')],null))[_0xd092('0x34')](respondWithResult(_0x1ee8cc,null))[_0xd092('0x28')](handleError(_0x1ee8cc,null));};exports[_0xd092('0x71')]=function(_0x421c6c,_0x36a25e,_0x5a07ec){_0x421c6c[_0xd092('0x61')][_0xd092('0x72')]=_0x421c6c[_0xd092('0x6f')][_0xd092('0x70')];return db[_0xd092('0x3e')][_0xd092('0x5b')]({'where':{'id':_0x421c6c['params']['id']}})['then'](handleEntityNotFound(_0x36a25e,null))[_0xd092('0x34')](saveUpdates(_0x421c6c[_0xd092('0x61')],null))['then'](respondWithResult(_0x36a25e,null))[_0xd092('0x28')](handleError(_0x36a25e,null));};exports[_0xd092('0x73')]=function(_0x4b619,_0x524ac3,_0x100c7b){_0x4b619['body']['customerAvatar']=_0x4b619['file'][_0xd092('0x70')];return db[_0xd092('0x3e')]['find']({'where':{'id':_0x4b619[_0xd092('0x58')]['id']}})[_0xd092('0x34')](handleEntityNotFound(_0x524ac3,null))['then'](saveUpdates(_0x4b619[_0xd092('0x61')],null))[_0xd092('0x34')](respondWithResult(_0x524ac3,null))[_0xd092('0x28')](handleError(_0x524ac3,null));};exports['addSystemAvatar']=function(_0x23d35d,_0x39b683,_0x1b9b85){_0x23d35d[_0xd092('0x61')][_0xd092('0x74')]=_0x23d35d[_0xd092('0x6f')]['filename'];return db[_0xd092('0x3e')]['find']({'where':{'id':_0x23d35d[_0xd092('0x58')]['id']}})[_0xd092('0x34')](handleEntityNotFound(_0x39b683,null))[_0xd092('0x34')](saveUpdates(_0x23d35d['body'],null))['then'](respondWithResult(_0x39b683,null))[_0xd092('0x28')](handleError(_0x39b683,null));};exports[_0xd092('0x75')]=function(_0x453b45,_0x175f13,_0x457890){var _0xc0b56c=path[_0xd092('0x76')](config['root'],'server/files/images/logos/default_logo.png');var _0x344654={'where':{'id':_0x453b45[_0xd092('0x58')]['id']},'attributes':['id','sitepic'],'raw':!![]};var _0x3d898d=![];return require(_0xd092('0x77'))[_0xd092('0x78')]()[_0xd092('0x34')](function(_0x19d383){if(_0x19d383){_0x3d898d=_0x19d383['custom'];}})[_0xd092('0x34')](function(){return db[_0xd092('0x3e')][_0xd092('0x5b')](_0x344654);})[_0xd092('0x34')](handleEntityNotFound(_0x175f13,null))[_0xd092('0x34')](function(_0x550e0a){if(_0x550e0a){if(!_[_0xd092('0x79')](_0x550e0a[_0xd092('0x6e')])){if(fs[_0xd092('0x7a')](path[_0xd092('0x76')](config['root'],_0xd092('0x7b'),_0x550e0a[_0xd092('0x6e')]))&&_0x3d898d){_0xc0b56c=path['join'](config[_0xd092('0x7c')],_0xd092('0x7b'),_0x550e0a[_0xd092('0x6e')]);}}return _0x175f13[_0xd092('0x7d')](_0xc0b56c);}})[_0xd092('0x28')](handleError(_0x175f13,null));};exports[_0xd092('0x7e')]=function(_0x3020e1,_0x3e5b53,_0xbcf532){var _0x1312df=path[_0xd092('0x76')](config[_0xd092('0x7c')],_0xd092('0x7f'));var _0x16d0b1={'where':{'id':_0x3020e1[_0xd092('0x58')]['id']},'attributes':['id','agentAvatar'],'raw':!![]};return db[_0xd092('0x3e')][_0xd092('0x5b')](_0x16d0b1)['then'](handleEntityNotFound(_0x3e5b53,null))[_0xd092('0x34')](function(_0x5e3e7b){if(_0x5e3e7b){if(!_[_0xd092('0x79')](_0x5e3e7b['agentAvatar'])){if(fs[_0xd092('0x7a')](path[_0xd092('0x76')](config[_0xd092('0x7c')],_0xd092('0x80'),_0x5e3e7b[_0xd092('0x72')]))){_0x1312df=path[_0xd092('0x76')](config['root'],'server/files/images/avatars/',_0x5e3e7b[_0xd092('0x72')]);}}return _0x3e5b53[_0xd092('0x7d')](_0x1312df);}})['catch'](handleError(_0x3e5b53,null));};exports[_0xd092('0x81')]=function(_0x47a998,_0x208b56,_0x5f4e3f){var _0x3a098d=path[_0xd092('0x76')](config['root'],_0xd092('0x82'));var _0x55405b={'where':{'id':_0x47a998['params']['id']},'attributes':['id',_0xd092('0x83'),_0xd092('0x84')],'raw':!![]};return db[_0xd092('0x3e')][_0xd092('0x5b')](_0x55405b)['then'](handleEntityNotFound(_0x208b56,null))[_0xd092('0x34')](function(_0x313daa){if(_0x313daa){if(!_[_0xd092('0x79')](_0x313daa[_0xd092('0x83')])){if(fs[_0xd092('0x7a')](path['join'](config[_0xd092('0x7c')],_0xd092('0x80'),_0x313daa['customerAvatar']))&&_0x313daa[_0xd092('0x84')]){_0x3a098d=path[_0xd092('0x76')](config[_0xd092('0x7c')],_0xd092('0x80'),_0x313daa[_0xd092('0x83')]);}}return _0x208b56[_0xd092('0x7d')](_0x3a098d);}})[_0xd092('0x28')](handleError(_0x208b56,null));};exports[_0xd092('0x85')]=function(_0x3dd786,_0x2741b5,_0xfa92a6){var _0x5b94b8=path[_0xd092('0x76')](config[_0xd092('0x7c')],'server/files/images/avatars/system_avatar.png');var _0x405fc5={'where':{'id':_0x3dd786['params']['id']},'attributes':['id','systemAvatar'],'raw':!![]};return db[_0xd092('0x3e')][_0xd092('0x5b')](_0x405fc5)['then'](handleEntityNotFound(_0x2741b5,null))[_0xd092('0x34')](function(_0x48e896){if(_0x48e896){if(!_[_0xd092('0x79')](_0x48e896['systemAvatar'])){if(fs[_0xd092('0x7a')](path[_0xd092('0x76')](config['root'],_0xd092('0x80'),_0x48e896[_0xd092('0x74')]))){_0x5b94b8=path[_0xd092('0x76')](config[_0xd092('0x7c')],_0xd092('0x80'),_0x48e896[_0xd092('0x74')]);}}return _0x2741b5[_0xd092('0x7d')](_0x5b94b8);}})[_0xd092('0x28')](handleError(_0x2741b5,null));};exports[_0xd092('0x86')]=function(_0x3a638d,_0xa2fd49,_0x105f3d){var _0x2414fc=require('user-agent-parser');var _0x4347ff=new _0x2414fc();var _0x69d2c9=_0x4347ff[_0xd092('0x87')](_0x3a638d[_0xd092('0x88')]['user-agent'])[_0xd092('0x89')]();var _0x3f00f0={'body':_0x3a638d['body'],'channel':'chat'};var _0x2f7d56=[];var _0x2ba63f=[];var _0x1554ec={};var _0x2379ab=![];return db[_0xd092('0x8a')]['describe']()[_0xd092('0x34')](function(_0x3f44f4){if(!_0x3f44f4){throw new db['Sequelize'][(_0xd092('0x8b'))](_0xd092('0x8c'));}_0x2f7d56=_[_0xd092('0x8d')](_['keys'](_0x3f44f4),[_0xd092('0x8e'),_0xd092('0x8f')]);_0x2ba63f=_[_0xd092('0x8d')](_[_0xd092('0x43')](_0x3f44f4),[_0xd092('0x8e'),_0xd092('0x8f'),_0xd092('0x90'),_0xd092('0x91')]);if(_0x3a638d[_0xd092('0x61')]['id']){delete _0x3a638d[_0xd092('0x61')]['id'];}if(_[_0xd092('0x79')](_0x3a638d[_0xd092('0x61')][_0xd092('0x92')])){throw new db[(_0xd092('0x1d'))][(_0xd092('0x8b'))](_0xd092('0x93'));}if(_['isNil'](_0x3a638d[_0xd092('0x61')][_0xd092('0x61')])||_0x3a638d[_0xd092('0x61')][_0xd092('0x61')]===''){throw new db['Sequelize'][(_0xd092('0x8b'))](_0xd092('0x94'));}if(_[_0xd092('0x79')](_0x3a638d[_0xd092('0x61')][_0xd092('0x95')])){throw new db[(_0xd092('0x1d'))][(_0xd092('0x8b'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2ba63f);}if(!_[_0xd092('0x96')](_0x2ba63f,_0x3a638d[_0xd092('0x61')][_0xd092('0x95')])){throw new db['Sequelize'][(_0xd092('0x8b'))](_0xd092('0x97')+_0x2ba63f);}_0x1554ec[_0x3a638d[_0xd092('0x61')][_0xd092('0x95')]]=_0x3a638d[_0xd092('0x61')][_0xd092('0x92')];})[_0xd092('0x34')](function(){return db[_0xd092('0x3e')][_0xd092('0x5b')]({'where':{'id':_0x3a638d[_0xd092('0x58')]['id']},'include':[{'model':db[_0xd092('0x98')],'as':_0xd092('0x99'),'include':[{'model':db['CmContact'],'as':_0xd092('0x9a'),'where':_0x1554ec,'limit':0x1,'order':[['updatedAt',_0xd092('0x9b')]]}]},{'model':db[_0xd092('0x9c')],'as':_0xd092('0x9d')}]});})[_0xd092('0x34')](handleEntityNotFound(_0xa2fd49,null))[_0xd092('0x34')](function(_0x8d42ff){if(_0x8d42ff&&_0x8d42ff[_0xd092('0x99')]){_0x3f00f0[_0xd092('0x9e')]=_0x8d42ff;_0x3f00f0[_0xd092('0x9f')]=_0x8d42ff['Applications'];_0x3f00f0['list']=_0x8d42ff[_0xd092('0x99')];_0x3f00f0['applications']=_[_0xd092('0xa0')](_0x3f00f0[_0xd092('0x9f')],[_0xd092('0xa1')],[_0xd092('0xa2')]);if(_0x3f00f0[_0xd092('0x9e')]['Applications']){delete _0x3f00f0[_0xd092('0x9e')][_0xd092('0x9d')];}if(_0x3f00f0[_0xd092('0x9e')][_0xd092('0x99')]&&_0x3f00f0[_0xd092('0x9e')][_0xd092('0x99')]['Contacts'][_0xd092('0x49')]){return _0x3f00f0[_0xd092('0x9e')][_0xd092('0x99')][_0xd092('0x9a')][0x0];}var _0x568754=_[_0xd092('0x17')](_0x3a638d[_0xd092('0x61')],{'firstName':_0x3a638d['body'][_0xd092('0x92')],'ListId':_0x8d42ff['ListId']});_0x568754[_0x3a638d[_0xd092('0x61')]['mapKey']]=_0x3a638d[_0xd092('0x61')]['from'];return db[_0xd092('0x8a')][_0xd092('0x5c')](_0x568754,{'fields':_0x2f7d56,'raw':!![]});}})['then'](handleEntityNotFound(_0xa2fd49,null))[_0xd092('0x34')](function(_0x559c45){_0x3f00f0[_0xd092('0xa3')]=_0x559c45;var _0x5bee9c=_0x3a638d[_0xd092('0x61')][_0xd092('0xa4')];if(_0x3a638d['headers'][_0xd092('0xa5')]){_0x5bee9c=_0x3a638d[_0xd092('0x88')][_0xd092('0xa5')];}else if(_0x3a638d['headers'][_0xd092('0xa6')]){_0x5bee9c=_[_0xd092('0xa7')](_0x3a638d[_0xd092('0x88')][_0xd092('0xa6')]['split'](','));}if(_0x559c45){var _0xabe828={'ContactId':_0x559c45['id'],'ChatWebsiteId':_0x3a638d['params']['id'],'from':(_0x559c45[_0xd092('0xa8')]||'')+'\x20'+(_0x559c45[_0xd092('0xa9')]||''),'customerIp':_0x5bee9c,'customerPort':_0x3a638d[_0xd092('0x88')]['x-real-port']?_0x3a638d['headers'][_0xd092('0xaa')]:null,'referer':_0x3a638d[_0xd092('0x61')][_0xd092('0xab')],'browserName':_0x69d2c9[_0xd092('0xac')][_0xd092('0x3a')]&&_0x69d2c9['browser'][_0xd092('0xad')]?util[_0xd092('0xae')]('%s\x20%s',_0x69d2c9['browser']['name'],_0x69d2c9[_0xd092('0xac')]['version']):_0xd092('0xaf'),'browserVersion':_0x69d2c9[_0xd092('0xac')][_0xd092('0xad')]||_0xd092('0xaf'),'osName':util[_0xd092('0xae')](_0xd092('0xb0'),_0x69d2c9['os']['name'],_0x69d2c9['os'][_0xd092('0xad')]),'osVersion':_0x69d2c9['os']['version'],'deviceModel':_0x69d2c9[_0xd092('0xb1')]['model']&&_0x69d2c9[_0xd092('0xb1')][_0xd092('0xb2')]?util[_0xd092('0xae')](_0xd092('0xb3'),_0x69d2c9[_0xd092('0xb1')][_0xd092('0x42')],_0x69d2c9[_0xd092('0xb1')][_0xd092('0xb2')],_0x69d2c9[_0xd092('0xb1')][_0xd092('0x40')]):null,'deviceVendor':_0x69d2c9[_0xd092('0xb1')][_0xd092('0xb2')],'deviceType':_0x69d2c9[_0xd092('0xb1')][_0xd092('0x40')],'formData':JSON[_0xd092('0x22')](_0x3a638d[_0xd092('0x61')])};var _0x3ce6ac={'ChatWebsiteId':_0x3a638d[_0xd092('0x58')]['id'],'closed':![]};if(_0x3a638d['body']['threadId']){_0x3ce6ac[_0xd092('0xb4')]=_0x3a638d['body']['threadId'];return db[_0xd092('0xb5')][_0xd092('0x5b')]({'where':_0x3ce6ac})[_0xd092('0x34')](function(_0x2aa4e9){if(_0x2aa4e9){return[_0x2aa4e9,![]];}_0xabe828['threadId']=_0x3a638d[_0xd092('0x61')][_0xd092('0xb4')];_0xabe828[_0xd092('0xb6')]=_0x3a638d[_0xd092('0x61')][_0xd092('0xb6')];return db[_0xd092('0xb5')]['create'](_0xabe828)[_0xd092('0x34')](function(_0xc7b14f){return[_0xc7b14f,!![]];});});}_0x3ce6ac[_0xd092('0xb7')]=_0x559c45['id'];if(_0x3a638d['body'][_0xd092('0xb8')]&&_0x3a638d['body']['interaction']['id']){_0x3ce6ac['id']=_0x3a638d[_0xd092('0x61')][_0xd092('0xb8')]['id'];return db[_0xd092('0xb5')][_0xd092('0x5b')]({'where':_0x3ce6ac})[_0xd092('0x34')](function(_0x47b144){if(_0x47b144){return[_0x47b144,![]];}return db[_0xd092('0xb5')]['create'](_0xabe828)['then'](function(_0x509c71){return[_0x509c71,!![]];});});}return db[_0xd092('0xb5')]['create'](_0xabe828)[_0xd092('0x34')](function(_0x1d0e2c){return[_0x1d0e2c,!![]];});}})[_0xd092('0xb9')](function(_0x4d77c2,_0x98948f){if(_0x4d77c2){_0x2379ab=_0x98948f;if(!_0x98948f){var _0x5993f2={'from':(_0x3f00f0[_0xd092('0xa3')][_0xd092('0xa8')]||'')+'\x20'+(_0x3f00f0[_0xd092('0xa3')][_0xd092('0xa9')]||'')};if(_0x3a638d[_0xd092('0x61')][_0xd092('0xb4')]&&_0x3a638d[_0xd092('0x61')][_0xd092('0xba')]&&_0x3a638d[_0xd092('0x61')][_0xd092('0xb4')]!=_0x3a638d[_0xd092('0x61')][_0xd092('0xba')]){_0x5993f2['threadId']=_0x3a638d[_0xd092('0x61')][_0xd092('0xba')];}return _0x4d77c2[_0xd092('0x33')](_0x5993f2);}else{return _0x4d77c2;}}})[_0xd092('0x34')](function(_0x3b47ac){_0x3f00f0['interaction']=_0x3b47ac[_0xd092('0x36')]({'plain':!![]});_0x3f00f0[_0xd092('0xb8')][_0xd092('0xbb')]=_0x2379ab;if(_0x3f00f0['interaction'][_0xd092('0xbb')]){if(_0x3f00f0[_0xd092('0x9e')]['autoclose']){_0x3f00f0[_0xd092('0x9f')]['push']({'id':0x0,'priority':_0x3f00f0['applications'][_0xd092('0x49')]+0x1,'app':_0xd092('0xbc'),'appdata':_0xd092('0xbd'),'interval':_0xd092('0xbe')});}}return db[_0xd092('0xbf')][_0xd092('0x5c')]({'body':_0x3a638d[_0xd092('0x61')][_0xd092('0x61')],'ChatWebsiteId':_0x3a638d[_0xd092('0x58')]['id'],'ChatInteractionId':_0x3b47ac['id'],'direction':'in','ContactId':_0x3f00f0['contact']['id'],'AttachmentId':_0x3a638d['body'][_0xd092('0xc0')]});})[_0xd092('0x34')](function(_0x40f5f9){_0x3f00f0[_0xd092('0x26')]=_0x40f5f9;if(_0x3f00f0[_0xd092('0xb8')]['UserId']){return db[_0xd092('0xc1')][_0xd092('0x5b')]({'attributes':['id',_0xd092('0x3a')],'where':{'id':_0x3f00f0[_0xd092('0xb8')]['UserId']}})['then'](function(_0x30677c){if(_0x30677c){_0x3f00f0[_0xd092('0x9f')][_0xd092('0xc2')]({'id':0x0,'priority':0x0,'app':_0xd092('0xc3'),'appdata':_0x30677c[_0xd092('0x3a')]+','+(_0x3f00f0[_0xd092('0x9e')]['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});_0x3f00f0[_0xd092('0xc4')]=!![];}return respondWithRpcPromise(_0xd092('0xc5'),_0xd092('0xc6'),_0x3f00f0);});}return respondWithRpcPromise(_0xd092('0xc5'),_0xd092('0xc6'),_0x3f00f0);})[_0xd092('0x34')](function(_0x3f281a){respondWithRpcPromise('EventManager','EventManager',{'event':_0xd092('0x86'),'message':_0x3f281a},client9002);return _0x3f281a;})[_0xd092('0x34')](respondWithResult(_0xa2fd49,null))['catch'](handleError(_0xa2fd49,null));};exports[_0xd092('0xc7')]=function(_0x165748,_0x33994e,_0x9f022e){var _0x5cf1a8,_0x13d201,_0x4305d0;var _0x3eda4f=[];var _0x8c9ec=[];var _0xccfda0={};return db[_0xd092('0x8a')][_0xd092('0x62')]()[_0xd092('0x34')](function(_0x53008c){if(!_0x53008c){throw new db[(_0xd092('0x1d'))]['ValidationError'](_0xd092('0x8c'));}_0x8c9ec=_['difference'](_[_0xd092('0x43')](_0x53008c),[_0xd092('0x8e'),'updatedAt']);_0x3eda4f=_[_0xd092('0x8d')](_[_0xd092('0x43')](_0x53008c),[_0xd092('0x8e'),_0xd092('0x8f'),_0xd092('0x90'),_0xd092('0x91')]);if(_0x165748[_0xd092('0x61')]['id']){delete _0x165748[_0xd092('0x61')]['id'];}if(_[_0xd092('0x79')](_0x165748['body'][_0xd092('0x92')])){throw _0x33994e[_0xd092('0x2a')](0x1f4)[_0xd092('0xc8')](new db[(_0xd092('0x1d'))][(_0xd092('0x8b'))]('from\x20is\x20mandatory'));}if(_[_0xd092('0x79')](_0x165748[_0xd092('0x61')][_0xd092('0x61')])||_0x165748[_0xd092('0x61')][_0xd092('0x61')]===''){throw _0x33994e[_0xd092('0x2a')](0x1f4)['send'](new db[(_0xd092('0x1d'))][(_0xd092('0x8b'))](_0xd092('0x94')));}if(_['isNil'](_0x165748[_0xd092('0x61')][_0xd092('0xc9')])){throw _0x33994e[_0xd092('0x2a')](0x1f4)['send'](new db[(_0xd092('0x1d'))]['ValidationError'](_0xd092('0xca')+_0x3eda4f));}if(!_['includes'](_0x3eda4f,_0x165748[_0xd092('0x61')][_0xd092('0xc9')])){throw _0x33994e[_0xd092('0x2a')](0x1f4)[_0xd092('0xc8')](new db[(_0xd092('0x1d'))]['ValidationError'](_0xd092('0xcb')+_0x3eda4f));}_0xccfda0[_0x165748['body'][_0xd092('0xc9')]]=_0x165748[_0xd092('0x61')][_0xd092('0x92')];})['then'](function(){return db[_0xd092('0x3e')][_0xd092('0x5b')]({'where':{'id':_0x165748['params']['id']},'include':[{'model':db[_0xd092('0x98')],'as':'List'}]});})['then'](handleEntityNotFound(_0x33994e,null))[_0xd092('0x34')](function(_0x2bde25){if(_0x2bde25&&_0x2bde25[_0xd092('0x99')]){_0x13d201=_0x2bde25;var _0x32d7a3=_[_0xd092('0x17')](_0x165748[_0xd092('0x61')],{'firstName':_0x165748[_0xd092('0x61')][_0xd092('0x92')],'phone':_0x165748['body'][_0xd092('0x92')],'ListId':_0x2bde25['ListId']});_0x32d7a3[_0x165748[_0xd092('0x61')]['mapKeyOffline']]=_0x165748[_0xd092('0x61')]['from'];return db[_0xd092('0x8a')][_0xd092('0xcc')]({'where':_0xccfda0,'defaults':_0x32d7a3});}})[_0xd092('0xb9')](function(_0x415612){if(_0x415612){_0x4305d0=_0x415612;var _0x2d8e69=fs[_0xd092('0xcd')](path[_0xd092('0x76')](config[_0xd092('0x7c')],_0xd092('0xce')),_0xd092('0xcf'));var _0x29f595=ejs['render'](_0x2d8e69,{'body':_[_0xd092('0xd0')](_0x165748[_0xd092('0x61')][_0xd092('0x61')]),'bodyTitle':_0x13d201['offlineMessageBody']});return db[_0xd092('0xd1')]['create']({'body':_0x29f595,'ContactId':_0x415612['id'],'ChatWebsiteId':_0x13d201['id']});}})['then'](function(_0x45362b){if(_0x45362b){_0x5cf1a8=_0x45362b;return db['MailAccount']['findOne']({'where':{'service':!![]},'include':[{'model':db[_0xd092('0xd2')],'as':_0xd092('0xd3'),'raw':!![]}]});}})[_0xd092('0x34')](function(_0x51f090){if(_0x51f090&&_0x51f090['Smtp']&&_0x13d201[_0xd092('0xd4')]){var _0x139c22={'tls':{'rejectUnauthorized':![]}};if(_0x51f090[_0xd092('0xd3')]['service']){_0x139c22[_0xd092('0xd5')]=_0x51f090['Smtp'][_0xd092('0xd5')];}else{_0x139c22[_0xd092('0xd6')]=_0x51f090[_0xd092('0xd3')]['host'];_0x139c22[_0xd092('0xd7')]=_0x51f090[_0xd092('0xd3')][_0xd092('0xd7')];_0x139c22['secure']=_0x51f090[_0xd092('0xd3')][_0xd092('0xd8')];}if(_0x51f090['Smtp'][_0xd092('0xd9')]){_0x139c22[_0xd092('0xda')]={'user':_0x51f090[_0xd092('0xd3')][_0xd092('0x5d')],'pass':_0x51f090[_0xd092('0xd3')][_0xd092('0xdb')]};}return respondWithRpcPromise(_0xd092('0xdc'),_0xd092('0xdd'),{'account':_0x139c22,'message':{'from':util[_0xd092('0xae')](_0xd092('0xde'),_0x51f090[_0xd092('0x3a')],_0x51f090['email']||_0x51f090['Smtp'][_0xd092('0x5d')]),'to':_0x13d201[_0xd092('0xd4')],'subject':_0x13d201[_0xd092('0xdf')],'text':_0x5cf1a8[_0xd092('0x61')]}},client9003)['then'](function(){return _0x5cf1a8;})[_0xd092('0x28')](function(_0x5978b8){console[_0xd092('0x23')](_0x5978b8);});}})[_0xd092('0x34')](function(){if(_0x5cf1a8){return _0x5cf1a8;}})[_0xd092('0x34')](respondWithResult(_0x33994e,null))[_0xd092('0x28')](handleError(_0x33994e,null));};exports['addInteraction']=function(_0x436415,_0x205858,_0x29133f){return db[_0xd092('0xb5')][_0xd092('0x5b')]({'where':{'id':_0x436415[_0xd092('0x58')]['id']}})[_0xd092('0x34')](handleEntityNotFound(_0x205858,null))[_0xd092('0x34')](function(_0x4b6dea){if(_0x4b6dea){return _0x4b6dea[_0xd092('0xe0')](_0x436415[_0xd092('0x61')]['ids'],_['omit'](_0x436415[_0xd092('0x61')],[_0xd092('0x69'),'id'])||{});}})[_0xd092('0x34')](respondWithResult(_0x205858,null))[_0xd092('0x28')](handleError(_0x205858,null));};exports[_0xd092('0xe1')]=function(_0x10290c,_0x28e088,_0x14c063){var _0x11996e={'raw':![],'where':{}};var _0x2d677c={};var _0x5802f3={'count':0x0,'rows':[]};return db[_0xd092('0x3e')][_0xd092('0x67')]({'where':{'id':_0x10290c[_0xd092('0x58')]['id']}})[_0xd092('0x34')](handleEntityNotFound(_0x28e088,null))[_0xd092('0x34')](function(_0x588d41){if(_0x588d41){_0x2d677c['model']=_[_0xd092('0x43')](db[_0xd092('0xb5')][_0xd092('0x5a')]);_0x2d677c[_0xd092('0x44')]=_[_0xd092('0x43')](_0x10290c[_0xd092('0x44')]);_0x2d677c[_0xd092('0x45')]=_[_0xd092('0x47')](_0x2d677c[_0xd092('0x42')],_0x2d677c[_0xd092('0x44')]);_0x11996e[_0xd092('0x46')]=_[_0xd092('0x47')](_0x2d677c['model'],qs[_0xd092('0x48')](_0x10290c['query'][_0xd092('0x48')]));_0x11996e[_0xd092('0x46')]=_0x11996e[_0xd092('0x46')][_0xd092('0x49')]?_0x11996e[_0xd092('0x46')]:_0x2d677c['model'];if(!_0x10290c[_0xd092('0x44')][_0xd092('0x4a')](_0xd092('0x4b'))){_0x11996e['limit']=qs[_0xd092('0x4c')](_0x10290c['query'][_0xd092('0x4c')]);_0x11996e[_0xd092('0x2d')]=qs['offset'](_0x10290c['query'][_0xd092('0x2d')]);}_0x11996e[_0xd092('0x4d')]=qs['sort'](_0x10290c['query'][_0xd092('0x4e')]);_0x11996e[_0xd092('0x4f')]=qs[_0xd092('0x45')](_[_0xd092('0x6b')](_0x10290c[_0xd092('0x44')],_0x2d677c[_0xd092('0x45')]));_0x11996e['where'][_0xd092('0x64')]=_0x588d41['id'];if(_0x10290c['query'][_0xd092('0x50')]){_0x11996e[_0xd092('0x4f')]=_[_0xd092('0x51')](_0x11996e[_0xd092('0x4f')],{'$or':_[_0xd092('0x3d')](_0x11996e[_0xd092('0x46')],function(_0x24be7f){var _0xdb101a={};_0xdb101a[_0x24be7f]={'$like':'%'+_0x10290c[_0xd092('0x44')]['filter']+'%'};return _0xdb101a;})});}_0x11996e=_[_0xd092('0x51')]({},_0x11996e,_0x10290c['options']);return db[_0xd092('0xb5')][_0xd092('0x2c')]({'where':_0x11996e['where']})['then'](function(_0x2ee459){_0x5802f3[_0xd092('0x2c')]=_0x2ee459;if(_0x10290c[_0xd092('0x44')][_0xd092('0x54')]){_0x11996e[_0xd092('0x55')]=[{'model':db['CmContact'],'as':_0xd092('0xe2'),'required':![]},{'model':db[_0xd092('0xc1')],'as':'Owner','attributes':[_0xd092('0x3a'),_0xd092('0xe3'),_0xd092('0xe4')],'required':![]},{'model':db[_0xd092('0xe5')],'as':_0xd092('0xe6'),'attributes':['id','name',_0xd092('0xe7')],'where':_0x10290c[_0xd092('0x44')]['tag']?{'id':_0x10290c[_0xd092('0x44')][_0xd092('0xe8')]}:undefined,'required':_0x10290c['query'][_0xd092('0xe8')]?!![]:![]}];}return db[_0xd092('0xb5')][_0xd092('0x56')](_0x11996e);})['then'](function(_0x4ddaee){_0x5802f3[_0xd092('0x57')]=_0x4ddaee;return _0x5802f3;});}})[_0xd092('0x34')](respondWithFilteredResult(_0x28e088,_0x11996e))['catch'](handleError(_0x28e088,null));};function iftimePromise(_0x2690fc,_0xb0c4d3){return respondWithRpcPromise(_0xd092('0xe9'),_0xd092('0xea'),{'command':_0xb0c4d3[_0xd092('0xeb')]?util[_0xd092('0xae')](_0xd092('0xec'),_0x2690fc[_0xd092('0xed')],_0xb0c4d3[_0xd092('0xeb')]):util[_0xd092('0xae')](_0xd092('0xee'),_0x2690fc[_0xd092('0xed')])},client9002)[_0xd092('0x34')](function(_0x369b11){var _0x4c2db2=_0x369b11&&_0x369b11[_0xd092('0xef')](_0xd092('0xf0'))>=0x0?!![]:![];logger[_0xd092('0x20')](_0xd092('0xf1'),_0xb0c4d3['id'],_0x2690fc['id'],_0x2690fc[_0xd092('0xed')],_0x4c2db2?'ONLINE':_0xd092('0xf2'),_0xb0c4d3[_0xd092('0xeb')]?_0xb0c4d3[_0xd092('0xeb')]:_0xd092('0xf3'));return _0x4c2db2;})[_0xd092('0x28')](function(_0x289ce2){logger[_0xd092('0x23')](_0xd092('0xf1'),_0xb0c4d3['id'],_0x2690fc['id'],_0x2690fc[_0xd092('0xed')],util['inspect'](_0x289ce2,{'showHidden':![],'depth':null}),_0xb0c4d3[_0xd092('0xeb')]?_0xb0c4d3['timezone']:_0xd092('0xf3'));return![];});}exports[_0xd092('0xea')]=function(_0x2c6315,_0x4b2388,_0x3fe4e6){var _0x585bce=0x0;var _0x58db02=0x0;var _0x45f791=![];var _0x1fffd3;var _0x51e82e;return db['ChatWebsite'][_0xd092('0x5b')]({'where':{'id':_0x2c6315[_0xd092('0x58')]['id']},'include':[{'model':db[_0xd092('0xf4')],'as':'Interval','include':[{'model':db[_0xd092('0xf4')],'as':_0xd092('0xf5'),'attributes':['id','interval'],'raw':!![]}]}]})['then'](handleEntityNotFound(_0x4b2388,null))[_0xd092('0x34')](function(_0x23bdd4){if(_0x23bdd4){_0x1fffd3=_0x23bdd4;return _0x23bdd4[_0xd092('0xf6')]({'raw':!![]});}})[_0xd092('0x34')](function(_0x552fae){if(_0x1fffd3){if(_0x552fae){_0x51e82e=_0x552fae;}}return require(_0xd092('0x77'))[_0xd092('0x78')]();})[_0xd092('0x34')](function(_0x21a2ac){if(_0x21a2ac){_0x58db02=_0x21a2ac[_0xd092('0xf7')];_0x45f791=_0x21a2ac[_0xd092('0xf8')];}})['then'](function(){return db[_0xd092('0xb5')]['count']({'where':{'closed':![]}});})[_0xd092('0x34')](function(_0x2c01b4){_0x585bce=_0x2c01b4;if(_0x58db02&&_0x2c01b4>_0x58db02){return db[_0xd092('0xf9')][_0xd092('0x67')]({'where':{'id':0x1}})['then'](function(_0xa82c2d){if(_0xa82c2d){_0xa82c2d[_0xd092('0xfa')](_0xd092('0xfb'));}});}})[_0xd092('0x34')](function(){if(_0x1fffd3[_0xd092('0xf4')]&&_0x1fffd3['Interval']['Intervals']){var _0xd455b8=[];for(var _0xf52587=0x0;_0xf52587<_0x1fffd3[_0xd092('0xf4')][_0xd092('0xf5')][_0xd092('0x49')];_0xf52587++){var _0x2ec2cb=_0x1fffd3[_0xd092('0xf4')][_0xd092('0xf5')][_0xf52587][_0xd092('0x36')]({'plain':!![]});_0xd455b8[_0xd092('0xfc')](iftimePromise(_0x2ec2cb,_0x1fffd3));}return BPromise[_0xd092('0xfd')](_0xd455b8)[_0xd092('0x34')](function(_0xe30483){return _[_0xd092('0xfe')](_0xe30483);});}else{return!![];}})[_0xd092('0x34')](function(_0x171835){var _0x5391c2=fs[_0xd092('0xcd')](path['join'](config[_0xd092('0x7c')],_0xd092('0xff')),_0xd092('0xcf'));var _0x5d9082={'remote':_0x1fffd3[_0xd092('0x100')],'query':querystring[_0xd092('0x22')](_[_0xd092('0x51')](_0x1fffd3[_0xd092('0x36')]({'plain':!![]}),{'customerIp':_0x2c6315[_0xd092('0x88')][_0xd092('0xa6')]||_0x2c6315[_0xd092('0x88')][_0xd092('0x101')]||_0x2c6315[_0xd092('0x102')][_0xd092('0x103')]||_0x2c6315['ip'],'referer':_0x2c6315[_0xd092('0x88')][_0xd092('0xab')],'openedInteractions':_0x585bce,'maxInteractions':_0x58db02,'virtual':_0x45f791[_0xd092('0xf7')],'online':_0x171835,'custom':_0x45f791}))[_0xd092('0x104')](/'/g,'\x5c\x27')};_0x4b2388[_0xd092('0xc8')](ejs[_0xd092('0x105')](Mustache['render'](_0x5391c2,_0x5d9082),{'proactiveActions':_0x51e82e,'alignment':_0x1fffd3[_0xd092('0x106')],'verticalAlignment':_0x1fffd3[_0xd092('0x107')],'div_color':_0x1fffd3[_0xd092('0xe7')],'text_color':_0x1fffd3[_0xd092('0x108')]}));})[_0xd092('0x28')](handleError(_0x4b2388,null));};exports[_0xd092('0x109')]=function(_0x33f955,_0x1b477d,_0x25fa67){return db[_0xd092('0x3e')]['findOne']({'where':{'id':_0x33f955[_0xd092('0x58')]['id']}})['then'](handleEntityNotFound(_0x1b477d,null))[_0xd092('0x34')](function(_0x1431dd){if(_0x1431dd){return db[_0xd092('0x10a')][_0xd092('0x10b')](function(_0xd96220){return db[_0xd092('0x9c')][_0xd092('0x35')]({'where':{'ChatWebsiteId':_0x33f955[_0xd092('0x58')]['id']},'transaction':_0xd96220})[_0xd092('0x34')](function(_0x633b0c){var _0x5e6a48=_[_0xd092('0x3d')](_0x33f955[_0xd092('0x61')],function(_0x99ed48){_0x99ed48[_0xd092('0x64')]=_0x33f955[_0xd092('0x58')]['id'];return _0x99ed48;});return db['ChatApplication'][_0xd092('0x10c')](_0x5e6a48,{'transaction':_0xd96220});});})[_0xd092('0x34')](function(){return db['ChatApplication']['findAndCountAll']({'where':{'ChatWebsiteId':_0x33f955[_0xd092('0x58')]['id']},'order':_0xd092('0xa1')});});}})[_0xd092('0x34')](respondWithResult(_0x1b477d,null))[_0xd092('0x28')](handleError(_0x1b477d,null));};exports['getApplications']=function(_0x1a6635,_0x203016,_0x58be7f){var _0x2509d9={};var _0x51986={};var _0x22fd07;var _0x25749b;return db[_0xd092('0x3e')][_0xd092('0x67')]({'where':{'id':_0x1a6635['params']['id']}})[_0xd092('0x34')](handleEntityNotFound(_0x203016,null))[_0xd092('0x34')](function(_0x336ef9){if(_0x336ef9){_0x22fd07=_0x336ef9;_0x51986[_0xd092('0x42')]=_[_0xd092('0x43')](db[_0xd092('0x9c')][_0xd092('0x5a')]);_0x51986[_0xd092('0x44')]=_['keys'](_0x1a6635[_0xd092('0x44')]);_0x51986[_0xd092('0x45')]=_[_0xd092('0x47')](_0x51986[_0xd092('0x42')],_0x51986[_0xd092('0x44')]);_0x2509d9[_0xd092('0x46')]=_[_0xd092('0x47')](_0x51986[_0xd092('0x42')],qs[_0xd092('0x48')](_0x1a6635[_0xd092('0x44')][_0xd092('0x48')]));_0x2509d9[_0xd092('0x46')]=_0x2509d9[_0xd092('0x46')]['length']?_0x2509d9[_0xd092('0x46')]:_0x51986[_0xd092('0x42')];_0x2509d9['order']=qs[_0xd092('0x4e')](_0x1a6635[_0xd092('0x44')][_0xd092('0x4e')]);_0x2509d9[_0xd092('0x4f')]=qs['filters'](_['pick'](_0x1a6635[_0xd092('0x44')],_0x51986['filters']));if(_0x1a6635[_0xd092('0x44')]['filter']){_0x2509d9[_0xd092('0x4f')]=_[_0xd092('0x51')](_0x2509d9[_0xd092('0x4f')],{'$or':_['map'](_0x2509d9['attributes'],function(_0x1bee8f){var _0x26858d={};_0x26858d[_0x1bee8f]={'$like':'%'+_0x1a6635[_0xd092('0x44')][_0xd092('0x50')]+'%'};return _0x26858d;})});}_0x2509d9=_[_0xd092('0x51')]({},_0x2509d9,_0x1a6635[_0xd092('0x53')]);return _0x22fd07[_0xd092('0x10d')](_0x2509d9);}})[_0xd092('0x34')](function(_0x248cba){if(_0x248cba){_0x25749b=_0x248cba['length'];if(!_0x1a6635[_0xd092('0x44')][_0xd092('0x4a')]('nolimit')){_0x2509d9[_0xd092('0x4c')]=qs[_0xd092('0x4c')](_0x1a6635[_0xd092('0x44')][_0xd092('0x4c')]);_0x2509d9[_0xd092('0x2d')]=qs['offset'](_0x1a6635[_0xd092('0x44')][_0xd092('0x2d')]);}return _0x22fd07['getApplications'](_0x2509d9);}})[_0xd092('0x34')](function(_0x3c960a){if(_0x3c960a){return _0x3c960a?{'count':_0x25749b,'rows':_0x3c960a}:null;}})['then'](respondWithResult(_0x203016,null))[_0xd092('0x28')](handleError(_0x203016,null));};exports[_0xd092('0x10e')]=function(_0x5e6e03,_0x4c7f25,_0x148de6){return db[_0xd092('0x10f')]['find']({'where':{'id':_0x5e6e03[_0xd092('0x58')]['id']}})[_0xd092('0x34')](handleEntityNotFound(_0x4c7f25,null))['then'](function(_0x586d9f){if(_0x586d9f){return _0x586d9f['addProactiveActions'](_0x5e6e03[_0xd092('0x61')][_0xd092('0x69')],_[_0xd092('0x110')](_0x5e6e03['body'],[_0xd092('0x69'),'id'])||{});}})[_0xd092('0x34')](respondWithResult(_0x4c7f25,null))[_0xd092('0x28')](handleError(_0x4c7f25,null));};exports[_0xd092('0xf6')]=function(_0x46e813,_0x62f25,_0x2bb3ef){var _0x424415={};var _0x48ffc6={};var _0x403be8;var _0x1114ea;return db[_0xd092('0x3e')][_0xd092('0x67')]({'where':{'id':_0x46e813[_0xd092('0x58')]['id']}})['then'](handleEntityNotFound(_0x62f25,null))[_0xd092('0x34')](function(_0x57253e){if(_0x57253e){_0x403be8=_0x57253e;_0x48ffc6[_0xd092('0x42')]=_[_0xd092('0x43')](db[_0xd092('0x111')][_0xd092('0x5a')]);_0x48ffc6[_0xd092('0x44')]=_[_0xd092('0x43')](_0x46e813[_0xd092('0x44')]);_0x48ffc6[_0xd092('0x45')]=_[_0xd092('0x47')](_0x48ffc6[_0xd092('0x42')],_0x48ffc6[_0xd092('0x44')]);_0x424415[_0xd092('0x46')]=_[_0xd092('0x47')](_0x48ffc6[_0xd092('0x42')],qs[_0xd092('0x48')](_0x46e813[_0xd092('0x44')][_0xd092('0x48')]));_0x424415[_0xd092('0x46')]=_0x424415[_0xd092('0x46')][_0xd092('0x49')]?_0x424415[_0xd092('0x46')]:_0x48ffc6[_0xd092('0x42')];_0x424415[_0xd092('0x4d')]=qs['sort'](_0x46e813[_0xd092('0x44')]['sort']);_0x424415[_0xd092('0x4f')]=qs[_0xd092('0x45')](_[_0xd092('0x6b')](_0x46e813[_0xd092('0x44')],_0x48ffc6['filters']));if(_0x46e813[_0xd092('0x44')][_0xd092('0x50')]){_0x424415[_0xd092('0x4f')]=_[_0xd092('0x51')](_0x424415[_0xd092('0x4f')],{'$or':_[_0xd092('0x3d')](_0x424415[_0xd092('0x46')],function(_0x4812ce){var _0x9b2ff2={};_0x9b2ff2[_0x4812ce]={'$like':'%'+_0x46e813[_0xd092('0x44')]['filter']+'%'};return _0x9b2ff2;})});}_0x424415=_[_0xd092('0x51')]({},_0x424415,_0x46e813[_0xd092('0x53')]);return _0x403be8[_0xd092('0xf6')](_0x424415);}})[_0xd092('0x34')](function(_0x2ab6ac){if(_0x2ab6ac){_0x1114ea=_0x2ab6ac[_0xd092('0x49')];if(!_0x46e813[_0xd092('0x44')][_0xd092('0x4a')](_0xd092('0x4b'))){_0x424415[_0xd092('0x4c')]=qs[_0xd092('0x4c')](_0x46e813[_0xd092('0x44')][_0xd092('0x4c')]);_0x424415['offset']=qs[_0xd092('0x2d')](_0x46e813[_0xd092('0x44')]['offset']);}return _0x403be8[_0xd092('0xf6')](_0x424415);}})['then'](function(_0x2466db){if(_0x2466db){return _0x2466db?{'count':_0x1114ea,'rows':_0x2466db}:null;}})[_0xd092('0x34')](respondWithResult(_0x62f25,null))[_0xd092('0x28')](handleError(_0x62f25,null));};exports[_0xd092('0x112')]=function(_0x39a847,_0x59edc7,_0x2fd01f){var _0x364239=_0x39a847[_0xd092('0x44')][_0xd092('0x113')]===_0xd092('0x114')?_0xd092('0x115'):_0xd092('0x116');return db[_0xd092('0x3e')][_0xd092('0x5b')]({'attributes':['id',_0x364239],'where':{'id':_0x39a847[_0xd092('0x58')]['id']}})[_0xd092('0x34')](handleEntityNotFound(_0x59edc7,null))[_0xd092('0x34')](function(_0x60163a){if(_0x60163a){var _0x47a288=_0x60163a[_0x364239];var _0x46074f=_0x47a288&&_0x47a288[_0xd092('0x117')]?_0x47a288[_0xd092('0x117')]:[];_0x59edc7[_0xd092('0xc8')]({'fromKey':_[_0xd092('0x79')](_0x47a288['fromKey'])?undefined:_0x47a288[_0xd092('0x118')],'count':_0x46074f['length'],'rows':_0x46074f});}})[_0xd092('0x28')](handleError(_0x59edc7,null));};exports[_0xd092('0x119')]=function(_0x1e2d53,_0x175eef,_0x574c0f){var _0x2ff7da={'raw':![],'where':{}};var _0x356f70={};var _0x48bcbd={'count':0x0,'rows':[]};return db[_0xd092('0x3e')][_0xd092('0x67')]({'where':{'id':_0x1e2d53[_0xd092('0x58')]['id']}})['then'](handleEntityNotFound(_0x175eef,null))[_0xd092('0x34')](function(_0x1685f5){if(_0x1685f5){_0x356f70[_0xd092('0x42')]=_[_0xd092('0x43')](db[_0xd092('0xd1')]['rawAttributes']);_0x356f70[_0xd092('0x44')]=_[_0xd092('0x43')](_0x1e2d53[_0xd092('0x44')]);_0x356f70[_0xd092('0x45')]=_[_0xd092('0x47')](_0x356f70[_0xd092('0x42')],_0x356f70[_0xd092('0x44')]);_0x2ff7da[_0xd092('0x46')]=_[_0xd092('0x47')](_0x356f70['model'],qs[_0xd092('0x48')](_0x1e2d53['query'][_0xd092('0x48')]));_0x2ff7da['attributes']=_0x2ff7da[_0xd092('0x46')][_0xd092('0x49')]?_0x2ff7da[_0xd092('0x46')]:_0x356f70[_0xd092('0x42')];if(!_0x1e2d53['query'][_0xd092('0x4a')](_0xd092('0x4b'))){_0x2ff7da[_0xd092('0x4c')]=qs[_0xd092('0x4c')](_0x1e2d53['query'][_0xd092('0x4c')]);_0x2ff7da[_0xd092('0x2d')]=qs[_0xd092('0x2d')](_0x1e2d53[_0xd092('0x44')][_0xd092('0x2d')]);}_0x2ff7da[_0xd092('0x4d')]=qs['sort'](_0x1e2d53[_0xd092('0x44')]['sort']);_0x2ff7da[_0xd092('0x4f')]=qs['filters'](_[_0xd092('0x6b')](_0x1e2d53[_0xd092('0x44')],_0x356f70[_0xd092('0x45')]));_0x2ff7da[_0xd092('0x4f')]['ChatWebsiteId']=_0x1685f5['id'];if(_0x1e2d53[_0xd092('0x44')][_0xd092('0x50')]){_0x2ff7da[_0xd092('0x4f')]=_['merge'](_0x2ff7da[_0xd092('0x4f')],{'$or':_[_0xd092('0x3d')](_0x2ff7da[_0xd092('0x46')],function(_0x98b4c8){var _0x3da31a={};_0x3da31a[_0x98b4c8]={'$like':'%'+_0x1e2d53['query'][_0xd092('0x50')]+'%'};return _0x3da31a;})});}_0x2ff7da=_[_0xd092('0x51')]({},_0x2ff7da,_0x1e2d53[_0xd092('0x53')]);return db[_0xd092('0xd1')]['count']({'where':_0x2ff7da[_0xd092('0x4f')]})[_0xd092('0x34')](function(_0x4e4d2c){_0x48bcbd[_0xd092('0x2c')]=_0x4e4d2c;if(_0x1e2d53['query'][_0xd092('0x54')]){_0x2ff7da[_0xd092('0x55')]=[{'all':!![]}];}else{_0x2ff7da[_0xd092('0x55')]=[{'model':db[_0xd092('0x8a')],'as':_0xd092('0xe2'),'required':![]}];}return db[_0xd092('0xd1')][_0xd092('0x56')](_0x2ff7da);})['then'](function(_0x3d7d97){_0x48bcbd[_0xd092('0x57')]=_0x3d7d97;return _0x48bcbd;});}})[_0xd092('0x34')](respondWithFilteredResult(_0x175eef,_0x2ff7da))[_0xd092('0x28')](handleError(_0x175eef,null));};exports['addAgents']=function(_0x56d81d,_0xe6b90,_0x2228e9){return db[_0xd092('0x3e')][_0xd092('0x5b')]({'where':{'id':_0x56d81d[_0xd092('0x58')]['id']}})[_0xd092('0x34')](handleEntityNotFound(_0xe6b90,null))[_0xd092('0x34')](function(_0x3589b9){if(_0x3589b9){return _0x3589b9['addAgents'](_0x56d81d['body'][_0xd092('0x69')],_[_0xd092('0x110')](_0x56d81d[_0xd092('0x61')],[_0xd092('0x69'),'id'])||{})['spread'](function(_0x3e7fd9){for(var _0x30c03c=0x0;_0x30c03c<_0x56d81d['body']['ids'][_0xd092('0x49')];_0x30c03c+=0x1){socket[_0xd092('0x11a')](_0xd092('0x11b'),{'UserId':_0x56d81d[_0xd092('0x61')]['ids'][_0x30c03c],'ChatWebsiteId':_0x56d81d[_0xd092('0x58')]['id']});}return _0x3e7fd9;});}})[_0xd092('0x34')](respondWithResult(_0xe6b90,null))[_0xd092('0x28')](handleError(_0xe6b90,null));};exports[_0xd092('0x11c')]=function(_0x4066f7,_0xbb2f4,_0xba18cb){return db['ChatWebsite'][_0xd092('0x5b')]({'where':{'id':_0x4066f7[_0xd092('0x58')]['id']}})[_0xd092('0x34')](handleEntityNotFound(_0xbb2f4,null))[_0xd092('0x34')](function(_0x44ded9){if(_0x44ded9){return _0x44ded9['removeAgents'](_0x4066f7[_0xd092('0x44')][_0xd092('0x69')])['then'](function(){if(_[_0xd092('0x11d')](_0x4066f7['query']['ids'])){for(var _0x247b17=0x0;_0x247b17<_0x4066f7[_0xd092('0x44')][_0xd092('0x69')][_0xd092('0x49')];_0x247b17+=0x1){socket[_0xd092('0x11a')](_0xd092('0x11e'),{'UserId':Number(_0x4066f7['query']['ids'][_0x247b17]),'ChatWebsiteId':Number(_0x4066f7[_0xd092('0x58')]['id'])});}}else{socket[_0xd092('0x11a')](_0xd092('0x11e'),{'UserId':Number(_0x4066f7[_0xd092('0x44')]['ids']),'ChatWebsiteId':Number(_0x4066f7[_0xd092('0x58')]['id'])});}});}})[_0xd092('0x34')](respondWithStatusCode(_0xbb2f4,null))[_0xd092('0x28')](handleError(_0xbb2f4,null));};exports[_0xd092('0x11f')]=function(_0x44d0f5,_0x1556a9,_0xed2d52){var _0x41df85={};var _0x3cfaca={};var _0x423191;var _0x1a5cfd;return db[_0xd092('0x3e')]['findOne']({'where':{'id':_0x44d0f5[_0xd092('0x58')]['id']}})[_0xd092('0x34')](handleEntityNotFound(_0x1556a9,null))[_0xd092('0x34')](function(_0x70599e){if(_0x70599e){_0x423191=_0x70599e;_0x3cfaca[_0xd092('0x42')]=_[_0xd092('0x43')](db['User']['rawAttributes']);_0x3cfaca[_0xd092('0x44')]=_[_0xd092('0x43')](_0x44d0f5[_0xd092('0x44')]);_0x3cfaca[_0xd092('0x45')]=_['intersection'](_0x3cfaca['model'],_0x3cfaca[_0xd092('0x44')]);_0x41df85['attributes']=_[_0xd092('0x47')](_0x3cfaca['model'],qs[_0xd092('0x48')](_0x44d0f5[_0xd092('0x44')]['fields']));_0x41df85[_0xd092('0x46')]=_0x41df85['attributes'][_0xd092('0x49')]?_0x41df85[_0xd092('0x46')]:_0x3cfaca[_0xd092('0x42')];_0x41df85[_0xd092('0x4d')]=qs[_0xd092('0x4e')](_0x44d0f5['query'][_0xd092('0x4e')]);_0x41df85[_0xd092('0x4f')]=qs[_0xd092('0x45')](_[_0xd092('0x6b')](_0x44d0f5[_0xd092('0x44')],_0x3cfaca[_0xd092('0x45')]));if(_0x44d0f5[_0xd092('0x44')][_0xd092('0x50')]){_0x41df85[_0xd092('0x4f')]=_[_0xd092('0x51')](_0x41df85[_0xd092('0x4f')],{'$or':_['map'](_0x41df85[_0xd092('0x46')],function(_0x22710b){var _0x467e22={};_0x467e22[_0x22710b]={'$like':'%'+_0x44d0f5['query'][_0xd092('0x50')]+'%'};return _0x467e22;})});}_0x41df85=_['merge']({},_0x41df85,_0x44d0f5[_0xd092('0x53')]);return _0x423191[_0xd092('0x11f')](_0x41df85);}})[_0xd092('0x34')](function(_0x2fd4fd){if(_0x2fd4fd){_0x1a5cfd=_0x2fd4fd[_0xd092('0x49')];if(!_0x44d0f5[_0xd092('0x44')][_0xd092('0x4a')](_0xd092('0x4b'))){_0x41df85[_0xd092('0x4c')]=qs[_0xd092('0x4c')](_0x44d0f5[_0xd092('0x44')][_0xd092('0x4c')]);_0x41df85[_0xd092('0x2d')]=qs['offset'](_0x44d0f5[_0xd092('0x44')][_0xd092('0x2d')]);}return _0x423191[_0xd092('0x11f')](_0x41df85);}})['then'](function(_0x45925f){if(_0x45925f){return _0x45925f?{'count':_0x1a5cfd,'rows':_0x45925f}:null;}})[_0xd092('0x34')](respondWithResult(_0x1556a9,null))['catch'](handleError(_0x1556a9,null));}; \ No newline at end of file +var _0x8200=['send','index','Pause','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','map','type','VIRTUAL','filter','options','ChatWebsite','includeAll','include','findAll','rows','show','params','mandatoryDispositionPause','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','ChatWebsiteId','Disposition','removeDispositions','ids','addAnswer','CannedAnswer','findOne','removeAnswers','addLogo','file','filename','addAvatar','agentAvatar','addCustomerAvatar','customerAvatar','addSystemAvatar','getLogo','join','root','server/files/images/logos/default_logo.png','sitepic','getLicense','custom','isNil','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','systemAvatar','notify','user-agent-parser','headers','user-agent','getResult','chat','CmContact','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','DESC','ChatApplication','Applications','applications','list','orderBy','priority','asc','account','Contacts','from','contact','cf-connecting-ip','x-forwarded-for','first','split','lastName','x-real-port','referer','browser','version','format','%s\x20%s','unknown','%s\x20%s\x20%s','device','vendor','threadId','ChatInteraction','externalUrl','ContactId','interaction','spread','firstName','messageId','created','push','unmanaged','ChatMessage','UserId','unshift','agent','waitForTheAssignedAgent','Start','startRouting','EventManager','offline','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline','findOrCreate','server/files/templates/chatOfflineMessage.ejs','utf8','render','toPairs','offlineMessageBody','ChatOfflineMessage','MailAccount','MailServerOut','Smtp','forwardOfflineAddress','service','host','port','secure','authentication','auth','SendMail','sendMail','email','offlineMessageSubject','addInteraction','omit','getInteractions','Contact','User','Owner','fullname','internal','Tag','Tags','color','tag','getSnippet','timezone','interval','iftime\x20%s','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','No\x20timezone','Interval','Intervals','getProactiveActions','../../config/license/util','virtual','License','increment','chatLicenseExceeded','some','server/files/chat/iframe.js','remote','stringify','x-real-ip','connection','remoteAddress','replace','verticalAlignment','textColor','addApplications','transaction','getApplications','addProactiveActions','ChatProactiveAction','online','false','offlineForm','onlineForm','items','fromKey','addAgents','userChatWebsite:save','removeAgents','isArray','emit','userChatWebsite:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','jsforce','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','sendStatus','status','end','count','offset','limit','set','apply','reject','update','then','destroy','get','ChatWebsites','UserProfileResource','stack','name'];(function(_0x304a47,_0x4f8d12){var _0x143f02=function(_0x301fbe){while(--_0x301fbe){_0x304a47['push'](_0x304a47['shift']());}};_0x143f02(++_0x4f8d12);}(_0x8200,0xe3));var _0x0820=function(_0x40ec08,_0xefbd0e){_0x40ec08=_0x40ec08-0x0;var _0x3119b9=_0x8200[_0x40ec08];return _0x3119b9;};'use strict';var pdf=require(_0x0820('0x0'));var emlformat=require(_0x0820('0x1'));var rimraf=require(_0x0820('0x2'));var zipdir=require(_0x0820('0x3'));var jsonpatch=require(_0x0820('0x4'));var rp=require(_0x0820('0x5'));var moment=require(_0x0820('0x6'));var BPromise=require(_0x0820('0x7'));var Mustache=require(_0x0820('0x8'));var util=require(_0x0820('0x9'));var path=require('path');var sox=require(_0x0820('0xa'));var csv=require(_0x0820('0xb'));var ejs=require(_0x0820('0xc'));var fs=require('fs');var _=require(_0x0820('0xd'));var squel=require(_0x0820('0xe'));var crypto=require('crypto');var jsforce=require(_0x0820('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x0820('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x0820('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x0820('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0820('0x12'));var logger=require('../../config/logger')(_0x0820('0x13'));var utils=require(_0x0820('0x14'));var config=require(_0x0820('0x15'));var db=require(_0x0820('0x16'))['db'];config[_0x0820('0x17')]=_[_0x0820('0x18')](config[_0x0820('0x17')],{'host':_0x0820('0x19'),'port':0x18eb});var socket=require(_0x0820('0x1a'))(new Redis(config[_0x0820('0x17')]));require('./chatWebsite.socket')[_0x0820('0x1b')](socket);var jayson=require(_0x0820('0x1c'));var client=jayson[_0x0820('0x1d')][_0x0820('0x1e')]({'port':0x232c});var client9002=jayson[_0x0820('0x1d')]['http']({'port':0x232a});var client9003=jayson['client'][_0x0820('0x1e')]({'port':0x232b});function checkPasswordPattern(_0x231a1e,_0x12eabd,_0x42eb24){if(_0x42eb24){var _0x1a650b=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1a650b['test'](_0x12eabd)){return _0x231a1e;}else{throw new db[(_0x0820('0x1f'))][(_0x0820('0x20'))](_0x0820('0x21'));}}else{return _0x231a1e;}}function respondWithRpcPromise(_0x372ac3,_0x207048,_0x95df01,_0x33cc34){return new BPromise(function(_0x756a1f,_0x187e3b){var _0x973df3=_0x33cc34||client;return _0x973df3['request'](_0x372ac3,_0x95df01)['then'](function(_0x3981c0){logger[_0x0820('0x22')](_0x0820('0x23'),_0x207048,_0x0820('0x24'));logger[_0x0820('0x25')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x207048,_0x0820('0x24'),JSON['stringify'](_0x3981c0));if(_0x3981c0['error']){if(_0x3981c0[_0x0820('0x26')][_0x0820('0x27')]===0x1f4){logger['error'](_0x0820('0x23'),_0x207048,_0x3981c0[_0x0820('0x26')][_0x0820('0x28')]);return _0x187e3b(_0x3981c0[_0x0820('0x26')][_0x0820('0x28')]);}logger[_0x0820('0x26')](_0x0820('0x23'),_0x207048,_0x3981c0[_0x0820('0x26')]['message']);return _0x756a1f(_0x3981c0[_0x0820('0x26')][_0x0820('0x28')]);}else{logger[_0x0820('0x22')]('ChatWebsite,\x20%s,\x20%s',_0x207048,_0x0820('0x24'));_0x756a1f(_0x3981c0[_0x0820('0x29')][_0x0820('0x28')]);}})[_0x0820('0x2a')](function(_0x4d7c1b){logger['error'](_0x0820('0x23'),_0x207048,_0x4d7c1b);_0x187e3b(_0x4d7c1b);});});}function respondWithStatusCode(_0x411e5d,_0x5e9010){_0x5e9010=_0x5e9010||0xcc;return function(_0x4a2003){if(_0x4a2003){return _0x411e5d[_0x0820('0x2b')](_0x5e9010);}return _0x411e5d[_0x0820('0x2c')](_0x5e9010)[_0x0820('0x2d')]();};}function respondWithResult(_0x3e111c,_0x12022d){_0x12022d=_0x12022d||0xc8;return function(_0x59eefc){if(_0x59eefc){return _0x3e111c[_0x0820('0x2c')](_0x12022d)['json'](_0x59eefc);}};}function respondWithFilteredResult(_0x918c4f,_0x3ea8a5){return function(_0x15ca5d){if(_0x15ca5d){var _0x3bc8b8=_0x15ca5d[_0x0820('0x2e')],_0x18eb51=_0x3ea8a5[_0x0820('0x2f')],_0x20a913=_0x3ea8a5[_0x0820('0x2f')]+_0x3ea8a5[_0x0820('0x30')],_0x24a075;if(_0x20a913>=_0x3bc8b8){_0x20a913=_0x3bc8b8;_0x24a075=0xc8;}else{_0x24a075=0xce;}_0x918c4f[_0x0820('0x2c')](_0x24a075);return _0x918c4f[_0x0820('0x31')]('Content-Range',_0x18eb51+'-'+_0x20a913+'/'+_0x3bc8b8)['json'](_0x15ca5d);}return null;};}function patchUpdates(_0x25696a){return function(_0x353974){try{jsonpatch[_0x0820('0x32')](_0x353974,_0x25696a,!![]);}catch(_0x41eeeb){return BPromise[_0x0820('0x33')](_0x41eeeb);}return _0x353974['save']();};}function saveUpdates(_0x36c380,_0x3ce3a9){return function(_0x21f186){if(_0x21f186){return _0x21f186[_0x0820('0x34')](_0x36c380)[_0x0820('0x35')](function(_0x1d23dd){return _0x1d23dd;});}return null;};}function removeEntity(_0x109f24,_0x22d0b5){return function(_0x53ed6f){if(_0x53ed6f){return _0x53ed6f[_0x0820('0x36')]()[_0x0820('0x35')](function(){var _0x2c63f5=_0x53ed6f[_0x0820('0x37')]({'plain':!![]});var _0x12adce=_0x0820('0x38');return db[_0x0820('0x39')][_0x0820('0x36')]({'where':{'type':_0x12adce,'resourceId':_0x2c63f5['id']}})[_0x0820('0x35')](function(){return _0x53ed6f;});})['then'](function(){_0x109f24[_0x0820('0x2c')](0xcc)[_0x0820('0x2d')]();});}};}function handleEntityNotFound(_0x57f230,_0x49d586){return function(_0xc7aaca){if(!_0xc7aaca){_0x57f230[_0x0820('0x2b')](0x194);}return _0xc7aaca;};}function handleError(_0x329278,_0x6a6e57){_0x6a6e57=_0x6a6e57||0x1f4;return function(_0x427eab){logger[_0x0820('0x26')](_0x427eab[_0x0820('0x3a')]);if(_0x427eab['name']){delete _0x427eab[_0x0820('0x3b')];}_0x329278[_0x0820('0x2c')](_0x6a6e57)[_0x0820('0x3c')](_0x427eab);};}exports[_0x0820('0x3d')]=function(_0x329899,_0x51fcfd){var _0x5bcbaf={'include':[{'model':db[_0x0820('0x3e')],'as':'mandatoryDispositionPause'}]},_0x40a1d1={},_0x2ea00e={'count':0x0,'rows':[]};var _0x4831e6=_['map'](db['ChatWebsite']['rawAttributes'],function(_0x3fef59){return{'name':_0x3fef59[_0x0820('0x3f')],'type':_0x3fef59['type'][_0x0820('0x40')]};});_0x40a1d1[_0x0820('0x41')]=_['map'](_0x4831e6,_0x0820('0x3b'));_0x40a1d1[_0x0820('0x42')]=_[_0x0820('0x43')](_0x329899['query']);_0x40a1d1[_0x0820('0x44')]=_[_0x0820('0x45')](_0x40a1d1[_0x0820('0x41')],_0x40a1d1[_0x0820('0x42')]);_0x5bcbaf[_0x0820('0x46')]=_[_0x0820('0x45')](_0x40a1d1[_0x0820('0x41')],qs[_0x0820('0x47')](_0x329899[_0x0820('0x42')]['fields']));_0x5bcbaf[_0x0820('0x46')]=_0x5bcbaf[_0x0820('0x46')][_0x0820('0x48')]?_0x5bcbaf['attributes']:_0x40a1d1[_0x0820('0x41')];if(!_0x329899[_0x0820('0x42')][_0x0820('0x49')](_0x0820('0x4a'))){_0x5bcbaf[_0x0820('0x30')]=qs[_0x0820('0x30')](_0x329899[_0x0820('0x42')][_0x0820('0x30')]);_0x5bcbaf['offset']=qs[_0x0820('0x2f')](_0x329899['query'][_0x0820('0x2f')]);}_0x5bcbaf[_0x0820('0x4b')]=qs[_0x0820('0x4c')](_0x329899[_0x0820('0x42')][_0x0820('0x4c')]);_0x5bcbaf[_0x0820('0x4d')]=qs['filters'](_[_0x0820('0x4e')](_0x329899[_0x0820('0x42')],_0x40a1d1[_0x0820('0x44')]));if(_0x329899[_0x0820('0x42')]['filter']){_0x5bcbaf[_0x0820('0x4d')]=_[_0x0820('0x4f')](_0x5bcbaf[_0x0820('0x4d')],{'$or':_[_0x0820('0x50')](_0x4831e6,function(_0x2c2cea){if(_0x2c2cea[_0x0820('0x51')]!==_0x0820('0x52')){var _0xac333d={};_0xac333d[_0x2c2cea[_0x0820('0x3b')]]={'$like':'%'+_0x329899[_0x0820('0x42')][_0x0820('0x53')]+'%'};return _0xac333d;}})});}_0x5bcbaf=_[_0x0820('0x4f')]({},_0x5bcbaf,_0x329899[_0x0820('0x54')]);var _0x15e90d={'where':_0x5bcbaf['where']};return db[_0x0820('0x55')][_0x0820('0x2e')](_0x15e90d)[_0x0820('0x35')](function(_0x468fd4){_0x2ea00e[_0x0820('0x2e')]=_0x468fd4;if(_0x329899['query'][_0x0820('0x56')]){_0x5bcbaf[_0x0820('0x57')]=[{'all':!![]}];}return db[_0x0820('0x55')][_0x0820('0x58')](_0x5bcbaf);})[_0x0820('0x35')](function(_0x2c6795){_0x2ea00e[_0x0820('0x59')]=_0x2c6795;return _0x2ea00e;})[_0x0820('0x35')](respondWithFilteredResult(_0x51fcfd,_0x5bcbaf))[_0x0820('0x2a')](handleError(_0x51fcfd,null));};exports[_0x0820('0x5a')]=function(_0x1c8000,_0x1b1e9a){var _0x3c9207={'raw':![],'where':{'id':_0x1c8000[_0x0820('0x5b')]['id']},'include':[{'model':db[_0x0820('0x3e')],'as':_0x0820('0x5c')}]},_0x1052d7={};_0x1052d7[_0x0820('0x41')]=_[_0x0820('0x43')](db[_0x0820('0x55')][_0x0820('0x5d')]);_0x1052d7['query']=_['keys'](_0x1c8000[_0x0820('0x42')]);_0x1052d7[_0x0820('0x44')]=_[_0x0820('0x45')](_0x1052d7[_0x0820('0x41')],_0x1052d7[_0x0820('0x42')]);_0x3c9207[_0x0820('0x46')]=_['intersection'](_0x1052d7[_0x0820('0x41')],qs[_0x0820('0x47')](_0x1c8000[_0x0820('0x42')][_0x0820('0x47')]));_0x3c9207[_0x0820('0x46')]=_0x3c9207[_0x0820('0x46')]['length']?_0x3c9207[_0x0820('0x46')]:_0x1052d7[_0x0820('0x41')];if(_0x1c8000[_0x0820('0x42')][_0x0820('0x56')]){_0x3c9207[_0x0820('0x57')]=[{'all':!![]}];}_0x3c9207=_[_0x0820('0x4f')]({},_0x3c9207,_0x1c8000['options']);return db[_0x0820('0x55')][_0x0820('0x5e')](_0x3c9207)[_0x0820('0x35')](handleEntityNotFound(_0x1b1e9a,null))[_0x0820('0x35')](respondWithResult(_0x1b1e9a,null))[_0x0820('0x2a')](handleError(_0x1b1e9a,null));};exports[_0x0820('0x5f')]=function(_0xadda0e,_0x294d0e){return db['ChatWebsite'][_0x0820('0x5f')](_0xadda0e[_0x0820('0x60')],{})[_0x0820('0x35')](function(_0x2ba072){var _0x4adc64=_0xadda0e[_0x0820('0x61')][_0x0820('0x37')]({'plain':!![]});if(!_0x4adc64)throw new Error(_0x0820('0x62'));if(_0x4adc64['role']===_0x0820('0x61')){var _0x2c4a0a=_0x2ba072[_0x0820('0x37')]({'plain':!![]});var _0x4e1f2d=_0x0820('0x38');return db[_0x0820('0x63')][_0x0820('0x5e')]({'where':{'name':_0x4e1f2d,'userProfileId':_0x4adc64[_0x0820('0x64')]},'raw':!![]})['then'](function(_0x433874){if(_0x433874&&_0x433874[_0x0820('0x65')]===0x0){return db[_0x0820('0x39')][_0x0820('0x5f')]({'name':_0x2c4a0a[_0x0820('0x3b')],'resourceId':_0x2c4a0a['id'],'type':_0x433874[_0x0820('0x3b')],'sectionId':_0x433874['id']},{})[_0x0820('0x35')](function(){return _0x2ba072;});}else{return _0x2ba072;}})[_0x0820('0x2a')](function(_0x11c0ed){logger[_0x0820('0x26')](_0x0820('0x66'),_0x11c0ed);throw _0x11c0ed;});}return _0x2ba072;})['then'](respondWithResult(_0x294d0e,0xc9))[_0x0820('0x2a')](handleError(_0x294d0e,null));};exports[_0x0820('0x34')]=function(_0x5e0e70,_0x3ad4ab){if(_0x5e0e70[_0x0820('0x60')]['id']){delete _0x5e0e70[_0x0820('0x60')]['id'];}return db[_0x0820('0x55')]['find']({'where':{'id':_0x5e0e70[_0x0820('0x5b')]['id']},'include':[{'model':db[_0x0820('0x3e')],'as':_0x0820('0x5c')}]})[_0x0820('0x35')](handleEntityNotFound(_0x3ad4ab,null))[_0x0820('0x35')](saveUpdates(_0x5e0e70['body'],null))[_0x0820('0x35')](respondWithResult(_0x3ad4ab,null))['catch'](handleError(_0x3ad4ab,null));};exports['destroy']=function(_0x31ee52,_0xa93e89){return db[_0x0820('0x55')][_0x0820('0x5e')]({'where':{'id':_0x31ee52['params']['id']}})[_0x0820('0x35')](handleEntityNotFound(_0xa93e89,null))['then'](removeEntity(_0xa93e89,null))[_0x0820('0x2a')](handleError(_0xa93e89,null));};exports[_0x0820('0x67')]=function(_0x33b532,_0x1e8e91){return db[_0x0820('0x55')][_0x0820('0x67')]()[_0x0820('0x35')](respondWithResult(_0x1e8e91,null))['catch'](handleError(_0x1e8e91,null));};exports[_0x0820('0x68')]=function(_0x499978,_0x5c64ea,_0x22b460){if(_0x499978[_0x0820('0x60')]['id']){delete _0x499978[_0x0820('0x60')]['id'];}return db[_0x0820('0x55')][_0x0820('0x5e')]({'where':{'id':_0x499978[_0x0820('0x5b')]['id']}})[_0x0820('0x35')](handleEntityNotFound(_0x5c64ea,null))[_0x0820('0x35')](function(_0x5ce6b4){if(_0x5ce6b4){_0x499978[_0x0820('0x60')][_0x0820('0x69')]=_0x5ce6b4['id'];return db[_0x0820('0x6a')][_0x0820('0x5f')](_0x499978[_0x0820('0x60')]);}})['then'](respondWithResult(_0x5c64ea,null))['catch'](handleError(_0x5c64ea,null));};exports['getDispositions']=function(_0x16c30e,_0x2ec6f0,_0x34c2ea){var _0x4ccb2c={'raw':![],'where':{}};var _0x68431d={};var _0x8ecb6b={'count':0x0,'rows':[]};return db[_0x0820('0x55')]['findOne']({'where':{'id':_0x16c30e[_0x0820('0x5b')]['id']}})[_0x0820('0x35')](handleEntityNotFound(_0x2ec6f0,null))[_0x0820('0x35')](function(_0x4b3bf3){if(_0x4b3bf3){_0x68431d[_0x0820('0x41')]=_['keys'](db[_0x0820('0x6a')][_0x0820('0x5d')]);_0x68431d[_0x0820('0x42')]=_[_0x0820('0x43')](_0x16c30e['query']);_0x68431d['filters']=_[_0x0820('0x45')](_0x68431d[_0x0820('0x41')],_0x68431d['query']);_0x4ccb2c[_0x0820('0x46')]=_[_0x0820('0x45')](_0x68431d[_0x0820('0x41')],qs['fields'](_0x16c30e['query']['fields']));_0x4ccb2c['attributes']=_0x4ccb2c[_0x0820('0x46')][_0x0820('0x48')]?_0x4ccb2c[_0x0820('0x46')]:_0x68431d[_0x0820('0x41')];if(!_0x16c30e[_0x0820('0x42')][_0x0820('0x49')](_0x0820('0x4a'))){_0x4ccb2c[_0x0820('0x30')]=qs[_0x0820('0x30')](_0x16c30e[_0x0820('0x42')][_0x0820('0x30')]);_0x4ccb2c['offset']=qs[_0x0820('0x2f')](_0x16c30e[_0x0820('0x42')][_0x0820('0x2f')]);}_0x4ccb2c['order']=qs[_0x0820('0x4c')](_0x16c30e[_0x0820('0x42')][_0x0820('0x4c')]);_0x4ccb2c[_0x0820('0x4d')]=qs[_0x0820('0x44')](_[_0x0820('0x4e')](_0x16c30e[_0x0820('0x42')],_0x68431d[_0x0820('0x44')]));_0x4ccb2c['where'][_0x0820('0x69')]=_0x4b3bf3['id'];if(_0x16c30e[_0x0820('0x42')]['filter']){_0x4ccb2c['where']=_[_0x0820('0x4f')](_0x4ccb2c[_0x0820('0x4d')],{'$or':_[_0x0820('0x50')](_0x4ccb2c[_0x0820('0x46')],function(_0x36c635){var _0x4632be={};_0x4632be[_0x36c635]={'$like':'%'+_0x16c30e[_0x0820('0x42')][_0x0820('0x53')]+'%'};return _0x4632be;})});}_0x4ccb2c=_['merge']({},_0x4ccb2c,_0x16c30e[_0x0820('0x54')]);return db[_0x0820('0x6a')][_0x0820('0x2e')]({'where':_0x4ccb2c[_0x0820('0x4d')]})[_0x0820('0x35')](function(_0x5ddeeb){_0x8ecb6b[_0x0820('0x2e')]=_0x5ddeeb;if(_0x16c30e['query'][_0x0820('0x56')]){_0x4ccb2c['include']=[{'all':!![]}];}return db[_0x0820('0x6a')][_0x0820('0x58')](_0x4ccb2c);})[_0x0820('0x35')](function(_0x5dd08e){_0x8ecb6b[_0x0820('0x59')]=_0x5dd08e;return _0x8ecb6b;});}})[_0x0820('0x35')](respondWithFilteredResult(_0x2ec6f0,_0x4ccb2c))['catch'](handleError(_0x2ec6f0,null));};exports[_0x0820('0x6b')]=function(_0x15d8aa,_0x4d08be,_0x3111c6){return db['ChatWebsite'][_0x0820('0x5e')]({'where':{'id':_0x15d8aa[_0x0820('0x5b')]['id']}})[_0x0820('0x35')](handleEntityNotFound(_0x4d08be,null))['then'](function(_0x356396){if(_0x356396){return _0x356396['removeDispositions'](_0x15d8aa[_0x0820('0x42')][_0x0820('0x6c')]);}})[_0x0820('0x35')](respondWithStatusCode(_0x4d08be,null))[_0x0820('0x2a')](handleError(_0x4d08be,null));};exports[_0x0820('0x6d')]=function(_0x92ce89,_0x596442,_0x36f687){if(_0x92ce89['body']['id']){delete _0x92ce89[_0x0820('0x60')]['id'];}return db[_0x0820('0x55')]['find']({'where':{'id':_0x92ce89[_0x0820('0x5b')]['id']}})[_0x0820('0x35')](handleEntityNotFound(_0x596442,null))['then'](function(_0x12cf39){if(_0x12cf39){_0x92ce89[_0x0820('0x60')]['ChatWebsiteId']=_0x12cf39['id'];return db[_0x0820('0x6e')][_0x0820('0x5f')](_0x92ce89[_0x0820('0x60')]);}})[_0x0820('0x35')](respondWithResult(_0x596442,null))[_0x0820('0x2a')](handleError(_0x596442,null));};exports['getAnswers']=function(_0x5d44a0,_0x1e70a4,_0x1bf5ac){var _0x2faf7d={'raw':![],'where':{}};var _0x17e710={};var _0x1e46c4={'count':0x0,'rows':[]};return db[_0x0820('0x55')][_0x0820('0x6f')]({'where':{'id':_0x5d44a0[_0x0820('0x5b')]['id']}})[_0x0820('0x35')](handleEntityNotFound(_0x1e70a4,null))[_0x0820('0x35')](function(_0xa8fb29){if(_0xa8fb29){_0x17e710[_0x0820('0x41')]=_[_0x0820('0x43')](db[_0x0820('0x6e')]['rawAttributes']);_0x17e710[_0x0820('0x42')]=_[_0x0820('0x43')](_0x5d44a0[_0x0820('0x42')]);_0x17e710[_0x0820('0x44')]=_['intersection'](_0x17e710[_0x0820('0x41')],_0x17e710[_0x0820('0x42')]);_0x2faf7d[_0x0820('0x46')]=_['intersection'](_0x17e710[_0x0820('0x41')],qs[_0x0820('0x47')](_0x5d44a0[_0x0820('0x42')]['fields']));_0x2faf7d[_0x0820('0x46')]=_0x2faf7d[_0x0820('0x46')][_0x0820('0x48')]?_0x2faf7d[_0x0820('0x46')]:_0x17e710[_0x0820('0x41')];if(!_0x5d44a0[_0x0820('0x42')]['hasOwnProperty'](_0x0820('0x4a'))){_0x2faf7d[_0x0820('0x30')]=qs[_0x0820('0x30')](_0x5d44a0[_0x0820('0x42')][_0x0820('0x30')]);_0x2faf7d[_0x0820('0x2f')]=qs['offset'](_0x5d44a0[_0x0820('0x42')]['offset']);}_0x2faf7d['order']=qs[_0x0820('0x4c')](_0x5d44a0['query'][_0x0820('0x4c')]);_0x2faf7d[_0x0820('0x4d')]=qs[_0x0820('0x44')](_['pick'](_0x5d44a0[_0x0820('0x42')],_0x17e710['filters']));_0x2faf7d[_0x0820('0x4d')]['ChatWebsiteId']=_0xa8fb29['id'];if(_0x5d44a0[_0x0820('0x42')][_0x0820('0x53')]){_0x2faf7d[_0x0820('0x4d')]=_[_0x0820('0x4f')](_0x2faf7d[_0x0820('0x4d')],{'$or':_[_0x0820('0x50')](_0x2faf7d[_0x0820('0x46')],function(_0x18880a){var _0x2e3039={};_0x2e3039[_0x18880a]={'$like':'%'+_0x5d44a0[_0x0820('0x42')][_0x0820('0x53')]+'%'};return _0x2e3039;})});}_0x2faf7d=_['merge']({},_0x2faf7d,_0x5d44a0[_0x0820('0x54')]);return db[_0x0820('0x6e')][_0x0820('0x2e')]({'where':_0x2faf7d[_0x0820('0x4d')]})[_0x0820('0x35')](function(_0xfe0fa8){_0x1e46c4['count']=_0xfe0fa8;if(_0x5d44a0[_0x0820('0x42')]['includeAll']){_0x2faf7d[_0x0820('0x57')]=[{'all':!![]}];}return db[_0x0820('0x6e')][_0x0820('0x58')](_0x2faf7d);})[_0x0820('0x35')](function(_0x53e8bf){_0x1e46c4['rows']=_0x53e8bf;return _0x1e46c4;});}})[_0x0820('0x35')](respondWithFilteredResult(_0x1e70a4,_0x2faf7d))[_0x0820('0x2a')](handleError(_0x1e70a4,null));};exports[_0x0820('0x70')]=function(_0x58f772,_0x5b475b,_0x5d674c){return db[_0x0820('0x55')][_0x0820('0x5e')]({'where':{'id':_0x58f772[_0x0820('0x5b')]['id']}})[_0x0820('0x35')](handleEntityNotFound(_0x5b475b,null))[_0x0820('0x35')](function(_0x141f2f){if(_0x141f2f){return _0x141f2f[_0x0820('0x70')](_0x58f772[_0x0820('0x42')][_0x0820('0x6c')]);}})['then'](respondWithStatusCode(_0x5b475b,null))[_0x0820('0x2a')](handleError(_0x5b475b,null));};exports[_0x0820('0x71')]=function(_0xa3a83a,_0x4538b4,_0x1db48e){_0xa3a83a['body']['sitepic']=_0xa3a83a[_0x0820('0x72')][_0x0820('0x73')];return db['ChatWebsite'][_0x0820('0x5e')]({'where':{'id':_0xa3a83a[_0x0820('0x5b')]['id']}})['then'](handleEntityNotFound(_0x4538b4,null))['then'](saveUpdates(_0xa3a83a[_0x0820('0x60')],null))[_0x0820('0x35')](respondWithResult(_0x4538b4,null))[_0x0820('0x2a')](handleError(_0x4538b4,null));};exports[_0x0820('0x74')]=function(_0x4f2ad2,_0x216160,_0x1f5d2a){_0x4f2ad2[_0x0820('0x60')][_0x0820('0x75')]=_0x4f2ad2[_0x0820('0x72')]['filename'];return db[_0x0820('0x55')][_0x0820('0x5e')]({'where':{'id':_0x4f2ad2[_0x0820('0x5b')]['id']}})[_0x0820('0x35')](handleEntityNotFound(_0x216160,null))[_0x0820('0x35')](saveUpdates(_0x4f2ad2['body'],null))[_0x0820('0x35')](respondWithResult(_0x216160,null))[_0x0820('0x2a')](handleError(_0x216160,null));};exports[_0x0820('0x76')]=function(_0x39e28f,_0x24fafc,_0x5b03ff){_0x39e28f[_0x0820('0x60')][_0x0820('0x77')]=_0x39e28f[_0x0820('0x72')][_0x0820('0x73')];return db['ChatWebsite'][_0x0820('0x5e')]({'where':{'id':_0x39e28f[_0x0820('0x5b')]['id']}})[_0x0820('0x35')](handleEntityNotFound(_0x24fafc,null))[_0x0820('0x35')](saveUpdates(_0x39e28f[_0x0820('0x60')],null))[_0x0820('0x35')](respondWithResult(_0x24fafc,null))[_0x0820('0x2a')](handleError(_0x24fafc,null));};exports[_0x0820('0x78')]=function(_0x2bd3b0,_0x4a1221,_0x2e2e96){_0x2bd3b0[_0x0820('0x60')]['systemAvatar']=_0x2bd3b0['file']['filename'];return db['ChatWebsite'][_0x0820('0x5e')]({'where':{'id':_0x2bd3b0['params']['id']}})[_0x0820('0x35')](handleEntityNotFound(_0x4a1221,null))['then'](saveUpdates(_0x2bd3b0[_0x0820('0x60')],null))['then'](respondWithResult(_0x4a1221,null))[_0x0820('0x2a')](handleError(_0x4a1221,null));};exports[_0x0820('0x79')]=function(_0x749b8a,_0x510580,_0x256e2b){var _0x135718=path[_0x0820('0x7a')](config[_0x0820('0x7b')],_0x0820('0x7c'));var _0x1779ba={'where':{'id':_0x749b8a[_0x0820('0x5b')]['id']},'attributes':['id',_0x0820('0x7d')],'raw':!![]};var _0xfe44ee=![];return require('../../config/license/util')[_0x0820('0x7e')]()['then'](function(_0x44766c){if(_0x44766c){_0xfe44ee=_0x44766c[_0x0820('0x7f')];}})[_0x0820('0x35')](function(){return db[_0x0820('0x55')][_0x0820('0x5e')](_0x1779ba);})['then'](handleEntityNotFound(_0x510580,null))[_0x0820('0x35')](function(_0x3ae62b){if(_0x3ae62b){if(!_[_0x0820('0x80')](_0x3ae62b[_0x0820('0x7d')])){if(fs[_0x0820('0x81')](path['join'](config[_0x0820('0x7b')],_0x0820('0x82'),_0x3ae62b[_0x0820('0x7d')]))&&_0xfe44ee){_0x135718=path['join'](config[_0x0820('0x7b')],_0x0820('0x82'),_0x3ae62b[_0x0820('0x7d')]);}}return _0x510580[_0x0820('0x83')](_0x135718);}})['catch'](handleError(_0x510580,null));};exports[_0x0820('0x84')]=function(_0x35efff,_0x25ebd7,_0x1d0138){var _0x31bdf4=path[_0x0820('0x7a')](config[_0x0820('0x7b')],_0x0820('0x85'));var _0x1b4876={'where':{'id':_0x35efff['params']['id']},'attributes':['id',_0x0820('0x75')],'raw':!![]};return db[_0x0820('0x55')]['find'](_0x1b4876)[_0x0820('0x35')](handleEntityNotFound(_0x25ebd7,null))[_0x0820('0x35')](function(_0x515e7f){if(_0x515e7f){if(!_['isNil'](_0x515e7f['agentAvatar'])){if(fs['existsSync'](path[_0x0820('0x7a')](config[_0x0820('0x7b')],'server/files/images/avatars/',_0x515e7f['agentAvatar']))){_0x31bdf4=path[_0x0820('0x7a')](config[_0x0820('0x7b')],_0x0820('0x86'),_0x515e7f[_0x0820('0x75')]);}}return _0x25ebd7[_0x0820('0x83')](_0x31bdf4);}})[_0x0820('0x2a')](handleError(_0x25ebd7,null));};exports[_0x0820('0x87')]=function(_0x1a91b7,_0xae7957,_0x280c18){var _0x599987=path[_0x0820('0x7a')](config['root'],_0x0820('0x88'));var _0x172778={'where':{'id':_0x1a91b7[_0x0820('0x5b')]['id']},'attributes':['id',_0x0820('0x77'),_0x0820('0x89')],'raw':!![]};return db['ChatWebsite'][_0x0820('0x5e')](_0x172778)[_0x0820('0x35')](handleEntityNotFound(_0xae7957,null))[_0x0820('0x35')](function(_0x500cbd){if(_0x500cbd){if(!_[_0x0820('0x80')](_0x500cbd[_0x0820('0x77')])){if(fs[_0x0820('0x81')](path[_0x0820('0x7a')](config[_0x0820('0x7b')],_0x0820('0x86'),_0x500cbd[_0x0820('0x77')]))&&_0x500cbd[_0x0820('0x89')]){_0x599987=path[_0x0820('0x7a')](config[_0x0820('0x7b')],_0x0820('0x86'),_0x500cbd[_0x0820('0x77')]);}}return _0xae7957[_0x0820('0x83')](_0x599987);}})[_0x0820('0x2a')](handleError(_0xae7957,null));};exports[_0x0820('0x8a')]=function(_0x4c3d5b,_0x16f34d,_0x47a881){var _0xcd93c0=path[_0x0820('0x7a')](config['root'],_0x0820('0x8b'));var _0x210fc0={'where':{'id':_0x4c3d5b[_0x0820('0x5b')]['id']},'attributes':['id',_0x0820('0x8c')],'raw':!![]};return db['ChatWebsite'][_0x0820('0x5e')](_0x210fc0)[_0x0820('0x35')](handleEntityNotFound(_0x16f34d,null))[_0x0820('0x35')](function(_0x4f3608){if(_0x4f3608){if(!_[_0x0820('0x80')](_0x4f3608[_0x0820('0x8c')])){if(fs[_0x0820('0x81')](path['join'](config[_0x0820('0x7b')],_0x0820('0x86'),_0x4f3608[_0x0820('0x8c')]))){_0xcd93c0=path[_0x0820('0x7a')](config['root'],'server/files/images/avatars/',_0x4f3608[_0x0820('0x8c')]);}}return _0x16f34d[_0x0820('0x83')](_0xcd93c0);}})['catch'](handleError(_0x16f34d,null));};exports[_0x0820('0x8d')]=function(_0x24ae5f,_0x2f7b7b,_0xbe653f){var _0x254790=require(_0x0820('0x8e'));var _0x3c17f5=new _0x254790();var _0x4d6564=_0x3c17f5['setUA'](_0x24ae5f[_0x0820('0x8f')][_0x0820('0x90')])[_0x0820('0x91')]();var _0x26000b={'body':_0x24ae5f[_0x0820('0x60')],'channel':_0x0820('0x92')};var _0x506b53=[];var _0x298101=[];var _0x15460c={};var _0x3514e2=![];return db[_0x0820('0x93')][_0x0820('0x67')]()[_0x0820('0x35')](function(_0x19f486){if(!_0x19f486){throw new db[(_0x0820('0x1f'))][(_0x0820('0x20'))](_0x0820('0x94'));}_0x506b53=_[_0x0820('0x95')](_['keys'](_0x19f486),[_0x0820('0x96'),_0x0820('0x97')]);_0x298101=_['difference'](_[_0x0820('0x43')](_0x19f486),['createdAt',_0x0820('0x97'),_0x0820('0x98'),'ListId']);if(_0x24ae5f[_0x0820('0x60')]['id']){delete _0x24ae5f[_0x0820('0x60')]['id'];}if(_[_0x0820('0x80')](_0x24ae5f[_0x0820('0x60')]['from'])){throw new db[(_0x0820('0x1f'))][(_0x0820('0x20'))](_0x0820('0x99'));}if(_['isNil'](_0x24ae5f['body'][_0x0820('0x60')])||_0x24ae5f['body']['body']===''){throw new db[(_0x0820('0x1f'))][(_0x0820('0x20'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x0820('0x80')](_0x24ae5f['body'][_0x0820('0x9a')])){throw new db[(_0x0820('0x1f'))]['ValidationError'](_0x0820('0x9b')+_0x298101);}if(!_['includes'](_0x298101,_0x24ae5f[_0x0820('0x60')]['mapKey'])){throw new db[(_0x0820('0x1f'))][(_0x0820('0x20'))](_0x0820('0x9c')+_0x298101);}_0x15460c[_0x24ae5f[_0x0820('0x60')][_0x0820('0x9a')]]=_0x24ae5f['body']['from'];})[_0x0820('0x35')](function(){return db['ChatWebsite'][_0x0820('0x5e')]({'where':{'id':_0x24ae5f['params']['id']},'include':[{'model':db[_0x0820('0x9d')],'as':_0x0820('0x9e'),'include':[{'model':db[_0x0820('0x93')],'as':'Contacts','where':_0x15460c,'limit':0x1,'order':[[_0x0820('0x97'),_0x0820('0x9f')]]}]},{'model':db[_0x0820('0xa0')],'as':_0x0820('0xa1')}]});})['then'](handleEntityNotFound(_0x2f7b7b,null))[_0x0820('0x35')](function(_0x422fe5){if(_0x422fe5&&_0x422fe5[_0x0820('0x9e')]){_0x26000b['account']=_0x422fe5;_0x26000b[_0x0820('0xa2')]=_0x422fe5['Applications'];_0x26000b[_0x0820('0xa3')]=_0x422fe5['List'];_0x26000b[_0x0820('0xa2')]=_[_0x0820('0xa4')](_0x26000b[_0x0820('0xa2')],[_0x0820('0xa5')],[_0x0820('0xa6')]);if(_0x26000b[_0x0820('0xa7')]['Applications']){delete _0x26000b[_0x0820('0xa7')][_0x0820('0xa1')];}if(_0x26000b[_0x0820('0xa7')]['List']&&_0x26000b['account'][_0x0820('0x9e')][_0x0820('0xa8')]['length']){return _0x26000b[_0x0820('0xa7')][_0x0820('0x9e')][_0x0820('0xa8')][0x0];}var _0x3f5623=_[_0x0820('0x18')](_0x24ae5f[_0x0820('0x60')],{'firstName':_0x24ae5f['body'][_0x0820('0xa9')],'ListId':_0x422fe5['ListId']});_0x3f5623[_0x24ae5f[_0x0820('0x60')][_0x0820('0x9a')]]=_0x24ae5f[_0x0820('0x60')][_0x0820('0xa9')];return db[_0x0820('0x93')][_0x0820('0x5f')](_0x3f5623,{'fields':_0x506b53,'raw':!![]});}})['then'](handleEntityNotFound(_0x2f7b7b,null))[_0x0820('0x35')](function(_0x11cefc){_0x26000b[_0x0820('0xaa')]=_0x11cefc;var _0x530ac1=_0x24ae5f[_0x0820('0x60')]['customerIp'];if(_0x24ae5f[_0x0820('0x8f')][_0x0820('0xab')]){_0x530ac1=_0x24ae5f[_0x0820('0x8f')][_0x0820('0xab')];}else if(_0x24ae5f[_0x0820('0x8f')][_0x0820('0xac')]){_0x530ac1=_[_0x0820('0xad')](_0x24ae5f[_0x0820('0x8f')][_0x0820('0xac')][_0x0820('0xae')](','));}if(_0x11cefc){var _0x3fbd2f={'ContactId':_0x11cefc['id'],'ChatWebsiteId':_0x24ae5f['params']['id'],'from':(_0x11cefc['firstName']||'')+'\x20'+(_0x11cefc[_0x0820('0xaf')]||''),'customerIp':_0x530ac1,'customerPort':_0x24ae5f['headers'][_0x0820('0xb0')]?_0x24ae5f[_0x0820('0x8f')]['x-real-port']:null,'referer':_0x24ae5f[_0x0820('0x60')][_0x0820('0xb1')],'browserName':_0x4d6564[_0x0820('0xb2')][_0x0820('0x3b')]&&_0x4d6564[_0x0820('0xb2')][_0x0820('0xb3')]?util[_0x0820('0xb4')](_0x0820('0xb5'),_0x4d6564[_0x0820('0xb2')][_0x0820('0x3b')],_0x4d6564[_0x0820('0xb2')]['version']):'unknown','browserVersion':_0x4d6564[_0x0820('0xb2')]['version']||_0x0820('0xb6'),'osName':util[_0x0820('0xb4')](_0x0820('0xb5'),_0x4d6564['os'][_0x0820('0x3b')],_0x4d6564['os'][_0x0820('0xb3')]),'osVersion':_0x4d6564['os'][_0x0820('0xb3')],'deviceModel':_0x4d6564['device'][_0x0820('0x41')]&&_0x4d6564['device']['vendor']?util[_0x0820('0xb4')](_0x0820('0xb7'),_0x4d6564[_0x0820('0xb8')]['model'],_0x4d6564['device'][_0x0820('0xb9')],_0x4d6564[_0x0820('0xb8')][_0x0820('0x51')]):null,'deviceVendor':_0x4d6564[_0x0820('0xb8')][_0x0820('0xb9')],'deviceType':_0x4d6564[_0x0820('0xb8')][_0x0820('0x51')],'formData':JSON['stringify'](_0x24ae5f[_0x0820('0x60')])};var _0x52f35b={'ChatWebsiteId':_0x24ae5f['params']['id'],'closed':![]};if(_0x24ae5f['body'][_0x0820('0xba')]){_0x52f35b['threadId']=_0x24ae5f[_0x0820('0x60')][_0x0820('0xba')];return db[_0x0820('0xbb')][_0x0820('0x5e')]({'where':_0x52f35b})[_0x0820('0x35')](function(_0x58a48b){if(_0x58a48b){return[_0x58a48b,![]];}_0x3fbd2f[_0x0820('0xba')]=_0x24ae5f[_0x0820('0x60')][_0x0820('0xba')];_0x3fbd2f[_0x0820('0xbc')]=_0x24ae5f[_0x0820('0x60')][_0x0820('0xbc')];return db[_0x0820('0xbb')]['create'](_0x3fbd2f)[_0x0820('0x35')](function(_0x2bf52b){return[_0x2bf52b,!![]];});});}_0x52f35b[_0x0820('0xbd')]=_0x11cefc['id'];if(_0x24ae5f[_0x0820('0x60')][_0x0820('0xbe')]&&_0x24ae5f[_0x0820('0x60')][_0x0820('0xbe')]['id']){_0x52f35b['id']=_0x24ae5f['body'][_0x0820('0xbe')]['id'];return db[_0x0820('0xbb')][_0x0820('0x5e')]({'where':_0x52f35b})['then'](function(_0x485dd8){if(_0x485dd8){return[_0x485dd8,![]];}return db['ChatInteraction'][_0x0820('0x5f')](_0x3fbd2f)[_0x0820('0x35')](function(_0x313de2){return[_0x313de2,!![]];});});}return db['ChatInteraction']['create'](_0x3fbd2f)['then'](function(_0x485fe9){return[_0x485fe9,!![]];});}})[_0x0820('0xbf')](function(_0x47b143,_0x1c6bcc){if(_0x47b143){_0x3514e2=_0x1c6bcc;if(!_0x1c6bcc){var _0x2a293f={'from':(_0x26000b[_0x0820('0xaa')][_0x0820('0xc0')]||'')+'\x20'+(_0x26000b[_0x0820('0xaa')]['lastName']||'')};if(_0x24ae5f['body']['threadId']&&_0x24ae5f[_0x0820('0x60')][_0x0820('0xc1')]&&_0x24ae5f[_0x0820('0x60')][_0x0820('0xba')]!=_0x24ae5f[_0x0820('0x60')][_0x0820('0xc1')]){_0x2a293f[_0x0820('0xba')]=_0x24ae5f['body'][_0x0820('0xc1')];}return _0x47b143['update'](_0x2a293f);}else{return _0x47b143;}}})['then'](function(_0x3c3236){_0x26000b[_0x0820('0xbe')]=_0x3c3236[_0x0820('0x37')]({'plain':!![]});_0x26000b[_0x0820('0xbe')]['created']=_0x3514e2;if(_0x26000b[_0x0820('0xbe')][_0x0820('0xc2')]){if(_0x26000b[_0x0820('0xa7')]['autoclose']){_0x26000b[_0x0820('0xa2')][_0x0820('0xc3')]({'id':0x0,'priority':_0x26000b['applications'][_0x0820('0x48')]+0x1,'app':'close','appdata':_0x0820('0xc4'),'interval':'*,*,*,*'});}}return db[_0x0820('0xc5')][_0x0820('0x5f')]({'body':_0x24ae5f[_0x0820('0x60')][_0x0820('0x60')],'ChatWebsiteId':_0x24ae5f[_0x0820('0x5b')]['id'],'ChatInteractionId':_0x3c3236['id'],'direction':'in','ContactId':_0x26000b[_0x0820('0xaa')]['id'],'AttachmentId':_0x24ae5f['body']['AttachmentId']});})['then'](function(_0x201623){_0x26000b[_0x0820('0x28')]=_0x201623;if(_0x26000b['interaction']['UserId']){return db['User'][_0x0820('0x5e')]({'attributes':['id',_0x0820('0x3b')],'where':{'id':_0x26000b[_0x0820('0xbe')][_0x0820('0xc6')]}})[_0x0820('0x35')](function(_0x20f7b7){if(_0x20f7b7){_0x26000b['applications'][_0x0820('0xc7')]({'id':0x0,'priority':0x0,'app':_0x0820('0xc8'),'appdata':_0x20f7b7[_0x0820('0x3b')]+','+(_0x26000b[_0x0820('0xa7')][_0x0820('0xc9')]||0xa),'interval':'*,*,*,*'});_0x26000b['forcedOwnership']=!![];}return respondWithRpcPromise(_0x0820('0xca'),'startRouting',_0x26000b);});}return respondWithRpcPromise(_0x0820('0xca'),_0x0820('0xcb'),_0x26000b);})[_0x0820('0x35')](function(_0x35333a){respondWithRpcPromise(_0x0820('0xcc'),_0x0820('0xcc'),{'event':_0x0820('0x8d'),'message':_0x35333a},client9002);return _0x35333a;})['then'](respondWithResult(_0x2f7b7b,null))[_0x0820('0x2a')](handleError(_0x2f7b7b,null));};exports[_0x0820('0xcd')]=function(_0x374fe3,_0xf62210,_0x418f48){var _0x56aafa,_0x8c2d49,_0x49455e;var _0x5ce356=[];var _0x5e6f82=[];var _0xf5554c={};return db[_0x0820('0x93')]['describe']()[_0x0820('0x35')](function(_0x546a78){if(!_0x546a78){throw new db['Sequelize'][(_0x0820('0x20'))](_0x0820('0x94'));}_0x5e6f82=_['difference'](_[_0x0820('0x43')](_0x546a78),[_0x0820('0x96'),_0x0820('0x97')]);_0x5ce356=_[_0x0820('0x95')](_[_0x0820('0x43')](_0x546a78),[_0x0820('0x96'),_0x0820('0x97'),_0x0820('0x98'),'ListId']);if(_0x374fe3[_0x0820('0x60')]['id']){delete _0x374fe3['body']['id'];}if(_['isNil'](_0x374fe3[_0x0820('0x60')][_0x0820('0xa9')])){throw _0xf62210[_0x0820('0x2c')](0x1f4)[_0x0820('0x3c')](new db[(_0x0820('0x1f'))][(_0x0820('0x20'))](_0x0820('0x99')));}if(_[_0x0820('0x80')](_0x374fe3[_0x0820('0x60')][_0x0820('0x60')])||_0x374fe3['body']['body']===''){throw _0xf62210[_0x0820('0x2c')](0x1f4)[_0x0820('0x3c')](new db[(_0x0820('0x1f'))][(_0x0820('0x20'))](_0x0820('0xce')));}if(_[_0x0820('0x80')](_0x374fe3[_0x0820('0x60')]['mapKeyOffline'])){throw _0xf62210['status'](0x1f4)[_0x0820('0x3c')](new db[(_0x0820('0x1f'))][(_0x0820('0x20'))](_0x0820('0xcf')+_0x5ce356));}if(!_['includes'](_0x5ce356,_0x374fe3[_0x0820('0x60')]['mapKeyOffline'])){throw _0xf62210[_0x0820('0x2c')](0x1f4)[_0x0820('0x3c')](new db[(_0x0820('0x1f'))]['ValidationError']('mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x5ce356));}_0xf5554c[_0x374fe3[_0x0820('0x60')][_0x0820('0xd0')]]=_0x374fe3[_0x0820('0x60')]['from'];})['then'](function(){return db[_0x0820('0x55')]['find']({'where':{'id':_0x374fe3[_0x0820('0x5b')]['id']},'include':[{'model':db[_0x0820('0x9d')],'as':_0x0820('0x9e')}]});})[_0x0820('0x35')](handleEntityNotFound(_0xf62210,null))[_0x0820('0x35')](function(_0x3f10d9){if(_0x3f10d9&&_0x3f10d9[_0x0820('0x9e')]){_0x8c2d49=_0x3f10d9;var _0x375bca=_[_0x0820('0x18')](_0x374fe3[_0x0820('0x60')],{'firstName':_0x374fe3['body'][_0x0820('0xa9')],'phone':_0x374fe3[_0x0820('0x60')][_0x0820('0xa9')],'ListId':_0x3f10d9['ListId']});_0x375bca[_0x374fe3[_0x0820('0x60')][_0x0820('0xd0')]]=_0x374fe3[_0x0820('0x60')][_0x0820('0xa9')];return db[_0x0820('0x93')][_0x0820('0xd1')]({'where':_0xf5554c,'defaults':_0x375bca});}})[_0x0820('0xbf')](function(_0x1bc662){if(_0x1bc662){_0x49455e=_0x1bc662;var _0x445906=fs['readFileSync'](path[_0x0820('0x7a')](config['root'],_0x0820('0xd2')),_0x0820('0xd3'));var _0x293beb=ejs[_0x0820('0xd4')](_0x445906,{'body':_[_0x0820('0xd5')](_0x374fe3[_0x0820('0x60')][_0x0820('0x60')]),'bodyTitle':_0x8c2d49[_0x0820('0xd6')]});return db[_0x0820('0xd7')][_0x0820('0x5f')]({'body':_0x293beb,'ContactId':_0x1bc662['id'],'ChatWebsiteId':_0x8c2d49['id']});}})[_0x0820('0x35')](function(_0x2a628d){if(_0x2a628d){_0x56aafa=_0x2a628d;return db[_0x0820('0xd8')][_0x0820('0x6f')]({'where':{'service':!![]},'include':[{'model':db[_0x0820('0xd9')],'as':'Smtp','raw':!![]}]});}})[_0x0820('0x35')](function(_0x2bdf59){if(_0x2bdf59&&_0x2bdf59[_0x0820('0xda')]&&_0x8c2d49[_0x0820('0xdb')]){var _0x34f105={'tls':{'rejectUnauthorized':![]}};if(_0x2bdf59['Smtp'][_0x0820('0xdc')]){_0x34f105[_0x0820('0xdc')]=_0x2bdf59[_0x0820('0xda')][_0x0820('0xdc')];}else{_0x34f105['host']=_0x2bdf59[_0x0820('0xda')][_0x0820('0xdd')];_0x34f105['port']=_0x2bdf59[_0x0820('0xda')][_0x0820('0xde')];_0x34f105[_0x0820('0xdf')]=_0x2bdf59[_0x0820('0xda')][_0x0820('0xdf')];}if(_0x2bdf59[_0x0820('0xda')][_0x0820('0xe0')]){_0x34f105[_0x0820('0xe1')]={'user':_0x2bdf59[_0x0820('0xda')][_0x0820('0x61')],'pass':_0x2bdf59['Smtp']['pass']};}return respondWithRpcPromise(_0x0820('0xe2'),_0x0820('0xe3'),{'account':_0x34f105,'message':{'from':util['format']('\x22%s\x22\x20<%s>',_0x2bdf59[_0x0820('0x3b')],_0x2bdf59[_0x0820('0xe4')]||_0x2bdf59['Smtp']['user']),'to':_0x8c2d49[_0x0820('0xdb')],'subject':_0x8c2d49[_0x0820('0xe5')],'text':_0x56aafa['body']}},client9003)['then'](function(){return _0x56aafa;})[_0x0820('0x2a')](function(_0x229496){console[_0x0820('0x26')](_0x229496);});}})[_0x0820('0x35')](function(){if(_0x56aafa){return _0x56aafa;}})[_0x0820('0x35')](respondWithResult(_0xf62210,null))[_0x0820('0x2a')](handleError(_0xf62210,null));};exports['addInteraction']=function(_0x4cc818,_0x1b4fa7,_0x4abed8){return db[_0x0820('0xbb')][_0x0820('0x5e')]({'where':{'id':_0x4cc818['params']['id']}})[_0x0820('0x35')](handleEntityNotFound(_0x1b4fa7,null))['then'](function(_0x4ba6ca){if(_0x4ba6ca){return _0x4ba6ca[_0x0820('0xe6')](_0x4cc818[_0x0820('0x60')][_0x0820('0x6c')],_[_0x0820('0xe7')](_0x4cc818[_0x0820('0x60')],[_0x0820('0x6c'),'id'])||{});}})[_0x0820('0x35')](respondWithResult(_0x1b4fa7,null))['catch'](handleError(_0x1b4fa7,null));};exports[_0x0820('0xe8')]=function(_0x1bc247,_0x277c72,_0x19bfa7){var _0x238f27={'raw':![],'where':{}};var _0x59e39c={};var _0x4cbd92={'count':0x0,'rows':[]};return db[_0x0820('0x55')][_0x0820('0x6f')]({'where':{'id':_0x1bc247['params']['id']}})[_0x0820('0x35')](handleEntityNotFound(_0x277c72,null))[_0x0820('0x35')](function(_0x21571d){if(_0x21571d){_0x59e39c[_0x0820('0x41')]=_['keys'](db[_0x0820('0xbb')][_0x0820('0x5d')]);_0x59e39c['query']=_[_0x0820('0x43')](_0x1bc247[_0x0820('0x42')]);_0x59e39c[_0x0820('0x44')]=_[_0x0820('0x45')](_0x59e39c[_0x0820('0x41')],_0x59e39c[_0x0820('0x42')]);_0x238f27[_0x0820('0x46')]=_['intersection'](_0x59e39c[_0x0820('0x41')],qs[_0x0820('0x47')](_0x1bc247['query'][_0x0820('0x47')]));_0x238f27[_0x0820('0x46')]=_0x238f27[_0x0820('0x46')][_0x0820('0x48')]?_0x238f27[_0x0820('0x46')]:_0x59e39c[_0x0820('0x41')];if(!_0x1bc247[_0x0820('0x42')]['hasOwnProperty'](_0x0820('0x4a'))){_0x238f27['limit']=qs[_0x0820('0x30')](_0x1bc247[_0x0820('0x42')][_0x0820('0x30')]);_0x238f27['offset']=qs['offset'](_0x1bc247[_0x0820('0x42')][_0x0820('0x2f')]);}_0x238f27[_0x0820('0x4b')]=qs[_0x0820('0x4c')](_0x1bc247[_0x0820('0x42')][_0x0820('0x4c')]);_0x238f27[_0x0820('0x4d')]=qs[_0x0820('0x44')](_[_0x0820('0x4e')](_0x1bc247[_0x0820('0x42')],_0x59e39c[_0x0820('0x44')]));_0x238f27[_0x0820('0x4d')][_0x0820('0x69')]=_0x21571d['id'];if(_0x1bc247['query'][_0x0820('0x53')]){_0x238f27[_0x0820('0x4d')]=_[_0x0820('0x4f')](_0x238f27[_0x0820('0x4d')],{'$or':_[_0x0820('0x50')](_0x238f27[_0x0820('0x46')],function(_0x1a7ea6){var _0x276bc0={};_0x276bc0[_0x1a7ea6]={'$like':'%'+_0x1bc247['query'][_0x0820('0x53')]+'%'};return _0x276bc0;})});}_0x238f27=_['merge']({},_0x238f27,_0x1bc247[_0x0820('0x54')]);return db[_0x0820('0xbb')]['count']({'where':_0x238f27['where']})[_0x0820('0x35')](function(_0x1f0244){_0x4cbd92[_0x0820('0x2e')]=_0x1f0244;if(_0x1bc247[_0x0820('0x42')][_0x0820('0x56')]){_0x238f27[_0x0820('0x57')]=[{'model':db[_0x0820('0x93')],'as':_0x0820('0xe9'),'required':![]},{'model':db[_0x0820('0xea')],'as':_0x0820('0xeb'),'attributes':[_0x0820('0x3b'),_0x0820('0xec'),_0x0820('0xed')],'required':![]},{'model':db[_0x0820('0xee')],'as':_0x0820('0xef'),'attributes':['id','name',_0x0820('0xf0')],'where':_0x1bc247[_0x0820('0x42')][_0x0820('0xf1')]?{'id':_0x1bc247[_0x0820('0x42')][_0x0820('0xf1')]}:undefined,'required':_0x1bc247[_0x0820('0x42')][_0x0820('0xf1')]?!![]:![]}];}return db[_0x0820('0xbb')]['findAll'](_0x238f27);})['then'](function(_0x4a5973){_0x4cbd92[_0x0820('0x59')]=_0x4a5973;return _0x4cbd92;});}})[_0x0820('0x35')](respondWithFilteredResult(_0x277c72,_0x238f27))['catch'](handleError(_0x277c72,null));};function iftimePromise(_0x743cef,_0x100eba){return respondWithRpcPromise('Command',_0x0820('0xf2'),{'command':_0x100eba[_0x0820('0xf3')]?util[_0x0820('0xb4')]('iftime\x20%s,%s',_0x743cef[_0x0820('0xf4')],_0x100eba[_0x0820('0xf3')]):util[_0x0820('0xb4')](_0x0820('0xf5'),_0x743cef[_0x0820('0xf4')])},client9002)[_0x0820('0x35')](function(_0x42e4cb){var _0x3ea319=_0x42e4cb&&_0x42e4cb[_0x0820('0xf6')](_0x0820('0xf7'))>=0x0?!![]:![];logger[_0x0820('0x22')](_0x0820('0xf8'),_0x100eba['id'],_0x743cef['id'],_0x743cef[_0x0820('0xf4')],_0x3ea319?_0x0820('0xf9'):'OFFLINE',_0x100eba[_0x0820('0xf3')]?_0x100eba[_0x0820('0xf3')]:_0x0820('0xfa'));return _0x3ea319;})[_0x0820('0x2a')](function(_0x21f2a9){logger[_0x0820('0x26')](_0x0820('0xf8'),_0x100eba['id'],_0x743cef['id'],_0x743cef['interval'],util['inspect'](_0x21f2a9,{'showHidden':![],'depth':null}),_0x100eba['timezone']?_0x100eba[_0x0820('0xf3')]:_0x0820('0xfa'));return![];});}exports[_0x0820('0xf2')]=function(_0x280467,_0x58104d,_0x19e5d6){var _0x521905=0x0;var _0xa128af=0x0;var _0x3b1892=![];var _0x19ca09;var _0x238671;return db[_0x0820('0x55')]['find']({'where':{'id':_0x280467['params']['id']},'include':[{'model':db[_0x0820('0xfb')],'as':_0x0820('0xfb'),'include':[{'model':db['Interval'],'as':_0x0820('0xfc'),'attributes':['id',_0x0820('0xf4')],'raw':!![]}]}]})[_0x0820('0x35')](handleEntityNotFound(_0x58104d,null))[_0x0820('0x35')](function(_0x5ded2c){if(_0x5ded2c){_0x19ca09=_0x5ded2c;return _0x5ded2c[_0x0820('0xfd')]({'raw':!![]});}})[_0x0820('0x35')](function(_0x2926f4){if(_0x19ca09){if(_0x2926f4){_0x238671=_0x2926f4;}}return require(_0x0820('0xfe'))[_0x0820('0x7e')]();})[_0x0820('0x35')](function(_0x42c07a){if(_0x42c07a){_0xa128af=_0x42c07a[_0x0820('0xff')];_0x3b1892=_0x42c07a[_0x0820('0x7f')];}})[_0x0820('0x35')](function(){return db['ChatInteraction']['count']({'where':{'closed':![]}});})[_0x0820('0x35')](function(_0x60d240){_0x521905=_0x60d240;if(_0xa128af&&_0x60d240>_0xa128af){return db[_0x0820('0x100')]['findOne']({'where':{'id':0x1}})[_0x0820('0x35')](function(_0x454ce1){if(_0x454ce1){_0x454ce1[_0x0820('0x101')](_0x0820('0x102'));}});}})['then'](function(){if(_0x19ca09[_0x0820('0xfb')]&&_0x19ca09[_0x0820('0xfb')][_0x0820('0xfc')]){var _0x43d0c5=[];for(var _0x32fa20=0x0;_0x32fa20<_0x19ca09['Interval'][_0x0820('0xfc')][_0x0820('0x48')];_0x32fa20++){var _0x15ea50=_0x19ca09[_0x0820('0xfb')][_0x0820('0xfc')][_0x32fa20][_0x0820('0x37')]({'plain':!![]});_0x43d0c5[_0x0820('0xc3')](iftimePromise(_0x15ea50,_0x19ca09));}return BPromise['all'](_0x43d0c5)[_0x0820('0x35')](function(_0x33b925){return _[_0x0820('0x103')](_0x33b925);});}else{return!![];}})[_0x0820('0x35')](function(_0x2c191a){var _0x447a2e=fs['readFileSync'](path['join'](config[_0x0820('0x7b')],_0x0820('0x104')),_0x0820('0xd3'));var _0x2603e9={'remote':_0x19ca09[_0x0820('0x105')],'query':querystring[_0x0820('0x106')](_[_0x0820('0x4f')](_0x19ca09[_0x0820('0x37')]({'plain':!![]}),{'customerIp':_0x280467[_0x0820('0x8f')][_0x0820('0xac')]||_0x280467[_0x0820('0x8f')][_0x0820('0x107')]||_0x280467[_0x0820('0x108')][_0x0820('0x109')]||_0x280467['ip'],'referer':_0x280467[_0x0820('0x8f')][_0x0820('0xb1')],'openedInteractions':_0x521905,'maxInteractions':_0xa128af,'virtual':_0x3b1892[_0x0820('0xff')],'online':_0x2c191a,'custom':_0x3b1892}))[_0x0820('0x10a')](/'/g,'\x5c\x27')};_0x58104d[_0x0820('0x3c')](ejs[_0x0820('0xd4')](Mustache[_0x0820('0xd4')](_0x447a2e,_0x2603e9),{'proactiveActions':_0x238671,'alignment':_0x19ca09['alignment'],'verticalAlignment':_0x19ca09[_0x0820('0x10b')],'div_color':_0x19ca09['color'],'text_color':_0x19ca09[_0x0820('0x10c')]}));})[_0x0820('0x2a')](handleError(_0x58104d,null));};exports[_0x0820('0x10d')]=function(_0x345001,_0x44f347,_0x31ceb5){return db[_0x0820('0x55')][_0x0820('0x6f')]({'where':{'id':_0x345001['params']['id']}})[_0x0820('0x35')](handleEntityNotFound(_0x44f347,null))[_0x0820('0x35')](function(_0x1ebf4c){if(_0x1ebf4c){return db['sequelize'][_0x0820('0x10e')](function(_0x2c811a){return db[_0x0820('0xa0')][_0x0820('0x36')]({'where':{'ChatWebsiteId':_0x345001[_0x0820('0x5b')]['id']},'transaction':_0x2c811a})[_0x0820('0x35')](function(_0x39c9d1){var _0x2c028b=_['map'](_0x345001[_0x0820('0x60')],function(_0x95f83d){_0x95f83d[_0x0820('0x69')]=_0x345001['params']['id'];return _0x95f83d;});return db[_0x0820('0xa0')]['bulkCreate'](_0x2c028b,{'transaction':_0x2c811a});});})[_0x0820('0x35')](function(){return db[_0x0820('0xa0')]['findAndCountAll']({'where':{'ChatWebsiteId':_0x345001[_0x0820('0x5b')]['id']},'order':_0x0820('0xa5')});});}})[_0x0820('0x35')](respondWithResult(_0x44f347,null))[_0x0820('0x2a')](handleError(_0x44f347,null));};exports[_0x0820('0x10f')]=function(_0x5d3551,_0x723b90,_0x2d70b4){var _0x2cbee7={};var _0x8dd2dc={};var _0x56ba27;var _0x1496e0;return db[_0x0820('0x55')][_0x0820('0x6f')]({'where':{'id':_0x5d3551[_0x0820('0x5b')]['id']}})['then'](handleEntityNotFound(_0x723b90,null))['then'](function(_0x29c36e){if(_0x29c36e){_0x56ba27=_0x29c36e;_0x8dd2dc[_0x0820('0x41')]=_['keys'](db[_0x0820('0xa0')][_0x0820('0x5d')]);_0x8dd2dc['query']=_[_0x0820('0x43')](_0x5d3551['query']);_0x8dd2dc['filters']=_[_0x0820('0x45')](_0x8dd2dc[_0x0820('0x41')],_0x8dd2dc[_0x0820('0x42')]);_0x2cbee7[_0x0820('0x46')]=_['intersection'](_0x8dd2dc[_0x0820('0x41')],qs[_0x0820('0x47')](_0x5d3551['query'][_0x0820('0x47')]));_0x2cbee7['attributes']=_0x2cbee7['attributes'][_0x0820('0x48')]?_0x2cbee7['attributes']:_0x8dd2dc[_0x0820('0x41')];_0x2cbee7[_0x0820('0x4b')]=qs[_0x0820('0x4c')](_0x5d3551[_0x0820('0x42')][_0x0820('0x4c')]);_0x2cbee7['where']=qs[_0x0820('0x44')](_[_0x0820('0x4e')](_0x5d3551[_0x0820('0x42')],_0x8dd2dc[_0x0820('0x44')]));if(_0x5d3551[_0x0820('0x42')][_0x0820('0x53')]){_0x2cbee7[_0x0820('0x4d')]=_[_0x0820('0x4f')](_0x2cbee7[_0x0820('0x4d')],{'$or':_[_0x0820('0x50')](_0x2cbee7[_0x0820('0x46')],function(_0x1d8944){var _0x829438={};_0x829438[_0x1d8944]={'$like':'%'+_0x5d3551[_0x0820('0x42')][_0x0820('0x53')]+'%'};return _0x829438;})});}_0x2cbee7=_['merge']({},_0x2cbee7,_0x5d3551['options']);return _0x56ba27[_0x0820('0x10f')](_0x2cbee7);}})[_0x0820('0x35')](function(_0x409326){if(_0x409326){_0x1496e0=_0x409326['length'];if(!_0x5d3551[_0x0820('0x42')][_0x0820('0x49')](_0x0820('0x4a'))){_0x2cbee7[_0x0820('0x30')]=qs[_0x0820('0x30')](_0x5d3551[_0x0820('0x42')][_0x0820('0x30')]);_0x2cbee7[_0x0820('0x2f')]=qs[_0x0820('0x2f')](_0x5d3551['query'][_0x0820('0x2f')]);}return _0x56ba27['getApplications'](_0x2cbee7);}})[_0x0820('0x35')](function(_0xdd537e){if(_0xdd537e){return _0xdd537e?{'count':_0x1496e0,'rows':_0xdd537e}:null;}})[_0x0820('0x35')](respondWithResult(_0x723b90,null))[_0x0820('0x2a')](handleError(_0x723b90,null));};exports[_0x0820('0x110')]=function(_0x2eacdb,_0x58e405,_0x97e091){return db['chatProactiveAction'][_0x0820('0x5e')]({'where':{'id':_0x2eacdb['params']['id']}})['then'](handleEntityNotFound(_0x58e405,null))[_0x0820('0x35')](function(_0x23e863){if(_0x23e863){return _0x23e863['addProactiveActions'](_0x2eacdb[_0x0820('0x60')][_0x0820('0x6c')],_[_0x0820('0xe7')](_0x2eacdb[_0x0820('0x60')],[_0x0820('0x6c'),'id'])||{});}})[_0x0820('0x35')](respondWithResult(_0x58e405,null))['catch'](handleError(_0x58e405,null));};exports[_0x0820('0xfd')]=function(_0x1041bb,_0x270e7c,_0x484f6c){var _0x40c471={};var _0x46ca35={};var _0x284438;var _0x405339;return db[_0x0820('0x55')][_0x0820('0x6f')]({'where':{'id':_0x1041bb[_0x0820('0x5b')]['id']}})[_0x0820('0x35')](handleEntityNotFound(_0x270e7c,null))[_0x0820('0x35')](function(_0x1022d6){if(_0x1022d6){_0x284438=_0x1022d6;_0x46ca35['model']=_[_0x0820('0x43')](db[_0x0820('0x111')][_0x0820('0x5d')]);_0x46ca35['query']=_['keys'](_0x1041bb[_0x0820('0x42')]);_0x46ca35[_0x0820('0x44')]=_['intersection'](_0x46ca35['model'],_0x46ca35['query']);_0x40c471[_0x0820('0x46')]=_[_0x0820('0x45')](_0x46ca35['model'],qs[_0x0820('0x47')](_0x1041bb[_0x0820('0x42')][_0x0820('0x47')]));_0x40c471[_0x0820('0x46')]=_0x40c471[_0x0820('0x46')]['length']?_0x40c471[_0x0820('0x46')]:_0x46ca35[_0x0820('0x41')];_0x40c471[_0x0820('0x4b')]=qs[_0x0820('0x4c')](_0x1041bb[_0x0820('0x42')]['sort']);_0x40c471[_0x0820('0x4d')]=qs['filters'](_[_0x0820('0x4e')](_0x1041bb[_0x0820('0x42')],_0x46ca35['filters']));if(_0x1041bb[_0x0820('0x42')][_0x0820('0x53')]){_0x40c471[_0x0820('0x4d')]=_['merge'](_0x40c471['where'],{'$or':_[_0x0820('0x50')](_0x40c471['attributes'],function(_0x58d3d7){var _0x3e3cec={};_0x3e3cec[_0x58d3d7]={'$like':'%'+_0x1041bb[_0x0820('0x42')][_0x0820('0x53')]+'%'};return _0x3e3cec;})});}_0x40c471=_['merge']({},_0x40c471,_0x1041bb['options']);return _0x284438['getProactiveActions'](_0x40c471);}})['then'](function(_0x1ea24b){if(_0x1ea24b){_0x405339=_0x1ea24b['length'];if(!_0x1041bb[_0x0820('0x42')]['hasOwnProperty'](_0x0820('0x4a'))){_0x40c471['limit']=qs[_0x0820('0x30')](_0x1041bb['query'][_0x0820('0x30')]);_0x40c471[_0x0820('0x2f')]=qs[_0x0820('0x2f')](_0x1041bb['query'][_0x0820('0x2f')]);}return _0x284438[_0x0820('0xfd')](_0x40c471);}})['then'](function(_0x144cb3){if(_0x144cb3){return _0x144cb3?{'count':_0x405339,'rows':_0x144cb3}:null;}})['then'](respondWithResult(_0x270e7c,null))[_0x0820('0x2a')](handleError(_0x270e7c,null));};exports['getFields']=function(_0x5b7618,_0x37662e,_0x4b73bd){var _0x596c03=_0x5b7618[_0x0820('0x42')][_0x0820('0x112')]===_0x0820('0x113')?_0x0820('0x114'):_0x0820('0x115');return db['ChatWebsite'][_0x0820('0x5e')]({'attributes':['id',_0x596c03],'where':{'id':_0x5b7618[_0x0820('0x5b')]['id']}})[_0x0820('0x35')](handleEntityNotFound(_0x37662e,null))[_0x0820('0x35')](function(_0x1bca17){if(_0x1bca17){var _0x572f45=_0x1bca17[_0x596c03];var _0x418d27=_0x572f45&&_0x572f45[_0x0820('0x116')]?_0x572f45[_0x0820('0x116')]:[];_0x37662e['send']({'fromKey':_['isNil'](_0x572f45['fromKey'])?undefined:_0x572f45[_0x0820('0x117')],'count':_0x418d27[_0x0820('0x48')],'rows':_0x418d27});}})[_0x0820('0x2a')](handleError(_0x37662e,null));};exports['getOfflineMessages']=function(_0x3feb1d,_0x2a3c14,_0x2e0869){var _0x4e5b6b={'raw':![],'where':{}};var _0x4f4026={};var _0x4a01bd={'count':0x0,'rows':[]};return db[_0x0820('0x55')][_0x0820('0x6f')]({'where':{'id':_0x3feb1d[_0x0820('0x5b')]['id']}})[_0x0820('0x35')](handleEntityNotFound(_0x2a3c14,null))[_0x0820('0x35')](function(_0x33da73){if(_0x33da73){_0x4f4026[_0x0820('0x41')]=_['keys'](db[_0x0820('0xd7')]['rawAttributes']);_0x4f4026[_0x0820('0x42')]=_[_0x0820('0x43')](_0x3feb1d[_0x0820('0x42')]);_0x4f4026[_0x0820('0x44')]=_[_0x0820('0x45')](_0x4f4026[_0x0820('0x41')],_0x4f4026[_0x0820('0x42')]);_0x4e5b6b[_0x0820('0x46')]=_[_0x0820('0x45')](_0x4f4026[_0x0820('0x41')],qs[_0x0820('0x47')](_0x3feb1d['query'][_0x0820('0x47')]));_0x4e5b6b[_0x0820('0x46')]=_0x4e5b6b['attributes'][_0x0820('0x48')]?_0x4e5b6b[_0x0820('0x46')]:_0x4f4026[_0x0820('0x41')];if(!_0x3feb1d[_0x0820('0x42')][_0x0820('0x49')](_0x0820('0x4a'))){_0x4e5b6b['limit']=qs[_0x0820('0x30')](_0x3feb1d[_0x0820('0x42')][_0x0820('0x30')]);_0x4e5b6b['offset']=qs[_0x0820('0x2f')](_0x3feb1d[_0x0820('0x42')][_0x0820('0x2f')]);}_0x4e5b6b[_0x0820('0x4b')]=qs[_0x0820('0x4c')](_0x3feb1d[_0x0820('0x42')][_0x0820('0x4c')]);_0x4e5b6b[_0x0820('0x4d')]=qs[_0x0820('0x44')](_[_0x0820('0x4e')](_0x3feb1d['query'],_0x4f4026['filters']));_0x4e5b6b[_0x0820('0x4d')][_0x0820('0x69')]=_0x33da73['id'];if(_0x3feb1d[_0x0820('0x42')][_0x0820('0x53')]){_0x4e5b6b['where']=_[_0x0820('0x4f')](_0x4e5b6b[_0x0820('0x4d')],{'$or':_['map'](_0x4e5b6b['attributes'],function(_0x41fe72){var _0xc09396={};_0xc09396[_0x41fe72]={'$like':'%'+_0x3feb1d[_0x0820('0x42')][_0x0820('0x53')]+'%'};return _0xc09396;})});}_0x4e5b6b=_[_0x0820('0x4f')]({},_0x4e5b6b,_0x3feb1d['options']);return db[_0x0820('0xd7')][_0x0820('0x2e')]({'where':_0x4e5b6b[_0x0820('0x4d')]})[_0x0820('0x35')](function(_0x4b4bed){_0x4a01bd['count']=_0x4b4bed;if(_0x3feb1d[_0x0820('0x42')][_0x0820('0x56')]){_0x4e5b6b[_0x0820('0x57')]=[{'all':!![]}];}else{_0x4e5b6b[_0x0820('0x57')]=[{'model':db[_0x0820('0x93')],'as':_0x0820('0xe9'),'required':![]}];}return db[_0x0820('0xd7')][_0x0820('0x58')](_0x4e5b6b);})[_0x0820('0x35')](function(_0x43638b){_0x4a01bd['rows']=_0x43638b;return _0x4a01bd;});}})[_0x0820('0x35')](respondWithFilteredResult(_0x2a3c14,_0x4e5b6b))[_0x0820('0x2a')](handleError(_0x2a3c14,null));};exports['addAgents']=function(_0x4da674,_0x40486b,_0x194f83){return db[_0x0820('0x55')][_0x0820('0x5e')]({'where':{'id':_0x4da674[_0x0820('0x5b')]['id']}})['then'](handleEntityNotFound(_0x40486b,null))[_0x0820('0x35')](function(_0x24fa90){if(_0x24fa90){return _0x24fa90[_0x0820('0x118')](_0x4da674[_0x0820('0x60')][_0x0820('0x6c')],_[_0x0820('0xe7')](_0x4da674[_0x0820('0x60')],[_0x0820('0x6c'),'id'])||{})['spread'](function(_0x41c280){for(var _0x5ea04c=0x0;_0x5ea04c<_0x4da674['body'][_0x0820('0x6c')]['length'];_0x5ea04c+=0x1){socket['emit'](_0x0820('0x119'),{'UserId':_0x4da674['body'][_0x0820('0x6c')][_0x5ea04c],'ChatWebsiteId':_0x4da674[_0x0820('0x5b')]['id']});}return _0x41c280;});}})[_0x0820('0x35')](respondWithResult(_0x40486b,null))[_0x0820('0x2a')](handleError(_0x40486b,null));};exports[_0x0820('0x11a')]=function(_0x4c9399,_0x3cc768,_0xdadce7){return db['ChatWebsite'][_0x0820('0x5e')]({'where':{'id':_0x4c9399[_0x0820('0x5b')]['id']}})['then'](handleEntityNotFound(_0x3cc768,null))['then'](function(_0x2893d8){if(_0x2893d8){return _0x2893d8[_0x0820('0x11a')](_0x4c9399[_0x0820('0x42')][_0x0820('0x6c')])['then'](function(){if(_[_0x0820('0x11b')](_0x4c9399[_0x0820('0x42')][_0x0820('0x6c')])){for(var _0x507bda=0x0;_0x507bda<_0x4c9399[_0x0820('0x42')][_0x0820('0x6c')][_0x0820('0x48')];_0x507bda+=0x1){socket[_0x0820('0x11c')](_0x0820('0x11d'),{'UserId':Number(_0x4c9399[_0x0820('0x42')][_0x0820('0x6c')][_0x507bda]),'ChatWebsiteId':Number(_0x4c9399[_0x0820('0x5b')]['id'])});}}else{socket[_0x0820('0x11c')]('userChatWebsite:remove',{'UserId':Number(_0x4c9399[_0x0820('0x42')]['ids']),'ChatWebsiteId':Number(_0x4c9399['params']['id'])});}});}})[_0x0820('0x35')](respondWithStatusCode(_0x3cc768,null))['catch'](handleError(_0x3cc768,null));};exports[_0x0820('0x11e')]=function(_0x47e2ec,_0x1d06a2,_0xc15d66){var _0x101cae={};var _0x28a988={};var _0x4cfa6c;var _0x1f52ae;return db['ChatWebsite'][_0x0820('0x6f')]({'where':{'id':_0x47e2ec[_0x0820('0x5b')]['id']}})[_0x0820('0x35')](handleEntityNotFound(_0x1d06a2,null))[_0x0820('0x35')](function(_0x3e1f09){if(_0x3e1f09){_0x4cfa6c=_0x3e1f09;_0x28a988['model']=_[_0x0820('0x43')](db['User'][_0x0820('0x5d')]);_0x28a988['query']=_['keys'](_0x47e2ec[_0x0820('0x42')]);_0x28a988[_0x0820('0x44')]=_['intersection'](_0x28a988[_0x0820('0x41')],_0x28a988[_0x0820('0x42')]);_0x101cae[_0x0820('0x46')]=_[_0x0820('0x45')](_0x28a988[_0x0820('0x41')],qs['fields'](_0x47e2ec[_0x0820('0x42')][_0x0820('0x47')]));_0x101cae[_0x0820('0x46')]=_0x101cae[_0x0820('0x46')]['length']?_0x101cae[_0x0820('0x46')]:_0x28a988['model'];_0x101cae[_0x0820('0x4b')]=qs[_0x0820('0x4c')](_0x47e2ec[_0x0820('0x42')]['sort']);_0x101cae[_0x0820('0x4d')]=qs['filters'](_[_0x0820('0x4e')](_0x47e2ec['query'],_0x28a988[_0x0820('0x44')]));if(_0x47e2ec[_0x0820('0x42')][_0x0820('0x53')]){_0x101cae[_0x0820('0x4d')]=_[_0x0820('0x4f')](_0x101cae['where'],{'$or':_[_0x0820('0x50')](_0x101cae[_0x0820('0x46')],function(_0x4d6951){var _0x19484a={};_0x19484a[_0x4d6951]={'$like':'%'+_0x47e2ec['query']['filter']+'%'};return _0x19484a;})});}_0x101cae=_['merge']({},_0x101cae,_0x47e2ec[_0x0820('0x54')]);return _0x4cfa6c[_0x0820('0x11e')](_0x101cae);}})[_0x0820('0x35')](function(_0x5576c3){if(_0x5576c3){_0x1f52ae=_0x5576c3[_0x0820('0x48')];if(!_0x47e2ec[_0x0820('0x42')][_0x0820('0x49')](_0x0820('0x4a'))){_0x101cae[_0x0820('0x30')]=qs[_0x0820('0x30')](_0x47e2ec[_0x0820('0x42')]['limit']);_0x101cae[_0x0820('0x2f')]=qs[_0x0820('0x2f')](_0x47e2ec[_0x0820('0x42')]['offset']);}return _0x4cfa6c[_0x0820('0x11e')](_0x101cae);}})['then'](function(_0x23db04){if(_0x23db04){return _0x23db04?{'count':_0x1f52ae,'rows':_0x23db04}:null;}})['then'](respondWithResult(_0x1d06a2,null))[_0x0820('0x2a')](handleError(_0x1d06a2,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index 084bd88..ae63fb8 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 _0x6b71=['../../mysqldb','setMaxListeners','save','remove','emit','hook','events'];(function(_0x47b58b,_0x41a189){var _0x46bebe=function(_0x22bbfa){while(--_0x22bbfa){_0x47b58b['push'](_0x47b58b['shift']());}};_0x46bebe(++_0x41a189);}(_0x6b71,0x12c));var _0x16b7=function(_0x45adaf,_0x21c3c1){_0x45adaf=_0x45adaf-0x0;var _0x15d189=_0x6b71[_0x45adaf];return _0x15d189;};'use strict';var EventEmitter=require(_0x16b7('0x0'));var ChatWebsite=require(_0x16b7('0x1'))['db']['ChatWebsite'];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x16b7('0x2')](0x0);var events={'afterCreate':_0x16b7('0x3'),'afterUpdate':'update','afterDestroy':_0x16b7('0x4')};function emitEvent(_0x7dd5fe){return function(_0x212683,_0x3b15dd,_0x1ba1dc){ChatWebsiteEvents[_0x16b7('0x5')](_0x7dd5fe+':'+_0x212683['id'],_0x212683);ChatWebsiteEvents['emit'](_0x7dd5fe,_0x212683);_0x1ba1dc(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatWebsite[_0x16b7('0x6')](e,emitEvent(event));}}module['exports']=ChatWebsiteEvents; \ No newline at end of file +var _0xdc0d=['emit','hasOwnProperty','exports','events','../../mysqldb','setMaxListeners','update','remove'];(function(_0x160cd7,_0x315362){var _0x4c34f2=function(_0x55c3c6){while(--_0x55c3c6){_0x160cd7['push'](_0x160cd7['shift']());}};_0x4c34f2(++_0x315362);}(_0xdc0d,0x1db));var _0xddc0=function(_0x135fc5,_0x3c4202){_0x135fc5=_0x135fc5-0x0;var _0x3a2df6=_0xdc0d[_0x135fc5];return _0x3a2df6;};'use strict';var EventEmitter=require(_0xddc0('0x0'));var ChatWebsite=require(_0xddc0('0x1'))['db']['ChatWebsite'];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xddc0('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xddc0('0x3'),'afterDestroy':_0xddc0('0x4')};function emitEvent(_0x333d21){return function(_0x32ad85,_0xb4e3f,_0x88b8b1){ChatWebsiteEvents[_0xddc0('0x5')](_0x333d21+':'+_0x32ad85['id'],_0x32ad85);ChatWebsiteEvents[_0xddc0('0x5')](_0x333d21,_0x32ad85);_0x88b8b1(null);};}for(var e in events){if(events[_0xddc0('0x6')](e)){var event=events[e];ChatWebsite['hook'](e,emitEvent(event));}}module[_0xddc0('0x7')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index acad374..aa16620 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 _0xd7a0=['path','rimraf','../../config/environment','exports','define','ChatWebsite','chat_websites','lodash','util','api','bluebird','request-promise'];(function(_0x456032,_0x1a799d){var _0x1a53cd=function(_0x162cc8){while(--_0x162cc8){_0x456032['push'](_0x456032['shift']());}};_0x1a53cd(++_0x1a799d);}(_0xd7a0,0x163));var _0x0d7a=function(_0x1e16f0,_0x569c17){_0x1e16f0=_0x1e16f0-0x0;var _0x402c9b=_0xd7a0[_0x1e16f0];return _0x402c9b;};'use strict';var _=require(_0x0d7a('0x0'));var util=require(_0x0d7a('0x1'));var logger=require('../../config/logger')(_0x0d7a('0x2'));var moment=require('moment');var BPromise=require(_0x0d7a('0x3'));var rp=require(_0x0d7a('0x4'));var fs=require('fs');var path=require(_0x0d7a('0x5'));var rimraf=require(_0x0d7a('0x6'));var config=require(_0x0d7a('0x7'));var attributes=require('./chatWebsite.attributes');module[_0x0d7a('0x8')]=function(_0x37c000,_0x321114){return _0x37c000[_0x0d7a('0x9')](_0x0d7a('0xa'),attributes,{'tableName':_0x0d7a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4ded=['path','rimraf','../../config/environment','./chatWebsite.attributes','exports','define','ChatWebsite','chat_websites','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x2a193f,_0x23ec70){var _0x4269c7=function(_0x10b783){while(--_0x10b783){_0x2a193f['push'](_0x2a193f['shift']());}};_0x4269c7(++_0x23ec70);}(_0x4ded,0x116));var _0xd4de=function(_0x1055e9,_0x5adc5e){_0x1055e9=_0x1055e9-0x0;var _0x58527d=_0x4ded[_0x1055e9];return _0x58527d;};'use strict';var _=require(_0xd4de('0x0'));var util=require(_0xd4de('0x1'));var logger=require(_0xd4de('0x2'))(_0xd4de('0x3'));var moment=require(_0xd4de('0x4'));var BPromise=require(_0xd4de('0x5'));var rp=require(_0xd4de('0x6'));var fs=require('fs');var path=require(_0xd4de('0x7'));var rimraf=require(_0xd4de('0x8'));var config=require(_0xd4de('0x9'));var attributes=require(_0xd4de('0xa'));module[_0xd4de('0xb')]=function(_0x554a51,_0x23e5b9){return _0x554a51[_0xd4de('0xc')](_0xd4de('0xd'),attributes,{'tableName':_0xd4de('0xe'),'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 e46267a..1a2a51f 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 _0x0598=['result','catch','lodash','util','bluebird','../../mysqldb','../../config/utils','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','register','then','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','ChatWebsite,\x20%s,\x20%s','message','info'];(function(_0x2697ec,_0x26c105){var _0x20aa02=function(_0x3edd91){while(--_0x3edd91){_0x2697ec['push'](_0x2697ec['shift']());}};_0x20aa02(++_0x26c105);}(_0x0598,0x92));var _0x8059=function(_0x21e941,_0x4c7c50){_0x21e941=_0x21e941-0x0;var _0x4ba335=_0x0598[_0x21e941];return _0x4ba335;};'use strict';var _=require(_0x8059('0x0'));var util=require(_0x8059('0x1'));var moment=require('moment');var BPromise=require(_0x8059('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8059('0x3'))['db'];var utils=require(_0x8059('0x4'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x8059('0x5'));var client=jayson[_0x8059('0x6')]['http']({'port':0x232a});config['redis']=_[_0x8059('0x7')](config[_0x8059('0x8')],{'host':_0x8059('0x9'),'port':0x18eb});var socket=require(_0x8059('0xa'))(new Redis(config['redis']));require('./chatWebsite.socket')[_0x8059('0xb')](socket);function respondWithRpcPromise(_0x1bf5fd,_0x336f85,_0x5097d6){return new BPromise(function(_0x283b63,_0x52a60d){return client['request'](_0x1bf5fd,_0x5097d6)[_0x8059('0xc')](function(_0x4109a9){logger['info']('ChatWebsite,\x20%s,\x20%s',_0x336f85,'request\x20sent');logger[_0x8059('0xd')](_0x8059('0xe'),_0x336f85,_0x8059('0xf'),JSON[_0x8059('0x10')](_0x4109a9));if(_0x4109a9[_0x8059('0x11')]){if(_0x4109a9['error'][_0x8059('0x12')]===0x1f4){logger['error'](_0x8059('0x13'),_0x336f85,_0x4109a9['error'][_0x8059('0x14')]);return _0x52a60d(_0x4109a9[_0x8059('0x11')][_0x8059('0x14')]);}logger['error']('ChatWebsite,\x20%s,\x20%s',_0x336f85,_0x4109a9['error'][_0x8059('0x14')]);return _0x283b63(_0x4109a9[_0x8059('0x11')][_0x8059('0x14')]);}else{logger[_0x8059('0x15')](_0x8059('0x13'),_0x336f85,'request\x20sent');_0x283b63(_0x4109a9[_0x8059('0x16')][_0x8059('0x14')]);}})[_0x8059('0x17')](function(_0x1c4566){logger['error'](_0x8059('0x13'),_0x336f85,_0x1c4566);_0x52a60d(_0x1c4566);});});} \ No newline at end of file +var _0x5c3c=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','localhost','socket.io-emitter','./chatWebsite.socket','register','request','then','info','ChatWebsite,\x20%s,\x20%s','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','lodash','util'];(function(_0x4edeee,_0x591186){var _0x277532=function(_0xea2bae){while(--_0xea2bae){_0x4edeee['push'](_0x4edeee['shift']());}};_0x277532(++_0x591186);}(_0x5c3c,0x132));var _0xc5c3=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0x5c3c[_0x278e3c];return _0x3e2d9b;};'use strict';var _=require(_0xc5c3('0x0'));var util=require(_0xc5c3('0x1'));var moment=require(_0xc5c3('0x2'));var BPromise=require(_0xc5c3('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc5c3('0x4'));var db=require(_0xc5c3('0x5'))['db'];var utils=require(_0xc5c3('0x6'));var logger=require(_0xc5c3('0x7'))(_0xc5c3('0x8'));var config=require(_0xc5c3('0x9'));var jayson=require(_0xc5c3('0xa'));var client=jayson[_0xc5c3('0xb')][_0xc5c3('0xc')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0xc5c3('0xd'),'port':0x18eb});var socket=require(_0xc5c3('0xe'))(new Redis(config['redis']));require(_0xc5c3('0xf'))[_0xc5c3('0x10')](socket);function respondWithRpcPromise(_0x52f3eb,_0x14140f,_0x2a1d19){return new BPromise(function(_0x4e329f,_0x1f2e34){return client[_0xc5c3('0x11')](_0x52f3eb,_0x2a1d19)[_0xc5c3('0x12')](function(_0x59fb60){logger[_0xc5c3('0x13')](_0xc5c3('0x14'),_0x14140f,'request\x20sent');logger[_0xc5c3('0x15')](_0xc5c3('0x16'),_0x14140f,_0xc5c3('0x17'),JSON['stringify'](_0x59fb60));if(_0x59fb60[_0xc5c3('0x18')]){if(_0x59fb60[_0xc5c3('0x18')][_0xc5c3('0x19')]===0x1f4){logger[_0xc5c3('0x18')](_0xc5c3('0x14'),_0x14140f,_0x59fb60['error']['message']);return _0x1f2e34(_0x59fb60[_0xc5c3('0x18')][_0xc5c3('0x1a')]);}logger[_0xc5c3('0x18')](_0xc5c3('0x14'),_0x14140f,_0x59fb60['error']['message']);return _0x4e329f(_0x59fb60[_0xc5c3('0x18')]['message']);}else{logger[_0xc5c3('0x13')](_0xc5c3('0x14'),_0x14140f,_0xc5c3('0x17'));_0x4e329f(_0x59fb60[_0xc5c3('0x1b')][_0xc5c3('0x1a')]);}})['catch'](function(_0x364f42){logger[_0xc5c3('0x18')](_0xc5c3('0x14'),_0x14140f,_0x364f42);_0x1f2e34(_0x364f42);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index f9437b6..4ec61d7 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 _0x5f2f=['remove','update','emit','removeListener','register','length','chatWebsite:','./chatWebsite.events','save'];(function(_0x19b1c2,_0x205062){var _0x4e1ae5=function(_0x5a1cb7){while(--_0x5a1cb7){_0x19b1c2['push'](_0x19b1c2['shift']());}};_0x4e1ae5(++_0x205062);}(_0x5f2f,0x73));var _0xf5f2=function(_0x37a7bc,_0x1220db){_0x37a7bc=_0x37a7bc-0x0;var _0x2e5f63=_0x5f2f[_0x37a7bc];return _0x2e5f63;};'use strict';var ChatWebsiteEvents=require(_0xf5f2('0x0'));var events=[_0xf5f2('0x1'),_0xf5f2('0x2'),_0xf5f2('0x3')];function createListener(_0x1172dd,_0x174bc7){return function(_0x3c72ee){_0x174bc7[_0xf5f2('0x4')](_0x1172dd,_0x3c72ee);};}function removeListener(_0x501fbd,_0x4854b6){return function(){ChatWebsiteEvents[_0xf5f2('0x5')](_0x501fbd,_0x4854b6);};}exports[_0xf5f2('0x6')]=function(_0xad7f65){for(var _0x3eebf6=0x0,_0x3133bc=events[_0xf5f2('0x7')];_0x3eebf6<_0x3133bc;_0x3eebf6++){var _0x5907aa=events[_0x3eebf6];var _0x466882=createListener(_0xf5f2('0x8')+_0x5907aa,_0xad7f65);ChatWebsiteEvents['on'](_0x5907aa,_0x466882);}}; \ No newline at end of file +var _0x5f2f=['remove','update','emit','removeListener','register','length','chatWebsite:','./chatWebsite.events','save'];(function(_0x3fa631,_0x24392c){var _0x5c9dec=function(_0x36d01a){while(--_0x36d01a){_0x3fa631['push'](_0x3fa631['shift']());}};_0x5c9dec(++_0x24392c);}(_0x5f2f,0x73));var _0xf5f2=function(_0x132d72,_0x5afb96){_0x132d72=_0x132d72-0x0;var _0x3254be=_0x5f2f[_0x132d72];return _0x3254be;};'use strict';var ChatWebsiteEvents=require(_0xf5f2('0x0'));var events=[_0xf5f2('0x1'),_0xf5f2('0x2'),_0xf5f2('0x3')];function createListener(_0x1172dd,_0x174bc7){return function(_0x3c72ee){_0x174bc7[_0xf5f2('0x4')](_0x1172dd,_0x3c72ee);};}function removeListener(_0x501fbd,_0x4854b6){return function(){ChatWebsiteEvents[_0xf5f2('0x5')](_0x501fbd,_0x4854b6);};}exports[_0xf5f2('0x6')]=function(_0xad7f65){for(var _0x3eebf6=0x0,_0x3133bc=events[_0xf5f2('0x7')];_0x3eebf6<_0x3133bc;_0x3eebf6++){var _0x5907aa=events[_0x3eebf6];var _0x466882=createListener(_0xf5f2('0x8')+_0x5907aa,_0xad7f65);ChatWebsiteEvents['on'](_0x5907aa,_0x466882);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index dd47aa3..47228c7 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 _0xf151=['isAuthenticated','index','get','/describe','describe','getDispositions','/:id/canned_answers','getAnswers','/:id/logo','getLogo','getAvatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','getOfflineMessages','getAgents','post','/:id/dispositions','addDisposition','addAnswer','join','root','server/files/images/logos/','format','originalname','single','file','addLogo','server/files/images/avatars/','%s-%s','/:id/avatar','diskStorage','now','/:id/customer_avatar','addCustomerAvatar','addSystemAvatar','/:id/notify','notify','/:id/offline','offline','addInteraction','addApplications','addAgents','/:id','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller'];(function(_0x5c016e,_0x37d67d){var _0x372145=function(_0x540cb1){while(--_0x540cb1){_0x5c016e['push'](_0x5c016e['shift']());}};_0x372145(++_0x37d67d);}(_0xf151,0x183));var _0x1f15=function(_0x5ec5a,_0x5bd7c5){_0x5ec5a=_0x5ec5a-0x0;var _0x2263de=_0xf151[_0x5ec5a];return _0x2263de;};'use strict';var multer=require('multer');var util=require(_0x1f15('0x0'));var path=require(_0x1f15('0x1'));var timeout=require(_0x1f15('0x2'));var express=require(_0x1f15('0x3'));var router=express[_0x1f15('0x4')]();var auth=require(_0x1f15('0x5'));var interaction=require(_0x1f15('0x6'));var config=require(_0x1f15('0x7'));var controller=require(_0x1f15('0x8'));router['get']('/',auth[_0x1f15('0x9')](),controller[_0x1f15('0xa')]);router[_0x1f15('0xb')](_0x1f15('0xc'),auth[_0x1f15('0x9')](),controller[_0x1f15('0xd')]);router[_0x1f15('0xb')]('/:id',auth[_0x1f15('0x9')](),controller['show']);router[_0x1f15('0xb')]('/:id/dispositions',auth[_0x1f15('0x9')](),controller[_0x1f15('0xe')]);router['get'](_0x1f15('0xf'),auth['isAuthenticated'](),controller[_0x1f15('0x10')]);router[_0x1f15('0xb')](_0x1f15('0x11'),controller[_0x1f15('0x12')]);router['get']('/:id/avatar',controller[_0x1f15('0x13')]);router['get']('/:id/customer_avatar',controller[_0x1f15('0x14')]);router[_0x1f15('0xb')](_0x1f15('0x15'),controller[_0x1f15('0x16')]);router[_0x1f15('0xb')](_0x1f15('0x17'),auth['isAuthenticated'](),controller['getInteractions']);router[_0x1f15('0xb')]('/:id/snippet',controller['getSnippet']);router[_0x1f15('0xb')](_0x1f15('0x18'),auth['isAuthenticated'](),controller[_0x1f15('0x19')]);router[_0x1f15('0xb')](_0x1f15('0x1a'),auth[_0x1f15('0x9')](),controller[_0x1f15('0x1b')]);router[_0x1f15('0xb')](_0x1f15('0x1c'),controller['getFields']);router[_0x1f15('0xb')]('/:id/offline_messages',auth[_0x1f15('0x9')](),controller[_0x1f15('0x1d')]);router['get']('/:id/users',auth[_0x1f15('0x9')](),controller[_0x1f15('0x1e')]);router[_0x1f15('0x1f')]('/',auth['isAuthenticated'](),controller['create']);router[_0x1f15('0x1f')](_0x1f15('0x20'),auth[_0x1f15('0x9')](),controller[_0x1f15('0x21')]);router[_0x1f15('0x1f')](_0x1f15('0xf'),auth[_0x1f15('0x9')](),controller[_0x1f15('0x22')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x221d88,_0x37c1c7,_0x427fa6){_0x427fa6(null,path[_0x1f15('0x23')](config[_0x1f15('0x24')],_0x1f15('0x25')));},'filename':function(_0x4de1ff,_0x4144a6,_0x3247f5){_0x3247f5(null,util[_0x1f15('0x26')]('%s-%s',Date['now'](),_0x4144a6[_0x1f15('0x27')]));}})});router[_0x1f15('0x1f')](_0x1f15('0x11'),upload[_0x1f15('0x28')](_0x1f15('0x29')),controller[_0x1f15('0x2a')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x471f16,_0x1bd30d,_0x33a669){_0x33a669(null,path[_0x1f15('0x23')](config[_0x1f15('0x24')],_0x1f15('0x2b')));},'filename':function(_0x28ac89,_0x4f0120,_0x3c08df){_0x3c08df(null,util['format'](_0x1f15('0x2c'),Date['now'](),_0x4f0120[_0x1f15('0x27')]));}})});router[_0x1f15('0x1f')](_0x1f15('0x2d'),upload[_0x1f15('0x28')](_0x1f15('0x29')),controller['addAvatar']);var upload=multer({'storage':multer[_0x1f15('0x2e')]({'destination':function(_0x936d47,_0x567dc7,_0x590726){_0x590726(null,path[_0x1f15('0x23')](config['root'],_0x1f15('0x2b')));},'filename':function(_0x5ec5d7,_0x51e92e,_0x3811dc){_0x3811dc(null,util[_0x1f15('0x26')](_0x1f15('0x2c'),Date[_0x1f15('0x2f')](),_0x51e92e['originalname']));}})});router[_0x1f15('0x1f')](_0x1f15('0x30'),upload[_0x1f15('0x28')](_0x1f15('0x29')),controller[_0x1f15('0x31')]);var upload=multer({'storage':multer[_0x1f15('0x2e')]({'destination':function(_0x173d61,_0x1debee,_0x28d3a5){_0x28d3a5(null,path['join'](config['root'],_0x1f15('0x2b')));},'filename':function(_0x3bf157,_0x3573f6,_0x2240f4){_0x2240f4(null,util['format']('%s-%s',Date[_0x1f15('0x2f')](),_0x3573f6[_0x1f15('0x27')]));}})});router[_0x1f15('0x1f')](_0x1f15('0x15'),upload[_0x1f15('0x28')](_0x1f15('0x29')),controller[_0x1f15('0x32')]);router['post'](_0x1f15('0x33'),controller[_0x1f15('0x34')]);router[_0x1f15('0x1f')](_0x1f15('0x35'),controller[_0x1f15('0x36')]);router[_0x1f15('0x1f')](_0x1f15('0x17'),auth['isAuthenticated'](),controller[_0x1f15('0x37')]);router[_0x1f15('0x1f')](_0x1f15('0x18'),auth[_0x1f15('0x9')](),controller[_0x1f15('0x38')]);router[_0x1f15('0x1f')](_0x1f15('0x1a'),auth[_0x1f15('0x9')](),controller['addProactiveActions']);router[_0x1f15('0x1f')]('/:id/users',auth[_0x1f15('0x9')](),controller[_0x1f15('0x39')]);router['put'](_0x1f15('0x3a'),auth[_0x1f15('0x9')](),controller[_0x1f15('0x3b')]);router['delete'](_0x1f15('0x3a'),auth[_0x1f15('0x9')](),controller[_0x1f15('0x3c')]);router[_0x1f15('0x3d')](_0x1f15('0x20'),auth['isAuthenticated'](),controller[_0x1f15('0x3e')]);router[_0x1f15('0x3d')](_0x1f15('0xf'),auth['isAuthenticated'](),controller[_0x1f15('0x3f')]);router[_0x1f15('0x3d')]('/:id/users',auth[_0x1f15('0x9')](),controller[_0x1f15('0x40')]);module[_0x1f15('0x41')]=router; \ No newline at end of file +var _0x1d89=['getInteractions','/:id/snippet','getSnippet','/:id/applications','getApplications','/:id/proactive_actions','/:id/fields','getFields','/:id/offline_messages','/:id/users','getAgents','post','addDisposition','addAnswer','diskStorage','join','root','server/files/images/logos/','format','%s-%s','now','originalname','single','addLogo','server/files/images/avatars/','file','/:id/customer_avatar','addCustomerAvatar','addSystemAvatar','/:id/notify','notify','/:id/offline','offline','addInteraction','addApplications','addProactiveActions','addAgents','update','delete','destroy','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./chatWebsite.controller','get','index','isAuthenticated','describe','/:id','show','/:id/dispositions','getDispositions','getAnswers','/:id/logo','getLogo','/:id/avatar','getAvatar','getCustomerAvatar','/:id/system_avatar','/:id/interactions'];(function(_0x167c28,_0x1e63f5){var _0x23bfe2=function(_0x38c510){while(--_0x38c510){_0x167c28['push'](_0x167c28['shift']());}};_0x23bfe2(++_0x1e63f5);}(_0x1d89,0x179));var _0x91d8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1d89[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x91d8('0x0'));var util=require(_0x91d8('0x1'));var path=require(_0x91d8('0x2'));var timeout=require(_0x91d8('0x3'));var express=require(_0x91d8('0x4'));var router=express[_0x91d8('0x5')]();var auth=require(_0x91d8('0x6'));var interaction=require(_0x91d8('0x7'));var config=require('../../config/environment');var controller=require(_0x91d8('0x8'));router[_0x91d8('0x9')]('/',auth['isAuthenticated'](),controller[_0x91d8('0xa')]);router[_0x91d8('0x9')]('/describe',auth[_0x91d8('0xb')](),controller[_0x91d8('0xc')]);router[_0x91d8('0x9')](_0x91d8('0xd'),auth[_0x91d8('0xb')](),controller[_0x91d8('0xe')]);router[_0x91d8('0x9')](_0x91d8('0xf'),auth[_0x91d8('0xb')](),controller[_0x91d8('0x10')]);router[_0x91d8('0x9')]('/:id/canned_answers',auth[_0x91d8('0xb')](),controller[_0x91d8('0x11')]);router[_0x91d8('0x9')](_0x91d8('0x12'),controller[_0x91d8('0x13')]);router[_0x91d8('0x9')](_0x91d8('0x14'),controller[_0x91d8('0x15')]);router[_0x91d8('0x9')]('/:id/customer_avatar',controller[_0x91d8('0x16')]);router[_0x91d8('0x9')](_0x91d8('0x17'),controller['getSystemAvatar']);router[_0x91d8('0x9')](_0x91d8('0x18'),auth[_0x91d8('0xb')](),controller[_0x91d8('0x19')]);router[_0x91d8('0x9')](_0x91d8('0x1a'),controller[_0x91d8('0x1b')]);router['get'](_0x91d8('0x1c'),auth[_0x91d8('0xb')](),controller[_0x91d8('0x1d')]);router[_0x91d8('0x9')](_0x91d8('0x1e'),auth[_0x91d8('0xb')](),controller['getProactiveActions']);router[_0x91d8('0x9')](_0x91d8('0x1f'),controller[_0x91d8('0x20')]);router[_0x91d8('0x9')](_0x91d8('0x21'),auth[_0x91d8('0xb')](),controller['getOfflineMessages']);router[_0x91d8('0x9')](_0x91d8('0x22'),auth[_0x91d8('0xb')](),controller[_0x91d8('0x23')]);router[_0x91d8('0x24')]('/',auth[_0x91d8('0xb')](),controller['create']);router[_0x91d8('0x24')](_0x91d8('0xf'),auth[_0x91d8('0xb')](),controller[_0x91d8('0x25')]);router[_0x91d8('0x24')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x91d8('0x26')]);var upload=multer({'storage':multer[_0x91d8('0x27')]({'destination':function(_0x4cee10,_0x366420,_0x263ef6){_0x263ef6(null,path[_0x91d8('0x28')](config[_0x91d8('0x29')],_0x91d8('0x2a')));},'filename':function(_0x1d8cf5,_0x31b0d9,_0x2c5f31){_0x2c5f31(null,util[_0x91d8('0x2b')](_0x91d8('0x2c'),Date[_0x91d8('0x2d')](),_0x31b0d9[_0x91d8('0x2e')]));}})});router[_0x91d8('0x24')]('/:id/logo',upload[_0x91d8('0x2f')]('file'),controller[_0x91d8('0x30')]);var upload=multer({'storage':multer[_0x91d8('0x27')]({'destination':function(_0x3b0eeb,_0x29b1cf,_0xebb0b1){_0xebb0b1(null,path[_0x91d8('0x28')](config[_0x91d8('0x29')],_0x91d8('0x31')));},'filename':function(_0x1dd1a7,_0x2cb0cb,_0x1671ad){_0x1671ad(null,util[_0x91d8('0x2b')](_0x91d8('0x2c'),Date[_0x91d8('0x2d')](),_0x2cb0cb[_0x91d8('0x2e')]));}})});router['post'](_0x91d8('0x14'),upload['single'](_0x91d8('0x32')),controller['addAvatar']);var upload=multer({'storage':multer[_0x91d8('0x27')]({'destination':function(_0x23a697,_0x2a9955,_0x135556){_0x135556(null,path[_0x91d8('0x28')](config[_0x91d8('0x29')],_0x91d8('0x31')));},'filename':function(_0x55459e,_0x1814ea,_0xc323e0){_0xc323e0(null,util[_0x91d8('0x2b')](_0x91d8('0x2c'),Date['now'](),_0x1814ea[_0x91d8('0x2e')]));}})});router['post'](_0x91d8('0x33'),upload[_0x91d8('0x2f')](_0x91d8('0x32')),controller[_0x91d8('0x34')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3023ab,_0x7ec105,_0x4d1bc5){_0x4d1bc5(null,path[_0x91d8('0x28')](config[_0x91d8('0x29')],'server/files/images/avatars/'));},'filename':function(_0x8d5ebf,_0x26c4fb,_0xe1e577){_0xe1e577(null,util['format'](_0x91d8('0x2c'),Date[_0x91d8('0x2d')](),_0x26c4fb['originalname']));}})});router[_0x91d8('0x24')](_0x91d8('0x17'),upload[_0x91d8('0x2f')](_0x91d8('0x32')),controller[_0x91d8('0x35')]);router['post'](_0x91d8('0x36'),controller[_0x91d8('0x37')]);router['post'](_0x91d8('0x38'),controller[_0x91d8('0x39')]);router[_0x91d8('0x24')]('/:id/interactions',auth[_0x91d8('0xb')](),controller[_0x91d8('0x3a')]);router['post'](_0x91d8('0x1c'),auth['isAuthenticated'](),controller[_0x91d8('0x3b')]);router[_0x91d8('0x24')](_0x91d8('0x1e'),auth[_0x91d8('0xb')](),controller[_0x91d8('0x3c')]);router['post'](_0x91d8('0x22'),auth[_0x91d8('0xb')](),controller[_0x91d8('0x3d')]);router['put'](_0x91d8('0xd'),auth[_0x91d8('0xb')](),controller[_0x91d8('0x3e')]);router[_0x91d8('0x3f')]('/:id',auth['isAuthenticated'](),controller[_0x91d8('0x40')]);router['delete'](_0x91d8('0xf'),auth['isAuthenticated'](),controller['removeDispositions']);router[_0x91d8('0x3f')]('/:id/canned_answers',auth['isAuthenticated'](),controller['removeAnswers']);router[_0x91d8('0x3f')](_0x91d8('0x22'),auth['isAuthenticated'](),controller[_0x91d8('0x41')]);module[_0x91d8('0x42')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index 7a4f1d8..861a97a 100644 --- a/server/api/cloudProvider/cloudProvider.attributes.js +++ b/server/api/cloudProvider/cloudProvider.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x55c1=['STRING','sequelize','exports','Google'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x55c1,0x1e5));var _0x155c=function(_0x4bbc3a,_0x3a6945){_0x4bbc3a=_0x4bbc3a-0x0;var _0x579d56=_0x55c1[_0x4bbc3a];return _0x579d56;};'use strict';var Sequelize=require(_0x155c('0x0'));module[_0x155c('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize['ENUM']('AmazonAWS',_0x155c('0x2')),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize[_0x155c('0x3')]},'data2':{'type':Sequelize[_0x155c('0x3')]}}; \ No newline at end of file +var _0x3595=['AmazonAWS','Google','sequelize','exports','STRING'];(function(_0x31792d,_0x3c3fa5){var _0x14b815=function(_0x1a8fed){while(--_0x1a8fed){_0x31792d['push'](_0x31792d['shift']());}};_0x14b815(++_0x3c3fa5);}(_0x3595,0x147));var _0x5359=function(_0x10e3c6,_0x5f3945){_0x10e3c6=_0x10e3c6-0x0;var _0xf060d4=_0x3595[_0x10e3c6];return _0xf060d4;};'use strict';var Sequelize=require(_0x5359('0x0'));module[_0x5359('0x1')]={'name':{'type':Sequelize[_0x5359('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize['ENUM'](_0x5359('0x3'),_0x5359('0x4')),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize[_0x5359('0x2')]},'data2':{'type':Sequelize[_0x5359('0x2')]}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index 94c2ce5..d55ac20 100644 --- a/server/api/cloudProvider/cloudProvider.controller.js +++ b/server/api/cloudProvider/cloudProvider.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x03e9=['key','model','query','intersection','fields','attributes','hasOwnProperty','nolimit','offset','order','sort','filters','filter','where','merge','VIRTUAL','options','CloudProvider','count','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','length','find','create','body','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','limit','set','Content-Range','reject','save','then','destroy','stack','name','send','index','map','fieldName','type'];(function(_0x406bd9,_0x4adf83){var _0x37495c=function(_0x31f170){while(--_0x31f170){_0x406bd9['push'](_0x406bd9['shift']());}};_0x37495c(++_0x4adf83);}(_0x03e9,0x19c));var _0x903e=function(_0x5dbe96,_0x21d047){_0x5dbe96=_0x5dbe96-0x0;var _0x47edbc=_0x03e9[_0x5dbe96];return _0x47edbc;};'use strict';var pdf=require(_0x903e('0x0'));var emlformat=require(_0x903e('0x1'));var rimraf=require(_0x903e('0x2'));var zipdir=require(_0x903e('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x903e('0x4'));var BPromise=require(_0x903e('0x5'));var Mustache=require('mustache');var util=require(_0x903e('0x6'));var path=require(_0x903e('0x7'));var sox=require(_0x903e('0x8'));var csv=require(_0x903e('0x9'));var ejs=require(_0x903e('0xa'));var fs=require('fs');var _=require(_0x903e('0xb'));var squel=require(_0x903e('0xc'));var crypto=require(_0x903e('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x903e('0x9'));var querystring=require(_0x903e('0xe'));var Papa=require(_0x903e('0xf'));var Redis=require(_0x903e('0x10'));var authService=require(_0x903e('0x11'));var qs=require(_0x903e('0x12'));var as=require(_0x903e('0x13'));var hardwareService=require(_0x903e('0x14'));var logger=require(_0x903e('0x15'))(_0x903e('0x16'));var utils=require(_0x903e('0x17'));var config=require(_0x903e('0x18'));var db=require(_0x903e('0x19'))['db'];function respondWithStatusCode(_0x46e945,_0x5c97c2){_0x5c97c2=_0x5c97c2||0xcc;return function(_0xf7497b){if(_0xf7497b){return _0x46e945[_0x903e('0x1a')](_0x5c97c2);}return _0x46e945[_0x903e('0x1b')](_0x5c97c2)[_0x903e('0x1c')]();};}function respondWithResult(_0x37e037,_0x4aee5b){_0x4aee5b=_0x4aee5b||0xc8;return function(_0x2a885f){if(_0x2a885f){return _0x37e037[_0x903e('0x1b')](_0x4aee5b)[_0x903e('0x1d')](_0x2a885f);}};}function respondWithFilteredResult(_0x5d135f,_0x2fa681){return function(_0x5a1dad){if(_0x5a1dad){var _0x237ef8=_0x5a1dad['count'],_0x26aec9=_0x2fa681['offset'],_0x378e3a=_0x2fa681['offset']+_0x2fa681[_0x903e('0x1e')],_0x42593e;if(_0x378e3a>=_0x237ef8){_0x378e3a=_0x237ef8;_0x42593e=0xc8;}else{_0x42593e=0xce;}_0x5d135f['status'](_0x42593e);return _0x5d135f[_0x903e('0x1f')](_0x903e('0x20'),_0x26aec9+'-'+_0x378e3a+'/'+_0x237ef8)[_0x903e('0x1d')](_0x5a1dad);}return null;};}function patchUpdates(_0x4253e6){return function(_0x16f780){try{jsonpatch['apply'](_0x16f780,_0x4253e6,!![]);}catch(_0x2c6c91){return BPromise[_0x903e('0x21')](_0x2c6c91);}return _0x16f780[_0x903e('0x22')]();};}function saveUpdates(_0x2a76af,_0x5a546e){return function(_0x3faf2e){if(_0x3faf2e){return _0x3faf2e['update'](_0x2a76af)[_0x903e('0x23')](function(_0x2743e6){return _0x2743e6;});}return null;};}function removeEntity(_0x2a6788,_0x1ec95d){return function(_0x34ac7d){if(_0x34ac7d){return _0x34ac7d[_0x903e('0x24')]()['then'](function(){_0x2a6788[_0x903e('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x449b65,_0x19e0b1){return function(_0x2410c9){if(!_0x2410c9){_0x449b65[_0x903e('0x1a')](0x194);}return _0x2410c9;};}function handleError(_0x5d66a3,_0x44f27f){_0x44f27f=_0x44f27f||0x1f4;return function(_0x433481){logger['error'](_0x433481[_0x903e('0x25')]);if(_0x433481[_0x903e('0x26')]){delete _0x433481[_0x903e('0x26')];}_0x5d66a3[_0x903e('0x1b')](_0x44f27f)[_0x903e('0x27')](_0x433481);};}exports[_0x903e('0x28')]=function(_0x564e29,_0x2a5ed7){var _0x281766={},_0xadb067={},_0x204f2d={'count':0x0,'rows':[]};var _0x55b520=_[_0x903e('0x29')](db['CloudProvider']['rawAttributes'],function(_0x1e973a){return{'name':_0x1e973a[_0x903e('0x2a')],'type':_0x1e973a[_0x903e('0x2b')][_0x903e('0x2c')]};});_0xadb067[_0x903e('0x2d')]=_[_0x903e('0x29')](_0x55b520,_0x903e('0x26'));_0xadb067['query']=_['keys'](_0x564e29[_0x903e('0x2e')]);_0xadb067['filters']=_[_0x903e('0x2f')](_0xadb067['model'],_0xadb067[_0x903e('0x2e')]);_0x281766['attributes']=_[_0x903e('0x2f')](_0xadb067[_0x903e('0x2d')],qs[_0x903e('0x30')](_0x564e29[_0x903e('0x2e')]['fields']));_0x281766['attributes']=_0x281766['attributes']['length']?_0x281766[_0x903e('0x31')]:_0xadb067[_0x903e('0x2d')];if(!_0x564e29[_0x903e('0x2e')][_0x903e('0x32')](_0x903e('0x33'))){_0x281766[_0x903e('0x1e')]=qs[_0x903e('0x1e')](_0x564e29[_0x903e('0x2e')]['limit']);_0x281766[_0x903e('0x34')]=qs[_0x903e('0x34')](_0x564e29[_0x903e('0x2e')][_0x903e('0x34')]);}_0x281766[_0x903e('0x35')]=qs[_0x903e('0x36')](_0x564e29['query']['sort']);_0x281766['where']=qs[_0x903e('0x37')](_['pick'](_0x564e29[_0x903e('0x2e')],_0xadb067[_0x903e('0x37')]),_0x55b520);if(_0x564e29[_0x903e('0x2e')][_0x903e('0x38')]){_0x281766[_0x903e('0x39')]=_[_0x903e('0x3a')](_0x281766[_0x903e('0x39')],{'$or':_[_0x903e('0x29')](_0x55b520,function(_0x14da2d){if(_0x14da2d['type']!==_0x903e('0x3b')){var _0x4bb41f={};_0x4bb41f[_0x14da2d[_0x903e('0x26')]]={'$like':'%'+_0x564e29[_0x903e('0x2e')][_0x903e('0x38')]+'%'};return _0x4bb41f;}})});}_0x281766=_[_0x903e('0x3a')]({},_0x281766,_0x564e29[_0x903e('0x3c')]);var _0x2b7837={'where':_0x281766['where']};return db[_0x903e('0x3d')][_0x903e('0x3e')](_0x2b7837)[_0x903e('0x23')](function(_0x5c5b91){_0x204f2d[_0x903e('0x3e')]=_0x5c5b91;if(_0x564e29[_0x903e('0x2e')][_0x903e('0x3f')]){_0x281766[_0x903e('0x40')]=[{'all':!![]}];}return db[_0x903e('0x3d')][_0x903e('0x41')](_0x281766);})[_0x903e('0x23')](function(_0x9b5866){_0x204f2d[_0x903e('0x42')]=_0x9b5866;return _0x204f2d;})[_0x903e('0x23')](respondWithFilteredResult(_0x2a5ed7,_0x281766))[_0x903e('0x43')](handleError(_0x2a5ed7,null));};exports[_0x903e('0x44')]=function(_0x509b17,_0x67fff0){var _0x2088dc={'raw':!![],'where':{'id':_0x509b17[_0x903e('0x45')]['id']}},_0x5f216e={};_0x5f216e[_0x903e('0x2d')]=_[_0x903e('0x46')](db[_0x903e('0x3d')][_0x903e('0x47')]);_0x5f216e[_0x903e('0x2e')]=_['keys'](_0x509b17[_0x903e('0x2e')]);_0x5f216e[_0x903e('0x37')]=_[_0x903e('0x2f')](_0x5f216e['model'],_0x5f216e[_0x903e('0x2e')]);_0x2088dc[_0x903e('0x31')]=_['intersection'](_0x5f216e[_0x903e('0x2d')],qs[_0x903e('0x30')](_0x509b17['query'][_0x903e('0x30')]));_0x2088dc[_0x903e('0x31')]=_0x2088dc['attributes'][_0x903e('0x48')]?_0x2088dc[_0x903e('0x31')]:_0x5f216e[_0x903e('0x2d')];if(_0x509b17['query']['includeAll']){_0x2088dc[_0x903e('0x40')]=[{'all':!![]}];}_0x2088dc=_[_0x903e('0x3a')]({},_0x2088dc,_0x509b17['options']);return db[_0x903e('0x3d')][_0x903e('0x49')](_0x2088dc)['then'](handleEntityNotFound(_0x67fff0,null))[_0x903e('0x23')](respondWithResult(_0x67fff0,null))['catch'](handleError(_0x67fff0,null));};exports[_0x903e('0x4a')]=function(_0x487a75,_0x32a728){return db[_0x903e('0x3d')]['create'](_0x487a75[_0x903e('0x4b')],{})[_0x903e('0x23')](respondWithResult(_0x32a728,0xc9))[_0x903e('0x43')](handleError(_0x32a728,null));};exports['update']=function(_0x351c23,_0x5058ec){if(_0x351c23[_0x903e('0x4b')]['id']){delete _0x351c23['body']['id'];}return db[_0x903e('0x3d')]['find']({'where':{'id':_0x351c23[_0x903e('0x45')]['id']}})[_0x903e('0x23')](handleEntityNotFound(_0x5058ec,null))[_0x903e('0x23')](saveUpdates(_0x351c23[_0x903e('0x4b')],null))[_0x903e('0x23')](respondWithResult(_0x5058ec,null))[_0x903e('0x43')](handleError(_0x5058ec,null));};exports[_0x903e('0x24')]=function(_0x465270,_0x79c6d4){return db[_0x903e('0x3d')][_0x903e('0x49')]({'where':{'id':_0x465270[_0x903e('0x45')]['id']}})[_0x903e('0x23')](handleEntityNotFound(_0x79c6d4,null))['then'](removeEntity(_0x79c6d4,null))[_0x903e('0x43')](handleError(_0x79c6d4,null));}; \ No newline at end of file +var _0x1695=['../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','count','offset','limit','status','set','Content-Range','apply','reject','save','update','then','error','stack','index','map','CloudProvider','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','findAll','catch','show','length','options','find','create','body','destroy','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api'];(function(_0x2aeef1,_0x33214e){var _0x5b8fc0=function(_0x176aee){while(--_0x176aee){_0x2aeef1['push'](_0x2aeef1['shift']());}};_0x5b8fc0(++_0x33214e);}(_0x1695,0x1b7));var _0x5169=function(_0x1633e0,_0x513fa3){_0x1633e0=_0x1633e0-0x0;var _0x38e5dd=_0x1695[_0x1633e0];return _0x38e5dd;};'use strict';var pdf=require(_0x5169('0x0'));var emlformat=require(_0x5169('0x1'));var rimraf=require(_0x5169('0x2'));var zipdir=require(_0x5169('0x3'));var jsonpatch=require(_0x5169('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x5169('0x5'));var Mustache=require(_0x5169('0x6'));var util=require(_0x5169('0x7'));var path=require('path');var sox=require(_0x5169('0x8'));var csv=require(_0x5169('0x9'));var ejs=require(_0x5169('0xa'));var fs=require('fs');var _=require(_0x5169('0xb'));var squel=require(_0x5169('0xc'));var crypto=require('crypto');var jsforce=require(_0x5169('0xd'));var deskjs=require(_0x5169('0xe'));var toCsv=require(_0x5169('0x9'));var querystring=require(_0x5169('0xf'));var Papa=require(_0x5169('0x10'));var Redis=require(_0x5169('0x11'));var authService=require(_0x5169('0x12'));var qs=require(_0x5169('0x13'));var as=require(_0x5169('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5169('0x15'))(_0x5169('0x16'));var utils=require(_0x5169('0x17'));var config=require(_0x5169('0x18'));var db=require(_0x5169('0x19'))['db'];function respondWithStatusCode(_0x1ba9d9,_0x386e53){_0x386e53=_0x386e53||0xcc;return function(_0x1b0684){if(_0x1b0684){return _0x1ba9d9[_0x5169('0x1a')](_0x386e53);}return _0x1ba9d9['status'](_0x386e53)[_0x5169('0x1b')]();};}function respondWithResult(_0x3bdebd,_0x96f104){_0x96f104=_0x96f104||0xc8;return function(_0x3bffa7){if(_0x3bffa7){return _0x3bdebd['status'](_0x96f104)['json'](_0x3bffa7);}};}function respondWithFilteredResult(_0x556bc0,_0x5d815a){return function(_0x184c6a){if(_0x184c6a){var _0xf3096b=_0x184c6a[_0x5169('0x1c')],_0x1b386c=_0x5d815a[_0x5169('0x1d')],_0x4fc1df=_0x5d815a[_0x5169('0x1d')]+_0x5d815a[_0x5169('0x1e')],_0x250fa8;if(_0x4fc1df>=_0xf3096b){_0x4fc1df=_0xf3096b;_0x250fa8=0xc8;}else{_0x250fa8=0xce;}_0x556bc0[_0x5169('0x1f')](_0x250fa8);return _0x556bc0[_0x5169('0x20')](_0x5169('0x21'),_0x1b386c+'-'+_0x4fc1df+'/'+_0xf3096b)['json'](_0x184c6a);}return null;};}function patchUpdates(_0xcbd14b){return function(_0x421d6b){try{jsonpatch[_0x5169('0x22')](_0x421d6b,_0xcbd14b,!![]);}catch(_0x328717){return BPromise[_0x5169('0x23')](_0x328717);}return _0x421d6b[_0x5169('0x24')]();};}function saveUpdates(_0x2da2e6,_0x5e0aa5){return function(_0xd911ca){if(_0xd911ca){return _0xd911ca[_0x5169('0x25')](_0x2da2e6)['then'](function(_0x1ba9f4){return _0x1ba9f4;});}return null;};}function removeEntity(_0x1ca0a9,_0x5ee921){return function(_0x1e2eab){if(_0x1e2eab){return _0x1e2eab['destroy']()[_0x5169('0x26')](function(){_0x1ca0a9[_0x5169('0x1f')](0xcc)[_0x5169('0x1b')]();});}};}function handleEntityNotFound(_0x44634f,_0xe8c8f9){return function(_0x315e05){if(!_0x315e05){_0x44634f[_0x5169('0x1a')](0x194);}return _0x315e05;};}function handleError(_0x45e65f,_0x372905){_0x372905=_0x372905||0x1f4;return function(_0x145179){logger[_0x5169('0x27')](_0x145179[_0x5169('0x28')]);if(_0x145179['name']){delete _0x145179['name'];}_0x45e65f[_0x5169('0x1f')](_0x372905)['send'](_0x145179);};}exports[_0x5169('0x29')]=function(_0x3c0645,_0x24d1f2){var _0x1aaedf={},_0x4683d9={},_0x378eb7={'count':0x0,'rows':[]};var _0x59e932=_[_0x5169('0x2a')](db[_0x5169('0x2b')][_0x5169('0x2c')],function(_0x4199ac){return{'name':_0x4199ac[_0x5169('0x2d')],'type':_0x4199ac[_0x5169('0x2e')][_0x5169('0x2f')]};});_0x4683d9[_0x5169('0x30')]=_['map'](_0x59e932,_0x5169('0x31'));_0x4683d9[_0x5169('0x32')]=_[_0x5169('0x33')](_0x3c0645[_0x5169('0x32')]);_0x4683d9[_0x5169('0x34')]=_[_0x5169('0x35')](_0x4683d9[_0x5169('0x30')],_0x4683d9[_0x5169('0x32')]);_0x1aaedf[_0x5169('0x36')]=_['intersection'](_0x4683d9['model'],qs[_0x5169('0x37')](_0x3c0645['query'][_0x5169('0x37')]));_0x1aaedf['attributes']=_0x1aaedf[_0x5169('0x36')]['length']?_0x1aaedf[_0x5169('0x36')]:_0x4683d9[_0x5169('0x30')];if(!_0x3c0645[_0x5169('0x32')][_0x5169('0x38')](_0x5169('0x39'))){_0x1aaedf['limit']=qs[_0x5169('0x1e')](_0x3c0645[_0x5169('0x32')][_0x5169('0x1e')]);_0x1aaedf[_0x5169('0x1d')]=qs[_0x5169('0x1d')](_0x3c0645[_0x5169('0x32')][_0x5169('0x1d')]);}_0x1aaedf[_0x5169('0x3a')]=qs[_0x5169('0x3b')](_0x3c0645[_0x5169('0x32')][_0x5169('0x3b')]);_0x1aaedf[_0x5169('0x3c')]=qs[_0x5169('0x34')](_[_0x5169('0x3d')](_0x3c0645[_0x5169('0x32')],_0x4683d9[_0x5169('0x34')]),_0x59e932);if(_0x3c0645['query']['filter']){_0x1aaedf[_0x5169('0x3c')]=_[_0x5169('0x3e')](_0x1aaedf[_0x5169('0x3c')],{'$or':_[_0x5169('0x2a')](_0x59e932,function(_0x20bf5e){if(_0x20bf5e['type']!==_0x5169('0x3f')){var _0x47bbe8={};_0x47bbe8[_0x20bf5e[_0x5169('0x31')]]={'$like':'%'+_0x3c0645[_0x5169('0x32')][_0x5169('0x40')]+'%'};return _0x47bbe8;}})});}_0x1aaedf=_[_0x5169('0x3e')]({},_0x1aaedf,_0x3c0645['options']);var _0x5220c2={'where':_0x1aaedf[_0x5169('0x3c')]};return db['CloudProvider'][_0x5169('0x1c')](_0x5220c2)[_0x5169('0x26')](function(_0x5782b7){_0x378eb7['count']=_0x5782b7;if(_0x3c0645[_0x5169('0x32')][_0x5169('0x41')]){_0x1aaedf[_0x5169('0x42')]=[{'all':!![]}];}return db[_0x5169('0x2b')][_0x5169('0x43')](_0x1aaedf);})[_0x5169('0x26')](function(_0x52992d){_0x378eb7['rows']=_0x52992d;return _0x378eb7;})['then'](respondWithFilteredResult(_0x24d1f2,_0x1aaedf))[_0x5169('0x44')](handleError(_0x24d1f2,null));};exports[_0x5169('0x45')]=function(_0x1f4d16,_0x40c70b){var _0x3c402f={'raw':!![],'where':{'id':_0x1f4d16['params']['id']}},_0x4e98a9={};_0x4e98a9[_0x5169('0x30')]=_['keys'](db['CloudProvider'][_0x5169('0x2c')]);_0x4e98a9[_0x5169('0x32')]=_[_0x5169('0x33')](_0x1f4d16[_0x5169('0x32')]);_0x4e98a9['filters']=_[_0x5169('0x35')](_0x4e98a9[_0x5169('0x30')],_0x4e98a9[_0x5169('0x32')]);_0x3c402f[_0x5169('0x36')]=_['intersection'](_0x4e98a9['model'],qs['fields'](_0x1f4d16['query'][_0x5169('0x37')]));_0x3c402f[_0x5169('0x36')]=_0x3c402f['attributes'][_0x5169('0x46')]?_0x3c402f[_0x5169('0x36')]:_0x4e98a9['model'];if(_0x1f4d16['query'][_0x5169('0x41')]){_0x3c402f['include']=[{'all':!![]}];}_0x3c402f=_[_0x5169('0x3e')]({},_0x3c402f,_0x1f4d16[_0x5169('0x47')]);return db['CloudProvider'][_0x5169('0x48')](_0x3c402f)[_0x5169('0x26')](handleEntityNotFound(_0x40c70b,null))['then'](respondWithResult(_0x40c70b,null))[_0x5169('0x44')](handleError(_0x40c70b,null));};exports[_0x5169('0x49')]=function(_0x138e3e,_0x4aa133){return db[_0x5169('0x2b')]['create'](_0x138e3e['body'],{})[_0x5169('0x26')](respondWithResult(_0x4aa133,0xc9))[_0x5169('0x44')](handleError(_0x4aa133,null));};exports[_0x5169('0x25')]=function(_0x40ec9e,_0x43031b){if(_0x40ec9e[_0x5169('0x4a')]['id']){delete _0x40ec9e[_0x5169('0x4a')]['id'];}return db['CloudProvider'][_0x5169('0x48')]({'where':{'id':_0x40ec9e['params']['id']}})['then'](handleEntityNotFound(_0x43031b,null))[_0x5169('0x26')](saveUpdates(_0x40ec9e[_0x5169('0x4a')],null))[_0x5169('0x26')](respondWithResult(_0x43031b,null))['catch'](handleError(_0x43031b,null));};exports[_0x5169('0x4b')]=function(_0x16b9be,_0x115a74){return db[_0x5169('0x2b')]['find']({'where':{'id':_0x16b9be[_0x5169('0x4c')]['id']}})[_0x5169('0x26')](handleEntityNotFound(_0x115a74,null))['then'](removeEntity(_0x115a74,null))[_0x5169('0x44')](handleError(_0x115a74,null));}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index 43c6348..0f41539 100644 --- a/server/api/cloudProvider/cloudProvider.model.js +++ b/server/api/cloudProvider/cloudProvider.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8b43=['rimraf','../../config/environment','./cloudProvider.attributes','exports','define','CloudProvider','cloud_providers','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x1031ab,_0x11a0e6){var _0x15ba29=function(_0x363709){while(--_0x363709){_0x1031ab['push'](_0x1031ab['shift']());}};_0x15ba29(++_0x11a0e6);}(_0x8b43,0xe8));var _0x38b4=function(_0x22a8ae,_0x1e5837){_0x22a8ae=_0x22a8ae-0x0;var _0x244a57=_0x8b43[_0x22a8ae];return _0x244a57;};'use strict';var _=require(_0x38b4('0x0'));var util=require(_0x38b4('0x1'));var logger=require(_0x38b4('0x2'))(_0x38b4('0x3'));var moment=require(_0x38b4('0x4'));var BPromise=require(_0x38b4('0x5'));var rp=require(_0x38b4('0x6'));var fs=require('fs');var path=require(_0x38b4('0x7'));var rimraf=require(_0x38b4('0x8'));var config=require(_0x38b4('0x9'));var attributes=require(_0x38b4('0xa'));module[_0x38b4('0xb')]=function(_0x3a302a,_0x3e3b82){return _0x3a302a[_0x38b4('0xc')](_0x38b4('0xd'),attributes,{'tableName':_0x38b4('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8bfc=['cloud_providers','util','../../config/logger','api','bluebird','path','rimraf','./cloudProvider.attributes','define'];(function(_0x25db32,_0xff506b){var _0x3b0487=function(_0x72ee81){while(--_0x72ee81){_0x25db32['push'](_0x25db32['shift']());}};_0x3b0487(++_0xff506b);}(_0x8bfc,0x13c));var _0xc8bf=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0x8bfc[_0x18ab2a];return _0x16dcee;};'use strict';var _=require('lodash');var util=require(_0xc8bf('0x0'));var logger=require(_0xc8bf('0x1'))(_0xc8bf('0x2'));var moment=require('moment');var BPromise=require(_0xc8bf('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc8bf('0x4'));var rimraf=require(_0xc8bf('0x5'));var config=require('../../config/environment');var attributes=require(_0xc8bf('0x6'));module['exports']=function(_0x277838,_0x4c8af6){return _0x277838[_0xc8bf('0x7')]('CloudProvider',attributes,{'tableName':_0xc8bf('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.rpc.js b/server/api/cloudProvider/cloudProvider.rpc.js index ed54da0..df3a51c 100644 --- a/server/api/cloudProvider/cloudProvider.rpc.js +++ b/server/api/cloudProvider/cloudProvider.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x448e=['stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','http','request','then','info','CloudProvider,\x20%s,\x20%s','request\x20sent','CloudProvider,\x20%s,\x20%s,\x20%s'];(function(_0x4b7daa,_0x583357){var _0x866f9f=function(_0x39f380){while(--_0x39f380){_0x4b7daa['push'](_0x4b7daa['shift']());}};_0x866f9f(++_0x583357);}(_0x448e,0xc3));var _0xe448=function(_0x57e196,_0x428408){_0x57e196=_0x57e196-0x0;var _0x5941ab=_0x448e[_0x57e196];return _0x5941ab;};'use strict';var _=require(_0xe448('0x0'));var util=require(_0xe448('0x1'));var moment=require('moment');var BPromise=require(_0xe448('0x2'));var rs=require(_0xe448('0x3'));var fs=require('fs');var Redis=require(_0xe448('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xe448('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xe448('0x6'));var jayson=require(_0xe448('0x7'));var client=jayson['client'][_0xe448('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x15b61f,_0x1b20cf,_0x1e6c4d){return new BPromise(function(_0x4e0cb1,_0x3c4d67){return client[_0xe448('0x9')](_0x15b61f,_0x1e6c4d)[_0xe448('0xa')](function(_0x10862b){logger[_0xe448('0xb')](_0xe448('0xc'),_0x1b20cf,_0xe448('0xd'));logger['debug'](_0xe448('0xe'),_0x1b20cf,'request\x20sent',JSON[_0xe448('0xf')](_0x10862b));if(_0x10862b[_0xe448('0x10')]){if(_0x10862b[_0xe448('0x10')][_0xe448('0x11')]===0x1f4){logger['error'](_0xe448('0xc'),_0x1b20cf,_0x10862b[_0xe448('0x10')][_0xe448('0x12')]);return _0x3c4d67(_0x10862b[_0xe448('0x10')]['message']);}logger['error'](_0xe448('0xc'),_0x1b20cf,_0x10862b[_0xe448('0x10')][_0xe448('0x12')]);return _0x4e0cb1(_0x10862b[_0xe448('0x10')][_0xe448('0x12')]);}else{logger[_0xe448('0xb')](_0xe448('0xc'),_0x1b20cf,'request\x20sent');_0x4e0cb1(_0x10862b[_0xe448('0x13')]['message']);}})[_0xe448('0x14')](function(_0x17510c){logger[_0xe448('0x10')](_0xe448('0xc'),_0x1b20cf,_0x17510c);_0x3c4d67(_0x17510c);});});} \ No newline at end of file +var _0x89cc=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','message','CloudProvider,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x4b25c1,_0xe76c7e){var _0x406b76=function(_0x5508c0){while(--_0x5508c0){_0x4b25c1['push'](_0x4b25c1['shift']());}};_0x406b76(++_0xe76c7e);}(_0x89cc,0x1c6));var _0xc89c=function(_0x311a13,_0x588b27){_0x311a13=_0x311a13-0x0;var _0x35e152=_0x89cc[_0x311a13];return _0x35e152;};'use strict';var _=require(_0xc89c('0x0'));var util=require(_0xc89c('0x1'));var moment=require(_0xc89c('0x2'));var BPromise=require(_0xc89c('0x3'));var rs=require(_0xc89c('0x4'));var fs=require('fs');var Redis=require(_0xc89c('0x5'));var db=require(_0xc89c('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xc89c('0x7'))(_0xc89c('0x8'));var config=require(_0xc89c('0x9'));var jayson=require(_0xc89c('0xa'));var client=jayson[_0xc89c('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b4df2,_0x55ba86,_0xc0110a){return new BPromise(function(_0x557ace,_0x1987d6){return client[_0xc89c('0xc')](_0x3b4df2,_0xc0110a)['then'](function(_0xe6c541){logger[_0xc89c('0xd')]('CloudProvider,\x20%s,\x20%s',_0x55ba86,_0xc89c('0xe'));logger[_0xc89c('0xf')](_0xc89c('0x10'),_0x55ba86,_0xc89c('0xe'),JSON[_0xc89c('0x11')](_0xe6c541));if(_0xe6c541[_0xc89c('0x12')]){if(_0xe6c541[_0xc89c('0x12')]['code']===0x1f4){logger[_0xc89c('0x12')]('CloudProvider,\x20%s,\x20%s',_0x55ba86,_0xe6c541[_0xc89c('0x12')][_0xc89c('0x13')]);return _0x1987d6(_0xe6c541[_0xc89c('0x12')][_0xc89c('0x13')]);}logger[_0xc89c('0x12')]('CloudProvider,\x20%s,\x20%s',_0x55ba86,_0xe6c541[_0xc89c('0x12')][_0xc89c('0x13')]);return _0x557ace(_0xe6c541[_0xc89c('0x12')]['message']);}else{logger[_0xc89c('0xd')](_0xc89c('0x14'),_0x55ba86,_0xc89c('0xe'));_0x557ace(_0xe6c541[_0xc89c('0x15')]['message']);}})[_0xc89c('0x16')](function(_0x275dd4){logger['error'](_0xc89c('0x14'),_0x55ba86,_0x275dd4);_0x1987d6(_0x275dd4);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index 30b6f99..152a8c7 100644 --- a/server/api/cloudProvider/index.js +++ b/server/api/cloudProvider/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc692=['exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cloudProvider.controller','get','isAuthenticated','show','create','update','delete','/:id','destroy'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xc692,0x11e));var _0x2c69=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0xc692[_0x3ff085];return _0x2b68c3;};'use strict';var multer=require(_0x2c69('0x0'));var util=require(_0x2c69('0x1'));var path=require(_0x2c69('0x2'));var timeout=require(_0x2c69('0x3'));var express=require(_0x2c69('0x4'));var router=express[_0x2c69('0x5')]();var auth=require(_0x2c69('0x6'));var interaction=require(_0x2c69('0x7'));var config=require(_0x2c69('0x8'));var controller=require(_0x2c69('0x9'));router[_0x2c69('0xa')]('/',auth[_0x2c69('0xb')](),controller['index']);router[_0x2c69('0xa')]('/:id',auth[_0x2c69('0xb')](),controller[_0x2c69('0xc')]);router['post']('/',auth[_0x2c69('0xb')](),controller[_0x2c69('0xd')]);router['put']('/:id',auth[_0x2c69('0xb')](),controller[_0x2c69('0xe')]);router[_0x2c69('0xf')](_0x2c69('0x10'),auth[_0x2c69('0xb')](),controller[_0x2c69('0x11')]);module[_0x2c69('0x12')]=router; \ No newline at end of file +var _0x1e45=['Router','../../components/auth/service','../../components/interaction/service','get','index','isAuthenticated','show','post','create','put','/:id','update','delete','multer','util','path','express'];(function(_0xb3e53,_0x2583db){var _0x385233=function(_0x444fe8){while(--_0x444fe8){_0xb3e53['push'](_0xb3e53['shift']());}};_0x385233(++_0x2583db);}(_0x1e45,0x10c));var _0x51e4=function(_0x241631,_0x2db210){_0x241631=_0x241631-0x0;var _0x39bce1=_0x1e45[_0x241631];return _0x39bce1;};'use strict';var multer=require(_0x51e4('0x0'));var util=require(_0x51e4('0x1'));var path=require(_0x51e4('0x2'));var timeout=require('connect-timeout');var express=require(_0x51e4('0x3'));var router=express[_0x51e4('0x4')]();var auth=require(_0x51e4('0x5'));var interaction=require(_0x51e4('0x6'));var config=require('../../config/environment');var controller=require('./cloudProvider.controller');router[_0x51e4('0x7')]('/',auth['isAuthenticated'](),controller[_0x51e4('0x8')]);router[_0x51e4('0x7')]('/:id',auth[_0x51e4('0x9')](),controller[_0x51e4('0xa')]);router[_0x51e4('0xb')]('/',auth[_0x51e4('0x9')](),controller[_0x51e4('0xc')]);router[_0x51e4('0xd')](_0x51e4('0xe'),auth[_0x51e4('0x9')](),controller[_0x51e4('0xf')]);router[_0x51e4('0x10')](_0x51e4('0xe'),auth[_0x51e4('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index 887fc48..d946011 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 _0x198c=['STRING','sequelize'];(function(_0x1a53b3,_0x177b8a){var _0x11023c=function(_0x3d3249){while(--_0x3d3249){_0x1a53b3['push'](_0x1a53b3['shift']());}};_0x11023c(++_0x177b8a);}(_0x198c,0x15b));var _0xc198=function(_0x30f136,_0x5d1821){_0x30f136=_0x30f136-0x0;var _0x32e07c=_0x198c[_0x30f136];return _0x32e07c;};'use strict';var Sequelize=require(_0xc198('0x0'));module['exports']={'name':{'type':Sequelize[_0xc198('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xc198('0x1')]},'companyId':{'type':Sequelize['STRING']},'website':{'type':Sequelize[_0xc198('0x1')]},'phone':{'type':Sequelize[_0xc198('0x1')]},'fax':{'type':Sequelize[_0xc198('0x1')]},'type':{'type':Sequelize['STRING']},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0xc198('0x1')]},'city':{'type':Sequelize[_0xc198('0x1')]},'country':{'type':Sequelize[_0xc198('0x1')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0xc198('0x1')]},'sStreet':{'type':Sequelize[_0xc198('0x1')]},'sPostalCode':{'type':Sequelize['STRING']},'sCity':{'type':Sequelize['STRING']},'sCountry':{'type':Sequelize[_0xc198('0x1')]},'description':{'type':Sequelize[_0xc198('0x1')]}}; \ No newline at end of file +var _0xc7fa=['STRING','sequelize','exports','name'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0xc7fa,0x159));var _0xac7f=function(_0xe73cf8,_0x35aa47){_0xe73cf8=_0xe73cf8-0x0;var _0x3d956f=_0xc7fa[_0xe73cf8];return _0x3d956f;};'use strict';var Sequelize=require(_0xac7f('0x0'));module[_0xac7f('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xac7f('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize['STRING']},'companyId':{'type':Sequelize['STRING']},'website':{'type':Sequelize['STRING']},'phone':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0xac7f('0x3')]},'type':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0xac7f('0x3')]},'postalCode':{'type':Sequelize[_0xac7f('0x3')]},'city':{'type':Sequelize[_0xac7f('0x3')]},'country':{'type':Sequelize[_0xac7f('0x3')]},'email':{'type':Sequelize[_0xac7f('0x3')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0xac7f('0x3')]},'sStreet':{'type':Sequelize[_0xac7f('0x3')]},'sPostalCode':{'type':Sequelize['STRING']},'sCity':{'type':Sequelize[_0xac7f('0x3')]},'sCountry':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xac7f('0x3')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index a1e87a9..447bd83 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 _0xebb0=['options','includeAll','rows','catch','show','params','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Companies','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addContacts','CmContact','ids','getContacts','rawAttributes','order','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','set','apply','save','update','then','destroy','get','UserProfileResource','error','name','send','index','CmCompany','describe','keys','query','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','limit','sort','where','pick','filter','map','merge'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0xebb0,0x1ab));var _0x0ebb=function(_0x56b540,_0x37f450){_0x56b540=_0x56b540-0x0;var _0xf62ffc=_0xebb0[_0x56b540];return _0xf62ffc;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x0ebb('0x0'));var rimraf=require(_0x0ebb('0x1'));var zipdir=require(_0x0ebb('0x2'));var jsonpatch=require(_0x0ebb('0x3'));var rp=require(_0x0ebb('0x4'));var moment=require(_0x0ebb('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x0ebb('0x6'));var util=require('util');var path=require(_0x0ebb('0x7'));var sox=require(_0x0ebb('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x0ebb('0x9'));var squel=require(_0x0ebb('0xa'));var crypto=require(_0x0ebb('0xb'));var jsforce=require(_0x0ebb('0xc'));var deskjs=require(_0x0ebb('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0ebb('0xe'));var Redis=require(_0x0ebb('0xf'));var authService=require(_0x0ebb('0x10'));var qs=require(_0x0ebb('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0ebb('0x12'));var logger=require(_0x0ebb('0x13'))(_0x0ebb('0x14'));var utils=require(_0x0ebb('0x15'));var config=require('../../config/environment');var db=require(_0x0ebb('0x16'))['db'];function respondWithStatusCode(_0x478154,_0x10445f){_0x10445f=_0x10445f||0xcc;return function(_0x44ea2e){if(_0x44ea2e){return _0x478154[_0x0ebb('0x17')](_0x10445f);}return _0x478154[_0x0ebb('0x18')](_0x10445f)[_0x0ebb('0x19')]();};}function respondWithResult(_0x245e5b,_0x1a68ce){_0x1a68ce=_0x1a68ce||0xc8;return function(_0x2519ba){if(_0x2519ba){return _0x245e5b[_0x0ebb('0x18')](_0x1a68ce)[_0x0ebb('0x1a')](_0x2519ba);}};}function respondWithFilteredResult(_0xdc7fe6,_0xc76672){return function(_0x24d9ad){if(_0x24d9ad){var _0x2bef30=_0x24d9ad[_0x0ebb('0x1b')],_0x53dec0=_0xc76672[_0x0ebb('0x1c')],_0x2c9cf3=_0xc76672[_0x0ebb('0x1c')]+_0xc76672['limit'],_0x5b6bbb;if(_0x2c9cf3>=_0x2bef30){_0x2c9cf3=_0x2bef30;_0x5b6bbb=0xc8;}else{_0x5b6bbb=0xce;}_0xdc7fe6['status'](_0x5b6bbb);return _0xdc7fe6[_0x0ebb('0x1d')]('Content-Range',_0x53dec0+'-'+_0x2c9cf3+'/'+_0x2bef30)[_0x0ebb('0x1a')](_0x24d9ad);}return null;};}function patchUpdates(_0x31197b){return function(_0x37e965){try{jsonpatch[_0x0ebb('0x1e')](_0x37e965,_0x31197b,!![]);}catch(_0x44000a){return BPromise['reject'](_0x44000a);}return _0x37e965[_0x0ebb('0x1f')]();};}function saveUpdates(_0x24916c,_0xfc7f49){return function(_0x13fc0e){if(_0x13fc0e){return _0x13fc0e[_0x0ebb('0x20')](_0x24916c)[_0x0ebb('0x21')](function(_0x1255b8){return _0x1255b8;});}return null;};}function removeEntity(_0x4cf645,_0x4a9c89){return function(_0x3c74c1){if(_0x3c74c1){return _0x3c74c1[_0x0ebb('0x22')]()[_0x0ebb('0x21')](function(){var _0x3669df=_0x3c74c1[_0x0ebb('0x23')]({'plain':!![]});var _0x1c0d6d='Companies';return db[_0x0ebb('0x24')][_0x0ebb('0x22')]({'where':{'type':_0x1c0d6d,'resourceId':_0x3669df['id']}})[_0x0ebb('0x21')](function(){return _0x3c74c1;});})[_0x0ebb('0x21')](function(){_0x4cf645['status'](0xcc)[_0x0ebb('0x19')]();});}};}function handleEntityNotFound(_0x5bd7b4,_0x3e7922){return function(_0x396575){if(!_0x396575){_0x5bd7b4[_0x0ebb('0x17')](0x194);}return _0x396575;};}function handleError(_0x54af8d,_0x2753e9){_0x2753e9=_0x2753e9||0x1f4;return function(_0x5bce5b){logger[_0x0ebb('0x25')](_0x5bce5b['stack']);if(_0x5bce5b[_0x0ebb('0x26')]){delete _0x5bce5b[_0x0ebb('0x26')];}_0x54af8d['status'](_0x2753e9)[_0x0ebb('0x27')](_0x5bce5b);};}exports[_0x0ebb('0x28')]=function(_0x44f3b5,_0x2d34e1){var _0x1ff264={},_0x5bd6cd={},_0x3f1160={'count':0x0,'rows':[]};return db[_0x0ebb('0x29')][_0x0ebb('0x2a')]()[_0x0ebb('0x21')](function(_0x552b79){_0x5bd6cd['model']=_['keys'](_0x552b79);_0x5bd6cd['query']=_[_0x0ebb('0x2b')](_0x44f3b5[_0x0ebb('0x2c')]);_0x5bd6cd[_0x0ebb('0x2d')]=_['intersection'](_0x5bd6cd[_0x0ebb('0x2e')],_0x5bd6cd['query']);_0x1ff264[_0x0ebb('0x2f')]=_[_0x0ebb('0x30')](_0x5bd6cd[_0x0ebb('0x2e')],qs[_0x0ebb('0x31')](_0x44f3b5[_0x0ebb('0x2c')]['fields']));_0x1ff264[_0x0ebb('0x2f')]=_0x1ff264[_0x0ebb('0x2f')]['length']?_0x1ff264[_0x0ebb('0x2f')]:_0x5bd6cd[_0x0ebb('0x2e')];if(!_0x44f3b5[_0x0ebb('0x2c')][_0x0ebb('0x32')](_0x0ebb('0x33'))){_0x1ff264['limit']=qs[_0x0ebb('0x34')](_0x44f3b5['query'][_0x0ebb('0x34')]);_0x1ff264[_0x0ebb('0x1c')]=qs[_0x0ebb('0x1c')](_0x44f3b5[_0x0ebb('0x2c')]['offset']);}_0x1ff264['order']=qs[_0x0ebb('0x35')](_0x44f3b5[_0x0ebb('0x2c')][_0x0ebb('0x35')]);_0x1ff264[_0x0ebb('0x36')]=qs[_0x0ebb('0x2d')](_[_0x0ebb('0x37')](_0x44f3b5[_0x0ebb('0x2c')],_0x5bd6cd[_0x0ebb('0x2d')]));if(_0x44f3b5[_0x0ebb('0x2c')][_0x0ebb('0x38')]){_0x1ff264[_0x0ebb('0x36')]=_['merge'](_0x1ff264[_0x0ebb('0x36')],{'$or':_[_0x0ebb('0x39')](_0x1ff264[_0x0ebb('0x2f')],function(_0xb77d0c){var _0x53bd4d={};_0x53bd4d[_0xb77d0c]={'$like':'%'+_0x44f3b5['query'][_0x0ebb('0x38')]+'%'};return _0x53bd4d;})});}_0x1ff264=_[_0x0ebb('0x3a')]({},_0x1ff264,_0x44f3b5[_0x0ebb('0x3b')]);var _0x1a0fea={'where':_0x1ff264[_0x0ebb('0x36')]};return db[_0x0ebb('0x29')][_0x0ebb('0x1b')](_0x1a0fea)[_0x0ebb('0x21')](function(_0x46e58e){_0x3f1160[_0x0ebb('0x1b')]=_0x46e58e;if(_0x44f3b5['query'][_0x0ebb('0x3c')]){_0x1ff264['include']=[{'all':!![]}];}return db[_0x0ebb('0x29')]['findAll'](_0x1ff264);})['then'](function(_0xecc280){_0x3f1160[_0x0ebb('0x3d')]=_0xecc280;return _0x3f1160;})['then'](respondWithFilteredResult(_0x2d34e1,_0x1ff264))[_0x0ebb('0x3e')](handleError(_0x2d34e1,null));})[_0x0ebb('0x3e')](handleError(_0x2d34e1,null));};exports[_0x0ebb('0x3f')]=function(_0x22c6df,_0x2ff372){var _0x302ae0={'raw':![],'where':{'id':_0x22c6df[_0x0ebb('0x40')]['id']}},_0x359cac={};_0x359cac[_0x0ebb('0x2e')]=_[_0x0ebb('0x2b')](db[_0x0ebb('0x29')]['rawAttributes']);_0x359cac['query']=_[_0x0ebb('0x2b')](_0x22c6df[_0x0ebb('0x2c')]);_0x359cac['filters']=_[_0x0ebb('0x30')](_0x359cac[_0x0ebb('0x2e')],_0x359cac['query']);_0x302ae0[_0x0ebb('0x2f')]=_[_0x0ebb('0x30')](_0x359cac[_0x0ebb('0x2e')],qs[_0x0ebb('0x31')](_0x22c6df[_0x0ebb('0x2c')][_0x0ebb('0x31')]));_0x302ae0['attributes']=_0x302ae0[_0x0ebb('0x2f')]['length']?_0x302ae0['attributes']:_0x359cac[_0x0ebb('0x2e')];if(_0x22c6df['query'][_0x0ebb('0x3c')]){_0x302ae0[_0x0ebb('0x41')]=[{'all':!![]}];}_0x302ae0=_['merge']({},_0x302ae0,_0x22c6df['options']);return db[_0x0ebb('0x29')][_0x0ebb('0x42')](_0x302ae0)[_0x0ebb('0x21')](handleEntityNotFound(_0x2ff372,null))[_0x0ebb('0x21')](respondWithResult(_0x2ff372,null))[_0x0ebb('0x3e')](handleError(_0x2ff372,null));};exports[_0x0ebb('0x43')]=function(_0x162d2b,_0x42b1bb){return db['CmCompany']['create'](_0x162d2b[_0x0ebb('0x44')],{})[_0x0ebb('0x21')](function(_0x2311ac){var _0x47938e=_0x162d2b[_0x0ebb('0x45')][_0x0ebb('0x23')]({'plain':!![]});if(!_0x47938e)throw new Error(_0x0ebb('0x46'));if(_0x47938e['role']===_0x0ebb('0x45')){var _0x3e1c55=_0x2311ac[_0x0ebb('0x23')]({'plain':!![]});var _0x433e7b=_0x0ebb('0x47');return db[_0x0ebb('0x48')][_0x0ebb('0x42')]({'where':{'name':_0x433e7b,'userProfileId':_0x47938e[_0x0ebb('0x49')]},'raw':!![]})['then'](function(_0x4a1a59){if(_0x4a1a59&&_0x4a1a59['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x3e1c55[_0x0ebb('0x26')],'resourceId':_0x3e1c55['id'],'type':_0x4a1a59[_0x0ebb('0x26')],'sectionId':_0x4a1a59['id']},{})[_0x0ebb('0x21')](function(){return _0x2311ac;});}else{return _0x2311ac;}})[_0x0ebb('0x3e')](function(_0x40ac1a){logger['error'](_0x0ebb('0x4a'),_0x40ac1a);throw _0x40ac1a;});}return _0x2311ac;})[_0x0ebb('0x21')](respondWithResult(_0x42b1bb,0xc9))[_0x0ebb('0x3e')](handleError(_0x42b1bb,null));};exports[_0x0ebb('0x20')]=function(_0x48721d,_0x4c1a93){if(_0x48721d[_0x0ebb('0x44')]['id']){delete _0x48721d[_0x0ebb('0x44')]['id'];}return db[_0x0ebb('0x29')][_0x0ebb('0x42')]({'where':{'id':_0x48721d[_0x0ebb('0x40')]['id']}})[_0x0ebb('0x21')](handleEntityNotFound(_0x4c1a93,null))['then'](saveUpdates(_0x48721d[_0x0ebb('0x44')],null))[_0x0ebb('0x21')](respondWithResult(_0x4c1a93,null))[_0x0ebb('0x3e')](handleError(_0x4c1a93,null));};exports[_0x0ebb('0x22')]=function(_0x485cd5,_0x1a7274){return db['CmCompany'][_0x0ebb('0x42')]({'where':{'id':_0x485cd5[_0x0ebb('0x40')]['id']}})[_0x0ebb('0x21')](handleEntityNotFound(_0x1a7274,null))['then'](removeEntity(_0x1a7274,null))['catch'](handleError(_0x1a7274,null));};exports[_0x0ebb('0x2a')]=function(_0x5de26e,_0x49356f){return db[_0x0ebb('0x29')][_0x0ebb('0x2a')]()[_0x0ebb('0x21')](respondWithResult(_0x49356f,null))['catch'](handleError(_0x49356f,null));};exports[_0x0ebb('0x4b')]=function(_0x5c5ba0,_0x474238,_0xb9f74b){return db[_0x0ebb('0x4c')][_0x0ebb('0x42')]({'where':{'id':_0x5c5ba0[_0x0ebb('0x40')]['id']}})[_0x0ebb('0x21')](handleEntityNotFound(_0x474238,null))[_0x0ebb('0x21')](function(_0x5ac0d5){if(_0x5ac0d5){return _0x5ac0d5[_0x0ebb('0x4b')](_0x5c5ba0[_0x0ebb('0x44')][_0x0ebb('0x4d')],_['omit'](_0x5c5ba0[_0x0ebb('0x44')],['ids','id'])||{});}})[_0x0ebb('0x21')](respondWithResult(_0x474238,null))['catch'](handleError(_0x474238,null));};exports[_0x0ebb('0x4e')]=function(_0x1d0836,_0x5d4ef5,_0x355ca1){var _0x58a18f={};var _0x3343b5={};var _0x205b1d;var _0xd78a37;return db[_0x0ebb('0x29')]['findOne']({'where':{'id':_0x1d0836[_0x0ebb('0x40')]['id']}})['then'](handleEntityNotFound(_0x5d4ef5,null))[_0x0ebb('0x21')](function(_0x7545c1){if(_0x7545c1){_0x205b1d=_0x7545c1;_0x3343b5[_0x0ebb('0x2e')]=_[_0x0ebb('0x2b')](db[_0x0ebb('0x4c')][_0x0ebb('0x4f')]);_0x3343b5[_0x0ebb('0x2c')]=_[_0x0ebb('0x2b')](_0x1d0836[_0x0ebb('0x2c')]);_0x3343b5[_0x0ebb('0x2d')]=_['intersection'](_0x3343b5[_0x0ebb('0x2e')],_0x3343b5[_0x0ebb('0x2c')]);_0x58a18f[_0x0ebb('0x2f')]=_[_0x0ebb('0x30')](_0x3343b5[_0x0ebb('0x2e')],qs[_0x0ebb('0x31')](_0x1d0836[_0x0ebb('0x2c')][_0x0ebb('0x31')]));_0x58a18f[_0x0ebb('0x2f')]=_0x58a18f[_0x0ebb('0x2f')]['length']?_0x58a18f[_0x0ebb('0x2f')]:_0x3343b5[_0x0ebb('0x2e')];_0x58a18f[_0x0ebb('0x50')]=qs[_0x0ebb('0x35')](_0x1d0836[_0x0ebb('0x2c')][_0x0ebb('0x35')]);_0x58a18f[_0x0ebb('0x36')]=qs['filters'](_[_0x0ebb('0x37')](_0x1d0836[_0x0ebb('0x2c')],_0x3343b5[_0x0ebb('0x2d')]));if(_0x1d0836[_0x0ebb('0x2c')][_0x0ebb('0x38')]){_0x58a18f[_0x0ebb('0x36')]=_['merge'](_0x58a18f[_0x0ebb('0x36')],{'$or':_[_0x0ebb('0x39')](_0x58a18f[_0x0ebb('0x2f')],function(_0x504e6e){var _0x97bd1a={};_0x97bd1a[_0x504e6e]={'$like':'%'+_0x1d0836[_0x0ebb('0x2c')][_0x0ebb('0x38')]+'%'};return _0x97bd1a;})});}_0x58a18f=_['merge']({},_0x58a18f,_0x1d0836[_0x0ebb('0x3b')]);return _0x205b1d[_0x0ebb('0x4e')](_0x58a18f);}})[_0x0ebb('0x21')](function(_0x41b39e){if(_0x41b39e){_0xd78a37=_0x41b39e['length'];if(!_0x1d0836[_0x0ebb('0x2c')][_0x0ebb('0x32')](_0x0ebb('0x33'))){_0x58a18f['limit']=qs[_0x0ebb('0x34')](_0x1d0836[_0x0ebb('0x2c')]['limit']);_0x58a18f['offset']=qs[_0x0ebb('0x1c')](_0x1d0836[_0x0ebb('0x2c')]['offset']);}return _0x205b1d[_0x0ebb('0x4e')](_0x58a18f);}})[_0x0ebb('0x21')](function(_0x3b0e12){if(_0x3b0e12){return _0x3b0e12?{'count':_0xd78a37,'rows':_0x3b0e12}:null;}})['then'](respondWithResult(_0x5d4ef5,null))[_0x0ebb('0x3e')](handleError(_0x5d4ef5,null));}; \ No newline at end of file +var _0xc569=['userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','addContacts','ids','omit','getContacts','findOne','CmContact','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','count','offset','limit','set','Content-Range','json','reject','save','update','then','destroy','get','Companies','UserProfileResource','error','stack','name','index','describe','model','keys','query','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','map','filter','options','CmCompany','includeAll','include','findAll','rows','catch','show','params','rawAttributes','length','find','create','role','user'];(function(_0x57ca30,_0x3b0089){var _0x279df2=function(_0x223ff3){while(--_0x223ff3){_0x57ca30['push'](_0x57ca30['shift']());}};_0x279df2(++_0x3b0089);}(_0xc569,0x159));var _0x9c56=function(_0x590a84,_0x33e2fa){_0x590a84=_0x590a84-0x0;var _0x57e939=_0xc569[_0x590a84];return _0x57e939;};'use strict';var pdf=require(_0x9c56('0x0'));var emlformat=require(_0x9c56('0x1'));var rimraf=require(_0x9c56('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9c56('0x3'));var rp=require(_0x9c56('0x4'));var moment=require('moment');var BPromise=require(_0x9c56('0x5'));var Mustache=require(_0x9c56('0x6'));var util=require(_0x9c56('0x7'));var path=require('path');var sox=require(_0x9c56('0x8'));var csv=require(_0x9c56('0x9'));var ejs=require(_0x9c56('0xa'));var fs=require('fs');var _=require(_0x9c56('0xb'));var squel=require('squel');var crypto=require(_0x9c56('0xc'));var jsforce=require(_0x9c56('0xd'));var deskjs=require(_0x9c56('0xe'));var toCsv=require(_0x9c56('0x9'));var querystring=require(_0x9c56('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x9c56('0x10'));var as=require(_0x9c56('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9c56('0x12'))('api');var utils=require(_0x9c56('0x13'));var config=require(_0x9c56('0x14'));var db=require(_0x9c56('0x15'))['db'];function respondWithStatusCode(_0x45cdf3,_0x43b2a9){_0x43b2a9=_0x43b2a9||0xcc;return function(_0x137123){if(_0x137123){return _0x45cdf3[_0x9c56('0x16')](_0x43b2a9);}return _0x45cdf3['status'](_0x43b2a9)[_0x9c56('0x17')]();};}function respondWithResult(_0x5088d3,_0x44c0bd){_0x44c0bd=_0x44c0bd||0xc8;return function(_0xbeb12d){if(_0xbeb12d){return _0x5088d3[_0x9c56('0x18')](_0x44c0bd)['json'](_0xbeb12d);}};}function respondWithFilteredResult(_0x6605e3,_0x5217c3){return function(_0x37d40a){if(_0x37d40a){var _0x1f16ce=_0x37d40a[_0x9c56('0x19')],_0x14ace0=_0x5217c3[_0x9c56('0x1a')],_0x2ca2d2=_0x5217c3[_0x9c56('0x1a')]+_0x5217c3[_0x9c56('0x1b')],_0x131f30;if(_0x2ca2d2>=_0x1f16ce){_0x2ca2d2=_0x1f16ce;_0x131f30=0xc8;}else{_0x131f30=0xce;}_0x6605e3[_0x9c56('0x18')](_0x131f30);return _0x6605e3[_0x9c56('0x1c')](_0x9c56('0x1d'),_0x14ace0+'-'+_0x2ca2d2+'/'+_0x1f16ce)[_0x9c56('0x1e')](_0x37d40a);}return null;};}function patchUpdates(_0x8ef95e){return function(_0x2ac778){try{jsonpatch['apply'](_0x2ac778,_0x8ef95e,!![]);}catch(_0x22bd7f){return BPromise[_0x9c56('0x1f')](_0x22bd7f);}return _0x2ac778[_0x9c56('0x20')]();};}function saveUpdates(_0x56bf0a,_0xf074f9){return function(_0x1f55b6){if(_0x1f55b6){return _0x1f55b6[_0x9c56('0x21')](_0x56bf0a)[_0x9c56('0x22')](function(_0x25602b){return _0x25602b;});}return null;};}function removeEntity(_0x1a985e,_0x27066c){return function(_0xf4e706){if(_0xf4e706){return _0xf4e706[_0x9c56('0x23')]()['then'](function(){var _0x114a62=_0xf4e706[_0x9c56('0x24')]({'plain':!![]});var _0x573983=_0x9c56('0x25');return db[_0x9c56('0x26')][_0x9c56('0x23')]({'where':{'type':_0x573983,'resourceId':_0x114a62['id']}})[_0x9c56('0x22')](function(){return _0xf4e706;});})[_0x9c56('0x22')](function(){_0x1a985e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xf55d6c,_0x1e03ff){return function(_0x5c9b5f){if(!_0x5c9b5f){_0xf55d6c[_0x9c56('0x16')](0x194);}return _0x5c9b5f;};}function handleError(_0x5e3d83,_0x4e53d8){_0x4e53d8=_0x4e53d8||0x1f4;return function(_0x1a0d08){logger[_0x9c56('0x27')](_0x1a0d08[_0x9c56('0x28')]);if(_0x1a0d08[_0x9c56('0x29')]){delete _0x1a0d08[_0x9c56('0x29')];}_0x5e3d83[_0x9c56('0x18')](_0x4e53d8)['send'](_0x1a0d08);};}exports[_0x9c56('0x2a')]=function(_0x21de8e,_0x59529f){var _0x4f88fa={},_0x47c7be={},_0x708c75={'count':0x0,'rows':[]};return db['CmCompany'][_0x9c56('0x2b')]()[_0x9c56('0x22')](function(_0x7bcf70){_0x47c7be[_0x9c56('0x2c')]=_[_0x9c56('0x2d')](_0x7bcf70);_0x47c7be[_0x9c56('0x2e')]=_['keys'](_0x21de8e[_0x9c56('0x2e')]);_0x47c7be['filters']=_['intersection'](_0x47c7be[_0x9c56('0x2c')],_0x47c7be[_0x9c56('0x2e')]);_0x4f88fa[_0x9c56('0x2f')]=_[_0x9c56('0x30')](_0x47c7be[_0x9c56('0x2c')],qs[_0x9c56('0x31')](_0x21de8e[_0x9c56('0x2e')][_0x9c56('0x31')]));_0x4f88fa[_0x9c56('0x2f')]=_0x4f88fa[_0x9c56('0x2f')]['length']?_0x4f88fa[_0x9c56('0x2f')]:_0x47c7be[_0x9c56('0x2c')];if(!_0x21de8e['query'][_0x9c56('0x32')](_0x9c56('0x33'))){_0x4f88fa[_0x9c56('0x1b')]=qs[_0x9c56('0x1b')](_0x21de8e[_0x9c56('0x2e')]['limit']);_0x4f88fa[_0x9c56('0x1a')]=qs[_0x9c56('0x1a')](_0x21de8e['query']['offset']);}_0x4f88fa[_0x9c56('0x34')]=qs[_0x9c56('0x35')](_0x21de8e[_0x9c56('0x2e')]['sort']);_0x4f88fa[_0x9c56('0x36')]=qs[_0x9c56('0x37')](_[_0x9c56('0x38')](_0x21de8e[_0x9c56('0x2e')],_0x47c7be['filters']));if(_0x21de8e[_0x9c56('0x2e')]['filter']){_0x4f88fa['where']=_[_0x9c56('0x39')](_0x4f88fa[_0x9c56('0x36')],{'$or':_[_0x9c56('0x3a')](_0x4f88fa[_0x9c56('0x2f')],function(_0x76b71b){var _0x2dd72a={};_0x2dd72a[_0x76b71b]={'$like':'%'+_0x21de8e[_0x9c56('0x2e')][_0x9c56('0x3b')]+'%'};return _0x2dd72a;})});}_0x4f88fa=_[_0x9c56('0x39')]({},_0x4f88fa,_0x21de8e[_0x9c56('0x3c')]);var _0x542805={'where':_0x4f88fa['where']};return db[_0x9c56('0x3d')][_0x9c56('0x19')](_0x542805)['then'](function(_0x212227){_0x708c75[_0x9c56('0x19')]=_0x212227;if(_0x21de8e[_0x9c56('0x2e')][_0x9c56('0x3e')]){_0x4f88fa[_0x9c56('0x3f')]=[{'all':!![]}];}return db[_0x9c56('0x3d')][_0x9c56('0x40')](_0x4f88fa);})[_0x9c56('0x22')](function(_0x2d7603){_0x708c75[_0x9c56('0x41')]=_0x2d7603;return _0x708c75;})[_0x9c56('0x22')](respondWithFilteredResult(_0x59529f,_0x4f88fa))[_0x9c56('0x42')](handleError(_0x59529f,null));})[_0x9c56('0x42')](handleError(_0x59529f,null));};exports[_0x9c56('0x43')]=function(_0x10c659,_0x794f0a){var _0x2ffd8a={'raw':![],'where':{'id':_0x10c659[_0x9c56('0x44')]['id']}},_0x1a17a3={};_0x1a17a3[_0x9c56('0x2c')]=_[_0x9c56('0x2d')](db[_0x9c56('0x3d')][_0x9c56('0x45')]);_0x1a17a3[_0x9c56('0x2e')]=_['keys'](_0x10c659['query']);_0x1a17a3[_0x9c56('0x37')]=_[_0x9c56('0x30')](_0x1a17a3[_0x9c56('0x2c')],_0x1a17a3[_0x9c56('0x2e')]);_0x2ffd8a[_0x9c56('0x2f')]=_[_0x9c56('0x30')](_0x1a17a3[_0x9c56('0x2c')],qs[_0x9c56('0x31')](_0x10c659['query'][_0x9c56('0x31')]));_0x2ffd8a[_0x9c56('0x2f')]=_0x2ffd8a[_0x9c56('0x2f')][_0x9c56('0x46')]?_0x2ffd8a['attributes']:_0x1a17a3['model'];if(_0x10c659[_0x9c56('0x2e')][_0x9c56('0x3e')]){_0x2ffd8a[_0x9c56('0x3f')]=[{'all':!![]}];}_0x2ffd8a=_[_0x9c56('0x39')]({},_0x2ffd8a,_0x10c659[_0x9c56('0x3c')]);return db[_0x9c56('0x3d')][_0x9c56('0x47')](_0x2ffd8a)[_0x9c56('0x22')](handleEntityNotFound(_0x794f0a,null))[_0x9c56('0x22')](respondWithResult(_0x794f0a,null))['catch'](handleError(_0x794f0a,null));};exports[_0x9c56('0x48')]=function(_0xa6d53d,_0x4f78e0){return db[_0x9c56('0x3d')][_0x9c56('0x48')](_0xa6d53d['body'],{})[_0x9c56('0x22')](function(_0x2fbbf6){var _0x489eaa=_0xa6d53d['user']['get']({'plain':!![]});if(!_0x489eaa)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x489eaa[_0x9c56('0x49')]===_0x9c56('0x4a')){var _0x1d01b5=_0x2fbbf6[_0x9c56('0x24')]({'plain':!![]});var _0x5de5a5=_0x9c56('0x25');return db['UserProfileSection']['find']({'where':{'name':_0x5de5a5,'userProfileId':_0x489eaa[_0x9c56('0x4b')]},'raw':!![]})[_0x9c56('0x22')](function(_0x506975){if(_0x506975&&_0x506975['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x1d01b5[_0x9c56('0x29')],'resourceId':_0x1d01b5['id'],'type':_0x506975[_0x9c56('0x29')],'sectionId':_0x506975['id']},{})[_0x9c56('0x22')](function(){return _0x2fbbf6;});}else{return _0x2fbbf6;}})['catch'](function(_0x54e97f){logger[_0x9c56('0x27')](_0x9c56('0x4c'),_0x54e97f);throw _0x54e97f;});}return _0x2fbbf6;})[_0x9c56('0x22')](respondWithResult(_0x4f78e0,0xc9))['catch'](handleError(_0x4f78e0,null));};exports[_0x9c56('0x21')]=function(_0x5750b6,_0x35b067){if(_0x5750b6[_0x9c56('0x4d')]['id']){delete _0x5750b6[_0x9c56('0x4d')]['id'];}return db['CmCompany']['find']({'where':{'id':_0x5750b6[_0x9c56('0x44')]['id']}})[_0x9c56('0x22')](handleEntityNotFound(_0x35b067,null))['then'](saveUpdates(_0x5750b6[_0x9c56('0x4d')],null))[_0x9c56('0x22')](respondWithResult(_0x35b067,null))[_0x9c56('0x42')](handleError(_0x35b067,null));};exports[_0x9c56('0x23')]=function(_0x2a55c7,_0x116a1d){return db['CmCompany'][_0x9c56('0x47')]({'where':{'id':_0x2a55c7[_0x9c56('0x44')]['id']}})[_0x9c56('0x22')](handleEntityNotFound(_0x116a1d,null))[_0x9c56('0x22')](removeEntity(_0x116a1d,null))[_0x9c56('0x42')](handleError(_0x116a1d,null));};exports['describe']=function(_0x3e36db,_0x2c757e){return db['CmCompany'][_0x9c56('0x2b')]()[_0x9c56('0x22')](respondWithResult(_0x2c757e,null))[_0x9c56('0x42')](handleError(_0x2c757e,null));};exports[_0x9c56('0x4e')]=function(_0x35a5f0,_0x5e5a26,_0x14b3c6){return db['CmContact'][_0x9c56('0x47')]({'where':{'id':_0x35a5f0[_0x9c56('0x44')]['id']}})['then'](handleEntityNotFound(_0x5e5a26,null))[_0x9c56('0x22')](function(_0x4e6520){if(_0x4e6520){return _0x4e6520[_0x9c56('0x4e')](_0x35a5f0[_0x9c56('0x4d')][_0x9c56('0x4f')],_[_0x9c56('0x50')](_0x35a5f0[_0x9c56('0x4d')],[_0x9c56('0x4f'),'id'])||{});}})[_0x9c56('0x22')](respondWithResult(_0x5e5a26,null))[_0x9c56('0x42')](handleError(_0x5e5a26,null));};exports[_0x9c56('0x51')]=function(_0x14110d,_0x38ffb6,_0x452bf7){var _0x28f588={};var _0x183622={};var _0x2e85c4;var _0x5e6196;return db[_0x9c56('0x3d')][_0x9c56('0x52')]({'where':{'id':_0x14110d[_0x9c56('0x44')]['id']}})['then'](handleEntityNotFound(_0x38ffb6,null))[_0x9c56('0x22')](function(_0x5f3cc8){if(_0x5f3cc8){_0x2e85c4=_0x5f3cc8;_0x183622[_0x9c56('0x2c')]=_['keys'](db[_0x9c56('0x53')]['rawAttributes']);_0x183622['query']=_['keys'](_0x14110d[_0x9c56('0x2e')]);_0x183622[_0x9c56('0x37')]=_['intersection'](_0x183622[_0x9c56('0x2c')],_0x183622[_0x9c56('0x2e')]);_0x28f588[_0x9c56('0x2f')]=_[_0x9c56('0x30')](_0x183622[_0x9c56('0x2c')],qs[_0x9c56('0x31')](_0x14110d[_0x9c56('0x2e')][_0x9c56('0x31')]));_0x28f588[_0x9c56('0x2f')]=_0x28f588[_0x9c56('0x2f')]['length']?_0x28f588[_0x9c56('0x2f')]:_0x183622[_0x9c56('0x2c')];_0x28f588['order']=qs[_0x9c56('0x35')](_0x14110d[_0x9c56('0x2e')][_0x9c56('0x35')]);_0x28f588['where']=qs[_0x9c56('0x37')](_['pick'](_0x14110d[_0x9c56('0x2e')],_0x183622[_0x9c56('0x37')]));if(_0x14110d[_0x9c56('0x2e')][_0x9c56('0x3b')]){_0x28f588[_0x9c56('0x36')]=_[_0x9c56('0x39')](_0x28f588['where'],{'$or':_[_0x9c56('0x3a')](_0x28f588[_0x9c56('0x2f')],function(_0x414cee){var _0x38ca64={};_0x38ca64[_0x414cee]={'$like':'%'+_0x14110d['query'][_0x9c56('0x3b')]+'%'};return _0x38ca64;})});}_0x28f588=_[_0x9c56('0x39')]({},_0x28f588,_0x14110d[_0x9c56('0x3c')]);return _0x2e85c4[_0x9c56('0x51')](_0x28f588);}})[_0x9c56('0x22')](function(_0x1655d1){if(_0x1655d1){_0x5e6196=_0x1655d1[_0x9c56('0x46')];if(!_0x14110d[_0x9c56('0x2e')][_0x9c56('0x32')](_0x9c56('0x33'))){_0x28f588[_0x9c56('0x1b')]=qs['limit'](_0x14110d[_0x9c56('0x2e')]['limit']);_0x28f588[_0x9c56('0x1a')]=qs[_0x9c56('0x1a')](_0x14110d[_0x9c56('0x2e')][_0x9c56('0x1a')]);}return _0x2e85c4['getContacts'](_0x28f588);}})[_0x9c56('0x22')](function(_0x35735a){if(_0x35735a){return _0x35735a?{'count':_0x5e6196,'rows':_0x35735a}:null;}})[_0x9c56('0x22')](respondWithResult(_0x38ffb6,null))[_0x9c56('0x42')](handleError(_0x38ffb6,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index ec68889..a9f9241 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 _0x0e17=['exports','define','CmCompany','cm_companies','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmCompany.attributes'];(function(_0x545a3a,_0x3123aa){var _0x5a5493=function(_0x4e6bce){while(--_0x4e6bce){_0x545a3a['push'](_0x545a3a['shift']());}};_0x5a5493(++_0x3123aa);}(_0x0e17,0xd6));var _0x70e1=function(_0x4fc5bd,_0x13cbdb){_0x4fc5bd=_0x4fc5bd-0x0;var _0x5f35d7=_0x0e17[_0x4fc5bd];return _0x5f35d7;};'use strict';var _=require(_0x70e1('0x0'));var util=require(_0x70e1('0x1'));var logger=require(_0x70e1('0x2'))(_0x70e1('0x3'));var moment=require(_0x70e1('0x4'));var BPromise=require(_0x70e1('0x5'));var rp=require(_0x70e1('0x6'));var fs=require('fs');var path=require(_0x70e1('0x7'));var rimraf=require(_0x70e1('0x8'));var config=require(_0x70e1('0x9'));var attributes=require(_0x70e1('0xa'));module[_0x70e1('0xb')]=function(_0x4cb0b1,_0xc64213){return _0x4cb0b1[_0x70e1('0xc')](_0x70e1('0xd'),attributes,{'tableName':_0x70e1('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3bd7=['CmCompany','../../config/logger','api','moment','request-promise','path','rimraf','./cmCompany.attributes'];(function(_0x24618a,_0x2cd0f4){var _0x2e3d64=function(_0x28c59c){while(--_0x28c59c){_0x24618a['push'](_0x24618a['shift']());}};_0x2e3d64(++_0x2cd0f4);}(_0x3bd7,0x199));var _0x73bd=function(_0x56916d,_0x37b935){_0x56916d=_0x56916d-0x0;var _0x2b7f1f=_0x3bd7[_0x56916d];return _0x2b7f1f;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x73bd('0x0'))(_0x73bd('0x1'));var moment=require(_0x73bd('0x2'));var BPromise=require('bluebird');var rp=require(_0x73bd('0x3'));var fs=require('fs');var path=require(_0x73bd('0x4'));var rimraf=require(_0x73bd('0x5'));var config=require('../../config/environment');var attributes=require(_0x73bd('0x6'));module['exports']=function(_0xe20fe9,_0x1aa5e1){return _0xe20fe9['define'](_0x73bd('0x7'),attributes,{'tableName':'cm_companies','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 d04e235..6055d26 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 _0xb85a=['CmCompany,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','CmCompany,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x1f1c98,_0x132e98){var _0x5ee779=function(_0x38e5ce){while(--_0x38e5ce){_0x1f1c98['push'](_0x1f1c98['shift']());}};_0x5ee779(++_0x132e98);}(_0xb85a,0x1ea));var _0xab85=function(_0x1499ed,_0x31884c){_0x1499ed=_0x1499ed-0x0;var _0x821a34=_0xb85a[_0x1499ed];return _0x821a34;};'use strict';var _=require(_0xab85('0x0'));var util=require(_0xab85('0x1'));var moment=require(_0xab85('0x2'));var BPromise=require('bluebird');var rs=require(_0xab85('0x3'));var fs=require('fs');var Redis=require(_0xab85('0x4'));var db=require(_0xab85('0x5'))['db'];var utils=require(_0xab85('0x6'));var logger=require(_0xab85('0x7'))(_0xab85('0x8'));var config=require(_0xab85('0x9'));var jayson=require(_0xab85('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x10e0c3,_0x1fec07,_0x3a768b){return new BPromise(function(_0x9b717d,_0x2a876b){return client[_0xab85('0xb')](_0x10e0c3,_0x3a768b)[_0xab85('0xc')](function(_0x52d9ae){logger['info'](_0xab85('0xd'),_0x1fec07,_0xab85('0xe'));logger[_0xab85('0xf')](_0xab85('0x10'),_0x1fec07,_0xab85('0xe'),JSON['stringify'](_0x52d9ae));if(_0x52d9ae[_0xab85('0x11')]){if(_0x52d9ae[_0xab85('0x11')][_0xab85('0x12')]===0x1f4){logger[_0xab85('0x11')](_0xab85('0xd'),_0x1fec07,_0x52d9ae[_0xab85('0x11')][_0xab85('0x13')]);return _0x2a876b(_0x52d9ae[_0xab85('0x11')][_0xab85('0x13')]);}logger['error'](_0xab85('0xd'),_0x1fec07,_0x52d9ae[_0xab85('0x11')][_0xab85('0x13')]);return _0x9b717d(_0x52d9ae[_0xab85('0x11')][_0xab85('0x13')]);}else{logger[_0xab85('0x14')]('CmCompany,\x20%s,\x20%s',_0x1fec07,_0xab85('0xe'));_0x9b717d(_0x52d9ae['result']['message']);}})[_0xab85('0x15')](function(_0x1bff44){logger[_0xab85('0x11')](_0xab85('0xd'),_0x1fec07,_0x1bff44);_0x2a876b(_0x1bff44);});});} \ No newline at end of file +var _0x7790=['CmCompany,\x20%s,\x20%s','request\x20sent','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','bluebird','ioredis','../../config/environment','jayson/promise','client','request','then','info'];(function(_0x52d44f,_0x41c88d){var _0x3a830b=function(_0x401368){while(--_0x401368){_0x52d44f['push'](_0x52d44f['shift']());}};_0x3a830b(++_0x41c88d);}(_0x7790,0xe5));var _0x0779=function(_0x3f9600,_0x192c96){_0x3f9600=_0x3f9600-0x0;var _0x1d6724=_0x7790[_0x3f9600];return _0x1d6724;};'use strict';var _=require('lodash');var util=require(_0x0779('0x0'));var moment=require('moment');var BPromise=require(_0x0779('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0779('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x0779('0x3'));var jayson=require(_0x0779('0x4'));var client=jayson[_0x0779('0x5')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4b7718,_0x4c6f9c,_0x453e6d){return new BPromise(function(_0x4e9387,_0xcc7e4e){return client[_0x0779('0x6')](_0x4b7718,_0x453e6d)[_0x0779('0x7')](function(_0x365595){logger[_0x0779('0x8')](_0x0779('0x9'),_0x4c6f9c,_0x0779('0xa'));logger['debug'](_0x0779('0xb'),_0x4c6f9c,_0x0779('0xa'),JSON[_0x0779('0xc')](_0x365595));if(_0x365595['error']){if(_0x365595[_0x0779('0xd')][_0x0779('0xe')]===0x1f4){logger[_0x0779('0xd')](_0x0779('0x9'),_0x4c6f9c,_0x365595['error'][_0x0779('0xf')]);return _0xcc7e4e(_0x365595[_0x0779('0xd')]['message']);}logger[_0x0779('0xd')](_0x0779('0x9'),_0x4c6f9c,_0x365595['error']['message']);return _0x4e9387(_0x365595[_0x0779('0xd')][_0x0779('0xf')]);}else{logger[_0x0779('0x8')](_0x0779('0x9'),_0x4c6f9c,'request\x20sent');_0x4e9387(_0x365595['result'][_0x0779('0xf')]);}})[_0x0779('0x10')](function(_0x940960){logger[_0x0779('0xd')](_0x0779('0x9'),_0x4c6f9c,_0x940960);_0xcc7e4e(_0x940960);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 42532e1..bda06e5 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 _0xd046=['create','post','/:id/contacts','put','update','delete','destroy','exports','util','path','connect-timeout','Router','../../config/environment','get','/describe','/:id','isAuthenticated'];(function(_0xb74b87,_0x5b85cc){var _0x18d5de=function(_0x4939b1){while(--_0x4939b1){_0xb74b87['push'](_0xb74b87['shift']());}};_0x18d5de(++_0x5b85cc);}(_0xd046,0x129));var _0x6d04=function(_0x3f7a40,_0x100323){_0x3f7a40=_0x3f7a40-0x0;var _0x3b491d=_0xd046[_0x3f7a40];return _0x3b491d;};'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('./cmCompany.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('0x5')]('/:id/contacts',auth[_0x6d04('0x8')](),controller['getContacts']);router['post']('/',auth['isAuthenticated'](),controller[_0x6d04('0x9')]);router[_0x6d04('0xa')](_0x6d04('0xb'),auth[_0x6d04('0x8')](),controller['addContacts']);router[_0x6d04('0xc')](_0x6d04('0x7'),auth[_0x6d04('0x8')](),controller[_0x6d04('0xd')]);router[_0x6d04('0xe')](_0x6d04('0x7'),auth[_0x6d04('0x8')](),controller[_0x6d04('0xf')]);module[_0x6d04('0x10')]=router; \ No newline at end of file +var _0x4e2e=['get','isAuthenticated','/describe','describe','/:id','show','/:id/contacts','getContacts','create','post','put','update','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./cmCompany.controller'];(function(_0x23e7c1,_0x35110c){var _0x1add43=function(_0x238918){while(--_0x238918){_0x23e7c1['push'](_0x23e7c1['shift']());}};_0x1add43(++_0x35110c);}(_0x4e2e,0x1f2));var _0xe4e2=function(_0x25604f,_0xe119c){_0x25604f=_0x25604f-0x0;var _0x55f48a=_0x4e2e[_0x25604f];return _0x55f48a;};'use strict';var multer=require('multer');var util=require(_0xe4e2('0x0'));var path=require(_0xe4e2('0x1'));var timeout=require(_0xe4e2('0x2'));var express=require(_0xe4e2('0x3'));var router=express[_0xe4e2('0x4')]();var auth=require(_0xe4e2('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xe4e2('0x6'));var controller=require(_0xe4e2('0x7'));router[_0xe4e2('0x8')]('/',auth[_0xe4e2('0x9')](),controller['index']);router[_0xe4e2('0x8')](_0xe4e2('0xa'),auth[_0xe4e2('0x9')](),controller[_0xe4e2('0xb')]);router[_0xe4e2('0x8')](_0xe4e2('0xc'),auth[_0xe4e2('0x9')](),controller[_0xe4e2('0xd')]);router['get'](_0xe4e2('0xe'),auth[_0xe4e2('0x9')](),controller[_0xe4e2('0xf')]);router['post']('/',auth[_0xe4e2('0x9')](),controller[_0xe4e2('0x10')]);router[_0xe4e2('0x11')](_0xe4e2('0xe'),auth[_0xe4e2('0x9')](),controller['addContacts']);router[_0xe4e2('0x12')](_0xe4e2('0xc'),auth[_0xe4e2('0x9')](),controller[_0xe4e2('0x13')]);router['delete'](_0xe4e2('0xc'),auth[_0xe4e2('0x9')](),controller[_0xe4e2('0x14')]);module[_0xe4e2('0x15')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index 0fd5fb8..d0c6851 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 _0x12b6=['exports','STRING','TEXT','INTEGER','UNSIGNED','DATE','NOW','lodash','sequelize'];(function(_0x188d31,_0x576e87){var _0x30ed33=function(_0x15f9a5){while(--_0x15f9a5){_0x188d31['push'](_0x188d31['shift']());}};_0x30ed33(++_0x576e87);}(_0x12b6,0x1e4));var _0x612b=function(_0x3bc6ae,_0x1c6c91){_0x3bc6ae=_0x3bc6ae-0x0;var _0x48ffd8=_0x12b6[_0x3bc6ae];return _0x48ffd8;};'use strict';var _=require(_0x612b('0x0'));var Sequelize=require(_0x612b('0x1'));module[_0x612b('0x2')]={'firstName':{'type':Sequelize[_0x612b('0x3')],'allowNull':![]},'lastName':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0x612b('0x3')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x612b('0x3')]},'country':{'type':Sequelize[_0x612b('0x3')]},'dateOfBirth':{'type':Sequelize[_0x612b('0x3')]},'description':{'type':Sequelize[_0x612b('0x4')]},'phone':{'type':Sequelize[_0x612b('0x3')]},'mobile':{'type':Sequelize[_0x612b('0x3')]},'fax':{'type':Sequelize[_0x612b('0x3')]},'email':{'type':Sequelize['STRING']},'url':{'type':Sequelize[_0x612b('0x3')]},'facebook':{'type':Sequelize[_0x612b('0x3')]},'fb_data':{'type':Sequelize[_0x612b('0x3')]},'twitter':{'type':Sequelize[_0x612b('0x3')]},'skype':{'type':Sequelize[_0x612b('0x3')]},'teams':{'type':Sequelize[_0x612b('0x3')]},'viber':{'type':Sequelize[_0x612b('0x3')]},'line':{'type':Sequelize['STRING']},'wechat':{'type':Sequelize[_0x612b('0x3')]},'telegram':{'type':Sequelize[_0x612b('0x3')]},'UserId':{'type':Sequelize[_0x612b('0x5')]},'priority':{'type':Sequelize[_0x612b('0x5')](0x2)[_0x612b('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x612b('0x7')],'defaultValue':Sequelize[_0x612b('0x8')]}}; \ No newline at end of file +var _0x6f34=['exports','STRING','INTEGER','UNSIGNED','sequelize'];(function(_0x4c493c,_0xf6044c){var _0x3584f6=function(_0x5a10b3){while(--_0x5a10b3){_0x4c493c['push'](_0x4c493c['shift']());}};_0x3584f6(++_0xf6044c);}(_0x6f34,0x199));var _0x46f3=function(_0x419129,_0x51bc88){_0x419129=_0x419129-0x0;var _0x50eec0=_0x6f34[_0x419129];return _0x50eec0;};'use strict';var _=require('lodash');var Sequelize=require(_0x46f3('0x0'));module[_0x46f3('0x1')]={'firstName':{'type':Sequelize['STRING'],'allowNull':![]},'lastName':{'type':Sequelize[_0x46f3('0x2')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0x46f3('0x2')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x46f3('0x2')]},'dateOfBirth':{'type':Sequelize[_0x46f3('0x2')]},'description':{'type':Sequelize['TEXT']},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0x46f3('0x2')]},'fax':{'type':Sequelize[_0x46f3('0x2')]},'email':{'type':Sequelize[_0x46f3('0x2')]},'url':{'type':Sequelize[_0x46f3('0x2')]},'facebook':{'type':Sequelize[_0x46f3('0x2')]},'fb_data':{'type':Sequelize[_0x46f3('0x2')]},'twitter':{'type':Sequelize[_0x46f3('0x2')]},'skype':{'type':Sequelize[_0x46f3('0x2')]},'teams':{'type':Sequelize[_0x46f3('0x2')]},'viber':{'type':Sequelize[_0x46f3('0x2')]},'line':{'type':Sequelize[_0x46f3('0x2')]},'wechat':{'type':Sequelize[_0x46f3('0x2')]},'telegram':{'type':Sequelize['STRING']},'UserId':{'type':Sequelize['INTEGER']},'priority':{'type':Sequelize[_0x46f3('0x3')](0x2)[_0x46f3('0x4')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index f84a2dd..2bcfaf3 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 _0xc5af=['CompanyId','socket_timestamp','File\x20uploaded\x20correctly!','send','upload','createReadStream','file','meta','import','agent','binding','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','../../components/import/cm/csv2','stringify','message','start\x20child\x20process\x20correctly!','pid','exit','error\x20child\x20process','eml-format','rimraf','request-promise','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','defaults','redis','localhost','socket.io-emitter','./cmContact.socket','register','sendStatus','status','end','json','count','offset','Content-Range','reject','save','update','then','destroy','error','stack','name','index','CmContact','describe','keys','startsWith','cf_','push','trimStart','all','length','type','model','query','filters','intersection','attributes','nolimit','limit','sort','where','select','field','color','from','tools_tags','cm_contacts','cm_user_has_contacts','uc.CmContactId\x20=\x20c.id','left_join','ct.CmContactId\x20=\x20c.id','c.deletedAt\x20IS\x20NULL','expr','search','sqlOperator','find','Tag','value','split','map','forEach','union','User','and','dateOfBirth','datetime','castTo','buildExpression','text','start','isNil','Contact','isEmpty','ListId','concat','\x20=\x20?','isArray','tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','\x27\x27\x27\x27','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','isNumeric','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.lastName\x20LIKE\x20?','c.email\x20LIKE\x20?','c.id','Sequelize','QueryTypes','SELECT','clone','order','DESC','having','t.id\x20IN\x20?','some','user','getLists','c.ListId\x20IN\x20?','sequelize','toString','merge','c.firstName','c.lastName','c.mobile','c.fax','c.ListId','c.deletedAt','GROUP_CONCAT(DISTINCT\x20t.id)','Tags','TagIds','catch','params','tags','columnName','displayName','alias','custom','values','body','findAll','get','mergeWith','join','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','ChatMessage','ChatOfflineMessage','MailMessage','MailInteraction','SmsInteraction','SmsMessage','FaxInteraction','OpenchannelInteraction','OpenchannelMessage','CmHopperFinal','ReportAgentPreview','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','bulkCreate','each','duplicates','$or','show','CmCustomField','omit','format','pickBy','table','setFields','toParam','phone','findOne','rawAttributes','fields','pick','getTags','hasOwnProperty','setTags','ids','getHoppers','ContactId','options','include','getHopperHistories','CmHopperHistory','includeAll','rows','JscriptySessionReport','uploadCsv','No\x20ListId\x20specified','No\x20association\x20keys\x20specified!','binding_values','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','0777','child_process','fork','../../components/import/cm/csv'];(function(_0x234491,_0x303898){var _0x4cac47=function(_0x56e048){while(--_0x56e048){_0x234491['push'](_0x234491['shift']());}};_0x4cac47(++_0x303898);}(_0xc5af,0x1e3));var _0xfc5a=function(_0x450e05,_0x298fe4){_0x450e05=_0x450e05-0x0;var _0x5d56f1=_0xc5af[_0x450e05];return _0x5d56f1;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xfc5a('0x0'));var rimraf=require(_0xfc5a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xfc5a('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xfc5a('0x3'));var util=require(_0xfc5a('0x4'));var path=require(_0xfc5a('0x5'));var sox=require('sox');var csv=require(_0xfc5a('0x6'));var ejs=require(_0xfc5a('0x7'));var fs=require('fs');var _=require(_0xfc5a('0x8'));var squel=require(_0xfc5a('0x9'));var crypto=require('crypto');var jsforce=require(_0xfc5a('0xa'));var deskjs=require(_0xfc5a('0xb'));var toCsv=require('to-csv');var querystring=require(_0xfc5a('0xc'));var Papa=require('papaparse');var Redis=require(_0xfc5a('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xfc5a('0xe'));var as=require(_0xfc5a('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfc5a('0x10'))(_0xfc5a('0x11'));var utils=require('../../config/utils');var config=require(_0xfc5a('0x12'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xfc5a('0x13')](config[_0xfc5a('0x14')],{'host':_0xfc5a('0x15'),'port':0x18eb});var socket=require(_0xfc5a('0x16'))(new Redis(config[_0xfc5a('0x14')]));require(_0xfc5a('0x17'))[_0xfc5a('0x18')](socket);function respondWithStatusCode(_0xa02e6a,_0x7fad11){_0x7fad11=_0x7fad11||0xcc;return function(_0x1fe527){if(_0x1fe527){return _0xa02e6a[_0xfc5a('0x19')](_0x7fad11);}return _0xa02e6a[_0xfc5a('0x1a')](_0x7fad11)[_0xfc5a('0x1b')]();};}function respondWithResult(_0x391ae1,_0x1ce5cc){_0x1ce5cc=_0x1ce5cc||0xc8;return function(_0xbece68){if(_0xbece68){return _0x391ae1[_0xfc5a('0x1a')](_0x1ce5cc)[_0xfc5a('0x1c')](_0xbece68);}};}function respondWithFilteredResult(_0x192b5c,_0x58fdeb){return function(_0x22630a){if(_0x22630a){var _0x4a64b5=_0x22630a[_0xfc5a('0x1d')],_0x35a851=_0x58fdeb[_0xfc5a('0x1e')],_0x452a81=_0x58fdeb[_0xfc5a('0x1e')]+_0x58fdeb['limit'],_0x373bf0;if(_0x452a81>=_0x4a64b5){_0x452a81=_0x4a64b5;_0x373bf0=0xc8;}else{_0x373bf0=0xce;}_0x192b5c[_0xfc5a('0x1a')](_0x373bf0);return _0x192b5c['set'](_0xfc5a('0x1f'),_0x35a851+'-'+_0x452a81+'/'+_0x4a64b5)[_0xfc5a('0x1c')](_0x22630a);}return null;};}function patchUpdates(_0x45580f){return function(_0x2e0ee1){try{jsonpatch['apply'](_0x2e0ee1,_0x45580f,!![]);}catch(_0x45c56b){return BPromise[_0xfc5a('0x20')](_0x45c56b);}return _0x2e0ee1[_0xfc5a('0x21')]();};}function saveUpdates(_0x1ff072,_0x37f554){return function(_0xd6fe8){if(_0xd6fe8){return _0xd6fe8[_0xfc5a('0x22')](_0x1ff072)[_0xfc5a('0x23')](function(_0x5e1be1){return _0x5e1be1;});}return null;};}function removeEntity(_0x1daecd,_0xd0a50a){return function(_0x2a5d0e){if(_0x2a5d0e){return _0x2a5d0e[_0xfc5a('0x24')]()[_0xfc5a('0x23')](function(){_0x1daecd['status'](0xcc)[_0xfc5a('0x1b')]();});}};}function handleEntityNotFound(_0x5a7828,_0x466aff){return function(_0x16b3e4){if(!_0x16b3e4){_0x5a7828['sendStatus'](0x194);}return _0x16b3e4;};}function handleError(_0x337ebc,_0x149945){_0x149945=_0x149945||0x1f4;return function(_0x5ebd21){logger[_0xfc5a('0x25')](_0x5ebd21[_0xfc5a('0x26')]);if(_0x5ebd21[_0xfc5a('0x27')]){delete _0x5ebd21[_0xfc5a('0x27')];}_0x337ebc[_0xfc5a('0x1a')](_0x149945)['send'](_0x5ebd21);};}exports[_0xfc5a('0x28')]=function(_0x137c8d,_0x5ef287){var _0x193678={},_0x3f59c2={},_0x1f633a={'count':0x0,'rows':[]};return db[_0xfc5a('0x29')][_0xfc5a('0x2a')]()[_0xfc5a('0x23')](function(_0x4089d0){var _0x1222f6=[];for(var _0x398138=0x0;_0x3981380x1){_0x23784a['or'](_0xfc5a('0x65'),qs[_0xfc5a('0x66')](_0x11e733),null);}else{if(qs[_0xfc5a('0x67')](_0x11e733)){_0x23784a['or'](_0xfc5a('0x68'),_0x11e733+'%');_0x23784a['or'](_0xfc5a('0x69'),_0x11e733+'%');_0x23784a['or'](_0xfc5a('0x6a'),_0x11e733+'%');_0x23784a['or'](_0xfc5a('0x6b'),_0x11e733+'%');}else if(qs[_0xfc5a('0x6c')](_0x11e733)){_0x23784a['or']('c.email\x20LIKE\x20?',_0x11e733+'%');}else{_0x23784a['or']('c.firstName\x20LIKE\x20?','%'+_0x11e733+'%');_0x23784a['or'](_0xfc5a('0x6d'),'%'+_0x11e733+'%');_0x23784a['or'](_0xfc5a('0x6e'),'%'+_0x11e733+'%');}}}}_0x1da7e7['where'](_0x23784a);_0x1da7e7['group'](_0xfc5a('0x6f'));var _0x568944={'type':db[_0xfc5a('0x70')][_0xfc5a('0x71')][_0xfc5a('0x72')],'raw':!![]};var _0x9cfdcd=_0x1da7e7[_0xfc5a('0x73')]()['field'](_0xfc5a('0x6f'));if(_0x193678['order']){_0x193678[_0xfc5a('0x74')][_0xfc5a('0x4f')](function(_0x44d108){_0x1da7e7[_0xfc5a('0x74')]('c.'+_0x44d108[0x0],_0x44d108[0x1]===_0xfc5a('0x75')?![]:!![]);});}if(!_[_0xfc5a('0x5b')](_0x2b2ada)){_0x1da7e7[_0xfc5a('0x76')](_0x300ba0);_0x9cfdcd[_0xfc5a('0x3b')](_0xfc5a('0x77'),_0x2b2ada);}BPromise['resolve']()[_0xfc5a('0x23')](function(){if(_0x869cf5&&!_[_0xfc5a('0x78')](_0x869cf5['conditions'],[_0xfc5a('0x3d'),_0xfc5a('0x51')])){return _0x137c8d[_0xfc5a('0x79')][_0xfc5a('0x7a')]({'attributes':['id'],'raw':!![]})[_0xfc5a('0x23')](function(_0x40d43d){if(_['isEmpty'](_0x40d43d)){_0x9cfdcd['where']('c.ListId\x20IS\x20NULL');_0x1da7e7['where']('c.ListId\x20IS\x20NULL');}else{_0x9cfdcd[_0xfc5a('0x3b')]('c.ListId\x20IN\x20?',_[_0xfc5a('0x4e')](_0x40d43d,'id'));_0x1da7e7[_0xfc5a('0x3b')](_0xfc5a('0x7b'),_[_0xfc5a('0x4e')](_0x40d43d,'id'));}});}else{return;}})[_0xfc5a('0x23')](function(){db[_0xfc5a('0x7c')][_0xfc5a('0x34')](_0x9cfdcd['toString'](),_0x568944)['then'](function(_0x7b1f74){_0x1f633a[_0xfc5a('0x1d')]=_0x7b1f74[_0xfc5a('0x31')];if(_0x1f633a[_0xfc5a('0x1d')]===0x0)return[];return db[_0xfc5a('0x7c')][_0xfc5a('0x34')](_0x1c3e13[_0xfc5a('0x7d')](),_0x568944);})[_0xfc5a('0x23')](function(_0x143abd){_0x26fe7c=_['keyBy'](_0x143abd,'id');_0x568944=_[_0xfc5a('0x7e')](_0x568944,{'model':db['CmContact'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x137c8d[_0xfc5a('0x34')]['fields']){_0x193678[_0xfc5a('0x37')][_0xfc5a('0x4f')](function(_0xb89c54){_0x1da7e7[_0xfc5a('0x3d')]('c.'+_0xb89c54);});}else{_0x1da7e7[_0xfc5a('0x3d')](_0xfc5a('0x6f'));_0x1da7e7[_0xfc5a('0x3d')](_0xfc5a('0x7f'));_0x1da7e7[_0xfc5a('0x3d')](_0xfc5a('0x80'));_0x1da7e7[_0xfc5a('0x3d')]('c.phone');_0x1da7e7[_0xfc5a('0x3d')](_0xfc5a('0x81'));_0x1da7e7['field'](_0xfc5a('0x82'));_0x1da7e7[_0xfc5a('0x3d')]('c.email');_0x1da7e7['field'](_0xfc5a('0x83'));_0x1da7e7[_0xfc5a('0x3d')](_0xfc5a('0x84'));_0x1da7e7[_0xfc5a('0x3d')](_0xfc5a('0x85'),'TagIds');}if(_0x193678['limit'])_0x1da7e7['limit'](_0x193678[_0xfc5a('0x39')]);if(_0x193678['offset'])_0x1da7e7['offset'](_0x193678['offset']);return db['sequelize'][_0xfc5a('0x34')](_0x1da7e7[_0xfc5a('0x7d')](),_0x568944);})[_0xfc5a('0x23')](function(_0x1ce480){_0x1ce480[_0xfc5a('0x4f')](function(_0x3c6919){if(_0x3c6919['TagIds']){_0x3c6919[_0xfc5a('0x86')]=[];_0x3c6919['TagIds']['split'](',')[_0xfc5a('0x4f')](function(_0x640760){_0x3c6919[_0xfc5a('0x86')][_0xfc5a('0x2e')](_0x26fe7c[_0x640760]);});}delete _0x3c6919[_0xfc5a('0x87')];});_0x1f633a['rows']=_0x1ce480;return _0x1f633a;})[_0xfc5a('0x23')](respondWithFilteredResult(_0x5ef287,_0x193678));});})[_0xfc5a('0x88')](handleError(_0x5ef287,null));};exports[_0xfc5a('0x24')]=function(_0x5d09ab,_0x4934f7){return db[_0xfc5a('0x29')][_0xfc5a('0x4a')]({'where':{'id':_0x5d09ab[_0xfc5a('0x89')]['id']}})[_0xfc5a('0x23')](handleEntityNotFound(_0x4934f7,null))['then'](removeEntity(_0x4934f7,null))[_0xfc5a('0x88')](handleError(_0x4934f7,null));};exports[_0xfc5a('0x2a')]=function(_0x13b655,_0x370772){return db[_0xfc5a('0x29')][_0xfc5a('0x2a')]()[_0xfc5a('0x23')](function(_0x182b47){delete _0x182b47[_0xfc5a('0x8a')];for(var _0x34c391=0x0;_0x34c391=_0x1e6c99){_0x7ccb3c=_0x1e6c99;_0x5b3136=0xc8;}else{_0x5b3136=0xce;}_0x2cdbf8[_0xad8b('0x1f')](_0x5b3136);return _0x2cdbf8[_0xad8b('0x24')](_0xad8b('0x25'),_0x353115+'-'+_0x7ccb3c+'/'+_0x1e6c99)[_0xad8b('0x21')](_0x5c2cfe);}return null;};}function patchUpdates(_0x2cb7fd){return function(_0x415fe8){try{jsonpatch[_0xad8b('0x26')](_0x415fe8,_0x2cb7fd,!![]);}catch(_0xa1d0c5){return BPromise[_0xad8b('0x27')](_0xa1d0c5);}return _0x415fe8['save']();};}function saveUpdates(_0x39c893,_0x49a877){return function(_0x5a56d1){if(_0x5a56d1){return _0x5a56d1['update'](_0x39c893)[_0xad8b('0x28')](function(_0x1c9fee){return _0x1c9fee;});}return null;};}function removeEntity(_0x7709de,_0x3c350a){return function(_0x5e6ce0){if(_0x5e6ce0){return _0x5e6ce0[_0xad8b('0x29')]()[_0xad8b('0x28')](function(){_0x7709de[_0xad8b('0x1f')](0xcc)[_0xad8b('0x20')]();});}};}function handleEntityNotFound(_0x455e14,_0x4969a0){return function(_0x228fff){if(!_0x228fff){_0x455e14['sendStatus'](0x194);}return _0x228fff;};}function handleError(_0x206455,_0x19e461){_0x19e461=_0x19e461||0x1f4;return function(_0x3e94d5){logger[_0xad8b('0x2a')](_0x3e94d5[_0xad8b('0x2b')]);if(_0x3e94d5[_0xad8b('0x2c')]){delete _0x3e94d5[_0xad8b('0x2c')];}_0x206455['status'](_0x19e461)['send'](_0x3e94d5);};}exports[_0xad8b('0x2d')]=function(_0x4f567c,_0x34575d){var _0x3d2b8f={},_0x52d1e0={},_0x5f3146={'count':0x0,'rows':[]};return db['CmContact']['describe']()[_0xad8b('0x28')](function(_0x3bbe2f){var _0x3bbd5c=[];for(var _0x5d9cfc=0x0;_0x5d9cfc0x1){_0x50a8d1['or'](_0xad8b('0x6b'),qs[_0xad8b('0x6c')](_0x40cbcb),null);}else{if(qs[_0xad8b('0x6d')](_0x40cbcb)){_0x50a8d1['or'](_0xad8b('0x6e'),_0x40cbcb+'%');_0x50a8d1['or'](_0xad8b('0x6f'),_0x40cbcb+'%');_0x50a8d1['or'](_0xad8b('0x70'),_0x40cbcb+'%');_0x50a8d1['or'](_0xad8b('0x71'),_0x40cbcb+'%');}else if(qs[_0xad8b('0x72')](_0x40cbcb)){_0x50a8d1['or'](_0xad8b('0x73'),_0x40cbcb+'%');}else{_0x50a8d1['or'](_0xad8b('0x74'),'%'+_0x40cbcb+'%');_0x50a8d1['or'](_0xad8b('0x75'),'%'+_0x40cbcb+'%');_0x50a8d1['or'](_0xad8b('0x73'),'%'+_0x40cbcb+'%');}}}}_0x2998b5[_0xad8b('0x40')](_0x50a8d1);_0x2998b5[_0xad8b('0x76')](_0xad8b('0x77'));var _0x25e22b={'type':db[_0xad8b('0x78')]['QueryTypes'][_0xad8b('0x79')],'raw':!![]};var _0x47ef58=_0x2998b5[_0xad8b('0x7a')]()[_0xad8b('0x42')](_0xad8b('0x77'));if(_0x3d2b8f[_0xad8b('0x3f')]){_0x3d2b8f[_0xad8b('0x3f')][_0xad8b('0x55')](function(_0x11f350){_0x2998b5['order']('c.'+_0x11f350[0x0],_0x11f350[0x1]===_0xad8b('0x7b')?![]:!![]);});}if(!_[_0xad8b('0x62')](_0x189858)){_0x2998b5[_0xad8b('0x7c')](_0x53f9f9);_0x47ef58[_0xad8b('0x40')](_0xad8b('0x7d'),_0x189858);}BPromise[_0xad8b('0x7e')]()[_0xad8b('0x28')](function(){if(_0x14f237&&!_[_0xad8b('0x7f')](_0x14f237['conditions'],['field','User'])){return _0x4f567c[_0xad8b('0x80')][_0xad8b('0x81')]({'attributes':['id'],'raw':!![]})[_0xad8b('0x28')](function(_0x3bbae7){if(_[_0xad8b('0x62')](_0x3bbae7)){_0x47ef58['where']('c.ListId\x20IS\x20NULL');_0x2998b5[_0xad8b('0x40')](_0xad8b('0x82'));}else{_0x47ef58[_0xad8b('0x40')](_0xad8b('0x64'),_[_0xad8b('0x54')](_0x3bbae7,'id'));_0x2998b5[_0xad8b('0x40')]('c.ListId\x20IN\x20?',_['map'](_0x3bbae7,'id'));}});}else{return;}})['then'](function(){db[_0xad8b('0x83')][_0xad8b('0x3b')](_0x47ef58[_0xad8b('0x84')](),_0x25e22b)[_0xad8b('0x28')](function(_0x1a249b){_0x5f3146[_0xad8b('0x85')]=_0x1a249b['length'];if(_0x5f3146['count']===0x0)return[];return db[_0xad8b('0x83')][_0xad8b('0x3b')](_0x1631cf[_0xad8b('0x84')](),_0x25e22b);})[_0xad8b('0x28')](function(_0xde97f7){_0x8b849a=_[_0xad8b('0x86')](_0xde97f7,'id');_0x25e22b=_['merge'](_0x25e22b,{'model':db[_0xad8b('0x87')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x4f567c[_0xad8b('0x3b')][_0xad8b('0x3d')]){_0x3d2b8f[_0xad8b('0x3c')][_0xad8b('0x55')](function(_0x5b534b){_0x2998b5[_0xad8b('0x42')]('c.'+_0x5b534b);});}else{_0x2998b5[_0xad8b('0x42')](_0xad8b('0x77'));_0x2998b5[_0xad8b('0x42')](_0xad8b('0x88'));_0x2998b5['field'](_0xad8b('0x89'));_0x2998b5[_0xad8b('0x42')]('c.phone');_0x2998b5[_0xad8b('0x42')]('c.mobile');_0x2998b5[_0xad8b('0x42')](_0xad8b('0x8a'));_0x2998b5['field']('c.email');_0x2998b5[_0xad8b('0x42')]('c.ListId');_0x2998b5[_0xad8b('0x42')](_0xad8b('0x8b'));_0x2998b5[_0xad8b('0x42')]('GROUP_CONCAT(DISTINCT\x20t.id)','TagIds');}if(_0x3d2b8f[_0xad8b('0x23')])_0x2998b5['limit'](_0x3d2b8f[_0xad8b('0x23')]);if(_0x3d2b8f['offset'])_0x2998b5[_0xad8b('0x22')](_0x3d2b8f['offset']);return db[_0xad8b('0x83')]['query'](_0x2998b5[_0xad8b('0x84')](),_0x25e22b);})[_0xad8b('0x28')](function(_0x12fcc6){_0x12fcc6[_0xad8b('0x55')](function(_0x254389){if(_0x254389[_0xad8b('0x8c')]){_0x254389[_0xad8b('0x8d')]=[];_0x254389[_0xad8b('0x8c')][_0xad8b('0x53')](',')[_0xad8b('0x55')](function(_0x1baf32){_0x254389['Tags']['push'](_0x8b849a[_0x1baf32]);});}delete _0x254389[_0xad8b('0x8c')];});_0x5f3146[_0xad8b('0x8e')]=_0x12fcc6;return _0x5f3146;})['then'](respondWithFilteredResult(_0x34575d,_0x3d2b8f));});})[_0xad8b('0x8f')](handleError(_0x34575d,null));};exports[_0xad8b('0x29')]=function(_0x89a4a1,_0x43e500){return db['CmContact'][_0xad8b('0x51')]({'where':{'id':_0x89a4a1[_0xad8b('0x90')]['id']}})[_0xad8b('0x28')](handleEntityNotFound(_0x43e500,null))[_0xad8b('0x28')](removeEntity(_0x43e500,null))[_0xad8b('0x8f')](handleError(_0x43e500,null));};exports[_0xad8b('0x91')]=function(_0x175a0d,_0x577a44){return db[_0xad8b('0x87')][_0xad8b('0x91')]()[_0xad8b('0x28')](function(_0x13ae27){delete _0x13ae27['tags'];for(var _0xb330b7=0x0;_0xb330b7{}\s\\|]/g,'-');_0x1f692b(null,util['format'](_0xaa41('0x20'),path[_0xaa41('0x21')](_0x2bf794[_0xaa41('0x22')],path[_0xaa41('0x23')](_0x2bf794[_0xaa41('0x22')])),Date['now'](),path[_0xaa41('0x23')](_0x2bf794[_0xaa41('0x22')])));}})});router[_0xaa41('0x14')](_0xaa41('0x24'),upload[_0xaa41('0x25')](_0xaa41('0x26')),controller['uploadCsv']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x16aec5,_0x527cac,_0x493a10){_0x493a10(null,path[_0xaa41('0x1c')](config['root'],'server/files/tmp'));},'filename':function(_0x2d0ac0,_0x9c8c21,_0x392214){_0x9c8c21[_0xaa41('0x22')]=_0x9c8c21[_0xaa41('0x22')][_0xaa41('0x1f')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x392214(null,util['format'](_0xaa41('0x20'),path[_0xaa41('0x21')](_0x9c8c21[_0xaa41('0x22')],path[_0xaa41('0x23')](_0x9c8c21[_0xaa41('0x22')])),Date[_0xaa41('0x27')](),path[_0xaa41('0x23')](_0x9c8c21[_0xaa41('0x22')])));}})});router['post'](_0xaa41('0x28'),upload['single']('file'),controller[_0xaa41('0x29')]);router[_0xaa41('0x14')]('/upload/:id',auth[_0xaa41('0xc')](),controller[_0xaa41('0x2a')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xaa41('0x2b')]);router[_0xaa41('0x2c')](_0xaa41('0x2d'),auth[_0xaa41('0xc')](),controller['destroy']);module[_0xaa41('0x2e')]=router; \ No newline at end of file +var _0x8d0e=['diskStorage','root','server/files/tmp','originalname','replace','format','%s-%s%s','basename','extname','/csv','single','file','uploadCsv','join','now','upload','import','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/describe','isAuthenticated','describe','/:id','show','/:id/tags','getTags','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getJscriptySessions','post','/merge','merge','create','/create_many','bulkCreate','setTags'];(function(_0x5b0452,_0x33bcf2){var _0x388b76=function(_0x3d4f9f){while(--_0x3d4f9f){_0x5b0452['push'](_0x5b0452['shift']());}};_0x388b76(++_0x33bcf2);}(_0x8d0e,0x1d7));var _0xe8d0=function(_0x1bc501,_0xf61d96){_0x1bc501=_0x1bc501-0x0;var _0x3e08bc=_0x8d0e[_0x1bc501];return _0x3e08bc;};'use strict';var multer=require(_0xe8d0('0x0'));var util=require(_0xe8d0('0x1'));var path=require(_0xe8d0('0x2'));var timeout=require(_0xe8d0('0x3'));var express=require(_0xe8d0('0x4'));var router=express[_0xe8d0('0x5')]();var auth=require(_0xe8d0('0x6'));var interaction=require(_0xe8d0('0x7'));var config=require(_0xe8d0('0x8'));var controller=require('./cmContact.controller');router[_0xe8d0('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xe8d0('0x9')](_0xe8d0('0xa'),auth[_0xe8d0('0xb')](),controller[_0xe8d0('0xc')]);router[_0xe8d0('0x9')](_0xe8d0('0xd'),auth[_0xe8d0('0xb')](),controller[_0xe8d0('0xe')]);router['get'](_0xe8d0('0xf'),auth[_0xe8d0('0xb')](),controller[_0xe8d0('0x10')]);router['get']('/:id/hoppers',auth[_0xe8d0('0xb')](),controller[_0xe8d0('0x11')]);router[_0xe8d0('0x9')](_0xe8d0('0x12'),auth[_0xe8d0('0xb')](),controller[_0xe8d0('0x13')]);router['get'](_0xe8d0('0x14'),auth[_0xe8d0('0xb')](),controller['getHopperFinals']);router[_0xe8d0('0x9')]('/:id/jscripty_sessions',auth['isAuthenticated'](),controller[_0xe8d0('0x15')]);router[_0xe8d0('0x16')](_0xe8d0('0x17'),auth[_0xe8d0('0xb')](),controller[_0xe8d0('0x18')]);router[_0xe8d0('0x16')]('/',auth['isAuthenticated'](),controller[_0xe8d0('0x19')]);router['post'](_0xe8d0('0x1a'),auth[_0xe8d0('0xb')](),controller[_0xe8d0('0x1b')]);router['post']('/:id/tags',auth['isAuthenticated'](),controller[_0xe8d0('0x1c')]);var upload=multer({'storage':multer[_0xe8d0('0x1d')]({'destination':function(_0x27b910,_0x44bbe4,_0x83177b){_0x83177b(null,path['join'](config[_0xe8d0('0x1e')],_0xe8d0('0x1f')));},'filename':function(_0x524b00,_0x5ce284,_0x554402){_0x5ce284[_0xe8d0('0x20')]=_0x5ce284[_0xe8d0('0x20')][_0xe8d0('0x21')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x554402(null,util[_0xe8d0('0x22')](_0xe8d0('0x23'),path[_0xe8d0('0x24')](_0x5ce284[_0xe8d0('0x20')],path[_0xe8d0('0x25')](_0x5ce284[_0xe8d0('0x20')])),Date['now'](),path[_0xe8d0('0x25')](_0x5ce284[_0xe8d0('0x20')])));}})});router['post'](_0xe8d0('0x26'),upload[_0xe8d0('0x27')](_0xe8d0('0x28')),controller[_0xe8d0('0x29')]);var upload=multer({'storage':multer[_0xe8d0('0x1d')]({'destination':function(_0x149dfd,_0x31519b,_0x32f0c1){_0x32f0c1(null,path[_0xe8d0('0x2a')](config[_0xe8d0('0x1e')],_0xe8d0('0x1f')));},'filename':function(_0x539548,_0x24982c,_0x26dd52){_0x24982c[_0xe8d0('0x20')]=_0x24982c['originalname'][_0xe8d0('0x21')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x26dd52(null,util[_0xe8d0('0x22')]('%s-%s%s',path[_0xe8d0('0x24')](_0x24982c[_0xe8d0('0x20')],path[_0xe8d0('0x25')](_0x24982c[_0xe8d0('0x20')])),Date[_0xe8d0('0x2b')](),path['extname'](_0x24982c[_0xe8d0('0x20')])));}})});router['post']('/upload',upload['single'](_0xe8d0('0x28')),controller[_0xe8d0('0x2c')]);router[_0xe8d0('0x16')]('/upload/:id',auth['isAuthenticated'](),controller[_0xe8d0('0x2d')]);router['put'](_0xe8d0('0xd'),auth[_0xe8d0('0xb')](),controller[_0xe8d0('0x2e')]);router[_0xe8d0('0x2f')](_0xe8d0('0xd'),auth['isAuthenticated'](),controller[_0xe8d0('0x30')]);module[_0xe8d0('0x31')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index ebd1c43..af5b169 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 _0xf3a3=['stringify','BOOLEAN','lodash','exports','VIRTUAL','getDataValue','alias','STRING','setDataValue','name','values','isArray'];(function(_0x1d70db,_0x142b63){var _0x3060c6=function(_0x347866){while(--_0x347866){_0x1d70db['push'](_0x1d70db['shift']());}};_0x3060c6(++_0x142b63);}(_0xf3a3,0x146));var _0x3f3a=function(_0x338671,_0x39e1fd){_0x338671=_0x338671-0x0;var _0x2b0225=_0xf3a3[_0x338671];return _0x2b0225;};'use strict';var Sequelize=require('sequelize');var _=require(_0x3f3a('0x0'));module[_0x3f3a('0x1')]={'name':{'type':Sequelize[_0x3f3a('0x2')],'get':function(_0x2d84e3){return this[_0x3f3a('0x3')](_0x3f3a('0x4'));}},'alias':{'type':Sequelize[_0x3f3a('0x5')],'allowNull':![],'set':function(_0x563439){this[_0x3f3a('0x6')]('alias',_0x563439?_0x563439:this['getDataValue'](_0x3f3a('0x7')));}},'type':{'type':Sequelize[_0x3f3a('0x5')],'allowNull':![]},'values':{'type':Sequelize['TEXT']('long'),'get':function(){if(this[_0x3f3a('0x3')]('type')==='select'){return JSON['parse'](this['getDataValue'](_0x3f3a('0x8')));}else{return this[_0x3f3a('0x3')](_0x3f3a('0x8'));}},'set':function(_0x2af8ad){if(Array[_0x3f3a('0x9')](_0x2af8ad)){this[_0x3f3a('0x6')](_0x3f3a('0x8'),JSON[_0x3f3a('0xa')](_0x2af8ad));}else{this[_0x3f3a('0x6')](_0x3f3a('0x8'),_0x2af8ad);}}},'required':{'type':Sequelize[_0x3f3a('0xb')],'defaultValue':![]}}; \ No newline at end of file +var _0x0255=['alias','STRING','setDataValue','TEXT','type','select','parse','values','BOOLEAN','sequelize','lodash','getDataValue'];(function(_0x5ac4b6,_0x4d9360){var _0x29ced8=function(_0x4fdcb6){while(--_0x4fdcb6){_0x5ac4b6['push'](_0x5ac4b6['shift']());}};_0x29ced8(++_0x4d9360);}(_0x0255,0x111));var _0x5025=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x0255[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x5025('0x0'));var _=require(_0x5025('0x1'));module['exports']={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x57b46e){return this[_0x5025('0x2')](_0x5025('0x3'));}},'alias':{'type':Sequelize[_0x5025('0x4')],'allowNull':![],'set':function(_0x856113){this[_0x5025('0x5')](_0x5025('0x3'),_0x856113?_0x856113:this['getDataValue']('name'));}},'type':{'type':Sequelize[_0x5025('0x4')],'allowNull':![]},'values':{'type':Sequelize[_0x5025('0x6')]('long'),'get':function(){if(this['getDataValue'](_0x5025('0x7'))===_0x5025('0x8')){return JSON[_0x5025('0x9')](this['getDataValue'](_0x5025('0xa')));}else{return this[_0x5025('0x2')]('values');}},'set':function(_0x3b107a){if(Array['isArray'](_0x3b107a)){this[_0x5025('0x5')](_0x5025('0xa'),JSON['stringify'](_0x3b107a));}else{this[_0x5025('0x5')](_0x5025('0xa'),_0x3b107a);}}},'required':{'type':Sequelize[_0x5025('0xb')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 94df8e9..feb86ba 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 _0x9214=['intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filters','filter','merge','where','type','VIRTUAL','options','includeAll','include','rows','catch','show','params','rawAttributes','update','body','find','sequelize','transaction','create','number','Sequelize','queryInterface','addColumn','format','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','sendStatus','status','end','json','count','offset','limit','set','apply','reject','destroy','then','error','stack','name','send','index','map','CmCustomField','fieldName','key','model','query','keys'];(function(_0x4e76da,_0x291b71){var _0x5f14e8=function(_0x30ad0f){while(--_0x30ad0f){_0x4e76da['push'](_0x4e76da['shift']());}};_0x5f14e8(++_0x291b71);}(_0x9214,0x73));var _0x4921=function(_0x4c8fa9,_0x2a1337){_0x4c8fa9=_0x4c8fa9-0x0;var _0x192648=_0x9214[_0x4c8fa9];return _0x192648;};'use strict';var pdf=require(_0x4921('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x4921('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4921('0x2'));var rp=require(_0x4921('0x3'));var moment=require(_0x4921('0x4'));var BPromise=require(_0x4921('0x5'));var Mustache=require(_0x4921('0x6'));var util=require(_0x4921('0x7'));var path=require(_0x4921('0x8'));var sox=require(_0x4921('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x4921('0xa'));var squel=require(_0x4921('0xb'));var crypto=require(_0x4921('0xc'));var jsforce=require(_0x4921('0xd'));var deskjs=require(_0x4921('0xe'));var toCsv=require(_0x4921('0xf'));var querystring=require('querystring');var Papa=require(_0x4921('0x10'));var Redis=require(_0x4921('0x11'));var authService=require(_0x4921('0x12'));var qs=require(_0x4921('0x13'));var as=require(_0x4921('0x14'));var hardwareService=require(_0x4921('0x15'));var logger=require('../../config/logger')(_0x4921('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1987c5,_0x246996){_0x246996=_0x246996||0xcc;return function(_0x227cc7){if(_0x227cc7){return _0x1987c5[_0x4921('0x17')](_0x246996);}return _0x1987c5[_0x4921('0x18')](_0x246996)[_0x4921('0x19')]();};}function respondWithResult(_0x26f24b,_0x39d9bb){_0x39d9bb=_0x39d9bb||0xc8;return function(_0x1c083f){if(_0x1c083f){return _0x26f24b[_0x4921('0x18')](_0x39d9bb)[_0x4921('0x1a')](_0x1c083f);}};}function respondWithFilteredResult(_0x4ac81a,_0x373715){return function(_0x2f61e1){if(_0x2f61e1){var _0xc220d0=_0x2f61e1[_0x4921('0x1b')],_0x200ec2=_0x373715['offset'],_0x240d61=_0x373715[_0x4921('0x1c')]+_0x373715[_0x4921('0x1d')],_0xf3949f;if(_0x240d61>=_0xc220d0){_0x240d61=_0xc220d0;_0xf3949f=0xc8;}else{_0xf3949f=0xce;}_0x4ac81a[_0x4921('0x18')](_0xf3949f);return _0x4ac81a[_0x4921('0x1e')]('Content-Range',_0x200ec2+'-'+_0x240d61+'/'+_0xc220d0)[_0x4921('0x1a')](_0x2f61e1);}return null;};}function patchUpdates(_0xf39a63){return function(_0x2dba81){try{jsonpatch[_0x4921('0x1f')](_0x2dba81,_0xf39a63,!![]);}catch(_0x3ee924){return BPromise[_0x4921('0x20')](_0x3ee924);}return _0x2dba81['save']();};}function saveUpdates(_0x2aacab,_0x3a5f52){return function(_0x27f964){if(_0x27f964){return _0x27f964['update'](_0x2aacab)['then'](function(_0x168e4c){return _0x168e4c;});}return null;};}function removeEntity(_0x122afc,_0x4ae46d){return function(_0xe2a29b){if(_0xe2a29b){return _0xe2a29b[_0x4921('0x21')]()[_0x4921('0x22')](function(){_0x122afc['status'](0xcc)[_0x4921('0x19')]();});}};}function handleEntityNotFound(_0xaf4584,_0x50e1b7){return function(_0x9ddf2f){if(!_0x9ddf2f){_0xaf4584[_0x4921('0x17')](0x194);}return _0x9ddf2f;};}function handleError(_0x34ad61,_0x3be401){_0x3be401=_0x3be401||0x1f4;return function(_0x36ed73){logger[_0x4921('0x23')](_0x36ed73[_0x4921('0x24')]);if(_0x36ed73[_0x4921('0x25')]){delete _0x36ed73[_0x4921('0x25')];}_0x34ad61[_0x4921('0x18')](_0x3be401)[_0x4921('0x26')](_0x36ed73);};}exports[_0x4921('0x27')]=function(_0x4ed017,_0x8c8f7c){var _0x5b9878={},_0x392fba={},_0x3f6643={'count':0x0,'rows':[]};var _0x42a0ed=_[_0x4921('0x28')](db[_0x4921('0x29')]['rawAttributes'],function(_0x36c58e){return{'name':_0x36c58e[_0x4921('0x2a')],'type':_0x36c58e['type'][_0x4921('0x2b')]};});_0x392fba[_0x4921('0x2c')]=_['differenceBy'](_[_0x4921('0x28')](_0x42a0ed,'name'),[_0x4921('0x25')]);_0x392fba[_0x4921('0x2d')]=_[_0x4921('0x2e')](_0x4ed017['query']);_0x392fba['filters']=_[_0x4921('0x2f')](_0x392fba[_0x4921('0x2c')],_0x392fba[_0x4921('0x2d')]);_0x5b9878[_0x4921('0x30')]=_[_0x4921('0x2f')](_0x392fba[_0x4921('0x2c')],qs[_0x4921('0x31')](_0x4ed017[_0x4921('0x2d')][_0x4921('0x31')]));_0x5b9878['attributes']=_0x5b9878[_0x4921('0x30')][_0x4921('0x32')]?_0x5b9878[_0x4921('0x30')]:_0x392fba['model'];if(!_0x4ed017[_0x4921('0x2d')][_0x4921('0x33')](_0x4921('0x34'))){_0x5b9878[_0x4921('0x1d')]=qs[_0x4921('0x1d')](_0x4ed017['query'][_0x4921('0x1d')]);_0x5b9878['offset']=qs['offset'](_0x4ed017[_0x4921('0x2d')][_0x4921('0x1c')]);}_0x5b9878[_0x4921('0x35')]=qs[_0x4921('0x36')](_0x4ed017[_0x4921('0x2d')][_0x4921('0x36')]);_0x5b9878['where']=qs['filters'](_[_0x4921('0x37')](_0x4ed017[_0x4921('0x2d')],_0x392fba[_0x4921('0x38')]));if(_0x4ed017[_0x4921('0x2d')][_0x4921('0x39')]){_0x5b9878['where']=_[_0x4921('0x3a')](_0x5b9878[_0x4921('0x3b')],{'$or':_[_0x4921('0x28')](_0x42a0ed,function(_0x3ca2b4){if(_0x3ca2b4[_0x4921('0x3c')]!==_0x4921('0x3d')){var _0x47b516={};_0x47b516[_0x3ca2b4[_0x4921('0x25')]]={'$like':'%'+_0x4ed017[_0x4921('0x2d')][_0x4921('0x39')]+'%'};return _0x47b516;}})});}_0x5b9878=_[_0x4921('0x3a')]({},_0x5b9878,_0x4ed017[_0x4921('0x3e')]);var _0x2cc85c={'where':_0x5b9878[_0x4921('0x3b')]};return db[_0x4921('0x29')]['count'](_0x2cc85c)[_0x4921('0x22')](function(_0x21cd57){_0x3f6643[_0x4921('0x1b')]=_0x21cd57;if(_0x4ed017[_0x4921('0x2d')][_0x4921('0x3f')]){_0x5b9878[_0x4921('0x40')]=[{'all':!![]}];}return db[_0x4921('0x29')]['findAll'](_0x5b9878);})[_0x4921('0x22')](function(_0x26cad5){_0x3f6643[_0x4921('0x41')]=_0x26cad5;return _0x3f6643;})[_0x4921('0x22')](respondWithFilteredResult(_0x8c8f7c,_0x5b9878))[_0x4921('0x42')](handleError(_0x8c8f7c,null));};exports[_0x4921('0x43')]=function(_0x209947,_0x43889c){var _0x5d579e={'raw':!![],'where':{'id':_0x209947[_0x4921('0x44')]['id']}},_0x54331b={};_0x54331b[_0x4921('0x2c')]=_[_0x4921('0x2e')](db[_0x4921('0x29')][_0x4921('0x45')]);_0x54331b[_0x4921('0x2d')]=_[_0x4921('0x2e')](_0x209947[_0x4921('0x2d')]);_0x54331b[_0x4921('0x38')]=_['intersection'](_0x54331b['model'],_0x54331b[_0x4921('0x2d')]);_0x5d579e[_0x4921('0x30')]=_[_0x4921('0x2f')](_0x54331b[_0x4921('0x2c')],qs[_0x4921('0x31')](_0x209947['query'][_0x4921('0x31')]));_0x5d579e[_0x4921('0x30')]=_0x5d579e[_0x4921('0x30')][_0x4921('0x32')]?_0x5d579e[_0x4921('0x30')]:_0x54331b['model'];if(_0x209947[_0x4921('0x2d')][_0x4921('0x3f')]){_0x5d579e[_0x4921('0x40')]=[{'all':!![]}];}_0x5d579e=_['merge']({},_0x5d579e,_0x209947['options']);return db[_0x4921('0x29')]['find'](_0x5d579e)['then'](handleEntityNotFound(_0x43889c,null))[_0x4921('0x22')](respondWithResult(_0x43889c,null))[_0x4921('0x42')](handleError(_0x43889c,null));};exports[_0x4921('0x46')]=function(_0x1ecf3a,_0x561bbb){if(_0x1ecf3a[_0x4921('0x47')]['id']){delete _0x1ecf3a[_0x4921('0x47')]['id'];}return db[_0x4921('0x29')][_0x4921('0x48')]({'where':{'id':_0x1ecf3a[_0x4921('0x44')]['id']}})[_0x4921('0x22')](handleEntityNotFound(_0x561bbb,null))[_0x4921('0x22')](saveUpdates(_0x1ecf3a[_0x4921('0x47')],null))['then'](respondWithResult(_0x561bbb,null))[_0x4921('0x42')](handleError(_0x561bbb,null));};exports[_0x4921('0x21')]=function(_0x26c2af,_0x7e8cfc){return db['CmCustomField'][_0x4921('0x48')]({'where':{'id':_0x26c2af[_0x4921('0x44')]['id']}})[_0x4921('0x22')](handleEntityNotFound(_0x7e8cfc,null))[_0x4921('0x22')](removeEntity(_0x7e8cfc,null))['catch'](handleError(_0x7e8cfc,null));};exports['create']=function(_0x2419ee,_0x5f091b){var _0x3f9a08;return db[_0x4921('0x49')][_0x4921('0x4a')](function(_0xa33248){return db[_0x4921('0x29')][_0x4921('0x4b')](_0x2419ee[_0x4921('0x47')],{'transaction':_0xa33248})[_0x4921('0x22')](function(_0x306fbb){_0x3f9a08=_0x306fbb;var _0xd52253={'type':db['Sequelize']['TEXT'],'transaction':_0xa33248};switch(_0x2419ee[_0x4921('0x47')][_0x4921('0x3c')]){case'text':_0xd52253[_0x4921('0x3c')]=db['Sequelize']['TEXT'];break;case _0x4921('0x4c'):_0xd52253[_0x4921('0x3c')]=db[_0x4921('0x4d')]['INTEGER'];break;case'switch':_0xd52253['type']=db[_0x4921('0x4d')]['BOOLEAN'];_0xd52253['defaultValue']=![];break;default:}return db[_0x4921('0x49')][_0x4921('0x4e')][_0x4921('0x4f')]('cm_contacts',util[_0x4921('0x50')]('cf_%d',_0x3f9a08['id']),_0xd52253);})['then'](function(){return _0x3f9a08;});})[_0x4921('0x22')](respondWithResult(_0x5f091b,0xc9))['catch'](handleError(_0x5f091b,null));}; \ No newline at end of file +var _0x0941=['reject','update','then','destroy','stack','name','send','map','rawAttributes','type','key','model','differenceBy','query','keys','filters','attributes','intersection','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','CmCustomField','count','includeAll','include','catch','params','fields','find','create','transaction','body','Sequelize','text','TEXT','INTEGER','switch','sequelize','queryInterface','cf_%d','html-pdf','rimraf','request-promise','bluebird','mustache','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','sendStatus','end','status','offset','limit','set','apply'];(function(_0x5cfb92,_0x5797e6){var _0x1cd7c2=function(_0x1bb452){while(--_0x1bb452){_0x5cfb92['push'](_0x5cfb92['shift']());}};_0x1cd7c2(++_0x5797e6);}(_0x0941,0xc7));var _0x1094=function(_0xea1444,_0x142f2a){_0xea1444=_0xea1444-0x0;var _0x5b690e=_0x0941[_0xea1444];return _0x5b690e;};'use strict';var pdf=require(_0x1094('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x1094('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x1094('0x2'));var moment=require('moment');var BPromise=require(_0x1094('0x3'));var Mustache=require(_0x1094('0x4'));var util=require('util');var path=require(_0x1094('0x5'));var sox=require('sox');var csv=require(_0x1094('0x6'));var ejs=require(_0x1094('0x7'));var fs=require('fs');var _=require(_0x1094('0x8'));var squel=require(_0x1094('0x9'));var crypto=require(_0x1094('0xa'));var jsforce=require(_0x1094('0xb'));var deskjs=require(_0x1094('0xc'));var toCsv=require(_0x1094('0x6'));var querystring=require(_0x1094('0xd'));var Papa=require(_0x1094('0xe'));var Redis=require(_0x1094('0xf'));var authService=require(_0x1094('0x10'));var qs=require(_0x1094('0x11'));var as=require(_0x1094('0x12'));var hardwareService=require(_0x1094('0x13'));var logger=require('../../config/logger')(_0x1094('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x1094('0x15'))['db'];function respondWithStatusCode(_0xe89831,_0x4bd250){_0x4bd250=_0x4bd250||0xcc;return function(_0x471e23){if(_0x471e23){return _0xe89831[_0x1094('0x16')](_0x4bd250);}return _0xe89831['status'](_0x4bd250)[_0x1094('0x17')]();};}function respondWithResult(_0xeb001c,_0x15e650){_0x15e650=_0x15e650||0xc8;return function(_0x6101e8){if(_0x6101e8){return _0xeb001c[_0x1094('0x18')](_0x15e650)['json'](_0x6101e8);}};}function respondWithFilteredResult(_0x18eb68,_0x21d2cc){return function(_0x1f5d72){if(_0x1f5d72){var _0x211010=_0x1f5d72['count'],_0x3c9dc2=_0x21d2cc[_0x1094('0x19')],_0x16142a=_0x21d2cc[_0x1094('0x19')]+_0x21d2cc[_0x1094('0x1a')],_0x59c2d5;if(_0x16142a>=_0x211010){_0x16142a=_0x211010;_0x59c2d5=0xc8;}else{_0x59c2d5=0xce;}_0x18eb68[_0x1094('0x18')](_0x59c2d5);return _0x18eb68[_0x1094('0x1b')]('Content-Range',_0x3c9dc2+'-'+_0x16142a+'/'+_0x211010)['json'](_0x1f5d72);}return null;};}function patchUpdates(_0x4929b2){return function(_0x8384af){try{jsonpatch[_0x1094('0x1c')](_0x8384af,_0x4929b2,!![]);}catch(_0x1586c8){return BPromise[_0x1094('0x1d')](_0x1586c8);}return _0x8384af['save']();};}function saveUpdates(_0x1795f1,_0x39ae76){return function(_0x3017ff){if(_0x3017ff){return _0x3017ff[_0x1094('0x1e')](_0x1795f1)[_0x1094('0x1f')](function(_0x18a7ee){return _0x18a7ee;});}return null;};}function removeEntity(_0x5e3db0,_0x14001f){return function(_0x3c9dba){if(_0x3c9dba){return _0x3c9dba[_0x1094('0x20')]()['then'](function(){_0x5e3db0[_0x1094('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x21bf20,_0x1e8bb8){return function(_0x227c8c){if(!_0x227c8c){_0x21bf20[_0x1094('0x16')](0x194);}return _0x227c8c;};}function handleError(_0x4c3272,_0x6cf0e1){_0x6cf0e1=_0x6cf0e1||0x1f4;return function(_0x3f29b0){logger['error'](_0x3f29b0[_0x1094('0x21')]);if(_0x3f29b0[_0x1094('0x22')]){delete _0x3f29b0[_0x1094('0x22')];}_0x4c3272[_0x1094('0x18')](_0x6cf0e1)[_0x1094('0x23')](_0x3f29b0);};}exports['index']=function(_0x1fd895,_0x562752){var _0x1f9413={},_0x4a2e64={},_0x926b5d={'count':0x0,'rows':[]};var _0x22ff1d=_[_0x1094('0x24')](db['CmCustomField'][_0x1094('0x25')],function(_0x2d807a){return{'name':_0x2d807a['fieldName'],'type':_0x2d807a[_0x1094('0x26')][_0x1094('0x27')]};});_0x4a2e64[_0x1094('0x28')]=_[_0x1094('0x29')](_['map'](_0x22ff1d,_0x1094('0x22')),['name']);_0x4a2e64[_0x1094('0x2a')]=_[_0x1094('0x2b')](_0x1fd895[_0x1094('0x2a')]);_0x4a2e64[_0x1094('0x2c')]=_['intersection'](_0x4a2e64[_0x1094('0x28')],_0x4a2e64[_0x1094('0x2a')]);_0x1f9413[_0x1094('0x2d')]=_[_0x1094('0x2e')](_0x4a2e64[_0x1094('0x28')],qs['fields'](_0x1fd895[_0x1094('0x2a')]['fields']));_0x1f9413[_0x1094('0x2d')]=_0x1f9413['attributes'][_0x1094('0x2f')]?_0x1f9413[_0x1094('0x2d')]:_0x4a2e64[_0x1094('0x28')];if(!_0x1fd895['query']['hasOwnProperty'](_0x1094('0x30'))){_0x1f9413[_0x1094('0x1a')]=qs[_0x1094('0x1a')](_0x1fd895[_0x1094('0x2a')][_0x1094('0x1a')]);_0x1f9413['offset']=qs['offset'](_0x1fd895['query']['offset']);}_0x1f9413[_0x1094('0x31')]=qs[_0x1094('0x32')](_0x1fd895[_0x1094('0x2a')][_0x1094('0x32')]);_0x1f9413[_0x1094('0x33')]=qs[_0x1094('0x2c')](_[_0x1094('0x34')](_0x1fd895[_0x1094('0x2a')],_0x4a2e64[_0x1094('0x2c')]));if(_0x1fd895[_0x1094('0x2a')][_0x1094('0x35')]){_0x1f9413['where']=_['merge'](_0x1f9413[_0x1094('0x33')],{'$or':_[_0x1094('0x24')](_0x22ff1d,function(_0x1fbc1a){if(_0x1fbc1a[_0x1094('0x26')]!==_0x1094('0x36')){var _0x289653={};_0x289653[_0x1fbc1a[_0x1094('0x22')]]={'$like':'%'+_0x1fd895['query'][_0x1094('0x35')]+'%'};return _0x289653;}})});}_0x1f9413=_[_0x1094('0x37')]({},_0x1f9413,_0x1fd895[_0x1094('0x38')]);var _0x5c19aa={'where':_0x1f9413['where']};return db[_0x1094('0x39')]['count'](_0x5c19aa)[_0x1094('0x1f')](function(_0x2ee5ed){_0x926b5d[_0x1094('0x3a')]=_0x2ee5ed;if(_0x1fd895[_0x1094('0x2a')][_0x1094('0x3b')]){_0x1f9413[_0x1094('0x3c')]=[{'all':!![]}];}return db[_0x1094('0x39')]['findAll'](_0x1f9413);})['then'](function(_0x59dff8){_0x926b5d['rows']=_0x59dff8;return _0x926b5d;})[_0x1094('0x1f')](respondWithFilteredResult(_0x562752,_0x1f9413))[_0x1094('0x3d')](handleError(_0x562752,null));};exports['show']=function(_0x33a890,_0x60b6ff){var _0x1b3c86={'raw':!![],'where':{'id':_0x33a890[_0x1094('0x3e')]['id']}},_0x60f665={};_0x60f665[_0x1094('0x28')]=_[_0x1094('0x2b')](db[_0x1094('0x39')][_0x1094('0x25')]);_0x60f665[_0x1094('0x2a')]=_['keys'](_0x33a890[_0x1094('0x2a')]);_0x60f665[_0x1094('0x2c')]=_['intersection'](_0x60f665[_0x1094('0x28')],_0x60f665[_0x1094('0x2a')]);_0x1b3c86['attributes']=_[_0x1094('0x2e')](_0x60f665[_0x1094('0x28')],qs[_0x1094('0x3f')](_0x33a890[_0x1094('0x2a')]['fields']));_0x1b3c86[_0x1094('0x2d')]=_0x1b3c86['attributes'][_0x1094('0x2f')]?_0x1b3c86[_0x1094('0x2d')]:_0x60f665[_0x1094('0x28')];if(_0x33a890[_0x1094('0x2a')][_0x1094('0x3b')]){_0x1b3c86[_0x1094('0x3c')]=[{'all':!![]}];}_0x1b3c86=_['merge']({},_0x1b3c86,_0x33a890[_0x1094('0x38')]);return db[_0x1094('0x39')]['find'](_0x1b3c86)[_0x1094('0x1f')](handleEntityNotFound(_0x60b6ff,null))[_0x1094('0x1f')](respondWithResult(_0x60b6ff,null))[_0x1094('0x3d')](handleError(_0x60b6ff,null));};exports[_0x1094('0x1e')]=function(_0x1c6f2d,_0xaa3517){if(_0x1c6f2d['body']['id']){delete _0x1c6f2d['body']['id'];}return db[_0x1094('0x39')][_0x1094('0x40')]({'where':{'id':_0x1c6f2d[_0x1094('0x3e')]['id']}})[_0x1094('0x1f')](handleEntityNotFound(_0xaa3517,null))[_0x1094('0x1f')](saveUpdates(_0x1c6f2d['body'],null))[_0x1094('0x1f')](respondWithResult(_0xaa3517,null))[_0x1094('0x3d')](handleError(_0xaa3517,null));};exports[_0x1094('0x20')]=function(_0x3cad1e,_0x50fbac){return db[_0x1094('0x39')][_0x1094('0x40')]({'where':{'id':_0x3cad1e[_0x1094('0x3e')]['id']}})[_0x1094('0x1f')](handleEntityNotFound(_0x50fbac,null))[_0x1094('0x1f')](removeEntity(_0x50fbac,null))[_0x1094('0x3d')](handleError(_0x50fbac,null));};exports[_0x1094('0x41')]=function(_0x55bf1c,_0x1b7a77){var _0x3e2fd6;return db['sequelize'][_0x1094('0x42')](function(_0x16ed7d){return db['CmCustomField']['create'](_0x55bf1c[_0x1094('0x43')],{'transaction':_0x16ed7d})[_0x1094('0x1f')](function(_0x22dedd){_0x3e2fd6=_0x22dedd;var _0x29e9cc={'type':db[_0x1094('0x44')]['TEXT'],'transaction':_0x16ed7d};switch(_0x55bf1c['body'][_0x1094('0x26')]){case _0x1094('0x45'):_0x29e9cc['type']=db[_0x1094('0x44')][_0x1094('0x46')];break;case'number':_0x29e9cc[_0x1094('0x26')]=db[_0x1094('0x44')][_0x1094('0x47')];break;case _0x1094('0x48'):_0x29e9cc[_0x1094('0x26')]=db['Sequelize']['BOOLEAN'];_0x29e9cc['defaultValue']=![];break;default:}return db[_0x1094('0x49')][_0x1094('0x4a')]['addColumn']('cm_contacts',util['format'](_0x1094('0x4b'),_0x3e2fd6['id']),_0x29e9cc);})['then'](function(){return _0x3e2fd6;});})[_0x1094('0x1f')](respondWithResult(_0x1b7a77,0xc9))['catch'](handleError(_0x1b7a77,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 10685cc..ac86ebb 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 _0xdbd4=['rimraf','exports','define','CmCustomField','cm_custom_fields','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x17e4f9,_0x4318be){var _0xf6cb46=function(_0x329493){while(--_0x329493){_0x17e4f9['push'](_0x17e4f9['shift']());}};_0xf6cb46(++_0x4318be);}(_0xdbd4,0x1e6));var _0x4dbd=function(_0x77b119,_0x90de1e){_0x77b119=_0x77b119-0x0;var _0x29595b=_0xdbd4[_0x77b119];return _0x29595b;};'use strict';var _=require(_0x4dbd('0x0'));var util=require(_0x4dbd('0x1'));var logger=require(_0x4dbd('0x2'))(_0x4dbd('0x3'));var moment=require(_0x4dbd('0x4'));var BPromise=require(_0x4dbd('0x5'));var rp=require(_0x4dbd('0x6'));var fs=require('fs');var path=require(_0x4dbd('0x7'));var rimraf=require(_0x4dbd('0x8'));var config=require('../../config/environment');var attributes=require('./cmCustomField.attributes');module[_0x4dbd('0x9')]=function(_0x2c6f11,_0x44afe8){return _0x2c6f11[_0x4dbd('0xa')](_0x4dbd('0xb'),attributes,{'tableName':_0x4dbd('0xc'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6315=['exports','CmCustomField','cm_custom_fields','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x258e74,_0x459529){var _0x21f2fc=function(_0x1df3dd){while(--_0x1df3dd){_0x258e74['push'](_0x258e74['shift']());}};_0x21f2fc(++_0x459529);}(_0x6315,0x66));var _0x5631=function(_0x5aaed6,_0x10a3fa){_0x5aaed6=_0x5aaed6-0x0;var _0x354def=_0x6315[_0x5aaed6];return _0x354def;};'use strict';var _=require(_0x5631('0x0'));var util=require(_0x5631('0x1'));var logger=require('../../config/logger')(_0x5631('0x2'));var moment=require(_0x5631('0x3'));var BPromise=require('bluebird');var rp=require(_0x5631('0x4'));var fs=require('fs');var path=require(_0x5631('0x5'));var rimraf=require(_0x5631('0x6'));var config=require(_0x5631('0x7'));var attributes=require('./cmCustomField.attributes');module[_0x5631('0x8')]=function(_0x3b2476,_0x412a41){return _0x3b2476['define'](_0x5631('0x9'),attributes,{'tableName':_0x5631('0xa'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.rpc.js b/server/api/cmCustomField/cmCustomField.rpc.js index c01cfdf..25ccab1 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 _0xc978=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0xc978,0xcd));var _0x8c97=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xc978[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x8c97('0x0'));var util=require(_0x8c97('0x1'));var moment=require(_0x8c97('0x2'));var BPromise=require(_0x8c97('0x3'));var rs=require(_0x8c97('0x4'));var fs=require('fs');var Redis=require(_0x8c97('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x8c97('0x6'));var logger=require(_0x8c97('0x7'))(_0x8c97('0x8'));var config=require(_0x8c97('0x9'));var jayson=require(_0x8c97('0xa'));var client=jayson[_0x8c97('0xb')][_0x8c97('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x524196,_0x41a511,_0x1b5864){return new BPromise(function(_0x332cd1,_0x26ff40){return client[_0x8c97('0xd')](_0x524196,_0x1b5864)[_0x8c97('0xe')](function(_0x17aef0){logger['info'](_0x8c97('0xf'),_0x41a511,_0x8c97('0x10'));logger[_0x8c97('0x11')](_0x8c97('0x12'),_0x41a511,_0x8c97('0x10'),JSON[_0x8c97('0x13')](_0x17aef0));if(_0x17aef0[_0x8c97('0x14')]){if(_0x17aef0[_0x8c97('0x14')][_0x8c97('0x15')]===0x1f4){logger['error'](_0x8c97('0xf'),_0x41a511,_0x17aef0[_0x8c97('0x14')]['message']);return _0x26ff40(_0x17aef0[_0x8c97('0x14')][_0x8c97('0x16')]);}logger['error'](_0x8c97('0xf'),_0x41a511,_0x17aef0['error']['message']);return _0x332cd1(_0x17aef0['error'][_0x8c97('0x16')]);}else{logger[_0x8c97('0x17')](_0x8c97('0xf'),_0x41a511,_0x8c97('0x10'));_0x332cd1(_0x17aef0[_0x8c97('0x18')][_0x8c97('0x16')]);}})[_0x8c97('0x19')](function(_0xe3be1){logger[_0x8c97('0x14')]('CmCustomField,\x20%s,\x20%s',_0x41a511,_0xe3be1);_0x26ff40(_0xe3be1);});});} \ No newline at end of file +var _0xd6d6=['CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','CmCustomField,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x568f95,_0xab8b93){var _0x13d535=function(_0x51cacb){while(--_0x51cacb){_0x568f95['push'](_0x568f95['shift']());}};_0x13d535(++_0xab8b93);}(_0xd6d6,0xbe));var _0x6d6d=function(_0x2791e6,_0x1af353){_0x2791e6=_0x2791e6-0x0;var _0x537756=_0xd6d6[_0x2791e6];return _0x537756;};'use strict';var _=require(_0x6d6d('0x0'));var util=require(_0x6d6d('0x1'));var moment=require(_0x6d6d('0x2'));var BPromise=require(_0x6d6d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6d6d('0x4'));var db=require(_0x6d6d('0x5'))['db'];var utils=require(_0x6d6d('0x6'));var logger=require(_0x6d6d('0x7'))(_0x6d6d('0x8'));var config=require(_0x6d6d('0x9'));var jayson=require(_0x6d6d('0xa'));var client=jayson['client'][_0x6d6d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1bf731,_0x44f83d,_0x18f824){return new BPromise(function(_0xd49f57,_0x408f88){return client[_0x6d6d('0xc')](_0x1bf731,_0x18f824)['then'](function(_0x51dd38){logger[_0x6d6d('0xd')](_0x6d6d('0xe'),_0x44f83d,_0x6d6d('0xf'));logger[_0x6d6d('0x10')](_0x6d6d('0x11'),_0x44f83d,'request\x20sent',JSON[_0x6d6d('0x12')](_0x51dd38));if(_0x51dd38[_0x6d6d('0x13')]){if(_0x51dd38['error']['code']===0x1f4){logger[_0x6d6d('0x13')](_0x6d6d('0xe'),_0x44f83d,_0x51dd38[_0x6d6d('0x13')][_0x6d6d('0x14')]);return _0x408f88(_0x51dd38[_0x6d6d('0x13')][_0x6d6d('0x14')]);}logger[_0x6d6d('0x13')](_0x6d6d('0xe'),_0x44f83d,_0x51dd38['error'][_0x6d6d('0x14')]);return _0xd49f57(_0x51dd38[_0x6d6d('0x13')][_0x6d6d('0x14')]);}else{logger[_0x6d6d('0xd')](_0x6d6d('0xe'),_0x44f83d,'request\x20sent');_0xd49f57(_0x51dd38[_0x6d6d('0x15')]['message']);}})[_0x6d6d('0x16')](function(_0x2cbc86){logger[_0x6d6d('0x13')]('CmCustomField,\x20%s,\x20%s',_0x44f83d,_0x2cbc86);_0x408f88(_0x2cbc86);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 5e11c95..ba79c14 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 _0x7d77=['multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./cmCustomField.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','destroy','exports'];(function(_0x25533a,_0x2fea52){var _0x179861=function(_0x2f8513){while(--_0x2f8513){_0x25533a['push'](_0x25533a['shift']());}};_0x179861(++_0x2fea52);}(_0x7d77,0x11d));var _0x77d7=function(_0x27c24d,_0x2b50f1){_0x27c24d=_0x27c24d-0x0;var _0x14e722=_0x7d77[_0x27c24d];return _0x14e722;};'use strict';var multer=require(_0x77d7('0x0'));var util=require(_0x77d7('0x1'));var path=require(_0x77d7('0x2'));var timeout=require(_0x77d7('0x3'));var express=require('express');var router=express[_0x77d7('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x77d7('0x5'));var config=require(_0x77d7('0x6'));var controller=require(_0x77d7('0x7'));router[_0x77d7('0x8')]('/',auth[_0x77d7('0x9')](),controller[_0x77d7('0xa')]);router['get'](_0x77d7('0xb'),auth[_0x77d7('0x9')](),controller[_0x77d7('0xc')]);router[_0x77d7('0xd')]('/',auth[_0x77d7('0x9')](),controller[_0x77d7('0xe')]);router[_0x77d7('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x77d7('0x10')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x77d7('0x11')]);module[_0x77d7('0x12')]=router; \ No newline at end of file +var _0x5a6d=['put','update','destroy','multer','path','express','Router','../../components/interaction/service','../../config/environment','./cmCustomField.controller','index','get','/:id','isAuthenticated','post'];(function(_0x223a8d,_0x25770d){var _0x2eb6c4=function(_0x518105){while(--_0x518105){_0x223a8d['push'](_0x223a8d['shift']());}};_0x2eb6c4(++_0x25770d);}(_0x5a6d,0x1d4));var _0xd5a6=function(_0x536e48,_0x1354c3){_0x536e48=_0x536e48-0x0;var _0x1e227c=_0x5a6d[_0x536e48];return _0x1e227c;};'use strict';var multer=require(_0xd5a6('0x0'));var util=require('util');var path=require(_0xd5a6('0x1'));var timeout=require('connect-timeout');var express=require(_0xd5a6('0x2'));var router=express[_0xd5a6('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xd5a6('0x4'));var config=require(_0xd5a6('0x5'));var controller=require(_0xd5a6('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0xd5a6('0x7')]);router[_0xd5a6('0x8')](_0xd5a6('0x9'),auth[_0xd5a6('0xa')](),controller['show']);router[_0xd5a6('0xb')]('/',auth[_0xd5a6('0xa')](),controller['create']);router[_0xd5a6('0xc')]('/:id',auth['isAuthenticated'](),controller[_0xd5a6('0xd')]);router['delete']('/:id',auth[_0xd5a6('0xa')](),controller[_0xd5a6('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index c17f630..536ac11 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 _0x3c6c=['BOOLEAN','DATE','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','contactListQueue','moment','exports','STRING'];(function(_0x15389f,_0x4dfdc0){var _0x2011ac=function(_0x6a00df){while(--_0x6a00df){_0x15389f['push'](_0x15389f['shift']());}};_0x2011ac(++_0x4dfdc0);}(_0x3c6c,0x7b));var _0xc3c6=function(_0xc1ab4f,_0x3484c0){_0xc1ab4f=_0xc1ab4f-0x0;var _0x5ae08c=_0x3c6c[_0xc1ab4f];return _0x5ae08c;};'use strict';var moment=require(_0xc3c6('0x0'));var Sequelize=require('sequelize');module[_0xc3c6('0x1')]={'phone':{'type':Sequelize[_0xc3c6('0x2')],'allowNull':![]},'active':{'type':Sequelize[_0xc3c6('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0xc3c6('0x4')],'defaultValue':moment()[_0xc3c6('0x5')](_0xc3c6('0x6'))},'countbusyretry':{'type':Sequelize[_0xc3c6('0x7')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xc3c6('0x7')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'callback':{'type':Sequelize[_0xc3c6('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0xc3c6('0x4')]},'priority':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0xc3c6('0x7')],'unique':_0xc3c6('0x8')},'UserId':{'type':Sequelize['INTEGER']},'VoiceQueueId':{'type':Sequelize[_0xc3c6('0x7')],'unique':_0xc3c6('0x8')},'CampaignId':{'type':Sequelize[_0xc3c6('0x7')]},'countnosuchnumberretry':{'type':Sequelize[_0xc3c6('0x7')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xc3c6('0x7')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xc3c6('0x7')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xc3c6('0x7')],'defaultValue':0x0}}; \ No newline at end of file +var _0xb66c=['DATE','format','INTEGER','UNSIGNED','contactListQueue','moment','exports','BOOLEAN'];(function(_0x412dd8,_0x355780){var _0x47b96=function(_0x58b680){while(--_0x58b680){_0x412dd8['push'](_0x412dd8['shift']());}};_0x47b96(++_0x355780);}(_0xb66c,0x175));var _0xcb66=function(_0x52b062,_0x4c4a8f){_0x52b062=_0x52b062-0x0;var _0xe2129a=_0xb66c[_0x52b062];return _0xe2129a;};'use strict';var moment=require(_0xcb66('0x0'));var Sequelize=require('sequelize');module[_0xcb66('0x1')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'active':{'type':Sequelize[_0xcb66('0x2')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0xcb66('0x3')],'defaultValue':moment()[_0xcb66('0x4')]('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0xcb66('0x5')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xcb66('0x5')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xcb66('0x5')],'defaultValue':0x0},'callback':{'type':Sequelize[_0xcb66('0x2')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'priority':{'type':Sequelize[_0xcb66('0x5')](0x2)[_0xcb66('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0xcb66('0x2')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xcb66('0x5')],'unique':_0xcb66('0x7')},'ListId':{'type':Sequelize['INTEGER'],'unique':_0xcb66('0x7')},'UserId':{'type':Sequelize[_0xcb66('0x5')]},'VoiceQueueId':{'type':Sequelize[_0xcb66('0x5')],'unique':_0xcb66('0x7')},'CampaignId':{'type':Sequelize[_0xcb66('0x5')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xcb66('0x5')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xcb66('0x5')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xcb66('0x5')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xcb66('0x5')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.controller.js b/server/api/cmHopper/cmHopper.controller.js index 8599cc9..88f4677 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 _0x6f6e=['DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','scheduledAt','dialOrderByScheduledAt','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','LOCK','UPDATE','Contact','Company','CmList','Queue','preview','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','getOpenContacts','entity\x20not\x20found','html-pdf','zip-dir','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','CmHopper','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','concat','$gt','$gte','$lt','$eq','$not','$between','$in','$notIn','$notLike','$iLike','$notILike','$like','$contains','$contained','attributes','fields','length','nolimit','sort','filter','merge','where','VIRTUAL','includeAll','findAll','catch','show','include','find','create','body','describe','CampaignId','VoiceQueueId','VoiceQueue','Campaign','dataValues','createdAt','updatedAt','state','statedesc','deleted','campaign','membername','user','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','campaigntype','queue','CmContact','ContactId','firstName','lastName','isNil','calleridname','finally','getVoiceQueues','outbound','sequelize','transaction','direction','isEmpty','hopperIds','priority','ASC'];(function(_0x537bcd,_0x13bae1){var _0x6cc881=function(_0x3d470f){while(--_0x3d470f){_0x537bcd['push'](_0x537bcd['shift']());}};_0x6cc881(++_0x13bae1);}(_0x6f6e,0x1b4));var _0xe6f6=function(_0x41d677,_0x17ad95){_0x41d677=_0x41d677-0x0;var _0x507986=_0x6f6e[_0x41d677];return _0x507986;};'use strict';var pdf=require(_0xe6f6('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe6f6('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe6f6('0x2'));var moment=require('moment');var BPromise=require(_0xe6f6('0x3'));var Mustache=require(_0xe6f6('0x4'));var util=require(_0xe6f6('0x5'));var path=require(_0xe6f6('0x6'));var sox=require('sox');var csv=require(_0xe6f6('0x7'));var ejs=require(_0xe6f6('0x8'));var fs=require('fs');var _=require(_0xe6f6('0x9'));var squel=require(_0xe6f6('0xa'));var crypto=require(_0xe6f6('0xb'));var jsforce=require(_0xe6f6('0xc'));var deskjs=require(_0xe6f6('0xd'));var toCsv=require(_0xe6f6('0x7'));var querystring=require(_0xe6f6('0xe'));var Papa=require(_0xe6f6('0xf'));var Redis=require('ioredis');var authService=require(_0xe6f6('0x10'));var qs=require(_0xe6f6('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe6f6('0x12'));var logger=require(_0xe6f6('0x13'))(_0xe6f6('0x14'));var utils=require(_0xe6f6('0x15'));var config=require(_0xe6f6('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x8a37b5,_0x4a8073){_0x4a8073=_0x4a8073||0xcc;return function(_0x116361){if(_0x116361){return _0x8a37b5['sendStatus'](_0x4a8073);}return _0x8a37b5[_0xe6f6('0x17')](_0x4a8073)[_0xe6f6('0x18')]();};}function respondWithResult(_0x3fe8a5,_0x239c75){_0x239c75=_0x239c75||0xc8;return function(_0x554f82){if(_0x554f82){return _0x3fe8a5['status'](_0x239c75)[_0xe6f6('0x19')](_0x554f82);}};}function respondWithFilteredResult(_0x5d891e,_0x3be6be){return function(_0x2300b8){if(_0x2300b8){var _0x252b8a=_0x2300b8[_0xe6f6('0x1a')],_0x441f76=_0x3be6be[_0xe6f6('0x1b')],_0x77d41c=_0x3be6be['offset']+_0x3be6be[_0xe6f6('0x1c')],_0x9d3d44;if(_0x77d41c>=_0x252b8a){_0x77d41c=_0x252b8a;_0x9d3d44=0xc8;}else{_0x9d3d44=0xce;}_0x5d891e[_0xe6f6('0x17')](_0x9d3d44);return _0x5d891e['set'](_0xe6f6('0x1d'),_0x441f76+'-'+_0x77d41c+'/'+_0x252b8a)[_0xe6f6('0x19')](_0x2300b8);}return null;};}function patchUpdates(_0x1fa792){return function(_0x18b573){try{jsonpatch[_0xe6f6('0x1e')](_0x18b573,_0x1fa792,!![]);}catch(_0x3eb527){return BPromise[_0xe6f6('0x1f')](_0x3eb527);}return _0x18b573[_0xe6f6('0x20')]();};}function saveUpdates(_0x4b5caa,_0x35e4f3){return function(_0x2761f1){if(_0x2761f1){return _0x2761f1[_0xe6f6('0x21')](_0x4b5caa)[_0xe6f6('0x22')](function(_0x3c2dbb){return _0x3c2dbb;});}return null;};}function removeEntity(_0x4c6b12,_0x36c9fb){return function(_0xfbfbf6){if(_0xfbfbf6){return _0xfbfbf6[_0xe6f6('0x23')]()[_0xe6f6('0x22')](function(){_0x4c6b12[_0xe6f6('0x17')](0xcc)[_0xe6f6('0x18')]();});}};}function handleEntityNotFound(_0x58130c,_0x251d9b){return function(_0xf33cf8){if(!_0xf33cf8){_0x58130c[_0xe6f6('0x24')](0x194);}return _0xf33cf8;};}function handleError(_0x159f37,_0x428db4){_0x428db4=_0x428db4||0x1f4;return function(_0x1d35cf){logger[_0xe6f6('0x25')](_0x1d35cf[_0xe6f6('0x26')]);if(_0x1d35cf[_0xe6f6('0x27')]){delete _0x1d35cf[_0xe6f6('0x27')];}_0x159f37[_0xe6f6('0x17')](_0x428db4)[_0xe6f6('0x28')](_0x1d35cf);};}exports[_0xe6f6('0x29')]=function(_0x496703,_0x5f47d1){var _0x3f759d={},_0xc910fd={},_0x5ae2af={'count':0x0,'rows':[]};var _0x42168b=_[_0xe6f6('0x2a')](db[_0xe6f6('0x2b')][_0xe6f6('0x2c')],function(_0x2ad6ad){return{'name':_0x2ad6ad[_0xe6f6('0x2d')],'type':_0x2ad6ad[_0xe6f6('0x2e')][_0xe6f6('0x2f')]};});_0xc910fd[_0xe6f6('0x30')]=_['map'](_0x42168b,'name');_0xc910fd['query']=_[_0xe6f6('0x31')](_0x496703[_0xe6f6('0x32')]);_0xc910fd[_0xe6f6('0x33')]=_[_0xe6f6('0x34')](_0xc910fd[_0xe6f6('0x30')],_0xc910fd[_0xe6f6('0x32')]);_0xc910fd[_0xe6f6('0x33')]=_[_0xe6f6('0x35')](_0xc910fd[_0xe6f6('0x33')],['$and','$or',_0xe6f6('0x36'),_0xe6f6('0x37'),_0xe6f6('0x38'),'$lte','$ne',_0xe6f6('0x39'),_0xe6f6('0x3a'),_0xe6f6('0x3b'),'$notBetween',_0xe6f6('0x3c'),_0xe6f6('0x3d'),'$like',_0xe6f6('0x3e'),_0xe6f6('0x3f'),_0xe6f6('0x40'),_0xe6f6('0x41'),'$overlap',_0xe6f6('0x42'),_0xe6f6('0x43'),'$any']);_0x3f759d[_0xe6f6('0x44')]=_['intersection'](_0xc910fd[_0xe6f6('0x30')],qs['fields'](_0x496703[_0xe6f6('0x32')][_0xe6f6('0x45')]));_0x3f759d['attributes']=_0x3f759d[_0xe6f6('0x44')][_0xe6f6('0x46')]?_0x3f759d[_0xe6f6('0x44')]:_0xc910fd['model'];if(!_0x496703[_0xe6f6('0x32')]['hasOwnProperty'](_0xe6f6('0x47'))){_0x3f759d[_0xe6f6('0x1c')]=qs[_0xe6f6('0x1c')](_0x496703[_0xe6f6('0x32')][_0xe6f6('0x1c')]);_0x3f759d['offset']=qs['offset'](_0x496703[_0xe6f6('0x32')][_0xe6f6('0x1b')]);}_0x3f759d['order']=qs[_0xe6f6('0x48')](_0x496703['query'][_0xe6f6('0x48')]);_0x3f759d['where']=qs[_0xe6f6('0x33')](_['pick'](_0x496703['query'],_0xc910fd[_0xe6f6('0x33')]));if(_0x496703[_0xe6f6('0x32')][_0xe6f6('0x49')]){_0x3f759d['where']=_[_0xe6f6('0x4a')](_0x3f759d[_0xe6f6('0x4b')],{'$or':_[_0xe6f6('0x2a')](_0x42168b,function(_0x102cef){if(_0x102cef[_0xe6f6('0x2e')]!==_0xe6f6('0x4c')){var _0x14e54a={};_0x14e54a[_0x102cef[_0xe6f6('0x27')]]={'$like':'%'+_0x496703[_0xe6f6('0x32')][_0xe6f6('0x49')]+'%'};return _0x14e54a;}})});}_0x3f759d=_[_0xe6f6('0x4a')]({},_0x3f759d,_0x496703['options']);var _0x255959={'where':_0x3f759d[_0xe6f6('0x4b')]};return db[_0xe6f6('0x2b')][_0xe6f6('0x1a')](_0x255959)[_0xe6f6('0x22')](function(_0x51ee5a){_0x5ae2af[_0xe6f6('0x1a')]=_0x51ee5a;if(_0x496703['query'][_0xe6f6('0x4d')]){_0x3f759d['include']=[{'all':!![]}];}return db[_0xe6f6('0x2b')][_0xe6f6('0x4e')](_0x3f759d);})[_0xe6f6('0x22')](function(_0x36ca4e){_0x5ae2af['rows']=_0x36ca4e;return _0x5ae2af;})[_0xe6f6('0x22')](respondWithFilteredResult(_0x5f47d1,_0x3f759d))[_0xe6f6('0x4f')](handleError(_0x5f47d1,null));};exports[_0xe6f6('0x50')]=function(_0x3311db,_0x27bca8){var _0x3dcf92={'raw':!![],'where':{'id':_0x3311db['params']['id']}},_0x47f8d3={};_0x47f8d3[_0xe6f6('0x30')]=_[_0xe6f6('0x31')](db['CmHopper'][_0xe6f6('0x2c')]);_0x47f8d3['query']=_[_0xe6f6('0x31')](_0x3311db[_0xe6f6('0x32')]);_0x47f8d3[_0xe6f6('0x33')]=_[_0xe6f6('0x34')](_0x47f8d3['model'],_0x47f8d3[_0xe6f6('0x32')]);_0x3dcf92['attributes']=_[_0xe6f6('0x34')](_0x47f8d3[_0xe6f6('0x30')],qs['fields'](_0x3311db[_0xe6f6('0x32')]['fields']));_0x3dcf92[_0xe6f6('0x44')]=_0x3dcf92[_0xe6f6('0x44')]['length']?_0x3dcf92['attributes']:_0x47f8d3[_0xe6f6('0x30')];if(_0x3311db[_0xe6f6('0x32')][_0xe6f6('0x4d')]){_0x3dcf92[_0xe6f6('0x51')]=[{'all':!![]}];}_0x3dcf92=_[_0xe6f6('0x4a')]({},_0x3dcf92,_0x3311db['options']);return db[_0xe6f6('0x2b')][_0xe6f6('0x52')](_0x3dcf92)['then'](handleEntityNotFound(_0x27bca8,null))['then'](respondWithResult(_0x27bca8,null))[_0xe6f6('0x4f')](handleError(_0x27bca8,null));};exports[_0xe6f6('0x53')]=function(_0xdeb9f5,_0x33facd){return db[_0xe6f6('0x2b')][_0xe6f6('0x53')](_0xdeb9f5[_0xe6f6('0x54')],{})[_0xe6f6('0x22')](respondWithResult(_0x33facd,0xc9))[_0xe6f6('0x4f')](handleError(_0x33facd,null));};exports['update']=function(_0x593f82,_0x35b356){if(_0x593f82[_0xe6f6('0x54')]['id']){delete _0x593f82[_0xe6f6('0x54')]['id'];}return db[_0xe6f6('0x2b')][_0xe6f6('0x52')]({'where':{'id':_0x593f82['params']['id']}})[_0xe6f6('0x22')](handleEntityNotFound(_0x35b356,null))[_0xe6f6('0x22')](saveUpdates(_0x593f82['body'],null))[_0xe6f6('0x22')](respondWithResult(_0x35b356,null))[_0xe6f6('0x4f')](handleError(_0x35b356,null));};exports[_0xe6f6('0x55')]=function(_0x32255d,_0x1b189e){return db[_0xe6f6('0x2b')][_0xe6f6('0x55')]()[_0xe6f6('0x22')](respondWithResult(_0x1b189e,null))[_0xe6f6('0x4f')](handleError(_0x1b189e,null));};exports[_0xe6f6('0x23')]=function(_0x47304d,_0x1f3592){var _0x228299;return db[_0xe6f6('0x2b')][_0xe6f6('0x52')]({'where':{'id':_0x47304d['params']['id']}})[_0xe6f6('0x22')](handleEntityNotFound(_0x1f3592,null))[_0xe6f6('0x22')](function(_0x13b457){if(_0x13b457){return _0x13b457[_0xe6f6('0x23')]()['then'](function(_0x5dc013){return _0x5dc013;});}})[_0xe6f6('0x22')](function(_0x216331){_0x228299=_0x216331;if(_0x216331){if(_0x216331['VoiceQueueId']||_0x216331[_0xe6f6('0x56')]){return db[_0x216331[_0xe6f6('0x57')]?_0xe6f6('0x58'):_0xe6f6('0x59')][_0xe6f6('0x52')]({'where':{'id':_0x216331[_0xe6f6('0x57')]?_0x216331['VoiceQueueId']:_0x216331[_0xe6f6('0x56')]},'attributes':['id',_0xe6f6('0x27')],'raw':!![]});}}})[_0xe6f6('0x22')](function(_0x177c14){var _0x510f2e={};if(_0x177c14){_[_0xe6f6('0x4a')](_0x510f2e,_['omit'](_0x228299[_0xe6f6('0x5a')],[_0xe6f6('0x5b'),_0xe6f6('0x5c'),'id']));_0x510f2e[_0xe6f6('0x5d')]=0x15;_0x510f2e[_0xe6f6('0x5e')]=_0xe6f6('0x5f');_0x510f2e[_0xe6f6('0x60')]=_0x177c14[_0xe6f6('0x27')];_0x510f2e[_0xe6f6('0x61')]=_0x47304d[_0xe6f6('0x62')][_0xe6f6('0x27')];_0x510f2e['UserId']=_0x47304d[_0xe6f6('0x62')]['id'];_0x510f2e[_0xe6f6('0x5f')]=!![];_0x510f2e[_0xe6f6('0x63')]=moment()[_0xe6f6('0x64')](_0xe6f6('0x65'));_0x510f2e['calleridnum']=_0x228299['phone'];_0x510f2e[_0xe6f6('0x66')]=_0x228299['VoiceQueueId']?_0xe6f6('0x67'):'ivr';return db[_0xe6f6('0x68')][_0xe6f6('0x52')]({'where':{'id':_0x510f2e[_0xe6f6('0x69')]},'attributes':[_0xe6f6('0x6a'),_0xe6f6('0x6b')]})['then'](function(_0xe17ef4){if(!_['isNil'](_0x1f3592)&&!_[_0xe6f6('0x6c')](_0xe17ef4[_0xe6f6('0x6a')])){_0x510f2e[_0xe6f6('0x6d')]=_0xe17ef4['firstName'];if(!_[_0xe6f6('0x6c')](_0xe17ef4['lastName'])){_0x510f2e[_0xe6f6('0x6d')]+='\x20'+_0xe17ef4[_0xe6f6('0x6b')];}}})[_0xe6f6('0x6e')](function(){return db['CmHopperFinal'][_0xe6f6('0x53')](_0x510f2e);});}})[_0xe6f6('0x22')](function(){return _0x1f3592[_0xe6f6('0x17')](0xcc)[_0xe6f6('0x18')]();})[_0xe6f6('0x4f')](handleError(_0x1f3592,null));};exports['getPreview']=function(_0x28b803,_0x4d05fb,_0x31e15c){var _0x3668d0=[];return db[_0xe6f6('0x68')]['describe']()[_0xe6f6('0x22')](function(_0x5c4d20){_0x3668d0=_[_0xe6f6('0x31')](_0x5c4d20);return _0x28b803['user'][_0xe6f6('0x6f')]({'where':{'type':_0xe6f6('0x70'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id','dialOrderByScheduledAt'],'raw':!![]});})['then'](function(_0x4342db){if(_0x4342db&&_0x4342db[_0xe6f6('0x46')]){return db[_0xe6f6('0x71')][_0xe6f6('0x72')](function(_0x350467){var _0x1a57aa={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0xe6f6('0x65'))},'VoiceQueueId':{'$in':_[_0xe6f6('0x2a')](_0x4342db,'id')},'$or':[{'UserId':null},{'UserId':_0x28b803['user']['id']}]};var _0x22b830=[];if(_0x28b803['body'][_0xe6f6('0x73')]&&_0x28b803[_0xe6f6('0x54')][_0xe6f6('0x73')]==='prev'){if(!_[_0xe6f6('0x74')](_0x28b803[_0xe6f6('0x54')][_0xe6f6('0x75')])){_0x1a57aa['id']={'$in':_0x28b803[_0xe6f6('0x54')][_0xe6f6('0x75')]};}_0x22b830=[[_0xe6f6('0x76'),_0xe6f6('0x77')],['scheduledAt',_0x4342db[0x0]['dialOrderByScheduledAt']===_0xe6f6('0x77')?_0xe6f6('0x78'):_0xe6f6('0x77')],db[_0xe6f6('0x71')][_0xe6f6('0x79')](_0xe6f6('0x7a')),['id',_0xe6f6('0x78')]];}else{if(!_[_0xe6f6('0x74')](_0x28b803[_0xe6f6('0x54')]['hopperIds'])){_0x1a57aa['id']={'$notIn':_0x28b803['body']['hopperIds']};}_0x22b830=[[_0xe6f6('0x76'),'DESC'],[_0xe6f6('0x7b'),_0x4342db[0x0][_0xe6f6('0x7c')]],db['sequelize'][_0xe6f6('0x79')](_0xe6f6('0x7d')),['id',_0xe6f6('0x77')]];}return db[_0xe6f6('0x2b')][_0xe6f6('0x7e')]({'attributes':['id',_0xe6f6('0x7f')],'where':_0x1a57aa,'order':_0x22b830,'transaction':_0x350467,'lock':_0x350467[_0xe6f6('0x80')][_0xe6f6('0x81')],'include':[{'model':db['CmContact'],'as':_0xe6f6('0x82'),'attributes':_0x3668d0,'include':[{'model':db['CmCompany'],'as':_0xe6f6('0x83'),'attributes':['id',_0xe6f6('0x27')]}]},{'model':db[_0xe6f6('0x84')],'as':'List','attributes':['id',_0xe6f6('0x27')]},{'model':db[_0xe6f6('0x58')],'as':_0xe6f6('0x85'),'attributes':['id',_0xe6f6('0x27'),'dialActive']}]})[_0xe6f6('0x22')](function(_0x1d3f2b){if(_0x1d3f2b){return _0x1d3f2b[_0xe6f6('0x21')]({'UserId':_0x28b803['user']['id']},{'transaction':_0x350467});}});});}})[_0xe6f6('0x22')](handleEntityNotFound(_0x4d05fb,null))['then'](respondWithResult(_0x4d05fb,null))[_0xe6f6('0x4f')](handleError(_0x4d05fb,null));};exports['getOpenContacts']=function(_0x14ec38,_0x6ec47f,_0xf240bb){return _0x14ec38[_0xe6f6('0x62')][_0xe6f6('0x6f')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0xe6f6('0x86')},'attributes':['id'],'raw':!![]})[_0xe6f6('0x22')](function(_0x352f76){if(_0x352f76&&_0x352f76[_0xe6f6('0x46')]){return db['CmHopper'][_0xe6f6('0x1a')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0xe6f6('0x2a')](_0x352f76,'id')},'$or':[{'UserId':null},{'UserId':_0x14ec38[_0xe6f6('0x62')]['id']}]}});}return 0x0;})['then'](function(_0x466c37){if(!_[_0xe6f6('0x6c')](_0x466c37)&&_[_0xe6f6('0x87')](_0x466c37)){return _0x6ec47f[_0xe6f6('0x17')](0xc8)['json']({'contacts':_0x466c37});}else{logger[_0xe6f6('0x25')](_0xe6f6('0x88'),_0xe6f6('0x89'),0x194,_0xe6f6('0x8a'));_0x6ec47f[_0xe6f6('0x24')](0x194);}})[_0xe6f6('0x4f')](handleError(_0x6ec47f,null));}; \ No newline at end of file +var _0x1457=['util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','status','end','json','count','offset','limit','set','reject','save','update','then','stack','name','send','map','CmHopper','rawAttributes','fieldName','type','key','query','keys','filters','intersection','concat','$and','$or','$gt','$gte','$lte','$ne','$eq','$not','$between','$in','$notIn','$like','$notLike','$notILike','$overlap','$contained','attributes','fields','length','model','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','catch','params','create','body','find','describe','destroy','VoiceQueueId','CampaignId','VoiceQueue','Campaign','omit','dataValues','updatedAt','state','statedesc','deleted','campaign','user','UserId','deletedat','calleridnum','phone','ivr','CmContact','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','outbound','preview','dialOrderByScheduledAt','sequelize','transaction','format','YYYY-MM-DD\x20HH:mm:ss','direction','prev','isEmpty','hopperIds','ASC','scheduledAt','DESC','priority','literal','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','LOCK','Contact','CmCompany','CmList','Queue','dialActive','getOpenContacts','getVoiceQueues','isNumber','error','entity\x20not\x20found','sendStatus','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','mustache'];(function(_0x216d93,_0x5af397){var _0x1c49df=function(_0x9c43a7){while(--_0x9c43a7){_0x216d93['push'](_0x216d93['shift']());}};_0x1c49df(++_0x5af397);}(_0x1457,0x88));var _0x7145=function(_0xc6cd9,_0x24938f){_0xc6cd9=_0xc6cd9-0x0;var _0x39ca4b=_0x1457[_0xc6cd9];return _0x39ca4b;};'use strict';var pdf=require(_0x7145('0x0'));var emlformat=require(_0x7145('0x1'));var rimraf=require(_0x7145('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x7145('0x3'));var moment=require(_0x7145('0x4'));var BPromise=require(_0x7145('0x5'));var Mustache=require(_0x7145('0x6'));var util=require(_0x7145('0x7'));var path=require(_0x7145('0x8'));var sox=require(_0x7145('0x9'));var csv=require(_0x7145('0xa'));var ejs=require(_0x7145('0xb'));var fs=require('fs');var _=require(_0x7145('0xc'));var squel=require(_0x7145('0xd'));var crypto=require(_0x7145('0xe'));var jsforce=require(_0x7145('0xf'));var deskjs=require(_0x7145('0x10'));var toCsv=require(_0x7145('0xa'));var querystring=require(_0x7145('0x11'));var Papa=require(_0x7145('0x12'));var Redis=require('ioredis');var authService=require(_0x7145('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x7145('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7145('0x15'))(_0x7145('0x16'));var utils=require(_0x7145('0x17'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x196078,_0x59345b){_0x59345b=_0x59345b||0xcc;return function(_0x1db356){if(_0x1db356){return _0x196078['sendStatus'](_0x59345b);}return _0x196078[_0x7145('0x18')](_0x59345b)[_0x7145('0x19')]();};}function respondWithResult(_0x5153d0,_0x28db62){_0x28db62=_0x28db62||0xc8;return function(_0xd12be9){if(_0xd12be9){return _0x5153d0[_0x7145('0x18')](_0x28db62)[_0x7145('0x1a')](_0xd12be9);}};}function respondWithFilteredResult(_0xf94cc6,_0x47ba7e){return function(_0x41eb26){if(_0x41eb26){var _0x269872=_0x41eb26[_0x7145('0x1b')],_0x7fca9e=_0x47ba7e[_0x7145('0x1c')],_0xaf5a02=_0x47ba7e['offset']+_0x47ba7e[_0x7145('0x1d')],_0x5f4b65;if(_0xaf5a02>=_0x269872){_0xaf5a02=_0x269872;_0x5f4b65=0xc8;}else{_0x5f4b65=0xce;}_0xf94cc6[_0x7145('0x18')](_0x5f4b65);return _0xf94cc6[_0x7145('0x1e')]('Content-Range',_0x7fca9e+'-'+_0xaf5a02+'/'+_0x269872)[_0x7145('0x1a')](_0x41eb26);}return null;};}function patchUpdates(_0x20b24a){return function(_0xaad4dc){try{jsonpatch['apply'](_0xaad4dc,_0x20b24a,!![]);}catch(_0x5bbd76){return BPromise[_0x7145('0x1f')](_0x5bbd76);}return _0xaad4dc[_0x7145('0x20')]();};}function saveUpdates(_0x462abc,_0x1d9eee){return function(_0x21573e){if(_0x21573e){return _0x21573e[_0x7145('0x21')](_0x462abc)[_0x7145('0x22')](function(_0x13f39a){return _0x13f39a;});}return null;};}function removeEntity(_0x1f6d49,_0x3fe79f){return function(_0x52482e){if(_0x52482e){return _0x52482e['destroy']()[_0x7145('0x22')](function(){_0x1f6d49[_0x7145('0x18')](0xcc)[_0x7145('0x19')]();});}};}function handleEntityNotFound(_0x370ec8,_0x4a3b1d){return function(_0x31d77c){if(!_0x31d77c){_0x370ec8['sendStatus'](0x194);}return _0x31d77c;};}function handleError(_0x5c0357,_0x51fd29){_0x51fd29=_0x51fd29||0x1f4;return function(_0x41528a){logger['error'](_0x41528a[_0x7145('0x23')]);if(_0x41528a[_0x7145('0x24')]){delete _0x41528a[_0x7145('0x24')];}_0x5c0357['status'](_0x51fd29)[_0x7145('0x25')](_0x41528a);};}exports['index']=function(_0x55d395,_0x1d0587){var _0xdd06c5={},_0x3da93c={},_0x5c2dc4={'count':0x0,'rows':[]};var _0x3af56c=_[_0x7145('0x26')](db[_0x7145('0x27')][_0x7145('0x28')],function(_0x8d95dd){return{'name':_0x8d95dd[_0x7145('0x29')],'type':_0x8d95dd[_0x7145('0x2a')][_0x7145('0x2b')]};});_0x3da93c['model']=_['map'](_0x3af56c,'name');_0x3da93c[_0x7145('0x2c')]=_[_0x7145('0x2d')](_0x55d395['query']);_0x3da93c[_0x7145('0x2e')]=_[_0x7145('0x2f')](_0x3da93c['model'],_0x3da93c['query']);_0x3da93c[_0x7145('0x2e')]=_[_0x7145('0x30')](_0x3da93c[_0x7145('0x2e')],[_0x7145('0x31'),_0x7145('0x32'),_0x7145('0x33'),_0x7145('0x34'),'$lt',_0x7145('0x35'),_0x7145('0x36'),_0x7145('0x37'),_0x7145('0x38'),_0x7145('0x39'),'$notBetween',_0x7145('0x3a'),_0x7145('0x3b'),_0x7145('0x3c'),_0x7145('0x3d'),'$iLike',_0x7145('0x3e'),_0x7145('0x3c'),_0x7145('0x3f'),'$contains',_0x7145('0x40'),'$any']);_0xdd06c5[_0x7145('0x41')]=_[_0x7145('0x2f')](_0x3da93c['model'],qs[_0x7145('0x42')](_0x55d395['query'][_0x7145('0x42')]));_0xdd06c5[_0x7145('0x41')]=_0xdd06c5[_0x7145('0x41')][_0x7145('0x43')]?_0xdd06c5['attributes']:_0x3da93c[_0x7145('0x44')];if(!_0x55d395['query'][_0x7145('0x45')](_0x7145('0x46'))){_0xdd06c5[_0x7145('0x1d')]=qs[_0x7145('0x1d')](_0x55d395[_0x7145('0x2c')][_0x7145('0x1d')]);_0xdd06c5[_0x7145('0x1c')]=qs[_0x7145('0x1c')](_0x55d395[_0x7145('0x2c')][_0x7145('0x1c')]);}_0xdd06c5[_0x7145('0x47')]=qs['sort'](_0x55d395[_0x7145('0x2c')][_0x7145('0x48')]);_0xdd06c5[_0x7145('0x49')]=qs[_0x7145('0x2e')](_[_0x7145('0x4a')](_0x55d395['query'],_0x3da93c[_0x7145('0x2e')]));if(_0x55d395[_0x7145('0x2c')][_0x7145('0x4b')]){_0xdd06c5['where']=_['merge'](_0xdd06c5[_0x7145('0x49')],{'$or':_[_0x7145('0x26')](_0x3af56c,function(_0x461314){if(_0x461314['type']!==_0x7145('0x4c')){var _0x2b0621={};_0x2b0621[_0x461314[_0x7145('0x24')]]={'$like':'%'+_0x55d395['query'][_0x7145('0x4b')]+'%'};return _0x2b0621;}})});}_0xdd06c5=_[_0x7145('0x4d')]({},_0xdd06c5,_0x55d395[_0x7145('0x4e')]);var _0x496e26={'where':_0xdd06c5[_0x7145('0x49')]};return db[_0x7145('0x27')][_0x7145('0x1b')](_0x496e26)[_0x7145('0x22')](function(_0x179e20){_0x5c2dc4[_0x7145('0x1b')]=_0x179e20;if(_0x55d395['query'][_0x7145('0x4f')]){_0xdd06c5[_0x7145('0x50')]=[{'all':!![]}];}return db[_0x7145('0x27')]['findAll'](_0xdd06c5);})['then'](function(_0x34c31e){_0x5c2dc4['rows']=_0x34c31e;return _0x5c2dc4;})[_0x7145('0x22')](respondWithFilteredResult(_0x1d0587,_0xdd06c5))[_0x7145('0x51')](handleError(_0x1d0587,null));};exports['show']=function(_0x265ac0,_0x23c394){var _0x4a41b4={'raw':!![],'where':{'id':_0x265ac0[_0x7145('0x52')]['id']}},_0x417189={};_0x417189[_0x7145('0x44')]=_[_0x7145('0x2d')](db[_0x7145('0x27')][_0x7145('0x28')]);_0x417189[_0x7145('0x2c')]=_[_0x7145('0x2d')](_0x265ac0[_0x7145('0x2c')]);_0x417189[_0x7145('0x2e')]=_['intersection'](_0x417189[_0x7145('0x44')],_0x417189[_0x7145('0x2c')]);_0x4a41b4[_0x7145('0x41')]=_['intersection'](_0x417189['model'],qs[_0x7145('0x42')](_0x265ac0[_0x7145('0x2c')][_0x7145('0x42')]));_0x4a41b4[_0x7145('0x41')]=_0x4a41b4[_0x7145('0x41')][_0x7145('0x43')]?_0x4a41b4[_0x7145('0x41')]:_0x417189[_0x7145('0x44')];if(_0x265ac0[_0x7145('0x2c')][_0x7145('0x4f')]){_0x4a41b4[_0x7145('0x50')]=[{'all':!![]}];}_0x4a41b4=_[_0x7145('0x4d')]({},_0x4a41b4,_0x265ac0[_0x7145('0x4e')]);return db[_0x7145('0x27')]['find'](_0x4a41b4)[_0x7145('0x22')](handleEntityNotFound(_0x23c394,null))[_0x7145('0x22')](respondWithResult(_0x23c394,null))[_0x7145('0x51')](handleError(_0x23c394,null));};exports[_0x7145('0x53')]=function(_0x40b2f0,_0x186a78){return db[_0x7145('0x27')][_0x7145('0x53')](_0x40b2f0[_0x7145('0x54')],{})[_0x7145('0x22')](respondWithResult(_0x186a78,0xc9))['catch'](handleError(_0x186a78,null));};exports[_0x7145('0x21')]=function(_0x2fd862,_0x2d1c08){if(_0x2fd862['body']['id']){delete _0x2fd862[_0x7145('0x54')]['id'];}return db[_0x7145('0x27')][_0x7145('0x55')]({'where':{'id':_0x2fd862[_0x7145('0x52')]['id']}})[_0x7145('0x22')](handleEntityNotFound(_0x2d1c08,null))[_0x7145('0x22')](saveUpdates(_0x2fd862['body'],null))[_0x7145('0x22')](respondWithResult(_0x2d1c08,null))[_0x7145('0x51')](handleError(_0x2d1c08,null));};exports['describe']=function(_0x34fc27,_0x3c1413){return db[_0x7145('0x27')][_0x7145('0x56')]()[_0x7145('0x22')](respondWithResult(_0x3c1413,null))[_0x7145('0x51')](handleError(_0x3c1413,null));};exports[_0x7145('0x57')]=function(_0x249d81,_0x27edb6){var _0x34e756;return db[_0x7145('0x27')][_0x7145('0x55')]({'where':{'id':_0x249d81[_0x7145('0x52')]['id']}})[_0x7145('0x22')](handleEntityNotFound(_0x27edb6,null))['then'](function(_0x4641ba){if(_0x4641ba){return _0x4641ba[_0x7145('0x57')]()['then'](function(_0xa9546){return _0xa9546;});}})[_0x7145('0x22')](function(_0x18ef7c){_0x34e756=_0x18ef7c;if(_0x18ef7c){if(_0x18ef7c[_0x7145('0x58')]||_0x18ef7c[_0x7145('0x59')]){return db[_0x18ef7c['VoiceQueueId']?_0x7145('0x5a'):_0x7145('0x5b')]['find']({'where':{'id':_0x18ef7c[_0x7145('0x58')]?_0x18ef7c[_0x7145('0x58')]:_0x18ef7c[_0x7145('0x59')]},'attributes':['id','name'],'raw':!![]});}}})[_0x7145('0x22')](function(_0x3be117){var _0x3641ce={};if(_0x3be117){_[_0x7145('0x4d')](_0x3641ce,_[_0x7145('0x5c')](_0x34e756[_0x7145('0x5d')],['createdAt',_0x7145('0x5e'),'id']));_0x3641ce[_0x7145('0x5f')]=0x15;_0x3641ce[_0x7145('0x60')]=_0x7145('0x61');_0x3641ce[_0x7145('0x62')]=_0x3be117[_0x7145('0x24')];_0x3641ce['membername']=_0x249d81[_0x7145('0x63')][_0x7145('0x24')];_0x3641ce[_0x7145('0x64')]=_0x249d81[_0x7145('0x63')]['id'];_0x3641ce['deleted']=!![];_0x3641ce[_0x7145('0x65')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x3641ce[_0x7145('0x66')]=_0x34e756[_0x7145('0x67')];_0x3641ce['campaigntype']=_0x34e756[_0x7145('0x58')]?'queue':_0x7145('0x68');return db[_0x7145('0x69')][_0x7145('0x55')]({'where':{'id':_0x3641ce['ContactId']},'attributes':[_0x7145('0x6a'),_0x7145('0x6b')]})['then'](function(_0x25ccfc){if(!_[_0x7145('0x6c')](_0x27edb6)&&!_['isNil'](_0x25ccfc[_0x7145('0x6a')])){_0x3641ce[_0x7145('0x6d')]=_0x25ccfc[_0x7145('0x6a')];if(!_[_0x7145('0x6c')](_0x25ccfc[_0x7145('0x6b')])){_0x3641ce[_0x7145('0x6d')]+='\x20'+_0x25ccfc[_0x7145('0x6b')];}}})[_0x7145('0x6e')](function(){return db[_0x7145('0x6f')][_0x7145('0x53')](_0x3641ce);});}})[_0x7145('0x22')](function(){return _0x27edb6['status'](0xcc)[_0x7145('0x19')]();})[_0x7145('0x51')](handleError(_0x27edb6,null));};exports['getPreview']=function(_0x3acbdf,_0x4fc845,_0x457b11){var _0x11d93e=[];return db[_0x7145('0x69')][_0x7145('0x56')]()[_0x7145('0x22')](function(_0x2504ef){_0x11d93e=_[_0x7145('0x2d')](_0x2504ef);return _0x3acbdf[_0x7145('0x63')]['getVoiceQueues']({'where':{'type':_0x7145('0x70'),'dialActive':!![],'dialMethod':_0x7145('0x71')},'attributes':['id',_0x7145('0x72')],'raw':!![]});})[_0x7145('0x22')](function(_0x54ad38){if(_0x54ad38&&_0x54ad38[_0x7145('0x43')]){return db[_0x7145('0x73')][_0x7145('0x74')](function(_0x57f742){var _0x4d3815={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x7145('0x75')](_0x7145('0x76'))},'VoiceQueueId':{'$in':_[_0x7145('0x26')](_0x54ad38,'id')},'$or':[{'UserId':null},{'UserId':_0x3acbdf[_0x7145('0x63')]['id']}]};var _0x268014=[];if(_0x3acbdf[_0x7145('0x54')][_0x7145('0x77')]&&_0x3acbdf[_0x7145('0x54')][_0x7145('0x77')]===_0x7145('0x78')){if(!_[_0x7145('0x79')](_0x3acbdf[_0x7145('0x54')][_0x7145('0x7a')])){_0x4d3815['id']={'$in':_0x3acbdf['body'][_0x7145('0x7a')]};}_0x268014=[['priority',_0x7145('0x7b')],[_0x7145('0x7c'),_0x54ad38[0x0]['dialOrderByScheduledAt']===_0x7145('0x7b')?_0x7145('0x7d'):'ASC'],db[_0x7145('0x73')]['literal']('COALESCE(CmHopper.UserId,\x200)\x20ASC'),['id',_0x7145('0x7d')]];}else{if(!_[_0x7145('0x79')](_0x3acbdf['body'][_0x7145('0x7a')])){_0x4d3815['id']={'$notIn':_0x3acbdf[_0x7145('0x54')][_0x7145('0x7a')]};}_0x268014=[[_0x7145('0x7e'),_0x7145('0x7d')],[_0x7145('0x7c'),_0x54ad38[0x0][_0x7145('0x72')]],db[_0x7145('0x73')][_0x7145('0x7f')](_0x7145('0x80')),['id',_0x7145('0x7b')]];}return db[_0x7145('0x27')][_0x7145('0x81')]({'attributes':['id',_0x7145('0x82')],'where':_0x4d3815,'order':_0x268014,'transaction':_0x57f742,'lock':_0x57f742[_0x7145('0x83')]['UPDATE'],'include':[{'model':db[_0x7145('0x69')],'as':_0x7145('0x84'),'attributes':_0x11d93e,'include':[{'model':db[_0x7145('0x85')],'as':'Company','attributes':['id','name']}]},{'model':db[_0x7145('0x86')],'as':'List','attributes':['id',_0x7145('0x24')]},{'model':db[_0x7145('0x5a')],'as':_0x7145('0x87'),'attributes':['id','name',_0x7145('0x88')]}]})[_0x7145('0x22')](function(_0x415749){if(_0x415749){return _0x415749[_0x7145('0x21')]({'UserId':_0x3acbdf['user']['id']},{'transaction':_0x57f742});}});});}})['then'](handleEntityNotFound(_0x4fc845,null))[_0x7145('0x22')](respondWithResult(_0x4fc845,null))['catch'](handleError(_0x4fc845,null));};exports[_0x7145('0x89')]=function(_0x22e4ad,_0x1466b8,_0x52a13a){return _0x22e4ad[_0x7145('0x63')][_0x7145('0x8a')]({'where':{'type':_0x7145('0x70'),'dialActive':!![],'dialMethod':_0x7145('0x71')},'attributes':['id'],'raw':!![]})[_0x7145('0x22')](function(_0x2a2804){if(_0x2a2804&&_0x2a2804[_0x7145('0x43')]){return db[_0x7145('0x27')][_0x7145('0x1b')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x7145('0x75')](_0x7145('0x76'))},'VoiceQueueId':{'$in':_['map'](_0x2a2804,'id')},'$or':[{'UserId':null},{'UserId':_0x22e4ad[_0x7145('0x63')]['id']}]}});}return 0x0;})[_0x7145('0x22')](function(_0x8eeede){if(!_[_0x7145('0x6c')](_0x8eeede)&&_[_0x7145('0x8b')](_0x8eeede)){return _0x1466b8[_0x7145('0x18')](0xc8)[_0x7145('0x1a')]({'contacts':_0x8eeede});}else{logger[_0x7145('0x8c')]('CmHopper,\x20%s,\x20%s,\x20%s','getOpenContacts',0x194,_0x7145('0x8d'));_0x1466b8[_0x7145('0x8e')](0x194);}})[_0x7145('0x51')](handleError(_0x1466b8,null));}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index 06cc546..929efc8 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 _0x67cf=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./cmHopper.attributes','exports','CmHopper','cm_hopper','scheduledat','phone','priority'];(function(_0x1da527,_0x2dc953){var _0x40fc7c=function(_0x9949f5){while(--_0x9949f5){_0x1da527['push'](_0x1da527['shift']());}};_0x40fc7c(++_0x2dc953);}(_0x67cf,0x1d1));var _0xf67c=function(_0x9df3d8,_0x4074e3){_0x9df3d8=_0x9df3d8-0x0;var _0x366da1=_0x67cf[_0x9df3d8];return _0x366da1;};'use strict';var _=require(_0xf67c('0x0'));var util=require(_0xf67c('0x1'));var logger=require(_0xf67c('0x2'))(_0xf67c('0x3'));var moment=require(_0xf67c('0x4'));var BPromise=require(_0xf67c('0x5'));var rp=require(_0xf67c('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf67c('0x7'));var config=require('../../config/environment');var attributes=require(_0xf67c('0x8'));module[_0xf67c('0x9')]=function(_0x29d24f,_0x192fc9){return _0x29d24f['define'](_0xf67c('0xa'),attributes,{'tableName':_0xf67c('0xb'),'paranoid':![],'indexes':[{'name':_0xf67c('0xc'),'fields':['scheduledat']},{'name':'phone','fields':[_0xf67c('0xd')]},{'name':_0xf67c('0xe'),'fields':[_0xf67c('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x55e7=['lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','exports','CmHopper','cm_hopper','scheduledat','phone','priority'];(function(_0x3d4beb,_0x2a658e){var _0x1bb139=function(_0x3b22ee){while(--_0x3b22ee){_0x3d4beb['push'](_0x3d4beb['shift']());}};_0x1bb139(++_0x2a658e);}(_0x55e7,0xb6));var _0x755e=function(_0x270719,_0x41ff77){_0x270719=_0x270719-0x0;var _0x5e3877=_0x55e7[_0x270719];return _0x5e3877;};'use strict';var _=require(_0x755e('0x0'));var util=require(_0x755e('0x1'));var logger=require(_0x755e('0x2'))('api');var moment=require(_0x755e('0x3'));var BPromise=require(_0x755e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x755e('0x5'));var rimraf=require(_0x755e('0x6'));var config=require(_0x755e('0x7'));var attributes=require('./cmHopper.attributes');module[_0x755e('0x8')]=function(_0x341b77,_0x27f0c4){return _0x341b77['define'](_0x755e('0x9'),attributes,{'tableName':_0x755e('0xa'),'paranoid':![],'indexes':[{'name':_0x755e('0xb'),'fields':[_0x755e('0xb')]},{'name':_0x755e('0xc'),'fields':[_0x755e('0xc')]},{'name':_0x755e('0xd'),'fields':[_0x755e('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index e568b7e..ec84561 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 _0x7a54=['stringify','error','code','message','request\x20sent','result','catch','CmHopper','findAll','options','raw','where','attributes','include','map','model','then','GetCmHopper','ShowCmHopper','find','CreateCmHopper','create','update','UpdateCmHopper','DestroyCmHopper','destroy','GetContactDialer','CmContact','describe','sequelize','limit','order','LOCK','UPDATE','keys','User','Agent','name','voicePause','length','body','all','MoveContactManagedDialer','transaction','CountReScheduled','COUNT','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','UserId','push','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','CmHopper,\x20%s,\x20%s','debug'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x7a54,0x106));var _0x47a5=function(_0x65a4fd,_0x1fcc81){_0x65a4fd=_0x65a4fd-0x0;var _0x42bf21=_0x7a54[_0x65a4fd];return _0x42bf21;};'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')]('CmHopper,\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['GetCmHopper']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')]({'raw':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')][_0x47a5('0x18')]===undefined?!![]:![]:!![],'where':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x19')]||null:null,'attributes':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x1a')]||null:null,'limit':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')]['limit']||null:null,'include':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')][_0x47a5('0x1b')]?_[_0x47a5('0x1c')](_0x5247fd['options'][_0x47a5('0x1b')],function(_0x385687){return{'model':db[_0x385687['model']],'as':_0x385687['as'],'attributes':_0x385687[_0x47a5('0x1a')],'include':_0x385687[_0x47a5('0x1b')]?_[_0x47a5('0x1c')](_0x385687[_0x47a5('0x1b')],function(_0x3abd6a){return{'model':db[_0x3abd6a['model']],'as':_0x3abd6a['as'],'attributes':_0x3abd6a['attributes'],'include':_0x3abd6a[_0x47a5('0x1b')]?_['map'](_0x3abd6a[_0x47a5('0x1b')],function(_0x5b6c4e){return{'model':db[_0x5b6c4e[_0x47a5('0x1d')]],'as':_0x5b6c4e['as'],'attributes':_0x5b6c4e[_0x47a5('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x47a5('0x1e')](function(_0x1dac65){logger[_0x47a5('0xb')](_0x47a5('0x1f'),_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1f'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1dac65));_0xaf70a6(_0x1dac65);})[_0x47a5('0x14')](function(_0x1127f8){logger[_0x47a5('0xf')](_0x47a5('0x1f'),_0x1127f8['message'],_0x5247fd);_0x2ce454(_0x423a81[_0x47a5('0xf')](0x1f4,_0x1127f8['message']));});});};exports[_0x47a5('0x20')]=function(_0x9ac908){var _0x16901f=this;return new Promise(function(_0x4d6b57,_0x256650){return db[_0x47a5('0x15')][_0x47a5('0x21')]({'raw':_0x9ac908[_0x47a5('0x17')]?_0x9ac908['options']['raw']===undefined?!![]:![]:!![],'where':_0x9ac908[_0x47a5('0x17')]?_0x9ac908[_0x47a5('0x17')]['where']||null:null,'attributes':_0x9ac908['options']?_0x9ac908[_0x47a5('0x17')][_0x47a5('0x1a')]||null:null,'include':_0x9ac908['options']?_0x9ac908[_0x47a5('0x17')]['include']?_[_0x47a5('0x1c')](_0x9ac908[_0x47a5('0x17')]['include'],function(_0x4843c0){return{'model':db[_0x4843c0[_0x47a5('0x1d')]],'as':_0x4843c0['as'],'attributes':_0x4843c0['attributes'],'include':_0x4843c0[_0x47a5('0x1b')]?_[_0x47a5('0x1c')](_0x4843c0[_0x47a5('0x1b')],function(_0x52749b){return{'model':db[_0x52749b[_0x47a5('0x1d')]],'as':_0x52749b['as'],'attributes':_0x52749b['attributes'],'include':_0x52749b['include']?_[_0x47a5('0x1c')](_0x52749b['include'],function(_0x25cce0){return{'model':db[_0x25cce0['model']],'as':_0x25cce0['as'],'attributes':_0x25cce0[_0x47a5('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x47a5('0x1e')](function(_0x38c8d4){logger[_0x47a5('0xb')](_0x47a5('0x20'),_0x9ac908);logger[_0x47a5('0xd')](_0x47a5('0x20'),_0x9ac908,JSON[_0x47a5('0xe')](_0x38c8d4));_0x4d6b57(_0x38c8d4);})[_0x47a5('0x14')](function(_0x4caed5){logger[_0x47a5('0xf')](_0x47a5('0x20'),_0x4caed5['message'],_0x9ac908);_0x256650(_0x16901f[_0x47a5('0xf')](0x1f4,_0x4caed5[_0x47a5('0x11')]));});});};exports[_0x47a5('0x22')]=function(_0x49c4b5){var _0x101f70=this;return new Promise(function(_0x10f660,_0x596097){return db[_0x47a5('0x15')][_0x47a5('0x23')](_0x49c4b5['body'],{'raw':_0x49c4b5['options']?_0x49c4b5['options'][_0x47a5('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x9b5eaf){logger[_0x47a5('0xb')](_0x47a5('0x22'),_0x49c4b5);logger[_0x47a5('0xd')](_0x47a5('0x22'),_0x49c4b5,JSON[_0x47a5('0xe')](_0x9b5eaf));_0x10f660(_0x9b5eaf);})[_0x47a5('0x14')](function(_0x1f3d01){logger[_0x47a5('0xf')](_0x47a5('0x22'),_0x1f3d01[_0x47a5('0x11')],_0x49c4b5);_0x596097(_0x101f70[_0x47a5('0xf')](0x1f4,_0x1f3d01[_0x47a5('0x11')]));});});};exports['UpdateCmHopper']=function(_0x1fbece){var _0x1c36fa=this;return new Promise(function(_0x331474,_0x23bd8d){return db['CmHopper'][_0x47a5('0x24')](_0x1fbece['body'],{'raw':_0x1fbece['options']?_0x1fbece['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1fbece[_0x47a5('0x17')]?_0x1fbece['options'][_0x47a5('0x19')]||null:null,'attributes':_0x1fbece[_0x47a5('0x17')]?_0x1fbece[_0x47a5('0x17')]['attributes']||null:null,'limit':_0x1fbece[_0x47a5('0x17')]?_0x1fbece[_0x47a5('0x17')]['limit']||null:null})['then'](function(_0xbe21d9){logger['info'](_0x47a5('0x25'),_0x1fbece);logger[_0x47a5('0xd')](_0x47a5('0x25'),_0x1fbece,JSON[_0x47a5('0xe')](_0xbe21d9));_0x331474(_0xbe21d9);})[_0x47a5('0x14')](function(_0xf0edbb){logger[_0x47a5('0xf')](_0x47a5('0x25'),_0xf0edbb[_0x47a5('0x11')],_0x1fbece);_0x23bd8d(_0x1c36fa[_0x47a5('0xf')](0x1f4,_0xf0edbb[_0x47a5('0x11')]));});});};exports[_0x47a5('0x26')]=function(_0xe28d76){var _0x3574d4=this;return new Promise(function(_0x4e5e7,_0x3a2b38){return db['CmHopper'][_0x47a5('0x27')]({'where':_0xe28d76[_0x47a5('0x17')]?_0xe28d76['options']['where']||null:null})[_0x47a5('0x1e')](function(_0x560e4e){logger[_0x47a5('0xb')](_0x47a5('0x26'),_0xe28d76);logger['debug']('DestroyCmHopper',_0xe28d76,JSON[_0x47a5('0xe')](_0x560e4e));_0x4e5e7(_0x560e4e);})['catch'](function(_0x2d147c){logger[_0x47a5('0xf')](_0x47a5('0x26'),_0x2d147c[_0x47a5('0x11')],_0xe28d76);_0x3a2b38(_0x3574d4[_0x47a5('0xf')](0x1f4,_0x2d147c[_0x47a5('0x11')]));});});};exports[_0x47a5('0x28')]=function(_0x53e994){var _0x48a0ef=this;return new Promise(function(_0x2dd1db,_0x411230){return db[_0x47a5('0x29')][_0x47a5('0x2a')]()[_0x47a5('0x1e')](function(_0x2c0c86){return db[_0x47a5('0x2b')]['transaction'](function(_0x45cca5){return db[_0x47a5('0x15')][_0x47a5('0x16')]({'where':_0x53e994['options']?_0x53e994[_0x47a5('0x17')]['where']||null:null,'attributes':_0x53e994[_0x47a5('0x17')]?_0x53e994[_0x47a5('0x17')][_0x47a5('0x1a')]||null:null,'limit':_0x53e994[_0x47a5('0x17')]?_0x53e994['options'][_0x47a5('0x2c')]||null:null,'order':_0x53e994[_0x47a5('0x17')]?_0x53e994[_0x47a5('0x17')][_0x47a5('0x2d')]||null:null,'transaction':_0x45cca5,'lock':_0x45cca5[_0x47a5('0x2e')][_0x47a5('0x2f')],'include':[{'model':db[_0x47a5('0x29')],'as':'Contact','attributes':_[_0x47a5('0x30')](_0x2c0c86)},{'model':db[_0x47a5('0x31')],'as':_0x47a5('0x32'),'attributes':['id',_0x47a5('0x33'),_0x47a5('0x34')]}]})[_0x47a5('0x1e')](function(_0x572233){var _0x1ad6a9=[];for(var _0x245a15=0x0;_0x245a15<_0x572233[_0x47a5('0x35')];_0x245a15+=0x1){_0x1ad6a9['push'](_0x572233[_0x245a15][_0x47a5('0x24')](_0x53e994[_0x47a5('0x36')],{'transaction':_0x45cca5}));}return BPromise[_0x47a5('0x37')](_0x1ad6a9);});})['then'](function(_0x57641e){logger[_0x47a5('0xb')](_0x47a5('0x28'),_0x53e994);logger['debug']('GetContactDialer',_0x53e994,JSON[_0x47a5('0xe')](_0x57641e));_0x2dd1db(_0x57641e);})['catch'](function(_0x16bb8a){logger['error']('GetContactDialer',_0x16bb8a[_0x47a5('0x11')],_0x53e994);_0x411230(_0x48a0ef[_0x47a5('0xf')](0x1f4,_0x16bb8a['message']));});});});};exports[_0x47a5('0x38')]=function(_0x72fe){var _0x4b706a=this;return new Promise(function(_0x5b6127,_0x16b4fd){return db[_0x47a5('0x2b')][_0x47a5('0x39')](function(_0x2931e4){return db['CmHopperFinal'][_0x47a5('0x23')](_0x72fe[_0x47a5('0x36')],{'raw':_0x72fe[_0x47a5('0x17')]?_0x72fe['options'][_0x47a5('0x18')]===undefined?!![]:![]:!![],'transaction':_0x2931e4})['then'](function(){return db[_0x47a5('0x15')][_0x47a5('0x27')]({'where':_0x72fe[_0x47a5('0x17')]?_0x72fe[_0x47a5('0x17')][_0x47a5('0x19')]||null:null,'transaction':_0x2931e4});});})['then'](function(_0x144af9){logger['info']('MoveContactManagedDialer',_0x72fe);logger['debug']('MoveContactManagedDialer',_0x72fe,JSON[_0x47a5('0xe')](_0x144af9));_0x5b6127(_0x144af9);})[_0x47a5('0x14')](function(_0x1e2bb4){logger['error']('MoveContactManagedDialer',_0x1e2bb4[_0x47a5('0x11')],_0x72fe);_0x16b4fd(_0x4b706a[_0x47a5('0xf')](0x1f4,_0x1e2bb4[_0x47a5('0x11')]));});});};exports[_0x47a5('0x3a')]=function(_0xc45e25){var _0x4b5d0c=this;return new Promise(function(_0x3474b7,_0x519e9e){return db[_0x47a5('0x15')][_0x47a5('0x16')]({'raw':_0xc45e25['options']?_0xc45e25[_0x47a5('0x17')][_0x47a5('0x18')]===undefined?!![]:![]:!![],'where':_0xc45e25[_0x47a5('0x17')]?_0xc45e25[_0x47a5('0x17')][_0x47a5('0x19')]||null:null,'attributes':[[db[_0x47a5('0x2b')]['fn'](_0x47a5('0x3b'),db[_0x47a5('0x2b')]['fn']('IF',db['sequelize'][_0x47a5('0x3c')](_0x47a5('0x3d')+util[_0x47a5('0x3e')](_0x47a5('0x3f'),moment()[_0x47a5('0x3e')]('YYYY-MM-DD\x20HH:mm:ss'))+_0x47a5('0x40')))),_0x47a5('0x41')]]})[_0x47a5('0x1e')](function(_0x144aaa){logger[_0x47a5('0xb')](_0x47a5('0x3a'),_0xc45e25);logger[_0x47a5('0xd')](_0x47a5('0x3a'),_0xc45e25,JSON[_0x47a5('0xe')](_0x144aaa));_0x3474b7(_0x144aaa);})[_0x47a5('0x14')](function(_0x1d56f3){logger[_0x47a5('0xf')](_0x47a5('0x3a'),_0x1d56f3[_0x47a5('0x11')],_0xc45e25);_0x519e9e(_0x4b5d0c[_0x47a5('0xf')](0x1f4,_0x1d56f3['message']));});});};exports[_0x47a5('0x42')]=function(_0x284fb8){var _0x30504e=this;return new Promise(function(_0x4b42f3,_0x37ac59){return db[_0x47a5('0x29')][_0x47a5('0x2a')]()[_0x47a5('0x1e')](function(_0x5d9822){return db[_0x47a5('0x2b')]['transaction'](function(_0x2d5ee6){return db['CmHopper'][_0x47a5('0x16')]({'where':_0x284fb8['options']?_0x284fb8[_0x47a5('0x17')][_0x47a5('0x19')]||null:null,'attributes':_0x284fb8[_0x47a5('0x17')]?_0x284fb8['options']['attributes']||null:null,'limit':0x1,'order':_0x284fb8['options']?_0x284fb8[_0x47a5('0x17')][_0x47a5('0x2d')]||null:null,'group':db[_0x47a5('0x15')][_0x47a5('0x43')],'transaction':_0x2d5ee6,'lock':_0x2d5ee6['LOCK'][_0x47a5('0x2f')],'include':_0x284fb8[_0x47a5('0x17')]?_0x284fb8[_0x47a5('0x17')][_0x47a5('0x1b')]?_[_0x47a5('0x1c')](_0x284fb8[_0x47a5('0x17')][_0x47a5('0x1b')],function(_0x39939a){return{'model':db[_0x39939a[_0x47a5('0x1d')]],'as':_0x39939a['as'],'attributes':_0x39939a[_0x47a5('0x1a')],'include':_0x39939a[_0x47a5('0x1b')]?_[_0x47a5('0x1c')](_0x39939a['include'],function(_0x1e3212){return{'model':db[_0x1e3212['model']],'as':_0x1e3212['as'],'attributes':_0x1e3212[_0x47a5('0x1a')],'include':_0x1e3212[_0x47a5('0x1b')]?_[_0x47a5('0x1c')](_0x1e3212[_0x47a5('0x1b')],function(_0x40e584){return{'model':db[_0x40e584[_0x47a5('0x1d')]],'as':_0x40e584['as'],'attributes':_0x40e584[_0x47a5('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x47a5('0x1e')](function(_0x11c1db){var _0x254049=[];for(var _0x1cfb37=0x0;_0x1cfb37<_0x11c1db[_0x47a5('0x35')];_0x1cfb37+=0x1){_0x254049[_0x47a5('0x44')](_0x11c1db[_0x1cfb37][_0x47a5('0x24')](_0x284fb8[_0x47a5('0x36')],{'transaction':_0x2d5ee6}));}return BPromise['all'](_0x254049);});})['then'](function(_0x5ccc89){logger['info'](_0x47a5('0x42'),_0x284fb8);logger[_0x47a5('0xd')]('GetContactRecallMe',_0x284fb8,JSON[_0x47a5('0xe')](_0x5ccc89));_0x4b42f3(_0x5ccc89);})[_0x47a5('0x14')](function(_0x1baa5a){logger[_0x47a5('0xf')](_0x47a5('0x42'),_0x1baa5a[_0x47a5('0x11')],_0x284fb8);_0x37ac59(_0x30504e[_0x47a5('0xf')](0x1f4,_0x1baa5a[_0x47a5('0x11')]));});});});}; \ No newline at end of file +var _0xb10b=['order','LOCK','UPDATE','Contact','keys','User','Agent','name','voicePause','length','push','CmHopperFinal','MoveContactManagedDialer','CountReScheduled','COUNT','`scheduledat`\x20>=\x20','format','\x22%s\x22','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','all','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopper,\x20%s,\x20%s','CmHopper,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','GetCmHopper','CmHopper','findAll','options','raw','where','attributes','include','map','model','debug','catch','ShowCmHopper','CreateCmHopper','create','body','update','limit','UpdateCmHopper','destroy','DestroyCmHopper','GetContactDialer','CmContact','describe','sequelize','transaction'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xb10b,0x12a));var _0xbb10=function(_0x3c27b6,_0x2192cb){_0x3c27b6=_0x3c27b6-0x0;var _0x2a5f55=_0xb10b[_0x3c27b6];return _0x2a5f55;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')]({'raw':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8[_0xbb10('0x18')]?_0x378da8['options'][_0xbb10('0x1b')]||null:null,'limit':_0x378da8[_0xbb10('0x18')]?_0x378da8['options']['limit']||null:null,'include':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1c')]?_[_0xbb10('0x1d')](_0x378da8[_0xbb10('0x18')][_0xbb10('0x1c')],function(_0x407cb4){return{'model':db[_0x407cb4[_0xbb10('0x1e')]],'as':_0x407cb4['as'],'attributes':_0x407cb4[_0xbb10('0x1b')],'include':_0x407cb4[_0xbb10('0x1c')]?_[_0xbb10('0x1d')](_0x407cb4[_0xbb10('0x1c')],function(_0x537898){return{'model':db[_0x537898['model']],'as':_0x537898['as'],'attributes':_0x537898['attributes'],'include':_0x537898[_0xbb10('0x1c')]?_[_0xbb10('0x1d')](_0x537898[_0xbb10('0x1c')],function(_0x4e25ff){return{'model':db[_0x4e25ff[_0xbb10('0x1e')]],'as':_0x4e25ff['as'],'attributes':_0x4e25ff[_0xbb10('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xbb10('0xc')](function(_0x1d5e95){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1f')]('GetCmHopper',_0x378da8,JSON[_0xbb10('0x11')](_0x1d5e95));_0x575cca(_0x1d5e95);})[_0xbb10('0x20')](function(_0xfc3595){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0xfc3595[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4['error'](0x1f4,_0xfc3595[_0xbb10('0x13')]));});});};exports['ShowCmHopper']=function(_0x448d5c){var _0x56f2da=this;return new Promise(function(_0x16ad2a,_0x1dcc9c){return db[_0xbb10('0x16')]['find']({'raw':_0x448d5c['options']?_0x448d5c[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x448d5c['options']?_0x448d5c[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x448d5c[_0xbb10('0x18')]?_0x448d5c[_0xbb10('0x18')][_0xbb10('0x1b')]||null:null,'include':_0x448d5c[_0xbb10('0x18')]?_0x448d5c[_0xbb10('0x18')]['include']?_[_0xbb10('0x1d')](_0x448d5c[_0xbb10('0x18')][_0xbb10('0x1c')],function(_0x8c1ce6){return{'model':db[_0x8c1ce6[_0xbb10('0x1e')]],'as':_0x8c1ce6['as'],'attributes':_0x8c1ce6[_0xbb10('0x1b')],'include':_0x8c1ce6[_0xbb10('0x1c')]?_[_0xbb10('0x1d')](_0x8c1ce6[_0xbb10('0x1c')],function(_0x56943c){return{'model':db[_0x56943c[_0xbb10('0x1e')]],'as':_0x56943c['as'],'attributes':_0x56943c[_0xbb10('0x1b')],'include':_0x56943c[_0xbb10('0x1c')]?_[_0xbb10('0x1d')](_0x56943c['include'],function(_0x111762){return{'model':db[_0x111762['model']],'as':_0x111762['as'],'attributes':_0x111762['attributes']};}):[]};}):[]};}):[]:[]})[_0xbb10('0xc')](function(_0x40c164){logger[_0xbb10('0xd')](_0xbb10('0x21'),_0x448d5c);logger[_0xbb10('0x1f')](_0xbb10('0x21'),_0x448d5c,JSON['stringify'](_0x40c164));_0x16ad2a(_0x40c164);})[_0xbb10('0x20')](function(_0x25d72f){logger['error']('ShowCmHopper',_0x25d72f['message'],_0x448d5c);_0x1dcc9c(_0x56f2da[_0xbb10('0x12')](0x1f4,_0x25d72f[_0xbb10('0x13')]));});});};exports[_0xbb10('0x22')]=function(_0x4d5a9b){var _0x3c0cd7=this;return new Promise(function(_0x3e8538,_0x4345f3){return db['CmHopper'][_0xbb10('0x23')](_0x4d5a9b[_0xbb10('0x24')],{'raw':_0x4d5a9b[_0xbb10('0x18')]?_0x4d5a9b[_0xbb10('0x18')]['raw']===undefined?!![]:![]:!![]})[_0xbb10('0xc')](function(_0x110eb5){logger['info'](_0xbb10('0x22'),_0x4d5a9b);logger[_0xbb10('0x1f')](_0xbb10('0x22'),_0x4d5a9b,JSON[_0xbb10('0x11')](_0x110eb5));_0x3e8538(_0x110eb5);})[_0xbb10('0x20')](function(_0x185a52){logger['error'](_0xbb10('0x22'),_0x185a52[_0xbb10('0x13')],_0x4d5a9b);_0x4345f3(_0x3c0cd7[_0xbb10('0x12')](0x1f4,_0x185a52[_0xbb10('0x13')]));});});};exports['UpdateCmHopper']=function(_0x3fff6c){var _0x331751=this;return new Promise(function(_0x23dc18,_0x403beb){return db['CmHopper'][_0xbb10('0x25')](_0x3fff6c[_0xbb10('0x24')],{'raw':_0x3fff6c['options']?_0x3fff6c['options'][_0xbb10('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3fff6c['options']?_0x3fff6c[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x3fff6c['options']?_0x3fff6c[_0xbb10('0x18')][_0xbb10('0x1b')]||null:null,'limit':_0x3fff6c[_0xbb10('0x18')]?_0x3fff6c['options'][_0xbb10('0x26')]||null:null})[_0xbb10('0xc')](function(_0x3b9fdf){logger[_0xbb10('0xd')](_0xbb10('0x27'),_0x3fff6c);logger[_0xbb10('0x1f')](_0xbb10('0x27'),_0x3fff6c,JSON[_0xbb10('0x11')](_0x3b9fdf));_0x23dc18(_0x3b9fdf);})[_0xbb10('0x20')](function(_0x43b948){logger[_0xbb10('0x12')](_0xbb10('0x27'),_0x43b948['message'],_0x3fff6c);_0x403beb(_0x331751[_0xbb10('0x12')](0x1f4,_0x43b948[_0xbb10('0x13')]));});});};exports['DestroyCmHopper']=function(_0x14e1cb){var _0x2f5027=this;return new Promise(function(_0x1a7df6,_0x5a5226){return db[_0xbb10('0x16')][_0xbb10('0x28')]({'where':_0x14e1cb[_0xbb10('0x18')]?_0x14e1cb['options']['where']||null:null})[_0xbb10('0xc')](function(_0x76a208){logger[_0xbb10('0xd')]('DestroyCmHopper',_0x14e1cb);logger['debug'](_0xbb10('0x29'),_0x14e1cb,JSON[_0xbb10('0x11')](_0x76a208));_0x1a7df6(_0x76a208);})[_0xbb10('0x20')](function(_0xf820fe){logger[_0xbb10('0x12')](_0xbb10('0x29'),_0xf820fe[_0xbb10('0x13')],_0x14e1cb);_0x5a5226(_0x2f5027[_0xbb10('0x12')](0x1f4,_0xf820fe[_0xbb10('0x13')]));});});};exports[_0xbb10('0x2a')]=function(_0x550111){var _0x5eafac=this;return new Promise(function(_0x412e13,_0x467dba){return db[_0xbb10('0x2b')][_0xbb10('0x2c')]()[_0xbb10('0xc')](function(_0x440f9e){return db[_0xbb10('0x2d')][_0xbb10('0x2e')](function(_0x1c0d8f){return db[_0xbb10('0x16')][_0xbb10('0x17')]({'where':_0x550111[_0xbb10('0x18')]?_0x550111[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x550111[_0xbb10('0x18')]?_0x550111['options'][_0xbb10('0x1b')]||null:null,'limit':_0x550111['options']?_0x550111[_0xbb10('0x18')][_0xbb10('0x26')]||null:null,'order':_0x550111[_0xbb10('0x18')]?_0x550111[_0xbb10('0x18')][_0xbb10('0x2f')]||null:null,'transaction':_0x1c0d8f,'lock':_0x1c0d8f[_0xbb10('0x30')][_0xbb10('0x31')],'include':[{'model':db[_0xbb10('0x2b')],'as':_0xbb10('0x32'),'attributes':_[_0xbb10('0x33')](_0x440f9e)},{'model':db[_0xbb10('0x34')],'as':_0xbb10('0x35'),'attributes':['id',_0xbb10('0x36'),_0xbb10('0x37')]}]})[_0xbb10('0xc')](function(_0x5de0cc){var _0x4571b6=[];for(var _0x466eb7=0x0;_0x466eb7<_0x5de0cc[_0xbb10('0x38')];_0x466eb7+=0x1){_0x4571b6[_0xbb10('0x39')](_0x5de0cc[_0x466eb7][_0xbb10('0x25')](_0x550111[_0xbb10('0x24')],{'transaction':_0x1c0d8f}));}return BPromise['all'](_0x4571b6);});})[_0xbb10('0xc')](function(_0x4731ce){logger[_0xbb10('0xd')](_0xbb10('0x2a'),_0x550111);logger[_0xbb10('0x1f')](_0xbb10('0x2a'),_0x550111,JSON[_0xbb10('0x11')](_0x4731ce));_0x412e13(_0x4731ce);})[_0xbb10('0x20')](function(_0x205e01){logger[_0xbb10('0x12')](_0xbb10('0x2a'),_0x205e01[_0xbb10('0x13')],_0x550111);_0x467dba(_0x5eafac[_0xbb10('0x12')](0x1f4,_0x205e01['message']));});});});};exports['MoveContactManagedDialer']=function(_0x16272d){var _0x3e6338=this;return new Promise(function(_0x3d0cb7,_0x8b0a7d){return db['sequelize']['transaction'](function(_0x79411e){return db[_0xbb10('0x3a')][_0xbb10('0x23')](_0x16272d[_0xbb10('0x24')],{'raw':_0x16272d[_0xbb10('0x18')]?_0x16272d[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'transaction':_0x79411e})['then'](function(){return db[_0xbb10('0x16')][_0xbb10('0x28')]({'where':_0x16272d['options']?_0x16272d['options']['where']||null:null,'transaction':_0x79411e});});})[_0xbb10('0xc')](function(_0x31c727){logger[_0xbb10('0xd')]('MoveContactManagedDialer',_0x16272d);logger['debug']('MoveContactManagedDialer',_0x16272d,JSON[_0xbb10('0x11')](_0x31c727));_0x3d0cb7(_0x31c727);})[_0xbb10('0x20')](function(_0x45167a){logger['error'](_0xbb10('0x3b'),_0x45167a[_0xbb10('0x13')],_0x16272d);_0x8b0a7d(_0x3e6338['error'](0x1f4,_0x45167a['message']));});});};exports[_0xbb10('0x3c')]=function(_0x308896){var _0xd77753=this;return new Promise(function(_0x237246,_0x54b7c5){return db[_0xbb10('0x16')][_0xbb10('0x17')]({'raw':_0x308896[_0xbb10('0x18')]?_0x308896['options'][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x308896[_0xbb10('0x18')]?_0x308896[_0xbb10('0x18')]['where']||null:null,'attributes':[[db[_0xbb10('0x2d')]['fn'](_0xbb10('0x3d'),db[_0xbb10('0x2d')]['fn']('IF',db[_0xbb10('0x2d')]['literal'](_0xbb10('0x3e')+util[_0xbb10('0x3f')](_0xbb10('0x40'),moment()[_0xbb10('0x3f')]('YYYY-MM-DD\x20HH:mm:ss'))+_0xbb10('0x41')))),_0xbb10('0x42')]]})[_0xbb10('0xc')](function(_0x2ceb3e){logger[_0xbb10('0xd')](_0xbb10('0x3c'),_0x308896);logger[_0xbb10('0x1f')]('CountReScheduled',_0x308896,JSON['stringify'](_0x2ceb3e));_0x237246(_0x2ceb3e);})['catch'](function(_0xdfbc0b){logger[_0xbb10('0x12')](_0xbb10('0x3c'),_0xdfbc0b['message'],_0x308896);_0x54b7c5(_0xd77753['error'](0x1f4,_0xdfbc0b[_0xbb10('0x13')]));});});};exports[_0xbb10('0x43')]=function(_0xd9e743){var _0x3a9677=this;return new Promise(function(_0x260e06,_0x1ad2ed){return db['CmContact'][_0xbb10('0x2c')]()[_0xbb10('0xc')](function(_0x270fdb){return db[_0xbb10('0x2d')][_0xbb10('0x2e')](function(_0x5bfc68){return db['CmHopper']['findAll']({'where':_0xd9e743[_0xbb10('0x18')]?_0xd9e743[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0xd9e743[_0xbb10('0x18')]?_0xd9e743[_0xbb10('0x18')][_0xbb10('0x1b')]||null:null,'limit':0x1,'order':_0xd9e743['options']?_0xd9e743[_0xbb10('0x18')]['order']||null:null,'group':db['CmHopper']['UserId'],'transaction':_0x5bfc68,'lock':_0x5bfc68[_0xbb10('0x30')][_0xbb10('0x31')],'include':_0xd9e743[_0xbb10('0x18')]?_0xd9e743[_0xbb10('0x18')]['include']?_[_0xbb10('0x1d')](_0xd9e743['options']['include'],function(_0x165fe9){return{'model':db[_0x165fe9[_0xbb10('0x1e')]],'as':_0x165fe9['as'],'attributes':_0x165fe9[_0xbb10('0x1b')],'include':_0x165fe9[_0xbb10('0x1c')]?_[_0xbb10('0x1d')](_0x165fe9['include'],function(_0x2d52ea){return{'model':db[_0x2d52ea[_0xbb10('0x1e')]],'as':_0x2d52ea['as'],'attributes':_0x2d52ea[_0xbb10('0x1b')],'include':_0x2d52ea[_0xbb10('0x1c')]?_[_0xbb10('0x1d')](_0x2d52ea[_0xbb10('0x1c')],function(_0x174395){return{'model':db[_0x174395['model']],'as':_0x174395['as'],'attributes':_0x174395[_0xbb10('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xbb10('0xc')](function(_0x30f3ea){var _0x322b41=[];for(var _0x37b20e=0x0;_0x37b20e<_0x30f3ea[_0xbb10('0x38')];_0x37b20e+=0x1){_0x322b41[_0xbb10('0x39')](_0x30f3ea[_0x37b20e][_0xbb10('0x25')](_0xd9e743['body'],{'transaction':_0x5bfc68}));}return BPromise[_0xbb10('0x44')](_0x322b41);});})[_0xbb10('0xc')](function(_0x145baf){logger['info']('GetContactRecallMe',_0xd9e743);logger['debug'](_0xbb10('0x43'),_0xd9e743,JSON['stringify'](_0x145baf));_0x260e06(_0x145baf);})['catch'](function(_0x1701c5){logger[_0xbb10('0x12')](_0xbb10('0x43'),_0x1701c5[_0xbb10('0x13')],_0xd9e743);_0x1ad2ed(_0x3a9677[_0xbb10('0x12')](0x1f4,_0x1701c5[_0xbb10('0x13')]));});});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 6fb2e70..cc343a2 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 _0x6d2d=['connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopper.controller','get','isAuthenticated','index','describe','getOpenContacts','/:id','show','post','/preview','getPreview','put','delete','destroy','exports','path'];(function(_0x4dba68,_0x53d173){var _0x233acf=function(_0x198b76){while(--_0x198b76){_0x4dba68['push'](_0x4dba68['shift']());}};_0x233acf(++_0x53d173);}(_0x6d2d,0xbc));var _0xd6d2=function(_0x33f336,_0x25e4ab){_0x33f336=_0x33f336-0x0;var _0x2f6e9e=_0x6d2d[_0x33f336];return _0x2f6e9e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xd6d2('0x0'));var timeout=require(_0xd6d2('0x1'));var express=require(_0xd6d2('0x2'));var router=express['Router']();var auth=require(_0xd6d2('0x3'));var interaction=require(_0xd6d2('0x4'));var config=require(_0xd6d2('0x5'));var controller=require(_0xd6d2('0x6'));router[_0xd6d2('0x7')]('/',auth[_0xd6d2('0x8')](),controller[_0xd6d2('0x9')]);router[_0xd6d2('0x7')]('/describe',auth[_0xd6d2('0x8')](),controller[_0xd6d2('0xa')]);router[_0xd6d2('0x7')]('/opencontacts',auth[_0xd6d2('0x8')](),controller[_0xd6d2('0xb')]);router[_0xd6d2('0x7')](_0xd6d2('0xc'),auth[_0xd6d2('0x8')](),controller[_0xd6d2('0xd')]);router[_0xd6d2('0xe')]('/',auth[_0xd6d2('0x8')](),controller['create']);router[_0xd6d2('0xe')](_0xd6d2('0xf'),auth[_0xd6d2('0x8')](),controller[_0xd6d2('0x10')]);router[_0xd6d2('0x11')](_0xd6d2('0xc'),auth[_0xd6d2('0x8')](),controller['update']);router[_0xd6d2('0x12')](_0xd6d2('0xc'),auth[_0xd6d2('0x8')](),controller[_0xd6d2('0x13')]);module[_0xd6d2('0x14')]=router; \ No newline at end of file +var _0xf53d=['../../components/interaction/service','./cmHopper.controller','index','/describe','isAuthenticated','describe','get','/opencontacts','getOpenContacts','show','post','/preview','getPreview','put','/:id','update','destroy','exports','multer','util','connect-timeout','express','Router'];(function(_0x22f8ab,_0x15d8ff){var _0x2a70e5=function(_0x5e6895){while(--_0x5e6895){_0x22f8ab['push'](_0x22f8ab['shift']());}};_0x2a70e5(++_0x15d8ff);}(_0xf53d,0x199));var _0xdf53=function(_0x1817ef,_0x3d3e5a){_0x1817ef=_0x1817ef-0x0;var _0x3d35ca=_0xf53d[_0x1817ef];return _0x3d35ca;};'use strict';var multer=require(_0xdf53('0x0'));var util=require(_0xdf53('0x1'));var path=require('path');var timeout=require(_0xdf53('0x2'));var express=require(_0xdf53('0x3'));var router=express[_0xdf53('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xdf53('0x5'));var config=require('../../config/environment');var controller=require(_0xdf53('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0xdf53('0x7')]);router['get'](_0xdf53('0x8'),auth[_0xdf53('0x9')](),controller[_0xdf53('0xa')]);router[_0xdf53('0xb')](_0xdf53('0xc'),auth[_0xdf53('0x9')](),controller[_0xdf53('0xd')]);router[_0xdf53('0xb')]('/:id',auth[_0xdf53('0x9')](),controller[_0xdf53('0xe')]);router['post']('/',auth[_0xdf53('0x9')](),controller['create']);router[_0xdf53('0xf')](_0xdf53('0x10'),auth[_0xdf53('0x9')](),controller[_0xdf53('0x11')]);router[_0xdf53('0x12')](_0xdf53('0x13'),auth['isAuthenticated'](),controller[_0xdf53('0x14')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xdf53('0x15')]);module[_0xdf53('0x16')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index db2d2be..90c6353 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 _0x1e2c=['moment','sequelize','exports','STRING','contactListQueue','INTEGER'];(function(_0x57fa33,_0x2b8222){var _0x12e724=function(_0x481a33){while(--_0x481a33){_0x57fa33['push'](_0x57fa33['shift']());}};_0x12e724(++_0x2b8222);}(_0x1e2c,0x1bc));var _0xc1e2=function(_0x4c2403,_0x1de08c){_0x4c2403=_0x4c2403-0x0;var _0x504c71=_0x1e2c[_0x4c2403];return _0x504c71;};'use strict';var moment=require(_0xc1e2('0x0'));var Sequelize=require(_0xc1e2('0x1'));module[_0xc1e2('0x2')]={'phone':{'type':Sequelize[_0xc1e2('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0xc1e2('0x4')},'ListId':{'type':Sequelize[_0xc1e2('0x5')],'unique':'contactListQueue'},'VoiceQueueId':{'type':Sequelize[_0xc1e2('0x5')],'unique':_0xc1e2('0x4')}}; \ No newline at end of file +var _0x79d4=['contactListQueue','INTEGER','moment','sequelize','STRING'];(function(_0x1d87fc,_0x1e5321){var _0x492b56=function(_0x4c6b16){while(--_0x4c6b16){_0x1d87fc['push'](_0x1d87fc['shift']());}};_0x492b56(++_0x1e5321);}(_0x79d4,0x16a));var _0x479d=function(_0x3ecb92,_0x5be688){_0x3ecb92=_0x3ecb92-0x0;var _0x1b5d41=_0x79d4[_0x3ecb92];return _0x1b5d41;};'use strict';var moment=require(_0x479d('0x0'));var Sequelize=require(_0x479d('0x1'));module['exports']={'phone':{'type':Sequelize[_0x479d('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0x479d('0x3')},'ListId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'},'VoiceQueueId':{'type':Sequelize[_0x479d('0x4')],'unique':'contactListQueue'}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index 6105ebd..533ed0c 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 _0x5c3c=['fieldName','type','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','catch','keys','body','find','params','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','end','status','count','offset','limit','set','Content-Range','apply','save','update','destroy','then','error','name','send','index','map','CmHopperBlack','rawAttributes'];(function(_0x375381,_0x571bfc){var _0x4b1cb5=function(_0x304d4a){while(--_0x304d4a){_0x375381['push'](_0x375381['shift']());}};_0x4b1cb5(++_0x571bfc);}(_0x5c3c,0x132));var _0xc5c3=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x5c3c[_0x2f5ac5];return _0x37c9a8;};'use strict';var pdf=require(_0xc5c3('0x0'));var emlformat=require(_0xc5c3('0x1'));var rimraf=require(_0xc5c3('0x2'));var zipdir=require(_0xc5c3('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc5c3('0x4'));var moment=require(_0xc5c3('0x5'));var BPromise=require(_0xc5c3('0x6'));var Mustache=require(_0xc5c3('0x7'));var util=require(_0xc5c3('0x8'));var path=require(_0xc5c3('0x9'));var sox=require(_0xc5c3('0xa'));var csv=require(_0xc5c3('0xb'));var ejs=require(_0xc5c3('0xc'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xc5c3('0xd'));var deskjs=require(_0xc5c3('0xe'));var toCsv=require('to-csv');var querystring=require(_0xc5c3('0xf'));var Papa=require(_0xc5c3('0x10'));var Redis=require('ioredis');var authService=require(_0xc5c3('0x11'));var qs=require(_0xc5c3('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc5c3('0x13'));var logger=require(_0xc5c3('0x14'))(_0xc5c3('0x15'));var utils=require('../../config/utils');var config=require(_0xc5c3('0x16'));var db=require(_0xc5c3('0x17'))['db'];function respondWithStatusCode(_0x532065,_0x2b56e6){_0x2b56e6=_0x2b56e6||0xcc;return function(_0x44d2b9){if(_0x44d2b9){return _0x532065[_0xc5c3('0x18')](_0x2b56e6);}return _0x532065['status'](_0x2b56e6)[_0xc5c3('0x19')]();};}function respondWithResult(_0x54fa08,_0x1488ab){_0x1488ab=_0x1488ab||0xc8;return function(_0x13a740){if(_0x13a740){return _0x54fa08[_0xc5c3('0x1a')](_0x1488ab)['json'](_0x13a740);}};}function respondWithFilteredResult(_0x5c0341,_0x4445ea){return function(_0x577e1a){if(_0x577e1a){var _0x1bae87=_0x577e1a[_0xc5c3('0x1b')],_0xef8b21=_0x4445ea['offset'],_0x5ecd4b=_0x4445ea[_0xc5c3('0x1c')]+_0x4445ea[_0xc5c3('0x1d')],_0x4ff2de;if(_0x5ecd4b>=_0x1bae87){_0x5ecd4b=_0x1bae87;_0x4ff2de=0xc8;}else{_0x4ff2de=0xce;}_0x5c0341[_0xc5c3('0x1a')](_0x4ff2de);return _0x5c0341[_0xc5c3('0x1e')](_0xc5c3('0x1f'),_0xef8b21+'-'+_0x5ecd4b+'/'+_0x1bae87)['json'](_0x577e1a);}return null;};}function patchUpdates(_0x364f42){return function(_0x41af00){try{jsonpatch[_0xc5c3('0x20')](_0x41af00,_0x364f42,!![]);}catch(_0x2b582a){return BPromise['reject'](_0x2b582a);}return _0x41af00[_0xc5c3('0x21')]();};}function saveUpdates(_0x41578a,_0x3cc612){return function(_0x3ca20a){if(_0x3ca20a){return _0x3ca20a[_0xc5c3('0x22')](_0x41578a)['then'](function(_0xb07420){return _0xb07420;});}return null;};}function removeEntity(_0x159bec,_0x370254){return function(_0x2de266){if(_0x2de266){return _0x2de266[_0xc5c3('0x23')]()[_0xc5c3('0x24')](function(){_0x159bec[_0xc5c3('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x52d638,_0x45affe){return function(_0x38dd9e){if(!_0x38dd9e){_0x52d638['sendStatus'](0x194);}return _0x38dd9e;};}function handleError(_0x5c7329,_0x23e2fb){_0x23e2fb=_0x23e2fb||0x1f4;return function(_0x1591e3){logger[_0xc5c3('0x25')](_0x1591e3['stack']);if(_0x1591e3['name']){delete _0x1591e3[_0xc5c3('0x26')];}_0x5c7329[_0xc5c3('0x1a')](_0x23e2fb)[_0xc5c3('0x27')](_0x1591e3);};}exports[_0xc5c3('0x28')]=function(_0x5caf85,_0x21efd6){var _0x5176c4={},_0x2eacec={},_0x4e6e6f={'count':0x0,'rows':[]};var _0x1da259=_[_0xc5c3('0x29')](db[_0xc5c3('0x2a')][_0xc5c3('0x2b')],function(_0x15361c){return{'name':_0x15361c[_0xc5c3('0x2c')],'type':_0x15361c[_0xc5c3('0x2d')]['key']};});_0x2eacec[_0xc5c3('0x2e')]=_['map'](_0x1da259,_0xc5c3('0x26'));_0x2eacec[_0xc5c3('0x2f')]=_['keys'](_0x5caf85['query']);_0x2eacec[_0xc5c3('0x30')]=_[_0xc5c3('0x31')](_0x2eacec[_0xc5c3('0x2e')],_0x2eacec[_0xc5c3('0x2f')]);_0x5176c4['attributes']=_[_0xc5c3('0x31')](_0x2eacec[_0xc5c3('0x2e')],qs[_0xc5c3('0x32')](_0x5caf85[_0xc5c3('0x2f')][_0xc5c3('0x32')]));_0x5176c4[_0xc5c3('0x33')]=_0x5176c4[_0xc5c3('0x33')][_0xc5c3('0x34')]?_0x5176c4[_0xc5c3('0x33')]:_0x2eacec['model'];if(!_0x5caf85[_0xc5c3('0x2f')][_0xc5c3('0x35')](_0xc5c3('0x36'))){_0x5176c4[_0xc5c3('0x1d')]=qs[_0xc5c3('0x1d')](_0x5caf85[_0xc5c3('0x2f')][_0xc5c3('0x1d')]);_0x5176c4['offset']=qs['offset'](_0x5caf85[_0xc5c3('0x2f')]['offset']);}_0x5176c4[_0xc5c3('0x37')]=qs[_0xc5c3('0x38')](_0x5caf85[_0xc5c3('0x2f')][_0xc5c3('0x38')]);_0x5176c4[_0xc5c3('0x39')]=qs['filters'](_[_0xc5c3('0x3a')](_0x5caf85[_0xc5c3('0x2f')],_0x2eacec['filters']));if(_0x5caf85[_0xc5c3('0x2f')][_0xc5c3('0x3b')]){_0x5176c4[_0xc5c3('0x39')]=_[_0xc5c3('0x3c')](_0x5176c4[_0xc5c3('0x39')],{'$or':_[_0xc5c3('0x29')](_0x1da259,function(_0x168056){if(_0x168056[_0xc5c3('0x2d')]!==_0xc5c3('0x3d')){var _0xf4f027={};_0xf4f027[_0x168056['name']]={'$like':'%'+_0x5caf85[_0xc5c3('0x2f')]['filter']+'%'};return _0xf4f027;}})});}_0x5176c4=_['merge']({},_0x5176c4,_0x5caf85[_0xc5c3('0x3e')]);var _0x10e27d={'where':_0x5176c4[_0xc5c3('0x39')]};return db[_0xc5c3('0x2a')][_0xc5c3('0x1b')](_0x10e27d)['then'](function(_0x5eba80){_0x4e6e6f[_0xc5c3('0x1b')]=_0x5eba80;if(_0x5caf85[_0xc5c3('0x2f')]['includeAll']){_0x5176c4[_0xc5c3('0x3f')]=[{'all':!![]}];}return db['CmHopperBlack'][_0xc5c3('0x40')](_0x5176c4);})[_0xc5c3('0x24')](function(_0x44121e){_0x4e6e6f['rows']=_0x44121e;return _0x4e6e6f;})[_0xc5c3('0x24')](respondWithFilteredResult(_0x21efd6,_0x5176c4))[_0xc5c3('0x41')](handleError(_0x21efd6,null));};exports['show']=function(_0x4465c8,_0x599881){var _0x33936c={'raw':!![],'where':{'id':_0x4465c8['params']['id']}},_0x28c35c={};_0x28c35c['model']=_['keys'](db[_0xc5c3('0x2a')][_0xc5c3('0x2b')]);_0x28c35c['query']=_[_0xc5c3('0x42')](_0x4465c8[_0xc5c3('0x2f')]);_0x28c35c[_0xc5c3('0x30')]=_[_0xc5c3('0x31')](_0x28c35c['model'],_0x28c35c[_0xc5c3('0x2f')]);_0x33936c['attributes']=_['intersection'](_0x28c35c[_0xc5c3('0x2e')],qs[_0xc5c3('0x32')](_0x4465c8['query'][_0xc5c3('0x32')]));_0x33936c[_0xc5c3('0x33')]=_0x33936c['attributes'][_0xc5c3('0x34')]?_0x33936c['attributes']:_0x28c35c[_0xc5c3('0x2e')];if(_0x4465c8[_0xc5c3('0x2f')]['includeAll']){_0x33936c[_0xc5c3('0x3f')]=[{'all':!![]}];}_0x33936c=_['merge']({},_0x33936c,_0x4465c8[_0xc5c3('0x3e')]);return db[_0xc5c3('0x2a')]['find'](_0x33936c)[_0xc5c3('0x24')](handleEntityNotFound(_0x599881,null))[_0xc5c3('0x24')](respondWithResult(_0x599881,null))[_0xc5c3('0x41')](handleError(_0x599881,null));};exports[_0xc5c3('0x22')]=function(_0x450c46,_0x41dca5){if(_0x450c46['body']['id']){delete _0x450c46[_0xc5c3('0x43')]['id'];}return db[_0xc5c3('0x2a')][_0xc5c3('0x44')]({'where':{'id':_0x450c46[_0xc5c3('0x45')]['id']}})[_0xc5c3('0x24')](handleEntityNotFound(_0x41dca5,null))['then'](saveUpdates(_0x450c46['body'],null))[_0xc5c3('0x24')](respondWithResult(_0x41dca5,null))[_0xc5c3('0x41')](handleError(_0x41dca5,null));};exports[_0xc5c3('0x23')]=function(_0x5f0ee4,_0x38d82f){return db[_0xc5c3('0x2a')][_0xc5c3('0x44')]({'where':{'id':_0x5f0ee4[_0xc5c3('0x45')]['id']}})[_0xc5c3('0x24')](handleEntityNotFound(_0x38d82f,null))[_0xc5c3('0x24')](removeEntity(_0x38d82f,null))[_0xc5c3('0x41')](handleError(_0x38d82f,null));};exports['describe']=function(_0x259a4d,_0x3ff21e){return db[_0xc5c3('0x2a')]['describe']()[_0xc5c3('0x24')](respondWithResult(_0x3ff21e,null))[_0xc5c3('0x41')](handleError(_0x3ff21e,null));}; \ No newline at end of file +var _0xf61e=['describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','end','sendStatus','error','name','send','index','map','CmHopperBlack','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','VIRTUAL','filter','merge','count','includeAll','findAll','catch','show','params','keys','include','options','find','body'];(function(_0x5a729b,_0x1cda6c){var _0xa37df7=function(_0x2c5d77){while(--_0x2c5d77){_0x5a729b['push'](_0x5a729b['shift']());}};_0xa37df7(++_0x1cda6c);}(_0xf61e,0x191));var _0xef61=function(_0x26151d,_0x1c0ae9){_0x26151d=_0x26151d-0x0;var _0x3660b6=_0xf61e[_0x26151d];return _0x3660b6;};'use strict';var pdf=require(_0xef61('0x0'));var emlformat=require(_0xef61('0x1'));var rimraf=require(_0xef61('0x2'));var zipdir=require(_0xef61('0x3'));var jsonpatch=require(_0xef61('0x4'));var rp=require(_0xef61('0x5'));var moment=require(_0xef61('0x6'));var BPromise=require(_0xef61('0x7'));var Mustache=require(_0xef61('0x8'));var util=require(_0xef61('0x9'));var path=require(_0xef61('0xa'));var sox=require(_0xef61('0xb'));var csv=require('to-csv');var ejs=require(_0xef61('0xc'));var fs=require('fs');var _=require(_0xef61('0xd'));var squel=require('squel');var crypto=require(_0xef61('0xe'));var jsforce=require(_0xef61('0xf'));var deskjs=require(_0xef61('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xef61('0x11'));var Redis=require(_0xef61('0x12'));var authService=require(_0xef61('0x13'));var qs=require(_0xef61('0x14'));var as=require(_0xef61('0x15'));var hardwareService=require(_0xef61('0x16'));var logger=require(_0xef61('0x17'))(_0xef61('0x18'));var utils=require(_0xef61('0x19'));var config=require(_0xef61('0x1a'));var db=require(_0xef61('0x1b'))['db'];function respondWithStatusCode(_0x2f203c,_0x114e1f){_0x114e1f=_0x114e1f||0xcc;return function(_0x318f1c){if(_0x318f1c){return _0x2f203c['sendStatus'](_0x114e1f);}return _0x2f203c[_0xef61('0x1c')](_0x114e1f)['end']();};}function respondWithResult(_0x106472,_0x1db2a9){_0x1db2a9=_0x1db2a9||0xc8;return function(_0x370ee0){if(_0x370ee0){return _0x106472[_0xef61('0x1c')](_0x1db2a9)['json'](_0x370ee0);}};}function respondWithFilteredResult(_0x2ac1b2,_0x435beb){return function(_0x1224c2){if(_0x1224c2){var _0x78ff22=_0x1224c2['count'],_0x588a61=_0x435beb[_0xef61('0x1d')],_0x66fa62=_0x435beb[_0xef61('0x1d')]+_0x435beb[_0xef61('0x1e')],_0xbe23a7;if(_0x66fa62>=_0x78ff22){_0x66fa62=_0x78ff22;_0xbe23a7=0xc8;}else{_0xbe23a7=0xce;}_0x2ac1b2[_0xef61('0x1c')](_0xbe23a7);return _0x2ac1b2[_0xef61('0x1f')](_0xef61('0x20'),_0x588a61+'-'+_0x66fa62+'/'+_0x78ff22)[_0xef61('0x21')](_0x1224c2);}return null;};}function patchUpdates(_0x55f887){return function(_0x39443d){try{jsonpatch[_0xef61('0x22')](_0x39443d,_0x55f887,!![]);}catch(_0x4a3af6){return BPromise[_0xef61('0x23')](_0x4a3af6);}return _0x39443d[_0xef61('0x24')]();};}function saveUpdates(_0x29c13c,_0x26cf42){return function(_0xb0d7a4){if(_0xb0d7a4){return _0xb0d7a4[_0xef61('0x25')](_0x29c13c)[_0xef61('0x26')](function(_0x51f9ca){return _0x51f9ca;});}return null;};}function removeEntity(_0x536e9e,_0x3d31c1){return function(_0x58bd7d){if(_0x58bd7d){return _0x58bd7d[_0xef61('0x27')]()['then'](function(){_0x536e9e['status'](0xcc)[_0xef61('0x28')]();});}};}function handleEntityNotFound(_0x5ce99d,_0x53181b){return function(_0xfbee94){if(!_0xfbee94){_0x5ce99d[_0xef61('0x29')](0x194);}return _0xfbee94;};}function handleError(_0x3ceb14,_0x111bac){_0x111bac=_0x111bac||0x1f4;return function(_0x5e56da){logger[_0xef61('0x2a')](_0x5e56da['stack']);if(_0x5e56da[_0xef61('0x2b')]){delete _0x5e56da[_0xef61('0x2b')];}_0x3ceb14[_0xef61('0x1c')](_0x111bac)[_0xef61('0x2c')](_0x5e56da);};}exports[_0xef61('0x2d')]=function(_0x45ece2,_0x258b5a){var _0x23837f={},_0x297df7={},_0x1ee27b={'count':0x0,'rows':[]};var _0x3a16ba=_[_0xef61('0x2e')](db[_0xef61('0x2f')][_0xef61('0x30')],function(_0x1f3572){return{'name':_0x1f3572[_0xef61('0x31')],'type':_0x1f3572[_0xef61('0x32')][_0xef61('0x33')]};});_0x297df7[_0xef61('0x34')]=_[_0xef61('0x2e')](_0x3a16ba,_0xef61('0x2b'));_0x297df7[_0xef61('0x35')]=_['keys'](_0x45ece2['query']);_0x297df7[_0xef61('0x36')]=_[_0xef61('0x37')](_0x297df7[_0xef61('0x34')],_0x297df7['query']);_0x23837f[_0xef61('0x38')]=_[_0xef61('0x37')](_0x297df7['model'],qs[_0xef61('0x39')](_0x45ece2['query']['fields']));_0x23837f[_0xef61('0x38')]=_0x23837f['attributes'][_0xef61('0x3a')]?_0x23837f['attributes']:_0x297df7[_0xef61('0x34')];if(!_0x45ece2[_0xef61('0x35')][_0xef61('0x3b')](_0xef61('0x3c'))){_0x23837f[_0xef61('0x1e')]=qs[_0xef61('0x1e')](_0x45ece2[_0xef61('0x35')][_0xef61('0x1e')]);_0x23837f[_0xef61('0x1d')]=qs[_0xef61('0x1d')](_0x45ece2['query'][_0xef61('0x1d')]);}_0x23837f[_0xef61('0x3d')]=qs[_0xef61('0x3e')](_0x45ece2[_0xef61('0x35')][_0xef61('0x3e')]);_0x23837f['where']=qs[_0xef61('0x36')](_[_0xef61('0x3f')](_0x45ece2[_0xef61('0x35')],_0x297df7['filters']));if(_0x45ece2['query']['filter']){_0x23837f[_0xef61('0x40')]=_['merge'](_0x23837f['where'],{'$or':_['map'](_0x3a16ba,function(_0x3ee764){if(_0x3ee764[_0xef61('0x32')]!==_0xef61('0x41')){var _0x508dc7={};_0x508dc7[_0x3ee764['name']]={'$like':'%'+_0x45ece2['query'][_0xef61('0x42')]+'%'};return _0x508dc7;}})});}_0x23837f=_[_0xef61('0x43')]({},_0x23837f,_0x45ece2['options']);var _0x41aaeb={'where':_0x23837f[_0xef61('0x40')]};return db[_0xef61('0x2f')][_0xef61('0x44')](_0x41aaeb)['then'](function(_0xbc7323){_0x1ee27b[_0xef61('0x44')]=_0xbc7323;if(_0x45ece2[_0xef61('0x35')][_0xef61('0x45')]){_0x23837f['include']=[{'all':!![]}];}return db['CmHopperBlack'][_0xef61('0x46')](_0x23837f);})[_0xef61('0x26')](function(_0xd4f102){_0x1ee27b['rows']=_0xd4f102;return _0x1ee27b;})[_0xef61('0x26')](respondWithFilteredResult(_0x258b5a,_0x23837f))[_0xef61('0x47')](handleError(_0x258b5a,null));};exports[_0xef61('0x48')]=function(_0x2a7a4d,_0x50bc00){var _0x545597={'raw':!![],'where':{'id':_0x2a7a4d[_0xef61('0x49')]['id']}},_0x52bbe3={};_0x52bbe3[_0xef61('0x34')]=_[_0xef61('0x4a')](db[_0xef61('0x2f')][_0xef61('0x30')]);_0x52bbe3[_0xef61('0x35')]=_[_0xef61('0x4a')](_0x2a7a4d['query']);_0x52bbe3[_0xef61('0x36')]=_[_0xef61('0x37')](_0x52bbe3[_0xef61('0x34')],_0x52bbe3[_0xef61('0x35')]);_0x545597['attributes']=_[_0xef61('0x37')](_0x52bbe3[_0xef61('0x34')],qs[_0xef61('0x39')](_0x2a7a4d[_0xef61('0x35')][_0xef61('0x39')]));_0x545597[_0xef61('0x38')]=_0x545597['attributes'][_0xef61('0x3a')]?_0x545597[_0xef61('0x38')]:_0x52bbe3[_0xef61('0x34')];if(_0x2a7a4d['query'][_0xef61('0x45')]){_0x545597[_0xef61('0x4b')]=[{'all':!![]}];}_0x545597=_[_0xef61('0x43')]({},_0x545597,_0x2a7a4d[_0xef61('0x4c')]);return db[_0xef61('0x2f')][_0xef61('0x4d')](_0x545597)['then'](handleEntityNotFound(_0x50bc00,null))[_0xef61('0x26')](respondWithResult(_0x50bc00,null))[_0xef61('0x47')](handleError(_0x50bc00,null));};exports['update']=function(_0xdb0ee8,_0x37da22){if(_0xdb0ee8[_0xef61('0x4e')]['id']){delete _0xdb0ee8[_0xef61('0x4e')]['id'];}return db['CmHopperBlack'][_0xef61('0x4d')]({'where':{'id':_0xdb0ee8[_0xef61('0x49')]['id']}})[_0xef61('0x26')](handleEntityNotFound(_0x37da22,null))['then'](saveUpdates(_0xdb0ee8[_0xef61('0x4e')],null))[_0xef61('0x26')](respondWithResult(_0x37da22,null))['catch'](handleError(_0x37da22,null));};exports[_0xef61('0x27')]=function(_0x132c77,_0x13d0f8){return db[_0xef61('0x2f')][_0xef61('0x4d')]({'where':{'id':_0x132c77[_0xef61('0x49')]['id']}})[_0xef61('0x26')](handleEntityNotFound(_0x13d0f8,null))['then'](removeEntity(_0x13d0f8,null))[_0xef61('0x47')](handleError(_0x13d0f8,null));};exports['describe']=function(_0x89c04e,_0x2444a4){return db[_0xef61('0x2f')][_0xef61('0x4f')]()[_0xef61('0x26')](respondWithResult(_0x2444a4,null))[_0xef61('0x47')](handleError(_0x2444a4,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index 532e9d6..872c434 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 _0x1de5=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./cmHopperBlack.attributes','exports','CmHopperBlack','cm_hopper_black'];(function(_0x1811dd,_0x2ea9a4){var _0x33debb=function(_0x3571cd){while(--_0x3571cd){_0x1811dd['push'](_0x1811dd['shift']());}};_0x33debb(++_0x2ea9a4);}(_0x1de5,0xe4));var _0x51de=function(_0x35da42,_0x5c2610){_0x35da42=_0x35da42-0x0;var _0x370035=_0x1de5[_0x35da42];return _0x370035;};'use strict';var _=require(_0x51de('0x0'));var util=require('util');var logger=require(_0x51de('0x1'))(_0x51de('0x2'));var moment=require(_0x51de('0x3'));var BPromise=require(_0x51de('0x4'));var rp=require(_0x51de('0x5'));var fs=require('fs');var path=require(_0x51de('0x6'));var rimraf=require('rimraf');var config=require(_0x51de('0x7'));var attributes=require(_0x51de('0x8'));module[_0x51de('0x9')]=function(_0x40a936,_0x4217f3){return _0x40a936['define'](_0x51de('0xa'),attributes,{'tableName':_0x51de('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6f43=['cm_hopper_black','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperBlack.attributes','define','CmHopperBlack'];(function(_0x593b37,_0x1c34be){var _0x58a45c=function(_0x21b2f2){while(--_0x21b2f2){_0x593b37['push'](_0x593b37['shift']());}};_0x58a45c(++_0x1c34be);}(_0x6f43,0x1bd));var _0x36f4=function(_0x967959,_0x53c5c1){_0x967959=_0x967959-0x0;var _0x5c4489=_0x6f43[_0x967959];return _0x5c4489;};'use strict';var _=require(_0x36f4('0x0'));var util=require('util');var logger=require(_0x36f4('0x1'))('api');var moment=require(_0x36f4('0x2'));var BPromise=require(_0x36f4('0x3'));var rp=require(_0x36f4('0x4'));var fs=require('fs');var path=require(_0x36f4('0x5'));var rimraf=require(_0x36f4('0x6'));var config=require(_0x36f4('0x7'));var attributes=require(_0x36f4('0x8'));module['exports']=function(_0x40762c,_0x4dbe52){return _0x40762c[_0x36f4('0x9')](_0x36f4('0xa'),attributes,{'tableName':_0x36f4('0xb'),'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 2df07c7..0b3aed1 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 _0x2439=['raw','where','attributes','limit','include','model','then','UpdateCmHopperBlack','update','DestroyCmHopperBlack','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','info','request\x20sent','debug','stringify','error','code','CmHopperBlack,\x20%s,\x20%s','message','result','catch','GetCmHopperBlack','CmHopperBlack','options'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x2439,0xbe));var _0x9243=function(_0x599e60,_0x5b6519){_0x599e60=_0x599e60-0x0;var _0x468e19=_0x2439[_0x599e60];return _0x468e19;};'use strict';var _=require(_0x9243('0x0'));var util=require(_0x9243('0x1'));var moment=require(_0x9243('0x2'));var BPromise=require(_0x9243('0x3'));var rs=require(_0x9243('0x4'));var fs=require('fs');var Redis=require(_0x9243('0x5'));var db=require(_0x9243('0x6'))['db'];var utils=require(_0x9243('0x7'));var logger=require(_0x9243('0x8'))(_0x9243('0x9'));var config=require(_0x9243('0xa'));var jayson=require('jayson/promise');var client=jayson['client'][_0x9243('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x16e345,_0x48fd25,_0x2336fc){return new BPromise(function(_0x30dcf0,_0x2ae000){return client[_0x9243('0xc')](_0x16e345,_0x2336fc)['then'](function(_0x3ac039){logger[_0x9243('0xd')]('CmHopperBlack,\x20%s,\x20%s',_0x48fd25,_0x9243('0xe'));logger[_0x9243('0xf')]('CmHopperBlack,\x20%s,\x20%s,\x20%s',_0x48fd25,_0x9243('0xe'),JSON[_0x9243('0x10')](_0x3ac039));if(_0x3ac039[_0x9243('0x11')]){if(_0x3ac039['error'][_0x9243('0x12')]===0x1f4){logger[_0x9243('0x11')](_0x9243('0x13'),_0x48fd25,_0x3ac039[_0x9243('0x11')]['message']);return _0x2ae000(_0x3ac039[_0x9243('0x11')][_0x9243('0x14')]);}logger['error']('CmHopperBlack,\x20%s,\x20%s',_0x48fd25,_0x3ac039['error'][_0x9243('0x14')]);return _0x30dcf0(_0x3ac039[_0x9243('0x11')][_0x9243('0x14')]);}else{logger[_0x9243('0xd')]('CmHopperBlack,\x20%s,\x20%s',_0x48fd25,'request\x20sent');_0x30dcf0(_0x3ac039[_0x9243('0x15')][_0x9243('0x14')]);}})[_0x9243('0x16')](function(_0x4cfef8){logger[_0x9243('0x11')]('CmHopperBlack,\x20%s,\x20%s',_0x48fd25,_0x4cfef8);_0x2ae000(_0x4cfef8);});});}exports[_0x9243('0x17')]=function(_0x1d5f5a){var _0x20ff20=this;return new Promise(function(_0x23d18c,_0x39636e){return db[_0x9243('0x18')]['findAll']({'raw':_0x1d5f5a['options']?_0x1d5f5a[_0x9243('0x19')][_0x9243('0x1a')]===undefined?!![]:![]:!![],'where':_0x1d5f5a[_0x9243('0x19')]?_0x1d5f5a[_0x9243('0x19')][_0x9243('0x1b')]||null:null,'attributes':_0x1d5f5a[_0x9243('0x19')]?_0x1d5f5a[_0x9243('0x19')][_0x9243('0x1c')]||null:null,'limit':_0x1d5f5a['options']?_0x1d5f5a[_0x9243('0x19')][_0x9243('0x1d')]||null:null,'include':_0x1d5f5a[_0x9243('0x19')]?_0x1d5f5a['options'][_0x9243('0x1e')]?_['map'](_0x1d5f5a[_0x9243('0x19')][_0x9243('0x1e')],function(_0x51a17e){return{'model':db[_0x51a17e['model']],'as':_0x51a17e['as'],'attributes':_0x51a17e[_0x9243('0x1c')],'include':_0x51a17e[_0x9243('0x1e')]?_['map'](_0x51a17e['include'],function(_0x26e971){return{'model':db[_0x26e971[_0x9243('0x1f')]],'as':_0x26e971['as'],'attributes':_0x26e971[_0x9243('0x1c')],'include':_0x26e971[_0x9243('0x1e')]?_['map'](_0x26e971['include'],function(_0x338bd3){return{'model':db[_0x338bd3[_0x9243('0x1f')]],'as':_0x338bd3['as'],'attributes':_0x338bd3[_0x9243('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x9243('0x20')](function(_0x4aa939){logger[_0x9243('0xd')]('GetCmHopperBlack',_0x1d5f5a);logger[_0x9243('0xf')](_0x9243('0x17'),_0x1d5f5a,JSON[_0x9243('0x10')](_0x4aa939));_0x23d18c(_0x4aa939);})[_0x9243('0x16')](function(_0x75ad46){logger[_0x9243('0x11')](_0x9243('0x17'),_0x75ad46[_0x9243('0x14')],_0x1d5f5a);_0x39636e(_0x20ff20[_0x9243('0x11')](0x1f4,_0x75ad46[_0x9243('0x14')]));});});};exports[_0x9243('0x21')]=function(_0x3040de){var _0x2d4d9d=this;return new Promise(function(_0x5edae6,_0x489eb9){return db[_0x9243('0x18')][_0x9243('0x22')](_0x3040de['body'],{'raw':_0x3040de['options']?_0x3040de[_0x9243('0x19')][_0x9243('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3040de[_0x9243('0x19')]?_0x3040de[_0x9243('0x19')]['where']||null:null,'attributes':_0x3040de[_0x9243('0x19')]?_0x3040de['options'][_0x9243('0x1c')]||null:null,'limit':_0x3040de['options']?_0x3040de['options']['limit']||null:null})[_0x9243('0x20')](function(_0x56f0c2){logger[_0x9243('0xd')](_0x9243('0x21'),_0x3040de);logger['debug'](_0x9243('0x21'),_0x3040de,JSON[_0x9243('0x10')](_0x56f0c2));_0x5edae6(_0x56f0c2);})[_0x9243('0x16')](function(_0x2ea9ad){logger[_0x9243('0x11')](_0x9243('0x21'),_0x2ea9ad[_0x9243('0x14')],_0x3040de);_0x489eb9(_0x2d4d9d[_0x9243('0x11')](0x1f4,_0x2ea9ad[_0x9243('0x14')]));});});};exports['DestroyCmHopperBlack']=function(_0x38991d){var _0x127c66=this;return new Promise(function(_0x2b6af8,_0x57e41c){return db[_0x9243('0x18')]['destroy']({'where':_0x38991d[_0x9243('0x19')]?_0x38991d[_0x9243('0x19')][_0x9243('0x1b')]||null:null})[_0x9243('0x20')](function(_0x48a317){logger[_0x9243('0xd')](_0x9243('0x23'),_0x38991d);logger['debug'](_0x9243('0x23'),_0x38991d,JSON['stringify'](_0x48a317));_0x2b6af8(_0x48a317);})[_0x9243('0x16')](function(_0x19db6e){logger['error']('DestroyCmHopperBlack',_0x19db6e[_0x9243('0x14')],_0x38991d);_0x57e41c(_0x127c66[_0x9243('0x11')](0x1f4,_0x19db6e['message']));});});}; \ No newline at end of file +var _0xfddd=['where','attributes','limit','include','map','model','then','UpdateCmHopperBlack','update','body','DestroyCmHopperBlack','destroy','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetCmHopperBlack','CmHopperBlack','findAll','options','raw'];(function(_0x24b3fd,_0x3d7922){var _0x5bebf4=function(_0x39dfdc){while(--_0x39dfdc){_0x24b3fd['push'](_0x24b3fd['shift']());}};_0x5bebf4(++_0x3d7922);}(_0xfddd,0xd9));var _0xdfdd=function(_0x4841a9,_0x5e2343){_0x4841a9=_0x4841a9-0x0;var _0x3e52aa=_0xfddd[_0x4841a9];return _0x3e52aa;};'use strict';var _=require(_0xdfdd('0x0'));var util=require(_0xdfdd('0x1'));var moment=require('moment');var BPromise=require(_0xdfdd('0x2'));var rs=require(_0xdfdd('0x3'));var fs=require('fs');var Redis=require(_0xdfdd('0x4'));var db=require(_0xdfdd('0x5'))['db'];var utils=require(_0xdfdd('0x6'));var logger=require(_0xdfdd('0x7'))(_0xdfdd('0x8'));var config=require(_0xdfdd('0x9'));var jayson=require(_0xdfdd('0xa'));var client=jayson[_0xdfdd('0xb')][_0xdfdd('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3e658f,_0x5e7a1d,_0x1d4012){return new BPromise(function(_0x872115,_0x36dd58){return client[_0xdfdd('0xd')](_0x3e658f,_0x1d4012)['then'](function(_0x122066){logger[_0xdfdd('0xe')](_0xdfdd('0xf'),_0x5e7a1d,_0xdfdd('0x10'));logger[_0xdfdd('0x11')](_0xdfdd('0x12'),_0x5e7a1d,_0xdfdd('0x10'),JSON[_0xdfdd('0x13')](_0x122066));if(_0x122066[_0xdfdd('0x14')]){if(_0x122066[_0xdfdd('0x14')][_0xdfdd('0x15')]===0x1f4){logger['error'](_0xdfdd('0xf'),_0x5e7a1d,_0x122066['error'][_0xdfdd('0x16')]);return _0x36dd58(_0x122066[_0xdfdd('0x14')]['message']);}logger['error']('CmHopperBlack,\x20%s,\x20%s',_0x5e7a1d,_0x122066['error'][_0xdfdd('0x16')]);return _0x872115(_0x122066[_0xdfdd('0x14')]['message']);}else{logger['info'](_0xdfdd('0xf'),_0x5e7a1d,_0xdfdd('0x10'));_0x872115(_0x122066['result'][_0xdfdd('0x16')]);}})[_0xdfdd('0x17')](function(_0x8a84){logger[_0xdfdd('0x14')]('CmHopperBlack,\x20%s,\x20%s',_0x5e7a1d,_0x8a84);_0x36dd58(_0x8a84);});});}exports[_0xdfdd('0x18')]=function(_0x5d91d0){var _0x2867f0=this;return new Promise(function(_0x479d08,_0x2e5eb6){return db[_0xdfdd('0x19')][_0xdfdd('0x1a')]({'raw':_0x5d91d0[_0xdfdd('0x1b')]?_0x5d91d0[_0xdfdd('0x1b')][_0xdfdd('0x1c')]===undefined?!![]:![]:!![],'where':_0x5d91d0[_0xdfdd('0x1b')]?_0x5d91d0[_0xdfdd('0x1b')][_0xdfdd('0x1d')]||null:null,'attributes':_0x5d91d0[_0xdfdd('0x1b')]?_0x5d91d0[_0xdfdd('0x1b')][_0xdfdd('0x1e')]||null:null,'limit':_0x5d91d0[_0xdfdd('0x1b')]?_0x5d91d0[_0xdfdd('0x1b')][_0xdfdd('0x1f')]||null:null,'include':_0x5d91d0[_0xdfdd('0x1b')]?_0x5d91d0['options'][_0xdfdd('0x20')]?_[_0xdfdd('0x21')](_0x5d91d0[_0xdfdd('0x1b')]['include'],function(_0x37ba78){return{'model':db[_0x37ba78['model']],'as':_0x37ba78['as'],'attributes':_0x37ba78['attributes'],'include':_0x37ba78[_0xdfdd('0x20')]?_[_0xdfdd('0x21')](_0x37ba78[_0xdfdd('0x20')],function(_0x24b5e6){return{'model':db[_0x24b5e6[_0xdfdd('0x22')]],'as':_0x24b5e6['as'],'attributes':_0x24b5e6['attributes'],'include':_0x24b5e6[_0xdfdd('0x20')]?_[_0xdfdd('0x21')](_0x24b5e6[_0xdfdd('0x20')],function(_0xdc72b9){return{'model':db[_0xdc72b9[_0xdfdd('0x22')]],'as':_0xdc72b9['as'],'attributes':_0xdc72b9[_0xdfdd('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xdfdd('0x23')](function(_0x469876){logger[_0xdfdd('0xe')](_0xdfdd('0x18'),_0x5d91d0);logger[_0xdfdd('0x11')](_0xdfdd('0x18'),_0x5d91d0,JSON['stringify'](_0x469876));_0x479d08(_0x469876);})[_0xdfdd('0x17')](function(_0x4e3caf){logger[_0xdfdd('0x14')](_0xdfdd('0x18'),_0x4e3caf[_0xdfdd('0x16')],_0x5d91d0);_0x2e5eb6(_0x2867f0[_0xdfdd('0x14')](0x1f4,_0x4e3caf['message']));});});};exports[_0xdfdd('0x24')]=function(_0x188e0b){var _0x14cc62=this;return new Promise(function(_0x545a44,_0x45b268){return db[_0xdfdd('0x19')][_0xdfdd('0x25')](_0x188e0b[_0xdfdd('0x26')],{'raw':_0x188e0b[_0xdfdd('0x1b')]?_0x188e0b[_0xdfdd('0x1b')][_0xdfdd('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x188e0b[_0xdfdd('0x1b')]?_0x188e0b[_0xdfdd('0x1b')][_0xdfdd('0x1d')]||null:null,'attributes':_0x188e0b[_0xdfdd('0x1b')]?_0x188e0b[_0xdfdd('0x1b')][_0xdfdd('0x1e')]||null:null,'limit':_0x188e0b[_0xdfdd('0x1b')]?_0x188e0b[_0xdfdd('0x1b')][_0xdfdd('0x1f')]||null:null})[_0xdfdd('0x23')](function(_0x5cd695){logger[_0xdfdd('0xe')]('UpdateCmHopperBlack',_0x188e0b);logger['debug'](_0xdfdd('0x24'),_0x188e0b,JSON[_0xdfdd('0x13')](_0x5cd695));_0x545a44(_0x5cd695);})[_0xdfdd('0x17')](function(_0x334b15){logger[_0xdfdd('0x14')](_0xdfdd('0x24'),_0x334b15[_0xdfdd('0x16')],_0x188e0b);_0x45b268(_0x14cc62[_0xdfdd('0x14')](0x1f4,_0x334b15[_0xdfdd('0x16')]));});});};exports[_0xdfdd('0x27')]=function(_0x39c20a){var _0x138204=this;return new Promise(function(_0x4f1375,_0x5ccb1b){return db[_0xdfdd('0x19')][_0xdfdd('0x28')]({'where':_0x39c20a['options']?_0x39c20a[_0xdfdd('0x1b')][_0xdfdd('0x1d')]||null:null})['then'](function(_0x4e9b2e){logger[_0xdfdd('0xe')](_0xdfdd('0x27'),_0x39c20a);logger['debug']('DestroyCmHopperBlack',_0x39c20a,JSON[_0xdfdd('0x13')](_0x4e9b2e));_0x4f1375(_0x4e9b2e);})[_0xdfdd('0x17')](function(_0x4b4663){logger[_0xdfdd('0x14')](_0xdfdd('0x27'),_0x4b4663[_0xdfdd('0x16')],_0x39c20a);_0x5ccb1b(_0x138204[_0xdfdd('0x14')](0x1f4,_0x4b4663[_0xdfdd('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 579107d..ee9732b 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 _0x9a19=['/describe','/:id','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','get','isAuthenticated','index'];(function(_0x2fa11f,_0x2e47cb){var _0xe2e74e=function(_0x2452e5){while(--_0x2452e5){_0x2fa11f['push'](_0x2fa11f['shift']());}};_0xe2e74e(++_0x2e47cb);}(_0x9a19,0x114));var _0x99a1=function(_0x3df9dd,_0x26f5cd){_0x3df9dd=_0x3df9dd-0x0;var _0x4f11e4=_0x9a19[_0x3df9dd];return _0x4f11e4;};'use strict';var multer=require(_0x99a1('0x0'));var util=require(_0x99a1('0x1'));var path=require(_0x99a1('0x2'));var timeout=require('connect-timeout');var express=require(_0x99a1('0x3'));var router=express[_0x99a1('0x4')]();var auth=require(_0x99a1('0x5'));var interaction=require(_0x99a1('0x6'));var config=require(_0x99a1('0x7'));var controller=require(_0x99a1('0x8'));router[_0x99a1('0x9')]('/',auth[_0x99a1('0xa')](),controller[_0x99a1('0xb')]);router[_0x99a1('0x9')](_0x99a1('0xc'),auth['isAuthenticated'](),controller['describe']);router['get'](_0x99a1('0xd'),auth[_0x99a1('0xa')](),controller['show']);router['put'](_0x99a1('0xd'),auth[_0x99a1('0xa')](),controller[_0x99a1('0xe')]);router[_0x99a1('0xf')](_0x99a1('0xd'),auth['isAuthenticated'](),controller[_0x99a1('0x10')]);module[_0x99a1('0x11')]=router; \ No newline at end of file +var _0xd6d6=['./cmHopperBlack.controller','get','isAuthenticated','/describe','describe','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0xa417ff,_0x2ab57c){var _0x2c0a82=function(_0x118e47){while(--_0x118e47){_0xa417ff['push'](_0xa417ff['shift']());}};_0x2c0a82(++_0x2ab57c);}(_0xd6d6,0xbe));var _0x6d6d=function(_0x47ca1a,_0x5dafcb){_0x47ca1a=_0x47ca1a-0x0;var _0x5254b9=_0xd6d6[_0x47ca1a];return _0x5254b9;};'use strict';var multer=require(_0x6d6d('0x0'));var util=require(_0x6d6d('0x1'));var path=require(_0x6d6d('0x2'));var timeout=require(_0x6d6d('0x3'));var express=require('express');var router=express[_0x6d6d('0x4')]();var auth=require(_0x6d6d('0x5'));var interaction=require(_0x6d6d('0x6'));var config=require(_0x6d6d('0x7'));var controller=require(_0x6d6d('0x8'));router[_0x6d6d('0x9')]('/',auth[_0x6d6d('0xa')](),controller['index']);router[_0x6d6d('0x9')](_0x6d6d('0xb'),auth[_0x6d6d('0xa')](),controller[_0x6d6d('0xc')]);router[_0x6d6d('0x9')](_0x6d6d('0xd'),auth[_0x6d6d('0xa')](),controller['show']);router['put'](_0x6d6d('0xd'),auth[_0x6d6d('0xa')](),controller[_0x6d6d('0xe')]);router[_0x6d6d('0xf')](_0x6d6d('0xd'),auth['isAuthenticated'](),controller[_0x6d6d('0x10')]);module[_0x6d6d('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index 0877fd6..18e8868 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 _0xcd0b=['STRING','DATE','INTEGER','getDataValue','endtime','setDataValue','followuptime','diff','dispositionat','BOOLEAN','sequelize','moment'];(function(_0x5d2d8c,_0x332d36){var _0x4b4701=function(_0x1ded62){while(--_0x1ded62){_0x5d2d8c['push'](_0x5d2d8c['shift']());}};_0x4b4701(++_0x332d36);}(_0xcd0b,0x14e));var _0xbcd0=function(_0x99bfe7,_0x2a9a92){_0x99bfe7=_0x99bfe7-0x0;var _0x33988c=_0xcd0b[_0x99bfe7];return _0x33988c;};'use strict';var Sequelize=require(_0xbcd0('0x0'));var moment=require(_0xbcd0('0x1'));module['exports']={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0xbcd0('0x2')]},'scheduledat':{'type':Sequelize[_0xbcd0('0x3')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xbcd0('0x4')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xbcd0('0x4')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xbcd0('0x4')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xbcd0('0x2')]},'originatecalleridnum':{'type':Sequelize[_0xbcd0('0x2')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xbcd0('0x2')]},'calleridname':{'type':Sequelize[_0xbcd0('0x2')]},'starttime':{'type':Sequelize[_0xbcd0('0x3')]},'responsetime':{'type':Sequelize[_0xbcd0('0x3')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0xbcd0('0x3')]},'endtime':{'type':Sequelize[_0xbcd0('0x3')]},'ringtime':{'type':Sequelize[_0xbcd0('0x4')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xbcd0('0x4')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xbcd0('0x4')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xbcd0('0x2')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0xbcd0('0x2')]},'membername':{'type':Sequelize[_0xbcd0('0x2')]},'reason':{'type':Sequelize[_0xbcd0('0x2')]},'disposition':{'type':Sequelize[_0xbcd0('0x2')]},'dispositionat':{'type':Sequelize['DATE'],'set':function(_0x360146){var _0x2d69c4=this[_0xbcd0('0x5')](_0xbcd0('0x6'));if(_0x2d69c4&&_0x360146){this[_0xbcd0('0x7')](_0xbcd0('0x8'),moment(_0x360146)[_0xbcd0('0x9')](moment(_0x2d69c4),'seconds'));}return this[_0xbcd0('0x7')](_0xbcd0('0xa'),_0x360146);}},'amd':{'type':Sequelize[_0xbcd0('0xb')],'defaultValue':![]},'fax':{'type':Sequelize[_0xbcd0('0xb')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0xbcd0('0xb')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0xbcd0('0xb')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0xbcd0('0x3')]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xbcd0('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xbcd0('0x3')]},'deleted':{'type':Sequelize['STRING'],'defaultValue':null},'deletedat':{'type':Sequelize[_0xbcd0('0x3')]},'recallme':{'type':Sequelize[_0xbcd0('0xb')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0xbcd0('0x3')]},'countnosuchnumberretry':{'type':Sequelize[_0xbcd0('0x4')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xbcd0('0x4')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xbcd0('0x4')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xbcd0('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x6c8e=['exports','INTEGER','STRING','DATE','endtime','followuptime','diff','setDataValue','BOOLEAN','moment'];(function(_0x426fb8,_0x4ba911){var _0x5aaa41=function(_0x347f99){while(--_0x347f99){_0x426fb8['push'](_0x426fb8['shift']());}};_0x5aaa41(++_0x4ba911);}(_0x6c8e,0x167));var _0xe6c8=function(_0x546a50,_0x290fee){_0x546a50=_0x546a50-0x0;var _0x2c6eae=_0x6c8e[_0x546a50];return _0x2c6eae;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xe6c8('0x0'));module[_0xe6c8('0x1')]={'state':{'type':Sequelize[_0xe6c8('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xe6c8('0x3')]},'scheduledat':{'type':Sequelize[_0xe6c8('0x4')]},'countbusyretry':{'type':Sequelize[_0xe6c8('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xe6c8('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xe6c8('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xe6c8('0x3')]},'originatecalleridnum':{'type':Sequelize[_0xe6c8('0x3')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xe6c8('0x3')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xe6c8('0x4')]},'responsetime':{'type':Sequelize[_0xe6c8('0x4')]},'answertime':{'type':Sequelize[_0xe6c8('0x4')]},'droptime':{'type':Sequelize[_0xe6c8('0x4')]},'endtime':{'type':Sequelize[_0xe6c8('0x4')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xe6c8('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xe6c8('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xe6c8('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xe6c8('0x3')]},'campaign':{'type':Sequelize[_0xe6c8('0x3')]},'campaigntype':{'type':Sequelize[_0xe6c8('0x3')]},'membername':{'type':Sequelize[_0xe6c8('0x3')]},'reason':{'type':Sequelize[_0xe6c8('0x3')]},'disposition':{'type':Sequelize[_0xe6c8('0x3')]},'dispositionat':{'type':Sequelize[_0xe6c8('0x4')],'set':function(_0x2cacef){var _0x23dd46=this['getDataValue'](_0xe6c8('0x5'));if(_0x23dd46&&_0x2cacef){this['setDataValue'](_0xe6c8('0x6'),moment(_0x2cacef)[_0xe6c8('0x7')](moment(_0x23dd46),'seconds'));}return this[_0xe6c8('0x8')]('dispositionat',_0x2cacef);}},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0xe6c8('0x9')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0xe6c8('0x9')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0xe6c8('0x9')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0xe6c8('0x4')]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0xe6c8('0x4')]},'deleted':{'type':Sequelize[_0xe6c8('0x3')],'defaultValue':null},'deletedat':{'type':Sequelize[_0xe6c8('0x4')]},'recallme':{'type':Sequelize[_0xe6c8('0x9')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0xe6c8('0x4')]},'countnosuchnumberretry':{'type':Sequelize[_0xe6c8('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xe6c8('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xe6c8('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xe6c8('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.controller.js b/server/api/cmHopperFinal/cmHopperFinal.controller.js index 1d86b22..33f3e61 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 _0x192f=['fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','include','findAll','rows','show','params','includeAll','catch','uniqueid','find','body','countContactsQueueCampaignHopperFinal','sequelize','COUNT','literal','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','`state`\x20=\x2011\x20,\x201,\x20null','`state`\x20=\x2022,\x201,\x20null','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','abandonedContacts','reCallContacts','moveContactsQueueCampaignHopperFinal','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','VoiceQueueId','select','field','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','NOW()','createdAt','from','VoiceQueueId\x20=\x20?','toString','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','Campaign','ListId','CampaignId','updatedAt','cm_hopper_final','CampaignId\x20=\x20?','state\x20=\x20?','findOne','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','Content-Range','apply','reject','save','then','error','stack','name','send','map','CmHopperFinal','rawAttributes'];(function(_0x4e622f,_0x4c849f){var _0xd04c3f=function(_0x5f5068){while(--_0x5f5068){_0x4e622f['push'](_0x4e622f['shift']());}};_0xd04c3f(++_0x4c849f);}(_0x192f,0xd6));var _0xf192=function(_0x214f76,_0x378f9d){_0x214f76=_0x214f76-0x0;var _0x659066=_0x192f[_0x214f76];return _0x659066;};'use strict';var pdf=require(_0xf192('0x0'));var emlformat=require(_0xf192('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xf192('0x2'));var jsonpatch=require(_0xf192('0x3'));var rp=require(_0xf192('0x4'));var moment=require(_0xf192('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xf192('0x6'));var util=require(_0xf192('0x7'));var path=require(_0xf192('0x8'));var sox=require('sox');var csv=require(_0xf192('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xf192('0xa'));var squel=require(_0xf192('0xb'));var crypto=require(_0xf192('0xc'));var jsforce=require(_0xf192('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xf192('0xe'));var Papa=require(_0xf192('0xf'));var Redis=require('ioredis');var authService=require(_0xf192('0x10'));var qs=require(_0xf192('0x11'));var as=require(_0xf192('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf192('0x13'))(_0xf192('0x14'));var utils=require(_0xf192('0x15'));var config=require(_0xf192('0x16'));var db=require(_0xf192('0x17'))['db'];function respondWithStatusCode(_0xa3d944,_0x1d38f8){_0x1d38f8=_0x1d38f8||0xcc;return function(_0x3a809c){if(_0x3a809c){return _0xa3d944[_0xf192('0x18')](_0x1d38f8);}return _0xa3d944[_0xf192('0x19')](_0x1d38f8)[_0xf192('0x1a')]();};}function respondWithResult(_0x4f8bf9,_0x166f66){_0x166f66=_0x166f66||0xc8;return function(_0x28ef67){if(_0x28ef67){return _0x4f8bf9[_0xf192('0x19')](_0x166f66)[_0xf192('0x1b')](_0x28ef67);}};}function respondWithFilteredResult(_0x34b81e,_0x2a1a1b){return function(_0x6b040a){if(_0x6b040a){var _0x33f49d=_0x6b040a[_0xf192('0x1c')],_0x5a889d=_0x2a1a1b['offset'],_0x45d14e=_0x2a1a1b[_0xf192('0x1d')]+_0x2a1a1b['limit'],_0x4e5580;if(_0x45d14e>=_0x33f49d){_0x45d14e=_0x33f49d;_0x4e5580=0xc8;}else{_0x4e5580=0xce;}_0x34b81e[_0xf192('0x19')](_0x4e5580);return _0x34b81e['set'](_0xf192('0x1e'),_0x5a889d+'-'+_0x45d14e+'/'+_0x33f49d)[_0xf192('0x1b')](_0x6b040a);}return null;};}function patchUpdates(_0x4c92fb){return function(_0x5433ce){try{jsonpatch[_0xf192('0x1f')](_0x5433ce,_0x4c92fb,!![]);}catch(_0x5c19e0){return BPromise[_0xf192('0x20')](_0x5c19e0);}return _0x5433ce[_0xf192('0x21')]();};}function saveUpdates(_0x4c2a0f,_0x205249){return function(_0xa89315){if(_0xa89315){return _0xa89315['update'](_0x4c2a0f)['then'](function(_0x212dce){return _0x212dce;});}return null;};}function removeEntity(_0x997e79,_0x19626f){return function(_0xf4a97){if(_0xf4a97){return _0xf4a97['destroy']()[_0xf192('0x22')](function(){_0x997e79[_0xf192('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x980206,_0x57e073){return function(_0x4a8a7e){if(!_0x4a8a7e){_0x980206[_0xf192('0x18')](0x194);}return _0x4a8a7e;};}function handleError(_0x3784bb,_0x31daaa){_0x31daaa=_0x31daaa||0x1f4;return function(_0x2492f1){logger[_0xf192('0x23')](_0x2492f1[_0xf192('0x24')]);if(_0x2492f1[_0xf192('0x25')]){delete _0x2492f1[_0xf192('0x25')];}_0x3784bb[_0xf192('0x19')](_0x31daaa)[_0xf192('0x26')](_0x2492f1);};}exports['index']=function(_0x12c1b8,_0xc9b554){var _0x1c07af={},_0x4ba5bf={},_0x4a7793={'count':0x0,'rows':[]};var _0x146ce4=_[_0xf192('0x27')](db[_0xf192('0x28')][_0xf192('0x29')],function(_0x10cada){return{'name':_0x10cada[_0xf192('0x2a')],'type':_0x10cada['type'][_0xf192('0x2b')]};});_0x4ba5bf[_0xf192('0x2c')]=_[_0xf192('0x27')](_0x146ce4,'name');_0x4ba5bf[_0xf192('0x2d')]=_[_0xf192('0x2e')](_0x12c1b8['query']);_0x4ba5bf[_0xf192('0x2f')]=_[_0xf192('0x30')](_0x4ba5bf[_0xf192('0x2c')],_0x4ba5bf[_0xf192('0x2d')]);_0x1c07af['attributes']=_[_0xf192('0x30')](_0x4ba5bf['model'],qs[_0xf192('0x31')](_0x12c1b8[_0xf192('0x2d')]['fields']));_0x1c07af[_0xf192('0x32')]=_0x1c07af['attributes'][_0xf192('0x33')]?_0x1c07af[_0xf192('0x32')]:_0x4ba5bf['model'];if(!_0x12c1b8[_0xf192('0x2d')][_0xf192('0x34')](_0xf192('0x35'))){_0x1c07af[_0xf192('0x36')]=qs[_0xf192('0x36')](_0x12c1b8[_0xf192('0x2d')][_0xf192('0x36')]);_0x1c07af['offset']=qs['offset'](_0x12c1b8[_0xf192('0x2d')][_0xf192('0x1d')]);}_0x1c07af[_0xf192('0x37')]=qs[_0xf192('0x38')](_0x12c1b8[_0xf192('0x2d')][_0xf192('0x38')]);_0x1c07af[_0xf192('0x39')]=qs[_0xf192('0x2f')](_[_0xf192('0x3a')](_0x12c1b8['query'],_0x4ba5bf[_0xf192('0x2f')]));if(_0x12c1b8[_0xf192('0x2d')][_0xf192('0x3b')]){_0x1c07af[_0xf192('0x39')]=_['merge'](_0x1c07af['where'],{'$or':_[_0xf192('0x27')](_0x146ce4,function(_0x46af04){if(_0x46af04[_0xf192('0x3c')]!==_0xf192('0x3d')){var _0x299d11={};_0x299d11[_0x46af04[_0xf192('0x25')]]={'$like':'%'+_0x12c1b8[_0xf192('0x2d')][_0xf192('0x3b')]+'%'};return _0x299d11;}})});}_0x1c07af=_[_0xf192('0x3e')]({},_0x1c07af,_0x12c1b8[_0xf192('0x3f')]);var _0x2443ed={'where':_0x1c07af[_0xf192('0x39')]};return db[_0xf192('0x28')][_0xf192('0x1c')](_0x2443ed)[_0xf192('0x22')](function(_0x5931cd){_0x4a7793[_0xf192('0x1c')]=_0x5931cd;if(_0x12c1b8[_0xf192('0x2d')]['includeAll']){_0x1c07af[_0xf192('0x40')]=[{'all':!![]}];}return db[_0xf192('0x28')][_0xf192('0x41')](_0x1c07af);})[_0xf192('0x22')](function(_0x203959){_0x4a7793[_0xf192('0x42')]=_0x203959;return _0x4a7793;})[_0xf192('0x22')](respondWithFilteredResult(_0xc9b554,_0x1c07af))['catch'](handleError(_0xc9b554,null));};exports[_0xf192('0x43')]=function(_0x20d4dd,_0x47cf15){var _0x2b9329={'raw':!![],'where':{'id':_0x20d4dd[_0xf192('0x44')]['id']}},_0x1a7a14={};_0x1a7a14[_0xf192('0x2c')]=_[_0xf192('0x2e')](db['CmHopperFinal'][_0xf192('0x29')]);_0x1a7a14[_0xf192('0x2d')]=_['keys'](_0x20d4dd[_0xf192('0x2d')]);_0x1a7a14[_0xf192('0x2f')]=_[_0xf192('0x30')](_0x1a7a14[_0xf192('0x2c')],_0x1a7a14[_0xf192('0x2d')]);_0x2b9329['attributes']=_[_0xf192('0x30')](_0x1a7a14[_0xf192('0x2c')],qs[_0xf192('0x31')](_0x20d4dd[_0xf192('0x2d')][_0xf192('0x31')]));_0x2b9329['attributes']=_0x2b9329[_0xf192('0x32')][_0xf192('0x33')]?_0x2b9329[_0xf192('0x32')]:_0x1a7a14[_0xf192('0x2c')];if(_0x20d4dd[_0xf192('0x2d')][_0xf192('0x45')]){_0x2b9329[_0xf192('0x40')]=[{'all':!![]}];}_0x2b9329=_[_0xf192('0x3e')]({},_0x2b9329,_0x20d4dd['options']);return db[_0xf192('0x28')]['find'](_0x2b9329)['then'](handleEntityNotFound(_0x47cf15,null))[_0xf192('0x22')](respondWithResult(_0x47cf15,null))[_0xf192('0x46')](handleError(_0x47cf15,null));};exports['describe']=function(_0x14ddf7,_0x3202bc){return db[_0xf192('0x28')]['describe']()[_0xf192('0x22')](respondWithResult(_0x3202bc,null))['catch'](handleError(_0x3202bc,null));};exports['update']=function(_0x44a766,_0x39e55a){if(_0x44a766['body'][_0xf192('0x47')]){delete _0x44a766['body']['uniqueid'];}return db[_0xf192('0x28')][_0xf192('0x48')]({'where':{'uniqueid':_0x44a766[_0xf192('0x44')]['id']}})['then'](handleEntityNotFound(_0x39e55a,null))[_0xf192('0x22')](saveUpdates(_0x44a766[_0xf192('0x49')],null))[_0xf192('0x22')](respondWithResult(_0x39e55a,null))[_0xf192('0x46')](handleError(_0x39e55a,null));};exports[_0xf192('0x4a')]=function(_0x525739,_0x2d1cb6,_0x11db69){return db[_0xf192('0x28')][_0xf192('0x41')]({'raw':![],'where':{'VoiceQueueId':_0x525739[_0xf192('0x44')]['id']},'attributes':[[db[_0xf192('0x4b')]['fn'](_0xf192('0x4c'),db[_0xf192('0x4b')]['fn']('IF',db['sequelize'][_0xf192('0x4d')]('`state`\x20=\x200,\x201,\x20null'))),_0xf192('0x4e')],[db['sequelize']['fn']('COUNT',db[_0xf192('0x4b')]['fn']('IF',db[_0xf192('0x4b')][_0xf192('0x4d')](_0xf192('0x4f')))),_0xf192('0x50')],[db[_0xf192('0x4b')]['fn']('COUNT',db[_0xf192('0x4b')]['fn']('IF',db[_0xf192('0x4b')][_0xf192('0x4d')](_0xf192('0x51')))),_0xf192('0x52')],[db[_0xf192('0x4b')]['fn'](_0xf192('0x4c'),db['sequelize']['fn']('IF',db[_0xf192('0x4b')][_0xf192('0x4d')](_0xf192('0x53')))),_0xf192('0x54')],[db['sequelize']['fn'](_0xf192('0x4c'),db['sequelize']['fn']('IF',db[_0xf192('0x4b')]['literal'](_0xf192('0x55')))),_0xf192('0x56')],[db[_0xf192('0x4b')]['fn'](_0xf192('0x4c'),db[_0xf192('0x4b')]['fn']('IF',db[_0xf192('0x4b')]['literal'](_0xf192('0x57')))),'abandonedContacts'],[db['sequelize']['fn'](_0xf192('0x4c'),db[_0xf192('0x4b')]['fn']('IF',db[_0xf192('0x4b')][_0xf192('0x4d')](_0xf192('0x58')))),'reCallContacts'],[db[_0xf192('0x4b')]['fn'](_0xf192('0x4c'),db[_0xf192('0x4b')]['fn']('IF',db[_0xf192('0x4b')][_0xf192('0x4d')](_0xf192('0x59')))),_0xf192('0x5a')]]})['then'](handleEntityNotFound(_0x2d1cb6,null))['then'](respondWithResult(_0x2d1cb6,null))[_0xf192('0x46')](handleError(_0x2d1cb6,null));};exports[_0xf192('0x5b')]=function(_0x21a7b8,_0x3b43b4,_0x3b88fd){return db[_0xf192('0x28')][_0xf192('0x41')]({'raw':![],'where':{'CampaignId':_0x21a7b8[_0xf192('0x44')]['id']},'attributes':[[db[_0xf192('0x4b')]['fn'](_0xf192('0x4c'),db[_0xf192('0x4b')]['fn']('IF',db['sequelize'][_0xf192('0x4d')]('`state`\x20=\x200,\x201,\x20null'))),_0xf192('0x4e')],[db[_0xf192('0x4b')]['fn'](_0xf192('0x4c'),db[_0xf192('0x4b')]['fn']('IF',db[_0xf192('0x4b')][_0xf192('0x4d')](_0xf192('0x4f')))),_0xf192('0x50')],[db[_0xf192('0x4b')]['fn'](_0xf192('0x4c'),db[_0xf192('0x4b')]['fn']('IF',db[_0xf192('0x4b')][_0xf192('0x4d')](_0xf192('0x51')))),_0xf192('0x52')],[db[_0xf192('0x4b')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0xf192('0x4d')]('`state`\x20=\x208,\x201,\x20null'))),_0xf192('0x54')],[db[_0xf192('0x4b')]['fn'](_0xf192('0x4c'),db[_0xf192('0x4b')]['fn']('IF',db[_0xf192('0x4b')][_0xf192('0x4d')](_0xf192('0x55')))),_0xf192('0x56')],[db['sequelize']['fn'](_0xf192('0x4c'),db[_0xf192('0x4b')]['fn']('IF',db[_0xf192('0x4b')]['literal'](_0xf192('0x57')))),_0xf192('0x5c')],[db[_0xf192('0x4b')]['fn'](_0xf192('0x4c'),db['sequelize']['fn']('IF',db[_0xf192('0x4b')]['literal'](_0xf192('0x58')))),_0xf192('0x5d')],[db['sequelize']['fn'](_0xf192('0x4c'),db['sequelize']['fn']('IF',db[_0xf192('0x4b')]['literal'](_0xf192('0x59')))),_0xf192('0x5a')]]})['then'](handleEntityNotFound(_0x3b43b4,null))['then'](respondWithResult(_0x3b43b4,null))[_0xf192('0x46')](handleError(_0x3b43b4,null));};exports[_0xf192('0x5e')]=function(_0x35dec2,_0x1baf79,_0x5b1b0b){return db['VoiceQueue'][_0xf192('0x48')]({'where':{'id':_0x35dec2[_0xf192('0x44')]['id']}})[_0xf192('0x22')](handleEntityNotFound(_0x1baf79,null))[_0xf192('0x22')](function(_0x56ab6a){var _0x38fc03;if(_0x56ab6a){_0x38fc03=squel[_0xf192('0x5f')]()[_0xf192('0x60')](_0xf192('0x61'))[_0xf192('0x62')]([_0xf192('0x63'),_0xf192('0x64'),_0xf192('0x65'),'ListId',_0xf192('0x66'),'createdAt','updatedAt'],squel[_0xf192('0x67')]()[_0xf192('0x68')]('ANY_VALUE(calleridnum)',_0xf192('0x63'))[_0xf192('0x68')]('NOW()','scheduledAt')[_0xf192('0x68')](_0xf192('0x69'),_0xf192('0x65'))[_0xf192('0x68')](_0xf192('0x6a'),'ListId')[_0xf192('0x68')](_0xf192('0x6b'),_0xf192('0x66'))[_0xf192('0x68')](_0xf192('0x6c'),_0xf192('0x6d'))['field'](_0xf192('0x6c'),'updatedAt')[_0xf192('0x6e')]('cm_hopper_final')['where'](_0xf192('0x6f'),_0x35dec2[_0xf192('0x44')]['id'][_0xf192('0x70')]())[_0xf192('0x39')]('state\x20=\x20?',_0x35dec2['body'][_0xf192('0x71')][_0xf192('0x70')]())[_0xf192('0x39')](_0xf192('0x72'))[_0xf192('0x39')](_0xf192('0x73'),squel['select']()[_0xf192('0x68')](_0xf192('0x63'))['from'](_0xf192('0x61'))['where'](_0xf192('0x6f'),_0x35dec2['params']['id']['toString']()))[_0xf192('0x39')](_0xf192('0x73'),squel[_0xf192('0x67')]()[_0xf192('0x68')](_0xf192('0x74'))[_0xf192('0x6e')]('cm_hopper_final')[_0xf192('0x39')]('VoiceQueueId\x20=\x20?',_0x35dec2[_0xf192('0x44')]['id'][_0xf192('0x70')]())['where'](_0xf192('0x75')))[_0xf192('0x76')](_0xf192('0x65')))['toString']();return db['sequelize']['query'](_0x38fc03);}return[];})[_0xf192('0x22')](respondWithResult(_0x1baf79,null))[_0xf192('0x46')](handleError(_0x1baf79,null));};exports[_0xf192('0x77')]=function(_0x5db753,_0x3bb41d,_0x296013){return db[_0xf192('0x78')][_0xf192('0x48')]({'where':{'id':_0x5db753['params']['id']}})[_0xf192('0x22')](handleEntityNotFound(_0x3bb41d,null))[_0xf192('0x22')](function(_0x4c9c0a){var _0xf34ba6;if(_0x4c9c0a){_0xf34ba6=squel[_0xf192('0x5f')]()['into']('cm_hopper')[_0xf192('0x62')]([_0xf192('0x63'),'scheduledAt',_0xf192('0x65'),_0xf192('0x79'),_0xf192('0x7a'),'createdAt',_0xf192('0x7b')],squel[_0xf192('0x67')]()[_0xf192('0x68')]('ANY_VALUE(calleridnum)',_0xf192('0x63'))[_0xf192('0x68')]('NOW()',_0xf192('0x64'))['field']('ANY_VALUE(ContactId)',_0xf192('0x65'))[_0xf192('0x68')](_0xf192('0x6a'),_0xf192('0x79'))[_0xf192('0x68')]('ANY_VALUE(CampaignId)',_0xf192('0x7a'))[_0xf192('0x68')](_0xf192('0x6c'),'createdAt')['field'](_0xf192('0x6c'),'updatedAt')[_0xf192('0x6e')](_0xf192('0x7c'))[_0xf192('0x39')](_0xf192('0x7d'),_0x5db753['params']['id'][_0xf192('0x70')]())[_0xf192('0x39')](_0xf192('0x7e'),_0x5db753['body'][_0xf192('0x71')]['toString']())[_0xf192('0x39')](_0xf192('0x72'))['where']('calleridnum\x20NOT\x20IN\x20(?)',squel[_0xf192('0x67')]()[_0xf192('0x68')](_0xf192('0x63'))[_0xf192('0x6e')]('cm_hopper')[_0xf192('0x39')](_0xf192('0x7d'),_0x5db753[_0xf192('0x44')]['id'][_0xf192('0x70')]()))[_0xf192('0x39')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0xf192('0x67')]()[_0xf192('0x68')](_0xf192('0x74'))[_0xf192('0x6e')](_0xf192('0x7c'))['where'](_0xf192('0x7d'),_0x5db753[_0xf192('0x44')]['id'][_0xf192('0x70')]())[_0xf192('0x39')]('state\x20=\x204'))[_0xf192('0x76')](_0xf192('0x65')))[_0xf192('0x70')]();return db[_0xf192('0x4b')]['query'](_0xf34ba6);}return[];})[_0xf192('0x22')](respondWithResult(_0x3bb41d,null))['catch'](handleError(_0x3bb41d,null));};exports['checkContactHopper']=function(_0x45cfa6,_0x54dda3,_0x3afef3){return db['CmHopper'][_0xf192('0x7f')]({'where':{'VoiceQueueId':_0x45cfa6['body']['VoiceQueueId'],'CampaignId':_0x45cfa6[_0xf192('0x49')][_0xf192('0x7a')],'ContactId':_0x45cfa6[_0xf192('0x49')]['ContactId']}})['then'](handleEntityNotFound(_0x54dda3,null))[_0xf192('0x22')](function(_0x34cf74){if(_0x34cf74){return _0x34cf74;}return null;})[_0xf192('0x22')](respondWithResult(_0x54dda3,null))[_0xf192('0x46')](handleError(_0x54dda3,null));}; \ No newline at end of file +var _0xa33f=['`state`\x20=\x2022,\x201,\x20null','reCallContacts','answeringMachine','countContactsIvrCampaignHopperFinal','busyContacts','`state`\x20=\x208,\x201,\x20null','dropContacts','`state`\x20=\x2019,\x201,\x20null','moveContactsQueueCampaignHopperFinal','VoiceQueue','into','cm_hopper','fromQuery','scheduledAt','ContactId','ListId','VoiceQueueId','createdAt','select','field','ANY_VALUE(calleridnum)','phone','NOW()','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','updatedAt','from','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','state\x20=\x204','group','Campaign','CampaignId','ANY_VALUE(ContactId)','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','checkContactHopper','findOne','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','sendStatus','status','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','map','CmHopperFinal','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','sort','where','pick','filter','merge','count','includeAll','include','findAll','rows','show','params','options','find','catch','describe','uniqueid','body','sequelize','COUNT','literal','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts'];(function(_0x320dd0,_0x266a5b){var _0x1ffb02=function(_0x23fc0c){while(--_0x23fc0c){_0x320dd0['push'](_0x320dd0['shift']());}};_0x1ffb02(++_0x266a5b);}(_0xa33f,0xac));var _0xfa33=function(_0xeff2c3,_0x3a5a82){_0xeff2c3=_0xeff2c3-0x0;var _0x2cade6=_0xa33f[_0xeff2c3];return _0x2cade6;};'use strict';var pdf=require(_0xfa33('0x0'));var emlformat=require(_0xfa33('0x1'));var rimraf=require(_0xfa33('0x2'));var zipdir=require(_0xfa33('0x3'));var jsonpatch=require(_0xfa33('0x4'));var rp=require('request-promise');var moment=require(_0xfa33('0x5'));var BPromise=require(_0xfa33('0x6'));var Mustache=require(_0xfa33('0x7'));var util=require('util');var path=require(_0xfa33('0x8'));var sox=require(_0xfa33('0x9'));var csv=require(_0xfa33('0xa'));var ejs=require(_0xfa33('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xfa33('0xc'));var jsforce=require(_0xfa33('0xd'));var deskjs=require(_0xfa33('0xe'));var toCsv=require(_0xfa33('0xa'));var querystring=require(_0xfa33('0xf'));var Papa=require(_0xfa33('0x10'));var Redis=require(_0xfa33('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xfa33('0x12'));var as=require(_0xfa33('0x13'));var hardwareService=require(_0xfa33('0x14'));var logger=require('../../config/logger')(_0xfa33('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xfa33('0x16'))['db'];function respondWithStatusCode(_0x1aae3c,_0x9813ea){_0x9813ea=_0x9813ea||0xcc;return function(_0x4d95b5){if(_0x4d95b5){return _0x1aae3c[_0xfa33('0x17')](_0x9813ea);}return _0x1aae3c[_0xfa33('0x18')](_0x9813ea)['end']();};}function respondWithResult(_0xb463b1,_0x477ce4){_0x477ce4=_0x477ce4||0xc8;return function(_0x258015){if(_0x258015){return _0xb463b1[_0xfa33('0x18')](_0x477ce4)[_0xfa33('0x19')](_0x258015);}};}function respondWithFilteredResult(_0x383708,_0x311381){return function(_0x389b6c){if(_0x389b6c){var _0x54c4a9=_0x389b6c['count'],_0x1433e1=_0x311381[_0xfa33('0x1a')],_0x1c5930=_0x311381[_0xfa33('0x1a')]+_0x311381[_0xfa33('0x1b')],_0x45ea8b;if(_0x1c5930>=_0x54c4a9){_0x1c5930=_0x54c4a9;_0x45ea8b=0xc8;}else{_0x45ea8b=0xce;}_0x383708[_0xfa33('0x18')](_0x45ea8b);return _0x383708[_0xfa33('0x1c')](_0xfa33('0x1d'),_0x1433e1+'-'+_0x1c5930+'/'+_0x54c4a9)['json'](_0x389b6c);}return null;};}function patchUpdates(_0x233223){return function(_0x14454a){try{jsonpatch[_0xfa33('0x1e')](_0x14454a,_0x233223,!![]);}catch(_0x7ab02d){return BPromise[_0xfa33('0x1f')](_0x7ab02d);}return _0x14454a[_0xfa33('0x20')]();};}function saveUpdates(_0xe71261,_0xaa60df){return function(_0x5b456a){if(_0x5b456a){return _0x5b456a[_0xfa33('0x21')](_0xe71261)[_0xfa33('0x22')](function(_0x49465d){return _0x49465d;});}return null;};}function removeEntity(_0x275911,_0x181ffb){return function(_0x328647){if(_0x328647){return _0x328647[_0xfa33('0x23')]()[_0xfa33('0x22')](function(){_0x275911['status'](0xcc)[_0xfa33('0x24')]();});}};}function handleEntityNotFound(_0x1518ac,_0x48471d){return function(_0x26cb17){if(!_0x26cb17){_0x1518ac[_0xfa33('0x17')](0x194);}return _0x26cb17;};}function handleError(_0x1293c2,_0x37b7e7){_0x37b7e7=_0x37b7e7||0x1f4;return function(_0x5c0c79){logger[_0xfa33('0x25')](_0x5c0c79[_0xfa33('0x26')]);if(_0x5c0c79[_0xfa33('0x27')]){delete _0x5c0c79[_0xfa33('0x27')];}_0x1293c2[_0xfa33('0x18')](_0x37b7e7)['send'](_0x5c0c79);};}exports['index']=function(_0x75ca8e,_0x2d284c){var _0x2c0ed4={},_0x2317db={},_0x3225ee={'count':0x0,'rows':[]};var _0x32e76f=_[_0xfa33('0x28')](db[_0xfa33('0x29')][_0xfa33('0x2a')],function(_0x24f7a3){return{'name':_0x24f7a3[_0xfa33('0x2b')],'type':_0x24f7a3[_0xfa33('0x2c')][_0xfa33('0x2d')]};});_0x2317db[_0xfa33('0x2e')]=_[_0xfa33('0x28')](_0x32e76f,_0xfa33('0x27'));_0x2317db[_0xfa33('0x2f')]=_[_0xfa33('0x30')](_0x75ca8e[_0xfa33('0x2f')]);_0x2317db[_0xfa33('0x31')]=_[_0xfa33('0x32')](_0x2317db[_0xfa33('0x2e')],_0x2317db[_0xfa33('0x2f')]);_0x2c0ed4['attributes']=_[_0xfa33('0x32')](_0x2317db[_0xfa33('0x2e')],qs[_0xfa33('0x33')](_0x75ca8e[_0xfa33('0x2f')][_0xfa33('0x33')]));_0x2c0ed4[_0xfa33('0x34')]=_0x2c0ed4[_0xfa33('0x34')][_0xfa33('0x35')]?_0x2c0ed4[_0xfa33('0x34')]:_0x2317db['model'];if(!_0x75ca8e[_0xfa33('0x2f')][_0xfa33('0x36')]('nolimit')){_0x2c0ed4[_0xfa33('0x1b')]=qs[_0xfa33('0x1b')](_0x75ca8e[_0xfa33('0x2f')][_0xfa33('0x1b')]);_0x2c0ed4[_0xfa33('0x1a')]=qs[_0xfa33('0x1a')](_0x75ca8e['query'][_0xfa33('0x1a')]);}_0x2c0ed4['order']=qs[_0xfa33('0x37')](_0x75ca8e[_0xfa33('0x2f')]['sort']);_0x2c0ed4[_0xfa33('0x38')]=qs[_0xfa33('0x31')](_[_0xfa33('0x39')](_0x75ca8e['query'],_0x2317db[_0xfa33('0x31')]));if(_0x75ca8e[_0xfa33('0x2f')][_0xfa33('0x3a')]){_0x2c0ed4['where']=_[_0xfa33('0x3b')](_0x2c0ed4[_0xfa33('0x38')],{'$or':_[_0xfa33('0x28')](_0x32e76f,function(_0xfebf89){if(_0xfebf89['type']!=='VIRTUAL'){var _0x7d84b={};_0x7d84b[_0xfebf89[_0xfa33('0x27')]]={'$like':'%'+_0x75ca8e[_0xfa33('0x2f')][_0xfa33('0x3a')]+'%'};return _0x7d84b;}})});}_0x2c0ed4=_[_0xfa33('0x3b')]({},_0x2c0ed4,_0x75ca8e['options']);var _0x45afdc={'where':_0x2c0ed4[_0xfa33('0x38')]};return db[_0xfa33('0x29')][_0xfa33('0x3c')](_0x45afdc)[_0xfa33('0x22')](function(_0x4c5d2d){_0x3225ee[_0xfa33('0x3c')]=_0x4c5d2d;if(_0x75ca8e['query'][_0xfa33('0x3d')]){_0x2c0ed4[_0xfa33('0x3e')]=[{'all':!![]}];}return db[_0xfa33('0x29')][_0xfa33('0x3f')](_0x2c0ed4);})[_0xfa33('0x22')](function(_0x4e7c66){_0x3225ee[_0xfa33('0x40')]=_0x4e7c66;return _0x3225ee;})[_0xfa33('0x22')](respondWithFilteredResult(_0x2d284c,_0x2c0ed4))['catch'](handleError(_0x2d284c,null));};exports[_0xfa33('0x41')]=function(_0x342ced,_0x1c9395){var _0x4d3a0e={'raw':!![],'where':{'id':_0x342ced[_0xfa33('0x42')]['id']}},_0x5c7542={};_0x5c7542[_0xfa33('0x2e')]=_[_0xfa33('0x30')](db[_0xfa33('0x29')][_0xfa33('0x2a')]);_0x5c7542[_0xfa33('0x2f')]=_[_0xfa33('0x30')](_0x342ced[_0xfa33('0x2f')]);_0x5c7542[_0xfa33('0x31')]=_[_0xfa33('0x32')](_0x5c7542[_0xfa33('0x2e')],_0x5c7542[_0xfa33('0x2f')]);_0x4d3a0e[_0xfa33('0x34')]=_[_0xfa33('0x32')](_0x5c7542[_0xfa33('0x2e')],qs['fields'](_0x342ced[_0xfa33('0x2f')][_0xfa33('0x33')]));_0x4d3a0e[_0xfa33('0x34')]=_0x4d3a0e[_0xfa33('0x34')][_0xfa33('0x35')]?_0x4d3a0e[_0xfa33('0x34')]:_0x5c7542['model'];if(_0x342ced[_0xfa33('0x2f')][_0xfa33('0x3d')]){_0x4d3a0e[_0xfa33('0x3e')]=[{'all':!![]}];}_0x4d3a0e=_[_0xfa33('0x3b')]({},_0x4d3a0e,_0x342ced[_0xfa33('0x43')]);return db[_0xfa33('0x29')][_0xfa33('0x44')](_0x4d3a0e)[_0xfa33('0x22')](handleEntityNotFound(_0x1c9395,null))[_0xfa33('0x22')](respondWithResult(_0x1c9395,null))[_0xfa33('0x45')](handleError(_0x1c9395,null));};exports[_0xfa33('0x46')]=function(_0x5d947e,_0x287e51){return db[_0xfa33('0x29')][_0xfa33('0x46')]()[_0xfa33('0x22')](respondWithResult(_0x287e51,null))[_0xfa33('0x45')](handleError(_0x287e51,null));};exports[_0xfa33('0x21')]=function(_0x69c286,_0x2acb5c){if(_0x69c286['body'][_0xfa33('0x47')]){delete _0x69c286['body'][_0xfa33('0x47')];}return db[_0xfa33('0x29')]['find']({'where':{'uniqueid':_0x69c286[_0xfa33('0x42')]['id']}})[_0xfa33('0x22')](handleEntityNotFound(_0x2acb5c,null))[_0xfa33('0x22')](saveUpdates(_0x69c286[_0xfa33('0x48')],null))[_0xfa33('0x22')](respondWithResult(_0x2acb5c,null))[_0xfa33('0x45')](handleError(_0x2acb5c,null));};exports['countContactsQueueCampaignHopperFinal']=function(_0x274ddb,_0x27446b,_0x50b279){return db[_0xfa33('0x29')][_0xfa33('0x3f')]({'raw':![],'where':{'VoiceQueueId':_0x274ddb['params']['id']},'attributes':[[db[_0xfa33('0x49')]['fn'](_0xfa33('0x4a'),db[_0xfa33('0x49')]['fn']('IF',db[_0xfa33('0x49')][_0xfa33('0x4b')](_0xfa33('0x4c')))),'noSuchContacts'],[db[_0xfa33('0x49')]['fn'](_0xfa33('0x4a'),db[_0xfa33('0x49')]['fn']('IF',db[_0xfa33('0x49')][_0xfa33('0x4b')](_0xfa33('0x4d')))),_0xfa33('0x4e')],[db[_0xfa33('0x49')]['fn'](_0xfa33('0x4a'),db[_0xfa33('0x49')]['fn']('IF',db[_0xfa33('0x49')][_0xfa33('0x4b')](_0xfa33('0x4f')))),'busyContacts'],[db['sequelize']['fn']('COUNT',db[_0xfa33('0x49')]['fn']('IF',db[_0xfa33('0x49')][_0xfa33('0x4b')]('`state`\x20=\x208,\x201,\x20null'))),_0xfa33('0x50')],[db['sequelize']['fn'](_0xfa33('0x4a'),db[_0xfa33('0x49')]['fn']('IF',db[_0xfa33('0x49')]['literal'](_0xfa33('0x51')))),'dropContacts'],[db[_0xfa33('0x49')]['fn'](_0xfa33('0x4a'),db[_0xfa33('0x49')]['fn']('IF',db[_0xfa33('0x49')]['literal'](_0xfa33('0x52')))),_0xfa33('0x53')],[db[_0xfa33('0x49')]['fn'](_0xfa33('0x4a'),db[_0xfa33('0x49')]['fn']('IF',db[_0xfa33('0x49')][_0xfa33('0x4b')](_0xfa33('0x54')))),_0xfa33('0x55')],[db['sequelize']['fn'](_0xfa33('0x4a'),db[_0xfa33('0x49')]['fn']('IF',db[_0xfa33('0x49')][_0xfa33('0x4b')]('`state`\x20=\x2019,\x201,\x20null'))),_0xfa33('0x56')]]})['then'](handleEntityNotFound(_0x27446b,null))[_0xfa33('0x22')](respondWithResult(_0x27446b,null))[_0xfa33('0x45')](handleError(_0x27446b,null));};exports[_0xfa33('0x57')]=function(_0x5d0d9a,_0xe2b007,_0x11f8ed){return db[_0xfa33('0x29')][_0xfa33('0x3f')]({'raw':![],'where':{'CampaignId':_0x5d0d9a[_0xfa33('0x42')]['id']},'attributes':[[db['sequelize']['fn'](_0xfa33('0x4a'),db[_0xfa33('0x49')]['fn']('IF',db[_0xfa33('0x49')]['literal'](_0xfa33('0x4c')))),'noSuchContacts'],[db[_0xfa33('0x49')]['fn']('COUNT',db[_0xfa33('0x49')]['fn']('IF',db['sequelize']['literal'](_0xfa33('0x4d')))),'noAnswerContacts'],[db[_0xfa33('0x49')]['fn'](_0xfa33('0x4a'),db['sequelize']['fn']('IF',db[_0xfa33('0x49')][_0xfa33('0x4b')]('`state`\x20=\x205,\x201,\x20null'))),_0xfa33('0x58')],[db[_0xfa33('0x49')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xfa33('0x49')][_0xfa33('0x4b')](_0xfa33('0x59')))),_0xfa33('0x50')],[db[_0xfa33('0x49')]['fn'](_0xfa33('0x4a'),db['sequelize']['fn']('IF',db[_0xfa33('0x49')]['literal'](_0xfa33('0x51')))),_0xfa33('0x5a')],[db[_0xfa33('0x49')]['fn'](_0xfa33('0x4a'),db[_0xfa33('0x49')]['fn']('IF',db[_0xfa33('0x49')][_0xfa33('0x4b')](_0xfa33('0x52')))),_0xfa33('0x53')],[db[_0xfa33('0x49')]['fn'](_0xfa33('0x4a'),db['sequelize']['fn']('IF',db[_0xfa33('0x49')]['literal'](_0xfa33('0x54')))),_0xfa33('0x55')],[db[_0xfa33('0x49')]['fn'](_0xfa33('0x4a'),db[_0xfa33('0x49')]['fn']('IF',db[_0xfa33('0x49')][_0xfa33('0x4b')](_0xfa33('0x5b')))),_0xfa33('0x56')]]})[_0xfa33('0x22')](handleEntityNotFound(_0xe2b007,null))[_0xfa33('0x22')](respondWithResult(_0xe2b007,null))['catch'](handleError(_0xe2b007,null));};exports[_0xfa33('0x5c')]=function(_0x542f2f,_0x807a3f,_0x4007a2){return db[_0xfa33('0x5d')][_0xfa33('0x44')]({'where':{'id':_0x542f2f[_0xfa33('0x42')]['id']}})[_0xfa33('0x22')](handleEntityNotFound(_0x807a3f,null))[_0xfa33('0x22')](function(_0x51ac2d){var _0x5dacbc;if(_0x51ac2d){_0x5dacbc=squel['insert']()[_0xfa33('0x5e')](_0xfa33('0x5f'))[_0xfa33('0x60')](['phone',_0xfa33('0x61'),_0xfa33('0x62'),_0xfa33('0x63'),_0xfa33('0x64'),_0xfa33('0x65'),'updatedAt'],squel[_0xfa33('0x66')]()[_0xfa33('0x67')](_0xfa33('0x68'),_0xfa33('0x69'))[_0xfa33('0x67')](_0xfa33('0x6a'),_0xfa33('0x61'))[_0xfa33('0x67')]('ANY_VALUE(ContactId)','ContactId')['field'](_0xfa33('0x6b'),_0xfa33('0x63'))[_0xfa33('0x67')](_0xfa33('0x6c'),'VoiceQueueId')['field'](_0xfa33('0x6a'),_0xfa33('0x65'))[_0xfa33('0x67')](_0xfa33('0x6a'),_0xfa33('0x6d'))[_0xfa33('0x6e')](_0xfa33('0x6f'))[_0xfa33('0x38')](_0xfa33('0x70'),_0x542f2f['params']['id'][_0xfa33('0x71')]())[_0xfa33('0x38')](_0xfa33('0x72'),_0x542f2f[_0xfa33('0x48')][_0xfa33('0x73')]['toString']())[_0xfa33('0x38')](_0xfa33('0x74'))[_0xfa33('0x38')](_0xfa33('0x75'),squel[_0xfa33('0x66')]()['field'](_0xfa33('0x69'))[_0xfa33('0x6e')](_0xfa33('0x5f'))[_0xfa33('0x38')]('VoiceQueueId\x20=\x20?',_0x542f2f[_0xfa33('0x42')]['id'][_0xfa33('0x71')]()))['where']('calleridnum\x20NOT\x20IN\x20(?)',squel['select']()[_0xfa33('0x67')](_0xfa33('0x76'))[_0xfa33('0x6e')]('cm_hopper_final')[_0xfa33('0x38')](_0xfa33('0x70'),_0x542f2f['params']['id'][_0xfa33('0x71')]())['where'](_0xfa33('0x77')))[_0xfa33('0x78')](_0xfa33('0x62')))['toString']();return db[_0xfa33('0x49')][_0xfa33('0x2f')](_0x5dacbc);}return[];})[_0xfa33('0x22')](respondWithResult(_0x807a3f,null))[_0xfa33('0x45')](handleError(_0x807a3f,null));};exports['moveContactsIvrCampaignHopperFinal']=function(_0x4c0b5d,_0x1a3eac,_0xcb9965){return db[_0xfa33('0x79')][_0xfa33('0x44')]({'where':{'id':_0x4c0b5d[_0xfa33('0x42')]['id']}})['then'](handleEntityNotFound(_0x1a3eac,null))[_0xfa33('0x22')](function(_0x1ed4ff){var _0x4e29cd;if(_0x1ed4ff){_0x4e29cd=squel['insert']()[_0xfa33('0x5e')]('cm_hopper')['fromQuery']([_0xfa33('0x69'),_0xfa33('0x61'),_0xfa33('0x62'),'ListId',_0xfa33('0x7a'),_0xfa33('0x65'),'updatedAt'],squel[_0xfa33('0x66')]()[_0xfa33('0x67')](_0xfa33('0x68'),_0xfa33('0x69'))[_0xfa33('0x67')](_0xfa33('0x6a'),'scheduledAt')[_0xfa33('0x67')](_0xfa33('0x7b'),_0xfa33('0x62'))[_0xfa33('0x67')]('ANY_VALUE(ListId)',_0xfa33('0x63'))[_0xfa33('0x67')](_0xfa33('0x7c'),_0xfa33('0x7a'))[_0xfa33('0x67')]('NOW()',_0xfa33('0x65'))['field'](_0xfa33('0x6a'),'updatedAt')['from'](_0xfa33('0x6f'))[_0xfa33('0x38')](_0xfa33('0x7d'),_0x4c0b5d[_0xfa33('0x42')]['id']['toString']())[_0xfa33('0x38')](_0xfa33('0x72'),_0x4c0b5d[_0xfa33('0x48')][_0xfa33('0x73')]['toString']())['where'](_0xfa33('0x74'))[_0xfa33('0x38')](_0xfa33('0x75'),squel[_0xfa33('0x66')]()[_0xfa33('0x67')](_0xfa33('0x69'))[_0xfa33('0x6e')](_0xfa33('0x5f'))[_0xfa33('0x38')]('CampaignId\x20=\x20?',_0x4c0b5d['params']['id'][_0xfa33('0x71')]()))[_0xfa33('0x38')](_0xfa33('0x75'),squel['select']()[_0xfa33('0x67')](_0xfa33('0x76'))[_0xfa33('0x6e')](_0xfa33('0x6f'))[_0xfa33('0x38')]('CampaignId\x20=\x20?',_0x4c0b5d[_0xfa33('0x42')]['id']['toString']())[_0xfa33('0x38')]('state\x20=\x204'))[_0xfa33('0x78')](_0xfa33('0x62')))[_0xfa33('0x71')]();return db[_0xfa33('0x49')][_0xfa33('0x2f')](_0x4e29cd);}return[];})[_0xfa33('0x22')](respondWithResult(_0x1a3eac,null))['catch'](handleError(_0x1a3eac,null));};exports[_0xfa33('0x7e')]=function(_0x5e55fc,_0x574142,_0x91651c){return db['CmHopper'][_0xfa33('0x7f')]({'where':{'VoiceQueueId':_0x5e55fc[_0xfa33('0x48')][_0xfa33('0x64')],'CampaignId':_0x5e55fc[_0xfa33('0x48')][_0xfa33('0x7a')],'ContactId':_0x5e55fc[_0xfa33('0x48')]['ContactId']}})[_0xfa33('0x22')](handleEntityNotFound(_0x574142,null))['then'](function(_0x5d8166){if(_0x5d8166){return _0x5d8166;}return null;})['then'](respondWithResult(_0x574142,null))[_0xfa33('0x45')](handleError(_0x574142,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 0277ce5..77093e5 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 _0x70fd=['moment','path','../../config/environment','./cmHopperFinal.attributes','define','cm_hopper_final','calleridnum','uniqueid','util','../../config/logger','api'];(function(_0x6d4cee,_0x295b67){var _0x2602b0=function(_0x712d39){while(--_0x712d39){_0x6d4cee['push'](_0x6d4cee['shift']());}};_0x2602b0(++_0x295b67);}(_0x70fd,0x126));var _0xd70f=function(_0xc29e65,_0x7f1e9e){_0xc29e65=_0xc29e65-0x0;var _0x36240d=_0x70fd[_0xc29e65];return _0x36240d;};'use strict';var _=require('lodash');var util=require(_0xd70f('0x0'));var logger=require(_0xd70f('0x1'))(_0xd70f('0x2'));var moment=require(_0xd70f('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xd70f('0x4'));var rimraf=require('rimraf');var config=require(_0xd70f('0x5'));var attributes=require(_0xd70f('0x6'));module['exports']=function(_0x4935b9,_0x245d60){return _0x4935b9[_0xd70f('0x7')]('CmHopperFinal',attributes,{'tableName':_0xd70f('0x8'),'paranoid':![],'indexes':[{'name':_0xd70f('0x9'),'fields':[_0xd70f('0x9')]},{'name':_0xd70f('0xa'),'fields':[_0xd70f('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3ad4=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperFinal.attributes','exports','define','CmHopperFinal','calleridnum','uniqueid','lodash','../../config/logger'];(function(_0x4db8c1,_0x4bc4cd){var _0x22b9c3=function(_0x503bf2){while(--_0x503bf2){_0x4db8c1['push'](_0x4db8c1['shift']());}};_0x22b9c3(++_0x4bc4cd);}(_0x3ad4,0x148));var _0x43ad=function(_0x385fd1,_0x427ec3){_0x385fd1=_0x385fd1-0x0;var _0x402c49=_0x3ad4[_0x385fd1];return _0x402c49;};'use strict';var _=require(_0x43ad('0x0'));var util=require('util');var logger=require(_0x43ad('0x1'))(_0x43ad('0x2'));var moment=require(_0x43ad('0x3'));var BPromise=require(_0x43ad('0x4'));var rp=require(_0x43ad('0x5'));var fs=require('fs');var path=require(_0x43ad('0x6'));var rimraf=require(_0x43ad('0x7'));var config=require(_0x43ad('0x8'));var attributes=require(_0x43ad('0x9'));module[_0x43ad('0xa')]=function(_0x4bb2f7,_0x4b4dd4){return _0x4bb2f7[_0x43ad('0xb')](_0x43ad('0xc'),attributes,{'tableName':'cm_hopper_final','paranoid':![],'indexes':[{'name':_0x43ad('0xd'),'fields':['calleridnum']},{'name':_0x43ad('0xe'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index 7e393de..e47cef9 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 _0xc873=['http','request','then','info','CmHopperFinal,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','CreateCmHopperFinal','CmHopperFinal','create','options','stringify','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x2bcc9f,_0xfe216c){var _0xe0acbd=function(_0x1a1d0c){while(--_0x1a1d0c){_0x2bcc9f['push'](_0x2bcc9f['shift']());}};_0xe0acbd(++_0xfe216c);}(_0xc873,0x15a));var _0x3c87=function(_0x5060a1,_0xaf8baf){_0x5060a1=_0x5060a1-0x0;var _0x2443d3=_0xc873[_0x5060a1];return _0x2443d3;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3c87('0x0'));var BPromise=require('bluebird');var rs=require(_0x3c87('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3c87('0x2'))['db'];var utils=require(_0x3c87('0x3'));var logger=require(_0x3c87('0x4'))(_0x3c87('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x3c87('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x3b8646,_0x458a3a,_0x3a23aa){return new BPromise(function(_0x16fb8c,_0x1728e3){return client[_0x3c87('0x7')](_0x3b8646,_0x3a23aa)[_0x3c87('0x8')](function(_0x396e68){logger[_0x3c87('0x9')](_0x3c87('0xa'),_0x458a3a,_0x3c87('0xb'));logger[_0x3c87('0xc')]('CmHopperFinal,\x20%s,\x20%s,\x20%s',_0x458a3a,'request\x20sent',JSON['stringify'](_0x396e68));if(_0x396e68[_0x3c87('0xd')]){if(_0x396e68['error']['code']===0x1f4){logger[_0x3c87('0xd')]('CmHopperFinal,\x20%s,\x20%s',_0x458a3a,_0x396e68['error'][_0x3c87('0xe')]);return _0x1728e3(_0x396e68[_0x3c87('0xd')][_0x3c87('0xe')]);}logger[_0x3c87('0xd')](_0x3c87('0xa'),_0x458a3a,_0x396e68[_0x3c87('0xd')][_0x3c87('0xe')]);return _0x16fb8c(_0x396e68['error'][_0x3c87('0xe')]);}else{logger[_0x3c87('0x9')](_0x3c87('0xa'),_0x458a3a,_0x3c87('0xb'));_0x16fb8c(_0x396e68[_0x3c87('0xf')][_0x3c87('0xe')]);}})[_0x3c87('0x10')](function(_0x3acc3e){logger['error']('CmHopperFinal,\x20%s,\x20%s',_0x458a3a,_0x3acc3e);_0x1728e3(_0x3acc3e);});});}exports[_0x3c87('0x11')]=function(_0x4467cd){var _0x6dcfbb=this;return new Promise(function(_0x2934c4,_0x2d2fa2){return db[_0x3c87('0x12')][_0x3c87('0x13')](_0x4467cd['body'],{'raw':_0x4467cd['options']?_0x4467cd[_0x3c87('0x14')]['raw']===undefined?!![]:![]:!![]})[_0x3c87('0x8')](function(_0x369ed0){logger['info'](_0x3c87('0x11'),_0x4467cd);logger[_0x3c87('0xc')]('CreateCmHopperFinal',_0x4467cd,JSON[_0x3c87('0x15')](_0x369ed0));_0x2934c4(_0x369ed0);})[_0x3c87('0x10')](function(_0x1f8cae){logger[_0x3c87('0xd')](_0x3c87('0x11'),_0x1f8cae[_0x3c87('0xe')],_0x4467cd);_0x2d2fa2(_0x6dcfbb[_0x3c87('0xd')](0x1f4,_0x1f8cae[_0x3c87('0xe')]));});});}; \ No newline at end of file +var _0xb268=['client','request','then','info','request\x20sent','stringify','error','code','message','CmHopperFinal,\x20%s,\x20%s','result','CreateCmHopperFinal','create','options','raw','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x489618,_0x233987){var _0x3d34b8=function(_0xe4ffd0){while(--_0xe4ffd0){_0x489618['push'](_0x489618['shift']());}};_0x3d34b8(++_0x233987);}(_0xb268,0x114));var _0x8b26=function(_0xb1cad7,_0x1d5809){_0xb1cad7=_0xb1cad7-0x0;var _0x3ecd75=_0xb268[_0xb1cad7];return _0x3ecd75;};'use strict';var _=require(_0x8b26('0x0'));var util=require(_0x8b26('0x1'));var moment=require(_0x8b26('0x2'));var BPromise=require(_0x8b26('0x3'));var rs=require(_0x8b26('0x4'));var fs=require('fs');var Redis=require(_0x8b26('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x8b26('0x6'))(_0x8b26('0x7'));var config=require(_0x8b26('0x8'));var jayson=require(_0x8b26('0x9'));var client=jayson[_0x8b26('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b7c98,_0x5207ea,_0x4cca57){return new BPromise(function(_0x321391,_0x321c8f){return client[_0x8b26('0xb')](_0x3b7c98,_0x4cca57)[_0x8b26('0xc')](function(_0x185807){logger[_0x8b26('0xd')]('CmHopperFinal,\x20%s,\x20%s',_0x5207ea,_0x8b26('0xe'));logger['debug']('CmHopperFinal,\x20%s,\x20%s,\x20%s',_0x5207ea,_0x8b26('0xe'),JSON[_0x8b26('0xf')](_0x185807));if(_0x185807[_0x8b26('0x10')]){if(_0x185807['error'][_0x8b26('0x11')]===0x1f4){logger[_0x8b26('0x10')]('CmHopperFinal,\x20%s,\x20%s',_0x5207ea,_0x185807[_0x8b26('0x10')]['message']);return _0x321c8f(_0x185807['error'][_0x8b26('0x12')]);}logger[_0x8b26('0x10')](_0x8b26('0x13'),_0x5207ea,_0x185807[_0x8b26('0x10')][_0x8b26('0x12')]);return _0x321391(_0x185807[_0x8b26('0x10')][_0x8b26('0x12')]);}else{logger[_0x8b26('0xd')](_0x8b26('0x13'),_0x5207ea,_0x8b26('0xe'));_0x321391(_0x185807[_0x8b26('0x14')]['message']);}})['catch'](function(_0x5dc0fb){logger[_0x8b26('0x10')](_0x8b26('0x13'),_0x5207ea,_0x5dc0fb);_0x321c8f(_0x5dc0fb);});});}exports[_0x8b26('0x15')]=function(_0x1239fa){var _0x5b2e46=this;return new Promise(function(_0x405a3a,_0x3b4734){return db['CmHopperFinal'][_0x8b26('0x16')](_0x1239fa['body'],{'raw':_0x1239fa['options']?_0x1239fa[_0x8b26('0x17')][_0x8b26('0x18')]===undefined?!![]:![]:!![]})[_0x8b26('0xc')](function(_0x3966be){logger['info'](_0x8b26('0x15'),_0x1239fa);logger['debug'](_0x8b26('0x15'),_0x1239fa,JSON['stringify'](_0x3966be));_0x405a3a(_0x3966be);})[_0x8b26('0x19')](function(_0x2dfacf){logger['error'](_0x8b26('0x15'),_0x2dfacf['message'],_0x1239fa);_0x3b4734(_0x5b2e46[_0x8b26('0x10')](0x1f4,_0x2dfacf[_0x8b26('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index 70e4dc9..2846b4e 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 _0x9738=['isAuthenticated','describe','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','moveContactsIvrCampaignHopperFinal','/:id','update','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','./cmHopperFinal.controller','get','index','/describe'];(function(_0x5bd426,_0x4878e5){var _0x23a7eb=function(_0x594b42){while(--_0x594b42){_0x5bd426['push'](_0x5bd426['shift']());}};_0x23a7eb(++_0x4878e5);}(_0x9738,0x165));var _0x8973=function(_0x51e105,_0x999a73){_0x51e105=_0x51e105-0x0;var _0x1739cd=_0x9738[_0x51e105];return _0x1739cd;};'use strict';var multer=require(_0x8973('0x0'));var util=require(_0x8973('0x1'));var path=require(_0x8973('0x2'));var timeout=require(_0x8973('0x3'));var express=require(_0x8973('0x4'));var router=express[_0x8973('0x5')]();var auth=require(_0x8973('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x8973('0x7'));router[_0x8973('0x8')]('/',auth['isAuthenticated'](),controller[_0x8973('0x9')]);router[_0x8973('0x8')](_0x8973('0xa'),auth[_0x8973('0xb')](),controller[_0x8973('0xc')]);router[_0x8973('0x8')]('/:id',auth[_0x8973('0xb')](),controller[_0x8973('0xd')]);router['get'](_0x8973('0xe'),auth[_0x8973('0xb')](),controller[_0x8973('0xf')]);router[_0x8973('0x8')](_0x8973('0x10'),auth['isAuthenticated'](),controller[_0x8973('0x11')]);router[_0x8973('0x12')]('/voice/queue/moveContacts/:id',auth[_0x8973('0xb')](),controller['moveContactsQueueCampaignHopperFinal']);router[_0x8973('0x12')]('/voice/campaign/moveContacts/:id',auth[_0x8973('0xb')](),controller[_0x8973('0x13')]);router[_0x8973('0x12')]('/checkContactHopper',auth['isAuthenticated'](),controller['checkContactHopper']);router['put'](_0x8973('0x14'),auth[_0x8973('0xb')](),controller[_0x8973('0x15')]);module[_0x8973('0x16')]=router; \ No newline at end of file +var _0xcfe2=['multer','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./cmHopperFinal.controller','get','isAuthenticated','index','/describe','describe','/:id','show','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','put','update','exports'];(function(_0x16452b,_0x13d782){var _0x58020d=function(_0x145d32){while(--_0x145d32){_0x16452b['push'](_0x16452b['shift']());}};_0x58020d(++_0x13d782);}(_0xcfe2,0x104));var _0x2cfe=function(_0x548b88,_0x3ac013){_0x548b88=_0x548b88-0x0;var _0x3062f6=_0xcfe2[_0x548b88];return _0x3062f6;};'use strict';var multer=require(_0x2cfe('0x0'));var util=require('util');var path=require(_0x2cfe('0x1'));var timeout=require(_0x2cfe('0x2'));var express=require('express');var router=express[_0x2cfe('0x3')]();var auth=require(_0x2cfe('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x2cfe('0x5'));var controller=require(_0x2cfe('0x6'));router[_0x2cfe('0x7')]('/',auth[_0x2cfe('0x8')](),controller[_0x2cfe('0x9')]);router[_0x2cfe('0x7')](_0x2cfe('0xa'),auth['isAuthenticated'](),controller[_0x2cfe('0xb')]);router[_0x2cfe('0x7')](_0x2cfe('0xc'),auth[_0x2cfe('0x8')](),controller[_0x2cfe('0xd')]);router[_0x2cfe('0x7')]('/voice/queue/countAttributes/:id',auth['isAuthenticated'](),controller[_0x2cfe('0xe')]);router['get'](_0x2cfe('0xf'),auth['isAuthenticated'](),controller[_0x2cfe('0x10')]);router[_0x2cfe('0x11')]('/voice/queue/moveContacts/:id',auth[_0x2cfe('0x8')](),controller[_0x2cfe('0x12')]);router[_0x2cfe('0x11')](_0x2cfe('0x13'),auth['isAuthenticated'](),controller[_0x2cfe('0x14')]);router['post'](_0x2cfe('0x15'),auth[_0x2cfe('0x8')](),controller[_0x2cfe('0x16')]);router[_0x2cfe('0x17')](_0x2cfe('0xc'),auth['isAuthenticated'](),controller[_0x2cfe('0x18')]);module[_0x2cfe('0x19')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index 49b664f..739225d 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 _0x4a91=['sequelize','INTEGER','DATE','STRING','BOOLEAN'];(function(_0x4c3e9d,_0x2b1ec6){var _0x221663=function(_0x586cb0){while(--_0x586cb0){_0x4c3e9d['push'](_0x4c3e9d['shift']());}};_0x221663(++_0x2b1ec6);}(_0x4a91,0x7d));var _0x14a9=function(_0x3b5ad9,_0x223867){_0x3b5ad9=_0x3b5ad9-0x0;var _0x611ae9=_0x4a91[_0x3b5ad9];return _0x611ae9;};'use strict';var Sequelize=require(_0x14a9('0x0'));module['exports']={'state':{'type':Sequelize[_0x14a9('0x1')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x14a9('0x2')]},'countbusyretry':{'type':Sequelize[_0x14a9('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x14a9('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x14a9('0x1')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x14a9('0x1')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0x14a9('0x3')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x14a9('0x3')]},'calleridname':{'type':Sequelize[_0x14a9('0x3')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x14a9('0x2')]},'answertime':{'type':Sequelize[_0x14a9('0x2')]},'droptime':{'type':Sequelize[_0x14a9('0x2')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x14a9('0x1')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x14a9('0x1')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x14a9('0x1')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x14a9('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x14a9('0x3')]},'campaign':{'type':Sequelize[_0x14a9('0x3')]},'campaigntype':{'type':Sequelize[_0x14a9('0x3')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0x14a9('0x3')]},'amd':{'type':Sequelize[_0x14a9('0x4')],'defaultValue':![]},'fax':{'type':Sequelize[_0x14a9('0x4')],'defaultValue':![]},'callback':{'type':Sequelize[_0x14a9('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x14a9('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0x14a9('0x4')],'defaultValue':![]},'editedat':{'type':Sequelize['DATE']},'edited':{'type':Sequelize[_0x14a9('0x4')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x14a9('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x14a9('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x14a9('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xd95f=['STRING','DATE','BOOLEAN','exports','INTEGER'];(function(_0x4ea325,_0x1b84eb){var _0x4ba599=function(_0x6270dc){while(--_0x6270dc){_0x4ea325['push'](_0x4ea325['shift']());}};_0x4ba599(++_0x1b84eb);}(_0xd95f,0x193));var _0xfd95=function(_0x4f9f43,_0x296a99){_0x4f9f43=_0x4f9f43-0x0;var _0x48a004=_0xd95f[_0x4f9f43];return _0x48a004;};'use strict';var Sequelize=require('sequelize');module[_0xfd95('0x0')]={'state':{'type':Sequelize[_0xfd95('0x1')](0x2)},'statedesc':{'type':Sequelize[_0xfd95('0x2')]},'scheduledat':{'type':Sequelize[_0xfd95('0x3')]},'countbusyretry':{'type':Sequelize[_0xfd95('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xfd95('0x1')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xfd95('0x1')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0xfd95('0x2')]},'calleridnum':{'type':Sequelize[_0xfd95('0x2')]},'calleridname':{'type':Sequelize[_0xfd95('0x2')]},'starttime':{'type':Sequelize[_0xfd95('0x3')]},'responsetime':{'type':Sequelize[_0xfd95('0x3')]},'answertime':{'type':Sequelize[_0xfd95('0x3')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xfd95('0x3')]},'ringtime':{'type':Sequelize[_0xfd95('0x1')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xfd95('0x1')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xfd95('0x1')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xfd95('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xfd95('0x2')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0xfd95('0x2')]},'membername':{'type':Sequelize[_0xfd95('0x2')]},'reason':{'type':Sequelize['STRING']},'amd':{'type':Sequelize[_0xfd95('0x4')],'defaultValue':![]},'fax':{'type':Sequelize[_0xfd95('0x4')],'defaultValue':![]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xfd95('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xfd95('0x3')]},'recallme':{'type':Sequelize[_0xfd95('0x4')],'defaultValue':![]},'editedat':{'type':Sequelize[_0xfd95('0x3')]},'edited':{'type':Sequelize[_0xfd95('0x4')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0xfd95('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xfd95('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xfd95('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xfd95('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xfd95('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index dde4c72..3f71e79 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 _0x832c=['jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','json','offset','set','Content-Range','reject','save','update','destroy','then','end','stack','name','send','index','map','CmHopperHistory','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','VIRTUAL','merge','options','count','include','catch','includeAll','find','create','describe','uniqueid','body','params','html-pdf','eml-format','rimraf','zip-dir','request-promise','util','sox','to-csv','ejs','lodash','squel','crypto'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0x832c,0x1e5));var _0xc832=function(_0x5e4cdc,_0xf90a5c){_0x5e4cdc=_0x5e4cdc-0x0;var _0x5841aa=_0x832c[_0x5e4cdc];return _0x5841aa;};'use strict';var pdf=require(_0xc832('0x0'));var emlformat=require(_0xc832('0x1'));var rimraf=require(_0xc832('0x2'));var zipdir=require(_0xc832('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc832('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xc832('0x5'));var path=require('path');var sox=require(_0xc832('0x6'));var csv=require(_0xc832('0x7'));var ejs=require(_0xc832('0x8'));var fs=require('fs');var _=require(_0xc832('0x9'));var squel=require(_0xc832('0xa'));var crypto=require(_0xc832('0xb'));var jsforce=require(_0xc832('0xc'));var deskjs=require(_0xc832('0xd'));var toCsv=require(_0xc832('0x7'));var querystring=require(_0xc832('0xe'));var Papa=require(_0xc832('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xc832('0x10'));var as=require(_0xc832('0x11'));var hardwareService=require(_0xc832('0x12'));var logger=require(_0xc832('0x13'))(_0xc832('0x14'));var utils=require(_0xc832('0x15'));var config=require('../../config/environment');var db=require(_0xc832('0x16'))['db'];function respondWithStatusCode(_0x550fb6,_0x46676c){_0x46676c=_0x46676c||0xcc;return function(_0xa1c7c0){if(_0xa1c7c0){return _0x550fb6['sendStatus'](_0x46676c);}return _0x550fb6['status'](_0x46676c)['end']();};}function respondWithResult(_0x144d32,_0x1229d5){_0x1229d5=_0x1229d5||0xc8;return function(_0x33c84e){if(_0x33c84e){return _0x144d32[_0xc832('0x17')](_0x1229d5)[_0xc832('0x18')](_0x33c84e);}};}function respondWithFilteredResult(_0x261b5,_0x427205){return function(_0x36cd88){if(_0x36cd88){var _0x4d22bb=_0x36cd88['count'],_0x586299=_0x427205[_0xc832('0x19')],_0x1f7fdb=_0x427205[_0xc832('0x19')]+_0x427205['limit'],_0x53a827;if(_0x1f7fdb>=_0x4d22bb){_0x1f7fdb=_0x4d22bb;_0x53a827=0xc8;}else{_0x53a827=0xce;}_0x261b5[_0xc832('0x17')](_0x53a827);return _0x261b5[_0xc832('0x1a')](_0xc832('0x1b'),_0x586299+'-'+_0x1f7fdb+'/'+_0x4d22bb)[_0xc832('0x18')](_0x36cd88);}return null;};}function patchUpdates(_0x54965c){return function(_0x29eb68){try{jsonpatch['apply'](_0x29eb68,_0x54965c,!![]);}catch(_0x3e59c5){return BPromise[_0xc832('0x1c')](_0x3e59c5);}return _0x29eb68[_0xc832('0x1d')]();};}function saveUpdates(_0x3ca30d,_0x42b7f8){return function(_0x2d9de5){if(_0x2d9de5){return _0x2d9de5[_0xc832('0x1e')](_0x3ca30d)['then'](function(_0x361526){return _0x361526;});}return null;};}function removeEntity(_0x23884c,_0x3b068d){return function(_0x111910){if(_0x111910){return _0x111910[_0xc832('0x1f')]()[_0xc832('0x20')](function(){_0x23884c[_0xc832('0x17')](0xcc)[_0xc832('0x21')]();});}};}function handleEntityNotFound(_0x357dfb,_0x3bbd44){return function(_0x315f83){if(!_0x315f83){_0x357dfb['sendStatus'](0x194);}return _0x315f83;};}function handleError(_0x36559a,_0x17a2af){_0x17a2af=_0x17a2af||0x1f4;return function(_0x4fc7c2){logger['error'](_0x4fc7c2[_0xc832('0x22')]);if(_0x4fc7c2['name']){delete _0x4fc7c2[_0xc832('0x23')];}_0x36559a[_0xc832('0x17')](_0x17a2af)[_0xc832('0x24')](_0x4fc7c2);};}exports[_0xc832('0x25')]=function(_0x2a363b,_0x97877f){var _0xdc1177={},_0x447b21={},_0x49fb4e={'count':0x0,'rows':[]};var _0x12d240=_[_0xc832('0x26')](db[_0xc832('0x27')]['rawAttributes'],function(_0x4a77f5){return{'name':_0x4a77f5['fieldName'],'type':_0x4a77f5[_0xc832('0x28')][_0xc832('0x29')]};});_0x447b21[_0xc832('0x2a')]=_['map'](_0x12d240,_0xc832('0x23'));_0x447b21[_0xc832('0x2b')]=_[_0xc832('0x2c')](_0x2a363b[_0xc832('0x2b')]);_0x447b21[_0xc832('0x2d')]=_[_0xc832('0x2e')](_0x447b21['model'],_0x447b21[_0xc832('0x2b')]);_0xdc1177[_0xc832('0x2f')]=_[_0xc832('0x2e')](_0x447b21[_0xc832('0x2a')],qs['fields'](_0x2a363b[_0xc832('0x2b')][_0xc832('0x30')]));_0xdc1177[_0xc832('0x2f')]=_0xdc1177['attributes'][_0xc832('0x31')]?_0xdc1177[_0xc832('0x2f')]:_0x447b21['model'];if(!_0x2a363b[_0xc832('0x2b')][_0xc832('0x32')](_0xc832('0x33'))){_0xdc1177[_0xc832('0x34')]=qs[_0xc832('0x34')](_0x2a363b['query'][_0xc832('0x34')]);_0xdc1177[_0xc832('0x19')]=qs[_0xc832('0x19')](_0x2a363b[_0xc832('0x2b')][_0xc832('0x19')]);}_0xdc1177[_0xc832('0x35')]=qs[_0xc832('0x36')](_0x2a363b['query'][_0xc832('0x36')]);_0xdc1177[_0xc832('0x37')]=qs[_0xc832('0x2d')](_[_0xc832('0x38')](_0x2a363b[_0xc832('0x2b')],_0x447b21[_0xc832('0x2d')]));if(_0x2a363b[_0xc832('0x2b')][_0xc832('0x39')]){_0xdc1177[_0xc832('0x37')]=_['merge'](_0xdc1177['where'],{'$or':_[_0xc832('0x26')](_0x12d240,function(_0x4d705f){if(_0x4d705f[_0xc832('0x28')]!==_0xc832('0x3a')){var _0x376c6e={};_0x376c6e[_0x4d705f['name']]={'$like':'%'+_0x2a363b[_0xc832('0x2b')][_0xc832('0x39')]+'%'};return _0x376c6e;}})});}_0xdc1177=_[_0xc832('0x3b')]({},_0xdc1177,_0x2a363b[_0xc832('0x3c')]);var _0x40799e={'where':_0xdc1177['where']};return db[_0xc832('0x27')][_0xc832('0x3d')](_0x40799e)[_0xc832('0x20')](function(_0x30d7d3){_0x49fb4e[_0xc832('0x3d')]=_0x30d7d3;if(_0x2a363b[_0xc832('0x2b')]['includeAll']){_0xdc1177[_0xc832('0x3e')]=[{'all':!![]}];}return db[_0xc832('0x27')]['findAll'](_0xdc1177);})[_0xc832('0x20')](function(_0x1e6fbb){_0x49fb4e['rows']=_0x1e6fbb;return _0x49fb4e;})['then'](respondWithFilteredResult(_0x97877f,_0xdc1177))[_0xc832('0x3f')](handleError(_0x97877f,null));};exports['show']=function(_0x57d0a5,_0x1917dd){var _0x292bda={'raw':!![],'where':{'id':_0x57d0a5['params']['id']}},_0x5f2754={};_0x5f2754[_0xc832('0x2a')]=_[_0xc832('0x2c')](db[_0xc832('0x27')]['rawAttributes']);_0x5f2754[_0xc832('0x2b')]=_[_0xc832('0x2c')](_0x57d0a5['query']);_0x5f2754[_0xc832('0x2d')]=_[_0xc832('0x2e')](_0x5f2754[_0xc832('0x2a')],_0x5f2754[_0xc832('0x2b')]);_0x292bda[_0xc832('0x2f')]=_[_0xc832('0x2e')](_0x5f2754['model'],qs[_0xc832('0x30')](_0x57d0a5[_0xc832('0x2b')]['fields']));_0x292bda[_0xc832('0x2f')]=_0x292bda[_0xc832('0x2f')][_0xc832('0x31')]?_0x292bda[_0xc832('0x2f')]:_0x5f2754[_0xc832('0x2a')];if(_0x57d0a5[_0xc832('0x2b')][_0xc832('0x40')]){_0x292bda[_0xc832('0x3e')]=[{'all':!![]}];}_0x292bda=_['merge']({},_0x292bda,_0x57d0a5['options']);return db[_0xc832('0x27')][_0xc832('0x41')](_0x292bda)[_0xc832('0x20')](handleEntityNotFound(_0x1917dd,null))['then'](respondWithResult(_0x1917dd,null))[_0xc832('0x3f')](handleError(_0x1917dd,null));};exports[_0xc832('0x42')]=function(_0x8cfeea,_0xc6bcd7){return db[_0xc832('0x27')][_0xc832('0x42')](_0x8cfeea['body'],{})[_0xc832('0x20')](respondWithResult(_0xc6bcd7,0xc9))[_0xc832('0x3f')](handleError(_0xc6bcd7,null));};exports['describe']=function(_0x324121,_0x14d9b2){return db[_0xc832('0x27')][_0xc832('0x43')]()['then'](respondWithResult(_0x14d9b2,null))[_0xc832('0x3f')](handleError(_0x14d9b2,null));};exports[_0xc832('0x1e')]=function(_0x5c5063,_0x231519){if(_0x5c5063['body'][_0xc832('0x44')]){delete _0x5c5063[_0xc832('0x45')][_0xc832('0x44')];}return db[_0xc832('0x27')][_0xc832('0x41')]({'where':{'uniqueid':_0x5c5063[_0xc832('0x46')]['id']}})[_0xc832('0x20')](handleEntityNotFound(_0x231519,null))[_0xc832('0x20')](saveUpdates(_0x5c5063['body'],null))[_0xc832('0x20')](respondWithResult(_0x231519,null))['catch'](handleError(_0x231519,null));}; \ No newline at end of file +var _0xe364=['papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','CmHopperHistory','includeAll','include','findAll','catch','show','params','rawAttributes','length','options','find','create','body','describe','uniqueid','eml-format','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0xe364,0x121));var _0x4e36=function(_0x10df1e,_0xf56f85){_0x10df1e=_0x10df1e-0x0;var _0x3e24fb=_0xe364[_0x10df1e];return _0x3e24fb;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x4e36('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4e36('0x1'));var jsonpatch=require(_0x4e36('0x2'));var rp=require(_0x4e36('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x4e36('0x4'));var path=require(_0x4e36('0x5'));var sox=require(_0x4e36('0x6'));var csv=require(_0x4e36('0x7'));var ejs=require(_0x4e36('0x8'));var fs=require('fs');var _=require(_0x4e36('0x9'));var squel=require(_0x4e36('0xa'));var crypto=require(_0x4e36('0xb'));var jsforce=require(_0x4e36('0xc'));var deskjs=require(_0x4e36('0xd'));var toCsv=require(_0x4e36('0x7'));var querystring=require(_0x4e36('0xe'));var Papa=require(_0x4e36('0xf'));var Redis=require(_0x4e36('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x4e36('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4e36('0x12'));var logger=require('../../config/logger')(_0x4e36('0x13'));var utils=require(_0x4e36('0x14'));var config=require(_0x4e36('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x555937,_0x4c4b2c){_0x4c4b2c=_0x4c4b2c||0xcc;return function(_0x29636c){if(_0x29636c){return _0x555937[_0x4e36('0x16')](_0x4c4b2c);}return _0x555937[_0x4e36('0x17')](_0x4c4b2c)[_0x4e36('0x18')]();};}function respondWithResult(_0x18b226,_0x562dfd){_0x562dfd=_0x562dfd||0xc8;return function(_0x1cf81b){if(_0x1cf81b){return _0x18b226[_0x4e36('0x17')](_0x562dfd)[_0x4e36('0x19')](_0x1cf81b);}};}function respondWithFilteredResult(_0x4f20d8,_0x4bcd39){return function(_0x3430ba){if(_0x3430ba){var _0x24f03c=_0x3430ba[_0x4e36('0x1a')],_0xb73dba=_0x4bcd39[_0x4e36('0x1b')],_0x464763=_0x4bcd39[_0x4e36('0x1b')]+_0x4bcd39[_0x4e36('0x1c')],_0x1059da;if(_0x464763>=_0x24f03c){_0x464763=_0x24f03c;_0x1059da=0xc8;}else{_0x1059da=0xce;}_0x4f20d8['status'](_0x1059da);return _0x4f20d8[_0x4e36('0x1d')](_0x4e36('0x1e'),_0xb73dba+'-'+_0x464763+'/'+_0x24f03c)['json'](_0x3430ba);}return null;};}function patchUpdates(_0x3bc1df){return function(_0x11258b){try{jsonpatch[_0x4e36('0x1f')](_0x11258b,_0x3bc1df,!![]);}catch(_0x1c7cc7){return BPromise[_0x4e36('0x20')](_0x1c7cc7);}return _0x11258b[_0x4e36('0x21')]();};}function saveUpdates(_0x16c344,_0x57e71b){return function(_0x4fa6fc){if(_0x4fa6fc){return _0x4fa6fc[_0x4e36('0x22')](_0x16c344)[_0x4e36('0x23')](function(_0xc947fb){return _0xc947fb;});}return null;};}function removeEntity(_0x4c6625,_0x20bd18){return function(_0x274513){if(_0x274513){return _0x274513[_0x4e36('0x24')]()[_0x4e36('0x23')](function(){_0x4c6625['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x508d90,_0x5bc2c9){return function(_0x339522){if(!_0x339522){_0x508d90[_0x4e36('0x16')](0x194);}return _0x339522;};}function handleError(_0x5cf2ee,_0x741f62){_0x741f62=_0x741f62||0x1f4;return function(_0x55b802){logger[_0x4e36('0x25')](_0x55b802[_0x4e36('0x26')]);if(_0x55b802[_0x4e36('0x27')]){delete _0x55b802['name'];}_0x5cf2ee[_0x4e36('0x17')](_0x741f62)[_0x4e36('0x28')](_0x55b802);};}exports[_0x4e36('0x29')]=function(_0x5c69c5,_0x10759c){var _0x5e57ff={},_0x4b9d35={},_0xcc292={'count':0x0,'rows':[]};var _0x1ea31e=_[_0x4e36('0x2a')](db['CmHopperHistory']['rawAttributes'],function(_0x59e984){return{'name':_0x59e984[_0x4e36('0x2b')],'type':_0x59e984[_0x4e36('0x2c')][_0x4e36('0x2d')]};});_0x4b9d35[_0x4e36('0x2e')]=_[_0x4e36('0x2a')](_0x1ea31e,'name');_0x4b9d35['query']=_[_0x4e36('0x2f')](_0x5c69c5[_0x4e36('0x30')]);_0x4b9d35[_0x4e36('0x31')]=_[_0x4e36('0x32')](_0x4b9d35[_0x4e36('0x2e')],_0x4b9d35['query']);_0x5e57ff[_0x4e36('0x33')]=_[_0x4e36('0x32')](_0x4b9d35[_0x4e36('0x2e')],qs['fields'](_0x5c69c5[_0x4e36('0x30')][_0x4e36('0x34')]));_0x5e57ff['attributes']=_0x5e57ff['attributes']['length']?_0x5e57ff[_0x4e36('0x33')]:_0x4b9d35[_0x4e36('0x2e')];if(!_0x5c69c5['query'][_0x4e36('0x35')](_0x4e36('0x36'))){_0x5e57ff[_0x4e36('0x1c')]=qs[_0x4e36('0x1c')](_0x5c69c5[_0x4e36('0x30')][_0x4e36('0x1c')]);_0x5e57ff[_0x4e36('0x1b')]=qs[_0x4e36('0x1b')](_0x5c69c5[_0x4e36('0x30')][_0x4e36('0x1b')]);}_0x5e57ff[_0x4e36('0x37')]=qs['sort'](_0x5c69c5['query'][_0x4e36('0x38')]);_0x5e57ff[_0x4e36('0x39')]=qs[_0x4e36('0x31')](_[_0x4e36('0x3a')](_0x5c69c5['query'],_0x4b9d35[_0x4e36('0x31')]));if(_0x5c69c5[_0x4e36('0x30')][_0x4e36('0x3b')]){_0x5e57ff['where']=_[_0x4e36('0x3c')](_0x5e57ff[_0x4e36('0x39')],{'$or':_['map'](_0x1ea31e,function(_0x31083b){if(_0x31083b['type']!=='VIRTUAL'){var _0xe5cee3={};_0xe5cee3[_0x31083b[_0x4e36('0x27')]]={'$like':'%'+_0x5c69c5[_0x4e36('0x30')][_0x4e36('0x3b')]+'%'};return _0xe5cee3;}})});}_0x5e57ff=_[_0x4e36('0x3c')]({},_0x5e57ff,_0x5c69c5['options']);var _0x10e54c={'where':_0x5e57ff[_0x4e36('0x39')]};return db[_0x4e36('0x3d')][_0x4e36('0x1a')](_0x10e54c)['then'](function(_0x5c4324){_0xcc292[_0x4e36('0x1a')]=_0x5c4324;if(_0x5c69c5[_0x4e36('0x30')][_0x4e36('0x3e')]){_0x5e57ff[_0x4e36('0x3f')]=[{'all':!![]}];}return db[_0x4e36('0x3d')][_0x4e36('0x40')](_0x5e57ff);})[_0x4e36('0x23')](function(_0x359056){_0xcc292['rows']=_0x359056;return _0xcc292;})[_0x4e36('0x23')](respondWithFilteredResult(_0x10759c,_0x5e57ff))[_0x4e36('0x41')](handleError(_0x10759c,null));};exports[_0x4e36('0x42')]=function(_0x4daa3a,_0xf9dd2d){var _0x50c43c={'raw':!![],'where':{'id':_0x4daa3a[_0x4e36('0x43')]['id']}},_0x57251e={};_0x57251e[_0x4e36('0x2e')]=_[_0x4e36('0x2f')](db[_0x4e36('0x3d')][_0x4e36('0x44')]);_0x57251e[_0x4e36('0x30')]=_['keys'](_0x4daa3a[_0x4e36('0x30')]);_0x57251e[_0x4e36('0x31')]=_['intersection'](_0x57251e['model'],_0x57251e[_0x4e36('0x30')]);_0x50c43c[_0x4e36('0x33')]=_[_0x4e36('0x32')](_0x57251e[_0x4e36('0x2e')],qs[_0x4e36('0x34')](_0x4daa3a[_0x4e36('0x30')][_0x4e36('0x34')]));_0x50c43c[_0x4e36('0x33')]=_0x50c43c[_0x4e36('0x33')][_0x4e36('0x45')]?_0x50c43c[_0x4e36('0x33')]:_0x57251e[_0x4e36('0x2e')];if(_0x4daa3a[_0x4e36('0x30')][_0x4e36('0x3e')]){_0x50c43c[_0x4e36('0x3f')]=[{'all':!![]}];}_0x50c43c=_[_0x4e36('0x3c')]({},_0x50c43c,_0x4daa3a[_0x4e36('0x46')]);return db[_0x4e36('0x3d')][_0x4e36('0x47')](_0x50c43c)[_0x4e36('0x23')](handleEntityNotFound(_0xf9dd2d,null))['then'](respondWithResult(_0xf9dd2d,null))[_0x4e36('0x41')](handleError(_0xf9dd2d,null));};exports[_0x4e36('0x48')]=function(_0x5e1ba8,_0x801939){return db[_0x4e36('0x3d')]['create'](_0x5e1ba8[_0x4e36('0x49')],{})[_0x4e36('0x23')](respondWithResult(_0x801939,0xc9))['catch'](handleError(_0x801939,null));};exports[_0x4e36('0x4a')]=function(_0x243368,_0x561750){return db[_0x4e36('0x3d')]['describe']()['then'](respondWithResult(_0x561750,null))[_0x4e36('0x41')](handleError(_0x561750,null));};exports[_0x4e36('0x22')]=function(_0x2e3f87,_0x4f4cd9){if(_0x2e3f87[_0x4e36('0x49')]['uniqueid']){delete _0x2e3f87[_0x4e36('0x49')][_0x4e36('0x4b')];}return db[_0x4e36('0x3d')]['find']({'where':{'uniqueid':_0x2e3f87[_0x4e36('0x43')]['id']}})[_0x4e36('0x23')](handleEntityNotFound(_0x4f4cd9,null))['then'](saveUpdates(_0x2e3f87[_0x4e36('0x49')],null))[_0x4e36('0x23')](respondWithResult(_0x4f4cd9,null))[_0x4e36('0x41')](handleError(_0x4f4cd9,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index df97476..4d696bb 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 _0x6f07=['bluebird','path','./cmHopperHistory.attributes','define','CmHopperHistory','cm_hopper_history','endtime','uniqueid','lodash','util','../../config/logger','api','moment'];(function(_0x125ff8,_0x41925f){var _0x2d9ef=function(_0x4ef34c){while(--_0x4ef34c){_0x125ff8['push'](_0x125ff8['shift']());}};_0x2d9ef(++_0x41925f);}(_0x6f07,0x1e9));var _0x76f0=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x6f07[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x76f0('0x0'));var util=require(_0x76f0('0x1'));var logger=require(_0x76f0('0x2'))(_0x76f0('0x3'));var moment=require(_0x76f0('0x4'));var BPromise=require(_0x76f0('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x76f0('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x76f0('0x7'));module['exports']=function(_0xab62cd,_0x238437){return _0xab62cd[_0x76f0('0x8')](_0x76f0('0x9'),attributes,{'tableName':_0x76f0('0xa'),'paranoid':![],'indexes':[{'name':_0x76f0('0xb'),'fields':['endtime']},{'name':_0x76f0('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x2535=['lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','exports','CmHopperHistory','endtime','uniqueid'];(function(_0x3ae98b,_0x36e8a7){var _0x489dd9=function(_0x41a931){while(--_0x41a931){_0x3ae98b['push'](_0x3ae98b['shift']());}};_0x489dd9(++_0x36e8a7);}(_0x2535,0x174));var _0x5253=function(_0x17421a,_0x65b6ee){_0x17421a=_0x17421a-0x0;var _0x4eaf23=_0x2535[_0x17421a];return _0x4eaf23;};'use strict';var _=require(_0x5253('0x0'));var util=require(_0x5253('0x1'));var logger=require(_0x5253('0x2'))('api');var moment=require(_0x5253('0x3'));var BPromise=require(_0x5253('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5253('0x5'));var rimraf=require(_0x5253('0x6'));var config=require(_0x5253('0x7'));var attributes=require('./cmHopperHistory.attributes');module[_0x5253('0x8')]=function(_0x1f7bbd,_0x2a8882){return _0x1f7bbd['define'](_0x5253('0x9'),attributes,{'tableName':'cm_hopper_history','paranoid':![],'indexes':[{'name':_0x5253('0xa'),'fields':['endtime']},{'name':'uniqueid','fields':[_0x5253('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index 7dd1fe4..c4dc93d 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 _0xe511=['outboundAnswerAgiCallsDay','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetVoiceQueueHopperHistory','col','ivrTotalCallsDays','GetCampaignHopperHistory','lodash','util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateCmHopperHistory','CmHopperHistory','body','options','raw','then','AvgHandleTime','findAll','where','sequelize','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','COUNT','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','literal','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','catch','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','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundRejectCallsDay'];(function(_0x34ebcd,_0x2f8150){var _0x1b142a=function(_0xc396c5){while(--_0xc396c5){_0x34ebcd['push'](_0x34ebcd['shift']());}};_0x1b142a(++_0x2f8150);}(_0xe511,0x16f));var _0x1e51=function(_0x43eb54,_0x35e944){_0x43eb54=_0x43eb54-0x0;var _0x3892ac=_0xe511[_0x43eb54];return _0x3892ac;};'use strict';var _=require(_0x1e51('0x0'));var util=require(_0x1e51('0x1'));var moment=require('moment');var BPromise=require(_0x1e51('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1e51('0x3'));var db=require(_0x1e51('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x1e51('0x5'))(_0x1e51('0x6'));var config=require(_0x1e51('0x7'));var jayson=require(_0x1e51('0x8'));var client=jayson['client'][_0x1e51('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x21ed6b,_0x5c4590,_0x4fa2ba){return new BPromise(function(_0x394ad8,_0x133021){return client['request'](_0x21ed6b,_0x4fa2ba)['then'](function(_0x658941){logger[_0x1e51('0xa')](_0x1e51('0xb'),_0x5c4590,_0x1e51('0xc'));logger[_0x1e51('0xd')](_0x1e51('0xe'),_0x5c4590,'request\x20sent',JSON[_0x1e51('0xf')](_0x658941));if(_0x658941[_0x1e51('0x10')]){if(_0x658941[_0x1e51('0x10')][_0x1e51('0x11')]===0x1f4){logger[_0x1e51('0x10')](_0x1e51('0xb'),_0x5c4590,_0x658941['error'][_0x1e51('0x12')]);return _0x133021(_0x658941[_0x1e51('0x10')][_0x1e51('0x12')]);}logger[_0x1e51('0x10')](_0x1e51('0xb'),_0x5c4590,_0x658941[_0x1e51('0x10')][_0x1e51('0x12')]);return _0x394ad8(_0x658941[_0x1e51('0x10')][_0x1e51('0x12')]);}else{logger[_0x1e51('0xa')]('CmHopperHistory,\x20%s,\x20%s',_0x5c4590,_0x1e51('0xc'));_0x394ad8(_0x658941[_0x1e51('0x13')][_0x1e51('0x12')]);}})['catch'](function(_0xa3b410){logger['error']('CmHopperHistory,\x20%s,\x20%s',_0x5c4590,_0xa3b410);_0x133021(_0xa3b410);});});}exports[_0x1e51('0x14')]=function(_0x27dcad){var _0x40ae4c=this;return new Promise(function(_0x4785a5,_0x4d1aae){return db[_0x1e51('0x15')]['create'](_0x27dcad[_0x1e51('0x16')],{'raw':_0x27dcad['options']?_0x27dcad[_0x1e51('0x17')][_0x1e51('0x18')]===undefined?!![]:![]:!![]})[_0x1e51('0x19')](function(_0x183a95){logger['info']('CreateCmHopperHistory',_0x27dcad);logger['debug']('CreateCmHopperHistory',_0x27dcad,JSON[_0x1e51('0xf')](_0x183a95));_0x4785a5(_0x183a95);})['catch'](function(_0x3f7340){logger[_0x1e51('0x10')](_0x1e51('0x14'),_0x3f7340[_0x1e51('0x12')],_0x27dcad);_0x4d1aae(_0x40ae4c[_0x1e51('0x10')](0x1f4,_0x3f7340[_0x1e51('0x12')]));});});};exports[_0x1e51('0x1a')]=function(_0x461d3d){var _0x4bcdd3=this;return new Promise(function(_0x4d04c0,_0x43f5c5){return db[_0x1e51('0x15')][_0x1e51('0x1b')]({'raw':_0x461d3d[_0x1e51('0x17')]?_0x461d3d['options']['raw']===undefined?!![]:![]:!![],'where':_0x461d3d['options']?_0x461d3d[_0x1e51('0x17')][_0x1e51('0x1c')]||null:null,'attributes':[[db[_0x1e51('0x1d')]['fn']('COUNT',db[_0x1e51('0x1d')]['col']('id')),'predictiveIntervalTotalCalls'],[db[_0x1e51('0x1d')]['fn']('COUNT',db[_0x1e51('0x1d')]['fn']('IF',db[_0x1e51('0x1d')]['literal'](_0x1e51('0x1e')))),_0x1e51('0x1f')],[db[_0x1e51('0x1d')]['fn'](_0x1e51('0x20'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0x1e51('0x21')))),_0x1e51('0x22')],[db[_0x1e51('0x1d')]['fn'](_0x1e51('0x20'),db[_0x1e51('0x1d')]['fn']('IF',db[_0x1e51('0x1d')][_0x1e51('0x23')](_0x1e51('0x24')))),_0x1e51('0x25')],[db[_0x1e51('0x1d')]['fn'](_0x1e51('0x26'),db['sequelize']['fn']('IF',db[_0x1e51('0x1d')][_0x1e51('0x23')](_0x1e51('0x27')))),_0x1e51('0x28')],[db[_0x1e51('0x1d')]['fn']('AVG',db[_0x1e51('0x1d')]['fn']('IF',db['sequelize'][_0x1e51('0x23')](_0x1e51('0x29')))),_0x1e51('0x2a')]]})['then'](function(_0x3e3742){logger['info'](_0x1e51('0x1a'),_0x461d3d);logger['debug']('AvgHandleTime',_0x461d3d,JSON[_0x1e51('0xf')](_0x3e3742));_0x4d04c0(_0x3e3742);})[_0x1e51('0x2b')](function(_0x45313e){logger['error'](_0x1e51('0x1a'),_0x45313e['message'],_0x461d3d);_0x43f5c5(_0x4bcdd3[_0x1e51('0x10')](0x1f4,_0x45313e[_0x1e51('0x12')]));});});};exports['GetVoiceQueueHopperHistory']=function(_0xd4fd91){var _0x1bab7f=this;return new Promise(function(_0x433cb1,_0xeeff34){return db[_0x1e51('0x15')][_0x1e51('0x1b')]({'raw':_0xd4fd91['options']?_0xd4fd91['options'][_0x1e51('0x18')]===undefined?!![]:![]:!![],'where':_0xd4fd91['options']?_0xd4fd91[_0x1e51('0x17')][_0x1e51('0x1c')]||null:null,'attributes':[[_0x1e51('0x2c'),_0x1e51('0x2d')],[db[_0x1e51('0x1d')]['fn'](_0x1e51('0x20'),db[_0x1e51('0x1d')]['fn']('IF',db[_0x1e51('0x1d')][_0x1e51('0x23')](_0x1e51('0x2e')))),_0x1e51('0x2f')],[db['sequelize']['fn'](_0x1e51('0x20'),db['sequelize']['fn']('IF',db[_0x1e51('0x1d')][_0x1e51('0x23')](_0x1e51('0x30')))),_0x1e51('0x31')],[db[_0x1e51('0x1d')]['fn'](_0x1e51('0x20'),db[_0x1e51('0x1d')]['fn']('IF',db[_0x1e51('0x1d')][_0x1e51('0x23')](_0x1e51('0x1e')))),_0x1e51('0x32')],[db['sequelize']['fn']('COUNT',db[_0x1e51('0x1d')]['fn']('IF',db[_0x1e51('0x1d')][_0x1e51('0x23')](_0x1e51('0x33')))),_0x1e51('0x34')],[db[_0x1e51('0x1d')]['fn'](_0x1e51('0x20'),db[_0x1e51('0x1d')]['fn']('IF',db['sequelize'][_0x1e51('0x23')](_0x1e51('0x35')))),_0x1e51('0x36')],[db[_0x1e51('0x1d')]['fn'](_0x1e51('0x20'),db[_0x1e51('0x1d')]['fn']('IF',db[_0x1e51('0x1d')]['literal'](_0x1e51('0x37')))),_0x1e51('0x38')],[db['sequelize']['fn'](_0x1e51('0x20'),db[_0x1e51('0x1d')]['fn']('IF',db[_0x1e51('0x1d')]['literal'](_0x1e51('0x39')))),_0x1e51('0x3a')],[db[_0x1e51('0x1d')]['fn'](_0x1e51('0x20'),db[_0x1e51('0x1d')]['fn']('IF',db[_0x1e51('0x1d')][_0x1e51('0x23')](_0x1e51('0x3b')))),_0x1e51('0x3c')],[db['sequelize']['fn'](_0x1e51('0x20'),db[_0x1e51('0x1d')]['fn']('IF',db['sequelize'][_0x1e51('0x23')](_0x1e51('0x3d')))),_0x1e51('0x3e')],[db['sequelize']['fn'](_0x1e51('0x20'),db[_0x1e51('0x1d')]['fn']('IF',db[_0x1e51('0x1d')]['literal'](_0x1e51('0x3f')))),'outboundOriginateFailureCallsDay'],[db['sequelize']['fn']('COUNT',db[_0x1e51('0x1d')]['fn']('IF',db[_0x1e51('0x1d')]['literal']('`state`\x20=\x2018,\x201,\x20null'))),_0x1e51('0x40')],[db[_0x1e51('0x1d')]['fn'](_0x1e51('0x20'),db[_0x1e51('0x1d')]['fn']('IF',db[_0x1e51('0x1d')][_0x1e51('0x23')]('`state`\x20=\x2016,\x201,\x20null'))),_0x1e51('0x41')],[db['sequelize']['fn'](_0x1e51('0x20'),db[_0x1e51('0x1d')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2020,\x201,\x20null'))),_0x1e51('0x40')],[db[_0x1e51('0x1d')]['fn'](_0x1e51('0x20'),db['sequelize']['fn']('IF',db[_0x1e51('0x1d')][_0x1e51('0x23')](_0x1e51('0x42')))),_0x1e51('0x43')]],'group':[_0x1e51('0x2c')]})[_0x1e51('0x19')](function(_0x32fe1f){logger[_0x1e51('0xa')]('GetVoiceQueueHopperHistory',_0xd4fd91);logger[_0x1e51('0xd')](_0x1e51('0x44'),_0xd4fd91,JSON[_0x1e51('0xf')](_0x32fe1f));_0x433cb1(_0x32fe1f);})[_0x1e51('0x2b')](function(_0x177b63){logger[_0x1e51('0x10')]('GetVoiceQueueHopperHistory',_0x177b63[_0x1e51('0x12')],_0xd4fd91);_0xeeff34(_0x1bab7f['error'](0x1f4,_0x177b63['message']));});});};exports['GetCampaignHopperHistory']=function(_0xd353e3){var _0xfbc40f=this;return new Promise(function(_0x4b2046,_0x56f9ba){return db[_0x1e51('0x15')][_0x1e51('0x1b')]({'raw':_0xd353e3[_0x1e51('0x17')]?_0xd353e3['options'][_0x1e51('0x18')]===undefined?!![]:![]:!![],'where':_0xd353e3[_0x1e51('0x17')]?_0xd353e3[_0x1e51('0x17')]['where']||null:null,'attributes':[[_0x1e51('0x2c'),_0x1e51('0x2d')],[db[_0x1e51('0x1d')]['fn'](_0x1e51('0x20'),db[_0x1e51('0x1d')][_0x1e51('0x45')]('id')),_0x1e51('0x46')],[db[_0x1e51('0x1d')]['fn']('COUNT',db[_0x1e51('0x1d')]['fn']('IF',db[_0x1e51('0x1d')]['literal']('`state`\x20=\x204,\x201,\x20null'))),'ivrAnswerCallsDay']],'group':[_0x1e51('0x2c')]})[_0x1e51('0x19')](function(_0x2ffd82){logger[_0x1e51('0xa')](_0x1e51('0x47'),_0xd353e3);logger[_0x1e51('0xd')](_0x1e51('0x47'),_0xd353e3,JSON[_0x1e51('0xf')](_0x2ffd82));_0x4b2046(_0x2ffd82);})[_0x1e51('0x2b')](function(_0x47a961){logger['error']('GetCampaignHopperHistory',_0x47a961[_0x1e51('0x12')],_0xd353e3);_0x56f9ba(_0xfbc40f[_0x1e51('0x10')](0x1f4,_0x47a961['message']));});});}; \ No newline at end of file +var _0x4024=['randomstring','../../mysqldb','../../config/logger','rpc','client','http','request','info','request\x20sent','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','code','CmHopperHistory,\x20%s,\x20%s','message','result','catch','CreateCmHopperHistory','CmHopperHistory','body','options','raw','debug','AvgHandleTime','where','sequelize','col','predictiveIntervalTotalCalls','COUNT','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','literal','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','AVG','`state`\x20=\x204,\x20`talktime`,\x20null','then','GetVoiceQueueHopperHistory','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','campaign','ivrTotalCallsDays','ivrAnswerCallsDay','GetCampaignHopperHistory','lodash','util','bluebird'];(function(_0x445d79,_0xcab620){var _0x359f43=function(_0x3b8a6f){while(--_0x3b8a6f){_0x445d79['push'](_0x445d79['shift']());}};_0x359f43(++_0xcab620);}(_0x4024,0x89));var _0x4402=function(_0x54161a,_0x5022b1){_0x54161a=_0x54161a-0x0;var _0x39ce2f=_0x4024[_0x54161a];return _0x39ce2f;};'use strict';var _=require(_0x4402('0x0'));var util=require(_0x4402('0x1'));var moment=require('moment');var BPromise=require(_0x4402('0x2'));var rs=require(_0x4402('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4402('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x4402('0x5'))(_0x4402('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4402('0x7')][_0x4402('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x168acd,_0x4ed77d,_0x3045ae){return new BPromise(function(_0x5d7ca4,_0x5c0b70){return client[_0x4402('0x9')](_0x168acd,_0x3045ae)['then'](function(_0x4d2882){logger[_0x4402('0xa')]('CmHopperHistory,\x20%s,\x20%s',_0x4ed77d,_0x4402('0xb'));logger['debug'](_0x4402('0xc'),_0x4ed77d,'request\x20sent',JSON[_0x4402('0xd')](_0x4d2882));if(_0x4d2882[_0x4402('0xe')]){if(_0x4d2882['error'][_0x4402('0xf')]===0x1f4){logger[_0x4402('0xe')](_0x4402('0x10'),_0x4ed77d,_0x4d2882['error'][_0x4402('0x11')]);return _0x5c0b70(_0x4d2882[_0x4402('0xe')][_0x4402('0x11')]);}logger[_0x4402('0xe')](_0x4402('0x10'),_0x4ed77d,_0x4d2882[_0x4402('0xe')][_0x4402('0x11')]);return _0x5d7ca4(_0x4d2882[_0x4402('0xe')][_0x4402('0x11')]);}else{logger[_0x4402('0xa')](_0x4402('0x10'),_0x4ed77d,_0x4402('0xb'));_0x5d7ca4(_0x4d2882[_0x4402('0x12')][_0x4402('0x11')]);}})[_0x4402('0x13')](function(_0x30c390){logger[_0x4402('0xe')](_0x4402('0x10'),_0x4ed77d,_0x30c390);_0x5c0b70(_0x30c390);});});}exports[_0x4402('0x14')]=function(_0x231382){var _0x5b127f=this;return new Promise(function(_0x494389,_0x663ab7){return db[_0x4402('0x15')]['create'](_0x231382[_0x4402('0x16')],{'raw':_0x231382[_0x4402('0x17')]?_0x231382['options'][_0x4402('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x55cc8c){logger[_0x4402('0xa')](_0x4402('0x14'),_0x231382);logger[_0x4402('0x19')]('CreateCmHopperHistory',_0x231382,JSON[_0x4402('0xd')](_0x55cc8c));_0x494389(_0x55cc8c);})['catch'](function(_0x47ab54){logger[_0x4402('0xe')](_0x4402('0x14'),_0x47ab54[_0x4402('0x11')],_0x231382);_0x663ab7(_0x5b127f[_0x4402('0xe')](0x1f4,_0x47ab54[_0x4402('0x11')]));});});};exports[_0x4402('0x1a')]=function(_0x289a3e){var _0x6b1fc5=this;return new Promise(function(_0x24a9b8,_0x4d6846){return db[_0x4402('0x15')]['findAll']({'raw':_0x289a3e[_0x4402('0x17')]?_0x289a3e[_0x4402('0x17')][_0x4402('0x18')]===undefined?!![]:![]:!![],'where':_0x289a3e[_0x4402('0x17')]?_0x289a3e['options'][_0x4402('0x1b')]||null:null,'attributes':[[db['sequelize']['fn']('COUNT',db[_0x4402('0x1c')][_0x4402('0x1d')]('id')),_0x4402('0x1e')],[db[_0x4402('0x1c')]['fn'](_0x4402('0x1f'),db['sequelize']['fn']('IF',db[_0x4402('0x1c')]['literal'](_0x4402('0x20')))),_0x4402('0x21')],[db[_0x4402('0x1c')]['fn']('COUNT',db[_0x4402('0x1c')]['fn']('IF',db[_0x4402('0x1c')][_0x4402('0x22')](_0x4402('0x23')))),_0x4402('0x24')],[db[_0x4402('0x1c')]['fn'](_0x4402('0x1f'),db[_0x4402('0x1c')]['fn']('IF',db[_0x4402('0x1c')][_0x4402('0x22')](_0x4402('0x25')))),'predictiveIntervalDroppedCallsCallersExit'],[db[_0x4402('0x1c')]['fn']('AVG',db[_0x4402('0x1c')]['fn']('IF',db['sequelize'][_0x4402('0x22')](_0x4402('0x26')))),_0x4402('0x27')],[db[_0x4402('0x1c')]['fn'](_0x4402('0x28'),db['sequelize']['fn']('IF',db[_0x4402('0x1c')][_0x4402('0x22')](_0x4402('0x29')))),'predictiveIntervalAvgTalktime']]})[_0x4402('0x2a')](function(_0x3383e3){logger['info'](_0x4402('0x1a'),_0x289a3e);logger[_0x4402('0x19')](_0x4402('0x1a'),_0x289a3e,JSON[_0x4402('0xd')](_0x3383e3));_0x24a9b8(_0x3383e3);})[_0x4402('0x13')](function(_0x235f30){logger[_0x4402('0xe')](_0x4402('0x1a'),_0x235f30[_0x4402('0x11')],_0x289a3e);_0x4d6846(_0x6b1fc5['error'](0x1f4,_0x235f30[_0x4402('0x11')]));});});};exports[_0x4402('0x2b')]=function(_0x2a1657){var _0x566a80=this;return new Promise(function(_0x34e4ae,_0x1c1ac3){return db['CmHopperHistory']['findAll']({'raw':_0x2a1657[_0x4402('0x17')]?_0x2a1657[_0x4402('0x17')][_0x4402('0x18')]===undefined?!![]:![]:!![],'where':_0x2a1657[_0x4402('0x17')]?_0x2a1657['options']['where']||null:null,'attributes':[['campaign',_0x4402('0x2c')],[db[_0x4402('0x1c')]['fn'](_0x4402('0x1f'),db[_0x4402('0x1c')]['fn']('IF',db['sequelize'][_0x4402('0x22')](_0x4402('0x2d')))),_0x4402('0x2e')],[db['sequelize']['fn'](_0x4402('0x1f'),db['sequelize']['fn']('IF',db[_0x4402('0x1c')][_0x4402('0x22')]('`state`\x20=\x203,\x201,\x20null'))),_0x4402('0x2f')],[db['sequelize']['fn'](_0x4402('0x1f'),db[_0x4402('0x1c')]['fn']('IF',db['sequelize'][_0x4402('0x22')](_0x4402('0x20')))),_0x4402('0x30')],[db[_0x4402('0x1c')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x4402('0x1c')]['literal'](_0x4402('0x31')))),_0x4402('0x32')],[db[_0x4402('0x1c')]['fn'](_0x4402('0x1f'),db[_0x4402('0x1c')]['fn']('IF',db[_0x4402('0x1c')][_0x4402('0x22')](_0x4402('0x33')))),_0x4402('0x34')],[db[_0x4402('0x1c')]['fn']('COUNT',db[_0x4402('0x1c')]['fn']('IF',db[_0x4402('0x1c')]['literal'](_0x4402('0x35')))),_0x4402('0x36')],[db['sequelize']['fn'](_0x4402('0x1f'),db[_0x4402('0x1c')]['fn']('IF',db[_0x4402('0x1c')][_0x4402('0x22')](_0x4402('0x37')))),'outboundDropCallsDayCallersExit'],[db[_0x4402('0x1c')]['fn'](_0x4402('0x1f'),db[_0x4402('0x1c')]['fn']('IF',db[_0x4402('0x1c')][_0x4402('0x22')](_0x4402('0x38')))),_0x4402('0x39')],[db[_0x4402('0x1c')]['fn'](_0x4402('0x1f'),db[_0x4402('0x1c')]['fn']('IF',db[_0x4402('0x1c')]['literal'](_0x4402('0x3a')))),'outboundBlacklistCallsDay'],[db[_0x4402('0x1c')]['fn'](_0x4402('0x1f'),db['sequelize']['fn']('IF',db[_0x4402('0x1c')][_0x4402('0x22')](_0x4402('0x3b')))),_0x4402('0x3c')],[db[_0x4402('0x1c')]['fn'](_0x4402('0x1f'),db['sequelize']['fn']('IF',db[_0x4402('0x1c')][_0x4402('0x22')](_0x4402('0x3d')))),_0x4402('0x3e')],[db[_0x4402('0x1c')]['fn'](_0x4402('0x1f'),db[_0x4402('0x1c')]['fn']('IF',db[_0x4402('0x1c')][_0x4402('0x22')]('`state`\x20=\x2016,\x201,\x20null'))),'outboundAnswerAgiCallsDay'],[db['sequelize']['fn']('COUNT',db[_0x4402('0x1c')]['fn']('IF',db[_0x4402('0x1c')][_0x4402('0x22')](_0x4402('0x3f')))),'outboundRejectCallsDay'],[db[_0x4402('0x1c')]['fn'](_0x4402('0x1f'),db[_0x4402('0x1c')]['fn']('IF',db[_0x4402('0x1c')][_0x4402('0x22')](_0x4402('0x40')))),_0x4402('0x41')]],'group':['campaign']})[_0x4402('0x2a')](function(_0x2a8085){logger[_0x4402('0xa')](_0x4402('0x2b'),_0x2a1657);logger[_0x4402('0x19')](_0x4402('0x2b'),_0x2a1657,JSON['stringify'](_0x2a8085));_0x34e4ae(_0x2a8085);})[_0x4402('0x13')](function(_0x642ab4){logger[_0x4402('0xe')](_0x4402('0x2b'),_0x642ab4[_0x4402('0x11')],_0x2a1657);_0x1c1ac3(_0x566a80[_0x4402('0xe')](0x1f4,_0x642ab4[_0x4402('0x11')]));});});};exports['GetCampaignHopperHistory']=function(_0x48e138){var _0x1a94f5=this;return new Promise(function(_0xb82409,_0x219472){return db['CmHopperHistory']['findAll']({'raw':_0x48e138[_0x4402('0x17')]?_0x48e138[_0x4402('0x17')][_0x4402('0x18')]===undefined?!![]:![]:!![],'where':_0x48e138[_0x4402('0x17')]?_0x48e138[_0x4402('0x17')][_0x4402('0x1b')]||null:null,'attributes':[[_0x4402('0x42'),_0x4402('0x2c')],[db[_0x4402('0x1c')]['fn'](_0x4402('0x1f'),db[_0x4402('0x1c')][_0x4402('0x1d')]('id')),_0x4402('0x43')],[db['sequelize']['fn'](_0x4402('0x1f'),db['sequelize']['fn']('IF',db[_0x4402('0x1c')]['literal'](_0x4402('0x20')))),_0x4402('0x44')]],'group':[_0x4402('0x42')]})[_0x4402('0x2a')](function(_0x1f298c){logger[_0x4402('0xa')]('GetCampaignHopperHistory',_0x48e138);logger[_0x4402('0x19')](_0x4402('0x45'),_0x48e138,JSON[_0x4402('0xd')](_0x1f298c));_0xb82409(_0x1f298c);})[_0x4402('0x13')](function(_0xb341ab){logger['error'](_0x4402('0x45'),_0xb341ab[_0x4402('0x11')],_0x48e138);_0x219472(_0x1a94f5[_0x4402('0xe')](0x1f4,_0xb341ab[_0x4402('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index ea02347..60c90ac 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 _0x7919=['connect-timeout','express','Router','../../components/auth/service','../../config/environment','./cmHopperHistory.controller','isAuthenticated','index','get','/describe','put','/:id','update','exports','multer','util','path'];(function(_0x1becbd,_0x13b851){var _0x302014=function(_0x41a6fa){while(--_0x41a6fa){_0x1becbd['push'](_0x1becbd['shift']());}};_0x302014(++_0x13b851);}(_0x7919,0xeb));var _0x9791=function(_0x25ed8a,_0xccf6f5){_0x25ed8a=_0x25ed8a-0x0;var _0x23310c=_0x7919[_0x25ed8a];return _0x23310c;};'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'));var controller=require(_0x9791('0x8'));router['get']('/',auth[_0x9791('0x9')](),controller[_0x9791('0xa')]);router[_0x9791('0xb')](_0x9791('0xc'),auth[_0x9791('0x9')](),controller['describe']);router[_0x9791('0xb')]('/:id',auth[_0x9791('0x9')](),controller['show']);router['post']('/',auth[_0x9791('0x9')](),controller['create']);router[_0x9791('0xd')](_0x9791('0xe'),auth[_0x9791('0x9')](),controller[_0x9791('0xf')]);module[_0x9791('0x10')]=router; \ No newline at end of file +var _0x8343=['put','multer','util','path','express','../../components/auth/service','get','isAuthenticated','index','/describe','describe','show','post','create'];(function(_0x771660,_0x339505){var _0x42c005=function(_0x310863){while(--_0x310863){_0x771660['push'](_0x771660['shift']());}};_0x42c005(++_0x339505);}(_0x8343,0xa9));var _0x3834=function(_0xa34105,_0x210c4b){_0xa34105=_0xa34105-0x0;var _0x55820a=_0x8343[_0xa34105];return _0x55820a;};'use strict';var multer=require(_0x3834('0x0'));var util=require(_0x3834('0x1'));var path=require(_0x3834('0x2'));var timeout=require('connect-timeout');var express=require(_0x3834('0x3'));var router=express['Router']();var auth=require(_0x3834('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./cmHopperHistory.controller');router[_0x3834('0x5')]('/',auth[_0x3834('0x6')](),controller[_0x3834('0x7')]);router['get'](_0x3834('0x8'),auth[_0x3834('0x6')](),controller[_0x3834('0x9')]);router[_0x3834('0x5')]('/:id',auth['isAuthenticated'](),controller[_0x3834('0xa')]);router[_0x3834('0xb')]('/',auth[_0x3834('0x6')](),controller[_0x3834('0xc')]);router[_0x3834('0xd')]('/:id',auth[_0x3834('0x6')](),controller['update']);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index c520962..8e5d0a9 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 _0xaeb2=['sequelize','exports','STRING'];(function(_0x597644,_0x4b5cea){var _0x5d5d22=function(_0xd69ddd){while(--_0xd69ddd){_0x597644['push'](_0x597644['shift']());}};_0x5d5d22(++_0x4b5cea);}(_0xaeb2,0x171));var _0x2aeb=function(_0x4c45b2,_0x3fc02f){_0x4c45b2=_0x4c45b2-0x0;var _0x14ec15=_0xaeb2[_0x4c45b2];return _0x14ec15;};'use strict';var Sequelize=require(_0x2aeb('0x0'));module[_0x2aeb('0x1')]={'name':{'type':Sequelize[_0x2aeb('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x2aeb('0x2')]},'dialPrefix':{'type':Sequelize[_0x2aeb('0x2')]}}; \ No newline at end of file +var _0xbc92=['exports','STRING','name'];(function(_0x1c12de,_0x426242){var _0x21da18=function(_0x17ad78){while(--_0x17ad78){_0x1c12de['push'](_0x1c12de['shift']());}};_0x21da18(++_0x426242);}(_0xbc92,0xd8));var _0x2bc9=function(_0x51fe86,_0x422b66){_0x51fe86=_0x51fe86-0x0;var _0x3557d4=_0xbc92[_0x51fe86];return _0x3557d4;};'use strict';var Sequelize=require('sequelize');module[_0x2bc9('0x0')]={'name':{'type':Sequelize[_0x2bc9('0x1')],'unique':_0x2bc9('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x2bc9('0x1')]},'dialPrefix':{'type':Sequelize[_0x2bc9('0x1')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index f8b84df..14a9f10 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 _0x9c44=['fields','attributes','length','hasOwnProperty','nolimit','limit','sort','pick','filter','where','merge','VIRTUAL','options','include','findAll','rows','show','params','keys','includeAll','find','catch','create','user','role','UserProfileSection','userProfileId','autoAssociation','update','body','describe','ListId','getDispositions','findOne','order','Disposition','removeDispositions','ids','addContacts','CmContact','tags','isArray','join','push','each','omit','success','dataValues','errors','getContacts','CmCustomField','CustomFields','concat','raw','getContactsCsv','cf_%d','isEmpty','now','writeFileSync','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','Content-type','text/csv','download','sequelize','transaction','Sequelize','type','text','TEXT','number','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','addColumn','cm_contacts','format','getCustomFields','findAndCountAll','addAgents','spread','userCmList:save','emit','userCmList:remove','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../mysqldb','redis','localhost','./cmList.socket','register','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','get','Lists','UserProfileResource','destroy','then','end','error','stack','name','send','index','map','CmList','rawAttributes','fieldName','key','model','query','filters','intersection'];(function(_0xd7096e,_0x2bcebb){var _0x8ed2=function(_0x54968c){while(--_0x54968c){_0xd7096e['push'](_0xd7096e['shift']());}};_0x8ed2(++_0x2bcebb);}(_0x9c44,0x178));var _0x49c4=function(_0x13b02f,_0x462a53){_0x13b02f=_0x13b02f-0x0;var _0x12e9a6=_0x9c44[_0x13b02f];return _0x12e9a6;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x49c4('0x0'));var zipdir=require(_0x49c4('0x1'));var jsonpatch=require(_0x49c4('0x2'));var rp=require(_0x49c4('0x3'));var moment=require(_0x49c4('0x4'));var BPromise=require(_0x49c4('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x49c4('0x6'));var sox=require('sox');var csv=require(_0x49c4('0x7'));var ejs=require(_0x49c4('0x8'));var fs=require('fs');var _=require(_0x49c4('0x9'));var squel=require(_0x49c4('0xa'));var crypto=require(_0x49c4('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x49c4('0xc'));var toCsv=require(_0x49c4('0x7'));var querystring=require(_0x49c4('0xd'));var Papa=require(_0x49c4('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x49c4('0xf'));var as=require(_0x49c4('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x49c4('0x11'))(_0x49c4('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x49c4('0x13'))['db'];config[_0x49c4('0x14')]=_['defaults'](config[_0x49c4('0x14')],{'host':_0x49c4('0x15'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x49c4('0x14')]));require(_0x49c4('0x16'))[_0x49c4('0x17')](socket);function respondWithStatusCode(_0x2decee,_0x12777c){_0x12777c=_0x12777c||0xcc;return function(_0x18211c){if(_0x18211c){return _0x2decee[_0x49c4('0x18')](_0x12777c);}return _0x2decee[_0x49c4('0x19')](_0x12777c)['end']();};}function respondWithResult(_0x3acd06,_0x141003){_0x141003=_0x141003||0xc8;return function(_0x13a2db){if(_0x13a2db){return _0x3acd06[_0x49c4('0x19')](_0x141003)[_0x49c4('0x1a')](_0x13a2db);}};}function respondWithFilteredResult(_0x53e3a2,_0x44e607){return function(_0x2891f4){if(_0x2891f4){var _0x4c3253=_0x2891f4[_0x49c4('0x1b')],_0x512650=_0x44e607['offset'],_0x3c782d=_0x44e607[_0x49c4('0x1c')]+_0x44e607['limit'],_0x2f82d5;if(_0x3c782d>=_0x4c3253){_0x3c782d=_0x4c3253;_0x2f82d5=0xc8;}else{_0x2f82d5=0xce;}_0x53e3a2[_0x49c4('0x19')](_0x2f82d5);return _0x53e3a2[_0x49c4('0x1d')](_0x49c4('0x1e'),_0x512650+'-'+_0x3c782d+'/'+_0x4c3253)[_0x49c4('0x1a')](_0x2891f4);}return null;};}function patchUpdates(_0x382040){return function(_0x41078c){try{jsonpatch[_0x49c4('0x1f')](_0x41078c,_0x382040,!![]);}catch(_0x46e475){return BPromise[_0x49c4('0x20')](_0x46e475);}return _0x41078c['save']();};}function saveUpdates(_0x527126,_0x57f502){return function(_0x1c99b1){if(_0x1c99b1){return _0x1c99b1['update'](_0x527126)['then'](function(_0x2263ae){return _0x2263ae;});}return null;};}function removeEntity(_0x15581b,_0x26c640){return function(_0xd335e4){if(_0xd335e4){return _0xd335e4['destroy']()['then'](function(){var _0x180276=_0xd335e4[_0x49c4('0x21')]({'plain':!![]});var _0x565423=_0x49c4('0x22');return db[_0x49c4('0x23')][_0x49c4('0x24')]({'where':{'type':_0x565423,'resourceId':_0x180276['id']}})[_0x49c4('0x25')](function(){return _0xd335e4;});})['then'](function(){_0x15581b['status'](0xcc)[_0x49c4('0x26')]();});}};}function handleEntityNotFound(_0x53c199,_0x3800b7){return function(_0x3852b2){if(!_0x3852b2){_0x53c199[_0x49c4('0x18')](0x194);}return _0x3852b2;};}function handleError(_0x372a47,_0x5987ae){_0x5987ae=_0x5987ae||0x1f4;return function(_0x889909){logger[_0x49c4('0x27')](_0x889909[_0x49c4('0x28')]);if(_0x889909[_0x49c4('0x29')]){delete _0x889909[_0x49c4('0x29')];}_0x372a47[_0x49c4('0x19')](_0x5987ae)[_0x49c4('0x2a')](_0x889909);};}exports[_0x49c4('0x2b')]=function(_0x17b50f,_0x2cbd88){var _0x46f7ea={},_0x4ea6ea={},_0x4f4495={'count':0x0,'rows':[]};var _0x59eb84=_[_0x49c4('0x2c')](db[_0x49c4('0x2d')][_0x49c4('0x2e')],function(_0x27e467){return{'name':_0x27e467[_0x49c4('0x2f')],'type':_0x27e467['type'][_0x49c4('0x30')]};});_0x4ea6ea[_0x49c4('0x31')]=_[_0x49c4('0x2c')](_0x59eb84,_0x49c4('0x29'));_0x4ea6ea['query']=_['keys'](_0x17b50f[_0x49c4('0x32')]);_0x4ea6ea[_0x49c4('0x33')]=_[_0x49c4('0x34')](_0x4ea6ea[_0x49c4('0x31')],_0x4ea6ea[_0x49c4('0x32')]);_0x46f7ea['attributes']=_[_0x49c4('0x34')](_0x4ea6ea[_0x49c4('0x31')],qs[_0x49c4('0x35')](_0x17b50f['query']['fields']));_0x46f7ea[_0x49c4('0x36')]=_0x46f7ea[_0x49c4('0x36')][_0x49c4('0x37')]?_0x46f7ea[_0x49c4('0x36')]:_0x4ea6ea[_0x49c4('0x31')];if(!_0x17b50f[_0x49c4('0x32')][_0x49c4('0x38')](_0x49c4('0x39'))){_0x46f7ea[_0x49c4('0x3a')]=qs['limit'](_0x17b50f[_0x49c4('0x32')]['limit']);_0x46f7ea[_0x49c4('0x1c')]=qs[_0x49c4('0x1c')](_0x17b50f[_0x49c4('0x32')][_0x49c4('0x1c')]);}_0x46f7ea['order']=qs[_0x49c4('0x3b')](_0x17b50f[_0x49c4('0x32')][_0x49c4('0x3b')]);_0x46f7ea['where']=qs[_0x49c4('0x33')](_[_0x49c4('0x3c')](_0x17b50f[_0x49c4('0x32')],_0x4ea6ea[_0x49c4('0x33')]));if(_0x17b50f[_0x49c4('0x32')][_0x49c4('0x3d')]){_0x46f7ea[_0x49c4('0x3e')]=_[_0x49c4('0x3f')](_0x46f7ea[_0x49c4('0x3e')],{'$or':_[_0x49c4('0x2c')](_0x59eb84,function(_0x1e506a){if(_0x1e506a['type']!==_0x49c4('0x40')){var _0x20cd21={};_0x20cd21[_0x1e506a[_0x49c4('0x29')]]={'$like':'%'+_0x17b50f[_0x49c4('0x32')][_0x49c4('0x3d')]+'%'};return _0x20cd21;}})});}_0x46f7ea=_[_0x49c4('0x3f')]({},_0x46f7ea,_0x17b50f[_0x49c4('0x41')]);var _0xc9722b={'where':_0x46f7ea[_0x49c4('0x3e')]};return db[_0x49c4('0x2d')][_0x49c4('0x1b')](_0xc9722b)[_0x49c4('0x25')](function(_0x326142){_0x4f4495['count']=_0x326142;if(_0x17b50f[_0x49c4('0x32')]['includeAll']){_0x46f7ea[_0x49c4('0x42')]=[{'all':!![]}];}return db[_0x49c4('0x2d')][_0x49c4('0x43')](_0x46f7ea);})[_0x49c4('0x25')](function(_0x239327){_0x4f4495[_0x49c4('0x44')]=_0x239327;return _0x4f4495;})['then'](respondWithFilteredResult(_0x2cbd88,_0x46f7ea))['catch'](handleError(_0x2cbd88,null));};exports[_0x49c4('0x45')]=function(_0x1e7bdc,_0x38349b){var _0x117151={'raw':![],'where':{'id':_0x1e7bdc[_0x49c4('0x46')]['id']}},_0x490823={};_0x490823[_0x49c4('0x31')]=_[_0x49c4('0x47')](db[_0x49c4('0x2d')][_0x49c4('0x2e')]);_0x490823[_0x49c4('0x32')]=_[_0x49c4('0x47')](_0x1e7bdc[_0x49c4('0x32')]);_0x490823[_0x49c4('0x33')]=_['intersection'](_0x490823[_0x49c4('0x31')],_0x490823['query']);_0x117151[_0x49c4('0x36')]=_[_0x49c4('0x34')](_0x490823[_0x49c4('0x31')],qs[_0x49c4('0x35')](_0x1e7bdc[_0x49c4('0x32')]['fields']));_0x117151[_0x49c4('0x36')]=_0x117151[_0x49c4('0x36')][_0x49c4('0x37')]?_0x117151[_0x49c4('0x36')]:_0x490823[_0x49c4('0x31')];if(_0x1e7bdc[_0x49c4('0x32')][_0x49c4('0x48')]){_0x117151['include']=[{'all':!![]}];}_0x117151=_[_0x49c4('0x3f')]({},_0x117151,_0x1e7bdc['options']);return db[_0x49c4('0x2d')][_0x49c4('0x49')](_0x117151)[_0x49c4('0x25')](handleEntityNotFound(_0x38349b,null))[_0x49c4('0x25')](respondWithResult(_0x38349b,null))[_0x49c4('0x4a')](handleError(_0x38349b,null));};exports[_0x49c4('0x4b')]=function(_0x2c6be1,_0x506c71){return db[_0x49c4('0x2d')][_0x49c4('0x4b')](_0x2c6be1['body'],{})[_0x49c4('0x25')](function(_0xaece5f){var _0xfbe179=_0x2c6be1[_0x49c4('0x4c')]['get']({'plain':!![]});if(!_0xfbe179)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xfbe179[_0x49c4('0x4d')]==='user'){var _0x4597c3=_0xaece5f[_0x49c4('0x21')]({'plain':!![]});var _0x3811b2=_0x49c4('0x22');return db[_0x49c4('0x4e')][_0x49c4('0x49')]({'where':{'name':_0x3811b2,'userProfileId':_0xfbe179[_0x49c4('0x4f')]},'raw':!![]})['then'](function(_0x1f26c2){if(_0x1f26c2&&_0x1f26c2[_0x49c4('0x50')]===0x0){return db[_0x49c4('0x23')][_0x49c4('0x4b')]({'name':_0x4597c3[_0x49c4('0x29')],'resourceId':_0x4597c3['id'],'type':_0x1f26c2[_0x49c4('0x29')],'sectionId':_0x1f26c2['id']},{})[_0x49c4('0x25')](function(){return _0xaece5f;});}else{return _0xaece5f;}})[_0x49c4('0x4a')](function(_0x1e0b4f){logger[_0x49c4('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1e0b4f);throw _0x1e0b4f;});}return _0xaece5f;})['then'](respondWithResult(_0x506c71,0xc9))[_0x49c4('0x4a')](handleError(_0x506c71,null));};exports[_0x49c4('0x51')]=function(_0x527e74,_0x59a8bc){if(_0x527e74[_0x49c4('0x52')]['id']){delete _0x527e74['body']['id'];}return db['CmList'][_0x49c4('0x49')]({'where':{'id':_0x527e74[_0x49c4('0x46')]['id']}})[_0x49c4('0x25')](handleEntityNotFound(_0x59a8bc,null))[_0x49c4('0x25')](saveUpdates(_0x527e74[_0x49c4('0x52')],null))[_0x49c4('0x25')](respondWithResult(_0x59a8bc,null))[_0x49c4('0x4a')](handleError(_0x59a8bc,null));};exports['destroy']=function(_0x859dde,_0xcc6a2b){return db[_0x49c4('0x2d')][_0x49c4('0x49')]({'where':{'id':_0x859dde[_0x49c4('0x46')]['id']}})[_0x49c4('0x25')](handleEntityNotFound(_0xcc6a2b,null))['then'](removeEntity(_0xcc6a2b,null))['catch'](handleError(_0xcc6a2b,null));};exports[_0x49c4('0x53')]=function(_0x155c43,_0x2a6308){return db[_0x49c4('0x2d')][_0x49c4('0x53')]()[_0x49c4('0x25')](respondWithResult(_0x2a6308,null))[_0x49c4('0x4a')](handleError(_0x2a6308,null));};exports['addDisposition']=function(_0x45d715,_0x33c9a6,_0x4ba4eb){if(_0x45d715[_0x49c4('0x52')]['id']){delete _0x45d715['body']['id'];}return db[_0x49c4('0x2d')][_0x49c4('0x49')]({'where':{'id':_0x45d715[_0x49c4('0x46')]['id']}})[_0x49c4('0x25')](handleEntityNotFound(_0x33c9a6,null))[_0x49c4('0x25')](function(_0x3e44d7){if(_0x3e44d7){_0x45d715[_0x49c4('0x52')][_0x49c4('0x54')]=_0x3e44d7['id'];return db['Disposition'][_0x49c4('0x4b')](_0x45d715[_0x49c4('0x52')]);}})['then'](respondWithResult(_0x33c9a6,null))[_0x49c4('0x4a')](handleError(_0x33c9a6,null));};exports[_0x49c4('0x55')]=function(_0x4fefbd,_0x39c455,_0x42e0e6){var _0x4f50bf={'raw':![],'where':{}};var _0x4dc54d={};var _0x589484={'count':0x0,'rows':[]};return db['CmList'][_0x49c4('0x56')]({'where':{'id':_0x4fefbd['params']['id']}})[_0x49c4('0x25')](handleEntityNotFound(_0x39c455,null))[_0x49c4('0x25')](function(_0x515240){if(_0x515240){_0x4dc54d[_0x49c4('0x31')]=_[_0x49c4('0x47')](db['Disposition'][_0x49c4('0x2e')]);_0x4dc54d[_0x49c4('0x32')]=_[_0x49c4('0x47')](_0x4fefbd[_0x49c4('0x32')]);_0x4dc54d['filters']=_[_0x49c4('0x34')](_0x4dc54d[_0x49c4('0x31')],_0x4dc54d[_0x49c4('0x32')]);_0x4f50bf[_0x49c4('0x36')]=_['intersection'](_0x4dc54d[_0x49c4('0x31')],qs['fields'](_0x4fefbd['query']['fields']));_0x4f50bf['attributes']=_0x4f50bf[_0x49c4('0x36')][_0x49c4('0x37')]?_0x4f50bf[_0x49c4('0x36')]:_0x4dc54d[_0x49c4('0x31')];if(!_0x4fefbd['query']['hasOwnProperty'](_0x49c4('0x39'))){_0x4f50bf[_0x49c4('0x3a')]=qs[_0x49c4('0x3a')](_0x4fefbd[_0x49c4('0x32')][_0x49c4('0x3a')]);_0x4f50bf[_0x49c4('0x1c')]=qs[_0x49c4('0x1c')](_0x4fefbd[_0x49c4('0x32')]['offset']);}_0x4f50bf[_0x49c4('0x57')]=qs['sort'](_0x4fefbd[_0x49c4('0x32')][_0x49c4('0x3b')]);_0x4f50bf[_0x49c4('0x3e')]=qs[_0x49c4('0x33')](_[_0x49c4('0x3c')](_0x4fefbd[_0x49c4('0x32')],_0x4dc54d[_0x49c4('0x33')]));_0x4f50bf[_0x49c4('0x3e')][_0x49c4('0x54')]=_0x515240['id'];if(_0x4fefbd[_0x49c4('0x32')][_0x49c4('0x3d')]){_0x4f50bf[_0x49c4('0x3e')]=_[_0x49c4('0x3f')](_0x4f50bf[_0x49c4('0x3e')],{'$or':_[_0x49c4('0x2c')](_0x4f50bf[_0x49c4('0x36')],function(_0x371e49){var _0x3485c0={};_0x3485c0[_0x371e49]={'$like':'%'+_0x4fefbd['query']['filter']+'%'};return _0x3485c0;})});}_0x4f50bf=_[_0x49c4('0x3f')]({},_0x4f50bf,_0x4fefbd[_0x49c4('0x41')]);return db['Disposition'][_0x49c4('0x1b')]({'where':_0x4f50bf[_0x49c4('0x3e')]})[_0x49c4('0x25')](function(_0x16e7b1){_0x589484['count']=_0x16e7b1;if(_0x4fefbd['query']['includeAll']){_0x4f50bf[_0x49c4('0x42')]=[{'all':!![]}];}return db[_0x49c4('0x58')][_0x49c4('0x43')](_0x4f50bf);})[_0x49c4('0x25')](function(_0x118fc4){_0x589484[_0x49c4('0x44')]=_0x118fc4;return _0x589484;});}})[_0x49c4('0x25')](respondWithFilteredResult(_0x39c455,_0x4f50bf))[_0x49c4('0x4a')](handleError(_0x39c455,null));};exports[_0x49c4('0x59')]=function(_0x54dea5,_0x363b2e,_0x10fb84){return db[_0x49c4('0x2d')]['find']({'where':{'id':_0x54dea5[_0x49c4('0x46')]['id']}})[_0x49c4('0x25')](handleEntityNotFound(_0x363b2e,null))[_0x49c4('0x25')](function(_0xb6031b){if(_0xb6031b){return _0xb6031b[_0x49c4('0x59')](_0x54dea5[_0x49c4('0x32')][_0x49c4('0x5a')]);}})[_0x49c4('0x25')](respondWithStatusCode(_0x363b2e,null))['catch'](handleError(_0x363b2e,null));};exports[_0x49c4('0x5b')]=function(_0x20e2d5,_0x85540f,_0x18e82b){return db[_0x49c4('0x2d')]['find']({'where':{'id':_0x20e2d5['params']['id']}})[_0x49c4('0x25')](handleEntityNotFound(_0x85540f,null))['then'](function(_0x34cf49){if(_0x34cf49){var _0x558880=[];var _0x23516e={'success':[],'errors':[]};return db[_0x49c4('0x5c')][_0x49c4('0x53')]()[_0x49c4('0x25')](function(_0x4eb9f7){if(_0x20e2d5[_0x49c4('0x52')][_0x49c4('0x5d')]&&_[_0x49c4('0x5e')](_0x20e2d5[_0x49c4('0x52')][_0x49c4('0x5d')])){if(_0x20e2d5[_0x49c4('0x52')][_0x49c4('0x5d')][_0x49c4('0x37')]){_0x20e2d5[_0x49c4('0x52')][_0x49c4('0x5d')]=_0x20e2d5['body'][_0x49c4('0x5d')][_0x49c4('0x5f')](';')+';';}else{_0x20e2d5['body'][_0x49c4('0x5d')]=null;}}else{_0x20e2d5['body'][_0x49c4('0x5d')]=null;}if(_0x20e2d5[_0x49c4('0x52')]&&_[_0x49c4('0x5e')](_0x20e2d5[_0x49c4('0x52')])){for(var _0x2c32c0=0x0;_0x2c32c0<_0x20e2d5['body'][_0x49c4('0x37')];_0x2c32c0+=0x1){_0x20e2d5[_0x49c4('0x52')][_0x2c32c0]['ListId']=_0x20e2d5[_0x49c4('0x46')]['id'];_0x558880[_0x49c4('0x60')](_0x20e2d5['body'][_0x2c32c0]);}return BPromise[_0x49c4('0x61')](_0x558880,function(_0x2cb416){return db['CmContact'][_0x49c4('0x4b')](_[_0x49c4('0x62')](_0x2cb416,[_0x49c4('0x5a'),'id'])||{},{'fields':_[_0x49c4('0x47')](_0x4eb9f7),'raw':!![]})['then'](function(_0x999ae2){_0x23516e[_0x49c4('0x63')]['push'](_0x999ae2[_0x49c4('0x64')]);})['catch'](function(_0x4a4cb7){_0x23516e[_0x49c4('0x65')]['push']({'data':_0x2cb416,'error':_0x4a4cb7['message']});});})[_0x49c4('0x25')](function(_0x131064){return _0x23516e;})['catch'](function(_0x23e684){return _0x23e684;});}else{_0x85540f['status'](0x190)['json']({'message':'Malformed\x20request\x20syntax'});}});}})[_0x49c4('0x25')](respondWithResult(_0x85540f,null))[_0x49c4('0x4a')](handleError(_0x85540f,null));};exports[_0x49c4('0x66')]=function(_0x2bfe15,_0x4a5f0b,_0x5b751a){var _0x348693;return db['CmList'][_0x49c4('0x49')]({'where':{'id':_0x2bfe15['params']['id']},'include':[{'model':db[_0x49c4('0x67')],'as':_0x49c4('0x68')}]})[_0x49c4('0x25')](handleEntityNotFound(_0x4a5f0b,null))[_0x49c4('0x25')](function(_0x12d060){if(_0x12d060){_0x348693=_0x12d060;return db[_0x49c4('0x5c')][_0x49c4('0x2e')];}})['then'](function(_0xbde4b2){if(_0xbde4b2){var _0x1518cb={};var _0x44a188={};_0x44a188[_0x49c4('0x31')]=_[_0x49c4('0x69')](_['keys'](_0xbde4b2),_[_0x49c4('0x2c')](_0x348693[_0x49c4('0x68')],function(_0x3f5a6e){return util['format']('cf_%d',_0x3f5a6e['id']);}));_0x44a188[_0x49c4('0x32')]=_[_0x49c4('0x47')](_0x2bfe15[_0x49c4('0x32')]);_0x44a188[_0x49c4('0x33')]=_[_0x49c4('0x34')](_0x44a188['model'],_0x44a188[_0x49c4('0x32')]);_0x1518cb[_0x49c4('0x36')]=_[_0x49c4('0x34')](_0x44a188[_0x49c4('0x31')],qs['fields'](_0x2bfe15['query'][_0x49c4('0x35')]));_0x1518cb[_0x49c4('0x36')]=_0x1518cb[_0x49c4('0x36')][_0x49c4('0x37')]?_0x1518cb[_0x49c4('0x36')]:_0x44a188['model'];if(!_0x2bfe15[_0x49c4('0x32')][_0x49c4('0x38')](_0x49c4('0x39'))){_0x1518cb[_0x49c4('0x3a')]=qs[_0x49c4('0x3a')](_0x2bfe15[_0x49c4('0x32')]['limit']);_0x1518cb[_0x49c4('0x1c')]=qs[_0x49c4('0x1c')](_0x2bfe15[_0x49c4('0x32')][_0x49c4('0x1c')]);}_0x1518cb['order']=qs['sort'](_0x2bfe15[_0x49c4('0x32')]['sort']);_0x1518cb[_0x49c4('0x3e')]=qs['filters'](_[_0x49c4('0x3c')](_0x2bfe15[_0x49c4('0x32')],_0x44a188[_0x49c4('0x33')]));_0x1518cb[_0x49c4('0x6a')]=!![];if(_0x2bfe15['query']['filter']){_0x1518cb[_0x49c4('0x3e')]=_[_0x49c4('0x3f')](_0x1518cb[_0x49c4('0x3e')],{'$or':_['map'](_0x1518cb['attributes'],function(_0x3e7ab3){var _0x4ce733={};_0x4ce733[_0x3e7ab3]={'$like':'%'+_0x2bfe15['query'][_0x49c4('0x3d')]+'%'};return _0x4ce733;})});}_0x1518cb=_['merge']({},_0x1518cb,_0x2bfe15[_0x49c4('0x41')]);return _0x348693[_0x49c4('0x66')](_0x1518cb);}})['then'](respondWithResult(_0x4a5f0b,null))[_0x49c4('0x4a')](handleError(_0x4a5f0b,null));};exports[_0x49c4('0x6b')]=function(_0x49f060,_0x5428a9,_0xdb9820){var _0x493b9a;return db[_0x49c4('0x2d')][_0x49c4('0x49')]({'where':{'id':_0x49f060[_0x49c4('0x46')]['id']},'include':[{'model':db[_0x49c4('0x67')],'as':_0x49c4('0x68')}]})[_0x49c4('0x25')](handleEntityNotFound(_0x5428a9,null))[_0x49c4('0x25')](function(_0x5f07fa){if(_0x5f07fa){_0x493b9a=_0x5f07fa;return db[_0x49c4('0x5c')][_0x49c4('0x2e')];}})[_0x49c4('0x25')](function(_0xcc42bf){if(_0xcc42bf){var _0x3107c9={};var _0x5795e8={};_0x5795e8[_0x49c4('0x31')]=_['concat'](_[_0x49c4('0x47')](_0xcc42bf),_[_0x49c4('0x2c')](_0x493b9a[_0x49c4('0x68')],function(_0x3d662c){return util['format'](_0x49c4('0x6c'),_0x3d662c['id']);}));_0x5795e8[_0x49c4('0x32')]=_[_0x49c4('0x47')](_0x49f060[_0x49c4('0x32')]);_0x5795e8[_0x49c4('0x33')]=_[_0x49c4('0x34')](_0x5795e8['model'],_0x5795e8[_0x49c4('0x32')]);_0x3107c9['attributes']=_[_0x49c4('0x34')](_0x5795e8[_0x49c4('0x31')],qs[_0x49c4('0x35')](_0x49f060[_0x49c4('0x32')]['fields']));_0x3107c9[_0x49c4('0x36')]=_0x3107c9[_0x49c4('0x36')]['length']?_0x3107c9[_0x49c4('0x36')]:_0x5795e8[_0x49c4('0x31')];if(!_0x49f060['query']['hasOwnProperty'](_0x49c4('0x39'))){_0x3107c9[_0x49c4('0x3a')]=qs[_0x49c4('0x3a')](_0x49f060[_0x49c4('0x32')][_0x49c4('0x3a')]);_0x3107c9[_0x49c4('0x1c')]=qs[_0x49c4('0x1c')](_0x49f060[_0x49c4('0x32')][_0x49c4('0x1c')]);}_0x3107c9[_0x49c4('0x57')]=qs[_0x49c4('0x3b')](_0x49f060['query']['sort']);_0x3107c9[_0x49c4('0x3e')]=qs[_0x49c4('0x33')](_[_0x49c4('0x3c')](_0x49f060['query'],_0x5795e8[_0x49c4('0x33')]));_0x3107c9[_0x49c4('0x6a')]=!![];if(_0x49f060['query'][_0x49c4('0x3d')]){_0x3107c9['where']=_[_0x49c4('0x3f')](_0x3107c9[_0x49c4('0x3e')],{'$or':_[_0x49c4('0x2c')](_0x3107c9[_0x49c4('0x36')],function(_0x572433){var _0x2456a0={};_0x2456a0[_0x572433]={'$like':'%'+_0x49f060[_0x49c4('0x32')][_0x49c4('0x3d')]+'%'};return _0x2456a0;})});}_0x3107c9=_[_0x49c4('0x3f')]({},_0x3107c9,_0x49f060[_0x49c4('0x41')]);return _0x493b9a['getContacts'](_0x3107c9);}})['then'](function(_0x5f4d82){if(!_[_0x49c4('0x6d')](_0x5f4d82)){var _0x10655c=toCsv(_0x5f4d82);var _0x228bbb=Date[_0x49c4('0x6e')]();fs[_0x49c4('0x6f')](util['format'](_0x49c4('0x70'),_0x493b9a['id'],_0x228bbb),_0x10655c);_0x5428a9[_0x49c4('0x71')](_0x49c4('0x72'),_0x49c4('0x73')+util['format'](_0x49c4('0x74'),_0x493b9a['id'],_0x228bbb));_0x5428a9[_0x49c4('0x71')](_0x49c4('0x75'),_0x49c4('0x76'));return _0x5428a9[_0x49c4('0x77')](util['format'](_0x49c4('0x70'),_0x493b9a['id'],_0x228bbb));}else{return _0x5428a9[_0x49c4('0x18')](0xcc);}})[_0x49c4('0x4a')](handleError(_0x5428a9,null));};exports['addCustomField']=function(_0x182d2f,_0x11f47f,_0xa1954a){var _0x56341f;delete _0x182d2f[_0x49c4('0x52')]['id'];return db['CmList']['findOne']({'where':{'id':_0x182d2f[_0x49c4('0x46')]['id']}})[_0x49c4('0x25')](handleEntityNotFound(_0x11f47f,null))['then'](function(_0x815b34){if(_0x815b34){return db[_0x49c4('0x78')][_0x49c4('0x79')](function(_0x1ffc9a){return db[_0x49c4('0x67')][_0x49c4('0x4b')](_0x182d2f[_0x49c4('0x52')],{'transaction':_0x1ffc9a})[_0x49c4('0x25')](function(_0x59dbef){_0x56341f=_0x59dbef;return _0x815b34['addCustomFields'](_0x59dbef,{'transaction':_0x1ffc9a});})[_0x49c4('0x25')](function(){var _0x4c85ab={'type':db[_0x49c4('0x7a')]['TEXT'],'transaction':_0x1ffc9a};switch(_0x182d2f['body'][_0x49c4('0x7b')]){case _0x49c4('0x7c'):_0x4c85ab[_0x49c4('0x7b')]=db[_0x49c4('0x7a')][_0x49c4('0x7d')];break;case _0x49c4('0x7e'):_0x4c85ab[_0x49c4('0x7b')]=db[_0x49c4('0x7a')][_0x49c4('0x7f')];break;case _0x49c4('0x80'):_0x4c85ab[_0x49c4('0x7b')]=db[_0x49c4('0x7a')][_0x49c4('0x81')];_0x4c85ab[_0x49c4('0x82')]=![];break;default:}return db['sequelize'][_0x49c4('0x83')][_0x49c4('0x84')](_0x49c4('0x85'),util[_0x49c4('0x86')]('cf_%s',_0x56341f['id']),_0x4c85ab);})['then'](function(){return _0x56341f;});});}})[_0x49c4('0x25')](respondWithResult(_0x11f47f,null))['catch'](handleError(_0x11f47f,null));};exports[_0x49c4('0x87')]=function(_0x1ac087,_0xd6dc2a,_0xfc5a8f){var _0x2bcc8c={};var _0x45a2ef={};var _0x3238e7;var _0xe9e187;return db[_0x49c4('0x2d')][_0x49c4('0x56')]({'where':{'id':_0x1ac087[_0x49c4('0x46')]['id']}})[_0x49c4('0x25')](handleEntityNotFound(_0xd6dc2a,null))['then'](function(_0x22fdb9){if(_0x22fdb9){_0x3238e7=_0x22fdb9;_0x45a2ef[_0x49c4('0x31')]=_[_0x49c4('0x47')](db['CmCustomField'][_0x49c4('0x2e')]);_0x45a2ef['query']=_[_0x49c4('0x47')](_0x1ac087[_0x49c4('0x32')]);_0x45a2ef[_0x49c4('0x33')]=_[_0x49c4('0x34')](_0x45a2ef['model'],_0x45a2ef[_0x49c4('0x32')]);_0x2bcc8c['attributes']=_['intersection'](_0x45a2ef[_0x49c4('0x31')],qs[_0x49c4('0x35')](_0x1ac087[_0x49c4('0x32')]['fields']));_0x2bcc8c['attributes']=_0x2bcc8c[_0x49c4('0x36')][_0x49c4('0x37')]?_0x2bcc8c[_0x49c4('0x36')]:_0x45a2ef[_0x49c4('0x31')];_0x2bcc8c[_0x49c4('0x57')]=qs[_0x49c4('0x3b')](_0x1ac087[_0x49c4('0x32')][_0x49c4('0x3b')]);_0x2bcc8c[_0x49c4('0x3e')]=qs['filters'](_[_0x49c4('0x3c')](_0x1ac087[_0x49c4('0x32')],_0x45a2ef['filters']));_0x2bcc8c['where']=_[_0x49c4('0x3f')](_0x2bcc8c['where'],{'$or':[{'ListId':_0x22fdb9['id']},{'ListId':null}]});if(_0x1ac087[_0x49c4('0x32')]['filter']){_0x2bcc8c[_0x49c4('0x3e')]=_['merge'](_0x2bcc8c[_0x49c4('0x3e')],{'$or':_[_0x49c4('0x2c')](_0x2bcc8c[_0x49c4('0x36')],function(_0x1ab574){var _0x5b1e3d={};_0x5b1e3d[_0x1ab574]={'$like':'%'+_0x1ac087['query'][_0x49c4('0x3d')]+'%'};return _0x5b1e3d;})});}_0x2bcc8c=_[_0x49c4('0x3f')]({},_0x2bcc8c,_0x1ac087[_0x49c4('0x41')]);return db['CmCustomField'][_0x49c4('0x88')](_0x2bcc8c);}})[_0x49c4('0x25')](respondWithResult(_0xd6dc2a,null))['catch'](handleError(_0xd6dc2a,null));};exports['addAgents']=function(_0x43ca05,_0x269170,_0xa0698d){return db['CmList'][_0x49c4('0x49')]({'where':{'id':_0x43ca05[_0x49c4('0x46')]['id']}})[_0x49c4('0x25')](handleEntityNotFound(_0x269170,null))[_0x49c4('0x25')](function(_0x5a0045){if(_0x5a0045){return _0x5a0045[_0x49c4('0x89')](_0x43ca05['body']['ids'],_[_0x49c4('0x62')](_0x43ca05[_0x49c4('0x52')],[_0x49c4('0x5a'),'id'])||{})[_0x49c4('0x8a')](function(_0x5adb90){for(var _0x32b6e4=0x0;_0x32b6e4<_0x43ca05[_0x49c4('0x52')][_0x49c4('0x5a')][_0x49c4('0x37')];_0x32b6e4+=0x1){socket['emit'](_0x49c4('0x8b'),{'UserId':_0x43ca05['body']['ids'][_0x32b6e4],'CmListId':_0x43ca05[_0x49c4('0x46')]['id']});}return _0x5adb90;});}})[_0x49c4('0x25')](respondWithResult(_0x269170,null))[_0x49c4('0x4a')](handleError(_0x269170,null));};exports['removeAgents']=function(_0x336853,_0x4a874a,_0x30b616){return db[_0x49c4('0x2d')][_0x49c4('0x49')]({'where':{'id':_0x336853[_0x49c4('0x46')]['id']}})[_0x49c4('0x25')](handleEntityNotFound(_0x4a874a,null))[_0x49c4('0x25')](function(_0x2b31ac){if(_0x2b31ac){return _0x2b31ac['removeAgents'](_0x336853[_0x49c4('0x32')][_0x49c4('0x5a')])[_0x49c4('0x25')](function(){if(_[_0x49c4('0x5e')](_0x336853['query']['ids'])){for(var _0x4c15ff=0x0;_0x4c15ff<_0x336853[_0x49c4('0x32')][_0x49c4('0x5a')][_0x49c4('0x37')];_0x4c15ff+=0x1){socket[_0x49c4('0x8c')](_0x49c4('0x8d'),{'UserId':Number(_0x336853[_0x49c4('0x32')][_0x49c4('0x5a')][_0x4c15ff]),'CmListId':Number(_0x336853['params']['id'])});}}else{socket[_0x49c4('0x8c')](_0x49c4('0x8d'),{'UserId':Number(_0x336853['query']['ids']),'CmListId':Number(_0x336853['params']['id'])});}});}})[_0x49c4('0x25')](respondWithStatusCode(_0x4a874a,null))[_0x49c4('0x4a')](handleError(_0x4a874a,null));};exports[_0x49c4('0x8e')]=function(_0x3d0013,_0x1069b9,_0x1480d3){var _0x2f36c6={};var _0x5039fc={};var _0x83440b;var _0x3226c4;return db[_0x49c4('0x2d')][_0x49c4('0x56')]({'where':{'id':_0x3d0013['params']['id']}})[_0x49c4('0x25')](handleEntityNotFound(_0x1069b9,null))[_0x49c4('0x25')](function(_0x227c94){if(_0x227c94){_0x83440b=_0x227c94;_0x5039fc[_0x49c4('0x31')]=_[_0x49c4('0x47')](db['User'][_0x49c4('0x2e')]);_0x5039fc['query']=_['keys'](_0x3d0013[_0x49c4('0x32')]);_0x5039fc[_0x49c4('0x33')]=_[_0x49c4('0x34')](_0x5039fc[_0x49c4('0x31')],_0x5039fc[_0x49c4('0x32')]);_0x2f36c6['attributes']=_[_0x49c4('0x34')](_0x5039fc[_0x49c4('0x31')],qs[_0x49c4('0x35')](_0x3d0013['query'][_0x49c4('0x35')]));_0x2f36c6[_0x49c4('0x36')]=_0x2f36c6['attributes'][_0x49c4('0x37')]?_0x2f36c6[_0x49c4('0x36')]:_0x5039fc[_0x49c4('0x31')];_0x2f36c6[_0x49c4('0x57')]=qs[_0x49c4('0x3b')](_0x3d0013[_0x49c4('0x32')][_0x49c4('0x3b')]);_0x2f36c6['where']=qs[_0x49c4('0x33')](_[_0x49c4('0x3c')](_0x3d0013[_0x49c4('0x32')],_0x5039fc[_0x49c4('0x33')]));if(_0x3d0013[_0x49c4('0x32')]['filter']){_0x2f36c6[_0x49c4('0x3e')]=_[_0x49c4('0x3f')](_0x2f36c6[_0x49c4('0x3e')],{'$or':_[_0x49c4('0x2c')](_0x2f36c6[_0x49c4('0x36')],function(_0x50423b){var _0x2582e3={};_0x2582e3[_0x50423b]={'$like':'%'+_0x3d0013[_0x49c4('0x32')][_0x49c4('0x3d')]+'%'};return _0x2582e3;})});}_0x2f36c6=_[_0x49c4('0x3f')]({},_0x2f36c6,_0x3d0013[_0x49c4('0x41')]);return _0x83440b[_0x49c4('0x8e')](_0x2f36c6);}})[_0x49c4('0x25')](function(_0x2a25dc){if(_0x2a25dc){_0x3226c4=_0x2a25dc[_0x49c4('0x37')];if(!_0x3d0013[_0x49c4('0x32')]['hasOwnProperty'](_0x49c4('0x39'))){_0x2f36c6[_0x49c4('0x3a')]=qs[_0x49c4('0x3a')](_0x3d0013[_0x49c4('0x32')][_0x49c4('0x3a')]);_0x2f36c6['offset']=qs['offset'](_0x3d0013[_0x49c4('0x32')][_0x49c4('0x1c')]);}return _0x83440b[_0x49c4('0x8e')](_0x2f36c6);}})[_0x49c4('0x25')](function(_0xd87f7e){if(_0xd87f7e){return _0xd87f7e?{'count':_0x3226c4,'rows':_0xd87f7e}:null;}})[_0x49c4('0x25')](respondWithResult(_0x1069b9,null))['catch'](handleError(_0x1069b9,null));}; \ No newline at end of file +var _0xe706=['cf_%s','getCustomFields','findAndCountAll','addAgents','omit','spread','userCmList:save','removeAgents','emit','userCmList:remove','getAgents','User','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','Lists','destroy','sendStatus','error','stack','name','send','index','CmList','rawAttributes','type','key','map','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','count','include','findAll','show','params','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','ListId','Disposition','getDispositions','findOne','order','includeAll','rows','removeDispositions','ids','addContacts','tags','isArray','each','CmContact','push','dataValues','errors','message','Malformed\x20request\x20syntax','getContacts','CmCustomField','concat','CustomFields','format','raw','getContactsCsv','cf_%d','isEmpty','now','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','addCustomField','sequelize','transaction','Sequelize','TEXT','number','INTEGER','BOOLEAN','defaultValue','queryInterface','addColumn','cm_contacts'];(function(_0xe22ceb,_0x27dc83){var _0x45bb58=function(_0x4e1177){while(--_0x4e1177){_0xe22ceb['push'](_0xe22ceb['shift']());}};_0x45bb58(++_0x27dc83);}(_0xe706,0xa3));var _0x6e70=function(_0x5991d7,_0x3ca7f8){_0x5991d7=_0x5991d7-0x0;var _0x5b299d=_0xe706[_0x5991d7];return _0x5b299d;};'use strict';var pdf=require(_0x6e70('0x0'));var emlformat=require(_0x6e70('0x1'));var rimraf=require(_0x6e70('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6e70('0x3'));var rp=require(_0x6e70('0x4'));var moment=require(_0x6e70('0x5'));var BPromise=require(_0x6e70('0x6'));var Mustache=require(_0x6e70('0x7'));var util=require(_0x6e70('0x8'));var path=require(_0x6e70('0x9'));var sox=require(_0x6e70('0xa'));var csv=require(_0x6e70('0xb'));var ejs=require(_0x6e70('0xc'));var fs=require('fs');var _=require(_0x6e70('0xd'));var squel=require(_0x6e70('0xe'));var crypto=require(_0x6e70('0xf'));var jsforce=require(_0x6e70('0x10'));var deskjs=require(_0x6e70('0x11'));var toCsv=require(_0x6e70('0xb'));var querystring=require(_0x6e70('0x12'));var Papa=require(_0x6e70('0x13'));var Redis=require(_0x6e70('0x14'));var authService=require(_0x6e70('0x15'));var qs=require(_0x6e70('0x16'));var as=require(_0x6e70('0x17'));var hardwareService=require(_0x6e70('0x18'));var logger=require(_0x6e70('0x19'))('api');var utils=require('../../config/utils');var config=require(_0x6e70('0x1a'));var db=require(_0x6e70('0x1b'))['db'];config[_0x6e70('0x1c')]=_[_0x6e70('0x1d')](config[_0x6e70('0x1c')],{'host':_0x6e70('0x1e'),'port':0x18eb});var socket=require(_0x6e70('0x1f'))(new Redis(config[_0x6e70('0x1c')]));require('./cmList.socket')['register'](socket);function respondWithStatusCode(_0x48bc72,_0x257e81){_0x257e81=_0x257e81||0xcc;return function(_0x5a37a6){if(_0x5a37a6){return _0x48bc72['sendStatus'](_0x257e81);}return _0x48bc72[_0x6e70('0x20')](_0x257e81)[_0x6e70('0x21')]();};}function respondWithResult(_0x5d9263,_0x24f3ac){_0x24f3ac=_0x24f3ac||0xc8;return function(_0x5c3fe7){if(_0x5c3fe7){return _0x5d9263[_0x6e70('0x20')](_0x24f3ac)[_0x6e70('0x22')](_0x5c3fe7);}};}function respondWithFilteredResult(_0x4ca554,_0x49029f){return function(_0x3bd572){if(_0x3bd572){var _0x5ea7a5=_0x3bd572['count'],_0x28a21f=_0x49029f[_0x6e70('0x23')],_0x173afe=_0x49029f[_0x6e70('0x23')]+_0x49029f[_0x6e70('0x24')],_0x53acdc;if(_0x173afe>=_0x5ea7a5){_0x173afe=_0x5ea7a5;_0x53acdc=0xc8;}else{_0x53acdc=0xce;}_0x4ca554[_0x6e70('0x20')](_0x53acdc);return _0x4ca554[_0x6e70('0x25')](_0x6e70('0x26'),_0x28a21f+'-'+_0x173afe+'/'+_0x5ea7a5)[_0x6e70('0x22')](_0x3bd572);}return null;};}function patchUpdates(_0x44a49f){return function(_0x29326f){try{jsonpatch[_0x6e70('0x27')](_0x29326f,_0x44a49f,!![]);}catch(_0x4a0cfe){return BPromise[_0x6e70('0x28')](_0x4a0cfe);}return _0x29326f[_0x6e70('0x29')]();};}function saveUpdates(_0x27b294,_0x502b2d){return function(_0x3ccd87){if(_0x3ccd87){return _0x3ccd87[_0x6e70('0x2a')](_0x27b294)[_0x6e70('0x2b')](function(_0x50da2c){return _0x50da2c;});}return null;};}function removeEntity(_0x10fc91,_0x538b9c){return function(_0x50aec2){if(_0x50aec2){return _0x50aec2['destroy']()[_0x6e70('0x2b')](function(){var _0x19c5ae=_0x50aec2['get']({'plain':!![]});var _0x3ecdf1=_0x6e70('0x2c');return db['UserProfileResource'][_0x6e70('0x2d')]({'where':{'type':_0x3ecdf1,'resourceId':_0x19c5ae['id']}})[_0x6e70('0x2b')](function(){return _0x50aec2;});})[_0x6e70('0x2b')](function(){_0x10fc91['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2c4d37,_0x3af17f){return function(_0x83c836){if(!_0x83c836){_0x2c4d37[_0x6e70('0x2e')](0x194);}return _0x83c836;};}function handleError(_0x43fee0,_0x5d772a){_0x5d772a=_0x5d772a||0x1f4;return function(_0x1952ea){logger[_0x6e70('0x2f')](_0x1952ea[_0x6e70('0x30')]);if(_0x1952ea[_0x6e70('0x31')]){delete _0x1952ea[_0x6e70('0x31')];}_0x43fee0[_0x6e70('0x20')](_0x5d772a)[_0x6e70('0x32')](_0x1952ea);};}exports[_0x6e70('0x33')]=function(_0x3a0821,_0x3a5d30){var _0x4b1229={},_0x1b27d8={},_0x50d60b={'count':0x0,'rows':[]};var _0x259486=_['map'](db[_0x6e70('0x34')][_0x6e70('0x35')],function(_0x30fa0b){return{'name':_0x30fa0b['fieldName'],'type':_0x30fa0b[_0x6e70('0x36')][_0x6e70('0x37')]};});_0x1b27d8['model']=_[_0x6e70('0x38')](_0x259486,_0x6e70('0x31'));_0x1b27d8['query']=_[_0x6e70('0x39')](_0x3a0821[_0x6e70('0x3a')]);_0x1b27d8[_0x6e70('0x3b')]=_[_0x6e70('0x3c')](_0x1b27d8[_0x6e70('0x3d')],_0x1b27d8[_0x6e70('0x3a')]);_0x4b1229[_0x6e70('0x3e')]=_[_0x6e70('0x3c')](_0x1b27d8[_0x6e70('0x3d')],qs[_0x6e70('0x3f')](_0x3a0821['query'][_0x6e70('0x3f')]));_0x4b1229['attributes']=_0x4b1229[_0x6e70('0x3e')][_0x6e70('0x40')]?_0x4b1229[_0x6e70('0x3e')]:_0x1b27d8[_0x6e70('0x3d')];if(!_0x3a0821[_0x6e70('0x3a')][_0x6e70('0x41')](_0x6e70('0x42'))){_0x4b1229[_0x6e70('0x24')]=qs[_0x6e70('0x24')](_0x3a0821[_0x6e70('0x3a')][_0x6e70('0x24')]);_0x4b1229[_0x6e70('0x23')]=qs[_0x6e70('0x23')](_0x3a0821['query']['offset']);}_0x4b1229['order']=qs[_0x6e70('0x43')](_0x3a0821[_0x6e70('0x3a')][_0x6e70('0x43')]);_0x4b1229[_0x6e70('0x44')]=qs[_0x6e70('0x3b')](_[_0x6e70('0x45')](_0x3a0821['query'],_0x1b27d8[_0x6e70('0x3b')]));if(_0x3a0821[_0x6e70('0x3a')][_0x6e70('0x46')]){_0x4b1229[_0x6e70('0x44')]=_[_0x6e70('0x47')](_0x4b1229[_0x6e70('0x44')],{'$or':_[_0x6e70('0x38')](_0x259486,function(_0x16fc7d){if(_0x16fc7d['type']!==_0x6e70('0x48')){var _0x23e893={};_0x23e893[_0x16fc7d[_0x6e70('0x31')]]={'$like':'%'+_0x3a0821[_0x6e70('0x3a')][_0x6e70('0x46')]+'%'};return _0x23e893;}})});}_0x4b1229=_[_0x6e70('0x47')]({},_0x4b1229,_0x3a0821[_0x6e70('0x49')]);var _0x4a8adc={'where':_0x4b1229['where']};return db['CmList'][_0x6e70('0x4a')](_0x4a8adc)[_0x6e70('0x2b')](function(_0x83847b){_0x50d60b[_0x6e70('0x4a')]=_0x83847b;if(_0x3a0821[_0x6e70('0x3a')]['includeAll']){_0x4b1229[_0x6e70('0x4b')]=[{'all':!![]}];}return db[_0x6e70('0x34')][_0x6e70('0x4c')](_0x4b1229);})['then'](function(_0x544ad0){_0x50d60b['rows']=_0x544ad0;return _0x50d60b;})[_0x6e70('0x2b')](respondWithFilteredResult(_0x3a5d30,_0x4b1229))['catch'](handleError(_0x3a5d30,null));};exports[_0x6e70('0x4d')]=function(_0x39913a,_0x3fed21){var _0x75a90d={'raw':![],'where':{'id':_0x39913a[_0x6e70('0x4e')]['id']}},_0x59c87d={};_0x59c87d['model']=_[_0x6e70('0x39')](db[_0x6e70('0x34')][_0x6e70('0x35')]);_0x59c87d[_0x6e70('0x3a')]=_['keys'](_0x39913a[_0x6e70('0x3a')]);_0x59c87d[_0x6e70('0x3b')]=_[_0x6e70('0x3c')](_0x59c87d[_0x6e70('0x3d')],_0x59c87d[_0x6e70('0x3a')]);_0x75a90d[_0x6e70('0x3e')]=_[_0x6e70('0x3c')](_0x59c87d['model'],qs[_0x6e70('0x3f')](_0x39913a[_0x6e70('0x3a')][_0x6e70('0x3f')]));_0x75a90d[_0x6e70('0x3e')]=_0x75a90d[_0x6e70('0x3e')][_0x6e70('0x40')]?_0x75a90d[_0x6e70('0x3e')]:_0x59c87d['model'];if(_0x39913a[_0x6e70('0x3a')]['includeAll']){_0x75a90d[_0x6e70('0x4b')]=[{'all':!![]}];}_0x75a90d=_[_0x6e70('0x47')]({},_0x75a90d,_0x39913a['options']);return db['CmList'][_0x6e70('0x4f')](_0x75a90d)[_0x6e70('0x2b')](handleEntityNotFound(_0x3fed21,null))[_0x6e70('0x2b')](respondWithResult(_0x3fed21,null))['catch'](handleError(_0x3fed21,null));};exports['create']=function(_0x238ebb,_0x11ac3d){return db[_0x6e70('0x34')][_0x6e70('0x50')](_0x238ebb[_0x6e70('0x51')],{})[_0x6e70('0x2b')](function(_0x4ad5a9){var _0x756a5b=_0x238ebb[_0x6e70('0x52')][_0x6e70('0x53')]({'plain':!![]});if(!_0x756a5b)throw new Error(_0x6e70('0x54'));if(_0x756a5b[_0x6e70('0x55')]==='user'){var _0x4ae901=_0x4ad5a9[_0x6e70('0x53')]({'plain':!![]});var _0x2e3ea6=_0x6e70('0x2c');return db[_0x6e70('0x56')][_0x6e70('0x4f')]({'where':{'name':_0x2e3ea6,'userProfileId':_0x756a5b['userProfileId']},'raw':!![]})[_0x6e70('0x2b')](function(_0x232366){if(_0x232366&&_0x232366[_0x6e70('0x57')]===0x0){return db[_0x6e70('0x58')][_0x6e70('0x50')]({'name':_0x4ae901['name'],'resourceId':_0x4ae901['id'],'type':_0x232366[_0x6e70('0x31')],'sectionId':_0x232366['id']},{})[_0x6e70('0x2b')](function(){return _0x4ad5a9;});}else{return _0x4ad5a9;}})[_0x6e70('0x59')](function(_0x3fb0d3){logger[_0x6e70('0x2f')](_0x6e70('0x5a'),_0x3fb0d3);throw _0x3fb0d3;});}return _0x4ad5a9;})['then'](respondWithResult(_0x11ac3d,0xc9))[_0x6e70('0x59')](handleError(_0x11ac3d,null));};exports[_0x6e70('0x2a')]=function(_0x5c2396,_0x382fde){if(_0x5c2396[_0x6e70('0x51')]['id']){delete _0x5c2396['body']['id'];}return db[_0x6e70('0x34')][_0x6e70('0x4f')]({'where':{'id':_0x5c2396[_0x6e70('0x4e')]['id']}})[_0x6e70('0x2b')](handleEntityNotFound(_0x382fde,null))[_0x6e70('0x2b')](saveUpdates(_0x5c2396['body'],null))[_0x6e70('0x2b')](respondWithResult(_0x382fde,null))[_0x6e70('0x59')](handleError(_0x382fde,null));};exports[_0x6e70('0x2d')]=function(_0x13be81,_0x1c02d7){return db[_0x6e70('0x34')][_0x6e70('0x4f')]({'where':{'id':_0x13be81[_0x6e70('0x4e')]['id']}})[_0x6e70('0x2b')](handleEntityNotFound(_0x1c02d7,null))[_0x6e70('0x2b')](removeEntity(_0x1c02d7,null))[_0x6e70('0x59')](handleError(_0x1c02d7,null));};exports[_0x6e70('0x5b')]=function(_0xb8f78,_0x1fd9a6){return db[_0x6e70('0x34')][_0x6e70('0x5b')]()[_0x6e70('0x2b')](respondWithResult(_0x1fd9a6,null))[_0x6e70('0x59')](handleError(_0x1fd9a6,null));};exports[_0x6e70('0x5c')]=function(_0x1c7dca,_0x4c6aab,_0x28898a){if(_0x1c7dca[_0x6e70('0x51')]['id']){delete _0x1c7dca[_0x6e70('0x51')]['id'];}return db[_0x6e70('0x34')][_0x6e70('0x4f')]({'where':{'id':_0x1c7dca[_0x6e70('0x4e')]['id']}})['then'](handleEntityNotFound(_0x4c6aab,null))[_0x6e70('0x2b')](function(_0x6cabf0){if(_0x6cabf0){_0x1c7dca['body'][_0x6e70('0x5d')]=_0x6cabf0['id'];return db[_0x6e70('0x5e')][_0x6e70('0x50')](_0x1c7dca['body']);}})['then'](respondWithResult(_0x4c6aab,null))[_0x6e70('0x59')](handleError(_0x4c6aab,null));};exports[_0x6e70('0x5f')]=function(_0x2d0203,_0x41a861,_0x10d299){var _0x739946={'raw':![],'where':{}};var _0x30cd88={};var _0x57bfe5={'count':0x0,'rows':[]};return db['CmList'][_0x6e70('0x60')]({'where':{'id':_0x2d0203[_0x6e70('0x4e')]['id']}})[_0x6e70('0x2b')](handleEntityNotFound(_0x41a861,null))[_0x6e70('0x2b')](function(_0x5b1e6f){if(_0x5b1e6f){_0x30cd88['model']=_[_0x6e70('0x39')](db[_0x6e70('0x5e')]['rawAttributes']);_0x30cd88['query']=_[_0x6e70('0x39')](_0x2d0203['query']);_0x30cd88[_0x6e70('0x3b')]=_[_0x6e70('0x3c')](_0x30cd88[_0x6e70('0x3d')],_0x30cd88[_0x6e70('0x3a')]);_0x739946[_0x6e70('0x3e')]=_[_0x6e70('0x3c')](_0x30cd88[_0x6e70('0x3d')],qs[_0x6e70('0x3f')](_0x2d0203['query'][_0x6e70('0x3f')]));_0x739946[_0x6e70('0x3e')]=_0x739946[_0x6e70('0x3e')][_0x6e70('0x40')]?_0x739946[_0x6e70('0x3e')]:_0x30cd88['model'];if(!_0x2d0203['query']['hasOwnProperty'](_0x6e70('0x42'))){_0x739946[_0x6e70('0x24')]=qs[_0x6e70('0x24')](_0x2d0203['query']['limit']);_0x739946[_0x6e70('0x23')]=qs[_0x6e70('0x23')](_0x2d0203[_0x6e70('0x3a')][_0x6e70('0x23')]);}_0x739946[_0x6e70('0x61')]=qs[_0x6e70('0x43')](_0x2d0203['query'][_0x6e70('0x43')]);_0x739946[_0x6e70('0x44')]=qs[_0x6e70('0x3b')](_[_0x6e70('0x45')](_0x2d0203['query'],_0x30cd88[_0x6e70('0x3b')]));_0x739946['where']['ListId']=_0x5b1e6f['id'];if(_0x2d0203[_0x6e70('0x3a')][_0x6e70('0x46')]){_0x739946[_0x6e70('0x44')]=_[_0x6e70('0x47')](_0x739946[_0x6e70('0x44')],{'$or':_[_0x6e70('0x38')](_0x739946['attributes'],function(_0x370eeb){var _0x152003={};_0x152003[_0x370eeb]={'$like':'%'+_0x2d0203[_0x6e70('0x3a')][_0x6e70('0x46')]+'%'};return _0x152003;})});}_0x739946=_[_0x6e70('0x47')]({},_0x739946,_0x2d0203[_0x6e70('0x49')]);return db[_0x6e70('0x5e')][_0x6e70('0x4a')]({'where':_0x739946[_0x6e70('0x44')]})[_0x6e70('0x2b')](function(_0x575938){_0x57bfe5[_0x6e70('0x4a')]=_0x575938;if(_0x2d0203[_0x6e70('0x3a')][_0x6e70('0x62')]){_0x739946['include']=[{'all':!![]}];}return db['Disposition'][_0x6e70('0x4c')](_0x739946);})[_0x6e70('0x2b')](function(_0x25e685){_0x57bfe5[_0x6e70('0x63')]=_0x25e685;return _0x57bfe5;});}})[_0x6e70('0x2b')](respondWithFilteredResult(_0x41a861,_0x739946))['catch'](handleError(_0x41a861,null));};exports['removeDispositions']=function(_0xe0073f,_0x241a21,_0x56d4d9){return db[_0x6e70('0x34')][_0x6e70('0x4f')]({'where':{'id':_0xe0073f[_0x6e70('0x4e')]['id']}})[_0x6e70('0x2b')](handleEntityNotFound(_0x241a21,null))[_0x6e70('0x2b')](function(_0x44bf96){if(_0x44bf96){return _0x44bf96[_0x6e70('0x64')](_0xe0073f[_0x6e70('0x3a')][_0x6e70('0x65')]);}})[_0x6e70('0x2b')](respondWithStatusCode(_0x241a21,null))[_0x6e70('0x59')](handleError(_0x241a21,null));};exports[_0x6e70('0x66')]=function(_0x2eb58b,_0x2473e8,_0x511658){return db['CmList'][_0x6e70('0x4f')]({'where':{'id':_0x2eb58b['params']['id']}})[_0x6e70('0x2b')](handleEntityNotFound(_0x2473e8,null))['then'](function(_0x5b5471){if(_0x5b5471){var _0x402f6f=[];var _0x48e04b={'success':[],'errors':[]};return db['CmContact'][_0x6e70('0x5b')]()[_0x6e70('0x2b')](function(_0x3d1b42){if(_0x2eb58b['body']['tags']&&_['isArray'](_0x2eb58b[_0x6e70('0x51')]['tags'])){if(_0x2eb58b[_0x6e70('0x51')][_0x6e70('0x67')][_0x6e70('0x40')]){_0x2eb58b[_0x6e70('0x51')][_0x6e70('0x67')]=_0x2eb58b[_0x6e70('0x51')][_0x6e70('0x67')]['join'](';')+';';}else{_0x2eb58b[_0x6e70('0x51')][_0x6e70('0x67')]=null;}}else{_0x2eb58b[_0x6e70('0x51')]['tags']=null;}if(_0x2eb58b[_0x6e70('0x51')]&&_[_0x6e70('0x68')](_0x2eb58b[_0x6e70('0x51')])){for(var _0x267576=0x0;_0x267576<_0x2eb58b[_0x6e70('0x51')][_0x6e70('0x40')];_0x267576+=0x1){_0x2eb58b[_0x6e70('0x51')][_0x267576][_0x6e70('0x5d')]=_0x2eb58b[_0x6e70('0x4e')]['id'];_0x402f6f['push'](_0x2eb58b[_0x6e70('0x51')][_0x267576]);}return BPromise[_0x6e70('0x69')](_0x402f6f,function(_0x53acc8){return db[_0x6e70('0x6a')][_0x6e70('0x50')](_['omit'](_0x53acc8,['ids','id'])||{},{'fields':_[_0x6e70('0x39')](_0x3d1b42),'raw':!![]})['then'](function(_0x154c8a){_0x48e04b['success'][_0x6e70('0x6b')](_0x154c8a[_0x6e70('0x6c')]);})[_0x6e70('0x59')](function(_0x40eec7){_0x48e04b[_0x6e70('0x6d')][_0x6e70('0x6b')]({'data':_0x53acc8,'error':_0x40eec7[_0x6e70('0x6e')]});});})['then'](function(_0x4d6a09){return _0x48e04b;})[_0x6e70('0x59')](function(_0x4bf451){return _0x4bf451;});}else{_0x2473e8[_0x6e70('0x20')](0x190)[_0x6e70('0x22')]({'message':_0x6e70('0x6f')});}});}})[_0x6e70('0x2b')](respondWithResult(_0x2473e8,null))['catch'](handleError(_0x2473e8,null));};exports[_0x6e70('0x70')]=function(_0x5c30ce,_0x260dfa,_0x18a1be){var _0x21cd21;return db[_0x6e70('0x34')][_0x6e70('0x4f')]({'where':{'id':_0x5c30ce[_0x6e70('0x4e')]['id']},'include':[{'model':db[_0x6e70('0x71')],'as':'CustomFields'}]})[_0x6e70('0x2b')](handleEntityNotFound(_0x260dfa,null))['then'](function(_0x185599){if(_0x185599){_0x21cd21=_0x185599;return db['CmContact']['rawAttributes'];}})['then'](function(_0x1b4258){if(_0x1b4258){var _0x2179c9={};var _0x168209={};_0x168209[_0x6e70('0x3d')]=_[_0x6e70('0x72')](_['keys'](_0x1b4258),_[_0x6e70('0x38')](_0x21cd21[_0x6e70('0x73')],function(_0x48c30c){return util[_0x6e70('0x74')]('cf_%d',_0x48c30c['id']);}));_0x168209[_0x6e70('0x3a')]=_['keys'](_0x5c30ce['query']);_0x168209[_0x6e70('0x3b')]=_[_0x6e70('0x3c')](_0x168209[_0x6e70('0x3d')],_0x168209[_0x6e70('0x3a')]);_0x2179c9[_0x6e70('0x3e')]=_[_0x6e70('0x3c')](_0x168209[_0x6e70('0x3d')],qs['fields'](_0x5c30ce[_0x6e70('0x3a')]['fields']));_0x2179c9[_0x6e70('0x3e')]=_0x2179c9[_0x6e70('0x3e')][_0x6e70('0x40')]?_0x2179c9[_0x6e70('0x3e')]:_0x168209[_0x6e70('0x3d')];if(!_0x5c30ce[_0x6e70('0x3a')][_0x6e70('0x41')]('nolimit')){_0x2179c9[_0x6e70('0x24')]=qs['limit'](_0x5c30ce[_0x6e70('0x3a')][_0x6e70('0x24')]);_0x2179c9[_0x6e70('0x23')]=qs[_0x6e70('0x23')](_0x5c30ce[_0x6e70('0x3a')][_0x6e70('0x23')]);}_0x2179c9[_0x6e70('0x61')]=qs[_0x6e70('0x43')](_0x5c30ce[_0x6e70('0x3a')][_0x6e70('0x43')]);_0x2179c9['where']=qs[_0x6e70('0x3b')](_[_0x6e70('0x45')](_0x5c30ce[_0x6e70('0x3a')],_0x168209[_0x6e70('0x3b')]));_0x2179c9[_0x6e70('0x75')]=!![];if(_0x5c30ce['query']['filter']){_0x2179c9['where']=_[_0x6e70('0x47')](_0x2179c9[_0x6e70('0x44')],{'$or':_[_0x6e70('0x38')](_0x2179c9[_0x6e70('0x3e')],function(_0x3ef276){var _0x251111={};_0x251111[_0x3ef276]={'$like':'%'+_0x5c30ce[_0x6e70('0x3a')][_0x6e70('0x46')]+'%'};return _0x251111;})});}_0x2179c9=_[_0x6e70('0x47')]({},_0x2179c9,_0x5c30ce[_0x6e70('0x49')]);return _0x21cd21[_0x6e70('0x70')](_0x2179c9);}})[_0x6e70('0x2b')](respondWithResult(_0x260dfa,null))[_0x6e70('0x59')](handleError(_0x260dfa,null));};exports[_0x6e70('0x76')]=function(_0x3fcf78,_0x54abf9,_0x3a038a){var _0x223610;return db[_0x6e70('0x34')][_0x6e70('0x4f')]({'where':{'id':_0x3fcf78[_0x6e70('0x4e')]['id']},'include':[{'model':db[_0x6e70('0x71')],'as':'CustomFields'}]})['then'](handleEntityNotFound(_0x54abf9,null))[_0x6e70('0x2b')](function(_0x433c79){if(_0x433c79){_0x223610=_0x433c79;return db[_0x6e70('0x6a')][_0x6e70('0x35')];}})[_0x6e70('0x2b')](function(_0x213926){if(_0x213926){var _0x2ea4e9={};var _0x5f0cfb={};_0x5f0cfb[_0x6e70('0x3d')]=_['concat'](_[_0x6e70('0x39')](_0x213926),_[_0x6e70('0x38')](_0x223610[_0x6e70('0x73')],function(_0x3caa72){return util['format'](_0x6e70('0x77'),_0x3caa72['id']);}));_0x5f0cfb[_0x6e70('0x3a')]=_['keys'](_0x3fcf78[_0x6e70('0x3a')]);_0x5f0cfb['filters']=_[_0x6e70('0x3c')](_0x5f0cfb['model'],_0x5f0cfb['query']);_0x2ea4e9[_0x6e70('0x3e')]=_[_0x6e70('0x3c')](_0x5f0cfb[_0x6e70('0x3d')],qs['fields'](_0x3fcf78[_0x6e70('0x3a')][_0x6e70('0x3f')]));_0x2ea4e9['attributes']=_0x2ea4e9[_0x6e70('0x3e')][_0x6e70('0x40')]?_0x2ea4e9[_0x6e70('0x3e')]:_0x5f0cfb[_0x6e70('0x3d')];if(!_0x3fcf78[_0x6e70('0x3a')][_0x6e70('0x41')](_0x6e70('0x42'))){_0x2ea4e9[_0x6e70('0x24')]=qs[_0x6e70('0x24')](_0x3fcf78['query']['limit']);_0x2ea4e9[_0x6e70('0x23')]=qs['offset'](_0x3fcf78[_0x6e70('0x3a')][_0x6e70('0x23')]);}_0x2ea4e9['order']=qs[_0x6e70('0x43')](_0x3fcf78[_0x6e70('0x3a')][_0x6e70('0x43')]);_0x2ea4e9['where']=qs[_0x6e70('0x3b')](_[_0x6e70('0x45')](_0x3fcf78[_0x6e70('0x3a')],_0x5f0cfb[_0x6e70('0x3b')]));_0x2ea4e9[_0x6e70('0x75')]=!![];if(_0x3fcf78[_0x6e70('0x3a')][_0x6e70('0x46')]){_0x2ea4e9[_0x6e70('0x44')]=_[_0x6e70('0x47')](_0x2ea4e9[_0x6e70('0x44')],{'$or':_[_0x6e70('0x38')](_0x2ea4e9[_0x6e70('0x3e')],function(_0x5f41ae){var _0x5bcfcf={};_0x5bcfcf[_0x5f41ae]={'$like':'%'+_0x3fcf78[_0x6e70('0x3a')][_0x6e70('0x46')]+'%'};return _0x5bcfcf;})});}_0x2ea4e9=_[_0x6e70('0x47')]({},_0x2ea4e9,_0x3fcf78[_0x6e70('0x49')]);return _0x223610[_0x6e70('0x70')](_0x2ea4e9);}})['then'](function(_0x3296e9){if(!_[_0x6e70('0x78')](_0x3296e9)){var _0x2a5aed=toCsv(_0x3296e9);var _0x5e5b1f=Date[_0x6e70('0x79')]();fs['writeFileSync'](util['format'](_0x6e70('0x7a'),_0x223610['id'],_0x5e5b1f),_0x2a5aed);_0x54abf9[_0x6e70('0x7b')](_0x6e70('0x7c'),_0x6e70('0x7d')+util['format'](_0x6e70('0x7e'),_0x223610['id'],_0x5e5b1f));_0x54abf9[_0x6e70('0x7b')]('Content-type','text/csv');return _0x54abf9['download'](util[_0x6e70('0x74')](_0x6e70('0x7a'),_0x223610['id'],_0x5e5b1f));}else{return _0x54abf9[_0x6e70('0x2e')](0xcc);}})[_0x6e70('0x59')](handleError(_0x54abf9,null));};exports[_0x6e70('0x7f')]=function(_0xae1e83,_0x40c5c0,_0x5d5dc1){var _0x26e149;delete _0xae1e83[_0x6e70('0x51')]['id'];return db[_0x6e70('0x34')][_0x6e70('0x60')]({'where':{'id':_0xae1e83[_0x6e70('0x4e')]['id']}})[_0x6e70('0x2b')](handleEntityNotFound(_0x40c5c0,null))[_0x6e70('0x2b')](function(_0x2badf5){if(_0x2badf5){return db[_0x6e70('0x80')][_0x6e70('0x81')](function(_0x1a2a44){return db[_0x6e70('0x71')]['create'](_0xae1e83[_0x6e70('0x51')],{'transaction':_0x1a2a44})[_0x6e70('0x2b')](function(_0x397289){_0x26e149=_0x397289;return _0x2badf5['addCustomFields'](_0x397289,{'transaction':_0x1a2a44});})[_0x6e70('0x2b')](function(){var _0x8264bb={'type':db[_0x6e70('0x82')][_0x6e70('0x83')],'transaction':_0x1a2a44};switch(_0xae1e83[_0x6e70('0x51')][_0x6e70('0x36')]){case'text':_0x8264bb['type']=db[_0x6e70('0x82')][_0x6e70('0x83')];break;case _0x6e70('0x84'):_0x8264bb[_0x6e70('0x36')]=db[_0x6e70('0x82')][_0x6e70('0x85')];break;case'switch':_0x8264bb[_0x6e70('0x36')]=db[_0x6e70('0x82')][_0x6e70('0x86')];_0x8264bb[_0x6e70('0x87')]=![];break;default:}return db[_0x6e70('0x80')][_0x6e70('0x88')][_0x6e70('0x89')](_0x6e70('0x8a'),util[_0x6e70('0x74')](_0x6e70('0x8b'),_0x26e149['id']),_0x8264bb);})[_0x6e70('0x2b')](function(){return _0x26e149;});});}})[_0x6e70('0x2b')](respondWithResult(_0x40c5c0,null))[_0x6e70('0x59')](handleError(_0x40c5c0,null));};exports[_0x6e70('0x8c')]=function(_0xc2eb8c,_0x1fc939,_0x3b9f61){var _0x4ca2f4={};var _0x4995fc={};var _0x35bd16;var _0xebb753;return db[_0x6e70('0x34')][_0x6e70('0x60')]({'where':{'id':_0xc2eb8c[_0x6e70('0x4e')]['id']}})[_0x6e70('0x2b')](handleEntityNotFound(_0x1fc939,null))['then'](function(_0x8476fd){if(_0x8476fd){_0x35bd16=_0x8476fd;_0x4995fc['model']=_[_0x6e70('0x39')](db['CmCustomField'][_0x6e70('0x35')]);_0x4995fc['query']=_[_0x6e70('0x39')](_0xc2eb8c[_0x6e70('0x3a')]);_0x4995fc[_0x6e70('0x3b')]=_['intersection'](_0x4995fc[_0x6e70('0x3d')],_0x4995fc[_0x6e70('0x3a')]);_0x4ca2f4[_0x6e70('0x3e')]=_[_0x6e70('0x3c')](_0x4995fc[_0x6e70('0x3d')],qs[_0x6e70('0x3f')](_0xc2eb8c[_0x6e70('0x3a')]['fields']));_0x4ca2f4[_0x6e70('0x3e')]=_0x4ca2f4[_0x6e70('0x3e')]['length']?_0x4ca2f4[_0x6e70('0x3e')]:_0x4995fc[_0x6e70('0x3d')];_0x4ca2f4['order']=qs['sort'](_0xc2eb8c[_0x6e70('0x3a')]['sort']);_0x4ca2f4[_0x6e70('0x44')]=qs[_0x6e70('0x3b')](_[_0x6e70('0x45')](_0xc2eb8c[_0x6e70('0x3a')],_0x4995fc[_0x6e70('0x3b')]));_0x4ca2f4[_0x6e70('0x44')]=_[_0x6e70('0x47')](_0x4ca2f4[_0x6e70('0x44')],{'$or':[{'ListId':_0x8476fd['id']},{'ListId':null}]});if(_0xc2eb8c[_0x6e70('0x3a')][_0x6e70('0x46')]){_0x4ca2f4[_0x6e70('0x44')]=_[_0x6e70('0x47')](_0x4ca2f4[_0x6e70('0x44')],{'$or':_['map'](_0x4ca2f4[_0x6e70('0x3e')],function(_0x3fb786){var _0x2aa20a={};_0x2aa20a[_0x3fb786]={'$like':'%'+_0xc2eb8c[_0x6e70('0x3a')][_0x6e70('0x46')]+'%'};return _0x2aa20a;})});}_0x4ca2f4=_[_0x6e70('0x47')]({},_0x4ca2f4,_0xc2eb8c[_0x6e70('0x49')]);return db[_0x6e70('0x71')][_0x6e70('0x8d')](_0x4ca2f4);}})['then'](respondWithResult(_0x1fc939,null))[_0x6e70('0x59')](handleError(_0x1fc939,null));};exports[_0x6e70('0x8e')]=function(_0x349387,_0x49fd11,_0x88522){return db[_0x6e70('0x34')][_0x6e70('0x4f')]({'where':{'id':_0x349387[_0x6e70('0x4e')]['id']}})['then'](handleEntityNotFound(_0x49fd11,null))['then'](function(_0x20ac7e){if(_0x20ac7e){return _0x20ac7e['addAgents'](_0x349387['body'][_0x6e70('0x65')],_[_0x6e70('0x8f')](_0x349387[_0x6e70('0x51')],[_0x6e70('0x65'),'id'])||{})[_0x6e70('0x90')](function(_0x22827){for(var _0xf7e813=0x0;_0xf7e813<_0x349387[_0x6e70('0x51')][_0x6e70('0x65')][_0x6e70('0x40')];_0xf7e813+=0x1){socket['emit'](_0x6e70('0x91'),{'UserId':_0x349387[_0x6e70('0x51')][_0x6e70('0x65')][_0xf7e813],'CmListId':_0x349387[_0x6e70('0x4e')]['id']});}return _0x22827;});}})[_0x6e70('0x2b')](respondWithResult(_0x49fd11,null))[_0x6e70('0x59')](handleError(_0x49fd11,null));};exports[_0x6e70('0x92')]=function(_0xa9a209,_0x3c0e38,_0x372c3d){return db['CmList']['find']({'where':{'id':_0xa9a209['params']['id']}})['then'](handleEntityNotFound(_0x3c0e38,null))[_0x6e70('0x2b')](function(_0x12f155){if(_0x12f155){return _0x12f155[_0x6e70('0x92')](_0xa9a209['query'][_0x6e70('0x65')])['then'](function(){if(_[_0x6e70('0x68')](_0xa9a209['query']['ids'])){for(var _0xe4b9f8=0x0;_0xe4b9f8<_0xa9a209[_0x6e70('0x3a')][_0x6e70('0x65')][_0x6e70('0x40')];_0xe4b9f8+=0x1){socket[_0x6e70('0x93')](_0x6e70('0x94'),{'UserId':Number(_0xa9a209[_0x6e70('0x3a')]['ids'][_0xe4b9f8]),'CmListId':Number(_0xa9a209[_0x6e70('0x4e')]['id'])});}}else{socket[_0x6e70('0x93')]('userCmList:remove',{'UserId':Number(_0xa9a209[_0x6e70('0x3a')][_0x6e70('0x65')]),'CmListId':Number(_0xa9a209[_0x6e70('0x4e')]['id'])});}});}})['then'](respondWithStatusCode(_0x3c0e38,null))[_0x6e70('0x59')](handleError(_0x3c0e38,null));};exports[_0x6e70('0x95')]=function(_0x5516b9,_0x502927,_0x18f71f){var _0x303ae3={};var _0x747523={};var _0xe93f52;var _0x2943a6;return db['CmList']['findOne']({'where':{'id':_0x5516b9[_0x6e70('0x4e')]['id']}})[_0x6e70('0x2b')](handleEntityNotFound(_0x502927,null))[_0x6e70('0x2b')](function(_0x5dcc57){if(_0x5dcc57){_0xe93f52=_0x5dcc57;_0x747523[_0x6e70('0x3d')]=_[_0x6e70('0x39')](db[_0x6e70('0x96')][_0x6e70('0x35')]);_0x747523[_0x6e70('0x3a')]=_[_0x6e70('0x39')](_0x5516b9[_0x6e70('0x3a')]);_0x747523[_0x6e70('0x3b')]=_[_0x6e70('0x3c')](_0x747523[_0x6e70('0x3d')],_0x747523['query']);_0x303ae3[_0x6e70('0x3e')]=_[_0x6e70('0x3c')](_0x747523[_0x6e70('0x3d')],qs[_0x6e70('0x3f')](_0x5516b9['query'][_0x6e70('0x3f')]));_0x303ae3[_0x6e70('0x3e')]=_0x303ae3[_0x6e70('0x3e')]['length']?_0x303ae3[_0x6e70('0x3e')]:_0x747523[_0x6e70('0x3d')];_0x303ae3[_0x6e70('0x61')]=qs[_0x6e70('0x43')](_0x5516b9['query'][_0x6e70('0x43')]);_0x303ae3[_0x6e70('0x44')]=qs[_0x6e70('0x3b')](_[_0x6e70('0x45')](_0x5516b9[_0x6e70('0x3a')],_0x747523[_0x6e70('0x3b')]));if(_0x5516b9[_0x6e70('0x3a')][_0x6e70('0x46')]){_0x303ae3[_0x6e70('0x44')]=_[_0x6e70('0x47')](_0x303ae3['where'],{'$or':_['map'](_0x303ae3[_0x6e70('0x3e')],function(_0x3dec80){var _0x323887={};_0x323887[_0x3dec80]={'$like':'%'+_0x5516b9[_0x6e70('0x3a')][_0x6e70('0x46')]+'%'};return _0x323887;})});}_0x303ae3=_[_0x6e70('0x47')]({},_0x303ae3,_0x5516b9[_0x6e70('0x49')]);return _0xe93f52[_0x6e70('0x95')](_0x303ae3);}})[_0x6e70('0x2b')](function(_0x166244){if(_0x166244){_0x2943a6=_0x166244[_0x6e70('0x40')];if(!_0x5516b9[_0x6e70('0x3a')][_0x6e70('0x41')](_0x6e70('0x42'))){_0x303ae3[_0x6e70('0x24')]=qs['limit'](_0x5516b9[_0x6e70('0x3a')][_0x6e70('0x24')]);_0x303ae3[_0x6e70('0x23')]=qs['offset'](_0x5516b9[_0x6e70('0x3a')][_0x6e70('0x23')]);}return _0xe93f52[_0x6e70('0x95')](_0x303ae3);}})[_0x6e70('0x2b')](function(_0x3c7d2f){if(_0x3c7d2f){return _0x3c7d2f?{'count':_0x2943a6,'rows':_0x3c7d2f}:null;}})[_0x6e70('0x2b')](respondWithResult(_0x502927,null))['catch'](handleError(_0x502927,null));}; \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index 88feefa..d87b9e9 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 _0x98db=['../../mysqldb','CmList','setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x3f6460,_0x3bdb9b){var _0x5d9ac6=function(_0x1ebb5e){while(--_0x1ebb5e){_0x3f6460['push'](_0x3f6460['shift']());}};_0x5d9ac6(++_0x3bdb9b);}(_0x98db,0x149));var _0xb98d=function(_0xce9195,_0x1963e1){_0xce9195=_0xce9195-0x0;var _0x530fe6=_0x98db[_0xce9195];return _0x530fe6;};'use strict';var EventEmitter=require(_0xb98d('0x0'));var CmList=require(_0xb98d('0x1'))['db'][_0xb98d('0x2')];var CmListEvents=new EventEmitter();CmListEvents[_0xb98d('0x3')](0x0);var events={'afterCreate':_0xb98d('0x4'),'afterUpdate':'update','afterDestroy':_0xb98d('0x5')};function emitEvent(_0x45dd56){return function(_0x17ff0a,_0x1b0616,_0x2bfeb1){CmListEvents[_0xb98d('0x6')](_0x45dd56+':'+_0x17ff0a['id'],_0x17ff0a);CmListEvents[_0xb98d('0x6')](_0x45dd56,_0x17ff0a);_0x2bfeb1(null);};}for(var e in events){if(events[_0xb98d('0x7')](e)){var event=events[e];CmList[_0xb98d('0x8')](e,emitEvent(event));}}module[_0xb98d('0x9')]=CmListEvents; \ No newline at end of file +var _0x9624=['exports','events','../../mysqldb','CmList','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x45e5b9,_0x557b95){var _0x162588=function(_0x3ce82b){while(--_0x3ce82b){_0x45e5b9['push'](_0x45e5b9['shift']());}};_0x162588(++_0x557b95);}(_0x9624,0xb5));var _0x4962=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9624[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x4962('0x0'));var CmList=require(_0x4962('0x1'))['db'][_0x4962('0x2')];var CmListEvents=new EventEmitter();CmListEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x4962('0x3'),'afterUpdate':_0x4962('0x4'),'afterDestroy':_0x4962('0x5')};function emitEvent(_0x3a5299){return function(_0x3e3947,_0x34c96d,_0x5a9386){CmListEvents['emit'](_0x3a5299+':'+_0x3e3947['id'],_0x3e3947);CmListEvents[_0x4962('0x6')](_0x3a5299,_0x3e3947);_0x5a9386(null);};}for(var e in events){if(events[_0x4962('0x7')](e)){var event=events[e];CmList[_0x4962('0x8')](e,emitEvent(event));}}module[_0x4962('0x9')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index ef94997..606a285 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 _0x2607=['cm_lists','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./cmList.attributes','CmList'];(function(_0x23e7c1,_0x35110c){var _0x1add43=function(_0x238918){while(--_0x238918){_0x23e7c1['push'](_0x23e7c1['shift']());}};_0x1add43(++_0x35110c);}(_0x2607,0xe5));var _0x7260=function(_0x1d1963,_0x32cc0e){_0x1d1963=_0x1d1963-0x0;var _0x3f58bb=_0x2607[_0x1d1963];return _0x3f58bb;};'use strict';var _=require(_0x7260('0x0'));var util=require(_0x7260('0x1'));var logger=require(_0x7260('0x2'))(_0x7260('0x3'));var moment=require(_0x7260('0x4'));var BPromise=require(_0x7260('0x5'));var rp=require(_0x7260('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7260('0x7'));var config=require(_0x7260('0x8'));var attributes=require(_0x7260('0x9'));module['exports']=function(_0x2460a8,_0x5a9a1c){return _0x2460a8['define'](_0x7260('0xa'),attributes,{'tableName':_0x7260('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x71fc=['CmList','cm_lists','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','define'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x71fc,0x19a));var _0xc71f=function(_0x27c72c,_0x1d9de1){_0x27c72c=_0x27c72c-0x0;var _0x41c2b4=_0x71fc[_0x27c72c];return _0x41c2b4;};'use strict';var _=require(_0xc71f('0x0'));var util=require(_0xc71f('0x1'));var logger=require(_0xc71f('0x2'))(_0xc71f('0x3'));var moment=require(_0xc71f('0x4'));var BPromise=require(_0xc71f('0x5'));var rp=require(_0xc71f('0x6'));var fs=require('fs');var path=require(_0xc71f('0x7'));var rimraf=require('rimraf');var config=require(_0xc71f('0x8'));var attributes=require('./cmList.attributes');module['exports']=function(_0x384e3c,_0x2e211e){return _0x384e3c[_0xc71f('0x9')](_0xc71f('0xa'),attributes,{'tableName':_0xc71f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmList/cmList.rpc.js b/server/api/cmList/cmList.rpc.js index 446931e..d94ad11 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 _0xd5d7=['lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','redis','localhost','./cmList.socket','request','CmList,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xd5d7,0x8c));var _0x7d5d=function(_0x4a2f7c,_0x3c9183){_0x4a2f7c=_0x4a2f7c-0x0;var _0x1e55a2=_0xd5d7[_0x4a2f7c];return _0x1e55a2;};'use strict';var _=require(_0x7d5d('0x0'));var util=require('util');var moment=require(_0x7d5d('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7d5d('0x2'));var db=require(_0x7d5d('0x3'))['db'];var utils=require(_0x7d5d('0x4'));var logger=require(_0x7d5d('0x5'))('rpc');var config=require(_0x7d5d('0x6'));var jayson=require(_0x7d5d('0x7'));var client=jayson['client']['http']({'port':0x232a});config[_0x7d5d('0x8')]=_['defaults'](config[_0x7d5d('0x8')],{'host':_0x7d5d('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7d5d('0x8')]));require(_0x7d5d('0xa'))['register'](socket);function respondWithRpcPromise(_0x3dd68d,_0x24e630,_0x409d62){return new BPromise(function(_0x400812,_0xde8acf){return client[_0x7d5d('0xb')](_0x3dd68d,_0x409d62)['then'](function(_0x469cb2){logger['info'](_0x7d5d('0xc'),_0x24e630,_0x7d5d('0xd'));logger[_0x7d5d('0xe')]('CmList,\x20%s,\x20%s,\x20%s',_0x24e630,'request\x20sent',JSON['stringify'](_0x469cb2));if(_0x469cb2[_0x7d5d('0xf')]){if(_0x469cb2[_0x7d5d('0xf')][_0x7d5d('0x10')]===0x1f4){logger[_0x7d5d('0xf')](_0x7d5d('0xc'),_0x24e630,_0x469cb2['error'][_0x7d5d('0x11')]);return _0xde8acf(_0x469cb2[_0x7d5d('0xf')][_0x7d5d('0x11')]);}logger[_0x7d5d('0xf')](_0x7d5d('0xc'),_0x24e630,_0x469cb2['error'][_0x7d5d('0x11')]);return _0x400812(_0x469cb2[_0x7d5d('0xf')][_0x7d5d('0x11')]);}else{logger[_0x7d5d('0x12')](_0x7d5d('0xc'),_0x24e630,_0x7d5d('0xd'));_0x400812(_0x469cb2[_0x7d5d('0x13')][_0x7d5d('0x11')]);}})['catch'](function(_0x59b773){logger[_0x7d5d('0xf')]('CmList,\x20%s,\x20%s',_0x24e630,_0x59b773);_0xde8acf(_0x59b773);});});} \ No newline at end of file +var _0x610f=['stringify','error','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','register','request','info','CmList,\x20%s,\x20%s','debug','CmList,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x125ff8,_0x41925f){var _0x2d9ef=function(_0x4ef34c){while(--_0x4ef34c){_0x125ff8['push'](_0x125ff8['shift']());}};_0x2d9ef(++_0x41925f);}(_0x610f,0x14a));var _0xf610=function(_0xb292f9,_0x42a4bc){_0xb292f9=_0xb292f9-0x0;var _0x366dab=_0x610f[_0xb292f9];return _0x366dab;};'use strict';var _=require(_0xf610('0x0'));var util=require(_0xf610('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xf610('0x2'));var fs=require('fs');var Redis=require(_0xf610('0x3'));var db=require(_0xf610('0x4'))['db'];var utils=require(_0xf610('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xf610('0x6'));var jayson=require(_0xf610('0x7'));var client=jayson[_0xf610('0x8')][_0xf610('0x9')]({'port':0x232a});config[_0xf610('0xa')]=_[_0xf610('0xb')](config[_0xf610('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xf610('0xc'))(new Redis(config[_0xf610('0xa')]));require('./cmList.socket')[_0xf610('0xd')](socket);function respondWithRpcPromise(_0x558d5a,_0x1807e3,_0x507263){return new BPromise(function(_0x4e0f86,_0x544229){return client[_0xf610('0xe')](_0x558d5a,_0x507263)['then'](function(_0x4c5e17){logger[_0xf610('0xf')](_0xf610('0x10'),_0x1807e3,'request\x20sent');logger[_0xf610('0x11')](_0xf610('0x12'),_0x1807e3,_0xf610('0x13'),JSON[_0xf610('0x14')](_0x4c5e17));if(_0x4c5e17['error']){if(_0x4c5e17['error']['code']===0x1f4){logger[_0xf610('0x15')](_0xf610('0x10'),_0x1807e3,_0x4c5e17[_0xf610('0x15')][_0xf610('0x16')]);return _0x544229(_0x4c5e17['error'][_0xf610('0x16')]);}logger[_0xf610('0x15')](_0xf610('0x10'),_0x1807e3,_0x4c5e17[_0xf610('0x15')][_0xf610('0x16')]);return _0x4e0f86(_0x4c5e17[_0xf610('0x15')][_0xf610('0x16')]);}else{logger[_0xf610('0xf')](_0xf610('0x10'),_0x1807e3,_0xf610('0x13'));_0x4e0f86(_0x4c5e17[_0xf610('0x17')][_0xf610('0x16')]);}})[_0xf610('0x18')](function(_0x2d4b73){logger[_0xf610('0x15')]('CmList,\x20%s,\x20%s',_0x1807e3,_0x2d4b73);_0x544229(_0x2d4b73);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 4fdf867..0e6c9bb 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 _0xed08=['remove','update','emit','removeListener','register','length','cmList:','save'];(function(_0x1ed034,_0x5d495d){var _0x4a82b7=function(_0x348231){while(--_0x348231){_0x1ed034['push'](_0x1ed034['shift']());}};_0x4a82b7(++_0x5d495d);}(_0xed08,0x67));var _0x8ed0=function(_0x5e553e,_0x44646f){_0x5e553e=_0x5e553e-0x0;var _0x16bd04=_0xed08[_0x5e553e];return _0x16bd04;};'use strict';var CmListEvents=require('./cmList.events');var events=[_0x8ed0('0x0'),_0x8ed0('0x1'),_0x8ed0('0x2')];function createListener(_0x13c458,_0xce1ff){return function(_0x1ff91e){_0xce1ff[_0x8ed0('0x3')](_0x13c458,_0x1ff91e);};}function removeListener(_0x33c3ad,_0x14901f){return function(){CmListEvents[_0x8ed0('0x4')](_0x33c3ad,_0x14901f);};}exports[_0x8ed0('0x5')]=function(_0x43ca60){for(var _0x5c1343=0x0,_0x15f266=events[_0x8ed0('0x6')];_0x5c1343<_0x15f266;_0x5c1343++){var _0x1c86e6=events[_0x5c1343];var _0x39642a=createListener(_0x8ed0('0x7')+_0x1c86e6,_0x43ca60);CmListEvents['on'](_0x1c86e6,_0x39642a);}}; \ No newline at end of file +var _0xefce=['removeListener','register','cmList:','save','emit'];(function(_0x334c2d,_0x208a15){var _0x5535cc=function(_0x502cf7){while(--_0x502cf7){_0x334c2d['push'](_0x334c2d['shift']());}};_0x5535cc(++_0x208a15);}(_0xefce,0x1e8));var _0xeefc=function(_0x545b71,_0x4f44eb){_0x545b71=_0x545b71-0x0;var _0x26e587=_0xefce[_0x545b71];return _0x26e587;};'use strict';var CmListEvents=require('./cmList.events');var events=[_0xeefc('0x0'),'remove','update'];function createListener(_0x44f0fd,_0x374916){return function(_0x243bdc){_0x374916[_0xeefc('0x1')](_0x44f0fd,_0x243bdc);};}function removeListener(_0x1cb1a5,_0x145a9b){return function(){CmListEvents[_0xeefc('0x2')](_0x1cb1a5,_0x145a9b);};}exports[_0xeefc('0x3')]=function(_0x41ba7c){for(var _0x181dd7=0x0,_0x5a2635=events['length'];_0x181dd7<_0x5a2635;_0x181dd7++){var _0x377309=events[_0x181dd7];var _0xfb5a39=createListener(_0xeefc('0x4')+_0x377309,_0x41ba7c);CmListEvents['on'](_0x377309,_0xfb5a39);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index cde8003..2b7604b 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 _0xa3fd=['show','/:id/dispositions','getDispositions','/:id/contacts','getContacts','/:id/contacts/csv','/:id/fields','getCustomFields','/:id/users','getAgents','post','create','addContacts','addCustomField','addAgents','update','delete','removeDispositions','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./cmList.controller','isAuthenticated','index','get','/describe','/:id'];(function(_0x4635c5,_0x17ecc9){var _0x69e7c8=function(_0x24d98a){while(--_0x24d98a){_0x4635c5['push'](_0x4635c5['shift']());}};_0x69e7c8(++_0x17ecc9);}(_0xa3fd,0x102));var _0xda3f=function(_0x164eca,_0x555e28){_0x164eca=_0x164eca-0x0;var _0x2ce562=_0xa3fd[_0x164eca];return _0x2ce562;};'use strict';var multer=require(_0xda3f('0x0'));var util=require(_0xda3f('0x1'));var path=require(_0xda3f('0x2'));var timeout=require(_0xda3f('0x3'));var express=require(_0xda3f('0x4'));var router=express[_0xda3f('0x5')]();var auth=require(_0xda3f('0x6'));var interaction=require(_0xda3f('0x7'));var config=require('../../config/environment');var controller=require(_0xda3f('0x8'));router['get']('/',auth[_0xda3f('0x9')](),controller[_0xda3f('0xa')]);router[_0xda3f('0xb')](_0xda3f('0xc'),auth[_0xda3f('0x9')](),controller['describe']);router[_0xda3f('0xb')](_0xda3f('0xd'),auth[_0xda3f('0x9')](),controller[_0xda3f('0xe')]);router[_0xda3f('0xb')](_0xda3f('0xf'),auth['isAuthenticated'](),controller[_0xda3f('0x10')]);router[_0xda3f('0xb')](_0xda3f('0x11'),auth[_0xda3f('0x9')](),controller[_0xda3f('0x12')]);router['get'](_0xda3f('0x13'),auth[_0xda3f('0x9')](),controller['getContactsCsv']);router[_0xda3f('0xb')](_0xda3f('0x14'),auth[_0xda3f('0x9')](),controller[_0xda3f('0x15')]);router[_0xda3f('0xb')](_0xda3f('0x16'),auth[_0xda3f('0x9')](),controller[_0xda3f('0x17')]);router[_0xda3f('0x18')]('/',auth[_0xda3f('0x9')](),controller[_0xda3f('0x19')]);router[_0xda3f('0x18')]('/:id/dispositions',auth[_0xda3f('0x9')](),controller['addDisposition']);router[_0xda3f('0x18')](_0xda3f('0x11'),auth[_0xda3f('0x9')](),controller[_0xda3f('0x1a')]);router['post'](_0xda3f('0x14'),auth['isAuthenticated'](),controller[_0xda3f('0x1b')]);router['post'](_0xda3f('0x16'),auth[_0xda3f('0x9')](),controller[_0xda3f('0x1c')]);router['put'](_0xda3f('0xd'),auth[_0xda3f('0x9')](),controller[_0xda3f('0x1d')]);router[_0xda3f('0x1e')]('/:id',auth[_0xda3f('0x9')](),controller['destroy']);router[_0xda3f('0x1e')](_0xda3f('0xf'),auth[_0xda3f('0x9')](),controller[_0xda3f('0x1f')]);router[_0xda3f('0x1e')](_0xda3f('0x16'),auth[_0xda3f('0x9')](),controller[_0xda3f('0x20')]);module[_0xda3f('0x21')]=router; \ No newline at end of file +var _0x79ff=['put','update','delete','destroy','removeDispositions','removeAgents','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./cmList.controller','get','/describe','describe','/:id','isAuthenticated','show','/:id/dispositions','getDispositions','/:id/contacts','getContactsCsv','/:id/fields','/:id/users','getAgents','post','create','addDisposition','addContacts','addCustomField'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x79ff,0xac));var _0xf79f=function(_0x1ab0e6,_0x17ba8d){_0x1ab0e6=_0x1ab0e6-0x0;var _0x248815=_0x79ff[_0x1ab0e6];return _0x248815;};'use strict';var multer=require(_0xf79f('0x0'));var util=require(_0xf79f('0x1'));var path=require(_0xf79f('0x2'));var timeout=require(_0xf79f('0x3'));var express=require('express');var router=express[_0xf79f('0x4')]();var auth=require(_0xf79f('0x5'));var interaction=require(_0xf79f('0x6'));var config=require('../../config/environment');var controller=require(_0xf79f('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xf79f('0x8')](_0xf79f('0x9'),auth['isAuthenticated'](),controller[_0xf79f('0xa')]);router[_0xf79f('0x8')](_0xf79f('0xb'),auth[_0xf79f('0xc')](),controller[_0xf79f('0xd')]);router['get'](_0xf79f('0xe'),auth[_0xf79f('0xc')](),controller[_0xf79f('0xf')]);router['get'](_0xf79f('0x10'),auth[_0xf79f('0xc')](),controller['getContacts']);router[_0xf79f('0x8')]('/:id/contacts/csv',auth[_0xf79f('0xc')](),controller[_0xf79f('0x11')]);router[_0xf79f('0x8')](_0xf79f('0x12'),auth[_0xf79f('0xc')](),controller['getCustomFields']);router[_0xf79f('0x8')](_0xf79f('0x13'),auth[_0xf79f('0xc')](),controller[_0xf79f('0x14')]);router[_0xf79f('0x15')]('/',auth['isAuthenticated'](),controller[_0xf79f('0x16')]);router[_0xf79f('0x15')]('/:id/dispositions',auth[_0xf79f('0xc')](),controller[_0xf79f('0x17')]);router[_0xf79f('0x15')](_0xf79f('0x10'),auth[_0xf79f('0xc')](),controller[_0xf79f('0x18')]);router[_0xf79f('0x15')]('/:id/fields',auth['isAuthenticated'](),controller[_0xf79f('0x19')]);router['post'](_0xf79f('0x13'),auth[_0xf79f('0xc')](),controller['addAgents']);router[_0xf79f('0x1a')](_0xf79f('0xb'),auth['isAuthenticated'](),controller[_0xf79f('0x1b')]);router[_0xf79f('0x1c')](_0xf79f('0xb'),auth[_0xf79f('0xc')](),controller[_0xf79f('0x1d')]);router[_0xf79f('0x1c')](_0xf79f('0xe'),auth[_0xf79f('0xc')](),controller[_0xf79f('0x1e')]);router[_0xf79f('0x1c')](_0xf79f('0x13'),auth[_0xf79f('0xc')](),controller[_0xf79f('0x1f')]);module[_0xf79f('0x20')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index 13e7e5e..29cde30 100644 --- a/server/api/condition/condition.attributes.js +++ b/server/api/condition/condition.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['STRING','sequelize','exports','VIRTUAL','field'];(function(_0x3a60d7,_0x42a292){var _0x32d5ea=function(_0x3fcdd5){while(--_0x3fcdd5){_0x3a60d7['push'](_0x3a60d7['shift']());}};_0x32d5ea(++_0x42a292);}(_0xa9e0,0x123));var _0x0a9e=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0xa9e0[_0xae7c2f];return _0x5d7001;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')],'get':function(_0x5dd881){return this['getDataValue'](_0x0a9e('0x3'));}},'field':{'type':Sequelize['STRING'],'allowNull':![]},'operator':{'type':Sequelize[_0x0a9e('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0x0a9e('0x4')],'allowNull':![]}}; \ No newline at end of file +var _0xa9e0=['STRING','sequelize','exports','VIRTUAL','field'];(function(_0x4c8fc3,_0x517a51){var _0x37a184=function(_0x22db6f){while(--_0x22db6f){_0x4c8fc3['push'](_0x4c8fc3['shift']());}};_0x37a184(++_0x517a51);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xa9e0[_0x6131cd];return _0x47e916;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')],'get':function(_0x5dd881){return this['getDataValue'](_0x0a9e('0x3'));}},'field':{'type':Sequelize['STRING'],'allowNull':![]},'operator':{'type':Sequelize[_0x0a9e('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0x0a9e('0x4')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index ac53871..76ab1a3 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 _0xf431=['end','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','stack','name','body','find','params','catch','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status'];(function(_0xc2af53,_0x2c5084){var _0x2d3661=function(_0x247eca){while(--_0x247eca){_0xc2af53['push'](_0xc2af53['shift']());}};_0x2d3661(++_0x2c5084);}(_0xf431,0x93));var _0x1f43=function(_0x3f25c4,_0x7d5eb5){_0x3f25c4=_0x3f25c4-0x0;var _0x2b213d=_0xf431[_0x3f25c4];return _0x2b213d;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x1f43('0x0'));var rimraf=require(_0x1f43('0x1'));var zipdir=require(_0x1f43('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1f43('0x3'));var moment=require(_0x1f43('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x1f43('0x5'));var util=require(_0x1f43('0x6'));var path=require(_0x1f43('0x7'));var sox=require(_0x1f43('0x8'));var csv=require(_0x1f43('0x9'));var ejs=require(_0x1f43('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x1f43('0xb'));var jsforce=require(_0x1f43('0xc'));var deskjs=require(_0x1f43('0xd'));var toCsv=require(_0x1f43('0x9'));var querystring=require(_0x1f43('0xe'));var Papa=require('papaparse');var Redis=require(_0x1f43('0xf'));var authService=require(_0x1f43('0x10'));var qs=require(_0x1f43('0x11'));var as=require(_0x1f43('0x12'));var hardwareService=require(_0x1f43('0x13'));var logger=require(_0x1f43('0x14'))(_0x1f43('0x15'));var utils=require('../../config/utils');var config=require(_0x1f43('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4cbde4,_0x2f9b0d){_0x2f9b0d=_0x2f9b0d||0xcc;return function(_0xa25bbc){if(_0xa25bbc){return _0x4cbde4[_0x1f43('0x17')](_0x2f9b0d);}return _0x4cbde4[_0x1f43('0x18')](_0x2f9b0d)[_0x1f43('0x19')]();};}function respondWithResult(_0x3802c4,_0x94948d){_0x94948d=_0x94948d||0xc8;return function(_0xe5e0c1){if(_0xe5e0c1){return _0x3802c4['status'](_0x94948d)[_0x1f43('0x1a')](_0xe5e0c1);}};}function respondWithFilteredResult(_0x2b8622,_0x297672){return function(_0x1127f6){if(_0x1127f6){var _0x23a6f0=_0x1127f6[_0x1f43('0x1b')],_0x9d7d9b=_0x297672[_0x1f43('0x1c')],_0x1f13f1=_0x297672[_0x1f43('0x1c')]+_0x297672[_0x1f43('0x1d')],_0x349545;if(_0x1f13f1>=_0x23a6f0){_0x1f13f1=_0x23a6f0;_0x349545=0xc8;}else{_0x349545=0xce;}_0x2b8622[_0x1f43('0x18')](_0x349545);return _0x2b8622[_0x1f43('0x1e')](_0x1f43('0x1f'),_0x9d7d9b+'-'+_0x1f13f1+'/'+_0x23a6f0)[_0x1f43('0x1a')](_0x1127f6);}return null;};}function patchUpdates(_0x752acd){return function(_0x472cb9){try{jsonpatch[_0x1f43('0x20')](_0x472cb9,_0x752acd,!![]);}catch(_0xe4db32){return BPromise[_0x1f43('0x21')](_0xe4db32);}return _0x472cb9['save']();};}function saveUpdates(_0x5984ad,_0x1eced8){return function(_0x3e63c7){if(_0x3e63c7){return _0x3e63c7[_0x1f43('0x22')](_0x5984ad)[_0x1f43('0x23')](function(_0x5d2f52){return _0x5d2f52;});}return null;};}function removeEntity(_0x48795c,_0x3c457a){return function(_0x11fb59){if(_0x11fb59){return _0x11fb59[_0x1f43('0x24')]()[_0x1f43('0x23')](function(){_0x48795c[_0x1f43('0x18')](0xcc)[_0x1f43('0x19')]();});}};}function handleEntityNotFound(_0x2385d3,_0x634c3a){return function(_0x4fdd4a){if(!_0x4fdd4a){_0x2385d3[_0x1f43('0x17')](0x194);}return _0x4fdd4a;};}function handleError(_0x5b7809,_0x554aa5){_0x554aa5=_0x554aa5||0x1f4;return function(_0x4efca7){logger['error'](_0x4efca7[_0x1f43('0x25')]);if(_0x4efca7[_0x1f43('0x26')]){delete _0x4efca7['name'];}_0x5b7809['status'](_0x554aa5)['send'](_0x4efca7);};}exports[_0x1f43('0x22')]=function(_0x50098f,_0x14f318){if(_0x50098f['body']['id']){delete _0x50098f[_0x1f43('0x27')]['id'];}return db['Condition'][_0x1f43('0x28')]({'where':{'id':_0x50098f[_0x1f43('0x29')]['id']}})[_0x1f43('0x23')](handleEntityNotFound(_0x14f318,null))[_0x1f43('0x23')](saveUpdates(_0x50098f['body'],null))[_0x1f43('0x23')](respondWithResult(_0x14f318,null))[_0x1f43('0x2a')](handleError(_0x14f318,null));};exports['destroy']=function(_0x46f1ca,_0x34655c){return db['Condition'][_0x1f43('0x28')]({'where':{'id':_0x46f1ca[_0x1f43('0x29')]['id']}})[_0x1f43('0x23')](handleEntityNotFound(_0x34655c,null))['then'](removeEntity(_0x34655c,null))[_0x1f43('0x2a')](handleError(_0x34655c,null));}; \ No newline at end of file +var _0x9d49=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','sendStatus','end','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','status','error','stack','name','body','find','params','catch','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','lodash','squel','crypto','jsforce','to-csv','querystring','ioredis'];(function(_0x4f2c3a,_0x6bde90){var _0x17d91c=function(_0xaaf630){while(--_0xaaf630){_0x4f2c3a['push'](_0x4f2c3a['shift']());}};_0x17d91c(++_0x6bde90);}(_0x9d49,0xcf));var _0x99d4=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x9d49[_0x321bb2];return _0x9c12ed;};'use strict';var pdf=require(_0x99d4('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x99d4('0x1'));var zipdir=require(_0x99d4('0x2'));var jsonpatch=require(_0x99d4('0x3'));var rp=require(_0x99d4('0x4'));var moment=require(_0x99d4('0x5'));var BPromise=require(_0x99d4('0x6'));var Mustache=require(_0x99d4('0x7'));var util=require(_0x99d4('0x8'));var path=require(_0x99d4('0x9'));var sox=require(_0x99d4('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x99d4('0xb'));var squel=require(_0x99d4('0xc'));var crypto=require(_0x99d4('0xd'));var jsforce=require(_0x99d4('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x99d4('0xf'));var querystring=require(_0x99d4('0x10'));var Papa=require('papaparse');var Redis=require(_0x99d4('0x11'));var authService=require(_0x99d4('0x12'));var qs=require(_0x99d4('0x13'));var as=require(_0x99d4('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x99d4('0x15'))('api');var utils=require(_0x99d4('0x16'));var config=require(_0x99d4('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4e2126,_0x2d8a5b){_0x2d8a5b=_0x2d8a5b||0xcc;return function(_0x54b212){if(_0x54b212){return _0x4e2126[_0x99d4('0x18')](_0x2d8a5b);}return _0x4e2126['status'](_0x2d8a5b)[_0x99d4('0x19')]();};}function respondWithResult(_0x46cb95,_0x177a89){_0x177a89=_0x177a89||0xc8;return function(_0x7824af){if(_0x7824af){return _0x46cb95['status'](_0x177a89)[_0x99d4('0x1a')](_0x7824af);}};}function respondWithFilteredResult(_0x238151,_0x5ea9e7){return function(_0x56a08c){if(_0x56a08c){var _0x1033ef=_0x56a08c[_0x99d4('0x1b')],_0x42b26e=_0x5ea9e7[_0x99d4('0x1c')],_0x17bccc=_0x5ea9e7[_0x99d4('0x1c')]+_0x5ea9e7[_0x99d4('0x1d')],_0x26a59f;if(_0x17bccc>=_0x1033ef){_0x17bccc=_0x1033ef;_0x26a59f=0xc8;}else{_0x26a59f=0xce;}_0x238151['status'](_0x26a59f);return _0x238151[_0x99d4('0x1e')](_0x99d4('0x1f'),_0x42b26e+'-'+_0x17bccc+'/'+_0x1033ef)[_0x99d4('0x1a')](_0x56a08c);}return null;};}function patchUpdates(_0x1d1578){return function(_0x55a47f){try{jsonpatch[_0x99d4('0x20')](_0x55a47f,_0x1d1578,!![]);}catch(_0x4d5d48){return BPromise['reject'](_0x4d5d48);}return _0x55a47f[_0x99d4('0x21')]();};}function saveUpdates(_0x325df5,_0x11ad1d){return function(_0x4865ca){if(_0x4865ca){return _0x4865ca[_0x99d4('0x22')](_0x325df5)[_0x99d4('0x23')](function(_0x72e55d){return _0x72e55d;});}return null;};}function removeEntity(_0x4e1be2,_0x4fc4b4){return function(_0x41370e){if(_0x41370e){return _0x41370e[_0x99d4('0x24')]()[_0x99d4('0x23')](function(){_0x4e1be2[_0x99d4('0x25')](0xcc)[_0x99d4('0x19')]();});}};}function handleEntityNotFound(_0x197315,_0x4ee8ab){return function(_0x3bce8a){if(!_0x3bce8a){_0x197315[_0x99d4('0x18')](0x194);}return _0x3bce8a;};}function handleError(_0x264403,_0x5e955d){_0x5e955d=_0x5e955d||0x1f4;return function(_0x54d0b5){logger[_0x99d4('0x26')](_0x54d0b5[_0x99d4('0x27')]);if(_0x54d0b5[_0x99d4('0x28')]){delete _0x54d0b5[_0x99d4('0x28')];}_0x264403[_0x99d4('0x25')](_0x5e955d)['send'](_0x54d0b5);};}exports[_0x99d4('0x22')]=function(_0x24c8aa,_0x2606a9){if(_0x24c8aa['body']['id']){delete _0x24c8aa[_0x99d4('0x29')]['id'];}return db['Condition'][_0x99d4('0x2a')]({'where':{'id':_0x24c8aa[_0x99d4('0x2b')]['id']}})[_0x99d4('0x23')](handleEntityNotFound(_0x2606a9,null))[_0x99d4('0x23')](saveUpdates(_0x24c8aa[_0x99d4('0x29')],null))['then'](respondWithResult(_0x2606a9,null))[_0x99d4('0x2c')](handleError(_0x2606a9,null));};exports[_0x99d4('0x24')]=function(_0x180d73,_0x40a879){return db['Condition'][_0x99d4('0x2a')]({'where':{'id':_0x180d73[_0x99d4('0x2b')]['id']}})[_0x99d4('0x23')](handleEntityNotFound(_0x40a879,null))[_0x99d4('0x23')](removeEntity(_0x40a879,null))['catch'](handleError(_0x40a879,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index 4924913..c35fdb7 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 _0x2461=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','Condition','tools_conditions'];(function(_0x572491,_0x82993d){var _0x5f13fb=function(_0x451304){while(--_0x451304){_0x572491['push'](_0x572491['shift']());}};_0x5f13fb(++_0x82993d);}(_0x2461,0x1d4));var _0x1246=function(_0x2e6718,_0x557dee){_0x2e6718=_0x2e6718-0x0;var _0x4d23fe=_0x2461[_0x2e6718];return _0x4d23fe;};'use strict';var _=require(_0x1246('0x0'));var util=require(_0x1246('0x1'));var logger=require(_0x1246('0x2'))('api');var moment=require(_0x1246('0x3'));var BPromise=require(_0x1246('0x4'));var rp=require(_0x1246('0x5'));var fs=require('fs');var path=require(_0x1246('0x6'));var rimraf=require(_0x1246('0x7'));var config=require(_0x1246('0x8'));var attributes=require('./condition.attributes');module[_0x1246('0x9')]=function(_0x25db03,_0x4738ef){return _0x25db03[_0x1246('0xa')](_0x1246('0xb'),attributes,{'tableName':_0x1246('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9ff9=['./condition.attributes','define','Condition','tools_conditions','lodash','util','../../config/logger','moment','rimraf','../../config/environment'];(function(_0x599fe9,_0x11f92f){var _0x49c33a=function(_0x29ac01){while(--_0x29ac01){_0x599fe9['push'](_0x599fe9['shift']());}};_0x49c33a(++_0x11f92f);}(_0x9ff9,0x9a));var _0x99ff=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0x9ff9[_0x47b58b];return _0x46bebe;};'use strict';var _=require(_0x99ff('0x0'));var util=require(_0x99ff('0x1'));var logger=require(_0x99ff('0x2'))('api');var moment=require(_0x99ff('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x99ff('0x4'));var config=require(_0x99ff('0x5'));var attributes=require(_0x99ff('0x6'));module['exports']=function(_0x161817,_0x23cee9){return _0x161817[_0x99ff('0x7')](_0x99ff('0x8'),attributes,{'tableName':_0x99ff('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 85228d6..18e8827 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 _0xe644=['Condition,\x20%s,\x20%s,\x20%s','stringify','error','code','Condition,\x20%s,\x20%s','message','catch','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0xe644,0x1bc));var _0x4e64=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe644[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x4e64('0x0'));var util=require(_0x4e64('0x1'));var moment=require('moment');var BPromise=require(_0x4e64('0x2'));var rs=require(_0x4e64('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x4e64('0x4'));var logger=require(_0x4e64('0x5'))(_0x4e64('0x6'));var config=require(_0x4e64('0x7'));var jayson=require(_0x4e64('0x8'));var client=jayson[_0x4e64('0x9')][_0x4e64('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x57458d,_0xb4bff4,_0xfc6a15){return new BPromise(function(_0x1ec6fd,_0x5004ca){return client[_0x4e64('0xb')](_0x57458d,_0xfc6a15)[_0x4e64('0xc')](function(_0x1078de){logger[_0x4e64('0xd')]('Condition,\x20%s,\x20%s',_0xb4bff4,_0x4e64('0xe'));logger[_0x4e64('0xf')](_0x4e64('0x10'),_0xb4bff4,_0x4e64('0xe'),JSON[_0x4e64('0x11')](_0x1078de));if(_0x1078de[_0x4e64('0x12')]){if(_0x1078de[_0x4e64('0x12')][_0x4e64('0x13')]===0x1f4){logger[_0x4e64('0x12')](_0x4e64('0x14'),_0xb4bff4,_0x1078de['error'][_0x4e64('0x15')]);return _0x5004ca(_0x1078de['error'][_0x4e64('0x15')]);}logger[_0x4e64('0x12')](_0x4e64('0x14'),_0xb4bff4,_0x1078de[_0x4e64('0x12')][_0x4e64('0x15')]);return _0x1ec6fd(_0x1078de['error'][_0x4e64('0x15')]);}else{logger[_0x4e64('0xd')](_0x4e64('0x14'),_0xb4bff4,_0x4e64('0xe'));_0x1ec6fd(_0x1078de['result']['message']);}})[_0x4e64('0x16')](function(_0x4e8ffa){logger[_0x4e64('0x12')](_0x4e64('0x14'),_0xb4bff4,_0x4e8ffa);_0x5004ca(_0x4e8ffa);});});} \ No newline at end of file +var _0xd297=['request\x20sent','error','code','Condition,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','debug','Condition,\x20%s,\x20%s,\x20%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd297,0x64));var _0x7d29=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd297[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x7d29('0x0'));var util=require(_0x7d29('0x1'));var moment=require(_0x7d29('0x2'));var BPromise=require(_0x7d29('0x3'));var rs=require(_0x7d29('0x4'));var fs=require('fs');var Redis=require(_0x7d29('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x7d29('0x6'));var logger=require(_0x7d29('0x7'))(_0x7d29('0x8'));var config=require(_0x7d29('0x9'));var jayson=require(_0x7d29('0xa'));var client=jayson[_0x7d29('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x27f1bb,_0xb0d266,_0x32292c){return new BPromise(function(_0x3c5c52,_0x455bf6){return client['request'](_0x27f1bb,_0x32292c)[_0x7d29('0xc')](function(_0x3afc17){logger['info']('Condition,\x20%s,\x20%s',_0xb0d266,'request\x20sent');logger[_0x7d29('0xd')](_0x7d29('0xe'),_0xb0d266,_0x7d29('0xf'),JSON['stringify'](_0x3afc17));if(_0x3afc17['error']){if(_0x3afc17[_0x7d29('0x10')][_0x7d29('0x11')]===0x1f4){logger['error'](_0x7d29('0x12'),_0xb0d266,_0x3afc17[_0x7d29('0x10')]['message']);return _0x455bf6(_0x3afc17[_0x7d29('0x10')]['message']);}logger['error'](_0x7d29('0x12'),_0xb0d266,_0x3afc17[_0x7d29('0x10')][_0x7d29('0x13')]);return _0x3c5c52(_0x3afc17['error'][_0x7d29('0x13')]);}else{logger[_0x7d29('0x14')](_0x7d29('0x12'),_0xb0d266,_0x7d29('0xf'));_0x3c5c52(_0x3afc17[_0x7d29('0x15')][_0x7d29('0x13')]);}})[_0x7d29('0x16')](function(_0x4c57f0){logger[_0x7d29('0x10')](_0x7d29('0x12'),_0xb0d266,_0x4c57f0);_0x455bf6(_0x4c57f0);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 712dac2..33d1ba3 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 _0x0432=['connect-timeout','express','Router','../../config/environment','put','/:id','isAuthenticated','update','delete','destroy','exports','multer','util','path'];(function(_0x4fbd1b,_0x27d578){var _0x447ae7=function(_0x4061e7){while(--_0x4061e7){_0x4fbd1b['push'](_0x4fbd1b['shift']());}};_0x447ae7(++_0x27d578);}(_0x0432,0x115));var _0x2043=function(_0xd891f2,_0x3da9d6){_0xd891f2=_0xd891f2-0x0;var _0x1cc04c=_0x0432[_0xd891f2];return _0x1cc04c;};'use strict';var multer=require(_0x2043('0x0'));var util=require(_0x2043('0x1'));var path=require(_0x2043('0x2'));var timeout=require(_0x2043('0x3'));var express=require(_0x2043('0x4'));var router=express[_0x2043('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x2043('0x6'));var controller=require('./condition.controller');router[_0x2043('0x7')](_0x2043('0x8'),auth[_0x2043('0x9')](),controller[_0x2043('0xa')]);router[_0x2043('0xb')](_0x2043('0x8'),auth['isAuthenticated'](),controller[_0x2043('0xc')]);module[_0x2043('0xd')]=router; \ No newline at end of file +var _0xba03=['/:id','isAuthenticated','update','delete','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./condition.controller','put'];(function(_0x451c16,_0x34d8e8){var _0x1bb089=function(_0x26eabf){while(--_0x26eabf){_0x451c16['push'](_0x451c16['shift']());}};_0x1bb089(++_0x34d8e8);}(_0xba03,0xb9));var _0x3ba0=function(_0x5884b0,_0x408b59){_0x5884b0=_0x5884b0-0x0;var _0xe9d04f=_0xba03[_0x5884b0];return _0xe9d04f;};'use strict';var multer=require(_0x3ba0('0x0'));var util=require(_0x3ba0('0x1'));var path=require(_0x3ba0('0x2'));var timeout=require(_0x3ba0('0x3'));var express=require('express');var router=express[_0x3ba0('0x4')]();var auth=require(_0x3ba0('0x5'));var interaction=require(_0x3ba0('0x6'));var config=require(_0x3ba0('0x7'));var controller=require(_0x3ba0('0x8'));router[_0x3ba0('0x9')](_0x3ba0('0xa'),auth[_0x3ba0('0xb')](),controller[_0x3ba0('0xc')]);router[_0x3ba0('0xd')](_0x3ba0('0xa'),auth[_0x3ba0('0xb')](),controller['destroy']);module[_0x3ba0('0xe')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index 25f3d62..67f5a58 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 _0x7118=['name','STRING'];(function(_0x4babf5,_0xb700ad){var _0x253c7d=function(_0x487774){while(--_0x487774){_0x4babf5['push'](_0x4babf5['shift']());}};_0x253c7d(++_0xb700ad);}(_0x7118,0x159));var _0x8711=function(_0x4f535b,_0x372a4a){_0x4f535b=_0x4f535b-0x0;var _0x248eb8=_0x7118[_0x4f535b];return _0x248eb8;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x8711('0x0')],'allowNull':![],'unique':_0x8711('0x1')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x7676=['STRING','sequelize','exports'];(function(_0x7a7a6d,_0x3f1584){var _0xb90800=function(_0x3fba48){while(--_0x3fba48){_0x7a7a6d['push'](_0x7a7a6d['shift']());}};_0xb90800(++_0x3f1584);}(_0x7676,0xb8));var _0x6767=function(_0x4f82ed,_0x2dd4ed){_0x4f82ed=_0x4f82ed-0x0;var _0x2b093f=_0x7676[_0x4f82ed];return _0x2b093f;};'use strict';var Sequelize=require(_0x6767('0x0'));module[_0x6767('0x1')]={'name':{'type':Sequelize[_0x6767('0x2')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0x6767('0x2')]}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index 60d8c30..ad1776f 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 _0xafa8=['length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','map','includeAll','include','findAll','rows','catch','show','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','options','omit','createdAt','updatedAt','CustomDashboards','UserProfileSection','userProfileId','params','iframe','attrUrl','attrs','value','https://','custom','attrPath','attrHourFormat','attrTimezone','attrFontSize','counter','attrMetric','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardId','DashboardItem','getItems','findOne','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','end','json','count','offset','status','set','Content-Range','save','update','then','destroy','error','stack','name','send','Dashboard','rawAttributes','fieldName','type','key','model','filters','intersection','query','attributes','fields'];(function(_0x50b6d9,_0x1c24ac){var _0x4d956c=function(_0x48058e){while(--_0x48058e){_0x50b6d9['push'](_0x50b6d9['shift']());}};_0x4d956c(++_0x1c24ac);}(_0xafa8,0x135));var _0x8afa=function(_0x4b4277,_0x22676f){_0x4b4277=_0x4b4277-0x0;var _0x1ff405=_0xafa8[_0x4b4277];return _0x1ff405;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x8afa('0x0'));var rimraf=require(_0x8afa('0x1'));var zipdir=require(_0x8afa('0x2'));var jsonpatch=require(_0x8afa('0x3'));var rp=require(_0x8afa('0x4'));var moment=require(_0x8afa('0x5'));var BPromise=require(_0x8afa('0x6'));var Mustache=require('mustache');var util=require(_0x8afa('0x7'));var path=require('path');var sox=require(_0x8afa('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x8afa('0x9'));var squel=require(_0x8afa('0xa'));var crypto=require(_0x8afa('0xb'));var jsforce=require(_0x8afa('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x8afa('0xd'));var querystring=require(_0x8afa('0xe'));var Papa=require(_0x8afa('0xf'));var Redis=require(_0x8afa('0x10'));var authService=require(_0x8afa('0x11'));var qs=require(_0x8afa('0x12'));var as=require(_0x8afa('0x13'));var hardwareService=require(_0x8afa('0x14'));var logger=require(_0x8afa('0x15'))('api');var utils=require(_0x8afa('0x16'));var config=require(_0x8afa('0x17'));var db=require(_0x8afa('0x18'))['db'];config[_0x8afa('0x19')]=_[_0x8afa('0x1a')](config[_0x8afa('0x19')],{'host':_0x8afa('0x1b'),'port':0x18eb});var socket=require(_0x8afa('0x1c'))(new Redis(config[_0x8afa('0x19')]));require('./dashboard.socket')[_0x8afa('0x1d')](socket);function respondWithStatusCode(_0x522ec9,_0xc468a0){_0xc468a0=_0xc468a0||0xcc;return function(_0x39a113){if(_0x39a113){return _0x522ec9[_0x8afa('0x1e')](_0xc468a0);}return _0x522ec9['status'](_0xc468a0)[_0x8afa('0x1f')]();};}function respondWithResult(_0xf79f1d,_0x3916ce){_0x3916ce=_0x3916ce||0xc8;return function(_0x89bdf6){if(_0x89bdf6){return _0xf79f1d['status'](_0x3916ce)[_0x8afa('0x20')](_0x89bdf6);}};}function respondWithFilteredResult(_0x671b0c,_0x1d157f){return function(_0x4a92c9){if(_0x4a92c9){var _0x23f03b=_0x4a92c9[_0x8afa('0x21')],_0x429292=_0x1d157f[_0x8afa('0x22')],_0xd580cb=_0x1d157f[_0x8afa('0x22')]+_0x1d157f['limit'],_0x1931b7;if(_0xd580cb>=_0x23f03b){_0xd580cb=_0x23f03b;_0x1931b7=0xc8;}else{_0x1931b7=0xce;}_0x671b0c[_0x8afa('0x23')](_0x1931b7);return _0x671b0c[_0x8afa('0x24')](_0x8afa('0x25'),_0x429292+'-'+_0xd580cb+'/'+_0x23f03b)[_0x8afa('0x20')](_0x4a92c9);}return null;};}function patchUpdates(_0x2ae60e){return function(_0x51cbcc){try{jsonpatch['apply'](_0x51cbcc,_0x2ae60e,!![]);}catch(_0x231631){return BPromise['reject'](_0x231631);}return _0x51cbcc[_0x8afa('0x26')]();};}function saveUpdates(_0x1cee0c,_0x48b080){return function(_0x1f0fac){if(_0x1f0fac){return _0x1f0fac[_0x8afa('0x27')](_0x1cee0c)[_0x8afa('0x28')](function(_0x302013){return _0x302013;});}return null;};}function removeEntity(_0x47896f,_0x3b7cf2){return function(_0x5c7c5c){if(_0x5c7c5c){return _0x5c7c5c[_0x8afa('0x29')]()[_0x8afa('0x28')](function(){var _0x1c48fa=_0x5c7c5c['get']({'plain':!![]});var _0xdde12='CustomDashboards';return db['UserProfileResource'][_0x8afa('0x29')]({'where':{'type':_0xdde12,'resourceId':_0x1c48fa['id']}})['then'](function(){return _0x5c7c5c;});})[_0x8afa('0x28')](function(){_0x47896f[_0x8afa('0x23')](0xcc)[_0x8afa('0x1f')]();});}};}function handleEntityNotFound(_0x4dcefc,_0x36462a){return function(_0x1adb0e){if(!_0x1adb0e){_0x4dcefc[_0x8afa('0x1e')](0x194);}return _0x1adb0e;};}function handleError(_0x2fd9f4,_0x2be75b){_0x2be75b=_0x2be75b||0x1f4;return function(_0x47c833){logger[_0x8afa('0x2a')](_0x47c833[_0x8afa('0x2b')]);if(_0x47c833[_0x8afa('0x2c')]){delete _0x47c833['name'];}_0x2fd9f4[_0x8afa('0x23')](_0x2be75b)[_0x8afa('0x2d')](_0x47c833);};}exports['index']=function(_0x5f199d,_0x37b359){var _0x4f6297={},_0x26a1e9={},_0x2155f7={'count':0x0,'rows':[]};var _0x3e0cc7=_['map'](db[_0x8afa('0x2e')][_0x8afa('0x2f')],function(_0x5e7a6b){return{'name':_0x5e7a6b[_0x8afa('0x30')],'type':_0x5e7a6b[_0x8afa('0x31')][_0x8afa('0x32')]};});_0x26a1e9[_0x8afa('0x33')]=_['map'](_0x3e0cc7,_0x8afa('0x2c'));_0x26a1e9['query']=_['keys'](_0x5f199d['query']);_0x26a1e9[_0x8afa('0x34')]=_[_0x8afa('0x35')](_0x26a1e9['model'],_0x26a1e9[_0x8afa('0x36')]);_0x4f6297[_0x8afa('0x37')]=_[_0x8afa('0x35')](_0x26a1e9['model'],qs['fields'](_0x5f199d['query'][_0x8afa('0x38')]));_0x4f6297[_0x8afa('0x37')]=_0x4f6297[_0x8afa('0x37')][_0x8afa('0x39')]?_0x4f6297['attributes']:_0x26a1e9['model'];if(!_0x5f199d['query'][_0x8afa('0x3a')](_0x8afa('0x3b'))){_0x4f6297[_0x8afa('0x3c')]=qs['limit'](_0x5f199d[_0x8afa('0x36')]['limit']);_0x4f6297[_0x8afa('0x22')]=qs[_0x8afa('0x22')](_0x5f199d[_0x8afa('0x36')][_0x8afa('0x22')]);}_0x4f6297[_0x8afa('0x3d')]=qs[_0x8afa('0x3e')](_0x5f199d[_0x8afa('0x36')]['sort']);_0x4f6297[_0x8afa('0x3f')]=qs[_0x8afa('0x34')](_[_0x8afa('0x40')](_0x5f199d[_0x8afa('0x36')],_0x26a1e9[_0x8afa('0x34')]));if(_0x5f199d[_0x8afa('0x36')][_0x8afa('0x41')]){_0x4f6297[_0x8afa('0x3f')]=_[_0x8afa('0x42')](_0x4f6297[_0x8afa('0x3f')],{'$or':_[_0x8afa('0x43')](_0x3e0cc7,function(_0x5c9b2e){if(_0x5c9b2e[_0x8afa('0x31')]!=='VIRTUAL'){var _0x1b3f1b={};_0x1b3f1b[_0x5c9b2e['name']]={'$like':'%'+_0x5f199d[_0x8afa('0x36')]['filter']+'%'};return _0x1b3f1b;}})});}_0x4f6297=_[_0x8afa('0x42')]({},_0x4f6297,_0x5f199d['options']);var _0x540375={'where':_0x4f6297[_0x8afa('0x3f')]};return db[_0x8afa('0x2e')][_0x8afa('0x21')](_0x540375)[_0x8afa('0x28')](function(_0x30287d){_0x2155f7[_0x8afa('0x21')]=_0x30287d;if(_0x5f199d[_0x8afa('0x36')][_0x8afa('0x44')]){_0x4f6297[_0x8afa('0x45')]=[{'all':!![]}];}return db[_0x8afa('0x2e')][_0x8afa('0x46')](_0x4f6297);})[_0x8afa('0x28')](function(_0x67efdb){_0x2155f7[_0x8afa('0x47')]=_0x67efdb;return _0x2155f7;})['then'](respondWithFilteredResult(_0x37b359,_0x4f6297))[_0x8afa('0x48')](handleError(_0x37b359,null));};exports[_0x8afa('0x49')]=function(_0x10e538,_0x2f81ad){var _0x3ca243={'raw':![],'where':{'id':_0x10e538['params']['id']}},_0x585381={};_0x585381[_0x8afa('0x33')]=_[_0x8afa('0x4a')](db[_0x8afa('0x2e')][_0x8afa('0x2f')]);_0x585381[_0x8afa('0x36')]=_['keys'](_0x10e538[_0x8afa('0x36')]);_0x585381[_0x8afa('0x34')]=_[_0x8afa('0x35')](_0x585381[_0x8afa('0x33')],_0x585381[_0x8afa('0x36')]);_0x3ca243[_0x8afa('0x37')]=_[_0x8afa('0x35')](_0x585381[_0x8afa('0x33')],qs[_0x8afa('0x38')](_0x10e538[_0x8afa('0x36')][_0x8afa('0x38')]));_0x3ca243[_0x8afa('0x37')]=_0x3ca243[_0x8afa('0x37')]['length']?_0x3ca243[_0x8afa('0x37')]:_0x585381[_0x8afa('0x33')];if(_0x10e538['query'][_0x8afa('0x44')]){_0x3ca243[_0x8afa('0x45')]=[{'all':!![]}];}_0x3ca243=_['merge']({},_0x3ca243,_0x10e538['options']);return db[_0x8afa('0x2e')][_0x8afa('0x4b')](_0x3ca243)[_0x8afa('0x28')](handleEntityNotFound(_0x2f81ad,null))[_0x8afa('0x28')](respondWithResult(_0x2f81ad,null))['catch'](handleError(_0x2f81ad,null));};exports['create']=function(_0x10afc0,_0x4bf8c2){return db['Dashboard'][_0x8afa('0x4c')](_0x10afc0[_0x8afa('0x4d')],{})[_0x8afa('0x28')](function(_0x541020){var _0x349461=_0x10afc0[_0x8afa('0x4e')]['get']({'plain':!![]});if(!_0x349461)throw new Error(_0x8afa('0x4f'));if(_0x349461[_0x8afa('0x50')]===_0x8afa('0x4e')){var _0xa3d4bb=_0x541020[_0x8afa('0x51')]({'plain':!![]});var _0x965e17='CustomDashboards';return db['UserProfileSection'][_0x8afa('0x4b')]({'where':{'name':_0x965e17,'userProfileId':_0x349461['userProfileId']},'raw':!![]})[_0x8afa('0x28')](function(_0x45a14a){if(_0x45a14a&&_0x45a14a[_0x8afa('0x52')]===0x0){return db[_0x8afa('0x53')][_0x8afa('0x4c')]({'name':_0xa3d4bb[_0x8afa('0x2c')],'resourceId':_0xa3d4bb['id'],'type':_0x45a14a[_0x8afa('0x2c')],'sectionId':_0x45a14a['id']},{})[_0x8afa('0x28')](function(){return _0x541020;});}else{return _0x541020;}})[_0x8afa('0x48')](function(_0x135736){logger[_0x8afa('0x2a')](_0x8afa('0x54'),_0x135736);throw _0x135736;});}return _0x541020;})[_0x8afa('0x28')](respondWithResult(_0x4bf8c2,0xc9))[_0x8afa('0x48')](handleError(_0x4bf8c2,null));};exports[_0x8afa('0x55')]=function(_0x3b5ee4,_0x24c5af){var _0x167dfb={'where':{'id':_0x3b5ee4['params']['id']}},_0x4b0efd={};_0x4b0efd[_0x8afa('0x33')]=_['keys'](db[_0x8afa('0x2e')][_0x8afa('0x2f')]);_0x167dfb[_0x8afa('0x37')]=_['intersection'](_0x4b0efd['model'],qs[_0x8afa('0x38')](_0x3b5ee4[_0x8afa('0x36')][_0x8afa('0x38')]));_0x167dfb[_0x8afa('0x37')]=_0x167dfb[_0x8afa('0x37')][_0x8afa('0x39')]?_0x167dfb[_0x8afa('0x37')]:_0x4b0efd[_0x8afa('0x33')];if(_0x3b5ee4[_0x8afa('0x36')][_0x8afa('0x44')]){_0x167dfb['include']=[{'all':!![]}];}_0x167dfb=_[_0x8afa('0x42')]({},_0x167dfb,_0x3b5ee4[_0x8afa('0x56')]);return db[_0x8afa('0x2e')][_0x8afa('0x4b')](_0x167dfb)[_0x8afa('0x28')](handleEntityNotFound(_0x24c5af,null))[_0x8afa('0x28')](function(_0x21127f){if(_0x21127f){var _0x2e113e=_0x21127f['get']({'plain':!![]});_0x2e113e=qs[_0x8afa('0x57')](_0x2e113e,['id',_0x8afa('0x58'),_0x8afa('0x59')]);_0x3b5ee4[_0x8afa('0x4d')]=_[_0x8afa('0x57')](_0x3b5ee4[_0x8afa('0x4d')],['id',_0x8afa('0x58'),_0x8afa('0x59')]);return db['Dashboard'][_0x8afa('0x4c')](_[_0x8afa('0x42')](_0x2e113e,_0x3b5ee4[_0x8afa('0x4d')]),{'include':_0x3b5ee4[_0x8afa('0x36')][_0x8afa('0x44')]?[{'all':!![]}]:undefined})['then'](function(_0x544ffa){var _0x50cc1a=_0x3b5ee4[_0x8afa('0x4e')][_0x8afa('0x51')]({'plain':!![]});if(!_0x50cc1a)throw new Error(_0x8afa('0x4f'));if(_0x50cc1a[_0x8afa('0x50')]==='user'){var _0x4ade29=_0x544ffa[_0x8afa('0x51')]({'plain':!![]});var _0x349682=_0x8afa('0x5a');return db[_0x8afa('0x5b')][_0x8afa('0x4b')]({'where':{'name':_0x349682,'userProfileId':_0x50cc1a[_0x8afa('0x5c')]},'raw':!![]})[_0x8afa('0x28')](function(_0x39c55f){if(_0x39c55f&&_0x39c55f[_0x8afa('0x52')]===0x0){return db[_0x8afa('0x53')]['create']({'name':_0x4ade29[_0x8afa('0x2c')],'resourceId':_0x4ade29['id'],'type':_0x39c55f[_0x8afa('0x2c')],'sectionId':_0x39c55f['id']},{})[_0x8afa('0x28')](function(){return _0x544ffa;});}else{return _0x544ffa;}})[_0x8afa('0x48')](function(_0xc9c312){logger['error'](_0x8afa('0x54'),_0xc9c312);throw _0xc9c312;});}return _0x544ffa;});}})[_0x8afa('0x28')](respondWithResult(_0x24c5af,0xc9))[_0x8afa('0x48')](handleError(_0x24c5af,null));};exports[_0x8afa('0x27')]=function(_0x1cc0f3,_0xecd37a){if(_0x1cc0f3[_0x8afa('0x4d')]['id']){delete _0x1cc0f3[_0x8afa('0x4d')]['id'];}return db['Dashboard'][_0x8afa('0x4b')]({'where':{'id':_0x1cc0f3[_0x8afa('0x5d')]['id']}})[_0x8afa('0x28')](handleEntityNotFound(_0xecd37a,null))[_0x8afa('0x28')](saveUpdates(_0x1cc0f3[_0x8afa('0x4d')],null))[_0x8afa('0x28')](respondWithResult(_0xecd37a,null))[_0x8afa('0x48')](handleError(_0xecd37a,null));};exports[_0x8afa('0x29')]=function(_0x4c4a30,_0x36d246){return db[_0x8afa('0x2e')][_0x8afa('0x4b')]({'where':{'id':_0x4c4a30[_0x8afa('0x5d')]['id']}})[_0x8afa('0x28')](handleEntityNotFound(_0x36d246,null))['then'](removeEntity(_0x36d246,null))['catch'](handleError(_0x36d246,null));};function widgetAttributes(_0x5094c7){try{switch(_0x5094c7[_0x8afa('0x31')]){case _0x8afa('0x5e'):return[{'name':_0x8afa('0x5f'),'value':_0x5094c7[_0x8afa('0x5f')]||(_0x5094c7['attrs']&&_0x5094c7[_0x8afa('0x60')][0x0]?_0x5094c7[_0x8afa('0x60')][0x0][_0x8afa('0x61')]:undefined)||_0x8afa('0x62')}];case _0x8afa('0x63'):return[{'name':_0x8afa('0x64'),'value':_0x5094c7[_0x8afa('0x64')]||(_0x5094c7[_0x8afa('0x60')]&&_0x5094c7[_0x8afa('0x60')][0x0]?_0x5094c7[_0x8afa('0x60')][0x0][_0x8afa('0x61')]:undefined)||''}];case'clock':return[{'name':'attrHourFormat','value':_0x5094c7[_0x8afa('0x65')]||(_0x5094c7[_0x8afa('0x60')]&&_0x5094c7[_0x8afa('0x60')][0x0]?_0x5094c7['attrs'][0x0][_0x8afa('0x61')]:undefined)||'HH:mm:ss'},{'name':_0x8afa('0x66'),'value':_0x5094c7['attrTimezone']||(_0x5094c7[_0x8afa('0x60')]&&_0x5094c7[_0x8afa('0x60')][0x1]?_0x5094c7[_0x8afa('0x60')][0x1][_0x8afa('0x61')]:undefined)||'0.00'},{'name':_0x8afa('0x67'),'value':_0x5094c7[_0x8afa('0x67')]||(_0x5094c7['attrs']&&_0x5094c7[_0x8afa('0x60')][0x2]?_0x5094c7[_0x8afa('0x60')][0x2][_0x8afa('0x61')]:undefined)||0xc}];case _0x8afa('0x68'):return[{'name':_0x8afa('0x69'),'value':_0x5094c7[_0x8afa('0x69')]||(_0x5094c7[_0x8afa('0x60')]&&_0x5094c7[_0x8afa('0x60')][0x0]?_0x5094c7['attrs'][0x0][_0x8afa('0x61')]:undefined)||'total'},{'name':'attrVoiceQueues','value':_0x5094c7[_0x8afa('0x6a')]||(_0x5094c7[_0x8afa('0x60')]&&_0x5094c7[_0x8afa('0x60')][0x1]?_0x5094c7[_0x8afa('0x60')][0x1][_0x8afa('0x61')]:undefined)||[]},{'name':_0x8afa('0x67'),'value':_0x5094c7[_0x8afa('0x67')]||(_0x5094c7[_0x8afa('0x60')]&&_0x5094c7['attrs'][0x2]?_0x5094c7[_0x8afa('0x60')][0x2][_0x8afa('0x61')]:undefined)||0x14}];case _0x8afa('0x6b'):case _0x8afa('0x6c'):return[{'name':_0x8afa('0x6d'),'value':_0x5094c7[_0x8afa('0x6d')]||(_0x5094c7[_0x8afa('0x60')]&&_0x5094c7[_0x8afa('0x60')][0x0]?_0x5094c7[_0x8afa('0x60')][0x0][_0x8afa('0x61')]:undefined)||'total'},{'name':_0x8afa('0x6e'),'value':_0x5094c7[_0x8afa('0x6e')]||(_0x5094c7[_0x8afa('0x60')]&&_0x5094c7[_0x8afa('0x60')][0x1]?_0x5094c7[_0x8afa('0x60')][0x1][_0x8afa('0x61')]:undefined)||null},{'name':_0x8afa('0x6f'),'value':_0x5094c7[_0x8afa('0x6f')]||(_0x5094c7[_0x8afa('0x60')]&&_0x5094c7['attrs'][0x2]?_0x5094c7[_0x8afa('0x60')][0x2]['value']:undefined)||null},{'name':_0x8afa('0x6a'),'value':_0x5094c7[_0x8afa('0x6a')]||(_0x5094c7[_0x8afa('0x60')]&&_0x5094c7[_0x8afa('0x60')][0x3]?_0x5094c7[_0x8afa('0x60')][0x3][_0x8afa('0x61')]:undefined)||[]}];case _0x8afa('0x70'):return[{'name':'attrReport','type':_0x5094c7['reportType']||(_0x5094c7['attrs']&&_0x5094c7[_0x8afa('0x60')][0x0]?_0x5094c7[_0x8afa('0x60')][0x0][_0x8afa('0x31')]:undefined)||null,'value':_0x5094c7[_0x8afa('0x71')]||(_0x5094c7[_0x8afa('0x60')]&&_0x5094c7[_0x8afa('0x60')][0x0]?_0x5094c7[_0x8afa('0x60')][0x0][_0x8afa('0x61')]:undefined)||null},{'name':_0x8afa('0x72'),'value':_0x5094c7['attrRefresh']||(_0x5094c7[_0x8afa('0x60')]&&_0x5094c7[_0x8afa('0x60')][0x1]?_0x5094c7[_0x8afa('0x60')][0x1][_0x8afa('0x61')]:undefined)||0x0}];default:return[];}}catch(_0x37a9ea){logger[_0x8afa('0x2a')](_0x8afa('0x73'),JSON[_0x8afa('0x74')](_0x37a9ea));return[];}}exports[_0x8afa('0x75')]=function(_0x4aeead,_0x2798b1,_0x5be293){if(_0x4aeead[_0x8afa('0x4d')]['id']){delete _0x4aeead[_0x8afa('0x4d')]['id'];}return db['Dashboard']['find']({'where':{'id':_0x4aeead[_0x8afa('0x5d')]['id']}})[_0x8afa('0x28')](handleEntityNotFound(_0x2798b1,null))[_0x8afa('0x28')](function(_0x3a1786){if(_0x3a1786){_0x4aeead[_0x8afa('0x4d')][_0x8afa('0x76')]=_0x3a1786['id'];_0x4aeead[_0x8afa('0x4d')]['attrs']=widgetAttributes(_0x4aeead[_0x8afa('0x4d')]);return db[_0x8afa('0x77')][_0x8afa('0x4c')](_0x4aeead[_0x8afa('0x4d')]);}})[_0x8afa('0x28')](respondWithResult(_0x2798b1,null))[_0x8afa('0x48')](handleError(_0x2798b1,null));};exports[_0x8afa('0x78')]=function(_0x21b124,_0x266302,_0xffe008){var _0x1579b7={};var _0x2661e9={};var _0x414769;var _0x5ab7b9;return db[_0x8afa('0x2e')][_0x8afa('0x79')]({'where':{'id':_0x21b124[_0x8afa('0x5d')]['id']}})[_0x8afa('0x28')](handleEntityNotFound(_0x266302,null))[_0x8afa('0x28')](function(_0x3bfdd6){if(_0x3bfdd6){_0x414769=_0x3bfdd6;_0x2661e9['model']=_[_0x8afa('0x4a')](db[_0x8afa('0x77')]['rawAttributes']);_0x2661e9['query']=_[_0x8afa('0x4a')](_0x21b124[_0x8afa('0x36')]);_0x2661e9['filters']=_[_0x8afa('0x35')](_0x2661e9[_0x8afa('0x33')],_0x2661e9[_0x8afa('0x36')]);_0x1579b7[_0x8afa('0x37')]=_[_0x8afa('0x35')](_0x2661e9[_0x8afa('0x33')],qs[_0x8afa('0x38')](_0x21b124[_0x8afa('0x36')][_0x8afa('0x38')]));_0x1579b7['attributes']=_0x1579b7[_0x8afa('0x37')][_0x8afa('0x39')]?_0x1579b7[_0x8afa('0x37')]:_0x2661e9[_0x8afa('0x33')];_0x1579b7[_0x8afa('0x3d')]=qs['sort'](_0x21b124[_0x8afa('0x36')][_0x8afa('0x3e')]);_0x1579b7[_0x8afa('0x3f')]=qs[_0x8afa('0x34')](_[_0x8afa('0x40')](_0x21b124[_0x8afa('0x36')],_0x2661e9[_0x8afa('0x34')]));if(_0x21b124['query'][_0x8afa('0x41')]){_0x1579b7[_0x8afa('0x3f')]=_[_0x8afa('0x42')](_0x1579b7[_0x8afa('0x3f')],{'$or':_[_0x8afa('0x43')](_0x1579b7[_0x8afa('0x37')],function(_0x79358){var _0x16eb12={};_0x16eb12[_0x79358]={'$like':'%'+_0x21b124['query'][_0x8afa('0x41')]+'%'};return _0x16eb12;})});}_0x1579b7=_[_0x8afa('0x42')]({},_0x1579b7,_0x21b124[_0x8afa('0x56')]);return _0x414769[_0x8afa('0x78')](_0x1579b7);}})[_0x8afa('0x28')](function(_0x257a4c){if(_0x257a4c){_0x5ab7b9=_0x257a4c[_0x8afa('0x39')];if(!_0x21b124[_0x8afa('0x36')][_0x8afa('0x3a')]('nolimit')){_0x1579b7[_0x8afa('0x3c')]=qs[_0x8afa('0x3c')](_0x21b124[_0x8afa('0x36')][_0x8afa('0x3c')]);_0x1579b7[_0x8afa('0x22')]=qs[_0x8afa('0x22')](_0x21b124['query'][_0x8afa('0x22')]);}return _0x414769[_0x8afa('0x78')](_0x1579b7);}})[_0x8afa('0x28')](function(_0x35b651){if(_0x35b651){return _0x35b651?{'count':_0x5ab7b9,'rows':_0x35b651}:null;}})[_0x8afa('0x28')](respondWithResult(_0x266302,null))[_0x8afa('0x48')](handleError(_0x266302,null));}; \ No newline at end of file +var _0x028d=['findOne','sort','pick','filter','nolimit','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','socket.io-emitter','./dashboard.socket','register','sendStatus','status','end','offset','limit','set','Content-Range','json','reject','save','update','then','get','CustomDashboards','UserProfileResource','destroy','error','stack','name','send','index','map','Dashboard','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','hasOwnProperty','order','where','merge','options','count','includeAll','include','findAll','rows','catch','show','keys','length','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','clone','omit','createdAt','updatedAt','UserProfileSection','params','attrUrl','attrs','custom','attrPath','value','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','DashboardId','DashboardItem','getItems'];(function(_0xc3ba31,_0x34c038){var _0x207709=function(_0x4cb9cb){while(--_0x4cb9cb){_0xc3ba31['push'](_0xc3ba31['shift']());}};_0x207709(++_0x34c038);}(_0x028d,0xff));var _0xd028=function(_0x5961a4,_0x142bea){_0x5961a4=_0x5961a4-0x0;var _0x100e13=_0x028d[_0x5961a4];return _0x100e13;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xd028('0x0'));var rimraf=require(_0xd028('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd028('0x2'));var rp=require(_0xd028('0x3'));var moment=require(_0xd028('0x4'));var BPromise=require(_0xd028('0x5'));var Mustache=require(_0xd028('0x6'));var util=require(_0xd028('0x7'));var path=require('path');var sox=require(_0xd028('0x8'));var csv=require(_0xd028('0x9'));var ejs=require(_0xd028('0xa'));var fs=require('fs');var _=require(_0xd028('0xb'));var squel=require(_0xd028('0xc'));var crypto=require(_0xd028('0xd'));var jsforce=require(_0xd028('0xe'));var deskjs=require(_0xd028('0xf'));var toCsv=require(_0xd028('0x9'));var querystring=require(_0xd028('0x10'));var Papa=require(_0xd028('0x11'));var Redis=require(_0xd028('0x12'));var authService=require(_0xd028('0x13'));var qs=require(_0xd028('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd028('0x15'));var logger=require(_0xd028('0x16'))(_0xd028('0x17'));var utils=require(_0xd028('0x18'));var config=require(_0xd028('0x19'));var db=require(_0xd028('0x1a'))['db'];config['redis']=_[_0xd028('0x1b')](config[_0xd028('0x1c')],{'host':'localhost','port':0x18eb});var socket=require(_0xd028('0x1d'))(new Redis(config[_0xd028('0x1c')]));require(_0xd028('0x1e'))[_0xd028('0x1f')](socket);function respondWithStatusCode(_0x1667bf,_0x5ec067){_0x5ec067=_0x5ec067||0xcc;return function(_0x29f34a){if(_0x29f34a){return _0x1667bf[_0xd028('0x20')](_0x5ec067);}return _0x1667bf[_0xd028('0x21')](_0x5ec067)[_0xd028('0x22')]();};}function respondWithResult(_0x12450d,_0x463d38){_0x463d38=_0x463d38||0xc8;return function(_0x4834d4){if(_0x4834d4){return _0x12450d[_0xd028('0x21')](_0x463d38)['json'](_0x4834d4);}};}function respondWithFilteredResult(_0x262514,_0x2f4af6){return function(_0x293be7){if(_0x293be7){var _0x4df54f=_0x293be7['count'],_0x3e846e=_0x2f4af6[_0xd028('0x23')],_0x5a47a6=_0x2f4af6[_0xd028('0x23')]+_0x2f4af6[_0xd028('0x24')],_0x285bf8;if(_0x5a47a6>=_0x4df54f){_0x5a47a6=_0x4df54f;_0x285bf8=0xc8;}else{_0x285bf8=0xce;}_0x262514['status'](_0x285bf8);return _0x262514[_0xd028('0x25')](_0xd028('0x26'),_0x3e846e+'-'+_0x5a47a6+'/'+_0x4df54f)[_0xd028('0x27')](_0x293be7);}return null;};}function patchUpdates(_0x1648a7){return function(_0x58515e){try{jsonpatch['apply'](_0x58515e,_0x1648a7,!![]);}catch(_0x14baaa){return BPromise[_0xd028('0x28')](_0x14baaa);}return _0x58515e[_0xd028('0x29')]();};}function saveUpdates(_0x75657f,_0x3203f9){return function(_0x2f33c3){if(_0x2f33c3){return _0x2f33c3[_0xd028('0x2a')](_0x75657f)['then'](function(_0x115fef){return _0x115fef;});}return null;};}function removeEntity(_0x10d629,_0x13e5f4){return function(_0x1ec134){if(_0x1ec134){return _0x1ec134['destroy']()[_0xd028('0x2b')](function(){var _0x1de0cc=_0x1ec134[_0xd028('0x2c')]({'plain':!![]});var _0x3249ea=_0xd028('0x2d');return db[_0xd028('0x2e')][_0xd028('0x2f')]({'where':{'type':_0x3249ea,'resourceId':_0x1de0cc['id']}})[_0xd028('0x2b')](function(){return _0x1ec134;});})[_0xd028('0x2b')](function(){_0x10d629[_0xd028('0x21')](0xcc)[_0xd028('0x22')]();});}};}function handleEntityNotFound(_0x2db5c1,_0x20d7ff){return function(_0x2aa5bf){if(!_0x2aa5bf){_0x2db5c1[_0xd028('0x20')](0x194);}return _0x2aa5bf;};}function handleError(_0x3294fe,_0x3112e8){_0x3112e8=_0x3112e8||0x1f4;return function(_0x112578){logger[_0xd028('0x30')](_0x112578[_0xd028('0x31')]);if(_0x112578[_0xd028('0x32')]){delete _0x112578['name'];}_0x3294fe['status'](_0x3112e8)[_0xd028('0x33')](_0x112578);};}exports[_0xd028('0x34')]=function(_0x2caf5d,_0x26c44c){var _0x53d887={},_0x44f940={},_0x4ae1fb={'count':0x0,'rows':[]};var _0x4b5384=_[_0xd028('0x35')](db[_0xd028('0x36')][_0xd028('0x37')],function(_0x443ec4){return{'name':_0x443ec4[_0xd028('0x38')],'type':_0x443ec4[_0xd028('0x39')][_0xd028('0x3a')]};});_0x44f940['model']=_['map'](_0x4b5384,_0xd028('0x32'));_0x44f940[_0xd028('0x3b')]=_['keys'](_0x2caf5d['query']);_0x44f940[_0xd028('0x3c')]=_[_0xd028('0x3d')](_0x44f940[_0xd028('0x3e')],_0x44f940[_0xd028('0x3b')]);_0x53d887[_0xd028('0x3f')]=_[_0xd028('0x3d')](_0x44f940[_0xd028('0x3e')],qs[_0xd028('0x40')](_0x2caf5d[_0xd028('0x3b')][_0xd028('0x40')]));_0x53d887[_0xd028('0x3f')]=_0x53d887['attributes']['length']?_0x53d887['attributes']:_0x44f940['model'];if(!_0x2caf5d['query'][_0xd028('0x41')]('nolimit')){_0x53d887['limit']=qs['limit'](_0x2caf5d[_0xd028('0x3b')]['limit']);_0x53d887[_0xd028('0x23')]=qs['offset'](_0x2caf5d['query'][_0xd028('0x23')]);}_0x53d887[_0xd028('0x42')]=qs['sort'](_0x2caf5d[_0xd028('0x3b')]['sort']);_0x53d887['where']=qs['filters'](_['pick'](_0x2caf5d['query'],_0x44f940[_0xd028('0x3c')]));if(_0x2caf5d[_0xd028('0x3b')]['filter']){_0x53d887[_0xd028('0x43')]=_[_0xd028('0x44')](_0x53d887[_0xd028('0x43')],{'$or':_[_0xd028('0x35')](_0x4b5384,function(_0xc79c76){if(_0xc79c76[_0xd028('0x39')]!=='VIRTUAL'){var _0x233979={};_0x233979[_0xc79c76[_0xd028('0x32')]]={'$like':'%'+_0x2caf5d[_0xd028('0x3b')]['filter']+'%'};return _0x233979;}})});}_0x53d887=_[_0xd028('0x44')]({},_0x53d887,_0x2caf5d[_0xd028('0x45')]);var _0x14f28a={'where':_0x53d887['where']};return db[_0xd028('0x36')]['count'](_0x14f28a)[_0xd028('0x2b')](function(_0x1b791a){_0x4ae1fb[_0xd028('0x46')]=_0x1b791a;if(_0x2caf5d[_0xd028('0x3b')][_0xd028('0x47')]){_0x53d887[_0xd028('0x48')]=[{'all':!![]}];}return db[_0xd028('0x36')][_0xd028('0x49')](_0x53d887);})[_0xd028('0x2b')](function(_0x5247ae){_0x4ae1fb[_0xd028('0x4a')]=_0x5247ae;return _0x4ae1fb;})[_0xd028('0x2b')](respondWithFilteredResult(_0x26c44c,_0x53d887))[_0xd028('0x4b')](handleError(_0x26c44c,null));};exports[_0xd028('0x4c')]=function(_0x519d79,_0x15c071){var _0x8fb589={'raw':![],'where':{'id':_0x519d79['params']['id']}},_0x25acb1={};_0x25acb1[_0xd028('0x3e')]=_[_0xd028('0x4d')](db['Dashboard'][_0xd028('0x37')]);_0x25acb1[_0xd028('0x3b')]=_[_0xd028('0x4d')](_0x519d79[_0xd028('0x3b')]);_0x25acb1[_0xd028('0x3c')]=_[_0xd028('0x3d')](_0x25acb1[_0xd028('0x3e')],_0x25acb1[_0xd028('0x3b')]);_0x8fb589[_0xd028('0x3f')]=_[_0xd028('0x3d')](_0x25acb1['model'],qs[_0xd028('0x40')](_0x519d79[_0xd028('0x3b')][_0xd028('0x40')]));_0x8fb589[_0xd028('0x3f')]=_0x8fb589[_0xd028('0x3f')][_0xd028('0x4e')]?_0x8fb589['attributes']:_0x25acb1[_0xd028('0x3e')];if(_0x519d79[_0xd028('0x3b')][_0xd028('0x47')]){_0x8fb589[_0xd028('0x48')]=[{'all':!![]}];}_0x8fb589=_[_0xd028('0x44')]({},_0x8fb589,_0x519d79['options']);return db['Dashboard']['find'](_0x8fb589)['then'](handleEntityNotFound(_0x15c071,null))[_0xd028('0x2b')](respondWithResult(_0x15c071,null))[_0xd028('0x4b')](handleError(_0x15c071,null));};exports[_0xd028('0x4f')]=function(_0x3db4b8,_0xbebc7e){return db[_0xd028('0x36')][_0xd028('0x4f')](_0x3db4b8[_0xd028('0x50')],{})[_0xd028('0x2b')](function(_0x52489b){var _0x369913=_0x3db4b8[_0xd028('0x51')][_0xd028('0x2c')]({'plain':!![]});if(!_0x369913)throw new Error(_0xd028('0x52'));if(_0x369913[_0xd028('0x53')]===_0xd028('0x51')){var _0x4a2c39=_0x52489b['get']({'plain':!![]});var _0x1335ab=_0xd028('0x2d');return db['UserProfileSection'][_0xd028('0x54')]({'where':{'name':_0x1335ab,'userProfileId':_0x369913[_0xd028('0x55')]},'raw':!![]})[_0xd028('0x2b')](function(_0x1d337d){if(_0x1d337d&&_0x1d337d[_0xd028('0x56')]===0x0){return db[_0xd028('0x2e')][_0xd028('0x4f')]({'name':_0x4a2c39[_0xd028('0x32')],'resourceId':_0x4a2c39['id'],'type':_0x1d337d[_0xd028('0x32')],'sectionId':_0x1d337d['id']},{})['then'](function(){return _0x52489b;});}else{return _0x52489b;}})['catch'](function(_0x33be3a){logger[_0xd028('0x30')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x33be3a);throw _0x33be3a;});}return _0x52489b;})['then'](respondWithResult(_0xbebc7e,0xc9))[_0xd028('0x4b')](handleError(_0xbebc7e,null));};exports[_0xd028('0x57')]=function(_0x32dc1a,_0x4ff861){var _0x22bd1a={'where':{'id':_0x32dc1a['params']['id']}},_0x48dca1={};_0x48dca1['model']=_[_0xd028('0x4d')](db[_0xd028('0x36')][_0xd028('0x37')]);_0x22bd1a[_0xd028('0x3f')]=_[_0xd028('0x3d')](_0x48dca1[_0xd028('0x3e')],qs[_0xd028('0x40')](_0x32dc1a['query'][_0xd028('0x40')]));_0x22bd1a[_0xd028('0x3f')]=_0x22bd1a[_0xd028('0x3f')][_0xd028('0x4e')]?_0x22bd1a[_0xd028('0x3f')]:_0x48dca1[_0xd028('0x3e')];if(_0x32dc1a[_0xd028('0x3b')][_0xd028('0x47')]){_0x22bd1a['include']=[{'all':!![]}];}_0x22bd1a=_[_0xd028('0x44')]({},_0x22bd1a,_0x32dc1a['options']);return db[_0xd028('0x36')][_0xd028('0x54')](_0x22bd1a)[_0xd028('0x2b')](handleEntityNotFound(_0x4ff861,null))[_0xd028('0x2b')](function(_0xc10e82){if(_0xc10e82){var _0x3a2507=_0xc10e82[_0xd028('0x2c')]({'plain':!![]});_0x3a2507=qs[_0xd028('0x58')](_0x3a2507,['id',_0xd028('0x59'),_0xd028('0x5a')]);_0x32dc1a[_0xd028('0x50')]=_['omit'](_0x32dc1a['body'],['id','createdAt',_0xd028('0x5a')]);return db['Dashboard'][_0xd028('0x4f')](_[_0xd028('0x44')](_0x3a2507,_0x32dc1a[_0xd028('0x50')]),{'include':_0x32dc1a[_0xd028('0x3b')]['includeAll']?[{'all':!![]}]:undefined})[_0xd028('0x2b')](function(_0x16f36c){var _0x4e053d=_0x32dc1a[_0xd028('0x51')][_0xd028('0x2c')]({'plain':!![]});if(!_0x4e053d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4e053d[_0xd028('0x53')]===_0xd028('0x51')){var _0x32c363=_0x16f36c[_0xd028('0x2c')]({'plain':!![]});var _0x50fbb7='CustomDashboards';return db[_0xd028('0x5b')][_0xd028('0x54')]({'where':{'name':_0x50fbb7,'userProfileId':_0x4e053d[_0xd028('0x55')]},'raw':!![]})[_0xd028('0x2b')](function(_0x4ce15a){if(_0x4ce15a&&_0x4ce15a[_0xd028('0x56')]===0x0){return db[_0xd028('0x2e')]['create']({'name':_0x32c363[_0xd028('0x32')],'resourceId':_0x32c363['id'],'type':_0x4ce15a['name'],'sectionId':_0x4ce15a['id']},{})[_0xd028('0x2b')](function(){return _0x16f36c;});}else{return _0x16f36c;}})['catch'](function(_0x1dd089){logger[_0xd028('0x30')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1dd089);throw _0x1dd089;});}return _0x16f36c;});}})[_0xd028('0x2b')](respondWithResult(_0x4ff861,0xc9))['catch'](handleError(_0x4ff861,null));};exports[_0xd028('0x2a')]=function(_0x37f7d5,_0xb39f5d){if(_0x37f7d5[_0xd028('0x50')]['id']){delete _0x37f7d5[_0xd028('0x50')]['id'];}return db[_0xd028('0x36')][_0xd028('0x54')]({'where':{'id':_0x37f7d5[_0xd028('0x5c')]['id']}})[_0xd028('0x2b')](handleEntityNotFound(_0xb39f5d,null))['then'](saveUpdates(_0x37f7d5[_0xd028('0x50')],null))['then'](respondWithResult(_0xb39f5d,null))['catch'](handleError(_0xb39f5d,null));};exports[_0xd028('0x2f')]=function(_0x1c19e4,_0x5e87e4){return db[_0xd028('0x36')]['find']({'where':{'id':_0x1c19e4[_0xd028('0x5c')]['id']}})[_0xd028('0x2b')](handleEntityNotFound(_0x5e87e4,null))[_0xd028('0x2b')](removeEntity(_0x5e87e4,null))['catch'](handleError(_0x5e87e4,null));};function widgetAttributes(_0x491bb5){try{switch(_0x491bb5[_0xd028('0x39')]){case'iframe':return[{'name':_0xd028('0x5d'),'value':_0x491bb5[_0xd028('0x5d')]||(_0x491bb5[_0xd028('0x5e')]&&_0x491bb5[_0xd028('0x5e')][0x0]?_0x491bb5[_0xd028('0x5e')][0x0]['value']:undefined)||'https://'}];case _0xd028('0x5f'):return[{'name':'attrPath','value':_0x491bb5[_0xd028('0x60')]||(_0x491bb5[_0xd028('0x5e')]&&_0x491bb5[_0xd028('0x5e')][0x0]?_0x491bb5[_0xd028('0x5e')][0x0][_0xd028('0x61')]:undefined)||''}];case _0xd028('0x62'):return[{'name':_0xd028('0x63'),'value':_0x491bb5['attrHourFormat']||(_0x491bb5[_0xd028('0x5e')]&&_0x491bb5[_0xd028('0x5e')][0x0]?_0x491bb5['attrs'][0x0]['value']:undefined)||_0xd028('0x64')},{'name':_0xd028('0x65'),'value':_0x491bb5['attrTimezone']||(_0x491bb5['attrs']&&_0x491bb5[_0xd028('0x5e')][0x1]?_0x491bb5[_0xd028('0x5e')][0x1][_0xd028('0x61')]:undefined)||_0xd028('0x66')},{'name':_0xd028('0x67'),'value':_0x491bb5[_0xd028('0x67')]||(_0x491bb5[_0xd028('0x5e')]&&_0x491bb5['attrs'][0x2]?_0x491bb5[_0xd028('0x5e')][0x2][_0xd028('0x61')]:undefined)||0xc}];case _0xd028('0x68'):return[{'name':_0xd028('0x69'),'value':_0x491bb5[_0xd028('0x69')]||(_0x491bb5[_0xd028('0x5e')]&&_0x491bb5[_0xd028('0x5e')][0x0]?_0x491bb5['attrs'][0x0][_0xd028('0x61')]:undefined)||_0xd028('0x6a')},{'name':_0xd028('0x6b'),'value':_0x491bb5[_0xd028('0x6b')]||(_0x491bb5['attrs']&&_0x491bb5[_0xd028('0x5e')][0x1]?_0x491bb5[_0xd028('0x5e')][0x1][_0xd028('0x61')]:undefined)||[]},{'name':_0xd028('0x67'),'value':_0x491bb5[_0xd028('0x67')]||(_0x491bb5[_0xd028('0x5e')]&&_0x491bb5[_0xd028('0x5e')][0x2]?_0x491bb5[_0xd028('0x5e')][0x2]['value']:undefined)||0x14}];case _0xd028('0x6c'):case _0xd028('0x6d'):return[{'name':_0xd028('0x6e'),'value':_0x491bb5['attrSerie1']||(_0x491bb5['attrs']&&_0x491bb5['attrs'][0x0]?_0x491bb5[_0xd028('0x5e')][0x0][_0xd028('0x61')]:undefined)||_0xd028('0x6a')},{'name':'attrSerie2','value':_0x491bb5[_0xd028('0x6f')]||(_0x491bb5[_0xd028('0x5e')]&&_0x491bb5[_0xd028('0x5e')][0x1]?_0x491bb5[_0xd028('0x5e')][0x1][_0xd028('0x61')]:undefined)||null},{'name':'attrSerie3','value':_0x491bb5[_0xd028('0x70')]||(_0x491bb5[_0xd028('0x5e')]&&_0x491bb5[_0xd028('0x5e')][0x2]?_0x491bb5['attrs'][0x2][_0xd028('0x61')]:undefined)||null},{'name':_0xd028('0x6b'),'value':_0x491bb5[_0xd028('0x6b')]||(_0x491bb5[_0xd028('0x5e')]&&_0x491bb5['attrs'][0x3]?_0x491bb5[_0xd028('0x5e')][0x3][_0xd028('0x61')]:undefined)||[]}];case'web-report':return[{'name':_0xd028('0x71'),'type':_0x491bb5[_0xd028('0x72')]||(_0x491bb5[_0xd028('0x5e')]&&_0x491bb5[_0xd028('0x5e')][0x0]?_0x491bb5[_0xd028('0x5e')][0x0]['type']:undefined)||null,'value':_0x491bb5[_0xd028('0x71')]||(_0x491bb5[_0xd028('0x5e')]&&_0x491bb5[_0xd028('0x5e')][0x0]?_0x491bb5[_0xd028('0x5e')][0x0][_0xd028('0x61')]:undefined)||null},{'name':'attrRefresh','value':_0x491bb5[_0xd028('0x73')]||(_0x491bb5[_0xd028('0x5e')]&&_0x491bb5[_0xd028('0x5e')][0x1]?_0x491bb5['attrs'][0x1][_0xd028('0x61')]:undefined)||0x0}];default:return[];}}catch(_0x3171e4){logger[_0xd028('0x30')](_0xd028('0x74'),JSON['stringify'](_0x3171e4));return[];}}exports['addItem']=function(_0x5764ba,_0x223aef,_0x10e8b8){if(_0x5764ba[_0xd028('0x50')]['id']){delete _0x5764ba['body']['id'];}return db[_0xd028('0x36')][_0xd028('0x54')]({'where':{'id':_0x5764ba[_0xd028('0x5c')]['id']}})[_0xd028('0x2b')](handleEntityNotFound(_0x223aef,null))[_0xd028('0x2b')](function(_0x30615c){if(_0x30615c){_0x5764ba[_0xd028('0x50')][_0xd028('0x75')]=_0x30615c['id'];_0x5764ba[_0xd028('0x50')][_0xd028('0x5e')]=widgetAttributes(_0x5764ba['body']);return db[_0xd028('0x76')][_0xd028('0x4f')](_0x5764ba[_0xd028('0x50')]);}})['then'](respondWithResult(_0x223aef,null))[_0xd028('0x4b')](handleError(_0x223aef,null));};exports[_0xd028('0x77')]=function(_0xc2d9cb,_0x5dcf46,_0x52b309){var _0x165c1c={};var _0x465671={};var _0x3c2136;var _0x380152;return db[_0xd028('0x36')][_0xd028('0x78')]({'where':{'id':_0xc2d9cb[_0xd028('0x5c')]['id']}})[_0xd028('0x2b')](handleEntityNotFound(_0x5dcf46,null))['then'](function(_0x219193){if(_0x219193){_0x3c2136=_0x219193;_0x465671['model']=_['keys'](db[_0xd028('0x76')][_0xd028('0x37')]);_0x465671[_0xd028('0x3b')]=_[_0xd028('0x4d')](_0xc2d9cb[_0xd028('0x3b')]);_0x465671[_0xd028('0x3c')]=_[_0xd028('0x3d')](_0x465671['model'],_0x465671[_0xd028('0x3b')]);_0x165c1c[_0xd028('0x3f')]=_[_0xd028('0x3d')](_0x465671['model'],qs[_0xd028('0x40')](_0xc2d9cb[_0xd028('0x3b')]['fields']));_0x165c1c[_0xd028('0x3f')]=_0x165c1c[_0xd028('0x3f')][_0xd028('0x4e')]?_0x165c1c[_0xd028('0x3f')]:_0x465671[_0xd028('0x3e')];_0x165c1c[_0xd028('0x42')]=qs[_0xd028('0x79')](_0xc2d9cb[_0xd028('0x3b')][_0xd028('0x79')]);_0x165c1c[_0xd028('0x43')]=qs[_0xd028('0x3c')](_[_0xd028('0x7a')](_0xc2d9cb[_0xd028('0x3b')],_0x465671[_0xd028('0x3c')]));if(_0xc2d9cb[_0xd028('0x3b')]['filter']){_0x165c1c[_0xd028('0x43')]=_['merge'](_0x165c1c['where'],{'$or':_['map'](_0x165c1c[_0xd028('0x3f')],function(_0x5cedac){var _0x2dd431={};_0x2dd431[_0x5cedac]={'$like':'%'+_0xc2d9cb[_0xd028('0x3b')][_0xd028('0x7b')]+'%'};return _0x2dd431;})});}_0x165c1c=_['merge']({},_0x165c1c,_0xc2d9cb[_0xd028('0x45')]);return _0x3c2136[_0xd028('0x77')](_0x165c1c);}})[_0xd028('0x2b')](function(_0x734062){if(_0x734062){_0x380152=_0x734062[_0xd028('0x4e')];if(!_0xc2d9cb[_0xd028('0x3b')][_0xd028('0x41')](_0xd028('0x7c'))){_0x165c1c['limit']=qs[_0xd028('0x24')](_0xc2d9cb[_0xd028('0x3b')][_0xd028('0x24')]);_0x165c1c[_0xd028('0x23')]=qs[_0xd028('0x23')](_0xc2d9cb[_0xd028('0x3b')]['offset']);}return _0x3c2136[_0xd028('0x77')](_0x165c1c);}})[_0xd028('0x2b')](function(_0x1f5b4b){if(_0x1f5b4b){return _0x1f5b4b?{'count':_0x380152,'rows':_0x1f5b4b}:null;}})[_0xd028('0x2b')](respondWithResult(_0x5dcf46,null))['catch'](handleError(_0x5dcf46,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 461c487..8528e39 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 _0x6e12=['exports','events','../../mysqldb','setMaxListeners','save','update','emit','hasOwnProperty','hook'];(function(_0x5d1824,_0xf69d16){var _0x143bdc=function(_0xa8d201){while(--_0xa8d201){_0x5d1824['push'](_0x5d1824['shift']());}};_0x143bdc(++_0xf69d16);}(_0x6e12,0x1e7));var _0x26e1=function(_0x46e68a,_0x5a0d98){_0x46e68a=_0x46e68a-0x0;var _0x5d6551=_0x6e12[_0x46e68a];return _0x5d6551;};'use strict';var EventEmitter=require(_0x26e1('0x0'));var Dashboard=require(_0x26e1('0x1'))['db']['Dashboard'];var DashboardEvents=new EventEmitter();DashboardEvents[_0x26e1('0x2')](0x0);var events={'afterCreate':_0x26e1('0x3'),'afterUpdate':_0x26e1('0x4'),'afterDestroy':'remove'};function emitEvent(_0x58f0cb){return function(_0x5ba942,_0x6a843b,_0x423e97){DashboardEvents[_0x26e1('0x5')](_0x58f0cb+':'+_0x5ba942['id'],_0x5ba942);DashboardEvents['emit'](_0x58f0cb,_0x5ba942);_0x423e97(null);};}for(var e in events){if(events[_0x26e1('0x6')](e)){var event=events[e];Dashboard[_0x26e1('0x7')](e,emitEvent(event));}}module[_0x26e1('0x8')]=DashboardEvents; \ No newline at end of file +var _0xd9b9=['hook','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x350838,_0x5c9acf){var _0x1b4089=function(_0x25e0fa){while(--_0x25e0fa){_0x350838['push'](_0x350838['shift']());}};_0x1b4089(++_0x5c9acf);}(_0xd9b9,0xfd));var _0x9d9b=function(_0xb8fb4f,_0x579c19){_0xb8fb4f=_0xb8fb4f-0x0;var _0x44d61d=_0xd9b9[_0xb8fb4f];return _0x44d61d;};'use strict';var EventEmitter=require('events');var Dashboard=require('../../mysqldb')['db']['Dashboard'];var DashboardEvents=new EventEmitter();DashboardEvents[_0x9d9b('0x0')](0x0);var events={'afterCreate':_0x9d9b('0x1'),'afterUpdate':_0x9d9b('0x2'),'afterDestroy':_0x9d9b('0x3')};function emitEvent(_0x1a7b61){return function(_0x19ac03,_0x4c3526,_0x256455){DashboardEvents['emit'](_0x1a7b61+':'+_0x19ac03['id'],_0x19ac03);DashboardEvents[_0x9d9b('0x4')](_0x1a7b61,_0x19ac03);_0x256455(null);};}for(var e in events){if(events[_0x9d9b('0x5')](e)){var event=events[e];Dashboard[_0x9d9b('0x6')](e,emitEvent(event));}}module['exports']=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index ee0fb9b..235ecf1 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 _0x95e1=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./dashboard.attributes','exports','define','Dashboard','dashboards','lodash','util'];(function(_0x4dc845,_0x3ef798){var _0x3c50f6=function(_0x46a1e5){while(--_0x46a1e5){_0x4dc845['push'](_0x4dc845['shift']());}};_0x3c50f6(++_0x3ef798);}(_0x95e1,0xc1));var _0x195e=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x95e1[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x195e('0x0'));var util=require(_0x195e('0x1'));var logger=require(_0x195e('0x2'))(_0x195e('0x3'));var moment=require(_0x195e('0x4'));var BPromise=require(_0x195e('0x5'));var rp=require(_0x195e('0x6'));var fs=require('fs');var path=require(_0x195e('0x7'));var rimraf=require(_0x195e('0x8'));var config=require(_0x195e('0x9'));var attributes=require(_0x195e('0xa'));module[_0x195e('0xb')]=function(_0x4a23fd,_0x2c2c5f){return _0x4a23fd[_0x195e('0xc')](_0x195e('0xd'),attributes,{'tableName':_0x195e('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x29d9=['moment','rimraf','../../config/environment','exports','define','dashboards','util','../../config/logger','api'];(function(_0x5060fc,_0x281e69){var _0x401558=function(_0x295832){while(--_0x295832){_0x5060fc['push'](_0x5060fc['shift']());}};_0x401558(++_0x281e69);}(_0x29d9,0x84));var _0x929d=function(_0x1f75d4,_0x183581){_0x1f75d4=_0x1f75d4-0x0;var _0x72f2ca=_0x29d9[_0x1f75d4];return _0x72f2ca;};'use strict';var _=require('lodash');var util=require(_0x929d('0x0'));var logger=require(_0x929d('0x1'))(_0x929d('0x2'));var moment=require(_0x929d('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x929d('0x4'));var config=require(_0x929d('0x5'));var attributes=require('./dashboard.attributes');module[_0x929d('0x6')]=function(_0x2e1ca0,_0x341448){return _0x2e1ca0[_0x929d('0x7')]('Dashboard',attributes,{'tableName':_0x929d('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 13a6368..ba49621 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 _0xc57c=['defaults','localhost','socket.io-emitter','./dashboard.socket','register','request','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis'];(function(_0x1e3d59,_0x3d2e8b){var _0x19c9a4=function(_0x494641){while(--_0x494641){_0x1e3d59['push'](_0x1e3d59['shift']());}};_0x19c9a4(++_0x3d2e8b);}(_0xc57c,0x149));var _0xcc57=function(_0x5f247f,_0x2628ad){_0x5f247f=_0x5f247f-0x0;var _0x27a9b3=_0xc57c[_0x5f247f];return _0x27a9b3;};'use strict';var _=require(_0xcc57('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xcc57('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xcc57('0x2'));var logger=require('../../config/logger')(_0xcc57('0x3'));var config=require(_0xcc57('0x4'));var jayson=require(_0xcc57('0x5'));var client=jayson[_0xcc57('0x6')][_0xcc57('0x7')]({'port':0x232a});config[_0xcc57('0x8')]=_[_0xcc57('0x9')](config['redis'],{'host':_0xcc57('0xa'),'port':0x18eb});var socket=require(_0xcc57('0xb'))(new Redis(config[_0xcc57('0x8')]));require(_0xcc57('0xc'))[_0xcc57('0xd')](socket);function respondWithRpcPromise(_0x1a8031,_0x35916b,_0x551a73){return new BPromise(function(_0x4c7e7c,_0x51be8c){return client[_0xcc57('0xe')](_0x1a8031,_0x551a73)[_0xcc57('0xf')](function(_0x5a5444){logger[_0xcc57('0x10')](_0xcc57('0x11'),_0x35916b,_0xcc57('0x12'));logger[_0xcc57('0x13')](_0xcc57('0x14'),_0x35916b,_0xcc57('0x12'),JSON[_0xcc57('0x15')](_0x5a5444));if(_0x5a5444[_0xcc57('0x16')]){if(_0x5a5444[_0xcc57('0x16')][_0xcc57('0x17')]===0x1f4){logger['error']('Dashboard,\x20%s,\x20%s',_0x35916b,_0x5a5444['error'][_0xcc57('0x18')]);return _0x51be8c(_0x5a5444[_0xcc57('0x16')][_0xcc57('0x18')]);}logger[_0xcc57('0x16')](_0xcc57('0x11'),_0x35916b,_0x5a5444['error'][_0xcc57('0x18')]);return _0x4c7e7c(_0x5a5444[_0xcc57('0x16')]['message']);}else{logger[_0xcc57('0x10')]('Dashboard,\x20%s,\x20%s',_0x35916b,_0xcc57('0x12'));_0x4c7e7c(_0x5a5444['result'][_0xcc57('0x18')]);}})[_0xcc57('0x19')](function(_0x24b749){logger['error'](_0xcc57('0x11'),_0x35916b,_0x24b749);_0x51be8c(_0x24b749);});});} \ No newline at end of file +var _0xa399=['request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','socket.io-emitter','./dashboard.socket','register','then','info','Dashboard,\x20%s,\x20%s'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa399,0x1e3));var _0x9a39=function(_0x45f951,_0x2750c8){_0x45f951=_0x45f951-0x0;var _0x24756c=_0xa399[_0x45f951];return _0x24756c;};'use strict';var _=require(_0x9a39('0x0'));var util=require(_0x9a39('0x1'));var moment=require('moment');var BPromise=require(_0x9a39('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9a39('0x3'))['db'];var utils=require(_0x9a39('0x4'));var logger=require(_0x9a39('0x5'))(_0x9a39('0x6'));var config=require(_0x9a39('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x9a39('0x8')][_0x9a39('0x9')]({'port':0x232a});config[_0x9a39('0xa')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x9a39('0xb'))(new Redis(config[_0x9a39('0xa')]));require(_0x9a39('0xc'))[_0x9a39('0xd')](socket);function respondWithRpcPromise(_0x327b58,_0xa42bc2,_0x40ab61){return new BPromise(function(_0x1ee020,_0x303af9){return client['request'](_0x327b58,_0x40ab61)[_0x9a39('0xe')](function(_0x56fe2d){logger[_0x9a39('0xf')](_0x9a39('0x10'),_0xa42bc2,_0x9a39('0x11'));logger[_0x9a39('0x12')](_0x9a39('0x13'),_0xa42bc2,'request\x20sent',JSON[_0x9a39('0x14')](_0x56fe2d));if(_0x56fe2d[_0x9a39('0x15')]){if(_0x56fe2d[_0x9a39('0x15')]['code']===0x1f4){logger[_0x9a39('0x15')](_0x9a39('0x10'),_0xa42bc2,_0x56fe2d['error'][_0x9a39('0x16')]);return _0x303af9(_0x56fe2d[_0x9a39('0x15')][_0x9a39('0x16')]);}logger[_0x9a39('0x15')]('Dashboard,\x20%s,\x20%s',_0xa42bc2,_0x56fe2d[_0x9a39('0x15')]['message']);return _0x1ee020(_0x56fe2d[_0x9a39('0x15')][_0x9a39('0x16')]);}else{logger[_0x9a39('0xf')](_0x9a39('0x10'),_0xa42bc2,_0x9a39('0x11'));_0x1ee020(_0x56fe2d[_0x9a39('0x17')][_0x9a39('0x16')]);}})[_0x9a39('0x18')](function(_0x36f1b2){logger[_0x9a39('0x15')](_0x9a39('0x10'),_0xa42bc2,_0x36f1b2);_0x303af9(_0x36f1b2);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index e1cf03a..6be1129 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 _0xfc65=['emit','register','length','./dashboard.events','save'];(function(_0x2f62aa,_0x108e95){var _0x1a341f=function(_0x3aedcf){while(--_0x3aedcf){_0x2f62aa['push'](_0x2f62aa['shift']());}};_0x1a341f(++_0x108e95);}(_0xfc65,0x125));var _0x5fc6=function(_0x59c99b,_0x282514){_0x59c99b=_0x59c99b-0x0;var _0x2e4b23=_0xfc65[_0x59c99b];return _0x2e4b23;};'use strict';var DashboardEvents=require(_0x5fc6('0x0'));var events=[_0x5fc6('0x1'),'remove','update'];function createListener(_0x3005d5,_0xa05a56){return function(_0x28adc7){_0xa05a56[_0x5fc6('0x2')](_0x3005d5,_0x28adc7);};}function removeListener(_0x145cb7,_0x3e9d34){return function(){DashboardEvents['removeListener'](_0x145cb7,_0x3e9d34);};}exports[_0x5fc6('0x3')]=function(_0x204c7d){for(var _0x54ac86=0x0,_0x6d12a1=events[_0x5fc6('0x4')];_0x54ac86<_0x6d12a1;_0x54ac86++){var _0x2ba1df=events[_0x54ac86];var _0x129a0b=createListener('dashboard:'+_0x2ba1df,_0x204c7d);DashboardEvents['on'](_0x2ba1df,_0x129a0b);}}; \ No newline at end of file +var _0xf323=['emit','removeListener','register','length','dashboard:','./dashboard.events','save','remove','update'];(function(_0x3c6125,_0x3b2a9c){var _0x2f47b8=function(_0x214650){while(--_0x214650){_0x3c6125['push'](_0x3c6125['shift']());}};_0x2f47b8(++_0x3b2a9c);}(_0xf323,0xe6));var _0x3f32=function(_0x21402e,_0xfa81f2){_0x21402e=_0x21402e-0x0;var _0x28b7f8=_0xf323[_0x21402e];return _0x28b7f8;};'use strict';var DashboardEvents=require(_0x3f32('0x0'));var events=[_0x3f32('0x1'),_0x3f32('0x2'),_0x3f32('0x3')];function createListener(_0xcdb98d,_0x365700){return function(_0x4e0f08){_0x365700[_0x3f32('0x4')](_0xcdb98d,_0x4e0f08);};}function removeListener(_0xece483,_0x4dc4e6){return function(){DashboardEvents[_0x3f32('0x5')](_0xece483,_0x4dc4e6);};}exports[_0x3f32('0x6')]=function(_0x85d73a){for(var _0x5764cc=0x0,_0x4f2e77=events[_0x3f32('0x7')];_0x5764cc<_0x4f2e77;_0x5764cc++){var _0x12017c=events[_0x5764cc];var _0x5ba94c=createListener(_0x3f32('0x8')+_0x12017c,_0x85d73a);DashboardEvents['on'](_0x12017c,_0x5ba94c);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 639dd91..a9e134e 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 _0xb7e7=['addItem','put','update','delete','multer','path','express','../../components/auth/service','../../config/environment','./dashboard.controller','get','/:id','isAuthenticated','/:id/items','getItems','post','create','/:id/clone','clone'];(function(_0x4b3e49,_0x9e566c){var _0x57e339=function(_0x1430e9){while(--_0x1430e9){_0x4b3e49['push'](_0x4b3e49['shift']());}};_0x57e339(++_0x9e566c);}(_0xb7e7,0x121));var _0x7b7e=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xb7e7[_0x3947c9];return _0x2e7871;};'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('0xb')]('/',auth[_0x7b7e('0x8')](),controller[_0x7b7e('0xc')]);router['post'](_0x7b7e('0xd'),auth[_0x7b7e('0x8')](),controller[_0x7b7e('0xe')]);router[_0x7b7e('0xb')](_0x7b7e('0x9'),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 +var _0xd8b0=['../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboard.controller','index','get','/:id','show','isAuthenticated','getItems','post','create','/:id/clone','addItem','put','update','delete','destroy','exports','multer','util','Router'];(function(_0x343090,_0x433a80){var _0x3ff3e8=function(_0x16c811){while(--_0x16c811){_0x343090['push'](_0x343090['shift']());}};_0x3ff3e8(++_0x433a80);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var auth=require(_0x0d8b('0x3'));var interaction=require(_0x0d8b('0x4'));var config=require(_0x0d8b('0x5'));var controller=require(_0x0d8b('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x0d8b('0x7')]);router[_0x0d8b('0x8')](_0x0d8b('0x9'),auth['isAuthenticated'](),controller[_0x0d8b('0xa')]);router[_0x0d8b('0x8')]('/:id/items',auth[_0x0d8b('0xb')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0xb')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xd')](_0x0d8b('0xf'),auth[_0x0d8b('0xb')](),controller['clone']);router[_0x0d8b('0xd')]('/:id/items',auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x10')]);router[_0x0d8b('0x11')](_0x0d8b('0x9'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x12')]);router[_0x0d8b('0x13')](_0x0d8b('0x9'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x14')]);module[_0x0d8b('0x15')]=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index beadfe8..5e100cc 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 _0x6186=['long','parse','getDataValue','attrs','setDataValue','stringify','INTEGER','#ffffff','#2196f3','squel','lodash','exports','STRING','TEXT'];(function(_0x54b933,_0x1b6c35){var _0x2e6dcf=function(_0xcc3c03){while(--_0xcc3c03){_0x54b933['push'](_0x54b933['shift']());}};_0x2e6dcf(++_0x1b6c35);}(_0x6186,0x19f));var _0x6618=function(_0x303064,_0x12f0c2){_0x303064=_0x303064-0x0;var _0x5a1d3d=_0x6186[_0x303064];return _0x5a1d3d;};'use strict';var Sequelize=require('sequelize');var squel=require(_0x6618('0x0'));var _=require(_0x6618('0x1'));module[_0x6618('0x2')]={'title':{'type':Sequelize[_0x6618('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x6618('0x3')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x6618('0x4')](_0x6618('0x5')),'get':function(){try{return JSON[_0x6618('0x6')](this[_0x6618('0x7')](_0x6618('0x8')));}catch(_0x54b961){return[];}},'set':function(_0x2cc240){try{this[_0x6618('0x9')](_0x6618('0x8'),JSON[_0x6618('0xa')](_0x2cc240));}catch(_0x18c1c4){this[_0x6618('0x9')](_0x6618('0x8'),JSON[_0x6618('0xa')]([]));}}},'sizeX':{'type':Sequelize[_0x6618('0xb')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x6618('0xb')]},'col':{'type':Sequelize[_0x6618('0xb')]},'background':{'type':Sequelize[_0x6618('0x3')],'allowNull':![],'defaultValue':_0x6618('0xc'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x6618('0xd'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x6618('0x3')]}}; \ No newline at end of file +var _0x365b=['sequelize','lodash','STRING','parse','attrs','stringify','setDataValue','INTEGER','#2196f3'];(function(_0x1ffd67,_0x1c18ba){var _0xce170f=function(_0x16cdb2){while(--_0x16cdb2){_0x1ffd67['push'](_0x1ffd67['shift']());}};_0xce170f(++_0x1c18ba);}(_0x365b,0x1dd));var _0xb365=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0x365b[_0x5d4607];return _0x5e4a86;};'use strict';var Sequelize=require(_0xb365('0x0'));var squel=require('squel');var _=require(_0xb365('0x1'));module['exports']={'title':{'type':Sequelize[_0xb365('0x2')],'allowNull':![]},'type':{'type':Sequelize['STRING'](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize['TEXT']('long'),'get':function(){try{return JSON[_0xb365('0x3')](this['getDataValue'](_0xb365('0x4')));}catch(_0x2a8eda){return[];}},'set':function(_0x156aea){try{this['setDataValue'](_0xb365('0x4'),JSON[_0xb365('0x5')](_0x156aea));}catch(_0x2cd3cb){this[_0xb365('0x6')](_0xb365('0x4'),JSON[_0xb365('0x5')]([]));}}},'sizeX':{'type':Sequelize[_0xb365('0x7')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0xb365('0x7')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize['INTEGER']},'col':{'type':Sequelize[_0xb365('0x7')]},'background':{'type':Sequelize[_0xb365('0x2')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xb365('0x8'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0xb365('0x2')]}}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.controller.js b/server/api/dashboardItem/dashboardItem.controller.js index 02b0561..9a7c3c2 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 _0x0cca=['../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','register','sendStatus','status','json','offset','limit','set','apply','reject','save','update','end','error','name','send','show','params','model','DashboardItem','rawAttributes','query','keys','filters','intersection','fields','attributes','length','includeAll','include','merge','options','then','catch','find','iframe','attrs','https://','custom','attrPath','attrHourFormat','value','HH:mm:ss','attrTimezone','attrFontSize','counter','attrMetric','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrReport','reportType','type','attrRefresh','widgetAttributes:\x20%s','stringify','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service'];(function(_0x3ce2a8,_0x1a47ef){var _0x5a9920=function(_0x5b8e19){while(--_0x5b8e19){_0x3ce2a8['push'](_0x3ce2a8['shift']());}};_0x5a9920(++_0x1a47ef);}(_0x0cca,0x152));var _0xa0cc=function(_0x589aee,_0x140a03){_0x589aee=_0x589aee-0x0;var _0x2f5ed4=_0x0cca[_0x589aee];return _0x2f5ed4;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xa0cc('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa0cc('0x1'));var jsonpatch=require(_0xa0cc('0x2'));var rp=require(_0xa0cc('0x3'));var moment=require(_0xa0cc('0x4'));var BPromise=require(_0xa0cc('0x5'));var Mustache=require('mustache');var util=require(_0xa0cc('0x6'));var path=require(_0xa0cc('0x7'));var sox=require(_0xa0cc('0x8'));var csv=require(_0xa0cc('0x9'));var ejs=require(_0xa0cc('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xa0cc('0xb'));var crypto=require(_0xa0cc('0xc'));var jsforce=require(_0xa0cc('0xd'));var deskjs=require(_0xa0cc('0xe'));var toCsv=require(_0xa0cc('0x9'));var querystring=require(_0xa0cc('0xf'));var Papa=require(_0xa0cc('0x10'));var Redis=require('ioredis');var authService=require(_0xa0cc('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xa0cc('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa0cc('0x13'))(_0xa0cc('0x14'));var utils=require(_0xa0cc('0x15'));var config=require(_0xa0cc('0x16'));var db=require(_0xa0cc('0x17'))['db'];config[_0xa0cc('0x18')]=_[_0xa0cc('0x19')](config[_0xa0cc('0x18')],{'host':_0xa0cc('0x1a'),'port':0x18eb});var socket=require(_0xa0cc('0x1b'))(new Redis(config[_0xa0cc('0x18')]));require(_0xa0cc('0x1c'))[_0xa0cc('0x1d')](socket);function respondWithStatusCode(_0x448d01,_0x5a684c){_0x5a684c=_0x5a684c||0xcc;return function(_0x39c77d){if(_0x39c77d){return _0x448d01[_0xa0cc('0x1e')](_0x5a684c);}return _0x448d01[_0xa0cc('0x1f')](_0x5a684c)['end']();};}function respondWithResult(_0x1c6245,_0x1738f4){_0x1738f4=_0x1738f4||0xc8;return function(_0x8fef95){if(_0x8fef95){return _0x1c6245['status'](_0x1738f4)[_0xa0cc('0x20')](_0x8fef95);}};}function respondWithFilteredResult(_0x557941,_0x403a6e){return function(_0x519206){if(_0x519206){var _0x4255d5=_0x519206['count'],_0x27ecc9=_0x403a6e[_0xa0cc('0x21')],_0x2e16cd=_0x403a6e[_0xa0cc('0x21')]+_0x403a6e[_0xa0cc('0x22')],_0xba1199;if(_0x2e16cd>=_0x4255d5){_0x2e16cd=_0x4255d5;_0xba1199=0xc8;}else{_0xba1199=0xce;}_0x557941[_0xa0cc('0x1f')](_0xba1199);return _0x557941[_0xa0cc('0x23')]('Content-Range',_0x27ecc9+'-'+_0x2e16cd+'/'+_0x4255d5)[_0xa0cc('0x20')](_0x519206);}return null;};}function patchUpdates(_0x54214c){return function(_0xf81c6e){try{jsonpatch[_0xa0cc('0x24')](_0xf81c6e,_0x54214c,!![]);}catch(_0x517b7b){return BPromise[_0xa0cc('0x25')](_0x517b7b);}return _0xf81c6e[_0xa0cc('0x26')]();};}function saveUpdates(_0x305818,_0x3254d5){return function(_0x1d9d0d){if(_0x1d9d0d){return _0x1d9d0d[_0xa0cc('0x27')](_0x305818)['then'](function(_0x3ecbc7){return _0x3ecbc7;});}return null;};}function removeEntity(_0x356d43,_0x9180f9){return function(_0x477766){if(_0x477766){return _0x477766['destroy']()['then'](function(){_0x356d43[_0xa0cc('0x1f')](0xcc)[_0xa0cc('0x28')]();});}};}function handleEntityNotFound(_0x1d1dac,_0x71eb5b){return function(_0x857c0c){if(!_0x857c0c){_0x1d1dac['sendStatus'](0x194);}return _0x857c0c;};}function handleError(_0x1bc3ca,_0x47a5b9){_0x47a5b9=_0x47a5b9||0x1f4;return function(_0x55a0f8){logger[_0xa0cc('0x29')](_0x55a0f8['stack']);if(_0x55a0f8[_0xa0cc('0x2a')]){delete _0x55a0f8[_0xa0cc('0x2a')];}_0x1bc3ca['status'](_0x47a5b9)[_0xa0cc('0x2b')](_0x55a0f8);};}exports[_0xa0cc('0x2c')]=function(_0xa49d61,_0x21a9c6){var _0x346119={'raw':![],'where':{'id':_0xa49d61[_0xa0cc('0x2d')]['id']}},_0x31fceb={};_0x31fceb[_0xa0cc('0x2e')]=_['keys'](db[_0xa0cc('0x2f')][_0xa0cc('0x30')]);_0x31fceb[_0xa0cc('0x31')]=_[_0xa0cc('0x32')](_0xa49d61['query']);_0x31fceb[_0xa0cc('0x33')]=_[_0xa0cc('0x34')](_0x31fceb[_0xa0cc('0x2e')],_0x31fceb[_0xa0cc('0x31')]);_0x346119['attributes']=_['intersection'](_0x31fceb['model'],qs[_0xa0cc('0x35')](_0xa49d61[_0xa0cc('0x31')][_0xa0cc('0x35')]));_0x346119[_0xa0cc('0x36')]=_0x346119[_0xa0cc('0x36')][_0xa0cc('0x37')]?_0x346119['attributes']:_0x31fceb['model'];if(_0xa49d61['query'][_0xa0cc('0x38')]){_0x346119[_0xa0cc('0x39')]=[{'all':!![]}];}_0x346119=_[_0xa0cc('0x3a')]({},_0x346119,_0xa49d61[_0xa0cc('0x3b')]);return db[_0xa0cc('0x2f')]['find'](_0x346119)[_0xa0cc('0x3c')](handleEntityNotFound(_0x21a9c6,null))[_0xa0cc('0x3c')](respondWithResult(_0x21a9c6,null))[_0xa0cc('0x3d')](handleError(_0x21a9c6,null));};exports['destroy']=function(_0x31b6da,_0x496cbd){return db['DashboardItem'][_0xa0cc('0x3e')]({'where':{'id':_0x31b6da[_0xa0cc('0x2d')]['id']}})[_0xa0cc('0x3c')](handleEntityNotFound(_0x496cbd,null))[_0xa0cc('0x3c')](removeEntity(_0x496cbd,null))[_0xa0cc('0x3d')](handleError(_0x496cbd,null));};function widgetAttributes(_0x3b223e){try{switch(_0x3b223e['type']){case _0xa0cc('0x3f'):return[{'name':'attrUrl','value':_0x3b223e['attrUrl']||(_0x3b223e[_0xa0cc('0x40')]&&_0x3b223e[_0xa0cc('0x40')][0x0]?_0x3b223e[_0xa0cc('0x40')][0x0]['value']:undefined)||_0xa0cc('0x41')}];case _0xa0cc('0x42'):return[{'name':_0xa0cc('0x43'),'value':_0x3b223e['attrPath']||(_0x3b223e[_0xa0cc('0x40')]&&_0x3b223e[_0xa0cc('0x40')][0x0]?_0x3b223e[_0xa0cc('0x40')][0x0]['value']:undefined)||''}];case'clock':return[{'name':_0xa0cc('0x44'),'value':_0x3b223e[_0xa0cc('0x44')]||(_0x3b223e['attrs']&&_0x3b223e['attrs'][0x0]?_0x3b223e[_0xa0cc('0x40')][0x0][_0xa0cc('0x45')]:undefined)||_0xa0cc('0x46')},{'name':_0xa0cc('0x47'),'value':_0x3b223e['attrTimezone']||(_0x3b223e[_0xa0cc('0x40')]&&_0x3b223e[_0xa0cc('0x40')][0x1]?_0x3b223e[_0xa0cc('0x40')][0x1][_0xa0cc('0x45')]:undefined)||'0.00'},{'name':_0xa0cc('0x48'),'value':_0x3b223e[_0xa0cc('0x48')]||(_0x3b223e[_0xa0cc('0x40')]&&_0x3b223e[_0xa0cc('0x40')][0x2]?_0x3b223e[_0xa0cc('0x40')][0x2]['value']:undefined)||0xc}];case _0xa0cc('0x49'):return[{'name':_0xa0cc('0x4a'),'value':_0x3b223e['attrMetric']||(_0x3b223e[_0xa0cc('0x40')]&&_0x3b223e[_0xa0cc('0x40')][0x0]?_0x3b223e['attrs'][0x0][_0xa0cc('0x45')]:undefined)||'total'},{'name':_0xa0cc('0x4b'),'value':_0x3b223e[_0xa0cc('0x4b')]||(_0x3b223e[_0xa0cc('0x40')]&&_0x3b223e['attrs'][0x1]?_0x3b223e['attrs'][0x1][_0xa0cc('0x45')]:undefined)||[]},{'name':'attrFontSize','value':_0x3b223e['attrFontSize']||(_0x3b223e[_0xa0cc('0x40')]&&_0x3b223e['attrs'][0x2]?_0x3b223e['attrs'][0x2]['value']:undefined)||0x14}];case _0xa0cc('0x4c'):case _0xa0cc('0x4d'):return[{'name':_0xa0cc('0x4e'),'value':_0x3b223e['attrSerie1']||(_0x3b223e[_0xa0cc('0x40')]&&_0x3b223e[_0xa0cc('0x40')][0x0]?_0x3b223e[_0xa0cc('0x40')][0x0][_0xa0cc('0x45')]:undefined)||'total'},{'name':_0xa0cc('0x4f'),'value':_0x3b223e['attrSerie2']||(_0x3b223e[_0xa0cc('0x40')]&&_0x3b223e[_0xa0cc('0x40')][0x1]?_0x3b223e[_0xa0cc('0x40')][0x1]['value']:undefined)||null},{'name':_0xa0cc('0x50'),'value':_0x3b223e[_0xa0cc('0x50')]||(_0x3b223e[_0xa0cc('0x40')]&&_0x3b223e[_0xa0cc('0x40')][0x2]?_0x3b223e[_0xa0cc('0x40')][0x2][_0xa0cc('0x45')]:undefined)||null},{'name':_0xa0cc('0x4b'),'value':_0x3b223e[_0xa0cc('0x4b')]||(_0x3b223e[_0xa0cc('0x40')]&&_0x3b223e[_0xa0cc('0x40')][0x3]?_0x3b223e[_0xa0cc('0x40')][0x3]['value']:undefined)||[]}];case'web-report':return[{'name':_0xa0cc('0x51'),'type':_0x3b223e[_0xa0cc('0x52')]||(_0x3b223e[_0xa0cc('0x40')]&&_0x3b223e[_0xa0cc('0x40')][0x0]?_0x3b223e[_0xa0cc('0x40')][0x0][_0xa0cc('0x53')]:undefined)||null,'value':_0x3b223e[_0xa0cc('0x51')]||(_0x3b223e['attrs']&&_0x3b223e[_0xa0cc('0x40')][0x0]?_0x3b223e[_0xa0cc('0x40')][0x0][_0xa0cc('0x45')]:undefined)||null},{'name':_0xa0cc('0x54'),'value':_0x3b223e['attrRefresh']||(_0x3b223e['attrs']&&_0x3b223e['attrs'][0x1]?_0x3b223e[_0xa0cc('0x40')][0x1][_0xa0cc('0x45')]:undefined)||0x0}];default:return[];}}catch(_0x258a9b){logger[_0xa0cc('0x29')](_0xa0cc('0x55'),JSON[_0xa0cc('0x56')](_0x258a9b));return[];}}exports[_0xa0cc('0x57')]=function(_0x3a74e7,_0xd4e38){if(_0x3a74e7['body']){_0x3a74e7[_0xa0cc('0x58')][_0xa0cc('0x40')]=widgetAttributes(_0x3a74e7[_0xa0cc('0x58')]);}return db['DashboardItem'][_0xa0cc('0x57')](_0x3a74e7[_0xa0cc('0x58')],{})[_0xa0cc('0x3c')](respondWithResult(_0xd4e38,0xc9))[_0xa0cc('0x3d')](handleError(_0xd4e38,null));};exports[_0xa0cc('0x27')]=function(_0x380613,_0x59f5b5){if(_0x380613[_0xa0cc('0x58')]['id']){delete _0x380613['body']['id'];}_0x380613[_0xa0cc('0x58')][_0xa0cc('0x40')]=widgetAttributes(_0x380613[_0xa0cc('0x58')]);return db[_0xa0cc('0x2f')]['find']({'where':{'id':_0x380613['params']['id']}})[_0xa0cc('0x3c')](handleEntityNotFound(_0x59f5b5,null))[_0xa0cc('0x3c')](saveUpdates(_0x380613[_0xa0cc('0x58')],null))['then'](respondWithResult(_0x59f5b5,null))[_0xa0cc('0x3d')](handleError(_0x59f5b5,null));}; \ No newline at end of file +var _0xaac3=['mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','redis','defaults','localhost','./dashboardItem.socket','register','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','show','keys','DashboardItem','rawAttributes','query','filters','intersection','model','attributes','fields','length','includeAll','include','merge','options','find','catch','type','iframe','attrUrl','attrs','value','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','attrVoiceQueues','multibar-chart','total','attrSerie2','attrSerie3','web-report','attrReport','error','widgetAttributes:\x20%s','stringify','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird'];(function(_0x1f9f5f,_0x509fb7){var _0x51d649=function(_0x4a5285){while(--_0x4a5285){_0x1f9f5f['push'](_0x1f9f5f['shift']());}};_0x51d649(++_0x509fb7);}(_0xaac3,0xa9));var _0x3aac=function(_0x618612,_0x5aa6ee){_0x618612=_0x618612-0x0;var _0x21cfb3=_0xaac3[_0x618612];return _0x21cfb3;};'use strict';var pdf=require(_0x3aac('0x0'));var emlformat=require(_0x3aac('0x1'));var rimraf=require(_0x3aac('0x2'));var zipdir=require(_0x3aac('0x3'));var jsonpatch=require(_0x3aac('0x4'));var rp=require('request-promise');var moment=require(_0x3aac('0x5'));var BPromise=require(_0x3aac('0x6'));var Mustache=require(_0x3aac('0x7'));var util=require(_0x3aac('0x8'));var path=require(_0x3aac('0x9'));var sox=require('sox');var csv=require(_0x3aac('0xa'));var ejs=require(_0x3aac('0xb'));var fs=require('fs');var _=require(_0x3aac('0xc'));var squel=require(_0x3aac('0xd'));var crypto=require(_0x3aac('0xe'));var jsforce=require(_0x3aac('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x3aac('0xa'));var querystring=require(_0x3aac('0x10'));var Papa=require('papaparse');var Redis=require(_0x3aac('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x3aac('0x12'));var as=require(_0x3aac('0x13'));var hardwareService=require(_0x3aac('0x14'));var logger=require(_0x3aac('0x15'))('api');var utils=require(_0x3aac('0x16'));var config=require('../../config/environment');var db=require(_0x3aac('0x17'))['db'];config[_0x3aac('0x18')]=_[_0x3aac('0x19')](config[_0x3aac('0x18')],{'host':_0x3aac('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3aac('0x18')]));require(_0x3aac('0x1b'))[_0x3aac('0x1c')](socket);function respondWithStatusCode(_0x267919,_0x19e744){_0x19e744=_0x19e744||0xcc;return function(_0x5898e3){if(_0x5898e3){return _0x267919[_0x3aac('0x1d')](_0x19e744);}return _0x267919['status'](_0x19e744)['end']();};}function respondWithResult(_0x30c60a,_0x271610){_0x271610=_0x271610||0xc8;return function(_0x41d012){if(_0x41d012){return _0x30c60a[_0x3aac('0x1e')](_0x271610)[_0x3aac('0x1f')](_0x41d012);}};}function respondWithFilteredResult(_0x2c44b9,_0x115b2a){return function(_0x3f60ed){if(_0x3f60ed){var _0x45eb4c=_0x3f60ed[_0x3aac('0x20')],_0x296004=_0x115b2a[_0x3aac('0x21')],_0x2928ec=_0x115b2a[_0x3aac('0x21')]+_0x115b2a[_0x3aac('0x22')],_0x536e50;if(_0x2928ec>=_0x45eb4c){_0x2928ec=_0x45eb4c;_0x536e50=0xc8;}else{_0x536e50=0xce;}_0x2c44b9['status'](_0x536e50);return _0x2c44b9[_0x3aac('0x23')](_0x3aac('0x24'),_0x296004+'-'+_0x2928ec+'/'+_0x45eb4c)[_0x3aac('0x1f')](_0x3f60ed);}return null;};}function patchUpdates(_0x293222){return function(_0x1cfbd6){try{jsonpatch[_0x3aac('0x25')](_0x1cfbd6,_0x293222,!![]);}catch(_0x2d7262){return BPromise[_0x3aac('0x26')](_0x2d7262);}return _0x1cfbd6[_0x3aac('0x27')]();};}function saveUpdates(_0xe306de,_0x35937e){return function(_0x113e46){if(_0x113e46){return _0x113e46[_0x3aac('0x28')](_0xe306de)[_0x3aac('0x29')](function(_0x43bce0){return _0x43bce0;});}return null;};}function removeEntity(_0x34511b,_0x3c3053){return function(_0x4676bc){if(_0x4676bc){return _0x4676bc[_0x3aac('0x2a')]()['then'](function(){_0x34511b[_0x3aac('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x16ecdc,_0x295dd6){return function(_0x3991e4){if(!_0x3991e4){_0x16ecdc[_0x3aac('0x1d')](0x194);}return _0x3991e4;};}function handleError(_0x3ab20d,_0x109f5b){_0x109f5b=_0x109f5b||0x1f4;return function(_0x1b2e41){logger['error'](_0x1b2e41[_0x3aac('0x2b')]);if(_0x1b2e41[_0x3aac('0x2c')]){delete _0x1b2e41[_0x3aac('0x2c')];}_0x3ab20d[_0x3aac('0x1e')](_0x109f5b)[_0x3aac('0x2d')](_0x1b2e41);};}exports[_0x3aac('0x2e')]=function(_0x11f0f6,_0x347575){var _0x3ecf54={'raw':![],'where':{'id':_0x11f0f6['params']['id']}},_0x4fc69c={};_0x4fc69c['model']=_[_0x3aac('0x2f')](db[_0x3aac('0x30')][_0x3aac('0x31')]);_0x4fc69c[_0x3aac('0x32')]=_[_0x3aac('0x2f')](_0x11f0f6['query']);_0x4fc69c[_0x3aac('0x33')]=_[_0x3aac('0x34')](_0x4fc69c[_0x3aac('0x35')],_0x4fc69c[_0x3aac('0x32')]);_0x3ecf54[_0x3aac('0x36')]=_[_0x3aac('0x34')](_0x4fc69c[_0x3aac('0x35')],qs[_0x3aac('0x37')](_0x11f0f6[_0x3aac('0x32')][_0x3aac('0x37')]));_0x3ecf54['attributes']=_0x3ecf54[_0x3aac('0x36')][_0x3aac('0x38')]?_0x3ecf54[_0x3aac('0x36')]:_0x4fc69c[_0x3aac('0x35')];if(_0x11f0f6[_0x3aac('0x32')][_0x3aac('0x39')]){_0x3ecf54[_0x3aac('0x3a')]=[{'all':!![]}];}_0x3ecf54=_[_0x3aac('0x3b')]({},_0x3ecf54,_0x11f0f6[_0x3aac('0x3c')]);return db['DashboardItem'][_0x3aac('0x3d')](_0x3ecf54)[_0x3aac('0x29')](handleEntityNotFound(_0x347575,null))[_0x3aac('0x29')](respondWithResult(_0x347575,null))[_0x3aac('0x3e')](handleError(_0x347575,null));};exports[_0x3aac('0x2a')]=function(_0x8f4f5,_0x44b20c){return db[_0x3aac('0x30')][_0x3aac('0x3d')]({'where':{'id':_0x8f4f5['params']['id']}})[_0x3aac('0x29')](handleEntityNotFound(_0x44b20c,null))['then'](removeEntity(_0x44b20c,null))[_0x3aac('0x3e')](handleError(_0x44b20c,null));};function widgetAttributes(_0x20efcf){try{switch(_0x20efcf[_0x3aac('0x3f')]){case _0x3aac('0x40'):return[{'name':_0x3aac('0x41'),'value':_0x20efcf[_0x3aac('0x41')]||(_0x20efcf[_0x3aac('0x42')]&&_0x20efcf[_0x3aac('0x42')][0x0]?_0x20efcf[_0x3aac('0x42')][0x0][_0x3aac('0x43')]:undefined)||'https://'}];case'custom':return[{'name':'attrPath','value':_0x20efcf['attrPath']||(_0x20efcf[_0x3aac('0x42')]&&_0x20efcf[_0x3aac('0x42')][0x0]?_0x20efcf[_0x3aac('0x42')][0x0][_0x3aac('0x43')]:undefined)||''}];case _0x3aac('0x44'):return[{'name':_0x3aac('0x45'),'value':_0x20efcf[_0x3aac('0x45')]||(_0x20efcf[_0x3aac('0x42')]&&_0x20efcf['attrs'][0x0]?_0x20efcf[_0x3aac('0x42')][0x0][_0x3aac('0x43')]:undefined)||_0x3aac('0x46')},{'name':_0x3aac('0x47'),'value':_0x20efcf[_0x3aac('0x47')]||(_0x20efcf[_0x3aac('0x42')]&&_0x20efcf[_0x3aac('0x42')][0x1]?_0x20efcf[_0x3aac('0x42')][0x1][_0x3aac('0x43')]:undefined)||_0x3aac('0x48')},{'name':_0x3aac('0x49'),'value':_0x20efcf[_0x3aac('0x49')]||(_0x20efcf[_0x3aac('0x42')]&&_0x20efcf[_0x3aac('0x42')][0x2]?_0x20efcf[_0x3aac('0x42')][0x2]['value']:undefined)||0xc}];case _0x3aac('0x4a'):return[{'name':_0x3aac('0x4b'),'value':_0x20efcf[_0x3aac('0x4b')]||(_0x20efcf['attrs']&&_0x20efcf[_0x3aac('0x42')][0x0]?_0x20efcf[_0x3aac('0x42')][0x0][_0x3aac('0x43')]:undefined)||'total'},{'name':'attrVoiceQueues','value':_0x20efcf[_0x3aac('0x4c')]||(_0x20efcf['attrs']&&_0x20efcf[_0x3aac('0x42')][0x1]?_0x20efcf[_0x3aac('0x42')][0x1][_0x3aac('0x43')]:undefined)||[]},{'name':'attrFontSize','value':_0x20efcf[_0x3aac('0x49')]||(_0x20efcf['attrs']&&_0x20efcf[_0x3aac('0x42')][0x2]?_0x20efcf[_0x3aac('0x42')][0x2][_0x3aac('0x43')]:undefined)||0x14}];case _0x3aac('0x4d'):case'pie-chart':return[{'name':'attrSerie1','value':_0x20efcf['attrSerie1']||(_0x20efcf[_0x3aac('0x42')]&&_0x20efcf[_0x3aac('0x42')][0x0]?_0x20efcf[_0x3aac('0x42')][0x0]['value']:undefined)||_0x3aac('0x4e')},{'name':_0x3aac('0x4f'),'value':_0x20efcf[_0x3aac('0x4f')]||(_0x20efcf[_0x3aac('0x42')]&&_0x20efcf[_0x3aac('0x42')][0x1]?_0x20efcf[_0x3aac('0x42')][0x1][_0x3aac('0x43')]:undefined)||null},{'name':_0x3aac('0x50'),'value':_0x20efcf[_0x3aac('0x50')]||(_0x20efcf[_0x3aac('0x42')]&&_0x20efcf[_0x3aac('0x42')][0x2]?_0x20efcf['attrs'][0x2][_0x3aac('0x43')]:undefined)||null},{'name':_0x3aac('0x4c'),'value':_0x20efcf[_0x3aac('0x4c')]||(_0x20efcf[_0x3aac('0x42')]&&_0x20efcf[_0x3aac('0x42')][0x3]?_0x20efcf['attrs'][0x3]['value']:undefined)||[]}];case _0x3aac('0x51'):return[{'name':_0x3aac('0x52'),'type':_0x20efcf['reportType']||(_0x20efcf[_0x3aac('0x42')]&&_0x20efcf[_0x3aac('0x42')][0x0]?_0x20efcf[_0x3aac('0x42')][0x0]['type']:undefined)||null,'value':_0x20efcf[_0x3aac('0x52')]||(_0x20efcf['attrs']&&_0x20efcf[_0x3aac('0x42')][0x0]?_0x20efcf[_0x3aac('0x42')][0x0][_0x3aac('0x43')]:undefined)||null},{'name':'attrRefresh','value':_0x20efcf['attrRefresh']||(_0x20efcf[_0x3aac('0x42')]&&_0x20efcf[_0x3aac('0x42')][0x1]?_0x20efcf[_0x3aac('0x42')][0x1][_0x3aac('0x43')]:undefined)||0x0}];default:return[];}}catch(_0x4834c5){logger[_0x3aac('0x53')](_0x3aac('0x54'),JSON[_0x3aac('0x55')](_0x4834c5));return[];}}exports[_0x3aac('0x56')]=function(_0x58a724,_0x17b6e7){if(_0x58a724['body']){_0x58a724['body'][_0x3aac('0x42')]=widgetAttributes(_0x58a724[_0x3aac('0x57')]);}return db[_0x3aac('0x30')][_0x3aac('0x56')](_0x58a724[_0x3aac('0x57')],{})[_0x3aac('0x29')](respondWithResult(_0x17b6e7,0xc9))['catch'](handleError(_0x17b6e7,null));};exports[_0x3aac('0x28')]=function(_0x2797c7,_0x902f23){if(_0x2797c7[_0x3aac('0x57')]['id']){delete _0x2797c7[_0x3aac('0x57')]['id'];}_0x2797c7['body']['attrs']=widgetAttributes(_0x2797c7[_0x3aac('0x57')]);return db['DashboardItem']['find']({'where':{'id':_0x2797c7['params']['id']}})[_0x3aac('0x29')](handleEntityNotFound(_0x902f23,null))[_0x3aac('0x29')](saveUpdates(_0x2797c7[_0x3aac('0x57')],null))[_0x3aac('0x29')](respondWithResult(_0x902f23,null))['catch'](handleError(_0x902f23,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index a165bb8..3143256 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 _0xed00=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','update','remove'];(function(_0xd6af50,_0x4a2652){var _0x11ba01=function(_0x1eda4c){while(--_0x1eda4c){_0xd6af50['push'](_0xd6af50['shift']());}};_0x11ba01(++_0x4a2652);}(_0xed00,0xca));var _0x0ed0=function(_0x895358,_0x32f914){_0x895358=_0x895358-0x0;var _0x26e26e=_0xed00[_0x895358];return _0x26e26e;};'use strict';var EventEmitter=require(_0x0ed0('0x0'));var DashboardItem=require(_0x0ed0('0x1'))['db']['DashboardItem'];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x0ed0('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x0ed0('0x3'),'afterDestroy':_0x0ed0('0x4')};function emitEvent(_0x1644de){return function(_0x14ea52,_0x1fdc39,_0x3ceb6c){DashboardItemEvents[_0x0ed0('0x5')](_0x1644de+':'+_0x14ea52['id'],_0x14ea52);DashboardItemEvents[_0x0ed0('0x5')](_0x1644de,_0x14ea52);_0x3ceb6c(null);};}for(var e in events){if(events[_0x0ed0('0x6')](e)){var event=events[e];DashboardItem[_0x0ed0('0x7')](e,emitEvent(event));}}module[_0x0ed0('0x8')]=DashboardItemEvents; \ No newline at end of file +var _0x2159=['../../mysqldb','DashboardItem','setMaxListeners','update','emit','hasOwnProperty','hook','events'];(function(_0x1715bf,_0x28563e){var _0x57721e=function(_0xda5034){while(--_0xda5034){_0x1715bf['push'](_0x1715bf['shift']());}};_0x57721e(++_0x28563e);}(_0x2159,0x17f));var _0x9215=function(_0x11b55f,_0x4bf278){_0x11b55f=_0x11b55f-0x0;var _0xf39291=_0x2159[_0x11b55f];return _0xf39291;};'use strict';var EventEmitter=require(_0x9215('0x0'));var DashboardItem=require(_0x9215('0x1'))['db'][_0x9215('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x9215('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x9215('0x4'),'afterDestroy':'remove'};function emitEvent(_0x40501b){return function(_0x3128f9,_0x202c8d,_0x7933e9){DashboardItemEvents[_0x9215('0x5')](_0x40501b+':'+_0x3128f9['id'],_0x3128f9);DashboardItemEvents[_0x9215('0x5')](_0x40501b,_0x3128f9);_0x7933e9(null);};}for(var e in events){if(events[_0x9215('0x6')](e)){var event=events[e];DashboardItem[_0x9215('0x7')](e,emitEvent(event));}}module['exports']=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index 2e1c9f9..37bf7a0 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 _0xd5ab=['request-promise','define','DashboardItem','lodash','util','api','moment','bluebird'];(function(_0x11cb5d,_0x186502){var _0x2ba781=function(_0x596e7a){while(--_0x596e7a){_0x11cb5d['push'](_0x11cb5d['shift']());}};_0x2ba781(++_0x186502);}(_0xd5ab,0x163));var _0xbd5a=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xd5ab[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0xbd5a('0x0'));var util=require(_0xbd5a('0x1'));var logger=require('../../config/logger')(_0xbd5a('0x2'));var moment=require(_0xbd5a('0x3'));var BPromise=require(_0xbd5a('0x4'));var rp=require(_0xbd5a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./dashboardItem.attributes');module['exports']=function(_0x2e344d,_0x3e8f2f){return _0x2e344d[_0xbd5a('0x6')](_0xbd5a('0x7'),attributes,{'tableName':'dashboard_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x16ce=['request-promise','rimraf','../../config/environment','./dashboardItem.attributes','lodash','util','api','moment'];(function(_0x2bdb87,_0x48e132){var _0x2bbca4=function(_0x5047fb){while(--_0x5047fb){_0x2bdb87['push'](_0x2bdb87['shift']());}};_0x2bbca4(++_0x48e132);}(_0x16ce,0x134));var _0xe16c=function(_0x20fd63,_0x11d8e7){_0x20fd63=_0x20fd63-0x0;var _0x2ab394=_0x16ce[_0x20fd63];return _0x2ab394;};'use strict';var _=require(_0xe16c('0x0'));var util=require(_0xe16c('0x1'));var logger=require('../../config/logger')(_0xe16c('0x2'));var moment=require(_0xe16c('0x3'));var BPromise=require('bluebird');var rp=require(_0xe16c('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe16c('0x5'));var config=require(_0xe16c('0x6'));var attributes=require(_0xe16c('0x7'));module['exports']=function(_0x568096,_0x56f7fa){return _0x568096['define']('DashboardItem',attributes,{'tableName':'dashboard_items','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 6c79e73..94563cd 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 _0x1e16=['catch','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','redis','localhost','request','request\x20sent','stringify','error','code','DashboardItem,\x20%s,\x20%s','message','info','result'];(function(_0x4cbdb7,_0x1b82f6){var _0x4ecb18=function(_0x48271f){while(--_0x48271f){_0x4cbdb7['push'](_0x4cbdb7['shift']());}};_0x4ecb18(++_0x1b82f6);}(_0x1e16,0xbe));var _0x61e1=function(_0x2a2166,_0x3a077f){_0x2a2166=_0x2a2166-0x0;var _0x3bcf50=_0x1e16[_0x2a2166];return _0x3bcf50;};'use strict';var _=require(_0x61e1('0x0'));var util=require('util');var moment=require(_0x61e1('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x61e1('0x2'));var db=require(_0x61e1('0x3'))['db'];var utils=require(_0x61e1('0x4'));var logger=require(_0x61e1('0x5'))(_0x61e1('0x6'));var config=require('../../config/environment');var jayson=require(_0x61e1('0x7'));var client=jayson[_0x61e1('0x8')]['http']({'port':0x232a});config[_0x61e1('0x9')]=_['defaults'](config['redis'],{'host':_0x61e1('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x61e1('0x9')]));require('./dashboardItem.socket')['register'](socket);function respondWithRpcPromise(_0x2d8828,_0x32044a,_0x28ca99){return new BPromise(function(_0x4ec780,_0x12c3b4){return client[_0x61e1('0xb')](_0x2d8828,_0x28ca99)['then'](function(_0x2716e7){logger['info']('DashboardItem,\x20%s,\x20%s',_0x32044a,'request\x20sent');logger['debug']('DashboardItem,\x20%s,\x20%s,\x20%s',_0x32044a,_0x61e1('0xc'),JSON[_0x61e1('0xd')](_0x2716e7));if(_0x2716e7[_0x61e1('0xe')]){if(_0x2716e7['error'][_0x61e1('0xf')]===0x1f4){logger[_0x61e1('0xe')](_0x61e1('0x10'),_0x32044a,_0x2716e7[_0x61e1('0xe')][_0x61e1('0x11')]);return _0x12c3b4(_0x2716e7[_0x61e1('0xe')][_0x61e1('0x11')]);}logger['error'](_0x61e1('0x10'),_0x32044a,_0x2716e7[_0x61e1('0xe')][_0x61e1('0x11')]);return _0x4ec780(_0x2716e7['error'][_0x61e1('0x11')]);}else{logger[_0x61e1('0x12')]('DashboardItem,\x20%s,\x20%s',_0x32044a,_0x61e1('0xc'));_0x4ec780(_0x2716e7[_0x61e1('0x13')]['message']);}})[_0x61e1('0x14')](function(_0x512a9a){logger['error'](_0x61e1('0x10'),_0x32044a,_0x512a9a);_0x12c3b4(_0x512a9a);});});} \ No newline at end of file +var _0xb79b=['DashboardItem,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','socket.io-emitter','./dashboardItem.socket','register','request','then','info'];(function(_0x4cbbc6,_0x2932a8){var _0x2db5bb=function(_0x2d0a79){while(--_0x2d0a79){_0x4cbbc6['push'](_0x4cbbc6['shift']());}};_0x2db5bb(++_0x2932a8);}(_0xb79b,0xe0));var _0xbb79=function(_0x2b28b6,_0x82682d){_0x2b28b6=_0x2b28b6-0x0;var _0x4af937=_0xb79b[_0x2b28b6];return _0x4af937;};'use strict';var _=require(_0xbb79('0x0'));var util=require(_0xbb79('0x1'));var moment=require(_0xbb79('0x2'));var BPromise=require(_0xbb79('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbb79('0x4'));var db=require(_0xbb79('0x5'))['db'];var utils=require(_0xbb79('0x6'));var logger=require(_0xbb79('0x7'))(_0xbb79('0x8'));var config=require(_0xbb79('0x9'));var jayson=require(_0xbb79('0xa'));var client=jayson['client'][_0xbb79('0xb')]({'port':0x232a});config[_0xbb79('0xc')]=_['defaults'](config[_0xbb79('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xbb79('0xd'))(new Redis(config[_0xbb79('0xc')]));require(_0xbb79('0xe'))[_0xbb79('0xf')](socket);function respondWithRpcPromise(_0x43c826,_0x1c283,_0x48518f){return new BPromise(function(_0x4700a9,_0xe3c69d){return client[_0xbb79('0x10')](_0x43c826,_0x48518f)[_0xbb79('0x11')](function(_0x55d163){logger[_0xbb79('0x12')](_0xbb79('0x13'),_0x1c283,_0xbb79('0x14'));logger[_0xbb79('0x15')]('DashboardItem,\x20%s,\x20%s,\x20%s',_0x1c283,'request\x20sent',JSON[_0xbb79('0x16')](_0x55d163));if(_0x55d163[_0xbb79('0x17')]){if(_0x55d163[_0xbb79('0x17')][_0xbb79('0x18')]===0x1f4){logger[_0xbb79('0x17')](_0xbb79('0x13'),_0x1c283,_0x55d163[_0xbb79('0x17')][_0xbb79('0x19')]);return _0xe3c69d(_0x55d163['error'][_0xbb79('0x19')]);}logger['error'](_0xbb79('0x13'),_0x1c283,_0x55d163['error'][_0xbb79('0x19')]);return _0x4700a9(_0x55d163[_0xbb79('0x17')][_0xbb79('0x19')]);}else{logger[_0xbb79('0x12')](_0xbb79('0x13'),_0x1c283,_0xbb79('0x14'));_0x4700a9(_0x55d163['result'][_0xbb79('0x19')]);}})[_0xbb79('0x1a')](function(_0x2d04cc){logger['error'](_0xbb79('0x13'),_0x1c283,_0x2d04cc);_0xe3c69d(_0x2d04cc);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index be0632f..72f1b4f 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 _0x8632=['update','emit','removeListener','register','length','save','remove'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x8632,0xec));var _0x2863=function(_0x593564,_0x43583f){_0x593564=_0x593564-0x0;var _0x211a89=_0x8632[_0x593564];return _0x211a89;};'use strict';var DashboardItemEvents=require('./dashboardItem.events');var events=[_0x2863('0x0'),_0x2863('0x1'),_0x2863('0x2')];function createListener(_0x4ef096,_0x5ab8bd){return function(_0x26b2bd){_0x5ab8bd[_0x2863('0x3')](_0x4ef096,_0x26b2bd);};}function removeListener(_0x393bcc,_0xcf05b0){return function(){DashboardItemEvents[_0x2863('0x4')](_0x393bcc,_0xcf05b0);};}exports[_0x2863('0x5')]=function(_0x501e48){for(var _0x385ff3=0x0,_0x44c45a=events[_0x2863('0x6')];_0x385ff3<_0x44c45a;_0x385ff3++){var _0x5cf15c=events[_0x385ff3];var _0x550579=createListener('dashboardItem:'+_0x5cf15c,_0x501e48);DashboardItemEvents['on'](_0x5cf15c,_0x550579);}}; \ No newline at end of file +var _0x68cf=['register','length','dashboardItem:','./dashboardItem.events','emit','removeListener'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x68cf,0xd5));var _0xf68c=function(_0x2ac211,_0x5b3776){_0x2ac211=_0x2ac211-0x0;var _0x53179d=_0x68cf[_0x2ac211];return _0x53179d;};'use strict';var DashboardItemEvents=require(_0xf68c('0x0'));var events=['save','remove','update'];function createListener(_0x3629ec,_0x34770f){return function(_0x5d70a1){_0x34770f[_0xf68c('0x1')](_0x3629ec,_0x5d70a1);};}function removeListener(_0x598c15,_0x4905e6){return function(){DashboardItemEvents[_0xf68c('0x2')](_0x598c15,_0x4905e6);};}exports[_0xf68c('0x3')]=function(_0x52eaa1){for(var _0x52532f=0x0,_0x398fef=events[_0xf68c('0x4')];_0x52532f<_0x398fef;_0x52532f++){var _0x1e24c0=events[_0x52532f];var _0x47dc1c=createListener(_0xf68c('0x5')+_0x1e24c0,_0x52eaa1);DashboardItemEvents['on'](_0x1e24c0,_0x47dc1c);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index 3fad872..3457499 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 _0x2675=['multer','express','Router','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','show','post','put','update','destroy'];(function(_0x1d2ebd,_0x362dc8){var _0x4c568d=function(_0x4563b2){while(--_0x4563b2){_0x1d2ebd['push'](_0x1d2ebd['shift']());}};_0x4c568d(++_0x362dc8);}(_0x2675,0x75));var _0x5267=function(_0xccfcd2,_0xc48435){_0xccfcd2=_0xccfcd2-0x0;var _0x3f92c9=_0x2675[_0xccfcd2];return _0x3f92c9;};'use strict';var multer=require(_0x5267('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5267('0x1'));var router=express[_0x5267('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0x5267('0x3'));var config=require(_0x5267('0x4'));var controller=require('./dashboardItem.controller');router[_0x5267('0x5')](_0x5267('0x6'),auth[_0x5267('0x7')](),controller[_0x5267('0x8')]);router[_0x5267('0x9')]('/',auth[_0x5267('0x7')](),controller['create']);router[_0x5267('0xa')](_0x5267('0x6'),auth['isAuthenticated'](),controller[_0x5267('0xb')]);router['delete'](_0x5267('0x6'),auth[_0x5267('0x7')](),controller[_0x5267('0xc')]);module['exports']=router; \ No newline at end of file +var _0x3f8a=['isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboardItem.controller','get','/:id'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x3f8a,0x1d5));var _0xa3f8=function(_0xca43f7,_0x131f4b){_0xca43f7=_0xca43f7-0x0;var _0x53364e=_0x3f8a[_0xca43f7];return _0x53364e;};'use strict';var multer=require(_0xa3f8('0x0'));var util=require(_0xa3f8('0x1'));var path=require(_0xa3f8('0x2'));var timeout=require(_0xa3f8('0x3'));var express=require('express');var router=express[_0xa3f8('0x4')]();var auth=require(_0xa3f8('0x5'));var interaction=require(_0xa3f8('0x6'));var config=require(_0xa3f8('0x7'));var controller=require(_0xa3f8('0x8'));router[_0xa3f8('0x9')](_0xa3f8('0xa'),auth[_0xa3f8('0xb')](),controller[_0xa3f8('0xc')]);router[_0xa3f8('0xd')]('/',auth[_0xa3f8('0xb')](),controller[_0xa3f8('0xe')]);router[_0xa3f8('0xf')](_0xa3f8('0xa'),auth[_0xa3f8('0xb')](),controller[_0xa3f8('0x10')]);router[_0xa3f8('0x11')]('/:id',auth[_0xa3f8('0xb')](),controller[_0xa3f8('0x12')]);module[_0xa3f8('0x13')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index ccddbb1..5350b36 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 _0x9653=['sequelize','exports','STRING'];(function(_0x53d172,_0x46611b){var _0x1bd0a2=function(_0x19fb52){while(--_0x19fb52){_0x53d172['push'](_0x53d172['shift']());}};_0x1bd0a2(++_0x46611b);}(_0x9653,0x75));var _0x3965=function(_0x2695ea,_0x961e33){_0x2695ea=_0x2695ea-0x0;var _0x262fec=_0x9653[_0x2695ea];return _0x262fec;};'use strict';var Sequelize=require(_0x3965('0x0'));module[_0x3965('0x1')]={'name':{'type':Sequelize[_0x3965('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xbe04=['STRING','sequelize','exports'];(function(_0x47fd7c,_0x3baee4){var _0x66923a=function(_0x510e3f){while(--_0x510e3f){_0x47fd7c['push'](_0x47fd7c['shift']());}};_0x66923a(++_0x3baee4);}(_0xbe04,0x9d));var _0x4be0=function(_0x36bfe3,_0x358938){_0x36bfe3=_0x36bfe3-0x0;var _0x9b0436=_0xbe04[_0x36bfe3];return _0x9b0436;};'use strict';var Sequelize=require(_0x4be0('0x0'));module[_0x4be0('0x1')]={'name':{'type':Sequelize[_0x4be0('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 c02e373..6395000 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 _0xdb94=['bluebird','mustache','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','apply','reject','save','update','then','destroy','get','Dispositions','UserProfileResource','error','name','send','index','map','Disposition','rawAttributes','fieldName','key','model','query','filters','fields','attributes','length','order','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','rows','params','keys','intersection','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','find','userProfileId','autoAssociation','eml-format','rimraf','fast-json-patch','request-promise','moment'];(function(_0x242f67,_0x133c3a){var _0x3256bf=function(_0x147a21){while(--_0x147a21){_0x242f67['push'](_0x242f67['shift']());}};_0x3256bf(++_0x133c3a);}(_0xdb94,0xe5));var _0x4db9=function(_0x4134d6,_0x255f70){_0x4134d6=_0x4134d6-0x0;var _0x1a9f6c=_0xdb94[_0x4134d6];return _0x1a9f6c;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x4db9('0x0'));var rimraf=require(_0x4db9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4db9('0x2'));var rp=require(_0x4db9('0x3'));var moment=require(_0x4db9('0x4'));var BPromise=require(_0x4db9('0x5'));var Mustache=require(_0x4db9('0x6'));var util=require('util');var path=require(_0x4db9('0x7'));var sox=require('sox');var csv=require(_0x4db9('0x8'));var ejs=require(_0x4db9('0x9'));var fs=require('fs');var _=require(_0x4db9('0xa'));var squel=require(_0x4db9('0xb'));var crypto=require(_0x4db9('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x4db9('0xd'));var toCsv=require(_0x4db9('0x8'));var querystring=require(_0x4db9('0xe'));var Papa=require(_0x4db9('0xf'));var Redis=require(_0x4db9('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x4db9('0x11'));var as=require(_0x4db9('0x12'));var hardwareService=require(_0x4db9('0x13'));var logger=require(_0x4db9('0x14'))(_0x4db9('0x15'));var utils=require(_0x4db9('0x16'));var config=require('../../config/environment');var db=require(_0x4db9('0x17'))['db'];function respondWithStatusCode(_0x4397fc,_0x59f01c){_0x59f01c=_0x59f01c||0xcc;return function(_0x549c92){if(_0x549c92){return _0x4397fc[_0x4db9('0x18')](_0x59f01c);}return _0x4397fc[_0x4db9('0x19')](_0x59f01c)[_0x4db9('0x1a')]();};}function respondWithResult(_0x4d4046,_0x1a93be){_0x1a93be=_0x1a93be||0xc8;return function(_0x3dde55){if(_0x3dde55){return _0x4d4046[_0x4db9('0x19')](_0x1a93be)[_0x4db9('0x1b')](_0x3dde55);}};}function respondWithFilteredResult(_0x2d89a7,_0x585230){return function(_0x1b1062){if(_0x1b1062){var _0x1a5a9c=_0x1b1062[_0x4db9('0x1c')],_0x5d4d70=_0x585230['offset'],_0x27b387=_0x585230[_0x4db9('0x1d')]+_0x585230[_0x4db9('0x1e')],_0x7df575;if(_0x27b387>=_0x1a5a9c){_0x27b387=_0x1a5a9c;_0x7df575=0xc8;}else{_0x7df575=0xce;}_0x2d89a7['status'](_0x7df575);return _0x2d89a7['set']('Content-Range',_0x5d4d70+'-'+_0x27b387+'/'+_0x1a5a9c)[_0x4db9('0x1b')](_0x1b1062);}return null;};}function patchUpdates(_0x4235ab){return function(_0x48ff99){try{jsonpatch[_0x4db9('0x1f')](_0x48ff99,_0x4235ab,!![]);}catch(_0x1f6b24){return BPromise[_0x4db9('0x20')](_0x1f6b24);}return _0x48ff99[_0x4db9('0x21')]();};}function saveUpdates(_0x439433,_0x28b7f6){return function(_0x34a6ed){if(_0x34a6ed){return _0x34a6ed[_0x4db9('0x22')](_0x439433)[_0x4db9('0x23')](function(_0x41d0c1){return _0x41d0c1;});}return null;};}function removeEntity(_0x29b4ff,_0x102402){return function(_0x4d56a1){if(_0x4d56a1){return _0x4d56a1[_0x4db9('0x24')]()[_0x4db9('0x23')](function(){var _0x56a550=_0x4d56a1[_0x4db9('0x25')]({'plain':!![]});var _0x3f4931=_0x4db9('0x26');return db[_0x4db9('0x27')]['destroy']({'where':{'type':_0x3f4931,'resourceId':_0x56a550['id']}})[_0x4db9('0x23')](function(){return _0x4d56a1;});})['then'](function(){_0x29b4ff[_0x4db9('0x19')](0xcc)[_0x4db9('0x1a')]();});}};}function handleEntityNotFound(_0x135aa7,_0x47e89c){return function(_0x293933){if(!_0x293933){_0x135aa7[_0x4db9('0x18')](0x194);}return _0x293933;};}function handleError(_0x47464d,_0x5e7d29){_0x5e7d29=_0x5e7d29||0x1f4;return function(_0x5f59be){logger[_0x4db9('0x28')](_0x5f59be['stack']);if(_0x5f59be[_0x4db9('0x29')]){delete _0x5f59be[_0x4db9('0x29')];}_0x47464d[_0x4db9('0x19')](_0x5e7d29)[_0x4db9('0x2a')](_0x5f59be);};}exports[_0x4db9('0x2b')]=function(_0x3c3fcf,_0x1d0dc2){var _0x373a7d={},_0x4c4a47={},_0x35f757={'count':0x0,'rows':[]};var _0x57c1af=_[_0x4db9('0x2c')](db[_0x4db9('0x2d')][_0x4db9('0x2e')],function(_0x314e64){return{'name':_0x314e64[_0x4db9('0x2f')],'type':_0x314e64['type'][_0x4db9('0x30')]};});_0x4c4a47[_0x4db9('0x31')]=_[_0x4db9('0x2c')](_0x57c1af,_0x4db9('0x29'));_0x4c4a47['query']=_['keys'](_0x3c3fcf[_0x4db9('0x32')]);_0x4c4a47[_0x4db9('0x33')]=_['intersection'](_0x4c4a47['model'],_0x4c4a47[_0x4db9('0x32')]);_0x373a7d['attributes']=_['intersection'](_0x4c4a47[_0x4db9('0x31')],qs[_0x4db9('0x34')](_0x3c3fcf['query'][_0x4db9('0x34')]));_0x373a7d[_0x4db9('0x35')]=_0x373a7d[_0x4db9('0x35')][_0x4db9('0x36')]?_0x373a7d['attributes']:_0x4c4a47[_0x4db9('0x31')];if(!_0x3c3fcf['query']['hasOwnProperty']('nolimit')){_0x373a7d[_0x4db9('0x1e')]=qs[_0x4db9('0x1e')](_0x3c3fcf['query'][_0x4db9('0x1e')]);_0x373a7d[_0x4db9('0x1d')]=qs['offset'](_0x3c3fcf['query']['offset']);}_0x373a7d[_0x4db9('0x37')]=qs['sort'](_0x3c3fcf[_0x4db9('0x32')]['sort']);_0x373a7d[_0x4db9('0x38')]=qs[_0x4db9('0x33')](_[_0x4db9('0x39')](_0x3c3fcf[_0x4db9('0x32')],_0x4c4a47[_0x4db9('0x33')]));if(_0x3c3fcf['query'][_0x4db9('0x3a')]){_0x373a7d['where']=_[_0x4db9('0x3b')](_0x373a7d[_0x4db9('0x38')],{'$or':_[_0x4db9('0x2c')](_0x57c1af,function(_0x1c895e){if(_0x1c895e[_0x4db9('0x3c')]!==_0x4db9('0x3d')){var _0x52b00c={};_0x52b00c[_0x1c895e[_0x4db9('0x29')]]={'$like':'%'+_0x3c3fcf[_0x4db9('0x32')]['filter']+'%'};return _0x52b00c;}})});}_0x373a7d=_['merge']({},_0x373a7d,_0x3c3fcf[_0x4db9('0x3e')]);var _0x45142f={'where':_0x373a7d[_0x4db9('0x38')]};return db[_0x4db9('0x2d')][_0x4db9('0x1c')](_0x45142f)[_0x4db9('0x23')](function(_0x1a9fe7){_0x35f757[_0x4db9('0x1c')]=_0x1a9fe7;if(_0x3c3fcf[_0x4db9('0x32')][_0x4db9('0x3f')]){_0x373a7d[_0x4db9('0x40')]=[{'all':!![]}];}return db[_0x4db9('0x2d')]['findAll'](_0x373a7d);})[_0x4db9('0x23')](function(_0x4a2121){_0x35f757[_0x4db9('0x41')]=_0x4a2121;return _0x35f757;})[_0x4db9('0x23')](respondWithFilteredResult(_0x1d0dc2,_0x373a7d))['catch'](handleError(_0x1d0dc2,null));};exports['show']=function(_0x248891,_0x2b18a2){var _0x2fc233={'raw':!![],'where':{'id':_0x248891[_0x4db9('0x42')]['id']}},_0x5ddcd4={};_0x5ddcd4['model']=_[_0x4db9('0x43')](db[_0x4db9('0x2d')][_0x4db9('0x2e')]);_0x5ddcd4[_0x4db9('0x32')]=_[_0x4db9('0x43')](_0x248891['query']);_0x5ddcd4[_0x4db9('0x33')]=_[_0x4db9('0x44')](_0x5ddcd4[_0x4db9('0x31')],_0x5ddcd4[_0x4db9('0x32')]);_0x2fc233[_0x4db9('0x35')]=_['intersection'](_0x5ddcd4[_0x4db9('0x31')],qs[_0x4db9('0x34')](_0x248891[_0x4db9('0x32')][_0x4db9('0x34')]));_0x2fc233[_0x4db9('0x35')]=_0x2fc233[_0x4db9('0x35')][_0x4db9('0x36')]?_0x2fc233[_0x4db9('0x35')]:_0x5ddcd4[_0x4db9('0x31')];if(_0x248891['query'][_0x4db9('0x3f')]){_0x2fc233['include']=[{'all':!![]}];}_0x2fc233=_['merge']({},_0x2fc233,_0x248891[_0x4db9('0x3e')]);return db[_0x4db9('0x2d')]['find'](_0x2fc233)['then'](handleEntityNotFound(_0x2b18a2,null))[_0x4db9('0x23')](respondWithResult(_0x2b18a2,null))[_0x4db9('0x45')](handleError(_0x2b18a2,null));};exports[_0x4db9('0x46')]=function(_0x7f0aac,_0x2c2c17){return db[_0x4db9('0x2d')][_0x4db9('0x46')](_0x7f0aac[_0x4db9('0x47')],{})[_0x4db9('0x23')](function(_0x16c695){var _0x43312c=_0x7f0aac['user'][_0x4db9('0x25')]({'plain':!![]});if(!_0x43312c)throw new Error(_0x4db9('0x48'));if(_0x43312c['role']===_0x4db9('0x49')){var _0x5a461d=_0x16c695[_0x4db9('0x25')]({'plain':!![]});var _0x448010=_0x4db9('0x26');return db[_0x4db9('0x4a')][_0x4db9('0x4b')]({'where':{'name':_0x448010,'userProfileId':_0x43312c[_0x4db9('0x4c')]},'raw':!![]})[_0x4db9('0x23')](function(_0x3b8d8c){if(_0x3b8d8c&&_0x3b8d8c[_0x4db9('0x4d')]===0x0){return db[_0x4db9('0x27')][_0x4db9('0x46')]({'name':_0x5a461d[_0x4db9('0x29')],'resourceId':_0x5a461d['id'],'type':_0x3b8d8c[_0x4db9('0x29')],'sectionId':_0x3b8d8c['id']},{})['then'](function(){return _0x16c695;});}else{return _0x16c695;}})['catch'](function(_0x5ececc){logger[_0x4db9('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5ececc);throw _0x5ececc;});}return _0x16c695;})[_0x4db9('0x23')](respondWithResult(_0x2c2c17,0xc9))['catch'](handleError(_0x2c2c17,null));};exports[_0x4db9('0x22')]=function(_0x2ab2aa,_0x5f2072){if(_0x2ab2aa['body']['id']){delete _0x2ab2aa[_0x4db9('0x47')]['id'];}return db[_0x4db9('0x2d')][_0x4db9('0x4b')]({'where':{'id':_0x2ab2aa[_0x4db9('0x42')]['id']}})[_0x4db9('0x23')](handleEntityNotFound(_0x5f2072,null))[_0x4db9('0x23')](saveUpdates(_0x2ab2aa[_0x4db9('0x47')],null))[_0x4db9('0x23')](respondWithResult(_0x5f2072,null))['catch'](handleError(_0x5f2072,null));};exports[_0x4db9('0x24')]=function(_0x43253f,_0x12dc10){return db[_0x4db9('0x2d')][_0x4db9('0x4b')]({'where':{'id':_0x43253f['params']['id']}})[_0x4db9('0x23')](handleEntityNotFound(_0x12dc10,null))[_0x4db9('0x23')](removeEntity(_0x12dc10,null))[_0x4db9('0x45')](handleError(_0x12dc10,null));}; \ No newline at end of file +var _0xe14d=['includeAll','include','rows','catch','params','options','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','reject','update','then','destroy','get','Dispositions','error','stack','name','send','index','map','Disposition','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','order','pick','filter','where','merge','type','VIRTUAL'];(function(_0x404a11,_0x5d5647){var _0x471865=function(_0x2e3bc8){while(--_0x2e3bc8){_0x404a11['push'](_0x404a11['shift']());}};_0x471865(++_0x5d5647);}(_0xe14d,0x1ee));var _0xde14=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xe14d[_0x3b380d];return _0x54502b;};'use strict';var pdf=require(_0xde14('0x0'));var emlformat=require(_0xde14('0x1'));var rimraf=require(_0xde14('0x2'));var zipdir=require(_0xde14('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xde14('0x4'));var moment=require(_0xde14('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xde14('0x6'));var util=require(_0xde14('0x7'));var path=require(_0xde14('0x8'));var sox=require(_0xde14('0x9'));var csv=require(_0xde14('0xa'));var ejs=require(_0xde14('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xde14('0xc'));var jsforce=require(_0xde14('0xd'));var deskjs=require(_0xde14('0xe'));var toCsv=require(_0xde14('0xa'));var querystring=require(_0xde14('0xf'));var Papa=require(_0xde14('0x10'));var Redis=require(_0xde14('0x11'));var authService=require(_0xde14('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xde14('0x13'));var hardwareService=require(_0xde14('0x14'));var logger=require(_0xde14('0x15'))(_0xde14('0x16'));var utils=require(_0xde14('0x17'));var config=require(_0xde14('0x18'));var db=require(_0xde14('0x19'))['db'];function respondWithStatusCode(_0x3d5a29,_0x34e28f){_0x34e28f=_0x34e28f||0xcc;return function(_0x29e3ca){if(_0x29e3ca){return _0x3d5a29[_0xde14('0x1a')](_0x34e28f);}return _0x3d5a29[_0xde14('0x1b')](_0x34e28f)[_0xde14('0x1c')]();};}function respondWithResult(_0x281c54,_0x1489e9){_0x1489e9=_0x1489e9||0xc8;return function(_0x54c58b){if(_0x54c58b){return _0x281c54['status'](_0x1489e9)[_0xde14('0x1d')](_0x54c58b);}};}function respondWithFilteredResult(_0x1db2f6,_0x26c1ec){return function(_0x4c86ff){if(_0x4c86ff){var _0x16aa55=_0x4c86ff[_0xde14('0x1e')],_0x31adb3=_0x26c1ec[_0xde14('0x1f')],_0x257390=_0x26c1ec[_0xde14('0x1f')]+_0x26c1ec[_0xde14('0x20')],_0x31902a;if(_0x257390>=_0x16aa55){_0x257390=_0x16aa55;_0x31902a=0xc8;}else{_0x31902a=0xce;}_0x1db2f6[_0xde14('0x1b')](_0x31902a);return _0x1db2f6[_0xde14('0x21')]('Content-Range',_0x31adb3+'-'+_0x257390+'/'+_0x16aa55)[_0xde14('0x1d')](_0x4c86ff);}return null;};}function patchUpdates(_0x3bfc59){return function(_0x2eb8a8){try{jsonpatch[_0xde14('0x22')](_0x2eb8a8,_0x3bfc59,!![]);}catch(_0x4ce69f){return BPromise[_0xde14('0x23')](_0x4ce69f);}return _0x2eb8a8['save']();};}function saveUpdates(_0x45d101,_0x4c24a8){return function(_0xa50687){if(_0xa50687){return _0xa50687[_0xde14('0x24')](_0x45d101)[_0xde14('0x25')](function(_0x1949ab){return _0x1949ab;});}return null;};}function removeEntity(_0x39bdc5,_0x11a4d9){return function(_0x40b648){if(_0x40b648){return _0x40b648[_0xde14('0x26')]()[_0xde14('0x25')](function(){var _0x163b79=_0x40b648[_0xde14('0x27')]({'plain':!![]});var _0xbaa078=_0xde14('0x28');return db['UserProfileResource'][_0xde14('0x26')]({'where':{'type':_0xbaa078,'resourceId':_0x163b79['id']}})[_0xde14('0x25')](function(){return _0x40b648;});})[_0xde14('0x25')](function(){_0x39bdc5[_0xde14('0x1b')](0xcc)[_0xde14('0x1c')]();});}};}function handleEntityNotFound(_0x21ef15,_0x310d75){return function(_0x23c735){if(!_0x23c735){_0x21ef15[_0xde14('0x1a')](0x194);}return _0x23c735;};}function handleError(_0x350a78,_0x4eff65){_0x4eff65=_0x4eff65||0x1f4;return function(_0x309922){logger[_0xde14('0x29')](_0x309922[_0xde14('0x2a')]);if(_0x309922[_0xde14('0x2b')]){delete _0x309922['name'];}_0x350a78[_0xde14('0x1b')](_0x4eff65)[_0xde14('0x2c')](_0x309922);};}exports[_0xde14('0x2d')]=function(_0x553cab,_0x4655fb){var _0x582537={},_0x2760f9={},_0x361b2c={'count':0x0,'rows':[]};var _0x3bb1da=_[_0xde14('0x2e')](db[_0xde14('0x2f')][_0xde14('0x30')],function(_0xae9dca){return{'name':_0xae9dca[_0xde14('0x31')],'type':_0xae9dca['type'][_0xde14('0x32')]};});_0x2760f9[_0xde14('0x33')]=_['map'](_0x3bb1da,_0xde14('0x2b'));_0x2760f9['query']=_[_0xde14('0x34')](_0x553cab[_0xde14('0x35')]);_0x2760f9[_0xde14('0x36')]=_[_0xde14('0x37')](_0x2760f9[_0xde14('0x33')],_0x2760f9['query']);_0x582537[_0xde14('0x38')]=_[_0xde14('0x37')](_0x2760f9['model'],qs[_0xde14('0x39')](_0x553cab[_0xde14('0x35')][_0xde14('0x39')]));_0x582537[_0xde14('0x38')]=_0x582537[_0xde14('0x38')][_0xde14('0x3a')]?_0x582537[_0xde14('0x38')]:_0x2760f9[_0xde14('0x33')];if(!_0x553cab[_0xde14('0x35')]['hasOwnProperty']('nolimit')){_0x582537[_0xde14('0x20')]=qs[_0xde14('0x20')](_0x553cab[_0xde14('0x35')][_0xde14('0x20')]);_0x582537[_0xde14('0x1f')]=qs[_0xde14('0x1f')](_0x553cab[_0xde14('0x35')][_0xde14('0x1f')]);}_0x582537[_0xde14('0x3b')]=qs['sort'](_0x553cab[_0xde14('0x35')]['sort']);_0x582537['where']=qs['filters'](_[_0xde14('0x3c')](_0x553cab[_0xde14('0x35')],_0x2760f9[_0xde14('0x36')]));if(_0x553cab[_0xde14('0x35')][_0xde14('0x3d')]){_0x582537[_0xde14('0x3e')]=_[_0xde14('0x3f')](_0x582537[_0xde14('0x3e')],{'$or':_['map'](_0x3bb1da,function(_0xc2a39d){if(_0xc2a39d[_0xde14('0x40')]!==_0xde14('0x41')){var _0x2b3004={};_0x2b3004[_0xc2a39d[_0xde14('0x2b')]]={'$like':'%'+_0x553cab[_0xde14('0x35')][_0xde14('0x3d')]+'%'};return _0x2b3004;}})});}_0x582537=_[_0xde14('0x3f')]({},_0x582537,_0x553cab['options']);var _0x225164={'where':_0x582537[_0xde14('0x3e')]};return db[_0xde14('0x2f')][_0xde14('0x1e')](_0x225164)['then'](function(_0x5ebb03){_0x361b2c[_0xde14('0x1e')]=_0x5ebb03;if(_0x553cab[_0xde14('0x35')][_0xde14('0x42')]){_0x582537[_0xde14('0x43')]=[{'all':!![]}];}return db[_0xde14('0x2f')]['findAll'](_0x582537);})[_0xde14('0x25')](function(_0x70c912){_0x361b2c[_0xde14('0x44')]=_0x70c912;return _0x361b2c;})['then'](respondWithFilteredResult(_0x4655fb,_0x582537))[_0xde14('0x45')](handleError(_0x4655fb,null));};exports['show']=function(_0x46ac22,_0x51ace9){var _0x102770={'raw':!![],'where':{'id':_0x46ac22[_0xde14('0x46')]['id']}},_0x117c64={};_0x117c64[_0xde14('0x33')]=_[_0xde14('0x34')](db[_0xde14('0x2f')][_0xde14('0x30')]);_0x117c64[_0xde14('0x35')]=_['keys'](_0x46ac22[_0xde14('0x35')]);_0x117c64['filters']=_[_0xde14('0x37')](_0x117c64['model'],_0x117c64[_0xde14('0x35')]);_0x102770[_0xde14('0x38')]=_[_0xde14('0x37')](_0x117c64[_0xde14('0x33')],qs[_0xde14('0x39')](_0x46ac22[_0xde14('0x35')][_0xde14('0x39')]));_0x102770[_0xde14('0x38')]=_0x102770['attributes'][_0xde14('0x3a')]?_0x102770[_0xde14('0x38')]:_0x117c64[_0xde14('0x33')];if(_0x46ac22[_0xde14('0x35')]['includeAll']){_0x102770[_0xde14('0x43')]=[{'all':!![]}];}_0x102770=_[_0xde14('0x3f')]({},_0x102770,_0x46ac22[_0xde14('0x47')]);return db[_0xde14('0x2f')][_0xde14('0x48')](_0x102770)[_0xde14('0x25')](handleEntityNotFound(_0x51ace9,null))['then'](respondWithResult(_0x51ace9,null))[_0xde14('0x45')](handleError(_0x51ace9,null));};exports['create']=function(_0xa408ec,_0x383b99){return db['Disposition'][_0xde14('0x49')](_0xa408ec[_0xde14('0x4a')],{})[_0xde14('0x25')](function(_0x2775da){var _0x2d05c7=_0xa408ec[_0xde14('0x4b')][_0xde14('0x27')]({'plain':!![]});if(!_0x2d05c7)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2d05c7[_0xde14('0x4c')]==='user'){var _0xfa80c8=_0x2775da[_0xde14('0x27')]({'plain':!![]});var _0x237be4=_0xde14('0x28');return db[_0xde14('0x4d')][_0xde14('0x48')]({'where':{'name':_0x237be4,'userProfileId':_0x2d05c7[_0xde14('0x4e')]},'raw':!![]})[_0xde14('0x25')](function(_0x3495d1){if(_0x3495d1&&_0x3495d1[_0xde14('0x4f')]===0x0){return db['UserProfileResource'][_0xde14('0x49')]({'name':_0xfa80c8[_0xde14('0x2b')],'resourceId':_0xfa80c8['id'],'type':_0x3495d1[_0xde14('0x2b')],'sectionId':_0x3495d1['id']},{})[_0xde14('0x25')](function(){return _0x2775da;});}else{return _0x2775da;}})[_0xde14('0x45')](function(_0x4874ed){logger[_0xde14('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4874ed);throw _0x4874ed;});}return _0x2775da;})[_0xde14('0x25')](respondWithResult(_0x383b99,0xc9))[_0xde14('0x45')](handleError(_0x383b99,null));};exports[_0xde14('0x24')]=function(_0x115d3e,_0x30d230){if(_0x115d3e['body']['id']){delete _0x115d3e['body']['id'];}return db[_0xde14('0x2f')]['find']({'where':{'id':_0x115d3e[_0xde14('0x46')]['id']}})[_0xde14('0x25')](handleEntityNotFound(_0x30d230,null))[_0xde14('0x25')](saveUpdates(_0x115d3e[_0xde14('0x4a')],null))[_0xde14('0x25')](respondWithResult(_0x30d230,null))[_0xde14('0x45')](handleError(_0x30d230,null));};exports[_0xde14('0x26')]=function(_0x187bd3,_0x423adc){return db['Disposition'][_0xde14('0x48')]({'where':{'id':_0x187bd3[_0xde14('0x46')]['id']}})[_0xde14('0x25')](handleEntityNotFound(_0x423adc,null))[_0xde14('0x25')](removeEntity(_0x423adc,null))[_0xde14('0x45')](handleError(_0x423adc,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 7d782c5..abd906f 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 _0x05ab=['FaxAccountId','name_openchannel','OpenchannelAccountId','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./disposition.attributes','define','tools_dispositions','name_voice','name','ListId','name_chat','ChatWebsiteId','name_mail','MailAccountId','SmsAccountId','name_fax'];(function(_0x44f675,_0x189410){var _0x4718d9=function(_0x4b3d79){while(--_0x4b3d79){_0x44f675['push'](_0x44f675['shift']());}};_0x4718d9(++_0x189410);}(_0x05ab,0x123));var _0xb05a=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0x05ab[_0x422905];return _0x33dc6c;};'use strict';var _=require('lodash');var util=require(_0xb05a('0x0'));var logger=require(_0xb05a('0x1'))(_0xb05a('0x2'));var moment=require(_0xb05a('0x3'));var BPromise=require(_0xb05a('0x4'));var rp=require(_0xb05a('0x5'));var fs=require('fs');var path=require(_0xb05a('0x6'));var rimraf=require(_0xb05a('0x7'));var config=require(_0xb05a('0x8'));var attributes=require(_0xb05a('0x9'));module['exports']=function(_0xc1282,_0x4cb988){return _0xc1282[_0xb05a('0xa')]('Disposition',attributes,{'tableName':_0xb05a('0xb'),'paranoid':![],'indexes':[{'unique':!![],'name':_0xb05a('0xc'),'fields':[_0xb05a('0xd'),_0xb05a('0xe')]},{'unique':!![],'name':_0xb05a('0xf'),'fields':['name',_0xb05a('0x10')]},{'unique':!![],'name':_0xb05a('0x11'),'fields':[_0xb05a('0xd'),_0xb05a('0x12')]},{'unique':!![],'name':'name_sms','fields':[_0xb05a('0xd'),_0xb05a('0x13')]},{'unique':!![],'name':_0xb05a('0x14'),'fields':[_0xb05a('0xd'),_0xb05a('0x15')]},{'unique':!![],'name':_0xb05a('0x16'),'fields':[_0xb05a('0xd'),_0xb05a('0x17')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x61f1=['exports','define','Disposition','name_voice','name','ListId','name_chat','ChatWebsiteId','name_mail','MailAccountId','name_sms','name_fax','FaxAccountId','name_openchannel','util','api','moment','bluebird','rimraf','../../config/environment'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x61f1,0x18a));var _0x161f=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x61f1[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0x161f('0x0'));var logger=require('../../config/logger')(_0x161f('0x1'));var moment=require(_0x161f('0x2'));var BPromise=require(_0x161f('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x161f('0x4'));var config=require(_0x161f('0x5'));var attributes=require('./disposition.attributes');module[_0x161f('0x6')]=function(_0x2317af,_0x15b3a4){return _0x2317af[_0x161f('0x7')](_0x161f('0x8'),attributes,{'tableName':'tools_dispositions','paranoid':![],'indexes':[{'unique':!![],'name':_0x161f('0x9'),'fields':[_0x161f('0xa'),_0x161f('0xb')]},{'unique':!![],'name':_0x161f('0xc'),'fields':[_0x161f('0xa'),_0x161f('0xd')]},{'unique':!![],'name':_0x161f('0xe'),'fields':[_0x161f('0xa'),_0x161f('0xf')]},{'unique':!![],'name':_0x161f('0x10'),'fields':[_0x161f('0xa'),'SmsAccountId']},{'unique':!![],'name':_0x161f('0x11'),'fields':[_0x161f('0xa'),_0x161f('0x12')]},{'unique':!![],'name':_0x161f('0x13'),'fields':[_0x161f('0xa'),'OpenchannelAccountId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index b1196a6..2a7997b 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 _0x0637=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Disposition,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','lodash','util','moment','../../mysqldb','../../config/utils'];(function(_0x236dfb,_0x1a8986){var _0x43996f=function(_0x32f8cf){while(--_0x32f8cf){_0x236dfb['push'](_0x236dfb['shift']());}};_0x43996f(++_0x1a8986);}(_0x0637,0xa3));var _0x7063=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0637[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7063('0x0'));var util=require(_0x7063('0x1'));var moment=require(_0x7063('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7063('0x3'))['db'];var utils=require(_0x7063('0x4'));var logger=require(_0x7063('0x5'))(_0x7063('0x6'));var config=require(_0x7063('0x7'));var jayson=require(_0x7063('0x8'));var client=jayson[_0x7063('0x9')][_0x7063('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x92a5bc,_0x1affb6,_0x343682){return new BPromise(function(_0x53bca5,_0x14ea46){return client[_0x7063('0xb')](_0x92a5bc,_0x343682)[_0x7063('0xc')](function(_0x454de6){logger[_0x7063('0xd')](_0x7063('0xe'),_0x1affb6,_0x7063('0xf'));logger[_0x7063('0x10')]('Disposition,\x20%s,\x20%s,\x20%s',_0x1affb6,_0x7063('0xf'),JSON['stringify'](_0x454de6));if(_0x454de6['error']){if(_0x454de6[_0x7063('0x11')][_0x7063('0x12')]===0x1f4){logger[_0x7063('0x11')](_0x7063('0xe'),_0x1affb6,_0x454de6['error']['message']);return _0x14ea46(_0x454de6[_0x7063('0x11')][_0x7063('0x13')]);}logger[_0x7063('0x11')](_0x7063('0xe'),_0x1affb6,_0x454de6[_0x7063('0x11')]['message']);return _0x53bca5(_0x454de6[_0x7063('0x11')][_0x7063('0x13')]);}else{logger['info']('Disposition,\x20%s,\x20%s',_0x1affb6,_0x7063('0xf'));_0x53bca5(_0x454de6[_0x7063('0x14')][_0x7063('0x13')]);}})['catch'](function(_0x6d3d86){logger[_0x7063('0x11')](_0x7063('0xe'),_0x1affb6,_0x6d3d86);_0x14ea46(_0x6d3d86);});});} \ No newline at end of file +var _0x3ddd=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','Disposition,\x20%s,\x20%s','Disposition,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','randomstring'];(function(_0x2dc53a,_0x539151){var _0x396c0f=function(_0x1d5670){while(--_0x1d5670){_0x2dc53a['push'](_0x2dc53a['shift']());}};_0x396c0f(++_0x539151);}(_0x3ddd,0x155));var _0xd3dd=function(_0x44ac90,_0x440a73){_0x44ac90=_0x44ac90-0x0;var _0x44ae87=_0x3ddd[_0x44ac90];return _0x44ae87;};'use strict';var _=require(_0xd3dd('0x0'));var util=require(_0xd3dd('0x1'));var moment=require(_0xd3dd('0x2'));var BPromise=require('bluebird');var rs=require(_0xd3dd('0x3'));var fs=require('fs');var Redis=require(_0xd3dd('0x4'));var db=require(_0xd3dd('0x5'))['db'];var utils=require(_0xd3dd('0x6'));var logger=require(_0xd3dd('0x7'))(_0xd3dd('0x8'));var config=require(_0xd3dd('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xd3dd('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x17847a,_0x146c53,_0x30f592){return new BPromise(function(_0x31b4ea,_0x4852ef){return client[_0xd3dd('0xb')](_0x17847a,_0x30f592)[_0xd3dd('0xc')](function(_0x354832){logger[_0xd3dd('0xd')](_0xd3dd('0xe'),_0x146c53,'request\x20sent');logger['debug'](_0xd3dd('0xf'),_0x146c53,_0xd3dd('0x10'),JSON[_0xd3dd('0x11')](_0x354832));if(_0x354832[_0xd3dd('0x12')]){if(_0x354832[_0xd3dd('0x12')][_0xd3dd('0x13')]===0x1f4){logger[_0xd3dd('0x12')](_0xd3dd('0xe'),_0x146c53,_0x354832[_0xd3dd('0x12')][_0xd3dd('0x14')]);return _0x4852ef(_0x354832[_0xd3dd('0x12')]['message']);}logger[_0xd3dd('0x12')]('Disposition,\x20%s,\x20%s',_0x146c53,_0x354832[_0xd3dd('0x12')][_0xd3dd('0x14')]);return _0x31b4ea(_0x354832['error'][_0xd3dd('0x14')]);}else{logger[_0xd3dd('0xd')](_0xd3dd('0xe'),_0x146c53,_0xd3dd('0x10'));_0x31b4ea(_0x354832[_0xd3dd('0x15')][_0xd3dd('0x14')]);}})[_0xd3dd('0x16')](function(_0x395784){logger['error'](_0xd3dd('0xe'),_0x146c53,_0x395784);_0x4852ef(_0x395784);});});} \ No newline at end of file diff --git a/server/api/disposition/index.js b/server/api/disposition/index.js index 4d04ef7..5ebca6c 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 _0x5ae9=['/:id','create','put','delete','destroy','multer','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./disposition.controller','isAuthenticated','index','get'];(function(_0x1190b6,_0x43c0c5){var _0x486b3b=function(_0x29dda7){while(--_0x29dda7){_0x1190b6['push'](_0x1190b6['shift']());}};_0x486b3b(++_0x43c0c5);}(_0x5ae9,0x19b));var _0x95ae=function(_0x88ffd4,_0x25f7e6){_0x88ffd4=_0x88ffd4-0x0;var _0x528f9c=_0x5ae9[_0x88ffd4];return _0x528f9c;};'use strict';var multer=require(_0x95ae('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x95ae('0x1'));var express=require(_0x95ae('0x2'));var router=express['Router']();var auth=require(_0x95ae('0x3'));var interaction=require(_0x95ae('0x4'));var config=require('../../config/environment');var controller=require(_0x95ae('0x5'));router['get']('/',auth[_0x95ae('0x6')](),controller[_0x95ae('0x7')]);router[_0x95ae('0x8')](_0x95ae('0x9'),auth[_0x95ae('0x6')](),controller['show']);router['post']('/',auth[_0x95ae('0x6')](),controller[_0x95ae('0xa')]);router[_0x95ae('0xb')](_0x95ae('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x95ae('0xc')](_0x95ae('0x9'),auth[_0x95ae('0x6')](),controller[_0x95ae('0xd')]);module['exports']=router; \ No newline at end of file +var _0x7d8a=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./disposition.controller','get','isAuthenticated','index','show','post','create','/:id','update','destroy','exports','multer','util'];(function(_0x837dad,_0x1d9098){var _0x1d62d3=function(_0x40b7c1){while(--_0x40b7c1){_0x837dad['push'](_0x837dad['shift']());}};_0x1d62d3(++_0x1d9098);}(_0x7d8a,0x1ca));var _0xa7d8=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x7d8a[_0x8c43de];return _0xa6591b;};'use strict';var multer=require(_0xa7d8('0x0'));var util=require(_0xa7d8('0x1'));var path=require(_0xa7d8('0x2'));var timeout=require(_0xa7d8('0x3'));var express=require(_0xa7d8('0x4'));var router=express[_0xa7d8('0x5')]();var auth=require(_0xa7d8('0x6'));var interaction=require(_0xa7d8('0x7'));var config=require(_0xa7d8('0x8'));var controller=require(_0xa7d8('0x9'));router[_0xa7d8('0xa')]('/',auth[_0xa7d8('0xb')](),controller[_0xa7d8('0xc')]);router[_0xa7d8('0xa')]('/:id',auth[_0xa7d8('0xb')](),controller[_0xa7d8('0xd')]);router[_0xa7d8('0xe')]('/',auth[_0xa7d8('0xb')](),controller[_0xa7d8('0xf')]);router['put'](_0xa7d8('0x10'),auth['isAuthenticated'](),controller[_0xa7d8('0x11')]);router['delete'](_0xa7d8('0x10'),auth['isAuthenticated'](),controller[_0xa7d8('0x12')]);module[_0xa7d8('0x13')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index b2dd1ea..69a6bc9 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 _0x4fcd=['Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDisposition','sequelize','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','2400','4800','7200','9600','12000','14400','v17,v27,v29','SIP','IAX','DADHI','KHOMP'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x4fcd,0x15f));var _0xd4fc=function(_0x2e1b28,_0x24fc1c){_0x2e1b28=_0x2e1b28-0x0;var _0x3e4a03=_0x4fcd[_0x2e1b28];return _0x3e4a03;};'use strict';var Sequelize=require(_0xd4fc('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xd4fc('0x1')]},'ecm':{'type':Sequelize[_0xd4fc('0x2')](_0xd4fc('0x3'),'no'),'defaultValue':'yes'},'headerinfo':{'type':Sequelize[_0xd4fc('0x1')],'defaultValue':_0xd4fc('0x4')},'localstationid':{'type':Sequelize[_0xd4fc('0x1')],'unique':_0xd4fc('0x5')},'minrate':{'type':Sequelize[_0xd4fc('0x2')](_0xd4fc('0x6'),_0xd4fc('0x7'),_0xd4fc('0x8'),'9600','12000','14400'),'defaultValue':_0xd4fc('0x7')},'maxrate':{'type':Sequelize[_0xd4fc('0x2')]('2400',_0xd4fc('0x7'),_0xd4fc('0x8'),_0xd4fc('0x9'),_0xd4fc('0xa'),_0xd4fc('0xb')),'defaultValue':_0xd4fc('0xb')},'modem':{'type':Sequelize[_0xd4fc('0x1')],'defaultValue':_0xd4fc('0xc')},'gateway':{'type':Sequelize[_0xd4fc('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0xd4fc('0x2')](_0xd4fc('0xd'),_0xd4fc('0xe'),_0xd4fc('0xf'),_0xd4fc('0x10')),'defaultValue':_0xd4fc('0xd')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xd4fc('0x11');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xd4fc('0x12')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xd4fc('0x13')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xd4fc('0x12')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xd4fc('0x13')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xd4fc('0x13')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xd4fc('0x13')],'allowNull':!![],'defaultValue':null,'comment':_0xd4fc('0x14')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x326d04){if(!_0x326d04)this[_0xd4fc('0x15')]('mandatoryDispositionPauseId',null);this[_0xd4fc('0x15')](_0xd4fc('0x16'),_0x326d04);}}}; \ No newline at end of file +var _0x96a3=['yes','localstationid','7200','9600','12000','4800','ENUM','2400','14400','v17,v27,v29','INTEGER','DADHI','KHOMP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','exports','STRING'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x96a3,0x106));var _0x396a=function(_0x49ba7d,_0x480d51){_0x49ba7d=_0x49ba7d-0x0;var _0x2a7297=_0x96a3[_0x49ba7d];return _0x2a7297;};'use strict';var Sequelize=require('sequelize');module[_0x396a('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x396a('0x1')]},'ecm':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0x396a('0x2')},'headerinfo':{'type':Sequelize[_0x396a('0x1')],'defaultValue':'xCALLY\x20Motion\x20Fax'},'localstationid':{'type':Sequelize['STRING'],'unique':_0x396a('0x3')},'minrate':{'type':Sequelize['ENUM']('2400','4800',_0x396a('0x4'),_0x396a('0x5'),_0x396a('0x6'),'14400'),'defaultValue':_0x396a('0x7')},'maxrate':{'type':Sequelize[_0x396a('0x8')](_0x396a('0x9'),_0x396a('0x7'),'7200',_0x396a('0x5'),_0x396a('0x6'),_0x396a('0xa')),'defaultValue':_0x396a('0xa')},'modem':{'type':Sequelize[_0x396a('0x1')],'defaultValue':_0x396a('0xb')},'gateway':{'type':Sequelize[_0x396a('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x396a('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x396a('0xc')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize['ENUM']('SIP','IAX',_0x396a('0xd'),_0x396a('0xe')),'defaultValue':'SIP'},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x396a('0xf')],'defaultValue':function(){return _0x396a('0x10');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x396a('0x11')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x396a('0x11')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x396a('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x396a('0x11')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x396a('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x396a('0xc')],'allowNull':!![],'defaultValue':null,'comment':_0x396a('0x12')},'mandatoryDisposition':{'type':Sequelize[_0x396a('0x11')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x56ca44){if(!_0x56ca44)this[_0x396a('0x13')](_0x396a('0x14'),null);this[_0x396a('0x13')](_0x396a('0x15'),_0x56ca44);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index b22f768..bdd3318 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 _0xbecd=['fields','create','body','user','role','get','FaxAccounts','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','FaxAccountId','Disposition','getDispositions','findOne','hasOwnProperty','order','pick','includeAll','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addInteraction','omit','getInteractions','FaxInteraction','CmContact','Contact','User','Owner','fullname','Tag','Tags','color','tag','addApplications','FaxApplication','bulkCreate','findAndCountAll','priority','getApplications','from-voip-provider','system','description','Fax\x20Extension','appdata','push','ecm','localstationid','gateway','headerinfo','maxrate','minrate','modem','FAXOPT(','ReceiveFax','addAccountApplications','sequelize','transaction','VoiceExtension','updateAccountApplications','tech','createdAt','updatedAt','TrunkId','ListId','getMessages','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','CmList','DESC','attachments','root','basename','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','fax','List','Contacts','List\x20not\x20found','filename','Messages','Contact\x20not\x20found','out','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','spread','emit','removeAgents','isArray','userFaxAccount:remove','getAgents','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','register','jayson/promise','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','json','count','limit','Content-Range','save','update','UserProfileResource','destroy','end','stack','name','send','mandatoryDispositionPause','map','FaxAccount','rawAttributes','fieldName','type','key','model','query','attributes','length','nolimit','offset','sort','filters','filter','merge','where','options','include','findAll','rows','show','params','Pause','keys','intersection'];(function(_0x38a7ac,_0x45514b){var _0x53061a=function(_0x1d2469){while(--_0x1d2469){_0x38a7ac['push'](_0x38a7ac['shift']());}};_0x53061a(++_0x45514b);}(_0xbecd,0x6a));var _0xdbec=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xbecd[_0x20a584];return _0x4b41a8;};'use strict';var pdf=require(_0xdbec('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xdbec('0x1'));var zipdir=require(_0xdbec('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xdbec('0x3'));var moment=require(_0xdbec('0x4'));var BPromise=require(_0xdbec('0x5'));var Mustache=require(_0xdbec('0x6'));var util=require(_0xdbec('0x7'));var path=require(_0xdbec('0x8'));var sox=require(_0xdbec('0x9'));var csv=require(_0xdbec('0xa'));var ejs=require(_0xdbec('0xb'));var fs=require('fs');var _=require(_0xdbec('0xc'));var squel=require(_0xdbec('0xd'));var crypto=require(_0xdbec('0xe'));var jsforce=require(_0xdbec('0xf'));var deskjs=require(_0xdbec('0x10'));var toCsv=require(_0xdbec('0xa'));var querystring=require('querystring');var Papa=require(_0xdbec('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdbec('0x12'));var logger=require(_0xdbec('0x13'))('api');var utils=require(_0xdbec('0x14'));var config=require(_0xdbec('0x15'));var db=require(_0xdbec('0x16'))['db'];config[_0xdbec('0x17')]=_[_0xdbec('0x18')](config[_0xdbec('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0xdbec('0x19'))(new Redis(config[_0xdbec('0x17')]));require('./faxAccount.socket')[_0xdbec('0x1a')](socket);var jayson=require(_0xdbec('0x1b'));var client=jayson['client'][_0xdbec('0x1c')]({'port':0x232c});var client9002=jayson['client'][_0xdbec('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x4a2906,_0x45321f,_0x53420c){if(_0x53420c){var _0x55e40e=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x55e40e[_0xdbec('0x1d')](_0x45321f)){return _0x4a2906;}else{throw new db[(_0xdbec('0x1e'))][(_0xdbec('0x1f'))](_0xdbec('0x20'));}}else{return _0x4a2906;}}function respondWithRpcPromise(_0x1dcdd9,_0x392600,_0x309219,_0x5d9ed5){return new BPromise(function(_0x39d49d,_0x439bd9){var _0x3b2ba6=_0x5d9ed5||client;return _0x3b2ba6[_0xdbec('0x21')](_0x1dcdd9,_0x309219)[_0xdbec('0x22')](function(_0xa729e5){logger[_0xdbec('0x23')]('FaxAccount,\x20%s,\x20%s',_0x392600,_0xdbec('0x24'));logger[_0xdbec('0x25')](_0xdbec('0x26'),_0x392600,'request\x20sent',JSON[_0xdbec('0x27')](_0xa729e5));if(_0xa729e5['error']){if(_0xa729e5[_0xdbec('0x28')][_0xdbec('0x29')]===0x1f4){logger[_0xdbec('0x28')](_0xdbec('0x2a'),_0x392600,_0xa729e5[_0xdbec('0x28')][_0xdbec('0x2b')]);return _0x439bd9(_0xa729e5[_0xdbec('0x28')][_0xdbec('0x2b')]);}logger[_0xdbec('0x28')](_0xdbec('0x2a'),_0x392600,_0xa729e5[_0xdbec('0x28')][_0xdbec('0x2b')]);return _0x39d49d(_0xa729e5[_0xdbec('0x28')][_0xdbec('0x2b')]);}else{logger[_0xdbec('0x23')](_0xdbec('0x2a'),_0x392600,_0xdbec('0x24'));_0x39d49d(_0xa729e5[_0xdbec('0x2c')][_0xdbec('0x2b')]);}})[_0xdbec('0x2d')](function(_0x24edd3){logger['error'](_0xdbec('0x2a'),_0x392600,_0x24edd3);_0x439bd9(_0x24edd3);});});}function respondWithStatusCode(_0x26a6b9,_0x2cbe8c){_0x2cbe8c=_0x2cbe8c||0xcc;return function(_0x3e22a0){if(_0x3e22a0){return _0x26a6b9[_0xdbec('0x2e')](_0x2cbe8c);}return _0x26a6b9[_0xdbec('0x2f')](_0x2cbe8c)['end']();};}function respondWithResult(_0x43aa89,_0x2225ae){_0x2225ae=_0x2225ae||0xc8;return function(_0x2696ef){if(_0x2696ef){return _0x43aa89['status'](_0x2225ae)[_0xdbec('0x30')](_0x2696ef);}};}function respondWithFilteredResult(_0x595dcb,_0x2ed99e){return function(_0x546d59){if(_0x546d59){var _0x13ec80=_0x546d59[_0xdbec('0x31')],_0x4f73be=_0x2ed99e['offset'],_0x445ce7=_0x2ed99e['offset']+_0x2ed99e[_0xdbec('0x32')],_0x25c192;if(_0x445ce7>=_0x13ec80){_0x445ce7=_0x13ec80;_0x25c192=0xc8;}else{_0x25c192=0xce;}_0x595dcb[_0xdbec('0x2f')](_0x25c192);return _0x595dcb['set'](_0xdbec('0x33'),_0x4f73be+'-'+_0x445ce7+'/'+_0x13ec80)[_0xdbec('0x30')](_0x546d59);}return null;};}function patchUpdates(_0x1bd720){return function(_0x1c125d){try{jsonpatch['apply'](_0x1c125d,_0x1bd720,!![]);}catch(_0x3b4e2a){return BPromise['reject'](_0x3b4e2a);}return _0x1c125d[_0xdbec('0x34')]();};}function saveUpdates(_0x26d8a7,_0x362e03){return function(_0x3ab063){if(_0x3ab063){return _0x3ab063[_0xdbec('0x35')](_0x26d8a7)[_0xdbec('0x22')](function(_0x4ed734){return _0x4ed734;});}return null;};}function removeEntity(_0x5a11ce,_0x7983e8){return function(_0x43cf04){if(_0x43cf04){return _0x43cf04['destroy']()[_0xdbec('0x22')](function(){var _0x100dcd=_0x43cf04['get']({'plain':!![]});var _0x10c920='FaxAccounts';return db[_0xdbec('0x36')][_0xdbec('0x37')]({'where':{'type':_0x10c920,'resourceId':_0x100dcd['id']}})[_0xdbec('0x22')](function(){return _0x43cf04;});})[_0xdbec('0x22')](function(){_0x5a11ce[_0xdbec('0x2f')](0xcc)[_0xdbec('0x38')]();});}};}function handleEntityNotFound(_0x4e0f96,_0x481e89){return function(_0x1d2f23){if(!_0x1d2f23){_0x4e0f96[_0xdbec('0x2e')](0x194);}return _0x1d2f23;};}function handleError(_0x4c63f1,_0x5dff75){_0x5dff75=_0x5dff75||0x1f4;return function(_0x5e0851){logger['error'](_0x5e0851[_0xdbec('0x39')]);if(_0x5e0851[_0xdbec('0x3a')]){delete _0x5e0851[_0xdbec('0x3a')];}_0x4c63f1['status'](_0x5dff75)[_0xdbec('0x3b')](_0x5e0851);};}exports['index']=function(_0xecf488,_0xfbcbf8){var _0x533b40={'include':[{'model':db['Pause'],'as':_0xdbec('0x3c')}]},_0x5a415f={},_0xcf17fa={'count':0x0,'rows':[]};var _0x73b6e5=_[_0xdbec('0x3d')](db[_0xdbec('0x3e')][_0xdbec('0x3f')],function(_0x2a7153){return{'name':_0x2a7153[_0xdbec('0x40')],'type':_0x2a7153[_0xdbec('0x41')][_0xdbec('0x42')]};});_0x5a415f[_0xdbec('0x43')]=_['map'](_0x73b6e5,'name');_0x5a415f[_0xdbec('0x44')]=_['keys'](_0xecf488['query']);_0x5a415f['filters']=_['intersection'](_0x5a415f['model'],_0x5a415f[_0xdbec('0x44')]);_0x533b40[_0xdbec('0x45')]=_['intersection'](_0x5a415f[_0xdbec('0x43')],qs['fields'](_0xecf488[_0xdbec('0x44')]['fields']));_0x533b40[_0xdbec('0x45')]=_0x533b40['attributes'][_0xdbec('0x46')]?_0x533b40['attributes']:_0x5a415f[_0xdbec('0x43')];if(!_0xecf488[_0xdbec('0x44')]['hasOwnProperty'](_0xdbec('0x47'))){_0x533b40[_0xdbec('0x32')]=qs[_0xdbec('0x32')](_0xecf488[_0xdbec('0x44')][_0xdbec('0x32')]);_0x533b40['offset']=qs[_0xdbec('0x48')](_0xecf488['query'][_0xdbec('0x48')]);}_0x533b40['order']=qs[_0xdbec('0x49')](_0xecf488[_0xdbec('0x44')]['sort']);_0x533b40['where']=qs[_0xdbec('0x4a')](_['pick'](_0xecf488[_0xdbec('0x44')],_0x5a415f[_0xdbec('0x4a')]));if(_0xecf488[_0xdbec('0x44')][_0xdbec('0x4b')]){_0x533b40['where']=_[_0xdbec('0x4c')](_0x533b40[_0xdbec('0x4d')],{'$or':_[_0xdbec('0x3d')](_0x73b6e5,function(_0x458e33){if(_0x458e33[_0xdbec('0x41')]!=='VIRTUAL'){var _0x1f65f6={};_0x1f65f6[_0x458e33[_0xdbec('0x3a')]]={'$like':'%'+_0xecf488[_0xdbec('0x44')][_0xdbec('0x4b')]+'%'};return _0x1f65f6;}})});}_0x533b40=_['merge']({},_0x533b40,_0xecf488[_0xdbec('0x4e')]);var _0x247db6={'where':_0x533b40[_0xdbec('0x4d')]};return db[_0xdbec('0x3e')][_0xdbec('0x31')](_0x247db6)['then'](function(_0x296175){_0xcf17fa[_0xdbec('0x31')]=_0x296175;if(_0xecf488[_0xdbec('0x44')]['includeAll']){_0x533b40[_0xdbec('0x4f')]=[{'all':!![]}];}return db['FaxAccount'][_0xdbec('0x50')](_0x533b40);})[_0xdbec('0x22')](function(_0x9139d6){_0xcf17fa[_0xdbec('0x51')]=_0x9139d6;return _0xcf17fa;})[_0xdbec('0x22')](respondWithFilteredResult(_0xfbcbf8,_0x533b40))[_0xdbec('0x2d')](handleError(_0xfbcbf8,null));};exports[_0xdbec('0x52')]=function(_0x1da059,_0x12b15d){var _0x550372={'raw':![],'where':{'id':_0x1da059[_0xdbec('0x53')]['id']},'include':[{'model':db[_0xdbec('0x54')],'as':_0xdbec('0x3c')}]},_0x519dbe={};_0x519dbe[_0xdbec('0x43')]=_['keys'](db[_0xdbec('0x3e')][_0xdbec('0x3f')]);_0x519dbe[_0xdbec('0x44')]=_[_0xdbec('0x55')](_0x1da059[_0xdbec('0x44')]);_0x519dbe[_0xdbec('0x4a')]=_[_0xdbec('0x56')](_0x519dbe[_0xdbec('0x43')],_0x519dbe[_0xdbec('0x44')]);_0x550372[_0xdbec('0x45')]=_[_0xdbec('0x56')](_0x519dbe['model'],qs[_0xdbec('0x57')](_0x1da059['query']['fields']));_0x550372['attributes']=_0x550372[_0xdbec('0x45')]['length']?_0x550372[_0xdbec('0x45')]:_0x519dbe[_0xdbec('0x43')];if(_0x1da059[_0xdbec('0x44')]['includeAll']){_0x550372[_0xdbec('0x4f')]=[{'all':!![]}];}_0x550372=_[_0xdbec('0x4c')]({},_0x550372,_0x1da059[_0xdbec('0x4e')]);return db[_0xdbec('0x3e')]['find'](_0x550372)[_0xdbec('0x22')](handleEntityNotFound(_0x12b15d,null))[_0xdbec('0x22')](respondWithResult(_0x12b15d,null))['catch'](handleError(_0x12b15d,null));};exports[_0xdbec('0x58')]=function(_0x8d95a3,_0xb24622){return db['FaxAccount'][_0xdbec('0x58')](_0x8d95a3[_0xdbec('0x59')],{})['then'](function(_0x4ee9b3){var _0x2fb331=_0x8d95a3[_0xdbec('0x5a')]['get']({'plain':!![]});if(!_0x2fb331)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2fb331[_0xdbec('0x5b')]===_0xdbec('0x5a')){var _0x380eb5=_0x4ee9b3[_0xdbec('0x5c')]({'plain':!![]});var _0x111a84=_0xdbec('0x5d');return db[_0xdbec('0x5e')][_0xdbec('0x5f')]({'where':{'name':_0x111a84,'userProfileId':_0x2fb331[_0xdbec('0x60')]},'raw':!![]})['then'](function(_0x12dff2){if(_0x12dff2&&_0x12dff2[_0xdbec('0x61')]===0x0){return db[_0xdbec('0x36')][_0xdbec('0x58')]({'name':_0x380eb5['name'],'resourceId':_0x380eb5['id'],'type':_0x12dff2[_0xdbec('0x3a')],'sectionId':_0x12dff2['id']},{})[_0xdbec('0x22')](function(){return _0x4ee9b3;});}else{return _0x4ee9b3;}})[_0xdbec('0x2d')](function(_0x22817d){logger[_0xdbec('0x28')](_0xdbec('0x62'),_0x22817d);throw _0x22817d;});}return _0x4ee9b3;})[_0xdbec('0x22')](respondWithResult(_0xb24622,0xc9))['catch'](handleError(_0xb24622,null));};exports['update']=function(_0x5b2211,_0x5bf783){if(_0x5b2211[_0xdbec('0x59')]['id']){delete _0x5b2211['body']['id'];}return db['FaxAccount'][_0xdbec('0x5f')]({'where':{'id':_0x5b2211[_0xdbec('0x53')]['id']},'include':[{'model':db[_0xdbec('0x54')],'as':'mandatoryDispositionPause'}]})[_0xdbec('0x22')](handleEntityNotFound(_0x5bf783,null))[_0xdbec('0x22')](saveUpdates(_0x5b2211[_0xdbec('0x59')],null))[_0xdbec('0x22')](respondWithResult(_0x5bf783,null))[_0xdbec('0x2d')](handleError(_0x5bf783,null));};exports[_0xdbec('0x37')]=function(_0x5a34cf,_0x2e72bd){return db[_0xdbec('0x3e')]['find']({'where':{'id':_0x5a34cf[_0xdbec('0x53')]['id']}})['then'](handleEntityNotFound(_0x2e72bd,null))[_0xdbec('0x22')](removeEntity(_0x2e72bd,null))[_0xdbec('0x2d')](handleError(_0x2e72bd,null));};exports[_0xdbec('0x63')]=function(_0x3970ac,_0x41693f){return db[_0xdbec('0x3e')][_0xdbec('0x63')]()[_0xdbec('0x22')](respondWithResult(_0x41693f,null))[_0xdbec('0x2d')](handleError(_0x41693f,null));};exports[_0xdbec('0x64')]=function(_0x5aa746,_0x2dacd4,_0x237be4){if(_0x5aa746[_0xdbec('0x59')]['id']){delete _0x5aa746[_0xdbec('0x59')]['id'];}return db[_0xdbec('0x3e')][_0xdbec('0x5f')]({'where':{'id':_0x5aa746[_0xdbec('0x53')]['id']}})['then'](handleEntityNotFound(_0x2dacd4,null))[_0xdbec('0x22')](function(_0xfd7eb7){if(_0xfd7eb7){_0x5aa746[_0xdbec('0x59')][_0xdbec('0x65')]=_0xfd7eb7['id'];return db[_0xdbec('0x66')][_0xdbec('0x58')](_0x5aa746[_0xdbec('0x59')]);}})[_0xdbec('0x22')](respondWithResult(_0x2dacd4,null))['catch'](handleError(_0x2dacd4,null));};exports[_0xdbec('0x67')]=function(_0x3779e0,_0x42face,_0x4bf326){var _0x10bc7b={'raw':![],'where':{}};var _0x5bbfd3={};var _0x517f48={'count':0x0,'rows':[]};return db['FaxAccount'][_0xdbec('0x68')]({'where':{'id':_0x3779e0[_0xdbec('0x53')]['id']}})[_0xdbec('0x22')](handleEntityNotFound(_0x42face,null))['then'](function(_0x3140f6){if(_0x3140f6){_0x5bbfd3[_0xdbec('0x43')]=_[_0xdbec('0x55')](db[_0xdbec('0x66')][_0xdbec('0x3f')]);_0x5bbfd3[_0xdbec('0x44')]=_[_0xdbec('0x55')](_0x3779e0[_0xdbec('0x44')]);_0x5bbfd3[_0xdbec('0x4a')]=_[_0xdbec('0x56')](_0x5bbfd3[_0xdbec('0x43')],_0x5bbfd3[_0xdbec('0x44')]);_0x10bc7b[_0xdbec('0x45')]=_['intersection'](_0x5bbfd3[_0xdbec('0x43')],qs[_0xdbec('0x57')](_0x3779e0[_0xdbec('0x44')]['fields']));_0x10bc7b[_0xdbec('0x45')]=_0x10bc7b[_0xdbec('0x45')][_0xdbec('0x46')]?_0x10bc7b[_0xdbec('0x45')]:_0x5bbfd3[_0xdbec('0x43')];if(!_0x3779e0[_0xdbec('0x44')][_0xdbec('0x69')](_0xdbec('0x47'))){_0x10bc7b['limit']=qs['limit'](_0x3779e0['query'][_0xdbec('0x32')]);_0x10bc7b[_0xdbec('0x48')]=qs['offset'](_0x3779e0['query'][_0xdbec('0x48')]);}_0x10bc7b[_0xdbec('0x6a')]=qs[_0xdbec('0x49')](_0x3779e0['query']['sort']);_0x10bc7b[_0xdbec('0x4d')]=qs[_0xdbec('0x4a')](_[_0xdbec('0x6b')](_0x3779e0[_0xdbec('0x44')],_0x5bbfd3['filters']));_0x10bc7b[_0xdbec('0x4d')][_0xdbec('0x65')]=_0x3140f6['id'];if(_0x3779e0[_0xdbec('0x44')][_0xdbec('0x4b')]){_0x10bc7b[_0xdbec('0x4d')]=_[_0xdbec('0x4c')](_0x10bc7b[_0xdbec('0x4d')],{'$or':_[_0xdbec('0x3d')](_0x10bc7b[_0xdbec('0x45')],function(_0x8a21bc){var _0x5f39ee={};_0x5f39ee[_0x8a21bc]={'$like':'%'+_0x3779e0['query'][_0xdbec('0x4b')]+'%'};return _0x5f39ee;})});}_0x10bc7b=_['merge']({},_0x10bc7b,_0x3779e0[_0xdbec('0x4e')]);return db[_0xdbec('0x66')]['count']({'where':_0x10bc7b[_0xdbec('0x4d')]})[_0xdbec('0x22')](function(_0x561195){_0x517f48['count']=_0x561195;if(_0x3779e0[_0xdbec('0x44')][_0xdbec('0x6c')]){_0x10bc7b[_0xdbec('0x4f')]=[{'all':!![]}];}return db[_0xdbec('0x66')][_0xdbec('0x50')](_0x10bc7b);})[_0xdbec('0x22')](function(_0x28ba5e){_0x517f48[_0xdbec('0x51')]=_0x28ba5e;return _0x517f48;});}})[_0xdbec('0x22')](respondWithFilteredResult(_0x42face,_0x10bc7b))[_0xdbec('0x2d')](handleError(_0x42face,null));};exports[_0xdbec('0x6d')]=function(_0x58bf87,_0x1c73e8,_0x332daa){return db['FaxAccount'][_0xdbec('0x5f')]({'where':{'id':_0x58bf87['params']['id']}})[_0xdbec('0x22')](handleEntityNotFound(_0x1c73e8,null))[_0xdbec('0x22')](function(_0x5c659e){if(_0x5c659e){return _0x5c659e[_0xdbec('0x6d')](_0x58bf87[_0xdbec('0x44')][_0xdbec('0x6e')]);}})[_0xdbec('0x22')](respondWithStatusCode(_0x1c73e8,null))['catch'](handleError(_0x1c73e8,null));};exports[_0xdbec('0x6f')]=function(_0x364ac8,_0x1aea71,_0x5e8551){if(_0x364ac8[_0xdbec('0x59')]['id']){delete _0x364ac8['body']['id'];}return db[_0xdbec('0x3e')][_0xdbec('0x5f')]({'where':{'id':_0x364ac8[_0xdbec('0x53')]['id']}})[_0xdbec('0x22')](handleEntityNotFound(_0x1aea71,null))[_0xdbec('0x22')](function(_0x26d09f){if(_0x26d09f){_0x364ac8['body'][_0xdbec('0x65')]=_0x26d09f['id'];return db[_0xdbec('0x70')][_0xdbec('0x58')](_0x364ac8[_0xdbec('0x59')]);}})[_0xdbec('0x22')](respondWithResult(_0x1aea71,null))[_0xdbec('0x2d')](handleError(_0x1aea71,null));};exports[_0xdbec('0x71')]=function(_0x9a2f7b,_0x3c4b97,_0x10bd24){var _0x5255d1={'raw':![],'where':{}};var _0x3fcdf0={};var _0xf1f41f={'count':0x0,'rows':[]};return db[_0xdbec('0x3e')][_0xdbec('0x68')]({'where':{'id':_0x9a2f7b['params']['id']}})['then'](handleEntityNotFound(_0x3c4b97,null))[_0xdbec('0x22')](function(_0x1ed92){if(_0x1ed92){_0x3fcdf0[_0xdbec('0x43')]=_[_0xdbec('0x55')](db['CannedAnswer']['rawAttributes']);_0x3fcdf0[_0xdbec('0x44')]=_['keys'](_0x9a2f7b[_0xdbec('0x44')]);_0x3fcdf0[_0xdbec('0x4a')]=_[_0xdbec('0x56')](_0x3fcdf0[_0xdbec('0x43')],_0x3fcdf0[_0xdbec('0x44')]);_0x5255d1[_0xdbec('0x45')]=_[_0xdbec('0x56')](_0x3fcdf0[_0xdbec('0x43')],qs['fields'](_0x9a2f7b[_0xdbec('0x44')]['fields']));_0x5255d1[_0xdbec('0x45')]=_0x5255d1[_0xdbec('0x45')][_0xdbec('0x46')]?_0x5255d1[_0xdbec('0x45')]:_0x3fcdf0[_0xdbec('0x43')];if(!_0x9a2f7b[_0xdbec('0x44')][_0xdbec('0x69')](_0xdbec('0x47'))){_0x5255d1[_0xdbec('0x32')]=qs[_0xdbec('0x32')](_0x9a2f7b[_0xdbec('0x44')]['limit']);_0x5255d1[_0xdbec('0x48')]=qs['offset'](_0x9a2f7b['query'][_0xdbec('0x48')]);}_0x5255d1[_0xdbec('0x6a')]=qs['sort'](_0x9a2f7b[_0xdbec('0x44')][_0xdbec('0x49')]);_0x5255d1[_0xdbec('0x4d')]=qs['filters'](_[_0xdbec('0x6b')](_0x9a2f7b['query'],_0x3fcdf0['filters']));_0x5255d1['where'][_0xdbec('0x65')]=_0x1ed92['id'];if(_0x9a2f7b['query']['filter']){_0x5255d1[_0xdbec('0x4d')]=_[_0xdbec('0x4c')](_0x5255d1[_0xdbec('0x4d')],{'$or':_[_0xdbec('0x3d')](_0x5255d1[_0xdbec('0x45')],function(_0x46bfcf){var _0x36f180={};_0x36f180[_0x46bfcf]={'$like':'%'+_0x9a2f7b['query'][_0xdbec('0x4b')]+'%'};return _0x36f180;})});}_0x5255d1=_[_0xdbec('0x4c')]({},_0x5255d1,_0x9a2f7b[_0xdbec('0x4e')]);return db[_0xdbec('0x70')][_0xdbec('0x31')]({'where':_0x5255d1[_0xdbec('0x4d')]})[_0xdbec('0x22')](function(_0x137a10){_0xf1f41f[_0xdbec('0x31')]=_0x137a10;if(_0x9a2f7b[_0xdbec('0x44')][_0xdbec('0x6c')]){_0x5255d1[_0xdbec('0x4f')]=[{'all':!![]}];}return db['CannedAnswer'][_0xdbec('0x50')](_0x5255d1);})[_0xdbec('0x22')](function(_0x3be7af){_0xf1f41f[_0xdbec('0x51')]=_0x3be7af;return _0xf1f41f;});}})['then'](respondWithFilteredResult(_0x3c4b97,_0x5255d1))[_0xdbec('0x2d')](handleError(_0x3c4b97,null));};exports[_0xdbec('0x72')]=function(_0xaefae3,_0x410816,_0x5e9be5){return db[_0xdbec('0x3e')][_0xdbec('0x5f')]({'where':{'id':_0xaefae3['params']['id']}})[_0xdbec('0x22')](handleEntityNotFound(_0x410816,null))['then'](function(_0x4c0ec2){if(_0x4c0ec2){return _0x4c0ec2[_0xdbec('0x72')](_0xaefae3[_0xdbec('0x44')][_0xdbec('0x6e')]);}})[_0xdbec('0x22')](respondWithStatusCode(_0x410816,null))[_0xdbec('0x2d')](handleError(_0x410816,null));};exports[_0xdbec('0x73')]=function(_0x3fd96b,_0x5d29aa,_0xc8f2b){return db['FaxInteraction'][_0xdbec('0x5f')]({'where':{'id':_0x3fd96b[_0xdbec('0x53')]['id']}})[_0xdbec('0x22')](handleEntityNotFound(_0x5d29aa,null))[_0xdbec('0x22')](function(_0xc23834){if(_0xc23834){return _0xc23834['addInteraction'](_0x3fd96b[_0xdbec('0x59')][_0xdbec('0x6e')],_[_0xdbec('0x74')](_0x3fd96b[_0xdbec('0x59')],[_0xdbec('0x6e'),'id'])||{});}})[_0xdbec('0x22')](respondWithResult(_0x5d29aa,null))[_0xdbec('0x2d')](handleError(_0x5d29aa,null));};exports[_0xdbec('0x75')]=function(_0x530a8e,_0x410c1f,_0x3f2952){var _0x49b925={'raw':![],'where':{}};var _0x49dc51={};var _0x5df5ed={'count':0x0,'rows':[]};return db[_0xdbec('0x3e')][_0xdbec('0x68')]({'where':{'id':_0x530a8e[_0xdbec('0x53')]['id']}})[_0xdbec('0x22')](handleEntityNotFound(_0x410c1f,null))[_0xdbec('0x22')](function(_0xbdcebb){if(_0xbdcebb){_0x49dc51[_0xdbec('0x43')]=_[_0xdbec('0x55')](db[_0xdbec('0x76')][_0xdbec('0x3f')]);_0x49dc51[_0xdbec('0x44')]=_[_0xdbec('0x55')](_0x530a8e[_0xdbec('0x44')]);_0x49dc51[_0xdbec('0x4a')]=_[_0xdbec('0x56')](_0x49dc51[_0xdbec('0x43')],_0x49dc51[_0xdbec('0x44')]);_0x49b925[_0xdbec('0x45')]=_[_0xdbec('0x56')](_0x49dc51['model'],qs['fields'](_0x530a8e['query']['fields']));_0x49b925[_0xdbec('0x45')]=_0x49b925[_0xdbec('0x45')][_0xdbec('0x46')]?_0x49b925['attributes']:_0x49dc51[_0xdbec('0x43')];if(!_0x530a8e[_0xdbec('0x44')][_0xdbec('0x69')](_0xdbec('0x47'))){_0x49b925[_0xdbec('0x32')]=qs[_0xdbec('0x32')](_0x530a8e[_0xdbec('0x44')][_0xdbec('0x32')]);_0x49b925[_0xdbec('0x48')]=qs[_0xdbec('0x48')](_0x530a8e['query'][_0xdbec('0x48')]);}_0x49b925[_0xdbec('0x6a')]=qs['sort'](_0x530a8e[_0xdbec('0x44')][_0xdbec('0x49')]);_0x49b925[_0xdbec('0x4d')]=qs['filters'](_[_0xdbec('0x6b')](_0x530a8e[_0xdbec('0x44')],_0x49dc51[_0xdbec('0x4a')]));_0x49b925[_0xdbec('0x4d')][_0xdbec('0x65')]=_0xbdcebb['id'];if(_0x530a8e[_0xdbec('0x44')][_0xdbec('0x4b')]){_0x49b925[_0xdbec('0x4d')]=_['merge'](_0x49b925[_0xdbec('0x4d')],{'$or':_[_0xdbec('0x3d')](_0x49b925[_0xdbec('0x45')],function(_0xc8b457){var _0x564975={};_0x564975[_0xc8b457]={'$like':'%'+_0x530a8e[_0xdbec('0x44')][_0xdbec('0x4b')]+'%'};return _0x564975;})});}_0x49b925=_['merge']({},_0x49b925,_0x530a8e[_0xdbec('0x4e')]);return db[_0xdbec('0x76')][_0xdbec('0x31')]({'where':_0x49b925[_0xdbec('0x4d')]})[_0xdbec('0x22')](function(_0x1eb7bc){_0x5df5ed[_0xdbec('0x31')]=_0x1eb7bc;if(_0x530a8e[_0xdbec('0x44')][_0xdbec('0x6c')]){_0x49b925['include']=[{'model':db[_0xdbec('0x77')],'as':_0xdbec('0x78'),'required':![]},{'model':db[_0xdbec('0x79')],'as':_0xdbec('0x7a'),'attributes':[_0xdbec('0x3a'),_0xdbec('0x7b'),'internal'],'required':![]},{'model':db[_0xdbec('0x7c')],'as':_0xdbec('0x7d'),'attributes':['id',_0xdbec('0x3a'),_0xdbec('0x7e')],'where':_0x530a8e[_0xdbec('0x44')][_0xdbec('0x7f')]?{'id':_0x530a8e[_0xdbec('0x44')][_0xdbec('0x7f')]}:undefined,'required':_0x530a8e[_0xdbec('0x44')]['tag']?!![]:![]}];}return db[_0xdbec('0x76')]['findAll'](_0x49b925);})['then'](function(_0x13fde4){_0x5df5ed[_0xdbec('0x51')]=_0x13fde4;return _0x5df5ed;});}})[_0xdbec('0x22')](respondWithFilteredResult(_0x410c1f,_0x49b925))[_0xdbec('0x2d')](handleError(_0x410c1f,null));};exports[_0xdbec('0x80')]=function(_0x3d1b13,_0x2d6a26,_0x5c9997){return db[_0xdbec('0x3e')][_0xdbec('0x68')]({'where':{'id':_0x3d1b13['params']['id']}})[_0xdbec('0x22')](handleEntityNotFound(_0x2d6a26,null))['then'](function(_0x18d0c6){if(_0x18d0c6){return db['sequelize']['transaction'](function(_0x11478d){return db[_0xdbec('0x81')][_0xdbec('0x37')]({'where':{'FaxAccountId':_0x3d1b13['params']['id']},'transaction':_0x11478d})['then'](function(_0x597607){var _0x19db52=_[_0xdbec('0x3d')](_0x3d1b13['body'],function(_0x30312f){_0x30312f[_0xdbec('0x65')]=_0x3d1b13[_0xdbec('0x53')]['id'];return _0x30312f;});return db['FaxApplication'][_0xdbec('0x82')](_0x19db52,{'transaction':_0x11478d});});})[_0xdbec('0x22')](function(){return db[_0xdbec('0x81')][_0xdbec('0x83')]({'where':{'FaxAccountId':_0x3d1b13[_0xdbec('0x53')]['id']},'order':_0xdbec('0x84')});});}})['then'](respondWithResult(_0x2d6a26,null))[_0xdbec('0x2d')](handleError(_0x2d6a26,null));};exports['getApplications']=function(_0x2d8e4f,_0x37aa4d,_0x2957d9){var _0x1b63c2={};var _0xbc5e02={};var _0xcaacc8;var _0x191ca6;return db[_0xdbec('0x3e')]['findOne']({'where':{'id':_0x2d8e4f['params']['id']}})[_0xdbec('0x22')](handleEntityNotFound(_0x37aa4d,null))[_0xdbec('0x22')](function(_0x284853){if(_0x284853){_0xcaacc8=_0x284853;_0xbc5e02[_0xdbec('0x43')]=_['keys'](db[_0xdbec('0x81')][_0xdbec('0x3f')]);_0xbc5e02[_0xdbec('0x44')]=_[_0xdbec('0x55')](_0x2d8e4f[_0xdbec('0x44')]);_0xbc5e02[_0xdbec('0x4a')]=_[_0xdbec('0x56')](_0xbc5e02[_0xdbec('0x43')],_0xbc5e02[_0xdbec('0x44')]);_0x1b63c2[_0xdbec('0x45')]=_[_0xdbec('0x56')](_0xbc5e02['model'],qs[_0xdbec('0x57')](_0x2d8e4f[_0xdbec('0x44')][_0xdbec('0x57')]));_0x1b63c2['attributes']=_0x1b63c2[_0xdbec('0x45')][_0xdbec('0x46')]?_0x1b63c2[_0xdbec('0x45')]:_0xbc5e02['model'];_0x1b63c2[_0xdbec('0x6a')]=qs[_0xdbec('0x49')](_0x2d8e4f['query'][_0xdbec('0x49')]);_0x1b63c2[_0xdbec('0x4d')]=qs['filters'](_['pick'](_0x2d8e4f[_0xdbec('0x44')],_0xbc5e02[_0xdbec('0x4a')]));if(_0x2d8e4f[_0xdbec('0x44')][_0xdbec('0x4b')]){_0x1b63c2[_0xdbec('0x4d')]=_[_0xdbec('0x4c')](_0x1b63c2[_0xdbec('0x4d')],{'$or':_['map'](_0x1b63c2[_0xdbec('0x45')],function(_0x57e452){var _0x4ec734={};_0x4ec734[_0x57e452]={'$like':'%'+_0x2d8e4f[_0xdbec('0x44')]['filter']+'%'};return _0x4ec734;})});}_0x1b63c2=_[_0xdbec('0x4c')]({},_0x1b63c2,_0x2d8e4f[_0xdbec('0x4e')]);return _0xcaacc8[_0xdbec('0x85')](_0x1b63c2);}})[_0xdbec('0x22')](function(_0xf9131a){if(_0xf9131a){_0x191ca6=_0xf9131a['length'];if(!_0x2d8e4f[_0xdbec('0x44')][_0xdbec('0x69')](_0xdbec('0x47'))){_0x1b63c2[_0xdbec('0x32')]=qs[_0xdbec('0x32')](_0x2d8e4f[_0xdbec('0x44')][_0xdbec('0x32')]);_0x1b63c2[_0xdbec('0x48')]=qs[_0xdbec('0x48')](_0x2d8e4f[_0xdbec('0x44')][_0xdbec('0x48')]);}return _0xcaacc8[_0xdbec('0x85')](_0x1b63c2);}})[_0xdbec('0x22')](function(_0x57f93e){if(_0x57f93e){return _0x57f93e?{'count':_0x191ca6,'rows':_0x57f93e}:null;}})[_0xdbec('0x22')](respondWithResult(_0x37aa4d,null))[_0xdbec('0x2d')](handleError(_0x37aa4d,null));};function Extension(_0x561145,_0x203249,_0x1067d5,_0x12db72){this['context']=_0xdbec('0x86');this['exten']=_0x561145['localstationid'];this['app']=_0x12db72;this[_0xdbec('0x41')]=_0xdbec('0x87');this[_0xdbec('0x88')]=_0xdbec('0x89');this[_0xdbec('0x65')]=_0x561145['id'];this[_0xdbec('0x84')]=_0x203249;this[_0xdbec('0x8a')]=_0x1067d5;}function createExtensionsReciveFax(_0x40abbb){var _0x15720a=0x1;var _0x2a193a=[];_0x2a193a[_0xdbec('0x8b')](new Extension(_0x40abbb,_0x15720a,'','Answer'));_0x15720a+=0x1;_0x2a193a[_0xdbec('0x8b')](new Extension(_0x40abbb,_0x15720a,'CDR(type)=inbound-fax','Set'));_0x15720a+=0x1;for(var _0x56bbd4 in _0x40abbb){if(_0x40abbb[_0xdbec('0x69')](_0x56bbd4)&&(_0x56bbd4===_0xdbec('0x8c')||_0x56bbd4===_0xdbec('0x8d')||_0x56bbd4===_0xdbec('0x8e')||_0x56bbd4==='faxdetect'||_0x56bbd4===_0xdbec('0x8f')||_0x56bbd4===_0xdbec('0x90')||_0x56bbd4===_0xdbec('0x91')||_0x56bbd4===_0xdbec('0x92')||_0x56bbd4==='t38timeout')){_0x2a193a['push'](new Extension(_0x40abbb,_0x15720a,_0xdbec('0x93')+_0x56bbd4+')='+_0x40abbb[_0x56bbd4],'Set'));_0x15720a+=0x1;}}_0x2a193a['push'](new Extension(_0x40abbb,_0x15720a,'6','Wait'));_0x15720a+=0x1;_0x2a193a[_0xdbec('0x8b')](new Extension(_0x40abbb,_0x15720a,'/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',_0xdbec('0x94')));_0x15720a=0x0;return _0x2a193a;}exports[_0xdbec('0x95')]=function(_0x40f0e9,_0x2cbfff,_0x25ef5c){var _0x5e459d;return db[_0xdbec('0x96')][_0xdbec('0x97')](function(_0x4ca5f6){return db[_0xdbec('0x3e')]['create'](_0x40f0e9['body'],{'transaction':_0x4ca5f6})[_0xdbec('0x22')](function(_0x58fea2){_0x5e459d=_0x58fea2[_0xdbec('0x5c')]({'plain':!![]});return db[_0xdbec('0x98')][_0xdbec('0x82')](createExtensionsReciveFax(_0x5e459d),{'transaction':_0x4ca5f6});});})[_0xdbec('0x22')](function(){return _0x5e459d;})['then'](respondWithResult(_0x2cbfff,null))[_0xdbec('0x2d')](handleError(_0x2cbfff,null));};exports[_0xdbec('0x99')]=function(_0x19176c,_0x596b8f,_0x203ddf){var _0x58f169;return db[_0xdbec('0x96')][_0xdbec('0x97')](function(_0x4ae0e5){return db[_0xdbec('0x3e')][_0xdbec('0x35')](_0x19176c['body'],{'where':{'id':_0x19176c[_0xdbec('0x59')]['id']},'transaction':_0x4ae0e5})[_0xdbec('0x22')](function(_0x36e9af){return db[_0xdbec('0x98')]['destroy']({'where':{'FaxAccountId':_0x19176c[_0xdbec('0x59')]['id']},'transaction':_0x4ae0e5})['then'](function(_0x599fd2){return db[_0xdbec('0x98')][_0xdbec('0x82')](createExtensionsReciveFax(_[_0xdbec('0x74')](_0x19176c['body'],[_0xdbec('0x9a'),_0xdbec('0x42'),_0xdbec('0x9b'),_0xdbec('0x9c'),_0xdbec('0x9d'),_0xdbec('0x9e')])),{'transaction':_0x4ae0e5});});});})[_0xdbec('0x22')](function(){return db[_0xdbec('0x3e')]['findById'](_0x19176c[_0xdbec('0x59')]['id']);})[_0xdbec('0x22')](respondWithResult(_0x596b8f,null))['catch'](handleError(_0x596b8f,null));};exports[_0xdbec('0x9f')]=function(_0x20f0a8,_0x2006e0,_0x4b46cd){var _0xdb95d={'raw':!![],'where':{}};var _0x3ce566={};var _0x1e8360={'count':0x0,'rows':[]};return db['FaxAccount'][_0xdbec('0x68')]({'where':{'id':_0x20f0a8[_0xdbec('0x53')]['id']}})[_0xdbec('0x22')](handleEntityNotFound(_0x2006e0,null))[_0xdbec('0x22')](function(_0x4a0ee8){if(_0x4a0ee8){_0x3ce566[_0xdbec('0x43')]=_[_0xdbec('0x55')](db[_0xdbec('0xa0')][_0xdbec('0x3f')]);_0x3ce566[_0xdbec('0x44')]=_['keys'](_0x20f0a8[_0xdbec('0x44')]);_0x3ce566[_0xdbec('0x4a')]=_[_0xdbec('0x56')](_0x3ce566[_0xdbec('0x43')],_0x3ce566[_0xdbec('0x44')]);_0xdb95d['attributes']=_[_0xdbec('0x56')](_0x3ce566['model'],qs[_0xdbec('0x57')](_0x20f0a8[_0xdbec('0x44')][_0xdbec('0x57')]));_0xdb95d[_0xdbec('0x45')]=_0xdb95d['attributes'][_0xdbec('0x46')]?_0xdb95d['attributes']:_0x3ce566[_0xdbec('0x43')];if(!_0x20f0a8['query']['hasOwnProperty']('nolimit')){_0xdb95d['limit']=qs[_0xdbec('0x32')](_0x20f0a8[_0xdbec('0x44')][_0xdbec('0x32')]);_0xdb95d[_0xdbec('0x48')]=qs['offset'](_0x20f0a8[_0xdbec('0x44')][_0xdbec('0x48')]);}_0xdb95d[_0xdbec('0x6a')]=qs[_0xdbec('0x49')](_0x20f0a8['query']['sort']);_0xdb95d[_0xdbec('0x4d')]=qs[_0xdbec('0x4a')](_[_0xdbec('0x6b')](_0x20f0a8[_0xdbec('0x44')],_0x3ce566[_0xdbec('0x4a')]));_0xdb95d['where'][_0xdbec('0x65')]=_0x4a0ee8['id'];if(_0x20f0a8['query']['filter']){_0xdb95d['where']=_['merge'](_0xdb95d[_0xdbec('0x4d')],{'$or':_[_0xdbec('0x3d')](_0xdb95d['attributes'],function(_0x4c83a){var _0x2104f1={};_0x2104f1[_0x4c83a]={'$like':'%'+_0x20f0a8[_0xdbec('0x44')][_0xdbec('0x4b')]+'%'};return _0x2104f1;})});}if(_0x20f0a8['query'][_0xdbec('0xa1')]){var _0x21f251=_0x20f0a8[_0xdbec('0x44')]['$gte'][_0xdbec('0xa2')](',');var _0x1c921e={};_0x1c921e[_0x21f251[0x0]]={'$gte':moment(_0x21f251[0x1])[_0xdbec('0xa3')](_0xdbec('0xa4'))};_0xdb95d[_0xdbec('0x4d')]=_[_0xdbec('0x4c')](_0xdb95d[_0xdbec('0x4d')],_0x1c921e);}_0xdb95d=_[_0xdbec('0x4c')]({},_0xdb95d,_0x20f0a8['options']);return db[_0xdbec('0xa0')]['count']({'where':_0xdb95d[_0xdbec('0x4d')]})[_0xdbec('0x22')](function(_0x1068c6){_0x1e8360[_0xdbec('0x31')]=_0x1068c6;if(_0x20f0a8[_0xdbec('0x44')][_0xdbec('0x6c')]){_0xdb95d[_0xdbec('0x4f')]=[{'all':!![]}];}return db[_0xdbec('0xa0')][_0xdbec('0x50')](_0xdb95d);})['then'](function(_0x5903c9){_0x1e8360[_0xdbec('0x51')]=_0x5903c9;return _0x1e8360;});}})['then'](respondWithFilteredResult(_0x2006e0,_0xdb95d))['catch'](handleError(_0x2006e0,null));};exports[_0xdbec('0x3b')]=function(_0x2a8c61,_0x279034,_0x9709f1){var _0x1d6887,_0x111c03={},_0x465d73;if(_0x2a8c61['body']['to']){_0x465d73=_0x2a8c61[_0xdbec('0x59')]['to'][0x0];}return db[_0xdbec('0x3e')]['find']({'where':{'id':_0x2a8c61[_0xdbec('0x53')]['id']},'include':[{'model':db[_0xdbec('0xa5')],'as':'List','include':[{'model':db[_0xdbec('0x77')],'as':'Contacts','where':{'fax':_0x465d73},'limit':0x1,'order':[[_0xdbec('0x9c'),_0xdbec('0xa6')]]}]}]})['then'](handleEntityNotFound(_0x279034,null))[_0xdbec('0x22')](function(_0x3b84bc){_0x1d6887=_0x3b84bc;if(_0x2a8c61[_0xdbec('0x59')][_0xdbec('0xa7')]&&_0x2a8c61[_0xdbec('0x59')][_0xdbec('0xa7')][_0xdbec('0x46')]){for(var _0x97b5e0=0x0;_0x97b5e0<_0x2a8c61[_0xdbec('0x59')][_0xdbec('0xa7')][_0xdbec('0x46')];_0x97b5e0+=0x1){_0x2a8c61[_0xdbec('0x59')][_0xdbec('0xa7')][_0x97b5e0]={'filename':_0x2a8c61[_0xdbec('0x59')][_0xdbec('0xa7')][_0x97b5e0]['name'],'id':_0x2a8c61[_0xdbec('0x59')][_0xdbec('0xa7')][_0x97b5e0]['id'],'path':path['join'](config[_0xdbec('0xa8')],'server/files/attachments',_0x2a8c61['body'][_0xdbec('0xa7')][_0x97b5e0][_0xdbec('0xa9')])};}}return respondWithRpcPromise(_0xdbec('0xaa'),_0xdbec('0xaa'),{'FaxAccountId':_[_0xdbec('0xab')](_0x2a8c61[_0xdbec('0x53')]['id'])?undefined:_0x2a8c61[_0xdbec('0x53')]['id'],'path':_['isNil'](_0x2a8c61[_0xdbec('0x59')][_0xdbec('0xa7')][0x0][_0xdbec('0x8')])?undefined:_0x2a8c61[_0xdbec('0x59')][_0xdbec('0xa7')][0x0][_0xdbec('0x8')],'fax':_[_0xdbec('0xab')](_0x2a8c61['body']['to'][0x0])?undefined:_0x2a8c61[_0xdbec('0x59')]['to'][0x0]},client9002);})[_0xdbec('0x22')](function(){if(_0x1d6887){if(_[_0xdbec('0xab')](_0x2a8c61[_0xdbec('0x59')][_0xdbec('0xac')])){_0x2a8c61[_0xdbec('0x59')][_0xdbec('0xac')]=util[_0xdbec('0xa3')](_0xdbec('0xad'),_0x1d6887[_0xdbec('0x3a')],_0x1d6887[_0xdbec('0xae')]);}if(_0x1d6887[_0xdbec('0xaf')]){if(_0x1d6887[_0xdbec('0xaf')]['Contacts']['length']){return _0x1d6887[_0xdbec('0xaf')][_0xdbec('0xb0')][0x0];}else{return db['CmContact'][_0xdbec('0x58')](_[_0xdbec('0x18')](_0x2a8c61[_0xdbec('0x59')],{'firstName':_0x2a8c61[_0xdbec('0x59')]['to'][0x0],'phone':_0x2a8c61['body']['to'][0x0],'fax':_0x2a8c61[_0xdbec('0x59')]['to'][0x0],'ListId':_0x1d6887['ListId']}));}}else{throw new Error(_0xdbec('0xb1'));}}else{throw new Error('Send\x20Fax\x20failed');}})[_0xdbec('0x22')](function(_0x2bd380){if(_0x2bd380){return db['FaxInteraction']['find']({'where':{'ContactId':_0x2bd380['id'],'closed':![],'FaxAccountId':_0x1d6887['id']}})[_0xdbec('0x22')](function(_0x33357e){if(_0x33357e){return[_0x33357e,![]];}return db['FaxInteraction'][_0xdbec('0x58')]({'UserId':_0x2a8c61['user']['id'],'ContactId':_0x2bd380['id'],'FaxAccountId':_0x1d6887['id'],'fax':_0x2a8c61[_0xdbec('0x59')]['to'][0x0],'firstMsgDirection':'out','Messages':[_[_0xdbec('0x4c')](_0x2a8c61[_0xdbec('0x59')],{'read':![],'body':_0x2a8c61[_0xdbec('0x59')][_0xdbec('0xa7')][0x0][_0xdbec('0xb2')],'FaxAccountId':_0x1d6887['id'],'UserId':_0x2a8c61[_0xdbec('0x5a')]['id'],'ContactId':_0x2bd380['id'],'AttachmentId':_0x2a8c61[_0xdbec('0x59')][_0xdbec('0xa7')][0x0]['id']})]},{'include':[{'model':db[_0xdbec('0xa0')],'as':_0xdbec('0xb3')}]})[_0xdbec('0x22')](function(_0x9f20fb){return[_0x9f20fb,!![]];});});}else{throw new Error(_0xdbec('0xb4'));}})['spread'](function(_0x56edb3,_0x1df014){if(_0x1df014){return _0x56edb3;}return db['FaxMessage'][_0xdbec('0x58')]({'direction':_0xdbec('0xb5'),'read':![],'body':_0x2a8c61[_0xdbec('0x59')][_0xdbec('0xa7')][0x0][_0xdbec('0xb2')],'FaxAccountId':_0x1d6887['id'],'FaxInteractionId':_0x56edb3['id'],'UserId':_0x2a8c61[_0xdbec('0x5a')]['id'],'ContactId':_0x56edb3[_0xdbec('0xb6')],'AttachmentId':_0x2a8c61[_0xdbec('0x59')][_0xdbec('0xa7')][0x0]['id']})['then'](function(_0x473ec9){_0x56edb3['dataValues']['Messages']=[];_0x56edb3[_0xdbec('0xb7')][_0xdbec('0xb3')][_0xdbec('0x8b')](_0x473ec9['dataValues']);return _0x56edb3;});})[_0xdbec('0x22')](function(_0x4dd45){respondWithRpcPromise(_0xdbec('0xb8'),_0xdbec('0xb8'),{'FaxAccountId':_[_0xdbec('0xab')](_0x2a8c61[_0xdbec('0x53')]['id'])?undefined:_0x2a8c61[_0xdbec('0x53')]['id'],'path':_[_0xdbec('0xab')](_0x2a8c61[_0xdbec('0x59')][_0xdbec('0xa7')][0x0]['path'])?undefined:_0x2a8c61[_0xdbec('0x59')][_0xdbec('0xa7')][0x0][_0xdbec('0x8')],'fax':_[_0xdbec('0xab')](_0x2a8c61['body']['to'][0x0])?undefined:_0x2a8c61[_0xdbec('0x59')]['to'][0x0],'AttachmentId':_0x2a8c61['body'][_0xdbec('0xa7')][0x0]['id']},client9002)[_0xdbec('0x22')](function(_0x4f71aa){logger[_0xdbec('0x23')]('SendFaxRpc,\x20%s',_0x4f71aa);})['catch'](function(_0x28c282){logger[_0xdbec('0x23')](_0xdbec('0xb9'),_0x28c282);});return _0x4dd45;})[_0xdbec('0x22')](respondWithResult(_0x279034,null))['catch'](handleError(_0x279034,null));};exports['addAgents']=function(_0x5a1c3d,_0x533aa1,_0x457642){return db[_0xdbec('0x3e')][_0xdbec('0x5f')]({'where':{'id':_0x5a1c3d[_0xdbec('0x53')]['id']}})[_0xdbec('0x22')](handleEntityNotFound(_0x533aa1,null))[_0xdbec('0x22')](function(_0x2c2335){if(_0x2c2335){return _0x2c2335[_0xdbec('0xba')](_0x5a1c3d[_0xdbec('0x59')]['ids'],_[_0xdbec('0x74')](_0x5a1c3d[_0xdbec('0x59')],[_0xdbec('0x6e'),'id'])||{})[_0xdbec('0xbb')](function(_0xb09979){for(var _0x446194=0x0;_0x446194<_0x5a1c3d[_0xdbec('0x59')]['ids'][_0xdbec('0x46')];_0x446194+=0x1){socket[_0xdbec('0xbc')]('userFaxAccount:save',{'UserId':_0x5a1c3d[_0xdbec('0x59')][_0xdbec('0x6e')][_0x446194],'FaxAccountId':_0x5a1c3d[_0xdbec('0x53')]['id']});}return _0xb09979;});}})[_0xdbec('0x22')](respondWithResult(_0x533aa1,null))['catch'](handleError(_0x533aa1,null));};exports[_0xdbec('0xbd')]=function(_0x546c6c,_0x2dd1b4,_0x1e9fa3){return db[_0xdbec('0x3e')]['find']({'where':{'id':_0x546c6c[_0xdbec('0x53')]['id']}})['then'](handleEntityNotFound(_0x2dd1b4,null))[_0xdbec('0x22')](function(_0x372c45){if(_0x372c45){return _0x372c45[_0xdbec('0xbd')](_0x546c6c[_0xdbec('0x44')][_0xdbec('0x6e')])[_0xdbec('0x22')](function(){if(_[_0xdbec('0xbe')](_0x546c6c['query'][_0xdbec('0x6e')])){for(var _0x291621=0x0;_0x291621<_0x546c6c[_0xdbec('0x44')][_0xdbec('0x6e')]['length'];_0x291621+=0x1){socket[_0xdbec('0xbc')](_0xdbec('0xbf'),{'UserId':Number(_0x546c6c['query'][_0xdbec('0x6e')][_0x291621]),'FaxAccountId':Number(_0x546c6c[_0xdbec('0x53')]['id'])});}}else{socket[_0xdbec('0xbc')]('userFaxAccount:remove',{'UserId':Number(_0x546c6c['query']['ids']),'FaxAccountId':Number(_0x546c6c[_0xdbec('0x53')]['id'])});}});}})['then'](respondWithStatusCode(_0x2dd1b4,null))[_0xdbec('0x2d')](handleError(_0x2dd1b4,null));};exports[_0xdbec('0xc0')]=function(_0x5ebe36,_0x33cc3c,_0x1beb41){var _0x590114={};var _0x44d550={};var _0x52ad81;var _0x25dc21;return db['FaxAccount']['findOne']({'where':{'id':_0x5ebe36['params']['id']}})[_0xdbec('0x22')](handleEntityNotFound(_0x33cc3c,null))[_0xdbec('0x22')](function(_0x14e3d5){if(_0x14e3d5){_0x52ad81=_0x14e3d5;_0x44d550[_0xdbec('0x43')]=_[_0xdbec('0x55')](db[_0xdbec('0x79')]['rawAttributes']);_0x44d550[_0xdbec('0x44')]=_[_0xdbec('0x55')](_0x5ebe36[_0xdbec('0x44')]);_0x44d550['filters']=_[_0xdbec('0x56')](_0x44d550[_0xdbec('0x43')],_0x44d550[_0xdbec('0x44')]);_0x590114[_0xdbec('0x45')]=_[_0xdbec('0x56')](_0x44d550[_0xdbec('0x43')],qs[_0xdbec('0x57')](_0x5ebe36[_0xdbec('0x44')]['fields']));_0x590114[_0xdbec('0x45')]=_0x590114[_0xdbec('0x45')][_0xdbec('0x46')]?_0x590114[_0xdbec('0x45')]:_0x44d550['model'];_0x590114[_0xdbec('0x6a')]=qs[_0xdbec('0x49')](_0x5ebe36['query'][_0xdbec('0x49')]);_0x590114[_0xdbec('0x4d')]=qs[_0xdbec('0x4a')](_[_0xdbec('0x6b')](_0x5ebe36[_0xdbec('0x44')],_0x44d550['filters']));if(_0x5ebe36[_0xdbec('0x44')]['filter']){_0x590114[_0xdbec('0x4d')]=_[_0xdbec('0x4c')](_0x590114['where'],{'$or':_[_0xdbec('0x3d')](_0x590114[_0xdbec('0x45')],function(_0xc26158){var _0x1daf94={};_0x1daf94[_0xc26158]={'$like':'%'+_0x5ebe36['query']['filter']+'%'};return _0x1daf94;})});}_0x590114=_[_0xdbec('0x4c')]({},_0x590114,_0x5ebe36[_0xdbec('0x4e')]);return _0x52ad81[_0xdbec('0xc0')](_0x590114);}})[_0xdbec('0x22')](function(_0x485b8a){if(_0x485b8a){_0x25dc21=_0x485b8a[_0xdbec('0x46')];if(!_0x5ebe36[_0xdbec('0x44')][_0xdbec('0x69')](_0xdbec('0x47'))){_0x590114['limit']=qs[_0xdbec('0x32')](_0x5ebe36['query'][_0xdbec('0x32')]);_0x590114[_0xdbec('0x48')]=qs[_0xdbec('0x48')](_0x5ebe36[_0xdbec('0x44')][_0xdbec('0x48')]);}return _0x52ad81[_0xdbec('0xc0')](_0x590114);}})['then'](function(_0x215ec5){if(_0x215ec5){return _0x215ec5?{'count':_0x25dc21,'rows':_0x215ec5}:null;}})['then'](respondWithResult(_0x33cc3c,null))['catch'](handleError(_0x33cc3c,null));}; \ No newline at end of file +var _0xc774=['catch','show','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','Disposition','findOne','findAll','rows','removeDispositions','addAnswer','FaxAccountId','CannedAnswer','getAnswers','order','removeAnswers','ids','addInteraction','FaxInteraction','omit','getInteractions','CmContact','User','Owner','fullname','internal','Tag','Tags','color','tag','addApplications','transaction','FaxApplication','findAndCountAll','getApplications','context','from-voip-provider','exten','localstationid','app','type','system','priority','push','Answer','CDR(type)=inbound-fax','gateway','maxrate','minrate','modem','t38timeout','FAXOPT(','Set','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','addAccountApplications','VoiceExtension','bulkCreate','updateAccountApplications','sequelize','createdAt','ListId','findById','FaxMessage','$gte','split','format','CmList','Contacts','updatedAt','DESC','attachments','root','server/files/attachments','basename','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','fax','List','Send\x20Fax\x20failed','out','Messages','Contact\x20not\x20found','spread','filename','ContactId','dataValues','addAgents','emit','userFaxAccount:save','removeAgents','userFaxAccount:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','http','test','Sequelize','ValidationError','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','update','destroy','get','FaxAccounts','UserProfileResource','name','send','index','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','FaxAccount'];(function(_0x55ded3,_0xad389){var _0x41aeb1=function(_0x4bedc2){while(--_0x4bedc2){_0x55ded3['push'](_0x55ded3['shift']());}};_0x41aeb1(++_0xad389);}(_0xc774,0x129));var _0x4c77=function(_0x1d7a58,_0x450587){_0x1d7a58=_0x1d7a58-0x0;var _0xf09c26=_0xc774[_0x1d7a58];return _0xf09c26;};'use strict';var pdf=require(_0x4c77('0x0'));var emlformat=require(_0x4c77('0x1'));var rimraf=require(_0x4c77('0x2'));var zipdir=require(_0x4c77('0x3'));var jsonpatch=require(_0x4c77('0x4'));var rp=require(_0x4c77('0x5'));var moment=require(_0x4c77('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x4c77('0x7'));var util=require(_0x4c77('0x8'));var path=require(_0x4c77('0x9'));var sox=require(_0x4c77('0xa'));var csv=require(_0x4c77('0xb'));var ejs=require(_0x4c77('0xc'));var fs=require('fs');var _=require(_0x4c77('0xd'));var squel=require('squel');var crypto=require(_0x4c77('0xe'));var jsforce=require(_0x4c77('0xf'));var deskjs=require(_0x4c77('0x10'));var toCsv=require(_0x4c77('0xb'));var querystring=require(_0x4c77('0x11'));var Papa=require(_0x4c77('0x12'));var Redis=require(_0x4c77('0x13'));var authService=require(_0x4c77('0x14'));var qs=require(_0x4c77('0x15'));var as=require(_0x4c77('0x16'));var hardwareService=require(_0x4c77('0x17'));var logger=require(_0x4c77('0x18'))('api');var utils=require('../../config/utils');var config=require(_0x4c77('0x19'));var db=require('../../mysqldb')['db'];config[_0x4c77('0x1a')]=_[_0x4c77('0x1b')](config[_0x4c77('0x1a')],{'host':_0x4c77('0x1c'),'port':0x18eb});var socket=require(_0x4c77('0x1d'))(new Redis(config[_0x4c77('0x1a')]));require(_0x4c77('0x1e'))[_0x4c77('0x1f')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x4c77('0x20')]({'port':0x232c});var client9002=jayson['client'][_0x4c77('0x20')]({'port':0x232a});function checkPasswordPattern(_0xaeed6f,_0x53fd9f,_0x24669b){if(_0x24669b){var _0x20c1a3=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x20c1a3[_0x4c77('0x21')](_0x53fd9f)){return _0xaeed6f;}else{throw new db[(_0x4c77('0x22'))][(_0x4c77('0x23'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0xaeed6f;}}function respondWithRpcPromise(_0x4502b8,_0x3439b2,_0xdb4154,_0x484e93){return new BPromise(function(_0x386b8f,_0x21a45d){var _0x2ae1e8=_0x484e93||client;return _0x2ae1e8[_0x4c77('0x24')](_0x4502b8,_0xdb4154)[_0x4c77('0x25')](function(_0x2f73c6){logger[_0x4c77('0x26')](_0x4c77('0x27'),_0x3439b2,_0x4c77('0x28'));logger['debug'](_0x4c77('0x29'),_0x3439b2,'request\x20sent',JSON[_0x4c77('0x2a')](_0x2f73c6));if(_0x2f73c6[_0x4c77('0x2b')]){if(_0x2f73c6[_0x4c77('0x2b')][_0x4c77('0x2c')]===0x1f4){logger[_0x4c77('0x2b')](_0x4c77('0x27'),_0x3439b2,_0x2f73c6[_0x4c77('0x2b')][_0x4c77('0x2d')]);return _0x21a45d(_0x2f73c6[_0x4c77('0x2b')][_0x4c77('0x2d')]);}logger[_0x4c77('0x2b')](_0x4c77('0x27'),_0x3439b2,_0x2f73c6[_0x4c77('0x2b')]['message']);return _0x386b8f(_0x2f73c6[_0x4c77('0x2b')][_0x4c77('0x2d')]);}else{logger['info'](_0x4c77('0x27'),_0x3439b2,'request\x20sent');_0x386b8f(_0x2f73c6['result'][_0x4c77('0x2d')]);}})['catch'](function(_0x30e457){logger[_0x4c77('0x2b')]('FaxAccount,\x20%s,\x20%s',_0x3439b2,_0x30e457);_0x21a45d(_0x30e457);});});}function respondWithStatusCode(_0x5d238d,_0x5ae1d9){_0x5ae1d9=_0x5ae1d9||0xcc;return function(_0x40292e){if(_0x40292e){return _0x5d238d[_0x4c77('0x2e')](_0x5ae1d9);}return _0x5d238d[_0x4c77('0x2f')](_0x5ae1d9)[_0x4c77('0x30')]();};}function respondWithResult(_0x33370d,_0x440def){_0x440def=_0x440def||0xc8;return function(_0x13e18f){if(_0x13e18f){return _0x33370d['status'](_0x440def)[_0x4c77('0x31')](_0x13e18f);}};}function respondWithFilteredResult(_0x1b3076,_0x2ee14e){return function(_0x1c950d){if(_0x1c950d){var _0x197a12=_0x1c950d[_0x4c77('0x32')],_0x1ba9e4=_0x2ee14e[_0x4c77('0x33')],_0xa86c26=_0x2ee14e[_0x4c77('0x33')]+_0x2ee14e['limit'],_0x3f2052;if(_0xa86c26>=_0x197a12){_0xa86c26=_0x197a12;_0x3f2052=0xc8;}else{_0x3f2052=0xce;}_0x1b3076['status'](_0x3f2052);return _0x1b3076[_0x4c77('0x34')](_0x4c77('0x35'),_0x1ba9e4+'-'+_0xa86c26+'/'+_0x197a12)['json'](_0x1c950d);}return null;};}function patchUpdates(_0x1d5239){return function(_0x26acb8){try{jsonpatch[_0x4c77('0x36')](_0x26acb8,_0x1d5239,!![]);}catch(_0x411928){return BPromise[_0x4c77('0x37')](_0x411928);}return _0x26acb8['save']();};}function saveUpdates(_0x5a4ba7,_0x2a0cff){return function(_0x1360a9){if(_0x1360a9){return _0x1360a9[_0x4c77('0x38')](_0x5a4ba7)['then'](function(_0x58e1e8){return _0x58e1e8;});}return null;};}function removeEntity(_0x5c98da,_0x3dcb96){return function(_0x381d3f){if(_0x381d3f){return _0x381d3f[_0x4c77('0x39')]()[_0x4c77('0x25')](function(){var _0x38499b=_0x381d3f[_0x4c77('0x3a')]({'plain':!![]});var _0x1248ad=_0x4c77('0x3b');return db[_0x4c77('0x3c')]['destroy']({'where':{'type':_0x1248ad,'resourceId':_0x38499b['id']}})[_0x4c77('0x25')](function(){return _0x381d3f;});})['then'](function(){_0x5c98da['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1693c2,_0x2324dc){return function(_0x334e5e){if(!_0x334e5e){_0x1693c2[_0x4c77('0x2e')](0x194);}return _0x334e5e;};}function handleError(_0x1fdab7,_0x1500bd){_0x1500bd=_0x1500bd||0x1f4;return function(_0x2a8635){logger[_0x4c77('0x2b')](_0x2a8635['stack']);if(_0x2a8635[_0x4c77('0x3d')]){delete _0x2a8635[_0x4c77('0x3d')];}_0x1fdab7[_0x4c77('0x2f')](_0x1500bd)[_0x4c77('0x3e')](_0x2a8635);};}exports[_0x4c77('0x3f')]=function(_0x184859,_0xe1476d){var _0x3038ca={'include':[{'model':db[_0x4c77('0x40')],'as':_0x4c77('0x41')}]},_0x4decbb={},_0x3bd253={'count':0x0,'rows':[]};var _0x48bde4=_[_0x4c77('0x42')](db['FaxAccount'][_0x4c77('0x43')],function(_0x5e90ca){return{'name':_0x5e90ca[_0x4c77('0x44')],'type':_0x5e90ca['type'][_0x4c77('0x45')]};});_0x4decbb[_0x4c77('0x46')]=_['map'](_0x48bde4,_0x4c77('0x3d'));_0x4decbb[_0x4c77('0x47')]=_[_0x4c77('0x48')](_0x184859[_0x4c77('0x47')]);_0x4decbb[_0x4c77('0x49')]=_['intersection'](_0x4decbb['model'],_0x4decbb[_0x4c77('0x47')]);_0x3038ca[_0x4c77('0x4a')]=_[_0x4c77('0x4b')](_0x4decbb[_0x4c77('0x46')],qs[_0x4c77('0x4c')](_0x184859[_0x4c77('0x47')]['fields']));_0x3038ca[_0x4c77('0x4a')]=_0x3038ca[_0x4c77('0x4a')][_0x4c77('0x4d')]?_0x3038ca['attributes']:_0x4decbb[_0x4c77('0x46')];if(!_0x184859[_0x4c77('0x47')][_0x4c77('0x4e')](_0x4c77('0x4f'))){_0x3038ca[_0x4c77('0x50')]=qs[_0x4c77('0x50')](_0x184859[_0x4c77('0x47')][_0x4c77('0x50')]);_0x3038ca[_0x4c77('0x33')]=qs[_0x4c77('0x33')](_0x184859[_0x4c77('0x47')][_0x4c77('0x33')]);}_0x3038ca['order']=qs[_0x4c77('0x51')](_0x184859[_0x4c77('0x47')][_0x4c77('0x51')]);_0x3038ca[_0x4c77('0x52')]=qs[_0x4c77('0x49')](_[_0x4c77('0x53')](_0x184859[_0x4c77('0x47')],_0x4decbb['filters']));if(_0x184859[_0x4c77('0x47')][_0x4c77('0x54')]){_0x3038ca['where']=_[_0x4c77('0x55')](_0x3038ca['where'],{'$or':_[_0x4c77('0x42')](_0x48bde4,function(_0x5d6b37){if(_0x5d6b37['type']!==_0x4c77('0x56')){var _0x5907ab={};_0x5907ab[_0x5d6b37[_0x4c77('0x3d')]]={'$like':'%'+_0x184859[_0x4c77('0x47')][_0x4c77('0x54')]+'%'};return _0x5907ab;}})});}_0x3038ca=_[_0x4c77('0x55')]({},_0x3038ca,_0x184859[_0x4c77('0x57')]);var _0x579057={'where':_0x3038ca['where']};return db['FaxAccount'][_0x4c77('0x32')](_0x579057)[_0x4c77('0x25')](function(_0x465e8f){_0x3bd253[_0x4c77('0x32')]=_0x465e8f;if(_0x184859[_0x4c77('0x47')][_0x4c77('0x58')]){_0x3038ca[_0x4c77('0x59')]=[{'all':!![]}];}return db[_0x4c77('0x5a')]['findAll'](_0x3038ca);})[_0x4c77('0x25')](function(_0x2292a2){_0x3bd253['rows']=_0x2292a2;return _0x3bd253;})[_0x4c77('0x25')](respondWithFilteredResult(_0xe1476d,_0x3038ca))[_0x4c77('0x5b')](handleError(_0xe1476d,null));};exports[_0x4c77('0x5c')]=function(_0xfca13c,_0x29b200){var _0x1b26d4={'raw':![],'where':{'id':_0xfca13c['params']['id']},'include':[{'model':db[_0x4c77('0x40')],'as':_0x4c77('0x41')}]},_0x2a2a83={};_0x2a2a83[_0x4c77('0x46')]=_['keys'](db[_0x4c77('0x5a')][_0x4c77('0x43')]);_0x2a2a83[_0x4c77('0x47')]=_['keys'](_0xfca13c[_0x4c77('0x47')]);_0x2a2a83[_0x4c77('0x49')]=_['intersection'](_0x2a2a83[_0x4c77('0x46')],_0x2a2a83[_0x4c77('0x47')]);_0x1b26d4['attributes']=_[_0x4c77('0x4b')](_0x2a2a83['model'],qs['fields'](_0xfca13c[_0x4c77('0x47')][_0x4c77('0x4c')]));_0x1b26d4[_0x4c77('0x4a')]=_0x1b26d4['attributes'][_0x4c77('0x4d')]?_0x1b26d4[_0x4c77('0x4a')]:_0x2a2a83[_0x4c77('0x46')];if(_0xfca13c[_0x4c77('0x47')][_0x4c77('0x58')]){_0x1b26d4[_0x4c77('0x59')]=[{'all':!![]}];}_0x1b26d4=_[_0x4c77('0x55')]({},_0x1b26d4,_0xfca13c['options']);return db[_0x4c77('0x5a')][_0x4c77('0x5d')](_0x1b26d4)[_0x4c77('0x25')](handleEntityNotFound(_0x29b200,null))[_0x4c77('0x25')](respondWithResult(_0x29b200,null))[_0x4c77('0x5b')](handleError(_0x29b200,null));};exports['create']=function(_0x382c45,_0x317893){return db['FaxAccount']['create'](_0x382c45[_0x4c77('0x5e')],{})[_0x4c77('0x25')](function(_0x3e29ff){var _0x554e45=_0x382c45[_0x4c77('0x5f')][_0x4c77('0x3a')]({'plain':!![]});if(!_0x554e45)throw new Error(_0x4c77('0x60'));if(_0x554e45['role']==='user'){var _0xb82578=_0x3e29ff['get']({'plain':!![]});var _0x594655=_0x4c77('0x3b');return db[_0x4c77('0x61')][_0x4c77('0x5d')]({'where':{'name':_0x594655,'userProfileId':_0x554e45['userProfileId']},'raw':!![]})[_0x4c77('0x25')](function(_0x5465e2){if(_0x5465e2&&_0x5465e2[_0x4c77('0x62')]===0x0){return db[_0x4c77('0x3c')][_0x4c77('0x63')]({'name':_0xb82578[_0x4c77('0x3d')],'resourceId':_0xb82578['id'],'type':_0x5465e2[_0x4c77('0x3d')],'sectionId':_0x5465e2['id']},{})[_0x4c77('0x25')](function(){return _0x3e29ff;});}else{return _0x3e29ff;}})['catch'](function(_0x5e269f){logger[_0x4c77('0x2b')](_0x4c77('0x64'),_0x5e269f);throw _0x5e269f;});}return _0x3e29ff;})[_0x4c77('0x25')](respondWithResult(_0x317893,0xc9))['catch'](handleError(_0x317893,null));};exports[_0x4c77('0x38')]=function(_0x14a379,_0x4a69fc){if(_0x14a379[_0x4c77('0x5e')]['id']){delete _0x14a379[_0x4c77('0x5e')]['id'];}return db[_0x4c77('0x5a')][_0x4c77('0x5d')]({'where':{'id':_0x14a379[_0x4c77('0x65')]['id']},'include':[{'model':db[_0x4c77('0x40')],'as':'mandatoryDispositionPause'}]})[_0x4c77('0x25')](handleEntityNotFound(_0x4a69fc,null))[_0x4c77('0x25')](saveUpdates(_0x14a379[_0x4c77('0x5e')],null))['then'](respondWithResult(_0x4a69fc,null))['catch'](handleError(_0x4a69fc,null));};exports[_0x4c77('0x39')]=function(_0xd359e4,_0x1110c2){return db['FaxAccount'][_0x4c77('0x5d')]({'where':{'id':_0xd359e4[_0x4c77('0x65')]['id']}})[_0x4c77('0x25')](handleEntityNotFound(_0x1110c2,null))[_0x4c77('0x25')](removeEntity(_0x1110c2,null))[_0x4c77('0x5b')](handleError(_0x1110c2,null));};exports[_0x4c77('0x66')]=function(_0xb2a6ad,_0x5dcb1f){return db[_0x4c77('0x5a')][_0x4c77('0x66')]()[_0x4c77('0x25')](respondWithResult(_0x5dcb1f,null))[_0x4c77('0x5b')](handleError(_0x5dcb1f,null));};exports[_0x4c77('0x67')]=function(_0x3eafbb,_0x4e3733,_0x8242a9){if(_0x3eafbb['body']['id']){delete _0x3eafbb[_0x4c77('0x5e')]['id'];}return db['FaxAccount']['find']({'where':{'id':_0x3eafbb['params']['id']}})[_0x4c77('0x25')](handleEntityNotFound(_0x4e3733,null))[_0x4c77('0x25')](function(_0xb3d91e){if(_0xb3d91e){_0x3eafbb[_0x4c77('0x5e')]['FaxAccountId']=_0xb3d91e['id'];return db[_0x4c77('0x68')][_0x4c77('0x63')](_0x3eafbb[_0x4c77('0x5e')]);}})[_0x4c77('0x25')](respondWithResult(_0x4e3733,null))[_0x4c77('0x5b')](handleError(_0x4e3733,null));};exports['getDispositions']=function(_0xbe9571,_0x4b9e9d,_0x56e36e){var _0x17bcad={'raw':![],'where':{}};var _0x10cb0d={};var _0x1ff0fe={'count':0x0,'rows':[]};return db[_0x4c77('0x5a')][_0x4c77('0x69')]({'where':{'id':_0xbe9571['params']['id']}})['then'](handleEntityNotFound(_0x4b9e9d,null))['then'](function(_0xddabcb){if(_0xddabcb){_0x10cb0d[_0x4c77('0x46')]=_[_0x4c77('0x48')](db['Disposition'][_0x4c77('0x43')]);_0x10cb0d[_0x4c77('0x47')]=_[_0x4c77('0x48')](_0xbe9571[_0x4c77('0x47')]);_0x10cb0d[_0x4c77('0x49')]=_[_0x4c77('0x4b')](_0x10cb0d[_0x4c77('0x46')],_0x10cb0d[_0x4c77('0x47')]);_0x17bcad[_0x4c77('0x4a')]=_[_0x4c77('0x4b')](_0x10cb0d[_0x4c77('0x46')],qs[_0x4c77('0x4c')](_0xbe9571[_0x4c77('0x47')]['fields']));_0x17bcad[_0x4c77('0x4a')]=_0x17bcad[_0x4c77('0x4a')][_0x4c77('0x4d')]?_0x17bcad['attributes']:_0x10cb0d[_0x4c77('0x46')];if(!_0xbe9571[_0x4c77('0x47')][_0x4c77('0x4e')]('nolimit')){_0x17bcad[_0x4c77('0x50')]=qs['limit'](_0xbe9571['query'][_0x4c77('0x50')]);_0x17bcad['offset']=qs['offset'](_0xbe9571[_0x4c77('0x47')][_0x4c77('0x33')]);}_0x17bcad['order']=qs[_0x4c77('0x51')](_0xbe9571['query'][_0x4c77('0x51')]);_0x17bcad[_0x4c77('0x52')]=qs[_0x4c77('0x49')](_[_0x4c77('0x53')](_0xbe9571['query'],_0x10cb0d[_0x4c77('0x49')]));_0x17bcad[_0x4c77('0x52')]['FaxAccountId']=_0xddabcb['id'];if(_0xbe9571['query']['filter']){_0x17bcad[_0x4c77('0x52')]=_[_0x4c77('0x55')](_0x17bcad[_0x4c77('0x52')],{'$or':_['map'](_0x17bcad['attributes'],function(_0x79e80e){var _0xc50f9c={};_0xc50f9c[_0x79e80e]={'$like':'%'+_0xbe9571[_0x4c77('0x47')]['filter']+'%'};return _0xc50f9c;})});}_0x17bcad=_['merge']({},_0x17bcad,_0xbe9571['options']);return db[_0x4c77('0x68')][_0x4c77('0x32')]({'where':_0x17bcad[_0x4c77('0x52')]})['then'](function(_0x5c3e20){_0x1ff0fe[_0x4c77('0x32')]=_0x5c3e20;if(_0xbe9571[_0x4c77('0x47')][_0x4c77('0x58')]){_0x17bcad[_0x4c77('0x59')]=[{'all':!![]}];}return db[_0x4c77('0x68')][_0x4c77('0x6a')](_0x17bcad);})[_0x4c77('0x25')](function(_0x205b88){_0x1ff0fe[_0x4c77('0x6b')]=_0x205b88;return _0x1ff0fe;});}})[_0x4c77('0x25')](respondWithFilteredResult(_0x4b9e9d,_0x17bcad))[_0x4c77('0x5b')](handleError(_0x4b9e9d,null));};exports[_0x4c77('0x6c')]=function(_0x2a8487,_0x24e372,_0x5c85b3){return db[_0x4c77('0x5a')][_0x4c77('0x5d')]({'where':{'id':_0x2a8487[_0x4c77('0x65')]['id']}})[_0x4c77('0x25')](handleEntityNotFound(_0x24e372,null))['then'](function(_0x25ed20){if(_0x25ed20){return _0x25ed20[_0x4c77('0x6c')](_0x2a8487[_0x4c77('0x47')]['ids']);}})[_0x4c77('0x25')](respondWithStatusCode(_0x24e372,null))[_0x4c77('0x5b')](handleError(_0x24e372,null));};exports[_0x4c77('0x6d')]=function(_0x1d1eb0,_0x2f0549,_0x29476f){if(_0x1d1eb0[_0x4c77('0x5e')]['id']){delete _0x1d1eb0[_0x4c77('0x5e')]['id'];}return db[_0x4c77('0x5a')][_0x4c77('0x5d')]({'where':{'id':_0x1d1eb0[_0x4c77('0x65')]['id']}})[_0x4c77('0x25')](handleEntityNotFound(_0x2f0549,null))[_0x4c77('0x25')](function(_0x5b857e){if(_0x5b857e){_0x1d1eb0[_0x4c77('0x5e')][_0x4c77('0x6e')]=_0x5b857e['id'];return db[_0x4c77('0x6f')][_0x4c77('0x63')](_0x1d1eb0[_0x4c77('0x5e')]);}})[_0x4c77('0x25')](respondWithResult(_0x2f0549,null))[_0x4c77('0x5b')](handleError(_0x2f0549,null));};exports[_0x4c77('0x70')]=function(_0x25c887,_0x187398,_0x985369){var _0x522012={'raw':![],'where':{}};var _0x30614f={};var _0x51be36={'count':0x0,'rows':[]};return db[_0x4c77('0x5a')][_0x4c77('0x69')]({'where':{'id':_0x25c887[_0x4c77('0x65')]['id']}})[_0x4c77('0x25')](handleEntityNotFound(_0x187398,null))['then'](function(_0x2aa452){if(_0x2aa452){_0x30614f[_0x4c77('0x46')]=_['keys'](db['CannedAnswer'][_0x4c77('0x43')]);_0x30614f['query']=_[_0x4c77('0x48')](_0x25c887[_0x4c77('0x47')]);_0x30614f[_0x4c77('0x49')]=_[_0x4c77('0x4b')](_0x30614f[_0x4c77('0x46')],_0x30614f['query']);_0x522012[_0x4c77('0x4a')]=_['intersection'](_0x30614f['model'],qs[_0x4c77('0x4c')](_0x25c887[_0x4c77('0x47')][_0x4c77('0x4c')]));_0x522012[_0x4c77('0x4a')]=_0x522012[_0x4c77('0x4a')][_0x4c77('0x4d')]?_0x522012[_0x4c77('0x4a')]:_0x30614f[_0x4c77('0x46')];if(!_0x25c887['query'][_0x4c77('0x4e')](_0x4c77('0x4f'))){_0x522012['limit']=qs[_0x4c77('0x50')](_0x25c887[_0x4c77('0x47')][_0x4c77('0x50')]);_0x522012[_0x4c77('0x33')]=qs['offset'](_0x25c887[_0x4c77('0x47')][_0x4c77('0x33')]);}_0x522012[_0x4c77('0x71')]=qs[_0x4c77('0x51')](_0x25c887[_0x4c77('0x47')][_0x4c77('0x51')]);_0x522012[_0x4c77('0x52')]=qs[_0x4c77('0x49')](_[_0x4c77('0x53')](_0x25c887[_0x4c77('0x47')],_0x30614f[_0x4c77('0x49')]));_0x522012[_0x4c77('0x52')]['FaxAccountId']=_0x2aa452['id'];if(_0x25c887[_0x4c77('0x47')]['filter']){_0x522012[_0x4c77('0x52')]=_[_0x4c77('0x55')](_0x522012['where'],{'$or':_[_0x4c77('0x42')](_0x522012['attributes'],function(_0x27f5ab){var _0xb89c9={};_0xb89c9[_0x27f5ab]={'$like':'%'+_0x25c887[_0x4c77('0x47')][_0x4c77('0x54')]+'%'};return _0xb89c9;})});}_0x522012=_['merge']({},_0x522012,_0x25c887[_0x4c77('0x57')]);return db[_0x4c77('0x6f')][_0x4c77('0x32')]({'where':_0x522012[_0x4c77('0x52')]})['then'](function(_0x36f4a6){_0x51be36[_0x4c77('0x32')]=_0x36f4a6;if(_0x25c887[_0x4c77('0x47')][_0x4c77('0x58')]){_0x522012[_0x4c77('0x59')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x522012);})[_0x4c77('0x25')](function(_0x3df156){_0x51be36['rows']=_0x3df156;return _0x51be36;});}})['then'](respondWithFilteredResult(_0x187398,_0x522012))[_0x4c77('0x5b')](handleError(_0x187398,null));};exports[_0x4c77('0x72')]=function(_0xfe954f,_0x312a56,_0x5875ba){return db[_0x4c77('0x5a')][_0x4c77('0x5d')]({'where':{'id':_0xfe954f[_0x4c77('0x65')]['id']}})[_0x4c77('0x25')](handleEntityNotFound(_0x312a56,null))[_0x4c77('0x25')](function(_0x18d312){if(_0x18d312){return _0x18d312[_0x4c77('0x72')](_0xfe954f[_0x4c77('0x47')][_0x4c77('0x73')]);}})[_0x4c77('0x25')](respondWithStatusCode(_0x312a56,null))[_0x4c77('0x5b')](handleError(_0x312a56,null));};exports[_0x4c77('0x74')]=function(_0x31cb98,_0x12930a,_0x5ebcb1){return db[_0x4c77('0x75')][_0x4c77('0x5d')]({'where':{'id':_0x31cb98['params']['id']}})[_0x4c77('0x25')](handleEntityNotFound(_0x12930a,null))[_0x4c77('0x25')](function(_0x3f628b){if(_0x3f628b){return _0x3f628b[_0x4c77('0x74')](_0x31cb98[_0x4c77('0x5e')][_0x4c77('0x73')],_[_0x4c77('0x76')](_0x31cb98[_0x4c77('0x5e')],['ids','id'])||{});}})[_0x4c77('0x25')](respondWithResult(_0x12930a,null))[_0x4c77('0x5b')](handleError(_0x12930a,null));};exports[_0x4c77('0x77')]=function(_0x42b95c,_0x733e68,_0xc508d1){var _0x26f368={'raw':![],'where':{}};var _0x6ef3a9={};var _0x3ce9d2={'count':0x0,'rows':[]};return db['FaxAccount'][_0x4c77('0x69')]({'where':{'id':_0x42b95c[_0x4c77('0x65')]['id']}})[_0x4c77('0x25')](handleEntityNotFound(_0x733e68,null))[_0x4c77('0x25')](function(_0x1ca6a4){if(_0x1ca6a4){_0x6ef3a9[_0x4c77('0x46')]=_[_0x4c77('0x48')](db['FaxInteraction'][_0x4c77('0x43')]);_0x6ef3a9[_0x4c77('0x47')]=_[_0x4c77('0x48')](_0x42b95c[_0x4c77('0x47')]);_0x6ef3a9[_0x4c77('0x49')]=_[_0x4c77('0x4b')](_0x6ef3a9['model'],_0x6ef3a9[_0x4c77('0x47')]);_0x26f368[_0x4c77('0x4a')]=_[_0x4c77('0x4b')](_0x6ef3a9['model'],qs[_0x4c77('0x4c')](_0x42b95c[_0x4c77('0x47')][_0x4c77('0x4c')]));_0x26f368[_0x4c77('0x4a')]=_0x26f368['attributes'][_0x4c77('0x4d')]?_0x26f368[_0x4c77('0x4a')]:_0x6ef3a9[_0x4c77('0x46')];if(!_0x42b95c[_0x4c77('0x47')][_0x4c77('0x4e')](_0x4c77('0x4f'))){_0x26f368[_0x4c77('0x50')]=qs[_0x4c77('0x50')](_0x42b95c['query'][_0x4c77('0x50')]);_0x26f368[_0x4c77('0x33')]=qs[_0x4c77('0x33')](_0x42b95c[_0x4c77('0x47')][_0x4c77('0x33')]);}_0x26f368[_0x4c77('0x71')]=qs['sort'](_0x42b95c[_0x4c77('0x47')][_0x4c77('0x51')]);_0x26f368['where']=qs['filters'](_[_0x4c77('0x53')](_0x42b95c['query'],_0x6ef3a9[_0x4c77('0x49')]));_0x26f368[_0x4c77('0x52')][_0x4c77('0x6e')]=_0x1ca6a4['id'];if(_0x42b95c[_0x4c77('0x47')]['filter']){_0x26f368[_0x4c77('0x52')]=_[_0x4c77('0x55')](_0x26f368[_0x4c77('0x52')],{'$or':_[_0x4c77('0x42')](_0x26f368['attributes'],function(_0x37a04b){var _0x138f3e={};_0x138f3e[_0x37a04b]={'$like':'%'+_0x42b95c[_0x4c77('0x47')][_0x4c77('0x54')]+'%'};return _0x138f3e;})});}_0x26f368=_[_0x4c77('0x55')]({},_0x26f368,_0x42b95c[_0x4c77('0x57')]);return db[_0x4c77('0x75')][_0x4c77('0x32')]({'where':_0x26f368[_0x4c77('0x52')]})['then'](function(_0x230b86){_0x3ce9d2[_0x4c77('0x32')]=_0x230b86;if(_0x42b95c['query'][_0x4c77('0x58')]){_0x26f368['include']=[{'model':db[_0x4c77('0x78')],'as':'Contact','required':![]},{'model':db[_0x4c77('0x79')],'as':_0x4c77('0x7a'),'attributes':[_0x4c77('0x3d'),_0x4c77('0x7b'),_0x4c77('0x7c')],'required':![]},{'model':db[_0x4c77('0x7d')],'as':_0x4c77('0x7e'),'attributes':['id',_0x4c77('0x3d'),_0x4c77('0x7f')],'where':_0x42b95c['query'][_0x4c77('0x80')]?{'id':_0x42b95c[_0x4c77('0x47')][_0x4c77('0x80')]}:undefined,'required':_0x42b95c[_0x4c77('0x47')][_0x4c77('0x80')]?!![]:![]}];}return db[_0x4c77('0x75')][_0x4c77('0x6a')](_0x26f368);})[_0x4c77('0x25')](function(_0x44ab16){_0x3ce9d2['rows']=_0x44ab16;return _0x3ce9d2;});}})[_0x4c77('0x25')](respondWithFilteredResult(_0x733e68,_0x26f368))[_0x4c77('0x5b')](handleError(_0x733e68,null));};exports[_0x4c77('0x81')]=function(_0x24d647,_0x5e76d3,_0x4a31cb){return db[_0x4c77('0x5a')][_0x4c77('0x69')]({'where':{'id':_0x24d647[_0x4c77('0x65')]['id']}})[_0x4c77('0x25')](handleEntityNotFound(_0x5e76d3,null))[_0x4c77('0x25')](function(_0x33720b){if(_0x33720b){return db['sequelize'][_0x4c77('0x82')](function(_0x49f94c){return db['FaxApplication'][_0x4c77('0x39')]({'where':{'FaxAccountId':_0x24d647['params']['id']},'transaction':_0x49f94c})[_0x4c77('0x25')](function(_0x4bb05c){var _0x454e7e=_['map'](_0x24d647[_0x4c77('0x5e')],function(_0x45f44c){_0x45f44c['FaxAccountId']=_0x24d647[_0x4c77('0x65')]['id'];return _0x45f44c;});return db[_0x4c77('0x83')]['bulkCreate'](_0x454e7e,{'transaction':_0x49f94c});});})[_0x4c77('0x25')](function(){return db[_0x4c77('0x83')][_0x4c77('0x84')]({'where':{'FaxAccountId':_0x24d647[_0x4c77('0x65')]['id']},'order':'priority'});});}})[_0x4c77('0x25')](respondWithResult(_0x5e76d3,null))[_0x4c77('0x5b')](handleError(_0x5e76d3,null));};exports[_0x4c77('0x85')]=function(_0x2ff189,_0x75d377,_0xe7903b){var _0x268c7b={};var _0xc7e95c={};var _0x2c4cce;var _0x2c384b;return db[_0x4c77('0x5a')][_0x4c77('0x69')]({'where':{'id':_0x2ff189[_0x4c77('0x65')]['id']}})[_0x4c77('0x25')](handleEntityNotFound(_0x75d377,null))[_0x4c77('0x25')](function(_0xed0f74){if(_0xed0f74){_0x2c4cce=_0xed0f74;_0xc7e95c[_0x4c77('0x46')]=_[_0x4c77('0x48')](db[_0x4c77('0x83')]['rawAttributes']);_0xc7e95c['query']=_[_0x4c77('0x48')](_0x2ff189[_0x4c77('0x47')]);_0xc7e95c['filters']=_[_0x4c77('0x4b')](_0xc7e95c[_0x4c77('0x46')],_0xc7e95c[_0x4c77('0x47')]);_0x268c7b[_0x4c77('0x4a')]=_[_0x4c77('0x4b')](_0xc7e95c['model'],qs[_0x4c77('0x4c')](_0x2ff189['query']['fields']));_0x268c7b[_0x4c77('0x4a')]=_0x268c7b[_0x4c77('0x4a')]['length']?_0x268c7b[_0x4c77('0x4a')]:_0xc7e95c['model'];_0x268c7b[_0x4c77('0x71')]=qs[_0x4c77('0x51')](_0x2ff189[_0x4c77('0x47')]['sort']);_0x268c7b[_0x4c77('0x52')]=qs['filters'](_[_0x4c77('0x53')](_0x2ff189['query'],_0xc7e95c[_0x4c77('0x49')]));if(_0x2ff189[_0x4c77('0x47')][_0x4c77('0x54')]){_0x268c7b['where']=_[_0x4c77('0x55')](_0x268c7b['where'],{'$or':_[_0x4c77('0x42')](_0x268c7b['attributes'],function(_0x42d5cc){var _0x5498af={};_0x5498af[_0x42d5cc]={'$like':'%'+_0x2ff189[_0x4c77('0x47')][_0x4c77('0x54')]+'%'};return _0x5498af;})});}_0x268c7b=_['merge']({},_0x268c7b,_0x2ff189[_0x4c77('0x57')]);return _0x2c4cce[_0x4c77('0x85')](_0x268c7b);}})[_0x4c77('0x25')](function(_0x25145e){if(_0x25145e){_0x2c384b=_0x25145e['length'];if(!_0x2ff189[_0x4c77('0x47')]['hasOwnProperty'](_0x4c77('0x4f'))){_0x268c7b[_0x4c77('0x50')]=qs[_0x4c77('0x50')](_0x2ff189[_0x4c77('0x47')]['limit']);_0x268c7b[_0x4c77('0x33')]=qs[_0x4c77('0x33')](_0x2ff189[_0x4c77('0x47')][_0x4c77('0x33')]);}return _0x2c4cce[_0x4c77('0x85')](_0x268c7b);}})['then'](function(_0x98ba5e){if(_0x98ba5e){return _0x98ba5e?{'count':_0x2c384b,'rows':_0x98ba5e}:null;}})['then'](respondWithResult(_0x75d377,null))['catch'](handleError(_0x75d377,null));};function Extension(_0x4853d6,_0x468b5e,_0x300b70,_0x4e896b){this[_0x4c77('0x86')]=_0x4c77('0x87');this[_0x4c77('0x88')]=_0x4853d6[_0x4c77('0x89')];this[_0x4c77('0x8a')]=_0x4e896b;this[_0x4c77('0x8b')]=_0x4c77('0x8c');this['description']='Fax\x20Extension';this[_0x4c77('0x6e')]=_0x4853d6['id'];this[_0x4c77('0x8d')]=_0x468b5e;this['appdata']=_0x300b70;}function createExtensionsReciveFax(_0x15b371){var _0x279543=0x1;var _0x2d726b=[];_0x2d726b[_0x4c77('0x8e')](new Extension(_0x15b371,_0x279543,'',_0x4c77('0x8f')));_0x279543+=0x1;_0x2d726b[_0x4c77('0x8e')](new Extension(_0x15b371,_0x279543,_0x4c77('0x90'),'Set'));_0x279543+=0x1;for(var _0x315c46 in _0x15b371){if(_0x15b371['hasOwnProperty'](_0x315c46)&&(_0x315c46==='ecm'||_0x315c46===_0x4c77('0x89')||_0x315c46===_0x4c77('0x91')||_0x315c46==='faxdetect'||_0x315c46==='headerinfo'||_0x315c46===_0x4c77('0x92')||_0x315c46===_0x4c77('0x93')||_0x315c46===_0x4c77('0x94')||_0x315c46===_0x4c77('0x95'))){_0x2d726b[_0x4c77('0x8e')](new Extension(_0x15b371,_0x279543,_0x4c77('0x96')+_0x315c46+')='+_0x15b371[_0x315c46],_0x4c77('0x97')));_0x279543+=0x1;}}_0x2d726b[_0x4c77('0x8e')](new Extension(_0x15b371,_0x279543,'6',_0x4c77('0x98')));_0x279543+=0x1;_0x2d726b['push'](new Extension(_0x15b371,_0x279543,_0x4c77('0x99'),'ReceiveFax'));_0x279543=0x0;return _0x2d726b;}exports[_0x4c77('0x9a')]=function(_0x4d66c3,_0x48bccb,_0x3cffc7){var _0x41e532;return db['sequelize']['transaction'](function(_0x970c85){return db[_0x4c77('0x5a')][_0x4c77('0x63')](_0x4d66c3[_0x4c77('0x5e')],{'transaction':_0x970c85})[_0x4c77('0x25')](function(_0x5eb85b){_0x41e532=_0x5eb85b[_0x4c77('0x3a')]({'plain':!![]});return db[_0x4c77('0x9b')][_0x4c77('0x9c')](createExtensionsReciveFax(_0x41e532),{'transaction':_0x970c85});});})[_0x4c77('0x25')](function(){return _0x41e532;})[_0x4c77('0x25')](respondWithResult(_0x48bccb,null))[_0x4c77('0x5b')](handleError(_0x48bccb,null));};exports[_0x4c77('0x9d')]=function(_0x50589b,_0x1d686a,_0x3e3f3f){var _0x410c8b;return db[_0x4c77('0x9e')][_0x4c77('0x82')](function(_0x1d0175){return db[_0x4c77('0x5a')][_0x4c77('0x38')](_0x50589b[_0x4c77('0x5e')],{'where':{'id':_0x50589b['body']['id']},'transaction':_0x1d0175})[_0x4c77('0x25')](function(_0x23d271){return db['VoiceExtension'][_0x4c77('0x39')]({'where':{'FaxAccountId':_0x50589b[_0x4c77('0x5e')]['id']},'transaction':_0x1d0175})[_0x4c77('0x25')](function(_0x4f7891){return db[_0x4c77('0x9b')][_0x4c77('0x9c')](createExtensionsReciveFax(_[_0x4c77('0x76')](_0x50589b[_0x4c77('0x5e')],['tech',_0x4c77('0x45'),_0x4c77('0x9f'),'updatedAt','TrunkId',_0x4c77('0xa0')])),{'transaction':_0x1d0175});});});})[_0x4c77('0x25')](function(){return db[_0x4c77('0x5a')][_0x4c77('0xa1')](_0x50589b[_0x4c77('0x5e')]['id']);})['then'](respondWithResult(_0x1d686a,null))[_0x4c77('0x5b')](handleError(_0x1d686a,null));};exports['getMessages']=function(_0x2bb073,_0x4de4fb,_0xa0dbb4){var _0x4d8a78={'raw':!![],'where':{}};var _0x398124={};var _0x4f3139={'count':0x0,'rows':[]};return db[_0x4c77('0x5a')][_0x4c77('0x69')]({'where':{'id':_0x2bb073[_0x4c77('0x65')]['id']}})[_0x4c77('0x25')](handleEntityNotFound(_0x4de4fb,null))[_0x4c77('0x25')](function(_0x2a77d8){if(_0x2a77d8){_0x398124[_0x4c77('0x46')]=_['keys'](db[_0x4c77('0xa2')][_0x4c77('0x43')]);_0x398124[_0x4c77('0x47')]=_[_0x4c77('0x48')](_0x2bb073[_0x4c77('0x47')]);_0x398124[_0x4c77('0x49')]=_[_0x4c77('0x4b')](_0x398124[_0x4c77('0x46')],_0x398124['query']);_0x4d8a78['attributes']=_[_0x4c77('0x4b')](_0x398124[_0x4c77('0x46')],qs[_0x4c77('0x4c')](_0x2bb073[_0x4c77('0x47')]['fields']));_0x4d8a78['attributes']=_0x4d8a78[_0x4c77('0x4a')][_0x4c77('0x4d')]?_0x4d8a78['attributes']:_0x398124[_0x4c77('0x46')];if(!_0x2bb073[_0x4c77('0x47')]['hasOwnProperty'](_0x4c77('0x4f'))){_0x4d8a78[_0x4c77('0x50')]=qs['limit'](_0x2bb073[_0x4c77('0x47')]['limit']);_0x4d8a78[_0x4c77('0x33')]=qs['offset'](_0x2bb073[_0x4c77('0x47')][_0x4c77('0x33')]);}_0x4d8a78['order']=qs[_0x4c77('0x51')](_0x2bb073[_0x4c77('0x47')][_0x4c77('0x51')]);_0x4d8a78[_0x4c77('0x52')]=qs[_0x4c77('0x49')](_['pick'](_0x2bb073[_0x4c77('0x47')],_0x398124[_0x4c77('0x49')]));_0x4d8a78[_0x4c77('0x52')]['FaxAccountId']=_0x2a77d8['id'];if(_0x2bb073[_0x4c77('0x47')][_0x4c77('0x54')]){_0x4d8a78[_0x4c77('0x52')]=_[_0x4c77('0x55')](_0x4d8a78[_0x4c77('0x52')],{'$or':_[_0x4c77('0x42')](_0x4d8a78['attributes'],function(_0x59b5dc){var _0x44a60f={};_0x44a60f[_0x59b5dc]={'$like':'%'+_0x2bb073[_0x4c77('0x47')][_0x4c77('0x54')]+'%'};return _0x44a60f;})});}if(_0x2bb073['query'][_0x4c77('0xa3')]){var _0x2136c6=_0x2bb073[_0x4c77('0x47')]['$gte'][_0x4c77('0xa4')](',');var _0x2cde2e={};_0x2cde2e[_0x2136c6[0x0]]={'$gte':moment(_0x2136c6[0x1])[_0x4c77('0xa5')]('YYYY-MM-DD\x20HH:mm:ss')};_0x4d8a78[_0x4c77('0x52')]=_[_0x4c77('0x55')](_0x4d8a78[_0x4c77('0x52')],_0x2cde2e);}_0x4d8a78=_[_0x4c77('0x55')]({},_0x4d8a78,_0x2bb073[_0x4c77('0x57')]);return db['FaxMessage'][_0x4c77('0x32')]({'where':_0x4d8a78[_0x4c77('0x52')]})['then'](function(_0x5aa2f7){_0x4f3139['count']=_0x5aa2f7;if(_0x2bb073['query'][_0x4c77('0x58')]){_0x4d8a78[_0x4c77('0x59')]=[{'all':!![]}];}return db['FaxMessage'][_0x4c77('0x6a')](_0x4d8a78);})[_0x4c77('0x25')](function(_0x4148fd){_0x4f3139[_0x4c77('0x6b')]=_0x4148fd;return _0x4f3139;});}})[_0x4c77('0x25')](respondWithFilteredResult(_0x4de4fb,_0x4d8a78))[_0x4c77('0x5b')](handleError(_0x4de4fb,null));};exports['send']=function(_0x14258e,_0x10f342,_0x3486ae){var _0x23f51e,_0x242d0a={},_0xfc3db5;if(_0x14258e['body']['to']){_0xfc3db5=_0x14258e[_0x4c77('0x5e')]['to'][0x0];}return db['FaxAccount']['find']({'where':{'id':_0x14258e[_0x4c77('0x65')]['id']},'include':[{'model':db[_0x4c77('0xa6')],'as':'List','include':[{'model':db[_0x4c77('0x78')],'as':_0x4c77('0xa7'),'where':{'fax':_0xfc3db5},'limit':0x1,'order':[[_0x4c77('0xa8'),_0x4c77('0xa9')]]}]}]})[_0x4c77('0x25')](handleEntityNotFound(_0x10f342,null))[_0x4c77('0x25')](function(_0x27c6d5){_0x23f51e=_0x27c6d5;if(_0x14258e['body'][_0x4c77('0xaa')]&&_0x14258e[_0x4c77('0x5e')]['attachments'][_0x4c77('0x4d')]){for(var _0x22b817=0x0;_0x22b817<_0x14258e[_0x4c77('0x5e')][_0x4c77('0xaa')][_0x4c77('0x4d')];_0x22b817+=0x1){_0x14258e[_0x4c77('0x5e')][_0x4c77('0xaa')][_0x22b817]={'filename':_0x14258e['body'][_0x4c77('0xaa')][_0x22b817][_0x4c77('0x3d')],'id':_0x14258e[_0x4c77('0x5e')][_0x4c77('0xaa')][_0x22b817]['id'],'path':path['join'](config[_0x4c77('0xab')],_0x4c77('0xac'),_0x14258e[_0x4c77('0x5e')]['attachments'][_0x22b817][_0x4c77('0xad')])};}}return respondWithRpcPromise(_0x4c77('0xae'),'CheckAfterSend',{'FaxAccountId':_['isNil'](_0x14258e[_0x4c77('0x65')]['id'])?undefined:_0x14258e['params']['id'],'path':_[_0x4c77('0xaf')](_0x14258e[_0x4c77('0x5e')][_0x4c77('0xaa')][0x0]['path'])?undefined:_0x14258e[_0x4c77('0x5e')][_0x4c77('0xaa')][0x0][_0x4c77('0x9')],'fax':_[_0x4c77('0xaf')](_0x14258e[_0x4c77('0x5e')]['to'][0x0])?undefined:_0x14258e[_0x4c77('0x5e')]['to'][0x0]},client9002);})['then'](function(){if(_0x23f51e){if(_[_0x4c77('0xaf')](_0x14258e[_0x4c77('0x5e')][_0x4c77('0xb0')])){_0x14258e[_0x4c77('0x5e')][_0x4c77('0xb0')]=util['format'](_0x4c77('0xb1'),_0x23f51e[_0x4c77('0x3d')],_0x23f51e[_0x4c77('0xb2')]);}if(_0x23f51e[_0x4c77('0xb3')]){if(_0x23f51e[_0x4c77('0xb3')][_0x4c77('0xa7')][_0x4c77('0x4d')]){return _0x23f51e['List']['Contacts'][0x0];}else{return db[_0x4c77('0x78')]['create'](_[_0x4c77('0x1b')](_0x14258e[_0x4c77('0x5e')],{'firstName':_0x14258e['body']['to'][0x0],'phone':_0x14258e['body']['to'][0x0],'fax':_0x14258e[_0x4c77('0x5e')]['to'][0x0],'ListId':_0x23f51e['ListId']}));}}else{throw new Error('List\x20not\x20found');}}else{throw new Error(_0x4c77('0xb4'));}})[_0x4c77('0x25')](function(_0x1cc271){if(_0x1cc271){return db[_0x4c77('0x75')]['find']({'where':{'ContactId':_0x1cc271['id'],'closed':![],'FaxAccountId':_0x23f51e['id']}})['then'](function(_0x310de3){if(_0x310de3){return[_0x310de3,![]];}return db[_0x4c77('0x75')][_0x4c77('0x63')]({'UserId':_0x14258e[_0x4c77('0x5f')]['id'],'ContactId':_0x1cc271['id'],'FaxAccountId':_0x23f51e['id'],'fax':_0x14258e[_0x4c77('0x5e')]['to'][0x0],'firstMsgDirection':_0x4c77('0xb5'),'Messages':[_['merge'](_0x14258e[_0x4c77('0x5e')],{'read':![],'body':_0x14258e[_0x4c77('0x5e')][_0x4c77('0xaa')][0x0]['filename'],'FaxAccountId':_0x23f51e['id'],'UserId':_0x14258e['user']['id'],'ContactId':_0x1cc271['id'],'AttachmentId':_0x14258e[_0x4c77('0x5e')][_0x4c77('0xaa')][0x0]['id']})]},{'include':[{'model':db[_0x4c77('0xa2')],'as':_0x4c77('0xb6')}]})[_0x4c77('0x25')](function(_0x4e194c){return[_0x4e194c,!![]];});});}else{throw new Error(_0x4c77('0xb7'));}})[_0x4c77('0xb8')](function(_0x2abf1c,_0x3517dd){if(_0x3517dd){return _0x2abf1c;}return db[_0x4c77('0xa2')][_0x4c77('0x63')]({'direction':_0x4c77('0xb5'),'read':![],'body':_0x14258e[_0x4c77('0x5e')][_0x4c77('0xaa')][0x0][_0x4c77('0xb9')],'FaxAccountId':_0x23f51e['id'],'FaxInteractionId':_0x2abf1c['id'],'UserId':_0x14258e[_0x4c77('0x5f')]['id'],'ContactId':_0x2abf1c[_0x4c77('0xba')],'AttachmentId':_0x14258e[_0x4c77('0x5e')][_0x4c77('0xaa')][0x0]['id']})['then'](function(_0x5aafb6){_0x2abf1c[_0x4c77('0xbb')][_0x4c77('0xb6')]=[];_0x2abf1c[_0x4c77('0xbb')][_0x4c77('0xb6')]['push'](_0x5aafb6[_0x4c77('0xbb')]);return _0x2abf1c;});})[_0x4c77('0x25')](function(_0x3ebe27){respondWithRpcPromise('SendFax','SendFax',{'FaxAccountId':_[_0x4c77('0xaf')](_0x14258e[_0x4c77('0x65')]['id'])?undefined:_0x14258e['params']['id'],'path':_[_0x4c77('0xaf')](_0x14258e[_0x4c77('0x5e')][_0x4c77('0xaa')][0x0]['path'])?undefined:_0x14258e['body'][_0x4c77('0xaa')][0x0][_0x4c77('0x9')],'fax':_[_0x4c77('0xaf')](_0x14258e[_0x4c77('0x5e')]['to'][0x0])?undefined:_0x14258e[_0x4c77('0x5e')]['to'][0x0],'AttachmentId':_0x14258e[_0x4c77('0x5e')]['attachments'][0x0]['id']},client9002)[_0x4c77('0x25')](function(_0x100758){logger[_0x4c77('0x26')]('SendFaxRpc,\x20%s',_0x100758);})[_0x4c77('0x5b')](function(_0x42d76b){logger['info']('SendFaxRpc,\x20%s',_0x42d76b);});return _0x3ebe27;})['then'](respondWithResult(_0x10f342,null))['catch'](handleError(_0x10f342,null));};exports[_0x4c77('0xbc')]=function(_0x39de84,_0x39a84c,_0x46d637){return db[_0x4c77('0x5a')]['find']({'where':{'id':_0x39de84[_0x4c77('0x65')]['id']}})[_0x4c77('0x25')](handleEntityNotFound(_0x39a84c,null))[_0x4c77('0x25')](function(_0x239cdf){if(_0x239cdf){return _0x239cdf[_0x4c77('0xbc')](_0x39de84[_0x4c77('0x5e')][_0x4c77('0x73')],_[_0x4c77('0x76')](_0x39de84[_0x4c77('0x5e')],[_0x4c77('0x73'),'id'])||{})['spread'](function(_0x319fa5){for(var _0x2f4184=0x0;_0x2f4184<_0x39de84[_0x4c77('0x5e')][_0x4c77('0x73')][_0x4c77('0x4d')];_0x2f4184+=0x1){socket[_0x4c77('0xbd')](_0x4c77('0xbe'),{'UserId':_0x39de84[_0x4c77('0x5e')][_0x4c77('0x73')][_0x2f4184],'FaxAccountId':_0x39de84['params']['id']});}return _0x319fa5;});}})[_0x4c77('0x25')](respondWithResult(_0x39a84c,null))[_0x4c77('0x5b')](handleError(_0x39a84c,null));};exports['removeAgents']=function(_0x495493,_0x110d96,_0x2dafee){return db[_0x4c77('0x5a')][_0x4c77('0x5d')]({'where':{'id':_0x495493['params']['id']}})[_0x4c77('0x25')](handleEntityNotFound(_0x110d96,null))[_0x4c77('0x25')](function(_0x3cb633){if(_0x3cb633){return _0x3cb633[_0x4c77('0xbf')](_0x495493['query'][_0x4c77('0x73')])[_0x4c77('0x25')](function(){if(_['isArray'](_0x495493['query']['ids'])){for(var _0x21f8a9=0x0;_0x21f8a9<_0x495493[_0x4c77('0x47')][_0x4c77('0x73')][_0x4c77('0x4d')];_0x21f8a9+=0x1){socket['emit'](_0x4c77('0xc0'),{'UserId':Number(_0x495493['query']['ids'][_0x21f8a9]),'FaxAccountId':Number(_0x495493[_0x4c77('0x65')]['id'])});}}else{socket['emit']('userFaxAccount:remove',{'UserId':Number(_0x495493['query'][_0x4c77('0x73')]),'FaxAccountId':Number(_0x495493[_0x4c77('0x65')]['id'])});}});}})['then'](respondWithStatusCode(_0x110d96,null))[_0x4c77('0x5b')](handleError(_0x110d96,null));};exports[_0x4c77('0xc1')]=function(_0x4ad2df,_0x126cee,_0x5ed29){var _0x40841f={};var _0x14062b={};var _0x1e4853;var _0x26c156;return db['FaxAccount'][_0x4c77('0x69')]({'where':{'id':_0x4ad2df[_0x4c77('0x65')]['id']}})['then'](handleEntityNotFound(_0x126cee,null))[_0x4c77('0x25')](function(_0xeadae5){if(_0xeadae5){_0x1e4853=_0xeadae5;_0x14062b[_0x4c77('0x46')]=_[_0x4c77('0x48')](db[_0x4c77('0x79')]['rawAttributes']);_0x14062b[_0x4c77('0x47')]=_['keys'](_0x4ad2df[_0x4c77('0x47')]);_0x14062b[_0x4c77('0x49')]=_[_0x4c77('0x4b')](_0x14062b[_0x4c77('0x46')],_0x14062b[_0x4c77('0x47')]);_0x40841f[_0x4c77('0x4a')]=_[_0x4c77('0x4b')](_0x14062b[_0x4c77('0x46')],qs[_0x4c77('0x4c')](_0x4ad2df['query'][_0x4c77('0x4c')]));_0x40841f[_0x4c77('0x4a')]=_0x40841f[_0x4c77('0x4a')][_0x4c77('0x4d')]?_0x40841f[_0x4c77('0x4a')]:_0x14062b[_0x4c77('0x46')];_0x40841f['order']=qs['sort'](_0x4ad2df['query'][_0x4c77('0x51')]);_0x40841f[_0x4c77('0x52')]=qs[_0x4c77('0x49')](_['pick'](_0x4ad2df[_0x4c77('0x47')],_0x14062b[_0x4c77('0x49')]));if(_0x4ad2df[_0x4c77('0x47')][_0x4c77('0x54')]){_0x40841f[_0x4c77('0x52')]=_['merge'](_0x40841f[_0x4c77('0x52')],{'$or':_[_0x4c77('0x42')](_0x40841f[_0x4c77('0x4a')],function(_0x4b05d4){var _0x2704d6={};_0x2704d6[_0x4b05d4]={'$like':'%'+_0x4ad2df['query'][_0x4c77('0x54')]+'%'};return _0x2704d6;})});}_0x40841f=_[_0x4c77('0x55')]({},_0x40841f,_0x4ad2df[_0x4c77('0x57')]);return _0x1e4853[_0x4c77('0xc1')](_0x40841f);}})[_0x4c77('0x25')](function(_0x1a3854){if(_0x1a3854){_0x26c156=_0x1a3854['length'];if(!_0x4ad2df[_0x4c77('0x47')][_0x4c77('0x4e')](_0x4c77('0x4f'))){_0x40841f['limit']=qs[_0x4c77('0x50')](_0x4ad2df['query'][_0x4c77('0x50')]);_0x40841f[_0x4c77('0x33')]=qs['offset'](_0x4ad2df['query'][_0x4c77('0x33')]);}return _0x1e4853[_0x4c77('0xc1')](_0x40841f);}})['then'](function(_0x17e294){if(_0x17e294){return _0x17e294?{'count':_0x26c156,'rows':_0x17e294}:null;}})[_0x4c77('0x25')](respondWithResult(_0x126cee,null))[_0x4c77('0x5b')](handleError(_0x126cee,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 64f3fcb..419b78d 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 _0x6297=['hook','exports','events','../../mysqldb','FaxAccount','save','emit'];(function(_0x590c57,_0x573691){var _0x5e6b89=function(_0x25189a){while(--_0x25189a){_0x590c57['push'](_0x590c57['shift']());}};_0x5e6b89(++_0x573691);}(_0x6297,0x10c));var _0x7629=function(_0x56dc2b,_0x202854){_0x56dc2b=_0x56dc2b-0x0;var _0x2eb8f5=_0x6297[_0x56dc2b];return _0x2eb8f5;};'use strict';var EventEmitter=require(_0x7629('0x0'));var FaxAccount=require(_0x7629('0x1'))['db'][_0x7629('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x7629('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x542d7e){return function(_0x47dea2,_0x4f6346,_0xcb6b9f){FaxAccountEvents[_0x7629('0x4')](_0x542d7e+':'+_0x47dea2['id'],_0x47dea2);FaxAccountEvents[_0x7629('0x4')](_0x542d7e,_0x47dea2);_0xcb6b9f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxAccount[_0x7629('0x5')](e,emitEvent(event));}}module[_0x7629('0x6')]=FaxAccountEvents; \ No newline at end of file +var _0xfec8=['hook','events','../../mysqldb','FaxAccount','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0x207140,_0x4c6556){var _0x39e8cf=function(_0x16b730){while(--_0x16b730){_0x207140['push'](_0x207140['shift']());}};_0x39e8cf(++_0x4c6556);}(_0xfec8,0xc7));var _0x8fec=function(_0x2bc3f4,_0x470b26){_0x2bc3f4=_0x2bc3f4-0x0;var _0x14ac53=_0xfec8[_0x2bc3f4];return _0x14ac53;};'use strict';var EventEmitter=require(_0x8fec('0x0'));var FaxAccount=require(_0x8fec('0x1'))['db'][_0x8fec('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x8fec('0x3')](0x0);var events={'afterCreate':_0x8fec('0x4'),'afterUpdate':_0x8fec('0x5'),'afterDestroy':'remove'};function emitEvent(_0x5e6f84){return function(_0x71e71c,_0x2d43b0,_0x5749db){FaxAccountEvents[_0x8fec('0x6')](_0x5e6f84+':'+_0x71e71c['id'],_0x71e71c);FaxAccountEvents[_0x8fec('0x6')](_0x5e6f84,_0x71e71c);_0x5749db(null);};}for(var e in events){if(events[_0x8fec('0x7')](e)){var event=events[e];FaxAccount[_0x8fec('0x8')](e,emitEvent(event));}}module['exports']=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index 88951d0..a1dc792 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 _0x7057=['FaxAccount','fax_accounts','lodash','../../config/logger','api','bluebird','rimraf','../../config/environment','./faxAccount.attributes','exports'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x7057,0x174));var _0x7705=function(_0x3a94e1,_0x22e4fd){_0x3a94e1=_0x3a94e1-0x0;var _0x6a09d5=_0x7057[_0x3a94e1];return _0x6a09d5;};'use strict';var _=require(_0x7705('0x0'));var util=require('util');var logger=require(_0x7705('0x1'))(_0x7705('0x2'));var moment=require('moment');var BPromise=require(_0x7705('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x7705('0x4'));var config=require(_0x7705('0x5'));var attributes=require(_0x7705('0x6'));module[_0x7705('0x7')]=function(_0x3af414,_0x5eb094){return _0x3af414['define'](_0x7705('0x8'),attributes,{'tableName':_0x7705('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfb36=['fax_accounts','util','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define'];(function(_0x2e3d36,_0x22cc36){var _0xf8c27d=function(_0x431cb3){while(--_0x431cb3){_0x2e3d36['push'](_0x2e3d36['shift']());}};_0xf8c27d(++_0x22cc36);}(_0xfb36,0x17b));var _0x6fb3=function(_0x24b50e,_0x40a8ab){_0x24b50e=_0x24b50e-0x0;var _0x5dc6a8=_0xfb36[_0x24b50e];return _0x5dc6a8;};'use strict';var _=require('lodash');var util=require(_0x6fb3('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x6fb3('0x1'));var BPromise=require(_0x6fb3('0x2'));var rp=require(_0x6fb3('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6fb3('0x4'));var config=require(_0x6fb3('0x5'));var attributes=require('./faxAccount.attributes');module[_0x6fb3('0x6')]=function(_0x2f42d1,_0x5ca04c){return _0x2f42d1[_0x6fb3('0x7')]('FaxAccount',attributes,{'tableName':_0x6fb3('0x8'),'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 a24b8ab..27ab614 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 _0xe0c3=['AttachmentId','UserId','User','name','unshift','agent','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./faxAccount.socket','register','request','then','info','request\x20sent','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxAccount,\x20%s,\x20%s','message','result','catch','GetFaxAccount','FaxAccount','options','raw','where','attributes','include','model','map','fax','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','keys','createdAt','updatedAt','CompanyId','ListId','body','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','DESC','get','account','applications','list','orderBy','priority','asc','Applications','length','from','create','contact','FaxInteraction','find','Contact\x20not\x20found','spread','push','close','created','interaction','FaxMessage','ContactId'];(function(_0x179b7f,_0x3e7295){var _0xaf81e8=function(_0x22e7c7){while(--_0x22e7c7){_0x179b7f['push'](_0x179b7f['shift']());}};_0xaf81e8(++_0x3e7295);}(_0xe0c3,0x17e));var _0x3e0c=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe0c3[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x3e0c('0x0'));var util=require(_0x3e0c('0x1'));var moment=require('moment');var BPromise=require(_0x3e0c('0x2'));var rs=require(_0x3e0c('0x3'));var fs=require('fs');var Redis=require(_0x3e0c('0x4'));var db=require(_0x3e0c('0x5'))['db'];var utils=require(_0x3e0c('0x6'));var logger=require(_0x3e0c('0x7'))('rpc');var config=require(_0x3e0c('0x8'));var jayson=require(_0x3e0c('0x9'));var client=jayson[_0x3e0c('0xa')][_0x3e0c('0xb')]({'port':0x232c});config[_0x3e0c('0xc')]=_[_0x3e0c('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x3e0c('0xe'))(new Redis(config[_0x3e0c('0xc')]));require(_0x3e0c('0xf'))[_0x3e0c('0x10')](socket);function respondWithRpcPromise(_0xfdee17,_0xbcc62,_0x521ca8){return new BPromise(function(_0x5d61c7,_0x415c04){return client[_0x3e0c('0x11')](_0xfdee17,_0x521ca8)[_0x3e0c('0x12')](function(_0x263a36){logger[_0x3e0c('0x13')]('FaxAccount,\x20%s,\x20%s',_0xbcc62,_0x3e0c('0x14'));logger['debug'](_0x3e0c('0x15'),_0xbcc62,'request\x20sent',JSON[_0x3e0c('0x16')](_0x263a36));if(_0x263a36['error']){if(_0x263a36[_0x3e0c('0x17')][_0x3e0c('0x18')]===0x1f4){logger[_0x3e0c('0x17')](_0x3e0c('0x19'),_0xbcc62,_0x263a36['error'][_0x3e0c('0x1a')]);return _0x415c04(_0x263a36[_0x3e0c('0x17')]['message']);}logger[_0x3e0c('0x17')](_0x3e0c('0x19'),_0xbcc62,_0x263a36[_0x3e0c('0x17')][_0x3e0c('0x1a')]);return _0x5d61c7(_0x263a36[_0x3e0c('0x17')][_0x3e0c('0x1a')]);}else{logger[_0x3e0c('0x13')](_0x3e0c('0x19'),_0xbcc62,_0x3e0c('0x14'));_0x5d61c7(_0x263a36[_0x3e0c('0x1b')][_0x3e0c('0x1a')]);}})[_0x3e0c('0x1c')](function(_0x593411){logger[_0x3e0c('0x17')](_0x3e0c('0x19'),_0xbcc62,_0x593411);_0x415c04(_0x593411);});});}exports[_0x3e0c('0x1d')]=function(_0x43d495){var _0x526cf3=this;return new Promise(function(_0x18bd56,_0x40768f){return db[_0x3e0c('0x1e')]['findAll']({'raw':_0x43d495[_0x3e0c('0x1f')]?_0x43d495[_0x3e0c('0x1f')][_0x3e0c('0x20')]===undefined?!![]:![]:!![],'where':_0x43d495[_0x3e0c('0x1f')]?_0x43d495[_0x3e0c('0x1f')][_0x3e0c('0x21')]||null:null,'attributes':_0x43d495[_0x3e0c('0x1f')]?_0x43d495[_0x3e0c('0x1f')][_0x3e0c('0x22')]||null:null,'limit':_0x43d495[_0x3e0c('0x1f')]?_0x43d495[_0x3e0c('0x1f')]['limit']||null:null,'include':_0x43d495[_0x3e0c('0x1f')]?_0x43d495[_0x3e0c('0x1f')]['include']?_['map'](_0x43d495[_0x3e0c('0x1f')][_0x3e0c('0x23')],function(_0xe69fc9){return{'model':db[_0xe69fc9[_0x3e0c('0x24')]],'as':_0xe69fc9['as'],'attributes':_0xe69fc9['attributes'],'include':_0xe69fc9[_0x3e0c('0x23')]?_[_0x3e0c('0x25')](_0xe69fc9[_0x3e0c('0x23')],function(_0xeef129){return{'model':db[_0xeef129[_0x3e0c('0x24')]],'as':_0xeef129['as'],'attributes':_0xeef129[_0x3e0c('0x22')],'include':_0xeef129[_0x3e0c('0x23')]?_['map'](_0xeef129[_0x3e0c('0x23')],function(_0xf423e0){return{'model':db[_0xf423e0['model']],'as':_0xf423e0['as'],'attributes':_0xf423e0['attributes']};}):[]};}):[]};}):[]:[]})[_0x3e0c('0x12')](function(_0x181b4c){logger[_0x3e0c('0x13')]('GetFaxAccount',_0x43d495);logger['debug'](_0x3e0c('0x1d'),_0x43d495,JSON[_0x3e0c('0x16')](_0x181b4c));_0x18bd56(_0x181b4c);})[_0x3e0c('0x1c')](function(_0x2ae906){logger['error'](_0x3e0c('0x1d'),_0x2ae906[_0x3e0c('0x1a')],_0x43d495);_0x40768f(_0x526cf3[_0x3e0c('0x17')](0x1f4,_0x2ae906[_0x3e0c('0x1a')]));});});};exports['NotifyFaxAccount']=function(_0x4cb0c4,_0x9da297,_0x1b7170){var _0x386da2=this;return new Promise(function(_0x523256,_0xd98d60){var _0x3eb484={'body':_0x4cb0c4['body'],'channel':_0x3e0c('0x26')};var _0xf8f101=[];var _0x162c11=[];var _0x59a60a={};return db[_0x3e0c('0x27')]['describe']()[_0x3e0c('0x12')](function(_0x3f7ad3){if(!_0x3f7ad3){throw new db[(_0x3e0c('0x28'))][(_0x3e0c('0x29'))](_0x3e0c('0x2a'));}_0xf8f101=_[_0x3e0c('0x2b')](_[_0x3e0c('0x2c')](_0x3f7ad3),[_0x3e0c('0x2d'),_0x3e0c('0x2e')]);_0x162c11=_['difference'](_[_0x3e0c('0x2c')](_0x3f7ad3),[_0x3e0c('0x2d'),_0x3e0c('0x2e'),_0x3e0c('0x2f'),_0x3e0c('0x30')]);if(_0x4cb0c4[_0x3e0c('0x31')]['id']){delete _0x4cb0c4['body']['id'];}if(_['isNil'](_0x4cb0c4['body']['from'])){throw new db[(_0x3e0c('0x28'))][(_0x3e0c('0x29'))](_0x3e0c('0x32'));}if(_[_0x3e0c('0x33')](_0x4cb0c4[_0x3e0c('0x31')][_0x3e0c('0x31')])||_0x4cb0c4[_0x3e0c('0x31')]['body']===''){throw new db[(_0x3e0c('0x28'))][(_0x3e0c('0x29'))](_0x3e0c('0x34'));}if(_[_0x3e0c('0x33')](_0x4cb0c4[_0x3e0c('0x31')][_0x3e0c('0x35')])){throw new db[(_0x3e0c('0x28'))][(_0x3e0c('0x29'))](_0x3e0c('0x36')+_0x162c11);}if(!_[_0x3e0c('0x37')](_0x162c11,_0x4cb0c4[_0x3e0c('0x31')][_0x3e0c('0x35')])){throw new db['Sequelize'][(_0x3e0c('0x29'))](_0x3e0c('0x38')+_0x162c11);}_0x59a60a[_0x4cb0c4[_0x3e0c('0x31')][_0x3e0c('0x35')]]=_0x4cb0c4[_0x3e0c('0x31')]['from'];})[_0x3e0c('0x12')](function(){return db['FaxAccount']['find']({'where':{'id':_0x4cb0c4['account']['id']},'include':[{'model':db[_0x3e0c('0x39')],'as':_0x3e0c('0x3a'),'include':[{'model':db[_0x3e0c('0x27')],'as':_0x3e0c('0x3b'),'where':_0x59a60a,'limit':0x1,'order':[[_0x3e0c('0x2e'),_0x3e0c('0x3c')]]}]},{'model':db['FaxApplication'],'as':'Applications'}]});})[_0x3e0c('0x12')](function(_0x5393e0){if(_0x5393e0&&_0x5393e0['List']){var _0x2f844c=_0x5393e0[_0x3e0c('0x3d')]({'plain':!![]});_0x3eb484[_0x3e0c('0x3e')]=_0x2f844c;_0x3eb484[_0x3e0c('0x3f')]=_0x2f844c['Applications'];_0x3eb484[_0x3e0c('0x40')]=_0x2f844c[_0x3e0c('0x3a')];_0x3eb484[_0x3e0c('0x3f')]=_[_0x3e0c('0x41')](_0x3eb484[_0x3e0c('0x3f')],[_0x3e0c('0x42')],[_0x3e0c('0x43')]);if(_0x3eb484[_0x3e0c('0x3e')][_0x3e0c('0x44')]){delete _0x3eb484[_0x3e0c('0x3e')][_0x3e0c('0x44')];}if(_0x3eb484['account'][_0x3e0c('0x3a')]&&_0x3eb484[_0x3e0c('0x3e')]['List'][_0x3e0c('0x3b')][_0x3e0c('0x45')]){return _0x3eb484[_0x3e0c('0x3e')][_0x3e0c('0x3a')][_0x3e0c('0x3b')][0x0];}var _0x5a07cd=_[_0x3e0c('0xd')](_0x4cb0c4['body'],{'firstName':_0x4cb0c4[_0x3e0c('0x31')][_0x3e0c('0x46')],'ListId':_0x2f844c['ListId']});_0x5a07cd[_0x4cb0c4[_0x3e0c('0x31')][_0x3e0c('0x35')]]=_0x4cb0c4['body'][_0x3e0c('0x46')];return db[_0x3e0c('0x27')][_0x3e0c('0x47')](_0x5a07cd,{'fields':_0xf8f101,'raw':!![]});}})[_0x3e0c('0x12')](function(_0x4c884a){_0x3eb484[_0x3e0c('0x48')]=_0x4c884a;if(_0x4c884a){var _0x478d26={'ContactId':_0x4c884a['id'],'FaxAccountId':_0x4cb0c4[_0x3e0c('0x3e')]['id'],'fax':_0x4c884a[_0x3e0c('0x26')]};return db[_0x3e0c('0x49')][_0x3e0c('0x4a')]({'where':{'ContactId':_0x4c884a['id'],'closed':![],'FaxAccountId':_0x4cb0c4['account']['id']}})[_0x3e0c('0x12')](function(_0x10a86f){if(_0x10a86f){return[_0x10a86f,![]];}return db[_0x3e0c('0x49')][_0x3e0c('0x47')](_0x478d26)[_0x3e0c('0x12')](function(_0xa55b18){return[_0xa55b18,!![]];});});}else{throw new Error(_0x3e0c('0x4b'));}})[_0x3e0c('0x4c')](function(_0x17b942,_0x30e383){var _0x32ea4f=_0x17b942[_0x3e0c('0x3d')]({'plain':!![]});if(_0x30e383){if(_0x3eb484[_0x3e0c('0x3e')]['autoclose']){_0x3eb484[_0x3e0c('0x3f')][_0x3e0c('0x4d')]({'id':0x0,'priority':_0x3eb484[_0x3e0c('0x3f')][_0x3e0c('0x45')]+0x1,'app':_0x3e0c('0x4e'),'appdata':'unmanaged','interval':'*,*,*,*'});}_0x32ea4f['created']=!![];}else{_0x32ea4f[_0x3e0c('0x4f')]=![];}_0x3eb484[_0x3e0c('0x50')]=_0x32ea4f;return db[_0x3e0c('0x51')][_0x3e0c('0x47')]({'body':_0x4cb0c4[_0x3e0c('0x31')][_0x3e0c('0x31')],'FaxAccountId':_0x4cb0c4['account']['id'],'FaxInteractionId':_0x17b942['id'],'direction':'in','ContactId':_0x17b942[_0x3e0c('0x52')],'AttachmentId':_0x4cb0c4[_0x3e0c('0x31')][_0x3e0c('0x53')]});})[_0x3e0c('0x12')](function(_0x26069c){_0x3eb484[_0x3e0c('0x1a')]=_0x26069c;if(_0x3eb484[_0x3e0c('0x50')][_0x3e0c('0x54')]){return db[_0x3e0c('0x55')][_0x3e0c('0x4a')]({'attributes':['id',_0x3e0c('0x56')],'where':{'id':_0x3eb484['interaction'][_0x3e0c('0x54')]}})['then'](function(_0x20e271){if(_0x20e271){_0x3eb484[_0x3e0c('0x3f')][_0x3e0c('0x57')]({'id':0x0,'priority':0x0,'app':_0x3e0c('0x58'),'appdata':_0x20e271['name']+','+(_0x3eb484['account'][_0x3e0c('0x59')]||0xa),'interval':_0x3e0c('0x5a')});}return respondWithRpcPromise(_0x3e0c('0x5b'),_0x3e0c('0x5c'),_0x3eb484);});}return respondWithRpcPromise(_0x3e0c('0x5b'),_0x3e0c('0x5c'),_0x3eb484);})[_0x3e0c('0x12')](function(_0x44abca){_0x523256(_0x44abca);})['catch'](function(_0x30538b){_0xd98d60(_0x386da2[_0x3e0c('0x17')](0x1f4,_0x30538b['message']));});});}; \ No newline at end of file +var _0x1ba8=['*,*,*,*','created','interaction','FaxMessage','ContactId','AttachmentId','UserId','User','name','unshift','agent','waitForTheAssignedAgent','startRouting','Start','lodash','bluebird','ioredis','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','./faxAccount.socket','request','info','FaxAccount,\x20%s,\x20%s','request\x20sent','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','FaxAccount','findAll','options','raw','where','limit','include','map','model','attributes','then','GetFaxAccount','debug','body','fax','CmContact','describe','Sequelize','ValidationError','no\x20available\x20attributes','difference','keys','createdAt','updatedAt','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','find','account','List','Contacts','Applications','get','applications','priority','asc','defaults','create','contact','FaxInteraction','spread','autoclose','push','length','close'];(function(_0x47604d,_0x15a014){var _0x388e4c=function(_0x42a446){while(--_0x42a446){_0x47604d['push'](_0x47604d['shift']());}};_0x388e4c(++_0x15a014);}(_0x1ba8,0x10d));var _0x81ba=function(_0xe25b6a,_0x55c642){_0xe25b6a=_0xe25b6a-0x0;var _0x35e839=_0x1ba8[_0xe25b6a];return _0x35e839;};'use strict';var _=require(_0x81ba('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x81ba('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x81ba('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x81ba('0x3'));var config=require(_0x81ba('0x4'));var jayson=require('jayson/promise');var client=jayson[_0x81ba('0x5')][_0x81ba('0x6')]({'port':0x232c});config['redis']=_['defaults'](config[_0x81ba('0x7')],{'host':_0x81ba('0x8'),'port':0x18eb});var socket=require(_0x81ba('0x9'))(new Redis(config['redis']));require(_0x81ba('0xa'))['register'](socket);function respondWithRpcPromise(_0x377869,_0x2f773e,_0x2ff46c){return new BPromise(function(_0x210f1a,_0x482711){return client[_0x81ba('0xb')](_0x377869,_0x2ff46c)['then'](function(_0x4218f8){logger[_0x81ba('0xc')](_0x81ba('0xd'),_0x2f773e,_0x81ba('0xe'));logger['debug'](_0x81ba('0xf'),_0x2f773e,'request\x20sent',JSON[_0x81ba('0x10')](_0x4218f8));if(_0x4218f8[_0x81ba('0x11')]){if(_0x4218f8['error'][_0x81ba('0x12')]===0x1f4){logger['error'](_0x81ba('0xd'),_0x2f773e,_0x4218f8[_0x81ba('0x11')][_0x81ba('0x13')]);return _0x482711(_0x4218f8[_0x81ba('0x11')][_0x81ba('0x13')]);}logger[_0x81ba('0x11')]('FaxAccount,\x20%s,\x20%s',_0x2f773e,_0x4218f8[_0x81ba('0x11')][_0x81ba('0x13')]);return _0x210f1a(_0x4218f8[_0x81ba('0x11')][_0x81ba('0x13')]);}else{logger[_0x81ba('0xc')]('FaxAccount,\x20%s,\x20%s',_0x2f773e,_0x81ba('0xe'));_0x210f1a(_0x4218f8[_0x81ba('0x14')]['message']);}})[_0x81ba('0x15')](function(_0x573d2f){logger[_0x81ba('0x11')]('FaxAccount,\x20%s,\x20%s',_0x2f773e,_0x573d2f);_0x482711(_0x573d2f);});});}exports['GetFaxAccount']=function(_0x55010a){var _0x307973=this;return new Promise(function(_0x4ec89f,_0x4cb8df){return db[_0x81ba('0x16')][_0x81ba('0x17')]({'raw':_0x55010a[_0x81ba('0x18')]?_0x55010a['options'][_0x81ba('0x19')]===undefined?!![]:![]:!![],'where':_0x55010a['options']?_0x55010a[_0x81ba('0x18')][_0x81ba('0x1a')]||null:null,'attributes':_0x55010a[_0x81ba('0x18')]?_0x55010a[_0x81ba('0x18')]['attributes']||null:null,'limit':_0x55010a[_0x81ba('0x18')]?_0x55010a[_0x81ba('0x18')][_0x81ba('0x1b')]||null:null,'include':_0x55010a[_0x81ba('0x18')]?_0x55010a[_0x81ba('0x18')][_0x81ba('0x1c')]?_[_0x81ba('0x1d')](_0x55010a[_0x81ba('0x18')][_0x81ba('0x1c')],function(_0x40274f){return{'model':db[_0x40274f[_0x81ba('0x1e')]],'as':_0x40274f['as'],'attributes':_0x40274f[_0x81ba('0x1f')],'include':_0x40274f['include']?_[_0x81ba('0x1d')](_0x40274f[_0x81ba('0x1c')],function(_0x3ef0cc){return{'model':db[_0x3ef0cc['model']],'as':_0x3ef0cc['as'],'attributes':_0x3ef0cc['attributes'],'include':_0x3ef0cc[_0x81ba('0x1c')]?_[_0x81ba('0x1d')](_0x3ef0cc[_0x81ba('0x1c')],function(_0x3db89f){return{'model':db[_0x3db89f['model']],'as':_0x3db89f['as'],'attributes':_0x3db89f['attributes']};}):[]};}):[]};}):[]:[]})[_0x81ba('0x20')](function(_0xafafd7){logger['info'](_0x81ba('0x21'),_0x55010a);logger[_0x81ba('0x22')](_0x81ba('0x21'),_0x55010a,JSON[_0x81ba('0x10')](_0xafafd7));_0x4ec89f(_0xafafd7);})[_0x81ba('0x15')](function(_0x256578){logger[_0x81ba('0x11')](_0x81ba('0x21'),_0x256578['message'],_0x55010a);_0x4cb8df(_0x307973[_0x81ba('0x11')](0x1f4,_0x256578['message']));});});};exports['NotifyFaxAccount']=function(_0x73a801,_0x59fde1,_0xd05070){var _0x1b0e65=this;return new Promise(function(_0x20f2bd,_0x22fd34){var _0x268cbc={'body':_0x73a801[_0x81ba('0x23')],'channel':_0x81ba('0x24')};var _0x2257ac=[];var _0x35743e=[];var _0x3062b8={};return db[_0x81ba('0x25')][_0x81ba('0x26')]()['then'](function(_0x3a3ad4){if(!_0x3a3ad4){throw new db[(_0x81ba('0x27'))][(_0x81ba('0x28'))](_0x81ba('0x29'));}_0x2257ac=_[_0x81ba('0x2a')](_[_0x81ba('0x2b')](_0x3a3ad4),[_0x81ba('0x2c'),'updatedAt']);_0x35743e=_[_0x81ba('0x2a')](_[_0x81ba('0x2b')](_0x3a3ad4),[_0x81ba('0x2c'),_0x81ba('0x2d'),'CompanyId',_0x81ba('0x2e')]);if(_0x73a801[_0x81ba('0x23')]['id']){delete _0x73a801[_0x81ba('0x23')]['id'];}if(_[_0x81ba('0x2f')](_0x73a801['body'][_0x81ba('0x30')])){throw new db[(_0x81ba('0x27'))][(_0x81ba('0x28'))]('from\x20is\x20mandatory');}if(_[_0x81ba('0x2f')](_0x73a801['body'][_0x81ba('0x23')])||_0x73a801[_0x81ba('0x23')]['body']===''){throw new db[(_0x81ba('0x27'))][(_0x81ba('0x28'))](_0x81ba('0x31'));}if(_[_0x81ba('0x2f')](_0x73a801['body'][_0x81ba('0x32')])){throw new db[(_0x81ba('0x27'))]['ValidationError'](_0x81ba('0x33')+_0x35743e);}if(!_['includes'](_0x35743e,_0x73a801[_0x81ba('0x23')]['mapKey'])){throw new db[(_0x81ba('0x27'))]['ValidationError'](_0x81ba('0x34')+_0x35743e);}_0x3062b8[_0x73a801[_0x81ba('0x23')]['mapKey']]=_0x73a801[_0x81ba('0x23')][_0x81ba('0x30')];})[_0x81ba('0x20')](function(){return db[_0x81ba('0x16')][_0x81ba('0x35')]({'where':{'id':_0x73a801[_0x81ba('0x36')]['id']},'include':[{'model':db['CmList'],'as':_0x81ba('0x37'),'include':[{'model':db[_0x81ba('0x25')],'as':_0x81ba('0x38'),'where':_0x3062b8,'limit':0x1,'order':[[_0x81ba('0x2d'),'DESC']]}]},{'model':db['FaxApplication'],'as':_0x81ba('0x39')}]});})[_0x81ba('0x20')](function(_0x15199e){if(_0x15199e&&_0x15199e[_0x81ba('0x37')]){var _0x2bf7ff=_0x15199e[_0x81ba('0x3a')]({'plain':!![]});_0x268cbc[_0x81ba('0x36')]=_0x2bf7ff;_0x268cbc[_0x81ba('0x3b')]=_0x2bf7ff[_0x81ba('0x39')];_0x268cbc['list']=_0x2bf7ff[_0x81ba('0x37')];_0x268cbc['applications']=_['orderBy'](_0x268cbc[_0x81ba('0x3b')],[_0x81ba('0x3c')],[_0x81ba('0x3d')]);if(_0x268cbc[_0x81ba('0x36')][_0x81ba('0x39')]){delete _0x268cbc['account'][_0x81ba('0x39')];}if(_0x268cbc[_0x81ba('0x36')]['List']&&_0x268cbc[_0x81ba('0x36')][_0x81ba('0x37')][_0x81ba('0x38')]['length']){return _0x268cbc[_0x81ba('0x36')][_0x81ba('0x37')][_0x81ba('0x38')][0x0];}var _0x5e90ee=_[_0x81ba('0x3e')](_0x73a801[_0x81ba('0x23')],{'firstName':_0x73a801[_0x81ba('0x23')][_0x81ba('0x30')],'ListId':_0x2bf7ff[_0x81ba('0x2e')]});_0x5e90ee[_0x73a801['body'][_0x81ba('0x32')]]=_0x73a801[_0x81ba('0x23')]['from'];return db[_0x81ba('0x25')][_0x81ba('0x3f')](_0x5e90ee,{'fields':_0x2257ac,'raw':!![]});}})[_0x81ba('0x20')](function(_0x125c94){_0x268cbc[_0x81ba('0x40')]=_0x125c94;if(_0x125c94){var _0x517141={'ContactId':_0x125c94['id'],'FaxAccountId':_0x73a801[_0x81ba('0x36')]['id'],'fax':_0x125c94['fax']};return db[_0x81ba('0x41')][_0x81ba('0x35')]({'where':{'ContactId':_0x125c94['id'],'closed':![],'FaxAccountId':_0x73a801[_0x81ba('0x36')]['id']}})['then'](function(_0x37b79b){if(_0x37b79b){return[_0x37b79b,![]];}return db[_0x81ba('0x41')][_0x81ba('0x3f')](_0x517141)[_0x81ba('0x20')](function(_0x13bf8c){return[_0x13bf8c,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x81ba('0x42')](function(_0x21b9d5,_0x1732f2){var _0x16da42=_0x21b9d5[_0x81ba('0x3a')]({'plain':!![]});if(_0x1732f2){if(_0x268cbc[_0x81ba('0x36')][_0x81ba('0x43')]){_0x268cbc['applications'][_0x81ba('0x44')]({'id':0x0,'priority':_0x268cbc['applications'][_0x81ba('0x45')]+0x1,'app':_0x81ba('0x46'),'appdata':'unmanaged','interval':_0x81ba('0x47')});}_0x16da42[_0x81ba('0x48')]=!![];}else{_0x16da42[_0x81ba('0x48')]=![];}_0x268cbc[_0x81ba('0x49')]=_0x16da42;return db[_0x81ba('0x4a')]['create']({'body':_0x73a801[_0x81ba('0x23')][_0x81ba('0x23')],'FaxAccountId':_0x73a801[_0x81ba('0x36')]['id'],'FaxInteractionId':_0x21b9d5['id'],'direction':'in','ContactId':_0x21b9d5[_0x81ba('0x4b')],'AttachmentId':_0x73a801['body'][_0x81ba('0x4c')]});})[_0x81ba('0x20')](function(_0x156b68){_0x268cbc[_0x81ba('0x13')]=_0x156b68;if(_0x268cbc['interaction'][_0x81ba('0x4d')]){return db[_0x81ba('0x4e')][_0x81ba('0x35')]({'attributes':['id',_0x81ba('0x4f')],'where':{'id':_0x268cbc['interaction'][_0x81ba('0x4d')]}})['then'](function(_0x335159){if(_0x335159){_0x268cbc[_0x81ba('0x3b')][_0x81ba('0x50')]({'id':0x0,'priority':0x0,'app':_0x81ba('0x51'),'appdata':_0x335159[_0x81ba('0x4f')]+','+(_0x268cbc[_0x81ba('0x36')][_0x81ba('0x52')]||0xa),'interval':_0x81ba('0x47')});}return respondWithRpcPromise('Start',_0x81ba('0x53'),_0x268cbc);});}return respondWithRpcPromise(_0x81ba('0x54'),_0x81ba('0x53'),_0x268cbc);})[_0x81ba('0x20')](function(_0x2815ae){_0x20f2bd(_0x2815ae);})[_0x81ba('0x15')](function(_0x1f90bf){_0x22fd34(_0x1b0e65[_0x81ba('0x11')](0x1f4,_0x1f90bf['message']));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index dc7012f..54ab39b 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 _0x5430=['length','faxAccount:','./faxAccount.events','save','remove','update','register'];(function(_0x389b01,_0x11e987){var _0x1d7d63=function(_0x5493a6){while(--_0x5493a6){_0x389b01['push'](_0x389b01['shift']());}};_0x1d7d63(++_0x11e987);}(_0x5430,0x10c));var _0x0543=function(_0xc0965,_0x3b01aa){_0xc0965=_0xc0965-0x0;var _0x3b1cc3=_0x5430[_0xc0965];return _0x3b1cc3;};'use strict';var FaxAccountEvents=require(_0x0543('0x0'));var events=[_0x0543('0x1'),_0x0543('0x2'),_0x0543('0x3')];function createListener(_0x114bf2,_0x3b93d7){return function(_0x5518f8){_0x3b93d7['emit'](_0x114bf2,_0x5518f8);};}function removeListener(_0x1c5ab7,_0x4ee416){return function(){FaxAccountEvents['removeListener'](_0x1c5ab7,_0x4ee416);};}exports[_0x0543('0x4')]=function(_0x45b909){for(var _0x9754ba=0x0,_0x319568=events[_0x0543('0x5')];_0x9754ba<_0x319568;_0x9754ba++){var _0x5ac352=events[_0x9754ba];var _0x372974=createListener(_0x0543('0x6')+_0x5ac352,_0x45b909);FaxAccountEvents['on'](_0x5ac352,_0x372974);}}; \ No newline at end of file +var _0x32b6=['faxAccount:','./faxAccount.events','save','update','emit','removeListener','register','length'];(function(_0x35b8a5,_0x5af25e){var _0xfbc05f=function(_0x17906f){while(--_0x17906f){_0x35b8a5['push'](_0x35b8a5['shift']());}};_0xfbc05f(++_0x5af25e);}(_0x32b6,0x1d1));var _0x632b=function(_0x1ef3ba,_0x34c2ec){_0x1ef3ba=_0x1ef3ba-0x0;var _0xd9cb03=_0x32b6[_0x1ef3ba];return _0xd9cb03;};'use strict';var FaxAccountEvents=require(_0x632b('0x0'));var events=[_0x632b('0x1'),'remove',_0x632b('0x2')];function createListener(_0x1d100a,_0x51c210){return function(_0x5ad871){_0x51c210[_0x632b('0x3')](_0x1d100a,_0x5ad871);};}function removeListener(_0x3435e8,_0x3ba3a7){return function(){FaxAccountEvents[_0x632b('0x4')](_0x3435e8,_0x3ba3a7);};}exports[_0x632b('0x5')]=function(_0x122768){for(var _0x24ceab=0x0,_0x10458a=events[_0x632b('0x6')];_0x24ceab<_0x10458a;_0x24ceab++){var _0x43d6c7=events[_0x24ceab];var _0x5128f5=createListener(_0x632b('0x7')+_0x43d6c7,_0x122768);FaxAccountEvents['on'](_0x43d6c7,_0x5128f5);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 925b878..e2d83d9 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 _0xb3d5=['/:id','getDispositions','/:id/canned_answers','getAnswers','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','getAgents','post','create','/:id/dispositions','addDisposition','addInteraction','addAccountApplications','/updateaccountapplications','updateAccountApplications','/:id/send','send','/:id/users','delete','destroy','removeDispositions','removeAnswers','removeAgents','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','isAuthenticated','describe'];(function(_0x18a0c7,_0x4d3960){var _0x2d6bc4=function(_0x32c295){while(--_0x32c295){_0x18a0c7['push'](_0x18a0c7['shift']());}};_0x2d6bc4(++_0x4d3960);}(_0xb3d5,0xde));var _0x5b3d=function(_0x231086,_0x33d098){_0x231086=_0x231086-0x0;var _0x2ed449=_0xb3d5[_0x231086];return _0x2ed449;};'use strict';var multer=require(_0x5b3d('0x0'));var util=require(_0x5b3d('0x1'));var path=require('path');var timeout=require(_0x5b3d('0x2'));var express=require(_0x5b3d('0x3'));var router=express[_0x5b3d('0x4')]();var auth=require(_0x5b3d('0x5'));var interaction=require(_0x5b3d('0x6'));var config=require(_0x5b3d('0x7'));var controller=require(_0x5b3d('0x8'));router[_0x5b3d('0x9')]('/',auth[_0x5b3d('0xa')](),controller['index']);router[_0x5b3d('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x5b3d('0xb')]);router[_0x5b3d('0x9')](_0x5b3d('0xc'),auth[_0x5b3d('0xa')](),controller['show']);router[_0x5b3d('0x9')]('/:id/dispositions',auth[_0x5b3d('0xa')](),controller[_0x5b3d('0xd')]);router[_0x5b3d('0x9')](_0x5b3d('0xe'),auth['isAuthenticated'](),controller[_0x5b3d('0xf')]);router[_0x5b3d('0x9')](_0x5b3d('0x10'),auth['isAuthenticated'](),controller[_0x5b3d('0x11')]);router[_0x5b3d('0x9')](_0x5b3d('0x12'),auth[_0x5b3d('0xa')](),controller[_0x5b3d('0x13')]);router[_0x5b3d('0x9')](_0x5b3d('0x14'),auth[_0x5b3d('0xa')](),controller[_0x5b3d('0x15')]);router['get']('/:id/users',auth[_0x5b3d('0xa')](),controller[_0x5b3d('0x16')]);router[_0x5b3d('0x17')]('/',auth[_0x5b3d('0xa')](),controller[_0x5b3d('0x18')]);router[_0x5b3d('0x17')](_0x5b3d('0x19'),auth[_0x5b3d('0xa')](),controller[_0x5b3d('0x1a')]);router[_0x5b3d('0x17')](_0x5b3d('0xe'),auth['isAuthenticated'](),controller['addAnswer']);router[_0x5b3d('0x17')]('/:id/interactions',auth[_0x5b3d('0xa')](),controller[_0x5b3d('0x1b')]);router[_0x5b3d('0x17')](_0x5b3d('0x12'),auth[_0x5b3d('0xa')](),controller['addApplications']);router[_0x5b3d('0x17')]('/addaccountapplications',auth['isAuthenticated'](),controller[_0x5b3d('0x1c')]);router[_0x5b3d('0x17')](_0x5b3d('0x1d'),auth[_0x5b3d('0xa')](),controller[_0x5b3d('0x1e')]);router[_0x5b3d('0x17')](_0x5b3d('0x1f'),auth[_0x5b3d('0xa')](),controller[_0x5b3d('0x20')]);router[_0x5b3d('0x17')](_0x5b3d('0x21'),auth[_0x5b3d('0xa')](),controller['addAgents']);router['put']('/:id',auth[_0x5b3d('0xa')](),controller['update']);router[_0x5b3d('0x22')](_0x5b3d('0xc'),auth[_0x5b3d('0xa')](),controller[_0x5b3d('0x23')]);router['delete'](_0x5b3d('0x19'),auth[_0x5b3d('0xa')](),controller[_0x5b3d('0x24')]);router[_0x5b3d('0x22')]('/:id/canned_answers',auth[_0x5b3d('0xa')](),controller[_0x5b3d('0x25')]);router['delete'](_0x5b3d('0x21'),auth[_0x5b3d('0xa')](),controller[_0x5b3d('0x26')]);module['exports']=router; \ No newline at end of file +var _0x40a8=['send','/:id/users','addAgents','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','isAuthenticated','/describe','describe','getDispositions','/:id/canned_answers','getAnswers','/:id/interactions','/:id/applications','getAgents','post','addAnswer','addInteraction','addApplications','/addaccountapplications','addAccountApplications','/updateaccountapplications','updateAccountApplications','/:id/send'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x40a8,0xc2));var _0x840a=function(_0x11b58d,_0x555c55){_0x11b58d=_0x11b58d-0x0;var _0xc2811b=_0x40a8[_0x11b58d];return _0xc2811b;};'use strict';var multer=require(_0x840a('0x0'));var util=require(_0x840a('0x1'));var path=require(_0x840a('0x2'));var timeout=require(_0x840a('0x3'));var express=require(_0x840a('0x4'));var router=express['Router']();var auth=require(_0x840a('0x5'));var interaction=require(_0x840a('0x6'));var config=require(_0x840a('0x7'));var controller=require(_0x840a('0x8'));router[_0x840a('0x9')]('/',auth[_0x840a('0xa')](),controller['index']);router[_0x840a('0x9')](_0x840a('0xb'),auth[_0x840a('0xa')](),controller[_0x840a('0xc')]);router[_0x840a('0x9')]('/:id',auth[_0x840a('0xa')](),controller['show']);router[_0x840a('0x9')]('/:id/dispositions',auth[_0x840a('0xa')](),controller[_0x840a('0xd')]);router['get'](_0x840a('0xe'),auth['isAuthenticated'](),controller[_0x840a('0xf')]);router['get'](_0x840a('0x10'),auth['isAuthenticated'](),controller['getInteractions']);router[_0x840a('0x9')](_0x840a('0x11'),auth['isAuthenticated'](),controller['getApplications']);router['get']('/:id/messages',auth[_0x840a('0xa')](),controller['getMessages']);router[_0x840a('0x9')]('/:id/users',auth[_0x840a('0xa')](),controller[_0x840a('0x12')]);router[_0x840a('0x13')]('/',auth[_0x840a('0xa')](),controller['create']);router[_0x840a('0x13')]('/:id/dispositions',auth['isAuthenticated'](),controller['addDisposition']);router[_0x840a('0x13')](_0x840a('0xe'),auth[_0x840a('0xa')](),controller[_0x840a('0x14')]);router['post'](_0x840a('0x10'),auth[_0x840a('0xa')](),controller[_0x840a('0x15')]);router[_0x840a('0x13')]('/:id/applications',auth[_0x840a('0xa')](),controller[_0x840a('0x16')]);router[_0x840a('0x13')](_0x840a('0x17'),auth[_0x840a('0xa')](),controller[_0x840a('0x18')]);router[_0x840a('0x13')](_0x840a('0x19'),auth[_0x840a('0xa')](),controller[_0x840a('0x1a')]);router[_0x840a('0x13')](_0x840a('0x1b'),auth['isAuthenticated'](),controller[_0x840a('0x1c')]);router[_0x840a('0x13')](_0x840a('0x1d'),auth['isAuthenticated'](),controller[_0x840a('0x1e')]);router['put']('/:id',auth[_0x840a('0xa')](),controller[_0x840a('0x1f')]);router[_0x840a('0x20')]('/:id',auth[_0x840a('0xa')](),controller[_0x840a('0x21')]);router[_0x840a('0x20')]('/:id/dispositions',auth[_0x840a('0xa')](),controller[_0x840a('0x22')]);router[_0x840a('0x20')](_0x840a('0xe'),auth[_0x840a('0xa')](),controller[_0x840a('0x23')]);router[_0x840a('0x20')](_0x840a('0x1d'),auth[_0x840a('0xa')](),controller[_0x840a('0x24')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index b1a7587..84620d1 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 _0x078a=['sequelize','exports','INTEGER','STRING','noop','TEXT','*,*,*,*'];(function(_0xd22d95,_0xc59f8f){var _0x15d7a3=function(_0x3db95c){while(--_0x3db95c){_0xd22d95['push'](_0xd22d95['shift']());}};_0x15d7a3(++_0xc59f8f);}(_0x078a,0x12d));var _0xa078=function(_0x39bddd,_0x290df3){_0x39bddd=_0x39bddd-0x0;var _0x587868=_0x078a[_0x39bddd];return _0x587868;};'use strict';var Sequelize=require(_0xa078('0x0'));module[_0xa078('0x1')]={'priority':{'type':Sequelize[_0xa078('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xa078('0x3')],'allowNull':![],'defaultValue':_0xa078('0x4')},'appdata':{'type':Sequelize[_0xa078('0x5')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xa078('0x3')],'defaultValue':_0xa078('0x6')}}; \ No newline at end of file +var _0x4325=['sequelize','exports','STRING','noop','TEXT','*,*,*,*'];(function(_0x359bbe,_0x5b7fcc){var _0x1b3353=function(_0x34b41c){while(--_0x34b41c){_0x359bbe['push'](_0x359bbe['shift']());}};_0x1b3353(++_0x5b7fcc);}(_0x4325,0x1da));var _0x5432=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x4325[_0x397e5f];return _0x5302b8;};'use strict';var Sequelize=require(_0x5432('0x0'));module[_0x5432('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x5432('0x2')],'allowNull':![],'defaultValue':_0x5432('0x3')},'appdata':{'type':Sequelize[_0x5432('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x5432('0x5')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index ea11c17..e58f260 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 _0xa630=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','save','update','then','name','send','index','FaxApplication','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','fields','attributes','nolimit','sort','where','pick','filter','merge','options','include','findAll','rows','catch','params','keys','length','find','create','body','html-pdf','eml-format','fast-json-patch','moment','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xa630,0xbe));var _0x0a63=function(_0x3f868e,_0x44641c){_0x3f868e=_0x3f868e-0x0;var _0x587d90=_0xa630[_0x3f868e];return _0x587d90;};'use strict';var pdf=require(_0x0a63('0x0'));var emlformat=require(_0x0a63('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x0a63('0x2'));var rp=require('request-promise');var moment=require(_0x0a63('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0a63('0x4'));var util=require(_0x0a63('0x5'));var path=require(_0x0a63('0x6'));var sox=require(_0x0a63('0x7'));var csv=require(_0x0a63('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x0a63('0x9'));var squel=require(_0x0a63('0xa'));var crypto=require(_0x0a63('0xb'));var jsforce=require(_0x0a63('0xc'));var deskjs=require(_0x0a63('0xd'));var toCsv=require(_0x0a63('0x8'));var querystring=require('querystring');var Papa=require(_0x0a63('0xe'));var Redis=require(_0x0a63('0xf'));var authService=require(_0x0a63('0x10'));var qs=require(_0x0a63('0x11'));var as=require(_0x0a63('0x12'));var hardwareService=require(_0x0a63('0x13'));var logger=require(_0x0a63('0x14'))(_0x0a63('0x15'));var utils=require(_0x0a63('0x16'));var config=require(_0x0a63('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x345f56,_0x420043){_0x420043=_0x420043||0xcc;return function(_0x2fce86){if(_0x2fce86){return _0x345f56[_0x0a63('0x18')](_0x420043);}return _0x345f56['status'](_0x420043)[_0x0a63('0x19')]();};}function respondWithResult(_0x4d68c0,_0x331e99){_0x331e99=_0x331e99||0xc8;return function(_0x19e922){if(_0x19e922){return _0x4d68c0[_0x0a63('0x1a')](_0x331e99)[_0x0a63('0x1b')](_0x19e922);}};}function respondWithFilteredResult(_0x3ea3bb,_0x23b49d){return function(_0x552b1f){if(_0x552b1f){var _0x1e3251=_0x552b1f[_0x0a63('0x1c')],_0x524a98=_0x23b49d[_0x0a63('0x1d')],_0x47788e=_0x23b49d[_0x0a63('0x1d')]+_0x23b49d[_0x0a63('0x1e')],_0x56b314;if(_0x47788e>=_0x1e3251){_0x47788e=_0x1e3251;_0x56b314=0xc8;}else{_0x56b314=0xce;}_0x3ea3bb[_0x0a63('0x1a')](_0x56b314);return _0x3ea3bb[_0x0a63('0x1f')](_0x0a63('0x20'),_0x524a98+'-'+_0x47788e+'/'+_0x1e3251)[_0x0a63('0x1b')](_0x552b1f);}return null;};}function patchUpdates(_0x2fd06c){return function(_0x3cc74d){try{jsonpatch[_0x0a63('0x21')](_0x3cc74d,_0x2fd06c,!![]);}catch(_0x4ea56f){return BPromise['reject'](_0x4ea56f);}return _0x3cc74d[_0x0a63('0x22')]();};}function saveUpdates(_0x586190,_0x2fc87c){return function(_0x5937df){if(_0x5937df){return _0x5937df[_0x0a63('0x23')](_0x586190)[_0x0a63('0x24')](function(_0x145625){return _0x145625;});}return null;};}function removeEntity(_0x46b968,_0x5da46b){return function(_0x398a16){if(_0x398a16){return _0x398a16['destroy']()[_0x0a63('0x24')](function(){_0x46b968[_0x0a63('0x1a')](0xcc)[_0x0a63('0x19')]();});}};}function handleEntityNotFound(_0x20c114,_0x343273){return function(_0x1f929f){if(!_0x1f929f){_0x20c114[_0x0a63('0x18')](0x194);}return _0x1f929f;};}function handleError(_0x53c6e3,_0x567017){_0x567017=_0x567017||0x1f4;return function(_0x5e5987){logger['error'](_0x5e5987['stack']);if(_0x5e5987[_0x0a63('0x25')]){delete _0x5e5987['name'];}_0x53c6e3['status'](_0x567017)[_0x0a63('0x26')](_0x5e5987);};}exports[_0x0a63('0x27')]=function(_0x362d6a,_0x2e2526){var _0x52e7ef={},_0x402692={},_0x498371={'count':0x0,'rows':[]};var _0x25ab82=_['map'](db[_0x0a63('0x28')][_0x0a63('0x29')],function(_0x1b7bdb){return{'name':_0x1b7bdb[_0x0a63('0x2a')],'type':_0x1b7bdb[_0x0a63('0x2b')][_0x0a63('0x2c')]};});_0x402692[_0x0a63('0x2d')]=_[_0x0a63('0x2e')](_0x25ab82,'name');_0x402692[_0x0a63('0x2f')]=_['keys'](_0x362d6a[_0x0a63('0x2f')]);_0x402692[_0x0a63('0x30')]=_[_0x0a63('0x31')](_0x402692[_0x0a63('0x2d')],_0x402692[_0x0a63('0x2f')]);_0x52e7ef['attributes']=_[_0x0a63('0x31')](_0x402692[_0x0a63('0x2d')],qs[_0x0a63('0x32')](_0x362d6a[_0x0a63('0x2f')]['fields']));_0x52e7ef[_0x0a63('0x33')]=_0x52e7ef[_0x0a63('0x33')]['length']?_0x52e7ef['attributes']:_0x402692[_0x0a63('0x2d')];if(!_0x362d6a['query']['hasOwnProperty'](_0x0a63('0x34'))){_0x52e7ef[_0x0a63('0x1e')]=qs['limit'](_0x362d6a[_0x0a63('0x2f')][_0x0a63('0x1e')]);_0x52e7ef[_0x0a63('0x1d')]=qs[_0x0a63('0x1d')](_0x362d6a[_0x0a63('0x2f')]['offset']);}_0x52e7ef['order']=qs[_0x0a63('0x35')](_0x362d6a[_0x0a63('0x2f')][_0x0a63('0x35')]);_0x52e7ef[_0x0a63('0x36')]=qs[_0x0a63('0x30')](_[_0x0a63('0x37')](_0x362d6a['query'],_0x402692[_0x0a63('0x30')]));if(_0x362d6a[_0x0a63('0x2f')]['filter']){_0x52e7ef[_0x0a63('0x36')]=_['merge'](_0x52e7ef['where'],{'$or':_[_0x0a63('0x2e')](_0x25ab82,function(_0x232388){if(_0x232388[_0x0a63('0x2b')]!=='VIRTUAL'){var _0x209447={};_0x209447[_0x232388[_0x0a63('0x25')]]={'$like':'%'+_0x362d6a[_0x0a63('0x2f')][_0x0a63('0x38')]+'%'};return _0x209447;}})});}_0x52e7ef=_[_0x0a63('0x39')]({},_0x52e7ef,_0x362d6a[_0x0a63('0x3a')]);var _0x604a45={'where':_0x52e7ef['where']};return db[_0x0a63('0x28')][_0x0a63('0x1c')](_0x604a45)[_0x0a63('0x24')](function(_0x53d034){_0x498371['count']=_0x53d034;if(_0x362d6a[_0x0a63('0x2f')]['includeAll']){_0x52e7ef[_0x0a63('0x3b')]=[{'all':!![]}];}return db[_0x0a63('0x28')][_0x0a63('0x3c')](_0x52e7ef);})['then'](function(_0x2af987){_0x498371[_0x0a63('0x3d')]=_0x2af987;return _0x498371;})[_0x0a63('0x24')](respondWithFilteredResult(_0x2e2526,_0x52e7ef))[_0x0a63('0x3e')](handleError(_0x2e2526,null));};exports['show']=function(_0x1e3b70,_0x236617){var _0x4234cd={'raw':!![],'where':{'id':_0x1e3b70[_0x0a63('0x3f')]['id']}},_0x2ccd99={};_0x2ccd99[_0x0a63('0x2d')]=_['keys'](db[_0x0a63('0x28')][_0x0a63('0x29')]);_0x2ccd99[_0x0a63('0x2f')]=_[_0x0a63('0x40')](_0x1e3b70[_0x0a63('0x2f')]);_0x2ccd99[_0x0a63('0x30')]=_[_0x0a63('0x31')](_0x2ccd99[_0x0a63('0x2d')],_0x2ccd99[_0x0a63('0x2f')]);_0x4234cd[_0x0a63('0x33')]=_[_0x0a63('0x31')](_0x2ccd99[_0x0a63('0x2d')],qs[_0x0a63('0x32')](_0x1e3b70[_0x0a63('0x2f')][_0x0a63('0x32')]));_0x4234cd[_0x0a63('0x33')]=_0x4234cd[_0x0a63('0x33')][_0x0a63('0x41')]?_0x4234cd['attributes']:_0x2ccd99[_0x0a63('0x2d')];if(_0x1e3b70['query']['includeAll']){_0x4234cd[_0x0a63('0x3b')]=[{'all':!![]}];}_0x4234cd=_[_0x0a63('0x39')]({},_0x4234cd,_0x1e3b70[_0x0a63('0x3a')]);return db[_0x0a63('0x28')][_0x0a63('0x42')](_0x4234cd)[_0x0a63('0x24')](handleEntityNotFound(_0x236617,null))[_0x0a63('0x24')](respondWithResult(_0x236617,null))[_0x0a63('0x3e')](handleError(_0x236617,null));};exports[_0x0a63('0x43')]=function(_0xf00c9a,_0x9e5009){return db[_0x0a63('0x28')][_0x0a63('0x43')](_0xf00c9a[_0x0a63('0x44')],{})[_0x0a63('0x24')](respondWithResult(_0x9e5009,0xc9))[_0x0a63('0x3e')](handleError(_0x9e5009,null));};exports[_0x0a63('0x23')]=function(_0x20b864,_0x366887){if(_0x20b864[_0x0a63('0x44')]['id']){delete _0x20b864['body']['id'];}return db[_0x0a63('0x28')][_0x0a63('0x42')]({'where':{'id':_0x20b864['params']['id']}})['then'](handleEntityNotFound(_0x366887,null))['then'](saveUpdates(_0x20b864['body'],null))[_0x0a63('0x24')](respondWithResult(_0x366887,null))[_0x0a63('0x3e')](handleError(_0x366887,null));};exports['destroy']=function(_0x1abf0b,_0x59c367){return db[_0x0a63('0x28')][_0x0a63('0x42')]({'where':{'id':_0x1abf0b['params']['id']}})['then'](handleEntityNotFound(_0x59c367,null))['then'](removeEntity(_0x59c367,null))[_0x0a63('0x3e')](handleError(_0x59c367,null));}; \ No newline at end of file +var _0x32c0=['crypto','desk.js','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','destroy','then','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','FaxApplication','includeAll','findAll','rows','catch','show','include','create','body','update','find','params','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x32c0,0x1f3));var _0x032c=function(_0x748356,_0x3ddd99){_0x748356=_0x748356-0x0;var _0x1ae2c2=_0x32c0[_0x748356];return _0x1ae2c2;};'use strict';var pdf=require(_0x032c('0x0'));var emlformat=require(_0x032c('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x032c('0x2'));var jsonpatch=require(_0x032c('0x3'));var rp=require('request-promise');var moment=require(_0x032c('0x4'));var BPromise=require(_0x032c('0x5'));var Mustache=require(_0x032c('0x6'));var util=require(_0x032c('0x7'));var path=require('path');var sox=require(_0x032c('0x8'));var csv=require(_0x032c('0x9'));var ejs=require(_0x032c('0xa'));var fs=require('fs');var _=require(_0x032c('0xb'));var squel=require('squel');var crypto=require(_0x032c('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x032c('0xd'));var toCsv=require(_0x032c('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x032c('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x032c('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x032c('0x10'));var logger=require(_0x032c('0x11'))(_0x032c('0x12'));var utils=require(_0x032c('0x13'));var config=require(_0x032c('0x14'));var db=require(_0x032c('0x15'))['db'];function respondWithStatusCode(_0x55083a,_0x25af77){_0x25af77=_0x25af77||0xcc;return function(_0xc88e78){if(_0xc88e78){return _0x55083a[_0x032c('0x16')](_0x25af77);}return _0x55083a[_0x032c('0x17')](_0x25af77)['end']();};}function respondWithResult(_0x377397,_0x2650d6){_0x2650d6=_0x2650d6||0xc8;return function(_0x1ec9d8){if(_0x1ec9d8){return _0x377397[_0x032c('0x17')](_0x2650d6)[_0x032c('0x18')](_0x1ec9d8);}};}function respondWithFilteredResult(_0x2248ac,_0x51266f){return function(_0xb678d5){if(_0xb678d5){var _0x15ddb8=_0xb678d5[_0x032c('0x19')],_0x3ebda8=_0x51266f['offset'],_0x3f6f4d=_0x51266f[_0x032c('0x1a')]+_0x51266f[_0x032c('0x1b')],_0x3ccbd5;if(_0x3f6f4d>=_0x15ddb8){_0x3f6f4d=_0x15ddb8;_0x3ccbd5=0xc8;}else{_0x3ccbd5=0xce;}_0x2248ac[_0x032c('0x17')](_0x3ccbd5);return _0x2248ac[_0x032c('0x1c')](_0x032c('0x1d'),_0x3ebda8+'-'+_0x3f6f4d+'/'+_0x15ddb8)[_0x032c('0x18')](_0xb678d5);}return null;};}function patchUpdates(_0xe222c0){return function(_0x319532){try{jsonpatch[_0x032c('0x1e')](_0x319532,_0xe222c0,!![]);}catch(_0x415419){return BPromise[_0x032c('0x1f')](_0x415419);}return _0x319532[_0x032c('0x20')]();};}function saveUpdates(_0x2b9189,_0x515409){return function(_0x8a8f30){if(_0x8a8f30){return _0x8a8f30['update'](_0x2b9189)['then'](function(_0x509afe){return _0x509afe;});}return null;};}function removeEntity(_0x5cef54,_0x2a24f7){return function(_0x4c0c4b){if(_0x4c0c4b){return _0x4c0c4b[_0x032c('0x21')]()[_0x032c('0x22')](function(){_0x5cef54[_0x032c('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x135612,_0x16d40f){return function(_0x28ae24){if(!_0x28ae24){_0x135612[_0x032c('0x16')](0x194);}return _0x28ae24;};}function handleError(_0x2bbaef,_0x54a46){_0x54a46=_0x54a46||0x1f4;return function(_0xead856){logger['error'](_0xead856[_0x032c('0x23')]);if(_0xead856[_0x032c('0x24')]){delete _0xead856[_0x032c('0x24')];}_0x2bbaef['status'](_0x54a46)[_0x032c('0x25')](_0xead856);};}exports[_0x032c('0x26')]=function(_0x15c368,_0x12e3df){var _0x58de77={},_0x37a292={},_0x7150c8={'count':0x0,'rows':[]};var _0x1a38e1=_[_0x032c('0x27')](db['FaxApplication'][_0x032c('0x28')],function(_0x1de595){return{'name':_0x1de595[_0x032c('0x29')],'type':_0x1de595[_0x032c('0x2a')][_0x032c('0x2b')]};});_0x37a292[_0x032c('0x2c')]=_[_0x032c('0x27')](_0x1a38e1,'name');_0x37a292['query']=_[_0x032c('0x2d')](_0x15c368['query']);_0x37a292[_0x032c('0x2e')]=_[_0x032c('0x2f')](_0x37a292['model'],_0x37a292[_0x032c('0x30')]);_0x58de77[_0x032c('0x31')]=_[_0x032c('0x2f')](_0x37a292[_0x032c('0x2c')],qs['fields'](_0x15c368[_0x032c('0x30')][_0x032c('0x32')]));_0x58de77['attributes']=_0x58de77[_0x032c('0x31')][_0x032c('0x33')]?_0x58de77[_0x032c('0x31')]:_0x37a292[_0x032c('0x2c')];if(!_0x15c368[_0x032c('0x30')]['hasOwnProperty'](_0x032c('0x34'))){_0x58de77['limit']=qs[_0x032c('0x1b')](_0x15c368['query'][_0x032c('0x1b')]);_0x58de77[_0x032c('0x1a')]=qs[_0x032c('0x1a')](_0x15c368[_0x032c('0x30')][_0x032c('0x1a')]);}_0x58de77[_0x032c('0x35')]=qs['sort'](_0x15c368[_0x032c('0x30')][_0x032c('0x36')]);_0x58de77['where']=qs[_0x032c('0x2e')](_[_0x032c('0x37')](_0x15c368[_0x032c('0x30')],_0x37a292['filters']));if(_0x15c368[_0x032c('0x30')][_0x032c('0x38')]){_0x58de77[_0x032c('0x39')]=_[_0x032c('0x3a')](_0x58de77[_0x032c('0x39')],{'$or':_[_0x032c('0x27')](_0x1a38e1,function(_0x1fdf80){if(_0x1fdf80['type']!==_0x032c('0x3b')){var _0x15fafc={};_0x15fafc[_0x1fdf80[_0x032c('0x24')]]={'$like':'%'+_0x15c368[_0x032c('0x30')][_0x032c('0x38')]+'%'};return _0x15fafc;}})});}_0x58de77=_[_0x032c('0x3a')]({},_0x58de77,_0x15c368[_0x032c('0x3c')]);var _0x180e58={'where':_0x58de77['where']};return db[_0x032c('0x3d')]['count'](_0x180e58)[_0x032c('0x22')](function(_0x4e9d6a){_0x7150c8['count']=_0x4e9d6a;if(_0x15c368[_0x032c('0x30')][_0x032c('0x3e')]){_0x58de77['include']=[{'all':!![]}];}return db['FaxApplication'][_0x032c('0x3f')](_0x58de77);})['then'](function(_0x5d4676){_0x7150c8[_0x032c('0x40')]=_0x5d4676;return _0x7150c8;})[_0x032c('0x22')](respondWithFilteredResult(_0x12e3df,_0x58de77))[_0x032c('0x41')](handleError(_0x12e3df,null));};exports[_0x032c('0x42')]=function(_0x188160,_0x1cf509){var _0x49b83a={'raw':!![],'where':{'id':_0x188160['params']['id']}},_0x1819a7={};_0x1819a7['model']=_[_0x032c('0x2d')](db[_0x032c('0x3d')][_0x032c('0x28')]);_0x1819a7[_0x032c('0x30')]=_[_0x032c('0x2d')](_0x188160['query']);_0x1819a7['filters']=_[_0x032c('0x2f')](_0x1819a7['model'],_0x1819a7[_0x032c('0x30')]);_0x49b83a[_0x032c('0x31')]=_[_0x032c('0x2f')](_0x1819a7[_0x032c('0x2c')],qs[_0x032c('0x32')](_0x188160[_0x032c('0x30')][_0x032c('0x32')]));_0x49b83a[_0x032c('0x31')]=_0x49b83a[_0x032c('0x31')]['length']?_0x49b83a[_0x032c('0x31')]:_0x1819a7['model'];if(_0x188160['query'][_0x032c('0x3e')]){_0x49b83a[_0x032c('0x43')]=[{'all':!![]}];}_0x49b83a=_[_0x032c('0x3a')]({},_0x49b83a,_0x188160[_0x032c('0x3c')]);return db[_0x032c('0x3d')]['find'](_0x49b83a)['then'](handleEntityNotFound(_0x1cf509,null))['then'](respondWithResult(_0x1cf509,null))[_0x032c('0x41')](handleError(_0x1cf509,null));};exports['create']=function(_0x52fa05,_0x22d31c){return db['FaxApplication'][_0x032c('0x44')](_0x52fa05[_0x032c('0x45')],{})[_0x032c('0x22')](respondWithResult(_0x22d31c,0xc9))[_0x032c('0x41')](handleError(_0x22d31c,null));};exports[_0x032c('0x46')]=function(_0x26e988,_0xb4e45){if(_0x26e988[_0x032c('0x45')]['id']){delete _0x26e988[_0x032c('0x45')]['id'];}return db['FaxApplication'][_0x032c('0x47')]({'where':{'id':_0x26e988['params']['id']}})[_0x032c('0x22')](handleEntityNotFound(_0xb4e45,null))[_0x032c('0x22')](saveUpdates(_0x26e988[_0x032c('0x45')],null))[_0x032c('0x22')](respondWithResult(_0xb4e45,null))[_0x032c('0x41')](handleError(_0xb4e45,null));};exports[_0x032c('0x21')]=function(_0x1eed24,_0x110a5f){return db[_0x032c('0x3d')]['find']({'where':{'id':_0x1eed24[_0x032c('0x48')]['id']}})['then'](handleEntityNotFound(_0x110a5f,null))[_0x032c('0x22')](removeEntity(_0x110a5f,null))[_0x032c('0x41')](handleError(_0x110a5f,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index ee4751b..a7ebfd9 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 _0xd04f=['utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./faxApplication.attributes','exports','define','fax_applications','utf8mb4'];(function(_0x376d3f,_0x365cd6){var _0x48ce24=function(_0xac5587){while(--_0xac5587){_0x376d3f['push'](_0x376d3f['shift']());}};_0x48ce24(++_0x365cd6);}(_0xd04f,0xd3));var _0xfd04=function(_0x36e525,_0x45d1fa){_0x36e525=_0x36e525-0x0;var _0x472084=_0xd04f[_0x36e525];return _0x472084;};'use strict';var _=require(_0xfd04('0x0'));var util=require('util');var logger=require(_0xfd04('0x1'))(_0xfd04('0x2'));var moment=require(_0xfd04('0x3'));var BPromise=require(_0xfd04('0x4'));var rp=require(_0xfd04('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfd04('0x6'));var config=require(_0xfd04('0x7'));var attributes=require(_0xfd04('0x8'));module[_0xfd04('0x9')]=function(_0x2ffc5c,_0x3bb67d){return _0x2ffc5c[_0xfd04('0xa')]('FaxApplication',attributes,{'tableName':_0xfd04('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xfd04('0xc'),'collate':_0xfd04('0xd')});}; \ No newline at end of file +var _0x1259=['moment','request-promise','path','rimraf','exports','define','FaxApplication','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api'];(function(_0x5d6600,_0x9a9e9b){var _0x3c85cc=function(_0x4bb7fa){while(--_0x4bb7fa){_0x5d6600['push'](_0x5d6600['shift']());}};_0x3c85cc(++_0x9a9e9b);}(_0x1259,0x15b));var _0x9125=function(_0x5031dc,_0x1129f9){_0x5031dc=_0x5031dc-0x0;var _0x4b24ae=_0x1259[_0x5031dc];return _0x4b24ae;};'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('bluebird');var rp=require(_0x9125('0x5'));var fs=require('fs');var path=require(_0x9125('0x6'));var rimraf=require(_0x9125('0x7'));var config=require('../../config/environment');var attributes=require('./faxApplication.attributes');module[_0x9125('0x8')]=function(_0x2e953f,_0x4a113f){return _0x2e953f[_0x9125('0x9')](_0x9125('0xa'),attributes,{'tableName':'fax_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x9125('0xb'),'collate':_0x9125('0xc')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index c158a59..ca8b5fb 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 _0xae24=['../../config/environment','jayson/promise','client','http','request','then','info','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','UpdateFaxApplication','FaxApplication','body','options','where','attributes','limit','stringify','util','moment','bluebird','../../mysqldb','../../config/utils','rpc'];(function(_0x427568,_0x32e4a0){var _0x14f3ae=function(_0xad4afd){while(--_0xad4afd){_0x427568['push'](_0x427568['shift']());}};_0x14f3ae(++_0x32e4a0);}(_0xae24,0x72));var _0x4ae2=function(_0x407cfc,_0xdecdfd){_0x407cfc=_0x407cfc-0x0;var _0x1707ac=_0xae24[_0x407cfc];return _0x1707ac;};'use strict';var _=require('lodash');var util=require(_0x4ae2('0x0'));var moment=require(_0x4ae2('0x1'));var BPromise=require(_0x4ae2('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4ae2('0x3'))['db'];var utils=require(_0x4ae2('0x4'));var logger=require('../../config/logger')(_0x4ae2('0x5'));var config=require(_0x4ae2('0x6'));var jayson=require(_0x4ae2('0x7'));var client=jayson[_0x4ae2('0x8')][_0x4ae2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2ff15b,_0x2a28b4,_0x4b092d){return new BPromise(function(_0x391e45,_0x48d00c){return client[_0x4ae2('0xa')](_0x2ff15b,_0x4b092d)[_0x4ae2('0xb')](function(_0x4864d8){logger[_0x4ae2('0xc')](_0x4ae2('0xd'),_0x2a28b4,_0x4ae2('0xe'));logger[_0x4ae2('0xf')](_0x4ae2('0x10'),_0x2a28b4,_0x4ae2('0xe'),JSON['stringify'](_0x4864d8));if(_0x4864d8['error']){if(_0x4864d8[_0x4ae2('0x11')][_0x4ae2('0x12')]===0x1f4){logger[_0x4ae2('0x11')](_0x4ae2('0xd'),_0x2a28b4,_0x4864d8[_0x4ae2('0x11')]['message']);return _0x48d00c(_0x4864d8['error']['message']);}logger[_0x4ae2('0x11')](_0x4ae2('0xd'),_0x2a28b4,_0x4864d8['error'][_0x4ae2('0x13')]);return _0x391e45(_0x4864d8['error']['message']);}else{logger[_0x4ae2('0xc')](_0x4ae2('0xd'),_0x2a28b4,_0x4ae2('0xe'));_0x391e45(_0x4864d8[_0x4ae2('0x14')][_0x4ae2('0x13')]);}})[_0x4ae2('0x15')](function(_0x1e8b2c){logger[_0x4ae2('0x11')](_0x4ae2('0xd'),_0x2a28b4,_0x1e8b2c);_0x48d00c(_0x1e8b2c);});});}exports[_0x4ae2('0x16')]=function(_0x5e3e7f){var _0x3b278c=this;return new Promise(function(_0x5bbb21,_0x3b6897){return db[_0x4ae2('0x17')]['update'](_0x5e3e7f[_0x4ae2('0x18')],{'raw':_0x5e3e7f[_0x4ae2('0x19')]?_0x5e3e7f['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5e3e7f[_0x4ae2('0x19')]?_0x5e3e7f[_0x4ae2('0x19')][_0x4ae2('0x1a')]||null:null,'attributes':_0x5e3e7f[_0x4ae2('0x19')]?_0x5e3e7f['options'][_0x4ae2('0x1b')]||null:null,'limit':_0x5e3e7f['options']?_0x5e3e7f[_0x4ae2('0x19')][_0x4ae2('0x1c')]||null:null})[_0x4ae2('0xb')](function(_0x7d563b){logger[_0x4ae2('0xc')](_0x4ae2('0x16'),_0x5e3e7f);logger[_0x4ae2('0xf')](_0x4ae2('0x16'),_0x5e3e7f,JSON[_0x4ae2('0x1d')](_0x7d563b));_0x5bbb21(_0x7d563b);})[_0x4ae2('0x15')](function(_0x3c454e){logger[_0x4ae2('0x11')](_0x4ae2('0x16'),_0x3c454e[_0x4ae2('0x13')],_0x5e3e7f);_0x3b6897(_0x3b278c[_0x4ae2('0x11')](0x1f4,_0x3c454e['message']));});});}; \ No newline at end of file +var _0x73cd=['result','catch','UpdateFaxApplication','FaxApplication','update','options','raw','where','attributes','limit','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','FaxApplication,\x20%s,\x20%s','debug','FaxApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x47eae0,_0x243f1b){var _0x260347=function(_0x221977){while(--_0x221977){_0x47eae0['push'](_0x47eae0['shift']());}};_0x260347(++_0x243f1b);}(_0x73cd,0xc4));var _0xd73c=function(_0x55f380,_0x3e27f0){_0x55f380=_0x55f380-0x0;var _0x36b38e=_0x73cd[_0x55f380];return _0x36b38e;};'use strict';var _=require(_0xd73c('0x0'));var util=require(_0xd73c('0x1'));var moment=require(_0xd73c('0x2'));var BPromise=require('bluebird');var rs=require(_0xd73c('0x3'));var fs=require('fs');var Redis=require(_0xd73c('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xd73c('0x5'));var logger=require(_0xd73c('0x6'))(_0xd73c('0x7'));var config=require('../../config/environment');var jayson=require(_0xd73c('0x8'));var client=jayson['client'][_0xd73c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x301265,_0xcd7ee9,_0x131ecd){return new BPromise(function(_0xfcd598,_0x4b423b){return client[_0xd73c('0xa')](_0x301265,_0x131ecd)[_0xd73c('0xb')](function(_0x38af66){logger[_0xd73c('0xc')](_0xd73c('0xd'),_0xcd7ee9,'request\x20sent');logger[_0xd73c('0xe')](_0xd73c('0xf'),_0xcd7ee9,_0xd73c('0x10'),JSON[_0xd73c('0x11')](_0x38af66));if(_0x38af66['error']){if(_0x38af66[_0xd73c('0x12')][_0xd73c('0x13')]===0x1f4){logger[_0xd73c('0x12')](_0xd73c('0xd'),_0xcd7ee9,_0x38af66[_0xd73c('0x12')][_0xd73c('0x14')]);return _0x4b423b(_0x38af66['error'][_0xd73c('0x14')]);}logger['error'](_0xd73c('0xd'),_0xcd7ee9,_0x38af66[_0xd73c('0x12')][_0xd73c('0x14')]);return _0xfcd598(_0x38af66[_0xd73c('0x12')]['message']);}else{logger[_0xd73c('0xc')](_0xd73c('0xd'),_0xcd7ee9,'request\x20sent');_0xfcd598(_0x38af66[_0xd73c('0x15')]['message']);}})[_0xd73c('0x16')](function(_0x4c0806){logger[_0xd73c('0x12')](_0xd73c('0xd'),_0xcd7ee9,_0x4c0806);_0x4b423b(_0x4c0806);});});}exports[_0xd73c('0x17')]=function(_0xf6f5cf){var _0x5510dd=this;return new Promise(function(_0x22390c,_0x3ab844){return db[_0xd73c('0x18')][_0xd73c('0x19')](_0xf6f5cf['body'],{'raw':_0xf6f5cf['options']?_0xf6f5cf[_0xd73c('0x1a')][_0xd73c('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xf6f5cf[_0xd73c('0x1a')]?_0xf6f5cf[_0xd73c('0x1a')][_0xd73c('0x1c')]||null:null,'attributes':_0xf6f5cf[_0xd73c('0x1a')]?_0xf6f5cf[_0xd73c('0x1a')][_0xd73c('0x1d')]||null:null,'limit':_0xf6f5cf[_0xd73c('0x1a')]?_0xf6f5cf[_0xd73c('0x1a')][_0xd73c('0x1e')]||null:null})[_0xd73c('0xb')](function(_0x5f217f){logger[_0xd73c('0xc')]('UpdateFaxApplication',_0xf6f5cf);logger[_0xd73c('0xe')]('UpdateFaxApplication',_0xf6f5cf,JSON[_0xd73c('0x11')](_0x5f217f));_0x22390c(_0x5f217f);})[_0xd73c('0x16')](function(_0x3dcad9){logger[_0xd73c('0x12')](_0xd73c('0x17'),_0x3dcad9['message'],_0xf6f5cf);_0x3ab844(_0x5510dd['error'](0x1f4,_0x3dcad9[_0xd73c('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 505fcc5..d4df613 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 _0x038b=['update','delete','destroy','exports','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','create','put'];(function(_0x20f288,_0x42b564){var _0x800caf=function(_0x47aa1e){while(--_0x47aa1e){_0x20f288['push'](_0x20f288['shift']());}};_0x800caf(++_0x42b564);}(_0x038b,0x114));var _0xb038=function(_0x3290a3,_0x3ed31d){_0x3290a3=_0x3290a3-0x0;var _0x514e27=_0x038b[_0x3290a3];return _0x514e27;};'use strict';var multer=require('multer');var util=require(_0xb038('0x0'));var path=require(_0xb038('0x1'));var timeout=require(_0xb038('0x2'));var express=require('express');var router=express[_0xb038('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xb038('0x4'));var config=require(_0xb038('0x5'));var controller=require('./faxApplication.controller');router[_0xb038('0x6')]('/',auth[_0xb038('0x7')](),controller['index']);router['get'](_0xb038('0x8'),auth[_0xb038('0x7')](),controller[_0xb038('0x9')]);router['post']('/',auth['isAuthenticated'](),controller[_0xb038('0xa')]);router[_0xb038('0xb')]('/:id',auth['isAuthenticated'](),controller[_0xb038('0xc')]);router[_0xb038('0xd')]('/:id',auth[_0xb038('0x7')](),controller[_0xb038('0xe')]);module[_0xb038('0xf')]=router; \ No newline at end of file +var _0x53ec=['post','create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','./faxApplication.controller','get','index','/:id','isAuthenticated'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x53ec,0x192));var _0xc53e=function(_0x3c54d3,_0x9719e3){_0x3c54d3=_0x3c54d3-0x0;var _0xd67c8f=_0x53ec[_0x3c54d3];return _0xd67c8f;};'use strict';var multer=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var path=require(_0xc53e('0x2'));var timeout=require(_0xc53e('0x3'));var express=require(_0xc53e('0x4'));var router=express[_0xc53e('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xc53e('0x6'));var config=require('../../config/environment');var controller=require(_0xc53e('0x7'));router[_0xc53e('0x8')]('/',auth['isAuthenticated'](),controller[_0xc53e('0x9')]);router['get'](_0xc53e('0xa'),auth[_0xc53e('0xb')](),controller['show']);router[_0xc53e('0xc')]('/',auth[_0xc53e('0xb')](),controller[_0xc53e('0xd')]);router[_0xc53e('0xe')](_0xc53e('0xa'),auth[_0xc53e('0xb')](),controller[_0xc53e('0xf')]);router[_0xc53e('0x10')](_0xc53e('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0xc53e('0x11')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index f452543..d331127 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 _0x4662=['DATE','ENUM','out','sequelize','BOOLEAN'];(function(_0x39953f,_0x3fa03c){var _0x4b5178=function(_0x29f7d5){while(--_0x29f7d5){_0x39953f['push'](_0x39953f['shift']());}};_0x4b5178(++_0x3fa03c);}(_0x4662,0x1a7));var _0x2466=function(_0x461903,_0x34eb0d){_0x461903=_0x461903-0x0;var _0x1e0c59=_0x4662[_0x461903];return _0x1e0c59;};'use strict';var Sequelize=require(_0x2466('0x0'));module['exports']={'closed':{'type':Sequelize[_0x2466('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x2466('0x2')]},'fax':{'type':Sequelize['STRING']},'firstMsgDirection':{'type':Sequelize[_0x2466('0x3')]('in',_0x2466('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x2466('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x2466('0x3')]('in',_0x2466('0x4')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x7d00=['STRING','ENUM','out','sequelize','exports','BOOLEAN'];(function(_0x29b6f6,_0x19fdfb){var _0x1f95cb=function(_0x34e0c6){while(--_0x34e0c6){_0x29b6f6['push'](_0x29b6f6['shift']());}};_0x1f95cb(++_0x19fdfb);}(_0x7d00,0xed));var _0x07d0=function(_0x3d7899,_0x1f2b2e){_0x3d7899=_0x3d7899-0x0;var _0x18c15f=_0x7d00[_0x3d7899];return _0x18c15f;};'use strict';var Sequelize=require(_0x07d0('0x0'));module[_0x07d0('0x1')]={'closed':{'type':Sequelize[_0x07d0('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x07d0('0x3')]},'note':{'type':Sequelize[_0x07d0('0x3')]},'read1stAt':{'type':Sequelize['DATE']},'fax':{'type':Sequelize[_0x07d0('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x07d0('0x4')]('in',_0x07d0('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x07d0('0x4')]('in',_0x07d0('0x5')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index ed739df..39b39f6 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 _0x4569=['localhost','register','sendStatus','status','end','offset','limit','set','Content-Range','apply','reject','save','update','then','stack','name','send','map','fullname','TagIds','push','catch','FaxInteraction','fieldName','type','model','query','filters','intersection','fields','attributes','length','nolimit','order','where','pick','field','color','tools_tags','u.id','from','left_join','users','select','fax_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','fax_accounts','a.id\x20=\x20i.FaxAccountId','fax_messages','me.FaxInteractionId\x20=\x20i.id','fax_interaction_has_tags','it.FaxInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','$substring','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','buildExpression','text','start','Tag','forEach','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','keys','compact','isEmpty','concat','createdAt','$gte','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','read','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','\x27\x27\x27\x27','isNumeric','i.id\x20LIKE\x20?','group','Sequelize','QueryTypes','clone','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','t.id\x20IN\x20?','resolve','FaxAccountId','journey','i.FaxAccountId\x20IS\x20NOT\x20NULL','i.FaxAccountId\x20IS\x20NULL','sequelize','toString','count','a.mandatoryDisposition','Account.mandatoryDisposition','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','c.phone','Contact.phone','Contact.mobile','Contact.fax','Owner.fullname','Owner.internal','ui.FaxInteractionId\x20IN\x20?','rows','show','rawAttributes','includeAll','include','options','create','body','params','describe','addMessage','ids','omit','getMessages','findOne','FaxMessage','hasOwnProperty','sort','FaxInteractionId','merge','addTags','setTags','spread','findAll','emit','faxInteractionTags:save','removeTags','download','root','server','files','tmp','join','attachments','format','transcript-%d-%s.zip','Attachment','Messages','get','existsSync','createReadStream','createWriteStream','log','err','eml-format','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','redis','defaults'];(function(_0x491a7f,_0x28bb80){var _0x3d8f44=function(_0xdaa716){while(--_0xdaa716){_0x491a7f['push'](_0x491a7f['shift']());}};_0x3d8f44(++_0x28bb80);}(_0x4569,0xaa));var _0x9456=function(_0x3e6234,_0x2480ad){_0x3e6234=_0x3e6234-0x0;var _0x2b4329=_0x4569[_0x3e6234];return _0x2b4329;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x9456('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x9456('0x1'));var rp=require(_0x9456('0x2'));var moment=require(_0x9456('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x9456('0x4'));var util=require(_0x9456('0x5'));var path=require(_0x9456('0x6'));var sox=require(_0x9456('0x7'));var csv=require(_0x9456('0x8'));var ejs=require(_0x9456('0x9'));var fs=require('fs');var _=require(_0x9456('0xa'));var squel=require(_0x9456('0xb'));var crypto=require(_0x9456('0xc'));var jsforce=require(_0x9456('0xd'));var deskjs=require(_0x9456('0xe'));var toCsv=require(_0x9456('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x9456('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x9456('0x10'));var as=require(_0x9456('0x11'));var hardwareService=require(_0x9456('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x9456('0x13'));var config=require(_0x9456('0x14'));var db=require(_0x9456('0x15'))['db'];config[_0x9456('0x16')]=_[_0x9456('0x17')](config[_0x9456('0x16')],{'host':_0x9456('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9456('0x16')]));require('./faxInteraction.socket')[_0x9456('0x19')](socket);function respondWithStatusCode(_0x188e37,_0x595c4d){_0x595c4d=_0x595c4d||0xcc;return function(_0xff5f57){if(_0xff5f57){return _0x188e37[_0x9456('0x1a')](_0x595c4d);}return _0x188e37[_0x9456('0x1b')](_0x595c4d)[_0x9456('0x1c')]();};}function respondWithResult(_0x226a1f,_0x2e9e0f){_0x2e9e0f=_0x2e9e0f||0xc8;return function(_0x2faad5){if(_0x2faad5){return _0x226a1f['status'](_0x2e9e0f)['json'](_0x2faad5);}};}function respondWithFilteredResult(_0x4eab8e,_0x9430c3){return function(_0x61272f){if(_0x61272f){var _0x22c456=_0x61272f['count'],_0x3272e9=_0x9430c3[_0x9456('0x1d')],_0x48ef0d=_0x9430c3['offset']+_0x9430c3[_0x9456('0x1e')],_0x4a2779;if(_0x48ef0d>=_0x22c456){_0x48ef0d=_0x22c456;_0x4a2779=0xc8;}else{_0x4a2779=0xce;}_0x4eab8e['status'](_0x4a2779);return _0x4eab8e[_0x9456('0x1f')](_0x9456('0x20'),_0x3272e9+'-'+_0x48ef0d+'/'+_0x22c456)['json'](_0x61272f);}return null;};}function patchUpdates(_0x29e2fc){return function(_0x5272ff){try{jsonpatch[_0x9456('0x21')](_0x5272ff,_0x29e2fc,!![]);}catch(_0x50ffdd){return BPromise[_0x9456('0x22')](_0x50ffdd);}return _0x5272ff[_0x9456('0x23')]();};}function saveUpdates(_0x18d42b,_0x276538){return function(_0x216af0){if(_0x216af0){return _0x216af0[_0x9456('0x24')](_0x18d42b)[_0x9456('0x25')](function(_0x10aa93){return _0x10aa93;});}return null;};}function removeEntity(_0x245e39,_0x3d83ef){return function(_0x2e89b8){if(_0x2e89b8){return _0x2e89b8['destroy']()[_0x9456('0x25')](function(){_0x245e39[_0x9456('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x302e01,_0x2c1513){return function(_0x32aeda){if(!_0x32aeda){_0x302e01[_0x9456('0x1a')](0x194);}return _0x32aeda;};}function handleError(_0x529025,_0x5c6f76){_0x5c6f76=_0x5c6f76||0x1f4;return function(_0x385a05){logger['error'](_0x385a05[_0x9456('0x26')]);if(_0x385a05[_0x9456('0x27')]){delete _0x385a05['name'];}_0x529025[_0x9456('0x1b')](_0x5c6f76)[_0x9456('0x28')](_0x385a05);};}function getInteractionUsers(_0x3dcfd1,_0x1eb3a8){return new BPromise(function(_0x402264,_0x28e90d){try{if(_0x1eb3a8[_0x3dcfd1['id']]){_0x3dcfd1['Users']=_[_0x9456('0x29')](_0x1eb3a8[_0x3dcfd1['id']],function(_0xef3f74){return{'id':_0xef3f74['id'],'fullname':_0xef3f74[_0x9456('0x2a')]};});}}catch(_0x419701){_0x28e90d(_0x419701);}_0x402264(_0x3dcfd1);});}function getInteractionTags(_0x59d2f0,_0x1ae7ca){return new BPromise(function(_0x5f07e0,_0x1130f7){try{if(_0x59d2f0[_0x9456('0x2b')]){_0x59d2f0['Tags']=[];_0x59d2f0[_0x9456('0x2b')]['split'](',')['forEach'](function(_0x125165){_0x59d2f0['Tags'][_0x9456('0x2c')](_0x1ae7ca[_0x125165]);});}delete _0x59d2f0['TagIds'];}catch(_0x24321b){_0x1130f7(_0x24321b);}_0x5f07e0(_0x59d2f0);});}function updateFaxInteraction(_0x253aa5,_0x34b718,_0x330561){return new BPromise(function(_0x239a66,_0x45fdba){return getInteractionUsers(_0x253aa5,_0x330561)[_0x9456('0x25')](function(_0x3ffa12){return getInteractionTags(_0x3ffa12,_0x34b718);})[_0x9456('0x25')](function(_0x8d1f7b){_0x239a66(_0x8d1f7b);})[_0x9456('0x2d')](function(_0x426fd6){_0x45fdba(_0x426fd6);});});}exports['index']=function(_0x1b826c,_0x54bb75){var _0x382134={},_0x188ffc={},_0x34faf3={'count':0x0,'rows':[]};var _0x4f8834=_[_0x9456('0x29')](db[_0x9456('0x2e')]['rawAttributes'],function(_0x1365bb){return{'name':_0x1365bb[_0x9456('0x2f')],'type':_0x1365bb[_0x9456('0x30')]['key']};});_0x188ffc[_0x9456('0x31')]=_[_0x9456('0x29')](_0x4f8834,_0x9456('0x27'));_0x188ffc[_0x9456('0x32')]=_['keys'](_0x1b826c[_0x9456('0x32')]);_0x188ffc[_0x9456('0x33')]=_[_0x9456('0x34')](_0x188ffc[_0x9456('0x31')],_0x188ffc[_0x9456('0x32')]);_0x382134['attributes']=_[_0x9456('0x34')](_0x188ffc['model'],qs[_0x9456('0x35')](_0x1b826c[_0x9456('0x32')]['fields']));_0x382134[_0x9456('0x36')]=_0x382134['attributes'][_0x9456('0x37')]?_0x382134[_0x9456('0x36')]:_0x188ffc[_0x9456('0x31')];if(!_0x1b826c['query']['hasOwnProperty'](_0x9456('0x38'))){_0x382134[_0x9456('0x1e')]=qs['limit'](_0x1b826c['query'][_0x9456('0x1e')]);_0x382134[_0x9456('0x1d')]=qs[_0x9456('0x1d')](_0x1b826c[_0x9456('0x32')][_0x9456('0x1d')]);}_0x382134[_0x9456('0x39')]=qs['sort'](_0x1b826c['query']['sort']);_0x382134[_0x9456('0x3a')]=qs['filters'](_[_0x9456('0x3b')](_0x1b826c[_0x9456('0x32')],_0x188ffc[_0x9456('0x33')]));var _0x202948=[];var _0x3994b8=squel['select']()['field']('id')[_0x9456('0x3c')](_0x9456('0x27'))['field'](_0x9456('0x3d'))['from'](_0x9456('0x3e'));var _0x30c03c=squel['select']()[_0x9456('0x3c')](_0x9456('0x3f'))[_0x9456('0x3c')]('u.fullname')[_0x9456('0x3c')]('ui.FaxInteractionId')[_0x9456('0x40')]('user_has_fax_interactions','ui')[_0x9456('0x41')](_0x9456('0x42'),'u','u.id\x20=\x20ui.UserId');var _0x34f3d1=squel[_0x9456('0x43')]()['from'](_0x9456('0x44'),'i')['left_join'](_0x9456('0x45'),'c',_0x9456('0x46'))[_0x9456('0x41')]('users','o',_0x9456('0x47'))[_0x9456('0x41')](_0x9456('0x48'),'a',_0x9456('0x49'))[_0x9456('0x41')](_0x9456('0x4a'),'me',_0x9456('0x4b'))['left_join'](_0x9456('0x4c'),'it',_0x9456('0x4d'))[_0x9456('0x41')](_0x9456('0x3e'),'t',_0x9456('0x4e'));var _0x17a0b5=squel[_0x9456('0x4f')]();var _0x2817e4=[];var _0x40b8e1=squel[_0x9456('0x4f')]();var _0x226318;if(_0x1b826c[_0x9456('0x32')][_0x9456('0x50')]){_0x226318=as['parseSearch'](_0x1b826c[_0x9456('0x32')]['search']);var _0x3f1307=_0x226318[_0x9456('0x51')];for(var _0x3fcd7c=0x0;_0x3fcd7c<_0x226318[_0x9456('0x52')]['length'];_0x3fcd7c++){var _0x19b635=_0x226318[_0x9456('0x52')][_0x3fcd7c];var _0x2ff183='i';var _0x4a24d1=_[_0x9456('0x53')](_0x4f8834,[_0x9456('0x27'),_0x19b635[_0x9456('0x3c')]]);if(!_0x4a24d1){switch(_0x19b635[_0x9456('0x3c')]){case _0x9456('0x54'):if(_0x19b635[_0x9456('0x55')]==0x1){_0x34f3d1[_0x9456('0x56')]('`'+_0x19b635[_0x9456('0x3c')]+_0x9456('0x57'));}else{_0x34f3d1[_0x9456('0x56')]('`'+_0x19b635[_0x9456('0x3c')]+'`\x20>\x200');}break;case'Contact':if(_0x19b635['operator']===_0x9456('0x58')){if(_0x19b635[_0x9456('0x55')][_0x9456('0x59')]('\x20')[_0x9456('0x37')]>0x1){_0x17a0b5[_0x3f1307](_0x9456('0x5a'),qs['getFullTextValue'](_0x19b635[_0x9456('0x55')]),null);}else{var _0x598fed='%'+_0x19b635[_0x9456('0x55')]+'%';_0x17a0b5[_0x3f1307](_0x9456('0x5b'),_0x598fed,_0x598fed,_0x598fed);}}else{_0x4a24d1=_[_0x9456('0x53')](_0x4f8834,['name','ContactId']);_0x19b635[_0x9456('0x3c')]='ContactId';_0x8f1870=as[_0x9456('0x5c')](_0x2ff183,_0x4a24d1[_0x9456('0x30')],_0x19b635);_0x17a0b5[_0x3f1307](_0x8f1870[_0x9456('0x5d')],_0x8f1870[_0x9456('0x55')][_0x9456('0x5e')],_0x8f1870[_0x9456('0x55')]['end']);}break;case _0x9456('0x5f'):var _0xc98629=_0x19b635['value'][_0x9456('0x59')](',')[_0x9456('0x29')](function(_0xcaa4d3){return Number(_0xcaa4d3);});_0xc98629[_0x9456('0x60')](function(_0x520b29){_0x40b8e1['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x520b29+',%');});_0x2817e4=_['union'](_0x2817e4,_0xc98629);break;case'User':if(_0x19b635[_0x9456('0x61')]===_0x9456('0x58')){_0x17a0b5[_0x3f1307](_0x9456('0x62'),'%'+_0x19b635['value']+'%',null);}else{_0x4a24d1=_[_0x9456('0x53')](_0x4f8834,['name',_0x9456('0x63')]);_0x19b635['field']=_0x9456('0x63');_0x8f1870=as[_0x9456('0x5c')](_0x2ff183,_0x4a24d1['type'],_0x19b635);_0x17a0b5[_0x3f1307](_0x8f1870[_0x9456('0x5d')],_0x8f1870['value'][_0x9456('0x5e')],_0x8f1870[_0x9456('0x55')][_0x9456('0x1c')]);}break;case'body':_0x8f1870=as[_0x9456('0x5c')]('me',null,_0x19b635);_0x17a0b5[_0x3f1307](_0x8f1870[_0x9456('0x5d')],_0x8f1870['value'][_0x9456('0x5e')],_0x8f1870['value']['end']);break;}}else{var _0x8f1870=as['buildExpression'](_0x2ff183,_0x4a24d1[_0x9456('0x30')],_0x19b635);_0x17a0b5[_0x3f1307](_0x8f1870[_0x9456('0x5d')],_0x8f1870[_0x9456('0x55')][_0x9456('0x5e')],_0x8f1870['value'][_0x9456('0x1c')]);}}}else{var _0x177af5=_(_0x1b826c[_0x9456('0x32')])[_0x9456('0x64')]()[_0x9456('0x29')](function(_0x179492){return _['some'](_0x4f8834,[_0x9456('0x27'),_0x179492])?_0x179492:undefined;})[_0x9456('0x65')]()[_0x9456('0x55')]();if(!_[_0x9456('0x66')](_0x177af5)){_0x177af5[_0x9456('0x60')](function(_0x28597e){if(_0x28597e==='FaxAccountId'){_0x34f3d1[_0x9456('0x3a')]('i.FaxAccountId\x20IN\x20?',[][_0x9456('0x67')](_0x1b826c[_0x9456('0x32')][_0x28597e]));}else if(_0x28597e===_0x9456('0x68')){var _0xef0b55=JSON['parse'](_0x1b826c[_0x9456('0x32')][_0x28597e])[_0x9456('0x69')];var _0x95453=JSON[_0x9456('0x6a')](_0x1b826c[_0x9456('0x32')][_0x28597e])[_0x9456('0x6b')];_0x34f3d1[_0x9456('0x3a')](_0x9456('0x6c'),_0xef0b55,_0x95453);}else{if(_0x1b826c['query'][_0x28597e]===_0x9456('0x6d')){_0x34f3d1[_0x9456('0x3a')]('i.'+_0x28597e+'\x20IS\x20NULL');}else{_0x34f3d1['where']('i.'+_0x28597e+_0x9456('0x6e'),_0x1b826c[_0x9456('0x32')][_0x28597e]);}}});}if(_0x1b826c['query'][_0x9456('0x6f')]){if(_0x1b826c[_0x9456('0x32')]['read']==0x1){_0x34f3d1[_0x9456('0x56')]('`unreadMessages`\x20=\x200');}else{_0x34f3d1[_0x9456('0x56')]('`unreadMessages`\x20>\x200');}}if(_0x1b826c[_0x9456('0x32')][_0x9456('0x70')]){_0x2817e4=_[_0x9456('0x71')](_0x1b826c[_0x9456('0x32')]['tag'])?_0x1b826c['query']['tag']:new Array(_0x1b826c[_0x9456('0x32')]['tag']);_0x2817e4['forEach'](function(_0x150bd2){_0x40b8e1['or'](_0x9456('0x72'),'%,'+_0x150bd2+',%');});}if(_0x1b826c[_0x9456('0x32')][_0x9456('0x73')]){var _0xaa87b2=_0x1b826c[_0x9456('0x32')][_0x9456('0x73')]['replace']('\x5c','\x5c\x5c')[_0x9456('0x74')]('\x27\x27',_0x9456('0x75'));if(qs[_0x9456('0x76')](_0xaa87b2)){_0x17a0b5['or'](_0x9456('0x77'),_0xaa87b2+'%')['or']('i.fax\x20LIKE\x20?',_0xaa87b2+'%');}_0x17a0b5['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0xaa87b2+'%');}}_0x34f3d1[_0x9456('0x3a')](_0x17a0b5);_0x34f3d1[_0x9456('0x78')]('i.id');var _0x3c12b7={'type':db[_0x9456('0x79')][_0x9456('0x7a')]['SELECT'],'raw':!![]};var _0x4edd94=_0x34f3d1[_0x9456('0x7b')]();_0x4edd94[_0x9456('0x3c')](_0x9456('0x7c'));_0x4edd94[_0x9456('0x3c')](_0x9456('0x7d'),_0x9456('0x54'));if(_0x382134[_0x9456('0x39')]){_0x382134[_0x9456('0x39')][_0x9456('0x60')](function(_0x4e84da){_0x34f3d1['order']('i.'+_0x4e84da[0x0],_0x4e84da[0x1]===_0x9456('0x7e')?![]:!![]);});}if(!_['isEmpty'](_0x2817e4)){_0x34f3d1[_0x9456('0x56')](_0x40b8e1);_0x4edd94[_0x9456('0x3a')](_0x9456('0x7f'),_0x2817e4);}BPromise[_0x9456('0x80')]()['then'](function(){if(!_0x226318){if(_0x1b826c[_0x9456('0x32')][_0x9456('0x81')]||_0x1b826c[_0x9456('0x32')][_0x9456('0x82')])return;_0x4edd94[_0x9456('0x3a')]('i.FaxAccountId\x20IS\x20NOT\x20NULL');_0x34f3d1[_0x9456('0x3a')](_0x9456('0x83'));return;}return _0x1b826c['user']['getFaxAccounts']({'attributes':['id'],'raw':!![]})[_0x9456('0x25')](function(_0x2c52a9){if(_[_0x9456('0x66')](_0x2c52a9)){_0x4edd94[_0x9456('0x3a')](_0x9456('0x84'));_0x34f3d1[_0x9456('0x3a')]('i.FaxAccountId\x20IS\x20NULL');}else{_0x4edd94['where']('i.FaxAccountId\x20IN\x20?',_['map'](_0x2c52a9,'id'));_0x34f3d1['where']('i.FaxAccountId\x20IN\x20?',_['map'](_0x2c52a9,'id'));}});})[_0x9456('0x25')](function(){db[_0x9456('0x85')]['query'](_0x4edd94[_0x9456('0x86')](),_0x3c12b7)[_0x9456('0x25')](function(_0x3de543){_0x34faf3[_0x9456('0x87')]=_0x3de543['length'];if(_0x34faf3[_0x9456('0x87')]===0x0)return[];return db[_0x9456('0x85')]['query'](_0x3994b8[_0x9456('0x86')](),_0x3c12b7)[_0x9456('0x25')](function(_0x2a9821){_0x202948=_['keyBy'](_0x2a9821,'id');_0x3c12b7=_['merge'](_0x3c12b7,{'model':db[_0x9456('0x2e')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x1b826c[_0x9456('0x32')][_0x9456('0x35')]){_0x382134[_0x9456('0x36')][_0x9456('0x60')](function(_0x3e93b2){_0x34f3d1[_0x9456('0x3c')]('i.'+_0x3e93b2);});}else{_0x34f3d1[_0x9456('0x3c')](_0x9456('0x7d'),'unreadMessages');_0x34f3d1[_0x9456('0x3c')]('a.key','Account.key');_0x34f3d1[_0x9456('0x3c')](_0x9456('0x88'),_0x9456('0x89'));_0x34f3d1[_0x9456('0x3c')]('i.*');_0x34f3d1[_0x9456('0x3c')](_0x9456('0x8a'),_0x9456('0x8b'));_0x34f3d1[_0x9456('0x3c')](_0x9456('0x8c'),_0x9456('0x8d'));_0x34f3d1[_0x9456('0x3c')](_0x9456('0x8e'),'Contact.email');_0x34f3d1['field'](_0x9456('0x8f'),_0x9456('0x90'));_0x34f3d1[_0x9456('0x3c')]('c.mobile',_0x9456('0x91'));_0x34f3d1[_0x9456('0x3c')]('c.fax',_0x9456('0x92'));_0x34f3d1['field']('o.fullname',_0x9456('0x93'));_0x34f3d1[_0x9456('0x3c')]('o.internal',_0x9456('0x94'));_0x34f3d1[_0x9456('0x3c')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x9456('0x2b'));}_0x34f3d1[_0x9456('0x1e')](_0x382134[_0x9456('0x1e')]);_0x34f3d1[_0x9456('0x1d')](_0x382134['offset']);return db['sequelize'][_0x9456('0x32')](_0x34f3d1['toString'](),_0x3c12b7);})[_0x9456('0x25')](function(_0x247a93){_0x30c03c['where'](_0x9456('0x95'),_[_0x9456('0x29')](_0x247a93,'id'));return db[_0x9456('0x85')][_0x9456('0x32')](_0x30c03c['toString'](),_0x3c12b7)['then'](function(_0x5a06e4){var _0x30bcde=_['groupBy'](_0x5a06e4,'FaxInteractionId');var _0xa8024a=[];_0x247a93[_0x9456('0x60')](function(_0x43d7f3){_0xa8024a[_0x9456('0x2c')](updateFaxInteraction(_0x43d7f3,_0x202948,_0x30bcde));});return BPromise['all'](_0xa8024a);});});})[_0x9456('0x25')](function(_0x5863a7){_0x34faf3[_0x9456('0x96')]=_0x5863a7;return _0x34faf3;})['then'](respondWithFilteredResult(_0x54bb75,_0x382134));})['catch'](handleError(_0x54bb75,null));};exports[_0x9456('0x97')]=function(_0x1e7b3d,_0x4dbe3d){var _0x3a223f={'raw':![],'where':{'id':_0x1e7b3d['params']['id']}},_0x4087be={};_0x4087be[_0x9456('0x31')]=_['keys'](db[_0x9456('0x2e')][_0x9456('0x98')]);_0x4087be[_0x9456('0x32')]=_[_0x9456('0x64')](_0x1e7b3d[_0x9456('0x32')]);_0x4087be[_0x9456('0x33')]=_[_0x9456('0x34')](_0x4087be[_0x9456('0x31')],_0x4087be['query']);_0x3a223f['attributes']=_['intersection'](_0x4087be[_0x9456('0x31')],qs[_0x9456('0x35')](_0x1e7b3d[_0x9456('0x32')][_0x9456('0x35')]));_0x3a223f['attributes']=_0x3a223f['attributes'][_0x9456('0x37')]?_0x3a223f[_0x9456('0x36')]:_0x4087be[_0x9456('0x31')];if(_0x1e7b3d['query'][_0x9456('0x99')]){_0x3a223f[_0x9456('0x9a')]=[{'all':!![]}];}_0x3a223f=_['merge']({},_0x3a223f,_0x1e7b3d[_0x9456('0x9b')]);return db[_0x9456('0x2e')]['find'](_0x3a223f)['then'](handleEntityNotFound(_0x4dbe3d,null))['then'](respondWithResult(_0x4dbe3d,null))[_0x9456('0x2d')](handleError(_0x4dbe3d,null));};exports['create']=function(_0x2012a7,_0x2c851f){return db[_0x9456('0x2e')][_0x9456('0x9c')](_0x2012a7[_0x9456('0x9d')],{})[_0x9456('0x25')](respondWithResult(_0x2c851f,0xc9))['catch'](handleError(_0x2c851f,null));};exports[_0x9456('0x24')]=function(_0x52bbdf,_0x4e8ba3){if(_0x52bbdf[_0x9456('0x9d')]['id']){delete _0x52bbdf[_0x9456('0x9d')]['id'];}return db[_0x9456('0x2e')][_0x9456('0x53')]({'where':{'id':_0x52bbdf[_0x9456('0x9e')]['id']}})[_0x9456('0x25')](handleEntityNotFound(_0x4e8ba3,null))[_0x9456('0x25')](saveUpdates(_0x52bbdf[_0x9456('0x9d')],null))[_0x9456('0x25')](respondWithResult(_0x4e8ba3,null))['catch'](handleError(_0x4e8ba3,null));};exports['destroy']=function(_0x4b12a3,_0x2188b1){return db[_0x9456('0x2e')][_0x9456('0x53')]({'where':{'id':_0x4b12a3[_0x9456('0x9e')]['id']}})[_0x9456('0x25')](handleEntityNotFound(_0x2188b1,null))[_0x9456('0x25')](removeEntity(_0x2188b1,null))[_0x9456('0x2d')](handleError(_0x2188b1,null));};exports['describe']=function(_0x1f4351,_0x2909a0){return db[_0x9456('0x2e')][_0x9456('0x9f')]()[_0x9456('0x25')](respondWithResult(_0x2909a0,null))[_0x9456('0x2d')](handleError(_0x2909a0,null));};exports['addMessage']=function(_0x27b7f3,_0x5c9d50,_0x4a93eb){return db['FaxMessage'][_0x9456('0x53')]({'where':{'id':_0x27b7f3[_0x9456('0x9e')]['id']}})['then'](handleEntityNotFound(_0x5c9d50,null))[_0x9456('0x25')](function(_0x20fd9a){if(_0x20fd9a){return _0x20fd9a[_0x9456('0xa0')](_0x27b7f3[_0x9456('0x9d')][_0x9456('0xa1')],_[_0x9456('0xa2')](_0x27b7f3[_0x9456('0x9d')],[_0x9456('0xa1'),'id'])||{});}})[_0x9456('0x25')](respondWithResult(_0x5c9d50,null))[_0x9456('0x2d')](handleError(_0x5c9d50,null));};exports[_0x9456('0xa3')]=function(_0x26bb1b,_0x45ea43,_0x266a52){var _0x42975e={'raw':![],'where':{}};var _0x42544c={};var _0x4a8c5b={'count':0x0,'rows':[]};return db['FaxInteraction'][_0x9456('0xa4')]({'where':{'id':_0x26bb1b[_0x9456('0x9e')]['id']}})[_0x9456('0x25')](handleEntityNotFound(_0x45ea43,null))[_0x9456('0x25')](function(_0x24652c){if(_0x24652c){_0x42544c[_0x9456('0x31')]=_['keys'](db[_0x9456('0xa5')][_0x9456('0x98')]);_0x42544c[_0x9456('0x32')]=_[_0x9456('0x64')](_0x26bb1b[_0x9456('0x32')]);_0x42544c[_0x9456('0x33')]=_[_0x9456('0x34')](_0x42544c[_0x9456('0x31')],_0x42544c[_0x9456('0x32')]);_0x42975e[_0x9456('0x36')]=_[_0x9456('0x34')](_0x42544c[_0x9456('0x31')],qs['fields'](_0x26bb1b['query'][_0x9456('0x35')]));_0x42975e[_0x9456('0x36')]=_0x42975e[_0x9456('0x36')][_0x9456('0x37')]?_0x42975e[_0x9456('0x36')]:_0x42544c[_0x9456('0x31')];if(!_0x26bb1b['query'][_0x9456('0xa6')](_0x9456('0x38'))){_0x42975e[_0x9456('0x1e')]=qs[_0x9456('0x1e')](_0x26bb1b[_0x9456('0x32')][_0x9456('0x1e')]);_0x42975e[_0x9456('0x1d')]=qs[_0x9456('0x1d')](_0x26bb1b[_0x9456('0x32')][_0x9456('0x1d')]);}_0x42975e[_0x9456('0x39')]=qs[_0x9456('0xa7')](_0x26bb1b[_0x9456('0x32')]['sort']);_0x42975e[_0x9456('0x3a')]=qs[_0x9456('0x33')](_[_0x9456('0x3b')](_0x26bb1b[_0x9456('0x32')],_0x42544c['filters']));_0x42975e[_0x9456('0x3a')][_0x9456('0xa8')]=_0x24652c['id'];if(_0x26bb1b[_0x9456('0x32')][_0x9456('0x73')]){_0x42975e[_0x9456('0x3a')]=_['merge'](_0x42975e[_0x9456('0x3a')],{'$or':_['map'](_0x42975e[_0x9456('0x36')],function(_0x53472d){var _0x35ab86={};_0x35ab86[_0x53472d]={'$like':'%'+_0x26bb1b[_0x9456('0x32')]['filter']+'%'};return _0x35ab86;})});}if(_0x26bb1b['query'][_0x9456('0x69')]){var _0x43a72f=_0x26bb1b[_0x9456('0x32')][_0x9456('0x69')]['split'](',');var _0x212837={};_0x212837[_0x43a72f[0x0]]={'$gte':moment(_0x43a72f[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x42975e[_0x9456('0x3a')]=_['merge'](_0x42975e[_0x9456('0x3a')],_0x212837);}_0x42975e=_[_0x9456('0xa9')]({},_0x42975e,_0x26bb1b[_0x9456('0x9b')]);return db[_0x9456('0xa5')][_0x9456('0x87')]({'where':_0x42975e[_0x9456('0x3a')]})[_0x9456('0x25')](function(_0x58c379){_0x4a8c5b[_0x9456('0x87')]=_0x58c379;if(_0x26bb1b[_0x9456('0x32')][_0x9456('0x99')]){_0x42975e[_0x9456('0x9a')]=[{'all':!![]}];}return db[_0x9456('0xa5')]['findAll'](_0x42975e);})['then'](function(_0x4abaf9){_0x4a8c5b['rows']=_0x4abaf9;return _0x4a8c5b;});}})[_0x9456('0x25')](respondWithFilteredResult(_0x45ea43,_0x42975e))[_0x9456('0x2d')](handleError(_0x45ea43,null));};exports[_0x9456('0xaa')]=function(_0x5cd858,_0x42cbe8,_0xca02da){return db[_0x9456('0x2e')][_0x9456('0x53')]({'where':{'id':_0x5cd858[_0x9456('0x9e')]['id']}})[_0x9456('0x25')](handleEntityNotFound(_0x42cbe8,null))['then'](function(_0x1b1191){if(_0x1b1191){return _0x1b1191[_0x9456('0xab')](_0x5cd858[_0x9456('0x9d')]['ids'],_[_0x9456('0xa2')](_0x5cd858['body'],[_0x9456('0xa1'),'id'])||{})[_0x9456('0xac')](function(){return db[_0x9456('0x5f')][_0x9456('0xad')]({'attributes':['id','name',_0x9456('0x3d')],'where':{'id':_0x5cd858['body'][_0x9456('0xa1')]}});})['then'](function(_0x1076fa){socket[_0x9456('0xae')](_0x9456('0xaf'),{'id':Number(_0x5cd858[_0x9456('0x9e')]['id']),'tags':_0x1076fa||[]});return{'id':Number(_0x5cd858['params']['id']),'tags':_0x1076fa||[]};});}})['then'](respondWithResult(_0x42cbe8,null))['catch'](handleError(_0x42cbe8,null));};exports[_0x9456('0xb0')]=function(_0x537a9a,_0x563f6a,_0x982ef1){return db[_0x9456('0x2e')][_0x9456('0x53')]({'where':{'id':_0x537a9a['params']['id']}})[_0x9456('0x25')](handleEntityNotFound(_0x563f6a,null))['then'](function(_0x5b034b){if(_0x5b034b){return _0x5b034b[_0x9456('0xb0')](_0x537a9a[_0x9456('0x32')]['ids']);}})[_0x9456('0x25')](respondWithStatusCode(_0x563f6a,null))['catch'](handleError(_0x563f6a,null));};exports[_0x9456('0xb1')]=function(_0x10f7d3,_0x5300d9){var _0x44fa78=moment()['unix']()[_0x9456('0x86')]();var _0x567ca3=path['join'](config[_0x9456('0xb2')],_0x9456('0xb3'),_0x9456('0xb4'),_0x9456('0xb5'));var _0x2b9d04=path[_0x9456('0xb6')](config['root'],_0x9456('0xb3'),_0x9456('0xb4'),_0x9456('0xb7'));var _0x12ca6b=path['join'](_0x567ca3,_0x44fa78);var _0xcbf94c=util[_0x9456('0xb8')](_0x9456('0xb9'),_0x10f7d3['params']['id'],_0x44fa78);var _0x24b1db=path[_0x9456('0xb6')](_0x567ca3,_0xcbf94c);var _0x5c6e61=[];_0x5c6e61[_0x9456('0x2c')]({'model':db[_0x9456('0xba')],'as':'Attachment','raw':!![]});var _0x1ae394=[{'model':db[_0x9456('0xa5')],'as':_0x9456('0xbb'),'attributes':['id','body',_0x9456('0x68')],'include':_0x5c6e61}];return db['FaxInteraction'][_0x9456('0x53')]({'where':{'id':_0x10f7d3[_0x9456('0x9e')]['id']},'include':_0x1ae394})['then'](handleEntityNotFound(_0x5300d9,null))[_0x9456('0x25')](function(_0x27eb21){if(_0x27eb21&&_0x27eb21[_0x9456('0xbb')]){var _0x3f9b22=_0x27eb21[_0x9456('0xbc')]({'plain':!![]});fs['mkdirSync'](_0x12ca6b);for(var _0x2ba0b9=0x0;_0x2ba0b9<_0x3f9b22[_0x9456('0xbb')][_0x9456('0x37')];_0x2ba0b9++){var _0x564027=_0x3f9b22['Messages'][_0x2ba0b9][_0x9456('0xba')];if(_0x564027){var _0x1844f1=path[_0x9456('0xb6')](_0x2b9d04,_0x564027['basename']);if(fs[_0x9456('0xbd')](_0x1844f1)){fs[_0x9456('0xbe')](_0x1844f1)['pipe'](fs[_0x9456('0xbf')](path[_0x9456('0xb6')](_0x12ca6b,_0x564027['basename'])));}}}return BPromise['resolve']()[_0x9456('0x25')](function(){return new BPromise(function(_0x4565da,_0x1d1906){zipdir(_0x12ca6b,{'saveTo':_0x24b1db},function(_0x20bb78,_0x2ccfdb){if(_0x20bb78)return _0x1d1906(_0x20bb78);return _0x4565da(_0x2ccfdb);});})[_0x9456('0x25')](function(){return new BPromise(function(_0x72d528,_0x4d8e49){rimraf(_0x12ca6b,function(_0xbdac38){if(_0xbdac38)_0x4d8e49(_0xbdac38);return _0x72d528();});});})[_0x9456('0x25')](function(){return _0x5300d9[_0x9456('0xb1')](_0x24b1db,_0xcbf94c,function(_0x38c88b){if(_0x38c88b){console[_0x9456('0xc0')](_0x9456('0xc1'),_0x38c88b);}else{fs['unlinkSync'](_0x24b1db);}});});});}else{return _0x5300d9[_0x9456('0x1a')](0xc8);}})[_0x9456('0x2d')](handleError(_0x5300d9,null));}; \ No newline at end of file +var _0x61cd=['TagIds','Tags','split','push','index','FaxInteraction','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','field','color','from','u.id','u.fullname','left_join','users','u.id\x20=\x20ui.UserId','select','fax_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','fax_accounts','fax_messages','me.FaxInteractionId\x20=\x20i.id','fax_interaction_has_tags','it.FaxInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','Tag','UserId','body','start','compact','isEmpty','forEach','FaxAccountId','i.FaxAccountId\x20IN\x20?','concat','createdAt','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','replace','isNumeric','i.id\x20LIKE\x20?','i.fax\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','Sequelize','SELECT','clone','i.id','unreadMessages','t.id\x20IN\x20?','resolve','journey','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','getFaxAccounts','i.FaxAccountId\x20IS\x20NULL','sequelize','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','Account.key','Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','toString','FaxInteractionId','all','rows','catch','params','includeAll','include','options','create','addMessage','FaxMessage','getMessages','findOne','filter','YYYY-MM-DD\x20HH:mm:ss','addTags','setTags','ids','omit','spread','findAll','emit','faxInteractionTags:save','removeTags','unix','join','root','server','files','format','transcript-%d-%s.zip','Attachment','Messages','get','mkdirSync','basename','existsSync','createReadStream','pipe','createWriteStream','download','log','err','zip-dir','fast-json-patch','bluebird','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','status','end','json','count','offset','limit','set','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','Users','map','fullname'];(function(_0x20c8f6,_0x44c08b){var _0x2d17b9=function(_0x3c5343){while(--_0x3c5343){_0x20c8f6['push'](_0x20c8f6['shift']());}};_0x2d17b9(++_0x44c08b);}(_0x61cd,0xa3));var _0xd61c=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x61cd[_0x2c91e9];return _0x13f0ff;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xd61c('0x0'));var jsonpatch=require(_0xd61c('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xd61c('0x2'));var Mustache=require('mustache');var util=require('util');var path=require(_0xd61c('0x3'));var sox=require(_0xd61c('0x4'));var csv=require('to-csv');var ejs=require(_0xd61c('0x5'));var fs=require('fs');var _=require(_0xd61c('0x6'));var squel=require(_0xd61c('0x7'));var crypto=require(_0xd61c('0x8'));var jsforce=require(_0xd61c('0x9'));var deskjs=require(_0xd61c('0xa'));var toCsv=require(_0xd61c('0xb'));var querystring=require(_0xd61c('0xc'));var Papa=require('papaparse');var Redis=require(_0xd61c('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xd61c('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd61c('0xf'));var logger=require(_0xd61c('0x10'))('api');var utils=require(_0xd61c('0x11'));var config=require(_0xd61c('0x12'));var db=require(_0xd61c('0x13'))['db'];config[_0xd61c('0x14')]=_[_0xd61c('0x15')](config['redis'],{'host':_0xd61c('0x16'),'port':0x18eb});var socket=require(_0xd61c('0x17'))(new Redis(config[_0xd61c('0x14')]));require(_0xd61c('0x18'))[_0xd61c('0x19')](socket);function respondWithStatusCode(_0x4c5d47,_0x8d447b){_0x8d447b=_0x8d447b||0xcc;return function(_0x238d03){if(_0x238d03){return _0x4c5d47['sendStatus'](_0x8d447b);}return _0x4c5d47[_0xd61c('0x1a')](_0x8d447b)[_0xd61c('0x1b')]();};}function respondWithResult(_0x36aa70,_0xcd5ca1){_0xcd5ca1=_0xcd5ca1||0xc8;return function(_0x685642){if(_0x685642){return _0x36aa70[_0xd61c('0x1a')](_0xcd5ca1)[_0xd61c('0x1c')](_0x685642);}};}function respondWithFilteredResult(_0x57d376,_0x4aaae0){return function(_0x5d24b2){if(_0x5d24b2){var _0x495f35=_0x5d24b2[_0xd61c('0x1d')],_0x41b2ac=_0x4aaae0[_0xd61c('0x1e')],_0x23b5b1=_0x4aaae0[_0xd61c('0x1e')]+_0x4aaae0[_0xd61c('0x1f')],_0x18ea24;if(_0x23b5b1>=_0x495f35){_0x23b5b1=_0x495f35;_0x18ea24=0xc8;}else{_0x18ea24=0xce;}_0x57d376[_0xd61c('0x1a')](_0x18ea24);return _0x57d376[_0xd61c('0x20')]('Content-Range',_0x41b2ac+'-'+_0x23b5b1+'/'+_0x495f35)[_0xd61c('0x1c')](_0x5d24b2);}return null;};}function patchUpdates(_0x852135){return function(_0x4979eb){try{jsonpatch[_0xd61c('0x21')](_0x4979eb,_0x852135,!![]);}catch(_0x3bdf50){return BPromise[_0xd61c('0x22')](_0x3bdf50);}return _0x4979eb[_0xd61c('0x23')]();};}function saveUpdates(_0x40c9a6,_0x145ac7){return function(_0x4749bd){if(_0x4749bd){return _0x4749bd[_0xd61c('0x24')](_0x40c9a6)[_0xd61c('0x25')](function(_0x1b6712){return _0x1b6712;});}return null;};}function removeEntity(_0x4424b8,_0x2d44c6){return function(_0x33961a){if(_0x33961a){return _0x33961a[_0xd61c('0x26')]()[_0xd61c('0x25')](function(){_0x4424b8['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xa8eda3,_0x137433){return function(_0x27ab75){if(!_0x27ab75){_0xa8eda3[_0xd61c('0x27')](0x194);}return _0x27ab75;};}function handleError(_0x37df77,_0x463f31){_0x463f31=_0x463f31||0x1f4;return function(_0x1c1d4f){logger[_0xd61c('0x28')](_0x1c1d4f[_0xd61c('0x29')]);if(_0x1c1d4f[_0xd61c('0x2a')]){delete _0x1c1d4f[_0xd61c('0x2a')];}_0x37df77[_0xd61c('0x1a')](_0x463f31)[_0xd61c('0x2b')](_0x1c1d4f);};}function getInteractionUsers(_0x1d2d1a,_0x4a0cff){return new BPromise(function(_0x16c090,_0x1938d3){try{if(_0x4a0cff[_0x1d2d1a['id']]){_0x1d2d1a[_0xd61c('0x2c')]=_[_0xd61c('0x2d')](_0x4a0cff[_0x1d2d1a['id']],function(_0x4126af){return{'id':_0x4126af['id'],'fullname':_0x4126af[_0xd61c('0x2e')]};});}}catch(_0x208312){_0x1938d3(_0x208312);}_0x16c090(_0x1d2d1a);});}function getInteractionTags(_0x163c3d,_0x5b43b3){return new BPromise(function(_0x2f8440,_0x47373d){try{if(_0x163c3d[_0xd61c('0x2f')]){_0x163c3d[_0xd61c('0x30')]=[];_0x163c3d['TagIds'][_0xd61c('0x31')](',')['forEach'](function(_0x55a46b){_0x163c3d[_0xd61c('0x30')][_0xd61c('0x32')](_0x5b43b3[_0x55a46b]);});}delete _0x163c3d['TagIds'];}catch(_0xcfd4ca){_0x47373d(_0xcfd4ca);}_0x2f8440(_0x163c3d);});}function updateFaxInteraction(_0x55f633,_0x215f52,_0x183327){return new BPromise(function(_0x5dc278,_0x37a4c9){return getInteractionUsers(_0x55f633,_0x183327)[_0xd61c('0x25')](function(_0x4b758c){return getInteractionTags(_0x4b758c,_0x215f52);})[_0xd61c('0x25')](function(_0x2fb63c){_0x5dc278(_0x2fb63c);})['catch'](function(_0x70a6e6){_0x37a4c9(_0x70a6e6);});});}exports[_0xd61c('0x33')]=function(_0x9b5024,_0x2a9122){var _0x2b56e5={},_0x12d68a={},_0x7d9bba={'count':0x0,'rows':[]};var _0x5ee4b3=_['map'](db[_0xd61c('0x34')][_0xd61c('0x35')],function(_0x2a3e7a){return{'name':_0x2a3e7a['fieldName'],'type':_0x2a3e7a[_0xd61c('0x36')][_0xd61c('0x37')]};});_0x12d68a[_0xd61c('0x38')]=_['map'](_0x5ee4b3,'name');_0x12d68a[_0xd61c('0x39')]=_[_0xd61c('0x3a')](_0x9b5024[_0xd61c('0x39')]);_0x12d68a[_0xd61c('0x3b')]=_[_0xd61c('0x3c')](_0x12d68a[_0xd61c('0x38')],_0x12d68a['query']);_0x2b56e5['attributes']=_[_0xd61c('0x3c')](_0x12d68a[_0xd61c('0x38')],qs[_0xd61c('0x3d')](_0x9b5024[_0xd61c('0x39')][_0xd61c('0x3d')]));_0x2b56e5[_0xd61c('0x3e')]=_0x2b56e5[_0xd61c('0x3e')][_0xd61c('0x3f')]?_0x2b56e5['attributes']:_0x12d68a[_0xd61c('0x38')];if(!_0x9b5024[_0xd61c('0x39')][_0xd61c('0x40')](_0xd61c('0x41'))){_0x2b56e5[_0xd61c('0x1f')]=qs[_0xd61c('0x1f')](_0x9b5024['query']['limit']);_0x2b56e5[_0xd61c('0x1e')]=qs[_0xd61c('0x1e')](_0x9b5024[_0xd61c('0x39')][_0xd61c('0x1e')]);}_0x2b56e5[_0xd61c('0x42')]=qs['sort'](_0x9b5024[_0xd61c('0x39')][_0xd61c('0x43')]);_0x2b56e5[_0xd61c('0x44')]=qs[_0xd61c('0x3b')](_[_0xd61c('0x45')](_0x9b5024[_0xd61c('0x39')],_0x12d68a['filters']));var _0x1321b2=[];var _0x53b60d=squel['select']()[_0xd61c('0x46')]('id')[_0xd61c('0x46')](_0xd61c('0x2a'))['field'](_0xd61c('0x47'))[_0xd61c('0x48')]('tools_tags');var _0x14790d=squel['select']()['field'](_0xd61c('0x49'))[_0xd61c('0x46')](_0xd61c('0x4a'))[_0xd61c('0x46')]('ui.FaxInteractionId')[_0xd61c('0x48')]('user_has_fax_interactions','ui')[_0xd61c('0x4b')](_0xd61c('0x4c'),'u',_0xd61c('0x4d'));var _0x46e8c3=squel[_0xd61c('0x4e')]()[_0xd61c('0x48')](_0xd61c('0x4f'),'i')['left_join'](_0xd61c('0x50'),'c',_0xd61c('0x51'))[_0xd61c('0x4b')](_0xd61c('0x4c'),'o',_0xd61c('0x52'))['left_join'](_0xd61c('0x53'),'a','a.id\x20=\x20i.FaxAccountId')[_0xd61c('0x4b')](_0xd61c('0x54'),'me',_0xd61c('0x55'))[_0xd61c('0x4b')](_0xd61c('0x56'),'it',_0xd61c('0x57'))[_0xd61c('0x4b')](_0xd61c('0x58'),'t',_0xd61c('0x59'));var _0x45e006=squel[_0xd61c('0x5a')]();var _0x24107c=[];var _0x264392=squel['expr']();var _0x24f661;if(_0x9b5024['query'][_0xd61c('0x5b')]){_0x24f661=as[_0xd61c('0x5c')](_0x9b5024['query'][_0xd61c('0x5b')]);var _0x45131d=_0x24f661[_0xd61c('0x5d')];for(var _0x47d5b2=0x0;_0x47d5b2<_0x24f661[_0xd61c('0x5e')][_0xd61c('0x3f')];_0x47d5b2++){var _0x5d2d83=_0x24f661[_0xd61c('0x5e')][_0x47d5b2];var _0x289b8f='i';var _0x2a5552=_[_0xd61c('0x5f')](_0x5ee4b3,['name',_0x5d2d83[_0xd61c('0x46')]]);if(!_0x2a5552){switch(_0x5d2d83[_0xd61c('0x46')]){case'unreadMessages':if(_0x5d2d83[_0xd61c('0x60')]==0x1){_0x46e8c3[_0xd61c('0x61')]('`'+_0x5d2d83[_0xd61c('0x46')]+_0xd61c('0x62'));}else{_0x46e8c3['having']('`'+_0x5d2d83[_0xd61c('0x46')]+_0xd61c('0x63'));}break;case _0xd61c('0x64'):if(_0x5d2d83[_0xd61c('0x65')]===_0xd61c('0x66')){if(_0x5d2d83[_0xd61c('0x60')][_0xd61c('0x31')]('\x20')['length']>0x1){_0x45e006[_0x45131d]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x5d2d83[_0xd61c('0x60')]),null);}else{var _0x582c76='%'+_0x5d2d83[_0xd61c('0x60')]+'%';_0x45e006[_0x45131d](_0xd61c('0x67'),_0x582c76,_0x582c76,_0x582c76);}}else{_0x2a5552=_[_0xd61c('0x5f')](_0x5ee4b3,['name',_0xd61c('0x68')]);_0x5d2d83[_0xd61c('0x46')]='ContactId';_0x284f90=as[_0xd61c('0x69')](_0x289b8f,_0x2a5552[_0xd61c('0x36')],_0x5d2d83);_0x45e006[_0x45131d](_0x284f90[_0xd61c('0x6a')],_0x284f90[_0xd61c('0x60')]['start'],_0x284f90[_0xd61c('0x60')][_0xd61c('0x1b')]);}break;case _0xd61c('0x6b'):var _0x3e39db=_0x5d2d83[_0xd61c('0x60')]['split'](',')['map'](function(_0x18c016){return Number(_0x18c016);});_0x3e39db['forEach'](function(_0x11813a){_0x264392['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x11813a+',%');});_0x24107c=_['union'](_0x24107c,_0x3e39db);break;case'User':if(_0x5d2d83[_0xd61c('0x65')]==='$substring'){_0x45e006[_0x45131d]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x5d2d83[_0xd61c('0x60')]+'%',null);}else{_0x2a5552=_[_0xd61c('0x5f')](_0x5ee4b3,[_0xd61c('0x2a'),_0xd61c('0x6c')]);_0x5d2d83['field']=_0xd61c('0x6c');_0x284f90=as['buildExpression'](_0x289b8f,_0x2a5552[_0xd61c('0x36')],_0x5d2d83);_0x45e006[_0x45131d](_0x284f90[_0xd61c('0x6a')],_0x284f90['value']['start'],_0x284f90[_0xd61c('0x60')][_0xd61c('0x1b')]);}break;case _0xd61c('0x6d'):_0x284f90=as[_0xd61c('0x69')]('me',null,_0x5d2d83);_0x45e006[_0x45131d](_0x284f90['text'],_0x284f90[_0xd61c('0x60')]['start'],_0x284f90[_0xd61c('0x60')][_0xd61c('0x1b')]);break;}}else{var _0x284f90=as['buildExpression'](_0x289b8f,_0x2a5552[_0xd61c('0x36')],_0x5d2d83);_0x45e006[_0x45131d](_0x284f90[_0xd61c('0x6a')],_0x284f90[_0xd61c('0x60')][_0xd61c('0x6e')],_0x284f90[_0xd61c('0x60')][_0xd61c('0x1b')]);}}}else{var _0x274b51=_(_0x9b5024['query'])[_0xd61c('0x3a')]()['map'](function(_0x47da90){return _['some'](_0x5ee4b3,[_0xd61c('0x2a'),_0x47da90])?_0x47da90:undefined;})[_0xd61c('0x6f')]()[_0xd61c('0x60')]();if(!_[_0xd61c('0x70')](_0x274b51)){_0x274b51[_0xd61c('0x71')](function(_0x538de3){if(_0x538de3===_0xd61c('0x72')){_0x46e8c3[_0xd61c('0x44')](_0xd61c('0x73'),[][_0xd61c('0x74')](_0x9b5024['query'][_0x538de3]));}else if(_0x538de3===_0xd61c('0x75')){var _0x38d4e8=JSON[_0xd61c('0x76')](_0x9b5024[_0xd61c('0x39')][_0x538de3])[_0xd61c('0x77')];var _0x18e3a3=JSON['parse'](_0x9b5024[_0xd61c('0x39')][_0x538de3])['$lte'];_0x46e8c3[_0xd61c('0x44')](_0xd61c('0x78'),_0x38d4e8,_0x18e3a3);}else{if(_0x9b5024[_0xd61c('0x39')][_0x538de3]===_0xd61c('0x79')){_0x46e8c3[_0xd61c('0x44')]('i.'+_0x538de3+_0xd61c('0x7a'));}else{_0x46e8c3[_0xd61c('0x44')]('i.'+_0x538de3+_0xd61c('0x7b'),_0x9b5024[_0xd61c('0x39')][_0x538de3]);}}});}if(_0x9b5024[_0xd61c('0x39')][_0xd61c('0x7c')]){if(_0x9b5024[_0xd61c('0x39')][_0xd61c('0x7c')]==0x1){_0x46e8c3[_0xd61c('0x61')]('`unreadMessages`\x20=\x200');}else{_0x46e8c3[_0xd61c('0x61')](_0xd61c('0x7d'));}}if(_0x9b5024['query'][_0xd61c('0x7e')]){_0x24107c=_[_0xd61c('0x7f')](_0x9b5024[_0xd61c('0x39')]['tag'])?_0x9b5024['query']['tag']:new Array(_0x9b5024[_0xd61c('0x39')]['tag']);_0x24107c[_0xd61c('0x71')](function(_0x22e38c){_0x264392['or'](_0xd61c('0x80'),'%,'+_0x22e38c+',%');});}if(_0x9b5024[_0xd61c('0x39')]['filter']){var _0x55209d=_0x9b5024[_0xd61c('0x39')]['filter'][_0xd61c('0x81')]('\x5c','\x5c\x5c')[_0xd61c('0x81')]('\x27\x27','\x27\x27\x27\x27');if(qs[_0xd61c('0x82')](_0x55209d)){_0x45e006['or'](_0xd61c('0x83'),_0x55209d+'%')['or'](_0xd61c('0x84'),_0x55209d+'%');}_0x45e006['or'](_0xd61c('0x85'),_0x55209d+'%');}}_0x46e8c3['where'](_0x45e006);_0x46e8c3['group']('i.id');var _0x8ea690={'type':db[_0xd61c('0x86')]['QueryTypes'][_0xd61c('0x87')],'raw':!![]};var _0x6f0c2=_0x46e8c3[_0xd61c('0x88')]();_0x6f0c2[_0xd61c('0x46')](_0xd61c('0x89'));_0x6f0c2[_0xd61c('0x46')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xd61c('0x8a'));if(_0x2b56e5['order']){_0x2b56e5[_0xd61c('0x42')][_0xd61c('0x71')](function(_0x45a35a){_0x46e8c3['order']('i.'+_0x45a35a[0x0],_0x45a35a[0x1]==='DESC'?![]:!![]);});}if(!_[_0xd61c('0x70')](_0x24107c)){_0x46e8c3['having'](_0x264392);_0x6f0c2[_0xd61c('0x44')](_0xd61c('0x8b'),_0x24107c);}BPromise[_0xd61c('0x8c')]()[_0xd61c('0x25')](function(){if(!_0x24f661){if(_0x9b5024['query'][_0xd61c('0x72')]||_0x9b5024['query'][_0xd61c('0x8d')])return;_0x6f0c2['where'](_0xd61c('0x8e'));_0x46e8c3[_0xd61c('0x44')]('i.FaxAccountId\x20IS\x20NOT\x20NULL');return;}return _0x9b5024[_0xd61c('0x8f')][_0xd61c('0x90')]({'attributes':['id'],'raw':!![]})[_0xd61c('0x25')](function(_0x3917ab){if(_['isEmpty'](_0x3917ab)){_0x6f0c2['where'](_0xd61c('0x91'));_0x46e8c3['where'](_0xd61c('0x91'));}else{_0x6f0c2[_0xd61c('0x44')](_0xd61c('0x73'),_['map'](_0x3917ab,'id'));_0x46e8c3[_0xd61c('0x44')]('i.FaxAccountId\x20IN\x20?',_[_0xd61c('0x2d')](_0x3917ab,'id'));}});})[_0xd61c('0x25')](function(){db[_0xd61c('0x92')][_0xd61c('0x39')](_0x6f0c2['toString'](),_0x8ea690)['then'](function(_0x6b3d68){_0x7d9bba[_0xd61c('0x1d')]=_0x6b3d68[_0xd61c('0x3f')];if(_0x7d9bba[_0xd61c('0x1d')]===0x0)return[];return db[_0xd61c('0x92')][_0xd61c('0x39')](_0x53b60d['toString'](),_0x8ea690)['then'](function(_0x36912a){_0x1321b2=_['keyBy'](_0x36912a,'id');_0x8ea690=_[_0xd61c('0x93')](_0x8ea690,{'model':db['FaxInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x9b5024[_0xd61c('0x39')][_0xd61c('0x3d')]){_0x2b56e5['attributes']['forEach'](function(_0x4a6cac){_0x46e8c3['field']('i.'+_0x4a6cac);});}else{_0x46e8c3[_0xd61c('0x46')](_0xd61c('0x94'),_0xd61c('0x8a'));_0x46e8c3[_0xd61c('0x46')]('a.key',_0xd61c('0x95'));_0x46e8c3['field']('a.mandatoryDisposition',_0xd61c('0x96'));_0x46e8c3['field'](_0xd61c('0x97'));_0x46e8c3['field'](_0xd61c('0x98'),_0xd61c('0x99'));_0x46e8c3[_0xd61c('0x46')](_0xd61c('0x9a'),_0xd61c('0x9b'));_0x46e8c3['field']('c.email',_0xd61c('0x9c'));_0x46e8c3[_0xd61c('0x46')](_0xd61c('0x9d'),_0xd61c('0x9e'));_0x46e8c3['field'](_0xd61c('0x9f'),_0xd61c('0xa0'));_0x46e8c3[_0xd61c('0x46')]('c.fax',_0xd61c('0xa1'));_0x46e8c3['field'](_0xd61c('0xa2'),_0xd61c('0xa3'));_0x46e8c3[_0xd61c('0x46')](_0xd61c('0xa4'),_0xd61c('0xa5'));_0x46e8c3[_0xd61c('0x46')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0xd61c('0x2f'));}_0x46e8c3[_0xd61c('0x1f')](_0x2b56e5[_0xd61c('0x1f')]);_0x46e8c3['offset'](_0x2b56e5['offset']);return db[_0xd61c('0x92')][_0xd61c('0x39')](_0x46e8c3[_0xd61c('0xa6')](),_0x8ea690);})[_0xd61c('0x25')](function(_0x4a2cfd){_0x14790d[_0xd61c('0x44')]('ui.FaxInteractionId\x20IN\x20?',_[_0xd61c('0x2d')](_0x4a2cfd,'id'));return db[_0xd61c('0x92')][_0xd61c('0x39')](_0x14790d[_0xd61c('0xa6')](),_0x8ea690)[_0xd61c('0x25')](function(_0x1dedb){var _0x1adae4=_['groupBy'](_0x1dedb,_0xd61c('0xa7'));var _0x116818=[];_0x4a2cfd[_0xd61c('0x71')](function(_0x4b66bc){_0x116818[_0xd61c('0x32')](updateFaxInteraction(_0x4b66bc,_0x1321b2,_0x1adae4));});return BPromise[_0xd61c('0xa8')](_0x116818);});});})['then'](function(_0x5378ca){_0x7d9bba[_0xd61c('0xa9')]=_0x5378ca;return _0x7d9bba;})[_0xd61c('0x25')](respondWithFilteredResult(_0x2a9122,_0x2b56e5));})[_0xd61c('0xaa')](handleError(_0x2a9122,null));};exports['show']=function(_0x7fdb19,_0xe94997){var _0x37170f={'raw':![],'where':{'id':_0x7fdb19[_0xd61c('0xab')]['id']}},_0x126d16={};_0x126d16['model']=_['keys'](db[_0xd61c('0x34')][_0xd61c('0x35')]);_0x126d16[_0xd61c('0x39')]=_['keys'](_0x7fdb19[_0xd61c('0x39')]);_0x126d16[_0xd61c('0x3b')]=_['intersection'](_0x126d16['model'],_0x126d16['query']);_0x37170f[_0xd61c('0x3e')]=_[_0xd61c('0x3c')](_0x126d16[_0xd61c('0x38')],qs[_0xd61c('0x3d')](_0x7fdb19[_0xd61c('0x39')][_0xd61c('0x3d')]));_0x37170f[_0xd61c('0x3e')]=_0x37170f[_0xd61c('0x3e')]['length']?_0x37170f[_0xd61c('0x3e')]:_0x126d16[_0xd61c('0x38')];if(_0x7fdb19['query'][_0xd61c('0xac')]){_0x37170f[_0xd61c('0xad')]=[{'all':!![]}];}_0x37170f=_[_0xd61c('0x93')]({},_0x37170f,_0x7fdb19[_0xd61c('0xae')]);return db[_0xd61c('0x34')][_0xd61c('0x5f')](_0x37170f)[_0xd61c('0x25')](handleEntityNotFound(_0xe94997,null))['then'](respondWithResult(_0xe94997,null))[_0xd61c('0xaa')](handleError(_0xe94997,null));};exports['create']=function(_0x4c1a03,_0x352453){return db[_0xd61c('0x34')][_0xd61c('0xaf')](_0x4c1a03[_0xd61c('0x6d')],{})[_0xd61c('0x25')](respondWithResult(_0x352453,0xc9))['catch'](handleError(_0x352453,null));};exports[_0xd61c('0x24')]=function(_0x3d8816,_0x3312d9){if(_0x3d8816['body']['id']){delete _0x3d8816[_0xd61c('0x6d')]['id'];}return db[_0xd61c('0x34')][_0xd61c('0x5f')]({'where':{'id':_0x3d8816[_0xd61c('0xab')]['id']}})['then'](handleEntityNotFound(_0x3312d9,null))[_0xd61c('0x25')](saveUpdates(_0x3d8816[_0xd61c('0x6d')],null))[_0xd61c('0x25')](respondWithResult(_0x3312d9,null))[_0xd61c('0xaa')](handleError(_0x3312d9,null));};exports[_0xd61c('0x26')]=function(_0x263fe1,_0x1bc017){return db['FaxInteraction'][_0xd61c('0x5f')]({'where':{'id':_0x263fe1[_0xd61c('0xab')]['id']}})[_0xd61c('0x25')](handleEntityNotFound(_0x1bc017,null))[_0xd61c('0x25')](removeEntity(_0x1bc017,null))[_0xd61c('0xaa')](handleError(_0x1bc017,null));};exports['describe']=function(_0x1f3ea1,_0x11c24c){return db[_0xd61c('0x34')]['describe']()['then'](respondWithResult(_0x11c24c,null))[_0xd61c('0xaa')](handleError(_0x11c24c,null));};exports[_0xd61c('0xb0')]=function(_0x1f9e61,_0x1f377b,_0xe15863){return db[_0xd61c('0xb1')][_0xd61c('0x5f')]({'where':{'id':_0x1f9e61[_0xd61c('0xab')]['id']}})[_0xd61c('0x25')](handleEntityNotFound(_0x1f377b,null))['then'](function(_0x2c4ad8){if(_0x2c4ad8){return _0x2c4ad8[_0xd61c('0xb0')](_0x1f9e61[_0xd61c('0x6d')]['ids'],_['omit'](_0x1f9e61[_0xd61c('0x6d')],['ids','id'])||{});}})[_0xd61c('0x25')](respondWithResult(_0x1f377b,null))['catch'](handleError(_0x1f377b,null));};exports[_0xd61c('0xb2')]=function(_0x3c1539,_0x28fb44,_0x12ce78){var _0x1a5f88={'raw':![],'where':{}};var _0x1eabaf={};var _0x58b09f={'count':0x0,'rows':[]};return db[_0xd61c('0x34')][_0xd61c('0xb3')]({'where':{'id':_0x3c1539[_0xd61c('0xab')]['id']}})[_0xd61c('0x25')](handleEntityNotFound(_0x28fb44,null))['then'](function(_0xccfb5a){if(_0xccfb5a){_0x1eabaf[_0xd61c('0x38')]=_[_0xd61c('0x3a')](db[_0xd61c('0xb1')][_0xd61c('0x35')]);_0x1eabaf[_0xd61c('0x39')]=_[_0xd61c('0x3a')](_0x3c1539[_0xd61c('0x39')]);_0x1eabaf[_0xd61c('0x3b')]=_[_0xd61c('0x3c')](_0x1eabaf['model'],_0x1eabaf[_0xd61c('0x39')]);_0x1a5f88[_0xd61c('0x3e')]=_[_0xd61c('0x3c')](_0x1eabaf[_0xd61c('0x38')],qs[_0xd61c('0x3d')](_0x3c1539['query'][_0xd61c('0x3d')]));_0x1a5f88[_0xd61c('0x3e')]=_0x1a5f88[_0xd61c('0x3e')][_0xd61c('0x3f')]?_0x1a5f88[_0xd61c('0x3e')]:_0x1eabaf[_0xd61c('0x38')];if(!_0x3c1539[_0xd61c('0x39')][_0xd61c('0x40')](_0xd61c('0x41'))){_0x1a5f88[_0xd61c('0x1f')]=qs['limit'](_0x3c1539['query'][_0xd61c('0x1f')]);_0x1a5f88['offset']=qs[_0xd61c('0x1e')](_0x3c1539[_0xd61c('0x39')][_0xd61c('0x1e')]);}_0x1a5f88[_0xd61c('0x42')]=qs[_0xd61c('0x43')](_0x3c1539[_0xd61c('0x39')]['sort']);_0x1a5f88[_0xd61c('0x44')]=qs[_0xd61c('0x3b')](_['pick'](_0x3c1539[_0xd61c('0x39')],_0x1eabaf[_0xd61c('0x3b')]));_0x1a5f88[_0xd61c('0x44')][_0xd61c('0xa7')]=_0xccfb5a['id'];if(_0x3c1539[_0xd61c('0x39')][_0xd61c('0xb4')]){_0x1a5f88[_0xd61c('0x44')]=_[_0xd61c('0x93')](_0x1a5f88[_0xd61c('0x44')],{'$or':_['map'](_0x1a5f88[_0xd61c('0x3e')],function(_0x2fa5dc){var _0x134a0c={};_0x134a0c[_0x2fa5dc]={'$like':'%'+_0x3c1539[_0xd61c('0x39')][_0xd61c('0xb4')]+'%'};return _0x134a0c;})});}if(_0x3c1539[_0xd61c('0x39')][_0xd61c('0x77')]){var _0x4c787b=_0x3c1539[_0xd61c('0x39')][_0xd61c('0x77')][_0xd61c('0x31')](',');var _0x27d061={};_0x27d061[_0x4c787b[0x0]]={'$gte':moment(_0x4c787b[0x1])['format'](_0xd61c('0xb5'))};_0x1a5f88[_0xd61c('0x44')]=_['merge'](_0x1a5f88[_0xd61c('0x44')],_0x27d061);}_0x1a5f88=_[_0xd61c('0x93')]({},_0x1a5f88,_0x3c1539[_0xd61c('0xae')]);return db['FaxMessage'][_0xd61c('0x1d')]({'where':_0x1a5f88[_0xd61c('0x44')]})[_0xd61c('0x25')](function(_0x5b3782){_0x58b09f[_0xd61c('0x1d')]=_0x5b3782;if(_0x3c1539[_0xd61c('0x39')][_0xd61c('0xac')]){_0x1a5f88[_0xd61c('0xad')]=[{'all':!![]}];}return db[_0xd61c('0xb1')]['findAll'](_0x1a5f88);})[_0xd61c('0x25')](function(_0x1794dd){_0x58b09f[_0xd61c('0xa9')]=_0x1794dd;return _0x58b09f;});}})['then'](respondWithFilteredResult(_0x28fb44,_0x1a5f88))[_0xd61c('0xaa')](handleError(_0x28fb44,null));};exports[_0xd61c('0xb6')]=function(_0x49052d,_0x296bf6,_0x4ca647){return db[_0xd61c('0x34')][_0xd61c('0x5f')]({'where':{'id':_0x49052d['params']['id']}})[_0xd61c('0x25')](handleEntityNotFound(_0x296bf6,null))[_0xd61c('0x25')](function(_0x17a4c3){if(_0x17a4c3){return _0x17a4c3[_0xd61c('0xb7')](_0x49052d[_0xd61c('0x6d')][_0xd61c('0xb8')],_[_0xd61c('0xb9')](_0x49052d[_0xd61c('0x6d')],[_0xd61c('0xb8'),'id'])||{})[_0xd61c('0xba')](function(){return db[_0xd61c('0x6b')][_0xd61c('0xbb')]({'attributes':['id',_0xd61c('0x2a'),_0xd61c('0x47')],'where':{'id':_0x49052d[_0xd61c('0x6d')]['ids']}});})['then'](function(_0x32333a){socket[_0xd61c('0xbc')](_0xd61c('0xbd'),{'id':Number(_0x49052d[_0xd61c('0xab')]['id']),'tags':_0x32333a||[]});return{'id':Number(_0x49052d[_0xd61c('0xab')]['id']),'tags':_0x32333a||[]};});}})[_0xd61c('0x25')](respondWithResult(_0x296bf6,null))['catch'](handleError(_0x296bf6,null));};exports[_0xd61c('0xbe')]=function(_0x1133f2,_0x58897f,_0x5ce834){return db[_0xd61c('0x34')][_0xd61c('0x5f')]({'where':{'id':_0x1133f2[_0xd61c('0xab')]['id']}})[_0xd61c('0x25')](handleEntityNotFound(_0x58897f,null))[_0xd61c('0x25')](function(_0x4ee680){if(_0x4ee680){return _0x4ee680['removeTags'](_0x1133f2[_0xd61c('0x39')][_0xd61c('0xb8')]);}})['then'](respondWithStatusCode(_0x58897f,null))[_0xd61c('0xaa')](handleError(_0x58897f,null));};exports['download']=function(_0x5900ea,_0x320263){var _0x487718=moment()[_0xd61c('0xbf')]()['toString']();var _0x203deb=path[_0xd61c('0xc0')](config[_0xd61c('0xc1')],_0xd61c('0xc2'),_0xd61c('0xc3'),'tmp');var _0x526d78=path[_0xd61c('0xc0')](config[_0xd61c('0xc1')],_0xd61c('0xc2'),_0xd61c('0xc3'),'attachments');var _0x705ede=path[_0xd61c('0xc0')](_0x203deb,_0x487718);var _0x4cf8c3=util[_0xd61c('0xc4')](_0xd61c('0xc5'),_0x5900ea[_0xd61c('0xab')]['id'],_0x487718);var _0x3b61f3=path[_0xd61c('0xc0')](_0x203deb,_0x4cf8c3);var _0x5295aa=[];_0x5295aa['push']({'model':db[_0xd61c('0xc6')],'as':_0xd61c('0xc6'),'raw':!![]});var _0x3c722a=[{'model':db['FaxMessage'],'as':_0xd61c('0xc7'),'attributes':['id',_0xd61c('0x6d'),_0xd61c('0x75')],'include':_0x5295aa}];return db['FaxInteraction'][_0xd61c('0x5f')]({'where':{'id':_0x5900ea[_0xd61c('0xab')]['id']},'include':_0x3c722a})[_0xd61c('0x25')](handleEntityNotFound(_0x320263,null))[_0xd61c('0x25')](function(_0x982d3){if(_0x982d3&&_0x982d3[_0xd61c('0xc7')]){var _0x3c540d=_0x982d3[_0xd61c('0xc8')]({'plain':!![]});fs[_0xd61c('0xc9')](_0x705ede);for(var _0x4d9050=0x0;_0x4d9050<_0x3c540d[_0xd61c('0xc7')][_0xd61c('0x3f')];_0x4d9050++){var _0x42b5af=_0x3c540d[_0xd61c('0xc7')][_0x4d9050]['Attachment'];if(_0x42b5af){var _0x3fb8b0=path[_0xd61c('0xc0')](_0x526d78,_0x42b5af[_0xd61c('0xca')]);if(fs[_0xd61c('0xcb')](_0x3fb8b0)){fs[_0xd61c('0xcc')](_0x3fb8b0)[_0xd61c('0xcd')](fs[_0xd61c('0xce')](path[_0xd61c('0xc0')](_0x705ede,_0x42b5af[_0xd61c('0xca')])));}}}return BPromise[_0xd61c('0x8c')]()[_0xd61c('0x25')](function(){return new BPromise(function(_0x4be383,_0x26dba1){zipdir(_0x705ede,{'saveTo':_0x3b61f3},function(_0x65fa38,_0x33ea15){if(_0x65fa38)return _0x26dba1(_0x65fa38);return _0x4be383(_0x33ea15);});})['then'](function(){return new BPromise(function(_0x43c03e,_0xc1cd3d){rimraf(_0x705ede,function(_0x5d5695){if(_0x5d5695)_0xc1cd3d(_0x5d5695);return _0x43c03e();});});})['then'](function(){return _0x320263[_0xd61c('0xcf')](_0x3b61f3,_0x4cf8c3,function(_0x590edd){if(_0x590edd){console[_0xd61c('0xd0')](_0xd61c('0xd1'),_0x590edd);}else{fs['unlinkSync'](_0x3b61f3);}});});});}else{return _0x320263[_0xd61c('0x27')](0xc8);}})[_0xd61c('0xaa')](handleError(_0x320263,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 46f3a64..e98f2ea 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 _0x7a54=['setDataValue','map','length','catch','hasOwnProperty','hook','exports','events','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','update','remove','getUsers'];(function(_0x420f17,_0x4eb527){var _0x393bce=function(_0x2fb594){while(--_0x2fb594){_0x420f17['push'](_0x420f17['shift']());}};_0x393bce(++_0x4eb527);}(_0x7a54,0x106));var _0x47a5=function(_0x2ccb50,_0x1993fb){_0x2ccb50=_0x2ccb50-0x0;var _0x4c250d=_0x7a54[_0x2ccb50];return _0x4c250d;};'use strict';var EventEmitter=require(_0x47a5('0x0'));var FaxInteraction=require(_0x47a5('0x1'))['db'][_0x47a5('0x2')];var FaxMessage=require('../../mysqldb')['db'][_0x47a5('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x47a5('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0x47a5('0x5'),'afterDestroy':_0x47a5('0x6')};function emitEvent(_0x2a1a7e){return function(_0x3717e1,_0xfdf934,_0x545a97){_0x3717e1[_0x47a5('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x343372){_0x3717e1[_0x47a5('0x8')]('Users',_0x343372[_0x47a5('0x9')](function(_0x5077f3){return{'id':_0x5077f3['id']};}));return FaxMessage['findAll']({'where':{'FaxInteractionId':_0x3717e1['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x2a0e98){_0x3717e1[_0x47a5('0x8')]('unreadMessages',_0x2a0e98[_0x47a5('0xa')]);FaxInteractionEvents['emit'](_0x2a1a7e+':'+_0x3717e1['id'],_0x3717e1);FaxInteractionEvents['emit'](_0x2a1a7e,_0x3717e1);_0x545a97(null);})[_0x47a5('0xb')](_0x545a97(null));};}for(var e in events){if(events[_0x47a5('0xc')](e)){var event=events[e];FaxInteraction[_0x47a5('0xd')](e,emitEvent(event));}}module[_0x47a5('0xe')]=FaxInteractionEvents; \ No newline at end of file +var _0x814b=['then','Users','map','findAll','setDataValue','unreadMessages','length','emit','hasOwnProperty','exports','events','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','update','remove'];(function(_0x4f80a4,_0x21fbdb){var _0x5a1366=function(_0x1af6cb){while(--_0x1af6cb){_0x4f80a4['push'](_0x4f80a4['shift']());}};_0x5a1366(++_0x21fbdb);}(_0x814b,0x1a2));var _0xb814=function(_0x300c89,_0x25fcad){_0x300c89=_0x300c89-0x0;var _0x41762e=_0x814b[_0x300c89];return _0x41762e;};'use strict';var EventEmitter=require(_0xb814('0x0'));var FaxInteraction=require(_0xb814('0x1'))['db'][_0xb814('0x2')];var FaxMessage=require(_0xb814('0x1'))['db'][_0xb814('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xb814('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0xb814('0x5'),'afterDestroy':_0xb814('0x6')};function emitEvent(_0x258866){return function(_0x4237bc,_0x44931c,_0x322a70){_0x4237bc['getUsers']({'attributes':['id'],'raw':!![]})[_0xb814('0x7')](function(_0x2e6272){_0x4237bc['setDataValue'](_0xb814('0x8'),_0x2e6272[_0xb814('0x9')](function(_0x186d5a){return{'id':_0x186d5a['id']};}));return FaxMessage[_0xb814('0xa')]({'where':{'FaxInteractionId':_0x4237bc['id'],'direction':'in','read':![]},'raw':!![]});})[_0xb814('0x7')](function(_0x21d4a5){_0x4237bc[_0xb814('0xb')](_0xb814('0xc'),_0x21d4a5[_0xb814('0xd')]);FaxInteractionEvents[_0xb814('0xe')](_0x258866+':'+_0x4237bc['id'],_0x4237bc);FaxInteractionEvents[_0xb814('0xe')](_0x258866,_0x4237bc);_0x322a70(null);})['catch'](_0x322a70(null));};}for(var e in events){if(events[_0xb814('0xf')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0xb814('0x10')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index 4be845f..d87cb3f 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 _0xa76d=['../../config/environment','./faxInteraction.attributes','exports','define','FaxInteraction','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','rimraf'];(function(_0x2658c8,_0x5197a3){var _0x377f10=function(_0x59aab8){while(--_0x59aab8){_0x2658c8['push'](_0x2658c8['shift']());}};_0x377f10(++_0x5197a3);}(_0xa76d,0x89));var _0xda76=function(_0x1cd231,_0x43a0ee){_0x1cd231=_0x1cd231-0x0;var _0x2cc3bd=_0xa76d[_0x1cd231];return _0x2cc3bd;};'use strict';var _=require(_0xda76('0x0'));var util=require(_0xda76('0x1'));var logger=require(_0xda76('0x2'))(_0xda76('0x3'));var moment=require(_0xda76('0x4'));var BPromise=require(_0xda76('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xda76('0x6'));var config=require(_0xda76('0x7'));var attributes=require(_0xda76('0x8'));module[_0xda76('0x9')]=function(_0x2c1ce6,_0x2a8fc2){return _0x2c1ce6[_0xda76('0xa')](_0xda76('0xb'),attributes,{'tableName':'fax_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x387ed2,_0x2958d3,_0x2b5572){if(_0x387ed2['changed'](_0xda76('0xc'))){_0x387ed2[_0xda76('0xd')]=moment()[_0xda76('0xe')](_0xda76('0xf'));}_0x2b5572(null,_0x387ed2);}}});}; \ No newline at end of file +var _0xaf5a=['./faxInteraction.attributes','exports','FaxInteraction','fax_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment'];(function(_0x4a8617,_0x52353b){var _0x2b32c1=function(_0x2d94fa){while(--_0x2d94fa){_0x4a8617['push'](_0x4a8617['shift']());}};_0x2b32c1(++_0x52353b);}(_0xaf5a,0x17f));var _0xaaf5=function(_0x450f09,_0x59561d){_0x450f09=_0x450f09-0x0;var _0x4e22ec=_0xaf5a[_0x450f09];return _0x4e22ec;};'use strict';var _=require(_0xaaf5('0x0'));var util=require(_0xaaf5('0x1'));var logger=require(_0xaaf5('0x2'))(_0xaaf5('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xaaf5('0x4'));var fs=require('fs');var path=require(_0xaaf5('0x5'));var rimraf=require(_0xaaf5('0x6'));var config=require(_0xaaf5('0x7'));var attributes=require(_0xaaf5('0x8'));module[_0xaaf5('0x9')]=function(_0x474b76,_0x47304f){return _0x474b76['define'](_0xaaf5('0xa'),attributes,{'tableName':_0xaaf5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x40ad3d,_0x5be7e6,_0x5e1f40){if(_0x40ad3d[_0xaaf5('0xc')](_0xaaf5('0xd'))){_0x40ad3d[_0xaaf5('0xe')]=moment()[_0xaaf5('0xf')](_0xaaf5('0x10'));}_0x5e1f40(null,_0x40ad3d);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index 4f1cf92..fabc9e9 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 _0x691d=['request\x20sent','stringify','error','code','message','info','result','catch','UpdateFaxInteraction','update','options','attributes','limit','debug','AddTagsToFaxInteraction','FaxInteraction','find','where','addTags','body','ids','omit','spread','AddTags','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','FaxInteraction,\x20%s,\x20%s'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x691d,0x145));var _0xd691=function(_0x33fa3a,_0x44ebd4){_0x33fa3a=_0x33fa3a-0x0;var _0x2d454f=_0x691d[_0x33fa3a];return _0x2d454f;};'use strict';var _=require(_0xd691('0x0'));var util=require('util');var moment=require(_0xd691('0x1'));var BPromise=require('bluebird');var rs=require(_0xd691('0x2'));var fs=require('fs');var Redis=require(_0xd691('0x3'));var db=require(_0xd691('0x4'))['db'];var utils=require(_0xd691('0x5'));var logger=require(_0xd691('0x6'))(_0xd691('0x7'));var config=require(_0xd691('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd691('0x9')][_0xd691('0xa')]({'port':0x232a});config[_0xd691('0xb')]=_[_0xd691('0xc')](config[_0xd691('0xb')],{'host':_0xd691('0xd'),'port':0x18eb});var socket=require(_0xd691('0xe'))(new Redis(config[_0xd691('0xb')]));require('./faxInteraction.socket')[_0xd691('0xf')](socket);function respondWithRpcPromise(_0xe9e1b9,_0x2b299d,_0x57c402){return new BPromise(function(_0x218cac,_0x471679){return client[_0xd691('0x10')](_0xe9e1b9,_0x57c402)[_0xd691('0x11')](function(_0x599b22){logger['info'](_0xd691('0x12'),_0x2b299d,_0xd691('0x13'));logger['debug']('FaxInteraction,\x20%s,\x20%s,\x20%s',_0x2b299d,_0xd691('0x13'),JSON[_0xd691('0x14')](_0x599b22));if(_0x599b22[_0xd691('0x15')]){if(_0x599b22['error'][_0xd691('0x16')]===0x1f4){logger[_0xd691('0x15')](_0xd691('0x12'),_0x2b299d,_0x599b22[_0xd691('0x15')][_0xd691('0x17')]);return _0x471679(_0x599b22[_0xd691('0x15')][_0xd691('0x17')]);}logger[_0xd691('0x15')]('FaxInteraction,\x20%s,\x20%s',_0x2b299d,_0x599b22['error'][_0xd691('0x17')]);return _0x218cac(_0x599b22[_0xd691('0x15')][_0xd691('0x17')]);}else{logger[_0xd691('0x18')](_0xd691('0x12'),_0x2b299d,_0xd691('0x13'));_0x218cac(_0x599b22[_0xd691('0x19')]['message']);}})[_0xd691('0x1a')](function(_0x9ae61f){logger['error'](_0xd691('0x12'),_0x2b299d,_0x9ae61f);_0x471679(_0x9ae61f);});});}exports[_0xd691('0x1b')]=function(_0x4d2a41){var _0x275ac9=this;return new Promise(function(_0x2e6312,_0x1653b3){return db['FaxInteraction'][_0xd691('0x1c')](_0x4d2a41['body'],{'raw':_0x4d2a41['options']?_0x4d2a41['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4d2a41[_0xd691('0x1d')]?_0x4d2a41[_0xd691('0x1d')]['where']||null:null,'attributes':_0x4d2a41[_0xd691('0x1d')]?_0x4d2a41[_0xd691('0x1d')][_0xd691('0x1e')]||null:null,'limit':_0x4d2a41[_0xd691('0x1d')]?_0x4d2a41[_0xd691('0x1d')][_0xd691('0x1f')]||null:null})['then'](function(_0x2eec4b){logger['info'](_0xd691('0x1b'),_0x4d2a41);logger[_0xd691('0x20')](_0xd691('0x1b'),_0x4d2a41,JSON[_0xd691('0x14')](_0x2eec4b));_0x2e6312(_0x2eec4b);})['catch'](function(_0x2f38c8){logger[_0xd691('0x15')](_0xd691('0x1b'),_0x2f38c8[_0xd691('0x17')],_0x4d2a41);_0x1653b3(_0x275ac9[_0xd691('0x15')](0x1f4,_0x2f38c8[_0xd691('0x17')]));});});};exports[_0xd691('0x21')]=function(_0x195741){return new Promise(function(_0x1c42f2,_0x47606c){return db[_0xd691('0x22')][_0xd691('0x23')]({'where':_0x195741[_0xd691('0x1d')]?_0x195741[_0xd691('0x1d')][_0xd691('0x24')]||null:null})[_0xd691('0x11')](function(_0x15283f){if(_0x15283f){return _0x15283f[_0xd691('0x25')](_0x195741[_0xd691('0x26')][_0xd691('0x27')],_[_0xd691('0x28')](_0x195741['body'],['ids','id'])||{});}})[_0xd691('0x29')](function(_0x2d84a3){logger[_0xd691('0x18')](_0xd691('0x2a'),_0x195741);logger[_0xd691('0x20')](_0xd691('0x2a'),_0x195741,JSON['stringify'](_0x2d84a3));_0x1c42f2(_0x2d84a3);})[_0xd691('0x1a')](function(_0x2dd72e){logger[_0xd691('0x15')](_0xd691('0x2a'),_0x2dd72e[_0xd691('0x17')],_0x195741);_0x47606c(_this[_0xd691('0x15')](0x1f4,_0x2dd72e[_0xd691('0x17')]));});});}; \ No newline at end of file +var _0xce0a=['catch','AddTagsToFaxInteraction','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','FaxInteraction','update','body','options','raw','where','attributes','limit','UpdateFaxInteraction','debug'];(function(_0x4d8a8f,_0x2afd4c){var _0xfc4adc=function(_0xb89886){while(--_0xb89886){_0x4d8a8f['push'](_0x4d8a8f['shift']());}};_0xfc4adc(++_0x2afd4c);}(_0xce0a,0x157));var _0xace0=function(_0x1b76e6,_0x598520){_0x1b76e6=_0x1b76e6-0x0;var _0x333b53=_0xce0a[_0x1b76e6];return _0x333b53;};'use strict';var _=require(_0xace0('0x0'));var util=require(_0xace0('0x1'));var moment=require(_0xace0('0x2'));var BPromise=require(_0xace0('0x3'));var rs=require(_0xace0('0x4'));var fs=require('fs');var Redis=require(_0xace0('0x5'));var db=require(_0xace0('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xace0('0x7'))(_0xace0('0x8'));var config=require(_0xace0('0x9'));var jayson=require(_0xace0('0xa'));var client=jayson[_0xace0('0xb')][_0xace0('0xc')]({'port':0x232a});config[_0xace0('0xd')]=_['defaults'](config[_0xace0('0xd')],{'host':_0xace0('0xe'),'port':0x18eb});var socket=require(_0xace0('0xf'))(new Redis(config[_0xace0('0xd')]));require('./faxInteraction.socket')[_0xace0('0x10')](socket);function respondWithRpcPromise(_0x732686,_0x574d1f,_0x33e11a){return new BPromise(function(_0x13fbfd,_0x66a1d4){return client['request'](_0x732686,_0x33e11a)[_0xace0('0x11')](function(_0x2bcd01){logger[_0xace0('0x12')](_0xace0('0x13'),_0x574d1f,'request\x20sent');logger['debug']('FaxInteraction,\x20%s,\x20%s,\x20%s',_0x574d1f,_0xace0('0x14'),JSON[_0xace0('0x15')](_0x2bcd01));if(_0x2bcd01[_0xace0('0x16')]){if(_0x2bcd01[_0xace0('0x16')][_0xace0('0x17')]===0x1f4){logger['error'](_0xace0('0x13'),_0x574d1f,_0x2bcd01['error'][_0xace0('0x18')]);return _0x66a1d4(_0x2bcd01['error'][_0xace0('0x18')]);}logger[_0xace0('0x16')](_0xace0('0x13'),_0x574d1f,_0x2bcd01[_0xace0('0x16')][_0xace0('0x18')]);return _0x13fbfd(_0x2bcd01[_0xace0('0x16')][_0xace0('0x18')]);}else{logger[_0xace0('0x12')]('FaxInteraction,\x20%s,\x20%s',_0x574d1f,_0xace0('0x14'));_0x13fbfd(_0x2bcd01['result'][_0xace0('0x18')]);}})['catch'](function(_0xa29cac){logger['error'](_0xace0('0x13'),_0x574d1f,_0xa29cac);_0x66a1d4(_0xa29cac);});});}exports['UpdateFaxInteraction']=function(_0x5ebf2b){var _0x275397=this;return new Promise(function(_0x10701a,_0x409c69){return db[_0xace0('0x19')][_0xace0('0x1a')](_0x5ebf2b[_0xace0('0x1b')],{'raw':_0x5ebf2b[_0xace0('0x1c')]?_0x5ebf2b[_0xace0('0x1c')][_0xace0('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5ebf2b[_0xace0('0x1c')]?_0x5ebf2b[_0xace0('0x1c')][_0xace0('0x1e')]||null:null,'attributes':_0x5ebf2b['options']?_0x5ebf2b['options'][_0xace0('0x1f')]||null:null,'limit':_0x5ebf2b['options']?_0x5ebf2b[_0xace0('0x1c')][_0xace0('0x20')]||null:null})[_0xace0('0x11')](function(_0x4f72b2){logger['info'](_0xace0('0x21'),_0x5ebf2b);logger[_0xace0('0x22')](_0xace0('0x21'),_0x5ebf2b,JSON[_0xace0('0x15')](_0x4f72b2));_0x10701a(_0x4f72b2);})[_0xace0('0x23')](function(_0x2a4c50){logger[_0xace0('0x16')](_0xace0('0x21'),_0x2a4c50[_0xace0('0x18')],_0x5ebf2b);_0x409c69(_0x275397[_0xace0('0x16')](0x1f4,_0x2a4c50[_0xace0('0x18')]));});});};exports[_0xace0('0x24')]=function(_0x23faa2){return new Promise(function(_0x34455e,_0x171f8d){return db['FaxInteraction']['find']({'where':_0x23faa2[_0xace0('0x1c')]?_0x23faa2['options'][_0xace0('0x1e')]||null:null})[_0xace0('0x11')](function(_0x3b8ca2){if(_0x3b8ca2){return _0x3b8ca2[_0xace0('0x25')](_0x23faa2[_0xace0('0x1b')][_0xace0('0x26')],_[_0xace0('0x27')](_0x23faa2['body'],['ids','id'])||{});}})[_0xace0('0x28')](function(_0x1129de){logger['info'](_0xace0('0x29'),_0x23faa2);logger[_0xace0('0x22')]('AddTags',_0x23faa2,JSON[_0xace0('0x15')](_0x1129de));_0x34455e(_0x1129de);})['catch'](function(_0x491513){logger[_0xace0('0x16')]('AddTags',_0x491513[_0xace0('0x18')],_0x23faa2);_0x171f8d(_this[_0xace0('0x16')](0x1f4,_0x491513['message']));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 11e94ab..ff47988 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 _0x0c1f=['removeListener','register','length','faxInteraction:','./faxInteraction.events','save','update','emit'];(function(_0x118473,_0xbb29c){var _0x2634bb=function(_0x37a87b){while(--_0x37a87b){_0x118473['push'](_0x118473['shift']());}};_0x2634bb(++_0xbb29c);}(_0x0c1f,0xec));var _0xf0c1=function(_0x35027c,_0x4af623){_0x35027c=_0x35027c-0x0;var _0x4bba7d=_0x0c1f[_0x35027c];return _0x4bba7d;};'use strict';var FaxInteractionEvents=require(_0xf0c1('0x0'));var events=[_0xf0c1('0x1'),'remove',_0xf0c1('0x2')];function createListener(_0x41648b,_0x591f10){return function(_0x59189c){_0x591f10[_0xf0c1('0x3')](_0x41648b,_0x59189c);};}function removeListener(_0x3251fd,_0x3d8e32){return function(){FaxInteractionEvents[_0xf0c1('0x4')](_0x3251fd,_0x3d8e32);};}exports[_0xf0c1('0x5')]=function(_0x354eeb){for(var _0xbfc4c5=0x0,_0x33cffd=events[_0xf0c1('0x6')];_0xbfc4c5<_0x33cffd;_0xbfc4c5++){var _0x24e236=events[_0xbfc4c5];var _0x23f02e=createListener(_0xf0c1('0x7')+_0x24e236,_0x354eeb);FaxInteractionEvents['on'](_0x24e236,_0x23f02e);}}; \ No newline at end of file +var _0x792b=['register','length','./faxInteraction.events','remove','update','removeListener'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x792b,0x140));var _0xb792=function(_0x447725,_0x49753b){_0x447725=_0x447725-0x0;var _0x399167=_0x792b[_0x447725];return _0x399167;};'use strict';var FaxInteractionEvents=require(_0xb792('0x0'));var events=['save',_0xb792('0x1'),_0xb792('0x2')];function createListener(_0x6a8697,_0x59b872){return function(_0x16b7aa){_0x59b872['emit'](_0x6a8697,_0x16b7aa);};}function removeListener(_0x56c606,_0x1821da){return function(){FaxInteractionEvents[_0xb792('0x3')](_0x56c606,_0x1821da);};}exports[_0xb792('0x4')]=function(_0x49224b){for(var _0x17ac50=0x0,_0x13744b=events[_0xb792('0x5')];_0x17ac50<_0x13744b;_0x17ac50++){var _0x456b8c=events[_0x17ac50];var _0x2caef8=createListener('faxInteraction:'+_0x456b8c,_0x49224b);FaxInteractionEvents['on'](_0x456b8c,_0x2caef8);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 202ea64..e57c02d 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 _0xa09f=['create','post','addMessage','fax','addTags','/:id','faxinteraction:update','update','delete','tracked','faxinteraction:destroy','destroy','/:id/tags','removeTags','exports','multer','express','Router','../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','isAuthenticated','index','getMessages','/:id/download'];(function(_0x39fddc,_0x2e3041){var _0x4a3cc0=function(_0xb0ffc1){while(--_0xb0ffc1){_0x39fddc['push'](_0x39fddc['shift']());}};_0x4a3cc0(++_0x2e3041);}(_0xa09f,0xdf));var _0xfa09=function(_0xba8162,_0x2c9248){_0xba8162=_0xba8162-0x0;var _0x33c411=_0xa09f[_0xba8162];return _0x33c411;};'use strict';var multer=require(_0xfa09('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xfa09('0x1'));var router=express[_0xfa09('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0xfa09('0x3'));var config=require(_0xfa09('0x4'));var controller=require(_0xfa09('0x5'));router[_0xfa09('0x6')]('/',auth[_0xfa09('0x7')](),controller[_0xfa09('0x8')]);router[_0xfa09('0x6')]('/describe',auth[_0xfa09('0x7')](),controller['describe']);router['get']('/:id',auth[_0xfa09('0x7')](),controller['show']);router[_0xfa09('0x6')]('/:id/messages',auth[_0xfa09('0x7')](),controller[_0xfa09('0x9')]);router[_0xfa09('0x6')](_0xfa09('0xa'),auth[_0xfa09('0x7')](),controller['download']);router['post']('/',auth[_0xfa09('0x7')](),controller[_0xfa09('0xb')]);router[_0xfa09('0xc')]('/:id/messages',auth[_0xfa09('0x7')](),controller[_0xfa09('0xd')]);router['post']('/:id/tags',auth[_0xfa09('0x7')](),interaction['tracked'](_0xfa09('0xe'),'faxinteraction:addtags'),controller[_0xfa09('0xf')]);router['put'](_0xfa09('0x10'),auth[_0xfa09('0x7')](),interaction['tracked'](_0xfa09('0xe'),_0xfa09('0x11')),controller[_0xfa09('0x12')]);router[_0xfa09('0x13')](_0xfa09('0x10'),auth[_0xfa09('0x7')](),interaction[_0xfa09('0x14')](_0xfa09('0xe'),_0xfa09('0x15')),controller[_0xfa09('0x16')]);router[_0xfa09('0x13')](_0xfa09('0x17'),auth[_0xfa09('0x7')](),controller[_0xfa09('0x18')]);module[_0xfa09('0x19')]=router; \ No newline at end of file +var _0x7fa9=['destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/describe','isAuthenticated','/:id','show','/:id/messages','download','post','create','addMessage','/:id/tags','fax','faxinteraction:addtags','addTags','put','tracked','update','delete','faxinteraction:destroy'];(function(_0x43d50d,_0x192757){var _0xe623e7=function(_0x101c76){while(--_0x101c76){_0x43d50d['push'](_0x43d50d['shift']());}};_0xe623e7(++_0x192757);}(_0x7fa9,0x76));var _0x97fa=function(_0x34e1dc,_0x1e11ce){_0x34e1dc=_0x34e1dc-0x0;var _0x46b454=_0x7fa9[_0x34e1dc];return _0x46b454;};'use strict';var multer=require(_0x97fa('0x0'));var util=require('util');var path=require(_0x97fa('0x1'));var timeout=require(_0x97fa('0x2'));var express=require(_0x97fa('0x3'));var router=express[_0x97fa('0x4')]();var auth=require(_0x97fa('0x5'));var interaction=require(_0x97fa('0x6'));var config=require(_0x97fa('0x7'));var controller=require('./faxInteraction.controller');router[_0x97fa('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x97fa('0x9'),auth[_0x97fa('0xa')](),controller['describe']);router[_0x97fa('0x8')](_0x97fa('0xb'),auth[_0x97fa('0xa')](),controller[_0x97fa('0xc')]);router[_0x97fa('0x8')](_0x97fa('0xd'),auth[_0x97fa('0xa')](),controller['getMessages']);router[_0x97fa('0x8')]('/:id/download',auth['isAuthenticated'](),controller[_0x97fa('0xe')]);router[_0x97fa('0xf')]('/',auth['isAuthenticated'](),controller[_0x97fa('0x10')]);router['post'](_0x97fa('0xd'),auth[_0x97fa('0xa')](),controller[_0x97fa('0x11')]);router[_0x97fa('0xf')](_0x97fa('0x12'),auth['isAuthenticated'](),interaction['tracked'](_0x97fa('0x13'),_0x97fa('0x14')),controller[_0x97fa('0x15')]);router[_0x97fa('0x16')](_0x97fa('0xb'),auth['isAuthenticated'](),interaction[_0x97fa('0x17')](_0x97fa('0x13'),'faxinteraction:update'),controller[_0x97fa('0x18')]);router[_0x97fa('0x19')]('/:id',auth['isAuthenticated'](),interaction[_0x97fa('0x17')](_0x97fa('0x13'),_0x97fa('0x1a')),controller[_0x97fa('0x1b')]);router[_0x97fa('0x19')](_0x97fa('0x12'),auth[_0x97fa('0xa')](),controller['removeTags']);module[_0x97fa('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 641dbe6..3798e8a 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 _0x0572=['sequelize','exports','TEXT','BOOLEAN','ENUM','out','DATE'];(function(_0x3c7362,_0x14f4ce){var _0x1aeed6=function(_0x46e204){while(--_0x46e204){_0x3c7362['push'](_0x3c7362['shift']());}};_0x1aeed6(++_0x14f4ce);}(_0x0572,0x142));var _0x2057=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x0572[_0x199572];return _0x13cfa3;};'use strict';var Sequelize=require(_0x2057('0x0'));module[_0x2057('0x1')]={'body':{'type':Sequelize[_0x2057('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x2057('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x2057('0x4')]('in',_0x2057('0x5')),'defaultValue':_0x2057('0x5'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x2057('0x2')],'defaultValue':null},'readAt':{'type':Sequelize[_0x2057('0x6')]}}; \ No newline at end of file +var _0xb2e6=['BOOLEAN','ENUM','out','DATE','TEXT','medium'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xb2e6,0x148));var _0x6b2e=function(_0x4c92e2,_0xc99b58){_0x4c92e2=_0x4c92e2-0x0;var _0x466e66=_0xb2e6[_0x4c92e2];return _0x466e66;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0x6b2e('0x0')](_0x6b2e('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x6b2e('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x6b2e('0x3')]('in','out'),'defaultValue':_0x6b2e('0x4'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x6b2e('0x0')],'defaultValue':null},'readAt':{'type':Sequelize[_0x6b2e('0x5')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index a612eaa..1293188 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 _0xb10b=['read1stAt','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','manual','interface','channel','EventManager','acceptmessage','fax','agent','FaxInteractionId','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','event','create','Attachment','findOne','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','join','root','server','attachments','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','sendStatus','end','status','json','count','limit','Content-Range','apply','reject','update','stack','name','send','index','FaxMessage','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','offset','order','sort','where','pick','filter','merge','VIRTUAL','options','findAll','rows','catch','show','params','includeAll','include','find','body','destroy','describe','fax-interactions','accept','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','get','FaxInteraction','isNil'];(function(_0x59bfca,_0x9a39d){var _0x137740=function(_0x52d9e9){while(--_0x52d9e9){_0x59bfca['push'](_0x59bfca['shift']());}};_0x137740(++_0x9a39d);}(_0xb10b,0x12a));var _0xbb10=function(_0x20d237,_0x6a4566){_0x20d237=_0x20d237-0x0;var _0x37b1f4=_0xb10b[_0x20d237];return _0x37b1f4;};'use strict';var pdf=require(_0xbb10('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xbb10('0x1'));var zipdir=require(_0xbb10('0x2'));var jsonpatch=require(_0xbb10('0x3'));var rp=require('request-promise');var moment=require(_0xbb10('0x4'));var BPromise=require(_0xbb10('0x5'));var Mustache=require(_0xbb10('0x6'));var util=require(_0xbb10('0x7'));var path=require(_0xbb10('0x8'));var sox=require(_0xbb10('0x9'));var csv=require('to-csv');var ejs=require(_0xbb10('0xa'));var fs=require('fs');var _=require(_0xbb10('0xb'));var squel=require('squel');var crypto=require(_0xbb10('0xc'));var jsforce=require(_0xbb10('0xd'));var deskjs=require(_0xbb10('0xe'));var toCsv=require(_0xbb10('0xf'));var querystring=require(_0xbb10('0x10'));var Papa=require(_0xbb10('0x11'));var Redis=require(_0xbb10('0x12'));var authService=require(_0xbb10('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbb10('0x14'));var logger=require(_0xbb10('0x15'))(_0xbb10('0x16'));var utils=require('../../config/utils');var config=require(_0xbb10('0x17'));var db=require('../../mysqldb')['db'];config[_0xbb10('0x18')]=_[_0xbb10('0x19')](config[_0xbb10('0x18')],{'host':_0xbb10('0x1a'),'port':0x18eb});var socket=require(_0xbb10('0x1b'))(new Redis(config[_0xbb10('0x18')]));require('./faxMessage.socket')[_0xbb10('0x1c')](socket);var jayson=require(_0xbb10('0x1d'));var client=jayson[_0xbb10('0x1e')][_0xbb10('0x1f')]({'port':0x232c});var client9002=jayson[_0xbb10('0x1e')][_0xbb10('0x1f')]({'port':0x232a});function checkPasswordPattern(_0x24a57b,_0x36b5e8,_0x3e26f4){if(_0x3e26f4){var _0x2b184e=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2b184e['test'](_0x36b5e8)){return _0x24a57b;}else{throw new db[(_0xbb10('0x20'))][(_0xbb10('0x21'))](_0xbb10('0x22'));}}else{return _0x24a57b;}}function respondWithRpcPromise(_0x42db98,_0x378da8,_0x1682a4,_0x575cca){return new BPromise(function(_0x30efc6,_0xbf2906){var _0xe1c665=_0x575cca||client;return _0xe1c665['request'](_0x42db98,_0x1682a4)[_0xbb10('0x23')](function(_0x19f48d){logger[_0xbb10('0x24')](_0xbb10('0x25'),_0x378da8,_0xbb10('0x26'));logger[_0xbb10('0x27')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x378da8,_0xbb10('0x26'),JSON[_0xbb10('0x28')](_0x19f48d));if(_0x19f48d['error']){if(_0x19f48d['error'][_0xbb10('0x29')]===0x1f4){logger[_0xbb10('0x2a')](_0xbb10('0x25'),_0x378da8,_0x19f48d[_0xbb10('0x2a')][_0xbb10('0x2b')]);return _0xbf2906(_0x19f48d[_0xbb10('0x2a')][_0xbb10('0x2b')]);}logger[_0xbb10('0x2a')](_0xbb10('0x25'),_0x378da8,_0x19f48d[_0xbb10('0x2a')][_0xbb10('0x2b')]);return _0x30efc6(_0x19f48d[_0xbb10('0x2a')]['message']);}else{logger['info']('FaxMessage,\x20%s,\x20%s',_0x378da8,_0xbb10('0x26'));_0x30efc6(_0x19f48d[_0xbb10('0x2c')][_0xbb10('0x2b')]);}})['catch'](function(_0x2fdde9){logger[_0xbb10('0x2a')](_0xbb10('0x25'),_0x378da8,_0x2fdde9);_0xbf2906(_0x2fdde9);});});}function respondWithStatusCode(_0x1d5e95,_0x1acce9){_0x1acce9=_0x1acce9||0xcc;return function(_0x20d946){if(_0x20d946){return _0x1d5e95[_0xbb10('0x2d')](_0x1acce9);}return _0x1d5e95['status'](_0x1acce9)[_0xbb10('0x2e')]();};}function respondWithResult(_0x21ac54,_0xfc3595){_0xfc3595=_0xfc3595||0xc8;return function(_0x2e0249){if(_0x2e0249){return _0x21ac54[_0xbb10('0x2f')](_0xfc3595)[_0xbb10('0x30')](_0x2e0249);}};}function respondWithFilteredResult(_0x5d5c80,_0x221624){return function(_0x4ee02e){if(_0x4ee02e){var _0x448d5c=_0x4ee02e[_0xbb10('0x31')],_0x56f2da=_0x221624['offset'],_0x16ad2a=_0x221624['offset']+_0x221624[_0xbb10('0x32')],_0x1dcc9c;if(_0x16ad2a>=_0x448d5c){_0x16ad2a=_0x448d5c;_0x1dcc9c=0xc8;}else{_0x1dcc9c=0xce;}_0x5d5c80[_0xbb10('0x2f')](_0x1dcc9c);return _0x5d5c80['set'](_0xbb10('0x33'),_0x56f2da+'-'+_0x16ad2a+'/'+_0x448d5c)[_0xbb10('0x30')](_0x4ee02e);}return null;};}function patchUpdates(_0x2f653f){return function(_0x1c0b57){try{jsonpatch[_0xbb10('0x34')](_0x1c0b57,_0x2f653f,!![]);}catch(_0x138bc6){return BPromise[_0xbb10('0x35')](_0x138bc6);}return _0x1c0b57['save']();};}function saveUpdates(_0x25acb3,_0x1da9c9){return function(_0x441d15){if(_0x441d15){return _0x441d15[_0xbb10('0x36')](_0x25acb3)[_0xbb10('0x23')](function(_0x9de708){return _0x9de708;});}return null;};}function removeEntity(_0x188cbd,_0x10202c){return function(_0x3c8d7d){if(_0x3c8d7d){return _0x3c8d7d['destroy']()[_0xbb10('0x23')](function(){_0x188cbd[_0xbb10('0x2f')](0xcc)[_0xbb10('0x2e')]();});}};}function handleEntityNotFound(_0x3c3c45,_0x570f5a){return function(_0x111762){if(!_0x111762){_0x3c3c45['sendStatus'](0x194);}return _0x111762;};}function handleError(_0x4e2754,_0x3eb3cc){_0x3eb3cc=_0x3eb3cc||0x1f4;return function(_0x40c164){logger[_0xbb10('0x2a')](_0x40c164[_0xbb10('0x37')]);if(_0x40c164[_0xbb10('0x38')]){delete _0x40c164[_0xbb10('0x38')];}_0x4e2754['status'](_0x3eb3cc)[_0xbb10('0x39')](_0x40c164);};}exports[_0xbb10('0x3a')]=function(_0x52de31,_0x5e3fbd){var _0x5cd55f={},_0x31bee3={},_0x2b0b45={'count':0x0,'rows':[]};var _0x2b658a=_['map'](db[_0xbb10('0x3b')][_0xbb10('0x3c')],function(_0x4345f3){return{'name':_0x4345f3['fieldName'],'type':_0x4345f3[_0xbb10('0x3d')][_0xbb10('0x3e')]};});_0x31bee3[_0xbb10('0x3f')]=_[_0xbb10('0x40')](_0x2b658a,'name');_0x31bee3[_0xbb10('0x41')]=_[_0xbb10('0x42')](_0x52de31['query']);_0x31bee3[_0xbb10('0x43')]=_[_0xbb10('0x44')](_0x31bee3[_0xbb10('0x3f')],_0x31bee3[_0xbb10('0x41')]);_0x5cd55f[_0xbb10('0x45')]=_[_0xbb10('0x44')](_0x31bee3['model'],qs[_0xbb10('0x46')](_0x52de31[_0xbb10('0x41')][_0xbb10('0x46')]));_0x5cd55f[_0xbb10('0x45')]=_0x5cd55f['attributes'][_0xbb10('0x47')]?_0x5cd55f[_0xbb10('0x45')]:_0x31bee3[_0xbb10('0x3f')];if(!_0x52de31[_0xbb10('0x41')]['hasOwnProperty'](_0xbb10('0x48'))){_0x5cd55f[_0xbb10('0x32')]=qs['limit'](_0x52de31['query'][_0xbb10('0x32')]);_0x5cd55f['offset']=qs[_0xbb10('0x49')](_0x52de31[_0xbb10('0x41')]['offset']);}_0x5cd55f[_0xbb10('0x4a')]=qs[_0xbb10('0x4b')](_0x52de31[_0xbb10('0x41')]['sort']);_0x5cd55f[_0xbb10('0x4c')]=qs[_0xbb10('0x43')](_[_0xbb10('0x4d')](_0x52de31[_0xbb10('0x41')],_0x31bee3[_0xbb10('0x43')]));if(_0x52de31[_0xbb10('0x41')][_0xbb10('0x4e')]){_0x5cd55f[_0xbb10('0x4c')]=_[_0xbb10('0x4f')](_0x5cd55f[_0xbb10('0x4c')],{'$or':_[_0xbb10('0x40')](_0x2b658a,function(_0x1eadd2){if(_0x1eadd2['type']!==_0xbb10('0x50')){var _0x41bbf8={};_0x41bbf8[_0x1eadd2['name']]={'$like':'%'+_0x52de31[_0xbb10('0x41')][_0xbb10('0x4e')]+'%'};return _0x41bbf8;}})});}_0x5cd55f=_[_0xbb10('0x4f')]({},_0x5cd55f,_0x52de31[_0xbb10('0x51')]);var _0x41ea91={'where':_0x5cd55f[_0xbb10('0x4c')]};return db[_0xbb10('0x3b')]['count'](_0x41ea91)['then'](function(_0xcb3354){_0x2b0b45[_0xbb10('0x31')]=_0xcb3354;if(_0x52de31[_0xbb10('0x41')]['includeAll']){_0x5cd55f['include']=[{'all':!![]}];}return db[_0xbb10('0x3b')][_0xbb10('0x52')](_0x5cd55f);})[_0xbb10('0x23')](function(_0xf820fe){_0x2b0b45[_0xbb10('0x53')]=_0xf820fe;return _0x2b0b45;})[_0xbb10('0x23')](respondWithFilteredResult(_0x5e3fbd,_0x5cd55f))[_0xbb10('0x54')](handleError(_0x5e3fbd,null));};exports[_0xbb10('0x55')]=function(_0x2626d8,_0x3d7e7e){var _0x550111={'raw':!![],'where':{'id':_0x2626d8[_0xbb10('0x56')]['id']}},_0x5eafac={};_0x5eafac[_0xbb10('0x3f')]=_[_0xbb10('0x42')](db[_0xbb10('0x3b')][_0xbb10('0x3c')]);_0x5eafac[_0xbb10('0x41')]=_[_0xbb10('0x42')](_0x2626d8[_0xbb10('0x41')]);_0x5eafac[_0xbb10('0x43')]=_[_0xbb10('0x44')](_0x5eafac[_0xbb10('0x3f')],_0x5eafac[_0xbb10('0x41')]);_0x550111[_0xbb10('0x45')]=_[_0xbb10('0x44')](_0x5eafac[_0xbb10('0x3f')],qs['fields'](_0x2626d8[_0xbb10('0x41')]['fields']));_0x550111[_0xbb10('0x45')]=_0x550111[_0xbb10('0x45')][_0xbb10('0x47')]?_0x550111[_0xbb10('0x45')]:_0x5eafac[_0xbb10('0x3f')];if(_0x2626d8[_0xbb10('0x41')][_0xbb10('0x57')]){_0x550111[_0xbb10('0x58')]=[{'all':!![]}];}_0x550111=_[_0xbb10('0x4f')]({},_0x550111,_0x2626d8[_0xbb10('0x51')]);return db[_0xbb10('0x3b')][_0xbb10('0x59')](_0x550111)[_0xbb10('0x23')](handleEntityNotFound(_0x3d7e7e,null))[_0xbb10('0x23')](respondWithResult(_0x3d7e7e,null))[_0xbb10('0x54')](handleError(_0x3d7e7e,null));};exports['update']=function(_0x4571b6,_0x466eb7){if(_0x4571b6[_0xbb10('0x5a')]['id']){delete _0x4571b6[_0xbb10('0x5a')]['id'];}return db[_0xbb10('0x3b')][_0xbb10('0x59')]({'where':{'id':_0x4571b6['params']['id']}})[_0xbb10('0x23')](handleEntityNotFound(_0x466eb7,null))[_0xbb10('0x23')](saveUpdates(_0x4571b6[_0xbb10('0x5a')],null))[_0xbb10('0x23')](respondWithResult(_0x466eb7,null))[_0xbb10('0x54')](handleError(_0x466eb7,null));};exports[_0xbb10('0x5b')]=function(_0x175872,_0x12ec18){return db[_0xbb10('0x3b')][_0xbb10('0x59')]({'where':{'id':_0x175872[_0xbb10('0x56')]['id']}})[_0xbb10('0x23')](handleEntityNotFound(_0x12ec18,null))[_0xbb10('0x23')](removeEntity(_0x12ec18,null))['catch'](handleError(_0x12ec18,null));};exports['describe']=function(_0x16272d,_0x3e6338){return db[_0xbb10('0x3b')][_0xbb10('0x5c')]()['then'](respondWithResult(_0x3e6338,null))['catch'](handleError(_0x3e6338,null));};var interaction_log=require(_0xbb10('0x15'))(_0xbb10('0x5d'));exports[_0xbb10('0x5e')]=function(_0x2dd150,_0x412f13,_0x3e9753){var _0x45c0dc={'channel':'fax'};if(_0x2dd150[_0xbb10('0x5a')]['id']){delete _0x2dd150[_0xbb10('0x5a')]['id'];}_0x2dd150['body']['read']=!![];_0x2dd150['body'][_0xbb10('0x5f')]=moment()[_0xbb10('0x60')](_0xbb10('0x61'));_0x2dd150['body']['UserId']=_0x2dd150['body'][_0xbb10('0x62')]||_0x2dd150[_0xbb10('0x63')]['id'];return db[_0xbb10('0x3b')]['find']({'where':{'id':_0x2dd150[_0xbb10('0x56')]['id'],'UserId':null},'include':[{'model':db[_0xbb10('0x64')],'as':'Contact'}]})['then'](handleEntityNotFound(_0x412f13,null))[_0xbb10('0x23')](saveUpdates(_0x2dd150[_0xbb10('0x5a')],null))[_0xbb10('0x23')](function(_0x237246){if(_0x237246){_0x45c0dc['message']=_0x237246[_0xbb10('0x65')]({'plain':!![]});return db[_0xbb10('0x66')][_0xbb10('0x59')]({'where':{'id':_0x237246['FaxInteractionId']}});}return null;})[_0xbb10('0x23')](handleEntityNotFound(_0x412f13,null))[_0xbb10('0x23')](function(_0x3e3617){if(_0x3e3617){return _0x3e3617['update']({'UserId':_0x2dd150[_0xbb10('0x5a')][_0xbb10('0x62')],'read1stAt':_[_0xbb10('0x67')](_0x3e3617[_0xbb10('0x68')])?moment()['format'](_0xbb10('0x61')):undefined});}return null;})[_0xbb10('0x23')](function(_0x108e5b){if(_0x108e5b){_0x45c0dc[_0xbb10('0x69')]=_0x108e5b['get']({'plain':!![]});interaction_log[_0xbb10('0x24')](_0xbb10('0x6a'),_0x2dd150[_0xbb10('0x63')]['id'],_0x2dd150[_0xbb10('0x63')][_0xbb10('0x38')],_0x2dd150[_0xbb10('0x63')][_0xbb10('0x6b')],_0x45c0dc['interaction']['id'],_0x2dd150['body']?JSON['stringify'](_0x2dd150[_0xbb10('0x5a')]):_0xbb10('0x6c'));return respondWithRpcPromise(_0xbb10('0x6d'),'acceptMessage',_0x45c0dc);}return null;})['then'](function(_0x46f462){if(_0x46f462){if(_0x2dd150[_0xbb10('0x5a')][_0xbb10('0x6e')]){_0x45c0dc[_0xbb10('0x2b')][_0xbb10('0x6f')]=util[_0xbb10('0x60')]('SIP/%s',_0x2dd150[_0xbb10('0x63')][_0xbb10('0x38')]);_0x45c0dc[_0xbb10('0x2b')][_0xbb10('0x70')]=_0x45c0dc[_0xbb10('0x70')];_0x45c0dc['message']['event']='accept';return respondWithRpcPromise(_0xbb10('0x71'),_0xbb10('0x71'),{'event':_0xbb10('0x72'),'message':_0x45c0dc[_0xbb10('0x2b')]},client9002)[_0xbb10('0x23')](function(){return _0x45c0dc;});}return _0x45c0dc;}return null;})[_0xbb10('0x23')](respondWithResult(_0x412f13,null))['catch'](handleError(_0x412f13,null));};var interaction_log=require(_0xbb10('0x15'))('fax-interactions');exports['reject']=function(_0x519a54,_0xdf634f,_0x13040d){var _0x23b1d5={'agent':{},'channel':_0xbb10('0x73')};if(_0x519a54['body']['id']){delete _0x519a54[_0xbb10('0x5a')]['id'];}_0x519a54['body']['UserId']=_0x519a54[_0xbb10('0x5a')][_0xbb10('0x62')]||_0x519a54[_0xbb10('0x63')]['id'];_0x23b1d5[_0xbb10('0x74')]['id']=_0x519a54[_0xbb10('0x5a')]['UserId'];return db[_0xbb10('0x3b')][_0xbb10('0x59')]({'where':{'id':_0x519a54[_0xbb10('0x56')]['id'],'UserId':null}})[_0xbb10('0x23')](handleEntityNotFound(_0xdf634f,null))[_0xbb10('0x23')](function(_0x27f42f){if(_0x27f42f){_0x23b1d5[_0xbb10('0x2b')]=_0x27f42f['get']({'plain':!![]});return db[_0xbb10('0x66')][_0xbb10('0x59')]({'where':{'id':_0x27f42f[_0xbb10('0x75')]}});}return null;})[_0xbb10('0x23')](handleEntityNotFound(_0xdf634f,null))[_0xbb10('0x23')](function(_0x172be3){if(_0x172be3){_0x23b1d5[_0xbb10('0x69')]=_0x172be3[_0xbb10('0x65')]({'plain':!![]});interaction_log['info'](_0xbb10('0x76'),_0x519a54[_0xbb10('0x63')]['id'],_0x519a54[_0xbb10('0x63')]['name'],_0x519a54['user']['role'],_0x23b1d5[_0xbb10('0x69')]['id'],_0x519a54['body']?JSON['stringify'](_0x519a54[_0xbb10('0x5a')]):_0xbb10('0x6c'));return respondWithRpcPromise(_0xbb10('0x77'),_0xbb10('0x78'),_0x23b1d5);}return null;})[_0xbb10('0x23')](function(_0x24dca6){if(_0x24dca6){_0x24dca6[_0xbb10('0x2b')][_0xbb10('0x6f')]=util[_0xbb10('0x60')]('SIP/%s',_0x519a54[_0xbb10('0x63')][_0xbb10('0x38')]);_0x24dca6[_0xbb10('0x2b')][_0xbb10('0x70')]=_0x23b1d5['channel'];_0x24dca6['message'][_0xbb10('0x79')]=_0xbb10('0x35');respondWithRpcPromise(_0xbb10('0x71'),_0xbb10('0x71'),{'event':'rejectmessage','message':_0x24dca6[_0xbb10('0x2b')]},client9002);return _0x23b1d5;}return null;})[_0xbb10('0x23')](respondWithResult(_0xdf634f,null))[_0xbb10('0x54')](handleError(_0xdf634f,null));};exports[_0xbb10('0x7a')]=function(_0x35c1e8,_0x517185){var _0x5f0691;return db[_0xbb10('0x3b')][_0xbb10('0x7a')](_0x35c1e8[_0xbb10('0x5a')],{})['then'](function(_0x256b35){_0x5f0691=_0x256b35;return db[_0xbb10('0x64')]['findOne']({'where':{'id':_0x5f0691['ContactId']}});})[_0xbb10('0x23')](function(_0x26d0dd){if(_[_0xbb10('0x67')](_0x26d0dd)){return;}else{_0x5f0691['fax']=_0x26d0dd[_0xbb10('0x73')];return db[_0xbb10('0x7b')][_0xbb10('0x7c')]({'where':{'id':_0x5f0691[_0xbb10('0x7d')]}});}})[_0xbb10('0x23')](function(_0x5de006){return respondWithRpcPromise(_0xbb10('0x7e'),_0xbb10('0x7e'),{'FaxAccountId':_[_0xbb10('0x67')](_0x35c1e8['body'])?undefined:_0x35c1e8[_0xbb10('0x5a')][_0xbb10('0x7f')],'path':_[_0xbb10('0x67')](_0x5de006)?undefined:util[_0xbb10('0x60')](_0xbb10('0x80'),_0x5de006[_0xbb10('0x81')]),'fax':_[_0xbb10('0x67')](_0x5f0691[_0xbb10('0x73')])?undefined:_0x5f0691[_0xbb10('0x73')],'AttachmentId':_0x5f0691[_0xbb10('0x7d')]},client9002);})[_0xbb10('0x23')](respondWithResult(_0x517185,0xc9))[_0xbb10('0x54')](handleError(_0x517185,null));};exports['download']=function(_0x51f106,_0xe1fc51){var _0x3fa344=path[_0xbb10('0x82')](config[_0xbb10('0x83')],_0xbb10('0x84'),'files',_0xbb10('0x85'));return db[_0xbb10('0x3b')][_0xbb10('0x59')]({'where':{'id':_0x51f106[_0xbb10('0x56')]['id']},'include':[{'model':db[_0xbb10('0x7b')],'as':_0xbb10('0x7b')}]})['then'](handleEntityNotFound(_0xe1fc51,null))[_0xbb10('0x23')](function(_0x742e10){if(_0x742e10){return _0xe1fc51['download'](path[_0xbb10('0x82')](_0x3fa344,_0x742e10['Attachment'][_0xbb10('0x81')]));}})[_0xbb10('0x54')](handleError(_0xe1fc51,null));}; \ No newline at end of file +var _0xa9e0=['format','get','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','stringify','null','AcceptMessage','acceptMessage','interface','channel','event','agent','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','EventManager','rejectmessage','create','findOne','AttachmentId','SendFax','/var/opt/motion2/server/files/attachments/%s','basename','join','server','files','attachments','Attachment','download','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','jayson/promise','client','http','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','FaxMessage,\x20%s,\x20%s,\x20%s','error','message','result','catch','sendStatus','status','end','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','stack','index','map','rawAttributes','fieldName','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','name','options','FaxMessage','includeAll','include','findAll','rows','show','intersection','find','body','params','describe','../../config/logger','fax-interactions','accept','fax','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','Contact','FaxInteraction','isNil','read1stAt'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0xa9e0[_0x4154a6];return _0x3b2786;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x0a9e('0x13'))['db'];config[_0x0a9e('0x14')]=_[_0x0a9e('0x15')](config[_0x0a9e('0x14')],{'host':_0x0a9e('0x16'),'port':0x18eb});var socket=require(_0x0a9e('0x17'))(new Redis(config['redis']));require(_0x0a9e('0x18'))[_0x0a9e('0x19')](socket);var jayson=require(_0x0a9e('0x1a'));var client=jayson[_0x0a9e('0x1b')][_0x0a9e('0x1c')]({'port':0x232c});var client9002=jayson[_0x0a9e('0x1b')]['http']({'port':0x232a});function checkPasswordPattern(_0x22dccb,_0x5d0880,_0x1985b6){if(_0x1985b6){var _0x519dfd=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x519dfd[_0x0a9e('0x1d')](_0x5d0880)){return _0x22dccb;}else{throw new db[(_0x0a9e('0x1e'))]['ValidationError'](_0x0a9e('0x1f'));}}else{return _0x22dccb;}}function respondWithRpcPromise(_0x5a0a06,_0x459eb1,_0x478723,_0x106033){return new BPromise(function(_0x205fd6,_0x31b1ca){var _0x2eb11f=_0x106033||client;return _0x2eb11f[_0x0a9e('0x20')](_0x5a0a06,_0x478723)[_0x0a9e('0x21')](function(_0x1314ae){logger[_0x0a9e('0x22')](_0x0a9e('0x23'),_0x459eb1,_0x0a9e('0x24'));logger['debug'](_0x0a9e('0x25'),_0x459eb1,_0x0a9e('0x24'),JSON['stringify'](_0x1314ae));if(_0x1314ae[_0x0a9e('0x26')]){if(_0x1314ae['error']['code']===0x1f4){logger[_0x0a9e('0x26')](_0x0a9e('0x23'),_0x459eb1,_0x1314ae[_0x0a9e('0x26')][_0x0a9e('0x27')]);return _0x31b1ca(_0x1314ae['error'][_0x0a9e('0x27')]);}logger[_0x0a9e('0x26')](_0x0a9e('0x23'),_0x459eb1,_0x1314ae[_0x0a9e('0x26')][_0x0a9e('0x27')]);return _0x205fd6(_0x1314ae[_0x0a9e('0x26')][_0x0a9e('0x27')]);}else{logger['info']('FaxMessage,\x20%s,\x20%s',_0x459eb1,_0x0a9e('0x24'));_0x205fd6(_0x1314ae[_0x0a9e('0x28')][_0x0a9e('0x27')]);}})[_0x0a9e('0x29')](function(_0x526cf3){logger[_0x0a9e('0x26')]('FaxMessage,\x20%s,\x20%s',_0x459eb1,_0x526cf3);_0x31b1ca(_0x526cf3);});});}function respondWithStatusCode(_0x45a1e7,_0x5bfb33){_0x5bfb33=_0x5bfb33||0xcc;return function(_0x1dc186){if(_0x1dc186){return _0x45a1e7[_0x0a9e('0x2a')](_0x5bfb33);}return _0x45a1e7[_0x0a9e('0x2b')](_0x5bfb33)[_0x0a9e('0x2c')]();};}function respondWithResult(_0x140511,_0x1538a4){_0x1538a4=_0x1538a4||0xc8;return function(_0x11c3b6){if(_0x11c3b6){return _0x140511[_0x0a9e('0x2b')](_0x1538a4)['json'](_0x11c3b6);}};}function respondWithFilteredResult(_0x3652a7,_0x468813){return function(_0x2b1f27){if(_0x2b1f27){var _0x2ec755=_0x2b1f27[_0x0a9e('0x2d')],_0x5c877d=_0x468813[_0x0a9e('0x2e')],_0x15b200=_0x468813[_0x0a9e('0x2e')]+_0x468813[_0x0a9e('0x2f')],_0x40e7a3;if(_0x15b200>=_0x2ec755){_0x15b200=_0x2ec755;_0x40e7a3=0xc8;}else{_0x40e7a3=0xce;}_0x3652a7[_0x0a9e('0x2b')](_0x40e7a3);return _0x3652a7[_0x0a9e('0x30')](_0x0a9e('0x31'),_0x5c877d+'-'+_0x15b200+'/'+_0x2ec755)['json'](_0x2b1f27);}return null;};}function patchUpdates(_0x426950){return function(_0x5d1e0e){try{jsonpatch[_0x0a9e('0x32')](_0x5d1e0e,_0x426950,!![]);}catch(_0x3ae878){return BPromise[_0x0a9e('0x33')](_0x3ae878);}return _0x5d1e0e[_0x0a9e('0x34')]();};}function saveUpdates(_0x25ce3a,_0x5180f1){return function(_0x66c1d2){if(_0x66c1d2){return _0x66c1d2[_0x0a9e('0x35')](_0x25ce3a)[_0x0a9e('0x21')](function(_0x2da5c0){return _0x2da5c0;});}return null;};}function removeEntity(_0x2b45ea,_0x409319){return function(_0x332d35){if(_0x332d35){return _0x332d35[_0x0a9e('0x36')]()['then'](function(){_0x2b45ea[_0x0a9e('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2cc7a0,_0x14b13f){return function(_0x2b7e7f){if(!_0x2b7e7f){_0x2cc7a0[_0x0a9e('0x2a')](0x194);}return _0x2b7e7f;};}function handleError(_0x567193,_0x191e91){_0x191e91=_0x191e91||0x1f4;return function(_0xd1836d){logger[_0x0a9e('0x26')](_0xd1836d[_0x0a9e('0x37')]);if(_0xd1836d['name']){delete _0xd1836d['name'];}_0x567193[_0x0a9e('0x2b')](_0x191e91)['send'](_0xd1836d);};}exports[_0x0a9e('0x38')]=function(_0x3d9717,_0x381c37){var _0x1ef87a={},_0x4f41ae={},_0x31916f={'count':0x0,'rows':[]};var _0x3bfce8=_[_0x0a9e('0x39')](db['FaxMessage'][_0x0a9e('0x3a')],function(_0x1a180b){return{'name':_0x1a180b[_0x0a9e('0x3b')],'type':_0x1a180b['type']['key']};});_0x4f41ae[_0x0a9e('0x3c')]=_[_0x0a9e('0x39')](_0x3bfce8,'name');_0x4f41ae[_0x0a9e('0x3d')]=_[_0x0a9e('0x3e')](_0x3d9717[_0x0a9e('0x3d')]);_0x4f41ae[_0x0a9e('0x3f')]=_['intersection'](_0x4f41ae['model'],_0x4f41ae[_0x0a9e('0x3d')]);_0x1ef87a[_0x0a9e('0x40')]=_['intersection'](_0x4f41ae[_0x0a9e('0x3c')],qs[_0x0a9e('0x41')](_0x3d9717[_0x0a9e('0x3d')]['fields']));_0x1ef87a[_0x0a9e('0x40')]=_0x1ef87a[_0x0a9e('0x40')][_0x0a9e('0x42')]?_0x1ef87a[_0x0a9e('0x40')]:_0x4f41ae[_0x0a9e('0x3c')];if(!_0x3d9717[_0x0a9e('0x3d')][_0x0a9e('0x43')](_0x0a9e('0x44'))){_0x1ef87a[_0x0a9e('0x2f')]=qs[_0x0a9e('0x2f')](_0x3d9717[_0x0a9e('0x3d')][_0x0a9e('0x2f')]);_0x1ef87a[_0x0a9e('0x2e')]=qs[_0x0a9e('0x2e')](_0x3d9717[_0x0a9e('0x3d')]['offset']);}_0x1ef87a['order']=qs[_0x0a9e('0x45')](_0x3d9717[_0x0a9e('0x3d')][_0x0a9e('0x45')]);_0x1ef87a[_0x0a9e('0x46')]=qs[_0x0a9e('0x3f')](_[_0x0a9e('0x47')](_0x3d9717[_0x0a9e('0x3d')],_0x4f41ae[_0x0a9e('0x3f')]));if(_0x3d9717[_0x0a9e('0x3d')][_0x0a9e('0x48')]){_0x1ef87a[_0x0a9e('0x46')]=_[_0x0a9e('0x49')](_0x1ef87a['where'],{'$or':_[_0x0a9e('0x39')](_0x3bfce8,function(_0x138b8b){if(_0x138b8b[_0x0a9e('0x4a')]!==_0x0a9e('0x4b')){var _0x2e8caf={};_0x2e8caf[_0x138b8b[_0x0a9e('0x4c')]]={'$like':'%'+_0x3d9717[_0x0a9e('0x3d')][_0x0a9e('0x48')]+'%'};return _0x2e8caf;}})});}_0x1ef87a=_['merge']({},_0x1ef87a,_0x3d9717[_0x0a9e('0x4d')]);var _0x48fd45={'where':_0x1ef87a[_0x0a9e('0x46')]};return db[_0x0a9e('0x4e')][_0x0a9e('0x2d')](_0x48fd45)['then'](function(_0x14bec2){_0x31916f[_0x0a9e('0x2d')]=_0x14bec2;if(_0x3d9717[_0x0a9e('0x3d')][_0x0a9e('0x4f')]){_0x1ef87a[_0x0a9e('0x50')]=[{'all':!![]}];}return db[_0x0a9e('0x4e')][_0x0a9e('0x51')](_0x1ef87a);})['then'](function(_0x13f44d){_0x31916f[_0x0a9e('0x52')]=_0x13f44d;return _0x31916f;})[_0x0a9e('0x21')](respondWithFilteredResult(_0x381c37,_0x1ef87a))[_0x0a9e('0x29')](handleError(_0x381c37,null));};exports[_0x0a9e('0x53')]=function(_0x992c77,_0x6054ee){var _0x19383e={'raw':!![],'where':{'id':_0x992c77['params']['id']}},_0x34febd={};_0x34febd[_0x0a9e('0x3c')]=_[_0x0a9e('0x3e')](db['FaxMessage']['rawAttributes']);_0x34febd['query']=_[_0x0a9e('0x3e')](_0x992c77[_0x0a9e('0x3d')]);_0x34febd[_0x0a9e('0x3f')]=_[_0x0a9e('0x54')](_0x34febd[_0x0a9e('0x3c')],_0x34febd[_0x0a9e('0x3d')]);_0x19383e[_0x0a9e('0x40')]=_[_0x0a9e('0x54')](_0x34febd['model'],qs['fields'](_0x992c77['query'][_0x0a9e('0x41')]));_0x19383e[_0x0a9e('0x40')]=_0x19383e[_0x0a9e('0x40')]['length']?_0x19383e[_0x0a9e('0x40')]:_0x34febd[_0x0a9e('0x3c')];if(_0x992c77['query']['includeAll']){_0x19383e[_0x0a9e('0x50')]=[{'all':!![]}];}_0x19383e=_['merge']({},_0x19383e,_0x992c77[_0x0a9e('0x4d')]);return db['FaxMessage'][_0x0a9e('0x55')](_0x19383e)[_0x0a9e('0x21')](handleEntityNotFound(_0x6054ee,null))[_0x0a9e('0x21')](respondWithResult(_0x6054ee,null))['catch'](handleError(_0x6054ee,null));};exports[_0x0a9e('0x35')]=function(_0x1bf38a,_0x508b47){if(_0x1bf38a['body']['id']){delete _0x1bf38a[_0x0a9e('0x56')]['id'];}return db[_0x0a9e('0x4e')]['find']({'where':{'id':_0x1bf38a[_0x0a9e('0x57')]['id']}})['then'](handleEntityNotFound(_0x508b47,null))[_0x0a9e('0x21')](saveUpdates(_0x1bf38a['body'],null))[_0x0a9e('0x21')](respondWithResult(_0x508b47,null))['catch'](handleError(_0x508b47,null));};exports['destroy']=function(_0x5df0ad,_0x2da03c){return db['FaxMessage'][_0x0a9e('0x55')]({'where':{'id':_0x5df0ad[_0x0a9e('0x57')]['id']}})[_0x0a9e('0x21')](handleEntityNotFound(_0x2da03c,null))[_0x0a9e('0x21')](removeEntity(_0x2da03c,null))[_0x0a9e('0x29')](handleError(_0x2da03c,null));};exports[_0x0a9e('0x58')]=function(_0xd10662,_0x28d814){return db['FaxMessage'][_0x0a9e('0x58')]()[_0x0a9e('0x21')](respondWithResult(_0x28d814,null))[_0x0a9e('0x29')](handleError(_0x28d814,null));};var interaction_log=require(_0x0a9e('0x59'))(_0x0a9e('0x5a'));exports[_0x0a9e('0x5b')]=function(_0x5d86e9,_0x956fbe,_0x26bc80){var _0x5239ef={'channel':_0x0a9e('0x5c')};if(_0x5d86e9['body']['id']){delete _0x5d86e9[_0x0a9e('0x56')]['id'];}_0x5d86e9['body']['read']=!![];_0x5d86e9['body'][_0x0a9e('0x5d')]=moment()['format'](_0x0a9e('0x5e'));_0x5d86e9[_0x0a9e('0x56')][_0x0a9e('0x5f')]=_0x5d86e9[_0x0a9e('0x56')][_0x0a9e('0x5f')]||_0x5d86e9[_0x0a9e('0x60')]['id'];return db['FaxMessage'][_0x0a9e('0x55')]({'where':{'id':_0x5d86e9['params']['id'],'UserId':null},'include':[{'model':db[_0x0a9e('0x61')],'as':_0x0a9e('0x62')}]})[_0x0a9e('0x21')](handleEntityNotFound(_0x956fbe,null))['then'](saveUpdates(_0x5d86e9[_0x0a9e('0x56')],null))[_0x0a9e('0x21')](function(_0x119677){if(_0x119677){_0x5239ef[_0x0a9e('0x27')]=_0x119677['get']({'plain':!![]});return db[_0x0a9e('0x63')][_0x0a9e('0x55')]({'where':{'id':_0x119677['FaxInteractionId']}});}return null;})[_0x0a9e('0x21')](handleEntityNotFound(_0x956fbe,null))[_0x0a9e('0x21')](function(_0x88dcbf){if(_0x88dcbf){return _0x88dcbf[_0x0a9e('0x35')]({'UserId':_0x5d86e9[_0x0a9e('0x56')]['UserId'],'read1stAt':_[_0x0a9e('0x64')](_0x88dcbf[_0x0a9e('0x65')])?moment()[_0x0a9e('0x66')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x0a9e('0x21')](function(_0x4f1e60){if(_0x4f1e60){_0x5239ef['interaction']=_0x4f1e60[_0x0a9e('0x67')]({'plain':!![]});interaction_log[_0x0a9e('0x22')](_0x0a9e('0x68'),_0x5d86e9[_0x0a9e('0x60')]['id'],_0x5d86e9[_0x0a9e('0x60')][_0x0a9e('0x4c')],_0x5d86e9[_0x0a9e('0x60')][_0x0a9e('0x69')],_0x5239ef[_0x0a9e('0x6a')]['id'],_0x5d86e9[_0x0a9e('0x56')]?JSON[_0x0a9e('0x6b')](_0x5d86e9[_0x0a9e('0x56')]):_0x0a9e('0x6c'));return respondWithRpcPromise(_0x0a9e('0x6d'),_0x0a9e('0x6e'),_0x5239ef);}return null;})[_0x0a9e('0x21')](function(_0x2a28c0){if(_0x2a28c0){if(_0x5d86e9[_0x0a9e('0x56')]['manual']){_0x5239ef[_0x0a9e('0x27')][_0x0a9e('0x6f')]=util[_0x0a9e('0x66')]('SIP/%s',_0x5d86e9[_0x0a9e('0x60')][_0x0a9e('0x4c')]);_0x5239ef['message'][_0x0a9e('0x70')]=_0x5239ef[_0x0a9e('0x70')];_0x5239ef[_0x0a9e('0x27')][_0x0a9e('0x71')]=_0x0a9e('0x5b');return respondWithRpcPromise('EventManager','EventManager',{'event':'acceptmessage','message':_0x5239ef[_0x0a9e('0x27')]},client9002)[_0x0a9e('0x21')](function(){return _0x5239ef;});}return _0x5239ef;}return null;})[_0x0a9e('0x21')](respondWithResult(_0x956fbe,null))[_0x0a9e('0x29')](handleError(_0x956fbe,null));};var interaction_log=require(_0x0a9e('0x59'))(_0x0a9e('0x5a'));exports[_0x0a9e('0x33')]=function(_0x1a0677,_0x5512d1,_0x235f8f){var _0xcbc8b2={'agent':{},'channel':_0x0a9e('0x5c')};if(_0x1a0677['body']['id']){delete _0x1a0677[_0x0a9e('0x56')]['id'];}_0x1a0677['body'][_0x0a9e('0x5f')]=_0x1a0677[_0x0a9e('0x56')]['UserId']||_0x1a0677[_0x0a9e('0x60')]['id'];_0xcbc8b2[_0x0a9e('0x72')]['id']=_0x1a0677[_0x0a9e('0x56')][_0x0a9e('0x5f')];return db['FaxMessage'][_0x0a9e('0x55')]({'where':{'id':_0x1a0677[_0x0a9e('0x57')]['id'],'UserId':null}})[_0x0a9e('0x21')](handleEntityNotFound(_0x5512d1,null))[_0x0a9e('0x21')](function(_0x5b7fc3){if(_0x5b7fc3){_0xcbc8b2[_0x0a9e('0x27')]=_0x5b7fc3[_0x0a9e('0x67')]({'plain':!![]});return db[_0x0a9e('0x63')][_0x0a9e('0x55')]({'where':{'id':_0x5b7fc3['FaxInteractionId']}});}return null;})[_0x0a9e('0x21')](handleEntityNotFound(_0x5512d1,null))[_0x0a9e('0x21')](function(_0x30a4c7){if(_0x30a4c7){_0xcbc8b2[_0x0a9e('0x6a')]=_0x30a4c7[_0x0a9e('0x67')]({'plain':!![]});interaction_log[_0x0a9e('0x22')](_0x0a9e('0x73'),_0x1a0677[_0x0a9e('0x60')]['id'],_0x1a0677[_0x0a9e('0x60')][_0x0a9e('0x4c')],_0x1a0677[_0x0a9e('0x60')][_0x0a9e('0x69')],_0xcbc8b2[_0x0a9e('0x6a')]['id'],_0x1a0677[_0x0a9e('0x56')]?JSON['stringify'](_0x1a0677[_0x0a9e('0x56')]):_0x0a9e('0x6c'));return respondWithRpcPromise(_0x0a9e('0x74'),'rejectMessage',_0xcbc8b2);}return null;})[_0x0a9e('0x21')](function(_0x33dda0){if(_0x33dda0){_0x33dda0[_0x0a9e('0x27')][_0x0a9e('0x6f')]=util['format']('SIP/%s',_0x1a0677[_0x0a9e('0x60')][_0x0a9e('0x4c')]);_0x33dda0['message'][_0x0a9e('0x70')]=_0xcbc8b2['channel'];_0x33dda0[_0x0a9e('0x27')][_0x0a9e('0x71')]='reject';respondWithRpcPromise(_0x0a9e('0x75'),_0x0a9e('0x75'),{'event':_0x0a9e('0x76'),'message':_0x33dda0[_0x0a9e('0x27')]},client9002);return _0xcbc8b2;}return null;})[_0x0a9e('0x21')](respondWithResult(_0x5512d1,null))[_0x0a9e('0x29')](handleError(_0x5512d1,null));};exports[_0x0a9e('0x77')]=function(_0x482ca2,_0x2973d3){var _0x3ca9b9;return db[_0x0a9e('0x4e')][_0x0a9e('0x77')](_0x482ca2['body'],{})[_0x0a9e('0x21')](function(_0xf0db1){_0x3ca9b9=_0xf0db1;return db['CmContact'][_0x0a9e('0x78')]({'where':{'id':_0x3ca9b9['ContactId']}});})[_0x0a9e('0x21')](function(_0x2bb25a){if(_[_0x0a9e('0x64')](_0x2bb25a)){return;}else{_0x3ca9b9[_0x0a9e('0x5c')]=_0x2bb25a['fax'];return db['Attachment'][_0x0a9e('0x78')]({'where':{'id':_0x3ca9b9[_0x0a9e('0x79')]}});}})[_0x0a9e('0x21')](function(_0x5ac73d){return respondWithRpcPromise(_0x0a9e('0x7a'),_0x0a9e('0x7a'),{'FaxAccountId':_['isNil'](_0x482ca2['body'])?undefined:_0x482ca2[_0x0a9e('0x56')]['FaxAccountId'],'path':_['isNil'](_0x5ac73d)?undefined:util['format'](_0x0a9e('0x7b'),_0x5ac73d[_0x0a9e('0x7c')]),'fax':_[_0x0a9e('0x64')](_0x3ca9b9[_0x0a9e('0x5c')])?undefined:_0x3ca9b9[_0x0a9e('0x5c')],'AttachmentId':_0x3ca9b9[_0x0a9e('0x79')]},client9002);})['then'](respondWithResult(_0x2973d3,0xc9))[_0x0a9e('0x29')](handleError(_0x2973d3,null));};exports['download']=function(_0x2871c1,_0x2aabab){var _0x18ad56=path[_0x0a9e('0x7d')](config['root'],_0x0a9e('0x7e'),_0x0a9e('0x7f'),_0x0a9e('0x80'));return db['FaxMessage'][_0x0a9e('0x55')]({'where':{'id':_0x2871c1[_0x0a9e('0x57')]['id']},'include':[{'model':db[_0x0a9e('0x81')],'as':_0x0a9e('0x81')}]})[_0x0a9e('0x21')](handleEntityNotFound(_0x2aabab,null))[_0x0a9e('0x21')](function(_0x32b9bd){if(_0x32b9bd){return _0x2aabab[_0x0a9e('0x82')](path['join'](_0x18ad56,_0x32b9bd[_0x0a9e('0x81')][_0x0a9e('0x7c')]));}})['catch'](handleError(_0x2aabab,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index d547d4d..4014afe 100644 --- a/server/api/faxMessage/faxMessage.events.js +++ b/server/api/faxMessage/faxMessage.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7217=['emit','hasOwnProperty','hook','exports','events','FaxMessage','setMaxListeners','save','update','remove'];(function(_0xacb1e2,_0x55e0ab){var _0x463815=function(_0x413c3b){while(--_0x413c3b){_0xacb1e2['push'](_0xacb1e2['shift']());}};_0x463815(++_0x55e0ab);}(_0x7217,0x19e));var _0x7721=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0x7217[_0x5b78e8];return _0xf2c321;};'use strict';var EventEmitter=require(_0x7721('0x0'));var FaxMessage=require('../../mysqldb')['db'][_0x7721('0x1')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x7721('0x2')](0x0);var events={'afterCreate':_0x7721('0x3'),'afterUpdate':_0x7721('0x4'),'afterDestroy':_0x7721('0x5')};function emitEvent(_0x4d6446){return function(_0x5bf160,_0x472a96,_0xce17f9){FaxMessageEvents[_0x7721('0x6')](_0x4d6446+':'+_0x5bf160['id'],_0x5bf160);FaxMessageEvents[_0x7721('0x6')](_0x4d6446,_0x5bf160);_0xce17f9(null);};}for(var e in events){if(events[_0x7721('0x7')](e)){var event=events[e];FaxMessage[_0x7721('0x8')](e,emitEvent(event));}}module[_0x7721('0x9')]=FaxMessageEvents; \ No newline at end of file +var _0x55ca=['events','../../mysqldb','update','remove','emit','hasOwnProperty','hook'];(function(_0x22f8ab,_0x15d8ff){var _0x2a70e5=function(_0x5e6895){while(--_0x5e6895){_0x22f8ab['push'](_0x22f8ab['shift']());}};_0x2a70e5(++_0x15d8ff);}(_0x55ca,0x126));var _0xa55c=function(_0x2bbd2d,_0x37c3c4){_0x2bbd2d=_0x2bbd2d-0x0;var _0x257dc9=_0x55ca[_0x2bbd2d];return _0x257dc9;};'use strict';var EventEmitter=require(_0xa55c('0x0'));var FaxMessage=require(_0xa55c('0x1'))['db']['FaxMessage'];var FaxMessageEvents=new EventEmitter();FaxMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xa55c('0x2'),'afterDestroy':_0xa55c('0x3')};function emitEvent(_0x5dc716){return function(_0x3b478a,_0x2db02a,_0xcb02e3){FaxMessageEvents[_0xa55c('0x4')](_0x5dc716+':'+_0x3b478a['id'],_0x3b478a);FaxMessageEvents[_0xa55c('0x4')](_0x5dc716,_0x3b478a);_0xcb02e3(null);};}for(var e in events){if(events[_0xa55c('0x5')](e)){var event=events[e];FaxMessage[_0xa55c('0x6')](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 583b5b2..16db047 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 _0x9d37=['rimraf','../../config/environment','./faxMessage.attributes','define','fax_messages','fti_fax_messages','body','FULLTEXT','get','direction','toLowerCase','out','isNil','UserId','findOne','FaxInteractionId','then','catch','utf8mb4_unicode_ci','api','moment','bluebird','path'];(function(_0x319080,_0x36dc97){var _0x1be7a5=function(_0x393666){while(--_0x393666){_0x319080['push'](_0x319080['shift']());}};_0x1be7a5(++_0x36dc97);}(_0x9d37,0xf9));var _0x79d3=function(_0x392439,_0x2acb12){_0x392439=_0x392439-0x0;var _0x160001=_0x9d37[_0x392439];return _0x160001;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x79d3('0x0'));var moment=require(_0x79d3('0x1'));var BPromise=require(_0x79d3('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x79d3('0x3'));var rimraf=require(_0x79d3('0x4'));var config=require(_0x79d3('0x5'));var attributes=require(_0x79d3('0x6'));module['exports']=function(_0x1168fa,_0x408dc0){return _0x1168fa[_0x79d3('0x7')]('FaxMessage',attributes,{'tableName':_0x79d3('0x8'),'paranoid':![],'indexes':[{'name':_0x79d3('0x9'),'fields':[_0x79d3('0xa')],'type':_0x79d3('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0xf6bbcd,_0x4f3e5f,_0x2ed539){var _0x5d2ffe=_0x1168fa['models'];var _0x2c5adb=_0xf6bbcd[_0x79d3('0xc')]({'plain':!![]});if(_0x2c5adb[_0x79d3('0xd')][_0x79d3('0xe')]()==='in'||_0x2c5adb['direction']['toLowerCase']()===_0x79d3('0xf')&&!_0x2c5adb['secret']&&!_[_0x79d3('0x10')](_0x2c5adb[_0x79d3('0x11')])){_0x5d2ffe['FaxInteraction'][_0x79d3('0x12')]({'where':{'id':_0x2c5adb[_0x79d3('0x13')]}})[_0x79d3('0x14')](function(_0x1f2d41){if(_0x1f2d41){_0x1f2d41['update']({'lastMsgAt':_0x2c5adb['createdAt'],'lastMsgDirection':_0x2c5adb[_0x79d3('0xd')]['toLowerCase']()});}})[_0x79d3('0x15')](function(_0x31f044){console['error'](_0x31f044);});}_0x2ed539();}},'charset':'utf8mb4','collate':_0x79d3('0x16')});}; \ No newline at end of file +var _0xdf6a=['createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./faxMessage.attributes','define','fax_messages','body','FULLTEXT','direction','toLowerCase','out','secret','isNil','FaxInteraction','findOne','FaxInteractionId','then'];(function(_0x54d50d,_0x42244a){var _0x3947fe=function(_0x4a855){while(--_0x4a855){_0x54d50d['push'](_0x54d50d['shift']());}};_0x3947fe(++_0x42244a);}(_0xdf6a,0xad));var _0xadf6=function(_0x36b9a3,_0x1bb9c4){_0x36b9a3=_0x36b9a3-0x0;var _0xe07db8=_0xdf6a[_0x36b9a3];return _0xe07db8;};'use strict';var _=require(_0xadf6('0x0'));var util=require(_0xadf6('0x1'));var logger=require(_0xadf6('0x2'))(_0xadf6('0x3'));var moment=require('moment');var BPromise=require(_0xadf6('0x4'));var rp=require(_0xadf6('0x5'));var fs=require('fs');var path=require(_0xadf6('0x6'));var rimraf=require(_0xadf6('0x7'));var config=require(_0xadf6('0x8'));var attributes=require(_0xadf6('0x9'));module['exports']=function(_0x590d18,_0x345107){return _0x590d18[_0xadf6('0xa')]('FaxMessage',attributes,{'tableName':_0xadf6('0xb'),'paranoid':![],'indexes':[{'name':'fti_fax_messages','fields':[_0xadf6('0xc')],'type':_0xadf6('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x573d22,_0x120f4a,_0x21794e){var _0x4392b2=_0x590d18['models'];var _0x317c89=_0x573d22['get']({'plain':!![]});if(_0x317c89[_0xadf6('0xe')]['toLowerCase']()==='in'||_0x317c89[_0xadf6('0xe')][_0xadf6('0xf')]()===_0xadf6('0x10')&&!_0x317c89[_0xadf6('0x11')]&&!_[_0xadf6('0x12')](_0x317c89['UserId'])){_0x4392b2[_0xadf6('0x13')][_0xadf6('0x14')]({'where':{'id':_0x317c89[_0xadf6('0x15')]}})[_0xadf6('0x16')](function(_0x396291){if(_0x396291){_0x396291['update']({'lastMsgAt':_0x317c89[_0xadf6('0x17')],'lastMsgDirection':_0x317c89[_0xadf6('0xe')][_0xadf6('0xf')]()});}})[_0xadf6('0x18')](function(_0x27177b){console[_0xadf6('0x19')](_0x27177b);});}_0x21794e();}},'charset':_0xadf6('0x1a'),'collate':_0xadf6('0x1b')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index 948187c..4b70470 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 _0x0bc1=['catch','create','body','options','raw','info','CreateFaxMessage','UpdateFaxMessage','FaxMessage','update','attributes','limit','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x48367c,_0x407ebb){var _0x24d3a0=function(_0x12eb6b){while(--_0x12eb6b){_0x48367c['push'](_0x48367c['shift']());}};_0x24d3a0(++_0x407ebb);}(_0x0bc1,0x1ae));var _0x10bc=function(_0x34aa72,_0x4bb48f){_0x34aa72=_0x34aa72-0x0;var _0x4aa635=_0x0bc1[_0x34aa72];return _0x4aa635;};'use strict';var _=require(_0x10bc('0x0'));var util=require(_0x10bc('0x1'));var moment=require(_0x10bc('0x2'));var BPromise=require(_0x10bc('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x10bc('0x4'))['db'];var utils=require(_0x10bc('0x5'));var logger=require(_0x10bc('0x6'))(_0x10bc('0x7'));var config=require(_0x10bc('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x10bc('0x9')][_0x10bc('0xa')]({'port':0x232a});config[_0x10bc('0xb')]=_[_0x10bc('0xc')](config[_0x10bc('0xb')],{'host':_0x10bc('0xd'),'port':0x18eb});var socket=require(_0x10bc('0xe'))(new Redis(config[_0x10bc('0xb')]));require('./faxMessage.socket')[_0x10bc('0xf')](socket);function respondWithRpcPromise(_0x4eba3f,_0x53e222,_0x17b19e){return new BPromise(function(_0x3e0414,_0x4e8d28){return client[_0x10bc('0x10')](_0x4eba3f,_0x17b19e)[_0x10bc('0x11')](function(_0x13462d){logger['info'](_0x10bc('0x12'),_0x53e222,_0x10bc('0x13'));logger[_0x10bc('0x14')](_0x10bc('0x15'),_0x53e222,_0x10bc('0x13'),JSON[_0x10bc('0x16')](_0x13462d));if(_0x13462d[_0x10bc('0x17')]){if(_0x13462d[_0x10bc('0x17')][_0x10bc('0x18')]===0x1f4){logger[_0x10bc('0x17')](_0x10bc('0x12'),_0x53e222,_0x13462d[_0x10bc('0x17')][_0x10bc('0x19')]);return _0x4e8d28(_0x13462d[_0x10bc('0x17')][_0x10bc('0x19')]);}logger[_0x10bc('0x17')](_0x10bc('0x12'),_0x53e222,_0x13462d[_0x10bc('0x17')][_0x10bc('0x19')]);return _0x3e0414(_0x13462d['error'][_0x10bc('0x19')]);}else{logger['info'](_0x10bc('0x12'),_0x53e222,'request\x20sent');_0x3e0414(_0x13462d['result'][_0x10bc('0x19')]);}})[_0x10bc('0x1a')](function(_0x8ea902){logger['error'](_0x10bc('0x12'),_0x53e222,_0x8ea902);_0x4e8d28(_0x8ea902);});});}exports['CreateFaxMessage']=function(_0x178915){var _0x5ad529=this;return new Promise(function(_0x1eab1e,_0x106233){return db['FaxMessage'][_0x10bc('0x1b')](_0x178915[_0x10bc('0x1c')],{'raw':_0x178915['options']?_0x178915[_0x10bc('0x1d')][_0x10bc('0x1e')]===undefined?!![]:![]:!![]})[_0x10bc('0x11')](function(_0x279cf8){logger[_0x10bc('0x1f')](_0x10bc('0x20'),_0x178915);logger['debug']('CreateFaxMessage',_0x178915,JSON[_0x10bc('0x16')](_0x279cf8));_0x1eab1e(_0x279cf8);})[_0x10bc('0x1a')](function(_0x586727){logger[_0x10bc('0x17')](_0x10bc('0x20'),_0x586727[_0x10bc('0x19')],_0x178915);_0x106233(_0x5ad529[_0x10bc('0x17')](0x1f4,_0x586727[_0x10bc('0x19')]));});});};exports[_0x10bc('0x21')]=function(_0xabc911){var _0x1e9b11=this;return new Promise(function(_0x1d4ff9,_0x1dca59){return db[_0x10bc('0x22')][_0x10bc('0x23')](_0xabc911[_0x10bc('0x1c')],{'raw':_0xabc911['options']?_0xabc911[_0x10bc('0x1d')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xabc911[_0x10bc('0x1d')]?_0xabc911[_0x10bc('0x1d')]['where']||null:null,'attributes':_0xabc911[_0x10bc('0x1d')]?_0xabc911[_0x10bc('0x1d')][_0x10bc('0x24')]||null:null,'limit':_0xabc911[_0x10bc('0x1d')]?_0xabc911[_0x10bc('0x1d')][_0x10bc('0x25')]||null:null})[_0x10bc('0x11')](function(_0x72e124){logger[_0x10bc('0x1f')]('UpdateFaxMessage',_0xabc911);logger[_0x10bc('0x14')](_0x10bc('0x21'),_0xabc911,JSON[_0x10bc('0x16')](_0x72e124));_0x1d4ff9(_0x72e124);})[_0x10bc('0x1a')](function(_0x2a6baf){logger[_0x10bc('0x17')]('UpdateFaxMessage',_0x2a6baf['message'],_0xabc911);_0x1dca59(_0x1e9b11['error'](0x1f4,_0x2a6baf[_0x10bc('0x19')]));});});}; \ No newline at end of file +var _0xf280=['options','stringify','catch','UpdateFaxMessage','update','body','raw','where','limit','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','FaxMessage,\x20%s,\x20%s','debug','request\x20sent','error','message','result','CreateFaxMessage','FaxMessage','create'];(function(_0x499fa2,_0x5b335e){var _0x24e834=function(_0xfd19e6){while(--_0xfd19e6){_0x499fa2['push'](_0x499fa2['shift']());}};_0x24e834(++_0x5b335e);}(_0xf280,0x113));var _0x0f28=function(_0x1fb1c1,_0x4ebe69){_0x1fb1c1=_0x1fb1c1-0x0;var _0x1622df=_0xf280[_0x1fb1c1];return _0x1622df;};'use strict';var _=require(_0x0f28('0x0'));var util=require('util');var moment=require(_0x0f28('0x1'));var BPromise=require(_0x0f28('0x2'));var rs=require(_0x0f28('0x3'));var fs=require('fs');var Redis=require(_0x0f28('0x4'));var db=require(_0x0f28('0x5'))['db'];var utils=require(_0x0f28('0x6'));var logger=require('../../config/logger')(_0x0f28('0x7'));var config=require(_0x0f28('0x8'));var jayson=require(_0x0f28('0x9'));var client=jayson[_0x0f28('0xa')][_0x0f28('0xb')]({'port':0x232a});config[_0x0f28('0xc')]=_[_0x0f28('0xd')](config[_0x0f28('0xc')],{'host':_0x0f28('0xe'),'port':0x18eb});var socket=require(_0x0f28('0xf'))(new Redis(config[_0x0f28('0xc')]));require('./faxMessage.socket')[_0x0f28('0x10')](socket);function respondWithRpcPromise(_0xf760cd,_0x1fbd0d,_0x3badba){return new BPromise(function(_0x91821c,_0x5246cb){return client[_0x0f28('0x11')](_0xf760cd,_0x3badba)[_0x0f28('0x12')](function(_0x1ffeab){logger[_0x0f28('0x13')](_0x0f28('0x14'),_0x1fbd0d,'request\x20sent');logger[_0x0f28('0x15')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x1fbd0d,_0x0f28('0x16'),JSON['stringify'](_0x1ffeab));if(_0x1ffeab[_0x0f28('0x17')]){if(_0x1ffeab['error']['code']===0x1f4){logger['error'](_0x0f28('0x14'),_0x1fbd0d,_0x1ffeab[_0x0f28('0x17')]['message']);return _0x5246cb(_0x1ffeab['error'][_0x0f28('0x18')]);}logger[_0x0f28('0x17')]('FaxMessage,\x20%s,\x20%s',_0x1fbd0d,_0x1ffeab[_0x0f28('0x17')][_0x0f28('0x18')]);return _0x91821c(_0x1ffeab['error'][_0x0f28('0x18')]);}else{logger[_0x0f28('0x13')](_0x0f28('0x14'),_0x1fbd0d,_0x0f28('0x16'));_0x91821c(_0x1ffeab[_0x0f28('0x19')][_0x0f28('0x18')]);}})['catch'](function(_0x24b4d0){logger['error'](_0x0f28('0x14'),_0x1fbd0d,_0x24b4d0);_0x5246cb(_0x24b4d0);});});}exports[_0x0f28('0x1a')]=function(_0x3c234e){var _0x28f243=this;return new Promise(function(_0x4888e9,_0x2cace8){return db[_0x0f28('0x1b')][_0x0f28('0x1c')](_0x3c234e['body'],{'raw':_0x3c234e[_0x0f28('0x1d')]?_0x3c234e[_0x0f28('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x0f28('0x12')](function(_0x4c6d67){logger['info']('CreateFaxMessage',_0x3c234e);logger[_0x0f28('0x15')](_0x0f28('0x1a'),_0x3c234e,JSON[_0x0f28('0x1e')](_0x4c6d67));_0x4888e9(_0x4c6d67);})[_0x0f28('0x1f')](function(_0x444382){logger[_0x0f28('0x17')](_0x0f28('0x1a'),_0x444382[_0x0f28('0x18')],_0x3c234e);_0x2cace8(_0x28f243[_0x0f28('0x17')](0x1f4,_0x444382[_0x0f28('0x18')]));});});};exports[_0x0f28('0x20')]=function(_0x3cde8b){var _0x4c663e=this;return new Promise(function(_0x284a8a,_0x11baae){return db[_0x0f28('0x1b')][_0x0f28('0x21')](_0x3cde8b[_0x0f28('0x22')],{'raw':_0x3cde8b['options']?_0x3cde8b['options'][_0x0f28('0x23')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3cde8b[_0x0f28('0x1d')]?_0x3cde8b['options'][_0x0f28('0x24')]||null:null,'attributes':_0x3cde8b[_0x0f28('0x1d')]?_0x3cde8b['options']['attributes']||null:null,'limit':_0x3cde8b[_0x0f28('0x1d')]?_0x3cde8b['options'][_0x0f28('0x25')]||null:null})[_0x0f28('0x12')](function(_0x40ea2a){logger[_0x0f28('0x13')](_0x0f28('0x20'),_0x3cde8b);logger[_0x0f28('0x15')](_0x0f28('0x20'),_0x3cde8b,JSON[_0x0f28('0x1e')](_0x40ea2a));_0x284a8a(_0x40ea2a);})[_0x0f28('0x1f')](function(_0x48515e){logger['error'](_0x0f28('0x20'),_0x48515e[_0x0f28('0x18')],_0x3cde8b);_0x11baae(_0x4c663e[_0x0f28('0x17')](0x1f4,_0x48515e[_0x0f28('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index 4823390..662eff1 100644 --- a/server/api/faxMessage/faxMessage.socket.js +++ b/server/api/faxMessage/faxMessage.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['register','length','faxMessage:','./faxMessage.events','save','remove','update','emit','removeListener'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var FaxMessageEvents=require(_0x7995('0x0'));var events=[_0x7995('0x1'),_0x7995('0x2'),_0x7995('0x3')];function createListener(_0x5b96eb,_0x86c128){return function(_0x3c58eb){_0x86c128[_0x7995('0x4')](_0x5b96eb,_0x3c58eb);};}function removeListener(_0x462a03,_0x576d89){return function(){FaxMessageEvents[_0x7995('0x5')](_0x462a03,_0x576d89);};}exports[_0x7995('0x6')]=function(_0x137b6b){for(var _0x219534=0x0,_0xbda126=events[_0x7995('0x7')];_0x219534<_0xbda126;_0x219534++){var _0x4996ca=events[_0x219534];var _0x465276=createListener(_0x7995('0x8')+_0x4996ca,_0x137b6b);FaxMessageEvents['on'](_0x4996ca,_0x465276);}}; \ No newline at end of file +var _0x9957=['register','length','faxMessage:','./faxMessage.events','save','remove','update','emit','removeListener'];(function(_0x1139d0,_0x41e5f8){var _0xcc01a6=function(_0x504ffa){while(--_0x504ffa){_0x1139d0['push'](_0x1139d0['shift']());}};_0xcc01a6(++_0x41e5f8);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var FaxMessageEvents=require(_0x7995('0x0'));var events=[_0x7995('0x1'),_0x7995('0x2'),_0x7995('0x3')];function createListener(_0x5b96eb,_0x86c128){return function(_0x3c58eb){_0x86c128[_0x7995('0x4')](_0x5b96eb,_0x3c58eb);};}function removeListener(_0x462a03,_0x576d89){return function(){FaxMessageEvents[_0x7995('0x5')](_0x462a03,_0x576d89);};}exports[_0x7995('0x6')]=function(_0x137b6b){for(var _0x219534=0x0,_0xbda126=events[_0x7995('0x7')];_0x219534<_0xbda126;_0x219534++){var _0x4996ca=events[_0x219534];var _0x465276=createListener(_0x7995('0x8')+_0x4996ca,_0x137b6b);FaxMessageEvents['on'](_0x4996ca,_0x465276);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index 888d9e7..b8afcfa 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 _0x0df9=['accept','/:id/reject','destroy','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxMessage.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/download','download','post','faxmessage:create','create','put','update','/:id/accept'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x0df9,0x170));var _0x90df=function(_0x371396,_0x1692aa){_0x371396=_0x371396-0x0;var _0x57c9a4=_0x0df9[_0x371396];return _0x57c9a4;};'use strict';var multer=require(_0x90df('0x0'));var util=require('util');var path=require(_0x90df('0x1'));var timeout=require(_0x90df('0x2'));var express=require('express');var router=express[_0x90df('0x3')]();var auth=require(_0x90df('0x4'));var interaction=require(_0x90df('0x5'));var config=require(_0x90df('0x6'));var controller=require(_0x90df('0x7'));router[_0x90df('0x8')]('/',auth[_0x90df('0x9')](),controller[_0x90df('0xa')]);router[_0x90df('0x8')](_0x90df('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0x90df('0x8')](_0x90df('0xc'),auth['isAuthenticated'](),controller[_0x90df('0xd')]);router[_0x90df('0x8')](_0x90df('0xe'),auth[_0x90df('0x9')](),controller[_0x90df('0xf')]);router[_0x90df('0x10')]('/',auth[_0x90df('0x9')](),interaction['tracked']('fax',_0x90df('0x11')),controller[_0x90df('0x12')]);router[_0x90df('0x13')](_0x90df('0xc'),auth['isAuthenticated'](),controller[_0x90df('0x14')]);router[_0x90df('0x13')](_0x90df('0x15'),auth[_0x90df('0x9')](),controller[_0x90df('0x16')]);router['put'](_0x90df('0x17'),auth[_0x90df('0x9')](),controller['reject']);router['delete'](_0x90df('0xc'),auth[_0x90df('0x9')](),controller[_0x90df('0x18')]);module[_0x90df('0x19')]=router; \ No newline at end of file +var _0xca41=['describe','/:id','show','/:id/download','download','post','tracked','fax','faxmessage:create','create','update','put','accept','/:id/reject','reject','delete','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0xca41,0x129));var _0x1ca4=function(_0x21d4b0,_0x23f87c){_0x21d4b0=_0x21d4b0-0x0;var _0x406ecc=_0xca41[_0x21d4b0];return _0x406ecc;};'use strict';var multer=require(_0x1ca4('0x0'));var util=require('util');var path=require(_0x1ca4('0x1'));var timeout=require(_0x1ca4('0x2'));var express=require(_0x1ca4('0x3'));var router=express[_0x1ca4('0x4')]();var auth=require(_0x1ca4('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x1ca4('0x6'));var controller=require('./faxMessage.controller');router[_0x1ca4('0x7')]('/',auth[_0x1ca4('0x8')](),controller[_0x1ca4('0x9')]);router['get'](_0x1ca4('0xa'),auth[_0x1ca4('0x8')](),controller[_0x1ca4('0xb')]);router[_0x1ca4('0x7')](_0x1ca4('0xc'),auth[_0x1ca4('0x8')](),controller[_0x1ca4('0xd')]);router[_0x1ca4('0x7')](_0x1ca4('0xe'),auth[_0x1ca4('0x8')](),controller[_0x1ca4('0xf')]);router[_0x1ca4('0x10')]('/',auth[_0x1ca4('0x8')](),interaction[_0x1ca4('0x11')](_0x1ca4('0x12'),_0x1ca4('0x13')),controller[_0x1ca4('0x14')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x1ca4('0x15')]);router[_0x1ca4('0x16')]('/:id/accept',auth['isAuthenticated'](),controller[_0x1ca4('0x17')]);router[_0x1ca4('0x16')](_0x1ca4('0x18'),auth['isAuthenticated'](),controller[_0x1ca4('0x19')]);router[_0x1ca4('0x1a')](_0x1ca4('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x1ca4('0x1b')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index a218ede..875c39f 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 _0x5909=['ENUM','beepall','roundrobin','sequelize','exports','STRING','name','INTEGER'];(function(_0x71c597,_0x3d7109){var _0xae9ab5=function(_0x5b3a8d){while(--_0x5b3a8d){_0x71c597['push'](_0x71c597['shift']());}};_0xae9ab5(++_0x3d7109);}(_0x5909,0x73));var _0x9590=function(_0xa1e3ca,_0x559022){_0xa1e3ca=_0xa1e3ca-0x0;var _0x5005ab=_0x5909[_0xa1e3ca];return _0x5005ab;};'use strict';var Sequelize=require(_0x9590('0x0'));module[_0x9590('0x1')]={'name':{'type':Sequelize[_0x9590('0x2')],'unique':_0x9590('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x9590('0x2')]},'timeout':{'type':Sequelize[_0x9590('0x4')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x9590('0x5')]('rrmemory',_0x9590('0x6'),_0x9590('0x7')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x9590('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0xf410=['INTEGER','ENUM','rrmemory','roundrobin','sequelize','exports','STRING'];(function(_0x4f9b18,_0x2cb5ca){var _0x29f20c=function(_0x268b3d){while(--_0x268b3d){_0x4f9b18['push'](_0x4f9b18['shift']());}};_0x29f20c(++_0x2cb5ca);}(_0xf410,0x14d));var _0x0f41=function(_0x447568,_0x59a2be){_0x447568=_0x447568-0x0;var _0x32d413=_0xf410[_0x447568];return _0x32d413;};'use strict';var Sequelize=require(_0x0f41('0x0'));module[_0x0f41('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x0f41('0x2')]},'timeout':{'type':Sequelize[_0x0f41('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x0f41('0x4')](_0x0f41('0x5'),'beepall',_0x0f41('0x6')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x0f41('0x3')],'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 755c32f..39830df 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 _0xad07=['rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','limit','order','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','describe','getMembers','findOne','UserFaxQueue','hasOwnProperty','sort','FaxQueueId','User','UserId','agent','faxPause','updatedAt','createdAt','rows','format','SIP','getTeams','Team','addTeams','ids','Agents','online','voicePause','interface','flatMap','transaction','each','forEach','emit','removeTeams','field','tq.TeamId','from','team_has_fax_queues','join','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','push','sequelize','QueryTypes','every','TeamId','includes','all','union','compact','value','removeAgents','userFaxQueue:remove','addAgents','omit','spread','userFaxQueue:save','isArray','getAgents','pick','html-pdf','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','sox','lodash','squel','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./faxQueue.socket','register','sendStatus','status','end','count','offset','Content-Range','json','save','then','get','FaxQueues','UserProfileResource','error','stack','name','index','map','FaxQueue'];(function(_0x36cd25,_0x1eec5b){var _0x3077c3=function(_0xfbf50){while(--_0xfbf50){_0x36cd25['push'](_0x36cd25['shift']());}};_0x3077c3(++_0x1eec5b);}(_0xad07,0xe3));var _0x7ad0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xad07[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x7ad0('0x0'));var emlformat=require(_0x7ad0('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x7ad0('0x2'));var jsonpatch=require(_0x7ad0('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x7ad0('0x4'));var Mustache=require(_0x7ad0('0x5'));var util=require(_0x7ad0('0x6'));var path=require('path');var sox=require(_0x7ad0('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x7ad0('0x8'));var squel=require(_0x7ad0('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x7ad0('0xa'));var toCsv=require(_0x7ad0('0xb'));var querystring=require('querystring');var Papa=require(_0x7ad0('0xc'));var Redis=require(_0x7ad0('0xd'));var authService=require(_0x7ad0('0xe'));var qs=require(_0x7ad0('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7ad0('0x10'));var logger=require(_0x7ad0('0x11'))(_0x7ad0('0x12'));var utils=require(_0x7ad0('0x13'));var config=require(_0x7ad0('0x14'));var db=require(_0x7ad0('0x15'))['db'];config[_0x7ad0('0x16')]=_[_0x7ad0('0x17')](config[_0x7ad0('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0x7ad0('0x18'))(new Redis(config[_0x7ad0('0x16')]));require(_0x7ad0('0x19'))[_0x7ad0('0x1a')](socket);function respondWithStatusCode(_0x51fed3,_0x53cdff){_0x53cdff=_0x53cdff||0xcc;return function(_0x13bbb0){if(_0x13bbb0){return _0x51fed3[_0x7ad0('0x1b')](_0x53cdff);}return _0x51fed3[_0x7ad0('0x1c')](_0x53cdff)[_0x7ad0('0x1d')]();};}function respondWithResult(_0xebb4da,_0x901908){_0x901908=_0x901908||0xc8;return function(_0x11268b){if(_0x11268b){return _0xebb4da[_0x7ad0('0x1c')](_0x901908)['json'](_0x11268b);}};}function respondWithFilteredResult(_0x2286fa,_0x40fa9c){return function(_0x4bf612){if(_0x4bf612){var _0x4f45e4=_0x4bf612[_0x7ad0('0x1e')],_0x412578=_0x40fa9c['offset'],_0x4f9d6b=_0x40fa9c[_0x7ad0('0x1f')]+_0x40fa9c['limit'],_0x2dae00;if(_0x4f9d6b>=_0x4f45e4){_0x4f9d6b=_0x4f45e4;_0x2dae00=0xc8;}else{_0x2dae00=0xce;}_0x2286fa[_0x7ad0('0x1c')](_0x2dae00);return _0x2286fa['set'](_0x7ad0('0x20'),_0x412578+'-'+_0x4f9d6b+'/'+_0x4f45e4)[_0x7ad0('0x21')](_0x4bf612);}return null;};}function patchUpdates(_0x1c5c7c){return function(_0x1e163a){try{jsonpatch['apply'](_0x1e163a,_0x1c5c7c,!![]);}catch(_0xfbe5c5){return BPromise['reject'](_0xfbe5c5);}return _0x1e163a[_0x7ad0('0x22')]();};}function saveUpdates(_0x304054,_0x5df5c8){return function(_0x382505){if(_0x382505){return _0x382505['update'](_0x304054)['then'](function(_0x4be2a0){return _0x4be2a0;});}return null;};}function removeEntity(_0x1d9a26,_0x4fbe51){return function(_0x35c035){if(_0x35c035){return _0x35c035['destroy']()[_0x7ad0('0x23')](function(){var _0x41a16a=_0x35c035[_0x7ad0('0x24')]({'plain':!![]});var _0x319644=_0x7ad0('0x25');return db[_0x7ad0('0x26')]['destroy']({'where':{'type':_0x319644,'resourceId':_0x41a16a['id']}})[_0x7ad0('0x23')](function(){return _0x35c035;});})[_0x7ad0('0x23')](function(){_0x1d9a26[_0x7ad0('0x1c')](0xcc)[_0x7ad0('0x1d')]();});}};}function handleEntityNotFound(_0x368931,_0x116e11){return function(_0x1f9a7f){if(!_0x1f9a7f){_0x368931[_0x7ad0('0x1b')](0x194);}return _0x1f9a7f;};}function handleError(_0x50cb16,_0x5196df){_0x5196df=_0x5196df||0x1f4;return function(_0x2b2e49){logger[_0x7ad0('0x27')](_0x2b2e49[_0x7ad0('0x28')]);if(_0x2b2e49[_0x7ad0('0x29')]){delete _0x2b2e49[_0x7ad0('0x29')];}_0x50cb16['status'](_0x5196df)['send'](_0x2b2e49);};}exports[_0x7ad0('0x2a')]=function(_0x1b4028,_0x2b497b){var _0x30bf59={},_0x14b021={},_0x3b471a={'count':0x0,'rows':[]};var _0x11592c=_[_0x7ad0('0x2b')](db[_0x7ad0('0x2c')][_0x7ad0('0x2d')],function(_0x5d52f1){return{'name':_0x5d52f1['fieldName'],'type':_0x5d52f1[_0x7ad0('0x2e')][_0x7ad0('0x2f')]};});_0x14b021[_0x7ad0('0x30')]=_[_0x7ad0('0x2b')](_0x11592c,_0x7ad0('0x29'));_0x14b021[_0x7ad0('0x31')]=_[_0x7ad0('0x32')](_0x1b4028[_0x7ad0('0x31')]);_0x14b021[_0x7ad0('0x33')]=_[_0x7ad0('0x34')](_0x14b021[_0x7ad0('0x30')],_0x14b021[_0x7ad0('0x31')]);_0x30bf59[_0x7ad0('0x35')]=_['intersection'](_0x14b021[_0x7ad0('0x30')],qs[_0x7ad0('0x36')](_0x1b4028[_0x7ad0('0x31')][_0x7ad0('0x36')]));_0x30bf59[_0x7ad0('0x35')]=_0x30bf59[_0x7ad0('0x35')][_0x7ad0('0x37')]?_0x30bf59[_0x7ad0('0x35')]:_0x14b021[_0x7ad0('0x30')];if(!_0x1b4028[_0x7ad0('0x31')]['hasOwnProperty'](_0x7ad0('0x38'))){_0x30bf59['limit']=qs[_0x7ad0('0x39')](_0x1b4028[_0x7ad0('0x31')][_0x7ad0('0x39')]);_0x30bf59['offset']=qs[_0x7ad0('0x1f')](_0x1b4028[_0x7ad0('0x31')][_0x7ad0('0x1f')]);}_0x30bf59[_0x7ad0('0x3a')]=qs['sort'](_0x1b4028[_0x7ad0('0x31')]['sort']);_0x30bf59['where']=qs[_0x7ad0('0x33')](_['pick'](_0x1b4028['query'],_0x14b021[_0x7ad0('0x33')]));if(_0x1b4028[_0x7ad0('0x31')][_0x7ad0('0x3b')]){_0x30bf59[_0x7ad0('0x3c')]=_[_0x7ad0('0x3d')](_0x30bf59[_0x7ad0('0x3c')],{'$or':_['map'](_0x11592c,function(_0x448962){if(_0x448962[_0x7ad0('0x2e')]!==_0x7ad0('0x3e')){var _0x589ca7={};_0x589ca7[_0x448962[_0x7ad0('0x29')]]={'$like':'%'+_0x1b4028[_0x7ad0('0x31')][_0x7ad0('0x3b')]+'%'};return _0x589ca7;}})});}_0x30bf59=_['merge']({},_0x30bf59,_0x1b4028[_0x7ad0('0x3f')]);var _0x443109={'where':_0x30bf59[_0x7ad0('0x3c')]};return db['FaxQueue']['count'](_0x443109)[_0x7ad0('0x23')](function(_0x2290e3){_0x3b471a['count']=_0x2290e3;if(_0x1b4028['query'][_0x7ad0('0x40')]){_0x30bf59[_0x7ad0('0x41')]=[{'all':!![]}];}return db[_0x7ad0('0x2c')][_0x7ad0('0x42')](_0x30bf59);})['then'](function(_0x52e773){_0x3b471a['rows']=_0x52e773;return _0x3b471a;})[_0x7ad0('0x23')](respondWithFilteredResult(_0x2b497b,_0x30bf59))[_0x7ad0('0x43')](handleError(_0x2b497b,null));};exports[_0x7ad0('0x44')]=function(_0xceeda9,_0x4f81d7){var _0xeb3c3={'raw':!![],'where':{'id':_0xceeda9['params']['id']}},_0x2f6a95={};_0x2f6a95['model']=_[_0x7ad0('0x32')](db['FaxQueue']['rawAttributes']);_0x2f6a95[_0x7ad0('0x31')]=_[_0x7ad0('0x32')](_0xceeda9[_0x7ad0('0x31')]);_0x2f6a95[_0x7ad0('0x33')]=_[_0x7ad0('0x34')](_0x2f6a95[_0x7ad0('0x30')],_0x2f6a95[_0x7ad0('0x31')]);_0xeb3c3['attributes']=_[_0x7ad0('0x34')](_0x2f6a95['model'],qs['fields'](_0xceeda9[_0x7ad0('0x31')][_0x7ad0('0x36')]));_0xeb3c3[_0x7ad0('0x35')]=_0xeb3c3[_0x7ad0('0x35')][_0x7ad0('0x37')]?_0xeb3c3[_0x7ad0('0x35')]:_0x2f6a95[_0x7ad0('0x30')];if(_0xceeda9[_0x7ad0('0x31')]['includeAll']){_0xeb3c3[_0x7ad0('0x41')]=[{'all':!![]}];}_0xeb3c3=_[_0x7ad0('0x3d')]({},_0xeb3c3,_0xceeda9[_0x7ad0('0x3f')]);return db[_0x7ad0('0x2c')][_0x7ad0('0x45')](_0xeb3c3)[_0x7ad0('0x23')](handleEntityNotFound(_0x4f81d7,null))[_0x7ad0('0x23')](respondWithResult(_0x4f81d7,null))[_0x7ad0('0x43')](handleError(_0x4f81d7,null));};exports[_0x7ad0('0x46')]=function(_0x23b613,_0x4e4139){return db['FaxQueue'][_0x7ad0('0x46')](_0x23b613[_0x7ad0('0x47')],{})[_0x7ad0('0x23')](function(_0x3a99b0){var _0x3018ca=_0x23b613[_0x7ad0('0x48')][_0x7ad0('0x24')]({'plain':!![]});if(!_0x3018ca)throw new Error(_0x7ad0('0x49'));if(_0x3018ca[_0x7ad0('0x4a')]===_0x7ad0('0x48')){var _0x4ea6d6=_0x3a99b0[_0x7ad0('0x24')]({'plain':!![]});var _0x21b05b=_0x7ad0('0x25');return db['UserProfileSection'][_0x7ad0('0x45')]({'where':{'name':_0x21b05b,'userProfileId':_0x3018ca[_0x7ad0('0x4b')]},'raw':!![]})[_0x7ad0('0x23')](function(_0x32933a){if(_0x32933a&&_0x32933a[_0x7ad0('0x4c')]===0x0){return db[_0x7ad0('0x26')][_0x7ad0('0x46')]({'name':_0x4ea6d6['name'],'resourceId':_0x4ea6d6['id'],'type':_0x32933a[_0x7ad0('0x29')],'sectionId':_0x32933a['id']},{})[_0x7ad0('0x23')](function(){return _0x3a99b0;});}else{return _0x3a99b0;}})[_0x7ad0('0x43')](function(_0x5be54c){logger['error'](_0x7ad0('0x4d'),_0x5be54c);throw _0x5be54c;});}return _0x3a99b0;})[_0x7ad0('0x23')](respondWithResult(_0x4e4139,0xc9))[_0x7ad0('0x43')](handleError(_0x4e4139,null));};exports[_0x7ad0('0x4e')]=function(_0x234708,_0x36418a){if(_0x234708[_0x7ad0('0x47')]['id']){delete _0x234708[_0x7ad0('0x47')]['id'];}return db[_0x7ad0('0x2c')][_0x7ad0('0x45')]({'where':{'id':_0x234708['params']['id']}})[_0x7ad0('0x23')](handleEntityNotFound(_0x36418a,null))[_0x7ad0('0x23')](saveUpdates(_0x234708[_0x7ad0('0x47')],null))['then'](respondWithResult(_0x36418a,null))[_0x7ad0('0x43')](handleError(_0x36418a,null));};exports['destroy']=function(_0x4caad5,_0x9729f5){return db['FaxQueue']['find']({'where':{'id':_0x4caad5[_0x7ad0('0x4f')]['id']}})[_0x7ad0('0x23')](handleEntityNotFound(_0x9729f5,null))[_0x7ad0('0x23')](removeEntity(_0x9729f5,null))[_0x7ad0('0x43')](handleError(_0x9729f5,null));};exports['describe']=function(_0x36b3d1,_0x2b10df){return db[_0x7ad0('0x2c')][_0x7ad0('0x50')]()[_0x7ad0('0x23')](respondWithResult(_0x2b10df,null))[_0x7ad0('0x43')](handleError(_0x2b10df,null));};exports[_0x7ad0('0x51')]=function(_0x527bb2,_0x507f09,_0x268f85){var _0xb45252={'raw':!![],'where':{}},_0x3516d9={},_0x51329d;return db['FaxQueue'][_0x7ad0('0x52')]({'where':{'id':_0x527bb2[_0x7ad0('0x4f')]['id']}})[_0x7ad0('0x23')](handleEntityNotFound(_0x507f09,null))['then'](function(_0x54afe3){if(_0x54afe3){_0x51329d=_0x54afe3[_0x7ad0('0x24')]({'plain':!![]});_0x3516d9[_0x7ad0('0x30')]=_[_0x7ad0('0x32')](db[_0x7ad0('0x53')][_0x7ad0('0x2d')]);_0x3516d9['query']=_[_0x7ad0('0x32')](_0x527bb2[_0x7ad0('0x31')]);_0x3516d9[_0x7ad0('0x33')]=_[_0x7ad0('0x34')](_0x3516d9['model'],_0x3516d9[_0x7ad0('0x31')]);_0xb45252[_0x7ad0('0x35')]=_[_0x7ad0('0x34')](_0x3516d9[_0x7ad0('0x30')],qs[_0x7ad0('0x36')](_0x527bb2['query']['fields']));_0xb45252[_0x7ad0('0x35')]=_0xb45252[_0x7ad0('0x35')]['length']?_0xb45252[_0x7ad0('0x35')]:_0x3516d9[_0x7ad0('0x30')];if(!_0x527bb2[_0x7ad0('0x31')][_0x7ad0('0x54')](_0x7ad0('0x38'))){_0xb45252['limit']=qs[_0x7ad0('0x39')](_0x527bb2['query'][_0x7ad0('0x39')]);_0xb45252[_0x7ad0('0x1f')]=qs[_0x7ad0('0x1f')](_0x527bb2[_0x7ad0('0x31')][_0x7ad0('0x1f')]);}_0xb45252[_0x7ad0('0x3a')]=qs[_0x7ad0('0x55')](_0x527bb2[_0x7ad0('0x31')]['sort']);_0xb45252[_0x7ad0('0x3c')]=qs[_0x7ad0('0x33')](_['pick'](_0x527bb2[_0x7ad0('0x31')],_0x3516d9[_0x7ad0('0x33')]));_0xb45252['where'][_0x7ad0('0x56')]=_0x54afe3['id'];if(_0x527bb2['query']['filter']){_0xb45252['where']=_[_0x7ad0('0x3d')](_0xb45252[_0x7ad0('0x3c')],{'$or':_['map'](_0xb45252[_0x7ad0('0x35')],function(_0x41a837){var _0x4fc932={};_0x4fc932[_0x41a837]={'$like':'%'+_0x527bb2[_0x7ad0('0x31')]['filter']+'%'};return _0x4fc932;})});}_0xb45252=_[_0x7ad0('0x3d')]({},_0xb45252,_0x527bb2['options']);return db[_0x7ad0('0x53')]['findAll'](_0xb45252);}})[_0x7ad0('0x23')](function(_0x5d1451){if(_0x5d1451){return db[_0x7ad0('0x57')]['findAndCountAll']({'where':{'id':_[_0x7ad0('0x2b')](_0x5d1451,_0x7ad0('0x58')),'role':_0x7ad0('0x59')},'attributes':['id',_0x7ad0('0x29'),_0x7ad0('0x5a'),_0x7ad0('0x5b'),_0x7ad0('0x5c')]});}})[_0x7ad0('0x23')](function(_0x264a99){if(_0x264a99){return{'count':_0x264a99[_0x7ad0('0x1e')],'rows':_[_0x7ad0('0x2b')](_0x264a99[_0x7ad0('0x5d')],function(_0x268162){return{'membername':_0x268162[_0x7ad0('0x29')],'UserId':_0x268162['id'],'queue_name':_0x51329d[_0x7ad0('0x29')],'FaxQueueId':_0x51329d['id'],'interface':util[_0x7ad0('0x5e')]('%s/%s',_0x7ad0('0x5f'),_0x268162['name']),'penalty':0x0,'paused':_0x268162[_0x7ad0('0x5a')],'createdAt':_0x268162[_0x7ad0('0x5c')],'updatedAt':_0x268162[_0x7ad0('0x5b')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x7ad0('0x23')](respondWithFilteredResult(_0x507f09,_0xb45252))[_0x7ad0('0x43')](handleError(_0x507f09,null));};exports[_0x7ad0('0x60')]=function(_0x5cd870,_0x5d4f16,_0x2f80e6){var _0x3231a8={};var _0x3084c7={};var _0x36744c;var _0x13fa09;return db[_0x7ad0('0x2c')]['findOne']({'where':{'id':_0x5cd870[_0x7ad0('0x4f')]['id']}})[_0x7ad0('0x23')](handleEntityNotFound(_0x5d4f16,null))[_0x7ad0('0x23')](function(_0x275700){if(_0x275700){_0x36744c=_0x275700;_0x3084c7[_0x7ad0('0x30')]=_[_0x7ad0('0x32')](db[_0x7ad0('0x61')]['rawAttributes']);_0x3084c7[_0x7ad0('0x31')]=_[_0x7ad0('0x32')](_0x5cd870[_0x7ad0('0x31')]);_0x3084c7['filters']=_[_0x7ad0('0x34')](_0x3084c7['model'],_0x3084c7[_0x7ad0('0x31')]);_0x3231a8[_0x7ad0('0x35')]=_['intersection'](_0x3084c7[_0x7ad0('0x30')],qs[_0x7ad0('0x36')](_0x5cd870[_0x7ad0('0x31')]['fields']));_0x3231a8[_0x7ad0('0x35')]=_0x3231a8['attributes']['length']?_0x3231a8[_0x7ad0('0x35')]:_0x3084c7['model'];_0x3231a8[_0x7ad0('0x3a')]=qs['sort'](_0x5cd870['query'][_0x7ad0('0x55')]);_0x3231a8[_0x7ad0('0x3c')]=qs[_0x7ad0('0x33')](_['pick'](_0x5cd870['query'],_0x3084c7[_0x7ad0('0x33')]));if(_0x5cd870[_0x7ad0('0x31')][_0x7ad0('0x3b')]){_0x3231a8['where']=_['merge'](_0x3231a8['where'],{'$or':_['map'](_0x3231a8[_0x7ad0('0x35')],function(_0x5c3bfc){var _0x3ff980={};_0x3ff980[_0x5c3bfc]={'$like':'%'+_0x5cd870[_0x7ad0('0x31')][_0x7ad0('0x3b')]+'%'};return _0x3ff980;})});}_0x3231a8=_[_0x7ad0('0x3d')]({},_0x3231a8,_0x5cd870[_0x7ad0('0x3f')]);return _0x36744c[_0x7ad0('0x60')](_0x3231a8);}})[_0x7ad0('0x23')](function(_0x278da8){if(_0x278da8){_0x13fa09=_0x278da8[_0x7ad0('0x37')];if(!_0x5cd870[_0x7ad0('0x31')]['hasOwnProperty']('nolimit')){_0x3231a8[_0x7ad0('0x39')]=qs[_0x7ad0('0x39')](_0x5cd870['query'][_0x7ad0('0x39')]);_0x3231a8[_0x7ad0('0x1f')]=qs[_0x7ad0('0x1f')](_0x5cd870[_0x7ad0('0x31')][_0x7ad0('0x1f')]);}return _0x36744c[_0x7ad0('0x60')](_0x3231a8);}})[_0x7ad0('0x23')](function(_0x1993b2){if(_0x1993b2){return _0x1993b2?{'count':_0x13fa09,'rows':_0x1993b2}:null;}})['then'](respondWithResult(_0x5d4f16,null))[_0x7ad0('0x43')](handleError(_0x5d4f16,null));};exports[_0x7ad0('0x62')]=function(_0x323753,_0x435368,_0x772a){var _0x3379fd=_0x323753[_0x7ad0('0x47')][_0x7ad0('0x63')];return db[_0x7ad0('0x61')]['findAll']({'where':{'id':_0x3379fd},'attributes':['id'],'include':[{'model':db[_0x7ad0('0x57')],'as':_0x7ad0('0x64'),'attributes':['id','name',_0x7ad0('0x65'),_0x7ad0('0x66'),_0x7ad0('0x67')],'raw':!![]}]})[_0x7ad0('0x23')](function(_0x8c78cb){if(_0x8c78cb){var _0x1d7ff9=_[_0x7ad0('0x68')](_0x8c78cb,function(_0xe4aa31){var _0x2a2d09=_0xe4aa31['get']({'plain':!![]});return _0x2a2d09[_0x7ad0('0x64')];});return db[_0x7ad0('0x2c')][_0x7ad0('0x45')]({'where':{'id':_0x323753[_0x7ad0('0x4f')]['id']}})[_0x7ad0('0x23')](function(_0x51dd38){return db['sequelize'][_0x7ad0('0x69')](function(_0xabeb23){return _0x51dd38[_0x7ad0('0x62')](_0x3379fd,{'transaction':_0xabeb23})[_0x7ad0('0x23')](function(){return BPromise[_0x7ad0('0x6a')](_0x1d7ff9,function(_0x17e2b2){return db[_0x7ad0('0x53')]['findOrCreate']({'where':{'UserId':_0x17e2b2['id'],'FaxQueueId':_0x323753[_0x7ad0('0x4f')]['id']},'transaction':_0xabeb23});});})[_0x7ad0('0x23')](function(){_0x1d7ff9[_0x7ad0('0x6b')](function(_0x42b625){socket[_0x7ad0('0x6c')]('userFaxQueue:save',{'UserId':_0x42b625['id'],'FaxQueueId':_0x51dd38['id']});});});});});}})[_0x7ad0('0x23')](respondWithStatusCode(_0x435368,null))[_0x7ad0('0x43')](handleError(_0x435368,null));};exports[_0x7ad0('0x6d')]=function(_0x341964,_0xfb56d4,_0x574a8e){return db[_0x7ad0('0x61')][_0x7ad0('0x42')]({'where':{'id':_0x341964[_0x7ad0('0x31')][_0x7ad0('0x63')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x7ad0('0x64'),'attributes':['id'],'raw':!![]}]})[_0x7ad0('0x23')](handleEntityNotFound(_0xfb56d4,null))[_0x7ad0('0x23')](function(_0x49df54){var _0x3df1a7=_['map'](_0x49df54,'id');var _0x5ac2a6=[];var _0x50ae71=[];var _0x49c8dd=squel['select']();_0x49c8dd[_0x7ad0('0x6e')](_0x7ad0('0x6f'))[_0x7ad0('0x70')](_0x7ad0('0x71'),'tq')[_0x7ad0('0x72')]('user_has_teams','ut',_0x7ad0('0x73'))[_0x7ad0('0x3c')]('FaxQueueId\x20=\x20?',_0x341964[_0x7ad0('0x4f')]['id']);for(var _0x27d10b=0x0;_0x27d10b<_0x49df54['length'];_0x27d10b+=0x1){let _0x5b14b5=_0x49df54[_0x27d10b];for(var _0x14226f=0x0;_0x14226f<_0x5b14b5[_0x7ad0('0x64')][_0x7ad0('0x37')];_0x14226f+=0x1){let _0x50e83a=_0x5b14b5[_0x7ad0('0x64')][_0x14226f];var _0x5423d0=_0x49c8dd['clone']();_0x5423d0[_0x7ad0('0x3c')](_0x7ad0('0x74'),_0x50e83a['id']);_0x50ae71[_0x7ad0('0x75')](db[_0x7ad0('0x76')][_0x7ad0('0x31')](_0x5423d0['toString'](),{'type':db[_0x7ad0('0x76')][_0x7ad0('0x77')]['SELECT']})[_0x7ad0('0x23')](function(_0x1fc7db){if(_0x1fc7db[_0x7ad0('0x37')]===0x1){return _0x50e83a['id'];}else{var _0x2ab9a0=_[_0x7ad0('0x78')](_[_0x7ad0('0x2b')](_0x1fc7db,_0x7ad0('0x79')),function(_0x293305){return _[_0x7ad0('0x7a')](_0x3df1a7,_0x293305);});if(_0x2ab9a0){return _0x50e83a['id'];}}}));}}return BPromise[_0x7ad0('0x7b')](_0x50ae71)['then'](function(_0x373359){_0x5ac2a6=_(_0x5ac2a6)[_0x7ad0('0x7c')](_0x373359)[_0x7ad0('0x7d')]()[_0x7ad0('0x7e')]();return db['FaxQueue']['find']({'where':{'id':_0x341964[_0x7ad0('0x4f')]['id']}})[_0x7ad0('0x23')](function(_0x4bef73){return db[_0x7ad0('0x76')][_0x7ad0('0x69')](function(_0x33979e){return _0x4bef73[_0x7ad0('0x6d')](_0x341964[_0x7ad0('0x31')][_0x7ad0('0x63')],{'transaction':_0x33979e})[_0x7ad0('0x23')](function(){if(!_['isEmpty'](_0x5ac2a6)){return _0x4bef73[_0x7ad0('0x7f')](_0x5ac2a6,{'transaction':_0x33979e});}})[_0x7ad0('0x23')](function(){_0x5ac2a6[_0x7ad0('0x6b')](function(_0x52b192){socket[_0x7ad0('0x6c')](_0x7ad0('0x80'),{'UserId':_0x52b192,'FaxQueueId':_0x4bef73['id']});});});});});});})[_0x7ad0('0x23')](respondWithStatusCode(_0xfb56d4,null))[_0x7ad0('0x43')](handleError(_0xfb56d4,null));};exports[_0x7ad0('0x81')]=function(_0x554895,_0x328f98,_0x3fecdc){return db[_0x7ad0('0x2c')]['find']({'where':{'id':_0x554895['params']['id']}})[_0x7ad0('0x23')](handleEntityNotFound(_0x328f98,null))[_0x7ad0('0x23')](function(_0x2efc0a){if(_0x2efc0a){return _0x2efc0a[_0x7ad0('0x81')](_0x554895['body'][_0x7ad0('0x63')],_[_0x7ad0('0x82')](_0x554895[_0x7ad0('0x47')],[_0x7ad0('0x63'),'id'])||{})[_0x7ad0('0x83')](function(_0x151c6){for(var _0x15b373=0x0;_0x15b373<_0x554895[_0x7ad0('0x47')][_0x7ad0('0x63')][_0x7ad0('0x37')];_0x15b373+=0x1){socket[_0x7ad0('0x6c')](_0x7ad0('0x84'),{'UserId':_0x554895[_0x7ad0('0x47')][_0x7ad0('0x63')][_0x15b373],'FaxQueueId':_0x554895[_0x7ad0('0x4f')]['id']});}return _0x151c6;});}})[_0x7ad0('0x23')](respondWithResult(_0x328f98,null))[_0x7ad0('0x43')](handleError(_0x328f98,null));};exports[_0x7ad0('0x7f')]=function(_0x380cb8,_0x29ca17,_0xb6ed44){return db[_0x7ad0('0x2c')][_0x7ad0('0x45')]({'where':{'id':_0x380cb8[_0x7ad0('0x4f')]['id']}})[_0x7ad0('0x23')](handleEntityNotFound(_0x29ca17,null))[_0x7ad0('0x23')](function(_0x410d19){if(_0x410d19){return _0x410d19[_0x7ad0('0x7f')](_0x380cb8[_0x7ad0('0x31')][_0x7ad0('0x63')])['then'](function(){if(_[_0x7ad0('0x85')](_0x380cb8[_0x7ad0('0x31')][_0x7ad0('0x63')])){for(var _0x5a4164=0x0;_0x5a4164<_0x380cb8[_0x7ad0('0x31')][_0x7ad0('0x63')][_0x7ad0('0x37')];_0x5a4164+=0x1){socket[_0x7ad0('0x6c')](_0x7ad0('0x80'),{'UserId':Number(_0x380cb8[_0x7ad0('0x31')][_0x7ad0('0x63')][_0x5a4164]),'FaxQueueId':Number(_0x380cb8[_0x7ad0('0x4f')]['id'])});}}else{socket[_0x7ad0('0x6c')](_0x7ad0('0x80'),{'UserId':Number(_0x380cb8[_0x7ad0('0x31')]['ids']),'FaxQueueId':Number(_0x380cb8[_0x7ad0('0x4f')]['id'])});}});}})[_0x7ad0('0x23')](respondWithStatusCode(_0x29ca17,null))['catch'](handleError(_0x29ca17,null));};exports[_0x7ad0('0x86')]=function(_0x11be8b,_0x53176c,_0xf2fcc0){var _0x51b1e8={};var _0x4e140f={};var _0x5be54f;var _0x3e669b;return db[_0x7ad0('0x2c')][_0x7ad0('0x52')]({'where':{'id':_0x11be8b[_0x7ad0('0x4f')]['id']}})[_0x7ad0('0x23')](handleEntityNotFound(_0x53176c,null))['then'](function(_0x51eb97){if(_0x51eb97){_0x5be54f=_0x51eb97;_0x4e140f[_0x7ad0('0x30')]=_['keys'](db[_0x7ad0('0x57')][_0x7ad0('0x2d')]);_0x4e140f[_0x7ad0('0x31')]=_['keys'](_0x11be8b['query']);_0x4e140f[_0x7ad0('0x33')]=_[_0x7ad0('0x34')](_0x4e140f[_0x7ad0('0x30')],_0x4e140f[_0x7ad0('0x31')]);_0x51b1e8['attributes']=_['intersection'](_0x4e140f[_0x7ad0('0x30')],qs[_0x7ad0('0x36')](_0x11be8b[_0x7ad0('0x31')][_0x7ad0('0x36')]));_0x51b1e8['attributes']=_0x51b1e8[_0x7ad0('0x35')]['length']?_0x51b1e8[_0x7ad0('0x35')]:_0x4e140f[_0x7ad0('0x30')];_0x51b1e8[_0x7ad0('0x3a')]=qs[_0x7ad0('0x55')](_0x11be8b['query'][_0x7ad0('0x55')]);_0x51b1e8['where']=qs[_0x7ad0('0x33')](_[_0x7ad0('0x87')](_0x11be8b[_0x7ad0('0x31')],_0x4e140f[_0x7ad0('0x33')]));if(_0x11be8b[_0x7ad0('0x31')][_0x7ad0('0x3b')]){_0x51b1e8[_0x7ad0('0x3c')]=_[_0x7ad0('0x3d')](_0x51b1e8[_0x7ad0('0x3c')],{'$or':_[_0x7ad0('0x2b')](_0x51b1e8[_0x7ad0('0x35')],function(_0x1128e4){var _0x1cb20={};_0x1cb20[_0x1128e4]={'$like':'%'+_0x11be8b['query'][_0x7ad0('0x3b')]+'%'};return _0x1cb20;})});}_0x51b1e8=_[_0x7ad0('0x3d')]({},_0x51b1e8,_0x11be8b[_0x7ad0('0x3f')]);return _0x5be54f[_0x7ad0('0x86')](_0x51b1e8);}})[_0x7ad0('0x23')](function(_0x478c42){if(_0x478c42){_0x3e669b=_0x478c42[_0x7ad0('0x37')];if(!_0x11be8b[_0x7ad0('0x31')][_0x7ad0('0x54')](_0x7ad0('0x38'))){_0x51b1e8['limit']=qs['limit'](_0x11be8b[_0x7ad0('0x31')][_0x7ad0('0x39')]);_0x51b1e8[_0x7ad0('0x1f')]=qs[_0x7ad0('0x1f')](_0x11be8b[_0x7ad0('0x31')][_0x7ad0('0x1f')]);}return _0x5be54f[_0x7ad0('0x86')](_0x51b1e8);}})[_0x7ad0('0x23')](function(_0xbad8b){if(_0xbad8b){return _0xbad8b?{'count':_0x3e669b,'rows':_0xbad8b}:null;}})[_0x7ad0('0x23')](respondWithResult(_0x53176c,null))[_0x7ad0('0x43')](handleError(_0x53176c,null));}; \ No newline at end of file +var _0xab23=['removeTeams','select','field','tq.TeamId','join','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','toString','QueryTypes','SELECT','every','TeamId','all','union','compact','value','isEmpty','removeAgents','userFaxQueue:remove','addAgents','omit','spread','isArray','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','ejs','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','defaults','redis','localhost','socket.io-emitter','./faxQueue.socket','register','sendStatus','end','status','json','offset','limit','Content-Range','apply','reject','save','update','then','destroy','get','FaxQueues','UserProfileResource','error','stack','name','map','FaxQueue','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','count','includeAll','include','rows','catch','show','params','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','findOne','UserFaxQueue','FaxQueueId','findAll','User','findAndCountAll','UserId','agent','createdAt','format','%s/%s','updatedAt','getTeams','Team','ids','voicePause','interface','flatMap','Agents','sequelize','transaction','addTeams','each','forEach','emit','userFaxQueue:save'];(function(_0x5201c0,_0x171649){var _0x11222a=function(_0x3c0499){while(--_0x3c0499){_0x5201c0['push'](_0x5201c0['shift']());}};_0x11222a(++_0x171649);}(_0xab23,0x1bc));var _0x3ab2=function(_0x5692d2,_0x4e7473){_0x5692d2=_0x5692d2-0x0;var _0x19d8ee=_0xab23[_0x5692d2];return _0x19d8ee;};'use strict';var pdf=require(_0x3ab2('0x0'));var emlformat=require(_0x3ab2('0x1'));var rimraf=require(_0x3ab2('0x2'));var zipdir=require(_0x3ab2('0x3'));var jsonpatch=require(_0x3ab2('0x4'));var rp=require(_0x3ab2('0x5'));var moment=require('moment');var BPromise=require(_0x3ab2('0x6'));var Mustache=require(_0x3ab2('0x7'));var util=require(_0x3ab2('0x8'));var path=require(_0x3ab2('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x3ab2('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x3ab2('0xb'));var jsforce=require(_0x3ab2('0xc'));var deskjs=require(_0x3ab2('0xd'));var toCsv=require(_0x3ab2('0xe'));var querystring=require(_0x3ab2('0xf'));var Papa=require(_0x3ab2('0x10'));var Redis=require(_0x3ab2('0x11'));var authService=require(_0x3ab2('0x12'));var qs=require(_0x3ab2('0x13'));var as=require(_0x3ab2('0x14'));var hardwareService=require(_0x3ab2('0x15'));var logger=require('../../config/logger')(_0x3ab2('0x16'));var utils=require(_0x3ab2('0x17'));var config=require(_0x3ab2('0x18'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x3ab2('0x19')](config[_0x3ab2('0x1a')],{'host':_0x3ab2('0x1b'),'port':0x18eb});var socket=require(_0x3ab2('0x1c'))(new Redis(config[_0x3ab2('0x1a')]));require(_0x3ab2('0x1d'))[_0x3ab2('0x1e')](socket);function respondWithStatusCode(_0x101769,_0x11d439){_0x11d439=_0x11d439||0xcc;return function(_0x4eecd3){if(_0x4eecd3){return _0x101769[_0x3ab2('0x1f')](_0x11d439);}return _0x101769['status'](_0x11d439)[_0x3ab2('0x20')]();};}function respondWithResult(_0x458f08,_0x5c152c){_0x5c152c=_0x5c152c||0xc8;return function(_0x560437){if(_0x560437){return _0x458f08[_0x3ab2('0x21')](_0x5c152c)[_0x3ab2('0x22')](_0x560437);}};}function respondWithFilteredResult(_0xf9124c,_0x700533){return function(_0x170506){if(_0x170506){var _0x5a6ec4=_0x170506['count'],_0x4d129b=_0x700533[_0x3ab2('0x23')],_0x42c4f4=_0x700533[_0x3ab2('0x23')]+_0x700533[_0x3ab2('0x24')],_0x1efcb9;if(_0x42c4f4>=_0x5a6ec4){_0x42c4f4=_0x5a6ec4;_0x1efcb9=0xc8;}else{_0x1efcb9=0xce;}_0xf9124c[_0x3ab2('0x21')](_0x1efcb9);return _0xf9124c['set'](_0x3ab2('0x25'),_0x4d129b+'-'+_0x42c4f4+'/'+_0x5a6ec4)[_0x3ab2('0x22')](_0x170506);}return null;};}function patchUpdates(_0x16d0b2){return function(_0x143bfe){try{jsonpatch[_0x3ab2('0x26')](_0x143bfe,_0x16d0b2,!![]);}catch(_0xed8423){return BPromise[_0x3ab2('0x27')](_0xed8423);}return _0x143bfe[_0x3ab2('0x28')]();};}function saveUpdates(_0x5dbfdc,_0x186853){return function(_0x4e702d){if(_0x4e702d){return _0x4e702d[_0x3ab2('0x29')](_0x5dbfdc)[_0x3ab2('0x2a')](function(_0x299a78){return _0x299a78;});}return null;};}function removeEntity(_0x53bbcc,_0x436433){return function(_0x3b05dd){if(_0x3b05dd){return _0x3b05dd[_0x3ab2('0x2b')]()[_0x3ab2('0x2a')](function(){var _0x3e7632=_0x3b05dd[_0x3ab2('0x2c')]({'plain':!![]});var _0x40422d=_0x3ab2('0x2d');return db[_0x3ab2('0x2e')][_0x3ab2('0x2b')]({'where':{'type':_0x40422d,'resourceId':_0x3e7632['id']}})[_0x3ab2('0x2a')](function(){return _0x3b05dd;});})[_0x3ab2('0x2a')](function(){_0x53bbcc['status'](0xcc)[_0x3ab2('0x20')]();});}};}function handleEntityNotFound(_0x4f9603,_0x233cac){return function(_0x3a43e7){if(!_0x3a43e7){_0x4f9603[_0x3ab2('0x1f')](0x194);}return _0x3a43e7;};}function handleError(_0x29b692,_0x3feb73){_0x3feb73=_0x3feb73||0x1f4;return function(_0x36005a){logger[_0x3ab2('0x2f')](_0x36005a[_0x3ab2('0x30')]);if(_0x36005a[_0x3ab2('0x31')]){delete _0x36005a[_0x3ab2('0x31')];}_0x29b692[_0x3ab2('0x21')](_0x3feb73)['send'](_0x36005a);};}exports['index']=function(_0x5cbb93,_0x27f666){var _0x4f342f={},_0x1b0064={},_0xdd97b={'count':0x0,'rows':[]};var _0x52f743=_[_0x3ab2('0x32')](db[_0x3ab2('0x33')][_0x3ab2('0x34')],function(_0x5707df){return{'name':_0x5707df[_0x3ab2('0x35')],'type':_0x5707df[_0x3ab2('0x36')][_0x3ab2('0x37')]};});_0x1b0064['model']=_['map'](_0x52f743,_0x3ab2('0x31'));_0x1b0064[_0x3ab2('0x38')]=_['keys'](_0x5cbb93['query']);_0x1b0064[_0x3ab2('0x39')]=_[_0x3ab2('0x3a')](_0x1b0064[_0x3ab2('0x3b')],_0x1b0064['query']);_0x4f342f[_0x3ab2('0x3c')]=_[_0x3ab2('0x3a')](_0x1b0064['model'],qs[_0x3ab2('0x3d')](_0x5cbb93[_0x3ab2('0x38')][_0x3ab2('0x3d')]));_0x4f342f[_0x3ab2('0x3c')]=_0x4f342f['attributes'][_0x3ab2('0x3e')]?_0x4f342f[_0x3ab2('0x3c')]:_0x1b0064[_0x3ab2('0x3b')];if(!_0x5cbb93[_0x3ab2('0x38')][_0x3ab2('0x3f')](_0x3ab2('0x40'))){_0x4f342f['limit']=qs[_0x3ab2('0x24')](_0x5cbb93[_0x3ab2('0x38')][_0x3ab2('0x24')]);_0x4f342f[_0x3ab2('0x23')]=qs[_0x3ab2('0x23')](_0x5cbb93['query'][_0x3ab2('0x23')]);}_0x4f342f[_0x3ab2('0x41')]=qs['sort'](_0x5cbb93[_0x3ab2('0x38')][_0x3ab2('0x42')]);_0x4f342f[_0x3ab2('0x43')]=qs[_0x3ab2('0x39')](_[_0x3ab2('0x44')](_0x5cbb93['query'],_0x1b0064[_0x3ab2('0x39')]));if(_0x5cbb93[_0x3ab2('0x38')][_0x3ab2('0x45')]){_0x4f342f[_0x3ab2('0x43')]=_[_0x3ab2('0x46')](_0x4f342f[_0x3ab2('0x43')],{'$or':_[_0x3ab2('0x32')](_0x52f743,function(_0x589d79){if(_0x589d79[_0x3ab2('0x36')]!=='VIRTUAL'){var _0x3ee814={};_0x3ee814[_0x589d79['name']]={'$like':'%'+_0x5cbb93[_0x3ab2('0x38')][_0x3ab2('0x45')]+'%'};return _0x3ee814;}})});}_0x4f342f=_['merge']({},_0x4f342f,_0x5cbb93[_0x3ab2('0x47')]);var _0x452b54={'where':_0x4f342f[_0x3ab2('0x43')]};return db[_0x3ab2('0x33')][_0x3ab2('0x48')](_0x452b54)[_0x3ab2('0x2a')](function(_0x1afe4c){_0xdd97b[_0x3ab2('0x48')]=_0x1afe4c;if(_0x5cbb93[_0x3ab2('0x38')][_0x3ab2('0x49')]){_0x4f342f[_0x3ab2('0x4a')]=[{'all':!![]}];}return db[_0x3ab2('0x33')]['findAll'](_0x4f342f);})[_0x3ab2('0x2a')](function(_0x40f6d8){_0xdd97b[_0x3ab2('0x4b')]=_0x40f6d8;return _0xdd97b;})[_0x3ab2('0x2a')](respondWithFilteredResult(_0x27f666,_0x4f342f))[_0x3ab2('0x4c')](handleError(_0x27f666,null));};exports[_0x3ab2('0x4d')]=function(_0xeab245,_0x5d7bf7){var _0xceb17d={'raw':!![],'where':{'id':_0xeab245[_0x3ab2('0x4e')]['id']}},_0x186ab9={};_0x186ab9['model']=_[_0x3ab2('0x4f')](db[_0x3ab2('0x33')][_0x3ab2('0x34')]);_0x186ab9[_0x3ab2('0x38')]=_['keys'](_0xeab245[_0x3ab2('0x38')]);_0x186ab9[_0x3ab2('0x39')]=_['intersection'](_0x186ab9[_0x3ab2('0x3b')],_0x186ab9['query']);_0xceb17d[_0x3ab2('0x3c')]=_['intersection'](_0x186ab9[_0x3ab2('0x3b')],qs[_0x3ab2('0x3d')](_0xeab245['query'][_0x3ab2('0x3d')]));_0xceb17d[_0x3ab2('0x3c')]=_0xceb17d[_0x3ab2('0x3c')][_0x3ab2('0x3e')]?_0xceb17d[_0x3ab2('0x3c')]:_0x186ab9[_0x3ab2('0x3b')];if(_0xeab245['query'][_0x3ab2('0x49')]){_0xceb17d['include']=[{'all':!![]}];}_0xceb17d=_['merge']({},_0xceb17d,_0xeab245[_0x3ab2('0x47')]);return db[_0x3ab2('0x33')][_0x3ab2('0x50')](_0xceb17d)[_0x3ab2('0x2a')](handleEntityNotFound(_0x5d7bf7,null))[_0x3ab2('0x2a')](respondWithResult(_0x5d7bf7,null))[_0x3ab2('0x4c')](handleError(_0x5d7bf7,null));};exports[_0x3ab2('0x51')]=function(_0x586b89,_0x59d980){return db[_0x3ab2('0x33')]['create'](_0x586b89[_0x3ab2('0x52')],{})[_0x3ab2('0x2a')](function(_0x1b4921){var _0x2683ca=_0x586b89[_0x3ab2('0x53')][_0x3ab2('0x2c')]({'plain':!![]});if(!_0x2683ca)throw new Error(_0x3ab2('0x54'));if(_0x2683ca['role']===_0x3ab2('0x53')){var _0x4b658b=_0x1b4921[_0x3ab2('0x2c')]({'plain':!![]});var _0x46f7d4=_0x3ab2('0x2d');return db[_0x3ab2('0x55')][_0x3ab2('0x50')]({'where':{'name':_0x46f7d4,'userProfileId':_0x2683ca[_0x3ab2('0x56')]},'raw':!![]})[_0x3ab2('0x2a')](function(_0x336724){if(_0x336724&&_0x336724[_0x3ab2('0x57')]===0x0){return db[_0x3ab2('0x2e')][_0x3ab2('0x51')]({'name':_0x4b658b[_0x3ab2('0x31')],'resourceId':_0x4b658b['id'],'type':_0x336724[_0x3ab2('0x31')],'sectionId':_0x336724['id']},{})['then'](function(){return _0x1b4921;});}else{return _0x1b4921;}})[_0x3ab2('0x4c')](function(_0x586aa4){logger[_0x3ab2('0x2f')](_0x3ab2('0x58'),_0x586aa4);throw _0x586aa4;});}return _0x1b4921;})['then'](respondWithResult(_0x59d980,0xc9))[_0x3ab2('0x4c')](handleError(_0x59d980,null));};exports[_0x3ab2('0x29')]=function(_0x57849e,_0x52ce38){if(_0x57849e[_0x3ab2('0x52')]['id']){delete _0x57849e[_0x3ab2('0x52')]['id'];}return db[_0x3ab2('0x33')][_0x3ab2('0x50')]({'where':{'id':_0x57849e[_0x3ab2('0x4e')]['id']}})[_0x3ab2('0x2a')](handleEntityNotFound(_0x52ce38,null))[_0x3ab2('0x2a')](saveUpdates(_0x57849e[_0x3ab2('0x52')],null))[_0x3ab2('0x2a')](respondWithResult(_0x52ce38,null))[_0x3ab2('0x4c')](handleError(_0x52ce38,null));};exports[_0x3ab2('0x2b')]=function(_0x67f97a,_0x5d830c){return db[_0x3ab2('0x33')][_0x3ab2('0x50')]({'where':{'id':_0x67f97a[_0x3ab2('0x4e')]['id']}})[_0x3ab2('0x2a')](handleEntityNotFound(_0x5d830c,null))[_0x3ab2('0x2a')](removeEntity(_0x5d830c,null))['catch'](handleError(_0x5d830c,null));};exports[_0x3ab2('0x59')]=function(_0x3e6777,_0x1cc825){return db[_0x3ab2('0x33')]['describe']()[_0x3ab2('0x2a')](respondWithResult(_0x1cc825,null))[_0x3ab2('0x4c')](handleError(_0x1cc825,null));};exports['getMembers']=function(_0x537e18,_0x29b2ee,_0x13646f){var _0x5d9679={'raw':!![],'where':{}},_0x5e850e={},_0x1dc790;return db['FaxQueue'][_0x3ab2('0x5a')]({'where':{'id':_0x537e18[_0x3ab2('0x4e')]['id']}})[_0x3ab2('0x2a')](handleEntityNotFound(_0x29b2ee,null))['then'](function(_0x39fe4b){if(_0x39fe4b){_0x1dc790=_0x39fe4b[_0x3ab2('0x2c')]({'plain':!![]});_0x5e850e[_0x3ab2('0x3b')]=_['keys'](db[_0x3ab2('0x5b')][_0x3ab2('0x34')]);_0x5e850e[_0x3ab2('0x38')]=_[_0x3ab2('0x4f')](_0x537e18[_0x3ab2('0x38')]);_0x5e850e[_0x3ab2('0x39')]=_[_0x3ab2('0x3a')](_0x5e850e[_0x3ab2('0x3b')],_0x5e850e['query']);_0x5d9679['attributes']=_['intersection'](_0x5e850e[_0x3ab2('0x3b')],qs[_0x3ab2('0x3d')](_0x537e18[_0x3ab2('0x38')][_0x3ab2('0x3d')]));_0x5d9679[_0x3ab2('0x3c')]=_0x5d9679[_0x3ab2('0x3c')][_0x3ab2('0x3e')]?_0x5d9679[_0x3ab2('0x3c')]:_0x5e850e[_0x3ab2('0x3b')];if(!_0x537e18[_0x3ab2('0x38')]['hasOwnProperty'](_0x3ab2('0x40'))){_0x5d9679[_0x3ab2('0x24')]=qs[_0x3ab2('0x24')](_0x537e18[_0x3ab2('0x38')][_0x3ab2('0x24')]);_0x5d9679[_0x3ab2('0x23')]=qs['offset'](_0x537e18[_0x3ab2('0x38')][_0x3ab2('0x23')]);}_0x5d9679['order']=qs[_0x3ab2('0x42')](_0x537e18[_0x3ab2('0x38')][_0x3ab2('0x42')]);_0x5d9679[_0x3ab2('0x43')]=qs['filters'](_[_0x3ab2('0x44')](_0x537e18['query'],_0x5e850e['filters']));_0x5d9679[_0x3ab2('0x43')][_0x3ab2('0x5c')]=_0x39fe4b['id'];if(_0x537e18[_0x3ab2('0x38')][_0x3ab2('0x45')]){_0x5d9679['where']=_['merge'](_0x5d9679[_0x3ab2('0x43')],{'$or':_[_0x3ab2('0x32')](_0x5d9679[_0x3ab2('0x3c')],function(_0x10125f){var _0x5b2814={};_0x5b2814[_0x10125f]={'$like':'%'+_0x537e18[_0x3ab2('0x38')][_0x3ab2('0x45')]+'%'};return _0x5b2814;})});}_0x5d9679=_[_0x3ab2('0x46')]({},_0x5d9679,_0x537e18[_0x3ab2('0x47')]);return db[_0x3ab2('0x5b')][_0x3ab2('0x5d')](_0x5d9679);}})[_0x3ab2('0x2a')](function(_0x3c98ca){if(_0x3c98ca){return db[_0x3ab2('0x5e')][_0x3ab2('0x5f')]({'where':{'id':_[_0x3ab2('0x32')](_0x3c98ca,_0x3ab2('0x60')),'role':_0x3ab2('0x61')},'attributes':['id',_0x3ab2('0x31'),'faxPause','updatedAt',_0x3ab2('0x62')]});}})['then'](function(_0x3ea475){if(_0x3ea475){return{'count':_0x3ea475['count'],'rows':_[_0x3ab2('0x32')](_0x3ea475[_0x3ab2('0x4b')],function(_0x22e912){return{'membername':_0x22e912[_0x3ab2('0x31')],'UserId':_0x22e912['id'],'queue_name':_0x1dc790[_0x3ab2('0x31')],'FaxQueueId':_0x1dc790['id'],'interface':util[_0x3ab2('0x63')](_0x3ab2('0x64'),'SIP',_0x22e912[_0x3ab2('0x31')]),'penalty':0x0,'paused':_0x22e912['faxPause'],'createdAt':_0x22e912['createdAt'],'updatedAt':_0x22e912[_0x3ab2('0x65')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x29b2ee,_0x5d9679))['catch'](handleError(_0x29b2ee,null));};exports[_0x3ab2('0x66')]=function(_0x11c46b,_0x5b646c,_0x5305a0){var _0x2ade12={};var _0x1f643a={};var _0x2586f2;var _0x43f476;return db[_0x3ab2('0x33')][_0x3ab2('0x5a')]({'where':{'id':_0x11c46b['params']['id']}})[_0x3ab2('0x2a')](handleEntityNotFound(_0x5b646c,null))[_0x3ab2('0x2a')](function(_0x453046){if(_0x453046){_0x2586f2=_0x453046;_0x1f643a['model']=_['keys'](db[_0x3ab2('0x67')][_0x3ab2('0x34')]);_0x1f643a[_0x3ab2('0x38')]=_[_0x3ab2('0x4f')](_0x11c46b[_0x3ab2('0x38')]);_0x1f643a['filters']=_[_0x3ab2('0x3a')](_0x1f643a[_0x3ab2('0x3b')],_0x1f643a['query']);_0x2ade12[_0x3ab2('0x3c')]=_['intersection'](_0x1f643a[_0x3ab2('0x3b')],qs[_0x3ab2('0x3d')](_0x11c46b['query'][_0x3ab2('0x3d')]));_0x2ade12[_0x3ab2('0x3c')]=_0x2ade12[_0x3ab2('0x3c')][_0x3ab2('0x3e')]?_0x2ade12[_0x3ab2('0x3c')]:_0x1f643a[_0x3ab2('0x3b')];_0x2ade12['order']=qs[_0x3ab2('0x42')](_0x11c46b[_0x3ab2('0x38')][_0x3ab2('0x42')]);_0x2ade12[_0x3ab2('0x43')]=qs[_0x3ab2('0x39')](_[_0x3ab2('0x44')](_0x11c46b[_0x3ab2('0x38')],_0x1f643a[_0x3ab2('0x39')]));if(_0x11c46b[_0x3ab2('0x38')][_0x3ab2('0x45')]){_0x2ade12[_0x3ab2('0x43')]=_[_0x3ab2('0x46')](_0x2ade12[_0x3ab2('0x43')],{'$or':_['map'](_0x2ade12[_0x3ab2('0x3c')],function(_0x5e99ae){var _0x1eca34={};_0x1eca34[_0x5e99ae]={'$like':'%'+_0x11c46b['query'][_0x3ab2('0x45')]+'%'};return _0x1eca34;})});}_0x2ade12=_['merge']({},_0x2ade12,_0x11c46b[_0x3ab2('0x47')]);return _0x2586f2[_0x3ab2('0x66')](_0x2ade12);}})[_0x3ab2('0x2a')](function(_0x31073b){if(_0x31073b){_0x43f476=_0x31073b[_0x3ab2('0x3e')];if(!_0x11c46b[_0x3ab2('0x38')][_0x3ab2('0x3f')]('nolimit')){_0x2ade12[_0x3ab2('0x24')]=qs['limit'](_0x11c46b[_0x3ab2('0x38')][_0x3ab2('0x24')]);_0x2ade12[_0x3ab2('0x23')]=qs[_0x3ab2('0x23')](_0x11c46b['query'][_0x3ab2('0x23')]);}return _0x2586f2[_0x3ab2('0x66')](_0x2ade12);}})[_0x3ab2('0x2a')](function(_0x32e1bc){if(_0x32e1bc){return _0x32e1bc?{'count':_0x43f476,'rows':_0x32e1bc}:null;}})['then'](respondWithResult(_0x5b646c,null))['catch'](handleError(_0x5b646c,null));};exports['addTeams']=function(_0x13bf30,_0x23e2e2,_0xfd4bc5){var _0x1f4381=_0x13bf30['body'][_0x3ab2('0x68')];return db[_0x3ab2('0x67')][_0x3ab2('0x5d')]({'where':{'id':_0x1f4381},'attributes':['id'],'include':[{'model':db[_0x3ab2('0x5e')],'as':'Agents','attributes':['id',_0x3ab2('0x31'),'online',_0x3ab2('0x69'),_0x3ab2('0x6a')],'raw':!![]}]})[_0x3ab2('0x2a')](function(_0x2d7774){if(_0x2d7774){var _0x309f33=_[_0x3ab2('0x6b')](_0x2d7774,function(_0x3f84f0){var _0x3d969c=_0x3f84f0[_0x3ab2('0x2c')]({'plain':!![]});return _0x3d969c[_0x3ab2('0x6c')];});return db[_0x3ab2('0x33')]['find']({'where':{'id':_0x13bf30['params']['id']}})[_0x3ab2('0x2a')](function(_0x559a47){return db[_0x3ab2('0x6d')][_0x3ab2('0x6e')](function(_0xad5226){return _0x559a47[_0x3ab2('0x6f')](_0x1f4381,{'transaction':_0xad5226})[_0x3ab2('0x2a')](function(){return BPromise[_0x3ab2('0x70')](_0x309f33,function(_0x1c6153){return db[_0x3ab2('0x5b')]['findOrCreate']({'where':{'UserId':_0x1c6153['id'],'FaxQueueId':_0x13bf30[_0x3ab2('0x4e')]['id']},'transaction':_0xad5226});});})[_0x3ab2('0x2a')](function(){_0x309f33[_0x3ab2('0x71')](function(_0x50822a){socket[_0x3ab2('0x72')](_0x3ab2('0x73'),{'UserId':_0x50822a['id'],'FaxQueueId':_0x559a47['id']});});});});});}})[_0x3ab2('0x2a')](respondWithStatusCode(_0x23e2e2,null))['catch'](handleError(_0x23e2e2,null));};exports[_0x3ab2('0x74')]=function(_0x2bb68b,_0x115281,_0x443923){return db['Team']['findAll']({'where':{'id':_0x2bb68b[_0x3ab2('0x38')][_0x3ab2('0x68')]},'attributes':['id'],'include':[{'model':db[_0x3ab2('0x5e')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x3ab2('0x2a')](handleEntityNotFound(_0x115281,null))[_0x3ab2('0x2a')](function(_0x33b798){var _0x484676=_[_0x3ab2('0x32')](_0x33b798,'id');var _0x3bd1fb=[];var _0x2f8e1f=[];var _0x16d2c6=squel[_0x3ab2('0x75')]();_0x16d2c6[_0x3ab2('0x76')](_0x3ab2('0x77'))['from']('team_has_fax_queues','tq')[_0x3ab2('0x78')]('user_has_teams','ut',_0x3ab2('0x79'))['where'](_0x3ab2('0x7a'),_0x2bb68b[_0x3ab2('0x4e')]['id']);for(var _0x48b3b2=0x0;_0x48b3b2<_0x33b798['length'];_0x48b3b2+=0x1){let _0x165348=_0x33b798[_0x48b3b2];for(var _0x5c5e09=0x0;_0x5c5e09<_0x165348[_0x3ab2('0x6c')][_0x3ab2('0x3e')];_0x5c5e09+=0x1){let _0x255d5d=_0x165348['Agents'][_0x5c5e09];var _0x5708c5=_0x16d2c6['clone']();_0x5708c5[_0x3ab2('0x43')]('ut.UserId\x20=\x20?',_0x255d5d['id']);_0x2f8e1f['push'](db[_0x3ab2('0x6d')]['query'](_0x5708c5[_0x3ab2('0x7b')](),{'type':db[_0x3ab2('0x6d')][_0x3ab2('0x7c')][_0x3ab2('0x7d')]})['then'](function(_0x7f4163){if(_0x7f4163[_0x3ab2('0x3e')]===0x1){return _0x255d5d['id'];}else{var _0x2b711c=_[_0x3ab2('0x7e')](_['map'](_0x7f4163,_0x3ab2('0x7f')),function(_0x191faf){return _['includes'](_0x484676,_0x191faf);});if(_0x2b711c){return _0x255d5d['id'];}}}));}}return BPromise[_0x3ab2('0x80')](_0x2f8e1f)[_0x3ab2('0x2a')](function(_0x1b7d0a){_0x3bd1fb=_(_0x3bd1fb)[_0x3ab2('0x81')](_0x1b7d0a)[_0x3ab2('0x82')]()[_0x3ab2('0x83')]();return db[_0x3ab2('0x33')][_0x3ab2('0x50')]({'where':{'id':_0x2bb68b[_0x3ab2('0x4e')]['id']}})['then'](function(_0x5c7ff3){return db[_0x3ab2('0x6d')][_0x3ab2('0x6e')](function(_0x253220){return _0x5c7ff3[_0x3ab2('0x74')](_0x2bb68b[_0x3ab2('0x38')][_0x3ab2('0x68')],{'transaction':_0x253220})[_0x3ab2('0x2a')](function(){if(!_[_0x3ab2('0x84')](_0x3bd1fb)){return _0x5c7ff3[_0x3ab2('0x85')](_0x3bd1fb,{'transaction':_0x253220});}})[_0x3ab2('0x2a')](function(){_0x3bd1fb[_0x3ab2('0x71')](function(_0x49829a){socket['emit'](_0x3ab2('0x86'),{'UserId':_0x49829a,'FaxQueueId':_0x5c7ff3['id']});});});});});});})[_0x3ab2('0x2a')](respondWithStatusCode(_0x115281,null))['catch'](handleError(_0x115281,null));};exports[_0x3ab2('0x87')]=function(_0x826fb2,_0xb07615,_0x3a14db){return db['FaxQueue'][_0x3ab2('0x50')]({'where':{'id':_0x826fb2[_0x3ab2('0x4e')]['id']}})[_0x3ab2('0x2a')](handleEntityNotFound(_0xb07615,null))['then'](function(_0x2b028c){if(_0x2b028c){return _0x2b028c[_0x3ab2('0x87')](_0x826fb2[_0x3ab2('0x52')][_0x3ab2('0x68')],_[_0x3ab2('0x88')](_0x826fb2[_0x3ab2('0x52')],[_0x3ab2('0x68'),'id'])||{})[_0x3ab2('0x89')](function(_0x1dc087){for(var _0x1b092a=0x0;_0x1b092a<_0x826fb2[_0x3ab2('0x52')][_0x3ab2('0x68')][_0x3ab2('0x3e')];_0x1b092a+=0x1){socket[_0x3ab2('0x72')]('userFaxQueue:save',{'UserId':_0x826fb2[_0x3ab2('0x52')]['ids'][_0x1b092a],'FaxQueueId':_0x826fb2['params']['id']});}return _0x1dc087;});}})[_0x3ab2('0x2a')](respondWithResult(_0xb07615,null))[_0x3ab2('0x4c')](handleError(_0xb07615,null));};exports['removeAgents']=function(_0x24d3d5,_0x148e20,_0x3923f3){return db[_0x3ab2('0x33')][_0x3ab2('0x50')]({'where':{'id':_0x24d3d5['params']['id']}})[_0x3ab2('0x2a')](handleEntityNotFound(_0x148e20,null))['then'](function(_0x57a3dd){if(_0x57a3dd){return _0x57a3dd[_0x3ab2('0x85')](_0x24d3d5[_0x3ab2('0x38')][_0x3ab2('0x68')])[_0x3ab2('0x2a')](function(){if(_[_0x3ab2('0x8a')](_0x24d3d5[_0x3ab2('0x38')][_0x3ab2('0x68')])){for(var _0x37ca72=0x0;_0x37ca72<_0x24d3d5[_0x3ab2('0x38')][_0x3ab2('0x68')][_0x3ab2('0x3e')];_0x37ca72+=0x1){socket['emit'](_0x3ab2('0x86'),{'UserId':Number(_0x24d3d5[_0x3ab2('0x38')][_0x3ab2('0x68')][_0x37ca72]),'FaxQueueId':Number(_0x24d3d5['params']['id'])});}}else{socket[_0x3ab2('0x72')]('userFaxQueue:remove',{'UserId':Number(_0x24d3d5['query'][_0x3ab2('0x68')]),'FaxQueueId':Number(_0x24d3d5[_0x3ab2('0x4e')]['id'])});}});}})[_0x3ab2('0x2a')](respondWithStatusCode(_0x148e20,null))['catch'](handleError(_0x148e20,null));};exports[_0x3ab2('0x8b')]=function(_0x2cb307,_0x3c55bc,_0x50ebd5){var _0x8da0ce={};var _0x583034={};var _0x86257f;var _0xcddfb5;return db[_0x3ab2('0x33')][_0x3ab2('0x5a')]({'where':{'id':_0x2cb307[_0x3ab2('0x4e')]['id']}})[_0x3ab2('0x2a')](handleEntityNotFound(_0x3c55bc,null))[_0x3ab2('0x2a')](function(_0x3c7334){if(_0x3c7334){_0x86257f=_0x3c7334;_0x583034[_0x3ab2('0x3b')]=_[_0x3ab2('0x4f')](db['User'][_0x3ab2('0x34')]);_0x583034[_0x3ab2('0x38')]=_['keys'](_0x2cb307[_0x3ab2('0x38')]);_0x583034[_0x3ab2('0x39')]=_[_0x3ab2('0x3a')](_0x583034[_0x3ab2('0x3b')],_0x583034['query']);_0x8da0ce[_0x3ab2('0x3c')]=_[_0x3ab2('0x3a')](_0x583034[_0x3ab2('0x3b')],qs[_0x3ab2('0x3d')](_0x2cb307[_0x3ab2('0x38')][_0x3ab2('0x3d')]));_0x8da0ce[_0x3ab2('0x3c')]=_0x8da0ce[_0x3ab2('0x3c')]['length']?_0x8da0ce[_0x3ab2('0x3c')]:_0x583034[_0x3ab2('0x3b')];_0x8da0ce[_0x3ab2('0x41')]=qs['sort'](_0x2cb307[_0x3ab2('0x38')]['sort']);_0x8da0ce[_0x3ab2('0x43')]=qs[_0x3ab2('0x39')](_[_0x3ab2('0x44')](_0x2cb307[_0x3ab2('0x38')],_0x583034[_0x3ab2('0x39')]));if(_0x2cb307[_0x3ab2('0x38')][_0x3ab2('0x45')]){_0x8da0ce['where']=_[_0x3ab2('0x46')](_0x8da0ce['where'],{'$or':_['map'](_0x8da0ce[_0x3ab2('0x3c')],function(_0x4458f6){var _0x186df3={};_0x186df3[_0x4458f6]={'$like':'%'+_0x2cb307[_0x3ab2('0x38')][_0x3ab2('0x45')]+'%'};return _0x186df3;})});}_0x8da0ce=_[_0x3ab2('0x46')]({},_0x8da0ce,_0x2cb307['options']);return _0x86257f['getAgents'](_0x8da0ce);}})[_0x3ab2('0x2a')](function(_0x2e7a4d){if(_0x2e7a4d){_0xcddfb5=_0x2e7a4d[_0x3ab2('0x3e')];if(!_0x2cb307[_0x3ab2('0x38')]['hasOwnProperty']('nolimit')){_0x8da0ce['limit']=qs[_0x3ab2('0x24')](_0x2cb307[_0x3ab2('0x38')][_0x3ab2('0x24')]);_0x8da0ce[_0x3ab2('0x23')]=qs[_0x3ab2('0x23')](_0x2cb307['query']['offset']);}return _0x86257f['getAgents'](_0x8da0ce);}})[_0x3ab2('0x2a')](function(_0xa47b62){if(_0xa47b62){return _0xa47b62?{'count':_0xcddfb5,'rows':_0xa47b62}:null;}})[_0x3ab2('0x2a')](respondWithResult(_0x3c55bc,null))[_0x3ab2('0x4c')](handleError(_0x3c55bc,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index fe0a458..b44fae9 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 _0x9866=['exports','../../mysqldb','FaxQueue','setMaxListeners','save','update','remove','emit','hook'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x9866,0x1f0));var _0x6986=function(_0x354d06,_0x2e89a0){_0x354d06=_0x354d06-0x0;var _0x44af05=_0x9866[_0x354d06];return _0x44af05;};'use strict';var EventEmitter=require('events');var FaxQueue=require(_0x6986('0x0'))['db'][_0x6986('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x6986('0x2')](0x0);var events={'afterCreate':_0x6986('0x3'),'afterUpdate':_0x6986('0x4'),'afterDestroy':_0x6986('0x5')};function emitEvent(_0x520ac4){return function(_0x115981,_0x258d66,_0x15bb2e){FaxQueueEvents[_0x6986('0x6')](_0x520ac4+':'+_0x115981['id'],_0x115981);FaxQueueEvents[_0x6986('0x6')](_0x520ac4,_0x115981);_0x15bb2e(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxQueue[_0x6986('0x7')](e,emitEvent(event));}}module[_0x6986('0x8')]=FaxQueueEvents; \ No newline at end of file +var _0xaedf=['../../mysqldb','FaxQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xaedf,0x112));var _0xfaed=function(_0x4784ea,_0x3f032b){_0x4784ea=_0x4784ea-0x0;var _0x469b61=_0xaedf[_0x4784ea];return _0x469b61;};'use strict';var EventEmitter=require(_0xfaed('0x0'));var FaxQueue=require(_0xfaed('0x1'))['db'][_0xfaed('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0xfaed('0x3')](0x0);var events={'afterCreate':_0xfaed('0x4'),'afterUpdate':_0xfaed('0x5'),'afterDestroy':_0xfaed('0x6')};function emitEvent(_0x394d45){return function(_0x466806,_0x55147d,_0x112e4a){FaxQueueEvents[_0xfaed('0x7')](_0x394d45+':'+_0x466806['id'],_0x466806);FaxQueueEvents['emit'](_0x394d45,_0x466806);_0x112e4a(null);};}for(var e in events){if(events[_0xfaed('0x8')](e)){var event=events[e];FaxQueue[_0xfaed('0x9')](e,emitEvent(event));}}module[_0xfaed('0xa')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index 477f85a..cb771fd 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 _0x2bf8=['define','fax_queues','lodash','util','api','moment','bluebird','request-promise','path','rimraf','./faxQueue.attributes','exports'];(function(_0x212a37,_0xf35b2e){var _0x5d0bf9=function(_0x51850f){while(--_0x51850f){_0x212a37['push'](_0x212a37['shift']());}};_0x5d0bf9(++_0xf35b2e);}(_0x2bf8,0x15e));var _0x82bf=function(_0x303a5e,_0x4c071a){_0x303a5e=_0x303a5e-0x0;var _0x4fc3dd=_0x2bf8[_0x303a5e];return _0x4fc3dd;};'use strict';var _=require(_0x82bf('0x0'));var util=require(_0x82bf('0x1'));var logger=require('../../config/logger')(_0x82bf('0x2'));var moment=require(_0x82bf('0x3'));var BPromise=require(_0x82bf('0x4'));var rp=require(_0x82bf('0x5'));var fs=require('fs');var path=require(_0x82bf('0x6'));var rimraf=require(_0x82bf('0x7'));var config=require('../../config/environment');var attributes=require(_0x82bf('0x8'));module[_0x82bf('0x9')]=function(_0x4d31ca,_0x7b76c2){return _0x4d31ca[_0x82bf('0xa')]('FaxQueue',attributes,{'tableName':_0x82bf('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfde8=['path','rimraf','../../config/environment','./faxQueue.attributes','exports','define','fax_queues','util','../../config/logger','api','moment','request-promise'];(function(_0x4e18d5,_0x86ae8d){var _0x591a04=function(_0x41e977){while(--_0x41e977){_0x4e18d5['push'](_0x4e18d5['shift']());}};_0x591a04(++_0x86ae8d);}(_0xfde8,0x187));var _0x8fde=function(_0x56a913,_0x5eace8){_0x56a913=_0x56a913-0x0;var _0x4f44c1=_0xfde8[_0x56a913];return _0x4f44c1;};'use strict';var _=require('lodash');var util=require(_0x8fde('0x0'));var logger=require(_0x8fde('0x1'))(_0x8fde('0x2'));var moment=require(_0x8fde('0x3'));var BPromise=require('bluebird');var rp=require(_0x8fde('0x4'));var fs=require('fs');var path=require(_0x8fde('0x5'));var rimraf=require(_0x8fde('0x6'));var config=require(_0x8fde('0x7'));var attributes=require(_0x8fde('0x8'));module[_0x8fde('0x9')]=function(_0x1caf9b,_0x1e6616){return _0x1caf9b[_0x8fde('0xa')]('FaxQueue',attributes,{'tableName':_0x8fde('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.rpc.js b/server/api/faxQueue/faxQueue.rpc.js index 476a19c..d7a4da9 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 _0xf768=['error','code','message','result','catch','options','raw','include','map','attributes','GetFaxQueue','ShowFaxQueue','FaxQueue','find','where','model','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','defaults','redis','localhost','./faxQueue.socket','register','request','then','info','FaxQueue,\x20%s,\x20%s','debug','FaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x491cf8,_0x8b5453){var _0x48a17d=function(_0x2f9eec){while(--_0x2f9eec){_0x491cf8['push'](_0x491cf8['shift']());}};_0x48a17d(++_0x8b5453);}(_0xf768,0x1f1));var _0x8f76=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xf768[_0x2b10c6];return _0x3789d2;};'use strict';var _=require(_0x8f76('0x0'));var util=require(_0x8f76('0x1'));var moment=require(_0x8f76('0x2'));var BPromise=require(_0x8f76('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8f76('0x4'));var db=require(_0x8f76('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x8f76('0x6'))('rpc');var config=require(_0x8f76('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0x8f76('0x8')](config[_0x8f76('0x9')],{'host':_0x8f76('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8f76('0x9')]));require(_0x8f76('0xb'))[_0x8f76('0xc')](socket);function respondWithRpcPromise(_0x5e1595,_0x38f5e9,_0xe830e7){return new BPromise(function(_0x1024c2,_0xfad120){return client[_0x8f76('0xd')](_0x5e1595,_0xe830e7)[_0x8f76('0xe')](function(_0x422022){logger[_0x8f76('0xf')](_0x8f76('0x10'),_0x38f5e9,'request\x20sent');logger[_0x8f76('0x11')](_0x8f76('0x12'),_0x38f5e9,_0x8f76('0x13'),JSON[_0x8f76('0x14')](_0x422022));if(_0x422022[_0x8f76('0x15')]){if(_0x422022[_0x8f76('0x15')][_0x8f76('0x16')]===0x1f4){logger[_0x8f76('0x15')](_0x8f76('0x10'),_0x38f5e9,_0x422022[_0x8f76('0x15')]['message']);return _0xfad120(_0x422022[_0x8f76('0x15')][_0x8f76('0x17')]);}logger[_0x8f76('0x15')](_0x8f76('0x10'),_0x38f5e9,_0x422022[_0x8f76('0x15')][_0x8f76('0x17')]);return _0x1024c2(_0x422022[_0x8f76('0x15')]['message']);}else{logger[_0x8f76('0xf')](_0x8f76('0x10'),_0x38f5e9,'request\x20sent');_0x1024c2(_0x422022[_0x8f76('0x18')][_0x8f76('0x17')]);}})[_0x8f76('0x19')](function(_0x7279c9){logger['error'](_0x8f76('0x10'),_0x38f5e9,_0x7279c9);_0xfad120(_0x7279c9);});});}exports['GetFaxQueue']=function(_0x12d531){var _0x519eb1=this;return new Promise(function(_0x568c2c,_0xb4de28){return db['FaxQueue']['findAll']({'raw':_0x12d531['options']?_0x12d531[_0x8f76('0x1a')][_0x8f76('0x1b')]===undefined?!![]:![]:!![],'where':_0x12d531[_0x8f76('0x1a')]?_0x12d531[_0x8f76('0x1a')]['where']||null:null,'attributes':_0x12d531[_0x8f76('0x1a')]?_0x12d531[_0x8f76('0x1a')]['attributes']||null:null,'limit':_0x12d531['options']?_0x12d531[_0x8f76('0x1a')]['limit']||null:null,'include':_0x12d531['options']?_0x12d531[_0x8f76('0x1a')][_0x8f76('0x1c')]?_[_0x8f76('0x1d')](_0x12d531[_0x8f76('0x1a')][_0x8f76('0x1c')],function(_0x2cd638){return{'model':db[_0x2cd638['model']],'as':_0x2cd638['as'],'attributes':_0x2cd638[_0x8f76('0x1e')],'include':_0x2cd638[_0x8f76('0x1c')]?_[_0x8f76('0x1d')](_0x2cd638[_0x8f76('0x1c')],function(_0x2bef6d){return{'model':db[_0x2bef6d['model']],'as':_0x2bef6d['as'],'attributes':_0x2bef6d[_0x8f76('0x1e')],'include':_0x2bef6d['include']?_[_0x8f76('0x1d')](_0x2bef6d['include'],function(_0x2c650b){return{'model':db[_0x2c650b['model']],'as':_0x2c650b['as'],'attributes':_0x2c650b[_0x8f76('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1ac7e2){logger[_0x8f76('0xf')](_0x8f76('0x1f'),_0x12d531);logger[_0x8f76('0x11')](_0x8f76('0x1f'),_0x12d531,JSON['stringify'](_0x1ac7e2));_0x568c2c(_0x1ac7e2);})['catch'](function(_0x1492b2){logger[_0x8f76('0x15')](_0x8f76('0x1f'),_0x1492b2[_0x8f76('0x17')],_0x12d531);_0xb4de28(_0x519eb1['error'](0x1f4,_0x1492b2[_0x8f76('0x17')]));});});};exports[_0x8f76('0x20')]=function(_0x8b2d84){var _0xe2f421=this;return new Promise(function(_0x59e605,_0x383c50){return db[_0x8f76('0x21')][_0x8f76('0x22')]({'raw':_0x8b2d84[_0x8f76('0x1a')]?_0x8b2d84['options'][_0x8f76('0x1b')]===undefined?!![]:![]:!![],'where':_0x8b2d84['options']?_0x8b2d84[_0x8f76('0x1a')][_0x8f76('0x23')]||null:null,'attributes':_0x8b2d84[_0x8f76('0x1a')]?_0x8b2d84[_0x8f76('0x1a')][_0x8f76('0x1e')]||null:null,'include':_0x8b2d84['options']?_0x8b2d84['options']['include']?_[_0x8f76('0x1d')](_0x8b2d84['options']['include'],function(_0x2e1131){return{'model':db[_0x2e1131[_0x8f76('0x24')]],'as':_0x2e1131['as'],'attributes':_0x2e1131[_0x8f76('0x1e')],'include':_0x2e1131[_0x8f76('0x1c')]?_['map'](_0x2e1131[_0x8f76('0x1c')],function(_0x181d24){return{'model':db[_0x181d24[_0x8f76('0x24')]],'as':_0x181d24['as'],'attributes':_0x181d24['attributes'],'include':_0x181d24[_0x8f76('0x1c')]?_[_0x8f76('0x1d')](_0x181d24[_0x8f76('0x1c')],function(_0x2d8a41){return{'model':db[_0x2d8a41[_0x8f76('0x24')]],'as':_0x2d8a41['as'],'attributes':_0x2d8a41[_0x8f76('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x8f76('0xe')](function(_0x414143){logger[_0x8f76('0xf')](_0x8f76('0x20'),_0x8b2d84);logger[_0x8f76('0x11')](_0x8f76('0x20'),_0x8b2d84,JSON[_0x8f76('0x14')](_0x414143));_0x59e605(_0x414143);})[_0x8f76('0x19')](function(_0x330459){logger[_0x8f76('0x15')](_0x8f76('0x20'),_0x330459[_0x8f76('0x17')],_0x8b2d84);_0x383c50(_0xe2f421[_0x8f76('0x15')](0x1f4,_0x330459[_0x8f76('0x17')]));});});}; \ No newline at end of file +var _0xcd39=['./faxQueue.socket','register','request','then','info','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetFaxQueue','findAll','options','raw','where','attributes','limit','include','model','map','ShowFaxQueue','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','socket.io-emitter','redis'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0xcd39,0xc2));var _0x9cd3=function(_0x3108d9,_0xf08d6){_0x3108d9=_0x3108d9-0x0;var _0x1455e6=_0xcd39[_0x3108d9];return _0x1455e6;};'use strict';var _=require(_0x9cd3('0x0'));var util=require(_0x9cd3('0x1'));var moment=require(_0x9cd3('0x2'));var BPromise=require(_0x9cd3('0x3'));var rs=require(_0x9cd3('0x4'));var fs=require('fs');var Redis=require(_0x9cd3('0x5'));var db=require(_0x9cd3('0x6'))['db'];var utils=require(_0x9cd3('0x7'));var logger=require(_0x9cd3('0x8'))(_0x9cd3('0x9'));var config=require(_0x9cd3('0xa'));var jayson=require(_0x9cd3('0xb'));var client=jayson[_0x9cd3('0xc')]['http']({'port':0x232a});config['redis']=_[_0x9cd3('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x9cd3('0xe'))(new Redis(config[_0x9cd3('0xf')]));require(_0x9cd3('0x10'))[_0x9cd3('0x11')](socket);function respondWithRpcPromise(_0x1ac51d,_0x32d8b5,_0x285d73){return new BPromise(function(_0x391e7c,_0x2e6cfa){return client[_0x9cd3('0x12')](_0x1ac51d,_0x285d73)[_0x9cd3('0x13')](function(_0x3f7d70){logger[_0x9cd3('0x14')](_0x9cd3('0x15'),_0x32d8b5,_0x9cd3('0x16'));logger[_0x9cd3('0x17')](_0x9cd3('0x18'),_0x32d8b5,_0x9cd3('0x16'),JSON[_0x9cd3('0x19')](_0x3f7d70));if(_0x3f7d70[_0x9cd3('0x1a')]){if(_0x3f7d70[_0x9cd3('0x1a')][_0x9cd3('0x1b')]===0x1f4){logger[_0x9cd3('0x1a')](_0x9cd3('0x15'),_0x32d8b5,_0x3f7d70[_0x9cd3('0x1a')][_0x9cd3('0x1c')]);return _0x2e6cfa(_0x3f7d70[_0x9cd3('0x1a')]['message']);}logger['error'](_0x9cd3('0x15'),_0x32d8b5,_0x3f7d70['error'][_0x9cd3('0x1c')]);return _0x391e7c(_0x3f7d70[_0x9cd3('0x1a')][_0x9cd3('0x1c')]);}else{logger[_0x9cd3('0x14')](_0x9cd3('0x15'),_0x32d8b5,_0x9cd3('0x16'));_0x391e7c(_0x3f7d70['result'][_0x9cd3('0x1c')]);}})[_0x9cd3('0x1d')](function(_0x343c89){logger[_0x9cd3('0x1a')](_0x9cd3('0x15'),_0x32d8b5,_0x343c89);_0x2e6cfa(_0x343c89);});});}exports[_0x9cd3('0x1e')]=function(_0x57665d){var _0x358131=this;return new Promise(function(_0x10294f,_0x1e4b87){return db['FaxQueue'][_0x9cd3('0x1f')]({'raw':_0x57665d[_0x9cd3('0x20')]?_0x57665d['options'][_0x9cd3('0x21')]===undefined?!![]:![]:!![],'where':_0x57665d[_0x9cd3('0x20')]?_0x57665d[_0x9cd3('0x20')][_0x9cd3('0x22')]||null:null,'attributes':_0x57665d['options']?_0x57665d['options'][_0x9cd3('0x23')]||null:null,'limit':_0x57665d[_0x9cd3('0x20')]?_0x57665d[_0x9cd3('0x20')][_0x9cd3('0x24')]||null:null,'include':_0x57665d[_0x9cd3('0x20')]?_0x57665d[_0x9cd3('0x20')][_0x9cd3('0x25')]?_['map'](_0x57665d[_0x9cd3('0x20')]['include'],function(_0x548163){return{'model':db[_0x548163[_0x9cd3('0x26')]],'as':_0x548163['as'],'attributes':_0x548163[_0x9cd3('0x23')],'include':_0x548163[_0x9cd3('0x25')]?_[_0x9cd3('0x27')](_0x548163[_0x9cd3('0x25')],function(_0x3c51da){return{'model':db[_0x3c51da[_0x9cd3('0x26')]],'as':_0x3c51da['as'],'attributes':_0x3c51da[_0x9cd3('0x23')],'include':_0x3c51da[_0x9cd3('0x25')]?_[_0x9cd3('0x27')](_0x3c51da[_0x9cd3('0x25')],function(_0x215a39){return{'model':db[_0x215a39[_0x9cd3('0x26')]],'as':_0x215a39['as'],'attributes':_0x215a39[_0x9cd3('0x23')]};}):[]};}):[]};}):[]:[]})[_0x9cd3('0x13')](function(_0x49289c){logger[_0x9cd3('0x14')]('GetFaxQueue',_0x57665d);logger['debug']('GetFaxQueue',_0x57665d,JSON[_0x9cd3('0x19')](_0x49289c));_0x10294f(_0x49289c);})[_0x9cd3('0x1d')](function(_0x483360){logger[_0x9cd3('0x1a')](_0x9cd3('0x1e'),_0x483360[_0x9cd3('0x1c')],_0x57665d);_0x1e4b87(_0x358131[_0x9cd3('0x1a')](0x1f4,_0x483360[_0x9cd3('0x1c')]));});});};exports[_0x9cd3('0x28')]=function(_0x27e8b6){var _0x2d0021=this;return new Promise(function(_0x523a78,_0x3f2ae1){return db['FaxQueue'][_0x9cd3('0x29')]({'raw':_0x27e8b6['options']?_0x27e8b6[_0x9cd3('0x20')]['raw']===undefined?!![]:![]:!![],'where':_0x27e8b6[_0x9cd3('0x20')]?_0x27e8b6[_0x9cd3('0x20')]['where']||null:null,'attributes':_0x27e8b6[_0x9cd3('0x20')]?_0x27e8b6[_0x9cd3('0x20')][_0x9cd3('0x23')]||null:null,'include':_0x27e8b6[_0x9cd3('0x20')]?_0x27e8b6[_0x9cd3('0x20')][_0x9cd3('0x25')]?_[_0x9cd3('0x27')](_0x27e8b6[_0x9cd3('0x20')]['include'],function(_0x23e1fe){return{'model':db[_0x23e1fe['model']],'as':_0x23e1fe['as'],'attributes':_0x23e1fe[_0x9cd3('0x23')],'include':_0x23e1fe[_0x9cd3('0x25')]?_['map'](_0x23e1fe['include'],function(_0x8ada54){return{'model':db[_0x8ada54[_0x9cd3('0x26')]],'as':_0x8ada54['as'],'attributes':_0x8ada54[_0x9cd3('0x23')],'include':_0x8ada54[_0x9cd3('0x25')]?_[_0x9cd3('0x27')](_0x8ada54[_0x9cd3('0x25')],function(_0x4cdde5){return{'model':db[_0x4cdde5[_0x9cd3('0x26')]],'as':_0x4cdde5['as'],'attributes':_0x4cdde5[_0x9cd3('0x23')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2523a3){logger[_0x9cd3('0x14')](_0x9cd3('0x28'),_0x27e8b6);logger['debug'](_0x9cd3('0x28'),_0x27e8b6,JSON['stringify'](_0x2523a3));_0x523a78(_0x2523a3);})[_0x9cd3('0x1d')](function(_0x3408f3){logger[_0x9cd3('0x1a')](_0x9cd3('0x28'),_0x3408f3[_0x9cd3('0x1c')],_0x27e8b6);_0x3f2ae1(_0x2d0021[_0x9cd3('0x1a')](0x1f4,_0x3408f3[_0x9cd3('0x1c')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index 345904d..4f7db21 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 _0x7176=['update','emit','removeListener','register','length','faxQueue:','./faxQueue.events','save'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x7176,0x17e));var _0x6717=function(_0x1ce042,_0x55d438){_0x1ce042=_0x1ce042-0x0;var _0x3f1155=_0x7176[_0x1ce042];return _0x3f1155;};'use strict';var FaxQueueEvents=require(_0x6717('0x0'));var events=[_0x6717('0x1'),'remove',_0x6717('0x2')];function createListener(_0x142035,_0x1e7db6){return function(_0x198d8c){_0x1e7db6[_0x6717('0x3')](_0x142035,_0x198d8c);};}function removeListener(_0x319681,_0x5341b7){return function(){FaxQueueEvents[_0x6717('0x4')](_0x319681,_0x5341b7);};}exports[_0x6717('0x5')]=function(_0xe8f70b){for(var _0x51f5d5=0x0,_0x1061f2=events[_0x6717('0x6')];_0x51f5d5<_0x1061f2;_0x51f5d5++){var _0x481a04=events[_0x51f5d5];var _0xff530=createListener(_0x6717('0x7')+_0x481a04,_0xe8f70b);FaxQueueEvents['on'](_0x481a04,_0xff530);}}; \ No newline at end of file +var _0x5f77=['save','update','emit','register','faxQueue:','./faxQueue.events'];(function(_0x71b765,_0x3053f8){var _0x34cb24=function(_0x2dd237){while(--_0x2dd237){_0x71b765['push'](_0x71b765['shift']());}};_0x34cb24(++_0x3053f8);}(_0x5f77,0x83));var _0x75f7=function(_0x243b59,_0x3f9495){_0x243b59=_0x243b59-0x0;var _0x3e1676=_0x5f77[_0x243b59];return _0x3e1676;};'use strict';var FaxQueueEvents=require(_0x75f7('0x0'));var events=[_0x75f7('0x1'),'remove',_0x75f7('0x2')];function createListener(_0x592558,_0x3b73a9){return function(_0x508baf){_0x3b73a9[_0x75f7('0x3')](_0x592558,_0x508baf);};}function removeListener(_0x293693,_0x296946){return function(){FaxQueueEvents['removeListener'](_0x293693,_0x296946);};}exports[_0x75f7('0x4')]=function(_0x40f764){for(var _0x11139a=0x0,_0x201749=events['length'];_0x11139a<_0x201749;_0x11139a++){var _0x13c554=events[_0x11139a];var _0x175e21=createListener(_0x75f7('0x5')+_0x13c554,_0x40f764);FaxQueueEvents['on'](_0x13c554,_0x175e21);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index fbcbec6..6ec1d18 100644 --- a/server/api/faxQueue/index.js +++ b/server/api/faxQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['create','addAgents','put','delete','destroy','removeTeams','removeAgents','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','post'];(function(_0x1cd095,_0x43af58){var _0x2b1bcb=function(_0x1e4256){while(--_0x1e4256){_0x1cd095['push'](_0x1cd095['shift']());}};_0x2b1bcb(++_0x43af58);}(_0xbaf0,0x12a));var _0x0baf=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xbaf0[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var auth=require(_0x0baf('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0baf('0x6'));var controller=require(_0x0baf('0x7'));router[_0x0baf('0x8')]('/',auth[_0x0baf('0x9')](),controller[_0x0baf('0xa')]);router[_0x0baf('0x8')](_0x0baf('0xb'),auth[_0x0baf('0x9')](),controller[_0x0baf('0xc')]);router['get'](_0x0baf('0xd'),auth['isAuthenticated'](),controller[_0x0baf('0xe')]);router[_0x0baf('0x8')](_0x0baf('0xf'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x10')]);router[_0x0baf('0x8')](_0x0baf('0x11'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x12')]);router[_0x0baf('0x8')](_0x0baf('0x13'),auth['isAuthenticated'](),controller['getAgents']);router[_0x0baf('0x14')]('/',auth[_0x0baf('0x9')](),controller[_0x0baf('0x15')]);router[_0x0baf('0x14')]('/:id/teams',auth[_0x0baf('0x9')](),controller['addTeams']);router[_0x0baf('0x14')](_0x0baf('0x13'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x16')]);router[_0x0baf('0x17')](_0x0baf('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x0baf('0x18')](_0x0baf('0xd'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x19')]);router[_0x0baf('0x18')](_0x0baf('0x11'),auth['isAuthenticated'](),controller[_0x0baf('0x1a')]);router[_0x0baf('0x18')](_0x0baf('0x13'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x1b')]);module[_0x0baf('0x1c')]=router; \ No newline at end of file +var _0xbaf0=['create','addAgents','put','delete','destroy','removeTeams','removeAgents','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','post'];(function(_0xdfcfd1,_0x1ec03b){var _0x4e8035=function(_0x18d1c9){while(--_0x18d1c9){_0xdfcfd1['push'](_0xdfcfd1['shift']());}};_0x4e8035(++_0x1ec03b);}(_0xbaf0,0x12a));var _0x0baf=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xbaf0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var auth=require(_0x0baf('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0baf('0x6'));var controller=require(_0x0baf('0x7'));router[_0x0baf('0x8')]('/',auth[_0x0baf('0x9')](),controller[_0x0baf('0xa')]);router[_0x0baf('0x8')](_0x0baf('0xb'),auth[_0x0baf('0x9')](),controller[_0x0baf('0xc')]);router['get'](_0x0baf('0xd'),auth['isAuthenticated'](),controller[_0x0baf('0xe')]);router[_0x0baf('0x8')](_0x0baf('0xf'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x10')]);router[_0x0baf('0x8')](_0x0baf('0x11'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x12')]);router[_0x0baf('0x8')](_0x0baf('0x13'),auth['isAuthenticated'](),controller['getAgents']);router[_0x0baf('0x14')]('/',auth[_0x0baf('0x9')](),controller[_0x0baf('0x15')]);router[_0x0baf('0x14')]('/:id/teams',auth[_0x0baf('0x9')](),controller['addTeams']);router[_0x0baf('0x14')](_0x0baf('0x13'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x16')]);router[_0x0baf('0x17')](_0x0baf('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x0baf('0x18')](_0x0baf('0xd'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x19')]);router[_0x0baf('0x18')](_0x0baf('0x11'),auth['isAuthenticated'](),controller[_0x0baf('0x1a')]);router[_0x0baf('0x18')](_0x0baf('0x13'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x1b')]);module[_0x0baf('0x1c')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index a955a22..ea29f9e 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 _0x988c=['STRING','DATE','moment','sequelize','exports'];(function(_0x37c8c4,_0x192fbe){var _0x3f570f=function(_0x10fcb6){while(--_0x10fcb6){_0x37c8c4['push'](_0x37c8c4['shift']());}};_0x3f570f(++_0x192fbe);}(_0x988c,0xfc));var _0xc988=function(_0x417d68,_0x295f4f){_0x417d68=_0x417d68-0x0;var _0x59f88e=_0x988c[_0x417d68];return _0x59f88e;};'use strict';var moment=require(_0xc988('0x0'));var Sequelize=require(_0xc988('0x1'));module[_0xc988('0x2')]={'uniqueid':{'type':Sequelize[_0xc988('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xc988('0x4')]},'leaveAt':{'type':Sequelize[_0xc988('0x4')]},'acceptAt':{'type':Sequelize[_0xc988('0x4')]},'exitAt':{'type':Sequelize[_0xc988('0x4')]},'reason':{'type':Sequelize[_0xc988('0x3')]}}; \ No newline at end of file +var _0x889a=['STRING','DATE','sequelize','exports'];(function(_0x55b8aa,_0x321b5){var _0x4d56a2=function(_0x225e5b){while(--_0x225e5b){_0x55b8aa['push'](_0x55b8aa['shift']());}};_0x4d56a2(++_0x321b5);}(_0x889a,0x196));var _0xa889=function(_0x454f2b,_0x58e468){_0x454f2b=_0x454f2b-0x0;var _0x2b15a2=_0x889a[_0x454f2b];return _0x2b15a2;};'use strict';var moment=require('moment');var Sequelize=require(_0xa889('0x0'));module[_0xa889('0x1')]={'uniqueid':{'type':Sequelize[_0xa889('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xa889('0x3')]},'leaveAt':{'type':Sequelize[_0xa889('0x3')]},'acceptAt':{'type':Sequelize[_0xa889('0x3')]},'exitAt':{'type':Sequelize[_0xa889('0x3')]},'reason':{'type':Sequelize[_0xa889('0x2')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 072d96c..92b70f1 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 _0x36bd=['destroy','error','stack','name','map','FaxQueueReport','rawAttributes','fieldName','query','filters','model','intersection','fields','attributes','length','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','create','body','find','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','ejs','lodash','squel','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','save','update','then'];(function(_0x210753,_0x2523da){var _0x553a0d=function(_0x3a3942){while(--_0x3a3942){_0x210753['push'](_0x210753['shift']());}};_0x553a0d(++_0x2523da);}(_0x36bd,0x1c1));var _0xd36b=function(_0x2a4d62,_0x4846e8){_0x2a4d62=_0x2a4d62-0x0;var _0x560fb8=_0x36bd[_0x2a4d62];return _0x560fb8;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xd36b('0x0'));var zipdir=require(_0xd36b('0x1'));var jsonpatch=require(_0xd36b('0x2'));var rp=require(_0xd36b('0x3'));var moment=require(_0xd36b('0x4'));var BPromise=require(_0xd36b('0x5'));var Mustache=require(_0xd36b('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd36b('0x7'));var fs=require('fs');var _=require(_0xd36b('0x8'));var squel=require(_0xd36b('0x9'));var crypto=require('crypto');var jsforce=require(_0xd36b('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xd36b('0xb'));var querystring=require(_0xd36b('0xc'));var Papa=require('papaparse');var Redis=require(_0xd36b('0xd'));var authService=require(_0xd36b('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xd36b('0xf'));var hardwareService=require(_0xd36b('0x10'));var logger=require(_0xd36b('0x11'))(_0xd36b('0x12'));var utils=require(_0xd36b('0x13'));var config=require(_0xd36b('0x14'));var db=require(_0xd36b('0x15'))['db'];function respondWithStatusCode(_0x3edaee,_0x52e646){_0x52e646=_0x52e646||0xcc;return function(_0x3cad54){if(_0x3cad54){return _0x3edaee[_0xd36b('0x16')](_0x52e646);}return _0x3edaee[_0xd36b('0x17')](_0x52e646)[_0xd36b('0x18')]();};}function respondWithResult(_0x4896ea,_0x5195fa){_0x5195fa=_0x5195fa||0xc8;return function(_0x90af1a){if(_0x90af1a){return _0x4896ea[_0xd36b('0x17')](_0x5195fa)[_0xd36b('0x19')](_0x90af1a);}};}function respondWithFilteredResult(_0x5b6645,_0x77cb9e){return function(_0x4e17b9){if(_0x4e17b9){var _0x25e145=_0x4e17b9[_0xd36b('0x1a')],_0x3dba78=_0x77cb9e[_0xd36b('0x1b')],_0x56a513=_0x77cb9e[_0xd36b('0x1b')]+_0x77cb9e['limit'],_0x370c89;if(_0x56a513>=_0x25e145){_0x56a513=_0x25e145;_0x370c89=0xc8;}else{_0x370c89=0xce;}_0x5b6645['status'](_0x370c89);return _0x5b6645[_0xd36b('0x1c')](_0xd36b('0x1d'),_0x3dba78+'-'+_0x56a513+'/'+_0x25e145)[_0xd36b('0x19')](_0x4e17b9);}return null;};}function patchUpdates(_0x2f88d7){return function(_0x174609){try{jsonpatch[_0xd36b('0x1e')](_0x174609,_0x2f88d7,!![]);}catch(_0x305399){return BPromise['reject'](_0x305399);}return _0x174609[_0xd36b('0x1f')]();};}function saveUpdates(_0x30414a,_0x39a3cb){return function(_0x270a10){if(_0x270a10){return _0x270a10[_0xd36b('0x20')](_0x30414a)[_0xd36b('0x21')](function(_0x5775b2){return _0x5775b2;});}return null;};}function removeEntity(_0x3dcdeb,_0x3feb17){return function(_0x553d0d){if(_0x553d0d){return _0x553d0d[_0xd36b('0x22')]()[_0xd36b('0x21')](function(){_0x3dcdeb[_0xd36b('0x17')](0xcc)[_0xd36b('0x18')]();});}};}function handleEntityNotFound(_0x525e1a,_0x201c4f){return function(_0x533b33){if(!_0x533b33){_0x525e1a[_0xd36b('0x16')](0x194);}return _0x533b33;};}function handleError(_0x38a834,_0x29bfb2){_0x29bfb2=_0x29bfb2||0x1f4;return function(_0x138338){logger[_0xd36b('0x23')](_0x138338[_0xd36b('0x24')]);if(_0x138338[_0xd36b('0x25')]){delete _0x138338['name'];}_0x38a834[_0xd36b('0x17')](_0x29bfb2)['send'](_0x138338);};}exports['index']=function(_0x4467ac,_0x39b68e){var _0x578834={},_0x55ed21={},_0xd0ad14={'count':0x0,'rows':[]};var _0x7a3d4d=_[_0xd36b('0x26')](db[_0xd36b('0x27')][_0xd36b('0x28')],function(_0x19fa68){return{'name':_0x19fa68[_0xd36b('0x29')],'type':_0x19fa68['type']['key']};});_0x55ed21['model']=_[_0xd36b('0x26')](_0x7a3d4d,_0xd36b('0x25'));_0x55ed21[_0xd36b('0x2a')]=_['keys'](_0x4467ac[_0xd36b('0x2a')]);_0x55ed21[_0xd36b('0x2b')]=_['intersection'](_0x55ed21[_0xd36b('0x2c')],_0x55ed21['query']);_0x578834['attributes']=_[_0xd36b('0x2d')](_0x55ed21[_0xd36b('0x2c')],qs['fields'](_0x4467ac['query'][_0xd36b('0x2e')]));_0x578834[_0xd36b('0x2f')]=_0x578834[_0xd36b('0x2f')][_0xd36b('0x30')]?_0x578834[_0xd36b('0x2f')]:_0x55ed21[_0xd36b('0x2c')];if(!_0x4467ac['query']['hasOwnProperty']('nolimit')){_0x578834['limit']=qs[_0xd36b('0x31')](_0x4467ac[_0xd36b('0x2a')][_0xd36b('0x31')]);_0x578834[_0xd36b('0x1b')]=qs['offset'](_0x4467ac[_0xd36b('0x2a')][_0xd36b('0x1b')]);}_0x578834[_0xd36b('0x32')]=qs[_0xd36b('0x33')](_0x4467ac[_0xd36b('0x2a')]['sort']);_0x578834[_0xd36b('0x34')]=qs[_0xd36b('0x2b')](_[_0xd36b('0x35')](_0x4467ac['query'],_0x55ed21[_0xd36b('0x2b')]));if(_0x4467ac[_0xd36b('0x2a')][_0xd36b('0x36')]){_0x578834['where']=_[_0xd36b('0x37')](_0x578834[_0xd36b('0x34')],{'$or':_[_0xd36b('0x26')](_0x7a3d4d,function(_0x52e58a){if(_0x52e58a['type']!==_0xd36b('0x38')){var _0x4d3255={};_0x4d3255[_0x52e58a[_0xd36b('0x25')]]={'$like':'%'+_0x4467ac[_0xd36b('0x2a')]['filter']+'%'};return _0x4d3255;}})});}_0x578834=_[_0xd36b('0x37')]({},_0x578834,_0x4467ac[_0xd36b('0x39')]);var _0x3cf440={'where':_0x578834['where']};return db[_0xd36b('0x27')][_0xd36b('0x1a')](_0x3cf440)[_0xd36b('0x21')](function(_0x35f58f){_0xd0ad14['count']=_0x35f58f;if(_0x4467ac['query'][_0xd36b('0x3a')]){_0x578834['include']=[{'all':!![]}];}return db['FaxQueueReport'][_0xd36b('0x3b')](_0x578834);})['then'](function(_0x4944e6){_0xd0ad14[_0xd36b('0x3c')]=_0x4944e6;return _0xd0ad14;})[_0xd36b('0x21')](respondWithFilteredResult(_0x39b68e,_0x578834))[_0xd36b('0x3d')](handleError(_0x39b68e,null));};exports[_0xd36b('0x3e')]=function(_0x4b67fa,_0x86fa44){var _0x4ab927={'raw':!![],'where':{'id':_0x4b67fa[_0xd36b('0x3f')]['id']}},_0x55aa3c={};_0x55aa3c['model']=_['keys'](db['FaxQueueReport'][_0xd36b('0x28')]);_0x55aa3c[_0xd36b('0x2a')]=_['keys'](_0x4b67fa[_0xd36b('0x2a')]);_0x55aa3c[_0xd36b('0x2b')]=_['intersection'](_0x55aa3c[_0xd36b('0x2c')],_0x55aa3c[_0xd36b('0x2a')]);_0x4ab927[_0xd36b('0x2f')]=_[_0xd36b('0x2d')](_0x55aa3c[_0xd36b('0x2c')],qs['fields'](_0x4b67fa[_0xd36b('0x2a')][_0xd36b('0x2e')]));_0x4ab927['attributes']=_0x4ab927[_0xd36b('0x2f')][_0xd36b('0x30')]?_0x4ab927['attributes']:_0x55aa3c['model'];if(_0x4b67fa[_0xd36b('0x2a')][_0xd36b('0x3a')]){_0x4ab927[_0xd36b('0x40')]=[{'all':!![]}];}_0x4ab927=_['merge']({},_0x4ab927,_0x4b67fa[_0xd36b('0x39')]);return db[_0xd36b('0x27')]['find'](_0x4ab927)['then'](handleEntityNotFound(_0x86fa44,null))[_0xd36b('0x21')](respondWithResult(_0x86fa44,null))[_0xd36b('0x3d')](handleError(_0x86fa44,null));};exports['create']=function(_0x15f765,_0x1e4778){return db['FaxQueueReport'][_0xd36b('0x41')](_0x15f765[_0xd36b('0x42')],{})[_0xd36b('0x21')](respondWithResult(_0x1e4778,0xc9))['catch'](handleError(_0x1e4778,null));};exports[_0xd36b('0x20')]=function(_0x226124,_0x2b1189){if(_0x226124[_0xd36b('0x42')]['id']){delete _0x226124['body']['id'];}return db['FaxQueueReport'][_0xd36b('0x43')]({'where':{'id':_0x226124[_0xd36b('0x3f')]['id']}})[_0xd36b('0x21')](handleEntityNotFound(_0x2b1189,null))[_0xd36b('0x21')](saveUpdates(_0x226124[_0xd36b('0x42')],null))[_0xd36b('0x21')](respondWithResult(_0x2b1189,null))[_0xd36b('0x3d')](handleError(_0x2b1189,null));};exports[_0xd36b('0x22')]=function(_0x1c2d9,_0x58b795){return db[_0xd36b('0x27')][_0xd36b('0x43')]({'where':{'id':_0x1c2d9[_0xd36b('0x3f')]['id']}})[_0xd36b('0x21')](handleEntityNotFound(_0x58b795,null))[_0xd36b('0x21')](removeEntity(_0x58b795,null))[_0xd36b('0x3d')](handleError(_0x58b795,null));};exports[_0xd36b('0x44')]=function(_0x4bdcd1,_0x36b99b){return db['FaxQueueReport'][_0xd36b('0x44')]()[_0xd36b('0x21')](respondWithResult(_0x36b99b,null))[_0xd36b('0x3d')](handleError(_0x36b99b,null));}; \ No newline at end of file +var _0x8125=['request-promise','moment','bluebird','mustache','sox','to-csv','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','save','update','then','destroy','error','name','send','index','map','FaxQueueReport','rawAttributes','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','options','includeAll','include','findAll','rows','show','params','catch','create','body','describe','html-pdf','eml-format','zip-dir'];(function(_0xcb0eb2,_0x3906bf){var _0xbab9b8=function(_0x24fa8a){while(--_0x24fa8a){_0xcb0eb2['push'](_0xcb0eb2['shift']());}};_0xbab9b8(++_0x3906bf);}(_0x8125,0xd2));var _0x5812=function(_0x3d274d,_0x2040c9){_0x3d274d=_0x3d274d-0x0;var _0x3b13ad=_0x8125[_0x3d274d];return _0x3b13ad;};'use strict';var pdf=require(_0x5812('0x0'));var emlformat=require(_0x5812('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x5812('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5812('0x3'));var moment=require(_0x5812('0x4'));var BPromise=require(_0x5812('0x5'));var Mustache=require(_0x5812('0x6'));var util=require('util');var path=require('path');var sox=require(_0x5812('0x7'));var csv=require(_0x5812('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x5812('0x9'));var crypto=require(_0x5812('0xa'));var jsforce=require(_0x5812('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x5812('0x8'));var querystring=require(_0x5812('0xc'));var Papa=require(_0x5812('0xd'));var Redis=require('ioredis');var authService=require(_0x5812('0xe'));var qs=require(_0x5812('0xf'));var as=require(_0x5812('0x10'));var hardwareService=require(_0x5812('0x11'));var logger=require('../../config/logger')(_0x5812('0x12'));var utils=require(_0x5812('0x13'));var config=require(_0x5812('0x14'));var db=require(_0x5812('0x15'))['db'];function respondWithStatusCode(_0x3464f7,_0x323686){_0x323686=_0x323686||0xcc;return function(_0x5d1851){if(_0x5d1851){return _0x3464f7[_0x5812('0x16')](_0x323686);}return _0x3464f7[_0x5812('0x17')](_0x323686)[_0x5812('0x18')]();};}function respondWithResult(_0x5c3c6d,_0x534101){_0x534101=_0x534101||0xc8;return function(_0x21ceee){if(_0x21ceee){return _0x5c3c6d[_0x5812('0x17')](_0x534101)[_0x5812('0x19')](_0x21ceee);}};}function respondWithFilteredResult(_0x9dccc5,_0x485748){return function(_0x4bd861){if(_0x4bd861){var _0x4a2f1e=_0x4bd861[_0x5812('0x1a')],_0x4fe99f=_0x485748['offset'],_0x557d0f=_0x485748[_0x5812('0x1b')]+_0x485748['limit'],_0x51a751;if(_0x557d0f>=_0x4a2f1e){_0x557d0f=_0x4a2f1e;_0x51a751=0xc8;}else{_0x51a751=0xce;}_0x9dccc5['status'](_0x51a751);return _0x9dccc5[_0x5812('0x1c')](_0x5812('0x1d'),_0x4fe99f+'-'+_0x557d0f+'/'+_0x4a2f1e)['json'](_0x4bd861);}return null;};}function patchUpdates(_0xac4711){return function(_0x954b7a){try{jsonpatch[_0x5812('0x1e')](_0x954b7a,_0xac4711,!![]);}catch(_0x11795e){return BPromise['reject'](_0x11795e);}return _0x954b7a[_0x5812('0x1f')]();};}function saveUpdates(_0x17c28f,_0x386b66){return function(_0xfe7fc2){if(_0xfe7fc2){return _0xfe7fc2[_0x5812('0x20')](_0x17c28f)[_0x5812('0x21')](function(_0xc28fee){return _0xc28fee;});}return null;};}function removeEntity(_0x314d43,_0x45870e){return function(_0x46585d){if(_0x46585d){return _0x46585d[_0x5812('0x22')]()[_0x5812('0x21')](function(){_0x314d43[_0x5812('0x17')](0xcc)[_0x5812('0x18')]();});}};}function handleEntityNotFound(_0x5881c,_0x4b64ee){return function(_0xfc08ab){if(!_0xfc08ab){_0x5881c[_0x5812('0x16')](0x194);}return _0xfc08ab;};}function handleError(_0x53acaf,_0x5ee1c6){_0x5ee1c6=_0x5ee1c6||0x1f4;return function(_0x408c61){logger[_0x5812('0x23')](_0x408c61['stack']);if(_0x408c61['name']){delete _0x408c61[_0x5812('0x24')];}_0x53acaf[_0x5812('0x17')](_0x5ee1c6)[_0x5812('0x25')](_0x408c61);};}exports[_0x5812('0x26')]=function(_0x1e5f7f,_0x12aabb){var _0x5e7e3d={},_0x35391c={},_0x1dda9e={'count':0x0,'rows':[]};var _0x1b02d0=_[_0x5812('0x27')](db[_0x5812('0x28')][_0x5812('0x29')],function(_0x485bfa){return{'name':_0x485bfa['fieldName'],'type':_0x485bfa[_0x5812('0x2a')]['key']};});_0x35391c[_0x5812('0x2b')]=_['map'](_0x1b02d0,_0x5812('0x24'));_0x35391c[_0x5812('0x2c')]=_[_0x5812('0x2d')](_0x1e5f7f['query']);_0x35391c[_0x5812('0x2e')]=_['intersection'](_0x35391c[_0x5812('0x2b')],_0x35391c[_0x5812('0x2c')]);_0x5e7e3d[_0x5812('0x2f')]=_[_0x5812('0x30')](_0x35391c[_0x5812('0x2b')],qs[_0x5812('0x31')](_0x1e5f7f[_0x5812('0x2c')][_0x5812('0x31')]));_0x5e7e3d[_0x5812('0x2f')]=_0x5e7e3d[_0x5812('0x2f')][_0x5812('0x32')]?_0x5e7e3d[_0x5812('0x2f')]:_0x35391c[_0x5812('0x2b')];if(!_0x1e5f7f['query'][_0x5812('0x33')](_0x5812('0x34'))){_0x5e7e3d[_0x5812('0x35')]=qs[_0x5812('0x35')](_0x1e5f7f[_0x5812('0x2c')][_0x5812('0x35')]);_0x5e7e3d[_0x5812('0x1b')]=qs[_0x5812('0x1b')](_0x1e5f7f[_0x5812('0x2c')][_0x5812('0x1b')]);}_0x5e7e3d[_0x5812('0x36')]=qs[_0x5812('0x37')](_0x1e5f7f['query'][_0x5812('0x37')]);_0x5e7e3d['where']=qs[_0x5812('0x2e')](_[_0x5812('0x38')](_0x1e5f7f[_0x5812('0x2c')],_0x35391c[_0x5812('0x2e')]));if(_0x1e5f7f[_0x5812('0x2c')][_0x5812('0x39')]){_0x5e7e3d[_0x5812('0x3a')]=_[_0x5812('0x3b')](_0x5e7e3d['where'],{'$or':_[_0x5812('0x27')](_0x1b02d0,function(_0x4fccc0){if(_0x4fccc0[_0x5812('0x2a')]!=='VIRTUAL'){var _0x44edb2={};_0x44edb2[_0x4fccc0[_0x5812('0x24')]]={'$like':'%'+_0x1e5f7f[_0x5812('0x2c')][_0x5812('0x39')]+'%'};return _0x44edb2;}})});}_0x5e7e3d=_['merge']({},_0x5e7e3d,_0x1e5f7f[_0x5812('0x3c')]);var _0x4fb451={'where':_0x5e7e3d[_0x5812('0x3a')]};return db[_0x5812('0x28')][_0x5812('0x1a')](_0x4fb451)[_0x5812('0x21')](function(_0x537eda){_0x1dda9e['count']=_0x537eda;if(_0x1e5f7f[_0x5812('0x2c')][_0x5812('0x3d')]){_0x5e7e3d[_0x5812('0x3e')]=[{'all':!![]}];}return db['FaxQueueReport'][_0x5812('0x3f')](_0x5e7e3d);})[_0x5812('0x21')](function(_0x45d1a6){_0x1dda9e[_0x5812('0x40')]=_0x45d1a6;return _0x1dda9e;})[_0x5812('0x21')](respondWithFilteredResult(_0x12aabb,_0x5e7e3d))['catch'](handleError(_0x12aabb,null));};exports[_0x5812('0x41')]=function(_0x5d2d84,_0x2ec1ea){var _0x1348b0={'raw':!![],'where':{'id':_0x5d2d84[_0x5812('0x42')]['id']}},_0x58ec5f={};_0x58ec5f['model']=_[_0x5812('0x2d')](db[_0x5812('0x28')][_0x5812('0x29')]);_0x58ec5f['query']=_[_0x5812('0x2d')](_0x5d2d84[_0x5812('0x2c')]);_0x58ec5f[_0x5812('0x2e')]=_[_0x5812('0x30')](_0x58ec5f[_0x5812('0x2b')],_0x58ec5f[_0x5812('0x2c')]);_0x1348b0[_0x5812('0x2f')]=_[_0x5812('0x30')](_0x58ec5f['model'],qs['fields'](_0x5d2d84[_0x5812('0x2c')][_0x5812('0x31')]));_0x1348b0[_0x5812('0x2f')]=_0x1348b0['attributes'][_0x5812('0x32')]?_0x1348b0[_0x5812('0x2f')]:_0x58ec5f[_0x5812('0x2b')];if(_0x5d2d84[_0x5812('0x2c')]['includeAll']){_0x1348b0[_0x5812('0x3e')]=[{'all':!![]}];}_0x1348b0=_['merge']({},_0x1348b0,_0x5d2d84['options']);return db[_0x5812('0x28')]['find'](_0x1348b0)['then'](handleEntityNotFound(_0x2ec1ea,null))['then'](respondWithResult(_0x2ec1ea,null))[_0x5812('0x43')](handleError(_0x2ec1ea,null));};exports[_0x5812('0x44')]=function(_0x311e80,_0x53451b){return db[_0x5812('0x28')][_0x5812('0x44')](_0x311e80[_0x5812('0x45')],{})[_0x5812('0x21')](respondWithResult(_0x53451b,0xc9))[_0x5812('0x43')](handleError(_0x53451b,null));};exports[_0x5812('0x20')]=function(_0x364d1b,_0x22c7a1){if(_0x364d1b[_0x5812('0x45')]['id']){delete _0x364d1b[_0x5812('0x45')]['id'];}return db[_0x5812('0x28')]['find']({'where':{'id':_0x364d1b[_0x5812('0x42')]['id']}})[_0x5812('0x21')](handleEntityNotFound(_0x22c7a1,null))[_0x5812('0x21')](saveUpdates(_0x364d1b['body'],null))['then'](respondWithResult(_0x22c7a1,null))['catch'](handleError(_0x22c7a1,null));};exports[_0x5812('0x22')]=function(_0x5ca6dd,_0x4a9b85){return db[_0x5812('0x28')]['find']({'where':{'id':_0x5ca6dd[_0x5812('0x42')]['id']}})[_0x5812('0x21')](handleEntityNotFound(_0x4a9b85,null))['then'](removeEntity(_0x4a9b85,null))[_0x5812('0x43')](handleError(_0x4a9b85,null));};exports['describe']=function(_0x22f73b,_0x3e999c){return db[_0x5812('0x28')][_0x5812('0x46')]()[_0x5812('0x21')](respondWithResult(_0x3e999c,null))['catch'](handleError(_0x3e999c,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index c3b7765..bc52b1a 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 _0xae18=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','define','report_fax_queue','uniqueid','util'];(function(_0x25081f,_0x223347){var _0x5da204=function(_0x4c3cb4){while(--_0x4c3cb4){_0x25081f['push'](_0x25081f['shift']());}};_0x5da204(++_0x223347);}(_0xae18,0x74));var _0x8ae1=function(_0x582e23,_0x370658){_0x582e23=_0x582e23-0x0;var _0x515092=_0xae18[_0x582e23];return _0x515092;};'use strict';var _=require('lodash');var util=require(_0x8ae1('0x0'));var logger=require(_0x8ae1('0x1'))(_0x8ae1('0x2'));var moment=require(_0x8ae1('0x3'));var BPromise=require(_0x8ae1('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8ae1('0x5'));var rimraf=require(_0x8ae1('0x6'));var config=require(_0x8ae1('0x7'));var attributes=require(_0x8ae1('0x8'));module[_0x8ae1('0x9')]=function(_0x36788a,_0x4687df){return _0x36788a[_0x8ae1('0xa')]('FaxQueueReport',attributes,{'tableName':_0x8ae1('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x8ae1('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa314=['rimraf','../../config/environment','./faxQueueReport.attributes','exports','define','report_fax_queue','uniqueid','lodash','util','../../config/logger','api','moment','path'];(function(_0xd480a2,_0x4e0fac){var _0x436664=function(_0x4fc51d){while(--_0x4fc51d){_0xd480a2['push'](_0xd480a2['shift']());}};_0x436664(++_0x4e0fac);}(_0xa314,0x1ce));var _0x4a31=function(_0x40a77f,_0x1d5f8d){_0x40a77f=_0x40a77f-0x0;var _0x415aa1=_0xa314[_0x40a77f];return _0x415aa1;};'use strict';var _=require(_0x4a31('0x0'));var util=require(_0x4a31('0x1'));var logger=require(_0x4a31('0x2'))(_0x4a31('0x3'));var moment=require(_0x4a31('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4a31('0x5'));var rimraf=require(_0x4a31('0x6'));var config=require(_0x4a31('0x7'));var attributes=require(_0x4a31('0x8'));module[_0x4a31('0x9')]=function(_0xabc79f,_0x3cc0c6){return _0xabc79f[_0x4a31('0xa')]('FaxQueueReport',attributes,{'tableName':_0x4a31('0xb'),'paranoid':![],'indexes':[{'name':_0x4a31('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index cc2e84c..65562fa 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 _0x264e=['debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateFaxQueueReport','FaxQueueReport','create','body','options','raw','UpdateFaxQueueReport','update','where','limit','lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent'];(function(_0x14e5c0,_0x2c8436){var _0x5332fd=function(_0x4536e7){while(--_0x4536e7){_0x14e5c0['push'](_0x14e5c0['shift']());}};_0x5332fd(++_0x2c8436);}(_0x264e,0x1b1));var _0xe264=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x264e[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0xe264('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xe264('0x1'));var rs=require(_0xe264('0x2'));var fs=require('fs');var Redis=require(_0xe264('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xe264('0x4'));var logger=require(_0xe264('0x5'))(_0xe264('0x6'));var config=require(_0xe264('0x7'));var jayson=require(_0xe264('0x8'));var client=jayson[_0xe264('0x9')][_0xe264('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3574d9,_0x5c37cb,_0x744844){return new BPromise(function(_0x4e7bc3,_0x4755f5){return client['request'](_0x3574d9,_0x744844)[_0xe264('0xb')](function(_0x239846){logger[_0xe264('0xc')](_0xe264('0xd'),_0x5c37cb,_0xe264('0xe'));logger[_0xe264('0xf')](_0xe264('0x10'),_0x5c37cb,_0xe264('0xe'),JSON[_0xe264('0x11')](_0x239846));if(_0x239846[_0xe264('0x12')]){if(_0x239846[_0xe264('0x12')]['code']===0x1f4){logger['error'](_0xe264('0xd'),_0x5c37cb,_0x239846[_0xe264('0x12')]['message']);return _0x4755f5(_0x239846['error']['message']);}logger['error'](_0xe264('0xd'),_0x5c37cb,_0x239846[_0xe264('0x12')][_0xe264('0x13')]);return _0x4e7bc3(_0x239846[_0xe264('0x12')][_0xe264('0x13')]);}else{logger[_0xe264('0xc')](_0xe264('0xd'),_0x5c37cb,_0xe264('0xe'));_0x4e7bc3(_0x239846[_0xe264('0x14')]['message']);}})[_0xe264('0x15')](function(_0x3ad01f){logger[_0xe264('0x12')](_0xe264('0xd'),_0x5c37cb,_0x3ad01f);_0x4755f5(_0x3ad01f);});});}exports[_0xe264('0x16')]=function(_0x377aeb){var _0x294e4d=this;return new Promise(function(_0x9b7f49,_0x719056){return db[_0xe264('0x17')][_0xe264('0x18')](_0x377aeb[_0xe264('0x19')],{'raw':_0x377aeb['options']?_0x377aeb[_0xe264('0x1a')][_0xe264('0x1b')]===undefined?!![]:![]:!![]})[_0xe264('0xb')](function(_0x570cb7){logger['info']('CreateFaxQueueReport',_0x377aeb);logger[_0xe264('0xf')](_0xe264('0x16'),_0x377aeb,JSON[_0xe264('0x11')](_0x570cb7));_0x9b7f49(_0x570cb7);})[_0xe264('0x15')](function(_0x548369){logger[_0xe264('0x12')](_0xe264('0x16'),_0x548369[_0xe264('0x13')],_0x377aeb);_0x719056(_0x294e4d[_0xe264('0x12')](0x1f4,_0x548369[_0xe264('0x13')]));});});};exports[_0xe264('0x1c')]=function(_0x3c7efb){var _0x2c9cad=this;return new Promise(function(_0xd9a84e,_0x44bdf8){return db[_0xe264('0x17')][_0xe264('0x1d')](_0x3c7efb['body'],{'raw':_0x3c7efb[_0xe264('0x1a')]?_0x3c7efb[_0xe264('0x1a')][_0xe264('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3c7efb[_0xe264('0x1a')]?_0x3c7efb[_0xe264('0x1a')][_0xe264('0x1e')]||null:null,'attributes':_0x3c7efb[_0xe264('0x1a')]?_0x3c7efb[_0xe264('0x1a')]['attributes']||null:null,'limit':_0x3c7efb[_0xe264('0x1a')]?_0x3c7efb[_0xe264('0x1a')][_0xe264('0x1f')]||null:null})['then'](function(_0x4eebf9){logger['info'](_0xe264('0x1c'),_0x3c7efb);logger[_0xe264('0xf')](_0xe264('0x1c'),_0x3c7efb,JSON[_0xe264('0x11')](_0x4eebf9));_0xd9a84e(_0x4eebf9);})[_0xe264('0x15')](function(_0x1ee92a){logger['error'](_0xe264('0x1c'),_0x1ee92a[_0xe264('0x13')],_0x3c7efb);_0x44bdf8(_0x2c9cad[_0xe264('0x12')](0x1f4,_0x1ee92a[_0xe264('0x13')]));});});}; \ No newline at end of file +var _0xdff8=['stringify','error','code','FaxQueueReport,\x20%s,\x20%s','message','result','catch','FaxQueueReport','create','body','options','raw','CreateFaxQueueReport','UpdateFaxQueueReport','update','attributes','lodash','util','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xdff8,0xd6));var _0x8dff=function(_0x5f76e3,_0x977880){_0x5f76e3=_0x5f76e3-0x0;var _0x4a5558=_0xdff8[_0x5f76e3];return _0x4a5558;};'use strict';var _=require(_0x8dff('0x0'));var util=require(_0x8dff('0x1'));var moment=require(_0x8dff('0x2'));var BPromise=require(_0x8dff('0x3'));var rs=require(_0x8dff('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8dff('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x8dff('0x6'));var config=require(_0x8dff('0x7'));var jayson=require(_0x8dff('0x8'));var client=jayson[_0x8dff('0x9')][_0x8dff('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xec9255,_0x26e0f8,_0xf103c0){return new BPromise(function(_0x59b634,_0x221821){return client[_0x8dff('0xb')](_0xec9255,_0xf103c0)[_0x8dff('0xc')](function(_0x265ab6){logger[_0x8dff('0xd')]('FaxQueueReport,\x20%s,\x20%s',_0x26e0f8,_0x8dff('0xe'));logger[_0x8dff('0xf')](_0x8dff('0x10'),_0x26e0f8,_0x8dff('0xe'),JSON[_0x8dff('0x11')](_0x265ab6));if(_0x265ab6[_0x8dff('0x12')]){if(_0x265ab6[_0x8dff('0x12')][_0x8dff('0x13')]===0x1f4){logger['error'](_0x8dff('0x14'),_0x26e0f8,_0x265ab6[_0x8dff('0x12')][_0x8dff('0x15')]);return _0x221821(_0x265ab6[_0x8dff('0x12')][_0x8dff('0x15')]);}logger['error']('FaxQueueReport,\x20%s,\x20%s',_0x26e0f8,_0x265ab6[_0x8dff('0x12')][_0x8dff('0x15')]);return _0x59b634(_0x265ab6['error'][_0x8dff('0x15')]);}else{logger[_0x8dff('0xd')](_0x8dff('0x14'),_0x26e0f8,_0x8dff('0xe'));_0x59b634(_0x265ab6[_0x8dff('0x16')][_0x8dff('0x15')]);}})[_0x8dff('0x17')](function(_0x2d15a5){logger[_0x8dff('0x12')]('FaxQueueReport,\x20%s,\x20%s',_0x26e0f8,_0x2d15a5);_0x221821(_0x2d15a5);});});}exports['CreateFaxQueueReport']=function(_0x2376f4){var _0x264071=this;return new Promise(function(_0xe417a4,_0x20cf89){return db[_0x8dff('0x18')][_0x8dff('0x19')](_0x2376f4[_0x8dff('0x1a')],{'raw':_0x2376f4[_0x8dff('0x1b')]?_0x2376f4['options'][_0x8dff('0x1c')]===undefined?!![]:![]:!![]})[_0x8dff('0xc')](function(_0x75407b){logger['info'](_0x8dff('0x1d'),_0x2376f4);logger[_0x8dff('0xf')](_0x8dff('0x1d'),_0x2376f4,JSON['stringify'](_0x75407b));_0xe417a4(_0x75407b);})[_0x8dff('0x17')](function(_0x19a426){logger[_0x8dff('0x12')](_0x8dff('0x1d'),_0x19a426[_0x8dff('0x15')],_0x2376f4);_0x20cf89(_0x264071['error'](0x1f4,_0x19a426[_0x8dff('0x15')]));});});};exports[_0x8dff('0x1e')]=function(_0x4db471){var _0x3be640=this;return new Promise(function(_0x8d6261,_0x268cc4){return db['FaxQueueReport'][_0x8dff('0x1f')](_0x4db471[_0x8dff('0x1a')],{'raw':_0x4db471[_0x8dff('0x1b')]?_0x4db471['options'][_0x8dff('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4db471[_0x8dff('0x1b')]?_0x4db471[_0x8dff('0x1b')]['where']||null:null,'attributes':_0x4db471[_0x8dff('0x1b')]?_0x4db471[_0x8dff('0x1b')][_0x8dff('0x20')]||null:null,'limit':_0x4db471[_0x8dff('0x1b')]?_0x4db471[_0x8dff('0x1b')]['limit']||null:null})['then'](function(_0x46cac9){logger['info'](_0x8dff('0x1e'),_0x4db471);logger[_0x8dff('0xf')]('UpdateFaxQueueReport',_0x4db471,JSON[_0x8dff('0x11')](_0x46cac9));_0x8d6261(_0x46cac9);})['catch'](function(_0x38f787){logger[_0x8dff('0x12')]('UpdateFaxQueueReport',_0x38f787[_0x8dff('0x15')],_0x4db471);_0x268cc4(_0x3be640[_0x8dff('0x12')](0x1f4,_0x38f787[_0x8dff('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index 00639ab..4299346 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 _0xf334=['destroy','exports','multer','util','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','isAuthenticated','describe','show','post','put','update','delete'];(function(_0x69a451,_0x49fd37){var _0x3d6ef5=function(_0x27ebf4){while(--_0x27ebf4){_0x69a451['push'](_0x69a451['shift']());}};_0x3d6ef5(++_0x49fd37);}(_0xf334,0x178));var _0x4f33=function(_0x451dee,_0x1b4320){_0x451dee=_0x451dee-0x0;var _0x4ad728=_0xf334[_0x451dee];return _0x4ad728;};'use strict';var multer=require(_0x4f33('0x0'));var util=require(_0x4f33('0x1'));var path=require('path');var timeout=require(_0x4f33('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x4f33('0x3'));var interaction=require(_0x4f33('0x4'));var config=require(_0x4f33('0x5'));var controller=require('./faxQueueReport.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x4f33('0x6')]);router[_0x4f33('0x7')]('/describe',auth[_0x4f33('0x8')](),controller[_0x4f33('0x9')]);router[_0x4f33('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x4f33('0xa')]);router[_0x4f33('0xb')]('/',auth[_0x4f33('0x8')](),controller['create']);router[_0x4f33('0xc')]('/:id',auth['isAuthenticated'](),controller[_0x4f33('0xd')]);router[_0x4f33('0xe')]('/:id',auth[_0x4f33('0x8')](),controller[_0x4f33('0xf')]);module[_0x4f33('0x10')]=router; \ No newline at end of file +var _0x471a=['put','update','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','./faxQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create'];(function(_0x524939,_0x3cc0fb){var _0x1676dc=function(_0x6c27cc){while(--_0x6c27cc){_0x524939['push'](_0x524939['shift']());}};_0x1676dc(++_0x3cc0fb);}(_0x471a,0x8a));var _0xa471=function(_0x2699d7,_0x41d731){_0x2699d7=_0x2699d7-0x0;var _0x350f71=_0x471a[_0x2699d7];return _0x350f71;};'use strict';var multer=require(_0xa471('0x0'));var util=require(_0xa471('0x1'));var path=require(_0xa471('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa471('0x3')]();var auth=require(_0xa471('0x4'));var interaction=require(_0xa471('0x5'));var config=require('../../config/environment');var controller=require(_0xa471('0x6'));router[_0xa471('0x7')]('/',auth[_0xa471('0x8')](),controller[_0xa471('0x9')]);router[_0xa471('0x7')](_0xa471('0xa'),auth[_0xa471('0x8')](),controller[_0xa471('0xb')]);router['get'](_0xa471('0xc'),auth[_0xa471('0x8')](),controller[_0xa471('0xd')]);router['post']('/',auth[_0xa471('0x8')](),controller[_0xa471('0xe')]);router[_0xa471('0xf')](_0xa471('0xc'),auth['isAuthenticated'](),controller[_0xa471('0x10')]);router['delete'](_0xa471('0xc'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index ee30985..3d7feae 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 _0x0b05=['sequelize','exports','STRING','ENUM','account','agent','DATE','NOW','moment'];(function(_0x2b3468,_0x2c3e5d){var _0x276fc4=function(_0x93e9ea){while(--_0x93e9ea){_0x2b3468['push'](_0x2b3468['shift']());}};_0x276fc4(++_0x2c3e5d);}(_0x0b05,0xd7));var _0x50b0=function(_0x18cd5b,_0x10240b){_0x18cd5b=_0x18cd5b-0x0;var _0x5eaa52=_0x0b05[_0x18cd5b];return _0x5eaa52;};'use strict';var moment=require(_0x50b0('0x0'));var Sequelize=require(_0x50b0('0x1'));module[_0x50b0('0x2')]={'uniqueid':{'type':Sequelize[_0x50b0('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x50b0('0x4')](_0x50b0('0x5'),_0x50b0('0x6'),'queue'),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0x50b0('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x50b0('0x8')]}}; \ No newline at end of file +var _0xe0ef=['NOW','sequelize','exports','ENUM','account','agent','queue','DATE'];(function(_0x34e94a,_0x2da491){var _0x2a8106=function(_0x2aa904){while(--_0x2aa904){_0x34e94a['push'](_0x34e94a['shift']());}};_0x2a8106(++_0x2da491);}(_0xe0ef,0x99));var _0xfe0e=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xe0ef[_0x122ef9];return _0x42fba0;};'use strict';var moment=require('moment');var Sequelize=require(_0xfe0e('0x0'));module[_0xfe0e('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xfe0e('0x2')](_0xfe0e('0x3'),_0xfe0e('0x4'),_0xfe0e('0x5')),'allowNull':![],'defaultValue':_0xfe0e('0x5')},'transferredAt':{'type':Sequelize[_0xfe0e('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xfe0e('0x7')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index 9781870..23d9577 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 _0x0626=['sort','pick','filter','where','type','VIRTUAL','merge','options','FaxTransferReport','includeAll','include','findAll','rows','catch','show','params','create','body','find','describe','html-pdf','rimraf','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit'];(function(_0xc0a4ed,_0x38de4e){var _0x3fddc9=function(_0x247e57){while(--_0x247e57){_0xc0a4ed['push'](_0xc0a4ed['shift']());}};_0x3fddc9(++_0x38de4e);}(_0x0626,0xa8));var _0x6062=function(_0x51c720,_0x3f38b4){_0x51c720=_0x51c720-0x0;var _0x47e95e=_0x0626[_0x51c720];return _0x47e95e;};'use strict';var pdf=require(_0x6062('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x6062('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x6062('0x2'));var moment=require('moment');var BPromise=require(_0x6062('0x3'));var Mustache=require(_0x6062('0x4'));var util=require(_0x6062('0x5'));var path=require(_0x6062('0x6'));var sox=require(_0x6062('0x7'));var csv=require(_0x6062('0x8'));var ejs=require(_0x6062('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x6062('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x6062('0xb'));var toCsv=require(_0x6062('0x8'));var querystring=require(_0x6062('0xc'));var Papa=require(_0x6062('0xd'));var Redis=require(_0x6062('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x6062('0xf'));var as=require(_0x6062('0x10'));var hardwareService=require(_0x6062('0x11'));var logger=require(_0x6062('0x12'))(_0x6062('0x13'));var utils=require(_0x6062('0x14'));var config=require(_0x6062('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2e6274,_0x5676bc){_0x5676bc=_0x5676bc||0xcc;return function(_0x29ecdc){if(_0x29ecdc){return _0x2e6274[_0x6062('0x16')](_0x5676bc);}return _0x2e6274[_0x6062('0x17')](_0x5676bc)[_0x6062('0x18')]();};}function respondWithResult(_0x12ce34,_0x1e7d63){_0x1e7d63=_0x1e7d63||0xc8;return function(_0x2eb822){if(_0x2eb822){return _0x12ce34['status'](_0x1e7d63)[_0x6062('0x19')](_0x2eb822);}};}function respondWithFilteredResult(_0xc5ed2b,_0x106310){return function(_0x76f166){if(_0x76f166){var _0xc470d4=_0x76f166[_0x6062('0x1a')],_0x412d62=_0x106310[_0x6062('0x1b')],_0x44de2e=_0x106310[_0x6062('0x1b')]+_0x106310['limit'],_0x3b1624;if(_0x44de2e>=_0xc470d4){_0x44de2e=_0xc470d4;_0x3b1624=0xc8;}else{_0x3b1624=0xce;}_0xc5ed2b[_0x6062('0x17')](_0x3b1624);return _0xc5ed2b[_0x6062('0x1c')](_0x6062('0x1d'),_0x412d62+'-'+_0x44de2e+'/'+_0xc470d4)[_0x6062('0x19')](_0x76f166);}return null;};}function patchUpdates(_0x313243){return function(_0x40f7b9){try{jsonpatch[_0x6062('0x1e')](_0x40f7b9,_0x313243,!![]);}catch(_0x41e324){return BPromise[_0x6062('0x1f')](_0x41e324);}return _0x40f7b9[_0x6062('0x20')]();};}function saveUpdates(_0x5e6fac,_0x483cee){return function(_0x5cc4ea){if(_0x5cc4ea){return _0x5cc4ea[_0x6062('0x21')](_0x5e6fac)[_0x6062('0x22')](function(_0x35aad4){return _0x35aad4;});}return null;};}function removeEntity(_0x204586,_0x5d5f21){return function(_0x4fa9e8){if(_0x4fa9e8){return _0x4fa9e8[_0x6062('0x23')]()[_0x6062('0x22')](function(){_0x204586[_0x6062('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e2d4b,_0xc5a0bd){return function(_0x3ac911){if(!_0x3ac911){_0x3e2d4b[_0x6062('0x16')](0x194);}return _0x3ac911;};}function handleError(_0x2d5801,_0x42dcd8){_0x42dcd8=_0x42dcd8||0x1f4;return function(_0x4e6f7a){logger[_0x6062('0x24')](_0x4e6f7a['stack']);if(_0x4e6f7a[_0x6062('0x25')]){delete _0x4e6f7a[_0x6062('0x25')];}_0x2d5801[_0x6062('0x17')](_0x42dcd8)[_0x6062('0x26')](_0x4e6f7a);};}exports[_0x6062('0x27')]=function(_0xf4983,_0x432d7f){var _0x51d7ea={},_0x54e0e7={},_0x5f8a9d={'count':0x0,'rows':[]};var _0xcb5d4f=_[_0x6062('0x28')](db['FaxTransferReport'][_0x6062('0x29')],function(_0x189ada){return{'name':_0x189ada[_0x6062('0x2a')],'type':_0x189ada['type'][_0x6062('0x2b')]};});_0x54e0e7[_0x6062('0x2c')]=_[_0x6062('0x28')](_0xcb5d4f,'name');_0x54e0e7[_0x6062('0x2d')]=_['keys'](_0xf4983['query']);_0x54e0e7[_0x6062('0x2e')]=_[_0x6062('0x2f')](_0x54e0e7[_0x6062('0x2c')],_0x54e0e7[_0x6062('0x2d')]);_0x51d7ea[_0x6062('0x30')]=_[_0x6062('0x2f')](_0x54e0e7[_0x6062('0x2c')],qs[_0x6062('0x31')](_0xf4983[_0x6062('0x2d')][_0x6062('0x31')]));_0x51d7ea[_0x6062('0x30')]=_0x51d7ea[_0x6062('0x30')][_0x6062('0x32')]?_0x51d7ea[_0x6062('0x30')]:_0x54e0e7[_0x6062('0x2c')];if(!_0xf4983[_0x6062('0x2d')][_0x6062('0x33')](_0x6062('0x34'))){_0x51d7ea[_0x6062('0x35')]=qs[_0x6062('0x35')](_0xf4983[_0x6062('0x2d')][_0x6062('0x35')]);_0x51d7ea[_0x6062('0x1b')]=qs['offset'](_0xf4983['query']['offset']);}_0x51d7ea['order']=qs['sort'](_0xf4983['query'][_0x6062('0x36')]);_0x51d7ea['where']=qs[_0x6062('0x2e')](_[_0x6062('0x37')](_0xf4983[_0x6062('0x2d')],_0x54e0e7[_0x6062('0x2e')]));if(_0xf4983[_0x6062('0x2d')][_0x6062('0x38')]){_0x51d7ea[_0x6062('0x39')]=_['merge'](_0x51d7ea[_0x6062('0x39')],{'$or':_[_0x6062('0x28')](_0xcb5d4f,function(_0x15dd52){if(_0x15dd52[_0x6062('0x3a')]!==_0x6062('0x3b')){var _0x359b45={};_0x359b45[_0x15dd52[_0x6062('0x25')]]={'$like':'%'+_0xf4983[_0x6062('0x2d')][_0x6062('0x38')]+'%'};return _0x359b45;}})});}_0x51d7ea=_[_0x6062('0x3c')]({},_0x51d7ea,_0xf4983[_0x6062('0x3d')]);var _0x18ecc4={'where':_0x51d7ea[_0x6062('0x39')]};return db[_0x6062('0x3e')][_0x6062('0x1a')](_0x18ecc4)[_0x6062('0x22')](function(_0x17f93a){_0x5f8a9d[_0x6062('0x1a')]=_0x17f93a;if(_0xf4983[_0x6062('0x2d')][_0x6062('0x3f')]){_0x51d7ea[_0x6062('0x40')]=[{'all':!![]}];}return db[_0x6062('0x3e')][_0x6062('0x41')](_0x51d7ea);})[_0x6062('0x22')](function(_0x15fda2){_0x5f8a9d[_0x6062('0x42')]=_0x15fda2;return _0x5f8a9d;})['then'](respondWithFilteredResult(_0x432d7f,_0x51d7ea))[_0x6062('0x43')](handleError(_0x432d7f,null));};exports[_0x6062('0x44')]=function(_0x52d5c6,_0x16ed5d){var _0x4c318c={'raw':!![],'where':{'id':_0x52d5c6[_0x6062('0x45')]['id']}},_0x5b61b1={};_0x5b61b1['model']=_['keys'](db[_0x6062('0x3e')][_0x6062('0x29')]);_0x5b61b1[_0x6062('0x2d')]=_['keys'](_0x52d5c6[_0x6062('0x2d')]);_0x5b61b1[_0x6062('0x2e')]=_[_0x6062('0x2f')](_0x5b61b1['model'],_0x5b61b1[_0x6062('0x2d')]);_0x4c318c[_0x6062('0x30')]=_['intersection'](_0x5b61b1[_0x6062('0x2c')],qs[_0x6062('0x31')](_0x52d5c6[_0x6062('0x2d')][_0x6062('0x31')]));_0x4c318c[_0x6062('0x30')]=_0x4c318c[_0x6062('0x30')]['length']?_0x4c318c[_0x6062('0x30')]:_0x5b61b1[_0x6062('0x2c')];if(_0x52d5c6[_0x6062('0x2d')]['includeAll']){_0x4c318c[_0x6062('0x40')]=[{'all':!![]}];}_0x4c318c=_[_0x6062('0x3c')]({},_0x4c318c,_0x52d5c6[_0x6062('0x3d')]);return db[_0x6062('0x3e')]['find'](_0x4c318c)['then'](handleEntityNotFound(_0x16ed5d,null))[_0x6062('0x22')](respondWithResult(_0x16ed5d,null))[_0x6062('0x43')](handleError(_0x16ed5d,null));};exports[_0x6062('0x46')]=function(_0x200a05,_0x3391e7){return db[_0x6062('0x3e')][_0x6062('0x46')](_0x200a05[_0x6062('0x47')],{})[_0x6062('0x22')](respondWithResult(_0x3391e7,0xc9))[_0x6062('0x43')](handleError(_0x3391e7,null));};exports['update']=function(_0x2f217a,_0x17c1f8){if(_0x2f217a[_0x6062('0x47')]['id']){delete _0x2f217a['body']['id'];}return db['FaxTransferReport']['find']({'where':{'id':_0x2f217a['params']['id']}})[_0x6062('0x22')](handleEntityNotFound(_0x17c1f8,null))['then'](saveUpdates(_0x2f217a[_0x6062('0x47')],null))[_0x6062('0x22')](respondWithResult(_0x17c1f8,null))[_0x6062('0x43')](handleError(_0x17c1f8,null));};exports['destroy']=function(_0xb7b34f,_0x1ad8ba){return db['FaxTransferReport'][_0x6062('0x48')]({'where':{'id':_0xb7b34f['params']['id']}})[_0x6062('0x22')](handleEntityNotFound(_0x1ad8ba,null))['then'](removeEntity(_0x1ad8ba,null))[_0x6062('0x43')](handleError(_0x1ad8ba,null));};exports[_0x6062('0x49')]=function(_0x4f465c,_0x3bc55c){return db[_0x6062('0x3e')][_0x6062('0x49')]()[_0x6062('0x22')](respondWithResult(_0x3bc55c,null))[_0x6062('0x43')](handleError(_0x3bc55c,null));}; \ No newline at end of file +var _0x80d0=['rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','hasOwnProperty','order','where','pick','VIRTUAL','filter','merge','options','FaxTransferReport','includeAll','include','findAll','rows','catch','show','params','keys','length','find','create','body','describe','html-pdf','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','json','count','offset','limit','status','Content-Range','save','update','then','error','stack','name','index','map'];(function(_0x399338,_0x11496b){var _0x3c4485=function(_0x17e385){while(--_0x17e385){_0x399338['push'](_0x399338['shift']());}};_0x3c4485(++_0x11496b);}(_0x80d0,0xaf));var _0x080d=function(_0x4b25ba,_0xcafd20){_0x4b25ba=_0x4b25ba-0x0;var _0x3acd80=_0x80d0[_0x4b25ba];return _0x3acd80;};'use strict';var pdf=require(_0x080d('0x0'));var emlformat=require(_0x080d('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x080d('0x2'));var rp=require(_0x080d('0x3'));var moment=require('moment');var BPromise=require(_0x080d('0x4'));var Mustache=require(_0x080d('0x5'));var util=require(_0x080d('0x6'));var path=require(_0x080d('0x7'));var sox=require(_0x080d('0x8'));var csv=require(_0x080d('0x9'));var ejs=require(_0x080d('0xa'));var fs=require('fs');var _=require(_0x080d('0xb'));var squel=require('squel');var crypto=require(_0x080d('0xc'));var jsforce=require(_0x080d('0xd'));var deskjs=require(_0x080d('0xe'));var toCsv=require('to-csv');var querystring=require(_0x080d('0xf'));var Papa=require(_0x080d('0x10'));var Redis=require(_0x080d('0x11'));var authService=require(_0x080d('0x12'));var qs=require(_0x080d('0x13'));var as=require(_0x080d('0x14'));var hardwareService=require(_0x080d('0x15'));var logger=require(_0x080d('0x16'))('api');var utils=require(_0x080d('0x17'));var config=require(_0x080d('0x18'));var db=require(_0x080d('0x19'))['db'];function respondWithStatusCode(_0x3e85f1,_0x282d27){_0x282d27=_0x282d27||0xcc;return function(_0x14cdc3){if(_0x14cdc3){return _0x3e85f1[_0x080d('0x1a')](_0x282d27);}return _0x3e85f1['status'](_0x282d27)['end']();};}function respondWithResult(_0x2442d5,_0x2ec65a){_0x2ec65a=_0x2ec65a||0xc8;return function(_0x22e290){if(_0x22e290){return _0x2442d5['status'](_0x2ec65a)[_0x080d('0x1b')](_0x22e290);}};}function respondWithFilteredResult(_0x17e90c,_0x4b10cf){return function(_0x1819b7){if(_0x1819b7){var _0x3cf311=_0x1819b7[_0x080d('0x1c')],_0x538bce=_0x4b10cf[_0x080d('0x1d')],_0x315c17=_0x4b10cf[_0x080d('0x1d')]+_0x4b10cf[_0x080d('0x1e')],_0x167f1a;if(_0x315c17>=_0x3cf311){_0x315c17=_0x3cf311;_0x167f1a=0xc8;}else{_0x167f1a=0xce;}_0x17e90c[_0x080d('0x1f')](_0x167f1a);return _0x17e90c['set'](_0x080d('0x20'),_0x538bce+'-'+_0x315c17+'/'+_0x3cf311)['json'](_0x1819b7);}return null;};}function patchUpdates(_0x234cd4){return function(_0x1d9790){try{jsonpatch['apply'](_0x1d9790,_0x234cd4,!![]);}catch(_0x47adb8){return BPromise['reject'](_0x47adb8);}return _0x1d9790[_0x080d('0x21')]();};}function saveUpdates(_0x23e516,_0x201772){return function(_0x88b106){if(_0x88b106){return _0x88b106[_0x080d('0x22')](_0x23e516)['then'](function(_0x5675d3){return _0x5675d3;});}return null;};}function removeEntity(_0xc550c5,_0x4172c8){return function(_0x46d2e6){if(_0x46d2e6){return _0x46d2e6['destroy']()[_0x080d('0x23')](function(){_0xc550c5['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x461d9f,_0x3ebdc0){return function(_0x412de5){if(!_0x412de5){_0x461d9f[_0x080d('0x1a')](0x194);}return _0x412de5;};}function handleError(_0x1b31ae,_0x153866){_0x153866=_0x153866||0x1f4;return function(_0x37ff8b){logger[_0x080d('0x24')](_0x37ff8b[_0x080d('0x25')]);if(_0x37ff8b[_0x080d('0x26')]){delete _0x37ff8b[_0x080d('0x26')];}_0x1b31ae[_0x080d('0x1f')](_0x153866)['send'](_0x37ff8b);};}exports[_0x080d('0x27')]=function(_0x2e67bc,_0x2a06bb){var _0x29c0e8={},_0x2341d3={},_0x1384c4={'count':0x0,'rows':[]};var _0x35e9c8=_[_0x080d('0x28')](db['FaxTransferReport'][_0x080d('0x29')],function(_0x21e88e){return{'name':_0x21e88e[_0x080d('0x2a')],'type':_0x21e88e[_0x080d('0x2b')]['key']};});_0x2341d3[_0x080d('0x2c')]=_[_0x080d('0x28')](_0x35e9c8,'name');_0x2341d3[_0x080d('0x2d')]=_['keys'](_0x2e67bc[_0x080d('0x2d')]);_0x2341d3[_0x080d('0x2e')]=_[_0x080d('0x2f')](_0x2341d3[_0x080d('0x2c')],_0x2341d3[_0x080d('0x2d')]);_0x29c0e8[_0x080d('0x30')]=_[_0x080d('0x2f')](_0x2341d3[_0x080d('0x2c')],qs[_0x080d('0x31')](_0x2e67bc[_0x080d('0x2d')][_0x080d('0x31')]));_0x29c0e8[_0x080d('0x30')]=_0x29c0e8['attributes']['length']?_0x29c0e8[_0x080d('0x30')]:_0x2341d3[_0x080d('0x2c')];if(!_0x2e67bc['query'][_0x080d('0x32')]('nolimit')){_0x29c0e8[_0x080d('0x1e')]=qs['limit'](_0x2e67bc[_0x080d('0x2d')][_0x080d('0x1e')]);_0x29c0e8['offset']=qs['offset'](_0x2e67bc[_0x080d('0x2d')][_0x080d('0x1d')]);}_0x29c0e8[_0x080d('0x33')]=qs['sort'](_0x2e67bc[_0x080d('0x2d')]['sort']);_0x29c0e8[_0x080d('0x34')]=qs['filters'](_[_0x080d('0x35')](_0x2e67bc[_0x080d('0x2d')],_0x2341d3['filters']));if(_0x2e67bc[_0x080d('0x2d')]['filter']){_0x29c0e8[_0x080d('0x34')]=_['merge'](_0x29c0e8['where'],{'$or':_[_0x080d('0x28')](_0x35e9c8,function(_0x23a343){if(_0x23a343[_0x080d('0x2b')]!==_0x080d('0x36')){var _0x4ba248={};_0x4ba248[_0x23a343[_0x080d('0x26')]]={'$like':'%'+_0x2e67bc[_0x080d('0x2d')][_0x080d('0x37')]+'%'};return _0x4ba248;}})});}_0x29c0e8=_[_0x080d('0x38')]({},_0x29c0e8,_0x2e67bc[_0x080d('0x39')]);var _0x45b46a={'where':_0x29c0e8['where']};return db[_0x080d('0x3a')][_0x080d('0x1c')](_0x45b46a)[_0x080d('0x23')](function(_0x1ac47b){_0x1384c4['count']=_0x1ac47b;if(_0x2e67bc[_0x080d('0x2d')][_0x080d('0x3b')]){_0x29c0e8[_0x080d('0x3c')]=[{'all':!![]}];}return db['FaxTransferReport'][_0x080d('0x3d')](_0x29c0e8);})[_0x080d('0x23')](function(_0x3610d9){_0x1384c4[_0x080d('0x3e')]=_0x3610d9;return _0x1384c4;})['then'](respondWithFilteredResult(_0x2a06bb,_0x29c0e8))[_0x080d('0x3f')](handleError(_0x2a06bb,null));};exports[_0x080d('0x40')]=function(_0x1d4488,_0x12385a){var _0x4e9503={'raw':!![],'where':{'id':_0x1d4488[_0x080d('0x41')]['id']}},_0x1d7142={};_0x1d7142[_0x080d('0x2c')]=_['keys'](db[_0x080d('0x3a')][_0x080d('0x29')]);_0x1d7142[_0x080d('0x2d')]=_[_0x080d('0x42')](_0x1d4488[_0x080d('0x2d')]);_0x1d7142[_0x080d('0x2e')]=_['intersection'](_0x1d7142[_0x080d('0x2c')],_0x1d7142[_0x080d('0x2d')]);_0x4e9503['attributes']=_[_0x080d('0x2f')](_0x1d7142[_0x080d('0x2c')],qs[_0x080d('0x31')](_0x1d4488[_0x080d('0x2d')][_0x080d('0x31')]));_0x4e9503['attributes']=_0x4e9503['attributes'][_0x080d('0x43')]?_0x4e9503[_0x080d('0x30')]:_0x1d7142['model'];if(_0x1d4488[_0x080d('0x2d')][_0x080d('0x3b')]){_0x4e9503[_0x080d('0x3c')]=[{'all':!![]}];}_0x4e9503=_[_0x080d('0x38')]({},_0x4e9503,_0x1d4488['options']);return db[_0x080d('0x3a')][_0x080d('0x44')](_0x4e9503)[_0x080d('0x23')](handleEntityNotFound(_0x12385a,null))[_0x080d('0x23')](respondWithResult(_0x12385a,null))['catch'](handleError(_0x12385a,null));};exports['create']=function(_0x3ddac3,_0x286548){return db[_0x080d('0x3a')][_0x080d('0x45')](_0x3ddac3[_0x080d('0x46')],{})[_0x080d('0x23')](respondWithResult(_0x286548,0xc9))['catch'](handleError(_0x286548,null));};exports[_0x080d('0x22')]=function(_0x408ff8,_0x2ed42f){if(_0x408ff8[_0x080d('0x46')]['id']){delete _0x408ff8[_0x080d('0x46')]['id'];}return db[_0x080d('0x3a')][_0x080d('0x44')]({'where':{'id':_0x408ff8[_0x080d('0x41')]['id']}})[_0x080d('0x23')](handleEntityNotFound(_0x2ed42f,null))['then'](saveUpdates(_0x408ff8[_0x080d('0x46')],null))[_0x080d('0x23')](respondWithResult(_0x2ed42f,null))[_0x080d('0x3f')](handleError(_0x2ed42f,null));};exports['destroy']=function(_0x38251e,_0x178045){return db[_0x080d('0x3a')][_0x080d('0x44')]({'where':{'id':_0x38251e[_0x080d('0x41')]['id']}})['then'](handleEntityNotFound(_0x178045,null))['then'](removeEntity(_0x178045,null))[_0x080d('0x3f')](handleError(_0x178045,null));};exports['describe']=function(_0x20623c,_0x5cd4ad){return db[_0x080d('0x3a')][_0x080d('0x47')]()[_0x080d('0x23')](respondWithResult(_0x5cd4ad,null))[_0x080d('0x3f')](handleError(_0x5cd4ad,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 77b4f43..bdc4b71 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 _0x16a6=['define','report_fax_transfer','lodash','util','../../config/logger','moment','bluebird','path','../../config/environment','./faxTransferReport.attributes','exports'];(function(_0x593ce4,_0x44a5a2){var _0x111454=function(_0x2b4a2a){while(--_0x2b4a2a){_0x593ce4['push'](_0x593ce4['shift']());}};_0x111454(++_0x44a5a2);}(_0x16a6,0x120));var _0x616a=function(_0x484cac,_0x30ad3a){_0x484cac=_0x484cac-0x0;var _0x1d6e77=_0x16a6[_0x484cac];return _0x1d6e77;};'use strict';var _=require(_0x616a('0x0'));var util=require(_0x616a('0x1'));var logger=require(_0x616a('0x2'))('api');var moment=require(_0x616a('0x3'));var BPromise=require(_0x616a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x616a('0x5'));var rimraf=require('rimraf');var config=require(_0x616a('0x6'));var attributes=require(_0x616a('0x7'));module[_0x616a('0x8')]=function(_0x5d04cb,_0x1f0947){return _0x5d04cb[_0x616a('0x9')]('FaxTransferReport',attributes,{'tableName':_0x616a('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x76ff=['bluebird','request-promise','path','rimraf','lodash','../../config/logger','api','moment'];(function(_0x2fd8ba,_0x31a672){var _0x14cc5d=function(_0x424e40){while(--_0x424e40){_0x2fd8ba['push'](_0x2fd8ba['shift']());}};_0x14cc5d(++_0x31a672);}(_0x76ff,0x10c));var _0xf76f=function(_0x278421,_0x4a6c5a){_0x278421=_0x278421-0x0;var _0x46fbe0=_0x76ff[_0x278421];return _0x46fbe0;};'use strict';var _=require(_0xf76f('0x0'));var util=require('util');var logger=require(_0xf76f('0x1'))(_0xf76f('0x2'));var moment=require(_0xf76f('0x3'));var BPromise=require(_0xf76f('0x4'));var rp=require(_0xf76f('0x5'));var fs=require('fs');var path=require(_0xf76f('0x6'));var rimraf=require(_0xf76f('0x7'));var config=require('../../config/environment');var attributes=require('./faxTransferReport.attributes');module['exports']=function(_0x56f44a,_0x5ba126){return _0x56f44a['define']('FaxTransferReport',attributes,{'tableName':'report_fax_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index 0a9b83b..4b0294b 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 _0x6419=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','catch','lodash','util'];(function(_0x17c18c,_0x37dc0b){var _0xd9acc5=function(_0x3e17aa){while(--_0x3e17aa){_0x17c18c['push'](_0x17c18c['shift']());}};_0xd9acc5(++_0x37dc0b);}(_0x6419,0x82));var _0x9641=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x6419[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x9641('0x0'));var util=require(_0x9641('0x1'));var moment=require(_0x9641('0x2'));var BPromise=require(_0x9641('0x3'));var rs=require(_0x9641('0x4'));var fs=require('fs');var Redis=require(_0x9641('0x5'));var db=require(_0x9641('0x6'))['db'];var utils=require(_0x9641('0x7'));var logger=require(_0x9641('0x8'))(_0x9641('0x9'));var config=require('../../config/environment');var jayson=require(_0x9641('0xa'));var client=jayson[_0x9641('0xb')][_0x9641('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x584c0f,_0x2677ce,_0x4d0031){return new BPromise(function(_0x3ecd1b,_0x5c661b){return client[_0x9641('0xd')](_0x584c0f,_0x4d0031)['then'](function(_0x1647af){logger[_0x9641('0xe')](_0x9641('0xf'),_0x2677ce,_0x9641('0x10'));logger[_0x9641('0x11')]('FaxTransferReport,\x20%s,\x20%s,\x20%s',_0x2677ce,_0x9641('0x10'),JSON['stringify'](_0x1647af));if(_0x1647af[_0x9641('0x12')]){if(_0x1647af[_0x9641('0x12')][_0x9641('0x13')]===0x1f4){logger['error'](_0x9641('0xf'),_0x2677ce,_0x1647af[_0x9641('0x12')][_0x9641('0x14')]);return _0x5c661b(_0x1647af[_0x9641('0x12')][_0x9641('0x14')]);}logger[_0x9641('0x12')](_0x9641('0xf'),_0x2677ce,_0x1647af[_0x9641('0x12')][_0x9641('0x14')]);return _0x3ecd1b(_0x1647af[_0x9641('0x12')][_0x9641('0x14')]);}else{logger[_0x9641('0xe')](_0x9641('0xf'),_0x2677ce,_0x9641('0x10'));_0x3ecd1b(_0x1647af['result'][_0x9641('0x14')]);}})[_0x9641('0x15')](function(_0x4e62be){logger[_0x9641('0x12')](_0x9641('0xf'),_0x2677ce,_0x4e62be);_0x5c661b(_0x4e62be);});});} \ No newline at end of file +var _0x8c2a=['code','message','info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x21308a,_0x16b4a4){var _0x390f9a=function(_0x1a58ba){while(--_0x1a58ba){_0x21308a['push'](_0x21308a['shift']());}};_0x390f9a(++_0x16b4a4);}(_0x8c2a,0xbd));var _0xa8c2=function(_0x27ebe8,_0x21dd01){_0x27ebe8=_0x27ebe8-0x0;var _0x431778=_0x8c2a[_0x27ebe8];return _0x431778;};'use strict';var _=require(_0xa8c2('0x0'));var util=require(_0xa8c2('0x1'));var moment=require('moment');var BPromise=require(_0xa8c2('0x2'));var rs=require(_0xa8c2('0x3'));var fs=require('fs');var Redis=require(_0xa8c2('0x4'));var db=require(_0xa8c2('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa8c2('0x6'))(_0xa8c2('0x7'));var config=require(_0xa8c2('0x8'));var jayson=require(_0xa8c2('0x9'));var client=jayson[_0xa8c2('0xa')][_0xa8c2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xc2ded,_0x581524,_0x404570){return new BPromise(function(_0x5abcb3,_0xf7550d){return client['request'](_0xc2ded,_0x404570)['then'](function(_0x51f312){logger['info'](_0xa8c2('0xc'),_0x581524,_0xa8c2('0xd'));logger[_0xa8c2('0xe')](_0xa8c2('0xf'),_0x581524,_0xa8c2('0xd'),JSON[_0xa8c2('0x10')](_0x51f312));if(_0x51f312[_0xa8c2('0x11')]){if(_0x51f312[_0xa8c2('0x11')][_0xa8c2('0x12')]===0x1f4){logger[_0xa8c2('0x11')](_0xa8c2('0xc'),_0x581524,_0x51f312[_0xa8c2('0x11')][_0xa8c2('0x13')]);return _0xf7550d(_0x51f312[_0xa8c2('0x11')][_0xa8c2('0x13')]);}logger['error'](_0xa8c2('0xc'),_0x581524,_0x51f312['error']['message']);return _0x5abcb3(_0x51f312['error'][_0xa8c2('0x13')]);}else{logger[_0xa8c2('0x14')]('FaxTransferReport,\x20%s,\x20%s',_0x581524,'request\x20sent');_0x5abcb3(_0x51f312[_0xa8c2('0x15')][_0xa8c2('0x13')]);}})[_0xa8c2('0x16')](function(_0x45a464){logger[_0xa8c2('0x11')]('FaxTransferReport,\x20%s,\x20%s',_0x581524,_0x45a464);_0xf7550d(_0x45a464);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 02a9737..36f56f9 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 _0x4a1a=['destroy','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','get','isAuthenticated','index','describe','/:id','show','post','create','put'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x4a1a,0x11f));var _0xa4a1=function(_0x41f28b,_0x4f9279){_0x41f28b=_0x41f28b-0x0;var _0x4e60af=_0x4a1a[_0x41f28b];return _0x4e60af;};'use strict';var multer=require('multer');var util=require(_0xa4a1('0x0'));var path=require(_0xa4a1('0x1'));var timeout=require(_0xa4a1('0x2'));var express=require('express');var router=express[_0xa4a1('0x3')]();var auth=require(_0xa4a1('0x4'));var interaction=require(_0xa4a1('0x5'));var config=require(_0xa4a1('0x6'));var controller=require(_0xa4a1('0x7'));router[_0xa4a1('0x8')]('/',auth[_0xa4a1('0x9')](),controller[_0xa4a1('0xa')]);router['get']('/describe',auth[_0xa4a1('0x9')](),controller[_0xa4a1('0xb')]);router[_0xa4a1('0x8')](_0xa4a1('0xc'),auth['isAuthenticated'](),controller[_0xa4a1('0xd')]);router[_0xa4a1('0xe')]('/',auth[_0xa4a1('0x9')](),controller[_0xa4a1('0xf')]);router[_0xa4a1('0x10')](_0xa4a1('0xc'),auth[_0xa4a1('0x9')](),controller['update']);router['delete'](_0xa4a1('0xc'),auth[_0xa4a1('0x9')](),controller[_0xa4a1('0x11')]);module[_0xa4a1('0x12')]=router; \ No newline at end of file +var _0x5a16=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','/describe','describe','get','post','create','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x41f17b,_0x34103c){var _0x117e87=function(_0x4e1e53){while(--_0x4e1e53){_0x41f17b['push'](_0x41f17b['shift']());}};_0x117e87(++_0x34103c);}(_0x5a16,0x177));var _0x65a1=function(_0x454e6d,_0x1e1f38){_0x454e6d=_0x454e6d-0x0;var _0x4bc294=_0x5a16[_0x454e6d];return _0x4bc294;};'use strict';var multer=require(_0x65a1('0x0'));var util=require(_0x65a1('0x1'));var path=require(_0x65a1('0x2'));var timeout=require(_0x65a1('0x3'));var express=require(_0x65a1('0x4'));var router=express[_0x65a1('0x5')]();var auth=require(_0x65a1('0x6'));var interaction=require(_0x65a1('0x7'));var config=require(_0x65a1('0x8'));var controller=require('./faxTransferReport.controller');router['get']('/',auth[_0x65a1('0x9')](),controller['index']);router['get'](_0x65a1('0xa'),auth[_0x65a1('0x9')](),controller[_0x65a1('0xb')]);router[_0x65a1('0xc')]('/:id',auth[_0x65a1('0x9')](),controller['show']);router[_0x65a1('0xd')]('/',auth[_0x65a1('0x9')](),controller[_0x65a1('0xe')]);router[_0x65a1('0xf')](_0x65a1('0x10'),auth[_0x65a1('0x9')](),controller[_0x65a1('0x11')]);router['delete'](_0x65a1('0x10'),auth[_0x65a1('0x9')](),controller[_0x65a1('0x12')]);module[_0x65a1('0x13')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 448e6f4..05b5ffb 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 _0xa1f6=['index','get','/:id','show','getConfigurations','/:id/fields','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','isAuthenticated'];(function(_0x51b031,_0x217229){var _0x222c01=function(_0x3eb751){while(--_0x3eb751){_0x51b031['push'](_0x51b031['shift']());}};_0x222c01(++_0x217229);}(_0xa1f6,0x19d));var _0x6a1f=function(_0x33554b,_0x48162b){_0x33554b=_0x33554b-0x0;var _0x256954=_0xa1f6[_0x33554b];return _0x256954;};'use strict';var multer=require(_0x6a1f('0x0'));var util=require(_0x6a1f('0x1'));var path=require(_0x6a1f('0x2'));var timeout=require(_0x6a1f('0x3'));var express=require(_0x6a1f('0x4'));var router=express[_0x6a1f('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intDeskAccount.controller');router['get']('/',auth[_0x6a1f('0x6')](),controller[_0x6a1f('0x7')]);router[_0x6a1f('0x8')](_0x6a1f('0x9'),auth[_0x6a1f('0x6')](),controller[_0x6a1f('0xa')]);router[_0x6a1f('0x8')]('/:id/configurations',auth[_0x6a1f('0x6')](),controller[_0x6a1f('0xb')]);router[_0x6a1f('0x8')](_0x6a1f('0xc'),auth[_0x6a1f('0x6')](),controller['getFields']);router[_0x6a1f('0xd')]('/',auth[_0x6a1f('0x6')](),controller[_0x6a1f('0xe')]);router[_0x6a1f('0xd')]('/:id/configurations',auth[_0x6a1f('0x6')](),controller['addConfiguration']);router[_0x6a1f('0xf')](_0x6a1f('0x9'),auth[_0x6a1f('0x6')](),controller[_0x6a1f('0x10')]);router[_0x6a1f('0x11')](_0x6a1f('0x9'),auth[_0x6a1f('0x6')](),controller[_0x6a1f('0x12')]);module[_0x6a1f('0x13')]=router; \ No newline at end of file +var _0x2eb2=['../../components/auth/service','../../config/environment','isAuthenticated','index','get','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','create','update','delete','destroy','util','path','connect-timeout','express','Router'];(function(_0x4fe7bb,_0x1bdd1c){var _0x5659cc=function(_0x425c86){while(--_0x425c86){_0x4fe7bb['push'](_0x4fe7bb['shift']());}};_0x5659cc(++_0x1bdd1c);}(_0x2eb2,0x19f));var _0x22eb=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0x2eb2[_0x5447fd];return _0x15b28a;};'use strict';var multer=require('multer');var util=require(_0x22eb('0x0'));var path=require(_0x22eb('0x1'));var timeout=require(_0x22eb('0x2'));var express=require(_0x22eb('0x3'));var router=express[_0x22eb('0x4')]();var auth=require(_0x22eb('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x22eb('0x6'));var controller=require('./intDeskAccount.controller');router['get']('/',auth[_0x22eb('0x7')](),controller[_0x22eb('0x8')]);router[_0x22eb('0x9')](_0x22eb('0xa'),auth[_0x22eb('0x7')](),controller[_0x22eb('0xb')]);router[_0x22eb('0x9')](_0x22eb('0xc'),auth[_0x22eb('0x7')](),controller[_0x22eb('0xd')]);router[_0x22eb('0x9')](_0x22eb('0xe'),auth['isAuthenticated'](),controller[_0x22eb('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0x22eb('0x10')]);router['post'](_0x22eb('0xc'),auth[_0x22eb('0x7')](),controller['addConfiguration']);router['put'](_0x22eb('0xa'),auth[_0x22eb('0x7')](),controller[_0x22eb('0x11')]);router[_0x22eb('0x12')](_0x22eb('0xa'),auth['isAuthenticated'](),controller[_0x22eb('0x13')]);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 dd8793c..979ec78 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 _0x30aa=['exports','STRING','ENUM','basic','integrationTab','sequelize'];(function(_0x70d01a,_0xaa3e0c){var _0x499ab2=function(_0x124a69){while(--_0x124a69){_0x70d01a['push'](_0x70d01a['shift']());}};_0x499ab2(++_0xaa3e0c);}(_0x30aa,0x161));var _0xa30a=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0x30aa[_0x134c2e];return _0x2825db;};'use strict';var Sequelize=require(_0xa30a('0x0'));module[_0xa30a('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xa30a('0x2')]},'remoteUri':{'type':Sequelize[_0xa30a('0x2')]},'authType':{'type':Sequelize[_0xa30a('0x3')](_0xa30a('0x4')),'defaultValue':_0xa30a('0x4')},'password':{'type':Sequelize[_0xa30a('0x2')]},'consumerKey':{'type':Sequelize['STRING']},'consumerSecret':{'type':Sequelize[_0xa30a('0x2')]},'token':{'type':Sequelize['STRING']},'tokenSecret':{'type':Sequelize[_0xa30a('0x2')]},'serverUrl':{'type':Sequelize[_0xa30a('0x2')]},'type':{'type':Sequelize[_0xa30a('0x3')](_0xa30a('0x5'),'newTab'),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0xcb20=['ENUM','basic','newTab','integrationTab','sequelize','exports','STRING'];(function(_0x1e7b16,_0x4607a1){var _0x37fadc=function(_0x1fc9ce){while(--_0x1fc9ce){_0x1e7b16['push'](_0x1e7b16['shift']());}};_0x37fadc(++_0x4607a1);}(_0xcb20,0xe4));var _0x0cb2=function(_0x179f64,_0x1c85fb){_0x179f64=_0x179f64-0x0;var _0x47e677=_0xcb20[_0x179f64];return _0x47e677;};'use strict';var Sequelize=require(_0x0cb2('0x0'));module[_0x0cb2('0x1')]={'name':{'type':Sequelize[_0x0cb2('0x2')]},'description':{'type':Sequelize[_0x0cb2('0x2')]},'username':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING']},'authType':{'type':Sequelize[_0x0cb2('0x3')]('basic'),'defaultValue':_0x0cb2('0x4')},'password':{'type':Sequelize[_0x0cb2('0x2')]},'consumerKey':{'type':Sequelize[_0x0cb2('0x2')]},'consumerSecret':{'type':Sequelize[_0x0cb2('0x2')]},'token':{'type':Sequelize[_0x0cb2('0x2')]},'tokenSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x0cb2('0x2')]},'type':{'type':Sequelize[_0x0cb2('0x3')]('integrationTab',_0x0cb2('0x5')),'defaultValue':_0x0cb2('0x6')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index 817959e..cde3cda 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 _0x5770=['path','sox','to-csv','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','test','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end','json','count','offset','limit','set','reject','save','update','destroy','stack','name','index','map','DeskAccount','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','find','create','body','params','getConfigurations','findOne','DeskConfiguration','addConfiguration','Subjects','getSubjects','channel','DeskField','priority','authType','username','password','consumerSecret','remoteUri','slice','lastIndexOf','GET','format','%s/custom_fields','application/json','headers','Authorization','%s:%s','toString','base64','concat','_embedded','entries','label','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','send','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird'];(function(_0x45c574,_0x497848){var _0x2fa16a=function(_0x1e903a){while(--_0x1e903a){_0x45c574['push'](_0x45c574['shift']());}};_0x2fa16a(++_0x497848);}(_0x5770,0x15f));var _0x0577=function(_0xdd2348,_0x5d3232){_0xdd2348=_0xdd2348-0x0;var _0x2e0a02=_0x5770[_0xdd2348];return _0x2e0a02;};'use strict';var pdf=require(_0x0577('0x0'));var emlformat=require(_0x0577('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x0577('0x2'));var rp=require(_0x0577('0x3'));var moment=require(_0x0577('0x4'));var BPromise=require(_0x0577('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x0577('0x6'));var sox=require(_0x0577('0x7'));var csv=require(_0x0577('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x0577('0x9'));var jsforce=require(_0x0577('0xa'));var deskjs=require(_0x0577('0xb'));var toCsv=require(_0x0577('0x8'));var querystring=require(_0x0577('0xc'));var Papa=require(_0x0577('0xd'));var Redis=require(_0x0577('0xe'));var authService=require(_0x0577('0xf'));var qs=require(_0x0577('0x10'));var as=require(_0x0577('0x11'));var hardwareService=require(_0x0577('0x12'));var logger=require(_0x0577('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x0577('0x14'))['db'];var integrations=require(_0x0577('0x15'));var jayson=require(_0x0577('0x16'));var client=jayson[_0x0577('0x17')][_0x0577('0x18')]({'port':0x232a});function checkPasswordPattern(_0x57477d,_0x3325f8,_0x262050){if(_0x262050){var _0x555ec1=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x555ec1[_0x0577('0x19')](_0x3325f8)){return _0x57477d;}else{throw new db['Sequelize']['ValidationError'](_0x0577('0x1a'));}}else{return _0x57477d;}}function respondWithRpcPromise(_0x58aec5,_0x2f7ce0,_0x4ee28e,_0x2aee08){return new BPromise(function(_0x40bdfd,_0x2cc500){var _0x283eca=_0x2aee08||client;return _0x283eca[_0x0577('0x1b')](_0x58aec5,_0x4ee28e)[_0x0577('0x1c')](function(_0x184e56){logger[_0x0577('0x1d')](_0x0577('0x1e'),_0x2f7ce0,_0x0577('0x1f'));logger[_0x0577('0x20')](_0x0577('0x21'),_0x2f7ce0,_0x0577('0x1f'),JSON[_0x0577('0x22')](_0x184e56));if(_0x184e56['error']){if(_0x184e56[_0x0577('0x23')][_0x0577('0x24')]===0x1f4){logger['error']('DeskAccount,\x20%s,\x20%s',_0x2f7ce0,_0x184e56[_0x0577('0x23')]['message']);return _0x2cc500(_0x184e56[_0x0577('0x23')][_0x0577('0x25')]);}logger[_0x0577('0x23')](_0x0577('0x1e'),_0x2f7ce0,_0x184e56[_0x0577('0x23')][_0x0577('0x25')]);return _0x40bdfd(_0x184e56[_0x0577('0x23')]['message']);}else{logger[_0x0577('0x1d')]('DeskAccount,\x20%s,\x20%s',_0x2f7ce0,_0x0577('0x1f'));_0x40bdfd(_0x184e56[_0x0577('0x26')][_0x0577('0x25')]);}})['catch'](function(_0x41eb3b){logger[_0x0577('0x23')](_0x0577('0x1e'),_0x2f7ce0,_0x41eb3b);_0x2cc500(_0x41eb3b);});});}function respondWithStatusCode(_0x22cc44,_0x2755cf){_0x2755cf=_0x2755cf||0xcc;return function(_0x461dc2){if(_0x461dc2){return _0x22cc44[_0x0577('0x27')](_0x2755cf);}return _0x22cc44[_0x0577('0x28')](_0x2755cf)[_0x0577('0x29')]();};}function respondWithResult(_0x30db82,_0x17f813){_0x17f813=_0x17f813||0xc8;return function(_0x35beec){if(_0x35beec){return _0x30db82['status'](_0x17f813)[_0x0577('0x2a')](_0x35beec);}};}function respondWithFilteredResult(_0xc8b5f1,_0x4c1c4e){return function(_0x5c4f4c){if(_0x5c4f4c){var _0x206eb7=_0x5c4f4c[_0x0577('0x2b')],_0x2f2e51=_0x4c1c4e[_0x0577('0x2c')],_0xa049ed=_0x4c1c4e[_0x0577('0x2c')]+_0x4c1c4e[_0x0577('0x2d')],_0x3d816c;if(_0xa049ed>=_0x206eb7){_0xa049ed=_0x206eb7;_0x3d816c=0xc8;}else{_0x3d816c=0xce;}_0xc8b5f1[_0x0577('0x28')](_0x3d816c);return _0xc8b5f1[_0x0577('0x2e')]('Content-Range',_0x2f2e51+'-'+_0xa049ed+'/'+_0x206eb7)[_0x0577('0x2a')](_0x5c4f4c);}return null;};}function patchUpdates(_0x22922d){return function(_0x1d4334){try{jsonpatch['apply'](_0x1d4334,_0x22922d,!![]);}catch(_0x58abfc){return BPromise[_0x0577('0x2f')](_0x58abfc);}return _0x1d4334[_0x0577('0x30')]();};}function saveUpdates(_0x18682c,_0x5bbf9e){return function(_0x58b8d9){if(_0x58b8d9){return _0x58b8d9[_0x0577('0x31')](_0x18682c)[_0x0577('0x1c')](function(_0x1d5e91){return _0x1d5e91;});}return null;};}function removeEntity(_0x4890b0,_0x4bd657){return function(_0x5cbd8a){if(_0x5cbd8a){return _0x5cbd8a[_0x0577('0x32')]()['then'](function(){_0x4890b0['status'](0xcc)[_0x0577('0x29')]();});}};}function handleEntityNotFound(_0x1c6970,_0x418f7e){return function(_0x4c227b){if(!_0x4c227b){_0x1c6970[_0x0577('0x27')](0x194);}return _0x4c227b;};}function handleError(_0x50e1c6,_0x347037){_0x347037=_0x347037||0x1f4;return function(_0x3bc554){logger[_0x0577('0x23')](_0x3bc554[_0x0577('0x33')]);if(_0x3bc554['name']){delete _0x3bc554[_0x0577('0x34')];}_0x50e1c6[_0x0577('0x28')](_0x347037)['send'](_0x3bc554);};}exports[_0x0577('0x35')]=function(_0x9e5229,_0x1bd16b){var _0x29a2ce={},_0x3c1e3e={},_0x310a1f={'count':0x0,'rows':[]};var _0x9d7f12=_[_0x0577('0x36')](db[_0x0577('0x37')][_0x0577('0x38')],function(_0x2e07e6){return{'name':_0x2e07e6[_0x0577('0x39')],'type':_0x2e07e6[_0x0577('0x3a')]['key']};});_0x3c1e3e[_0x0577('0x3b')]=_[_0x0577('0x36')](_0x9d7f12,_0x0577('0x34'));_0x3c1e3e[_0x0577('0x3c')]=_[_0x0577('0x3d')](_0x9e5229[_0x0577('0x3c')]);_0x3c1e3e[_0x0577('0x3e')]=_[_0x0577('0x3f')](_0x3c1e3e[_0x0577('0x3b')],_0x3c1e3e[_0x0577('0x3c')]);_0x29a2ce[_0x0577('0x40')]=_[_0x0577('0x3f')](_0x3c1e3e[_0x0577('0x3b')],qs[_0x0577('0x41')](_0x9e5229[_0x0577('0x3c')][_0x0577('0x41')]));_0x29a2ce[_0x0577('0x40')]=_0x29a2ce[_0x0577('0x40')][_0x0577('0x42')]?_0x29a2ce[_0x0577('0x40')]:_0x3c1e3e['model'];if(!_0x9e5229['query'][_0x0577('0x43')](_0x0577('0x44'))){_0x29a2ce[_0x0577('0x2d')]=qs[_0x0577('0x2d')](_0x9e5229[_0x0577('0x3c')][_0x0577('0x2d')]);_0x29a2ce[_0x0577('0x2c')]=qs[_0x0577('0x2c')](_0x9e5229[_0x0577('0x3c')][_0x0577('0x2c')]);}_0x29a2ce[_0x0577('0x45')]=qs['sort'](_0x9e5229[_0x0577('0x3c')][_0x0577('0x46')]);_0x29a2ce[_0x0577('0x47')]=qs[_0x0577('0x3e')](_[_0x0577('0x48')](_0x9e5229['query'],_0x3c1e3e['filters']));if(_0x9e5229[_0x0577('0x3c')][_0x0577('0x49')]){_0x29a2ce[_0x0577('0x47')]=_[_0x0577('0x4a')](_0x29a2ce[_0x0577('0x47')],{'$or':_[_0x0577('0x36')](_0x9d7f12,function(_0x1f2c78){if(_0x1f2c78[_0x0577('0x3a')]!==_0x0577('0x4b')){var _0x3e7359={};_0x3e7359[_0x1f2c78[_0x0577('0x34')]]={'$like':'%'+_0x9e5229[_0x0577('0x3c')][_0x0577('0x49')]+'%'};return _0x3e7359;}})});}_0x29a2ce=_['merge']({},_0x29a2ce,_0x9e5229[_0x0577('0x4c')]);var _0x54fd02={'where':_0x29a2ce['where']};return db[_0x0577('0x37')]['count'](_0x54fd02)[_0x0577('0x1c')](function(_0x40d9d7){_0x310a1f[_0x0577('0x2b')]=_0x40d9d7;if(_0x9e5229[_0x0577('0x3c')][_0x0577('0x4d')]){_0x29a2ce[_0x0577('0x4e')]=[{'all':!![]}];}return db[_0x0577('0x37')][_0x0577('0x4f')](_0x29a2ce);})[_0x0577('0x1c')](function(_0x540bb0){_0x310a1f['rows']=_0x540bb0;return _0x310a1f;})[_0x0577('0x1c')](respondWithFilteredResult(_0x1bd16b,_0x29a2ce))[_0x0577('0x50')](handleError(_0x1bd16b,null));};exports[_0x0577('0x51')]=function(_0x1fdd9e,_0x2b1ea5){var _0x564ed4={'raw':![],'where':{'id':_0x1fdd9e['params']['id']}},_0x1c0d30={};_0x1c0d30[_0x0577('0x3b')]=_['keys'](db[_0x0577('0x37')][_0x0577('0x38')]);_0x1c0d30[_0x0577('0x3c')]=_['keys'](_0x1fdd9e[_0x0577('0x3c')]);_0x1c0d30[_0x0577('0x3e')]=_[_0x0577('0x3f')](_0x1c0d30['model'],_0x1c0d30[_0x0577('0x3c')]);_0x564ed4[_0x0577('0x40')]=_[_0x0577('0x3f')](_0x1c0d30[_0x0577('0x3b')],qs['fields'](_0x1fdd9e[_0x0577('0x3c')][_0x0577('0x41')]));_0x564ed4[_0x0577('0x40')]=_0x564ed4['attributes'][_0x0577('0x42')]?_0x564ed4[_0x0577('0x40')]:_0x1c0d30[_0x0577('0x3b')];if(_0x1fdd9e[_0x0577('0x3c')][_0x0577('0x4d')]){_0x564ed4['include']=[{'all':!![]}];}_0x564ed4=_[_0x0577('0x4a')]({},_0x564ed4,_0x1fdd9e[_0x0577('0x4c')]);return db[_0x0577('0x37')][_0x0577('0x52')](_0x564ed4)[_0x0577('0x1c')](handleEntityNotFound(_0x2b1ea5,null))['then'](respondWithResult(_0x2b1ea5,null))['catch'](handleError(_0x2b1ea5,null));};exports[_0x0577('0x53')]=function(_0x1f7306,_0x498839){return db[_0x0577('0x37')][_0x0577('0x53')](_0x1f7306[_0x0577('0x54')],{})[_0x0577('0x1c')](respondWithResult(_0x498839,0xc9))[_0x0577('0x50')](handleError(_0x498839,null));};exports[_0x0577('0x31')]=function(_0x38d714,_0x30edfb){if(_0x38d714['body']['id']){delete _0x38d714['body']['id'];}return db[_0x0577('0x37')][_0x0577('0x52')]({'where':{'id':_0x38d714['params']['id']}})['then'](handleEntityNotFound(_0x30edfb,null))[_0x0577('0x1c')](saveUpdates(_0x38d714[_0x0577('0x54')],null))['then'](respondWithResult(_0x30edfb,null))[_0x0577('0x50')](handleError(_0x30edfb,null));};exports[_0x0577('0x32')]=function(_0x241bfe,_0x1510cb){return db[_0x0577('0x37')][_0x0577('0x52')]({'where':{'id':_0x241bfe[_0x0577('0x55')]['id']}})['then'](handleEntityNotFound(_0x1510cb,null))[_0x0577('0x1c')](removeEntity(_0x1510cb,null))[_0x0577('0x50')](handleError(_0x1510cb,null));};exports[_0x0577('0x56')]=function(_0x29c9aa,_0x1d3c0a,_0x5d62d8){var _0x550f0b={};var _0x47f314={};var _0x43bf36;var _0x2855e1;return db[_0x0577('0x37')][_0x0577('0x57')]({'where':{'id':_0x29c9aa['params']['id']}})[_0x0577('0x1c')](handleEntityNotFound(_0x1d3c0a,null))[_0x0577('0x1c')](function(_0x3b84ac){if(_0x3b84ac){_0x43bf36=_0x3b84ac;_0x47f314['model']=_[_0x0577('0x3d')](db[_0x0577('0x58')][_0x0577('0x38')]);_0x47f314[_0x0577('0x3c')]=_[_0x0577('0x3d')](_0x29c9aa['query']);_0x47f314['filters']=_['intersection'](_0x47f314[_0x0577('0x3b')],_0x47f314[_0x0577('0x3c')]);_0x550f0b[_0x0577('0x40')]=_[_0x0577('0x3f')](_0x47f314[_0x0577('0x3b')],qs[_0x0577('0x41')](_0x29c9aa['query']['fields']));_0x550f0b[_0x0577('0x40')]=_0x550f0b[_0x0577('0x40')][_0x0577('0x42')]?_0x550f0b[_0x0577('0x40')]:_0x47f314[_0x0577('0x3b')];_0x550f0b[_0x0577('0x45')]=qs[_0x0577('0x46')](_0x29c9aa[_0x0577('0x3c')][_0x0577('0x46')]);_0x550f0b['where']=qs[_0x0577('0x3e')](_[_0x0577('0x48')](_0x29c9aa['query'],_0x47f314[_0x0577('0x3e')]));if(_0x29c9aa[_0x0577('0x3c')]['filter']){_0x550f0b['where']=_['merge'](_0x550f0b['where'],{'$or':_[_0x0577('0x36')](_0x550f0b[_0x0577('0x40')],function(_0x18e7e8){var _0x1abcd7={};_0x1abcd7[_0x18e7e8]={'$like':'%'+_0x29c9aa[_0x0577('0x3c')][_0x0577('0x49')]+'%'};return _0x1abcd7;})});}_0x550f0b=_['merge']({},_0x550f0b,_0x29c9aa['options']);return _0x43bf36[_0x0577('0x56')](_0x550f0b);}})[_0x0577('0x1c')](function(_0x1ca38e){if(_0x1ca38e){_0x2855e1=_0x1ca38e[_0x0577('0x42')];if(!_0x29c9aa[_0x0577('0x3c')][_0x0577('0x43')](_0x0577('0x44'))){_0x550f0b[_0x0577('0x2d')]=qs[_0x0577('0x2d')](_0x29c9aa[_0x0577('0x3c')][_0x0577('0x2d')]);_0x550f0b[_0x0577('0x2c')]=qs[_0x0577('0x2c')](_0x29c9aa[_0x0577('0x3c')]['offset']);}return _0x43bf36['getConfigurations'](_0x550f0b);}})[_0x0577('0x1c')](function(_0x2a11d5){if(_0x2a11d5){return _0x2a11d5?{'count':_0x2855e1,'rows':_0x2a11d5}:null;}})[_0x0577('0x1c')](respondWithResult(_0x1d3c0a,null))[_0x0577('0x50')](handleError(_0x1d3c0a,null));};exports[_0x0577('0x59')]=function(_0x5dfb1e,_0x15ea39,_0x1bde4a){if(_0x5dfb1e[_0x0577('0x54')]['id']){delete _0x5dfb1e[_0x0577('0x54')]['id'];}return db['DeskAccount'][_0x0577('0x57')]({'where':{'id':_0x5dfb1e[_0x0577('0x55')]['id']}})[_0x0577('0x1c')](handleEntityNotFound(_0x15ea39,null))[_0x0577('0x1c')](function(_0x24fc46){if(_0x24fc46){_0x5dfb1e[_0x0577('0x54')]['AccountId']=_0x24fc46['id'];_0x5dfb1e[_0x0577('0x54')][_0x0577('0x5a')]=integrations[_0x0577('0x5b')](_0x5dfb1e['body'][_0x0577('0x5c')],_0x5dfb1e[_0x0577('0x54')][_0x0577('0x3a')]);_0x5dfb1e[_0x0577('0x54')]['Descriptions']=integrations['getDescriptions'](_0x5dfb1e['body'][_0x0577('0x5c')],_0x5dfb1e[_0x0577('0x54')]['type']);return db[_0x0577('0x58')][_0x0577('0x53')](_0x5dfb1e[_0x0577('0x54')],{'include':[{'model':db[_0x0577('0x5d')],'as':_0x0577('0x5a')},{'model':db[_0x0577('0x5d')],'as':'Descriptions'}]});}return null;})[_0x0577('0x1c')](respondWithResult(_0x15ea39,null))[_0x0577('0x50')](handleError(_0x15ea39,null));};exports['getFields']=function(_0x27035e,_0x4a9325,_0x212481){var _0xbba027=[{'name':_0x0577('0x5e'),'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 _0x58eda5='';return db[_0x0577('0x37')][_0x0577('0x57')]({'where':{'id':_0x27035e[_0x0577('0x55')]['id']},'attributes':['id','remoteUri',_0x0577('0x5f'),_0x0577('0x60'),_0x0577('0x61'),'consumerKey',_0x0577('0x62'),'token','tokenSecret']})[_0x0577('0x1c')](handleEntityNotFound(_0x4a9325,null))['then'](function(_0x462eed){if(_0x462eed){_0x58eda5=_0x462eed[_0x0577('0x63')];var _0x1a210e=_0x58eda5[_0x0577('0x64')](-0x1);if(_0x1a210e==='/'){_0x58eda5=_0x58eda5['substring'](0x0,_0x58eda5[_0x0577('0x65')](_0x1a210e));}var _0x4d6001={'method':_0x0577('0x66'),'uri':util[_0x0577('0x67')](_0x0577('0x68'),_0x58eda5),'headers':{'Content-Type':_0x0577('0x69'),'Accept':_0x0577('0x69')},'json':!![]};if(_0x462eed[_0x0577('0x5f')]==='basic'){_0x4d6001[_0x0577('0x6a')][_0x0577('0x6b')]=util[_0x0577('0x67')]('Basic\x20%s',new Buffer(util[_0x0577('0x67')](_0x0577('0x6c'),_0x462eed[_0x0577('0x60')],_0x462eed[_0x0577('0x61')]))[_0x0577('0x6d')](_0x0577('0x6e')));}return rp(_0x4d6001)[_0x0577('0x1c')](function(_0x261bad){return _0xbba027[_0x0577('0x6f')](_['map'](_0x261bad[_0x0577('0x70')][_0x0577('0x71')],function(_0x4df4a6){return{'id':_0x4df4a6[_0x0577('0x34')],'name':_0x4df4a6[_0x0577('0x34')],'type':_0x4df4a6['type'],'active':_0x4df4a6['active'],'label':_0x4df4a6[_0x0577('0x72')],'custom':!![]};}));});}})[_0x0577('0x1c')](function(_0xc238d3){return{'count':_0xc238d3[_0x0577('0x42')],'rows':_0xc238d3};})[_0x0577('0x1c')](respondWithResult(_0x4a9325,null))[_0x0577('0x50')](function(_0x14bcb3){var _0x2a467b=_0x27035e[_0x0577('0x3c')][_0x0577('0x19')]?0x1f4:_0x14bcb3[_0x0577('0x73')]||0x1f4;logger[_0x0577('0x23')](_0x0577('0x74'),_0x0577('0x75'),_0x2a467b,JSON[_0x0577('0x22')](_0x14bcb3));delete _0x14bcb3[_0x0577('0x34')];if(_0x2a467b===0x191){_0x2a467b=0x190;}_0x4a9325[_0x0577('0x28')](_0x2a467b)[_0x0577('0x76')](_0x27035e[_0x0577('0x3c')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x14bcb3[_0x0577('0x73')]}:_0x14bcb3);});}; \ No newline at end of file +var _0xd939=['query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','filter','merge','options','DeskAccount','include','rows','show','params','find','create','body','getConfigurations','findOne','DeskConfiguration','addConfiguration','AccountId','Subjects','getSubjects','channel','DeskField','Descriptions','priority','remoteUri','authType','username','password','consumerKey','consumerSecret','token','tokenSecret','slice','substring','lastIndexOf','application/json','basic','headers','Authorization','Basic\x20%s','format','%s:%s','toString','base64','concat','_embedded','entries','active','getFields,\x20%s,\x20%s,\x20%s','statusCode','html-pdf','eml-format','zip-dir','fast-json-patch','mustache','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','DeskAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','name','send','index','map','rawAttributes','fieldName','type','key','model'];(function(_0x5556bf,_0x226c13){var _0x2c8a6d=function(_0xbe624e){while(--_0xbe624e){_0x5556bf['push'](_0x5556bf['shift']());}};_0x2c8a6d(++_0x226c13);}(_0xd939,0x1b4));var _0x9d93=function(_0xb6e2ea,_0x3b26e9){_0xb6e2ea=_0xb6e2ea-0x0;var _0x2a57bb=_0xd939[_0xb6e2ea];return _0x2a57bb;};'use strict';var pdf=require(_0x9d93('0x0'));var emlformat=require(_0x9d93('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x9d93('0x2'));var jsonpatch=require(_0x9d93('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x9d93('0x4'));var util=require('util');var path=require(_0x9d93('0x5'));var sox=require('sox');var csv=require(_0x9d93('0x6'));var ejs=require(_0x9d93('0x7'));var fs=require('fs');var _=require(_0x9d93('0x8'));var squel=require(_0x9d93('0x9'));var crypto=require(_0x9d93('0xa'));var jsforce=require(_0x9d93('0xb'));var deskjs=require(_0x9d93('0xc'));var toCsv=require(_0x9d93('0x6'));var querystring=require('querystring');var Papa=require(_0x9d93('0xd'));var Redis=require(_0x9d93('0xe'));var authService=require(_0x9d93('0xf'));var qs=require(_0x9d93('0x10'));var as=require(_0x9d93('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9d93('0x12'))(_0x9d93('0x13'));var utils=require('../../config/utils');var config=require(_0x9d93('0x14'));var db=require(_0x9d93('0x15'))['db'];var integrations=require(_0x9d93('0x16'));var jayson=require(_0x9d93('0x17'));var client=jayson['client'][_0x9d93('0x18')]({'port':0x232a});function checkPasswordPattern(_0x2f81bd,_0x31e361,_0x17eec1){if(_0x17eec1){var _0x1b16f3=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1b16f3[_0x9d93('0x19')](_0x31e361)){return _0x2f81bd;}else{throw new db[(_0x9d93('0x1a'))][(_0x9d93('0x1b'))](_0x9d93('0x1c'));}}else{return _0x2f81bd;}}function respondWithRpcPromise(_0x5d974a,_0x1102b7,_0x2a6335,_0x4b37f0){return new BPromise(function(_0x4e4062,_0x53c629){var _0x349bea=_0x4b37f0||client;return _0x349bea[_0x9d93('0x1d')](_0x5d974a,_0x2a6335)[_0x9d93('0x1e')](function(_0x28cc75){logger['info'](_0x9d93('0x1f'),_0x1102b7,'request\x20sent');logger[_0x9d93('0x20')]('DeskAccount,\x20%s,\x20%s,\x20%s',_0x1102b7,_0x9d93('0x21'),JSON[_0x9d93('0x22')](_0x28cc75));if(_0x28cc75[_0x9d93('0x23')]){if(_0x28cc75[_0x9d93('0x23')][_0x9d93('0x24')]===0x1f4){logger[_0x9d93('0x23')](_0x9d93('0x1f'),_0x1102b7,_0x28cc75[_0x9d93('0x23')][_0x9d93('0x25')]);return _0x53c629(_0x28cc75[_0x9d93('0x23')][_0x9d93('0x25')]);}logger['error']('DeskAccount,\x20%s,\x20%s',_0x1102b7,_0x28cc75[_0x9d93('0x23')]['message']);return _0x4e4062(_0x28cc75[_0x9d93('0x23')]['message']);}else{logger[_0x9d93('0x26')](_0x9d93('0x1f'),_0x1102b7,'request\x20sent');_0x4e4062(_0x28cc75[_0x9d93('0x27')][_0x9d93('0x25')]);}})[_0x9d93('0x28')](function(_0x592019){logger[_0x9d93('0x23')](_0x9d93('0x1f'),_0x1102b7,_0x592019);_0x53c629(_0x592019);});});}function respondWithStatusCode(_0x4d61fb,_0x792376){_0x792376=_0x792376||0xcc;return function(_0xae2476){if(_0xae2476){return _0x4d61fb[_0x9d93('0x29')](_0x792376);}return _0x4d61fb[_0x9d93('0x2a')](_0x792376)[_0x9d93('0x2b')]();};}function respondWithResult(_0x5bcd53,_0x553218){_0x553218=_0x553218||0xc8;return function(_0x397bae){if(_0x397bae){return _0x5bcd53[_0x9d93('0x2a')](_0x553218)[_0x9d93('0x2c')](_0x397bae);}};}function respondWithFilteredResult(_0x1eaf5f,_0x43da25){return function(_0x1b38c3){if(_0x1b38c3){var _0x528aa4=_0x1b38c3[_0x9d93('0x2d')],_0x539555=_0x43da25[_0x9d93('0x2e')],_0x40fa89=_0x43da25['offset']+_0x43da25[_0x9d93('0x2f')],_0x33569e;if(_0x40fa89>=_0x528aa4){_0x40fa89=_0x528aa4;_0x33569e=0xc8;}else{_0x33569e=0xce;}_0x1eaf5f[_0x9d93('0x2a')](_0x33569e);return _0x1eaf5f[_0x9d93('0x30')](_0x9d93('0x31'),_0x539555+'-'+_0x40fa89+'/'+_0x528aa4)[_0x9d93('0x2c')](_0x1b38c3);}return null;};}function patchUpdates(_0x376197){return function(_0x2b5c39){try{jsonpatch[_0x9d93('0x32')](_0x2b5c39,_0x376197,!![]);}catch(_0x18635d){return BPromise[_0x9d93('0x33')](_0x18635d);}return _0x2b5c39[_0x9d93('0x34')]();};}function saveUpdates(_0x414bd4,_0x1dd318){return function(_0x41f021){if(_0x41f021){return _0x41f021[_0x9d93('0x35')](_0x414bd4)[_0x9d93('0x1e')](function(_0x4a25b8){return _0x4a25b8;});}return null;};}function removeEntity(_0x3fa920,_0x5e0195){return function(_0x1c4e4d){if(_0x1c4e4d){return _0x1c4e4d[_0x9d93('0x36')]()[_0x9d93('0x1e')](function(){_0x3fa920[_0x9d93('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x520470,_0x2e07e4){return function(_0x597efe){if(!_0x597efe){_0x520470[_0x9d93('0x29')](0x194);}return _0x597efe;};}function handleError(_0x2d7814,_0x5dcf8d){_0x5dcf8d=_0x5dcf8d||0x1f4;return function(_0x1b563e){logger[_0x9d93('0x23')](_0x1b563e['stack']);if(_0x1b563e[_0x9d93('0x37')]){delete _0x1b563e[_0x9d93('0x37')];}_0x2d7814[_0x9d93('0x2a')](_0x5dcf8d)[_0x9d93('0x38')](_0x1b563e);};}exports[_0x9d93('0x39')]=function(_0xbcfc8,_0x4f02d7){var _0x13ffc3={},_0xef0e9f={},_0xa83d44={'count':0x0,'rows':[]};var _0x36bf73=_[_0x9d93('0x3a')](db['DeskAccount'][_0x9d93('0x3b')],function(_0x1d684a){return{'name':_0x1d684a[_0x9d93('0x3c')],'type':_0x1d684a[_0x9d93('0x3d')][_0x9d93('0x3e')]};});_0xef0e9f[_0x9d93('0x3f')]=_[_0x9d93('0x3a')](_0x36bf73,_0x9d93('0x37'));_0xef0e9f[_0x9d93('0x40')]=_[_0x9d93('0x41')](_0xbcfc8['query']);_0xef0e9f[_0x9d93('0x42')]=_[_0x9d93('0x43')](_0xef0e9f[_0x9d93('0x3f')],_0xef0e9f['query']);_0x13ffc3[_0x9d93('0x44')]=_[_0x9d93('0x43')](_0xef0e9f[_0x9d93('0x3f')],qs['fields'](_0xbcfc8['query'][_0x9d93('0x45')]));_0x13ffc3['attributes']=_0x13ffc3[_0x9d93('0x44')][_0x9d93('0x46')]?_0x13ffc3['attributes']:_0xef0e9f[_0x9d93('0x3f')];if(!_0xbcfc8[_0x9d93('0x40')][_0x9d93('0x47')](_0x9d93('0x48'))){_0x13ffc3['limit']=qs[_0x9d93('0x2f')](_0xbcfc8[_0x9d93('0x40')][_0x9d93('0x2f')]);_0x13ffc3[_0x9d93('0x2e')]=qs['offset'](_0xbcfc8[_0x9d93('0x40')][_0x9d93('0x2e')]);}_0x13ffc3[_0x9d93('0x49')]=qs[_0x9d93('0x4a')](_0xbcfc8[_0x9d93('0x40')][_0x9d93('0x4a')]);_0x13ffc3['where']=qs['filters'](_[_0x9d93('0x4b')](_0xbcfc8[_0x9d93('0x40')],_0xef0e9f[_0x9d93('0x42')]));if(_0xbcfc8[_0x9d93('0x40')]['filter']){_0x13ffc3[_0x9d93('0x4c')]=_['merge'](_0x13ffc3[_0x9d93('0x4c')],{'$or':_[_0x9d93('0x3a')](_0x36bf73,function(_0x1e4217){if(_0x1e4217[_0x9d93('0x3d')]!=='VIRTUAL'){var _0x156d11={};_0x156d11[_0x1e4217['name']]={'$like':'%'+_0xbcfc8[_0x9d93('0x40')][_0x9d93('0x4d')]+'%'};return _0x156d11;}})});}_0x13ffc3=_[_0x9d93('0x4e')]({},_0x13ffc3,_0xbcfc8[_0x9d93('0x4f')]);var _0x599ccf={'where':_0x13ffc3[_0x9d93('0x4c')]};return db[_0x9d93('0x50')][_0x9d93('0x2d')](_0x599ccf)[_0x9d93('0x1e')](function(_0x827ed){_0xa83d44[_0x9d93('0x2d')]=_0x827ed;if(_0xbcfc8[_0x9d93('0x40')]['includeAll']){_0x13ffc3[_0x9d93('0x51')]=[{'all':!![]}];}return db[_0x9d93('0x50')]['findAll'](_0x13ffc3);})[_0x9d93('0x1e')](function(_0x3ec84e){_0xa83d44[_0x9d93('0x52')]=_0x3ec84e;return _0xa83d44;})['then'](respondWithFilteredResult(_0x4f02d7,_0x13ffc3))[_0x9d93('0x28')](handleError(_0x4f02d7,null));};exports[_0x9d93('0x53')]=function(_0x33ba53,_0x47fc7e){var _0x24d5d5={'raw':![],'where':{'id':_0x33ba53[_0x9d93('0x54')]['id']}},_0x575a94={};_0x575a94['model']=_[_0x9d93('0x41')](db[_0x9d93('0x50')]['rawAttributes']);_0x575a94[_0x9d93('0x40')]=_['keys'](_0x33ba53[_0x9d93('0x40')]);_0x575a94[_0x9d93('0x42')]=_['intersection'](_0x575a94['model'],_0x575a94[_0x9d93('0x40')]);_0x24d5d5[_0x9d93('0x44')]=_[_0x9d93('0x43')](_0x575a94[_0x9d93('0x3f')],qs[_0x9d93('0x45')](_0x33ba53['query'][_0x9d93('0x45')]));_0x24d5d5[_0x9d93('0x44')]=_0x24d5d5[_0x9d93('0x44')]['length']?_0x24d5d5[_0x9d93('0x44')]:_0x575a94[_0x9d93('0x3f')];if(_0x33ba53[_0x9d93('0x40')]['includeAll']){_0x24d5d5[_0x9d93('0x51')]=[{'all':!![]}];}_0x24d5d5=_['merge']({},_0x24d5d5,_0x33ba53[_0x9d93('0x4f')]);return db[_0x9d93('0x50')][_0x9d93('0x55')](_0x24d5d5)[_0x9d93('0x1e')](handleEntityNotFound(_0x47fc7e,null))[_0x9d93('0x1e')](respondWithResult(_0x47fc7e,null))[_0x9d93('0x28')](handleError(_0x47fc7e,null));};exports['create']=function(_0x34b916,_0x2b7d45){return db[_0x9d93('0x50')][_0x9d93('0x56')](_0x34b916[_0x9d93('0x57')],{})[_0x9d93('0x1e')](respondWithResult(_0x2b7d45,0xc9))[_0x9d93('0x28')](handleError(_0x2b7d45,null));};exports[_0x9d93('0x35')]=function(_0x5b308d,_0x1d00e9){if(_0x5b308d['body']['id']){delete _0x5b308d[_0x9d93('0x57')]['id'];}return db['DeskAccount'][_0x9d93('0x55')]({'where':{'id':_0x5b308d['params']['id']}})[_0x9d93('0x1e')](handleEntityNotFound(_0x1d00e9,null))[_0x9d93('0x1e')](saveUpdates(_0x5b308d['body'],null))['then'](respondWithResult(_0x1d00e9,null))[_0x9d93('0x28')](handleError(_0x1d00e9,null));};exports['destroy']=function(_0x249275,_0x186b78){return db[_0x9d93('0x50')][_0x9d93('0x55')]({'where':{'id':_0x249275[_0x9d93('0x54')]['id']}})['then'](handleEntityNotFound(_0x186b78,null))[_0x9d93('0x1e')](removeEntity(_0x186b78,null))[_0x9d93('0x28')](handleError(_0x186b78,null));};exports[_0x9d93('0x58')]=function(_0x1550fa,_0xb970ba,_0x347189){var _0x43a85d={};var _0x341aaf={};var _0x584f53;var _0x26d842;return db[_0x9d93('0x50')][_0x9d93('0x59')]({'where':{'id':_0x1550fa[_0x9d93('0x54')]['id']}})[_0x9d93('0x1e')](handleEntityNotFound(_0xb970ba,null))[_0x9d93('0x1e')](function(_0x407718){if(_0x407718){_0x584f53=_0x407718;_0x341aaf[_0x9d93('0x3f')]=_[_0x9d93('0x41')](db[_0x9d93('0x5a')][_0x9d93('0x3b')]);_0x341aaf[_0x9d93('0x40')]=_['keys'](_0x1550fa['query']);_0x341aaf[_0x9d93('0x42')]=_[_0x9d93('0x43')](_0x341aaf['model'],_0x341aaf[_0x9d93('0x40')]);_0x43a85d['attributes']=_['intersection'](_0x341aaf['model'],qs[_0x9d93('0x45')](_0x1550fa[_0x9d93('0x40')][_0x9d93('0x45')]));_0x43a85d['attributes']=_0x43a85d[_0x9d93('0x44')][_0x9d93('0x46')]?_0x43a85d[_0x9d93('0x44')]:_0x341aaf[_0x9d93('0x3f')];_0x43a85d[_0x9d93('0x49')]=qs[_0x9d93('0x4a')](_0x1550fa[_0x9d93('0x40')][_0x9d93('0x4a')]);_0x43a85d[_0x9d93('0x4c')]=qs[_0x9d93('0x42')](_[_0x9d93('0x4b')](_0x1550fa[_0x9d93('0x40')],_0x341aaf[_0x9d93('0x42')]));if(_0x1550fa['query'][_0x9d93('0x4d')]){_0x43a85d[_0x9d93('0x4c')]=_[_0x9d93('0x4e')](_0x43a85d[_0x9d93('0x4c')],{'$or':_['map'](_0x43a85d[_0x9d93('0x44')],function(_0x21ac1d){var _0x2bbdba={};_0x2bbdba[_0x21ac1d]={'$like':'%'+_0x1550fa[_0x9d93('0x40')][_0x9d93('0x4d')]+'%'};return _0x2bbdba;})});}_0x43a85d=_[_0x9d93('0x4e')]({},_0x43a85d,_0x1550fa['options']);return _0x584f53['getConfigurations'](_0x43a85d);}})[_0x9d93('0x1e')](function(_0xf38ff9){if(_0xf38ff9){_0x26d842=_0xf38ff9[_0x9d93('0x46')];if(!_0x1550fa[_0x9d93('0x40')][_0x9d93('0x47')](_0x9d93('0x48'))){_0x43a85d[_0x9d93('0x2f')]=qs['limit'](_0x1550fa['query'][_0x9d93('0x2f')]);_0x43a85d[_0x9d93('0x2e')]=qs[_0x9d93('0x2e')](_0x1550fa[_0x9d93('0x40')]['offset']);}return _0x584f53[_0x9d93('0x58')](_0x43a85d);}})[_0x9d93('0x1e')](function(_0x4c7e39){if(_0x4c7e39){return _0x4c7e39?{'count':_0x26d842,'rows':_0x4c7e39}:null;}})['then'](respondWithResult(_0xb970ba,null))['catch'](handleError(_0xb970ba,null));};exports[_0x9d93('0x5b')]=function(_0x35c249,_0x2eb953,_0x37218b){if(_0x35c249['body']['id']){delete _0x35c249['body']['id'];}return db['DeskAccount'][_0x9d93('0x59')]({'where':{'id':_0x35c249['params']['id']}})[_0x9d93('0x1e')](handleEntityNotFound(_0x2eb953,null))[_0x9d93('0x1e')](function(_0x557c57){if(_0x557c57){_0x35c249[_0x9d93('0x57')][_0x9d93('0x5c')]=_0x557c57['id'];_0x35c249['body'][_0x9d93('0x5d')]=integrations[_0x9d93('0x5e')](_0x35c249[_0x9d93('0x57')][_0x9d93('0x5f')],_0x35c249['body'][_0x9d93('0x3d')]);_0x35c249[_0x9d93('0x57')]['Descriptions']=integrations['getDescriptions'](_0x35c249[_0x9d93('0x57')][_0x9d93('0x5f')],_0x35c249[_0x9d93('0x57')][_0x9d93('0x3d')]);return db[_0x9d93('0x5a')][_0x9d93('0x56')](_0x35c249[_0x9d93('0x57')],{'include':[{'model':db[_0x9d93('0x60')],'as':_0x9d93('0x5d')},{'model':db[_0x9d93('0x60')],'as':_0x9d93('0x61')}]});}return null;})[_0x9d93('0x1e')](respondWithResult(_0x2eb953,null))[_0x9d93('0x28')](handleError(_0x2eb953,null));};exports['getFields']=function(_0xdb2750,_0x274099,_0x5776e3){var _0x4a1175=[{'name':_0x9d93('0x62'),'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 _0x27b202='';return db[_0x9d93('0x50')]['findOne']({'where':{'id':_0xdb2750[_0x9d93('0x54')]['id']},'attributes':['id',_0x9d93('0x63'),_0x9d93('0x64'),_0x9d93('0x65'),_0x9d93('0x66'),_0x9d93('0x67'),_0x9d93('0x68'),_0x9d93('0x69'),_0x9d93('0x6a')]})['then'](handleEntityNotFound(_0x274099,null))['then'](function(_0x48eb10){if(_0x48eb10){_0x27b202=_0x48eb10[_0x9d93('0x63')];var _0x46f19b=_0x27b202[_0x9d93('0x6b')](-0x1);if(_0x46f19b==='/'){_0x27b202=_0x27b202[_0x9d93('0x6c')](0x0,_0x27b202[_0x9d93('0x6d')](_0x46f19b));}var _0x5125fc={'method':'GET','uri':util['format']('%s/custom_fields',_0x27b202),'headers':{'Content-Type':_0x9d93('0x6e'),'Accept':'application/json'},'json':!![]};if(_0x48eb10[_0x9d93('0x64')]===_0x9d93('0x6f')){_0x5125fc[_0x9d93('0x70')][_0x9d93('0x71')]=util['format'](_0x9d93('0x72'),new Buffer(util[_0x9d93('0x73')](_0x9d93('0x74'),_0x48eb10[_0x9d93('0x65')],_0x48eb10['password']))[_0x9d93('0x75')](_0x9d93('0x76')));}return rp(_0x5125fc)['then'](function(_0x39a888){return _0x4a1175[_0x9d93('0x77')](_['map'](_0x39a888[_0x9d93('0x78')][_0x9d93('0x79')],function(_0x5b6266){return{'id':_0x5b6266['name'],'name':_0x5b6266[_0x9d93('0x37')],'type':_0x5b6266['type'],'active':_0x5b6266[_0x9d93('0x7a')],'label':_0x5b6266['label'],'custom':!![]};}));});}})[_0x9d93('0x1e')](function(_0x3b013d){return{'count':_0x3b013d[_0x9d93('0x46')],'rows':_0x3b013d};})['then'](respondWithResult(_0x274099,null))[_0x9d93('0x28')](function(_0x478dea){var _0x50f67e=_0xdb2750['query'][_0x9d93('0x19')]?0x1f4:_0x478dea['statusCode']||0x1f4;logger[_0x9d93('0x23')](_0x9d93('0x7b'),'getFields',_0x50f67e,JSON['stringify'](_0x478dea));delete _0x478dea['name'];if(_0x50f67e===0x191){_0x50f67e=0x190;}_0x274099[_0x9d93('0x2a')](_0x50f67e)[_0x9d93('0x38')](_0xdb2750[_0x9d93('0x40')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x478dea[_0x9d93('0x7c')]}:_0x478dea);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 2c2823d..70ee8f6 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 _0x5818=['path','rimraf','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','define','int_desk_accounts','util','../../config/logger','api','moment'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x5818,0xac));var _0x8581=function(_0x258f27,_0x17d611){_0x258f27=_0x258f27-0x0;var _0x39df18=_0x5818[_0x258f27];return _0x39df18;};'use strict';var _=require('lodash');var util=require(_0x8581('0x0'));var logger=require(_0x8581('0x1'))(_0x8581('0x2'));var moment=require(_0x8581('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x8581('0x4'));var rimraf=require(_0x8581('0x5'));var config=require(_0x8581('0x6'));var attributes=require(_0x8581('0x7'));var integrations=require(_0x8581('0x8'));module['exports']=function(_0x211cf2,_0x329bf1){return _0x211cf2[_0x8581('0x9')]('DeskAccount',attributes,{'tableName':_0x8581('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1ce9=['../../config/environment','../../components/integrations/configuration','define','DeskAccount','int_desk_accounts','util','api','moment','bluebird','path','rimraf'];(function(_0x5abfe4,_0x2e5843){var _0x326d19=function(_0x53f11e){while(--_0x53f11e){_0x5abfe4['push'](_0x5abfe4['shift']());}};_0x326d19(++_0x2e5843);}(_0x1ce9,0xf7));var _0x91ce=function(_0x36bcfc,_0x1a81d0){_0x36bcfc=_0x36bcfc-0x0;var _0x43411d=_0x1ce9[_0x36bcfc];return _0x43411d;};'use strict';var _=require('lodash');var util=require(_0x91ce('0x0'));var logger=require('../../config/logger')(_0x91ce('0x1'));var moment=require(_0x91ce('0x2'));var BPromise=require(_0x91ce('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x91ce('0x4'));var rimraf=require(_0x91ce('0x5'));var config=require(_0x91ce('0x6'));var attributes=require('./intDeskAccount.attributes');var integrations=require(_0x91ce('0x7'));module['exports']=function(_0x23236c,_0x5c6d59){return _0x23236c[_0x91ce('0x8')](_0x91ce('0x9'),attributes,{'tableName':_0x91ce('0xa'),'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 7e5684e..cb77000 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 _0xa196=['then','GetDeskAccount','catch','ShowDeskAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','DeskAccount,\x20%s,\x20%s','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','DeskAccount','findAll','options','raw','where','attributes','limit','include','map','model'];(function(_0x3dd8dd,_0x369f8e){var _0x33e300=function(_0xf1a7db){while(--_0xf1a7db){_0x3dd8dd['push'](_0x3dd8dd['shift']());}};_0x33e300(++_0x369f8e);}(_0xa196,0xa1));var _0x6a19=function(_0x1b89d0,_0x5ea66a){_0x1b89d0=_0x1b89d0-0x0;var _0x245a3d=_0xa196[_0x1b89d0];return _0x245a3d;};'use strict';var _=require(_0x6a19('0x0'));var util=require(_0x6a19('0x1'));var moment=require(_0x6a19('0x2'));var BPromise=require(_0x6a19('0x3'));var rs=require(_0x6a19('0x4'));var fs=require('fs');var Redis=require(_0x6a19('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x6a19('0x6'));var logger=require(_0x6a19('0x7'))(_0x6a19('0x8'));var config=require(_0x6a19('0x9'));var jayson=require(_0x6a19('0xa'));var client=jayson[_0x6a19('0xb')][_0x6a19('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x39d112,_0x10f753,_0x34d2e4){return new BPromise(function(_0x51872e,_0x105961){return client[_0x6a19('0xd')](_0x39d112,_0x34d2e4)['then'](function(_0x1c5250){logger[_0x6a19('0xe')](_0x6a19('0xf'),_0x10f753,'request\x20sent');logger[_0x6a19('0x10')](_0x6a19('0x11'),_0x10f753,'request\x20sent',JSON[_0x6a19('0x12')](_0x1c5250));if(_0x1c5250[_0x6a19('0x13')]){if(_0x1c5250[_0x6a19('0x13')][_0x6a19('0x14')]===0x1f4){logger[_0x6a19('0x13')](_0x6a19('0xf'),_0x10f753,_0x1c5250[_0x6a19('0x13')][_0x6a19('0x15')]);return _0x105961(_0x1c5250[_0x6a19('0x13')][_0x6a19('0x15')]);}logger[_0x6a19('0x13')](_0x6a19('0xf'),_0x10f753,_0x1c5250[_0x6a19('0x13')][_0x6a19('0x15')]);return _0x51872e(_0x1c5250[_0x6a19('0x13')]['message']);}else{logger[_0x6a19('0xe')](_0x6a19('0xf'),_0x10f753,_0x6a19('0x16'));_0x51872e(_0x1c5250[_0x6a19('0x17')][_0x6a19('0x15')]);}})['catch'](function(_0x2aeec0){logger['error'](_0x6a19('0xf'),_0x10f753,_0x2aeec0);_0x105961(_0x2aeec0);});});}exports['GetDeskAccount']=function(_0x1c74b6){var _0x4376ab=this;return new Promise(function(_0x31ef94,_0x2259a1){return db[_0x6a19('0x18')][_0x6a19('0x19')]({'raw':_0x1c74b6[_0x6a19('0x1a')]?_0x1c74b6[_0x6a19('0x1a')][_0x6a19('0x1b')]===undefined?!![]:![]:!![],'where':_0x1c74b6[_0x6a19('0x1a')]?_0x1c74b6[_0x6a19('0x1a')][_0x6a19('0x1c')]||null:null,'attributes':_0x1c74b6[_0x6a19('0x1a')]?_0x1c74b6[_0x6a19('0x1a')][_0x6a19('0x1d')]||null:null,'limit':_0x1c74b6[_0x6a19('0x1a')]?_0x1c74b6[_0x6a19('0x1a')][_0x6a19('0x1e')]||null:null,'include':_0x1c74b6['options']?_0x1c74b6[_0x6a19('0x1a')][_0x6a19('0x1f')]?_[_0x6a19('0x20')](_0x1c74b6[_0x6a19('0x1a')][_0x6a19('0x1f')],function(_0x1fd270){return{'model':db[_0x1fd270[_0x6a19('0x21')]],'as':_0x1fd270['as'],'attributes':_0x1fd270['attributes'],'include':_0x1fd270['include']?_[_0x6a19('0x20')](_0x1fd270['include'],function(_0xdffb15){return{'model':db[_0xdffb15[_0x6a19('0x21')]],'as':_0xdffb15['as'],'attributes':_0xdffb15[_0x6a19('0x1d')],'include':_0xdffb15[_0x6a19('0x1f')]?_[_0x6a19('0x20')](_0xdffb15[_0x6a19('0x1f')],function(_0x3d2e22){return{'model':db[_0x3d2e22['model']],'as':_0x3d2e22['as'],'attributes':_0x3d2e22[_0x6a19('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x6a19('0x22')](function(_0x47d3b5){logger[_0x6a19('0xe')](_0x6a19('0x23'),_0x1c74b6);logger[_0x6a19('0x10')](_0x6a19('0x23'),_0x1c74b6,JSON['stringify'](_0x47d3b5));_0x31ef94(_0x47d3b5);})[_0x6a19('0x24')](function(_0x509665){logger[_0x6a19('0x13')]('GetDeskAccount',_0x509665['message'],_0x1c74b6);_0x2259a1(_0x4376ab[_0x6a19('0x13')](0x1f4,_0x509665[_0x6a19('0x15')]));});});};exports[_0x6a19('0x25')]=function(_0x31bc94){var _0x368e15=this;return new Promise(function(_0x4392c2,_0x45c55c){return db[_0x6a19('0x18')][_0x6a19('0x26')]({'raw':_0x31bc94[_0x6a19('0x1a')]?_0x31bc94['options'][_0x6a19('0x1b')]===undefined?!![]:![]:!![],'where':_0x31bc94[_0x6a19('0x1a')]?_0x31bc94[_0x6a19('0x1a')][_0x6a19('0x1c')]||null:null,'attributes':_0x31bc94[_0x6a19('0x1a')]?_0x31bc94[_0x6a19('0x1a')][_0x6a19('0x1d')]||null:null,'include':_0x31bc94[_0x6a19('0x1a')]?_0x31bc94[_0x6a19('0x1a')][_0x6a19('0x1f')]?_[_0x6a19('0x20')](_0x31bc94['options'][_0x6a19('0x1f')],function(_0x683e06){return{'model':db[_0x683e06['model']],'as':_0x683e06['as'],'attributes':_0x683e06['attributes'],'include':_0x683e06[_0x6a19('0x1f')]?_[_0x6a19('0x20')](_0x683e06[_0x6a19('0x1f')],function(_0x10f5f8){return{'model':db[_0x10f5f8['model']],'as':_0x10f5f8['as'],'attributes':_0x10f5f8[_0x6a19('0x1d')],'include':_0x10f5f8[_0x6a19('0x1f')]?_[_0x6a19('0x20')](_0x10f5f8[_0x6a19('0x1f')],function(_0x10a978){return{'model':db[_0x10a978[_0x6a19('0x21')]],'as':_0x10a978['as'],'attributes':_0x10a978[_0x6a19('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3982ab){logger[_0x6a19('0xe')](_0x6a19('0x25'),_0x31bc94);logger[_0x6a19('0x10')](_0x6a19('0x25'),_0x31bc94,JSON[_0x6a19('0x12')](_0x3982ab));_0x4392c2(_0x3982ab);})[_0x6a19('0x24')](function(_0x2ccfc0){logger[_0x6a19('0x13')](_0x6a19('0x25'),_0x2ccfc0[_0x6a19('0x15')],_0x31bc94);_0x45c55c(_0x368e15['error'](0x1f4,_0x2ccfc0[_0x6a19('0x15')]));});});}; \ No newline at end of file +var _0xe78d=['attributes','then','debug','find','ShowDeskAccount','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','info','DeskAccount,\x20%s,\x20%s','request\x20sent','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetDeskAccount','DeskAccount','findAll','options','raw','where','limit','map','include','model'];(function(_0x425979,_0x3b0590){var _0x29ca69=function(_0x13e12f){while(--_0x13e12f){_0x425979['push'](_0x425979['shift']());}};_0x29ca69(++_0x3b0590);}(_0xe78d,0xf3));var _0xde78=function(_0x340380,_0x4bd2a8){_0x340380=_0x340380-0x0;var _0x49ce1c=_0xe78d[_0x340380];return _0x49ce1c;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xde78('0x0'));var BPromise=require(_0xde78('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xde78('0x2'));var db=require(_0xde78('0x3'))['db'];var utils=require(_0xde78('0x4'));var logger=require(_0xde78('0x5'))(_0xde78('0x6'));var config=require(_0xde78('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xde78('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5f1043,_0x1e3cd5,_0x406b35){return new BPromise(function(_0x263182,_0xf3eb09){return client[_0xde78('0x9')](_0x5f1043,_0x406b35)['then'](function(_0xb94f37){logger[_0xde78('0xa')](_0xde78('0xb'),_0x1e3cd5,_0xde78('0xc'));logger['debug'](_0xde78('0xd'),_0x1e3cd5,_0xde78('0xc'),JSON[_0xde78('0xe')](_0xb94f37));if(_0xb94f37['error']){if(_0xb94f37[_0xde78('0xf')][_0xde78('0x10')]===0x1f4){logger[_0xde78('0xf')](_0xde78('0xb'),_0x1e3cd5,_0xb94f37[_0xde78('0xf')][_0xde78('0x11')]);return _0xf3eb09(_0xb94f37[_0xde78('0xf')][_0xde78('0x11')]);}logger[_0xde78('0xf')](_0xde78('0xb'),_0x1e3cd5,_0xb94f37[_0xde78('0xf')][_0xde78('0x11')]);return _0x263182(_0xb94f37[_0xde78('0xf')]['message']);}else{logger[_0xde78('0xa')]('DeskAccount,\x20%s,\x20%s',_0x1e3cd5,_0xde78('0xc'));_0x263182(_0xb94f37[_0xde78('0x12')][_0xde78('0x11')]);}})['catch'](function(_0x33b93a){logger[_0xde78('0xf')]('DeskAccount,\x20%s,\x20%s',_0x1e3cd5,_0x33b93a);_0xf3eb09(_0x33b93a);});});}exports[_0xde78('0x13')]=function(_0x5441aa){var _0x7b369=this;return new Promise(function(_0x45e824,_0x467e8f){return db[_0xde78('0x14')][_0xde78('0x15')]({'raw':_0x5441aa[_0xde78('0x16')]?_0x5441aa[_0xde78('0x16')][_0xde78('0x17')]===undefined?!![]:![]:!![],'where':_0x5441aa[_0xde78('0x16')]?_0x5441aa[_0xde78('0x16')][_0xde78('0x18')]||null:null,'attributes':_0x5441aa[_0xde78('0x16')]?_0x5441aa[_0xde78('0x16')]['attributes']||null:null,'limit':_0x5441aa[_0xde78('0x16')]?_0x5441aa[_0xde78('0x16')][_0xde78('0x19')]||null:null,'include':_0x5441aa['options']?_0x5441aa[_0xde78('0x16')]['include']?_[_0xde78('0x1a')](_0x5441aa[_0xde78('0x16')][_0xde78('0x1b')],function(_0x4ca38a){return{'model':db[_0x4ca38a[_0xde78('0x1c')]],'as':_0x4ca38a['as'],'attributes':_0x4ca38a[_0xde78('0x1d')],'include':_0x4ca38a[_0xde78('0x1b')]?_[_0xde78('0x1a')](_0x4ca38a[_0xde78('0x1b')],function(_0x5cd345){return{'model':db[_0x5cd345['model']],'as':_0x5cd345['as'],'attributes':_0x5cd345[_0xde78('0x1d')],'include':_0x5cd345['include']?_[_0xde78('0x1a')](_0x5cd345['include'],function(_0x2125a3){return{'model':db[_0x2125a3[_0xde78('0x1c')]],'as':_0x2125a3['as'],'attributes':_0x2125a3[_0xde78('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xde78('0x1e')](function(_0x5500db){logger[_0xde78('0xa')](_0xde78('0x13'),_0x5441aa);logger[_0xde78('0x1f')](_0xde78('0x13'),_0x5441aa,JSON[_0xde78('0xe')](_0x5500db));_0x45e824(_0x5500db);})['catch'](function(_0xa52eec){logger['error'](_0xde78('0x13'),_0xa52eec[_0xde78('0x11')],_0x5441aa);_0x467e8f(_0x7b369[_0xde78('0xf')](0x1f4,_0xa52eec[_0xde78('0x11')]));});});};exports['ShowDeskAccount']=function(_0x505275){var _0x499dab=this;return new Promise(function(_0x266ea4,_0x2f096f){return db[_0xde78('0x14')][_0xde78('0x20')]({'raw':_0x505275[_0xde78('0x16')]?_0x505275[_0xde78('0x16')][_0xde78('0x17')]===undefined?!![]:![]:!![],'where':_0x505275[_0xde78('0x16')]?_0x505275[_0xde78('0x16')][_0xde78('0x18')]||null:null,'attributes':_0x505275['options']?_0x505275['options'][_0xde78('0x1d')]||null:null,'include':_0x505275[_0xde78('0x16')]?_0x505275['options']['include']?_['map'](_0x505275[_0xde78('0x16')][_0xde78('0x1b')],function(_0x57d71c){return{'model':db[_0x57d71c[_0xde78('0x1c')]],'as':_0x57d71c['as'],'attributes':_0x57d71c[_0xde78('0x1d')],'include':_0x57d71c[_0xde78('0x1b')]?_[_0xde78('0x1a')](_0x57d71c[_0xde78('0x1b')],function(_0x2919e1){return{'model':db[_0x2919e1[_0xde78('0x1c')]],'as':_0x2919e1['as'],'attributes':_0x2919e1[_0xde78('0x1d')],'include':_0x2919e1[_0xde78('0x1b')]?_[_0xde78('0x1a')](_0x2919e1['include'],function(_0x5c4573){return{'model':db[_0x5c4573['model']],'as':_0x5c4573['as'],'attributes':_0x5c4573['attributes']};}):[]};}):[]};}):[]:[]})[_0xde78('0x1e')](function(_0x430d9c){logger[_0xde78('0xa')](_0xde78('0x21'),_0x505275);logger['debug'](_0xde78('0x21'),_0x505275,JSON[_0xde78('0xe')](_0x430d9c));_0x266ea4(_0x430d9c);})['catch'](function(_0x3df2aa){logger[_0xde78('0xf')]('ShowDeskAccount',_0x3df2aa[_0xde78('0x11')],_0x505275);_0x2f096f(_0x499dab['error'](0x1f4,_0x3df2aa['message']));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index fd342b4..b11f553 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 _0x9e54=['isAuthenticated','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create','setTags','put','update','/:id','destroy','exports','multer','util','Router','../../components/auth/service','../../components/interaction/service','./intDeskConfiguration.controller','get','index'];(function(_0xaa44d9,_0x2d4402){var _0x26a6fc=function(_0x3375ea){while(--_0x3375ea){_0xaa44d9['push'](_0xaa44d9['shift']());}};_0x26a6fc(++_0x2d4402);}(_0x9e54,0x88));var _0x49e5=function(_0x1e699f,_0x3174f2){_0x1e699f=_0x1e699f-0x0;var _0x2719d6=_0x9e54[_0x1e699f];return _0x2719d6;};'use strict';var multer=require(_0x49e5('0x0'));var util=require(_0x49e5('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x49e5('0x2')]();var auth=require(_0x49e5('0x3'));var interaction=require(_0x49e5('0x4'));var config=require('../../config/environment');var controller=require(_0x49e5('0x5'));router[_0x49e5('0x6')]('/',auth['isAuthenticated'](),controller[_0x49e5('0x7')]);router['get']('/:id',auth[_0x49e5('0x8')](),controller['show']);router[_0x49e5('0x6')](_0x49e5('0x9'),auth[_0x49e5('0x8')](),controller['getFields']);router['get'](_0x49e5('0xa'),auth['isAuthenticated'](),controller[_0x49e5('0xb')]);router[_0x49e5('0x6')](_0x49e5('0xc'),auth[_0x49e5('0x8')](),controller[_0x49e5('0xd')]);router['get'](_0x49e5('0xe'),auth['isAuthenticated'](),controller[_0x49e5('0xf')]);router[_0x49e5('0x10')]('/',auth[_0x49e5('0x8')](),controller[_0x49e5('0x11')]);router[_0x49e5('0x10')]('/:id/tags',auth['isAuthenticated'](),controller[_0x49e5('0x12')]);router[_0x49e5('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x49e5('0x14')]);router['delete'](_0x49e5('0x15'),auth['isAuthenticated'](),controller[_0x49e5('0x16')]);module[_0x49e5('0x17')]=router; \ No newline at end of file +var _0x2f4a=['/:id/tags','post','create','setTags','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskConfiguration.controller','isAuthenticated','index','get','/:id','show','/:id/fields','getSubjects','/:id/descriptions','getDescriptions'];(function(_0x967959,_0x53c5c1){var _0x5c4489=function(_0x1ae5c6){while(--_0x1ae5c6){_0x967959['push'](_0x967959['shift']());}};_0x5c4489(++_0x53c5c1);}(_0x2f4a,0x8f));var _0xa2f4=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x2f4a[_0x3947c9];return _0x2e7871;};'use strict';var multer=require(_0xa2f4('0x0'));var util=require(_0xa2f4('0x1'));var path=require(_0xa2f4('0x2'));var timeout=require(_0xa2f4('0x3'));var express=require(_0xa2f4('0x4'));var router=express[_0xa2f4('0x5')]();var auth=require(_0xa2f4('0x6'));var interaction=require(_0xa2f4('0x7'));var config=require(_0xa2f4('0x8'));var controller=require(_0xa2f4('0x9'));router['get']('/',auth[_0xa2f4('0xa')](),controller[_0xa2f4('0xb')]);router[_0xa2f4('0xc')](_0xa2f4('0xd'),auth[_0xa2f4('0xa')](),controller[_0xa2f4('0xe')]);router['get'](_0xa2f4('0xf'),auth['isAuthenticated'](),controller['getFields']);router['get']('/:id/subjects',auth[_0xa2f4('0xa')](),controller[_0xa2f4('0x10')]);router[_0xa2f4('0xc')](_0xa2f4('0x11'),auth['isAuthenticated'](),controller[_0xa2f4('0x12')]);router['get'](_0xa2f4('0x13'),auth[_0xa2f4('0xa')](),controller['getTags']);router[_0xa2f4('0x14')]('/',auth['isAuthenticated'](),controller[_0xa2f4('0x15')]);router['post'](_0xa2f4('0x13'),auth['isAuthenticated'](),controller[_0xa2f4('0x16')]);router[_0xa2f4('0x17')](_0xa2f4('0xd'),auth[_0xa2f4('0xa')](),controller[_0xa2f4('0x18')]);router[_0xa2f4('0x19')]('/:id',auth[_0xa2f4('0xa')](),controller[_0xa2f4('0x1a')]);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 e068787..b85efa8 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 _0xdc50=['exports','STRING','sequelize'];(function(_0x15ad3f,_0x1d6280){var _0xfb1d10=function(_0x2730f7){while(--_0x2730f7){_0x15ad3f['push'](_0x15ad3f['shift']());}};_0xfb1d10(++_0x1d6280);}(_0xdc50,0x80));var _0x0dc5=function(_0x16f18f,_0x533934){_0x16f18f=_0x16f18f-0x0;var _0xafa041=_0xdc50[_0x16f18f];return _0xafa041;};'use strict';var Sequelize=require(_0x0dc5('0x0'));module[_0x0dc5('0x1')]={'name':{'type':Sequelize[_0x0dc5('0x2')]},'description':{'type':Sequelize[_0x0dc5('0x2')]}}; \ No newline at end of file +var _0x66e9=['STRING','sequelize','exports'];(function(_0x5805d7,_0x3d584a){var _0x170fe4=function(_0x3b9b73){while(--_0x3b9b73){_0x5805d7['push'](_0x5805d7['shift']());}};_0x170fe4(++_0x3d584a);}(_0x66e9,0x76));var _0x966e=function(_0x4ce028,_0x526d4b){_0x4ce028=_0x4ce028-0x0;var _0x583d0c=_0x66e9[_0x4ce028];return _0x583d0c;};'use strict';var Sequelize=require(_0x966e('0x0'));module[_0x966e('0x1')]={'name':{'type':Sequelize[_0x966e('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index f08a352..b517d54 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 _0x2007=['error','code','message','info','result','status','end','json','offset','limit','set','Content-Range','reject','save','update','destroy','sendStatus','stack','name','send','index','DeskConfiguration','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','count','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','getFields','findOne','length','getSubjects','DeskField','getDescriptions','getTags','ids','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','test','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','DeskConfiguration,\x20%s,\x20%s','request\x20sent','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x1b1c65,_0x23ca6d){var _0x1b86d9=function(_0x1e8559){while(--_0x1e8559){_0x1b1c65['push'](_0x1b1c65['shift']());}};_0x1b86d9(++_0x23ca6d);}(_0x2007,0x16a));var _0x7200=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x2007[_0x14add3];return _0x4a174f;};'use strict';var pdf=require(_0x7200('0x0'));var emlformat=require(_0x7200('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x7200('0x2'));var jsonpatch=require(_0x7200('0x3'));var rp=require(_0x7200('0x4'));var moment=require(_0x7200('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x7200('0x6'));var util=require(_0x7200('0x7'));var path=require(_0x7200('0x8'));var sox=require(_0x7200('0x9'));var csv=require('to-csv');var ejs=require(_0x7200('0xa'));var fs=require('fs');var _=require(_0x7200('0xb'));var squel=require(_0x7200('0xc'));var crypto=require(_0x7200('0xd'));var jsforce=require(_0x7200('0xe'));var deskjs=require(_0x7200('0xf'));var toCsv=require(_0x7200('0x10'));var querystring=require(_0x7200('0x11'));var Papa=require(_0x7200('0x12'));var Redis=require(_0x7200('0x13'));var authService=require(_0x7200('0x14'));var qs=require(_0x7200('0x15'));var as=require(_0x7200('0x16'));var hardwareService=require(_0x7200('0x17'));var logger=require('../../config/logger')(_0x7200('0x18'));var utils=require(_0x7200('0x19'));var config=require(_0x7200('0x1a'));var db=require(_0x7200('0x1b'))['db'];var jayson=require(_0x7200('0x1c'));var client=jayson[_0x7200('0x1d')][_0x7200('0x1e')]({'port':0x232a});function checkPasswordPattern(_0x1e4ecd,_0x1db014,_0x34ac06){if(_0x34ac06){var _0x597667=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x597667[_0x7200('0x1f')](_0x1db014)){return _0x1e4ecd;}else{throw new db['Sequelize']['ValidationError'](_0x7200('0x20'));}}else{return _0x1e4ecd;}}function respondWithRpcPromise(_0x266fda,_0x591e01,_0x5830c0,_0x3ff589){return new BPromise(function(_0x16b645,_0x2ccfa4){var _0x3a33b3=_0x3ff589||client;return _0x3a33b3['request'](_0x266fda,_0x5830c0)[_0x7200('0x21')](function(_0x142d4e){logger['info'](_0x7200('0x22'),_0x591e01,_0x7200('0x23'));logger['debug'](_0x7200('0x24'),_0x591e01,_0x7200('0x23'),JSON[_0x7200('0x25')](_0x142d4e));if(_0x142d4e[_0x7200('0x26')]){if(_0x142d4e[_0x7200('0x26')][_0x7200('0x27')]===0x1f4){logger[_0x7200('0x26')]('DeskConfiguration,\x20%s,\x20%s',_0x591e01,_0x142d4e[_0x7200('0x26')]['message']);return _0x2ccfa4(_0x142d4e['error']['message']);}logger[_0x7200('0x26')]('DeskConfiguration,\x20%s,\x20%s',_0x591e01,_0x142d4e[_0x7200('0x26')][_0x7200('0x28')]);return _0x16b645(_0x142d4e[_0x7200('0x26')]['message']);}else{logger[_0x7200('0x29')]('DeskConfiguration,\x20%s,\x20%s',_0x591e01,_0x7200('0x23'));_0x16b645(_0x142d4e[_0x7200('0x2a')]['message']);}})['catch'](function(_0x135742){logger[_0x7200('0x26')](_0x7200('0x22'),_0x591e01,_0x135742);_0x2ccfa4(_0x135742);});});}function respondWithStatusCode(_0x30b1f4,_0xdceb5b){_0xdceb5b=_0xdceb5b||0xcc;return function(_0x5895dd){if(_0x5895dd){return _0x30b1f4['sendStatus'](_0xdceb5b);}return _0x30b1f4[_0x7200('0x2b')](_0xdceb5b)[_0x7200('0x2c')]();};}function respondWithResult(_0x430cca,_0x98d3e){_0x98d3e=_0x98d3e||0xc8;return function(_0x1065f6){if(_0x1065f6){return _0x430cca[_0x7200('0x2b')](_0x98d3e)[_0x7200('0x2d')](_0x1065f6);}};}function respondWithFilteredResult(_0x5060d5,_0x365fec){return function(_0x383023){if(_0x383023){var _0x2e5f90=_0x383023['count'],_0x307790=_0x365fec[_0x7200('0x2e')],_0x18d553=_0x365fec[_0x7200('0x2e')]+_0x365fec[_0x7200('0x2f')],_0x312d79;if(_0x18d553>=_0x2e5f90){_0x18d553=_0x2e5f90;_0x312d79=0xc8;}else{_0x312d79=0xce;}_0x5060d5[_0x7200('0x2b')](_0x312d79);return _0x5060d5[_0x7200('0x30')](_0x7200('0x31'),_0x307790+'-'+_0x18d553+'/'+_0x2e5f90)[_0x7200('0x2d')](_0x383023);}return null;};}function patchUpdates(_0x1b26e0){return function(_0x2b97ce){try{jsonpatch['apply'](_0x2b97ce,_0x1b26e0,!![]);}catch(_0x108895){return BPromise[_0x7200('0x32')](_0x108895);}return _0x2b97ce[_0x7200('0x33')]();};}function saveUpdates(_0x55ad3a,_0x536f54){return function(_0x14f3a5){if(_0x14f3a5){return _0x14f3a5[_0x7200('0x34')](_0x55ad3a)['then'](function(_0x109f76){return _0x109f76;});}return null;};}function removeEntity(_0x9cd6e6,_0x2de97d){return function(_0x549dab){if(_0x549dab){return _0x549dab[_0x7200('0x35')]()[_0x7200('0x21')](function(){_0x9cd6e6['status'](0xcc)[_0x7200('0x2c')]();});}};}function handleEntityNotFound(_0x175b8e,_0x2cf404){return function(_0x1451d7){if(!_0x1451d7){_0x175b8e[_0x7200('0x36')](0x194);}return _0x1451d7;};}function handleError(_0x33e7de,_0x5bc4db){_0x5bc4db=_0x5bc4db||0x1f4;return function(_0x323f0f){logger[_0x7200('0x26')](_0x323f0f[_0x7200('0x37')]);if(_0x323f0f['name']){delete _0x323f0f[_0x7200('0x38')];}_0x33e7de[_0x7200('0x2b')](_0x5bc4db)[_0x7200('0x39')](_0x323f0f);};}exports[_0x7200('0x3a')]=function(_0x478686,_0x49a8f7){var _0x36c346={},_0x23749e={},_0xe60c1d={'count':0x0,'rows':[]};var _0x28055b=_['map'](db[_0x7200('0x3b')]['rawAttributes'],function(_0x2baa5a){return{'name':_0x2baa5a['fieldName'],'type':_0x2baa5a[_0x7200('0x3c')][_0x7200('0x3d')]};});_0x23749e[_0x7200('0x3e')]=_[_0x7200('0x3f')](_0x28055b,_0x7200('0x38'));_0x23749e[_0x7200('0x40')]=_[_0x7200('0x41')](_0x478686[_0x7200('0x40')]);_0x23749e[_0x7200('0x42')]=_[_0x7200('0x43')](_0x23749e[_0x7200('0x3e')],_0x23749e['query']);_0x36c346[_0x7200('0x44')]=_[_0x7200('0x43')](_0x23749e['model'],qs[_0x7200('0x45')](_0x478686[_0x7200('0x40')]['fields']));_0x36c346[_0x7200('0x44')]=_0x36c346[_0x7200('0x44')]['length']?_0x36c346[_0x7200('0x44')]:_0x23749e['model'];if(!_0x478686[_0x7200('0x40')][_0x7200('0x46')](_0x7200('0x47'))){_0x36c346['limit']=qs['limit'](_0x478686[_0x7200('0x40')][_0x7200('0x2f')]);_0x36c346[_0x7200('0x2e')]=qs['offset'](_0x478686['query'][_0x7200('0x2e')]);}_0x36c346[_0x7200('0x48')]=qs[_0x7200('0x49')](_0x478686[_0x7200('0x40')][_0x7200('0x49')]);_0x36c346[_0x7200('0x4a')]=qs[_0x7200('0x42')](_[_0x7200('0x4b')](_0x478686['query'],_0x23749e[_0x7200('0x42')]));if(_0x478686[_0x7200('0x40')][_0x7200('0x4c')]){_0x36c346[_0x7200('0x4a')]=_['merge'](_0x36c346[_0x7200('0x4a')],{'$or':_['map'](_0x28055b,function(_0x3b5818){if(_0x3b5818[_0x7200('0x3c')]!==_0x7200('0x4d')){var _0x3a53bd={};_0x3a53bd[_0x3b5818[_0x7200('0x38')]]={'$like':'%'+_0x478686[_0x7200('0x40')][_0x7200('0x4c')]+'%'};return _0x3a53bd;}})});}_0x36c346=_[_0x7200('0x4e')]({},_0x36c346,_0x478686[_0x7200('0x4f')]);var _0x4c646c={'where':_0x36c346['where']};return db[_0x7200('0x3b')][_0x7200('0x50')](_0x4c646c)[_0x7200('0x21')](function(_0x5284fe){_0xe60c1d['count']=_0x5284fe;if(_0x478686[_0x7200('0x40')][_0x7200('0x51')]){_0x36c346[_0x7200('0x52')]=[{'all':!![]}];}return db[_0x7200('0x3b')][_0x7200('0x53')](_0x36c346);})[_0x7200('0x21')](function(_0x11446f){_0xe60c1d[_0x7200('0x54')]=_0x11446f;return _0xe60c1d;})[_0x7200('0x21')](respondWithFilteredResult(_0x49a8f7,_0x36c346))[_0x7200('0x55')](handleError(_0x49a8f7,null));};exports[_0x7200('0x56')]=function(_0x53a9f4,_0x3da843){var _0x5510a9={'raw':![],'where':{'id':_0x53a9f4[_0x7200('0x57')]['id']}},_0x16eda8={};_0x16eda8[_0x7200('0x3e')]=_[_0x7200('0x41')](db[_0x7200('0x3b')][_0x7200('0x58')]);_0x16eda8[_0x7200('0x40')]=_['keys'](_0x53a9f4[_0x7200('0x40')]);_0x16eda8[_0x7200('0x42')]=_['intersection'](_0x16eda8['model'],_0x16eda8[_0x7200('0x40')]);_0x5510a9['attributes']=_[_0x7200('0x43')](_0x16eda8['model'],qs['fields'](_0x53a9f4[_0x7200('0x40')][_0x7200('0x45')]));_0x5510a9['attributes']=_0x5510a9[_0x7200('0x44')]['length']?_0x5510a9['attributes']:_0x16eda8[_0x7200('0x3e')];if(_0x53a9f4[_0x7200('0x40')]['includeAll']){_0x5510a9[_0x7200('0x52')]=[{'all':!![]}];}_0x5510a9=_[_0x7200('0x4e')]({},_0x5510a9,_0x53a9f4[_0x7200('0x4f')]);return db[_0x7200('0x3b')][_0x7200('0x59')](_0x5510a9)[_0x7200('0x21')](handleEntityNotFound(_0x3da843,null))[_0x7200('0x21')](respondWithResult(_0x3da843,null))[_0x7200('0x55')](handleError(_0x3da843,null));};exports[_0x7200('0x5a')]=function(_0x823455,_0x16450d){return db['DeskConfiguration'][_0x7200('0x5a')](_0x823455['body'],{})[_0x7200('0x21')](respondWithResult(_0x16450d,0xc9))[_0x7200('0x55')](handleError(_0x16450d,null));};exports[_0x7200('0x34')]=function(_0x209d7a,_0xdc42f4){if(_0x209d7a[_0x7200('0x5b')]['id']){delete _0x209d7a[_0x7200('0x5b')]['id'];}return db['DeskConfiguration']['find']({'where':{'id':_0x209d7a['params']['id']}})[_0x7200('0x21')](handleEntityNotFound(_0xdc42f4,null))[_0x7200('0x21')](saveUpdates(_0x209d7a[_0x7200('0x5b')],null))[_0x7200('0x21')](respondWithResult(_0xdc42f4,null))[_0x7200('0x55')](handleError(_0xdc42f4,null));};exports[_0x7200('0x35')]=function(_0x56daa0,_0x30d191){return db[_0x7200('0x3b')][_0x7200('0x59')]({'where':{'id':_0x56daa0['params']['id']}})['then'](handleEntityNotFound(_0x30d191,null))[_0x7200('0x21')](removeEntity(_0x30d191,null))['catch'](handleError(_0x30d191,null));};exports[_0x7200('0x5c')]=function(_0xae5d1,_0x4ea43f,_0x4eb8c7){var _0x5ce7be={};var _0x42b1b7={};var _0x29c43f;var _0x2eadae;return db['DeskConfiguration'][_0x7200('0x5d')]({'where':{'id':_0xae5d1[_0x7200('0x57')]['id']}})['then'](handleEntityNotFound(_0x4ea43f,null))['then'](function(_0x4ccf27){if(_0x4ccf27){_0x29c43f=_0x4ccf27;_0x42b1b7[_0x7200('0x3e')]=_[_0x7200('0x41')](db['DeskField'][_0x7200('0x58')]);_0x42b1b7[_0x7200('0x40')]=_['keys'](_0xae5d1[_0x7200('0x40')]);_0x42b1b7[_0x7200('0x42')]=_[_0x7200('0x43')](_0x42b1b7[_0x7200('0x3e')],_0x42b1b7[_0x7200('0x40')]);_0x5ce7be[_0x7200('0x44')]=_[_0x7200('0x43')](_0x42b1b7[_0x7200('0x3e')],qs[_0x7200('0x45')](_0xae5d1[_0x7200('0x40')]['fields']));_0x5ce7be[_0x7200('0x44')]=_0x5ce7be['attributes'][_0x7200('0x5e')]?_0x5ce7be[_0x7200('0x44')]:_0x42b1b7[_0x7200('0x3e')];_0x5ce7be['order']=qs[_0x7200('0x49')](_0xae5d1[_0x7200('0x40')]['sort']);_0x5ce7be[_0x7200('0x4a')]=qs['filters'](_['pick'](_0xae5d1[_0x7200('0x40')],_0x42b1b7[_0x7200('0x42')]));if(_0xae5d1[_0x7200('0x40')][_0x7200('0x4c')]){_0x5ce7be[_0x7200('0x4a')]=_[_0x7200('0x4e')](_0x5ce7be['where'],{'$or':_[_0x7200('0x3f')](_0x5ce7be['attributes'],function(_0x4015bb){var _0x4629f8={};_0x4629f8[_0x4015bb]={'$like':'%'+_0xae5d1['query'][_0x7200('0x4c')]+'%'};return _0x4629f8;})});}_0x5ce7be=_[_0x7200('0x4e')]({},_0x5ce7be,_0xae5d1[_0x7200('0x4f')]);return _0x29c43f['getFields'](_0x5ce7be);}})['then'](function(_0x1befed){if(_0x1befed){_0x2eadae=_0x1befed[_0x7200('0x5e')];if(!_0xae5d1[_0x7200('0x40')][_0x7200('0x46')](_0x7200('0x47'))){_0x5ce7be['limit']=qs[_0x7200('0x2f')](_0xae5d1[_0x7200('0x40')][_0x7200('0x2f')]);_0x5ce7be['offset']=qs['offset'](_0xae5d1[_0x7200('0x40')][_0x7200('0x2e')]);}return _0x29c43f[_0x7200('0x5c')](_0x5ce7be);}})[_0x7200('0x21')](function(_0x54902c){if(_0x54902c){return _0x54902c?{'count':_0x2eadae,'rows':_0x54902c}:null;}})[_0x7200('0x21')](respondWithResult(_0x4ea43f,null))['catch'](handleError(_0x4ea43f,null));};exports[_0x7200('0x5f')]=function(_0x45fc85,_0x58d952,_0x58dc3e){var _0x4f9f09={};var _0x2810ee={};var _0x3a0ae0;var _0x5ece29;return db[_0x7200('0x3b')][_0x7200('0x5d')]({'where':{'id':_0x45fc85[_0x7200('0x57')]['id']}})[_0x7200('0x21')](handleEntityNotFound(_0x58d952,null))[_0x7200('0x21')](function(_0x3aaac7){if(_0x3aaac7){_0x3a0ae0=_0x3aaac7;_0x2810ee[_0x7200('0x3e')]=_['keys'](db[_0x7200('0x60')][_0x7200('0x58')]);_0x2810ee['query']=_['keys'](_0x45fc85[_0x7200('0x40')]);_0x2810ee[_0x7200('0x42')]=_[_0x7200('0x43')](_0x2810ee[_0x7200('0x3e')],_0x2810ee[_0x7200('0x40')]);_0x4f9f09[_0x7200('0x44')]=_[_0x7200('0x43')](_0x2810ee[_0x7200('0x3e')],qs[_0x7200('0x45')](_0x45fc85[_0x7200('0x40')][_0x7200('0x45')]));_0x4f9f09[_0x7200('0x44')]=_0x4f9f09[_0x7200('0x44')][_0x7200('0x5e')]?_0x4f9f09['attributes']:_0x2810ee[_0x7200('0x3e')];_0x4f9f09[_0x7200('0x48')]=qs['sort'](_0x45fc85[_0x7200('0x40')][_0x7200('0x49')]);_0x4f9f09['where']=qs['filters'](_[_0x7200('0x4b')](_0x45fc85[_0x7200('0x40')],_0x2810ee[_0x7200('0x42')]));if(_0x45fc85['query'][_0x7200('0x4c')]){_0x4f9f09[_0x7200('0x4a')]=_['merge'](_0x4f9f09[_0x7200('0x4a')],{'$or':_[_0x7200('0x3f')](_0x4f9f09[_0x7200('0x44')],function(_0xa7ee0a){var _0x45d4c6={};_0x45d4c6[_0xa7ee0a]={'$like':'%'+_0x45fc85[_0x7200('0x40')][_0x7200('0x4c')]+'%'};return _0x45d4c6;})});}_0x4f9f09=_[_0x7200('0x4e')]({},_0x4f9f09,_0x45fc85[_0x7200('0x4f')]);return _0x3a0ae0['getSubjects'](_0x4f9f09);}})[_0x7200('0x21')](function(_0x764b0d){if(_0x764b0d){_0x5ece29=_0x764b0d[_0x7200('0x5e')];if(!_0x45fc85['query'][_0x7200('0x46')](_0x7200('0x47'))){_0x4f9f09[_0x7200('0x2f')]=qs[_0x7200('0x2f')](_0x45fc85[_0x7200('0x40')][_0x7200('0x2f')]);_0x4f9f09[_0x7200('0x2e')]=qs[_0x7200('0x2e')](_0x45fc85[_0x7200('0x40')]['offset']);}return _0x3a0ae0[_0x7200('0x5f')](_0x4f9f09);}})['then'](function(_0x5749af){if(_0x5749af){return _0x5749af?{'count':_0x5ece29,'rows':_0x5749af}:null;}})[_0x7200('0x21')](respondWithResult(_0x58d952,null))[_0x7200('0x55')](handleError(_0x58d952,null));};exports[_0x7200('0x61')]=function(_0x27222d,_0x325cb8,_0x3300eb){var _0x24fca7={};var _0x2c3cde={};var _0x3e9e41;var _0x226445;return db[_0x7200('0x3b')]['findOne']({'where':{'id':_0x27222d[_0x7200('0x57')]['id']}})[_0x7200('0x21')](handleEntityNotFound(_0x325cb8,null))[_0x7200('0x21')](function(_0x29ab17){if(_0x29ab17){_0x3e9e41=_0x29ab17;_0x2c3cde[_0x7200('0x3e')]=_[_0x7200('0x41')](db[_0x7200('0x60')][_0x7200('0x58')]);_0x2c3cde[_0x7200('0x40')]=_['keys'](_0x27222d[_0x7200('0x40')]);_0x2c3cde[_0x7200('0x42')]=_[_0x7200('0x43')](_0x2c3cde[_0x7200('0x3e')],_0x2c3cde[_0x7200('0x40')]);_0x24fca7[_0x7200('0x44')]=_[_0x7200('0x43')](_0x2c3cde['model'],qs['fields'](_0x27222d[_0x7200('0x40')][_0x7200('0x45')]));_0x24fca7[_0x7200('0x44')]=_0x24fca7[_0x7200('0x44')][_0x7200('0x5e')]?_0x24fca7[_0x7200('0x44')]:_0x2c3cde[_0x7200('0x3e')];_0x24fca7[_0x7200('0x48')]=qs[_0x7200('0x49')](_0x27222d['query'][_0x7200('0x49')]);_0x24fca7[_0x7200('0x4a')]=qs[_0x7200('0x42')](_['pick'](_0x27222d[_0x7200('0x40')],_0x2c3cde[_0x7200('0x42')]));if(_0x27222d[_0x7200('0x40')][_0x7200('0x4c')]){_0x24fca7[_0x7200('0x4a')]=_[_0x7200('0x4e')](_0x24fca7[_0x7200('0x4a')],{'$or':_[_0x7200('0x3f')](_0x24fca7[_0x7200('0x44')],function(_0x3cab6d){var _0x111fc0={};_0x111fc0[_0x3cab6d]={'$like':'%'+_0x27222d[_0x7200('0x40')][_0x7200('0x4c')]+'%'};return _0x111fc0;})});}_0x24fca7=_[_0x7200('0x4e')]({},_0x24fca7,_0x27222d[_0x7200('0x4f')]);return _0x3e9e41[_0x7200('0x61')](_0x24fca7);}})[_0x7200('0x21')](function(_0x359827){if(_0x359827){_0x226445=_0x359827[_0x7200('0x5e')];if(!_0x27222d[_0x7200('0x40')][_0x7200('0x46')](_0x7200('0x47'))){_0x24fca7[_0x7200('0x2f')]=qs[_0x7200('0x2f')](_0x27222d[_0x7200('0x40')]['limit']);_0x24fca7[_0x7200('0x2e')]=qs[_0x7200('0x2e')](_0x27222d[_0x7200('0x40')]['offset']);}return _0x3e9e41[_0x7200('0x61')](_0x24fca7);}})['then'](function(_0x429d65){if(_0x429d65){return _0x429d65?{'count':_0x226445,'rows':_0x429d65}:null;}})['then'](respondWithResult(_0x325cb8,null))['catch'](handleError(_0x325cb8,null));};exports[_0x7200('0x62')]=function(_0x3b03db,_0x47fe06,_0x434307){var _0x29c553={};var _0x16ca00={};var _0x4ef21f;var _0x26a6e6;return db[_0x7200('0x3b')][_0x7200('0x5d')]({'where':{'id':_0x3b03db[_0x7200('0x57')]['id']}})[_0x7200('0x21')](handleEntityNotFound(_0x47fe06,null))[_0x7200('0x21')](function(_0xff36f8){if(_0xff36f8){_0x4ef21f=_0xff36f8;_0x16ca00[_0x7200('0x3e')]=_[_0x7200('0x41')](db['Tag']['rawAttributes']);_0x16ca00['query']=_[_0x7200('0x41')](_0x3b03db[_0x7200('0x40')]);_0x16ca00[_0x7200('0x42')]=_[_0x7200('0x43')](_0x16ca00['model'],_0x16ca00[_0x7200('0x40')]);_0x29c553['attributes']=_[_0x7200('0x43')](_0x16ca00['model'],qs[_0x7200('0x45')](_0x3b03db[_0x7200('0x40')][_0x7200('0x45')]));_0x29c553[_0x7200('0x44')]=_0x29c553[_0x7200('0x44')][_0x7200('0x5e')]?_0x29c553['attributes']:_0x16ca00[_0x7200('0x3e')];_0x29c553[_0x7200('0x48')]=qs[_0x7200('0x49')](_0x3b03db[_0x7200('0x40')]['sort']);_0x29c553['where']=qs['filters'](_[_0x7200('0x4b')](_0x3b03db['query'],_0x16ca00[_0x7200('0x42')]));if(_0x3b03db[_0x7200('0x40')]['filter']){_0x29c553['where']=_[_0x7200('0x4e')](_0x29c553['where'],{'$or':_[_0x7200('0x3f')](_0x29c553[_0x7200('0x44')],function(_0x13a5e7){var _0x5205c2={};_0x5205c2[_0x13a5e7]={'$like':'%'+_0x3b03db[_0x7200('0x40')][_0x7200('0x4c')]+'%'};return _0x5205c2;})});}_0x29c553=_[_0x7200('0x4e')]({},_0x29c553,_0x3b03db[_0x7200('0x4f')]);return _0x4ef21f[_0x7200('0x62')](_0x29c553);}})[_0x7200('0x21')](function(_0x28b2e2){if(_0x28b2e2){_0x26a6e6=_0x28b2e2[_0x7200('0x5e')];if(!_0x3b03db[_0x7200('0x40')][_0x7200('0x46')](_0x7200('0x47'))){_0x29c553[_0x7200('0x2f')]=qs['limit'](_0x3b03db['query']['limit']);_0x29c553['offset']=qs['offset'](_0x3b03db[_0x7200('0x40')][_0x7200('0x2e')]);}return _0x4ef21f[_0x7200('0x62')](_0x29c553);}})[_0x7200('0x21')](function(_0x406917){if(_0x406917){return _0x406917?{'count':_0x26a6e6,'rows':_0x406917}:null;}})[_0x7200('0x21')](respondWithResult(_0x47fe06,null))[_0x7200('0x55')](handleError(_0x47fe06,null));};exports['setTags']=function(_0x3e59e8,_0x555718,_0x19460a){if(_0x3e59e8[_0x7200('0x5b')]['id']){delete _0x3e59e8[_0x7200('0x5b')]['id'];}return db[_0x7200('0x3b')][_0x7200('0x5d')]({'where':{'id':_0x3e59e8[_0x7200('0x57')]['id']}})['then'](handleEntityNotFound(_0x555718,null))[_0x7200('0x21')](function(_0x118825){if(_0x118825){return _0x118825['setTags'](_0x3e59e8[_0x7200('0x5b')][_0x7200('0x63')]||[]);}return null;})[_0x7200('0x21')](respondWithResult(_0x555718,null))[_0x7200('0x55')](handleError(_0x555718,null));}; \ No newline at end of file +var _0xa683=['Tag','setTags','ids','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','jayson/promise','client','http','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','DeskConfiguration,\x20%s,\x20%s','message','result','catch','status','count','offset','limit','set','Content-Range','json','apply','reject','save','update','end','sendStatus','stack','name','send','index','DeskConfiguration','rawAttributes','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','findAll','rows','show','include','find','create','body','destroy','findOne','params','DeskField','map','getFields','getSubjects','getDescriptions'];(function(_0x5a633a,_0x4e8830){var _0x4a9df=function(_0x1a6732){while(--_0x1a6732){_0x5a633a['push'](_0x5a633a['shift']());}};_0x4a9df(++_0x4e8830);}(_0xa683,0x18b));var _0x3a68=function(_0x137b74,_0x234153){_0x137b74=_0x137b74-0x0;var _0x4ada61=_0xa683[_0x137b74];return _0x4ada61;};'use strict';var pdf=require(_0x3a68('0x0'));var emlformat=require(_0x3a68('0x1'));var rimraf=require(_0x3a68('0x2'));var zipdir=require(_0x3a68('0x3'));var jsonpatch=require(_0x3a68('0x4'));var rp=require(_0x3a68('0x5'));var moment=require('moment');var BPromise=require(_0x3a68('0x6'));var Mustache=require(_0x3a68('0x7'));var util=require(_0x3a68('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x3a68('0x9'));var ejs=require(_0x3a68('0xa'));var fs=require('fs');var _=require(_0x3a68('0xb'));var squel=require(_0x3a68('0xc'));var crypto=require(_0x3a68('0xd'));var jsforce=require(_0x3a68('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x3a68('0x9'));var querystring=require('querystring');var Papa=require(_0x3a68('0xf'));var Redis=require(_0x3a68('0x10'));var authService=require(_0x3a68('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x3a68('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3a68('0x13'))('api');var utils=require(_0x3a68('0x14'));var config=require(_0x3a68('0x15'));var db=require('../../mysqldb')['db'];var jayson=require(_0x3a68('0x16'));var client=jayson[_0x3a68('0x17')][_0x3a68('0x18')]({'port':0x232a});function checkPasswordPattern(_0x32f46e,_0x557cc6,_0x3f42b6){if(_0x3f42b6){var _0x2f25d1=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2f25d1['test'](_0x557cc6)){return _0x32f46e;}else{throw new db[(_0x3a68('0x19'))][(_0x3a68('0x1a'))](_0x3a68('0x1b'));}}else{return _0x32f46e;}}function respondWithRpcPromise(_0x190aa4,_0x4ce6ef,_0x4be432,_0x3a31e2){return new BPromise(function(_0x5b59fa,_0xc2ba25){var _0x776ef6=_0x3a31e2||client;return _0x776ef6[_0x3a68('0x1c')](_0x190aa4,_0x4be432)[_0x3a68('0x1d')](function(_0x43912b){logger[_0x3a68('0x1e')]('DeskConfiguration,\x20%s,\x20%s',_0x4ce6ef,_0x3a68('0x1f'));logger[_0x3a68('0x20')](_0x3a68('0x21'),_0x4ce6ef,_0x3a68('0x1f'),JSON['stringify'](_0x43912b));if(_0x43912b['error']){if(_0x43912b[_0x3a68('0x22')][_0x3a68('0x23')]===0x1f4){logger['error'](_0x3a68('0x24'),_0x4ce6ef,_0x43912b[_0x3a68('0x22')][_0x3a68('0x25')]);return _0xc2ba25(_0x43912b[_0x3a68('0x22')][_0x3a68('0x25')]);}logger[_0x3a68('0x22')](_0x3a68('0x24'),_0x4ce6ef,_0x43912b['error'][_0x3a68('0x25')]);return _0x5b59fa(_0x43912b['error'][_0x3a68('0x25')]);}else{logger[_0x3a68('0x1e')](_0x3a68('0x24'),_0x4ce6ef,_0x3a68('0x1f'));_0x5b59fa(_0x43912b[_0x3a68('0x26')][_0x3a68('0x25')]);}})[_0x3a68('0x27')](function(_0x4c6926){logger[_0x3a68('0x22')](_0x3a68('0x24'),_0x4ce6ef,_0x4c6926);_0xc2ba25(_0x4c6926);});});}function respondWithStatusCode(_0x2acf6b,_0x4fde75){_0x4fde75=_0x4fde75||0xcc;return function(_0x49b46c){if(_0x49b46c){return _0x2acf6b['sendStatus'](_0x4fde75);}return _0x2acf6b[_0x3a68('0x28')](_0x4fde75)['end']();};}function respondWithResult(_0x4a842b,_0x5201b3){_0x5201b3=_0x5201b3||0xc8;return function(_0x147a8c){if(_0x147a8c){return _0x4a842b[_0x3a68('0x28')](_0x5201b3)['json'](_0x147a8c);}};}function respondWithFilteredResult(_0x378916,_0x509297){return function(_0x501f1b){if(_0x501f1b){var _0x51719b=_0x501f1b[_0x3a68('0x29')],_0x5f1673=_0x509297['offset'],_0x4aa3d2=_0x509297[_0x3a68('0x2a')]+_0x509297[_0x3a68('0x2b')],_0x3630e9;if(_0x4aa3d2>=_0x51719b){_0x4aa3d2=_0x51719b;_0x3630e9=0xc8;}else{_0x3630e9=0xce;}_0x378916[_0x3a68('0x28')](_0x3630e9);return _0x378916[_0x3a68('0x2c')](_0x3a68('0x2d'),_0x5f1673+'-'+_0x4aa3d2+'/'+_0x51719b)[_0x3a68('0x2e')](_0x501f1b);}return null;};}function patchUpdates(_0x2f323b){return function(_0x4acc2d){try{jsonpatch[_0x3a68('0x2f')](_0x4acc2d,_0x2f323b,!![]);}catch(_0x170f19){return BPromise[_0x3a68('0x30')](_0x170f19);}return _0x4acc2d[_0x3a68('0x31')]();};}function saveUpdates(_0xd55b1e,_0x534294){return function(_0x238fba){if(_0x238fba){return _0x238fba[_0x3a68('0x32')](_0xd55b1e)[_0x3a68('0x1d')](function(_0x4a9a6f){return _0x4a9a6f;});}return null;};}function removeEntity(_0xc0da3b,_0x45ef32){return function(_0x2021c1){if(_0x2021c1){return _0x2021c1['destroy']()['then'](function(){_0xc0da3b['status'](0xcc)[_0x3a68('0x33')]();});}};}function handleEntityNotFound(_0xf0047,_0x49bd63){return function(_0x486c7f){if(!_0x486c7f){_0xf0047[_0x3a68('0x34')](0x194);}return _0x486c7f;};}function handleError(_0xde8880,_0x5913fd){_0x5913fd=_0x5913fd||0x1f4;return function(_0x27619b){logger[_0x3a68('0x22')](_0x27619b[_0x3a68('0x35')]);if(_0x27619b[_0x3a68('0x36')]){delete _0x27619b[_0x3a68('0x36')];}_0xde8880[_0x3a68('0x28')](_0x5913fd)[_0x3a68('0x37')](_0x27619b);};}exports[_0x3a68('0x38')]=function(_0x53d437,_0x1f1efc){var _0x2e7a7d={},_0x2ec486={},_0x21c9a3={'count':0x0,'rows':[]};var _0x51d9ff=_['map'](db[_0x3a68('0x39')][_0x3a68('0x3a')],function(_0x51924f){return{'name':_0x51924f['fieldName'],'type':_0x51924f['type'][_0x3a68('0x3b')]};});_0x2ec486['model']=_['map'](_0x51d9ff,_0x3a68('0x36'));_0x2ec486[_0x3a68('0x3c')]=_[_0x3a68('0x3d')](_0x53d437[_0x3a68('0x3c')]);_0x2ec486[_0x3a68('0x3e')]=_[_0x3a68('0x3f')](_0x2ec486[_0x3a68('0x40')],_0x2ec486[_0x3a68('0x3c')]);_0x2e7a7d['attributes']=_['intersection'](_0x2ec486[_0x3a68('0x40')],qs[_0x3a68('0x41')](_0x53d437[_0x3a68('0x3c')]['fields']));_0x2e7a7d[_0x3a68('0x42')]=_0x2e7a7d[_0x3a68('0x42')][_0x3a68('0x43')]?_0x2e7a7d[_0x3a68('0x42')]:_0x2ec486[_0x3a68('0x40')];if(!_0x53d437[_0x3a68('0x3c')][_0x3a68('0x44')](_0x3a68('0x45'))){_0x2e7a7d['limit']=qs[_0x3a68('0x2b')](_0x53d437[_0x3a68('0x3c')][_0x3a68('0x2b')]);_0x2e7a7d[_0x3a68('0x2a')]=qs['offset'](_0x53d437[_0x3a68('0x3c')][_0x3a68('0x2a')]);}_0x2e7a7d[_0x3a68('0x46')]=qs[_0x3a68('0x47')](_0x53d437['query'][_0x3a68('0x47')]);_0x2e7a7d['where']=qs[_0x3a68('0x3e')](_[_0x3a68('0x48')](_0x53d437[_0x3a68('0x3c')],_0x2ec486[_0x3a68('0x3e')]));if(_0x53d437[_0x3a68('0x3c')][_0x3a68('0x49')]){_0x2e7a7d[_0x3a68('0x4a')]=_[_0x3a68('0x4b')](_0x2e7a7d[_0x3a68('0x4a')],{'$or':_['map'](_0x51d9ff,function(_0x578039){if(_0x578039[_0x3a68('0x4c')]!==_0x3a68('0x4d')){var _0x505dd2={};_0x505dd2[_0x578039[_0x3a68('0x36')]]={'$like':'%'+_0x53d437[_0x3a68('0x3c')][_0x3a68('0x49')]+'%'};return _0x505dd2;}})});}_0x2e7a7d=_['merge']({},_0x2e7a7d,_0x53d437[_0x3a68('0x4e')]);var _0x22a2a7={'where':_0x2e7a7d[_0x3a68('0x4a')]};return db[_0x3a68('0x39')]['count'](_0x22a2a7)[_0x3a68('0x1d')](function(_0x3d65ce){_0x21c9a3[_0x3a68('0x29')]=_0x3d65ce;if(_0x53d437[_0x3a68('0x3c')][_0x3a68('0x4f')]){_0x2e7a7d['include']=[{'all':!![]}];}return db[_0x3a68('0x39')][_0x3a68('0x50')](_0x2e7a7d);})[_0x3a68('0x1d')](function(_0x510819){_0x21c9a3[_0x3a68('0x51')]=_0x510819;return _0x21c9a3;})[_0x3a68('0x1d')](respondWithFilteredResult(_0x1f1efc,_0x2e7a7d))[_0x3a68('0x27')](handleError(_0x1f1efc,null));};exports[_0x3a68('0x52')]=function(_0x5989cf,_0x55c3d6){var _0x4de319={'raw':![],'where':{'id':_0x5989cf['params']['id']}},_0x8a8402={};_0x8a8402[_0x3a68('0x40')]=_['keys'](db[_0x3a68('0x39')][_0x3a68('0x3a')]);_0x8a8402['query']=_[_0x3a68('0x3d')](_0x5989cf[_0x3a68('0x3c')]);_0x8a8402['filters']=_[_0x3a68('0x3f')](_0x8a8402[_0x3a68('0x40')],_0x8a8402['query']);_0x4de319[_0x3a68('0x42')]=_[_0x3a68('0x3f')](_0x8a8402['model'],qs['fields'](_0x5989cf[_0x3a68('0x3c')][_0x3a68('0x41')]));_0x4de319['attributes']=_0x4de319['attributes'][_0x3a68('0x43')]?_0x4de319['attributes']:_0x8a8402['model'];if(_0x5989cf[_0x3a68('0x3c')][_0x3a68('0x4f')]){_0x4de319[_0x3a68('0x53')]=[{'all':!![]}];}_0x4de319=_[_0x3a68('0x4b')]({},_0x4de319,_0x5989cf[_0x3a68('0x4e')]);return db['DeskConfiguration'][_0x3a68('0x54')](_0x4de319)[_0x3a68('0x1d')](handleEntityNotFound(_0x55c3d6,null))['then'](respondWithResult(_0x55c3d6,null))['catch'](handleError(_0x55c3d6,null));};exports['create']=function(_0x5b5a88,_0x4861c0){return db['DeskConfiguration'][_0x3a68('0x55')](_0x5b5a88[_0x3a68('0x56')],{})['then'](respondWithResult(_0x4861c0,0xc9))[_0x3a68('0x27')](handleError(_0x4861c0,null));};exports[_0x3a68('0x32')]=function(_0x8a1300,_0x34db80){if(_0x8a1300[_0x3a68('0x56')]['id']){delete _0x8a1300['body']['id'];}return db['DeskConfiguration']['find']({'where':{'id':_0x8a1300['params']['id']}})['then'](handleEntityNotFound(_0x34db80,null))[_0x3a68('0x1d')](saveUpdates(_0x8a1300[_0x3a68('0x56')],null))[_0x3a68('0x1d')](respondWithResult(_0x34db80,null))[_0x3a68('0x27')](handleError(_0x34db80,null));};exports[_0x3a68('0x57')]=function(_0x5dee0c,_0x529770){return db[_0x3a68('0x39')]['find']({'where':{'id':_0x5dee0c['params']['id']}})[_0x3a68('0x1d')](handleEntityNotFound(_0x529770,null))[_0x3a68('0x1d')](removeEntity(_0x529770,null))['catch'](handleError(_0x529770,null));};exports['getFields']=function(_0xb6ccda,_0x27b39e,_0x2984ba){var _0xe5ea5f={};var _0x3b3fd0={};var _0x5304cc;var _0x5c89ae;return db[_0x3a68('0x39')][_0x3a68('0x58')]({'where':{'id':_0xb6ccda[_0x3a68('0x59')]['id']}})['then'](handleEntityNotFound(_0x27b39e,null))[_0x3a68('0x1d')](function(_0x52699a){if(_0x52699a){_0x5304cc=_0x52699a;_0x3b3fd0[_0x3a68('0x40')]=_[_0x3a68('0x3d')](db[_0x3a68('0x5a')][_0x3a68('0x3a')]);_0x3b3fd0[_0x3a68('0x3c')]=_[_0x3a68('0x3d')](_0xb6ccda[_0x3a68('0x3c')]);_0x3b3fd0['filters']=_[_0x3a68('0x3f')](_0x3b3fd0['model'],_0x3b3fd0[_0x3a68('0x3c')]);_0xe5ea5f['attributes']=_[_0x3a68('0x3f')](_0x3b3fd0[_0x3a68('0x40')],qs[_0x3a68('0x41')](_0xb6ccda[_0x3a68('0x3c')][_0x3a68('0x41')]));_0xe5ea5f['attributes']=_0xe5ea5f[_0x3a68('0x42')][_0x3a68('0x43')]?_0xe5ea5f[_0x3a68('0x42')]:_0x3b3fd0[_0x3a68('0x40')];_0xe5ea5f[_0x3a68('0x46')]=qs[_0x3a68('0x47')](_0xb6ccda[_0x3a68('0x3c')][_0x3a68('0x47')]);_0xe5ea5f['where']=qs[_0x3a68('0x3e')](_[_0x3a68('0x48')](_0xb6ccda[_0x3a68('0x3c')],_0x3b3fd0[_0x3a68('0x3e')]));if(_0xb6ccda['query'][_0x3a68('0x49')]){_0xe5ea5f['where']=_['merge'](_0xe5ea5f[_0x3a68('0x4a')],{'$or':_[_0x3a68('0x5b')](_0xe5ea5f[_0x3a68('0x42')],function(_0x4e36a2){var _0x2b5b77={};_0x2b5b77[_0x4e36a2]={'$like':'%'+_0xb6ccda[_0x3a68('0x3c')][_0x3a68('0x49')]+'%'};return _0x2b5b77;})});}_0xe5ea5f=_['merge']({},_0xe5ea5f,_0xb6ccda['options']);return _0x5304cc[_0x3a68('0x5c')](_0xe5ea5f);}})[_0x3a68('0x1d')](function(_0x1a9c6c){if(_0x1a9c6c){_0x5c89ae=_0x1a9c6c[_0x3a68('0x43')];if(!_0xb6ccda[_0x3a68('0x3c')]['hasOwnProperty']('nolimit')){_0xe5ea5f['limit']=qs['limit'](_0xb6ccda[_0x3a68('0x3c')][_0x3a68('0x2b')]);_0xe5ea5f[_0x3a68('0x2a')]=qs['offset'](_0xb6ccda[_0x3a68('0x3c')][_0x3a68('0x2a')]);}return _0x5304cc[_0x3a68('0x5c')](_0xe5ea5f);}})['then'](function(_0x2c4068){if(_0x2c4068){return _0x2c4068?{'count':_0x5c89ae,'rows':_0x2c4068}:null;}})[_0x3a68('0x1d')](respondWithResult(_0x27b39e,null))['catch'](handleError(_0x27b39e,null));};exports[_0x3a68('0x5d')]=function(_0x527e8c,_0x22285e,_0x22585a){var _0x166642={};var _0x40eb4c={};var _0x56334c;var _0x4d1f6a;return db[_0x3a68('0x39')][_0x3a68('0x58')]({'where':{'id':_0x527e8c[_0x3a68('0x59')]['id']}})[_0x3a68('0x1d')](handleEntityNotFound(_0x22285e,null))[_0x3a68('0x1d')](function(_0x48ae2d){if(_0x48ae2d){_0x56334c=_0x48ae2d;_0x40eb4c[_0x3a68('0x40')]=_['keys'](db[_0x3a68('0x5a')][_0x3a68('0x3a')]);_0x40eb4c['query']=_[_0x3a68('0x3d')](_0x527e8c['query']);_0x40eb4c[_0x3a68('0x3e')]=_['intersection'](_0x40eb4c['model'],_0x40eb4c[_0x3a68('0x3c')]);_0x166642[_0x3a68('0x42')]=_[_0x3a68('0x3f')](_0x40eb4c[_0x3a68('0x40')],qs[_0x3a68('0x41')](_0x527e8c[_0x3a68('0x3c')][_0x3a68('0x41')]));_0x166642[_0x3a68('0x42')]=_0x166642[_0x3a68('0x42')][_0x3a68('0x43')]?_0x166642['attributes']:_0x40eb4c[_0x3a68('0x40')];_0x166642[_0x3a68('0x46')]=qs[_0x3a68('0x47')](_0x527e8c[_0x3a68('0x3c')]['sort']);_0x166642[_0x3a68('0x4a')]=qs['filters'](_[_0x3a68('0x48')](_0x527e8c[_0x3a68('0x3c')],_0x40eb4c[_0x3a68('0x3e')]));if(_0x527e8c['query']['filter']){_0x166642[_0x3a68('0x4a')]=_[_0x3a68('0x4b')](_0x166642[_0x3a68('0x4a')],{'$or':_[_0x3a68('0x5b')](_0x166642['attributes'],function(_0x37ffee){var _0x148f9c={};_0x148f9c[_0x37ffee]={'$like':'%'+_0x527e8c['query'][_0x3a68('0x49')]+'%'};return _0x148f9c;})});}_0x166642=_[_0x3a68('0x4b')]({},_0x166642,_0x527e8c[_0x3a68('0x4e')]);return _0x56334c['getSubjects'](_0x166642);}})['then'](function(_0x30ad39){if(_0x30ad39){_0x4d1f6a=_0x30ad39[_0x3a68('0x43')];if(!_0x527e8c[_0x3a68('0x3c')][_0x3a68('0x44')](_0x3a68('0x45'))){_0x166642[_0x3a68('0x2b')]=qs['limit'](_0x527e8c[_0x3a68('0x3c')][_0x3a68('0x2b')]);_0x166642[_0x3a68('0x2a')]=qs[_0x3a68('0x2a')](_0x527e8c[_0x3a68('0x3c')][_0x3a68('0x2a')]);}return _0x56334c[_0x3a68('0x5d')](_0x166642);}})[_0x3a68('0x1d')](function(_0x26e478){if(_0x26e478){return _0x26e478?{'count':_0x4d1f6a,'rows':_0x26e478}:null;}})[_0x3a68('0x1d')](respondWithResult(_0x22285e,null))[_0x3a68('0x27')](handleError(_0x22285e,null));};exports['getDescriptions']=function(_0x28f58f,_0x337c7d,_0x2e51b9){var _0x16d4ae={};var _0x2e5337={};var _0x354b18;var _0x6e271e;return db[_0x3a68('0x39')][_0x3a68('0x58')]({'where':{'id':_0x28f58f[_0x3a68('0x59')]['id']}})[_0x3a68('0x1d')](handleEntityNotFound(_0x337c7d,null))['then'](function(_0x4af9e7){if(_0x4af9e7){_0x354b18=_0x4af9e7;_0x2e5337[_0x3a68('0x40')]=_[_0x3a68('0x3d')](db['DeskField']['rawAttributes']);_0x2e5337[_0x3a68('0x3c')]=_[_0x3a68('0x3d')](_0x28f58f[_0x3a68('0x3c')]);_0x2e5337[_0x3a68('0x3e')]=_[_0x3a68('0x3f')](_0x2e5337['model'],_0x2e5337[_0x3a68('0x3c')]);_0x16d4ae[_0x3a68('0x42')]=_['intersection'](_0x2e5337[_0x3a68('0x40')],qs[_0x3a68('0x41')](_0x28f58f[_0x3a68('0x3c')]['fields']));_0x16d4ae['attributes']=_0x16d4ae[_0x3a68('0x42')][_0x3a68('0x43')]?_0x16d4ae[_0x3a68('0x42')]:_0x2e5337[_0x3a68('0x40')];_0x16d4ae[_0x3a68('0x46')]=qs[_0x3a68('0x47')](_0x28f58f[_0x3a68('0x3c')][_0x3a68('0x47')]);_0x16d4ae[_0x3a68('0x4a')]=qs['filters'](_[_0x3a68('0x48')](_0x28f58f[_0x3a68('0x3c')],_0x2e5337['filters']));if(_0x28f58f[_0x3a68('0x3c')][_0x3a68('0x49')]){_0x16d4ae[_0x3a68('0x4a')]=_[_0x3a68('0x4b')](_0x16d4ae[_0x3a68('0x4a')],{'$or':_[_0x3a68('0x5b')](_0x16d4ae[_0x3a68('0x42')],function(_0x48cc88){var _0x2369ba={};_0x2369ba[_0x48cc88]={'$like':'%'+_0x28f58f[_0x3a68('0x3c')][_0x3a68('0x49')]+'%'};return _0x2369ba;})});}_0x16d4ae=_[_0x3a68('0x4b')]({},_0x16d4ae,_0x28f58f[_0x3a68('0x4e')]);return _0x354b18[_0x3a68('0x5e')](_0x16d4ae);}})['then'](function(_0x2813f3){if(_0x2813f3){_0x6e271e=_0x2813f3[_0x3a68('0x43')];if(!_0x28f58f[_0x3a68('0x3c')][_0x3a68('0x44')]('nolimit')){_0x16d4ae[_0x3a68('0x2b')]=qs[_0x3a68('0x2b')](_0x28f58f[_0x3a68('0x3c')]['limit']);_0x16d4ae['offset']=qs[_0x3a68('0x2a')](_0x28f58f[_0x3a68('0x3c')][_0x3a68('0x2a')]);}return _0x354b18[_0x3a68('0x5e')](_0x16d4ae);}})[_0x3a68('0x1d')](function(_0x51eca5){if(_0x51eca5){return _0x51eca5?{'count':_0x6e271e,'rows':_0x51eca5}:null;}})[_0x3a68('0x1d')](respondWithResult(_0x337c7d,null))['catch'](handleError(_0x337c7d,null));};exports['getTags']=function(_0x20ee62,_0x4e9e36,_0x3b71e3){var _0x401fbf={};var _0xbdbad7={};var _0x4dde21;var _0x3c6568;return db[_0x3a68('0x39')]['findOne']({'where':{'id':_0x20ee62[_0x3a68('0x59')]['id']}})[_0x3a68('0x1d')](handleEntityNotFound(_0x4e9e36,null))[_0x3a68('0x1d')](function(_0x1a5f24){if(_0x1a5f24){_0x4dde21=_0x1a5f24;_0xbdbad7[_0x3a68('0x40')]=_['keys'](db[_0x3a68('0x5f')][_0x3a68('0x3a')]);_0xbdbad7[_0x3a68('0x3c')]=_[_0x3a68('0x3d')](_0x20ee62[_0x3a68('0x3c')]);_0xbdbad7[_0x3a68('0x3e')]=_['intersection'](_0xbdbad7[_0x3a68('0x40')],_0xbdbad7[_0x3a68('0x3c')]);_0x401fbf[_0x3a68('0x42')]=_['intersection'](_0xbdbad7['model'],qs[_0x3a68('0x41')](_0x20ee62['query']['fields']));_0x401fbf[_0x3a68('0x42')]=_0x401fbf[_0x3a68('0x42')][_0x3a68('0x43')]?_0x401fbf[_0x3a68('0x42')]:_0xbdbad7['model'];_0x401fbf[_0x3a68('0x46')]=qs[_0x3a68('0x47')](_0x20ee62[_0x3a68('0x3c')][_0x3a68('0x47')]);_0x401fbf['where']=qs[_0x3a68('0x3e')](_['pick'](_0x20ee62[_0x3a68('0x3c')],_0xbdbad7['filters']));if(_0x20ee62['query'][_0x3a68('0x49')]){_0x401fbf['where']=_[_0x3a68('0x4b')](_0x401fbf['where'],{'$or':_[_0x3a68('0x5b')](_0x401fbf[_0x3a68('0x42')],function(_0x576337){var _0x3bdf4f={};_0x3bdf4f[_0x576337]={'$like':'%'+_0x20ee62[_0x3a68('0x3c')][_0x3a68('0x49')]+'%'};return _0x3bdf4f;})});}_0x401fbf=_[_0x3a68('0x4b')]({},_0x401fbf,_0x20ee62[_0x3a68('0x4e')]);return _0x4dde21['getTags'](_0x401fbf);}})[_0x3a68('0x1d')](function(_0xae24e9){if(_0xae24e9){_0x3c6568=_0xae24e9[_0x3a68('0x43')];if(!_0x20ee62[_0x3a68('0x3c')][_0x3a68('0x44')]('nolimit')){_0x401fbf['limit']=qs[_0x3a68('0x2b')](_0x20ee62[_0x3a68('0x3c')][_0x3a68('0x2b')]);_0x401fbf['offset']=qs[_0x3a68('0x2a')](_0x20ee62[_0x3a68('0x3c')][_0x3a68('0x2a')]);}return _0x4dde21['getTags'](_0x401fbf);}})[_0x3a68('0x1d')](function(_0x3e2579){if(_0x3e2579){return _0x3e2579?{'count':_0x3c6568,'rows':_0x3e2579}:null;}})[_0x3a68('0x1d')](respondWithResult(_0x4e9e36,null))[_0x3a68('0x27')](handleError(_0x4e9e36,null));};exports[_0x3a68('0x60')]=function(_0x255636,_0x393fba,_0x357343){if(_0x255636[_0x3a68('0x56')]['id']){delete _0x255636[_0x3a68('0x56')]['id'];}return db[_0x3a68('0x39')][_0x3a68('0x58')]({'where':{'id':_0x255636[_0x3a68('0x59')]['id']}})[_0x3a68('0x1d')](handleEntityNotFound(_0x393fba,null))[_0x3a68('0x1d')](function(_0x1c5720){if(_0x1c5720){return _0x1c5720[_0x3a68('0x60')](_0x255636[_0x3a68('0x56')][_0x3a68('0x61')]||[]);}return null;})[_0x3a68('0x1d')](respondWithResult(_0x393fba,null))[_0x3a68('0x27')](handleError(_0x393fba,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index b64e6e1..587fcb9 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 _0x3710=['request-promise','path','../../config/environment','exports','int_desk_configurations','lodash','util','../../config/logger','api'];(function(_0x549f40,_0x20c9dc){var _0x43e44f=function(_0xac3d71){while(--_0xac3d71){_0x549f40['push'](_0x549f40['shift']());}};_0x43e44f(++_0x20c9dc);}(_0x3710,0x1a3));var _0x0371=function(_0x1466a3,_0x4d3c05){_0x1466a3=_0x1466a3-0x0;var _0x4e19a7=_0x3710[_0x1466a3];return _0x4e19a7;};'use strict';var _=require(_0x0371('0x0'));var util=require(_0x0371('0x1'));var logger=require(_0x0371('0x2'))(_0x0371('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x0371('0x4'));var fs=require('fs');var path=require(_0x0371('0x5'));var rimraf=require('rimraf');var config=require(_0x0371('0x6'));var attributes=require('./intDeskConfiguration.attributes');module[_0x0371('0x7')]=function(_0x2e271f,_0x3f52ae){return _0x2e271f['define']('DeskConfiguration',attributes,{'tableName':_0x0371('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x90b8=['exports','define','DeskConfiguration','int_desk_configurations','lodash','util','api','moment','request-promise','rimraf','../../config/environment'];(function(_0x1a3a96,_0xc64c12){var _0x5a6016=function(_0x3e981c){while(--_0x3e981c){_0x1a3a96['push'](_0x1a3a96['shift']());}};_0x5a6016(++_0xc64c12);}(_0x90b8,0x1a6));var _0x890b=function(_0x3b0c9d,_0x3ddeb5){_0x3b0c9d=_0x3b0c9d-0x0;var _0xcfc8d7=_0x90b8[_0x3b0c9d];return _0xcfc8d7;};'use strict';var _=require(_0x890b('0x0'));var util=require(_0x890b('0x1'));var logger=require('../../config/logger')(_0x890b('0x2'));var moment=require(_0x890b('0x3'));var BPromise=require('bluebird');var rp=require(_0x890b('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x890b('0x5'));var config=require(_0x890b('0x6'));var attributes=require('./intDeskConfiguration.attributes');module[_0x890b('0x7')]=function(_0x2f3fb5,_0x1ea361){return _0x2f3fb5[_0x890b('0x8')](_0x890b('0x9'),attributes,{'tableName':_0x890b('0xa'),'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 cf01b55..3e0c059 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 _0xffe1=['util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','then','info','DeskConfiguration,\x20%s,\x20%s','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash'];(function(_0x57e1b7,_0x5d0871){var _0x52ff18=function(_0x4e740f){while(--_0x4e740f){_0x57e1b7['push'](_0x57e1b7['shift']());}};_0x52ff18(++_0x5d0871);}(_0xffe1,0x175));var _0x1ffe=function(_0x211d75,_0x1cbe20){_0x211d75=_0x211d75-0x0;var _0x3ec331=_0xffe1[_0x211d75];return _0x3ec331;};'use strict';var _=require(_0x1ffe('0x0'));var util=require(_0x1ffe('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x1ffe('0x2'));var fs=require('fs');var Redis=require(_0x1ffe('0x3'));var db=require(_0x1ffe('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x1ffe('0x5'))(_0x1ffe('0x6'));var config=require(_0x1ffe('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x1ffe('0x8')][_0x1ffe('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x6bc1ed,_0x26e370,_0xb34112){return new BPromise(function(_0x8eee2b,_0x4d2a28){return client['request'](_0x6bc1ed,_0xb34112)[_0x1ffe('0xa')](function(_0x13556e){logger[_0x1ffe('0xb')](_0x1ffe('0xc'),_0x26e370,'request\x20sent');logger[_0x1ffe('0xd')](_0x1ffe('0xe'),_0x26e370,_0x1ffe('0xf'),JSON[_0x1ffe('0x10')](_0x13556e));if(_0x13556e[_0x1ffe('0x11')]){if(_0x13556e[_0x1ffe('0x11')][_0x1ffe('0x12')]===0x1f4){logger[_0x1ffe('0x11')]('DeskConfiguration,\x20%s,\x20%s',_0x26e370,_0x13556e[_0x1ffe('0x11')][_0x1ffe('0x13')]);return _0x4d2a28(_0x13556e['error'][_0x1ffe('0x13')]);}logger[_0x1ffe('0x11')](_0x1ffe('0xc'),_0x26e370,_0x13556e[_0x1ffe('0x11')][_0x1ffe('0x13')]);return _0x8eee2b(_0x13556e['error'][_0x1ffe('0x13')]);}else{logger[_0x1ffe('0xb')](_0x1ffe('0xc'),_0x26e370,'request\x20sent');_0x8eee2b(_0x13556e[_0x1ffe('0x14')]['message']);}})[_0x1ffe('0x15')](function(_0x565922){logger[_0x1ffe('0x11')](_0x1ffe('0xc'),_0x26e370,_0x565922);_0x4d2a28(_0x565922);});});} \ No newline at end of file +var _0x559a=['message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','request','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x3faffe,_0x108747){var _0x5ed845=function(_0x2db64d){while(--_0x2db64d){_0x3faffe['push'](_0x3faffe['shift']());}};_0x5ed845(++_0x108747);}(_0x559a,0xb3));var _0xa559=function(_0x238733,_0x38fbd2){_0x238733=_0x238733-0x0;var _0x515548=_0x559a[_0x238733];return _0x515548;};'use strict';var _=require(_0xa559('0x0'));var util=require(_0xa559('0x1'));var moment=require('moment');var BPromise=require(_0xa559('0x2'));var rs=require(_0xa559('0x3'));var fs=require('fs');var Redis=require(_0xa559('0x4'));var db=require(_0xa559('0x5'))['db'];var utils=require(_0xa559('0x6'));var logger=require(_0xa559('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xa559('0x8'));var client=jayson[_0xa559('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2edab4,_0x1a5cec,_0x4eada1){return new BPromise(function(_0xb8055,_0x218e3b){return client[_0xa559('0xa')](_0x2edab4,_0x4eada1)[_0xa559('0xb')](function(_0x48aa9a){logger[_0xa559('0xc')](_0xa559('0xd'),_0x1a5cec,_0xa559('0xe'));logger[_0xa559('0xf')]('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0x1a5cec,'request\x20sent',JSON[_0xa559('0x10')](_0x48aa9a));if(_0x48aa9a[_0xa559('0x11')]){if(_0x48aa9a['error'][_0xa559('0x12')]===0x1f4){logger['error'](_0xa559('0xd'),_0x1a5cec,_0x48aa9a['error'][_0xa559('0x13')]);return _0x218e3b(_0x48aa9a[_0xa559('0x11')][_0xa559('0x13')]);}logger['error'](_0xa559('0xd'),_0x1a5cec,_0x48aa9a[_0xa559('0x11')]['message']);return _0xb8055(_0x48aa9a[_0xa559('0x11')][_0xa559('0x13')]);}else{logger[_0xa559('0xc')](_0xa559('0xd'),_0x1a5cec,'request\x20sent');_0xb8055(_0x48aa9a[_0xa559('0x14')]['message']);}})[_0xa559('0x15')](function(_0x1387b6){logger['error'](_0xa559('0xd'),_0x1a5cec,_0x1387b6);_0x218e3b(_0x1387b6);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index adc38cd..46d7c5a 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 _0x796b=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports'];(function(_0x14a944,_0x44e3d0){var _0x52323a=function(_0x5ca764){while(--_0x5ca764){_0x14a944['push'](_0x14a944['shift']());}};_0x52323a(++_0x44e3d0);}(_0x796b,0x144));var _0xb796=function(_0x12bcf7,_0xc11103){_0x12bcf7=_0x12bcf7-0x0;var _0x2825a=_0x796b[_0x12bcf7];return _0x2825a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xb796('0x0'));var timeout=require(_0xb796('0x1'));var express=require(_0xb796('0x2'));var router=express[_0xb796('0x3')]();var auth=require(_0xb796('0x4'));var interaction=require(_0xb796('0x5'));var config=require(_0xb796('0x6'));var controller=require('./intDeskField.controller');router[_0xb796('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xb796('0x7')](_0xb796('0x8'),auth[_0xb796('0x9')](),controller[_0xb796('0xa')]);router[_0xb796('0xb')]('/',auth[_0xb796('0x9')](),controller[_0xb796('0xc')]);router[_0xb796('0xd')](_0xb796('0x8'),auth[_0xb796('0x9')](),controller[_0xb796('0xe')]);router[_0xb796('0xf')](_0xb796('0x8'),auth['isAuthenticated'](),controller[_0xb796('0x10')]);module[_0xb796('0x11')]=router; \ No newline at end of file +var _0x67db=['post','/:id','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskField.controller','get','isAuthenticated','index','show'];(function(_0x581172,_0x383510){var _0x32b65c=function(_0x5aee3c){while(--_0x5aee3c){_0x581172['push'](_0x581172['shift']());}};_0x32b65c(++_0x383510);}(_0x67db,0x1e1));var _0xb67d=function(_0x13b8f3,_0x442821){_0x13b8f3=_0x13b8f3-0x0;var _0x1a6d06=_0x67db[_0x13b8f3];return _0x1a6d06;};'use strict';var multer=require(_0xb67d('0x0'));var util=require(_0xb67d('0x1'));var path=require('path');var timeout=require(_0xb67d('0x2'));var express=require(_0xb67d('0x3'));var router=express[_0xb67d('0x4')]();var auth=require(_0xb67d('0x5'));var interaction=require(_0xb67d('0x6'));var config=require(_0xb67d('0x7'));var controller=require(_0xb67d('0x8'));router[_0xb67d('0x9')]('/',auth[_0xb67d('0xa')](),controller[_0xb67d('0xb')]);router[_0xb67d('0x9')]('/:id',auth[_0xb67d('0xa')](),controller[_0xb67d('0xc')]);router[_0xb67d('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xb67d('0xe'),auth[_0xb67d('0xa')](),controller[_0xb67d('0xf')]);router[_0xb67d('0x10')](_0xb67d('0xe'),auth[_0xb67d('0xa')](),controller[_0xb67d('0x11')]);module[_0xb67d('0x12')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index 27bff59..355be03 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 _0x1f5e=['keyValue','STRING','BOOLEAN','sequelize','exports','ENUM','string','customVariable'];(function(_0x3ea544,_0x26a5e5){var _0x2f02a0=function(_0xea157d){while(--_0xea157d){_0x3ea544['push'](_0x3ea544['shift']());}};_0x2f02a0(++_0x26a5e5);}(_0x1f5e,0x73));var _0xe1f5=function(_0x19bac7,_0x7e97dd){_0x19bac7=_0x19bac7-0x0;var _0x251192=_0x1f5e[_0x19bac7];return _0x251192;};'use strict';var Sequelize=require(_0xe1f5('0x0'));module[_0xe1f5('0x1')]={'type':{'type':Sequelize[_0xe1f5('0x2')](_0xe1f5('0x3'),'variable',_0xe1f5('0x4'),_0xe1f5('0x5')),'defaultValue':_0xe1f5('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xe1f5('0x6')]},'keyType':{'type':Sequelize[_0xe1f5('0x2')]('string','variable',_0xe1f5('0x4'))},'keyContent':{'type':Sequelize[_0xe1f5('0x6')]},'idField':{'type':Sequelize[_0xe1f5('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xe1f5('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xe1f5('0x6')]}}; \ No newline at end of file +var _0x978e=['customVariable','STRING','exports','ENUM','string','variable'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x978e,0x164));var _0xe978=function(_0x1bd415,_0xa40fce){_0x1bd415=_0x1bd415-0x0;var _0x5b3baf=_0x978e[_0x1bd415];return _0x5b3baf;};'use strict';var Sequelize=require('sequelize');module[_0xe978('0x0')]={'type':{'type':Sequelize[_0xe978('0x1')](_0xe978('0x2'),_0xe978('0x3'),_0xe978('0x4'),'keyValue'),'defaultValue':_0xe978('0x2')},'content':{'type':Sequelize[_0xe978('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0xe978('0x2'),_0xe978('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0xe978('0x5')]},'idField':{'type':Sequelize[_0xe978('0x5')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xe978('0x5')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 745b6a2..2d24a48 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 _0x8664=['to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','sendStatus','status','end','count','offset','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','DeskField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','options','where','findAll','rows','show','include','merge','catch','body','find','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path'];(function(_0x44dd72,_0x3c707c){var _0x2234d1=function(_0x11371e){while(--_0x11371e){_0x44dd72['push'](_0x44dd72['shift']());}};_0x2234d1(++_0x3c707c);}(_0x8664,0x11a));var _0x4866=function(_0x3cd335,_0x128c0c){_0x3cd335=_0x3cd335-0x0;var _0x4130ce=_0x8664[_0x3cd335];return _0x4130ce;};'use strict';var pdf=require(_0x4866('0x0'));var emlformat=require(_0x4866('0x1'));var rimraf=require(_0x4866('0x2'));var zipdir=require(_0x4866('0x3'));var jsonpatch=require(_0x4866('0x4'));var rp=require(_0x4866('0x5'));var moment=require(_0x4866('0x6'));var BPromise=require(_0x4866('0x7'));var Mustache=require(_0x4866('0x8'));var util=require('util');var path=require(_0x4866('0x9'));var sox=require('sox');var csv=require(_0x4866('0xa'));var ejs=require(_0x4866('0xb'));var fs=require('fs');var _=require(_0x4866('0xc'));var squel=require(_0x4866('0xd'));var crypto=require(_0x4866('0xe'));var jsforce=require(_0x4866('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x4866('0xa'));var querystring=require(_0x4866('0x10'));var Papa=require(_0x4866('0x11'));var Redis=require(_0x4866('0x12'));var authService=require(_0x4866('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x4866('0x14'));var hardwareService=require(_0x4866('0x15'));var logger=require('../../config/logger')(_0x4866('0x16'));var utils=require(_0x4866('0x17'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x47a50e,_0x73fdc6){_0x73fdc6=_0x73fdc6||0xcc;return function(_0x10f64d){if(_0x10f64d){return _0x47a50e[_0x4866('0x18')](_0x73fdc6);}return _0x47a50e[_0x4866('0x19')](_0x73fdc6)[_0x4866('0x1a')]();};}function respondWithResult(_0x36aa92,_0x4ec00d){_0x4ec00d=_0x4ec00d||0xc8;return function(_0x92e62e){if(_0x92e62e){return _0x36aa92[_0x4866('0x19')](_0x4ec00d)['json'](_0x92e62e);}};}function respondWithFilteredResult(_0x3d7bda,_0x348996){return function(_0x3f8f56){if(_0x3f8f56){var _0x108950=_0x3f8f56[_0x4866('0x1b')],_0x16b7ff=_0x348996[_0x4866('0x1c')],_0x3bd260=_0x348996['offset']+_0x348996['limit'],_0x373888;if(_0x3bd260>=_0x108950){_0x3bd260=_0x108950;_0x373888=0xc8;}else{_0x373888=0xce;}_0x3d7bda[_0x4866('0x19')](_0x373888);return _0x3d7bda[_0x4866('0x1d')](_0x4866('0x1e'),_0x16b7ff+'-'+_0x3bd260+'/'+_0x108950)['json'](_0x3f8f56);}return null;};}function patchUpdates(_0x49f816){return function(_0x2a95b4){try{jsonpatch[_0x4866('0x1f')](_0x2a95b4,_0x49f816,!![]);}catch(_0x4b0126){return BPromise[_0x4866('0x20')](_0x4b0126);}return _0x2a95b4['save']();};}function saveUpdates(_0x33cbf3,_0x579621){return function(_0x76e72d){if(_0x76e72d){return _0x76e72d[_0x4866('0x21')](_0x33cbf3)[_0x4866('0x22')](function(_0x364ef8){return _0x364ef8;});}return null;};}function removeEntity(_0x382b14,_0x5a8e01){return function(_0x5d1401){if(_0x5d1401){return _0x5d1401[_0x4866('0x23')]()[_0x4866('0x22')](function(){_0x382b14[_0x4866('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x43f3a6,_0x4d3da4){return function(_0x4a16d1){if(!_0x4a16d1){_0x43f3a6[_0x4866('0x18')](0x194);}return _0x4a16d1;};}function handleError(_0x33cae1,_0x5f0811){_0x5f0811=_0x5f0811||0x1f4;return function(_0x16c1ca){logger[_0x4866('0x24')](_0x16c1ca[_0x4866('0x25')]);if(_0x16c1ca[_0x4866('0x26')]){delete _0x16c1ca[_0x4866('0x26')];}_0x33cae1[_0x4866('0x19')](_0x5f0811)[_0x4866('0x27')](_0x16c1ca);};}exports[_0x4866('0x28')]=function(_0x43c4e2,_0x2a6389){var _0x278471={},_0x58f5f4={},_0xaedc67={'count':0x0,'rows':[]};var _0x3f8632=_[_0x4866('0x29')](db[_0x4866('0x2a')][_0x4866('0x2b')],function(_0xd32f19){return{'name':_0xd32f19[_0x4866('0x2c')],'type':_0xd32f19[_0x4866('0x2d')][_0x4866('0x2e')]};});_0x58f5f4[_0x4866('0x2f')]=_[_0x4866('0x29')](_0x3f8632,_0x4866('0x26'));_0x58f5f4[_0x4866('0x30')]=_[_0x4866('0x31')](_0x43c4e2[_0x4866('0x30')]);_0x58f5f4[_0x4866('0x32')]=_[_0x4866('0x33')](_0x58f5f4[_0x4866('0x2f')],_0x58f5f4[_0x4866('0x30')]);_0x278471[_0x4866('0x34')]=_[_0x4866('0x33')](_0x58f5f4[_0x4866('0x2f')],qs['fields'](_0x43c4e2['query'][_0x4866('0x35')]));_0x278471[_0x4866('0x34')]=_0x278471[_0x4866('0x34')][_0x4866('0x36')]?_0x278471[_0x4866('0x34')]:_0x58f5f4['model'];if(!_0x43c4e2[_0x4866('0x30')][_0x4866('0x37')](_0x4866('0x38'))){_0x278471[_0x4866('0x39')]=qs[_0x4866('0x39')](_0x43c4e2['query'][_0x4866('0x39')]);_0x278471[_0x4866('0x1c')]=qs[_0x4866('0x1c')](_0x43c4e2[_0x4866('0x30')][_0x4866('0x1c')]);}_0x278471[_0x4866('0x3a')]=qs[_0x4866('0x3b')](_0x43c4e2[_0x4866('0x30')][_0x4866('0x3b')]);_0x278471['where']=qs[_0x4866('0x32')](_[_0x4866('0x3c')](_0x43c4e2['query'],_0x58f5f4[_0x4866('0x32')]));if(_0x43c4e2[_0x4866('0x30')]['filter']){_0x278471['where']=_['merge'](_0x278471['where'],{'$or':_[_0x4866('0x29')](_0x3f8632,function(_0x46d1bf){if(_0x46d1bf['type']!=='VIRTUAL'){var _0x4fbe06={};_0x4fbe06[_0x46d1bf[_0x4866('0x26')]]={'$like':'%'+_0x43c4e2['query'][_0x4866('0x3d')]+'%'};return _0x4fbe06;}})});}_0x278471=_['merge']({},_0x278471,_0x43c4e2[_0x4866('0x3e')]);var _0x5e3de6={'where':_0x278471[_0x4866('0x3f')]};return db[_0x4866('0x2a')][_0x4866('0x1b')](_0x5e3de6)[_0x4866('0x22')](function(_0x441348){_0xaedc67[_0x4866('0x1b')]=_0x441348;if(_0x43c4e2[_0x4866('0x30')]['includeAll']){_0x278471['include']=[{'all':!![]}];}return db[_0x4866('0x2a')][_0x4866('0x40')](_0x278471);})[_0x4866('0x22')](function(_0x2ae265){_0xaedc67[_0x4866('0x41')]=_0x2ae265;return _0xaedc67;})[_0x4866('0x22')](respondWithFilteredResult(_0x2a6389,_0x278471))['catch'](handleError(_0x2a6389,null));};exports[_0x4866('0x42')]=function(_0x372804,_0x559cda){var _0x513276={'raw':!![],'where':{'id':_0x372804['params']['id']}},_0x4a8f1a={};_0x4a8f1a[_0x4866('0x2f')]=_[_0x4866('0x31')](db[_0x4866('0x2a')][_0x4866('0x2b')]);_0x4a8f1a['query']=_[_0x4866('0x31')](_0x372804[_0x4866('0x30')]);_0x4a8f1a[_0x4866('0x32')]=_[_0x4866('0x33')](_0x4a8f1a[_0x4866('0x2f')],_0x4a8f1a[_0x4866('0x30')]);_0x513276['attributes']=_[_0x4866('0x33')](_0x4a8f1a[_0x4866('0x2f')],qs[_0x4866('0x35')](_0x372804[_0x4866('0x30')][_0x4866('0x35')]));_0x513276[_0x4866('0x34')]=_0x513276[_0x4866('0x34')]['length']?_0x513276[_0x4866('0x34')]:_0x4a8f1a['model'];if(_0x372804[_0x4866('0x30')]['includeAll']){_0x513276[_0x4866('0x43')]=[{'all':!![]}];}_0x513276=_[_0x4866('0x44')]({},_0x513276,_0x372804[_0x4866('0x3e')]);return db[_0x4866('0x2a')]['find'](_0x513276)[_0x4866('0x22')](handleEntityNotFound(_0x559cda,null))[_0x4866('0x22')](respondWithResult(_0x559cda,null))[_0x4866('0x45')](handleError(_0x559cda,null));};exports['create']=function(_0xc735e0,_0x1114e7){return db[_0x4866('0x2a')]['create'](_0xc735e0[_0x4866('0x46')],{})[_0x4866('0x22')](respondWithResult(_0x1114e7,0xc9))[_0x4866('0x45')](handleError(_0x1114e7,null));};exports['update']=function(_0xef8fe0,_0x29c1a1){if(_0xef8fe0[_0x4866('0x46')]['id']){delete _0xef8fe0[_0x4866('0x46')]['id'];}return db[_0x4866('0x2a')][_0x4866('0x47')]({'where':{'id':_0xef8fe0[_0x4866('0x48')]['id']}})[_0x4866('0x22')](handleEntityNotFound(_0x29c1a1,null))['then'](saveUpdates(_0xef8fe0[_0x4866('0x46')],null))['then'](respondWithResult(_0x29c1a1,null))['catch'](handleError(_0x29c1a1,null));};exports[_0x4866('0x23')]=function(_0x2ffb10,_0x4608d8){return db['DeskField'][_0x4866('0x47')]({'where':{'id':_0x2ffb10[_0x4866('0x48')]['id']}})[_0x4866('0x22')](handleEntityNotFound(_0x4608d8,null))['then'](removeEntity(_0x4608d8,null))[_0x4866('0x45')](handleError(_0x4608d8,null));}; \ No newline at end of file +var _0x7a59=['body','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','status','end','json','offset','set','apply','save','update','then','destroy','sendStatus','error','stack','name','send','index','DeskField','rawAttributes','fieldName','type','model','query','keys','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','merge','map','options','count','includeAll','findAll','rows','show','params','intersection','find','catch','create'];(function(_0x50322a,_0x23e887){var _0x5457dd=function(_0x28af1e){while(--_0x28af1e){_0x50322a['push'](_0x50322a['shift']());}};_0x5457dd(++_0x23e887);}(_0x7a59,0x16e));var _0x97a5=function(_0x1ccbcc,_0x5c948b){_0x1ccbcc=_0x1ccbcc-0x0;var _0x1e873f=_0x7a59[_0x1ccbcc];return _0x1e873f;};'use strict';var pdf=require(_0x97a5('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x97a5('0x1'));var jsonpatch=require(_0x97a5('0x2'));var rp=require(_0x97a5('0x3'));var moment=require(_0x97a5('0x4'));var BPromise=require(_0x97a5('0x5'));var Mustache=require('mustache');var util=require(_0x97a5('0x6'));var path=require(_0x97a5('0x7'));var sox=require(_0x97a5('0x8'));var csv=require('to-csv');var ejs=require(_0x97a5('0x9'));var fs=require('fs');var _=require(_0x97a5('0xa'));var squel=require(_0x97a5('0xb'));var crypto=require(_0x97a5('0xc'));var jsforce=require(_0x97a5('0xd'));var deskjs=require(_0x97a5('0xe'));var toCsv=require(_0x97a5('0xf'));var querystring=require('querystring');var Papa=require(_0x97a5('0x10'));var Redis=require(_0x97a5('0x11'));var authService=require(_0x97a5('0x12'));var qs=require(_0x97a5('0x13'));var as=require(_0x97a5('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x97a5('0x15'));var utils=require(_0x97a5('0x16'));var config=require(_0x97a5('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5c6143,_0x350720){_0x350720=_0x350720||0xcc;return function(_0x55305a){if(_0x55305a){return _0x5c6143['sendStatus'](_0x350720);}return _0x5c6143[_0x97a5('0x18')](_0x350720)[_0x97a5('0x19')]();};}function respondWithResult(_0x50d291,_0x595437){_0x595437=_0x595437||0xc8;return function(_0x51d5e2){if(_0x51d5e2){return _0x50d291['status'](_0x595437)[_0x97a5('0x1a')](_0x51d5e2);}};}function respondWithFilteredResult(_0x3dfb08,_0x3603e4){return function(_0x4d8ba7){if(_0x4d8ba7){var _0x1a7a62=_0x4d8ba7['count'],_0x3fa986=_0x3603e4[_0x97a5('0x1b')],_0x531ed8=_0x3603e4['offset']+_0x3603e4['limit'],_0x1178d5;if(_0x531ed8>=_0x1a7a62){_0x531ed8=_0x1a7a62;_0x1178d5=0xc8;}else{_0x1178d5=0xce;}_0x3dfb08['status'](_0x1178d5);return _0x3dfb08[_0x97a5('0x1c')]('Content-Range',_0x3fa986+'-'+_0x531ed8+'/'+_0x1a7a62)[_0x97a5('0x1a')](_0x4d8ba7);}return null;};}function patchUpdates(_0x9863ea){return function(_0x3e87b2){try{jsonpatch[_0x97a5('0x1d')](_0x3e87b2,_0x9863ea,!![]);}catch(_0x49bcc3){return BPromise['reject'](_0x49bcc3);}return _0x3e87b2[_0x97a5('0x1e')]();};}function saveUpdates(_0x114372,_0x4e3386){return function(_0x51858b){if(_0x51858b){return _0x51858b[_0x97a5('0x1f')](_0x114372)[_0x97a5('0x20')](function(_0x38be6b){return _0x38be6b;});}return null;};}function removeEntity(_0x587f2c,_0x34fb55){return function(_0x3a5849){if(_0x3a5849){return _0x3a5849[_0x97a5('0x21')]()['then'](function(){_0x587f2c[_0x97a5('0x18')](0xcc)[_0x97a5('0x19')]();});}};}function handleEntityNotFound(_0x4e2074,_0x5e731e){return function(_0x469592){if(!_0x469592){_0x4e2074[_0x97a5('0x22')](0x194);}return _0x469592;};}function handleError(_0x1d3da2,_0x282192){_0x282192=_0x282192||0x1f4;return function(_0x5239f2){logger[_0x97a5('0x23')](_0x5239f2[_0x97a5('0x24')]);if(_0x5239f2[_0x97a5('0x25')]){delete _0x5239f2['name'];}_0x1d3da2[_0x97a5('0x18')](_0x282192)[_0x97a5('0x26')](_0x5239f2);};}exports[_0x97a5('0x27')]=function(_0x14fe08,_0x2076e9){var _0x46846f={},_0x5c0517={},_0x1dcf5f={'count':0x0,'rows':[]};var _0x3eff21=_['map'](db[_0x97a5('0x28')][_0x97a5('0x29')],function(_0x48f1c1){return{'name':_0x48f1c1[_0x97a5('0x2a')],'type':_0x48f1c1[_0x97a5('0x2b')]['key']};});_0x5c0517[_0x97a5('0x2c')]=_['map'](_0x3eff21,_0x97a5('0x25'));_0x5c0517[_0x97a5('0x2d')]=_[_0x97a5('0x2e')](_0x14fe08[_0x97a5('0x2d')]);_0x5c0517['filters']=_['intersection'](_0x5c0517[_0x97a5('0x2c')],_0x5c0517[_0x97a5('0x2d')]);_0x46846f[_0x97a5('0x2f')]=_['intersection'](_0x5c0517[_0x97a5('0x2c')],qs[_0x97a5('0x30')](_0x14fe08['query'][_0x97a5('0x30')]));_0x46846f[_0x97a5('0x2f')]=_0x46846f['attributes'][_0x97a5('0x31')]?_0x46846f[_0x97a5('0x2f')]:_0x5c0517[_0x97a5('0x2c')];if(!_0x14fe08['query'][_0x97a5('0x32')](_0x97a5('0x33'))){_0x46846f[_0x97a5('0x34')]=qs[_0x97a5('0x34')](_0x14fe08[_0x97a5('0x2d')][_0x97a5('0x34')]);_0x46846f[_0x97a5('0x1b')]=qs['offset'](_0x14fe08[_0x97a5('0x2d')][_0x97a5('0x1b')]);}_0x46846f[_0x97a5('0x35')]=qs[_0x97a5('0x36')](_0x14fe08[_0x97a5('0x2d')][_0x97a5('0x36')]);_0x46846f[_0x97a5('0x37')]=qs[_0x97a5('0x38')](_[_0x97a5('0x39')](_0x14fe08[_0x97a5('0x2d')],_0x5c0517[_0x97a5('0x38')]));if(_0x14fe08[_0x97a5('0x2d')][_0x97a5('0x3a')]){_0x46846f['where']=_[_0x97a5('0x3b')](_0x46846f[_0x97a5('0x37')],{'$or':_[_0x97a5('0x3c')](_0x3eff21,function(_0x305d92){if(_0x305d92[_0x97a5('0x2b')]!=='VIRTUAL'){var _0x5274e2={};_0x5274e2[_0x305d92[_0x97a5('0x25')]]={'$like':'%'+_0x14fe08[_0x97a5('0x2d')][_0x97a5('0x3a')]+'%'};return _0x5274e2;}})});}_0x46846f=_[_0x97a5('0x3b')]({},_0x46846f,_0x14fe08[_0x97a5('0x3d')]);var _0x3dd209={'where':_0x46846f['where']};return db[_0x97a5('0x28')]['count'](_0x3dd209)[_0x97a5('0x20')](function(_0x1bde97){_0x1dcf5f[_0x97a5('0x3e')]=_0x1bde97;if(_0x14fe08[_0x97a5('0x2d')][_0x97a5('0x3f')]){_0x46846f['include']=[{'all':!![]}];}return db[_0x97a5('0x28')][_0x97a5('0x40')](_0x46846f);})[_0x97a5('0x20')](function(_0x3e59b3){_0x1dcf5f[_0x97a5('0x41')]=_0x3e59b3;return _0x1dcf5f;})['then'](respondWithFilteredResult(_0x2076e9,_0x46846f))['catch'](handleError(_0x2076e9,null));};exports[_0x97a5('0x42')]=function(_0xf48f55,_0xd89561){var _0x20dbc6={'raw':!![],'where':{'id':_0xf48f55[_0x97a5('0x43')]['id']}},_0x52b775={};_0x52b775['model']=_[_0x97a5('0x2e')](db[_0x97a5('0x28')][_0x97a5('0x29')]);_0x52b775['query']=_[_0x97a5('0x2e')](_0xf48f55[_0x97a5('0x2d')]);_0x52b775['filters']=_[_0x97a5('0x44')](_0x52b775[_0x97a5('0x2c')],_0x52b775[_0x97a5('0x2d')]);_0x20dbc6[_0x97a5('0x2f')]=_[_0x97a5('0x44')](_0x52b775[_0x97a5('0x2c')],qs[_0x97a5('0x30')](_0xf48f55[_0x97a5('0x2d')][_0x97a5('0x30')]));_0x20dbc6[_0x97a5('0x2f')]=_0x20dbc6[_0x97a5('0x2f')][_0x97a5('0x31')]?_0x20dbc6['attributes']:_0x52b775[_0x97a5('0x2c')];if(_0xf48f55[_0x97a5('0x2d')][_0x97a5('0x3f')]){_0x20dbc6['include']=[{'all':!![]}];}_0x20dbc6=_[_0x97a5('0x3b')]({},_0x20dbc6,_0xf48f55[_0x97a5('0x3d')]);return db[_0x97a5('0x28')][_0x97a5('0x45')](_0x20dbc6)[_0x97a5('0x20')](handleEntityNotFound(_0xd89561,null))['then'](respondWithResult(_0xd89561,null))[_0x97a5('0x46')](handleError(_0xd89561,null));};exports[_0x97a5('0x47')]=function(_0x3245a4,_0xec4726){return db[_0x97a5('0x28')]['create'](_0x3245a4[_0x97a5('0x48')],{})['then'](respondWithResult(_0xec4726,0xc9))[_0x97a5('0x46')](handleError(_0xec4726,null));};exports[_0x97a5('0x1f')]=function(_0x330f6a,_0x4b3c38){if(_0x330f6a[_0x97a5('0x48')]['id']){delete _0x330f6a[_0x97a5('0x48')]['id'];}return db[_0x97a5('0x28')][_0x97a5('0x45')]({'where':{'id':_0x330f6a[_0x97a5('0x43')]['id']}})[_0x97a5('0x20')](handleEntityNotFound(_0x4b3c38,null))['then'](saveUpdates(_0x330f6a[_0x97a5('0x48')],null))[_0x97a5('0x20')](respondWithResult(_0x4b3c38,null))[_0x97a5('0x46')](handleError(_0x4b3c38,null));};exports[_0x97a5('0x21')]=function(_0x543146,_0x4582e9){return db[_0x97a5('0x28')]['find']({'where':{'id':_0x543146[_0x97a5('0x43')]['id']}})[_0x97a5('0x20')](handleEntityNotFound(_0x4582e9,null))[_0x97a5('0x20')](removeEntity(_0x4582e9,null))['catch'](handleError(_0x4582e9,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index 59e5f49..657452e 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 _0x74ea=['lodash','../../config/logger','bluebird','request-promise','path','../../config/environment','./intDeskField.attributes','int_desk_fields','desk_unique_index','idField'];(function(_0x33d4a2,_0x2baaf4){var _0x2c793f=function(_0x414303){while(--_0x414303){_0x33d4a2['push'](_0x33d4a2['shift']());}};_0x2c793f(++_0x2baaf4);}(_0x74ea,0x96));var _0xa74e=function(_0x572094,_0x3b41c3){_0x572094=_0x572094-0x0;var _0x175b43=_0x74ea[_0x572094];return _0x175b43;};'use strict';var _=require(_0xa74e('0x0'));var util=require('util');var logger=require(_0xa74e('0x1'))('api');var moment=require('moment');var BPromise=require(_0xa74e('0x2'));var rp=require(_0xa74e('0x3'));var fs=require('fs');var path=require(_0xa74e('0x4'));var rimraf=require('rimraf');var config=require(_0xa74e('0x5'));var attributes=require(_0xa74e('0x6'));module['exports']=function(_0x1f4c49,_0x1e5557){return _0x1f4c49['define']('DeskField',attributes,{'tableName':_0xa74e('0x7'),'paranoid':![],'indexes':[{'name':_0xa74e('0x8'),'fields':[_0xa74e('0x9'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2261=['request-promise','rimraf','./intDeskField.attributes','exports','DeskField','desk_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x5448a9,_0x4764da){var _0x1924af=function(_0x34f9bf){while(--_0x34f9bf){_0x5448a9['push'](_0x5448a9['shift']());}};_0x1924af(++_0x4764da);}(_0x2261,0x1f2));var _0x1226=function(_0xed27e1,_0x1105ec){_0xed27e1=_0xed27e1-0x0;var _0x43d5c7=_0x2261[_0xed27e1];return _0x43d5c7;};'use strict';var _=require(_0x1226('0x0'));var util=require(_0x1226('0x1'));var logger=require(_0x1226('0x2'))(_0x1226('0x3'));var moment=require(_0x1226('0x4'));var BPromise=require(_0x1226('0x5'));var rp=require(_0x1226('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1226('0x7'));var config=require('../../config/environment');var attributes=require(_0x1226('0x8'));module[_0x1226('0x9')]=function(_0x248bb7,_0xb0a4d3){return _0x248bb7['define'](_0x1226('0xa'),attributes,{'tableName':'int_desk_fields','paranoid':![],'indexes':[{'name':_0x1226('0xb'),'fields':[_0x1226('0xc'),_0x1226('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.rpc.js b/server/api/intDeskField/intDeskField.rpc.js index 75556c0..e719659 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 _0xa723=['debug','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','DeskField,\x20%s,\x20%s','request\x20sent'];(function(_0x3c6b7d,_0x5f0d90){var _0x1d3ed2=function(_0x1a8f35){while(--_0x1a8f35){_0x3c6b7d['push'](_0x3c6b7d['shift']());}};_0x1d3ed2(++_0x5f0d90);}(_0xa723,0x1a6));var _0x3a72=function(_0x2ec461,_0x5f588a){_0x2ec461=_0x2ec461-0x0;var _0x28603d=_0xa723[_0x2ec461];return _0x28603d;};'use strict';var _=require(_0x3a72('0x0'));var util=require(_0x3a72('0x1'));var moment=require(_0x3a72('0x2'));var BPromise=require(_0x3a72('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3a72('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x3a72('0x5'));var logger=require('../../config/logger')(_0x3a72('0x6'));var config=require(_0x3a72('0x7'));var jayson=require(_0x3a72('0x8'));var client=jayson['client'][_0x3a72('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2a7392,_0x1f6581,_0x7e4048){return new BPromise(function(_0x207bd7,_0x343e1c){return client[_0x3a72('0xa')](_0x2a7392,_0x7e4048)[_0x3a72('0xb')](function(_0x38342b){logger[_0x3a72('0xc')](_0x3a72('0xd'),_0x1f6581,_0x3a72('0xe'));logger[_0x3a72('0xf')](_0x3a72('0x10'),_0x1f6581,_0x3a72('0xe'),JSON[_0x3a72('0x11')](_0x38342b));if(_0x38342b[_0x3a72('0x12')]){if(_0x38342b[_0x3a72('0x12')][_0x3a72('0x13')]===0x1f4){logger[_0x3a72('0x12')](_0x3a72('0xd'),_0x1f6581,_0x38342b['error'][_0x3a72('0x14')]);return _0x343e1c(_0x38342b['error'][_0x3a72('0x14')]);}logger[_0x3a72('0x12')]('DeskField,\x20%s,\x20%s',_0x1f6581,_0x38342b[_0x3a72('0x12')][_0x3a72('0x14')]);return _0x207bd7(_0x38342b[_0x3a72('0x12')][_0x3a72('0x14')]);}else{logger[_0x3a72('0xc')]('DeskField,\x20%s,\x20%s',_0x1f6581,_0x3a72('0xe'));_0x207bd7(_0x38342b[_0x3a72('0x15')][_0x3a72('0x14')]);}})[_0x3a72('0x16')](function(_0x14706f){logger[_0x3a72('0x12')]('DeskField,\x20%s,\x20%s',_0x1f6581,_0x14706f);_0x343e1c(_0x14706f);});});} \ No newline at end of file +var _0x4526=['../../config/logger','rpc','jayson/promise','client','http','info','DeskField,\x20%s,\x20%s','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x4526,0xc0));var _0x6452=function(_0x3f3f27,_0x3d5ce0){_0x3f3f27=_0x3f3f27-0x0;var _0x4eeb55=_0x4526[_0x3f3f27];return _0x4eeb55;};'use strict';var _=require(_0x6452('0x0'));var util=require('util');var moment=require(_0x6452('0x1'));var BPromise=require(_0x6452('0x2'));var rs=require(_0x6452('0x3'));var fs=require('fs');var Redis=require(_0x6452('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6452('0x5'));var logger=require(_0x6452('0x6'))(_0x6452('0x7'));var config=require('../../config/environment');var jayson=require(_0x6452('0x8'));var client=jayson[_0x6452('0x9')][_0x6452('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x25b4cf,_0x561b3e,_0x44a9b8){return new BPromise(function(_0x4c1c0c,_0x195aee){return client['request'](_0x25b4cf,_0x44a9b8)['then'](function(_0x2ba95d){logger[_0x6452('0xb')](_0x6452('0xc'),_0x561b3e,_0x6452('0xd'));logger[_0x6452('0xe')](_0x6452('0xf'),_0x561b3e,'request\x20sent',JSON[_0x6452('0x10')](_0x2ba95d));if(_0x2ba95d['error']){if(_0x2ba95d[_0x6452('0x11')][_0x6452('0x12')]===0x1f4){logger['error']('DeskField,\x20%s,\x20%s',_0x561b3e,_0x2ba95d[_0x6452('0x11')][_0x6452('0x13')]);return _0x195aee(_0x2ba95d['error'][_0x6452('0x13')]);}logger['error'](_0x6452('0xc'),_0x561b3e,_0x2ba95d[_0x6452('0x11')]['message']);return _0x4c1c0c(_0x2ba95d[_0x6452('0x11')][_0x6452('0x13')]);}else{logger[_0x6452('0xb')]('DeskField,\x20%s,\x20%s',_0x561b3e,_0x6452('0xd'));_0x4c1c0c(_0x2ba95d[_0x6452('0x14')][_0x6452('0x13')]);}})[_0x6452('0x15')](function(_0x219a73){logger[_0x6452('0x11')](_0x6452('0xc'),_0x561b3e,_0x219a73);_0x195aee(_0x219a73);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 6057207..b4ea0c9 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 _0x603c=['/:id/configurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','get','isAuthenticated','index','/:id','show'];(function(_0x1a7e45,_0x7f2bdd){var _0x145834=function(_0x41771b){while(--_0x41771b){_0x1a7e45['push'](_0x1a7e45['shift']());}};_0x145834(++_0x7f2bdd);}(_0x603c,0x182));var _0xc603=function(_0x1ea6eb,_0x33d3d4){_0x1ea6eb=_0x1ea6eb-0x0;var _0x127200=_0x603c[_0x1ea6eb];return _0x127200;};'use strict';var multer=require(_0xc603('0x0'));var util=require(_0xc603('0x1'));var path=require(_0xc603('0x2'));var timeout=require('connect-timeout');var express=require(_0xc603('0x3'));var router=express[_0xc603('0x4')]();var auth=require(_0xc603('0x5'));var interaction=require(_0xc603('0x6'));var config=require(_0xc603('0x7'));var controller=require(_0xc603('0x8'));router[_0xc603('0x9')]('/',auth[_0xc603('0xa')](),controller[_0xc603('0xb')]);router[_0xc603('0x9')](_0xc603('0xc'),auth[_0xc603('0xa')](),controller[_0xc603('0xd')]);router[_0xc603('0x9')](_0xc603('0xe'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0xc603('0x9')](_0xc603('0xf'),auth[_0xc603('0xa')](),controller[_0xc603('0x10')]);router[_0xc603('0x11')]('/',auth['isAuthenticated'](),controller[_0xc603('0x12')]);router[_0xc603('0x11')](_0xc603('0xe'),auth[_0xc603('0xa')](),controller[_0xc603('0x13')]);router[_0xc603('0x14')](_0xc603('0xc'),auth[_0xc603('0xa')](),controller[_0xc603('0x15')]);router[_0xc603('0x16')](_0xc603('0xc'),auth[_0xc603('0xa')](),controller[_0xc603('0x17')]);module[_0xc603('0x18')]=router; \ No newline at end of file +var _0xa5c4=['util','express','Router','../../components/auth/service','../../config/environment','isAuthenticated','get','/:id','show','getConfigurations','getFields','post','create','/:id/configurations','put','delete','destroy'];(function(_0x5d7ad6,_0x35559c){var _0x89c1a4=function(_0x533f29){while(--_0x533f29){_0x5d7ad6['push'](_0x5d7ad6['shift']());}};_0x89c1a4(++_0x35559c);}(_0xa5c4,0x1cb));var _0x4a5c=function(_0x1034ca,_0x14ecd6){_0x1034ca=_0x1034ca-0x0;var _0x1a023a=_0xa5c4[_0x1034ca];return _0x1a023a;};'use strict';var multer=require('multer');var util=require(_0x4a5c('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x4a5c('0x1'));var router=express[_0x4a5c('0x2')]();var auth=require(_0x4a5c('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x4a5c('0x4'));var controller=require('./intDynamics365Account.controller');router['get']('/',auth[_0x4a5c('0x5')](),controller['index']);router[_0x4a5c('0x6')](_0x4a5c('0x7'),auth[_0x4a5c('0x5')](),controller[_0x4a5c('0x8')]);router[_0x4a5c('0x6')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x4a5c('0x9')]);router[_0x4a5c('0x6')]('/:id/fields',auth['isAuthenticated'](),controller[_0x4a5c('0xa')]);router[_0x4a5c('0xb')]('/',auth[_0x4a5c('0x5')](),controller[_0x4a5c('0xc')]);router[_0x4a5c('0xb')](_0x4a5c('0xd'),auth[_0x4a5c('0x5')](),controller['addConfiguration']);router[_0x4a5c('0xe')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x4a5c('0xf')]('/:id',auth[_0x4a5c('0x5')](),controller[_0x4a5c('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index 0423b07..91e42c3 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 _0xfc30=['STRING','sequelize','exports'];(function(_0x1ddabb,_0x5a2cd4){var _0xf76d8d=function(_0x57b970){while(--_0x57b970){_0x1ddabb['push'](_0x1ddabb['shift']());}};_0xf76d8d(++_0x5a2cd4);}(_0xfc30,0x94));var _0x0fc3=function(_0x434ab9,_0x2c3eef){_0x434ab9=_0x434ab9-0x0;var _0x2ca0d9=_0xfc30[_0x434ab9];return _0x2ca0d9;};'use strict';var Sequelize=require(_0x0fc3('0x0'));module[_0x0fc3('0x1')]={'name':{'type':Sequelize[_0x0fc3('0x2')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x0fc3('0x2')]},'remoteUri':{'type':Sequelize[_0x0fc3('0x2')]},'tenantId':{'type':Sequelize[_0x0fc3('0x2')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0x0fc3('0x2')]},'serverUrl':{'type':Sequelize[_0x0fc3('0x2')]},'description':{'type':Sequelize[_0x0fc3('0x2')]}}; \ No newline at end of file +var _0x404c=['STRING','exports'];(function(_0x10ea3f,_0x3ce70d){var _0xbbba31=function(_0xe1c6d5){while(--_0xe1c6d5){_0x10ea3f['push'](_0x10ea3f['shift']());}};_0xbbba31(++_0x3ce70d);}(_0x404c,0x11b));var _0xc404=function(_0x5a58ad,_0x491b19){_0x5a58ad=_0x5a58ad-0x0;var _0x34850a=_0x404c[_0x5a58ad];return _0x34850a;};'use strict';var Sequelize=require('sequelize');module[_0xc404('0x0')]={'name':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xc404('0x1')]},'password':{'type':Sequelize[_0xc404('0x1')]},'remoteUri':{'type':Sequelize[_0xc404('0x1')]},'tenantId':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0xc404('0x1')]},'clientSecret':{'type':Sequelize[_0xc404('0x1')]},'serverUrl':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xc404('0x1')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index 12cb2af..6469695 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 _0x5d31=['LogicalName','forEach','@odata.type','PicklistAttributeMetadata','push','MetadataId','all','isNil','DoubleAttributeMetadata','BigIntAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','concat','Wrong\x20credentials',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','4.0','OptionSet','Options','Label','DisplayName','true','UserLocalizedLabel','false',')/Attributes(','?$select=DisplayName,LogicalName','eml-format','rimraf','zip-dir','request-promise','mustache','util','path','sox','ejs','lodash','squel','crypto','desk.js','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','destroy','stack','name','send','Dynamics365Account','fieldName','key','model','map','query','keys','filters','attributes','intersection','fields','nolimit','order','sort','filter','merge','type','VIRTUAL','where','includeAll','include','findAll','rows','length','find','create','body','params','getConfigurations','findOne','rawAttributes','pick','hasOwnProperty','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','Dynamics365Configuration','Dynamics365Field','getFields','ticketType','Incident','PhoneCall','title','ownerid','caseorigincode','subject','phonenumber','regardingobjectid','directioncode','phonecall_activity_parties','accountidname','actualserviceunits','billedserviceunits','contactidname','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','followupby','importsequencenumber','influencescore','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyname','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','overriddencreatedon','owneridname','owneridtype','owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame','productidname','productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','socialprofileidname','statecode','statuscode','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','username','remoteUri','clientId','clientSecret','slice','substring','lastIndexOf','POST','https://login.microsoftonline.com/','tenantId','password','access_token','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','GET','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','remove','includes'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0x5d31,0xf7));var _0x15d3=function(_0x3382f4,_0x32b70b){_0x3382f4=_0x3382f4-0x0;var _0x3a3368=_0x5d31[_0x3382f4];return _0x3a3368;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x15d3('0x0'));var rimraf=require(_0x15d3('0x1'));var zipdir=require(_0x15d3('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x15d3('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x15d3('0x4'));var util=require(_0x15d3('0x5'));var path=require(_0x15d3('0x6'));var sox=require(_0x15d3('0x7'));var csv=require('to-csv');var ejs=require(_0x15d3('0x8'));var fs=require('fs');var _=require(_0x15d3('0x9'));var squel=require(_0x15d3('0xa'));var crypto=require(_0x15d3('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x15d3('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x15d3('0xd'));var Redis=require('ioredis');var authService=require(_0x15d3('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x15d3('0xf'));var logger=require(_0x15d3('0x10'))(_0x15d3('0x11'));var utils=require(_0x15d3('0x12'));var config=require(_0x15d3('0x13'));var db=require(_0x15d3('0x14'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0x15d3('0x15'));var client=jayson[_0x15d3('0x16')][_0x15d3('0x17')]({'port':0x232a});function checkPasswordPattern(_0x209104,_0x36ab99,_0x1360dd){if(_0x1360dd){var _0x24eb07=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x24eb07[_0x15d3('0x18')](_0x36ab99)){return _0x209104;}else{throw new db[(_0x15d3('0x19'))][(_0x15d3('0x1a'))](_0x15d3('0x1b'));}}else{return _0x209104;}}function respondWithRpcPromise(_0x4af3a7,_0x304a13,_0x17401b,_0x5bbfef){return new BPromise(function(_0xf93348,_0x1b07ba){var _0x407da5=_0x5bbfef||client;return _0x407da5[_0x15d3('0x1c')](_0x4af3a7,_0x17401b)[_0x15d3('0x1d')](function(_0x2c25ba){logger[_0x15d3('0x1e')](_0x15d3('0x1f'),_0x304a13,_0x15d3('0x20'));logger[_0x15d3('0x21')](_0x15d3('0x22'),_0x304a13,'request\x20sent',JSON[_0x15d3('0x23')](_0x2c25ba));if(_0x2c25ba[_0x15d3('0x24')]){if(_0x2c25ba['error']['code']===0x1f4){logger['error']('Dynamics365Account,\x20%s,\x20%s',_0x304a13,_0x2c25ba[_0x15d3('0x24')][_0x15d3('0x25')]);return _0x1b07ba(_0x2c25ba[_0x15d3('0x24')][_0x15d3('0x25')]);}logger[_0x15d3('0x24')](_0x15d3('0x1f'),_0x304a13,_0x2c25ba['error']['message']);return _0xf93348(_0x2c25ba[_0x15d3('0x24')][_0x15d3('0x25')]);}else{logger[_0x15d3('0x1e')](_0x15d3('0x1f'),_0x304a13,'request\x20sent');_0xf93348(_0x2c25ba[_0x15d3('0x26')][_0x15d3('0x25')]);}})[_0x15d3('0x27')](function(_0x539626){logger[_0x15d3('0x24')](_0x15d3('0x1f'),_0x304a13,_0x539626);_0x1b07ba(_0x539626);});});}function respondWithStatusCode(_0x4a499a,_0x514380){_0x514380=_0x514380||0xcc;return function(_0x50f171){if(_0x50f171){return _0x4a499a[_0x15d3('0x28')](_0x514380);}return _0x4a499a[_0x15d3('0x29')](_0x514380)[_0x15d3('0x2a')]();};}function respondWithResult(_0x374fa4,_0x26ec4b){_0x26ec4b=_0x26ec4b||0xc8;return function(_0x24bf3c){if(_0x24bf3c){return _0x374fa4[_0x15d3('0x29')](_0x26ec4b)[_0x15d3('0x2b')](_0x24bf3c);}};}function respondWithFilteredResult(_0x3b1ba4,_0x49b865){return function(_0x5f445a){if(_0x5f445a){var _0x164aa1=_0x5f445a[_0x15d3('0x2c')],_0x4e5840=_0x49b865[_0x15d3('0x2d')],_0x6a9c0c=_0x49b865['offset']+_0x49b865[_0x15d3('0x2e')],_0x5a2ccf;if(_0x6a9c0c>=_0x164aa1){_0x6a9c0c=_0x164aa1;_0x5a2ccf=0xc8;}else{_0x5a2ccf=0xce;}_0x3b1ba4[_0x15d3('0x29')](_0x5a2ccf);return _0x3b1ba4[_0x15d3('0x2f')](_0x15d3('0x30'),_0x4e5840+'-'+_0x6a9c0c+'/'+_0x164aa1)[_0x15d3('0x2b')](_0x5f445a);}return null;};}function patchUpdates(_0x14491b){return function(_0x1c9aea){try{jsonpatch[_0x15d3('0x31')](_0x1c9aea,_0x14491b,!![]);}catch(_0x9133e5){return BPromise[_0x15d3('0x32')](_0x9133e5);}return _0x1c9aea['save']();};}function saveUpdates(_0x42d444,_0x398e19){return function(_0x40f778){if(_0x40f778){return _0x40f778[_0x15d3('0x33')](_0x42d444)[_0x15d3('0x1d')](function(_0xb82aa6){return _0xb82aa6;});}return null;};}function removeEntity(_0xcc0489,_0x2c6bdd){return function(_0x4d4485){if(_0x4d4485){return _0x4d4485[_0x15d3('0x34')]()['then'](function(){_0xcc0489[_0x15d3('0x29')](0xcc)[_0x15d3('0x2a')]();});}};}function handleEntityNotFound(_0x17d460,_0x467a0e){return function(_0x145fa3){if(!_0x145fa3){_0x17d460[_0x15d3('0x28')](0x194);}return _0x145fa3;};}function handleError(_0x186fa1,_0xa9bc2c){_0xa9bc2c=_0xa9bc2c||0x1f4;return function(_0x340d03){logger[_0x15d3('0x24')](_0x340d03[_0x15d3('0x35')]);if(_0x340d03[_0x15d3('0x36')]){delete _0x340d03[_0x15d3('0x36')];}_0x186fa1[_0x15d3('0x29')](_0xa9bc2c)[_0x15d3('0x37')](_0x340d03);};}exports['index']=function(_0x205bbd,_0x30f7e8){var _0x4d3b71={},_0xe3e4ba={},_0x7e460a={'count':0x0,'rows':[]};var _0xd2708=_['map'](db[_0x15d3('0x38')]['rawAttributes'],function(_0x2f511b){return{'name':_0x2f511b[_0x15d3('0x39')],'type':_0x2f511b['type'][_0x15d3('0x3a')]};});_0xe3e4ba[_0x15d3('0x3b')]=_[_0x15d3('0x3c')](_0xd2708,_0x15d3('0x36'));_0xe3e4ba[_0x15d3('0x3d')]=_[_0x15d3('0x3e')](_0x205bbd['query']);_0xe3e4ba[_0x15d3('0x3f')]=_['intersection'](_0xe3e4ba[_0x15d3('0x3b')],_0xe3e4ba[_0x15d3('0x3d')]);_0x4d3b71[_0x15d3('0x40')]=_[_0x15d3('0x41')](_0xe3e4ba[_0x15d3('0x3b')],qs[_0x15d3('0x42')](_0x205bbd[_0x15d3('0x3d')][_0x15d3('0x42')]));_0x4d3b71[_0x15d3('0x40')]=_0x4d3b71[_0x15d3('0x40')]['length']?_0x4d3b71[_0x15d3('0x40')]:_0xe3e4ba[_0x15d3('0x3b')];if(!_0x205bbd['query']['hasOwnProperty'](_0x15d3('0x43'))){_0x4d3b71[_0x15d3('0x2e')]=qs[_0x15d3('0x2e')](_0x205bbd[_0x15d3('0x3d')][_0x15d3('0x2e')]);_0x4d3b71[_0x15d3('0x2d')]=qs[_0x15d3('0x2d')](_0x205bbd[_0x15d3('0x3d')][_0x15d3('0x2d')]);}_0x4d3b71[_0x15d3('0x44')]=qs['sort'](_0x205bbd[_0x15d3('0x3d')][_0x15d3('0x45')]);_0x4d3b71['where']=qs[_0x15d3('0x3f')](_['pick'](_0x205bbd['query'],_0xe3e4ba[_0x15d3('0x3f')]));if(_0x205bbd[_0x15d3('0x3d')][_0x15d3('0x46')]){_0x4d3b71['where']=_[_0x15d3('0x47')](_0x4d3b71['where'],{'$or':_[_0x15d3('0x3c')](_0xd2708,function(_0x100ea4){if(_0x100ea4[_0x15d3('0x48')]!==_0x15d3('0x49')){var _0x361154={};_0x361154[_0x100ea4['name']]={'$like':'%'+_0x205bbd['query']['filter']+'%'};return _0x361154;}})});}_0x4d3b71=_[_0x15d3('0x47')]({},_0x4d3b71,_0x205bbd['options']);var _0x327cc8={'where':_0x4d3b71[_0x15d3('0x4a')]};return db[_0x15d3('0x38')]['count'](_0x327cc8)[_0x15d3('0x1d')](function(_0x2d896a){_0x7e460a[_0x15d3('0x2c')]=_0x2d896a;if(_0x205bbd[_0x15d3('0x3d')][_0x15d3('0x4b')]){_0x4d3b71[_0x15d3('0x4c')]=[{'all':!![]}];}return db[_0x15d3('0x38')][_0x15d3('0x4d')](_0x4d3b71);})[_0x15d3('0x1d')](function(_0x43ba84){_0x7e460a[_0x15d3('0x4e')]=_0x43ba84;return _0x7e460a;})[_0x15d3('0x1d')](respondWithFilteredResult(_0x30f7e8,_0x4d3b71))['catch'](handleError(_0x30f7e8,null));};exports['show']=function(_0x264487,_0x446929){var _0x13faa2={'raw':![],'where':{'id':_0x264487['params']['id']}},_0x4ff662={};_0x4ff662[_0x15d3('0x3b')]=_['keys'](db[_0x15d3('0x38')]['rawAttributes']);_0x4ff662[_0x15d3('0x3d')]=_[_0x15d3('0x3e')](_0x264487['query']);_0x4ff662['filters']=_['intersection'](_0x4ff662['model'],_0x4ff662['query']);_0x13faa2[_0x15d3('0x40')]=_[_0x15d3('0x41')](_0x4ff662['model'],qs[_0x15d3('0x42')](_0x264487[_0x15d3('0x3d')][_0x15d3('0x42')]));_0x13faa2['attributes']=_0x13faa2[_0x15d3('0x40')][_0x15d3('0x4f')]?_0x13faa2[_0x15d3('0x40')]:_0x4ff662[_0x15d3('0x3b')];if(_0x264487[_0x15d3('0x3d')][_0x15d3('0x4b')]){_0x13faa2['include']=[{'all':!![]}];}_0x13faa2=_[_0x15d3('0x47')]({},_0x13faa2,_0x264487['options']);return db['Dynamics365Account'][_0x15d3('0x50')](_0x13faa2)['then'](handleEntityNotFound(_0x446929,null))[_0x15d3('0x1d')](respondWithResult(_0x446929,null))['catch'](handleError(_0x446929,null));};exports[_0x15d3('0x51')]=function(_0x205230,_0x18429c){return db[_0x15d3('0x38')][_0x15d3('0x51')](_0x205230['body'],{})['then'](respondWithResult(_0x18429c,0xc9))[_0x15d3('0x27')](handleError(_0x18429c,null));};exports['update']=function(_0x29b4a5,_0x300c4f){if(_0x29b4a5[_0x15d3('0x52')]['id']){delete _0x29b4a5[_0x15d3('0x52')]['id'];}return db[_0x15d3('0x38')][_0x15d3('0x50')]({'where':{'id':_0x29b4a5[_0x15d3('0x53')]['id']}})['then'](handleEntityNotFound(_0x300c4f,null))[_0x15d3('0x1d')](saveUpdates(_0x29b4a5[_0x15d3('0x52')],null))[_0x15d3('0x1d')](respondWithResult(_0x300c4f,null))[_0x15d3('0x27')](handleError(_0x300c4f,null));};exports[_0x15d3('0x34')]=function(_0x540f04,_0x45ea28){return db['Dynamics365Account']['find']({'where':{'id':_0x540f04[_0x15d3('0x53')]['id']}})[_0x15d3('0x1d')](handleEntityNotFound(_0x45ea28,null))[_0x15d3('0x1d')](removeEntity(_0x45ea28,null))[_0x15d3('0x27')](handleError(_0x45ea28,null));};exports[_0x15d3('0x54')]=function(_0x48c04f,_0x17bd0e,_0x939112){var _0x341565={};var _0x4783a6={};var _0x4b0cec;var _0x4242d4;return db[_0x15d3('0x38')][_0x15d3('0x55')]({'where':{'id':_0x48c04f[_0x15d3('0x53')]['id']}})[_0x15d3('0x1d')](handleEntityNotFound(_0x17bd0e,null))[_0x15d3('0x1d')](function(_0x92d46e){if(_0x92d46e){_0x4b0cec=_0x92d46e;_0x4783a6['model']=_[_0x15d3('0x3e')](db['Dynamics365Configuration'][_0x15d3('0x56')]);_0x4783a6[_0x15d3('0x3d')]=_[_0x15d3('0x3e')](_0x48c04f['query']);_0x4783a6[_0x15d3('0x3f')]=_['intersection'](_0x4783a6[_0x15d3('0x3b')],_0x4783a6[_0x15d3('0x3d')]);_0x341565['attributes']=_[_0x15d3('0x41')](_0x4783a6['model'],qs['fields'](_0x48c04f['query']['fields']));_0x341565[_0x15d3('0x40')]=_0x341565[_0x15d3('0x40')][_0x15d3('0x4f')]?_0x341565[_0x15d3('0x40')]:_0x4783a6['model'];_0x341565[_0x15d3('0x44')]=qs[_0x15d3('0x45')](_0x48c04f[_0x15d3('0x3d')][_0x15d3('0x45')]);_0x341565['where']=qs['filters'](_[_0x15d3('0x57')](_0x48c04f['query'],_0x4783a6[_0x15d3('0x3f')]));if(_0x48c04f[_0x15d3('0x3d')][_0x15d3('0x46')]){_0x341565[_0x15d3('0x4a')]=_['merge'](_0x341565[_0x15d3('0x4a')],{'$or':_[_0x15d3('0x3c')](_0x341565[_0x15d3('0x40')],function(_0xcd37cd){var _0x3ca30d={};_0x3ca30d[_0xcd37cd]={'$like':'%'+_0x48c04f[_0x15d3('0x3d')]['filter']+'%'};return _0x3ca30d;})});}_0x341565=_[_0x15d3('0x47')]({},_0x341565,_0x48c04f['options']);return _0x4b0cec[_0x15d3('0x54')](_0x341565);}})[_0x15d3('0x1d')](function(_0x4465d0){if(_0x4465d0){_0x4242d4=_0x4465d0['length'];if(!_0x48c04f[_0x15d3('0x3d')][_0x15d3('0x58')](_0x15d3('0x43'))){_0x341565[_0x15d3('0x2e')]=qs['limit'](_0x48c04f[_0x15d3('0x3d')][_0x15d3('0x2e')]);_0x341565['offset']=qs['offset'](_0x48c04f[_0x15d3('0x3d')][_0x15d3('0x2d')]);}return _0x4b0cec[_0x15d3('0x54')](_0x341565);}})[_0x15d3('0x1d')](function(_0x48b608){if(_0x48b608){return _0x48b608?{'count':_0x4242d4,'rows':_0x48b608}:null;}})[_0x15d3('0x1d')](respondWithResult(_0x17bd0e,null))[_0x15d3('0x27')](handleError(_0x17bd0e,null));};exports[_0x15d3('0x59')]=function(_0x4e23ba,_0x250d52,_0x21d086){if(_0x4e23ba[_0x15d3('0x52')]['id']){delete _0x4e23ba[_0x15d3('0x52')]['id'];}return db['Dynamics365Account'][_0x15d3('0x55')]({'where':{'id':_0x4e23ba[_0x15d3('0x53')]['id']}})[_0x15d3('0x1d')](handleEntityNotFound(_0x250d52,null))['then'](function(_0x368374){if(_0x368374){_0x4e23ba[_0x15d3('0x52')]['AccountId']=_0x368374['id'];_0x4e23ba[_0x15d3('0x52')][_0x15d3('0x5a')]=integrations[_0x15d3('0x5b')](_0x4e23ba['body'][_0x15d3('0x5c')],_0x4e23ba[_0x15d3('0x52')]['type']);_0x4e23ba[_0x15d3('0x52')][_0x15d3('0x5d')]=integrations[_0x15d3('0x5e')](_0x4e23ba[_0x15d3('0x52')][_0x15d3('0x5c')],_0x4e23ba[_0x15d3('0x52')][_0x15d3('0x48')]);return db[_0x15d3('0x5f')][_0x15d3('0x51')](_0x4e23ba[_0x15d3('0x52')],{'include':[{'model':db['Dynamics365Field'],'as':_0x15d3('0x5a')},{'model':db[_0x15d3('0x60')],'as':_0x15d3('0x5d')}]});}return null;})[_0x15d3('0x1d')](respondWithResult(_0x250d52,null))[_0x15d3('0x27')](handleError(_0x250d52,null));};exports[_0x15d3('0x61')]=function(_0x5b8f73,_0x4f58df,_0x5f147e){var _0x3b03d7=_0x5b8f73[_0x15d3('0x3d')][_0x15d3('0x62')];var _0x35869e=_0x3b03d7==='incident'?_0x15d3('0x63'):_0x15d3('0x64');var _0x4c2f51='';var _0x26fd5f='';var _0x38d19a='';var _0xe26daf='';var _0x2e4a53='';var _0x473456='';var _0x5a0262='';var _0x2b75b3='';var _0x58de62=[_0x15d3('0x65'),'description','customerid',_0x15d3('0x66'),_0x15d3('0x67'),_0x15d3('0x68'),_0x15d3('0x69'),_0x15d3('0x6a'),_0x15d3('0x6b'),_0x15d3('0x6c')];var _0x1b8520=[_0x15d3('0x6d'),'accountidyominame',_0x15d3('0x6e'),_0x15d3('0x6f'),_0x15d3('0x70'),_0x15d3('0x71'),_0x15d3('0x72'),_0x15d3('0x73'),_0x15d3('0x74'),_0x15d3('0x75'),'createdbyname','createdbyyominame',_0x15d3('0x76'),_0x15d3('0x77'),_0x15d3('0x78'),_0x15d3('0x79'),'customeridtype','customeridyominame',_0x15d3('0x7a'),_0x15d3('0x7b'),_0x15d3('0x7c'),_0x15d3('0x7d'),_0x15d3('0x7e'),_0x15d3('0x7f'),'firstresponsebykpiidname',_0x15d3('0x80'),_0x15d3('0x81'),_0x15d3('0x82'),_0x15d3('0x83'),_0x15d3('0x84'),_0x15d3('0x85'),_0x15d3('0x86'),'modifiedbyexternalpartyyominame',_0x15d3('0x87'),'modifiedbyyominame',_0x15d3('0x88'),_0x15d3('0x89'),_0x15d3('0x8a'),_0x15d3('0x8b'),_0x15d3('0x8c'),_0x15d3('0x8d'),_0x15d3('0x8e'),_0x15d3('0x8f'),_0x15d3('0x90'),_0x15d3('0x91'),_0x15d3('0x92'),_0x15d3('0x93'),_0x15d3('0x94'),_0x15d3('0x95'),'prioritycodename',_0x15d3('0x96'),_0x15d3('0x97'),_0x15d3('0x98'),_0x15d3('0x99'),_0x15d3('0x9a'),_0x15d3('0x9b'),_0x15d3('0x9c'),_0x15d3('0x9d'),_0x15d3('0x9e'),_0x15d3('0x9f'),_0x15d3('0xa0'),_0x15d3('0xa1'),_0x15d3('0xa2'),'subjectidname',_0x15d3('0xa3'),_0x15d3('0xa4'),_0x15d3('0xa5'),_0x15d3('0xa6'),'utcconversiontimezonecode','versionnumber'];var _0x4c4bef=_0x58de62['concat'](_0x1b8520);return db[_0x15d3('0x38')][_0x15d3('0x55')]({'where':{'id':_0x5b8f73[_0x15d3('0x53')]['id']},'attributes':['id',_0x15d3('0xa7'),'password',_0x15d3('0xa8'),'tenantId',_0x15d3('0xa9'),_0x15d3('0xaa')]})[_0x15d3('0x1d')](handleEntityNotFound(_0x4f58df,null))['then'](function(_0x1a92b3){if(_0x1a92b3){_0x2b75b3=_0x1a92b3[_0x15d3('0xa8')];var _0x2e4000=_0x2b75b3[_0x15d3('0xab')](-0x1);if(_0x2e4000==='/'){_0x2b75b3=_0x2b75b3[_0x15d3('0xac')](0x0,_0x2b75b3[_0x15d3('0xad')](_0x2e4000));}_0x5a0262=util['format']('%s/api/data/v9.0/',_0x2b75b3);var _0x4b49dd={'method':_0x15d3('0xae'),'uri':_0x15d3('0xaf')+_0x1a92b3[_0x15d3('0xb0')]+'/oauth2/token','form':{'client_id':_0x1a92b3['clientId'],'resource':_0x2b75b3,'username':_0x1a92b3[_0x15d3('0xa7')],'password':_0x1a92b3[_0x15d3('0xb1')],'grant_type':_0x15d3('0xb1'),'client_secret':_0x1a92b3[_0x15d3('0xaa')]},'json':!![]};return rp(_0x4b49dd);}})[_0x15d3('0x1d')](function(_0x111b13){_0x473456=_0x111b13[_0x15d3('0xb2')];var _0x1ced35={'method':'GET','uri':encodeURI(_0x5a0262+_0x15d3('0xb3')+_0x35869e+'\x27'),'headers':{'Authorization':_0x15d3('0xb4')+_0x473456,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x1ced35);})['then'](function(_0x5e071b){var _0xbea92f=_0x5e071b['value'][0x0];var _0x14a3d1=_0xbea92f['MetadataId'];var _0x56aec8={'method':_0x15d3('0xb5'),'uri':_0x5a0262+_0x15d3('0xb6')+_0x14a3d1+_0x15d3('0xb7'),'headers':{'Authorization':'Bearer\x20'+_0x473456,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x56aec8);})[_0x15d3('0x1d')](function(_0x1b051a){_0x4c2f51=_0x1b051a;_0x26fd5f=_0x4c2f51[_0x15d3('0xb8')];_0x26fd5f=_[_0x15d3('0xb9')](_0x26fd5f,function(_0x3274e8){return!_0x4c4bef[_0x15d3('0xba')](_0x3274e8[_0x15d3('0xbb')]);});var _0x4927a7=[];var _0xc3842=[];_0x26fd5f[_0x15d3('0xbc')](function(_0x201699){if(_0x201699[_0x15d3('0xbd')]){var _0x4f0787=_0x201699[_0x15d3('0xbd')][_0x15d3('0xac')](_0x201699[_0x15d3('0xbd')]['lastIndexOf']('.')+0x1);if(_0x4f0787===_0x15d3('0xbe')){_0x4927a7[_0x15d3('0xbf')](getSelectList(_0x5a0262,_0x3b03d7,_0xc3842,_0x4c2f51[_0x15d3('0xc0')],_0x201699[_0x15d3('0xc0')],_0x473456));}}});return Promise[_0x15d3('0xc1')](_0x4927a7);})[_0x15d3('0x1d')](function(_0x322c90){_0x38d19a=_0x322c90[0x0];var _0x556663=[];var _0x539c74=[];_0x26fd5f[_0x15d3('0xbc')](function(_0x328186){if(!_[_0x15d3('0xc2')](_0x328186[_0x15d3('0xbd')])){var _0x731621=_0x328186[_0x15d3('0xbd')]['substring'](_0x328186[_0x15d3('0xbd')][_0x15d3('0xad')]('.')+0x1);if(_0x731621==='BooleanAttributeMetadata'){_0x556663[_0x15d3('0xbf')](getBooleanList(_0x5a0262,_0x3b03d7,_0x539c74,_0x4c2f51[_0x15d3('0xc0')],_0x328186[_0x15d3('0xc0')],_0x473456));}}});return Promise[_0x15d3('0xc1')](_0x556663);})['then'](function(_0x5cd063){_0xe26daf=_0x5cd063[0x0];var _0x2354dd=[];var _0x3136e4=[];_0x26fd5f[_0x15d3('0xbc')](function(_0x5d2167){if(_0x5d2167[_0x15d3('0xbd')]){var _0x25dd0e=_0x5d2167[_0x15d3('0xbd')][_0x15d3('0xac')](_0x5d2167[_0x15d3('0xbd')]['lastIndexOf']('.')+0x1);if(_0x25dd0e==='StringAttributeMetadata'||_0x25dd0e===_0x15d3('0xc3')||_0x25dd0e===_0x15d3('0xc4')||_0x25dd0e==='IntegerAttributeMetadata'||_0x25dd0e===_0x15d3('0xc5')||_0x25dd0e===_0x15d3('0xc6')||_0x25dd0e===_0x15d3('0xc7')||_0x25dd0e===_0x15d3('0xc8')||_0x25dd0e===_0x15d3('0xc9')||_0x25dd0e===_0x15d3('0xca')){_0x2354dd[_0x15d3('0xbf')](getInputList(_0x5a0262,_0x3b03d7,_0x25dd0e,_0x3136e4,_0x4c2f51[_0x15d3('0xc0')],_0x5d2167[_0x15d3('0xc0')],_0x473456));}}});return Promise['all'](_0x2354dd);})['then'](function(_0xd5c75b){_0x2e4a53=_0xd5c75b[0x0];var _0x5d8483=_0x38d19a[_0x15d3('0xcb')](_0xe26daf)[_0x15d3('0xcb')](_0x2e4a53);var _0x3572b3={'count':_0x5d8483[_0x15d3('0x4f')],'rows':_0x5d8483};return _0x3572b3;})[_0x15d3('0x1d')](respondWithResult(_0x4f58df,null))[_0x15d3('0x27')](function(_0x52e43b){var _0x45f967=_0x5b8f73[_0x15d3('0x3d')][_0x15d3('0x18')]?0x1f4:_0x52e43b['statusCode']||0x1f4;logger[_0x15d3('0x24')](_0x52e43b['stack']);delete _0x52e43b['name'];if(_0x45f967===0x191){_0x45f967=0x190;}_0x4f58df[_0x15d3('0x29')](_0x45f967)[_0x15d3('0x37')](_0x5b8f73['query']['test']?{'message':_0x15d3('0xcc'),'statusCode':_0x52e43b['statusCode']}:_0x52e43b);});};function getSelectList(_0x492672,_0x27f28b,_0x164625,_0x3efede,_0x27cea5,_0x3f040a){var _0x3730b5={'method':_0x15d3('0xb5'),'uri':_0x492672+_0x15d3('0xb6')+_0x3efede+')/Attributes('+_0x27cea5+_0x15d3('0xcd')+_0x15d3('0xce'),'headers':{'Authorization':_0x15d3('0xb4')+_0x3f040a,'If-None-Match':null,'OData-Version':_0x15d3('0xcf')},'json':!![]};return rp(_0x3730b5)['then'](function(_0x65b811){var _0x75972b=[];var _0x30efb6=_0x65b811[_0x15d3('0xd0')][_0x15d3('0xd1')];_0x30efb6[_0x15d3('0xbc')](function(_0x2d5472){_0x75972b[_0x15d3('0xbf')]({'name':_0x2d5472[_0x15d3('0xd2')]['UserLocalizedLabel']['Label'],'value':String(_0x2d5472['Value'])});});var _0x51c0ad={'id':_0x27f28b+'_'+_0x65b811[_0x15d3('0xbb')],'name':_0x65b811[_0x15d3('0xd3')]['UserLocalizedLabel'][_0x15d3('0xd2')],'custom':![],'options':_0x75972b};_0x164625[_0x15d3('0xbf')](_0x51c0ad);return _0x164625;});}function getBooleanList(_0x1266c8,_0x4b9f49,_0x2e462c,_0x573b43,_0x39b1f0,_0x1a0899){var _0x1c44bc={'method':_0x15d3('0xb5'),'uri':_0x1266c8+_0x15d3('0xb6')+_0x573b43+')/Attributes('+_0x39b1f0+')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','headers':{'Authorization':_0x15d3('0xb4')+_0x1a0899,'If-None-Match':null,'OData-Version':_0x15d3('0xcf')},'json':!![]};return rp(_0x1c44bc)[_0x15d3('0x1d')](function(_0x5851f7){var _0x245ea6=[];_0x245ea6[_0x15d3('0xbf')]({'name':_0x5851f7[_0x15d3('0xd0')]['TrueOption'][_0x15d3('0xd2')]['UserLocalizedLabel']['Label'],'value':_0x15d3('0xd4')},{'name':_0x5851f7[_0x15d3('0xd0')]['FalseOption'][_0x15d3('0xd2')][_0x15d3('0xd5')][_0x15d3('0xd2')],'value':_0x15d3('0xd6')});var _0x3c6c73={'id':_0x4b9f49+'_'+_0x5851f7[_0x15d3('0xbb')],'name':_0x5851f7[_0x15d3('0xd3')][_0x15d3('0xd5')][_0x15d3('0xd2')],'custom':![],'options':_0x245ea6};_0x2e462c[_0x15d3('0xbf')](_0x3c6c73);return _0x2e462c;});}function getInputList(_0x2b434a,_0x550671,_0x3d9a3a,_0x16976d,_0x33e5f8,_0x3d9c70,_0x92dd3f){var _0x55c032={'method':_0x15d3('0xb5'),'uri':_0x2b434a+_0x15d3('0xb6')+_0x33e5f8+_0x15d3('0xd7')+_0x3d9c70+')/Microsoft.Dynamics.CRM.'+_0x3d9a3a+_0x15d3('0xd8'),'headers':{'Authorization':'Bearer\x20'+_0x92dd3f,'If-None-Match':null,'OData-Version':_0x15d3('0xcf')},'json':!![]};return rp(_0x55c032)[_0x15d3('0x1d')](function(_0x169d49){var _0x42bdd3={'id':_0x550671+'_'+_0x169d49['LogicalName'],'name':_0x169d49[_0x15d3('0xd3')][_0x15d3('0xd5')]?_0x169d49[_0x15d3('0xd3')][_0x15d3('0xd5')][_0x15d3('0xd2')]:_0x169d49[_0x15d3('0xbb')],'custom':![],'options':[]};_0x16976d[_0x15d3('0xbf')](_0x42bdd3);return _0x16976d;});} \ No newline at end of file +var _0x4a65=['map','Dynamics365Account','rawAttributes','type','model','keys','filters','intersection','fields','query','attributes','length','nolimit','limit','order','sort','where','filter','merge','VIRTUAL','include','rows','catch','show','params','includeAll','create','body','find','getConfigurations','findOne','options','hasOwnProperty','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','Dynamics365Field','getFields','ticketType','PhoneCall','title','description','ownerid','caseorigincode','subject','phonenumber','directioncode','phonecall_activity_parties','accountidyominame','billedserviceunits','contactidname','contactidyominame','contractdetailidname','createdbyexternalpartyname','createdbyname','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridyominame','entitlementidname','entityimage_url','escalatedon','exchangerate','firstresponsebykpiidname','followupby','influencescore','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_iotalertname','numberofchildincidents','overriddencreatedon','owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame','productidname','productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','slainvokedidname','slaname','statecode','statuscode','ticketnumber','timezoneruleversionnumber','utcconversiontimezonecode','versionnumber','concat','clientSecret','remoteUri','slice','format','%s/api/data/v9.0/','POST','https://login.microsoftonline.com/','tenantId','clientId','username','password','access_token','GET','Bearer\x20','value','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','remove','forEach','@odata.type','substring','PicklistAttributeMetadata','push','MetadataId','all','isNil','lastIndexOf','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','DecimalAttributeMetadata','statusCode','Wrong\x20credentials',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','4.0','OptionSet','Options','Label','Value','LogicalName','DisplayName','UserLocalizedLabel',')/Attributes(',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true','FalseOption','false',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','http','test','ValidationError','then','info','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','error','Dynamics365Account,\x20%s,\x20%s','message','sendStatus','end','status','json','count','offset','set','apply','reject','save','update','destroy','stack','name','send','index'];(function(_0xbbfe59,_0x46067f){var _0x28a2a4=function(_0xfe230){while(--_0xfe230){_0xbbfe59['push'](_0xbbfe59['shift']());}};_0x28a2a4(++_0x46067f);}(_0x4a65,0x16f));var _0x54a6=function(_0x47029c,_0x1d2c9d){_0x47029c=_0x47029c-0x0;var _0x22d99a=_0x4a65[_0x47029c];return _0x22d99a;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x54a6('0x0'));var rimraf=require(_0x54a6('0x1'));var zipdir=require(_0x54a6('0x2'));var jsonpatch=require(_0x54a6('0x3'));var rp=require(_0x54a6('0x4'));var moment=require(_0x54a6('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x54a6('0x6'));var util=require(_0x54a6('0x7'));var path=require(_0x54a6('0x8'));var sox=require(_0x54a6('0x9'));var csv=require(_0x54a6('0xa'));var ejs=require(_0x54a6('0xb'));var fs=require('fs');var _=require(_0x54a6('0xc'));var squel=require(_0x54a6('0xd'));var crypto=require(_0x54a6('0xe'));var jsforce=require(_0x54a6('0xf'));var deskjs=require(_0x54a6('0x10'));var toCsv=require('to-csv');var querystring=require(_0x54a6('0x11'));var Papa=require(_0x54a6('0x12'));var Redis=require('ioredis');var authService=require(_0x54a6('0x13'));var qs=require(_0x54a6('0x14'));var as=require(_0x54a6('0x15'));var hardwareService=require(_0x54a6('0x16'));var logger=require(_0x54a6('0x17'))(_0x54a6('0x18'));var utils=require(_0x54a6('0x19'));var config=require(_0x54a6('0x1a'));var db=require(_0x54a6('0x1b'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require('jayson/promise');var client=jayson['client'][_0x54a6('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x527de2,_0x551ecf,_0x3c0564){if(_0x3c0564){var _0x49775e=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x49775e[_0x54a6('0x1d')](_0x551ecf)){return _0x527de2;}else{throw new db['Sequelize'][(_0x54a6('0x1e'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x527de2;}}function respondWithRpcPromise(_0x1020ff,_0x240ed4,_0x25913f,_0x5161f2){return new BPromise(function(_0x30c3ad,_0x484990){var _0x1e18f6=_0x5161f2||client;return _0x1e18f6['request'](_0x1020ff,_0x25913f)[_0x54a6('0x1f')](function(_0x2b3384){logger[_0x54a6('0x20')]('Dynamics365Account,\x20%s,\x20%s',_0x240ed4,_0x54a6('0x21'));logger[_0x54a6('0x22')](_0x54a6('0x23'),_0x240ed4,'request\x20sent',JSON['stringify'](_0x2b3384));if(_0x2b3384[_0x54a6('0x24')]){if(_0x2b3384[_0x54a6('0x24')]['code']===0x1f4){logger['error'](_0x54a6('0x25'),_0x240ed4,_0x2b3384[_0x54a6('0x24')][_0x54a6('0x26')]);return _0x484990(_0x2b3384[_0x54a6('0x24')][_0x54a6('0x26')]);}logger['error']('Dynamics365Account,\x20%s,\x20%s',_0x240ed4,_0x2b3384['error']['message']);return _0x30c3ad(_0x2b3384[_0x54a6('0x24')][_0x54a6('0x26')]);}else{logger['info'](_0x54a6('0x25'),_0x240ed4,_0x54a6('0x21'));_0x30c3ad(_0x2b3384['result']['message']);}})['catch'](function(_0x10ca94){logger['error'](_0x54a6('0x25'),_0x240ed4,_0x10ca94);_0x484990(_0x10ca94);});});}function respondWithStatusCode(_0x479087,_0x5b13ee){_0x5b13ee=_0x5b13ee||0xcc;return function(_0x558b92){if(_0x558b92){return _0x479087[_0x54a6('0x27')](_0x5b13ee);}return _0x479087['status'](_0x5b13ee)[_0x54a6('0x28')]();};}function respondWithResult(_0x49d370,_0x3ec92b){_0x3ec92b=_0x3ec92b||0xc8;return function(_0x247440){if(_0x247440){return _0x49d370[_0x54a6('0x29')](_0x3ec92b)[_0x54a6('0x2a')](_0x247440);}};}function respondWithFilteredResult(_0x48da73,_0x682fc0){return function(_0x34808a){if(_0x34808a){var _0x5a85a7=_0x34808a[_0x54a6('0x2b')],_0x36775e=_0x682fc0[_0x54a6('0x2c')],_0x35d739=_0x682fc0[_0x54a6('0x2c')]+_0x682fc0['limit'],_0x341793;if(_0x35d739>=_0x5a85a7){_0x35d739=_0x5a85a7;_0x341793=0xc8;}else{_0x341793=0xce;}_0x48da73[_0x54a6('0x29')](_0x341793);return _0x48da73[_0x54a6('0x2d')]('Content-Range',_0x36775e+'-'+_0x35d739+'/'+_0x5a85a7)[_0x54a6('0x2a')](_0x34808a);}return null;};}function patchUpdates(_0x248564){return function(_0x423622){try{jsonpatch[_0x54a6('0x2e')](_0x423622,_0x248564,!![]);}catch(_0x39a27f){return BPromise[_0x54a6('0x2f')](_0x39a27f);}return _0x423622[_0x54a6('0x30')]();};}function saveUpdates(_0x58cd28,_0x57abd3){return function(_0x56f177){if(_0x56f177){return _0x56f177[_0x54a6('0x31')](_0x58cd28)[_0x54a6('0x1f')](function(_0x1ade6f){return _0x1ade6f;});}return null;};}function removeEntity(_0x46e18b,_0x112cbc){return function(_0x55f2b5){if(_0x55f2b5){return _0x55f2b5[_0x54a6('0x32')]()[_0x54a6('0x1f')](function(){_0x46e18b[_0x54a6('0x29')](0xcc)[_0x54a6('0x28')]();});}};}function handleEntityNotFound(_0x588492,_0x1e5e6b){return function(_0x21cf97){if(!_0x21cf97){_0x588492[_0x54a6('0x27')](0x194);}return _0x21cf97;};}function handleError(_0x1514cf,_0x4cb836){_0x4cb836=_0x4cb836||0x1f4;return function(_0x2bfc71){logger[_0x54a6('0x24')](_0x2bfc71[_0x54a6('0x33')]);if(_0x2bfc71[_0x54a6('0x34')]){delete _0x2bfc71[_0x54a6('0x34')];}_0x1514cf['status'](_0x4cb836)[_0x54a6('0x35')](_0x2bfc71);};}exports[_0x54a6('0x36')]=function(_0x29b4e0,_0x3c9ddc){var _0x4b7495={},_0x18b8a4={},_0x52ed36={'count':0x0,'rows':[]};var _0x32d286=_[_0x54a6('0x37')](db[_0x54a6('0x38')][_0x54a6('0x39')],function(_0x35aaa7){return{'name':_0x35aaa7['fieldName'],'type':_0x35aaa7[_0x54a6('0x3a')]['key']};});_0x18b8a4[_0x54a6('0x3b')]=_[_0x54a6('0x37')](_0x32d286,_0x54a6('0x34'));_0x18b8a4['query']=_[_0x54a6('0x3c')](_0x29b4e0['query']);_0x18b8a4[_0x54a6('0x3d')]=_[_0x54a6('0x3e')](_0x18b8a4[_0x54a6('0x3b')],_0x18b8a4['query']);_0x4b7495['attributes']=_[_0x54a6('0x3e')](_0x18b8a4['model'],qs[_0x54a6('0x3f')](_0x29b4e0[_0x54a6('0x40')][_0x54a6('0x3f')]));_0x4b7495[_0x54a6('0x41')]=_0x4b7495[_0x54a6('0x41')][_0x54a6('0x42')]?_0x4b7495[_0x54a6('0x41')]:_0x18b8a4[_0x54a6('0x3b')];if(!_0x29b4e0[_0x54a6('0x40')]['hasOwnProperty'](_0x54a6('0x43'))){_0x4b7495[_0x54a6('0x44')]=qs['limit'](_0x29b4e0[_0x54a6('0x40')][_0x54a6('0x44')]);_0x4b7495[_0x54a6('0x2c')]=qs[_0x54a6('0x2c')](_0x29b4e0['query'][_0x54a6('0x2c')]);}_0x4b7495[_0x54a6('0x45')]=qs[_0x54a6('0x46')](_0x29b4e0[_0x54a6('0x40')][_0x54a6('0x46')]);_0x4b7495[_0x54a6('0x47')]=qs[_0x54a6('0x3d')](_['pick'](_0x29b4e0[_0x54a6('0x40')],_0x18b8a4['filters']));if(_0x29b4e0['query'][_0x54a6('0x48')]){_0x4b7495['where']=_[_0x54a6('0x49')](_0x4b7495['where'],{'$or':_[_0x54a6('0x37')](_0x32d286,function(_0x4e8d51){if(_0x4e8d51['type']!==_0x54a6('0x4a')){var _0xafd965={};_0xafd965[_0x4e8d51[_0x54a6('0x34')]]={'$like':'%'+_0x29b4e0[_0x54a6('0x40')][_0x54a6('0x48')]+'%'};return _0xafd965;}})});}_0x4b7495=_[_0x54a6('0x49')]({},_0x4b7495,_0x29b4e0['options']);var _0x23d157={'where':_0x4b7495[_0x54a6('0x47')]};return db[_0x54a6('0x38')]['count'](_0x23d157)['then'](function(_0x3fb2be){_0x52ed36[_0x54a6('0x2b')]=_0x3fb2be;if(_0x29b4e0[_0x54a6('0x40')]['includeAll']){_0x4b7495[_0x54a6('0x4b')]=[{'all':!![]}];}return db['Dynamics365Account']['findAll'](_0x4b7495);})[_0x54a6('0x1f')](function(_0x5bedea){_0x52ed36[_0x54a6('0x4c')]=_0x5bedea;return _0x52ed36;})[_0x54a6('0x1f')](respondWithFilteredResult(_0x3c9ddc,_0x4b7495))[_0x54a6('0x4d')](handleError(_0x3c9ddc,null));};exports[_0x54a6('0x4e')]=function(_0xfaa561,_0x4d141b){var _0x3373b4={'raw':![],'where':{'id':_0xfaa561[_0x54a6('0x4f')]['id']}},_0xd7951b={};_0xd7951b[_0x54a6('0x3b')]=_['keys'](db['Dynamics365Account'][_0x54a6('0x39')]);_0xd7951b['query']=_[_0x54a6('0x3c')](_0xfaa561['query']);_0xd7951b[_0x54a6('0x3d')]=_[_0x54a6('0x3e')](_0xd7951b[_0x54a6('0x3b')],_0xd7951b[_0x54a6('0x40')]);_0x3373b4['attributes']=_[_0x54a6('0x3e')](_0xd7951b['model'],qs['fields'](_0xfaa561['query'][_0x54a6('0x3f')]));_0x3373b4['attributes']=_0x3373b4['attributes'][_0x54a6('0x42')]?_0x3373b4['attributes']:_0xd7951b[_0x54a6('0x3b')];if(_0xfaa561['query'][_0x54a6('0x50')]){_0x3373b4['include']=[{'all':!![]}];}_0x3373b4=_[_0x54a6('0x49')]({},_0x3373b4,_0xfaa561['options']);return db[_0x54a6('0x38')]['find'](_0x3373b4)[_0x54a6('0x1f')](handleEntityNotFound(_0x4d141b,null))[_0x54a6('0x1f')](respondWithResult(_0x4d141b,null))[_0x54a6('0x4d')](handleError(_0x4d141b,null));};exports[_0x54a6('0x51')]=function(_0x54609c,_0xe64254){return db[_0x54a6('0x38')][_0x54a6('0x51')](_0x54609c[_0x54a6('0x52')],{})[_0x54a6('0x1f')](respondWithResult(_0xe64254,0xc9))['catch'](handleError(_0xe64254,null));};exports[_0x54a6('0x31')]=function(_0x121120,_0x3aa907){if(_0x121120[_0x54a6('0x52')]['id']){delete _0x121120[_0x54a6('0x52')]['id'];}return db[_0x54a6('0x38')][_0x54a6('0x53')]({'where':{'id':_0x121120[_0x54a6('0x4f')]['id']}})[_0x54a6('0x1f')](handleEntityNotFound(_0x3aa907,null))['then'](saveUpdates(_0x121120[_0x54a6('0x52')],null))['then'](respondWithResult(_0x3aa907,null))[_0x54a6('0x4d')](handleError(_0x3aa907,null));};exports[_0x54a6('0x32')]=function(_0x5f5d8e,_0xee59a1){return db['Dynamics365Account'][_0x54a6('0x53')]({'where':{'id':_0x5f5d8e['params']['id']}})['then'](handleEntityNotFound(_0xee59a1,null))['then'](removeEntity(_0xee59a1,null))[_0x54a6('0x4d')](handleError(_0xee59a1,null));};exports[_0x54a6('0x54')]=function(_0x3f596a,_0x278f38,_0x542bb3){var _0x310703={};var _0x1d0e0a={};var _0x51a451;var _0x7455b5;return db[_0x54a6('0x38')][_0x54a6('0x55')]({'where':{'id':_0x3f596a[_0x54a6('0x4f')]['id']}})[_0x54a6('0x1f')](handleEntityNotFound(_0x278f38,null))[_0x54a6('0x1f')](function(_0x13cf03){if(_0x13cf03){_0x51a451=_0x13cf03;_0x1d0e0a[_0x54a6('0x3b')]=_[_0x54a6('0x3c')](db['Dynamics365Configuration'][_0x54a6('0x39')]);_0x1d0e0a[_0x54a6('0x40')]=_[_0x54a6('0x3c')](_0x3f596a[_0x54a6('0x40')]);_0x1d0e0a[_0x54a6('0x3d')]=_[_0x54a6('0x3e')](_0x1d0e0a[_0x54a6('0x3b')],_0x1d0e0a[_0x54a6('0x40')]);_0x310703[_0x54a6('0x41')]=_[_0x54a6('0x3e')](_0x1d0e0a['model'],qs[_0x54a6('0x3f')](_0x3f596a[_0x54a6('0x40')][_0x54a6('0x3f')]));_0x310703[_0x54a6('0x41')]=_0x310703[_0x54a6('0x41')]['length']?_0x310703[_0x54a6('0x41')]:_0x1d0e0a[_0x54a6('0x3b')];_0x310703['order']=qs[_0x54a6('0x46')](_0x3f596a[_0x54a6('0x40')][_0x54a6('0x46')]);_0x310703[_0x54a6('0x47')]=qs[_0x54a6('0x3d')](_['pick'](_0x3f596a[_0x54a6('0x40')],_0x1d0e0a[_0x54a6('0x3d')]));if(_0x3f596a[_0x54a6('0x40')][_0x54a6('0x48')]){_0x310703[_0x54a6('0x47')]=_[_0x54a6('0x49')](_0x310703['where'],{'$or':_['map'](_0x310703['attributes'],function(_0x5f1d0b){var _0x5f1fbe={};_0x5f1fbe[_0x5f1d0b]={'$like':'%'+_0x3f596a[_0x54a6('0x40')][_0x54a6('0x48')]+'%'};return _0x5f1fbe;})});}_0x310703=_['merge']({},_0x310703,_0x3f596a[_0x54a6('0x56')]);return _0x51a451[_0x54a6('0x54')](_0x310703);}})[_0x54a6('0x1f')](function(_0xe91e48){if(_0xe91e48){_0x7455b5=_0xe91e48[_0x54a6('0x42')];if(!_0x3f596a[_0x54a6('0x40')][_0x54a6('0x57')](_0x54a6('0x43'))){_0x310703['limit']=qs[_0x54a6('0x44')](_0x3f596a[_0x54a6('0x40')][_0x54a6('0x44')]);_0x310703['offset']=qs[_0x54a6('0x2c')](_0x3f596a[_0x54a6('0x40')][_0x54a6('0x2c')]);}return _0x51a451[_0x54a6('0x54')](_0x310703);}})['then'](function(_0x1c452a){if(_0x1c452a){return _0x1c452a?{'count':_0x7455b5,'rows':_0x1c452a}:null;}})['then'](respondWithResult(_0x278f38,null))[_0x54a6('0x4d')](handleError(_0x278f38,null));};exports['addConfiguration']=function(_0x479481,_0x45ebe1,_0x37c360){if(_0x479481[_0x54a6('0x52')]['id']){delete _0x479481[_0x54a6('0x52')]['id'];}return db[_0x54a6('0x38')][_0x54a6('0x55')]({'where':{'id':_0x479481['params']['id']}})['then'](handleEntityNotFound(_0x45ebe1,null))[_0x54a6('0x1f')](function(_0xc017df){if(_0xc017df){_0x479481[_0x54a6('0x52')][_0x54a6('0x58')]=_0xc017df['id'];_0x479481[_0x54a6('0x52')][_0x54a6('0x59')]=integrations[_0x54a6('0x5a')](_0x479481[_0x54a6('0x52')][_0x54a6('0x5b')],_0x479481[_0x54a6('0x52')][_0x54a6('0x3a')]);_0x479481[_0x54a6('0x52')][_0x54a6('0x5c')]=integrations[_0x54a6('0x5d')](_0x479481[_0x54a6('0x52')][_0x54a6('0x5b')],_0x479481[_0x54a6('0x52')]['type']);return db['Dynamics365Configuration'][_0x54a6('0x51')](_0x479481[_0x54a6('0x52')],{'include':[{'model':db[_0x54a6('0x5e')],'as':_0x54a6('0x59')},{'model':db['Dynamics365Field'],'as':_0x54a6('0x5c')}]});}return null;})[_0x54a6('0x1f')](respondWithResult(_0x45ebe1,null))[_0x54a6('0x4d')](handleError(_0x45ebe1,null));};exports[_0x54a6('0x5f')]=function(_0x1cc009,_0x5808f6,_0x2c384a){var _0x1417e4=_0x1cc009['query'][_0x54a6('0x60')];var _0x166e73=_0x1417e4==='incident'?'Incident':_0x54a6('0x61');var _0x149d83='';var _0x414899='';var _0x506839='';var _0x442522='';var _0x1c9cf7='';var _0x18259d='';var _0x53dd47='';var _0x6cd57f='';var _0x14b83f=[_0x54a6('0x62'),_0x54a6('0x63'),'customerid',_0x54a6('0x64'),_0x54a6('0x65'),_0x54a6('0x66'),_0x54a6('0x67'),'regardingobjectid',_0x54a6('0x68'),_0x54a6('0x69')];var _0x6fc229=['accountidname',_0x54a6('0x6a'),'actualserviceunits',_0x54a6('0x6b'),_0x54a6('0x6c'),_0x54a6('0x6d'),_0x54a6('0x6e'),'contractidname',_0x54a6('0x6f'),'createdbyexternalpartyyominame',_0x54a6('0x70'),'createdbyyominame',_0x54a6('0x71'),_0x54a6('0x72'),_0x54a6('0x73'),_0x54a6('0x74'),'customeridtype',_0x54a6('0x75'),'emailaddress',_0x54a6('0x76'),'entityimage_timestamp',_0x54a6('0x77'),_0x54a6('0x78'),_0x54a6('0x79'),_0x54a6('0x7a'),_0x54a6('0x7b'),'importsequencenumber',_0x54a6('0x7c'),_0x54a6('0x7d'),_0x54a6('0x7e'),_0x54a6('0x7f'),_0x54a6('0x80'),_0x54a6('0x81'),_0x54a6('0x82'),_0x54a6('0x83'),_0x54a6('0x84'),_0x54a6('0x85'),_0x54a6('0x86'),'msdyn_incidenttypename',_0x54a6('0x87'),_0x54a6('0x88'),'onholdtime',_0x54a6('0x89'),'owneridname','owneridtype',_0x54a6('0x8a'),_0x54a6('0x8b'),_0x54a6('0x8c'),_0x54a6('0x8d'),'prioritycodename',_0x54a6('0x8e'),_0x54a6('0x8f'),_0x54a6('0x90'),_0x54a6('0x91'),_0x54a6('0x92'),_0x54a6('0x93'),_0x54a6('0x94'),'sentimentvalue',_0x54a6('0x95'),_0x54a6('0x96'),'socialprofileidname',_0x54a6('0x97'),_0x54a6('0x98'),'subjectidname',_0x54a6('0x99'),_0x54a6('0x9a'),'transactioncurrencyidname','traversedpath',_0x54a6('0x9b'),_0x54a6('0x9c')];var _0x14eaef=_0x14b83f[_0x54a6('0x9d')](_0x6fc229);return db[_0x54a6('0x38')][_0x54a6('0x55')]({'where':{'id':_0x1cc009[_0x54a6('0x4f')]['id']},'attributes':['id','username','password','remoteUri','tenantId','clientId',_0x54a6('0x9e')]})[_0x54a6('0x1f')](handleEntityNotFound(_0x5808f6,null))[_0x54a6('0x1f')](function(_0x5810ef){if(_0x5810ef){_0x6cd57f=_0x5810ef[_0x54a6('0x9f')];var _0x21c91a=_0x6cd57f[_0x54a6('0xa0')](-0x1);if(_0x21c91a==='/'){_0x6cd57f=_0x6cd57f['substring'](0x0,_0x6cd57f['lastIndexOf'](_0x21c91a));}_0x53dd47=util[_0x54a6('0xa1')](_0x54a6('0xa2'),_0x6cd57f);var _0x2c7083={'method':_0x54a6('0xa3'),'uri':_0x54a6('0xa4')+_0x5810ef[_0x54a6('0xa5')]+'/oauth2/token','form':{'client_id':_0x5810ef[_0x54a6('0xa6')],'resource':_0x6cd57f,'username':_0x5810ef[_0x54a6('0xa7')],'password':_0x5810ef[_0x54a6('0xa8')],'grant_type':_0x54a6('0xa8'),'client_secret':_0x5810ef[_0x54a6('0x9e')]},'json':!![]};return rp(_0x2c7083);}})[_0x54a6('0x1f')](function(_0xe16ed6){_0x18259d=_0xe16ed6[_0x54a6('0xa9')];var _0xa6ec1b={'method':_0x54a6('0xaa'),'uri':encodeURI(_0x53dd47+'EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27'+_0x166e73+'\x27'),'headers':{'Authorization':_0x54a6('0xab')+_0x18259d,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0xa6ec1b);})['then'](function(_0x2ab472){var _0x127b23=_0x2ab472[_0x54a6('0xac')][0x0];var _0x5d0d7b=_0x127b23['MetadataId'];var _0x250cee={'method':'GET','uri':_0x53dd47+_0x54a6('0xad')+_0x5d0d7b+_0x54a6('0xae'),'headers':{'Authorization':_0x54a6('0xab')+_0x18259d,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x250cee);})[_0x54a6('0x1f')](function(_0x3341f8){_0x149d83=_0x3341f8;_0x414899=_0x149d83[_0x54a6('0xaf')];_0x414899=_[_0x54a6('0xb0')](_0x414899,function(_0x59b93d){return!_0x14eaef['includes'](_0x59b93d['LogicalName']);});var _0x3b0f59=[];var _0x1fdeaf=[];_0x414899[_0x54a6('0xb1')](function(_0x20136f){if(_0x20136f[_0x54a6('0xb2')]){var _0x19585d=_0x20136f[_0x54a6('0xb2')][_0x54a6('0xb3')](_0x20136f['@odata.type']['lastIndexOf']('.')+0x1);if(_0x19585d===_0x54a6('0xb4')){_0x3b0f59[_0x54a6('0xb5')](getSelectList(_0x53dd47,_0x1417e4,_0x1fdeaf,_0x149d83[_0x54a6('0xb6')],_0x20136f[_0x54a6('0xb6')],_0x18259d));}}});return Promise[_0x54a6('0xb7')](_0x3b0f59);})[_0x54a6('0x1f')](function(_0x233233){_0x506839=_0x233233[0x0];var _0x538218=[];var _0xdcc303=[];_0x414899[_0x54a6('0xb1')](function(_0x73089c){if(!_[_0x54a6('0xb8')](_0x73089c['@odata.type'])){var _0x3a6e94=_0x73089c[_0x54a6('0xb2')][_0x54a6('0xb3')](_0x73089c['@odata.type'][_0x54a6('0xb9')]('.')+0x1);if(_0x3a6e94==='BooleanAttributeMetadata'){_0x538218[_0x54a6('0xb5')](getBooleanList(_0x53dd47,_0x1417e4,_0xdcc303,_0x149d83[_0x54a6('0xb6')],_0x73089c[_0x54a6('0xb6')],_0x18259d));}}});return Promise[_0x54a6('0xb7')](_0x538218);})[_0x54a6('0x1f')](function(_0x120508){_0x442522=_0x120508[0x0];var _0x3f1764=[];var _0x28bc8b=[];_0x414899[_0x54a6('0xb1')](function(_0x43ff25){if(_0x43ff25[_0x54a6('0xb2')]){var _0x54e351=_0x43ff25[_0x54a6('0xb2')][_0x54a6('0xb3')](_0x43ff25[_0x54a6('0xb2')][_0x54a6('0xb9')]('.')+0x1);if(_0x54e351==='StringAttributeMetadata'||_0x54e351===_0x54a6('0xba')||_0x54e351===_0x54a6('0xbb')||_0x54e351===_0x54a6('0xbc')||_0x54e351==='MemoAttributeMetadata'||_0x54e351===_0x54a6('0xbd')||_0x54e351===_0x54a6('0xbe')||_0x54e351==='EntityNameAttributeMetadata'||_0x54e351==='StateAttributeMetadata'||_0x54e351===_0x54a6('0xbf')){_0x3f1764[_0x54a6('0xb5')](getInputList(_0x53dd47,_0x1417e4,_0x54e351,_0x28bc8b,_0x149d83[_0x54a6('0xb6')],_0x43ff25[_0x54a6('0xb6')],_0x18259d));}}});return Promise[_0x54a6('0xb7')](_0x3f1764);})[_0x54a6('0x1f')](function(_0x5399fd){_0x1c9cf7=_0x5399fd[0x0];var _0x15c22e=_0x506839['concat'](_0x442522)[_0x54a6('0x9d')](_0x1c9cf7);var _0x168bad={'count':_0x15c22e[_0x54a6('0x42')],'rows':_0x15c22e};return _0x168bad;})[_0x54a6('0x1f')](respondWithResult(_0x5808f6,null))['catch'](function(_0x44da96){var _0x2ee7f0=_0x1cc009[_0x54a6('0x40')][_0x54a6('0x1d')]?0x1f4:_0x44da96[_0x54a6('0xc0')]||0x1f4;logger['error'](_0x44da96['stack']);delete _0x44da96[_0x54a6('0x34')];if(_0x2ee7f0===0x191){_0x2ee7f0=0x190;}_0x5808f6['status'](_0x2ee7f0)[_0x54a6('0x35')](_0x1cc009[_0x54a6('0x40')]['test']?{'message':_0x54a6('0xc1'),'statusCode':_0x44da96[_0x54a6('0xc0')]}:_0x44da96);});};function getSelectList(_0x14b339,_0x9f931a,_0x595a8d,_0x45fd78,_0x56d489,_0x2ce394){var _0x2f35b8={'method':'GET','uri':_0x14b339+'EntityDefinitions('+_0x45fd78+')/Attributes('+_0x56d489+_0x54a6('0xc2')+'$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','headers':{'Authorization':_0x54a6('0xab')+_0x2ce394,'If-None-Match':null,'OData-Version':_0x54a6('0xc3')},'json':!![]};return rp(_0x2f35b8)[_0x54a6('0x1f')](function(_0x2a3f2f){var _0x2ac3fb=[];var _0x4884e4=_0x2a3f2f[_0x54a6('0xc4')][_0x54a6('0xc5')];_0x4884e4[_0x54a6('0xb1')](function(_0x17705b){_0x2ac3fb[_0x54a6('0xb5')]({'name':_0x17705b[_0x54a6('0xc6')]['UserLocalizedLabel']['Label'],'value':String(_0x17705b[_0x54a6('0xc7')])});});var _0x95a418={'id':_0x9f931a+'_'+_0x2a3f2f[_0x54a6('0xc8')],'name':_0x2a3f2f[_0x54a6('0xc9')][_0x54a6('0xca')]['Label'],'custom':![],'options':_0x2ac3fb};_0x595a8d[_0x54a6('0xb5')](_0x95a418);return _0x595a8d;});}function getBooleanList(_0x50cd1e,_0x22518c,_0x2bed49,_0x537f70,_0x39e717,_0x3a1f23){var _0x2c5937={'method':'GET','uri':_0x50cd1e+_0x54a6('0xad')+_0x537f70+_0x54a6('0xcb')+_0x39e717+_0x54a6('0xcc'),'headers':{'Authorization':_0x54a6('0xab')+_0x3a1f23,'If-None-Match':null,'OData-Version':_0x54a6('0xc3')},'json':!![]};return rp(_0x2c5937)[_0x54a6('0x1f')](function(_0x58632b){var _0x2291eb=[];_0x2291eb[_0x54a6('0xb5')]({'name':_0x58632b[_0x54a6('0xc4')][_0x54a6('0xcd')][_0x54a6('0xc6')][_0x54a6('0xca')][_0x54a6('0xc6')],'value':_0x54a6('0xce')},{'name':_0x58632b[_0x54a6('0xc4')][_0x54a6('0xcf')][_0x54a6('0xc6')][_0x54a6('0xca')][_0x54a6('0xc6')],'value':_0x54a6('0xd0')});var _0x309019={'id':_0x22518c+'_'+_0x58632b[_0x54a6('0xc8')],'name':_0x58632b[_0x54a6('0xc9')][_0x54a6('0xca')][_0x54a6('0xc6')],'custom':![],'options':_0x2291eb};_0x2bed49['push'](_0x309019);return _0x2bed49;});}function getInputList(_0xb6ca30,_0x4dc1be,_0x3c70bc,_0x40234c,_0xdc3cec,_0x173d6f,_0x2d4d17){var _0x1fcfd8={'method':_0x54a6('0xaa'),'uri':_0xb6ca30+_0x54a6('0xad')+_0xdc3cec+_0x54a6('0xcb')+_0x173d6f+_0x54a6('0xd1')+_0x3c70bc+_0x54a6('0xd2'),'headers':{'Authorization':_0x54a6('0xab')+_0x2d4d17,'If-None-Match':null,'OData-Version':_0x54a6('0xc3')},'json':!![]};return rp(_0x1fcfd8)['then'](function(_0x56b33b){var _0x148f14={'id':_0x4dc1be+'_'+_0x56b33b[_0x54a6('0xc8')],'name':_0x56b33b[_0x54a6('0xc9')]['UserLocalizedLabel']?_0x56b33b[_0x54a6('0xc9')][_0x54a6('0xca')][_0x54a6('0xc6')]:_0x56b33b[_0x54a6('0xc8')],'custom':![],'options':[]};_0x40234c[_0x54a6('0xb5')](_0x148f14);return _0x40234c;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index 4e8c8f7..411a809 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 _0x5dc1=['bluebird','request-promise','path','../../config/environment','./intDynamics365Account.attributes','exports','define','lodash','api'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x5dc1,0x1c0));var _0x15dc=function(_0x22a02a,_0x1f365a){_0x22a02a=_0x22a02a-0x0;var _0x5bf4d5=_0x5dc1[_0x22a02a];return _0x5bf4d5;};'use strict';var _=require(_0x15dc('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x15dc('0x1'));var moment=require('moment');var BPromise=require(_0x15dc('0x2'));var rp=require(_0x15dc('0x3'));var fs=require('fs');var path=require(_0x15dc('0x4'));var rimraf=require('rimraf');var config=require(_0x15dc('0x5'));var attributes=require(_0x15dc('0x6'));var integrations=require('../../components/integrations/configuration');module[_0x15dc('0x7')]=function(_0x5e6e09,_0x2b2b9f){return _0x5e6e09[_0x15dc('0x8')]('Dynamics365Account',attributes,{'tableName':'int_dynamics365_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x96f8=['util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','Dynamics365Account','int_dynamics365_accounts'];(function(_0x24ca74,_0x33dcb8){var _0x1b4711=function(_0x45fbca){while(--_0x45fbca){_0x24ca74['push'](_0x24ca74['shift']());}};_0x1b4711(++_0x33dcb8);}(_0x96f8,0x12b));var _0x896f=function(_0x221584,_0x79fc1d){_0x221584=_0x221584-0x0;var _0x329e3e=_0x96f8[_0x221584];return _0x329e3e;};'use strict';var _=require('lodash');var util=require(_0x896f('0x0'));var logger=require(_0x896f('0x1'))(_0x896f('0x2'));var moment=require(_0x896f('0x3'));var BPromise=require(_0x896f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x896f('0x5'));var rimraf=require(_0x896f('0x6'));var config=require(_0x896f('0x7'));var attributes=require(_0x896f('0x8'));var integrations=require(_0x896f('0x9'));module[_0x896f('0xa')]=function(_0x1d60b6,_0x199d19){return _0x1d60b6['define'](_0x896f('0xb'),attributes,{'tableName':_0x896f('0xc'),'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 6d3d267..af06d0b 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 _0x9505=['message','result','catch','GetDynamics365Account','options','raw','where','limit','map','include','model','attributes','debug','stringify','ShowDynamics365Account','Dynamics365Account','find','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','Dynamics365Account,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x1914cf,_0xc4957b){var _0x157847=function(_0x39eef0){while(--_0x39eef0){_0x1914cf['push'](_0x1914cf['shift']());}};_0x157847(++_0xc4957b);}(_0x9505,0x1e5));var _0x5950=function(_0x3b557a,_0x3a97cf){_0x3b557a=_0x3b557a-0x0;var _0x359f22=_0x9505[_0x3b557a];return _0x359f22;};'use strict';var _=require(_0x5950('0x0'));var util=require(_0x5950('0x1'));var moment=require('moment');var BPromise=require(_0x5950('0x2'));var rs=require(_0x5950('0x3'));var fs=require('fs');var Redis=require(_0x5950('0x4'));var db=require(_0x5950('0x5'))['db'];var utils=require(_0x5950('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x5950('0x7'));var jayson=require(_0x5950('0x8'));var client=jayson[_0x5950('0x9')][_0x5950('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4aa518,_0x4b9478,_0x425d17){return new BPromise(function(_0x362f04,_0x3986aa){return client[_0x5950('0xb')](_0x4aa518,_0x425d17)[_0x5950('0xc')](function(_0x1df039){logger[_0x5950('0xd')](_0x5950('0xe'),_0x4b9478,_0x5950('0xf'));logger['debug'](_0x5950('0x10'),_0x4b9478,_0x5950('0xf'),JSON['stringify'](_0x1df039));if(_0x1df039['error']){if(_0x1df039[_0x5950('0x11')][_0x5950('0x12')]===0x1f4){logger[_0x5950('0x11')](_0x5950('0xe'),_0x4b9478,_0x1df039[_0x5950('0x11')][_0x5950('0x13')]);return _0x3986aa(_0x1df039[_0x5950('0x11')][_0x5950('0x13')]);}logger[_0x5950('0x11')](_0x5950('0xe'),_0x4b9478,_0x1df039[_0x5950('0x11')][_0x5950('0x13')]);return _0x362f04(_0x1df039[_0x5950('0x11')][_0x5950('0x13')]);}else{logger[_0x5950('0xd')](_0x5950('0xe'),_0x4b9478,_0x5950('0xf'));_0x362f04(_0x1df039[_0x5950('0x14')][_0x5950('0x13')]);}})[_0x5950('0x15')](function(_0xface83){logger['error']('Dynamics365Account,\x20%s,\x20%s',_0x4b9478,_0xface83);_0x3986aa(_0xface83);});});}exports[_0x5950('0x16')]=function(_0x40f50c){var _0x3a7821=this;return new Promise(function(_0x5a9530,_0x3e0032){return db['Dynamics365Account']['findAll']({'raw':_0x40f50c[_0x5950('0x17')]?_0x40f50c[_0x5950('0x17')][_0x5950('0x18')]===undefined?!![]:![]:!![],'where':_0x40f50c['options']?_0x40f50c[_0x5950('0x17')][_0x5950('0x19')]||null:null,'attributes':_0x40f50c['options']?_0x40f50c['options']['attributes']||null:null,'limit':_0x40f50c['options']?_0x40f50c[_0x5950('0x17')][_0x5950('0x1a')]||null:null,'include':_0x40f50c[_0x5950('0x17')]?_0x40f50c[_0x5950('0x17')]['include']?_[_0x5950('0x1b')](_0x40f50c[_0x5950('0x17')][_0x5950('0x1c')],function(_0x1bd0ad){return{'model':db[_0x1bd0ad[_0x5950('0x1d')]],'as':_0x1bd0ad['as'],'attributes':_0x1bd0ad[_0x5950('0x1e')],'include':_0x1bd0ad[_0x5950('0x1c')]?_['map'](_0x1bd0ad['include'],function(_0x1b2265){return{'model':db[_0x1b2265[_0x5950('0x1d')]],'as':_0x1b2265['as'],'attributes':_0x1b2265[_0x5950('0x1e')],'include':_0x1b2265[_0x5950('0x1c')]?_[_0x5950('0x1b')](_0x1b2265['include'],function(_0x4a7b22){return{'model':db[_0x4a7b22['model']],'as':_0x4a7b22['as'],'attributes':_0x4a7b22[_0x5950('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x5950('0xc')](function(_0xfc543b){logger[_0x5950('0xd')](_0x5950('0x16'),_0x40f50c);logger[_0x5950('0x1f')](_0x5950('0x16'),_0x40f50c,JSON[_0x5950('0x20')](_0xfc543b));_0x5a9530(_0xfc543b);})[_0x5950('0x15')](function(_0x3a3cc0){logger[_0x5950('0x11')](_0x5950('0x16'),_0x3a3cc0[_0x5950('0x13')],_0x40f50c);_0x3e0032(_0x3a7821[_0x5950('0x11')](0x1f4,_0x3a3cc0[_0x5950('0x13')]));});});};exports[_0x5950('0x21')]=function(_0x10f4d4){var _0x18a8ca=this;return new Promise(function(_0x33aa23,_0x625135){return db[_0x5950('0x22')][_0x5950('0x23')]({'raw':_0x10f4d4[_0x5950('0x17')]?_0x10f4d4[_0x5950('0x17')][_0x5950('0x18')]===undefined?!![]:![]:!![],'where':_0x10f4d4[_0x5950('0x17')]?_0x10f4d4[_0x5950('0x17')][_0x5950('0x19')]||null:null,'attributes':_0x10f4d4['options']?_0x10f4d4[_0x5950('0x17')][_0x5950('0x1e')]||null:null,'include':_0x10f4d4[_0x5950('0x17')]?_0x10f4d4[_0x5950('0x17')][_0x5950('0x1c')]?_['map'](_0x10f4d4['options'][_0x5950('0x1c')],function(_0x3c44fa){return{'model':db[_0x3c44fa['model']],'as':_0x3c44fa['as'],'attributes':_0x3c44fa[_0x5950('0x1e')],'include':_0x3c44fa['include']?_[_0x5950('0x1b')](_0x3c44fa[_0x5950('0x1c')],function(_0x376d9f){return{'model':db[_0x376d9f['model']],'as':_0x376d9f['as'],'attributes':_0x376d9f[_0x5950('0x1e')],'include':_0x376d9f['include']?_[_0x5950('0x1b')](_0x376d9f[_0x5950('0x1c')],function(_0x858e48){return{'model':db[_0x858e48[_0x5950('0x1d')]],'as':_0x858e48['as'],'attributes':_0x858e48['attributes']};}):[]};}):[]};}):[]:[]})[_0x5950('0xc')](function(_0x2d8766){logger[_0x5950('0xd')]('ShowDynamics365Account',_0x10f4d4);logger[_0x5950('0x1f')](_0x5950('0x21'),_0x10f4d4,JSON['stringify'](_0x2d8766));_0x33aa23(_0x2d8766);})['catch'](function(_0x57c990){logger[_0x5950('0x11')](_0x5950('0x21'),_0x57c990[_0x5950('0x13')],_0x10f4d4);_0x625135(_0x18a8ca[_0x5950('0x11')](0x1f4,_0x57c990[_0x5950('0x13')]));});});}; \ No newline at end of file +var _0x202a=['http','request','then','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','Dynamics365Account','findAll','options','raw','where','attributes','limit','map','model','include','GetDynamics365Account','ShowDynamics365Account','find','util','moment','bluebird','ioredis','rpc','../../config/environment'];(function(_0x353a10,_0x13a392){var _0x3d21c7=function(_0x1e317f){while(--_0x1e317f){_0x353a10['push'](_0x353a10['shift']());}};_0x3d21c7(++_0x13a392);}(_0x202a,0xc0));var _0xa202=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x202a[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xa202('0x0'));var moment=require(_0xa202('0x1'));var BPromise=require(_0xa202('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa202('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xa202('0x4'));var config=require(_0xa202('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0xa202('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x4cb469,_0x4f0a59,_0x4d8dcc){return new BPromise(function(_0x216b4c,_0xcd59fb){return client[_0xa202('0x7')](_0x4cb469,_0x4d8dcc)[_0xa202('0x8')](function(_0x572036){logger['info'](_0xa202('0x9'),_0x4f0a59,_0xa202('0xa'));logger[_0xa202('0xb')](_0xa202('0xc'),_0x4f0a59,'request\x20sent',JSON[_0xa202('0xd')](_0x572036));if(_0x572036['error']){if(_0x572036[_0xa202('0xe')][_0xa202('0xf')]===0x1f4){logger[_0xa202('0xe')]('Dynamics365Account,\x20%s,\x20%s',_0x4f0a59,_0x572036[_0xa202('0xe')][_0xa202('0x10')]);return _0xcd59fb(_0x572036[_0xa202('0xe')][_0xa202('0x10')]);}logger[_0xa202('0xe')](_0xa202('0x9'),_0x4f0a59,_0x572036['error'][_0xa202('0x10')]);return _0x216b4c(_0x572036[_0xa202('0xe')][_0xa202('0x10')]);}else{logger[_0xa202('0x11')](_0xa202('0x9'),_0x4f0a59,'request\x20sent');_0x216b4c(_0x572036[_0xa202('0x12')][_0xa202('0x10')]);}})[_0xa202('0x13')](function(_0x3fcc66){logger[_0xa202('0xe')](_0xa202('0x9'),_0x4f0a59,_0x3fcc66);_0xcd59fb(_0x3fcc66);});});}exports['GetDynamics365Account']=function(_0x44a1b6){var _0x53ff78=this;return new Promise(function(_0x130df2,_0x55d39b){return db[_0xa202('0x14')][_0xa202('0x15')]({'raw':_0x44a1b6[_0xa202('0x16')]?_0x44a1b6[_0xa202('0x16')][_0xa202('0x17')]===undefined?!![]:![]:!![],'where':_0x44a1b6['options']?_0x44a1b6[_0xa202('0x16')][_0xa202('0x18')]||null:null,'attributes':_0x44a1b6[_0xa202('0x16')]?_0x44a1b6[_0xa202('0x16')][_0xa202('0x19')]||null:null,'limit':_0x44a1b6['options']?_0x44a1b6[_0xa202('0x16')][_0xa202('0x1a')]||null:null,'include':_0x44a1b6[_0xa202('0x16')]?_0x44a1b6[_0xa202('0x16')]['include']?_[_0xa202('0x1b')](_0x44a1b6[_0xa202('0x16')]['include'],function(_0x565685){return{'model':db[_0x565685[_0xa202('0x1c')]],'as':_0x565685['as'],'attributes':_0x565685[_0xa202('0x19')],'include':_0x565685['include']?_[_0xa202('0x1b')](_0x565685['include'],function(_0x5373b6){return{'model':db[_0x5373b6[_0xa202('0x1c')]],'as':_0x5373b6['as'],'attributes':_0x5373b6[_0xa202('0x19')],'include':_0x5373b6[_0xa202('0x1d')]?_[_0xa202('0x1b')](_0x5373b6[_0xa202('0x1d')],function(_0x1d6704){return{'model':db[_0x1d6704['model']],'as':_0x1d6704['as'],'attributes':_0x1d6704['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4d33fe){logger[_0xa202('0x11')](_0xa202('0x1e'),_0x44a1b6);logger[_0xa202('0xb')]('GetDynamics365Account',_0x44a1b6,JSON[_0xa202('0xd')](_0x4d33fe));_0x130df2(_0x4d33fe);})[_0xa202('0x13')](function(_0xf73ab4){logger[_0xa202('0xe')](_0xa202('0x1e'),_0xf73ab4[_0xa202('0x10')],_0x44a1b6);_0x55d39b(_0x53ff78[_0xa202('0xe')](0x1f4,_0xf73ab4[_0xa202('0x10')]));});});};exports[_0xa202('0x1f')]=function(_0x106b89){var _0x213749=this;return new Promise(function(_0x144afd,_0xb0fda6){return db[_0xa202('0x14')][_0xa202('0x20')]({'raw':_0x106b89[_0xa202('0x16')]?_0x106b89['options'][_0xa202('0x17')]===undefined?!![]:![]:!![],'where':_0x106b89[_0xa202('0x16')]?_0x106b89[_0xa202('0x16')][_0xa202('0x18')]||null:null,'attributes':_0x106b89[_0xa202('0x16')]?_0x106b89[_0xa202('0x16')]['attributes']||null:null,'include':_0x106b89[_0xa202('0x16')]?_0x106b89[_0xa202('0x16')]['include']?_[_0xa202('0x1b')](_0x106b89[_0xa202('0x16')]['include'],function(_0x4c6830){return{'model':db[_0x4c6830['model']],'as':_0x4c6830['as'],'attributes':_0x4c6830[_0xa202('0x19')],'include':_0x4c6830[_0xa202('0x1d')]?_[_0xa202('0x1b')](_0x4c6830[_0xa202('0x1d')],function(_0x2c158c){return{'model':db[_0x2c158c['model']],'as':_0x2c158c['as'],'attributes':_0x2c158c[_0xa202('0x19')],'include':_0x2c158c['include']?_[_0xa202('0x1b')](_0x2c158c[_0xa202('0x1d')],function(_0x130806){return{'model':db[_0x130806['model']],'as':_0x130806['as'],'attributes':_0x130806[_0xa202('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5ebac8){logger[_0xa202('0x11')](_0xa202('0x1f'),_0x106b89);logger['debug'](_0xa202('0x1f'),_0x106b89,JSON['stringify'](_0x5ebac8));_0x144afd(_0x5ebac8);})['catch'](function(_0x20369c){logger[_0xa202('0xe')]('ShowDynamics365Account',_0x20369c[_0xa202('0x10')],_0x106b89);_0xb0fda6(_0x213749[_0xa202('0xe')](0x1f4,_0x20369c[_0xa202('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 75f4579..d736cfb 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 _0xfcbc=['/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','create','put','update','delete','destroy','exports','util','path','connect-timeout','Router','../../components/interaction/service','./intDynamics365Configuration.controller','index','get','/:id','show','/:id/fields','isAuthenticated'];(function(_0xec75c9,_0x360c29){var _0x44ed83=function(_0x1ac323){while(--_0x1ac323){_0xec75c9['push'](_0xec75c9['shift']());}};_0x44ed83(++_0x360c29);}(_0xfcbc,0x154));var _0xcfcb=function(_0x291f8b,_0x3b5591){_0x291f8b=_0x291f8b-0x0;var _0x275171=_0xfcbc[_0x291f8b];return _0x275171;};'use strict';var multer=require('multer');var util=require(_0xcfcb('0x0'));var path=require(_0xcfcb('0x1'));var timeout=require(_0xcfcb('0x2'));var express=require('express');var router=express[_0xcfcb('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xcfcb('0x4'));var config=require('../../config/environment');var controller=require(_0xcfcb('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0xcfcb('0x6')]);router[_0xcfcb('0x7')](_0xcfcb('0x8'),auth['isAuthenticated'](),controller[_0xcfcb('0x9')]);router[_0xcfcb('0x7')](_0xcfcb('0xa'),auth[_0xcfcb('0xb')](),controller['getFields']);router[_0xcfcb('0x7')](_0xcfcb('0xc'),auth[_0xcfcb('0xb')](),controller[_0xcfcb('0xd')]);router[_0xcfcb('0x7')](_0xcfcb('0xe'),auth['isAuthenticated'](),controller[_0xcfcb('0xf')]);router['post']('/',auth[_0xcfcb('0xb')](),controller[_0xcfcb('0x10')]);router[_0xcfcb('0x11')](_0xcfcb('0x8'),auth[_0xcfcb('0xb')](),controller[_0xcfcb('0x12')]);router[_0xcfcb('0x13')](_0xcfcb('0x8'),auth[_0xcfcb('0xb')](),controller[_0xcfcb('0x14')]);module[_0xcfcb('0x15')]=router; \ No newline at end of file +var _0x2c07=['update','delete','/:id','destroy','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','isAuthenticated','index','get','show','/:id/fields','getFields','/:id/subjects','getSubjects','post','create'];(function(_0x1980df,_0x5df061){var _0x516798=function(_0xacae3){while(--_0xacae3){_0x1980df['push'](_0x1980df['shift']());}};_0x516798(++_0x5df061);}(_0x2c07,0x147));var _0x72c0=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x2c07[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x72c0('0x0'));var util=require(_0x72c0('0x1'));var path=require(_0x72c0('0x2'));var timeout=require('connect-timeout');var express=require(_0x72c0('0x3'));var router=express['Router']();var auth=require(_0x72c0('0x4'));var interaction=require(_0x72c0('0x5'));var config=require(_0x72c0('0x6'));var controller=require(_0x72c0('0x7'));router['get']('/',auth[_0x72c0('0x8')](),controller[_0x72c0('0x9')]);router[_0x72c0('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x72c0('0xb')]);router[_0x72c0('0xa')](_0x72c0('0xc'),auth[_0x72c0('0x8')](),controller[_0x72c0('0xd')]);router[_0x72c0('0xa')](_0x72c0('0xe'),auth[_0x72c0('0x8')](),controller[_0x72c0('0xf')]);router['get']('/:id/descriptions',auth[_0x72c0('0x8')](),controller['getDescriptions']);router[_0x72c0('0x10')]('/',auth['isAuthenticated'](),controller[_0x72c0('0x11')]);router['put']('/:id',auth[_0x72c0('0x8')](),controller[_0x72c0('0x12')]);router[_0x72c0('0x13')](_0x72c0('0x14'),auth[_0x72c0('0x8')](),controller[_0x72c0('0x15')]);module[_0x72c0('0x16')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index 5fee704..d6ab2af 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 _0x40b1=['incident','exports','STRING'];(function(_0x18ec2c,_0x177ac5){var _0x484b18=function(_0x492549){while(--_0x492549){_0x18ec2c['push'](_0x18ec2c['shift']());}};_0x484b18(++_0x177ac5);}(_0x40b1,0x1db));var _0x140b=function(_0x27f9be,_0x2ff20b){_0x27f9be=_0x27f9be-0x0;var _0x3e830f=_0x40b1[_0x27f9be];return _0x3e830f;};'use strict';var Sequelize=require('sequelize');module[_0x140b('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x140b('0x1')]},'ticketType':{'type':Sequelize['ENUM'](_0x140b('0x2'),'phonecall'),'defaultValue':_0x140b('0x2')}}; \ No newline at end of file +var _0x6300=['incident','phonecall','exports','STRING'];(function(_0x58e09b,_0x6ef44c){var _0x243038=function(_0x1564bf){while(--_0x1564bf){_0x58e09b['push'](_0x58e09b['shift']());}};_0x243038(++_0x6ef44c);}(_0x6300,0x162));var _0x0630=function(_0x4814ff,_0x73262){_0x4814ff=_0x4814ff-0x0;var _0x4cc09d=_0x6300[_0x4814ff];return _0x4cc09d;};'use strict';var Sequelize=require('sequelize');module[_0x0630('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x0630('0x1')]},'ticketType':{'type':Sequelize['ENUM'](_0x0630('0x2'),_0x0630('0x3')),'defaultValue':_0x0630('0x2')}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index f5174f0..178c456 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 _0xa713=['offset','limit','set','Content-Range','apply','reject','save','destroy','sendStatus','name','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','map','merge','options','Dynamics365Configuration','rows','show','includeAll','include','find','body','update','params','getFields','Dynamics365Field','getSubjects','findOne','nolimit','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','jayson/promise','client','http','test','Sequelize','ValidationError','request','then','request\x20sent','debug','stringify','error','code','Dynamics365Configuration,\x20%s,\x20%s','message','info','result','catch','end','status','json','count'];(function(_0x37db9f,_0x4c93ed){var _0x48fb29=function(_0x5d27a4){while(--_0x5d27a4){_0x37db9f['push'](_0x37db9f['shift']());}};_0x48fb29(++_0x4c93ed);}(_0xa713,0x89));var _0x3a71=function(_0xf3bf1d,_0x442cb7){_0xf3bf1d=_0xf3bf1d-0x0;var _0x2472a6=_0xa713[_0xf3bf1d];return _0x2472a6;};'use strict';var pdf=require(_0x3a71('0x0'));var emlformat=require(_0x3a71('0x1'));var rimraf=require(_0x3a71('0x2'));var zipdir=require(_0x3a71('0x3'));var jsonpatch=require(_0x3a71('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x3a71('0x5'));var Mustache=require(_0x3a71('0x6'));var util=require(_0x3a71('0x7'));var path=require('path');var sox=require(_0x3a71('0x8'));var csv=require(_0x3a71('0x9'));var ejs=require(_0x3a71('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x3a71('0xb'));var crypto=require(_0x3a71('0xc'));var jsforce=require(_0x3a71('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x3a71('0x9'));var querystring=require(_0x3a71('0xe'));var Papa=require('papaparse');var Redis=require(_0x3a71('0xf'));var authService=require(_0x3a71('0x10'));var qs=require(_0x3a71('0x11'));var as=require(_0x3a71('0x12'));var hardwareService=require(_0x3a71('0x13'));var logger=require(_0x3a71('0x14'))(_0x3a71('0x15'));var utils=require(_0x3a71('0x16'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var jayson=require(_0x3a71('0x17'));var client=jayson[_0x3a71('0x18')][_0x3a71('0x19')]({'port':0x232a});function checkPasswordPattern(_0x45e090,_0x51785f,_0x25af3d){if(_0x25af3d){var _0x3c1aa5=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3c1aa5[_0x3a71('0x1a')](_0x51785f)){return _0x45e090;}else{throw new db[(_0x3a71('0x1b'))][(_0x3a71('0x1c'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x45e090;}}function respondWithRpcPromise(_0x36c5c3,_0x12ec76,_0x1fa3f6,_0xfe4e74){return new BPromise(function(_0x438280,_0x5e03ea){var _0x403a5f=_0xfe4e74||client;return _0x403a5f[_0x3a71('0x1d')](_0x36c5c3,_0x1fa3f6)[_0x3a71('0x1e')](function(_0x2e3d55){logger['info']('Dynamics365Configuration,\x20%s,\x20%s',_0x12ec76,_0x3a71('0x1f'));logger[_0x3a71('0x20')]('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0x12ec76,_0x3a71('0x1f'),JSON[_0x3a71('0x21')](_0x2e3d55));if(_0x2e3d55[_0x3a71('0x22')]){if(_0x2e3d55[_0x3a71('0x22')][_0x3a71('0x23')]===0x1f4){logger[_0x3a71('0x22')](_0x3a71('0x24'),_0x12ec76,_0x2e3d55['error'][_0x3a71('0x25')]);return _0x5e03ea(_0x2e3d55[_0x3a71('0x22')][_0x3a71('0x25')]);}logger[_0x3a71('0x22')](_0x3a71('0x24'),_0x12ec76,_0x2e3d55[_0x3a71('0x22')][_0x3a71('0x25')]);return _0x438280(_0x2e3d55[_0x3a71('0x22')]['message']);}else{logger[_0x3a71('0x26')](_0x3a71('0x24'),_0x12ec76,_0x3a71('0x1f'));_0x438280(_0x2e3d55[_0x3a71('0x27')][_0x3a71('0x25')]);}})[_0x3a71('0x28')](function(_0x336d3e){logger[_0x3a71('0x22')](_0x3a71('0x24'),_0x12ec76,_0x336d3e);_0x5e03ea(_0x336d3e);});});}function respondWithStatusCode(_0x37da40,_0x282846){_0x282846=_0x282846||0xcc;return function(_0xd9ac73){if(_0xd9ac73){return _0x37da40['sendStatus'](_0x282846);}return _0x37da40['status'](_0x282846)[_0x3a71('0x29')]();};}function respondWithResult(_0x76d241,_0x3b2e7f){_0x3b2e7f=_0x3b2e7f||0xc8;return function(_0x497a17){if(_0x497a17){return _0x76d241[_0x3a71('0x2a')](_0x3b2e7f)[_0x3a71('0x2b')](_0x497a17);}};}function respondWithFilteredResult(_0x143c8f,_0x238b43){return function(_0x32ef40){if(_0x32ef40){var _0x43565d=_0x32ef40[_0x3a71('0x2c')],_0x339073=_0x238b43[_0x3a71('0x2d')],_0x2a533d=_0x238b43[_0x3a71('0x2d')]+_0x238b43[_0x3a71('0x2e')],_0x494ecc;if(_0x2a533d>=_0x43565d){_0x2a533d=_0x43565d;_0x494ecc=0xc8;}else{_0x494ecc=0xce;}_0x143c8f[_0x3a71('0x2a')](_0x494ecc);return _0x143c8f[_0x3a71('0x2f')](_0x3a71('0x30'),_0x339073+'-'+_0x2a533d+'/'+_0x43565d)[_0x3a71('0x2b')](_0x32ef40);}return null;};}function patchUpdates(_0x439267){return function(_0x35ba99){try{jsonpatch[_0x3a71('0x31')](_0x35ba99,_0x439267,!![]);}catch(_0x330e38){return BPromise[_0x3a71('0x32')](_0x330e38);}return _0x35ba99[_0x3a71('0x33')]();};}function saveUpdates(_0x1bea3,_0x459805){return function(_0x2440ed){if(_0x2440ed){return _0x2440ed['update'](_0x1bea3)[_0x3a71('0x1e')](function(_0xe83b59){return _0xe83b59;});}return null;};}function removeEntity(_0x8e4370,_0x334123){return function(_0x86cf4e){if(_0x86cf4e){return _0x86cf4e[_0x3a71('0x34')]()[_0x3a71('0x1e')](function(){_0x8e4370['status'](0xcc)[_0x3a71('0x29')]();});}};}function handleEntityNotFound(_0x419939,_0xa570dd){return function(_0x253f9a){if(!_0x253f9a){_0x419939[_0x3a71('0x35')](0x194);}return _0x253f9a;};}function handleError(_0x1eac89,_0x13f5a1){_0x13f5a1=_0x13f5a1||0x1f4;return function(_0x1e7456){logger['error'](_0x1e7456['stack']);if(_0x1e7456[_0x3a71('0x36')]){delete _0x1e7456[_0x3a71('0x36')];}_0x1eac89[_0x3a71('0x2a')](_0x13f5a1)['send'](_0x1e7456);};}exports['index']=function(_0x33b3ea,_0x30e72a){var _0x1cef9c={},_0x2b1dd1={},_0x5143a1={'count':0x0,'rows':[]};var _0x4a37ec=_['map'](db['Dynamics365Configuration'][_0x3a71('0x37')],function(_0x2982b8){return{'name':_0x2982b8[_0x3a71('0x38')],'type':_0x2982b8[_0x3a71('0x39')][_0x3a71('0x3a')]};});_0x2b1dd1[_0x3a71('0x3b')]=_['map'](_0x4a37ec,_0x3a71('0x36'));_0x2b1dd1['query']=_[_0x3a71('0x3c')](_0x33b3ea[_0x3a71('0x3d')]);_0x2b1dd1[_0x3a71('0x3e')]=_[_0x3a71('0x3f')](_0x2b1dd1['model'],_0x2b1dd1[_0x3a71('0x3d')]);_0x1cef9c[_0x3a71('0x40')]=_[_0x3a71('0x3f')](_0x2b1dd1[_0x3a71('0x3b')],qs[_0x3a71('0x41')](_0x33b3ea[_0x3a71('0x3d')][_0x3a71('0x41')]));_0x1cef9c['attributes']=_0x1cef9c['attributes'][_0x3a71('0x42')]?_0x1cef9c[_0x3a71('0x40')]:_0x2b1dd1[_0x3a71('0x3b')];if(!_0x33b3ea['query'][_0x3a71('0x43')]('nolimit')){_0x1cef9c['limit']=qs[_0x3a71('0x2e')](_0x33b3ea['query']['limit']);_0x1cef9c[_0x3a71('0x2d')]=qs['offset'](_0x33b3ea['query'][_0x3a71('0x2d')]);}_0x1cef9c[_0x3a71('0x44')]=qs['sort'](_0x33b3ea[_0x3a71('0x3d')][_0x3a71('0x45')]);_0x1cef9c[_0x3a71('0x46')]=qs['filters'](_[_0x3a71('0x47')](_0x33b3ea[_0x3a71('0x3d')],_0x2b1dd1[_0x3a71('0x3e')]));if(_0x33b3ea['query'][_0x3a71('0x48')]){_0x1cef9c['where']=_['merge'](_0x1cef9c[_0x3a71('0x46')],{'$or':_[_0x3a71('0x49')](_0x4a37ec,function(_0x49fc19){if(_0x49fc19[_0x3a71('0x39')]!=='VIRTUAL'){var _0x3f49b5={};_0x3f49b5[_0x49fc19[_0x3a71('0x36')]]={'$like':'%'+_0x33b3ea[_0x3a71('0x3d')][_0x3a71('0x48')]+'%'};return _0x3f49b5;}})});}_0x1cef9c=_[_0x3a71('0x4a')]({},_0x1cef9c,_0x33b3ea[_0x3a71('0x4b')]);var _0x1f3908={'where':_0x1cef9c[_0x3a71('0x46')]};return db[_0x3a71('0x4c')][_0x3a71('0x2c')](_0x1f3908)[_0x3a71('0x1e')](function(_0x5c078b){_0x5143a1[_0x3a71('0x2c')]=_0x5c078b;if(_0x33b3ea[_0x3a71('0x3d')]['includeAll']){_0x1cef9c['include']=[{'all':!![]}];}return db[_0x3a71('0x4c')]['findAll'](_0x1cef9c);})[_0x3a71('0x1e')](function(_0x1e8f84){_0x5143a1[_0x3a71('0x4d')]=_0x1e8f84;return _0x5143a1;})[_0x3a71('0x1e')](respondWithFilteredResult(_0x30e72a,_0x1cef9c))[_0x3a71('0x28')](handleError(_0x30e72a,null));};exports[_0x3a71('0x4e')]=function(_0x41ebfb,_0x554407){var _0x4e83c7={'raw':![],'where':{'id':_0x41ebfb['params']['id']}},_0x38ff82={};_0x38ff82[_0x3a71('0x3b')]=_[_0x3a71('0x3c')](db[_0x3a71('0x4c')][_0x3a71('0x37')]);_0x38ff82[_0x3a71('0x3d')]=_[_0x3a71('0x3c')](_0x41ebfb[_0x3a71('0x3d')]);_0x38ff82[_0x3a71('0x3e')]=_[_0x3a71('0x3f')](_0x38ff82[_0x3a71('0x3b')],_0x38ff82[_0x3a71('0x3d')]);_0x4e83c7[_0x3a71('0x40')]=_[_0x3a71('0x3f')](_0x38ff82[_0x3a71('0x3b')],qs[_0x3a71('0x41')](_0x41ebfb[_0x3a71('0x3d')][_0x3a71('0x41')]));_0x4e83c7[_0x3a71('0x40')]=_0x4e83c7['attributes'][_0x3a71('0x42')]?_0x4e83c7[_0x3a71('0x40')]:_0x38ff82[_0x3a71('0x3b')];if(_0x41ebfb[_0x3a71('0x3d')][_0x3a71('0x4f')]){_0x4e83c7[_0x3a71('0x50')]=[{'all':!![]}];}_0x4e83c7=_[_0x3a71('0x4a')]({},_0x4e83c7,_0x41ebfb[_0x3a71('0x4b')]);return db[_0x3a71('0x4c')][_0x3a71('0x51')](_0x4e83c7)[_0x3a71('0x1e')](handleEntityNotFound(_0x554407,null))[_0x3a71('0x1e')](respondWithResult(_0x554407,null))[_0x3a71('0x28')](handleError(_0x554407,null));};exports['create']=function(_0x8822be,_0x6b7614){return db[_0x3a71('0x4c')]['create'](_0x8822be[_0x3a71('0x52')],{})[_0x3a71('0x1e')](respondWithResult(_0x6b7614,0xc9))[_0x3a71('0x28')](handleError(_0x6b7614,null));};exports[_0x3a71('0x53')]=function(_0xe57801,_0x60a807){if(_0xe57801[_0x3a71('0x52')]['id']){delete _0xe57801['body']['id'];}return db[_0x3a71('0x4c')][_0x3a71('0x51')]({'where':{'id':_0xe57801['params']['id']}})['then'](handleEntityNotFound(_0x60a807,null))[_0x3a71('0x1e')](saveUpdates(_0xe57801[_0x3a71('0x52')],null))[_0x3a71('0x1e')](respondWithResult(_0x60a807,null))[_0x3a71('0x28')](handleError(_0x60a807,null));};exports[_0x3a71('0x34')]=function(_0x146b8b,_0x26e9d3){return db[_0x3a71('0x4c')][_0x3a71('0x51')]({'where':{'id':_0x146b8b[_0x3a71('0x54')]['id']}})[_0x3a71('0x1e')](handleEntityNotFound(_0x26e9d3,null))[_0x3a71('0x1e')](removeEntity(_0x26e9d3,null))[_0x3a71('0x28')](handleError(_0x26e9d3,null));};exports[_0x3a71('0x55')]=function(_0x160dcc,_0x3e605c,_0x1e4e84){var _0x5795e2={};var _0x7888c3={};var _0x3bb167;var _0x55ed58;return db[_0x3a71('0x4c')]['findOne']({'where':{'id':_0x160dcc[_0x3a71('0x54')]['id']}})[_0x3a71('0x1e')](handleEntityNotFound(_0x3e605c,null))['then'](function(_0x38d3a6){if(_0x38d3a6){_0x3bb167=_0x38d3a6;_0x7888c3[_0x3a71('0x3b')]=_[_0x3a71('0x3c')](db[_0x3a71('0x56')][_0x3a71('0x37')]);_0x7888c3[_0x3a71('0x3d')]=_[_0x3a71('0x3c')](_0x160dcc['query']);_0x7888c3[_0x3a71('0x3e')]=_['intersection'](_0x7888c3[_0x3a71('0x3b')],_0x7888c3[_0x3a71('0x3d')]);_0x5795e2['attributes']=_[_0x3a71('0x3f')](_0x7888c3[_0x3a71('0x3b')],qs['fields'](_0x160dcc[_0x3a71('0x3d')][_0x3a71('0x41')]));_0x5795e2[_0x3a71('0x40')]=_0x5795e2['attributes']['length']?_0x5795e2[_0x3a71('0x40')]:_0x7888c3['model'];_0x5795e2[_0x3a71('0x44')]=qs[_0x3a71('0x45')](_0x160dcc['query'][_0x3a71('0x45')]);_0x5795e2[_0x3a71('0x46')]=qs['filters'](_[_0x3a71('0x47')](_0x160dcc[_0x3a71('0x3d')],_0x7888c3[_0x3a71('0x3e')]));if(_0x160dcc[_0x3a71('0x3d')]['filter']){_0x5795e2[_0x3a71('0x46')]=_[_0x3a71('0x4a')](_0x5795e2[_0x3a71('0x46')],{'$or':_[_0x3a71('0x49')](_0x5795e2[_0x3a71('0x40')],function(_0x3c5c99){var _0xb575f8={};_0xb575f8[_0x3c5c99]={'$like':'%'+_0x160dcc[_0x3a71('0x3d')][_0x3a71('0x48')]+'%'};return _0xb575f8;})});}_0x5795e2=_[_0x3a71('0x4a')]({},_0x5795e2,_0x160dcc[_0x3a71('0x4b')]);return _0x3bb167[_0x3a71('0x55')](_0x5795e2);}})[_0x3a71('0x1e')](function(_0x54341d){if(_0x54341d){_0x55ed58=_0x54341d[_0x3a71('0x42')];if(!_0x160dcc[_0x3a71('0x3d')][_0x3a71('0x43')]('nolimit')){_0x5795e2[_0x3a71('0x2e')]=qs[_0x3a71('0x2e')](_0x160dcc[_0x3a71('0x3d')]['limit']);_0x5795e2['offset']=qs[_0x3a71('0x2d')](_0x160dcc[_0x3a71('0x3d')][_0x3a71('0x2d')]);}return _0x3bb167['getFields'](_0x5795e2);}})[_0x3a71('0x1e')](function(_0xcb7935){if(_0xcb7935){return _0xcb7935?{'count':_0x55ed58,'rows':_0xcb7935}:null;}})[_0x3a71('0x1e')](respondWithResult(_0x3e605c,null))[_0x3a71('0x28')](handleError(_0x3e605c,null));};exports[_0x3a71('0x57')]=function(_0x4fd038,_0x3c9101,_0x277861){var _0x64c5e2={};var _0x337e3c={};var _0x1ada2;var _0x4f4e5e;return db[_0x3a71('0x4c')][_0x3a71('0x58')]({'where':{'id':_0x4fd038[_0x3a71('0x54')]['id']}})[_0x3a71('0x1e')](handleEntityNotFound(_0x3c9101,null))[_0x3a71('0x1e')](function(_0x20183a){if(_0x20183a){_0x1ada2=_0x20183a;_0x337e3c['model']=_[_0x3a71('0x3c')](db['Dynamics365Field']['rawAttributes']);_0x337e3c[_0x3a71('0x3d')]=_['keys'](_0x4fd038[_0x3a71('0x3d')]);_0x337e3c[_0x3a71('0x3e')]=_[_0x3a71('0x3f')](_0x337e3c[_0x3a71('0x3b')],_0x337e3c[_0x3a71('0x3d')]);_0x64c5e2[_0x3a71('0x40')]=_['intersection'](_0x337e3c[_0x3a71('0x3b')],qs['fields'](_0x4fd038[_0x3a71('0x3d')][_0x3a71('0x41')]));_0x64c5e2['attributes']=_0x64c5e2[_0x3a71('0x40')][_0x3a71('0x42')]?_0x64c5e2[_0x3a71('0x40')]:_0x337e3c[_0x3a71('0x3b')];_0x64c5e2[_0x3a71('0x44')]=qs['sort'](_0x4fd038[_0x3a71('0x3d')][_0x3a71('0x45')]);_0x64c5e2[_0x3a71('0x46')]=qs[_0x3a71('0x3e')](_[_0x3a71('0x47')](_0x4fd038[_0x3a71('0x3d')],_0x337e3c[_0x3a71('0x3e')]));if(_0x4fd038[_0x3a71('0x3d')][_0x3a71('0x48')]){_0x64c5e2[_0x3a71('0x46')]=_[_0x3a71('0x4a')](_0x64c5e2['where'],{'$or':_['map'](_0x64c5e2[_0x3a71('0x40')],function(_0x49d057){var _0x51e8e8={};_0x51e8e8[_0x49d057]={'$like':'%'+_0x4fd038[_0x3a71('0x3d')][_0x3a71('0x48')]+'%'};return _0x51e8e8;})});}_0x64c5e2=_['merge']({},_0x64c5e2,_0x4fd038['options']);return _0x1ada2[_0x3a71('0x57')](_0x64c5e2);}})[_0x3a71('0x1e')](function(_0x4f68a4){if(_0x4f68a4){_0x4f4e5e=_0x4f68a4[_0x3a71('0x42')];if(!_0x4fd038['query'][_0x3a71('0x43')](_0x3a71('0x59'))){_0x64c5e2[_0x3a71('0x2e')]=qs[_0x3a71('0x2e')](_0x4fd038[_0x3a71('0x3d')][_0x3a71('0x2e')]);_0x64c5e2[_0x3a71('0x2d')]=qs[_0x3a71('0x2d')](_0x4fd038[_0x3a71('0x3d')][_0x3a71('0x2d')]);}return _0x1ada2[_0x3a71('0x57')](_0x64c5e2);}})[_0x3a71('0x1e')](function(_0x34989d){if(_0x34989d){return _0x34989d?{'count':_0x4f4e5e,'rows':_0x34989d}:null;}})['then'](respondWithResult(_0x3c9101,null))['catch'](handleError(_0x3c9101,null));};exports[_0x3a71('0x5a')]=function(_0x2779f,_0x26668a,_0x32bc58){var _0x36e717={};var _0x4b3362={};var _0x56e1e4;var _0x429823;return db[_0x3a71('0x4c')][_0x3a71('0x58')]({'where':{'id':_0x2779f['params']['id']}})[_0x3a71('0x1e')](handleEntityNotFound(_0x26668a,null))['then'](function(_0x1efe89){if(_0x1efe89){_0x56e1e4=_0x1efe89;_0x4b3362['model']=_['keys'](db[_0x3a71('0x56')][_0x3a71('0x37')]);_0x4b3362[_0x3a71('0x3d')]=_[_0x3a71('0x3c')](_0x2779f['query']);_0x4b3362['filters']=_[_0x3a71('0x3f')](_0x4b3362['model'],_0x4b3362['query']);_0x36e717[_0x3a71('0x40')]=_[_0x3a71('0x3f')](_0x4b3362['model'],qs[_0x3a71('0x41')](_0x2779f[_0x3a71('0x3d')][_0x3a71('0x41')]));_0x36e717[_0x3a71('0x40')]=_0x36e717[_0x3a71('0x40')]['length']?_0x36e717[_0x3a71('0x40')]:_0x4b3362[_0x3a71('0x3b')];_0x36e717[_0x3a71('0x44')]=qs['sort'](_0x2779f['query']['sort']);_0x36e717[_0x3a71('0x46')]=qs[_0x3a71('0x3e')](_[_0x3a71('0x47')](_0x2779f[_0x3a71('0x3d')],_0x4b3362['filters']));if(_0x2779f['query'][_0x3a71('0x48')]){_0x36e717[_0x3a71('0x46')]=_[_0x3a71('0x4a')](_0x36e717[_0x3a71('0x46')],{'$or':_[_0x3a71('0x49')](_0x36e717[_0x3a71('0x40')],function(_0x1f0906){var _0x480d9c={};_0x480d9c[_0x1f0906]={'$like':'%'+_0x2779f[_0x3a71('0x3d')][_0x3a71('0x48')]+'%'};return _0x480d9c;})});}_0x36e717=_['merge']({},_0x36e717,_0x2779f[_0x3a71('0x4b')]);return _0x56e1e4['getDescriptions'](_0x36e717);}})[_0x3a71('0x1e')](function(_0x6dcd5b){if(_0x6dcd5b){_0x429823=_0x6dcd5b[_0x3a71('0x42')];if(!_0x2779f['query'][_0x3a71('0x43')](_0x3a71('0x59'))){_0x36e717[_0x3a71('0x2e')]=qs['limit'](_0x2779f['query'][_0x3a71('0x2e')]);_0x36e717[_0x3a71('0x2d')]=qs[_0x3a71('0x2d')](_0x2779f[_0x3a71('0x3d')][_0x3a71('0x2d')]);}return _0x56e1e4['getDescriptions'](_0x36e717);}})[_0x3a71('0x1e')](function(_0x3f5853){if(_0x3f5853){return _0x3f5853?{'count':_0x429823,'rows':_0x3f5853}:null;}})[_0x3a71('0x1e')](respondWithResult(_0x26668a,null))[_0x3a71('0x28')](handleError(_0x26668a,null));}; \ No newline at end of file +var _0xc375=['html-pdf','eml-format','zip-dir','request-promise','mustache','util','path','to-csv','ejs','lodash','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','jayson/promise','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','error','Dynamics365Configuration,\x20%s,\x20%s','message','result','sendStatus','status','end','count','offset','limit','set','Content-Range','reject','update','destroy','stack','name','send','map','Dynamics365Configuration','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','where','pick','filter','merge','options','includeAll','include','rows','show','create','body','catch','params','find','getFields','rawAttributes','length','sort','Dynamics365Field','getSubjects','nolimit','findOne','getDescriptions'];(function(_0x3fd34a,_0x1a1d52){var _0x34a923=function(_0x2c95a3){while(--_0x2c95a3){_0x3fd34a['push'](_0x3fd34a['shift']());}};_0x34a923(++_0x1a1d52);}(_0xc375,0x1a4));var _0x5c37=function(_0xbb9dbf,_0x5dafa4){_0xbb9dbf=_0xbb9dbf-0x0;var _0x30223c=_0xc375[_0xbb9dbf];return _0x30223c;};'use strict';var pdf=require(_0x5c37('0x0'));var emlformat=require(_0x5c37('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x5c37('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5c37('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x5c37('0x4'));var util=require(_0x5c37('0x5'));var path=require(_0x5c37('0x6'));var sox=require('sox');var csv=require(_0x5c37('0x7'));var ejs=require(_0x5c37('0x8'));var fs=require('fs');var _=require(_0x5c37('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5c37('0xa'));var toCsv=require('to-csv');var querystring=require(_0x5c37('0xb'));var Papa=require('papaparse');var Redis=require(_0x5c37('0xc'));var authService=require(_0x5c37('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x5c37('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5c37('0xf'))(_0x5c37('0x10'));var utils=require('../../config/utils');var config=require(_0x5c37('0x11'));var db=require(_0x5c37('0x12'))['db'];var jayson=require(_0x5c37('0x13'));var client=jayson['client']['http']({'port':0x232a});function checkPasswordPattern(_0x2fb1bb,_0x30b667,_0x265976){if(_0x265976){var _0x4d7526=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4d7526[_0x5c37('0x14')](_0x30b667)){return _0x2fb1bb;}else{throw new db[(_0x5c37('0x15'))][(_0x5c37('0x16'))](_0x5c37('0x17'));}}else{return _0x2fb1bb;}}function respondWithRpcPromise(_0x2c93f8,_0x24c409,_0x492433,_0x5afb45){return new BPromise(function(_0x24d90a,_0x5d4609){var _0x1f8f44=_0x5afb45||client;return _0x1f8f44[_0x5c37('0x18')](_0x2c93f8,_0x492433)[_0x5c37('0x19')](function(_0x53adb5){logger[_0x5c37('0x1a')]('Dynamics365Configuration,\x20%s,\x20%s',_0x24c409,_0x5c37('0x1b'));logger[_0x5c37('0x1c')](_0x5c37('0x1d'),_0x24c409,_0x5c37('0x1b'),JSON['stringify'](_0x53adb5));if(_0x53adb5[_0x5c37('0x1e')]){if(_0x53adb5[_0x5c37('0x1e')]['code']===0x1f4){logger[_0x5c37('0x1e')](_0x5c37('0x1f'),_0x24c409,_0x53adb5[_0x5c37('0x1e')]['message']);return _0x5d4609(_0x53adb5[_0x5c37('0x1e')][_0x5c37('0x20')]);}logger['error'](_0x5c37('0x1f'),_0x24c409,_0x53adb5[_0x5c37('0x1e')][_0x5c37('0x20')]);return _0x24d90a(_0x53adb5[_0x5c37('0x1e')][_0x5c37('0x20')]);}else{logger['info'](_0x5c37('0x1f'),_0x24c409,'request\x20sent');_0x24d90a(_0x53adb5[_0x5c37('0x21')][_0x5c37('0x20')]);}})['catch'](function(_0x40bb0e){logger[_0x5c37('0x1e')](_0x5c37('0x1f'),_0x24c409,_0x40bb0e);_0x5d4609(_0x40bb0e);});});}function respondWithStatusCode(_0x176bfc,_0x493ceb){_0x493ceb=_0x493ceb||0xcc;return function(_0x49c7d9){if(_0x49c7d9){return _0x176bfc[_0x5c37('0x22')](_0x493ceb);}return _0x176bfc[_0x5c37('0x23')](_0x493ceb)[_0x5c37('0x24')]();};}function respondWithResult(_0x43df6c,_0x565c3d){_0x565c3d=_0x565c3d||0xc8;return function(_0x495f56){if(_0x495f56){return _0x43df6c[_0x5c37('0x23')](_0x565c3d)['json'](_0x495f56);}};}function respondWithFilteredResult(_0x131220,_0x5d2f20){return function(_0x502924){if(_0x502924){var _0x455311=_0x502924[_0x5c37('0x25')],_0x4c9ed1=_0x5d2f20[_0x5c37('0x26')],_0x1bcfac=_0x5d2f20[_0x5c37('0x26')]+_0x5d2f20[_0x5c37('0x27')],_0xffd0c6;if(_0x1bcfac>=_0x455311){_0x1bcfac=_0x455311;_0xffd0c6=0xc8;}else{_0xffd0c6=0xce;}_0x131220[_0x5c37('0x23')](_0xffd0c6);return _0x131220[_0x5c37('0x28')](_0x5c37('0x29'),_0x4c9ed1+'-'+_0x1bcfac+'/'+_0x455311)['json'](_0x502924);}return null;};}function patchUpdates(_0x467328){return function(_0x41c333){try{jsonpatch['apply'](_0x41c333,_0x467328,!![]);}catch(_0x419115){return BPromise[_0x5c37('0x2a')](_0x419115);}return _0x41c333['save']();};}function saveUpdates(_0x42dca8,_0x52c0ae){return function(_0x36925d){if(_0x36925d){return _0x36925d[_0x5c37('0x2b')](_0x42dca8)[_0x5c37('0x19')](function(_0x5f36c9){return _0x5f36c9;});}return null;};}function removeEntity(_0x5b45ab,_0x2d0de2){return function(_0x22de6f){if(_0x22de6f){return _0x22de6f[_0x5c37('0x2c')]()['then'](function(){_0x5b45ab[_0x5c37('0x23')](0xcc)[_0x5c37('0x24')]();});}};}function handleEntityNotFound(_0xd1e6e2,_0x7a9016){return function(_0x29e9bf){if(!_0x29e9bf){_0xd1e6e2[_0x5c37('0x22')](0x194);}return _0x29e9bf;};}function handleError(_0x5cffd5,_0x3aa40f){_0x3aa40f=_0x3aa40f||0x1f4;return function(_0x317a39){logger[_0x5c37('0x1e')](_0x317a39[_0x5c37('0x2d')]);if(_0x317a39['name']){delete _0x317a39[_0x5c37('0x2e')];}_0x5cffd5[_0x5c37('0x23')](_0x3aa40f)[_0x5c37('0x2f')](_0x317a39);};}exports['index']=function(_0x4e073d,_0xb5ee5d){var _0x27fa3b={},_0x114fbe={},_0x2b765a={'count':0x0,'rows':[]};var _0x2c0248=_[_0x5c37('0x30')](db[_0x5c37('0x31')]['rawAttributes'],function(_0xfdcd64){return{'name':_0xfdcd64['fieldName'],'type':_0xfdcd64[_0x5c37('0x32')][_0x5c37('0x33')]};});_0x114fbe[_0x5c37('0x34')]=_['map'](_0x2c0248,'name');_0x114fbe[_0x5c37('0x35')]=_[_0x5c37('0x36')](_0x4e073d['query']);_0x114fbe[_0x5c37('0x37')]=_[_0x5c37('0x38')](_0x114fbe[_0x5c37('0x34')],_0x114fbe[_0x5c37('0x35')]);_0x27fa3b['attributes']=_[_0x5c37('0x38')](_0x114fbe[_0x5c37('0x34')],qs[_0x5c37('0x39')](_0x4e073d[_0x5c37('0x35')]['fields']));_0x27fa3b['attributes']=_0x27fa3b[_0x5c37('0x3a')]['length']?_0x27fa3b[_0x5c37('0x3a')]:_0x114fbe[_0x5c37('0x34')];if(!_0x4e073d[_0x5c37('0x35')][_0x5c37('0x3b')]('nolimit')){_0x27fa3b[_0x5c37('0x27')]=qs[_0x5c37('0x27')](_0x4e073d[_0x5c37('0x35')]['limit']);_0x27fa3b['offset']=qs[_0x5c37('0x26')](_0x4e073d[_0x5c37('0x35')]['offset']);}_0x27fa3b[_0x5c37('0x3c')]=qs['sort'](_0x4e073d[_0x5c37('0x35')]['sort']);_0x27fa3b[_0x5c37('0x3d')]=qs[_0x5c37('0x37')](_[_0x5c37('0x3e')](_0x4e073d['query'],_0x114fbe[_0x5c37('0x37')]));if(_0x4e073d[_0x5c37('0x35')][_0x5c37('0x3f')]){_0x27fa3b[_0x5c37('0x3d')]=_['merge'](_0x27fa3b[_0x5c37('0x3d')],{'$or':_[_0x5c37('0x30')](_0x2c0248,function(_0x4da68b){if(_0x4da68b['type']!=='VIRTUAL'){var _0x3e5591={};_0x3e5591[_0x4da68b[_0x5c37('0x2e')]]={'$like':'%'+_0x4e073d[_0x5c37('0x35')][_0x5c37('0x3f')]+'%'};return _0x3e5591;}})});}_0x27fa3b=_[_0x5c37('0x40')]({},_0x27fa3b,_0x4e073d[_0x5c37('0x41')]);var _0x2d061a={'where':_0x27fa3b['where']};return db[_0x5c37('0x31')][_0x5c37('0x25')](_0x2d061a)[_0x5c37('0x19')](function(_0x56eb8a){_0x2b765a[_0x5c37('0x25')]=_0x56eb8a;if(_0x4e073d[_0x5c37('0x35')][_0x5c37('0x42')]){_0x27fa3b[_0x5c37('0x43')]=[{'all':!![]}];}return db[_0x5c37('0x31')]['findAll'](_0x27fa3b);})[_0x5c37('0x19')](function(_0x4ba10c){_0x2b765a[_0x5c37('0x44')]=_0x4ba10c;return _0x2b765a;})[_0x5c37('0x19')](respondWithFilteredResult(_0xb5ee5d,_0x27fa3b))['catch'](handleError(_0xb5ee5d,null));};exports[_0x5c37('0x45')]=function(_0x17f51e,_0x4f57bb){var _0x9cce51={'raw':![],'where':{'id':_0x17f51e['params']['id']}},_0x158f43={};_0x158f43[_0x5c37('0x34')]=_[_0x5c37('0x36')](db[_0x5c37('0x31')]['rawAttributes']);_0x158f43[_0x5c37('0x35')]=_[_0x5c37('0x36')](_0x17f51e[_0x5c37('0x35')]);_0x158f43['filters']=_['intersection'](_0x158f43[_0x5c37('0x34')],_0x158f43[_0x5c37('0x35')]);_0x9cce51[_0x5c37('0x3a')]=_[_0x5c37('0x38')](_0x158f43[_0x5c37('0x34')],qs[_0x5c37('0x39')](_0x17f51e['query'][_0x5c37('0x39')]));_0x9cce51['attributes']=_0x9cce51[_0x5c37('0x3a')]['length']?_0x9cce51[_0x5c37('0x3a')]:_0x158f43[_0x5c37('0x34')];if(_0x17f51e[_0x5c37('0x35')][_0x5c37('0x42')]){_0x9cce51[_0x5c37('0x43')]=[{'all':!![]}];}_0x9cce51=_[_0x5c37('0x40')]({},_0x9cce51,_0x17f51e[_0x5c37('0x41')]);return db['Dynamics365Configuration']['find'](_0x9cce51)[_0x5c37('0x19')](handleEntityNotFound(_0x4f57bb,null))[_0x5c37('0x19')](respondWithResult(_0x4f57bb,null))['catch'](handleError(_0x4f57bb,null));};exports[_0x5c37('0x46')]=function(_0x57c7bd,_0x57ea06){return db[_0x5c37('0x31')][_0x5c37('0x46')](_0x57c7bd[_0x5c37('0x47')],{})[_0x5c37('0x19')](respondWithResult(_0x57ea06,0xc9))[_0x5c37('0x48')](handleError(_0x57ea06,null));};exports[_0x5c37('0x2b')]=function(_0x5cf6bd,_0xc0c8fa){if(_0x5cf6bd['body']['id']){delete _0x5cf6bd[_0x5c37('0x47')]['id'];}return db[_0x5c37('0x31')]['find']({'where':{'id':_0x5cf6bd[_0x5c37('0x49')]['id']}})[_0x5c37('0x19')](handleEntityNotFound(_0xc0c8fa,null))[_0x5c37('0x19')](saveUpdates(_0x5cf6bd[_0x5c37('0x47')],null))[_0x5c37('0x19')](respondWithResult(_0xc0c8fa,null))['catch'](handleError(_0xc0c8fa,null));};exports[_0x5c37('0x2c')]=function(_0x54b7f4,_0x5315e2){return db[_0x5c37('0x31')][_0x5c37('0x4a')]({'where':{'id':_0x54b7f4[_0x5c37('0x49')]['id']}})['then'](handleEntityNotFound(_0x5315e2,null))[_0x5c37('0x19')](removeEntity(_0x5315e2,null))[_0x5c37('0x48')](handleError(_0x5315e2,null));};exports[_0x5c37('0x4b')]=function(_0x45557e,_0x550c42,_0x6d8e68){var _0x16955e={};var _0x24ecb0={};var _0x59d639;var _0x2e4862;return db[_0x5c37('0x31')]['findOne']({'where':{'id':_0x45557e[_0x5c37('0x49')]['id']}})[_0x5c37('0x19')](handleEntityNotFound(_0x550c42,null))[_0x5c37('0x19')](function(_0x5a8921){if(_0x5a8921){_0x59d639=_0x5a8921;_0x24ecb0[_0x5c37('0x34')]=_[_0x5c37('0x36')](db['Dynamics365Field'][_0x5c37('0x4c')]);_0x24ecb0[_0x5c37('0x35')]=_['keys'](_0x45557e[_0x5c37('0x35')]);_0x24ecb0[_0x5c37('0x37')]=_[_0x5c37('0x38')](_0x24ecb0[_0x5c37('0x34')],_0x24ecb0[_0x5c37('0x35')]);_0x16955e[_0x5c37('0x3a')]=_[_0x5c37('0x38')](_0x24ecb0['model'],qs['fields'](_0x45557e[_0x5c37('0x35')]['fields']));_0x16955e[_0x5c37('0x3a')]=_0x16955e[_0x5c37('0x3a')][_0x5c37('0x4d')]?_0x16955e['attributes']:_0x24ecb0[_0x5c37('0x34')];_0x16955e[_0x5c37('0x3c')]=qs[_0x5c37('0x4e')](_0x45557e[_0x5c37('0x35')][_0x5c37('0x4e')]);_0x16955e[_0x5c37('0x3d')]=qs[_0x5c37('0x37')](_[_0x5c37('0x3e')](_0x45557e[_0x5c37('0x35')],_0x24ecb0['filters']));if(_0x45557e['query']['filter']){_0x16955e[_0x5c37('0x3d')]=_[_0x5c37('0x40')](_0x16955e['where'],{'$or':_[_0x5c37('0x30')](_0x16955e[_0x5c37('0x3a')],function(_0x43018e){var _0x3f3990={};_0x3f3990[_0x43018e]={'$like':'%'+_0x45557e[_0x5c37('0x35')][_0x5c37('0x3f')]+'%'};return _0x3f3990;})});}_0x16955e=_[_0x5c37('0x40')]({},_0x16955e,_0x45557e[_0x5c37('0x41')]);return _0x59d639[_0x5c37('0x4b')](_0x16955e);}})[_0x5c37('0x19')](function(_0x341962){if(_0x341962){_0x2e4862=_0x341962[_0x5c37('0x4d')];if(!_0x45557e[_0x5c37('0x35')][_0x5c37('0x3b')]('nolimit')){_0x16955e['limit']=qs[_0x5c37('0x27')](_0x45557e[_0x5c37('0x35')][_0x5c37('0x27')]);_0x16955e[_0x5c37('0x26')]=qs[_0x5c37('0x26')](_0x45557e['query'][_0x5c37('0x26')]);}return _0x59d639[_0x5c37('0x4b')](_0x16955e);}})[_0x5c37('0x19')](function(_0x129d6c){if(_0x129d6c){return _0x129d6c?{'count':_0x2e4862,'rows':_0x129d6c}:null;}})['then'](respondWithResult(_0x550c42,null))[_0x5c37('0x48')](handleError(_0x550c42,null));};exports['getSubjects']=function(_0x26d233,_0x616783,_0x177cbd){var _0x4b4ff2={};var _0x3b701c={};var _0x23739e;var _0x5c28bd;return db['Dynamics365Configuration']['findOne']({'where':{'id':_0x26d233[_0x5c37('0x49')]['id']}})[_0x5c37('0x19')](handleEntityNotFound(_0x616783,null))[_0x5c37('0x19')](function(_0x42272f){if(_0x42272f){_0x23739e=_0x42272f;_0x3b701c[_0x5c37('0x34')]=_[_0x5c37('0x36')](db[_0x5c37('0x4f')][_0x5c37('0x4c')]);_0x3b701c[_0x5c37('0x35')]=_[_0x5c37('0x36')](_0x26d233[_0x5c37('0x35')]);_0x3b701c[_0x5c37('0x37')]=_[_0x5c37('0x38')](_0x3b701c['model'],_0x3b701c['query']);_0x4b4ff2['attributes']=_[_0x5c37('0x38')](_0x3b701c[_0x5c37('0x34')],qs[_0x5c37('0x39')](_0x26d233[_0x5c37('0x35')][_0x5c37('0x39')]));_0x4b4ff2['attributes']=_0x4b4ff2[_0x5c37('0x3a')]['length']?_0x4b4ff2[_0x5c37('0x3a')]:_0x3b701c[_0x5c37('0x34')];_0x4b4ff2['order']=qs[_0x5c37('0x4e')](_0x26d233[_0x5c37('0x35')][_0x5c37('0x4e')]);_0x4b4ff2['where']=qs[_0x5c37('0x37')](_[_0x5c37('0x3e')](_0x26d233[_0x5c37('0x35')],_0x3b701c['filters']));if(_0x26d233[_0x5c37('0x35')][_0x5c37('0x3f')]){_0x4b4ff2[_0x5c37('0x3d')]=_['merge'](_0x4b4ff2['where'],{'$or':_['map'](_0x4b4ff2[_0x5c37('0x3a')],function(_0x37b189){var _0x307f1c={};_0x307f1c[_0x37b189]={'$like':'%'+_0x26d233[_0x5c37('0x35')]['filter']+'%'};return _0x307f1c;})});}_0x4b4ff2=_[_0x5c37('0x40')]({},_0x4b4ff2,_0x26d233[_0x5c37('0x41')]);return _0x23739e[_0x5c37('0x50')](_0x4b4ff2);}})['then'](function(_0x3cd09b){if(_0x3cd09b){_0x5c28bd=_0x3cd09b[_0x5c37('0x4d')];if(!_0x26d233[_0x5c37('0x35')][_0x5c37('0x3b')](_0x5c37('0x51'))){_0x4b4ff2['limit']=qs[_0x5c37('0x27')](_0x26d233[_0x5c37('0x35')][_0x5c37('0x27')]);_0x4b4ff2[_0x5c37('0x26')]=qs['offset'](_0x26d233[_0x5c37('0x35')]['offset']);}return _0x23739e['getSubjects'](_0x4b4ff2);}})[_0x5c37('0x19')](function(_0x533f3b){if(_0x533f3b){return _0x533f3b?{'count':_0x5c28bd,'rows':_0x533f3b}:null;}})['then'](respondWithResult(_0x616783,null))[_0x5c37('0x48')](handleError(_0x616783,null));};exports['getDescriptions']=function(_0x5cbc82,_0x177360,_0xe07408){var _0x1499e1={};var _0x8cc87={};var _0x2ea82e;var _0x413952;return db[_0x5c37('0x31')][_0x5c37('0x52')]({'where':{'id':_0x5cbc82[_0x5c37('0x49')]['id']}})[_0x5c37('0x19')](handleEntityNotFound(_0x177360,null))[_0x5c37('0x19')](function(_0x5129f9){if(_0x5129f9){_0x2ea82e=_0x5129f9;_0x8cc87[_0x5c37('0x34')]=_[_0x5c37('0x36')](db[_0x5c37('0x4f')][_0x5c37('0x4c')]);_0x8cc87['query']=_[_0x5c37('0x36')](_0x5cbc82[_0x5c37('0x35')]);_0x8cc87[_0x5c37('0x37')]=_[_0x5c37('0x38')](_0x8cc87['model'],_0x8cc87[_0x5c37('0x35')]);_0x1499e1['attributes']=_[_0x5c37('0x38')](_0x8cc87[_0x5c37('0x34')],qs[_0x5c37('0x39')](_0x5cbc82[_0x5c37('0x35')][_0x5c37('0x39')]));_0x1499e1[_0x5c37('0x3a')]=_0x1499e1['attributes'][_0x5c37('0x4d')]?_0x1499e1['attributes']:_0x8cc87[_0x5c37('0x34')];_0x1499e1[_0x5c37('0x3c')]=qs[_0x5c37('0x4e')](_0x5cbc82[_0x5c37('0x35')][_0x5c37('0x4e')]);_0x1499e1[_0x5c37('0x3d')]=qs[_0x5c37('0x37')](_[_0x5c37('0x3e')](_0x5cbc82[_0x5c37('0x35')],_0x8cc87['filters']));if(_0x5cbc82['query']['filter']){_0x1499e1[_0x5c37('0x3d')]=_['merge'](_0x1499e1[_0x5c37('0x3d')],{'$or':_[_0x5c37('0x30')](_0x1499e1[_0x5c37('0x3a')],function(_0xe2bc8b){var _0x411ece={};_0x411ece[_0xe2bc8b]={'$like':'%'+_0x5cbc82[_0x5c37('0x35')]['filter']+'%'};return _0x411ece;})});}_0x1499e1=_['merge']({},_0x1499e1,_0x5cbc82[_0x5c37('0x41')]);return _0x2ea82e[_0x5c37('0x53')](_0x1499e1);}})[_0x5c37('0x19')](function(_0x8837f1){if(_0x8837f1){_0x413952=_0x8837f1[_0x5c37('0x4d')];if(!_0x5cbc82[_0x5c37('0x35')]['hasOwnProperty'](_0x5c37('0x51'))){_0x1499e1[_0x5c37('0x27')]=qs[_0x5c37('0x27')](_0x5cbc82[_0x5c37('0x35')][_0x5c37('0x27')]);_0x1499e1[_0x5c37('0x26')]=qs[_0x5c37('0x26')](_0x5cbc82['query'][_0x5c37('0x26')]);}return _0x2ea82e[_0x5c37('0x53')](_0x1499e1);}})[_0x5c37('0x19')](function(_0x1aa8db){if(_0x1aa8db){return _0x1aa8db?{'count':_0x413952,'rows':_0x1aa8db}:null;}})[_0x5c37('0x19')](respondWithResult(_0x177360,null))[_0x5c37('0x48')](handleError(_0x177360,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index 47a3807..e131514 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 _0x0f3c=['define','int_dynamics365_configurations','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports'];(function(_0x454918,_0x1dbc64){var _0x3a814b=function(_0x3d1c39){while(--_0x3d1c39){_0x454918['push'](_0x454918['shift']());}};_0x3a814b(++_0x1dbc64);}(_0x0f3c,0x19a));var _0xc0f3=function(_0x21fe35,_0x28764b){_0x21fe35=_0x21fe35-0x0;var _0x38de04=_0x0f3c[_0x21fe35];return _0x38de04;};'use strict';var _=require(_0xc0f3('0x0'));var util=require('util');var logger=require(_0xc0f3('0x1'))(_0xc0f3('0x2'));var moment=require(_0xc0f3('0x3'));var BPromise=require('bluebird');var rp=require(_0xc0f3('0x4'));var fs=require('fs');var path=require(_0xc0f3('0x5'));var rimraf=require(_0xc0f3('0x6'));var config=require(_0xc0f3('0x7'));var attributes=require(_0xc0f3('0x8'));module[_0xc0f3('0x9')]=function(_0x5296bb,_0x5c8c70){return _0x5296bb[_0xc0f3('0xa')]('Dynamics365Configuration',attributes,{'tableName':_0xc0f3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa33f=['request-promise','path','rimraf','../../config/environment','exports','int_dynamics365_configurations','lodash','../../config/logger','api','moment','bluebird'];(function(_0x53c894,_0x401101){var _0x388d67=function(_0x1214eb){while(--_0x1214eb){_0x53c894['push'](_0x53c894['shift']());}};_0x388d67(++_0x401101);}(_0xa33f,0x95));var _0xfa33=function(_0x344ce1,_0x31157a){_0x344ce1=_0x344ce1-0x0;var _0x4414af=_0xa33f[_0x344ce1];return _0x4414af;};'use strict';var _=require(_0xfa33('0x0'));var util=require('util');var logger=require(_0xfa33('0x1'))(_0xfa33('0x2'));var moment=require(_0xfa33('0x3'));var BPromise=require(_0xfa33('0x4'));var rp=require(_0xfa33('0x5'));var fs=require('fs');var path=require(_0xfa33('0x6'));var rimraf=require(_0xfa33('0x7'));var config=require(_0xfa33('0x8'));var attributes=require('./intDynamics365Configuration.attributes');module[_0xfa33('0x9')]=function(_0x9c7f21,_0x166a59){return _0x9c7f21['define']('Dynamics365Configuration',attributes,{'tableName':_0xfa33('0xa'),'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 8540a23..9166bad 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 _0x8413=['Dynamics365Configuration,\x20%s,\x20%s','debug','request\x20sent','stringify','code','error','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info'];(function(_0x25f0ef,_0x503a06){var _0x1e8f17=function(_0x2a46c6){while(--_0x2a46c6){_0x25f0ef['push'](_0x25f0ef['shift']());}};_0x1e8f17(++_0x503a06);}(_0x8413,0x110));var _0x3841=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x8413[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0x3841('0x0'));var util=require('util');var moment=require(_0x3841('0x1'));var BPromise=require(_0x3841('0x2'));var rs=require(_0x3841('0x3'));var fs=require('fs');var Redis=require(_0x3841('0x4'));var db=require(_0x3841('0x5'))['db'];var utils=require(_0x3841('0x6'));var logger=require(_0x3841('0x7'))(_0x3841('0x8'));var config=require(_0x3841('0x9'));var jayson=require(_0x3841('0xa'));var client=jayson[_0x3841('0xb')][_0x3841('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x43bb43,_0x58ae16,_0x1eb390){return new BPromise(function(_0x17d037,_0x1e65e9){return client['request'](_0x43bb43,_0x1eb390)['then'](function(_0x1660be){logger[_0x3841('0xd')](_0x3841('0xe'),_0x58ae16,'request\x20sent');logger[_0x3841('0xf')]('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0x58ae16,_0x3841('0x10'),JSON[_0x3841('0x11')](_0x1660be));if(_0x1660be['error']){if(_0x1660be['error'][_0x3841('0x12')]===0x1f4){logger[_0x3841('0x13')](_0x3841('0xe'),_0x58ae16,_0x1660be[_0x3841('0x13')][_0x3841('0x14')]);return _0x1e65e9(_0x1660be[_0x3841('0x13')][_0x3841('0x14')]);}logger[_0x3841('0x13')](_0x3841('0xe'),_0x58ae16,_0x1660be[_0x3841('0x13')]['message']);return _0x17d037(_0x1660be[_0x3841('0x13')][_0x3841('0x14')]);}else{logger['info'](_0x3841('0xe'),_0x58ae16,_0x3841('0x10'));_0x17d037(_0x1660be[_0x3841('0x15')][_0x3841('0x14')]);}})['catch'](function(_0x441dd1){logger['error'](_0x3841('0xe'),_0x58ae16,_0x441dd1);_0x1e65e9(_0x441dd1);});});} \ No newline at end of file +var _0xb1ef=['rpc','client','request','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger'];(function(_0x369531,_0x37e699){var _0x5e927f=function(_0x55c3f5){while(--_0x55c3f5){_0x369531['push'](_0x369531['shift']());}};_0x5e927f(++_0x37e699);}(_0xb1ef,0x1d4));var _0xfb1e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xb1ef[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xfb1e('0x0'));var util=require(_0xfb1e('0x1'));var moment=require(_0xfb1e('0x2'));var BPromise=require(_0xfb1e('0x3'));var rs=require(_0xfb1e('0x4'));var fs=require('fs');var Redis=require(_0xfb1e('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xfb1e('0x6'))(_0xfb1e('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xfb1e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3a4bfd,_0x3ceea0,_0x36c0c5){return new BPromise(function(_0x5dae66,_0x25b577){return client[_0xfb1e('0x9')](_0x3a4bfd,_0x36c0c5)[_0xfb1e('0xa')](function(_0xec61bf){logger[_0xfb1e('0xb')](_0xfb1e('0xc'),_0x3ceea0,_0xfb1e('0xd'));logger['debug']('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0x3ceea0,'request\x20sent',JSON[_0xfb1e('0xe')](_0xec61bf));if(_0xec61bf[_0xfb1e('0xf')]){if(_0xec61bf[_0xfb1e('0xf')]['code']===0x1f4){logger[_0xfb1e('0xf')](_0xfb1e('0xc'),_0x3ceea0,_0xec61bf['error']['message']);return _0x25b577(_0xec61bf[_0xfb1e('0xf')][_0xfb1e('0x10')]);}logger[_0xfb1e('0xf')]('Dynamics365Configuration,\x20%s,\x20%s',_0x3ceea0,_0xec61bf[_0xfb1e('0xf')][_0xfb1e('0x10')]);return _0x5dae66(_0xec61bf['error'][_0xfb1e('0x10')]);}else{logger['info'](_0xfb1e('0xc'),_0x3ceea0,_0xfb1e('0xd'));_0x5dae66(_0xec61bf[_0xfb1e('0x11')]['message']);}})[_0xfb1e('0x12')](function(_0xc12dbf){logger[_0xfb1e('0xf')]('Dynamics365Configuration,\x20%s,\x20%s',_0x3ceea0,_0xc12dbf);_0x25b577(_0xc12dbf);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index 7668217..cfed87a 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 _0x39cb=['../../config/environment','./intDynamics365Field.controller','get','isAuthenticated','/:id','show','create','put','destroy','exports','util','path','express','Router','../../components/interaction/service'];(function(_0x1ce018,_0x45f915){var _0x17b309=function(_0x34fbdb){while(--_0x34fbdb){_0x1ce018['push'](_0x1ce018['shift']());}};_0x17b309(++_0x45f915);}(_0x39cb,0x1bd));var _0xb39c=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x39cb[_0xfae23b];return _0x200640;};'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['post']('/',auth['isAuthenticated'](),controller[_0xb39c('0xb')]);router[_0xb39c('0xc')](_0xb39c('0x9'),auth[_0xb39c('0x8')](),controller['update']);router['delete']('/:id',auth[_0xb39c('0x8')](),controller[_0xb39c('0xd')]);module[_0xb39c('0xe')]=router; \ No newline at end of file +var _0x7af2=['get','isAuthenticated','index','/:id','show','post','put','delete','destroy','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7af2,0x119));var _0x27af=function(_0x5749d0,_0x4b3590){_0x5749d0=_0x5749d0-0x0;var _0x2cea6d=_0x7af2[_0x5749d0];return _0x2cea6d;};'use strict';var multer=require('multer');var util=require(_0x27af('0x0'));var path=require(_0x27af('0x1'));var timeout=require(_0x27af('0x2'));var express=require(_0x27af('0x3'));var router=express['Router']();var auth=require(_0x27af('0x4'));var interaction=require(_0x27af('0x5'));var config=require(_0x27af('0x6'));var controller=require(_0x27af('0x7'));router[_0x27af('0x8')]('/',auth[_0x27af('0x9')](),controller[_0x27af('0xa')]);router[_0x27af('0x8')](_0x27af('0xb'),auth['isAuthenticated'](),controller[_0x27af('0xc')]);router[_0x27af('0xd')]('/',auth[_0x27af('0x9')](),controller['create']);router[_0x27af('0xe')](_0x27af('0xb'),auth[_0x27af('0x9')](),controller['update']);router[_0x27af('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x27af('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index 8bfed0a..333a12b 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 _0x83f1=['exports','string','variable','STRING','ENUM','customVariable','BOOLEAN'];(function(_0x21cc4e,_0x24a7ac){var _0x3b7125=function(_0x1f37db){while(--_0x1f37db){_0x21cc4e['push'](_0x21cc4e['shift']());}};_0x3b7125(++_0x24a7ac);}(_0x83f1,0xa8));var _0x183f=function(_0xea96be,_0x19c5b8){_0xea96be=_0xea96be-0x0;var _0x14e76a=_0x83f1[_0xea96be];return _0x14e76a;};'use strict';var Sequelize=require('sequelize');module[_0x183f('0x0')]={'type':{'type':Sequelize['ENUM'](_0x183f('0x1'),_0x183f('0x2'),'customVariable','keyValue'),'defaultValue':_0x183f('0x1')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x183f('0x3')]},'keyType':{'type':Sequelize[_0x183f('0x4')](_0x183f('0x1'),_0x183f('0x2'),_0x183f('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x183f('0x3')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x183f('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x1317=['string','STRING','sequelize','ENUM','variable','customVariable','keyValue'];(function(_0x5d7504,_0x2ba214){var _0x29157a=function(_0x37665d){while(--_0x37665d){_0x5d7504['push'](_0x5d7504['shift']());}};_0x29157a(++_0x2ba214);}(_0x1317,0xa3));var _0x7131=function(_0x52c5d8,_0x3cc0c6){_0x52c5d8=_0x52c5d8-0x0;var _0x2a9487=_0x1317[_0x52c5d8];return _0x2a9487;};'use strict';var Sequelize=require(_0x7131('0x0'));module['exports']={'type':{'type':Sequelize[_0x7131('0x1')]('string',_0x7131('0x2'),_0x7131('0x3'),_0x7131('0x4')),'defaultValue':_0x7131('0x5')},'content':{'type':Sequelize[_0x7131('0x6')]},'key':{'type':Sequelize[_0x7131('0x6')]},'keyType':{'type':Sequelize[_0x7131('0x1')](_0x7131('0x5'),_0x7131('0x2'),_0x7131('0x3'))},'keyContent':{'type':Sequelize[_0x7131('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x7131('0x6')]},'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 0229606..109295f 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 _0x2cd0=['path','sox','to-csv','lodash','squel','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','count','offset','limit','set','Content-Range','json','reject','save','update','then','destroy','end','error','stack','name','send','map','Dynamics365Field','rawAttributes','key','model','query','filters','intersection','fields','attributes','length','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','findAll','rows','catch','params','keys','include','find','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util'];(function(_0x1b650a,_0x41a453){var _0x3ac6b1=function(_0x4eb6f5){while(--_0x4eb6f5){_0x1b650a['push'](_0x1b650a['shift']());}};_0x3ac6b1(++_0x41a453);}(_0x2cd0,0x10f));var _0x02cd=function(_0x3516eb,_0x3aed49){_0x3516eb=_0x3516eb-0x0;var _0xdd93e2=_0x2cd0[_0x3516eb];return _0xdd93e2;};'use strict';var pdf=require(_0x02cd('0x0'));var emlformat=require(_0x02cd('0x1'));var rimraf=require(_0x02cd('0x2'));var zipdir=require(_0x02cd('0x3'));var jsonpatch=require(_0x02cd('0x4'));var rp=require(_0x02cd('0x5'));var moment=require(_0x02cd('0x6'));var BPromise=require(_0x02cd('0x7'));var Mustache=require('mustache');var util=require(_0x02cd('0x8'));var path=require(_0x02cd('0x9'));var sox=require(_0x02cd('0xa'));var csv=require(_0x02cd('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x02cd('0xc'));var squel=require(_0x02cd('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x02cd('0xb'));var querystring=require(_0x02cd('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x02cd('0xf'));var qs=require(_0x02cd('0x10'));var as=require(_0x02cd('0x11'));var hardwareService=require(_0x02cd('0x12'));var logger=require(_0x02cd('0x13'))(_0x02cd('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x02cd('0x15'))['db'];function respondWithStatusCode(_0x21238,_0x1bce6c){_0x1bce6c=_0x1bce6c||0xcc;return function(_0x1c5e82){if(_0x1c5e82){return _0x21238[_0x02cd('0x16')](_0x1bce6c);}return _0x21238[_0x02cd('0x17')](_0x1bce6c)['end']();};}function respondWithResult(_0x251568,_0x52bbe6){_0x52bbe6=_0x52bbe6||0xc8;return function(_0x203e9d){if(_0x203e9d){return _0x251568['status'](_0x52bbe6)['json'](_0x203e9d);}};}function respondWithFilteredResult(_0x51f190,_0x24043b){return function(_0x2cda2c){if(_0x2cda2c){var _0x308ee3=_0x2cda2c[_0x02cd('0x18')],_0x15b6fe=_0x24043b[_0x02cd('0x19')],_0x14ba5c=_0x24043b[_0x02cd('0x19')]+_0x24043b[_0x02cd('0x1a')],_0x177720;if(_0x14ba5c>=_0x308ee3){_0x14ba5c=_0x308ee3;_0x177720=0xc8;}else{_0x177720=0xce;}_0x51f190[_0x02cd('0x17')](_0x177720);return _0x51f190[_0x02cd('0x1b')](_0x02cd('0x1c'),_0x15b6fe+'-'+_0x14ba5c+'/'+_0x308ee3)[_0x02cd('0x1d')](_0x2cda2c);}return null;};}function patchUpdates(_0x6bbe36){return function(_0x216967){try{jsonpatch['apply'](_0x216967,_0x6bbe36,!![]);}catch(_0xb1ecb6){return BPromise[_0x02cd('0x1e')](_0xb1ecb6);}return _0x216967[_0x02cd('0x1f')]();};}function saveUpdates(_0x17c764,_0x822204){return function(_0x33fb48){if(_0x33fb48){return _0x33fb48[_0x02cd('0x20')](_0x17c764)[_0x02cd('0x21')](function(_0x354385){return _0x354385;});}return null;};}function removeEntity(_0x40d43,_0x1736be){return function(_0x54453c){if(_0x54453c){return _0x54453c[_0x02cd('0x22')]()[_0x02cd('0x21')](function(){_0x40d43[_0x02cd('0x17')](0xcc)[_0x02cd('0x23')]();});}};}function handleEntityNotFound(_0x47dc25,_0x28f678){return function(_0x4e127f){if(!_0x4e127f){_0x47dc25[_0x02cd('0x16')](0x194);}return _0x4e127f;};}function handleError(_0x397aba,_0x238696){_0x238696=_0x238696||0x1f4;return function(_0x68b34a){logger[_0x02cd('0x24')](_0x68b34a[_0x02cd('0x25')]);if(_0x68b34a[_0x02cd('0x26')]){delete _0x68b34a['name'];}_0x397aba[_0x02cd('0x17')](_0x238696)[_0x02cd('0x27')](_0x68b34a);};}exports['index']=function(_0x2853e1,_0x560027){var _0x35f785={},_0x490389={},_0x2aa680={'count':0x0,'rows':[]};var _0x3651d4=_[_0x02cd('0x28')](db[_0x02cd('0x29')][_0x02cd('0x2a')],function(_0x256cb5){return{'name':_0x256cb5['fieldName'],'type':_0x256cb5['type'][_0x02cd('0x2b')]};});_0x490389[_0x02cd('0x2c')]=_[_0x02cd('0x28')](_0x3651d4,_0x02cd('0x26'));_0x490389['query']=_['keys'](_0x2853e1[_0x02cd('0x2d')]);_0x490389[_0x02cd('0x2e')]=_[_0x02cd('0x2f')](_0x490389['model'],_0x490389[_0x02cd('0x2d')]);_0x35f785['attributes']=_[_0x02cd('0x2f')](_0x490389['model'],qs[_0x02cd('0x30')](_0x2853e1['query'][_0x02cd('0x30')]));_0x35f785[_0x02cd('0x31')]=_0x35f785[_0x02cd('0x31')][_0x02cd('0x32')]?_0x35f785[_0x02cd('0x31')]:_0x490389['model'];if(!_0x2853e1[_0x02cd('0x2d')]['hasOwnProperty']('nolimit')){_0x35f785[_0x02cd('0x1a')]=qs[_0x02cd('0x1a')](_0x2853e1[_0x02cd('0x2d')][_0x02cd('0x1a')]);_0x35f785['offset']=qs['offset'](_0x2853e1[_0x02cd('0x2d')][_0x02cd('0x19')]);}_0x35f785[_0x02cd('0x33')]=qs[_0x02cd('0x34')](_0x2853e1[_0x02cd('0x2d')][_0x02cd('0x34')]);_0x35f785[_0x02cd('0x35')]=qs['filters'](_[_0x02cd('0x36')](_0x2853e1[_0x02cd('0x2d')],_0x490389[_0x02cd('0x2e')]));if(_0x2853e1[_0x02cd('0x2d')][_0x02cd('0x37')]){_0x35f785[_0x02cd('0x35')]=_[_0x02cd('0x38')](_0x35f785[_0x02cd('0x35')],{'$or':_[_0x02cd('0x28')](_0x3651d4,function(_0x557ded){if(_0x557ded[_0x02cd('0x39')]!==_0x02cd('0x3a')){var _0x20b319={};_0x20b319[_0x557ded[_0x02cd('0x26')]]={'$like':'%'+_0x2853e1[_0x02cd('0x2d')][_0x02cd('0x37')]+'%'};return _0x20b319;}})});}_0x35f785=_[_0x02cd('0x38')]({},_0x35f785,_0x2853e1[_0x02cd('0x3b')]);var _0x3907f9={'where':_0x35f785[_0x02cd('0x35')]};return db[_0x02cd('0x29')][_0x02cd('0x18')](_0x3907f9)['then'](function(_0x368eee){_0x2aa680[_0x02cd('0x18')]=_0x368eee;if(_0x2853e1['query'][_0x02cd('0x3c')]){_0x35f785['include']=[{'all':!![]}];}return db[_0x02cd('0x29')][_0x02cd('0x3d')](_0x35f785);})[_0x02cd('0x21')](function(_0xcd323){_0x2aa680[_0x02cd('0x3e')]=_0xcd323;return _0x2aa680;})[_0x02cd('0x21')](respondWithFilteredResult(_0x560027,_0x35f785))[_0x02cd('0x3f')](handleError(_0x560027,null));};exports['show']=function(_0x2582b6,_0x256644){var _0x248f84={'raw':!![],'where':{'id':_0x2582b6[_0x02cd('0x40')]['id']}},_0x7b44e4={};_0x7b44e4['model']=_[_0x02cd('0x41')](db[_0x02cd('0x29')]['rawAttributes']);_0x7b44e4[_0x02cd('0x2d')]=_[_0x02cd('0x41')](_0x2582b6[_0x02cd('0x2d')]);_0x7b44e4[_0x02cd('0x2e')]=_[_0x02cd('0x2f')](_0x7b44e4['model'],_0x7b44e4[_0x02cd('0x2d')]);_0x248f84['attributes']=_[_0x02cd('0x2f')](_0x7b44e4[_0x02cd('0x2c')],qs[_0x02cd('0x30')](_0x2582b6[_0x02cd('0x2d')]['fields']));_0x248f84[_0x02cd('0x31')]=_0x248f84[_0x02cd('0x31')][_0x02cd('0x32')]?_0x248f84[_0x02cd('0x31')]:_0x7b44e4[_0x02cd('0x2c')];if(_0x2582b6[_0x02cd('0x2d')]['includeAll']){_0x248f84[_0x02cd('0x42')]=[{'all':!![]}];}_0x248f84=_[_0x02cd('0x38')]({},_0x248f84,_0x2582b6[_0x02cd('0x3b')]);return db['Dynamics365Field'][_0x02cd('0x43')](_0x248f84)[_0x02cd('0x21')](handleEntityNotFound(_0x256644,null))['then'](respondWithResult(_0x256644,null))['catch'](handleError(_0x256644,null));};exports[_0x02cd('0x44')]=function(_0x20adc0,_0x439375){return db[_0x02cd('0x29')][_0x02cd('0x44')](_0x20adc0['body'],{})[_0x02cd('0x21')](respondWithResult(_0x439375,0xc9))['catch'](handleError(_0x439375,null));};exports[_0x02cd('0x20')]=function(_0x1d91ca,_0x454be5){if(_0x1d91ca['body']['id']){delete _0x1d91ca[_0x02cd('0x45')]['id'];}return db[_0x02cd('0x29')][_0x02cd('0x43')]({'where':{'id':_0x1d91ca[_0x02cd('0x40')]['id']}})[_0x02cd('0x21')](handleEntityNotFound(_0x454be5,null))[_0x02cd('0x21')](saveUpdates(_0x1d91ca[_0x02cd('0x45')],null))[_0x02cd('0x21')](respondWithResult(_0x454be5,null))[_0x02cd('0x3f')](handleError(_0x454be5,null));};exports[_0x02cd('0x22')]=function(_0x4f0d50,_0x39d0e0){return db[_0x02cd('0x29')][_0x02cd('0x43')]({'where':{'id':_0x4f0d50[_0x02cd('0x40')]['id']}})[_0x02cd('0x21')](handleEntityNotFound(_0x39d0e0,null))['then'](removeEntity(_0x39d0e0,null))['catch'](handleError(_0x39d0e0,null));}; \ No newline at end of file +var _0x6f44=['intersection','fields','attributes','hasOwnProperty','nolimit','limit','offset','order','sort','filters','pick','filter','where','VIRTUAL','merge','options','Dynamics365Field','includeAll','include','findAll','rows','catch','show','params','length','create','body','find','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','set','Content-Range','apply','save','update','then','end','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys'];(function(_0x13843f,_0x50422d){var _0x1063ae=function(_0x12fd6b){while(--_0x12fd6b){_0x13843f['push'](_0x13843f['shift']());}};_0x1063ae(++_0x50422d);}(_0x6f44,0x1ea));var _0x46f4=function(_0x40fb9e,_0x2602d6){_0x40fb9e=_0x40fb9e-0x0;var _0x15d560=_0x6f44[_0x40fb9e];return _0x15d560;};'use strict';var pdf=require(_0x46f4('0x0'));var emlformat=require(_0x46f4('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x46f4('0x2'));var jsonpatch=require(_0x46f4('0x3'));var rp=require(_0x46f4('0x4'));var moment=require(_0x46f4('0x5'));var BPromise=require(_0x46f4('0x6'));var Mustache=require(_0x46f4('0x7'));var util=require(_0x46f4('0x8'));var path=require(_0x46f4('0x9'));var sox=require(_0x46f4('0xa'));var csv=require('to-csv');var ejs=require(_0x46f4('0xb'));var fs=require('fs');var _=require(_0x46f4('0xc'));var squel=require(_0x46f4('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x46f4('0xe'));var toCsv=require(_0x46f4('0xf'));var querystring=require('querystring');var Papa=require(_0x46f4('0x10'));var Redis=require('ioredis');var authService=require(_0x46f4('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x46f4('0x12'));var hardwareService=require(_0x46f4('0x13'));var logger=require(_0x46f4('0x14'))(_0x46f4('0x15'));var utils=require(_0x46f4('0x16'));var config=require(_0x46f4('0x17'));var db=require(_0x46f4('0x18'))['db'];function respondWithStatusCode(_0x3c22e0,_0x21d4a6){_0x21d4a6=_0x21d4a6||0xcc;return function(_0x1f4748){if(_0x1f4748){return _0x3c22e0[_0x46f4('0x19')](_0x21d4a6);}return _0x3c22e0[_0x46f4('0x1a')](_0x21d4a6)['end']();};}function respondWithResult(_0x3b3b92,_0x33f73c){_0x33f73c=_0x33f73c||0xc8;return function(_0x52db86){if(_0x52db86){return _0x3b3b92[_0x46f4('0x1a')](_0x33f73c)[_0x46f4('0x1b')](_0x52db86);}};}function respondWithFilteredResult(_0x1a1649,_0x4dd2fb){return function(_0x3dc516){if(_0x3dc516){var _0x4e0661=_0x3dc516[_0x46f4('0x1c')],_0x4e84ce=_0x4dd2fb['offset'],_0x45917e=_0x4dd2fb['offset']+_0x4dd2fb['limit'],_0xf082a9;if(_0x45917e>=_0x4e0661){_0x45917e=_0x4e0661;_0xf082a9=0xc8;}else{_0xf082a9=0xce;}_0x1a1649['status'](_0xf082a9);return _0x1a1649[_0x46f4('0x1d')](_0x46f4('0x1e'),_0x4e84ce+'-'+_0x45917e+'/'+_0x4e0661)['json'](_0x3dc516);}return null;};}function patchUpdates(_0x22209b){return function(_0x108e6d){try{jsonpatch[_0x46f4('0x1f')](_0x108e6d,_0x22209b,!![]);}catch(_0x33521e){return BPromise['reject'](_0x33521e);}return _0x108e6d[_0x46f4('0x20')]();};}function saveUpdates(_0x390137,_0x1627db){return function(_0x6476f0){if(_0x6476f0){return _0x6476f0[_0x46f4('0x21')](_0x390137)[_0x46f4('0x22')](function(_0x47e1fa){return _0x47e1fa;});}return null;};}function removeEntity(_0x4bae60,_0x2b88d3){return function(_0x39760b){if(_0x39760b){return _0x39760b['destroy']()[_0x46f4('0x22')](function(){_0x4bae60[_0x46f4('0x1a')](0xcc)[_0x46f4('0x23')]();});}};}function handleEntityNotFound(_0x47528b,_0x36092e){return function(_0x41be5e){if(!_0x41be5e){_0x47528b[_0x46f4('0x19')](0x194);}return _0x41be5e;};}function handleError(_0x58d27d,_0x39eb2f){_0x39eb2f=_0x39eb2f||0x1f4;return function(_0x301e24){logger[_0x46f4('0x24')](_0x301e24[_0x46f4('0x25')]);if(_0x301e24[_0x46f4('0x26')]){delete _0x301e24['name'];}_0x58d27d[_0x46f4('0x1a')](_0x39eb2f)[_0x46f4('0x27')](_0x301e24);};}exports[_0x46f4('0x28')]=function(_0x30d302,_0x57eb00){var _0x33a7c5={},_0x531aef={},_0x13573d={'count':0x0,'rows':[]};var _0x552ab0=_['map'](db['Dynamics365Field'][_0x46f4('0x29')],function(_0x57ff78){return{'name':_0x57ff78[_0x46f4('0x2a')],'type':_0x57ff78[_0x46f4('0x2b')][_0x46f4('0x2c')]};});_0x531aef[_0x46f4('0x2d')]=_[_0x46f4('0x2e')](_0x552ab0,'name');_0x531aef[_0x46f4('0x2f')]=_[_0x46f4('0x30')](_0x30d302[_0x46f4('0x2f')]);_0x531aef['filters']=_[_0x46f4('0x31')](_0x531aef[_0x46f4('0x2d')],_0x531aef[_0x46f4('0x2f')]);_0x33a7c5['attributes']=_['intersection'](_0x531aef[_0x46f4('0x2d')],qs[_0x46f4('0x32')](_0x30d302[_0x46f4('0x2f')]['fields']));_0x33a7c5[_0x46f4('0x33')]=_0x33a7c5[_0x46f4('0x33')]['length']?_0x33a7c5[_0x46f4('0x33')]:_0x531aef['model'];if(!_0x30d302[_0x46f4('0x2f')][_0x46f4('0x34')](_0x46f4('0x35'))){_0x33a7c5[_0x46f4('0x36')]=qs[_0x46f4('0x36')](_0x30d302['query'][_0x46f4('0x36')]);_0x33a7c5[_0x46f4('0x37')]=qs['offset'](_0x30d302[_0x46f4('0x2f')][_0x46f4('0x37')]);}_0x33a7c5[_0x46f4('0x38')]=qs[_0x46f4('0x39')](_0x30d302['query'][_0x46f4('0x39')]);_0x33a7c5['where']=qs[_0x46f4('0x3a')](_[_0x46f4('0x3b')](_0x30d302[_0x46f4('0x2f')],_0x531aef[_0x46f4('0x3a')]));if(_0x30d302['query'][_0x46f4('0x3c')]){_0x33a7c5['where']=_['merge'](_0x33a7c5[_0x46f4('0x3d')],{'$or':_['map'](_0x552ab0,function(_0x520f05){if(_0x520f05[_0x46f4('0x2b')]!==_0x46f4('0x3e')){var _0x5ed740={};_0x5ed740[_0x520f05[_0x46f4('0x26')]]={'$like':'%'+_0x30d302['query'][_0x46f4('0x3c')]+'%'};return _0x5ed740;}})});}_0x33a7c5=_[_0x46f4('0x3f')]({},_0x33a7c5,_0x30d302[_0x46f4('0x40')]);var _0x3735d3={'where':_0x33a7c5['where']};return db[_0x46f4('0x41')][_0x46f4('0x1c')](_0x3735d3)[_0x46f4('0x22')](function(_0x5e22ba){_0x13573d['count']=_0x5e22ba;if(_0x30d302['query'][_0x46f4('0x42')]){_0x33a7c5[_0x46f4('0x43')]=[{'all':!![]}];}return db[_0x46f4('0x41')][_0x46f4('0x44')](_0x33a7c5);})['then'](function(_0x448f42){_0x13573d[_0x46f4('0x45')]=_0x448f42;return _0x13573d;})[_0x46f4('0x22')](respondWithFilteredResult(_0x57eb00,_0x33a7c5))[_0x46f4('0x46')](handleError(_0x57eb00,null));};exports[_0x46f4('0x47')]=function(_0x4b2de4,_0xe86eae){var _0x306400={'raw':!![],'where':{'id':_0x4b2de4[_0x46f4('0x48')]['id']}},_0x297cf9={};_0x297cf9[_0x46f4('0x2d')]=_['keys'](db['Dynamics365Field']['rawAttributes']);_0x297cf9[_0x46f4('0x2f')]=_[_0x46f4('0x30')](_0x4b2de4[_0x46f4('0x2f')]);_0x297cf9['filters']=_[_0x46f4('0x31')](_0x297cf9[_0x46f4('0x2d')],_0x297cf9[_0x46f4('0x2f')]);_0x306400[_0x46f4('0x33')]=_[_0x46f4('0x31')](_0x297cf9[_0x46f4('0x2d')],qs[_0x46f4('0x32')](_0x4b2de4[_0x46f4('0x2f')][_0x46f4('0x32')]));_0x306400[_0x46f4('0x33')]=_0x306400[_0x46f4('0x33')][_0x46f4('0x49')]?_0x306400[_0x46f4('0x33')]:_0x297cf9['model'];if(_0x4b2de4[_0x46f4('0x2f')][_0x46f4('0x42')]){_0x306400[_0x46f4('0x43')]=[{'all':!![]}];}_0x306400=_[_0x46f4('0x3f')]({},_0x306400,_0x4b2de4[_0x46f4('0x40')]);return db[_0x46f4('0x41')]['find'](_0x306400)['then'](handleEntityNotFound(_0xe86eae,null))['then'](respondWithResult(_0xe86eae,null))[_0x46f4('0x46')](handleError(_0xe86eae,null));};exports[_0x46f4('0x4a')]=function(_0x20698d,_0x19b357){return db[_0x46f4('0x41')][_0x46f4('0x4a')](_0x20698d[_0x46f4('0x4b')],{})[_0x46f4('0x22')](respondWithResult(_0x19b357,0xc9))[_0x46f4('0x46')](handleError(_0x19b357,null));};exports[_0x46f4('0x21')]=function(_0x21319d,_0x1d1513){if(_0x21319d['body']['id']){delete _0x21319d[_0x46f4('0x4b')]['id'];}return db[_0x46f4('0x41')][_0x46f4('0x4c')]({'where':{'id':_0x21319d['params']['id']}})['then'](handleEntityNotFound(_0x1d1513,null))[_0x46f4('0x22')](saveUpdates(_0x21319d[_0x46f4('0x4b')],null))[_0x46f4('0x22')](respondWithResult(_0x1d1513,null))['catch'](handleError(_0x1d1513,null));};exports['destroy']=function(_0x11f959,_0x1e3551){return db[_0x46f4('0x41')][_0x46f4('0x4c')]({'where':{'id':_0x11f959[_0x46f4('0x48')]['id']}})[_0x46f4('0x22')](handleEntityNotFound(_0x1e3551,null))['then'](removeEntity(_0x1e3551,null))[_0x46f4('0x46')](handleError(_0x1e3551,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index 953d5c8..ea10f40 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 _0xb49c=['idField','FieldId','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Field.attributes','exports','define','Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index'];(function(_0x43c456,_0xa105b3){var _0x76a242=function(_0x9ae128){while(--_0x9ae128){_0x43c456['push'](_0x43c456['shift']());}};_0x76a242(++_0xa105b3);}(_0xb49c,0x68));var _0xcb49=function(_0x24745f,_0x575a71){_0x24745f=_0x24745f-0x0;var _0x10c726=_0xb49c[_0x24745f];return _0x10c726;};'use strict';var _=require(_0xcb49('0x0'));var util=require(_0xcb49('0x1'));var logger=require(_0xcb49('0x2'))(_0xcb49('0x3'));var moment=require('moment');var BPromise=require(_0xcb49('0x4'));var rp=require(_0xcb49('0x5'));var fs=require('fs');var path=require(_0xcb49('0x6'));var rimraf=require(_0xcb49('0x7'));var config=require(_0xcb49('0x8'));var attributes=require(_0xcb49('0x9'));module[_0xcb49('0xa')]=function(_0x46db0b,_0x570e02){return _0x46db0b[_0xcb49('0xb')](_0xcb49('0xc'),attributes,{'tableName':_0xcb49('0xd'),'paranoid':![],'indexes':[{'name':_0xcb49('0xe'),'fields':[_0xcb49('0xf'),_0xcb49('0x10')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf575=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Field.attributes','define','Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index','FieldId'];(function(_0x352e09,_0x37a7da){var _0x1b7094=function(_0x561074){while(--_0x561074){_0x352e09['push'](_0x352e09['shift']());}};_0x1b7094(++_0x37a7da);}(_0xf575,0xa5));var _0x5f57=function(_0x4e39b1,_0x51ec5c){_0x4e39b1=_0x4e39b1-0x0;var _0x3c103c=_0xf575[_0x4e39b1];return _0x3c103c;};'use strict';var _=require('lodash');var util=require(_0x5f57('0x0'));var logger=require(_0x5f57('0x1'))(_0x5f57('0x2'));var moment=require(_0x5f57('0x3'));var BPromise=require(_0x5f57('0x4'));var rp=require(_0x5f57('0x5'));var fs=require('fs');var path=require(_0x5f57('0x6'));var rimraf=require(_0x5f57('0x7'));var config=require(_0x5f57('0x8'));var attributes=require(_0x5f57('0x9'));module['exports']=function(_0x21a790,_0x366c52){return _0x21a790[_0x5f57('0xa')](_0x5f57('0xb'),attributes,{'tableName':_0x5f57('0xc'),'paranoid':![],'indexes':[{'name':_0x5f57('0xd'),'fields':['idField',_0x5f57('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.rpc.js b/server/api/intDynamics365Field/intDynamics365Field.rpc.js index 516acc7..6f89c6e 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 _0x6d11=['message','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','then','info','Dynamics365Field,\x20%s,\x20%s','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x443c00,_0x5eb470){var _0x3d25cf=function(_0xc33180){while(--_0xc33180){_0x443c00['push'](_0x443c00['shift']());}};_0x3d25cf(++_0x5eb470);}(_0x6d11,0xbf));var _0x16d1=function(_0x1454e1,_0x3b2847){_0x1454e1=_0x1454e1-0x0;var _0x3739e5=_0x6d11[_0x1454e1];return _0x3739e5;};'use strict';var _=require(_0x16d1('0x0'));var util=require(_0x16d1('0x1'));var moment=require(_0x16d1('0x2'));var BPromise=require('bluebird');var rs=require(_0x16d1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x16d1('0x4'))['db'];var utils=require(_0x16d1('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x16d1('0x6'));var jayson=require(_0x16d1('0x7'));var client=jayson[_0x16d1('0x8')][_0x16d1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1009dc,_0x150217,_0x19390d){return new BPromise(function(_0x5d0e3f,_0x58a7a2){return client['request'](_0x1009dc,_0x19390d)[_0x16d1('0xa')](function(_0xcfbb15){logger[_0x16d1('0xb')](_0x16d1('0xc'),_0x150217,'request\x20sent');logger[_0x16d1('0xd')](_0x16d1('0xe'),_0x150217,_0x16d1('0xf'),JSON[_0x16d1('0x10')](_0xcfbb15));if(_0xcfbb15[_0x16d1('0x11')]){if(_0xcfbb15[_0x16d1('0x11')][_0x16d1('0x12')]===0x1f4){logger[_0x16d1('0x11')]('Dynamics365Field,\x20%s,\x20%s',_0x150217,_0xcfbb15[_0x16d1('0x11')][_0x16d1('0x13')]);return _0x58a7a2(_0xcfbb15[_0x16d1('0x11')][_0x16d1('0x13')]);}logger[_0x16d1('0x11')]('Dynamics365Field,\x20%s,\x20%s',_0x150217,_0xcfbb15[_0x16d1('0x11')][_0x16d1('0x13')]);return _0x5d0e3f(_0xcfbb15[_0x16d1('0x11')][_0x16d1('0x13')]);}else{logger[_0x16d1('0xb')](_0x16d1('0xc'),_0x150217,_0x16d1('0xf'));_0x5d0e3f(_0xcfbb15['result'][_0x16d1('0x13')]);}})[_0x16d1('0x14')](function(_0x555b2d){logger['error'](_0x16d1('0xc'),_0x150217,_0x555b2d);_0x58a7a2(_0x555b2d);});});} \ No newline at end of file +var _0xf0f4=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x5adcfd,_0x4f71dd){var _0x306d7d=function(_0x17550c){while(--_0x17550c){_0x5adcfd['push'](_0x5adcfd['shift']());}};_0x306d7d(++_0x4f71dd);}(_0xf0f4,0x182));var _0x4f0f=function(_0xef6761,_0x543cf8){_0xef6761=_0xef6761-0x0;var _0x3498ea=_0xf0f4[_0xef6761];return _0x3498ea;};'use strict';var _=require('lodash');var util=require(_0x4f0f('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x4f0f('0x1'));var fs=require('fs');var Redis=require(_0x4f0f('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x4f0f('0x3'));var logger=require(_0x4f0f('0x4'))(_0x4f0f('0x5'));var config=require(_0x4f0f('0x6'));var jayson=require(_0x4f0f('0x7'));var client=jayson[_0x4f0f('0x8')][_0x4f0f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x47faf5,_0x39ad76,_0x1dd6bd){return new BPromise(function(_0x95b1cf,_0x5da92f){return client[_0x4f0f('0xa')](_0x47faf5,_0x1dd6bd)[_0x4f0f('0xb')](function(_0x19cecb){logger[_0x4f0f('0xc')](_0x4f0f('0xd'),_0x39ad76,_0x4f0f('0xe'));logger[_0x4f0f('0xf')](_0x4f0f('0x10'),_0x39ad76,'request\x20sent',JSON[_0x4f0f('0x11')](_0x19cecb));if(_0x19cecb[_0x4f0f('0x12')]){if(_0x19cecb[_0x4f0f('0x12')][_0x4f0f('0x13')]===0x1f4){logger[_0x4f0f('0x12')](_0x4f0f('0xd'),_0x39ad76,_0x19cecb[_0x4f0f('0x12')][_0x4f0f('0x14')]);return _0x5da92f(_0x19cecb[_0x4f0f('0x12')][_0x4f0f('0x14')]);}logger[_0x4f0f('0x12')]('Dynamics365Field,\x20%s,\x20%s',_0x39ad76,_0x19cecb[_0x4f0f('0x12')][_0x4f0f('0x14')]);return _0x95b1cf(_0x19cecb[_0x4f0f('0x12')][_0x4f0f('0x14')]);}else{logger['info'](_0x4f0f('0xd'),_0x39ad76,_0x4f0f('0xe'));_0x95b1cf(_0x19cecb[_0x4f0f('0x15')][_0x4f0f('0x14')]);}})[_0x4f0f('0x16')](function(_0x5f171b){logger[_0x4f0f('0x12')](_0x4f0f('0xd'),_0x39ad76,_0x5f171b);_0x5da92f(_0x5f171b);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index d92948e..0fd8cb4 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 _0xbe62=['/:id','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','util','connect-timeout','../../components/auth/service','../../components/interaction/service','./intFreshdeskAccount.controller','get','isAuthenticated'];(function(_0x1f0b74,_0x2cc0da){var _0x14fda5=function(_0x479fbe){while(--_0x479fbe){_0x1f0b74['push'](_0x1f0b74['shift']());}};_0x14fda5(++_0x2cc0da);}(_0xbe62,0x103));var _0x2be6=function(_0x24e94d,_0x261a8b){_0x24e94d=_0x24e94d-0x0;var _0xee1443=_0xbe62[_0x24e94d];return _0xee1443;};'use strict';var multer=require('multer');var util=require(_0x2be6('0x0'));var path=require('path');var timeout=require(_0x2be6('0x1'));var express=require('express');var router=express['Router']();var auth=require(_0x2be6('0x2'));var interaction=require(_0x2be6('0x3'));var config=require('../../config/environment');var controller=require(_0x2be6('0x4'));router[_0x2be6('0x5')]('/',auth[_0x2be6('0x6')](),controller['index']);router['get'](_0x2be6('0x7'),auth[_0x2be6('0x6')](),controller['show']);router[_0x2be6('0x5')](_0x2be6('0x8'),auth[_0x2be6('0x6')](),controller[_0x2be6('0x9')]);router[_0x2be6('0x5')](_0x2be6('0xa'),auth['isAuthenticated'](),controller[_0x2be6('0xb')]);router[_0x2be6('0xc')]('/',auth[_0x2be6('0x6')](),controller[_0x2be6('0xd')]);router[_0x2be6('0xc')]('/:id/configurations',auth[_0x2be6('0x6')](),controller[_0x2be6('0xe')]);router[_0x2be6('0xf')](_0x2be6('0x7'),auth[_0x2be6('0x6')](),controller[_0x2be6('0x10')]);router[_0x2be6('0x11')](_0x2be6('0x7'),auth[_0x2be6('0x6')](),controller[_0x2be6('0x12')]);module['exports']=router; \ No newline at end of file +var _0xe397=['delete','destroy','multer','path','express','../../components/auth/service','../../components/interaction/service','./intFreshdeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','post','/:id/configurations','addConfiguration','update'];(function(_0x1770b3,_0x8cd87b){var _0x5e367f=function(_0x29a1be){while(--_0x29a1be){_0x1770b3['push'](_0x1770b3['shift']());}};_0x5e367f(++_0x8cd87b);}(_0xe397,0xad));var _0x7e39=function(_0xa3fadc,_0xd1e16){_0xa3fadc=_0xa3fadc-0x0;var _0x23ecb8=_0xe397[_0xa3fadc];return _0x23ecb8;};'use strict';var multer=require(_0x7e39('0x0'));var util=require('util');var path=require(_0x7e39('0x1'));var timeout=require('connect-timeout');var express=require(_0x7e39('0x2'));var router=express['Router']();var auth=require(_0x7e39('0x3'));var interaction=require(_0x7e39('0x4'));var config=require('../../config/environment');var controller=require(_0x7e39('0x5'));router[_0x7e39('0x6')]('/',auth[_0x7e39('0x7')](),controller[_0x7e39('0x8')]);router[_0x7e39('0x6')](_0x7e39('0x9'),auth[_0x7e39('0x7')](),controller[_0x7e39('0xa')]);router[_0x7e39('0x6')]('/:id/configurations',auth[_0x7e39('0x7')](),controller['getConfigurations']);router[_0x7e39('0x6')](_0x7e39('0xb'),auth[_0x7e39('0x7')](),controller[_0x7e39('0xc')]);router['post']('/',auth[_0x7e39('0x7')](),controller['create']);router[_0x7e39('0xd')](_0x7e39('0xe'),auth['isAuthenticated'](),controller[_0x7e39('0xf')]);router['put'](_0x7e39('0x9'),auth[_0x7e39('0x7')](),controller[_0x7e39('0x10')]);router[_0x7e39('0x11')](_0x7e39('0x9'),auth[_0x7e39('0x7')](),controller[_0x7e39('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index ff0763d..53e6d67 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 _0xaac4=['STRING','username','remoteUri','sequelize','exports'];(function(_0x15a634,_0x4feb86){var _0xf4f7a0=function(_0x31d9fe){while(--_0x31d9fe){_0x15a634['push'](_0x15a634['shift']());}};_0xf4f7a0(++_0x4feb86);}(_0xaac4,0x6c));var _0x4aac=function(_0x4121cc,_0x3b5a38){_0x4121cc=_0x4121cc-0x0;var _0x25ec50=_0xaac4[_0x4121cc];return _0x25ec50;};'use strict';var Sequelize=require(_0x4aac('0x0'));module[_0x4aac('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x4aac('0x2')]},'username':{'type':Sequelize[_0x4aac('0x2')],'unique':_0x4aac('0x3')},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x4aac('0x2')],'unique':_0x4aac('0x4')},'serverUrl':{'type':Sequelize[_0x4aac('0x2')]}}; \ No newline at end of file +var _0x147b=['exports','STRING','remoteUri','sequelize'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x147b,0x193));var _0xb147=function(_0x51bfa7,_0x51c8e0){_0x51bfa7=_0x51bfa7-0x0;var _0x1cf7ae=_0x147b[_0x51bfa7];return _0x1cf7ae;};'use strict';var Sequelize=require(_0xb147('0x0'));module[_0xb147('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xb147('0x2')]},'username':{'type':Sequelize[_0xb147('0x2')],'unique':'username'},'apiKey':{'type':Sequelize[_0xb147('0x2')]},'remoteUri':{'type':Sequelize[_0xb147('0x2')],'unique':_0xb147('0x3')},'serverUrl':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index 33aa224..f3e4443 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 _0xd61e=['FreshdeskConfiguration','nolimit','addConfiguration','Subjects','channel','Descriptions','getDescriptions','getFields','remoteUri','apiKey','slice','substring','lastIndexOf','GET','%s/%s','api/v2/ticket_fields','%s:X','toString','description','source','ticket_type','company','remove','includes','default','custom_dropdown','label','choices','capitalize','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','status','end','json','count','offset','Content-Range','apply','reject','save','update','sendStatus','stack','name','send','index','map','rawAttributes','type','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','limit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','FreshdeskAccount','includeAll','include','findAll','rows','show','params','find','create','body','destroy','getConfigurations','findOne'];(function(_0x4a48cf,_0x5f1870){var _0x24a970=function(_0x5a8544){while(--_0x5a8544){_0x4a48cf['push'](_0x4a48cf['shift']());}};_0x24a970(++_0x5f1870);}(_0xd61e,0x19a));var _0xed61=function(_0x25ecbb,_0x3fdc83){_0x25ecbb=_0x25ecbb-0x0;var _0x3db9a4=_0xd61e[_0x25ecbb];return _0x3db9a4;};'use strict';var pdf=require(_0xed61('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xed61('0x1'));var zipdir=require(_0xed61('0x2'));var jsonpatch=require(_0xed61('0x3'));var rp=require(_0xed61('0x4'));var moment=require('moment');var BPromise=require(_0xed61('0x5'));var Mustache=require(_0xed61('0x6'));var util=require(_0xed61('0x7'));var path=require(_0xed61('0x8'));var sox=require(_0xed61('0x9'));var csv=require('to-csv');var ejs=require(_0xed61('0xa'));var fs=require('fs');var _=require(_0xed61('0xb'));var squel=require(_0xed61('0xc'));var crypto=require(_0xed61('0xd'));var jsforce=require(_0xed61('0xe'));var deskjs=require(_0xed61('0xf'));var toCsv=require(_0xed61('0x10'));var querystring=require(_0xed61('0x11'));var Papa=require(_0xed61('0x12'));var Redis=require(_0xed61('0x13'));var authService=require(_0xed61('0x14'));var qs=require(_0xed61('0x15'));var as=require(_0xed61('0x16'));var hardwareService=require(_0xed61('0x17'));var logger=require('../../config/logger')(_0xed61('0x18'));var utils=require(_0xed61('0x19'));var config=require('../../config/environment');var db=require(_0xed61('0x1a'))['db'];var integrations=require(_0xed61('0x1b'));var jayson=require(_0xed61('0x1c'));var client=jayson[_0xed61('0x1d')][_0xed61('0x1e')]({'port':0x232a});function checkPasswordPattern(_0x30f786,_0xa71135,_0x2fb069){if(_0x2fb069){var _0x5c336e=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5c336e[_0xed61('0x1f')](_0xa71135)){return _0x30f786;}else{throw new db[(_0xed61('0x20'))]['ValidationError'](_0xed61('0x21'));}}else{return _0x30f786;}}function respondWithRpcPromise(_0x21b184,_0xc8a29,_0x27e613,_0x5087f4){return new BPromise(function(_0x187f46,_0x7fae10){var _0x17db5d=_0x5087f4||client;return _0x17db5d[_0xed61('0x22')](_0x21b184,_0x27e613)[_0xed61('0x23')](function(_0x147025){logger[_0xed61('0x24')](_0xed61('0x25'),_0xc8a29,_0xed61('0x26'));logger[_0xed61('0x27')]('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0xc8a29,_0xed61('0x26'),JSON['stringify'](_0x147025));if(_0x147025[_0xed61('0x28')]){if(_0x147025[_0xed61('0x28')][_0xed61('0x29')]===0x1f4){logger[_0xed61('0x28')]('FreshdeskAccount,\x20%s,\x20%s',_0xc8a29,_0x147025['error'][_0xed61('0x2a')]);return _0x7fae10(_0x147025['error'][_0xed61('0x2a')]);}logger[_0xed61('0x28')](_0xed61('0x25'),_0xc8a29,_0x147025[_0xed61('0x28')][_0xed61('0x2a')]);return _0x187f46(_0x147025[_0xed61('0x28')][_0xed61('0x2a')]);}else{logger['info']('FreshdeskAccount,\x20%s,\x20%s',_0xc8a29,_0xed61('0x26'));_0x187f46(_0x147025[_0xed61('0x2b')][_0xed61('0x2a')]);}})[_0xed61('0x2c')](function(_0x2315ae){logger[_0xed61('0x28')](_0xed61('0x25'),_0xc8a29,_0x2315ae);_0x7fae10(_0x2315ae);});});}function respondWithStatusCode(_0x5c1963,_0x5878cd){_0x5878cd=_0x5878cd||0xcc;return function(_0x52fcee){if(_0x52fcee){return _0x5c1963['sendStatus'](_0x5878cd);}return _0x5c1963[_0xed61('0x2d')](_0x5878cd)[_0xed61('0x2e')]();};}function respondWithResult(_0x140443,_0x11e1c4){_0x11e1c4=_0x11e1c4||0xc8;return function(_0x534c5a){if(_0x534c5a){return _0x140443['status'](_0x11e1c4)[_0xed61('0x2f')](_0x534c5a);}};}function respondWithFilteredResult(_0x278633,_0x4675c1){return function(_0x5d9b05){if(_0x5d9b05){var _0x232dff=_0x5d9b05[_0xed61('0x30')],_0x868296=_0x4675c1[_0xed61('0x31')],_0x25d196=_0x4675c1[_0xed61('0x31')]+_0x4675c1['limit'],_0x5a0d98;if(_0x25d196>=_0x232dff){_0x25d196=_0x232dff;_0x5a0d98=0xc8;}else{_0x5a0d98=0xce;}_0x278633[_0xed61('0x2d')](_0x5a0d98);return _0x278633['set'](_0xed61('0x32'),_0x868296+'-'+_0x25d196+'/'+_0x232dff)[_0xed61('0x2f')](_0x5d9b05);}return null;};}function patchUpdates(_0x54d3f){return function(_0x45a673){try{jsonpatch[_0xed61('0x33')](_0x45a673,_0x54d3f,!![]);}catch(_0x5ac5de){return BPromise[_0xed61('0x34')](_0x5ac5de);}return _0x45a673[_0xed61('0x35')]();};}function saveUpdates(_0xef919d,_0xbca885){return function(_0xc6b429){if(_0xc6b429){return _0xc6b429[_0xed61('0x36')](_0xef919d)['then'](function(_0x2bbe1e){return _0x2bbe1e;});}return null;};}function removeEntity(_0x4b3d6d,_0x394b18){return function(_0xef9c6c){if(_0xef9c6c){return _0xef9c6c['destroy']()[_0xed61('0x23')](function(){_0x4b3d6d[_0xed61('0x2d')](0xcc)[_0xed61('0x2e')]();});}};}function handleEntityNotFound(_0x221367,_0x2b7478){return function(_0x252484){if(!_0x252484){_0x221367[_0xed61('0x37')](0x194);}return _0x252484;};}function handleError(_0x4b1929,_0xdc994b){_0xdc994b=_0xdc994b||0x1f4;return function(_0xb7f7d9){logger['error'](_0xb7f7d9[_0xed61('0x38')]);if(_0xb7f7d9[_0xed61('0x39')]){delete _0xb7f7d9[_0xed61('0x39')];}_0x4b1929[_0xed61('0x2d')](_0xdc994b)[_0xed61('0x3a')](_0xb7f7d9);};}exports[_0xed61('0x3b')]=function(_0xbc74b,_0x2f3632){var _0x139ac5={},_0x4695cc={},_0x55c6f6={'count':0x0,'rows':[]};var _0x3103f4=_[_0xed61('0x3c')](db['FreshdeskAccount'][_0xed61('0x3d')],function(_0x1de931){return{'name':_0x1de931['fieldName'],'type':_0x1de931[_0xed61('0x3e')]['key']};});_0x4695cc[_0xed61('0x3f')]=_[_0xed61('0x3c')](_0x3103f4,_0xed61('0x39'));_0x4695cc[_0xed61('0x40')]=_[_0xed61('0x41')](_0xbc74b[_0xed61('0x40')]);_0x4695cc['filters']=_[_0xed61('0x42')](_0x4695cc['model'],_0x4695cc[_0xed61('0x40')]);_0x139ac5['attributes']=_['intersection'](_0x4695cc[_0xed61('0x3f')],qs[_0xed61('0x43')](_0xbc74b[_0xed61('0x40')][_0xed61('0x43')]));_0x139ac5[_0xed61('0x44')]=_0x139ac5[_0xed61('0x44')][_0xed61('0x45')]?_0x139ac5[_0xed61('0x44')]:_0x4695cc['model'];if(!_0xbc74b[_0xed61('0x40')][_0xed61('0x46')]('nolimit')){_0x139ac5[_0xed61('0x47')]=qs[_0xed61('0x47')](_0xbc74b[_0xed61('0x40')][_0xed61('0x47')]);_0x139ac5[_0xed61('0x31')]=qs[_0xed61('0x31')](_0xbc74b[_0xed61('0x40')][_0xed61('0x31')]);}_0x139ac5[_0xed61('0x48')]=qs[_0xed61('0x49')](_0xbc74b['query'][_0xed61('0x49')]);_0x139ac5[_0xed61('0x4a')]=qs[_0xed61('0x4b')](_[_0xed61('0x4c')](_0xbc74b['query'],_0x4695cc[_0xed61('0x4b')]));if(_0xbc74b['query'][_0xed61('0x4d')]){_0x139ac5['where']=_[_0xed61('0x4e')](_0x139ac5[_0xed61('0x4a')],{'$or':_[_0xed61('0x3c')](_0x3103f4,function(_0x1d406f){if(_0x1d406f[_0xed61('0x3e')]!==_0xed61('0x4f')){var _0x592838={};_0x592838[_0x1d406f[_0xed61('0x39')]]={'$like':'%'+_0xbc74b[_0xed61('0x40')][_0xed61('0x4d')]+'%'};return _0x592838;}})});}_0x139ac5=_[_0xed61('0x4e')]({},_0x139ac5,_0xbc74b[_0xed61('0x50')]);var _0x1a8b43={'where':_0x139ac5['where']};return db[_0xed61('0x51')]['count'](_0x1a8b43)[_0xed61('0x23')](function(_0x1fb4c6){_0x55c6f6[_0xed61('0x30')]=_0x1fb4c6;if(_0xbc74b[_0xed61('0x40')][_0xed61('0x52')]){_0x139ac5[_0xed61('0x53')]=[{'all':!![]}];}return db['FreshdeskAccount'][_0xed61('0x54')](_0x139ac5);})[_0xed61('0x23')](function(_0x2ed05c){_0x55c6f6[_0xed61('0x55')]=_0x2ed05c;return _0x55c6f6;})[_0xed61('0x23')](respondWithFilteredResult(_0x2f3632,_0x139ac5))[_0xed61('0x2c')](handleError(_0x2f3632,null));};exports[_0xed61('0x56')]=function(_0x86399e,_0x548fea){var _0x1197f4={'raw':![],'where':{'id':_0x86399e[_0xed61('0x57')]['id']}},_0x5eb2d8={};_0x5eb2d8['model']=_['keys'](db[_0xed61('0x51')][_0xed61('0x3d')]);_0x5eb2d8[_0xed61('0x40')]=_[_0xed61('0x41')](_0x86399e[_0xed61('0x40')]);_0x5eb2d8[_0xed61('0x4b')]=_['intersection'](_0x5eb2d8[_0xed61('0x3f')],_0x5eb2d8[_0xed61('0x40')]);_0x1197f4[_0xed61('0x44')]=_['intersection'](_0x5eb2d8['model'],qs['fields'](_0x86399e[_0xed61('0x40')]['fields']));_0x1197f4['attributes']=_0x1197f4['attributes'][_0xed61('0x45')]?_0x1197f4[_0xed61('0x44')]:_0x5eb2d8['model'];if(_0x86399e['query']['includeAll']){_0x1197f4[_0xed61('0x53')]=[{'all':!![]}];}_0x1197f4=_[_0xed61('0x4e')]({},_0x1197f4,_0x86399e[_0xed61('0x50')]);return db[_0xed61('0x51')][_0xed61('0x58')](_0x1197f4)[_0xed61('0x23')](handleEntityNotFound(_0x548fea,null))[_0xed61('0x23')](respondWithResult(_0x548fea,null))[_0xed61('0x2c')](handleError(_0x548fea,null));};exports[_0xed61('0x59')]=function(_0x5329c7,_0x228a7e){return db[_0xed61('0x51')][_0xed61('0x59')](_0x5329c7[_0xed61('0x5a')],{})[_0xed61('0x23')](respondWithResult(_0x228a7e,0xc9))[_0xed61('0x2c')](handleError(_0x228a7e,null));};exports[_0xed61('0x36')]=function(_0xf75baa,_0x34752){if(_0xf75baa['body']['id']){delete _0xf75baa['body']['id'];}return db[_0xed61('0x51')][_0xed61('0x58')]({'where':{'id':_0xf75baa[_0xed61('0x57')]['id']}})['then'](handleEntityNotFound(_0x34752,null))['then'](saveUpdates(_0xf75baa[_0xed61('0x5a')],null))['then'](respondWithResult(_0x34752,null))[_0xed61('0x2c')](handleError(_0x34752,null));};exports[_0xed61('0x5b')]=function(_0x1ddd21,_0x19039a){return db[_0xed61('0x51')]['find']({'where':{'id':_0x1ddd21[_0xed61('0x57')]['id']}})[_0xed61('0x23')](handleEntityNotFound(_0x19039a,null))['then'](removeEntity(_0x19039a,null))[_0xed61('0x2c')](handleError(_0x19039a,null));};exports[_0xed61('0x5c')]=function(_0x3de7ca,_0x264b65,_0x103902){var _0x4e2b46={};var _0x5e71a8={};var _0x53e37d;var _0x446146;return db[_0xed61('0x51')][_0xed61('0x5d')]({'where':{'id':_0x3de7ca['params']['id']}})['then'](handleEntityNotFound(_0x264b65,null))[_0xed61('0x23')](function(_0x231ef4){if(_0x231ef4){_0x53e37d=_0x231ef4;_0x5e71a8['model']=_[_0xed61('0x41')](db[_0xed61('0x5e')]['rawAttributes']);_0x5e71a8[_0xed61('0x40')]=_['keys'](_0x3de7ca[_0xed61('0x40')]);_0x5e71a8[_0xed61('0x4b')]=_[_0xed61('0x42')](_0x5e71a8[_0xed61('0x3f')],_0x5e71a8[_0xed61('0x40')]);_0x4e2b46[_0xed61('0x44')]=_[_0xed61('0x42')](_0x5e71a8[_0xed61('0x3f')],qs['fields'](_0x3de7ca[_0xed61('0x40')][_0xed61('0x43')]));_0x4e2b46[_0xed61('0x44')]=_0x4e2b46[_0xed61('0x44')]['length']?_0x4e2b46['attributes']:_0x5e71a8[_0xed61('0x3f')];_0x4e2b46['order']=qs[_0xed61('0x49')](_0x3de7ca[_0xed61('0x40')]['sort']);_0x4e2b46[_0xed61('0x4a')]=qs[_0xed61('0x4b')](_[_0xed61('0x4c')](_0x3de7ca[_0xed61('0x40')],_0x5e71a8[_0xed61('0x4b')]));if(_0x3de7ca[_0xed61('0x40')]['filter']){_0x4e2b46['where']=_[_0xed61('0x4e')](_0x4e2b46['where'],{'$or':_[_0xed61('0x3c')](_0x4e2b46[_0xed61('0x44')],function(_0x2eda44){var _0x1cdbdf={};_0x1cdbdf[_0x2eda44]={'$like':'%'+_0x3de7ca['query'][_0xed61('0x4d')]+'%'};return _0x1cdbdf;})});}_0x4e2b46=_[_0xed61('0x4e')]({},_0x4e2b46,_0x3de7ca[_0xed61('0x50')]);return _0x53e37d[_0xed61('0x5c')](_0x4e2b46);}})['then'](function(_0x55a625){if(_0x55a625){_0x446146=_0x55a625[_0xed61('0x45')];if(!_0x3de7ca[_0xed61('0x40')]['hasOwnProperty'](_0xed61('0x5f'))){_0x4e2b46['limit']=qs['limit'](_0x3de7ca['query'][_0xed61('0x47')]);_0x4e2b46[_0xed61('0x31')]=qs[_0xed61('0x31')](_0x3de7ca[_0xed61('0x40')]['offset']);}return _0x53e37d[_0xed61('0x5c')](_0x4e2b46);}})[_0xed61('0x23')](function(_0x441831){if(_0x441831){return _0x441831?{'count':_0x446146,'rows':_0x441831}:null;}})['then'](respondWithResult(_0x264b65,null))['catch'](handleError(_0x264b65,null));};exports[_0xed61('0x60')]=function(_0x4358fd,_0x23e9d5,_0x30eae1){if(_0x4358fd[_0xed61('0x5a')]['id']){delete _0x4358fd[_0xed61('0x5a')]['id'];}return db[_0xed61('0x51')][_0xed61('0x5d')]({'where':{'id':_0x4358fd[_0xed61('0x57')]['id']}})[_0xed61('0x23')](handleEntityNotFound(_0x23e9d5,null))[_0xed61('0x23')](function(_0x5c2892){if(_0x5c2892){_0x4358fd[_0xed61('0x5a')]['AccountId']=_0x5c2892['id'];_0x4358fd[_0xed61('0x5a')][_0xed61('0x61')]=integrations['getSubjects'](_0x4358fd['body'][_0xed61('0x62')],_0x4358fd[_0xed61('0x5a')][_0xed61('0x3e')]);_0x4358fd[_0xed61('0x5a')][_0xed61('0x63')]=integrations[_0xed61('0x64')](_0x4358fd[_0xed61('0x5a')][_0xed61('0x62')],_0x4358fd[_0xed61('0x5a')][_0xed61('0x3e')]);return db[_0xed61('0x5e')]['create'](_0x4358fd[_0xed61('0x5a')],{'include':[{'model':db['FreshdeskField'],'as':'Subjects'},{'model':db['FreshdeskField'],'as':_0xed61('0x63')}]});}return null;})['then'](respondWithResult(_0x23e9d5,null))[_0xed61('0x2c')](handleError(_0x23e9d5,null));};exports[_0xed61('0x65')]=function(_0x45b2b7,_0x5849ea,_0x47172c){var _0x118360='';return db[_0xed61('0x51')][_0xed61('0x5d')]({'where':{'id':_0x45b2b7[_0xed61('0x57')]['id']},'attributes':['id',_0xed61('0x66'),_0xed61('0x67')]})[_0xed61('0x23')](handleEntityNotFound(_0x5849ea,null))['then'](function(_0x5d7054){if(_0x5d7054){_0x118360=_0x5d7054[_0xed61('0x66')];var _0x3c6dae=_0x118360[_0xed61('0x68')](-0x1);if(_0x3c6dae==='/'){_0x118360=_0x118360[_0xed61('0x69')](0x0,_0x118360[_0xed61('0x6a')](_0x3c6dae));}return rp({'method':_0xed61('0x6b'),'uri':util['format'](_0xed61('0x6c'),_0x118360,_0xed61('0x6d')),'headers':{'Authorization':util['format']('Basic\x20%s',new Buffer(util['format'](_0xed61('0x6e'),_0x5d7054[_0xed61('0x67')]))[_0xed61('0x6f')]('base64'))},'json':!![]});}})[_0xed61('0x23')](function(_0x367198){if(_0x367198){var _0x11a945=['requester','subject','agent',_0xed61('0x70'),'status','priority','group',_0xed61('0x71'),_0xed61('0x72'),'group',_0xed61('0x73')];_[_0xed61('0x74')](_0x367198,function(_0x5e06df){return _0x11a945[_0xed61('0x75')](_0x5e06df[_0xed61('0x39')])||!_0x5e06df[_0xed61('0x76')]&&_0x5e06df[_0xed61('0x3e')]!=='custom_text'&&_0x5e06df[_0xed61('0x3e')]!==_0xed61('0x77');});return{'count':_0x367198[_0xed61('0x45')],'rows':_[_0xed61('0x3c')](_0x367198,function(_0xfa1602){return{'id':_0xfa1602[_0xed61('0x39')],'name':_0xfa1602[_0xed61('0x78')],'custom':!_0xfa1602[_0xed61('0x76')],'options':_0xfa1602[_0xed61('0x79')]?_[_0xed61('0x3c')](_0xfa1602['choices'],function(_0x399636){return{'name':_[_0xed61('0x7a')](_0x399636),'value':_0x399636};}):[]};})};}})['then'](respondWithResult(_0x5849ea,null))['catch'](function(_0x2b4530){var _0x3fd321=_0x45b2b7[_0xed61('0x40')][_0xed61('0x1f')]?0x1f4:_0x2b4530[_0xed61('0x7b')]||0x1f4;logger[_0xed61('0x28')](_0xed61('0x7c'),'getFields',_0x3fd321,JSON['stringify'](_0x2b4530));delete _0x2b4530[_0xed61('0x39')];if(_0x3fd321===0x191){_0x3fd321=0x190;}_0x5849ea[_0xed61('0x2d')](_0x3fd321)[_0xed61('0x3a')](_0x45b2b7[_0xed61('0x40')][_0xed61('0x1f')]?{'message':_0xed61('0x7d'),'statusCode':_0x2b4530[_0xed61('0x7b')]}:_0x2b4530);});}; \ No newline at end of file +var _0xf0ee=['where','filters','filter','merge','VIRTUAL','options','include','rows','show','params','find','create','body','getConfigurations','findOne','FreshdeskConfiguration','rawAttributes','pick','nolimit','addConfiguration','AccountId','Subjects','Descriptions','getDescriptions','channel','FreshdeskField','getFields','remoteUri','apiKey','slice','substring','lastIndexOf','format','api/v2/ticket_fields','Basic\x20%s','%s:X','toString','base64','subject','agent','priority','remove','includes','default','custom_text','custom_dropdown','label','choices','capitalize','statusCode','getFields,\x20%s,\x20%s,\x20%s','rimraf','zip-dir','fast-json-patch','util','path','sox','to-csv','ejs','lodash','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','http','test','Sequelize','request','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','FreshdeskAccount','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort'];(function(_0x550d12,_0x5384bd){var _0x12103d=function(_0x2a9834){while(--_0x2a9834){_0x550d12['push'](_0x550d12['shift']());}};_0x12103d(++_0x5384bd);}(_0xf0ee,0x127));var _0xef0e=function(_0x90a6f9,_0x2658e2){_0x90a6f9=_0x90a6f9-0x0;var _0x507f0c=_0xf0ee[_0x90a6f9];return _0x507f0c;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xef0e('0x0'));var zipdir=require(_0xef0e('0x1'));var jsonpatch=require(_0xef0e('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xef0e('0x3'));var path=require(_0xef0e('0x4'));var sox=require(_0xef0e('0x5'));var csv=require(_0xef0e('0x6'));var ejs=require(_0xef0e('0x7'));var fs=require('fs');var _=require(_0xef0e('0x8'));var squel=require(_0xef0e('0x9'));var crypto=require('crypto');var jsforce=require(_0xef0e('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xef0e('0x6'));var querystring=require('querystring');var Papa=require(_0xef0e('0xb'));var Redis=require(_0xef0e('0xc'));var authService=require(_0xef0e('0xd'));var qs=require(_0xef0e('0xe'));var as=require(_0xef0e('0xf'));var hardwareService=require(_0xef0e('0x10'));var logger=require('../../config/logger')(_0xef0e('0x11'));var utils=require(_0xef0e('0x12'));var config=require(_0xef0e('0x13'));var db=require(_0xef0e('0x14'))['db'];var integrations=require(_0xef0e('0x15'));var jayson=require(_0xef0e('0x16'));var client=jayson['client'][_0xef0e('0x17')]({'port':0x232a});function checkPasswordPattern(_0x2ef454,_0x40a9dc,_0x38b15b){if(_0x38b15b){var _0x1e2ad0=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1e2ad0[_0xef0e('0x18')](_0x40a9dc)){return _0x2ef454;}else{throw new db[(_0xef0e('0x19'))]['ValidationError']('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x2ef454;}}function respondWithRpcPromise(_0x165687,_0x294fea,_0x769950,_0x4f8082){return new BPromise(function(_0x5e3339,_0x5865da){var _0x1c0a2f=_0x4f8082||client;return _0x1c0a2f[_0xef0e('0x1a')](_0x165687,_0x769950)['then'](function(_0x5cec7b){logger[_0xef0e('0x1b')](_0xef0e('0x1c'),_0x294fea,_0xef0e('0x1d'));logger[_0xef0e('0x1e')](_0xef0e('0x1f'),_0x294fea,_0xef0e('0x1d'),JSON[_0xef0e('0x20')](_0x5cec7b));if(_0x5cec7b[_0xef0e('0x21')]){if(_0x5cec7b[_0xef0e('0x21')][_0xef0e('0x22')]===0x1f4){logger[_0xef0e('0x21')]('FreshdeskAccount,\x20%s,\x20%s',_0x294fea,_0x5cec7b[_0xef0e('0x21')][_0xef0e('0x23')]);return _0x5865da(_0x5cec7b[_0xef0e('0x21')][_0xef0e('0x23')]);}logger['error'](_0xef0e('0x1c'),_0x294fea,_0x5cec7b[_0xef0e('0x21')]['message']);return _0x5e3339(_0x5cec7b[_0xef0e('0x21')][_0xef0e('0x23')]);}else{logger[_0xef0e('0x1b')](_0xef0e('0x1c'),_0x294fea,_0xef0e('0x1d'));_0x5e3339(_0x5cec7b[_0xef0e('0x24')][_0xef0e('0x23')]);}})[_0xef0e('0x25')](function(_0x21d462){logger['error'](_0xef0e('0x1c'),_0x294fea,_0x21d462);_0x5865da(_0x21d462);});});}function respondWithStatusCode(_0x1fa65e,_0x22ecf7){_0x22ecf7=_0x22ecf7||0xcc;return function(_0x5be7ef){if(_0x5be7ef){return _0x1fa65e[_0xef0e('0x26')](_0x22ecf7);}return _0x1fa65e['status'](_0x22ecf7)[_0xef0e('0x27')]();};}function respondWithResult(_0x5cfd11,_0x4eeecd){_0x4eeecd=_0x4eeecd||0xc8;return function(_0x423ec2){if(_0x423ec2){return _0x5cfd11[_0xef0e('0x28')](_0x4eeecd)[_0xef0e('0x29')](_0x423ec2);}};}function respondWithFilteredResult(_0x1d977f,_0x50abfc){return function(_0xab261){if(_0xab261){var _0x3c39a9=_0xab261[_0xef0e('0x2a')],_0x27ddef=_0x50abfc['offset'],_0x216b8b=_0x50abfc[_0xef0e('0x2b')]+_0x50abfc[_0xef0e('0x2c')],_0xb0c716;if(_0x216b8b>=_0x3c39a9){_0x216b8b=_0x3c39a9;_0xb0c716=0xc8;}else{_0xb0c716=0xce;}_0x1d977f[_0xef0e('0x28')](_0xb0c716);return _0x1d977f[_0xef0e('0x2d')](_0xef0e('0x2e'),_0x27ddef+'-'+_0x216b8b+'/'+_0x3c39a9)[_0xef0e('0x29')](_0xab261);}return null;};}function patchUpdates(_0xd32975){return function(_0x532c12){try{jsonpatch[_0xef0e('0x2f')](_0x532c12,_0xd32975,!![]);}catch(_0x4d2ac4){return BPromise[_0xef0e('0x30')](_0x4d2ac4);}return _0x532c12[_0xef0e('0x31')]();};}function saveUpdates(_0x277dec,_0x51eb20){return function(_0x431348){if(_0x431348){return _0x431348[_0xef0e('0x32')](_0x277dec)[_0xef0e('0x33')](function(_0x35bf3f){return _0x35bf3f;});}return null;};}function removeEntity(_0x8f011f,_0x1e1196){return function(_0x47e60b){if(_0x47e60b){return _0x47e60b[_0xef0e('0x34')]()[_0xef0e('0x33')](function(){_0x8f011f[_0xef0e('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ef828,_0x3e4c52){return function(_0x1c46a3){if(!_0x1c46a3){_0x2ef828[_0xef0e('0x26')](0x194);}return _0x1c46a3;};}function handleError(_0x414518,_0x459c53){_0x459c53=_0x459c53||0x1f4;return function(_0x50f912){logger[_0xef0e('0x21')](_0x50f912[_0xef0e('0x35')]);if(_0x50f912[_0xef0e('0x36')]){delete _0x50f912['name'];}_0x414518[_0xef0e('0x28')](_0x459c53)[_0xef0e('0x37')](_0x50f912);};}exports[_0xef0e('0x38')]=function(_0x2a1010,_0x56c1cd){var _0x4bf40e={},_0x410783={},_0x6f1f16={'count':0x0,'rows':[]};var _0x3bab12=_[_0xef0e('0x39')](db[_0xef0e('0x3a')]['rawAttributes'],function(_0x17e1f9){return{'name':_0x17e1f9[_0xef0e('0x3b')],'type':_0x17e1f9[_0xef0e('0x3c')]['key']};});_0x410783[_0xef0e('0x3d')]=_[_0xef0e('0x39')](_0x3bab12,_0xef0e('0x36'));_0x410783[_0xef0e('0x3e')]=_[_0xef0e('0x3f')](_0x2a1010[_0xef0e('0x3e')]);_0x410783['filters']=_[_0xef0e('0x40')](_0x410783[_0xef0e('0x3d')],_0x410783[_0xef0e('0x3e')]);_0x4bf40e[_0xef0e('0x41')]=_['intersection'](_0x410783[_0xef0e('0x3d')],qs[_0xef0e('0x42')](_0x2a1010[_0xef0e('0x3e')]['fields']));_0x4bf40e[_0xef0e('0x41')]=_0x4bf40e[_0xef0e('0x41')][_0xef0e('0x43')]?_0x4bf40e['attributes']:_0x410783[_0xef0e('0x3d')];if(!_0x2a1010[_0xef0e('0x3e')][_0xef0e('0x44')]('nolimit')){_0x4bf40e[_0xef0e('0x2c')]=qs[_0xef0e('0x2c')](_0x2a1010[_0xef0e('0x3e')][_0xef0e('0x2c')]);_0x4bf40e[_0xef0e('0x2b')]=qs[_0xef0e('0x2b')](_0x2a1010[_0xef0e('0x3e')]['offset']);}_0x4bf40e[_0xef0e('0x45')]=qs[_0xef0e('0x46')](_0x2a1010[_0xef0e('0x3e')]['sort']);_0x4bf40e[_0xef0e('0x47')]=qs[_0xef0e('0x48')](_['pick'](_0x2a1010[_0xef0e('0x3e')],_0x410783[_0xef0e('0x48')]));if(_0x2a1010[_0xef0e('0x3e')][_0xef0e('0x49')]){_0x4bf40e[_0xef0e('0x47')]=_[_0xef0e('0x4a')](_0x4bf40e[_0xef0e('0x47')],{'$or':_[_0xef0e('0x39')](_0x3bab12,function(_0x39adb2){if(_0x39adb2['type']!==_0xef0e('0x4b')){var _0x1b1cb3={};_0x1b1cb3[_0x39adb2['name']]={'$like':'%'+_0x2a1010[_0xef0e('0x3e')]['filter']+'%'};return _0x1b1cb3;}})});}_0x4bf40e=_[_0xef0e('0x4a')]({},_0x4bf40e,_0x2a1010[_0xef0e('0x4c')]);var _0x50d0e8={'where':_0x4bf40e[_0xef0e('0x47')]};return db[_0xef0e('0x3a')][_0xef0e('0x2a')](_0x50d0e8)[_0xef0e('0x33')](function(_0x209266){_0x6f1f16[_0xef0e('0x2a')]=_0x209266;if(_0x2a1010[_0xef0e('0x3e')]['includeAll']){_0x4bf40e[_0xef0e('0x4d')]=[{'all':!![]}];}return db[_0xef0e('0x3a')]['findAll'](_0x4bf40e);})[_0xef0e('0x33')](function(_0x14e3d6){_0x6f1f16[_0xef0e('0x4e')]=_0x14e3d6;return _0x6f1f16;})[_0xef0e('0x33')](respondWithFilteredResult(_0x56c1cd,_0x4bf40e))[_0xef0e('0x25')](handleError(_0x56c1cd,null));};exports[_0xef0e('0x4f')]=function(_0x14afb0,_0x235855){var _0x96675f={'raw':![],'where':{'id':_0x14afb0[_0xef0e('0x50')]['id']}},_0x19addc={};_0x19addc['model']=_[_0xef0e('0x3f')](db[_0xef0e('0x3a')]['rawAttributes']);_0x19addc[_0xef0e('0x3e')]=_[_0xef0e('0x3f')](_0x14afb0[_0xef0e('0x3e')]);_0x19addc[_0xef0e('0x48')]=_[_0xef0e('0x40')](_0x19addc[_0xef0e('0x3d')],_0x19addc[_0xef0e('0x3e')]);_0x96675f[_0xef0e('0x41')]=_[_0xef0e('0x40')](_0x19addc[_0xef0e('0x3d')],qs['fields'](_0x14afb0[_0xef0e('0x3e')][_0xef0e('0x42')]));_0x96675f[_0xef0e('0x41')]=_0x96675f[_0xef0e('0x41')][_0xef0e('0x43')]?_0x96675f[_0xef0e('0x41')]:_0x19addc[_0xef0e('0x3d')];if(_0x14afb0[_0xef0e('0x3e')]['includeAll']){_0x96675f['include']=[{'all':!![]}];}_0x96675f=_[_0xef0e('0x4a')]({},_0x96675f,_0x14afb0[_0xef0e('0x4c')]);return db['FreshdeskAccount'][_0xef0e('0x51')](_0x96675f)[_0xef0e('0x33')](handleEntityNotFound(_0x235855,null))[_0xef0e('0x33')](respondWithResult(_0x235855,null))[_0xef0e('0x25')](handleError(_0x235855,null));};exports[_0xef0e('0x52')]=function(_0x14e7a1,_0x55e9b2){return db[_0xef0e('0x3a')][_0xef0e('0x52')](_0x14e7a1[_0xef0e('0x53')],{})[_0xef0e('0x33')](respondWithResult(_0x55e9b2,0xc9))[_0xef0e('0x25')](handleError(_0x55e9b2,null));};exports[_0xef0e('0x32')]=function(_0x428ff4,_0x50fffe){if(_0x428ff4[_0xef0e('0x53')]['id']){delete _0x428ff4[_0xef0e('0x53')]['id'];}return db[_0xef0e('0x3a')]['find']({'where':{'id':_0x428ff4[_0xef0e('0x50')]['id']}})['then'](handleEntityNotFound(_0x50fffe,null))[_0xef0e('0x33')](saveUpdates(_0x428ff4[_0xef0e('0x53')],null))[_0xef0e('0x33')](respondWithResult(_0x50fffe,null))['catch'](handleError(_0x50fffe,null));};exports[_0xef0e('0x34')]=function(_0x24350e,_0x2aba20){return db['FreshdeskAccount'][_0xef0e('0x51')]({'where':{'id':_0x24350e[_0xef0e('0x50')]['id']}})[_0xef0e('0x33')](handleEntityNotFound(_0x2aba20,null))[_0xef0e('0x33')](removeEntity(_0x2aba20,null))[_0xef0e('0x25')](handleError(_0x2aba20,null));};exports[_0xef0e('0x54')]=function(_0x5d0708,_0x5e870d,_0x30063d){var _0x268511={};var _0xc073aa={};var _0x1b8a53;var _0x242e10;return db[_0xef0e('0x3a')][_0xef0e('0x55')]({'where':{'id':_0x5d0708[_0xef0e('0x50')]['id']}})[_0xef0e('0x33')](handleEntityNotFound(_0x5e870d,null))[_0xef0e('0x33')](function(_0x386492){if(_0x386492){_0x1b8a53=_0x386492;_0xc073aa[_0xef0e('0x3d')]=_[_0xef0e('0x3f')](db[_0xef0e('0x56')][_0xef0e('0x57')]);_0xc073aa[_0xef0e('0x3e')]=_[_0xef0e('0x3f')](_0x5d0708[_0xef0e('0x3e')]);_0xc073aa[_0xef0e('0x48')]=_['intersection'](_0xc073aa[_0xef0e('0x3d')],_0xc073aa['query']);_0x268511['attributes']=_['intersection'](_0xc073aa['model'],qs['fields'](_0x5d0708[_0xef0e('0x3e')][_0xef0e('0x42')]));_0x268511[_0xef0e('0x41')]=_0x268511[_0xef0e('0x41')]['length']?_0x268511['attributes']:_0xc073aa[_0xef0e('0x3d')];_0x268511['order']=qs['sort'](_0x5d0708[_0xef0e('0x3e')]['sort']);_0x268511[_0xef0e('0x47')]=qs[_0xef0e('0x48')](_[_0xef0e('0x58')](_0x5d0708[_0xef0e('0x3e')],_0xc073aa[_0xef0e('0x48')]));if(_0x5d0708[_0xef0e('0x3e')][_0xef0e('0x49')]){_0x268511[_0xef0e('0x47')]=_[_0xef0e('0x4a')](_0x268511['where'],{'$or':_[_0xef0e('0x39')](_0x268511[_0xef0e('0x41')],function(_0x4aa38b){var _0x535037={};_0x535037[_0x4aa38b]={'$like':'%'+_0x5d0708[_0xef0e('0x3e')][_0xef0e('0x49')]+'%'};return _0x535037;})});}_0x268511=_[_0xef0e('0x4a')]({},_0x268511,_0x5d0708[_0xef0e('0x4c')]);return _0x1b8a53[_0xef0e('0x54')](_0x268511);}})['then'](function(_0x215e93){if(_0x215e93){_0x242e10=_0x215e93['length'];if(!_0x5d0708[_0xef0e('0x3e')][_0xef0e('0x44')](_0xef0e('0x59'))){_0x268511[_0xef0e('0x2c')]=qs[_0xef0e('0x2c')](_0x5d0708[_0xef0e('0x3e')][_0xef0e('0x2c')]);_0x268511[_0xef0e('0x2b')]=qs[_0xef0e('0x2b')](_0x5d0708[_0xef0e('0x3e')][_0xef0e('0x2b')]);}return _0x1b8a53[_0xef0e('0x54')](_0x268511);}})[_0xef0e('0x33')](function(_0x2d381c){if(_0x2d381c){return _0x2d381c?{'count':_0x242e10,'rows':_0x2d381c}:null;}})[_0xef0e('0x33')](respondWithResult(_0x5e870d,null))[_0xef0e('0x25')](handleError(_0x5e870d,null));};exports[_0xef0e('0x5a')]=function(_0x3da569,_0x3d8741,_0x53042c){if(_0x3da569['body']['id']){delete _0x3da569[_0xef0e('0x53')]['id'];}return db['FreshdeskAccount'][_0xef0e('0x55')]({'where':{'id':_0x3da569[_0xef0e('0x50')]['id']}})['then'](handleEntityNotFound(_0x3d8741,null))[_0xef0e('0x33')](function(_0x28d6fe){if(_0x28d6fe){_0x3da569[_0xef0e('0x53')][_0xef0e('0x5b')]=_0x28d6fe['id'];_0x3da569[_0xef0e('0x53')][_0xef0e('0x5c')]=integrations['getSubjects'](_0x3da569['body']['channel'],_0x3da569[_0xef0e('0x53')][_0xef0e('0x3c')]);_0x3da569[_0xef0e('0x53')][_0xef0e('0x5d')]=integrations[_0xef0e('0x5e')](_0x3da569[_0xef0e('0x53')][_0xef0e('0x5f')],_0x3da569[_0xef0e('0x53')][_0xef0e('0x3c')]);return db[_0xef0e('0x56')]['create'](_0x3da569[_0xef0e('0x53')],{'include':[{'model':db[_0xef0e('0x60')],'as':_0xef0e('0x5c')},{'model':db[_0xef0e('0x60')],'as':_0xef0e('0x5d')}]});}return null;})[_0xef0e('0x33')](respondWithResult(_0x3d8741,null))[_0xef0e('0x25')](handleError(_0x3d8741,null));};exports[_0xef0e('0x61')]=function(_0x2a8d73,_0x364886,_0x35ca3d){var _0x3d7b4d='';return db[_0xef0e('0x3a')]['findOne']({'where':{'id':_0x2a8d73[_0xef0e('0x50')]['id']},'attributes':['id',_0xef0e('0x62'),_0xef0e('0x63')]})[_0xef0e('0x33')](handleEntityNotFound(_0x364886,null))[_0xef0e('0x33')](function(_0x22ff13){if(_0x22ff13){_0x3d7b4d=_0x22ff13[_0xef0e('0x62')];var _0x51c169=_0x3d7b4d[_0xef0e('0x64')](-0x1);if(_0x51c169==='/'){_0x3d7b4d=_0x3d7b4d[_0xef0e('0x65')](0x0,_0x3d7b4d[_0xef0e('0x66')](_0x51c169));}return rp({'method':'GET','uri':util[_0xef0e('0x67')]('%s/%s',_0x3d7b4d,_0xef0e('0x68')),'headers':{'Authorization':util[_0xef0e('0x67')](_0xef0e('0x69'),new Buffer(util['format'](_0xef0e('0x6a'),_0x22ff13[_0xef0e('0x63')]))[_0xef0e('0x6b')](_0xef0e('0x6c')))},'json':!![]});}})['then'](function(_0x369091){if(_0x369091){var _0x27ac05=['requester',_0xef0e('0x6d'),_0xef0e('0x6e'),'description',_0xef0e('0x28'),_0xef0e('0x6f'),'group','source','ticket_type','group','company'];_[_0xef0e('0x70')](_0x369091,function(_0x462a83){return _0x27ac05[_0xef0e('0x71')](_0x462a83[_0xef0e('0x36')])||!_0x462a83[_0xef0e('0x72')]&&_0x462a83[_0xef0e('0x3c')]!==_0xef0e('0x73')&&_0x462a83['type']!==_0xef0e('0x74');});return{'count':_0x369091[_0xef0e('0x43')],'rows':_[_0xef0e('0x39')](_0x369091,function(_0x2f4a40){return{'id':_0x2f4a40[_0xef0e('0x36')],'name':_0x2f4a40[_0xef0e('0x75')],'custom':!_0x2f4a40[_0xef0e('0x72')],'options':_0x2f4a40[_0xef0e('0x76')]?_['map'](_0x2f4a40[_0xef0e('0x76')],function(_0x28614d){return{'name':_[_0xef0e('0x77')](_0x28614d),'value':_0x28614d};}):[]};})};}})[_0xef0e('0x33')](respondWithResult(_0x364886,null))[_0xef0e('0x25')](function(_0x58c6e7){var _0x223aa5=_0x2a8d73['query'][_0xef0e('0x18')]?0x1f4:_0x58c6e7[_0xef0e('0x78')]||0x1f4;logger[_0xef0e('0x21')](_0xef0e('0x79'),'getFields',_0x223aa5,JSON[_0xef0e('0x20')](_0x58c6e7));delete _0x58c6e7[_0xef0e('0x36')];if(_0x223aa5===0x191){_0x223aa5=0x190;}_0x364886['status'](_0x223aa5)[_0xef0e('0x37')](_0x2a8d73[_0xef0e('0x3e')][_0xef0e('0x18')]?{'message':'Wrong\x20credentials','statusCode':_0x58c6e7['statusCode']}:_0x58c6e7);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index 075b03e..af5637f 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 _0xe6c3=['util','api','path','rimraf','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','define','FreshdeskAccount','int_freshdesk_accounts','lodash'];(function(_0x5a037a,_0x44a3fc){var _0x28ff57=function(_0x13d49f){while(--_0x13d49f){_0x5a037a['push'](_0x5a037a['shift']());}};_0x28ff57(++_0x44a3fc);}(_0xe6c3,0x1c7));var _0x3e6c=function(_0x3376ef,_0x49e4ff){_0x3376ef=_0x3376ef-0x0;var _0x4f905f=_0xe6c3[_0x3376ef];return _0x4f905f;};'use strict';var _=require(_0x3e6c('0x0'));var util=require(_0x3e6c('0x1'));var logger=require('../../config/logger')(_0x3e6c('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x3e6c('0x3'));var rimraf=require(_0x3e6c('0x4'));var config=require(_0x3e6c('0x5'));var attributes=require(_0x3e6c('0x6'));var integrations=require(_0x3e6c('0x7'));module[_0x3e6c('0x8')]=function(_0x2a9b8e,_0x4cf357){return _0x2a9b8e[_0x3e6c('0x9')](_0x3e6c('0xa'),attributes,{'tableName':_0x3e6c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9fa4=['lodash','util','../../config/logger','request-promise','path','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','define','FreshdeskAccount','int_freshdesk_accounts'];(function(_0x1b3a9e,_0x3b6e29){var _0x53cdc2=function(_0x4b14ec){while(--_0x4b14ec){_0x1b3a9e['push'](_0x1b3a9e['shift']());}};_0x53cdc2(++_0x3b6e29);}(_0x9fa4,0x1c3));var _0x49fa=function(_0x3685b0,_0x111044){_0x3685b0=_0x3685b0-0x0;var _0x548adb=_0x9fa4[_0x3685b0];return _0x548adb;};'use strict';var _=require(_0x49fa('0x0'));var util=require(_0x49fa('0x1'));var logger=require(_0x49fa('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x49fa('0x3'));var fs=require('fs');var path=require(_0x49fa('0x4'));var rimraf=require('rimraf');var config=require(_0x49fa('0x5'));var attributes=require(_0x49fa('0x6'));var integrations=require(_0x49fa('0x7'));module['exports']=function(_0x29de64,_0xde11d6){return _0x29de64[_0x49fa('0x8')](_0x49fa('0x9'),attributes,{'tableName':_0x49fa('0xa'),'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 062e633..74035a0 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 _0x5595=['then','FreshdeskAccount,\x20%s,\x20%s','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','GetFreshdeskAccount','FreshdeskAccount','findAll','options','raw','where','attributes','limit','include','map','model','ShowFreshdeskAccount','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x55fab2,_0x23d552){var _0x231163=function(_0x4c388a){while(--_0x4c388a){_0x55fab2['push'](_0x55fab2['shift']());}};_0x231163(++_0x23d552);}(_0x5595,0x1eb));var _0x5559=function(_0x3c149d,_0x461ddc){_0x3c149d=_0x3c149d-0x0;var _0x5d298c=_0x5595[_0x3c149d];return _0x5d298c;};'use strict';var _=require(_0x5559('0x0'));var util=require(_0x5559('0x1'));var moment=require(_0x5559('0x2'));var BPromise=require(_0x5559('0x3'));var rs=require(_0x5559('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x5559('0x5'));var logger=require(_0x5559('0x6'))(_0x5559('0x7'));var config=require(_0x5559('0x8'));var jayson=require(_0x5559('0x9'));var client=jayson[_0x5559('0xa')][_0x5559('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1c5d44,_0xa8d1bd,_0x2762b6){return new BPromise(function(_0x13b109,_0x3f6ef3){return client[_0x5559('0xc')](_0x1c5d44,_0x2762b6)[_0x5559('0xd')](function(_0x5516e3){logger['info'](_0x5559('0xe'),_0xa8d1bd,'request\x20sent');logger[_0x5559('0xf')](_0x5559('0x10'),_0xa8d1bd,_0x5559('0x11'),JSON['stringify'](_0x5516e3));if(_0x5516e3[_0x5559('0x12')]){if(_0x5516e3[_0x5559('0x12')][_0x5559('0x13')]===0x1f4){logger['error'](_0x5559('0xe'),_0xa8d1bd,_0x5516e3[_0x5559('0x12')]['message']);return _0x3f6ef3(_0x5516e3[_0x5559('0x12')][_0x5559('0x14')]);}logger['error'](_0x5559('0xe'),_0xa8d1bd,_0x5516e3['error'][_0x5559('0x14')]);return _0x13b109(_0x5516e3[_0x5559('0x12')][_0x5559('0x14')]);}else{logger[_0x5559('0x15')](_0x5559('0xe'),_0xa8d1bd,'request\x20sent');_0x13b109(_0x5516e3[_0x5559('0x16')][_0x5559('0x14')]);}})[_0x5559('0x17')](function(_0x1335e9){logger[_0x5559('0x12')]('FreshdeskAccount,\x20%s,\x20%s',_0xa8d1bd,_0x1335e9);_0x3f6ef3(_0x1335e9);});});}exports[_0x5559('0x18')]=function(_0x345a98){var _0x4c5543=this;return new Promise(function(_0x1b7130,_0xeb6912){return db[_0x5559('0x19')][_0x5559('0x1a')]({'raw':_0x345a98[_0x5559('0x1b')]?_0x345a98[_0x5559('0x1b')][_0x5559('0x1c')]===undefined?!![]:![]:!![],'where':_0x345a98[_0x5559('0x1b')]?_0x345a98['options'][_0x5559('0x1d')]||null:null,'attributes':_0x345a98[_0x5559('0x1b')]?_0x345a98[_0x5559('0x1b')][_0x5559('0x1e')]||null:null,'limit':_0x345a98[_0x5559('0x1b')]?_0x345a98['options'][_0x5559('0x1f')]||null:null,'include':_0x345a98['options']?_0x345a98['options'][_0x5559('0x20')]?_[_0x5559('0x21')](_0x345a98[_0x5559('0x1b')][_0x5559('0x20')],function(_0x3db9f2){return{'model':db[_0x3db9f2[_0x5559('0x22')]],'as':_0x3db9f2['as'],'attributes':_0x3db9f2[_0x5559('0x1e')],'include':_0x3db9f2[_0x5559('0x20')]?_[_0x5559('0x21')](_0x3db9f2[_0x5559('0x20')],function(_0x2bf098){return{'model':db[_0x2bf098[_0x5559('0x22')]],'as':_0x2bf098['as'],'attributes':_0x2bf098[_0x5559('0x1e')],'include':_0x2bf098[_0x5559('0x20')]?_[_0x5559('0x21')](_0x2bf098[_0x5559('0x20')],function(_0x5215b8){return{'model':db[_0x5215b8[_0x5559('0x22')]],'as':_0x5215b8['as'],'attributes':_0x5215b8[_0x5559('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x5559('0xd')](function(_0x312a4a){logger[_0x5559('0x15')](_0x5559('0x18'),_0x345a98);logger['debug']('GetFreshdeskAccount',_0x345a98,JSON['stringify'](_0x312a4a));_0x1b7130(_0x312a4a);})['catch'](function(_0x22a783){logger[_0x5559('0x12')](_0x5559('0x18'),_0x22a783['message'],_0x345a98);_0xeb6912(_0x4c5543['error'](0x1f4,_0x22a783[_0x5559('0x14')]));});});};exports[_0x5559('0x23')]=function(_0x23d2b6){var _0x4603be=this;return new Promise(function(_0x4ba891,_0x4e737c){return db['FreshdeskAccount']['find']({'raw':_0x23d2b6[_0x5559('0x1b')]?_0x23d2b6['options'][_0x5559('0x1c')]===undefined?!![]:![]:!![],'where':_0x23d2b6['options']?_0x23d2b6[_0x5559('0x1b')][_0x5559('0x1d')]||null:null,'attributes':_0x23d2b6['options']?_0x23d2b6[_0x5559('0x1b')][_0x5559('0x1e')]||null:null,'include':_0x23d2b6[_0x5559('0x1b')]?_0x23d2b6['options']['include']?_[_0x5559('0x21')](_0x23d2b6[_0x5559('0x1b')][_0x5559('0x20')],function(_0xe61b6f){return{'model':db[_0xe61b6f[_0x5559('0x22')]],'as':_0xe61b6f['as'],'attributes':_0xe61b6f[_0x5559('0x1e')],'include':_0xe61b6f[_0x5559('0x20')]?_[_0x5559('0x21')](_0xe61b6f[_0x5559('0x20')],function(_0x8ef972){return{'model':db[_0x8ef972[_0x5559('0x22')]],'as':_0x8ef972['as'],'attributes':_0x8ef972[_0x5559('0x1e')],'include':_0x8ef972[_0x5559('0x20')]?_[_0x5559('0x21')](_0x8ef972['include'],function(_0x1de5bd){return{'model':db[_0x1de5bd[_0x5559('0x22')]],'as':_0x1de5bd['as'],'attributes':_0x1de5bd[_0x5559('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x5559('0xd')](function(_0x4ad0a6){logger[_0x5559('0x15')]('ShowFreshdeskAccount',_0x23d2b6);logger[_0x5559('0xf')]('ShowFreshdeskAccount',_0x23d2b6,JSON['stringify'](_0x4ad0a6));_0x4ba891(_0x4ad0a6);})[_0x5559('0x17')](function(_0x491eb9){logger[_0x5559('0x12')](_0x5559('0x23'),_0x491eb9[_0x5559('0x14')],_0x23d2b6);_0x4e737c(_0x4603be[_0x5559('0x12')](0x1f4,_0x491eb9[_0x5559('0x14')]));});});}; \ No newline at end of file +var _0x853b=['map','ShowFreshdeskAccount','find','where','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetFreshdeskAccount','FreshdeskAccount','findAll','options','raw','attributes','limit','include','model'];(function(_0x133928,_0x14e8e){var _0x320d88=function(_0x3c6179){while(--_0x3c6179){_0x133928['push'](_0x133928['shift']());}};_0x320d88(++_0x14e8e);}(_0x853b,0x94));var _0xb853=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x853b[_0x5ddb1c];return _0x354adc;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xb853('0x0'));var rs=require(_0xb853('0x1'));var fs=require('fs');var Redis=require(_0xb853('0x2'));var db=require(_0xb853('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xb853('0x4'))(_0xb853('0x5'));var config=require(_0xb853('0x6'));var jayson=require(_0xb853('0x7'));var client=jayson[_0xb853('0x8')][_0xb853('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x511687,_0x25ff0f,_0x465fc5){return new BPromise(function(_0x50df3f,_0x2a38fa){return client[_0xb853('0xa')](_0x511687,_0x465fc5)[_0xb853('0xb')](function(_0x171ed8){logger[_0xb853('0xc')](_0xb853('0xd'),_0x25ff0f,_0xb853('0xe'));logger[_0xb853('0xf')](_0xb853('0x10'),_0x25ff0f,'request\x20sent',JSON[_0xb853('0x11')](_0x171ed8));if(_0x171ed8[_0xb853('0x12')]){if(_0x171ed8[_0xb853('0x12')][_0xb853('0x13')]===0x1f4){logger[_0xb853('0x12')](_0xb853('0xd'),_0x25ff0f,_0x171ed8[_0xb853('0x12')][_0xb853('0x14')]);return _0x2a38fa(_0x171ed8['error'][_0xb853('0x14')]);}logger[_0xb853('0x12')]('FreshdeskAccount,\x20%s,\x20%s',_0x25ff0f,_0x171ed8[_0xb853('0x12')]['message']);return _0x50df3f(_0x171ed8[_0xb853('0x12')][_0xb853('0x14')]);}else{logger[_0xb853('0xc')](_0xb853('0xd'),_0x25ff0f,'request\x20sent');_0x50df3f(_0x171ed8[_0xb853('0x15')][_0xb853('0x14')]);}})[_0xb853('0x16')](function(_0x2b5cc3){logger[_0xb853('0x12')]('FreshdeskAccount,\x20%s,\x20%s',_0x25ff0f,_0x2b5cc3);_0x2a38fa(_0x2b5cc3);});});}exports[_0xb853('0x17')]=function(_0x351e78){var _0x343ea1=this;return new Promise(function(_0x5e8fcf,_0x477fa9){return db[_0xb853('0x18')][_0xb853('0x19')]({'raw':_0x351e78[_0xb853('0x1a')]?_0x351e78[_0xb853('0x1a')][_0xb853('0x1b')]===undefined?!![]:![]:!![],'where':_0x351e78[_0xb853('0x1a')]?_0x351e78[_0xb853('0x1a')]['where']||null:null,'attributes':_0x351e78['options']?_0x351e78['options'][_0xb853('0x1c')]||null:null,'limit':_0x351e78[_0xb853('0x1a')]?_0x351e78[_0xb853('0x1a')][_0xb853('0x1d')]||null:null,'include':_0x351e78[_0xb853('0x1a')]?_0x351e78[_0xb853('0x1a')][_0xb853('0x1e')]?_['map'](_0x351e78['options'][_0xb853('0x1e')],function(_0x7dd2f0){return{'model':db[_0x7dd2f0[_0xb853('0x1f')]],'as':_0x7dd2f0['as'],'attributes':_0x7dd2f0['attributes'],'include':_0x7dd2f0[_0xb853('0x1e')]?_[_0xb853('0x20')](_0x7dd2f0[_0xb853('0x1e')],function(_0x1d5ed7){return{'model':db[_0x1d5ed7[_0xb853('0x1f')]],'as':_0x1d5ed7['as'],'attributes':_0x1d5ed7[_0xb853('0x1c')],'include':_0x1d5ed7['include']?_[_0xb853('0x20')](_0x1d5ed7[_0xb853('0x1e')],function(_0x170319){return{'model':db[_0x170319[_0xb853('0x1f')]],'as':_0x170319['as'],'attributes':_0x170319[_0xb853('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xb853('0xb')](function(_0x51b788){logger[_0xb853('0xc')](_0xb853('0x17'),_0x351e78);logger['debug'](_0xb853('0x17'),_0x351e78,JSON[_0xb853('0x11')](_0x51b788));_0x5e8fcf(_0x51b788);})[_0xb853('0x16')](function(_0x4729f0){logger[_0xb853('0x12')](_0xb853('0x17'),_0x4729f0[_0xb853('0x14')],_0x351e78);_0x477fa9(_0x343ea1[_0xb853('0x12')](0x1f4,_0x4729f0[_0xb853('0x14')]));});});};exports[_0xb853('0x21')]=function(_0xb6b9f){var _0x23f9e1=this;return new Promise(function(_0x18adf3,_0x171606){return db['FreshdeskAccount'][_0xb853('0x22')]({'raw':_0xb6b9f[_0xb853('0x1a')]?_0xb6b9f['options'][_0xb853('0x1b')]===undefined?!![]:![]:!![],'where':_0xb6b9f[_0xb853('0x1a')]?_0xb6b9f['options'][_0xb853('0x23')]||null:null,'attributes':_0xb6b9f['options']?_0xb6b9f[_0xb853('0x1a')][_0xb853('0x1c')]||null:null,'include':_0xb6b9f[_0xb853('0x1a')]?_0xb6b9f[_0xb853('0x1a')][_0xb853('0x1e')]?_[_0xb853('0x20')](_0xb6b9f['options'][_0xb853('0x1e')],function(_0x1013a3){return{'model':db[_0x1013a3['model']],'as':_0x1013a3['as'],'attributes':_0x1013a3[_0xb853('0x1c')],'include':_0x1013a3[_0xb853('0x1e')]?_[_0xb853('0x20')](_0x1013a3[_0xb853('0x1e')],function(_0x4ce408){return{'model':db[_0x4ce408[_0xb853('0x1f')]],'as':_0x4ce408['as'],'attributes':_0x4ce408[_0xb853('0x1c')],'include':_0x4ce408[_0xb853('0x1e')]?_[_0xb853('0x20')](_0x4ce408[_0xb853('0x1e')],function(_0x58ecde){return{'model':db[_0x58ecde['model']],'as':_0x58ecde['as'],'attributes':_0x58ecde[_0xb853('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xb853('0xb')](function(_0x2df0b4){logger[_0xb853('0xc')](_0xb853('0x21'),_0xb6b9f);logger[_0xb853('0xf')]('ShowFreshdeskAccount',_0xb6b9f,JSON[_0xb853('0x11')](_0x2df0b4));_0x18adf3(_0x2df0b4);})[_0xb853('0x16')](function(_0x13427e){logger['error'](_0xb853('0x21'),_0x13427e[_0xb853('0x14')],_0xb6b9f);_0x171606(_0x23f9e1[_0xb853('0x12')](0x1f4,_0x13427e[_0xb853('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 8618039..b7d0043 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 _0xe2b3=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','setTags','put','destroy','exports'];(function(_0x11ca63,_0xea9f9c){var _0x41f1f6=function(_0xb80b69){while(--_0xb80b69){_0x11ca63['push'](_0x11ca63['shift']());}};_0x41f1f6(++_0xea9f9c);}(_0xe2b3,0x1ba));var _0x3e2b=function(_0x38854e,_0x23cbc9){_0x38854e=_0x38854e-0x0;var _0x3f8415=_0xe2b3[_0x38854e];return _0x3f8415;};'use strict';var multer=require(_0x3e2b('0x0'));var util=require(_0x3e2b('0x1'));var path=require(_0x3e2b('0x2'));var timeout=require(_0x3e2b('0x3'));var express=require(_0x3e2b('0x4'));var router=express[_0x3e2b('0x5')]();var auth=require(_0x3e2b('0x6'));var interaction=require(_0x3e2b('0x7'));var config=require(_0x3e2b('0x8'));var controller=require(_0x3e2b('0x9'));router[_0x3e2b('0xa')]('/',auth[_0x3e2b('0xb')](),controller[_0x3e2b('0xc')]);router['get'](_0x3e2b('0xd'),auth[_0x3e2b('0xb')](),controller[_0x3e2b('0xe')]);router[_0x3e2b('0xa')](_0x3e2b('0xf'),auth[_0x3e2b('0xb')](),controller['getFields']);router[_0x3e2b('0xa')]('/:id/subjects',auth[_0x3e2b('0xb')](),controller[_0x3e2b('0x10')]);router['get'](_0x3e2b('0x11'),auth[_0x3e2b('0xb')](),controller[_0x3e2b('0x12')]);router['get'](_0x3e2b('0x13'),auth[_0x3e2b('0xb')](),controller[_0x3e2b('0x14')]);router['post']('/',auth[_0x3e2b('0xb')](),controller['create']);router[_0x3e2b('0x15')](_0x3e2b('0x13'),auth[_0x3e2b('0xb')](),controller[_0x3e2b('0x16')]);router[_0x3e2b('0x17')](_0x3e2b('0xd'),auth[_0x3e2b('0xb')](),controller['update']);router['delete'](_0x3e2b('0xd'),auth[_0x3e2b('0xb')](),controller[_0x3e2b('0x18')]);module[_0x3e2b('0x19')]=router; \ No newline at end of file +var _0xb9a6=['Router','../../components/interaction/service','./intFreshdeskConfiguration.controller','get','isAuthenticated','index','/:id','show','getFields','/:id/subjects','getSubjects','/:id/descriptions','getTags','post','create','put','update','delete','destroy','util','path','connect-timeout','express'];(function(_0x29fcaf,_0x20c943){var _0x4adcb2=function(_0x59e82a){while(--_0x59e82a){_0x29fcaf['push'](_0x29fcaf['shift']());}};_0x4adcb2(++_0x20c943);}(_0xb9a6,0x13e));var _0x6b9a=function(_0x3eb9e6,_0x4b044d){_0x3eb9e6=_0x3eb9e6-0x0;var _0x1c2da0=_0xb9a6[_0x3eb9e6];return _0x1c2da0;};'use strict';var multer=require('multer');var util=require(_0x6b9a('0x0'));var path=require(_0x6b9a('0x1'));var timeout=require(_0x6b9a('0x2'));var express=require(_0x6b9a('0x3'));var router=express[_0x6b9a('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x6b9a('0x5'));var config=require('../../config/environment');var controller=require(_0x6b9a('0x6'));router[_0x6b9a('0x7')]('/',auth[_0x6b9a('0x8')](),controller[_0x6b9a('0x9')]);router[_0x6b9a('0x7')](_0x6b9a('0xa'),auth['isAuthenticated'](),controller[_0x6b9a('0xb')]);router[_0x6b9a('0x7')]('/:id/fields',auth[_0x6b9a('0x8')](),controller[_0x6b9a('0xc')]);router[_0x6b9a('0x7')](_0x6b9a('0xd'),auth['isAuthenticated'](),controller[_0x6b9a('0xe')]);router[_0x6b9a('0x7')](_0x6b9a('0xf'),auth[_0x6b9a('0x8')](),controller['getDescriptions']);router[_0x6b9a('0x7')]('/:id/tags',auth[_0x6b9a('0x8')](),controller[_0x6b9a('0x10')]);router[_0x6b9a('0x11')]('/',auth[_0x6b9a('0x8')](),controller[_0x6b9a('0x12')]);router[_0x6b9a('0x11')]('/:id/tags',auth[_0x6b9a('0x8')](),controller['setTags']);router[_0x6b9a('0x13')]('/:id',auth[_0x6b9a('0x8')](),controller[_0x6b9a('0x14')]);router[_0x6b9a('0x15')](_0x6b9a('0xa'),auth[_0x6b9a('0x8')](),controller[_0x6b9a('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index a688135..76d4ead 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. * // * * // ************************************************************************* -'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xa497=['sequelize','STRING'];(function(_0x5a3abf,_0x5448c6){var _0xf02c9b=function(_0x7af518){while(--_0x7af518){_0x5a3abf['push'](_0x5a3abf['shift']());}};_0xf02c9b(++_0x5448c6);}(_0xa497,0x9e));var _0x7a49=function(_0x1d472a,_0x18bef2){_0x1d472a=_0x1d472a-0x0;var _0x50f16e=_0xa497[_0x1d472a];return _0x50f16e;};'use strict';var Sequelize=require(_0x7a49('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x7a49('0x1')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index d67be1f..00556e4 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 _0x3b57=['../../config/logger','api','../../mysqldb','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','end','count','offset','limit','Content-Range','json','apply','reject','save','update','destroy','stack','name','send','map','FreshdeskConfiguration','rawAttributes','fieldName','type','key','query','intersection','model','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','include','show','params','keys','length','find','create','body','getFields','findOne','FreshdeskField','order','getDescriptions','getTags','setTags','ids','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','util','sox','to-csv','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch'];(function(_0x10add6,_0xef4429){var _0x3bbb02=function(_0x305d6d){while(--_0x305d6d){_0x10add6['push'](_0x10add6['shift']());}};_0x3bbb02(++_0xef4429);}(_0x3b57,0x103));var _0x73b5=function(_0x2bd4e3,_0x4d9b53){_0x2bd4e3=_0x2bd4e3-0x0;var _0x259f7c=_0x3b57[_0x2bd4e3];return _0x259f7c;};'use strict';var pdf=require(_0x73b5('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x73b5('0x1'));var zipdir=require(_0x73b5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x73b5('0x3'));var moment=require(_0x73b5('0x4'));var BPromise=require(_0x73b5('0x5'));var Mustache=require('mustache');var util=require(_0x73b5('0x6'));var path=require('path');var sox=require(_0x73b5('0x7'));var csv=require(_0x73b5('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x73b5('0x9'));var crypto=require(_0x73b5('0xa'));var jsforce=require(_0x73b5('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x73b5('0x8'));var querystring=require(_0x73b5('0xc'));var Papa=require(_0x73b5('0xd'));var Redis=require(_0x73b5('0xe'));var authService=require(_0x73b5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x73b5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x73b5('0x11'))(_0x73b5('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x73b5('0x13'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x73b5('0x14')][_0x73b5('0x15')]({'port':0x232a});function checkPasswordPattern(_0x164f3b,_0x482d37,_0x7bb21e){if(_0x7bb21e){var _0x5387c9=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5387c9[_0x73b5('0x16')](_0x482d37)){return _0x164f3b;}else{throw new db[(_0x73b5('0x17'))][(_0x73b5('0x18'))](_0x73b5('0x19'));}}else{return _0x164f3b;}}function respondWithRpcPromise(_0x6c5ce1,_0x363488,_0x2af26b,_0x20b1e0){return new BPromise(function(_0x2427d0,_0x3e1633){var _0x4a19f6=_0x20b1e0||client;return _0x4a19f6[_0x73b5('0x1a')](_0x6c5ce1,_0x2af26b)[_0x73b5('0x1b')](function(_0x196e22){logger[_0x73b5('0x1c')](_0x73b5('0x1d'),_0x363488,_0x73b5('0x1e'));logger[_0x73b5('0x1f')](_0x73b5('0x20'),_0x363488,_0x73b5('0x1e'),JSON[_0x73b5('0x21')](_0x196e22));if(_0x196e22[_0x73b5('0x22')]){if(_0x196e22[_0x73b5('0x22')]['code']===0x1f4){logger['error'](_0x73b5('0x1d'),_0x363488,_0x196e22[_0x73b5('0x22')][_0x73b5('0x23')]);return _0x3e1633(_0x196e22['error']['message']);}logger[_0x73b5('0x22')](_0x73b5('0x1d'),_0x363488,_0x196e22['error'][_0x73b5('0x23')]);return _0x2427d0(_0x196e22['error'][_0x73b5('0x23')]);}else{logger[_0x73b5('0x1c')](_0x73b5('0x1d'),_0x363488,_0x73b5('0x1e'));_0x2427d0(_0x196e22[_0x73b5('0x24')]['message']);}})[_0x73b5('0x25')](function(_0x2795fc){logger[_0x73b5('0x22')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x363488,_0x2795fc);_0x3e1633(_0x2795fc);});});}function respondWithStatusCode(_0x15ce9b,_0x2bd338){_0x2bd338=_0x2bd338||0xcc;return function(_0x378d37){if(_0x378d37){return _0x15ce9b[_0x73b5('0x26')](_0x2bd338);}return _0x15ce9b[_0x73b5('0x27')](_0x2bd338)[_0x73b5('0x28')]();};}function respondWithResult(_0x33f9ea,_0x32bb89){_0x32bb89=_0x32bb89||0xc8;return function(_0x2d3040){if(_0x2d3040){return _0x33f9ea[_0x73b5('0x27')](_0x32bb89)['json'](_0x2d3040);}};}function respondWithFilteredResult(_0x25b42a,_0x3eaa65){return function(_0x26340a){if(_0x26340a){var _0x59a69c=_0x26340a[_0x73b5('0x29')],_0x3715f2=_0x3eaa65[_0x73b5('0x2a')],_0xfc51ff=_0x3eaa65[_0x73b5('0x2a')]+_0x3eaa65[_0x73b5('0x2b')],_0x19f861;if(_0xfc51ff>=_0x59a69c){_0xfc51ff=_0x59a69c;_0x19f861=0xc8;}else{_0x19f861=0xce;}_0x25b42a[_0x73b5('0x27')](_0x19f861);return _0x25b42a['set'](_0x73b5('0x2c'),_0x3715f2+'-'+_0xfc51ff+'/'+_0x59a69c)[_0x73b5('0x2d')](_0x26340a);}return null;};}function patchUpdates(_0x8249ac){return function(_0x1f7574){try{jsonpatch[_0x73b5('0x2e')](_0x1f7574,_0x8249ac,!![]);}catch(_0x328607){return BPromise[_0x73b5('0x2f')](_0x328607);}return _0x1f7574[_0x73b5('0x30')]();};}function saveUpdates(_0x4ec788,_0x5cfb58){return function(_0x3b92fe){if(_0x3b92fe){return _0x3b92fe[_0x73b5('0x31')](_0x4ec788)[_0x73b5('0x1b')](function(_0x17e503){return _0x17e503;});}return null;};}function removeEntity(_0x344b1f,_0x21d4c9){return function(_0x8a35bb){if(_0x8a35bb){return _0x8a35bb[_0x73b5('0x32')]()['then'](function(){_0x344b1f[_0x73b5('0x27')](0xcc)[_0x73b5('0x28')]();});}};}function handleEntityNotFound(_0x191429,_0xcfcd00){return function(_0x44502a){if(!_0x44502a){_0x191429['sendStatus'](0x194);}return _0x44502a;};}function handleError(_0x45ea6c,_0x4ceaeb){_0x4ceaeb=_0x4ceaeb||0x1f4;return function(_0x419ca0){logger[_0x73b5('0x22')](_0x419ca0[_0x73b5('0x33')]);if(_0x419ca0['name']){delete _0x419ca0[_0x73b5('0x34')];}_0x45ea6c[_0x73b5('0x27')](_0x4ceaeb)[_0x73b5('0x35')](_0x419ca0);};}exports['index']=function(_0x429172,_0x22ff02){var _0x4d0aac={},_0xd998cb={},_0x190db6={'count':0x0,'rows':[]};var _0x24e5a3=_[_0x73b5('0x36')](db[_0x73b5('0x37')][_0x73b5('0x38')],function(_0xf657b7){return{'name':_0xf657b7[_0x73b5('0x39')],'type':_0xf657b7[_0x73b5('0x3a')][_0x73b5('0x3b')]};});_0xd998cb['model']=_['map'](_0x24e5a3,_0x73b5('0x34'));_0xd998cb[_0x73b5('0x3c')]=_['keys'](_0x429172[_0x73b5('0x3c')]);_0xd998cb['filters']=_[_0x73b5('0x3d')](_0xd998cb[_0x73b5('0x3e')],_0xd998cb[_0x73b5('0x3c')]);_0x4d0aac[_0x73b5('0x3f')]=_['intersection'](_0xd998cb[_0x73b5('0x3e')],qs[_0x73b5('0x40')](_0x429172[_0x73b5('0x3c')][_0x73b5('0x40')]));_0x4d0aac[_0x73b5('0x3f')]=_0x4d0aac['attributes']['length']?_0x4d0aac[_0x73b5('0x3f')]:_0xd998cb['model'];if(!_0x429172[_0x73b5('0x3c')][_0x73b5('0x41')](_0x73b5('0x42'))){_0x4d0aac[_0x73b5('0x2b')]=qs[_0x73b5('0x2b')](_0x429172[_0x73b5('0x3c')][_0x73b5('0x2b')]);_0x4d0aac[_0x73b5('0x2a')]=qs['offset'](_0x429172[_0x73b5('0x3c')]['offset']);}_0x4d0aac['order']=qs[_0x73b5('0x43')](_0x429172[_0x73b5('0x3c')][_0x73b5('0x43')]);_0x4d0aac[_0x73b5('0x44')]=qs['filters'](_[_0x73b5('0x45')](_0x429172['query'],_0xd998cb[_0x73b5('0x46')]));if(_0x429172[_0x73b5('0x3c')][_0x73b5('0x47')]){_0x4d0aac['where']=_[_0x73b5('0x48')](_0x4d0aac[_0x73b5('0x44')],{'$or':_[_0x73b5('0x36')](_0x24e5a3,function(_0x5aaf4c){if(_0x5aaf4c['type']!==_0x73b5('0x49')){var _0x1e9b5e={};_0x1e9b5e[_0x5aaf4c[_0x73b5('0x34')]]={'$like':'%'+_0x429172['query'][_0x73b5('0x47')]+'%'};return _0x1e9b5e;}})});}_0x4d0aac=_[_0x73b5('0x48')]({},_0x4d0aac,_0x429172[_0x73b5('0x4a')]);var _0x392e95={'where':_0x4d0aac[_0x73b5('0x44')]};return db[_0x73b5('0x37')]['count'](_0x392e95)[_0x73b5('0x1b')](function(_0x205527){_0x190db6['count']=_0x205527;if(_0x429172['query'][_0x73b5('0x4b')]){_0x4d0aac[_0x73b5('0x4c')]=[{'all':!![]}];}return db['FreshdeskConfiguration']['findAll'](_0x4d0aac);})[_0x73b5('0x1b')](function(_0x4a7db6){_0x190db6['rows']=_0x4a7db6;return _0x190db6;})[_0x73b5('0x1b')](respondWithFilteredResult(_0x22ff02,_0x4d0aac))['catch'](handleError(_0x22ff02,null));};exports[_0x73b5('0x4d')]=function(_0x318981,_0x1c1ac0){var _0x53c902={'raw':![],'where':{'id':_0x318981[_0x73b5('0x4e')]['id']}},_0x1f23f3={};_0x1f23f3[_0x73b5('0x3e')]=_['keys'](db['FreshdeskConfiguration'][_0x73b5('0x38')]);_0x1f23f3['query']=_[_0x73b5('0x4f')](_0x318981[_0x73b5('0x3c')]);_0x1f23f3[_0x73b5('0x46')]=_[_0x73b5('0x3d')](_0x1f23f3[_0x73b5('0x3e')],_0x1f23f3['query']);_0x53c902[_0x73b5('0x3f')]=_[_0x73b5('0x3d')](_0x1f23f3['model'],qs[_0x73b5('0x40')](_0x318981[_0x73b5('0x3c')][_0x73b5('0x40')]));_0x53c902[_0x73b5('0x3f')]=_0x53c902[_0x73b5('0x3f')][_0x73b5('0x50')]?_0x53c902[_0x73b5('0x3f')]:_0x1f23f3[_0x73b5('0x3e')];if(_0x318981[_0x73b5('0x3c')][_0x73b5('0x4b')]){_0x53c902[_0x73b5('0x4c')]=[{'all':!![]}];}_0x53c902=_[_0x73b5('0x48')]({},_0x53c902,_0x318981[_0x73b5('0x4a')]);return db['FreshdeskConfiguration'][_0x73b5('0x51')](_0x53c902)[_0x73b5('0x1b')](handleEntityNotFound(_0x1c1ac0,null))[_0x73b5('0x1b')](respondWithResult(_0x1c1ac0,null))[_0x73b5('0x25')](handleError(_0x1c1ac0,null));};exports[_0x73b5('0x52')]=function(_0x22b56d,_0x13a011){return db[_0x73b5('0x37')][_0x73b5('0x52')](_0x22b56d[_0x73b5('0x53')],{})[_0x73b5('0x1b')](respondWithResult(_0x13a011,0xc9))[_0x73b5('0x25')](handleError(_0x13a011,null));};exports[_0x73b5('0x31')]=function(_0x112407,_0x5df8e7){if(_0x112407['body']['id']){delete _0x112407['body']['id'];}return db[_0x73b5('0x37')][_0x73b5('0x51')]({'where':{'id':_0x112407['params']['id']}})[_0x73b5('0x1b')](handleEntityNotFound(_0x5df8e7,null))[_0x73b5('0x1b')](saveUpdates(_0x112407['body'],null))[_0x73b5('0x1b')](respondWithResult(_0x5df8e7,null))['catch'](handleError(_0x5df8e7,null));};exports[_0x73b5('0x32')]=function(_0x355deb,_0x48e15e){return db[_0x73b5('0x37')]['find']({'where':{'id':_0x355deb[_0x73b5('0x4e')]['id']}})[_0x73b5('0x1b')](handleEntityNotFound(_0x48e15e,null))[_0x73b5('0x1b')](removeEntity(_0x48e15e,null))['catch'](handleError(_0x48e15e,null));};exports[_0x73b5('0x54')]=function(_0x590319,_0x97f30a,_0x1a1c99){var _0x349053={};var _0x2f585={};var _0x4fc55f;var _0x176095;return db[_0x73b5('0x37')][_0x73b5('0x55')]({'where':{'id':_0x590319[_0x73b5('0x4e')]['id']}})['then'](handleEntityNotFound(_0x97f30a,null))[_0x73b5('0x1b')](function(_0x1c7082){if(_0x1c7082){_0x4fc55f=_0x1c7082;_0x2f585['model']=_[_0x73b5('0x4f')](db['FreshdeskField']['rawAttributes']);_0x2f585[_0x73b5('0x3c')]=_[_0x73b5('0x4f')](_0x590319[_0x73b5('0x3c')]);_0x2f585[_0x73b5('0x46')]=_[_0x73b5('0x3d')](_0x2f585[_0x73b5('0x3e')],_0x2f585[_0x73b5('0x3c')]);_0x349053['attributes']=_['intersection'](_0x2f585[_0x73b5('0x3e')],qs[_0x73b5('0x40')](_0x590319[_0x73b5('0x3c')]['fields']));_0x349053[_0x73b5('0x3f')]=_0x349053[_0x73b5('0x3f')][_0x73b5('0x50')]?_0x349053[_0x73b5('0x3f')]:_0x2f585[_0x73b5('0x3e')];_0x349053['order']=qs[_0x73b5('0x43')](_0x590319['query']['sort']);_0x349053[_0x73b5('0x44')]=qs[_0x73b5('0x46')](_['pick'](_0x590319[_0x73b5('0x3c')],_0x2f585[_0x73b5('0x46')]));if(_0x590319['query'][_0x73b5('0x47')]){_0x349053[_0x73b5('0x44')]=_['merge'](_0x349053['where'],{'$or':_['map'](_0x349053[_0x73b5('0x3f')],function(_0x9f55ab){var _0x5a2a1b={};_0x5a2a1b[_0x9f55ab]={'$like':'%'+_0x590319[_0x73b5('0x3c')]['filter']+'%'};return _0x5a2a1b;})});}_0x349053=_['merge']({},_0x349053,_0x590319[_0x73b5('0x4a')]);return _0x4fc55f['getFields'](_0x349053);}})[_0x73b5('0x1b')](function(_0x32633e){if(_0x32633e){_0x176095=_0x32633e[_0x73b5('0x50')];if(!_0x590319['query']['hasOwnProperty']('nolimit')){_0x349053[_0x73b5('0x2b')]=qs[_0x73b5('0x2b')](_0x590319[_0x73b5('0x3c')][_0x73b5('0x2b')]);_0x349053[_0x73b5('0x2a')]=qs[_0x73b5('0x2a')](_0x590319[_0x73b5('0x3c')]['offset']);}return _0x4fc55f['getFields'](_0x349053);}})['then'](function(_0x4438fd){if(_0x4438fd){return _0x4438fd?{'count':_0x176095,'rows':_0x4438fd}:null;}})[_0x73b5('0x1b')](respondWithResult(_0x97f30a,null))[_0x73b5('0x25')](handleError(_0x97f30a,null));};exports['getSubjects']=function(_0x4916ae,_0x173266,_0x280414){var _0x20d132={};var _0x1a2432={};var _0x4ae13d;var _0x3510dc;return db[_0x73b5('0x37')][_0x73b5('0x55')]({'where':{'id':_0x4916ae[_0x73b5('0x4e')]['id']}})[_0x73b5('0x1b')](handleEntityNotFound(_0x173266,null))[_0x73b5('0x1b')](function(_0x1c2bae){if(_0x1c2bae){_0x4ae13d=_0x1c2bae;_0x1a2432[_0x73b5('0x3e')]=_[_0x73b5('0x4f')](db[_0x73b5('0x56')][_0x73b5('0x38')]);_0x1a2432['query']=_[_0x73b5('0x4f')](_0x4916ae[_0x73b5('0x3c')]);_0x1a2432[_0x73b5('0x46')]=_[_0x73b5('0x3d')](_0x1a2432[_0x73b5('0x3e')],_0x1a2432[_0x73b5('0x3c')]);_0x20d132[_0x73b5('0x3f')]=_[_0x73b5('0x3d')](_0x1a2432['model'],qs['fields'](_0x4916ae['query'][_0x73b5('0x40')]));_0x20d132['attributes']=_0x20d132[_0x73b5('0x3f')][_0x73b5('0x50')]?_0x20d132[_0x73b5('0x3f')]:_0x1a2432[_0x73b5('0x3e')];_0x20d132[_0x73b5('0x57')]=qs[_0x73b5('0x43')](_0x4916ae[_0x73b5('0x3c')]['sort']);_0x20d132[_0x73b5('0x44')]=qs[_0x73b5('0x46')](_[_0x73b5('0x45')](_0x4916ae[_0x73b5('0x3c')],_0x1a2432[_0x73b5('0x46')]));if(_0x4916ae[_0x73b5('0x3c')]['filter']){_0x20d132['where']=_[_0x73b5('0x48')](_0x20d132[_0x73b5('0x44')],{'$or':_[_0x73b5('0x36')](_0x20d132['attributes'],function(_0x36d206){var _0x174f1d={};_0x174f1d[_0x36d206]={'$like':'%'+_0x4916ae['query']['filter']+'%'};return _0x174f1d;})});}_0x20d132=_[_0x73b5('0x48')]({},_0x20d132,_0x4916ae[_0x73b5('0x4a')]);return _0x4ae13d['getSubjects'](_0x20d132);}})[_0x73b5('0x1b')](function(_0x40f735){if(_0x40f735){_0x3510dc=_0x40f735['length'];if(!_0x4916ae[_0x73b5('0x3c')][_0x73b5('0x41')](_0x73b5('0x42'))){_0x20d132['limit']=qs['limit'](_0x4916ae[_0x73b5('0x3c')]['limit']);_0x20d132[_0x73b5('0x2a')]=qs[_0x73b5('0x2a')](_0x4916ae[_0x73b5('0x3c')][_0x73b5('0x2a')]);}return _0x4ae13d['getSubjects'](_0x20d132);}})[_0x73b5('0x1b')](function(_0x1bc148){if(_0x1bc148){return _0x1bc148?{'count':_0x3510dc,'rows':_0x1bc148}:null;}})[_0x73b5('0x1b')](respondWithResult(_0x173266,null))[_0x73b5('0x25')](handleError(_0x173266,null));};exports[_0x73b5('0x58')]=function(_0x3b62c2,_0x4b81df,_0x98203e){var _0x5b3a8c={};var _0x5ee48e={};var _0x1df354;var _0x14d6ac;return db[_0x73b5('0x37')]['findOne']({'where':{'id':_0x3b62c2[_0x73b5('0x4e')]['id']}})[_0x73b5('0x1b')](handleEntityNotFound(_0x4b81df,null))['then'](function(_0x22d1ff){if(_0x22d1ff){_0x1df354=_0x22d1ff;_0x5ee48e['model']=_[_0x73b5('0x4f')](db[_0x73b5('0x56')][_0x73b5('0x38')]);_0x5ee48e['query']=_[_0x73b5('0x4f')](_0x3b62c2[_0x73b5('0x3c')]);_0x5ee48e[_0x73b5('0x46')]=_[_0x73b5('0x3d')](_0x5ee48e[_0x73b5('0x3e')],_0x5ee48e['query']);_0x5b3a8c['attributes']=_[_0x73b5('0x3d')](_0x5ee48e[_0x73b5('0x3e')],qs[_0x73b5('0x40')](_0x3b62c2[_0x73b5('0x3c')][_0x73b5('0x40')]));_0x5b3a8c['attributes']=_0x5b3a8c['attributes'][_0x73b5('0x50')]?_0x5b3a8c[_0x73b5('0x3f')]:_0x5ee48e[_0x73b5('0x3e')];_0x5b3a8c['order']=qs[_0x73b5('0x43')](_0x3b62c2['query'][_0x73b5('0x43')]);_0x5b3a8c[_0x73b5('0x44')]=qs[_0x73b5('0x46')](_[_0x73b5('0x45')](_0x3b62c2[_0x73b5('0x3c')],_0x5ee48e[_0x73b5('0x46')]));if(_0x3b62c2['query'][_0x73b5('0x47')]){_0x5b3a8c[_0x73b5('0x44')]=_['merge'](_0x5b3a8c['where'],{'$or':_[_0x73b5('0x36')](_0x5b3a8c[_0x73b5('0x3f')],function(_0x151ef3){var _0x28f6fe={};_0x28f6fe[_0x151ef3]={'$like':'%'+_0x3b62c2['query'][_0x73b5('0x47')]+'%'};return _0x28f6fe;})});}_0x5b3a8c=_[_0x73b5('0x48')]({},_0x5b3a8c,_0x3b62c2[_0x73b5('0x4a')]);return _0x1df354[_0x73b5('0x58')](_0x5b3a8c);}})[_0x73b5('0x1b')](function(_0x30de47){if(_0x30de47){_0x14d6ac=_0x30de47[_0x73b5('0x50')];if(!_0x3b62c2[_0x73b5('0x3c')][_0x73b5('0x41')](_0x73b5('0x42'))){_0x5b3a8c[_0x73b5('0x2b')]=qs[_0x73b5('0x2b')](_0x3b62c2['query'][_0x73b5('0x2b')]);_0x5b3a8c[_0x73b5('0x2a')]=qs[_0x73b5('0x2a')](_0x3b62c2[_0x73b5('0x3c')][_0x73b5('0x2a')]);}return _0x1df354[_0x73b5('0x58')](_0x5b3a8c);}})[_0x73b5('0x1b')](function(_0x21783b){if(_0x21783b){return _0x21783b?{'count':_0x14d6ac,'rows':_0x21783b}:null;}})[_0x73b5('0x1b')](respondWithResult(_0x4b81df,null))[_0x73b5('0x25')](handleError(_0x4b81df,null));};exports[_0x73b5('0x59')]=function(_0x30d2a9,_0x156d3a,_0xf32624){var _0x3ca8ac={};var _0x424c39={};var _0x1fe3df;var _0x2ae813;return db[_0x73b5('0x37')][_0x73b5('0x55')]({'where':{'id':_0x30d2a9[_0x73b5('0x4e')]['id']}})[_0x73b5('0x1b')](handleEntityNotFound(_0x156d3a,null))[_0x73b5('0x1b')](function(_0x38ecb3){if(_0x38ecb3){_0x1fe3df=_0x38ecb3;_0x424c39['model']=_[_0x73b5('0x4f')](db['Tag'][_0x73b5('0x38')]);_0x424c39[_0x73b5('0x3c')]=_[_0x73b5('0x4f')](_0x30d2a9[_0x73b5('0x3c')]);_0x424c39['filters']=_[_0x73b5('0x3d')](_0x424c39['model'],_0x424c39[_0x73b5('0x3c')]);_0x3ca8ac[_0x73b5('0x3f')]=_[_0x73b5('0x3d')](_0x424c39['model'],qs['fields'](_0x30d2a9[_0x73b5('0x3c')][_0x73b5('0x40')]));_0x3ca8ac[_0x73b5('0x3f')]=_0x3ca8ac[_0x73b5('0x3f')]['length']?_0x3ca8ac[_0x73b5('0x3f')]:_0x424c39['model'];_0x3ca8ac[_0x73b5('0x57')]=qs[_0x73b5('0x43')](_0x30d2a9['query'][_0x73b5('0x43')]);_0x3ca8ac[_0x73b5('0x44')]=qs[_0x73b5('0x46')](_['pick'](_0x30d2a9['query'],_0x424c39[_0x73b5('0x46')]));if(_0x30d2a9[_0x73b5('0x3c')][_0x73b5('0x47')]){_0x3ca8ac[_0x73b5('0x44')]=_['merge'](_0x3ca8ac[_0x73b5('0x44')],{'$or':_[_0x73b5('0x36')](_0x3ca8ac[_0x73b5('0x3f')],function(_0x25a0be){var _0x534bcd={};_0x534bcd[_0x25a0be]={'$like':'%'+_0x30d2a9['query'][_0x73b5('0x47')]+'%'};return _0x534bcd;})});}_0x3ca8ac=_['merge']({},_0x3ca8ac,_0x30d2a9[_0x73b5('0x4a')]);return _0x1fe3df[_0x73b5('0x59')](_0x3ca8ac);}})[_0x73b5('0x1b')](function(_0x30358f){if(_0x30358f){_0x2ae813=_0x30358f[_0x73b5('0x50')];if(!_0x30d2a9[_0x73b5('0x3c')][_0x73b5('0x41')](_0x73b5('0x42'))){_0x3ca8ac[_0x73b5('0x2b')]=qs[_0x73b5('0x2b')](_0x30d2a9[_0x73b5('0x3c')]['limit']);_0x3ca8ac['offset']=qs[_0x73b5('0x2a')](_0x30d2a9[_0x73b5('0x3c')][_0x73b5('0x2a')]);}return _0x1fe3df[_0x73b5('0x59')](_0x3ca8ac);}})[_0x73b5('0x1b')](function(_0xcf5473){if(_0xcf5473){return _0xcf5473?{'count':_0x2ae813,'rows':_0xcf5473}:null;}})[_0x73b5('0x1b')](respondWithResult(_0x156d3a,null))['catch'](handleError(_0x156d3a,null));};exports[_0x73b5('0x5a')]=function(_0x424c3f,_0x37f301,_0x25f721){if(_0x424c3f[_0x73b5('0x53')]['id']){delete _0x424c3f[_0x73b5('0x53')]['id'];}return db[_0x73b5('0x37')]['findOne']({'where':{'id':_0x424c3f[_0x73b5('0x4e')]['id']}})[_0x73b5('0x1b')](handleEntityNotFound(_0x37f301,null))['then'](function(_0xfdf61e){if(_0xfdf61e){return _0xfdf61e[_0x73b5('0x5a')](_0x424c3f[_0x73b5('0x53')][_0x73b5('0x5b')]||[]);}return null;})[_0x73b5('0x1b')](respondWithResult(_0x37f301,null))[_0x73b5('0x25')](handleError(_0x37f301,null));}; \ No newline at end of file +var _0xafba=['sendStatus','end','json','limit','status','set','Content-Range','apply','reject','destroy','stack','name','send','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','fields','attributes','hasOwnProperty','offset','order','sort','where','pick','filter','merge','map','VIRTUAL','options','FreshdeskConfiguration','count','include','findAll','rows','catch','show','params','length','create','update','body','find','findOne','FreshdeskField','getFields','getSubjects','getDescriptions','nolimit','getTags','Tag','setTags','ids','html-pdf','eml-format','rimraf','zip-dir','moment','util','path','to-csv','jsforce','desk.js','querystring','papaparse','../../config/logger','api','../../config/environment','jayson/promise','client','ValidationError','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result'];(function(_0x4f4e4b,_0x46ea73){var _0x23a628=function(_0x56791){while(--_0x56791){_0x4f4e4b['push'](_0x4f4e4b['shift']());}};_0x23a628(++_0x46ea73);}(_0xafba,0x91));var _0xaafb=function(_0x5e10b4,_0x22590b){_0x5e10b4=_0x5e10b4-0x0;var _0x2c00d3=_0xafba[_0x5e10b4];return _0x2c00d3;};'use strict';var pdf=require(_0xaafb('0x0'));var emlformat=require(_0xaafb('0x1'));var rimraf=require(_0xaafb('0x2'));var zipdir=require(_0xaafb('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xaafb('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xaafb('0x5'));var path=require(_0xaafb('0x6'));var sox=require('sox');var csv=require(_0xaafb('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xaafb('0x8'));var deskjs=require(_0xaafb('0x9'));var toCsv=require('to-csv');var querystring=require(_0xaafb('0xa'));var Papa=require(_0xaafb('0xb'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xaafb('0xc'))(_0xaafb('0xd'));var utils=require('../../config/utils');var config=require(_0xaafb('0xe'));var db=require('../../mysqldb')['db'];var jayson=require(_0xaafb('0xf'));var client=jayson[_0xaafb('0x10')]['http']({'port':0x232a});function checkPasswordPattern(_0x18fc19,_0x20db1d,_0x4df379){if(_0x4df379){var _0xa361f4=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xa361f4['test'](_0x20db1d)){return _0x18fc19;}else{throw new db['Sequelize'][(_0xaafb('0x11'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x18fc19;}}function respondWithRpcPromise(_0x2bab23,_0x5406bb,_0x3b85ef,_0x5353d7){return new BPromise(function(_0xc13d08,_0x881bf7){var _0xe261f9=_0x5353d7||client;return _0xe261f9[_0xaafb('0x12')](_0x2bab23,_0x3b85ef)[_0xaafb('0x13')](function(_0x45be2a){logger[_0xaafb('0x14')](_0xaafb('0x15'),_0x5406bb,_0xaafb('0x16'));logger[_0xaafb('0x17')](_0xaafb('0x18'),_0x5406bb,_0xaafb('0x16'),JSON[_0xaafb('0x19')](_0x45be2a));if(_0x45be2a[_0xaafb('0x1a')]){if(_0x45be2a['error']['code']===0x1f4){logger[_0xaafb('0x1a')](_0xaafb('0x15'),_0x5406bb,_0x45be2a[_0xaafb('0x1a')][_0xaafb('0x1b')]);return _0x881bf7(_0x45be2a['error'][_0xaafb('0x1b')]);}logger['error']('FreshdeskConfiguration,\x20%s,\x20%s',_0x5406bb,_0x45be2a['error'][_0xaafb('0x1b')]);return _0xc13d08(_0x45be2a[_0xaafb('0x1a')][_0xaafb('0x1b')]);}else{logger[_0xaafb('0x14')](_0xaafb('0x15'),_0x5406bb,_0xaafb('0x16'));_0xc13d08(_0x45be2a[_0xaafb('0x1c')][_0xaafb('0x1b')]);}})['catch'](function(_0x17d226){logger[_0xaafb('0x1a')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x5406bb,_0x17d226);_0x881bf7(_0x17d226);});});}function respondWithStatusCode(_0xacddfe,_0x5b3a90){_0x5b3a90=_0x5b3a90||0xcc;return function(_0x22befb){if(_0x22befb){return _0xacddfe[_0xaafb('0x1d')](_0x5b3a90);}return _0xacddfe['status'](_0x5b3a90)[_0xaafb('0x1e')]();};}function respondWithResult(_0x30d719,_0x45bf6c){_0x45bf6c=_0x45bf6c||0xc8;return function(_0x1ed6e6){if(_0x1ed6e6){return _0x30d719['status'](_0x45bf6c)[_0xaafb('0x1f')](_0x1ed6e6);}};}function respondWithFilteredResult(_0x23e1b0,_0x1f496){return function(_0x2f01ee){if(_0x2f01ee){var _0xd989f1=_0x2f01ee['count'],_0x362963=_0x1f496['offset'],_0x254933=_0x1f496['offset']+_0x1f496[_0xaafb('0x20')],_0x327a9e;if(_0x254933>=_0xd989f1){_0x254933=_0xd989f1;_0x327a9e=0xc8;}else{_0x327a9e=0xce;}_0x23e1b0[_0xaafb('0x21')](_0x327a9e);return _0x23e1b0[_0xaafb('0x22')](_0xaafb('0x23'),_0x362963+'-'+_0x254933+'/'+_0xd989f1)[_0xaafb('0x1f')](_0x2f01ee);}return null;};}function patchUpdates(_0x946294){return function(_0x456043){try{jsonpatch[_0xaafb('0x24')](_0x456043,_0x946294,!![]);}catch(_0x53f85c){return BPromise[_0xaafb('0x25')](_0x53f85c);}return _0x456043['save']();};}function saveUpdates(_0x30b6b1,_0x4a039a){return function(_0x212c9a){if(_0x212c9a){return _0x212c9a['update'](_0x30b6b1)[_0xaafb('0x13')](function(_0x3d6583){return _0x3d6583;});}return null;};}function removeEntity(_0x1347c8,_0x2aa5ac){return function(_0x21c923){if(_0x21c923){return _0x21c923[_0xaafb('0x26')]()[_0xaafb('0x13')](function(){_0x1347c8[_0xaafb('0x21')](0xcc)[_0xaafb('0x1e')]();});}};}function handleEntityNotFound(_0x211e90,_0x3e44c4){return function(_0x174aab){if(!_0x174aab){_0x211e90[_0xaafb('0x1d')](0x194);}return _0x174aab;};}function handleError(_0x5e5c71,_0x9edf61){_0x9edf61=_0x9edf61||0x1f4;return function(_0x23c634){logger[_0xaafb('0x1a')](_0x23c634[_0xaafb('0x27')]);if(_0x23c634[_0xaafb('0x28')]){delete _0x23c634[_0xaafb('0x28')];}_0x5e5c71[_0xaafb('0x21')](_0x9edf61)[_0xaafb('0x29')](_0x23c634);};}exports['index']=function(_0xaaa085,_0x4e49ce){var _0x2a99c9={},_0x351e39={},_0x3f0320={'count':0x0,'rows':[]};var _0x2599d2=_['map'](db['FreshdeskConfiguration'][_0xaafb('0x2a')],function(_0x1ebef1){return{'name':_0x1ebef1[_0xaafb('0x2b')],'type':_0x1ebef1[_0xaafb('0x2c')][_0xaafb('0x2d')]};});_0x351e39[_0xaafb('0x2e')]=_['map'](_0x2599d2,'name');_0x351e39['query']=_[_0xaafb('0x2f')](_0xaaa085['query']);_0x351e39[_0xaafb('0x30')]=_[_0xaafb('0x31')](_0x351e39[_0xaafb('0x2e')],_0x351e39[_0xaafb('0x32')]);_0x2a99c9['attributes']=_[_0xaafb('0x31')](_0x351e39[_0xaafb('0x2e')],qs[_0xaafb('0x33')](_0xaaa085[_0xaafb('0x32')][_0xaafb('0x33')]));_0x2a99c9['attributes']=_0x2a99c9['attributes']['length']?_0x2a99c9[_0xaafb('0x34')]:_0x351e39[_0xaafb('0x2e')];if(!_0xaaa085[_0xaafb('0x32')][_0xaafb('0x35')]('nolimit')){_0x2a99c9[_0xaafb('0x20')]=qs[_0xaafb('0x20')](_0xaaa085[_0xaafb('0x32')][_0xaafb('0x20')]);_0x2a99c9[_0xaafb('0x36')]=qs[_0xaafb('0x36')](_0xaaa085[_0xaafb('0x32')]['offset']);}_0x2a99c9[_0xaafb('0x37')]=qs[_0xaafb('0x38')](_0xaaa085[_0xaafb('0x32')][_0xaafb('0x38')]);_0x2a99c9[_0xaafb('0x39')]=qs[_0xaafb('0x30')](_[_0xaafb('0x3a')](_0xaaa085['query'],_0x351e39[_0xaafb('0x30')]));if(_0xaaa085[_0xaafb('0x32')][_0xaafb('0x3b')]){_0x2a99c9[_0xaafb('0x39')]=_[_0xaafb('0x3c')](_0x2a99c9[_0xaafb('0x39')],{'$or':_[_0xaafb('0x3d')](_0x2599d2,function(_0x1567e6){if(_0x1567e6[_0xaafb('0x2c')]!==_0xaafb('0x3e')){var _0x3e3bb3={};_0x3e3bb3[_0x1567e6[_0xaafb('0x28')]]={'$like':'%'+_0xaaa085[_0xaafb('0x32')][_0xaafb('0x3b')]+'%'};return _0x3e3bb3;}})});}_0x2a99c9=_[_0xaafb('0x3c')]({},_0x2a99c9,_0xaaa085[_0xaafb('0x3f')]);var _0x143e8a={'where':_0x2a99c9[_0xaafb('0x39')]};return db[_0xaafb('0x40')][_0xaafb('0x41')](_0x143e8a)[_0xaafb('0x13')](function(_0x5b48d1){_0x3f0320['count']=_0x5b48d1;if(_0xaaa085[_0xaafb('0x32')]['includeAll']){_0x2a99c9[_0xaafb('0x42')]=[{'all':!![]}];}return db[_0xaafb('0x40')][_0xaafb('0x43')](_0x2a99c9);})['then'](function(_0x3ce400){_0x3f0320[_0xaafb('0x44')]=_0x3ce400;return _0x3f0320;})[_0xaafb('0x13')](respondWithFilteredResult(_0x4e49ce,_0x2a99c9))[_0xaafb('0x45')](handleError(_0x4e49ce,null));};exports[_0xaafb('0x46')]=function(_0x7a6a72,_0xdd9914){var _0x8ef699={'raw':![],'where':{'id':_0x7a6a72[_0xaafb('0x47')]['id']}},_0x3ed2a7={};_0x3ed2a7[_0xaafb('0x2e')]=_[_0xaafb('0x2f')](db['FreshdeskConfiguration']['rawAttributes']);_0x3ed2a7[_0xaafb('0x32')]=_[_0xaafb('0x2f')](_0x7a6a72['query']);_0x3ed2a7[_0xaafb('0x30')]=_['intersection'](_0x3ed2a7['model'],_0x3ed2a7[_0xaafb('0x32')]);_0x8ef699[_0xaafb('0x34')]=_[_0xaafb('0x31')](_0x3ed2a7[_0xaafb('0x2e')],qs['fields'](_0x7a6a72[_0xaafb('0x32')][_0xaafb('0x33')]));_0x8ef699['attributes']=_0x8ef699['attributes'][_0xaafb('0x48')]?_0x8ef699[_0xaafb('0x34')]:_0x3ed2a7[_0xaafb('0x2e')];if(_0x7a6a72['query']['includeAll']){_0x8ef699['include']=[{'all':!![]}];}_0x8ef699=_[_0xaafb('0x3c')]({},_0x8ef699,_0x7a6a72[_0xaafb('0x3f')]);return db[_0xaafb('0x40')]['find'](_0x8ef699)[_0xaafb('0x13')](handleEntityNotFound(_0xdd9914,null))[_0xaafb('0x13')](respondWithResult(_0xdd9914,null))[_0xaafb('0x45')](handleError(_0xdd9914,null));};exports[_0xaafb('0x49')]=function(_0x57d404,_0x39c59d){return db[_0xaafb('0x40')][_0xaafb('0x49')](_0x57d404['body'],{})['then'](respondWithResult(_0x39c59d,0xc9))[_0xaafb('0x45')](handleError(_0x39c59d,null));};exports[_0xaafb('0x4a')]=function(_0xe8055f,_0x26c569){if(_0xe8055f[_0xaafb('0x4b')]['id']){delete _0xe8055f[_0xaafb('0x4b')]['id'];}return db['FreshdeskConfiguration'][_0xaafb('0x4c')]({'where':{'id':_0xe8055f[_0xaafb('0x47')]['id']}})[_0xaafb('0x13')](handleEntityNotFound(_0x26c569,null))[_0xaafb('0x13')](saveUpdates(_0xe8055f['body'],null))['then'](respondWithResult(_0x26c569,null))[_0xaafb('0x45')](handleError(_0x26c569,null));};exports[_0xaafb('0x26')]=function(_0x16faee,_0x4ea83a){return db['FreshdeskConfiguration'][_0xaafb('0x4c')]({'where':{'id':_0x16faee[_0xaafb('0x47')]['id']}})['then'](handleEntityNotFound(_0x4ea83a,null))[_0xaafb('0x13')](removeEntity(_0x4ea83a,null))[_0xaafb('0x45')](handleError(_0x4ea83a,null));};exports['getFields']=function(_0x31a6b2,_0x1a0aa8,_0x41010d){var _0x334f53={};var _0x169ca2={};var _0x114d08;var _0x3eb226;return db[_0xaafb('0x40')][_0xaafb('0x4d')]({'where':{'id':_0x31a6b2[_0xaafb('0x47')]['id']}})[_0xaafb('0x13')](handleEntityNotFound(_0x1a0aa8,null))[_0xaafb('0x13')](function(_0x33831c){if(_0x33831c){_0x114d08=_0x33831c;_0x169ca2['model']=_[_0xaafb('0x2f')](db[_0xaafb('0x4e')][_0xaafb('0x2a')]);_0x169ca2[_0xaafb('0x32')]=_[_0xaafb('0x2f')](_0x31a6b2[_0xaafb('0x32')]);_0x169ca2[_0xaafb('0x30')]=_['intersection'](_0x169ca2[_0xaafb('0x2e')],_0x169ca2[_0xaafb('0x32')]);_0x334f53[_0xaafb('0x34')]=_[_0xaafb('0x31')](_0x169ca2[_0xaafb('0x2e')],qs['fields'](_0x31a6b2[_0xaafb('0x32')][_0xaafb('0x33')]));_0x334f53[_0xaafb('0x34')]=_0x334f53[_0xaafb('0x34')]['length']?_0x334f53[_0xaafb('0x34')]:_0x169ca2['model'];_0x334f53['order']=qs[_0xaafb('0x38')](_0x31a6b2['query'][_0xaafb('0x38')]);_0x334f53['where']=qs[_0xaafb('0x30')](_['pick'](_0x31a6b2[_0xaafb('0x32')],_0x169ca2['filters']));if(_0x31a6b2[_0xaafb('0x32')][_0xaafb('0x3b')]){_0x334f53[_0xaafb('0x39')]=_[_0xaafb('0x3c')](_0x334f53['where'],{'$or':_[_0xaafb('0x3d')](_0x334f53[_0xaafb('0x34')],function(_0x59a3ee){var _0x571e4e={};_0x571e4e[_0x59a3ee]={'$like':'%'+_0x31a6b2['query']['filter']+'%'};return _0x571e4e;})});}_0x334f53=_['merge']({},_0x334f53,_0x31a6b2['options']);return _0x114d08['getFields'](_0x334f53);}})[_0xaafb('0x13')](function(_0x68a996){if(_0x68a996){_0x3eb226=_0x68a996[_0xaafb('0x48')];if(!_0x31a6b2[_0xaafb('0x32')][_0xaafb('0x35')]('nolimit')){_0x334f53[_0xaafb('0x20')]=qs['limit'](_0x31a6b2[_0xaafb('0x32')]['limit']);_0x334f53[_0xaafb('0x36')]=qs[_0xaafb('0x36')](_0x31a6b2[_0xaafb('0x32')]['offset']);}return _0x114d08[_0xaafb('0x4f')](_0x334f53);}})['then'](function(_0x3055f7){if(_0x3055f7){return _0x3055f7?{'count':_0x3eb226,'rows':_0x3055f7}:null;}})['then'](respondWithResult(_0x1a0aa8,null))['catch'](handleError(_0x1a0aa8,null));};exports[_0xaafb('0x50')]=function(_0x3eaca7,_0x161c83,_0x44e70a){var _0x2cdfcd={};var _0x412246={};var _0x45730c;var _0x1af9d8;return db[_0xaafb('0x40')]['findOne']({'where':{'id':_0x3eaca7['params']['id']}})[_0xaafb('0x13')](handleEntityNotFound(_0x161c83,null))[_0xaafb('0x13')](function(_0x54e19c){if(_0x54e19c){_0x45730c=_0x54e19c;_0x412246[_0xaafb('0x2e')]=_[_0xaafb('0x2f')](db[_0xaafb('0x4e')][_0xaafb('0x2a')]);_0x412246[_0xaafb('0x32')]=_[_0xaafb('0x2f')](_0x3eaca7[_0xaafb('0x32')]);_0x412246[_0xaafb('0x30')]=_[_0xaafb('0x31')](_0x412246[_0xaafb('0x2e')],_0x412246[_0xaafb('0x32')]);_0x2cdfcd[_0xaafb('0x34')]=_[_0xaafb('0x31')](_0x412246[_0xaafb('0x2e')],qs[_0xaafb('0x33')](_0x3eaca7[_0xaafb('0x32')][_0xaafb('0x33')]));_0x2cdfcd[_0xaafb('0x34')]=_0x2cdfcd[_0xaafb('0x34')][_0xaafb('0x48')]?_0x2cdfcd[_0xaafb('0x34')]:_0x412246[_0xaafb('0x2e')];_0x2cdfcd[_0xaafb('0x37')]=qs[_0xaafb('0x38')](_0x3eaca7[_0xaafb('0x32')][_0xaafb('0x38')]);_0x2cdfcd[_0xaafb('0x39')]=qs[_0xaafb('0x30')](_[_0xaafb('0x3a')](_0x3eaca7[_0xaafb('0x32')],_0x412246[_0xaafb('0x30')]));if(_0x3eaca7[_0xaafb('0x32')][_0xaafb('0x3b')]){_0x2cdfcd['where']=_[_0xaafb('0x3c')](_0x2cdfcd[_0xaafb('0x39')],{'$or':_[_0xaafb('0x3d')](_0x2cdfcd[_0xaafb('0x34')],function(_0x534ac7){var _0x17133e={};_0x17133e[_0x534ac7]={'$like':'%'+_0x3eaca7[_0xaafb('0x32')]['filter']+'%'};return _0x17133e;})});}_0x2cdfcd=_[_0xaafb('0x3c')]({},_0x2cdfcd,_0x3eaca7['options']);return _0x45730c['getSubjects'](_0x2cdfcd);}})[_0xaafb('0x13')](function(_0x33e83a){if(_0x33e83a){_0x1af9d8=_0x33e83a[_0xaafb('0x48')];if(!_0x3eaca7[_0xaafb('0x32')]['hasOwnProperty']('nolimit')){_0x2cdfcd['limit']=qs[_0xaafb('0x20')](_0x3eaca7[_0xaafb('0x32')][_0xaafb('0x20')]);_0x2cdfcd[_0xaafb('0x36')]=qs[_0xaafb('0x36')](_0x3eaca7['query'][_0xaafb('0x36')]);}return _0x45730c[_0xaafb('0x50')](_0x2cdfcd);}})[_0xaafb('0x13')](function(_0xfec770){if(_0xfec770){return _0xfec770?{'count':_0x1af9d8,'rows':_0xfec770}:null;}})[_0xaafb('0x13')](respondWithResult(_0x161c83,null))[_0xaafb('0x45')](handleError(_0x161c83,null));};exports[_0xaafb('0x51')]=function(_0x1b61b2,_0x377f00,_0x52182e){var _0x17f4be={};var _0x4d9698={};var _0x2bb1e0;var _0x3889cc;return db[_0xaafb('0x40')][_0xaafb('0x4d')]({'where':{'id':_0x1b61b2[_0xaafb('0x47')]['id']}})[_0xaafb('0x13')](handleEntityNotFound(_0x377f00,null))[_0xaafb('0x13')](function(_0x5cec99){if(_0x5cec99){_0x2bb1e0=_0x5cec99;_0x4d9698[_0xaafb('0x2e')]=_['keys'](db[_0xaafb('0x4e')]['rawAttributes']);_0x4d9698[_0xaafb('0x32')]=_[_0xaafb('0x2f')](_0x1b61b2[_0xaafb('0x32')]);_0x4d9698[_0xaafb('0x30')]=_['intersection'](_0x4d9698['model'],_0x4d9698[_0xaafb('0x32')]);_0x17f4be[_0xaafb('0x34')]=_[_0xaafb('0x31')](_0x4d9698[_0xaafb('0x2e')],qs['fields'](_0x1b61b2[_0xaafb('0x32')][_0xaafb('0x33')]));_0x17f4be[_0xaafb('0x34')]=_0x17f4be['attributes'][_0xaafb('0x48')]?_0x17f4be['attributes']:_0x4d9698['model'];_0x17f4be[_0xaafb('0x37')]=qs[_0xaafb('0x38')](_0x1b61b2[_0xaafb('0x32')][_0xaafb('0x38')]);_0x17f4be[_0xaafb('0x39')]=qs[_0xaafb('0x30')](_[_0xaafb('0x3a')](_0x1b61b2[_0xaafb('0x32')],_0x4d9698[_0xaafb('0x30')]));if(_0x1b61b2[_0xaafb('0x32')][_0xaafb('0x3b')]){_0x17f4be['where']=_[_0xaafb('0x3c')](_0x17f4be['where'],{'$or':_[_0xaafb('0x3d')](_0x17f4be['attributes'],function(_0x116dcb){var _0x214f71={};_0x214f71[_0x116dcb]={'$like':'%'+_0x1b61b2['query'][_0xaafb('0x3b')]+'%'};return _0x214f71;})});}_0x17f4be=_[_0xaafb('0x3c')]({},_0x17f4be,_0x1b61b2[_0xaafb('0x3f')]);return _0x2bb1e0['getDescriptions'](_0x17f4be);}})[_0xaafb('0x13')](function(_0x28aef1){if(_0x28aef1){_0x3889cc=_0x28aef1[_0xaafb('0x48')];if(!_0x1b61b2['query'][_0xaafb('0x35')](_0xaafb('0x52'))){_0x17f4be[_0xaafb('0x20')]=qs['limit'](_0x1b61b2['query'][_0xaafb('0x20')]);_0x17f4be['offset']=qs[_0xaafb('0x36')](_0x1b61b2[_0xaafb('0x32')][_0xaafb('0x36')]);}return _0x2bb1e0[_0xaafb('0x51')](_0x17f4be);}})[_0xaafb('0x13')](function(_0x4fa69f){if(_0x4fa69f){return _0x4fa69f?{'count':_0x3889cc,'rows':_0x4fa69f}:null;}})[_0xaafb('0x13')](respondWithResult(_0x377f00,null))[_0xaafb('0x45')](handleError(_0x377f00,null));};exports[_0xaafb('0x53')]=function(_0xdfe8ff,_0x54b761,_0x5289ce){var _0x46971e={};var _0x32003f={};var _0xb003a3;var _0x204550;return db[_0xaafb('0x40')][_0xaafb('0x4d')]({'where':{'id':_0xdfe8ff[_0xaafb('0x47')]['id']}})[_0xaafb('0x13')](handleEntityNotFound(_0x54b761,null))[_0xaafb('0x13')](function(_0x5b5900){if(_0x5b5900){_0xb003a3=_0x5b5900;_0x32003f[_0xaafb('0x2e')]=_['keys'](db[_0xaafb('0x54')][_0xaafb('0x2a')]);_0x32003f['query']=_['keys'](_0xdfe8ff['query']);_0x32003f[_0xaafb('0x30')]=_['intersection'](_0x32003f[_0xaafb('0x2e')],_0x32003f[_0xaafb('0x32')]);_0x46971e[_0xaafb('0x34')]=_['intersection'](_0x32003f[_0xaafb('0x2e')],qs[_0xaafb('0x33')](_0xdfe8ff[_0xaafb('0x32')][_0xaafb('0x33')]));_0x46971e[_0xaafb('0x34')]=_0x46971e['attributes'][_0xaafb('0x48')]?_0x46971e[_0xaafb('0x34')]:_0x32003f['model'];_0x46971e[_0xaafb('0x37')]=qs[_0xaafb('0x38')](_0xdfe8ff[_0xaafb('0x32')]['sort']);_0x46971e[_0xaafb('0x39')]=qs[_0xaafb('0x30')](_['pick'](_0xdfe8ff[_0xaafb('0x32')],_0x32003f[_0xaafb('0x30')]));if(_0xdfe8ff['query'][_0xaafb('0x3b')]){_0x46971e[_0xaafb('0x39')]=_[_0xaafb('0x3c')](_0x46971e[_0xaafb('0x39')],{'$or':_[_0xaafb('0x3d')](_0x46971e[_0xaafb('0x34')],function(_0x25ec95){var _0x5be265={};_0x5be265[_0x25ec95]={'$like':'%'+_0xdfe8ff[_0xaafb('0x32')]['filter']+'%'};return _0x5be265;})});}_0x46971e=_[_0xaafb('0x3c')]({},_0x46971e,_0xdfe8ff[_0xaafb('0x3f')]);return _0xb003a3[_0xaafb('0x53')](_0x46971e);}})[_0xaafb('0x13')](function(_0x312721){if(_0x312721){_0x204550=_0x312721['length'];if(!_0xdfe8ff[_0xaafb('0x32')]['hasOwnProperty'](_0xaafb('0x52'))){_0x46971e[_0xaafb('0x20')]=qs[_0xaafb('0x20')](_0xdfe8ff[_0xaafb('0x32')]['limit']);_0x46971e[_0xaafb('0x36')]=qs[_0xaafb('0x36')](_0xdfe8ff[_0xaafb('0x32')][_0xaafb('0x36')]);}return _0xb003a3[_0xaafb('0x53')](_0x46971e);}})[_0xaafb('0x13')](function(_0x138a58){if(_0x138a58){return _0x138a58?{'count':_0x204550,'rows':_0x138a58}:null;}})['then'](respondWithResult(_0x54b761,null))['catch'](handleError(_0x54b761,null));};exports['setTags']=function(_0x2eb62f,_0x4f6dae,_0x377100){if(_0x2eb62f[_0xaafb('0x4b')]['id']){delete _0x2eb62f['body']['id'];}return db['FreshdeskConfiguration']['findOne']({'where':{'id':_0x2eb62f[_0xaafb('0x47')]['id']}})[_0xaafb('0x13')](handleEntityNotFound(_0x4f6dae,null))['then'](function(_0x5471a0){if(_0x5471a0){return _0x5471a0[_0xaafb('0x55')](_0x2eb62f[_0xaafb('0x4b')][_0xaafb('0x56')]||[]);}return null;})[_0xaafb('0x13')](respondWithResult(_0x4f6dae,null))['catch'](handleError(_0x4f6dae,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 8dcde9f..b410884 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 _0x3175=['int_freshdesk_configurations','lodash','util','api','bluebird','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes','exports','FreshdeskConfiguration'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x3175,0x8d));var _0x5317=function(_0x586fa2,_0x1a45bc){_0x586fa2=_0x586fa2-0x0;var _0x515be9=_0x3175[_0x586fa2];return _0x515be9;};'use strict';var _=require(_0x5317('0x0'));var util=require(_0x5317('0x1'));var logger=require('../../config/logger')(_0x5317('0x2'));var moment=require('moment');var BPromise=require(_0x5317('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x5317('0x4'));var config=require(_0x5317('0x5'));var attributes=require(_0x5317('0x6'));module[_0x5317('0x7')]=function(_0x1ec322,_0x4589c3){return _0x1ec322['define'](_0x5317('0x8'),attributes,{'tableName':_0x5317('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x98df=['FreshdeskConfiguration','lodash','util','../../config/logger','request-promise','path','../../config/environment','./intFreshdeskConfiguration.attributes','exports','define'];(function(_0x855caa,_0x5624fa){var _0x25488a=function(_0x4407bd){while(--_0x4407bd){_0x855caa['push'](_0x855caa['shift']());}};_0x25488a(++_0x5624fa);}(_0x98df,0x8d));var _0xf98d=function(_0x2b5cee,_0x3a70f1){_0x2b5cee=_0x2b5cee-0x0;var _0x320b26=_0x98df[_0x2b5cee];return _0x320b26;};'use strict';var _=require(_0xf98d('0x0'));var util=require(_0xf98d('0x1'));var logger=require(_0xf98d('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xf98d('0x3'));var fs=require('fs');var path=require(_0xf98d('0x4'));var rimraf=require('rimraf');var config=require(_0xf98d('0x5'));var attributes=require(_0xf98d('0x6'));module[_0xf98d('0x7')]=function(_0x494154,_0x3e9226){return _0x494154[_0xf98d('0x8')](_0xf98d('0x9'),attributes,{'tableName':'int_freshdesk_configurations','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 501b6e2..c367cbd 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 _0x08b9=['client','http','request','then','info','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','FreshdeskConfiguration,\x20%s,\x20%s','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise'];(function(_0xd82812,_0x2fe0a2){var _0x592bc5=function(_0x298c95){while(--_0x298c95){_0xd82812['push'](_0xd82812['shift']());}};_0x592bc5(++_0x2fe0a2);}(_0x08b9,0x1c6));var _0x908b=function(_0x122d9f,_0x2c9e5b){_0x122d9f=_0x122d9f-0x0;var _0x41a09e=_0x08b9[_0x122d9f];return _0x41a09e;};'use strict';var _=require(_0x908b('0x0'));var util=require('util');var moment=require(_0x908b('0x1'));var BPromise=require(_0x908b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x908b('0x3'));var db=require(_0x908b('0x4'))['db'];var utils=require(_0x908b('0x5'));var logger=require(_0x908b('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x908b('0x7'));var client=jayson[_0x908b('0x8')][_0x908b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1533b9,_0x53668e,_0xec8a87){return new BPromise(function(_0x50a586,_0x2abc26){return client[_0x908b('0xa')](_0x1533b9,_0xec8a87)[_0x908b('0xb')](function(_0x4d5010){logger[_0x908b('0xc')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x53668e,_0x908b('0xd'));logger[_0x908b('0xe')](_0x908b('0xf'),_0x53668e,_0x908b('0xd'),JSON[_0x908b('0x10')](_0x4d5010));if(_0x4d5010[_0x908b('0x11')]){if(_0x4d5010[_0x908b('0x11')][_0x908b('0x12')]===0x1f4){logger[_0x908b('0x11')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x53668e,_0x4d5010['error']['message']);return _0x2abc26(_0x4d5010[_0x908b('0x11')][_0x908b('0x13')]);}logger[_0x908b('0x11')](_0x908b('0x14'),_0x53668e,_0x4d5010[_0x908b('0x11')][_0x908b('0x13')]);return _0x50a586(_0x4d5010[_0x908b('0x11')][_0x908b('0x13')]);}else{logger[_0x908b('0xc')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x53668e,'request\x20sent');_0x50a586(_0x4d5010['result']['message']);}})[_0x908b('0x15')](function(_0x591f37){logger['error']('FreshdeskConfiguration,\x20%s,\x20%s',_0x53668e,_0x591f37);_0x2abc26(_0x591f37);});});} \ No newline at end of file +var _0xba55=['info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then'];(function(_0x4b5aba,_0x2cd729){var _0xc19279=function(_0x427dcd){while(--_0x427dcd){_0x4b5aba['push'](_0x4b5aba['shift']());}};_0xc19279(++_0x2cd729);}(_0xba55,0x95));var _0x5ba5=function(_0x55002d,_0x15ff8b){_0x55002d=_0x55002d-0x0;var _0x3cc95a=_0xba55[_0x55002d];return _0x3cc95a;};'use strict';var _=require(_0x5ba5('0x0'));var util=require('util');var moment=require(_0x5ba5('0x1'));var BPromise=require(_0x5ba5('0x2'));var rs=require(_0x5ba5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5ba5('0x4'))['db'];var utils=require(_0x5ba5('0x5'));var logger=require(_0x5ba5('0x6'))(_0x5ba5('0x7'));var config=require(_0x5ba5('0x8'));var jayson=require(_0x5ba5('0x9'));var client=jayson['client'][_0x5ba5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x11c500,_0x152b64,_0x32ae0a){return new BPromise(function(_0x1676b3,_0x55bc4b){return client['request'](_0x11c500,_0x32ae0a)[_0x5ba5('0xb')](function(_0x4ee510){logger[_0x5ba5('0xc')](_0x5ba5('0xd'),_0x152b64,_0x5ba5('0xe'));logger[_0x5ba5('0xf')](_0x5ba5('0x10'),_0x152b64,'request\x20sent',JSON[_0x5ba5('0x11')](_0x4ee510));if(_0x4ee510[_0x5ba5('0x12')]){if(_0x4ee510['error'][_0x5ba5('0x13')]===0x1f4){logger['error'](_0x5ba5('0xd'),_0x152b64,_0x4ee510[_0x5ba5('0x12')]['message']);return _0x55bc4b(_0x4ee510[_0x5ba5('0x12')][_0x5ba5('0x14')]);}logger[_0x5ba5('0x12')](_0x5ba5('0xd'),_0x152b64,_0x4ee510[_0x5ba5('0x12')]['message']);return _0x1676b3(_0x4ee510[_0x5ba5('0x12')][_0x5ba5('0x14')]);}else{logger[_0x5ba5('0xc')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x152b64,_0x5ba5('0xe'));_0x1676b3(_0x4ee510[_0x5ba5('0x15')]['message']);}})[_0x5ba5('0x16')](function(_0x454bf5){logger[_0x5ba5('0x12')](_0x5ba5('0xd'),_0x152b64,_0x454bf5);_0x55bc4b(_0x454bf5);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 61b1bd3..1576afb 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 _0x9c44=['/:id','isAuthenticated','show','create','put','delete','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','index'];(function(_0x423eba,_0xb6826c){var _0x138f29=function(_0x22e9e3){while(--_0x22e9e3){_0x423eba['push'](_0x423eba['shift']());}};_0x138f29(++_0xb6826c);}(_0x9c44,0x178));var _0x49c4=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x9c44[_0x2d7f0e];return _0x110b07;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var auth=require(_0x49c4('0x4'));var interaction=require(_0x49c4('0x5'));var config=require('../../config/environment');var controller=require('./intFreshdeskField.controller');router[_0x49c4('0x6')]('/',auth['isAuthenticated'](),controller[_0x49c4('0x7')]);router[_0x49c4('0x6')](_0x49c4('0x8'),auth[_0x49c4('0x9')](),controller[_0x49c4('0xa')]);router['post']('/',auth[_0x49c4('0x9')](),controller[_0x49c4('0xb')]);router[_0x49c4('0xc')](_0x49c4('0x8'),auth['isAuthenticated'](),controller['update']);router[_0x49c4('0xd')](_0x49c4('0x8'),auth['isAuthenticated'](),controller[_0x49c4('0xe')]);module[_0x49c4('0xf')]=router; \ No newline at end of file +var _0x70e0=['create','put','/:id','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','show','post','isAuthenticated'];(function(_0x3314a3,_0x712212){var _0xc5d6a4=function(_0x34cac2){while(--_0x34cac2){_0x3314a3['push'](_0x3314a3['shift']());}};_0xc5d6a4(++_0x712212);}(_0x70e0,0x17b));var _0x070e=function(_0x28bd4d,_0x5246ba){_0x28bd4d=_0x28bd4d-0x0;var _0x547b30=_0x70e0[_0x28bd4d];return _0x547b30;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var auth=require(_0x070e('0x4'));var interaction=require(_0x070e('0x5'));var config=require(_0x070e('0x6'));var controller=require('./intFreshdeskField.controller');router[_0x070e('0x7')]('/',auth['isAuthenticated'](),controller[_0x070e('0x8')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x070e('0x9')]);router[_0x070e('0xa')]('/',auth[_0x070e('0xb')](),controller[_0x070e('0xc')]);router[_0x070e('0xd')](_0x070e('0xe'),auth[_0x070e('0xb')](),controller['update']);router['delete'](_0x070e('0xe'),auth[_0x070e('0xb')](),controller[_0x070e('0xf')]);module[_0x070e('0x10')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index 1481733..4ca2448 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 _0x851e=['variable','BOOLEAN','sequelize','exports','ENUM','customVariable','keyValue','string','STRING'];(function(_0x330414,_0x4f3207){var _0x99dbff=function(_0x166f85){while(--_0x166f85){_0x330414['push'](_0x330414['shift']());}};_0x99dbff(++_0x4f3207);}(_0x851e,0x1e8));var _0xe851=function(_0x4da493,_0x15e45a){_0x4da493=_0x4da493-0x0;var _0x33e403=_0x851e[_0x4da493];return _0x33e403;};'use strict';var Sequelize=require(_0xe851('0x0'));module[_0xe851('0x1')]={'type':{'type':Sequelize[_0xe851('0x2')]('string','variable',_0xe851('0x3'),_0xe851('0x4')),'defaultValue':_0xe851('0x5')},'content':{'type':Sequelize[_0xe851('0x6')]},'key':{'type':Sequelize[_0xe851('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0xe851('0x5'),_0xe851('0x7'),_0xe851('0x3'))},'keyContent':{'type':Sequelize[_0xe851('0x6')]},'idField':{'type':Sequelize[_0xe851('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xe851('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xa1f6=['string','variable','customVariable','STRING','BOOLEAN','sequelize','exports','ENUM'];(function(_0x3d368b,_0xbbc5db){var _0x579af1=function(_0x25d530){while(--_0x25d530){_0x3d368b['push'](_0x3d368b['shift']());}};_0x579af1(++_0xbbc5db);}(_0xa1f6,0x19d));var _0x6a1f=function(_0x6dfbaa,_0x31eede){_0x6dfbaa=_0x6dfbaa-0x0;var _0xfbe02=_0xa1f6[_0x6dfbaa];return _0xfbe02;};'use strict';var Sequelize=require(_0x6a1f('0x0'));module[_0x6a1f('0x1')]={'type':{'type':Sequelize[_0x6a1f('0x2')](_0x6a1f('0x3'),_0x6a1f('0x4'),_0x6a1f('0x5'),'keyValue'),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x6a1f('0x3'),_0x6a1f('0x4'),_0x6a1f('0x5'))},'keyContent':{'type':Sequelize[_0x6a1f('0x6')]},'idField':{'type':Sequelize[_0x6a1f('0x6')]},'nameField':{'type':Sequelize[_0x6a1f('0x6')]},'customField':{'type':Sequelize[_0x6a1f('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index 64a79ed..85597a6 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 _0x5787=['filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','rawAttributes','intersection','find','create','body','html-pdf','eml-format','zip-dir','fast-json-patch','bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','update','then','destroy','sendStatus','stack','name','send','index','map','FreshdeskField','fieldName','type','key','query','filters','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x5b9f60,_0x392049){var _0x2ccf26=function(_0xebaee7){while(--_0xebaee7){_0x5b9f60['push'](_0x5b9f60['shift']());}};_0x2ccf26(++_0x392049);}(_0x5787,0x9c));var _0x7578=function(_0x4b1515,_0x3503a9){_0x4b1515=_0x4b1515-0x0;var _0x162c64=_0x5787[_0x4b1515];return _0x162c64;};'use strict';var pdf=require(_0x7578('0x0'));var emlformat=require(_0x7578('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x7578('0x2'));var jsonpatch=require(_0x7578('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x7578('0x4'));var Mustache=require(_0x7578('0x5'));var util=require('util');var path=require(_0x7578('0x6'));var sox=require(_0x7578('0x7'));var csv=require(_0x7578('0x8'));var ejs=require(_0x7578('0x9'));var fs=require('fs');var _=require(_0x7578('0xa'));var squel=require('squel');var crypto=require(_0x7578('0xb'));var jsforce=require(_0x7578('0xc'));var deskjs=require(_0x7578('0xd'));var toCsv=require(_0x7578('0x8'));var querystring=require('querystring');var Papa=require(_0x7578('0xe'));var Redis=require(_0x7578('0xf'));var authService=require(_0x7578('0x10'));var qs=require(_0x7578('0x11'));var as=require(_0x7578('0x12'));var hardwareService=require(_0x7578('0x13'));var logger=require(_0x7578('0x14'))('api');var utils=require(_0x7578('0x15'));var config=require('../../config/environment');var db=require(_0x7578('0x16'))['db'];function respondWithStatusCode(_0x56e052,_0x556983){_0x556983=_0x556983||0xcc;return function(_0xc3d0be){if(_0xc3d0be){return _0x56e052['sendStatus'](_0x556983);}return _0x56e052[_0x7578('0x17')](_0x556983)[_0x7578('0x18')]();};}function respondWithResult(_0x3c4879,_0x3b39a8){_0x3b39a8=_0x3b39a8||0xc8;return function(_0x23ecd4){if(_0x23ecd4){return _0x3c4879[_0x7578('0x17')](_0x3b39a8)[_0x7578('0x19')](_0x23ecd4);}};}function respondWithFilteredResult(_0x5b76c2,_0x544261){return function(_0x3c3b2c){if(_0x3c3b2c){var _0x2c89ed=_0x3c3b2c[_0x7578('0x1a')],_0x5d8481=_0x544261[_0x7578('0x1b')],_0x2fc5d7=_0x544261['offset']+_0x544261[_0x7578('0x1c')],_0x3617e8;if(_0x2fc5d7>=_0x2c89ed){_0x2fc5d7=_0x2c89ed;_0x3617e8=0xc8;}else{_0x3617e8=0xce;}_0x5b76c2[_0x7578('0x17')](_0x3617e8);return _0x5b76c2[_0x7578('0x1d')](_0x7578('0x1e'),_0x5d8481+'-'+_0x2fc5d7+'/'+_0x2c89ed)['json'](_0x3c3b2c);}return null;};}function patchUpdates(_0x35f520){return function(_0x54acde){try{jsonpatch[_0x7578('0x1f')](_0x54acde,_0x35f520,!![]);}catch(_0x71b4b4){return BPromise['reject'](_0x71b4b4);}return _0x54acde['save']();};}function saveUpdates(_0xf8abd8,_0x4f70d0){return function(_0x43e6b2){if(_0x43e6b2){return _0x43e6b2[_0x7578('0x20')](_0xf8abd8)[_0x7578('0x21')](function(_0x581c19){return _0x581c19;});}return null;};}function removeEntity(_0x6caaf5,_0x394361){return function(_0x447c74){if(_0x447c74){return _0x447c74[_0x7578('0x22')]()[_0x7578('0x21')](function(){_0x6caaf5[_0x7578('0x17')](0xcc)[_0x7578('0x18')]();});}};}function handleEntityNotFound(_0x7adb59,_0x3c2dd2){return function(_0x509c78){if(!_0x509c78){_0x7adb59[_0x7578('0x23')](0x194);}return _0x509c78;};}function handleError(_0x97e971,_0x5767b5){_0x5767b5=_0x5767b5||0x1f4;return function(_0x32ac8a){logger['error'](_0x32ac8a[_0x7578('0x24')]);if(_0x32ac8a[_0x7578('0x25')]){delete _0x32ac8a['name'];}_0x97e971[_0x7578('0x17')](_0x5767b5)[_0x7578('0x26')](_0x32ac8a);};}exports[_0x7578('0x27')]=function(_0x1a8497,_0x1c5d7a){var _0x64161c={},_0x2d611c={},_0x39f498={'count':0x0,'rows':[]};var _0x5a275c=_[_0x7578('0x28')](db[_0x7578('0x29')]['rawAttributes'],function(_0xcd248c){return{'name':_0xcd248c[_0x7578('0x2a')],'type':_0xcd248c[_0x7578('0x2b')][_0x7578('0x2c')]};});_0x2d611c['model']=_[_0x7578('0x28')](_0x5a275c,_0x7578('0x25'));_0x2d611c[_0x7578('0x2d')]=_['keys'](_0x1a8497[_0x7578('0x2d')]);_0x2d611c[_0x7578('0x2e')]=_['intersection'](_0x2d611c[_0x7578('0x2f')],_0x2d611c[_0x7578('0x2d')]);_0x64161c['attributes']=_['intersection'](_0x2d611c[_0x7578('0x2f')],qs[_0x7578('0x30')](_0x1a8497[_0x7578('0x2d')]['fields']));_0x64161c[_0x7578('0x31')]=_0x64161c[_0x7578('0x31')][_0x7578('0x32')]?_0x64161c[_0x7578('0x31')]:_0x2d611c['model'];if(!_0x1a8497[_0x7578('0x2d')][_0x7578('0x33')](_0x7578('0x34'))){_0x64161c[_0x7578('0x1c')]=qs[_0x7578('0x1c')](_0x1a8497[_0x7578('0x2d')]['limit']);_0x64161c['offset']=qs[_0x7578('0x1b')](_0x1a8497['query']['offset']);}_0x64161c[_0x7578('0x35')]=qs['sort'](_0x1a8497[_0x7578('0x2d')][_0x7578('0x36')]);_0x64161c[_0x7578('0x37')]=qs[_0x7578('0x2e')](_[_0x7578('0x38')](_0x1a8497[_0x7578('0x2d')],_0x2d611c[_0x7578('0x2e')]));if(_0x1a8497[_0x7578('0x2d')][_0x7578('0x39')]){_0x64161c['where']=_[_0x7578('0x3a')](_0x64161c[_0x7578('0x37')],{'$or':_[_0x7578('0x28')](_0x5a275c,function(_0x11906b){if(_0x11906b[_0x7578('0x2b')]!==_0x7578('0x3b')){var _0xe87904={};_0xe87904[_0x11906b[_0x7578('0x25')]]={'$like':'%'+_0x1a8497['query'][_0x7578('0x39')]+'%'};return _0xe87904;}})});}_0x64161c=_[_0x7578('0x3a')]({},_0x64161c,_0x1a8497[_0x7578('0x3c')]);var _0x2c0889={'where':_0x64161c[_0x7578('0x37')]};return db[_0x7578('0x29')][_0x7578('0x1a')](_0x2c0889)['then'](function(_0x49f990){_0x39f498['count']=_0x49f990;if(_0x1a8497[_0x7578('0x2d')][_0x7578('0x3d')]){_0x64161c[_0x7578('0x3e')]=[{'all':!![]}];}return db['FreshdeskField'][_0x7578('0x3f')](_0x64161c);})[_0x7578('0x21')](function(_0x4af821){_0x39f498['rows']=_0x4af821;return _0x39f498;})[_0x7578('0x21')](respondWithFilteredResult(_0x1c5d7a,_0x64161c))[_0x7578('0x40')](handleError(_0x1c5d7a,null));};exports['show']=function(_0x19ce90,_0x2317fe){var _0x5551f2={'raw':!![],'where':{'id':_0x19ce90[_0x7578('0x41')]['id']}},_0x308600={};_0x308600[_0x7578('0x2f')]=_['keys'](db[_0x7578('0x29')][_0x7578('0x42')]);_0x308600[_0x7578('0x2d')]=_['keys'](_0x19ce90[_0x7578('0x2d')]);_0x308600[_0x7578('0x2e')]=_['intersection'](_0x308600[_0x7578('0x2f')],_0x308600['query']);_0x5551f2[_0x7578('0x31')]=_[_0x7578('0x43')](_0x308600['model'],qs[_0x7578('0x30')](_0x19ce90[_0x7578('0x2d')][_0x7578('0x30')]));_0x5551f2[_0x7578('0x31')]=_0x5551f2[_0x7578('0x31')][_0x7578('0x32')]?_0x5551f2['attributes']:_0x308600[_0x7578('0x2f')];if(_0x19ce90['query'][_0x7578('0x3d')]){_0x5551f2[_0x7578('0x3e')]=[{'all':!![]}];}_0x5551f2=_[_0x7578('0x3a')]({},_0x5551f2,_0x19ce90['options']);return db['FreshdeskField'][_0x7578('0x44')](_0x5551f2)[_0x7578('0x21')](handleEntityNotFound(_0x2317fe,null))['then'](respondWithResult(_0x2317fe,null))['catch'](handleError(_0x2317fe,null));};exports[_0x7578('0x45')]=function(_0x5ea120,_0x24c9fb){return db['FreshdeskField']['create'](_0x5ea120[_0x7578('0x46')],{})[_0x7578('0x21')](respondWithResult(_0x24c9fb,0xc9))['catch'](handleError(_0x24c9fb,null));};exports[_0x7578('0x20')]=function(_0x3dd9b9,_0x3af2dc){if(_0x3dd9b9[_0x7578('0x46')]['id']){delete _0x3dd9b9[_0x7578('0x46')]['id'];}return db[_0x7578('0x29')][_0x7578('0x44')]({'where':{'id':_0x3dd9b9['params']['id']}})[_0x7578('0x21')](handleEntityNotFound(_0x3af2dc,null))['then'](saveUpdates(_0x3dd9b9['body'],null))[_0x7578('0x21')](respondWithResult(_0x3af2dc,null))['catch'](handleError(_0x3af2dc,null));};exports[_0x7578('0x22')]=function(_0xbf2a6b,_0x315106){return db[_0x7578('0x29')][_0x7578('0x44')]({'where':{'id':_0xbf2a6b['params']['id']}})[_0x7578('0x21')](handleEntityNotFound(_0x315106,null))['then'](removeEntity(_0x315106,null))[_0x7578('0x40')](handleError(_0x315106,null));}; \ No newline at end of file +var _0xc9a5=['../../config/logger','api','../../mysqldb','status','end','json','count','offset','limit','set','apply','save','update','then','destroy','sendStatus','error','stack','name','send','map','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','FreshdeskField','include','findAll','show','keys','rawAttributes','includeAll','find','create','body','params','catch','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','util','path','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x3bfa8d,_0x3f281a){var _0x166c08=function(_0xedfb6d){while(--_0xedfb6d){_0x3bfa8d['push'](_0x3bfa8d['shift']());}};_0x166c08(++_0x3f281a);}(_0xc9a5,0xc3));var _0x5c9a=function(_0x1d010b,_0x19fca5){_0x1d010b=_0x1d010b-0x0;var _0x43cb2d=_0xc9a5[_0x1d010b];return _0x43cb2d;};'use strict';var pdf=require(_0x5c9a('0x0'));var emlformat=require(_0x5c9a('0x1'));var rimraf=require(_0x5c9a('0x2'));var zipdir=require(_0x5c9a('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5c9a('0x4'));var moment=require('moment');var BPromise=require(_0x5c9a('0x5'));var Mustache=require('mustache');var util=require(_0x5c9a('0x6'));var path=require(_0x5c9a('0x7'));var sox=require(_0x5c9a('0x8'));var csv=require(_0x5c9a('0x9'));var ejs=require(_0x5c9a('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x5c9a('0xb'));var crypto=require('crypto');var jsforce=require(_0x5c9a('0xc'));var deskjs=require(_0x5c9a('0xd'));var toCsv=require(_0x5c9a('0x9'));var querystring=require(_0x5c9a('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x5c9a('0xf'));var as=require(_0x5c9a('0x10'));var hardwareService=require(_0x5c9a('0x11'));var logger=require(_0x5c9a('0x12'))(_0x5c9a('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x5c9a('0x14'))['db'];function respondWithStatusCode(_0x11aae7,_0x3e9a94){_0x3e9a94=_0x3e9a94||0xcc;return function(_0x117e1b){if(_0x117e1b){return _0x11aae7['sendStatus'](_0x3e9a94);}return _0x11aae7[_0x5c9a('0x15')](_0x3e9a94)[_0x5c9a('0x16')]();};}function respondWithResult(_0x3083d9,_0x40b33d){_0x40b33d=_0x40b33d||0xc8;return function(_0x445612){if(_0x445612){return _0x3083d9[_0x5c9a('0x15')](_0x40b33d)[_0x5c9a('0x17')](_0x445612);}};}function respondWithFilteredResult(_0x5e2992,_0x51e0ce){return function(_0x287ee3){if(_0x287ee3){var _0x1b2ea5=_0x287ee3[_0x5c9a('0x18')],_0x6bc88f=_0x51e0ce[_0x5c9a('0x19')],_0x121288=_0x51e0ce[_0x5c9a('0x19')]+_0x51e0ce[_0x5c9a('0x1a')],_0x1bc512;if(_0x121288>=_0x1b2ea5){_0x121288=_0x1b2ea5;_0x1bc512=0xc8;}else{_0x1bc512=0xce;}_0x5e2992['status'](_0x1bc512);return _0x5e2992[_0x5c9a('0x1b')]('Content-Range',_0x6bc88f+'-'+_0x121288+'/'+_0x1b2ea5)['json'](_0x287ee3);}return null;};}function patchUpdates(_0x296963){return function(_0x21ef3e){try{jsonpatch[_0x5c9a('0x1c')](_0x21ef3e,_0x296963,!![]);}catch(_0x2e1ac8){return BPromise['reject'](_0x2e1ac8);}return _0x21ef3e[_0x5c9a('0x1d')]();};}function saveUpdates(_0x49ab3d,_0x577d56){return function(_0x48b62e){if(_0x48b62e){return _0x48b62e[_0x5c9a('0x1e')](_0x49ab3d)[_0x5c9a('0x1f')](function(_0x1fa18d){return _0x1fa18d;});}return null;};}function removeEntity(_0x1e38eb,_0x498627){return function(_0xe7ee65){if(_0xe7ee65){return _0xe7ee65[_0x5c9a('0x20')]()[_0x5c9a('0x1f')](function(){_0x1e38eb['status'](0xcc)[_0x5c9a('0x16')]();});}};}function handleEntityNotFound(_0x4e7f4f,_0x5c34e8){return function(_0x3916b4){if(!_0x3916b4){_0x4e7f4f[_0x5c9a('0x21')](0x194);}return _0x3916b4;};}function handleError(_0x3fdbc0,_0x178cf5){_0x178cf5=_0x178cf5||0x1f4;return function(_0x224184){logger[_0x5c9a('0x22')](_0x224184[_0x5c9a('0x23')]);if(_0x224184['name']){delete _0x224184[_0x5c9a('0x24')];}_0x3fdbc0['status'](_0x178cf5)[_0x5c9a('0x25')](_0x224184);};}exports['index']=function(_0x577b84,_0xd4943a){var _0x355c03={},_0x37dea2={},_0x251a6b={'count':0x0,'rows':[]};var _0x3ee9bc=_[_0x5c9a('0x26')](db['FreshdeskField']['rawAttributes'],function(_0x505f8b){return{'name':_0x505f8b[_0x5c9a('0x27')],'type':_0x505f8b[_0x5c9a('0x28')][_0x5c9a('0x29')]};});_0x37dea2[_0x5c9a('0x2a')]=_[_0x5c9a('0x26')](_0x3ee9bc,_0x5c9a('0x24'));_0x37dea2[_0x5c9a('0x2b')]=_['keys'](_0x577b84['query']);_0x37dea2[_0x5c9a('0x2c')]=_['intersection'](_0x37dea2[_0x5c9a('0x2a')],_0x37dea2[_0x5c9a('0x2b')]);_0x355c03[_0x5c9a('0x2d')]=_[_0x5c9a('0x2e')](_0x37dea2['model'],qs[_0x5c9a('0x2f')](_0x577b84[_0x5c9a('0x2b')]['fields']));_0x355c03[_0x5c9a('0x2d')]=_0x355c03[_0x5c9a('0x2d')][_0x5c9a('0x30')]?_0x355c03[_0x5c9a('0x2d')]:_0x37dea2[_0x5c9a('0x2a')];if(!_0x577b84[_0x5c9a('0x2b')][_0x5c9a('0x31')](_0x5c9a('0x32'))){_0x355c03[_0x5c9a('0x1a')]=qs[_0x5c9a('0x1a')](_0x577b84[_0x5c9a('0x2b')]['limit']);_0x355c03[_0x5c9a('0x19')]=qs[_0x5c9a('0x19')](_0x577b84['query'][_0x5c9a('0x19')]);}_0x355c03[_0x5c9a('0x33')]=qs[_0x5c9a('0x34')](_0x577b84[_0x5c9a('0x2b')][_0x5c9a('0x34')]);_0x355c03[_0x5c9a('0x35')]=qs[_0x5c9a('0x2c')](_[_0x5c9a('0x36')](_0x577b84[_0x5c9a('0x2b')],_0x37dea2['filters']));if(_0x577b84['query'][_0x5c9a('0x37')]){_0x355c03[_0x5c9a('0x35')]=_['merge'](_0x355c03['where'],{'$or':_['map'](_0x3ee9bc,function(_0x361384){if(_0x361384[_0x5c9a('0x28')]!==_0x5c9a('0x38')){var _0xeed2af={};_0xeed2af[_0x361384[_0x5c9a('0x24')]]={'$like':'%'+_0x577b84[_0x5c9a('0x2b')][_0x5c9a('0x37')]+'%'};return _0xeed2af;}})});}_0x355c03=_[_0x5c9a('0x39')]({},_0x355c03,_0x577b84[_0x5c9a('0x3a')]);var _0x4a1380={'where':_0x355c03['where']};return db[_0x5c9a('0x3b')][_0x5c9a('0x18')](_0x4a1380)[_0x5c9a('0x1f')](function(_0x53f768){_0x251a6b[_0x5c9a('0x18')]=_0x53f768;if(_0x577b84['query']['includeAll']){_0x355c03[_0x5c9a('0x3c')]=[{'all':!![]}];}return db['FreshdeskField'][_0x5c9a('0x3d')](_0x355c03);})[_0x5c9a('0x1f')](function(_0x57b8f8){_0x251a6b['rows']=_0x57b8f8;return _0x251a6b;})[_0x5c9a('0x1f')](respondWithFilteredResult(_0xd4943a,_0x355c03))['catch'](handleError(_0xd4943a,null));};exports[_0x5c9a('0x3e')]=function(_0x1bce06,_0x20e87a){var _0x4acbd8={'raw':!![],'where':{'id':_0x1bce06['params']['id']}},_0x490d18={};_0x490d18['model']=_[_0x5c9a('0x3f')](db[_0x5c9a('0x3b')][_0x5c9a('0x40')]);_0x490d18[_0x5c9a('0x2b')]=_['keys'](_0x1bce06[_0x5c9a('0x2b')]);_0x490d18['filters']=_['intersection'](_0x490d18['model'],_0x490d18[_0x5c9a('0x2b')]);_0x4acbd8[_0x5c9a('0x2d')]=_[_0x5c9a('0x2e')](_0x490d18[_0x5c9a('0x2a')],qs[_0x5c9a('0x2f')](_0x1bce06[_0x5c9a('0x2b')][_0x5c9a('0x2f')]));_0x4acbd8[_0x5c9a('0x2d')]=_0x4acbd8[_0x5c9a('0x2d')][_0x5c9a('0x30')]?_0x4acbd8['attributes']:_0x490d18['model'];if(_0x1bce06[_0x5c9a('0x2b')][_0x5c9a('0x41')]){_0x4acbd8[_0x5c9a('0x3c')]=[{'all':!![]}];}_0x4acbd8=_[_0x5c9a('0x39')]({},_0x4acbd8,_0x1bce06['options']);return db[_0x5c9a('0x3b')][_0x5c9a('0x42')](_0x4acbd8)[_0x5c9a('0x1f')](handleEntityNotFound(_0x20e87a,null))[_0x5c9a('0x1f')](respondWithResult(_0x20e87a,null))['catch'](handleError(_0x20e87a,null));};exports[_0x5c9a('0x43')]=function(_0x34d5df,_0x41138b){return db[_0x5c9a('0x3b')][_0x5c9a('0x43')](_0x34d5df[_0x5c9a('0x44')],{})[_0x5c9a('0x1f')](respondWithResult(_0x41138b,0xc9))['catch'](handleError(_0x41138b,null));};exports[_0x5c9a('0x1e')]=function(_0x4400cc,_0x1e1b25){if(_0x4400cc[_0x5c9a('0x44')]['id']){delete _0x4400cc[_0x5c9a('0x44')]['id'];}return db[_0x5c9a('0x3b')]['find']({'where':{'id':_0x4400cc[_0x5c9a('0x45')]['id']}})[_0x5c9a('0x1f')](handleEntityNotFound(_0x1e1b25,null))[_0x5c9a('0x1f')](saveUpdates(_0x4400cc[_0x5c9a('0x44')],null))['then'](respondWithResult(_0x1e1b25,null))[_0x5c9a('0x46')](handleError(_0x1e1b25,null));};exports[_0x5c9a('0x20')]=function(_0x40f909,_0x66440a){return db[_0x5c9a('0x3b')][_0x5c9a('0x42')]({'where':{'id':_0x40f909['params']['id']}})[_0x5c9a('0x1f')](handleEntityNotFound(_0x66440a,null))['then'](removeEntity(_0x66440a,null))['catch'](handleError(_0x66440a,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 93fe903..5d85d6f 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 _0x6f03=['define','FreshdeskField','freshdesk_unique_index','idField','FieldId','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x427da5,_0x170eea){var _0x2b782e=function(_0x3c376b){while(--_0x3c376b){_0x427da5['push'](_0x427da5['shift']());}};_0x2b782e(++_0x170eea);}(_0x6f03,0xe2));var _0x36f0=function(_0x174964,_0x20b5ff){_0x174964=_0x174964-0x0;var _0x213389=_0x6f03[_0x174964];return _0x213389;};'use strict';var _=require('lodash');var util=require(_0x36f0('0x0'));var logger=require(_0x36f0('0x1'))('api');var moment=require(_0x36f0('0x2'));var BPromise=require('bluebird');var rp=require(_0x36f0('0x3'));var fs=require('fs');var path=require(_0x36f0('0x4'));var rimraf=require(_0x36f0('0x5'));var config=require(_0x36f0('0x6'));var attributes=require('./intFreshdeskField.attributes');module[_0x36f0('0x7')]=function(_0x4aacb4,_0x42284e){return _0x4aacb4[_0x36f0('0x8')](_0x36f0('0x9'),attributes,{'tableName':'int_freshdesk_fields','paranoid':![],'indexes':[{'name':_0x36f0('0xa'),'fields':[_0x36f0('0xb'),_0x36f0('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x35e4=['idField','FieldId','lodash','util','api','moment','bluebird','request-promise','path','rimraf','./intFreshdeskField.attributes','exports','define','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index'];(function(_0x2aec52,_0x59d962){var _0x3b8835=function(_0x3e2604){while(--_0x3e2604){_0x2aec52['push'](_0x2aec52['shift']());}};_0x3b8835(++_0x59d962);}(_0x35e4,0x152));var _0x435e=function(_0x5a749a,_0x4583db){_0x5a749a=_0x5a749a-0x0;var _0x1baee1=_0x35e4[_0x5a749a];return _0x1baee1;};'use strict';var _=require(_0x435e('0x0'));var util=require(_0x435e('0x1'));var logger=require('../../config/logger')(_0x435e('0x2'));var moment=require(_0x435e('0x3'));var BPromise=require(_0x435e('0x4'));var rp=require(_0x435e('0x5'));var fs=require('fs');var path=require(_0x435e('0x6'));var rimraf=require(_0x435e('0x7'));var config=require('../../config/environment');var attributes=require(_0x435e('0x8'));module[_0x435e('0x9')]=function(_0x20e8b8,_0x4ed9e2){return _0x20e8b8[_0x435e('0xa')](_0x435e('0xb'),attributes,{'tableName':_0x435e('0xc'),'paranoid':![],'indexes':[{'name':_0x435e('0xd'),'fields':[_0x435e('0xe'),_0x435e('0xf')],'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 5fec618..9518682 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 _0x7a54=['info','FreshdeskField,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x7a54,0x106));var _0x47a5=function(_0xcbd350,_0x53a60a){_0xcbd350=_0xcbd350-0x0;var _0xaf1fb=_0x7a54[_0xcbd350];return _0xaf1fb;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('FreshdeskField,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file +var _0x7a54=['info','FreshdeskField,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x7a54,0x106));var _0x47a5=function(_0x5c79fe,_0x2a9538){_0x5c79fe=_0x5c79fe-0x0;var _0x5a90a8=_0x7a54[_0x5c79fe];return _0x5a90a8;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('FreshdeskField,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index 0e60653..e986c75 100644 --- a/server/api/intFreshsalesAccount/index.js +++ b/server/api/intFreshsalesAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7d9d=['multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','get','/:id','isAuthenticated','show','/:id/configurations','/:id/fields','getFields','post','addConfiguration','put','update','delete','destroy'];(function(_0x3cadbd,_0x12bc43){var _0x296da9=function(_0x3b15fc){while(--_0x3b15fc){_0x3cadbd['push'](_0x3cadbd['shift']());}};_0x296da9(++_0x12bc43);}(_0x7d9d,0x84));var _0xd7d9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7d9d[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xd7d9('0x0'));var util=require(_0xd7d9('0x1'));var path=require(_0xd7d9('0x2'));var timeout=require(_0xd7d9('0x3'));var express=require(_0xd7d9('0x4'));var router=express[_0xd7d9('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xd7d9('0x6'));var config=require(_0xd7d9('0x7'));var controller=require(_0xd7d9('0x8'));router[_0xd7d9('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xd7d9('0xa'),auth[_0xd7d9('0xb')](),controller[_0xd7d9('0xc')]);router[_0xd7d9('0x9')](_0xd7d9('0xd'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0xd7d9('0x9')](_0xd7d9('0xe'),auth['isAuthenticated'](),controller[_0xd7d9('0xf')]);router['post']('/',auth[_0xd7d9('0xb')](),controller['create']);router[_0xd7d9('0x10')](_0xd7d9('0xd'),auth['isAuthenticated'](),controller[_0xd7d9('0x11')]);router[_0xd7d9('0x12')](_0xd7d9('0xa'),auth['isAuthenticated'](),controller[_0xd7d9('0x13')]);router[_0xd7d9('0x14')](_0xd7d9('0xa'),auth[_0xd7d9('0xb')](),controller[_0xd7d9('0x15')]);module['exports']=router; \ No newline at end of file +var _0x4c6a=['util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','delete','destroy','multer'];(function(_0x1e225f,_0x4ba2d1){var _0x4f39a6=function(_0x59b5ef){while(--_0x59b5ef){_0x1e225f['push'](_0x1e225f['shift']());}};_0x4f39a6(++_0x4ba2d1);}(_0x4c6a,0xc5));var _0xa4c6=function(_0x477415,_0x5a7a1b){_0x477415=_0x477415-0x0;var _0x182901=_0x4c6a[_0x477415];return _0x182901;};'use strict';var multer=require(_0xa4c6('0x0'));var util=require(_0xa4c6('0x1'));var path=require('path');var timeout=require(_0xa4c6('0x2'));var express=require(_0xa4c6('0x3'));var router=express[_0xa4c6('0x4')]();var auth=require(_0xa4c6('0x5'));var interaction=require(_0xa4c6('0x6'));var config=require(_0xa4c6('0x7'));var controller=require('./intFreshsalesAccount.controller');router[_0xa4c6('0x8')]('/',auth[_0xa4c6('0x9')](),controller[_0xa4c6('0xa')]);router['get'](_0xa4c6('0xb'),auth['isAuthenticated'](),controller[_0xa4c6('0xc')]);router['get'](_0xa4c6('0xd'),auth['isAuthenticated'](),controller[_0xa4c6('0xe')]);router['get'](_0xa4c6('0xf'),auth[_0xa4c6('0x9')](),controller[_0xa4c6('0x10')]);router[_0xa4c6('0x11')]('/',auth[_0xa4c6('0x9')](),controller[_0xa4c6('0x12')]);router['post']('/:id/configurations',auth['isAuthenticated'](),controller[_0xa4c6('0x13')]);router['put'](_0xa4c6('0xb'),auth['isAuthenticated'](),controller['update']);router[_0xa4c6('0x14')](_0xa4c6('0xb'),auth['isAuthenticated'](),controller[_0xa4c6('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index 154adbc..cf03b11 100644 --- a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js +++ b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfc4f=['exports','STRING','username'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xfc4f,0x192));var _0xffc4=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xfc4f[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require('sequelize');module[_0xffc4('0x0')]={'name':{'type':Sequelize[_0xffc4('0x1')]},'description':{'type':Sequelize[_0xffc4('0x1')]},'username':{'type':Sequelize[_0xffc4('0x1')],'unique':_0xffc4('0x2')},'apiKey':{'type':Sequelize[_0xffc4('0x1')]},'remoteUri':{'type':Sequelize[_0xffc4('0x1')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0xffc4('0x1')]}}; \ No newline at end of file +var _0x6efe=['STRING','remoteUri','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6efe,0xc6));var _0xe6ef=function(_0xb65ce6,_0x5bc66a){_0xb65ce6=_0xb65ce6-0x0;var _0x254c4b=_0x6efe[_0xb65ce6];return _0x254c4b;};'use strict';var Sequelize=require(_0xe6ef('0x0'));module[_0xe6ef('0x1')]={'name':{'type':Sequelize[_0xe6ef('0x2')]},'description':{'type':Sequelize[_0xe6ef('0x2')]},'username':{'type':Sequelize[_0xe6ef('0x2')],'unique':'username'},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xe6ef('0x2')],'unique':_0xe6ef('0x3')},'serverUrl':{'type':Sequelize[_0xe6ef('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index b32bf2b..3608eb5 100644 --- a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js +++ b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4053=['../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','map','FreshsalesAccount','rawAttributes','fieldName','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','type','VIRTUAL','filter','merge','options','count','includeAll','include','rows','show','params','keys','find','create','body','getConfigurations','findOne','FreshsalesConfiguration','addConfiguration','AccountId','getSubjects','Descriptions','channel','Subjects','FreshsalesField','getFields','username','remoteUri','substring','lastIndexOf','GET','format','/api/selector/owners','Token\x20token=','apiKey','email','Requested\x20Resource\x20not\x20Found','test','statusCode','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger'];(function(_0x1be8ae,_0x44b574){var _0x5f48a2=function(_0x3494e1){while(--_0x3494e1){_0x1be8ae['push'](_0x1be8ae['shift']());}};_0x5f48a2(++_0x44b574);}(_0x4053,0xd7));var _0x3405=function(_0x50ede0,_0x7e6410){_0x50ede0=_0x50ede0-0x0;var _0x5cbe32=_0x4053[_0x50ede0];return _0x5cbe32;};'use strict';var pdf=require(_0x3405('0x0'));var emlformat=require(_0x3405('0x1'));var rimraf=require(_0x3405('0x2'));var zipdir=require(_0x3405('0x3'));var jsonpatch=require(_0x3405('0x4'));var rp=require(_0x3405('0x5'));var moment=require('moment');var BPromise=require(_0x3405('0x6'));var Mustache=require(_0x3405('0x7'));var util=require(_0x3405('0x8'));var path=require(_0x3405('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x3405('0xa'));var fs=require('fs');var _=require(_0x3405('0xb'));var squel=require(_0x3405('0xc'));var crypto=require(_0x3405('0xd'));var jsforce=require(_0x3405('0xe'));var deskjs=require(_0x3405('0xf'));var toCsv=require(_0x3405('0x10'));var querystring=require('querystring');var Papa=require(_0x3405('0x11'));var Redis=require(_0x3405('0x12'));var authService=require(_0x3405('0x13'));var qs=require(_0x3405('0x14'));var as=require(_0x3405('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3405('0x16'))('api');var utils=require(_0x3405('0x17'));var config=require(_0x3405('0x18'));var db=require(_0x3405('0x19'))['db'];var integrations=require(_0x3405('0x1a'));var jayson=require(_0x3405('0x1b'));var client=jayson[_0x3405('0x1c')][_0x3405('0x1d')]({'port':0x232a});function checkPasswordPattern(_0x1f69ab,_0x1dfe4e,_0x1385dc){if(_0x1385dc){var _0x96afc1=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x96afc1['test'](_0x1dfe4e)){return _0x1f69ab;}else{throw new db[(_0x3405('0x1e'))][(_0x3405('0x1f'))](_0x3405('0x20'));}}else{return _0x1f69ab;}}function respondWithRpcPromise(_0x5741c7,_0x4c3144,_0x464673,_0x39582e){return new BPromise(function(_0x3641f3,_0x33bbf1){var _0x28a854=_0x39582e||client;return _0x28a854[_0x3405('0x21')](_0x5741c7,_0x464673)[_0x3405('0x22')](function(_0x1e2128){logger['info'](_0x3405('0x23'),_0x4c3144,_0x3405('0x24'));logger[_0x3405('0x25')](_0x3405('0x26'),_0x4c3144,_0x3405('0x24'),JSON[_0x3405('0x27')](_0x1e2128));if(_0x1e2128[_0x3405('0x28')]){if(_0x1e2128[_0x3405('0x28')][_0x3405('0x29')]===0x1f4){logger[_0x3405('0x28')](_0x3405('0x23'),_0x4c3144,_0x1e2128[_0x3405('0x28')][_0x3405('0x2a')]);return _0x33bbf1(_0x1e2128[_0x3405('0x28')][_0x3405('0x2a')]);}logger[_0x3405('0x28')]('FreshsalesAccount,\x20%s,\x20%s',_0x4c3144,_0x1e2128[_0x3405('0x28')][_0x3405('0x2a')]);return _0x3641f3(_0x1e2128[_0x3405('0x28')]['message']);}else{logger['info'](_0x3405('0x23'),_0x4c3144,_0x3405('0x24'));_0x3641f3(_0x1e2128[_0x3405('0x2b')][_0x3405('0x2a')]);}})[_0x3405('0x2c')](function(_0x4664e3){logger['error'](_0x3405('0x23'),_0x4c3144,_0x4664e3);_0x33bbf1(_0x4664e3);});});}function respondWithStatusCode(_0x444596,_0x433708){_0x433708=_0x433708||0xcc;return function(_0x3ddffb){if(_0x3ddffb){return _0x444596[_0x3405('0x2d')](_0x433708);}return _0x444596[_0x3405('0x2e')](_0x433708)[_0x3405('0x2f')]();};}function respondWithResult(_0x196b80,_0x501434){_0x501434=_0x501434||0xc8;return function(_0x18cb87){if(_0x18cb87){return _0x196b80[_0x3405('0x2e')](_0x501434)[_0x3405('0x30')](_0x18cb87);}};}function respondWithFilteredResult(_0x34bca1,_0x1afda3){return function(_0x247bf7){if(_0x247bf7){var _0x164324=_0x247bf7['count'],_0x4b3310=_0x1afda3[_0x3405('0x31')],_0x13902e=_0x1afda3[_0x3405('0x31')]+_0x1afda3[_0x3405('0x32')],_0xecba45;if(_0x13902e>=_0x164324){_0x13902e=_0x164324;_0xecba45=0xc8;}else{_0xecba45=0xce;}_0x34bca1['status'](_0xecba45);return _0x34bca1[_0x3405('0x33')](_0x3405('0x34'),_0x4b3310+'-'+_0x13902e+'/'+_0x164324)[_0x3405('0x30')](_0x247bf7);}return null;};}function patchUpdates(_0xee09d3){return function(_0x4ae54c){try{jsonpatch[_0x3405('0x35')](_0x4ae54c,_0xee09d3,!![]);}catch(_0x33643e){return BPromise[_0x3405('0x36')](_0x33643e);}return _0x4ae54c[_0x3405('0x37')]();};}function saveUpdates(_0x47be19,_0x29eaee){return function(_0x448cac){if(_0x448cac){return _0x448cac[_0x3405('0x38')](_0x47be19)[_0x3405('0x22')](function(_0x5c9e3d){return _0x5c9e3d;});}return null;};}function removeEntity(_0x55e90c,_0xca2fcd){return function(_0x4de837){if(_0x4de837){return _0x4de837[_0x3405('0x39')]()[_0x3405('0x22')](function(){_0x55e90c[_0x3405('0x2e')](0xcc)[_0x3405('0x2f')]();});}};}function handleEntityNotFound(_0x20c987,_0x491c49){return function(_0x2ec075){if(!_0x2ec075){_0x20c987[_0x3405('0x2d')](0x194);}return _0x2ec075;};}function handleError(_0x3ef8af,_0x4dc129){_0x4dc129=_0x4dc129||0x1f4;return function(_0x469f88){logger[_0x3405('0x28')](_0x469f88[_0x3405('0x3a')]);if(_0x469f88[_0x3405('0x3b')]){delete _0x469f88[_0x3405('0x3b')];}_0x3ef8af[_0x3405('0x2e')](_0x4dc129)[_0x3405('0x3c')](_0x469f88);};}exports['index']=function(_0x1b3e51,_0x4e5795){var _0x3c7ee1={},_0x41cecd={},_0xde6a8a={'count':0x0,'rows':[]};var _0x488997=_[_0x3405('0x3d')](db[_0x3405('0x3e')][_0x3405('0x3f')],function(_0x3a0318){return{'name':_0x3a0318[_0x3405('0x40')],'type':_0x3a0318['type'][_0x3405('0x41')]};});_0x41cecd['model']=_['map'](_0x488997,_0x3405('0x3b'));_0x41cecd['query']=_['keys'](_0x1b3e51[_0x3405('0x42')]);_0x41cecd[_0x3405('0x43')]=_[_0x3405('0x44')](_0x41cecd[_0x3405('0x45')],_0x41cecd[_0x3405('0x42')]);_0x3c7ee1[_0x3405('0x46')]=_[_0x3405('0x44')](_0x41cecd[_0x3405('0x45')],qs[_0x3405('0x47')](_0x1b3e51['query'][_0x3405('0x47')]));_0x3c7ee1[_0x3405('0x46')]=_0x3c7ee1[_0x3405('0x46')][_0x3405('0x48')]?_0x3c7ee1[_0x3405('0x46')]:_0x41cecd[_0x3405('0x45')];if(!_0x1b3e51[_0x3405('0x42')][_0x3405('0x49')](_0x3405('0x4a'))){_0x3c7ee1[_0x3405('0x32')]=qs['limit'](_0x1b3e51[_0x3405('0x42')][_0x3405('0x32')]);_0x3c7ee1[_0x3405('0x31')]=qs[_0x3405('0x31')](_0x1b3e51[_0x3405('0x42')][_0x3405('0x31')]);}_0x3c7ee1[_0x3405('0x4b')]=qs[_0x3405('0x4c')](_0x1b3e51[_0x3405('0x42')]['sort']);_0x3c7ee1[_0x3405('0x4d')]=qs[_0x3405('0x43')](_[_0x3405('0x4e')](_0x1b3e51[_0x3405('0x42')],_0x41cecd[_0x3405('0x43')]));if(_0x1b3e51[_0x3405('0x42')]['filter']){_0x3c7ee1['where']=_['merge'](_0x3c7ee1[_0x3405('0x4d')],{'$or':_['map'](_0x488997,function(_0x3e4434){if(_0x3e4434[_0x3405('0x4f')]!==_0x3405('0x50')){var _0x124dd1={};_0x124dd1[_0x3e4434[_0x3405('0x3b')]]={'$like':'%'+_0x1b3e51[_0x3405('0x42')][_0x3405('0x51')]+'%'};return _0x124dd1;}})});}_0x3c7ee1=_[_0x3405('0x52')]({},_0x3c7ee1,_0x1b3e51[_0x3405('0x53')]);var _0x44507b={'where':_0x3c7ee1[_0x3405('0x4d')]};return db['FreshsalesAccount'][_0x3405('0x54')](_0x44507b)[_0x3405('0x22')](function(_0x592314){_0xde6a8a[_0x3405('0x54')]=_0x592314;if(_0x1b3e51[_0x3405('0x42')][_0x3405('0x55')]){_0x3c7ee1[_0x3405('0x56')]=[{'all':!![]}];}return db[_0x3405('0x3e')]['findAll'](_0x3c7ee1);})[_0x3405('0x22')](function(_0x4de82f){_0xde6a8a[_0x3405('0x57')]=_0x4de82f;return _0xde6a8a;})[_0x3405('0x22')](respondWithFilteredResult(_0x4e5795,_0x3c7ee1))[_0x3405('0x2c')](handleError(_0x4e5795,null));};exports[_0x3405('0x58')]=function(_0x1cb587,_0x24cdec){var _0x1b7098={'raw':![],'where':{'id':_0x1cb587[_0x3405('0x59')]['id']}},_0x167652={};_0x167652[_0x3405('0x45')]=_[_0x3405('0x5a')](db[_0x3405('0x3e')][_0x3405('0x3f')]);_0x167652[_0x3405('0x42')]=_[_0x3405('0x5a')](_0x1cb587[_0x3405('0x42')]);_0x167652[_0x3405('0x43')]=_['intersection'](_0x167652[_0x3405('0x45')],_0x167652[_0x3405('0x42')]);_0x1b7098[_0x3405('0x46')]=_[_0x3405('0x44')](_0x167652[_0x3405('0x45')],qs[_0x3405('0x47')](_0x1cb587[_0x3405('0x42')][_0x3405('0x47')]));_0x1b7098[_0x3405('0x46')]=_0x1b7098[_0x3405('0x46')][_0x3405('0x48')]?_0x1b7098[_0x3405('0x46')]:_0x167652[_0x3405('0x45')];if(_0x1cb587[_0x3405('0x42')][_0x3405('0x55')]){_0x1b7098[_0x3405('0x56')]=[{'all':!![]}];}_0x1b7098=_[_0x3405('0x52')]({},_0x1b7098,_0x1cb587[_0x3405('0x53')]);return db[_0x3405('0x3e')][_0x3405('0x5b')](_0x1b7098)[_0x3405('0x22')](handleEntityNotFound(_0x24cdec,null))[_0x3405('0x22')](respondWithResult(_0x24cdec,null))['catch'](handleError(_0x24cdec,null));};exports[_0x3405('0x5c')]=function(_0x5de546,_0x136c15){return db[_0x3405('0x3e')][_0x3405('0x5c')](_0x5de546[_0x3405('0x5d')],{})[_0x3405('0x22')](respondWithResult(_0x136c15,0xc9))['catch'](handleError(_0x136c15,null));};exports[_0x3405('0x38')]=function(_0x5633a8,_0x28ae3f){if(_0x5633a8[_0x3405('0x5d')]['id']){delete _0x5633a8[_0x3405('0x5d')]['id'];}return db[_0x3405('0x3e')][_0x3405('0x5b')]({'where':{'id':_0x5633a8[_0x3405('0x59')]['id']}})[_0x3405('0x22')](handleEntityNotFound(_0x28ae3f,null))['then'](saveUpdates(_0x5633a8[_0x3405('0x5d')],null))[_0x3405('0x22')](respondWithResult(_0x28ae3f,null))[_0x3405('0x2c')](handleError(_0x28ae3f,null));};exports[_0x3405('0x39')]=function(_0x15f24f,_0x1d7017){return db[_0x3405('0x3e')]['find']({'where':{'id':_0x15f24f[_0x3405('0x59')]['id']}})[_0x3405('0x22')](handleEntityNotFound(_0x1d7017,null))[_0x3405('0x22')](removeEntity(_0x1d7017,null))[_0x3405('0x2c')](handleError(_0x1d7017,null));};exports[_0x3405('0x5e')]=function(_0x41d587,_0x343bf1,_0x515df5){var _0x4c45cb={};var _0xa0af29={};var _0x2483f1;var _0x2d201d;return db[_0x3405('0x3e')][_0x3405('0x5f')]({'where':{'id':_0x41d587[_0x3405('0x59')]['id']}})[_0x3405('0x22')](handleEntityNotFound(_0x343bf1,null))[_0x3405('0x22')](function(_0x40ba1c){if(_0x40ba1c){_0x2483f1=_0x40ba1c;_0xa0af29[_0x3405('0x45')]=_[_0x3405('0x5a')](db[_0x3405('0x60')][_0x3405('0x3f')]);_0xa0af29['query']=_[_0x3405('0x5a')](_0x41d587[_0x3405('0x42')]);_0xa0af29['filters']=_['intersection'](_0xa0af29[_0x3405('0x45')],_0xa0af29[_0x3405('0x42')]);_0x4c45cb[_0x3405('0x46')]=_['intersection'](_0xa0af29[_0x3405('0x45')],qs[_0x3405('0x47')](_0x41d587['query'][_0x3405('0x47')]));_0x4c45cb[_0x3405('0x46')]=_0x4c45cb[_0x3405('0x46')][_0x3405('0x48')]?_0x4c45cb[_0x3405('0x46')]:_0xa0af29[_0x3405('0x45')];_0x4c45cb[_0x3405('0x4b')]=qs['sort'](_0x41d587[_0x3405('0x42')]['sort']);_0x4c45cb[_0x3405('0x4d')]=qs[_0x3405('0x43')](_[_0x3405('0x4e')](_0x41d587['query'],_0xa0af29[_0x3405('0x43')]));if(_0x41d587[_0x3405('0x42')][_0x3405('0x51')]){_0x4c45cb[_0x3405('0x4d')]=_[_0x3405('0x52')](_0x4c45cb[_0x3405('0x4d')],{'$or':_[_0x3405('0x3d')](_0x4c45cb['attributes'],function(_0x20d9a7){var _0x320662={};_0x320662[_0x20d9a7]={'$like':'%'+_0x41d587[_0x3405('0x42')][_0x3405('0x51')]+'%'};return _0x320662;})});}_0x4c45cb=_[_0x3405('0x52')]({},_0x4c45cb,_0x41d587[_0x3405('0x53')]);return _0x2483f1[_0x3405('0x5e')](_0x4c45cb);}})[_0x3405('0x22')](function(_0x346649){if(_0x346649){_0x2d201d=_0x346649[_0x3405('0x48')];if(!_0x41d587[_0x3405('0x42')][_0x3405('0x49')]('nolimit')){_0x4c45cb[_0x3405('0x32')]=qs[_0x3405('0x32')](_0x41d587[_0x3405('0x42')][_0x3405('0x32')]);_0x4c45cb['offset']=qs[_0x3405('0x31')](_0x41d587[_0x3405('0x42')][_0x3405('0x31')]);}return _0x2483f1[_0x3405('0x5e')](_0x4c45cb);}})[_0x3405('0x22')](function(_0x5a6382){if(_0x5a6382){return _0x5a6382?{'count':_0x2d201d,'rows':_0x5a6382}:null;}})[_0x3405('0x22')](respondWithResult(_0x343bf1,null))[_0x3405('0x2c')](handleError(_0x343bf1,null));};exports[_0x3405('0x61')]=function(_0x13f11b,_0x29e590,_0x52ea10){if(_0x13f11b[_0x3405('0x5d')]['id']){delete _0x13f11b[_0x3405('0x5d')]['id'];}return db[_0x3405('0x3e')][_0x3405('0x5f')]({'where':{'id':_0x13f11b[_0x3405('0x59')]['id']}})[_0x3405('0x22')](handleEntityNotFound(_0x29e590,null))[_0x3405('0x22')](function(_0x4989d5){if(_0x4989d5){_0x13f11b[_0x3405('0x5d')][_0x3405('0x62')]=_0x4989d5['id'];_0x13f11b[_0x3405('0x5d')]['Subjects']=integrations[_0x3405('0x63')](_0x13f11b['body']['channel'],_0x13f11b[_0x3405('0x5d')]['type']);_0x13f11b[_0x3405('0x5d')][_0x3405('0x64')]=integrations['getDescriptions'](_0x13f11b[_0x3405('0x5d')][_0x3405('0x65')],_0x13f11b['body']['type']);return db[_0x3405('0x60')]['create'](_0x13f11b[_0x3405('0x5d')],{'include':[{'model':db['FreshsalesField'],'as':_0x3405('0x66')},{'model':db[_0x3405('0x67')],'as':_0x3405('0x64')}]});}return null;})[_0x3405('0x22')](respondWithResult(_0x29e590,null))[_0x3405('0x2c')](handleError(_0x29e590,null));};exports[_0x3405('0x68')]=function(_0x35df84,_0x106494,_0x419233){var _0x33df81='';var _0x4562bd='';return db[_0x3405('0x3e')][_0x3405('0x5f')]({'where':{'id':_0x35df84[_0x3405('0x59')]['id']},'attributes':['id',_0x3405('0x69'),_0x3405('0x6a'),'apiKey']})[_0x3405('0x22')](handleEntityNotFound(_0x106494,null))[_0x3405('0x22')](function(_0x263ef9){if(_0x263ef9){_0x4562bd=_0x263ef9['username'];_0x33df81=_0x263ef9[_0x3405('0x6a')];var _0x2727d8=_0x263ef9[_0x3405('0x6a')]['slice'](-0x1);if(_0x2727d8==='/'){_0x33df81=_0x33df81[_0x3405('0x6b')](0x0,_0x33df81[_0x3405('0x6c')](_0x2727d8));}return rp({'method':_0x3405('0x6d'),'uri':util[_0x3405('0x6e')]('%s%s',_0x33df81,_0x3405('0x6f')),'headers':{'Authorization':_0x3405('0x70')+_0x263ef9[_0x3405('0x71')]},'json':!![]});}})['then'](function(_0x245567){if(_0x245567){var _0x1e9149=_0x245567['users'];var _0x1ebbbb=![];var _0x1dda0e=null;for(_0x1dda0e=0x0;_0x1dda0e<_0x1e9149[_0x3405('0x48')];_0x1dda0e++){if(_0x1e9149[_0x1dda0e][_0x3405('0x72')]===_0x4562bd){_0x1ebbbb=!![];}}if(_0x1ebbbb){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x3405('0x73')});}}})['then'](respondWithResult(_0x106494,null))['catch'](function(_0x464040){var _0x178c3a=_0x35df84[_0x3405('0x42')][_0x3405('0x74')]?0x1f4:_0x464040[_0x3405('0x75')]||0x1f4;logger[_0x3405('0x28')]('getFields,\x20%s,\x20%s,\x20%s',_0x3405('0x68'),_0x178c3a,JSON[_0x3405('0x27')](_0x464040));delete _0x464040[_0x3405('0x3b')];if(_0x178c3a===0x191){_0x178c3a=0x190;}_0x106494[_0x3405('0x2e')](_0x178c3a)[_0x3405('0x3c')](_0x35df84[_0x3405('0x42')][_0x3405('0x74')]?{'message':_0x3405('0x76'),'statusCode':_0x464040[_0x3405('0x75')]}:_0x464040);});}; \ No newline at end of file +var _0x5458=['intersection','fields','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','show','length','find','create','body','params','destroy','getConfigurations','findOne','FreshsalesConfiguration','addConfiguration','AccountId','getSubjects','channel','FreshsalesField','Subjects','Descriptions','getFields','username','remoteUri','apiKey','slice','substring','lastIndexOf','GET','format','%s%s','/api/selector/owners','users','statusCode','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','jayson/promise','client','http','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','request\x20sent','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','FreshsalesAccount,\x20%s,\x20%s','result','catch','sendStatus','status','count','offset','limit','set','Content-Range','json','apply','reject','save','update','name','send','index','map','FreshsalesAccount','rawAttributes','fieldName','model','query','keys','attributes'];(function(_0x17ca3,_0x4daba9){var _0x3ee781=function(_0x3cf994){while(--_0x3cf994){_0x17ca3['push'](_0x17ca3['shift']());}};_0x3ee781(++_0x4daba9);}(_0x5458,0x10c));var _0x8545=function(_0x214f5d,_0x5d9652){_0x214f5d=_0x214f5d-0x0;var _0x98884e=_0x5458[_0x214f5d];return _0x98884e;};'use strict';var pdf=require(_0x8545('0x0'));var emlformat=require(_0x8545('0x1'));var rimraf=require(_0x8545('0x2'));var zipdir=require(_0x8545('0x3'));var jsonpatch=require(_0x8545('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x8545('0x5'));var Mustache=require(_0x8545('0x6'));var util=require(_0x8545('0x7'));var path=require(_0x8545('0x8'));var sox=require(_0x8545('0x9'));var csv=require('to-csv');var ejs=require(_0x8545('0xa'));var fs=require('fs');var _=require(_0x8545('0xb'));var squel=require(_0x8545('0xc'));var crypto=require(_0x8545('0xd'));var jsforce=require(_0x8545('0xe'));var deskjs=require(_0x8545('0xf'));var toCsv=require(_0x8545('0x10'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8545('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x8545('0x12'));var hardwareService=require(_0x8545('0x13'));var logger=require(_0x8545('0x14'))(_0x8545('0x15'));var utils=require('../../config/utils');var config=require(_0x8545('0x16'));var db=require(_0x8545('0x17'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0x8545('0x18'));var client=jayson[_0x8545('0x19')][_0x8545('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x1505ac,_0x23249d,_0x1ae0bb){if(_0x1ae0bb){var _0x3fe2e1=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3fe2e1[_0x8545('0x1b')](_0x23249d)){return _0x1505ac;}else{throw new db[(_0x8545('0x1c'))]['ValidationError'](_0x8545('0x1d'));}}else{return _0x1505ac;}}function respondWithRpcPromise(_0x3892e5,_0x2f489d,_0x144761,_0x2e9b1f){return new BPromise(function(_0x5ef03b,_0x2370a3){var _0x1426fc=_0x2e9b1f||client;return _0x1426fc[_0x8545('0x1e')](_0x3892e5,_0x144761)[_0x8545('0x1f')](function(_0x5398d8){logger[_0x8545('0x20')]('FreshsalesAccount,\x20%s,\x20%s',_0x2f489d,_0x8545('0x21'));logger['debug'](_0x8545('0x22'),_0x2f489d,'request\x20sent',JSON[_0x8545('0x23')](_0x5398d8));if(_0x5398d8[_0x8545('0x24')]){if(_0x5398d8[_0x8545('0x24')][_0x8545('0x25')]===0x1f4){logger['error']('FreshsalesAccount,\x20%s,\x20%s',_0x2f489d,_0x5398d8[_0x8545('0x24')][_0x8545('0x26')]);return _0x2370a3(_0x5398d8[_0x8545('0x24')][_0x8545('0x26')]);}logger[_0x8545('0x24')](_0x8545('0x27'),_0x2f489d,_0x5398d8[_0x8545('0x24')][_0x8545('0x26')]);return _0x5ef03b(_0x5398d8[_0x8545('0x24')][_0x8545('0x26')]);}else{logger[_0x8545('0x20')]('FreshsalesAccount,\x20%s,\x20%s',_0x2f489d,'request\x20sent');_0x5ef03b(_0x5398d8[_0x8545('0x28')][_0x8545('0x26')]);}})[_0x8545('0x29')](function(_0x1feaf2){logger[_0x8545('0x24')]('FreshsalesAccount,\x20%s,\x20%s',_0x2f489d,_0x1feaf2);_0x2370a3(_0x1feaf2);});});}function respondWithStatusCode(_0x495f1a,_0x3d3629){_0x3d3629=_0x3d3629||0xcc;return function(_0x30622a){if(_0x30622a){return _0x495f1a[_0x8545('0x2a')](_0x3d3629);}return _0x495f1a[_0x8545('0x2b')](_0x3d3629)['end']();};}function respondWithResult(_0x32e53d,_0x473341){_0x473341=_0x473341||0xc8;return function(_0x5bbf6a){if(_0x5bbf6a){return _0x32e53d[_0x8545('0x2b')](_0x473341)['json'](_0x5bbf6a);}};}function respondWithFilteredResult(_0x23166c,_0x154166){return function(_0x2d4c56){if(_0x2d4c56){var _0x595c2b=_0x2d4c56[_0x8545('0x2c')],_0xef5f8d=_0x154166[_0x8545('0x2d')],_0x2c4909=_0x154166[_0x8545('0x2d')]+_0x154166[_0x8545('0x2e')],_0x41c6b3;if(_0x2c4909>=_0x595c2b){_0x2c4909=_0x595c2b;_0x41c6b3=0xc8;}else{_0x41c6b3=0xce;}_0x23166c[_0x8545('0x2b')](_0x41c6b3);return _0x23166c[_0x8545('0x2f')](_0x8545('0x30'),_0xef5f8d+'-'+_0x2c4909+'/'+_0x595c2b)[_0x8545('0x31')](_0x2d4c56);}return null;};}function patchUpdates(_0x1a9c36){return function(_0x39175c){try{jsonpatch[_0x8545('0x32')](_0x39175c,_0x1a9c36,!![]);}catch(_0x143268){return BPromise[_0x8545('0x33')](_0x143268);}return _0x39175c[_0x8545('0x34')]();};}function saveUpdates(_0x263690,_0x53dc6e){return function(_0x4284c7){if(_0x4284c7){return _0x4284c7[_0x8545('0x35')](_0x263690)[_0x8545('0x1f')](function(_0x183630){return _0x183630;});}return null;};}function removeEntity(_0x285dc1,_0x4ee7cb){return function(_0x3b8a9c){if(_0x3b8a9c){return _0x3b8a9c['destroy']()[_0x8545('0x1f')](function(){_0x285dc1[_0x8545('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x332969,_0x261079){return function(_0x1a76b6){if(!_0x1a76b6){_0x332969[_0x8545('0x2a')](0x194);}return _0x1a76b6;};}function handleError(_0x58b444,_0x5ac7e2){_0x5ac7e2=_0x5ac7e2||0x1f4;return function(_0x3acaab){logger[_0x8545('0x24')](_0x3acaab['stack']);if(_0x3acaab[_0x8545('0x36')]){delete _0x3acaab[_0x8545('0x36')];}_0x58b444[_0x8545('0x2b')](_0x5ac7e2)[_0x8545('0x37')](_0x3acaab);};}exports[_0x8545('0x38')]=function(_0x199e4c,_0x4f7df6){var _0x20e603={},_0x4977e1={},_0xfb7eba={'count':0x0,'rows':[]};var _0x499d3f=_[_0x8545('0x39')](db[_0x8545('0x3a')][_0x8545('0x3b')],function(_0x28a3b3){return{'name':_0x28a3b3[_0x8545('0x3c')],'type':_0x28a3b3['type']['key']};});_0x4977e1[_0x8545('0x3d')]=_[_0x8545('0x39')](_0x499d3f,_0x8545('0x36'));_0x4977e1[_0x8545('0x3e')]=_[_0x8545('0x3f')](_0x199e4c[_0x8545('0x3e')]);_0x4977e1['filters']=_['intersection'](_0x4977e1[_0x8545('0x3d')],_0x4977e1[_0x8545('0x3e')]);_0x20e603[_0x8545('0x40')]=_[_0x8545('0x41')](_0x4977e1[_0x8545('0x3d')],qs[_0x8545('0x42')](_0x199e4c[_0x8545('0x3e')][_0x8545('0x42')]));_0x20e603['attributes']=_0x20e603[_0x8545('0x40')]['length']?_0x20e603[_0x8545('0x40')]:_0x4977e1[_0x8545('0x3d')];if(!_0x199e4c[_0x8545('0x3e')]['hasOwnProperty'](_0x8545('0x43'))){_0x20e603[_0x8545('0x2e')]=qs[_0x8545('0x2e')](_0x199e4c['query']['limit']);_0x20e603['offset']=qs[_0x8545('0x2d')](_0x199e4c['query'][_0x8545('0x2d')]);}_0x20e603[_0x8545('0x44')]=qs[_0x8545('0x45')](_0x199e4c[_0x8545('0x3e')][_0x8545('0x45')]);_0x20e603[_0x8545('0x46')]=qs[_0x8545('0x47')](_[_0x8545('0x48')](_0x199e4c[_0x8545('0x3e')],_0x4977e1[_0x8545('0x47')]));if(_0x199e4c[_0x8545('0x3e')][_0x8545('0x49')]){_0x20e603[_0x8545('0x46')]=_[_0x8545('0x4a')](_0x20e603['where'],{'$or':_[_0x8545('0x39')](_0x499d3f,function(_0x4a1f93){if(_0x4a1f93[_0x8545('0x4b')]!==_0x8545('0x4c')){var _0x429848={};_0x429848[_0x4a1f93[_0x8545('0x36')]]={'$like':'%'+_0x199e4c['query']['filter']+'%'};return _0x429848;}})});}_0x20e603=_[_0x8545('0x4a')]({},_0x20e603,_0x199e4c[_0x8545('0x4d')]);var _0x4cbcc1={'where':_0x20e603['where']};return db[_0x8545('0x3a')][_0x8545('0x2c')](_0x4cbcc1)[_0x8545('0x1f')](function(_0x22d967){_0xfb7eba[_0x8545('0x2c')]=_0x22d967;if(_0x199e4c['query'][_0x8545('0x4e')]){_0x20e603[_0x8545('0x4f')]=[{'all':!![]}];}return db[_0x8545('0x3a')][_0x8545('0x50')](_0x20e603);})['then'](function(_0x2cce2a){_0xfb7eba['rows']=_0x2cce2a;return _0xfb7eba;})[_0x8545('0x1f')](respondWithFilteredResult(_0x4f7df6,_0x20e603))['catch'](handleError(_0x4f7df6,null));};exports[_0x8545('0x51')]=function(_0x1a47ff,_0x2ae20e){var _0x44bf52={'raw':![],'where':{'id':_0x1a47ff['params']['id']}},_0x900a3={};_0x900a3[_0x8545('0x3d')]=_[_0x8545('0x3f')](db[_0x8545('0x3a')][_0x8545('0x3b')]);_0x900a3[_0x8545('0x3e')]=_[_0x8545('0x3f')](_0x1a47ff[_0x8545('0x3e')]);_0x900a3[_0x8545('0x47')]=_[_0x8545('0x41')](_0x900a3['model'],_0x900a3[_0x8545('0x3e')]);_0x44bf52[_0x8545('0x40')]=_[_0x8545('0x41')](_0x900a3['model'],qs['fields'](_0x1a47ff[_0x8545('0x3e')][_0x8545('0x42')]));_0x44bf52[_0x8545('0x40')]=_0x44bf52[_0x8545('0x40')][_0x8545('0x52')]?_0x44bf52[_0x8545('0x40')]:_0x900a3[_0x8545('0x3d')];if(_0x1a47ff[_0x8545('0x3e')][_0x8545('0x4e')]){_0x44bf52['include']=[{'all':!![]}];}_0x44bf52=_[_0x8545('0x4a')]({},_0x44bf52,_0x1a47ff[_0x8545('0x4d')]);return db['FreshsalesAccount'][_0x8545('0x53')](_0x44bf52)['then'](handleEntityNotFound(_0x2ae20e,null))[_0x8545('0x1f')](respondWithResult(_0x2ae20e,null))[_0x8545('0x29')](handleError(_0x2ae20e,null));};exports[_0x8545('0x54')]=function(_0x2b840b,_0x4b9cd3){return db[_0x8545('0x3a')][_0x8545('0x54')](_0x2b840b['body'],{})[_0x8545('0x1f')](respondWithResult(_0x4b9cd3,0xc9))[_0x8545('0x29')](handleError(_0x4b9cd3,null));};exports['update']=function(_0x31e706,_0x46d7a0){if(_0x31e706[_0x8545('0x55')]['id']){delete _0x31e706['body']['id'];}return db[_0x8545('0x3a')]['find']({'where':{'id':_0x31e706[_0x8545('0x56')]['id']}})[_0x8545('0x1f')](handleEntityNotFound(_0x46d7a0,null))['then'](saveUpdates(_0x31e706[_0x8545('0x55')],null))['then'](respondWithResult(_0x46d7a0,null))[_0x8545('0x29')](handleError(_0x46d7a0,null));};exports[_0x8545('0x57')]=function(_0x4216f0,_0x59e279){return db[_0x8545('0x3a')][_0x8545('0x53')]({'where':{'id':_0x4216f0[_0x8545('0x56')]['id']}})[_0x8545('0x1f')](handleEntityNotFound(_0x59e279,null))['then'](removeEntity(_0x59e279,null))['catch'](handleError(_0x59e279,null));};exports[_0x8545('0x58')]=function(_0x40ec18,_0x22cf34,_0x28415f){var _0x2d0bca={};var _0x5ce6d4={};var _0x2d217a;var _0xc11d0d;return db['FreshsalesAccount'][_0x8545('0x59')]({'where':{'id':_0x40ec18[_0x8545('0x56')]['id']}})[_0x8545('0x1f')](handleEntityNotFound(_0x22cf34,null))['then'](function(_0x4c5cf6){if(_0x4c5cf6){_0x2d217a=_0x4c5cf6;_0x5ce6d4['model']=_[_0x8545('0x3f')](db[_0x8545('0x5a')][_0x8545('0x3b')]);_0x5ce6d4['query']=_['keys'](_0x40ec18['query']);_0x5ce6d4['filters']=_[_0x8545('0x41')](_0x5ce6d4[_0x8545('0x3d')],_0x5ce6d4[_0x8545('0x3e')]);_0x2d0bca[_0x8545('0x40')]=_['intersection'](_0x5ce6d4[_0x8545('0x3d')],qs['fields'](_0x40ec18[_0x8545('0x3e')][_0x8545('0x42')]));_0x2d0bca[_0x8545('0x40')]=_0x2d0bca[_0x8545('0x40')][_0x8545('0x52')]?_0x2d0bca[_0x8545('0x40')]:_0x5ce6d4[_0x8545('0x3d')];_0x2d0bca[_0x8545('0x44')]=qs[_0x8545('0x45')](_0x40ec18['query'][_0x8545('0x45')]);_0x2d0bca[_0x8545('0x46')]=qs[_0x8545('0x47')](_[_0x8545('0x48')](_0x40ec18['query'],_0x5ce6d4['filters']));if(_0x40ec18['query'][_0x8545('0x49')]){_0x2d0bca['where']=_[_0x8545('0x4a')](_0x2d0bca[_0x8545('0x46')],{'$or':_[_0x8545('0x39')](_0x2d0bca['attributes'],function(_0x41658f){var _0x50e12f={};_0x50e12f[_0x41658f]={'$like':'%'+_0x40ec18[_0x8545('0x3e')][_0x8545('0x49')]+'%'};return _0x50e12f;})});}_0x2d0bca=_[_0x8545('0x4a')]({},_0x2d0bca,_0x40ec18[_0x8545('0x4d')]);return _0x2d217a[_0x8545('0x58')](_0x2d0bca);}})[_0x8545('0x1f')](function(_0x327d30){if(_0x327d30){_0xc11d0d=_0x327d30[_0x8545('0x52')];if(!_0x40ec18[_0x8545('0x3e')]['hasOwnProperty']('nolimit')){_0x2d0bca[_0x8545('0x2e')]=qs[_0x8545('0x2e')](_0x40ec18[_0x8545('0x3e')]['limit']);_0x2d0bca[_0x8545('0x2d')]=qs[_0x8545('0x2d')](_0x40ec18['query'][_0x8545('0x2d')]);}return _0x2d217a['getConfigurations'](_0x2d0bca);}})['then'](function(_0x589c63){if(_0x589c63){return _0x589c63?{'count':_0xc11d0d,'rows':_0x589c63}:null;}})[_0x8545('0x1f')](respondWithResult(_0x22cf34,null))['catch'](handleError(_0x22cf34,null));};exports[_0x8545('0x5b')]=function(_0x1cc03d,_0x13e40f,_0x48aef8){if(_0x1cc03d[_0x8545('0x55')]['id']){delete _0x1cc03d[_0x8545('0x55')]['id'];}return db['FreshsalesAccount'][_0x8545('0x59')]({'where':{'id':_0x1cc03d[_0x8545('0x56')]['id']}})['then'](handleEntityNotFound(_0x13e40f,null))[_0x8545('0x1f')](function(_0x2285c2){if(_0x2285c2){_0x1cc03d['body'][_0x8545('0x5c')]=_0x2285c2['id'];_0x1cc03d['body']['Subjects']=integrations[_0x8545('0x5d')](_0x1cc03d[_0x8545('0x55')]['channel'],_0x1cc03d[_0x8545('0x55')]['type']);_0x1cc03d[_0x8545('0x55')]['Descriptions']=integrations['getDescriptions'](_0x1cc03d['body'][_0x8545('0x5e')],_0x1cc03d['body'][_0x8545('0x4b')]);return db['FreshsalesConfiguration'][_0x8545('0x54')](_0x1cc03d[_0x8545('0x55')],{'include':[{'model':db[_0x8545('0x5f')],'as':_0x8545('0x60')},{'model':db[_0x8545('0x5f')],'as':_0x8545('0x61')}]});}return null;})[_0x8545('0x1f')](respondWithResult(_0x13e40f,null))['catch'](handleError(_0x13e40f,null));};exports[_0x8545('0x62')]=function(_0x54ca48,_0x4a36a4,_0x3a6521){var _0x24b28d='';var _0x829d1a='';return db['FreshsalesAccount'][_0x8545('0x59')]({'where':{'id':_0x54ca48[_0x8545('0x56')]['id']},'attributes':['id',_0x8545('0x63'),_0x8545('0x64'),_0x8545('0x65')]})[_0x8545('0x1f')](handleEntityNotFound(_0x4a36a4,null))[_0x8545('0x1f')](function(_0x2f45a4){if(_0x2f45a4){_0x829d1a=_0x2f45a4[_0x8545('0x63')];_0x24b28d=_0x2f45a4['remoteUri'];var _0x444a1f=_0x2f45a4[_0x8545('0x64')][_0x8545('0x66')](-0x1);if(_0x444a1f==='/'){_0x24b28d=_0x24b28d[_0x8545('0x67')](0x0,_0x24b28d[_0x8545('0x68')](_0x444a1f));}return rp({'method':_0x8545('0x69'),'uri':util[_0x8545('0x6a')](_0x8545('0x6b'),_0x24b28d,_0x8545('0x6c')),'headers':{'Authorization':'Token\x20token='+_0x2f45a4[_0x8545('0x65')]},'json':!![]});}})['then'](function(_0x1f8a57){if(_0x1f8a57){var _0x15d997=_0x1f8a57[_0x8545('0x6d')];var _0xf01d0=![];var _0x3f91e0=null;for(_0x3f91e0=0x0;_0x3f91e0<_0x15d997[_0x8545('0x52')];_0x3f91e0++){if(_0x15d997[_0x3f91e0]['email']===_0x829d1a){_0xf01d0=!![];}}if(_0xf01d0){return!![];}else{throw new Error({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}})[_0x8545('0x1f')](respondWithResult(_0x4a36a4,null))[_0x8545('0x29')](function(_0x109a8d){var _0x8436b9=_0x54ca48[_0x8545('0x3e')][_0x8545('0x1b')]?0x1f4:_0x109a8d[_0x8545('0x6e')]||0x1f4;logger[_0x8545('0x24')]('getFields,\x20%s,\x20%s,\x20%s',_0x8545('0x62'),_0x8436b9,JSON['stringify'](_0x109a8d));delete _0x109a8d[_0x8545('0x36')];if(_0x8436b9===0x191){_0x8436b9=0x190;}_0x4a36a4[_0x8545('0x2b')](_0x8436b9)[_0x8545('0x37')](_0x54ca48[_0x8545('0x3e')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x109a8d[_0x8545('0x6e')]}:_0x109a8d);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index 872b21a..b3c6fdb 100644 --- a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js +++ b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2fcb=['FreshsalesAccount','int_freshsales_accounts','../../config/logger','bluebird','request-promise','rimraf','./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports','define'];(function(_0x26e8c5,_0x59b90c){var _0x362920=function(_0x47bb28){while(--_0x47bb28){_0x26e8c5['push'](_0x26e8c5['shift']());}};_0x362920(++_0x59b90c);}(_0x2fcb,0x98));var _0xb2fc=function(_0x21b69f,_0x1c4d58){_0x21b69f=_0x21b69f-0x0;var _0x4dbe13=_0x2fcb[_0x21b69f];return _0x4dbe13;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xb2fc('0x0'))('api');var moment=require('moment');var BPromise=require(_0xb2fc('0x1'));var rp=require(_0xb2fc('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb2fc('0x3'));var config=require('../../config/environment');var attributes=require(_0xb2fc('0x4'));var integrations=require(_0xb2fc('0x5'));module[_0xb2fc('0x6')]=function(_0x26db8a,_0x36e952){return _0x26db8a[_0xb2fc('0x7')](_0xb2fc('0x8'),attributes,{'tableName':_0xb2fc('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x67a6=['define','FreshsalesAccount','int_freshsales_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports'];(function(_0x125e91,_0x53089c){var _0x180296=function(_0x48d681){while(--_0x48d681){_0x125e91['push'](_0x125e91['shift']());}};_0x180296(++_0x53089c);}(_0x67a6,0x137));var _0x667a=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0x67a6[_0x43d11d];return _0x38cd08;};'use strict';var _=require(_0x667a('0x0'));var util=require(_0x667a('0x1'));var logger=require(_0x667a('0x2'))(_0x667a('0x3'));var moment=require(_0x667a('0x4'));var BPromise=require(_0x667a('0x5'));var rp=require(_0x667a('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x667a('0x7'));var attributes=require(_0x667a('0x8'));var integrations=require(_0x667a('0x9'));module[_0x667a('0xa')]=function(_0x2dfbba,_0x69cd32){return _0x2dfbba[_0x667a('0xb')](_0x667a('0xc'),attributes,{'tableName':_0x667a('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js index 83faa55..d828f9f 100644 --- a/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js +++ b/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc7da=['http','request','then','info','FreshsalesAccount,\x20%s,\x20%s','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','raw','where','attributes','limit','map','model','include','ShowFreshsalesAccount','find','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x2950ba,_0x4a92b8){var _0xa7baac=function(_0x27eab9){while(--_0x27eab9){_0x2950ba['push'](_0x2950ba['shift']());}};_0xa7baac(++_0x4a92b8);}(_0xc7da,0xf2));var _0xac7d=function(_0x150841,_0x364f68){_0x150841=_0x150841-0x0;var _0x4291b5=_0xc7da[_0x150841];return _0x4291b5;};'use strict';var _=require(_0xac7d('0x0'));var util=require(_0xac7d('0x1'));var moment=require(_0xac7d('0x2'));var BPromise=require('bluebird');var rs=require(_0xac7d('0x3'));var fs=require('fs');var Redis=require(_0xac7d('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xac7d('0x5'));var logger=require(_0xac7d('0x6'))('rpc');var config=require(_0xac7d('0x7'));var jayson=require(_0xac7d('0x8'));var client=jayson[_0xac7d('0x9')][_0xac7d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x268265,_0x153ce5,_0x48ca59){return new BPromise(function(_0x44eb2b,_0x457e2d){return client[_0xac7d('0xb')](_0x268265,_0x48ca59)[_0xac7d('0xc')](function(_0x217811){logger[_0xac7d('0xd')](_0xac7d('0xe'),_0x153ce5,'request\x20sent');logger[_0xac7d('0xf')](_0xac7d('0x10'),_0x153ce5,_0xac7d('0x11'),JSON['stringify'](_0x217811));if(_0x217811[_0xac7d('0x12')]){if(_0x217811[_0xac7d('0x12')][_0xac7d('0x13')]===0x1f4){logger[_0xac7d('0x12')]('FreshsalesAccount,\x20%s,\x20%s',_0x153ce5,_0x217811[_0xac7d('0x12')][_0xac7d('0x14')]);return _0x457e2d(_0x217811[_0xac7d('0x12')][_0xac7d('0x14')]);}logger[_0xac7d('0x12')]('FreshsalesAccount,\x20%s,\x20%s',_0x153ce5,_0x217811[_0xac7d('0x12')]['message']);return _0x44eb2b(_0x217811[_0xac7d('0x12')][_0xac7d('0x14')]);}else{logger[_0xac7d('0xd')](_0xac7d('0xe'),_0x153ce5,'request\x20sent');_0x44eb2b(_0x217811[_0xac7d('0x15')][_0xac7d('0x14')]);}})[_0xac7d('0x16')](function(_0x12813a){logger[_0xac7d('0x12')]('FreshsalesAccount,\x20%s,\x20%s',_0x153ce5,_0x12813a);_0x457e2d(_0x12813a);});});}exports[_0xac7d('0x17')]=function(_0x3cb12d){var _0x563634=this;return new Promise(function(_0x2e4790,_0x2d2494){return db[_0xac7d('0x18')][_0xac7d('0x19')]({'raw':_0x3cb12d['options']?_0x3cb12d[_0xac7d('0x1a')][_0xac7d('0x1b')]===undefined?!![]:![]:!![],'where':_0x3cb12d[_0xac7d('0x1a')]?_0x3cb12d['options'][_0xac7d('0x1c')]||null:null,'attributes':_0x3cb12d['options']?_0x3cb12d[_0xac7d('0x1a')][_0xac7d('0x1d')]||null:null,'limit':_0x3cb12d[_0xac7d('0x1a')]?_0x3cb12d[_0xac7d('0x1a')][_0xac7d('0x1e')]||null:null,'include':_0x3cb12d[_0xac7d('0x1a')]?_0x3cb12d['options']['include']?_[_0xac7d('0x1f')](_0x3cb12d[_0xac7d('0x1a')]['include'],function(_0x4282d7){return{'model':db[_0x4282d7[_0xac7d('0x20')]],'as':_0x4282d7['as'],'attributes':_0x4282d7[_0xac7d('0x1d')],'include':_0x4282d7[_0xac7d('0x21')]?_[_0xac7d('0x1f')](_0x4282d7[_0xac7d('0x21')],function(_0x200562){return{'model':db[_0x200562[_0xac7d('0x20')]],'as':_0x200562['as'],'attributes':_0x200562[_0xac7d('0x1d')],'include':_0x200562[_0xac7d('0x21')]?_['map'](_0x200562[_0xac7d('0x21')],function(_0x3216cb){return{'model':db[_0x3216cb[_0xac7d('0x20')]],'as':_0x3216cb['as'],'attributes':_0x3216cb[_0xac7d('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x579b99){logger['info'](_0xac7d('0x17'),_0x3cb12d);logger[_0xac7d('0xf')](_0xac7d('0x17'),_0x3cb12d,JSON['stringify'](_0x579b99));_0x2e4790(_0x579b99);})[_0xac7d('0x16')](function(_0x506b88){logger['error']('GetFreshsalesAccount',_0x506b88['message'],_0x3cb12d);_0x2d2494(_0x563634['error'](0x1f4,_0x506b88[_0xac7d('0x14')]));});});};exports[_0xac7d('0x22')]=function(_0x35be2f){var _0x31a082=this;return new Promise(function(_0x15a950,_0x5c3c15){return db['FreshsalesAccount'][_0xac7d('0x23')]({'raw':_0x35be2f[_0xac7d('0x1a')]?_0x35be2f[_0xac7d('0x1a')][_0xac7d('0x1b')]===undefined?!![]:![]:!![],'where':_0x35be2f[_0xac7d('0x1a')]?_0x35be2f[_0xac7d('0x1a')][_0xac7d('0x1c')]||null:null,'attributes':_0x35be2f[_0xac7d('0x1a')]?_0x35be2f[_0xac7d('0x1a')][_0xac7d('0x1d')]||null:null,'include':_0x35be2f[_0xac7d('0x1a')]?_0x35be2f[_0xac7d('0x1a')][_0xac7d('0x21')]?_[_0xac7d('0x1f')](_0x35be2f[_0xac7d('0x1a')][_0xac7d('0x21')],function(_0x4ee968){return{'model':db[_0x4ee968[_0xac7d('0x20')]],'as':_0x4ee968['as'],'attributes':_0x4ee968[_0xac7d('0x1d')],'include':_0x4ee968[_0xac7d('0x21')]?_[_0xac7d('0x1f')](_0x4ee968[_0xac7d('0x21')],function(_0x5690e4){return{'model':db[_0x5690e4[_0xac7d('0x20')]],'as':_0x5690e4['as'],'attributes':_0x5690e4['attributes'],'include':_0x5690e4['include']?_[_0xac7d('0x1f')](_0x5690e4[_0xac7d('0x21')],function(_0x2adca1){return{'model':db[_0x2adca1[_0xac7d('0x20')]],'as':_0x2adca1['as'],'attributes':_0x2adca1[_0xac7d('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xac7d('0xc')](function(_0x330fb0){logger[_0xac7d('0xd')](_0xac7d('0x22'),_0x35be2f);logger[_0xac7d('0xf')](_0xac7d('0x22'),_0x35be2f,JSON['stringify'](_0x330fb0));_0x15a950(_0x330fb0);})['catch'](function(_0x382c19){logger['error'](_0xac7d('0x22'),_0x382c19[_0xac7d('0x14')],_0x35be2f);_0x5c3c15(_0x31a082[_0xac7d('0x12')](0x1f4,_0x382c19[_0xac7d('0x14')]));});});}; \ No newline at end of file +var _0xdab3=['http','request','then','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','where','attributes','limit','map','include','model','ShowFreshsalesAccount','find','raw','debug','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client'];(function(_0x5956d6,_0x48ffb5){var _0x257c47=function(_0x3d9ec7){while(--_0x3d9ec7){_0x5956d6['push'](_0x5956d6['shift']());}};_0x257c47(++_0x48ffb5);}(_0xdab3,0xeb));var _0x3dab=function(_0x26f5e6,_0x4c5936){_0x26f5e6=_0x26f5e6-0x0;var _0x474589=_0xdab3[_0x26f5e6];return _0x474589;};'use strict';var _=require(_0x3dab('0x0'));var util=require(_0x3dab('0x1'));var moment=require('moment');var BPromise=require(_0x3dab('0x2'));var rs=require(_0x3dab('0x3'));var fs=require('fs');var Redis=require(_0x3dab('0x4'));var db=require(_0x3dab('0x5'))['db'];var utils=require(_0x3dab('0x6'));var logger=require(_0x3dab('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x3dab('0x8'));var client=jayson[_0x3dab('0x9')][_0x3dab('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x415608,_0x3bdacb,_0x2d6b5c){return new BPromise(function(_0x5ae18c,_0x46a6d7){return client[_0x3dab('0xb')](_0x415608,_0x2d6b5c)[_0x3dab('0xc')](function(_0x2ab58a){logger[_0x3dab('0xd')](_0x3dab('0xe'),_0x3bdacb,_0x3dab('0xf'));logger['debug'](_0x3dab('0x10'),_0x3bdacb,_0x3dab('0xf'),JSON[_0x3dab('0x11')](_0x2ab58a));if(_0x2ab58a[_0x3dab('0x12')]){if(_0x2ab58a[_0x3dab('0x12')]['code']===0x1f4){logger['error'](_0x3dab('0xe'),_0x3bdacb,_0x2ab58a[_0x3dab('0x12')][_0x3dab('0x13')]);return _0x46a6d7(_0x2ab58a[_0x3dab('0x12')][_0x3dab('0x13')]);}logger[_0x3dab('0x12')](_0x3dab('0xe'),_0x3bdacb,_0x2ab58a[_0x3dab('0x12')]['message']);return _0x5ae18c(_0x2ab58a[_0x3dab('0x12')][_0x3dab('0x13')]);}else{logger[_0x3dab('0xd')](_0x3dab('0xe'),_0x3bdacb,_0x3dab('0xf'));_0x5ae18c(_0x2ab58a['result']['message']);}})[_0x3dab('0x14')](function(_0x2e9933){logger[_0x3dab('0x12')](_0x3dab('0xe'),_0x3bdacb,_0x2e9933);_0x46a6d7(_0x2e9933);});});}exports[_0x3dab('0x15')]=function(_0x4f71e1){var _0x83a01c=this;return new Promise(function(_0x2cca19,_0x578c5e){return db[_0x3dab('0x16')][_0x3dab('0x17')]({'raw':_0x4f71e1[_0x3dab('0x18')]?_0x4f71e1[_0x3dab('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x4f71e1[_0x3dab('0x18')]?_0x4f71e1[_0x3dab('0x18')][_0x3dab('0x19')]||null:null,'attributes':_0x4f71e1[_0x3dab('0x18')]?_0x4f71e1[_0x3dab('0x18')][_0x3dab('0x1a')]||null:null,'limit':_0x4f71e1[_0x3dab('0x18')]?_0x4f71e1[_0x3dab('0x18')][_0x3dab('0x1b')]||null:null,'include':_0x4f71e1['options']?_0x4f71e1[_0x3dab('0x18')]['include']?_[_0x3dab('0x1c')](_0x4f71e1[_0x3dab('0x18')][_0x3dab('0x1d')],function(_0x227c86){return{'model':db[_0x227c86[_0x3dab('0x1e')]],'as':_0x227c86['as'],'attributes':_0x227c86[_0x3dab('0x1a')],'include':_0x227c86['include']?_['map'](_0x227c86[_0x3dab('0x1d')],function(_0x10f848){return{'model':db[_0x10f848['model']],'as':_0x10f848['as'],'attributes':_0x10f848[_0x3dab('0x1a')],'include':_0x10f848[_0x3dab('0x1d')]?_[_0x3dab('0x1c')](_0x10f848[_0x3dab('0x1d')],function(_0x5acc7b){return{'model':db[_0x5acc7b[_0x3dab('0x1e')]],'as':_0x5acc7b['as'],'attributes':_0x5acc7b['attributes']};}):[]};}):[]};}):[]:[]})[_0x3dab('0xc')](function(_0x1ed38d){logger[_0x3dab('0xd')](_0x3dab('0x15'),_0x4f71e1);logger['debug']('GetFreshsalesAccount',_0x4f71e1,JSON[_0x3dab('0x11')](_0x1ed38d));_0x2cca19(_0x1ed38d);})['catch'](function(_0x483bce){logger['error']('GetFreshsalesAccount',_0x483bce[_0x3dab('0x13')],_0x4f71e1);_0x578c5e(_0x83a01c[_0x3dab('0x12')](0x1f4,_0x483bce[_0x3dab('0x13')]));});});};exports[_0x3dab('0x1f')]=function(_0x2088cc){var _0x3f612a=this;return new Promise(function(_0xf2c487,_0x9d2420){return db[_0x3dab('0x16')][_0x3dab('0x20')]({'raw':_0x2088cc[_0x3dab('0x18')]?_0x2088cc[_0x3dab('0x18')][_0x3dab('0x21')]===undefined?!![]:![]:!![],'where':_0x2088cc[_0x3dab('0x18')]?_0x2088cc[_0x3dab('0x18')][_0x3dab('0x19')]||null:null,'attributes':_0x2088cc[_0x3dab('0x18')]?_0x2088cc[_0x3dab('0x18')][_0x3dab('0x1a')]||null:null,'include':_0x2088cc[_0x3dab('0x18')]?_0x2088cc['options']['include']?_[_0x3dab('0x1c')](_0x2088cc['options'][_0x3dab('0x1d')],function(_0x457d80){return{'model':db[_0x457d80['model']],'as':_0x457d80['as'],'attributes':_0x457d80[_0x3dab('0x1a')],'include':_0x457d80[_0x3dab('0x1d')]?_[_0x3dab('0x1c')](_0x457d80[_0x3dab('0x1d')],function(_0x5430e3){return{'model':db[_0x5430e3['model']],'as':_0x5430e3['as'],'attributes':_0x5430e3[_0x3dab('0x1a')],'include':_0x5430e3['include']?_[_0x3dab('0x1c')](_0x5430e3[_0x3dab('0x1d')],function(_0x414dba){return{'model':db[_0x414dba['model']],'as':_0x414dba['as'],'attributes':_0x414dba['attributes']};}):[]};}):[]};}):[]:[]})[_0x3dab('0xc')](function(_0x20ab66){logger[_0x3dab('0xd')]('ShowFreshsalesAccount',_0x2088cc);logger[_0x3dab('0x22')](_0x3dab('0x1f'),_0x2088cc,JSON[_0x3dab('0x11')](_0x20ab66));_0xf2c487(_0x20ab66);})[_0x3dab('0x14')](function(_0xc2e1f7){logger['error'](_0x3dab('0x1f'),_0xc2e1f7[_0x3dab('0x13')],_0x2088cc);_0x9d2420(_0x3f612a[_0x3dab('0x12')](0x1f4,_0xc2e1f7[_0x3dab('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 7dfa4b4..b855552 100644 --- a/server/api/intFreshsalesConfiguration/index.js +++ b/server/api/intFreshsalesConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd44d=['isAuthenticated','/:id','show','/:id/subjects','getSubjects','getFields','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','get'];(function(_0x1c0f41,_0x26d95d){var _0x369a9f=function(_0x251234){while(--_0x251234){_0x1c0f41['push'](_0x1c0f41['shift']());}};_0x369a9f(++_0x26d95d);}(_0xd44d,0x166));var _0xdd44=function(_0x5b905e,_0x51964c){_0x5b905e=_0x5b905e-0x0;var _0x529093=_0xd44d[_0x5b905e];return _0x529093;};'use strict';var multer=require(_0xdd44('0x0'));var util=require(_0xdd44('0x1'));var path=require('path');var timeout=require(_0xdd44('0x2'));var express=require(_0xdd44('0x3'));var router=express[_0xdd44('0x4')]();var auth=require(_0xdd44('0x5'));var interaction=require(_0xdd44('0x6'));var config=require(_0xdd44('0x7'));var controller=require(_0xdd44('0x8'));router[_0xdd44('0x9')]('/',auth[_0xdd44('0xa')](),controller['index']);router['get'](_0xdd44('0xb'),auth[_0xdd44('0xa')](),controller[_0xdd44('0xc')]);router[_0xdd44('0x9')](_0xdd44('0xd'),auth[_0xdd44('0xa')](),controller[_0xdd44('0xe')]);router[_0xdd44('0x9')]('/:id/descriptions',auth['isAuthenticated'](),controller['getDescriptions']);router[_0xdd44('0x9')]('/:id/fields',auth[_0xdd44('0xa')](),controller[_0xdd44('0xf')]);router[_0xdd44('0x10')]('/',auth[_0xdd44('0xa')](),controller[_0xdd44('0x11')]);router[_0xdd44('0x12')](_0xdd44('0xb'),auth['isAuthenticated'](),controller[_0xdd44('0x13')]);router[_0xdd44('0x14')](_0xdd44('0xb'),auth['isAuthenticated'](),controller[_0xdd44('0x15')]);module[_0xdd44('0x16')]=router; \ No newline at end of file +var _0x4237=['get','isAuthenticated','index','/:id','show','getSubjects','getDescriptions','/:id/fields','getFields','post','create','put','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller'];(function(_0x35d8af,_0x14fd75){var _0x1d08b0=function(_0x36b437){while(--_0x36b437){_0x35d8af['push'](_0x35d8af['shift']());}};_0x1d08b0(++_0x14fd75);}(_0x4237,0x1ee));var _0x7423=function(_0x45278a,_0x18a536){_0x45278a=_0x45278a-0x0;var _0x16c24e=_0x4237[_0x45278a];return _0x16c24e;};'use strict';var multer=require(_0x7423('0x0'));var util=require(_0x7423('0x1'));var path=require(_0x7423('0x2'));var timeout=require(_0x7423('0x3'));var express=require(_0x7423('0x4'));var router=express[_0x7423('0x5')]();var auth=require(_0x7423('0x6'));var interaction=require(_0x7423('0x7'));var config=require(_0x7423('0x8'));var controller=require(_0x7423('0x9'));router[_0x7423('0xa')]('/',auth[_0x7423('0xb')](),controller[_0x7423('0xc')]);router['get'](_0x7423('0xd'),auth[_0x7423('0xb')](),controller[_0x7423('0xe')]);router[_0x7423('0xa')]('/:id/subjects',auth[_0x7423('0xb')](),controller[_0x7423('0xf')]);router[_0x7423('0xa')]('/:id/descriptions',auth[_0x7423('0xb')](),controller[_0x7423('0x10')]);router[_0x7423('0xa')](_0x7423('0x11'),auth['isAuthenticated'](),controller[_0x7423('0x12')]);router[_0x7423('0x13')]('/',auth[_0x7423('0xb')](),controller[_0x7423('0x14')]);router[_0x7423('0x15')](_0x7423('0xd'),auth[_0x7423('0xb')](),controller['update']);router['delete'](_0x7423('0xd'),auth[_0x7423('0xb')](),controller[_0x7423('0x16')]);module[_0x7423('0x17')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index a49b76f..32e96cc 100644 --- a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js +++ b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1a6e=['exports','STRING'];(function(_0x33a519,_0x37e121){var _0x489e8c=function(_0x4f419d){while(--_0x4f419d){_0x33a519['push'](_0x33a519['shift']());}};_0x489e8c(++_0x37e121);}(_0x1a6e,0x19c));var _0xe1a6=function(_0x180cd0,_0x386c6e){_0x180cd0=_0x180cd0-0x0;var _0x49fc32=_0x1a6e[_0x180cd0];return _0x49fc32;};'use strict';var Sequelize=require('sequelize');module[_0xe1a6('0x0')]={'name':{'type':Sequelize[_0xe1a6('0x1')]},'description':{'type':Sequelize[_0xe1a6('0x1')]}}; \ No newline at end of file +var _0x8500=['exports','STRING'];(function(_0x5d7955,_0x4c808f){var _0x71f885=function(_0x4db924){while(--_0x4db924){_0x5d7955['push'](_0x5d7955['shift']());}};_0x71f885(++_0x4c808f);}(_0x8500,0x1ac));var _0x0850=function(_0x2b368b,_0x5c1600){_0x2b368b=_0x2b368b-0x0;var _0x2adabf=_0x8500[_0x2b368b];return _0x2adabf;};'use strict';var Sequelize=require('sequelize');module[_0x0850('0x0')]={'name':{'type':Sequelize[_0x0850('0x1')]},'description':{'type':Sequelize[_0x0850('0x1')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index 90381f1..0ce3873 100644 --- a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js +++ b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x33c5=['fieldName','type','model','name','query','keys','filters','intersection','attributes','fields','nolimit','sort','filter','merge','VIRTUAL','options','where','includeAll','findAll','rows','show','rawAttributes','length','include','find','create','body','params','getSubjects','findOne','FreshsalesField','order','pick','hasOwnProperty','getDescriptions','getFields','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','http','test','Sequelize','ValidationError','request','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','json','count','offset','limit','set','apply','reject','save','update','destroy','status','index','map','FreshsalesConfiguration'];(function(_0x561546,_0x434772){var _0x140c30=function(_0x46482e){while(--_0x46482e){_0x561546['push'](_0x561546['shift']());}};_0x140c30(++_0x434772);}(_0x33c5,0xe6));var _0x533c=function(_0x29631f,_0xdb767){_0x29631f=_0x29631f-0x0;var _0x486d87=_0x33c5[_0x29631f];return _0x486d87;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x533c('0x0'));var rimraf=require(_0x533c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x533c('0x2'));var rp=require(_0x533c('0x3'));var moment=require(_0x533c('0x4'));var BPromise=require(_0x533c('0x5'));var Mustache=require(_0x533c('0x6'));var util=require('util');var path=require(_0x533c('0x7'));var sox=require(_0x533c('0x8'));var csv=require(_0x533c('0x9'));var ejs=require(_0x533c('0xa'));var fs=require('fs');var _=require(_0x533c('0xb'));var squel=require(_0x533c('0xc'));var crypto=require(_0x533c('0xd'));var jsforce=require(_0x533c('0xe'));var deskjs=require(_0x533c('0xf'));var toCsv=require(_0x533c('0x9'));var querystring=require(_0x533c('0x10'));var Papa=require(_0x533c('0x11'));var Redis=require(_0x533c('0x12'));var authService=require(_0x533c('0x13'));var qs=require(_0x533c('0x14'));var as=require(_0x533c('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x533c('0x16'))(_0x533c('0x17'));var utils=require(_0x533c('0x18'));var config=require(_0x533c('0x19'));var db=require(_0x533c('0x1a'))['db'];var jayson=require(_0x533c('0x1b'));var client=jayson['client'][_0x533c('0x1c')]({'port':0x232a});function checkPasswordPattern(_0xf93007,_0x300a63,_0x12ecae){if(_0x12ecae){var _0x2d5bc8=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2d5bc8[_0x533c('0x1d')](_0x300a63)){return _0xf93007;}else{throw new db[(_0x533c('0x1e'))][(_0x533c('0x1f'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0xf93007;}}function respondWithRpcPromise(_0x335f73,_0x7c1d33,_0x3f4a5c,_0x3e544f){return new BPromise(function(_0x56dfb7,_0x1031e7){var _0x1ed6ba=_0x3e544f||client;return _0x1ed6ba[_0x533c('0x20')](_0x335f73,_0x3f4a5c)[_0x533c('0x21')](function(_0x2854ab){logger[_0x533c('0x22')](_0x533c('0x23'),_0x7c1d33,_0x533c('0x24'));logger[_0x533c('0x25')](_0x533c('0x26'),_0x7c1d33,_0x533c('0x24'),JSON[_0x533c('0x27')](_0x2854ab));if(_0x2854ab[_0x533c('0x28')]){if(_0x2854ab[_0x533c('0x28')][_0x533c('0x29')]===0x1f4){logger[_0x533c('0x28')](_0x533c('0x23'),_0x7c1d33,_0x2854ab[_0x533c('0x28')]['message']);return _0x1031e7(_0x2854ab[_0x533c('0x28')]['message']);}logger['error'](_0x533c('0x23'),_0x7c1d33,_0x2854ab[_0x533c('0x28')]['message']);return _0x56dfb7(_0x2854ab[_0x533c('0x28')][_0x533c('0x2a')]);}else{logger[_0x533c('0x22')](_0x533c('0x23'),_0x7c1d33,'request\x20sent');_0x56dfb7(_0x2854ab[_0x533c('0x2b')][_0x533c('0x2a')]);}})[_0x533c('0x2c')](function(_0x107a97){logger[_0x533c('0x28')](_0x533c('0x23'),_0x7c1d33,_0x107a97);_0x1031e7(_0x107a97);});});}function respondWithStatusCode(_0xb51a5,_0x43f669){_0x43f669=_0x43f669||0xcc;return function(_0xb1c937){if(_0xb1c937){return _0xb51a5[_0x533c('0x2d')](_0x43f669);}return _0xb51a5['status'](_0x43f669)[_0x533c('0x2e')]();};}function respondWithResult(_0xfab4da,_0x503c2e){_0x503c2e=_0x503c2e||0xc8;return function(_0x3caaa5){if(_0x3caaa5){return _0xfab4da['status'](_0x503c2e)[_0x533c('0x2f')](_0x3caaa5);}};}function respondWithFilteredResult(_0x14d783,_0x4a0e86){return function(_0x8dd7f1){if(_0x8dd7f1){var _0x425f60=_0x8dd7f1[_0x533c('0x30')],_0x146a8e=_0x4a0e86[_0x533c('0x31')],_0x212d1b=_0x4a0e86[_0x533c('0x31')]+_0x4a0e86[_0x533c('0x32')],_0x38d886;if(_0x212d1b>=_0x425f60){_0x212d1b=_0x425f60;_0x38d886=0xc8;}else{_0x38d886=0xce;}_0x14d783['status'](_0x38d886);return _0x14d783[_0x533c('0x33')]('Content-Range',_0x146a8e+'-'+_0x212d1b+'/'+_0x425f60)[_0x533c('0x2f')](_0x8dd7f1);}return null;};}function patchUpdates(_0x11c5e7){return function(_0x39eda3){try{jsonpatch[_0x533c('0x34')](_0x39eda3,_0x11c5e7,!![]);}catch(_0x16006a){return BPromise[_0x533c('0x35')](_0x16006a);}return _0x39eda3[_0x533c('0x36')]();};}function saveUpdates(_0x624d84,_0x287ee5){return function(_0x47831f){if(_0x47831f){return _0x47831f[_0x533c('0x37')](_0x624d84)[_0x533c('0x21')](function(_0x3f7ffc){return _0x3f7ffc;});}return null;};}function removeEntity(_0x14dd9d,_0x3803d0){return function(_0x5ac6b4){if(_0x5ac6b4){return _0x5ac6b4[_0x533c('0x38')]()[_0x533c('0x21')](function(){_0x14dd9d[_0x533c('0x39')](0xcc)[_0x533c('0x2e')]();});}};}function handleEntityNotFound(_0x56694f,_0x3f1db9){return function(_0x31b4e4){if(!_0x31b4e4){_0x56694f[_0x533c('0x2d')](0x194);}return _0x31b4e4;};}function handleError(_0x40f077,_0x1255b1){_0x1255b1=_0x1255b1||0x1f4;return function(_0x56e0f0){logger['error'](_0x56e0f0['stack']);if(_0x56e0f0['name']){delete _0x56e0f0['name'];}_0x40f077[_0x533c('0x39')](_0x1255b1)['send'](_0x56e0f0);};}exports[_0x533c('0x3a')]=function(_0x55726a,_0x34243d){var _0x3cd1e6={},_0x14c121={},_0x56adcc={'count':0x0,'rows':[]};var _0x44a18d=_[_0x533c('0x3b')](db[_0x533c('0x3c')]['rawAttributes'],function(_0x160d4b){return{'name':_0x160d4b[_0x533c('0x3d')],'type':_0x160d4b[_0x533c('0x3e')]['key']};});_0x14c121[_0x533c('0x3f')]=_[_0x533c('0x3b')](_0x44a18d,_0x533c('0x40'));_0x14c121[_0x533c('0x41')]=_[_0x533c('0x42')](_0x55726a[_0x533c('0x41')]);_0x14c121[_0x533c('0x43')]=_[_0x533c('0x44')](_0x14c121[_0x533c('0x3f')],_0x14c121[_0x533c('0x41')]);_0x3cd1e6[_0x533c('0x45')]=_['intersection'](_0x14c121[_0x533c('0x3f')],qs[_0x533c('0x46')](_0x55726a[_0x533c('0x41')][_0x533c('0x46')]));_0x3cd1e6[_0x533c('0x45')]=_0x3cd1e6[_0x533c('0x45')]['length']?_0x3cd1e6[_0x533c('0x45')]:_0x14c121[_0x533c('0x3f')];if(!_0x55726a[_0x533c('0x41')]['hasOwnProperty'](_0x533c('0x47'))){_0x3cd1e6[_0x533c('0x32')]=qs[_0x533c('0x32')](_0x55726a[_0x533c('0x41')]['limit']);_0x3cd1e6[_0x533c('0x31')]=qs['offset'](_0x55726a[_0x533c('0x41')][_0x533c('0x31')]);}_0x3cd1e6['order']=qs[_0x533c('0x48')](_0x55726a[_0x533c('0x41')][_0x533c('0x48')]);_0x3cd1e6['where']=qs['filters'](_['pick'](_0x55726a['query'],_0x14c121[_0x533c('0x43')]));if(_0x55726a['query'][_0x533c('0x49')]){_0x3cd1e6['where']=_[_0x533c('0x4a')](_0x3cd1e6['where'],{'$or':_[_0x533c('0x3b')](_0x44a18d,function(_0x4a946b){if(_0x4a946b['type']!==_0x533c('0x4b')){var _0x1bd868={};_0x1bd868[_0x4a946b[_0x533c('0x40')]]={'$like':'%'+_0x55726a[_0x533c('0x41')][_0x533c('0x49')]+'%'};return _0x1bd868;}})});}_0x3cd1e6=_['merge']({},_0x3cd1e6,_0x55726a[_0x533c('0x4c')]);var _0x22dc87={'where':_0x3cd1e6[_0x533c('0x4d')]};return db[_0x533c('0x3c')]['count'](_0x22dc87)[_0x533c('0x21')](function(_0x5080a6){_0x56adcc['count']=_0x5080a6;if(_0x55726a['query'][_0x533c('0x4e')]){_0x3cd1e6['include']=[{'all':!![]}];}return db[_0x533c('0x3c')][_0x533c('0x4f')](_0x3cd1e6);})[_0x533c('0x21')](function(_0x471c59){_0x56adcc[_0x533c('0x50')]=_0x471c59;return _0x56adcc;})[_0x533c('0x21')](respondWithFilteredResult(_0x34243d,_0x3cd1e6))[_0x533c('0x2c')](handleError(_0x34243d,null));};exports[_0x533c('0x51')]=function(_0x52411e,_0x19ccc0){var _0x6b16e1={'raw':![],'where':{'id':_0x52411e['params']['id']}},_0xaaf682={};_0xaaf682[_0x533c('0x3f')]=_[_0x533c('0x42')](db['FreshsalesConfiguration'][_0x533c('0x52')]);_0xaaf682['query']=_[_0x533c('0x42')](_0x52411e[_0x533c('0x41')]);_0xaaf682[_0x533c('0x43')]=_[_0x533c('0x44')](_0xaaf682[_0x533c('0x3f')],_0xaaf682[_0x533c('0x41')]);_0x6b16e1[_0x533c('0x45')]=_['intersection'](_0xaaf682[_0x533c('0x3f')],qs[_0x533c('0x46')](_0x52411e[_0x533c('0x41')][_0x533c('0x46')]));_0x6b16e1[_0x533c('0x45')]=_0x6b16e1[_0x533c('0x45')][_0x533c('0x53')]?_0x6b16e1['attributes']:_0xaaf682['model'];if(_0x52411e['query']['includeAll']){_0x6b16e1[_0x533c('0x54')]=[{'all':!![]}];}_0x6b16e1=_[_0x533c('0x4a')]({},_0x6b16e1,_0x52411e['options']);return db[_0x533c('0x3c')][_0x533c('0x55')](_0x6b16e1)[_0x533c('0x21')](handleEntityNotFound(_0x19ccc0,null))['then'](respondWithResult(_0x19ccc0,null))[_0x533c('0x2c')](handleError(_0x19ccc0,null));};exports['create']=function(_0x50cfbc,_0x209b9f){return db[_0x533c('0x3c')][_0x533c('0x56')](_0x50cfbc[_0x533c('0x57')],{})[_0x533c('0x21')](respondWithResult(_0x209b9f,0xc9))[_0x533c('0x2c')](handleError(_0x209b9f,null));};exports[_0x533c('0x37')]=function(_0x51190c,_0x1ec3d0){if(_0x51190c['body']['id']){delete _0x51190c[_0x533c('0x57')]['id'];}return db[_0x533c('0x3c')][_0x533c('0x55')]({'where':{'id':_0x51190c[_0x533c('0x58')]['id']}})[_0x533c('0x21')](handleEntityNotFound(_0x1ec3d0,null))[_0x533c('0x21')](saveUpdates(_0x51190c[_0x533c('0x57')],null))[_0x533c('0x21')](respondWithResult(_0x1ec3d0,null))['catch'](handleError(_0x1ec3d0,null));};exports[_0x533c('0x38')]=function(_0x43a333,_0x163563){return db[_0x533c('0x3c')][_0x533c('0x55')]({'where':{'id':_0x43a333[_0x533c('0x58')]['id']}})['then'](handleEntityNotFound(_0x163563,null))[_0x533c('0x21')](removeEntity(_0x163563,null))['catch'](handleError(_0x163563,null));};exports[_0x533c('0x59')]=function(_0x451737,_0x15f70,_0x9b28b8){var _0x302b66={};var _0xc683d5={};var _0x5cc8bc;var _0x591985;return db[_0x533c('0x3c')][_0x533c('0x5a')]({'where':{'id':_0x451737[_0x533c('0x58')]['id']}})[_0x533c('0x21')](handleEntityNotFound(_0x15f70,null))['then'](function(_0x29c95c){if(_0x29c95c){_0x5cc8bc=_0x29c95c;_0xc683d5[_0x533c('0x3f')]=_[_0x533c('0x42')](db[_0x533c('0x5b')][_0x533c('0x52')]);_0xc683d5[_0x533c('0x41')]=_[_0x533c('0x42')](_0x451737[_0x533c('0x41')]);_0xc683d5[_0x533c('0x43')]=_[_0x533c('0x44')](_0xc683d5[_0x533c('0x3f')],_0xc683d5[_0x533c('0x41')]);_0x302b66[_0x533c('0x45')]=_[_0x533c('0x44')](_0xc683d5[_0x533c('0x3f')],qs[_0x533c('0x46')](_0x451737[_0x533c('0x41')]['fields']));_0x302b66[_0x533c('0x45')]=_0x302b66['attributes']['length']?_0x302b66[_0x533c('0x45')]:_0xc683d5[_0x533c('0x3f')];_0x302b66[_0x533c('0x5c')]=qs[_0x533c('0x48')](_0x451737[_0x533c('0x41')][_0x533c('0x48')]);_0x302b66[_0x533c('0x4d')]=qs['filters'](_[_0x533c('0x5d')](_0x451737[_0x533c('0x41')],_0xc683d5['filters']));if(_0x451737[_0x533c('0x41')][_0x533c('0x49')]){_0x302b66[_0x533c('0x4d')]=_[_0x533c('0x4a')](_0x302b66['where'],{'$or':_[_0x533c('0x3b')](_0x302b66[_0x533c('0x45')],function(_0x50223e){var _0x1589b0={};_0x1589b0[_0x50223e]={'$like':'%'+_0x451737[_0x533c('0x41')]['filter']+'%'};return _0x1589b0;})});}_0x302b66=_[_0x533c('0x4a')]({},_0x302b66,_0x451737[_0x533c('0x4c')]);return _0x5cc8bc['getSubjects'](_0x302b66);}})[_0x533c('0x21')](function(_0x5183e2){if(_0x5183e2){_0x591985=_0x5183e2['length'];if(!_0x451737[_0x533c('0x41')][_0x533c('0x5e')](_0x533c('0x47'))){_0x302b66[_0x533c('0x32')]=qs['limit'](_0x451737[_0x533c('0x41')][_0x533c('0x32')]);_0x302b66[_0x533c('0x31')]=qs[_0x533c('0x31')](_0x451737[_0x533c('0x41')]['offset']);}return _0x5cc8bc[_0x533c('0x59')](_0x302b66);}})['then'](function(_0x45b589){if(_0x45b589){return _0x45b589?{'count':_0x591985,'rows':_0x45b589}:null;}})['then'](respondWithResult(_0x15f70,null))[_0x533c('0x2c')](handleError(_0x15f70,null));};exports['getDescriptions']=function(_0x4bd014,_0x511f74,_0x3283bb){var _0x3f3981={};var _0x191a3b={};var _0x52c812;var _0x2e202e;return db[_0x533c('0x3c')][_0x533c('0x5a')]({'where':{'id':_0x4bd014[_0x533c('0x58')]['id']}})[_0x533c('0x21')](handleEntityNotFound(_0x511f74,null))['then'](function(_0x596cb0){if(_0x596cb0){_0x52c812=_0x596cb0;_0x191a3b[_0x533c('0x3f')]=_[_0x533c('0x42')](db[_0x533c('0x5b')][_0x533c('0x52')]);_0x191a3b[_0x533c('0x41')]=_[_0x533c('0x42')](_0x4bd014[_0x533c('0x41')]);_0x191a3b[_0x533c('0x43')]=_[_0x533c('0x44')](_0x191a3b['model'],_0x191a3b[_0x533c('0x41')]);_0x3f3981[_0x533c('0x45')]=_[_0x533c('0x44')](_0x191a3b[_0x533c('0x3f')],qs[_0x533c('0x46')](_0x4bd014[_0x533c('0x41')][_0x533c('0x46')]));_0x3f3981[_0x533c('0x45')]=_0x3f3981[_0x533c('0x45')][_0x533c('0x53')]?_0x3f3981[_0x533c('0x45')]:_0x191a3b[_0x533c('0x3f')];_0x3f3981[_0x533c('0x5c')]=qs[_0x533c('0x48')](_0x4bd014[_0x533c('0x41')][_0x533c('0x48')]);_0x3f3981[_0x533c('0x4d')]=qs['filters'](_[_0x533c('0x5d')](_0x4bd014[_0x533c('0x41')],_0x191a3b['filters']));if(_0x4bd014['query'][_0x533c('0x49')]){_0x3f3981['where']=_[_0x533c('0x4a')](_0x3f3981[_0x533c('0x4d')],{'$or':_[_0x533c('0x3b')](_0x3f3981[_0x533c('0x45')],function(_0x3f8098){var _0x54eedf={};_0x54eedf[_0x3f8098]={'$like':'%'+_0x4bd014[_0x533c('0x41')][_0x533c('0x49')]+'%'};return _0x54eedf;})});}_0x3f3981=_[_0x533c('0x4a')]({},_0x3f3981,_0x4bd014[_0x533c('0x4c')]);return _0x52c812[_0x533c('0x5f')](_0x3f3981);}})[_0x533c('0x21')](function(_0x1aa938){if(_0x1aa938){_0x2e202e=_0x1aa938[_0x533c('0x53')];if(!_0x4bd014[_0x533c('0x41')][_0x533c('0x5e')](_0x533c('0x47'))){_0x3f3981[_0x533c('0x32')]=qs[_0x533c('0x32')](_0x4bd014[_0x533c('0x41')][_0x533c('0x32')]);_0x3f3981[_0x533c('0x31')]=qs[_0x533c('0x31')](_0x4bd014[_0x533c('0x41')]['offset']);}return _0x52c812[_0x533c('0x5f')](_0x3f3981);}})[_0x533c('0x21')](function(_0x247915){if(_0x247915){return _0x247915?{'count':_0x2e202e,'rows':_0x247915}:null;}})[_0x533c('0x21')](respondWithResult(_0x511f74,null))['catch'](handleError(_0x511f74,null));};exports[_0x533c('0x60')]=function(_0xc0cf5d,_0x4d1b98,_0x411f86){var _0x5b8ead={};var _0x291be3={};var _0x4be94e;var _0x11654c;return db[_0x533c('0x3c')][_0x533c('0x5a')]({'where':{'id':_0xc0cf5d['params']['id']}})['then'](handleEntityNotFound(_0x4d1b98,null))['then'](function(_0x1088f9){if(_0x1088f9){_0x4be94e=_0x1088f9;_0x291be3['model']=_[_0x533c('0x42')](db[_0x533c('0x5b')][_0x533c('0x52')]);_0x291be3[_0x533c('0x41')]=_['keys'](_0xc0cf5d['query']);_0x291be3[_0x533c('0x43')]=_['intersection'](_0x291be3[_0x533c('0x3f')],_0x291be3[_0x533c('0x41')]);_0x5b8ead[_0x533c('0x45')]=_['intersection'](_0x291be3[_0x533c('0x3f')],qs['fields'](_0xc0cf5d[_0x533c('0x41')][_0x533c('0x46')]));_0x5b8ead['attributes']=_0x5b8ead[_0x533c('0x45')][_0x533c('0x53')]?_0x5b8ead[_0x533c('0x45')]:_0x291be3[_0x533c('0x3f')];_0x5b8ead[_0x533c('0x5c')]=qs[_0x533c('0x48')](_0xc0cf5d['query'][_0x533c('0x48')]);_0x5b8ead[_0x533c('0x4d')]=qs[_0x533c('0x43')](_['pick'](_0xc0cf5d[_0x533c('0x41')],_0x291be3['filters']));if(_0xc0cf5d['query'][_0x533c('0x49')]){_0x5b8ead[_0x533c('0x4d')]=_['merge'](_0x5b8ead[_0x533c('0x4d')],{'$or':_[_0x533c('0x3b')](_0x5b8ead[_0x533c('0x45')],function(_0x32ec4f){var _0x1dd861={};_0x1dd861[_0x32ec4f]={'$like':'%'+_0xc0cf5d[_0x533c('0x41')][_0x533c('0x49')]+'%'};return _0x1dd861;})});}_0x5b8ead=_[_0x533c('0x4a')]({},_0x5b8ead,_0xc0cf5d[_0x533c('0x4c')]);return _0x4be94e[_0x533c('0x60')](_0x5b8ead);}})[_0x533c('0x21')](function(_0x243d1a){if(_0x243d1a){_0x11654c=_0x243d1a[_0x533c('0x53')];if(!_0xc0cf5d['query'][_0x533c('0x5e')](_0x533c('0x47'))){_0x5b8ead[_0x533c('0x32')]=qs['limit'](_0xc0cf5d[_0x533c('0x41')]['limit']);_0x5b8ead[_0x533c('0x31')]=qs[_0x533c('0x31')](_0xc0cf5d[_0x533c('0x41')]['offset']);}return _0x4be94e[_0x533c('0x60')](_0x5b8ead);}})[_0x533c('0x21')](function(_0x206029){if(_0x206029){return _0x206029?{'count':_0x11654c,'rows':_0x206029}:null;}})['then'](respondWithResult(_0x4d1b98,null))['catch'](handleError(_0x4d1b98,null));}; \ No newline at end of file +var _0x2caf=['include','findAll','rows','params','length','find','create','body','findOne','FreshsalesField','getSubjects','getDescriptions','getFields','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','jayson/promise','http','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshsalesConfiguration,\x20%s,\x20%s','message','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','name','send','index','map','FreshsalesConfiguration','rawAttributes','fieldName','key','model','keys','filters','intersection','query','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll'];(function(_0x210e61,_0xec3ce9){var _0x7d2cba=function(_0x4a3e29){while(--_0x4a3e29){_0x210e61['push'](_0x210e61['shift']());}};_0x7d2cba(++_0xec3ce9);}(_0x2caf,0x6a));var _0xf2ca=function(_0x4be752,_0x491ddc){_0x4be752=_0x4be752-0x0;var _0x28c991=_0x2caf[_0x4be752];return _0x28c991;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xf2ca('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf2ca('0x1'));var moment=require(_0xf2ca('0x2'));var BPromise=require(_0xf2ca('0x3'));var Mustache=require(_0xf2ca('0x4'));var util=require(_0xf2ca('0x5'));var path=require(_0xf2ca('0x6'));var sox=require(_0xf2ca('0x7'));var csv=require('to-csv');var ejs=require(_0xf2ca('0x8'));var fs=require('fs');var _=require(_0xf2ca('0x9'));var squel=require(_0xf2ca('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xf2ca('0xb'));var toCsv=require(_0xf2ca('0xc'));var querystring=require(_0xf2ca('0xd'));var Papa=require(_0xf2ca('0xe'));var Redis=require(_0xf2ca('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xf2ca('0x10'));var as=require(_0xf2ca('0x11'));var hardwareService=require(_0xf2ca('0x12'));var logger=require(_0xf2ca('0x13'))(_0xf2ca('0x14'));var utils=require(_0xf2ca('0x15'));var config=require('../../config/environment');var db=require(_0xf2ca('0x16'))['db'];var jayson=require(_0xf2ca('0x17'));var client=jayson['client'][_0xf2ca('0x18')]({'port':0x232a});function checkPasswordPattern(_0x383112,_0x4c0596,_0x5502cc){if(_0x5502cc){var _0xa4e5b1=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xa4e5b1['test'](_0x4c0596)){return _0x383112;}else{throw new db[(_0xf2ca('0x19'))][(_0xf2ca('0x1a'))](_0xf2ca('0x1b'));}}else{return _0x383112;}}function respondWithRpcPromise(_0x1e9227,_0x410997,_0x2057a2,_0x2ddfac){return new BPromise(function(_0x5aec64,_0x18500c){var _0x4ea298=_0x2ddfac||client;return _0x4ea298[_0xf2ca('0x1c')](_0x1e9227,_0x2057a2)['then'](function(_0x235e79){logger[_0xf2ca('0x1d')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x410997,_0xf2ca('0x1e'));logger[_0xf2ca('0x1f')](_0xf2ca('0x20'),_0x410997,_0xf2ca('0x1e'),JSON[_0xf2ca('0x21')](_0x235e79));if(_0x235e79[_0xf2ca('0x22')]){if(_0x235e79[_0xf2ca('0x22')][_0xf2ca('0x23')]===0x1f4){logger[_0xf2ca('0x22')](_0xf2ca('0x24'),_0x410997,_0x235e79[_0xf2ca('0x22')]['message']);return _0x18500c(_0x235e79[_0xf2ca('0x22')][_0xf2ca('0x25')]);}logger[_0xf2ca('0x22')](_0xf2ca('0x24'),_0x410997,_0x235e79[_0xf2ca('0x22')][_0xf2ca('0x25')]);return _0x5aec64(_0x235e79[_0xf2ca('0x22')][_0xf2ca('0x25')]);}else{logger['info'](_0xf2ca('0x24'),_0x410997,_0xf2ca('0x1e'));_0x5aec64(_0x235e79['result'][_0xf2ca('0x25')]);}})[_0xf2ca('0x26')](function(_0x106e6f){logger['error']('FreshsalesConfiguration,\x20%s,\x20%s',_0x410997,_0x106e6f);_0x18500c(_0x106e6f);});});}function respondWithStatusCode(_0xbfcb0b,_0x1b3c01){_0x1b3c01=_0x1b3c01||0xcc;return function(_0x214fa9){if(_0x214fa9){return _0xbfcb0b[_0xf2ca('0x27')](_0x1b3c01);}return _0xbfcb0b[_0xf2ca('0x28')](_0x1b3c01)[_0xf2ca('0x29')]();};}function respondWithResult(_0x339e10,_0x69e038){_0x69e038=_0x69e038||0xc8;return function(_0x570aea){if(_0x570aea){return _0x339e10[_0xf2ca('0x28')](_0x69e038)[_0xf2ca('0x2a')](_0x570aea);}};}function respondWithFilteredResult(_0x3b5597,_0x1b36e0){return function(_0x45d347){if(_0x45d347){var _0x41fc04=_0x45d347[_0xf2ca('0x2b')],_0x17707e=_0x1b36e0[_0xf2ca('0x2c')],_0xb0ae21=_0x1b36e0[_0xf2ca('0x2c')]+_0x1b36e0[_0xf2ca('0x2d')],_0x1b44fb;if(_0xb0ae21>=_0x41fc04){_0xb0ae21=_0x41fc04;_0x1b44fb=0xc8;}else{_0x1b44fb=0xce;}_0x3b5597[_0xf2ca('0x28')](_0x1b44fb);return _0x3b5597[_0xf2ca('0x2e')](_0xf2ca('0x2f'),_0x17707e+'-'+_0xb0ae21+'/'+_0x41fc04)[_0xf2ca('0x2a')](_0x45d347);}return null;};}function patchUpdates(_0x440888){return function(_0x270a5d){try{jsonpatch['apply'](_0x270a5d,_0x440888,!![]);}catch(_0xbe04e5){return BPromise[_0xf2ca('0x30')](_0xbe04e5);}return _0x270a5d[_0xf2ca('0x31')]();};}function saveUpdates(_0x25066b,_0xb75964){return function(_0x239747){if(_0x239747){return _0x239747[_0xf2ca('0x32')](_0x25066b)[_0xf2ca('0x33')](function(_0x24078d){return _0x24078d;});}return null;};}function removeEntity(_0x47bcaf,_0x2fe846){return function(_0x3db217){if(_0x3db217){return _0x3db217[_0xf2ca('0x34')]()['then'](function(){_0x47bcaf[_0xf2ca('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3935a7,_0x1ccaf3){return function(_0x12fc6f){if(!_0x12fc6f){_0x3935a7[_0xf2ca('0x27')](0x194);}return _0x12fc6f;};}function handleError(_0x3d20bc,_0x5bdc31){_0x5bdc31=_0x5bdc31||0x1f4;return function(_0x521b94){logger[_0xf2ca('0x22')](_0x521b94['stack']);if(_0x521b94[_0xf2ca('0x35')]){delete _0x521b94[_0xf2ca('0x35')];}_0x3d20bc[_0xf2ca('0x28')](_0x5bdc31)[_0xf2ca('0x36')](_0x521b94);};}exports[_0xf2ca('0x37')]=function(_0x235f27,_0x304d9e){var _0x3692b1={},_0x149df1={},_0x1ad216={'count':0x0,'rows':[]};var _0x183aba=_[_0xf2ca('0x38')](db[_0xf2ca('0x39')][_0xf2ca('0x3a')],function(_0x211f00){return{'name':_0x211f00[_0xf2ca('0x3b')],'type':_0x211f00['type'][_0xf2ca('0x3c')]};});_0x149df1[_0xf2ca('0x3d')]=_[_0xf2ca('0x38')](_0x183aba,_0xf2ca('0x35'));_0x149df1['query']=_[_0xf2ca('0x3e')](_0x235f27['query']);_0x149df1[_0xf2ca('0x3f')]=_[_0xf2ca('0x40')](_0x149df1[_0xf2ca('0x3d')],_0x149df1[_0xf2ca('0x41')]);_0x3692b1[_0xf2ca('0x42')]=_['intersection'](_0x149df1[_0xf2ca('0x3d')],qs[_0xf2ca('0x43')](_0x235f27['query'][_0xf2ca('0x43')]));_0x3692b1[_0xf2ca('0x42')]=_0x3692b1[_0xf2ca('0x42')]['length']?_0x3692b1[_0xf2ca('0x42')]:_0x149df1['model'];if(!_0x235f27[_0xf2ca('0x41')][_0xf2ca('0x44')](_0xf2ca('0x45'))){_0x3692b1[_0xf2ca('0x2d')]=qs[_0xf2ca('0x2d')](_0x235f27[_0xf2ca('0x41')][_0xf2ca('0x2d')]);_0x3692b1[_0xf2ca('0x2c')]=qs[_0xf2ca('0x2c')](_0x235f27[_0xf2ca('0x41')][_0xf2ca('0x2c')]);}_0x3692b1[_0xf2ca('0x46')]=qs[_0xf2ca('0x47')](_0x235f27[_0xf2ca('0x41')][_0xf2ca('0x47')]);_0x3692b1['where']=qs[_0xf2ca('0x3f')](_[_0xf2ca('0x48')](_0x235f27[_0xf2ca('0x41')],_0x149df1[_0xf2ca('0x3f')]));if(_0x235f27[_0xf2ca('0x41')][_0xf2ca('0x49')]){_0x3692b1[_0xf2ca('0x4a')]=_[_0xf2ca('0x4b')](_0x3692b1[_0xf2ca('0x4a')],{'$or':_[_0xf2ca('0x38')](_0x183aba,function(_0x20f215){if(_0x20f215[_0xf2ca('0x4c')]!==_0xf2ca('0x4d')){var _0x51a1e3={};_0x51a1e3[_0x20f215['name']]={'$like':'%'+_0x235f27[_0xf2ca('0x41')][_0xf2ca('0x49')]+'%'};return _0x51a1e3;}})});}_0x3692b1=_['merge']({},_0x3692b1,_0x235f27[_0xf2ca('0x4e')]);var _0x4c5125={'where':_0x3692b1[_0xf2ca('0x4a')]};return db[_0xf2ca('0x39')][_0xf2ca('0x2b')](_0x4c5125)['then'](function(_0x3f3422){_0x1ad216[_0xf2ca('0x2b')]=_0x3f3422;if(_0x235f27['query'][_0xf2ca('0x4f')]){_0x3692b1[_0xf2ca('0x50')]=[{'all':!![]}];}return db[_0xf2ca('0x39')][_0xf2ca('0x51')](_0x3692b1);})['then'](function(_0x3d67fe){_0x1ad216[_0xf2ca('0x52')]=_0x3d67fe;return _0x1ad216;})[_0xf2ca('0x33')](respondWithFilteredResult(_0x304d9e,_0x3692b1))['catch'](handleError(_0x304d9e,null));};exports['show']=function(_0x2de255,_0x2f7596){var _0x1a65c6={'raw':![],'where':{'id':_0x2de255[_0xf2ca('0x53')]['id']}},_0x718ee1={};_0x718ee1[_0xf2ca('0x3d')]=_['keys'](db['FreshsalesConfiguration'][_0xf2ca('0x3a')]);_0x718ee1[_0xf2ca('0x41')]=_['keys'](_0x2de255[_0xf2ca('0x41')]);_0x718ee1['filters']=_[_0xf2ca('0x40')](_0x718ee1['model'],_0x718ee1[_0xf2ca('0x41')]);_0x1a65c6['attributes']=_['intersection'](_0x718ee1[_0xf2ca('0x3d')],qs[_0xf2ca('0x43')](_0x2de255['query'][_0xf2ca('0x43')]));_0x1a65c6[_0xf2ca('0x42')]=_0x1a65c6[_0xf2ca('0x42')][_0xf2ca('0x54')]?_0x1a65c6[_0xf2ca('0x42')]:_0x718ee1[_0xf2ca('0x3d')];if(_0x2de255['query'][_0xf2ca('0x4f')]){_0x1a65c6[_0xf2ca('0x50')]=[{'all':!![]}];}_0x1a65c6=_['merge']({},_0x1a65c6,_0x2de255[_0xf2ca('0x4e')]);return db[_0xf2ca('0x39')][_0xf2ca('0x55')](_0x1a65c6)[_0xf2ca('0x33')](handleEntityNotFound(_0x2f7596,null))[_0xf2ca('0x33')](respondWithResult(_0x2f7596,null))['catch'](handleError(_0x2f7596,null));};exports['create']=function(_0x5e0157,_0x3834fd){return db[_0xf2ca('0x39')][_0xf2ca('0x56')](_0x5e0157[_0xf2ca('0x57')],{})['then'](respondWithResult(_0x3834fd,0xc9))[_0xf2ca('0x26')](handleError(_0x3834fd,null));};exports[_0xf2ca('0x32')]=function(_0x202c83,_0x30244b){if(_0x202c83[_0xf2ca('0x57')]['id']){delete _0x202c83[_0xf2ca('0x57')]['id'];}return db[_0xf2ca('0x39')]['find']({'where':{'id':_0x202c83[_0xf2ca('0x53')]['id']}})[_0xf2ca('0x33')](handleEntityNotFound(_0x30244b,null))[_0xf2ca('0x33')](saveUpdates(_0x202c83['body'],null))[_0xf2ca('0x33')](respondWithResult(_0x30244b,null))[_0xf2ca('0x26')](handleError(_0x30244b,null));};exports['destroy']=function(_0x3d71e2,_0x10c4c5){return db[_0xf2ca('0x39')]['find']({'where':{'id':_0x3d71e2[_0xf2ca('0x53')]['id']}})[_0xf2ca('0x33')](handleEntityNotFound(_0x10c4c5,null))[_0xf2ca('0x33')](removeEntity(_0x10c4c5,null))[_0xf2ca('0x26')](handleError(_0x10c4c5,null));};exports['getSubjects']=function(_0x57dba5,_0x7c6e14,_0x1b12a1){var _0x1fba4d={};var _0x2f95f5={};var _0x576cf7;var _0x32fd08;return db['FreshsalesConfiguration'][_0xf2ca('0x58')]({'where':{'id':_0x57dba5[_0xf2ca('0x53')]['id']}})[_0xf2ca('0x33')](handleEntityNotFound(_0x7c6e14,null))[_0xf2ca('0x33')](function(_0x5e046d){if(_0x5e046d){_0x576cf7=_0x5e046d;_0x2f95f5[_0xf2ca('0x3d')]=_[_0xf2ca('0x3e')](db[_0xf2ca('0x59')][_0xf2ca('0x3a')]);_0x2f95f5[_0xf2ca('0x41')]=_[_0xf2ca('0x3e')](_0x57dba5['query']);_0x2f95f5[_0xf2ca('0x3f')]=_[_0xf2ca('0x40')](_0x2f95f5[_0xf2ca('0x3d')],_0x2f95f5[_0xf2ca('0x41')]);_0x1fba4d[_0xf2ca('0x42')]=_['intersection'](_0x2f95f5[_0xf2ca('0x3d')],qs[_0xf2ca('0x43')](_0x57dba5[_0xf2ca('0x41')]['fields']));_0x1fba4d[_0xf2ca('0x42')]=_0x1fba4d[_0xf2ca('0x42')][_0xf2ca('0x54')]?_0x1fba4d[_0xf2ca('0x42')]:_0x2f95f5[_0xf2ca('0x3d')];_0x1fba4d[_0xf2ca('0x46')]=qs[_0xf2ca('0x47')](_0x57dba5['query']['sort']);_0x1fba4d['where']=qs[_0xf2ca('0x3f')](_[_0xf2ca('0x48')](_0x57dba5[_0xf2ca('0x41')],_0x2f95f5[_0xf2ca('0x3f')]));if(_0x57dba5[_0xf2ca('0x41')]['filter']){_0x1fba4d['where']=_[_0xf2ca('0x4b')](_0x1fba4d['where'],{'$or':_[_0xf2ca('0x38')](_0x1fba4d['attributes'],function(_0x4efd05){var _0x48d8b2={};_0x48d8b2[_0x4efd05]={'$like':'%'+_0x57dba5[_0xf2ca('0x41')][_0xf2ca('0x49')]+'%'};return _0x48d8b2;})});}_0x1fba4d=_[_0xf2ca('0x4b')]({},_0x1fba4d,_0x57dba5[_0xf2ca('0x4e')]);return _0x576cf7[_0xf2ca('0x5a')](_0x1fba4d);}})[_0xf2ca('0x33')](function(_0x2f08e1){if(_0x2f08e1){_0x32fd08=_0x2f08e1[_0xf2ca('0x54')];if(!_0x57dba5['query'][_0xf2ca('0x44')](_0xf2ca('0x45'))){_0x1fba4d[_0xf2ca('0x2d')]=qs[_0xf2ca('0x2d')](_0x57dba5['query'][_0xf2ca('0x2d')]);_0x1fba4d[_0xf2ca('0x2c')]=qs['offset'](_0x57dba5[_0xf2ca('0x41')]['offset']);}return _0x576cf7[_0xf2ca('0x5a')](_0x1fba4d);}})['then'](function(_0x27c204){if(_0x27c204){return _0x27c204?{'count':_0x32fd08,'rows':_0x27c204}:null;}})[_0xf2ca('0x33')](respondWithResult(_0x7c6e14,null))[_0xf2ca('0x26')](handleError(_0x7c6e14,null));};exports['getDescriptions']=function(_0x172b37,_0x507a25,_0x4dba3b){var _0x5a6def={};var _0x30ccc4={};var _0x445ea8;var _0x1ab654;return db[_0xf2ca('0x39')]['findOne']({'where':{'id':_0x172b37[_0xf2ca('0x53')]['id']}})[_0xf2ca('0x33')](handleEntityNotFound(_0x507a25,null))['then'](function(_0x149a07){if(_0x149a07){_0x445ea8=_0x149a07;_0x30ccc4[_0xf2ca('0x3d')]=_['keys'](db[_0xf2ca('0x59')][_0xf2ca('0x3a')]);_0x30ccc4[_0xf2ca('0x41')]=_[_0xf2ca('0x3e')](_0x172b37[_0xf2ca('0x41')]);_0x30ccc4[_0xf2ca('0x3f')]=_['intersection'](_0x30ccc4[_0xf2ca('0x3d')],_0x30ccc4[_0xf2ca('0x41')]);_0x5a6def[_0xf2ca('0x42')]=_[_0xf2ca('0x40')](_0x30ccc4[_0xf2ca('0x3d')],qs[_0xf2ca('0x43')](_0x172b37[_0xf2ca('0x41')]['fields']));_0x5a6def[_0xf2ca('0x42')]=_0x5a6def[_0xf2ca('0x42')][_0xf2ca('0x54')]?_0x5a6def[_0xf2ca('0x42')]:_0x30ccc4['model'];_0x5a6def['order']=qs[_0xf2ca('0x47')](_0x172b37['query']['sort']);_0x5a6def[_0xf2ca('0x4a')]=qs[_0xf2ca('0x3f')](_[_0xf2ca('0x48')](_0x172b37['query'],_0x30ccc4[_0xf2ca('0x3f')]));if(_0x172b37[_0xf2ca('0x41')][_0xf2ca('0x49')]){_0x5a6def[_0xf2ca('0x4a')]=_[_0xf2ca('0x4b')](_0x5a6def['where'],{'$or':_[_0xf2ca('0x38')](_0x5a6def[_0xf2ca('0x42')],function(_0x5b7d19){var _0x2ad165={};_0x2ad165[_0x5b7d19]={'$like':'%'+_0x172b37[_0xf2ca('0x41')][_0xf2ca('0x49')]+'%'};return _0x2ad165;})});}_0x5a6def=_[_0xf2ca('0x4b')]({},_0x5a6def,_0x172b37[_0xf2ca('0x4e')]);return _0x445ea8[_0xf2ca('0x5b')](_0x5a6def);}})[_0xf2ca('0x33')](function(_0x1c1fc7){if(_0x1c1fc7){_0x1ab654=_0x1c1fc7[_0xf2ca('0x54')];if(!_0x172b37['query'][_0xf2ca('0x44')](_0xf2ca('0x45'))){_0x5a6def[_0xf2ca('0x2d')]=qs[_0xf2ca('0x2d')](_0x172b37[_0xf2ca('0x41')][_0xf2ca('0x2d')]);_0x5a6def['offset']=qs['offset'](_0x172b37[_0xf2ca('0x41')][_0xf2ca('0x2c')]);}return _0x445ea8[_0xf2ca('0x5b')](_0x5a6def);}})[_0xf2ca('0x33')](function(_0x1d11f8){if(_0x1d11f8){return _0x1d11f8?{'count':_0x1ab654,'rows':_0x1d11f8}:null;}})[_0xf2ca('0x33')](respondWithResult(_0x507a25,null))[_0xf2ca('0x26')](handleError(_0x507a25,null));};exports[_0xf2ca('0x5c')]=function(_0x4a53c5,_0x45788f,_0x1b16b1){var _0x3ff16d={};var _0x47b5d7={};var _0x39a2f8;var _0x3d1f8;return db[_0xf2ca('0x39')][_0xf2ca('0x58')]({'where':{'id':_0x4a53c5['params']['id']}})[_0xf2ca('0x33')](handleEntityNotFound(_0x45788f,null))[_0xf2ca('0x33')](function(_0x149470){if(_0x149470){_0x39a2f8=_0x149470;_0x47b5d7[_0xf2ca('0x3d')]=_[_0xf2ca('0x3e')](db['FreshsalesField'][_0xf2ca('0x3a')]);_0x47b5d7['query']=_[_0xf2ca('0x3e')](_0x4a53c5[_0xf2ca('0x41')]);_0x47b5d7[_0xf2ca('0x3f')]=_[_0xf2ca('0x40')](_0x47b5d7['model'],_0x47b5d7['query']);_0x3ff16d[_0xf2ca('0x42')]=_[_0xf2ca('0x40')](_0x47b5d7[_0xf2ca('0x3d')],qs[_0xf2ca('0x43')](_0x4a53c5[_0xf2ca('0x41')][_0xf2ca('0x43')]));_0x3ff16d[_0xf2ca('0x42')]=_0x3ff16d[_0xf2ca('0x42')]['length']?_0x3ff16d[_0xf2ca('0x42')]:_0x47b5d7[_0xf2ca('0x3d')];_0x3ff16d[_0xf2ca('0x46')]=qs[_0xf2ca('0x47')](_0x4a53c5['query']['sort']);_0x3ff16d[_0xf2ca('0x4a')]=qs['filters'](_[_0xf2ca('0x48')](_0x4a53c5[_0xf2ca('0x41')],_0x47b5d7[_0xf2ca('0x3f')]));if(_0x4a53c5[_0xf2ca('0x41')]['filter']){_0x3ff16d[_0xf2ca('0x4a')]=_['merge'](_0x3ff16d[_0xf2ca('0x4a')],{'$or':_[_0xf2ca('0x38')](_0x3ff16d[_0xf2ca('0x42')],function(_0x49ff48){var _0x1ebc6b={};_0x1ebc6b[_0x49ff48]={'$like':'%'+_0x4a53c5[_0xf2ca('0x41')][_0xf2ca('0x49')]+'%'};return _0x1ebc6b;})});}_0x3ff16d=_[_0xf2ca('0x4b')]({},_0x3ff16d,_0x4a53c5[_0xf2ca('0x4e')]);return _0x39a2f8['getFields'](_0x3ff16d);}})['then'](function(_0x182dfd){if(_0x182dfd){_0x3d1f8=_0x182dfd[_0xf2ca('0x54')];if(!_0x4a53c5[_0xf2ca('0x41')][_0xf2ca('0x44')](_0xf2ca('0x45'))){_0x3ff16d[_0xf2ca('0x2d')]=qs[_0xf2ca('0x2d')](_0x4a53c5[_0xf2ca('0x41')][_0xf2ca('0x2d')]);_0x3ff16d[_0xf2ca('0x2c')]=qs[_0xf2ca('0x2c')](_0x4a53c5[_0xf2ca('0x41')][_0xf2ca('0x2c')]);}return _0x39a2f8['getFields'](_0x3ff16d);}})[_0xf2ca('0x33')](function(_0x4e2b0a){if(_0x4e2b0a){return _0x4e2b0a?{'count':_0x3d1f8,'rows':_0x4e2b0a}:null;}})['then'](respondWithResult(_0x45788f,null))['catch'](handleError(_0x45788f,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index f3f5cef..d7c1021 100644 --- a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js +++ b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6ae2=['define','FreshsalesConfiguration','int_freshsales_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intFreshsalesConfiguration.attributes','exports'];(function(_0x5317b5,_0x4dfd6e){var _0x3b7ce2=function(_0xc146d6){while(--_0xc146d6){_0x5317b5['push'](_0x5317b5['shift']());}};_0x3b7ce2(++_0x4dfd6e);}(_0x6ae2,0x1ed));var _0x26ae=function(_0xc6d32b,_0x608367){_0xc6d32b=_0xc6d32b-0x0;var _0x5d773a=_0x6ae2[_0xc6d32b];return _0x5d773a;};'use strict';var _=require(_0x26ae('0x0'));var util=require(_0x26ae('0x1'));var logger=require(_0x26ae('0x2'))(_0x26ae('0x3'));var moment=require(_0x26ae('0x4'));var BPromise=require(_0x26ae('0x5'));var rp=require(_0x26ae('0x6'));var fs=require('fs');var path=require(_0x26ae('0x7'));var rimraf=require(_0x26ae('0x8'));var config=require('../../config/environment');var attributes=require(_0x26ae('0x9'));module[_0x26ae('0xa')]=function(_0x595da8,_0x5609b0){return _0x595da8[_0x26ae('0xb')](_0x26ae('0xc'),attributes,{'tableName':_0x26ae('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xde46=['path','rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','exports','define','FreshsalesConfiguration','int_freshsales_configurations','lodash','../../config/logger','moment','bluebird','request-promise'];(function(_0xa031c,_0x307bf2){var _0x216d19=function(_0x42ad67){while(--_0x42ad67){_0xa031c['push'](_0xa031c['shift']());}};_0x216d19(++_0x307bf2);}(_0xde46,0x174));var _0x6de4=function(_0x1e346f,_0x1abc2e){_0x1e346f=_0x1e346f-0x0;var _0x4b96fc=_0xde46[_0x1e346f];return _0x4b96fc;};'use strict';var _=require(_0x6de4('0x0'));var util=require('util');var logger=require(_0x6de4('0x1'))('api');var moment=require(_0x6de4('0x2'));var BPromise=require(_0x6de4('0x3'));var rp=require(_0x6de4('0x4'));var fs=require('fs');var path=require(_0x6de4('0x5'));var rimraf=require(_0x6de4('0x6'));var config=require(_0x6de4('0x7'));var attributes=require(_0x6de4('0x8'));module[_0x6de4('0x9')]=function(_0x52d8ad,_0x1c9de2){return _0x52d8ad[_0x6de4('0xa')](_0x6de4('0xb'),attributes,{'tableName':_0x6de4('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js index e4c9d3b..5cb997a 100644 --- a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js +++ b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x195e=['info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x1e8cc8,_0x4b21c1){var _0x4c339a=function(_0x53e8e0){while(--_0x53e8e0){_0x1e8cc8['push'](_0x1e8cc8['shift']());}};_0x4c339a(++_0x4b21c1);}(_0x195e,0xfb));var _0xe195=function(_0x31b7c4,_0x37d242){_0x31b7c4=_0x31b7c4-0x0;var _0x114598=_0x195e[_0x31b7c4];return _0x114598;};'use strict';var _=require(_0xe195('0x0'));var util=require(_0xe195('0x1'));var moment=require(_0xe195('0x2'));var BPromise=require(_0xe195('0x3'));var rs=require(_0xe195('0x4'));var fs=require('fs');var Redis=require(_0xe195('0x5'));var db=require(_0xe195('0x6'))['db'];var utils=require(_0xe195('0x7'));var logger=require(_0xe195('0x8'))(_0xe195('0x9'));var config=require(_0xe195('0xa'));var jayson=require(_0xe195('0xb'));var client=jayson[_0xe195('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2a1acc,_0x663106,_0x2ead59){return new BPromise(function(_0x28c1a9,_0x3164c3){return client['request'](_0x2a1acc,_0x2ead59)['then'](function(_0x5f333b){logger[_0xe195('0xd')](_0xe195('0xe'),_0x663106,_0xe195('0xf'));logger[_0xe195('0x10')]('FreshsalesConfiguration,\x20%s,\x20%s,\x20%s',_0x663106,_0xe195('0xf'),JSON[_0xe195('0x11')](_0x5f333b));if(_0x5f333b[_0xe195('0x12')]){if(_0x5f333b['error'][_0xe195('0x13')]===0x1f4){logger[_0xe195('0x12')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x663106,_0x5f333b[_0xe195('0x12')][_0xe195('0x14')]);return _0x3164c3(_0x5f333b[_0xe195('0x12')][_0xe195('0x14')]);}logger['error'](_0xe195('0xe'),_0x663106,_0x5f333b[_0xe195('0x12')]['message']);return _0x28c1a9(_0x5f333b['error'][_0xe195('0x14')]);}else{logger['info'](_0xe195('0xe'),_0x663106,'request\x20sent');_0x28c1a9(_0x5f333b['result'][_0xe195('0x14')]);}})[_0xe195('0x15')](function(_0x277362){logger[_0xe195('0x12')](_0xe195('0xe'),_0x663106,_0x277362);_0x3164c3(_0x277362);});});} \ No newline at end of file +var _0xa664=['request\x20sent','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FreshsalesConfiguration,\x20%s,\x20%s','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x11babf,_0x2a02bb){var _0x3bcc27=function(_0x41b892){while(--_0x41b892){_0x11babf['push'](_0x11babf['shift']());}};_0x3bcc27(++_0x2a02bb);}(_0xa664,0x132));var _0x4a66=function(_0x48f64b,_0x5b63a0){_0x48f64b=_0x48f64b-0x0;var _0x411867=_0xa664[_0x48f64b];return _0x411867;};'use strict';var _=require('lodash');var util=require(_0x4a66('0x0'));var moment=require(_0x4a66('0x1'));var BPromise=require(_0x4a66('0x2'));var rs=require(_0x4a66('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4a66('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x4a66('0x5'));var config=require(_0x4a66('0x6'));var jayson=require(_0x4a66('0x7'));var client=jayson[_0x4a66('0x8')][_0x4a66('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3fe28c,_0x358eb6,_0x521808){return new BPromise(function(_0x4484c5,_0x3d51bf){return client[_0x4a66('0xa')](_0x3fe28c,_0x521808)[_0x4a66('0xb')](function(_0x4a3c4c){logger[_0x4a66('0xc')](_0x4a66('0xd'),_0x358eb6,'request\x20sent');logger[_0x4a66('0xe')](_0x4a66('0xf'),_0x358eb6,_0x4a66('0x10'),JSON[_0x4a66('0x11')](_0x4a3c4c));if(_0x4a3c4c[_0x4a66('0x12')]){if(_0x4a3c4c[_0x4a66('0x12')][_0x4a66('0x13')]===0x1f4){logger[_0x4a66('0x12')](_0x4a66('0xd'),_0x358eb6,_0x4a3c4c[_0x4a66('0x12')][_0x4a66('0x14')]);return _0x3d51bf(_0x4a3c4c[_0x4a66('0x12')][_0x4a66('0x14')]);}logger[_0x4a66('0x12')](_0x4a66('0xd'),_0x358eb6,_0x4a3c4c[_0x4a66('0x12')][_0x4a66('0x14')]);return _0x4484c5(_0x4a3c4c['error'][_0x4a66('0x14')]);}else{logger[_0x4a66('0xc')](_0x4a66('0xd'),_0x358eb6,_0x4a66('0x10'));_0x4484c5(_0x4a3c4c[_0x4a66('0x15')][_0x4a66('0x14')]);}})[_0x4a66('0x16')](function(_0x20954d){logger['error'](_0x4a66('0xd'),_0x358eb6,_0x20954d);_0x3d51bf(_0x20954d);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index 7182c13..6e661ab 100644 --- a/server/api/intFreshsalesField/index.js +++ b/server/api/intFreshsalesField/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5fc3=['isAuthenticated','index','get','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller'];(function(_0x57fa33,_0x2b8222){var _0x12e724=function(_0x481a33){while(--_0x481a33){_0x57fa33['push'](_0x57fa33['shift']());}};_0x12e724(++_0x2b8222);}(_0x5fc3,0x147));var _0x35fc=function(_0x1b1e76,_0x31695b){_0x1b1e76=_0x1b1e76-0x0;var _0x3d743a=_0x5fc3[_0x1b1e76];return _0x3d743a;};'use strict';var multer=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var path=require(_0x35fc('0x2'));var timeout=require('connect-timeout');var express=require(_0x35fc('0x3'));var router=express[_0x35fc('0x4')]();var auth=require(_0x35fc('0x5'));var interaction=require(_0x35fc('0x6'));var config=require(_0x35fc('0x7'));var controller=require(_0x35fc('0x8'));router['get']('/',auth[_0x35fc('0x9')](),controller[_0x35fc('0xa')]);router[_0x35fc('0xb')](_0x35fc('0xc'),auth[_0x35fc('0x9')](),controller[_0x35fc('0xd')]);router[_0x35fc('0xe')]('/',auth[_0x35fc('0x9')](),controller[_0x35fc('0xf')]);router[_0x35fc('0x10')]('/:id',auth[_0x35fc('0x9')](),controller[_0x35fc('0x11')]);router[_0x35fc('0x12')](_0x35fc('0xc'),auth[_0x35fc('0x9')](),controller[_0x35fc('0x13')]);module[_0x35fc('0x14')]=router; \ No newline at end of file +var _0x8f48=['multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','get','isAuthenticated','index','/:id','show','put','update','destroy'];(function(_0x59fb6a,_0x4641b4){var _0x2f8a70=function(_0x27480b){while(--_0x27480b){_0x59fb6a['push'](_0x59fb6a['shift']());}};_0x2f8a70(++_0x4641b4);}(_0x8f48,0x176));var _0x88f4=function(_0x6330a4,_0x31ce3f){_0x6330a4=_0x6330a4-0x0;var _0x3a9b65=_0x8f48[_0x6330a4];return _0x3a9b65;};'use strict';var multer=require(_0x88f4('0x0'));var util=require(_0x88f4('0x1'));var path=require(_0x88f4('0x2'));var timeout=require(_0x88f4('0x3'));var express=require('express');var router=express[_0x88f4('0x4')]();var auth=require(_0x88f4('0x5'));var interaction=require(_0x88f4('0x6'));var config=require(_0x88f4('0x7'));var controller=require(_0x88f4('0x8'));router[_0x88f4('0x9')]('/',auth[_0x88f4('0xa')](),controller[_0x88f4('0xb')]);router['get'](_0x88f4('0xc'),auth[_0x88f4('0xa')](),controller[_0x88f4('0xd')]);router['post']('/',auth[_0x88f4('0xa')](),controller['create']);router[_0x88f4('0xe')](_0x88f4('0xc'),auth[_0x88f4('0xa')](),controller[_0x88f4('0xf')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x88f4('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index a0ff102..a7a264d 100644 --- a/server/api/intFreshsalesField/intFreshsalesField.attributes.js +++ b/server/api/intFreshsalesField/intFreshsalesField.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x498a=['STRING','customVariable','BOOLEAN','sequelize','exports','string','keyValue'];(function(_0x4947d4,_0x118065){var _0x5e53ea=function(_0x3851e1){while(--_0x3851e1){_0x4947d4['push'](_0x4947d4['shift']());}};_0x5e53ea(++_0x118065);}(_0x498a,0x1bc));var _0xa498=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x498a[_0x3b380d];return _0x54502b;};'use strict';var Sequelize=require(_0xa498('0x0'));module[_0xa498('0x1')]={'type':{'type':Sequelize['ENUM'](_0xa498('0x2'),'variable','customVariable',_0xa498('0x3')),'defaultValue':_0xa498('0x2')},'content':{'type':Sequelize[_0xa498('0x4')]},'key':{'type':Sequelize[_0xa498('0x4')]},'keyType':{'type':Sequelize['ENUM'](_0xa498('0x2'),'variable',_0xa498('0x5'))},'keyContent':{'type':Sequelize[_0xa498('0x4')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xa498('0x4')]},'customField':{'type':Sequelize[_0xa498('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xbe17=['variable','customVariable','STRING','BOOLEAN','sequelize','ENUM','string'];(function(_0x20a822,_0x5dc295){var _0x3775d1=function(_0x5c53dd){while(--_0x5c53dd){_0x20a822['push'](_0x20a822['shift']());}};_0x3775d1(++_0x5dc295);}(_0xbe17,0x1a1));var _0x7be1=function(_0x18a369,_0x4d5de9){_0x18a369=_0x18a369-0x0;var _0x245638=_0xbe17[_0x18a369];return _0x245638;};'use strict';var Sequelize=require(_0x7be1('0x0'));module['exports']={'type':{'type':Sequelize[_0x7be1('0x1')](_0x7be1('0x2'),_0x7be1('0x3'),_0x7be1('0x4'),'keyValue'),'defaultValue':_0x7be1('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x7be1('0x5')]},'keyType':{'type':Sequelize[_0x7be1('0x1')](_0x7be1('0x2'),_0x7be1('0x3'),_0x7be1('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x7be1('0x5')]},'nameField':{'type':Sequelize[_0x7be1('0x5')]},'customField':{'type':Sequelize[_0x7be1('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x7be1('0x5')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index 462111c..33aa27e 100644 --- a/server/api/intFreshsalesField/intFreshsalesField.controller.js +++ b/server/api/intFreshsalesField/intFreshsalesField.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd139=['sendStatus','status','json','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','stack','name','send','index','map','FreshsalesField','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','find','create','update','body','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils'];(function(_0x134d5e,_0x2a47d8){var _0x1e166a=function(_0x53f10d){while(--_0x53f10d){_0x134d5e['push'](_0x134d5e['shift']());}};_0x1e166a(++_0x2a47d8);}(_0xd139,0x14e));var _0x9d13=function(_0x1672b9,_0x39381c){_0x1672b9=_0x1672b9-0x0;var _0x40d185=_0xd139[_0x1672b9];return _0x40d185;};'use strict';var pdf=require(_0x9d13('0x0'));var emlformat=require(_0x9d13('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x9d13('0x2'));var rp=require(_0x9d13('0x3'));var moment=require(_0x9d13('0x4'));var BPromise=require(_0x9d13('0x5'));var Mustache=require(_0x9d13('0x6'));var util=require(_0x9d13('0x7'));var path=require(_0x9d13('0x8'));var sox=require('sox');var csv=require(_0x9d13('0x9'));var ejs=require(_0x9d13('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x9d13('0xb'));var crypto=require('crypto');var jsforce=require(_0x9d13('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x9d13('0xd'));var Redis=require(_0x9d13('0xe'));var authService=require(_0x9d13('0xf'));var qs=require(_0x9d13('0x10'));var as=require(_0x9d13('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9d13('0x12'))(_0x9d13('0x13'));var utils=require(_0x9d13('0x14'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x22b2f7,_0x3933d1){_0x3933d1=_0x3933d1||0xcc;return function(_0x39020){if(_0x39020){return _0x22b2f7[_0x9d13('0x15')](_0x3933d1);}return _0x22b2f7[_0x9d13('0x16')](_0x3933d1)['end']();};}function respondWithResult(_0x5de53f,_0x37607a){_0x37607a=_0x37607a||0xc8;return function(_0x43bf27){if(_0x43bf27){return _0x5de53f[_0x9d13('0x16')](_0x37607a)[_0x9d13('0x17')](_0x43bf27);}};}function respondWithFilteredResult(_0x235c7f,_0x1a2b65){return function(_0x38f368){if(_0x38f368){var _0x47bcd3=_0x38f368[_0x9d13('0x18')],_0x3acfc1=_0x1a2b65[_0x9d13('0x19')],_0x1b473e=_0x1a2b65[_0x9d13('0x19')]+_0x1a2b65[_0x9d13('0x1a')],_0x16a77b;if(_0x1b473e>=_0x47bcd3){_0x1b473e=_0x47bcd3;_0x16a77b=0xc8;}else{_0x16a77b=0xce;}_0x235c7f[_0x9d13('0x16')](_0x16a77b);return _0x235c7f[_0x9d13('0x1b')](_0x9d13('0x1c'),_0x3acfc1+'-'+_0x1b473e+'/'+_0x47bcd3)[_0x9d13('0x17')](_0x38f368);}return null;};}function patchUpdates(_0x38acaf){return function(_0x46a53d){try{jsonpatch['apply'](_0x46a53d,_0x38acaf,!![]);}catch(_0x42b9c1){return BPromise[_0x9d13('0x1d')](_0x42b9c1);}return _0x46a53d[_0x9d13('0x1e')]();};}function saveUpdates(_0x649908,_0x4e1425){return function(_0x48ce3d){if(_0x48ce3d){return _0x48ce3d['update'](_0x649908)[_0x9d13('0x1f')](function(_0x3706e7){return _0x3706e7;});}return null;};}function removeEntity(_0x204f8a,_0x1fefe4){return function(_0x3971e0){if(_0x3971e0){return _0x3971e0[_0x9d13('0x20')]()[_0x9d13('0x1f')](function(){_0x204f8a[_0x9d13('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0xb34817,_0xd5a981){return function(_0x22963f){if(!_0x22963f){_0xb34817[_0x9d13('0x15')](0x194);}return _0x22963f;};}function handleError(_0x517003,_0xe02b36){_0xe02b36=_0xe02b36||0x1f4;return function(_0x5203e3){logger[_0x9d13('0x21')](_0x5203e3[_0x9d13('0x22')]);if(_0x5203e3[_0x9d13('0x23')]){delete _0x5203e3[_0x9d13('0x23')];}_0x517003[_0x9d13('0x16')](_0xe02b36)[_0x9d13('0x24')](_0x5203e3);};}exports[_0x9d13('0x25')]=function(_0xb2a42d,_0x5d854e){var _0x2e7fa1={},_0x4edc05={},_0x3600ab={'count':0x0,'rows':[]};var _0x420926=_[_0x9d13('0x26')](db[_0x9d13('0x27')][_0x9d13('0x28')],function(_0x23c91f){return{'name':_0x23c91f[_0x9d13('0x29')],'type':_0x23c91f[_0x9d13('0x2a')][_0x9d13('0x2b')]};});_0x4edc05[_0x9d13('0x2c')]=_[_0x9d13('0x26')](_0x420926,_0x9d13('0x23'));_0x4edc05['query']=_[_0x9d13('0x2d')](_0xb2a42d['query']);_0x4edc05[_0x9d13('0x2e')]=_[_0x9d13('0x2f')](_0x4edc05['model'],_0x4edc05[_0x9d13('0x30')]);_0x2e7fa1[_0x9d13('0x31')]=_['intersection'](_0x4edc05['model'],qs['fields'](_0xb2a42d[_0x9d13('0x30')]['fields']));_0x2e7fa1[_0x9d13('0x31')]=_0x2e7fa1[_0x9d13('0x31')][_0x9d13('0x32')]?_0x2e7fa1['attributes']:_0x4edc05[_0x9d13('0x2c')];if(!_0xb2a42d[_0x9d13('0x30')][_0x9d13('0x33')](_0x9d13('0x34'))){_0x2e7fa1['limit']=qs['limit'](_0xb2a42d[_0x9d13('0x30')][_0x9d13('0x1a')]);_0x2e7fa1['offset']=qs[_0x9d13('0x19')](_0xb2a42d[_0x9d13('0x30')][_0x9d13('0x19')]);}_0x2e7fa1[_0x9d13('0x35')]=qs[_0x9d13('0x36')](_0xb2a42d[_0x9d13('0x30')][_0x9d13('0x36')]);_0x2e7fa1['where']=qs[_0x9d13('0x2e')](_['pick'](_0xb2a42d['query'],_0x4edc05['filters']));if(_0xb2a42d[_0x9d13('0x30')][_0x9d13('0x37')]){_0x2e7fa1[_0x9d13('0x38')]=_[_0x9d13('0x39')](_0x2e7fa1[_0x9d13('0x38')],{'$or':_['map'](_0x420926,function(_0x1a00ba){if(_0x1a00ba[_0x9d13('0x2a')]!==_0x9d13('0x3a')){var _0x2bad38={};_0x2bad38[_0x1a00ba[_0x9d13('0x23')]]={'$like':'%'+_0xb2a42d[_0x9d13('0x30')]['filter']+'%'};return _0x2bad38;}})});}_0x2e7fa1=_[_0x9d13('0x39')]({},_0x2e7fa1,_0xb2a42d[_0x9d13('0x3b')]);var _0x287d0b={'where':_0x2e7fa1['where']};return db['FreshsalesField'][_0x9d13('0x18')](_0x287d0b)[_0x9d13('0x1f')](function(_0x2f96cf){_0x3600ab['count']=_0x2f96cf;if(_0xb2a42d[_0x9d13('0x30')][_0x9d13('0x3c')]){_0x2e7fa1['include']=[{'all':!![]}];}return db[_0x9d13('0x27')][_0x9d13('0x3d')](_0x2e7fa1);})[_0x9d13('0x1f')](function(_0x46ea19){_0x3600ab[_0x9d13('0x3e')]=_0x46ea19;return _0x3600ab;})[_0x9d13('0x1f')](respondWithFilteredResult(_0x5d854e,_0x2e7fa1))[_0x9d13('0x3f')](handleError(_0x5d854e,null));};exports[_0x9d13('0x40')]=function(_0x2a2132,_0x5033b3){var _0x56943={'raw':!![],'where':{'id':_0x2a2132[_0x9d13('0x41')]['id']}},_0x1d2ee6={};_0x1d2ee6[_0x9d13('0x2c')]=_[_0x9d13('0x2d')](db[_0x9d13('0x27')][_0x9d13('0x28')]);_0x1d2ee6['query']=_[_0x9d13('0x2d')](_0x2a2132[_0x9d13('0x30')]);_0x1d2ee6[_0x9d13('0x2e')]=_[_0x9d13('0x2f')](_0x1d2ee6[_0x9d13('0x2c')],_0x1d2ee6[_0x9d13('0x30')]);_0x56943['attributes']=_['intersection'](_0x1d2ee6[_0x9d13('0x2c')],qs['fields'](_0x2a2132[_0x9d13('0x30')]['fields']));_0x56943[_0x9d13('0x31')]=_0x56943[_0x9d13('0x31')][_0x9d13('0x32')]?_0x56943[_0x9d13('0x31')]:_0x1d2ee6[_0x9d13('0x2c')];if(_0x2a2132['query'][_0x9d13('0x3c')]){_0x56943[_0x9d13('0x42')]=[{'all':!![]}];}_0x56943=_[_0x9d13('0x39')]({},_0x56943,_0x2a2132[_0x9d13('0x3b')]);return db[_0x9d13('0x27')][_0x9d13('0x43')](_0x56943)[_0x9d13('0x1f')](handleEntityNotFound(_0x5033b3,null))[_0x9d13('0x1f')](respondWithResult(_0x5033b3,null))[_0x9d13('0x3f')](handleError(_0x5033b3,null));};exports[_0x9d13('0x44')]=function(_0x56ef0f,_0x54446e){return db[_0x9d13('0x27')][_0x9d13('0x44')](_0x56ef0f['body'],{})[_0x9d13('0x1f')](respondWithResult(_0x54446e,0xc9))['catch'](handleError(_0x54446e,null));};exports[_0x9d13('0x45')]=function(_0x20b834,_0x503850){if(_0x20b834['body']['id']){delete _0x20b834[_0x9d13('0x46')]['id'];}return db[_0x9d13('0x27')][_0x9d13('0x43')]({'where':{'id':_0x20b834[_0x9d13('0x41')]['id']}})[_0x9d13('0x1f')](handleEntityNotFound(_0x503850,null))[_0x9d13('0x1f')](saveUpdates(_0x20b834[_0x9d13('0x46')],null))[_0x9d13('0x1f')](respondWithResult(_0x503850,null))[_0x9d13('0x3f')](handleError(_0x503850,null));};exports['destroy']=function(_0x3a2177,_0x5b0c6e){return db['FreshsalesField'][_0x9d13('0x43')]({'where':{'id':_0x3a2177['params']['id']}})[_0x9d13('0x1f')](handleEntityNotFound(_0x5b0c6e,null))[_0x9d13('0x1f')](removeEntity(_0x5b0c6e,null))[_0x9d13('0x3f')](handleError(_0x5b0c6e,null));}; \ No newline at end of file +var _0x9c00=['squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','apply','save','update','then','destroy','stack','name','send','index','map','FreshsalesField','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','pick','filter','merge','options','includeAll','findAll','rows','catch','show','keys','include','find','create','body','params','html-pdf','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','lodash'];(function(_0x44dafd,_0x5cc823){var _0xfccbf5=function(_0x14ff2a){while(--_0x14ff2a){_0x44dafd['push'](_0x44dafd['shift']());}};_0xfccbf5(++_0x5cc823);}(_0x9c00,0x1a0));var _0x09c0=function(_0x1c013d,_0x15a3df){_0x1c013d=_0x1c013d-0x0;var _0xda7764=_0x9c00[_0x1c013d];return _0xda7764;};'use strict';var pdf=require(_0x09c0('0x0'));var emlformat=require(_0x09c0('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x09c0('0x2'));var rp=require(_0x09c0('0x3'));var moment=require('moment');var BPromise=require(_0x09c0('0x4'));var Mustache=require(_0x09c0('0x5'));var util=require(_0x09c0('0x6'));var path=require(_0x09c0('0x7'));var sox=require(_0x09c0('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x09c0('0x9'));var squel=require(_0x09c0('0xa'));var crypto=require(_0x09c0('0xb'));var jsforce=require(_0x09c0('0xc'));var deskjs=require(_0x09c0('0xd'));var toCsv=require('to-csv');var querystring=require(_0x09c0('0xe'));var Papa=require(_0x09c0('0xf'));var Redis=require(_0x09c0('0x10'));var authService=require(_0x09c0('0x11'));var qs=require(_0x09c0('0x12'));var as=require(_0x09c0('0x13'));var hardwareService=require(_0x09c0('0x14'));var logger=require(_0x09c0('0x15'))(_0x09c0('0x16'));var utils=require(_0x09c0('0x17'));var config=require(_0x09c0('0x18'));var db=require(_0x09c0('0x19'))['db'];function respondWithStatusCode(_0x2929f1,_0x144271){_0x144271=_0x144271||0xcc;return function(_0x3b95cc){if(_0x3b95cc){return _0x2929f1[_0x09c0('0x1a')](_0x144271);}return _0x2929f1[_0x09c0('0x1b')](_0x144271)[_0x09c0('0x1c')]();};}function respondWithResult(_0x342ceb,_0x3649d2){_0x3649d2=_0x3649d2||0xc8;return function(_0x16e490){if(_0x16e490){return _0x342ceb[_0x09c0('0x1b')](_0x3649d2)[_0x09c0('0x1d')](_0x16e490);}};}function respondWithFilteredResult(_0x45a265,_0x33c3d6){return function(_0x2fdf11){if(_0x2fdf11){var _0x4ff6b7=_0x2fdf11[_0x09c0('0x1e')],_0x590129=_0x33c3d6[_0x09c0('0x1f')],_0x558b4f=_0x33c3d6[_0x09c0('0x1f')]+_0x33c3d6['limit'],_0x42030d;if(_0x558b4f>=_0x4ff6b7){_0x558b4f=_0x4ff6b7;_0x42030d=0xc8;}else{_0x42030d=0xce;}_0x45a265[_0x09c0('0x1b')](_0x42030d);return _0x45a265['set']('Content-Range',_0x590129+'-'+_0x558b4f+'/'+_0x4ff6b7)[_0x09c0('0x1d')](_0x2fdf11);}return null;};}function patchUpdates(_0x50fccc){return function(_0x2cda5e){try{jsonpatch[_0x09c0('0x20')](_0x2cda5e,_0x50fccc,!![]);}catch(_0x2da257){return BPromise['reject'](_0x2da257);}return _0x2cda5e[_0x09c0('0x21')]();};}function saveUpdates(_0x44f714,_0x8ad645){return function(_0x3447c5){if(_0x3447c5){return _0x3447c5[_0x09c0('0x22')](_0x44f714)[_0x09c0('0x23')](function(_0x8c6b9a){return _0x8c6b9a;});}return null;};}function removeEntity(_0x5d5391,_0x1695e8){return function(_0x46f171){if(_0x46f171){return _0x46f171[_0x09c0('0x24')]()[_0x09c0('0x23')](function(){_0x5d5391['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x321bcc,_0x25fdb5){return function(_0x1e8a1c){if(!_0x1e8a1c){_0x321bcc[_0x09c0('0x1a')](0x194);}return _0x1e8a1c;};}function handleError(_0x491e6f,_0x42ebfc){_0x42ebfc=_0x42ebfc||0x1f4;return function(_0x120418){logger['error'](_0x120418[_0x09c0('0x25')]);if(_0x120418[_0x09c0('0x26')]){delete _0x120418[_0x09c0('0x26')];}_0x491e6f[_0x09c0('0x1b')](_0x42ebfc)[_0x09c0('0x27')](_0x120418);};}exports[_0x09c0('0x28')]=function(_0x45cc64,_0x35b61c){var _0x1ea951={},_0x1aa80e={},_0x46a36a={'count':0x0,'rows':[]};var _0x5e53ac=_[_0x09c0('0x29')](db[_0x09c0('0x2a')]['rawAttributes'],function(_0x1d09e0){return{'name':_0x1d09e0['fieldName'],'type':_0x1d09e0[_0x09c0('0x2b')]['key']};});_0x1aa80e[_0x09c0('0x2c')]=_[_0x09c0('0x29')](_0x5e53ac,_0x09c0('0x26'));_0x1aa80e[_0x09c0('0x2d')]=_['keys'](_0x45cc64['query']);_0x1aa80e[_0x09c0('0x2e')]=_[_0x09c0('0x2f')](_0x1aa80e[_0x09c0('0x2c')],_0x1aa80e['query']);_0x1ea951[_0x09c0('0x30')]=_['intersection'](_0x1aa80e[_0x09c0('0x2c')],qs[_0x09c0('0x31')](_0x45cc64[_0x09c0('0x2d')]['fields']));_0x1ea951[_0x09c0('0x30')]=_0x1ea951[_0x09c0('0x30')][_0x09c0('0x32')]?_0x1ea951[_0x09c0('0x30')]:_0x1aa80e[_0x09c0('0x2c')];if(!_0x45cc64[_0x09c0('0x2d')][_0x09c0('0x33')]('nolimit')){_0x1ea951[_0x09c0('0x34')]=qs[_0x09c0('0x34')](_0x45cc64[_0x09c0('0x2d')][_0x09c0('0x34')]);_0x1ea951[_0x09c0('0x1f')]=qs['offset'](_0x45cc64[_0x09c0('0x2d')][_0x09c0('0x1f')]);}_0x1ea951[_0x09c0('0x35')]=qs[_0x09c0('0x36')](_0x45cc64[_0x09c0('0x2d')]['sort']);_0x1ea951[_0x09c0('0x37')]=qs[_0x09c0('0x2e')](_[_0x09c0('0x38')](_0x45cc64[_0x09c0('0x2d')],_0x1aa80e[_0x09c0('0x2e')]));if(_0x45cc64[_0x09c0('0x2d')][_0x09c0('0x39')]){_0x1ea951['where']=_[_0x09c0('0x3a')](_0x1ea951[_0x09c0('0x37')],{'$or':_[_0x09c0('0x29')](_0x5e53ac,function(_0x1104b9){if(_0x1104b9[_0x09c0('0x2b')]!=='VIRTUAL'){var _0x5420fd={};_0x5420fd[_0x1104b9['name']]={'$like':'%'+_0x45cc64['query'][_0x09c0('0x39')]+'%'};return _0x5420fd;}})});}_0x1ea951=_[_0x09c0('0x3a')]({},_0x1ea951,_0x45cc64[_0x09c0('0x3b')]);var _0x2cd7cc={'where':_0x1ea951[_0x09c0('0x37')]};return db['FreshsalesField'][_0x09c0('0x1e')](_0x2cd7cc)[_0x09c0('0x23')](function(_0x5374fa){_0x46a36a[_0x09c0('0x1e')]=_0x5374fa;if(_0x45cc64['query'][_0x09c0('0x3c')]){_0x1ea951['include']=[{'all':!![]}];}return db[_0x09c0('0x2a')][_0x09c0('0x3d')](_0x1ea951);})['then'](function(_0x26a21c){_0x46a36a[_0x09c0('0x3e')]=_0x26a21c;return _0x46a36a;})['then'](respondWithFilteredResult(_0x35b61c,_0x1ea951))[_0x09c0('0x3f')](handleError(_0x35b61c,null));};exports[_0x09c0('0x40')]=function(_0xb8a592,_0x27e4fb){var _0xeb8191={'raw':!![],'where':{'id':_0xb8a592['params']['id']}},_0x34326c={};_0x34326c[_0x09c0('0x2c')]=_[_0x09c0('0x41')](db[_0x09c0('0x2a')]['rawAttributes']);_0x34326c[_0x09c0('0x2d')]=_[_0x09c0('0x41')](_0xb8a592[_0x09c0('0x2d')]);_0x34326c['filters']=_[_0x09c0('0x2f')](_0x34326c[_0x09c0('0x2c')],_0x34326c['query']);_0xeb8191['attributes']=_[_0x09c0('0x2f')](_0x34326c[_0x09c0('0x2c')],qs['fields'](_0xb8a592[_0x09c0('0x2d')][_0x09c0('0x31')]));_0xeb8191['attributes']=_0xeb8191[_0x09c0('0x30')][_0x09c0('0x32')]?_0xeb8191[_0x09c0('0x30')]:_0x34326c[_0x09c0('0x2c')];if(_0xb8a592[_0x09c0('0x2d')]['includeAll']){_0xeb8191[_0x09c0('0x42')]=[{'all':!![]}];}_0xeb8191=_['merge']({},_0xeb8191,_0xb8a592['options']);return db[_0x09c0('0x2a')][_0x09c0('0x43')](_0xeb8191)[_0x09c0('0x23')](handleEntityNotFound(_0x27e4fb,null))[_0x09c0('0x23')](respondWithResult(_0x27e4fb,null))[_0x09c0('0x3f')](handleError(_0x27e4fb,null));};exports[_0x09c0('0x44')]=function(_0x52a4ff,_0x5e239a){return db['FreshsalesField'][_0x09c0('0x44')](_0x52a4ff[_0x09c0('0x45')],{})[_0x09c0('0x23')](respondWithResult(_0x5e239a,0xc9))['catch'](handleError(_0x5e239a,null));};exports[_0x09c0('0x22')]=function(_0xff9650,_0x2016f1){if(_0xff9650[_0x09c0('0x45')]['id']){delete _0xff9650[_0x09c0('0x45')]['id'];}return db[_0x09c0('0x2a')][_0x09c0('0x43')]({'where':{'id':_0xff9650[_0x09c0('0x46')]['id']}})[_0x09c0('0x23')](handleEntityNotFound(_0x2016f1,null))[_0x09c0('0x23')](saveUpdates(_0xff9650[_0x09c0('0x45')],null))[_0x09c0('0x23')](respondWithResult(_0x2016f1,null))[_0x09c0('0x3f')](handleError(_0x2016f1,null));};exports[_0x09c0('0x24')]=function(_0x332b69,_0x32abbe){return db[_0x09c0('0x2a')][_0x09c0('0x43')]({'where':{'id':_0x332b69[_0x09c0('0x46')]['id']}})[_0x09c0('0x23')](handleEntityNotFound(_0x32abbe,null))['then'](removeEntity(_0x32abbe,null))[_0x09c0('0x3f')](handleError(_0x32abbe,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 9637479..9dae3e5 100644 --- a/server/api/intFreshsalesField/intFreshsalesField.model.js +++ b/server/api/intFreshsalesField/intFreshsalesField.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70d2=['bluebird','request-promise','path','../../config/environment','./intFreshsalesField.attributes','exports','define','FreshsalesField','int_freshsales_fields','freshsales_unique_index','idField','FieldId','lodash','util','moment'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x70d2,0x93));var _0x270d=function(_0x3585e5,_0x1033c2){_0x3585e5=_0x3585e5-0x0;var _0x32ae8e=_0x70d2[_0x3585e5];return _0x32ae8e;};'use strict';var _=require(_0x270d('0x0'));var util=require(_0x270d('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x270d('0x2'));var BPromise=require(_0x270d('0x3'));var rp=require(_0x270d('0x4'));var fs=require('fs');var path=require(_0x270d('0x5'));var rimraf=require('rimraf');var config=require(_0x270d('0x6'));var attributes=require(_0x270d('0x7'));module[_0x270d('0x8')]=function(_0x478dd3,_0x1e10ea){return _0x478dd3[_0x270d('0x9')](_0x270d('0xa'),attributes,{'tableName':_0x270d('0xb'),'paranoid':![],'indexes':[{'name':_0x270d('0xc'),'fields':[_0x270d('0xd'),_0x270d('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xeb8c=['request-promise','rimraf','../../config/environment','./intFreshsalesField.attributes','FreshsalesField','idField','util','../../config/logger','api','moment'];(function(_0x591cfd,_0x501204){var _0x4d0100=function(_0xb9ff0c){while(--_0xb9ff0c){_0x591cfd['push'](_0x591cfd['shift']());}};_0x4d0100(++_0x501204);}(_0xeb8c,0xce));var _0xceb8=function(_0x1b5c15,_0x471697){_0x1b5c15=_0x1b5c15-0x0;var _0x4c7210=_0xeb8c[_0x1b5c15];return _0x4c7210;};'use strict';var _=require('lodash');var util=require(_0xceb8('0x0'));var logger=require(_0xceb8('0x1'))(_0xceb8('0x2'));var moment=require(_0xceb8('0x3'));var BPromise=require('bluebird');var rp=require(_0xceb8('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xceb8('0x5'));var config=require(_0xceb8('0x6'));var attributes=require(_0xceb8('0x7'));module['exports']=function(_0x5b25e3,_0x2c0e18){return _0x5b25e3['define'](_0xceb8('0x8'),attributes,{'tableName':'int_freshsales_fields','paranoid':![],'indexes':[{'name':'freshsales_unique_index','fields':[_0xceb8('0x9'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.rpc.js b/server/api/intFreshsalesField/intFreshsalesField.rpc.js index 274945d..fc08732 100644 --- a/server/api/intFreshsalesField/intFreshsalesField.rpc.js +++ b/server/api/intFreshsalesField/intFreshsalesField.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x555f=['error','code','message','result','catch','lodash','moment','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','http','request','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','FreshsalesField,\x20%s,\x20%s,\x20%s'];(function(_0xe1a3a5,_0xd3e341){var _0x362646=function(_0xdcef03){while(--_0xdcef03){_0xe1a3a5['push'](_0xe1a3a5['shift']());}};_0x362646(++_0xd3e341);}(_0x555f,0x1e0));var _0xf555=function(_0x5d6270,_0x83b57a){_0x5d6270=_0x5d6270-0x0;var _0x168f26=_0x555f[_0x5d6270];return _0x168f26;};'use strict';var _=require(_0xf555('0x0'));var util=require('util');var moment=require(_0xf555('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf555('0x2'));var db=require(_0xf555('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xf555('0x4'));var config=require(_0xf555('0x5'));var jayson=require(_0xf555('0x6'));var client=jayson['client'][_0xf555('0x7')]({'port':0x232a});function respondWithRpcPromise(_0xc5080c,_0x3d4795,_0x3f9c15){return new BPromise(function(_0x8685b9,_0x31ea83){return client[_0xf555('0x8')](_0xc5080c,_0x3f9c15)['then'](function(_0x52c540){logger[_0xf555('0x9')](_0xf555('0xa'),_0x3d4795,_0xf555('0xb'));logger[_0xf555('0xc')](_0xf555('0xd'),_0x3d4795,_0xf555('0xb'),JSON['stringify'](_0x52c540));if(_0x52c540[_0xf555('0xe')]){if(_0x52c540[_0xf555('0xe')][_0xf555('0xf')]===0x1f4){logger['error']('FreshsalesField,\x20%s,\x20%s',_0x3d4795,_0x52c540[_0xf555('0xe')]['message']);return _0x31ea83(_0x52c540[_0xf555('0xe')][_0xf555('0x10')]);}logger['error'](_0xf555('0xa'),_0x3d4795,_0x52c540['error']['message']);return _0x8685b9(_0x52c540['error'][_0xf555('0x10')]);}else{logger[_0xf555('0x9')]('FreshsalesField,\x20%s,\x20%s',_0x3d4795,_0xf555('0xb'));_0x8685b9(_0x52c540[_0xf555('0x11')][_0xf555('0x10')]);}})[_0xf555('0x12')](function(_0x446361){logger[_0xf555('0xe')](_0xf555('0xa'),_0x3d4795,_0x446361);_0x31ea83(_0x446361);});});} \ No newline at end of file +var _0xa46e=['request','then','request\x20sent','debug','stringify','error','code','message','FreshsalesField,\x20%s,\x20%s','info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','http'];(function(_0x50b850,_0x797ed2){var _0x348619=function(_0x2b12f5){while(--_0x2b12f5){_0x50b850['push'](_0x50b850['shift']());}};_0x348619(++_0x797ed2);}(_0xa46e,0x8a));var _0xea46=function(_0x1d426f,_0x37e919){_0x1d426f=_0x1d426f-0x0;var _0x17f71a=_0xa46e[_0x1d426f];return _0x17f71a;};'use strict';var _=require(_0xea46('0x0'));var util=require(_0xea46('0x1'));var moment=require('moment');var BPromise=require(_0xea46('0x2'));var rs=require(_0xea46('0x3'));var fs=require('fs');var Redis=require(_0xea46('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xea46('0x5'));var logger=require('../../config/logger')(_0xea46('0x6'));var config=require('../../config/environment');var jayson=require(_0xea46('0x7'));var client=jayson['client'][_0xea46('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3dc26f,_0x5f1cd1,_0x2d1b30){return new BPromise(function(_0x42771a,_0xe7d428){return client[_0xea46('0x9')](_0x3dc26f,_0x2d1b30)[_0xea46('0xa')](function(_0x4cf206){logger['info']('FreshsalesField,\x20%s,\x20%s',_0x5f1cd1,_0xea46('0xb'));logger[_0xea46('0xc')]('FreshsalesField,\x20%s,\x20%s,\x20%s',_0x5f1cd1,_0xea46('0xb'),JSON[_0xea46('0xd')](_0x4cf206));if(_0x4cf206[_0xea46('0xe')]){if(_0x4cf206['error'][_0xea46('0xf')]===0x1f4){logger[_0xea46('0xe')]('FreshsalesField,\x20%s,\x20%s',_0x5f1cd1,_0x4cf206[_0xea46('0xe')][_0xea46('0x10')]);return _0xe7d428(_0x4cf206['error'][_0xea46('0x10')]);}logger['error'](_0xea46('0x11'),_0x5f1cd1,_0x4cf206[_0xea46('0xe')][_0xea46('0x10')]);return _0x42771a(_0x4cf206[_0xea46('0xe')][_0xea46('0x10')]);}else{logger[_0xea46('0x12')](_0xea46('0x11'),_0x5f1cd1,_0xea46('0xb'));_0x42771a(_0x4cf206[_0xea46('0x13')]['message']);}})[_0xea46('0x14')](function(_0xbf225e){logger[_0xea46('0xe')]('FreshsalesField,\x20%s,\x20%s',_0x5f1cd1,_0xbf225e);_0xe7d428(_0xbf225e);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index a2e8555..a5475d2 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 _0x1b8c=['addConfiguration','put','update','exports','multer','path','Router','../../components/auth/service','../../config/environment','./intSalesforceAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','post','create'];(function(_0x21549c,_0x6d64d1){var _0x426cbd=function(_0x323f5b){while(--_0x323f5b){_0x21549c['push'](_0x21549c['shift']());}};_0x426cbd(++_0x6d64d1);}(_0x1b8c,0x130));var _0xc1b8=function(_0x4ba77a,_0x26a598){_0x4ba77a=_0x4ba77a-0x0;var _0x2c2410=_0x1b8c[_0x4ba77a];return _0x2c2410;};'use strict';var multer=require(_0xc1b8('0x0'));var util=require('util');var path=require(_0xc1b8('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xc1b8('0x2')]();var auth=require(_0xc1b8('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xc1b8('0x4'));var controller=require(_0xc1b8('0x5'));router[_0xc1b8('0x6')]('/',auth[_0xc1b8('0x7')](),controller[_0xc1b8('0x8')]);router[_0xc1b8('0x6')](_0xc1b8('0x9'),auth['isAuthenticated'](),controller[_0xc1b8('0xa')]);router[_0xc1b8('0x6')](_0xc1b8('0xb'),auth['isAuthenticated'](),controller[_0xc1b8('0xc')]);router[_0xc1b8('0x6')](_0xc1b8('0xd'),auth[_0xc1b8('0x7')](),controller['getFields']);router[_0xc1b8('0xe')]('/',auth[_0xc1b8('0x7')](),controller[_0xc1b8('0xf')]);router[_0xc1b8('0xe')](_0xc1b8('0xb'),auth['isAuthenticated'](),controller[_0xc1b8('0x10')]);router[_0xc1b8('0x11')](_0xc1b8('0x9'),auth['isAuthenticated'](),controller[_0xc1b8('0x12')]);router['delete'](_0xc1b8('0x9'),auth[_0xc1b8('0x7')](),controller['destroy']);module[_0xc1b8('0x13')]=router; \ No newline at end of file +var _0xc1fe=['get','/:id/configurations','getFields','post','create','addConfiguration','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','isAuthenticated','index','show'];(function(_0x43d0bb,_0x57222a){var _0x2f54ba=function(_0x11dc29){while(--_0x11dc29){_0x43d0bb['push'](_0x43d0bb['shift']());}};_0x2f54ba(++_0x57222a);}(_0xc1fe,0xdd));var _0xec1f=function(_0x4361d3,_0x3478ed){_0x4361d3=_0x4361d3-0x0;var _0x8fe292=_0xc1fe[_0x4361d3];return _0x8fe292;};'use strict';var multer=require(_0xec1f('0x0'));var util=require(_0xec1f('0x1'));var path=require(_0xec1f('0x2'));var timeout=require(_0xec1f('0x3'));var express=require('express');var router=express[_0xec1f('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xec1f('0x5'));var config=require(_0xec1f('0x6'));var controller=require('./intSalesforceAccount.controller');router['get']('/',auth[_0xec1f('0x7')](),controller[_0xec1f('0x8')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xec1f('0x9')]);router[_0xec1f('0xa')](_0xec1f('0xb'),auth[_0xec1f('0x7')](),controller['getConfigurations']);router[_0xec1f('0xa')]('/:id/fields',auth[_0xec1f('0x7')](),controller[_0xec1f('0xc')]);router[_0xec1f('0xd')]('/',auth['isAuthenticated'](),controller[_0xec1f('0xe')]);router[_0xec1f('0xd')](_0xec1f('0xb'),auth[_0xec1f('0x7')](),controller[_0xec1f('0xf')]);router['put'](_0xec1f('0x10'),auth[_0xec1f('0x7')](),controller[_0xec1f('0x11')]);router[_0xec1f('0x12')](_0xec1f('0x10'),auth[_0xec1f('0x7')](),controller[_0xec1f('0x13')]);module[_0xec1f('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index 24a77ab..4b433aa 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 _0x53ec=['ENUM','newTab','integrationTab','sequelize','exports','STRING','username'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x53ec,0x192));var _0xc53e=function(_0x72c194,_0x1a953a){_0x72c194=_0x72c194-0x0;var _0x1f4f68=_0x53ec[_0x72c194];return _0x1f4f68;};'use strict';var Sequelize=require(_0xc53e('0x0'));module[_0xc53e('0x1')]={'name':{'type':Sequelize[_0xc53e('0x2')]},'description':{'type':Sequelize[_0xc53e('0x2')]},'username':{'type':Sequelize[_0xc53e('0x2')],'unique':_0xc53e('0x3')},'remoteUri':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xc53e('0x2')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0xc53e('0x2')]},'securityToken':{'type':Sequelize[_0xc53e('0x2')]},'serverUrl':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xc53e('0x4')]('integrationTab',_0xc53e('0x5')),'defaultValue':_0xc53e('0x6')}}; \ No newline at end of file +var _0x1261=['STRING','username','integrationTab','newTab','exports'];(function(_0x2e5256,_0x21ed55){var _0xa380ae=function(_0x43dffc){while(--_0x43dffc){_0x2e5256['push'](_0x2e5256['shift']());}};_0xa380ae(++_0x21ed55);}(_0x1261,0x144));var _0x1126=function(_0x22b70f,_0x4c853f){_0x22b70f=_0x22b70f-0x0;var _0x100985=_0x1261[_0x22b70f];return _0x100985;};'use strict';var Sequelize=require('sequelize');module[_0x1126('0x0')]={'name':{'type':Sequelize[_0x1126('0x1')]},'description':{'type':Sequelize[_0x1126('0x1')]},'username':{'type':Sequelize[_0x1126('0x1')],'unique':_0x1126('0x2')},'remoteUri':{'type':Sequelize[_0x1126('0x1')]},'password':{'type':Sequelize[_0x1126('0x1')]},'clientId':{'type':Sequelize[_0x1126('0x1')]},'clientSecret':{'type':Sequelize[_0x1126('0x1')]},'securityToken':{'type':Sequelize[_0x1126('0x1')]},'serverUrl':{'type':Sequelize['STRING']},'type':{'type':Sequelize['ENUM'](_0x1126('0x3'),_0x1126('0x4')),'defaultValue':'integrationTab'}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index b8d61ad..ca33833 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 _0x7a54=['rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','status','json','count','offset','set','Content-Range','apply','destroy','sendStatus','name','index','map','SalesforceAccount','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','where','merge','VIRTUAL','filter','options','includeAll','findAll','rows','show','params','rawAttributes','include','find','create','body','update','SalesforceConfiguration','getConfigurations','addConfiguration','findOne','AccountId','channel','type','Descriptions','getDescriptions','SalesforceField','Subjects','getFields','Task','remoteUri','clientId','clientSecret','username','slice','substring','lastIndexOf','Connection','login','password','concat','securityToken','isNil','ticketType','sobject','CallDisposition','CallDurationInSeconds','CallObject','CallType','IsArchived','Priority','Case','Origin','IsEscalated','SuppliedCompany','remove','custom','picklistValues','label','value','boolean','True','true','False','false','statusCode','getFields,\x20%s,\x20%s,\x20%s','send','html-pdf','eml-format'];(function(_0x46085b,_0x4833f9){var _0x1a4a91=function(_0x5b7638){while(--_0x5b7638){_0x46085b['push'](_0x46085b['shift']());}};_0x1a4a91(++_0x4833f9);}(_0x7a54,0x106));var _0x47a5=function(_0x5b5b18,_0x42667b){_0x5b5b18=_0x5b5b18-0x0;var _0x2c9298=_0x7a54[_0x5b5b18];return _0x2c9298;};'use strict';var pdf=require(_0x47a5('0x0'));var emlformat=require(_0x47a5('0x1'));var rimraf=require(_0x47a5('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x47a5('0x3'));var rp=require(_0x47a5('0x4'));var moment=require('moment');var BPromise=require(_0x47a5('0x5'));var Mustache=require(_0x47a5('0x6'));var util=require(_0x47a5('0x7'));var path=require(_0x47a5('0x8'));var sox=require(_0x47a5('0x9'));var csv=require('to-csv');var ejs=require(_0x47a5('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var db=require(_0x47a5('0x14'))['db'];var integrations=require(_0x47a5('0x15'));var jayson=require(_0x47a5('0x16'));var client=jayson[_0x47a5('0x17')]['http']({'port':0x232a});function checkPasswordPattern(_0x44bd3e,_0x221b54,_0x1cf309){if(_0x1cf309){var _0x711793=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x711793[_0x47a5('0x18')](_0x221b54)){return _0x44bd3e;}else{throw new db[(_0x47a5('0x19'))][(_0x47a5('0x1a'))](_0x47a5('0x1b'));}}else{return _0x44bd3e;}}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')]('SalesforceAccount,\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=_[_0x47a5('0x31')](db[_0x47a5('0x32')]['rawAttributes'],function(_0x396a9a){return{'name':_0x396a9a[_0x47a5('0x33')],'type':_0x396a9a['type'][_0x47a5('0x34')]};});_0x36add5[_0x47a5('0x35')]=_[_0x47a5('0x31')](_0xee582c,'name');_0x36add5[_0x47a5('0x36')]=_[_0x47a5('0x37')](_0x3534cb['query']);_0x36add5[_0x47a5('0x38')]=_[_0x47a5('0x39')](_0x36add5['model'],_0x36add5['query']);_0x199698['attributes']=_[_0x47a5('0x39')](_0x36add5['model'],qs[_0x47a5('0x3a')](_0x3534cb[_0x47a5('0x36')][_0x47a5('0x3a')]));_0x199698[_0x47a5('0x3b')]=_0x199698[_0x47a5('0x3b')][_0x47a5('0x3c')]?_0x199698[_0x47a5('0x3b')]:_0x36add5[_0x47a5('0x35')];if(!_0x3534cb[_0x47a5('0x36')][_0x47a5('0x3d')](_0x47a5('0x3e'))){_0x199698[_0x47a5('0x3f')]=qs[_0x47a5('0x3f')](_0x3534cb['query'][_0x47a5('0x3f')]);_0x199698[_0x47a5('0x29')]=qs[_0x47a5('0x29')](_0x3534cb[_0x47a5('0x36')]['offset']);}_0x199698[_0x47a5('0x40')]=qs['sort'](_0x3534cb['query']['sort']);_0x199698['where']=qs[_0x47a5('0x38')](_['pick'](_0x3534cb[_0x47a5('0x36')],_0x36add5[_0x47a5('0x38')]));if(_0x3534cb[_0x47a5('0x36')]['filter']){_0x199698[_0x47a5('0x41')]=_[_0x47a5('0x42')](_0x199698['where'],{'$or':_['map'](_0xee582c,function(_0xbe21d9){if(_0xbe21d9['type']!==_0x47a5('0x43')){var _0x4703b2={};_0x4703b2[_0xbe21d9[_0x47a5('0x2f')]]={'$like':'%'+_0x3534cb[_0x47a5('0x36')][_0x47a5('0x44')]+'%'};return _0x4703b2;}})});}_0x199698=_[_0x47a5('0x42')]({},_0x199698,_0x3534cb[_0x47a5('0x45')]);var _0x17cc42={'where':_0x199698[_0x47a5('0x41')]};return db[_0x47a5('0x32')][_0x47a5('0x28')](_0x17cc42)[_0x47a5('0x1c')](function(_0xe28d76){_0xed6320[_0x47a5('0x28')]=_0xe28d76;if(_0x3534cb[_0x47a5('0x36')][_0x47a5('0x46')]){_0x199698['include']=[{'all':!![]}];}return db[_0x47a5('0x32')][_0x47a5('0x47')](_0x199698);})['then'](function(_0x52b3a8){_0xed6320[_0x47a5('0x48')]=_0x52b3a8;return _0xed6320;})['then'](respondWithFilteredResult(_0x38c8d4,_0x199698))[_0x47a5('0x25')](handleError(_0x38c8d4,null));};exports[_0x47a5('0x49')]=function(_0x54c35f,_0x4f62d3){var _0x3d85cc={'raw':![],'where':{'id':_0x54c35f[_0x47a5('0x4a')]['id']}},_0x52d409={};_0x52d409[_0x47a5('0x35')]=_[_0x47a5('0x37')](db[_0x47a5('0x32')][_0x47a5('0x4b')]);_0x52d409[_0x47a5('0x36')]=_[_0x47a5('0x37')](_0x54c35f['query']);_0x52d409['filters']=_[_0x47a5('0x39')](_0x52d409[_0x47a5('0x35')],_0x52d409[_0x47a5('0x36')]);_0x3d85cc[_0x47a5('0x3b')]=_[_0x47a5('0x39')](_0x52d409[_0x47a5('0x35')],qs[_0x47a5('0x3a')](_0x54c35f['query'][_0x47a5('0x3a')]));_0x3d85cc[_0x47a5('0x3b')]=_0x3d85cc[_0x47a5('0x3b')]['length']?_0x3d85cc[_0x47a5('0x3b')]:_0x52d409['model'];if(_0x54c35f[_0x47a5('0x36')][_0x47a5('0x46')]){_0x3d85cc[_0x47a5('0x4c')]=[{'all':!![]}];}_0x3d85cc=_[_0x47a5('0x42')]({},_0x3d85cc,_0x54c35f['options']);return db[_0x47a5('0x32')][_0x47a5('0x4d')](_0x3d85cc)[_0x47a5('0x1c')](handleEntityNotFound(_0x4f62d3,null))[_0x47a5('0x1c')](respondWithResult(_0x4f62d3,null))[_0x47a5('0x25')](handleError(_0x4f62d3,null));};exports[_0x47a5('0x4e')]=function(_0x24e9f4,_0x481089){return db[_0x47a5('0x32')][_0x47a5('0x4e')](_0x24e9f4[_0x47a5('0x4f')],{})[_0x47a5('0x1c')](respondWithResult(_0x481089,0xc9))[_0x47a5('0x25')](handleError(_0x481089,null));};exports[_0x47a5('0x50')]=function(_0x572233,_0x1ad6a9){if(_0x572233[_0x47a5('0x4f')]['id']){delete _0x572233[_0x47a5('0x4f')]['id'];}return db['SalesforceAccount'][_0x47a5('0x4d')]({'where':{'id':_0x572233[_0x47a5('0x4a')]['id']}})[_0x47a5('0x1c')](handleEntityNotFound(_0x1ad6a9,null))['then'](saveUpdates(_0x572233['body'],null))[_0x47a5('0x1c')](respondWithResult(_0x1ad6a9,null))[_0x47a5('0x25')](handleError(_0x1ad6a9,null));};exports['destroy']=function(_0x4cf792,_0x6d6b2b){return db['SalesforceAccount'][_0x47a5('0x4d')]({'where':{'id':_0x4cf792['params']['id']}})['then'](handleEntityNotFound(_0x6d6b2b,null))[_0x47a5('0x1c')](removeEntity(_0x6d6b2b,null))[_0x47a5('0x25')](handleError(_0x6d6b2b,null));};exports['getConfigurations']=function(_0x1b958b,_0x72fe,_0x4b706a){var _0x5b6127={};var _0x16b4fd={};var _0x30d482;var _0x867da0;return db[_0x47a5('0x32')]['findOne']({'where':{'id':_0x1b958b[_0x47a5('0x4a')]['id']}})[_0x47a5('0x1c')](handleEntityNotFound(_0x72fe,null))[_0x47a5('0x1c')](function(_0x5a33b8){if(_0x5a33b8){_0x30d482=_0x5a33b8;_0x16b4fd[_0x47a5('0x35')]=_['keys'](db[_0x47a5('0x51')][_0x47a5('0x4b')]);_0x16b4fd[_0x47a5('0x36')]=_[_0x47a5('0x37')](_0x1b958b[_0x47a5('0x36')]);_0x16b4fd['filters']=_[_0x47a5('0x39')](_0x16b4fd['model'],_0x16b4fd['query']);_0x5b6127['attributes']=_['intersection'](_0x16b4fd[_0x47a5('0x35')],qs[_0x47a5('0x3a')](_0x1b958b[_0x47a5('0x36')]['fields']));_0x5b6127['attributes']=_0x5b6127[_0x47a5('0x3b')][_0x47a5('0x3c')]?_0x5b6127[_0x47a5('0x3b')]:_0x16b4fd[_0x47a5('0x35')];_0x5b6127[_0x47a5('0x40')]=qs['sort'](_0x1b958b[_0x47a5('0x36')]['sort']);_0x5b6127[_0x47a5('0x41')]=qs[_0x47a5('0x38')](_['pick'](_0x1b958b[_0x47a5('0x36')],_0x16b4fd[_0x47a5('0x38')]));if(_0x1b958b[_0x47a5('0x36')][_0x47a5('0x44')]){_0x5b6127[_0x47a5('0x41')]=_[_0x47a5('0x42')](_0x5b6127[_0x47a5('0x41')],{'$or':_[_0x47a5('0x31')](_0x5b6127['attributes'],function(_0x2dcc3b){var _0x2a3a57={};_0x2a3a57[_0x2dcc3b]={'$like':'%'+_0x1b958b[_0x47a5('0x36')][_0x47a5('0x44')]+'%'};return _0x2a3a57;})});}_0x5b6127=_[_0x47a5('0x42')]({},_0x5b6127,_0x1b958b['options']);return _0x30d482[_0x47a5('0x52')](_0x5b6127);}})[_0x47a5('0x1c')](function(_0x1224bc){if(_0x1224bc){_0x867da0=_0x1224bc[_0x47a5('0x3c')];if(!_0x1b958b[_0x47a5('0x36')][_0x47a5('0x3d')](_0x47a5('0x3e'))){_0x5b6127[_0x47a5('0x3f')]=qs[_0x47a5('0x3f')](_0x1b958b[_0x47a5('0x36')][_0x47a5('0x3f')]);_0x5b6127[_0x47a5('0x29')]=qs[_0x47a5('0x29')](_0x1b958b[_0x47a5('0x36')][_0x47a5('0x29')]);}return _0x30d482['getConfigurations'](_0x5b6127);}})[_0x47a5('0x1c')](function(_0x284fb8){if(_0x284fb8){return _0x284fb8?{'count':_0x867da0,'rows':_0x284fb8}:null;}})[_0x47a5('0x1c')](respondWithResult(_0x72fe,null))['catch'](handleError(_0x72fe,null));};exports[_0x47a5('0x53')]=function(_0x2e46af,_0x36c67,_0x26f1ac){if(_0x2e46af['body']['id']){delete _0x2e46af[_0x47a5('0x4f')]['id'];}return db['SalesforceAccount'][_0x47a5('0x54')]({'where':{'id':_0x2e46af['params']['id']}})[_0x47a5('0x1c')](handleEntityNotFound(_0x36c67,null))['then'](function(_0x7c1190){if(_0x7c1190){_0x2e46af[_0x47a5('0x4f')][_0x47a5('0x55')]=_0x7c1190['id'];_0x2e46af['body']['Subjects']=integrations['getSubjects'](_0x2e46af[_0x47a5('0x4f')][_0x47a5('0x56')],_0x2e46af[_0x47a5('0x4f')][_0x47a5('0x57')]);_0x2e46af['body'][_0x47a5('0x58')]=integrations[_0x47a5('0x59')](_0x2e46af[_0x47a5('0x4f')][_0x47a5('0x56')],_0x2e46af[_0x47a5('0x4f')][_0x47a5('0x57')]);return db[_0x47a5('0x51')][_0x47a5('0x4e')](_0x2e46af[_0x47a5('0x4f')],{'include':[{'model':db[_0x47a5('0x5a')],'as':_0x47a5('0x5b')},{'model':db[_0x47a5('0x5a')],'as':'Descriptions'}]});}return null;})[_0x47a5('0x1c')](respondWithResult(_0x36c67,null))['catch'](handleError(_0x36c67,null));};exports[_0x47a5('0x5c')]=function(_0x2ac30f,_0x281e5f,_0x12fec9){var _0x40e584;var _0xa9c853='';var _0x12025a=_0x47a5('0x5d');return db[_0x47a5('0x32')][_0x47a5('0x54')]({'where':{'id':_0x2ac30f[_0x47a5('0x4a')]['id']},'attributes':['id',_0x47a5('0x5e'),_0x47a5('0x5f'),_0x47a5('0x60'),_0x47a5('0x61'),'password','securityToken']})['then'](handleEntityNotFound(_0x281e5f,null))['then'](function(_0x490e28){if(_0x490e28){_0xa9c853=_0x490e28[_0x47a5('0x5e')];var _0x5d6916=_0xa9c853[_0x47a5('0x62')](-0x1);if(_0x5d6916==='/'){_0xa9c853=_0xa9c853[_0x47a5('0x63')](0x0,_0xa9c853[_0x47a5('0x64')](_0x5d6916));}_0x40e584=new jsforce[(_0x47a5('0x65'))]({'oauth2':{'loginUrl':_0xa9c853,'clientId':_0x490e28[_0x47a5('0x5f')],'clientSecret':_0x490e28[_0x47a5('0x60')]}});return _0x40e584[_0x47a5('0x66')](_0x490e28[_0x47a5('0x61')],_0x490e28[_0x47a5('0x67')][_0x47a5('0x68')](_0x490e28[_0x47a5('0x69')]));}})['then'](function(_0x18fa31){if(_0x18fa31){if(!_[_0x47a5('0x6a')](_0x2ac30f[_0x47a5('0x36')]['ticketType'])){_0x12025a=_0x2ac30f[_0x47a5('0x36')][_0x47a5('0x6b')];}return _0x40e584[_0x47a5('0x6c')](_0x12025a)['describe']();}})[_0x47a5('0x1c')](function(_0x5205ba){var _0x49d93d=[_0x47a5('0x6d'),_0x47a5('0x6e'),_0x47a5('0x6f'),_0x47a5('0x70'),_0x47a5('0x71'),_0x47a5('0x72'),'Status','Type'];if(!_[_0x47a5('0x6a')](_0x2ac30f['query'][_0x47a5('0x6b')])&&_0x2ac30f[_0x47a5('0x36')][_0x47a5('0x6b')]===_0x47a5('0x73')){_0x49d93d=['Type',_0x47a5('0x74'),'Reason','Status',_0x47a5('0x72'),_0x47a5('0x75'),'SuppliedName',_0x47a5('0x76')];}if(_0x5205ba){_[_0x47a5('0x77')](_0x5205ba[_0x47a5('0x3a')],function(_0x4c25ec){return _0x4c25ec[_0x47a5('0x78')]===![]&&!_0x49d93d['includes'](_0x4c25ec[_0x47a5('0x2f')]);});return{'count':_0x5205ba[_0x47a5('0x3a')][_0x47a5('0x3c')],'rows':_['map'](_0x5205ba[_0x47a5('0x3a')],function(_0x196600){return{'id':_0x196600[_0x47a5('0x2f')],'name':_0x196600['label'],'custom':_0x196600[_0x47a5('0x78')],'options':_0x196600['picklistValues'][_0x47a5('0x3c')]>0x0?_['map'](_0x196600[_0x47a5('0x79')],function(_0x20d8bd){return{'name':_0x20d8bd[_0x47a5('0x7a')],'value':_0x20d8bd[_0x47a5('0x7b')]};}):_0x196600['type']==_0x47a5('0x7c')?[{'name':_0x47a5('0x7d'),'value':_0x47a5('0x7e')},{'name':_0x47a5('0x7f'),'value':_0x47a5('0x80')}]:[]};})};}})['then'](respondWithResult(_0x281e5f,null))['catch'](function(_0x569550){var _0x4ab01f=_0x2ac30f[_0x47a5('0x36')][_0x47a5('0x18')]?0x1f4:_0x569550[_0x47a5('0x81')]||0x1f4;logger['error'](_0x47a5('0x82'),_0x47a5('0x5c'),_0x4ab01f,JSON['stringify'](_0x569550));delete _0x569550[_0x47a5('0x2f')];if(_0x4ab01f===0x191){_0x4ab01f=0x190;}_0x281e5f[_0x47a5('0x26')](_0x4ab01f)[_0x47a5('0x83')](_0x2ac30f[_0x47a5('0x36')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x569550[_0x47a5('0x81')]}:_0x569550);});}; \ No newline at end of file +var _0x814b=['Status','Priority','IsEscalated','SuppliedCompany','remove','includes','custom','picklistValues','value','boolean','True','true','False','false','statusCode','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','SalesforceAccount,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','catch','sendStatus','status','end','count','offset','limit','set','apply','reject','then','destroy','stack','name','send','SalesforceAccount','type','model','map','filters','intersection','query','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','rows','show','keys','rawAttributes','include','create','body','find','params','findOne','getConfigurations','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','SalesforceConfiguration','getFields','Task','remoteUri','clientId','password','slice','substring','Connection','clientSecret','username','securityToken','isNil','ticketType','sobject','describe','CallDisposition','CallDurationInSeconds','CallObject','Case','Type','Origin','Reason'];(function(_0x2594e0,_0x1ee198){var _0x1eadb9=function(_0x52a325){while(--_0x52a325){_0x2594e0['push'](_0x2594e0['shift']());}};_0x1eadb9(++_0x1ee198);}(_0x814b,0x1a2));var _0xb814=function(_0x1e17eb,_0x2e15c5){_0x1e17eb=_0x1e17eb-0x0;var _0x4de4c7=_0x814b[_0x1e17eb];return _0x4de4c7;};'use strict';var pdf=require(_0xb814('0x0'));var emlformat=require(_0xb814('0x1'));var rimraf=require(_0xb814('0x2'));var zipdir=require(_0xb814('0x3'));var jsonpatch=require(_0xb814('0x4'));var rp=require(_0xb814('0x5'));var moment=require('moment');var BPromise=require(_0xb814('0x6'));var Mustache=require(_0xb814('0x7'));var util=require(_0xb814('0x8'));var path=require(_0xb814('0x9'));var sox=require(_0xb814('0xa'));var csv=require(_0xb814('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xb814('0xc'));var squel=require(_0xb814('0xd'));var crypto=require('crypto');var jsforce=require(_0xb814('0xe'));var deskjs=require(_0xb814('0xf'));var toCsv=require(_0xb814('0xb'));var querystring=require(_0xb814('0x10'));var Papa=require(_0xb814('0x11'));var Redis=require(_0xb814('0x12'));var authService=require(_0xb814('0x13'));var qs=require(_0xb814('0x14'));var as=require(_0xb814('0x15'));var hardwareService=require(_0xb814('0x16'));var logger=require(_0xb814('0x17'))('api');var utils=require(_0xb814('0x18'));var config=require('../../config/environment');var db=require(_0xb814('0x19'))['db'];var integrations=require(_0xb814('0x1a'));var jayson=require(_0xb814('0x1b'));var client=jayson[_0xb814('0x1c')][_0xb814('0x1d')]({'port':0x232a});function checkPasswordPattern(_0x3bde14,_0x1438e7,_0x41ed7b){if(_0x41ed7b){var _0xa0a2e5=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xa0a2e5[_0xb814('0x1e')](_0x1438e7)){return _0x3bde14;}else{throw new db[(_0xb814('0x1f'))][(_0xb814('0x20'))](_0xb814('0x21'));}}else{return _0x3bde14;}}function respondWithRpcPromise(_0x39bfcf,_0x303aca,_0x3a71d6,_0x45e0d0){return new BPromise(function(_0x265a83,_0x125ce2){var _0x21b73f=_0x45e0d0||client;return _0x21b73f[_0xb814('0x22')](_0x39bfcf,_0x3a71d6)['then'](function(_0x168a48){logger['info'](_0xb814('0x23'),_0x303aca,_0xb814('0x24'));logger['debug']('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0x303aca,'request\x20sent',JSON[_0xb814('0x25')](_0x168a48));if(_0x168a48['error']){if(_0x168a48['error'][_0xb814('0x26')]===0x1f4){logger[_0xb814('0x27')](_0xb814('0x23'),_0x303aca,_0x168a48['error'][_0xb814('0x28')]);return _0x125ce2(_0x168a48['error'][_0xb814('0x28')]);}logger[_0xb814('0x27')](_0xb814('0x23'),_0x303aca,_0x168a48[_0xb814('0x27')][_0xb814('0x28')]);return _0x265a83(_0x168a48[_0xb814('0x27')][_0xb814('0x28')]);}else{logger['info'](_0xb814('0x23'),_0x303aca,'request\x20sent');_0x265a83(_0x168a48[_0xb814('0x29')][_0xb814('0x28')]);}})[_0xb814('0x2a')](function(_0x208927){logger[_0xb814('0x27')](_0xb814('0x23'),_0x303aca,_0x208927);_0x125ce2(_0x208927);});});}function respondWithStatusCode(_0x3d836c,_0x5755ea){_0x5755ea=_0x5755ea||0xcc;return function(_0x392222){if(_0x392222){return _0x3d836c[_0xb814('0x2b')](_0x5755ea);}return _0x3d836c[_0xb814('0x2c')](_0x5755ea)[_0xb814('0x2d')]();};}function respondWithResult(_0x32ed56,_0x1d5965){_0x1d5965=_0x1d5965||0xc8;return function(_0x3f0150){if(_0x3f0150){return _0x32ed56[_0xb814('0x2c')](_0x1d5965)['json'](_0x3f0150);}};}function respondWithFilteredResult(_0x271aa8,_0x328a08){return function(_0x52ed64){if(_0x52ed64){var _0x9008b2=_0x52ed64[_0xb814('0x2e')],_0x37d24d=_0x328a08[_0xb814('0x2f')],_0x530744=_0x328a08['offset']+_0x328a08[_0xb814('0x30')],_0x499f22;if(_0x530744>=_0x9008b2){_0x530744=_0x9008b2;_0x499f22=0xc8;}else{_0x499f22=0xce;}_0x271aa8['status'](_0x499f22);return _0x271aa8[_0xb814('0x31')]('Content-Range',_0x37d24d+'-'+_0x530744+'/'+_0x9008b2)['json'](_0x52ed64);}return null;};}function patchUpdates(_0x419cd9){return function(_0x4a4f27){try{jsonpatch[_0xb814('0x32')](_0x4a4f27,_0x419cd9,!![]);}catch(_0x19469b){return BPromise[_0xb814('0x33')](_0x19469b);}return _0x4a4f27['save']();};}function saveUpdates(_0x51d5ae,_0x26d3a9){return function(_0x336e2b){if(_0x336e2b){return _0x336e2b['update'](_0x51d5ae)[_0xb814('0x34')](function(_0xe558d5){return _0xe558d5;});}return null;};}function removeEntity(_0x692c72,_0x217b7e){return function(_0x1b78de){if(_0x1b78de){return _0x1b78de[_0xb814('0x35')]()[_0xb814('0x34')](function(){_0x692c72['status'](0xcc)[_0xb814('0x2d')]();});}};}function handleEntityNotFound(_0x2263f6,_0x30de5a){return function(_0x424e2b){if(!_0x424e2b){_0x2263f6[_0xb814('0x2b')](0x194);}return _0x424e2b;};}function handleError(_0x4ff31a,_0x16ef82){_0x16ef82=_0x16ef82||0x1f4;return function(_0x57e6e6){logger[_0xb814('0x27')](_0x57e6e6[_0xb814('0x36')]);if(_0x57e6e6[_0xb814('0x37')]){delete _0x57e6e6['name'];}_0x4ff31a[_0xb814('0x2c')](_0x16ef82)[_0xb814('0x38')](_0x57e6e6);};}exports['index']=function(_0x2fcd92,_0x2d0e27){var _0x1a8bd0={},_0x1f7cd8={},_0xd77d96={'count':0x0,'rows':[]};var _0x467cf9=_['map'](db[_0xb814('0x39')]['rawAttributes'],function(_0x2aaf1c){return{'name':_0x2aaf1c['fieldName'],'type':_0x2aaf1c[_0xb814('0x3a')]['key']};});_0x1f7cd8[_0xb814('0x3b')]=_[_0xb814('0x3c')](_0x467cf9,'name');_0x1f7cd8['query']=_['keys'](_0x2fcd92['query']);_0x1f7cd8[_0xb814('0x3d')]=_[_0xb814('0x3e')](_0x1f7cd8[_0xb814('0x3b')],_0x1f7cd8[_0xb814('0x3f')]);_0x1a8bd0['attributes']=_['intersection'](_0x1f7cd8[_0xb814('0x3b')],qs['fields'](_0x2fcd92[_0xb814('0x3f')][_0xb814('0x40')]));_0x1a8bd0[_0xb814('0x41')]=_0x1a8bd0[_0xb814('0x41')][_0xb814('0x42')]?_0x1a8bd0[_0xb814('0x41')]:_0x1f7cd8[_0xb814('0x3b')];if(!_0x2fcd92[_0xb814('0x3f')][_0xb814('0x43')]('nolimit')){_0x1a8bd0['limit']=qs['limit'](_0x2fcd92[_0xb814('0x3f')]['limit']);_0x1a8bd0[_0xb814('0x2f')]=qs['offset'](_0x2fcd92[_0xb814('0x3f')][_0xb814('0x2f')]);}_0x1a8bd0[_0xb814('0x44')]=qs[_0xb814('0x45')](_0x2fcd92['query'][_0xb814('0x45')]);_0x1a8bd0[_0xb814('0x46')]=qs[_0xb814('0x3d')](_[_0xb814('0x47')](_0x2fcd92[_0xb814('0x3f')],_0x1f7cd8[_0xb814('0x3d')]));if(_0x2fcd92['query'][_0xb814('0x48')]){_0x1a8bd0[_0xb814('0x46')]=_[_0xb814('0x49')](_0x1a8bd0[_0xb814('0x46')],{'$or':_[_0xb814('0x3c')](_0x467cf9,function(_0x144d37){if(_0x144d37[_0xb814('0x3a')]!=='VIRTUAL'){var _0x4a5e84={};_0x4a5e84[_0x144d37[_0xb814('0x37')]]={'$like':'%'+_0x2fcd92[_0xb814('0x3f')][_0xb814('0x48')]+'%'};return _0x4a5e84;}})});}_0x1a8bd0=_[_0xb814('0x49')]({},_0x1a8bd0,_0x2fcd92[_0xb814('0x4a')]);var _0x40e627={'where':_0x1a8bd0[_0xb814('0x46')]};return db[_0xb814('0x39')][_0xb814('0x2e')](_0x40e627)[_0xb814('0x34')](function(_0xe73300){_0xd77d96['count']=_0xe73300;if(_0x2fcd92[_0xb814('0x3f')][_0xb814('0x4b')]){_0x1a8bd0['include']=[{'all':!![]}];}return db[_0xb814('0x39')]['findAll'](_0x1a8bd0);})[_0xb814('0x34')](function(_0x37866f){_0xd77d96[_0xb814('0x4c')]=_0x37866f;return _0xd77d96;})[_0xb814('0x34')](respondWithFilteredResult(_0x2d0e27,_0x1a8bd0))[_0xb814('0x2a')](handleError(_0x2d0e27,null));};exports[_0xb814('0x4d')]=function(_0x2cc806,_0x45480e){var _0x32a397={'raw':![],'where':{'id':_0x2cc806['params']['id']}},_0x2a422a={};_0x2a422a['model']=_[_0xb814('0x4e')](db[_0xb814('0x39')][_0xb814('0x4f')]);_0x2a422a[_0xb814('0x3f')]=_[_0xb814('0x4e')](_0x2cc806[_0xb814('0x3f')]);_0x2a422a[_0xb814('0x3d')]=_['intersection'](_0x2a422a[_0xb814('0x3b')],_0x2a422a[_0xb814('0x3f')]);_0x32a397[_0xb814('0x41')]=_['intersection'](_0x2a422a[_0xb814('0x3b')],qs['fields'](_0x2cc806[_0xb814('0x3f')]['fields']));_0x32a397[_0xb814('0x41')]=_0x32a397[_0xb814('0x41')]['length']?_0x32a397[_0xb814('0x41')]:_0x2a422a[_0xb814('0x3b')];if(_0x2cc806[_0xb814('0x3f')]['includeAll']){_0x32a397[_0xb814('0x50')]=[{'all':!![]}];}_0x32a397=_['merge']({},_0x32a397,_0x2cc806[_0xb814('0x4a')]);return db[_0xb814('0x39')]['find'](_0x32a397)[_0xb814('0x34')](handleEntityNotFound(_0x45480e,null))['then'](respondWithResult(_0x45480e,null))['catch'](handleError(_0x45480e,null));};exports[_0xb814('0x51')]=function(_0x35f59a,_0x34935b){return db['SalesforceAccount'][_0xb814('0x51')](_0x35f59a['body'],{})[_0xb814('0x34')](respondWithResult(_0x34935b,0xc9))[_0xb814('0x2a')](handleError(_0x34935b,null));};exports['update']=function(_0x2db5a6,_0x5c32c2){if(_0x2db5a6[_0xb814('0x52')]['id']){delete _0x2db5a6[_0xb814('0x52')]['id'];}return db[_0xb814('0x39')][_0xb814('0x53')]({'where':{'id':_0x2db5a6[_0xb814('0x54')]['id']}})[_0xb814('0x34')](handleEntityNotFound(_0x5c32c2,null))[_0xb814('0x34')](saveUpdates(_0x2db5a6[_0xb814('0x52')],null))['then'](respondWithResult(_0x5c32c2,null))[_0xb814('0x2a')](handleError(_0x5c32c2,null));};exports[_0xb814('0x35')]=function(_0x5d71d5,_0x29a127){return db[_0xb814('0x39')]['find']({'where':{'id':_0x5d71d5[_0xb814('0x54')]['id']}})['then'](handleEntityNotFound(_0x29a127,null))['then'](removeEntity(_0x29a127,null))[_0xb814('0x2a')](handleError(_0x29a127,null));};exports['getConfigurations']=function(_0x3ff213,_0xd1cd8b,_0x2dec52){var _0x586957={};var _0x1a0ef4={};var _0x4df65c;var _0x2ef77d;return db[_0xb814('0x39')][_0xb814('0x55')]({'where':{'id':_0x3ff213[_0xb814('0x54')]['id']}})[_0xb814('0x34')](handleEntityNotFound(_0xd1cd8b,null))[_0xb814('0x34')](function(_0x2e5f99){if(_0x2e5f99){_0x4df65c=_0x2e5f99;_0x1a0ef4[_0xb814('0x3b')]=_[_0xb814('0x4e')](db['SalesforceConfiguration'][_0xb814('0x4f')]);_0x1a0ef4[_0xb814('0x3f')]=_[_0xb814('0x4e')](_0x3ff213[_0xb814('0x3f')]);_0x1a0ef4[_0xb814('0x3d')]=_[_0xb814('0x3e')](_0x1a0ef4['model'],_0x1a0ef4[_0xb814('0x3f')]);_0x586957['attributes']=_[_0xb814('0x3e')](_0x1a0ef4[_0xb814('0x3b')],qs[_0xb814('0x40')](_0x3ff213['query'][_0xb814('0x40')]));_0x586957['attributes']=_0x586957[_0xb814('0x41')]['length']?_0x586957[_0xb814('0x41')]:_0x1a0ef4[_0xb814('0x3b')];_0x586957[_0xb814('0x44')]=qs[_0xb814('0x45')](_0x3ff213[_0xb814('0x3f')][_0xb814('0x45')]);_0x586957[_0xb814('0x46')]=qs['filters'](_[_0xb814('0x47')](_0x3ff213['query'],_0x1a0ef4[_0xb814('0x3d')]));if(_0x3ff213[_0xb814('0x3f')][_0xb814('0x48')]){_0x586957[_0xb814('0x46')]=_[_0xb814('0x49')](_0x586957[_0xb814('0x46')],{'$or':_['map'](_0x586957[_0xb814('0x41')],function(_0x1a2603){var _0x4a49ba={};_0x4a49ba[_0x1a2603]={'$like':'%'+_0x3ff213[_0xb814('0x3f')][_0xb814('0x48')]+'%'};return _0x4a49ba;})});}_0x586957=_[_0xb814('0x49')]({},_0x586957,_0x3ff213[_0xb814('0x4a')]);return _0x4df65c[_0xb814('0x56')](_0x586957);}})['then'](function(_0x3a4d4b){if(_0x3a4d4b){_0x2ef77d=_0x3a4d4b['length'];if(!_0x3ff213[_0xb814('0x3f')][_0xb814('0x43')](_0xb814('0x57'))){_0x586957[_0xb814('0x30')]=qs[_0xb814('0x30')](_0x3ff213[_0xb814('0x3f')]['limit']);_0x586957['offset']=qs['offset'](_0x3ff213[_0xb814('0x3f')]['offset']);}return _0x4df65c[_0xb814('0x56')](_0x586957);}})[_0xb814('0x34')](function(_0x25db89){if(_0x25db89){return _0x25db89?{'count':_0x2ef77d,'rows':_0x25db89}:null;}})['then'](respondWithResult(_0xd1cd8b,null))[_0xb814('0x2a')](handleError(_0xd1cd8b,null));};exports[_0xb814('0x58')]=function(_0xee204,_0x5aabbe,_0x30f717){if(_0xee204[_0xb814('0x52')]['id']){delete _0xee204[_0xb814('0x52')]['id'];}return db[_0xb814('0x39')]['findOne']({'where':{'id':_0xee204['params']['id']}})[_0xb814('0x34')](handleEntityNotFound(_0x5aabbe,null))[_0xb814('0x34')](function(_0x39863d){if(_0x39863d){_0xee204[_0xb814('0x52')][_0xb814('0x59')]=_0x39863d['id'];_0xee204[_0xb814('0x52')][_0xb814('0x5a')]=integrations[_0xb814('0x5b')](_0xee204[_0xb814('0x52')][_0xb814('0x5c')],_0xee204[_0xb814('0x52')][_0xb814('0x3a')]);_0xee204[_0xb814('0x52')][_0xb814('0x5d')]=integrations[_0xb814('0x5e')](_0xee204['body'][_0xb814('0x5c')],_0xee204[_0xb814('0x52')][_0xb814('0x3a')]);return db[_0xb814('0x5f')][_0xb814('0x51')](_0xee204[_0xb814('0x52')],{'include':[{'model':db['SalesforceField'],'as':_0xb814('0x5a')},{'model':db['SalesforceField'],'as':_0xb814('0x5d')}]});}return null;})[_0xb814('0x34')](respondWithResult(_0x5aabbe,null))[_0xb814('0x2a')](handleError(_0x5aabbe,null));};exports[_0xb814('0x60')]=function(_0x265a25,_0x5ce177,_0x4c44ee){var _0xea9cee;var _0x1b502b='';var _0x1bca54=_0xb814('0x61');return db['SalesforceAccount'][_0xb814('0x55')]({'where':{'id':_0x265a25['params']['id']},'attributes':['id',_0xb814('0x62'),_0xb814('0x63'),'clientSecret','username',_0xb814('0x64'),'securityToken']})[_0xb814('0x34')](handleEntityNotFound(_0x5ce177,null))[_0xb814('0x34')](function(_0x3c770d){if(_0x3c770d){_0x1b502b=_0x3c770d[_0xb814('0x62')];var _0x46784f=_0x1b502b[_0xb814('0x65')](-0x1);if(_0x46784f==='/'){_0x1b502b=_0x1b502b[_0xb814('0x66')](0x0,_0x1b502b['lastIndexOf'](_0x46784f));}_0xea9cee=new jsforce[(_0xb814('0x67'))]({'oauth2':{'loginUrl':_0x1b502b,'clientId':_0x3c770d['clientId'],'clientSecret':_0x3c770d[_0xb814('0x68')]}});return _0xea9cee['login'](_0x3c770d[_0xb814('0x69')],_0x3c770d[_0xb814('0x64')]['concat'](_0x3c770d[_0xb814('0x6a')]));}})['then'](function(_0x37adec){if(_0x37adec){if(!_[_0xb814('0x6b')](_0x265a25['query']['ticketType'])){_0x1bca54=_0x265a25[_0xb814('0x3f')][_0xb814('0x6c')];}return _0xea9cee[_0xb814('0x6d')](_0x1bca54)[_0xb814('0x6e')]();}})[_0xb814('0x34')](function(_0x4394da){var _0x2b12a9=[_0xb814('0x6f'),_0xb814('0x70'),_0xb814('0x71'),'CallType','IsArchived','Priority','Status','Type'];if(!_[_0xb814('0x6b')](_0x265a25[_0xb814('0x3f')][_0xb814('0x6c')])&&_0x265a25['query'][_0xb814('0x6c')]===_0xb814('0x72')){_0x2b12a9=[_0xb814('0x73'),_0xb814('0x74'),_0xb814('0x75'),_0xb814('0x76'),_0xb814('0x77'),_0xb814('0x78'),'SuppliedName',_0xb814('0x79')];}if(_0x4394da){_[_0xb814('0x7a')](_0x4394da[_0xb814('0x40')],function(_0x30faa0){return _0x30faa0['custom']===![]&&!_0x2b12a9[_0xb814('0x7b')](_0x30faa0[_0xb814('0x37')]);});return{'count':_0x4394da[_0xb814('0x40')][_0xb814('0x42')],'rows':_[_0xb814('0x3c')](_0x4394da['fields'],function(_0x4db6e2){return{'id':_0x4db6e2[_0xb814('0x37')],'name':_0x4db6e2['label'],'custom':_0x4db6e2[_0xb814('0x7c')],'options':_0x4db6e2[_0xb814('0x7d')]['length']>0x0?_[_0xb814('0x3c')](_0x4db6e2['picklistValues'],function(_0xe17e86){return{'name':_0xe17e86['label'],'value':_0xe17e86[_0xb814('0x7e')]};}):_0x4db6e2[_0xb814('0x3a')]==_0xb814('0x7f')?[{'name':_0xb814('0x80'),'value':_0xb814('0x81')},{'name':_0xb814('0x82'),'value':_0xb814('0x83')}]:[]};})};}})['then'](respondWithResult(_0x5ce177,null))['catch'](function(_0x21aa36){var _0x50ed93=_0x265a25['query'][_0xb814('0x1e')]?0x1f4:_0x21aa36[_0xb814('0x84')]||0x1f4;logger[_0xb814('0x27')]('getFields,\x20%s,\x20%s,\x20%s',_0xb814('0x60'),_0x50ed93,JSON['stringify'](_0x21aa36));delete _0x21aa36[_0xb814('0x37')];if(_0x50ed93===0x191){_0x50ed93=0x190;}_0x5ce177[_0xb814('0x2c')](_0x50ed93)[_0xb814('0x38')](_0x265a25[_0xb814('0x3f')]['test']?{'message':_0xb814('0x85'),'statusCode':_0x21aa36[_0xb814('0x84')]}:_0x21aa36);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index 66849c0..58cc793 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 _0x2a54=['api','bluebird','request-promise','rimraf','./intSalesforceAccount.attributes','../../components/integrations/configuration','exports','define','SalesforceAccount','lodash'];(function(_0x2fd8e2,_0x8cbd99){var _0x35bdb4=function(_0x5248af){while(--_0x5248af){_0x2fd8e2['push'](_0x2fd8e2['shift']());}};_0x35bdb4(++_0x8cbd99);}(_0x2a54,0x15d));var _0x42a5=function(_0x19a66b,_0x14eb7b){_0x19a66b=_0x19a66b-0x0;var _0x10e265=_0x2a54[_0x19a66b];return _0x10e265;};'use strict';var _=require(_0x42a5('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x42a5('0x1'));var moment=require('moment');var BPromise=require(_0x42a5('0x2'));var rp=require(_0x42a5('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x42a5('0x4'));var config=require('../../config/environment');var attributes=require(_0x42a5('0x5'));var integrations=require(_0x42a5('0x6'));module[_0x42a5('0x7')]=function(_0x36ee2b,_0x330764){return _0x36ee2b[_0x42a5('0x8')](_0x42a5('0x9'),attributes,{'tableName':'int_salesforce_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc3d5=['../../components/integrations/configuration','define','int_salesforce_accounts','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./intSalesforceAccount.attributes'];(function(_0x2140fc,_0x3d25e5){var _0x44f2d6=function(_0x56ae0b){while(--_0x56ae0b){_0x2140fc['push'](_0x2140fc['shift']());}};_0x44f2d6(++_0x3d25e5);}(_0xc3d5,0x1a7));var _0x5c3d=function(_0x5ed1ff,_0x361938){_0x5ed1ff=_0x5ed1ff-0x0;var _0x13f2ee=_0xc3d5[_0x5ed1ff];return _0x13f2ee;};'use strict';var _=require(_0x5c3d('0x0'));var util=require(_0x5c3d('0x1'));var logger=require(_0x5c3d('0x2'))(_0x5c3d('0x3'));var moment=require('moment');var BPromise=require(_0x5c3d('0x4'));var rp=require(_0x5c3d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5c3d('0x6'));var config=require(_0x5c3d('0x7'));var attributes=require(_0x5c3d('0x8'));var integrations=require(_0x5c3d('0x9'));module['exports']=function(_0x44ed0d,_0x14b140){return _0x44ed0d[_0x5c3d('0xa')]('SalesforceAccount',attributes,{'tableName':_0x5c3d('0xb'),'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 70d59c2..4a5f8f7 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 _0xedd9=['attributes','limit','map','include','model','ShowSalesforceAccount','find','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','SalesforceAccount,\x20%s,\x20%s','message','catch','GetSalesforceAccount','SalesforceAccount','findAll','raw','options'];(function(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0xedd9,0xfc));var _0x9edd=function(_0x8f1d38,_0x2149ef){_0x8f1d38=_0x8f1d38-0x0;var _0x4b7efb=_0xedd9[_0x8f1d38];return _0x4b7efb;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var moment=require(_0x9edd('0x1'));var BPromise=require(_0x9edd('0x2'));var rs=require(_0x9edd('0x3'));var fs=require('fs');var Redis=require(_0x9edd('0x4'));var db=require(_0x9edd('0x5'))['db'];var utils=require(_0x9edd('0x6'));var logger=require(_0x9edd('0x7'))('rpc');var config=require(_0x9edd('0x8'));var jayson=require(_0x9edd('0x9'));var client=jayson[_0x9edd('0xa')][_0x9edd('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5319f7,_0xf0b2d8,_0x571af9){return new BPromise(function(_0x172522,_0x190185){return client[_0x9edd('0xc')](_0x5319f7,_0x571af9)[_0x9edd('0xd')](function(_0x49d5e3){logger[_0x9edd('0xe')]('SalesforceAccount,\x20%s,\x20%s',_0xf0b2d8,_0x9edd('0xf'));logger[_0x9edd('0x10')]('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0xf0b2d8,_0x9edd('0xf'),JSON[_0x9edd('0x11')](_0x49d5e3));if(_0x49d5e3['error']){if(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x13')]===0x1f4){logger[_0x9edd('0x12')](_0x9edd('0x14'),_0xf0b2d8,_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);return _0x190185(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);}logger['error'](_0x9edd('0x14'),_0xf0b2d8,_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);return _0x172522(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);}else{logger[_0x9edd('0xe')](_0x9edd('0x14'),_0xf0b2d8,_0x9edd('0xf'));_0x172522(_0x49d5e3['result'][_0x9edd('0x15')]);}})[_0x9edd('0x16')](function(_0x449cee){logger['error'](_0x9edd('0x14'),_0xf0b2d8,_0x449cee);_0x190185(_0x449cee);});});}exports[_0x9edd('0x17')]=function(_0x40ba32){var _0x4d8f33=this;return new Promise(function(_0x43dc70,_0x5d879c){return db[_0x9edd('0x18')][_0x9edd('0x19')]({'raw':_0x40ba32['options']?_0x40ba32['options'][_0x9edd('0x1a')]===undefined?!![]:![]:!![],'where':_0x40ba32['options']?_0x40ba32[_0x9edd('0x1b')]['where']||null:null,'attributes':_0x40ba32['options']?_0x40ba32[_0x9edd('0x1b')][_0x9edd('0x1c')]||null:null,'limit':_0x40ba32['options']?_0x40ba32['options'][_0x9edd('0x1d')]||null:null,'include':_0x40ba32[_0x9edd('0x1b')]?_0x40ba32[_0x9edd('0x1b')]['include']?_[_0x9edd('0x1e')](_0x40ba32[_0x9edd('0x1b')][_0x9edd('0x1f')],function(_0x2ca65f){return{'model':db[_0x2ca65f[_0x9edd('0x20')]],'as':_0x2ca65f['as'],'attributes':_0x2ca65f['attributes'],'include':_0x2ca65f[_0x9edd('0x1f')]?_[_0x9edd('0x1e')](_0x2ca65f[_0x9edd('0x1f')],function(_0x2f9f86){return{'model':db[_0x2f9f86[_0x9edd('0x20')]],'as':_0x2f9f86['as'],'attributes':_0x2f9f86['attributes'],'include':_0x2f9f86['include']?_[_0x9edd('0x1e')](_0x2f9f86[_0x9edd('0x1f')],function(_0x8d67aa){return{'model':db[_0x8d67aa[_0x9edd('0x20')]],'as':_0x8d67aa['as'],'attributes':_0x8d67aa[_0x9edd('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x57a2cc){logger[_0x9edd('0xe')](_0x9edd('0x17'),_0x40ba32);logger[_0x9edd('0x10')]('GetSalesforceAccount',_0x40ba32,JSON[_0x9edd('0x11')](_0x57a2cc));_0x43dc70(_0x57a2cc);})[_0x9edd('0x16')](function(_0x2ae8dd){logger[_0x9edd('0x12')]('GetSalesforceAccount',_0x2ae8dd[_0x9edd('0x15')],_0x40ba32);_0x5d879c(_0x4d8f33[_0x9edd('0x12')](0x1f4,_0x2ae8dd[_0x9edd('0x15')]));});});};exports[_0x9edd('0x21')]=function(_0xbbf08f){var _0x42e664=this;return new Promise(function(_0x209aba,_0x1fba7b){return db[_0x9edd('0x18')][_0x9edd('0x22')]({'raw':_0xbbf08f[_0x9edd('0x1b')]?_0xbbf08f[_0x9edd('0x1b')][_0x9edd('0x1a')]===undefined?!![]:![]:!![],'where':_0xbbf08f[_0x9edd('0x1b')]?_0xbbf08f[_0x9edd('0x1b')]['where']||null:null,'attributes':_0xbbf08f[_0x9edd('0x1b')]?_0xbbf08f[_0x9edd('0x1b')][_0x9edd('0x1c')]||null:null,'include':_0xbbf08f['options']?_0xbbf08f[_0x9edd('0x1b')][_0x9edd('0x1f')]?_[_0x9edd('0x1e')](_0xbbf08f[_0x9edd('0x1b')][_0x9edd('0x1f')],function(_0x2bc4ed){return{'model':db[_0x2bc4ed[_0x9edd('0x20')]],'as':_0x2bc4ed['as'],'attributes':_0x2bc4ed[_0x9edd('0x1c')],'include':_0x2bc4ed[_0x9edd('0x1f')]?_[_0x9edd('0x1e')](_0x2bc4ed[_0x9edd('0x1f')],function(_0x42c1d9){return{'model':db[_0x42c1d9[_0x9edd('0x20')]],'as':_0x42c1d9['as'],'attributes':_0x42c1d9[_0x9edd('0x1c')],'include':_0x42c1d9['include']?_[_0x9edd('0x1e')](_0x42c1d9['include'],function(_0x968303){return{'model':db[_0x968303[_0x9edd('0x20')]],'as':_0x968303['as'],'attributes':_0x968303[_0x9edd('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x9edd('0xd')](function(_0x16770e){logger['info'](_0x9edd('0x21'),_0xbbf08f);logger[_0x9edd('0x10')](_0x9edd('0x21'),_0xbbf08f,JSON[_0x9edd('0x11')](_0x16770e));_0x209aba(_0x16770e);})[_0x9edd('0x16')](function(_0x337e6c){logger[_0x9edd('0x12')](_0x9edd('0x21'),_0x337e6c[_0x9edd('0x15')],_0xbbf08f);_0x1fba7b(_0x42e664[_0x9edd('0x12')](0x1f4,_0x337e6c['message']));});});}; \ No newline at end of file +var _0x57d4=['catch','GetSalesforceAccount','SalesforceAccount','options','raw','where','attributes','include','model','map','ShowSalesforceAccount','find','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','SalesforceAccount,\x20%s,\x20%s','message','info'];(function(_0x2a8135,_0x145fd4){var _0x412cfe=function(_0x5a9e3f){while(--_0x5a9e3f){_0x2a8135['push'](_0x2a8135['shift']());}};_0x412cfe(++_0x145fd4);}(_0x57d4,0x78));var _0x457d=function(_0x50596d,_0x1c9047){_0x50596d=_0x50596d-0x0;var _0x55f687=_0x57d4[_0x50596d];return _0x55f687;};'use strict';var _=require(_0x457d('0x0'));var util=require(_0x457d('0x1'));var moment=require('moment');var BPromise=require(_0x457d('0x2'));var rs=require(_0x457d('0x3'));var fs=require('fs');var Redis=require(_0x457d('0x4'));var db=require(_0x457d('0x5'))['db'];var utils=require(_0x457d('0x6'));var logger=require(_0x457d('0x7'))(_0x457d('0x8'));var config=require(_0x457d('0x9'));var jayson=require(_0x457d('0xa'));var client=jayson[_0x457d('0xb')][_0x457d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5c6816,_0x1fc199,_0x381e22){return new BPromise(function(_0x4e32c0,_0x5dff56){return client[_0x457d('0xd')](_0x5c6816,_0x381e22)[_0x457d('0xe')](function(_0x127b89){logger['info']('SalesforceAccount,\x20%s,\x20%s',_0x1fc199,'request\x20sent');logger[_0x457d('0xf')](_0x457d('0x10'),_0x1fc199,_0x457d('0x11'),JSON[_0x457d('0x12')](_0x127b89));if(_0x127b89[_0x457d('0x13')]){if(_0x127b89[_0x457d('0x13')][_0x457d('0x14')]===0x1f4){logger[_0x457d('0x13')](_0x457d('0x15'),_0x1fc199,_0x127b89['error'][_0x457d('0x16')]);return _0x5dff56(_0x127b89[_0x457d('0x13')]['message']);}logger['error'](_0x457d('0x15'),_0x1fc199,_0x127b89[_0x457d('0x13')][_0x457d('0x16')]);return _0x4e32c0(_0x127b89[_0x457d('0x13')][_0x457d('0x16')]);}else{logger[_0x457d('0x17')](_0x457d('0x15'),_0x1fc199,_0x457d('0x11'));_0x4e32c0(_0x127b89['result'][_0x457d('0x16')]);}})[_0x457d('0x18')](function(_0x2c05ca){logger['error']('SalesforceAccount,\x20%s,\x20%s',_0x1fc199,_0x2c05ca);_0x5dff56(_0x2c05ca);});});}exports[_0x457d('0x19')]=function(_0x4d988f){var _0x151416=this;return new Promise(function(_0x802f2b,_0x50e78f){return db[_0x457d('0x1a')]['findAll']({'raw':_0x4d988f['options']?_0x4d988f[_0x457d('0x1b')][_0x457d('0x1c')]===undefined?!![]:![]:!![],'where':_0x4d988f[_0x457d('0x1b')]?_0x4d988f[_0x457d('0x1b')][_0x457d('0x1d')]||null:null,'attributes':_0x4d988f[_0x457d('0x1b')]?_0x4d988f[_0x457d('0x1b')][_0x457d('0x1e')]||null:null,'limit':_0x4d988f[_0x457d('0x1b')]?_0x4d988f[_0x457d('0x1b')]['limit']||null:null,'include':_0x4d988f['options']?_0x4d988f['options'][_0x457d('0x1f')]?_['map'](_0x4d988f['options']['include'],function(_0x206fdc){return{'model':db[_0x206fdc[_0x457d('0x20')]],'as':_0x206fdc['as'],'attributes':_0x206fdc['attributes'],'include':_0x206fdc[_0x457d('0x1f')]?_[_0x457d('0x21')](_0x206fdc[_0x457d('0x1f')],function(_0x152cfc){return{'model':db[_0x152cfc['model']],'as':_0x152cfc['as'],'attributes':_0x152cfc['attributes'],'include':_0x152cfc[_0x457d('0x1f')]?_['map'](_0x152cfc[_0x457d('0x1f')],function(_0x21a102){return{'model':db[_0x21a102[_0x457d('0x20')]],'as':_0x21a102['as'],'attributes':_0x21a102[_0x457d('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x298dd4){logger['info']('GetSalesforceAccount',_0x4d988f);logger[_0x457d('0xf')](_0x457d('0x19'),_0x4d988f,JSON['stringify'](_0x298dd4));_0x802f2b(_0x298dd4);})[_0x457d('0x18')](function(_0x2d69d2){logger['error'](_0x457d('0x19'),_0x2d69d2[_0x457d('0x16')],_0x4d988f);_0x50e78f(_0x151416[_0x457d('0x13')](0x1f4,_0x2d69d2[_0x457d('0x16')]));});});};exports[_0x457d('0x22')]=function(_0x1efd5f){var _0x397f54=this;return new Promise(function(_0x123b58,_0x272d40){return db[_0x457d('0x1a')][_0x457d('0x23')]({'raw':_0x1efd5f[_0x457d('0x1b')]?_0x1efd5f[_0x457d('0x1b')][_0x457d('0x1c')]===undefined?!![]:![]:!![],'where':_0x1efd5f[_0x457d('0x1b')]?_0x1efd5f[_0x457d('0x1b')][_0x457d('0x1d')]||null:null,'attributes':_0x1efd5f[_0x457d('0x1b')]?_0x1efd5f['options'][_0x457d('0x1e')]||null:null,'include':_0x1efd5f[_0x457d('0x1b')]?_0x1efd5f['options']['include']?_[_0x457d('0x21')](_0x1efd5f[_0x457d('0x1b')]['include'],function(_0x306ece){return{'model':db[_0x306ece[_0x457d('0x20')]],'as':_0x306ece['as'],'attributes':_0x306ece[_0x457d('0x1e')],'include':_0x306ece[_0x457d('0x1f')]?_[_0x457d('0x21')](_0x306ece[_0x457d('0x1f')],function(_0x17f011){return{'model':db[_0x17f011[_0x457d('0x20')]],'as':_0x17f011['as'],'attributes':_0x17f011[_0x457d('0x1e')],'include':_0x17f011[_0x457d('0x1f')]?_[_0x457d('0x21')](_0x17f011[_0x457d('0x1f')],function(_0x237be1){return{'model':db[_0x237be1[_0x457d('0x20')]],'as':_0x237be1['as'],'attributes':_0x237be1[_0x457d('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x27811b){logger['info']('ShowSalesforceAccount',_0x1efd5f);logger['debug'](_0x457d('0x22'),_0x1efd5f,JSON['stringify'](_0x27811b));_0x123b58(_0x27811b);})[_0x457d('0x18')](function(_0x55e580){logger['error'](_0x457d('0x22'),_0x55e580[_0x457d('0x16')],_0x1efd5f);_0x272d40(_0x397f54[_0x457d('0x13')](0x1f4,_0x55e580[_0x457d('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 62429fc..d0f1976 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 _0x405e=['destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./intSalesforceConfiguration.controller','get','isAuthenticated','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','put','/:id','delete'];(function(_0x39040e,_0xfaacfa){var _0x576fe5=function(_0x5449c5){while(--_0x5449c5){_0x39040e['push'](_0x39040e['shift']());}};_0x576fe5(++_0xfaacfa);}(_0x405e,0x70));var _0xe405=function(_0x5e44a5,_0x22cd28){_0x5e44a5=_0x5e44a5-0x0;var _0x5276b0=_0x405e[_0x5e44a5];return _0x5276b0;};'use strict';var multer=require(_0xe405('0x0'));var util=require(_0xe405('0x1'));var path=require(_0xe405('0x2'));var timeout=require(_0xe405('0x3'));var express=require(_0xe405('0x4'));var router=express['Router']();var auth=require(_0xe405('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xe405('0x6'));var controller=require(_0xe405('0x7'));router[_0xe405('0x8')]('/',auth[_0xe405('0x9')](),controller['index']);router[_0xe405('0x8')]('/:id',auth[_0xe405('0x9')](),controller['show']);router['get'](_0xe405('0xa'),auth[_0xe405('0x9')](),controller[_0xe405('0xb')]);router[_0xe405('0x8')](_0xe405('0xc'),auth[_0xe405('0x9')](),controller[_0xe405('0xd')]);router[_0xe405('0x8')](_0xe405('0xe'),auth['isAuthenticated'](),controller[_0xe405('0xf')]);router[_0xe405('0x10')]('/',auth[_0xe405('0x9')](),controller['create']);router[_0xe405('0x11')](_0xe405('0x12'),auth[_0xe405('0x9')](),controller['update']);router[_0xe405('0x13')](_0xe405('0x12'),auth[_0xe405('0x9')](),controller[_0xe405('0x14')]);module[_0xe405('0x15')]=router; \ No newline at end of file +var _0x8699=['getDescriptions','post','create','put','update','delete','destroy','multer','path','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects'];(function(_0x5984bb,_0x56f02a){var _0x5351d8=function(_0x43415a){while(--_0x43415a){_0x5984bb['push'](_0x5984bb['shift']());}};_0x5351d8(++_0x56f02a);}(_0x8699,0x1ab));var _0x9869=function(_0x4fdb2e,_0x1f0ad9){_0x4fdb2e=_0x4fdb2e-0x0;var _0x2f415a=_0x8699[_0x4fdb2e];return _0x2f415a;};'use strict';var multer=require(_0x9869('0x0'));var util=require('util');var path=require(_0x9869('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0x9869('0x2'));var interaction=require(_0x9869('0x3'));var config=require(_0x9869('0x4'));var controller=require('./intSalesforceConfiguration.controller');router[_0x9869('0x5')]('/',auth[_0x9869('0x6')](),controller[_0x9869('0x7')]);router['get'](_0x9869('0x8'),auth[_0x9869('0x6')](),controller[_0x9869('0x9')]);router[_0x9869('0x5')](_0x9869('0xa'),auth[_0x9869('0x6')](),controller[_0x9869('0xb')]);router[_0x9869('0x5')](_0x9869('0xc'),auth['isAuthenticated'](),controller['getSubjects']);router[_0x9869('0x5')]('/:id/descriptions',auth[_0x9869('0x6')](),controller[_0x9869('0xd')]);router[_0x9869('0xe')]('/',auth[_0x9869('0x6')](),controller[_0x9869('0xf')]);router[_0x9869('0x10')](_0x9869('0x8'),auth[_0x9869('0x6')](),controller[_0x9869('0x11')]);router[_0x9869('0x12')](_0x9869('0x8'),auth[_0x9869('0x6')](),controller[_0x9869('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index 2ea3b42..5a899af 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 _0x2081=['exports','STRING','ENUM','Case','Task','contact_lead','contact','lead'];(function(_0x4c4f48,_0x35110e){var _0x488c58=function(_0x89f768){while(--_0x89f768){_0x4c4f48['push'](_0x4c4f48['shift']());}};_0x488c58(++_0x35110e);}(_0x2081,0x178));var _0x1208=function(_0x442f02,_0x47d845){_0x442f02=_0x442f02-0x0;var _0xab6ef1=_0x2081[_0x442f02];return _0xab6ef1;};'use strict';var Sequelize=require('sequelize');module[_0x1208('0x0')]={'name':{'type':Sequelize[_0x1208('0x1')]},'description':{'type':Sequelize[_0x1208('0x1')]},'ticketType':{'type':Sequelize[_0x1208('0x2')]('Task',_0x1208('0x3')),'defaultValue':_0x1208('0x4')},'moduleSearch':{'type':Sequelize[_0x1208('0x2')](_0x1208('0x5'),_0x1208('0x6'),_0x1208('0x7')),'defaultValue':_0x1208('0x5')},'moduleCreate':{'type':Sequelize[_0x1208('0x2')]('nothing',_0x1208('0x6'),_0x1208('0x7')),'defaultValue':_0x1208('0x7')}}; \ No newline at end of file +var _0x1ef4=['exports','STRING','ENUM','Task','contact_lead','contact','lead','nothing','sequelize'];(function(_0x4e6018,_0x3213dd){var _0x4a2e85=function(_0x1868e7){while(--_0x1868e7){_0x4e6018['push'](_0x4e6018['shift']());}};_0x4a2e85(++_0x3213dd);}(_0x1ef4,0x194));var _0x41ef=function(_0x10fbd4,_0x4cf0d5){_0x10fbd4=_0x10fbd4-0x0;var _0x5322a8=_0x1ef4[_0x10fbd4];return _0x5322a8;};'use strict';var Sequelize=require(_0x41ef('0x0'));module[_0x41ef('0x1')]={'name':{'type':Sequelize[_0x41ef('0x2')]},'description':{'type':Sequelize[_0x41ef('0x2')]},'ticketType':{'type':Sequelize[_0x41ef('0x3')](_0x41ef('0x4'),'Case'),'defaultValue':'Task'},'moduleSearch':{'type':Sequelize[_0x41ef('0x3')](_0x41ef('0x5'),_0x41ef('0x6'),_0x41ef('0x7')),'defaultValue':'contact_lead'},'moduleCreate':{'type':Sequelize[_0x41ef('0x3')](_0x41ef('0x8'),_0x41ef('0x6'),_0x41ef('0x7')),'defaultValue':_0x41ef('0x7')}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 690b9ff..06cd3ec 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 _0xd26a=['name','send','index','map','SalesforceConfiguration','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','nolimit','limit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll','rows','params','keys','options','create','body','find','getFields','findOne','SalesforceField','length','hasOwnProperty','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','SalesforceConfiguration,\x20%s,\x20%s','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','Content-Range','apply','reject','update','destroy','stack'];(function(_0x587fb5,_0x59cb3b){var _0x551105=function(_0x5bbef4){while(--_0x5bbef4){_0x587fb5['push'](_0x587fb5['shift']());}};_0x551105(++_0x59cb3b);}(_0xd26a,0xed));var _0xad26=function(_0x3b8d4d,_0x272530){_0x3b8d4d=_0x3b8d4d-0x0;var _0x3f04c4=_0xd26a[_0x3b8d4d];return _0x3f04c4;};'use strict';var pdf=require(_0xad26('0x0'));var emlformat=require(_0xad26('0x1'));var rimraf=require(_0xad26('0x2'));var zipdir=require(_0xad26('0x3'));var jsonpatch=require(_0xad26('0x4'));var rp=require(_0xad26('0x5'));var moment=require(_0xad26('0x6'));var BPromise=require(_0xad26('0x7'));var Mustache=require(_0xad26('0x8'));var util=require(_0xad26('0x9'));var path=require(_0xad26('0xa'));var sox=require(_0xad26('0xb'));var csv=require('to-csv');var ejs=require(_0xad26('0xc'));var fs=require('fs');var _=require(_0xad26('0xd'));var squel=require('squel');var crypto=require(_0xad26('0xe'));var jsforce=require(_0xad26('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xad26('0x10'));var querystring=require('querystring');var Papa=require(_0xad26('0x11'));var Redis=require(_0xad26('0x12'));var authService=require(_0xad26('0x13'));var qs=require(_0xad26('0x14'));var as=require(_0xad26('0x15'));var hardwareService=require(_0xad26('0x16'));var logger=require(_0xad26('0x17'))('api');var utils=require(_0xad26('0x18'));var config=require(_0xad26('0x19'));var db=require(_0xad26('0x1a'))['db'];var jayson=require(_0xad26('0x1b'));var client=jayson[_0xad26('0x1c')]['http']({'port':0x232a});function checkPasswordPattern(_0x598446,_0x5e43cf,_0x225319){if(_0x225319){var _0x1e5ea7=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1e5ea7[_0xad26('0x1d')](_0x5e43cf)){return _0x598446;}else{throw new db[(_0xad26('0x1e'))][(_0xad26('0x1f'))](_0xad26('0x20'));}}else{return _0x598446;}}function respondWithRpcPromise(_0x5e753d,_0x485091,_0x323182,_0x18c846){return new BPromise(function(_0x4bfb07,_0x40a4be){var _0x25a975=_0x18c846||client;return _0x25a975['request'](_0x5e753d,_0x323182)[_0xad26('0x21')](function(_0x1170b3){logger[_0xad26('0x22')](_0xad26('0x23'),_0x485091,'request\x20sent');logger[_0xad26('0x24')](_0xad26('0x25'),_0x485091,_0xad26('0x26'),JSON[_0xad26('0x27')](_0x1170b3));if(_0x1170b3[_0xad26('0x28')]){if(_0x1170b3['error'][_0xad26('0x29')]===0x1f4){logger[_0xad26('0x28')](_0xad26('0x23'),_0x485091,_0x1170b3[_0xad26('0x28')][_0xad26('0x2a')]);return _0x40a4be(_0x1170b3[_0xad26('0x28')]['message']);}logger[_0xad26('0x28')](_0xad26('0x23'),_0x485091,_0x1170b3[_0xad26('0x28')][_0xad26('0x2a')]);return _0x4bfb07(_0x1170b3['error'][_0xad26('0x2a')]);}else{logger[_0xad26('0x22')](_0xad26('0x23'),_0x485091,_0xad26('0x26'));_0x4bfb07(_0x1170b3[_0xad26('0x2b')][_0xad26('0x2a')]);}})[_0xad26('0x2c')](function(_0x4b1436){logger['error'](_0xad26('0x23'),_0x485091,_0x4b1436);_0x40a4be(_0x4b1436);});});}function respondWithStatusCode(_0x1ad9be,_0x5c9bb3){_0x5c9bb3=_0x5c9bb3||0xcc;return function(_0x383d64){if(_0x383d64){return _0x1ad9be[_0xad26('0x2d')](_0x5c9bb3);}return _0x1ad9be[_0xad26('0x2e')](_0x5c9bb3)[_0xad26('0x2f')]();};}function respondWithResult(_0x5cf8ad,_0x1f109f){_0x1f109f=_0x1f109f||0xc8;return function(_0x2699ae){if(_0x2699ae){return _0x5cf8ad['status'](_0x1f109f)[_0xad26('0x30')](_0x2699ae);}};}function respondWithFilteredResult(_0x23a211,_0x34d30b){return function(_0xace7b9){if(_0xace7b9){var _0x2b6876=_0xace7b9[_0xad26('0x31')],_0xa2bbc9=_0x34d30b[_0xad26('0x32')],_0x1ba879=_0x34d30b[_0xad26('0x32')]+_0x34d30b['limit'],_0x5047f3;if(_0x1ba879>=_0x2b6876){_0x1ba879=_0x2b6876;_0x5047f3=0xc8;}else{_0x5047f3=0xce;}_0x23a211[_0xad26('0x2e')](_0x5047f3);return _0x23a211['set'](_0xad26('0x33'),_0xa2bbc9+'-'+_0x1ba879+'/'+_0x2b6876)[_0xad26('0x30')](_0xace7b9);}return null;};}function patchUpdates(_0x14a18a){return function(_0x50276a){try{jsonpatch[_0xad26('0x34')](_0x50276a,_0x14a18a,!![]);}catch(_0xa1368b){return BPromise[_0xad26('0x35')](_0xa1368b);}return _0x50276a['save']();};}function saveUpdates(_0x4df59a,_0x58af94){return function(_0x2b6a54){if(_0x2b6a54){return _0x2b6a54[_0xad26('0x36')](_0x4df59a)['then'](function(_0x25efd5){return _0x25efd5;});}return null;};}function removeEntity(_0x5f017b,_0x49e5d1){return function(_0x2f3e97){if(_0x2f3e97){return _0x2f3e97[_0xad26('0x37')]()[_0xad26('0x21')](function(){_0x5f017b['status'](0xcc)[_0xad26('0x2f')]();});}};}function handleEntityNotFound(_0x4a6e66,_0x102db4){return function(_0x3db34e){if(!_0x3db34e){_0x4a6e66[_0xad26('0x2d')](0x194);}return _0x3db34e;};}function handleError(_0x2e9d9b,_0x382043){_0x382043=_0x382043||0x1f4;return function(_0x342d4a){logger[_0xad26('0x28')](_0x342d4a[_0xad26('0x38')]);if(_0x342d4a[_0xad26('0x39')]){delete _0x342d4a[_0xad26('0x39')];}_0x2e9d9b['status'](_0x382043)[_0xad26('0x3a')](_0x342d4a);};}exports[_0xad26('0x3b')]=function(_0x1516d8,_0x7bfdd){var _0x104924={},_0x7a55f3={},_0x2f8292={'count':0x0,'rows':[]};var _0x25e9e1=_[_0xad26('0x3c')](db[_0xad26('0x3d')][_0xad26('0x3e')],function(_0x25bd42){return{'name':_0x25bd42[_0xad26('0x3f')],'type':_0x25bd42[_0xad26('0x40')][_0xad26('0x41')]};});_0x7a55f3[_0xad26('0x42')]=_['map'](_0x25e9e1,_0xad26('0x39'));_0x7a55f3[_0xad26('0x43')]=_['keys'](_0x1516d8['query']);_0x7a55f3[_0xad26('0x44')]=_['intersection'](_0x7a55f3[_0xad26('0x42')],_0x7a55f3[_0xad26('0x43')]);_0x104924[_0xad26('0x45')]=_[_0xad26('0x46')](_0x7a55f3['model'],qs[_0xad26('0x47')](_0x1516d8[_0xad26('0x43')]['fields']));_0x104924[_0xad26('0x45')]=_0x104924[_0xad26('0x45')]['length']?_0x104924[_0xad26('0x45')]:_0x7a55f3[_0xad26('0x42')];if(!_0x1516d8[_0xad26('0x43')]['hasOwnProperty'](_0xad26('0x48'))){_0x104924['limit']=qs[_0xad26('0x49')](_0x1516d8[_0xad26('0x43')][_0xad26('0x49')]);_0x104924[_0xad26('0x32')]=qs[_0xad26('0x32')](_0x1516d8[_0xad26('0x43')][_0xad26('0x32')]);}_0x104924[_0xad26('0x4a')]=qs[_0xad26('0x4b')](_0x1516d8[_0xad26('0x43')][_0xad26('0x4b')]);_0x104924[_0xad26('0x4c')]=qs[_0xad26('0x44')](_[_0xad26('0x4d')](_0x1516d8[_0xad26('0x43')],_0x7a55f3['filters']));if(_0x1516d8['query'][_0xad26('0x4e')]){_0x104924[_0xad26('0x4c')]=_['merge'](_0x104924[_0xad26('0x4c')],{'$or':_[_0xad26('0x3c')](_0x25e9e1,function(_0x58c114){if(_0x58c114[_0xad26('0x40')]!==_0xad26('0x4f')){var _0xb5f18a={};_0xb5f18a[_0x58c114[_0xad26('0x39')]]={'$like':'%'+_0x1516d8['query']['filter']+'%'};return _0xb5f18a;}})});}_0x104924=_[_0xad26('0x50')]({},_0x104924,_0x1516d8['options']);var _0x2b57fd={'where':_0x104924[_0xad26('0x4c')]};return db[_0xad26('0x3d')][_0xad26('0x31')](_0x2b57fd)[_0xad26('0x21')](function(_0x24eaec){_0x2f8292[_0xad26('0x31')]=_0x24eaec;if(_0x1516d8['query'][_0xad26('0x51')]){_0x104924[_0xad26('0x52')]=[{'all':!![]}];}return db[_0xad26('0x3d')][_0xad26('0x53')](_0x104924);})[_0xad26('0x21')](function(_0x12b4a1){_0x2f8292[_0xad26('0x54')]=_0x12b4a1;return _0x2f8292;})[_0xad26('0x21')](respondWithFilteredResult(_0x7bfdd,_0x104924))['catch'](handleError(_0x7bfdd,null));};exports['show']=function(_0x16878e,_0x3df9f6){var _0x474c2e={'raw':![],'where':{'id':_0x16878e[_0xad26('0x55')]['id']}},_0xf2229={};_0xf2229['model']=_[_0xad26('0x56')](db[_0xad26('0x3d')][_0xad26('0x3e')]);_0xf2229[_0xad26('0x43')]=_[_0xad26('0x56')](_0x16878e['query']);_0xf2229['filters']=_[_0xad26('0x46')](_0xf2229[_0xad26('0x42')],_0xf2229[_0xad26('0x43')]);_0x474c2e[_0xad26('0x45')]=_[_0xad26('0x46')](_0xf2229['model'],qs[_0xad26('0x47')](_0x16878e[_0xad26('0x43')][_0xad26('0x47')]));_0x474c2e[_0xad26('0x45')]=_0x474c2e[_0xad26('0x45')]['length']?_0x474c2e[_0xad26('0x45')]:_0xf2229[_0xad26('0x42')];if(_0x16878e['query'][_0xad26('0x51')]){_0x474c2e[_0xad26('0x52')]=[{'all':!![]}];}_0x474c2e=_[_0xad26('0x50')]({},_0x474c2e,_0x16878e[_0xad26('0x57')]);return db['SalesforceConfiguration']['find'](_0x474c2e)['then'](handleEntityNotFound(_0x3df9f6,null))['then'](respondWithResult(_0x3df9f6,null))[_0xad26('0x2c')](handleError(_0x3df9f6,null));};exports[_0xad26('0x58')]=function(_0x22884e,_0x167730){return db[_0xad26('0x3d')][_0xad26('0x58')](_0x22884e['body'],{})[_0xad26('0x21')](respondWithResult(_0x167730,0xc9))[_0xad26('0x2c')](handleError(_0x167730,null));};exports['update']=function(_0x44db15,_0x4c1507){if(_0x44db15[_0xad26('0x59')]['id']){delete _0x44db15[_0xad26('0x59')]['id'];}return db[_0xad26('0x3d')][_0xad26('0x5a')]({'where':{'id':_0x44db15[_0xad26('0x55')]['id']}})[_0xad26('0x21')](handleEntityNotFound(_0x4c1507,null))['then'](saveUpdates(_0x44db15['body'],null))[_0xad26('0x21')](respondWithResult(_0x4c1507,null))[_0xad26('0x2c')](handleError(_0x4c1507,null));};exports[_0xad26('0x37')]=function(_0x515c52,_0x2b5cc0){return db['SalesforceConfiguration'][_0xad26('0x5a')]({'where':{'id':_0x515c52[_0xad26('0x55')]['id']}})[_0xad26('0x21')](handleEntityNotFound(_0x2b5cc0,null))['then'](removeEntity(_0x2b5cc0,null))['catch'](handleError(_0x2b5cc0,null));};exports[_0xad26('0x5b')]=function(_0x1ae972,_0x1b4faa,_0x5a1bb8){var _0x1f64a0={};var _0x454bdb={};var _0x3dbf68;var _0x2a1d7c;return db[_0xad26('0x3d')][_0xad26('0x5c')]({'where':{'id':_0x1ae972[_0xad26('0x55')]['id']}})['then'](handleEntityNotFound(_0x1b4faa,null))['then'](function(_0x5df938){if(_0x5df938){_0x3dbf68=_0x5df938;_0x454bdb['model']=_['keys'](db[_0xad26('0x5d')][_0xad26('0x3e')]);_0x454bdb['query']=_[_0xad26('0x56')](_0x1ae972[_0xad26('0x43')]);_0x454bdb['filters']=_[_0xad26('0x46')](_0x454bdb[_0xad26('0x42')],_0x454bdb[_0xad26('0x43')]);_0x1f64a0[_0xad26('0x45')]=_[_0xad26('0x46')](_0x454bdb[_0xad26('0x42')],qs[_0xad26('0x47')](_0x1ae972[_0xad26('0x43')]['fields']));_0x1f64a0['attributes']=_0x1f64a0['attributes']['length']?_0x1f64a0[_0xad26('0x45')]:_0x454bdb[_0xad26('0x42')];_0x1f64a0[_0xad26('0x4a')]=qs[_0xad26('0x4b')](_0x1ae972[_0xad26('0x43')][_0xad26('0x4b')]);_0x1f64a0[_0xad26('0x4c')]=qs['filters'](_['pick'](_0x1ae972[_0xad26('0x43')],_0x454bdb[_0xad26('0x44')]));if(_0x1ae972[_0xad26('0x43')][_0xad26('0x4e')]){_0x1f64a0[_0xad26('0x4c')]=_['merge'](_0x1f64a0[_0xad26('0x4c')],{'$or':_[_0xad26('0x3c')](_0x1f64a0[_0xad26('0x45')],function(_0x882e81){var _0x56f2d6={};_0x56f2d6[_0x882e81]={'$like':'%'+_0x1ae972['query']['filter']+'%'};return _0x56f2d6;})});}_0x1f64a0=_[_0xad26('0x50')]({},_0x1f64a0,_0x1ae972[_0xad26('0x57')]);return _0x3dbf68[_0xad26('0x5b')](_0x1f64a0);}})['then'](function(_0x1d9bd3){if(_0x1d9bd3){_0x2a1d7c=_0x1d9bd3[_0xad26('0x5e')];if(!_0x1ae972[_0xad26('0x43')][_0xad26('0x5f')](_0xad26('0x48'))){_0x1f64a0[_0xad26('0x49')]=qs[_0xad26('0x49')](_0x1ae972[_0xad26('0x43')][_0xad26('0x49')]);_0x1f64a0[_0xad26('0x32')]=qs[_0xad26('0x32')](_0x1ae972[_0xad26('0x43')]['offset']);}return _0x3dbf68[_0xad26('0x5b')](_0x1f64a0);}})[_0xad26('0x21')](function(_0x10e294){if(_0x10e294){return _0x10e294?{'count':_0x2a1d7c,'rows':_0x10e294}:null;}})[_0xad26('0x21')](respondWithResult(_0x1b4faa,null))['catch'](handleError(_0x1b4faa,null));};exports[_0xad26('0x60')]=function(_0x572ee9,_0x1a4136,_0x2c512c){var _0x2939a7={};var _0xbc8252={};var _0x5b9194;var _0x1fc36f;return db[_0xad26('0x3d')][_0xad26('0x5c')]({'where':{'id':_0x572ee9[_0xad26('0x55')]['id']}})[_0xad26('0x21')](handleEntityNotFound(_0x1a4136,null))['then'](function(_0x5543c0){if(_0x5543c0){_0x5b9194=_0x5543c0;_0xbc8252[_0xad26('0x42')]=_['keys'](db[_0xad26('0x5d')][_0xad26('0x3e')]);_0xbc8252[_0xad26('0x43')]=_[_0xad26('0x56')](_0x572ee9[_0xad26('0x43')]);_0xbc8252['filters']=_[_0xad26('0x46')](_0xbc8252[_0xad26('0x42')],_0xbc8252[_0xad26('0x43')]);_0x2939a7[_0xad26('0x45')]=_[_0xad26('0x46')](_0xbc8252[_0xad26('0x42')],qs['fields'](_0x572ee9[_0xad26('0x43')]['fields']));_0x2939a7[_0xad26('0x45')]=_0x2939a7[_0xad26('0x45')]['length']?_0x2939a7[_0xad26('0x45')]:_0xbc8252[_0xad26('0x42')];_0x2939a7[_0xad26('0x4a')]=qs[_0xad26('0x4b')](_0x572ee9['query']['sort']);_0x2939a7[_0xad26('0x4c')]=qs[_0xad26('0x44')](_[_0xad26('0x4d')](_0x572ee9['query'],_0xbc8252[_0xad26('0x44')]));if(_0x572ee9[_0xad26('0x43')][_0xad26('0x4e')]){_0x2939a7[_0xad26('0x4c')]=_[_0xad26('0x50')](_0x2939a7[_0xad26('0x4c')],{'$or':_[_0xad26('0x3c')](_0x2939a7[_0xad26('0x45')],function(_0x1b5c29){var _0x1a6416={};_0x1a6416[_0x1b5c29]={'$like':'%'+_0x572ee9[_0xad26('0x43')][_0xad26('0x4e')]+'%'};return _0x1a6416;})});}_0x2939a7=_[_0xad26('0x50')]({},_0x2939a7,_0x572ee9['options']);return _0x5b9194[_0xad26('0x60')](_0x2939a7);}})[_0xad26('0x21')](function(_0x5b9087){if(_0x5b9087){_0x1fc36f=_0x5b9087['length'];if(!_0x572ee9[_0xad26('0x43')][_0xad26('0x5f')](_0xad26('0x48'))){_0x2939a7[_0xad26('0x49')]=qs[_0xad26('0x49')](_0x572ee9[_0xad26('0x43')][_0xad26('0x49')]);_0x2939a7[_0xad26('0x32')]=qs[_0xad26('0x32')](_0x572ee9[_0xad26('0x43')][_0xad26('0x32')]);}return _0x5b9194['getSubjects'](_0x2939a7);}})[_0xad26('0x21')](function(_0x553c80){if(_0x553c80){return _0x553c80?{'count':_0x1fc36f,'rows':_0x553c80}:null;}})[_0xad26('0x21')](respondWithResult(_0x1a4136,null))['catch'](handleError(_0x1a4136,null));};exports['getDescriptions']=function(_0x126568,_0x4926ad,_0x2bc39c){var _0x5b982f={};var _0x2f4e95={};var _0x279fda;var _0x43610a;return db['SalesforceConfiguration'][_0xad26('0x5c')]({'where':{'id':_0x126568[_0xad26('0x55')]['id']}})['then'](handleEntityNotFound(_0x4926ad,null))[_0xad26('0x21')](function(_0x4d0e4e){if(_0x4d0e4e){_0x279fda=_0x4d0e4e;_0x2f4e95['model']=_[_0xad26('0x56')](db[_0xad26('0x5d')]['rawAttributes']);_0x2f4e95[_0xad26('0x43')]=_['keys'](_0x126568[_0xad26('0x43')]);_0x2f4e95[_0xad26('0x44')]=_[_0xad26('0x46')](_0x2f4e95[_0xad26('0x42')],_0x2f4e95[_0xad26('0x43')]);_0x5b982f[_0xad26('0x45')]=_[_0xad26('0x46')](_0x2f4e95[_0xad26('0x42')],qs[_0xad26('0x47')](_0x126568[_0xad26('0x43')][_0xad26('0x47')]));_0x5b982f[_0xad26('0x45')]=_0x5b982f['attributes']['length']?_0x5b982f[_0xad26('0x45')]:_0x2f4e95[_0xad26('0x42')];_0x5b982f[_0xad26('0x4a')]=qs[_0xad26('0x4b')](_0x126568['query'][_0xad26('0x4b')]);_0x5b982f[_0xad26('0x4c')]=qs[_0xad26('0x44')](_[_0xad26('0x4d')](_0x126568[_0xad26('0x43')],_0x2f4e95[_0xad26('0x44')]));if(_0x126568[_0xad26('0x43')][_0xad26('0x4e')]){_0x5b982f['where']=_[_0xad26('0x50')](_0x5b982f[_0xad26('0x4c')],{'$or':_[_0xad26('0x3c')](_0x5b982f['attributes'],function(_0x3b9d4d){var _0x3190ae={};_0x3190ae[_0x3b9d4d]={'$like':'%'+_0x126568[_0xad26('0x43')][_0xad26('0x4e')]+'%'};return _0x3190ae;})});}_0x5b982f=_['merge']({},_0x5b982f,_0x126568[_0xad26('0x57')]);return _0x279fda[_0xad26('0x61')](_0x5b982f);}})[_0xad26('0x21')](function(_0x247bcb){if(_0x247bcb){_0x43610a=_0x247bcb[_0xad26('0x5e')];if(!_0x126568[_0xad26('0x43')][_0xad26('0x5f')](_0xad26('0x48'))){_0x5b982f['limit']=qs[_0xad26('0x49')](_0x126568[_0xad26('0x43')][_0xad26('0x49')]);_0x5b982f[_0xad26('0x32')]=qs[_0xad26('0x32')](_0x126568[_0xad26('0x43')][_0xad26('0x32')]);}return _0x279fda[_0xad26('0x61')](_0x5b982f);}})[_0xad26('0x21')](function(_0xe963f2){if(_0xe963f2){return _0xe963f2?{'count':_0x43610a,'rows':_0xe963f2}:null;}})[_0xad26('0x21')](respondWithResult(_0x4926ad,null))[_0xad26('0x2c')](handleError(_0x4926ad,null));}; \ No newline at end of file +var _0x665e=['sort','where','pick','filter','VIRTUAL','merge','options','count','includeAll','include','findAll','rows','catch','show','params','find','create','body','getFields','getSubjects','findOne','SalesforceField','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','jayson/promise','client','http','test','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','end','status','json','offset','set','Content-Range','apply','update','destroy','stack','name','send','index','map','SalesforceConfiguration','rawAttributes','fieldName','key','keys','query','filters','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','limit','order'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x665e,0x74));var _0xe665=function(_0x60df74,_0x458e29){_0x60df74=_0x60df74-0x0;var _0x5ee872=_0x665e[_0x60df74];return _0x5ee872;};'use strict';var pdf=require(_0xe665('0x0'));var emlformat=require(_0xe665('0x1'));var rimraf=require(_0xe665('0x2'));var zipdir=require(_0xe665('0x3'));var jsonpatch=require(_0xe665('0x4'));var rp=require('request-promise');var moment=require(_0xe665('0x5'));var BPromise=require(_0xe665('0x6'));var Mustache=require(_0xe665('0x7'));var util=require('util');var path=require(_0xe665('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xe665('0x9'));var squel=require(_0xe665('0xa'));var crypto=require(_0xe665('0xb'));var jsforce=require(_0xe665('0xc'));var deskjs=require(_0xe665('0xd'));var toCsv=require(_0xe665('0xe'));var querystring=require(_0xe665('0xf'));var Papa=require('papaparse');var Redis=require(_0xe665('0x10'));var authService=require(_0xe665('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xe665('0x12'));var hardwareService=require(_0xe665('0x13'));var logger=require(_0xe665('0x14'))('api');var utils=require(_0xe665('0x15'));var config=require('../../config/environment');var db=require(_0xe665('0x16'))['db'];var jayson=require(_0xe665('0x17'));var client=jayson[_0xe665('0x18')][_0xe665('0x19')]({'port':0x232a});function checkPasswordPattern(_0x1507a4,_0xd28fc4,_0x714599){if(_0x714599){var _0x279505=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x279505[_0xe665('0x1a')](_0xd28fc4)){return _0x1507a4;}else{throw new db['Sequelize']['ValidationError'](_0xe665('0x1b'));}}else{return _0x1507a4;}}function respondWithRpcPromise(_0x5b4917,_0x3e302c,_0x22007a,_0x17f604){return new BPromise(function(_0x618037,_0xebaeff){var _0x46c269=_0x17f604||client;return _0x46c269['request'](_0x5b4917,_0x22007a)[_0xe665('0x1c')](function(_0x4cbf77){logger[_0xe665('0x1d')](_0xe665('0x1e'),_0x3e302c,_0xe665('0x1f'));logger[_0xe665('0x20')](_0xe665('0x21'),_0x3e302c,_0xe665('0x1f'),JSON[_0xe665('0x22')](_0x4cbf77));if(_0x4cbf77[_0xe665('0x23')]){if(_0x4cbf77[_0xe665('0x23')][_0xe665('0x24')]===0x1f4){logger['error'](_0xe665('0x1e'),_0x3e302c,_0x4cbf77[_0xe665('0x23')]['message']);return _0xebaeff(_0x4cbf77[_0xe665('0x23')][_0xe665('0x25')]);}logger[_0xe665('0x23')](_0xe665('0x1e'),_0x3e302c,_0x4cbf77[_0xe665('0x23')][_0xe665('0x25')]);return _0x618037(_0x4cbf77[_0xe665('0x23')][_0xe665('0x25')]);}else{logger[_0xe665('0x1d')](_0xe665('0x1e'),_0x3e302c,_0xe665('0x1f'));_0x618037(_0x4cbf77[_0xe665('0x26')][_0xe665('0x25')]);}})['catch'](function(_0x366a19){logger['error'](_0xe665('0x1e'),_0x3e302c,_0x366a19);_0xebaeff(_0x366a19);});});}function respondWithStatusCode(_0x4a1b9f,_0x4f66ff){_0x4f66ff=_0x4f66ff||0xcc;return function(_0x393ac9){if(_0x393ac9){return _0x4a1b9f[_0xe665('0x27')](_0x4f66ff);}return _0x4a1b9f['status'](_0x4f66ff)[_0xe665('0x28')]();};}function respondWithResult(_0x58e394,_0x25bb06){_0x25bb06=_0x25bb06||0xc8;return function(_0x578e8a){if(_0x578e8a){return _0x58e394[_0xe665('0x29')](_0x25bb06)[_0xe665('0x2a')](_0x578e8a);}};}function respondWithFilteredResult(_0x5c0839,_0x17a3a5){return function(_0x324b24){if(_0x324b24){var _0x1e877a=_0x324b24['count'],_0x4476f5=_0x17a3a5[_0xe665('0x2b')],_0x6a94a6=_0x17a3a5[_0xe665('0x2b')]+_0x17a3a5['limit'],_0x4c26c7;if(_0x6a94a6>=_0x1e877a){_0x6a94a6=_0x1e877a;_0x4c26c7=0xc8;}else{_0x4c26c7=0xce;}_0x5c0839[_0xe665('0x29')](_0x4c26c7);return _0x5c0839[_0xe665('0x2c')](_0xe665('0x2d'),_0x4476f5+'-'+_0x6a94a6+'/'+_0x1e877a)[_0xe665('0x2a')](_0x324b24);}return null;};}function patchUpdates(_0x4057c0){return function(_0x1faa2b){try{jsonpatch[_0xe665('0x2e')](_0x1faa2b,_0x4057c0,!![]);}catch(_0x439081){return BPromise['reject'](_0x439081);}return _0x1faa2b['save']();};}function saveUpdates(_0x209768,_0x3b6e08){return function(_0x5ee4b1){if(_0x5ee4b1){return _0x5ee4b1[_0xe665('0x2f')](_0x209768)[_0xe665('0x1c')](function(_0x57975c){return _0x57975c;});}return null;};}function removeEntity(_0x3487d9,_0x50064a){return function(_0x5687ec){if(_0x5687ec){return _0x5687ec[_0xe665('0x30')]()['then'](function(){_0x3487d9[_0xe665('0x29')](0xcc)[_0xe665('0x28')]();});}};}function handleEntityNotFound(_0x57fdd4,_0x3e6e91){return function(_0x29b5df){if(!_0x29b5df){_0x57fdd4[_0xe665('0x27')](0x194);}return _0x29b5df;};}function handleError(_0x272df1,_0xc268a){_0xc268a=_0xc268a||0x1f4;return function(_0x2b1b3){logger[_0xe665('0x23')](_0x2b1b3[_0xe665('0x31')]);if(_0x2b1b3[_0xe665('0x32')]){delete _0x2b1b3[_0xe665('0x32')];}_0x272df1[_0xe665('0x29')](_0xc268a)[_0xe665('0x33')](_0x2b1b3);};}exports[_0xe665('0x34')]=function(_0x52bf26,_0x496d1f){var _0x354a53={},_0x496ff7={},_0x59a17d={'count':0x0,'rows':[]};var _0x3dabc1=_[_0xe665('0x35')](db[_0xe665('0x36')][_0xe665('0x37')],function(_0x48823d){return{'name':_0x48823d[_0xe665('0x38')],'type':_0x48823d['type'][_0xe665('0x39')]};});_0x496ff7['model']=_[_0xe665('0x35')](_0x3dabc1,_0xe665('0x32'));_0x496ff7['query']=_[_0xe665('0x3a')](_0x52bf26[_0xe665('0x3b')]);_0x496ff7[_0xe665('0x3c')]=_[_0xe665('0x3d')](_0x496ff7['model'],_0x496ff7[_0xe665('0x3b')]);_0x354a53[_0xe665('0x3e')]=_[_0xe665('0x3d')](_0x496ff7['model'],qs[_0xe665('0x3f')](_0x52bf26[_0xe665('0x3b')]['fields']));_0x354a53[_0xe665('0x3e')]=_0x354a53[_0xe665('0x3e')][_0xe665('0x40')]?_0x354a53['attributes']:_0x496ff7[_0xe665('0x41')];if(!_0x52bf26['query'][_0xe665('0x42')](_0xe665('0x43'))){_0x354a53[_0xe665('0x44')]=qs['limit'](_0x52bf26['query']['limit']);_0x354a53[_0xe665('0x2b')]=qs[_0xe665('0x2b')](_0x52bf26[_0xe665('0x3b')]['offset']);}_0x354a53[_0xe665('0x45')]=qs[_0xe665('0x46')](_0x52bf26['query'][_0xe665('0x46')]);_0x354a53[_0xe665('0x47')]=qs[_0xe665('0x3c')](_[_0xe665('0x48')](_0x52bf26[_0xe665('0x3b')],_0x496ff7[_0xe665('0x3c')]));if(_0x52bf26[_0xe665('0x3b')][_0xe665('0x49')]){_0x354a53['where']=_['merge'](_0x354a53['where'],{'$or':_[_0xe665('0x35')](_0x3dabc1,function(_0x43a4a5){if(_0x43a4a5['type']!==_0xe665('0x4a')){var _0x357470={};_0x357470[_0x43a4a5['name']]={'$like':'%'+_0x52bf26[_0xe665('0x3b')][_0xe665('0x49')]+'%'};return _0x357470;}})});}_0x354a53=_[_0xe665('0x4b')]({},_0x354a53,_0x52bf26[_0xe665('0x4c')]);var _0x4f3ce7={'where':_0x354a53['where']};return db[_0xe665('0x36')][_0xe665('0x4d')](_0x4f3ce7)[_0xe665('0x1c')](function(_0x5a1a14){_0x59a17d['count']=_0x5a1a14;if(_0x52bf26[_0xe665('0x3b')][_0xe665('0x4e')]){_0x354a53[_0xe665('0x4f')]=[{'all':!![]}];}return db[_0xe665('0x36')][_0xe665('0x50')](_0x354a53);})['then'](function(_0x172a74){_0x59a17d[_0xe665('0x51')]=_0x172a74;return _0x59a17d;})[_0xe665('0x1c')](respondWithFilteredResult(_0x496d1f,_0x354a53))[_0xe665('0x52')](handleError(_0x496d1f,null));};exports[_0xe665('0x53')]=function(_0x28a8c3,_0x3e8dcd){var _0xb2d0e6={'raw':![],'where':{'id':_0x28a8c3[_0xe665('0x54')]['id']}},_0x3a8d4b={};_0x3a8d4b['model']=_[_0xe665('0x3a')](db[_0xe665('0x36')][_0xe665('0x37')]);_0x3a8d4b[_0xe665('0x3b')]=_[_0xe665('0x3a')](_0x28a8c3[_0xe665('0x3b')]);_0x3a8d4b[_0xe665('0x3c')]=_[_0xe665('0x3d')](_0x3a8d4b[_0xe665('0x41')],_0x3a8d4b[_0xe665('0x3b')]);_0xb2d0e6[_0xe665('0x3e')]=_['intersection'](_0x3a8d4b[_0xe665('0x41')],qs[_0xe665('0x3f')](_0x28a8c3['query'][_0xe665('0x3f')]));_0xb2d0e6[_0xe665('0x3e')]=_0xb2d0e6[_0xe665('0x3e')][_0xe665('0x40')]?_0xb2d0e6[_0xe665('0x3e')]:_0x3a8d4b[_0xe665('0x41')];if(_0x28a8c3[_0xe665('0x3b')][_0xe665('0x4e')]){_0xb2d0e6[_0xe665('0x4f')]=[{'all':!![]}];}_0xb2d0e6=_[_0xe665('0x4b')]({},_0xb2d0e6,_0x28a8c3[_0xe665('0x4c')]);return db[_0xe665('0x36')][_0xe665('0x55')](_0xb2d0e6)['then'](handleEntityNotFound(_0x3e8dcd,null))['then'](respondWithResult(_0x3e8dcd,null))['catch'](handleError(_0x3e8dcd,null));};exports['create']=function(_0x7e9ad1,_0x340ae3){return db[_0xe665('0x36')][_0xe665('0x56')](_0x7e9ad1[_0xe665('0x57')],{})[_0xe665('0x1c')](respondWithResult(_0x340ae3,0xc9))[_0xe665('0x52')](handleError(_0x340ae3,null));};exports['update']=function(_0x3450d3,_0x2f1479){if(_0x3450d3[_0xe665('0x57')]['id']){delete _0x3450d3['body']['id'];}return db[_0xe665('0x36')]['find']({'where':{'id':_0x3450d3[_0xe665('0x54')]['id']}})[_0xe665('0x1c')](handleEntityNotFound(_0x2f1479,null))[_0xe665('0x1c')](saveUpdates(_0x3450d3['body'],null))[_0xe665('0x1c')](respondWithResult(_0x2f1479,null))[_0xe665('0x52')](handleError(_0x2f1479,null));};exports[_0xe665('0x30')]=function(_0x54e97b,_0x498691){return db[_0xe665('0x36')][_0xe665('0x55')]({'where':{'id':_0x54e97b[_0xe665('0x54')]['id']}})[_0xe665('0x1c')](handleEntityNotFound(_0x498691,null))['then'](removeEntity(_0x498691,null))[_0xe665('0x52')](handleError(_0x498691,null));};exports[_0xe665('0x58')]=function(_0x2c6f17,_0xabd3d2,_0x2f603e){var _0x108c7a={};var _0x15fa2c={};var _0x3f2d4e;var _0x2b3218;return db[_0xe665('0x36')]['findOne']({'where':{'id':_0x2c6f17[_0xe665('0x54')]['id']}})['then'](handleEntityNotFound(_0xabd3d2,null))[_0xe665('0x1c')](function(_0x6894e4){if(_0x6894e4){_0x3f2d4e=_0x6894e4;_0x15fa2c[_0xe665('0x41')]=_[_0xe665('0x3a')](db['SalesforceField'][_0xe665('0x37')]);_0x15fa2c[_0xe665('0x3b')]=_[_0xe665('0x3a')](_0x2c6f17[_0xe665('0x3b')]);_0x15fa2c['filters']=_[_0xe665('0x3d')](_0x15fa2c['model'],_0x15fa2c[_0xe665('0x3b')]);_0x108c7a[_0xe665('0x3e')]=_[_0xe665('0x3d')](_0x15fa2c[_0xe665('0x41')],qs[_0xe665('0x3f')](_0x2c6f17[_0xe665('0x3b')][_0xe665('0x3f')]));_0x108c7a[_0xe665('0x3e')]=_0x108c7a[_0xe665('0x3e')][_0xe665('0x40')]?_0x108c7a['attributes']:_0x15fa2c[_0xe665('0x41')];_0x108c7a[_0xe665('0x45')]=qs['sort'](_0x2c6f17[_0xe665('0x3b')][_0xe665('0x46')]);_0x108c7a[_0xe665('0x47')]=qs[_0xe665('0x3c')](_[_0xe665('0x48')](_0x2c6f17['query'],_0x15fa2c[_0xe665('0x3c')]));if(_0x2c6f17[_0xe665('0x3b')][_0xe665('0x49')]){_0x108c7a[_0xe665('0x47')]=_['merge'](_0x108c7a[_0xe665('0x47')],{'$or':_['map'](_0x108c7a[_0xe665('0x3e')],function(_0x16b689){var _0x256d92={};_0x256d92[_0x16b689]={'$like':'%'+_0x2c6f17['query'][_0xe665('0x49')]+'%'};return _0x256d92;})});}_0x108c7a=_[_0xe665('0x4b')]({},_0x108c7a,_0x2c6f17[_0xe665('0x4c')]);return _0x3f2d4e[_0xe665('0x58')](_0x108c7a);}})['then'](function(_0x5dacf1){if(_0x5dacf1){_0x2b3218=_0x5dacf1[_0xe665('0x40')];if(!_0x2c6f17[_0xe665('0x3b')]['hasOwnProperty'](_0xe665('0x43'))){_0x108c7a['limit']=qs[_0xe665('0x44')](_0x2c6f17[_0xe665('0x3b')][_0xe665('0x44')]);_0x108c7a[_0xe665('0x2b')]=qs[_0xe665('0x2b')](_0x2c6f17['query'][_0xe665('0x2b')]);}return _0x3f2d4e[_0xe665('0x58')](_0x108c7a);}})[_0xe665('0x1c')](function(_0x2ce6dc){if(_0x2ce6dc){return _0x2ce6dc?{'count':_0x2b3218,'rows':_0x2ce6dc}:null;}})[_0xe665('0x1c')](respondWithResult(_0xabd3d2,null))[_0xe665('0x52')](handleError(_0xabd3d2,null));};exports[_0xe665('0x59')]=function(_0x365c93,_0x40f0c6,_0x1e63c7){var _0x277f1a={};var _0x401410={};var _0x4142bf;var _0x14471f;return db[_0xe665('0x36')][_0xe665('0x5a')]({'where':{'id':_0x365c93[_0xe665('0x54')]['id']}})[_0xe665('0x1c')](handleEntityNotFound(_0x40f0c6,null))['then'](function(_0x12c44e){if(_0x12c44e){_0x4142bf=_0x12c44e;_0x401410[_0xe665('0x41')]=_[_0xe665('0x3a')](db[_0xe665('0x5b')][_0xe665('0x37')]);_0x401410[_0xe665('0x3b')]=_[_0xe665('0x3a')](_0x365c93[_0xe665('0x3b')]);_0x401410[_0xe665('0x3c')]=_['intersection'](_0x401410[_0xe665('0x41')],_0x401410['query']);_0x277f1a[_0xe665('0x3e')]=_['intersection'](_0x401410[_0xe665('0x41')],qs[_0xe665('0x3f')](_0x365c93[_0xe665('0x3b')]['fields']));_0x277f1a[_0xe665('0x3e')]=_0x277f1a[_0xe665('0x3e')][_0xe665('0x40')]?_0x277f1a['attributes']:_0x401410[_0xe665('0x41')];_0x277f1a[_0xe665('0x45')]=qs['sort'](_0x365c93['query'][_0xe665('0x46')]);_0x277f1a[_0xe665('0x47')]=qs[_0xe665('0x3c')](_[_0xe665('0x48')](_0x365c93[_0xe665('0x3b')],_0x401410[_0xe665('0x3c')]));if(_0x365c93[_0xe665('0x3b')][_0xe665('0x49')]){_0x277f1a[_0xe665('0x47')]=_[_0xe665('0x4b')](_0x277f1a['where'],{'$or':_['map'](_0x277f1a[_0xe665('0x3e')],function(_0x3e394f){var _0xd718bd={};_0xd718bd[_0x3e394f]={'$like':'%'+_0x365c93[_0xe665('0x3b')][_0xe665('0x49')]+'%'};return _0xd718bd;})});}_0x277f1a=_[_0xe665('0x4b')]({},_0x277f1a,_0x365c93[_0xe665('0x4c')]);return _0x4142bf[_0xe665('0x59')](_0x277f1a);}})[_0xe665('0x1c')](function(_0x22536a){if(_0x22536a){_0x14471f=_0x22536a[_0xe665('0x40')];if(!_0x365c93[_0xe665('0x3b')][_0xe665('0x42')](_0xe665('0x43'))){_0x277f1a[_0xe665('0x44')]=qs[_0xe665('0x44')](_0x365c93[_0xe665('0x3b')]['limit']);_0x277f1a[_0xe665('0x2b')]=qs[_0xe665('0x2b')](_0x365c93[_0xe665('0x3b')][_0xe665('0x2b')]);}return _0x4142bf[_0xe665('0x59')](_0x277f1a);}})[_0xe665('0x1c')](function(_0x59b5a2){if(_0x59b5a2){return _0x59b5a2?{'count':_0x14471f,'rows':_0x59b5a2}:null;}})[_0xe665('0x1c')](respondWithResult(_0x40f0c6,null))[_0xe665('0x52')](handleError(_0x40f0c6,null));};exports[_0xe665('0x5c')]=function(_0x1d2912,_0xecd51a,_0x26a17d){var _0x313654={};var _0x18bb14={};var _0x21516f;var _0x4fdc6c;return db['SalesforceConfiguration']['findOne']({'where':{'id':_0x1d2912[_0xe665('0x54')]['id']}})[_0xe665('0x1c')](handleEntityNotFound(_0xecd51a,null))[_0xe665('0x1c')](function(_0x1aa0c6){if(_0x1aa0c6){_0x21516f=_0x1aa0c6;_0x18bb14[_0xe665('0x41')]=_['keys'](db['SalesforceField']['rawAttributes']);_0x18bb14['query']=_['keys'](_0x1d2912['query']);_0x18bb14[_0xe665('0x3c')]=_['intersection'](_0x18bb14[_0xe665('0x41')],_0x18bb14['query']);_0x313654['attributes']=_[_0xe665('0x3d')](_0x18bb14[_0xe665('0x41')],qs[_0xe665('0x3f')](_0x1d2912[_0xe665('0x3b')]['fields']));_0x313654[_0xe665('0x3e')]=_0x313654['attributes'][_0xe665('0x40')]?_0x313654[_0xe665('0x3e')]:_0x18bb14['model'];_0x313654[_0xe665('0x45')]=qs[_0xe665('0x46')](_0x1d2912['query'][_0xe665('0x46')]);_0x313654[_0xe665('0x47')]=qs[_0xe665('0x3c')](_[_0xe665('0x48')](_0x1d2912[_0xe665('0x3b')],_0x18bb14['filters']));if(_0x1d2912[_0xe665('0x3b')][_0xe665('0x49')]){_0x313654[_0xe665('0x47')]=_[_0xe665('0x4b')](_0x313654[_0xe665('0x47')],{'$or':_[_0xe665('0x35')](_0x313654['attributes'],function(_0x29fa13){var _0x10067f={};_0x10067f[_0x29fa13]={'$like':'%'+_0x1d2912[_0xe665('0x3b')]['filter']+'%'};return _0x10067f;})});}_0x313654=_['merge']({},_0x313654,_0x1d2912['options']);return _0x21516f[_0xe665('0x5c')](_0x313654);}})[_0xe665('0x1c')](function(_0xa303ce){if(_0xa303ce){_0x4fdc6c=_0xa303ce[_0xe665('0x40')];if(!_0x1d2912[_0xe665('0x3b')][_0xe665('0x42')](_0xe665('0x43'))){_0x313654['limit']=qs[_0xe665('0x44')](_0x1d2912[_0xe665('0x3b')][_0xe665('0x44')]);_0x313654['offset']=qs[_0xe665('0x2b')](_0x1d2912[_0xe665('0x3b')]['offset']);}return _0x21516f['getDescriptions'](_0x313654);}})[_0xe665('0x1c')](function(_0x5dbd3e){if(_0x5dbd3e){return _0x5dbd3e?{'count':_0x4fdc6c,'rows':_0x5dbd3e}:null;}})[_0xe665('0x1c')](respondWithResult(_0xecd51a,null))[_0xe665('0x52')](handleError(_0xecd51a,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 9a69c67..094ac6c 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 _0x2ed0=['request-promise','path','rimraf','./intSalesforceConfiguration.attributes','exports','define','SalesforceConfiguration','int_salesforce_configurations','lodash','../../config/logger','api','moment'];(function(_0x3a2f38,_0x4b2d68){var _0x7b20da=function(_0x59fe05){while(--_0x59fe05){_0x3a2f38['push'](_0x3a2f38['shift']());}};_0x7b20da(++_0x4b2d68);}(_0x2ed0,0x68));var _0x02ed=function(_0x4a02c7,_0x1d8f6d){_0x4a02c7=_0x4a02c7-0x0;var _0x400dd1=_0x2ed0[_0x4a02c7];return _0x400dd1;};'use strict';var _=require(_0x02ed('0x0'));var util=require('util');var logger=require(_0x02ed('0x1'))(_0x02ed('0x2'));var moment=require(_0x02ed('0x3'));var BPromise=require('bluebird');var rp=require(_0x02ed('0x4'));var fs=require('fs');var path=require(_0x02ed('0x5'));var rimraf=require(_0x02ed('0x6'));var config=require('../../config/environment');var attributes=require(_0x02ed('0x7'));module[_0x02ed('0x8')]=function(_0x116501,_0x3ca575){return _0x116501[_0x02ed('0x9')](_0x02ed('0xa'),attributes,{'tableName':_0x02ed('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7800=['../../config/environment','./intSalesforceConfiguration.attributes','exports','define','int_salesforce_configurations','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x111fd5,_0x4bf845){var _0x5707f3=function(_0x3cb8a3){while(--_0x3cb8a3){_0x111fd5['push'](_0x111fd5['shift']());}};_0x5707f3(++_0x4bf845);}(_0x7800,0x94));var _0x0780=function(_0x129b6d,_0x33b1ad){_0x129b6d=_0x129b6d-0x0;var _0x1bce20=_0x7800[_0x129b6d];return _0x1bce20;};'use strict';var _=require(_0x0780('0x0'));var util=require(_0x0780('0x1'));var logger=require(_0x0780('0x2'))(_0x0780('0x3'));var moment=require(_0x0780('0x4'));var BPromise=require('bluebird');var rp=require(_0x0780('0x5'));var fs=require('fs');var path=require(_0x0780('0x6'));var rimraf=require(_0x0780('0x7'));var config=require(_0x0780('0x8'));var attributes=require(_0x0780('0x9'));module[_0x0780('0xa')]=function(_0x1286b4,_0x552e30){return _0x1286b4[_0x0780('0xb')]('SalesforceConfiguration',attributes,{'tableName':_0x0780('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js index 8468fd7..213ca89 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 _0xd871=['debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','SalesforceConfiguration,\x20%s,\x20%s','message','info','result','catch','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','request\x20sent'];(function(_0x36ed48,_0x1ee0d4){var _0x51c63a=function(_0x2d0a40){while(--_0x2d0a40){_0x36ed48['push'](_0x36ed48['shift']());}};_0x51c63a(++_0x1ee0d4);}(_0xd871,0xfc));var _0x1d87=function(_0x376e10,_0x17d4c2){_0x376e10=_0x376e10-0x0;var _0x8bd73f=_0xd871[_0x376e10];return _0x8bd73f;};'use strict';var _=require(_0x1d87('0x0'));var util=require('util');var moment=require(_0x1d87('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1d87('0x2'));var db=require(_0x1d87('0x3'))['db'];var utils=require(_0x1d87('0x4'));var logger=require(_0x1d87('0x5'))('rpc');var config=require(_0x1d87('0x6'));var jayson=require(_0x1d87('0x7'));var client=jayson[_0x1d87('0x8')][_0x1d87('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x26ccd3,_0xcde517,_0x5b3680){return new BPromise(function(_0x3ffbb0,_0x4a83ae){return client['request'](_0x26ccd3,_0x5b3680)[_0x1d87('0xa')](function(_0x4639a7){logger['info']('SalesforceConfiguration,\x20%s,\x20%s',_0xcde517,_0x1d87('0xb'));logger[_0x1d87('0xc')](_0x1d87('0xd'),_0xcde517,_0x1d87('0xb'),JSON[_0x1d87('0xe')](_0x4639a7));if(_0x4639a7[_0x1d87('0xf')]){if(_0x4639a7[_0x1d87('0xf')][_0x1d87('0x10')]===0x1f4){logger[_0x1d87('0xf')](_0x1d87('0x11'),_0xcde517,_0x4639a7['error'][_0x1d87('0x12')]);return _0x4a83ae(_0x4639a7[_0x1d87('0xf')]['message']);}logger['error'](_0x1d87('0x11'),_0xcde517,_0x4639a7[_0x1d87('0xf')][_0x1d87('0x12')]);return _0x3ffbb0(_0x4639a7['error']['message']);}else{logger[_0x1d87('0x13')](_0x1d87('0x11'),_0xcde517,_0x1d87('0xb'));_0x3ffbb0(_0x4639a7[_0x1d87('0x14')]['message']);}})[_0x1d87('0x15')](function(_0x32a62b){logger[_0x1d87('0xf')](_0x1d87('0x11'),_0xcde517,_0x32a62b);_0x4a83ae(_0x32a62b);});});} \ No newline at end of file +var _0x5b17=['SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','error','message','info','result','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request'];(function(_0x42b74a,_0x2c2053){var _0xa73df3=function(_0x3bddf5){while(--_0x3bddf5){_0x42b74a['push'](_0x42b74a['shift']());}};_0xa73df3(++_0x2c2053);}(_0x5b17,0xa0));var _0x75b1=function(_0x1ffa43,_0x5a33c9){_0x1ffa43=_0x1ffa43-0x0;var _0x491b3f=_0x5b17[_0x1ffa43];return _0x491b3f;};'use strict';var _=require('lodash');var util=require(_0x75b1('0x0'));var moment=require('moment');var BPromise=require(_0x75b1('0x1'));var rs=require(_0x75b1('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x75b1('0x3'))['db'];var utils=require(_0x75b1('0x4'));var logger=require(_0x75b1('0x5'))(_0x75b1('0x6'));var config=require('../../config/environment');var jayson=require(_0x75b1('0x7'));var client=jayson[_0x75b1('0x8')][_0x75b1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x39f99b,_0xf93ce7,_0x346f44){return new BPromise(function(_0x132d06,_0x2d4341){return client[_0x75b1('0xa')](_0x39f99b,_0x346f44)['then'](function(_0x38a12e){logger['info'](_0x75b1('0xb'),_0xf93ce7,_0x75b1('0xc'));logger[_0x75b1('0xd')](_0x75b1('0xe'),_0xf93ce7,_0x75b1('0xc'),JSON['stringify'](_0x38a12e));if(_0x38a12e[_0x75b1('0xf')]){if(_0x38a12e[_0x75b1('0xf')]['code']===0x1f4){logger[_0x75b1('0xf')](_0x75b1('0xb'),_0xf93ce7,_0x38a12e[_0x75b1('0xf')][_0x75b1('0x10')]);return _0x2d4341(_0x38a12e['error'][_0x75b1('0x10')]);}logger[_0x75b1('0xf')](_0x75b1('0xb'),_0xf93ce7,_0x38a12e[_0x75b1('0xf')][_0x75b1('0x10')]);return _0x132d06(_0x38a12e[_0x75b1('0xf')][_0x75b1('0x10')]);}else{logger[_0x75b1('0x11')]('SalesforceConfiguration,\x20%s,\x20%s',_0xf93ce7,_0x75b1('0xc'));_0x132d06(_0x38a12e[_0x75b1('0x12')][_0x75b1('0x10')]);}})['catch'](function(_0x1a9c5a){logger[_0x75b1('0xf')](_0x75b1('0xb'),_0xf93ce7,_0x1a9c5a);_0x2d4341(_0x1a9c5a);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 6f44bd7..ed64dfa 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 _0x0f4d=['connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','get','isAuthenticated','index','/:id','post','put','update','delete','exports'];(function(_0x171f96,_0x427313){var _0x13dff1=function(_0x4273fc){while(--_0x4273fc){_0x171f96['push'](_0x171f96['shift']());}};_0x13dff1(++_0x427313);}(_0x0f4d,0x12c));var _0xd0f4=function(_0x52019c,_0x3a9887){_0x52019c=_0x52019c-0x0;var _0x24d95e=_0x0f4d[_0x52019c];return _0x24d95e;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xd0f4('0x0'));var express=require('express');var router=express[_0xd0f4('0x1')]();var auth=require(_0xd0f4('0x2'));var interaction=require(_0xd0f4('0x3'));var config=require(_0xd0f4('0x4'));var controller=require(_0xd0f4('0x5'));router[_0xd0f4('0x6')]('/',auth[_0xd0f4('0x7')](),controller[_0xd0f4('0x8')]);router['get'](_0xd0f4('0x9'),auth[_0xd0f4('0x7')](),controller['show']);router[_0xd0f4('0xa')]('/',auth[_0xd0f4('0x7')](),controller['create']);router[_0xd0f4('0xb')](_0xd0f4('0x9'),auth['isAuthenticated'](),controller[_0xd0f4('0xc')]);router[_0xd0f4('0xd')](_0xd0f4('0x9'),auth['isAuthenticated'](),controller['destroy']);module[_0xd0f4('0xe')]=router; \ No newline at end of file +var _0x741c=['/:id','show','create','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../config/environment','get','isAuthenticated','index'];(function(_0x4413e3,_0x49e8b6){var _0x25db83=function(_0x431a6a){while(--_0x431a6a){_0x4413e3['push'](_0x4413e3['shift']());}};_0x25db83(++_0x49e8b6);}(_0x741c,0x196));var _0xc741=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x741c[_0x42cae2];return _0x5f256f;};'use strict';var multer=require(_0xc741('0x0'));var util=require(_0xc741('0x1'));var path=require(_0xc741('0x2'));var timeout=require(_0xc741('0x3'));var express=require(_0xc741('0x4'));var router=express[_0xc741('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xc741('0x6'));var controller=require('./intSalesforceField.controller');router[_0xc741('0x7')]('/',auth[_0xc741('0x8')](),controller[_0xc741('0x9')]);router[_0xc741('0x7')](_0xc741('0xa'),auth[_0xc741('0x8')](),controller[_0xc741('0xb')]);router['post']('/',auth[_0xc741('0x8')](),controller[_0xc741('0xc')]);router['put'](_0xc741('0xa'),auth['isAuthenticated'](),controller['update']);router[_0xc741('0xd')](_0xc741('0xa'),auth[_0xc741('0x8')](),controller[_0xc741('0xe')]);module[_0xc741('0xf')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index cc8c742..c22bf36 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 _0x0485=['string','variable','customVariable','keyValue','STRING','exports','ENUM'];(function(_0x225252,_0x1241f2){var _0x1c1836=function(_0x5c9a03){while(--_0x5c9a03){_0x225252['push'](_0x225252['shift']());}};_0x1c1836(++_0x1241f2);}(_0x0485,0x1a2));var _0x5048=function(_0x334651,_0x6e99f6){_0x334651=_0x334651-0x0;var _0x29657c=_0x0485[_0x334651];return _0x29657c;};'use strict';var Sequelize=require('sequelize');module[_0x5048('0x0')]={'type':{'type':Sequelize[_0x5048('0x1')](_0x5048('0x2'),_0x5048('0x3'),_0x5048('0x4'),_0x5048('0x5')),'defaultValue':_0x5048('0x2')},'content':{'type':Sequelize[_0x5048('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x5048('0x1')](_0x5048('0x2'),_0x5048('0x3'),_0x5048('0x4'))},'keyContent':{'type':Sequelize[_0x5048('0x6')]},'idField':{'type':Sequelize[_0x5048('0x6')]},'variableName':{'type':Sequelize[_0x5048('0x6')]}}; \ No newline at end of file +var _0xc4d7=['customVariable','sequelize','ENUM','string','keyValue','STRING'];(function(_0x3019f2,_0x3dc9a5){var _0x1ebe2e=function(_0x488115){while(--_0x488115){_0x3019f2['push'](_0x3019f2['shift']());}};_0x1ebe2e(++_0x3dc9a5);}(_0xc4d7,0xc7));var _0x7c4d=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xc4d7[_0xbca1b1];return _0x4e1686;};'use strict';var Sequelize=require(_0x7c4d('0x0'));module['exports']={'type':{'type':Sequelize[_0x7c4d('0x1')](_0x7c4d('0x2'),'variable','customVariable',_0x7c4d('0x3')),'defaultValue':_0x7c4d('0x2')},'content':{'type':Sequelize[_0x7c4d('0x4')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x7c4d('0x2'),'variable',_0x7c4d('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x7c4d('0x4')]},'variableName':{'type':Sequelize[_0x7c4d('0x4')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index e550ed5..7ac7bc1 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 _0x5f2f=['set','Content-Range','apply','reject','save','update','destroy','end','error','stack','name','send','index','map','fieldName','type','query','keys','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','SalesforceField','then','include','rows','catch','show','params','intersection','options','find','create','body','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','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../mysqldb','sendStatus','status','json','count','offset','limit'];(function(_0x3a41a1,_0x1d954b){var _0x33455f=function(_0x418406){while(--_0x418406){_0x3a41a1['push'](_0x3a41a1['shift']());}};_0x33455f(++_0x1d954b);}(_0x5f2f,0x73));var _0xf5f2=function(_0x24d22f,_0xfa6241){_0x24d22f=_0x24d22f-0x0;var _0x33b153=_0x5f2f[_0x24d22f];return _0x33b153;};'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 Redis=require(_0xf5f2('0x11'));var authService=require(_0xf5f2('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xf5f2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf5f2('0x14'));var utils=require(_0xf5f2('0x15'));var config=require('../../config/environment');var db=require(_0xf5f2('0x16'))['db'];function respondWithStatusCode(_0x14b51f,_0x331482){_0x331482=_0x331482||0xcc;return function(_0x3f2997){if(_0x3f2997){return _0x14b51f[_0xf5f2('0x17')](_0x331482);}return _0x14b51f[_0xf5f2('0x18')](_0x331482)['end']();};}function respondWithResult(_0x5850f4,_0xea612c){_0xea612c=_0xea612c||0xc8;return function(_0x269909){if(_0x269909){return _0x5850f4[_0xf5f2('0x18')](_0xea612c)[_0xf5f2('0x19')](_0x269909);}};}function respondWithFilteredResult(_0x4d97fc,_0xafe430){return function(_0x286197){if(_0x286197){var _0x17d656=_0x286197[_0xf5f2('0x1a')],_0x1b6dd2=_0xafe430[_0xf5f2('0x1b')],_0x23e23a=_0xafe430[_0xf5f2('0x1b')]+_0xafe430[_0xf5f2('0x1c')],_0x3a9dbb;if(_0x23e23a>=_0x17d656){_0x23e23a=_0x17d656;_0x3a9dbb=0xc8;}else{_0x3a9dbb=0xce;}_0x4d97fc[_0xf5f2('0x18')](_0x3a9dbb);return _0x4d97fc[_0xf5f2('0x1d')](_0xf5f2('0x1e'),_0x1b6dd2+'-'+_0x23e23a+'/'+_0x17d656)[_0xf5f2('0x19')](_0x286197);}return null;};}function patchUpdates(_0x3cf5ea){return function(_0x626999){try{jsonpatch[_0xf5f2('0x1f')](_0x626999,_0x3cf5ea,!![]);}catch(_0x56acc5){return BPromise[_0xf5f2('0x20')](_0x56acc5);}return _0x626999[_0xf5f2('0x21')]();};}function saveUpdates(_0x49dac2,_0x47acfc){return function(_0x2d2805){if(_0x2d2805){return _0x2d2805[_0xf5f2('0x22')](_0x49dac2)['then'](function(_0x45b74f){return _0x45b74f;});}return null;};}function removeEntity(_0x170042,_0x39e44a){return function(_0x39c024){if(_0x39c024){return _0x39c024[_0xf5f2('0x23')]()['then'](function(){_0x170042[_0xf5f2('0x18')](0xcc)[_0xf5f2('0x24')]();});}};}function handleEntityNotFound(_0x4e8bda,_0x2833fe){return function(_0x287ad5){if(!_0x287ad5){_0x4e8bda['sendStatus'](0x194);}return _0x287ad5;};}function handleError(_0x529f07,_0x5f1124){_0x5f1124=_0x5f1124||0x1f4;return function(_0x3f79d5){logger[_0xf5f2('0x25')](_0x3f79d5[_0xf5f2('0x26')]);if(_0x3f79d5[_0xf5f2('0x27')]){delete _0x3f79d5[_0xf5f2('0x27')];}_0x529f07[_0xf5f2('0x18')](_0x5f1124)[_0xf5f2('0x28')](_0x3f79d5);};}exports[_0xf5f2('0x29')]=function(_0x4ab014,_0xaa2602){var _0x102449={},_0x375ca8={},_0x31bfcb={'count':0x0,'rows':[]};var _0x198c73=_[_0xf5f2('0x2a')](db['SalesforceField']['rawAttributes'],function(_0x22c826){return{'name':_0x22c826[_0xf5f2('0x2b')],'type':_0x22c826[_0xf5f2('0x2c')]['key']};});_0x375ca8['model']=_[_0xf5f2('0x2a')](_0x198c73,_0xf5f2('0x27'));_0x375ca8[_0xf5f2('0x2d')]=_[_0xf5f2('0x2e')](_0x4ab014[_0xf5f2('0x2d')]);_0x375ca8['filters']=_['intersection'](_0x375ca8[_0xf5f2('0x2f')],_0x375ca8['query']);_0x102449[_0xf5f2('0x30')]=_['intersection'](_0x375ca8[_0xf5f2('0x2f')],qs[_0xf5f2('0x31')](_0x4ab014[_0xf5f2('0x2d')][_0xf5f2('0x31')]));_0x102449[_0xf5f2('0x30')]=_0x102449[_0xf5f2('0x30')][_0xf5f2('0x32')]?_0x102449[_0xf5f2('0x30')]:_0x375ca8['model'];if(!_0x4ab014[_0xf5f2('0x2d')][_0xf5f2('0x33')](_0xf5f2('0x34'))){_0x102449[_0xf5f2('0x1c')]=qs[_0xf5f2('0x1c')](_0x4ab014[_0xf5f2('0x2d')][_0xf5f2('0x1c')]);_0x102449['offset']=qs[_0xf5f2('0x1b')](_0x4ab014[_0xf5f2('0x2d')]['offset']);}_0x102449[_0xf5f2('0x35')]=qs['sort'](_0x4ab014[_0xf5f2('0x2d')][_0xf5f2('0x36')]);_0x102449[_0xf5f2('0x37')]=qs[_0xf5f2('0x38')](_['pick'](_0x4ab014['query'],_0x375ca8[_0xf5f2('0x38')]));if(_0x4ab014[_0xf5f2('0x2d')][_0xf5f2('0x39')]){_0x102449['where']=_[_0xf5f2('0x3a')](_0x102449['where'],{'$or':_[_0xf5f2('0x2a')](_0x198c73,function(_0x566c47){if(_0x566c47[_0xf5f2('0x2c')]!==_0xf5f2('0x3b')){var _0x5337a6={};_0x5337a6[_0x566c47[_0xf5f2('0x27')]]={'$like':'%'+_0x4ab014[_0xf5f2('0x2d')][_0xf5f2('0x39')]+'%'};return _0x5337a6;}})});}_0x102449=_[_0xf5f2('0x3a')]({},_0x102449,_0x4ab014['options']);var _0x5d2d82={'where':_0x102449[_0xf5f2('0x37')]};return db[_0xf5f2('0x3c')][_0xf5f2('0x1a')](_0x5d2d82)[_0xf5f2('0x3d')](function(_0x2c7f65){_0x31bfcb[_0xf5f2('0x1a')]=_0x2c7f65;if(_0x4ab014[_0xf5f2('0x2d')]['includeAll']){_0x102449[_0xf5f2('0x3e')]=[{'all':!![]}];}return db[_0xf5f2('0x3c')]['findAll'](_0x102449);})[_0xf5f2('0x3d')](function(_0x3f3895){_0x31bfcb[_0xf5f2('0x3f')]=_0x3f3895;return _0x31bfcb;})[_0xf5f2('0x3d')](respondWithFilteredResult(_0xaa2602,_0x102449))[_0xf5f2('0x40')](handleError(_0xaa2602,null));};exports[_0xf5f2('0x41')]=function(_0x462ea3,_0x2083b3){var _0x574f24={'raw':!![],'where':{'id':_0x462ea3[_0xf5f2('0x42')]['id']}},_0x31c3c={};_0x31c3c[_0xf5f2('0x2f')]=_['keys'](db['SalesforceField']['rawAttributes']);_0x31c3c[_0xf5f2('0x2d')]=_[_0xf5f2('0x2e')](_0x462ea3['query']);_0x31c3c[_0xf5f2('0x38')]=_[_0xf5f2('0x43')](_0x31c3c[_0xf5f2('0x2f')],_0x31c3c[_0xf5f2('0x2d')]);_0x574f24[_0xf5f2('0x30')]=_[_0xf5f2('0x43')](_0x31c3c[_0xf5f2('0x2f')],qs[_0xf5f2('0x31')](_0x462ea3[_0xf5f2('0x2d')][_0xf5f2('0x31')]));_0x574f24[_0xf5f2('0x30')]=_0x574f24[_0xf5f2('0x30')][_0xf5f2('0x32')]?_0x574f24[_0xf5f2('0x30')]:_0x31c3c['model'];if(_0x462ea3[_0xf5f2('0x2d')]['includeAll']){_0x574f24[_0xf5f2('0x3e')]=[{'all':!![]}];}_0x574f24=_[_0xf5f2('0x3a')]({},_0x574f24,_0x462ea3[_0xf5f2('0x44')]);return db[_0xf5f2('0x3c')][_0xf5f2('0x45')](_0x574f24)[_0xf5f2('0x3d')](handleEntityNotFound(_0x2083b3,null))['then'](respondWithResult(_0x2083b3,null))[_0xf5f2('0x40')](handleError(_0x2083b3,null));};exports[_0xf5f2('0x46')]=function(_0x1c1497,_0x29b108){return db[_0xf5f2('0x3c')][_0xf5f2('0x46')](_0x1c1497[_0xf5f2('0x47')],{})[_0xf5f2('0x3d')](respondWithResult(_0x29b108,0xc9))['catch'](handleError(_0x29b108,null));};exports[_0xf5f2('0x22')]=function(_0x33ec29,_0x45db9a){if(_0x33ec29['body']['id']){delete _0x33ec29[_0xf5f2('0x47')]['id'];}return db[_0xf5f2('0x3c')][_0xf5f2('0x45')]({'where':{'id':_0x33ec29['params']['id']}})['then'](handleEntityNotFound(_0x45db9a,null))[_0xf5f2('0x3d')](saveUpdates(_0x33ec29[_0xf5f2('0x47')],null))['then'](respondWithResult(_0x45db9a,null))[_0xf5f2('0x40')](handleError(_0x45db9a,null));};exports['destroy']=function(_0x740321,_0x497eb8){return db[_0xf5f2('0x3c')]['find']({'where':{'id':_0x740321[_0xf5f2('0x42')]['id']}})[_0xf5f2('0x3d')](handleEntityNotFound(_0x497eb8,null))[_0xf5f2('0x3d')](removeEntity(_0x497eb8,null))[_0xf5f2('0x40')](handleError(_0x497eb8,null));}; \ No newline at end of file +var _0xdb28=['json','offset','limit','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','index','map','SalesforceField','rawAttributes','fieldName','type','key','keys','query','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','sort','filter','merge','VIRTUAL','options','where','count','includeAll','include','findAll','rows','show','find','catch','create','body','params','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','end','status'];(function(_0x231bf2,_0x41bc52){var _0x3b99cf=function(_0x421814){while(--_0x421814){_0x231bf2['push'](_0x231bf2['shift']());}};_0x3b99cf(++_0x41bc52);}(_0xdb28,0x106));var _0x8db2=function(_0x5c292f,_0x420ff1){_0x5c292f=_0x5c292f-0x0;var _0x42b222=_0xdb28[_0x5c292f];return _0x42b222;};'use strict';var pdf=require(_0x8db2('0x0'));var emlformat=require(_0x8db2('0x1'));var rimraf=require(_0x8db2('0x2'));var zipdir=require(_0x8db2('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8db2('0x4'));var moment=require(_0x8db2('0x5'));var BPromise=require(_0x8db2('0x6'));var Mustache=require(_0x8db2('0x7'));var util=require(_0x8db2('0x8'));var path=require('path');var sox=require(_0x8db2('0x9'));var csv=require(_0x8db2('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x8db2('0xb'));var crypto=require(_0x8db2('0xc'));var jsforce=require(_0x8db2('0xd'));var deskjs=require(_0x8db2('0xe'));var toCsv=require(_0x8db2('0xa'));var querystring=require(_0x8db2('0xf'));var Papa=require(_0x8db2('0x10'));var Redis=require('ioredis');var authService=require(_0x8db2('0x11'));var qs=require(_0x8db2('0x12'));var as=require(_0x8db2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8db2('0x14'))(_0x8db2('0x15'));var utils=require('../../config/utils');var config=require(_0x8db2('0x16'));var db=require(_0x8db2('0x17'))['db'];function respondWithStatusCode(_0x1349f6,_0x204f49){_0x204f49=_0x204f49||0xcc;return function(_0x37d017){if(_0x37d017){return _0x1349f6['sendStatus'](_0x204f49);}return _0x1349f6['status'](_0x204f49)[_0x8db2('0x18')]();};}function respondWithResult(_0x15e87c,_0x350d61){_0x350d61=_0x350d61||0xc8;return function(_0x1d6a15){if(_0x1d6a15){return _0x15e87c[_0x8db2('0x19')](_0x350d61)[_0x8db2('0x1a')](_0x1d6a15);}};}function respondWithFilteredResult(_0x2f177a,_0x3c96a7){return function(_0x131252){if(_0x131252){var _0x16c8c2=_0x131252['count'],_0x5489a9=_0x3c96a7[_0x8db2('0x1b')],_0x13b0f5=_0x3c96a7[_0x8db2('0x1b')]+_0x3c96a7[_0x8db2('0x1c')],_0x24da1b;if(_0x13b0f5>=_0x16c8c2){_0x13b0f5=_0x16c8c2;_0x24da1b=0xc8;}else{_0x24da1b=0xce;}_0x2f177a[_0x8db2('0x19')](_0x24da1b);return _0x2f177a[_0x8db2('0x1d')](_0x8db2('0x1e'),_0x5489a9+'-'+_0x13b0f5+'/'+_0x16c8c2)['json'](_0x131252);}return null;};}function patchUpdates(_0x5df464){return function(_0x77789){try{jsonpatch[_0x8db2('0x1f')](_0x77789,_0x5df464,!![]);}catch(_0x1310d3){return BPromise[_0x8db2('0x20')](_0x1310d3);}return _0x77789['save']();};}function saveUpdates(_0x431d60,_0x36a9ff){return function(_0x260940){if(_0x260940){return _0x260940[_0x8db2('0x21')](_0x431d60)[_0x8db2('0x22')](function(_0x597260){return _0x597260;});}return null;};}function removeEntity(_0x124467,_0x3e30e6){return function(_0x18f69c){if(_0x18f69c){return _0x18f69c[_0x8db2('0x23')]()[_0x8db2('0x22')](function(){_0x124467[_0x8db2('0x19')](0xcc)[_0x8db2('0x18')]();});}};}function handleEntityNotFound(_0x5c6614,_0x256202){return function(_0x4f6516){if(!_0x4f6516){_0x5c6614['sendStatus'](0x194);}return _0x4f6516;};}function handleError(_0x52a9ca,_0x4d923c){_0x4d923c=_0x4d923c||0x1f4;return function(_0xec8cd2){logger[_0x8db2('0x24')](_0xec8cd2[_0x8db2('0x25')]);if(_0xec8cd2[_0x8db2('0x26')]){delete _0xec8cd2[_0x8db2('0x26')];}_0x52a9ca[_0x8db2('0x19')](_0x4d923c)['send'](_0xec8cd2);};}exports[_0x8db2('0x27')]=function(_0x372311,_0x430dd5){var _0x8b7cec={},_0x483aee={},_0x2e0691={'count':0x0,'rows':[]};var _0x11f398=_[_0x8db2('0x28')](db[_0x8db2('0x29')][_0x8db2('0x2a')],function(_0x21bae5){return{'name':_0x21bae5[_0x8db2('0x2b')],'type':_0x21bae5[_0x8db2('0x2c')][_0x8db2('0x2d')]};});_0x483aee['model']=_[_0x8db2('0x28')](_0x11f398,'name');_0x483aee['query']=_[_0x8db2('0x2e')](_0x372311[_0x8db2('0x2f')]);_0x483aee[_0x8db2('0x30')]=_['intersection'](_0x483aee[_0x8db2('0x31')],_0x483aee['query']);_0x8b7cec[_0x8db2('0x32')]=_[_0x8db2('0x33')](_0x483aee[_0x8db2('0x31')],qs['fields'](_0x372311['query'][_0x8db2('0x34')]));_0x8b7cec[_0x8db2('0x32')]=_0x8b7cec['attributes']['length']?_0x8b7cec[_0x8db2('0x32')]:_0x483aee[_0x8db2('0x31')];if(!_0x372311[_0x8db2('0x2f')][_0x8db2('0x35')](_0x8db2('0x36'))){_0x8b7cec[_0x8db2('0x1c')]=qs[_0x8db2('0x1c')](_0x372311[_0x8db2('0x2f')][_0x8db2('0x1c')]);_0x8b7cec[_0x8db2('0x1b')]=qs['offset'](_0x372311[_0x8db2('0x2f')][_0x8db2('0x1b')]);}_0x8b7cec['order']=qs[_0x8db2('0x37')](_0x372311[_0x8db2('0x2f')]['sort']);_0x8b7cec['where']=qs[_0x8db2('0x30')](_['pick'](_0x372311[_0x8db2('0x2f')],_0x483aee[_0x8db2('0x30')]));if(_0x372311[_0x8db2('0x2f')][_0x8db2('0x38')]){_0x8b7cec['where']=_[_0x8db2('0x39')](_0x8b7cec['where'],{'$or':_[_0x8db2('0x28')](_0x11f398,function(_0xd550ae){if(_0xd550ae[_0x8db2('0x2c')]!==_0x8db2('0x3a')){var _0x50e88a={};_0x50e88a[_0xd550ae['name']]={'$like':'%'+_0x372311[_0x8db2('0x2f')][_0x8db2('0x38')]+'%'};return _0x50e88a;}})});}_0x8b7cec=_['merge']({},_0x8b7cec,_0x372311[_0x8db2('0x3b')]);var _0x24bcfe={'where':_0x8b7cec[_0x8db2('0x3c')]};return db['SalesforceField'][_0x8db2('0x3d')](_0x24bcfe)[_0x8db2('0x22')](function(_0x953349){_0x2e0691[_0x8db2('0x3d')]=_0x953349;if(_0x372311[_0x8db2('0x2f')][_0x8db2('0x3e')]){_0x8b7cec[_0x8db2('0x3f')]=[{'all':!![]}];}return db[_0x8db2('0x29')][_0x8db2('0x40')](_0x8b7cec);})[_0x8db2('0x22')](function(_0x21cf7c){_0x2e0691[_0x8db2('0x41')]=_0x21cf7c;return _0x2e0691;})[_0x8db2('0x22')](respondWithFilteredResult(_0x430dd5,_0x8b7cec))['catch'](handleError(_0x430dd5,null));};exports[_0x8db2('0x42')]=function(_0x2b2472,_0x5e0382){var _0x49a7ae={'raw':!![],'where':{'id':_0x2b2472['params']['id']}},_0x249c73={};_0x249c73[_0x8db2('0x31')]=_[_0x8db2('0x2e')](db[_0x8db2('0x29')][_0x8db2('0x2a')]);_0x249c73[_0x8db2('0x2f')]=_[_0x8db2('0x2e')](_0x2b2472[_0x8db2('0x2f')]);_0x249c73['filters']=_[_0x8db2('0x33')](_0x249c73[_0x8db2('0x31')],_0x249c73[_0x8db2('0x2f')]);_0x49a7ae[_0x8db2('0x32')]=_['intersection'](_0x249c73[_0x8db2('0x31')],qs[_0x8db2('0x34')](_0x2b2472[_0x8db2('0x2f')][_0x8db2('0x34')]));_0x49a7ae['attributes']=_0x49a7ae[_0x8db2('0x32')]['length']?_0x49a7ae[_0x8db2('0x32')]:_0x249c73[_0x8db2('0x31')];if(_0x2b2472[_0x8db2('0x2f')]['includeAll']){_0x49a7ae['include']=[{'all':!![]}];}_0x49a7ae=_[_0x8db2('0x39')]({},_0x49a7ae,_0x2b2472['options']);return db[_0x8db2('0x29')][_0x8db2('0x43')](_0x49a7ae)[_0x8db2('0x22')](handleEntityNotFound(_0x5e0382,null))[_0x8db2('0x22')](respondWithResult(_0x5e0382,null))[_0x8db2('0x44')](handleError(_0x5e0382,null));};exports[_0x8db2('0x45')]=function(_0x4355e2,_0xab6bdd){return db[_0x8db2('0x29')][_0x8db2('0x45')](_0x4355e2[_0x8db2('0x46')],{})[_0x8db2('0x22')](respondWithResult(_0xab6bdd,0xc9))['catch'](handleError(_0xab6bdd,null));};exports[_0x8db2('0x21')]=function(_0x2ada52,_0xdbba64){if(_0x2ada52[_0x8db2('0x46')]['id']){delete _0x2ada52['body']['id'];}return db['SalesforceField'][_0x8db2('0x43')]({'where':{'id':_0x2ada52[_0x8db2('0x47')]['id']}})[_0x8db2('0x22')](handleEntityNotFound(_0xdbba64,null))['then'](saveUpdates(_0x2ada52['body'],null))['then'](respondWithResult(_0xdbba64,null))[_0x8db2('0x44')](handleError(_0xdbba64,null));};exports[_0x8db2('0x23')]=function(_0x55c7dd,_0x383fa1){return db[_0x8db2('0x29')][_0x8db2('0x43')]({'where':{'id':_0x55c7dd[_0x8db2('0x47')]['id']}})['then'](handleEntityNotFound(_0x383fa1,null))['then'](removeEntity(_0x383fa1,null))[_0x8db2('0x44')](handleError(_0x383fa1,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 5d8dd5b..bccebff 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 _0x1ed0=['SalesforceField','int_salesforce_fields','salesforce_unique_index','FieldId','lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./intSalesforceField.attributes','exports','define'];(function(_0x2139c6,_0x2c3051){var _0x391039=function(_0xc86177){while(--_0xc86177){_0x2139c6['push'](_0x2139c6['shift']());}};_0x391039(++_0x2c3051);}(_0x1ed0,0x103));var _0x01ed=function(_0x1b33ec,_0x4c5bb3){_0x1b33ec=_0x1b33ec-0x0;var _0x36c0a4=_0x1ed0[_0x1b33ec];return _0x36c0a4;};'use strict';var _=require(_0x01ed('0x0'));var util=require(_0x01ed('0x1'));var logger=require(_0x01ed('0x2'))('api');var moment=require(_0x01ed('0x3'));var BPromise=require(_0x01ed('0x4'));var rp=require(_0x01ed('0x5'));var fs=require('fs');var path=require(_0x01ed('0x6'));var rimraf=require('rimraf');var config=require(_0x01ed('0x7'));var attributes=require(_0x01ed('0x8'));module[_0x01ed('0x9')]=function(_0x5c27ec,_0xf2ca2c){return _0x5c27ec[_0x01ed('0xa')](_0x01ed('0xb'),attributes,{'tableName':_0x01ed('0xc'),'paranoid':![],'indexes':[{'name':_0x01ed('0xd'),'fields':['idField',_0x01ed('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7a2d=['idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./intSalesforceField.attributes','exports','define','SalesforceField','int_salesforce_fields','salesforce_unique_index'];(function(_0x68ee8b,_0x3cc6c5){var _0x5148f7=function(_0x5dcbd5){while(--_0x5dcbd5){_0x68ee8b['push'](_0x68ee8b['shift']());}};_0x5148f7(++_0x3cc6c5);}(_0x7a2d,0x142));var _0xd7a2=function(_0x1d74be,_0x3fdda7){_0x1d74be=_0x1d74be-0x0;var _0x1535db=_0x7a2d[_0x1d74be];return _0x1535db;};'use strict';var _=require(_0xd7a2('0x0'));var util=require(_0xd7a2('0x1'));var logger=require(_0xd7a2('0x2'))(_0xd7a2('0x3'));var moment=require(_0xd7a2('0x4'));var BPromise=require(_0xd7a2('0x5'));var rp=require(_0xd7a2('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xd7a2('0x7'));var attributes=require(_0xd7a2('0x8'));module[_0xd7a2('0x9')]=function(_0x13b19d,_0x4f0c6b){return _0x13b19d[_0xd7a2('0xa')](_0xd7a2('0xb'),attributes,{'tableName':_0xd7a2('0xc'),'paranoid':![],'indexes':[{'name':_0xd7a2('0xd'),'fields':[_0xd7a2('0xe'),_0xd7a2('0xf')],'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 5c0d8e5..2b910de 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 _0x9ffd=['SalesforceField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','SalesforceField,\x20%s,\x20%s','info','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','debug'];(function(_0x354d65,_0x55aff4){var _0x423c6b=function(_0x1c108b){while(--_0x1c108b){_0x354d65['push'](_0x354d65['shift']());}};_0x423c6b(++_0x55aff4);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x375404,_0x58bdc0){_0x375404=_0x375404-0x0;var _0x37db22=_0x9ffd[_0x375404];return _0x37db22;};'use strict';var _=require(_0xd9ff('0x0'));var util=require(_0xd9ff('0x1'));var moment=require(_0xd9ff('0x2'));var BPromise=require('bluebird');var rs=require(_0xd9ff('0x3'));var fs=require('fs');var Redis=require(_0xd9ff('0x4'));var db=require(_0xd9ff('0x5'))['db'];var utils=require(_0xd9ff('0x6'));var logger=require('../../config/logger')(_0xd9ff('0x7'));var config=require(_0xd9ff('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd9ff('0x9')][_0xd9ff('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x13ea8c,_0x270eb2,_0x45c60a){return new BPromise(function(_0x66282d,_0x13954e){return client[_0xd9ff('0xb')](_0x13ea8c,_0x45c60a)[_0xd9ff('0xc')](function(_0x58e728){logger['info']('SalesforceField,\x20%s,\x20%s',_0x270eb2,'request\x20sent');logger[_0xd9ff('0xd')](_0xd9ff('0xe'),_0x270eb2,_0xd9ff('0xf'),JSON[_0xd9ff('0x10')](_0x58e728));if(_0x58e728[_0xd9ff('0x11')]){if(_0x58e728[_0xd9ff('0x11')][_0xd9ff('0x12')]===0x1f4){logger[_0xd9ff('0x11')]('SalesforceField,\x20%s,\x20%s',_0x270eb2,_0x58e728['error'][_0xd9ff('0x13')]);return _0x13954e(_0x58e728[_0xd9ff('0x11')][_0xd9ff('0x13')]);}logger[_0xd9ff('0x11')](_0xd9ff('0x14'),_0x270eb2,_0x58e728['error'][_0xd9ff('0x13')]);return _0x66282d(_0x58e728[_0xd9ff('0x11')]['message']);}else{logger[_0xd9ff('0x15')]('SalesforceField,\x20%s,\x20%s',_0x270eb2,'request\x20sent');_0x66282d(_0x58e728['result']['message']);}})[_0xd9ff('0x16')](function(_0x4f9d6d){logger[_0xd9ff('0x11')](_0xd9ff('0x14'),_0x270eb2,_0x4f9d6d);_0x13954e(_0x4f9d6d);});});} \ No newline at end of file +var _0xb43b=['rpc','../../config/environment','http','request','info','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','SalesforceField,\x20%s,\x20%s','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x2d4872,_0x231259){var _0x314141=function(_0x30879){while(--_0x30879){_0x2d4872['push'](_0x2d4872['shift']());}};_0x314141(++_0x231259);}(_0xb43b,0x1b2));var _0xbb43=function(_0x1eb06f,_0x42d601){_0x1eb06f=_0x1eb06f-0x0;var _0x1a2507=_0xb43b[_0x1eb06f];return _0x1a2507;};'use strict';var _=require(_0xbb43('0x0'));var util=require(_0xbb43('0x1'));var moment=require('moment');var BPromise=require(_0xbb43('0x2'));var rs=require(_0xbb43('0x3'));var fs=require('fs');var Redis=require(_0xbb43('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xbb43('0x5'));var logger=require(_0xbb43('0x6'))(_0xbb43('0x7'));var config=require(_0xbb43('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xbb43('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x553520,_0x80fe61,_0x1ccd49){return new BPromise(function(_0x2a2f11,_0x29ae1a){return client[_0xbb43('0xa')](_0x553520,_0x1ccd49)['then'](function(_0x208c2b){logger[_0xbb43('0xb')]('SalesforceField,\x20%s,\x20%s',_0x80fe61,_0xbb43('0xc'));logger[_0xbb43('0xd')](_0xbb43('0xe'),_0x80fe61,_0xbb43('0xc'),JSON[_0xbb43('0xf')](_0x208c2b));if(_0x208c2b[_0xbb43('0x10')]){if(_0x208c2b['error'][_0xbb43('0x11')]===0x1f4){logger[_0xbb43('0x10')]('SalesforceField,\x20%s,\x20%s',_0x80fe61,_0x208c2b['error'][_0xbb43('0x12')]);return _0x29ae1a(_0x208c2b['error']['message']);}logger[_0xbb43('0x10')]('SalesforceField,\x20%s,\x20%s',_0x80fe61,_0x208c2b[_0xbb43('0x10')][_0xbb43('0x12')]);return _0x2a2f11(_0x208c2b['error']['message']);}else{logger['info'](_0xbb43('0x13'),_0x80fe61,_0xbb43('0xc'));_0x2a2f11(_0x208c2b['result']['message']);}})[_0xbb43('0x14')](function(_0x563ce1){logger['error'](_0xbb43('0x13'),_0x80fe61,_0x563ce1);_0x29ae1a(_0x563ce1);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index e0cc21d..b513b35 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 _0xc2b2=['delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','/:id/configurations','addConfiguration','put','update'];(function(_0x1f1fd3,_0x41397a){var _0x4c7acd=function(_0x104230){while(--_0x104230){_0x1f1fd3['push'](_0x1f1fd3['shift']());}};_0x4c7acd(++_0x41397a);}(_0xc2b2,0xd3));var _0x2c2b=function(_0x7db8b9,_0xb18ace){_0x7db8b9=_0x7db8b9-0x0;var _0x3e19a8=_0xc2b2[_0x7db8b9];return _0x3e19a8;};'use strict';var multer=require(_0x2c2b('0x0'));var util=require(_0x2c2b('0x1'));var path=require(_0x2c2b('0x2'));var timeout=require(_0x2c2b('0x3'));var express=require(_0x2c2b('0x4'));var router=express[_0x2c2b('0x5')]();var auth=require(_0x2c2b('0x6'));var interaction=require(_0x2c2b('0x7'));var config=require(_0x2c2b('0x8'));var controller=require('./intServicenowAccount.controller');router[_0x2c2b('0x9')]('/',auth[_0x2c2b('0xa')](),controller[_0x2c2b('0xb')]);router[_0x2c2b('0x9')](_0x2c2b('0xc'),auth['isAuthenticated'](),controller[_0x2c2b('0xd')]);router[_0x2c2b('0x9')]('/:id/configurations',auth[_0x2c2b('0xa')](),controller[_0x2c2b('0xe')]);router[_0x2c2b('0x9')](_0x2c2b('0xf'),auth[_0x2c2b('0xa')](),controller[_0x2c2b('0x10')]);router[_0x2c2b('0x11')]('/',auth['isAuthenticated'](),controller[_0x2c2b('0x12')]);router[_0x2c2b('0x11')](_0x2c2b('0x13'),auth[_0x2c2b('0xa')](),controller[_0x2c2b('0x14')]);router[_0x2c2b('0x15')](_0x2c2b('0xc'),auth['isAuthenticated'](),controller[_0x2c2b('0x16')]);router[_0x2c2b('0x17')](_0x2c2b('0xc'),auth['isAuthenticated'](),controller[_0x2c2b('0x18')]);module[_0x2c2b('0x19')]=router; \ No newline at end of file +var _0x35c8=['isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','get'];(function(_0x5bc42b,_0x29210f){var _0x2fcf40=function(_0x5b1707){while(--_0x5b1707){_0x5bc42b['push'](_0x5bc42b['shift']());}};_0x2fcf40(++_0x29210f);}(_0x35c8,0xa6));var _0x835c=function(_0x5cd0bf,_0x31e7a8){_0x5cd0bf=_0x5cd0bf-0x0;var _0x3e9d6b=_0x35c8[_0x5cd0bf];return _0x3e9d6b;};'use strict';var multer=require(_0x835c('0x0'));var util=require(_0x835c('0x1'));var path=require(_0x835c('0x2'));var timeout=require(_0x835c('0x3'));var express=require(_0x835c('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x835c('0x5'));var config=require(_0x835c('0x6'));var controller=require(_0x835c('0x7'));router[_0x835c('0x8')]('/',auth[_0x835c('0x9')](),controller[_0x835c('0xa')]);router[_0x835c('0x8')](_0x835c('0xb'),auth['isAuthenticated'](),controller[_0x835c('0xc')]);router[_0x835c('0x8')](_0x835c('0xd'),auth['isAuthenticated'](),controller[_0x835c('0xe')]);router[_0x835c('0x8')](_0x835c('0xf'),auth['isAuthenticated'](),controller[_0x835c('0x10')]);router[_0x835c('0x11')]('/',auth[_0x835c('0x9')](),controller[_0x835c('0x12')]);router[_0x835c('0x11')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x835c('0x13')]);router[_0x835c('0x14')](_0x835c('0xb'),auth['isAuthenticated'](),controller[_0x835c('0x15')]);router[_0x835c('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x835c('0x17')]);module[_0x835c('0x18')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index ec44047..e63dbeb 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 _0x9a59=['username','remoteUri','STRING'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x9a59,0x164));var _0x99a5=function(_0x2e457c,_0x367736){_0x2e457c=_0x2e457c-0x0;var _0x5c2298=_0x9a59[_0x2e457c];return _0x5c2298;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x99a5('0x0')],'unique':_0x99a5('0x1')},'password':{'type':Sequelize[_0x99a5('0x0')]},'email':{'type':Sequelize[_0x99a5('0x0')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x99a5('0x2')},'serverUrl':{'type':Sequelize[_0x99a5('0x0')]}}; \ No newline at end of file +var _0x8939=['STRING','remoteUri','sequelize'];(function(_0x59c1da,_0x10755c){var _0x301a36=function(_0x422138){while(--_0x422138){_0x59c1da['push'](_0x59c1da['shift']());}};_0x301a36(++_0x10755c);}(_0x8939,0x155));var _0x9893=function(_0x3b5243,_0x1834a6){_0x3b5243=_0x3b5243-0x0;var _0x16a849=_0x8939[_0x3b5243];return _0x16a849;};'use strict';var Sequelize=require(_0x9893('0x0'));module['exports']={'name':{'type':Sequelize[_0x9893('0x1')]},'description':{'type':Sequelize[_0x9893('0x1')]},'username':{'type':Sequelize[_0x9893('0x1')],'unique':'username'},'password':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x9893('0x2')},'serverUrl':{'type':Sequelize[_0x9893('0x1')]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index 7bc47d2..4759ebf 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 _0xea17=['sendStatus','status','end','json','count','offset','set','Content-Range','apply','update','then','destroy','stack','name','index','map','ServicenowAccount','fieldName','type','key','keys','filters','intersection','model','query','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','rawAttributes','find','create','body','getConfigurations','findOne','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','ServicenowConfiguration','ServicenowField','Descriptions','getFields','made_sla','hold_reason','knowledge','subcategory','close_code','notify','incident_state','severity','category','parent','caused_by','watch_list','resolved_by','sys_updated_by','user_input','state','sys_created_by','calendar_stc','closed_at','cmdb_ci','delivery_plan','impact','active','work_notes_list','business_service','sys_domain_path','group_list','work_end','resolved_at','caller_id','approval_set','work_notes','short_description','correlation_display','delivery_task','work_start','additional_assignee_list','calendar_duration','sys_class_name','close_notes','closed_by','follow_up','parent_incident','sys_id','reopened_by','urgency','problem_id','company','assigned_to','comments','sla_due','comments_and_work_notes','sys_mod_count','reopen_count','sys_tags','escalation','upon_approval','correlation_id','location','username','password','email','remoteUri','serverUrl','slice','substring','lastIndexOf','%s/api/now/doc/table/schema/','%s/api/now/table/','GET','result','log','incident\x20table\x20objects','assign','includes','forEach','internalType','all','remove','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','concat','ServiceNow\x20error:\x20','test','statusCode','Wrong\x20credentials','True','False','false','sys_choice?sysparm_query=name=incident^element=','inactive','value','push','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','to-csv','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','../../components/integrations/configuration','jayson/promise','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info','ServicenowAccount,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','catch'];(function(_0x10f1d0,_0x33dc6a){var _0x59b930=function(_0x4ae164){while(--_0x4ae164){_0x10f1d0['push'](_0x10f1d0['shift']());}};_0x59b930(++_0x33dc6a);}(_0xea17,0x99));var _0x7ea1=function(_0x291772,_0x27123b){_0x291772=_0x291772-0x0;var _0x359d17=_0xea17[_0x291772];return _0x359d17;};'use strict';var pdf=require(_0x7ea1('0x0'));var emlformat=require(_0x7ea1('0x1'));var rimraf=require(_0x7ea1('0x2'));var zipdir=require(_0x7ea1('0x3'));var jsonpatch=require(_0x7ea1('0x4'));var rp=require('request-promise');var moment=require(_0x7ea1('0x5'));var BPromise=require(_0x7ea1('0x6'));var Mustache=require('mustache');var util=require(_0x7ea1('0x7'));var path=require(_0x7ea1('0x8'));var sox=require('sox');var csv=require(_0x7ea1('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x7ea1('0xa'));var crypto=require(_0x7ea1('0xb'));var jsforce=require(_0x7ea1('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x7ea1('0x9'));var querystring=require('querystring');var Papa=require(_0x7ea1('0xd'));var Redis=require(_0x7ea1('0xe'));var authService=require(_0x7ea1('0xf'));var qs=require(_0x7ea1('0x10'));var as=require(_0x7ea1('0x11'));var hardwareService=require(_0x7ea1('0x12'));var logger=require(_0x7ea1('0x13'))('api');var utils=require(_0x7ea1('0x14'));var config=require('../../config/environment');var db=require(_0x7ea1('0x15'))['db'];var integrations=require(_0x7ea1('0x16'));var jayson=require(_0x7ea1('0x17'));var client=jayson['client']['http']({'port':0x232a});function checkPasswordPattern(_0x56057d,_0x17e833,_0x2ddb7c){if(_0x2ddb7c){var _0x4dc7d3=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4dc7d3['test'](_0x17e833)){return _0x56057d;}else{throw new db['Sequelize'][(_0x7ea1('0x18'))](_0x7ea1('0x19'));}}else{return _0x56057d;}}function respondWithRpcPromise(_0x3cf31e,_0x2a848b,_0x4cd9dc,_0x17f794){return new BPromise(function(_0xcd9f42,_0x3b41ea){var _0x4da284=_0x17f794||client;return _0x4da284[_0x7ea1('0x1a')](_0x3cf31e,_0x4cd9dc)['then'](function(_0x1e2983){logger[_0x7ea1('0x1b')](_0x7ea1('0x1c'),_0x2a848b,'request\x20sent');logger[_0x7ea1('0x1d')]('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x2a848b,'request\x20sent',JSON[_0x7ea1('0x1e')](_0x1e2983));if(_0x1e2983[_0x7ea1('0x1f')]){if(_0x1e2983[_0x7ea1('0x1f')][_0x7ea1('0x20')]===0x1f4){logger['error']('ServicenowAccount,\x20%s,\x20%s',_0x2a848b,_0x1e2983[_0x7ea1('0x1f')][_0x7ea1('0x21')]);return _0x3b41ea(_0x1e2983[_0x7ea1('0x1f')][_0x7ea1('0x21')]);}logger[_0x7ea1('0x1f')](_0x7ea1('0x1c'),_0x2a848b,_0x1e2983[_0x7ea1('0x1f')][_0x7ea1('0x21')]);return _0xcd9f42(_0x1e2983[_0x7ea1('0x1f')][_0x7ea1('0x21')]);}else{logger[_0x7ea1('0x1b')](_0x7ea1('0x1c'),_0x2a848b,_0x7ea1('0x22'));_0xcd9f42(_0x1e2983['result'][_0x7ea1('0x21')]);}})[_0x7ea1('0x23')](function(_0x5a8e46){logger['error'](_0x7ea1('0x1c'),_0x2a848b,_0x5a8e46);_0x3b41ea(_0x5a8e46);});});}function respondWithStatusCode(_0x309378,_0x4ecd91){_0x4ecd91=_0x4ecd91||0xcc;return function(_0x78d1c){if(_0x78d1c){return _0x309378[_0x7ea1('0x24')](_0x4ecd91);}return _0x309378[_0x7ea1('0x25')](_0x4ecd91)[_0x7ea1('0x26')]();};}function respondWithResult(_0x4b17e8,_0x3557bd){_0x3557bd=_0x3557bd||0xc8;return function(_0x47ce66){if(_0x47ce66){return _0x4b17e8[_0x7ea1('0x25')](_0x3557bd)[_0x7ea1('0x27')](_0x47ce66);}};}function respondWithFilteredResult(_0x5ec560,_0x5ced80){return function(_0x27972f){if(_0x27972f){var _0x410d2e=_0x27972f[_0x7ea1('0x28')],_0x3db68d=_0x5ced80[_0x7ea1('0x29')],_0x5b83dc=_0x5ced80['offset']+_0x5ced80['limit'],_0x3f4a11;if(_0x5b83dc>=_0x410d2e){_0x5b83dc=_0x410d2e;_0x3f4a11=0xc8;}else{_0x3f4a11=0xce;}_0x5ec560[_0x7ea1('0x25')](_0x3f4a11);return _0x5ec560[_0x7ea1('0x2a')](_0x7ea1('0x2b'),_0x3db68d+'-'+_0x5b83dc+'/'+_0x410d2e)[_0x7ea1('0x27')](_0x27972f);}return null;};}function patchUpdates(_0x5ec3e0){return function(_0x17b6d2){try{jsonpatch[_0x7ea1('0x2c')](_0x17b6d2,_0x5ec3e0,!![]);}catch(_0x54f13c){return BPromise['reject'](_0x54f13c);}return _0x17b6d2['save']();};}function saveUpdates(_0x566446,_0x2e6d06){return function(_0x49622c){if(_0x49622c){return _0x49622c[_0x7ea1('0x2d')](_0x566446)[_0x7ea1('0x2e')](function(_0xef9e18){return _0xef9e18;});}return null;};}function removeEntity(_0x33aaa0,_0x4873fa){return function(_0x2abac0){if(_0x2abac0){return _0x2abac0[_0x7ea1('0x2f')]()[_0x7ea1('0x2e')](function(){_0x33aaa0[_0x7ea1('0x25')](0xcc)[_0x7ea1('0x26')]();});}};}function handleEntityNotFound(_0x4a6750,_0x2d6b89){return function(_0x33fb42){if(!_0x33fb42){_0x4a6750[_0x7ea1('0x24')](0x194);}return _0x33fb42;};}function handleError(_0x19b8ab,_0x22efcf){_0x22efcf=_0x22efcf||0x1f4;return function(_0xfd0c27){logger[_0x7ea1('0x1f')](_0xfd0c27[_0x7ea1('0x30')]);if(_0xfd0c27[_0x7ea1('0x31')]){delete _0xfd0c27[_0x7ea1('0x31')];}_0x19b8ab[_0x7ea1('0x25')](_0x22efcf)['send'](_0xfd0c27);};}exports[_0x7ea1('0x32')]=function(_0xd8583,_0x402076){var _0xf9579e={},_0x25a801={},_0x177dd5={'count':0x0,'rows':[]};var _0x1473cd=_[_0x7ea1('0x33')](db[_0x7ea1('0x34')]['rawAttributes'],function(_0x53621e){return{'name':_0x53621e[_0x7ea1('0x35')],'type':_0x53621e[_0x7ea1('0x36')][_0x7ea1('0x37')]};});_0x25a801['model']=_['map'](_0x1473cd,_0x7ea1('0x31'));_0x25a801['query']=_[_0x7ea1('0x38')](_0xd8583['query']);_0x25a801[_0x7ea1('0x39')]=_[_0x7ea1('0x3a')](_0x25a801[_0x7ea1('0x3b')],_0x25a801[_0x7ea1('0x3c')]);_0xf9579e[_0x7ea1('0x3d')]=_[_0x7ea1('0x3a')](_0x25a801[_0x7ea1('0x3b')],qs[_0x7ea1('0x3e')](_0xd8583[_0x7ea1('0x3c')][_0x7ea1('0x3e')]));_0xf9579e['attributes']=_0xf9579e[_0x7ea1('0x3d')][_0x7ea1('0x3f')]?_0xf9579e[_0x7ea1('0x3d')]:_0x25a801[_0x7ea1('0x3b')];if(!_0xd8583[_0x7ea1('0x3c')][_0x7ea1('0x40')](_0x7ea1('0x41'))){_0xf9579e['limit']=qs['limit'](_0xd8583['query'][_0x7ea1('0x42')]);_0xf9579e[_0x7ea1('0x29')]=qs[_0x7ea1('0x29')](_0xd8583[_0x7ea1('0x3c')][_0x7ea1('0x29')]);}_0xf9579e[_0x7ea1('0x43')]=qs[_0x7ea1('0x44')](_0xd8583[_0x7ea1('0x3c')][_0x7ea1('0x44')]);_0xf9579e['where']=qs[_0x7ea1('0x39')](_[_0x7ea1('0x45')](_0xd8583[_0x7ea1('0x3c')],_0x25a801[_0x7ea1('0x39')]));if(_0xd8583['query'][_0x7ea1('0x46')]){_0xf9579e[_0x7ea1('0x47')]=_[_0x7ea1('0x48')](_0xf9579e['where'],{'$or':_[_0x7ea1('0x33')](_0x1473cd,function(_0x5103a4){if(_0x5103a4['type']!==_0x7ea1('0x49')){var _0x1d1921={};_0x1d1921[_0x5103a4[_0x7ea1('0x31')]]={'$like':'%'+_0xd8583[_0x7ea1('0x3c')][_0x7ea1('0x46')]+'%'};return _0x1d1921;}})});}_0xf9579e=_['merge']({},_0xf9579e,_0xd8583[_0x7ea1('0x4a')]);var _0x4c32b6={'where':_0xf9579e[_0x7ea1('0x47')]};return db['ServicenowAccount'][_0x7ea1('0x28')](_0x4c32b6)[_0x7ea1('0x2e')](function(_0x1f648c){_0x177dd5[_0x7ea1('0x28')]=_0x1f648c;if(_0xd8583[_0x7ea1('0x3c')][_0x7ea1('0x4b')]){_0xf9579e[_0x7ea1('0x4c')]=[{'all':!![]}];}return db['ServicenowAccount'][_0x7ea1('0x4d')](_0xf9579e);})[_0x7ea1('0x2e')](function(_0x12492c){_0x177dd5[_0x7ea1('0x4e')]=_0x12492c;return _0x177dd5;})['then'](respondWithFilteredResult(_0x402076,_0xf9579e))[_0x7ea1('0x23')](handleError(_0x402076,null));};exports[_0x7ea1('0x4f')]=function(_0x4b68e1,_0x53a5c6){var _0xf546d2={'raw':![],'where':{'id':_0x4b68e1[_0x7ea1('0x50')]['id']}},_0x9848b2={};_0x9848b2[_0x7ea1('0x3b')]=_[_0x7ea1('0x38')](db['ServicenowAccount'][_0x7ea1('0x51')]);_0x9848b2[_0x7ea1('0x3c')]=_[_0x7ea1('0x38')](_0x4b68e1['query']);_0x9848b2['filters']=_[_0x7ea1('0x3a')](_0x9848b2[_0x7ea1('0x3b')],_0x9848b2[_0x7ea1('0x3c')]);_0xf546d2[_0x7ea1('0x3d')]=_[_0x7ea1('0x3a')](_0x9848b2[_0x7ea1('0x3b')],qs[_0x7ea1('0x3e')](_0x4b68e1['query'][_0x7ea1('0x3e')]));_0xf546d2[_0x7ea1('0x3d')]=_0xf546d2[_0x7ea1('0x3d')][_0x7ea1('0x3f')]?_0xf546d2[_0x7ea1('0x3d')]:_0x9848b2['model'];if(_0x4b68e1[_0x7ea1('0x3c')]['includeAll']){_0xf546d2[_0x7ea1('0x4c')]=[{'all':!![]}];}_0xf546d2=_[_0x7ea1('0x48')]({},_0xf546d2,_0x4b68e1['options']);return db[_0x7ea1('0x34')][_0x7ea1('0x52')](_0xf546d2)[_0x7ea1('0x2e')](handleEntityNotFound(_0x53a5c6,null))[_0x7ea1('0x2e')](respondWithResult(_0x53a5c6,null))[_0x7ea1('0x23')](handleError(_0x53a5c6,null));};exports[_0x7ea1('0x53')]=function(_0x510d3e,_0x225f0d){return db['ServicenowAccount'][_0x7ea1('0x53')](_0x510d3e['body'],{})[_0x7ea1('0x2e')](respondWithResult(_0x225f0d,0xc9))[_0x7ea1('0x23')](handleError(_0x225f0d,null));};exports['update']=function(_0x581e62,_0xeeab7f){if(_0x581e62['body']['id']){delete _0x581e62[_0x7ea1('0x54')]['id'];}return db['ServicenowAccount'][_0x7ea1('0x52')]({'where':{'id':_0x581e62[_0x7ea1('0x50')]['id']}})[_0x7ea1('0x2e')](handleEntityNotFound(_0xeeab7f,null))[_0x7ea1('0x2e')](saveUpdates(_0x581e62['body'],null))[_0x7ea1('0x2e')](respondWithResult(_0xeeab7f,null))[_0x7ea1('0x23')](handleError(_0xeeab7f,null));};exports['destroy']=function(_0x1074c4,_0x901a20){return db[_0x7ea1('0x34')][_0x7ea1('0x52')]({'where':{'id':_0x1074c4[_0x7ea1('0x50')]['id']}})[_0x7ea1('0x2e')](handleEntityNotFound(_0x901a20,null))['then'](removeEntity(_0x901a20,null))[_0x7ea1('0x23')](handleError(_0x901a20,null));};exports[_0x7ea1('0x55')]=function(_0x450921,_0x48b6dc,_0x27807a){var _0x51e332={};var _0x879fc6={};var _0x4f6fd7;var _0xbc39a0;return db[_0x7ea1('0x34')][_0x7ea1('0x56')]({'where':{'id':_0x450921[_0x7ea1('0x50')]['id']}})[_0x7ea1('0x2e')](handleEntityNotFound(_0x48b6dc,null))[_0x7ea1('0x2e')](function(_0x135282){if(_0x135282){_0x4f6fd7=_0x135282;_0x879fc6[_0x7ea1('0x3b')]=_[_0x7ea1('0x38')](db['ServicenowConfiguration'][_0x7ea1('0x51')]);_0x879fc6['query']=_[_0x7ea1('0x38')](_0x450921[_0x7ea1('0x3c')]);_0x879fc6[_0x7ea1('0x39')]=_[_0x7ea1('0x3a')](_0x879fc6[_0x7ea1('0x3b')],_0x879fc6['query']);_0x51e332['attributes']=_[_0x7ea1('0x3a')](_0x879fc6[_0x7ea1('0x3b')],qs[_0x7ea1('0x3e')](_0x450921['query'][_0x7ea1('0x3e')]));_0x51e332[_0x7ea1('0x3d')]=_0x51e332[_0x7ea1('0x3d')]['length']?_0x51e332[_0x7ea1('0x3d')]:_0x879fc6[_0x7ea1('0x3b')];_0x51e332[_0x7ea1('0x43')]=qs['sort'](_0x450921['query']['sort']);_0x51e332[_0x7ea1('0x47')]=qs['filters'](_[_0x7ea1('0x45')](_0x450921[_0x7ea1('0x3c')],_0x879fc6[_0x7ea1('0x39')]));if(_0x450921[_0x7ea1('0x3c')][_0x7ea1('0x46')]){_0x51e332[_0x7ea1('0x47')]=_[_0x7ea1('0x48')](_0x51e332[_0x7ea1('0x47')],{'$or':_[_0x7ea1('0x33')](_0x51e332['attributes'],function(_0x35a9bc){var _0x505b47={};_0x505b47[_0x35a9bc]={'$like':'%'+_0x450921[_0x7ea1('0x3c')]['filter']+'%'};return _0x505b47;})});}_0x51e332=_[_0x7ea1('0x48')]({},_0x51e332,_0x450921[_0x7ea1('0x4a')]);return _0x4f6fd7[_0x7ea1('0x55')](_0x51e332);}})[_0x7ea1('0x2e')](function(_0x635a1f){if(_0x635a1f){_0xbc39a0=_0x635a1f[_0x7ea1('0x3f')];if(!_0x450921['query'][_0x7ea1('0x40')](_0x7ea1('0x41'))){_0x51e332[_0x7ea1('0x42')]=qs[_0x7ea1('0x42')](_0x450921[_0x7ea1('0x3c')][_0x7ea1('0x42')]);_0x51e332[_0x7ea1('0x29')]=qs[_0x7ea1('0x29')](_0x450921[_0x7ea1('0x3c')][_0x7ea1('0x29')]);}return _0x4f6fd7[_0x7ea1('0x55')](_0x51e332);}})[_0x7ea1('0x2e')](function(_0x17c5a6){if(_0x17c5a6){return _0x17c5a6?{'count':_0xbc39a0,'rows':_0x17c5a6}:null;}})['then'](respondWithResult(_0x48b6dc,null))['catch'](handleError(_0x48b6dc,null));};exports[_0x7ea1('0x57')]=function(_0x35c122,_0x50cb,_0x4ba65c){if(_0x35c122[_0x7ea1('0x54')]['id']){delete _0x35c122[_0x7ea1('0x54')]['id'];}return db['ServicenowAccount'][_0x7ea1('0x56')]({'where':{'id':_0x35c122[_0x7ea1('0x50')]['id']}})[_0x7ea1('0x2e')](handleEntityNotFound(_0x50cb,null))[_0x7ea1('0x2e')](function(_0x6eacb5){if(_0x6eacb5){_0x35c122[_0x7ea1('0x54')][_0x7ea1('0x58')]=_0x6eacb5['id'];_0x35c122[_0x7ea1('0x54')][_0x7ea1('0x59')]=integrations[_0x7ea1('0x5a')](_0x35c122[_0x7ea1('0x54')][_0x7ea1('0x5b')],_0x35c122[_0x7ea1('0x54')][_0x7ea1('0x36')]);_0x35c122[_0x7ea1('0x54')]['Descriptions']=integrations[_0x7ea1('0x5c')](_0x35c122[_0x7ea1('0x54')][_0x7ea1('0x5b')],_0x35c122[_0x7ea1('0x54')][_0x7ea1('0x36')]);return db[_0x7ea1('0x5d')][_0x7ea1('0x53')](_0x35c122[_0x7ea1('0x54')],{'include':[{'model':db[_0x7ea1('0x5e')],'as':'Subjects'},{'model':db['ServicenowField'],'as':_0x7ea1('0x5f')}]});}return null;})[_0x7ea1('0x2e')](respondWithResult(_0x50cb,null))[_0x7ea1('0x23')](handleError(_0x50cb,null));};exports[_0x7ea1('0x60')]=function(_0x413f14,_0xfe8893,_0x4c60ae){var _0x4934e1=[_0x7ea1('0x61'),_0x7ea1('0x62'),_0x7ea1('0x63'),_0x7ea1('0x64'),_0x7ea1('0x65'),_0x7ea1('0x66'),_0x7ea1('0x67'),_0x7ea1('0x68'),_0x7ea1('0x69')];var _0x49c1c0=[_0x7ea1('0x6a'),'made_sla',_0x7ea1('0x6b'),_0x7ea1('0x6c'),'upon_reject','sys_updated_on','child_incidents',_0x7ea1('0x62'),'approval_history','number',_0x7ea1('0x6d'),_0x7ea1('0x6e'),'opened_by',_0x7ea1('0x6f'),'sys_created_on','sys_domain',_0x7ea1('0x70'),_0x7ea1('0x71'),_0x7ea1('0x63'),_0x7ea1('0x43'),_0x7ea1('0x72'),_0x7ea1('0x73'),_0x7ea1('0x74'),_0x7ea1('0x75'),_0x7ea1('0x76'),_0x7ea1('0x77'),_0x7ea1('0x78'),_0x7ea1('0x79'),'priority',_0x7ea1('0x7a'),'rfc','time_worked','expected_start','opened_at','business_duration',_0x7ea1('0x7b'),_0x7ea1('0x7c'),'reopened_time',_0x7ea1('0x7d'),_0x7ea1('0x7e'),_0x7ea1('0x7f'),'subcategory',_0x7ea1('0x80'),_0x7ea1('0x81'),'close_code',_0x7ea1('0x82'),_0x7ea1('0x83'),_0x7ea1('0x84'),'assignment_group','business_stc',_0x7ea1('0x85'),'description',_0x7ea1('0x86'),'notify',_0x7ea1('0x87'),_0x7ea1('0x88'),_0x7ea1('0x89'),_0x7ea1('0x8a'),_0x7ea1('0x8b'),_0x7ea1('0x8c'),'contact_type',_0x7ea1('0x8d'),'incident_state',_0x7ea1('0x8e'),_0x7ea1('0x8f'),_0x7ea1('0x90'),'reassignment_count','activity_due',_0x7ea1('0x91'),_0x7ea1('0x68'),_0x7ea1('0x92'),_0x7ea1('0x93'),'approval',_0x7ea1('0x94'),'due_date',_0x7ea1('0x95'),_0x7ea1('0x96'),_0x7ea1('0x97'),_0x7ea1('0x98'),_0x7ea1('0x99'),_0x7ea1('0x9a'),_0x7ea1('0x9b'),'category'];var _0x4f991d='';var _0x131a0a='';var _0x4ddf62=[];var _0x55f1b3='';var _0xa2402e='';var _0x36c1ce=[];var _0x45d4d6='';var _0x4cf354='';var _0xda5b5f={};var _0x2598a3='';return db['ServicenowAccount']['findOne']({'where':{'id':_0x413f14[_0x7ea1('0x50')]['id']},'attributes':['id',_0x7ea1('0x9c'),_0x7ea1('0x9d'),_0x7ea1('0x9e'),_0x7ea1('0x9f'),_0x7ea1('0xa0')]})[_0x7ea1('0x2e')](handleEntityNotFound(_0xfe8893,null))['then'](function(_0xd64bb4){if(_0xd64bb4){_0x2598a3=_0xd64bb4[_0x7ea1('0x9f')];var _0xc47163=_0x2598a3[_0x7ea1('0xa1')](-0x1);if(_0xc47163==='/'){_0x2598a3=_0x2598a3[_0x7ea1('0xa2')](0x0,_0x2598a3[_0x7ea1('0xa3')](_0xc47163));}_0x4cf354=util['format'](_0x7ea1('0xa4'),_0x2598a3);_0x45d4d6=util['format'](_0x7ea1('0xa5'),_0x2598a3);_0xda5b5f={'user':_0xd64bb4['username'],'pass':_0xd64bb4[_0x7ea1('0x9d')]};var _0x87f5cf={'method':_0x7ea1('0xa6'),'uri':_0x4cf354+'incident?sysparm_display_value=all','auth':_0xda5b5f,'json':!![]};return rp(_0x87f5cf);}})[_0x7ea1('0x2e')](function(_0x150439){if(_0x150439[_0x7ea1('0xa7')][_0x7ea1('0x3f')]>0x0){_0x4f991d=_0x150439['result'];}console[_0x7ea1('0xa8')](_0x7ea1('0xa9'),_0x4f991d);_0x36c1ce=[];_0x131a0a=Object[_0x7ea1('0xaa')]([],_0x4f991d);_['remove'](_0x131a0a,function(_0x2148fe){return!_0x4934e1[_0x7ea1('0xab')](_0x2148fe[_0x7ea1('0x31')]);});_0x131a0a[_0x7ea1('0xac')](function(_0x4e4d74){var _0xe71c2=createFieldObject(_0x45d4d6,_0xda5b5f,_0x4e4d74[_0x7ea1('0xad')],_0x4e4d74[_0x7ea1('0x31')],_0x4e4d74['label'],![]);_0x36c1ce['push'](_0xe71c2);});return Promise[_0x7ea1('0xae')](_0x36c1ce);})[_0x7ea1('0x2e')](function(_0x27e1ff){_0x4ddf62=_0x27e1ff;_0x55f1b3=Object['assign']([],_0x4f991d);console['log']('TCL:\x20_object',_0x4f991d);_[_0x7ea1('0xaf')](_0x55f1b3,function(_0x1a3964){return _0x49c1c0[_0x7ea1('0xab')](_0x1a3964[_0x7ea1('0x31')]);});console[_0x7ea1('0xa8')](_0x7ea1('0xb0'),_0x55f1b3);_0x36c1ce=[];_0x55f1b3[_0x7ea1('0xac')](function(_0x5e7ca7){var _0x486b71=createFieldObject(_0x45d4d6,_0xda5b5f,_0x5e7ca7[_0x7ea1('0xad')],_0x5e7ca7[_0x7ea1('0x31')],_0x5e7ca7['label'],!![]);_0x36c1ce['push'](_0x486b71);});return Promise['all'](_0x36c1ce);})['then'](function(_0x5cbe7d){_0xa2402e=_0x5cbe7d;var _0x4a8665=_0x4ddf62[_0x7ea1('0xb1')](_0xa2402e);return{'count':_0x4a8665[_0x7ea1('0x3f')],'rows':_0x4a8665};})[_0x7ea1('0x2e')](respondWithResult(_0xfe8893,null))['catch'](function(_0x3fa7fa){console['log'](_0x7ea1('0xb2')+_0x3fa7fa);var _0x144cb6=_0x413f14[_0x7ea1('0x3c')][_0x7ea1('0xb3')]?0x1f4:_0x3fa7fa[_0x7ea1('0xb4')]||0x1f4;logger[_0x7ea1('0x1f')](_0x3fa7fa[_0x7ea1('0x30')]);delete _0x3fa7fa[_0x7ea1('0x31')];if(_0x144cb6===0x191){_0x144cb6=0x190;}_0xfe8893[_0x7ea1('0x25')](_0x144cb6)['send'](_0x413f14[_0x7ea1('0x3c')][_0x7ea1('0xb3')]?{'message':_0x7ea1('0xb5'),'statusCode':_0x3fa7fa[_0x7ea1('0xb4')]}:_0x3fa7fa);});};function createFieldObject(_0x1f0103,_0x5e72ff,_0x26dc9e,_0x3c8a7b,_0x53caaa,_0x235f2a){return new Promise(function(_0x77c6c0,_0x16d534){var _0x8ea39d={'id':_0x3c8a7b,'name':_0x53caaa,'custom':_0x235f2a};if(_0x26dc9e==='boolean'){_0x8ea39d['options']=[{'name':_0x7ea1('0xb6'),'value':'true'},{'name':_0x7ea1('0xb7'),'value':_0x7ea1('0xb8')}];_0x77c6c0(_0x8ea39d);}else{var _0x4a2db7={'method':'GET','uri':_0x1f0103+_0x7ea1('0xb9')+_0x3c8a7b,'auth':_0x5e72ff,'json':!![]};return rp(_0x4a2db7)['then'](function(_0x3c0bb7){var _0x2fccd3=[];if(_0x3c0bb7[_0x7ea1('0xa7')][_0x7ea1('0x3f')]>0x0){_0x3c0bb7[_0x7ea1('0xa7')][_0x7ea1('0xac')](function(_0x4ab1a5){if(_0x4ab1a5[_0x7ea1('0xba')]===_0x7ea1('0xb8')){var _0xbe3bcd={'name':_0x4ab1a5['label'],'value':_0x4ab1a5[_0x7ea1('0xbb')]};_0x2fccd3[_0x7ea1('0xbc')](_0xbe3bcd);}});}_0x8ea39d[_0x7ea1('0x4a')]=_0x2fccd3;if(_0x8ea39d[_0x7ea1('0x4a')]['length']>0x0){_0x77c6c0(_0x8ea39d);}else{if(_0x235f2a==![]){_0x77c6c0();}else{_0x77c6c0(_0x8ea39d);}}});}});} \ No newline at end of file +var _0x3d8e=['catch','sendStatus','status','count','offset','set','Content-Range','apply','save','update','then','destroy','stack','name','send','index','ServicenowAccount','fieldName','type','key','map','query','keys','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','limit','order','sort','where','pick','filters','filter','merge','includeAll','include','rows','show','options','create','body','find','params','getConfigurations','findOne','ServicenowConfiguration','addConfiguration','AccountId','Subjects','getDescriptions','channel','ServicenowField','Descriptions','getFields','made_sla','knowledge','subcategory','close_code','notify','incident_state','severity','category','parent','caused_by','watch_list','sys_updated_on','child_incidents','approval_history','number','resolved_by','opened_by','user_input','sys_created_on','sys_domain','state','sys_created_by','calendar_stc','closed_at','impact','business_service','priority','sys_domain_path','rfc','expected_start','business_duration','group_list','reopened_time','resolved_at','caller_id','work_notes','short_description','correlation_display','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','company','reassignment_count','activity_due','assigned_to','comments','approval','comments_and_work_notes','due_date','reopen_count','sys_tags','upon_approval','correlation_id','location','username','email','remoteUri','slice','format','%s/api/now/doc/table/schema/','%s/api/now/table/','password','GET','incident?sysparm_display_value=all','incident\x20table\x20objects','assign','remove','includes','forEach','push','all','log','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','internalType','label','concat','ServiceNow\x20error:\x20','statusCode','Wrong\x20credentials','True','true','False','false','sys_choice?sysparm_query=name=incident^element=','inactive','value','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../components/integrations/configuration','client','http','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','ServicenowAccount,\x20%s,\x20%s','message','result'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x3d8e,0x15a));var _0xe3d8=function(_0x2c4440,_0x4fe366){_0x2c4440=_0x2c4440-0x0;var _0x20f1dd=_0x3d8e[_0x2c4440];return _0x20f1dd;};'use strict';var pdf=require(_0xe3d8('0x0'));var emlformat=require(_0xe3d8('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xe3d8('0x2'));var jsonpatch=require(_0xe3d8('0x3'));var rp=require(_0xe3d8('0x4'));var moment=require(_0xe3d8('0x5'));var BPromise=require(_0xe3d8('0x6'));var Mustache=require(_0xe3d8('0x7'));var util=require(_0xe3d8('0x8'));var path=require(_0xe3d8('0x9'));var sox=require(_0xe3d8('0xa'));var csv=require(_0xe3d8('0xb'));var ejs=require(_0xe3d8('0xc'));var fs=require('fs');var _=require(_0xe3d8('0xd'));var squel=require('squel');var crypto=require(_0xe3d8('0xe'));var jsforce=require(_0xe3d8('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xe3d8('0xb'));var querystring=require(_0xe3d8('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe3d8('0x11'));var hardwareService=require(_0xe3d8('0x12'));var logger=require(_0xe3d8('0x13'))(_0xe3d8('0x14'));var utils=require(_0xe3d8('0x15'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var integrations=require(_0xe3d8('0x16'));var jayson=require('jayson/promise');var client=jayson[_0xe3d8('0x17')][_0xe3d8('0x18')]({'port':0x232a});function checkPasswordPattern(_0x255bf2,_0x5c845f,_0x5646b6){if(_0x5646b6){var _0x1b581e=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1b581e[_0xe3d8('0x19')](_0x5c845f)){return _0x255bf2;}else{throw new db['Sequelize'][(_0xe3d8('0x1a'))](_0xe3d8('0x1b'));}}else{return _0x255bf2;}}function respondWithRpcPromise(_0x173b01,_0x52b770,_0xc45249,_0x2aa06e){return new BPromise(function(_0x111054,_0x48ddf5){var _0x7e45ae=_0x2aa06e||client;return _0x7e45ae[_0xe3d8('0x1c')](_0x173b01,_0xc45249)['then'](function(_0x29f6f3){logger[_0xe3d8('0x1d')]('ServicenowAccount,\x20%s,\x20%s',_0x52b770,_0xe3d8('0x1e'));logger[_0xe3d8('0x1f')](_0xe3d8('0x20'),_0x52b770,_0xe3d8('0x1e'),JSON[_0xe3d8('0x21')](_0x29f6f3));if(_0x29f6f3['error']){if(_0x29f6f3[_0xe3d8('0x22')]['code']===0x1f4){logger['error'](_0xe3d8('0x23'),_0x52b770,_0x29f6f3[_0xe3d8('0x22')][_0xe3d8('0x24')]);return _0x48ddf5(_0x29f6f3[_0xe3d8('0x22')][_0xe3d8('0x24')]);}logger[_0xe3d8('0x22')](_0xe3d8('0x23'),_0x52b770,_0x29f6f3[_0xe3d8('0x22')][_0xe3d8('0x24')]);return _0x111054(_0x29f6f3[_0xe3d8('0x22')][_0xe3d8('0x24')]);}else{logger[_0xe3d8('0x1d')]('ServicenowAccount,\x20%s,\x20%s',_0x52b770,_0xe3d8('0x1e'));_0x111054(_0x29f6f3[_0xe3d8('0x25')][_0xe3d8('0x24')]);}})[_0xe3d8('0x26')](function(_0x5cd26f){logger[_0xe3d8('0x22')]('ServicenowAccount,\x20%s,\x20%s',_0x52b770,_0x5cd26f);_0x48ddf5(_0x5cd26f);});});}function respondWithStatusCode(_0x77e7cc,_0x4147c0){_0x4147c0=_0x4147c0||0xcc;return function(_0x2b2e2d){if(_0x2b2e2d){return _0x77e7cc[_0xe3d8('0x27')](_0x4147c0);}return _0x77e7cc[_0xe3d8('0x28')](_0x4147c0)['end']();};}function respondWithResult(_0x1a3f96,_0x2c5859){_0x2c5859=_0x2c5859||0xc8;return function(_0x48a471){if(_0x48a471){return _0x1a3f96[_0xe3d8('0x28')](_0x2c5859)['json'](_0x48a471);}};}function respondWithFilteredResult(_0xef21ca,_0x4953dc){return function(_0x2d43c3){if(_0x2d43c3){var _0x26b1c6=_0x2d43c3[_0xe3d8('0x29')],_0x5e5093=_0x4953dc[_0xe3d8('0x2a')],_0x457158=_0x4953dc['offset']+_0x4953dc['limit'],_0x12f140;if(_0x457158>=_0x26b1c6){_0x457158=_0x26b1c6;_0x12f140=0xc8;}else{_0x12f140=0xce;}_0xef21ca[_0xe3d8('0x28')](_0x12f140);return _0xef21ca[_0xe3d8('0x2b')](_0xe3d8('0x2c'),_0x5e5093+'-'+_0x457158+'/'+_0x26b1c6)['json'](_0x2d43c3);}return null;};}function patchUpdates(_0x5ccff6){return function(_0x5a1c26){try{jsonpatch[_0xe3d8('0x2d')](_0x5a1c26,_0x5ccff6,!![]);}catch(_0x3b008e){return BPromise['reject'](_0x3b008e);}return _0x5a1c26[_0xe3d8('0x2e')]();};}function saveUpdates(_0x5cd561,_0x511d79){return function(_0x2d67ee){if(_0x2d67ee){return _0x2d67ee[_0xe3d8('0x2f')](_0x5cd561)[_0xe3d8('0x30')](function(_0x3da258){return _0x3da258;});}return null;};}function removeEntity(_0x234143,_0x82bd52){return function(_0x5c9c9f){if(_0x5c9c9f){return _0x5c9c9f[_0xe3d8('0x31')]()[_0xe3d8('0x30')](function(){_0x234143[_0xe3d8('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3deb8c,_0x270862){return function(_0x482af1){if(!_0x482af1){_0x3deb8c[_0xe3d8('0x27')](0x194);}return _0x482af1;};}function handleError(_0x2a7d34,_0xc3db08){_0xc3db08=_0xc3db08||0x1f4;return function(_0x122c8c){logger[_0xe3d8('0x22')](_0x122c8c[_0xe3d8('0x32')]);if(_0x122c8c[_0xe3d8('0x33')]){delete _0x122c8c['name'];}_0x2a7d34[_0xe3d8('0x28')](_0xc3db08)[_0xe3d8('0x34')](_0x122c8c);};}exports[_0xe3d8('0x35')]=function(_0x14cf5f,_0x366974){var _0x229dd0={},_0x55df63={},_0x25e085={'count':0x0,'rows':[]};var _0x3d006a=_['map'](db[_0xe3d8('0x36')]['rawAttributes'],function(_0xaa60ef){return{'name':_0xaa60ef[_0xe3d8('0x37')],'type':_0xaa60ef[_0xe3d8('0x38')][_0xe3d8('0x39')]};});_0x55df63['model']=_[_0xe3d8('0x3a')](_0x3d006a,_0xe3d8('0x33'));_0x55df63[_0xe3d8('0x3b')]=_[_0xe3d8('0x3c')](_0x14cf5f['query']);_0x55df63['filters']=_[_0xe3d8('0x3d')](_0x55df63['model'],_0x55df63[_0xe3d8('0x3b')]);_0x229dd0[_0xe3d8('0x3e')]=_[_0xe3d8('0x3d')](_0x55df63['model'],qs['fields'](_0x14cf5f[_0xe3d8('0x3b')][_0xe3d8('0x3f')]));_0x229dd0['attributes']=_0x229dd0['attributes'][_0xe3d8('0x40')]?_0x229dd0[_0xe3d8('0x3e')]:_0x55df63[_0xe3d8('0x41')];if(!_0x14cf5f[_0xe3d8('0x3b')][_0xe3d8('0x42')](_0xe3d8('0x43'))){_0x229dd0[_0xe3d8('0x44')]=qs[_0xe3d8('0x44')](_0x14cf5f[_0xe3d8('0x3b')][_0xe3d8('0x44')]);_0x229dd0[_0xe3d8('0x2a')]=qs[_0xe3d8('0x2a')](_0x14cf5f[_0xe3d8('0x3b')][_0xe3d8('0x2a')]);}_0x229dd0[_0xe3d8('0x45')]=qs[_0xe3d8('0x46')](_0x14cf5f['query'][_0xe3d8('0x46')]);_0x229dd0[_0xe3d8('0x47')]=qs['filters'](_[_0xe3d8('0x48')](_0x14cf5f[_0xe3d8('0x3b')],_0x55df63[_0xe3d8('0x49')]));if(_0x14cf5f[_0xe3d8('0x3b')][_0xe3d8('0x4a')]){_0x229dd0[_0xe3d8('0x47')]=_['merge'](_0x229dd0[_0xe3d8('0x47')],{'$or':_[_0xe3d8('0x3a')](_0x3d006a,function(_0x3f32fe){if(_0x3f32fe[_0xe3d8('0x38')]!=='VIRTUAL'){var _0x4bc1f4={};_0x4bc1f4[_0x3f32fe[_0xe3d8('0x33')]]={'$like':'%'+_0x14cf5f[_0xe3d8('0x3b')][_0xe3d8('0x4a')]+'%'};return _0x4bc1f4;}})});}_0x229dd0=_[_0xe3d8('0x4b')]({},_0x229dd0,_0x14cf5f['options']);var _0x3371ae={'where':_0x229dd0[_0xe3d8('0x47')]};return db['ServicenowAccount'][_0xe3d8('0x29')](_0x3371ae)[_0xe3d8('0x30')](function(_0x41cd24){_0x25e085[_0xe3d8('0x29')]=_0x41cd24;if(_0x14cf5f['query'][_0xe3d8('0x4c')]){_0x229dd0[_0xe3d8('0x4d')]=[{'all':!![]}];}return db['ServicenowAccount']['findAll'](_0x229dd0);})[_0xe3d8('0x30')](function(_0x385bea){_0x25e085[_0xe3d8('0x4e')]=_0x385bea;return _0x25e085;})['then'](respondWithFilteredResult(_0x366974,_0x229dd0))['catch'](handleError(_0x366974,null));};exports[_0xe3d8('0x4f')]=function(_0x55fae3,_0x38b28f){var _0x62ce8c={'raw':![],'where':{'id':_0x55fae3['params']['id']}},_0x34a0b2={};_0x34a0b2[_0xe3d8('0x41')]=_['keys'](db[_0xe3d8('0x36')]['rawAttributes']);_0x34a0b2[_0xe3d8('0x3b')]=_[_0xe3d8('0x3c')](_0x55fae3[_0xe3d8('0x3b')]);_0x34a0b2[_0xe3d8('0x49')]=_[_0xe3d8('0x3d')](_0x34a0b2['model'],_0x34a0b2[_0xe3d8('0x3b')]);_0x62ce8c[_0xe3d8('0x3e')]=_[_0xe3d8('0x3d')](_0x34a0b2['model'],qs[_0xe3d8('0x3f')](_0x55fae3['query'][_0xe3d8('0x3f')]));_0x62ce8c[_0xe3d8('0x3e')]=_0x62ce8c[_0xe3d8('0x3e')]['length']?_0x62ce8c[_0xe3d8('0x3e')]:_0x34a0b2[_0xe3d8('0x41')];if(_0x55fae3[_0xe3d8('0x3b')][_0xe3d8('0x4c')]){_0x62ce8c[_0xe3d8('0x4d')]=[{'all':!![]}];}_0x62ce8c=_['merge']({},_0x62ce8c,_0x55fae3[_0xe3d8('0x50')]);return db['ServicenowAccount']['find'](_0x62ce8c)[_0xe3d8('0x30')](handleEntityNotFound(_0x38b28f,null))[_0xe3d8('0x30')](respondWithResult(_0x38b28f,null))[_0xe3d8('0x26')](handleError(_0x38b28f,null));};exports[_0xe3d8('0x51')]=function(_0x4890da,_0x2c244b){return db[_0xe3d8('0x36')][_0xe3d8('0x51')](_0x4890da[_0xe3d8('0x52')],{})[_0xe3d8('0x30')](respondWithResult(_0x2c244b,0xc9))[_0xe3d8('0x26')](handleError(_0x2c244b,null));};exports['update']=function(_0x29a84e,_0x369dd8){if(_0x29a84e['body']['id']){delete _0x29a84e[_0xe3d8('0x52')]['id'];}return db[_0xe3d8('0x36')][_0xe3d8('0x53')]({'where':{'id':_0x29a84e[_0xe3d8('0x54')]['id']}})['then'](handleEntityNotFound(_0x369dd8,null))['then'](saveUpdates(_0x29a84e['body'],null))[_0xe3d8('0x30')](respondWithResult(_0x369dd8,null))[_0xe3d8('0x26')](handleError(_0x369dd8,null));};exports[_0xe3d8('0x31')]=function(_0x4afc3b,_0x170923){return db[_0xe3d8('0x36')][_0xe3d8('0x53')]({'where':{'id':_0x4afc3b[_0xe3d8('0x54')]['id']}})['then'](handleEntityNotFound(_0x170923,null))['then'](removeEntity(_0x170923,null))[_0xe3d8('0x26')](handleError(_0x170923,null));};exports[_0xe3d8('0x55')]=function(_0x5f3546,_0x1ede90,_0x272e45){var _0x58662b={};var _0xb1ab3a={};var _0x2747a6;var _0x2b697b;return db[_0xe3d8('0x36')][_0xe3d8('0x56')]({'where':{'id':_0x5f3546[_0xe3d8('0x54')]['id']}})[_0xe3d8('0x30')](handleEntityNotFound(_0x1ede90,null))[_0xe3d8('0x30')](function(_0x58a69b){if(_0x58a69b){_0x2747a6=_0x58a69b;_0xb1ab3a['model']=_[_0xe3d8('0x3c')](db[_0xe3d8('0x57')]['rawAttributes']);_0xb1ab3a[_0xe3d8('0x3b')]=_['keys'](_0x5f3546['query']);_0xb1ab3a[_0xe3d8('0x49')]=_[_0xe3d8('0x3d')](_0xb1ab3a[_0xe3d8('0x41')],_0xb1ab3a['query']);_0x58662b['attributes']=_[_0xe3d8('0x3d')](_0xb1ab3a[_0xe3d8('0x41')],qs[_0xe3d8('0x3f')](_0x5f3546['query'][_0xe3d8('0x3f')]));_0x58662b[_0xe3d8('0x3e')]=_0x58662b[_0xe3d8('0x3e')][_0xe3d8('0x40')]?_0x58662b['attributes']:_0xb1ab3a['model'];_0x58662b[_0xe3d8('0x45')]=qs[_0xe3d8('0x46')](_0x5f3546[_0xe3d8('0x3b')][_0xe3d8('0x46')]);_0x58662b[_0xe3d8('0x47')]=qs[_0xe3d8('0x49')](_[_0xe3d8('0x48')](_0x5f3546[_0xe3d8('0x3b')],_0xb1ab3a[_0xe3d8('0x49')]));if(_0x5f3546[_0xe3d8('0x3b')][_0xe3d8('0x4a')]){_0x58662b[_0xe3d8('0x47')]=_[_0xe3d8('0x4b')](_0x58662b[_0xe3d8('0x47')],{'$or':_[_0xe3d8('0x3a')](_0x58662b['attributes'],function(_0x58001f){var _0x52506b={};_0x52506b[_0x58001f]={'$like':'%'+_0x5f3546['query'][_0xe3d8('0x4a')]+'%'};return _0x52506b;})});}_0x58662b=_['merge']({},_0x58662b,_0x5f3546[_0xe3d8('0x50')]);return _0x2747a6[_0xe3d8('0x55')](_0x58662b);}})[_0xe3d8('0x30')](function(_0x1c67a6){if(_0x1c67a6){_0x2b697b=_0x1c67a6[_0xe3d8('0x40')];if(!_0x5f3546[_0xe3d8('0x3b')]['hasOwnProperty'](_0xe3d8('0x43'))){_0x58662b[_0xe3d8('0x44')]=qs[_0xe3d8('0x44')](_0x5f3546['query'][_0xe3d8('0x44')]);_0x58662b['offset']=qs[_0xe3d8('0x2a')](_0x5f3546[_0xe3d8('0x3b')][_0xe3d8('0x2a')]);}return _0x2747a6[_0xe3d8('0x55')](_0x58662b);}})[_0xe3d8('0x30')](function(_0x5076a4){if(_0x5076a4){return _0x5076a4?{'count':_0x2b697b,'rows':_0x5076a4}:null;}})[_0xe3d8('0x30')](respondWithResult(_0x1ede90,null))['catch'](handleError(_0x1ede90,null));};exports[_0xe3d8('0x58')]=function(_0x563050,_0x54fbcd,_0x2ef68e){if(_0x563050[_0xe3d8('0x52')]['id']){delete _0x563050[_0xe3d8('0x52')]['id'];}return db[_0xe3d8('0x36')]['findOne']({'where':{'id':_0x563050[_0xe3d8('0x54')]['id']}})[_0xe3d8('0x30')](handleEntityNotFound(_0x54fbcd,null))['then'](function(_0x820edd){if(_0x820edd){_0x563050[_0xe3d8('0x52')][_0xe3d8('0x59')]=_0x820edd['id'];_0x563050[_0xe3d8('0x52')][_0xe3d8('0x5a')]=integrations['getSubjects'](_0x563050[_0xe3d8('0x52')]['channel'],_0x563050[_0xe3d8('0x52')][_0xe3d8('0x38')]);_0x563050[_0xe3d8('0x52')]['Descriptions']=integrations[_0xe3d8('0x5b')](_0x563050[_0xe3d8('0x52')][_0xe3d8('0x5c')],_0x563050[_0xe3d8('0x52')][_0xe3d8('0x38')]);return db[_0xe3d8('0x57')]['create'](_0x563050[_0xe3d8('0x52')],{'include':[{'model':db[_0xe3d8('0x5d')],'as':_0xe3d8('0x5a')},{'model':db[_0xe3d8('0x5d')],'as':_0xe3d8('0x5e')}]});}return null;})[_0xe3d8('0x30')](respondWithResult(_0x54fbcd,null))[_0xe3d8('0x26')](handleError(_0x54fbcd,null));};exports[_0xe3d8('0x5f')]=function(_0x590d59,_0x267437,_0x551c2e){var _0x33521c=[_0xe3d8('0x60'),'hold_reason',_0xe3d8('0x61'),_0xe3d8('0x62'),_0xe3d8('0x63'),_0xe3d8('0x64'),_0xe3d8('0x65'),_0xe3d8('0x66'),_0xe3d8('0x67')];var _0x560a8c=[_0xe3d8('0x68'),_0xe3d8('0x60'),_0xe3d8('0x69'),_0xe3d8('0x6a'),'upon_reject',_0xe3d8('0x6b'),_0xe3d8('0x6c'),'hold_reason',_0xe3d8('0x6d'),_0xe3d8('0x6e'),_0xe3d8('0x6f'),'sys_updated_by',_0xe3d8('0x70'),_0xe3d8('0x71'),_0xe3d8('0x72'),_0xe3d8('0x73'),_0xe3d8('0x74'),_0xe3d8('0x75'),_0xe3d8('0x61'),_0xe3d8('0x45'),_0xe3d8('0x76'),_0xe3d8('0x77'),'cmdb_ci','delivery_plan',_0xe3d8('0x78'),'active','work_notes_list',_0xe3d8('0x79'),_0xe3d8('0x7a'),_0xe3d8('0x7b'),_0xe3d8('0x7c'),'time_worked',_0xe3d8('0x7d'),'opened_at',_0xe3d8('0x7e'),_0xe3d8('0x7f'),'work_end',_0xe3d8('0x80'),_0xe3d8('0x81'),_0xe3d8('0x82'),'approval_set','subcategory',_0xe3d8('0x83'),_0xe3d8('0x84'),_0xe3d8('0x63'),_0xe3d8('0x85'),_0xe3d8('0x86'),'work_start',_0xe3d8('0x87'),_0xe3d8('0x88'),'additional_assignee_list','description',_0xe3d8('0x89'),_0xe3d8('0x64'),_0xe3d8('0x8a'),_0xe3d8('0x8b'),_0xe3d8('0x8c'),_0xe3d8('0x8d'),_0xe3d8('0x8e'),_0xe3d8('0x8f'),_0xe3d8('0x90'),_0xe3d8('0x91'),'incident_state',_0xe3d8('0x92'),'problem_id',_0xe3d8('0x93'),_0xe3d8('0x94'),_0xe3d8('0x95'),_0xe3d8('0x96'),_0xe3d8('0x66'),_0xe3d8('0x97'),'sla_due',_0xe3d8('0x98'),_0xe3d8('0x99'),_0xe3d8('0x9a'),'sys_mod_count',_0xe3d8('0x9b'),_0xe3d8('0x9c'),'escalation',_0xe3d8('0x9d'),_0xe3d8('0x9e'),_0xe3d8('0x9f'),'category'];var _0x534e39='';var _0x453717='';var _0xbd590b=[];var _0x127d00='';var _0x512b38='';var _0x379d91=[];var _0x46f9b1='';var _0x4904c3='';var _0x5f5f03={};var _0x3908a5='';return db[_0xe3d8('0x36')][_0xe3d8('0x56')]({'where':{'id':_0x590d59[_0xe3d8('0x54')]['id']},'attributes':['id',_0xe3d8('0xa0'),'password',_0xe3d8('0xa1'),'remoteUri','serverUrl']})[_0xe3d8('0x30')](handleEntityNotFound(_0x267437,null))[_0xe3d8('0x30')](function(_0x21a256){if(_0x21a256){_0x3908a5=_0x21a256[_0xe3d8('0xa2')];var _0x5ce863=_0x3908a5[_0xe3d8('0xa3')](-0x1);if(_0x5ce863==='/'){_0x3908a5=_0x3908a5['substring'](0x0,_0x3908a5['lastIndexOf'](_0x5ce863));}_0x4904c3=util[_0xe3d8('0xa4')](_0xe3d8('0xa5'),_0x3908a5);_0x46f9b1=util[_0xe3d8('0xa4')](_0xe3d8('0xa6'),_0x3908a5);_0x5f5f03={'user':_0x21a256[_0xe3d8('0xa0')],'pass':_0x21a256[_0xe3d8('0xa7')]};var _0x13463e={'method':_0xe3d8('0xa8'),'uri':_0x4904c3+_0xe3d8('0xa9'),'auth':_0x5f5f03,'json':!![]};return rp(_0x13463e);}})['then'](function(_0x1ad53d){if(_0x1ad53d[_0xe3d8('0x25')][_0xe3d8('0x40')]>0x0){_0x534e39=_0x1ad53d[_0xe3d8('0x25')];}console['log'](_0xe3d8('0xaa'),_0x534e39);_0x379d91=[];_0x453717=Object[_0xe3d8('0xab')]([],_0x534e39);_[_0xe3d8('0xac')](_0x453717,function(_0x2ef2c6){return!_0x33521c[_0xe3d8('0xad')](_0x2ef2c6['name']);});_0x453717[_0xe3d8('0xae')](function(_0x30e6de){var _0x34f032=createFieldObject(_0x46f9b1,_0x5f5f03,_0x30e6de['internalType'],_0x30e6de[_0xe3d8('0x33')],_0x30e6de['label'],![]);_0x379d91[_0xe3d8('0xaf')](_0x34f032);});return Promise[_0xe3d8('0xb0')](_0x379d91);})[_0xe3d8('0x30')](function(_0x311e15){_0xbd590b=_0x311e15;_0x127d00=Object['assign']([],_0x534e39);console[_0xe3d8('0xb1')]('TCL:\x20_object',_0x534e39);_['remove'](_0x127d00,function(_0x20219d){return _0x560a8c[_0xe3d8('0xad')](_0x20219d['name']);});console[_0xe3d8('0xb1')](_0xe3d8('0xb2'),_0x127d00);_0x379d91=[];_0x127d00[_0xe3d8('0xae')](function(_0x299e7d){var _0x4a7c04=createFieldObject(_0x46f9b1,_0x5f5f03,_0x299e7d[_0xe3d8('0xb3')],_0x299e7d[_0xe3d8('0x33')],_0x299e7d[_0xe3d8('0xb4')],!![]);_0x379d91[_0xe3d8('0xaf')](_0x4a7c04);});return Promise['all'](_0x379d91);})['then'](function(_0x5b043f){_0x512b38=_0x5b043f;var _0x48d3ef=_0xbd590b[_0xe3d8('0xb5')](_0x512b38);return{'count':_0x48d3ef[_0xe3d8('0x40')],'rows':_0x48d3ef};})['then'](respondWithResult(_0x267437,null))[_0xe3d8('0x26')](function(_0x54a5f5){console[_0xe3d8('0xb1')](_0xe3d8('0xb6')+_0x54a5f5);var _0x424853=_0x590d59[_0xe3d8('0x3b')][_0xe3d8('0x19')]?0x1f4:_0x54a5f5[_0xe3d8('0xb7')]||0x1f4;logger[_0xe3d8('0x22')](_0x54a5f5[_0xe3d8('0x32')]);delete _0x54a5f5[_0xe3d8('0x33')];if(_0x424853===0x191){_0x424853=0x190;}_0x267437[_0xe3d8('0x28')](_0x424853)[_0xe3d8('0x34')](_0x590d59[_0xe3d8('0x3b')][_0xe3d8('0x19')]?{'message':_0xe3d8('0xb8'),'statusCode':_0x54a5f5[_0xe3d8('0xb7')]}:_0x54a5f5);});};function createFieldObject(_0x41b1d5,_0x3a87a4,_0x28d530,_0x271d64,_0x39db85,_0x3e8e3b){return new Promise(function(_0x189294,_0x52ec3e){var _0x28d249={'id':_0x271d64,'name':_0x39db85,'custom':_0x3e8e3b};if(_0x28d530==='boolean'){_0x28d249['options']=[{'name':_0xe3d8('0xb9'),'value':_0xe3d8('0xba')},{'name':_0xe3d8('0xbb'),'value':_0xe3d8('0xbc')}];_0x189294(_0x28d249);}else{var _0x289fd9={'method':'GET','uri':_0x41b1d5+_0xe3d8('0xbd')+_0x271d64,'auth':_0x3a87a4,'json':!![]};return rp(_0x289fd9)[_0xe3d8('0x30')](function(_0x5a4ec0){var _0x54f016=[];if(_0x5a4ec0[_0xe3d8('0x25')]['length']>0x0){_0x5a4ec0[_0xe3d8('0x25')][_0xe3d8('0xae')](function(_0xae8b66){if(_0xae8b66[_0xe3d8('0xbe')]===_0xe3d8('0xbc')){var _0x2c8894={'name':_0xae8b66[_0xe3d8('0xb4')],'value':_0xae8b66[_0xe3d8('0xbf')]};_0x54f016[_0xe3d8('0xaf')](_0x2c8894);}});}_0x28d249[_0xe3d8('0x50')]=_0x54f016;if(_0x28d249[_0xe3d8('0x50')][_0xe3d8('0x40')]>0x0){_0x189294(_0x28d249);}else{if(_0x3e8e3b==![]){_0x189294();}else{_0x189294(_0x28d249);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index 7e569d1..c0a00a7 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 _0x81bd=['../../config/environment','./intServicenowAccount.attributes','exports','int_servicenow_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x53b594,_0x559767){var _0x1e616f=function(_0x333eda){while(--_0x333eda){_0x53b594['push'](_0x53b594['shift']());}};_0x1e616f(++_0x559767);}(_0x81bd,0x7c));var _0xd81b=function(_0xf0ec6e,_0xa183d3){_0xf0ec6e=_0xf0ec6e-0x0;var _0x8bbc27=_0x81bd[_0xf0ec6e];return _0x8bbc27;};'use strict';var _=require(_0xd81b('0x0'));var util=require(_0xd81b('0x1'));var logger=require(_0xd81b('0x2'))(_0xd81b('0x3'));var moment=require(_0xd81b('0x4'));var BPromise=require(_0xd81b('0x5'));var rp=require(_0xd81b('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd81b('0x7'));var config=require(_0xd81b('0x8'));var attributes=require(_0xd81b('0x9'));var integrations=require('../../components/integrations/configuration');module[_0xd81b('0xa')]=function(_0x34eb73,_0x1f3f2c){return _0x34eb73['define']('ServicenowAccount',attributes,{'tableName':_0xd81b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd13e=['bluebird','path','../../config/environment','./intServicenowAccount.attributes','define','ServicenowAccount','int_servicenow_accounts','lodash','util','../../config/logger','api'];(function(_0x473a91,_0x5a1d12){var _0x27961e=function(_0x471c21){while(--_0x471c21){_0x473a91['push'](_0x473a91['shift']());}};_0x27961e(++_0x5a1d12);}(_0xd13e,0x193));var _0xed13=function(_0x500c77,_0x2863fe){_0x500c77=_0x500c77-0x0;var _0x27f44a=_0xd13e[_0x500c77];return _0x27f44a;};'use strict';var _=require(_0xed13('0x0'));var util=require(_0xed13('0x1'));var logger=require(_0xed13('0x2'))(_0xed13('0x3'));var moment=require('moment');var BPromise=require(_0xed13('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xed13('0x5'));var rimraf=require('rimraf');var config=require(_0xed13('0x6'));var attributes=require(_0xed13('0x7'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x5142bd,_0x95ff4c){return _0x5142bd[_0xed13('0x8')](_0xed13('0x9'),attributes,{'tableName':_0xed13('0xa'),'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 6d16260..c2c3378 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 _0x2a49=['then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetServicenowAccount','findAll','options','attributes','limit','map','include','model','debug','catch','ServicenowAccount','find','raw','where','ShowServicenowAccount','util','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x92c450,_0x41f1e3){var _0x2a9599=function(_0x4f27df){while(--_0x4f27df){_0x92c450['push'](_0x92c450['shift']());}};_0x2a9599(++_0x41f1e3);}(_0x2a49,0xcd));var _0x92a4=function(_0x89207c,_0x97abd){_0x89207c=_0x89207c-0x0;var _0x4fc9b2=_0x2a49[_0x89207c];return _0x4fc9b2;};'use strict';var _=require('lodash');var util=require(_0x92a4('0x0'));var moment=require('moment');var BPromise=require(_0x92a4('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x92a4('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x92a4('0x3'));var logger=require(_0x92a4('0x4'))(_0x92a4('0x5'));var config=require(_0x92a4('0x6'));var jayson=require(_0x92a4('0x7'));var client=jayson[_0x92a4('0x8')][_0x92a4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x55f8bb,_0x4c7096,_0x1b2899){return new BPromise(function(_0x529edd,_0x435de9){return client[_0x92a4('0xa')](_0x55f8bb,_0x1b2899)[_0x92a4('0xb')](function(_0xa1c235){logger[_0x92a4('0xc')](_0x92a4('0xd'),_0x4c7096,_0x92a4('0xe'));logger['debug'](_0x92a4('0xf'),_0x4c7096,'request\x20sent',JSON[_0x92a4('0x10')](_0xa1c235));if(_0xa1c235[_0x92a4('0x11')]){if(_0xa1c235[_0x92a4('0x11')][_0x92a4('0x12')]===0x1f4){logger['error'](_0x92a4('0xd'),_0x4c7096,_0xa1c235[_0x92a4('0x11')][_0x92a4('0x13')]);return _0x435de9(_0xa1c235[_0x92a4('0x11')]['message']);}logger['error'](_0x92a4('0xd'),_0x4c7096,_0xa1c235[_0x92a4('0x11')][_0x92a4('0x13')]);return _0x529edd(_0xa1c235[_0x92a4('0x11')][_0x92a4('0x13')]);}else{logger[_0x92a4('0xc')]('ServicenowAccount,\x20%s,\x20%s',_0x4c7096,'request\x20sent');_0x529edd(_0xa1c235[_0x92a4('0x14')][_0x92a4('0x13')]);}})['catch'](function(_0x31d1c4){logger[_0x92a4('0x11')](_0x92a4('0xd'),_0x4c7096,_0x31d1c4);_0x435de9(_0x31d1c4);});});}exports[_0x92a4('0x15')]=function(_0x416def){var _0x2e196e=this;return new Promise(function(_0x2d4b7d,_0x51a5a0){return db['ServicenowAccount'][_0x92a4('0x16')]({'raw':_0x416def['options']?_0x416def['options']['raw']===undefined?!![]:![]:!![],'where':_0x416def[_0x92a4('0x17')]?_0x416def[_0x92a4('0x17')]['where']||null:null,'attributes':_0x416def[_0x92a4('0x17')]?_0x416def['options'][_0x92a4('0x18')]||null:null,'limit':_0x416def['options']?_0x416def[_0x92a4('0x17')][_0x92a4('0x19')]||null:null,'include':_0x416def[_0x92a4('0x17')]?_0x416def[_0x92a4('0x17')]['include']?_[_0x92a4('0x1a')](_0x416def[_0x92a4('0x17')][_0x92a4('0x1b')],function(_0x29b828){return{'model':db[_0x29b828['model']],'as':_0x29b828['as'],'attributes':_0x29b828['attributes'],'include':_0x29b828[_0x92a4('0x1b')]?_[_0x92a4('0x1a')](_0x29b828[_0x92a4('0x1b')],function(_0x1a4ee5){return{'model':db[_0x1a4ee5[_0x92a4('0x1c')]],'as':_0x1a4ee5['as'],'attributes':_0x1a4ee5[_0x92a4('0x18')],'include':_0x1a4ee5[_0x92a4('0x1b')]?_[_0x92a4('0x1a')](_0x1a4ee5['include'],function(_0x1cbd9e){return{'model':db[_0x1cbd9e[_0x92a4('0x1c')]],'as':_0x1cbd9e['as'],'attributes':_0x1cbd9e['attributes']};}):[]};}):[]};}):[]:[]})[_0x92a4('0xb')](function(_0x40b421){logger[_0x92a4('0xc')](_0x92a4('0x15'),_0x416def);logger[_0x92a4('0x1d')](_0x92a4('0x15'),_0x416def,JSON['stringify'](_0x40b421));_0x2d4b7d(_0x40b421);})[_0x92a4('0x1e')](function(_0x38c028){logger['error']('GetServicenowAccount',_0x38c028[_0x92a4('0x13')],_0x416def);_0x51a5a0(_0x2e196e[_0x92a4('0x11')](0x1f4,_0x38c028[_0x92a4('0x13')]));});});};exports['ShowServicenowAccount']=function(_0x3f1f22){var _0x5f0fe9=this;return new Promise(function(_0x54e595,_0x47bc02){return db[_0x92a4('0x1f')][_0x92a4('0x20')]({'raw':_0x3f1f22[_0x92a4('0x17')]?_0x3f1f22[_0x92a4('0x17')][_0x92a4('0x21')]===undefined?!![]:![]:!![],'where':_0x3f1f22[_0x92a4('0x17')]?_0x3f1f22[_0x92a4('0x17')][_0x92a4('0x22')]||null:null,'attributes':_0x3f1f22[_0x92a4('0x17')]?_0x3f1f22['options'][_0x92a4('0x18')]||null:null,'include':_0x3f1f22['options']?_0x3f1f22[_0x92a4('0x17')]['include']?_[_0x92a4('0x1a')](_0x3f1f22['options'][_0x92a4('0x1b')],function(_0x304327){return{'model':db[_0x304327['model']],'as':_0x304327['as'],'attributes':_0x304327[_0x92a4('0x18')],'include':_0x304327['include']?_[_0x92a4('0x1a')](_0x304327[_0x92a4('0x1b')],function(_0x5c4cf3){return{'model':db[_0x5c4cf3['model']],'as':_0x5c4cf3['as'],'attributes':_0x5c4cf3[_0x92a4('0x18')],'include':_0x5c4cf3[_0x92a4('0x1b')]?_[_0x92a4('0x1a')](_0x5c4cf3['include'],function(_0x4e654d){return{'model':db[_0x4e654d[_0x92a4('0x1c')]],'as':_0x4e654d['as'],'attributes':_0x4e654d['attributes']};}):[]};}):[]};}):[]:[]})[_0x92a4('0xb')](function(_0x162b29){logger['info']('ShowServicenowAccount',_0x3f1f22);logger[_0x92a4('0x1d')](_0x92a4('0x23'),_0x3f1f22,JSON[_0x92a4('0x10')](_0x162b29));_0x54e595(_0x162b29);})[_0x92a4('0x1e')](function(_0x35cfe1){logger[_0x92a4('0x11')](_0x92a4('0x23'),_0x35cfe1['message'],_0x3f1f22);_0x47bc02(_0x5f0fe9[_0x92a4('0x11')](0x1f4,_0x35cfe1[_0x92a4('0x13')]));});});}; \ No newline at end of file +var _0xe988=['debug','error','code','message','result','catch','GetServicenowAccount','options','raw','attributes','limit','include','model','map','stringify','ServicenowAccount','where','ShowServicenowAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent'];(function(_0x53f122,_0x2cdeca){var _0x59a134=function(_0x41468d){while(--_0x41468d){_0x53f122['push'](_0x53f122['shift']());}};_0x59a134(++_0x2cdeca);}(_0xe988,0x9e));var _0x8e98=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xe988[_0x47a7d0];return _0xb9bd08;};'use strict';var _=require(_0x8e98('0x0'));var util=require(_0x8e98('0x1'));var moment=require(_0x8e98('0x2'));var BPromise=require(_0x8e98('0x3'));var rs=require(_0x8e98('0x4'));var fs=require('fs');var Redis=require(_0x8e98('0x5'));var db=require(_0x8e98('0x6'))['db'];var utils=require(_0x8e98('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x8e98('0x8'));var jayson=require(_0x8e98('0x9'));var client=jayson[_0x8e98('0xa')][_0x8e98('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x27f1a9,_0x4afd43,_0x3863b7){return new BPromise(function(_0x453dcf,_0x59121d){return client[_0x8e98('0xc')](_0x27f1a9,_0x3863b7)[_0x8e98('0xd')](function(_0x2b1783){logger[_0x8e98('0xe')](_0x8e98('0xf'),_0x4afd43,_0x8e98('0x10'));logger[_0x8e98('0x11')]('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x4afd43,_0x8e98('0x10'),JSON['stringify'](_0x2b1783));if(_0x2b1783[_0x8e98('0x12')]){if(_0x2b1783[_0x8e98('0x12')][_0x8e98('0x13')]===0x1f4){logger[_0x8e98('0x12')](_0x8e98('0xf'),_0x4afd43,_0x2b1783[_0x8e98('0x12')]['message']);return _0x59121d(_0x2b1783['error'][_0x8e98('0x14')]);}logger[_0x8e98('0x12')](_0x8e98('0xf'),_0x4afd43,_0x2b1783[_0x8e98('0x12')][_0x8e98('0x14')]);return _0x453dcf(_0x2b1783[_0x8e98('0x12')][_0x8e98('0x14')]);}else{logger[_0x8e98('0xe')]('ServicenowAccount,\x20%s,\x20%s',_0x4afd43,'request\x20sent');_0x453dcf(_0x2b1783[_0x8e98('0x15')][_0x8e98('0x14')]);}})[_0x8e98('0x16')](function(_0x36cba7){logger[_0x8e98('0x12')](_0x8e98('0xf'),_0x4afd43,_0x36cba7);_0x59121d(_0x36cba7);});});}exports[_0x8e98('0x17')]=function(_0x3f7f03){var _0x5edea1=this;return new Promise(function(_0x316428,_0x46fdc4){return db['ServicenowAccount']['findAll']({'raw':_0x3f7f03['options']?_0x3f7f03[_0x8e98('0x18')][_0x8e98('0x19')]===undefined?!![]:![]:!![],'where':_0x3f7f03[_0x8e98('0x18')]?_0x3f7f03[_0x8e98('0x18')]['where']||null:null,'attributes':_0x3f7f03['options']?_0x3f7f03[_0x8e98('0x18')][_0x8e98('0x1a')]||null:null,'limit':_0x3f7f03[_0x8e98('0x18')]?_0x3f7f03['options'][_0x8e98('0x1b')]||null:null,'include':_0x3f7f03[_0x8e98('0x18')]?_0x3f7f03[_0x8e98('0x18')][_0x8e98('0x1c')]?_['map'](_0x3f7f03[_0x8e98('0x18')][_0x8e98('0x1c')],function(_0x12d514){return{'model':db[_0x12d514[_0x8e98('0x1d')]],'as':_0x12d514['as'],'attributes':_0x12d514[_0x8e98('0x1a')],'include':_0x12d514[_0x8e98('0x1c')]?_[_0x8e98('0x1e')](_0x12d514['include'],function(_0x12cd3c){return{'model':db[_0x12cd3c[_0x8e98('0x1d')]],'as':_0x12cd3c['as'],'attributes':_0x12cd3c[_0x8e98('0x1a')],'include':_0x12cd3c[_0x8e98('0x1c')]?_[_0x8e98('0x1e')](_0x12cd3c[_0x8e98('0x1c')],function(_0xec22eb){return{'model':db[_0xec22eb['model']],'as':_0xec22eb['as'],'attributes':_0xec22eb[_0x8e98('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x8e98('0xd')](function(_0xb30d6a){logger['info'](_0x8e98('0x17'),_0x3f7f03);logger[_0x8e98('0x11')](_0x8e98('0x17'),_0x3f7f03,JSON[_0x8e98('0x1f')](_0xb30d6a));_0x316428(_0xb30d6a);})[_0x8e98('0x16')](function(_0x3e5e6f){logger['error']('GetServicenowAccount',_0x3e5e6f[_0x8e98('0x14')],_0x3f7f03);_0x46fdc4(_0x5edea1[_0x8e98('0x12')](0x1f4,_0x3e5e6f[_0x8e98('0x14')]));});});};exports['ShowServicenowAccount']=function(_0x1976ba){var _0x15ea60=this;return new Promise(function(_0x12eb91,_0x2b62f4){return db[_0x8e98('0x20')]['find']({'raw':_0x1976ba[_0x8e98('0x18')]?_0x1976ba[_0x8e98('0x18')][_0x8e98('0x19')]===undefined?!![]:![]:!![],'where':_0x1976ba[_0x8e98('0x18')]?_0x1976ba[_0x8e98('0x18')][_0x8e98('0x21')]||null:null,'attributes':_0x1976ba[_0x8e98('0x18')]?_0x1976ba['options'][_0x8e98('0x1a')]||null:null,'include':_0x1976ba[_0x8e98('0x18')]?_0x1976ba[_0x8e98('0x18')][_0x8e98('0x1c')]?_[_0x8e98('0x1e')](_0x1976ba['options'][_0x8e98('0x1c')],function(_0x218583){return{'model':db[_0x218583[_0x8e98('0x1d')]],'as':_0x218583['as'],'attributes':_0x218583['attributes'],'include':_0x218583[_0x8e98('0x1c')]?_[_0x8e98('0x1e')](_0x218583[_0x8e98('0x1c')],function(_0x36da68){return{'model':db[_0x36da68[_0x8e98('0x1d')]],'as':_0x36da68['as'],'attributes':_0x36da68[_0x8e98('0x1a')],'include':_0x36da68[_0x8e98('0x1c')]?_[_0x8e98('0x1e')](_0x36da68[_0x8e98('0x1c')],function(_0x11f602){return{'model':db[_0x11f602[_0x8e98('0x1d')]],'as':_0x11f602['as'],'attributes':_0x11f602[_0x8e98('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x8e98('0xd')](function(_0x354ca1){logger[_0x8e98('0xe')](_0x8e98('0x22'),_0x1976ba);logger[_0x8e98('0x11')](_0x8e98('0x22'),_0x1976ba,JSON[_0x8e98('0x1f')](_0x354ca1));_0x12eb91(_0x354ca1);})[_0x8e98('0x16')](function(_0x226a77){logger[_0x8e98('0x12')](_0x8e98('0x22'),_0x226a77[_0x8e98('0x14')],_0x1976ba);_0x2b62f4(_0x15ea60[_0x8e98('0x12')](0x1f4,_0x226a77[_0x8e98('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index 7ee4a6a..46dc755 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 _0x2d5f=['../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','get','isAuthenticated','index','/:id','show','getFields','/:id/subjects','/:id/descriptions','getDescriptions','post','put','update','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0xeadf5f,_0xc8e4ff){var _0x5530c3=function(_0x321a20){while(--_0x321a20){_0xeadf5f['push'](_0xeadf5f['shift']());}};_0x5530c3(++_0xc8e4ff);}(_0x2d5f,0x10d));var _0xf2d5=function(_0x40ddc0,_0x41c082){_0x40ddc0=_0x40ddc0-0x0;var _0x1aebf1=_0x2d5f[_0x40ddc0];return _0x1aebf1;};'use strict';var multer=require(_0xf2d5('0x0'));var util=require(_0xf2d5('0x1'));var path=require(_0xf2d5('0x2'));var timeout=require(_0xf2d5('0x3'));var express=require(_0xf2d5('0x4'));var router=express[_0xf2d5('0x5')]();var auth=require(_0xf2d5('0x6'));var interaction=require(_0xf2d5('0x7'));var config=require(_0xf2d5('0x8'));var controller=require(_0xf2d5('0x9'));router[_0xf2d5('0xa')]('/',auth[_0xf2d5('0xb')](),controller[_0xf2d5('0xc')]);router[_0xf2d5('0xa')](_0xf2d5('0xd'),auth[_0xf2d5('0xb')](),controller[_0xf2d5('0xe')]);router[_0xf2d5('0xa')]('/:id/fields',auth[_0xf2d5('0xb')](),controller[_0xf2d5('0xf')]);router['get'](_0xf2d5('0x10'),auth[_0xf2d5('0xb')](),controller['getSubjects']);router[_0xf2d5('0xa')](_0xf2d5('0x11'),auth[_0xf2d5('0xb')](),controller[_0xf2d5('0x12')]);router[_0xf2d5('0x13')]('/',auth['isAuthenticated'](),controller['create']);router[_0xf2d5('0x14')](_0xf2d5('0xd'),auth[_0xf2d5('0xb')](),controller[_0xf2d5('0x15')]);router['delete'](_0xf2d5('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0xf2d5('0x16')]=router; \ No newline at end of file +var _0x3f08=['multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','index','get','/:id','isAuthenticated','show','getFields','getSubjects','/:id/descriptions','getDescriptions','post','put','delete','destroy','exports'];(function(_0x3d42d8,_0x4cffaa){var _0x27fc41=function(_0x3a363b){while(--_0x3a363b){_0x3d42d8['push'](_0x3d42d8['shift']());}};_0x27fc41(++_0x4cffaa);}(_0x3f08,0x1e3));var _0x83f0=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x3f08[_0x1facfa];return _0x9ec701;};'use strict';var multer=require(_0x83f0('0x0'));var util=require(_0x83f0('0x1'));var path=require(_0x83f0('0x2'));var timeout=require(_0x83f0('0x3'));var express=require('express');var router=express[_0x83f0('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x83f0('0x5'));var config=require(_0x83f0('0x6'));var controller=require('./intServicenowConfiguration.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x83f0('0x7')]);router[_0x83f0('0x8')](_0x83f0('0x9'),auth[_0x83f0('0xa')](),controller[_0x83f0('0xb')]);router['get']('/:id/fields',auth[_0x83f0('0xa')](),controller[_0x83f0('0xc')]);router['get']('/:id/subjects',auth[_0x83f0('0xa')](),controller[_0x83f0('0xd')]);router[_0x83f0('0x8')](_0x83f0('0xe'),auth[_0x83f0('0xa')](),controller[_0x83f0('0xf')]);router[_0x83f0('0x10')]('/',auth[_0x83f0('0xa')](),controller['create']);router[_0x83f0('0x11')]('/:id',auth[_0x83f0('0xa')](),controller['update']);router[_0x83f0('0x12')](_0x83f0('0x9'),auth[_0x83f0('0xa')](),controller[_0x83f0('0x13')]);module[_0x83f0('0x14')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index 7f74c00..e827014 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 _0x4c88=['STRING','exports'];(function(_0x49011b,_0x4ff958){var _0x33ce53=function(_0xd010cb){while(--_0xd010cb){_0x49011b['push'](_0x49011b['shift']());}};_0x33ce53(++_0x4ff958);}(_0x4c88,0x1b9));var _0x84c8=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x4c88[_0x2c91e9];return _0x13f0ff;};'use strict';var Sequelize=require('sequelize');module[_0x84c8('0x0')]={'name':{'type':Sequelize[_0x84c8('0x1')]},'description':{'type':Sequelize[_0x84c8('0x1')]}}; \ No newline at end of file +var _0x3100=['STRING','sequelize','exports'];(function(_0x125c96,_0x22f7f7){var _0x4f8412=function(_0x5c69f1){while(--_0x5c69f1){_0x125c96['push'](_0x125c96['shift']());}};_0x4f8412(++_0x22f7f7);}(_0x3100,0x106));var _0x0310=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3100[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x0310('0x0'));module[_0x0310('0x1')]={'name':{'type':Sequelize[_0x0310('0x2')]},'description':{'type':Sequelize[_0x0310('0x2')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index 3a98341..db5646f 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 _0x7de8=['includeAll','findAll','rows','show','find','create','body','params','getFields','findOne','nolimit','getSubjects','ServicenowField','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','jayson/promise','http','request','then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','end','json','count','offset','save','update','destroy','sendStatus','stack','name','send','index','ServicenowConfiguration','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','limit','order','sort','where','pick','filter','merge','VIRTUAL','options'];(function(_0x21b48b,_0x3cc09a){var _0x24d2f3=function(_0x4212a5){while(--_0x4212a5){_0x21b48b['push'](_0x21b48b['shift']());}};_0x24d2f3(++_0x3cc09a);}(_0x7de8,0x6b));var _0x87de=function(_0x1cb55d,_0xd9537){_0x1cb55d=_0x1cb55d-0x0;var _0xa553ca=_0x7de8[_0x1cb55d];return _0xa553ca;};'use strict';var pdf=require(_0x87de('0x0'));var emlformat=require(_0x87de('0x1'));var rimraf=require(_0x87de('0x2'));var zipdir=require(_0x87de('0x3'));var jsonpatch=require(_0x87de('0x4'));var rp=require('request-promise');var moment=require(_0x87de('0x5'));var BPromise=require(_0x87de('0x6'));var Mustache=require(_0x87de('0x7'));var util=require(_0x87de('0x8'));var path=require(_0x87de('0x9'));var sox=require(_0x87de('0xa'));var csv=require(_0x87de('0xb'));var ejs=require(_0x87de('0xc'));var fs=require('fs');var _=require(_0x87de('0xd'));var squel=require(_0x87de('0xe'));var crypto=require(_0x87de('0xf'));var jsforce=require(_0x87de('0x10'));var deskjs=require(_0x87de('0x11'));var toCsv=require(_0x87de('0xb'));var querystring=require(_0x87de('0x12'));var Papa=require(_0x87de('0x13'));var Redis=require(_0x87de('0x14'));var authService=require('../../components/auth/service');var qs=require(_0x87de('0x15'));var as=require(_0x87de('0x16'));var hardwareService=require(_0x87de('0x17'));var logger=require(_0x87de('0x18'))(_0x87de('0x19'));var utils=require('../../config/utils');var config=require(_0x87de('0x1a'));var db=require('../../mysqldb')['db'];var jayson=require(_0x87de('0x1b'));var client=jayson['client'][_0x87de('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x524d9a,_0x43a33e,_0x4108b4){if(_0x4108b4){var _0x42a3a7=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x42a3a7['test'](_0x43a33e)){return _0x524d9a;}else{throw new db['Sequelize']['ValidationError']('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x524d9a;}}function respondWithRpcPromise(_0x579a7a,_0x28e75a,_0x556549,_0x2485b2){return new BPromise(function(_0x294480,_0x1ccb7f){var _0x206961=_0x2485b2||client;return _0x206961[_0x87de('0x1d')](_0x579a7a,_0x556549)[_0x87de('0x1e')](function(_0x732b23){logger[_0x87de('0x1f')](_0x87de('0x20'),_0x28e75a,_0x87de('0x21'));logger[_0x87de('0x22')](_0x87de('0x23'),_0x28e75a,_0x87de('0x21'),JSON[_0x87de('0x24')](_0x732b23));if(_0x732b23[_0x87de('0x25')]){if(_0x732b23[_0x87de('0x25')][_0x87de('0x26')]===0x1f4){logger['error'](_0x87de('0x20'),_0x28e75a,_0x732b23['error'][_0x87de('0x27')]);return _0x1ccb7f(_0x732b23['error'][_0x87de('0x27')]);}logger[_0x87de('0x25')]('ServicenowConfiguration,\x20%s,\x20%s',_0x28e75a,_0x732b23[_0x87de('0x25')][_0x87de('0x27')]);return _0x294480(_0x732b23[_0x87de('0x25')][_0x87de('0x27')]);}else{logger[_0x87de('0x1f')](_0x87de('0x20'),_0x28e75a,_0x87de('0x21'));_0x294480(_0x732b23[_0x87de('0x28')][_0x87de('0x27')]);}})[_0x87de('0x29')](function(_0x4d4e1d){logger[_0x87de('0x25')](_0x87de('0x20'),_0x28e75a,_0x4d4e1d);_0x1ccb7f(_0x4d4e1d);});});}function respondWithStatusCode(_0x1fd401,_0x40ab48){_0x40ab48=_0x40ab48||0xcc;return function(_0x5f2535){if(_0x5f2535){return _0x1fd401['sendStatus'](_0x40ab48);}return _0x1fd401[_0x87de('0x2a')](_0x40ab48)[_0x87de('0x2b')]();};}function respondWithResult(_0x270180,_0x137773){_0x137773=_0x137773||0xc8;return function(_0x13f019){if(_0x13f019){return _0x270180[_0x87de('0x2a')](_0x137773)[_0x87de('0x2c')](_0x13f019);}};}function respondWithFilteredResult(_0x17c25b,_0x51472b){return function(_0x3496a9){if(_0x3496a9){var _0x3b5913=_0x3496a9[_0x87de('0x2d')],_0x32d62b=_0x51472b['offset'],_0x4ebe7f=_0x51472b[_0x87de('0x2e')]+_0x51472b['limit'],_0x4bd1ae;if(_0x4ebe7f>=_0x3b5913){_0x4ebe7f=_0x3b5913;_0x4bd1ae=0xc8;}else{_0x4bd1ae=0xce;}_0x17c25b[_0x87de('0x2a')](_0x4bd1ae);return _0x17c25b['set']('Content-Range',_0x32d62b+'-'+_0x4ebe7f+'/'+_0x3b5913)[_0x87de('0x2c')](_0x3496a9);}return null;};}function patchUpdates(_0x4d4b6a){return function(_0x466302){try{jsonpatch['apply'](_0x466302,_0x4d4b6a,!![]);}catch(_0x5316ba){return BPromise['reject'](_0x5316ba);}return _0x466302[_0x87de('0x2f')]();};}function saveUpdates(_0x280f5d,_0x414aea){return function(_0x40c8b8){if(_0x40c8b8){return _0x40c8b8[_0x87de('0x30')](_0x280f5d)[_0x87de('0x1e')](function(_0x2d1c54){return _0x2d1c54;});}return null;};}function removeEntity(_0x675f01,_0x2f825a){return function(_0x27641c){if(_0x27641c){return _0x27641c[_0x87de('0x31')]()[_0x87de('0x1e')](function(){_0x675f01['status'](0xcc)[_0x87de('0x2b')]();});}};}function handleEntityNotFound(_0x428c04,_0x58d708){return function(_0x2deb30){if(!_0x2deb30){_0x428c04[_0x87de('0x32')](0x194);}return _0x2deb30;};}function handleError(_0x355944,_0x2d7809){_0x2d7809=_0x2d7809||0x1f4;return function(_0x174921){logger['error'](_0x174921[_0x87de('0x33')]);if(_0x174921[_0x87de('0x34')]){delete _0x174921[_0x87de('0x34')];}_0x355944[_0x87de('0x2a')](_0x2d7809)[_0x87de('0x35')](_0x174921);};}exports[_0x87de('0x36')]=function(_0x5dd8ec,_0x4605a5){var _0x154bb9={},_0x1ac1f8={},_0x281894={'count':0x0,'rows':[]};var _0x5e543a=_['map'](db[_0x87de('0x37')][_0x87de('0x38')],function(_0x4c07ea){return{'name':_0x4c07ea[_0x87de('0x39')],'type':_0x4c07ea[_0x87de('0x3a')][_0x87de('0x3b')]};});_0x1ac1f8['model']=_[_0x87de('0x3c')](_0x5e543a,_0x87de('0x34'));_0x1ac1f8[_0x87de('0x3d')]=_[_0x87de('0x3e')](_0x5dd8ec['query']);_0x1ac1f8[_0x87de('0x3f')]=_[_0x87de('0x40')](_0x1ac1f8[_0x87de('0x41')],_0x1ac1f8[_0x87de('0x3d')]);_0x154bb9[_0x87de('0x42')]=_[_0x87de('0x40')](_0x1ac1f8[_0x87de('0x41')],qs[_0x87de('0x43')](_0x5dd8ec[_0x87de('0x3d')][_0x87de('0x43')]));_0x154bb9['attributes']=_0x154bb9['attributes'][_0x87de('0x44')]?_0x154bb9[_0x87de('0x42')]:_0x1ac1f8[_0x87de('0x41')];if(!_0x5dd8ec[_0x87de('0x3d')][_0x87de('0x45')]('nolimit')){_0x154bb9[_0x87de('0x46')]=qs['limit'](_0x5dd8ec[_0x87de('0x3d')][_0x87de('0x46')]);_0x154bb9[_0x87de('0x2e')]=qs['offset'](_0x5dd8ec[_0x87de('0x3d')][_0x87de('0x2e')]);}_0x154bb9[_0x87de('0x47')]=qs[_0x87de('0x48')](_0x5dd8ec['query'][_0x87de('0x48')]);_0x154bb9[_0x87de('0x49')]=qs[_0x87de('0x3f')](_[_0x87de('0x4a')](_0x5dd8ec[_0x87de('0x3d')],_0x1ac1f8['filters']));if(_0x5dd8ec[_0x87de('0x3d')][_0x87de('0x4b')]){_0x154bb9['where']=_[_0x87de('0x4c')](_0x154bb9[_0x87de('0x49')],{'$or':_[_0x87de('0x3c')](_0x5e543a,function(_0x19d047){if(_0x19d047[_0x87de('0x3a')]!==_0x87de('0x4d')){var _0x3f38f7={};_0x3f38f7[_0x19d047[_0x87de('0x34')]]={'$like':'%'+_0x5dd8ec['query'][_0x87de('0x4b')]+'%'};return _0x3f38f7;}})});}_0x154bb9=_[_0x87de('0x4c')]({},_0x154bb9,_0x5dd8ec[_0x87de('0x4e')]);var _0x4f1725={'where':_0x154bb9[_0x87de('0x49')]};return db[_0x87de('0x37')][_0x87de('0x2d')](_0x4f1725)[_0x87de('0x1e')](function(_0x3e090c){_0x281894[_0x87de('0x2d')]=_0x3e090c;if(_0x5dd8ec[_0x87de('0x3d')][_0x87de('0x4f')]){_0x154bb9['include']=[{'all':!![]}];}return db[_0x87de('0x37')][_0x87de('0x50')](_0x154bb9);})[_0x87de('0x1e')](function(_0x506b7b){_0x281894[_0x87de('0x51')]=_0x506b7b;return _0x281894;})[_0x87de('0x1e')](respondWithFilteredResult(_0x4605a5,_0x154bb9))[_0x87de('0x29')](handleError(_0x4605a5,null));};exports[_0x87de('0x52')]=function(_0x10a22a,_0x54df69){var _0x828d69={'raw':![],'where':{'id':_0x10a22a['params']['id']}},_0x54378e={};_0x54378e[_0x87de('0x41')]=_[_0x87de('0x3e')](db[_0x87de('0x37')][_0x87de('0x38')]);_0x54378e[_0x87de('0x3d')]=_['keys'](_0x10a22a['query']);_0x54378e['filters']=_[_0x87de('0x40')](_0x54378e[_0x87de('0x41')],_0x54378e[_0x87de('0x3d')]);_0x828d69[_0x87de('0x42')]=_['intersection'](_0x54378e[_0x87de('0x41')],qs[_0x87de('0x43')](_0x10a22a['query'][_0x87de('0x43')]));_0x828d69['attributes']=_0x828d69[_0x87de('0x42')][_0x87de('0x44')]?_0x828d69[_0x87de('0x42')]:_0x54378e[_0x87de('0x41')];if(_0x10a22a[_0x87de('0x3d')]['includeAll']){_0x828d69['include']=[{'all':!![]}];}_0x828d69=_[_0x87de('0x4c')]({},_0x828d69,_0x10a22a[_0x87de('0x4e')]);return db[_0x87de('0x37')][_0x87de('0x53')](_0x828d69)[_0x87de('0x1e')](handleEntityNotFound(_0x54df69,null))[_0x87de('0x1e')](respondWithResult(_0x54df69,null))['catch'](handleError(_0x54df69,null));};exports[_0x87de('0x54')]=function(_0x58291b,_0x444023){return db[_0x87de('0x37')]['create'](_0x58291b[_0x87de('0x55')],{})[_0x87de('0x1e')](respondWithResult(_0x444023,0xc9))[_0x87de('0x29')](handleError(_0x444023,null));};exports['update']=function(_0x5cdf52,_0x18ccf4){if(_0x5cdf52[_0x87de('0x55')]['id']){delete _0x5cdf52[_0x87de('0x55')]['id'];}return db[_0x87de('0x37')][_0x87de('0x53')]({'where':{'id':_0x5cdf52[_0x87de('0x56')]['id']}})[_0x87de('0x1e')](handleEntityNotFound(_0x18ccf4,null))[_0x87de('0x1e')](saveUpdates(_0x5cdf52['body'],null))[_0x87de('0x1e')](respondWithResult(_0x18ccf4,null))[_0x87de('0x29')](handleError(_0x18ccf4,null));};exports[_0x87de('0x31')]=function(_0xada699,_0x9621b6){return db['ServicenowConfiguration'][_0x87de('0x53')]({'where':{'id':_0xada699[_0x87de('0x56')]['id']}})['then'](handleEntityNotFound(_0x9621b6,null))['then'](removeEntity(_0x9621b6,null))[_0x87de('0x29')](handleError(_0x9621b6,null));};exports[_0x87de('0x57')]=function(_0x510735,_0x232a7b,_0x2f37f5){var _0x26352d={};var _0x3dbbbe={};var _0x1e5380;var _0x396b17;return db[_0x87de('0x37')][_0x87de('0x58')]({'where':{'id':_0x510735[_0x87de('0x56')]['id']}})['then'](handleEntityNotFound(_0x232a7b,null))['then'](function(_0x1c2582){if(_0x1c2582){_0x1e5380=_0x1c2582;_0x3dbbbe['model']=_[_0x87de('0x3e')](db['ServicenowField'][_0x87de('0x38')]);_0x3dbbbe[_0x87de('0x3d')]=_[_0x87de('0x3e')](_0x510735[_0x87de('0x3d')]);_0x3dbbbe[_0x87de('0x3f')]=_[_0x87de('0x40')](_0x3dbbbe[_0x87de('0x41')],_0x3dbbbe['query']);_0x26352d[_0x87de('0x42')]=_[_0x87de('0x40')](_0x3dbbbe[_0x87de('0x41')],qs[_0x87de('0x43')](_0x510735['query']['fields']));_0x26352d[_0x87de('0x42')]=_0x26352d[_0x87de('0x42')][_0x87de('0x44')]?_0x26352d['attributes']:_0x3dbbbe[_0x87de('0x41')];_0x26352d['order']=qs[_0x87de('0x48')](_0x510735[_0x87de('0x3d')][_0x87de('0x48')]);_0x26352d[_0x87de('0x49')]=qs['filters'](_[_0x87de('0x4a')](_0x510735[_0x87de('0x3d')],_0x3dbbbe['filters']));if(_0x510735[_0x87de('0x3d')][_0x87de('0x4b')]){_0x26352d['where']=_[_0x87de('0x4c')](_0x26352d[_0x87de('0x49')],{'$or':_[_0x87de('0x3c')](_0x26352d[_0x87de('0x42')],function(_0x11ebf8){var _0x4ac519={};_0x4ac519[_0x11ebf8]={'$like':'%'+_0x510735[_0x87de('0x3d')]['filter']+'%'};return _0x4ac519;})});}_0x26352d=_[_0x87de('0x4c')]({},_0x26352d,_0x510735[_0x87de('0x4e')]);return _0x1e5380['getFields'](_0x26352d);}})['then'](function(_0x33c676){if(_0x33c676){_0x396b17=_0x33c676[_0x87de('0x44')];if(!_0x510735[_0x87de('0x3d')][_0x87de('0x45')](_0x87de('0x59'))){_0x26352d[_0x87de('0x46')]=qs[_0x87de('0x46')](_0x510735[_0x87de('0x3d')][_0x87de('0x46')]);_0x26352d['offset']=qs[_0x87de('0x2e')](_0x510735['query'][_0x87de('0x2e')]);}return _0x1e5380[_0x87de('0x57')](_0x26352d);}})[_0x87de('0x1e')](function(_0x575ff6){if(_0x575ff6){return _0x575ff6?{'count':_0x396b17,'rows':_0x575ff6}:null;}})['then'](respondWithResult(_0x232a7b,null))[_0x87de('0x29')](handleError(_0x232a7b,null));};exports[_0x87de('0x5a')]=function(_0x50c23f,_0x288196,_0x2aab5e){var _0x2a6f3f={};var _0x1b53ac={};var _0x3e21f6;var _0x158dea;return db['ServicenowConfiguration'][_0x87de('0x58')]({'where':{'id':_0x50c23f['params']['id']}})['then'](handleEntityNotFound(_0x288196,null))[_0x87de('0x1e')](function(_0x1561c6){if(_0x1561c6){_0x3e21f6=_0x1561c6;_0x1b53ac['model']=_[_0x87de('0x3e')](db[_0x87de('0x5b')][_0x87de('0x38')]);_0x1b53ac[_0x87de('0x3d')]=_[_0x87de('0x3e')](_0x50c23f[_0x87de('0x3d')]);_0x1b53ac[_0x87de('0x3f')]=_[_0x87de('0x40')](_0x1b53ac[_0x87de('0x41')],_0x1b53ac[_0x87de('0x3d')]);_0x2a6f3f[_0x87de('0x42')]=_['intersection'](_0x1b53ac[_0x87de('0x41')],qs[_0x87de('0x43')](_0x50c23f[_0x87de('0x3d')][_0x87de('0x43')]));_0x2a6f3f[_0x87de('0x42')]=_0x2a6f3f[_0x87de('0x42')][_0x87de('0x44')]?_0x2a6f3f['attributes']:_0x1b53ac[_0x87de('0x41')];_0x2a6f3f[_0x87de('0x47')]=qs[_0x87de('0x48')](_0x50c23f[_0x87de('0x3d')][_0x87de('0x48')]);_0x2a6f3f[_0x87de('0x49')]=qs[_0x87de('0x3f')](_[_0x87de('0x4a')](_0x50c23f[_0x87de('0x3d')],_0x1b53ac[_0x87de('0x3f')]));if(_0x50c23f[_0x87de('0x3d')][_0x87de('0x4b')]){_0x2a6f3f['where']=_['merge'](_0x2a6f3f['where'],{'$or':_[_0x87de('0x3c')](_0x2a6f3f['attributes'],function(_0x284f4c){var _0x47816f={};_0x47816f[_0x284f4c]={'$like':'%'+_0x50c23f[_0x87de('0x3d')][_0x87de('0x4b')]+'%'};return _0x47816f;})});}_0x2a6f3f=_['merge']({},_0x2a6f3f,_0x50c23f['options']);return _0x3e21f6['getSubjects'](_0x2a6f3f);}})['then'](function(_0x453ad1){if(_0x453ad1){_0x158dea=_0x453ad1[_0x87de('0x44')];if(!_0x50c23f['query'][_0x87de('0x45')](_0x87de('0x59'))){_0x2a6f3f[_0x87de('0x46')]=qs['limit'](_0x50c23f[_0x87de('0x3d')][_0x87de('0x46')]);_0x2a6f3f['offset']=qs[_0x87de('0x2e')](_0x50c23f['query'][_0x87de('0x2e')]);}return _0x3e21f6[_0x87de('0x5a')](_0x2a6f3f);}})['then'](function(_0x2baa80){if(_0x2baa80){return _0x2baa80?{'count':_0x158dea,'rows':_0x2baa80}:null;}})['then'](respondWithResult(_0x288196,null))['catch'](handleError(_0x288196,null));};exports[_0x87de('0x5c')]=function(_0x3ab173,_0x4f9d89,_0x5e9b71){var _0x4dfda5={};var _0x6775ed={};var _0x5bc7ff;var _0x15c843;return db[_0x87de('0x37')][_0x87de('0x58')]({'where':{'id':_0x3ab173[_0x87de('0x56')]['id']}})[_0x87de('0x1e')](handleEntityNotFound(_0x4f9d89,null))[_0x87de('0x1e')](function(_0x484806){if(_0x484806){_0x5bc7ff=_0x484806;_0x6775ed[_0x87de('0x41')]=_[_0x87de('0x3e')](db[_0x87de('0x5b')][_0x87de('0x38')]);_0x6775ed['query']=_[_0x87de('0x3e')](_0x3ab173[_0x87de('0x3d')]);_0x6775ed[_0x87de('0x3f')]=_[_0x87de('0x40')](_0x6775ed[_0x87de('0x41')],_0x6775ed[_0x87de('0x3d')]);_0x4dfda5[_0x87de('0x42')]=_[_0x87de('0x40')](_0x6775ed[_0x87de('0x41')],qs[_0x87de('0x43')](_0x3ab173['query'][_0x87de('0x43')]));_0x4dfda5[_0x87de('0x42')]=_0x4dfda5[_0x87de('0x42')]['length']?_0x4dfda5['attributes']:_0x6775ed['model'];_0x4dfda5[_0x87de('0x47')]=qs['sort'](_0x3ab173['query'][_0x87de('0x48')]);_0x4dfda5[_0x87de('0x49')]=qs[_0x87de('0x3f')](_[_0x87de('0x4a')](_0x3ab173[_0x87de('0x3d')],_0x6775ed['filters']));if(_0x3ab173['query'][_0x87de('0x4b')]){_0x4dfda5[_0x87de('0x49')]=_[_0x87de('0x4c')](_0x4dfda5[_0x87de('0x49')],{'$or':_[_0x87de('0x3c')](_0x4dfda5['attributes'],function(_0x55f10c){var _0x511a24={};_0x511a24[_0x55f10c]={'$like':'%'+_0x3ab173['query']['filter']+'%'};return _0x511a24;})});}_0x4dfda5=_[_0x87de('0x4c')]({},_0x4dfda5,_0x3ab173[_0x87de('0x4e')]);return _0x5bc7ff['getDescriptions'](_0x4dfda5);}})[_0x87de('0x1e')](function(_0x27e025){if(_0x27e025){_0x15c843=_0x27e025[_0x87de('0x44')];if(!_0x3ab173['query'][_0x87de('0x45')](_0x87de('0x59'))){_0x4dfda5[_0x87de('0x46')]=qs['limit'](_0x3ab173[_0x87de('0x3d')][_0x87de('0x46')]);_0x4dfda5[_0x87de('0x2e')]=qs[_0x87de('0x2e')](_0x3ab173[_0x87de('0x3d')]['offset']);}return _0x5bc7ff[_0x87de('0x5c')](_0x4dfda5);}})[_0x87de('0x1e')](function(_0x1906d6){if(_0x1906d6){return _0x1906d6?{'count':_0x15c843,'rows':_0x1906d6}:null;}})[_0x87de('0x1e')](respondWithResult(_0x4f9d89,null))[_0x87de('0x29')](handleError(_0x4f9d89,null));}; \ No newline at end of file +var _0x4f25=['model','query','filters','attributes','intersection','fields','length','hasOwnProperty','sort','pick','filter','where','merge','type','options','includeAll','include','findAll','show','params','keys','find','create','body','getFields','findOne','ServicenowField','order','nolimit','getSubjects','getDescriptions','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','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','jayson/promise','client','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','ServicenowConfiguration,\x20%s,\x20%s','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','destroy','stack','name','send','index','map','ServicenowConfiguration','rawAttributes','fieldName','key'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x4f25,0x1a7));var _0x54f2=function(_0xbb9dbf,_0x5dafa4){_0xbb9dbf=_0xbb9dbf-0x0;var _0x30223c=_0x4f25[_0xbb9dbf];return _0x30223c;};'use strict';var pdf=require(_0x54f2('0x0'));var emlformat=require(_0x54f2('0x1'));var rimraf=require(_0x54f2('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x54f2('0x3'));var rp=require(_0x54f2('0x4'));var moment=require(_0x54f2('0x5'));var BPromise=require(_0x54f2('0x6'));var Mustache=require('mustache');var util=require(_0x54f2('0x7'));var path=require(_0x54f2('0x8'));var sox=require(_0x54f2('0x9'));var csv=require(_0x54f2('0xa'));var ejs=require(_0x54f2('0xb'));var fs=require('fs');var _=require(_0x54f2('0xc'));var squel=require(_0x54f2('0xd'));var crypto=require(_0x54f2('0xe'));var jsforce=require(_0x54f2('0xf'));var deskjs=require(_0x54f2('0x10'));var toCsv=require(_0x54f2('0xa'));var querystring=require(_0x54f2('0x11'));var Papa=require(_0x54f2('0x12'));var Redis=require(_0x54f2('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x54f2('0x14'));var as=require(_0x54f2('0x15'));var hardwareService=require(_0x54f2('0x16'));var logger=require(_0x54f2('0x17'))(_0x54f2('0x18'));var utils=require(_0x54f2('0x19'));var config=require(_0x54f2('0x1a'));var db=require('../../mysqldb')['db'];var jayson=require(_0x54f2('0x1b'));var client=jayson[_0x54f2('0x1c')]['http']({'port':0x232a});function checkPasswordPattern(_0x810704,_0x4a941b,_0x2151b1){if(_0x2151b1){var _0x245aec=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x245aec[_0x54f2('0x1d')](_0x4a941b)){return _0x810704;}else{throw new db[(_0x54f2('0x1e'))][(_0x54f2('0x1f'))](_0x54f2('0x20'));}}else{return _0x810704;}}function respondWithRpcPromise(_0x261d9e,_0x6d6642,_0x26b75e,_0x2ffb37){return new BPromise(function(_0x1517c2,_0x5300c8){var _0x15b322=_0x2ffb37||client;return _0x15b322[_0x54f2('0x21')](_0x261d9e,_0x26b75e)[_0x54f2('0x22')](function(_0x18dcc7){logger[_0x54f2('0x23')](_0x54f2('0x24'),_0x6d6642,'request\x20sent');logger[_0x54f2('0x25')](_0x54f2('0x26'),_0x6d6642,'request\x20sent',JSON[_0x54f2('0x27')](_0x18dcc7));if(_0x18dcc7['error']){if(_0x18dcc7[_0x54f2('0x28')][_0x54f2('0x29')]===0x1f4){logger[_0x54f2('0x28')]('ServicenowConfiguration,\x20%s,\x20%s',_0x6d6642,_0x18dcc7[_0x54f2('0x28')][_0x54f2('0x2a')]);return _0x5300c8(_0x18dcc7[_0x54f2('0x28')][_0x54f2('0x2a')]);}logger['error'](_0x54f2('0x24'),_0x6d6642,_0x18dcc7[_0x54f2('0x28')][_0x54f2('0x2a')]);return _0x1517c2(_0x18dcc7[_0x54f2('0x28')][_0x54f2('0x2a')]);}else{logger[_0x54f2('0x23')](_0x54f2('0x24'),_0x6d6642,_0x54f2('0x2b'));_0x1517c2(_0x18dcc7['result'][_0x54f2('0x2a')]);}})[_0x54f2('0x2c')](function(_0x8b0493){logger[_0x54f2('0x28')](_0x54f2('0x24'),_0x6d6642,_0x8b0493);_0x5300c8(_0x8b0493);});});}function respondWithStatusCode(_0x1e45e4,_0x5cfdbf){_0x5cfdbf=_0x5cfdbf||0xcc;return function(_0x380cd9){if(_0x380cd9){return _0x1e45e4[_0x54f2('0x2d')](_0x5cfdbf);}return _0x1e45e4[_0x54f2('0x2e')](_0x5cfdbf)[_0x54f2('0x2f')]();};}function respondWithResult(_0x3fc0b1,_0x2dff17){_0x2dff17=_0x2dff17||0xc8;return function(_0x139b7e){if(_0x139b7e){return _0x3fc0b1[_0x54f2('0x2e')](_0x2dff17)[_0x54f2('0x30')](_0x139b7e);}};}function respondWithFilteredResult(_0x4dde96,_0x3fcce7){return function(_0x23e8e2){if(_0x23e8e2){var _0x561a1d=_0x23e8e2[_0x54f2('0x31')],_0x4d9ffa=_0x3fcce7[_0x54f2('0x32')],_0x548923=_0x3fcce7[_0x54f2('0x32')]+_0x3fcce7[_0x54f2('0x33')],_0x5eacfe;if(_0x548923>=_0x561a1d){_0x548923=_0x561a1d;_0x5eacfe=0xc8;}else{_0x5eacfe=0xce;}_0x4dde96[_0x54f2('0x2e')](_0x5eacfe);return _0x4dde96[_0x54f2('0x34')](_0x54f2('0x35'),_0x4d9ffa+'-'+_0x548923+'/'+_0x561a1d)['json'](_0x23e8e2);}return null;};}function patchUpdates(_0x1178d1){return function(_0x521fc2){try{jsonpatch['apply'](_0x521fc2,_0x1178d1,!![]);}catch(_0x38d206){return BPromise[_0x54f2('0x36')](_0x38d206);}return _0x521fc2[_0x54f2('0x37')]();};}function saveUpdates(_0x3a1b2e,_0x358910){return function(_0xa4195c){if(_0xa4195c){return _0xa4195c[_0x54f2('0x38')](_0x3a1b2e)[_0x54f2('0x22')](function(_0x47b244){return _0x47b244;});}return null;};}function removeEntity(_0x26d7a6,_0x4b51be){return function(_0x3d5d62){if(_0x3d5d62){return _0x3d5d62[_0x54f2('0x39')]()['then'](function(){_0x26d7a6['status'](0xcc)[_0x54f2('0x2f')]();});}};}function handleEntityNotFound(_0x161e2c,_0x59df36){return function(_0x49f168){if(!_0x49f168){_0x161e2c[_0x54f2('0x2d')](0x194);}return _0x49f168;};}function handleError(_0x73bf37,_0x20b70d){_0x20b70d=_0x20b70d||0x1f4;return function(_0x25340e){logger[_0x54f2('0x28')](_0x25340e[_0x54f2('0x3a')]);if(_0x25340e[_0x54f2('0x3b')]){delete _0x25340e[_0x54f2('0x3b')];}_0x73bf37[_0x54f2('0x2e')](_0x20b70d)[_0x54f2('0x3c')](_0x25340e);};}exports[_0x54f2('0x3d')]=function(_0x455865,_0x199f04){var _0x554471={},_0x599d48={},_0x162972={'count':0x0,'rows':[]};var _0x5e3001=_[_0x54f2('0x3e')](db[_0x54f2('0x3f')][_0x54f2('0x40')],function(_0x4ed808){return{'name':_0x4ed808[_0x54f2('0x41')],'type':_0x4ed808['type'][_0x54f2('0x42')]};});_0x599d48[_0x54f2('0x43')]=_['map'](_0x5e3001,_0x54f2('0x3b'));_0x599d48['query']=_['keys'](_0x455865[_0x54f2('0x44')]);_0x599d48[_0x54f2('0x45')]=_['intersection'](_0x599d48[_0x54f2('0x43')],_0x599d48[_0x54f2('0x44')]);_0x554471[_0x54f2('0x46')]=_[_0x54f2('0x47')](_0x599d48['model'],qs[_0x54f2('0x48')](_0x455865['query'][_0x54f2('0x48')]));_0x554471[_0x54f2('0x46')]=_0x554471[_0x54f2('0x46')][_0x54f2('0x49')]?_0x554471['attributes']:_0x599d48[_0x54f2('0x43')];if(!_0x455865[_0x54f2('0x44')][_0x54f2('0x4a')]('nolimit')){_0x554471[_0x54f2('0x33')]=qs[_0x54f2('0x33')](_0x455865['query']['limit']);_0x554471['offset']=qs['offset'](_0x455865[_0x54f2('0x44')][_0x54f2('0x32')]);}_0x554471['order']=qs['sort'](_0x455865[_0x54f2('0x44')][_0x54f2('0x4b')]);_0x554471['where']=qs[_0x54f2('0x45')](_[_0x54f2('0x4c')](_0x455865[_0x54f2('0x44')],_0x599d48[_0x54f2('0x45')]));if(_0x455865['query'][_0x54f2('0x4d')]){_0x554471[_0x54f2('0x4e')]=_[_0x54f2('0x4f')](_0x554471['where'],{'$or':_[_0x54f2('0x3e')](_0x5e3001,function(_0x5d0c1b){if(_0x5d0c1b[_0x54f2('0x50')]!=='VIRTUAL'){var _0x100d94={};_0x100d94[_0x5d0c1b[_0x54f2('0x3b')]]={'$like':'%'+_0x455865[_0x54f2('0x44')]['filter']+'%'};return _0x100d94;}})});}_0x554471=_[_0x54f2('0x4f')]({},_0x554471,_0x455865[_0x54f2('0x51')]);var _0x44d79d={'where':_0x554471['where']};return db['ServicenowConfiguration']['count'](_0x44d79d)['then'](function(_0x138aac){_0x162972[_0x54f2('0x31')]=_0x138aac;if(_0x455865[_0x54f2('0x44')][_0x54f2('0x52')]){_0x554471[_0x54f2('0x53')]=[{'all':!![]}];}return db['ServicenowConfiguration'][_0x54f2('0x54')](_0x554471);})[_0x54f2('0x22')](function(_0x490e54){_0x162972['rows']=_0x490e54;return _0x162972;})[_0x54f2('0x22')](respondWithFilteredResult(_0x199f04,_0x554471))['catch'](handleError(_0x199f04,null));};exports[_0x54f2('0x55')]=function(_0x594905,_0x4a18cc){var _0x1da14b={'raw':![],'where':{'id':_0x594905[_0x54f2('0x56')]['id']}},_0x34b404={};_0x34b404[_0x54f2('0x43')]=_['keys'](db[_0x54f2('0x3f')][_0x54f2('0x40')]);_0x34b404[_0x54f2('0x44')]=_[_0x54f2('0x57')](_0x594905['query']);_0x34b404[_0x54f2('0x45')]=_[_0x54f2('0x47')](_0x34b404['model'],_0x34b404[_0x54f2('0x44')]);_0x1da14b[_0x54f2('0x46')]=_['intersection'](_0x34b404[_0x54f2('0x43')],qs[_0x54f2('0x48')](_0x594905['query']['fields']));_0x1da14b[_0x54f2('0x46')]=_0x1da14b['attributes'][_0x54f2('0x49')]?_0x1da14b['attributes']:_0x34b404[_0x54f2('0x43')];if(_0x594905[_0x54f2('0x44')][_0x54f2('0x52')]){_0x1da14b[_0x54f2('0x53')]=[{'all':!![]}];}_0x1da14b=_[_0x54f2('0x4f')]({},_0x1da14b,_0x594905[_0x54f2('0x51')]);return db[_0x54f2('0x3f')][_0x54f2('0x58')](_0x1da14b)[_0x54f2('0x22')](handleEntityNotFound(_0x4a18cc,null))['then'](respondWithResult(_0x4a18cc,null))['catch'](handleError(_0x4a18cc,null));};exports[_0x54f2('0x59')]=function(_0x1d45fb,_0x4c6197){return db[_0x54f2('0x3f')][_0x54f2('0x59')](_0x1d45fb['body'],{})['then'](respondWithResult(_0x4c6197,0xc9))[_0x54f2('0x2c')](handleError(_0x4c6197,null));};exports['update']=function(_0x363928,_0x506bd9){if(_0x363928['body']['id']){delete _0x363928[_0x54f2('0x5a')]['id'];}return db[_0x54f2('0x3f')][_0x54f2('0x58')]({'where':{'id':_0x363928[_0x54f2('0x56')]['id']}})[_0x54f2('0x22')](handleEntityNotFound(_0x506bd9,null))[_0x54f2('0x22')](saveUpdates(_0x363928[_0x54f2('0x5a')],null))['then'](respondWithResult(_0x506bd9,null))['catch'](handleError(_0x506bd9,null));};exports['destroy']=function(_0x33ec10,_0x329381){return db[_0x54f2('0x3f')][_0x54f2('0x58')]({'where':{'id':_0x33ec10['params']['id']}})[_0x54f2('0x22')](handleEntityNotFound(_0x329381,null))[_0x54f2('0x22')](removeEntity(_0x329381,null))[_0x54f2('0x2c')](handleError(_0x329381,null));};exports[_0x54f2('0x5b')]=function(_0x2e059e,_0x3cc0be,_0x4918a4){var _0x1e733c={};var _0x5e3d6b={};var _0x30e690;var _0xfa0add;return db[_0x54f2('0x3f')][_0x54f2('0x5c')]({'where':{'id':_0x2e059e[_0x54f2('0x56')]['id']}})[_0x54f2('0x22')](handleEntityNotFound(_0x3cc0be,null))[_0x54f2('0x22')](function(_0x477353){if(_0x477353){_0x30e690=_0x477353;_0x5e3d6b['model']=_[_0x54f2('0x57')](db[_0x54f2('0x5d')][_0x54f2('0x40')]);_0x5e3d6b[_0x54f2('0x44')]=_['keys'](_0x2e059e[_0x54f2('0x44')]);_0x5e3d6b['filters']=_[_0x54f2('0x47')](_0x5e3d6b['model'],_0x5e3d6b[_0x54f2('0x44')]);_0x1e733c[_0x54f2('0x46')]=_[_0x54f2('0x47')](_0x5e3d6b[_0x54f2('0x43')],qs['fields'](_0x2e059e[_0x54f2('0x44')]['fields']));_0x1e733c[_0x54f2('0x46')]=_0x1e733c[_0x54f2('0x46')][_0x54f2('0x49')]?_0x1e733c[_0x54f2('0x46')]:_0x5e3d6b[_0x54f2('0x43')];_0x1e733c[_0x54f2('0x5e')]=qs['sort'](_0x2e059e[_0x54f2('0x44')][_0x54f2('0x4b')]);_0x1e733c[_0x54f2('0x4e')]=qs['filters'](_[_0x54f2('0x4c')](_0x2e059e[_0x54f2('0x44')],_0x5e3d6b[_0x54f2('0x45')]));if(_0x2e059e[_0x54f2('0x44')][_0x54f2('0x4d')]){_0x1e733c['where']=_['merge'](_0x1e733c[_0x54f2('0x4e')],{'$or':_[_0x54f2('0x3e')](_0x1e733c['attributes'],function(_0x152019){var _0x44d641={};_0x44d641[_0x152019]={'$like':'%'+_0x2e059e[_0x54f2('0x44')][_0x54f2('0x4d')]+'%'};return _0x44d641;})});}_0x1e733c=_['merge']({},_0x1e733c,_0x2e059e[_0x54f2('0x51')]);return _0x30e690[_0x54f2('0x5b')](_0x1e733c);}})[_0x54f2('0x22')](function(_0x4ca292){if(_0x4ca292){_0xfa0add=_0x4ca292[_0x54f2('0x49')];if(!_0x2e059e[_0x54f2('0x44')][_0x54f2('0x4a')]('nolimit')){_0x1e733c[_0x54f2('0x33')]=qs[_0x54f2('0x33')](_0x2e059e[_0x54f2('0x44')][_0x54f2('0x33')]);_0x1e733c[_0x54f2('0x32')]=qs[_0x54f2('0x32')](_0x2e059e[_0x54f2('0x44')][_0x54f2('0x32')]);}return _0x30e690['getFields'](_0x1e733c);}})[_0x54f2('0x22')](function(_0x8255fc){if(_0x8255fc){return _0x8255fc?{'count':_0xfa0add,'rows':_0x8255fc}:null;}})['then'](respondWithResult(_0x3cc0be,null))['catch'](handleError(_0x3cc0be,null));};exports['getSubjects']=function(_0x243d6e,_0x1c9388,_0x2129c9){var _0x43089e={};var _0x1a5abe={};var _0xb36aad;var _0x5e119d;return db[_0x54f2('0x3f')][_0x54f2('0x5c')]({'where':{'id':_0x243d6e[_0x54f2('0x56')]['id']}})['then'](handleEntityNotFound(_0x1c9388,null))[_0x54f2('0x22')](function(_0x37bda2){if(_0x37bda2){_0xb36aad=_0x37bda2;_0x1a5abe['model']=_['keys'](db[_0x54f2('0x5d')][_0x54f2('0x40')]);_0x1a5abe[_0x54f2('0x44')]=_[_0x54f2('0x57')](_0x243d6e['query']);_0x1a5abe[_0x54f2('0x45')]=_[_0x54f2('0x47')](_0x1a5abe[_0x54f2('0x43')],_0x1a5abe[_0x54f2('0x44')]);_0x43089e[_0x54f2('0x46')]=_[_0x54f2('0x47')](_0x1a5abe[_0x54f2('0x43')],qs['fields'](_0x243d6e[_0x54f2('0x44')][_0x54f2('0x48')]));_0x43089e['attributes']=_0x43089e[_0x54f2('0x46')][_0x54f2('0x49')]?_0x43089e[_0x54f2('0x46')]:_0x1a5abe[_0x54f2('0x43')];_0x43089e['order']=qs['sort'](_0x243d6e['query'][_0x54f2('0x4b')]);_0x43089e[_0x54f2('0x4e')]=qs[_0x54f2('0x45')](_['pick'](_0x243d6e['query'],_0x1a5abe[_0x54f2('0x45')]));if(_0x243d6e[_0x54f2('0x44')][_0x54f2('0x4d')]){_0x43089e[_0x54f2('0x4e')]=_[_0x54f2('0x4f')](_0x43089e['where'],{'$or':_[_0x54f2('0x3e')](_0x43089e[_0x54f2('0x46')],function(_0x4cc4c){var _0x379c7e={};_0x379c7e[_0x4cc4c]={'$like':'%'+_0x243d6e['query'][_0x54f2('0x4d')]+'%'};return _0x379c7e;})});}_0x43089e=_['merge']({},_0x43089e,_0x243d6e[_0x54f2('0x51')]);return _0xb36aad['getSubjects'](_0x43089e);}})[_0x54f2('0x22')](function(_0x1dfa2c){if(_0x1dfa2c){_0x5e119d=_0x1dfa2c[_0x54f2('0x49')];if(!_0x243d6e[_0x54f2('0x44')]['hasOwnProperty'](_0x54f2('0x5f'))){_0x43089e[_0x54f2('0x33')]=qs['limit'](_0x243d6e['query'][_0x54f2('0x33')]);_0x43089e[_0x54f2('0x32')]=qs[_0x54f2('0x32')](_0x243d6e[_0x54f2('0x44')][_0x54f2('0x32')]);}return _0xb36aad[_0x54f2('0x60')](_0x43089e);}})['then'](function(_0x411364){if(_0x411364){return _0x411364?{'count':_0x5e119d,'rows':_0x411364}:null;}})[_0x54f2('0x22')](respondWithResult(_0x1c9388,null))[_0x54f2('0x2c')](handleError(_0x1c9388,null));};exports[_0x54f2('0x61')]=function(_0x3215bf,_0x33975e,_0x402416){var _0x280d8b={};var _0x431e80={};var _0x3d6be8;var _0x1d2ecd;return db[_0x54f2('0x3f')][_0x54f2('0x5c')]({'where':{'id':_0x3215bf[_0x54f2('0x56')]['id']}})[_0x54f2('0x22')](handleEntityNotFound(_0x33975e,null))[_0x54f2('0x22')](function(_0x106bdb){if(_0x106bdb){_0x3d6be8=_0x106bdb;_0x431e80[_0x54f2('0x43')]=_[_0x54f2('0x57')](db['ServicenowField'][_0x54f2('0x40')]);_0x431e80[_0x54f2('0x44')]=_[_0x54f2('0x57')](_0x3215bf[_0x54f2('0x44')]);_0x431e80[_0x54f2('0x45')]=_['intersection'](_0x431e80['model'],_0x431e80[_0x54f2('0x44')]);_0x280d8b['attributes']=_[_0x54f2('0x47')](_0x431e80[_0x54f2('0x43')],qs['fields'](_0x3215bf[_0x54f2('0x44')]['fields']));_0x280d8b[_0x54f2('0x46')]=_0x280d8b[_0x54f2('0x46')][_0x54f2('0x49')]?_0x280d8b[_0x54f2('0x46')]:_0x431e80['model'];_0x280d8b[_0x54f2('0x5e')]=qs[_0x54f2('0x4b')](_0x3215bf['query']['sort']);_0x280d8b[_0x54f2('0x4e')]=qs[_0x54f2('0x45')](_[_0x54f2('0x4c')](_0x3215bf['query'],_0x431e80['filters']));if(_0x3215bf[_0x54f2('0x44')]['filter']){_0x280d8b['where']=_[_0x54f2('0x4f')](_0x280d8b['where'],{'$or':_[_0x54f2('0x3e')](_0x280d8b[_0x54f2('0x46')],function(_0x29178d){var _0x57840b={};_0x57840b[_0x29178d]={'$like':'%'+_0x3215bf[_0x54f2('0x44')]['filter']+'%'};return _0x57840b;})});}_0x280d8b=_['merge']({},_0x280d8b,_0x3215bf['options']);return _0x3d6be8[_0x54f2('0x61')](_0x280d8b);}})[_0x54f2('0x22')](function(_0x4b6067){if(_0x4b6067){_0x1d2ecd=_0x4b6067[_0x54f2('0x49')];if(!_0x3215bf[_0x54f2('0x44')]['hasOwnProperty'](_0x54f2('0x5f'))){_0x280d8b['limit']=qs[_0x54f2('0x33')](_0x3215bf['query'][_0x54f2('0x33')]);_0x280d8b[_0x54f2('0x32')]=qs[_0x54f2('0x32')](_0x3215bf['query'][_0x54f2('0x32')]);}return _0x3d6be8['getDescriptions'](_0x280d8b);}})[_0x54f2('0x22')](function(_0xb1c828){if(_0xb1c828){return _0xb1c828?{'count':_0x1d2ecd,'rows':_0xb1c828}:null;}})[_0x54f2('0x22')](respondWithResult(_0x33975e,null))[_0x54f2('0x2c')](handleError(_0x33975e,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index 1b2665e..42020fc 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 _0xc4bf=['exports','ServicenowConfiguration','lodash','util','api','request-promise','path','rimraf','../../config/environment','./intServicenowConfiguration.attributes'];(function(_0x1547fb,_0x26c693){var _0x502071=function(_0x24dcd6){while(--_0x24dcd6){_0x1547fb['push'](_0x1547fb['shift']());}};_0x502071(++_0x26c693);}(_0xc4bf,0xb6));var _0xfc4b=function(_0x2b12f7,_0x4033ac){_0x2b12f7=_0x2b12f7-0x0;var _0x8cb277=_0xc4bf[_0x2b12f7];return _0x8cb277;};'use strict';var _=require(_0xfc4b('0x0'));var util=require(_0xfc4b('0x1'));var logger=require('../../config/logger')(_0xfc4b('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xfc4b('0x3'));var fs=require('fs');var path=require(_0xfc4b('0x4'));var rimraf=require(_0xfc4b('0x5'));var config=require(_0xfc4b('0x6'));var attributes=require(_0xfc4b('0x7'));module[_0xfc4b('0x8')]=function(_0x5dd48b,_0x3f3c5d){return _0x5dd48b['define'](_0xfc4b('0x9'),attributes,{'tableName':'int_servicenow_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdeb4=['./intServicenowConfiguration.attributes','exports','define','ServicenowConfiguration','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xdeb4,0xd0));var _0x4deb=function(_0x2f67e1,_0x18dda9){_0x2f67e1=_0x2f67e1-0x0;var _0xe88a36=_0xdeb4[_0x2f67e1];return _0xe88a36;};'use strict';var _=require(_0x4deb('0x0'));var util=require(_0x4deb('0x1'));var logger=require(_0x4deb('0x2'))(_0x4deb('0x3'));var moment=require(_0x4deb('0x4'));var BPromise=require(_0x4deb('0x5'));var rp=require(_0x4deb('0x6'));var fs=require('fs');var path=require(_0x4deb('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x4deb('0x8'));module[_0x4deb('0x9')]=function(_0x182198,_0x54223f){return _0x182198[_0x4deb('0xa')](_0x4deb('0xb'),attributes,{'tableName':'int_servicenow_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js index 917d3cd..9554ab9 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 _0xb4f5=['../../config/environment','jayson/promise','client','http','info','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','ServicenowConfiguration,\x20%s,\x20%s','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','rpc'];(function(_0x3a0100,_0x212268){var _0x548171=function(_0x2a490d){while(--_0x2a490d){_0x3a0100['push'](_0x3a0100['shift']());}};_0x548171(++_0x212268);}(_0xb4f5,0x1b2));var _0x5b4f=function(_0x5e7e1a,_0x38a7c6){_0x5e7e1a=_0x5e7e1a-0x0;var _0x46b94f=_0xb4f5[_0x5e7e1a];return _0x46b94f;};'use strict';var _=require(_0x5b4f('0x0'));var util=require(_0x5b4f('0x1'));var moment=require(_0x5b4f('0x2'));var BPromise=require('bluebird');var rs=require(_0x5b4f('0x3'));var fs=require('fs');var Redis=require(_0x5b4f('0x4'));var db=require(_0x5b4f('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x5b4f('0x6'));var config=require(_0x5b4f('0x7'));var jayson=require(_0x5b4f('0x8'));var client=jayson[_0x5b4f('0x9')][_0x5b4f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x156399,_0x17935f,_0x5870d3){return new BPromise(function(_0x46a51a,_0x429cb8){return client['request'](_0x156399,_0x5870d3)['then'](function(_0x5b58de){logger[_0x5b4f('0xb')]('ServicenowConfiguration,\x20%s,\x20%s',_0x17935f,'request\x20sent');logger[_0x5b4f('0xc')](_0x5b4f('0xd'),_0x17935f,_0x5b4f('0xe'),JSON[_0x5b4f('0xf')](_0x5b58de));if(_0x5b58de[_0x5b4f('0x10')]){if(_0x5b58de[_0x5b4f('0x10')]['code']===0x1f4){logger[_0x5b4f('0x10')]('ServicenowConfiguration,\x20%s,\x20%s',_0x17935f,_0x5b58de['error'][_0x5b4f('0x11')]);return _0x429cb8(_0x5b58de['error'][_0x5b4f('0x11')]);}logger[_0x5b4f('0x10')](_0x5b4f('0x12'),_0x17935f,_0x5b58de[_0x5b4f('0x10')][_0x5b4f('0x11')]);return _0x46a51a(_0x5b58de[_0x5b4f('0x10')]['message']);}else{logger[_0x5b4f('0xb')]('ServicenowConfiguration,\x20%s,\x20%s',_0x17935f,_0x5b4f('0xe'));_0x46a51a(_0x5b58de[_0x5b4f('0x13')][_0x5b4f('0x11')]);}})[_0x5b4f('0x14')](function(_0x1af19f){logger[_0x5b4f('0x10')](_0x5b4f('0x12'),_0x17935f,_0x1af19f);_0x429cb8(_0x1af19f);});});} \ No newline at end of file +var _0x4356=['../../config/utils','../../config/logger','rpc','jayson/promise','client','http','info','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','ServicenowConfiguration,\x20%s,\x20%s','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x5d04ee,_0x2a38ca){var _0x4a666a=function(_0x1883e4){while(--_0x1883e4){_0x5d04ee['push'](_0x5d04ee['shift']());}};_0x4a666a(++_0x2a38ca);}(_0x4356,0x8d));var _0x6435=function(_0x5c52ca,_0x5a3e19){_0x5c52ca=_0x5c52ca-0x0;var _0x164c4e=_0x4356[_0x5c52ca];return _0x164c4e;};'use strict';var _=require(_0x6435('0x0'));var util=require('util');var moment=require(_0x6435('0x1'));var BPromise=require(_0x6435('0x2'));var rs=require(_0x6435('0x3'));var fs=require('fs');var Redis=require(_0x6435('0x4'));var db=require(_0x6435('0x5'))['db'];var utils=require(_0x6435('0x6'));var logger=require(_0x6435('0x7'))(_0x6435('0x8'));var config=require('../../config/environment');var jayson=require(_0x6435('0x9'));var client=jayson[_0x6435('0xa')][_0x6435('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x13449b,_0x2fa06c,_0x561d30){return new BPromise(function(_0x4736c4,_0x598309){return client['request'](_0x13449b,_0x561d30)['then'](function(_0x450c70){logger[_0x6435('0xc')]('ServicenowConfiguration,\x20%s,\x20%s',_0x2fa06c,_0x6435('0xd'));logger[_0x6435('0xe')](_0x6435('0xf'),_0x2fa06c,_0x6435('0xd'),JSON['stringify'](_0x450c70));if(_0x450c70[_0x6435('0x10')]){if(_0x450c70['error'][_0x6435('0x11')]===0x1f4){logger[_0x6435('0x10')]('ServicenowConfiguration,\x20%s,\x20%s',_0x2fa06c,_0x450c70[_0x6435('0x10')]['message']);return _0x598309(_0x450c70[_0x6435('0x10')][_0x6435('0x12')]);}logger['error']('ServicenowConfiguration,\x20%s,\x20%s',_0x2fa06c,_0x450c70[_0x6435('0x10')]['message']);return _0x4736c4(_0x450c70[_0x6435('0x10')][_0x6435('0x12')]);}else{logger['info']('ServicenowConfiguration,\x20%s,\x20%s',_0x2fa06c,'request\x20sent');_0x4736c4(_0x450c70[_0x6435('0x13')][_0x6435('0x12')]);}})['catch'](function(_0x23ed63){logger[_0x6435('0x10')](_0x6435('0x14'),_0x2fa06c,_0x23ed63);_0x598309(_0x23ed63);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 95b5514..6f9dedf 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 _0xd286=['multer','connect-timeout','../../components/auth/service','../../config/environment','isAuthenticated','get','/:id','show','create','put','update','destroy','exports'];(function(_0x25afa9,_0x28840b){var _0xe03c4c=function(_0xff0a21){while(--_0xff0a21){_0x25afa9['push'](_0x25afa9['shift']());}};_0xe03c4c(++_0x28840b);}(_0xd286,0x179));var _0x6d28=function(_0x2732cc,_0x3704f2){_0x2732cc=_0x2732cc-0x0;var _0xaf082f=_0xd286[_0x2732cc];return _0xaf082f;};'use strict';var multer=require(_0x6d28('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x6d28('0x1'));var express=require('express');var router=express['Router']();var auth=require(_0x6d28('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0x6d28('0x3'));var controller=require('./intServicenowField.controller');router['get']('/',auth[_0x6d28('0x4')](),controller['index']);router[_0x6d28('0x5')](_0x6d28('0x6'),auth[_0x6d28('0x4')](),controller[_0x6d28('0x7')]);router['post']('/',auth[_0x6d28('0x4')](),controller[_0x6d28('0x8')]);router[_0x6d28('0x9')](_0x6d28('0x6'),auth[_0x6d28('0x4')](),controller[_0x6d28('0xa')]);router['delete']('/:id',auth[_0x6d28('0x4')](),controller[_0x6d28('0xb')]);module[_0x6d28('0xc')]=router; \ No newline at end of file +var _0xf9ed=['path','connect-timeout','express','Router','../../components/auth/service','./intServicenowField.controller','get','isAuthenticated','index','/:id','show','update','delete','exports','multer'];(function(_0x1819d0,_0x1891b4){var _0x2a596a=function(_0x3bfcdd){while(--_0x3bfcdd){_0x1819d0['push'](_0x1819d0['shift']());}};_0x2a596a(++_0x1891b4);}(_0xf9ed,0x158));var _0xdf9e=function(_0x2070da,_0x45e586){_0x2070da=_0x2070da-0x0;var _0x4f9fe1=_0xf9ed[_0x2070da];return _0x4f9fe1;};'use strict';var multer=require(_0xdf9e('0x0'));var util=require('util');var path=require(_0xdf9e('0x1'));var timeout=require(_0xdf9e('0x2'));var express=require(_0xdf9e('0x3'));var router=express[_0xdf9e('0x4')]();var auth=require(_0xdf9e('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xdf9e('0x6'));router[_0xdf9e('0x7')]('/',auth[_0xdf9e('0x8')](),controller[_0xdf9e('0x9')]);router[_0xdf9e('0x7')](_0xdf9e('0xa'),auth[_0xdf9e('0x8')](),controller[_0xdf9e('0xb')]);router['post']('/',auth[_0xdf9e('0x8')](),controller['create']);router['put'](_0xdf9e('0xa'),auth[_0xdf9e('0x8')](),controller[_0xdf9e('0xc')]);router[_0xdf9e('0xd')](_0xdf9e('0xa'),auth[_0xdf9e('0x8')](),controller['destroy']);module[_0xdf9e('0xe')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index 11664fa..ff01b34 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 _0x4d7e=['keyValue','string','STRING','ENUM','exports','variable','customVariable'];(function(_0x1b93f6,_0x5c8aec){var _0x23f1c=function(_0x560baf){while(--_0x560baf){_0x1b93f6['push'](_0x1b93f6['shift']());}};_0x23f1c(++_0x5c8aec);}(_0x4d7e,0xba));var _0xe4d7=function(_0x3b4b79,_0x395e10){_0x3b4b79=_0x3b4b79-0x0;var _0x5d48b9=_0x4d7e[_0x3b4b79];return _0x5d48b9;};'use strict';var Sequelize=require('sequelize');module[_0xe4d7('0x0')]={'type':{'type':Sequelize['ENUM']('string',_0xe4d7('0x1'),_0xe4d7('0x2'),_0xe4d7('0x3')),'defaultValue':_0xe4d7('0x4')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xe4d7('0x5')]},'keyType':{'type':Sequelize[_0xe4d7('0x6')](_0xe4d7('0x4'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0xe4d7('0x5')]},'idField':{'type':Sequelize[_0xe4d7('0x5')]},'nameField':{'type':Sequelize[_0xe4d7('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xe4d7('0x5')]}}; \ No newline at end of file +var _0xaec9=['STRING','BOOLEAN','exports','ENUM','string','variable','customVariable','keyValue'];(function(_0x50234e,_0x1ad0be){var _0x2de3db=function(_0x5e74ce){while(--_0x5e74ce){_0x50234e['push'](_0x50234e['shift']());}};_0x2de3db(++_0x1ad0be);}(_0xaec9,0x112));var _0x9aec=function(_0x3ef45e,_0xe84f33){_0x3ef45e=_0x3ef45e-0x0;var _0x69e7c=_0xaec9[_0x3ef45e];return _0x69e7c;};'use strict';var Sequelize=require('sequelize');module[_0x9aec('0x0')]={'type':{'type':Sequelize[_0x9aec('0x1')](_0x9aec('0x2'),_0x9aec('0x3'),_0x9aec('0x4'),_0x9aec('0x5')),'defaultValue':_0x9aec('0x2')},'content':{'type':Sequelize[_0x9aec('0x6')]},'key':{'type':Sequelize[_0x9aec('0x6')]},'keyType':{'type':Sequelize[_0x9aec('0x1')](_0x9aec('0x2'),_0x9aec('0x3'),_0x9aec('0x4'))},'keyContent':{'type':Sequelize[_0x9aec('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x9aec('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index a288d76..9a7e798 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 _0x97e4=['moment','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../mysqldb','status','end','json','count','offset','limit','set','apply','update','then','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','intersection','length','attributes','hasOwnProperty','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','ServicenowField','includeAll','include','findAll','rows','catch','params','fields','find','body','html-pdf','eml-format','zip-dir','fast-json-patch'];(function(_0x26e127,_0x354e00){var _0x3503a9=function(_0x4484c9){while(--_0x4484c9){_0x26e127['push'](_0x26e127['shift']());}};_0x3503a9(++_0x354e00);}(_0x97e4,0x155));var _0x497e=function(_0x3f5522,_0x28e324){_0x3f5522=_0x3f5522-0x0;var _0x4731f1=_0x97e4[_0x3f5522];return _0x4731f1;};'use strict';var pdf=require(_0x497e('0x0'));var emlformat=require(_0x497e('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x497e('0x2'));var jsonpatch=require(_0x497e('0x3'));var rp=require('request-promise');var moment=require(_0x497e('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x497e('0x5'));var util=require(_0x497e('0x6'));var path=require(_0x497e('0x7'));var sox=require(_0x497e('0x8'));var csv=require(_0x497e('0x9'));var ejs=require(_0x497e('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x497e('0xb'));var crypto=require(_0x497e('0xc'));var jsforce=require(_0x497e('0xd'));var deskjs=require(_0x497e('0xe'));var toCsv=require(_0x497e('0x9'));var querystring=require(_0x497e('0xf'));var Papa=require(_0x497e('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x497e('0x11'));var as=require(_0x497e('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x497e('0x13'))('api');var utils=require(_0x497e('0x14'));var config=require('../../config/environment');var db=require(_0x497e('0x15'))['db'];function respondWithStatusCode(_0x53f755,_0xf0cef5){_0xf0cef5=_0xf0cef5||0xcc;return function(_0x216ba1){if(_0x216ba1){return _0x53f755['sendStatus'](_0xf0cef5);}return _0x53f755[_0x497e('0x16')](_0xf0cef5)[_0x497e('0x17')]();};}function respondWithResult(_0x3d310,_0x43502b){_0x43502b=_0x43502b||0xc8;return function(_0x22aa26){if(_0x22aa26){return _0x3d310['status'](_0x43502b)[_0x497e('0x18')](_0x22aa26);}};}function respondWithFilteredResult(_0xe72277,_0x4a3442){return function(_0x2bd5d5){if(_0x2bd5d5){var _0x919e66=_0x2bd5d5[_0x497e('0x19')],_0x530fa8=_0x4a3442[_0x497e('0x1a')],_0x401846=_0x4a3442['offset']+_0x4a3442[_0x497e('0x1b')],_0x591091;if(_0x401846>=_0x919e66){_0x401846=_0x919e66;_0x591091=0xc8;}else{_0x591091=0xce;}_0xe72277[_0x497e('0x16')](_0x591091);return _0xe72277[_0x497e('0x1c')]('Content-Range',_0x530fa8+'-'+_0x401846+'/'+_0x919e66)[_0x497e('0x18')](_0x2bd5d5);}return null;};}function patchUpdates(_0x3d0ff3){return function(_0x220b0e){try{jsonpatch[_0x497e('0x1d')](_0x220b0e,_0x3d0ff3,!![]);}catch(_0x58cd0d){return BPromise['reject'](_0x58cd0d);}return _0x220b0e['save']();};}function saveUpdates(_0x1829a3,_0x2a3799){return function(_0x463817){if(_0x463817){return _0x463817[_0x497e('0x1e')](_0x1829a3)[_0x497e('0x1f')](function(_0x41ce7b){return _0x41ce7b;});}return null;};}function removeEntity(_0x29f7e8,_0x2134a1){return function(_0x5418a2){if(_0x5418a2){return _0x5418a2['destroy']()[_0x497e('0x1f')](function(){_0x29f7e8[_0x497e('0x16')](0xcc)[_0x497e('0x17')]();});}};}function handleEntityNotFound(_0x29d06c,_0x495e31){return function(_0x5ca479){if(!_0x5ca479){_0x29d06c[_0x497e('0x20')](0x194);}return _0x5ca479;};}function handleError(_0xa90d47,_0x50f1e2){_0x50f1e2=_0x50f1e2||0x1f4;return function(_0x391290){logger[_0x497e('0x21')](_0x391290[_0x497e('0x22')]);if(_0x391290[_0x497e('0x23')]){delete _0x391290['name'];}_0xa90d47[_0x497e('0x16')](_0x50f1e2)[_0x497e('0x24')](_0x391290);};}exports[_0x497e('0x25')]=function(_0x419462,_0x447a9f){var _0x7d5ca1={},_0x309c54={},_0x4ec387={'count':0x0,'rows':[]};var _0x11c0c7=_[_0x497e('0x26')](db['ServicenowField'][_0x497e('0x27')],function(_0x58985b){return{'name':_0x58985b[_0x497e('0x28')],'type':_0x58985b[_0x497e('0x29')][_0x497e('0x2a')]};});_0x309c54[_0x497e('0x2b')]=_[_0x497e('0x26')](_0x11c0c7,_0x497e('0x23'));_0x309c54['query']=_[_0x497e('0x2c')](_0x419462[_0x497e('0x2d')]);_0x309c54['filters']=_[_0x497e('0x2e')](_0x309c54['model'],_0x309c54[_0x497e('0x2d')]);_0x7d5ca1['attributes']=_[_0x497e('0x2e')](_0x309c54[_0x497e('0x2b')],qs['fields'](_0x419462[_0x497e('0x2d')]['fields']));_0x7d5ca1['attributes']=_0x7d5ca1['attributes'][_0x497e('0x2f')]?_0x7d5ca1[_0x497e('0x30')]:_0x309c54[_0x497e('0x2b')];if(!_0x419462[_0x497e('0x2d')][_0x497e('0x31')]('nolimit')){_0x7d5ca1[_0x497e('0x1b')]=qs[_0x497e('0x1b')](_0x419462[_0x497e('0x2d')][_0x497e('0x1b')]);_0x7d5ca1['offset']=qs[_0x497e('0x1a')](_0x419462[_0x497e('0x2d')][_0x497e('0x1a')]);}_0x7d5ca1[_0x497e('0x32')]=qs['sort'](_0x419462[_0x497e('0x2d')][_0x497e('0x33')]);_0x7d5ca1[_0x497e('0x34')]=qs[_0x497e('0x35')](_[_0x497e('0x36')](_0x419462[_0x497e('0x2d')],_0x309c54[_0x497e('0x35')]));if(_0x419462[_0x497e('0x2d')][_0x497e('0x37')]){_0x7d5ca1[_0x497e('0x34')]=_['merge'](_0x7d5ca1['where'],{'$or':_[_0x497e('0x26')](_0x11c0c7,function(_0xc3c29c){if(_0xc3c29c[_0x497e('0x29')]!==_0x497e('0x38')){var _0x2c80f5={};_0x2c80f5[_0xc3c29c[_0x497e('0x23')]]={'$like':'%'+_0x419462[_0x497e('0x2d')]['filter']+'%'};return _0x2c80f5;}})});}_0x7d5ca1=_[_0x497e('0x39')]({},_0x7d5ca1,_0x419462[_0x497e('0x3a')]);var _0x56e189={'where':_0x7d5ca1[_0x497e('0x34')]};return db[_0x497e('0x3b')][_0x497e('0x19')](_0x56e189)[_0x497e('0x1f')](function(_0x251fef){_0x4ec387[_0x497e('0x19')]=_0x251fef;if(_0x419462[_0x497e('0x2d')][_0x497e('0x3c')]){_0x7d5ca1[_0x497e('0x3d')]=[{'all':!![]}];}return db[_0x497e('0x3b')][_0x497e('0x3e')](_0x7d5ca1);})['then'](function(_0x467ca5){_0x4ec387[_0x497e('0x3f')]=_0x467ca5;return _0x4ec387;})['then'](respondWithFilteredResult(_0x447a9f,_0x7d5ca1))[_0x497e('0x40')](handleError(_0x447a9f,null));};exports['show']=function(_0x2dc3ac,_0x121215){var _0x5c86f6={'raw':!![],'where':{'id':_0x2dc3ac[_0x497e('0x41')]['id']}},_0x5e7a98={};_0x5e7a98[_0x497e('0x2b')]=_['keys'](db['ServicenowField'][_0x497e('0x27')]);_0x5e7a98[_0x497e('0x2d')]=_['keys'](_0x2dc3ac[_0x497e('0x2d')]);_0x5e7a98['filters']=_[_0x497e('0x2e')](_0x5e7a98[_0x497e('0x2b')],_0x5e7a98[_0x497e('0x2d')]);_0x5c86f6['attributes']=_[_0x497e('0x2e')](_0x5e7a98[_0x497e('0x2b')],qs[_0x497e('0x42')](_0x2dc3ac[_0x497e('0x2d')][_0x497e('0x42')]));_0x5c86f6[_0x497e('0x30')]=_0x5c86f6[_0x497e('0x30')][_0x497e('0x2f')]?_0x5c86f6[_0x497e('0x30')]:_0x5e7a98['model'];if(_0x2dc3ac[_0x497e('0x2d')][_0x497e('0x3c')]){_0x5c86f6[_0x497e('0x3d')]=[{'all':!![]}];}_0x5c86f6=_[_0x497e('0x39')]({},_0x5c86f6,_0x2dc3ac[_0x497e('0x3a')]);return db[_0x497e('0x3b')][_0x497e('0x43')](_0x5c86f6)['then'](handleEntityNotFound(_0x121215,null))[_0x497e('0x1f')](respondWithResult(_0x121215,null))['catch'](handleError(_0x121215,null));};exports['create']=function(_0x9110d9,_0x322e5a){return db[_0x497e('0x3b')]['create'](_0x9110d9['body'],{})[_0x497e('0x1f')](respondWithResult(_0x322e5a,0xc9))['catch'](handleError(_0x322e5a,null));};exports[_0x497e('0x1e')]=function(_0x3d9449,_0x23ff7b){if(_0x3d9449[_0x497e('0x44')]['id']){delete _0x3d9449[_0x497e('0x44')]['id'];}return db[_0x497e('0x3b')]['find']({'where':{'id':_0x3d9449[_0x497e('0x41')]['id']}})[_0x497e('0x1f')](handleEntityNotFound(_0x23ff7b,null))['then'](saveUpdates(_0x3d9449[_0x497e('0x44')],null))[_0x497e('0x1f')](respondWithResult(_0x23ff7b,null))[_0x497e('0x40')](handleError(_0x23ff7b,null));};exports['destroy']=function(_0x53b503,_0x15f612){return db['ServicenowField'][_0x497e('0x43')]({'where':{'id':_0x53b503[_0x497e('0x41')]['id']}})[_0x497e('0x1f')](handleEntityNotFound(_0x15f612,null))['then'](removeEntity(_0x15f612,null))[_0x497e('0x40')](handleError(_0x15f612,null));}; \ No newline at end of file +var _0x00ef=['where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','html-pdf','eml-format','rimraf','request-promise','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','Content-Range','apply','reject','update','destroy','then','stack','name','send','index','map','ServicenowField','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x00ef,0x1ba));var _0xf00e=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x00ef[_0x1cc8fe];return _0x230054;};'use strict';var pdf=require(_0xf00e('0x0'));var emlformat=require(_0xf00e('0x1'));var rimraf=require(_0xf00e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xf00e('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xf00e('0x4'));var util=require(_0xf00e('0x5'));var path=require(_0xf00e('0x6'));var sox=require(_0xf00e('0x7'));var csv=require(_0xf00e('0x8'));var ejs=require(_0xf00e('0x9'));var fs=require('fs');var _=require(_0xf00e('0xa'));var squel=require(_0xf00e('0xb'));var crypto=require(_0xf00e('0xc'));var jsforce=require(_0xf00e('0xd'));var deskjs=require(_0xf00e('0xe'));var toCsv=require(_0xf00e('0x8'));var querystring=require(_0xf00e('0xf'));var Papa=require(_0xf00e('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xf00e('0x11'));var hardwareService=require(_0xf00e('0x12'));var logger=require('../../config/logger')(_0xf00e('0x13'));var utils=require(_0xf00e('0x14'));var config=require(_0xf00e('0x15'));var db=require(_0xf00e('0x16'))['db'];function respondWithStatusCode(_0x3a4284,_0x2b15e6){_0x2b15e6=_0x2b15e6||0xcc;return function(_0x4e08c6){if(_0x4e08c6){return _0x3a4284['sendStatus'](_0x2b15e6);}return _0x3a4284[_0xf00e('0x17')](_0x2b15e6)[_0xf00e('0x18')]();};}function respondWithResult(_0x463556,_0x4e852e){_0x4e852e=_0x4e852e||0xc8;return function(_0x6aeeb3){if(_0x6aeeb3){return _0x463556[_0xf00e('0x17')](_0x4e852e)[_0xf00e('0x19')](_0x6aeeb3);}};}function respondWithFilteredResult(_0x251669,_0x1847a4){return function(_0x26cd34){if(_0x26cd34){var _0x320bd4=_0x26cd34[_0xf00e('0x1a')],_0x4e5531=_0x1847a4['offset'],_0x5e2f18=_0x1847a4[_0xf00e('0x1b')]+_0x1847a4[_0xf00e('0x1c')],_0x46ae17;if(_0x5e2f18>=_0x320bd4){_0x5e2f18=_0x320bd4;_0x46ae17=0xc8;}else{_0x46ae17=0xce;}_0x251669[_0xf00e('0x17')](_0x46ae17);return _0x251669['set'](_0xf00e('0x1d'),_0x4e5531+'-'+_0x5e2f18+'/'+_0x320bd4)['json'](_0x26cd34);}return null;};}function patchUpdates(_0x57a32a){return function(_0x618c95){try{jsonpatch[_0xf00e('0x1e')](_0x618c95,_0x57a32a,!![]);}catch(_0x267057){return BPromise[_0xf00e('0x1f')](_0x267057);}return _0x618c95['save']();};}function saveUpdates(_0x5d9ba3,_0x3151ea){return function(_0x4327f){if(_0x4327f){return _0x4327f[_0xf00e('0x20')](_0x5d9ba3)['then'](function(_0x10b9d8){return _0x10b9d8;});}return null;};}function removeEntity(_0x3b1178,_0x15fc08){return function(_0x6f8650){if(_0x6f8650){return _0x6f8650[_0xf00e('0x21')]()[_0xf00e('0x22')](function(){_0x3b1178['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3ee32b,_0x6657f3){return function(_0x518f4d){if(!_0x518f4d){_0x3ee32b['sendStatus'](0x194);}return _0x518f4d;};}function handleError(_0x38e517,_0x51c5e2){_0x51c5e2=_0x51c5e2||0x1f4;return function(_0x48c466){logger['error'](_0x48c466[_0xf00e('0x23')]);if(_0x48c466[_0xf00e('0x24')]){delete _0x48c466[_0xf00e('0x24')];}_0x38e517['status'](_0x51c5e2)[_0xf00e('0x25')](_0x48c466);};}exports[_0xf00e('0x26')]=function(_0x5152f5,_0x5b8ac1){var _0x2b3c9f={},_0x110d7a={},_0x17b0db={'count':0x0,'rows':[]};var _0x1ccd84=_[_0xf00e('0x27')](db[_0xf00e('0x28')][_0xf00e('0x29')],function(_0x341c1a){return{'name':_0x341c1a['fieldName'],'type':_0x341c1a[_0xf00e('0x2a')][_0xf00e('0x2b')]};});_0x110d7a[_0xf00e('0x2c')]=_[_0xf00e('0x27')](_0x1ccd84,_0xf00e('0x24'));_0x110d7a[_0xf00e('0x2d')]=_[_0xf00e('0x2e')](_0x5152f5[_0xf00e('0x2d')]);_0x110d7a[_0xf00e('0x2f')]=_[_0xf00e('0x30')](_0x110d7a[_0xf00e('0x2c')],_0x110d7a[_0xf00e('0x2d')]);_0x2b3c9f[_0xf00e('0x31')]=_['intersection'](_0x110d7a[_0xf00e('0x2c')],qs['fields'](_0x5152f5[_0xf00e('0x2d')][_0xf00e('0x32')]));_0x2b3c9f[_0xf00e('0x31')]=_0x2b3c9f[_0xf00e('0x31')][_0xf00e('0x33')]?_0x2b3c9f['attributes']:_0x110d7a['model'];if(!_0x5152f5[_0xf00e('0x2d')]['hasOwnProperty'](_0xf00e('0x34'))){_0x2b3c9f['limit']=qs[_0xf00e('0x1c')](_0x5152f5[_0xf00e('0x2d')][_0xf00e('0x1c')]);_0x2b3c9f[_0xf00e('0x1b')]=qs[_0xf00e('0x1b')](_0x5152f5[_0xf00e('0x2d')]['offset']);}_0x2b3c9f[_0xf00e('0x35')]=qs[_0xf00e('0x36')](_0x5152f5['query'][_0xf00e('0x36')]);_0x2b3c9f[_0xf00e('0x37')]=qs[_0xf00e('0x2f')](_[_0xf00e('0x38')](_0x5152f5[_0xf00e('0x2d')],_0x110d7a[_0xf00e('0x2f')]));if(_0x5152f5['query'][_0xf00e('0x39')]){_0x2b3c9f['where']=_[_0xf00e('0x3a')](_0x2b3c9f[_0xf00e('0x37')],{'$or':_[_0xf00e('0x27')](_0x1ccd84,function(_0x87b16d){if(_0x87b16d[_0xf00e('0x2a')]!==_0xf00e('0x3b')){var _0x5efb1c={};_0x5efb1c[_0x87b16d['name']]={'$like':'%'+_0x5152f5[_0xf00e('0x2d')]['filter']+'%'};return _0x5efb1c;}})});}_0x2b3c9f=_[_0xf00e('0x3a')]({},_0x2b3c9f,_0x5152f5[_0xf00e('0x3c')]);var _0x5cd79a={'where':_0x2b3c9f['where']};return db['ServicenowField'][_0xf00e('0x1a')](_0x5cd79a)[_0xf00e('0x22')](function(_0x2c0e71){_0x17b0db[_0xf00e('0x1a')]=_0x2c0e71;if(_0x5152f5[_0xf00e('0x2d')][_0xf00e('0x3d')]){_0x2b3c9f[_0xf00e('0x3e')]=[{'all':!![]}];}return db[_0xf00e('0x28')][_0xf00e('0x3f')](_0x2b3c9f);})[_0xf00e('0x22')](function(_0x3ffead){_0x17b0db[_0xf00e('0x40')]=_0x3ffead;return _0x17b0db;})[_0xf00e('0x22')](respondWithFilteredResult(_0x5b8ac1,_0x2b3c9f))[_0xf00e('0x41')](handleError(_0x5b8ac1,null));};exports[_0xf00e('0x42')]=function(_0x5212f9,_0x36cc44){var _0x2cd559={'raw':!![],'where':{'id':_0x5212f9[_0xf00e('0x43')]['id']}},_0x57860a={};_0x57860a['model']=_['keys'](db['ServicenowField'][_0xf00e('0x29')]);_0x57860a[_0xf00e('0x2d')]=_['keys'](_0x5212f9[_0xf00e('0x2d')]);_0x57860a['filters']=_['intersection'](_0x57860a['model'],_0x57860a['query']);_0x2cd559[_0xf00e('0x31')]=_[_0xf00e('0x30')](_0x57860a['model'],qs['fields'](_0x5212f9[_0xf00e('0x2d')]['fields']));_0x2cd559[_0xf00e('0x31')]=_0x2cd559['attributes'][_0xf00e('0x33')]?_0x2cd559[_0xf00e('0x31')]:_0x57860a[_0xf00e('0x2c')];if(_0x5212f9[_0xf00e('0x2d')][_0xf00e('0x3d')]){_0x2cd559[_0xf00e('0x3e')]=[{'all':!![]}];}_0x2cd559=_[_0xf00e('0x3a')]({},_0x2cd559,_0x5212f9[_0xf00e('0x3c')]);return db[_0xf00e('0x28')][_0xf00e('0x44')](_0x2cd559)[_0xf00e('0x22')](handleEntityNotFound(_0x36cc44,null))[_0xf00e('0x22')](respondWithResult(_0x36cc44,null))[_0xf00e('0x41')](handleError(_0x36cc44,null));};exports['create']=function(_0x883feb,_0x209941){return db[_0xf00e('0x28')][_0xf00e('0x45')](_0x883feb[_0xf00e('0x46')],{})[_0xf00e('0x22')](respondWithResult(_0x209941,0xc9))['catch'](handleError(_0x209941,null));};exports['update']=function(_0x5b8eba,_0x37aeb1){if(_0x5b8eba['body']['id']){delete _0x5b8eba[_0xf00e('0x46')]['id'];}return db[_0xf00e('0x28')][_0xf00e('0x44')]({'where':{'id':_0x5b8eba[_0xf00e('0x43')]['id']}})[_0xf00e('0x22')](handleEntityNotFound(_0x37aeb1,null))['then'](saveUpdates(_0x5b8eba['body'],null))[_0xf00e('0x22')](respondWithResult(_0x37aeb1,null))[_0xf00e('0x41')](handleError(_0x37aeb1,null));};exports[_0xf00e('0x21')]=function(_0x29c78a,_0x5ba654){return db[_0xf00e('0x28')][_0xf00e('0x44')]({'where':{'id':_0x29c78a[_0xf00e('0x43')]['id']}})['then'](handleEntityNotFound(_0x5ba654,null))[_0xf00e('0x22')](removeEntity(_0x5ba654,null))[_0xf00e('0x41')](handleError(_0x5ba654,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 72833b8..c180c39 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 _0xa98d=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowField.attributes','exports','define','int_servicenow_fields','servicenow_unique_index','idField','lodash'];(function(_0x38441d,_0x12e5f5){var _0x23c0a0=function(_0xa360c8){while(--_0xa360c8){_0x38441d['push'](_0x38441d['shift']());}};_0x23c0a0(++_0x12e5f5);}(_0xa98d,0x1c1));var _0xda98=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xa98d[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0xda98('0x0'));var util=require(_0xda98('0x1'));var logger=require(_0xda98('0x2'))(_0xda98('0x3'));var moment=require('moment');var BPromise=require(_0xda98('0x4'));var rp=require(_0xda98('0x5'));var fs=require('fs');var path=require(_0xda98('0x6'));var rimraf=require(_0xda98('0x7'));var config=require(_0xda98('0x8'));var attributes=require(_0xda98('0x9'));module[_0xda98('0xa')]=function(_0x256046,_0x5b6f8d){return _0x256046[_0xda98('0xb')]('ServicenowField',attributes,{'tableName':_0xda98('0xc'),'paranoid':![],'indexes':[{'name':_0xda98('0xd'),'fields':[_0xda98('0xe'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8ffc=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','ServicenowField','int_servicenow_fields','servicenow_unique_index','idField','lodash'];(function(_0x32f6fa,_0x49df3f){var _0x2582cc=function(_0x96a35e){while(--_0x96a35e){_0x32f6fa['push'](_0x32f6fa['shift']());}};_0x2582cc(++_0x49df3f);}(_0x8ffc,0x158));var _0xc8ff=function(_0x5c2a2b,_0x22c94e){_0x5c2a2b=_0x5c2a2b-0x0;var _0x19921f=_0x8ffc[_0x5c2a2b];return _0x19921f;};'use strict';var _=require(_0xc8ff('0x0'));var util=require(_0xc8ff('0x1'));var logger=require(_0xc8ff('0x2'))('api');var moment=require(_0xc8ff('0x3'));var BPromise=require(_0xc8ff('0x4'));var rp=require(_0xc8ff('0x5'));var fs=require('fs');var path=require(_0xc8ff('0x6'));var rimraf=require(_0xc8ff('0x7'));var config=require(_0xc8ff('0x8'));var attributes=require('./intServicenowField.attributes');module[_0xc8ff('0x9')]=function(_0x1c0402,_0x98c2e8){return _0x1c0402[_0xc8ff('0xa')](_0xc8ff('0xb'),attributes,{'tableName':_0xc8ff('0xc'),'paranoid':![],'indexes':[{'name':_0xc8ff('0xd'),'fields':[_0xc8ff('0xe'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.rpc.js b/server/api/intServicenowField/intServicenowField.rpc.js index 852336d..7c4eb8c 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 _0xef40=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','lodash','util'];(function(_0x92ef22,_0x87c808){var _0x419f67=function(_0x12e531){while(--_0x12e531){_0x92ef22['push'](_0x92ef22['shift']());}};_0x419f67(++_0x87c808);}(_0xef40,0xa6));var _0x0ef4=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xef40[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0x0ef4('0x0'));var util=require(_0x0ef4('0x1'));var moment=require(_0x0ef4('0x2'));var BPromise=require('bluebird');var rs=require(_0x0ef4('0x3'));var fs=require('fs');var Redis=require(_0x0ef4('0x4'));var db=require(_0x0ef4('0x5'))['db'];var utils=require(_0x0ef4('0x6'));var logger=require(_0x0ef4('0x7'))(_0x0ef4('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0ef4('0x9')][_0x0ef4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xfab128,_0xff0b2e,_0x293a2a){return new BPromise(function(_0x26e683,_0x3b70c6){return client[_0x0ef4('0xb')](_0xfab128,_0x293a2a)[_0x0ef4('0xc')](function(_0x29da28){logger[_0x0ef4('0xd')](_0x0ef4('0xe'),_0xff0b2e,_0x0ef4('0xf'));logger[_0x0ef4('0x10')]('ServicenowField,\x20%s,\x20%s,\x20%s',_0xff0b2e,'request\x20sent',JSON[_0x0ef4('0x11')](_0x29da28));if(_0x29da28['error']){if(_0x29da28[_0x0ef4('0x12')]['code']===0x1f4){logger[_0x0ef4('0x12')](_0x0ef4('0xe'),_0xff0b2e,_0x29da28[_0x0ef4('0x12')][_0x0ef4('0x13')]);return _0x3b70c6(_0x29da28['error'][_0x0ef4('0x13')]);}logger['error']('ServicenowField,\x20%s,\x20%s',_0xff0b2e,_0x29da28[_0x0ef4('0x12')][_0x0ef4('0x13')]);return _0x26e683(_0x29da28[_0x0ef4('0x12')][_0x0ef4('0x13')]);}else{logger[_0x0ef4('0xd')](_0x0ef4('0xe'),_0xff0b2e,_0x0ef4('0xf'));_0x26e683(_0x29da28[_0x0ef4('0x14')]['message']);}})['catch'](function(_0x585c6f){logger['error'](_0x0ef4('0xe'),_0xff0b2e,_0x585c6f);_0x3b70c6(_0x585c6f);});});} \ No newline at end of file +var _0x422f=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','ServicenowField,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util'];(function(_0x18fe54,_0xff789){var _0xccb1ee=function(_0x513cf3){while(--_0x513cf3){_0x18fe54['push'](_0x18fe54['shift']());}};_0xccb1ee(++_0xff789);}(_0x422f,0x1cd));var _0xf422=function(_0x20b47d,_0x2b5e1f){_0x20b47d=_0x20b47d-0x0;var _0x58df38=_0x422f[_0x20b47d];return _0x58df38;};'use strict';var _=require('lodash');var util=require(_0xf422('0x0'));var moment=require(_0xf422('0x1'));var BPromise=require(_0xf422('0x2'));var rs=require(_0xf422('0x3'));var fs=require('fs');var Redis=require(_0xf422('0x4'));var db=require(_0xf422('0x5'))['db'];var utils=require(_0xf422('0x6'));var logger=require('../../config/logger')(_0xf422('0x7'));var config=require(_0xf422('0x8'));var jayson=require(_0xf422('0x9'));var client=jayson[_0xf422('0xa')][_0xf422('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4776de,_0x395f51,_0x49992e){return new BPromise(function(_0x37ae48,_0x3b1943){return client[_0xf422('0xc')](_0x4776de,_0x49992e)['then'](function(_0x300125){logger[_0xf422('0xd')](_0xf422('0xe'),_0x395f51,_0xf422('0xf'));logger['debug']('ServicenowField,\x20%s,\x20%s,\x20%s',_0x395f51,_0xf422('0xf'),JSON[_0xf422('0x10')](_0x300125));if(_0x300125[_0xf422('0x11')]){if(_0x300125[_0xf422('0x11')][_0xf422('0x12')]===0x1f4){logger[_0xf422('0x11')](_0xf422('0xe'),_0x395f51,_0x300125[_0xf422('0x11')][_0xf422('0x13')]);return _0x3b1943(_0x300125[_0xf422('0x11')][_0xf422('0x13')]);}logger['error']('ServicenowField,\x20%s,\x20%s',_0x395f51,_0x300125[_0xf422('0x11')][_0xf422('0x13')]);return _0x37ae48(_0x300125[_0xf422('0x11')][_0xf422('0x13')]);}else{logger[_0xf422('0xd')](_0xf422('0xe'),_0x395f51,'request\x20sent');_0x37ae48(_0x300125[_0xf422('0x14')][_0xf422('0x13')]);}})[_0xf422('0x15')](function(_0xca9de1){logger[_0xf422('0x11')](_0xf422('0xe'),_0x395f51,_0xca9de1);_0x3b1943(_0xca9de1);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index ab6533d..a3feede 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 _0x4e21=['path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','create','post','addConfiguration','delete','destroy','exports','util'];(function(_0x505f73,_0x1f95d8){var _0x227e7f=function(_0x112ae8){while(--_0x112ae8){_0x505f73['push'](_0x505f73['shift']());}};_0x227e7f(++_0x1f95d8);}(_0x4e21,0x92));var _0x14e2=function(_0x1abe50,_0x23e270){_0x1abe50=_0x1abe50-0x0;var _0x220a64=_0x4e21[_0x1abe50];return _0x220a64;};'use strict';var multer=require('multer');var util=require(_0x14e2('0x0'));var path=require(_0x14e2('0x1'));var timeout=require('connect-timeout');var express=require(_0x14e2('0x2'));var router=express[_0x14e2('0x3')]();var auth=require(_0x14e2('0x4'));var interaction=require(_0x14e2('0x5'));var config=require(_0x14e2('0x6'));var controller=require('./intSugarcrmAccount.controller');router[_0x14e2('0x7')]('/',auth[_0x14e2('0x8')](),controller[_0x14e2('0x9')]);router[_0x14e2('0x7')](_0x14e2('0xa'),auth[_0x14e2('0x8')](),controller[_0x14e2('0xb')]);router['get'](_0x14e2('0xc'),auth['isAuthenticated'](),controller[_0x14e2('0xd')]);router['get'](_0x14e2('0xe'),auth['isAuthenticated'](),controller['getFields']);router['post']('/',auth['isAuthenticated'](),controller[_0x14e2('0xf')]);router[_0x14e2('0x10')](_0x14e2('0xc'),auth['isAuthenticated'](),controller[_0x14e2('0x11')]);router['put'](_0x14e2('0xa'),auth[_0x14e2('0x8')](),controller['update']);router[_0x14e2('0x12')](_0x14e2('0xa'),auth[_0x14e2('0x8')](),controller[_0x14e2('0x13')]);module[_0x14e2('0x14')]=router; \ No newline at end of file +var _0xae5f=['show','/:id/fields','getFields','create','post','/:id/configurations','addConfiguration','put','update','delete','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmAccount.controller','get','isAuthenticated','index','/:id'];(function(_0x37049c,_0x121da2){var _0x35acb9=function(_0x38ac2d){while(--_0x38ac2d){_0x37049c['push'](_0x37049c['shift']());}};_0x35acb9(++_0x121da2);}(_0xae5f,0x12c));var _0xfae5=function(_0x1e0bb9,_0x3dd4c8){_0x1e0bb9=_0x1e0bb9-0x0;var _0x50eb3c=_0xae5f[_0x1e0bb9];return _0x50eb3c;};'use strict';var multer=require(_0xfae5('0x0'));var util=require(_0xfae5('0x1'));var path=require(_0xfae5('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xfae5('0x3')]();var auth=require(_0xfae5('0x4'));var interaction=require(_0xfae5('0x5'));var config=require(_0xfae5('0x6'));var controller=require(_0xfae5('0x7'));router[_0xfae5('0x8')]('/',auth[_0xfae5('0x9')](),controller[_0xfae5('0xa')]);router[_0xfae5('0x8')](_0xfae5('0xb'),auth[_0xfae5('0x9')](),controller[_0xfae5('0xc')]);router[_0xfae5('0x8')]('/:id/configurations',auth[_0xfae5('0x9')](),controller['getConfigurations']);router[_0xfae5('0x8')](_0xfae5('0xd'),auth[_0xfae5('0x9')](),controller[_0xfae5('0xe')]);router['post']('/',auth[_0xfae5('0x9')](),controller[_0xfae5('0xf')]);router[_0xfae5('0x10')](_0xfae5('0x11'),auth['isAuthenticated'](),controller[_0xfae5('0x12')]);router[_0xfae5('0x13')](_0xfae5('0xb'),auth[_0xfae5('0x9')](),controller[_0xfae5('0x14')]);router[_0xfae5('0x15')]('/:id',auth['isAuthenticated'](),controller[_0xfae5('0x16')]);module[_0xfae5('0x17')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index cb99249..1193210 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 _0xbb91=['remoteUri','sequelize','exports','STRING','username'];(function(_0x348d2e,_0x2b7b9b){var _0x143ca5=function(_0x287ae4){while(--_0x287ae4){_0x348d2e['push'](_0x348d2e['shift']());}};_0x143ca5(++_0x2b7b9b);}(_0xbb91,0xce));var _0x1bb9=function(_0x3e8930,_0x154364){_0x3e8930=_0x3e8930-0x0;var _0x15b38f=_0xbb91[_0x3e8930];return _0x15b38f;};'use strict';var Sequelize=require(_0x1bb9('0x0'));module[_0x1bb9('0x1')]={'name':{'type':Sequelize[_0x1bb9('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x1bb9('0x2')],'unique':_0x1bb9('0x3')},'password':{'type':Sequelize[_0x1bb9('0x2')]},'remoteUri':{'type':Sequelize[_0x1bb9('0x2')],'unique':_0x1bb9('0x4')},'serverUrl':{'type':Sequelize[_0x1bb9('0x2')]}}; \ No newline at end of file +var _0xdbd0=['sequelize','exports','STRING','remoteUri'];(function(_0x1b0c7c,_0x468383){var _0x44f649=function(_0x56fbc6){while(--_0x56fbc6){_0x1b0c7c['push'](_0x1b0c7c['shift']());}};_0x44f649(++_0x468383);}(_0xdbd0,0x88));var _0x0dbd=function(_0x124ec8,_0x439023){_0x124ec8=_0x124ec8-0x0;var _0x4f0551=_0xdbd0[_0x124ec8];return _0x4f0551;};'use strict';var Sequelize=require(_0x0dbd('0x0'));module[_0x0dbd('0x1')]={'name':{'type':Sequelize[_0x0dbd('0x2')]},'description':{'type':Sequelize[_0x0dbd('0x2')]},'username':{'type':Sequelize[_0x0dbd('0x2')],'unique':'username'},'password':{'type':Sequelize[_0x0dbd('0x2')]},'remoteUri':{'type':Sequelize[_0x0dbd('0x2')],'unique':_0x0dbd('0x3')},'serverUrl':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js index 9042a90..fcd26d7 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 _0x5727=['merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','rawAttributes','create','body','find','destroy','findOne','getConfigurations','Subjects','channel','getDescriptions','SugarcrmConfiguration','SugarcrmField','Descriptions','getFields','created_by','date_start','duration_hours','parent_id','parent_name','direction','password','remoteUri','slice','substring','lastIndexOf','format','%s%s','login','JSON','stringify','username','PLAIN','xCALLY\x20Motion\x20Integration','POST','get_module_fields','Calls','values','remove','includes','label','value','statusCode','Wrong\x20credentials','html-pdf','zip-dir','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','../../components/integrations/configuration','client','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','error','code','result','message','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','stack','name','send','index','map','SugarcrmAccount','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filters','filter','where'];(function(_0x823d62,_0x4747fc){var _0xde067c=function(_0x430efd){while(--_0x430efd){_0x823d62['push'](_0x823d62['shift']());}};_0xde067c(++_0x4747fc);}(_0x5727,0x12c));var _0x7572=function(_0x1c4a44,_0x15abd4){_0x1c4a44=_0x1c4a44-0x0;var _0x2009f5=_0x5727[_0x1c4a44];return _0x2009f5;};'use strict';var pdf=require(_0x7572('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x7572('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7572('0x2'));var moment=require(_0x7572('0x3'));var BPromise=require(_0x7572('0x4'));var Mustache=require(_0x7572('0x5'));var util=require('util');var path=require('path');var sox=require(_0x7572('0x6'));var csv=require(_0x7572('0x7'));var ejs=require(_0x7572('0x8'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x7572('0x9'));var jsforce=require(_0x7572('0xa'));var deskjs=require(_0x7572('0xb'));var toCsv=require(_0x7572('0x7'));var querystring=require(_0x7572('0xc'));var Papa=require('papaparse');var Redis=require(_0x7572('0xd'));var authService=require(_0x7572('0xe'));var qs=require(_0x7572('0xf'));var as=require(_0x7572('0x10'));var hardwareService=require(_0x7572('0x11'));var logger=require(_0x7572('0x12'))('api');var utils=require(_0x7572('0x13'));var config=require('../../config/environment');var db=require(_0x7572('0x14'))['db'];var integrations=require(_0x7572('0x15'));var jayson=require('jayson/promise');var client=jayson[_0x7572('0x16')]['http']({'port':0x232a});function checkPasswordPattern(_0x4fa880,_0x94ad5f,_0x3e26df){if(_0x3e26df){var _0x4d406e=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4d406e[_0x7572('0x17')](_0x94ad5f)){return _0x4fa880;}else{throw new db[(_0x7572('0x18'))][(_0x7572('0x19'))](_0x7572('0x1a'));}}else{return _0x4fa880;}}function respondWithRpcPromise(_0x3072ac,_0x231f2a,_0x36f93b,_0xbae54e){return new BPromise(function(_0x1cbb14,_0x44cc5b){var _0x38e6a0=_0xbae54e||client;return _0x38e6a0[_0x7572('0x1b')](_0x3072ac,_0x36f93b)[_0x7572('0x1c')](function(_0x299cb4){logger['info'](_0x7572('0x1d'),_0x231f2a,_0x7572('0x1e'));logger[_0x7572('0x1f')](_0x7572('0x20'),_0x231f2a,'request\x20sent',JSON['stringify'](_0x299cb4));if(_0x299cb4[_0x7572('0x21')]){if(_0x299cb4[_0x7572('0x21')][_0x7572('0x22')]===0x1f4){logger[_0x7572('0x21')](_0x7572('0x1d'),_0x231f2a,_0x299cb4[_0x7572('0x21')]['message']);return _0x44cc5b(_0x299cb4[_0x7572('0x21')]['message']);}logger['error'](_0x7572('0x1d'),_0x231f2a,_0x299cb4['error']['message']);return _0x1cbb14(_0x299cb4[_0x7572('0x21')]['message']);}else{logger['info'](_0x7572('0x1d'),_0x231f2a,_0x7572('0x1e'));_0x1cbb14(_0x299cb4[_0x7572('0x23')][_0x7572('0x24')]);}})[_0x7572('0x25')](function(_0x30aae1){logger[_0x7572('0x21')](_0x7572('0x1d'),_0x231f2a,_0x30aae1);_0x44cc5b(_0x30aae1);});});}function respondWithStatusCode(_0x38142d,_0x3dcd21){_0x3dcd21=_0x3dcd21||0xcc;return function(_0x50f71f){if(_0x50f71f){return _0x38142d[_0x7572('0x26')](_0x3dcd21);}return _0x38142d[_0x7572('0x27')](_0x3dcd21)[_0x7572('0x28')]();};}function respondWithResult(_0x132de6,_0x21450d){_0x21450d=_0x21450d||0xc8;return function(_0x12d060){if(_0x12d060){return _0x132de6[_0x7572('0x27')](_0x21450d)[_0x7572('0x29')](_0x12d060);}};}function respondWithFilteredResult(_0x16e54d,_0x3a0ccb){return function(_0x5e264a){if(_0x5e264a){var _0x2fd540=_0x5e264a[_0x7572('0x2a')],_0x25c9d5=_0x3a0ccb['offset'],_0x3df5ea=_0x3a0ccb[_0x7572('0x2b')]+_0x3a0ccb[_0x7572('0x2c')],_0x38af8b;if(_0x3df5ea>=_0x2fd540){_0x3df5ea=_0x2fd540;_0x38af8b=0xc8;}else{_0x38af8b=0xce;}_0x16e54d[_0x7572('0x27')](_0x38af8b);return _0x16e54d[_0x7572('0x2d')](_0x7572('0x2e'),_0x25c9d5+'-'+_0x3df5ea+'/'+_0x2fd540)[_0x7572('0x29')](_0x5e264a);}return null;};}function patchUpdates(_0x215b45){return function(_0x48252b){try{jsonpatch['apply'](_0x48252b,_0x215b45,!![]);}catch(_0x208cd9){return BPromise[_0x7572('0x2f')](_0x208cd9);}return _0x48252b[_0x7572('0x30')]();};}function saveUpdates(_0xe4dcf,_0x5619fe){return function(_0x1e9c58){if(_0x1e9c58){return _0x1e9c58[_0x7572('0x31')](_0xe4dcf)[_0x7572('0x1c')](function(_0x3a0529){return _0x3a0529;});}return null;};}function removeEntity(_0x1bcebd,_0x5edc73){return function(_0x3ac1a5){if(_0x3ac1a5){return _0x3ac1a5['destroy']()[_0x7572('0x1c')](function(){_0x1bcebd['status'](0xcc)[_0x7572('0x28')]();});}};}function handleEntityNotFound(_0x3a2188,_0x296d67){return function(_0x273b70){if(!_0x273b70){_0x3a2188['sendStatus'](0x194);}return _0x273b70;};}function handleError(_0xfdc11a,_0x17f805){_0x17f805=_0x17f805||0x1f4;return function(_0x1f7172){logger['error'](_0x1f7172[_0x7572('0x32')]);if(_0x1f7172[_0x7572('0x33')]){delete _0x1f7172[_0x7572('0x33')];}_0xfdc11a[_0x7572('0x27')](_0x17f805)[_0x7572('0x34')](_0x1f7172);};}exports[_0x7572('0x35')]=function(_0x3e06b7,_0x840c){var _0x19e111={},_0x2863ca={},_0x2cdd4d={'count':0x0,'rows':[]};var _0x1d5044=_[_0x7572('0x36')](db[_0x7572('0x37')]['rawAttributes'],function(_0x32ea80){return{'name':_0x32ea80['fieldName'],'type':_0x32ea80[_0x7572('0x38')][_0x7572('0x39')]};});_0x2863ca[_0x7572('0x3a')]=_[_0x7572('0x36')](_0x1d5044,_0x7572('0x33'));_0x2863ca[_0x7572('0x3b')]=_[_0x7572('0x3c')](_0x3e06b7[_0x7572('0x3b')]);_0x2863ca['filters']=_[_0x7572('0x3d')](_0x2863ca[_0x7572('0x3a')],_0x2863ca[_0x7572('0x3b')]);_0x19e111['attributes']=_[_0x7572('0x3d')](_0x2863ca[_0x7572('0x3a')],qs[_0x7572('0x3e')](_0x3e06b7[_0x7572('0x3b')][_0x7572('0x3e')]));_0x19e111[_0x7572('0x3f')]=_0x19e111[_0x7572('0x3f')][_0x7572('0x40')]?_0x19e111[_0x7572('0x3f')]:_0x2863ca[_0x7572('0x3a')];if(!_0x3e06b7['query'][_0x7572('0x41')](_0x7572('0x42'))){_0x19e111[_0x7572('0x2c')]=qs['limit'](_0x3e06b7[_0x7572('0x3b')][_0x7572('0x2c')]);_0x19e111[_0x7572('0x2b')]=qs[_0x7572('0x2b')](_0x3e06b7['query'][_0x7572('0x2b')]);}_0x19e111[_0x7572('0x43')]=qs[_0x7572('0x44')](_0x3e06b7[_0x7572('0x3b')]['sort']);_0x19e111['where']=qs[_0x7572('0x45')](_['pick'](_0x3e06b7[_0x7572('0x3b')],_0x2863ca[_0x7572('0x45')]));if(_0x3e06b7[_0x7572('0x3b')][_0x7572('0x46')]){_0x19e111[_0x7572('0x47')]=_[_0x7572('0x48')](_0x19e111[_0x7572('0x47')],{'$or':_[_0x7572('0x36')](_0x1d5044,function(_0x45f009){if(_0x45f009[_0x7572('0x38')]!==_0x7572('0x49')){var _0x49a074={};_0x49a074[_0x45f009[_0x7572('0x33')]]={'$like':'%'+_0x3e06b7[_0x7572('0x3b')][_0x7572('0x46')]+'%'};return _0x49a074;}})});}_0x19e111=_[_0x7572('0x48')]({},_0x19e111,_0x3e06b7[_0x7572('0x4a')]);var _0x2bfe7a={'where':_0x19e111[_0x7572('0x47')]};return db[_0x7572('0x37')][_0x7572('0x2a')](_0x2bfe7a)[_0x7572('0x1c')](function(_0x39f94d){_0x2cdd4d[_0x7572('0x2a')]=_0x39f94d;if(_0x3e06b7[_0x7572('0x3b')][_0x7572('0x4b')]){_0x19e111[_0x7572('0x4c')]=[{'all':!![]}];}return db[_0x7572('0x37')][_0x7572('0x4d')](_0x19e111);})['then'](function(_0x327daa){_0x2cdd4d[_0x7572('0x4e')]=_0x327daa;return _0x2cdd4d;})[_0x7572('0x1c')](respondWithFilteredResult(_0x840c,_0x19e111))[_0x7572('0x25')](handleError(_0x840c,null));};exports[_0x7572('0x4f')]=function(_0xe86117,_0x4bf782){var _0x755e4a={'raw':![],'where':{'id':_0xe86117[_0x7572('0x50')]['id']}},_0x415ed2={};_0x415ed2[_0x7572('0x3a')]=_[_0x7572('0x3c')](db['SugarcrmAccount'][_0x7572('0x51')]);_0x415ed2['query']=_[_0x7572('0x3c')](_0xe86117[_0x7572('0x3b')]);_0x415ed2[_0x7572('0x45')]=_[_0x7572('0x3d')](_0x415ed2[_0x7572('0x3a')],_0x415ed2[_0x7572('0x3b')]);_0x755e4a[_0x7572('0x3f')]=_[_0x7572('0x3d')](_0x415ed2['model'],qs['fields'](_0xe86117[_0x7572('0x3b')]['fields']));_0x755e4a[_0x7572('0x3f')]=_0x755e4a['attributes'][_0x7572('0x40')]?_0x755e4a[_0x7572('0x3f')]:_0x415ed2['model'];if(_0xe86117[_0x7572('0x3b')][_0x7572('0x4b')]){_0x755e4a[_0x7572('0x4c')]=[{'all':!![]}];}_0x755e4a=_[_0x7572('0x48')]({},_0x755e4a,_0xe86117[_0x7572('0x4a')]);return db[_0x7572('0x37')]['find'](_0x755e4a)[_0x7572('0x1c')](handleEntityNotFound(_0x4bf782,null))[_0x7572('0x1c')](respondWithResult(_0x4bf782,null))[_0x7572('0x25')](handleError(_0x4bf782,null));};exports[_0x7572('0x52')]=function(_0x292308,_0x545968){return db['SugarcrmAccount'][_0x7572('0x52')](_0x292308[_0x7572('0x53')],{})[_0x7572('0x1c')](respondWithResult(_0x545968,0xc9))[_0x7572('0x25')](handleError(_0x545968,null));};exports['update']=function(_0x10b5e0,_0x45505f){if(_0x10b5e0[_0x7572('0x53')]['id']){delete _0x10b5e0[_0x7572('0x53')]['id'];}return db['SugarcrmAccount'][_0x7572('0x54')]({'where':{'id':_0x10b5e0[_0x7572('0x50')]['id']}})[_0x7572('0x1c')](handleEntityNotFound(_0x45505f,null))['then'](saveUpdates(_0x10b5e0[_0x7572('0x53')],null))['then'](respondWithResult(_0x45505f,null))[_0x7572('0x25')](handleError(_0x45505f,null));};exports[_0x7572('0x55')]=function(_0x2d2f26,_0x4ae117){return db[_0x7572('0x37')][_0x7572('0x54')]({'where':{'id':_0x2d2f26[_0x7572('0x50')]['id']}})['then'](handleEntityNotFound(_0x4ae117,null))[_0x7572('0x1c')](removeEntity(_0x4ae117,null))[_0x7572('0x25')](handleError(_0x4ae117,null));};exports['getConfigurations']=function(_0x2375a8,_0x32ff7a,_0x4aa47d){var _0x493d2f={};var _0x4b0200={};var _0x38d99f;var _0x64726b;return db[_0x7572('0x37')][_0x7572('0x56')]({'where':{'id':_0x2375a8[_0x7572('0x50')]['id']}})[_0x7572('0x1c')](handleEntityNotFound(_0x32ff7a,null))[_0x7572('0x1c')](function(_0x59fb63){if(_0x59fb63){_0x38d99f=_0x59fb63;_0x4b0200[_0x7572('0x3a')]=_[_0x7572('0x3c')](db['SugarcrmConfiguration'][_0x7572('0x51')]);_0x4b0200[_0x7572('0x3b')]=_[_0x7572('0x3c')](_0x2375a8[_0x7572('0x3b')]);_0x4b0200[_0x7572('0x45')]=_['intersection'](_0x4b0200[_0x7572('0x3a')],_0x4b0200[_0x7572('0x3b')]);_0x493d2f['attributes']=_[_0x7572('0x3d')](_0x4b0200[_0x7572('0x3a')],qs[_0x7572('0x3e')](_0x2375a8['query']['fields']));_0x493d2f[_0x7572('0x3f')]=_0x493d2f['attributes'][_0x7572('0x40')]?_0x493d2f[_0x7572('0x3f')]:_0x4b0200[_0x7572('0x3a')];_0x493d2f[_0x7572('0x43')]=qs['sort'](_0x2375a8[_0x7572('0x3b')][_0x7572('0x44')]);_0x493d2f[_0x7572('0x47')]=qs[_0x7572('0x45')](_['pick'](_0x2375a8['query'],_0x4b0200[_0x7572('0x45')]));if(_0x2375a8['query'][_0x7572('0x46')]){_0x493d2f[_0x7572('0x47')]=_['merge'](_0x493d2f[_0x7572('0x47')],{'$or':_[_0x7572('0x36')](_0x493d2f[_0x7572('0x3f')],function(_0x3f0341){var _0x18d9a6={};_0x18d9a6[_0x3f0341]={'$like':'%'+_0x2375a8[_0x7572('0x3b')][_0x7572('0x46')]+'%'};return _0x18d9a6;})});}_0x493d2f=_[_0x7572('0x48')]({},_0x493d2f,_0x2375a8[_0x7572('0x4a')]);return _0x38d99f[_0x7572('0x57')](_0x493d2f);}})['then'](function(_0x425e05){if(_0x425e05){_0x64726b=_0x425e05[_0x7572('0x40')];if(!_0x2375a8['query'][_0x7572('0x41')](_0x7572('0x42'))){_0x493d2f['limit']=qs[_0x7572('0x2c')](_0x2375a8[_0x7572('0x3b')][_0x7572('0x2c')]);_0x493d2f[_0x7572('0x2b')]=qs['offset'](_0x2375a8[_0x7572('0x3b')]['offset']);}return _0x38d99f['getConfigurations'](_0x493d2f);}})['then'](function(_0x3015e0){if(_0x3015e0){return _0x3015e0?{'count':_0x64726b,'rows':_0x3015e0}:null;}})['then'](respondWithResult(_0x32ff7a,null))[_0x7572('0x25')](handleError(_0x32ff7a,null));};exports['addConfiguration']=function(_0x2692df,_0x2feb57,_0xadc488){if(_0x2692df[_0x7572('0x53')]['id']){delete _0x2692df[_0x7572('0x53')]['id'];}return db['SugarcrmAccount'][_0x7572('0x56')]({'where':{'id':_0x2692df['params']['id']}})[_0x7572('0x1c')](handleEntityNotFound(_0x2feb57,null))[_0x7572('0x1c')](function(_0x40c5fb){if(_0x40c5fb){_0x2692df[_0x7572('0x53')]['AccountId']=_0x40c5fb['id'];_0x2692df[_0x7572('0x53')][_0x7572('0x58')]=integrations['getSubjects'](_0x2692df['body'][_0x7572('0x59')],_0x2692df['body']['type']);_0x2692df[_0x7572('0x53')]['Descriptions']=integrations[_0x7572('0x5a')](_0x2692df[_0x7572('0x53')][_0x7572('0x59')],_0x2692df[_0x7572('0x53')][_0x7572('0x38')]);return db[_0x7572('0x5b')][_0x7572('0x52')](_0x2692df[_0x7572('0x53')],{'include':[{'model':db['SugarcrmField'],'as':'Subjects'},{'model':db[_0x7572('0x5c')],'as':_0x7572('0x5d')}]});}return null;})['then'](respondWithResult(_0x2feb57,null))[_0x7572('0x25')](handleError(_0x2feb57,null));};exports[_0x7572('0x5e')]=function(_0x2baff9,_0x2aae81,_0x455f6d){var _0xeef6ae='';var _0x3174d9=['id',_0x7572('0x33'),'assigned_user_id',_0x7572('0x5f'),'description',_0x7572('0x60'),_0x7572('0x61'),'duration_minutes',_0x7572('0x62'),'parent_type',_0x7572('0x63'),_0x7572('0x64')];return db[_0x7572('0x37')][_0x7572('0x56')]({'where':{'id':_0x2baff9[_0x7572('0x50')]['id']},'attributes':['id','username',_0x7572('0x65'),_0x7572('0x66')]})[_0x7572('0x1c')](handleEntityNotFound(_0x2aae81,null))[_0x7572('0x1c')](function(_0xeddaa2){if(_0xeddaa2){_0xeef6ae=_0xeddaa2['remoteUri'];var _0x5e8207=_0xeef6ae[_0x7572('0x67')](-0x1);if(_0x5e8207==='/'){_0xeef6ae=_0xeef6ae[_0x7572('0x68')](0x0,_0xeef6ae[_0x7572('0x69')](_0x5e8207));}return rp({'method':'POST','uri':util[_0x7572('0x6a')](_0x7572('0x6b'),_0xeef6ae,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0x7572('0x6c'),'input_type':_0x7572('0x6d'),'response_type':_0x7572('0x6d'),'rest_data':JSON[_0x7572('0x6e')]({'user_auth':{'user_name':_0xeddaa2[_0x7572('0x6f')],'password':_0xeddaa2[_0x7572('0x65')],'encryption':_0x7572('0x70')},'application':_0x7572('0x71')})}});}})[_0x7572('0x1c')](function(_0x3224f3){if(_0x3224f3&&_0x3224f3[_0x7572('0x33')]!=='Invalid\x20Login'&&_0x3224f3['name']!=='Password\x20Expired'){return rp({'method':_0x7572('0x72'),'uri':util[_0x7572('0x6a')](_0x7572('0x6b'),_0xeef6ae,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0x7572('0x73'),'input_type':'JSON','response_type':_0x7572('0x6d'),'rest_data':JSON[_0x7572('0x6e')]({'session':_0x3224f3['id'],'module_name':_0x7572('0x74')})}})[_0x7572('0x1c')](function(_0x41e07f){if(_0x41e07f){var _0x3758b1=_[_0x7572('0x75')](_0x41e07f['module_fields']);_[_0x7572('0x76')](_0x3758b1,function(_0x424643){return _0x3174d9[_0x7572('0x77')](_0x424643[_0x7572('0x33')]);});return{'count':_0x3758b1[_0x7572('0x40')],'rows':_[_0x7572('0x36')](_0x3758b1,function(_0x5a6242){return{'id':_0x5a6242['name'],'name':_0x5a6242[_0x7572('0x78')],'custom':_['endsWith'](_0x5a6242['name'],'_c')?!![]:![],'options':_0x5a6242[_0x7572('0x4a')]?_[_0x7572('0x36')](_[_0x7572('0x75')](_0x5a6242[_0x7572('0x4a')]),function(_0x1e2e03){return{'name':_0x1e2e03[_0x7572('0x79')],'value':_0x1e2e03[_0x7572('0x33')]};}):[]};})};}})[_0x7572('0x1c')](respondWithResult(_0x2aae81,null))[_0x7572('0x25')](function(_0x4421e4){var _0x2d6e06=_0x2baff9[_0x7572('0x3b')][_0x7572('0x17')]?0x1f4:_0x4421e4[_0x7572('0x7a')]||0x1f4;logger[_0x7572('0x21')]('getFields,\x20%s,\x20%s,\x20%s',_0x7572('0x5e'),_0x2d6e06,JSON[_0x7572('0x6e')](_0x4421e4));delete _0x4421e4[_0x7572('0x33')];if(_0x2d6e06===0x191){_0x2d6e06=0x190;}_0x2aae81[_0x7572('0x27')](_0x2d6e06)[_0x7572('0x34')](_0x2baff9[_0x7572('0x3b')][_0x7572('0x17')]?{'message':_0x7572('0x7b'),'statusCode':_0x4421e4[_0x7572('0x7a')]}:_0x4421e4);});}else{var _0x519642=0x1f4;_0x2aae81[_0x7572('0x27')](_0x519642)['send']({'message':'Wrong\x20credentials','statusCode':0x190});}});}; \ No newline at end of file +var _0x7b09=['module_fields','includes','endsWith','statusCode','Wrong\x20credentials','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','../../components/integrations/configuration','http','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','SugarcrmAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','result','catch','sendStatus','status','end','count','offset','limit','Content-Range','json','apply','reject','save','update','destroy','stack','name','send','index','map','SugarcrmAccount','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','includeAll','include','findAll','rows','show','params','rawAttributes','find','create','body','SugarcrmConfiguration','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','SugarcrmField','getFields','assigned_user_id','created_by','description','duration_minutes','parent_type','remoteUri','slice','POST','format','%s%s','/service/v4_1/rest.php','login','JSON','username','password','PLAIN','Password\x20Expired','Calls','values'];(function(_0x1e4a8e,_0x18022b){var _0x5408f9=function(_0x4ef2ed){while(--_0x4ef2ed){_0x1e4a8e['push'](_0x1e4a8e['shift']());}};_0x5408f9(++_0x18022b);}(_0x7b09,0x176));var _0x97b0=function(_0x32313d,_0x420e7b){_0x32313d=_0x32313d-0x0;var _0x112aa1=_0x7b09[_0x32313d];return _0x112aa1;};'use strict';var pdf=require(_0x97b0('0x0'));var emlformat=require(_0x97b0('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x97b0('0x2'));var jsonpatch=require(_0x97b0('0x3'));var rp=require('request-promise');var moment=require(_0x97b0('0x4'));var BPromise=require(_0x97b0('0x5'));var Mustache=require('mustache');var util=require(_0x97b0('0x6'));var path=require(_0x97b0('0x7'));var sox=require(_0x97b0('0x8'));var csv=require('to-csv');var ejs=require(_0x97b0('0x9'));var fs=require('fs');var _=require(_0x97b0('0xa'));var squel=require(_0x97b0('0xb'));var crypto=require(_0x97b0('0xc'));var jsforce=require(_0x97b0('0xd'));var deskjs=require(_0x97b0('0xe'));var toCsv=require(_0x97b0('0xf'));var querystring=require(_0x97b0('0x10'));var Papa=require(_0x97b0('0x11'));var Redis=require(_0x97b0('0x12'));var authService=require(_0x97b0('0x13'));var qs=require(_0x97b0('0x14'));var as=require(_0x97b0('0x15'));var hardwareService=require(_0x97b0('0x16'));var logger=require(_0x97b0('0x17'))('api');var utils=require(_0x97b0('0x18'));var config=require('../../config/environment');var db=require(_0x97b0('0x19'))['db'];var integrations=require(_0x97b0('0x1a'));var jayson=require('jayson/promise');var client=jayson['client'][_0x97b0('0x1b')]({'port':0x232a});function checkPasswordPattern(_0x2518ed,_0x2ed949,_0xfedff5){if(_0xfedff5){var _0xcfbfdc=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xcfbfdc[_0x97b0('0x1c')](_0x2ed949)){return _0x2518ed;}else{throw new db['Sequelize'][(_0x97b0('0x1d'))](_0x97b0('0x1e'));}}else{return _0x2518ed;}}function respondWithRpcPromise(_0x54bbae,_0x1005fd,_0x461ab6,_0x31835c){return new BPromise(function(_0x46c51b,_0x40973b){var _0x569c76=_0x31835c||client;return _0x569c76[_0x97b0('0x1f')](_0x54bbae,_0x461ab6)[_0x97b0('0x20')](function(_0x3b9cbe){logger['info'](_0x97b0('0x21'),_0x1005fd,'request\x20sent');logger[_0x97b0('0x22')]('SugarcrmAccount,\x20%s,\x20%s,\x20%s',_0x1005fd,_0x97b0('0x23'),JSON[_0x97b0('0x24')](_0x3b9cbe));if(_0x3b9cbe[_0x97b0('0x25')]){if(_0x3b9cbe[_0x97b0('0x25')][_0x97b0('0x26')]===0x1f4){logger[_0x97b0('0x25')](_0x97b0('0x21'),_0x1005fd,_0x3b9cbe[_0x97b0('0x25')][_0x97b0('0x27')]);return _0x40973b(_0x3b9cbe[_0x97b0('0x25')]['message']);}logger['error']('SugarcrmAccount,\x20%s,\x20%s',_0x1005fd,_0x3b9cbe[_0x97b0('0x25')]['message']);return _0x46c51b(_0x3b9cbe[_0x97b0('0x25')][_0x97b0('0x27')]);}else{logger[_0x97b0('0x28')](_0x97b0('0x21'),_0x1005fd,_0x97b0('0x23'));_0x46c51b(_0x3b9cbe[_0x97b0('0x29')][_0x97b0('0x27')]);}})[_0x97b0('0x2a')](function(_0x21f02c){logger[_0x97b0('0x25')](_0x97b0('0x21'),_0x1005fd,_0x21f02c);_0x40973b(_0x21f02c);});});}function respondWithStatusCode(_0xfc1924,_0x52add9){_0x52add9=_0x52add9||0xcc;return function(_0x38303f){if(_0x38303f){return _0xfc1924[_0x97b0('0x2b')](_0x52add9);}return _0xfc1924[_0x97b0('0x2c')](_0x52add9)[_0x97b0('0x2d')]();};}function respondWithResult(_0x25b4fa,_0x4ed9a1){_0x4ed9a1=_0x4ed9a1||0xc8;return function(_0x4ecaf3){if(_0x4ecaf3){return _0x25b4fa[_0x97b0('0x2c')](_0x4ed9a1)['json'](_0x4ecaf3);}};}function respondWithFilteredResult(_0xe33658,_0x148834){return function(_0x3f1770){if(_0x3f1770){var _0x4846c4=_0x3f1770[_0x97b0('0x2e')],_0x243007=_0x148834[_0x97b0('0x2f')],_0x5a19c0=_0x148834[_0x97b0('0x2f')]+_0x148834[_0x97b0('0x30')],_0x104fcc;if(_0x5a19c0>=_0x4846c4){_0x5a19c0=_0x4846c4;_0x104fcc=0xc8;}else{_0x104fcc=0xce;}_0xe33658[_0x97b0('0x2c')](_0x104fcc);return _0xe33658['set'](_0x97b0('0x31'),_0x243007+'-'+_0x5a19c0+'/'+_0x4846c4)[_0x97b0('0x32')](_0x3f1770);}return null;};}function patchUpdates(_0x5b36c8){return function(_0x480e72){try{jsonpatch[_0x97b0('0x33')](_0x480e72,_0x5b36c8,!![]);}catch(_0x4872aa){return BPromise[_0x97b0('0x34')](_0x4872aa);}return _0x480e72[_0x97b0('0x35')]();};}function saveUpdates(_0x5b0148,_0x5973b3){return function(_0x47ce07){if(_0x47ce07){return _0x47ce07[_0x97b0('0x36')](_0x5b0148)[_0x97b0('0x20')](function(_0x2c25c0){return _0x2c25c0;});}return null;};}function removeEntity(_0x1cab6d,_0x50a8dd){return function(_0x10db2b){if(_0x10db2b){return _0x10db2b[_0x97b0('0x37')]()[_0x97b0('0x20')](function(){_0x1cab6d[_0x97b0('0x2c')](0xcc)[_0x97b0('0x2d')]();});}};}function handleEntityNotFound(_0x16bc7a,_0x21ba99){return function(_0x4b270a){if(!_0x4b270a){_0x16bc7a[_0x97b0('0x2b')](0x194);}return _0x4b270a;};}function handleError(_0x531d14,_0x4913f8){_0x4913f8=_0x4913f8||0x1f4;return function(_0x44a39a){logger[_0x97b0('0x25')](_0x44a39a[_0x97b0('0x38')]);if(_0x44a39a[_0x97b0('0x39')]){delete _0x44a39a[_0x97b0('0x39')];}_0x531d14[_0x97b0('0x2c')](_0x4913f8)[_0x97b0('0x3a')](_0x44a39a);};}exports[_0x97b0('0x3b')]=function(_0x192ccc,_0x519c15){var _0x1eeb66={},_0x354362={},_0x398559={'count':0x0,'rows':[]};var _0x1204c6=_[_0x97b0('0x3c')](db[_0x97b0('0x3d')]['rawAttributes'],function(_0x5cbf33){return{'name':_0x5cbf33['fieldName'],'type':_0x5cbf33['type']['key']};});_0x354362[_0x97b0('0x3e')]=_['map'](_0x1204c6,_0x97b0('0x39'));_0x354362['query']=_[_0x97b0('0x3f')](_0x192ccc[_0x97b0('0x40')]);_0x354362[_0x97b0('0x41')]=_[_0x97b0('0x42')](_0x354362[_0x97b0('0x3e')],_0x354362[_0x97b0('0x40')]);_0x1eeb66[_0x97b0('0x43')]=_['intersection'](_0x354362[_0x97b0('0x3e')],qs[_0x97b0('0x44')](_0x192ccc[_0x97b0('0x40')][_0x97b0('0x44')]));_0x1eeb66[_0x97b0('0x43')]=_0x1eeb66['attributes'][_0x97b0('0x45')]?_0x1eeb66[_0x97b0('0x43')]:_0x354362['model'];if(!_0x192ccc[_0x97b0('0x40')][_0x97b0('0x46')](_0x97b0('0x47'))){_0x1eeb66[_0x97b0('0x30')]=qs[_0x97b0('0x30')](_0x192ccc[_0x97b0('0x40')][_0x97b0('0x30')]);_0x1eeb66[_0x97b0('0x2f')]=qs['offset'](_0x192ccc[_0x97b0('0x40')][_0x97b0('0x2f')]);}_0x1eeb66[_0x97b0('0x48')]=qs['sort'](_0x192ccc['query'][_0x97b0('0x49')]);_0x1eeb66[_0x97b0('0x4a')]=qs[_0x97b0('0x41')](_[_0x97b0('0x4b')](_0x192ccc[_0x97b0('0x40')],_0x354362[_0x97b0('0x41')]));if(_0x192ccc[_0x97b0('0x40')][_0x97b0('0x4c')]){_0x1eeb66[_0x97b0('0x4a')]=_[_0x97b0('0x4d')](_0x1eeb66['where'],{'$or':_[_0x97b0('0x3c')](_0x1204c6,function(_0x5a4ad6){if(_0x5a4ad6[_0x97b0('0x4e')]!=='VIRTUAL'){var _0x10509f={};_0x10509f[_0x5a4ad6[_0x97b0('0x39')]]={'$like':'%'+_0x192ccc['query'][_0x97b0('0x4c')]+'%'};return _0x10509f;}})});}_0x1eeb66=_[_0x97b0('0x4d')]({},_0x1eeb66,_0x192ccc[_0x97b0('0x4f')]);var _0xaed79e={'where':_0x1eeb66['where']};return db['SugarcrmAccount'][_0x97b0('0x2e')](_0xaed79e)[_0x97b0('0x20')](function(_0x5df7d9){_0x398559['count']=_0x5df7d9;if(_0x192ccc[_0x97b0('0x40')][_0x97b0('0x50')]){_0x1eeb66[_0x97b0('0x51')]=[{'all':!![]}];}return db[_0x97b0('0x3d')][_0x97b0('0x52')](_0x1eeb66);})[_0x97b0('0x20')](function(_0x2676fc){_0x398559[_0x97b0('0x53')]=_0x2676fc;return _0x398559;})['then'](respondWithFilteredResult(_0x519c15,_0x1eeb66))[_0x97b0('0x2a')](handleError(_0x519c15,null));};exports[_0x97b0('0x54')]=function(_0x116c6e,_0x495dd4){var _0x1a2acd={'raw':![],'where':{'id':_0x116c6e[_0x97b0('0x55')]['id']}},_0x4b5ddb={};_0x4b5ddb[_0x97b0('0x3e')]=_[_0x97b0('0x3f')](db['SugarcrmAccount'][_0x97b0('0x56')]);_0x4b5ddb['query']=_[_0x97b0('0x3f')](_0x116c6e[_0x97b0('0x40')]);_0x4b5ddb[_0x97b0('0x41')]=_[_0x97b0('0x42')](_0x4b5ddb[_0x97b0('0x3e')],_0x4b5ddb[_0x97b0('0x40')]);_0x1a2acd[_0x97b0('0x43')]=_[_0x97b0('0x42')](_0x4b5ddb[_0x97b0('0x3e')],qs[_0x97b0('0x44')](_0x116c6e[_0x97b0('0x40')][_0x97b0('0x44')]));_0x1a2acd['attributes']=_0x1a2acd[_0x97b0('0x43')][_0x97b0('0x45')]?_0x1a2acd['attributes']:_0x4b5ddb[_0x97b0('0x3e')];if(_0x116c6e[_0x97b0('0x40')][_0x97b0('0x50')]){_0x1a2acd[_0x97b0('0x51')]=[{'all':!![]}];}_0x1a2acd=_[_0x97b0('0x4d')]({},_0x1a2acd,_0x116c6e[_0x97b0('0x4f')]);return db[_0x97b0('0x3d')][_0x97b0('0x57')](_0x1a2acd)[_0x97b0('0x20')](handleEntityNotFound(_0x495dd4,null))[_0x97b0('0x20')](respondWithResult(_0x495dd4,null))[_0x97b0('0x2a')](handleError(_0x495dd4,null));};exports[_0x97b0('0x58')]=function(_0x2be338,_0x608af5){return db[_0x97b0('0x3d')][_0x97b0('0x58')](_0x2be338[_0x97b0('0x59')],{})['then'](respondWithResult(_0x608af5,0xc9))[_0x97b0('0x2a')](handleError(_0x608af5,null));};exports[_0x97b0('0x36')]=function(_0x46c8c0,_0x172ea1){if(_0x46c8c0[_0x97b0('0x59')]['id']){delete _0x46c8c0['body']['id'];}return db[_0x97b0('0x3d')][_0x97b0('0x57')]({'where':{'id':_0x46c8c0['params']['id']}})[_0x97b0('0x20')](handleEntityNotFound(_0x172ea1,null))[_0x97b0('0x20')](saveUpdates(_0x46c8c0[_0x97b0('0x59')],null))[_0x97b0('0x20')](respondWithResult(_0x172ea1,null))[_0x97b0('0x2a')](handleError(_0x172ea1,null));};exports[_0x97b0('0x37')]=function(_0x2465cc,_0x302494){return db[_0x97b0('0x3d')][_0x97b0('0x57')]({'where':{'id':_0x2465cc['params']['id']}})['then'](handleEntityNotFound(_0x302494,null))['then'](removeEntity(_0x302494,null))['catch'](handleError(_0x302494,null));};exports['getConfigurations']=function(_0x7079e4,_0x44102b,_0x363c03){var _0x7e425e={};var _0x9bb157={};var _0x2ad361;var _0x3b7d4d;return db['SugarcrmAccount']['findOne']({'where':{'id':_0x7079e4['params']['id']}})[_0x97b0('0x20')](handleEntityNotFound(_0x44102b,null))['then'](function(_0x49adb7){if(_0x49adb7){_0x2ad361=_0x49adb7;_0x9bb157[_0x97b0('0x3e')]=_[_0x97b0('0x3f')](db[_0x97b0('0x5a')][_0x97b0('0x56')]);_0x9bb157['query']=_[_0x97b0('0x3f')](_0x7079e4[_0x97b0('0x40')]);_0x9bb157[_0x97b0('0x41')]=_[_0x97b0('0x42')](_0x9bb157[_0x97b0('0x3e')],_0x9bb157[_0x97b0('0x40')]);_0x7e425e[_0x97b0('0x43')]=_['intersection'](_0x9bb157['model'],qs[_0x97b0('0x44')](_0x7079e4['query']['fields']));_0x7e425e[_0x97b0('0x43')]=_0x7e425e[_0x97b0('0x43')]['length']?_0x7e425e[_0x97b0('0x43')]:_0x9bb157[_0x97b0('0x3e')];_0x7e425e[_0x97b0('0x48')]=qs['sort'](_0x7079e4[_0x97b0('0x40')]['sort']);_0x7e425e[_0x97b0('0x4a')]=qs[_0x97b0('0x41')](_[_0x97b0('0x4b')](_0x7079e4[_0x97b0('0x40')],_0x9bb157[_0x97b0('0x41')]));if(_0x7079e4[_0x97b0('0x40')][_0x97b0('0x4c')]){_0x7e425e[_0x97b0('0x4a')]=_['merge'](_0x7e425e[_0x97b0('0x4a')],{'$or':_[_0x97b0('0x3c')](_0x7e425e[_0x97b0('0x43')],function(_0x21bb49){var _0x291d14={};_0x291d14[_0x21bb49]={'$like':'%'+_0x7079e4[_0x97b0('0x40')][_0x97b0('0x4c')]+'%'};return _0x291d14;})});}_0x7e425e=_[_0x97b0('0x4d')]({},_0x7e425e,_0x7079e4[_0x97b0('0x4f')]);return _0x2ad361['getConfigurations'](_0x7e425e);}})['then'](function(_0x195f59){if(_0x195f59){_0x3b7d4d=_0x195f59['length'];if(!_0x7079e4[_0x97b0('0x40')]['hasOwnProperty'](_0x97b0('0x47'))){_0x7e425e[_0x97b0('0x30')]=qs['limit'](_0x7079e4[_0x97b0('0x40')][_0x97b0('0x30')]);_0x7e425e[_0x97b0('0x2f')]=qs['offset'](_0x7079e4[_0x97b0('0x40')][_0x97b0('0x2f')]);}return _0x2ad361['getConfigurations'](_0x7e425e);}})[_0x97b0('0x20')](function(_0x14b11a){if(_0x14b11a){return _0x14b11a?{'count':_0x3b7d4d,'rows':_0x14b11a}:null;}})[_0x97b0('0x20')](respondWithResult(_0x44102b,null))[_0x97b0('0x2a')](handleError(_0x44102b,null));};exports['addConfiguration']=function(_0x543642,_0x5424c8,_0x5f1601){if(_0x543642[_0x97b0('0x59')]['id']){delete _0x543642[_0x97b0('0x59')]['id'];}return db[_0x97b0('0x3d')][_0x97b0('0x5b')]({'where':{'id':_0x543642[_0x97b0('0x55')]['id']}})[_0x97b0('0x20')](handleEntityNotFound(_0x5424c8,null))[_0x97b0('0x20')](function(_0x11012c){if(_0x11012c){_0x543642['body'][_0x97b0('0x5c')]=_0x11012c['id'];_0x543642[_0x97b0('0x59')][_0x97b0('0x5d')]=integrations[_0x97b0('0x5e')](_0x543642[_0x97b0('0x59')][_0x97b0('0x5f')],_0x543642[_0x97b0('0x59')]['type']);_0x543642[_0x97b0('0x59')][_0x97b0('0x60')]=integrations['getDescriptions'](_0x543642[_0x97b0('0x59')]['channel'],_0x543642['body'][_0x97b0('0x4e')]);return db[_0x97b0('0x5a')][_0x97b0('0x58')](_0x543642['body'],{'include':[{'model':db[_0x97b0('0x61')],'as':'Subjects'},{'model':db[_0x97b0('0x61')],'as':_0x97b0('0x60')}]});}return null;})['then'](respondWithResult(_0x5424c8,null))['catch'](handleError(_0x5424c8,null));};exports[_0x97b0('0x62')]=function(_0x3a1662,_0x43f48d,_0x5c4b3c){var _0x5f3baa='';var _0x4ac7bd=['id',_0x97b0('0x39'),_0x97b0('0x63'),_0x97b0('0x64'),_0x97b0('0x65'),'date_start','duration_hours',_0x97b0('0x66'),'parent_id',_0x97b0('0x67'),'parent_name','direction'];return db['SugarcrmAccount'][_0x97b0('0x5b')]({'where':{'id':_0x3a1662[_0x97b0('0x55')]['id']},'attributes':['id','username','password',_0x97b0('0x68')]})[_0x97b0('0x20')](handleEntityNotFound(_0x43f48d,null))[_0x97b0('0x20')](function(_0x5f3274){if(_0x5f3274){_0x5f3baa=_0x5f3274[_0x97b0('0x68')];var _0x37b6e5=_0x5f3baa[_0x97b0('0x69')](-0x1);if(_0x37b6e5==='/'){_0x5f3baa=_0x5f3baa['substring'](0x0,_0x5f3baa['lastIndexOf'](_0x37b6e5));}return rp({'method':_0x97b0('0x6a'),'uri':util[_0x97b0('0x6b')](_0x97b0('0x6c'),_0x5f3baa,_0x97b0('0x6d')),'json':!![],'form':{'method':_0x97b0('0x6e'),'input_type':_0x97b0('0x6f'),'response_type':_0x97b0('0x6f'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x5f3274[_0x97b0('0x70')],'password':_0x5f3274[_0x97b0('0x71')],'encryption':_0x97b0('0x72')},'application':'xCALLY\x20Motion\x20Integration'})}});}})['then'](function(_0x2d4bf5){if(_0x2d4bf5&&_0x2d4bf5[_0x97b0('0x39')]!=='Invalid\x20Login'&&_0x2d4bf5[_0x97b0('0x39')]!==_0x97b0('0x73')){return rp({'method':_0x97b0('0x6a'),'uri':util['format'](_0x97b0('0x6c'),_0x5f3baa,_0x97b0('0x6d')),'json':!![],'form':{'method':'get_module_fields','input_type':_0x97b0('0x6f'),'response_type':_0x97b0('0x6f'),'rest_data':JSON['stringify']({'session':_0x2d4bf5['id'],'module_name':_0x97b0('0x74')})}})['then'](function(_0x2211fe){if(_0x2211fe){var _0x455487=_[_0x97b0('0x75')](_0x2211fe[_0x97b0('0x76')]);_['remove'](_0x455487,function(_0x238147){return _0x4ac7bd[_0x97b0('0x77')](_0x238147[_0x97b0('0x39')]);});return{'count':_0x455487[_0x97b0('0x45')],'rows':_[_0x97b0('0x3c')](_0x455487,function(_0x2b629d){return{'id':_0x2b629d['name'],'name':_0x2b629d['label'],'custom':_[_0x97b0('0x78')](_0x2b629d[_0x97b0('0x39')],'_c')?!![]:![],'options':_0x2b629d['options']?_[_0x97b0('0x3c')](_[_0x97b0('0x75')](_0x2b629d['options']),function(_0x1da8dd){return{'name':_0x1da8dd['value'],'value':_0x1da8dd[_0x97b0('0x39')]};}):[]};})};}})[_0x97b0('0x20')](respondWithResult(_0x43f48d,null))[_0x97b0('0x2a')](function(_0x590980){var _0x5152a3=_0x3a1662[_0x97b0('0x40')][_0x97b0('0x1c')]?0x1f4:_0x590980[_0x97b0('0x79')]||0x1f4;logger[_0x97b0('0x25')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x5152a3,JSON[_0x97b0('0x24')](_0x590980));delete _0x590980[_0x97b0('0x39')];if(_0x5152a3===0x191){_0x5152a3=0x190;}_0x43f48d['status'](_0x5152a3)['send'](_0x3a1662['query'][_0x97b0('0x1c')]?{'message':_0x97b0('0x7a'),'statusCode':_0x590980[_0x97b0('0x79')]}:_0x590980);});}else{var _0x3949b9=0x1f4;_0x43f48d[_0x97b0('0x2c')](_0x3949b9)[_0x97b0('0x3a')]({'message':_0x97b0('0x7a'),'statusCode':0x190});}});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.model.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.model.js index a92d6f8..b720a42 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 _0xb17f=['rimraf','../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','define','SugarcrmAccount','int_sugarcrm_accounts','lodash','util','../../config/logger','api','request-promise','path'];(function(_0x7c4037,_0x4e7dbc){var _0x3e9366=function(_0x13587a){while(--_0x13587a){_0x7c4037['push'](_0x7c4037['shift']());}};_0x3e9366(++_0x4e7dbc);}(_0xb17f,0xcc));var _0xfb17=function(_0x89e678,_0x3c8809){_0x89e678=_0x89e678-0x0;var _0x42e4a5=_0xb17f[_0x89e678];return _0x42e4a5;};'use strict';var _=require(_0xfb17('0x0'));var util=require(_0xfb17('0x1'));var logger=require(_0xfb17('0x2'))(_0xfb17('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xfb17('0x4'));var fs=require('fs');var path=require(_0xfb17('0x5'));var rimraf=require(_0xfb17('0x6'));var config=require(_0xfb17('0x7'));var attributes=require(_0xfb17('0x8'));var integrations=require(_0xfb17('0x9'));module[_0xfb17('0xa')]=function(_0x3fba35,_0x4c8b1f){return _0x3fba35[_0xfb17('0xb')](_0xfb17('0xc'),attributes,{'tableName':_0xfb17('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf9e9=['../../components/integrations/configuration','exports','define','SugarcrmAccount','util','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x4d0606,_0x8f07e1){var _0x239297=function(_0x45c3ca){while(--_0x45c3ca){_0x4d0606['push'](_0x4d0606['shift']());}};_0x239297(++_0x8f07e1);}(_0xf9e9,0xf6));var _0x9f9e=function(_0x58afd5,_0x534a48){_0x58afd5=_0x58afd5-0x0;var _0x3e503b=_0xf9e9[_0x58afd5];return _0x3e503b;};'use strict';var _=require('lodash');var util=require(_0x9f9e('0x0'));var logger=require('../../config/logger')(_0x9f9e('0x1'));var moment=require('moment');var BPromise=require(_0x9f9e('0x2'));var rp=require(_0x9f9e('0x3'));var fs=require('fs');var path=require(_0x9f9e('0x4'));var rimraf=require(_0x9f9e('0x5'));var config=require(_0x9f9e('0x6'));var attributes=require('./intSugarcrmAccount.attributes');var integrations=require(_0x9f9e('0x7'));module[_0x9f9e('0x8')]=function(_0x772a74,_0x1bd4d4){return _0x772a74[_0x9f9e('0x9')](_0x9f9e('0xa'),attributes,{'tableName':'int_sugarcrm_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js index e724bc3..29f2feb 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 _0xdf60=['limit','include','model','map','then','GetSugarcrmAccount','catch','ShowSugarcrmAccount','find','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','http','request','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','findAll','options','raw','where','attributes'];(function(_0x9cfe28,_0x1a335c){var _0x54a1d0=function(_0x46bc02){while(--_0x46bc02){_0x9cfe28['push'](_0x9cfe28['shift']());}};_0x54a1d0(++_0x1a335c);}(_0xdf60,0x15d));var _0x0df6=function(_0x3a345f,_0x493626){_0x3a345f=_0x3a345f-0x0;var _0x13d69f=_0xdf60[_0x3a345f];return _0x13d69f;};'use strict';var _=require('lodash');var util=require(_0x0df6('0x0'));var moment=require(_0x0df6('0x1'));var BPromise=require(_0x0df6('0x2'));var rs=require(_0x0df6('0x3'));var fs=require('fs');var Redis=require(_0x0df6('0x4'));var db=require(_0x0df6('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0df6('0x6'))(_0x0df6('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x0df6('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x9d2cfd,_0x499de5,_0x105fd5){return new BPromise(function(_0x51c3f2,_0x55d5cf){return client[_0x0df6('0x9')](_0x9d2cfd,_0x105fd5)['then'](function(_0xef6d83){logger['info'](_0x0df6('0xa'),_0x499de5,_0x0df6('0xb'));logger[_0x0df6('0xc')](_0x0df6('0xd'),_0x499de5,_0x0df6('0xb'),JSON[_0x0df6('0xe')](_0xef6d83));if(_0xef6d83[_0x0df6('0xf')]){if(_0xef6d83[_0x0df6('0xf')][_0x0df6('0x10')]===0x1f4){logger['error'](_0x0df6('0xa'),_0x499de5,_0xef6d83['error'][_0x0df6('0x11')]);return _0x55d5cf(_0xef6d83[_0x0df6('0xf')][_0x0df6('0x11')]);}logger[_0x0df6('0xf')]('SugarcrmAccount,\x20%s,\x20%s',_0x499de5,_0xef6d83[_0x0df6('0xf')][_0x0df6('0x11')]);return _0x51c3f2(_0xef6d83[_0x0df6('0xf')]['message']);}else{logger[_0x0df6('0x12')]('SugarcrmAccount,\x20%s,\x20%s',_0x499de5,_0x0df6('0xb'));_0x51c3f2(_0xef6d83[_0x0df6('0x13')][_0x0df6('0x11')]);}})['catch'](function(_0x4f217d){logger[_0x0df6('0xf')](_0x0df6('0xa'),_0x499de5,_0x4f217d);_0x55d5cf(_0x4f217d);});});}exports['GetSugarcrmAccount']=function(_0x1a96f6){var _0x4a67ef=this;return new Promise(function(_0x22efbc,_0x456815){return db['SugarcrmAccount'][_0x0df6('0x14')]({'raw':_0x1a96f6[_0x0df6('0x15')]?_0x1a96f6[_0x0df6('0x15')][_0x0df6('0x16')]===undefined?!![]:![]:!![],'where':_0x1a96f6[_0x0df6('0x15')]?_0x1a96f6[_0x0df6('0x15')][_0x0df6('0x17')]||null:null,'attributes':_0x1a96f6[_0x0df6('0x15')]?_0x1a96f6[_0x0df6('0x15')][_0x0df6('0x18')]||null:null,'limit':_0x1a96f6[_0x0df6('0x15')]?_0x1a96f6[_0x0df6('0x15')][_0x0df6('0x19')]||null:null,'include':_0x1a96f6[_0x0df6('0x15')]?_0x1a96f6[_0x0df6('0x15')][_0x0df6('0x1a')]?_['map'](_0x1a96f6[_0x0df6('0x15')][_0x0df6('0x1a')],function(_0x5823a8){return{'model':db[_0x5823a8[_0x0df6('0x1b')]],'as':_0x5823a8['as'],'attributes':_0x5823a8[_0x0df6('0x18')],'include':_0x5823a8[_0x0df6('0x1a')]?_[_0x0df6('0x1c')](_0x5823a8[_0x0df6('0x1a')],function(_0x580593){return{'model':db[_0x580593[_0x0df6('0x1b')]],'as':_0x580593['as'],'attributes':_0x580593[_0x0df6('0x18')],'include':_0x580593[_0x0df6('0x1a')]?_[_0x0df6('0x1c')](_0x580593[_0x0df6('0x1a')],function(_0x573445){return{'model':db[_0x573445['model']],'as':_0x573445['as'],'attributes':_0x573445[_0x0df6('0x18')]};}):[]};}):[]};}):[]:[]})[_0x0df6('0x1d')](function(_0x2fe800){logger[_0x0df6('0x12')](_0x0df6('0x1e'),_0x1a96f6);logger[_0x0df6('0xc')](_0x0df6('0x1e'),_0x1a96f6,JSON[_0x0df6('0xe')](_0x2fe800));_0x22efbc(_0x2fe800);})[_0x0df6('0x1f')](function(_0x10baac){logger['error'](_0x0df6('0x1e'),_0x10baac[_0x0df6('0x11')],_0x1a96f6);_0x456815(_0x4a67ef[_0x0df6('0xf')](0x1f4,_0x10baac[_0x0df6('0x11')]));});});};exports[_0x0df6('0x20')]=function(_0x4bfa9e){var _0x46778b=this;return new Promise(function(_0x165597,_0x56e559){return db['SugarcrmAccount'][_0x0df6('0x21')]({'raw':_0x4bfa9e[_0x0df6('0x15')]?_0x4bfa9e[_0x0df6('0x15')][_0x0df6('0x16')]===undefined?!![]:![]:!![],'where':_0x4bfa9e[_0x0df6('0x15')]?_0x4bfa9e[_0x0df6('0x15')][_0x0df6('0x17')]||null:null,'attributes':_0x4bfa9e['options']?_0x4bfa9e['options']['attributes']||null:null,'include':_0x4bfa9e[_0x0df6('0x15')]?_0x4bfa9e['options'][_0x0df6('0x1a')]?_['map'](_0x4bfa9e[_0x0df6('0x15')]['include'],function(_0xce9be4){return{'model':db[_0xce9be4['model']],'as':_0xce9be4['as'],'attributes':_0xce9be4[_0x0df6('0x18')],'include':_0xce9be4[_0x0df6('0x1a')]?_[_0x0df6('0x1c')](_0xce9be4['include'],function(_0x43672b){return{'model':db[_0x43672b[_0x0df6('0x1b')]],'as':_0x43672b['as'],'attributes':_0x43672b[_0x0df6('0x18')],'include':_0x43672b[_0x0df6('0x1a')]?_[_0x0df6('0x1c')](_0x43672b[_0x0df6('0x1a')],function(_0x57ee20){return{'model':db[_0x57ee20[_0x0df6('0x1b')]],'as':_0x57ee20['as'],'attributes':_0x57ee20[_0x0df6('0x18')]};}):[]};}):[]};}):[]:[]})[_0x0df6('0x1d')](function(_0x4879bb){logger[_0x0df6('0x12')]('ShowSugarcrmAccount',_0x4bfa9e);logger[_0x0df6('0xc')]('ShowSugarcrmAccount',_0x4bfa9e,JSON[_0x0df6('0xe')](_0x4879bb));_0x165597(_0x4879bb);})[_0x0df6('0x1f')](function(_0x40dfde){logger[_0x0df6('0xf')](_0x0df6('0x20'),_0x40dfde[_0x0df6('0x11')],_0x4bfa9e);_0x56e559(_0x46778b[_0x0df6('0xf')](0x1f4,_0x40dfde[_0x0df6('0x11')]));});});}; \ No newline at end of file +var _0x088b=['moment','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','SugarcrmAccount,\x20%s,\x20%s','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','SugarcrmAccount','findAll','options','raw','limit','include','map','model','attributes','then','GetSugarcrmAccount','find','where','ShowSugarcrmAccount','catch','lodash','util'];(function(_0x2aa0e7,_0x4e5145){var _0x1472c0=function(_0x4deaeb){while(--_0x4deaeb){_0x2aa0e7['push'](_0x2aa0e7['shift']());}};_0x1472c0(++_0x4e5145);}(_0x088b,0x174));var _0xb088=function(_0x31e9a5,_0x520323){_0x31e9a5=_0x31e9a5-0x0;var _0x96859d=_0x088b[_0x31e9a5];return _0x96859d;};'use strict';var _=require(_0xb088('0x0'));var util=require(_0xb088('0x1'));var moment=require(_0xb088('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb088('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xb088('0x4'))(_0xb088('0x5'));var config=require(_0xb088('0x6'));var jayson=require(_0xb088('0x7'));var client=jayson['client'][_0xb088('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x23451c,_0x4a0d1a,_0x54a6a0){return new BPromise(function(_0x2d456d,_0x285408){return client['request'](_0x23451c,_0x54a6a0)['then'](function(_0x3d16d8){logger[_0xb088('0x9')](_0xb088('0xa'),_0x4a0d1a,'request\x20sent');logger[_0xb088('0xb')](_0xb088('0xc'),_0x4a0d1a,_0xb088('0xd'),JSON[_0xb088('0xe')](_0x3d16d8));if(_0x3d16d8[_0xb088('0xf')]){if(_0x3d16d8[_0xb088('0xf')][_0xb088('0x10')]===0x1f4){logger[_0xb088('0xf')]('SugarcrmAccount,\x20%s,\x20%s',_0x4a0d1a,_0x3d16d8[_0xb088('0xf')][_0xb088('0x11')]);return _0x285408(_0x3d16d8[_0xb088('0xf')][_0xb088('0x11')]);}logger[_0xb088('0xf')](_0xb088('0xa'),_0x4a0d1a,_0x3d16d8[_0xb088('0xf')]['message']);return _0x2d456d(_0x3d16d8['error'][_0xb088('0x11')]);}else{logger['info'](_0xb088('0xa'),_0x4a0d1a,_0xb088('0xd'));_0x2d456d(_0x3d16d8[_0xb088('0x12')][_0xb088('0x11')]);}})['catch'](function(_0x579707){logger['error'](_0xb088('0xa'),_0x4a0d1a,_0x579707);_0x285408(_0x579707);});});}exports['GetSugarcrmAccount']=function(_0x52dde5){var _0x2f9956=this;return new Promise(function(_0x510b99,_0x387ad7){return db[_0xb088('0x13')][_0xb088('0x14')]({'raw':_0x52dde5[_0xb088('0x15')]?_0x52dde5[_0xb088('0x15')][_0xb088('0x16')]===undefined?!![]:![]:!![],'where':_0x52dde5[_0xb088('0x15')]?_0x52dde5['options']['where']||null:null,'attributes':_0x52dde5[_0xb088('0x15')]?_0x52dde5[_0xb088('0x15')]['attributes']||null:null,'limit':_0x52dde5[_0xb088('0x15')]?_0x52dde5[_0xb088('0x15')][_0xb088('0x17')]||null:null,'include':_0x52dde5['options']?_0x52dde5[_0xb088('0x15')][_0xb088('0x18')]?_[_0xb088('0x19')](_0x52dde5['options'][_0xb088('0x18')],function(_0x2c744e){return{'model':db[_0x2c744e[_0xb088('0x1a')]],'as':_0x2c744e['as'],'attributes':_0x2c744e['attributes'],'include':_0x2c744e[_0xb088('0x18')]?_[_0xb088('0x19')](_0x2c744e[_0xb088('0x18')],function(_0x3c52a8){return{'model':db[_0x3c52a8[_0xb088('0x1a')]],'as':_0x3c52a8['as'],'attributes':_0x3c52a8[_0xb088('0x1b')],'include':_0x3c52a8[_0xb088('0x18')]?_[_0xb088('0x19')](_0x3c52a8['include'],function(_0x2f8bd8){return{'model':db[_0x2f8bd8[_0xb088('0x1a')]],'as':_0x2f8bd8['as'],'attributes':_0x2f8bd8['attributes']};}):[]};}):[]};}):[]:[]})[_0xb088('0x1c')](function(_0x58a792){logger[_0xb088('0x9')]('GetSugarcrmAccount',_0x52dde5);logger[_0xb088('0xb')](_0xb088('0x1d'),_0x52dde5,JSON[_0xb088('0xe')](_0x58a792));_0x510b99(_0x58a792);})['catch'](function(_0x1a11c2){logger['error'](_0xb088('0x1d'),_0x1a11c2[_0xb088('0x11')],_0x52dde5);_0x387ad7(_0x2f9956['error'](0x1f4,_0x1a11c2[_0xb088('0x11')]));});});};exports['ShowSugarcrmAccount']=function(_0x3a6928){var _0x3fb341=this;return new Promise(function(_0x333257,_0x1eec53){return db['SugarcrmAccount'][_0xb088('0x1e')]({'raw':_0x3a6928[_0xb088('0x15')]?_0x3a6928[_0xb088('0x15')][_0xb088('0x16')]===undefined?!![]:![]:!![],'where':_0x3a6928[_0xb088('0x15')]?_0x3a6928[_0xb088('0x15')][_0xb088('0x1f')]||null:null,'attributes':_0x3a6928[_0xb088('0x15')]?_0x3a6928[_0xb088('0x15')]['attributes']||null:null,'include':_0x3a6928[_0xb088('0x15')]?_0x3a6928[_0xb088('0x15')][_0xb088('0x18')]?_['map'](_0x3a6928[_0xb088('0x15')][_0xb088('0x18')],function(_0x2d1ba0){return{'model':db[_0x2d1ba0['model']],'as':_0x2d1ba0['as'],'attributes':_0x2d1ba0[_0xb088('0x1b')],'include':_0x2d1ba0[_0xb088('0x18')]?_['map'](_0x2d1ba0[_0xb088('0x18')],function(_0x4f7fff){return{'model':db[_0x4f7fff[_0xb088('0x1a')]],'as':_0x4f7fff['as'],'attributes':_0x4f7fff['attributes'],'include':_0x4f7fff[_0xb088('0x18')]?_[_0xb088('0x19')](_0x4f7fff['include'],function(_0x2ac71a){return{'model':db[_0x2ac71a['model']],'as':_0x2ac71a['as'],'attributes':_0x2ac71a[_0xb088('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xb088('0x1c')](function(_0x381331){logger['info'](_0xb088('0x20'),_0x3a6928);logger[_0xb088('0xb')]('ShowSugarcrmAccount',_0x3a6928,JSON[_0xb088('0xe')](_0x381331));_0x333257(_0x381331);})[_0xb088('0x21')](function(_0x4eb536){logger[_0xb088('0xf')](_0xb088('0x20'),_0x4eb536['message'],_0x3a6928);_0x1eec53(_0x3fb341[_0xb088('0xf')](0x1f4,_0x4eb536[_0xb088('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index bd78cea..6b3c596 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 _0xa153=['/:id/descriptions','getDescriptions','post','create','update','delete','destroy','exports','path','express','../../components/interaction/service','get','index','/:id','isAuthenticated','show','getFields','/:id/subjects','getSubjects'];(function(_0x2706da,_0x3856f5){var _0x3ba87e=function(_0x479a79){while(--_0x479a79){_0x2706da['push'](_0x2706da['shift']());}};_0x3ba87e(++_0x3856f5);}(_0xa153,0xb3));var _0x3a15=function(_0x54cf5e,_0xaa57c5){_0x54cf5e=_0x54cf5e-0x0;var _0x179169=_0xa153[_0x54cf5e];return _0x179169;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3a15('0x0'));var timeout=require('connect-timeout');var express=require(_0x3a15('0x1'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x3a15('0x2'));var config=require('../../config/environment');var controller=require('./intSugarcrmConfiguration.controller');router[_0x3a15('0x3')]('/',auth['isAuthenticated'](),controller[_0x3a15('0x4')]);router[_0x3a15('0x3')](_0x3a15('0x5'),auth[_0x3a15('0x6')](),controller[_0x3a15('0x7')]);router['get']('/:id/fields',auth['isAuthenticated'](),controller[_0x3a15('0x8')]);router['get'](_0x3a15('0x9'),auth[_0x3a15('0x6')](),controller[_0x3a15('0xa')]);router[_0x3a15('0x3')](_0x3a15('0xb'),auth[_0x3a15('0x6')](),controller[_0x3a15('0xc')]);router[_0x3a15('0xd')]('/',auth[_0x3a15('0x6')](),controller[_0x3a15('0xe')]);router['put']('/:id',auth[_0x3a15('0x6')](),controller[_0x3a15('0xf')]);router[_0x3a15('0x10')](_0x3a15('0x5'),auth[_0x3a15('0x6')](),controller[_0x3a15('0x11')]);module[_0x3a15('0x12')]=router; \ No newline at end of file +var _0x357c=['post','put','/:id','update','delete','destroy','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','get','isAuthenticated','index','show','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions'];(function(_0x10004e,_0xd701e6){var _0x5af990=function(_0x4bab6a){while(--_0x4bab6a){_0x10004e['push'](_0x10004e['shift']());}};_0x5af990(++_0xd701e6);}(_0x357c,0x1e7));var _0xc357=function(_0x13594e,_0x6f0ed0){_0x13594e=_0x13594e-0x0;var _0x1a4f42=_0x357c[_0x13594e];return _0x1a4f42;};'use strict';var multer=require(_0xc357('0x0'));var util=require('util');var path=require(_0xc357('0x1'));var timeout=require(_0xc357('0x2'));var express=require('express');var router=express[_0xc357('0x3')]();var auth=require(_0xc357('0x4'));var interaction=require(_0xc357('0x5'));var config=require(_0xc357('0x6'));var controller=require(_0xc357('0x7'));router[_0xc357('0x8')]('/',auth[_0xc357('0x9')](),controller[_0xc357('0xa')]);router[_0xc357('0x8')]('/:id',auth[_0xc357('0x9')](),controller[_0xc357('0xb')]);router['get']('/:id/fields',auth[_0xc357('0x9')](),controller[_0xc357('0xc')]);router[_0xc357('0x8')](_0xc357('0xd'),auth[_0xc357('0x9')](),controller[_0xc357('0xe')]);router['get'](_0xc357('0xf'),auth[_0xc357('0x9')](),controller[_0xc357('0x10')]);router[_0xc357('0x11')]('/',auth[_0xc357('0x9')](),controller['create']);router[_0xc357('0x12')](_0xc357('0x13'),auth['isAuthenticated'](),controller[_0xc357('0x14')]);router[_0xc357('0x15')](_0xc357('0x13'),auth[_0xc357('0x9')](),controller[_0xc357('0x16')]);module[_0xc357('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 cde039f..1f7926e 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 _0x17d9=['sequelize','exports','STRING'];(function(_0x173f10,_0x35db61){var _0x53142d=function(_0x37bbef){while(--_0x37bbef){_0x173f10['push'](_0x173f10['shift']());}};_0x53142d(++_0x35db61);}(_0x17d9,0xb1));var _0x917d=function(_0x50f392,_0x1d8441){_0x50f392=_0x50f392-0x0;var _0x5926f2=_0x17d9[_0x50f392];return _0x5926f2;};'use strict';var Sequelize=require(_0x917d('0x0'));module[_0x917d('0x1')]={'name':{'type':Sequelize[_0x917d('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xc6bb=['exports','STRING','sequelize'];(function(_0x1f2390,_0x5d3f5f){var _0xe19912=function(_0x185653){while(--_0x185653){_0x1f2390['push'](_0x1f2390['shift']());}};_0xe19912(++_0x5d3f5f);}(_0xc6bb,0x8f));var _0xbc6b=function(_0x533747,_0x2c2225){_0x533747=_0x533747-0x0;var _0x4fda7b=_0xc6bb[_0x533747];return _0x4fda7b;};'use strict';var Sequelize=require(_0xbc6b('0x0'));module[_0xbc6b('0x1')]={'name':{'type':Sequelize[_0xbc6b('0x2')]},'description':{'type':Sequelize[_0xbc6b('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index 80a93e2..943e255 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 _0x532a=['stringify','error','message','result','catch','sendStatus','status','end','json','count','offset','set','reject','save','destroy','stack','name','map','SugarcrmConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','rows','create','body','find','params','getFields','findOne','getSubjects','SugarcrmField','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../mysqldb','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x3d87bd,_0x108926){var _0x99337c=function(_0x298eb0){while(--_0x298eb0){_0x3d87bd['push'](_0x3d87bd['shift']());}};_0x99337c(++_0x108926);}(_0x532a,0x8f));var _0xa532=function(_0xdaab62,_0x2728ab){_0xdaab62=_0xdaab62-0x0;var _0x13d767=_0x532a[_0xdaab62];return _0x13d767;};'use strict';var pdf=require(_0xa532('0x0'));var emlformat=require(_0xa532('0x1'));var rimraf=require(_0xa532('0x2'));var zipdir=require(_0xa532('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa532('0x4'));var moment=require(_0xa532('0x5'));var BPromise=require(_0xa532('0x6'));var Mustache=require(_0xa532('0x7'));var util=require(_0xa532('0x8'));var path=require(_0xa532('0x9'));var sox=require(_0xa532('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xa532('0xb'));var squel=require(_0xa532('0xc'));var crypto=require(_0xa532('0xd'));var jsforce=require(_0xa532('0xe'));var deskjs=require(_0xa532('0xf'));var toCsv=require(_0xa532('0x10'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xa532('0x11'));var authService=require(_0xa532('0x12'));var qs=require(_0xa532('0x13'));var as=require(_0xa532('0x14'));var hardwareService=require(_0xa532('0x15'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xa532('0x16'));var db=require(_0xa532('0x17'))['db'];var jayson=require(_0xa532('0x18'));var client=jayson[_0xa532('0x19')][_0xa532('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x15f53a,_0x2d68bc,_0x3883cc){if(_0x3883cc){var _0x187b49=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x187b49[_0xa532('0x1b')](_0x2d68bc)){return _0x15f53a;}else{throw new db[(_0xa532('0x1c'))][(_0xa532('0x1d'))](_0xa532('0x1e'));}}else{return _0x15f53a;}}function respondWithRpcPromise(_0x1e1787,_0x42790a,_0xe4fe26,_0x148cb3){return new BPromise(function(_0xb8a34f,_0x1197c5){var _0x14240b=_0x148cb3||client;return _0x14240b['request'](_0x1e1787,_0xe4fe26)[_0xa532('0x1f')](function(_0x45ae8f){logger[_0xa532('0x20')](_0xa532('0x21'),_0x42790a,_0xa532('0x22'));logger[_0xa532('0x23')](_0xa532('0x24'),_0x42790a,'request\x20sent',JSON[_0xa532('0x25')](_0x45ae8f));if(_0x45ae8f[_0xa532('0x26')]){if(_0x45ae8f['error']['code']===0x1f4){logger[_0xa532('0x26')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x42790a,_0x45ae8f[_0xa532('0x26')][_0xa532('0x27')]);return _0x1197c5(_0x45ae8f['error'][_0xa532('0x27')]);}logger[_0xa532('0x26')](_0xa532('0x21'),_0x42790a,_0x45ae8f[_0xa532('0x26')]['message']);return _0xb8a34f(_0x45ae8f[_0xa532('0x26')][_0xa532('0x27')]);}else{logger[_0xa532('0x20')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x42790a,_0xa532('0x22'));_0xb8a34f(_0x45ae8f[_0xa532('0x28')][_0xa532('0x27')]);}})[_0xa532('0x29')](function(_0x3b5670){logger[_0xa532('0x26')](_0xa532('0x21'),_0x42790a,_0x3b5670);_0x1197c5(_0x3b5670);});});}function respondWithStatusCode(_0x54424a,_0x1a15b4){_0x1a15b4=_0x1a15b4||0xcc;return function(_0x4a1890){if(_0x4a1890){return _0x54424a[_0xa532('0x2a')](_0x1a15b4);}return _0x54424a[_0xa532('0x2b')](_0x1a15b4)[_0xa532('0x2c')]();};}function respondWithResult(_0x565359,_0x43e17e){_0x43e17e=_0x43e17e||0xc8;return function(_0x11500a){if(_0x11500a){return _0x565359[_0xa532('0x2b')](_0x43e17e)[_0xa532('0x2d')](_0x11500a);}};}function respondWithFilteredResult(_0x449773,_0x8546fe){return function(_0x37066c){if(_0x37066c){var _0xf11b9f=_0x37066c[_0xa532('0x2e')],_0x4ee90c=_0x8546fe[_0xa532('0x2f')],_0x1f02ce=_0x8546fe['offset']+_0x8546fe['limit'],_0x4ec9df;if(_0x1f02ce>=_0xf11b9f){_0x1f02ce=_0xf11b9f;_0x4ec9df=0xc8;}else{_0x4ec9df=0xce;}_0x449773[_0xa532('0x2b')](_0x4ec9df);return _0x449773[_0xa532('0x30')]('Content-Range',_0x4ee90c+'-'+_0x1f02ce+'/'+_0xf11b9f)['json'](_0x37066c);}return null;};}function patchUpdates(_0xa53d8f){return function(_0x598e35){try{jsonpatch['apply'](_0x598e35,_0xa53d8f,!![]);}catch(_0xca9e09){return BPromise[_0xa532('0x31')](_0xca9e09);}return _0x598e35[_0xa532('0x32')]();};}function saveUpdates(_0x169420,_0x676ecf){return function(_0x1795b1){if(_0x1795b1){return _0x1795b1['update'](_0x169420)[_0xa532('0x1f')](function(_0x653aa0){return _0x653aa0;});}return null;};}function removeEntity(_0x2dc71d,_0x53a94b){return function(_0xf7c92d){if(_0xf7c92d){return _0xf7c92d[_0xa532('0x33')]()[_0xa532('0x1f')](function(){_0x2dc71d[_0xa532('0x2b')](0xcc)[_0xa532('0x2c')]();});}};}function handleEntityNotFound(_0x4651ea,_0x58164b){return function(_0x5e228d){if(!_0x5e228d){_0x4651ea[_0xa532('0x2a')](0x194);}return _0x5e228d;};}function handleError(_0x59e9cb,_0x24ea3d){_0x24ea3d=_0x24ea3d||0x1f4;return function(_0x5405e8){logger[_0xa532('0x26')](_0x5405e8[_0xa532('0x34')]);if(_0x5405e8['name']){delete _0x5405e8[_0xa532('0x35')];}_0x59e9cb[_0xa532('0x2b')](_0x24ea3d)['send'](_0x5405e8);};}exports['index']=function(_0x352fc8,_0x4744c5){var _0x743771={},_0x5b45dc={},_0x41be8b={'count':0x0,'rows':[]};var _0x3b2919=_[_0xa532('0x36')](db[_0xa532('0x37')][_0xa532('0x38')],function(_0x3a7e0e){return{'name':_0x3a7e0e[_0xa532('0x39')],'type':_0x3a7e0e[_0xa532('0x3a')][_0xa532('0x3b')]};});_0x5b45dc[_0xa532('0x3c')]=_[_0xa532('0x36')](_0x3b2919,_0xa532('0x35'));_0x5b45dc[_0xa532('0x3d')]=_[_0xa532('0x3e')](_0x352fc8[_0xa532('0x3d')]);_0x5b45dc[_0xa532('0x3f')]=_['intersection'](_0x5b45dc[_0xa532('0x3c')],_0x5b45dc[_0xa532('0x3d')]);_0x743771['attributes']=_[_0xa532('0x40')](_0x5b45dc[_0xa532('0x3c')],qs[_0xa532('0x41')](_0x352fc8['query'][_0xa532('0x41')]));_0x743771['attributes']=_0x743771[_0xa532('0x42')][_0xa532('0x43')]?_0x743771[_0xa532('0x42')]:_0x5b45dc[_0xa532('0x3c')];if(!_0x352fc8[_0xa532('0x3d')][_0xa532('0x44')](_0xa532('0x45'))){_0x743771[_0xa532('0x46')]=qs[_0xa532('0x46')](_0x352fc8[_0xa532('0x3d')]['limit']);_0x743771[_0xa532('0x2f')]=qs[_0xa532('0x2f')](_0x352fc8[_0xa532('0x3d')][_0xa532('0x2f')]);}_0x743771[_0xa532('0x47')]=qs['sort'](_0x352fc8[_0xa532('0x3d')][_0xa532('0x48')]);_0x743771['where']=qs[_0xa532('0x3f')](_[_0xa532('0x49')](_0x352fc8[_0xa532('0x3d')],_0x5b45dc[_0xa532('0x3f')]));if(_0x352fc8[_0xa532('0x3d')]['filter']){_0x743771[_0xa532('0x4a')]=_[_0xa532('0x4b')](_0x743771[_0xa532('0x4a')],{'$or':_[_0xa532('0x36')](_0x3b2919,function(_0x3556c0){if(_0x3556c0[_0xa532('0x3a')]!==_0xa532('0x4c')){var _0x2d891c={};_0x2d891c[_0x3556c0[_0xa532('0x35')]]={'$like':'%'+_0x352fc8[_0xa532('0x3d')][_0xa532('0x4d')]+'%'};return _0x2d891c;}})});}_0x743771=_[_0xa532('0x4b')]({},_0x743771,_0x352fc8[_0xa532('0x4e')]);var _0x2d8019={'where':_0x743771['where']};return db[_0xa532('0x37')]['count'](_0x2d8019)[_0xa532('0x1f')](function(_0x48a4b5){_0x41be8b[_0xa532('0x2e')]=_0x48a4b5;if(_0x352fc8[_0xa532('0x3d')][_0xa532('0x4f')]){_0x743771['include']=[{'all':!![]}];}return db['SugarcrmConfiguration']['findAll'](_0x743771);})[_0xa532('0x1f')](function(_0x5a8fd9){_0x41be8b[_0xa532('0x50')]=_0x5a8fd9;return _0x41be8b;})[_0xa532('0x1f')](respondWithFilteredResult(_0x4744c5,_0x743771))[_0xa532('0x29')](handleError(_0x4744c5,null));};exports['show']=function(_0x3f7339,_0x46df12){var _0x420a69={'raw':![],'where':{'id':_0x3f7339['params']['id']}},_0x26036a={};_0x26036a[_0xa532('0x3c')]=_[_0xa532('0x3e')](db['SugarcrmConfiguration'][_0xa532('0x38')]);_0x26036a['query']=_['keys'](_0x3f7339[_0xa532('0x3d')]);_0x26036a['filters']=_[_0xa532('0x40')](_0x26036a[_0xa532('0x3c')],_0x26036a['query']);_0x420a69['attributes']=_[_0xa532('0x40')](_0x26036a[_0xa532('0x3c')],qs['fields'](_0x3f7339[_0xa532('0x3d')][_0xa532('0x41')]));_0x420a69['attributes']=_0x420a69[_0xa532('0x42')]['length']?_0x420a69[_0xa532('0x42')]:_0x26036a[_0xa532('0x3c')];if(_0x3f7339[_0xa532('0x3d')][_0xa532('0x4f')]){_0x420a69['include']=[{'all':!![]}];}_0x420a69=_[_0xa532('0x4b')]({},_0x420a69,_0x3f7339['options']);return db[_0xa532('0x37')]['find'](_0x420a69)[_0xa532('0x1f')](handleEntityNotFound(_0x46df12,null))[_0xa532('0x1f')](respondWithResult(_0x46df12,null))[_0xa532('0x29')](handleError(_0x46df12,null));};exports[_0xa532('0x51')]=function(_0x127796,_0x3a2049){return db[_0xa532('0x37')][_0xa532('0x51')](_0x127796[_0xa532('0x52')],{})[_0xa532('0x1f')](respondWithResult(_0x3a2049,0xc9))[_0xa532('0x29')](handleError(_0x3a2049,null));};exports['update']=function(_0x2a0670,_0x1a8d23){if(_0x2a0670[_0xa532('0x52')]['id']){delete _0x2a0670[_0xa532('0x52')]['id'];}return db['SugarcrmConfiguration'][_0xa532('0x53')]({'where':{'id':_0x2a0670[_0xa532('0x54')]['id']}})[_0xa532('0x1f')](handleEntityNotFound(_0x1a8d23,null))[_0xa532('0x1f')](saveUpdates(_0x2a0670[_0xa532('0x52')],null))['then'](respondWithResult(_0x1a8d23,null))[_0xa532('0x29')](handleError(_0x1a8d23,null));};exports[_0xa532('0x33')]=function(_0x4b32de,_0x4ae0c4){return db[_0xa532('0x37')][_0xa532('0x53')]({'where':{'id':_0x4b32de[_0xa532('0x54')]['id']}})[_0xa532('0x1f')](handleEntityNotFound(_0x4ae0c4,null))[_0xa532('0x1f')](removeEntity(_0x4ae0c4,null))[_0xa532('0x29')](handleError(_0x4ae0c4,null));};exports[_0xa532('0x55')]=function(_0x45a731,_0xa4c905,_0x4def9e){var _0x3253c5={};var _0x2a7936={};var _0x20e639;var _0x48f0c2;return db[_0xa532('0x37')][_0xa532('0x56')]({'where':{'id':_0x45a731['params']['id']}})['then'](handleEntityNotFound(_0xa4c905,null))['then'](function(_0x4d31bc){if(_0x4d31bc){_0x20e639=_0x4d31bc;_0x2a7936['model']=_[_0xa532('0x3e')](db['SugarcrmField'][_0xa532('0x38')]);_0x2a7936[_0xa532('0x3d')]=_[_0xa532('0x3e')](_0x45a731[_0xa532('0x3d')]);_0x2a7936[_0xa532('0x3f')]=_[_0xa532('0x40')](_0x2a7936[_0xa532('0x3c')],_0x2a7936[_0xa532('0x3d')]);_0x3253c5[_0xa532('0x42')]=_[_0xa532('0x40')](_0x2a7936['model'],qs[_0xa532('0x41')](_0x45a731[_0xa532('0x3d')][_0xa532('0x41')]));_0x3253c5[_0xa532('0x42')]=_0x3253c5['attributes'][_0xa532('0x43')]?_0x3253c5['attributes']:_0x2a7936['model'];_0x3253c5[_0xa532('0x47')]=qs[_0xa532('0x48')](_0x45a731[_0xa532('0x3d')][_0xa532('0x48')]);_0x3253c5[_0xa532('0x4a')]=qs[_0xa532('0x3f')](_[_0xa532('0x49')](_0x45a731[_0xa532('0x3d')],_0x2a7936[_0xa532('0x3f')]));if(_0x45a731[_0xa532('0x3d')]['filter']){_0x3253c5[_0xa532('0x4a')]=_['merge'](_0x3253c5[_0xa532('0x4a')],{'$or':_[_0xa532('0x36')](_0x3253c5[_0xa532('0x42')],function(_0x1c0b76){var _0x4c2335={};_0x4c2335[_0x1c0b76]={'$like':'%'+_0x45a731[_0xa532('0x3d')]['filter']+'%'};return _0x4c2335;})});}_0x3253c5=_[_0xa532('0x4b')]({},_0x3253c5,_0x45a731[_0xa532('0x4e')]);return _0x20e639[_0xa532('0x55')](_0x3253c5);}})[_0xa532('0x1f')](function(_0x1d4c88){if(_0x1d4c88){_0x48f0c2=_0x1d4c88[_0xa532('0x43')];if(!_0x45a731[_0xa532('0x3d')][_0xa532('0x44')](_0xa532('0x45'))){_0x3253c5['limit']=qs[_0xa532('0x46')](_0x45a731[_0xa532('0x3d')]['limit']);_0x3253c5[_0xa532('0x2f')]=qs['offset'](_0x45a731['query'][_0xa532('0x2f')]);}return _0x20e639['getFields'](_0x3253c5);}})[_0xa532('0x1f')](function(_0x271d54){if(_0x271d54){return _0x271d54?{'count':_0x48f0c2,'rows':_0x271d54}:null;}})[_0xa532('0x1f')](respondWithResult(_0xa4c905,null))[_0xa532('0x29')](handleError(_0xa4c905,null));};exports[_0xa532('0x57')]=function(_0x323d27,_0x3639f0,_0x304450){var _0x3805e3={};var _0x180c4c={};var _0x3b7ea9;var _0x1298b2;return db[_0xa532('0x37')][_0xa532('0x56')]({'where':{'id':_0x323d27[_0xa532('0x54')]['id']}})[_0xa532('0x1f')](handleEntityNotFound(_0x3639f0,null))[_0xa532('0x1f')](function(_0x367994){if(_0x367994){_0x3b7ea9=_0x367994;_0x180c4c[_0xa532('0x3c')]=_[_0xa532('0x3e')](db[_0xa532('0x58')][_0xa532('0x38')]);_0x180c4c[_0xa532('0x3d')]=_['keys'](_0x323d27['query']);_0x180c4c[_0xa532('0x3f')]=_[_0xa532('0x40')](_0x180c4c[_0xa532('0x3c')],_0x180c4c['query']);_0x3805e3[_0xa532('0x42')]=_[_0xa532('0x40')](_0x180c4c[_0xa532('0x3c')],qs[_0xa532('0x41')](_0x323d27[_0xa532('0x3d')][_0xa532('0x41')]));_0x3805e3[_0xa532('0x42')]=_0x3805e3[_0xa532('0x42')][_0xa532('0x43')]?_0x3805e3['attributes']:_0x180c4c['model'];_0x3805e3[_0xa532('0x47')]=qs['sort'](_0x323d27['query']['sort']);_0x3805e3[_0xa532('0x4a')]=qs[_0xa532('0x3f')](_['pick'](_0x323d27[_0xa532('0x3d')],_0x180c4c[_0xa532('0x3f')]));if(_0x323d27['query'][_0xa532('0x4d')]){_0x3805e3[_0xa532('0x4a')]=_[_0xa532('0x4b')](_0x3805e3[_0xa532('0x4a')],{'$or':_[_0xa532('0x36')](_0x3805e3[_0xa532('0x42')],function(_0x4273e4){var _0x14904c={};_0x14904c[_0x4273e4]={'$like':'%'+_0x323d27['query']['filter']+'%'};return _0x14904c;})});}_0x3805e3=_[_0xa532('0x4b')]({},_0x3805e3,_0x323d27['options']);return _0x3b7ea9[_0xa532('0x57')](_0x3805e3);}})[_0xa532('0x1f')](function(_0x456bee){if(_0x456bee){_0x1298b2=_0x456bee[_0xa532('0x43')];if(!_0x323d27[_0xa532('0x3d')][_0xa532('0x44')](_0xa532('0x45'))){_0x3805e3['limit']=qs[_0xa532('0x46')](_0x323d27[_0xa532('0x3d')]['limit']);_0x3805e3[_0xa532('0x2f')]=qs[_0xa532('0x2f')](_0x323d27[_0xa532('0x3d')][_0xa532('0x2f')]);}return _0x3b7ea9[_0xa532('0x57')](_0x3805e3);}})['then'](function(_0x216853){if(_0x216853){return _0x216853?{'count':_0x1298b2,'rows':_0x216853}:null;}})[_0xa532('0x1f')](respondWithResult(_0x3639f0,null))[_0xa532('0x29')](handleError(_0x3639f0,null));};exports[_0xa532('0x59')]=function(_0x313d5c,_0x32ff4d,_0x2b32aa){var _0x17a333={};var _0x211b67={};var _0x338aa9;var _0x192952;return db[_0xa532('0x37')][_0xa532('0x56')]({'where':{'id':_0x313d5c['params']['id']}})[_0xa532('0x1f')](handleEntityNotFound(_0x32ff4d,null))[_0xa532('0x1f')](function(_0x1382c6){if(_0x1382c6){_0x338aa9=_0x1382c6;_0x211b67[_0xa532('0x3c')]=_[_0xa532('0x3e')](db['SugarcrmField'][_0xa532('0x38')]);_0x211b67[_0xa532('0x3d')]=_[_0xa532('0x3e')](_0x313d5c['query']);_0x211b67[_0xa532('0x3f')]=_['intersection'](_0x211b67['model'],_0x211b67[_0xa532('0x3d')]);_0x17a333[_0xa532('0x42')]=_[_0xa532('0x40')](_0x211b67[_0xa532('0x3c')],qs['fields'](_0x313d5c[_0xa532('0x3d')][_0xa532('0x41')]));_0x17a333[_0xa532('0x42')]=_0x17a333[_0xa532('0x42')][_0xa532('0x43')]?_0x17a333[_0xa532('0x42')]:_0x211b67[_0xa532('0x3c')];_0x17a333[_0xa532('0x47')]=qs['sort'](_0x313d5c[_0xa532('0x3d')][_0xa532('0x48')]);_0x17a333[_0xa532('0x4a')]=qs[_0xa532('0x3f')](_[_0xa532('0x49')](_0x313d5c[_0xa532('0x3d')],_0x211b67[_0xa532('0x3f')]));if(_0x313d5c[_0xa532('0x3d')][_0xa532('0x4d')]){_0x17a333[_0xa532('0x4a')]=_[_0xa532('0x4b')](_0x17a333[_0xa532('0x4a')],{'$or':_['map'](_0x17a333[_0xa532('0x42')],function(_0x55a66f){var _0x16cd6a={};_0x16cd6a[_0x55a66f]={'$like':'%'+_0x313d5c[_0xa532('0x3d')][_0xa532('0x4d')]+'%'};return _0x16cd6a;})});}_0x17a333=_[_0xa532('0x4b')]({},_0x17a333,_0x313d5c[_0xa532('0x4e')]);return _0x338aa9[_0xa532('0x59')](_0x17a333);}})[_0xa532('0x1f')](function(_0x419182){if(_0x419182){_0x192952=_0x419182[_0xa532('0x43')];if(!_0x313d5c[_0xa532('0x3d')][_0xa532('0x44')](_0xa532('0x45'))){_0x17a333[_0xa532('0x46')]=qs[_0xa532('0x46')](_0x313d5c[_0xa532('0x3d')][_0xa532('0x46')]);_0x17a333['offset']=qs[_0xa532('0x2f')](_0x313d5c[_0xa532('0x3d')][_0xa532('0x2f')]);}return _0x338aa9['getDescriptions'](_0x17a333);}})['then'](function(_0x2bad58){if(_0x2bad58){return _0x2bad58?{'count':_0x192952,'rows':_0x2bad58}:null;}})[_0xa532('0x1f')](respondWithResult(_0x32ff4d,null))['catch'](handleError(_0x32ff4d,null));}; \ No newline at end of file +var _0xa396=['mustache','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','jayson/promise','client','http','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','status','count','offset','set','reject','save','update','destroy','name','index','map','SugarcrmConfiguration','type','model','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','show','params','keys','fields','include','body','find','getFields','findOne','SugarcrmField','rawAttributes','getSubjects','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x50db40,_0x2c2bdc){var _0x1cb894=function(_0x5dd8ca){while(--_0x5dd8ca){_0x50db40['push'](_0x50db40['shift']());}};_0x1cb894(++_0x2c2bdc);}(_0xa396,0x109));var _0x6a39=function(_0x1e20f5,_0x2f2e0d){_0x1e20f5=_0x1e20f5-0x0;var _0x581060=_0xa396[_0x1e20f5];return _0x581060;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x6a39('0x0'));var zipdir=require(_0x6a39('0x1'));var jsonpatch=require(_0x6a39('0x2'));var rp=require(_0x6a39('0x3'));var moment=require(_0x6a39('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x6a39('0x5'));var util=require(_0x6a39('0x6'));var path=require(_0x6a39('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x6a39('0x8'));var fs=require('fs');var _=require(_0x6a39('0x9'));var squel=require(_0x6a39('0xa'));var crypto=require(_0x6a39('0xb'));var jsforce=require(_0x6a39('0xc'));var deskjs=require(_0x6a39('0xd'));var toCsv=require(_0x6a39('0xe'));var querystring=require(_0x6a39('0xf'));var Papa=require(_0x6a39('0x10'));var Redis=require(_0x6a39('0x11'));var authService=require(_0x6a39('0x12'));var qs=require(_0x6a39('0x13'));var as=require(_0x6a39('0x14'));var hardwareService=require(_0x6a39('0x15'));var logger=require(_0x6a39('0x16'))(_0x6a39('0x17'));var utils=require('../../config/utils');var config=require(_0x6a39('0x18'));var db=require(_0x6a39('0x19'))['db'];var jayson=require(_0x6a39('0x1a'));var client=jayson[_0x6a39('0x1b')][_0x6a39('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x3b1514,_0x4353cd,_0x339a8b){if(_0x339a8b){var _0x4e55f2=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4e55f2['test'](_0x4353cd)){return _0x3b1514;}else{throw new db['Sequelize'][(_0x6a39('0x1d'))](_0x6a39('0x1e'));}}else{return _0x3b1514;}}function respondWithRpcPromise(_0x240345,_0x191d2b,_0x2f458d,_0x533937){return new BPromise(function(_0x571a01,_0xedbd02){var _0x5e29fd=_0x533937||client;return _0x5e29fd[_0x6a39('0x1f')](_0x240345,_0x2f458d)[_0x6a39('0x20')](function(_0x21bc00){logger[_0x6a39('0x21')](_0x6a39('0x22'),_0x191d2b,_0x6a39('0x23'));logger[_0x6a39('0x24')](_0x6a39('0x25'),_0x191d2b,'request\x20sent',JSON[_0x6a39('0x26')](_0x21bc00));if(_0x21bc00['error']){if(_0x21bc00[_0x6a39('0x27')][_0x6a39('0x28')]===0x1f4){logger[_0x6a39('0x27')](_0x6a39('0x22'),_0x191d2b,_0x21bc00[_0x6a39('0x27')][_0x6a39('0x29')]);return _0xedbd02(_0x21bc00['error'][_0x6a39('0x29')]);}logger['error']('SugarcrmConfiguration,\x20%s,\x20%s',_0x191d2b,_0x21bc00['error'][_0x6a39('0x29')]);return _0x571a01(_0x21bc00['error'][_0x6a39('0x29')]);}else{logger[_0x6a39('0x21')](_0x6a39('0x22'),_0x191d2b,_0x6a39('0x23'));_0x571a01(_0x21bc00[_0x6a39('0x2a')][_0x6a39('0x29')]);}})[_0x6a39('0x2b')](function(_0x2c423d){logger['error'](_0x6a39('0x22'),_0x191d2b,_0x2c423d);_0xedbd02(_0x2c423d);});});}function respondWithStatusCode(_0x3f66d1,_0x566fd0){_0x566fd0=_0x566fd0||0xcc;return function(_0x1b9615){if(_0x1b9615){return _0x3f66d1[_0x6a39('0x2c')](_0x566fd0);}return _0x3f66d1['status'](_0x566fd0)[_0x6a39('0x2d')]();};}function respondWithResult(_0xd034ce,_0x20b85a){_0x20b85a=_0x20b85a||0xc8;return function(_0x257542){if(_0x257542){return _0xd034ce[_0x6a39('0x2e')](_0x20b85a)['json'](_0x257542);}};}function respondWithFilteredResult(_0x242286,_0xaee151){return function(_0x4bcf04){if(_0x4bcf04){var _0x26aee8=_0x4bcf04[_0x6a39('0x2f')],_0x1fa877=_0xaee151[_0x6a39('0x30')],_0x490e04=_0xaee151[_0x6a39('0x30')]+_0xaee151['limit'],_0x5edd83;if(_0x490e04>=_0x26aee8){_0x490e04=_0x26aee8;_0x5edd83=0xc8;}else{_0x5edd83=0xce;}_0x242286[_0x6a39('0x2e')](_0x5edd83);return _0x242286[_0x6a39('0x31')]('Content-Range',_0x1fa877+'-'+_0x490e04+'/'+_0x26aee8)['json'](_0x4bcf04);}return null;};}function patchUpdates(_0x57cd73){return function(_0x3ee1c1){try{jsonpatch['apply'](_0x3ee1c1,_0x57cd73,!![]);}catch(_0x371c91){return BPromise[_0x6a39('0x32')](_0x371c91);}return _0x3ee1c1[_0x6a39('0x33')]();};}function saveUpdates(_0x2d3916,_0x2228f1){return function(_0x29250c){if(_0x29250c){return _0x29250c[_0x6a39('0x34')](_0x2d3916)['then'](function(_0x1c5eb4){return _0x1c5eb4;});}return null;};}function removeEntity(_0x10e358,_0x5d892f){return function(_0x2e35d1){if(_0x2e35d1){return _0x2e35d1[_0x6a39('0x35')]()['then'](function(){_0x10e358['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2305f2,_0x23fac4){return function(_0x1c16f5){if(!_0x1c16f5){_0x2305f2[_0x6a39('0x2c')](0x194);}return _0x1c16f5;};}function handleError(_0x42cab1,_0x2fa85a){_0x2fa85a=_0x2fa85a||0x1f4;return function(_0x615a20){logger[_0x6a39('0x27')](_0x615a20['stack']);if(_0x615a20[_0x6a39('0x36')]){delete _0x615a20[_0x6a39('0x36')];}_0x42cab1['status'](_0x2fa85a)['send'](_0x615a20);};}exports[_0x6a39('0x37')]=function(_0x3ebae6,_0x53a5b6){var _0x68b80a={},_0x4d7c52={},_0x10f1da={'count':0x0,'rows':[]};var _0x48b335=_[_0x6a39('0x38')](db[_0x6a39('0x39')]['rawAttributes'],function(_0x2ce000){return{'name':_0x2ce000['fieldName'],'type':_0x2ce000[_0x6a39('0x3a')]['key']};});_0x4d7c52[_0x6a39('0x3b')]=_['map'](_0x48b335,_0x6a39('0x36'));_0x4d7c52[_0x6a39('0x3c')]=_['keys'](_0x3ebae6[_0x6a39('0x3c')]);_0x4d7c52[_0x6a39('0x3d')]=_['intersection'](_0x4d7c52[_0x6a39('0x3b')],_0x4d7c52[_0x6a39('0x3c')]);_0x68b80a['attributes']=_[_0x6a39('0x3e')](_0x4d7c52[_0x6a39('0x3b')],qs['fields'](_0x3ebae6[_0x6a39('0x3c')]['fields']));_0x68b80a[_0x6a39('0x3f')]=_0x68b80a['attributes'][_0x6a39('0x40')]?_0x68b80a['attributes']:_0x4d7c52[_0x6a39('0x3b')];if(!_0x3ebae6['query'][_0x6a39('0x41')](_0x6a39('0x42'))){_0x68b80a[_0x6a39('0x43')]=qs[_0x6a39('0x43')](_0x3ebae6[_0x6a39('0x3c')]['limit']);_0x68b80a['offset']=qs[_0x6a39('0x30')](_0x3ebae6['query'][_0x6a39('0x30')]);}_0x68b80a[_0x6a39('0x44')]=qs[_0x6a39('0x45')](_0x3ebae6[_0x6a39('0x3c')]['sort']);_0x68b80a[_0x6a39('0x46')]=qs['filters'](_[_0x6a39('0x47')](_0x3ebae6[_0x6a39('0x3c')],_0x4d7c52[_0x6a39('0x3d')]));if(_0x3ebae6[_0x6a39('0x3c')][_0x6a39('0x48')]){_0x68b80a[_0x6a39('0x46')]=_[_0x6a39('0x49')](_0x68b80a[_0x6a39('0x46')],{'$or':_[_0x6a39('0x38')](_0x48b335,function(_0xaa66e7){if(_0xaa66e7[_0x6a39('0x3a')]!==_0x6a39('0x4a')){var _0xabec12={};_0xabec12[_0xaa66e7[_0x6a39('0x36')]]={'$like':'%'+_0x3ebae6[_0x6a39('0x3c')][_0x6a39('0x48')]+'%'};return _0xabec12;}})});}_0x68b80a=_[_0x6a39('0x49')]({},_0x68b80a,_0x3ebae6[_0x6a39('0x4b')]);var _0x5c9c2f={'where':_0x68b80a[_0x6a39('0x46')]};return db[_0x6a39('0x39')][_0x6a39('0x2f')](_0x5c9c2f)[_0x6a39('0x20')](function(_0x382716){_0x10f1da[_0x6a39('0x2f')]=_0x382716;if(_0x3ebae6[_0x6a39('0x3c')][_0x6a39('0x4c')]){_0x68b80a['include']=[{'all':!![]}];}return db['SugarcrmConfiguration']['findAll'](_0x68b80a);})[_0x6a39('0x20')](function(_0x59160b){_0x10f1da['rows']=_0x59160b;return _0x10f1da;})[_0x6a39('0x20')](respondWithFilteredResult(_0x53a5b6,_0x68b80a))['catch'](handleError(_0x53a5b6,null));};exports[_0x6a39('0x4d')]=function(_0x14b0ba,_0x1cab3e){var _0x56801f={'raw':![],'where':{'id':_0x14b0ba[_0x6a39('0x4e')]['id']}},_0x5d822d={};_0x5d822d[_0x6a39('0x3b')]=_[_0x6a39('0x4f')](db['SugarcrmConfiguration']['rawAttributes']);_0x5d822d[_0x6a39('0x3c')]=_['keys'](_0x14b0ba['query']);_0x5d822d[_0x6a39('0x3d')]=_['intersection'](_0x5d822d[_0x6a39('0x3b')],_0x5d822d[_0x6a39('0x3c')]);_0x56801f[_0x6a39('0x3f')]=_[_0x6a39('0x3e')](_0x5d822d[_0x6a39('0x3b')],qs[_0x6a39('0x50')](_0x14b0ba[_0x6a39('0x3c')][_0x6a39('0x50')]));_0x56801f['attributes']=_0x56801f[_0x6a39('0x3f')][_0x6a39('0x40')]?_0x56801f[_0x6a39('0x3f')]:_0x5d822d[_0x6a39('0x3b')];if(_0x14b0ba['query'][_0x6a39('0x4c')]){_0x56801f[_0x6a39('0x51')]=[{'all':!![]}];}_0x56801f=_['merge']({},_0x56801f,_0x14b0ba[_0x6a39('0x4b')]);return db[_0x6a39('0x39')]['find'](_0x56801f)[_0x6a39('0x20')](handleEntityNotFound(_0x1cab3e,null))[_0x6a39('0x20')](respondWithResult(_0x1cab3e,null))['catch'](handleError(_0x1cab3e,null));};exports['create']=function(_0x1be624,_0x331396){return db[_0x6a39('0x39')]['create'](_0x1be624[_0x6a39('0x52')],{})[_0x6a39('0x20')](respondWithResult(_0x331396,0xc9))[_0x6a39('0x2b')](handleError(_0x331396,null));};exports[_0x6a39('0x34')]=function(_0x54d0c3,_0x4b06cf){if(_0x54d0c3[_0x6a39('0x52')]['id']){delete _0x54d0c3[_0x6a39('0x52')]['id'];}return db[_0x6a39('0x39')][_0x6a39('0x53')]({'where':{'id':_0x54d0c3[_0x6a39('0x4e')]['id']}})[_0x6a39('0x20')](handleEntityNotFound(_0x4b06cf,null))[_0x6a39('0x20')](saveUpdates(_0x54d0c3[_0x6a39('0x52')],null))[_0x6a39('0x20')](respondWithResult(_0x4b06cf,null))['catch'](handleError(_0x4b06cf,null));};exports[_0x6a39('0x35')]=function(_0x4764dd,_0x5a3cf7){return db[_0x6a39('0x39')][_0x6a39('0x53')]({'where':{'id':_0x4764dd[_0x6a39('0x4e')]['id']}})[_0x6a39('0x20')](handleEntityNotFound(_0x5a3cf7,null))[_0x6a39('0x20')](removeEntity(_0x5a3cf7,null))[_0x6a39('0x2b')](handleError(_0x5a3cf7,null));};exports[_0x6a39('0x54')]=function(_0x5dcfe5,_0x149407,_0x467537){var _0x5a548f={};var _0x477b01={};var _0x49bba8;var _0x542357;return db[_0x6a39('0x39')][_0x6a39('0x55')]({'where':{'id':_0x5dcfe5['params']['id']}})[_0x6a39('0x20')](handleEntityNotFound(_0x149407,null))[_0x6a39('0x20')](function(_0x5bae50){if(_0x5bae50){_0x49bba8=_0x5bae50;_0x477b01['model']=_['keys'](db[_0x6a39('0x56')][_0x6a39('0x57')]);_0x477b01[_0x6a39('0x3c')]=_[_0x6a39('0x4f')](_0x5dcfe5['query']);_0x477b01[_0x6a39('0x3d')]=_[_0x6a39('0x3e')](_0x477b01[_0x6a39('0x3b')],_0x477b01[_0x6a39('0x3c')]);_0x5a548f[_0x6a39('0x3f')]=_[_0x6a39('0x3e')](_0x477b01[_0x6a39('0x3b')],qs[_0x6a39('0x50')](_0x5dcfe5[_0x6a39('0x3c')][_0x6a39('0x50')]));_0x5a548f['attributes']=_0x5a548f[_0x6a39('0x3f')]['length']?_0x5a548f[_0x6a39('0x3f')]:_0x477b01[_0x6a39('0x3b')];_0x5a548f[_0x6a39('0x44')]=qs['sort'](_0x5dcfe5[_0x6a39('0x3c')]['sort']);_0x5a548f[_0x6a39('0x46')]=qs[_0x6a39('0x3d')](_[_0x6a39('0x47')](_0x5dcfe5[_0x6a39('0x3c')],_0x477b01['filters']));if(_0x5dcfe5[_0x6a39('0x3c')][_0x6a39('0x48')]){_0x5a548f[_0x6a39('0x46')]=_[_0x6a39('0x49')](_0x5a548f[_0x6a39('0x46')],{'$or':_[_0x6a39('0x38')](_0x5a548f[_0x6a39('0x3f')],function(_0x185cb8){var _0x2db219={};_0x2db219[_0x185cb8]={'$like':'%'+_0x5dcfe5[_0x6a39('0x3c')][_0x6a39('0x48')]+'%'};return _0x2db219;})});}_0x5a548f=_[_0x6a39('0x49')]({},_0x5a548f,_0x5dcfe5['options']);return _0x49bba8[_0x6a39('0x54')](_0x5a548f);}})['then'](function(_0x2ff81d){if(_0x2ff81d){_0x542357=_0x2ff81d[_0x6a39('0x40')];if(!_0x5dcfe5[_0x6a39('0x3c')][_0x6a39('0x41')](_0x6a39('0x42'))){_0x5a548f[_0x6a39('0x43')]=qs['limit'](_0x5dcfe5[_0x6a39('0x3c')][_0x6a39('0x43')]);_0x5a548f[_0x6a39('0x30')]=qs[_0x6a39('0x30')](_0x5dcfe5[_0x6a39('0x3c')][_0x6a39('0x30')]);}return _0x49bba8['getFields'](_0x5a548f);}})['then'](function(_0x158e47){if(_0x158e47){return _0x158e47?{'count':_0x542357,'rows':_0x158e47}:null;}})[_0x6a39('0x20')](respondWithResult(_0x149407,null))[_0x6a39('0x2b')](handleError(_0x149407,null));};exports['getSubjects']=function(_0x3b0d79,_0x53b8dd,_0x2e25b6){var _0x36037f={};var _0x4f37b3={};var _0x3b72bb;var _0x1f138e;return db[_0x6a39('0x39')]['findOne']({'where':{'id':_0x3b0d79['params']['id']}})['then'](handleEntityNotFound(_0x53b8dd,null))[_0x6a39('0x20')](function(_0x20ffac){if(_0x20ffac){_0x3b72bb=_0x20ffac;_0x4f37b3[_0x6a39('0x3b')]=_[_0x6a39('0x4f')](db['SugarcrmField'][_0x6a39('0x57')]);_0x4f37b3['query']=_[_0x6a39('0x4f')](_0x3b0d79['query']);_0x4f37b3[_0x6a39('0x3d')]=_[_0x6a39('0x3e')](_0x4f37b3[_0x6a39('0x3b')],_0x4f37b3[_0x6a39('0x3c')]);_0x36037f[_0x6a39('0x3f')]=_[_0x6a39('0x3e')](_0x4f37b3['model'],qs['fields'](_0x3b0d79[_0x6a39('0x3c')][_0x6a39('0x50')]));_0x36037f[_0x6a39('0x3f')]=_0x36037f[_0x6a39('0x3f')]['length']?_0x36037f['attributes']:_0x4f37b3[_0x6a39('0x3b')];_0x36037f[_0x6a39('0x44')]=qs[_0x6a39('0x45')](_0x3b0d79['query'][_0x6a39('0x45')]);_0x36037f[_0x6a39('0x46')]=qs['filters'](_[_0x6a39('0x47')](_0x3b0d79[_0x6a39('0x3c')],_0x4f37b3[_0x6a39('0x3d')]));if(_0x3b0d79[_0x6a39('0x3c')][_0x6a39('0x48')]){_0x36037f[_0x6a39('0x46')]=_['merge'](_0x36037f['where'],{'$or':_[_0x6a39('0x38')](_0x36037f[_0x6a39('0x3f')],function(_0x14470b){var _0x1f9543={};_0x1f9543[_0x14470b]={'$like':'%'+_0x3b0d79[_0x6a39('0x3c')][_0x6a39('0x48')]+'%'};return _0x1f9543;})});}_0x36037f=_[_0x6a39('0x49')]({},_0x36037f,_0x3b0d79['options']);return _0x3b72bb['getSubjects'](_0x36037f);}})[_0x6a39('0x20')](function(_0x8becc7){if(_0x8becc7){_0x1f138e=_0x8becc7['length'];if(!_0x3b0d79[_0x6a39('0x3c')][_0x6a39('0x41')]('nolimit')){_0x36037f[_0x6a39('0x43')]=qs[_0x6a39('0x43')](_0x3b0d79['query'][_0x6a39('0x43')]);_0x36037f['offset']=qs['offset'](_0x3b0d79['query'][_0x6a39('0x30')]);}return _0x3b72bb[_0x6a39('0x58')](_0x36037f);}})[_0x6a39('0x20')](function(_0x4d2d5a){if(_0x4d2d5a){return _0x4d2d5a?{'count':_0x1f138e,'rows':_0x4d2d5a}:null;}})[_0x6a39('0x20')](respondWithResult(_0x53b8dd,null))['catch'](handleError(_0x53b8dd,null));};exports[_0x6a39('0x59')]=function(_0x3587eb,_0xb5547d,_0x4d1e3a){var _0x11e88={};var _0x42fb72={};var _0x3ae9f4;var _0x38d8c8;return db['SugarcrmConfiguration']['findOne']({'where':{'id':_0x3587eb['params']['id']}})[_0x6a39('0x20')](handleEntityNotFound(_0xb5547d,null))['then'](function(_0x459515){if(_0x459515){_0x3ae9f4=_0x459515;_0x42fb72[_0x6a39('0x3b')]=_[_0x6a39('0x4f')](db['SugarcrmField'][_0x6a39('0x57')]);_0x42fb72[_0x6a39('0x3c')]=_[_0x6a39('0x4f')](_0x3587eb[_0x6a39('0x3c')]);_0x42fb72[_0x6a39('0x3d')]=_[_0x6a39('0x3e')](_0x42fb72[_0x6a39('0x3b')],_0x42fb72['query']);_0x11e88['attributes']=_['intersection'](_0x42fb72[_0x6a39('0x3b')],qs[_0x6a39('0x50')](_0x3587eb[_0x6a39('0x3c')]['fields']));_0x11e88[_0x6a39('0x3f')]=_0x11e88[_0x6a39('0x3f')][_0x6a39('0x40')]?_0x11e88[_0x6a39('0x3f')]:_0x42fb72[_0x6a39('0x3b')];_0x11e88[_0x6a39('0x44')]=qs[_0x6a39('0x45')](_0x3587eb[_0x6a39('0x3c')][_0x6a39('0x45')]);_0x11e88['where']=qs['filters'](_[_0x6a39('0x47')](_0x3587eb[_0x6a39('0x3c')],_0x42fb72[_0x6a39('0x3d')]));if(_0x3587eb[_0x6a39('0x3c')]['filter']){_0x11e88[_0x6a39('0x46')]=_[_0x6a39('0x49')](_0x11e88['where'],{'$or':_[_0x6a39('0x38')](_0x11e88[_0x6a39('0x3f')],function(_0x5b16d8){var _0x50a0c6={};_0x50a0c6[_0x5b16d8]={'$like':'%'+_0x3587eb['query'][_0x6a39('0x48')]+'%'};return _0x50a0c6;})});}_0x11e88=_[_0x6a39('0x49')]({},_0x11e88,_0x3587eb[_0x6a39('0x4b')]);return _0x3ae9f4['getDescriptions'](_0x11e88);}})[_0x6a39('0x20')](function(_0x3ba8b5){if(_0x3ba8b5){_0x38d8c8=_0x3ba8b5[_0x6a39('0x40')];if(!_0x3587eb[_0x6a39('0x3c')]['hasOwnProperty'](_0x6a39('0x42'))){_0x11e88[_0x6a39('0x43')]=qs[_0x6a39('0x43')](_0x3587eb[_0x6a39('0x3c')][_0x6a39('0x43')]);_0x11e88[_0x6a39('0x30')]=qs['offset'](_0x3587eb[_0x6a39('0x3c')][_0x6a39('0x30')]);}return _0x3ae9f4[_0x6a39('0x59')](_0x11e88);}})[_0x6a39('0x20')](function(_0xb9fe51){if(_0xb9fe51){return _0xb9fe51?{'count':_0x38d8c8,'rows':_0xb9fe51}:null;}})[_0x6a39('0x20')](respondWithResult(_0xb5547d,null))[_0x6a39('0x2b')](handleError(_0xb5547d,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 0be8760..8ca281d 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 _0x1a87=['int_sugarcrm_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','SugarcrmConfiguration'];(function(_0x5af459,_0x45d683){var _0x5ac0ae=function(_0x5dfbed){while(--_0x5dfbed){_0x5af459['push'](_0x5af459['shift']());}};_0x5ac0ae(++_0x45d683);}(_0x1a87,0x189));var _0x71a8=function(_0x29adb2,_0x48616f){_0x29adb2=_0x29adb2-0x0;var _0x250229=_0x1a87[_0x29adb2];return _0x250229;};'use strict';var _=require(_0x71a8('0x0'));var util=require(_0x71a8('0x1'));var logger=require(_0x71a8('0x2'))(_0x71a8('0x3'));var moment=require(_0x71a8('0x4'));var BPromise=require(_0x71a8('0x5'));var rp=require(_0x71a8('0x6'));var fs=require('fs');var path=require(_0x71a8('0x7'));var rimraf=require(_0x71a8('0x8'));var config=require(_0x71a8('0x9'));var attributes=require('./intSugarcrmConfiguration.attributes');module[_0x71a8('0xa')]=function(_0x351440,_0x1f93d0){return _0x351440[_0x71a8('0xb')](_0x71a8('0xc'),attributes,{'tableName':_0x71a8('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe52a=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes','exports','define','SugarcrmConfiguration','int_sugarcrm_configurations','lodash','../../config/logger','api'];(function(_0xcc464a,_0x58cec3){var _0x58f48a=function(_0x21878c){while(--_0x21878c){_0xcc464a['push'](_0xcc464a['shift']());}};_0x58f48a(++_0x58cec3);}(_0xe52a,0x1bd));var _0xae52=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0xe52a[_0x3a6efd];return _0x487b9a;};'use strict';var _=require(_0xae52('0x0'));var util=require('util');var logger=require(_0xae52('0x1'))(_0xae52('0x2'));var moment=require(_0xae52('0x3'));var BPromise=require(_0xae52('0x4'));var rp=require(_0xae52('0x5'));var fs=require('fs');var path=require(_0xae52('0x6'));var rimraf=require(_0xae52('0x7'));var config=require(_0xae52('0x8'));var attributes=require(_0xae52('0x9'));module[_0xae52('0xa')]=function(_0x1131d7,_0x17a40e){return _0x1131d7[_0xae52('0xb')](_0xae52('0xc'),attributes,{'tableName':_0xae52('0xd'),'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 9f474f0..4c9a3ba 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 _0xc5b5=['request\x20sent','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','request','info','SugarcrmConfiguration,\x20%s,\x20%s'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0xc5b5,0x85));var _0x5c5b=function(_0x314350,_0x4433a0){_0x314350=_0x314350-0x0;var _0x2d9c1d=_0xc5b5[_0x314350];return _0x2d9c1d;};'use strict';var _=require(_0x5c5b('0x0'));var util=require(_0x5c5b('0x1'));var moment=require(_0x5c5b('0x2'));var BPromise=require(_0x5c5b('0x3'));var rs=require(_0x5c5b('0x4'));var fs=require('fs');var Redis=require(_0x5c5b('0x5'));var db=require(_0x5c5b('0x6'))['db'];var utils=require(_0x5c5b('0x7'));var logger=require(_0x5c5b('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x5c5b('0x9'));var client=jayson[_0x5c5b('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ecc55,_0x36c789,_0x1e6520){return new BPromise(function(_0x285851,_0x5478c5){return client[_0x5c5b('0xb')](_0x4ecc55,_0x1e6520)['then'](function(_0x1615fe){logger[_0x5c5b('0xc')](_0x5c5b('0xd'),_0x36c789,_0x5c5b('0xe'));logger['debug'](_0x5c5b('0xf'),_0x36c789,_0x5c5b('0xe'),JSON[_0x5c5b('0x10')](_0x1615fe));if(_0x1615fe[_0x5c5b('0x11')]){if(_0x1615fe[_0x5c5b('0x11')][_0x5c5b('0x12')]===0x1f4){logger[_0x5c5b('0x11')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x36c789,_0x1615fe[_0x5c5b('0x11')][_0x5c5b('0x13')]);return _0x5478c5(_0x1615fe[_0x5c5b('0x11')][_0x5c5b('0x13')]);}logger[_0x5c5b('0x11')](_0x5c5b('0xd'),_0x36c789,_0x1615fe['error']['message']);return _0x285851(_0x1615fe[_0x5c5b('0x11')]['message']);}else{logger[_0x5c5b('0xc')](_0x5c5b('0xd'),_0x36c789,_0x5c5b('0xe'));_0x285851(_0x1615fe[_0x5c5b('0x14')][_0x5c5b('0x13')]);}})['catch'](function(_0x45fab6){logger['error'](_0x5c5b('0xd'),_0x36c789,_0x45fab6);_0x5478c5(_0x45fab6);});});} \ No newline at end of file +var _0xf36b=['request','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http'];(function(_0x1e3c02,_0x5c07a2){var _0x4d26d7=function(_0x367ed9){while(--_0x367ed9){_0x1e3c02['push'](_0x1e3c02['shift']());}};_0x4d26d7(++_0x5c07a2);}(_0xf36b,0x16f));var _0xbf36=function(_0x4041cc,_0x4514c1){_0x4041cc=_0x4041cc-0x0;var _0x4b7fff=_0xf36b[_0x4041cc];return _0x4b7fff;};'use strict';var _=require('lodash');var util=require(_0xbf36('0x0'));var moment=require(_0xbf36('0x1'));var BPromise=require(_0xbf36('0x2'));var rs=require(_0xbf36('0x3'));var fs=require('fs');var Redis=require(_0xbf36('0x4'));var db=require(_0xbf36('0x5'))['db'];var utils=require(_0xbf36('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xbf36('0x7'));var jayson=require(_0xbf36('0x8'));var client=jayson[_0xbf36('0x9')][_0xbf36('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x57b065,_0x119eb5,_0x5f2069){return new BPromise(function(_0xc03847,_0x672944){return client[_0xbf36('0xb')](_0x57b065,_0x5f2069)['then'](function(_0x5c3576){logger['info'](_0xbf36('0xc'),_0x119eb5,_0xbf36('0xd'));logger[_0xbf36('0xe')](_0xbf36('0xf'),_0x119eb5,_0xbf36('0xd'),JSON[_0xbf36('0x10')](_0x5c3576));if(_0x5c3576[_0xbf36('0x11')]){if(_0x5c3576[_0xbf36('0x11')][_0xbf36('0x12')]===0x1f4){logger[_0xbf36('0x11')](_0xbf36('0xc'),_0x119eb5,_0x5c3576[_0xbf36('0x11')][_0xbf36('0x13')]);return _0x672944(_0x5c3576['error'][_0xbf36('0x13')]);}logger[_0xbf36('0x11')](_0xbf36('0xc'),_0x119eb5,_0x5c3576[_0xbf36('0x11')][_0xbf36('0x13')]);return _0xc03847(_0x5c3576[_0xbf36('0x11')][_0xbf36('0x13')]);}else{logger['info']('SugarcrmConfiguration,\x20%s,\x20%s',_0x119eb5,_0xbf36('0xd'));_0xc03847(_0x5c3576['result'][_0xbf36('0x13')]);}})[_0xbf36('0x14')](function(_0x5d086d){logger['error'](_0xbf36('0xc'),_0x119eb5,_0x5d086d);_0x672944(_0x5d086d);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 222dc1b..6cbfd5d 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 _0x03b3=['put','/:id','update','delete','destroy','exports','multer','util','path','express','Router','./intSugarcrmField.controller','get','isAuthenticated','index','show','post','create'];(function(_0x31523c,_0x5af867){var _0xb05cc0=function(_0x15232b){while(--_0x15232b){_0x31523c['push'](_0x31523c['shift']());}};_0xb05cc0(++_0x5af867);}(_0x03b3,0x102));var _0x303b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x03b3[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x303b('0x0'));var util=require(_0x303b('0x1'));var path=require(_0x303b('0x2'));var timeout=require('connect-timeout');var express=require(_0x303b('0x3'));var router=express[_0x303b('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x303b('0x5'));router[_0x303b('0x6')]('/',auth[_0x303b('0x7')](),controller[_0x303b('0x8')]);router[_0x303b('0x6')]('/:id',auth[_0x303b('0x7')](),controller[_0x303b('0x9')]);router[_0x303b('0xa')]('/',auth[_0x303b('0x7')](),controller[_0x303b('0xb')]);router[_0x303b('0xc')](_0x303b('0xd'),auth['isAuthenticated'](),controller[_0x303b('0xe')]);router[_0x303b('0xf')](_0x303b('0xd'),auth[_0x303b('0x7')](),controller[_0x303b('0x10')]);module[_0x303b('0x11')]=router; \ No newline at end of file +var _0x0d12=['get','isAuthenticated','/:id','create','put','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','./intSugarcrmField.controller'];(function(_0x2f93b8,_0x15654b){var _0xc1f0c=function(_0x564000){while(--_0x564000){_0x2f93b8['push'](_0x2f93b8['shift']());}};_0xc1f0c(++_0x15654b);}(_0x0d12,0x1ac));var _0x20d1=function(_0x19ff84,_0x311aad){_0x19ff84=_0x19ff84-0x0;var _0x35fdbb=_0x0d12[_0x19ff84];return _0x35fdbb;};'use strict';var multer=require(_0x20d1('0x0'));var util=require(_0x20d1('0x1'));var path=require(_0x20d1('0x2'));var timeout=require(_0x20d1('0x3'));var express=require('express');var router=express[_0x20d1('0x4')]();var auth=require(_0x20d1('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x20d1('0x6'));router[_0x20d1('0x7')]('/',auth[_0x20d1('0x8')](),controller['index']);router[_0x20d1('0x7')](_0x20d1('0x9'),auth[_0x20d1('0x8')](),controller['show']);router['post']('/',auth[_0x20d1('0x8')](),controller[_0x20d1('0xa')]);router[_0x20d1('0xb')](_0x20d1('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x20d1('0xc')](_0x20d1('0x9'),auth[_0x20d1('0x8')](),controller[_0x20d1('0xd')]);module[_0x20d1('0xe')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index d8ffffe..355db5b 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 _0x32c0=['STRING','customVariable','sequelize','exports','string','variable','keyValue'];(function(_0x36604a,_0x1e8344){var _0x39e2de=function(_0x56a08e){while(--_0x56a08e){_0x36604a['push'](_0x36604a['shift']());}};_0x39e2de(++_0x1e8344);}(_0x32c0,0x1f3));var _0x032c=function(_0x35b8d1,_0x41c729){_0x35b8d1=_0x35b8d1-0x0;var _0x487ce0=_0x32c0[_0x35b8d1];return _0x487ce0;};'use strict';var Sequelize=require(_0x032c('0x0'));module[_0x032c('0x1')]={'type':{'type':Sequelize['ENUM'](_0x032c('0x2'),_0x032c('0x3'),'customVariable',_0x032c('0x4')),'defaultValue':_0x032c('0x2')},'content':{'type':Sequelize[_0x032c('0x5')]},'key':{'type':Sequelize[_0x032c('0x5')]},'keyType':{'type':Sequelize['ENUM'](_0x032c('0x2'),_0x032c('0x3'),_0x032c('0x6'))},'keyContent':{'type':Sequelize[_0x032c('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x032c('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x032c('0x5')]}}; \ No newline at end of file +var _0x9c5a=['keyValue','STRING','BOOLEAN','sequelize','exports','string','variable','customVariable'];(function(_0x2bb71b,_0x3dcd7e){var _0x2f8eab=function(_0xe4abc7){while(--_0xe4abc7){_0x2bb71b['push'](_0x2bb71b['shift']());}};_0x2f8eab(++_0x3dcd7e);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x1dc4b7,_0x3257d3){_0x1dc4b7=_0x1dc4b7-0x0;var _0x154ba4=_0x9c5a[_0x1dc4b7];return _0x154ba4;};'use strict';var Sequelize=require(_0xa9c5('0x0'));module[_0xa9c5('0x1')]={'type':{'type':Sequelize['ENUM'](_0xa9c5('0x2'),_0xa9c5('0x3'),_0xa9c5('0x4'),_0xa9c5('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0xa9c5('0x6')]},'key':{'type':Sequelize[_0xa9c5('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0xa9c5('0x2'),'variable',_0xa9c5('0x4'))},'keyContent':{'type':Sequelize[_0xa9c5('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xa9c5('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xa9c5('0x6')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 22be3ff..f7b94cb 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 _0x883f=['status','json','count','offset','Content-Range','apply','reject','save','then','destroy','stack','name','send','SugarcrmField','rawAttributes','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','options','includeAll','include','rows','show','params','create','body','update','find','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb'];(function(_0x395465,_0x16a076){var _0x440b4e=function(_0x2bf2a7){while(--_0x2bf2a7){_0x395465['push'](_0x395465['shift']());}};_0x440b4e(++_0x16a076);}(_0x883f,0xf9));var _0xf883=function(_0x16d3f2,_0x2bb33e){_0x16d3f2=_0x16d3f2-0x0;var _0x2ac270=_0x883f[_0x16d3f2];return _0x2ac270;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xf883('0x0'));var rimraf=require(_0xf883('0x1'));var zipdir=require(_0xf883('0x2'));var jsonpatch=require(_0xf883('0x3'));var rp=require(_0xf883('0x4'));var moment=require('moment');var BPromise=require(_0xf883('0x5'));var Mustache=require(_0xf883('0x6'));var util=require(_0xf883('0x7'));var path=require(_0xf883('0x8'));var sox=require(_0xf883('0x9'));var csv=require(_0xf883('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xf883('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xf883('0xc'));var Papa=require(_0xf883('0xd'));var Redis=require(_0xf883('0xe'));var authService=require(_0xf883('0xf'));var qs=require(_0xf883('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf883('0x11'));var logger=require(_0xf883('0x12'))(_0xf883('0x13'));var utils=require(_0xf883('0x14'));var config=require(_0xf883('0x15'));var db=require(_0xf883('0x16'))['db'];function respondWithStatusCode(_0x16c93e,_0x412989){_0x412989=_0x412989||0xcc;return function(_0x3e8c9b){if(_0x3e8c9b){return _0x16c93e['sendStatus'](_0x412989);}return _0x16c93e['status'](_0x412989)['end']();};}function respondWithResult(_0x53f37a,_0x35a27f){_0x35a27f=_0x35a27f||0xc8;return function(_0x2b4676){if(_0x2b4676){return _0x53f37a[_0xf883('0x17')](_0x35a27f)[_0xf883('0x18')](_0x2b4676);}};}function respondWithFilteredResult(_0x366336,_0x4f43c7){return function(_0x593b46){if(_0x593b46){var _0x1684bb=_0x593b46[_0xf883('0x19')],_0x16832a=_0x4f43c7[_0xf883('0x1a')],_0x27a673=_0x4f43c7[_0xf883('0x1a')]+_0x4f43c7['limit'],_0xe62a3;if(_0x27a673>=_0x1684bb){_0x27a673=_0x1684bb;_0xe62a3=0xc8;}else{_0xe62a3=0xce;}_0x366336[_0xf883('0x17')](_0xe62a3);return _0x366336['set'](_0xf883('0x1b'),_0x16832a+'-'+_0x27a673+'/'+_0x1684bb)[_0xf883('0x18')](_0x593b46);}return null;};}function patchUpdates(_0x17d4ae){return function(_0x27a6be){try{jsonpatch[_0xf883('0x1c')](_0x27a6be,_0x17d4ae,!![]);}catch(_0x509cb0){return BPromise[_0xf883('0x1d')](_0x509cb0);}return _0x27a6be[_0xf883('0x1e')]();};}function saveUpdates(_0x2130d7,_0x3afdb6){return function(_0xb7da2f){if(_0xb7da2f){return _0xb7da2f['update'](_0x2130d7)[_0xf883('0x1f')](function(_0x35b86d){return _0x35b86d;});}return null;};}function removeEntity(_0x2c35d8,_0x458581){return function(_0x1fe107){if(_0x1fe107){return _0x1fe107[_0xf883('0x20')]()['then'](function(){_0x2c35d8['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3d55b0,_0x28df79){return function(_0x35d98a){if(!_0x35d98a){_0x3d55b0['sendStatus'](0x194);}return _0x35d98a;};}function handleError(_0x4467a5,_0x285d02){_0x285d02=_0x285d02||0x1f4;return function(_0x156e3c){logger['error'](_0x156e3c[_0xf883('0x21')]);if(_0x156e3c[_0xf883('0x22')]){delete _0x156e3c[_0xf883('0x22')];}_0x4467a5['status'](_0x285d02)[_0xf883('0x23')](_0x156e3c);};}exports['index']=function(_0x3e9ca9,_0x1a4bc2){var _0x1d4613={},_0xb29777={},_0x26cee8={'count':0x0,'rows':[]};var _0x44e2d6=_['map'](db[_0xf883('0x24')][_0xf883('0x25')],function(_0x303192){return{'name':_0x303192['fieldName'],'type':_0x303192[_0xf883('0x26')][_0xf883('0x27')]};});_0xb29777[_0xf883('0x28')]=_[_0xf883('0x29')](_0x44e2d6,_0xf883('0x22'));_0xb29777[_0xf883('0x2a')]=_[_0xf883('0x2b')](_0x3e9ca9[_0xf883('0x2a')]);_0xb29777[_0xf883('0x2c')]=_['intersection'](_0xb29777['model'],_0xb29777['query']);_0x1d4613['attributes']=_[_0xf883('0x2d')](_0xb29777['model'],qs[_0xf883('0x2e')](_0x3e9ca9[_0xf883('0x2a')][_0xf883('0x2e')]));_0x1d4613[_0xf883('0x2f')]=_0x1d4613[_0xf883('0x2f')][_0xf883('0x30')]?_0x1d4613[_0xf883('0x2f')]:_0xb29777[_0xf883('0x28')];if(!_0x3e9ca9[_0xf883('0x2a')][_0xf883('0x31')](_0xf883('0x32'))){_0x1d4613[_0xf883('0x33')]=qs[_0xf883('0x33')](_0x3e9ca9[_0xf883('0x2a')][_0xf883('0x33')]);_0x1d4613['offset']=qs[_0xf883('0x1a')](_0x3e9ca9[_0xf883('0x2a')][_0xf883('0x1a')]);}_0x1d4613[_0xf883('0x34')]=qs[_0xf883('0x35')](_0x3e9ca9[_0xf883('0x2a')][_0xf883('0x35')]);_0x1d4613[_0xf883('0x36')]=qs[_0xf883('0x2c')](_[_0xf883('0x37')](_0x3e9ca9[_0xf883('0x2a')],_0xb29777[_0xf883('0x2c')]));if(_0x3e9ca9[_0xf883('0x2a')]['filter']){_0x1d4613[_0xf883('0x36')]=_[_0xf883('0x38')](_0x1d4613[_0xf883('0x36')],{'$or':_[_0xf883('0x29')](_0x44e2d6,function(_0x56477a){if(_0x56477a[_0xf883('0x26')]!=='VIRTUAL'){var _0x224ff8={};_0x224ff8[_0x56477a['name']]={'$like':'%'+_0x3e9ca9[_0xf883('0x2a')]['filter']+'%'};return _0x224ff8;}})});}_0x1d4613=_[_0xf883('0x38')]({},_0x1d4613,_0x3e9ca9[_0xf883('0x39')]);var _0x337f26={'where':_0x1d4613[_0xf883('0x36')]};return db[_0xf883('0x24')]['count'](_0x337f26)[_0xf883('0x1f')](function(_0x1bca54){_0x26cee8[_0xf883('0x19')]=_0x1bca54;if(_0x3e9ca9[_0xf883('0x2a')][_0xf883('0x3a')]){_0x1d4613[_0xf883('0x3b')]=[{'all':!![]}];}return db['SugarcrmField']['findAll'](_0x1d4613);})['then'](function(_0x11f67a){_0x26cee8[_0xf883('0x3c')]=_0x11f67a;return _0x26cee8;})[_0xf883('0x1f')](respondWithFilteredResult(_0x1a4bc2,_0x1d4613))['catch'](handleError(_0x1a4bc2,null));};exports[_0xf883('0x3d')]=function(_0x4d557b,_0x372df5){var _0x54a9d1={'raw':!![],'where':{'id':_0x4d557b[_0xf883('0x3e')]['id']}},_0x44e795={};_0x44e795[_0xf883('0x28')]=_[_0xf883('0x2b')](db[_0xf883('0x24')][_0xf883('0x25')]);_0x44e795[_0xf883('0x2a')]=_[_0xf883('0x2b')](_0x4d557b['query']);_0x44e795[_0xf883('0x2c')]=_[_0xf883('0x2d')](_0x44e795[_0xf883('0x28')],_0x44e795[_0xf883('0x2a')]);_0x54a9d1[_0xf883('0x2f')]=_[_0xf883('0x2d')](_0x44e795[_0xf883('0x28')],qs[_0xf883('0x2e')](_0x4d557b[_0xf883('0x2a')][_0xf883('0x2e')]));_0x54a9d1['attributes']=_0x54a9d1[_0xf883('0x2f')][_0xf883('0x30')]?_0x54a9d1[_0xf883('0x2f')]:_0x44e795[_0xf883('0x28')];if(_0x4d557b[_0xf883('0x2a')]['includeAll']){_0x54a9d1[_0xf883('0x3b')]=[{'all':!![]}];}_0x54a9d1=_[_0xf883('0x38')]({},_0x54a9d1,_0x4d557b[_0xf883('0x39')]);return db[_0xf883('0x24')]['find'](_0x54a9d1)[_0xf883('0x1f')](handleEntityNotFound(_0x372df5,null))[_0xf883('0x1f')](respondWithResult(_0x372df5,null))['catch'](handleError(_0x372df5,null));};exports[_0xf883('0x3f')]=function(_0x20ddd8,_0xb30d56){return db[_0xf883('0x24')]['create'](_0x20ddd8[_0xf883('0x40')],{})[_0xf883('0x1f')](respondWithResult(_0xb30d56,0xc9))['catch'](handleError(_0xb30d56,null));};exports[_0xf883('0x41')]=function(_0x22ce20,_0x1f3150){if(_0x22ce20['body']['id']){delete _0x22ce20[_0xf883('0x40')]['id'];}return db[_0xf883('0x24')][_0xf883('0x42')]({'where':{'id':_0x22ce20[_0xf883('0x3e')]['id']}})[_0xf883('0x1f')](handleEntityNotFound(_0x1f3150,null))[_0xf883('0x1f')](saveUpdates(_0x22ce20['body'],null))[_0xf883('0x1f')](respondWithResult(_0x1f3150,null))[_0xf883('0x43')](handleError(_0x1f3150,null));};exports[_0xf883('0x20')]=function(_0x3d25f6,_0x55a506){return db[_0xf883('0x24')][_0xf883('0x42')]({'where':{'id':_0x3d25f6[_0xf883('0x3e')]['id']}})[_0xf883('0x1f')](handleEntityNotFound(_0x55a506,null))['then'](removeEntity(_0x55a506,null))[_0xf883('0x43')](handleError(_0x55a506,null));}; \ No newline at end of file +var _0x755e=['hasOwnProperty','order','sort','pick','where','VIRTUAL','filter','merge','options','include','findAll','show','includeAll','find','catch','update','body','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','status','json','count','offset','limit','set','Content-Range','reject','save','then','destroy','end','sendStatus','stack','name','send','map','SugarcrmField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x755e,0x1ee));var _0xe755=function(_0x4254e7,_0x4fc342){_0x4254e7=_0x4254e7-0x0;var _0x5e0844=_0x755e[_0x4254e7];return _0x5e0844;};'use strict';var pdf=require(_0xe755('0x0'));var emlformat=require(_0xe755('0x1'));var rimraf=require(_0xe755('0x2'));var zipdir=require(_0xe755('0x3'));var jsonpatch=require(_0xe755('0x4'));var rp=require('request-promise');var moment=require(_0xe755('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xe755('0x6'));var util=require('util');var path=require('path');var sox=require(_0xe755('0x7'));var csv=require(_0xe755('0x8'));var ejs=require(_0xe755('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xe755('0xa'));var crypto=require('crypto');var jsforce=require(_0xe755('0xb'));var deskjs=require(_0xe755('0xc'));var toCsv=require(_0xe755('0x8'));var querystring=require(_0xe755('0xd'));var Papa=require(_0xe755('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe755('0xf'));var hardwareService=require(_0xe755('0x10'));var logger=require('../../config/logger')('api');var utils=require(_0xe755('0x11'));var config=require(_0xe755('0x12'));var db=require(_0xe755('0x13'))['db'];function respondWithStatusCode(_0xe0650d,_0x15bd7a){_0x15bd7a=_0x15bd7a||0xcc;return function(_0x57b855){if(_0x57b855){return _0xe0650d['sendStatus'](_0x15bd7a);}return _0xe0650d[_0xe755('0x14')](_0x15bd7a)['end']();};}function respondWithResult(_0x6e50eb,_0x3f8dd8){_0x3f8dd8=_0x3f8dd8||0xc8;return function(_0x19c275){if(_0x19c275){return _0x6e50eb[_0xe755('0x14')](_0x3f8dd8)[_0xe755('0x15')](_0x19c275);}};}function respondWithFilteredResult(_0x23f56d,_0x4d9700){return function(_0x3e1b88){if(_0x3e1b88){var _0x3eebf6=_0x3e1b88[_0xe755('0x16')],_0x4d3b4=_0x4d9700[_0xe755('0x17')],_0x1beafe=_0x4d9700[_0xe755('0x17')]+_0x4d9700[_0xe755('0x18')],_0x13a787;if(_0x1beafe>=_0x3eebf6){_0x1beafe=_0x3eebf6;_0x13a787=0xc8;}else{_0x13a787=0xce;}_0x23f56d['status'](_0x13a787);return _0x23f56d[_0xe755('0x19')](_0xe755('0x1a'),_0x4d3b4+'-'+_0x1beafe+'/'+_0x3eebf6)[_0xe755('0x15')](_0x3e1b88);}return null;};}function patchUpdates(_0x299d49){return function(_0x304838){try{jsonpatch['apply'](_0x304838,_0x299d49,!![]);}catch(_0x3efc30){return BPromise[_0xe755('0x1b')](_0x3efc30);}return _0x304838[_0xe755('0x1c')]();};}function saveUpdates(_0x587fc3,_0x4582b1){return function(_0x372bbb){if(_0x372bbb){return _0x372bbb['update'](_0x587fc3)[_0xe755('0x1d')](function(_0x1a6cd7){return _0x1a6cd7;});}return null;};}function removeEntity(_0x20b71a,_0x486bc1){return function(_0x5413ee){if(_0x5413ee){return _0x5413ee[_0xe755('0x1e')]()[_0xe755('0x1d')](function(){_0x20b71a[_0xe755('0x14')](0xcc)[_0xe755('0x1f')]();});}};}function handleEntityNotFound(_0x24ccdb,_0x4baa73){return function(_0x386ae7){if(!_0x386ae7){_0x24ccdb[_0xe755('0x20')](0x194);}return _0x386ae7;};}function handleError(_0x1c23d6,_0x596ed9){_0x596ed9=_0x596ed9||0x1f4;return function(_0x45f343){logger['error'](_0x45f343[_0xe755('0x21')]);if(_0x45f343['name']){delete _0x45f343[_0xe755('0x22')];}_0x1c23d6[_0xe755('0x14')](_0x596ed9)[_0xe755('0x23')](_0x45f343);};}exports['index']=function(_0x490129,_0xb53861){var _0x40e518={},_0x2d2b3f={},_0x51e126={'count':0x0,'rows':[]};var _0x3efab7=_[_0xe755('0x24')](db[_0xe755('0x25')][_0xe755('0x26')],function(_0x413dfd){return{'name':_0x413dfd[_0xe755('0x27')],'type':_0x413dfd[_0xe755('0x28')][_0xe755('0x29')]};});_0x2d2b3f[_0xe755('0x2a')]=_[_0xe755('0x24')](_0x3efab7,_0xe755('0x22'));_0x2d2b3f[_0xe755('0x2b')]=_[_0xe755('0x2c')](_0x490129[_0xe755('0x2b')]);_0x2d2b3f[_0xe755('0x2d')]=_[_0xe755('0x2e')](_0x2d2b3f['model'],_0x2d2b3f['query']);_0x40e518[_0xe755('0x2f')]=_[_0xe755('0x2e')](_0x2d2b3f[_0xe755('0x2a')],qs[_0xe755('0x30')](_0x490129['query'][_0xe755('0x30')]));_0x40e518[_0xe755('0x2f')]=_0x40e518['attributes'][_0xe755('0x31')]?_0x40e518[_0xe755('0x2f')]:_0x2d2b3f[_0xe755('0x2a')];if(!_0x490129[_0xe755('0x2b')][_0xe755('0x32')]('nolimit')){_0x40e518[_0xe755('0x18')]=qs[_0xe755('0x18')](_0x490129[_0xe755('0x2b')][_0xe755('0x18')]);_0x40e518[_0xe755('0x17')]=qs['offset'](_0x490129[_0xe755('0x2b')]['offset']);}_0x40e518[_0xe755('0x33')]=qs['sort'](_0x490129[_0xe755('0x2b')][_0xe755('0x34')]);_0x40e518['where']=qs['filters'](_[_0xe755('0x35')](_0x490129[_0xe755('0x2b')],_0x2d2b3f[_0xe755('0x2d')]));if(_0x490129[_0xe755('0x2b')]['filter']){_0x40e518[_0xe755('0x36')]=_['merge'](_0x40e518[_0xe755('0x36')],{'$or':_['map'](_0x3efab7,function(_0x2cf458){if(_0x2cf458['type']!==_0xe755('0x37')){var _0x2b6172={};_0x2b6172[_0x2cf458[_0xe755('0x22')]]={'$like':'%'+_0x490129['query'][_0xe755('0x38')]+'%'};return _0x2b6172;}})});}_0x40e518=_[_0xe755('0x39')]({},_0x40e518,_0x490129[_0xe755('0x3a')]);var _0x5b515a={'where':_0x40e518['where']};return db[_0xe755('0x25')][_0xe755('0x16')](_0x5b515a)['then'](function(_0x226cf5){_0x51e126[_0xe755('0x16')]=_0x226cf5;if(_0x490129[_0xe755('0x2b')]['includeAll']){_0x40e518[_0xe755('0x3b')]=[{'all':!![]}];}return db[_0xe755('0x25')][_0xe755('0x3c')](_0x40e518);})['then'](function(_0x4e4d21){_0x51e126['rows']=_0x4e4d21;return _0x51e126;})[_0xe755('0x1d')](respondWithFilteredResult(_0xb53861,_0x40e518))['catch'](handleError(_0xb53861,null));};exports[_0xe755('0x3d')]=function(_0xdd64cb,_0x1ac9a9){var _0x338e4c={'raw':!![],'where':{'id':_0xdd64cb['params']['id']}},_0xaf8425={};_0xaf8425[_0xe755('0x2a')]=_['keys'](db[_0xe755('0x25')]['rawAttributes']);_0xaf8425[_0xe755('0x2b')]=_['keys'](_0xdd64cb['query']);_0xaf8425[_0xe755('0x2d')]=_[_0xe755('0x2e')](_0xaf8425[_0xe755('0x2a')],_0xaf8425[_0xe755('0x2b')]);_0x338e4c[_0xe755('0x2f')]=_[_0xe755('0x2e')](_0xaf8425['model'],qs[_0xe755('0x30')](_0xdd64cb['query'][_0xe755('0x30')]));_0x338e4c[_0xe755('0x2f')]=_0x338e4c[_0xe755('0x2f')][_0xe755('0x31')]?_0x338e4c[_0xe755('0x2f')]:_0xaf8425[_0xe755('0x2a')];if(_0xdd64cb['query'][_0xe755('0x3e')]){_0x338e4c['include']=[{'all':!![]}];}_0x338e4c=_['merge']({},_0x338e4c,_0xdd64cb[_0xe755('0x3a')]);return db['SugarcrmField'][_0xe755('0x3f')](_0x338e4c)[_0xe755('0x1d')](handleEntityNotFound(_0x1ac9a9,null))['then'](respondWithResult(_0x1ac9a9,null))[_0xe755('0x40')](handleError(_0x1ac9a9,null));};exports['create']=function(_0x2f9af3,_0x5bbdc1){return db[_0xe755('0x25')]['create'](_0x2f9af3['body'],{})[_0xe755('0x1d')](respondWithResult(_0x5bbdc1,0xc9))['catch'](handleError(_0x5bbdc1,null));};exports[_0xe755('0x41')]=function(_0xa2267f,_0x111f86){if(_0xa2267f['body']['id']){delete _0xa2267f[_0xe755('0x42')]['id'];}return db[_0xe755('0x25')][_0xe755('0x3f')]({'where':{'id':_0xa2267f[_0xe755('0x43')]['id']}})[_0xe755('0x1d')](handleEntityNotFound(_0x111f86,null))[_0xe755('0x1d')](saveUpdates(_0xa2267f[_0xe755('0x42')],null))[_0xe755('0x1d')](respondWithResult(_0x111f86,null))[_0xe755('0x40')](handleError(_0x111f86,null));};exports['destroy']=function(_0x604346,_0x186b5c){return db[_0xe755('0x25')][_0xe755('0x3f')]({'where':{'id':_0x604346[_0xe755('0x43')]['id']}})[_0xe755('0x1d')](handleEntityNotFound(_0x186b5c,null))[_0xe755('0x1d')](removeEntity(_0x186b5c,null))[_0xe755('0x40')](handleError(_0x186b5c,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index 793284b..37edbc8 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 _0x5a1f=['FieldId','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./intSugarcrmField.attributes','exports','define','SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index','idField'];(function(_0x17b434,_0x58f53f){var _0x53d593=function(_0x55b6b7){while(--_0x55b6b7){_0x17b434['push'](_0x17b434['shift']());}};_0x53d593(++_0x58f53f);}(_0x5a1f,0x178));var _0xf5a1=function(_0xefef2f,_0x28ddbf){_0xefef2f=_0xefef2f-0x0;var _0x50dbc1=_0x5a1f[_0xefef2f];return _0x50dbc1;};'use strict';var _=require('lodash');var util=require(_0xf5a1('0x0'));var logger=require(_0xf5a1('0x1'))(_0xf5a1('0x2'));var moment=require('moment');var BPromise=require(_0xf5a1('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf5a1('0x4'));var rimraf=require(_0xf5a1('0x5'));var config=require(_0xf5a1('0x6'));var attributes=require(_0xf5a1('0x7'));module[_0xf5a1('0x8')]=function(_0x378c7c,_0x25aff8){return _0x378c7c[_0xf5a1('0x9')](_0xf5a1('0xa'),attributes,{'tableName':_0xf5a1('0xb'),'paranoid':![],'indexes':[{'name':_0xf5a1('0xc'),'fields':[_0xf5a1('0xd'),_0xf5a1('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5ba0=['define','SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index','idField','FieldId','lodash','../../config/logger','bluebird','request-promise','path','../../config/environment','./intSugarcrmField.attributes','exports'];(function(_0x32f850,_0x6ba444){var _0x38e424=function(_0x14e281){while(--_0x14e281){_0x32f850['push'](_0x32f850['shift']());}};_0x38e424(++_0x6ba444);}(_0x5ba0,0xa0));var _0x05ba=function(_0x20b789,_0x59a41){_0x20b789=_0x20b789-0x0;var _0x2ffd85=_0x5ba0[_0x20b789];return _0x2ffd85;};'use strict';var _=require(_0x05ba('0x0'));var util=require('util');var logger=require(_0x05ba('0x1'))('api');var moment=require('moment');var BPromise=require(_0x05ba('0x2'));var rp=require(_0x05ba('0x3'));var fs=require('fs');var path=require(_0x05ba('0x4'));var rimraf=require('rimraf');var config=require(_0x05ba('0x5'));var attributes=require(_0x05ba('0x6'));module[_0x05ba('0x7')]=function(_0x8b1504,_0x5776ce){return _0x8b1504[_0x05ba('0x8')](_0x05ba('0x9'),attributes,{'tableName':_0x05ba('0xa'),'paranoid':![],'indexes':[{'name':_0x05ba('0xb'),'fields':[_0x05ba('0xc'),_0x05ba('0xd')],'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 e9ea924..cd19f3b 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 _0xbaf0=['client','http','then','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x119d25,_0x588c8){var _0x39cf30=function(_0x31c68c){while(--_0x31c68c){_0x119d25['push'](_0x119d25['shift']());}};_0x39cf30(++_0x588c8);}(_0xbaf0,0x12a));var _0x0baf=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xbaf0[_0x6c993a];return _0x27f547;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var moment=require(_0x0baf('0x1'));var BPromise=require(_0x0baf('0x2'));var rs=require(_0x0baf('0x3'));var fs=require('fs');var Redis=require(_0x0baf('0x4'));var db=require(_0x0baf('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0baf('0x6'))(_0x0baf('0x7'));var config=require(_0x0baf('0x8'));var jayson=require(_0x0baf('0x9'));var client=jayson[_0x0baf('0xa')][_0x0baf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1a10b1,_0x2dcaac,_0x1d0a0d){return new BPromise(function(_0x5f5030,_0x11b947){return client['request'](_0x1a10b1,_0x1d0a0d)[_0x0baf('0xc')](function(_0x2c7442){logger[_0x0baf('0xd')](_0x0baf('0xe'),_0x2dcaac,_0x0baf('0xf'));logger[_0x0baf('0x10')](_0x0baf('0x11'),_0x2dcaac,_0x0baf('0xf'),JSON[_0x0baf('0x12')](_0x2c7442));if(_0x2c7442[_0x0baf('0x13')]){if(_0x2c7442[_0x0baf('0x13')]['code']===0x1f4){logger['error'](_0x0baf('0xe'),_0x2dcaac,_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);return _0x11b947(_0x2c7442[_0x0baf('0x13')]['message']);}logger[_0x0baf('0x13')]('SugarcrmField,\x20%s,\x20%s',_0x2dcaac,_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);return _0x5f5030(_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);}else{logger[_0x0baf('0xd')](_0x0baf('0xe'),_0x2dcaac,'request\x20sent');_0x5f5030(_0x2c7442['result'][_0x0baf('0x14')]);}})[_0x0baf('0x15')](function(_0x283408){logger[_0x0baf('0x13')](_0x0baf('0xe'),_0x2dcaac,_0x283408);_0x11b947(_0x283408);});});} \ No newline at end of file +var _0x757a=['request','then','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3d0cd4,_0x474eba){var _0x3f72df=function(_0x24bcde){while(--_0x24bcde){_0x3d0cd4['push'](_0x3d0cd4['shift']());}};_0x3f72df(++_0x474eba);}(_0x757a,0xde));var _0xa757=function(_0x13dae6,_0x30e314){_0x13dae6=_0x13dae6-0x0;var _0x5783c7=_0x757a[_0x13dae6];return _0x5783c7;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var moment=require(_0xa757('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa757('0x2'))['db'];var utils=require(_0xa757('0x3'));var logger=require(_0xa757('0x4'))(_0xa757('0x5'));var config=require(_0xa757('0x6'));var jayson=require(_0xa757('0x7'));var client=jayson['client'][_0xa757('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4343b6,_0x53be0e,_0x2930fa){return new BPromise(function(_0x2f7793,_0x447344){return client[_0xa757('0x9')](_0x4343b6,_0x2930fa)[_0xa757('0xa')](function(_0x5aef8a){logger[_0xa757('0xb')](_0xa757('0xc'),_0x53be0e,_0xa757('0xd'));logger[_0xa757('0xe')](_0xa757('0xf'),_0x53be0e,_0xa757('0xd'),JSON[_0xa757('0x10')](_0x5aef8a));if(_0x5aef8a['error']){if(_0x5aef8a['error']['code']===0x1f4){logger['error']('SugarcrmField,\x20%s,\x20%s',_0x53be0e,_0x5aef8a[_0xa757('0x11')]['message']);return _0x447344(_0x5aef8a['error'][_0xa757('0x12')]);}logger['error']('SugarcrmField,\x20%s,\x20%s',_0x53be0e,_0x5aef8a[_0xa757('0x11')][_0xa757('0x12')]);return _0x2f7793(_0x5aef8a[_0xa757('0x11')][_0xa757('0x12')]);}else{logger[_0xa757('0xb')](_0xa757('0xc'),_0x53be0e,_0xa757('0xd'));_0x2f7793(_0x5aef8a[_0xa757('0x13')][_0xa757('0x12')]);}})[_0xa757('0x14')](function(_0x50aac1){logger[_0xa757('0x11')](_0xa757('0xc'),_0x53be0e,_0x50aac1);_0x447344(_0x50aac1);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 52765ad..9b1636c 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 _0xa2d1=['addConfiguration','put','update','delete','destroy','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./intVtigerAccount.controller','isAuthenticated','index','get','/:id','show','/:id/configurations','getConfigurations','/:id/fields','create'];(function(_0x1bf08e,_0x43a2e4){var _0x24e196=function(_0x2a454c){while(--_0x2a454c){_0x1bf08e['push'](_0x1bf08e['shift']());}};_0x24e196(++_0x43a2e4);}(_0xa2d1,0x155));var _0x1a2d=function(_0x5ae8f7,_0x330d91){_0x5ae8f7=_0x5ae8f7-0x0;var _0x54c636=_0xa2d1[_0x5ae8f7];return _0x54c636;};'use strict';var multer=require('multer');var util=require(_0x1a2d('0x0'));var path=require(_0x1a2d('0x1'));var timeout=require(_0x1a2d('0x2'));var express=require('express');var router=express[_0x1a2d('0x3')]();var auth=require(_0x1a2d('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x1a2d('0x5'));var controller=require(_0x1a2d('0x6'));router['get']('/',auth[_0x1a2d('0x7')](),controller[_0x1a2d('0x8')]);router[_0x1a2d('0x9')](_0x1a2d('0xa'),auth[_0x1a2d('0x7')](),controller[_0x1a2d('0xb')]);router['get'](_0x1a2d('0xc'),auth['isAuthenticated'](),controller[_0x1a2d('0xd')]);router[_0x1a2d('0x9')](_0x1a2d('0xe'),auth[_0x1a2d('0x7')](),controller['getFields']);router['post']('/',auth[_0x1a2d('0x7')](),controller[_0x1a2d('0xf')]);router['post'](_0x1a2d('0xc'),auth[_0x1a2d('0x7')](),controller[_0x1a2d('0x10')]);router[_0x1a2d('0x11')](_0x1a2d('0xa'),auth['isAuthenticated'](),controller[_0x1a2d('0x12')]);router[_0x1a2d('0x13')]('/:id',auth[_0x1a2d('0x7')](),controller[_0x1a2d('0x14')]);module['exports']=router; \ No newline at end of file +var _0x8e27=['index','get','/:id','show','/:id/configurations','getConfigurations','/:id/fields','post','create','addConfiguration','put','update','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated'];(function(_0x4c5c97,_0x4f85bf){var _0xd5d2cb=function(_0x1e6100){while(--_0x1e6100){_0x4c5c97['push'](_0x4c5c97['shift']());}};_0xd5d2cb(++_0x4f85bf);}(_0x8e27,0x158));var _0x78e2=function(_0x49b73b,_0x49456b){_0x49b73b=_0x49b73b-0x0;var _0x391e11=_0x8e27[_0x49b73b];return _0x391e11;};'use strict';var multer=require(_0x78e2('0x0'));var util=require('util');var path=require(_0x78e2('0x1'));var timeout=require(_0x78e2('0x2'));var express=require(_0x78e2('0x3'));var router=express['Router']();var auth=require(_0x78e2('0x4'));var interaction=require(_0x78e2('0x5'));var config=require(_0x78e2('0x6'));var controller=require('./intVtigerAccount.controller');router['get']('/',auth[_0x78e2('0x7')](),controller[_0x78e2('0x8')]);router[_0x78e2('0x9')](_0x78e2('0xa'),auth[_0x78e2('0x7')](),controller[_0x78e2('0xb')]);router[_0x78e2('0x9')](_0x78e2('0xc'),auth['isAuthenticated'](),controller[_0x78e2('0xd')]);router[_0x78e2('0x9')](_0x78e2('0xe'),auth[_0x78e2('0x7')](),controller['getFields']);router[_0x78e2('0xf')]('/',auth[_0x78e2('0x7')](),controller[_0x78e2('0x10')]);router['post']('/:id/configurations',auth['isAuthenticated'](),controller[_0x78e2('0x11')]);router[_0x78e2('0x12')](_0x78e2('0xa'),auth[_0x78e2('0x7')](),controller[_0x78e2('0x13')]);router['delete'](_0x78e2('0xa'),auth[_0x78e2('0x7')](),controller[_0x78e2('0x14')]);module[_0x78e2('0x15')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index 928ac77..7ef3344 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 _0xeaa0=['HelpDesk','STRING'];(function(_0x2ce2ab,_0x54e6be){var _0x19073d=function(_0x26b8f5){while(--_0x26b8f5){_0x2ce2ab['push'](_0x2ce2ab['shift']());}};_0x19073d(++_0x54e6be);}(_0xeaa0,0x149));var _0x0eaa=function(_0x3b5ad9,_0x223867){_0x3b5ad9=_0x3b5ad9-0x0;var _0x611ae9=_0xeaa0[_0x3b5ad9];return _0x611ae9;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x0eaa('0x0')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'allowNull':![]},'moduleName':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x0eaa('0x1')},'remoteUri':{'type':Sequelize[_0x0eaa('0x0')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x0eaa('0x0')]},'accessKey':{'type':Sequelize[_0x0eaa('0x0')],'allowNull':![]}}; \ No newline at end of file +var _0x6036=['STRING','HelpDesk','sequelize'];(function(_0x4c0e76,_0x424c83){var _0x7b0007=function(_0x39b29a){while(--_0x39b29a){_0x4c0e76['push'](_0x4c0e76['shift']());}};_0x7b0007(++_0x424c83);}(_0x6036,0x1a9));var _0x6603=function(_0x1f4b59,_0xc4d850){_0x1f4b59=_0x1f4b59-0x0;var _0x349a56=_0x6036[_0x1f4b59];return _0x349a56;};'use strict';var Sequelize=require(_0x6603('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x6603('0x1')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x6603('0x1')],'allowNull':![],'defaultValue':_0x6603('0x2')},'remoteUri':{'type':Sequelize[_0x6603('0x1')],'allowNull':![]},'serverUrl':{'type':Sequelize['STRING']},'accessKey':{'type':Sequelize[_0x6603('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index 166f2c8..c24a7bb 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 _0x3ac8=['../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','test','Sequelize','ValidationError','request','then','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','error','code','message','sendStatus','end','status','json','count','offset','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','map','VtigerAccount','rawAttributes','type','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','getConfigurations','findOne','AccountId','Subjects','Descriptions','VtigerField','md5','username','description','moduleName','remoteUri','serverUrl','accessKey','slice','format','%s/webservice.php','GET','getchallenge','success','POST','login','result','token','sessionName','autogenerated','owner','editable','false','cf_','picklist','picklistValues','log','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','ioredis','../../components/auth/service'];(function(_0x312108,_0x72fc13){var _0x307443=function(_0x89b32a){while(--_0x89b32a){_0x312108['push'](_0x312108['shift']());}};_0x307443(++_0x72fc13);}(_0x3ac8,0x6b));var _0x83ac=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3ac8[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x83ac('0x0'));var emlformat=require(_0x83ac('0x1'));var rimraf=require(_0x83ac('0x2'));var zipdir=require(_0x83ac('0x3'));var jsonpatch=require(_0x83ac('0x4'));var rp=require(_0x83ac('0x5'));var moment=require('moment');var BPromise=require(_0x83ac('0x6'));var Mustache=require(_0x83ac('0x7'));var util=require(_0x83ac('0x8'));var path=require(_0x83ac('0x9'));var sox=require(_0x83ac('0xa'));var csv=require(_0x83ac('0xb'));var ejs=require(_0x83ac('0xc'));var fs=require('fs');var _=require(_0x83ac('0xd'));var squel=require(_0x83ac('0xe'));var crypto=require(_0x83ac('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x83ac('0x10'));var toCsv=require(_0x83ac('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x83ac('0x11'));var authService=require(_0x83ac('0x12'));var qs=require(_0x83ac('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x83ac('0x14'));var logger=require(_0x83ac('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x83ac('0x16'));var db=require(_0x83ac('0x17'))['db'];var integrations=require(_0x83ac('0x18'));var jayson=require(_0x83ac('0x19'));var client=jayson[_0x83ac('0x1a')][_0x83ac('0x1b')]({'port':0x232a});function checkPasswordPattern(_0x30c95d,_0x27487f,_0x2506e0){if(_0x2506e0){var _0x3f9ff1=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3f9ff1[_0x83ac('0x1c')](_0x27487f)){return _0x30c95d;}else{throw new db[(_0x83ac('0x1d'))][(_0x83ac('0x1e'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x30c95d;}}function respondWithRpcPromise(_0x2616df,_0x164cd5,_0x2ca4ea,_0x110137){return new BPromise(function(_0x39b266,_0x3983db){var _0x4744f8=_0x110137||client;return _0x4744f8[_0x83ac('0x1f')](_0x2616df,_0x2ca4ea)[_0x83ac('0x20')](function(_0x14a0cf){logger['info'](_0x83ac('0x21'),_0x164cd5,_0x83ac('0x22'));logger[_0x83ac('0x23')](_0x83ac('0x24'),_0x164cd5,_0x83ac('0x22'),JSON['stringify'](_0x14a0cf));if(_0x14a0cf[_0x83ac('0x25')]){if(_0x14a0cf['error'][_0x83ac('0x26')]===0x1f4){logger[_0x83ac('0x25')](_0x83ac('0x21'),_0x164cd5,_0x14a0cf[_0x83ac('0x25')][_0x83ac('0x27')]);return _0x3983db(_0x14a0cf[_0x83ac('0x25')][_0x83ac('0x27')]);}logger[_0x83ac('0x25')](_0x83ac('0x21'),_0x164cd5,_0x14a0cf['error'][_0x83ac('0x27')]);return _0x39b266(_0x14a0cf[_0x83ac('0x25')][_0x83ac('0x27')]);}else{logger['info'](_0x83ac('0x21'),_0x164cd5,'request\x20sent');_0x39b266(_0x14a0cf['result'][_0x83ac('0x27')]);}})['catch'](function(_0x4a312f){logger[_0x83ac('0x25')](_0x83ac('0x21'),_0x164cd5,_0x4a312f);_0x3983db(_0x4a312f);});});}function respondWithStatusCode(_0x542900,_0x40eb5b){_0x40eb5b=_0x40eb5b||0xcc;return function(_0x5072d5){if(_0x5072d5){return _0x542900[_0x83ac('0x28')](_0x40eb5b);}return _0x542900['status'](_0x40eb5b)[_0x83ac('0x29')]();};}function respondWithResult(_0x5eb62b,_0x2ea07a){_0x2ea07a=_0x2ea07a||0xc8;return function(_0x1a88cf){if(_0x1a88cf){return _0x5eb62b[_0x83ac('0x2a')](_0x2ea07a)[_0x83ac('0x2b')](_0x1a88cf);}};}function respondWithFilteredResult(_0x30d8ec,_0x4704cb){return function(_0x1ce56f){if(_0x1ce56f){var _0x271379=_0x1ce56f[_0x83ac('0x2c')],_0x315c03=_0x4704cb[_0x83ac('0x2d')],_0x3d30c9=_0x4704cb[_0x83ac('0x2d')]+_0x4704cb['limit'],_0x18aa9c;if(_0x3d30c9>=_0x271379){_0x3d30c9=_0x271379;_0x18aa9c=0xc8;}else{_0x18aa9c=0xce;}_0x30d8ec[_0x83ac('0x2a')](_0x18aa9c);return _0x30d8ec[_0x83ac('0x2e')](_0x83ac('0x2f'),_0x315c03+'-'+_0x3d30c9+'/'+_0x271379)[_0x83ac('0x2b')](_0x1ce56f);}return null;};}function patchUpdates(_0x414e76){return function(_0x538a71){try{jsonpatch[_0x83ac('0x30')](_0x538a71,_0x414e76,!![]);}catch(_0xa022a0){return BPromise[_0x83ac('0x31')](_0xa022a0);}return _0x538a71[_0x83ac('0x32')]();};}function saveUpdates(_0x24439b,_0x4acd5e){return function(_0x48c563){if(_0x48c563){return _0x48c563[_0x83ac('0x33')](_0x24439b)[_0x83ac('0x20')](function(_0x212f04){return _0x212f04;});}return null;};}function removeEntity(_0x1de48f,_0x10377e){return function(_0x380816){if(_0x380816){return _0x380816[_0x83ac('0x34')]()['then'](function(){_0x1de48f['status'](0xcc)[_0x83ac('0x29')]();});}};}function handleEntityNotFound(_0xd1e419,_0x2d137c){return function(_0x2499d3){if(!_0x2499d3){_0xd1e419['sendStatus'](0x194);}return _0x2499d3;};}function handleError(_0x1a2b74,_0x3c8bae){_0x3c8bae=_0x3c8bae||0x1f4;return function(_0x552315){logger['error'](_0x552315[_0x83ac('0x35')]);if(_0x552315['name']){delete _0x552315[_0x83ac('0x36')];}_0x1a2b74['status'](_0x3c8bae)[_0x83ac('0x37')](_0x552315);};}exports[_0x83ac('0x38')]=function(_0x936ff1,_0xac5076){var _0x1d66b9={},_0x10c378={},_0x51b54f={'count':0x0,'rows':[]};var _0x4408bb=_[_0x83ac('0x39')](db[_0x83ac('0x3a')][_0x83ac('0x3b')],function(_0x3997bd){return{'name':_0x3997bd['fieldName'],'type':_0x3997bd[_0x83ac('0x3c')]['key']};});_0x10c378[_0x83ac('0x3d')]=_[_0x83ac('0x39')](_0x4408bb,_0x83ac('0x36'));_0x10c378[_0x83ac('0x3e')]=_[_0x83ac('0x3f')](_0x936ff1[_0x83ac('0x3e')]);_0x10c378['filters']=_[_0x83ac('0x40')](_0x10c378['model'],_0x10c378[_0x83ac('0x3e')]);_0x1d66b9['attributes']=_[_0x83ac('0x40')](_0x10c378[_0x83ac('0x3d')],qs[_0x83ac('0x41')](_0x936ff1[_0x83ac('0x3e')]['fields']));_0x1d66b9[_0x83ac('0x42')]=_0x1d66b9[_0x83ac('0x42')][_0x83ac('0x43')]?_0x1d66b9[_0x83ac('0x42')]:_0x10c378[_0x83ac('0x3d')];if(!_0x936ff1[_0x83ac('0x3e')][_0x83ac('0x44')](_0x83ac('0x45'))){_0x1d66b9[_0x83ac('0x46')]=qs[_0x83ac('0x46')](_0x936ff1[_0x83ac('0x3e')][_0x83ac('0x46')]);_0x1d66b9['offset']=qs[_0x83ac('0x2d')](_0x936ff1[_0x83ac('0x3e')]['offset']);}_0x1d66b9[_0x83ac('0x47')]=qs[_0x83ac('0x48')](_0x936ff1[_0x83ac('0x3e')]['sort']);_0x1d66b9[_0x83ac('0x49')]=qs[_0x83ac('0x4a')](_[_0x83ac('0x4b')](_0x936ff1[_0x83ac('0x3e')],_0x10c378[_0x83ac('0x4a')]));if(_0x936ff1[_0x83ac('0x3e')][_0x83ac('0x4c')]){_0x1d66b9[_0x83ac('0x49')]=_['merge'](_0x1d66b9[_0x83ac('0x49')],{'$or':_[_0x83ac('0x39')](_0x4408bb,function(_0x5b695b){if(_0x5b695b[_0x83ac('0x3c')]!==_0x83ac('0x4d')){var _0x378080={};_0x378080[_0x5b695b[_0x83ac('0x36')]]={'$like':'%'+_0x936ff1['query'][_0x83ac('0x4c')]+'%'};return _0x378080;}})});}_0x1d66b9=_[_0x83ac('0x4e')]({},_0x1d66b9,_0x936ff1[_0x83ac('0x4f')]);var _0x2e2d17={'where':_0x1d66b9[_0x83ac('0x49')]};return db[_0x83ac('0x3a')][_0x83ac('0x2c')](_0x2e2d17)[_0x83ac('0x20')](function(_0x76bd45){_0x51b54f[_0x83ac('0x2c')]=_0x76bd45;if(_0x936ff1[_0x83ac('0x3e')][_0x83ac('0x50')]){_0x1d66b9['include']=[{'all':!![]}];}return db[_0x83ac('0x3a')][_0x83ac('0x51')](_0x1d66b9);})[_0x83ac('0x20')](function(_0x3dc218){_0x51b54f[_0x83ac('0x52')]=_0x3dc218;return _0x51b54f;})['then'](respondWithFilteredResult(_0xac5076,_0x1d66b9))[_0x83ac('0x53')](handleError(_0xac5076,null));};exports[_0x83ac('0x54')]=function(_0x45d5e7,_0x15d3ab){var _0x1b67b2={'raw':![],'where':{'id':_0x45d5e7[_0x83ac('0x55')]['id']}},_0xf30e51={};_0xf30e51[_0x83ac('0x3d')]=_[_0x83ac('0x3f')](db[_0x83ac('0x3a')][_0x83ac('0x3b')]);_0xf30e51[_0x83ac('0x3e')]=_[_0x83ac('0x3f')](_0x45d5e7[_0x83ac('0x3e')]);_0xf30e51[_0x83ac('0x4a')]=_['intersection'](_0xf30e51[_0x83ac('0x3d')],_0xf30e51[_0x83ac('0x3e')]);_0x1b67b2[_0x83ac('0x42')]=_[_0x83ac('0x40')](_0xf30e51[_0x83ac('0x3d')],qs[_0x83ac('0x41')](_0x45d5e7[_0x83ac('0x3e')][_0x83ac('0x41')]));_0x1b67b2[_0x83ac('0x42')]=_0x1b67b2[_0x83ac('0x42')]['length']?_0x1b67b2[_0x83ac('0x42')]:_0xf30e51[_0x83ac('0x3d')];if(_0x45d5e7['query'][_0x83ac('0x50')]){_0x1b67b2[_0x83ac('0x56')]=[{'all':!![]}];}_0x1b67b2=_[_0x83ac('0x4e')]({},_0x1b67b2,_0x45d5e7[_0x83ac('0x4f')]);return db[_0x83ac('0x3a')][_0x83ac('0x57')](_0x1b67b2)[_0x83ac('0x20')](handleEntityNotFound(_0x15d3ab,null))['then'](respondWithResult(_0x15d3ab,null))[_0x83ac('0x53')](handleError(_0x15d3ab,null));};exports['create']=function(_0x3dc61a,_0x1fe7d0){return db[_0x83ac('0x3a')][_0x83ac('0x58')](_0x3dc61a[_0x83ac('0x59')],{})['then'](respondWithResult(_0x1fe7d0,0xc9))[_0x83ac('0x53')](handleError(_0x1fe7d0,null));};exports[_0x83ac('0x33')]=function(_0x258285,_0x70fd87){if(_0x258285['body']['id']){delete _0x258285['body']['id'];}return db[_0x83ac('0x3a')]['find']({'where':{'id':_0x258285[_0x83ac('0x55')]['id']}})[_0x83ac('0x20')](handleEntityNotFound(_0x70fd87,null))[_0x83ac('0x20')](saveUpdates(_0x258285[_0x83ac('0x59')],null))[_0x83ac('0x20')](respondWithResult(_0x70fd87,null))[_0x83ac('0x53')](handleError(_0x70fd87,null));};exports[_0x83ac('0x34')]=function(_0x44e7c7,_0x4186e7){return db[_0x83ac('0x3a')][_0x83ac('0x57')]({'where':{'id':_0x44e7c7[_0x83ac('0x55')]['id']}})['then'](handleEntityNotFound(_0x4186e7,null))[_0x83ac('0x20')](removeEntity(_0x4186e7,null))[_0x83ac('0x53')](handleError(_0x4186e7,null));};exports[_0x83ac('0x5a')]=function(_0x12053d,_0x44e15c,_0x192cb7){var _0x57a71b={};var _0x1de662={};var _0x4ace0f;var _0x56ecf2;return db[_0x83ac('0x3a')][_0x83ac('0x5b')]({'where':{'id':_0x12053d[_0x83ac('0x55')]['id']}})[_0x83ac('0x20')](handleEntityNotFound(_0x44e15c,null))[_0x83ac('0x20')](function(_0x191b89){if(_0x191b89){_0x4ace0f=_0x191b89;_0x1de662[_0x83ac('0x3d')]=_[_0x83ac('0x3f')](db['VtigerConfiguration']['rawAttributes']);_0x1de662[_0x83ac('0x3e')]=_[_0x83ac('0x3f')](_0x12053d[_0x83ac('0x3e')]);_0x1de662['filters']=_[_0x83ac('0x40')](_0x1de662[_0x83ac('0x3d')],_0x1de662[_0x83ac('0x3e')]);_0x57a71b[_0x83ac('0x42')]=_[_0x83ac('0x40')](_0x1de662[_0x83ac('0x3d')],qs[_0x83ac('0x41')](_0x12053d[_0x83ac('0x3e')][_0x83ac('0x41')]));_0x57a71b[_0x83ac('0x42')]=_0x57a71b[_0x83ac('0x42')][_0x83ac('0x43')]?_0x57a71b[_0x83ac('0x42')]:_0x1de662[_0x83ac('0x3d')];_0x57a71b[_0x83ac('0x47')]=qs['sort'](_0x12053d['query'][_0x83ac('0x48')]);_0x57a71b['where']=qs[_0x83ac('0x4a')](_[_0x83ac('0x4b')](_0x12053d[_0x83ac('0x3e')],_0x1de662[_0x83ac('0x4a')]));if(_0x12053d[_0x83ac('0x3e')]['filter']){_0x57a71b['where']=_[_0x83ac('0x4e')](_0x57a71b[_0x83ac('0x49')],{'$or':_['map'](_0x57a71b[_0x83ac('0x42')],function(_0x1f04c8){var _0x1df72e={};_0x1df72e[_0x1f04c8]={'$like':'%'+_0x12053d[_0x83ac('0x3e')][_0x83ac('0x4c')]+'%'};return _0x1df72e;})});}_0x57a71b=_[_0x83ac('0x4e')]({},_0x57a71b,_0x12053d[_0x83ac('0x4f')]);return _0x4ace0f[_0x83ac('0x5a')](_0x57a71b);}})['then'](function(_0x233204){if(_0x233204){_0x56ecf2=_0x233204[_0x83ac('0x43')];if(!_0x12053d[_0x83ac('0x3e')][_0x83ac('0x44')]('nolimit')){_0x57a71b[_0x83ac('0x46')]=qs[_0x83ac('0x46')](_0x12053d[_0x83ac('0x3e')][_0x83ac('0x46')]);_0x57a71b[_0x83ac('0x2d')]=qs[_0x83ac('0x2d')](_0x12053d[_0x83ac('0x3e')]['offset']);}return _0x4ace0f[_0x83ac('0x5a')](_0x57a71b);}})[_0x83ac('0x20')](function(_0x56dee8){if(_0x56dee8){return _0x56dee8?{'count':_0x56ecf2,'rows':_0x56dee8}:null;}})['then'](respondWithResult(_0x44e15c,null))[_0x83ac('0x53')](handleError(_0x44e15c,null));};exports['addConfiguration']=function(_0x419cad,_0x40d76c,_0x1923be){if(_0x419cad[_0x83ac('0x59')]['id']){delete _0x419cad[_0x83ac('0x59')]['id'];}return db[_0x83ac('0x3a')][_0x83ac('0x5b')]({'where':{'id':_0x419cad[_0x83ac('0x55')]['id']}})[_0x83ac('0x20')](handleEntityNotFound(_0x40d76c,null))['then'](function(_0x14a148){if(_0x14a148){_0x419cad[_0x83ac('0x59')][_0x83ac('0x5c')]=_0x14a148['id'];_0x419cad['body'][_0x83ac('0x5d')]=integrations['getSubjects'](_0x419cad[_0x83ac('0x59')]['channel'],_0x419cad[_0x83ac('0x59')][_0x83ac('0x3c')]);_0x419cad[_0x83ac('0x59')][_0x83ac('0x5e')]=integrations['getDescriptions'](_0x419cad[_0x83ac('0x59')]['channel'],_0x419cad[_0x83ac('0x59')]['type']);return db['VtigerConfiguration']['create'](_0x419cad[_0x83ac('0x59')],{'include':[{'model':db[_0x83ac('0x5f')],'as':_0x83ac('0x5d')},{'model':db['VtigerField'],'as':'Descriptions'}]});}return null;})[_0x83ac('0x20')](respondWithResult(_0x40d76c,null))[_0x83ac('0x53')](handleError(_0x40d76c,null));};var md5=require(_0x83ac('0x60'));exports['getFields']=function(_0x5a00ac,_0x1f1645,_0x393576){var _0x30e7e9=null;var _0x5a53fa=null;var _0x11c35d=null;var _0x52c4af=null;var _0x49a0e8='';return db[_0x83ac('0x3a')][_0x83ac('0x5b')]({'where':{'id':_0x5a00ac[_0x83ac('0x55')]['id']},'attributes':['id',_0x83ac('0x36'),_0x83ac('0x61'),_0x83ac('0x62'),_0x83ac('0x63'),_0x83ac('0x64'),_0x83ac('0x65'),_0x83ac('0x66')]})[_0x83ac('0x20')](handleEntityNotFound(_0x1f1645,null))[_0x83ac('0x20')](function(_0x312cd3){if(_0x312cd3){_0x30e7e9=_0x312cd3['username'];_0x5a53fa=_0x312cd3[_0x83ac('0x66')];_0x11c35d=_0x312cd3[_0x83ac('0x63')];_0x49a0e8=_0x312cd3[_0x83ac('0x64')];var _0x3e4843=_0x49a0e8[_0x83ac('0x67')](-0x1);if(_0x3e4843==='/'){_0x49a0e8=_0x49a0e8['substring'](0x0,_0x49a0e8['lastIndexOf'](_0x3e4843));}_0x52c4af=util[_0x83ac('0x68')](_0x83ac('0x69'),_0x49a0e8);var _0x571a0f={'method':_0x83ac('0x6a'),'uri':_0x52c4af,'qs':{'operation':_0x83ac('0x6b'),'username':_0x312cd3[_0x83ac('0x61')]},'json':!![]};return rp(_0x571a0f);}})[_0x83ac('0x20')](function(_0x1e351){if(_0x1e351[_0x83ac('0x6c')]){var _0x4cd05a={'method':_0x83ac('0x6d'),'uri':_0x52c4af,'form':{'operation':_0x83ac('0x6e'),'username':_0x30e7e9,'accessKey':md5(_0x1e351[_0x83ac('0x6f')][_0x83ac('0x70')]+_0x5a53fa)},'json':!![]};return rp(_0x4cd05a);}})[_0x83ac('0x20')](function(_0x5efa9c){if(_0x5efa9c[_0x83ac('0x6c')]){var _0x37e015={'method':_0x83ac('0x6a'),'uri':_0x52c4af,'qs':{'operation':'describe','username':_0x30e7e9,'sessionName':_0x5efa9c['result'][_0x83ac('0x71')],'elementType':_0x11c35d},'json':!![]};return rp(_0x37e015);}})[_0x83ac('0x20')](function(_0x22f3db){if(_0x22f3db['success']){var _0x396752=[_0x83ac('0x72'),'reference',_0x83ac('0x73')];_['remove'](_0x22f3db[_0x83ac('0x6f')][_0x83ac('0x41')],function(_0x1b9b05){return _0x396752['includes'](_0x1b9b05[_0x83ac('0x3c')]['name']);});_['remove'](_0x22f3db[_0x83ac('0x6f')][_0x83ac('0x41')],function(_0xb22955){return _0xb22955[_0x83ac('0x74')]===_0x83ac('0x75');});return{'count':_0x22f3db[_0x83ac('0x6f')][_0x83ac('0x41')][_0x83ac('0x43')],'rows':_[_0x83ac('0x39')](_0x22f3db['result']['fields'],function(_0x475a0b){return{'id':_0x475a0b[_0x83ac('0x36')],'name':_0x475a0b['label'],'custom':_['startsWith'](_0x475a0b[_0x83ac('0x36')],_0x83ac('0x76'))?!![]:![],'options':_0x475a0b[_0x83ac('0x3c')][_0x83ac('0x36')]===_0x83ac('0x77')&&_0x475a0b[_0x83ac('0x3c')][_0x83ac('0x78')][_0x83ac('0x43')]>0x0?_[_0x83ac('0x39')](_0x475a0b[_0x83ac('0x3c')][_0x83ac('0x78')],function(_0x19e4c6){return{'name':_0x19e4c6['label'],'value':_0x19e4c6['value']};}):[]};})};}})[_0x83ac('0x20')](respondWithResult(_0x1f1645,null))[_0x83ac('0x53')](function(_0x1023ce){console[_0x83ac('0x79')]('vTiger\x20error:\x20'+_0x1023ce);var _0x41c4ae=_0x5a00ac['query'][_0x83ac('0x1c')]?0x1f4:_0x1023ce['statusCode']||0x1f4;logger['error'](_0x83ac('0x7a'),_0x83ac('0x7b'),_0x41c4ae,JSON[_0x83ac('0x7c')](_0x1023ce));delete _0x1023ce[_0x83ac('0x36')];if(_0x41c4ae===0x191){_0x41c4ae=0x190;}_0x1f1645['status'](_0x41c4ae)[_0x83ac('0x37')](_0x5a00ac[_0x83ac('0x3e')]['test']?{'message':_0x83ac('0x7d'),'statusCode':_0x1023ce['statusCode']}:_0x1023ce);});}; \ No newline at end of file +var _0x32b6=['VtigerAccount','fieldName','type','key','model','map','name','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','params','rawAttributes','fields','find','create','update','body','getConfigurations','findOne','addConfiguration','AccountId','getSubjects','channel','VtigerField','Descriptions','md5','getFields','description','accessKey','username','moduleName','slice','substring','lastIndexOf','format','%s/webservice.php','GET','success','describe','sessionName','autogenerated','reference','owner','includes','remove','editable','label','startsWith','cf_','picklist','value','log','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','html-pdf','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info','VtigerAccount,\x20%s,\x20%s','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','stack','send','index'];(function(_0x344a3f,_0x579a22){var _0x264712=function(_0x34c9f0){while(--_0x34c9f0){_0x344a3f['push'](_0x344a3f['shift']());}};_0x264712(++_0x579a22);}(_0x32b6,0x1d1));var _0x632b=function(_0x182336,_0x21cddf){_0x182336=_0x182336-0x0;var _0x3372ff=_0x32b6[_0x182336];return _0x3372ff;};'use strict';var pdf=require(_0x632b('0x0'));var emlformat=require(_0x632b('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x632b('0x2'));var jsonpatch=require(_0x632b('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x632b('0x4'));var Mustache=require(_0x632b('0x5'));var util=require(_0x632b('0x6'));var path=require(_0x632b('0x7'));var sox=require(_0x632b('0x8'));var csv=require(_0x632b('0x9'));var ejs=require(_0x632b('0xa'));var fs=require('fs');var _=require(_0x632b('0xb'));var squel=require(_0x632b('0xc'));var crypto=require(_0x632b('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x632b('0xe'));var toCsv=require(_0x632b('0x9'));var querystring=require(_0x632b('0xf'));var Papa=require(_0x632b('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x632b('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x632b('0x12'))(_0x632b('0x13'));var utils=require(_0x632b('0x14'));var config=require(_0x632b('0x15'));var db=require(_0x632b('0x16'))['db'];var integrations=require(_0x632b('0x17'));var jayson=require(_0x632b('0x18'));var client=jayson[_0x632b('0x19')][_0x632b('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x536aa2,_0xb5416c,_0x286f75){if(_0x286f75){var _0x9246a6=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x9246a6['test'](_0xb5416c)){return _0x536aa2;}else{throw new db[(_0x632b('0x1b'))][(_0x632b('0x1c'))](_0x632b('0x1d'));}}else{return _0x536aa2;}}function respondWithRpcPromise(_0x17ff9b,_0x40d410,_0x21cdd3,_0x4efe39){return new BPromise(function(_0x17ddc5,_0x52f353){var _0x4fdef2=_0x4efe39||client;return _0x4fdef2[_0x632b('0x1e')](_0x17ff9b,_0x21cdd3)['then'](function(_0x2c8340){logger[_0x632b('0x1f')](_0x632b('0x20'),_0x40d410,'request\x20sent');logger[_0x632b('0x21')](_0x632b('0x22'),_0x40d410,_0x632b('0x23'),JSON[_0x632b('0x24')](_0x2c8340));if(_0x2c8340['error']){if(_0x2c8340[_0x632b('0x25')][_0x632b('0x26')]===0x1f4){logger['error'](_0x632b('0x20'),_0x40d410,_0x2c8340['error']['message']);return _0x52f353(_0x2c8340[_0x632b('0x25')]['message']);}logger[_0x632b('0x25')](_0x632b('0x20'),_0x40d410,_0x2c8340[_0x632b('0x25')]['message']);return _0x17ddc5(_0x2c8340[_0x632b('0x25')][_0x632b('0x27')]);}else{logger['info'](_0x632b('0x20'),_0x40d410,_0x632b('0x23'));_0x17ddc5(_0x2c8340[_0x632b('0x28')][_0x632b('0x27')]);}})[_0x632b('0x29')](function(_0x183c5c){logger['error']('VtigerAccount,\x20%s,\x20%s',_0x40d410,_0x183c5c);_0x52f353(_0x183c5c);});});}function respondWithStatusCode(_0x11fe61,_0x4d3a70){_0x4d3a70=_0x4d3a70||0xcc;return function(_0x4ebd26){if(_0x4ebd26){return _0x11fe61[_0x632b('0x2a')](_0x4d3a70);}return _0x11fe61['status'](_0x4d3a70)[_0x632b('0x2b')]();};}function respondWithResult(_0x3f4eab,_0x29d9aa){_0x29d9aa=_0x29d9aa||0xc8;return function(_0x18dc8c){if(_0x18dc8c){return _0x3f4eab[_0x632b('0x2c')](_0x29d9aa)[_0x632b('0x2d')](_0x18dc8c);}};}function respondWithFilteredResult(_0xe9d530,_0x1975ac){return function(_0x33a625){if(_0x33a625){var _0x4f8410=_0x33a625[_0x632b('0x2e')],_0x1bb484=_0x1975ac[_0x632b('0x2f')],_0x35348e=_0x1975ac[_0x632b('0x2f')]+_0x1975ac[_0x632b('0x30')],_0x1819fa;if(_0x35348e>=_0x4f8410){_0x35348e=_0x4f8410;_0x1819fa=0xc8;}else{_0x1819fa=0xce;}_0xe9d530[_0x632b('0x2c')](_0x1819fa);return _0xe9d530[_0x632b('0x31')](_0x632b('0x32'),_0x1bb484+'-'+_0x35348e+'/'+_0x4f8410)[_0x632b('0x2d')](_0x33a625);}return null;};}function patchUpdates(_0x35584f){return function(_0x2a7a44){try{jsonpatch[_0x632b('0x33')](_0x2a7a44,_0x35584f,!![]);}catch(_0x227497){return BPromise[_0x632b('0x34')](_0x227497);}return _0x2a7a44[_0x632b('0x35')]();};}function saveUpdates(_0x36936d,_0x3f3dc4){return function(_0x12f00){if(_0x12f00){return _0x12f00['update'](_0x36936d)[_0x632b('0x36')](function(_0x4401dc){return _0x4401dc;});}return null;};}function removeEntity(_0x397f36,_0x1220a7){return function(_0x5857e4){if(_0x5857e4){return _0x5857e4[_0x632b('0x37')]()['then'](function(){_0x397f36[_0x632b('0x2c')](0xcc)[_0x632b('0x2b')]();});}};}function handleEntityNotFound(_0x4ffe00,_0x2265aa){return function(_0xa228ed){if(!_0xa228ed){_0x4ffe00[_0x632b('0x2a')](0x194);}return _0xa228ed;};}function handleError(_0x11b766,_0x27bbf5){_0x27bbf5=_0x27bbf5||0x1f4;return function(_0x2a7998){logger[_0x632b('0x25')](_0x2a7998[_0x632b('0x38')]);if(_0x2a7998['name']){delete _0x2a7998['name'];}_0x11b766[_0x632b('0x2c')](_0x27bbf5)[_0x632b('0x39')](_0x2a7998);};}exports[_0x632b('0x3a')]=function(_0x2a723a,_0x384420){var _0x27582f={},_0x1d9020={},_0x16a2cb={'count':0x0,'rows':[]};var _0x5bd161=_['map'](db[_0x632b('0x3b')]['rawAttributes'],function(_0x3a416c){return{'name':_0x3a416c[_0x632b('0x3c')],'type':_0x3a416c[_0x632b('0x3d')][_0x632b('0x3e')]};});_0x1d9020[_0x632b('0x3f')]=_[_0x632b('0x40')](_0x5bd161,_0x632b('0x41'));_0x1d9020[_0x632b('0x42')]=_[_0x632b('0x43')](_0x2a723a[_0x632b('0x42')]);_0x1d9020[_0x632b('0x44')]=_[_0x632b('0x45')](_0x1d9020[_0x632b('0x3f')],_0x1d9020[_0x632b('0x42')]);_0x27582f[_0x632b('0x46')]=_[_0x632b('0x45')](_0x1d9020[_0x632b('0x3f')],qs['fields'](_0x2a723a['query']['fields']));_0x27582f['attributes']=_0x27582f['attributes'][_0x632b('0x47')]?_0x27582f['attributes']:_0x1d9020['model'];if(!_0x2a723a['query'][_0x632b('0x48')](_0x632b('0x49'))){_0x27582f[_0x632b('0x30')]=qs[_0x632b('0x30')](_0x2a723a['query'][_0x632b('0x30')]);_0x27582f[_0x632b('0x2f')]=qs[_0x632b('0x2f')](_0x2a723a['query'][_0x632b('0x2f')]);}_0x27582f[_0x632b('0x4a')]=qs[_0x632b('0x4b')](_0x2a723a[_0x632b('0x42')][_0x632b('0x4b')]);_0x27582f[_0x632b('0x4c')]=qs['filters'](_[_0x632b('0x4d')](_0x2a723a[_0x632b('0x42')],_0x1d9020[_0x632b('0x44')]));if(_0x2a723a[_0x632b('0x42')]['filter']){_0x27582f['where']=_[_0x632b('0x4e')](_0x27582f[_0x632b('0x4c')],{'$or':_[_0x632b('0x40')](_0x5bd161,function(_0x3566e7){if(_0x3566e7[_0x632b('0x3d')]!==_0x632b('0x4f')){var _0x56a548={};_0x56a548[_0x3566e7[_0x632b('0x41')]]={'$like':'%'+_0x2a723a[_0x632b('0x42')][_0x632b('0x50')]+'%'};return _0x56a548;}})});}_0x27582f=_[_0x632b('0x4e')]({},_0x27582f,_0x2a723a[_0x632b('0x51')]);var _0x41b48e={'where':_0x27582f[_0x632b('0x4c')]};return db[_0x632b('0x3b')]['count'](_0x41b48e)[_0x632b('0x36')](function(_0x56f254){_0x16a2cb[_0x632b('0x2e')]=_0x56f254;if(_0x2a723a['query'][_0x632b('0x52')]){_0x27582f[_0x632b('0x53')]=[{'all':!![]}];}return db[_0x632b('0x3b')][_0x632b('0x54')](_0x27582f);})[_0x632b('0x36')](function(_0x57a580){_0x16a2cb[_0x632b('0x55')]=_0x57a580;return _0x16a2cb;})[_0x632b('0x36')](respondWithFilteredResult(_0x384420,_0x27582f))[_0x632b('0x29')](handleError(_0x384420,null));};exports['show']=function(_0x253aec,_0x16eb80){var _0x26b7f4={'raw':![],'where':{'id':_0x253aec[_0x632b('0x56')]['id']}},_0x35f25a={};_0x35f25a['model']=_[_0x632b('0x43')](db['VtigerAccount'][_0x632b('0x57')]);_0x35f25a[_0x632b('0x42')]=_[_0x632b('0x43')](_0x253aec[_0x632b('0x42')]);_0x35f25a[_0x632b('0x44')]=_['intersection'](_0x35f25a['model'],_0x35f25a[_0x632b('0x42')]);_0x26b7f4[_0x632b('0x46')]=_[_0x632b('0x45')](_0x35f25a[_0x632b('0x3f')],qs[_0x632b('0x58')](_0x253aec[_0x632b('0x42')]['fields']));_0x26b7f4[_0x632b('0x46')]=_0x26b7f4[_0x632b('0x46')][_0x632b('0x47')]?_0x26b7f4['attributes']:_0x35f25a[_0x632b('0x3f')];if(_0x253aec[_0x632b('0x42')][_0x632b('0x52')]){_0x26b7f4[_0x632b('0x53')]=[{'all':!![]}];}_0x26b7f4=_['merge']({},_0x26b7f4,_0x253aec[_0x632b('0x51')]);return db[_0x632b('0x3b')][_0x632b('0x59')](_0x26b7f4)[_0x632b('0x36')](handleEntityNotFound(_0x16eb80,null))[_0x632b('0x36')](respondWithResult(_0x16eb80,null))['catch'](handleError(_0x16eb80,null));};exports[_0x632b('0x5a')]=function(_0x29051a,_0x39ccc7){return db[_0x632b('0x3b')][_0x632b('0x5a')](_0x29051a['body'],{})[_0x632b('0x36')](respondWithResult(_0x39ccc7,0xc9))[_0x632b('0x29')](handleError(_0x39ccc7,null));};exports[_0x632b('0x5b')]=function(_0x360516,_0x1f5fdf){if(_0x360516[_0x632b('0x5c')]['id']){delete _0x360516[_0x632b('0x5c')]['id'];}return db[_0x632b('0x3b')][_0x632b('0x59')]({'where':{'id':_0x360516[_0x632b('0x56')]['id']}})[_0x632b('0x36')](handleEntityNotFound(_0x1f5fdf,null))['then'](saveUpdates(_0x360516[_0x632b('0x5c')],null))[_0x632b('0x36')](respondWithResult(_0x1f5fdf,null))[_0x632b('0x29')](handleError(_0x1f5fdf,null));};exports[_0x632b('0x37')]=function(_0x2b767a,_0x5aa669){return db[_0x632b('0x3b')][_0x632b('0x59')]({'where':{'id':_0x2b767a[_0x632b('0x56')]['id']}})[_0x632b('0x36')](handleEntityNotFound(_0x5aa669,null))[_0x632b('0x36')](removeEntity(_0x5aa669,null))[_0x632b('0x29')](handleError(_0x5aa669,null));};exports[_0x632b('0x5d')]=function(_0x4ffa35,_0x14ee44,_0x4b7307){var _0x2b9cf2={};var _0x541b51={};var _0xddc351;var _0x562b67;return db[_0x632b('0x3b')][_0x632b('0x5e')]({'where':{'id':_0x4ffa35['params']['id']}})['then'](handleEntityNotFound(_0x14ee44,null))[_0x632b('0x36')](function(_0x3fe1a1){if(_0x3fe1a1){_0xddc351=_0x3fe1a1;_0x541b51[_0x632b('0x3f')]=_[_0x632b('0x43')](db['VtigerConfiguration'][_0x632b('0x57')]);_0x541b51[_0x632b('0x42')]=_['keys'](_0x4ffa35[_0x632b('0x42')]);_0x541b51['filters']=_[_0x632b('0x45')](_0x541b51[_0x632b('0x3f')],_0x541b51['query']);_0x2b9cf2[_0x632b('0x46')]=_[_0x632b('0x45')](_0x541b51[_0x632b('0x3f')],qs[_0x632b('0x58')](_0x4ffa35['query'][_0x632b('0x58')]));_0x2b9cf2[_0x632b('0x46')]=_0x2b9cf2[_0x632b('0x46')][_0x632b('0x47')]?_0x2b9cf2['attributes']:_0x541b51[_0x632b('0x3f')];_0x2b9cf2[_0x632b('0x4a')]=qs[_0x632b('0x4b')](_0x4ffa35[_0x632b('0x42')][_0x632b('0x4b')]);_0x2b9cf2[_0x632b('0x4c')]=qs['filters'](_[_0x632b('0x4d')](_0x4ffa35[_0x632b('0x42')],_0x541b51[_0x632b('0x44')]));if(_0x4ffa35['query']['filter']){_0x2b9cf2[_0x632b('0x4c')]=_[_0x632b('0x4e')](_0x2b9cf2[_0x632b('0x4c')],{'$or':_[_0x632b('0x40')](_0x2b9cf2[_0x632b('0x46')],function(_0x37b4b9){var _0x45d5e1={};_0x45d5e1[_0x37b4b9]={'$like':'%'+_0x4ffa35['query'][_0x632b('0x50')]+'%'};return _0x45d5e1;})});}_0x2b9cf2=_[_0x632b('0x4e')]({},_0x2b9cf2,_0x4ffa35[_0x632b('0x51')]);return _0xddc351[_0x632b('0x5d')](_0x2b9cf2);}})[_0x632b('0x36')](function(_0x4386ad){if(_0x4386ad){_0x562b67=_0x4386ad['length'];if(!_0x4ffa35[_0x632b('0x42')][_0x632b('0x48')](_0x632b('0x49'))){_0x2b9cf2[_0x632b('0x30')]=qs['limit'](_0x4ffa35[_0x632b('0x42')][_0x632b('0x30')]);_0x2b9cf2[_0x632b('0x2f')]=qs['offset'](_0x4ffa35[_0x632b('0x42')][_0x632b('0x2f')]);}return _0xddc351[_0x632b('0x5d')](_0x2b9cf2);}})[_0x632b('0x36')](function(_0x225d81){if(_0x225d81){return _0x225d81?{'count':_0x562b67,'rows':_0x225d81}:null;}})[_0x632b('0x36')](respondWithResult(_0x14ee44,null))['catch'](handleError(_0x14ee44,null));};exports[_0x632b('0x5f')]=function(_0x1f9001,_0x4fd7d4,_0x4ad866){if(_0x1f9001['body']['id']){delete _0x1f9001[_0x632b('0x5c')]['id'];}return db[_0x632b('0x3b')][_0x632b('0x5e')]({'where':{'id':_0x1f9001[_0x632b('0x56')]['id']}})[_0x632b('0x36')](handleEntityNotFound(_0x4fd7d4,null))['then'](function(_0x4b876e){if(_0x4b876e){_0x1f9001[_0x632b('0x5c')][_0x632b('0x60')]=_0x4b876e['id'];_0x1f9001['body']['Subjects']=integrations[_0x632b('0x61')](_0x1f9001[_0x632b('0x5c')]['channel'],_0x1f9001[_0x632b('0x5c')][_0x632b('0x3d')]);_0x1f9001[_0x632b('0x5c')]['Descriptions']=integrations['getDescriptions'](_0x1f9001['body'][_0x632b('0x62')],_0x1f9001[_0x632b('0x5c')][_0x632b('0x3d')]);return db['VtigerConfiguration']['create'](_0x1f9001['body'],{'include':[{'model':db[_0x632b('0x63')],'as':'Subjects'},{'model':db[_0x632b('0x63')],'as':_0x632b('0x64')}]});}return null;})[_0x632b('0x36')](respondWithResult(_0x4fd7d4,null))[_0x632b('0x29')](handleError(_0x4fd7d4,null));};var md5=require(_0x632b('0x65'));exports[_0x632b('0x66')]=function(_0xa87c08,_0x360796,_0x32e92f){var _0x260509=null;var _0x5ba09d=null;var _0x528585=null;var _0x270c08=null;var _0x4c4ad0='';return db[_0x632b('0x3b')][_0x632b('0x5e')]({'where':{'id':_0xa87c08[_0x632b('0x56')]['id']},'attributes':['id',_0x632b('0x41'),'username',_0x632b('0x67'),'moduleName','remoteUri','serverUrl',_0x632b('0x68')]})['then'](handleEntityNotFound(_0x360796,null))[_0x632b('0x36')](function(_0x14f451){if(_0x14f451){_0x260509=_0x14f451[_0x632b('0x69')];_0x5ba09d=_0x14f451[_0x632b('0x68')];_0x528585=_0x14f451[_0x632b('0x6a')];_0x4c4ad0=_0x14f451['remoteUri'];var _0x47e2a6=_0x4c4ad0[_0x632b('0x6b')](-0x1);if(_0x47e2a6==='/'){_0x4c4ad0=_0x4c4ad0[_0x632b('0x6c')](0x0,_0x4c4ad0[_0x632b('0x6d')](_0x47e2a6));}_0x270c08=util[_0x632b('0x6e')](_0x632b('0x6f'),_0x4c4ad0);var _0xcf1fba={'method':_0x632b('0x70'),'uri':_0x270c08,'qs':{'operation':'getchallenge','username':_0x14f451[_0x632b('0x69')]},'json':!![]};return rp(_0xcf1fba);}})[_0x632b('0x36')](function(_0x504a71){if(_0x504a71['success']){var _0x3393c7={'method':'POST','uri':_0x270c08,'form':{'operation':'login','username':_0x260509,'accessKey':md5(_0x504a71[_0x632b('0x28')]['token']+_0x5ba09d)},'json':!![]};return rp(_0x3393c7);}})[_0x632b('0x36')](function(_0x521d15){if(_0x521d15[_0x632b('0x71')]){var _0x590e68={'method':_0x632b('0x70'),'uri':_0x270c08,'qs':{'operation':_0x632b('0x72'),'username':_0x260509,'sessionName':_0x521d15['result'][_0x632b('0x73')],'elementType':_0x528585},'json':!![]};return rp(_0x590e68);}})[_0x632b('0x36')](function(_0x1e07da){if(_0x1e07da[_0x632b('0x71')]){var _0x2b368b=[_0x632b('0x74'),_0x632b('0x75'),_0x632b('0x76')];_['remove'](_0x1e07da['result'][_0x632b('0x58')],function(_0x805968){return _0x2b368b[_0x632b('0x77')](_0x805968[_0x632b('0x3d')][_0x632b('0x41')]);});_[_0x632b('0x78')](_0x1e07da['result'][_0x632b('0x58')],function(_0x53fb10){return _0x53fb10[_0x632b('0x79')]==='false';});return{'count':_0x1e07da[_0x632b('0x28')][_0x632b('0x58')][_0x632b('0x47')],'rows':_[_0x632b('0x40')](_0x1e07da['result'][_0x632b('0x58')],function(_0x3dcad7){return{'id':_0x3dcad7['name'],'name':_0x3dcad7[_0x632b('0x7a')],'custom':_[_0x632b('0x7b')](_0x3dcad7[_0x632b('0x41')],_0x632b('0x7c'))?!![]:![],'options':_0x3dcad7[_0x632b('0x3d')]['name']===_0x632b('0x7d')&&_0x3dcad7[_0x632b('0x3d')]['picklistValues'][_0x632b('0x47')]>0x0?_['map'](_0x3dcad7[_0x632b('0x3d')]['picklistValues'],function(_0x114683){return{'name':_0x114683['label'],'value':_0x114683[_0x632b('0x7e')]};}):[]};})};}})[_0x632b('0x36')](respondWithResult(_0x360796,null))[_0x632b('0x29')](function(_0x1f5d21){console[_0x632b('0x7f')]('vTiger\x20error:\x20'+_0x1f5d21);var _0x1b1547=_0xa87c08[_0x632b('0x42')]['test']?0x1f4:_0x1f5d21[_0x632b('0x80')]||0x1f4;logger['error'](_0x632b('0x81'),'getFields',_0x1b1547,JSON[_0x632b('0x24')](_0x1f5d21));delete _0x1f5d21['name'];if(_0x1b1547===0x191){_0x1b1547=0x190;}_0x360796[_0x632b('0x2c')](_0x1b1547)[_0x632b('0x39')](_0xa87c08[_0x632b('0x42')]['test']?{'message':_0x632b('0x82'),'statusCode':_0x1f5d21[_0x632b('0x80')]}:_0x1f5d21);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index f078ea5..3a9ce0d 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 _0x53c3=['../../components/integrations/configuration','exports','define','int_vtiger_accounts','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x52cd3c,_0x158868){var _0x31bfe3=function(_0x20c1bc){while(--_0x20c1bc){_0x52cd3c['push'](_0x52cd3c['shift']());}};_0x31bfe3(++_0x158868);}(_0x53c3,0xea));var _0x353c=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0x53c3[_0x32f7d7];return _0x133d09;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x353c('0x0'));var BPromise=require(_0x353c('0x1'));var rp=require(_0x353c('0x2'));var fs=require('fs');var path=require(_0x353c('0x3'));var rimraf=require(_0x353c('0x4'));var config=require(_0x353c('0x5'));var attributes=require('./intVtigerAccount.attributes');var integrations=require(_0x353c('0x6'));module[_0x353c('0x7')]=function(_0x2148fb,_0x2613c7){return _0x2148fb[_0x353c('0x8')]('VtigerAccount',attributes,{'tableName':_0x353c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x02eb=['int_vtiger_accounts','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','exports','define','VtigerAccount'];(function(_0x2784fe,_0xc88902){var _0x731fa2=function(_0x90f023){while(--_0x90f023){_0x2784fe['push'](_0x2784fe['shift']());}};_0x731fa2(++_0xc88902);}(_0x02eb,0x1c3));var _0xb02e=function(_0x4c2a0f,_0x18b106){_0x4c2a0f=_0x4c2a0f-0x0;var _0x101a4f=_0x02eb[_0x4c2a0f];return _0x101a4f;};'use strict';var _=require(_0xb02e('0x0'));var util=require('util');var logger=require(_0xb02e('0x1'))(_0xb02e('0x2'));var moment=require(_0xb02e('0x3'));var BPromise=require(_0xb02e('0x4'));var rp=require(_0xb02e('0x5'));var fs=require('fs');var path=require(_0xb02e('0x6'));var rimraf=require(_0xb02e('0x7'));var config=require(_0xb02e('0x8'));var attributes=require(_0xb02e('0x9'));var integrations=require(_0xb02e('0xa'));module[_0xb02e('0xb')]=function(_0x5e3140,_0x1b378b){return _0x5e3140[_0xb02e('0xc')](_0xb02e('0xd'),attributes,{'tableName':_0xb02e('0xe'),'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 5bf6b5c..41360fa 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 _0xc416=['model','attributes','map','stringify','catch','ShowVtigerAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','GetVtigerAccount','VtigerAccount','findAll','options','raw','where','limit','include'];(function(_0x3f3f40,_0x4e745f){var _0x32c366=function(_0x343f6a){while(--_0x343f6a){_0x3f3f40['push'](_0x3f3f40['shift']());}};_0x32c366(++_0x4e745f);}(_0xc416,0xe4));var _0x6c41=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc416[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x6c41('0x0'));var util=require(_0x6c41('0x1'));var moment=require(_0x6c41('0x2'));var BPromise=require(_0x6c41('0x3'));var rs=require(_0x6c41('0x4'));var fs=require('fs');var Redis=require(_0x6c41('0x5'));var db=require(_0x6c41('0x6'))['db'];var utils=require(_0x6c41('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x6c41('0x8'));var jayson=require(_0x6c41('0x9'));var client=jayson[_0x6c41('0xa')][_0x6c41('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2df852,_0x568102,_0x43837a){return new BPromise(function(_0x5461d9,_0x36a781){return client[_0x6c41('0xc')](_0x2df852,_0x43837a)[_0x6c41('0xd')](function(_0x2d611d){logger[_0x6c41('0xe')](_0x6c41('0xf'),_0x568102,_0x6c41('0x10'));logger[_0x6c41('0x11')](_0x6c41('0x12'),_0x568102,_0x6c41('0x10'),JSON['stringify'](_0x2d611d));if(_0x2d611d[_0x6c41('0x13')]){if(_0x2d611d['error'][_0x6c41('0x14')]===0x1f4){logger[_0x6c41('0x13')](_0x6c41('0xf'),_0x568102,_0x2d611d[_0x6c41('0x13')][_0x6c41('0x15')]);return _0x36a781(_0x2d611d['error'][_0x6c41('0x15')]);}logger[_0x6c41('0x13')](_0x6c41('0xf'),_0x568102,_0x2d611d[_0x6c41('0x13')][_0x6c41('0x15')]);return _0x5461d9(_0x2d611d['error'][_0x6c41('0x15')]);}else{logger[_0x6c41('0xe')](_0x6c41('0xf'),_0x568102,_0x6c41('0x10'));_0x5461d9(_0x2d611d[_0x6c41('0x16')][_0x6c41('0x15')]);}})['catch'](function(_0x8f3d06){logger[_0x6c41('0x13')](_0x6c41('0xf'),_0x568102,_0x8f3d06);_0x36a781(_0x8f3d06);});});}exports[_0x6c41('0x17')]=function(_0x1d05ab){var _0x3cd489=this;return new Promise(function(_0x2567ad,_0x5a5681){return db[_0x6c41('0x18')][_0x6c41('0x19')]({'raw':_0x1d05ab[_0x6c41('0x1a')]?_0x1d05ab[_0x6c41('0x1a')][_0x6c41('0x1b')]===undefined?!![]:![]:!![],'where':_0x1d05ab['options']?_0x1d05ab[_0x6c41('0x1a')][_0x6c41('0x1c')]||null:null,'attributes':_0x1d05ab[_0x6c41('0x1a')]?_0x1d05ab[_0x6c41('0x1a')]['attributes']||null:null,'limit':_0x1d05ab[_0x6c41('0x1a')]?_0x1d05ab[_0x6c41('0x1a')][_0x6c41('0x1d')]||null:null,'include':_0x1d05ab['options']?_0x1d05ab[_0x6c41('0x1a')][_0x6c41('0x1e')]?_['map'](_0x1d05ab['options'][_0x6c41('0x1e')],function(_0x50d200){return{'model':db[_0x50d200[_0x6c41('0x1f')]],'as':_0x50d200['as'],'attributes':_0x50d200[_0x6c41('0x20')],'include':_0x50d200[_0x6c41('0x1e')]?_[_0x6c41('0x21')](_0x50d200['include'],function(_0x5a8cf0){return{'model':db[_0x5a8cf0[_0x6c41('0x1f')]],'as':_0x5a8cf0['as'],'attributes':_0x5a8cf0[_0x6c41('0x20')],'include':_0x5a8cf0['include']?_[_0x6c41('0x21')](_0x5a8cf0[_0x6c41('0x1e')],function(_0x270e3d){return{'model':db[_0x270e3d[_0x6c41('0x1f')]],'as':_0x270e3d['as'],'attributes':_0x270e3d[_0x6c41('0x20')]};}):[]};}):[]};}):[]:[]})[_0x6c41('0xd')](function(_0x32f00c){logger[_0x6c41('0xe')]('GetVtigerAccount',_0x1d05ab);logger[_0x6c41('0x11')](_0x6c41('0x17'),_0x1d05ab,JSON[_0x6c41('0x22')](_0x32f00c));_0x2567ad(_0x32f00c);})[_0x6c41('0x23')](function(_0x47dd4a){logger['error'](_0x6c41('0x17'),_0x47dd4a[_0x6c41('0x15')],_0x1d05ab);_0x5a5681(_0x3cd489[_0x6c41('0x13')](0x1f4,_0x47dd4a[_0x6c41('0x15')]));});});};exports['ShowVtigerAccount']=function(_0x46d251){var _0x6bfec0=this;return new Promise(function(_0x5b396f,_0x5222d6){return db[_0x6c41('0x18')]['find']({'raw':_0x46d251[_0x6c41('0x1a')]?_0x46d251['options']['raw']===undefined?!![]:![]:!![],'where':_0x46d251[_0x6c41('0x1a')]?_0x46d251[_0x6c41('0x1a')][_0x6c41('0x1c')]||null:null,'attributes':_0x46d251['options']?_0x46d251['options'][_0x6c41('0x20')]||null:null,'include':_0x46d251[_0x6c41('0x1a')]?_0x46d251[_0x6c41('0x1a')][_0x6c41('0x1e')]?_['map'](_0x46d251[_0x6c41('0x1a')][_0x6c41('0x1e')],function(_0x1c894a){return{'model':db[_0x1c894a['model']],'as':_0x1c894a['as'],'attributes':_0x1c894a[_0x6c41('0x20')],'include':_0x1c894a[_0x6c41('0x1e')]?_[_0x6c41('0x21')](_0x1c894a[_0x6c41('0x1e')],function(_0xf3fbe5){return{'model':db[_0xf3fbe5[_0x6c41('0x1f')]],'as':_0xf3fbe5['as'],'attributes':_0xf3fbe5[_0x6c41('0x20')],'include':_0xf3fbe5[_0x6c41('0x1e')]?_[_0x6c41('0x21')](_0xf3fbe5['include'],function(_0x4f1294){return{'model':db[_0x4f1294[_0x6c41('0x1f')]],'as':_0x4f1294['as'],'attributes':_0x4f1294['attributes']};}):[]};}):[]};}):[]:[]})[_0x6c41('0xd')](function(_0x1944da){logger[_0x6c41('0xe')](_0x6c41('0x24'),_0x46d251);logger['debug'](_0x6c41('0x24'),_0x46d251,JSON[_0x6c41('0x22')](_0x1944da));_0x5b396f(_0x1944da);})['catch'](function(_0x5df66e){logger[_0x6c41('0x13')](_0x6c41('0x24'),_0x5df66e['message'],_0x46d251);_0x5222d6(_0x6bfec0[_0x6c41('0x13')](0x1f4,_0x5df66e[_0x6c41('0x15')]));});});}; \ No newline at end of file +var _0x0c67=['VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetVtigerAccount','findAll','options','where','attributes','include','model','map','debug','ShowVtigerAccount','VtigerAccount','find','raw','lodash','util','moment','bluebird','ioredis','../../mysqldb','jayson/promise','client','request','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent'];(function(_0x28d18d,_0x55896b){var _0x470640=function(_0x57e78b){while(--_0x57e78b){_0x28d18d['push'](_0x28d18d['shift']());}};_0x470640(++_0x55896b);}(_0x0c67,0x173));var _0x70c6=function(_0x487d09,_0x4ff511){_0x487d09=_0x487d09-0x0;var _0x2ba8e9=_0x0c67[_0x487d09];return _0x2ba8e9;};'use strict';var _=require(_0x70c6('0x0'));var util=require(_0x70c6('0x1'));var moment=require(_0x70c6('0x2'));var BPromise=require(_0x70c6('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x70c6('0x4'));var db=require(_0x70c6('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x70c6('0x6'));var client=jayson[_0x70c6('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x15f590,_0x4cd2c6,_0x588450){return new BPromise(function(_0x5209ca,_0x3e0c51){return client[_0x70c6('0x8')](_0x15f590,_0x588450)[_0x70c6('0x9')](function(_0x1bbcee){logger[_0x70c6('0xa')](_0x70c6('0xb'),_0x4cd2c6,_0x70c6('0xc'));logger['debug'](_0x70c6('0xd'),_0x4cd2c6,_0x70c6('0xc'),JSON[_0x70c6('0xe')](_0x1bbcee));if(_0x1bbcee[_0x70c6('0xf')]){if(_0x1bbcee['error']['code']===0x1f4){logger[_0x70c6('0xf')](_0x70c6('0xb'),_0x4cd2c6,_0x1bbcee[_0x70c6('0xf')][_0x70c6('0x10')]);return _0x3e0c51(_0x1bbcee[_0x70c6('0xf')][_0x70c6('0x10')]);}logger[_0x70c6('0xf')](_0x70c6('0xb'),_0x4cd2c6,_0x1bbcee[_0x70c6('0xf')][_0x70c6('0x10')]);return _0x5209ca(_0x1bbcee[_0x70c6('0xf')]['message']);}else{logger[_0x70c6('0xa')]('VtigerAccount,\x20%s,\x20%s',_0x4cd2c6,_0x70c6('0xc'));_0x5209ca(_0x1bbcee[_0x70c6('0x11')][_0x70c6('0x10')]);}})[_0x70c6('0x12')](function(_0x4aa77c){logger[_0x70c6('0xf')](_0x70c6('0xb'),_0x4cd2c6,_0x4aa77c);_0x3e0c51(_0x4aa77c);});});}exports[_0x70c6('0x13')]=function(_0xb5b8c0){var _0x4f3c0a=this;return new Promise(function(_0x5a6ddd,_0x531c79){return db['VtigerAccount'][_0x70c6('0x14')]({'raw':_0xb5b8c0[_0x70c6('0x15')]?_0xb5b8c0[_0x70c6('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0xb5b8c0[_0x70c6('0x15')]?_0xb5b8c0[_0x70c6('0x15')][_0x70c6('0x16')]||null:null,'attributes':_0xb5b8c0[_0x70c6('0x15')]?_0xb5b8c0['options'][_0x70c6('0x17')]||null:null,'limit':_0xb5b8c0['options']?_0xb5b8c0[_0x70c6('0x15')]['limit']||null:null,'include':_0xb5b8c0[_0x70c6('0x15')]?_0xb5b8c0[_0x70c6('0x15')]['include']?_['map'](_0xb5b8c0[_0x70c6('0x15')][_0x70c6('0x18')],function(_0x1816f1){return{'model':db[_0x1816f1[_0x70c6('0x19')]],'as':_0x1816f1['as'],'attributes':_0x1816f1['attributes'],'include':_0x1816f1[_0x70c6('0x18')]?_[_0x70c6('0x1a')](_0x1816f1[_0x70c6('0x18')],function(_0x3fd303){return{'model':db[_0x3fd303[_0x70c6('0x19')]],'as':_0x3fd303['as'],'attributes':_0x3fd303[_0x70c6('0x17')],'include':_0x3fd303[_0x70c6('0x18')]?_[_0x70c6('0x1a')](_0x3fd303[_0x70c6('0x18')],function(_0x53cfb3){return{'model':db[_0x53cfb3[_0x70c6('0x19')]],'as':_0x53cfb3['as'],'attributes':_0x53cfb3[_0x70c6('0x17')]};}):[]};}):[]};}):[]:[]})[_0x70c6('0x9')](function(_0x3afc34){logger[_0x70c6('0xa')](_0x70c6('0x13'),_0xb5b8c0);logger[_0x70c6('0x1b')](_0x70c6('0x13'),_0xb5b8c0,JSON[_0x70c6('0xe')](_0x3afc34));_0x5a6ddd(_0x3afc34);})['catch'](function(_0x41246c){logger[_0x70c6('0xf')](_0x70c6('0x13'),_0x41246c[_0x70c6('0x10')],_0xb5b8c0);_0x531c79(_0x4f3c0a[_0x70c6('0xf')](0x1f4,_0x41246c[_0x70c6('0x10')]));});});};exports[_0x70c6('0x1c')]=function(_0x5f5cdf){var _0x4cda95=this;return new Promise(function(_0x3b5256,_0x13fb0c){return db[_0x70c6('0x1d')][_0x70c6('0x1e')]({'raw':_0x5f5cdf[_0x70c6('0x15')]?_0x5f5cdf[_0x70c6('0x15')][_0x70c6('0x1f')]===undefined?!![]:![]:!![],'where':_0x5f5cdf[_0x70c6('0x15')]?_0x5f5cdf[_0x70c6('0x15')][_0x70c6('0x16')]||null:null,'attributes':_0x5f5cdf['options']?_0x5f5cdf['options'][_0x70c6('0x17')]||null:null,'include':_0x5f5cdf['options']?_0x5f5cdf[_0x70c6('0x15')][_0x70c6('0x18')]?_[_0x70c6('0x1a')](_0x5f5cdf[_0x70c6('0x15')][_0x70c6('0x18')],function(_0x3db46a){return{'model':db[_0x3db46a[_0x70c6('0x19')]],'as':_0x3db46a['as'],'attributes':_0x3db46a[_0x70c6('0x17')],'include':_0x3db46a[_0x70c6('0x18')]?_[_0x70c6('0x1a')](_0x3db46a[_0x70c6('0x18')],function(_0x378e62){return{'model':db[_0x378e62[_0x70c6('0x19')]],'as':_0x378e62['as'],'attributes':_0x378e62[_0x70c6('0x17')],'include':_0x378e62[_0x70c6('0x18')]?_['map'](_0x378e62[_0x70c6('0x18')],function(_0x4b79a8){return{'model':db[_0x4b79a8[_0x70c6('0x19')]],'as':_0x4b79a8['as'],'attributes':_0x4b79a8['attributes']};}):[]};}):[]};}):[]:[]})[_0x70c6('0x9')](function(_0x38373a){logger['info'](_0x70c6('0x1c'),_0x5f5cdf);logger['debug'](_0x70c6('0x1c'),_0x5f5cdf,JSON[_0x70c6('0xe')](_0x38373a));_0x3b5256(_0x38373a);})[_0x70c6('0x12')](function(_0x22e2e8){logger['error'](_0x70c6('0x1c'),_0x22e2e8[_0x70c6('0x10')],_0x5f5cdf);_0x13fb0c(_0x4cda95[_0x70c6('0xf')](0x1f4,_0x22e2e8[_0x70c6('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 7d35f98..6418090 100644 --- a/server/api/intVtigerConfiguration/index.js +++ b/server/api/intVtigerConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['/:id','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','put','update','delete','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','get','isAuthenticated'];(function(_0xf6aa94,_0x5cd52c){var _0x523f4c=function(_0x5b7ae9){while(--_0x5b7ae9){_0xf6aa94['push'](_0xf6aa94['shift']());}};_0x523f4c(++_0x5cd52c);}(_0xb10b,0x12a));var _0xbb10=function(_0x3cb9bc,_0x1c95f5){_0x3cb9bc=_0x3cb9bc-0x0;var _0x5d13ec=_0xb10b[_0x3cb9bc];return _0x5d13ec;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var auth=require(_0xbb10('0x4'));var interaction=require(_0xbb10('0x5'));var config=require(_0xbb10('0x6'));var controller=require(_0xbb10('0x7'));router[_0xbb10('0x8')]('/',auth[_0xbb10('0x9')](),controller['index']);router[_0xbb10('0x8')](_0xbb10('0xa'),auth['isAuthenticated'](),controller[_0xbb10('0xb')]);router[_0xbb10('0x8')](_0xbb10('0xc'),auth[_0xbb10('0x9')](),controller[_0xbb10('0xd')]);router[_0xbb10('0x8')](_0xbb10('0xe'),auth[_0xbb10('0x9')](),controller['getSubjects']);router['get'](_0xbb10('0xf'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x10')]);router['post']('/',auth[_0xbb10('0x9')](),controller['create']);router[_0xbb10('0x11')](_0xbb10('0xa'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x12')]);router[_0xbb10('0x13')](_0xbb10('0xa'),auth['isAuthenticated'](),controller[_0xbb10('0x14')]);module[_0xbb10('0x15')]=router; \ No newline at end of file +var _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(_0x39ded1,_0xaee436){var _0x2e248e=function(_0x193df3){while(--_0x193df3){_0x39ded1['push'](_0x39ded1['shift']());}};_0x2e248e(++_0xaee436);}(_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 diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index bf3dbfe..4e82483 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 _0xc6e3=['STRING','sequelize'];(function(_0x25d4e5,_0x30b67f){var _0x44d116=function(_0x3011c2){while(--_0x3011c2){_0x25d4e5['push'](_0x25d4e5['shift']());}};_0x44d116(++_0x30b67f);}(_0xc6e3,0x1d7));var _0x3c6e=function(_0x4e3e3c,_0x44fc4b){_0x4e3e3c=_0x4e3e3c-0x0;var _0x5b3c6b=_0xc6e3[_0x4e3e3c];return _0x5b3c6b;};'use strict';var Sequelize=require(_0x3c6e('0x0'));module['exports']={'name':{'type':Sequelize[_0x3c6e('0x1')]},'description':{'type':Sequelize[_0x3c6e('0x1')]}}; \ No newline at end of file +var _0xdb53=['sequelize','exports','STRING'];(function(_0x24237f,_0x4cf32c){var _0x48298e=function(_0x3f7511){while(--_0x3f7511){_0x24237f['push'](_0x24237f['shift']());}};_0x48298e(++_0x4cf32c);}(_0xdb53,0x8d));var _0x3db5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdb53[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x3db5('0x0'));module[_0x3db5('0x1')]={'name':{'type':Sequelize[_0x3db5('0x2')]},'description':{'type':Sequelize[_0x3db5('0x2')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index 5342d49..ad33780 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 _0xbe60=['../../config/utils','../../config/environment','../../mysqldb','client','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','set','Content-Range','reject','save','update','then','destroy','stack','name','send','index','VtigerConfiguration','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','nolimit','limit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','rawAttributes','filters','find','create','body','getFields','findOne','VtigerField','order','hasOwnProperty','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','mustache','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x22e47a,_0x4ea10c){var _0x15a12a=function(_0x4a097f){while(--_0x4a097f){_0x22e47a['push'](_0x22e47a['shift']());}};_0x15a12a(++_0x4ea10c);}(_0xbe60,0x1bc));var _0x0be6=function(_0x4e9a48,_0x4d468c){_0x4e9a48=_0x4e9a48-0x0;var _0x365d55=_0xbe60[_0x4e9a48];return _0x365d55;};'use strict';var pdf=require(_0x0be6('0x0'));var emlformat=require(_0x0be6('0x1'));var rimraf=require(_0x0be6('0x2'));var zipdir=require(_0x0be6('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0be6('0x4'));var moment=require(_0x0be6('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x0be6('0x6'));var util=require('util');var path=require(_0x0be6('0x7'));var sox=require(_0x0be6('0x8'));var csv=require('to-csv');var ejs=require(_0x0be6('0x9'));var fs=require('fs');var _=require(_0x0be6('0xa'));var squel=require(_0x0be6('0xb'));var crypto=require(_0x0be6('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x0be6('0xd'));var toCsv=require(_0x0be6('0xe'));var querystring=require(_0x0be6('0xf'));var Papa=require(_0x0be6('0x10'));var Redis=require('ioredis');var authService=require(_0x0be6('0x11'));var qs=require(_0x0be6('0x12'));var as=require(_0x0be6('0x13'));var hardwareService=require(_0x0be6('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x0be6('0x15'));var config=require(_0x0be6('0x16'));var db=require(_0x0be6('0x17'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x0be6('0x18')]['http']({'port':0x232a});function checkPasswordPattern(_0x3ca9d9,_0x3a18b8,_0x447789){if(_0x447789){var _0xaf0b3a=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xaf0b3a[_0x0be6('0x19')](_0x3a18b8)){return _0x3ca9d9;}else{throw new db['Sequelize'][(_0x0be6('0x1a'))](_0x0be6('0x1b'));}}else{return _0x3ca9d9;}}function respondWithRpcPromise(_0x4c50dd,_0x3b83ee,_0x2efef2,_0x1d43d1){return new BPromise(function(_0x4aa4a7,_0x319564){var _0x1d1ed3=_0x1d43d1||client;return _0x1d1ed3['request'](_0x4c50dd,_0x2efef2)['then'](function(_0x4d881a){logger[_0x0be6('0x1c')](_0x0be6('0x1d'),_0x3b83ee,_0x0be6('0x1e'));logger[_0x0be6('0x1f')]('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0x3b83ee,_0x0be6('0x1e'),JSON[_0x0be6('0x20')](_0x4d881a));if(_0x4d881a[_0x0be6('0x21')]){if(_0x4d881a['error'][_0x0be6('0x22')]===0x1f4){logger[_0x0be6('0x21')](_0x0be6('0x1d'),_0x3b83ee,_0x4d881a[_0x0be6('0x21')][_0x0be6('0x23')]);return _0x319564(_0x4d881a[_0x0be6('0x21')][_0x0be6('0x23')]);}logger[_0x0be6('0x21')]('VtigerConfiguration,\x20%s,\x20%s',_0x3b83ee,_0x4d881a[_0x0be6('0x21')][_0x0be6('0x23')]);return _0x4aa4a7(_0x4d881a[_0x0be6('0x21')][_0x0be6('0x23')]);}else{logger[_0x0be6('0x1c')]('VtigerConfiguration,\x20%s,\x20%s',_0x3b83ee,'request\x20sent');_0x4aa4a7(_0x4d881a[_0x0be6('0x24')][_0x0be6('0x23')]);}})[_0x0be6('0x25')](function(_0x289f2f){logger[_0x0be6('0x21')](_0x0be6('0x1d'),_0x3b83ee,_0x289f2f);_0x319564(_0x289f2f);});});}function respondWithStatusCode(_0x3bd834,_0x40770b){_0x40770b=_0x40770b||0xcc;return function(_0x15bb33){if(_0x15bb33){return _0x3bd834[_0x0be6('0x26')](_0x40770b);}return _0x3bd834[_0x0be6('0x27')](_0x40770b)[_0x0be6('0x28')]();};}function respondWithResult(_0x1fac41,_0x4a409a){_0x4a409a=_0x4a409a||0xc8;return function(_0x3f07de){if(_0x3f07de){return _0x1fac41[_0x0be6('0x27')](_0x4a409a)[_0x0be6('0x29')](_0x3f07de);}};}function respondWithFilteredResult(_0x2904c2,_0x295fdf){return function(_0x1ebc40){if(_0x1ebc40){var _0x3cac17=_0x1ebc40[_0x0be6('0x2a')],_0x49784a=_0x295fdf[_0x0be6('0x2b')],_0x2ecdb3=_0x295fdf[_0x0be6('0x2b')]+_0x295fdf['limit'],_0x72d877;if(_0x2ecdb3>=_0x3cac17){_0x2ecdb3=_0x3cac17;_0x72d877=0xc8;}else{_0x72d877=0xce;}_0x2904c2['status'](_0x72d877);return _0x2904c2[_0x0be6('0x2c')](_0x0be6('0x2d'),_0x49784a+'-'+_0x2ecdb3+'/'+_0x3cac17)[_0x0be6('0x29')](_0x1ebc40);}return null;};}function patchUpdates(_0x129dae){return function(_0x241223){try{jsonpatch['apply'](_0x241223,_0x129dae,!![]);}catch(_0x360dfc){return BPromise[_0x0be6('0x2e')](_0x360dfc);}return _0x241223[_0x0be6('0x2f')]();};}function saveUpdates(_0x1ba935,_0x2ebc39){return function(_0x3e97aa){if(_0x3e97aa){return _0x3e97aa[_0x0be6('0x30')](_0x1ba935)[_0x0be6('0x31')](function(_0x469bee){return _0x469bee;});}return null;};}function removeEntity(_0x2487ab,_0x118630){return function(_0x89eb2f){if(_0x89eb2f){return _0x89eb2f[_0x0be6('0x32')]()[_0x0be6('0x31')](function(){_0x2487ab[_0x0be6('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0xe0a582,_0x48df24){return function(_0x1fb36c){if(!_0x1fb36c){_0xe0a582[_0x0be6('0x26')](0x194);}return _0x1fb36c;};}function handleError(_0x5846ae,_0x38ca41){_0x38ca41=_0x38ca41||0x1f4;return function(_0x18f2a1){logger['error'](_0x18f2a1[_0x0be6('0x33')]);if(_0x18f2a1[_0x0be6('0x34')]){delete _0x18f2a1[_0x0be6('0x34')];}_0x5846ae[_0x0be6('0x27')](_0x38ca41)[_0x0be6('0x35')](_0x18f2a1);};}exports[_0x0be6('0x36')]=function(_0x335df5,_0x912f1a){var _0xa2a95e={},_0x3f4546={},_0x2a83aa={'count':0x0,'rows':[]};var _0x11e74e=_['map'](db[_0x0be6('0x37')]['rawAttributes'],function(_0x4ec0ce){return{'name':_0x4ec0ce[_0x0be6('0x38')],'type':_0x4ec0ce[_0x0be6('0x39')][_0x0be6('0x3a')]};});_0x3f4546[_0x0be6('0x3b')]=_[_0x0be6('0x3c')](_0x11e74e,'name');_0x3f4546[_0x0be6('0x3d')]=_[_0x0be6('0x3e')](_0x335df5[_0x0be6('0x3d')]);_0x3f4546['filters']=_[_0x0be6('0x3f')](_0x3f4546['model'],_0x3f4546[_0x0be6('0x3d')]);_0xa2a95e[_0x0be6('0x40')]=_[_0x0be6('0x3f')](_0x3f4546[_0x0be6('0x3b')],qs['fields'](_0x335df5[_0x0be6('0x3d')][_0x0be6('0x41')]));_0xa2a95e['attributes']=_0xa2a95e[_0x0be6('0x40')][_0x0be6('0x42')]?_0xa2a95e['attributes']:_0x3f4546[_0x0be6('0x3b')];if(!_0x335df5[_0x0be6('0x3d')]['hasOwnProperty'](_0x0be6('0x43'))){_0xa2a95e[_0x0be6('0x44')]=qs[_0x0be6('0x44')](_0x335df5[_0x0be6('0x3d')]['limit']);_0xa2a95e[_0x0be6('0x2b')]=qs['offset'](_0x335df5[_0x0be6('0x3d')][_0x0be6('0x2b')]);}_0xa2a95e['order']=qs[_0x0be6('0x45')](_0x335df5[_0x0be6('0x3d')][_0x0be6('0x45')]);_0xa2a95e[_0x0be6('0x46')]=qs['filters'](_[_0x0be6('0x47')](_0x335df5[_0x0be6('0x3d')],_0x3f4546['filters']));if(_0x335df5['query'][_0x0be6('0x48')]){_0xa2a95e[_0x0be6('0x46')]=_[_0x0be6('0x49')](_0xa2a95e[_0x0be6('0x46')],{'$or':_[_0x0be6('0x3c')](_0x11e74e,function(_0x174d5c){if(_0x174d5c['type']!==_0x0be6('0x4a')){var _0x4b4455={};_0x4b4455[_0x174d5c[_0x0be6('0x34')]]={'$like':'%'+_0x335df5[_0x0be6('0x3d')]['filter']+'%'};return _0x4b4455;}})});}_0xa2a95e=_[_0x0be6('0x49')]({},_0xa2a95e,_0x335df5[_0x0be6('0x4b')]);var _0x5a610f={'where':_0xa2a95e[_0x0be6('0x46')]};return db[_0x0be6('0x37')][_0x0be6('0x2a')](_0x5a610f)[_0x0be6('0x31')](function(_0x328833){_0x2a83aa[_0x0be6('0x2a')]=_0x328833;if(_0x335df5['query'][_0x0be6('0x4c')]){_0xa2a95e['include']=[{'all':!![]}];}return db[_0x0be6('0x37')][_0x0be6('0x4d')](_0xa2a95e);})[_0x0be6('0x31')](function(_0x5607c1){_0x2a83aa[_0x0be6('0x4e')]=_0x5607c1;return _0x2a83aa;})[_0x0be6('0x31')](respondWithFilteredResult(_0x912f1a,_0xa2a95e))[_0x0be6('0x25')](handleError(_0x912f1a,null));};exports[_0x0be6('0x4f')]=function(_0x50bc21,_0x411744){var _0x1fd279={'raw':![],'where':{'id':_0x50bc21[_0x0be6('0x50')]['id']}},_0xa3ed37={};_0xa3ed37[_0x0be6('0x3b')]=_[_0x0be6('0x3e')](db[_0x0be6('0x37')][_0x0be6('0x51')]);_0xa3ed37['query']=_[_0x0be6('0x3e')](_0x50bc21['query']);_0xa3ed37[_0x0be6('0x52')]=_[_0x0be6('0x3f')](_0xa3ed37[_0x0be6('0x3b')],_0xa3ed37[_0x0be6('0x3d')]);_0x1fd279[_0x0be6('0x40')]=_[_0x0be6('0x3f')](_0xa3ed37[_0x0be6('0x3b')],qs[_0x0be6('0x41')](_0x50bc21[_0x0be6('0x3d')][_0x0be6('0x41')]));_0x1fd279['attributes']=_0x1fd279[_0x0be6('0x40')][_0x0be6('0x42')]?_0x1fd279[_0x0be6('0x40')]:_0xa3ed37['model'];if(_0x50bc21['query']['includeAll']){_0x1fd279['include']=[{'all':!![]}];}_0x1fd279=_['merge']({},_0x1fd279,_0x50bc21['options']);return db[_0x0be6('0x37')][_0x0be6('0x53')](_0x1fd279)[_0x0be6('0x31')](handleEntityNotFound(_0x411744,null))[_0x0be6('0x31')](respondWithResult(_0x411744,null))[_0x0be6('0x25')](handleError(_0x411744,null));};exports['create']=function(_0x1ebb7e,_0x2f05b0){return db[_0x0be6('0x37')][_0x0be6('0x54')](_0x1ebb7e[_0x0be6('0x55')],{})[_0x0be6('0x31')](respondWithResult(_0x2f05b0,0xc9))[_0x0be6('0x25')](handleError(_0x2f05b0,null));};exports['update']=function(_0x49f3be,_0x5119bb){if(_0x49f3be[_0x0be6('0x55')]['id']){delete _0x49f3be[_0x0be6('0x55')]['id'];}return db['VtigerConfiguration'][_0x0be6('0x53')]({'where':{'id':_0x49f3be[_0x0be6('0x50')]['id']}})[_0x0be6('0x31')](handleEntityNotFound(_0x5119bb,null))[_0x0be6('0x31')](saveUpdates(_0x49f3be[_0x0be6('0x55')],null))['then'](respondWithResult(_0x5119bb,null))[_0x0be6('0x25')](handleError(_0x5119bb,null));};exports[_0x0be6('0x32')]=function(_0x51e029,_0x3a255c){return db[_0x0be6('0x37')][_0x0be6('0x53')]({'where':{'id':_0x51e029[_0x0be6('0x50')]['id']}})[_0x0be6('0x31')](handleEntityNotFound(_0x3a255c,null))['then'](removeEntity(_0x3a255c,null))[_0x0be6('0x25')](handleError(_0x3a255c,null));};exports[_0x0be6('0x56')]=function(_0x281d6a,_0x3f9f34,_0x3b5c40){var _0x2c68d3={};var _0x2619eb={};var _0x571050;var _0x2a7c38;return db[_0x0be6('0x37')][_0x0be6('0x57')]({'where':{'id':_0x281d6a['params']['id']}})['then'](handleEntityNotFound(_0x3f9f34,null))['then'](function(_0x21aa77){if(_0x21aa77){_0x571050=_0x21aa77;_0x2619eb['model']=_[_0x0be6('0x3e')](db[_0x0be6('0x58')]['rawAttributes']);_0x2619eb['query']=_[_0x0be6('0x3e')](_0x281d6a[_0x0be6('0x3d')]);_0x2619eb['filters']=_['intersection'](_0x2619eb[_0x0be6('0x3b')],_0x2619eb['query']);_0x2c68d3[_0x0be6('0x40')]=_['intersection'](_0x2619eb[_0x0be6('0x3b')],qs[_0x0be6('0x41')](_0x281d6a['query'][_0x0be6('0x41')]));_0x2c68d3[_0x0be6('0x40')]=_0x2c68d3['attributes'][_0x0be6('0x42')]?_0x2c68d3['attributes']:_0x2619eb[_0x0be6('0x3b')];_0x2c68d3[_0x0be6('0x59')]=qs[_0x0be6('0x45')](_0x281d6a[_0x0be6('0x3d')][_0x0be6('0x45')]);_0x2c68d3[_0x0be6('0x46')]=qs[_0x0be6('0x52')](_[_0x0be6('0x47')](_0x281d6a['query'],_0x2619eb[_0x0be6('0x52')]));if(_0x281d6a['query'][_0x0be6('0x48')]){_0x2c68d3[_0x0be6('0x46')]=_['merge'](_0x2c68d3[_0x0be6('0x46')],{'$or':_[_0x0be6('0x3c')](_0x2c68d3[_0x0be6('0x40')],function(_0x165dd9){var _0x829293={};_0x829293[_0x165dd9]={'$like':'%'+_0x281d6a[_0x0be6('0x3d')]['filter']+'%'};return _0x829293;})});}_0x2c68d3=_['merge']({},_0x2c68d3,_0x281d6a[_0x0be6('0x4b')]);return _0x571050[_0x0be6('0x56')](_0x2c68d3);}})[_0x0be6('0x31')](function(_0x1c097a){if(_0x1c097a){_0x2a7c38=_0x1c097a['length'];if(!_0x281d6a[_0x0be6('0x3d')][_0x0be6('0x5a')](_0x0be6('0x43'))){_0x2c68d3[_0x0be6('0x44')]=qs[_0x0be6('0x44')](_0x281d6a['query'][_0x0be6('0x44')]);_0x2c68d3[_0x0be6('0x2b')]=qs[_0x0be6('0x2b')](_0x281d6a[_0x0be6('0x3d')][_0x0be6('0x2b')]);}return _0x571050['getFields'](_0x2c68d3);}})[_0x0be6('0x31')](function(_0x483a26){if(_0x483a26){return _0x483a26?{'count':_0x2a7c38,'rows':_0x483a26}:null;}})[_0x0be6('0x31')](respondWithResult(_0x3f9f34,null))[_0x0be6('0x25')](handleError(_0x3f9f34,null));};exports[_0x0be6('0x5b')]=function(_0x3866e7,_0x568286,_0x364a29){var _0x26b1fc={};var _0x1a7b33={};var _0x45b9ef;var _0x3c585a;return db['VtigerConfiguration'][_0x0be6('0x57')]({'where':{'id':_0x3866e7[_0x0be6('0x50')]['id']}})[_0x0be6('0x31')](handleEntityNotFound(_0x568286,null))[_0x0be6('0x31')](function(_0x52c814){if(_0x52c814){_0x45b9ef=_0x52c814;_0x1a7b33['model']=_[_0x0be6('0x3e')](db[_0x0be6('0x58')][_0x0be6('0x51')]);_0x1a7b33[_0x0be6('0x3d')]=_[_0x0be6('0x3e')](_0x3866e7[_0x0be6('0x3d')]);_0x1a7b33[_0x0be6('0x52')]=_[_0x0be6('0x3f')](_0x1a7b33[_0x0be6('0x3b')],_0x1a7b33[_0x0be6('0x3d')]);_0x26b1fc['attributes']=_[_0x0be6('0x3f')](_0x1a7b33['model'],qs[_0x0be6('0x41')](_0x3866e7[_0x0be6('0x3d')][_0x0be6('0x41')]));_0x26b1fc[_0x0be6('0x40')]=_0x26b1fc[_0x0be6('0x40')][_0x0be6('0x42')]?_0x26b1fc['attributes']:_0x1a7b33['model'];_0x26b1fc[_0x0be6('0x59')]=qs[_0x0be6('0x45')](_0x3866e7['query'][_0x0be6('0x45')]);_0x26b1fc['where']=qs[_0x0be6('0x52')](_[_0x0be6('0x47')](_0x3866e7[_0x0be6('0x3d')],_0x1a7b33[_0x0be6('0x52')]));if(_0x3866e7['query']['filter']){_0x26b1fc[_0x0be6('0x46')]=_['merge'](_0x26b1fc[_0x0be6('0x46')],{'$or':_[_0x0be6('0x3c')](_0x26b1fc['attributes'],function(_0x285a61){var _0x103e31={};_0x103e31[_0x285a61]={'$like':'%'+_0x3866e7[_0x0be6('0x3d')][_0x0be6('0x48')]+'%'};return _0x103e31;})});}_0x26b1fc=_['merge']({},_0x26b1fc,_0x3866e7[_0x0be6('0x4b')]);return _0x45b9ef[_0x0be6('0x5b')](_0x26b1fc);}})[_0x0be6('0x31')](function(_0x48420f){if(_0x48420f){_0x3c585a=_0x48420f[_0x0be6('0x42')];if(!_0x3866e7[_0x0be6('0x3d')]['hasOwnProperty'](_0x0be6('0x43'))){_0x26b1fc[_0x0be6('0x44')]=qs[_0x0be6('0x44')](_0x3866e7[_0x0be6('0x3d')][_0x0be6('0x44')]);_0x26b1fc[_0x0be6('0x2b')]=qs[_0x0be6('0x2b')](_0x3866e7[_0x0be6('0x3d')][_0x0be6('0x2b')]);}return _0x45b9ef[_0x0be6('0x5b')](_0x26b1fc);}})['then'](function(_0x36da06){if(_0x36da06){return _0x36da06?{'count':_0x3c585a,'rows':_0x36da06}:null;}})[_0x0be6('0x31')](respondWithResult(_0x568286,null))['catch'](handleError(_0x568286,null));};exports[_0x0be6('0x5c')]=function(_0x48e1f7,_0x10e4f5,_0x9d48f0){var _0x18a554={};var _0x3392c0={};var _0x3cdbbc;var _0x5defa1;return db[_0x0be6('0x37')][_0x0be6('0x57')]({'where':{'id':_0x48e1f7['params']['id']}})['then'](handleEntityNotFound(_0x10e4f5,null))[_0x0be6('0x31')](function(_0x4f45d8){if(_0x4f45d8){_0x3cdbbc=_0x4f45d8;_0x3392c0[_0x0be6('0x3b')]=_['keys'](db[_0x0be6('0x58')][_0x0be6('0x51')]);_0x3392c0['query']=_[_0x0be6('0x3e')](_0x48e1f7['query']);_0x3392c0[_0x0be6('0x52')]=_[_0x0be6('0x3f')](_0x3392c0['model'],_0x3392c0['query']);_0x18a554[_0x0be6('0x40')]=_['intersection'](_0x3392c0['model'],qs[_0x0be6('0x41')](_0x48e1f7['query'][_0x0be6('0x41')]));_0x18a554[_0x0be6('0x40')]=_0x18a554[_0x0be6('0x40')][_0x0be6('0x42')]?_0x18a554[_0x0be6('0x40')]:_0x3392c0[_0x0be6('0x3b')];_0x18a554[_0x0be6('0x59')]=qs[_0x0be6('0x45')](_0x48e1f7['query'][_0x0be6('0x45')]);_0x18a554['where']=qs['filters'](_[_0x0be6('0x47')](_0x48e1f7[_0x0be6('0x3d')],_0x3392c0['filters']));if(_0x48e1f7[_0x0be6('0x3d')]['filter']){_0x18a554[_0x0be6('0x46')]=_[_0x0be6('0x49')](_0x18a554[_0x0be6('0x46')],{'$or':_[_0x0be6('0x3c')](_0x18a554[_0x0be6('0x40')],function(_0x4e524f){var _0x48516a={};_0x48516a[_0x4e524f]={'$like':'%'+_0x48e1f7[_0x0be6('0x3d')][_0x0be6('0x48')]+'%'};return _0x48516a;})});}_0x18a554=_[_0x0be6('0x49')]({},_0x18a554,_0x48e1f7[_0x0be6('0x4b')]);return _0x3cdbbc[_0x0be6('0x5c')](_0x18a554);}})[_0x0be6('0x31')](function(_0x27a265){if(_0x27a265){_0x5defa1=_0x27a265['length'];if(!_0x48e1f7['query'][_0x0be6('0x5a')](_0x0be6('0x43'))){_0x18a554['limit']=qs[_0x0be6('0x44')](_0x48e1f7[_0x0be6('0x3d')][_0x0be6('0x44')]);_0x18a554['offset']=qs[_0x0be6('0x2b')](_0x48e1f7[_0x0be6('0x3d')][_0x0be6('0x2b')]);}return _0x3cdbbc[_0x0be6('0x5c')](_0x18a554);}})['then'](function(_0x2eb3fe){if(_0x2eb3fe){return _0x2eb3fe?{'count':_0x5defa1,'rows':_0x2eb3fe}:null;}})[_0x0be6('0x31')](respondWithResult(_0x10e4f5,null))[_0x0be6('0x25')](handleError(_0x10e4f5,null));}; \ No newline at end of file +var _0x2334=['options','includeAll','include','VtigerConfiguration','findAll','show','params','find','create','body','destroy','getFields','findOne','VtigerField','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','to-csv','ejs','squel','crypto','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','then','sendStatus','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL'];(function(_0xb65482,_0x252b07){var _0x226754=function(_0x1cf579){while(--_0x1cf579){_0xb65482['push'](_0xb65482['shift']());}};_0x226754(++_0x252b07);}(_0x2334,0x6a));var _0x4233=function(_0xf6bb7d,_0x8af4f5){_0xf6bb7d=_0xf6bb7d-0x0;var _0x132764=_0x2334[_0xf6bb7d];return _0x132764;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x4233('0x0'));var rimraf=require(_0x4233('0x1'));var zipdir=require(_0x4233('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4233('0x3'));var moment=require(_0x4233('0x4'));var BPromise=require(_0x4233('0x5'));var Mustache=require('mustache');var util=require(_0x4233('0x6'));var path=require(_0x4233('0x7'));var sox=require('sox');var csv=require(_0x4233('0x8'));var ejs=require(_0x4233('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x4233('0xa'));var crypto=require(_0x4233('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x4233('0x8'));var querystring=require('querystring');var Papa=require(_0x4233('0xc'));var Redis=require(_0x4233('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x4233('0xe'));var as=require(_0x4233('0xf'));var hardwareService=require(_0x4233('0x10'));var logger=require(_0x4233('0x11'))(_0x4233('0x12'));var utils=require('../../config/utils');var config=require(_0x4233('0x13'));var db=require('../../mysqldb')['db'];var jayson=require(_0x4233('0x14'));var client=jayson[_0x4233('0x15')][_0x4233('0x16')]({'port':0x232a});function checkPasswordPattern(_0x27a59d,_0x270255,_0x351229){if(_0x351229){var _0x59a6f0=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x59a6f0[_0x4233('0x17')](_0x270255)){return _0x27a59d;}else{throw new db[(_0x4233('0x18'))][(_0x4233('0x19'))](_0x4233('0x1a'));}}else{return _0x27a59d;}}function respondWithRpcPromise(_0x1ca989,_0x452ad2,_0x8c7d44,_0x3c6464){return new BPromise(function(_0x776c78,_0x5d460d){var _0x4961dc=_0x3c6464||client;return _0x4961dc[_0x4233('0x1b')](_0x1ca989,_0x8c7d44)['then'](function(_0x35de79){logger['info'](_0x4233('0x1c'),_0x452ad2,_0x4233('0x1d'));logger['debug'](_0x4233('0x1e'),_0x452ad2,_0x4233('0x1d'),JSON[_0x4233('0x1f')](_0x35de79));if(_0x35de79['error']){if(_0x35de79['error'][_0x4233('0x20')]===0x1f4){logger['error'](_0x4233('0x1c'),_0x452ad2,_0x35de79[_0x4233('0x21')]['message']);return _0x5d460d(_0x35de79['error'][_0x4233('0x22')]);}logger[_0x4233('0x21')](_0x4233('0x1c'),_0x452ad2,_0x35de79[_0x4233('0x21')][_0x4233('0x22')]);return _0x776c78(_0x35de79['error'][_0x4233('0x22')]);}else{logger['info'](_0x4233('0x1c'),_0x452ad2,'request\x20sent');_0x776c78(_0x35de79[_0x4233('0x23')][_0x4233('0x22')]);}})[_0x4233('0x24')](function(_0x2c14a4){logger['error'](_0x4233('0x1c'),_0x452ad2,_0x2c14a4);_0x5d460d(_0x2c14a4);});});}function respondWithStatusCode(_0x3e6d3a,_0x5f4467){_0x5f4467=_0x5f4467||0xcc;return function(_0x4e945b){if(_0x4e945b){return _0x3e6d3a['sendStatus'](_0x5f4467);}return _0x3e6d3a[_0x4233('0x25')](_0x5f4467)[_0x4233('0x26')]();};}function respondWithResult(_0x15fe4e,_0x41a52f){_0x41a52f=_0x41a52f||0xc8;return function(_0x561ff5){if(_0x561ff5){return _0x15fe4e[_0x4233('0x25')](_0x41a52f)[_0x4233('0x27')](_0x561ff5);}};}function respondWithFilteredResult(_0x1afd0c,_0x5b5158){return function(_0xea4a63){if(_0xea4a63){var _0x199842=_0xea4a63[_0x4233('0x28')],_0x66d15c=_0x5b5158[_0x4233('0x29')],_0x599397=_0x5b5158[_0x4233('0x29')]+_0x5b5158[_0x4233('0x2a')],_0x122c1a;if(_0x599397>=_0x199842){_0x599397=_0x199842;_0x122c1a=0xc8;}else{_0x122c1a=0xce;}_0x1afd0c[_0x4233('0x25')](_0x122c1a);return _0x1afd0c[_0x4233('0x2b')](_0x4233('0x2c'),_0x66d15c+'-'+_0x599397+'/'+_0x199842)['json'](_0xea4a63);}return null;};}function patchUpdates(_0x188f86){return function(_0x4daa78){try{jsonpatch['apply'](_0x4daa78,_0x188f86,!![]);}catch(_0x53a3cb){return BPromise[_0x4233('0x2d')](_0x53a3cb);}return _0x4daa78[_0x4233('0x2e')]();};}function saveUpdates(_0x4302a3,_0x352296){return function(_0x4169ab){if(_0x4169ab){return _0x4169ab[_0x4233('0x2f')](_0x4302a3)[_0x4233('0x30')](function(_0x35d211){return _0x35d211;});}return null;};}function removeEntity(_0x1dfa56,_0x1ee202){return function(_0x49630e){if(_0x49630e){return _0x49630e['destroy']()[_0x4233('0x30')](function(){_0x1dfa56[_0x4233('0x25')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5cd0be,_0x3c6740){return function(_0x1e68ee){if(!_0x1e68ee){_0x5cd0be[_0x4233('0x31')](0x194);}return _0x1e68ee;};}function handleError(_0x25b63f,_0x1829f3){_0x1829f3=_0x1829f3||0x1f4;return function(_0x4f24aa){logger['error'](_0x4f24aa['stack']);if(_0x4f24aa[_0x4233('0x32')]){delete _0x4f24aa[_0x4233('0x32')];}_0x25b63f[_0x4233('0x25')](_0x1829f3)['send'](_0x4f24aa);};}exports[_0x4233('0x33')]=function(_0x2fe3b8,_0x3833ab){var _0x5956fc={},_0x2ccc46={},_0x150577={'count':0x0,'rows':[]};var _0xd8b0b9=_[_0x4233('0x34')](db['VtigerConfiguration'][_0x4233('0x35')],function(_0x41519d){return{'name':_0x41519d[_0x4233('0x36')],'type':_0x41519d[_0x4233('0x37')][_0x4233('0x38')]};});_0x2ccc46[_0x4233('0x39')]=_[_0x4233('0x34')](_0xd8b0b9,_0x4233('0x32'));_0x2ccc46[_0x4233('0x3a')]=_[_0x4233('0x3b')](_0x2fe3b8[_0x4233('0x3a')]);_0x2ccc46['filters']=_[_0x4233('0x3c')](_0x2ccc46['model'],_0x2ccc46[_0x4233('0x3a')]);_0x5956fc[_0x4233('0x3d')]=_[_0x4233('0x3c')](_0x2ccc46[_0x4233('0x39')],qs[_0x4233('0x3e')](_0x2fe3b8[_0x4233('0x3a')][_0x4233('0x3e')]));_0x5956fc[_0x4233('0x3d')]=_0x5956fc[_0x4233('0x3d')][_0x4233('0x3f')]?_0x5956fc[_0x4233('0x3d')]:_0x2ccc46[_0x4233('0x39')];if(!_0x2fe3b8['query'][_0x4233('0x40')](_0x4233('0x41'))){_0x5956fc[_0x4233('0x2a')]=qs[_0x4233('0x2a')](_0x2fe3b8['query']['limit']);_0x5956fc[_0x4233('0x29')]=qs[_0x4233('0x29')](_0x2fe3b8[_0x4233('0x3a')][_0x4233('0x29')]);}_0x5956fc[_0x4233('0x42')]=qs[_0x4233('0x43')](_0x2fe3b8['query'][_0x4233('0x43')]);_0x5956fc[_0x4233('0x44')]=qs['filters'](_[_0x4233('0x45')](_0x2fe3b8[_0x4233('0x3a')],_0x2ccc46[_0x4233('0x46')]));if(_0x2fe3b8[_0x4233('0x3a')][_0x4233('0x47')]){_0x5956fc[_0x4233('0x44')]=_[_0x4233('0x48')](_0x5956fc['where'],{'$or':_[_0x4233('0x34')](_0xd8b0b9,function(_0x584add){if(_0x584add[_0x4233('0x37')]!==_0x4233('0x49')){var _0x1addce={};_0x1addce[_0x584add[_0x4233('0x32')]]={'$like':'%'+_0x2fe3b8[_0x4233('0x3a')][_0x4233('0x47')]+'%'};return _0x1addce;}})});}_0x5956fc=_[_0x4233('0x48')]({},_0x5956fc,_0x2fe3b8[_0x4233('0x4a')]);var _0x282c66={'where':_0x5956fc[_0x4233('0x44')]};return db['VtigerConfiguration'][_0x4233('0x28')](_0x282c66)[_0x4233('0x30')](function(_0x381e11){_0x150577[_0x4233('0x28')]=_0x381e11;if(_0x2fe3b8['query'][_0x4233('0x4b')]){_0x5956fc[_0x4233('0x4c')]=[{'all':!![]}];}return db[_0x4233('0x4d')][_0x4233('0x4e')](_0x5956fc);})['then'](function(_0x538a22){_0x150577['rows']=_0x538a22;return _0x150577;})['then'](respondWithFilteredResult(_0x3833ab,_0x5956fc))[_0x4233('0x24')](handleError(_0x3833ab,null));};exports[_0x4233('0x4f')]=function(_0x4aac9a,_0xe0bb2d){var _0x22e8c9={'raw':![],'where':{'id':_0x4aac9a[_0x4233('0x50')]['id']}},_0x2fee5c={};_0x2fee5c['model']=_['keys'](db['VtigerConfiguration'][_0x4233('0x35')]);_0x2fee5c[_0x4233('0x3a')]=_[_0x4233('0x3b')](_0x4aac9a['query']);_0x2fee5c['filters']=_[_0x4233('0x3c')](_0x2fee5c[_0x4233('0x39')],_0x2fee5c['query']);_0x22e8c9['attributes']=_[_0x4233('0x3c')](_0x2fee5c[_0x4233('0x39')],qs['fields'](_0x4aac9a[_0x4233('0x3a')][_0x4233('0x3e')]));_0x22e8c9[_0x4233('0x3d')]=_0x22e8c9[_0x4233('0x3d')][_0x4233('0x3f')]?_0x22e8c9[_0x4233('0x3d')]:_0x2fee5c[_0x4233('0x39')];if(_0x4aac9a[_0x4233('0x3a')][_0x4233('0x4b')]){_0x22e8c9[_0x4233('0x4c')]=[{'all':!![]}];}_0x22e8c9=_['merge']({},_0x22e8c9,_0x4aac9a[_0x4233('0x4a')]);return db['VtigerConfiguration'][_0x4233('0x51')](_0x22e8c9)[_0x4233('0x30')](handleEntityNotFound(_0xe0bb2d,null))[_0x4233('0x30')](respondWithResult(_0xe0bb2d,null))[_0x4233('0x24')](handleError(_0xe0bb2d,null));};exports['create']=function(_0x2e1b9f,_0x370c42){return db[_0x4233('0x4d')][_0x4233('0x52')](_0x2e1b9f[_0x4233('0x53')],{})['then'](respondWithResult(_0x370c42,0xc9))['catch'](handleError(_0x370c42,null));};exports[_0x4233('0x2f')]=function(_0x554129,_0x52a39b){if(_0x554129[_0x4233('0x53')]['id']){delete _0x554129['body']['id'];}return db[_0x4233('0x4d')][_0x4233('0x51')]({'where':{'id':_0x554129['params']['id']}})[_0x4233('0x30')](handleEntityNotFound(_0x52a39b,null))['then'](saveUpdates(_0x554129[_0x4233('0x53')],null))[_0x4233('0x30')](respondWithResult(_0x52a39b,null))[_0x4233('0x24')](handleError(_0x52a39b,null));};exports[_0x4233('0x54')]=function(_0x32e0a3,_0x2e554c){return db['VtigerConfiguration']['find']({'where':{'id':_0x32e0a3[_0x4233('0x50')]['id']}})[_0x4233('0x30')](handleEntityNotFound(_0x2e554c,null))[_0x4233('0x30')](removeEntity(_0x2e554c,null))[_0x4233('0x24')](handleError(_0x2e554c,null));};exports[_0x4233('0x55')]=function(_0x4bae7d,_0x3216d5,_0x595ae0){var _0x102c72={};var _0x2681a9={};var _0xf8318;var _0x43f8c2;return db[_0x4233('0x4d')][_0x4233('0x56')]({'where':{'id':_0x4bae7d[_0x4233('0x50')]['id']}})[_0x4233('0x30')](handleEntityNotFound(_0x3216d5,null))[_0x4233('0x30')](function(_0x31a571){if(_0x31a571){_0xf8318=_0x31a571;_0x2681a9[_0x4233('0x39')]=_[_0x4233('0x3b')](db[_0x4233('0x57')][_0x4233('0x35')]);_0x2681a9[_0x4233('0x3a')]=_[_0x4233('0x3b')](_0x4bae7d['query']);_0x2681a9[_0x4233('0x46')]=_[_0x4233('0x3c')](_0x2681a9[_0x4233('0x39')],_0x2681a9['query']);_0x102c72[_0x4233('0x3d')]=_[_0x4233('0x3c')](_0x2681a9[_0x4233('0x39')],qs[_0x4233('0x3e')](_0x4bae7d[_0x4233('0x3a')]['fields']));_0x102c72[_0x4233('0x3d')]=_0x102c72['attributes']['length']?_0x102c72[_0x4233('0x3d')]:_0x2681a9[_0x4233('0x39')];_0x102c72['order']=qs[_0x4233('0x43')](_0x4bae7d[_0x4233('0x3a')][_0x4233('0x43')]);_0x102c72[_0x4233('0x44')]=qs[_0x4233('0x46')](_['pick'](_0x4bae7d[_0x4233('0x3a')],_0x2681a9[_0x4233('0x46')]));if(_0x4bae7d[_0x4233('0x3a')]['filter']){_0x102c72[_0x4233('0x44')]=_[_0x4233('0x48')](_0x102c72['where'],{'$or':_[_0x4233('0x34')](_0x102c72['attributes'],function(_0xea82fd){var _0x2582fc={};_0x2582fc[_0xea82fd]={'$like':'%'+_0x4bae7d[_0x4233('0x3a')][_0x4233('0x47')]+'%'};return _0x2582fc;})});}_0x102c72=_[_0x4233('0x48')]({},_0x102c72,_0x4bae7d[_0x4233('0x4a')]);return _0xf8318[_0x4233('0x55')](_0x102c72);}})[_0x4233('0x30')](function(_0x543ba5){if(_0x543ba5){_0x43f8c2=_0x543ba5['length'];if(!_0x4bae7d[_0x4233('0x3a')]['hasOwnProperty'](_0x4233('0x41'))){_0x102c72[_0x4233('0x2a')]=qs[_0x4233('0x2a')](_0x4bae7d[_0x4233('0x3a')][_0x4233('0x2a')]);_0x102c72[_0x4233('0x29')]=qs[_0x4233('0x29')](_0x4bae7d[_0x4233('0x3a')][_0x4233('0x29')]);}return _0xf8318[_0x4233('0x55')](_0x102c72);}})[_0x4233('0x30')](function(_0x48fdbc){if(_0x48fdbc){return _0x48fdbc?{'count':_0x43f8c2,'rows':_0x48fdbc}:null;}})[_0x4233('0x30')](respondWithResult(_0x3216d5,null))['catch'](handleError(_0x3216d5,null));};exports['getSubjects']=function(_0x90cc4,_0x50f378,_0xc5209){var _0x8e101a={};var _0xde4fd1={};var _0x1de3ab;var _0x289e2b;return db[_0x4233('0x4d')][_0x4233('0x56')]({'where':{'id':_0x90cc4[_0x4233('0x50')]['id']}})[_0x4233('0x30')](handleEntityNotFound(_0x50f378,null))[_0x4233('0x30')](function(_0x169551){if(_0x169551){_0x1de3ab=_0x169551;_0xde4fd1[_0x4233('0x39')]=_['keys'](db[_0x4233('0x57')][_0x4233('0x35')]);_0xde4fd1[_0x4233('0x3a')]=_[_0x4233('0x3b')](_0x90cc4[_0x4233('0x3a')]);_0xde4fd1[_0x4233('0x46')]=_['intersection'](_0xde4fd1[_0x4233('0x39')],_0xde4fd1[_0x4233('0x3a')]);_0x8e101a[_0x4233('0x3d')]=_[_0x4233('0x3c')](_0xde4fd1[_0x4233('0x39')],qs[_0x4233('0x3e')](_0x90cc4[_0x4233('0x3a')][_0x4233('0x3e')]));_0x8e101a[_0x4233('0x3d')]=_0x8e101a[_0x4233('0x3d')][_0x4233('0x3f')]?_0x8e101a[_0x4233('0x3d')]:_0xde4fd1[_0x4233('0x39')];_0x8e101a[_0x4233('0x42')]=qs['sort'](_0x90cc4['query'][_0x4233('0x43')]);_0x8e101a['where']=qs[_0x4233('0x46')](_[_0x4233('0x45')](_0x90cc4[_0x4233('0x3a')],_0xde4fd1[_0x4233('0x46')]));if(_0x90cc4['query'][_0x4233('0x47')]){_0x8e101a['where']=_[_0x4233('0x48')](_0x8e101a[_0x4233('0x44')],{'$or':_[_0x4233('0x34')](_0x8e101a[_0x4233('0x3d')],function(_0x40fe2d){var _0x4b8ffb={};_0x4b8ffb[_0x40fe2d]={'$like':'%'+_0x90cc4[_0x4233('0x3a')][_0x4233('0x47')]+'%'};return _0x4b8ffb;})});}_0x8e101a=_[_0x4233('0x48')]({},_0x8e101a,_0x90cc4[_0x4233('0x4a')]);return _0x1de3ab[_0x4233('0x58')](_0x8e101a);}})['then'](function(_0x15b009){if(_0x15b009){_0x289e2b=_0x15b009[_0x4233('0x3f')];if(!_0x90cc4['query'][_0x4233('0x40')](_0x4233('0x41'))){_0x8e101a[_0x4233('0x2a')]=qs[_0x4233('0x2a')](_0x90cc4[_0x4233('0x3a')]['limit']);_0x8e101a['offset']=qs['offset'](_0x90cc4[_0x4233('0x3a')][_0x4233('0x29')]);}return _0x1de3ab['getSubjects'](_0x8e101a);}})[_0x4233('0x30')](function(_0x33f578){if(_0x33f578){return _0x33f578?{'count':_0x289e2b,'rows':_0x33f578}:null;}})[_0x4233('0x30')](respondWithResult(_0x50f378,null))[_0x4233('0x24')](handleError(_0x50f378,null));};exports['getDescriptions']=function(_0x26aa51,_0xc63a9e,_0x347955){var _0x3b6844={};var _0x5b94c9={};var _0x54cd0d;var _0x467b45;return db[_0x4233('0x4d')][_0x4233('0x56')]({'where':{'id':_0x26aa51[_0x4233('0x50')]['id']}})[_0x4233('0x30')](handleEntityNotFound(_0xc63a9e,null))[_0x4233('0x30')](function(_0x3831b0){if(_0x3831b0){_0x54cd0d=_0x3831b0;_0x5b94c9[_0x4233('0x39')]=_[_0x4233('0x3b')](db[_0x4233('0x57')][_0x4233('0x35')]);_0x5b94c9[_0x4233('0x3a')]=_[_0x4233('0x3b')](_0x26aa51['query']);_0x5b94c9[_0x4233('0x46')]=_[_0x4233('0x3c')](_0x5b94c9[_0x4233('0x39')],_0x5b94c9['query']);_0x3b6844[_0x4233('0x3d')]=_[_0x4233('0x3c')](_0x5b94c9[_0x4233('0x39')],qs[_0x4233('0x3e')](_0x26aa51[_0x4233('0x3a')][_0x4233('0x3e')]));_0x3b6844[_0x4233('0x3d')]=_0x3b6844['attributes'][_0x4233('0x3f')]?_0x3b6844[_0x4233('0x3d')]:_0x5b94c9[_0x4233('0x39')];_0x3b6844['order']=qs[_0x4233('0x43')](_0x26aa51['query'][_0x4233('0x43')]);_0x3b6844['where']=qs[_0x4233('0x46')](_[_0x4233('0x45')](_0x26aa51[_0x4233('0x3a')],_0x5b94c9[_0x4233('0x46')]));if(_0x26aa51[_0x4233('0x3a')]['filter']){_0x3b6844['where']=_[_0x4233('0x48')](_0x3b6844[_0x4233('0x44')],{'$or':_['map'](_0x3b6844['attributes'],function(_0x1cedeb){var _0x510a79={};_0x510a79[_0x1cedeb]={'$like':'%'+_0x26aa51[_0x4233('0x3a')][_0x4233('0x47')]+'%'};return _0x510a79;})});}_0x3b6844=_[_0x4233('0x48')]({},_0x3b6844,_0x26aa51[_0x4233('0x4a')]);return _0x54cd0d[_0x4233('0x59')](_0x3b6844);}})[_0x4233('0x30')](function(_0x2748a1){if(_0x2748a1){_0x467b45=_0x2748a1[_0x4233('0x3f')];if(!_0x26aa51['query'][_0x4233('0x40')]('nolimit')){_0x3b6844['limit']=qs[_0x4233('0x2a')](_0x26aa51['query']['limit']);_0x3b6844['offset']=qs['offset'](_0x26aa51['query'][_0x4233('0x29')]);}return _0x54cd0d['getDescriptions'](_0x3b6844);}})['then'](function(_0x29ade3){if(_0x29ade3){return _0x29ade3?{'count':_0x467b45,'rows':_0x29ade3}:null;}})[_0x4233('0x30')](respondWithResult(_0xc63a9e,null))[_0x4233('0x24')](handleError(_0xc63a9e,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index 115ec09..c47f362 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 _0xfb67=['int_vtiger_configurations','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intVtigerConfiguration.attributes','exports','VtigerConfiguration'];(function(_0x4ac5c1,_0x12f4bc){var _0x17c632=function(_0x5a586c){while(--_0x5a586c){_0x4ac5c1['push'](_0x4ac5c1['shift']());}};_0x17c632(++_0x12f4bc);}(_0xfb67,0x91));var _0x7fb6=function(_0x26a093,_0x18faae){_0x26a093=_0x26a093-0x0;var _0x266f9b=_0xfb67[_0x26a093];return _0x266f9b;};'use strict';var _=require(_0x7fb6('0x0'));var util=require('util');var logger=require(_0x7fb6('0x1'))(_0x7fb6('0x2'));var moment=require(_0x7fb6('0x3'));var BPromise=require(_0x7fb6('0x4'));var rp=require(_0x7fb6('0x5'));var fs=require('fs');var path=require(_0x7fb6('0x6'));var rimraf=require('rimraf');var config=require(_0x7fb6('0x7'));var attributes=require(_0x7fb6('0x8'));module[_0x7fb6('0x9')]=function(_0x151632,_0x30bc46){return _0x151632['define'](_0x7fb6('0xa'),attributes,{'tableName':_0x7fb6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2a1d=['int_vtiger_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerConfiguration.attributes','define'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2a1d,0x112));var _0xd2a1=function(_0x1e25e7,_0x322b9c){_0x1e25e7=_0x1e25e7-0x0;var _0x3f86a7=_0x2a1d[_0x1e25e7];return _0x3f86a7;};'use strict';var _=require(_0xd2a1('0x0'));var util=require(_0xd2a1('0x1'));var logger=require(_0xd2a1('0x2'))(_0xd2a1('0x3'));var moment=require(_0xd2a1('0x4'));var BPromise=require(_0xd2a1('0x5'));var rp=require(_0xd2a1('0x6'));var fs=require('fs');var path=require(_0xd2a1('0x7'));var rimraf=require(_0xd2a1('0x8'));var config=require(_0xd2a1('0x9'));var attributes=require(_0xd2a1('0xa'));module['exports']=function(_0xdd7ea0,_0x40dc40){return _0xdd7ea0[_0xd2a1('0xb')]('VtigerConfiguration',attributes,{'tableName':_0xd2a1('0xc'),'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 6d9973d..40879f0 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 _0x5e4f=['stringify','error','code','message','result','catch','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x18839c,_0x48453b){var _0x16e30b=function(_0x5094a4){while(--_0x5094a4){_0x18839c['push'](_0x18839c['shift']());}};_0x16e30b(++_0x48453b);}(_0x5e4f,0x166));var _0xf5e4=function(_0x315c6e,_0x51d5ad){_0x315c6e=_0x315c6e-0x0;var _0x2169f4=_0x5e4f[_0x315c6e];return _0x2169f4;};'use strict';var _=require(_0xf5e4('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xf5e4('0x1'));var rs=require(_0xf5e4('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf5e4('0x3'))['db'];var utils=require(_0xf5e4('0x4'));var logger=require(_0xf5e4('0x5'))(_0xf5e4('0x6'));var config=require(_0xf5e4('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xf5e4('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0xc5c120,_0xaaf171,_0x6360c8){return new BPromise(function(_0x36476b,_0x368c1a){return client[_0xf5e4('0x9')](_0xc5c120,_0x6360c8)[_0xf5e4('0xa')](function(_0x4f3554){logger[_0xf5e4('0xb')](_0xf5e4('0xc'),_0xaaf171,_0xf5e4('0xd'));logger[_0xf5e4('0xe')](_0xf5e4('0xf'),_0xaaf171,_0xf5e4('0xd'),JSON[_0xf5e4('0x10')](_0x4f3554));if(_0x4f3554['error']){if(_0x4f3554[_0xf5e4('0x11')][_0xf5e4('0x12')]===0x1f4){logger['error'](_0xf5e4('0xc'),_0xaaf171,_0x4f3554['error'][_0xf5e4('0x13')]);return _0x368c1a(_0x4f3554[_0xf5e4('0x11')][_0xf5e4('0x13')]);}logger['error']('VtigerConfiguration,\x20%s,\x20%s',_0xaaf171,_0x4f3554[_0xf5e4('0x11')][_0xf5e4('0x13')]);return _0x36476b(_0x4f3554[_0xf5e4('0x11')][_0xf5e4('0x13')]);}else{logger['info']('VtigerConfiguration,\x20%s,\x20%s',_0xaaf171,_0xf5e4('0xd'));_0x36476b(_0x4f3554[_0xf5e4('0x14')][_0xf5e4('0x13')]);}})[_0xf5e4('0x15')](function(_0x45a4aa){logger['error'](_0xf5e4('0xc'),_0xaaf171,_0x45a4aa);_0x368c1a(_0x45a4aa);});});} \ No newline at end of file +var _0x3e6f=['http','request','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x1e393b,_0x355f6b){var _0x3d0bfe=function(_0x320830){while(--_0x320830){_0x1e393b['push'](_0x1e393b['shift']());}};_0x3d0bfe(++_0x355f6b);}(_0x3e6f,0x1db));var _0xf3e6=function(_0x38f62d,_0x3bb4d8){_0x38f62d=_0x38f62d-0x0;var _0x1359f1=_0x3e6f[_0x38f62d];return _0x1359f1;};'use strict';var _=require(_0xf3e6('0x0'));var util=require(_0xf3e6('0x1'));var moment=require('moment');var BPromise=require(_0xf3e6('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf3e6('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xf3e6('0x4'))(_0xf3e6('0x5'));var config=require(_0xf3e6('0x6'));var jayson=require(_0xf3e6('0x7'));var client=jayson[_0xf3e6('0x8')][_0xf3e6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x20d09c,_0x3bf3a1,_0x4dca79){return new BPromise(function(_0x2c702f,_0x4f351c){return client[_0xf3e6('0xa')](_0x20d09c,_0x4dca79)['then'](function(_0x59089b){logger[_0xf3e6('0xb')](_0xf3e6('0xc'),_0x3bf3a1,_0xf3e6('0xd'));logger[_0xf3e6('0xe')](_0xf3e6('0xf'),_0x3bf3a1,_0xf3e6('0xd'),JSON[_0xf3e6('0x10')](_0x59089b));if(_0x59089b['error']){if(_0x59089b[_0xf3e6('0x11')][_0xf3e6('0x12')]===0x1f4){logger['error']('VtigerConfiguration,\x20%s,\x20%s',_0x3bf3a1,_0x59089b[_0xf3e6('0x11')][_0xf3e6('0x13')]);return _0x4f351c(_0x59089b[_0xf3e6('0x11')][_0xf3e6('0x13')]);}logger['error'](_0xf3e6('0xc'),_0x3bf3a1,_0x59089b[_0xf3e6('0x11')]['message']);return _0x2c702f(_0x59089b[_0xf3e6('0x11')]['message']);}else{logger[_0xf3e6('0xb')](_0xf3e6('0xc'),_0x3bf3a1,_0xf3e6('0xd'));_0x2c702f(_0x59089b[_0xf3e6('0x14')]['message']);}})[_0xf3e6('0x15')](function(_0x511c25){logger[_0xf3e6('0x11')](_0xf3e6('0xc'),_0x3bf3a1,_0x511c25);_0x4f351c(_0x511c25);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 0fcd4db..2e60b02 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 _0x8a1c=['delete','destroy','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','post','create','put','update'];(function(_0x36dfbd,_0x5bfe2d){var _0x4ecad9=function(_0x5230da){while(--_0x5230da){_0x36dfbd['push'](_0x36dfbd['shift']());}};_0x4ecad9(++_0x5bfe2d);}(_0x8a1c,0x1de));var _0xc8a1=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x8a1c[_0x57b54c];return _0x59cc19;};'use strict';var multer=require(_0xc8a1('0x0'));var util=require(_0xc8a1('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xc8a1('0x2'));var router=express[_0xc8a1('0x3')]();var auth=require(_0xc8a1('0x4'));var interaction=require(_0xc8a1('0x5'));var config=require(_0xc8a1('0x6'));var controller=require('./intVtigerField.controller');router[_0xc8a1('0x7')]('/',auth[_0xc8a1('0x8')](),controller[_0xc8a1('0x9')]);router[_0xc8a1('0x7')](_0xc8a1('0xa'),auth[_0xc8a1('0x8')](),controller['show']);router[_0xc8a1('0xb')]('/',auth[_0xc8a1('0x8')](),controller[_0xc8a1('0xc')]);router[_0xc8a1('0xd')](_0xc8a1('0xa'),auth[_0xc8a1('0x8')](),controller[_0xc8a1('0xe')]);router[_0xc8a1('0xf')](_0xc8a1('0xa'),auth[_0xc8a1('0x8')](),controller[_0xc8a1('0x10')]);module['exports']=router; \ No newline at end of file +var _0xfa5a=['path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerField.controller','isAuthenticated','get','/:id','show','post','put','update','delete','destroy','exports','multer','util'];(function(_0x26bf16,_0x391f46){var _0x27655b=function(_0xabf793){while(--_0xabf793){_0x26bf16['push'](_0x26bf16['shift']());}};_0x27655b(++_0x391f46);}(_0xfa5a,0x1ae));var _0xafa5=function(_0x13c7c4,_0x1c5517){_0x13c7c4=_0x13c7c4-0x0;var _0x5bb807=_0xfa5a[_0x13c7c4];return _0x5bb807;};'use strict';var multer=require(_0xafa5('0x0'));var util=require(_0xafa5('0x1'));var path=require(_0xafa5('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xafa5('0x3')]();var auth=require(_0xafa5('0x4'));var interaction=require(_0xafa5('0x5'));var config=require(_0xafa5('0x6'));var controller=require(_0xafa5('0x7'));router['get']('/',auth[_0xafa5('0x8')](),controller['index']);router[_0xafa5('0x9')](_0xafa5('0xa'),auth[_0xafa5('0x8')](),controller[_0xafa5('0xb')]);router[_0xafa5('0xc')]('/',auth[_0xafa5('0x8')](),controller['create']);router[_0xafa5('0xd')](_0xafa5('0xa'),auth[_0xafa5('0x8')](),controller[_0xafa5('0xe')]);router[_0xafa5('0xf')]('/:id',auth[_0xafa5('0x8')](),controller[_0xafa5('0x10')]);module[_0xafa5('0x11')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index f5f7425..e8e1113 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 _0x089f=['exports','ENUM','string','variable','customVariable','STRING','BOOLEAN'];(function(_0x55677b,_0x3e5655){var _0x104b88=function(_0x78d34f){while(--_0x78d34f){_0x55677b['push'](_0x55677b['shift']());}};_0x104b88(++_0x3e5655);}(_0x089f,0x1c7));var _0xf089=function(_0x510bd3,_0x459b63){_0x510bd3=_0x510bd3-0x0;var _0x23bc1c=_0x089f[_0x510bd3];return _0x23bc1c;};'use strict';var Sequelize=require('sequelize');module[_0xf089('0x0')]={'type':{'type':Sequelize[_0xf089('0x1')](_0xf089('0x2'),_0xf089('0x3'),_0xf089('0x4'),'keyValue'),'defaultValue':_0xf089('0x2')},'content':{'type':Sequelize[_0xf089('0x5')]},'key':{'type':Sequelize[_0xf089('0x5')]},'keyType':{'type':Sequelize['ENUM'](_0xf089('0x2'),_0xf089('0x3'),_0xf089('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xf089('0x5')]},'nameField':{'type':Sequelize[_0xf089('0x5')]},'customField':{'type':Sequelize[_0xf089('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xc7b4=['string','customVariable','keyValue','STRING','variable','BOOLEAN','sequelize','ENUM'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc7b4,0x15e));var _0x4c7b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc7b4[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x4c7b('0x0'));module['exports']={'type':{'type':Sequelize[_0x4c7b('0x1')](_0x4c7b('0x2'),'variable',_0x4c7b('0x3'),_0x4c7b('0x4')),'defaultValue':_0x4c7b('0x2')},'content':{'type':Sequelize[_0x4c7b('0x5')]},'key':{'type':Sequelize[_0x4c7b('0x5')]},'keyType':{'type':Sequelize['ENUM'](_0x4c7b('0x2'),_0x4c7b('0x6'),_0x4c7b('0x3'))},'keyContent':{'type':Sequelize[_0x4c7b('0x5')]},'idField':{'type':Sequelize[_0x4c7b('0x5')]},'nameField':{'type':Sequelize[_0x4c7b('0x5')]},'customField':{'type':Sequelize[_0x4c7b('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index fb33aad..0158eab 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 _0x9499=['model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filters','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','find','create','body','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','name','send','index','map','VtigerField','rawAttributes','fieldName','type','key','query','keys','intersection'];(function(_0x1da06b,_0x274c4b){var _0x370e3b=function(_0x423bd5){while(--_0x423bd5){_0x1da06b['push'](_0x1da06b['shift']());}};_0x370e3b(++_0x274c4b);}(_0x9499,0x1e7));var _0x9949=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x9499[_0x122ef9];return _0x42fba0;};'use strict';var pdf=require(_0x9949('0x0'));var emlformat=require(_0x9949('0x1'));var rimraf=require(_0x9949('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9949('0x3'));var rp=require('request-promise');var moment=require(_0x9949('0x4'));var BPromise=require(_0x9949('0x5'));var Mustache=require(_0x9949('0x6'));var util=require(_0x9949('0x7'));var path=require('path');var sox=require(_0x9949('0x8'));var csv=require(_0x9949('0x9'));var ejs=require(_0x9949('0xa'));var fs=require('fs');var _=require(_0x9949('0xb'));var squel=require(_0x9949('0xc'));var crypto=require(_0x9949('0xd'));var jsforce=require(_0x9949('0xe'));var deskjs=require(_0x9949('0xf'));var toCsv=require(_0x9949('0x9'));var querystring=require(_0x9949('0x10'));var Papa=require('papaparse');var Redis=require(_0x9949('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x9949('0x12'));var as=require(_0x9949('0x13'));var hardwareService=require(_0x9949('0x14'));var logger=require('../../config/logger')(_0x9949('0x15'));var utils=require(_0x9949('0x16'));var config=require(_0x9949('0x17'));var db=require(_0x9949('0x18'))['db'];function respondWithStatusCode(_0x29b9bc,_0x26f496){_0x26f496=_0x26f496||0xcc;return function(_0x5a4098){if(_0x5a4098){return _0x29b9bc['sendStatus'](_0x26f496);}return _0x29b9bc[_0x9949('0x19')](_0x26f496)[_0x9949('0x1a')]();};}function respondWithResult(_0x3156f6,_0xed6a0f){_0xed6a0f=_0xed6a0f||0xc8;return function(_0x53f263){if(_0x53f263){return _0x3156f6[_0x9949('0x19')](_0xed6a0f)[_0x9949('0x1b')](_0x53f263);}};}function respondWithFilteredResult(_0x13cac6,_0x14c617){return function(_0x387f26){if(_0x387f26){var _0x11a6fb=_0x387f26[_0x9949('0x1c')],_0x3e304a=_0x14c617[_0x9949('0x1d')],_0xa3f67e=_0x14c617[_0x9949('0x1d')]+_0x14c617['limit'],_0x573b29;if(_0xa3f67e>=_0x11a6fb){_0xa3f67e=_0x11a6fb;_0x573b29=0xc8;}else{_0x573b29=0xce;}_0x13cac6[_0x9949('0x19')](_0x573b29);return _0x13cac6[_0x9949('0x1e')](_0x9949('0x1f'),_0x3e304a+'-'+_0xa3f67e+'/'+_0x11a6fb)[_0x9949('0x1b')](_0x387f26);}return null;};}function patchUpdates(_0x1b6208){return function(_0x1e94bd){try{jsonpatch[_0x9949('0x20')](_0x1e94bd,_0x1b6208,!![]);}catch(_0x1fadf8){return BPromise[_0x9949('0x21')](_0x1fadf8);}return _0x1e94bd[_0x9949('0x22')]();};}function saveUpdates(_0x3b53fc,_0x385bd0){return function(_0x258ae9){if(_0x258ae9){return _0x258ae9[_0x9949('0x23')](_0x3b53fc)[_0x9949('0x24')](function(_0x16a98f){return _0x16a98f;});}return null;};}function removeEntity(_0x40e95f,_0x8c3ce3){return function(_0x55145c){if(_0x55145c){return _0x55145c[_0x9949('0x25')]()[_0x9949('0x24')](function(){_0x40e95f[_0x9949('0x19')](0xcc)[_0x9949('0x1a')]();});}};}function handleEntityNotFound(_0x5ebde0,_0x343e83){return function(_0x4fa840){if(!_0x4fa840){_0x5ebde0[_0x9949('0x26')](0x194);}return _0x4fa840;};}function handleError(_0x4852fb,_0x8ee2b0){_0x8ee2b0=_0x8ee2b0||0x1f4;return function(_0x1d2f66){logger[_0x9949('0x27')](_0x1d2f66['stack']);if(_0x1d2f66[_0x9949('0x28')]){delete _0x1d2f66[_0x9949('0x28')];}_0x4852fb[_0x9949('0x19')](_0x8ee2b0)[_0x9949('0x29')](_0x1d2f66);};}exports[_0x9949('0x2a')]=function(_0x588d87,_0xd3c324){var _0xbc68fc={},_0x18a41a={},_0x5a610d={'count':0x0,'rows':[]};var _0x5a57c2=_[_0x9949('0x2b')](db[_0x9949('0x2c')][_0x9949('0x2d')],function(_0x194adf){return{'name':_0x194adf[_0x9949('0x2e')],'type':_0x194adf[_0x9949('0x2f')][_0x9949('0x30')]};});_0x18a41a['model']=_[_0x9949('0x2b')](_0x5a57c2,'name');_0x18a41a[_0x9949('0x31')]=_[_0x9949('0x32')](_0x588d87['query']);_0x18a41a['filters']=_[_0x9949('0x33')](_0x18a41a[_0x9949('0x34')],_0x18a41a['query']);_0xbc68fc[_0x9949('0x35')]=_[_0x9949('0x33')](_0x18a41a[_0x9949('0x34')],qs[_0x9949('0x36')](_0x588d87[_0x9949('0x31')]['fields']));_0xbc68fc['attributes']=_0xbc68fc['attributes'][_0x9949('0x37')]?_0xbc68fc[_0x9949('0x35')]:_0x18a41a[_0x9949('0x34')];if(!_0x588d87[_0x9949('0x31')][_0x9949('0x38')](_0x9949('0x39'))){_0xbc68fc['limit']=qs[_0x9949('0x3a')](_0x588d87[_0x9949('0x31')]['limit']);_0xbc68fc[_0x9949('0x1d')]=qs[_0x9949('0x1d')](_0x588d87[_0x9949('0x31')][_0x9949('0x1d')]);}_0xbc68fc[_0x9949('0x3b')]=qs[_0x9949('0x3c')](_0x588d87['query'][_0x9949('0x3c')]);_0xbc68fc[_0x9949('0x3d')]=qs['filters'](_[_0x9949('0x3e')](_0x588d87[_0x9949('0x31')],_0x18a41a[_0x9949('0x3f')]));if(_0x588d87['query'][_0x9949('0x40')]){_0xbc68fc[_0x9949('0x3d')]=_[_0x9949('0x41')](_0xbc68fc['where'],{'$or':_[_0x9949('0x2b')](_0x5a57c2,function(_0x150948){if(_0x150948[_0x9949('0x2f')]!==_0x9949('0x42')){var _0x1f94d6={};_0x1f94d6[_0x150948[_0x9949('0x28')]]={'$like':'%'+_0x588d87[_0x9949('0x31')][_0x9949('0x40')]+'%'};return _0x1f94d6;}})});}_0xbc68fc=_[_0x9949('0x41')]({},_0xbc68fc,_0x588d87['options']);var _0x10cc7f={'where':_0xbc68fc[_0x9949('0x3d')]};return db[_0x9949('0x2c')][_0x9949('0x1c')](_0x10cc7f)[_0x9949('0x24')](function(_0x27d199){_0x5a610d[_0x9949('0x1c')]=_0x27d199;if(_0x588d87[_0x9949('0x31')][_0x9949('0x43')]){_0xbc68fc[_0x9949('0x44')]=[{'all':!![]}];}return db[_0x9949('0x2c')][_0x9949('0x45')](_0xbc68fc);})[_0x9949('0x24')](function(_0x3b8dfb){_0x5a610d[_0x9949('0x46')]=_0x3b8dfb;return _0x5a610d;})[_0x9949('0x24')](respondWithFilteredResult(_0xd3c324,_0xbc68fc))[_0x9949('0x47')](handleError(_0xd3c324,null));};exports[_0x9949('0x48')]=function(_0x1f1fc0,_0x3c6aad){var _0x63fd4e={'raw':!![],'where':{'id':_0x1f1fc0[_0x9949('0x49')]['id']}},_0x4fbd82={};_0x4fbd82['model']=_[_0x9949('0x32')](db[_0x9949('0x2c')][_0x9949('0x2d')]);_0x4fbd82[_0x9949('0x31')]=_[_0x9949('0x32')](_0x1f1fc0[_0x9949('0x31')]);_0x4fbd82['filters']=_[_0x9949('0x33')](_0x4fbd82['model'],_0x4fbd82[_0x9949('0x31')]);_0x63fd4e[_0x9949('0x35')]=_[_0x9949('0x33')](_0x4fbd82[_0x9949('0x34')],qs[_0x9949('0x36')](_0x1f1fc0[_0x9949('0x31')]['fields']));_0x63fd4e[_0x9949('0x35')]=_0x63fd4e['attributes']['length']?_0x63fd4e[_0x9949('0x35')]:_0x4fbd82['model'];if(_0x1f1fc0[_0x9949('0x31')][_0x9949('0x43')]){_0x63fd4e[_0x9949('0x44')]=[{'all':!![]}];}_0x63fd4e=_[_0x9949('0x41')]({},_0x63fd4e,_0x1f1fc0['options']);return db[_0x9949('0x2c')][_0x9949('0x4a')](_0x63fd4e)['then'](handleEntityNotFound(_0x3c6aad,null))[_0x9949('0x24')](respondWithResult(_0x3c6aad,null))[_0x9949('0x47')](handleError(_0x3c6aad,null));};exports[_0x9949('0x4b')]=function(_0x293709,_0x1a2ae2){return db['VtigerField'][_0x9949('0x4b')](_0x293709[_0x9949('0x4c')],{})['then'](respondWithResult(_0x1a2ae2,0xc9))[_0x9949('0x47')](handleError(_0x1a2ae2,null));};exports['update']=function(_0x560016,_0x4979a2){if(_0x560016['body']['id']){delete _0x560016['body']['id'];}return db['VtigerField'][_0x9949('0x4a')]({'where':{'id':_0x560016[_0x9949('0x49')]['id']}})[_0x9949('0x24')](handleEntityNotFound(_0x4979a2,null))[_0x9949('0x24')](saveUpdates(_0x560016[_0x9949('0x4c')],null))[_0x9949('0x24')](respondWithResult(_0x4979a2,null))[_0x9949('0x47')](handleError(_0x4979a2,null));};exports[_0x9949('0x25')]=function(_0x97ce83,_0x57361e){return db[_0x9949('0x2c')][_0x9949('0x4a')]({'where':{'id':_0x97ce83[_0x9949('0x49')]['id']}})[_0x9949('0x24')](handleEntityNotFound(_0x57361e,null))['then'](removeEntity(_0x57361e,null))['catch'](handleError(_0x57361e,null));}; \ No newline at end of file +var _0x530f=['querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','end','error','stack','name','send','index','map','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','options','VtigerField','includeAll','include','findAll','rows','catch','show','rawAttributes','length','find','create','update','body','params','html-pdf','eml-format','rimraf','zip-dir','bluebird','mustache','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv'];(function(_0x26a9e0,_0x1c482a){var _0x2756e4=function(_0x4e9677){while(--_0x4e9677){_0x26a9e0['push'](_0x26a9e0['shift']());}};_0x2756e4(++_0x1c482a);}(_0x530f,0x1ba));var _0xf530=function(_0x3d474e,_0x431f54){_0x3d474e=_0x3d474e-0x0;var _0x30b3e3=_0x530f[_0x3d474e];return _0x30b3e3;};'use strict';var pdf=require(_0xf530('0x0'));var emlformat=require(_0xf530('0x1'));var rimraf=require(_0xf530('0x2'));var zipdir=require(_0xf530('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xf530('0x4'));var Mustache=require(_0xf530('0x5'));var util=require('util');var path=require(_0xf530('0x6'));var sox=require(_0xf530('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xf530('0x8'));var squel=require(_0xf530('0x9'));var crypto=require(_0xf530('0xa'));var jsforce=require(_0xf530('0xb'));var deskjs=require(_0xf530('0xc'));var toCsv=require(_0xf530('0xd'));var querystring=require(_0xf530('0xe'));var Papa=require(_0xf530('0xf'));var Redis=require(_0xf530('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xf530('0x11'));var as=require(_0xf530('0x12'));var hardwareService=require(_0xf530('0x13'));var logger=require('../../config/logger')(_0xf530('0x14'));var utils=require(_0xf530('0x15'));var config=require(_0xf530('0x16'));var db=require(_0xf530('0x17'))['db'];function respondWithStatusCode(_0x44c382,_0x250922){_0x250922=_0x250922||0xcc;return function(_0x138a5f){if(_0x138a5f){return _0x44c382[_0xf530('0x18')](_0x250922);}return _0x44c382[_0xf530('0x19')](_0x250922)['end']();};}function respondWithResult(_0x19992b,_0x32f868){_0x32f868=_0x32f868||0xc8;return function(_0x3b2374){if(_0x3b2374){return _0x19992b[_0xf530('0x19')](_0x32f868)[_0xf530('0x1a')](_0x3b2374);}};}function respondWithFilteredResult(_0x3b8903,_0x148f6c){return function(_0x17f74c){if(_0x17f74c){var _0x5407d3=_0x17f74c[_0xf530('0x1b')],_0x5e6f22=_0x148f6c[_0xf530('0x1c')],_0x323969=_0x148f6c[_0xf530('0x1c')]+_0x148f6c[_0xf530('0x1d')],_0x18f78e;if(_0x323969>=_0x5407d3){_0x323969=_0x5407d3;_0x18f78e=0xc8;}else{_0x18f78e=0xce;}_0x3b8903['status'](_0x18f78e);return _0x3b8903[_0xf530('0x1e')](_0xf530('0x1f'),_0x5e6f22+'-'+_0x323969+'/'+_0x5407d3)['json'](_0x17f74c);}return null;};}function patchUpdates(_0x61c2c1){return function(_0x3f5443){try{jsonpatch[_0xf530('0x20')](_0x3f5443,_0x61c2c1,!![]);}catch(_0x267db5){return BPromise[_0xf530('0x21')](_0x267db5);}return _0x3f5443[_0xf530('0x22')]();};}function saveUpdates(_0x877d8f,_0x23d4ab){return function(_0x2f1bb4){if(_0x2f1bb4){return _0x2f1bb4['update'](_0x877d8f)[_0xf530('0x23')](function(_0x3fb4b4){return _0x3fb4b4;});}return null;};}function removeEntity(_0x9bf990,_0x57d325){return function(_0x384a7f){if(_0x384a7f){return _0x384a7f[_0xf530('0x24')]()[_0xf530('0x23')](function(){_0x9bf990['status'](0xcc)[_0xf530('0x25')]();});}};}function handleEntityNotFound(_0x2e1bb6,_0x2facb4){return function(_0x548307){if(!_0x548307){_0x2e1bb6[_0xf530('0x18')](0x194);}return _0x548307;};}function handleError(_0xe0217c,_0x337c8a){_0x337c8a=_0x337c8a||0x1f4;return function(_0x549151){logger[_0xf530('0x26')](_0x549151[_0xf530('0x27')]);if(_0x549151['name']){delete _0x549151[_0xf530('0x28')];}_0xe0217c['status'](_0x337c8a)[_0xf530('0x29')](_0x549151);};}exports[_0xf530('0x2a')]=function(_0x1bd3ff,_0x5d6966){var _0x1333d4={},_0x110d7f={},_0x40ee05={'count':0x0,'rows':[]};var _0x2a2549=_[_0xf530('0x2b')](db['VtigerField']['rawAttributes'],function(_0x2d4dea){return{'name':_0x2d4dea['fieldName'],'type':_0x2d4dea['type'][_0xf530('0x2c')]};});_0x110d7f['model']=_[_0xf530('0x2b')](_0x2a2549,_0xf530('0x28'));_0x110d7f[_0xf530('0x2d')]=_[_0xf530('0x2e')](_0x1bd3ff[_0xf530('0x2d')]);_0x110d7f[_0xf530('0x2f')]=_[_0xf530('0x30')](_0x110d7f[_0xf530('0x31')],_0x110d7f['query']);_0x1333d4[_0xf530('0x32')]=_[_0xf530('0x30')](_0x110d7f[_0xf530('0x31')],qs[_0xf530('0x33')](_0x1bd3ff['query'][_0xf530('0x33')]));_0x1333d4['attributes']=_0x1333d4[_0xf530('0x32')]['length']?_0x1333d4['attributes']:_0x110d7f[_0xf530('0x31')];if(!_0x1bd3ff[_0xf530('0x2d')][_0xf530('0x34')](_0xf530('0x35'))){_0x1333d4[_0xf530('0x1d')]=qs[_0xf530('0x1d')](_0x1bd3ff[_0xf530('0x2d')]['limit']);_0x1333d4[_0xf530('0x1c')]=qs[_0xf530('0x1c')](_0x1bd3ff[_0xf530('0x2d')]['offset']);}_0x1333d4[_0xf530('0x36')]=qs[_0xf530('0x37')](_0x1bd3ff[_0xf530('0x2d')][_0xf530('0x37')]);_0x1333d4[_0xf530('0x38')]=qs[_0xf530('0x2f')](_[_0xf530('0x39')](_0x1bd3ff['query'],_0x110d7f[_0xf530('0x2f')]));if(_0x1bd3ff[_0xf530('0x2d')]['filter']){_0x1333d4[_0xf530('0x38')]=_[_0xf530('0x3a')](_0x1333d4[_0xf530('0x38')],{'$or':_[_0xf530('0x2b')](_0x2a2549,function(_0x582dcd){if(_0x582dcd[_0xf530('0x3b')]!==_0xf530('0x3c')){var _0x2f5a80={};_0x2f5a80[_0x582dcd[_0xf530('0x28')]]={'$like':'%'+_0x1bd3ff['query']['filter']+'%'};return _0x2f5a80;}})});}_0x1333d4=_['merge']({},_0x1333d4,_0x1bd3ff[_0xf530('0x3d')]);var _0x2f0ab7={'where':_0x1333d4[_0xf530('0x38')]};return db[_0xf530('0x3e')][_0xf530('0x1b')](_0x2f0ab7)['then'](function(_0x324fd1){_0x40ee05['count']=_0x324fd1;if(_0x1bd3ff[_0xf530('0x2d')][_0xf530('0x3f')]){_0x1333d4[_0xf530('0x40')]=[{'all':!![]}];}return db[_0xf530('0x3e')][_0xf530('0x41')](_0x1333d4);})[_0xf530('0x23')](function(_0x381b94){_0x40ee05[_0xf530('0x42')]=_0x381b94;return _0x40ee05;})[_0xf530('0x23')](respondWithFilteredResult(_0x5d6966,_0x1333d4))[_0xf530('0x43')](handleError(_0x5d6966,null));};exports[_0xf530('0x44')]=function(_0x5cad1c,_0x5a8629){var _0x5cc031={'raw':!![],'where':{'id':_0x5cad1c['params']['id']}},_0x189b21={};_0x189b21[_0xf530('0x31')]=_[_0xf530('0x2e')](db[_0xf530('0x3e')][_0xf530('0x45')]);_0x189b21[_0xf530('0x2d')]=_[_0xf530('0x2e')](_0x5cad1c[_0xf530('0x2d')]);_0x189b21[_0xf530('0x2f')]=_[_0xf530('0x30')](_0x189b21[_0xf530('0x31')],_0x189b21['query']);_0x5cc031[_0xf530('0x32')]=_[_0xf530('0x30')](_0x189b21['model'],qs[_0xf530('0x33')](_0x5cad1c['query'][_0xf530('0x33')]));_0x5cc031[_0xf530('0x32')]=_0x5cc031[_0xf530('0x32')][_0xf530('0x46')]?_0x5cc031[_0xf530('0x32')]:_0x189b21[_0xf530('0x31')];if(_0x5cad1c[_0xf530('0x2d')][_0xf530('0x3f')]){_0x5cc031[_0xf530('0x40')]=[{'all':!![]}];}_0x5cc031=_[_0xf530('0x3a')]({},_0x5cc031,_0x5cad1c[_0xf530('0x3d')]);return db[_0xf530('0x3e')][_0xf530('0x47')](_0x5cc031)['then'](handleEntityNotFound(_0x5a8629,null))[_0xf530('0x23')](respondWithResult(_0x5a8629,null))['catch'](handleError(_0x5a8629,null));};exports['create']=function(_0xb27f35,_0x467387){return db[_0xf530('0x3e')][_0xf530('0x48')](_0xb27f35['body'],{})['then'](respondWithResult(_0x467387,0xc9))[_0xf530('0x43')](handleError(_0x467387,null));};exports[_0xf530('0x49')]=function(_0x266acc,_0x5c4adf){if(_0x266acc[_0xf530('0x4a')]['id']){delete _0x266acc['body']['id'];}return db['VtigerField']['find']({'where':{'id':_0x266acc[_0xf530('0x4b')]['id']}})[_0xf530('0x23')](handleEntityNotFound(_0x5c4adf,null))[_0xf530('0x23')](saveUpdates(_0x266acc[_0xf530('0x4a')],null))['then'](respondWithResult(_0x5c4adf,null))['catch'](handleError(_0x5c4adf,null));};exports['destroy']=function(_0x462ba8,_0x25c8af){return db[_0xf530('0x3e')]['find']({'where':{'id':_0x462ba8[_0xf530('0x4b')]['id']}})[_0xf530('0x23')](handleEntityNotFound(_0x25c8af,null))[_0xf530('0x23')](removeEntity(_0x25c8af,null))[_0xf530('0x43')](handleError(_0x25c8af,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index b4c4e34..433edf9 100644 --- a/server/api/intVtigerField/intVtigerField.model.js +++ b/server/api/intVtigerField/intVtigerField.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['int_vtiger_fields','idField','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./intVtigerField.attributes','exports','VtigerField'];(function(_0x373742,_0x56adb9){var _0x5c8fb2=function(_0x5f10db){while(--_0x5f10db){_0x373742['push'](_0x373742['shift']());}};_0x5c8fb2(++_0x56adb9);}(_0x7a54,0x106));var _0x47a5=function(_0x1fcdce,_0x30e47a){_0x1fcdce=_0x1fcdce-0x0;var _0xb564d8=_0x7a54[_0x1fcdce];return _0xb564d8;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'vtiger_unique_index','fields':[_0x47a5('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7a54=['int_vtiger_fields','idField','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./intVtigerField.attributes','exports','VtigerField'];(function(_0x53a653,_0x2964e4){var _0x455247=function(_0x17a227){while(--_0x17a227){_0x53a653['push'](_0x53a653['shift']());}};_0x455247(++_0x2964e4);}(_0x7a54,0x106));var _0x47a5=function(_0xc4136d,_0x416834){_0xc4136d=_0xc4136d-0x0;var _0xc76475=_0x7a54[_0xc4136d];return _0xc76475;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'vtiger_unique_index','fields':[_0x47a5('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.rpc.js b/server/api/intVtigerField/intVtigerField.rpc.js index a9857e5..149a7cf 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 _0x2f68=['code','message','request\x20sent','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','then','info','VtigerField,\x20%s,\x20%s','debug','stringify','error'];(function(_0x18afca,_0x4219d9){var _0x11603f=function(_0x21d5d1){while(--_0x21d5d1){_0x18afca['push'](_0x18afca['shift']());}};_0x11603f(++_0x4219d9);}(_0x2f68,0x12b));var _0x82f6=function(_0x1a6f1e,_0x5f1de1){_0x1a6f1e=_0x1a6f1e-0x0;var _0x2d7143=_0x2f68[_0x1a6f1e];return _0x2d7143;};'use strict';var _=require('lodash');var util=require(_0x82f6('0x0'));var moment=require(_0x82f6('0x1'));var BPromise=require(_0x82f6('0x2'));var rs=require(_0x82f6('0x3'));var fs=require('fs');var Redis=require(_0x82f6('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x82f6('0x5'));var logger=require(_0x82f6('0x6'))(_0x82f6('0x7'));var config=require(_0x82f6('0x8'));var jayson=require(_0x82f6('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x9ad1f,_0x4fa10f,_0x282bc8){return new BPromise(function(_0x3fd6ef,_0x159ea8){return client['request'](_0x9ad1f,_0x282bc8)[_0x82f6('0xa')](function(_0x415226){logger[_0x82f6('0xb')](_0x82f6('0xc'),_0x4fa10f,'request\x20sent');logger[_0x82f6('0xd')]('VtigerField,\x20%s,\x20%s,\x20%s',_0x4fa10f,'request\x20sent',JSON[_0x82f6('0xe')](_0x415226));if(_0x415226['error']){if(_0x415226[_0x82f6('0xf')][_0x82f6('0x10')]===0x1f4){logger['error'](_0x82f6('0xc'),_0x4fa10f,_0x415226['error'][_0x82f6('0x11')]);return _0x159ea8(_0x415226['error']['message']);}logger[_0x82f6('0xf')](_0x82f6('0xc'),_0x4fa10f,_0x415226[_0x82f6('0xf')][_0x82f6('0x11')]);return _0x3fd6ef(_0x415226[_0x82f6('0xf')][_0x82f6('0x11')]);}else{logger[_0x82f6('0xb')](_0x82f6('0xc'),_0x4fa10f,_0x82f6('0x12'));_0x3fd6ef(_0x415226[_0x82f6('0x13')][_0x82f6('0x11')]);}})[_0x82f6('0x14')](function(_0x412d1f){logger[_0x82f6('0xf')](_0x82f6('0xc'),_0x4fa10f,_0x412d1f);_0x159ea8(_0x412d1f);});});} \ No newline at end of file +var _0x531a=['stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','VtigerField,\x20%s,\x20%s','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s'];(function(_0x34f9d9,_0x2ac5a8){var _0x43b3b6=function(_0x3e0ef9){while(--_0x3e0ef9){_0x34f9d9['push'](_0x34f9d9['shift']());}};_0x43b3b6(++_0x2ac5a8);}(_0x531a,0x100));var _0xa531=function(_0x4d120d,_0x55a2c9){_0x4d120d=_0x4d120d-0x0;var _0x12b156=_0x531a[_0x4d120d];return _0x12b156;};'use strict';var _=require(_0xa531('0x0'));var util=require(_0xa531('0x1'));var moment=require(_0xa531('0x2'));var BPromise=require(_0xa531('0x3'));var rs=require(_0xa531('0x4'));var fs=require('fs');var Redis=require(_0xa531('0x5'));var db=require(_0xa531('0x6'))['db'];var utils=require(_0xa531('0x7'));var logger=require(_0xa531('0x8'))(_0xa531('0x9'));var config=require('../../config/environment');var jayson=require(_0xa531('0xa'));var client=jayson['client'][_0xa531('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4446b9,_0x3fd172,_0x286dc7){return new BPromise(function(_0x3b68a7,_0x5bd2f9){return client[_0xa531('0xc')](_0x4446b9,_0x286dc7)[_0xa531('0xd')](function(_0x4d07e4){logger[_0xa531('0xe')](_0xa531('0xf'),_0x3fd172,_0xa531('0x10'));logger[_0xa531('0x11')](_0xa531('0x12'),_0x3fd172,'request\x20sent',JSON[_0xa531('0x13')](_0x4d07e4));if(_0x4d07e4['error']){if(_0x4d07e4[_0xa531('0x14')][_0xa531('0x15')]===0x1f4){logger[_0xa531('0x14')]('VtigerField,\x20%s,\x20%s',_0x3fd172,_0x4d07e4[_0xa531('0x14')][_0xa531('0x16')]);return _0x5bd2f9(_0x4d07e4['error'][_0xa531('0x16')]);}logger[_0xa531('0x14')]('VtigerField,\x20%s,\x20%s',_0x3fd172,_0x4d07e4[_0xa531('0x14')][_0xa531('0x16')]);return _0x3b68a7(_0x4d07e4[_0xa531('0x14')]['message']);}else{logger['info']('VtigerField,\x20%s,\x20%s',_0x3fd172,_0xa531('0x10'));_0x3b68a7(_0x4d07e4[_0xa531('0x17')][_0xa531('0x16')]);}})[_0xa531('0x18')](function(_0x324076){logger[_0xa531('0x14')]('VtigerField,\x20%s,\x20%s',_0x3fd172,_0x324076);_0x5bd2f9(_0x324076);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 025693e..6783bc9 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 _0xb8c7=['util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./intZendeskAccount.controller','get','isAuthenticated','index','/:id','/:id/configurations','getConfigurations','/:id/fields','getFields','create','addConfiguration','put','update','delete','destroy','exports'];(function(_0x4e3e61,_0x5a49b8){var _0xbdf1b5=function(_0x1ec386){while(--_0x1ec386){_0x4e3e61['push'](_0x4e3e61['shift']());}};_0xbdf1b5(++_0x5a49b8);}(_0xb8c7,0xb0));var _0x7b8c=function(_0x2d00ef,_0x4211bc){_0x2d00ef=_0x2d00ef-0x0;var _0x2cbe73=_0xb8c7[_0x2d00ef];return _0x2cbe73;};'use strict';var multer=require('multer');var util=require(_0x7b8c('0x0'));var path=require(_0x7b8c('0x1'));var timeout=require(_0x7b8c('0x2'));var express=require(_0x7b8c('0x3'));var router=express['Router']();var auth=require(_0x7b8c('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x7b8c('0x5'));var controller=require(_0x7b8c('0x6'));router[_0x7b8c('0x7')]('/',auth[_0x7b8c('0x8')](),controller[_0x7b8c('0x9')]);router[_0x7b8c('0x7')](_0x7b8c('0xa'),auth[_0x7b8c('0x8')](),controller['show']);router['get'](_0x7b8c('0xb'),auth[_0x7b8c('0x8')](),controller[_0x7b8c('0xc')]);router[_0x7b8c('0x7')](_0x7b8c('0xd'),auth[_0x7b8c('0x8')](),controller[_0x7b8c('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x7b8c('0xf')]);router['post'](_0x7b8c('0xb'),auth[_0x7b8c('0x8')](),controller[_0x7b8c('0x10')]);router[_0x7b8c('0x11')]('/:id',auth[_0x7b8c('0x8')](),controller[_0x7b8c('0x12')]);router[_0x7b8c('0x13')](_0x7b8c('0xa'),auth['isAuthenticated'](),controller[_0x7b8c('0x14')]);module[_0x7b8c('0x15')]=router; \ No newline at end of file +var _0xf906=['express','Router','../../config/environment','./intZendeskAccount.controller','get','isAuthenticated','index','/:id','/:id/configurations','getConfigurations','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x1f27df,_0x4f1a64){var _0x286ee2=function(_0x255ea7){while(--_0x255ea7){_0x1f27df['push'](_0x1f27df['shift']());}};_0x286ee2(++_0x4f1a64);}(_0xf906,0xb1));var _0x6f90=function(_0x34a984,_0x48a8be){_0x34a984=_0x34a984-0x0;var _0x2943ce=_0xf906[_0x34a984];return _0x2943ce;};'use strict';var multer=require(_0x6f90('0x0'));var util=require(_0x6f90('0x1'));var path=require(_0x6f90('0x2'));var timeout=require('connect-timeout');var express=require(_0x6f90('0x3'));var router=express[_0x6f90('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x6f90('0x5'));var controller=require(_0x6f90('0x6'));router[_0x6f90('0x7')]('/',auth[_0x6f90('0x8')](),controller[_0x6f90('0x9')]);router[_0x6f90('0x7')](_0x6f90('0xa'),auth[_0x6f90('0x8')](),controller['show']);router[_0x6f90('0x7')](_0x6f90('0xb'),auth['isAuthenticated'](),controller[_0x6f90('0xc')]);router[_0x6f90('0x7')]('/:id/fields',auth[_0x6f90('0x8')](),controller[_0x6f90('0xd')]);router[_0x6f90('0xe')]('/',auth[_0x6f90('0x8')](),controller['create']);router[_0x6f90('0xe')](_0x6f90('0xb'),auth['isAuthenticated'](),controller[_0x6f90('0xf')]);router[_0x6f90('0x10')](_0x6f90('0xa'),auth['isAuthenticated'](),controller[_0x6f90('0x11')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x6f90('0x12')]);module[_0x6f90('0x13')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index a681106..3a829a3 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 _0x45d6=['password','token','integrationTab','newTab','sequelize','exports','STRING','username','remoteUri','ENUM'];(function(_0xfcb2a4,_0xcfcfaf){var _0x5ee714=function(_0x290ee4){while(--_0x290ee4){_0xfcb2a4['push'](_0xfcb2a4['shift']());}};_0x5ee714(++_0xcfcfaf);}(_0x45d6,0x176));var _0x645d=function(_0x3c5cba,_0x386723){_0x3c5cba=_0x3c5cba-0x0;var _0x5860a2=_0x45d6[_0x3c5cba];return _0x5860a2;};'use strict';var Sequelize=require(_0x645d('0x0'));module[_0x645d('0x1')]={'name':{'type':Sequelize[_0x645d('0x2')]},'description':{'type':Sequelize[_0x645d('0x2')]},'username':{'type':Sequelize[_0x645d('0x2')],'unique':_0x645d('0x3')},'password':{'type':Sequelize[_0x645d('0x2')]},'token':{'type':Sequelize[_0x645d('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x645d('0x4')},'authType':{'type':Sequelize[_0x645d('0x5')](_0x645d('0x6'),_0x645d('0x7')),'defaultValue':_0x645d('0x6')},'serverUrl':{'type':Sequelize[_0x645d('0x2')]},'type':{'type':Sequelize[_0x645d('0x5')](_0x645d('0x8'),_0x645d('0x9')),'defaultValue':_0x645d('0x8')}}; \ No newline at end of file +var _0xeddf=['sequelize','exports','STRING','username','ENUM','password','token','integrationTab','newTab'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xeddf,0xfc));var _0xfedd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xeddf[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xfedd('0x0'));module[_0xfedd('0x1')]={'name':{'type':Sequelize[_0xfedd('0x2')]},'description':{'type':Sequelize[_0xfedd('0x2')]},'username':{'type':Sequelize[_0xfedd('0x2')],'unique':_0xfedd('0x3')},'password':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0xfedd('0x2')]},'remoteUri':{'type':Sequelize[_0xfedd('0x2')],'unique':'remoteUri'},'authType':{'type':Sequelize[_0xfedd('0x4')](_0xfedd('0x5'),_0xfedd('0x6')),'defaultValue':'password'},'serverUrl':{'type':Sequelize[_0xfedd('0x2')]},'type':{'type':Sequelize[_0xfedd('0x4')](_0xfedd('0x7'),_0xfedd('0x8')),'defaultValue':'integrationTab'}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 2402bf2..cd314a2 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 _0xd7fc=['format','%s/%s','headers','%s:%s','toString','Basic\x20%s','%s/token:%s','base64','Unknown\x20authentication\x20type','subject','description','group','assignee','remove','ticket_fields','includes','position','system_field_options','custom_field_options','statusCode','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','to-csv','ejs','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','ZendeskAccount,\x20%s,\x20%s','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','status','end','json','count','offset','limit','Content-Range','apply','save','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','ZendeskAccount','includeAll','include','rows','show','create','body','update','find','params','getConfigurations','findOne','addConfiguration','Subjects','channel','Descriptions','getDescriptions','ZendeskField','getFields','username','token','authType','remoteUri','slice','substring','lastIndexOf','GET'];(function(_0x26649c,_0x9122d0){var _0x23aef7=function(_0x2d6ce8){while(--_0x2d6ce8){_0x26649c['push'](_0x26649c['shift']());}};_0x23aef7(++_0x9122d0);}(_0xd7fc,0x91));var _0xcd7f=function(_0x5bb4e8,_0x44b756){_0x5bb4e8=_0x5bb4e8-0x0;var _0x2a86f2=_0xd7fc[_0x5bb4e8];return _0x2a86f2;};'use strict';var pdf=require(_0xcd7f('0x0'));var emlformat=require(_0xcd7f('0x1'));var rimraf=require(_0xcd7f('0x2'));var zipdir=require(_0xcd7f('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xcd7f('0x4'));var BPromise=require(_0xcd7f('0x5'));var Mustache=require(_0xcd7f('0x6'));var util=require(_0xcd7f('0x7'));var path=require(_0xcd7f('0x8'));var sox=require('sox');var csv=require(_0xcd7f('0x9'));var ejs=require(_0xcd7f('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xcd7f('0xb'));var deskjs=require(_0xcd7f('0xc'));var toCsv=require(_0xcd7f('0x9'));var querystring=require('querystring');var Papa=require(_0xcd7f('0xd'));var Redis=require(_0xcd7f('0xe'));var authService=require(_0xcd7f('0xf'));var qs=require(_0xcd7f('0x10'));var as=require(_0xcd7f('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xcd7f('0x12'))(_0xcd7f('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xcd7f('0x14'))['db'];var integrations=require(_0xcd7f('0x15'));var jayson=require(_0xcd7f('0x16'));var client=jayson[_0xcd7f('0x17')]['http']({'port':0x232a});function checkPasswordPattern(_0x4edc96,_0x32e303,_0x2dfad2){if(_0x2dfad2){var _0x50280c=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x50280c[_0xcd7f('0x18')](_0x32e303)){return _0x4edc96;}else{throw new db[(_0xcd7f('0x19'))][(_0xcd7f('0x1a'))](_0xcd7f('0x1b'));}}else{return _0x4edc96;}}function respondWithRpcPromise(_0x5d551a,_0x745a1c,_0x14e7e9,_0xa8943f){return new BPromise(function(_0x2270cf,_0x31bcb1){var _0x2bf90d=_0xa8943f||client;return _0x2bf90d[_0xcd7f('0x1c')](_0x5d551a,_0x14e7e9)[_0xcd7f('0x1d')](function(_0x244d3){logger[_0xcd7f('0x1e')](_0xcd7f('0x1f'),_0x745a1c,'request\x20sent');logger[_0xcd7f('0x20')](_0xcd7f('0x21'),_0x745a1c,_0xcd7f('0x22'),JSON[_0xcd7f('0x23')](_0x244d3));if(_0x244d3[_0xcd7f('0x24')]){if(_0x244d3[_0xcd7f('0x24')][_0xcd7f('0x25')]===0x1f4){logger['error'](_0xcd7f('0x1f'),_0x745a1c,_0x244d3[_0xcd7f('0x24')][_0xcd7f('0x26')]);return _0x31bcb1(_0x244d3[_0xcd7f('0x24')][_0xcd7f('0x26')]);}logger[_0xcd7f('0x24')](_0xcd7f('0x1f'),_0x745a1c,_0x244d3['error'][_0xcd7f('0x26')]);return _0x2270cf(_0x244d3[_0xcd7f('0x24')][_0xcd7f('0x26')]);}else{logger[_0xcd7f('0x1e')](_0xcd7f('0x1f'),_0x745a1c,'request\x20sent');_0x2270cf(_0x244d3[_0xcd7f('0x27')][_0xcd7f('0x26')]);}})[_0xcd7f('0x28')](function(_0x1b032c){logger[_0xcd7f('0x24')]('ZendeskAccount,\x20%s,\x20%s',_0x745a1c,_0x1b032c);_0x31bcb1(_0x1b032c);});});}function respondWithStatusCode(_0x342078,_0x441b97){_0x441b97=_0x441b97||0xcc;return function(_0x5b58e3){if(_0x5b58e3){return _0x342078['sendStatus'](_0x441b97);}return _0x342078[_0xcd7f('0x29')](_0x441b97)[_0xcd7f('0x2a')]();};}function respondWithResult(_0xee0f3f,_0x24396e){_0x24396e=_0x24396e||0xc8;return function(_0x10f243){if(_0x10f243){return _0xee0f3f[_0xcd7f('0x29')](_0x24396e)[_0xcd7f('0x2b')](_0x10f243);}};}function respondWithFilteredResult(_0x15584e,_0x28089f){return function(_0x189a94){if(_0x189a94){var _0x476a3c=_0x189a94[_0xcd7f('0x2c')],_0x1a4581=_0x28089f[_0xcd7f('0x2d')],_0x19cefb=_0x28089f[_0xcd7f('0x2d')]+_0x28089f[_0xcd7f('0x2e')],_0x4dc3c5;if(_0x19cefb>=_0x476a3c){_0x19cefb=_0x476a3c;_0x4dc3c5=0xc8;}else{_0x4dc3c5=0xce;}_0x15584e['status'](_0x4dc3c5);return _0x15584e['set'](_0xcd7f('0x2f'),_0x1a4581+'-'+_0x19cefb+'/'+_0x476a3c)['json'](_0x189a94);}return null;};}function patchUpdates(_0x2839c4){return function(_0x5576c0){try{jsonpatch[_0xcd7f('0x30')](_0x5576c0,_0x2839c4,!![]);}catch(_0x457d67){return BPromise['reject'](_0x457d67);}return _0x5576c0[_0xcd7f('0x31')]();};}function saveUpdates(_0x359f87,_0x3fb72d){return function(_0x28d872){if(_0x28d872){return _0x28d872['update'](_0x359f87)[_0xcd7f('0x1d')](function(_0x368611){return _0x368611;});}return null;};}function removeEntity(_0x48ce6d,_0x5e7086){return function(_0x98f652){if(_0x98f652){return _0x98f652[_0xcd7f('0x32')]()[_0xcd7f('0x1d')](function(){_0x48ce6d[_0xcd7f('0x29')](0xcc)[_0xcd7f('0x2a')]();});}};}function handleEntityNotFound(_0x5549f1,_0x3187ff){return function(_0x37d6d9){if(!_0x37d6d9){_0x5549f1['sendStatus'](0x194);}return _0x37d6d9;};}function handleError(_0x496ccb,_0x4245ea){_0x4245ea=_0x4245ea||0x1f4;return function(_0x5d7a0c){logger[_0xcd7f('0x24')](_0x5d7a0c[_0xcd7f('0x33')]);if(_0x5d7a0c[_0xcd7f('0x34')]){delete _0x5d7a0c[_0xcd7f('0x34')];}_0x496ccb[_0xcd7f('0x29')](_0x4245ea)[_0xcd7f('0x35')](_0x5d7a0c);};}exports[_0xcd7f('0x36')]=function(_0x5a6709,_0x58e55e){var _0x132ccd={},_0x4892d2={},_0x7547fe={'count':0x0,'rows':[]};var _0x458c35=_[_0xcd7f('0x37')](db['ZendeskAccount'][_0xcd7f('0x38')],function(_0x4eae03){return{'name':_0x4eae03[_0xcd7f('0x39')],'type':_0x4eae03[_0xcd7f('0x3a')][_0xcd7f('0x3b')]};});_0x4892d2[_0xcd7f('0x3c')]=_[_0xcd7f('0x37')](_0x458c35,_0xcd7f('0x34'));_0x4892d2[_0xcd7f('0x3d')]=_[_0xcd7f('0x3e')](_0x5a6709[_0xcd7f('0x3d')]);_0x4892d2['filters']=_[_0xcd7f('0x3f')](_0x4892d2[_0xcd7f('0x3c')],_0x4892d2['query']);_0x132ccd[_0xcd7f('0x40')]=_[_0xcd7f('0x3f')](_0x4892d2[_0xcd7f('0x3c')],qs[_0xcd7f('0x41')](_0x5a6709[_0xcd7f('0x3d')][_0xcd7f('0x41')]));_0x132ccd[_0xcd7f('0x40')]=_0x132ccd[_0xcd7f('0x40')][_0xcd7f('0x42')]?_0x132ccd[_0xcd7f('0x40')]:_0x4892d2[_0xcd7f('0x3c')];if(!_0x5a6709[_0xcd7f('0x3d')][_0xcd7f('0x43')](_0xcd7f('0x44'))){_0x132ccd[_0xcd7f('0x2e')]=qs[_0xcd7f('0x2e')](_0x5a6709[_0xcd7f('0x3d')][_0xcd7f('0x2e')]);_0x132ccd[_0xcd7f('0x2d')]=qs[_0xcd7f('0x2d')](_0x5a6709[_0xcd7f('0x3d')]['offset']);}_0x132ccd[_0xcd7f('0x45')]=qs[_0xcd7f('0x46')](_0x5a6709['query'][_0xcd7f('0x46')]);_0x132ccd[_0xcd7f('0x47')]=qs[_0xcd7f('0x48')](_[_0xcd7f('0x49')](_0x5a6709[_0xcd7f('0x3d')],_0x4892d2['filters']));if(_0x5a6709[_0xcd7f('0x3d')][_0xcd7f('0x4a')]){_0x132ccd['where']=_[_0xcd7f('0x4b')](_0x132ccd[_0xcd7f('0x47')],{'$or':_[_0xcd7f('0x37')](_0x458c35,function(_0x5e02c2){if(_0x5e02c2['type']!==_0xcd7f('0x4c')){var _0x5968af={};_0x5968af[_0x5e02c2[_0xcd7f('0x34')]]={'$like':'%'+_0x5a6709[_0xcd7f('0x3d')][_0xcd7f('0x4a')]+'%'};return _0x5968af;}})});}_0x132ccd=_[_0xcd7f('0x4b')]({},_0x132ccd,_0x5a6709[_0xcd7f('0x4d')]);var _0x296138={'where':_0x132ccd[_0xcd7f('0x47')]};return db[_0xcd7f('0x4e')][_0xcd7f('0x2c')](_0x296138)[_0xcd7f('0x1d')](function(_0x1917ae){_0x7547fe[_0xcd7f('0x2c')]=_0x1917ae;if(_0x5a6709['query'][_0xcd7f('0x4f')]){_0x132ccd[_0xcd7f('0x50')]=[{'all':!![]}];}return db['ZendeskAccount']['findAll'](_0x132ccd);})[_0xcd7f('0x1d')](function(_0x9d3e2c){_0x7547fe[_0xcd7f('0x51')]=_0x9d3e2c;return _0x7547fe;})['then'](respondWithFilteredResult(_0x58e55e,_0x132ccd))['catch'](handleError(_0x58e55e,null));};exports[_0xcd7f('0x52')]=function(_0x3d239d,_0xaff57f){var _0x8b4381={'raw':![],'where':{'id':_0x3d239d['params']['id']}},_0x25202e={};_0x25202e[_0xcd7f('0x3c')]=_[_0xcd7f('0x3e')](db[_0xcd7f('0x4e')]['rawAttributes']);_0x25202e[_0xcd7f('0x3d')]=_[_0xcd7f('0x3e')](_0x3d239d['query']);_0x25202e[_0xcd7f('0x48')]=_[_0xcd7f('0x3f')](_0x25202e['model'],_0x25202e[_0xcd7f('0x3d')]);_0x8b4381[_0xcd7f('0x40')]=_[_0xcd7f('0x3f')](_0x25202e[_0xcd7f('0x3c')],qs[_0xcd7f('0x41')](_0x3d239d[_0xcd7f('0x3d')][_0xcd7f('0x41')]));_0x8b4381[_0xcd7f('0x40')]=_0x8b4381['attributes'][_0xcd7f('0x42')]?_0x8b4381[_0xcd7f('0x40')]:_0x25202e[_0xcd7f('0x3c')];if(_0x3d239d[_0xcd7f('0x3d')][_0xcd7f('0x4f')]){_0x8b4381[_0xcd7f('0x50')]=[{'all':!![]}];}_0x8b4381=_[_0xcd7f('0x4b')]({},_0x8b4381,_0x3d239d[_0xcd7f('0x4d')]);return db[_0xcd7f('0x4e')]['find'](_0x8b4381)['then'](handleEntityNotFound(_0xaff57f,null))['then'](respondWithResult(_0xaff57f,null))[_0xcd7f('0x28')](handleError(_0xaff57f,null));};exports[_0xcd7f('0x53')]=function(_0x36393f,_0x462116){return db['ZendeskAccount'][_0xcd7f('0x53')](_0x36393f[_0xcd7f('0x54')],{})['then'](respondWithResult(_0x462116,0xc9))[_0xcd7f('0x28')](handleError(_0x462116,null));};exports[_0xcd7f('0x55')]=function(_0x1fe32c,_0x55fce3){if(_0x1fe32c['body']['id']){delete _0x1fe32c[_0xcd7f('0x54')]['id'];}return db[_0xcd7f('0x4e')][_0xcd7f('0x56')]({'where':{'id':_0x1fe32c[_0xcd7f('0x57')]['id']}})[_0xcd7f('0x1d')](handleEntityNotFound(_0x55fce3,null))[_0xcd7f('0x1d')](saveUpdates(_0x1fe32c[_0xcd7f('0x54')],null))['then'](respondWithResult(_0x55fce3,null))[_0xcd7f('0x28')](handleError(_0x55fce3,null));};exports[_0xcd7f('0x32')]=function(_0x10a9c6,_0x4b9930){return db[_0xcd7f('0x4e')][_0xcd7f('0x56')]({'where':{'id':_0x10a9c6[_0xcd7f('0x57')]['id']}})['then'](handleEntityNotFound(_0x4b9930,null))[_0xcd7f('0x1d')](removeEntity(_0x4b9930,null))[_0xcd7f('0x28')](handleError(_0x4b9930,null));};exports[_0xcd7f('0x58')]=function(_0x3b8bda,_0x2a7966,_0x14dbf8){var _0x50e54c={};var _0x4cb5c3={};var _0x485c8b;var _0x27c37e;return db['ZendeskAccount'][_0xcd7f('0x59')]({'where':{'id':_0x3b8bda['params']['id']}})[_0xcd7f('0x1d')](handleEntityNotFound(_0x2a7966,null))['then'](function(_0x5dd1a5){if(_0x5dd1a5){_0x485c8b=_0x5dd1a5;_0x4cb5c3[_0xcd7f('0x3c')]=_[_0xcd7f('0x3e')](db['ZendeskConfiguration']['rawAttributes']);_0x4cb5c3['query']=_[_0xcd7f('0x3e')](_0x3b8bda[_0xcd7f('0x3d')]);_0x4cb5c3[_0xcd7f('0x48')]=_['intersection'](_0x4cb5c3[_0xcd7f('0x3c')],_0x4cb5c3[_0xcd7f('0x3d')]);_0x50e54c[_0xcd7f('0x40')]=_[_0xcd7f('0x3f')](_0x4cb5c3[_0xcd7f('0x3c')],qs['fields'](_0x3b8bda[_0xcd7f('0x3d')]['fields']));_0x50e54c[_0xcd7f('0x40')]=_0x50e54c['attributes'][_0xcd7f('0x42')]?_0x50e54c[_0xcd7f('0x40')]:_0x4cb5c3[_0xcd7f('0x3c')];_0x50e54c[_0xcd7f('0x45')]=qs[_0xcd7f('0x46')](_0x3b8bda[_0xcd7f('0x3d')][_0xcd7f('0x46')]);_0x50e54c[_0xcd7f('0x47')]=qs[_0xcd7f('0x48')](_['pick'](_0x3b8bda[_0xcd7f('0x3d')],_0x4cb5c3[_0xcd7f('0x48')]));if(_0x3b8bda[_0xcd7f('0x3d')][_0xcd7f('0x4a')]){_0x50e54c['where']=_['merge'](_0x50e54c[_0xcd7f('0x47')],{'$or':_[_0xcd7f('0x37')](_0x50e54c['attributes'],function(_0x1c938d){var _0x51e92a={};_0x51e92a[_0x1c938d]={'$like':'%'+_0x3b8bda['query']['filter']+'%'};return _0x51e92a;})});}_0x50e54c=_[_0xcd7f('0x4b')]({},_0x50e54c,_0x3b8bda[_0xcd7f('0x4d')]);return _0x485c8b[_0xcd7f('0x58')](_0x50e54c);}})[_0xcd7f('0x1d')](function(_0x4474e4){if(_0x4474e4){_0x27c37e=_0x4474e4['length'];if(!_0x3b8bda[_0xcd7f('0x3d')]['hasOwnProperty'](_0xcd7f('0x44'))){_0x50e54c[_0xcd7f('0x2e')]=qs[_0xcd7f('0x2e')](_0x3b8bda['query'][_0xcd7f('0x2e')]);_0x50e54c[_0xcd7f('0x2d')]=qs[_0xcd7f('0x2d')](_0x3b8bda[_0xcd7f('0x3d')][_0xcd7f('0x2d')]);}return _0x485c8b[_0xcd7f('0x58')](_0x50e54c);}})[_0xcd7f('0x1d')](function(_0x1963f0){if(_0x1963f0){return _0x1963f0?{'count':_0x27c37e,'rows':_0x1963f0}:null;}})['then'](respondWithResult(_0x2a7966,null))[_0xcd7f('0x28')](handleError(_0x2a7966,null));};exports[_0xcd7f('0x5a')]=function(_0x4c5d61,_0x2dd7cc,_0x127fe0){if(_0x4c5d61['body']['id']){delete _0x4c5d61[_0xcd7f('0x54')]['id'];}return db[_0xcd7f('0x4e')][_0xcd7f('0x59')]({'where':{'id':_0x4c5d61['params']['id']}})[_0xcd7f('0x1d')](handleEntityNotFound(_0x2dd7cc,null))[_0xcd7f('0x1d')](function(_0x5c77c7){if(_0x5c77c7){_0x4c5d61['body']['AccountId']=_0x5c77c7['id'];_0x4c5d61[_0xcd7f('0x54')][_0xcd7f('0x5b')]=integrations['getSubjects'](_0x4c5d61['body'][_0xcd7f('0x5c')],_0x4c5d61['body']['type']);_0x4c5d61[_0xcd7f('0x54')][_0xcd7f('0x5d')]=integrations[_0xcd7f('0x5e')](_0x4c5d61[_0xcd7f('0x54')][_0xcd7f('0x5c')],_0x4c5d61[_0xcd7f('0x54')][_0xcd7f('0x3a')]);return db['ZendeskConfiguration'][_0xcd7f('0x53')](_0x4c5d61[_0xcd7f('0x54')],{'include':[{'model':db[_0xcd7f('0x5f')],'as':'Subjects'},{'model':db[_0xcd7f('0x5f')],'as':_0xcd7f('0x5d')}]});}return null;})[_0xcd7f('0x1d')](respondWithResult(_0x2dd7cc,null))['catch'](handleError(_0x2dd7cc,null));};exports[_0xcd7f('0x60')]=function(_0x150980,_0x5e12f5,_0x4d6f43){var _0xbce27c='';return db[_0xcd7f('0x4e')][_0xcd7f('0x59')]({'where':{'id':_0x150980[_0xcd7f('0x57')]['id']},'attributes':['id',_0xcd7f('0x61'),'password',_0xcd7f('0x62'),_0xcd7f('0x63'),'remoteUri']})[_0xcd7f('0x1d')](handleEntityNotFound(_0x5e12f5,null))[_0xcd7f('0x1d')](function(_0x460ac3){if(_0x460ac3){_0xbce27c=_0x460ac3[_0xcd7f('0x64')];var _0x20f1e4=_0xbce27c[_0xcd7f('0x65')](-0x1);if(_0x20f1e4==='/'){_0xbce27c=_0xbce27c[_0xcd7f('0x66')](0x0,_0xbce27c[_0xcd7f('0x67')](_0x20f1e4));}var _0x5e0367={'method':_0xcd7f('0x68'),'uri':util[_0xcd7f('0x69')](_0xcd7f('0x6a'),_0xbce27c,'ticket_fields'),'json':!![]};switch(_0x460ac3['authType']){case'password':_0x5e0367[_0xcd7f('0x6b')]={'Authorization':util[_0xcd7f('0x69')]('Basic\x20%s',new Buffer(util[_0xcd7f('0x69')](_0xcd7f('0x6c'),_0x460ac3[_0xcd7f('0x61')],_0x460ac3['password']))[_0xcd7f('0x6d')]('base64'))};break;case _0xcd7f('0x62'):_0x5e0367[_0xcd7f('0x6b')]={'Authorization':util[_0xcd7f('0x69')](_0xcd7f('0x6e'),new Buffer(util['format'](_0xcd7f('0x6f'),_0x460ac3[_0xcd7f('0x61')],_0x460ac3[_0xcd7f('0x62')]))[_0xcd7f('0x6d')](_0xcd7f('0x70')))};break;default:throw new db[(_0xcd7f('0x19'))][(_0xcd7f('0x1a'))](_0xcd7f('0x71'));}return rp(_0x5e0367);}})[_0xcd7f('0x1d')](function(_0xfaba57){if(_0xfaba57){var _0x313586=[_0xcd7f('0x72'),_0xcd7f('0x73'),_0xcd7f('0x74'),_0xcd7f('0x75')];_[_0xcd7f('0x76')](_0xfaba57[_0xcd7f('0x77')],function(_0x12cd17){return _0x313586[_0xcd7f('0x78')](_0x12cd17[_0xcd7f('0x3a')]);});return{'count':_0xfaba57[_0xcd7f('0x77')][_0xcd7f('0x42')],'rows':_[_0xcd7f('0x37')](_0xfaba57[_0xcd7f('0x77')],function(_0x49e630){return{'id':_0x49e630['id'],'name':_0x49e630[_0xcd7f('0x79')]>0x7?_0x49e630['title']:_0x49e630['type'],'custom':_0x49e630[_0xcd7f('0x79')]>0x7?!![]:![],'options':_0x49e630[_0xcd7f('0x7a')]?_0x49e630[_0xcd7f('0x7a')]:_0x49e630[_0xcd7f('0x7b')]?_0x49e630[_0xcd7f('0x7b')]:[]};})};}})[_0xcd7f('0x1d')](respondWithResult(_0x5e12f5,null))[_0xcd7f('0x28')](function(_0x5a73bd){var _0x5289a0=_0x150980[_0xcd7f('0x3d')]['test']?0x1f4:_0x5a73bd['statusCode']||0x1f4;logger[_0xcd7f('0x24')]('getFields,\x20%s,\x20%s,\x20%s',_0xcd7f('0x60'),_0x5289a0,JSON['stringify'](_0x5a73bd));delete _0x5a73bd[_0xcd7f('0x34')];if(_0x5289a0===0x191){_0x5289a0=0x190;}_0x5e12f5[_0xcd7f('0x29')](_0x5289a0)[_0xcd7f('0x35')](_0x150980[_0xcd7f('0x3d')][_0xcd7f('0x18')]?{'message':'Wrong\x20credentials','statusCode':_0x5a73bd[_0xcd7f('0x7c')]}:_0x5a73bd);});}; \ No newline at end of file +var _0x9de7=['ValidationError','description','group','assignee','remove','position','title','system_field_options','test','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','statusCode','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../components/integrations/configuration','jayson/promise','client','http','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','ZendeskAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','sendStatus','status','end','json','count','offset','set','Content-Range','reject','save','update','then','name','send','index','map','ZendeskAccount','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','options','findAll','rows','show','params','include','find','catch','create','body','destroy','findOne','ZendeskConfiguration','length','order','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','ZendeskField','getFields','password','token','authType','slice','format','%s/%s','ticket_fields','headers','Basic\x20%s','username','toString','base64'];(function(_0x468ec7,_0x4a398d){var _0x3773f9=function(_0x197b2f){while(--_0x197b2f){_0x468ec7['push'](_0x468ec7['shift']());}};_0x3773f9(++_0x4a398d);}(_0x9de7,0x17a));var _0x79de=function(_0x57cb4f,_0x541f57){_0x57cb4f=_0x57cb4f-0x0;var _0x29bb45=_0x9de7[_0x57cb4f];return _0x29bb45;};'use strict';var pdf=require(_0x79de('0x0'));var emlformat=require(_0x79de('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x79de('0x2'));var jsonpatch=require(_0x79de('0x3'));var rp=require(_0x79de('0x4'));var moment=require(_0x79de('0x5'));var BPromise=require(_0x79de('0x6'));var Mustache=require(_0x79de('0x7'));var util=require('util');var path=require(_0x79de('0x8'));var sox=require(_0x79de('0x9'));var csv=require(_0x79de('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x79de('0xb'));var squel=require(_0x79de('0xc'));var crypto=require(_0x79de('0xd'));var jsforce=require(_0x79de('0xe'));var deskjs=require(_0x79de('0xf'));var toCsv=require(_0x79de('0xa'));var querystring=require(_0x79de('0x10'));var Papa=require(_0x79de('0x11'));var Redis=require('ioredis');var authService=require(_0x79de('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x79de('0x13'));var hardwareService=require(_0x79de('0x14'));var logger=require(_0x79de('0x15'))(_0x79de('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var integrations=require(_0x79de('0x17'));var jayson=require(_0x79de('0x18'));var client=jayson[_0x79de('0x19')][_0x79de('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x45689f,_0x3f8abe,_0x5da39d){if(_0x5da39d){var _0x592d17=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x592d17['test'](_0x3f8abe)){return _0x45689f;}else{throw new db[(_0x79de('0x1b'))]['ValidationError'](_0x79de('0x1c'));}}else{return _0x45689f;}}function respondWithRpcPromise(_0x4d2fec,_0x4b73f5,_0x162b85,_0xa28575){return new BPromise(function(_0x9cfccf,_0x3a7533){var _0x2e8f46=_0xa28575||client;return _0x2e8f46[_0x79de('0x1d')](_0x4d2fec,_0x162b85)['then'](function(_0x30e40e){logger['info'](_0x79de('0x1e'),_0x4b73f5,_0x79de('0x1f'));logger['debug']('ZendeskAccount,\x20%s,\x20%s,\x20%s',_0x4b73f5,_0x79de('0x1f'),JSON[_0x79de('0x20')](_0x30e40e));if(_0x30e40e[_0x79de('0x21')]){if(_0x30e40e[_0x79de('0x21')][_0x79de('0x22')]===0x1f4){logger[_0x79de('0x21')](_0x79de('0x1e'),_0x4b73f5,_0x30e40e[_0x79de('0x21')][_0x79de('0x23')]);return _0x3a7533(_0x30e40e['error'][_0x79de('0x23')]);}logger['error']('ZendeskAccount,\x20%s,\x20%s',_0x4b73f5,_0x30e40e['error'][_0x79de('0x23')]);return _0x9cfccf(_0x30e40e[_0x79de('0x21')]['message']);}else{logger[_0x79de('0x24')](_0x79de('0x1e'),_0x4b73f5,'request\x20sent');_0x9cfccf(_0x30e40e[_0x79de('0x25')][_0x79de('0x23')]);}})['catch'](function(_0x4927ee){logger[_0x79de('0x21')](_0x79de('0x1e'),_0x4b73f5,_0x4927ee);_0x3a7533(_0x4927ee);});});}function respondWithStatusCode(_0x51de8e,_0x14a818){_0x14a818=_0x14a818||0xcc;return function(_0x423c97){if(_0x423c97){return _0x51de8e[_0x79de('0x26')](_0x14a818);}return _0x51de8e[_0x79de('0x27')](_0x14a818)[_0x79de('0x28')]();};}function respondWithResult(_0x3139be,_0x38ba78){_0x38ba78=_0x38ba78||0xc8;return function(_0x311957){if(_0x311957){return _0x3139be[_0x79de('0x27')](_0x38ba78)[_0x79de('0x29')](_0x311957);}};}function respondWithFilteredResult(_0x3453d1,_0x492154){return function(_0x55331a){if(_0x55331a){var _0x12fcdc=_0x55331a[_0x79de('0x2a')],_0x2430b0=_0x492154[_0x79de('0x2b')],_0x19c7c5=_0x492154['offset']+_0x492154['limit'],_0x279485;if(_0x19c7c5>=_0x12fcdc){_0x19c7c5=_0x12fcdc;_0x279485=0xc8;}else{_0x279485=0xce;}_0x3453d1['status'](_0x279485);return _0x3453d1[_0x79de('0x2c')](_0x79de('0x2d'),_0x2430b0+'-'+_0x19c7c5+'/'+_0x12fcdc)[_0x79de('0x29')](_0x55331a);}return null;};}function patchUpdates(_0x358213){return function(_0x57a3d6){try{jsonpatch['apply'](_0x57a3d6,_0x358213,!![]);}catch(_0x4cce05){return BPromise[_0x79de('0x2e')](_0x4cce05);}return _0x57a3d6[_0x79de('0x2f')]();};}function saveUpdates(_0x157474,_0x214bae){return function(_0x484e60){if(_0x484e60){return _0x484e60[_0x79de('0x30')](_0x157474)[_0x79de('0x31')](function(_0x35a65b){return _0x35a65b;});}return null;};}function removeEntity(_0x4d3c29,_0x17cce6){return function(_0x4633cb){if(_0x4633cb){return _0x4633cb['destroy']()[_0x79de('0x31')](function(){_0x4d3c29[_0x79de('0x27')](0xcc)[_0x79de('0x28')]();});}};}function handleEntityNotFound(_0x1334f6,_0x483a23){return function(_0x370358){if(!_0x370358){_0x1334f6[_0x79de('0x26')](0x194);}return _0x370358;};}function handleError(_0x48f516,_0x5b04d6){_0x5b04d6=_0x5b04d6||0x1f4;return function(_0x5af75a){logger[_0x79de('0x21')](_0x5af75a['stack']);if(_0x5af75a[_0x79de('0x32')]){delete _0x5af75a[_0x79de('0x32')];}_0x48f516[_0x79de('0x27')](_0x5b04d6)[_0x79de('0x33')](_0x5af75a);};}exports[_0x79de('0x34')]=function(_0x408ad8,_0x2daede){var _0x2be0df={},_0x311a93={},_0x2eff4f={'count':0x0,'rows':[]};var _0x186834=_[_0x79de('0x35')](db[_0x79de('0x36')][_0x79de('0x37')],function(_0x4c5d76){return{'name':_0x4c5d76[_0x79de('0x38')],'type':_0x4c5d76[_0x79de('0x39')][_0x79de('0x3a')]};});_0x311a93['model']=_['map'](_0x186834,_0x79de('0x32'));_0x311a93[_0x79de('0x3b')]=_[_0x79de('0x3c')](_0x408ad8[_0x79de('0x3b')]);_0x311a93[_0x79de('0x3d')]=_[_0x79de('0x3e')](_0x311a93[_0x79de('0x3f')],_0x311a93['query']);_0x2be0df[_0x79de('0x40')]=_['intersection'](_0x311a93[_0x79de('0x3f')],qs[_0x79de('0x41')](_0x408ad8[_0x79de('0x3b')][_0x79de('0x41')]));_0x2be0df[_0x79de('0x40')]=_0x2be0df[_0x79de('0x40')]['length']?_0x2be0df[_0x79de('0x40')]:_0x311a93[_0x79de('0x3f')];if(!_0x408ad8[_0x79de('0x3b')][_0x79de('0x42')](_0x79de('0x43'))){_0x2be0df['limit']=qs[_0x79de('0x44')](_0x408ad8[_0x79de('0x3b')]['limit']);_0x2be0df['offset']=qs[_0x79de('0x2b')](_0x408ad8[_0x79de('0x3b')][_0x79de('0x2b')]);}_0x2be0df['order']=qs[_0x79de('0x45')](_0x408ad8[_0x79de('0x3b')][_0x79de('0x45')]);_0x2be0df[_0x79de('0x46')]=qs['filters'](_[_0x79de('0x47')](_0x408ad8[_0x79de('0x3b')],_0x311a93[_0x79de('0x3d')]));if(_0x408ad8[_0x79de('0x3b')][_0x79de('0x48')]){_0x2be0df[_0x79de('0x46')]=_[_0x79de('0x49')](_0x2be0df['where'],{'$or':_[_0x79de('0x35')](_0x186834,function(_0x8a11e0){if(_0x8a11e0['type']!=='VIRTUAL'){var _0x17b310={};_0x17b310[_0x8a11e0[_0x79de('0x32')]]={'$like':'%'+_0x408ad8[_0x79de('0x3b')][_0x79de('0x48')]+'%'};return _0x17b310;}})});}_0x2be0df=_[_0x79de('0x49')]({},_0x2be0df,_0x408ad8[_0x79de('0x4a')]);var _0x38a628={'where':_0x2be0df[_0x79de('0x46')]};return db[_0x79de('0x36')]['count'](_0x38a628)[_0x79de('0x31')](function(_0x5d7969){_0x2eff4f[_0x79de('0x2a')]=_0x5d7969;if(_0x408ad8[_0x79de('0x3b')]['includeAll']){_0x2be0df['include']=[{'all':!![]}];}return db[_0x79de('0x36')][_0x79de('0x4b')](_0x2be0df);})[_0x79de('0x31')](function(_0x107c3e){_0x2eff4f[_0x79de('0x4c')]=_0x107c3e;return _0x2eff4f;})['then'](respondWithFilteredResult(_0x2daede,_0x2be0df))['catch'](handleError(_0x2daede,null));};exports[_0x79de('0x4d')]=function(_0x2da308,_0x839bf){var _0x406fbe={'raw':![],'where':{'id':_0x2da308[_0x79de('0x4e')]['id']}},_0x509fcf={};_0x509fcf['model']=_[_0x79de('0x3c')](db[_0x79de('0x36')]['rawAttributes']);_0x509fcf[_0x79de('0x3b')]=_[_0x79de('0x3c')](_0x2da308[_0x79de('0x3b')]);_0x509fcf['filters']=_['intersection'](_0x509fcf[_0x79de('0x3f')],_0x509fcf[_0x79de('0x3b')]);_0x406fbe['attributes']=_[_0x79de('0x3e')](_0x509fcf[_0x79de('0x3f')],qs[_0x79de('0x41')](_0x2da308[_0x79de('0x3b')][_0x79de('0x41')]));_0x406fbe[_0x79de('0x40')]=_0x406fbe[_0x79de('0x40')]['length']?_0x406fbe[_0x79de('0x40')]:_0x509fcf[_0x79de('0x3f')];if(_0x2da308[_0x79de('0x3b')]['includeAll']){_0x406fbe[_0x79de('0x4f')]=[{'all':!![]}];}_0x406fbe=_['merge']({},_0x406fbe,_0x2da308[_0x79de('0x4a')]);return db[_0x79de('0x36')][_0x79de('0x50')](_0x406fbe)['then'](handleEntityNotFound(_0x839bf,null))[_0x79de('0x31')](respondWithResult(_0x839bf,null))[_0x79de('0x51')](handleError(_0x839bf,null));};exports[_0x79de('0x52')]=function(_0x33c494,_0x59a8e0){return db[_0x79de('0x36')][_0x79de('0x52')](_0x33c494[_0x79de('0x53')],{})[_0x79de('0x31')](respondWithResult(_0x59a8e0,0xc9))[_0x79de('0x51')](handleError(_0x59a8e0,null));};exports[_0x79de('0x30')]=function(_0x19b0cf,_0x1cc0bf){if(_0x19b0cf[_0x79de('0x53')]['id']){delete _0x19b0cf['body']['id'];}return db[_0x79de('0x36')]['find']({'where':{'id':_0x19b0cf[_0x79de('0x4e')]['id']}})[_0x79de('0x31')](handleEntityNotFound(_0x1cc0bf,null))[_0x79de('0x31')](saveUpdates(_0x19b0cf[_0x79de('0x53')],null))[_0x79de('0x31')](respondWithResult(_0x1cc0bf,null))[_0x79de('0x51')](handleError(_0x1cc0bf,null));};exports[_0x79de('0x54')]=function(_0x385189,_0x5b4f92){return db[_0x79de('0x36')][_0x79de('0x50')]({'where':{'id':_0x385189[_0x79de('0x4e')]['id']}})[_0x79de('0x31')](handleEntityNotFound(_0x5b4f92,null))[_0x79de('0x31')](removeEntity(_0x5b4f92,null))[_0x79de('0x51')](handleError(_0x5b4f92,null));};exports['getConfigurations']=function(_0x36cbcc,_0x5ebf66,_0x1b90ba){var _0x3f5e0a={};var _0x6fb6ac={};var _0x52c826;var _0x509475;return db['ZendeskAccount'][_0x79de('0x55')]({'where':{'id':_0x36cbcc[_0x79de('0x4e')]['id']}})['then'](handleEntityNotFound(_0x5ebf66,null))[_0x79de('0x31')](function(_0x5f15aa){if(_0x5f15aa){_0x52c826=_0x5f15aa;_0x6fb6ac['model']=_[_0x79de('0x3c')](db[_0x79de('0x56')][_0x79de('0x37')]);_0x6fb6ac[_0x79de('0x3b')]=_[_0x79de('0x3c')](_0x36cbcc[_0x79de('0x3b')]);_0x6fb6ac['filters']=_[_0x79de('0x3e')](_0x6fb6ac['model'],_0x6fb6ac[_0x79de('0x3b')]);_0x3f5e0a[_0x79de('0x40')]=_[_0x79de('0x3e')](_0x6fb6ac['model'],qs['fields'](_0x36cbcc[_0x79de('0x3b')][_0x79de('0x41')]));_0x3f5e0a[_0x79de('0x40')]=_0x3f5e0a['attributes'][_0x79de('0x57')]?_0x3f5e0a['attributes']:_0x6fb6ac[_0x79de('0x3f')];_0x3f5e0a[_0x79de('0x58')]=qs['sort'](_0x36cbcc[_0x79de('0x3b')]['sort']);_0x3f5e0a[_0x79de('0x46')]=qs[_0x79de('0x3d')](_[_0x79de('0x47')](_0x36cbcc[_0x79de('0x3b')],_0x6fb6ac[_0x79de('0x3d')]));if(_0x36cbcc[_0x79de('0x3b')][_0x79de('0x48')]){_0x3f5e0a['where']=_[_0x79de('0x49')](_0x3f5e0a['where'],{'$or':_[_0x79de('0x35')](_0x3f5e0a[_0x79de('0x40')],function(_0x154b7f){var _0x42ad50={};_0x42ad50[_0x154b7f]={'$like':'%'+_0x36cbcc[_0x79de('0x3b')]['filter']+'%'};return _0x42ad50;})});}_0x3f5e0a=_['merge']({},_0x3f5e0a,_0x36cbcc[_0x79de('0x4a')]);return _0x52c826[_0x79de('0x59')](_0x3f5e0a);}})[_0x79de('0x31')](function(_0x4f5724){if(_0x4f5724){_0x509475=_0x4f5724['length'];if(!_0x36cbcc[_0x79de('0x3b')][_0x79de('0x42')]('nolimit')){_0x3f5e0a['limit']=qs['limit'](_0x36cbcc[_0x79de('0x3b')]['limit']);_0x3f5e0a[_0x79de('0x2b')]=qs['offset'](_0x36cbcc['query']['offset']);}return _0x52c826[_0x79de('0x59')](_0x3f5e0a);}})['then'](function(_0x1c4398){if(_0x1c4398){return _0x1c4398?{'count':_0x509475,'rows':_0x1c4398}:null;}})[_0x79de('0x31')](respondWithResult(_0x5ebf66,null))[_0x79de('0x51')](handleError(_0x5ebf66,null));};exports[_0x79de('0x5a')]=function(_0x20bc8e,_0x1f6250,_0x3e9e42){if(_0x20bc8e[_0x79de('0x53')]['id']){delete _0x20bc8e[_0x79de('0x53')]['id'];}return db[_0x79de('0x36')][_0x79de('0x55')]({'where':{'id':_0x20bc8e['params']['id']}})[_0x79de('0x31')](handleEntityNotFound(_0x1f6250,null))['then'](function(_0x18512f){if(_0x18512f){_0x20bc8e[_0x79de('0x53')][_0x79de('0x5b')]=_0x18512f['id'];_0x20bc8e[_0x79de('0x53')][_0x79de('0x5c')]=integrations[_0x79de('0x5d')](_0x20bc8e[_0x79de('0x53')]['channel'],_0x20bc8e['body'][_0x79de('0x39')]);_0x20bc8e[_0x79de('0x53')][_0x79de('0x5e')]=integrations[_0x79de('0x5f')](_0x20bc8e[_0x79de('0x53')]['channel'],_0x20bc8e[_0x79de('0x53')][_0x79de('0x39')]);return db[_0x79de('0x56')][_0x79de('0x52')](_0x20bc8e[_0x79de('0x53')],{'include':[{'model':db[_0x79de('0x60')],'as':_0x79de('0x5c')},{'model':db[_0x79de('0x60')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x1f6250,null))[_0x79de('0x51')](handleError(_0x1f6250,null));};exports[_0x79de('0x61')]=function(_0x9ab628,_0x9618ce,_0x5bbecf){var _0x3e6f63='';return db[_0x79de('0x36')]['findOne']({'where':{'id':_0x9ab628['params']['id']},'attributes':['id','username',_0x79de('0x62'),_0x79de('0x63'),_0x79de('0x64'),'remoteUri']})[_0x79de('0x31')](handleEntityNotFound(_0x9618ce,null))['then'](function(_0x326676){if(_0x326676){_0x3e6f63=_0x326676['remoteUri'];var _0x509e25=_0x3e6f63[_0x79de('0x65')](-0x1);if(_0x509e25==='/'){_0x3e6f63=_0x3e6f63['substring'](0x0,_0x3e6f63['lastIndexOf'](_0x509e25));}var _0xd7921b={'method':'GET','uri':util[_0x79de('0x66')](_0x79de('0x67'),_0x3e6f63,_0x79de('0x68')),'json':!![]};switch(_0x326676[_0x79de('0x64')]){case _0x79de('0x62'):_0xd7921b[_0x79de('0x69')]={'Authorization':util[_0x79de('0x66')](_0x79de('0x6a'),new Buffer(util[_0x79de('0x66')]('%s:%s',_0x326676[_0x79de('0x6b')],_0x326676[_0x79de('0x62')]))['toString']('base64'))};break;case'token':_0xd7921b[_0x79de('0x69')]={'Authorization':util[_0x79de('0x66')](_0x79de('0x6a'),new Buffer(util[_0x79de('0x66')]('%s/token:%s',_0x326676['username'],_0x326676[_0x79de('0x63')]))[_0x79de('0x6c')](_0x79de('0x6d')))};break;default:throw new db[(_0x79de('0x1b'))][(_0x79de('0x6e'))]('Unknown\x20authentication\x20type');}return rp(_0xd7921b);}})[_0x79de('0x31')](function(_0x35884b){if(_0x35884b){var _0x12cfaf=['subject',_0x79de('0x6f'),_0x79de('0x70'),_0x79de('0x71')];_[_0x79de('0x72')](_0x35884b[_0x79de('0x68')],function(_0xdd5c4c){return _0x12cfaf['includes'](_0xdd5c4c[_0x79de('0x39')]);});return{'count':_0x35884b['ticket_fields'][_0x79de('0x57')],'rows':_[_0x79de('0x35')](_0x35884b[_0x79de('0x68')],function(_0x516102){return{'id':_0x516102['id'],'name':_0x516102[_0x79de('0x73')]>0x7?_0x516102[_0x79de('0x74')]:_0x516102[_0x79de('0x39')],'custom':_0x516102[_0x79de('0x73')]>0x7?!![]:![],'options':_0x516102[_0x79de('0x75')]?_0x516102['system_field_options']:_0x516102['custom_field_options']?_0x516102['custom_field_options']:[]};})};}})[_0x79de('0x31')](respondWithResult(_0x9618ce,null))['catch'](function(_0x5e875e){var _0x128ba9=_0x9ab628[_0x79de('0x3b')][_0x79de('0x76')]?0x1f4:_0x5e875e['statusCode']||0x1f4;logger[_0x79de('0x21')](_0x79de('0x77'),_0x79de('0x61'),_0x128ba9,JSON['stringify'](_0x5e875e));delete _0x5e875e[_0x79de('0x32')];if(_0x128ba9===0x191){_0x128ba9=0x190;}_0x9618ce['status'](_0x128ba9)[_0x79de('0x33')](_0x9ab628[_0x79de('0x3b')]['test']?{'message':_0x79de('0x78'),'statusCode':_0x5e875e[_0x79de('0x79')]}:_0x5e875e);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 4e6650b..1ea0376 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 _0x7620=['../../components/integrations/configuration','define','ZendeskAccount','int_zendesk_accounts','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZendeskAccount.attributes'];(function(_0x1c6b9c,_0x4a312c){var _0x247491=function(_0x2e0dc0){while(--_0x2e0dc0){_0x1c6b9c['push'](_0x1c6b9c['shift']());}};_0x247491(++_0x4a312c);}(_0x7620,0x1ee));var _0x0762=function(_0x3e8bf8,_0x4e76d6){_0x3e8bf8=_0x3e8bf8-0x0;var _0x3391ce=_0x7620[_0x3e8bf8];return _0x3391ce;};'use strict';var _=require(_0x0762('0x0'));var util=require(_0x0762('0x1'));var logger=require('../../config/logger')(_0x0762('0x2'));var moment=require(_0x0762('0x3'));var BPromise=require(_0x0762('0x4'));var rp=require(_0x0762('0x5'));var fs=require('fs');var path=require(_0x0762('0x6'));var rimraf=require(_0x0762('0x7'));var config=require(_0x0762('0x8'));var attributes=require(_0x0762('0x9'));var integrations=require(_0x0762('0xa'));module['exports']=function(_0x2b100e,_0x3bf916){return _0x2b100e[_0x0762('0xb')](_0x0762('0xc'),attributes,{'tableName':_0x0762('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x75ee=['../../components/integrations/configuration','define','ZendeskAccount','int_zendesk_accounts','lodash','util','../../config/logger','moment','request-promise','path','../../config/environment'];(function(_0x4584df,_0x2aeec1){var _0x14f1e7=function(_0x567a36){while(--_0x567a36){_0x4584df['push'](_0x4584df['shift']());}};_0x14f1e7(++_0x2aeec1);}(_0x75ee,0x67));var _0xe75e=function(_0xbf8ebe,_0x3b69a5){_0xbf8ebe=_0xbf8ebe-0x0;var _0x1e25e8=_0x75ee[_0xbf8ebe];return _0x1e25e8;};'use strict';var _=require(_0xe75e('0x0'));var util=require(_0xe75e('0x1'));var logger=require(_0xe75e('0x2'))('api');var moment=require(_0xe75e('0x3'));var BPromise=require('bluebird');var rp=require(_0xe75e('0x4'));var fs=require('fs');var path=require(_0xe75e('0x5'));var rimraf=require('rimraf');var config=require(_0xe75e('0x6'));var attributes=require('./intZendeskAccount.attributes');var integrations=require(_0xe75e('0x7'));module['exports']=function(_0xace8b7,_0x4ed7ac){return _0xace8b7[_0xe75e('0x8')](_0xe75e('0x9'),attributes,{'tableName':_0xe75e('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 f61f2f9..2525d82 100644 --- a/server/api/intZendeskAccount/intZendeskAccount.rpc.js +++ b/server/api/intZendeskAccount/intZendeskAccount.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['code','error','message','result','catch','ZendeskAccount','findAll','options','raw','where','attributes','include','map','model','GetZendeskAccount','stringify','ShowZendeskAccount','find','then','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s'];(function(_0xdc37a1,_0x53ebb9){var _0x99b4fe=function(_0x2811e3){while(--_0x2811e3){_0xdc37a1['push'](_0xdc37a1['shift']());}};_0x99b4fe(++_0x53ebb9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0xa9e0[_0x92c450];return _0x2a9599;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['GetZendeskAccount']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')]({'raw':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x18')]||null:null,'attributes':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x19')]||null:null,'limit':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')]['limit']||null:null,'include':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x459eb1[_0x0a9e('0x16')]['include'],function(_0xfb6e48){return{'model':db[_0xfb6e48[_0x0a9e('0x1c')]],'as':_0xfb6e48['as'],'attributes':_0xfb6e48[_0x0a9e('0x19')],'include':_0xfb6e48[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0xfb6e48[_0x0a9e('0x1a')],function(_0x16b1ca){return{'model':db[_0x16b1ca['model']],'as':_0x16b1ca['as'],'attributes':_0x16b1ca['attributes'],'include':_0x16b1ca[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x16b1ca[_0x0a9e('0x1a')],function(_0x33161b){return{'model':db[_0x33161b['model']],'as':_0x33161b['as'],'attributes':_0x33161b[_0x0a9e('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x45a1e7){logger['info'](_0x0a9e('0x1d'),_0x459eb1);logger[_0x0a9e('0xd')](_0x0a9e('0x1d'),_0x459eb1,JSON[_0x0a9e('0x1e')](_0x45a1e7));_0x106033(_0x45a1e7);})[_0x0a9e('0x13')](function(_0x1538a4){logger[_0x0a9e('0x10')](_0x0a9e('0x1d'),_0x1538a4['message'],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x1538a4[_0x0a9e('0x11')]));});});};exports[_0x0a9e('0x1f')]=function(_0x2ec755){var _0x5c877d=this;return new Promise(function(_0x15b200,_0x40e7a3){return db[_0x0a9e('0x14')][_0x0a9e('0x20')]({'raw':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')]['where']||null:null,'attributes':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755['options'][_0x0a9e('0x19')]||null:null,'include':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x2ec755['options'][_0x0a9e('0x1a')],function(_0x46f0a5){return{'model':db[_0x46f0a5[_0x0a9e('0x1c')]],'as':_0x46f0a5['as'],'attributes':_0x46f0a5[_0x0a9e('0x19')],'include':_0x46f0a5[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x46f0a5[_0x0a9e('0x1a')],function(_0x39e565){return{'model':db[_0x39e565['model']],'as':_0x39e565['as'],'attributes':_0x39e565[_0x0a9e('0x19')],'include':_0x39e565['include']?_[_0x0a9e('0x1b')](_0x39e565[_0x0a9e('0x1a')],function(_0x2b7e7f){return{'model':db[_0x2b7e7f[_0x0a9e('0x1c')]],'as':_0x2b7e7f['as'],'attributes':_0x2b7e7f['attributes']};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x21')](function(_0xd1836d){logger[_0x0a9e('0xa')](_0x0a9e('0x1f'),_0x2ec755);logger['debug']('ShowZendeskAccount',_0x2ec755,JSON[_0x0a9e('0x1e')](_0xd1836d));_0x15b200(_0xd1836d);})['catch'](function(_0x24936a){logger[_0x0a9e('0x10')](_0x0a9e('0x1f'),_0x24936a[_0x0a9e('0x11')],_0x2ec755);_0x40e7a3(_0x5c877d['error'](0x1f4,_0x24936a[_0x0a9e('0x11')]));});});}; \ No newline at end of file +var _0xb7e7=['request','then','info','ZendeskAccount,\x20%s,\x20%s','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','GetZendeskAccount','ZendeskAccount','findAll','options','raw','attributes','limit','include','map','model','ShowZendeskAccount','find','where','lodash','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','http'];(function(_0x4fcb6b,_0x2615a7){var _0x16b9e6=function(_0x4bedc2){while(--_0x4bedc2){_0x4fcb6b['push'](_0x4fcb6b['shift']());}};_0x16b9e6(++_0x2615a7);}(_0xb7e7,0x121));var _0x7b7e=function(_0x4b2863,_0x494899){_0x4b2863=_0x4b2863-0x0;var _0x567d67=_0xb7e7[_0x4b2863];return _0x567d67;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var moment=require(_0x7b7e('0x1'));var BPromise=require('bluebird');var rs=require(_0x7b7e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7b7e('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x7b7e('0x4'))(_0x7b7e('0x5'));var config=require(_0x7b7e('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7b7e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x372bde,_0x7f87e0,_0x55ce81){return new BPromise(function(_0x42b871,_0x223587){return client[_0x7b7e('0x8')](_0x372bde,_0x55ce81)[_0x7b7e('0x9')](function(_0x148964){logger[_0x7b7e('0xa')](_0x7b7e('0xb'),_0x7f87e0,'request\x20sent');logger[_0x7b7e('0xc')](_0x7b7e('0xd'),_0x7f87e0,_0x7b7e('0xe'),JSON[_0x7b7e('0xf')](_0x148964));if(_0x148964[_0x7b7e('0x10')]){if(_0x148964[_0x7b7e('0x10')][_0x7b7e('0x11')]===0x1f4){logger[_0x7b7e('0x10')](_0x7b7e('0xb'),_0x7f87e0,_0x148964['error'][_0x7b7e('0x12')]);return _0x223587(_0x148964[_0x7b7e('0x10')]['message']);}logger[_0x7b7e('0x10')]('ZendeskAccount,\x20%s,\x20%s',_0x7f87e0,_0x148964['error'][_0x7b7e('0x12')]);return _0x42b871(_0x148964[_0x7b7e('0x10')][_0x7b7e('0x12')]);}else{logger[_0x7b7e('0xa')](_0x7b7e('0xb'),_0x7f87e0,'request\x20sent');_0x42b871(_0x148964['result'][_0x7b7e('0x12')]);}})[_0x7b7e('0x13')](function(_0x27f999){logger[_0x7b7e('0x10')](_0x7b7e('0xb'),_0x7f87e0,_0x27f999);_0x223587(_0x27f999);});});}exports[_0x7b7e('0x14')]=function(_0x242368){var _0x200ef7=this;return new Promise(function(_0x2acb8c,_0x429a0e){return db[_0x7b7e('0x15')][_0x7b7e('0x16')]({'raw':_0x242368[_0x7b7e('0x17')]?_0x242368[_0x7b7e('0x17')][_0x7b7e('0x18')]===undefined?!![]:![]:!![],'where':_0x242368[_0x7b7e('0x17')]?_0x242368[_0x7b7e('0x17')]['where']||null:null,'attributes':_0x242368[_0x7b7e('0x17')]?_0x242368[_0x7b7e('0x17')][_0x7b7e('0x19')]||null:null,'limit':_0x242368['options']?_0x242368[_0x7b7e('0x17')][_0x7b7e('0x1a')]||null:null,'include':_0x242368[_0x7b7e('0x17')]?_0x242368[_0x7b7e('0x17')][_0x7b7e('0x1b')]?_[_0x7b7e('0x1c')](_0x242368[_0x7b7e('0x17')][_0x7b7e('0x1b')],function(_0x53bbb3){return{'model':db[_0x53bbb3['model']],'as':_0x53bbb3['as'],'attributes':_0x53bbb3['attributes'],'include':_0x53bbb3[_0x7b7e('0x1b')]?_[_0x7b7e('0x1c')](_0x53bbb3[_0x7b7e('0x1b')],function(_0x483c6f){return{'model':db[_0x483c6f['model']],'as':_0x483c6f['as'],'attributes':_0x483c6f['attributes'],'include':_0x483c6f[_0x7b7e('0x1b')]?_[_0x7b7e('0x1c')](_0x483c6f[_0x7b7e('0x1b')],function(_0x7aa71){return{'model':db[_0x7aa71[_0x7b7e('0x1d')]],'as':_0x7aa71['as'],'attributes':_0x7aa71['attributes']};}):[]};}):[]};}):[]:[]})[_0x7b7e('0x9')](function(_0x21a15){logger['info']('GetZendeskAccount',_0x242368);logger['debug'](_0x7b7e('0x14'),_0x242368,JSON[_0x7b7e('0xf')](_0x21a15));_0x2acb8c(_0x21a15);})['catch'](function(_0x3db8c4){logger['error'](_0x7b7e('0x14'),_0x3db8c4[_0x7b7e('0x12')],_0x242368);_0x429a0e(_0x200ef7[_0x7b7e('0x10')](0x1f4,_0x3db8c4['message']));});});};exports[_0x7b7e('0x1e')]=function(_0xe31336){var _0x35602a=this;return new Promise(function(_0x326dd2,_0x33f9a1){return db['ZendeskAccount'][_0x7b7e('0x1f')]({'raw':_0xe31336['options']?_0xe31336[_0x7b7e('0x17')][_0x7b7e('0x18')]===undefined?!![]:![]:!![],'where':_0xe31336[_0x7b7e('0x17')]?_0xe31336[_0x7b7e('0x17')][_0x7b7e('0x20')]||null:null,'attributes':_0xe31336[_0x7b7e('0x17')]?_0xe31336[_0x7b7e('0x17')]['attributes']||null:null,'include':_0xe31336['options']?_0xe31336[_0x7b7e('0x17')][_0x7b7e('0x1b')]?_['map'](_0xe31336[_0x7b7e('0x17')][_0x7b7e('0x1b')],function(_0x2ca366){return{'model':db[_0x2ca366['model']],'as':_0x2ca366['as'],'attributes':_0x2ca366[_0x7b7e('0x19')],'include':_0x2ca366[_0x7b7e('0x1b')]?_[_0x7b7e('0x1c')](_0x2ca366[_0x7b7e('0x1b')],function(_0x31043a){return{'model':db[_0x31043a[_0x7b7e('0x1d')]],'as':_0x31043a['as'],'attributes':_0x31043a[_0x7b7e('0x19')],'include':_0x31043a[_0x7b7e('0x1b')]?_[_0x7b7e('0x1c')](_0x31043a[_0x7b7e('0x1b')],function(_0xd5a64d){return{'model':db[_0xd5a64d[_0x7b7e('0x1d')]],'as':_0xd5a64d['as'],'attributes':_0xd5a64d[_0x7b7e('0x19')]};}):[]};}):[]};}):[]:[]})[_0x7b7e('0x9')](function(_0x116563){logger[_0x7b7e('0xa')]('ShowZendeskAccount',_0xe31336);logger[_0x7b7e('0xc')](_0x7b7e('0x1e'),_0xe31336,JSON[_0x7b7e('0xf')](_0x116563));_0x326dd2(_0x116563);})[_0x7b7e('0x13')](function(_0x36abfc){logger[_0x7b7e('0x10')](_0x7b7e('0x1e'),_0x36abfc[_0x7b7e('0x12')],_0xe31336);_0x33f9a1(_0x35602a[_0x7b7e('0x10')](0x1f4,_0x36abfc[_0x7b7e('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 9590a53..d3fc6c1 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 _0x6bf2=['connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','isAuthenticated','index','/:id','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create','setTags','put','update','delete','destroy','exports','multer','util','path'];(function(_0x554e9e,_0xcb21e5){var _0x1ba47c=function(_0x535af9){while(--_0x535af9){_0x554e9e['push'](_0x554e9e['shift']());}};_0x1ba47c(++_0xcb21e5);}(_0x6bf2,0x1ea));var _0x26bf=function(_0x201038,_0x5921df){_0x201038=_0x201038-0x0;var _0x5dc9b0=_0x6bf2[_0x201038];return _0x5dc9b0;};'use strict';var multer=require(_0x26bf('0x0'));var util=require(_0x26bf('0x1'));var path=require(_0x26bf('0x2'));var timeout=require(_0x26bf('0x3'));var express=require(_0x26bf('0x4'));var router=express['Router']();var auth=require(_0x26bf('0x5'));var interaction=require(_0x26bf('0x6'));var config=require(_0x26bf('0x7'));var controller=require(_0x26bf('0x8'));router[_0x26bf('0x9')]('/',auth[_0x26bf('0xa')](),controller[_0x26bf('0xb')]);router[_0x26bf('0x9')](_0x26bf('0xc'),auth[_0x26bf('0xa')](),controller['show']);router[_0x26bf('0x9')](_0x26bf('0xd'),auth[_0x26bf('0xa')](),controller[_0x26bf('0xe')]);router[_0x26bf('0x9')](_0x26bf('0xf'),auth[_0x26bf('0xa')](),controller[_0x26bf('0x10')]);router[_0x26bf('0x9')](_0x26bf('0x11'),auth['isAuthenticated'](),controller[_0x26bf('0x12')]);router['get'](_0x26bf('0x13'),auth[_0x26bf('0xa')](),controller[_0x26bf('0x14')]);router[_0x26bf('0x15')]('/',auth[_0x26bf('0xa')](),controller[_0x26bf('0x16')]);router[_0x26bf('0x15')](_0x26bf('0x13'),auth['isAuthenticated'](),controller[_0x26bf('0x17')]);router[_0x26bf('0x18')]('/:id',auth['isAuthenticated'](),controller[_0x26bf('0x19')]);router[_0x26bf('0x1a')](_0x26bf('0xc'),auth[_0x26bf('0xa')](),controller[_0x26bf('0x1b')]);module[_0x26bf('0x1c')]=router; \ No newline at end of file +var _0x8d10=['./intZendeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','post','create','setTags','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x140c6d,_0x54af36){var _0x40323b=function(_0xa05839){while(--_0xa05839){_0x140c6d['push'](_0x140c6d['shift']());}};_0x40323b(++_0x54af36);}(_0x8d10,0xfc));var _0x08d1=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x8d10[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x08d1('0x0'));var util=require(_0x08d1('0x1'));var path=require(_0x08d1('0x2'));var timeout=require(_0x08d1('0x3'));var express=require(_0x08d1('0x4'));var router=express[_0x08d1('0x5')]();var auth=require(_0x08d1('0x6'));var interaction=require(_0x08d1('0x7'));var config=require(_0x08d1('0x8'));var controller=require(_0x08d1('0x9'));router[_0x08d1('0xa')]('/',auth[_0x08d1('0xb')](),controller[_0x08d1('0xc')]);router[_0x08d1('0xa')](_0x08d1('0xd'),auth[_0x08d1('0xb')](),controller[_0x08d1('0xe')]);router['get'](_0x08d1('0xf'),auth[_0x08d1('0xb')](),controller[_0x08d1('0x10')]);router[_0x08d1('0xa')](_0x08d1('0x11'),auth[_0x08d1('0xb')](),controller[_0x08d1('0x12')]);router[_0x08d1('0xa')](_0x08d1('0x13'),auth[_0x08d1('0xb')](),controller[_0x08d1('0x14')]);router[_0x08d1('0xa')](_0x08d1('0x15'),auth[_0x08d1('0xb')](),controller['getTags']);router[_0x08d1('0x16')]('/',auth[_0x08d1('0xb')](),controller[_0x08d1('0x17')]);router['post'](_0x08d1('0x15'),auth[_0x08d1('0xb')](),controller[_0x08d1('0x18')]);router[_0x08d1('0x19')](_0x08d1('0xd'),auth[_0x08d1('0xb')](),controller['update']);router[_0x08d1('0x1a')](_0x08d1('0xd'),auth[_0x08d1('0xb')](),controller[_0x08d1('0x1b')]);module[_0x08d1('0x1c')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index 5ced57e..8d0ac2d 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 _0x2c16=['sequelize'];(function(_0x410e45,_0x5837f3){var _0x3d24aa=function(_0x108359){while(--_0x108359){_0x410e45['push'](_0x410e45['shift']());}};_0x3d24aa(++_0x5837f3);}(_0x2c16,0x9a));var _0x62c1=function(_0x24d70d,_0x2b6516){_0x24d70d=_0x24d70d-0x0;var _0x29d887=_0x2c16[_0x24d70d];return _0x29d887;};'use strict';var Sequelize=require(_0x62c1('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x364e=['STRING','sequelize','exports'];(function(_0x4dc63a,_0x2b4f2f){var _0xee072b=function(_0x2c0e18){while(--_0x2c0e18){_0x4dc63a['push'](_0x4dc63a['shift']());}};_0xee072b(++_0x2b4f2f);}(_0x364e,0x67));var _0xe364=function(_0x58afd5,_0x534a48){_0x58afd5=_0x58afd5-0x0;var _0x3e503b=_0x364e[_0x58afd5];return _0x3e503b;};'use strict';var Sequelize=require(_0xe364('0x0'));module[_0xe364('0x1')]={'name':{'type':Sequelize[_0xe364('0x2')]},'description':{'type':Sequelize[_0xe364('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index b9c4a46..ac6ef9e 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 _0x9957=['count','offset','set','Content-Range','apply','save','update','name','send','index','ZendeskConfiguration','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','pick','filter','where','merge','type','options','includeAll','findAll','rows','show','params','find','create','body','getFields','findOne','ZendeskField','sort','nolimit','getSubjects','getDescriptions','getTags','setTags','ids','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','jayson/promise','client','http','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','catch','sendStatus','status','end','json'];(function(_0xb42ec7,_0x4a0132){var _0x5824d5=function(_0x3dfd6f){while(--_0x3dfd6f){_0xb42ec7['push'](_0xb42ec7['shift']());}};_0x5824d5(++_0x4a0132);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var pdf=require(_0x7995('0x0'));var emlformat=require(_0x7995('0x1'));var rimraf=require(_0x7995('0x2'));var zipdir=require(_0x7995('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7995('0x4'));var moment=require(_0x7995('0x5'));var BPromise=require(_0x7995('0x6'));var Mustache=require(_0x7995('0x7'));var util=require('util');var path=require(_0x7995('0x8'));var sox=require(_0x7995('0x9'));var csv=require(_0x7995('0xa'));var ejs=require(_0x7995('0xb'));var fs=require('fs');var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var db=require(_0x7995('0x19'))['db'];var jayson=require(_0x7995('0x1a'));var client=jayson[_0x7995('0x1b')][_0x7995('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x281576,_0x23999f,_0x2bbe7a){if(_0x2bbe7a){var _0x4cc004=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4cc004['test'](_0x23999f)){return _0x281576;}else{throw new db[(_0x7995('0x1d'))][(_0x7995('0x1e'))](_0x7995('0x1f'));}}else{return _0x281576;}}function respondWithRpcPromise(_0x321ae8,_0x3f1d3e,_0x1a5310,_0x2202ce){return new BPromise(function(_0x41cbf0,_0x5377e5){var _0x2eeacc=_0x2202ce||client;return _0x2eeacc['request'](_0x321ae8,_0x1a5310)[_0x7995('0x20')](function(_0x37f297){logger[_0x7995('0x21')](_0x7995('0x22'),_0x3f1d3e,_0x7995('0x23'));logger[_0x7995('0x24')]('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0x3f1d3e,'request\x20sent',JSON[_0x7995('0x25')](_0x37f297));if(_0x37f297['error']){if(_0x37f297['error'][_0x7995('0x26')]===0x1f4){logger[_0x7995('0x27')]('ZendeskConfiguration,\x20%s,\x20%s',_0x3f1d3e,_0x37f297[_0x7995('0x27')]['message']);return _0x5377e5(_0x37f297['error'][_0x7995('0x28')]);}logger[_0x7995('0x27')](_0x7995('0x22'),_0x3f1d3e,_0x37f297[_0x7995('0x27')][_0x7995('0x28')]);return _0x41cbf0(_0x37f297[_0x7995('0x27')]['message']);}else{logger[_0x7995('0x21')](_0x7995('0x22'),_0x3f1d3e,_0x7995('0x23'));_0x41cbf0(_0x37f297[_0x7995('0x29')][_0x7995('0x28')]);}})[_0x7995('0x2a')](function(_0x475351){logger[_0x7995('0x27')]('ZendeskConfiguration,\x20%s,\x20%s',_0x3f1d3e,_0x475351);_0x5377e5(_0x475351);});});}function respondWithStatusCode(_0x39df42,_0x34e70c){_0x34e70c=_0x34e70c||0xcc;return function(_0x401dc3){if(_0x401dc3){return _0x39df42[_0x7995('0x2b')](_0x34e70c);}return _0x39df42[_0x7995('0x2c')](_0x34e70c)[_0x7995('0x2d')]();};}function respondWithResult(_0x56691a,_0x47625f){_0x47625f=_0x47625f||0xc8;return function(_0x5911c3){if(_0x5911c3){return _0x56691a[_0x7995('0x2c')](_0x47625f)[_0x7995('0x2e')](_0x5911c3);}};}function respondWithFilteredResult(_0xf16cc2,_0x132a42){return function(_0x11c1eb){if(_0x11c1eb){var _0x4b6f99=_0x11c1eb[_0x7995('0x2f')],_0x9b2a15=_0x132a42[_0x7995('0x30')],_0x514445=_0x132a42['offset']+_0x132a42['limit'],_0x456a28;if(_0x514445>=_0x4b6f99){_0x514445=_0x4b6f99;_0x456a28=0xc8;}else{_0x456a28=0xce;}_0xf16cc2['status'](_0x456a28);return _0xf16cc2[_0x7995('0x31')](_0x7995('0x32'),_0x9b2a15+'-'+_0x514445+'/'+_0x4b6f99)[_0x7995('0x2e')](_0x11c1eb);}return null;};}function patchUpdates(_0x2b874d){return function(_0x2e3493){try{jsonpatch[_0x7995('0x33')](_0x2e3493,_0x2b874d,!![]);}catch(_0x538841){return BPromise['reject'](_0x538841);}return _0x2e3493[_0x7995('0x34')]();};}function saveUpdates(_0x5524af,_0x553671){return function(_0x3eb566){if(_0x3eb566){return _0x3eb566[_0x7995('0x35')](_0x5524af)[_0x7995('0x20')](function(_0x1f7d27){return _0x1f7d27;});}return null;};}function removeEntity(_0x510841,_0x44309d){return function(_0x33e24e){if(_0x33e24e){return _0x33e24e['destroy']()['then'](function(){_0x510841['status'](0xcc)[_0x7995('0x2d')]();});}};}function handleEntityNotFound(_0x3acfc3,_0x4a176f){return function(_0x3e7020){if(!_0x3e7020){_0x3acfc3['sendStatus'](0x194);}return _0x3e7020;};}function handleError(_0x37917b,_0x1cb058){_0x1cb058=_0x1cb058||0x1f4;return function(_0x177cb4){logger['error'](_0x177cb4['stack']);if(_0x177cb4[_0x7995('0x36')]){delete _0x177cb4['name'];}_0x37917b['status'](_0x1cb058)[_0x7995('0x37')](_0x177cb4);};}exports[_0x7995('0x38')]=function(_0x5212ff,_0x1baa15){var _0x1922b4={},_0x2b772f={},_0x18667c={'count':0x0,'rows':[]};var _0x1e3dbf=_['map'](db[_0x7995('0x39')][_0x7995('0x3a')],function(_0xf612e6){return{'name':_0xf612e6[_0x7995('0x3b')],'type':_0xf612e6['type'][_0x7995('0x3c')]};});_0x2b772f[_0x7995('0x3d')]=_[_0x7995('0x3e')](_0x1e3dbf,_0x7995('0x36'));_0x2b772f[_0x7995('0x3f')]=_[_0x7995('0x40')](_0x5212ff['query']);_0x2b772f[_0x7995('0x41')]=_[_0x7995('0x42')](_0x2b772f[_0x7995('0x3d')],_0x2b772f[_0x7995('0x3f')]);_0x1922b4[_0x7995('0x43')]=_[_0x7995('0x42')](_0x2b772f[_0x7995('0x3d')],qs[_0x7995('0x44')](_0x5212ff[_0x7995('0x3f')][_0x7995('0x44')]));_0x1922b4[_0x7995('0x43')]=_0x1922b4[_0x7995('0x43')][_0x7995('0x45')]?_0x1922b4['attributes']:_0x2b772f['model'];if(!_0x5212ff[_0x7995('0x3f')][_0x7995('0x46')]('nolimit')){_0x1922b4['limit']=qs[_0x7995('0x47')](_0x5212ff['query']['limit']);_0x1922b4[_0x7995('0x30')]=qs[_0x7995('0x30')](_0x5212ff[_0x7995('0x3f')]['offset']);}_0x1922b4[_0x7995('0x48')]=qs['sort'](_0x5212ff[_0x7995('0x3f')]['sort']);_0x1922b4['where']=qs[_0x7995('0x41')](_[_0x7995('0x49')](_0x5212ff[_0x7995('0x3f')],_0x2b772f[_0x7995('0x41')]));if(_0x5212ff['query'][_0x7995('0x4a')]){_0x1922b4[_0x7995('0x4b')]=_[_0x7995('0x4c')](_0x1922b4[_0x7995('0x4b')],{'$or':_['map'](_0x1e3dbf,function(_0x5f28e7){if(_0x5f28e7[_0x7995('0x4d')]!=='VIRTUAL'){var _0x23c41d={};_0x23c41d[_0x5f28e7['name']]={'$like':'%'+_0x5212ff[_0x7995('0x3f')]['filter']+'%'};return _0x23c41d;}})});}_0x1922b4=_[_0x7995('0x4c')]({},_0x1922b4,_0x5212ff[_0x7995('0x4e')]);var _0x4d9245={'where':_0x1922b4[_0x7995('0x4b')]};return db[_0x7995('0x39')][_0x7995('0x2f')](_0x4d9245)[_0x7995('0x20')](function(_0x4c6837){_0x18667c[_0x7995('0x2f')]=_0x4c6837;if(_0x5212ff[_0x7995('0x3f')][_0x7995('0x4f')]){_0x1922b4['include']=[{'all':!![]}];}return db[_0x7995('0x39')][_0x7995('0x50')](_0x1922b4);})[_0x7995('0x20')](function(_0x3d8ae3){_0x18667c[_0x7995('0x51')]=_0x3d8ae3;return _0x18667c;})['then'](respondWithFilteredResult(_0x1baa15,_0x1922b4))[_0x7995('0x2a')](handleError(_0x1baa15,null));};exports[_0x7995('0x52')]=function(_0x5921b9,_0x3d1dbb){var _0x5843ba={'raw':![],'where':{'id':_0x5921b9[_0x7995('0x53')]['id']}},_0x1d87f9={};_0x1d87f9[_0x7995('0x3d')]=_[_0x7995('0x40')](db[_0x7995('0x39')][_0x7995('0x3a')]);_0x1d87f9[_0x7995('0x3f')]=_['keys'](_0x5921b9[_0x7995('0x3f')]);_0x1d87f9[_0x7995('0x41')]=_[_0x7995('0x42')](_0x1d87f9['model'],_0x1d87f9[_0x7995('0x3f')]);_0x5843ba[_0x7995('0x43')]=_[_0x7995('0x42')](_0x1d87f9['model'],qs['fields'](_0x5921b9['query'][_0x7995('0x44')]));_0x5843ba[_0x7995('0x43')]=_0x5843ba['attributes'][_0x7995('0x45')]?_0x5843ba[_0x7995('0x43')]:_0x1d87f9[_0x7995('0x3d')];if(_0x5921b9[_0x7995('0x3f')][_0x7995('0x4f')]){_0x5843ba['include']=[{'all':!![]}];}_0x5843ba=_[_0x7995('0x4c')]({},_0x5843ba,_0x5921b9['options']);return db[_0x7995('0x39')][_0x7995('0x54')](_0x5843ba)[_0x7995('0x20')](handleEntityNotFound(_0x3d1dbb,null))['then'](respondWithResult(_0x3d1dbb,null))['catch'](handleError(_0x3d1dbb,null));};exports['create']=function(_0x563f8e,_0x2e13b0){return db[_0x7995('0x39')][_0x7995('0x55')](_0x563f8e[_0x7995('0x56')],{})[_0x7995('0x20')](respondWithResult(_0x2e13b0,0xc9))[_0x7995('0x2a')](handleError(_0x2e13b0,null));};exports[_0x7995('0x35')]=function(_0xda6ce8,_0x328671){if(_0xda6ce8[_0x7995('0x56')]['id']){delete _0xda6ce8[_0x7995('0x56')]['id'];}return db[_0x7995('0x39')][_0x7995('0x54')]({'where':{'id':_0xda6ce8[_0x7995('0x53')]['id']}})[_0x7995('0x20')](handleEntityNotFound(_0x328671,null))[_0x7995('0x20')](saveUpdates(_0xda6ce8[_0x7995('0x56')],null))[_0x7995('0x20')](respondWithResult(_0x328671,null))[_0x7995('0x2a')](handleError(_0x328671,null));};exports['destroy']=function(_0x56a374,_0x630737){return db[_0x7995('0x39')][_0x7995('0x54')]({'where':{'id':_0x56a374['params']['id']}})['then'](handleEntityNotFound(_0x630737,null))[_0x7995('0x20')](removeEntity(_0x630737,null))[_0x7995('0x2a')](handleError(_0x630737,null));};exports[_0x7995('0x57')]=function(_0x332a85,_0x51c50b,_0x13cd7b){var _0x74ff38={};var _0xef5044={};var _0x33c49c;var _0x502d43;return db['ZendeskConfiguration'][_0x7995('0x58')]({'where':{'id':_0x332a85[_0x7995('0x53')]['id']}})[_0x7995('0x20')](handleEntityNotFound(_0x51c50b,null))[_0x7995('0x20')](function(_0x37072){if(_0x37072){_0x33c49c=_0x37072;_0xef5044[_0x7995('0x3d')]=_[_0x7995('0x40')](db[_0x7995('0x59')][_0x7995('0x3a')]);_0xef5044['query']=_[_0x7995('0x40')](_0x332a85[_0x7995('0x3f')]);_0xef5044[_0x7995('0x41')]=_[_0x7995('0x42')](_0xef5044['model'],_0xef5044['query']);_0x74ff38[_0x7995('0x43')]=_[_0x7995('0x42')](_0xef5044['model'],qs[_0x7995('0x44')](_0x332a85[_0x7995('0x3f')][_0x7995('0x44')]));_0x74ff38[_0x7995('0x43')]=_0x74ff38[_0x7995('0x43')]['length']?_0x74ff38[_0x7995('0x43')]:_0xef5044['model'];_0x74ff38[_0x7995('0x48')]=qs[_0x7995('0x5a')](_0x332a85[_0x7995('0x3f')][_0x7995('0x5a')]);_0x74ff38[_0x7995('0x4b')]=qs[_0x7995('0x41')](_[_0x7995('0x49')](_0x332a85[_0x7995('0x3f')],_0xef5044[_0x7995('0x41')]));if(_0x332a85[_0x7995('0x3f')][_0x7995('0x4a')]){_0x74ff38[_0x7995('0x4b')]=_['merge'](_0x74ff38[_0x7995('0x4b')],{'$or':_[_0x7995('0x3e')](_0x74ff38[_0x7995('0x43')],function(_0xc2b660){var _0x2c6548={};_0x2c6548[_0xc2b660]={'$like':'%'+_0x332a85['query']['filter']+'%'};return _0x2c6548;})});}_0x74ff38=_[_0x7995('0x4c')]({},_0x74ff38,_0x332a85[_0x7995('0x4e')]);return _0x33c49c[_0x7995('0x57')](_0x74ff38);}})[_0x7995('0x20')](function(_0x5aa2ec){if(_0x5aa2ec){_0x502d43=_0x5aa2ec[_0x7995('0x45')];if(!_0x332a85['query']['hasOwnProperty'](_0x7995('0x5b'))){_0x74ff38[_0x7995('0x47')]=qs[_0x7995('0x47')](_0x332a85[_0x7995('0x3f')][_0x7995('0x47')]);_0x74ff38[_0x7995('0x30')]=qs[_0x7995('0x30')](_0x332a85[_0x7995('0x3f')][_0x7995('0x30')]);}return _0x33c49c[_0x7995('0x57')](_0x74ff38);}})['then'](function(_0x2dc1f7){if(_0x2dc1f7){return _0x2dc1f7?{'count':_0x502d43,'rows':_0x2dc1f7}:null;}})[_0x7995('0x20')](respondWithResult(_0x51c50b,null))[_0x7995('0x2a')](handleError(_0x51c50b,null));};exports['getSubjects']=function(_0x1fe1cb,_0x1d2f9d,_0x705f0){var _0x3a7d9d={};var _0x3b0d30={};var _0x51ab1e;var _0x550a10;return db[_0x7995('0x39')][_0x7995('0x58')]({'where':{'id':_0x1fe1cb[_0x7995('0x53')]['id']}})[_0x7995('0x20')](handleEntityNotFound(_0x1d2f9d,null))['then'](function(_0x5e8b4c){if(_0x5e8b4c){_0x51ab1e=_0x5e8b4c;_0x3b0d30[_0x7995('0x3d')]=_[_0x7995('0x40')](db[_0x7995('0x59')][_0x7995('0x3a')]);_0x3b0d30['query']=_[_0x7995('0x40')](_0x1fe1cb[_0x7995('0x3f')]);_0x3b0d30['filters']=_['intersection'](_0x3b0d30[_0x7995('0x3d')],_0x3b0d30[_0x7995('0x3f')]);_0x3a7d9d['attributes']=_[_0x7995('0x42')](_0x3b0d30['model'],qs[_0x7995('0x44')](_0x1fe1cb[_0x7995('0x3f')]['fields']));_0x3a7d9d['attributes']=_0x3a7d9d[_0x7995('0x43')]['length']?_0x3a7d9d[_0x7995('0x43')]:_0x3b0d30[_0x7995('0x3d')];_0x3a7d9d[_0x7995('0x48')]=qs[_0x7995('0x5a')](_0x1fe1cb[_0x7995('0x3f')][_0x7995('0x5a')]);_0x3a7d9d[_0x7995('0x4b')]=qs[_0x7995('0x41')](_[_0x7995('0x49')](_0x1fe1cb[_0x7995('0x3f')],_0x3b0d30[_0x7995('0x41')]));if(_0x1fe1cb[_0x7995('0x3f')][_0x7995('0x4a')]){_0x3a7d9d[_0x7995('0x4b')]=_[_0x7995('0x4c')](_0x3a7d9d[_0x7995('0x4b')],{'$or':_[_0x7995('0x3e')](_0x3a7d9d[_0x7995('0x43')],function(_0x2ff7ba){var _0xa2fc8e={};_0xa2fc8e[_0x2ff7ba]={'$like':'%'+_0x1fe1cb[_0x7995('0x3f')][_0x7995('0x4a')]+'%'};return _0xa2fc8e;})});}_0x3a7d9d=_[_0x7995('0x4c')]({},_0x3a7d9d,_0x1fe1cb[_0x7995('0x4e')]);return _0x51ab1e[_0x7995('0x5c')](_0x3a7d9d);}})[_0x7995('0x20')](function(_0x2f7f51){if(_0x2f7f51){_0x550a10=_0x2f7f51[_0x7995('0x45')];if(!_0x1fe1cb['query'][_0x7995('0x46')](_0x7995('0x5b'))){_0x3a7d9d['limit']=qs['limit'](_0x1fe1cb[_0x7995('0x3f')][_0x7995('0x47')]);_0x3a7d9d[_0x7995('0x30')]=qs[_0x7995('0x30')](_0x1fe1cb[_0x7995('0x3f')][_0x7995('0x30')]);}return _0x51ab1e['getSubjects'](_0x3a7d9d);}})[_0x7995('0x20')](function(_0xb68962){if(_0xb68962){return _0xb68962?{'count':_0x550a10,'rows':_0xb68962}:null;}})[_0x7995('0x20')](respondWithResult(_0x1d2f9d,null))[_0x7995('0x2a')](handleError(_0x1d2f9d,null));};exports[_0x7995('0x5d')]=function(_0x3f0bff,_0x151d99,_0xc93dcb){var _0x560095={};var _0x1c8e7d={};var _0x2b8217;var _0x5c04c9;return db['ZendeskConfiguration'][_0x7995('0x58')]({'where':{'id':_0x3f0bff[_0x7995('0x53')]['id']}})[_0x7995('0x20')](handleEntityNotFound(_0x151d99,null))[_0x7995('0x20')](function(_0xe42797){if(_0xe42797){_0x2b8217=_0xe42797;_0x1c8e7d['model']=_[_0x7995('0x40')](db[_0x7995('0x59')]['rawAttributes']);_0x1c8e7d[_0x7995('0x3f')]=_[_0x7995('0x40')](_0x3f0bff['query']);_0x1c8e7d[_0x7995('0x41')]=_['intersection'](_0x1c8e7d[_0x7995('0x3d')],_0x1c8e7d[_0x7995('0x3f')]);_0x560095[_0x7995('0x43')]=_[_0x7995('0x42')](_0x1c8e7d[_0x7995('0x3d')],qs['fields'](_0x3f0bff[_0x7995('0x3f')][_0x7995('0x44')]));_0x560095[_0x7995('0x43')]=_0x560095['attributes'][_0x7995('0x45')]?_0x560095[_0x7995('0x43')]:_0x1c8e7d[_0x7995('0x3d')];_0x560095[_0x7995('0x48')]=qs['sort'](_0x3f0bff[_0x7995('0x3f')][_0x7995('0x5a')]);_0x560095[_0x7995('0x4b')]=qs['filters'](_['pick'](_0x3f0bff[_0x7995('0x3f')],_0x1c8e7d[_0x7995('0x41')]));if(_0x3f0bff['query']['filter']){_0x560095[_0x7995('0x4b')]=_[_0x7995('0x4c')](_0x560095[_0x7995('0x4b')],{'$or':_[_0x7995('0x3e')](_0x560095[_0x7995('0x43')],function(_0x551b5e){var _0x56003d={};_0x56003d[_0x551b5e]={'$like':'%'+_0x3f0bff[_0x7995('0x3f')]['filter']+'%'};return _0x56003d;})});}_0x560095=_['merge']({},_0x560095,_0x3f0bff[_0x7995('0x4e')]);return _0x2b8217[_0x7995('0x5d')](_0x560095);}})[_0x7995('0x20')](function(_0x5eb360){if(_0x5eb360){_0x5c04c9=_0x5eb360[_0x7995('0x45')];if(!_0x3f0bff[_0x7995('0x3f')][_0x7995('0x46')](_0x7995('0x5b'))){_0x560095[_0x7995('0x47')]=qs['limit'](_0x3f0bff[_0x7995('0x3f')][_0x7995('0x47')]);_0x560095[_0x7995('0x30')]=qs[_0x7995('0x30')](_0x3f0bff['query'][_0x7995('0x30')]);}return _0x2b8217[_0x7995('0x5d')](_0x560095);}})['then'](function(_0x310272){if(_0x310272){return _0x310272?{'count':_0x5c04c9,'rows':_0x310272}:null;}})[_0x7995('0x20')](respondWithResult(_0x151d99,null))['catch'](handleError(_0x151d99,null));};exports[_0x7995('0x5e')]=function(_0x50efab,_0x1b4b34,_0x51e7d7){var _0x21f496={};var _0x4d12fd={};var _0xa97c08;var _0x20f48c;return db['ZendeskConfiguration'][_0x7995('0x58')]({'where':{'id':_0x50efab['params']['id']}})['then'](handleEntityNotFound(_0x1b4b34,null))[_0x7995('0x20')](function(_0x14812d){if(_0x14812d){_0xa97c08=_0x14812d;_0x4d12fd[_0x7995('0x3d')]=_[_0x7995('0x40')](db['Tag'][_0x7995('0x3a')]);_0x4d12fd[_0x7995('0x3f')]=_['keys'](_0x50efab['query']);_0x4d12fd[_0x7995('0x41')]=_['intersection'](_0x4d12fd[_0x7995('0x3d')],_0x4d12fd[_0x7995('0x3f')]);_0x21f496[_0x7995('0x43')]=_['intersection'](_0x4d12fd['model'],qs[_0x7995('0x44')](_0x50efab['query'][_0x7995('0x44')]));_0x21f496[_0x7995('0x43')]=_0x21f496[_0x7995('0x43')][_0x7995('0x45')]?_0x21f496['attributes']:_0x4d12fd['model'];_0x21f496['order']=qs[_0x7995('0x5a')](_0x50efab[_0x7995('0x3f')][_0x7995('0x5a')]);_0x21f496[_0x7995('0x4b')]=qs[_0x7995('0x41')](_[_0x7995('0x49')](_0x50efab['query'],_0x4d12fd['filters']));if(_0x50efab[_0x7995('0x3f')]['filter']){_0x21f496['where']=_[_0x7995('0x4c')](_0x21f496['where'],{'$or':_['map'](_0x21f496[_0x7995('0x43')],function(_0x3541d7){var _0x3873f3={};_0x3873f3[_0x3541d7]={'$like':'%'+_0x50efab['query'][_0x7995('0x4a')]+'%'};return _0x3873f3;})});}_0x21f496=_[_0x7995('0x4c')]({},_0x21f496,_0x50efab[_0x7995('0x4e')]);return _0xa97c08[_0x7995('0x5e')](_0x21f496);}})[_0x7995('0x20')](function(_0x178746){if(_0x178746){_0x20f48c=_0x178746[_0x7995('0x45')];if(!_0x50efab[_0x7995('0x3f')][_0x7995('0x46')]('nolimit')){_0x21f496[_0x7995('0x47')]=qs[_0x7995('0x47')](_0x50efab[_0x7995('0x3f')][_0x7995('0x47')]);_0x21f496[_0x7995('0x30')]=qs['offset'](_0x50efab[_0x7995('0x3f')][_0x7995('0x30')]);}return _0xa97c08[_0x7995('0x5e')](_0x21f496);}})['then'](function(_0x4c554d){if(_0x4c554d){return _0x4c554d?{'count':_0x20f48c,'rows':_0x4c554d}:null;}})['then'](respondWithResult(_0x1b4b34,null))[_0x7995('0x2a')](handleError(_0x1b4b34,null));};exports[_0x7995('0x5f')]=function(_0x9daa49,_0x1d52cf,_0x16a94d){if(_0x9daa49[_0x7995('0x56')]['id']){delete _0x9daa49['body']['id'];}return db[_0x7995('0x39')]['findOne']({'where':{'id':_0x9daa49[_0x7995('0x53')]['id']}})[_0x7995('0x20')](handleEntityNotFound(_0x1d52cf,null))[_0x7995('0x20')](function(_0x2cc9a4){if(_0x2cc9a4){return _0x2cc9a4[_0x7995('0x5f')](_0x9daa49[_0x7995('0x56')][_0x7995('0x60')]||[]);}return null;})[_0x7995('0x20')](respondWithResult(_0x1d52cf,null))[_0x7995('0x2a')](handleError(_0x1d52cf,null));}; \ No newline at end of file +var _0xc4aa=['ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','sendStatus','status','end','json','offset','limit','Content-Range','apply','reject','update','destroy','stack','send','index','map','ZendeskConfiguration','fieldName','type','model','keys','query','attributes','intersection','fields','length','order','sort','where','filters','pick','filter','merge','VIRTUAL','name','options','count','includeAll','rows','show','rawAttributes','include','create','body','find','params','getFields','ZendeskField','getSubjects','hasOwnProperty','nolimit','getDescriptions','findOne','getTags','setTags','ids','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../mysqldb','jayson/promise','client','test','Sequelize'];(function(_0x4c94d1,_0x573a4f){var _0x48c2c3=function(_0x326bcc){while(--_0x326bcc){_0x4c94d1['push'](_0x4c94d1['shift']());}};_0x48c2c3(++_0x573a4f);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xc4aa[_0x42cae2];return _0x5f256f;};'use strict';var pdf=require(_0xac4a('0x0'));var emlformat=require(_0xac4a('0x1'));var rimraf=require(_0xac4a('0x2'));var zipdir=require(_0xac4a('0x3'));var jsonpatch=require(_0xac4a('0x4'));var rp=require(_0xac4a('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xac4a('0x6'));var path=require(_0xac4a('0x7'));var sox=require(_0xac4a('0x8'));var csv=require(_0xac4a('0x9'));var ejs=require(_0xac4a('0xa'));var fs=require('fs');var _=require(_0xac4a('0xb'));var squel=require(_0xac4a('0xc'));var crypto=require(_0xac4a('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xac4a('0x9'));var querystring=require(_0xac4a('0xe'));var Papa=require(_0xac4a('0xf'));var Redis=require('ioredis');var authService=require(_0xac4a('0x10'));var qs=require(_0xac4a('0x11'));var as=require(_0xac4a('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xac4a('0x13'))('api');var utils=require(_0xac4a('0x14'));var config=require('../../config/environment');var db=require(_0xac4a('0x15'))['db'];var jayson=require(_0xac4a('0x16'));var client=jayson[_0xac4a('0x17')]['http']({'port':0x232a});function checkPasswordPattern(_0x21a79,_0x68424a,_0x247b78){if(_0x247b78){var _0x6e00d4=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x6e00d4[_0xac4a('0x18')](_0x68424a)){return _0x21a79;}else{throw new db[(_0xac4a('0x19'))][(_0xac4a('0x1a'))](_0xac4a('0x1b'));}}else{return _0x21a79;}}function respondWithRpcPromise(_0x190418,_0x42c7fc,_0x11e101,_0x26dbb8){return new BPromise(function(_0x4a2119,_0x402fff){var _0x34d797=_0x26dbb8||client;return _0x34d797[_0xac4a('0x1c')](_0x190418,_0x11e101)[_0xac4a('0x1d')](function(_0x3e88e3){logger[_0xac4a('0x1e')](_0xac4a('0x1f'),_0x42c7fc,_0xac4a('0x20'));logger['debug']('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0x42c7fc,_0xac4a('0x20'),JSON[_0xac4a('0x21')](_0x3e88e3));if(_0x3e88e3[_0xac4a('0x22')]){if(_0x3e88e3['error'][_0xac4a('0x23')]===0x1f4){logger[_0xac4a('0x22')](_0xac4a('0x1f'),_0x42c7fc,_0x3e88e3[_0xac4a('0x22')][_0xac4a('0x24')]);return _0x402fff(_0x3e88e3[_0xac4a('0x22')][_0xac4a('0x24')]);}logger[_0xac4a('0x22')]('ZendeskConfiguration,\x20%s,\x20%s',_0x42c7fc,_0x3e88e3[_0xac4a('0x22')][_0xac4a('0x24')]);return _0x4a2119(_0x3e88e3['error'][_0xac4a('0x24')]);}else{logger[_0xac4a('0x1e')](_0xac4a('0x1f'),_0x42c7fc,_0xac4a('0x20'));_0x4a2119(_0x3e88e3['result'][_0xac4a('0x24')]);}})[_0xac4a('0x25')](function(_0x15435c){logger[_0xac4a('0x22')](_0xac4a('0x1f'),_0x42c7fc,_0x15435c);_0x402fff(_0x15435c);});});}function respondWithStatusCode(_0x2b0dc2,_0x222507){_0x222507=_0x222507||0xcc;return function(_0x36054a){if(_0x36054a){return _0x2b0dc2[_0xac4a('0x26')](_0x222507);}return _0x2b0dc2[_0xac4a('0x27')](_0x222507)[_0xac4a('0x28')]();};}function respondWithResult(_0x215a31,_0x14832b){_0x14832b=_0x14832b||0xc8;return function(_0x472c57){if(_0x472c57){return _0x215a31[_0xac4a('0x27')](_0x14832b)[_0xac4a('0x29')](_0x472c57);}};}function respondWithFilteredResult(_0x4e17ce,_0x23b061){return function(_0x267a22){if(_0x267a22){var _0x42a33c=_0x267a22['count'],_0x2772fe=_0x23b061[_0xac4a('0x2a')],_0x116700=_0x23b061[_0xac4a('0x2a')]+_0x23b061[_0xac4a('0x2b')],_0x4a5a9e;if(_0x116700>=_0x42a33c){_0x116700=_0x42a33c;_0x4a5a9e=0xc8;}else{_0x4a5a9e=0xce;}_0x4e17ce['status'](_0x4a5a9e);return _0x4e17ce['set'](_0xac4a('0x2c'),_0x2772fe+'-'+_0x116700+'/'+_0x42a33c)[_0xac4a('0x29')](_0x267a22);}return null;};}function patchUpdates(_0x228629){return function(_0x432066){try{jsonpatch[_0xac4a('0x2d')](_0x432066,_0x228629,!![]);}catch(_0x53d3a5){return BPromise[_0xac4a('0x2e')](_0x53d3a5);}return _0x432066['save']();};}function saveUpdates(_0x30364b,_0x57adcf){return function(_0x17e6de){if(_0x17e6de){return _0x17e6de[_0xac4a('0x2f')](_0x30364b)[_0xac4a('0x1d')](function(_0x228aa7){return _0x228aa7;});}return null;};}function removeEntity(_0x34577f,_0x61e552){return function(_0xbd4591){if(_0xbd4591){return _0xbd4591[_0xac4a('0x30')]()[_0xac4a('0x1d')](function(){_0x34577f[_0xac4a('0x27')](0xcc)[_0xac4a('0x28')]();});}};}function handleEntityNotFound(_0x1634df,_0x1a9be2){return function(_0x1a9d4e){if(!_0x1a9d4e){_0x1634df['sendStatus'](0x194);}return _0x1a9d4e;};}function handleError(_0x30442d,_0x1c41fb){_0x1c41fb=_0x1c41fb||0x1f4;return function(_0x5a4e2b){logger[_0xac4a('0x22')](_0x5a4e2b[_0xac4a('0x31')]);if(_0x5a4e2b['name']){delete _0x5a4e2b['name'];}_0x30442d[_0xac4a('0x27')](_0x1c41fb)[_0xac4a('0x32')](_0x5a4e2b);};}exports[_0xac4a('0x33')]=function(_0x3de9e2,_0x4f5986){var _0x453d02={},_0x2e56c6={},_0x4e7630={'count':0x0,'rows':[]};var _0x37f2ee=_[_0xac4a('0x34')](db[_0xac4a('0x35')]['rawAttributes'],function(_0x121328){return{'name':_0x121328[_0xac4a('0x36')],'type':_0x121328[_0xac4a('0x37')]['key']};});_0x2e56c6[_0xac4a('0x38')]=_[_0xac4a('0x34')](_0x37f2ee,'name');_0x2e56c6['query']=_[_0xac4a('0x39')](_0x3de9e2['query']);_0x2e56c6['filters']=_['intersection'](_0x2e56c6['model'],_0x2e56c6[_0xac4a('0x3a')]);_0x453d02[_0xac4a('0x3b')]=_[_0xac4a('0x3c')](_0x2e56c6[_0xac4a('0x38')],qs[_0xac4a('0x3d')](_0x3de9e2[_0xac4a('0x3a')][_0xac4a('0x3d')]));_0x453d02[_0xac4a('0x3b')]=_0x453d02[_0xac4a('0x3b')][_0xac4a('0x3e')]?_0x453d02[_0xac4a('0x3b')]:_0x2e56c6[_0xac4a('0x38')];if(!_0x3de9e2['query']['hasOwnProperty']('nolimit')){_0x453d02[_0xac4a('0x2b')]=qs[_0xac4a('0x2b')](_0x3de9e2[_0xac4a('0x3a')][_0xac4a('0x2b')]);_0x453d02[_0xac4a('0x2a')]=qs[_0xac4a('0x2a')](_0x3de9e2[_0xac4a('0x3a')][_0xac4a('0x2a')]);}_0x453d02[_0xac4a('0x3f')]=qs[_0xac4a('0x40')](_0x3de9e2['query'][_0xac4a('0x40')]);_0x453d02[_0xac4a('0x41')]=qs[_0xac4a('0x42')](_[_0xac4a('0x43')](_0x3de9e2[_0xac4a('0x3a')],_0x2e56c6['filters']));if(_0x3de9e2[_0xac4a('0x3a')][_0xac4a('0x44')]){_0x453d02['where']=_[_0xac4a('0x45')](_0x453d02['where'],{'$or':_[_0xac4a('0x34')](_0x37f2ee,function(_0x65494e){if(_0x65494e[_0xac4a('0x37')]!==_0xac4a('0x46')){var _0x520e4a={};_0x520e4a[_0x65494e[_0xac4a('0x47')]]={'$like':'%'+_0x3de9e2[_0xac4a('0x3a')][_0xac4a('0x44')]+'%'};return _0x520e4a;}})});}_0x453d02=_[_0xac4a('0x45')]({},_0x453d02,_0x3de9e2[_0xac4a('0x48')]);var _0x4fa9eb={'where':_0x453d02[_0xac4a('0x41')]};return db['ZendeskConfiguration'][_0xac4a('0x49')](_0x4fa9eb)[_0xac4a('0x1d')](function(_0xeca4e9){_0x4e7630['count']=_0xeca4e9;if(_0x3de9e2[_0xac4a('0x3a')][_0xac4a('0x4a')]){_0x453d02['include']=[{'all':!![]}];}return db[_0xac4a('0x35')]['findAll'](_0x453d02);})[_0xac4a('0x1d')](function(_0xe620f6){_0x4e7630[_0xac4a('0x4b')]=_0xe620f6;return _0x4e7630;})['then'](respondWithFilteredResult(_0x4f5986,_0x453d02))['catch'](handleError(_0x4f5986,null));};exports[_0xac4a('0x4c')]=function(_0x4aaeff,_0x18ae96){var _0x566258={'raw':![],'where':{'id':_0x4aaeff['params']['id']}},_0x3d2aaf={};_0x3d2aaf[_0xac4a('0x38')]=_[_0xac4a('0x39')](db[_0xac4a('0x35')][_0xac4a('0x4d')]);_0x3d2aaf['query']=_[_0xac4a('0x39')](_0x4aaeff[_0xac4a('0x3a')]);_0x3d2aaf[_0xac4a('0x42')]=_[_0xac4a('0x3c')](_0x3d2aaf[_0xac4a('0x38')],_0x3d2aaf[_0xac4a('0x3a')]);_0x566258[_0xac4a('0x3b')]=_['intersection'](_0x3d2aaf[_0xac4a('0x38')],qs[_0xac4a('0x3d')](_0x4aaeff['query'][_0xac4a('0x3d')]));_0x566258[_0xac4a('0x3b')]=_0x566258[_0xac4a('0x3b')][_0xac4a('0x3e')]?_0x566258['attributes']:_0x3d2aaf[_0xac4a('0x38')];if(_0x4aaeff[_0xac4a('0x3a')][_0xac4a('0x4a')]){_0x566258[_0xac4a('0x4e')]=[{'all':!![]}];}_0x566258=_[_0xac4a('0x45')]({},_0x566258,_0x4aaeff['options']);return db[_0xac4a('0x35')]['find'](_0x566258)[_0xac4a('0x1d')](handleEntityNotFound(_0x18ae96,null))[_0xac4a('0x1d')](respondWithResult(_0x18ae96,null))['catch'](handleError(_0x18ae96,null));};exports['create']=function(_0x437466,_0x70fdc3){return db['ZendeskConfiguration'][_0xac4a('0x4f')](_0x437466[_0xac4a('0x50')],{})[_0xac4a('0x1d')](respondWithResult(_0x70fdc3,0xc9))[_0xac4a('0x25')](handleError(_0x70fdc3,null));};exports['update']=function(_0x3057d6,_0x108f7c){if(_0x3057d6[_0xac4a('0x50')]['id']){delete _0x3057d6[_0xac4a('0x50')]['id'];}return db[_0xac4a('0x35')][_0xac4a('0x51')]({'where':{'id':_0x3057d6[_0xac4a('0x52')]['id']}})['then'](handleEntityNotFound(_0x108f7c,null))[_0xac4a('0x1d')](saveUpdates(_0x3057d6[_0xac4a('0x50')],null))[_0xac4a('0x1d')](respondWithResult(_0x108f7c,null))[_0xac4a('0x25')](handleError(_0x108f7c,null));};exports[_0xac4a('0x30')]=function(_0x2ac1e9,_0x213df2){return db[_0xac4a('0x35')][_0xac4a('0x51')]({'where':{'id':_0x2ac1e9[_0xac4a('0x52')]['id']}})[_0xac4a('0x1d')](handleEntityNotFound(_0x213df2,null))[_0xac4a('0x1d')](removeEntity(_0x213df2,null))[_0xac4a('0x25')](handleError(_0x213df2,null));};exports[_0xac4a('0x53')]=function(_0x5222f3,_0x11c753,_0x492aae){var _0x13a577={};var _0x479ebc={};var _0x2d598e;var _0x4b7f79;return db[_0xac4a('0x35')]['findOne']({'where':{'id':_0x5222f3[_0xac4a('0x52')]['id']}})['then'](handleEntityNotFound(_0x11c753,null))['then'](function(_0x52c957){if(_0x52c957){_0x2d598e=_0x52c957;_0x479ebc[_0xac4a('0x38')]=_[_0xac4a('0x39')](db[_0xac4a('0x54')][_0xac4a('0x4d')]);_0x479ebc[_0xac4a('0x3a')]=_['keys'](_0x5222f3[_0xac4a('0x3a')]);_0x479ebc['filters']=_[_0xac4a('0x3c')](_0x479ebc['model'],_0x479ebc[_0xac4a('0x3a')]);_0x13a577[_0xac4a('0x3b')]=_[_0xac4a('0x3c')](_0x479ebc[_0xac4a('0x38')],qs[_0xac4a('0x3d')](_0x5222f3[_0xac4a('0x3a')][_0xac4a('0x3d')]));_0x13a577[_0xac4a('0x3b')]=_0x13a577[_0xac4a('0x3b')][_0xac4a('0x3e')]?_0x13a577[_0xac4a('0x3b')]:_0x479ebc[_0xac4a('0x38')];_0x13a577[_0xac4a('0x3f')]=qs[_0xac4a('0x40')](_0x5222f3[_0xac4a('0x3a')][_0xac4a('0x40')]);_0x13a577[_0xac4a('0x41')]=qs['filters'](_[_0xac4a('0x43')](_0x5222f3[_0xac4a('0x3a')],_0x479ebc['filters']));if(_0x5222f3[_0xac4a('0x3a')][_0xac4a('0x44')]){_0x13a577[_0xac4a('0x41')]=_[_0xac4a('0x45')](_0x13a577[_0xac4a('0x41')],{'$or':_['map'](_0x13a577['attributes'],function(_0x45f3c3){var _0x11bb54={};_0x11bb54[_0x45f3c3]={'$like':'%'+_0x5222f3[_0xac4a('0x3a')][_0xac4a('0x44')]+'%'};return _0x11bb54;})});}_0x13a577=_[_0xac4a('0x45')]({},_0x13a577,_0x5222f3[_0xac4a('0x48')]);return _0x2d598e[_0xac4a('0x53')](_0x13a577);}})[_0xac4a('0x1d')](function(_0x44c60b){if(_0x44c60b){_0x4b7f79=_0x44c60b[_0xac4a('0x3e')];if(!_0x5222f3[_0xac4a('0x3a')]['hasOwnProperty']('nolimit')){_0x13a577[_0xac4a('0x2b')]=qs[_0xac4a('0x2b')](_0x5222f3[_0xac4a('0x3a')][_0xac4a('0x2b')]);_0x13a577[_0xac4a('0x2a')]=qs[_0xac4a('0x2a')](_0x5222f3[_0xac4a('0x3a')][_0xac4a('0x2a')]);}return _0x2d598e[_0xac4a('0x53')](_0x13a577);}})[_0xac4a('0x1d')](function(_0xb09b89){if(_0xb09b89){return _0xb09b89?{'count':_0x4b7f79,'rows':_0xb09b89}:null;}})[_0xac4a('0x1d')](respondWithResult(_0x11c753,null))['catch'](handleError(_0x11c753,null));};exports[_0xac4a('0x55')]=function(_0xc74ce8,_0x26bd31,_0x231932){var _0x513976={};var _0xc61e94={};var _0x5a30af;var _0xab4305;return db[_0xac4a('0x35')]['findOne']({'where':{'id':_0xc74ce8['params']['id']}})[_0xac4a('0x1d')](handleEntityNotFound(_0x26bd31,null))[_0xac4a('0x1d')](function(_0x13097f){if(_0x13097f){_0x5a30af=_0x13097f;_0xc61e94['model']=_[_0xac4a('0x39')](db['ZendeskField'][_0xac4a('0x4d')]);_0xc61e94['query']=_['keys'](_0xc74ce8[_0xac4a('0x3a')]);_0xc61e94['filters']=_[_0xac4a('0x3c')](_0xc61e94['model'],_0xc61e94[_0xac4a('0x3a')]);_0x513976[_0xac4a('0x3b')]=_['intersection'](_0xc61e94[_0xac4a('0x38')],qs['fields'](_0xc74ce8[_0xac4a('0x3a')][_0xac4a('0x3d')]));_0x513976['attributes']=_0x513976[_0xac4a('0x3b')]['length']?_0x513976['attributes']:_0xc61e94[_0xac4a('0x38')];_0x513976['order']=qs[_0xac4a('0x40')](_0xc74ce8['query']['sort']);_0x513976[_0xac4a('0x41')]=qs[_0xac4a('0x42')](_[_0xac4a('0x43')](_0xc74ce8['query'],_0xc61e94['filters']));if(_0xc74ce8[_0xac4a('0x3a')][_0xac4a('0x44')]){_0x513976['where']=_['merge'](_0x513976[_0xac4a('0x41')],{'$or':_[_0xac4a('0x34')](_0x513976[_0xac4a('0x3b')],function(_0x36df3d){var _0x1810f7={};_0x1810f7[_0x36df3d]={'$like':'%'+_0xc74ce8[_0xac4a('0x3a')][_0xac4a('0x44')]+'%'};return _0x1810f7;})});}_0x513976=_[_0xac4a('0x45')]({},_0x513976,_0xc74ce8[_0xac4a('0x48')]);return _0x5a30af['getSubjects'](_0x513976);}})[_0xac4a('0x1d')](function(_0x440dc4){if(_0x440dc4){_0xab4305=_0x440dc4[_0xac4a('0x3e')];if(!_0xc74ce8['query'][_0xac4a('0x56')](_0xac4a('0x57'))){_0x513976[_0xac4a('0x2b')]=qs[_0xac4a('0x2b')](_0xc74ce8[_0xac4a('0x3a')]['limit']);_0x513976[_0xac4a('0x2a')]=qs[_0xac4a('0x2a')](_0xc74ce8[_0xac4a('0x3a')][_0xac4a('0x2a')]);}return _0x5a30af[_0xac4a('0x55')](_0x513976);}})[_0xac4a('0x1d')](function(_0xd7bdd6){if(_0xd7bdd6){return _0xd7bdd6?{'count':_0xab4305,'rows':_0xd7bdd6}:null;}})['then'](respondWithResult(_0x26bd31,null))[_0xac4a('0x25')](handleError(_0x26bd31,null));};exports[_0xac4a('0x58')]=function(_0x19bd6f,_0x35a97c,_0x1bb24d){var _0x171c47={};var _0x547eec={};var _0x318bee;var _0x29c772;return db[_0xac4a('0x35')][_0xac4a('0x59')]({'where':{'id':_0x19bd6f['params']['id']}})[_0xac4a('0x1d')](handleEntityNotFound(_0x35a97c,null))['then'](function(_0x4447b5){if(_0x4447b5){_0x318bee=_0x4447b5;_0x547eec[_0xac4a('0x38')]=_['keys'](db['ZendeskField'][_0xac4a('0x4d')]);_0x547eec[_0xac4a('0x3a')]=_[_0xac4a('0x39')](_0x19bd6f['query']);_0x547eec[_0xac4a('0x42')]=_['intersection'](_0x547eec[_0xac4a('0x38')],_0x547eec[_0xac4a('0x3a')]);_0x171c47[_0xac4a('0x3b')]=_[_0xac4a('0x3c')](_0x547eec[_0xac4a('0x38')],qs['fields'](_0x19bd6f['query'][_0xac4a('0x3d')]));_0x171c47[_0xac4a('0x3b')]=_0x171c47[_0xac4a('0x3b')][_0xac4a('0x3e')]?_0x171c47[_0xac4a('0x3b')]:_0x547eec[_0xac4a('0x38')];_0x171c47[_0xac4a('0x3f')]=qs[_0xac4a('0x40')](_0x19bd6f['query']['sort']);_0x171c47[_0xac4a('0x41')]=qs[_0xac4a('0x42')](_[_0xac4a('0x43')](_0x19bd6f[_0xac4a('0x3a')],_0x547eec[_0xac4a('0x42')]));if(_0x19bd6f[_0xac4a('0x3a')][_0xac4a('0x44')]){_0x171c47[_0xac4a('0x41')]=_['merge'](_0x171c47['where'],{'$or':_[_0xac4a('0x34')](_0x171c47[_0xac4a('0x3b')],function(_0x22804e){var _0x371e06={};_0x371e06[_0x22804e]={'$like':'%'+_0x19bd6f[_0xac4a('0x3a')][_0xac4a('0x44')]+'%'};return _0x371e06;})});}_0x171c47=_[_0xac4a('0x45')]({},_0x171c47,_0x19bd6f['options']);return _0x318bee[_0xac4a('0x58')](_0x171c47);}})[_0xac4a('0x1d')](function(_0x3439f3){if(_0x3439f3){_0x29c772=_0x3439f3['length'];if(!_0x19bd6f[_0xac4a('0x3a')][_0xac4a('0x56')](_0xac4a('0x57'))){_0x171c47[_0xac4a('0x2b')]=qs[_0xac4a('0x2b')](_0x19bd6f[_0xac4a('0x3a')][_0xac4a('0x2b')]);_0x171c47[_0xac4a('0x2a')]=qs[_0xac4a('0x2a')](_0x19bd6f['query'][_0xac4a('0x2a')]);}return _0x318bee['getDescriptions'](_0x171c47);}})[_0xac4a('0x1d')](function(_0x1199f6){if(_0x1199f6){return _0x1199f6?{'count':_0x29c772,'rows':_0x1199f6}:null;}})[_0xac4a('0x1d')](respondWithResult(_0x35a97c,null))[_0xac4a('0x25')](handleError(_0x35a97c,null));};exports[_0xac4a('0x5a')]=function(_0x337da7,_0x19766a,_0x5266d3){var _0x2b883a={};var _0x42b3f7={};var _0x279f9b;var _0x3315e7;return db[_0xac4a('0x35')]['findOne']({'where':{'id':_0x337da7[_0xac4a('0x52')]['id']}})[_0xac4a('0x1d')](handleEntityNotFound(_0x19766a,null))['then'](function(_0x55af32){if(_0x55af32){_0x279f9b=_0x55af32;_0x42b3f7[_0xac4a('0x38')]=_[_0xac4a('0x39')](db['Tag'][_0xac4a('0x4d')]);_0x42b3f7[_0xac4a('0x3a')]=_[_0xac4a('0x39')](_0x337da7[_0xac4a('0x3a')]);_0x42b3f7[_0xac4a('0x42')]=_[_0xac4a('0x3c')](_0x42b3f7['model'],_0x42b3f7[_0xac4a('0x3a')]);_0x2b883a[_0xac4a('0x3b')]=_[_0xac4a('0x3c')](_0x42b3f7['model'],qs[_0xac4a('0x3d')](_0x337da7[_0xac4a('0x3a')][_0xac4a('0x3d')]));_0x2b883a[_0xac4a('0x3b')]=_0x2b883a[_0xac4a('0x3b')][_0xac4a('0x3e')]?_0x2b883a['attributes']:_0x42b3f7[_0xac4a('0x38')];_0x2b883a[_0xac4a('0x3f')]=qs['sort'](_0x337da7[_0xac4a('0x3a')]['sort']);_0x2b883a[_0xac4a('0x41')]=qs[_0xac4a('0x42')](_['pick'](_0x337da7[_0xac4a('0x3a')],_0x42b3f7['filters']));if(_0x337da7[_0xac4a('0x3a')]['filter']){_0x2b883a[_0xac4a('0x41')]=_[_0xac4a('0x45')](_0x2b883a[_0xac4a('0x41')],{'$or':_[_0xac4a('0x34')](_0x2b883a[_0xac4a('0x3b')],function(_0x36d8ff){var _0x7e403a={};_0x7e403a[_0x36d8ff]={'$like':'%'+_0x337da7[_0xac4a('0x3a')][_0xac4a('0x44')]+'%'};return _0x7e403a;})});}_0x2b883a=_[_0xac4a('0x45')]({},_0x2b883a,_0x337da7[_0xac4a('0x48')]);return _0x279f9b[_0xac4a('0x5a')](_0x2b883a);}})[_0xac4a('0x1d')](function(_0x4217df){if(_0x4217df){_0x3315e7=_0x4217df['length'];if(!_0x337da7[_0xac4a('0x3a')][_0xac4a('0x56')]('nolimit')){_0x2b883a[_0xac4a('0x2b')]=qs[_0xac4a('0x2b')](_0x337da7[_0xac4a('0x3a')][_0xac4a('0x2b')]);_0x2b883a[_0xac4a('0x2a')]=qs['offset'](_0x337da7[_0xac4a('0x3a')]['offset']);}return _0x279f9b[_0xac4a('0x5a')](_0x2b883a);}})[_0xac4a('0x1d')](function(_0x240ff1){if(_0x240ff1){return _0x240ff1?{'count':_0x3315e7,'rows':_0x240ff1}:null;}})[_0xac4a('0x1d')](respondWithResult(_0x19766a,null))['catch'](handleError(_0x19766a,null));};exports[_0xac4a('0x5b')]=function(_0x55866d,_0x277fd1,_0x40d363){if(_0x55866d[_0xac4a('0x50')]['id']){delete _0x55866d['body']['id'];}return db[_0xac4a('0x35')][_0xac4a('0x59')]({'where':{'id':_0x55866d[_0xac4a('0x52')]['id']}})['then'](handleEntityNotFound(_0x277fd1,null))[_0xac4a('0x1d')](function(_0x25639a){if(_0x25639a){return _0x25639a[_0xac4a('0x5b')](_0x55866d[_0xac4a('0x50')][_0xac4a('0x5c')]||[]);}return null;})[_0xac4a('0x1d')](respondWithResult(_0x277fd1,null))[_0xac4a('0x25')](handleError(_0x277fd1,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 9400df5..b9cec25 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 _0x3314=['../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports','define','ZendeskConfiguration','int_zendesk_configurations','util'];(function(_0x402aa5,_0x198873){var _0x5bdaa7=function(_0x497148){while(--_0x497148){_0x402aa5['push'](_0x402aa5['shift']());}};_0x5bdaa7(++_0x198873);}(_0x3314,0x17f));var _0x4331=function(_0x2041d3,_0x13f844){_0x2041d3=_0x2041d3-0x0;var _0x25a5c3=_0x3314[_0x2041d3];return _0x25a5c3;};'use strict';var _=require('lodash');var util=require(_0x4331('0x0'));var logger=require(_0x4331('0x1'))(_0x4331('0x2'));var moment=require(_0x4331('0x3'));var BPromise=require(_0x4331('0x4'));var rp=require(_0x4331('0x5'));var fs=require('fs');var path=require(_0x4331('0x6'));var rimraf=require('rimraf');var config=require(_0x4331('0x7'));var attributes=require('./intZendeskConfiguration.attributes');module[_0x4331('0x8')]=function(_0x3ddb87,_0x14602d){return _0x3ddb87[_0x4331('0x9')](_0x4331('0xa'),attributes,{'tableName':_0x4331('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb603=['request-promise','path','rimraf','./intZendeskConfiguration.attributes','exports','define','ZendeskConfiguration','int_zendesk_configurations','util','../../config/logger','api','moment','bluebird'];(function(_0x2a0350,_0x249319){var _0x425220=function(_0x1d5f78){while(--_0x1d5f78){_0x2a0350['push'](_0x2a0350['shift']());}};_0x425220(++_0x249319);}(_0xb603,0x18e));var _0x3b60=function(_0x2283dc,_0x2fcfc5){_0x2283dc=_0x2283dc-0x0;var _0x16db90=_0xb603[_0x2283dc];return _0x16db90;};'use strict';var _=require('lodash');var util=require(_0x3b60('0x0'));var logger=require(_0x3b60('0x1'))(_0x3b60('0x2'));var moment=require(_0x3b60('0x3'));var BPromise=require(_0x3b60('0x4'));var rp=require(_0x3b60('0x5'));var fs=require('fs');var path=require(_0x3b60('0x6'));var rimraf=require(_0x3b60('0x7'));var config=require('../../config/environment');var attributes=require(_0x3b60('0x8'));module[_0x3b60('0x9')]=function(_0x232979,_0x49f1c){return _0x232979[_0x3b60('0xa')](_0x3b60('0xb'),attributes,{'tableName':_0x3b60('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js index 01210bf..d510c48 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 _0x09dd=['bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','lodash','util','moment'];(function(_0x5833ad,_0x300b0b){var _0x1ad585=function(_0x587452){while(--_0x587452){_0x5833ad['push'](_0x5833ad['shift']());}};_0x1ad585(++_0x300b0b);}(_0x09dd,0x13f));var _0xd09d=function(_0x49fa98,_0x11accf){_0x49fa98=_0x49fa98-0x0;var _0x1698f1=_0x09dd[_0x49fa98];return _0x1698f1;};'use strict';var _=require(_0xd09d('0x0'));var util=require(_0xd09d('0x1'));var moment=require(_0xd09d('0x2'));var BPromise=require(_0xd09d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd09d('0x4'))['db'];var utils=require(_0xd09d('0x5'));var logger=require(_0xd09d('0x6'))(_0xd09d('0x7'));var config=require(_0xd09d('0x8'));var jayson=require(_0xd09d('0x9'));var client=jayson[_0xd09d('0xa')][_0xd09d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x22d78f,_0x5e42f0,_0x4a905a){return new BPromise(function(_0x4a31bc,_0x5828c3){return client[_0xd09d('0xc')](_0x22d78f,_0x4a905a)[_0xd09d('0xd')](function(_0x2cebbe){logger['info'](_0xd09d('0xe'),_0x5e42f0,_0xd09d('0xf'));logger['debug'](_0xd09d('0x10'),_0x5e42f0,_0xd09d('0xf'),JSON['stringify'](_0x2cebbe));if(_0x2cebbe['error']){if(_0x2cebbe[_0xd09d('0x11')][_0xd09d('0x12')]===0x1f4){logger['error'](_0xd09d('0xe'),_0x5e42f0,_0x2cebbe['error'][_0xd09d('0x13')]);return _0x5828c3(_0x2cebbe[_0xd09d('0x11')][_0xd09d('0x13')]);}logger[_0xd09d('0x11')](_0xd09d('0xe'),_0x5e42f0,_0x2cebbe[_0xd09d('0x11')][_0xd09d('0x13')]);return _0x4a31bc(_0x2cebbe['error'][_0xd09d('0x13')]);}else{logger[_0xd09d('0x14')](_0xd09d('0xe'),_0x5e42f0,'request\x20sent');_0x4a31bc(_0x2cebbe[_0xd09d('0x15')][_0xd09d('0x13')]);}})[_0xd09d('0x16')](function(_0x206286){logger[_0xd09d('0x11')]('ZendeskConfiguration,\x20%s,\x20%s',_0x5e42f0,_0x206286);_0x5828c3(_0x206286);});});} \ No newline at end of file +var _0xb205=['../../config/utils','jayson/promise','client','http','then','info','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','ZendeskConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x44766f,_0x344e60){var _0x38a10f=function(_0x4f4a1d){while(--_0x4f4a1d){_0x44766f['push'](_0x44766f['shift']());}};_0x38a10f(++_0x344e60);}(_0xb205,0x68));var _0x5b20=function(_0x46ac50,_0x437fde){_0x46ac50=_0x46ac50-0x0;var _0x129cc5=_0xb205[_0x46ac50];return _0x129cc5;};'use strict';var _=require(_0x5b20('0x0'));var util=require(_0x5b20('0x1'));var moment=require(_0x5b20('0x2'));var BPromise=require(_0x5b20('0x3'));var rs=require(_0x5b20('0x4'));var fs=require('fs');var Redis=require(_0x5b20('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x5b20('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x5b20('0x7'));var client=jayson[_0x5b20('0x8')][_0x5b20('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3e2f7e,_0x2ab65e,_0x4a52fc){return new BPromise(function(_0x2e0f8a,_0x14ebd4){return client['request'](_0x3e2f7e,_0x4a52fc)[_0x5b20('0xa')](function(_0xea1a9){logger[_0x5b20('0xb')]('ZendeskConfiguration,\x20%s,\x20%s',_0x2ab65e,'request\x20sent');logger[_0x5b20('0xc')](_0x5b20('0xd'),_0x2ab65e,_0x5b20('0xe'),JSON[_0x5b20('0xf')](_0xea1a9));if(_0xea1a9[_0x5b20('0x10')]){if(_0xea1a9[_0x5b20('0x10')][_0x5b20('0x11')]===0x1f4){logger['error'](_0x5b20('0x12'),_0x2ab65e,_0xea1a9[_0x5b20('0x10')][_0x5b20('0x13')]);return _0x14ebd4(_0xea1a9[_0x5b20('0x10')][_0x5b20('0x13')]);}logger[_0x5b20('0x10')](_0x5b20('0x12'),_0x2ab65e,_0xea1a9[_0x5b20('0x10')][_0x5b20('0x13')]);return _0x2e0f8a(_0xea1a9['error'][_0x5b20('0x13')]);}else{logger[_0x5b20('0xb')]('ZendeskConfiguration,\x20%s,\x20%s',_0x2ab65e,'request\x20sent');_0x2e0f8a(_0xea1a9[_0x5b20('0x14')][_0x5b20('0x13')]);}})[_0x5b20('0x15')](function(_0x2b5557){logger[_0x5b20('0x10')]('ZendeskConfiguration,\x20%s,\x20%s',_0x2ab65e,_0x2b5557);_0x14ebd4(_0x2b5557);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 468a7f7..de115d5 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 _0xe563=['../../components/interaction/service','../../config/environment','./intZendeskField.controller','isAuthenticated','get','/:id','show','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x23a673,_0x31e4bc){var _0x2213b7=function(_0x3c5dcc){while(--_0x3c5dcc){_0x23a673['push'](_0x23a673['shift']());}};_0x2213b7(++_0x31e4bc);}(_0xe563,0x125));var _0x3e56=function(_0x597797,_0x20976c){_0x597797=_0x597797-0x0;var _0x198e5f=_0xe563[_0x597797];return _0x198e5f;};'use strict';var multer=require(_0x3e56('0x0'));var util=require(_0x3e56('0x1'));var path=require(_0x3e56('0x2'));var timeout=require(_0x3e56('0x3'));var express=require(_0x3e56('0x4'));var router=express[_0x3e56('0x5')]();var auth=require(_0x3e56('0x6'));var interaction=require(_0x3e56('0x7'));var config=require(_0x3e56('0x8'));var controller=require(_0x3e56('0x9'));router['get']('/',auth[_0x3e56('0xa')](),controller['index']);router[_0x3e56('0xb')](_0x3e56('0xc'),auth[_0x3e56('0xa')](),controller[_0x3e56('0xd')]);router[_0x3e56('0xe')]('/',auth[_0x3e56('0xa')](),controller[_0x3e56('0xf')]);router[_0x3e56('0x10')](_0x3e56('0xc'),auth[_0x3e56('0xa')](),controller[_0x3e56('0x11')]);router['delete'](_0x3e56('0xc'),auth[_0x3e56('0xa')](),controller[_0x3e56('0x12')]);module[_0x3e56('0x13')]=router; \ No newline at end of file +var _0x44ae=['exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./intZendeskField.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x44ae,0x17d));var _0xe44a=function(_0x667ff8,_0x59e7df){_0x667ff8=_0x667ff8-0x0;var _0x2ddfc7=_0x44ae[_0x667ff8];return _0x2ddfc7;};'use strict';var multer=require(_0xe44a('0x0'));var util=require(_0xe44a('0x1'));var path=require(_0xe44a('0x2'));var timeout=require(_0xe44a('0x3'));var express=require('express');var router=express[_0xe44a('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xe44a('0x5'));var config=require(_0xe44a('0x6'));var controller=require(_0xe44a('0x7'));router[_0xe44a('0x8')]('/',auth[_0xe44a('0x9')](),controller[_0xe44a('0xa')]);router['get'](_0xe44a('0xb'),auth[_0xe44a('0x9')](),controller[_0xe44a('0xc')]);router[_0xe44a('0xd')]('/',auth['isAuthenticated'](),controller[_0xe44a('0xe')]);router[_0xe44a('0xf')](_0xe44a('0xb'),auth[_0xe44a('0x9')](),controller['update']);router[_0xe44a('0x10')](_0xe44a('0xb'),auth[_0xe44a('0x9')](),controller[_0xe44a('0x11')]);module[_0xe44a('0x12')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index 75c7ac5..60f550b 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 _0xe105=['BOOLEAN','sequelize','customVariable','keyValue','string','STRING','ENUM'];(function(_0x319e2e,_0x2f727f){var _0x302524=function(_0x5cad9d){while(--_0x5cad9d){_0x319e2e['push'](_0x319e2e['shift']());}};_0x302524(++_0x2f727f);}(_0xe105,0xef));var _0x5e10=function(_0x411cc2,_0xc8156f){_0x411cc2=_0x411cc2-0x0;var _0x5a0d59=_0xe105[_0x411cc2];return _0x5a0d59;};'use strict';var Sequelize=require(_0x5e10('0x0'));module['exports']={'type':{'type':Sequelize['ENUM']('string','variable',_0x5e10('0x1'),_0x5e10('0x2')),'defaultValue':_0x5e10('0x3')},'content':{'type':Sequelize[_0x5e10('0x4')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x5e10('0x5')](_0x5e10('0x3'),'variable',_0x5e10('0x1'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x5e10('0x4')]},'customField':{'type':Sequelize[_0x5e10('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x331c=['sequelize','ENUM','customVariable','STRING','string','BOOLEAN'];(function(_0x1a750f,_0x37d916){var _0x26a742=function(_0x109a49){while(--_0x109a49){_0x1a750f['push'](_0x1a750f['shift']());}};_0x26a742(++_0x37d916);}(_0x331c,0xf0));var _0xc331=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0x331c[_0x411add];return _0x238242;};'use strict';var Sequelize=require(_0xc331('0x0'));module['exports']={'type':{'type':Sequelize[_0xc331('0x1')]('string','variable',_0xc331('0x2'),'keyValue'),'defaultValue':'string'},'content':{'type':Sequelize[_0xc331('0x3')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xc331('0x1')](_0xc331('0x4'),'variable',_0xc331('0x2'))},'keyContent':{'type':Sequelize[_0xc331('0x3')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xc331('0x3')]},'customField':{'type':Sequelize[_0xc331('0x5')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xc331('0x3')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index 0bdd69f..033068a 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 _0x49b2=['jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','then','destroy','stack','name','send','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','length','nolimit','order','sort','where','filters','pick','filter','merge','map','VIRTUAL','options','count','includeAll','include','ZendeskField','findAll','rows','catch','params','fields','create','body','update','find','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x49b2,0x110));var _0x249b=function(_0x2533c9,_0x4450c9){_0x2533c9=_0x2533c9-0x0;var _0x3dcff4=_0x49b2[_0x2533c9];return _0x3dcff4;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x249b('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x249b('0x1'));var moment=require(_0x249b('0x2'));var BPromise=require(_0x249b('0x3'));var Mustache=require(_0x249b('0x4'));var util=require(_0x249b('0x5'));var path=require(_0x249b('0x6'));var sox=require(_0x249b('0x7'));var csv=require(_0x249b('0x8'));var ejs=require(_0x249b('0x9'));var fs=require('fs');var _=require(_0x249b('0xa'));var squel=require('squel');var crypto=require(_0x249b('0xb'));var jsforce=require(_0x249b('0xc'));var deskjs=require(_0x249b('0xd'));var toCsv=require(_0x249b('0x8'));var querystring=require(_0x249b('0xe'));var Papa=require(_0x249b('0xf'));var Redis=require(_0x249b('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x249b('0x11'));var as=require(_0x249b('0x12'));var hardwareService=require(_0x249b('0x13'));var logger=require(_0x249b('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x249b('0x15'));var db=require(_0x249b('0x16'))['db'];function respondWithStatusCode(_0xe808b0,_0x424d6a){_0x424d6a=_0x424d6a||0xcc;return function(_0x4c03fc){if(_0x4c03fc){return _0xe808b0[_0x249b('0x17')](_0x424d6a);}return _0xe808b0[_0x249b('0x18')](_0x424d6a)[_0x249b('0x19')]();};}function respondWithResult(_0x596fdc,_0x52567b){_0x52567b=_0x52567b||0xc8;return function(_0x1079a0){if(_0x1079a0){return _0x596fdc['status'](_0x52567b)[_0x249b('0x1a')](_0x1079a0);}};}function respondWithFilteredResult(_0x2f3221,_0x4b0a4c){return function(_0x5c9837){if(_0x5c9837){var _0x58f232=_0x5c9837['count'],_0x57ad3d=_0x4b0a4c[_0x249b('0x1b')],_0x3e1682=_0x4b0a4c[_0x249b('0x1b')]+_0x4b0a4c[_0x249b('0x1c')],_0x1354d8;if(_0x3e1682>=_0x58f232){_0x3e1682=_0x58f232;_0x1354d8=0xc8;}else{_0x1354d8=0xce;}_0x2f3221[_0x249b('0x18')](_0x1354d8);return _0x2f3221[_0x249b('0x1d')](_0x249b('0x1e'),_0x57ad3d+'-'+_0x3e1682+'/'+_0x58f232)[_0x249b('0x1a')](_0x5c9837);}return null;};}function patchUpdates(_0x45738d){return function(_0x5934f1){try{jsonpatch[_0x249b('0x1f')](_0x5934f1,_0x45738d,!![]);}catch(_0x1c4838){return BPromise[_0x249b('0x20')](_0x1c4838);}return _0x5934f1['save']();};}function saveUpdates(_0x2005e0,_0x1e3696){return function(_0x650a01){if(_0x650a01){return _0x650a01['update'](_0x2005e0)[_0x249b('0x21')](function(_0x561ace){return _0x561ace;});}return null;};}function removeEntity(_0x237113,_0x1f4a90){return function(_0x475b25){if(_0x475b25){return _0x475b25[_0x249b('0x22')]()['then'](function(){_0x237113[_0x249b('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x18b9de,_0x384a5d){return function(_0x58c649){if(!_0x58c649){_0x18b9de[_0x249b('0x17')](0x194);}return _0x58c649;};}function handleError(_0x9f17fe,_0x5261e8){_0x5261e8=_0x5261e8||0x1f4;return function(_0xfbf10d){logger['error'](_0xfbf10d[_0x249b('0x23')]);if(_0xfbf10d[_0x249b('0x24')]){delete _0xfbf10d[_0x249b('0x24')];}_0x9f17fe[_0x249b('0x18')](_0x5261e8)[_0x249b('0x25')](_0xfbf10d);};}exports['index']=function(_0x226545,_0x487001){var _0x34b21c={},_0x49a1ab={},_0x478f01={'count':0x0,'rows':[]};var _0x2176f6=_['map'](db['ZendeskField'][_0x249b('0x26')],function(_0x4a8204){return{'name':_0x4a8204[_0x249b('0x27')],'type':_0x4a8204[_0x249b('0x28')]['key']};});_0x49a1ab[_0x249b('0x29')]=_['map'](_0x2176f6,_0x249b('0x24'));_0x49a1ab[_0x249b('0x2a')]=_[_0x249b('0x2b')](_0x226545[_0x249b('0x2a')]);_0x49a1ab['filters']=_[_0x249b('0x2c')](_0x49a1ab[_0x249b('0x29')],_0x49a1ab['query']);_0x34b21c['attributes']=_[_0x249b('0x2c')](_0x49a1ab['model'],qs['fields'](_0x226545[_0x249b('0x2a')]['fields']));_0x34b21c[_0x249b('0x2d')]=_0x34b21c['attributes'][_0x249b('0x2e')]?_0x34b21c[_0x249b('0x2d')]:_0x49a1ab[_0x249b('0x29')];if(!_0x226545[_0x249b('0x2a')]['hasOwnProperty'](_0x249b('0x2f'))){_0x34b21c[_0x249b('0x1c')]=qs[_0x249b('0x1c')](_0x226545[_0x249b('0x2a')][_0x249b('0x1c')]);_0x34b21c[_0x249b('0x1b')]=qs[_0x249b('0x1b')](_0x226545[_0x249b('0x2a')]['offset']);}_0x34b21c[_0x249b('0x30')]=qs[_0x249b('0x31')](_0x226545[_0x249b('0x2a')][_0x249b('0x31')]);_0x34b21c[_0x249b('0x32')]=qs[_0x249b('0x33')](_[_0x249b('0x34')](_0x226545['query'],_0x49a1ab[_0x249b('0x33')]));if(_0x226545[_0x249b('0x2a')][_0x249b('0x35')]){_0x34b21c[_0x249b('0x32')]=_[_0x249b('0x36')](_0x34b21c['where'],{'$or':_[_0x249b('0x37')](_0x2176f6,function(_0x205e73){if(_0x205e73[_0x249b('0x28')]!==_0x249b('0x38')){var _0xe5c136={};_0xe5c136[_0x205e73[_0x249b('0x24')]]={'$like':'%'+_0x226545[_0x249b('0x2a')][_0x249b('0x35')]+'%'};return _0xe5c136;}})});}_0x34b21c=_[_0x249b('0x36')]({},_0x34b21c,_0x226545[_0x249b('0x39')]);var _0x41f348={'where':_0x34b21c[_0x249b('0x32')]};return db['ZendeskField'][_0x249b('0x3a')](_0x41f348)['then'](function(_0x2c4e64){_0x478f01[_0x249b('0x3a')]=_0x2c4e64;if(_0x226545[_0x249b('0x2a')][_0x249b('0x3b')]){_0x34b21c[_0x249b('0x3c')]=[{'all':!![]}];}return db[_0x249b('0x3d')][_0x249b('0x3e')](_0x34b21c);})[_0x249b('0x21')](function(_0x1609ca){_0x478f01[_0x249b('0x3f')]=_0x1609ca;return _0x478f01;})['then'](respondWithFilteredResult(_0x487001,_0x34b21c))[_0x249b('0x40')](handleError(_0x487001,null));};exports['show']=function(_0x2ba103,_0x598d04){var _0x1e4b7e={'raw':!![],'where':{'id':_0x2ba103[_0x249b('0x41')]['id']}},_0x23d393={};_0x23d393[_0x249b('0x29')]=_[_0x249b('0x2b')](db[_0x249b('0x3d')][_0x249b('0x26')]);_0x23d393[_0x249b('0x2a')]=_[_0x249b('0x2b')](_0x2ba103['query']);_0x23d393[_0x249b('0x33')]=_[_0x249b('0x2c')](_0x23d393[_0x249b('0x29')],_0x23d393[_0x249b('0x2a')]);_0x1e4b7e['attributes']=_[_0x249b('0x2c')](_0x23d393[_0x249b('0x29')],qs[_0x249b('0x42')](_0x2ba103[_0x249b('0x2a')]['fields']));_0x1e4b7e[_0x249b('0x2d')]=_0x1e4b7e[_0x249b('0x2d')][_0x249b('0x2e')]?_0x1e4b7e['attributes']:_0x23d393['model'];if(_0x2ba103[_0x249b('0x2a')][_0x249b('0x3b')]){_0x1e4b7e[_0x249b('0x3c')]=[{'all':!![]}];}_0x1e4b7e=_[_0x249b('0x36')]({},_0x1e4b7e,_0x2ba103[_0x249b('0x39')]);return db[_0x249b('0x3d')]['find'](_0x1e4b7e)[_0x249b('0x21')](handleEntityNotFound(_0x598d04,null))[_0x249b('0x21')](respondWithResult(_0x598d04,null))['catch'](handleError(_0x598d04,null));};exports[_0x249b('0x43')]=function(_0x33c702,_0x4f0569){return db['ZendeskField'][_0x249b('0x43')](_0x33c702[_0x249b('0x44')],{})['then'](respondWithResult(_0x4f0569,0xc9))[_0x249b('0x40')](handleError(_0x4f0569,null));};exports[_0x249b('0x45')]=function(_0x4e7d58,_0x70658f){if(_0x4e7d58[_0x249b('0x44')]['id']){delete _0x4e7d58[_0x249b('0x44')]['id'];}return db[_0x249b('0x3d')][_0x249b('0x46')]({'where':{'id':_0x4e7d58[_0x249b('0x41')]['id']}})[_0x249b('0x21')](handleEntityNotFound(_0x70658f,null))[_0x249b('0x21')](saveUpdates(_0x4e7d58[_0x249b('0x44')],null))[_0x249b('0x21')](respondWithResult(_0x70658f,null))[_0x249b('0x40')](handleError(_0x70658f,null));};exports[_0x249b('0x22')]=function(_0x6c057d,_0x1c8cec){return db[_0x249b('0x3d')][_0x249b('0x46')]({'where':{'id':_0x6c057d[_0x249b('0x41')]['id']}})[_0x249b('0x21')](handleEntityNotFound(_0x1c8cec,null))[_0x249b('0x21')](removeEntity(_0x1c8cec,null))['catch'](handleError(_0x1c8cec,null));}; \ No newline at end of file +var _0xc80d=['api','../../config/environment','sendStatus','status','end','json','count','offset','limit','reject','update','then','error','stack','name','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','ZendeskField','findAll','rows','catch','show','params','includeAll','include','find','create','body','destroy','html-pdf','eml-format','request-promise','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x5787d2,_0x5ec8af){var _0x2c29c9=function(_0x1eef2c){while(--_0x1eef2c){_0x5787d2['push'](_0x5787d2['shift']());}};_0x2c29c9(++_0x5ec8af);}(_0xc80d,0xb7));var _0xdc80=function(_0x2313be,_0x95b1e7){_0x2313be=_0x2313be-0x0;var _0x5cf4d0=_0xc80d[_0x2313be];return _0x5cf4d0;};'use strict';var pdf=require(_0xdc80('0x0'));var emlformat=require(_0xdc80('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xdc80('0x2'));var moment=require(_0xdc80('0x3'));var BPromise=require(_0xdc80('0x4'));var Mustache=require(_0xdc80('0x5'));var util=require(_0xdc80('0x6'));var path=require('path');var sox=require(_0xdc80('0x7'));var csv=require(_0xdc80('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xdc80('0x9'));var squel=require(_0xdc80('0xa'));var crypto=require(_0xdc80('0xb'));var jsforce=require(_0xdc80('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xdc80('0x8'));var querystring=require(_0xdc80('0xd'));var Papa=require(_0xdc80('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xdc80('0xf'));var hardwareService=require(_0xdc80('0x10'));var logger=require(_0xdc80('0x11'))(_0xdc80('0x12'));var utils=require('../../config/utils');var config=require(_0xdc80('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x132264,_0x127874){_0x127874=_0x127874||0xcc;return function(_0x50a539){if(_0x50a539){return _0x132264[_0xdc80('0x14')](_0x127874);}return _0x132264[_0xdc80('0x15')](_0x127874)[_0xdc80('0x16')]();};}function respondWithResult(_0x5060aa,_0x2b0136){_0x2b0136=_0x2b0136||0xc8;return function(_0x202026){if(_0x202026){return _0x5060aa[_0xdc80('0x15')](_0x2b0136)[_0xdc80('0x17')](_0x202026);}};}function respondWithFilteredResult(_0x10880f,_0x93a3bd){return function(_0x5f59a9){if(_0x5f59a9){var _0x14a9bc=_0x5f59a9[_0xdc80('0x18')],_0xb09144=_0x93a3bd[_0xdc80('0x19')],_0x178625=_0x93a3bd[_0xdc80('0x19')]+_0x93a3bd[_0xdc80('0x1a')],_0x3399eb;if(_0x178625>=_0x14a9bc){_0x178625=_0x14a9bc;_0x3399eb=0xc8;}else{_0x3399eb=0xce;}_0x10880f[_0xdc80('0x15')](_0x3399eb);return _0x10880f['set']('Content-Range',_0xb09144+'-'+_0x178625+'/'+_0x14a9bc)[_0xdc80('0x17')](_0x5f59a9);}return null;};}function patchUpdates(_0xe44844){return function(_0x2e6610){try{jsonpatch['apply'](_0x2e6610,_0xe44844,!![]);}catch(_0x42cd57){return BPromise[_0xdc80('0x1b')](_0x42cd57);}return _0x2e6610['save']();};}function saveUpdates(_0x528729,_0x1d06d9){return function(_0x48fd4b){if(_0x48fd4b){return _0x48fd4b[_0xdc80('0x1c')](_0x528729)['then'](function(_0x322526){return _0x322526;});}return null;};}function removeEntity(_0x468522,_0x1e252a){return function(_0x555617){if(_0x555617){return _0x555617['destroy']()[_0xdc80('0x1d')](function(){_0x468522[_0xdc80('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x360d8c,_0x910b15){return function(_0x12fc3e){if(!_0x12fc3e){_0x360d8c[_0xdc80('0x14')](0x194);}return _0x12fc3e;};}function handleError(_0x583bb1,_0xee5d4a){_0xee5d4a=_0xee5d4a||0x1f4;return function(_0x1aab9f){logger[_0xdc80('0x1e')](_0x1aab9f[_0xdc80('0x1f')]);if(_0x1aab9f['name']){delete _0x1aab9f[_0xdc80('0x20')];}_0x583bb1[_0xdc80('0x15')](_0xee5d4a)['send'](_0x1aab9f);};}exports[_0xdc80('0x21')]=function(_0x62cda1,_0x49b14a){var _0x33805a={},_0x39bb9b={},_0x969fe2={'count':0x0,'rows':[]};var _0x3e3482=_[_0xdc80('0x22')](db['ZendeskField'][_0xdc80('0x23')],function(_0x22728d){return{'name':_0x22728d[_0xdc80('0x24')],'type':_0x22728d[_0xdc80('0x25')][_0xdc80('0x26')]};});_0x39bb9b['model']=_[_0xdc80('0x22')](_0x3e3482,'name');_0x39bb9b[_0xdc80('0x27')]=_[_0xdc80('0x28')](_0x62cda1['query']);_0x39bb9b[_0xdc80('0x29')]=_[_0xdc80('0x2a')](_0x39bb9b['model'],_0x39bb9b['query']);_0x33805a[_0xdc80('0x2b')]=_['intersection'](_0x39bb9b[_0xdc80('0x2c')],qs[_0xdc80('0x2d')](_0x62cda1[_0xdc80('0x27')]['fields']));_0x33805a[_0xdc80('0x2b')]=_0x33805a[_0xdc80('0x2b')][_0xdc80('0x2e')]?_0x33805a['attributes']:_0x39bb9b['model'];if(!_0x62cda1['query'][_0xdc80('0x2f')](_0xdc80('0x30'))){_0x33805a['limit']=qs['limit'](_0x62cda1[_0xdc80('0x27')][_0xdc80('0x1a')]);_0x33805a[_0xdc80('0x19')]=qs[_0xdc80('0x19')](_0x62cda1[_0xdc80('0x27')][_0xdc80('0x19')]);}_0x33805a[_0xdc80('0x31')]=qs['sort'](_0x62cda1[_0xdc80('0x27')][_0xdc80('0x32')]);_0x33805a[_0xdc80('0x33')]=qs[_0xdc80('0x29')](_['pick'](_0x62cda1[_0xdc80('0x27')],_0x39bb9b[_0xdc80('0x29')]));if(_0x62cda1[_0xdc80('0x27')][_0xdc80('0x34')]){_0x33805a[_0xdc80('0x33')]=_[_0xdc80('0x35')](_0x33805a[_0xdc80('0x33')],{'$or':_[_0xdc80('0x22')](_0x3e3482,function(_0x2da87f){if(_0x2da87f[_0xdc80('0x25')]!=='VIRTUAL'){var _0xb18208={};_0xb18208[_0x2da87f[_0xdc80('0x20')]]={'$like':'%'+_0x62cda1[_0xdc80('0x27')]['filter']+'%'};return _0xb18208;}})});}_0x33805a=_[_0xdc80('0x35')]({},_0x33805a,_0x62cda1[_0xdc80('0x36')]);var _0x27652a={'where':_0x33805a[_0xdc80('0x33')]};return db[_0xdc80('0x37')]['count'](_0x27652a)[_0xdc80('0x1d')](function(_0x1bd3d8){_0x969fe2[_0xdc80('0x18')]=_0x1bd3d8;if(_0x62cda1[_0xdc80('0x27')]['includeAll']){_0x33805a['include']=[{'all':!![]}];}return db[_0xdc80('0x37')][_0xdc80('0x38')](_0x33805a);})[_0xdc80('0x1d')](function(_0x2fb784){_0x969fe2[_0xdc80('0x39')]=_0x2fb784;return _0x969fe2;})[_0xdc80('0x1d')](respondWithFilteredResult(_0x49b14a,_0x33805a))[_0xdc80('0x3a')](handleError(_0x49b14a,null));};exports[_0xdc80('0x3b')]=function(_0x18baee,_0x31b967){var _0x57c8ed={'raw':!![],'where':{'id':_0x18baee[_0xdc80('0x3c')]['id']}},_0xeba107={};_0xeba107[_0xdc80('0x2c')]=_[_0xdc80('0x28')](db['ZendeskField'][_0xdc80('0x23')]);_0xeba107[_0xdc80('0x27')]=_['keys'](_0x18baee[_0xdc80('0x27')]);_0xeba107[_0xdc80('0x29')]=_[_0xdc80('0x2a')](_0xeba107[_0xdc80('0x2c')],_0xeba107[_0xdc80('0x27')]);_0x57c8ed['attributes']=_[_0xdc80('0x2a')](_0xeba107[_0xdc80('0x2c')],qs[_0xdc80('0x2d')](_0x18baee[_0xdc80('0x27')][_0xdc80('0x2d')]));_0x57c8ed[_0xdc80('0x2b')]=_0x57c8ed[_0xdc80('0x2b')][_0xdc80('0x2e')]?_0x57c8ed[_0xdc80('0x2b')]:_0xeba107[_0xdc80('0x2c')];if(_0x18baee['query'][_0xdc80('0x3d')]){_0x57c8ed[_0xdc80('0x3e')]=[{'all':!![]}];}_0x57c8ed=_['merge']({},_0x57c8ed,_0x18baee[_0xdc80('0x36')]);return db[_0xdc80('0x37')][_0xdc80('0x3f')](_0x57c8ed)[_0xdc80('0x1d')](handleEntityNotFound(_0x31b967,null))[_0xdc80('0x1d')](respondWithResult(_0x31b967,null))[_0xdc80('0x3a')](handleError(_0x31b967,null));};exports[_0xdc80('0x40')]=function(_0x4f1b46,_0x16cd29){return db[_0xdc80('0x37')][_0xdc80('0x40')](_0x4f1b46[_0xdc80('0x41')],{})['then'](respondWithResult(_0x16cd29,0xc9))['catch'](handleError(_0x16cd29,null));};exports[_0xdc80('0x1c')]=function(_0x94ec37,_0x35b742){if(_0x94ec37[_0xdc80('0x41')]['id']){delete _0x94ec37['body']['id'];}return db[_0xdc80('0x37')][_0xdc80('0x3f')]({'where':{'id':_0x94ec37[_0xdc80('0x3c')]['id']}})[_0xdc80('0x1d')](handleEntityNotFound(_0x35b742,null))[_0xdc80('0x1d')](saveUpdates(_0x94ec37[_0xdc80('0x41')],null))[_0xdc80('0x1d')](respondWithResult(_0x35b742,null))[_0xdc80('0x3a')](handleError(_0x35b742,null));};exports[_0xdc80('0x42')]=function(_0x25bb72,_0x5633bd){return db['ZendeskField']['find']({'where':{'id':_0x25bb72['params']['id']}})['then'](handleEntityNotFound(_0x5633bd,null))[_0xdc80('0x1d')](removeEntity(_0x5633bd,null))['catch'](handleError(_0x5633bd,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index af3d2db..cfb6710 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 _0x9861=['api','moment','bluebird','request-promise','path','rimraf','./intZendeskField.attributes','exports','define','ZendeskField','int_zendesk_fields','zendesk_unique_index','idField','FieldId','lodash'];(function(_0x1fa9fd,_0x38fff0){var _0x22f0ef=function(_0x33719e){while(--_0x33719e){_0x1fa9fd['push'](_0x1fa9fd['shift']());}};_0x22f0ef(++_0x38fff0);}(_0x9861,0x176));var _0x1986=function(_0x127933,_0x4e880f){_0x127933=_0x127933-0x0;var _0x1d6f84=_0x9861[_0x127933];return _0x1d6f84;};'use strict';var _=require(_0x1986('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x1986('0x1'));var moment=require(_0x1986('0x2'));var BPromise=require(_0x1986('0x3'));var rp=require(_0x1986('0x4'));var fs=require('fs');var path=require(_0x1986('0x5'));var rimraf=require(_0x1986('0x6'));var config=require('../../config/environment');var attributes=require(_0x1986('0x7'));module[_0x1986('0x8')]=function(_0x1b56d6,_0x17ccbf){return _0x1b56d6[_0x1986('0x9')](_0x1986('0xa'),attributes,{'tableName':_0x1986('0xb'),'paranoid':![],'indexes':[{'name':_0x1986('0xc'),'fields':[_0x1986('0xd'),_0x1986('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xfb5d=['bluebird','exports','define','ZendeskField','int_zendesk_fields','idField','FieldId','lodash','util','../../config/logger','api'];(function(_0x1893ee,_0x551bbd){var _0x218f13=function(_0x13af58){while(--_0x13af58){_0x1893ee['push'](_0x1893ee['shift']());}};_0x218f13(++_0x551bbd);}(_0xfb5d,0x11a));var _0xdfb5=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xfb5d[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0xdfb5('0x0'));var util=require(_0xdfb5('0x1'));var logger=require(_0xdfb5('0x2'))(_0xdfb5('0x3'));var moment=require('moment');var BPromise=require(_0xdfb5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intZendeskField.attributes');module[_0xdfb5('0x5')]=function(_0x4b0a35,_0x4892a7){return _0x4b0a35[_0xdfb5('0x6')](_0xdfb5('0x7'),attributes,{'tableName':_0xdfb5('0x8'),'paranoid':![],'indexes':[{'name':'zendesk_unique_index','fields':[_0xdfb5('0x9'),_0xdfb5('0xa')],'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 c8edd07..b03e668 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 _0x81b5=['request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','error','message','result','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZendeskField,\x20%s,\x20%s'];(function(_0x300dd7,_0xb6ac19){var _0x6e18f1=function(_0x172c76){while(--_0x172c76){_0x300dd7['push'](_0x300dd7['shift']());}};_0x6e18f1(++_0xb6ac19);}(_0x81b5,0x17c));var _0x581b=function(_0xd4ea39,_0x267244){_0xd4ea39=_0xd4ea39-0x0;var _0x281e37=_0x81b5[_0xd4ea39];return _0x281e37;};'use strict';var _=require('lodash');var util=require(_0x581b('0x0'));var moment=require('moment');var BPromise=require(_0x581b('0x1'));var rs=require(_0x581b('0x2'));var fs=require('fs');var Redis=require(_0x581b('0x3'));var db=require(_0x581b('0x4'))['db'];var utils=require(_0x581b('0x5'));var logger=require(_0x581b('0x6'))(_0x581b('0x7'));var config=require(_0x581b('0x8'));var jayson=require(_0x581b('0x9'));var client=jayson[_0x581b('0xa')][_0x581b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x85d8da,_0x3e0b67,_0x53c532){return new BPromise(function(_0x3c9dbc,_0x14cd4b){return client[_0x581b('0xc')](_0x85d8da,_0x53c532)[_0x581b('0xd')](function(_0x10e821){logger[_0x581b('0xe')](_0x581b('0xf'),_0x3e0b67,_0x581b('0x10'));logger[_0x581b('0x11')](_0x581b('0x12'),_0x3e0b67,_0x581b('0x10'),JSON['stringify'](_0x10e821));if(_0x10e821[_0x581b('0x13')]){if(_0x10e821[_0x581b('0x13')]['code']===0x1f4){logger['error'](_0x581b('0xf'),_0x3e0b67,_0x10e821[_0x581b('0x13')]['message']);return _0x14cd4b(_0x10e821[_0x581b('0x13')][_0x581b('0x14')]);}logger['error']('ZendeskField,\x20%s,\x20%s',_0x3e0b67,_0x10e821[_0x581b('0x13')][_0x581b('0x14')]);return _0x3c9dbc(_0x10e821[_0x581b('0x13')][_0x581b('0x14')]);}else{logger[_0x581b('0xe')](_0x581b('0xf'),_0x3e0b67,_0x581b('0x10'));_0x3c9dbc(_0x10e821[_0x581b('0x15')][_0x581b('0x14')]);}})['catch'](function(_0x95d68f){logger[_0x581b('0x13')](_0x581b('0xf'),_0x3e0b67,_0x95d68f);_0x14cd4b(_0x95d68f);});});} \ No newline at end of file +var _0x9782=['../../config/logger','../../config/environment','jayson/promise','http','then','info','ZendeskField,\x20%s,\x20%s','request\x20sent','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x153863,_0x41363d){var _0x3bfc32=function(_0x146041){while(--_0x146041){_0x153863['push'](_0x153863['shift']());}};_0x3bfc32(++_0x41363d);}(_0x9782,0xff));var _0x2978=function(_0xbab353,_0x37e159){_0xbab353=_0xbab353-0x0;var _0x56871e=_0x9782[_0xbab353];return _0x56871e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x2978('0x0'));var BPromise=require(_0x2978('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2978('0x2'));var db=require(_0x2978('0x3'))['db'];var utils=require(_0x2978('0x4'));var logger=require(_0x2978('0x5'))('rpc');var config=require(_0x2978('0x6'));var jayson=require(_0x2978('0x7'));var client=jayson['client'][_0x2978('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x113655,_0x5d73a1,_0x54e383){return new BPromise(function(_0x423589,_0x15a379){return client['request'](_0x113655,_0x54e383)[_0x2978('0x9')](function(_0x945136){logger[_0x2978('0xa')](_0x2978('0xb'),_0x5d73a1,_0x2978('0xc'));logger['debug'](_0x2978('0xd'),_0x5d73a1,_0x2978('0xc'),JSON[_0x2978('0xe')](_0x945136));if(_0x945136[_0x2978('0xf')]){if(_0x945136['error'][_0x2978('0x10')]===0x1f4){logger[_0x2978('0xf')](_0x2978('0xb'),_0x5d73a1,_0x945136[_0x2978('0xf')][_0x2978('0x11')]);return _0x15a379(_0x945136[_0x2978('0xf')][_0x2978('0x11')]);}logger['error'](_0x2978('0xb'),_0x5d73a1,_0x945136[_0x2978('0xf')][_0x2978('0x11')]);return _0x423589(_0x945136[_0x2978('0xf')][_0x2978('0x11')]);}else{logger['info'](_0x2978('0xb'),_0x5d73a1,_0x2978('0xc'));_0x423589(_0x945136[_0x2978('0x12')][_0x2978('0x11')]);}})[_0x2978('0x13')](function(_0xde3e87){logger[_0x2978('0xf')](_0x2978('0xb'),_0x5d73a1,_0xde3e87);_0x15a379(_0xde3e87);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index a780722..c4fa8c6 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 _0x6ece=['getFields','create','post','/:id/configurations','addConfiguration','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','./intZohoAccount.controller','index','get','/:id','isAuthenticated','/:id/fields'];(function(_0xd01157,_0x5bb2da){var _0x54974b=function(_0x584ff0){while(--_0x584ff0){_0xd01157['push'](_0xd01157['shift']());}};_0x54974b(++_0x5bb2da);}(_0x6ece,0x94));var _0xe6ec=function(_0x38d5ad,_0x6523f0){_0x38d5ad=_0x38d5ad-0x0;var _0x1826eb=_0x6ece[_0x38d5ad];return _0x1826eb;};'use strict';var multer=require(_0xe6ec('0x0'));var util=require(_0xe6ec('0x1'));var path=require(_0xe6ec('0x2'));var timeout=require(_0xe6ec('0x3'));var express=require(_0xe6ec('0x4'));var router=express[_0xe6ec('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xe6ec('0x6'));var config=require('../../config/environment');var controller=require(_0xe6ec('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xe6ec('0x8')]);router[_0xe6ec('0x9')](_0xe6ec('0xa'),auth[_0xe6ec('0xb')](),controller['show']);router[_0xe6ec('0x9')]('/:id/configurations',auth[_0xe6ec('0xb')](),controller['getConfigurations']);router[_0xe6ec('0x9')](_0xe6ec('0xc'),auth[_0xe6ec('0xb')](),controller[_0xe6ec('0xd')]);router['post']('/',auth[_0xe6ec('0xb')](),controller[_0xe6ec('0xe')]);router[_0xe6ec('0xf')](_0xe6ec('0x10'),auth[_0xe6ec('0xb')](),controller[_0xe6ec('0x11')]);router[_0xe6ec('0x12')](_0xe6ec('0xa'),auth[_0xe6ec('0xb')](),controller[_0xe6ec('0x13')]);router[_0xe6ec('0x14')]('/:id',auth['isAuthenticated'](),controller[_0xe6ec('0x15')]);module[_0xe6ec('0x16')]=router; \ No newline at end of file +var _0xaaed=['path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','/:id','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','update','delete','destroy','exports','multer'];(function(_0x4f2bfe,_0x2e9933){var _0x1a2b41=function(_0x213136){while(--_0x213136){_0x4f2bfe['push'](_0x4f2bfe['shift']());}};_0x1a2b41(++_0x2e9933);}(_0xaaed,0xfb));var _0xdaae=function(_0x1a2dc7,_0x1541d6){_0x1a2dc7=_0x1a2dc7-0x0;var _0x22ff20=_0xaaed[_0x1a2dc7];return _0x22ff20;};'use strict';var multer=require(_0xdaae('0x0'));var util=require('util');var path=require(_0xdaae('0x1'));var timeout=require('connect-timeout');var express=require(_0xdaae('0x2'));var router=express[_0xdaae('0x3')]();var auth=require(_0xdaae('0x4'));var interaction=require(_0xdaae('0x5'));var config=require(_0xdaae('0x6'));var controller=require('./intZohoAccount.controller');router['get']('/',auth[_0xdaae('0x7')](),controller['index']);router[_0xdaae('0x8')](_0xdaae('0x9'),auth[_0xdaae('0x7')](),controller['show']);router[_0xdaae('0x8')](_0xdaae('0xa'),auth[_0xdaae('0x7')](),controller[_0xdaae('0xb')]);router[_0xdaae('0x8')](_0xdaae('0xc'),auth[_0xdaae('0x7')](),controller[_0xdaae('0xd')]);router[_0xdaae('0xe')]('/',auth['isAuthenticated'](),controller[_0xdaae('0xf')]);router[_0xdaae('0xe')](_0xdaae('0xa'),auth[_0xdaae('0x7')](),controller[_0xdaae('0x10')]);router['put'](_0xdaae('0x9'),auth[_0xdaae('0x7')](),controller[_0xdaae('0x11')]);router[_0xdaae('0x12')]('/:id',auth[_0xdaae('0x7')](),controller[_0xdaae('0x13')]);module[_0xdaae('0x14')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index 6fc0ed6..c85cde5 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 _0x5669=['exports','STRING'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x5669,0xc6));var _0x9566=function(_0x3c2576,_0x10994b){_0x3c2576=_0x3c2576-0x0;var _0x3435d0=_0x5669[_0x3c2576];return _0x3435d0;};'use strict';var Sequelize=require('sequelize');module[_0x9566('0x0')]={'name':{'type':Sequelize[_0x9566('0x1')]},'description':{'type':Sequelize[_0x9566('0x1')]},'host':{'type':Sequelize['STRING']},'zone':{'type':Sequelize[_0x9566('0x1')]},'clientId':{'type':Sequelize[_0x9566('0x1')]},'clientSecret':{'type':Sequelize[_0x9566('0x1')]},'serverUrl':{'type':Sequelize['STRING']},'code':{'type':Sequelize[_0x9566('0x1')]},'refreshToken':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x604f=['STRING','exports'];(function(_0xd8cb52,_0x52e114){var _0x324504=function(_0x56b935){while(--_0x56b935){_0xd8cb52['push'](_0xd8cb52['shift']());}};_0x324504(++_0x52e114);}(_0x604f,0x16b));var _0xf604=function(_0x1b2ff7,_0x12a034){_0x1b2ff7=_0x1b2ff7-0x0;var _0x31656a=_0x604f[_0x1b2ff7];return _0x31656a;};'use strict';var Sequelize=require('sequelize');module[_0xf604('0x0')]={'name':{'type':Sequelize[_0xf604('0x1')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xf604('0x1')]},'zone':{'type':Sequelize[_0xf604('0x1')]},'clientId':{'type':Sequelize[_0xf604('0x1')]},'clientSecret':{'type':Sequelize[_0xf604('0x1')]},'serverUrl':{'type':Sequelize['STRING']},'code':{'type':Sequelize['STRING']},'refreshToken':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index 55159df..60323a7 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 _0x5084=['index','ZohoAccount','rawAttributes','type','key','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','map','VIRTUAL','options','include','rows','catch','show','params','includeAll','find','body','update','getConfigurations','findOne','ZohoConfiguration','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','create','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','serverUrl','zoho.eu','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','Owner','Description','WhoId','Call_Duration','Call_Result','remove','api_name','push','display_label','custom_field','data_type','pick_list_values','statusCode','getFields,\x20%s,\x20%s,\x20%s','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','info','ZohoAccount,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','end','status','json','count','offset','limit','Content-Range','apply','save','then','destroy','stack','name','send'];(function(_0x2882da,_0x467427){var _0x351813=function(_0x195616){while(--_0x195616){_0x2882da['push'](_0x2882da['shift']());}};_0x351813(++_0x467427);}(_0x5084,0xde));var _0x4508=function(_0x55235c,_0x7afbe8){_0x55235c=_0x55235c-0x0;var _0x49ed97=_0x5084[_0x55235c];return _0x49ed97;};'use strict';var pdf=require(_0x4508('0x0'));var emlformat=require(_0x4508('0x1'));var rimraf=require(_0x4508('0x2'));var zipdir=require(_0x4508('0x3'));var jsonpatch=require(_0x4508('0x4'));var rp=require(_0x4508('0x5'));var moment=require(_0x4508('0x6'));var BPromise=require(_0x4508('0x7'));var Mustache=require(_0x4508('0x8'));var util=require(_0x4508('0x9'));var path=require(_0x4508('0xa'));var sox=require(_0x4508('0xb'));var csv=require(_0x4508('0xc'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x4508('0xd'));var squel=require(_0x4508('0xe'));var crypto=require(_0x4508('0xf'));var jsforce=require(_0x4508('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x4508('0xc'));var querystring=require('querystring');var Papa=require(_0x4508('0x11'));var Redis=require(_0x4508('0x12'));var authService=require(_0x4508('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x4508('0x14'));var hardwareService=require(_0x4508('0x15'));var logger=require('../../config/logger')(_0x4508('0x16'));var utils=require(_0x4508('0x17'));var config=require(_0x4508('0x18'));var db=require(_0x4508('0x19'))['db'];var integrations=require(_0x4508('0x1a'));var jayson=require(_0x4508('0x1b'));var client=jayson[_0x4508('0x1c')][_0x4508('0x1d')]({'port':0x232a});function checkPasswordPattern(_0x566946,_0x319637,_0x2a002a){if(_0x2a002a){var _0x5980df=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5980df[_0x4508('0x1e')](_0x319637)){return _0x566946;}else{throw new db[(_0x4508('0x1f'))][(_0x4508('0x20'))](_0x4508('0x21'));}}else{return _0x566946;}}function respondWithRpcPromise(_0x11aa25,_0x4c8c5e,_0x483b21,_0x7561ce){return new BPromise(function(_0x1c5854,_0x353501){var _0x5e41b2=_0x7561ce||client;return _0x5e41b2['request'](_0x11aa25,_0x483b21)['then'](function(_0x4b1a56){logger[_0x4508('0x22')](_0x4508('0x23'),_0x4c8c5e,'request\x20sent');logger['debug']('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x4c8c5e,'request\x20sent',JSON[_0x4508('0x24')](_0x4b1a56));if(_0x4b1a56[_0x4508('0x25')]){if(_0x4b1a56[_0x4508('0x25')][_0x4508('0x26')]===0x1f4){logger[_0x4508('0x25')](_0x4508('0x23'),_0x4c8c5e,_0x4b1a56[_0x4508('0x25')][_0x4508('0x27')]);return _0x353501(_0x4b1a56[_0x4508('0x25')][_0x4508('0x27')]);}logger['error'](_0x4508('0x23'),_0x4c8c5e,_0x4b1a56['error']['message']);return _0x1c5854(_0x4b1a56[_0x4508('0x25')][_0x4508('0x27')]);}else{logger[_0x4508('0x22')](_0x4508('0x23'),_0x4c8c5e,'request\x20sent');_0x1c5854(_0x4b1a56[_0x4508('0x28')][_0x4508('0x27')]);}})['catch'](function(_0x3aaa6f){logger[_0x4508('0x25')](_0x4508('0x23'),_0x4c8c5e,_0x3aaa6f);_0x353501(_0x3aaa6f);});});}function respondWithStatusCode(_0x187b0c,_0x43ca07){_0x43ca07=_0x43ca07||0xcc;return function(_0x597c66){if(_0x597c66){return _0x187b0c[_0x4508('0x29')](_0x43ca07);}return _0x187b0c['status'](_0x43ca07)[_0x4508('0x2a')]();};}function respondWithResult(_0x6d4b23,_0x59d050){_0x59d050=_0x59d050||0xc8;return function(_0x14c2b5){if(_0x14c2b5){return _0x6d4b23[_0x4508('0x2b')](_0x59d050)[_0x4508('0x2c')](_0x14c2b5);}};}function respondWithFilteredResult(_0x190d02,_0x407a8a){return function(_0x384648){if(_0x384648){var _0x4c944a=_0x384648[_0x4508('0x2d')],_0x3b604d=_0x407a8a['offset'],_0x1a5b77=_0x407a8a[_0x4508('0x2e')]+_0x407a8a[_0x4508('0x2f')],_0x3b5fe9;if(_0x1a5b77>=_0x4c944a){_0x1a5b77=_0x4c944a;_0x3b5fe9=0xc8;}else{_0x3b5fe9=0xce;}_0x190d02[_0x4508('0x2b')](_0x3b5fe9);return _0x190d02['set'](_0x4508('0x30'),_0x3b604d+'-'+_0x1a5b77+'/'+_0x4c944a)[_0x4508('0x2c')](_0x384648);}return null;};}function patchUpdates(_0x1fdf01){return function(_0x1b6c4e){try{jsonpatch[_0x4508('0x31')](_0x1b6c4e,_0x1fdf01,!![]);}catch(_0x1c498f){return BPromise['reject'](_0x1c498f);}return _0x1b6c4e[_0x4508('0x32')]();};}function saveUpdates(_0x3f3aee,_0x585c30){return function(_0x2935ea){if(_0x2935ea){return _0x2935ea['update'](_0x3f3aee)[_0x4508('0x33')](function(_0x5cf065){return _0x5cf065;});}return null;};}function removeEntity(_0x4bb6b9,_0x10fd1b){return function(_0x346214){if(_0x346214){return _0x346214[_0x4508('0x34')]()['then'](function(){_0x4bb6b9[_0x4508('0x2b')](0xcc)[_0x4508('0x2a')]();});}};}function handleEntityNotFound(_0x224512,_0x4aed55){return function(_0x5f4c5e){if(!_0x5f4c5e){_0x224512['sendStatus'](0x194);}return _0x5f4c5e;};}function handleError(_0x33f6dc,_0x51d9b0){_0x51d9b0=_0x51d9b0||0x1f4;return function(_0x1c1373){logger['error'](_0x1c1373[_0x4508('0x35')]);if(_0x1c1373[_0x4508('0x36')]){delete _0x1c1373[_0x4508('0x36')];}_0x33f6dc[_0x4508('0x2b')](_0x51d9b0)[_0x4508('0x37')](_0x1c1373);};}exports[_0x4508('0x38')]=function(_0x27c44f,_0x7ee3bf){var _0x3499e6={},_0x373122={},_0x72c60f={'count':0x0,'rows':[]};var _0x3d6772=_['map'](db[_0x4508('0x39')][_0x4508('0x3a')],function(_0x53df85){return{'name':_0x53df85['fieldName'],'type':_0x53df85[_0x4508('0x3b')][_0x4508('0x3c')]};});_0x373122[_0x4508('0x3d')]=_['map'](_0x3d6772,_0x4508('0x36'));_0x373122['query']=_[_0x4508('0x3e')](_0x27c44f['query']);_0x373122['filters']=_['intersection'](_0x373122[_0x4508('0x3d')],_0x373122[_0x4508('0x3f')]);_0x3499e6['attributes']=_[_0x4508('0x40')](_0x373122[_0x4508('0x3d')],qs[_0x4508('0x41')](_0x27c44f[_0x4508('0x3f')][_0x4508('0x41')]));_0x3499e6[_0x4508('0x42')]=_0x3499e6[_0x4508('0x42')][_0x4508('0x43')]?_0x3499e6[_0x4508('0x42')]:_0x373122[_0x4508('0x3d')];if(!_0x27c44f[_0x4508('0x3f')][_0x4508('0x44')](_0x4508('0x45'))){_0x3499e6[_0x4508('0x2f')]=qs[_0x4508('0x2f')](_0x27c44f[_0x4508('0x3f')][_0x4508('0x2f')]);_0x3499e6['offset']=qs['offset'](_0x27c44f[_0x4508('0x3f')][_0x4508('0x2e')]);}_0x3499e6[_0x4508('0x46')]=qs[_0x4508('0x47')](_0x27c44f[_0x4508('0x3f')][_0x4508('0x47')]);_0x3499e6[_0x4508('0x48')]=qs[_0x4508('0x49')](_[_0x4508('0x4a')](_0x27c44f['query'],_0x373122['filters']));if(_0x27c44f[_0x4508('0x3f')][_0x4508('0x4b')]){_0x3499e6[_0x4508('0x48')]=_[_0x4508('0x4c')](_0x3499e6[_0x4508('0x48')],{'$or':_[_0x4508('0x4d')](_0x3d6772,function(_0x37d963){if(_0x37d963[_0x4508('0x3b')]!==_0x4508('0x4e')){var _0x14cf41={};_0x14cf41[_0x37d963['name']]={'$like':'%'+_0x27c44f[_0x4508('0x3f')][_0x4508('0x4b')]+'%'};return _0x14cf41;}})});}_0x3499e6=_[_0x4508('0x4c')]({},_0x3499e6,_0x27c44f[_0x4508('0x4f')]);var _0x101544={'where':_0x3499e6['where']};return db['ZohoAccount'][_0x4508('0x2d')](_0x101544)[_0x4508('0x33')](function(_0x2b9302){_0x72c60f['count']=_0x2b9302;if(_0x27c44f['query']['includeAll']){_0x3499e6[_0x4508('0x50')]=[{'all':!![]}];}return db[_0x4508('0x39')]['findAll'](_0x3499e6);})[_0x4508('0x33')](function(_0x51199f){_0x72c60f[_0x4508('0x51')]=_0x51199f;return _0x72c60f;})['then'](respondWithFilteredResult(_0x7ee3bf,_0x3499e6))[_0x4508('0x52')](handleError(_0x7ee3bf,null));};exports[_0x4508('0x53')]=function(_0x95f7dd,_0x280dc6){var _0x575e19={'raw':![],'where':{'id':_0x95f7dd[_0x4508('0x54')]['id']}},_0x24dc60={};_0x24dc60[_0x4508('0x3d')]=_[_0x4508('0x3e')](db[_0x4508('0x39')][_0x4508('0x3a')]);_0x24dc60['query']=_[_0x4508('0x3e')](_0x95f7dd[_0x4508('0x3f')]);_0x24dc60['filters']=_[_0x4508('0x40')](_0x24dc60[_0x4508('0x3d')],_0x24dc60[_0x4508('0x3f')]);_0x575e19[_0x4508('0x42')]=_[_0x4508('0x40')](_0x24dc60[_0x4508('0x3d')],qs['fields'](_0x95f7dd[_0x4508('0x3f')][_0x4508('0x41')]));_0x575e19[_0x4508('0x42')]=_0x575e19[_0x4508('0x42')]['length']?_0x575e19[_0x4508('0x42')]:_0x24dc60['model'];if(_0x95f7dd[_0x4508('0x3f')][_0x4508('0x55')]){_0x575e19['include']=[{'all':!![]}];}_0x575e19=_['merge']({},_0x575e19,_0x95f7dd['options']);return db[_0x4508('0x39')][_0x4508('0x56')](_0x575e19)[_0x4508('0x33')](handleEntityNotFound(_0x280dc6,null))['then'](respondWithResult(_0x280dc6,null))[_0x4508('0x52')](handleError(_0x280dc6,null));};exports['create']=function(_0x5a8181,_0x30899d){return db[_0x4508('0x39')]['create'](_0x5a8181[_0x4508('0x57')],{})[_0x4508('0x33')](respondWithResult(_0x30899d,0xc9))[_0x4508('0x52')](handleError(_0x30899d,null));};exports[_0x4508('0x58')]=function(_0x448a05,_0x19d124){if(_0x448a05['body']['id']){delete _0x448a05[_0x4508('0x57')]['id'];}return db[_0x4508('0x39')][_0x4508('0x56')]({'where':{'id':_0x448a05['params']['id']}})[_0x4508('0x33')](handleEntityNotFound(_0x19d124,null))[_0x4508('0x33')](saveUpdates(_0x448a05[_0x4508('0x57')],null))[_0x4508('0x33')](respondWithResult(_0x19d124,null))[_0x4508('0x52')](handleError(_0x19d124,null));};exports[_0x4508('0x34')]=function(_0x13de1a,_0x184092){return db[_0x4508('0x39')]['find']({'where':{'id':_0x13de1a['params']['id']}})[_0x4508('0x33')](handleEntityNotFound(_0x184092,null))[_0x4508('0x33')](removeEntity(_0x184092,null))[_0x4508('0x52')](handleError(_0x184092,null));};exports[_0x4508('0x59')]=function(_0x4d3eaa,_0x2ee8e0,_0x101bb4){var _0x1b56d7={};var _0x1e7622={};var _0x3b2c6c;var _0x5adbb6;return db[_0x4508('0x39')][_0x4508('0x5a')]({'where':{'id':_0x4d3eaa['params']['id']}})[_0x4508('0x33')](handleEntityNotFound(_0x2ee8e0,null))[_0x4508('0x33')](function(_0x538ffd){if(_0x538ffd){_0x3b2c6c=_0x538ffd;_0x1e7622[_0x4508('0x3d')]=_[_0x4508('0x3e')](db[_0x4508('0x5b')]['rawAttributes']);_0x1e7622['query']=_[_0x4508('0x3e')](_0x4d3eaa['query']);_0x1e7622[_0x4508('0x49')]=_['intersection'](_0x1e7622[_0x4508('0x3d')],_0x1e7622[_0x4508('0x3f')]);_0x1b56d7['attributes']=_[_0x4508('0x40')](_0x1e7622[_0x4508('0x3d')],qs[_0x4508('0x41')](_0x4d3eaa['query']['fields']));_0x1b56d7['attributes']=_0x1b56d7['attributes']['length']?_0x1b56d7[_0x4508('0x42')]:_0x1e7622['model'];_0x1b56d7[_0x4508('0x46')]=qs['sort'](_0x4d3eaa[_0x4508('0x3f')][_0x4508('0x47')]);_0x1b56d7[_0x4508('0x48')]=qs[_0x4508('0x49')](_[_0x4508('0x4a')](_0x4d3eaa[_0x4508('0x3f')],_0x1e7622[_0x4508('0x49')]));if(_0x4d3eaa[_0x4508('0x3f')][_0x4508('0x4b')]){_0x1b56d7[_0x4508('0x48')]=_[_0x4508('0x4c')](_0x1b56d7[_0x4508('0x48')],{'$or':_[_0x4508('0x4d')](_0x1b56d7[_0x4508('0x42')],function(_0x5694b1){var _0x2a30ab={};_0x2a30ab[_0x5694b1]={'$like':'%'+_0x4d3eaa[_0x4508('0x3f')][_0x4508('0x4b')]+'%'};return _0x2a30ab;})});}_0x1b56d7=_[_0x4508('0x4c')]({},_0x1b56d7,_0x4d3eaa['options']);return _0x3b2c6c['getConfigurations'](_0x1b56d7);}})[_0x4508('0x33')](function(_0x52201b){if(_0x52201b){_0x5adbb6=_0x52201b[_0x4508('0x43')];if(!_0x4d3eaa[_0x4508('0x3f')]['hasOwnProperty']('nolimit')){_0x1b56d7['limit']=qs[_0x4508('0x2f')](_0x4d3eaa['query'][_0x4508('0x2f')]);_0x1b56d7[_0x4508('0x2e')]=qs[_0x4508('0x2e')](_0x4d3eaa[_0x4508('0x3f')][_0x4508('0x2e')]);}return _0x3b2c6c[_0x4508('0x59')](_0x1b56d7);}})[_0x4508('0x33')](function(_0x208599){if(_0x208599){return _0x208599?{'count':_0x5adbb6,'rows':_0x208599}:null;}})[_0x4508('0x33')](respondWithResult(_0x2ee8e0,null))['catch'](handleError(_0x2ee8e0,null));};exports[_0x4508('0x5c')]=function(_0x4c6387,_0x49d8cf,_0x23a800){if(_0x4c6387['body']['id']){delete _0x4c6387[_0x4508('0x57')]['id'];}return db[_0x4508('0x39')][_0x4508('0x5a')]({'where':{'id':_0x4c6387[_0x4508('0x54')]['id']}})[_0x4508('0x33')](handleEntityNotFound(_0x49d8cf,null))[_0x4508('0x33')](function(_0x51fbc8){if(_0x51fbc8){_0x4c6387[_0x4508('0x57')][_0x4508('0x5d')]=_0x51fbc8['id'];_0x4c6387[_0x4508('0x57')][_0x4508('0x5e')]=integrations[_0x4508('0x5f')](_0x4c6387['body'][_0x4508('0x60')],_0x4c6387[_0x4508('0x57')][_0x4508('0x3b')]);_0x4c6387[_0x4508('0x57')][_0x4508('0x61')]=integrations[_0x4508('0x62')](_0x4c6387['body'][_0x4508('0x60')],_0x4c6387[_0x4508('0x57')][_0x4508('0x3b')]);return db[_0x4508('0x5b')][_0x4508('0x63')](_0x4c6387[_0x4508('0x57')],{'include':[{'model':db['ZohoField'],'as':_0x4508('0x5e')},{'model':db['ZohoField'],'as':'Descriptions'}]});}return null;})[_0x4508('0x33')](respondWithResult(_0x49d8cf,null))[_0x4508('0x52')](handleError(_0x49d8cf,null));};function getAccessToken(_0x2f48b8){return new Promise(function(_0x2731ff,_0x2f4c66){var _0x48b301;switch(_0x2f48b8[_0x4508('0x64')]){case'US':_0x48b301=_0x4508('0x65');break;case'AU':_0x48b301=_0x4508('0x66');break;case'EU':_0x48b301='https://accounts.zoho.eu';break;case'IN':_0x48b301='https://accounts.zoho.in';break;case'CN':_0x48b301=_0x4508('0x67');break;default:_0x48b301=_0x4508('0x68');break;}var _0x231ce1={'method':_0x4508('0x69'),'uri':_0x48b301+_0x4508('0x6a'),'qs':{'refresh_token':_0x2f48b8[_0x4508('0x6b')],'client_id':_0x2f48b8[_0x4508('0x6c')],'client_secret':_0x2f48b8[_0x4508('0x6d')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x231ce1)[_0x4508('0x33')](function(_0x201cfb){if(_0x201cfb['access_token']){_0x2731ff(_0x201cfb[_0x4508('0x6e')]);}else{_0x2f4c66(_0x4508('0x6f'));}})[_0x4508('0x52')](function(_0x5527f6){_0x2f4c66(_0x5527f6);});});}exports[_0x4508('0x70')]=function(_0x2e46ec,_0x4e39a0,_0x2b4600){var _0x456e37,_0x1ccc30,_0x385844,_0x2d2cb9,_0x153d56;return db[_0x4508('0x39')]['findOne']({'where':{'id':_0x2e46ec[_0x4508('0x54')]['id']},'attributes':['id',_0x4508('0x71'),_0x4508('0x64'),'clientId',_0x4508('0x6d'),_0x4508('0x72'),_0x4508('0x26'),'refreshToken']})[_0x4508('0x33')](handleEntityNotFound(_0x4e39a0,null))[_0x4508('0x33')](function(_0x3deedc){_0x153d56=_0x3deedc;_0x456e37=_0x153d56[_0x4508('0x71')];_0x1ccc30=_0x456e37===_0x4508('0x73')?'eu':'com';_0x385844=_0x153d56[_0x4508('0x72')];var _0x61ade7=_0x385844[_0x4508('0x74')](-0x1);if(_0x61ade7==='/'||_0x61ade7==='\x5c'||_0x61ade7===':'){_0x385844=_0x385844[_0x4508('0x75')](0x0,_0x385844[_0x4508('0x76')](_0x61ade7));}if(!_0x153d56['refreshToken']){throw new Error(_0x4508('0x77'));}return getAccessToken(_0x153d56);})['then'](function(_0x377237){if(_0x377237){return rp({'method':_0x4508('0x78'),'uri':util['format'](_0x4508('0x79'),_0x1ccc30),'qs':{'module':_0x4508('0x7a')},'headers':{'Authorization':_0x4508('0x7b')+_0x377237},'json':!![]});}})[_0x4508('0x33')](function(_0x732d96){if(_0x732d96){if(_0x732d96[_0x4508('0x7c')]&&_0x732d96[_0x4508('0x7c')][_0x4508('0x25')]){throw new Error(_0x732d96[_0x4508('0x7c')][_0x4508('0x25')][_0x4508('0x27')]);}var _0x4be744=[];var _0x1b3d69=[];var _0x178e6c=[_0x4508('0x7d'),'Subject',_0x4508('0x7e'),_0x4508('0x7f'),_0x4508('0x80'),_0x4508('0x81'),'Call_Start_Time','Call_Type'];_0x1b3d69=_[_0x4508('0x82')](_0x732d96[_0x4508('0x41')],function(_0x1e4767){return _0x178e6c['includes'](_0x1e4767[_0x4508('0x83')]);});for(var _0x3b022b=0x0;_0x3b022b<_0x1b3d69[_0x4508('0x43')];_0x3b022b++){if(_0x1b3d69[_0x3b022b]['system_mandatory']===![]){_0x4be744[_0x4508('0x84')]({'id':_0x1b3d69[_0x3b022b]['id'],'name':_0x1b3d69[_0x3b022b][_0x4508('0x85')],'custom':_0x1b3d69[_0x3b022b][_0x4508('0x86')],'options':_0x1b3d69[_0x3b022b][_0x4508('0x87')]==='picklist'&&_0x1b3d69[_0x3b022b][_0x4508('0x88')][_0x4508('0x43')]>-0x1?_[_0x4508('0x4d')](_0x1b3d69[_0x3b022b][_0x4508('0x88')],function(_0xacc3d4){return{'name':_0xacc3d4,'value':_0xacc3d4};}):[]});}}return{'count':_0x4be744[_0x4508('0x43')],'rows':_0x4be744};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithResult(_0x4e39a0,null))[_0x4508('0x52')](function(_0x210d61){var _0x2412dd=_0x2e46ec[_0x4508('0x3f')][_0x4508('0x1e')]?0x1f4:_0x210d61[_0x4508('0x89')]||0x1f4;logger[_0x4508('0x25')](_0x4508('0x8a'),'getFields',_0x2412dd,JSON[_0x4508('0x24')](_0x210d61));delete _0x210d61[_0x4508('0x36')];if(_0x2412dd===0x191){_0x2412dd=0x190;}_0x4e39a0[_0x4508('0x2b')](_0x2412dd)[_0x4508('0x37')](_0x2e46ec[_0x4508('0x3f')][_0x4508('0x1e')]?{'message':'Wrong\x20credentials','statusCode':_0x210d61['statusCode']}:_0x210d61);});}; \ No newline at end of file +var _0xd338=['sendStatus','end','status','json','count','offset','limit','set','apply','reject','save','update','then','destroy','name','send','map','ZohoAccount','rawAttributes','key','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','filters','where','filter','merge','options','rows','catch','show','params','includeAll','include','find','create','body','getConfigurations','ZohoConfiguration','pick','hasOwnProperty','addConfiguration','findOne','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','type','ZohoField','https://accounts.zoho.com','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','/oauth/v2/token','refreshToken','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','host','clientId','serverUrl','code','com','slice','substring','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','Owner','Description','WhoId','Call_Duration','Call_Result','Call_Start_Time','Call_Type','remove','includes','system_mandatory','display_label','custom_field','data_type','pick_list_values','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','test','html-pdf','rimraf','request-promise','moment','bluebird','mustache','util','to-csv','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info','request\x20sent','debug','stringify','error','ZohoAccount,\x20%s,\x20%s','message','result'];(function(_0x1f1ef2,_0x333446){var _0x23a065=function(_0x4b455f){while(--_0x4b455f){_0x1f1ef2['push'](_0x1f1ef2['shift']());}};_0x23a065(++_0x333446);}(_0xd338,0x1f4));var _0x8d33=function(_0x571a17,_0x63fb3d){_0x571a17=_0x571a17-0x0;var _0x3ef337=_0xd338[_0x571a17];return _0x3ef337;};'use strict';var pdf=require(_0x8d33('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x8d33('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x8d33('0x2'));var moment=require(_0x8d33('0x3'));var BPromise=require(_0x8d33('0x4'));var Mustache=require(_0x8d33('0x5'));var util=require(_0x8d33('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x8d33('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x8d33('0x8'));var crypto=require(_0x8d33('0x9'));var jsforce=require(_0x8d33('0xa'));var deskjs=require(_0x8d33('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8d33('0xc'));var Redis=require(_0x8d33('0xd'));var authService=require(_0x8d33('0xe'));var qs=require(_0x8d33('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8d33('0x10'));var logger=require(_0x8d33('0x11'))(_0x8d33('0x12'));var utils=require('../../config/utils');var config=require(_0x8d33('0x13'));var db=require(_0x8d33('0x14'))['db'];var integrations=require(_0x8d33('0x15'));var jayson=require(_0x8d33('0x16'));var client=jayson[_0x8d33('0x17')][_0x8d33('0x18')]({'port':0x232a});function checkPasswordPattern(_0x293bb8,_0x182b55,_0x1712d9){if(_0x1712d9){var _0x40f8d6=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x40f8d6['test'](_0x182b55)){return _0x293bb8;}else{throw new db['Sequelize'][(_0x8d33('0x19'))](_0x8d33('0x1a'));}}else{return _0x293bb8;}}function respondWithRpcPromise(_0x22851d,_0x418652,_0x395e66,_0x1c7f61){return new BPromise(function(_0x50ece4,_0x256755){var _0x1a5533=_0x1c7f61||client;return _0x1a5533[_0x8d33('0x1b')](_0x22851d,_0x395e66)['then'](function(_0x586ef0){logger[_0x8d33('0x1c')]('ZohoAccount,\x20%s,\x20%s',_0x418652,_0x8d33('0x1d'));logger[_0x8d33('0x1e')]('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x418652,_0x8d33('0x1d'),JSON[_0x8d33('0x1f')](_0x586ef0));if(_0x586ef0[_0x8d33('0x20')]){if(_0x586ef0[_0x8d33('0x20')]['code']===0x1f4){logger[_0x8d33('0x20')](_0x8d33('0x21'),_0x418652,_0x586ef0[_0x8d33('0x20')]['message']);return _0x256755(_0x586ef0[_0x8d33('0x20')][_0x8d33('0x22')]);}logger[_0x8d33('0x20')](_0x8d33('0x21'),_0x418652,_0x586ef0[_0x8d33('0x20')][_0x8d33('0x22')]);return _0x50ece4(_0x586ef0[_0x8d33('0x20')][_0x8d33('0x22')]);}else{logger[_0x8d33('0x1c')](_0x8d33('0x21'),_0x418652,'request\x20sent');_0x50ece4(_0x586ef0[_0x8d33('0x23')]['message']);}})['catch'](function(_0x47b641){logger['error'](_0x8d33('0x21'),_0x418652,_0x47b641);_0x256755(_0x47b641);});});}function respondWithStatusCode(_0x357028,_0x364740){_0x364740=_0x364740||0xcc;return function(_0x4fd889){if(_0x4fd889){return _0x357028[_0x8d33('0x24')](_0x364740);}return _0x357028['status'](_0x364740)[_0x8d33('0x25')]();};}function respondWithResult(_0x334659,_0x1c93e3){_0x1c93e3=_0x1c93e3||0xc8;return function(_0x4a9df7){if(_0x4a9df7){return _0x334659[_0x8d33('0x26')](_0x1c93e3)[_0x8d33('0x27')](_0x4a9df7);}};}function respondWithFilteredResult(_0xfd5d3a,_0x10ecf6){return function(_0x192318){if(_0x192318){var _0x54f00b=_0x192318[_0x8d33('0x28')],_0x57d943=_0x10ecf6[_0x8d33('0x29')],_0x4e8843=_0x10ecf6[_0x8d33('0x29')]+_0x10ecf6[_0x8d33('0x2a')],_0xccbb21;if(_0x4e8843>=_0x54f00b){_0x4e8843=_0x54f00b;_0xccbb21=0xc8;}else{_0xccbb21=0xce;}_0xfd5d3a[_0x8d33('0x26')](_0xccbb21);return _0xfd5d3a[_0x8d33('0x2b')]('Content-Range',_0x57d943+'-'+_0x4e8843+'/'+_0x54f00b)[_0x8d33('0x27')](_0x192318);}return null;};}function patchUpdates(_0x304a2d){return function(_0x1acb95){try{jsonpatch[_0x8d33('0x2c')](_0x1acb95,_0x304a2d,!![]);}catch(_0x141c04){return BPromise[_0x8d33('0x2d')](_0x141c04);}return _0x1acb95[_0x8d33('0x2e')]();};}function saveUpdates(_0x2ce037,_0x3d8b7a){return function(_0x2b416d){if(_0x2b416d){return _0x2b416d[_0x8d33('0x2f')](_0x2ce037)[_0x8d33('0x30')](function(_0x15592e){return _0x15592e;});}return null;};}function removeEntity(_0x4b7a84,_0x47009b){return function(_0x31eea7){if(_0x31eea7){return _0x31eea7[_0x8d33('0x31')]()[_0x8d33('0x30')](function(){_0x4b7a84['status'](0xcc)[_0x8d33('0x25')]();});}};}function handleEntityNotFound(_0x3bfc75,_0x3d3670){return function(_0x5ac1e6){if(!_0x5ac1e6){_0x3bfc75[_0x8d33('0x24')](0x194);}return _0x5ac1e6;};}function handleError(_0x4d7d00,_0x2fa01f){_0x2fa01f=_0x2fa01f||0x1f4;return function(_0x466d27){logger[_0x8d33('0x20')](_0x466d27['stack']);if(_0x466d27[_0x8d33('0x32')]){delete _0x466d27[_0x8d33('0x32')];}_0x4d7d00[_0x8d33('0x26')](_0x2fa01f)[_0x8d33('0x33')](_0x466d27);};}exports['index']=function(_0x38cbf5,_0xba98d2){var _0x216736={},_0x53bf55={},_0x10508b={'count':0x0,'rows':[]};var _0x43714a=_[_0x8d33('0x34')](db[_0x8d33('0x35')][_0x8d33('0x36')],function(_0x6759c3){return{'name':_0x6759c3['fieldName'],'type':_0x6759c3['type'][_0x8d33('0x37')]};});_0x53bf55[_0x8d33('0x38')]=_[_0x8d33('0x34')](_0x43714a,_0x8d33('0x32'));_0x53bf55[_0x8d33('0x39')]=_[_0x8d33('0x3a')](_0x38cbf5[_0x8d33('0x39')]);_0x53bf55['filters']=_[_0x8d33('0x3b')](_0x53bf55[_0x8d33('0x38')],_0x53bf55[_0x8d33('0x39')]);_0x216736[_0x8d33('0x3c')]=_['intersection'](_0x53bf55[_0x8d33('0x38')],qs[_0x8d33('0x3d')](_0x38cbf5[_0x8d33('0x39')][_0x8d33('0x3d')]));_0x216736[_0x8d33('0x3c')]=_0x216736[_0x8d33('0x3c')][_0x8d33('0x3e')]?_0x216736[_0x8d33('0x3c')]:_0x53bf55[_0x8d33('0x38')];if(!_0x38cbf5[_0x8d33('0x39')]['hasOwnProperty'](_0x8d33('0x3f'))){_0x216736[_0x8d33('0x2a')]=qs[_0x8d33('0x2a')](_0x38cbf5[_0x8d33('0x39')]['limit']);_0x216736['offset']=qs[_0x8d33('0x29')](_0x38cbf5[_0x8d33('0x39')][_0x8d33('0x29')]);}_0x216736[_0x8d33('0x40')]=qs[_0x8d33('0x41')](_0x38cbf5[_0x8d33('0x39')]['sort']);_0x216736['where']=qs['filters'](_['pick'](_0x38cbf5[_0x8d33('0x39')],_0x53bf55[_0x8d33('0x42')]));if(_0x38cbf5[_0x8d33('0x39')]['filter']){_0x216736['where']=_['merge'](_0x216736[_0x8d33('0x43')],{'$or':_['map'](_0x43714a,function(_0x20785d){if(_0x20785d['type']!=='VIRTUAL'){var _0xfb29a1={};_0xfb29a1[_0x20785d[_0x8d33('0x32')]]={'$like':'%'+_0x38cbf5[_0x8d33('0x39')][_0x8d33('0x44')]+'%'};return _0xfb29a1;}})});}_0x216736=_[_0x8d33('0x45')]({},_0x216736,_0x38cbf5[_0x8d33('0x46')]);var _0x2cb93e={'where':_0x216736[_0x8d33('0x43')]};return db[_0x8d33('0x35')][_0x8d33('0x28')](_0x2cb93e)['then'](function(_0x1d382d){_0x10508b[_0x8d33('0x28')]=_0x1d382d;if(_0x38cbf5[_0x8d33('0x39')]['includeAll']){_0x216736['include']=[{'all':!![]}];}return db[_0x8d33('0x35')]['findAll'](_0x216736);})[_0x8d33('0x30')](function(_0x474496){_0x10508b[_0x8d33('0x47')]=_0x474496;return _0x10508b;})[_0x8d33('0x30')](respondWithFilteredResult(_0xba98d2,_0x216736))[_0x8d33('0x48')](handleError(_0xba98d2,null));};exports[_0x8d33('0x49')]=function(_0x4758f6,_0x3b5fc5){var _0x4b5581={'raw':![],'where':{'id':_0x4758f6[_0x8d33('0x4a')]['id']}},_0x52c2bf={};_0x52c2bf[_0x8d33('0x38')]=_[_0x8d33('0x3a')](db[_0x8d33('0x35')][_0x8d33('0x36')]);_0x52c2bf[_0x8d33('0x39')]=_[_0x8d33('0x3a')](_0x4758f6[_0x8d33('0x39')]);_0x52c2bf[_0x8d33('0x42')]=_[_0x8d33('0x3b')](_0x52c2bf[_0x8d33('0x38')],_0x52c2bf[_0x8d33('0x39')]);_0x4b5581[_0x8d33('0x3c')]=_[_0x8d33('0x3b')](_0x52c2bf['model'],qs[_0x8d33('0x3d')](_0x4758f6[_0x8d33('0x39')]['fields']));_0x4b5581[_0x8d33('0x3c')]=_0x4b5581[_0x8d33('0x3c')]['length']?_0x4b5581[_0x8d33('0x3c')]:_0x52c2bf[_0x8d33('0x38')];if(_0x4758f6[_0x8d33('0x39')][_0x8d33('0x4b')]){_0x4b5581[_0x8d33('0x4c')]=[{'all':!![]}];}_0x4b5581=_[_0x8d33('0x45')]({},_0x4b5581,_0x4758f6[_0x8d33('0x46')]);return db[_0x8d33('0x35')][_0x8d33('0x4d')](_0x4b5581)[_0x8d33('0x30')](handleEntityNotFound(_0x3b5fc5,null))[_0x8d33('0x30')](respondWithResult(_0x3b5fc5,null))['catch'](handleError(_0x3b5fc5,null));};exports[_0x8d33('0x4e')]=function(_0x2cf53e,_0x28cadd){return db['ZohoAccount'][_0x8d33('0x4e')](_0x2cf53e[_0x8d33('0x4f')],{})[_0x8d33('0x30')](respondWithResult(_0x28cadd,0xc9))['catch'](handleError(_0x28cadd,null));};exports[_0x8d33('0x2f')]=function(_0x1c192e,_0x1d5216){if(_0x1c192e[_0x8d33('0x4f')]['id']){delete _0x1c192e[_0x8d33('0x4f')]['id'];}return db[_0x8d33('0x35')][_0x8d33('0x4d')]({'where':{'id':_0x1c192e[_0x8d33('0x4a')]['id']}})[_0x8d33('0x30')](handleEntityNotFound(_0x1d5216,null))[_0x8d33('0x30')](saveUpdates(_0x1c192e[_0x8d33('0x4f')],null))[_0x8d33('0x30')](respondWithResult(_0x1d5216,null))['catch'](handleError(_0x1d5216,null));};exports[_0x8d33('0x31')]=function(_0x123ddd,_0x37ddea){return db[_0x8d33('0x35')]['find']({'where':{'id':_0x123ddd[_0x8d33('0x4a')]['id']}})[_0x8d33('0x30')](handleEntityNotFound(_0x37ddea,null))[_0x8d33('0x30')](removeEntity(_0x37ddea,null))['catch'](handleError(_0x37ddea,null));};exports[_0x8d33('0x50')]=function(_0x3d9d53,_0x308523,_0x2a5689){var _0x42ec90={};var _0x352d76={};var _0x428832;var _0x42e629;return db['ZohoAccount']['findOne']({'where':{'id':_0x3d9d53['params']['id']}})[_0x8d33('0x30')](handleEntityNotFound(_0x308523,null))[_0x8d33('0x30')](function(_0x46230f){if(_0x46230f){_0x428832=_0x46230f;_0x352d76[_0x8d33('0x38')]=_[_0x8d33('0x3a')](db[_0x8d33('0x51')][_0x8d33('0x36')]);_0x352d76['query']=_[_0x8d33('0x3a')](_0x3d9d53[_0x8d33('0x39')]);_0x352d76['filters']=_['intersection'](_0x352d76[_0x8d33('0x38')],_0x352d76[_0x8d33('0x39')]);_0x42ec90[_0x8d33('0x3c')]=_[_0x8d33('0x3b')](_0x352d76[_0x8d33('0x38')],qs['fields'](_0x3d9d53[_0x8d33('0x39')][_0x8d33('0x3d')]));_0x42ec90[_0x8d33('0x3c')]=_0x42ec90[_0x8d33('0x3c')]['length']?_0x42ec90[_0x8d33('0x3c')]:_0x352d76[_0x8d33('0x38')];_0x42ec90['order']=qs['sort'](_0x3d9d53['query'][_0x8d33('0x41')]);_0x42ec90[_0x8d33('0x43')]=qs[_0x8d33('0x42')](_[_0x8d33('0x52')](_0x3d9d53['query'],_0x352d76[_0x8d33('0x42')]));if(_0x3d9d53[_0x8d33('0x39')][_0x8d33('0x44')]){_0x42ec90[_0x8d33('0x43')]=_[_0x8d33('0x45')](_0x42ec90['where'],{'$or':_[_0x8d33('0x34')](_0x42ec90[_0x8d33('0x3c')],function(_0x1b2cd7){var _0x2bfd2e={};_0x2bfd2e[_0x1b2cd7]={'$like':'%'+_0x3d9d53[_0x8d33('0x39')][_0x8d33('0x44')]+'%'};return _0x2bfd2e;})});}_0x42ec90=_[_0x8d33('0x45')]({},_0x42ec90,_0x3d9d53[_0x8d33('0x46')]);return _0x428832[_0x8d33('0x50')](_0x42ec90);}})[_0x8d33('0x30')](function(_0x459c07){if(_0x459c07){_0x42e629=_0x459c07[_0x8d33('0x3e')];if(!_0x3d9d53[_0x8d33('0x39')][_0x8d33('0x53')](_0x8d33('0x3f'))){_0x42ec90[_0x8d33('0x2a')]=qs[_0x8d33('0x2a')](_0x3d9d53['query'][_0x8d33('0x2a')]);_0x42ec90[_0x8d33('0x29')]=qs[_0x8d33('0x29')](_0x3d9d53['query']['offset']);}return _0x428832['getConfigurations'](_0x42ec90);}})['then'](function(_0x553cb8){if(_0x553cb8){return _0x553cb8?{'count':_0x42e629,'rows':_0x553cb8}:null;}})[_0x8d33('0x30')](respondWithResult(_0x308523,null))[_0x8d33('0x48')](handleError(_0x308523,null));};exports[_0x8d33('0x54')]=function(_0x4afabb,_0x24d0c9,_0x48b4df){if(_0x4afabb['body']['id']){delete _0x4afabb[_0x8d33('0x4f')]['id'];}return db[_0x8d33('0x35')][_0x8d33('0x55')]({'where':{'id':_0x4afabb[_0x8d33('0x4a')]['id']}})[_0x8d33('0x30')](handleEntityNotFound(_0x24d0c9,null))['then'](function(_0x4c1fb9){if(_0x4c1fb9){_0x4afabb['body'][_0x8d33('0x56')]=_0x4c1fb9['id'];_0x4afabb[_0x8d33('0x4f')][_0x8d33('0x57')]=integrations[_0x8d33('0x58')](_0x4afabb[_0x8d33('0x4f')]['channel'],_0x4afabb[_0x8d33('0x4f')]['type']);_0x4afabb[_0x8d33('0x4f')][_0x8d33('0x59')]=integrations[_0x8d33('0x5a')](_0x4afabb[_0x8d33('0x4f')]['channel'],_0x4afabb[_0x8d33('0x4f')][_0x8d33('0x5b')]);return db[_0x8d33('0x51')][_0x8d33('0x4e')](_0x4afabb[_0x8d33('0x4f')],{'include':[{'model':db[_0x8d33('0x5c')],'as':_0x8d33('0x57')},{'model':db[_0x8d33('0x5c')],'as':_0x8d33('0x59')}]});}return null;})[_0x8d33('0x30')](respondWithResult(_0x24d0c9,null))[_0x8d33('0x48')](handleError(_0x24d0c9,null));};function getAccessToken(_0x5b4214){return new Promise(function(_0x2e0725,_0x4eee2a){var _0x1d8e14;switch(_0x5b4214['zone']){case'US':_0x1d8e14=_0x8d33('0x5d');break;case'AU':_0x1d8e14='https://accounts.zoho.com.au';break;case'EU':_0x1d8e14=_0x8d33('0x5e');break;case'IN':_0x1d8e14=_0x8d33('0x5f');break;case'CN':_0x1d8e14=_0x8d33('0x60');break;default:_0x1d8e14='https://accounts.zoho.eu';break;}var _0x1904dd={'method':'POST','uri':_0x1d8e14+_0x8d33('0x61'),'qs':{'refresh_token':_0x5b4214[_0x8d33('0x62')],'client_id':_0x5b4214['clientId'],'client_secret':_0x5b4214[_0x8d33('0x63')],'grant_type':_0x8d33('0x64')},'json':!![]};return rp(_0x1904dd)[_0x8d33('0x30')](function(_0x2faf8c){if(_0x2faf8c[_0x8d33('0x65')]){_0x2e0725(_0x2faf8c[_0x8d33('0x65')]);}else{_0x4eee2a(_0x8d33('0x66'));}})['catch'](function(_0x1ea2b5){_0x4eee2a(_0x1ea2b5);});});}exports['getFields']=function(_0x237f77,_0x587e7f,_0x28c68c){var _0x2ede30,_0x2ed657,_0x465d5b,_0x280469,_0x9eb994;return db[_0x8d33('0x35')][_0x8d33('0x55')]({'where':{'id':_0x237f77['params']['id']},'attributes':['id',_0x8d33('0x67'),'zone',_0x8d33('0x68'),'clientSecret',_0x8d33('0x69'),_0x8d33('0x6a'),_0x8d33('0x62')]})['then'](handleEntityNotFound(_0x587e7f,null))[_0x8d33('0x30')](function(_0x25dc4a){_0x9eb994=_0x25dc4a;_0x2ede30=_0x9eb994[_0x8d33('0x67')];_0x2ed657=_0x2ede30==='zoho.eu'?'eu':_0x8d33('0x6b');_0x465d5b=_0x9eb994['serverUrl'];var _0x54eb38=_0x465d5b[_0x8d33('0x6c')](-0x1);if(_0x54eb38==='/'||_0x54eb38==='\x5c'||_0x54eb38===':'){_0x465d5b=_0x465d5b[_0x8d33('0x6d')](0x0,_0x465d5b['lastIndexOf'](_0x54eb38));}if(!_0x9eb994['refreshToken']){throw new Error(_0x8d33('0x6e'));}return getAccessToken(_0x9eb994);})[_0x8d33('0x30')](function(_0x222f3b){if(_0x222f3b){return rp({'method':_0x8d33('0x6f'),'uri':util[_0x8d33('0x70')](_0x8d33('0x71'),_0x2ed657),'qs':{'module':_0x8d33('0x72')},'headers':{'Authorization':_0x8d33('0x73')+_0x222f3b},'json':!![]});}})[_0x8d33('0x30')](function(_0x22b5da){if(_0x22b5da){if(_0x22b5da['response']&&_0x22b5da['response'][_0x8d33('0x20')]){throw new Error(_0x22b5da['response']['error'][_0x8d33('0x22')]);}var _0x471401=[];var _0x4620ca=[];var _0x1f4ad0=[_0x8d33('0x74'),'Subject',_0x8d33('0x75'),_0x8d33('0x76'),_0x8d33('0x77'),_0x8d33('0x78'),_0x8d33('0x79'),_0x8d33('0x7a')];_0x4620ca=_[_0x8d33('0x7b')](_0x22b5da[_0x8d33('0x3d')],function(_0x2fdae0){return _0x1f4ad0[_0x8d33('0x7c')](_0x2fdae0['api_name']);});for(var _0x451dc0=0x0;_0x451dc0<_0x4620ca[_0x8d33('0x3e')];_0x451dc0++){if(_0x4620ca[_0x451dc0][_0x8d33('0x7d')]===![]){_0x471401['push']({'id':_0x4620ca[_0x451dc0]['id'],'name':_0x4620ca[_0x451dc0][_0x8d33('0x7e')],'custom':_0x4620ca[_0x451dc0][_0x8d33('0x7f')],'options':_0x4620ca[_0x451dc0][_0x8d33('0x80')]==='picklist'&&_0x4620ca[_0x451dc0][_0x8d33('0x81')]['length']>-0x1?_[_0x8d33('0x34')](_0x4620ca[_0x451dc0][_0x8d33('0x81')],function(_0x48acbd){return{'name':_0x48acbd,'value':_0x48acbd};}):[]});}}return{'count':_0x471401[_0x8d33('0x3e')],'rows':_0x471401};}else{return{'count':0x0,'rows':[]};}})[_0x8d33('0x30')](respondWithResult(_0x587e7f,null))['catch'](function(_0x97ba24){var _0x505d71=_0x237f77['query']['test']?0x1f4:_0x97ba24[_0x8d33('0x82')]||0x1f4;logger[_0x8d33('0x20')](_0x8d33('0x83'),_0x8d33('0x84'),_0x505d71,JSON[_0x8d33('0x1f')](_0x97ba24));delete _0x97ba24['name'];if(_0x505d71===0x191){_0x505d71=0x190;}_0x587e7f[_0x8d33('0x26')](_0x505d71)[_0x8d33('0x33')](_0x237f77[_0x8d33('0x39')][_0x8d33('0x85')]?{'message':'Wrong\x20credentials','statusCode':_0x97ba24['statusCode']}:_0x97ba24);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index 0f8ee1a..b70c48b 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 _0xbde8=['code','serverUrl','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','/oauth/v2/token','clientSecret','application/x-www-form-urlencoded','then','refresh_token','refreshToken','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','catch','host','slice','substring','POST','error','inspect','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./intZohoAccount.attributes','exports','ZohoAccount','int_zoho_accounts','changed','zone','clientId'];(function(_0x5674fc,_0x2b623b){var _0x2444a5=function(_0x19774c){while(--_0x19774c){_0x5674fc['push'](_0x5674fc['shift']());}};_0x2444a5(++_0x2b623b);}(_0xbde8,0x1a9));var _0x8bde=function(_0x5aa992,_0x559ebb){_0x5aa992=_0x5aa992-0x0;var _0x2e2d59=_0xbde8[_0x5aa992];return _0x2e2d59;};'use strict';var _=require(_0x8bde('0x0'));var util=require(_0x8bde('0x1'));var logger=require(_0x8bde('0x2'))(_0x8bde('0x3'));var moment=require(_0x8bde('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x8bde('0x5'));var rimraf=require(_0x8bde('0x6'));var config=require(_0x8bde('0x7'));var attributes=require(_0x8bde('0x8'));var integrations=require('../../components/integrations/configuration');module[_0x8bde('0x9')]=function(_0x4fc867,_0x5b9c4f){return _0x4fc867['define'](_0x8bde('0xa'),attributes,{'tableName':_0x8bde('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x1270f9,_0x2a590e,_0x2035ed){if(_0x1270f9[_0x8bde('0xc')](_0x8bde('0xd'))||_0x1270f9[_0x8bde('0xc')]('serverUrl')||_0x1270f9[_0x8bde('0xc')](_0x8bde('0xe'))||_0x1270f9[_0x8bde('0xc')]('clientSecret')||_0x1270f9[_0x8bde('0xc')](_0x8bde('0xf'))||_0x1270f9[_0x8bde('0xc')]('host')){var _0x3ab1fb,_0x18bcad;_0x3ab1fb=_0x1270f9[_0x8bde('0x10')];var _0x5ce686=_0x3ab1fb['slice'](-0x1);if(_0x5ce686==='/'||_0x5ce686==='\x5c'||_0x5ce686===':'){_0x3ab1fb=_0x3ab1fb['substring'](0x0,_0x3ab1fb[_0x8bde('0x11')](_0x5ce686));}switch(_0x1270f9['zone']){case'US':_0x18bcad=_0x8bde('0x12');break;case'AU':_0x18bcad=_0x8bde('0x13');break;case'IN':_0x18bcad=_0x8bde('0x14');break;case'CN':_0x18bcad=_0x8bde('0x15');break;default:_0x18bcad=_0x8bde('0x16');break;}var _0x39f72c={'method':'POST','uri':_0x18bcad+_0x8bde('0x17'),'form':{'grant_type':'authorization_code','client_id':_0x1270f9['clientId'],'client_secret':_0x1270f9[_0x8bde('0x18')],'redirect_uri':_0x1270f9[_0x8bde('0x10')],'code':_0x1270f9[_0x8bde('0xf')]},'headers':{'Content-Type':_0x8bde('0x19')}};return rp(_0x39f72c)[_0x8bde('0x1a')](function(_0x44643f){var _0xb67960=JSON['parse'](_0x44643f);if(_0xb67960[_0x8bde('0x1b')]){_0x1270f9[_0x8bde('0x1c')]=_0xb67960['refresh_token'];logger['info'](util[_0x8bde('0x1d')](_0x8bde('0x1e'),_0x1270f9[_0x8bde('0x1f')],_0x1270f9['id']));}else{logger['error'](util['format'](_0x8bde('0x20'),_0x1270f9[_0x8bde('0x1f')],_0x1270f9['id']),util['inspect'](_0xb67960,{'showHidden':![],'depth':null}));}return _0x2035ed(null,_0x2a590e);})[_0x8bde('0x21')](function(_0x1767ea){logger['error'](util[_0x8bde('0x1d')](_0x8bde('0x20'),_0x1270f9[_0x8bde('0x1f')],_0x1270f9['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x2035ed(_0x1767ea);});}else{return _0x2035ed(null,_0x2a590e);}},'beforeUpdate':function(_0x166637,_0x3db4ae,_0x32a01c){if(_0x166637[_0x8bde('0xc')]('zone')||_0x166637[_0x8bde('0xc')](_0x8bde('0x10'))||_0x166637['changed'](_0x8bde('0xe'))||_0x166637[_0x8bde('0xc')]('clientSecret')||_0x166637[_0x8bde('0xc')](_0x8bde('0xf'))||_0x166637[_0x8bde('0xc')](_0x8bde('0x22'))){var _0x53fcfc,_0x18811d;_0x53fcfc=_0x166637[_0x8bde('0x10')];var _0x220368=_0x53fcfc[_0x8bde('0x23')](-0x1);if(_0x220368==='/'||_0x220368==='\x5c'||_0x220368===':'){_0x53fcfc=_0x53fcfc[_0x8bde('0x24')](0x0,_0x53fcfc[_0x8bde('0x11')](_0x220368));}switch(_0x166637[_0x8bde('0xd')]){case'US':_0x18811d='https://accounts.zoho.com';break;case'AU':_0x18811d=_0x8bde('0x13');break;case'IN':_0x18811d='https://accounts.zoho.in';break;case'CN':_0x18811d=_0x8bde('0x15');break;default:_0x18811d=_0x8bde('0x16');break;}var _0x48bd80={'method':_0x8bde('0x25'),'uri':_0x18811d+_0x8bde('0x17'),'form':{'grant_type':'authorization_code','client_id':_0x166637[_0x8bde('0xe')],'client_secret':_0x166637['clientSecret'],'redirect_uri':_0x166637[_0x8bde('0x10')],'code':_0x166637['code']},'headers':{'Content-Type':_0x8bde('0x19')}};return rp(_0x48bd80)[_0x8bde('0x1a')](function(_0x4cfbba){var _0x3e7a95=JSON['parse'](_0x4cfbba);if(_0x3e7a95['refresh_token']){_0x166637[_0x8bde('0x1c')]=_0x3e7a95['refresh_token'];logger['info'](util['format'](_0x8bde('0x1e'),_0x166637['name'],_0x166637['id']));}else{logger[_0x8bde('0x26')](util[_0x8bde('0x1d')](_0x8bde('0x20'),_0x166637[_0x8bde('0x1f')],_0x166637['id']),util['inspect'](_0x3e7a95,{'showHidden':![],'depth':null}));}return _0x32a01c(null,_0x3db4ae);})[_0x8bde('0x21')](function(_0x17de62){logger[_0x8bde('0x26')](util[_0x8bde('0x1d')](_0x8bde('0x20'),_0x166637[_0x8bde('0x1f')],_0x166637['id']),util[_0x8bde('0x27')](parsedResult,{'showHidden':![],'depth':null}));return _0x32a01c(_0x17de62);});}else{return _0x32a01c(null,_0x3db4ae);}}}});}; \ No newline at end of file +var _0xbe31=['https://accounts.zoho.eu','POST','/oauth/v2/token','authorization_code','application/x-www-form-urlencoded','then','parse','refresh_token','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','catch','name','host','https://accounts.zoho.in','refreshToken','info','error','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','define','int_zoho_accounts','zone','changed','serverUrl','clientId','clientSecret','code','slice','substring','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au'];(function(_0x54cca3,_0x3b297d){var _0x348fde=function(_0x1ecada){while(--_0x1ecada){_0x54cca3['push'](_0x54cca3['shift']());}};_0x348fde(++_0x3b297d);}(_0xbe31,0x1d6));var _0x1be3=function(_0x14998e,_0xd2f6b1){_0x14998e=_0x14998e-0x0;var _0x513137=_0xbe31[_0x14998e];return _0x513137;};'use strict';var _=require(_0x1be3('0x0'));var util=require(_0x1be3('0x1'));var logger=require(_0x1be3('0x2'))('api');var moment=require('moment');var BPromise=require(_0x1be3('0x3'));var rp=require(_0x1be3('0x4'));var fs=require('fs');var path=require(_0x1be3('0x5'));var rimraf=require(_0x1be3('0x6'));var config=require(_0x1be3('0x7'));var attributes=require('./intZohoAccount.attributes');var integrations=require(_0x1be3('0x8'));module['exports']=function(_0x146ad6,_0x3a2c16){return _0x146ad6[_0x1be3('0x9')]('ZohoAccount',attributes,{'tableName':_0x1be3('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x27ca64,_0x41caf3,_0x4ba453){if(_0x27ca64['changed'](_0x1be3('0xb'))||_0x27ca64[_0x1be3('0xc')](_0x1be3('0xd'))||_0x27ca64['changed'](_0x1be3('0xe'))||_0x27ca64[_0x1be3('0xc')](_0x1be3('0xf'))||_0x27ca64[_0x1be3('0xc')](_0x1be3('0x10'))||_0x27ca64['changed']('host')){var _0x57c49a,_0x328931;_0x57c49a=_0x27ca64[_0x1be3('0xd')];var _0x459a67=_0x57c49a[_0x1be3('0x11')](-0x1);if(_0x459a67==='/'||_0x459a67==='\x5c'||_0x459a67===':'){_0x57c49a=_0x57c49a[_0x1be3('0x12')](0x0,_0x57c49a[_0x1be3('0x13')](_0x459a67));}switch(_0x27ca64[_0x1be3('0xb')]){case'US':_0x328931=_0x1be3('0x14');break;case'AU':_0x328931=_0x1be3('0x15');break;case'IN':_0x328931='https://accounts.zoho.in';break;case'CN':_0x328931='https://accounts.zoho.com.cn';break;default:_0x328931=_0x1be3('0x16');break;}var _0x82f3df={'method':_0x1be3('0x17'),'uri':_0x328931+_0x1be3('0x18'),'form':{'grant_type':_0x1be3('0x19'),'client_id':_0x27ca64[_0x1be3('0xe')],'client_secret':_0x27ca64['clientSecret'],'redirect_uri':_0x27ca64[_0x1be3('0xd')],'code':_0x27ca64['code']},'headers':{'Content-Type':_0x1be3('0x1a')}};return rp(_0x82f3df)[_0x1be3('0x1b')](function(_0x596d61){var _0x522a4a=JSON[_0x1be3('0x1c')](_0x596d61);if(_0x522a4a[_0x1be3('0x1d')]){_0x27ca64['refreshToken']=_0x522a4a['refresh_token'];logger['info'](util[_0x1be3('0x1e')](_0x1be3('0x1f'),_0x27ca64['name'],_0x27ca64['id']));}else{logger['error'](util[_0x1be3('0x1e')](_0x1be3('0x20'),_0x27ca64['name'],_0x27ca64['id']),util[_0x1be3('0x21')](_0x522a4a,{'showHidden':![],'depth':null}));}return _0x4ba453(null,_0x41caf3);})[_0x1be3('0x22')](function(_0x4def9f){logger['error'](util[_0x1be3('0x1e')](_0x1be3('0x20'),_0x27ca64[_0x1be3('0x23')],_0x27ca64['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x4ba453(_0x4def9f);});}else{return _0x4ba453(null,_0x41caf3);}},'beforeUpdate':function(_0x384b88,_0xde89d,_0x23fc1c){if(_0x384b88[_0x1be3('0xc')](_0x1be3('0xb'))||_0x384b88[_0x1be3('0xc')](_0x1be3('0xd'))||_0x384b88['changed'](_0x1be3('0xe'))||_0x384b88[_0x1be3('0xc')](_0x1be3('0xf'))||_0x384b88[_0x1be3('0xc')](_0x1be3('0x10'))||_0x384b88[_0x1be3('0xc')](_0x1be3('0x24'))){var _0x580faf,_0xa3a8a4;_0x580faf=_0x384b88['serverUrl'];var _0x2cddf7=_0x580faf[_0x1be3('0x11')](-0x1);if(_0x2cddf7==='/'||_0x2cddf7==='\x5c'||_0x2cddf7===':'){_0x580faf=_0x580faf[_0x1be3('0x12')](0x0,_0x580faf[_0x1be3('0x13')](_0x2cddf7));}switch(_0x384b88['zone']){case'US':_0xa3a8a4=_0x1be3('0x14');break;case'AU':_0xa3a8a4=_0x1be3('0x15');break;case'IN':_0xa3a8a4=_0x1be3('0x25');break;case'CN':_0xa3a8a4='https://accounts.zoho.com.cn';break;default:_0xa3a8a4=_0x1be3('0x16');break;}var _0x2c834c={'method':_0x1be3('0x17'),'uri':_0xa3a8a4+_0x1be3('0x18'),'form':{'grant_type':_0x1be3('0x19'),'client_id':_0x384b88[_0x1be3('0xe')],'client_secret':_0x384b88[_0x1be3('0xf')],'redirect_uri':_0x384b88[_0x1be3('0xd')],'code':_0x384b88[_0x1be3('0x10')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x2c834c)['then'](function(_0x547044){var _0x31b70c=JSON[_0x1be3('0x1c')](_0x547044);if(_0x31b70c[_0x1be3('0x1d')]){_0x384b88[_0x1be3('0x26')]=_0x31b70c[_0x1be3('0x1d')];logger[_0x1be3('0x27')](util[_0x1be3('0x1e')](_0x1be3('0x1f'),_0x384b88[_0x1be3('0x23')],_0x384b88['id']));}else{logger[_0x1be3('0x28')](util[_0x1be3('0x1e')](_0x1be3('0x20'),_0x384b88[_0x1be3('0x23')],_0x384b88['id']),util[_0x1be3('0x21')](_0x31b70c,{'showHidden':![],'depth':null}));}return _0x23fc1c(null,_0xde89d);})[_0x1be3('0x22')](function(_0x3d16b7){logger[_0x1be3('0x28')](util['format']('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x384b88[_0x1be3('0x23')],_0x384b88['id']),util[_0x1be3('0x21')](parsedResult,{'showHidden':![],'depth':null}));return _0x23fc1c(_0x3d16b7);});}else{return _0x23fc1c(null,_0xde89d);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index ea97c07..ac9af55 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 _0xce6b=['message','GetZohoAccount','ZohoAccount','options','raw','where','attributes','limit','map','include','model','catch','ShowZohoAccount','find','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x34ab65,_0x356d84){var _0x31532c=function(_0x23761b){while(--_0x23761b){_0x34ab65['push'](_0x34ab65['shift']());}};_0x31532c(++_0x356d84);}(_0xce6b,0x8e));var _0xbce6=function(_0x4eb3de,_0x14d1dc){_0x4eb3de=_0x4eb3de-0x0;var _0x21bf07=_0xce6b[_0x4eb3de];return _0x21bf07;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xbce6('0x0'));var BPromise=require(_0xbce6('0x1'));var rs=require(_0xbce6('0x2'));var fs=require('fs');var Redis=require(_0xbce6('0x3'));var db=require(_0xbce6('0x4'))['db'];var utils=require(_0xbce6('0x5'));var logger=require(_0xbce6('0x6'))(_0xbce6('0x7'));var config=require(_0xbce6('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xbce6('0x9')][_0xbce6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x126425,_0x355f14,_0x12d0d1){return new BPromise(function(_0x13abd5,_0x47d8d7){return client['request'](_0x126425,_0x12d0d1)[_0xbce6('0xb')](function(_0x4a03b5){logger[_0xbce6('0xc')](_0xbce6('0xd'),_0x355f14,_0xbce6('0xe'));logger[_0xbce6('0xf')]('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x355f14,_0xbce6('0xe'),JSON[_0xbce6('0x10')](_0x4a03b5));if(_0x4a03b5[_0xbce6('0x11')]){if(_0x4a03b5['error']['code']===0x1f4){logger['error'](_0xbce6('0xd'),_0x355f14,_0x4a03b5['error'][_0xbce6('0x12')]);return _0x47d8d7(_0x4a03b5['error'][_0xbce6('0x12')]);}logger['error'](_0xbce6('0xd'),_0x355f14,_0x4a03b5[_0xbce6('0x11')][_0xbce6('0x12')]);return _0x13abd5(_0x4a03b5[_0xbce6('0x11')][_0xbce6('0x12')]);}else{logger[_0xbce6('0xc')]('ZohoAccount,\x20%s,\x20%s',_0x355f14,_0xbce6('0xe'));_0x13abd5(_0x4a03b5['result']['message']);}})['catch'](function(_0x5839ed){logger[_0xbce6('0x11')]('ZohoAccount,\x20%s,\x20%s',_0x355f14,_0x5839ed);_0x47d8d7(_0x5839ed);});});}exports[_0xbce6('0x13')]=function(_0x2bf9ea){var _0x4b94e0=this;return new Promise(function(_0x2c69c9,_0x7dccdb){return db[_0xbce6('0x14')]['findAll']({'raw':_0x2bf9ea[_0xbce6('0x15')]?_0x2bf9ea[_0xbce6('0x15')][_0xbce6('0x16')]===undefined?!![]:![]:!![],'where':_0x2bf9ea[_0xbce6('0x15')]?_0x2bf9ea[_0xbce6('0x15')][_0xbce6('0x17')]||null:null,'attributes':_0x2bf9ea[_0xbce6('0x15')]?_0x2bf9ea['options'][_0xbce6('0x18')]||null:null,'limit':_0x2bf9ea[_0xbce6('0x15')]?_0x2bf9ea[_0xbce6('0x15')][_0xbce6('0x19')]||null:null,'include':_0x2bf9ea[_0xbce6('0x15')]?_0x2bf9ea[_0xbce6('0x15')]['include']?_[_0xbce6('0x1a')](_0x2bf9ea['options'][_0xbce6('0x1b')],function(_0x5ceff9){return{'model':db[_0x5ceff9[_0xbce6('0x1c')]],'as':_0x5ceff9['as'],'attributes':_0x5ceff9[_0xbce6('0x18')],'include':_0x5ceff9[_0xbce6('0x1b')]?_['map'](_0x5ceff9[_0xbce6('0x1b')],function(_0x4a6c11){return{'model':db[_0x4a6c11[_0xbce6('0x1c')]],'as':_0x4a6c11['as'],'attributes':_0x4a6c11[_0xbce6('0x18')],'include':_0x4a6c11['include']?_[_0xbce6('0x1a')](_0x4a6c11[_0xbce6('0x1b')],function(_0x48ae24){return{'model':db[_0x48ae24[_0xbce6('0x1c')]],'as':_0x48ae24['as'],'attributes':_0x48ae24[_0xbce6('0x18')]};}):[]};}):[]};}):[]:[]})[_0xbce6('0xb')](function(_0xf34ff6){logger[_0xbce6('0xc')]('GetZohoAccount',_0x2bf9ea);logger[_0xbce6('0xf')](_0xbce6('0x13'),_0x2bf9ea,JSON['stringify'](_0xf34ff6));_0x2c69c9(_0xf34ff6);})[_0xbce6('0x1d')](function(_0x4a0010){logger[_0xbce6('0x11')](_0xbce6('0x13'),_0x4a0010['message'],_0x2bf9ea);_0x7dccdb(_0x4b94e0[_0xbce6('0x11')](0x1f4,_0x4a0010[_0xbce6('0x12')]));});});};exports[_0xbce6('0x1e')]=function(_0x200407){var _0x1a17be=this;return new Promise(function(_0x2e7271,_0x1b5413){return db[_0xbce6('0x14')][_0xbce6('0x1f')]({'raw':_0x200407[_0xbce6('0x15')]?_0x200407[_0xbce6('0x15')][_0xbce6('0x16')]===undefined?!![]:![]:!![],'where':_0x200407['options']?_0x200407[_0xbce6('0x15')][_0xbce6('0x17')]||null:null,'attributes':_0x200407[_0xbce6('0x15')]?_0x200407[_0xbce6('0x15')][_0xbce6('0x18')]||null:null,'include':_0x200407[_0xbce6('0x15')]?_0x200407[_0xbce6('0x15')][_0xbce6('0x1b')]?_['map'](_0x200407['options'][_0xbce6('0x1b')],function(_0x528b9b){return{'model':db[_0x528b9b[_0xbce6('0x1c')]],'as':_0x528b9b['as'],'attributes':_0x528b9b[_0xbce6('0x18')],'include':_0x528b9b[_0xbce6('0x1b')]?_[_0xbce6('0x1a')](_0x528b9b['include'],function(_0x5ecc5b){return{'model':db[_0x5ecc5b[_0xbce6('0x1c')]],'as':_0x5ecc5b['as'],'attributes':_0x5ecc5b[_0xbce6('0x18')],'include':_0x5ecc5b[_0xbce6('0x1b')]?_[_0xbce6('0x1a')](_0x5ecc5b['include'],function(_0x211c46){return{'model':db[_0x211c46['model']],'as':_0x211c46['as'],'attributes':_0x211c46[_0xbce6('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x56b5bd){logger[_0xbce6('0xc')]('ShowZohoAccount',_0x200407);logger[_0xbce6('0xf')]('ShowZohoAccount',_0x200407,JSON[_0xbce6('0x10')](_0x56b5bd));_0x2e7271(_0x56b5bd);})['catch'](function(_0x2afa65){logger['error']('ShowZohoAccount',_0x2afa65[_0xbce6('0x12')],_0x200407);_0x1b5413(_0x1a17be[_0xbce6('0x11')](0x1f4,_0x2afa65[_0xbce6('0x12')]));});});}; \ No newline at end of file +var _0xc80c=['include','map','model','attributes','then','info','ShowZohoAccount','find','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetZohoAccount','ZohoAccount','findAll','options','raw','where','limit'];(function(_0x352e09,_0x37a7da){var _0x1b7094=function(_0x561074){while(--_0x561074){_0x352e09['push'](_0x352e09['shift']());}};_0x1b7094(++_0x37a7da);}(_0xc80c,0x94));var _0xcc80=function(_0x5a9c0c,_0x4ec485){_0x5a9c0c=_0x5a9c0c-0x0;var _0x53c77d=_0xc80c[_0x5a9c0c];return _0x53c77d;};'use strict';var _=require(_0xcc80('0x0'));var util=require('util');var moment=require(_0xcc80('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcc80('0x2'));var db=require(_0xcc80('0x3'))['db'];var utils=require(_0xcc80('0x4'));var logger=require(_0xcc80('0x5'))('rpc');var config=require(_0xcc80('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xcc80('0x7')][_0xcc80('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x416445,_0xd3e105,_0xc9c809){return new BPromise(function(_0x7f1b19,_0x36814f){return client[_0xcc80('0x9')](_0x416445,_0xc9c809)['then'](function(_0x1be85e){logger['info'](_0xcc80('0xa'),_0xd3e105,_0xcc80('0xb'));logger[_0xcc80('0xc')](_0xcc80('0xd'),_0xd3e105,_0xcc80('0xb'),JSON[_0xcc80('0xe')](_0x1be85e));if(_0x1be85e[_0xcc80('0xf')]){if(_0x1be85e['error'][_0xcc80('0x10')]===0x1f4){logger[_0xcc80('0xf')]('ZohoAccount,\x20%s,\x20%s',_0xd3e105,_0x1be85e[_0xcc80('0xf')]['message']);return _0x36814f(_0x1be85e[_0xcc80('0xf')][_0xcc80('0x11')]);}logger[_0xcc80('0xf')]('ZohoAccount,\x20%s,\x20%s',_0xd3e105,_0x1be85e[_0xcc80('0xf')][_0xcc80('0x11')]);return _0x7f1b19(_0x1be85e[_0xcc80('0xf')]['message']);}else{logger['info'](_0xcc80('0xa'),_0xd3e105,_0xcc80('0xb'));_0x7f1b19(_0x1be85e[_0xcc80('0x12')]['message']);}})[_0xcc80('0x13')](function(_0x20df44){logger[_0xcc80('0xf')]('ZohoAccount,\x20%s,\x20%s',_0xd3e105,_0x20df44);_0x36814f(_0x20df44);});});}exports[_0xcc80('0x14')]=function(_0x113b52){var _0x46f01a=this;return new Promise(function(_0x5d2b15,_0x421b3c){return db[_0xcc80('0x15')][_0xcc80('0x16')]({'raw':_0x113b52[_0xcc80('0x17')]?_0x113b52['options'][_0xcc80('0x18')]===undefined?!![]:![]:!![],'where':_0x113b52[_0xcc80('0x17')]?_0x113b52[_0xcc80('0x17')][_0xcc80('0x19')]||null:null,'attributes':_0x113b52['options']?_0x113b52[_0xcc80('0x17')]['attributes']||null:null,'limit':_0x113b52[_0xcc80('0x17')]?_0x113b52['options'][_0xcc80('0x1a')]||null:null,'include':_0x113b52['options']?_0x113b52[_0xcc80('0x17')][_0xcc80('0x1b')]?_[_0xcc80('0x1c')](_0x113b52[_0xcc80('0x17')][_0xcc80('0x1b')],function(_0x4dba6c){return{'model':db[_0x4dba6c[_0xcc80('0x1d')]],'as':_0x4dba6c['as'],'attributes':_0x4dba6c[_0xcc80('0x1e')],'include':_0x4dba6c[_0xcc80('0x1b')]?_['map'](_0x4dba6c[_0xcc80('0x1b')],function(_0x3e5f97){return{'model':db[_0x3e5f97[_0xcc80('0x1d')]],'as':_0x3e5f97['as'],'attributes':_0x3e5f97[_0xcc80('0x1e')],'include':_0x3e5f97[_0xcc80('0x1b')]?_[_0xcc80('0x1c')](_0x3e5f97[_0xcc80('0x1b')],function(_0x3eadd1){return{'model':db[_0x3eadd1[_0xcc80('0x1d')]],'as':_0x3eadd1['as'],'attributes':_0x3eadd1[_0xcc80('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xcc80('0x1f')](function(_0x5a774a){logger[_0xcc80('0x20')](_0xcc80('0x14'),_0x113b52);logger['debug'](_0xcc80('0x14'),_0x113b52,JSON['stringify'](_0x5a774a));_0x5d2b15(_0x5a774a);})['catch'](function(_0x2c7951){logger[_0xcc80('0xf')](_0xcc80('0x14'),_0x2c7951[_0xcc80('0x11')],_0x113b52);_0x421b3c(_0x46f01a['error'](0x1f4,_0x2c7951['message']));});});};exports[_0xcc80('0x21')]=function(_0x3b7276){var _0x3a48d5=this;return new Promise(function(_0x3e44e5,_0x3ef92b){return db['ZohoAccount'][_0xcc80('0x22')]({'raw':_0x3b7276['options']?_0x3b7276['options'][_0xcc80('0x18')]===undefined?!![]:![]:!![],'where':_0x3b7276[_0xcc80('0x17')]?_0x3b7276['options'][_0xcc80('0x19')]||null:null,'attributes':_0x3b7276[_0xcc80('0x17')]?_0x3b7276[_0xcc80('0x17')][_0xcc80('0x1e')]||null:null,'include':_0x3b7276[_0xcc80('0x17')]?_0x3b7276['options'][_0xcc80('0x1b')]?_[_0xcc80('0x1c')](_0x3b7276[_0xcc80('0x17')][_0xcc80('0x1b')],function(_0x2bec40){return{'model':db[_0x2bec40[_0xcc80('0x1d')]],'as':_0x2bec40['as'],'attributes':_0x2bec40[_0xcc80('0x1e')],'include':_0x2bec40[_0xcc80('0x1b')]?_[_0xcc80('0x1c')](_0x2bec40[_0xcc80('0x1b')],function(_0x5d7899){return{'model':db[_0x5d7899[_0xcc80('0x1d')]],'as':_0x5d7899['as'],'attributes':_0x5d7899[_0xcc80('0x1e')],'include':_0x5d7899['include']?_[_0xcc80('0x1c')](_0x5d7899[_0xcc80('0x1b')],function(_0x4e1fce){return{'model':db[_0x4e1fce['model']],'as':_0x4e1fce['as'],'attributes':_0x4e1fce[_0xcc80('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xcc80('0x1f')](function(_0x432026){logger['info']('ShowZohoAccount',_0x3b7276);logger[_0xcc80('0xc')](_0xcc80('0x21'),_0x3b7276,JSON[_0xcc80('0xe')](_0x432026));_0x3e44e5(_0x432026);})[_0xcc80('0x13')](function(_0x483ee5){logger[_0xcc80('0xf')](_0xcc80('0x21'),_0x483ee5['message'],_0x3b7276);_0x3ef92b(_0x3a48d5[_0xcc80('0xf')](0x1f4,_0x483ee5[_0xcc80('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 14398f0..1e26e1b 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 _0xad13=['/:id','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','post','update','delete','exports','multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated','index'];(function(_0xf16f5f,_0x97e376){var _0x15bdfa=function(_0x52efb9){while(--_0x52efb9){_0xf16f5f['push'](_0xf16f5f['shift']());}};_0x15bdfa(++_0x97e376);}(_0xad13,0x79));var _0x3ad1=function(_0x576ab3,_0x173592){_0x576ab3=_0x576ab3-0x0;var _0x3f025c=_0xad13[_0x576ab3];return _0x3f025c;};'use strict';var multer=require(_0x3ad1('0x0'));var util=require('util');var path=require(_0x3ad1('0x1'));var timeout=require(_0x3ad1('0x2'));var express=require(_0x3ad1('0x3'));var router=express[_0x3ad1('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x3ad1('0x5'));var config=require(_0x3ad1('0x6'));var controller=require(_0x3ad1('0x7'));router[_0x3ad1('0x8')]('/',auth[_0x3ad1('0x9')](),controller[_0x3ad1('0xa')]);router[_0x3ad1('0x8')](_0x3ad1('0xb'),auth[_0x3ad1('0x9')](),controller[_0x3ad1('0xc')]);router['get'](_0x3ad1('0xd'),auth[_0x3ad1('0x9')](),controller[_0x3ad1('0xe')]);router['get'](_0x3ad1('0xf'),auth[_0x3ad1('0x9')](),controller['getSubjects']);router[_0x3ad1('0x8')](_0x3ad1('0x10'),auth[_0x3ad1('0x9')](),controller[_0x3ad1('0x11')]);router[_0x3ad1('0x12')]('/',auth[_0x3ad1('0x9')](),controller['create']);router['put'](_0x3ad1('0xb'),auth[_0x3ad1('0x9')](),controller[_0x3ad1('0x13')]);router[_0x3ad1('0x14')]('/:id',auth[_0x3ad1('0x9')](),controller['destroy']);module[_0x3ad1('0x15')]=router; \ No newline at end of file +var _0x6822=['util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','/:id/subjects','/:id/descriptions','post','put','update','delete','destroy','exports'];(function(_0x3231e8,_0x41df58){var _0x13a897=function(_0x5c01b5){while(--_0x5c01b5){_0x3231e8['push'](_0x3231e8['shift']());}};_0x13a897(++_0x41df58);}(_0x6822,0x18c));var _0x2682=function(_0x48dcd8,_0x3bd2d1){_0x48dcd8=_0x48dcd8-0x0;var _0xa81baf=_0x6822[_0x48dcd8];return _0xa81baf;};'use strict';var multer=require('multer');var util=require(_0x2682('0x0'));var path=require(_0x2682('0x1'));var timeout=require(_0x2682('0x2'));var express=require(_0x2682('0x3'));var router=express['Router']();var auth=require(_0x2682('0x4'));var interaction=require(_0x2682('0x5'));var config=require(_0x2682('0x6'));var controller=require(_0x2682('0x7'));router[_0x2682('0x8')]('/',auth[_0x2682('0x9')](),controller[_0x2682('0xa')]);router[_0x2682('0x8')](_0x2682('0xb'),auth[_0x2682('0x9')](),controller[_0x2682('0xc')]);router[_0x2682('0x8')](_0x2682('0xd'),auth[_0x2682('0x9')](),controller['getFields']);router[_0x2682('0x8')](_0x2682('0xe'),auth['isAuthenticated'](),controller['getSubjects']);router['get'](_0x2682('0xf'),auth[_0x2682('0x9')](),controller['getDescriptions']);router[_0x2682('0x10')]('/',auth[_0x2682('0x9')](),controller['create']);router[_0x2682('0x11')](_0x2682('0xb'),auth[_0x2682('0x9')](),controller[_0x2682('0x12')]);router[_0x2682('0x13')](_0x2682('0xb'),auth[_0x2682('0x9')](),controller[_0x2682('0x14')]);module[_0x2682('0x15')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index ae96fd4..8249c1f 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 _0xc6d9=['contact_lead','contact','sequelize','exports','STRING','ENUM','lead','nothing'];(function(_0x7dbd65,_0x18da49){var _0x33d551=function(_0x7ce789){while(--_0x7ce789){_0x7dbd65['push'](_0x7dbd65['shift']());}};_0x33d551(++_0x18da49);}(_0xc6d9,0x15a));var _0x9c6d=function(_0xf5e4b0,_0x337348){_0xf5e4b0=_0xf5e4b0-0x0;var _0x24783b=_0xc6d9[_0xf5e4b0];return _0x24783b;};'use strict';var Sequelize=require(_0x9c6d('0x0'));module[_0x9c6d('0x1')]={'name':{'type':Sequelize[_0x9c6d('0x2')]},'moduleCreate':{'type':Sequelize[_0x9c6d('0x3')](_0x9c6d('0x4'),'contact',_0x9c6d('0x5')),'defaultValue':_0x9c6d('0x4')},'moduleSearch':{'type':Sequelize[_0x9c6d('0x3')](_0x9c6d('0x6'),_0x9c6d('0x7'),_0x9c6d('0x4')),'defaultValue':_0x9c6d('0x6')},'description':{'type':Sequelize[_0x9c6d('0x2')]}}; \ No newline at end of file +var _0x86db=['STRING','ENUM','lead','contact','contact_lead','exports'];(function(_0x5286bb,_0x452114){var _0x4d2989=function(_0x434bce){while(--_0x434bce){_0x5286bb['push'](_0x5286bb['shift']());}};_0x4d2989(++_0x452114);}(_0x86db,0x8f));var _0xb86d=function(_0xe51596,_0x314d5b){_0xe51596=_0xe51596-0x0;var _0x22c705=_0x86db[_0xe51596];return _0x22c705;};'use strict';var Sequelize=require('sequelize');module[_0xb86d('0x0')]={'name':{'type':Sequelize[_0xb86d('0x1')]},'moduleCreate':{'type':Sequelize[_0xb86d('0x2')](_0xb86d('0x3'),'contact','nothing'),'defaultValue':'lead'},'moduleSearch':{'type':Sequelize[_0xb86d('0x2')]('contact_lead',_0xb86d('0x4'),_0xb86d('0x3')),'defaultValue':_0xb86d('0x5')},'description':{'type':Sequelize[_0xb86d('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index c098070..5ddee10 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 _0xe14b=['info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','sendStatus','status','count','offset','limit','set','Content-Range','json','apply','reject','save','update','destroy','name','map','ZohoConfiguration','rawAttributes','fieldName','type','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','find','catch','body','getFields','findOne','ZohoField','order','getSubjects','getDescriptions','html-pdf','eml-format','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','test','Sequelize','ValidationError','request','then'];(function(_0xf7c72a,_0x4bb071){var _0x483324=function(_0x36b75e){while(--_0x36b75e){_0xf7c72a['push'](_0xf7c72a['shift']());}};_0x483324(++_0x4bb071);}(_0xe14b,0x93));var _0xbe14=function(_0xbc46f9,_0x426f4f){_0xbc46f9=_0xbc46f9-0x0;var _0x1c7669=_0xe14b[_0xbc46f9];return _0x1c7669;};'use strict';var pdf=require(_0xbe14('0x0'));var emlformat=require(_0xbe14('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xbe14('0x2'));var rp=require(_0xbe14('0x3'));var moment=require('moment');var BPromise=require(_0xbe14('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xbe14('0x5'));var sox=require(_0xbe14('0x6'));var csv=require(_0xbe14('0x7'));var ejs=require(_0xbe14('0x8'));var fs=require('fs');var _=require(_0xbe14('0x9'));var squel=require(_0xbe14('0xa'));var crypto=require(_0xbe14('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xbe14('0xc'));var Papa=require(_0xbe14('0xd'));var Redis=require(_0xbe14('0xe'));var authService=require(_0xbe14('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbe14('0x10'));var logger=require(_0xbe14('0x11'))('api');var utils=require(_0xbe14('0x12'));var config=require(_0xbe14('0x13'));var db=require(_0xbe14('0x14'))['db'];var jayson=require(_0xbe14('0x15'));var client=jayson[_0xbe14('0x16')][_0xbe14('0x17')]({'port':0x232a});function checkPasswordPattern(_0x23a730,_0x2850cb,_0x16893f){if(_0x16893f){var _0xa2cf72=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xa2cf72[_0xbe14('0x18')](_0x2850cb)){return _0x23a730;}else{throw new db[(_0xbe14('0x19'))][(_0xbe14('0x1a'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x23a730;}}function respondWithRpcPromise(_0x55b3a7,_0x3f58f5,_0x3dc4a9,_0xf4ac9){return new BPromise(function(_0x37ce4e,_0x4e8f34){var _0x21c789=_0xf4ac9||client;return _0x21c789[_0xbe14('0x1b')](_0x55b3a7,_0x3dc4a9)[_0xbe14('0x1c')](function(_0x123ede){logger[_0xbe14('0x1d')](_0xbe14('0x1e'),_0x3f58f5,_0xbe14('0x1f'));logger['debug'](_0xbe14('0x20'),_0x3f58f5,_0xbe14('0x1f'),JSON[_0xbe14('0x21')](_0x123ede));if(_0x123ede[_0xbe14('0x22')]){if(_0x123ede[_0xbe14('0x22')][_0xbe14('0x23')]===0x1f4){logger['error'](_0xbe14('0x1e'),_0x3f58f5,_0x123ede[_0xbe14('0x22')][_0xbe14('0x24')]);return _0x4e8f34(_0x123ede[_0xbe14('0x22')][_0xbe14('0x24')]);}logger['error'](_0xbe14('0x1e'),_0x3f58f5,_0x123ede['error'][_0xbe14('0x24')]);return _0x37ce4e(_0x123ede['error'][_0xbe14('0x24')]);}else{logger['info'](_0xbe14('0x1e'),_0x3f58f5,_0xbe14('0x1f'));_0x37ce4e(_0x123ede['result'][_0xbe14('0x24')]);}})['catch'](function(_0x4587a8){logger['error'](_0xbe14('0x1e'),_0x3f58f5,_0x4587a8);_0x4e8f34(_0x4587a8);});});}function respondWithStatusCode(_0x5fa043,_0x1ee9c1){_0x1ee9c1=_0x1ee9c1||0xcc;return function(_0x39cc81){if(_0x39cc81){return _0x5fa043[_0xbe14('0x25')](_0x1ee9c1);}return _0x5fa043[_0xbe14('0x26')](_0x1ee9c1)['end']();};}function respondWithResult(_0x1822e0,_0x1ba46a){_0x1ba46a=_0x1ba46a||0xc8;return function(_0x391556){if(_0x391556){return _0x1822e0[_0xbe14('0x26')](_0x1ba46a)['json'](_0x391556);}};}function respondWithFilteredResult(_0x16f884,_0x29fc64){return function(_0x59bf34){if(_0x59bf34){var _0x3c3613=_0x59bf34[_0xbe14('0x27')],_0x3b3e84=_0x29fc64[_0xbe14('0x28')],_0x1c7cc7=_0x29fc64[_0xbe14('0x28')]+_0x29fc64[_0xbe14('0x29')],_0x19252f;if(_0x1c7cc7>=_0x3c3613){_0x1c7cc7=_0x3c3613;_0x19252f=0xc8;}else{_0x19252f=0xce;}_0x16f884[_0xbe14('0x26')](_0x19252f);return _0x16f884[_0xbe14('0x2a')](_0xbe14('0x2b'),_0x3b3e84+'-'+_0x1c7cc7+'/'+_0x3c3613)[_0xbe14('0x2c')](_0x59bf34);}return null;};}function patchUpdates(_0x39dc0a){return function(_0x10ae36){try{jsonpatch[_0xbe14('0x2d')](_0x10ae36,_0x39dc0a,!![]);}catch(_0xe6feb2){return BPromise[_0xbe14('0x2e')](_0xe6feb2);}return _0x10ae36[_0xbe14('0x2f')]();};}function saveUpdates(_0x29e76a,_0x14e7c4){return function(_0x581e86){if(_0x581e86){return _0x581e86[_0xbe14('0x30')](_0x29e76a)['then'](function(_0x58f8de){return _0x58f8de;});}return null;};}function removeEntity(_0x46c2d1,_0x4c1e7e){return function(_0x243524){if(_0x243524){return _0x243524[_0xbe14('0x31')]()['then'](function(){_0x46c2d1['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x412ad5,_0xa3d24){return function(_0x5f27b6){if(!_0x5f27b6){_0x412ad5[_0xbe14('0x25')](0x194);}return _0x5f27b6;};}function handleError(_0x1faf3e,_0x452635){_0x452635=_0x452635||0x1f4;return function(_0x1aa849){logger[_0xbe14('0x22')](_0x1aa849['stack']);if(_0x1aa849['name']){delete _0x1aa849[_0xbe14('0x32')];}_0x1faf3e['status'](_0x452635)['send'](_0x1aa849);};}exports['index']=function(_0x163ef7,_0x393f6b){var _0x2bb45={},_0x3dbacb={},_0x172e79={'count':0x0,'rows':[]};var _0x29356f=_[_0xbe14('0x33')](db[_0xbe14('0x34')][_0xbe14('0x35')],function(_0x2dfd5a){return{'name':_0x2dfd5a[_0xbe14('0x36')],'type':_0x2dfd5a[_0xbe14('0x37')]['key']};});_0x3dbacb['model']=_[_0xbe14('0x33')](_0x29356f,_0xbe14('0x32'));_0x3dbacb[_0xbe14('0x38')]=_['keys'](_0x163ef7[_0xbe14('0x38')]);_0x3dbacb[_0xbe14('0x39')]=_[_0xbe14('0x3a')](_0x3dbacb[_0xbe14('0x3b')],_0x3dbacb[_0xbe14('0x38')]);_0x2bb45[_0xbe14('0x3c')]=_[_0xbe14('0x3a')](_0x3dbacb[_0xbe14('0x3b')],qs[_0xbe14('0x3d')](_0x163ef7['query'][_0xbe14('0x3d')]));_0x2bb45[_0xbe14('0x3c')]=_0x2bb45[_0xbe14('0x3c')][_0xbe14('0x3e')]?_0x2bb45[_0xbe14('0x3c')]:_0x3dbacb[_0xbe14('0x3b')];if(!_0x163ef7['query'][_0xbe14('0x3f')](_0xbe14('0x40'))){_0x2bb45[_0xbe14('0x29')]=qs[_0xbe14('0x29')](_0x163ef7['query']['limit']);_0x2bb45[_0xbe14('0x28')]=qs[_0xbe14('0x28')](_0x163ef7[_0xbe14('0x38')]['offset']);}_0x2bb45['order']=qs[_0xbe14('0x41')](_0x163ef7['query']['sort']);_0x2bb45[_0xbe14('0x42')]=qs[_0xbe14('0x39')](_[_0xbe14('0x43')](_0x163ef7['query'],_0x3dbacb['filters']));if(_0x163ef7['query'][_0xbe14('0x44')]){_0x2bb45[_0xbe14('0x42')]=_[_0xbe14('0x45')](_0x2bb45['where'],{'$or':_[_0xbe14('0x33')](_0x29356f,function(_0xcb0680){if(_0xcb0680[_0xbe14('0x37')]!==_0xbe14('0x46')){var _0x58351f={};_0x58351f[_0xcb0680['name']]={'$like':'%'+_0x163ef7[_0xbe14('0x38')][_0xbe14('0x44')]+'%'};return _0x58351f;}})});}_0x2bb45=_[_0xbe14('0x45')]({},_0x2bb45,_0x163ef7[_0xbe14('0x47')]);var _0x2550dc={'where':_0x2bb45['where']};return db['ZohoConfiguration'][_0xbe14('0x27')](_0x2550dc)[_0xbe14('0x1c')](function(_0x238c60){_0x172e79[_0xbe14('0x27')]=_0x238c60;if(_0x163ef7['query'][_0xbe14('0x48')]){_0x2bb45[_0xbe14('0x49')]=[{'all':!![]}];}return db['ZohoConfiguration'][_0xbe14('0x4a')](_0x2bb45);})[_0xbe14('0x1c')](function(_0x2d6ee8){_0x172e79[_0xbe14('0x4b')]=_0x2d6ee8;return _0x172e79;})['then'](respondWithFilteredResult(_0x393f6b,_0x2bb45))['catch'](handleError(_0x393f6b,null));};exports[_0xbe14('0x4c')]=function(_0x29564b,_0x4a1a37){var _0x5acf90={'raw':![],'where':{'id':_0x29564b[_0xbe14('0x4d')]['id']}},_0xca8cdb={};_0xca8cdb[_0xbe14('0x3b')]=_[_0xbe14('0x4e')](db[_0xbe14('0x34')][_0xbe14('0x35')]);_0xca8cdb[_0xbe14('0x38')]=_['keys'](_0x29564b[_0xbe14('0x38')]);_0xca8cdb[_0xbe14('0x39')]=_[_0xbe14('0x3a')](_0xca8cdb[_0xbe14('0x3b')],_0xca8cdb[_0xbe14('0x38')]);_0x5acf90['attributes']=_[_0xbe14('0x3a')](_0xca8cdb[_0xbe14('0x3b')],qs[_0xbe14('0x3d')](_0x29564b[_0xbe14('0x38')][_0xbe14('0x3d')]));_0x5acf90[_0xbe14('0x3c')]=_0x5acf90['attributes']['length']?_0x5acf90[_0xbe14('0x3c')]:_0xca8cdb[_0xbe14('0x3b')];if(_0x29564b[_0xbe14('0x38')]['includeAll']){_0x5acf90['include']=[{'all':!![]}];}_0x5acf90=_[_0xbe14('0x45')]({},_0x5acf90,_0x29564b[_0xbe14('0x47')]);return db['ZohoConfiguration'][_0xbe14('0x4f')](_0x5acf90)[_0xbe14('0x1c')](handleEntityNotFound(_0x4a1a37,null))['then'](respondWithResult(_0x4a1a37,null))[_0xbe14('0x50')](handleError(_0x4a1a37,null));};exports['create']=function(_0x41ba58,_0x410c59){return db[_0xbe14('0x34')]['create'](_0x41ba58[_0xbe14('0x51')],{})[_0xbe14('0x1c')](respondWithResult(_0x410c59,0xc9))['catch'](handleError(_0x410c59,null));};exports[_0xbe14('0x30')]=function(_0x42ca15,_0x2210cc){if(_0x42ca15[_0xbe14('0x51')]['id']){delete _0x42ca15[_0xbe14('0x51')]['id'];}return db['ZohoConfiguration'][_0xbe14('0x4f')]({'where':{'id':_0x42ca15[_0xbe14('0x4d')]['id']}})[_0xbe14('0x1c')](handleEntityNotFound(_0x2210cc,null))[_0xbe14('0x1c')](saveUpdates(_0x42ca15[_0xbe14('0x51')],null))[_0xbe14('0x1c')](respondWithResult(_0x2210cc,null))[_0xbe14('0x50')](handleError(_0x2210cc,null));};exports['destroy']=function(_0x72c875,_0x1b47a4){return db[_0xbe14('0x34')][_0xbe14('0x4f')]({'where':{'id':_0x72c875[_0xbe14('0x4d')]['id']}})[_0xbe14('0x1c')](handleEntityNotFound(_0x1b47a4,null))[_0xbe14('0x1c')](removeEntity(_0x1b47a4,null))[_0xbe14('0x50')](handleError(_0x1b47a4,null));};exports[_0xbe14('0x52')]=function(_0xc61103,_0x358950,_0x4bccfc){var _0x56bcd3={};var _0x58dd79={};var _0x10c0bc;var _0x1bfcbf;return db[_0xbe14('0x34')][_0xbe14('0x53')]({'where':{'id':_0xc61103[_0xbe14('0x4d')]['id']}})[_0xbe14('0x1c')](handleEntityNotFound(_0x358950,null))[_0xbe14('0x1c')](function(_0x22bf69){if(_0x22bf69){_0x10c0bc=_0x22bf69;_0x58dd79[_0xbe14('0x3b')]=_[_0xbe14('0x4e')](db[_0xbe14('0x54')][_0xbe14('0x35')]);_0x58dd79[_0xbe14('0x38')]=_[_0xbe14('0x4e')](_0xc61103[_0xbe14('0x38')]);_0x58dd79[_0xbe14('0x39')]=_[_0xbe14('0x3a')](_0x58dd79[_0xbe14('0x3b')],_0x58dd79[_0xbe14('0x38')]);_0x56bcd3[_0xbe14('0x3c')]=_['intersection'](_0x58dd79[_0xbe14('0x3b')],qs[_0xbe14('0x3d')](_0xc61103[_0xbe14('0x38')][_0xbe14('0x3d')]));_0x56bcd3[_0xbe14('0x3c')]=_0x56bcd3[_0xbe14('0x3c')][_0xbe14('0x3e')]?_0x56bcd3[_0xbe14('0x3c')]:_0x58dd79[_0xbe14('0x3b')];_0x56bcd3[_0xbe14('0x55')]=qs['sort'](_0xc61103[_0xbe14('0x38')][_0xbe14('0x41')]);_0x56bcd3[_0xbe14('0x42')]=qs[_0xbe14('0x39')](_[_0xbe14('0x43')](_0xc61103['query'],_0x58dd79[_0xbe14('0x39')]));if(_0xc61103[_0xbe14('0x38')][_0xbe14('0x44')]){_0x56bcd3[_0xbe14('0x42')]=_[_0xbe14('0x45')](_0x56bcd3['where'],{'$or':_[_0xbe14('0x33')](_0x56bcd3[_0xbe14('0x3c')],function(_0x7ea146){var _0x29bb26={};_0x29bb26[_0x7ea146]={'$like':'%'+_0xc61103[_0xbe14('0x38')][_0xbe14('0x44')]+'%'};return _0x29bb26;})});}_0x56bcd3=_[_0xbe14('0x45')]({},_0x56bcd3,_0xc61103[_0xbe14('0x47')]);return _0x10c0bc['getFields'](_0x56bcd3);}})[_0xbe14('0x1c')](function(_0x33c309){if(_0x33c309){_0x1bfcbf=_0x33c309[_0xbe14('0x3e')];if(!_0xc61103[_0xbe14('0x38')][_0xbe14('0x3f')](_0xbe14('0x40'))){_0x56bcd3[_0xbe14('0x29')]=qs['limit'](_0xc61103['query'][_0xbe14('0x29')]);_0x56bcd3[_0xbe14('0x28')]=qs[_0xbe14('0x28')](_0xc61103[_0xbe14('0x38')][_0xbe14('0x28')]);}return _0x10c0bc[_0xbe14('0x52')](_0x56bcd3);}})[_0xbe14('0x1c')](function(_0x43511e){if(_0x43511e){return _0x43511e?{'count':_0x1bfcbf,'rows':_0x43511e}:null;}})['then'](respondWithResult(_0x358950,null))['catch'](handleError(_0x358950,null));};exports[_0xbe14('0x56')]=function(_0x1c18b6,_0x29aa52,_0x57729f){var _0x76e91e={};var _0x16bca1={};var _0x105be0;var _0x1797dd;return db[_0xbe14('0x34')][_0xbe14('0x53')]({'where':{'id':_0x1c18b6[_0xbe14('0x4d')]['id']}})['then'](handleEntityNotFound(_0x29aa52,null))[_0xbe14('0x1c')](function(_0x3b6ef5){if(_0x3b6ef5){_0x105be0=_0x3b6ef5;_0x16bca1[_0xbe14('0x3b')]=_[_0xbe14('0x4e')](db[_0xbe14('0x54')][_0xbe14('0x35')]);_0x16bca1[_0xbe14('0x38')]=_['keys'](_0x1c18b6[_0xbe14('0x38')]);_0x16bca1[_0xbe14('0x39')]=_[_0xbe14('0x3a')](_0x16bca1[_0xbe14('0x3b')],_0x16bca1[_0xbe14('0x38')]);_0x76e91e[_0xbe14('0x3c')]=_[_0xbe14('0x3a')](_0x16bca1[_0xbe14('0x3b')],qs['fields'](_0x1c18b6[_0xbe14('0x38')][_0xbe14('0x3d')]));_0x76e91e[_0xbe14('0x3c')]=_0x76e91e[_0xbe14('0x3c')][_0xbe14('0x3e')]?_0x76e91e[_0xbe14('0x3c')]:_0x16bca1['model'];_0x76e91e[_0xbe14('0x55')]=qs[_0xbe14('0x41')](_0x1c18b6[_0xbe14('0x38')][_0xbe14('0x41')]);_0x76e91e['where']=qs[_0xbe14('0x39')](_[_0xbe14('0x43')](_0x1c18b6[_0xbe14('0x38')],_0x16bca1[_0xbe14('0x39')]));if(_0x1c18b6[_0xbe14('0x38')][_0xbe14('0x44')]){_0x76e91e[_0xbe14('0x42')]=_['merge'](_0x76e91e[_0xbe14('0x42')],{'$or':_['map'](_0x76e91e[_0xbe14('0x3c')],function(_0x5d85d3){var _0x389822={};_0x389822[_0x5d85d3]={'$like':'%'+_0x1c18b6[_0xbe14('0x38')][_0xbe14('0x44')]+'%'};return _0x389822;})});}_0x76e91e=_['merge']({},_0x76e91e,_0x1c18b6[_0xbe14('0x47')]);return _0x105be0[_0xbe14('0x56')](_0x76e91e);}})[_0xbe14('0x1c')](function(_0x546f22){if(_0x546f22){_0x1797dd=_0x546f22[_0xbe14('0x3e')];if(!_0x1c18b6[_0xbe14('0x38')][_0xbe14('0x3f')](_0xbe14('0x40'))){_0x76e91e['limit']=qs[_0xbe14('0x29')](_0x1c18b6[_0xbe14('0x38')][_0xbe14('0x29')]);_0x76e91e[_0xbe14('0x28')]=qs[_0xbe14('0x28')](_0x1c18b6[_0xbe14('0x38')][_0xbe14('0x28')]);}return _0x105be0['getSubjects'](_0x76e91e);}})[_0xbe14('0x1c')](function(_0x123f4f){if(_0x123f4f){return _0x123f4f?{'count':_0x1797dd,'rows':_0x123f4f}:null;}})[_0xbe14('0x1c')](respondWithResult(_0x29aa52,null))['catch'](handleError(_0x29aa52,null));};exports[_0xbe14('0x57')]=function(_0x420467,_0x1ea305,_0x5bc52b){var _0xa53262={};var _0x1205d1={};var _0x47d7bb;var _0x2be969;return db['ZohoConfiguration'][_0xbe14('0x53')]({'where':{'id':_0x420467[_0xbe14('0x4d')]['id']}})['then'](handleEntityNotFound(_0x1ea305,null))['then'](function(_0x54045e){if(_0x54045e){_0x47d7bb=_0x54045e;_0x1205d1[_0xbe14('0x3b')]=_[_0xbe14('0x4e')](db['ZohoField'][_0xbe14('0x35')]);_0x1205d1[_0xbe14('0x38')]=_[_0xbe14('0x4e')](_0x420467[_0xbe14('0x38')]);_0x1205d1['filters']=_['intersection'](_0x1205d1[_0xbe14('0x3b')],_0x1205d1[_0xbe14('0x38')]);_0xa53262[_0xbe14('0x3c')]=_[_0xbe14('0x3a')](_0x1205d1[_0xbe14('0x3b')],qs[_0xbe14('0x3d')](_0x420467[_0xbe14('0x38')]['fields']));_0xa53262[_0xbe14('0x3c')]=_0xa53262['attributes'][_0xbe14('0x3e')]?_0xa53262[_0xbe14('0x3c')]:_0x1205d1[_0xbe14('0x3b')];_0xa53262[_0xbe14('0x55')]=qs['sort'](_0x420467[_0xbe14('0x38')][_0xbe14('0x41')]);_0xa53262[_0xbe14('0x42')]=qs['filters'](_[_0xbe14('0x43')](_0x420467[_0xbe14('0x38')],_0x1205d1[_0xbe14('0x39')]));if(_0x420467[_0xbe14('0x38')][_0xbe14('0x44')]){_0xa53262[_0xbe14('0x42')]=_[_0xbe14('0x45')](_0xa53262[_0xbe14('0x42')],{'$or':_[_0xbe14('0x33')](_0xa53262[_0xbe14('0x3c')],function(_0x2bf94c){var _0x49497e={};_0x49497e[_0x2bf94c]={'$like':'%'+_0x420467[_0xbe14('0x38')][_0xbe14('0x44')]+'%'};return _0x49497e;})});}_0xa53262=_[_0xbe14('0x45')]({},_0xa53262,_0x420467[_0xbe14('0x47')]);return _0x47d7bb[_0xbe14('0x57')](_0xa53262);}})[_0xbe14('0x1c')](function(_0x1679bd){if(_0x1679bd){_0x2be969=_0x1679bd[_0xbe14('0x3e')];if(!_0x420467['query'][_0xbe14('0x3f')]('nolimit')){_0xa53262[_0xbe14('0x29')]=qs[_0xbe14('0x29')](_0x420467[_0xbe14('0x38')][_0xbe14('0x29')]);_0xa53262[_0xbe14('0x28')]=qs['offset'](_0x420467['query'][_0xbe14('0x28')]);}return _0x47d7bb[_0xbe14('0x57')](_0xa53262);}})[_0xbe14('0x1c')](function(_0x42b849){if(_0x42b849){return _0x42b849?{'count':_0x2be969,'rows':_0x42b849}:null;}})['then'](respondWithResult(_0x1ea305,null))[_0xbe14('0x50')](handleError(_0x1ea305,null));}; \ No newline at end of file +var _0x7217=['fields','attributes','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','ZohoConfiguration','includeAll','rows','show','rawAttributes','keys','intersection','include','options','find','create','body','params','getFields','ZohoField','getSubjects','hasOwnProperty','getDescriptions','findOne','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','http','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','ZohoConfiguration,\x20%s,\x20%s','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','sendStatus','status','end','count','offset','limit','Content-Range','json','apply','save','update','destroy','then','stack','name','index','map','type','key','model','query','filters'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7217,0x19e));var _0x7721=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0x7217[_0x5e3b04];return _0x1fc44d;};'use strict';var pdf=require(_0x7721('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x7721('0x1'));var zipdir=require(_0x7721('0x2'));var jsonpatch=require(_0x7721('0x3'));var rp=require(_0x7721('0x4'));var moment=require(_0x7721('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x7721('0x6'));var path=require(_0x7721('0x7'));var sox=require(_0x7721('0x8'));var csv=require(_0x7721('0x9'));var ejs=require(_0x7721('0xa'));var fs=require('fs');var _=require(_0x7721('0xb'));var squel=require(_0x7721('0xc'));var crypto=require(_0x7721('0xd'));var jsforce=require(_0x7721('0xe'));var deskjs=require(_0x7721('0xf'));var toCsv=require(_0x7721('0x9'));var querystring=require(_0x7721('0x10'));var Papa=require(_0x7721('0x11'));var Redis=require(_0x7721('0x12'));var authService=require(_0x7721('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x7721('0x14'));var hardwareService=require(_0x7721('0x15'));var logger=require(_0x7721('0x16'))(_0x7721('0x17'));var utils=require(_0x7721('0x18'));var config=require(_0x7721('0x19'));var db=require(_0x7721('0x1a'))['db'];var jayson=require(_0x7721('0x1b'));var client=jayson['client'][_0x7721('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x199930,_0x57ff6d,_0x109900){if(_0x109900){var _0x30da54=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x30da54[_0x7721('0x1d')](_0x57ff6d)){return _0x199930;}else{throw new db[(_0x7721('0x1e'))]['ValidationError'](_0x7721('0x1f'));}}else{return _0x199930;}}function respondWithRpcPromise(_0x25b1c0,_0x534f1b,_0x4e199a,_0x4b183e){return new BPromise(function(_0x5ed54,_0x25a628){var _0x3cc909=_0x4b183e||client;return _0x3cc909[_0x7721('0x20')](_0x25b1c0,_0x4e199a)['then'](function(_0x20f669){logger['info'](_0x7721('0x21'),_0x534f1b,'request\x20sent');logger[_0x7721('0x22')](_0x7721('0x23'),_0x534f1b,_0x7721('0x24'),JSON[_0x7721('0x25')](_0x20f669));if(_0x20f669[_0x7721('0x26')]){if(_0x20f669[_0x7721('0x26')][_0x7721('0x27')]===0x1f4){logger[_0x7721('0x26')](_0x7721('0x21'),_0x534f1b,_0x20f669[_0x7721('0x26')]['message']);return _0x25a628(_0x20f669[_0x7721('0x26')][_0x7721('0x28')]);}logger[_0x7721('0x26')](_0x7721('0x21'),_0x534f1b,_0x20f669['error'][_0x7721('0x28')]);return _0x5ed54(_0x20f669['error'][_0x7721('0x28')]);}else{logger[_0x7721('0x29')](_0x7721('0x21'),_0x534f1b,_0x7721('0x24'));_0x5ed54(_0x20f669[_0x7721('0x2a')][_0x7721('0x28')]);}})[_0x7721('0x2b')](function(_0x5b4d74){logger[_0x7721('0x26')](_0x7721('0x21'),_0x534f1b,_0x5b4d74);_0x25a628(_0x5b4d74);});});}function respondWithStatusCode(_0x125564,_0x1f67c7){_0x1f67c7=_0x1f67c7||0xcc;return function(_0x40d550){if(_0x40d550){return _0x125564[_0x7721('0x2c')](_0x1f67c7);}return _0x125564[_0x7721('0x2d')](_0x1f67c7)[_0x7721('0x2e')]();};}function respondWithResult(_0x40f367,_0x52316e){_0x52316e=_0x52316e||0xc8;return function(_0x258ddf){if(_0x258ddf){return _0x40f367['status'](_0x52316e)['json'](_0x258ddf);}};}function respondWithFilteredResult(_0x315202,_0x343c19){return function(_0x53c904){if(_0x53c904){var _0x158d98=_0x53c904[_0x7721('0x2f')],_0x1ea4d=_0x343c19['offset'],_0x37b9f0=_0x343c19[_0x7721('0x30')]+_0x343c19[_0x7721('0x31')],_0xd7d703;if(_0x37b9f0>=_0x158d98){_0x37b9f0=_0x158d98;_0xd7d703=0xc8;}else{_0xd7d703=0xce;}_0x315202['status'](_0xd7d703);return _0x315202['set'](_0x7721('0x32'),_0x1ea4d+'-'+_0x37b9f0+'/'+_0x158d98)[_0x7721('0x33')](_0x53c904);}return null;};}function patchUpdates(_0x48f329){return function(_0x46f772){try{jsonpatch[_0x7721('0x34')](_0x46f772,_0x48f329,!![]);}catch(_0x382821){return BPromise['reject'](_0x382821);}return _0x46f772[_0x7721('0x35')]();};}function saveUpdates(_0x1ff31b,_0x1492d4){return function(_0x3f15e2){if(_0x3f15e2){return _0x3f15e2[_0x7721('0x36')](_0x1ff31b)['then'](function(_0x195ffb){return _0x195ffb;});}return null;};}function removeEntity(_0x3e4e56,_0xb2386d){return function(_0x5c5b33){if(_0x5c5b33){return _0x5c5b33[_0x7721('0x37')]()[_0x7721('0x38')](function(){_0x3e4e56['status'](0xcc)[_0x7721('0x2e')]();});}};}function handleEntityNotFound(_0x5ce026,_0x2d6ba0){return function(_0x326c50){if(!_0x326c50){_0x5ce026[_0x7721('0x2c')](0x194);}return _0x326c50;};}function handleError(_0x1d894b,_0x1c84c0){_0x1c84c0=_0x1c84c0||0x1f4;return function(_0x13c635){logger[_0x7721('0x26')](_0x13c635[_0x7721('0x39')]);if(_0x13c635[_0x7721('0x3a')]){delete _0x13c635[_0x7721('0x3a')];}_0x1d894b[_0x7721('0x2d')](_0x1c84c0)['send'](_0x13c635);};}exports[_0x7721('0x3b')]=function(_0x5e6663,_0x212384){var _0x35614c={},_0x7942f7={},_0x1d03de={'count':0x0,'rows':[]};var _0x3968f3=_[_0x7721('0x3c')](db['ZohoConfiguration']['rawAttributes'],function(_0x4cadef){return{'name':_0x4cadef['fieldName'],'type':_0x4cadef[_0x7721('0x3d')][_0x7721('0x3e')]};});_0x7942f7[_0x7721('0x3f')]=_[_0x7721('0x3c')](_0x3968f3,'name');_0x7942f7[_0x7721('0x40')]=_['keys'](_0x5e6663[_0x7721('0x40')]);_0x7942f7[_0x7721('0x41')]=_['intersection'](_0x7942f7[_0x7721('0x3f')],_0x7942f7[_0x7721('0x40')]);_0x35614c['attributes']=_['intersection'](_0x7942f7[_0x7721('0x3f')],qs[_0x7721('0x42')](_0x5e6663[_0x7721('0x40')][_0x7721('0x42')]));_0x35614c['attributes']=_0x35614c[_0x7721('0x43')][_0x7721('0x44')]?_0x35614c[_0x7721('0x43')]:_0x7942f7[_0x7721('0x3f')];if(!_0x5e6663[_0x7721('0x40')]['hasOwnProperty'](_0x7721('0x45'))){_0x35614c['limit']=qs[_0x7721('0x31')](_0x5e6663['query'][_0x7721('0x31')]);_0x35614c[_0x7721('0x30')]=qs[_0x7721('0x30')](_0x5e6663['query'][_0x7721('0x30')]);}_0x35614c[_0x7721('0x46')]=qs[_0x7721('0x47')](_0x5e6663['query'][_0x7721('0x47')]);_0x35614c[_0x7721('0x48')]=qs[_0x7721('0x41')](_[_0x7721('0x49')](_0x5e6663[_0x7721('0x40')],_0x7942f7[_0x7721('0x41')]));if(_0x5e6663[_0x7721('0x40')]['filter']){_0x35614c['where']=_[_0x7721('0x4a')](_0x35614c[_0x7721('0x48')],{'$or':_[_0x7721('0x3c')](_0x3968f3,function(_0x39a3ad){if(_0x39a3ad[_0x7721('0x3d')]!==_0x7721('0x4b')){var _0x1d2ea5={};_0x1d2ea5[_0x39a3ad[_0x7721('0x3a')]]={'$like':'%'+_0x5e6663[_0x7721('0x40')][_0x7721('0x4c')]+'%'};return _0x1d2ea5;}})});}_0x35614c=_['merge']({},_0x35614c,_0x5e6663['options']);var _0x5ed70d={'where':_0x35614c[_0x7721('0x48')]};return db[_0x7721('0x4d')][_0x7721('0x2f')](_0x5ed70d)['then'](function(_0x30107e){_0x1d03de[_0x7721('0x2f')]=_0x30107e;if(_0x5e6663['query'][_0x7721('0x4e')]){_0x35614c['include']=[{'all':!![]}];}return db[_0x7721('0x4d')]['findAll'](_0x35614c);})[_0x7721('0x38')](function(_0x196be4){_0x1d03de[_0x7721('0x4f')]=_0x196be4;return _0x1d03de;})['then'](respondWithFilteredResult(_0x212384,_0x35614c))[_0x7721('0x2b')](handleError(_0x212384,null));};exports[_0x7721('0x50')]=function(_0x499381,_0x223d93){var _0x1196c2={'raw':![],'where':{'id':_0x499381['params']['id']}},_0xf88e8c={};_0xf88e8c[_0x7721('0x3f')]=_['keys'](db[_0x7721('0x4d')][_0x7721('0x51')]);_0xf88e8c[_0x7721('0x40')]=_[_0x7721('0x52')](_0x499381[_0x7721('0x40')]);_0xf88e8c[_0x7721('0x41')]=_[_0x7721('0x53')](_0xf88e8c[_0x7721('0x3f')],_0xf88e8c[_0x7721('0x40')]);_0x1196c2[_0x7721('0x43')]=_[_0x7721('0x53')](_0xf88e8c[_0x7721('0x3f')],qs[_0x7721('0x42')](_0x499381[_0x7721('0x40')][_0x7721('0x42')]));_0x1196c2['attributes']=_0x1196c2[_0x7721('0x43')][_0x7721('0x44')]?_0x1196c2[_0x7721('0x43')]:_0xf88e8c[_0x7721('0x3f')];if(_0x499381[_0x7721('0x40')][_0x7721('0x4e')]){_0x1196c2[_0x7721('0x54')]=[{'all':!![]}];}_0x1196c2=_['merge']({},_0x1196c2,_0x499381[_0x7721('0x55')]);return db[_0x7721('0x4d')][_0x7721('0x56')](_0x1196c2)[_0x7721('0x38')](handleEntityNotFound(_0x223d93,null))[_0x7721('0x38')](respondWithResult(_0x223d93,null))[_0x7721('0x2b')](handleError(_0x223d93,null));};exports[_0x7721('0x57')]=function(_0x33287d,_0x11b300){return db[_0x7721('0x4d')][_0x7721('0x57')](_0x33287d['body'],{})[_0x7721('0x38')](respondWithResult(_0x11b300,0xc9))[_0x7721('0x2b')](handleError(_0x11b300,null));};exports[_0x7721('0x36')]=function(_0x2ee3c0,_0x15ed3b){if(_0x2ee3c0[_0x7721('0x58')]['id']){delete _0x2ee3c0[_0x7721('0x58')]['id'];}return db[_0x7721('0x4d')][_0x7721('0x56')]({'where':{'id':_0x2ee3c0[_0x7721('0x59')]['id']}})[_0x7721('0x38')](handleEntityNotFound(_0x15ed3b,null))[_0x7721('0x38')](saveUpdates(_0x2ee3c0[_0x7721('0x58')],null))[_0x7721('0x38')](respondWithResult(_0x15ed3b,null))[_0x7721('0x2b')](handleError(_0x15ed3b,null));};exports['destroy']=function(_0x50e9e9,_0x4e112e){return db[_0x7721('0x4d')]['find']({'where':{'id':_0x50e9e9['params']['id']}})['then'](handleEntityNotFound(_0x4e112e,null))['then'](removeEntity(_0x4e112e,null))[_0x7721('0x2b')](handleError(_0x4e112e,null));};exports[_0x7721('0x5a')]=function(_0x13f254,_0x5343a1,_0x5181d7){var _0x5925b7={};var _0x51a3a2={};var _0x484b8e;var _0x24d1dc;return db['ZohoConfiguration']['findOne']({'where':{'id':_0x13f254['params']['id']}})[_0x7721('0x38')](handleEntityNotFound(_0x5343a1,null))[_0x7721('0x38')](function(_0x1ff090){if(_0x1ff090){_0x484b8e=_0x1ff090;_0x51a3a2['model']=_[_0x7721('0x52')](db[_0x7721('0x5b')][_0x7721('0x51')]);_0x51a3a2[_0x7721('0x40')]=_[_0x7721('0x52')](_0x13f254[_0x7721('0x40')]);_0x51a3a2[_0x7721('0x41')]=_[_0x7721('0x53')](_0x51a3a2[_0x7721('0x3f')],_0x51a3a2[_0x7721('0x40')]);_0x5925b7[_0x7721('0x43')]=_[_0x7721('0x53')](_0x51a3a2[_0x7721('0x3f')],qs[_0x7721('0x42')](_0x13f254[_0x7721('0x40')]['fields']));_0x5925b7[_0x7721('0x43')]=_0x5925b7[_0x7721('0x43')][_0x7721('0x44')]?_0x5925b7[_0x7721('0x43')]:_0x51a3a2['model'];_0x5925b7[_0x7721('0x46')]=qs[_0x7721('0x47')](_0x13f254['query'][_0x7721('0x47')]);_0x5925b7['where']=qs[_0x7721('0x41')](_[_0x7721('0x49')](_0x13f254[_0x7721('0x40')],_0x51a3a2[_0x7721('0x41')]));if(_0x13f254[_0x7721('0x40')][_0x7721('0x4c')]){_0x5925b7[_0x7721('0x48')]=_[_0x7721('0x4a')](_0x5925b7[_0x7721('0x48')],{'$or':_['map'](_0x5925b7[_0x7721('0x43')],function(_0x24444f){var _0x112033={};_0x112033[_0x24444f]={'$like':'%'+_0x13f254[_0x7721('0x40')][_0x7721('0x4c')]+'%'};return _0x112033;})});}_0x5925b7=_[_0x7721('0x4a')]({},_0x5925b7,_0x13f254[_0x7721('0x55')]);return _0x484b8e['getFields'](_0x5925b7);}})[_0x7721('0x38')](function(_0xb19b84){if(_0xb19b84){_0x24d1dc=_0xb19b84['length'];if(!_0x13f254[_0x7721('0x40')]['hasOwnProperty'](_0x7721('0x45'))){_0x5925b7[_0x7721('0x31')]=qs[_0x7721('0x31')](_0x13f254[_0x7721('0x40')][_0x7721('0x31')]);_0x5925b7[_0x7721('0x30')]=qs[_0x7721('0x30')](_0x13f254['query'][_0x7721('0x30')]);}return _0x484b8e[_0x7721('0x5a')](_0x5925b7);}})[_0x7721('0x38')](function(_0x5f08cc){if(_0x5f08cc){return _0x5f08cc?{'count':_0x24d1dc,'rows':_0x5f08cc}:null;}})['then'](respondWithResult(_0x5343a1,null))['catch'](handleError(_0x5343a1,null));};exports['getSubjects']=function(_0x5e966f,_0x1fc5f7,_0x2645dd){var _0x580473={};var _0x2d4b3a={};var _0x42f6e9;var _0xbbc86f;return db[_0x7721('0x4d')]['findOne']({'where':{'id':_0x5e966f[_0x7721('0x59')]['id']}})[_0x7721('0x38')](handleEntityNotFound(_0x1fc5f7,null))[_0x7721('0x38')](function(_0x1bea13){if(_0x1bea13){_0x42f6e9=_0x1bea13;_0x2d4b3a[_0x7721('0x3f')]=_['keys'](db[_0x7721('0x5b')][_0x7721('0x51')]);_0x2d4b3a[_0x7721('0x40')]=_['keys'](_0x5e966f['query']);_0x2d4b3a[_0x7721('0x41')]=_[_0x7721('0x53')](_0x2d4b3a[_0x7721('0x3f')],_0x2d4b3a[_0x7721('0x40')]);_0x580473[_0x7721('0x43')]=_['intersection'](_0x2d4b3a['model'],qs[_0x7721('0x42')](_0x5e966f[_0x7721('0x40')][_0x7721('0x42')]));_0x580473[_0x7721('0x43')]=_0x580473[_0x7721('0x43')][_0x7721('0x44')]?_0x580473[_0x7721('0x43')]:_0x2d4b3a['model'];_0x580473[_0x7721('0x46')]=qs[_0x7721('0x47')](_0x5e966f[_0x7721('0x40')]['sort']);_0x580473[_0x7721('0x48')]=qs[_0x7721('0x41')](_[_0x7721('0x49')](_0x5e966f[_0x7721('0x40')],_0x2d4b3a['filters']));if(_0x5e966f['query'][_0x7721('0x4c')]){_0x580473[_0x7721('0x48')]=_[_0x7721('0x4a')](_0x580473[_0x7721('0x48')],{'$or':_[_0x7721('0x3c')](_0x580473[_0x7721('0x43')],function(_0x59e80c){var _0x3855d5={};_0x3855d5[_0x59e80c]={'$like':'%'+_0x5e966f[_0x7721('0x40')][_0x7721('0x4c')]+'%'};return _0x3855d5;})});}_0x580473=_['merge']({},_0x580473,_0x5e966f[_0x7721('0x55')]);return _0x42f6e9[_0x7721('0x5c')](_0x580473);}})[_0x7721('0x38')](function(_0xc20188){if(_0xc20188){_0xbbc86f=_0xc20188[_0x7721('0x44')];if(!_0x5e966f['query'][_0x7721('0x5d')]('nolimit')){_0x580473[_0x7721('0x31')]=qs[_0x7721('0x31')](_0x5e966f[_0x7721('0x40')][_0x7721('0x31')]);_0x580473[_0x7721('0x30')]=qs[_0x7721('0x30')](_0x5e966f[_0x7721('0x40')][_0x7721('0x30')]);}return _0x42f6e9[_0x7721('0x5c')](_0x580473);}})[_0x7721('0x38')](function(_0x2c74d8){if(_0x2c74d8){return _0x2c74d8?{'count':_0xbbc86f,'rows':_0x2c74d8}:null;}})['then'](respondWithResult(_0x1fc5f7,null))[_0x7721('0x2b')](handleError(_0x1fc5f7,null));};exports[_0x7721('0x5e')]=function(_0x39194e,_0x5eec29,_0x94af20){var _0x26b2cc={};var _0x139517={};var _0xc9761e;var _0xcd9f0d;return db['ZohoConfiguration'][_0x7721('0x5f')]({'where':{'id':_0x39194e[_0x7721('0x59')]['id']}})[_0x7721('0x38')](handleEntityNotFound(_0x5eec29,null))[_0x7721('0x38')](function(_0x30326d){if(_0x30326d){_0xc9761e=_0x30326d;_0x139517[_0x7721('0x3f')]=_['keys'](db[_0x7721('0x5b')][_0x7721('0x51')]);_0x139517['query']=_[_0x7721('0x52')](_0x39194e['query']);_0x139517[_0x7721('0x41')]=_[_0x7721('0x53')](_0x139517['model'],_0x139517[_0x7721('0x40')]);_0x26b2cc['attributes']=_['intersection'](_0x139517['model'],qs[_0x7721('0x42')](_0x39194e[_0x7721('0x40')][_0x7721('0x42')]));_0x26b2cc['attributes']=_0x26b2cc['attributes']['length']?_0x26b2cc[_0x7721('0x43')]:_0x139517[_0x7721('0x3f')];_0x26b2cc[_0x7721('0x46')]=qs[_0x7721('0x47')](_0x39194e[_0x7721('0x40')][_0x7721('0x47')]);_0x26b2cc['where']=qs[_0x7721('0x41')](_[_0x7721('0x49')](_0x39194e[_0x7721('0x40')],_0x139517[_0x7721('0x41')]));if(_0x39194e[_0x7721('0x40')][_0x7721('0x4c')]){_0x26b2cc[_0x7721('0x48')]=_[_0x7721('0x4a')](_0x26b2cc[_0x7721('0x48')],{'$or':_[_0x7721('0x3c')](_0x26b2cc[_0x7721('0x43')],function(_0x368dbb){var _0x58429d={};_0x58429d[_0x368dbb]={'$like':'%'+_0x39194e['query'][_0x7721('0x4c')]+'%'};return _0x58429d;})});}_0x26b2cc=_[_0x7721('0x4a')]({},_0x26b2cc,_0x39194e['options']);return _0xc9761e[_0x7721('0x5e')](_0x26b2cc);}})['then'](function(_0x4e3c93){if(_0x4e3c93){_0xcd9f0d=_0x4e3c93[_0x7721('0x44')];if(!_0x39194e['query']['hasOwnProperty'](_0x7721('0x45'))){_0x26b2cc[_0x7721('0x31')]=qs[_0x7721('0x31')](_0x39194e[_0x7721('0x40')][_0x7721('0x31')]);_0x26b2cc['offset']=qs[_0x7721('0x30')](_0x39194e[_0x7721('0x40')][_0x7721('0x30')]);}return _0xc9761e[_0x7721('0x5e')](_0x26b2cc);}})['then'](function(_0x52fcc1){if(_0x52fcc1){return _0x52fcc1?{'count':_0xcd9f0d,'rows':_0x52fcc1}:null;}})[_0x7721('0x38')](respondWithResult(_0x5eec29,null))[_0x7721('0x2b')](handleError(_0x5eec29,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index f3e1f5d..443a18b 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 _0x593b=['bluebird','request-promise','path','rimraf','../../config/environment','./intZohoConfiguration.attributes','exports','define','ZohoConfiguration','lodash','../../config/logger','api','moment'];(function(_0x2ca09e,_0x2c0b52){var _0x25d84b=function(_0x3615ba){while(--_0x3615ba){_0x2ca09e['push'](_0x2ca09e['shift']());}};_0x25d84b(++_0x2c0b52);}(_0x593b,0xb2));var _0xb593=function(_0xebe29e,_0x1b8208){_0xebe29e=_0xebe29e-0x0;var _0x3bbb8f=_0x593b[_0xebe29e];return _0x3bbb8f;};'use strict';var _=require(_0xb593('0x0'));var util=require('util');var logger=require(_0xb593('0x1'))(_0xb593('0x2'));var moment=require(_0xb593('0x3'));var BPromise=require(_0xb593('0x4'));var rp=require(_0xb593('0x5'));var fs=require('fs');var path=require(_0xb593('0x6'));var rimraf=require(_0xb593('0x7'));var config=require(_0xb593('0x8'));var attributes=require(_0xb593('0x9'));module[_0xb593('0xa')]=function(_0x5e826f,_0x454b29){return _0x5e826f[_0xb593('0xb')](_0xb593('0xc'),attributes,{'tableName':'int_zoho_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7863=['define','ZohoConfiguration','int_zoho_configurations','lodash','../../config/logger','api','moment','request-promise','../../config/environment','./intZohoConfiguration.attributes','exports'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x7863,0x1a5));var _0x3786=function(_0x1489ef,_0x275d93){_0x1489ef=_0x1489ef-0x0;var _0x20e0e6=_0x7863[_0x1489ef];return _0x20e0e6;};'use strict';var _=require(_0x3786('0x0'));var util=require('util');var logger=require(_0x3786('0x1'))(_0x3786('0x2'));var moment=require(_0x3786('0x3'));var BPromise=require('bluebird');var rp=require(_0x3786('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x3786('0x5'));var attributes=require(_0x3786('0x6'));module[_0x3786('0x7')]=function(_0x321df0,_0x272a50){return _0x321df0[_0x3786('0x8')](_0x3786('0x9'),attributes,{'tableName':_0x3786('0xa'),'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 2971f93..2e1adbc 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 _0xf0da=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash'];(function(_0x934754,_0x15bd40){var _0x5cf1fc=function(_0x2c1de6){while(--_0x2c1de6){_0x934754['push'](_0x934754['shift']());}};_0x5cf1fc(++_0x15bd40);}(_0xf0da,0x164));var _0xaf0d=function(_0x2af850,_0x3dd810){_0x2af850=_0x2af850-0x0;var _0x16486f=_0xf0da[_0x2af850];return _0x16486f;};'use strict';var _=require(_0xaf0d('0x0'));var util=require('util');var moment=require(_0xaf0d('0x1'));var BPromise=require(_0xaf0d('0x2'));var rs=require(_0xaf0d('0x3'));var fs=require('fs');var Redis=require(_0xaf0d('0x4'));var db=require(_0xaf0d('0x5'))['db'];var utils=require(_0xaf0d('0x6'));var logger=require('../../config/logger')(_0xaf0d('0x7'));var config=require(_0xaf0d('0x8'));var jayson=require(_0xaf0d('0x9'));var client=jayson['client'][_0xaf0d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3c078b,_0x2c7a61,_0x1c8a54){return new BPromise(function(_0x4bfa5e,_0x24346a){return client[_0xaf0d('0xb')](_0x3c078b,_0x1c8a54)[_0xaf0d('0xc')](function(_0x29b59c){logger[_0xaf0d('0xd')](_0xaf0d('0xe'),_0x2c7a61,_0xaf0d('0xf'));logger['debug']('ZohoConfiguration,\x20%s,\x20%s,\x20%s',_0x2c7a61,_0xaf0d('0xf'),JSON['stringify'](_0x29b59c));if(_0x29b59c['error']){if(_0x29b59c[_0xaf0d('0x10')][_0xaf0d('0x11')]===0x1f4){logger[_0xaf0d('0x10')](_0xaf0d('0xe'),_0x2c7a61,_0x29b59c[_0xaf0d('0x10')][_0xaf0d('0x12')]);return _0x24346a(_0x29b59c[_0xaf0d('0x10')][_0xaf0d('0x12')]);}logger[_0xaf0d('0x10')](_0xaf0d('0xe'),_0x2c7a61,_0x29b59c['error'][_0xaf0d('0x12')]);return _0x4bfa5e(_0x29b59c['error']['message']);}else{logger[_0xaf0d('0xd')](_0xaf0d('0xe'),_0x2c7a61,_0xaf0d('0xf'));_0x4bfa5e(_0x29b59c[_0xaf0d('0x13')][_0xaf0d('0x12')]);}})[_0xaf0d('0x14')](function(_0x4148e6){logger[_0xaf0d('0x10')](_0xaf0d('0xe'),_0x2c7a61,_0x4148e6);_0x24346a(_0x4148e6);});});} \ No newline at end of file +var _0x0294=['lodash','util','moment','randomstring','ioredis','../../config/utils','rpc','jayson/promise','http','request','then','info','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','ZohoConfiguration,\x20%s,\x20%s','message','result','catch'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x0294,0x176));var _0x4029=function(_0x28085b,_0x2f6171){_0x28085b=_0x28085b-0x0;var _0x4f1700=_0x0294[_0x28085b];return _0x4f1700;};'use strict';var _=require(_0x4029('0x0'));var util=require(_0x4029('0x1'));var moment=require(_0x4029('0x2'));var BPromise=require('bluebird');var rs=require(_0x4029('0x3'));var fs=require('fs');var Redis=require(_0x4029('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x4029('0x5'));var logger=require('../../config/logger')(_0x4029('0x6'));var config=require('../../config/environment');var jayson=require(_0x4029('0x7'));var client=jayson['client'][_0x4029('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3fc888,_0x2456ad,_0x1f49ff){return new BPromise(function(_0xe476f0,_0xfcd4c9){return client[_0x4029('0x9')](_0x3fc888,_0x1f49ff)[_0x4029('0xa')](function(_0x3d298e){logger[_0x4029('0xb')]('ZohoConfiguration,\x20%s,\x20%s',_0x2456ad,'request\x20sent');logger[_0x4029('0xc')](_0x4029('0xd'),_0x2456ad,_0x4029('0xe'),JSON[_0x4029('0xf')](_0x3d298e));if(_0x3d298e['error']){if(_0x3d298e[_0x4029('0x10')][_0x4029('0x11')]===0x1f4){logger[_0x4029('0x10')](_0x4029('0x12'),_0x2456ad,_0x3d298e[_0x4029('0x10')]['message']);return _0xfcd4c9(_0x3d298e[_0x4029('0x10')]['message']);}logger[_0x4029('0x10')](_0x4029('0x12'),_0x2456ad,_0x3d298e[_0x4029('0x10')][_0x4029('0x13')]);return _0xe476f0(_0x3d298e['error'][_0x4029('0x13')]);}else{logger[_0x4029('0xb')](_0x4029('0x12'),_0x2456ad,_0x4029('0xe'));_0xe476f0(_0x3d298e[_0x4029('0x14')]['message']);}})[_0x4029('0x15')](function(_0xfc334a){logger[_0x4029('0x10')](_0x4029('0x12'),_0x2456ad,_0xfc334a);_0xfcd4c9(_0xfc334a);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index cc18654..f2fed10 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 _0x781d=['../../config/environment','./intZohoField.controller','get','isAuthenticated','index','show','post','put','update','/:id','multer','util','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x2ff669,_0x50b926){var _0x1522d6=function(_0x759f6f){while(--_0x759f6f){_0x2ff669['push'](_0x2ff669['shift']());}};_0x1522d6(++_0x50b926);}(_0x781d,0x14a));var _0xd781=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x781d[_0x397e5f];return _0x5302b8;};'use strict';var multer=require(_0xd781('0x0'));var util=require(_0xd781('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xd781('0x2'));var router=express[_0xd781('0x3')]();var auth=require(_0xd781('0x4'));var interaction=require(_0xd781('0x5'));var config=require(_0xd781('0x6'));var controller=require(_0xd781('0x7'));router[_0xd781('0x8')]('/',auth[_0xd781('0x9')](),controller[_0xd781('0xa')]);router[_0xd781('0x8')]('/:id',auth[_0xd781('0x9')](),controller[_0xd781('0xb')]);router[_0xd781('0xc')]('/',auth[_0xd781('0x9')](),controller['create']);router[_0xd781('0xd')]('/:id',auth[_0xd781('0x9')](),controller[_0xd781('0xe')]);router['delete'](_0xd781('0xf'),auth[_0xd781('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xa456=['util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./intZohoField.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','multer'];(function(_0x15bc81,_0x4d4f77){var _0x59440e=function(_0x1b60f2){while(--_0x1b60f2){_0x15bc81['push'](_0x15bc81['shift']());}};_0x59440e(++_0x4d4f77);}(_0xa456,0x142));var _0x6a45=function(_0x172747,_0x1732bd){_0x172747=_0x172747-0x0;var _0x509692=_0xa456[_0x172747];return _0x509692;};'use strict';var multer=require(_0x6a45('0x0'));var util=require(_0x6a45('0x1'));var path=require(_0x6a45('0x2'));var timeout=require(_0x6a45('0x3'));var express=require('express');var router=express[_0x6a45('0x4')]();var auth=require(_0x6a45('0x5'));var interaction=require(_0x6a45('0x6'));var config=require('../../config/environment');var controller=require(_0x6a45('0x7'));router[_0x6a45('0x8')]('/',auth[_0x6a45('0x9')](),controller[_0x6a45('0xa')]);router['get'](_0x6a45('0xb'),auth[_0x6a45('0x9')](),controller[_0x6a45('0xc')]);router[_0x6a45('0xd')]('/',auth[_0x6a45('0x9')](),controller['create']);router[_0x6a45('0xe')]('/:id',auth[_0x6a45('0x9')](),controller[_0x6a45('0xf')]);router[_0x6a45('0x10')](_0x6a45('0xb'),auth[_0x6a45('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index 27d60da..a6720ab 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 _0x925e=['STRING','customVariable','BOOLEAN','ENUM','string','variable','keyValue'];(function(_0x165ada,_0x4be17c){var _0x22517e=function(_0x49afa8){while(--_0x49afa8){_0x165ada['push'](_0x165ada['shift']());}};_0x22517e(++_0x4be17c);}(_0x925e,0x199));var _0xe925=function(_0x36bb51,_0x338f02){_0x36bb51=_0x36bb51-0x0;var _0x3aeada=_0x925e[_0x36bb51];return _0x3aeada;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0xe925('0x0')](_0xe925('0x1'),_0xe925('0x2'),'customVariable',_0xe925('0x3')),'defaultValue':_0xe925('0x1')},'content':{'type':Sequelize[_0xe925('0x4')]},'key':{'type':Sequelize[_0xe925('0x4')]},'keyType':{'type':Sequelize[_0xe925('0x0')](_0xe925('0x1'),_0xe925('0x2'),_0xe925('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xe925('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xb205=['string','customVariable','keyValue','STRING','variable','BOOLEAN','sequelize','ENUM'];(function(_0x19a9a5,_0x2bf8b2){var _0x5306fe=function(_0x20f9e1){while(--_0x20f9e1){_0x19a9a5['push'](_0x19a9a5['shift']());}};_0x5306fe(++_0x2bf8b2);}(_0xb205,0x156));var _0x5b20=function(_0x10f895,_0x1b2e77){_0x10f895=_0x10f895-0x0;var _0x3430b4=_0xb205[_0x10f895];return _0x3430b4;};'use strict';var Sequelize=require(_0x5b20('0x0'));module['exports']={'type':{'type':Sequelize[_0x5b20('0x1')](_0x5b20('0x2'),'variable',_0x5b20('0x3'),_0x5b20('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0x5b20('0x5')]},'key':{'type':Sequelize[_0x5b20('0x5')]},'keyType':{'type':Sequelize[_0x5b20('0x1')](_0x5b20('0x2'),_0x5b20('0x6'),_0x5b20('0x3'))},'keyContent':{'type':Sequelize[_0x5b20('0x5')]},'idField':{'type':Sequelize[_0x5b20('0x5')]},'nameField':{'type':Sequelize[_0x5b20('0x5')]},'customField':{'type':Sequelize[_0x5b20('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x5b20('0x5')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index b980859..47e19b0 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 _0x05d6=['fieldName','key','model','query','keys','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','catch','show','params','create','body','update','find','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','end','status','json','offset','limit','set','Content-Range','apply','reject','save','then','destroy','error','name','index','map','ZohoField','rawAttributes'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x05d6,0xf9));var _0x605d=function(_0x471e28,_0x49c23e){_0x471e28=_0x471e28-0x0;var _0x53bba0=_0x05d6[_0x471e28];return _0x53bba0;};'use strict';var pdf=require(_0x605d('0x0'));var emlformat=require(_0x605d('0x1'));var rimraf=require(_0x605d('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x605d('0x3'));var rp=require(_0x605d('0x4'));var moment=require('moment');var BPromise=require(_0x605d('0x5'));var Mustache=require(_0x605d('0x6'));var util=require(_0x605d('0x7'));var path=require(_0x605d('0x8'));var sox=require(_0x605d('0x9'));var csv=require(_0x605d('0xa'));var ejs=require(_0x605d('0xb'));var fs=require('fs');var _=require(_0x605d('0xc'));var squel=require(_0x605d('0xd'));var crypto=require('crypto');var jsforce=require(_0x605d('0xe'));var deskjs=require(_0x605d('0xf'));var toCsv=require(_0x605d('0xa'));var querystring=require('querystring');var Papa=require(_0x605d('0x10'));var Redis=require(_0x605d('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x605d('0x12'));var as=require(_0x605d('0x13'));var hardwareService=require(_0x605d('0x14'));var logger=require(_0x605d('0x15'))('api');var utils=require(_0x605d('0x16'));var config=require('../../config/environment');var db=require(_0x605d('0x17'))['db'];function respondWithStatusCode(_0xd64e21,_0x22e320){_0x22e320=_0x22e320||0xcc;return function(_0x36e76d){if(_0x36e76d){return _0xd64e21[_0x605d('0x18')](_0x22e320);}return _0xd64e21['status'](_0x22e320)[_0x605d('0x19')]();};}function respondWithResult(_0x152bda,_0x4fd468){_0x4fd468=_0x4fd468||0xc8;return function(_0x249faf){if(_0x249faf){return _0x152bda[_0x605d('0x1a')](_0x4fd468)[_0x605d('0x1b')](_0x249faf);}};}function respondWithFilteredResult(_0x515881,_0x47ba22){return function(_0x2b5e0c){if(_0x2b5e0c){var _0x54be34=_0x2b5e0c['count'],_0xa9854=_0x47ba22[_0x605d('0x1c')],_0x1b9ffa=_0x47ba22['offset']+_0x47ba22[_0x605d('0x1d')],_0xeed26a;if(_0x1b9ffa>=_0x54be34){_0x1b9ffa=_0x54be34;_0xeed26a=0xc8;}else{_0xeed26a=0xce;}_0x515881[_0x605d('0x1a')](_0xeed26a);return _0x515881[_0x605d('0x1e')](_0x605d('0x1f'),_0xa9854+'-'+_0x1b9ffa+'/'+_0x54be34)[_0x605d('0x1b')](_0x2b5e0c);}return null;};}function patchUpdates(_0x424330){return function(_0x1e6c5b){try{jsonpatch[_0x605d('0x20')](_0x1e6c5b,_0x424330,!![]);}catch(_0xdb9731){return BPromise[_0x605d('0x21')](_0xdb9731);}return _0x1e6c5b[_0x605d('0x22')]();};}function saveUpdates(_0x489fd1,_0x17d31d){return function(_0x56a11f){if(_0x56a11f){return _0x56a11f['update'](_0x489fd1)[_0x605d('0x23')](function(_0x4f1dfb){return _0x4f1dfb;});}return null;};}function removeEntity(_0x2c6e7b,_0x1d7617){return function(_0x40cfd3){if(_0x40cfd3){return _0x40cfd3[_0x605d('0x24')]()[_0x605d('0x23')](function(){_0x2c6e7b['status'](0xcc)[_0x605d('0x19')]();});}};}function handleEntityNotFound(_0x170ba3,_0x5c5722){return function(_0x2f7791){if(!_0x2f7791){_0x170ba3[_0x605d('0x18')](0x194);}return _0x2f7791;};}function handleError(_0x4b8e4d,_0x4847d6){_0x4847d6=_0x4847d6||0x1f4;return function(_0x28fc54){logger[_0x605d('0x25')](_0x28fc54['stack']);if(_0x28fc54[_0x605d('0x26')]){delete _0x28fc54['name'];}_0x4b8e4d[_0x605d('0x1a')](_0x4847d6)['send'](_0x28fc54);};}exports[_0x605d('0x27')]=function(_0xf05ba6,_0x41d2f5){var _0x1c2afd={},_0x417313={},_0x1ea6bd={'count':0x0,'rows':[]};var _0x44a8f3=_[_0x605d('0x28')](db[_0x605d('0x29')][_0x605d('0x2a')],function(_0x18876a){return{'name':_0x18876a[_0x605d('0x2b')],'type':_0x18876a['type'][_0x605d('0x2c')]};});_0x417313[_0x605d('0x2d')]=_[_0x605d('0x28')](_0x44a8f3,_0x605d('0x26'));_0x417313[_0x605d('0x2e')]=_[_0x605d('0x2f')](_0xf05ba6['query']);_0x417313['filters']=_['intersection'](_0x417313[_0x605d('0x2d')],_0x417313[_0x605d('0x2e')]);_0x1c2afd[_0x605d('0x30')]=_[_0x605d('0x31')](_0x417313['model'],qs[_0x605d('0x32')](_0xf05ba6[_0x605d('0x2e')][_0x605d('0x32')]));_0x1c2afd[_0x605d('0x30')]=_0x1c2afd[_0x605d('0x30')]['length']?_0x1c2afd[_0x605d('0x30')]:_0x417313[_0x605d('0x2d')];if(!_0xf05ba6[_0x605d('0x2e')][_0x605d('0x33')](_0x605d('0x34'))){_0x1c2afd['limit']=qs[_0x605d('0x1d')](_0xf05ba6[_0x605d('0x2e')]['limit']);_0x1c2afd[_0x605d('0x1c')]=qs[_0x605d('0x1c')](_0xf05ba6[_0x605d('0x2e')]['offset']);}_0x1c2afd[_0x605d('0x35')]=qs[_0x605d('0x36')](_0xf05ba6[_0x605d('0x2e')][_0x605d('0x36')]);_0x1c2afd[_0x605d('0x37')]=qs[_0x605d('0x38')](_[_0x605d('0x39')](_0xf05ba6['query'],_0x417313['filters']));if(_0xf05ba6[_0x605d('0x2e')][_0x605d('0x3a')]){_0x1c2afd[_0x605d('0x37')]=_[_0x605d('0x3b')](_0x1c2afd[_0x605d('0x37')],{'$or':_[_0x605d('0x28')](_0x44a8f3,function(_0x49bfe5){if(_0x49bfe5['type']!==_0x605d('0x3c')){var _0x22d7f1={};_0x22d7f1[_0x49bfe5[_0x605d('0x26')]]={'$like':'%'+_0xf05ba6[_0x605d('0x2e')]['filter']+'%'};return _0x22d7f1;}})});}_0x1c2afd=_[_0x605d('0x3b')]({},_0x1c2afd,_0xf05ba6[_0x605d('0x3d')]);var _0x3fe803={'where':_0x1c2afd[_0x605d('0x37')]};return db[_0x605d('0x29')][_0x605d('0x3e')](_0x3fe803)['then'](function(_0x4ae53d){_0x1ea6bd[_0x605d('0x3e')]=_0x4ae53d;if(_0xf05ba6[_0x605d('0x2e')][_0x605d('0x3f')]){_0x1c2afd[_0x605d('0x40')]=[{'all':!![]}];}return db['ZohoField'][_0x605d('0x41')](_0x1c2afd);})[_0x605d('0x23')](function(_0x4fb01f){_0x1ea6bd['rows']=_0x4fb01f;return _0x1ea6bd;})[_0x605d('0x23')](respondWithFilteredResult(_0x41d2f5,_0x1c2afd))[_0x605d('0x42')](handleError(_0x41d2f5,null));};exports[_0x605d('0x43')]=function(_0x523ec4,_0x500d32){var _0x3f8614={'raw':!![],'where':{'id':_0x523ec4[_0x605d('0x44')]['id']}},_0x47ca8d={};_0x47ca8d[_0x605d('0x2d')]=_[_0x605d('0x2f')](db['ZohoField'][_0x605d('0x2a')]);_0x47ca8d['query']=_['keys'](_0x523ec4[_0x605d('0x2e')]);_0x47ca8d['filters']=_[_0x605d('0x31')](_0x47ca8d[_0x605d('0x2d')],_0x47ca8d[_0x605d('0x2e')]);_0x3f8614[_0x605d('0x30')]=_[_0x605d('0x31')](_0x47ca8d[_0x605d('0x2d')],qs[_0x605d('0x32')](_0x523ec4[_0x605d('0x2e')][_0x605d('0x32')]));_0x3f8614[_0x605d('0x30')]=_0x3f8614['attributes']['length']?_0x3f8614['attributes']:_0x47ca8d[_0x605d('0x2d')];if(_0x523ec4[_0x605d('0x2e')][_0x605d('0x3f')]){_0x3f8614[_0x605d('0x40')]=[{'all':!![]}];}_0x3f8614=_[_0x605d('0x3b')]({},_0x3f8614,_0x523ec4['options']);return db[_0x605d('0x29')]['find'](_0x3f8614)[_0x605d('0x23')](handleEntityNotFound(_0x500d32,null))[_0x605d('0x23')](respondWithResult(_0x500d32,null))['catch'](handleError(_0x500d32,null));};exports[_0x605d('0x45')]=function(_0x1e0b4d,_0x1274ee){return db['ZohoField'][_0x605d('0x45')](_0x1e0b4d[_0x605d('0x46')],{})[_0x605d('0x23')](respondWithResult(_0x1274ee,0xc9))['catch'](handleError(_0x1274ee,null));};exports[_0x605d('0x47')]=function(_0x4a32c5,_0x55b57e){if(_0x4a32c5[_0x605d('0x46')]['id']){delete _0x4a32c5['body']['id'];}return db[_0x605d('0x29')][_0x605d('0x48')]({'where':{'id':_0x4a32c5[_0x605d('0x44')]['id']}})[_0x605d('0x23')](handleEntityNotFound(_0x55b57e,null))[_0x605d('0x23')](saveUpdates(_0x4a32c5[_0x605d('0x46')],null))[_0x605d('0x23')](respondWithResult(_0x55b57e,null))[_0x605d('0x42')](handleError(_0x55b57e,null));};exports[_0x605d('0x24')]=function(_0x355c92,_0x4dc6d1){return db[_0x605d('0x29')][_0x605d('0x48')]({'where':{'id':_0x355c92['params']['id']}})[_0x605d('0x23')](handleEntityNotFound(_0x4dc6d1,null))['then'](removeEntity(_0x4dc6d1,null))[_0x605d('0x42')](handleError(_0x4dc6d1,null));}; \ No newline at end of file +var _0xfb81=['error','stack','name','send','index','ZohoField','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filter','map','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','length','merge','create','body','update','find','destroy','html-pdf','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','count','offset','limit','set','Content-Range','apply','reject','save','then'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xfb81,0x70));var _0x1fb8=function(_0x434339,_0x2abf5e){_0x434339=_0x434339-0x0;var _0x507ca6=_0xfb81[_0x434339];return _0x507ca6;};'use strict';var pdf=require(_0x1fb8('0x0'));var emlformat=require(_0x1fb8('0x1'));var rimraf=require(_0x1fb8('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1fb8('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x1fb8('0x4'));var Mustache=require(_0x1fb8('0x5'));var util=require(_0x1fb8('0x6'));var path=require(_0x1fb8('0x7'));var sox=require(_0x1fb8('0x8'));var csv=require(_0x1fb8('0x9'));var ejs=require(_0x1fb8('0xa'));var fs=require('fs');var _=require(_0x1fb8('0xb'));var squel=require('squel');var crypto=require(_0x1fb8('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x1fb8('0x9'));var querystring=require(_0x1fb8('0xd'));var Papa=require(_0x1fb8('0xe'));var Redis=require(_0x1fb8('0xf'));var authService=require(_0x1fb8('0x10'));var qs=require(_0x1fb8('0x11'));var as=require(_0x1fb8('0x12'));var hardwareService=require(_0x1fb8('0x13'));var logger=require(_0x1fb8('0x14'))(_0x1fb8('0x15'));var utils=require(_0x1fb8('0x16'));var config=require(_0x1fb8('0x17'));var db=require(_0x1fb8('0x18'))['db'];function respondWithStatusCode(_0x134537,_0x138425){_0x138425=_0x138425||0xcc;return function(_0x54a0da){if(_0x54a0da){return _0x134537['sendStatus'](_0x138425);}return _0x134537[_0x1fb8('0x19')](_0x138425)[_0x1fb8('0x1a')]();};}function respondWithResult(_0x120b45,_0x45c848){_0x45c848=_0x45c848||0xc8;return function(_0x57b6db){if(_0x57b6db){return _0x120b45[_0x1fb8('0x19')](_0x45c848)['json'](_0x57b6db);}};}function respondWithFilteredResult(_0x1a6e8f,_0x11bedd){return function(_0x24cd47){if(_0x24cd47){var _0x45c279=_0x24cd47[_0x1fb8('0x1b')],_0x4aade9=_0x11bedd[_0x1fb8('0x1c')],_0x190010=_0x11bedd['offset']+_0x11bedd[_0x1fb8('0x1d')],_0x551c7c;if(_0x190010>=_0x45c279){_0x190010=_0x45c279;_0x551c7c=0xc8;}else{_0x551c7c=0xce;}_0x1a6e8f[_0x1fb8('0x19')](_0x551c7c);return _0x1a6e8f[_0x1fb8('0x1e')](_0x1fb8('0x1f'),_0x4aade9+'-'+_0x190010+'/'+_0x45c279)['json'](_0x24cd47);}return null;};}function patchUpdates(_0xff7222){return function(_0x1af322){try{jsonpatch[_0x1fb8('0x20')](_0x1af322,_0xff7222,!![]);}catch(_0x23b38b){return BPromise[_0x1fb8('0x21')](_0x23b38b);}return _0x1af322[_0x1fb8('0x22')]();};}function saveUpdates(_0x4a32a4,_0x5ad64d){return function(_0x2795d2){if(_0x2795d2){return _0x2795d2['update'](_0x4a32a4)[_0x1fb8('0x23')](function(_0x50223b){return _0x50223b;});}return null;};}function removeEntity(_0x5c4f74,_0x57d2c8){return function(_0x385f7c){if(_0x385f7c){return _0x385f7c['destroy']()[_0x1fb8('0x23')](function(){_0x5c4f74[_0x1fb8('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0xfa71f4,_0x2ad9c3){return function(_0x1b8de0){if(!_0x1b8de0){_0xfa71f4['sendStatus'](0x194);}return _0x1b8de0;};}function handleError(_0x138574,_0x492be4){_0x492be4=_0x492be4||0x1f4;return function(_0x14351e){logger[_0x1fb8('0x24')](_0x14351e[_0x1fb8('0x25')]);if(_0x14351e['name']){delete _0x14351e[_0x1fb8('0x26')];}_0x138574[_0x1fb8('0x19')](_0x492be4)[_0x1fb8('0x27')](_0x14351e);};}exports[_0x1fb8('0x28')]=function(_0x3655de,_0x1a4900){var _0x2ced56={},_0x95a01e={},_0xa220e7={'count':0x0,'rows':[]};var _0x12e64c=_['map'](db[_0x1fb8('0x29')]['rawAttributes'],function(_0x58645a){return{'name':_0x58645a[_0x1fb8('0x2a')],'type':_0x58645a[_0x1fb8('0x2b')][_0x1fb8('0x2c')]};});_0x95a01e[_0x1fb8('0x2d')]=_['map'](_0x12e64c,_0x1fb8('0x26'));_0x95a01e[_0x1fb8('0x2e')]=_[_0x1fb8('0x2f')](_0x3655de['query']);_0x95a01e[_0x1fb8('0x30')]=_[_0x1fb8('0x31')](_0x95a01e[_0x1fb8('0x2d')],_0x95a01e[_0x1fb8('0x2e')]);_0x2ced56[_0x1fb8('0x32')]=_[_0x1fb8('0x31')](_0x95a01e[_0x1fb8('0x2d')],qs[_0x1fb8('0x33')](_0x3655de['query'][_0x1fb8('0x33')]));_0x2ced56[_0x1fb8('0x32')]=_0x2ced56[_0x1fb8('0x32')]['length']?_0x2ced56[_0x1fb8('0x32')]:_0x95a01e[_0x1fb8('0x2d')];if(!_0x3655de[_0x1fb8('0x2e')][_0x1fb8('0x34')](_0x1fb8('0x35'))){_0x2ced56['limit']=qs[_0x1fb8('0x1d')](_0x3655de[_0x1fb8('0x2e')][_0x1fb8('0x1d')]);_0x2ced56['offset']=qs[_0x1fb8('0x1c')](_0x3655de[_0x1fb8('0x2e')][_0x1fb8('0x1c')]);}_0x2ced56['order']=qs[_0x1fb8('0x36')](_0x3655de['query'][_0x1fb8('0x36')]);_0x2ced56[_0x1fb8('0x37')]=qs['filters'](_['pick'](_0x3655de[_0x1fb8('0x2e')],_0x95a01e[_0x1fb8('0x30')]));if(_0x3655de[_0x1fb8('0x2e')][_0x1fb8('0x38')]){_0x2ced56[_0x1fb8('0x37')]=_['merge'](_0x2ced56[_0x1fb8('0x37')],{'$or':_[_0x1fb8('0x39')](_0x12e64c,function(_0x1de2b9){if(_0x1de2b9[_0x1fb8('0x2b')]!=='VIRTUAL'){var _0x3f4d26={};_0x3f4d26[_0x1de2b9[_0x1fb8('0x26')]]={'$like':'%'+_0x3655de[_0x1fb8('0x2e')][_0x1fb8('0x38')]+'%'};return _0x3f4d26;}})});}_0x2ced56=_['merge']({},_0x2ced56,_0x3655de[_0x1fb8('0x3a')]);var _0x581244={'where':_0x2ced56[_0x1fb8('0x37')]};return db['ZohoField'][_0x1fb8('0x1b')](_0x581244)[_0x1fb8('0x23')](function(_0x40fbdc){_0xa220e7[_0x1fb8('0x1b')]=_0x40fbdc;if(_0x3655de[_0x1fb8('0x2e')][_0x1fb8('0x3b')]){_0x2ced56[_0x1fb8('0x3c')]=[{'all':!![]}];}return db['ZohoField'][_0x1fb8('0x3d')](_0x2ced56);})[_0x1fb8('0x23')](function(_0x566a56){_0xa220e7[_0x1fb8('0x3e')]=_0x566a56;return _0xa220e7;})[_0x1fb8('0x23')](respondWithFilteredResult(_0x1a4900,_0x2ced56))[_0x1fb8('0x3f')](handleError(_0x1a4900,null));};exports[_0x1fb8('0x40')]=function(_0xdf7f84,_0xf324da){var _0x105f1a={'raw':!![],'where':{'id':_0xdf7f84[_0x1fb8('0x41')]['id']}},_0x1769e9={};_0x1769e9[_0x1fb8('0x2d')]=_['keys'](db[_0x1fb8('0x29')][_0x1fb8('0x42')]);_0x1769e9['query']=_[_0x1fb8('0x2f')](_0xdf7f84['query']);_0x1769e9[_0x1fb8('0x30')]=_[_0x1fb8('0x31')](_0x1769e9[_0x1fb8('0x2d')],_0x1769e9[_0x1fb8('0x2e')]);_0x105f1a[_0x1fb8('0x32')]=_['intersection'](_0x1769e9[_0x1fb8('0x2d')],qs[_0x1fb8('0x33')](_0xdf7f84['query'][_0x1fb8('0x33')]));_0x105f1a[_0x1fb8('0x32')]=_0x105f1a[_0x1fb8('0x32')][_0x1fb8('0x43')]?_0x105f1a[_0x1fb8('0x32')]:_0x1769e9['model'];if(_0xdf7f84[_0x1fb8('0x2e')][_0x1fb8('0x3b')]){_0x105f1a['include']=[{'all':!![]}];}_0x105f1a=_[_0x1fb8('0x44')]({},_0x105f1a,_0xdf7f84[_0x1fb8('0x3a')]);return db[_0x1fb8('0x29')]['find'](_0x105f1a)[_0x1fb8('0x23')](handleEntityNotFound(_0xf324da,null))[_0x1fb8('0x23')](respondWithResult(_0xf324da,null))[_0x1fb8('0x3f')](handleError(_0xf324da,null));};exports[_0x1fb8('0x45')]=function(_0x46e62f,_0x21a9e8){return db['ZohoField'][_0x1fb8('0x45')](_0x46e62f[_0x1fb8('0x46')],{})[_0x1fb8('0x23')](respondWithResult(_0x21a9e8,0xc9))[_0x1fb8('0x3f')](handleError(_0x21a9e8,null));};exports[_0x1fb8('0x47')]=function(_0x4d1066,_0x3bc1bb){if(_0x4d1066[_0x1fb8('0x46')]['id']){delete _0x4d1066[_0x1fb8('0x46')]['id'];}return db[_0x1fb8('0x29')][_0x1fb8('0x48')]({'where':{'id':_0x4d1066[_0x1fb8('0x41')]['id']}})[_0x1fb8('0x23')](handleEntityNotFound(_0x3bc1bb,null))[_0x1fb8('0x23')](saveUpdates(_0x4d1066[_0x1fb8('0x46')],null))[_0x1fb8('0x23')](respondWithResult(_0x3bc1bb,null))[_0x1fb8('0x3f')](handleError(_0x3bc1bb,null));};exports[_0x1fb8('0x49')]=function(_0x2fddd6,_0x37858b){return db[_0x1fb8('0x29')][_0x1fb8('0x48')]({'where':{'id':_0x2fddd6['params']['id']}})[_0x1fb8('0x23')](handleEntityNotFound(_0x37858b,null))[_0x1fb8('0x23')](removeEntity(_0x37858b,null))[_0x1fb8('0x3f')](handleError(_0x37858b,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index f477ace..2794635 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 _0x7553=['bluebird','request-promise','path','rimraf','../../config/environment','exports','define','ZohoField','int_zoho_fields','idField','FieldId','lodash','util','../../config/logger','api'];(function(_0x419253,_0x199221){var _0x256fdb=function(_0x272f4c){while(--_0x272f4c){_0x419253['push'](_0x419253['shift']());}};_0x256fdb(++_0x199221);}(_0x7553,0x164));var _0x3755=function(_0x3de7e0,_0x28cbff){_0x3de7e0=_0x3de7e0-0x0;var _0x11d0b3=_0x7553[_0x3de7e0];return _0x11d0b3;};'use strict';var _=require(_0x3755('0x0'));var util=require(_0x3755('0x1'));var logger=require(_0x3755('0x2'))(_0x3755('0x3'));var moment=require('moment');var BPromise=require(_0x3755('0x4'));var rp=require(_0x3755('0x5'));var fs=require('fs');var path=require(_0x3755('0x6'));var rimraf=require(_0x3755('0x7'));var config=require(_0x3755('0x8'));var attributes=require('./intZohoField.attributes');module[_0x3755('0x9')]=function(_0xa9d2e9,_0x95913b){return _0xa9d2e9[_0x3755('0xa')](_0x3755('0xb'),attributes,{'tableName':_0x3755('0xc'),'paranoid':![],'indexes':[{'name':'zoho_unique_index','fields':[_0x3755('0xd'),_0x3755('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe28c=['ZohoField','zoho_unique_index','idField','FieldId','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoField.attributes','define'];(function(_0x4a53d,_0x58a95e){var _0x27410e=function(_0x38fc90){while(--_0x38fc90){_0x4a53d['push'](_0x4a53d['shift']());}};_0x27410e(++_0x58a95e);}(_0xe28c,0x1a8));var _0xce28=function(_0x23e5ce,_0x57584d){_0x23e5ce=_0x23e5ce-0x0;var _0x2ce19b=_0xe28c[_0x23e5ce];return _0x2ce19b;};'use strict';var _=require(_0xce28('0x0'));var util=require(_0xce28('0x1'));var logger=require('../../config/logger')(_0xce28('0x2'));var moment=require(_0xce28('0x3'));var BPromise=require(_0xce28('0x4'));var rp=require(_0xce28('0x5'));var fs=require('fs');var path=require(_0xce28('0x6'));var rimraf=require(_0xce28('0x7'));var config=require(_0xce28('0x8'));var attributes=require(_0xce28('0x9'));module['exports']=function(_0x115d14,_0x41e034){return _0x115d14[_0xce28('0xa')](_0xce28('0xb'),attributes,{'tableName':'int_zoho_fields','paranoid':![],'indexes':[{'name':_0xce28('0xc'),'fields':[_0xce28('0xd'),_0xce28('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.rpc.js b/server/api/intZohoField/intZohoField.rpc.js index 7e47878..f4c5479 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 _0x98a8=['request','then','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x34bce6,_0x168b02){var _0x431230=function(_0x45056c){while(--_0x45056c){_0x34bce6['push'](_0x34bce6['shift']());}};_0x431230(++_0x168b02);}(_0x98a8,0x12c));var _0x898a=function(_0x14ad20,_0x5a0a88){_0x14ad20=_0x14ad20-0x0;var _0x58f5b8=_0x98a8[_0x14ad20];return _0x58f5b8;};'use strict';var _=require(_0x898a('0x0'));var util=require(_0x898a('0x1'));var moment=require(_0x898a('0x2'));var BPromise=require(_0x898a('0x3'));var rs=require(_0x898a('0x4'));var fs=require('fs');var Redis=require(_0x898a('0x5'));var db=require(_0x898a('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x898a('0x7'))(_0x898a('0x8'));var config=require(_0x898a('0x9'));var jayson=require(_0x898a('0xa'));var client=jayson[_0x898a('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3aadc2,_0x564583,_0xfa8c50){return new BPromise(function(_0x4fbce5,_0x42021d){return client[_0x898a('0xc')](_0x3aadc2,_0xfa8c50)[_0x898a('0xd')](function(_0x96b636){logger[_0x898a('0xe')](_0x898a('0xf'),_0x564583,_0x898a('0x10'));logger[_0x898a('0x11')](_0x898a('0x12'),_0x564583,'request\x20sent',JSON[_0x898a('0x13')](_0x96b636));if(_0x96b636['error']){if(_0x96b636[_0x898a('0x14')]['code']===0x1f4){logger[_0x898a('0x14')](_0x898a('0xf'),_0x564583,_0x96b636[_0x898a('0x14')]['message']);return _0x42021d(_0x96b636['error']['message']);}logger[_0x898a('0x14')](_0x898a('0xf'),_0x564583,_0x96b636[_0x898a('0x14')][_0x898a('0x15')]);return _0x4fbce5(_0x96b636[_0x898a('0x14')][_0x898a('0x15')]);}else{logger['info'](_0x898a('0xf'),_0x564583,'request\x20sent');_0x4fbce5(_0x96b636[_0x898a('0x16')]['message']);}})[_0x898a('0x17')](function(_0x4fb05b){logger[_0x898a('0x14')]('ZohoField,\x20%s,\x20%s',_0x564583,_0x4fb05b);_0x42021d(_0x4fb05b);});});} \ No newline at end of file +var _0xedd9=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','ZohoField,\x20%s,\x20%s','message','catch','util'];(function(_0x246bb6,_0x3efaea){var _0xca02a3=function(_0x5d0c4c){while(--_0x5d0c4c){_0x246bb6['push'](_0x246bb6['shift']());}};_0xca02a3(++_0x3efaea);}(_0xedd9,0xfc));var _0x9edd=function(_0x314df2,_0x235772){_0x314df2=_0x314df2-0x0;var _0x317ba6=_0xedd9[_0x314df2];return _0x317ba6;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var moment=require(_0x9edd('0x1'));var BPromise=require(_0x9edd('0x2'));var rs=require(_0x9edd('0x3'));var fs=require('fs');var Redis=require(_0x9edd('0x4'));var db=require(_0x9edd('0x5'))['db'];var utils=require(_0x9edd('0x6'));var logger=require(_0x9edd('0x7'))('rpc');var config=require(_0x9edd('0x8'));var jayson=require(_0x9edd('0x9'));var client=jayson[_0x9edd('0xa')][_0x9edd('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5319f7,_0xf0b2d8,_0x571af9){return new BPromise(function(_0x172522,_0x190185){return client[_0x9edd('0xc')](_0x5319f7,_0x571af9)[_0x9edd('0xd')](function(_0x49d5e3){logger[_0x9edd('0xe')]('ZohoField,\x20%s,\x20%s',_0xf0b2d8,_0x9edd('0xf'));logger[_0x9edd('0x10')]('ZohoField,\x20%s,\x20%s,\x20%s',_0xf0b2d8,_0x9edd('0xf'),JSON[_0x9edd('0x11')](_0x49d5e3));if(_0x49d5e3['error']){if(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x13')]===0x1f4){logger[_0x9edd('0x12')](_0x9edd('0x14'),_0xf0b2d8,_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);return _0x190185(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);}logger['error'](_0x9edd('0x14'),_0xf0b2d8,_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);return _0x172522(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);}else{logger[_0x9edd('0xe')](_0x9edd('0x14'),_0xf0b2d8,_0x9edd('0xf'));_0x172522(_0x49d5e3['result'][_0x9edd('0x15')]);}})[_0x9edd('0x16')](function(_0x449cee){logger['error'](_0x9edd('0x14'),_0xf0b2d8,_0x449cee);_0x190185(_0x449cee);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index aa9aa26..215ecdc 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 _0xd022=['util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer'];(function(_0x525b45,_0x514428){var _0x471f63=function(_0x2f65f9){while(--_0x2f65f9){_0x525b45['push'](_0x525b45['shift']());}};_0x471f63(++_0x514428);}(_0xd022,0xa1));var _0x2d02=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0xd022[_0x36c5b0];return _0xf19333;};'use strict';var multer=require(_0x2d02('0x0'));var util=require(_0x2d02('0x1'));var path=require(_0x2d02('0x2'));var timeout=require('connect-timeout');var express=require(_0x2d02('0x3'));var router=express[_0x2d02('0x4')]();var auth=require(_0x2d02('0x5'));var interaction=require(_0x2d02('0x6'));var config=require(_0x2d02('0x7'));module[_0x2d02('0x8')]=router; \ No newline at end of file +var _0x748d=['../../components/interaction/service','../../config/environment','exports','util','path','express','Router','../../components/auth/service'];(function(_0x14040c,_0x277b36){var _0x3b1859=function(_0x17473f){while(--_0x17473f){_0x14040c['push'](_0x14040c['shift']());}};_0x3b1859(++_0x277b36);}(_0x748d,0x7b));var _0xd748=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x748d[_0x6131cd];return _0x47e916;};'use strict';var multer=require('multer');var util=require(_0xd748('0x0'));var path=require(_0xd748('0x1'));var timeout=require('connect-timeout');var express=require(_0xd748('0x2'));var router=express[_0xd748('0x3')]();var auth=require(_0xd748('0x4'));var interaction=require(_0xd748('0x5'));var config=require(_0xd748('0x6'));module[_0xd748('0x7')]=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index b1bf1d5..f92e9c5 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 _0x266e=['STRING','unique_name_and_version','INTEGER','BOOLEAN','sequelize'];(function(_0x14b749,_0x3ab747){var _0x182ef5=function(_0xe69ad6){while(--_0xe69ad6){_0x14b749['push'](_0x14b749['shift']());}};_0x182ef5(++_0x3ab747);}(_0x266e,0x1e4));var _0xe266=function(_0x5f522e,_0x37b97d){_0x5f522e=_0x5f522e-0x0;var _0x2c9d04=_0x266e[_0x5f522e];return _0x2c9d04;};'use strict';var Sequelize=require(_0xe266('0x0'));module['exports']={'name':{'type':Sequelize[_0xe266('0x1')],'allowNull':![],'unique':'unique_name_and_version'},'version':{'type':Sequelize[_0xe266('0x1')],'allowNull':![],'unique':_0xe266('0x2')},'main':{'type':Sequelize['STRING'],'defaultValue':'app.js'},'filename':{'type':Sequelize[_0xe266('0x1')]},'path':{'type':Sequelize[_0xe266('0x1')]},'type':{'type':Sequelize['STRING']},'size':{'type':Sequelize[_0xe266('0x3')]},'active':{'type':Sequelize[_0xe266('0x4')],'defaultValue':![]},'author':{'type':Sequelize['STRING']},'logo':{'type':Sequelize[_0xe266('0x1')]},'state':{'type':Sequelize[_0xe266('0x1')],'unique':'state'},'description':{'type':Sequelize['STRING']},'title':{'type':Sequelize[_0xe266('0x1')]},'remoteUri':{'type':Sequelize[_0xe266('0x1')]},'link':{'type':Sequelize[_0xe266('0x1')],'defaultValue':'#'}}; \ No newline at end of file +var _0xb223=['exports','unique_name_and_version','STRING','INTEGER','BOOLEAN','state','sequelize'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xb223,0x13a));var _0x3b22=function(_0x498120,_0x4f8db4){_0x498120=_0x498120-0x0;var _0xb9f90c=_0xb223[_0x498120];return _0xb9f90c;};'use strict';var Sequelize=require(_0x3b22('0x0'));module[_0x3b22('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x3b22('0x2')},'version':{'type':Sequelize[_0x3b22('0x3')],'allowNull':![],'unique':_0x3b22('0x2')},'main':{'type':Sequelize['STRING'],'defaultValue':'app.js'},'filename':{'type':Sequelize[_0x3b22('0x3')]},'path':{'type':Sequelize[_0x3b22('0x3')]},'type':{'type':Sequelize['STRING']},'size':{'type':Sequelize[_0x3b22('0x4')]},'active':{'type':Sequelize[_0x3b22('0x5')],'defaultValue':![]},'author':{'type':Sequelize[_0x3b22('0x3')]},'logo':{'type':Sequelize[_0x3b22('0x3')]},'state':{'type':Sequelize[_0x3b22('0x3')],'unique':_0x3b22('0x6')},'description':{'type':Sequelize['STRING']},'title':{'type':Sequelize[_0x3b22('0x3')]},'remoteUri':{'type':Sequelize[_0x3b22('0x3')]},'link':{'type':Sequelize['STRING'],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index d4fced7..fb37f61 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 _0xa56f=['util','path','sox','to-csv','lodash','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','update','then','destroy','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','Integration','includeAll','include','findAll','rows','show','params','find','catch','create','body','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x5eca50,_0xc1e3f8){var _0x41fb84=function(_0x4ce3f3){while(--_0x4ce3f3){_0x5eca50['push'](_0x5eca50['shift']());}};_0x41fb84(++_0xc1e3f8);}(_0xa56f,0x115));var _0xfa56=function(_0x196a3f,_0x3d9060){_0x196a3f=_0x196a3f-0x0;var _0x285d8e=_0xa56f[_0x196a3f];return _0x285d8e;};'use strict';var pdf=require(_0xfa56('0x0'));var emlformat=require(_0xfa56('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xfa56('0x2'));var jsonpatch=require(_0xfa56('0x3'));var rp=require(_0xfa56('0x4'));var moment=require(_0xfa56('0x5'));var BPromise=require(_0xfa56('0x6'));var Mustache=require('mustache');var util=require(_0xfa56('0x7'));var path=require(_0xfa56('0x8'));var sox=require(_0xfa56('0x9'));var csv=require(_0xfa56('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xfa56('0xb'));var squel=require('squel');var crypto=require(_0xfa56('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xfa56('0xd'));var toCsv=require(_0xfa56('0xa'));var querystring=require(_0xfa56('0xe'));var Papa=require('papaparse');var Redis=require(_0xfa56('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xfa56('0x10'));var as=require(_0xfa56('0x11'));var hardwareService=require(_0xfa56('0x12'));var logger=require(_0xfa56('0x13'))('api');var utils=require(_0xfa56('0x14'));var config=require(_0xfa56('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xbb2d6d,_0x2aa8f9){_0x2aa8f9=_0x2aa8f9||0xcc;return function(_0x3e594e){if(_0x3e594e){return _0xbb2d6d[_0xfa56('0x16')](_0x2aa8f9);}return _0xbb2d6d[_0xfa56('0x17')](_0x2aa8f9)[_0xfa56('0x18')]();};}function respondWithResult(_0x408a9c,_0x24fc32){_0x24fc32=_0x24fc32||0xc8;return function(_0x4d2cd1){if(_0x4d2cd1){return _0x408a9c[_0xfa56('0x17')](_0x24fc32)['json'](_0x4d2cd1);}};}function respondWithFilteredResult(_0x3c111b,_0x251a07){return function(_0x3680f6){if(_0x3680f6){var _0x56b3df=_0x3680f6[_0xfa56('0x19')],_0x3fe52c=_0x251a07[_0xfa56('0x1a')],_0x323336=_0x251a07[_0xfa56('0x1a')]+_0x251a07[_0xfa56('0x1b')],_0x350171;if(_0x323336>=_0x56b3df){_0x323336=_0x56b3df;_0x350171=0xc8;}else{_0x350171=0xce;}_0x3c111b[_0xfa56('0x17')](_0x350171);return _0x3c111b[_0xfa56('0x1c')](_0xfa56('0x1d'),_0x3fe52c+'-'+_0x323336+'/'+_0x56b3df)[_0xfa56('0x1e')](_0x3680f6);}return null;};}function patchUpdates(_0x4434db){return function(_0x4498ba){try{jsonpatch[_0xfa56('0x1f')](_0x4498ba,_0x4434db,!![]);}catch(_0x36d55d){return BPromise[_0xfa56('0x20')](_0x36d55d);}return _0x4498ba['save']();};}function saveUpdates(_0x40acc8,_0x4158fb){return function(_0x32ce8f){if(_0x32ce8f){return _0x32ce8f[_0xfa56('0x21')](_0x40acc8)[_0xfa56('0x22')](function(_0x1ec82f){return _0x1ec82f;});}return null;};}function removeEntity(_0x25f67e,_0x48f811){return function(_0x5a574a){if(_0x5a574a){return _0x5a574a[_0xfa56('0x23')]()[_0xfa56('0x22')](function(){_0x25f67e[_0xfa56('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x7f34a3,_0x4dcce0){return function(_0xce3d68){if(!_0xce3d68){_0x7f34a3[_0xfa56('0x16')](0x194);}return _0xce3d68;};}function handleError(_0x3c21e7,_0xe71c2f){_0xe71c2f=_0xe71c2f||0x1f4;return function(_0x90f36d){logger['error'](_0x90f36d[_0xfa56('0x24')]);if(_0x90f36d[_0xfa56('0x25')]){delete _0x90f36d['name'];}_0x3c21e7[_0xfa56('0x17')](_0xe71c2f)[_0xfa56('0x26')](_0x90f36d);};}exports['index']=function(_0x5a11d9,_0x5e57bb){var _0x34447b={},_0x4c10e7={},_0x1153f3={'count':0x0,'rows':[]};var _0x9e081f=_[_0xfa56('0x27')](db['Integration'][_0xfa56('0x28')],function(_0x29b58b){return{'name':_0x29b58b[_0xfa56('0x29')],'type':_0x29b58b[_0xfa56('0x2a')][_0xfa56('0x2b')]};});_0x4c10e7[_0xfa56('0x2c')]=_['map'](_0x9e081f,_0xfa56('0x25'));_0x4c10e7[_0xfa56('0x2d')]=_[_0xfa56('0x2e')](_0x5a11d9[_0xfa56('0x2d')]);_0x4c10e7[_0xfa56('0x2f')]=_['intersection'](_0x4c10e7[_0xfa56('0x2c')],_0x4c10e7[_0xfa56('0x2d')]);_0x34447b['attributes']=_[_0xfa56('0x30')](_0x4c10e7[_0xfa56('0x2c')],qs[_0xfa56('0x31')](_0x5a11d9[_0xfa56('0x2d')][_0xfa56('0x31')]));_0x34447b[_0xfa56('0x32')]=_0x34447b['attributes'][_0xfa56('0x33')]?_0x34447b[_0xfa56('0x32')]:_0x4c10e7[_0xfa56('0x2c')];if(!_0x5a11d9[_0xfa56('0x2d')][_0xfa56('0x34')]('nolimit')){_0x34447b['limit']=qs[_0xfa56('0x1b')](_0x5a11d9['query'][_0xfa56('0x1b')]);_0x34447b[_0xfa56('0x1a')]=qs[_0xfa56('0x1a')](_0x5a11d9[_0xfa56('0x2d')]['offset']);}_0x34447b['order']=qs[_0xfa56('0x35')](_0x5a11d9['query'][_0xfa56('0x35')]);_0x34447b[_0xfa56('0x36')]=qs[_0xfa56('0x2f')](_[_0xfa56('0x37')](_0x5a11d9[_0xfa56('0x2d')],_0x4c10e7[_0xfa56('0x2f')]));if(_0x5a11d9[_0xfa56('0x2d')][_0xfa56('0x38')]){_0x34447b[_0xfa56('0x36')]=_[_0xfa56('0x39')](_0x34447b[_0xfa56('0x36')],{'$or':_[_0xfa56('0x27')](_0x9e081f,function(_0x18d804){if(_0x18d804[_0xfa56('0x2a')]!==_0xfa56('0x3a')){var _0x3996bb={};_0x3996bb[_0x18d804['name']]={'$like':'%'+_0x5a11d9['query'][_0xfa56('0x38')]+'%'};return _0x3996bb;}})});}_0x34447b=_[_0xfa56('0x39')]({},_0x34447b,_0x5a11d9[_0xfa56('0x3b')]);var _0x380a58={'where':_0x34447b[_0xfa56('0x36')]};return db[_0xfa56('0x3c')]['count'](_0x380a58)[_0xfa56('0x22')](function(_0x2733d5){_0x1153f3['count']=_0x2733d5;if(_0x5a11d9[_0xfa56('0x2d')][_0xfa56('0x3d')]){_0x34447b[_0xfa56('0x3e')]=[{'all':!![]}];}return db['Integration'][_0xfa56('0x3f')](_0x34447b);})[_0xfa56('0x22')](function(_0x1bb322){_0x1153f3[_0xfa56('0x40')]=_0x1bb322;return _0x1153f3;})[_0xfa56('0x22')](respondWithFilteredResult(_0x5e57bb,_0x34447b))['catch'](handleError(_0x5e57bb,null));};exports[_0xfa56('0x41')]=function(_0x5d4a32,_0xf5f838){var _0x211739={'raw':![],'where':{'id':_0x5d4a32[_0xfa56('0x42')]['id']}},_0x20fbea={};_0x20fbea[_0xfa56('0x2c')]=_[_0xfa56('0x2e')](db[_0xfa56('0x3c')][_0xfa56('0x28')]);_0x20fbea[_0xfa56('0x2d')]=_[_0xfa56('0x2e')](_0x5d4a32['query']);_0x20fbea[_0xfa56('0x2f')]=_[_0xfa56('0x30')](_0x20fbea[_0xfa56('0x2c')],_0x20fbea[_0xfa56('0x2d')]);_0x211739[_0xfa56('0x32')]=_['intersection'](_0x20fbea[_0xfa56('0x2c')],qs[_0xfa56('0x31')](_0x5d4a32[_0xfa56('0x2d')][_0xfa56('0x31')]));_0x211739['attributes']=_0x211739[_0xfa56('0x32')][_0xfa56('0x33')]?_0x211739[_0xfa56('0x32')]:_0x20fbea[_0xfa56('0x2c')];if(_0x5d4a32[_0xfa56('0x2d')]['includeAll']){_0x211739['include']=[{'all':!![]}];}_0x211739=_['merge']({},_0x211739,_0x5d4a32[_0xfa56('0x3b')]);return db[_0xfa56('0x3c')][_0xfa56('0x43')](_0x211739)[_0xfa56('0x22')](handleEntityNotFound(_0xf5f838,null))[_0xfa56('0x22')](respondWithResult(_0xf5f838,null))[_0xfa56('0x44')](handleError(_0xf5f838,null));};exports[_0xfa56('0x45')]=function(_0x2795f9,_0x325282){return db[_0xfa56('0x3c')]['create'](_0x2795f9[_0xfa56('0x46')],{})[_0xfa56('0x22')](respondWithResult(_0x325282,0xc9))[_0xfa56('0x44')](handleError(_0x325282,null));};exports[_0xfa56('0x21')]=function(_0x47e491,_0x48036e){if(_0x47e491[_0xfa56('0x46')]['id']){delete _0x47e491[_0xfa56('0x46')]['id'];}return db[_0xfa56('0x3c')][_0xfa56('0x43')]({'where':{'id':_0x47e491['params']['id']}})[_0xfa56('0x22')](handleEntityNotFound(_0x48036e,null))['then'](saveUpdates(_0x47e491[_0xfa56('0x46')],null))[_0xfa56('0x22')](respondWithResult(_0x48036e,null))[_0xfa56('0x44')](handleError(_0x48036e,null));};exports[_0xfa56('0x23')]=function(_0x4630ff,_0x21d0c4){return db[_0xfa56('0x3c')][_0xfa56('0x43')]({'where':{'id':_0x4630ff[_0xfa56('0x42')]['id']}})[_0xfa56('0x22')](handleEntityNotFound(_0x21d0c4,null))[_0xfa56('0x22')](removeEntity(_0x21d0c4,null))[_0xfa56('0x44')](handleError(_0x21d0c4,null));}; \ No newline at end of file +var _0x3c74=['keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','merge','Integration','count','includeAll','include','findAll','rows','show','params','rawAttributes','options','create','body','find','catch','html-pdf','eml-format','fast-json-patch','moment','bluebird','mustache','path','sox','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','save','destroy','then','error','stack','name','index','map','fieldName','type','key','model','query'];(function(_0x2b0bb6,_0x131774){var _0x3b81bf=function(_0x29f0a3){while(--_0x29f0a3){_0x2b0bb6['push'](_0x2b0bb6['shift']());}};_0x3b81bf(++_0x131774);}(_0x3c74,0x1ac));var _0x43c7=function(_0x1ed9bd,_0x24892c){_0x1ed9bd=_0x1ed9bd-0x0;var _0x4cf5ce=_0x3c74[_0x1ed9bd];return _0x4cf5ce;};'use strict';var pdf=require(_0x43c7('0x0'));var emlformat=require(_0x43c7('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x43c7('0x2'));var rp=require('request-promise');var moment=require(_0x43c7('0x3'));var BPromise=require(_0x43c7('0x4'));var Mustache=require(_0x43c7('0x5'));var util=require('util');var path=require(_0x43c7('0x6'));var sox=require(_0x43c7('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x43c7('0x8'));var squel=require(_0x43c7('0x9'));var crypto=require(_0x43c7('0xa'));var jsforce=require(_0x43c7('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x43c7('0xc'));var querystring=require(_0x43c7('0xd'));var Papa=require(_0x43c7('0xe'));var Redis=require('ioredis');var authService=require(_0x43c7('0xf'));var qs=require(_0x43c7('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x43c7('0x11'));var db=require(_0x43c7('0x12'))['db'];function respondWithStatusCode(_0x41a492,_0xd1b680){_0xd1b680=_0xd1b680||0xcc;return function(_0x59c9ad){if(_0x59c9ad){return _0x41a492[_0x43c7('0x13')](_0xd1b680);}return _0x41a492[_0x43c7('0x14')](_0xd1b680)[_0x43c7('0x15')]();};}function respondWithResult(_0x49bb36,_0x55de9f){_0x55de9f=_0x55de9f||0xc8;return function(_0x1f983d){if(_0x1f983d){return _0x49bb36[_0x43c7('0x14')](_0x55de9f)[_0x43c7('0x16')](_0x1f983d);}};}function respondWithFilteredResult(_0x20194a,_0x47e6db){return function(_0x44ec12){if(_0x44ec12){var _0x2e4831=_0x44ec12['count'],_0x58a09f=_0x47e6db[_0x43c7('0x17')],_0x1ec56f=_0x47e6db[_0x43c7('0x17')]+_0x47e6db[_0x43c7('0x18')],_0x53f1c1;if(_0x1ec56f>=_0x2e4831){_0x1ec56f=_0x2e4831;_0x53f1c1=0xc8;}else{_0x53f1c1=0xce;}_0x20194a[_0x43c7('0x14')](_0x53f1c1);return _0x20194a[_0x43c7('0x19')](_0x43c7('0x1a'),_0x58a09f+'-'+_0x1ec56f+'/'+_0x2e4831)[_0x43c7('0x16')](_0x44ec12);}return null;};}function patchUpdates(_0x1ac0b5){return function(_0x35624c){try{jsonpatch[_0x43c7('0x1b')](_0x35624c,_0x1ac0b5,!![]);}catch(_0x2e81fc){return BPromise['reject'](_0x2e81fc);}return _0x35624c[_0x43c7('0x1c')]();};}function saveUpdates(_0x2ad228,_0x5cfdc2){return function(_0x40037a){if(_0x40037a){return _0x40037a['update'](_0x2ad228)['then'](function(_0x54e3bb){return _0x54e3bb;});}return null;};}function removeEntity(_0x572cdd,_0x28a14b){return function(_0x3de01a){if(_0x3de01a){return _0x3de01a[_0x43c7('0x1d')]()[_0x43c7('0x1e')](function(){_0x572cdd[_0x43c7('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x253a58,_0x4fb7b1){return function(_0x28cd56){if(!_0x28cd56){_0x253a58[_0x43c7('0x13')](0x194);}return _0x28cd56;};}function handleError(_0x1b9f81,_0x4e41d5){_0x4e41d5=_0x4e41d5||0x1f4;return function(_0x389fe1){logger[_0x43c7('0x1f')](_0x389fe1[_0x43c7('0x20')]);if(_0x389fe1[_0x43c7('0x21')]){delete _0x389fe1['name'];}_0x1b9f81[_0x43c7('0x14')](_0x4e41d5)['send'](_0x389fe1);};}exports[_0x43c7('0x22')]=function(_0x3c66e3,_0x1799fe){var _0x34e92b={},_0x1d435a={},_0x163bf1={'count':0x0,'rows':[]};var _0x4018a9=_[_0x43c7('0x23')](db['Integration']['rawAttributes'],function(_0x101ec9){return{'name':_0x101ec9[_0x43c7('0x24')],'type':_0x101ec9[_0x43c7('0x25')][_0x43c7('0x26')]};});_0x1d435a[_0x43c7('0x27')]=_[_0x43c7('0x23')](_0x4018a9,_0x43c7('0x21'));_0x1d435a[_0x43c7('0x28')]=_[_0x43c7('0x29')](_0x3c66e3[_0x43c7('0x28')]);_0x1d435a[_0x43c7('0x2a')]=_['intersection'](_0x1d435a[_0x43c7('0x27')],_0x1d435a[_0x43c7('0x28')]);_0x34e92b[_0x43c7('0x2b')]=_[_0x43c7('0x2c')](_0x1d435a[_0x43c7('0x27')],qs[_0x43c7('0x2d')](_0x3c66e3[_0x43c7('0x28')]['fields']));_0x34e92b['attributes']=_0x34e92b[_0x43c7('0x2b')][_0x43c7('0x2e')]?_0x34e92b['attributes']:_0x1d435a[_0x43c7('0x27')];if(!_0x3c66e3['query']['hasOwnProperty'](_0x43c7('0x2f'))){_0x34e92b[_0x43c7('0x18')]=qs['limit'](_0x3c66e3[_0x43c7('0x28')][_0x43c7('0x18')]);_0x34e92b['offset']=qs[_0x43c7('0x17')](_0x3c66e3[_0x43c7('0x28')][_0x43c7('0x17')]);}_0x34e92b[_0x43c7('0x30')]=qs[_0x43c7('0x31')](_0x3c66e3[_0x43c7('0x28')][_0x43c7('0x31')]);_0x34e92b[_0x43c7('0x32')]=qs['filters'](_[_0x43c7('0x33')](_0x3c66e3[_0x43c7('0x28')],_0x1d435a['filters']));if(_0x3c66e3['query']['filter']){_0x34e92b['where']=_[_0x43c7('0x34')](_0x34e92b[_0x43c7('0x32')],{'$or':_['map'](_0x4018a9,function(_0x4a0a7d){if(_0x4a0a7d['type']!=='VIRTUAL'){var _0xee4567={};_0xee4567[_0x4a0a7d[_0x43c7('0x21')]]={'$like':'%'+_0x3c66e3[_0x43c7('0x28')]['filter']+'%'};return _0xee4567;}})});}_0x34e92b=_[_0x43c7('0x34')]({},_0x34e92b,_0x3c66e3['options']);var _0x5c436b={'where':_0x34e92b[_0x43c7('0x32')]};return db[_0x43c7('0x35')][_0x43c7('0x36')](_0x5c436b)['then'](function(_0x4c609a){_0x163bf1[_0x43c7('0x36')]=_0x4c609a;if(_0x3c66e3['query'][_0x43c7('0x37')]){_0x34e92b[_0x43c7('0x38')]=[{'all':!![]}];}return db[_0x43c7('0x35')][_0x43c7('0x39')](_0x34e92b);})[_0x43c7('0x1e')](function(_0x33c707){_0x163bf1[_0x43c7('0x3a')]=_0x33c707;return _0x163bf1;})[_0x43c7('0x1e')](respondWithFilteredResult(_0x1799fe,_0x34e92b))['catch'](handleError(_0x1799fe,null));};exports[_0x43c7('0x3b')]=function(_0x4365c0,_0x33091c){var _0x114ff2={'raw':![],'where':{'id':_0x4365c0[_0x43c7('0x3c')]['id']}},_0x1962ee={};_0x1962ee[_0x43c7('0x27')]=_['keys'](db[_0x43c7('0x35')][_0x43c7('0x3d')]);_0x1962ee[_0x43c7('0x28')]=_[_0x43c7('0x29')](_0x4365c0[_0x43c7('0x28')]);_0x1962ee['filters']=_[_0x43c7('0x2c')](_0x1962ee[_0x43c7('0x27')],_0x1962ee[_0x43c7('0x28')]);_0x114ff2['attributes']=_[_0x43c7('0x2c')](_0x1962ee[_0x43c7('0x27')],qs[_0x43c7('0x2d')](_0x4365c0[_0x43c7('0x28')][_0x43c7('0x2d')]));_0x114ff2[_0x43c7('0x2b')]=_0x114ff2['attributes'][_0x43c7('0x2e')]?_0x114ff2[_0x43c7('0x2b')]:_0x1962ee[_0x43c7('0x27')];if(_0x4365c0[_0x43c7('0x28')][_0x43c7('0x37')]){_0x114ff2[_0x43c7('0x38')]=[{'all':!![]}];}_0x114ff2=_[_0x43c7('0x34')]({},_0x114ff2,_0x4365c0[_0x43c7('0x3e')]);return db[_0x43c7('0x35')]['find'](_0x114ff2)[_0x43c7('0x1e')](handleEntityNotFound(_0x33091c,null))[_0x43c7('0x1e')](respondWithResult(_0x33091c,null))['catch'](handleError(_0x33091c,null));};exports['create']=function(_0x41e1d3,_0x443c58){return db[_0x43c7('0x35')][_0x43c7('0x3f')](_0x41e1d3['body'],{})[_0x43c7('0x1e')](respondWithResult(_0x443c58,0xc9))['catch'](handleError(_0x443c58,null));};exports['update']=function(_0x2ff41c,_0x19fd9e){if(_0x2ff41c['body']['id']){delete _0x2ff41c[_0x43c7('0x40')]['id'];}return db[_0x43c7('0x35')][_0x43c7('0x41')]({'where':{'id':_0x2ff41c[_0x43c7('0x3c')]['id']}})['then'](handleEntityNotFound(_0x19fd9e,null))[_0x43c7('0x1e')](saveUpdates(_0x2ff41c[_0x43c7('0x40')],null))[_0x43c7('0x1e')](respondWithResult(_0x19fd9e,null))['catch'](handleError(_0x19fd9e,null));};exports[_0x43c7('0x1d')]=function(_0x567d2b,_0x10a3e9){return db[_0x43c7('0x35')][_0x43c7('0x41')]({'where':{'id':_0x567d2b[_0x43c7('0x3c')]['id']}})[_0x43c7('0x1e')](handleEntityNotFound(_0x10a3e9,null))[_0x43c7('0x1e')](removeEntity(_0x10a3e9,null))[_0x43c7('0x42')](handleError(_0x10a3e9,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 7d6dbfd..def37ec 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 _0xab9a=['path','rimraf','../../config/environment','./integration.attributes','exports','define','Integration','integrations','lodash','util','../../config/logger'];(function(_0x564523,_0x5db1c8){var _0x404d2a=function(_0x346236){while(--_0x346236){_0x564523['push'](_0x564523['shift']());}};_0x404d2a(++_0x5db1c8);}(_0xab9a,0x13c));var _0xaab9=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0xab9a[_0x311c35];return _0x5cc50c;};'use strict';var _=require(_0xaab9('0x0'));var util=require(_0xaab9('0x1'));var logger=require(_0xaab9('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xaab9('0x3'));var rimraf=require(_0xaab9('0x4'));var config=require(_0xaab9('0x5'));var attributes=require(_0xaab9('0x6'));module[_0xaab9('0x7')]=function(_0x4d88be,_0x17b776){return _0x4d88be[_0xaab9('0x8')](_0xaab9('0x9'),attributes,{'tableName':_0xaab9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x212c=['rimraf','../../config/environment','./integration.attributes','define','Integration','integrations','lodash','../../config/logger','api','moment','request-promise'];(function(_0x4d6704,_0x5ee244){var _0x2cadb8=function(_0xedf18c){while(--_0xedf18c){_0x4d6704['push'](_0x4d6704['shift']());}};_0x2cadb8(++_0x5ee244);}(_0x212c,0x1df));var _0xc212=function(_0x4e49ce,_0x134bfd){_0x4e49ce=_0x4e49ce-0x0;var _0x2a5204=_0x212c[_0x4e49ce];return _0x2a5204;};'use strict';var _=require(_0xc212('0x0'));var util=require('util');var logger=require(_0xc212('0x1'))(_0xc212('0x2'));var moment=require(_0xc212('0x3'));var BPromise=require('bluebird');var rp=require(_0xc212('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc212('0x5'));var config=require(_0xc212('0x6'));var attributes=require(_0xc212('0x7'));module['exports']=function(_0x181405,_0x2c9e50){return _0x181405[_0xc212('0x8')](_0xc212('0x9'),attributes,{'tableName':_0xc212('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integration/integration.rpc.js b/server/api/integration/integration.rpc.js index 2a3d623..ae42f61 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 _0x181d=['catch','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','http','request','then','info','Integration,\x20%s,\x20%s','stringify','code','error','message','request\x20sent'];(function(_0x3ac063,_0x52424f){var _0xa682d=function(_0x47af4a){while(--_0x47af4a){_0x3ac063['push'](_0x3ac063['shift']());}};_0xa682d(++_0x52424f);}(_0x181d,0x10f));var _0xd181=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x181d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xd181('0x0'));var BPromise=require('bluebird');var rs=require(_0xd181('0x1'));var fs=require('fs');var Redis=require(_0xd181('0x2'));var db=require(_0xd181('0x3'))['db'];var utils=require(_0xd181('0x4'));var logger=require('../../config/logger')(_0xd181('0x5'));var config=require(_0xd181('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0xd181('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5ca37d,_0x46150f,_0x1ae588){return new BPromise(function(_0x24da16,_0x5d8174){return client[_0xd181('0x8')](_0x5ca37d,_0x1ae588)[_0xd181('0x9')](function(_0x2c28b7){logger[_0xd181('0xa')](_0xd181('0xb'),_0x46150f,'request\x20sent');logger['debug']('Integration,\x20%s,\x20%s,\x20%s',_0x46150f,'request\x20sent',JSON[_0xd181('0xc')](_0x2c28b7));if(_0x2c28b7['error']){if(_0x2c28b7['error'][_0xd181('0xd')]===0x1f4){logger[_0xd181('0xe')](_0xd181('0xb'),_0x46150f,_0x2c28b7[_0xd181('0xe')][_0xd181('0xf')]);return _0x5d8174(_0x2c28b7[_0xd181('0xe')][_0xd181('0xf')]);}logger[_0xd181('0xe')](_0xd181('0xb'),_0x46150f,_0x2c28b7[_0xd181('0xe')][_0xd181('0xf')]);return _0x24da16(_0x2c28b7[_0xd181('0xe')][_0xd181('0xf')]);}else{logger[_0xd181('0xa')](_0xd181('0xb'),_0x46150f,_0xd181('0x10'));_0x24da16(_0x2c28b7['result'][_0xd181('0xf')]);}})[_0xd181('0x11')](function(_0x15ff64){logger['error'](_0xd181('0xb'),_0x46150f,_0x15ff64);_0x5d8174(_0x15ff64);});});} \ No newline at end of file +var _0x4c4e=['result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','info','Integration,\x20%s,\x20%s','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x1829a4,_0x29bc87){var _0x166cab=function(_0xe31e39){while(--_0xe31e39){_0x1829a4['push'](_0x1829a4['shift']());}};_0x166cab(++_0x29bc87);}(_0x4c4e,0x152));var _0xe4c4=function(_0x1d03ba,_0xddd354){_0x1d03ba=_0x1d03ba-0x0;var _0x3f987e=_0x4c4e[_0x1d03ba];return _0x3f987e;};'use strict';var _=require(_0xe4c4('0x0'));var util=require('util');var moment=require(_0xe4c4('0x1'));var BPromise=require(_0xe4c4('0x2'));var rs=require(_0xe4c4('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe4c4('0x4'))['db'];var utils=require(_0xe4c4('0x5'));var logger=require(_0xe4c4('0x6'))('rpc');var config=require(_0xe4c4('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xe4c4('0x8')][_0xe4c4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x262b64,_0xad105,_0x22085a){return new BPromise(function(_0x329d29,_0x28a42e){return client[_0xe4c4('0xa')](_0x262b64,_0x22085a)['then'](function(_0x589b2e){logger[_0xe4c4('0xb')](_0xe4c4('0xc'),_0xad105,_0xe4c4('0xd'));logger[_0xe4c4('0xe')](_0xe4c4('0xf'),_0xad105,_0xe4c4('0xd'),JSON['stringify'](_0x589b2e));if(_0x589b2e[_0xe4c4('0x10')]){if(_0x589b2e[_0xe4c4('0x10')][_0xe4c4('0x11')]===0x1f4){logger[_0xe4c4('0x10')]('Integration,\x20%s,\x20%s',_0xad105,_0x589b2e[_0xe4c4('0x10')][_0xe4c4('0x12')]);return _0x28a42e(_0x589b2e['error'][_0xe4c4('0x12')]);}logger[_0xe4c4('0x10')]('Integration,\x20%s,\x20%s',_0xad105,_0x589b2e[_0xe4c4('0x10')][_0xe4c4('0x12')]);return _0x329d29(_0x589b2e['error'][_0xe4c4('0x12')]);}else{logger[_0xe4c4('0xb')](_0xe4c4('0xc'),_0xad105,_0xe4c4('0xd'));_0x329d29(_0x589b2e[_0xe4c4('0x13')][_0xe4c4('0x12')]);}})[_0xe4c4('0x14')](function(_0x1038cb){logger[_0xe4c4('0x10')](_0xe4c4('0xc'),_0xad105,_0x1038cb);_0x28a42e(_0x1038cb);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 71c203c..146e386 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 _0xe1ee=['get','/describe','describe','show','post','/:id','destroy','exports','multer','util','connect-timeout','express','../../components/auth/service','../../config/environment','isAuthenticated','index'];(function(_0x44e09a,_0x584aa6){var _0xaab725=function(_0x2e2d65){while(--_0x2e2d65){_0x44e09a['push'](_0x44e09a['shift']());}};_0xaab725(++_0x584aa6);}(_0xe1ee,0x158));var _0xee1e=function(_0x3b2526,_0x278079){_0x3b2526=_0x3b2526-0x0;var _0x5e40bf=_0xe1ee[_0x3b2526];return _0x5e40bf;};'use strict';var multer=require(_0xee1e('0x0'));var util=require(_0xee1e('0x1'));var path=require('path');var timeout=require(_0xee1e('0x2'));var express=require(_0xee1e('0x3'));var router=express['Router']();var auth=require(_0xee1e('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xee1e('0x5'));var controller=require('./integrationReport.controller');router['get']('/',auth[_0xee1e('0x6')](),controller[_0xee1e('0x7')]);router[_0xee1e('0x8')](_0xee1e('0x9'),auth['isAuthenticated'](),controller[_0xee1e('0xa')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xee1e('0xb')]);router[_0xee1e('0xc')]('/',auth[_0xee1e('0x6')](),controller['create']);router['put'](_0xee1e('0xd'),auth[_0xee1e('0x6')](),controller['update']);router['delete'](_0xee1e('0xd'),auth[_0xee1e('0x6')](),controller[_0xee1e('0xe')]);module[_0xee1e('0xf')]=router; \ No newline at end of file +var _0x87d1=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./integrationReport.controller','get','isAuthenticated','/describe','describe','/:id','post','create','put','update','delete','destroy','exports','connect-timeout'];(function(_0x9fdf60,_0x4a32cb){var _0x57f041=function(_0x675ad8){while(--_0x675ad8){_0x9fdf60['push'](_0x9fdf60['shift']());}};_0x57f041(++_0x4a32cb);}(_0x87d1,0x1a1));var _0x187d=function(_0xcaf501,_0x4c7cfb){_0xcaf501=_0xcaf501-0x0;var _0x3a5507=_0x87d1[_0xcaf501];return _0x3a5507;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x187d('0x0'));var express=require(_0x187d('0x1'));var router=express[_0x187d('0x2')]();var auth=require(_0x187d('0x3'));var interaction=require(_0x187d('0x4'));var config=require(_0x187d('0x5'));var controller=require(_0x187d('0x6'));router[_0x187d('0x7')]('/',auth[_0x187d('0x8')](),controller['index']);router[_0x187d('0x7')](_0x187d('0x9'),auth[_0x187d('0x8')](),controller[_0x187d('0xa')]);router['get'](_0x187d('0xb'),auth[_0x187d('0x8')](),controller['show']);router[_0x187d('0xc')]('/',auth[_0x187d('0x8')](),controller[_0x187d('0xd')]);router[_0x187d('0xe')](_0x187d('0xb'),auth['isAuthenticated'](),controller[_0x187d('0xf')]);router[_0x187d('0x10')]('/:id',auth[_0x187d('0x8')](),controller[_0x187d('0x11')]);module[_0x187d('0x12')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index 38a0bf4..40183ac 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 _0x4801=['FAILED','sequelize','STRING','INTEGER','DATE','BOOLEAN','TEXT','ENUM','SENT','SENDING'];(function(_0x353469,_0x1c5a6c){var _0x307591=function(_0xfe809c){while(--_0xfe809c){_0x353469['push'](_0x353469['shift']());}};_0x307591(++_0x1c5a6c);}(_0x4801,0x1e1));var _0x1480=function(_0x1a22e9,_0x5a2229){_0x1a22e9=_0x1a22e9-0x0;var _0x5dafe9=_0x4801[_0x1a22e9];return _0x5dafe9;};'use strict';var Sequelize=require(_0x1480('0x0'));module['exports']={'integration':{'type':Sequelize['STRING']},'eventChannel':{'type':Sequelize[_0x1480('0x1')]},'exitStatus':{'type':Sequelize['STRING']},'ticketId':{'type':Sequelize[_0x1480('0x1')]},'integrationId':{'type':Sequelize[_0x1480('0x2')]},'contacts':{'type':Sequelize[_0x1480('0x1')]},'uniqueid':{'type':Sequelize[_0x1480('0x1')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x1480('0x1')]},'queue':{'type':Sequelize[_0x1480('0x1')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0x1480('0x3')]},'agentconnectAt':{'type':Sequelize[_0x1480('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0x1480('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize['DATE']},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0x1480('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x1480('0x2')]},'reason':{'type':Sequelize[_0x1480('0x1')]},'agentringnoanswer':{'type':Sequelize[_0x1480('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x1480('0x3')]},'agentdump':{'type':Sequelize[_0x1480('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x1480('0x3')]},'lastevent':{'type':Sequelize[_0x1480('0x1')]},'channel':{'type':Sequelize[_0x1480('0x1')]},'channelstate':{'type':Sequelize[_0x1480('0x2')]},'channelstatedesc':{'type':Sequelize[_0x1480('0x1')]},'connectedlinenum':{'type':Sequelize[_0x1480('0x1')]},'connectedlinename':{'type':Sequelize[_0x1480('0x1')]},'language':{'type':Sequelize[_0x1480('0x1')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x1480('0x1')]},'exten':{'type':Sequelize[_0x1480('0x1')]},'priority':{'type':Sequelize[_0x1480('0x1')]},'destchannel':{'type':Sequelize[_0x1480('0x1')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0x1480('0x1')]},'destcalleridnum':{'type':Sequelize[_0x1480('0x1')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x1480('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x1480('0x1')]},'destlanguage':{'type':Sequelize[_0x1480('0x1')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0x1480('0x1')]},'destexten':{'type':Sequelize[_0x1480('0x1')]},'destpriority':{'type':Sequelize[_0x1480('0x1')]},'destuniqueid':{'type':Sequelize[_0x1480('0x1')]},'messageId':{'type':Sequelize[_0x1480('0x1')]},'inReplyTo':{'type':Sequelize['STRING']},'subject':{'type':Sequelize[_0x1480('0x1')]},'from':{'type':Sequelize[_0x1480('0x1')]},'to':{'type':Sequelize[_0x1480('0x1')]},'cc':{'type':Sequelize[_0x1480('0x1')]},'attachment':{'type':Sequelize['TEXT']},'html':{'type':Sequelize[_0x1480('0x5')]},'text':{'type':Sequelize[_0x1480('0x5')]},'status':{'type':Sequelize[_0x1480('0x6')](_0x1480('0x7'),_0x1480('0x8'),'RECEIVED',_0x1480('0x9'))},'url':{'type':Sequelize[_0x1480('0x1')]},'app':{'type':Sequelize[_0x1480('0x1')]},'appdata':{'type':Sequelize[_0x1480('0x1')]},'projectId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x8d51=['BOOLEAN','SENT','SENDING','RECEIVED','FAILED','sequelize','exports','STRING','DATE','INTEGER'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0x8d51,0x1e5));var _0x18d5=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x8d51[_0x6c993a];return _0x27f547;};'use strict';var Sequelize=require(_0x18d5('0x0'));module[_0x18d5('0x1')]={'integration':{'type':Sequelize[_0x18d5('0x2')]},'eventChannel':{'type':Sequelize[_0x18d5('0x2')]},'exitStatus':{'type':Sequelize[_0x18d5('0x2')]},'ticketId':{'type':Sequelize['STRING']},'integrationId':{'type':Sequelize['INTEGER']},'contacts':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x18d5('0x2')]},'calleridnum':{'type':Sequelize[_0x18d5('0x2')]},'calleridname':{'type':Sequelize[_0x18d5('0x2')]},'queue':{'type':Sequelize[_0x18d5('0x2')]},'interface':{'type':Sequelize[_0x18d5('0x2')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0x18d5('0x3')]},'agentconnectAt':{'type':Sequelize[_0x18d5('0x3')]},'holdtime':{'type':Sequelize[_0x18d5('0x4')]},'agentcomplete':{'type':Sequelize[_0x18d5('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x18d5('0x3')]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0x18d5('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x18d5('0x4')]},'reason':{'type':Sequelize[_0x18d5('0x2')]},'agentringnoanswer':{'type':Sequelize[_0x18d5('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x18d5('0x3')]},'agentdump':{'type':Sequelize[_0x18d5('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize[_0x18d5('0x2')]},'channel':{'type':Sequelize[_0x18d5('0x2')]},'channelstate':{'type':Sequelize[_0x18d5('0x4')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x18d5('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x18d5('0x2')]},'accountcode':{'type':Sequelize[_0x18d5('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x18d5('0x2')]},'priority':{'type':Sequelize[_0x18d5('0x2')]},'destchannel':{'type':Sequelize[_0x18d5('0x2')]},'destchannelstate':{'type':Sequelize[_0x18d5('0x4')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0x18d5('0x2')]},'destcalleridname':{'type':Sequelize[_0x18d5('0x2')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0x18d5('0x2')]},'destlanguage':{'type':Sequelize[_0x18d5('0x2')]},'destaccountcode':{'type':Sequelize[_0x18d5('0x2')]},'destcontext':{'type':Sequelize[_0x18d5('0x2')]},'destexten':{'type':Sequelize[_0x18d5('0x2')]},'destpriority':{'type':Sequelize[_0x18d5('0x2')]},'destuniqueid':{'type':Sequelize[_0x18d5('0x2')]},'messageId':{'type':Sequelize[_0x18d5('0x2')]},'inReplyTo':{'type':Sequelize['STRING']},'subject':{'type':Sequelize[_0x18d5('0x2')]},'from':{'type':Sequelize[_0x18d5('0x2')]},'to':{'type':Sequelize[_0x18d5('0x2')]},'cc':{'type':Sequelize[_0x18d5('0x2')]},'attachment':{'type':Sequelize['TEXT']},'html':{'type':Sequelize['TEXT']},'text':{'type':Sequelize['TEXT']},'status':{'type':Sequelize['ENUM'](_0x18d5('0x6'),_0x18d5('0x7'),_0x18d5('0x8'),_0x18d5('0x9'))},'url':{'type':Sequelize[_0x18d5('0x2')]},'app':{'type':Sequelize['STRING']},'appdata':{'type':Sequelize['STRING']},'projectId':{'type':Sequelize[_0x18d5('0x4')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index d149ad5..3f9a2bd 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 _0xac35=['VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','name','send','index','map','IntegrationReport','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge'];(function(_0x3236d9,_0x4cc1ba){var _0x28ae45=function(_0x1ec1b1){while(--_0x1ec1b1){_0x3236d9['push'](_0x3236d9['shift']());}};_0x28ae45(++_0x4cc1ba);}(_0xac35,0x141));var _0x5ac3=function(_0x3d5719,_0x2fea03){_0x3d5719=_0x3d5719-0x0;var _0x2c17da=_0xac35[_0x3d5719];return _0x2c17da;};'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 Redis=require(_0x5ac3('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x5ac3('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5ac3('0x15'));var logger=require(_0x5ac3('0x16'))(_0x5ac3('0x17'));var utils=require(_0x5ac3('0x18'));var config=require(_0x5ac3('0x19'));var db=require(_0x5ac3('0x1a'))['db'];function respondWithStatusCode(_0x963aa5,_0x5921c6){_0x5921c6=_0x5921c6||0xcc;return function(_0x19ed64){if(_0x19ed64){return _0x963aa5[_0x5ac3('0x1b')](_0x5921c6);}return _0x963aa5[_0x5ac3('0x1c')](_0x5921c6)[_0x5ac3('0x1d')]();};}function respondWithResult(_0x297c33,_0x24ed02){_0x24ed02=_0x24ed02||0xc8;return function(_0x1961f3){if(_0x1961f3){return _0x297c33[_0x5ac3('0x1c')](_0x24ed02)['json'](_0x1961f3);}};}function respondWithFilteredResult(_0x585770,_0x3926d0){return function(_0x388da8){if(_0x388da8){var _0x516c97=_0x388da8[_0x5ac3('0x1e')],_0x2eec4a=_0x3926d0[_0x5ac3('0x1f')],_0x4b718a=_0x3926d0['offset']+_0x3926d0[_0x5ac3('0x20')],_0x45c7ed;if(_0x4b718a>=_0x516c97){_0x4b718a=_0x516c97;_0x45c7ed=0xc8;}else{_0x45c7ed=0xce;}_0x585770[_0x5ac3('0x1c')](_0x45c7ed);return _0x585770[_0x5ac3('0x21')](_0x5ac3('0x22'),_0x2eec4a+'-'+_0x4b718a+'/'+_0x516c97)['json'](_0x388da8);}return null;};}function patchUpdates(_0x22907d){return function(_0x9fb253){try{jsonpatch[_0x5ac3('0x23')](_0x9fb253,_0x22907d,!![]);}catch(_0x2ec013){return BPromise[_0x5ac3('0x24')](_0x2ec013);}return _0x9fb253[_0x5ac3('0x25')]();};}function saveUpdates(_0x2039b1,_0x2fcc26){return function(_0x26f446){if(_0x26f446){return _0x26f446[_0x5ac3('0x26')](_0x2039b1)[_0x5ac3('0x27')](function(_0x38486d){return _0x38486d;});}return null;};}function removeEntity(_0x579d76,_0x462b1d){return function(_0x3cbb52){if(_0x3cbb52){return _0x3cbb52[_0x5ac3('0x28')]()[_0x5ac3('0x27')](function(){_0x579d76['status'](0xcc)[_0x5ac3('0x1d')]();});}};}function handleEntityNotFound(_0x1e28f6,_0x2aa7c9){return function(_0x3cce67){if(!_0x3cce67){_0x1e28f6['sendStatus'](0x194);}return _0x3cce67;};}function handleError(_0x1eb39c,_0x567807){_0x567807=_0x567807||0x1f4;return function(_0x34394f){logger['error'](_0x34394f['stack']);if(_0x34394f[_0x5ac3('0x29')]){delete _0x34394f[_0x5ac3('0x29')];}_0x1eb39c['status'](_0x567807)[_0x5ac3('0x2a')](_0x34394f);};}exports[_0x5ac3('0x2b')]=function(_0x2fd301,_0x1f563e){var _0x4af783={},_0x452519={},_0x228deb={'count':0x0,'rows':[]};var _0x1bd43a=_[_0x5ac3('0x2c')](db[_0x5ac3('0x2d')][_0x5ac3('0x2e')],function(_0x136862){return{'name':_0x136862['fieldName'],'type':_0x136862[_0x5ac3('0x2f')][_0x5ac3('0x30')]};});_0x452519[_0x5ac3('0x31')]=_['map'](_0x1bd43a,_0x5ac3('0x29'));_0x452519[_0x5ac3('0x32')]=_[_0x5ac3('0x33')](_0x2fd301['query']);_0x452519[_0x5ac3('0x34')]=_['intersection'](_0x452519[_0x5ac3('0x31')],_0x452519['query']);_0x4af783[_0x5ac3('0x35')]=_[_0x5ac3('0x36')](_0x452519['model'],qs['fields'](_0x2fd301['query'][_0x5ac3('0x37')]));_0x4af783[_0x5ac3('0x35')]=_0x4af783['attributes'][_0x5ac3('0x38')]?_0x4af783[_0x5ac3('0x35')]:_0x452519[_0x5ac3('0x31')];if(!_0x2fd301[_0x5ac3('0x32')][_0x5ac3('0x39')](_0x5ac3('0x3a'))){_0x4af783['limit']=qs[_0x5ac3('0x20')](_0x2fd301[_0x5ac3('0x32')][_0x5ac3('0x20')]);_0x4af783[_0x5ac3('0x1f')]=qs['offset'](_0x2fd301['query'][_0x5ac3('0x1f')]);}_0x4af783['order']=qs[_0x5ac3('0x3b')](_0x2fd301[_0x5ac3('0x32')]['sort']);_0x4af783[_0x5ac3('0x3c')]=qs['filters'](_[_0x5ac3('0x3d')](_0x2fd301['query'],_0x452519['filters']));if(_0x2fd301[_0x5ac3('0x32')][_0x5ac3('0x3e')]){_0x4af783[_0x5ac3('0x3c')]=_[_0x5ac3('0x3f')](_0x4af783['where'],{'$or':_[_0x5ac3('0x2c')](_0x1bd43a,function(_0x50e749){if(_0x50e749[_0x5ac3('0x2f')]!==_0x5ac3('0x40')){var _0x264c12={};_0x264c12[_0x50e749[_0x5ac3('0x29')]]={'$like':'%'+_0x2fd301[_0x5ac3('0x32')]['filter']+'%'};return _0x264c12;}})});}_0x4af783=_[_0x5ac3('0x3f')]({},_0x4af783,_0x2fd301[_0x5ac3('0x41')]);var _0x5e83a4={'where':_0x4af783[_0x5ac3('0x3c')]};return db[_0x5ac3('0x2d')][_0x5ac3('0x1e')](_0x5e83a4)[_0x5ac3('0x27')](function(_0x271f3d){_0x228deb[_0x5ac3('0x1e')]=_0x271f3d;if(_0x2fd301[_0x5ac3('0x32')][_0x5ac3('0x42')]){_0x4af783[_0x5ac3('0x43')]=[{'all':!![]}];}return db[_0x5ac3('0x2d')][_0x5ac3('0x44')](_0x4af783);})[_0x5ac3('0x27')](function(_0x20c16c){_0x228deb[_0x5ac3('0x45')]=_0x20c16c;return _0x228deb;})['then'](respondWithFilteredResult(_0x1f563e,_0x4af783))['catch'](handleError(_0x1f563e,null));};exports[_0x5ac3('0x46')]=function(_0x40f749,_0x359379){var _0x4f8984={'raw':![],'where':{'id':_0x40f749[_0x5ac3('0x47')]['id']}},_0x17e2bf={};_0x17e2bf[_0x5ac3('0x31')]=_[_0x5ac3('0x33')](db[_0x5ac3('0x2d')][_0x5ac3('0x2e')]);_0x17e2bf[_0x5ac3('0x32')]=_[_0x5ac3('0x33')](_0x40f749[_0x5ac3('0x32')]);_0x17e2bf[_0x5ac3('0x34')]=_[_0x5ac3('0x36')](_0x17e2bf[_0x5ac3('0x31')],_0x17e2bf[_0x5ac3('0x32')]);_0x4f8984['attributes']=_['intersection'](_0x17e2bf['model'],qs['fields'](_0x40f749['query']['fields']));_0x4f8984[_0x5ac3('0x35')]=_0x4f8984[_0x5ac3('0x35')][_0x5ac3('0x38')]?_0x4f8984['attributes']:_0x17e2bf[_0x5ac3('0x31')];if(_0x40f749[_0x5ac3('0x32')][_0x5ac3('0x42')]){_0x4f8984[_0x5ac3('0x43')]=[{'all':!![]}];}_0x4f8984=_[_0x5ac3('0x3f')]({},_0x4f8984,_0x40f749['options']);return db[_0x5ac3('0x2d')][_0x5ac3('0x48')](_0x4f8984)[_0x5ac3('0x27')](handleEntityNotFound(_0x359379,null))[_0x5ac3('0x27')](respondWithResult(_0x359379,null))[_0x5ac3('0x49')](handleError(_0x359379,null));};exports['create']=function(_0x30fa49,_0x121b53){return db[_0x5ac3('0x2d')][_0x5ac3('0x4a')](_0x30fa49['body'],{})[_0x5ac3('0x27')](respondWithResult(_0x121b53,0xc9))[_0x5ac3('0x49')](handleError(_0x121b53,null));};exports[_0x5ac3('0x26')]=function(_0x47332a,_0x59e097){if(_0x47332a[_0x5ac3('0x4b')]['id']){delete _0x47332a[_0x5ac3('0x4b')]['id'];}return db[_0x5ac3('0x2d')][_0x5ac3('0x48')]({'where':{'id':_0x47332a[_0x5ac3('0x47')]['id']}})[_0x5ac3('0x27')](handleEntityNotFound(_0x59e097,null))[_0x5ac3('0x27')](saveUpdates(_0x47332a['body'],null))['then'](respondWithResult(_0x59e097,null))[_0x5ac3('0x49')](handleError(_0x59e097,null));};exports[_0x5ac3('0x28')]=function(_0x3844b6,_0x2d507d){return db[_0x5ac3('0x2d')]['find']({'where':{'id':_0x3844b6['params']['id']}})[_0x5ac3('0x27')](handleEntityNotFound(_0x2d507d,null))[_0x5ac3('0x27')](removeEntity(_0x2d507d,null))[_0x5ac3('0x49')](handleError(_0x2d507d,null));};exports[_0x5ac3('0x4c')]=function(_0x68538a,_0x1a47de){return db['IntegrationReport'][_0x5ac3('0x4c')]()[_0x5ac3('0x27')](respondWithResult(_0x1a47de,null))[_0x5ac3('0x49')](handleError(_0x1a47de,null));}; \ No newline at end of file +var _0x3fce=['fields','length','hasOwnProperty','limit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','to-csv','ejs','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','Content-Range','reject','save','then','destroy','end','error','index','map','IntegrationReport','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','attributes'];(function(_0x3c3335,_0x400050){var _0x164123=function(_0x4c14ce){while(--_0x4c14ce){_0x3c3335['push'](_0x3c3335['shift']());}};_0x164123(++_0x400050);}(_0x3fce,0x121));var _0xe3fc=function(_0x50007c,_0x1cbf11){_0x50007c=_0x50007c-0x0;var _0x5c1ec7=_0x3fce[_0x50007c];return _0x5c1ec7;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xe3fc('0x0'));var rimraf=require(_0xe3fc('0x1'));var zipdir=require(_0xe3fc('0x2'));var jsonpatch=require(_0xe3fc('0x3'));var rp=require(_0xe3fc('0x4'));var moment=require(_0xe3fc('0x5'));var BPromise=require(_0xe3fc('0x6'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xe3fc('0x7'));var ejs=require(_0xe3fc('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0xe3fc('0x9'));var crypto=require('crypto');var jsforce=require(_0xe3fc('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xe3fc('0x7'));var querystring=require(_0xe3fc('0xb'));var Papa=require(_0xe3fc('0xc'));var Redis=require(_0xe3fc('0xd'));var authService=require(_0xe3fc('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe3fc('0xf'));var logger=require(_0xe3fc('0x10'))(_0xe3fc('0x11'));var utils=require('../../config/utils');var config=require(_0xe3fc('0x12'));var db=require(_0xe3fc('0x13'))['db'];function respondWithStatusCode(_0x26473d,_0x317490){_0x317490=_0x317490||0xcc;return function(_0x40fc7e){if(_0x40fc7e){return _0x26473d[_0xe3fc('0x14')](_0x317490);}return _0x26473d[_0xe3fc('0x15')](_0x317490)['end']();};}function respondWithResult(_0x413344,_0x37c993){_0x37c993=_0x37c993||0xc8;return function(_0x4b2ed4){if(_0x4b2ed4){return _0x413344[_0xe3fc('0x15')](_0x37c993)[_0xe3fc('0x16')](_0x4b2ed4);}};}function respondWithFilteredResult(_0x5edfdf,_0x28403f){return function(_0x25852e){if(_0x25852e){var _0x4b6256=_0x25852e[_0xe3fc('0x17')],_0x4fa4d4=_0x28403f[_0xe3fc('0x18')],_0x5953ac=_0x28403f['offset']+_0x28403f['limit'],_0x27b618;if(_0x5953ac>=_0x4b6256){_0x5953ac=_0x4b6256;_0x27b618=0xc8;}else{_0x27b618=0xce;}_0x5edfdf[_0xe3fc('0x15')](_0x27b618);return _0x5edfdf['set'](_0xe3fc('0x19'),_0x4fa4d4+'-'+_0x5953ac+'/'+_0x4b6256)[_0xe3fc('0x16')](_0x25852e);}return null;};}function patchUpdates(_0xfefb77){return function(_0x51c7f2){try{jsonpatch['apply'](_0x51c7f2,_0xfefb77,!![]);}catch(_0x42140f){return BPromise[_0xe3fc('0x1a')](_0x42140f);}return _0x51c7f2[_0xe3fc('0x1b')]();};}function saveUpdates(_0x5e74ab,_0x4472f7){return function(_0xfac19f){if(_0xfac19f){return _0xfac19f['update'](_0x5e74ab)[_0xe3fc('0x1c')](function(_0x82da29){return _0x82da29;});}return null;};}function removeEntity(_0x55bc5a,_0x543535){return function(_0x457cef){if(_0x457cef){return _0x457cef[_0xe3fc('0x1d')]()['then'](function(){_0x55bc5a['status'](0xcc)[_0xe3fc('0x1e')]();});}};}function handleEntityNotFound(_0x4f4134,_0x55ea5e){return function(_0x383f19){if(!_0x383f19){_0x4f4134[_0xe3fc('0x14')](0x194);}return _0x383f19;};}function handleError(_0x3a8071,_0x177a14){_0x177a14=_0x177a14||0x1f4;return function(_0x47b2d6){logger[_0xe3fc('0x1f')](_0x47b2d6['stack']);if(_0x47b2d6['name']){delete _0x47b2d6['name'];}_0x3a8071['status'](_0x177a14)['send'](_0x47b2d6);};}exports[_0xe3fc('0x20')]=function(_0x35a7b5,_0x5d1cc3){var _0x60e9b8={},_0x188ca2={},_0x5be1d6={'count':0x0,'rows':[]};var _0x46f549=_[_0xe3fc('0x21')](db[_0xe3fc('0x22')][_0xe3fc('0x23')],function(_0x3d173e){return{'name':_0x3d173e[_0xe3fc('0x24')],'type':_0x3d173e[_0xe3fc('0x25')][_0xe3fc('0x26')]};});_0x188ca2[_0xe3fc('0x27')]=_[_0xe3fc('0x21')](_0x46f549,_0xe3fc('0x28'));_0x188ca2[_0xe3fc('0x29')]=_[_0xe3fc('0x2a')](_0x35a7b5[_0xe3fc('0x29')]);_0x188ca2[_0xe3fc('0x2b')]=_[_0xe3fc('0x2c')](_0x188ca2['model'],_0x188ca2[_0xe3fc('0x29')]);_0x60e9b8[_0xe3fc('0x2d')]=_[_0xe3fc('0x2c')](_0x188ca2['model'],qs[_0xe3fc('0x2e')](_0x35a7b5[_0xe3fc('0x29')][_0xe3fc('0x2e')]));_0x60e9b8['attributes']=_0x60e9b8[_0xe3fc('0x2d')][_0xe3fc('0x2f')]?_0x60e9b8[_0xe3fc('0x2d')]:_0x188ca2[_0xe3fc('0x27')];if(!_0x35a7b5[_0xe3fc('0x29')][_0xe3fc('0x30')]('nolimit')){_0x60e9b8[_0xe3fc('0x31')]=qs[_0xe3fc('0x31')](_0x35a7b5[_0xe3fc('0x29')][_0xe3fc('0x31')]);_0x60e9b8[_0xe3fc('0x18')]=qs[_0xe3fc('0x18')](_0x35a7b5[_0xe3fc('0x29')][_0xe3fc('0x18')]);}_0x60e9b8[_0xe3fc('0x32')]=qs[_0xe3fc('0x33')](_0x35a7b5[_0xe3fc('0x29')][_0xe3fc('0x33')]);_0x60e9b8[_0xe3fc('0x34')]=qs['filters'](_['pick'](_0x35a7b5['query'],_0x188ca2[_0xe3fc('0x2b')]));if(_0x35a7b5[_0xe3fc('0x29')][_0xe3fc('0x35')]){_0x60e9b8[_0xe3fc('0x34')]=_[_0xe3fc('0x36')](_0x60e9b8[_0xe3fc('0x34')],{'$or':_[_0xe3fc('0x21')](_0x46f549,function(_0x2db77e){if(_0x2db77e['type']!==_0xe3fc('0x37')){var _0x1b0d87={};_0x1b0d87[_0x2db77e['name']]={'$like':'%'+_0x35a7b5[_0xe3fc('0x29')][_0xe3fc('0x35')]+'%'};return _0x1b0d87;}})});}_0x60e9b8=_[_0xe3fc('0x36')]({},_0x60e9b8,_0x35a7b5[_0xe3fc('0x38')]);var _0x36ffee={'where':_0x60e9b8['where']};return db[_0xe3fc('0x22')]['count'](_0x36ffee)['then'](function(_0xd62417){_0x5be1d6[_0xe3fc('0x17')]=_0xd62417;if(_0x35a7b5['query'][_0xe3fc('0x39')]){_0x60e9b8[_0xe3fc('0x3a')]=[{'all':!![]}];}return db[_0xe3fc('0x22')][_0xe3fc('0x3b')](_0x60e9b8);})[_0xe3fc('0x1c')](function(_0x157bcc){_0x5be1d6['rows']=_0x157bcc;return _0x5be1d6;})[_0xe3fc('0x1c')](respondWithFilteredResult(_0x5d1cc3,_0x60e9b8))[_0xe3fc('0x3c')](handleError(_0x5d1cc3,null));};exports[_0xe3fc('0x3d')]=function(_0x1ebd60,_0x65e252){var _0x4ed642={'raw':![],'where':{'id':_0x1ebd60[_0xe3fc('0x3e')]['id']}},_0x10bc8d={};_0x10bc8d[_0xe3fc('0x27')]=_['keys'](db[_0xe3fc('0x22')]['rawAttributes']);_0x10bc8d[_0xe3fc('0x29')]=_[_0xe3fc('0x2a')](_0x1ebd60[_0xe3fc('0x29')]);_0x10bc8d[_0xe3fc('0x2b')]=_[_0xe3fc('0x2c')](_0x10bc8d['model'],_0x10bc8d[_0xe3fc('0x29')]);_0x4ed642[_0xe3fc('0x2d')]=_[_0xe3fc('0x2c')](_0x10bc8d[_0xe3fc('0x27')],qs[_0xe3fc('0x2e')](_0x1ebd60['query'][_0xe3fc('0x2e')]));_0x4ed642['attributes']=_0x4ed642['attributes']['length']?_0x4ed642[_0xe3fc('0x2d')]:_0x10bc8d[_0xe3fc('0x27')];if(_0x1ebd60[_0xe3fc('0x29')][_0xe3fc('0x39')]){_0x4ed642[_0xe3fc('0x3a')]=[{'all':!![]}];}_0x4ed642=_[_0xe3fc('0x36')]({},_0x4ed642,_0x1ebd60['options']);return db[_0xe3fc('0x22')]['find'](_0x4ed642)[_0xe3fc('0x1c')](handleEntityNotFound(_0x65e252,null))[_0xe3fc('0x1c')](respondWithResult(_0x65e252,null))[_0xe3fc('0x3c')](handleError(_0x65e252,null));};exports[_0xe3fc('0x3f')]=function(_0x5dcdf7,_0x161354){return db[_0xe3fc('0x22')][_0xe3fc('0x3f')](_0x5dcdf7[_0xe3fc('0x40')],{})[_0xe3fc('0x1c')](respondWithResult(_0x161354,0xc9))[_0xe3fc('0x3c')](handleError(_0x161354,null));};exports['update']=function(_0x484726,_0x39ef31){if(_0x484726[_0xe3fc('0x40')]['id']){delete _0x484726[_0xe3fc('0x40')]['id'];}return db[_0xe3fc('0x22')][_0xe3fc('0x41')]({'where':{'id':_0x484726[_0xe3fc('0x3e')]['id']}})['then'](handleEntityNotFound(_0x39ef31,null))[_0xe3fc('0x1c')](saveUpdates(_0x484726['body'],null))[_0xe3fc('0x1c')](respondWithResult(_0x39ef31,null))['catch'](handleError(_0x39ef31,null));};exports['destroy']=function(_0x49306f,_0x3b5d97){return db[_0xe3fc('0x22')]['find']({'where':{'id':_0x49306f[_0xe3fc('0x3e')]['id']}})['then'](handleEntityNotFound(_0x3b5d97,null))[_0xe3fc('0x1c')](removeEntity(_0x3b5d97,null))[_0xe3fc('0x3c')](handleError(_0x3b5d97,null));};exports[_0xe3fc('0x42')]=function(_0x23f9b7,_0x11bc2f){return db[_0xe3fc('0x22')]['describe']()['then'](respondWithResult(_0x11bc2f,null))[_0xe3fc('0x3c')](handleError(_0x11bc2f,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index a6f468b..0d5d688 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 _0x4fbf=['util','api','moment','request-promise','rimraf','../../config/environment','./integrationReport.attributes','exports','IntegrationReport','report_integration','lodash'];(function(_0x229f5e,_0x225dba){var _0x565061=function(_0x2ba587){while(--_0x2ba587){_0x229f5e['push'](_0x229f5e['shift']());}};_0x565061(++_0x225dba);}(_0x4fbf,0xaf));var _0xf4fb=function(_0xd358ab,_0xfcdbde){_0xd358ab=_0xd358ab-0x0;var _0x2796b6=_0x4fbf[_0xd358ab];return _0x2796b6;};'use strict';var _=require(_0xf4fb('0x0'));var util=require(_0xf4fb('0x1'));var logger=require('../../config/logger')(_0xf4fb('0x2'));var moment=require(_0xf4fb('0x3'));var BPromise=require('bluebird');var rp=require(_0xf4fb('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf4fb('0x5'));var config=require(_0xf4fb('0x6'));var attributes=require(_0xf4fb('0x7'));module[_0xf4fb('0x8')]=function(_0x3ff876,_0x33b1e5){return _0x3ff876['define'](_0xf4fb('0x9'),attributes,{'tableName':_0xf4fb('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x99c4=['util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./integrationReport.attributes','define','IntegrationReport','report_integration','lodash'];(function(_0xdff763,_0x477c10){var _0x99390e=function(_0x344514){while(--_0x344514){_0xdff763['push'](_0xdff763['shift']());}};_0x99390e(++_0x477c10);}(_0x99c4,0x192));var _0x499c=function(_0x132117,_0x1731aa){_0x132117=_0x132117-0x0;var _0x3465af=_0x99c4[_0x132117];return _0x3465af;};'use strict';var _=require(_0x499c('0x0'));var util=require(_0x499c('0x1'));var logger=require(_0x499c('0x2'))(_0x499c('0x3'));var moment=require(_0x499c('0x4'));var BPromise=require(_0x499c('0x5'));var rp=require(_0x499c('0x6'));var fs=require('fs');var path=require(_0x499c('0x7'));var rimraf=require('rimraf');var config=require(_0x499c('0x8'));var attributes=require(_0x499c('0x9'));module['exports']=function(_0x6fba89,_0x201328){return _0x6fba89[_0x499c('0xa')](_0x499c('0xb'),attributes,{'tableName':_0x499c('0xc'),'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 313967b..7789250 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 _0xac4a=['IntegrationReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','then','info','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xac4a,0x13f));var _0xaac4=function(_0x162026,_0x5471b1){_0x162026=_0x162026-0x0;var _0x497400=_0xac4a[_0x162026];return _0x497400;};'use strict';var _=require(_0xaac4('0x0'));var util=require(_0xaac4('0x1'));var moment=require(_0xaac4('0x2'));var BPromise=require(_0xaac4('0x3'));var rs=require(_0xaac4('0x4'));var fs=require('fs');var Redis=require(_0xaac4('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xaac4('0x6'))(_0xaac4('0x7'));var config=require(_0xaac4('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xaac4('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1cdfc5,_0x5870e8,_0x1e4283){return new BPromise(function(_0x27354c,_0x567295){return client['request'](_0x1cdfc5,_0x1e4283)[_0xaac4('0xa')](function(_0x50d114){logger[_0xaac4('0xb')]('IntegrationReport,\x20%s,\x20%s',_0x5870e8,'request\x20sent');logger[_0xaac4('0xc')](_0xaac4('0xd'),_0x5870e8,_0xaac4('0xe'),JSON[_0xaac4('0xf')](_0x50d114));if(_0x50d114[_0xaac4('0x10')]){if(_0x50d114['error']['code']===0x1f4){logger[_0xaac4('0x10')](_0xaac4('0x11'),_0x5870e8,_0x50d114[_0xaac4('0x10')]['message']);return _0x567295(_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);}logger['error'](_0xaac4('0x11'),_0x5870e8,_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);return _0x27354c(_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);}else{logger[_0xaac4('0xb')](_0xaac4('0x11'),_0x5870e8,_0xaac4('0xe'));_0x27354c(_0x50d114[_0xaac4('0x13')][_0xaac4('0x12')]);}})[_0xaac4('0x14')](function(_0x1766c2){logger[_0xaac4('0x10')]('IntegrationReport,\x20%s,\x20%s',_0x5870e8,_0x1766c2);_0x567295(_0x1766c2);});});} \ No newline at end of file +var _0x0b0e=['IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','IntegrationReport,\x20%s,\x20%s','debug'];(function(_0x56740a,_0x568894){var _0x257144=function(_0x2b8cc5){while(--_0x2b8cc5){_0x56740a['push'](_0x56740a['shift']());}};_0x257144(++_0x568894);}(_0x0b0e,0x187));var _0xe0b0=function(_0x18e52b,_0x1fae35){_0x18e52b=_0x18e52b-0x0;var _0x3d3062=_0x0b0e[_0x18e52b];return _0x3d3062;};'use strict';var _=require(_0xe0b0('0x0'));var util=require('util');var moment=require(_0xe0b0('0x1'));var BPromise=require('bluebird');var rs=require(_0xe0b0('0x2'));var fs=require('fs');var Redis=require(_0xe0b0('0x3'));var db=require(_0xe0b0('0x4'))['db'];var utils=require(_0xe0b0('0x5'));var logger=require(_0xe0b0('0x6'))(_0xe0b0('0x7'));var config=require(_0xe0b0('0x8'));var jayson=require(_0xe0b0('0x9'));var client=jayson[_0xe0b0('0xa')][_0xe0b0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x219b1c,_0x5cf9cc,_0x50be7f){return new BPromise(function(_0x11effc,_0x435060){return client[_0xe0b0('0xc')](_0x219b1c,_0x50be7f)[_0xe0b0('0xd')](function(_0x4c24f9){logger[_0xe0b0('0xe')](_0xe0b0('0xf'),_0x5cf9cc,'request\x20sent');logger[_0xe0b0('0x10')](_0xe0b0('0x11'),_0x5cf9cc,'request\x20sent',JSON[_0xe0b0('0x12')](_0x4c24f9));if(_0x4c24f9[_0xe0b0('0x13')]){if(_0x4c24f9[_0xe0b0('0x13')]['code']===0x1f4){logger[_0xe0b0('0x13')](_0xe0b0('0xf'),_0x5cf9cc,_0x4c24f9[_0xe0b0('0x13')][_0xe0b0('0x14')]);return _0x435060(_0x4c24f9[_0xe0b0('0x13')]['message']);}logger[_0xe0b0('0x13')](_0xe0b0('0xf'),_0x5cf9cc,_0x4c24f9[_0xe0b0('0x13')][_0xe0b0('0x14')]);return _0x11effc(_0x4c24f9[_0xe0b0('0x13')]['message']);}else{logger[_0xe0b0('0xe')]('IntegrationReport,\x20%s,\x20%s',_0x5cf9cc,_0xe0b0('0x15'));_0x11effc(_0x4c24f9[_0xe0b0('0x16')]['message']);}})[_0xe0b0('0x17')](function(_0x4a4cc0){logger[_0xe0b0('0x13')](_0xe0b0('0xf'),_0x5cf9cc,_0x4a4cc0);_0x435060(_0x4a4cc0);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index 566ba14..5b3bce4 100644 --- a/server/api/interval/index.js +++ b/server/api/interval/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x55ca=['/:id/sub_intervals','addInterval','/:id/sub_intervals/create_many','addIntervals','put','update','destroy','exports','multer','util','Router','../../components/auth/service','../../config/environment','./interval.controller','get','isAuthenticated','index','/:id','show','getIntervals','create','post'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x55ca,0x126));var _0xa55c=function(_0xd6a568,_0x4d39e9){_0xd6a568=_0xd6a568-0x0;var _0x56e5ab=_0x55ca[_0xd6a568];return _0x56e5ab;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var auth=require(_0xa55c('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xa55c('0x4'));var controller=require(_0xa55c('0x5'));router[_0xa55c('0x6')]('/',auth[_0xa55c('0x7')](),controller[_0xa55c('0x8')]);router[_0xa55c('0x6')](_0xa55c('0x9'),auth['isAuthenticated'](),controller[_0xa55c('0xa')]);router[_0xa55c('0x6')]('/:id/sub_intervals',auth[_0xa55c('0x7')](),controller[_0xa55c('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0xa55c('0xc')]);router[_0xa55c('0xd')](_0xa55c('0xe'),auth[_0xa55c('0x7')](),controller[_0xa55c('0xf')]);router[_0xa55c('0xd')](_0xa55c('0x10'),auth[_0xa55c('0x7')](),controller[_0xa55c('0x11')]);router[_0xa55c('0x12')]('/:id',auth['isAuthenticated'](),controller[_0xa55c('0x13')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xa55c('0x14')]);module[_0xa55c('0x15')]=router; \ No newline at end of file +var _0x55ca=['/:id/sub_intervals','addInterval','/:id/sub_intervals/create_many','addIntervals','put','update','destroy','exports','multer','util','Router','../../components/auth/service','../../config/environment','./interval.controller','get','isAuthenticated','index','/:id','show','getIntervals','create','post'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x55ca,0x126));var _0xa55c=function(_0x345de7,_0x1de531){_0x345de7=_0x345de7-0x0;var _0x26ffc7=_0x55ca[_0x345de7];return _0x26ffc7;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var auth=require(_0xa55c('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xa55c('0x4'));var controller=require(_0xa55c('0x5'));router[_0xa55c('0x6')]('/',auth[_0xa55c('0x7')](),controller[_0xa55c('0x8')]);router[_0xa55c('0x6')](_0xa55c('0x9'),auth['isAuthenticated'](),controller[_0xa55c('0xa')]);router[_0xa55c('0x6')]('/:id/sub_intervals',auth[_0xa55c('0x7')](),controller[_0xa55c('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0xa55c('0xc')]);router[_0xa55c('0xd')](_0xa55c('0xe'),auth[_0xa55c('0x7')](),controller[_0xa55c('0xf')]);router[_0xa55c('0xd')](_0xa55c('0x10'),auth[_0xa55c('0x7')](),controller[_0xa55c('0x11')]);router[_0xa55c('0x12')]('/:id',auth['isAuthenticated'](),controller[_0xa55c('0x13')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xa55c('0x14')]);module[_0xa55c('0x15')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index ded9df8..c8a20d4 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 _0x5e01=['sequelize'];(function(_0x2842bc,_0x2c6854){var _0x3fbdfe=function(_0x23b569){while(--_0x23b569){_0x2842bc['push'](_0x2842bc['shift']());}};_0x3fbdfe(++_0x2c6854);}(_0x5e01,0xd1));var _0x15e0=function(_0xc0a3d3,_0x2c8d00){_0xc0a3d3=_0xc0a3d3-0x0;var _0x3386e8=_0x5e01[_0xc0a3d3];return _0x3386e8;};'use strict';var Sequelize=require(_0x15e0('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file +var _0xbed3=['exports','STRING','sequelize'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xbed3,0xad));var _0x3bed=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xbed3[_0x3ab51d];return _0x29a04e;};'use strict';var Sequelize=require(_0x3bed('0x0'));module[_0x3bed('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x3bed('0x2')]},'interval':{'type':Sequelize[_0x3bed('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 8c99b58..057b839 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 _0x008c=['query','keys','filters','intersection','attributes','fields','length','nolimit','limit','offset','order','sort','pick','where','VIRTUAL','filter','merge','options','Interval','include','findAll','catch','show','params','rawAttributes','includeAll','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Intervals','UserProfileSection','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','addInterval','getIntervals','findOne','hasOwnProperty','sequelize','IntervalId','bulkCreate','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','papaparse','ioredis','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','../../components/extensions/rewrite','end','status','json','count','set','Content-Range','save','destroy','then','get','UserProfileResource','sendStatus','name','send','map','fieldName','type','key','model'];(function(_0x5a3d49,_0x24b21a){var _0x4d5c23=function(_0x4f62b0){while(--_0x4f62b0){_0x5a3d49['push'](_0x5a3d49['shift']());}};_0x4d5c23(++_0x24b21a);}(_0x008c,0x188));var _0xc008=function(_0x3aa779,_0x4a18c5){_0x3aa779=_0x3aa779-0x0;var _0x2fd150=_0x008c[_0x3aa779];return _0x2fd150;};'use strict';var pdf=require(_0xc008('0x0'));var emlformat=require(_0xc008('0x1'));var rimraf=require(_0xc008('0x2'));var zipdir=require(_0xc008('0x3'));var jsonpatch=require(_0xc008('0x4'));var rp=require('request-promise');var moment=require(_0xc008('0x5'));var BPromise=require(_0xc008('0x6'));var Mustache=require(_0xc008('0x7'));var util=require(_0xc008('0x8'));var path=require(_0xc008('0x9'));var sox=require(_0xc008('0xa'));var csv=require(_0xc008('0xb'));var ejs=require(_0xc008('0xc'));var fs=require('fs');var _=require(_0xc008('0xd'));var squel=require('squel');var crypto=require(_0xc008('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xc008('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc008('0x10'));var Redis=require(_0xc008('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc008('0x12'));var logger=require(_0xc008('0x13'))('api');var utils=require(_0xc008('0x14'));var config=require(_0xc008('0x15'));var db=require(_0xc008('0x16'))['db'];var extensions=require(_0xc008('0x17'));function respondWithStatusCode(_0x9ffa93,_0x1819c6){_0x1819c6=_0x1819c6||0xcc;return function(_0x69726e){if(_0x69726e){return _0x9ffa93['sendStatus'](_0x1819c6);}return _0x9ffa93['status'](_0x1819c6)[_0xc008('0x18')]();};}function respondWithResult(_0x50c1ab,_0x25e13f){_0x25e13f=_0x25e13f||0xc8;return function(_0x4584e1){if(_0x4584e1){return _0x50c1ab[_0xc008('0x19')](_0x25e13f)[_0xc008('0x1a')](_0x4584e1);}};}function respondWithFilteredResult(_0x3f0ecf,_0x5ee00b){return function(_0x5e894e){if(_0x5e894e){var _0x4bd0f4=_0x5e894e[_0xc008('0x1b')],_0x11ef38=_0x5ee00b['offset'],_0x15a6ad=_0x5ee00b['offset']+_0x5ee00b['limit'],_0x3cafe3;if(_0x15a6ad>=_0x4bd0f4){_0x15a6ad=_0x4bd0f4;_0x3cafe3=0xc8;}else{_0x3cafe3=0xce;}_0x3f0ecf['status'](_0x3cafe3);return _0x3f0ecf[_0xc008('0x1c')](_0xc008('0x1d'),_0x11ef38+'-'+_0x15a6ad+'/'+_0x4bd0f4)['json'](_0x5e894e);}return null;};}function patchUpdates(_0x813397){return function(_0x5906e6){try{jsonpatch['apply'](_0x5906e6,_0x813397,!![]);}catch(_0x543e5d){return BPromise['reject'](_0x543e5d);}return _0x5906e6[_0xc008('0x1e')]();};}function saveUpdates(_0x4b9726,_0x5560b1){return function(_0x590a71){if(_0x590a71){return _0x590a71['update'](_0x4b9726)['then'](function(_0x13a263){return _0x13a263;});}return null;};}function removeEntity(_0x4777a6,_0x251db2){return function(_0x415af3){if(_0x415af3){return _0x415af3[_0xc008('0x1f')]()[_0xc008('0x20')](function(){var _0x4f43e2=_0x415af3[_0xc008('0x21')]({'plain':!![]});var _0x5c85f2='Intervals';return db[_0xc008('0x22')][_0xc008('0x1f')]({'where':{'type':_0x5c85f2,'resourceId':_0x4f43e2['id']}})[_0xc008('0x20')](function(){return _0x415af3;});})[_0xc008('0x20')](function(){_0x4777a6['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5de1e9,_0x3f7b07){return function(_0x15dade){if(!_0x15dade){_0x5de1e9[_0xc008('0x23')](0x194);}return _0x15dade;};}function handleError(_0x2e31c2,_0x5bebd9){_0x5bebd9=_0x5bebd9||0x1f4;return function(_0x5e2aca){logger['error'](_0x5e2aca['stack']);if(_0x5e2aca['name']){delete _0x5e2aca[_0xc008('0x24')];}_0x2e31c2[_0xc008('0x19')](_0x5bebd9)[_0xc008('0x25')](_0x5e2aca);};}exports['index']=function(_0x24c14c,_0x32390d){var _0x209591={},_0x2a7d4f={},_0x4c5dec={'count':0x0,'rows':[]};var _0xcdb32b=_[_0xc008('0x26')](db['Interval']['rawAttributes'],function(_0x539766){return{'name':_0x539766[_0xc008('0x27')],'type':_0x539766[_0xc008('0x28')][_0xc008('0x29')]};});_0x2a7d4f[_0xc008('0x2a')]=_[_0xc008('0x26')](_0xcdb32b,_0xc008('0x24'));_0x2a7d4f[_0xc008('0x2b')]=_[_0xc008('0x2c')](_0x24c14c[_0xc008('0x2b')]);_0x2a7d4f[_0xc008('0x2d')]=_[_0xc008('0x2e')](_0x2a7d4f[_0xc008('0x2a')],_0x2a7d4f['query']);_0x209591[_0xc008('0x2f')]=_[_0xc008('0x2e')](_0x2a7d4f['model'],qs[_0xc008('0x30')](_0x24c14c[_0xc008('0x2b')][_0xc008('0x30')]));_0x209591[_0xc008('0x2f')]=_0x209591[_0xc008('0x2f')][_0xc008('0x31')]?_0x209591[_0xc008('0x2f')]:_0x2a7d4f[_0xc008('0x2a')];if(!_0x24c14c[_0xc008('0x2b')]['hasOwnProperty'](_0xc008('0x32'))){_0x209591[_0xc008('0x33')]=qs[_0xc008('0x33')](_0x24c14c[_0xc008('0x2b')][_0xc008('0x33')]);_0x209591[_0xc008('0x34')]=qs[_0xc008('0x34')](_0x24c14c['query'][_0xc008('0x34')]);}_0x209591[_0xc008('0x35')]=qs['sort'](_0x24c14c[_0xc008('0x2b')][_0xc008('0x36')]);_0x209591['where']=qs[_0xc008('0x2d')](_[_0xc008('0x37')](_0x24c14c[_0xc008('0x2b')],_0x2a7d4f['filters']));if(_0x24c14c['query']['filter']){_0x209591[_0xc008('0x38')]=_['merge'](_0x209591[_0xc008('0x38')],{'$or':_[_0xc008('0x26')](_0xcdb32b,function(_0x6a4ccb){if(_0x6a4ccb[_0xc008('0x28')]!==_0xc008('0x39')){var _0xa381d1={};_0xa381d1[_0x6a4ccb[_0xc008('0x24')]]={'$like':'%'+_0x24c14c[_0xc008('0x2b')][_0xc008('0x3a')]+'%'};return _0xa381d1;}})});}_0x209591=_[_0xc008('0x3b')]({},_0x209591,_0x24c14c[_0xc008('0x3c')]);var _0xdfca2e={'where':_0x209591[_0xc008('0x38')]};return db[_0xc008('0x3d')]['count'](_0xdfca2e)[_0xc008('0x20')](function(_0x23c4db){_0x4c5dec[_0xc008('0x1b')]=_0x23c4db;if(_0x24c14c[_0xc008('0x2b')]['includeAll']){_0x209591[_0xc008('0x3e')]=[{'all':!![]}];}return db[_0xc008('0x3d')][_0xc008('0x3f')](_0x209591);})[_0xc008('0x20')](function(_0x2d142d){_0x4c5dec['rows']=_0x2d142d;return _0x4c5dec;})[_0xc008('0x20')](respondWithFilteredResult(_0x32390d,_0x209591))[_0xc008('0x40')](handleError(_0x32390d,null));};exports[_0xc008('0x41')]=function(_0x3e9a99,_0x7279e8){var _0x4f93a4={'raw':!![],'where':{'id':_0x3e9a99[_0xc008('0x42')]['id']}},_0xf4cc4b={};_0xf4cc4b[_0xc008('0x2a')]=_[_0xc008('0x2c')](db['Interval'][_0xc008('0x43')]);_0xf4cc4b[_0xc008('0x2b')]=_[_0xc008('0x2c')](_0x3e9a99['query']);_0xf4cc4b[_0xc008('0x2d')]=_['intersection'](_0xf4cc4b[_0xc008('0x2a')],_0xf4cc4b['query']);_0x4f93a4[_0xc008('0x2f')]=_[_0xc008('0x2e')](_0xf4cc4b['model'],qs[_0xc008('0x30')](_0x3e9a99[_0xc008('0x2b')][_0xc008('0x30')]));_0x4f93a4['attributes']=_0x4f93a4[_0xc008('0x2f')][_0xc008('0x31')]?_0x4f93a4[_0xc008('0x2f')]:_0xf4cc4b[_0xc008('0x2a')];if(_0x3e9a99[_0xc008('0x2b')][_0xc008('0x44')]){_0x4f93a4['include']=[{'all':!![]}];}_0x4f93a4=_['merge']({},_0x4f93a4,_0x3e9a99['options']);return db[_0xc008('0x3d')][_0xc008('0x45')](_0x4f93a4)[_0xc008('0x20')](handleEntityNotFound(_0x7279e8,null))[_0xc008('0x20')](respondWithResult(_0x7279e8,null))[_0xc008('0x40')](handleError(_0x7279e8,null));};exports[_0xc008('0x46')]=function(_0x2cf641,_0x33be4f){return db['Interval']['create'](_0x2cf641['body'],{})[_0xc008('0x20')](function(_0x2651cf){var _0x158eae=_0x2cf641['user'][_0xc008('0x21')]({'plain':!![]});if(!_0x158eae)throw new Error(_0xc008('0x47'));if(_0x158eae[_0xc008('0x48')]===_0xc008('0x49')){var _0x4981b4=_0x2651cf[_0xc008('0x21')]({'plain':!![]});var _0x17ec90=_0xc008('0x4a');return db[_0xc008('0x4b')][_0xc008('0x45')]({'where':{'name':_0x17ec90,'userProfileId':_0x158eae['userProfileId']},'raw':!![]})['then'](function(_0x223056){if(_0x223056&&_0x223056['autoAssociation']===0x0){return db[_0xc008('0x22')][_0xc008('0x46')]({'name':_0x4981b4[_0xc008('0x24')],'resourceId':_0x4981b4['id'],'type':_0x223056['name'],'sectionId':_0x223056['id']},{})[_0xc008('0x20')](function(){return _0x2651cf;});}else{return _0x2651cf;}})[_0xc008('0x40')](function(_0xee64){logger[_0xc008('0x4c')](_0xc008('0x4d'),_0xee64);throw _0xee64;});}return _0x2651cf;})['then'](respondWithResult(_0x33be4f,0xc9))[_0xc008('0x40')](handleError(_0x33be4f,null));};exports[_0xc008('0x4e')]=function(_0x4b4c6d,_0x24f775){if(_0x4b4c6d[_0xc008('0x4f')]['id']){delete _0x4b4c6d['body']['id'];}return db['Interval'][_0xc008('0x45')]({'where':{'id':_0x4b4c6d[_0xc008('0x42')]['id']}})[_0xc008('0x20')](handleEntityNotFound(_0x24f775,null))[_0xc008('0x20')](saveUpdates(_0x4b4c6d[_0xc008('0x4f')],null))['then'](respondWithResult(_0x24f775,null))['catch'](handleError(_0x24f775,null));};exports[_0xc008('0x1f')]=function(_0x5d815d,_0x3d7cce){return db[_0xc008('0x3d')][_0xc008('0x45')]({'where':{'id':_0x5d815d[_0xc008('0x42')]['id']}})[_0xc008('0x20')](handleEntityNotFound(_0x3d7cce,null))[_0xc008('0x20')](removeEntity(_0x3d7cce,null))['catch'](handleError(_0x3d7cce,null));};exports[_0xc008('0x50')]=function(_0xbd7422,_0x9a7abc,_0x2b350c){if(_0xbd7422[_0xc008('0x4f')]['id']){delete _0xbd7422['body']['id'];}return db[_0xc008('0x3d')]['find']({'where':{'id':_0xbd7422['params']['id']}})['then'](handleEntityNotFound(_0x9a7abc,null))[_0xc008('0x20')](function(_0x1bcbb1){if(_0x1bcbb1){_0xbd7422[_0xc008('0x4f')]['IntervalId']=_0x1bcbb1['id'];return db[_0xc008('0x3d')][_0xc008('0x46')](_0xbd7422[_0xc008('0x4f')]);}})['then'](respondWithResult(_0x9a7abc,null))[_0xc008('0x40')](handleError(_0x9a7abc,null));};exports[_0xc008('0x51')]=function(_0x12ba3f,_0x1b5a22,_0x5baff1){var _0x4022dd={};var _0x4eaa6d={};var _0x23ef33;var _0x422e1f;return db[_0xc008('0x3d')][_0xc008('0x52')]({'where':{'id':_0x12ba3f[_0xc008('0x42')]['id']}})[_0xc008('0x20')](handleEntityNotFound(_0x1b5a22,null))['then'](function(_0x375e71){if(_0x375e71){_0x23ef33=_0x375e71;_0x4eaa6d['model']=_['keys'](db[_0xc008('0x3d')][_0xc008('0x43')]);_0x4eaa6d['query']=_[_0xc008('0x2c')](_0x12ba3f[_0xc008('0x2b')]);_0x4eaa6d[_0xc008('0x2d')]=_[_0xc008('0x2e')](_0x4eaa6d[_0xc008('0x2a')],_0x4eaa6d[_0xc008('0x2b')]);_0x4022dd[_0xc008('0x2f')]=_['intersection'](_0x4eaa6d[_0xc008('0x2a')],qs[_0xc008('0x30')](_0x12ba3f[_0xc008('0x2b')][_0xc008('0x30')]));_0x4022dd[_0xc008('0x2f')]=_0x4022dd[_0xc008('0x2f')][_0xc008('0x31')]?_0x4022dd[_0xc008('0x2f')]:_0x4eaa6d[_0xc008('0x2a')];_0x4022dd[_0xc008('0x35')]=qs[_0xc008('0x36')](_0x12ba3f[_0xc008('0x2b')][_0xc008('0x36')]);_0x4022dd[_0xc008('0x38')]=qs['filters'](_[_0xc008('0x37')](_0x12ba3f[_0xc008('0x2b')],_0x4eaa6d[_0xc008('0x2d')]));if(_0x12ba3f['query'][_0xc008('0x3a')]){_0x4022dd[_0xc008('0x38')]=_['merge'](_0x4022dd['where'],{'$or':_[_0xc008('0x26')](_0x4022dd[_0xc008('0x2f')],function(_0x7bad14){var _0x39083c={};_0x39083c[_0x7bad14]={'$like':'%'+_0x12ba3f[_0xc008('0x2b')][_0xc008('0x3a')]+'%'};return _0x39083c;})});}_0x4022dd=_[_0xc008('0x3b')]({},_0x4022dd,_0x12ba3f[_0xc008('0x3c')]);return _0x23ef33[_0xc008('0x51')](_0x4022dd);}})[_0xc008('0x20')](function(_0x383325){if(_0x383325){_0x422e1f=_0x383325['length'];if(!_0x12ba3f[_0xc008('0x2b')][_0xc008('0x53')](_0xc008('0x32'))){_0x4022dd[_0xc008('0x33')]=qs['limit'](_0x12ba3f[_0xc008('0x2b')]['limit']);_0x4022dd[_0xc008('0x34')]=qs[_0xc008('0x34')](_0x12ba3f[_0xc008('0x2b')]['offset']);}return _0x23ef33[_0xc008('0x51')](_0x4022dd);}})[_0xc008('0x20')](function(_0xa80000){if(_0xa80000){return _0xa80000?{'count':_0x422e1f,'rows':_0xa80000}:null;}})['then'](respondWithResult(_0x1b5a22,null))[_0xc008('0x40')](handleError(_0x1b5a22,null));};exports['addIntervals']=function(_0x50ee03,_0xee7a85,_0x23012c){return db[_0xc008('0x3d')][_0xc008('0x52')]({'where':{'id':_0x50ee03['params']['id']}})[_0xc008('0x20')](handleEntityNotFound(_0xee7a85,null))[_0xc008('0x20')](function(_0x49493b){if(_0x49493b){return db[_0xc008('0x54')]['transaction'](function(_0x278cbe){return db['Interval'][_0xc008('0x1f')]({'where':{'IntervalId':_0x50ee03['params']['id']},'transaction':_0x278cbe})[_0xc008('0x20')](function(_0x103d75){var _0x33d8e4=_[_0xc008('0x26')](_0x50ee03['body'],function(_0x57752c){delete _0x57752c['id'];_0x57752c[_0xc008('0x55')]=_0x50ee03[_0xc008('0x42')]['id'];return _0x57752c;});return db[_0xc008('0x3d')][_0xc008('0x56')](_0x33d8e4,{'transaction':_0x278cbe});});})[_0xc008('0x20')](function(){return db[_0xc008('0x3d')][_0xc008('0x3f')]({'where':{'IntervalId':_0x50ee03['params']['id']}});});}})[_0xc008('0x20')](respondWithResult(_0xee7a85,null))['catch'](handleError(_0xee7a85,null));}; \ No newline at end of file +var _0x9c44=['length','nolimit','limit','sort','where','pick','filter','merge','type','VIRTUAL','count','includeAll','include','findAll','rows','catch','show','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','addInterval','IntervalId','order','getIntervals','hasOwnProperty','addIntervals','findOne','sequelize','bulkCreate','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../mysqldb','../../components/extensions/rewrite','status','end','json','offset','set','Content-Range','reject','save','update','then','destroy','get','Intervals','UserProfileResource','sendStatus','stack','name','index','map','Interval','rawAttributes','model','query','keys','filters','intersection','fields','attributes'];(function(_0x280e19,_0x2e6de4){var _0x1a28aa=function(_0xc07d6b){while(--_0xc07d6b){_0x280e19['push'](_0x280e19['shift']());}};_0x1a28aa(++_0x2e6de4);}(_0x9c44,0x178));var _0x49c4=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0x9c44[_0x50a0c2];return _0x5ebadd;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x49c4('0x0'));var zipdir=require(_0x49c4('0x1'));var jsonpatch=require(_0x49c4('0x2'));var rp=require(_0x49c4('0x3'));var moment=require(_0x49c4('0x4'));var BPromise=require(_0x49c4('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x49c4('0x6'));var sox=require('sox');var csv=require(_0x49c4('0x7'));var ejs=require(_0x49c4('0x8'));var fs=require('fs');var _=require(_0x49c4('0x9'));var squel=require(_0x49c4('0xa'));var crypto=require(_0x49c4('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x49c4('0xc'));var toCsv=require(_0x49c4('0x7'));var querystring=require(_0x49c4('0xd'));var Papa=require(_0x49c4('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x49c4('0xf'));var as=require(_0x49c4('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x49c4('0x11'))(_0x49c4('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x49c4('0x13'))['db'];var extensions=require(_0x49c4('0x14'));function respondWithStatusCode(_0x5487cd,_0x7df3a9){_0x7df3a9=_0x7df3a9||0xcc;return function(_0x403bfb){if(_0x403bfb){return _0x5487cd['sendStatus'](_0x7df3a9);}return _0x5487cd[_0x49c4('0x15')](_0x7df3a9)[_0x49c4('0x16')]();};}function respondWithResult(_0x21f15a,_0x2decee){_0x2decee=_0x2decee||0xc8;return function(_0x12777c){if(_0x12777c){return _0x21f15a[_0x49c4('0x15')](_0x2decee)[_0x49c4('0x17')](_0x12777c);}};}function respondWithFilteredResult(_0x3de397,_0x58d177){return function(_0x3acd06){if(_0x3acd06){var _0x141003=_0x3acd06['count'],_0x13a2db=_0x58d177[_0x49c4('0x18')],_0x81e831=_0x58d177[_0x49c4('0x18')]+_0x58d177['limit'],_0x2abc78;if(_0x81e831>=_0x141003){_0x81e831=_0x141003;_0x2abc78=0xc8;}else{_0x2abc78=0xce;}_0x3de397['status'](_0x2abc78);return _0x3de397[_0x49c4('0x19')](_0x49c4('0x1a'),_0x13a2db+'-'+_0x81e831+'/'+_0x141003)[_0x49c4('0x17')](_0x3acd06);}return null;};}function patchUpdates(_0x59f29b){return function(_0x24856d){try{jsonpatch['apply'](_0x24856d,_0x59f29b,!![]);}catch(_0x2cbd50){return BPromise[_0x49c4('0x1b')](_0x2cbd50);}return _0x24856d[_0x49c4('0x1c')]();};}function saveUpdates(_0x291526,_0x382040){return function(_0x41078c){if(_0x41078c){return _0x41078c[_0x49c4('0x1d')](_0x291526)[_0x49c4('0x1e')](function(_0x2197d2){return _0x2197d2;});}return null;};}function removeEntity(_0x578447,_0x527126){return function(_0x57f502){if(_0x57f502){return _0x57f502[_0x49c4('0x1f')]()['then'](function(){var _0x592bb8=_0x57f502[_0x49c4('0x20')]({'plain':!![]});var _0x15581b=_0x49c4('0x21');return db[_0x49c4('0x22')]['destroy']({'where':{'type':_0x15581b,'resourceId':_0x592bb8['id']}})['then'](function(){return _0x57f502;});})[_0x49c4('0x1e')](function(){_0x578447[_0x49c4('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x207358,_0x43e014){return function(_0x210159){if(!_0x210159){_0x207358[_0x49c4('0x23')](0x194);}return _0x210159;};}function handleError(_0x531d92,_0x543ea2){_0x543ea2=_0x543ea2||0x1f4;return function(_0x449960){logger['error'](_0x449960[_0x49c4('0x24')]);if(_0x449960[_0x49c4('0x25')]){delete _0x449960[_0x49c4('0x25')];}_0x531d92[_0x49c4('0x15')](_0x543ea2)['send'](_0x449960);};}exports[_0x49c4('0x26')]=function(_0x2b2793,_0x46e04d){var _0x4f28a2={},_0x6329b3={},_0x29f835={'count':0x0,'rows':[]};var _0x26ba17=_[_0x49c4('0x27')](db[_0x49c4('0x28')][_0x49c4('0x29')],function(_0x46f7ea){return{'name':_0x46f7ea['fieldName'],'type':_0x46f7ea['type']['key']};});_0x6329b3[_0x49c4('0x2a')]=_[_0x49c4('0x27')](_0x26ba17,_0x49c4('0x25'));_0x6329b3[_0x49c4('0x2b')]=_[_0x49c4('0x2c')](_0x2b2793['query']);_0x6329b3[_0x49c4('0x2d')]=_[_0x49c4('0x2e')](_0x6329b3[_0x49c4('0x2a')],_0x6329b3[_0x49c4('0x2b')]);_0x4f28a2['attributes']=_['intersection'](_0x6329b3[_0x49c4('0x2a')],qs[_0x49c4('0x2f')](_0x2b2793[_0x49c4('0x2b')][_0x49c4('0x2f')]));_0x4f28a2[_0x49c4('0x30')]=_0x4f28a2['attributes'][_0x49c4('0x31')]?_0x4f28a2[_0x49c4('0x30')]:_0x6329b3[_0x49c4('0x2a')];if(!_0x2b2793['query']['hasOwnProperty'](_0x49c4('0x32'))){_0x4f28a2[_0x49c4('0x33')]=qs[_0x49c4('0x33')](_0x2b2793[_0x49c4('0x2b')][_0x49c4('0x33')]);_0x4f28a2[_0x49c4('0x18')]=qs[_0x49c4('0x18')](_0x2b2793[_0x49c4('0x2b')][_0x49c4('0x18')]);}_0x4f28a2['order']=qs[_0x49c4('0x34')](_0x2b2793['query'][_0x49c4('0x34')]);_0x4f28a2[_0x49c4('0x35')]=qs[_0x49c4('0x2d')](_[_0x49c4('0x36')](_0x2b2793['query'],_0x6329b3[_0x49c4('0x2d')]));if(_0x2b2793[_0x49c4('0x2b')][_0x49c4('0x37')]){_0x4f28a2['where']=_[_0x49c4('0x38')](_0x4f28a2[_0x49c4('0x35')],{'$or':_[_0x49c4('0x27')](_0x26ba17,function(_0x5e5366){if(_0x5e5366[_0x49c4('0x39')]!==_0x49c4('0x3a')){var _0x143916={};_0x143916[_0x5e5366[_0x49c4('0x25')]]={'$like':'%'+_0x2b2793[_0x49c4('0x2b')][_0x49c4('0x37')]+'%'};return _0x143916;}})});}_0x4f28a2=_[_0x49c4('0x38')]({},_0x4f28a2,_0x2b2793['options']);var _0x2d2510={'where':_0x4f28a2[_0x49c4('0x35')]};return db[_0x49c4('0x28')][_0x49c4('0x3b')](_0x2d2510)[_0x49c4('0x1e')](function(_0x29dd5d){_0x29f835[_0x49c4('0x3b')]=_0x29dd5d;if(_0x2b2793[_0x49c4('0x2b')][_0x49c4('0x3c')]){_0x4f28a2[_0x49c4('0x3d')]=[{'all':!![]}];}return db[_0x49c4('0x28')][_0x49c4('0x3e')](_0x4f28a2);})[_0x49c4('0x1e')](function(_0x4e38bc){_0x29f835[_0x49c4('0x3f')]=_0x4e38bc;return _0x29f835;})['then'](respondWithFilteredResult(_0x46e04d,_0x4f28a2))[_0x49c4('0x40')](handleError(_0x46e04d,null));};exports[_0x49c4('0x41')]=function(_0x28d4fb,_0x1480da){var _0x239327={'raw':!![],'where':{'id':_0x28d4fb['params']['id']}},_0x281b83={};_0x281b83['model']=_[_0x49c4('0x2c')](db[_0x49c4('0x28')][_0x49c4('0x29')]);_0x281b83[_0x49c4('0x2b')]=_['keys'](_0x28d4fb[_0x49c4('0x2b')]);_0x281b83[_0x49c4('0x2d')]=_[_0x49c4('0x2e')](_0x281b83[_0x49c4('0x2a')],_0x281b83[_0x49c4('0x2b')]);_0x239327[_0x49c4('0x30')]=_[_0x49c4('0x2e')](_0x281b83[_0x49c4('0x2a')],qs[_0x49c4('0x2f')](_0x28d4fb['query'][_0x49c4('0x2f')]));_0x239327['attributes']=_0x239327[_0x49c4('0x30')][_0x49c4('0x31')]?_0x239327[_0x49c4('0x30')]:_0x281b83[_0x49c4('0x2a')];if(_0x28d4fb[_0x49c4('0x2b')]['includeAll']){_0x239327[_0x49c4('0x3d')]=[{'all':!![]}];}_0x239327=_[_0x49c4('0x38')]({},_0x239327,_0x28d4fb[_0x49c4('0x42')]);return db[_0x49c4('0x28')][_0x49c4('0x43')](_0x239327)[_0x49c4('0x1e')](handleEntityNotFound(_0x1480da,null))[_0x49c4('0x1e')](respondWithResult(_0x1480da,null))['catch'](handleError(_0x1480da,null));};exports[_0x49c4('0x44')]=function(_0x5cfff9,_0x3f7379){return db[_0x49c4('0x28')][_0x49c4('0x44')](_0x5cfff9[_0x49c4('0x45')],{})[_0x49c4('0x1e')](function(_0x30bea5){var _0x2c6be1=_0x5cfff9['user'][_0x49c4('0x20')]({'plain':!![]});if(!_0x2c6be1)throw new Error(_0x49c4('0x46'));if(_0x2c6be1['role']===_0x49c4('0x47')){var _0xaece5f=_0x30bea5[_0x49c4('0x20')]({'plain':!![]});var _0x242afc='Intervals';return db['UserProfileSection'][_0x49c4('0x43')]({'where':{'name':_0x242afc,'userProfileId':_0x2c6be1['userProfileId']},'raw':!![]})[_0x49c4('0x1e')](function(_0x1f941f){if(_0x1f941f&&_0x1f941f[_0x49c4('0x48')]===0x0){return db[_0x49c4('0x22')][_0x49c4('0x44')]({'name':_0xaece5f[_0x49c4('0x25')],'resourceId':_0xaece5f['id'],'type':_0x1f941f[_0x49c4('0x25')],'sectionId':_0x1f941f['id']},{})['then'](function(){return _0x30bea5;});}else{return _0x30bea5;}})[_0x49c4('0x40')](function(_0x1550ce){logger[_0x49c4('0x49')](_0x49c4('0x4a'),_0x1550ce);throw _0x1550ce;});}return _0x30bea5;})[_0x49c4('0x1e')](respondWithResult(_0x3f7379,0xc9))[_0x49c4('0x40')](handleError(_0x3f7379,null));};exports[_0x49c4('0x1d')]=function(_0x25d174,_0x1e0b4f){if(_0x25d174[_0x49c4('0x45')]['id']){delete _0x25d174['body']['id'];}return db['Interval'][_0x49c4('0x43')]({'where':{'id':_0x25d174[_0x49c4('0x4b')]['id']}})['then'](handleEntityNotFound(_0x1e0b4f,null))['then'](saveUpdates(_0x25d174[_0x49c4('0x45')],null))['then'](respondWithResult(_0x1e0b4f,null))['catch'](handleError(_0x1e0b4f,null));};exports[_0x49c4('0x1f')]=function(_0x4081a5,_0x4a0a93){return db[_0x49c4('0x28')][_0x49c4('0x43')]({'where':{'id':_0x4081a5[_0x49c4('0x4b')]['id']}})[_0x49c4('0x1e')](handleEntityNotFound(_0x4a0a93,null))['then'](removeEntity(_0x4a0a93,null))[_0x49c4('0x40')](handleError(_0x4a0a93,null));};exports[_0x49c4('0x4c')]=function(_0x207572,_0x208208,_0x73840f){if(_0x207572[_0x49c4('0x45')]['id']){delete _0x207572['body']['id'];}return db['Interval'][_0x49c4('0x43')]({'where':{'id':_0x207572[_0x49c4('0x4b')]['id']}})[_0x49c4('0x1e')](handleEntityNotFound(_0x208208,null))[_0x49c4('0x1e')](function(_0x23288e){if(_0x23288e){_0x207572[_0x49c4('0x45')][_0x49c4('0x4d')]=_0x23288e['id'];return db['Interval'][_0x49c4('0x44')](_0x207572[_0x49c4('0x45')]);}})['then'](respondWithResult(_0x208208,null))[_0x49c4('0x40')](handleError(_0x208208,null));};exports['getIntervals']=function(_0x2f966c,_0x147ebd,_0x9eaa84){var _0x2fe89a={};var _0x845f7e={};var _0x3e44d7;var _0x3eb66d;return db[_0x49c4('0x28')]['findOne']({'where':{'id':_0x2f966c[_0x49c4('0x4b')]['id']}})[_0x49c4('0x1e')](handleEntityNotFound(_0x147ebd,null))['then'](function(_0x10dec7){if(_0x10dec7){_0x3e44d7=_0x10dec7;_0x845f7e[_0x49c4('0x2a')]=_['keys'](db[_0x49c4('0x28')][_0x49c4('0x29')]);_0x845f7e['query']=_['keys'](_0x2f966c['query']);_0x845f7e['filters']=_[_0x49c4('0x2e')](_0x845f7e['model'],_0x845f7e[_0x49c4('0x2b')]);_0x2fe89a[_0x49c4('0x30')]=_['intersection'](_0x845f7e[_0x49c4('0x2a')],qs[_0x49c4('0x2f')](_0x2f966c['query'][_0x49c4('0x2f')]));_0x2fe89a[_0x49c4('0x30')]=_0x2fe89a[_0x49c4('0x30')][_0x49c4('0x31')]?_0x2fe89a['attributes']:_0x845f7e[_0x49c4('0x2a')];_0x2fe89a[_0x49c4('0x4e')]=qs[_0x49c4('0x34')](_0x2f966c[_0x49c4('0x2b')]['sort']);_0x2fe89a[_0x49c4('0x35')]=qs['filters'](_['pick'](_0x2f966c['query'],_0x845f7e['filters']));if(_0x2f966c[_0x49c4('0x2b')][_0x49c4('0x37')]){_0x2fe89a[_0x49c4('0x35')]=_[_0x49c4('0x38')](_0x2fe89a['where'],{'$or':_['map'](_0x2fe89a[_0x49c4('0x30')],function(_0x109b81){var _0x342326={};_0x342326[_0x109b81]={'$like':'%'+_0x2f966c[_0x49c4('0x2b')][_0x49c4('0x37')]+'%'};return _0x342326;})});}_0x2fe89a=_[_0x49c4('0x38')]({},_0x2fe89a,_0x2f966c[_0x49c4('0x42')]);return _0x3e44d7[_0x49c4('0x4f')](_0x2fe89a);}})['then'](function(_0x2276db){if(_0x2276db){_0x3eb66d=_0x2276db['length'];if(!_0x2f966c[_0x49c4('0x2b')][_0x49c4('0x50')](_0x49c4('0x32'))){_0x2fe89a[_0x49c4('0x33')]=qs[_0x49c4('0x33')](_0x2f966c[_0x49c4('0x2b')][_0x49c4('0x33')]);_0x2fe89a[_0x49c4('0x18')]=qs[_0x49c4('0x18')](_0x2f966c[_0x49c4('0x2b')][_0x49c4('0x18')]);}return _0x3e44d7[_0x49c4('0x4f')](_0x2fe89a);}})[_0x49c4('0x1e')](function(_0x14bd09){if(_0x14bd09){return _0x14bd09?{'count':_0x3eb66d,'rows':_0x14bd09}:null;}})[_0x49c4('0x1e')](respondWithResult(_0x147ebd,null))[_0x49c4('0x40')](handleError(_0x147ebd,null));};exports[_0x49c4('0x51')]=function(_0x3485c0,_0x4e1544,_0x5ec201){return db[_0x49c4('0x28')][_0x49c4('0x52')]({'where':{'id':_0x3485c0['params']['id']}})[_0x49c4('0x1e')](handleEntityNotFound(_0x4e1544,null))[_0x49c4('0x1e')](function(_0x2939fd){if(_0x2939fd){return db[_0x49c4('0x53')]['transaction'](function(_0x5a14a5){return db['Interval'][_0x49c4('0x1f')]({'where':{'IntervalId':_0x3485c0[_0x49c4('0x4b')]['id']},'transaction':_0x5a14a5})[_0x49c4('0x1e')](function(_0x2f4289){var _0x118fc4=_[_0x49c4('0x27')](_0x3485c0[_0x49c4('0x45')],function(_0x3692a4){delete _0x3692a4['id'];_0x3692a4[_0x49c4('0x4d')]=_0x3485c0['params']['id'];return _0x3692a4;});return db[_0x49c4('0x28')][_0x49c4('0x54')](_0x118fc4,{'transaction':_0x5a14a5});});})[_0x49c4('0x1e')](function(){return db['Interval'][_0x49c4('0x3e')]({'where':{'IntervalId':_0x3485c0[_0x49c4('0x4b')]['id']}});});}})[_0x49c4('0x1e')](respondWithResult(_0x4e1544,null))[_0x49c4('0x40')](handleError(_0x4e1544,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 6b029c9..7b697fd 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 _0xe1bf=['rimraf','../../config/environment','./interval.attributes','../../components/extensions/rewrite','define','tools_intervals','rewrite','util','api','moment','bluebird','request-promise'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xe1bf,0x67));var _0xfe1b=function(_0x50f876,_0x4953af){_0x50f876=_0x50f876-0x0;var _0x5bf693=_0xe1bf[_0x50f876];return _0x5bf693;};'use strict';var _=require('lodash');var util=require(_0xfe1b('0x0'));var logger=require('../../config/logger')(_0xfe1b('0x1'));var moment=require(_0xfe1b('0x2'));var BPromise=require(_0xfe1b('0x3'));var rp=require(_0xfe1b('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfe1b('0x5'));var config=require(_0xfe1b('0x6'));var attributes=require(_0xfe1b('0x7'));var extensions=require(_0xfe1b('0x8'));module['exports']=function(_0x41d69f,_0x25a3ae){return _0x41d69f[_0xfe1b('0x9')]('Interval',attributes,{'tableName':_0xfe1b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x3fe148,_0x411299){extensions[_0xfe1b('0xb')](_0x41d69f,_0x3fe148);},'afterBulkCreate':function(_0x446abc,_0x493180,_0xc0301e){_0xc0301e();extensions[_0xfe1b('0xb')](_0x41d69f,_0x446abc[0x0]);},'afterUpdate':function(_0x2a2e2d,_0xa28356){extensions[_0xfe1b('0xb')](_0x41d69f,_0x2a2e2d);},'afterDestroy':function(_0x4693ce,_0x2bb8c0){extensions[_0xfe1b('0xb')](_0x41d69f,_0x4693ce);}}});}; \ No newline at end of file +var _0x6085=['path','rimraf','./interval.attributes','../../components/extensions/rewrite','exports','Interval','tools_intervals','rewrite','lodash','util','api'];(function(_0x1e7b16,_0x4607a1){var _0x37fadc=function(_0x1fc9ce){while(--_0x1fc9ce){_0x1e7b16['push'](_0x1e7b16['shift']());}};_0x37fadc(++_0x4607a1);}(_0x6085,0x15d));var _0x5608=function(_0x530570,_0xe3c5a1){_0x530570=_0x530570-0x0;var _0x55ca9d=_0x6085[_0x530570];return _0x55ca9d;};'use strict';var _=require(_0x5608('0x0'));var util=require(_0x5608('0x1'));var logger=require('../../config/logger')(_0x5608('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x5608('0x3'));var rimraf=require(_0x5608('0x4'));var config=require('../../config/environment');var attributes=require(_0x5608('0x5'));var extensions=require(_0x5608('0x6'));module[_0x5608('0x7')]=function(_0x72b6a5,_0x3e5a94){return _0x72b6a5['define'](_0x5608('0x8'),attributes,{'tableName':_0x5608('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x5c177a,_0x79e4ac){extensions[_0x5608('0xa')](_0x72b6a5,_0x5c177a);},'afterBulkCreate':function(_0x57c27b,_0x1fa28a,_0x54c181){_0x54c181();extensions['rewrite'](_0x72b6a5,_0x57c27b[0x0]);},'afterUpdate':function(_0x26beca,_0x310233){extensions[_0x5608('0xa')](_0x72b6a5,_0x26beca);},'afterDestroy':function(_0xfcc832,_0x25fc5c){extensions[_0x5608('0xa')](_0x72b6a5,_0xfcc832);}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 2514e0a..7b046ab 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 _0x648c=['util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','Interval,\x20%s,\x20%s','request\x20sent','debug','Interval,\x20%s,\x20%s,\x20%s','stringify','error','message','result','GetInterval','Interval','findAll','options','raw','limit','include','model','map','attributes','ShowInterval','find','where','lodash'];(function(_0x580576,_0x2f107d){var _0x3f55a0=function(_0x2e180b){while(--_0x2e180b){_0x580576['push'](_0x580576['shift']());}};_0x3f55a0(++_0x2f107d);}(_0x648c,0xd1));var _0xc648=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x648c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc648('0x0'));var util=require(_0xc648('0x1'));var moment=require('moment');var BPromise=require(_0xc648('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc648('0x3'));var db=require(_0xc648('0x4'))['db'];var utils=require(_0xc648('0x5'));var logger=require(_0xc648('0x6'))(_0xc648('0x7'));var config=require(_0xc648('0x8'));var jayson=require(_0xc648('0x9'));var client=jayson[_0xc648('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x143b5f,_0x1fd744,_0x4bab66){return new BPromise(function(_0x52259d,_0x44a9e8){return client[_0xc648('0xb')](_0x143b5f,_0x4bab66)[_0xc648('0xc')](function(_0x52b243){logger[_0xc648('0xd')](_0xc648('0xe'),_0x1fd744,_0xc648('0xf'));logger[_0xc648('0x10')](_0xc648('0x11'),_0x1fd744,_0xc648('0xf'),JSON[_0xc648('0x12')](_0x52b243));if(_0x52b243[_0xc648('0x13')]){if(_0x52b243[_0xc648('0x13')]['code']===0x1f4){logger[_0xc648('0x13')]('Interval,\x20%s,\x20%s',_0x1fd744,_0x52b243[_0xc648('0x13')][_0xc648('0x14')]);return _0x44a9e8(_0x52b243[_0xc648('0x13')][_0xc648('0x14')]);}logger[_0xc648('0x13')](_0xc648('0xe'),_0x1fd744,_0x52b243[_0xc648('0x13')][_0xc648('0x14')]);return _0x52259d(_0x52b243['error'][_0xc648('0x14')]);}else{logger['info'](_0xc648('0xe'),_0x1fd744,_0xc648('0xf'));_0x52259d(_0x52b243[_0xc648('0x15')][_0xc648('0x14')]);}})['catch'](function(_0x29599c){logger[_0xc648('0x13')](_0xc648('0xe'),_0x1fd744,_0x29599c);_0x44a9e8(_0x29599c);});});}exports[_0xc648('0x16')]=function(_0x25429e){var _0x547d94=this;return new Promise(function(_0x30c923,_0x533341){return db[_0xc648('0x17')][_0xc648('0x18')]({'raw':_0x25429e['options']?_0x25429e[_0xc648('0x19')][_0xc648('0x1a')]===undefined?!![]:![]:!![],'where':_0x25429e[_0xc648('0x19')]?_0x25429e[_0xc648('0x19')]['where']||null:null,'attributes':_0x25429e[_0xc648('0x19')]?_0x25429e[_0xc648('0x19')]['attributes']||null:null,'limit':_0x25429e[_0xc648('0x19')]?_0x25429e[_0xc648('0x19')][_0xc648('0x1b')]||null:null,'include':_0x25429e[_0xc648('0x19')]?_0x25429e[_0xc648('0x19')][_0xc648('0x1c')]?_['map'](_0x25429e[_0xc648('0x19')]['include'],function(_0x4d218b){return{'model':db[_0x4d218b[_0xc648('0x1d')]],'as':_0x4d218b['as'],'attributes':_0x4d218b['attributes'],'include':_0x4d218b[_0xc648('0x1c')]?_[_0xc648('0x1e')](_0x4d218b[_0xc648('0x1c')],function(_0x3d32e0){return{'model':db[_0x3d32e0['model']],'as':_0x3d32e0['as'],'attributes':_0x3d32e0[_0xc648('0x1f')],'include':_0x3d32e0['include']?_[_0xc648('0x1e')](_0x3d32e0[_0xc648('0x1c')],function(_0x34fa9d){return{'model':db[_0x34fa9d[_0xc648('0x1d')]],'as':_0x34fa9d['as'],'attributes':_0x34fa9d[_0xc648('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xc648('0xc')](function(_0x3a38f6){logger[_0xc648('0xd')](_0xc648('0x16'),_0x25429e);logger['debug'](_0xc648('0x16'),_0x25429e,JSON['stringify'](_0x3a38f6));_0x30c923(_0x3a38f6);})['catch'](function(_0x579a3b){logger[_0xc648('0x13')](_0xc648('0x16'),_0x579a3b['message'],_0x25429e);_0x533341(_0x547d94['error'](0x1f4,_0x579a3b[_0xc648('0x14')]));});});};exports[_0xc648('0x20')]=function(_0x5ed5d0){var _0x3fd70a=this;return new Promise(function(_0x417b87,_0x420877){return db[_0xc648('0x17')][_0xc648('0x21')]({'raw':_0x5ed5d0['options']?_0x5ed5d0[_0xc648('0x19')][_0xc648('0x1a')]===undefined?!![]:![]:!![],'where':_0x5ed5d0['options']?_0x5ed5d0[_0xc648('0x19')][_0xc648('0x22')]||null:null,'attributes':_0x5ed5d0['options']?_0x5ed5d0[_0xc648('0x19')][_0xc648('0x1f')]||null:null,'include':_0x5ed5d0['options']?_0x5ed5d0[_0xc648('0x19')][_0xc648('0x1c')]?_[_0xc648('0x1e')](_0x5ed5d0[_0xc648('0x19')][_0xc648('0x1c')],function(_0x573a67){return{'model':db[_0x573a67['model']],'as':_0x573a67['as'],'attributes':_0x573a67[_0xc648('0x1f')],'include':_0x573a67[_0xc648('0x1c')]?_['map'](_0x573a67[_0xc648('0x1c')],function(_0x425371){return{'model':db[_0x425371[_0xc648('0x1d')]],'as':_0x425371['as'],'attributes':_0x425371['attributes'],'include':_0x425371[_0xc648('0x1c')]?_[_0xc648('0x1e')](_0x425371[_0xc648('0x1c')],function(_0x20375f){return{'model':db[_0x20375f['model']],'as':_0x20375f['as'],'attributes':_0x20375f[_0xc648('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xc648('0xc')](function(_0x5b86df){logger[_0xc648('0xd')](_0xc648('0x20'),_0x5ed5d0);logger[_0xc648('0x10')]('ShowInterval',_0x5ed5d0,JSON['stringify'](_0x5b86df));_0x417b87(_0x5b86df);})['catch'](function(_0x5574d6){logger[_0xc648('0x13')]('ShowInterval',_0x5574d6[_0xc648('0x14')],_0x5ed5d0);_0x420877(_0x3fd70a[_0xc648('0x13')](0x1f4,_0x5574d6['message']));});});}; \ No newline at end of file +var _0x665b=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','Interval,\x20%s,\x20%s','debug','Interval,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','GetInterval','Interval','findAll','options','raw','attributes','limit','include','map','model','ShowInterval','find','where','then','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x3ce3c,_0x319337){var _0x55a2c9=function(_0x1568d0){while(--_0x1568d0){_0x3ce3c['push'](_0x3ce3c['shift']());}};_0x55a2c9(++_0x319337);}(_0x665b,0x94));var _0xb665=function(_0x398d53,_0x59cd8a){_0x398d53=_0x398d53-0x0;var _0xcaaec9=_0x665b[_0x398d53];return _0xcaaec9;};'use strict';var _=require(_0xb665('0x0'));var util=require(_0xb665('0x1'));var moment=require(_0xb665('0x2'));var BPromise=require(_0xb665('0x3'));var rs=require(_0xb665('0x4'));var fs=require('fs');var Redis=require(_0xb665('0x5'));var db=require(_0xb665('0x6'))['db'];var utils=require(_0xb665('0x7'));var logger=require(_0xb665('0x8'))(_0xb665('0x9'));var config=require(_0xb665('0xa'));var jayson=require(_0xb665('0xb'));var client=jayson[_0xb665('0xc')][_0xb665('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x110c44,_0xac2b5c,_0x397ede){return new BPromise(function(_0xc0cef3,_0x252450){return client[_0xb665('0xe')](_0x110c44,_0x397ede)['then'](function(_0x1cbce5){logger[_0xb665('0xf')](_0xb665('0x10'),_0xac2b5c,'request\x20sent');logger[_0xb665('0x11')](_0xb665('0x12'),_0xac2b5c,_0xb665('0x13'),JSON['stringify'](_0x1cbce5));if(_0x1cbce5['error']){if(_0x1cbce5['error']['code']===0x1f4){logger[_0xb665('0x14')]('Interval,\x20%s,\x20%s',_0xac2b5c,_0x1cbce5[_0xb665('0x14')][_0xb665('0x15')]);return _0x252450(_0x1cbce5[_0xb665('0x14')][_0xb665('0x15')]);}logger[_0xb665('0x14')](_0xb665('0x10'),_0xac2b5c,_0x1cbce5[_0xb665('0x14')][_0xb665('0x15')]);return _0xc0cef3(_0x1cbce5['error'][_0xb665('0x15')]);}else{logger[_0xb665('0xf')](_0xb665('0x10'),_0xac2b5c,_0xb665('0x13'));_0xc0cef3(_0x1cbce5[_0xb665('0x16')][_0xb665('0x15')]);}})[_0xb665('0x17')](function(_0x251f26){logger[_0xb665('0x14')](_0xb665('0x10'),_0xac2b5c,_0x251f26);_0x252450(_0x251f26);});});}exports[_0xb665('0x18')]=function(_0x1db42e){var _0x20daac=this;return new Promise(function(_0x1acf6c,_0x203016){return db[_0xb665('0x19')][_0xb665('0x1a')]({'raw':_0x1db42e[_0xb665('0x1b')]?_0x1db42e[_0xb665('0x1b')][_0xb665('0x1c')]===undefined?!![]:![]:!![],'where':_0x1db42e[_0xb665('0x1b')]?_0x1db42e[_0xb665('0x1b')]['where']||null:null,'attributes':_0x1db42e['options']?_0x1db42e[_0xb665('0x1b')][_0xb665('0x1d')]||null:null,'limit':_0x1db42e[_0xb665('0x1b')]?_0x1db42e[_0xb665('0x1b')][_0xb665('0x1e')]||null:null,'include':_0x1db42e[_0xb665('0x1b')]?_0x1db42e[_0xb665('0x1b')][_0xb665('0x1f')]?_[_0xb665('0x20')](_0x1db42e[_0xb665('0x1b')][_0xb665('0x1f')],function(_0x4e342c){return{'model':db[_0x4e342c['model']],'as':_0x4e342c['as'],'attributes':_0x4e342c[_0xb665('0x1d')],'include':_0x4e342c['include']?_[_0xb665('0x20')](_0x4e342c[_0xb665('0x1f')],function(_0x3f7a05){return{'model':db[_0x3f7a05[_0xb665('0x21')]],'as':_0x3f7a05['as'],'attributes':_0x3f7a05[_0xb665('0x1d')],'include':_0x3f7a05['include']?_[_0xb665('0x20')](_0x3f7a05[_0xb665('0x1f')],function(_0x1ad2db){return{'model':db[_0x1ad2db[_0xb665('0x21')]],'as':_0x1ad2db['as'],'attributes':_0x1ad2db[_0xb665('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2c0a99){logger[_0xb665('0xf')]('GetInterval',_0x1db42e);logger['debug'](_0xb665('0x18'),_0x1db42e,JSON['stringify'](_0x2c0a99));_0x1acf6c(_0x2c0a99);})[_0xb665('0x17')](function(_0x3ebf8e){logger[_0xb665('0x14')](_0xb665('0x18'),_0x3ebf8e['message'],_0x1db42e);_0x203016(_0x20daac[_0xb665('0x14')](0x1f4,_0x3ebf8e[_0xb665('0x15')]));});});};exports[_0xb665('0x22')]=function(_0x48beec){var _0x57673b=this;return new Promise(function(_0x410a44,_0x47a693){return db[_0xb665('0x19')][_0xb665('0x23')]({'raw':_0x48beec[_0xb665('0x1b')]?_0x48beec[_0xb665('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x48beec[_0xb665('0x1b')]?_0x48beec[_0xb665('0x1b')][_0xb665('0x24')]||null:null,'attributes':_0x48beec[_0xb665('0x1b')]?_0x48beec['options'][_0xb665('0x1d')]||null:null,'include':_0x48beec[_0xb665('0x1b')]?_0x48beec[_0xb665('0x1b')][_0xb665('0x1f')]?_[_0xb665('0x20')](_0x48beec[_0xb665('0x1b')][_0xb665('0x1f')],function(_0x57b5d2){return{'model':db[_0x57b5d2[_0xb665('0x21')]],'as':_0x57b5d2['as'],'attributes':_0x57b5d2[_0xb665('0x1d')],'include':_0x57b5d2[_0xb665('0x1f')]?_[_0xb665('0x20')](_0x57b5d2[_0xb665('0x1f')],function(_0x3660a9){return{'model':db[_0x3660a9[_0xb665('0x21')]],'as':_0x3660a9['as'],'attributes':_0x3660a9[_0xb665('0x1d')],'include':_0x3660a9[_0xb665('0x1f')]?_[_0xb665('0x20')](_0x3660a9[_0xb665('0x1f')],function(_0x24c67a){return{'model':db[_0x24c67a[_0xb665('0x21')]],'as':_0x24c67a['as'],'attributes':_0x24c67a['attributes']};}):[]};}):[]};}):[]:[]})[_0xb665('0x25')](function(_0x3575aa){logger[_0xb665('0xf')](_0xb665('0x22'),_0x48beec);logger[_0xb665('0x11')](_0xb665('0x22'),_0x48beec,JSON[_0xb665('0x26')](_0x3575aa));_0x410a44(_0x3575aa);})[_0xb665('0x17')](function(_0x525dad){logger[_0xb665('0x14')](_0xb665('0x22'),_0x525dad[_0xb665('0x15')],_0x48beec);_0x47a693(_0x57673b['error'](0x1f4,_0x525dad[_0xb665('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index 2f56ead..bdffae0 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 _0x1a94=['Router','../../components/auth/service','./jira.controller','post','isAuthenticated','exports'];(function(_0x82129b,_0x484ae9){var _0x2ae5dc=function(_0x299e34){while(--_0x299e34){_0x82129b['push'](_0x82129b['shift']());}};_0x2ae5dc(++_0x484ae9);}(_0x1a94,0x11a));var _0x41a9=function(_0x1a36a5,_0x746928){_0x1a36a5=_0x1a36a5-0x0;var _0x746243=_0x1a94[_0x1a36a5];return _0x746243;};'use strict';var express=require('express');var router=express[_0x41a9('0x0')]();var auth=require(_0x41a9('0x1'));var controller=require(_0x41a9('0x2'));router[_0x41a9('0x3')]('/',auth[_0x41a9('0x4')](),controller['send']);module[_0x41a9('0x5')]=router; \ No newline at end of file +var _0x0add=['isAuthenticated','send','exports','express','Router','../../components/auth/service','post'];(function(_0x4be1fb,_0x2b9bc4){var _0x3a00a0=function(_0x2fa6e5){while(--_0x2fa6e5){_0x4be1fb['push'](_0x4be1fb['shift']());}};_0x3a00a0(++_0x2b9bc4);}(_0x0add,0x122));var _0xd0ad=function(_0x307d86,_0x9264f2){_0x307d86=_0x307d86-0x0;var _0x361745=_0x0add[_0x307d86];return _0x361745;};'use strict';var express=require(_0xd0ad('0x0'));var router=express[_0xd0ad('0x1')]();var auth=require(_0xd0ad('0x2'));var controller=require('./jira.controller');router[_0xd0ad('0x3')]('/',auth[_0xd0ad('0x4')](),controller[_0xd0ad('0x5')]);module[_0xd0ad('0x6')]=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index 4fb1908..07c9943 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 _0x008d=['customfield_11503','name','customfield_11504','track.xcallymotion.com','/rest/api/2/issue','application/json','Basic\x20','toString','setEncoding','utf8','status','statusCode','json','parse','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','end','body','x-forwarded-for','connection','remoteAddress','socket','https','api','support','MOTGUI','summary','Report','\x20from\x20','stringify','issuetype','Bug','fields','customfield_11500','email','customfield_11501'];(function(_0x139d5d,_0x169b61){var _0x29a654=function(_0x42cb9f){while(--_0x42cb9f){_0x139d5d['push'](_0x139d5d['shift']());}};_0x29a654(++_0x169b61);}(_0x008d,0xfc));var _0xd008=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x008d[_0x321bb2];return _0x9c12ed;};'use strict';var BPromise=require('bluebird');var https=require(_0xd008('0x0'));var logger=require('../../config/logger')(_0xd008('0x1'));var USERNAME=_0xd008('0x2');var PASSWORD='3eAmWpBVP0';function openIssue(_0x1a72e9,_0x4f7d88){var _0x1ad93e={'fields':{'project':{'key':_0x1a72e9['key']||_0xd008('0x3')},'summary':(_0x1a72e9[_0xd008('0x4')]||_0xd008('0x5'))+_0xd008('0x6')+_0x1a72e9['ip'],'description':_0x1a72e9['description']||JSON[_0xd008('0x7')](_0x1a72e9),'issuetype':{'name':_0x1a72e9[_0xd008('0x8')]||_0xd008('0x9')}}};_0x1ad93e[_0xd008('0xa')][_0xd008('0xb')]=_0x1a72e9[_0xd008('0xc')];_0x1ad93e[_0xd008('0xa')][_0xd008('0xd')]=_0x1a72e9['oldToken'];_0x1ad93e[_0xd008('0xa')]['customfield_11502']=_0x1a72e9['newToken'];_0x1ad93e[_0xd008('0xa')][_0xd008('0xe')]=_0x1a72e9[_0xd008('0xf')];_0x1ad93e[_0xd008('0xa')][_0xd008('0x10')]=_0x1a72e9['reason'];_0x1ad93e[_0xd008('0xa')]['customfield_10102']=_0x1a72e9['ip'];var _0x44ebcb={'host':_0xd008('0x11'),'port':0x1bb,'path':_0xd008('0x12'),'method':'POST','timeout':0x4e20,'headers':{'Content-Type':_0xd008('0x13'),'Authorization':_0xd008('0x14')+new Buffer(USERNAME+':'+PASSWORD)[_0xd008('0x15')]('base64')}};var _0x22fe35=JSON[_0xd008('0x7')](_0x1ad93e);var _0x1ac84c=https['request'](_0x44ebcb,function(_0x2dfc83){_0x2dfc83[_0xd008('0x16')](_0xd008('0x17'));var _0x2e1fed='';_0x2dfc83['on']('data',function(_0x4b8e1d){_0x2e1fed+=_0x4b8e1d;});_0x2dfc83['on']('end',function(){if(_0x4f7d88){return _0x4f7d88[_0xd008('0x18')](_0x2dfc83[_0xd008('0x19')])[_0xd008('0x1a')](JSON[_0xd008('0x1b')](_0x2e1fed));}});});_0x1ac84c['on'](_0xd008('0x1c'),function(_0x326dc7){if(_0x4f7d88){return _0x4f7d88[_0xd008('0x18')](0x1f4)[_0xd008('0x1a')]({'errors':[{'message':_0xd008('0x1d'),'type':_0xd008('0x1e')}]});}});_0x1ac84c[_0xd008('0x1f')](_0x22fe35);_0x1ac84c[_0xd008('0x20')]();}exports['openIssue']=openIssue;exports['send']=function(_0x19c25b,_0x60a8ca){_0x19c25b[_0xd008('0x21')]['ip']=_0x19c25b['headers'][_0xd008('0x22')]||_0x19c25b[_0xd008('0x23')][_0xd008('0x24')]||_0x19c25b[_0xd008('0x25')]['remoteAddress']||_0x19c25b[_0xd008('0x23')][_0xd008('0x25')]['remoteAddress'];return openIssue(_0x19c25b[_0xd008('0x21')],_0x60a8ca);}; \ No newline at end of file +var _0xd297=['email','oldToken','customfield_11502','newToken','customfield_11503','reason','customfield_10102','track.xcallymotion.com','POST','application/json','toString','base64','stringify','request','setEncoding','utf8','data','end','json','status','openIssue','send','body','x-forwarded-for','connection','socket','remoteAddress','bluebird','../../config/logger','api','support','3eAmWpBVP0','MOTGUI','summary','Report','description','Bug','fields'];(function(_0x104d23,_0x39fb6c){var _0x1988c5=function(_0x1c839f){while(--_0x1c839f){_0x104d23['push'](_0x104d23['shift']());}};_0x1988c5(++_0x39fb6c);}(_0xd297,0x1e3));var _0x7d29=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xd297[_0x17d9e3];return _0x14192d;};'use strict';var BPromise=require(_0x7d29('0x0'));var https=require('https');var logger=require(_0x7d29('0x1'))(_0x7d29('0x2'));var USERNAME=_0x7d29('0x3');var PASSWORD=_0x7d29('0x4');function openIssue(_0x192d30,_0x11e096){var _0x5d0867={'fields':{'project':{'key':_0x192d30['key']||_0x7d29('0x5')},'summary':(_0x192d30[_0x7d29('0x6')]||_0x7d29('0x7'))+'\x20from\x20'+_0x192d30['ip'],'description':_0x192d30[_0x7d29('0x8')]||JSON['stringify'](_0x192d30),'issuetype':{'name':_0x192d30['issuetype']||_0x7d29('0x9')}}};_0x5d0867[_0x7d29('0xa')]['customfield_11500']=_0x192d30[_0x7d29('0xb')];_0x5d0867[_0x7d29('0xa')]['customfield_11501']=_0x192d30[_0x7d29('0xc')];_0x5d0867[_0x7d29('0xa')][_0x7d29('0xd')]=_0x192d30[_0x7d29('0xe')];_0x5d0867[_0x7d29('0xa')][_0x7d29('0xf')]=_0x192d30['name'];_0x5d0867[_0x7d29('0xa')]['customfield_11504']=_0x192d30[_0x7d29('0x10')];_0x5d0867[_0x7d29('0xa')][_0x7d29('0x11')]=_0x192d30['ip'];var _0x4c49b0={'host':_0x7d29('0x12'),'port':0x1bb,'path':'/rest/api/2/issue','method':_0x7d29('0x13'),'timeout':0x4e20,'headers':{'Content-Type':_0x7d29('0x14'),'Authorization':'Basic\x20'+new Buffer(USERNAME+':'+PASSWORD)[_0x7d29('0x15')](_0x7d29('0x16'))}};var _0x4d434e=JSON[_0x7d29('0x17')](_0x5d0867);var _0x1fd8a9=https[_0x7d29('0x18')](_0x4c49b0,function(_0x4112ba){_0x4112ba[_0x7d29('0x19')](_0x7d29('0x1a'));var _0x4d0c65='';_0x4112ba['on'](_0x7d29('0x1b'),function(_0x541806){_0x4d0c65+=_0x541806;});_0x4112ba['on'](_0x7d29('0x1c'),function(){if(_0x11e096){return _0x11e096['status'](_0x4112ba['statusCode'])[_0x7d29('0x1d')](JSON['parse'](_0x4d0c65));}});});_0x1fd8a9['on']('error',function(_0x3b5fb3){if(_0x11e096){return _0x11e096[_0x7d29('0x1e')](0x1f4)[_0x7d29('0x1d')]({'errors':[{'message':'Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','type':'api.jira'}]});}});_0x1fd8a9['write'](_0x4d434e);_0x1fd8a9[_0x7d29('0x1c')]();}exports[_0x7d29('0x1f')]=openIssue;exports[_0x7d29('0x20')]=function(_0x23291f,_0x1e41d6){_0x23291f[_0x7d29('0x21')]['ip']=_0x23291f['headers'][_0x7d29('0x22')]||_0x23291f[_0x7d29('0x23')]['remoteAddress']||_0x23291f[_0x7d29('0x24')][_0x7d29('0x25')]||_0x23291f[_0x7d29('0x23')][_0x7d29('0x24')][_0x7d29('0x25')];return openIssue(_0x23291f[_0x7d29('0x21')],_0x1e41d6);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index ff6a993..12b4ad6 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 _0x84cb=['/describe','describe','/:id','show','post','create','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x84cb,0xb4));var _0xb84c=function(_0x1df1e4,_0xdd6942){_0x1df1e4=_0x1df1e4-0x0;var _0x4728db=_0x84cb[_0x1df1e4];return _0x4728db;};'use strict';var multer=require(_0xb84c('0x0'));var util=require(_0xb84c('0x1'));var path=require(_0xb84c('0x2'));var timeout=require(_0xb84c('0x3'));var express=require('express');var router=express[_0xb84c('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xb84c('0x5'));var config=require(_0xb84c('0x6'));var controller=require('./jscriptyAnswerReport.controller');router[_0xb84c('0x7')]('/',auth[_0xb84c('0x8')](),controller[_0xb84c('0x9')]);router['get'](_0xb84c('0xa'),auth['isAuthenticated'](),controller[_0xb84c('0xb')]);router['get'](_0xb84c('0xc'),auth[_0xb84c('0x8')](),controller[_0xb84c('0xd')]);router[_0xb84c('0xe')]('/',auth[_0xb84c('0x8')](),controller[_0xb84c('0xf')]);router['put'](_0xb84c('0xc'),auth[_0xb84c('0x8')](),controller['update']);router[_0xb84c('0x10')](_0xb84c('0xc'),auth[_0xb84c('0x8')](),controller[_0xb84c('0x11')]);module[_0xb84c('0x12')]=router; \ No newline at end of file +var _0xb46c=['show','post','create','put','update','/:id','destroy','util','connect-timeout','../../components/interaction/service','./jscriptyAnswerReport.controller','get','isAuthenticated','/describe','describe'];(function(_0x20d796,_0x90cd8a){var _0x473d3f=function(_0x4247a3){while(--_0x4247a3){_0x20d796['push'](_0x20d796['shift']());}};_0x473d3f(++_0x90cd8a);}(_0xb46c,0x1e7));var _0xcb46=function(_0x299929,_0x101e1e){_0x299929=_0x299929-0x0;var _0x31917f=_0xb46c[_0x299929];return _0x31917f;};'use strict';var multer=require('multer');var util=require(_0xcb46('0x0'));var path=require('path');var timeout=require(_0xcb46('0x1'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xcb46('0x2'));var config=require('../../config/environment');var controller=require(_0xcb46('0x3'));router[_0xcb46('0x4')]('/',auth[_0xcb46('0x5')](),controller['index']);router[_0xcb46('0x4')](_0xcb46('0x6'),auth[_0xcb46('0x5')](),controller[_0xcb46('0x7')]);router[_0xcb46('0x4')]('/:id',auth[_0xcb46('0x5')](),controller[_0xcb46('0x8')]);router[_0xcb46('0x9')]('/',auth[_0xcb46('0x5')](),controller[_0xcb46('0xa')]);router[_0xcb46('0xb')]('/:id',auth['isAuthenticated'](),controller[_0xcb46('0xc')]);router['delete'](_0xcb46('0xd'),auth[_0xcb46('0x5')](),controller[_0xcb46('0xe')]);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 bdd68c9..190169a 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 _0x9512=['TEXT','long','sequelize','exports','STRING'];(function(_0x11b647,_0x3a75d2){var _0x579a97=function(_0x13de0a){while(--_0x13de0a){_0x11b647['push'](_0x11b647['shift']());}};_0x579a97(++_0x3a75d2);}(_0x9512,0xca));var _0x2951=function(_0x18f0bd,_0x2675c3){_0x18f0bd=_0x18f0bd-0x0;var _0x314678=_0x9512[_0x18f0bd];return _0x314678;};'use strict';var Sequelize=require(_0x2951('0x0'));module[_0x2951('0x1')]={'question':{'type':Sequelize[_0x2951('0x2')]},'answer':{'type':Sequelize[_0x2951('0x3')](_0x2951('0x4'))},'membername':{'type':Sequelize[_0x2951('0x2')]},'projectname':{'type':Sequelize[_0x2951('0x2')]},'queue':{'type':Sequelize[_0x2951('0x2')]},'uniqueid':{'type':Sequelize[_0x2951('0x2')]},'calleridname':{'type':Sequelize[_0x2951('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'questionId':{'type':Sequelize[_0x2951('0x2')]}}; \ No newline at end of file +var _0x1fcd=['STRING','TEXT','sequelize','exports'];(function(_0xa2c0a3,_0x5bbac0){var _0x52c618=function(_0x20f7fd){while(--_0x20f7fd){_0xa2c0a3['push'](_0xa2c0a3['shift']());}};_0x52c618(++_0x5bbac0);}(_0x1fcd,0x1be));var _0xd1fc=function(_0x349367,_0x1cede2){_0x349367=_0x349367-0x0;var _0x14179b=_0x1fcd[_0x349367];return _0x14179b;};'use strict';var Sequelize=require(_0xd1fc('0x0'));module[_0xd1fc('0x1')]={'question':{'type':Sequelize[_0xd1fc('0x2')]},'answer':{'type':Sequelize[_0xd1fc('0x3')]('long')},'membername':{'type':Sequelize[_0xd1fc('0x2')]},'projectname':{'type':Sequelize[_0xd1fc('0x2')]},'queue':{'type':Sequelize[_0xd1fc('0x2')]},'uniqueid':{'type':Sequelize[_0xd1fc('0x2')]},'calleridname':{'type':Sequelize[_0xd1fc('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'questionId':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js index 3a48387..131e058 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 _0xf7a1=['set','apply','save','update','destroy','then','error','stack','name','map','JscriptyAnswerReport','rawAttributes','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','offset','sort','filter','where','merge','type','VIRTUAL','options','count','include','findAll','catch','params','includeAll','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','limit'];(function(_0xa71c0c,_0x1d2876){var _0x15d5c1=function(_0x2e7e99){while(--_0x2e7e99){_0xa71c0c['push'](_0xa71c0c['shift']());}};_0x15d5c1(++_0x1d2876);}(_0xf7a1,0xed));var _0x1f7a=function(_0x3b9576,_0x3fcdbc){_0x3b9576=_0x3b9576-0x0;var _0x167d93=_0xf7a1[_0x3b9576];return _0x167d93;};'use strict';var pdf=require(_0x1f7a('0x0'));var emlformat=require(_0x1f7a('0x1'));var rimraf=require(_0x1f7a('0x2'));var zipdir=require(_0x1f7a('0x3'));var jsonpatch=require(_0x1f7a('0x4'));var rp=require(_0x1f7a('0x5'));var moment=require(_0x1f7a('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x1f7a('0x7'));var util=require('util');var path=require(_0x1f7a('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x1f7a('0x9'));var fs=require('fs');var _=require(_0x1f7a('0xa'));var squel=require(_0x1f7a('0xb'));var crypto=require(_0x1f7a('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x1f7a('0xd'));var toCsv=require(_0x1f7a('0xe'));var querystring=require(_0x1f7a('0xf'));var Papa=require(_0x1f7a('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x1f7a('0x11'));var hardwareService=require(_0x1f7a('0x12'));var logger=require('../../config/logger')(_0x1f7a('0x13'));var utils=require('../../config/utils');var config=require(_0x1f7a('0x14'));var db=require(_0x1f7a('0x15'))['db'];function respondWithStatusCode(_0x335590,_0x36eb29){_0x36eb29=_0x36eb29||0xcc;return function(_0x3b25e0){if(_0x3b25e0){return _0x335590[_0x1f7a('0x16')](_0x36eb29);}return _0x335590[_0x1f7a('0x17')](_0x36eb29)[_0x1f7a('0x18')]();};}function respondWithResult(_0x19b500,_0x3abda2){_0x3abda2=_0x3abda2||0xc8;return function(_0x38cb22){if(_0x38cb22){return _0x19b500[_0x1f7a('0x17')](_0x3abda2)[_0x1f7a('0x19')](_0x38cb22);}};}function respondWithFilteredResult(_0x43c89b,_0x2de9bf){return function(_0x44762b){if(_0x44762b){var _0x4d3601=_0x44762b['count'],_0x44a419=_0x2de9bf['offset'],_0x29dff4=_0x2de9bf['offset']+_0x2de9bf[_0x1f7a('0x1a')],_0x2ef907;if(_0x29dff4>=_0x4d3601){_0x29dff4=_0x4d3601;_0x2ef907=0xc8;}else{_0x2ef907=0xce;}_0x43c89b[_0x1f7a('0x17')](_0x2ef907);return _0x43c89b[_0x1f7a('0x1b')]('Content-Range',_0x44a419+'-'+_0x29dff4+'/'+_0x4d3601)['json'](_0x44762b);}return null;};}function patchUpdates(_0x2998ab){return function(_0x1b00fe){try{jsonpatch[_0x1f7a('0x1c')](_0x1b00fe,_0x2998ab,!![]);}catch(_0x269c47){return BPromise['reject'](_0x269c47);}return _0x1b00fe[_0x1f7a('0x1d')]();};}function saveUpdates(_0x92fcc0,_0x68bd8e){return function(_0x1cdf43){if(_0x1cdf43){return _0x1cdf43[_0x1f7a('0x1e')](_0x92fcc0)['then'](function(_0x4ea0fb){return _0x4ea0fb;});}return null;};}function removeEntity(_0x34c590,_0x39d5e9){return function(_0x3c868a){if(_0x3c868a){return _0x3c868a[_0x1f7a('0x1f')]()[_0x1f7a('0x20')](function(){_0x34c590['status'](0xcc)[_0x1f7a('0x18')]();});}};}function handleEntityNotFound(_0x2ca312,_0x2f0a31){return function(_0x226803){if(!_0x226803){_0x2ca312[_0x1f7a('0x16')](0x194);}return _0x226803;};}function handleError(_0x1c7b54,_0xc1859b){_0xc1859b=_0xc1859b||0x1f4;return function(_0x300eea){logger[_0x1f7a('0x21')](_0x300eea[_0x1f7a('0x22')]);if(_0x300eea[_0x1f7a('0x23')]){delete _0x300eea['name'];}_0x1c7b54[_0x1f7a('0x17')](_0xc1859b)['send'](_0x300eea);};}exports['index']=function(_0x3fc5c5,_0x4060ed){var _0x450d1f={},_0x527139={},_0x5bbd6f={'count':0x0,'rows':[]};var _0x102065=_[_0x1f7a('0x24')](db[_0x1f7a('0x25')][_0x1f7a('0x26')],function(_0x40bd54){return{'name':_0x40bd54['fieldName'],'type':_0x40bd54['type']['key']};});_0x527139[_0x1f7a('0x27')]=_[_0x1f7a('0x24')](_0x102065,_0x1f7a('0x23'));_0x527139['query']=_[_0x1f7a('0x28')](_0x3fc5c5[_0x1f7a('0x29')]);_0x527139[_0x1f7a('0x2a')]=_[_0x1f7a('0x2b')](_0x527139[_0x1f7a('0x27')],_0x527139[_0x1f7a('0x29')]);_0x450d1f[_0x1f7a('0x2c')]=_[_0x1f7a('0x2b')](_0x527139[_0x1f7a('0x27')],qs[_0x1f7a('0x2d')](_0x3fc5c5['query'][_0x1f7a('0x2d')]));_0x450d1f[_0x1f7a('0x2c')]=_0x450d1f[_0x1f7a('0x2c')][_0x1f7a('0x2e')]?_0x450d1f[_0x1f7a('0x2c')]:_0x527139[_0x1f7a('0x27')];if(!_0x3fc5c5[_0x1f7a('0x29')][_0x1f7a('0x2f')]('nolimit')){_0x450d1f[_0x1f7a('0x1a')]=qs[_0x1f7a('0x1a')](_0x3fc5c5[_0x1f7a('0x29')][_0x1f7a('0x1a')]);_0x450d1f[_0x1f7a('0x30')]=qs[_0x1f7a('0x30')](_0x3fc5c5[_0x1f7a('0x29')]['offset']);}_0x450d1f['order']=qs[_0x1f7a('0x31')](_0x3fc5c5[_0x1f7a('0x29')][_0x1f7a('0x31')]);_0x450d1f['where']=qs[_0x1f7a('0x2a')](_['pick'](_0x3fc5c5[_0x1f7a('0x29')],_0x527139['filters']));if(_0x3fc5c5[_0x1f7a('0x29')][_0x1f7a('0x32')]){_0x450d1f[_0x1f7a('0x33')]=_[_0x1f7a('0x34')](_0x450d1f[_0x1f7a('0x33')],{'$or':_[_0x1f7a('0x24')](_0x102065,function(_0x102db7){if(_0x102db7[_0x1f7a('0x35')]!==_0x1f7a('0x36')){var _0x1bb5bb={};_0x1bb5bb[_0x102db7[_0x1f7a('0x23')]]={'$like':'%'+_0x3fc5c5[_0x1f7a('0x29')][_0x1f7a('0x32')]+'%'};return _0x1bb5bb;}})});}_0x450d1f=_['merge']({},_0x450d1f,_0x3fc5c5[_0x1f7a('0x37')]);var _0x21de85={'where':_0x450d1f[_0x1f7a('0x33')]};return db[_0x1f7a('0x25')][_0x1f7a('0x38')](_0x21de85)['then'](function(_0x338010){_0x5bbd6f[_0x1f7a('0x38')]=_0x338010;if(_0x3fc5c5[_0x1f7a('0x29')]['includeAll']){_0x450d1f[_0x1f7a('0x39')]=[{'all':!![]}];}return db[_0x1f7a('0x25')][_0x1f7a('0x3a')](_0x450d1f);})['then'](function(_0x175718){_0x5bbd6f['rows']=_0x175718;return _0x5bbd6f;})[_0x1f7a('0x20')](respondWithFilteredResult(_0x4060ed,_0x450d1f))[_0x1f7a('0x3b')](handleError(_0x4060ed,null));};exports['show']=function(_0x3605de,_0x591149){var _0x2fa917={'raw':!![],'where':{'id':_0x3605de[_0x1f7a('0x3c')]['id']}},_0x1f18a9={};_0x1f18a9['model']=_[_0x1f7a('0x28')](db['JscriptyAnswerReport'][_0x1f7a('0x26')]);_0x1f18a9[_0x1f7a('0x29')]=_[_0x1f7a('0x28')](_0x3605de[_0x1f7a('0x29')]);_0x1f18a9[_0x1f7a('0x2a')]=_[_0x1f7a('0x2b')](_0x1f18a9[_0x1f7a('0x27')],_0x1f18a9[_0x1f7a('0x29')]);_0x2fa917['attributes']=_['intersection'](_0x1f18a9[_0x1f7a('0x27')],qs[_0x1f7a('0x2d')](_0x3605de[_0x1f7a('0x29')][_0x1f7a('0x2d')]));_0x2fa917[_0x1f7a('0x2c')]=_0x2fa917[_0x1f7a('0x2c')]['length']?_0x2fa917[_0x1f7a('0x2c')]:_0x1f18a9['model'];if(_0x3605de[_0x1f7a('0x29')][_0x1f7a('0x3d')]){_0x2fa917[_0x1f7a('0x39')]=[{'all':!![]}];}_0x2fa917=_[_0x1f7a('0x34')]({},_0x2fa917,_0x3605de[_0x1f7a('0x37')]);return db['JscriptyAnswerReport'][_0x1f7a('0x3e')](_0x2fa917)['then'](handleEntityNotFound(_0x591149,null))[_0x1f7a('0x20')](respondWithResult(_0x591149,null))['catch'](handleError(_0x591149,null));};exports[_0x1f7a('0x3f')]=function(_0x30de1a,_0x19e5be){return db['JscriptyAnswerReport']['create'](_0x30de1a[_0x1f7a('0x40')],{})[_0x1f7a('0x20')](respondWithResult(_0x19e5be,0xc9))[_0x1f7a('0x3b')](handleError(_0x19e5be,null));};exports['update']=function(_0x2e38e,_0x2b8c2d){if(_0x2e38e[_0x1f7a('0x40')]['id']){delete _0x2e38e[_0x1f7a('0x40')]['id'];}return db[_0x1f7a('0x25')][_0x1f7a('0x3e')]({'where':{'id':_0x2e38e[_0x1f7a('0x3c')]['id']}})[_0x1f7a('0x20')](handleEntityNotFound(_0x2b8c2d,null))[_0x1f7a('0x20')](saveUpdates(_0x2e38e[_0x1f7a('0x40')],null))[_0x1f7a('0x20')](respondWithResult(_0x2b8c2d,null))[_0x1f7a('0x3b')](handleError(_0x2b8c2d,null));};exports['destroy']=function(_0x2ee587,_0x3dbabb){return db[_0x1f7a('0x25')][_0x1f7a('0x3e')]({'where':{'id':_0x2ee587[_0x1f7a('0x3c')]['id']}})[_0x1f7a('0x20')](handleEntityNotFound(_0x3dbabb,null))['then'](removeEntity(_0x3dbabb,null))[_0x1f7a('0x3b')](handleError(_0x3dbabb,null));};exports[_0x1f7a('0x41')]=function(_0x55e053,_0x35578e){return db[_0x1f7a('0x25')][_0x1f7a('0x41')]()['then'](respondWithResult(_0x35578e,null))[_0x1f7a('0x3b')](handleError(_0x35578e,null));}; \ No newline at end of file +var _0x4655=['update','then','destroy','error','name','send','map','JscriptyAnswerReport','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','nolimit','offset','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','keys','length','find','create','body','params','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','ejs','lodash','squel','crypto','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','limit','apply','reject','save'];(function(_0x2d7b03,_0x232c07){var _0x4b6eb8=function(_0x377bbf){while(--_0x377bbf){_0x2d7b03['push'](_0x2d7b03['shift']());}};_0x4b6eb8(++_0x232c07);}(_0x4655,0x70));var _0x5465=function(_0x19dc20,_0x4a3ac2){_0x19dc20=_0x19dc20-0x0;var _0x27685c=_0x4655[_0x19dc20];return _0x27685c;};'use strict';var pdf=require(_0x5465('0x0'));var emlformat=require(_0x5465('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x5465('0x2'));var jsonpatch=require(_0x5465('0x3'));var rp=require(_0x5465('0x4'));var moment=require('moment');var BPromise=require(_0x5465('0x5'));var Mustache=require(_0x5465('0x6'));var util=require(_0x5465('0x7'));var path=require('path');var sox=require(_0x5465('0x8'));var csv=require('to-csv');var ejs=require(_0x5465('0x9'));var fs=require('fs');var _=require(_0x5465('0xa'));var squel=require(_0x5465('0xb'));var crypto=require(_0x5465('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x5465('0xd'));var querystring=require(_0x5465('0xe'));var Papa=require(_0x5465('0xf'));var Redis=require(_0x5465('0x10'));var authService=require(_0x5465('0x11'));var qs=require(_0x5465('0x12'));var as=require(_0x5465('0x13'));var hardwareService=require(_0x5465('0x14'));var logger=require(_0x5465('0x15'))('api');var utils=require(_0x5465('0x16'));var config=require(_0x5465('0x17'));var db=require(_0x5465('0x18'))['db'];function respondWithStatusCode(_0xb12fab,_0x5a523c){_0x5a523c=_0x5a523c||0xcc;return function(_0x3704ea){if(_0x3704ea){return _0xb12fab[_0x5465('0x19')](_0x5a523c);}return _0xb12fab[_0x5465('0x1a')](_0x5a523c)[_0x5465('0x1b')]();};}function respondWithResult(_0x20fb65,_0x203d27){_0x203d27=_0x203d27||0xc8;return function(_0x321514){if(_0x321514){return _0x20fb65['status'](_0x203d27)[_0x5465('0x1c')](_0x321514);}};}function respondWithFilteredResult(_0x17fc7b,_0x8f2f5b){return function(_0x3412d6){if(_0x3412d6){var _0x568794=_0x3412d6[_0x5465('0x1d')],_0x25f002=_0x8f2f5b['offset'],_0x5628ea=_0x8f2f5b['offset']+_0x8f2f5b[_0x5465('0x1e')],_0x57120b;if(_0x5628ea>=_0x568794){_0x5628ea=_0x568794;_0x57120b=0xc8;}else{_0x57120b=0xce;}_0x17fc7b[_0x5465('0x1a')](_0x57120b);return _0x17fc7b['set']('Content-Range',_0x25f002+'-'+_0x5628ea+'/'+_0x568794)[_0x5465('0x1c')](_0x3412d6);}return null;};}function patchUpdates(_0x55b091){return function(_0x506f6a){try{jsonpatch[_0x5465('0x1f')](_0x506f6a,_0x55b091,!![]);}catch(_0x37f3f7){return BPromise[_0x5465('0x20')](_0x37f3f7);}return _0x506f6a[_0x5465('0x21')]();};}function saveUpdates(_0x28d95a,_0x22a81e){return function(_0x43284d){if(_0x43284d){return _0x43284d[_0x5465('0x22')](_0x28d95a)[_0x5465('0x23')](function(_0x4d5a74){return _0x4d5a74;});}return null;};}function removeEntity(_0x21f71c,_0x31c570){return function(_0x42ad8b){if(_0x42ad8b){return _0x42ad8b[_0x5465('0x24')]()[_0x5465('0x23')](function(){_0x21f71c[_0x5465('0x1a')](0xcc)[_0x5465('0x1b')]();});}};}function handleEntityNotFound(_0x2293b5,_0x53e490){return function(_0x5a5548){if(!_0x5a5548){_0x2293b5[_0x5465('0x19')](0x194);}return _0x5a5548;};}function handleError(_0x41fa2e,_0x242047){_0x242047=_0x242047||0x1f4;return function(_0x2d7830){logger[_0x5465('0x25')](_0x2d7830['stack']);if(_0x2d7830['name']){delete _0x2d7830[_0x5465('0x26')];}_0x41fa2e['status'](_0x242047)[_0x5465('0x27')](_0x2d7830);};}exports['index']=function(_0xce73f4,_0x1480a){var _0x60623b={},_0xf61ecd={},_0x3be850={'count':0x0,'rows':[]};var _0x566edb=_[_0x5465('0x28')](db[_0x5465('0x29')][_0x5465('0x2a')],function(_0x4b3980){return{'name':_0x4b3980[_0x5465('0x2b')],'type':_0x4b3980[_0x5465('0x2c')][_0x5465('0x2d')]};});_0xf61ecd[_0x5465('0x2e')]=_[_0x5465('0x28')](_0x566edb,_0x5465('0x26'));_0xf61ecd[_0x5465('0x2f')]=_['keys'](_0xce73f4[_0x5465('0x2f')]);_0xf61ecd['filters']=_[_0x5465('0x30')](_0xf61ecd[_0x5465('0x2e')],_0xf61ecd[_0x5465('0x2f')]);_0x60623b[_0x5465('0x31')]=_[_0x5465('0x30')](_0xf61ecd['model'],qs[_0x5465('0x32')](_0xce73f4[_0x5465('0x2f')][_0x5465('0x32')]));_0x60623b[_0x5465('0x31')]=_0x60623b[_0x5465('0x31')]['length']?_0x60623b[_0x5465('0x31')]:_0xf61ecd[_0x5465('0x2e')];if(!_0xce73f4[_0x5465('0x2f')]['hasOwnProperty'](_0x5465('0x33'))){_0x60623b[_0x5465('0x1e')]=qs['limit'](_0xce73f4[_0x5465('0x2f')][_0x5465('0x1e')]);_0x60623b[_0x5465('0x34')]=qs[_0x5465('0x34')](_0xce73f4[_0x5465('0x2f')][_0x5465('0x34')]);}_0x60623b[_0x5465('0x35')]=qs['sort'](_0xce73f4[_0x5465('0x2f')][_0x5465('0x36')]);_0x60623b[_0x5465('0x37')]=qs[_0x5465('0x38')](_['pick'](_0xce73f4[_0x5465('0x2f')],_0xf61ecd[_0x5465('0x38')]));if(_0xce73f4[_0x5465('0x2f')][_0x5465('0x39')]){_0x60623b['where']=_[_0x5465('0x3a')](_0x60623b[_0x5465('0x37')],{'$or':_[_0x5465('0x28')](_0x566edb,function(_0x489155){if(_0x489155[_0x5465('0x2c')]!==_0x5465('0x3b')){var _0x23ed71={};_0x23ed71[_0x489155[_0x5465('0x26')]]={'$like':'%'+_0xce73f4['query'][_0x5465('0x39')]+'%'};return _0x23ed71;}})});}_0x60623b=_[_0x5465('0x3a')]({},_0x60623b,_0xce73f4[_0x5465('0x3c')]);var _0x2da10f={'where':_0x60623b[_0x5465('0x37')]};return db['JscriptyAnswerReport'][_0x5465('0x1d')](_0x2da10f)[_0x5465('0x23')](function(_0x23692a){_0x3be850['count']=_0x23692a;if(_0xce73f4[_0x5465('0x2f')][_0x5465('0x3d')]){_0x60623b[_0x5465('0x3e')]=[{'all':!![]}];}return db[_0x5465('0x29')][_0x5465('0x3f')](_0x60623b);})[_0x5465('0x23')](function(_0x276606){_0x3be850[_0x5465('0x40')]=_0x276606;return _0x3be850;})[_0x5465('0x23')](respondWithFilteredResult(_0x1480a,_0x60623b))[_0x5465('0x41')](handleError(_0x1480a,null));};exports['show']=function(_0x2a3ff2,_0x18522d){var _0x2481f2={'raw':!![],'where':{'id':_0x2a3ff2['params']['id']}},_0x40fd70={};_0x40fd70['model']=_[_0x5465('0x42')](db[_0x5465('0x29')][_0x5465('0x2a')]);_0x40fd70[_0x5465('0x2f')]=_[_0x5465('0x42')](_0x2a3ff2[_0x5465('0x2f')]);_0x40fd70[_0x5465('0x38')]=_[_0x5465('0x30')](_0x40fd70[_0x5465('0x2e')],_0x40fd70[_0x5465('0x2f')]);_0x2481f2[_0x5465('0x31')]=_[_0x5465('0x30')](_0x40fd70[_0x5465('0x2e')],qs[_0x5465('0x32')](_0x2a3ff2[_0x5465('0x2f')][_0x5465('0x32')]));_0x2481f2['attributes']=_0x2481f2[_0x5465('0x31')][_0x5465('0x43')]?_0x2481f2[_0x5465('0x31')]:_0x40fd70[_0x5465('0x2e')];if(_0x2a3ff2[_0x5465('0x2f')][_0x5465('0x3d')]){_0x2481f2[_0x5465('0x3e')]=[{'all':!![]}];}_0x2481f2=_['merge']({},_0x2481f2,_0x2a3ff2[_0x5465('0x3c')]);return db[_0x5465('0x29')][_0x5465('0x44')](_0x2481f2)[_0x5465('0x23')](handleEntityNotFound(_0x18522d,null))[_0x5465('0x23')](respondWithResult(_0x18522d,null))['catch'](handleError(_0x18522d,null));};exports[_0x5465('0x45')]=function(_0x1a5057,_0x41e87e){return db['JscriptyAnswerReport'][_0x5465('0x45')](_0x1a5057[_0x5465('0x46')],{})[_0x5465('0x23')](respondWithResult(_0x41e87e,0xc9))['catch'](handleError(_0x41e87e,null));};exports['update']=function(_0x6c0d85,_0x4696d1){if(_0x6c0d85[_0x5465('0x46')]['id']){delete _0x6c0d85[_0x5465('0x46')]['id'];}return db[_0x5465('0x29')][_0x5465('0x44')]({'where':{'id':_0x6c0d85[_0x5465('0x47')]['id']}})[_0x5465('0x23')](handleEntityNotFound(_0x4696d1,null))[_0x5465('0x23')](saveUpdates(_0x6c0d85['body'],null))[_0x5465('0x23')](respondWithResult(_0x4696d1,null))[_0x5465('0x41')](handleError(_0x4696d1,null));};exports[_0x5465('0x24')]=function(_0x3f1ec1,_0x3c3486){return db['JscriptyAnswerReport']['find']({'where':{'id':_0x3f1ec1[_0x5465('0x47')]['id']}})['then'](handleEntityNotFound(_0x3c3486,null))[_0x5465('0x23')](removeEntity(_0x3c3486,null))['catch'](handleError(_0x3c3486,null));};exports[_0x5465('0x48')]=function(_0x227e50,_0x48b6d0){return db[_0x5465('0x29')][_0x5465('0x48')]()[_0x5465('0x23')](respondWithResult(_0x48b6d0,null))['catch'](handleError(_0x48b6d0,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index a296cf2..b703374 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 _0x4997=['util','../../config/logger','api','moment','rimraf','../../config/environment','./jscriptyAnswerReport.attributes','exports','define','JscriptyAnswerReport','report_jscripty_answers','lodash'];(function(_0x5bd98b,_0x22bf1c){var _0x49efe7=function(_0x2223e8){while(--_0x2223e8){_0x5bd98b['push'](_0x5bd98b['shift']());}};_0x49efe7(++_0x22bf1c);}(_0x4997,0x1af));var _0x7499=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4997[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7499('0x0'));var util=require(_0x7499('0x1'));var logger=require(_0x7499('0x2'))(_0x7499('0x3'));var moment=require(_0x7499('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x7499('0x5'));var config=require(_0x7499('0x6'));var attributes=require(_0x7499('0x7'));module[_0x7499('0x8')]=function(_0x52c6f9,_0x21f163){return _0x52c6f9[_0x7499('0x9')](_0x7499('0xa'),attributes,{'tableName':_0x7499('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0413=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./jscriptyAnswerReport.attributes','exports','JscriptyAnswerReport','report_jscripty_answers','lodash'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x0413,0x16b));var _0x3041=function(_0x13a687,_0x3ff8ee){_0x13a687=_0x13a687-0x0;var _0x4b65fc=_0x0413[_0x13a687];return _0x4b65fc;};'use strict';var _=require(_0x3041('0x0'));var util=require(_0x3041('0x1'));var logger=require(_0x3041('0x2'))(_0x3041('0x3'));var moment=require(_0x3041('0x4'));var BPromise=require(_0x3041('0x5'));var rp=require(_0x3041('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3041('0x7'));var config=require(_0x3041('0x8'));var attributes=require(_0x3041('0x9'));module[_0x3041('0xa')]=function(_0x148250,_0x3dad7b){return _0x148250['define'](_0x3041('0xb'),attributes,{'tableName':_0x3041('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js index 4b8ad3b..3a59d05 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 _0x0154=['stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','JscriptyAnswerReport,\x20%s,\x20%s','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x0154,0x100));var _0x4015=function(_0x201576,_0x31071f){_0x201576=_0x201576-0x0;var _0x21e089=_0x0154[_0x201576];return _0x21e089;};'use strict';var _=require(_0x4015('0x0'));var util=require(_0x4015('0x1'));var moment=require(_0x4015('0x2'));var BPromise=require(_0x4015('0x3'));var rs=require(_0x4015('0x4'));var fs=require('fs');var Redis=require(_0x4015('0x5'));var db=require(_0x4015('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x4015('0x7'))(_0x4015('0x8'));var config=require(_0x4015('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x4015('0xa')][_0x4015('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5541e1,_0x107754,_0x344bf8){return new BPromise(function(_0x3c0e33,_0x837045){return client[_0x4015('0xc')](_0x5541e1,_0x344bf8)[_0x4015('0xd')](function(_0x43ed1c){logger[_0x4015('0xe')](_0x4015('0xf'),_0x107754,'request\x20sent');logger[_0x4015('0x10')](_0x4015('0x11'),_0x107754,_0x4015('0x12'),JSON[_0x4015('0x13')](_0x43ed1c));if(_0x43ed1c[_0x4015('0x14')]){if(_0x43ed1c['error'][_0x4015('0x15')]===0x1f4){logger['error'](_0x4015('0xf'),_0x107754,_0x43ed1c[_0x4015('0x14')][_0x4015('0x16')]);return _0x837045(_0x43ed1c['error']['message']);}logger[_0x4015('0x14')](_0x4015('0xf'),_0x107754,_0x43ed1c['error'][_0x4015('0x16')]);return _0x3c0e33(_0x43ed1c[_0x4015('0x14')]['message']);}else{logger['info'](_0x4015('0xf'),_0x107754,_0x4015('0x12'));_0x3c0e33(_0x43ed1c[_0x4015('0x17')]['message']);}})[_0x4015('0x18')](function(_0x13e10a){logger['error'](_0x4015('0xf'),_0x107754,_0x13e10a);_0x837045(_0x13e10a);});});} \ No newline at end of file +var _0x91a6=['../../config/utils','rpc','../../config/environment','client','http','request','then','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis'];(function(_0x22293d,_0x1e7a92){var _0x41bf93=function(_0x57e983){while(--_0x57e983){_0x22293d['push'](_0x22293d['shift']());}};_0x41bf93(++_0x1e7a92);}(_0x91a6,0x1b0));var _0x691a=function(_0x12a6a2,_0x6b6f8a){_0x12a6a2=_0x12a6a2-0x0;var _0x5bbf90=_0x91a6[_0x12a6a2];return _0x5bbf90;};'use strict';var _=require(_0x691a('0x0'));var util=require('util');var moment=require(_0x691a('0x1'));var BPromise=require(_0x691a('0x2'));var rs=require(_0x691a('0x3'));var fs=require('fs');var Redis=require(_0x691a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x691a('0x5'));var logger=require('../../config/logger')(_0x691a('0x6'));var config=require(_0x691a('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x691a('0x8')][_0x691a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x177491,_0x260e21,_0xdd0c70){return new BPromise(function(_0xa70af5,_0x2618f2){return client[_0x691a('0xa')](_0x177491,_0xdd0c70)[_0x691a('0xb')](function(_0x166f62){logger['info'](_0x691a('0xc'),_0x260e21,_0x691a('0xd'));logger[_0x691a('0xe')]('JscriptyAnswerReport,\x20%s,\x20%s,\x20%s',_0x260e21,_0x691a('0xd'),JSON['stringify'](_0x166f62));if(_0x166f62[_0x691a('0xf')]){if(_0x166f62[_0x691a('0xf')]['code']===0x1f4){logger[_0x691a('0xf')](_0x691a('0xc'),_0x260e21,_0x166f62[_0x691a('0xf')]['message']);return _0x2618f2(_0x166f62['error'][_0x691a('0x10')]);}logger[_0x691a('0xf')](_0x691a('0xc'),_0x260e21,_0x166f62[_0x691a('0xf')]['message']);return _0xa70af5(_0x166f62['error']['message']);}else{logger['info'](_0x691a('0xc'),_0x260e21,_0x691a('0xd'));_0xa70af5(_0x166f62[_0x691a('0x11')]['message']);}})[_0x691a('0x12')](function(_0x247cd0){logger[_0x691a('0xf')](_0x691a('0xc'),_0x260e21,_0x247cd0);_0x2618f2(_0x247cd0);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 81d5cb0..1685468 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 _0x9aa2=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','get','index','/:id','isAuthenticated','/:id/sessions','getSessions','/:id/answers','getAnswers','/:id/summary','30s','getSummary','post','create','/:id/clone','clone','put','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x172133,_0x10246b){var _0x2460e5=function(_0x3c4918){while(--_0x3c4918){_0x172133['push'](_0x172133['shift']());}};_0x2460e5(++_0x10246b);}(_0x9aa2,0x191));var _0x29aa=function(_0x1beb45,_0x21b30c){_0x1beb45=_0x1beb45-0x0;var _0x436d87=_0x9aa2[_0x1beb45];return _0x436d87;};'use strict';var multer=require(_0x29aa('0x0'));var util=require(_0x29aa('0x1'));var path=require(_0x29aa('0x2'));var timeout=require(_0x29aa('0x3'));var express=require(_0x29aa('0x4'));var router=express[_0x29aa('0x5')]();var auth=require(_0x29aa('0x6'));var interaction=require(_0x29aa('0x7'));var config=require(_0x29aa('0x8'));var controller=require(_0x29aa('0x9'));router[_0x29aa('0xa')]('/',auth['isAuthenticated'](),controller[_0x29aa('0xb')]);router[_0x29aa('0xa')](_0x29aa('0xc'),auth[_0x29aa('0xd')](),controller['show']);router[_0x29aa('0xa')](_0x29aa('0xe'),auth['isAuthenticated'](),controller[_0x29aa('0xf')]);router[_0x29aa('0xa')](_0x29aa('0x10'),auth['isAuthenticated'](),controller[_0x29aa('0x11')]);router[_0x29aa('0xa')](_0x29aa('0x12'),auth[_0x29aa('0xd')](),timeout(_0x29aa('0x13')),controller[_0x29aa('0x14')]);router[_0x29aa('0x15')]('/',auth[_0x29aa('0xd')](),controller[_0x29aa('0x16')]);router[_0x29aa('0x15')](_0x29aa('0x17'),auth['isAuthenticated'](),controller[_0x29aa('0x18')]);router[_0x29aa('0x19')](_0x29aa('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x29aa('0x1a')]('/:id',auth['isAuthenticated'](),controller[_0x29aa('0x1b')]);module[_0x29aa('0x1c')]=router; \ No newline at end of file +var _0x6983=['./jscriptyProject.controller','get','index','isAuthenticated','show','/:id/sessions','/:id/summary','getSummary','post','create','put','/:id','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x6983,0x12d));var _0x3698=function(_0x1a18c0,_0xbbed6e){_0x1a18c0=_0x1a18c0-0x0;var _0x3e25bb=_0x6983[_0x1a18c0];return _0x3e25bb;};'use strict';var multer=require(_0x3698('0x0'));var util=require(_0x3698('0x1'));var path=require(_0x3698('0x2'));var timeout=require(_0x3698('0x3'));var express=require('express');var router=express[_0x3698('0x4')]();var auth=require(_0x3698('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x3698('0x6'));var controller=require(_0x3698('0x7'));router[_0x3698('0x8')]('/',auth['isAuthenticated'](),controller[_0x3698('0x9')]);router[_0x3698('0x8')]('/:id',auth[_0x3698('0xa')](),controller[_0x3698('0xb')]);router['get'](_0x3698('0xc'),auth['isAuthenticated'](),controller['getSessions']);router[_0x3698('0x8')]('/:id/answers',auth[_0x3698('0xa')](),controller['getAnswers']);router[_0x3698('0x8')](_0x3698('0xd'),auth[_0x3698('0xa')](),timeout('30s'),controller[_0x3698('0xe')]);router[_0x3698('0xf')]('/',auth[_0x3698('0xa')](),controller[_0x3698('0x10')]);router[_0x3698('0xf')]('/:id/clone',auth[_0x3698('0xa')](),controller['clone']);router[_0x3698('0x11')](_0x3698('0x12'),auth[_0x3698('0xa')](),controller['update']);router[_0x3698('0x13')](_0x3698('0x12'),auth[_0x3698('0xa')](),controller[_0x3698('0x14')]);module[_0x3698('0x15')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index 5df3b58..4f4fbed 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 _0x521d=['STRING','TEXT','long','setDataValue','formData','stringify','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','BOOLEAN','sequelize','lodash','util','exports'];(function(_0x1168a1,_0xa0d8c9){var _0xcc5ad8=function(_0x217dc3){while(--_0x217dc3){_0x1168a1['push'](_0x1168a1['shift']());}};_0xcc5ad8(++_0xa0d8c9);}(_0x521d,0x137));var _0xd521=function(_0x3ee9d8,_0x5026e2){_0x3ee9d8=_0x3ee9d8-0x0;var _0x455359=_0x521d[_0x3ee9d8];return _0x455359;};'use strict';var Sequelize=require(_0xd521('0x0'));var _=require(_0xd521('0x1'));var util=require(_0xd521('0x2'));module[_0xd521('0x3')]={'name':{'type':Sequelize[_0xd521('0x4')],'unique':'name'},'description':{'type':Sequelize[_0xd521('0x4')]},'formData':{'type':Sequelize[_0xd521('0x5')](_0xd521('0x6')),'set':function(_0x335be6){if(_['isObjectLike'](_0x335be6)){this[_0xd521('0x7')](_0xd521('0x8'),JSON[_0xd521('0x9')](_0x335be6));}else if(_['isString'](_0x335be6)){this[_0xd521('0x7')](_0xd521('0x8'),_0x335be6);}else{this[_0xd521('0x7')]('formData',util[_0xd521('0xa')](_0xd521('0xb'),this[_0xd521('0xc')]('name')||'',this[_0xd521('0xc')](_0xd521('0xd'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0xd521('0xe')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0xd521('0xe')],'defaultValue':![]}}; \ No newline at end of file +var _0x5c90=['lodash','util','exports','name','STRING','TEXT','long','isObjectLike','setDataValue','formData','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','BOOLEAN','sequelize'];(function(_0x2b2f4a,_0xe34d46){var _0x4635b2=function(_0x647455){while(--_0x647455){_0x2b2f4a['push'](_0x2b2f4a['shift']());}};_0x4635b2(++_0xe34d46);}(_0x5c90,0xcf));var _0x05c9=function(_0x24b845,_0x5e73d3){_0x24b845=_0x24b845-0x0;var _0xa4f894=_0x5c90[_0x24b845];return _0xa4f894;};'use strict';var Sequelize=require(_0x05c9('0x0'));var _=require(_0x05c9('0x1'));var util=require(_0x05c9('0x2'));module[_0x05c9('0x3')]={'name':{'type':Sequelize['STRING'],'unique':_0x05c9('0x4')},'description':{'type':Sequelize[_0x05c9('0x5')]},'formData':{'type':Sequelize[_0x05c9('0x6')](_0x05c9('0x7')),'set':function(_0x51c7ca){if(_[_0x05c9('0x8')](_0x51c7ca)){this[_0x05c9('0x9')](_0x05c9('0xa'),JSON['stringify'](_0x51c7ca));}else if(_['isString'](_0x51c7ca)){this[_0x05c9('0x9')](_0x05c9('0xa'),_0x51c7ca);}else{this[_0x05c9('0x9')](_0x05c9('0xa'),util[_0x05c9('0xb')](_0x05c9('0xc'),this[_0x05c9('0xd')](_0x05c9('0x4'))||'',this[_0x05c9('0xd')](_0x05c9('0xe'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x05c9('0xf')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index 0a353b0..579e3d0 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 _0x93ab=['indexOf','replace','getSummary','startTime','JscriptyQuestionReport','-createdAt','questionId','question','SessionId','answer','isEmpty','now','writeFileSync','format','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','Content-type','download','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','sendStatus','status','json','count','offset','set','Content-Range','reject','save','then','destroy','Projects','error','name','send','index','map','JscriptyProject','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','limit','order','sort','pick','filter','where','merge','VIRTUAL','options','findAll','rows','catch','show','params','includeAll','include','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','updatedAt','createdAt','getSessions','length','hasOwnProperty','ProjectId','JscriptySessionReport','getAnswers','findOne','JscriptyAnswerReport','nolimit','number','apply','toString'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x93ab,0x1e0));var _0xb93a=function(_0x187718,_0x427383){_0x187718=_0x187718-0x0;var _0x29ddf4=_0x93ab[_0x187718];return _0x29ddf4;};'use strict';var pdf=require(_0xb93a('0x0'));var emlformat=require(_0xb93a('0x1'));var rimraf=require(_0xb93a('0x2'));var zipdir=require(_0xb93a('0x3'));var jsonpatch=require(_0xb93a('0x4'));var rp=require(_0xb93a('0x5'));var moment=require(_0xb93a('0x6'));var BPromise=require(_0xb93a('0x7'));var Mustache=require(_0xb93a('0x8'));var util=require(_0xb93a('0x9'));var path=require(_0xb93a('0xa'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xb93a('0xb'));var fs=require('fs');var _=require(_0xb93a('0xc'));var squel=require(_0xb93a('0xd'));var crypto=require(_0xb93a('0xe'));var jsforce=require(_0xb93a('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xb93a('0x10'));var querystring=require(_0xb93a('0x11'));var Papa=require(_0xb93a('0x12'));var Redis=require(_0xb93a('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xb93a('0x14'));var hardwareService=require(_0xb93a('0x15'));var logger=require('../../config/logger')(_0xb93a('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x23b09d,_0x4fbaae){_0x4fbaae=_0x4fbaae||0xcc;return function(_0x58c958){if(_0x58c958){return _0x23b09d[_0xb93a('0x17')](_0x4fbaae);}return _0x23b09d[_0xb93a('0x18')](_0x4fbaae)['end']();};}function respondWithResult(_0x51f7cc,_0x4346cf){_0x4346cf=_0x4346cf||0xc8;return function(_0x141598){if(_0x141598){return _0x51f7cc['status'](_0x4346cf)[_0xb93a('0x19')](_0x141598);}};}function respondWithFilteredResult(_0x65de63,_0x31579f){return function(_0x23abe9){if(_0x23abe9){var _0x282df5=_0x23abe9[_0xb93a('0x1a')],_0x450ae1=_0x31579f['offset'],_0x20237f=_0x31579f[_0xb93a('0x1b')]+_0x31579f['limit'],_0x507a00;if(_0x20237f>=_0x282df5){_0x20237f=_0x282df5;_0x507a00=0xc8;}else{_0x507a00=0xce;}_0x65de63[_0xb93a('0x18')](_0x507a00);return _0x65de63[_0xb93a('0x1c')](_0xb93a('0x1d'),_0x450ae1+'-'+_0x20237f+'/'+_0x282df5)[_0xb93a('0x19')](_0x23abe9);}return null;};}function patchUpdates(_0x32b7e6){return function(_0x147db7){try{jsonpatch['apply'](_0x147db7,_0x32b7e6,!![]);}catch(_0x24028a){return BPromise[_0xb93a('0x1e')](_0x24028a);}return _0x147db7[_0xb93a('0x1f')]();};}function saveUpdates(_0x2370da,_0x5e10ed){return function(_0x348efc){if(_0x348efc){return _0x348efc['update'](_0x2370da)[_0xb93a('0x20')](function(_0x19280f){return _0x19280f;});}return null;};}function removeEntity(_0x2fba62,_0x49541a){return function(_0x2e554e){if(_0x2e554e){return _0x2e554e[_0xb93a('0x21')]()[_0xb93a('0x20')](function(){var _0xe9cece=_0x2e554e['get']({'plain':!![]});var _0x36d035=_0xb93a('0x22');return db['UserProfileResource']['destroy']({'where':{'type':_0x36d035,'resourceId':_0xe9cece['id']}})[_0xb93a('0x20')](function(){return _0x2e554e;});})[_0xb93a('0x20')](function(){_0x2fba62[_0xb93a('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0xf02cb7,_0x24604c){return function(_0x5a3cb6){if(!_0x5a3cb6){_0xf02cb7['sendStatus'](0x194);}return _0x5a3cb6;};}function handleError(_0x13873f,_0xf990d5){_0xf990d5=_0xf990d5||0x1f4;return function(_0x5bbfad){logger[_0xb93a('0x23')](_0x5bbfad['stack']);if(_0x5bbfad[_0xb93a('0x24')]){delete _0x5bbfad[_0xb93a('0x24')];}_0x13873f[_0xb93a('0x18')](_0xf990d5)[_0xb93a('0x25')](_0x5bbfad);};}exports[_0xb93a('0x26')]=function(_0x226bde,_0x3410ee){var _0x310b17={},_0xbb977d={},_0x133874={'count':0x0,'rows':[]};var _0x5275ae=_[_0xb93a('0x27')](db[_0xb93a('0x28')][_0xb93a('0x29')],function(_0x4fd571){return{'name':_0x4fd571[_0xb93a('0x2a')],'type':_0x4fd571['type'][_0xb93a('0x2b')]};});_0xbb977d[_0xb93a('0x2c')]=_[_0xb93a('0x27')](_0x5275ae,_0xb93a('0x24'));_0xbb977d[_0xb93a('0x2d')]=_[_0xb93a('0x2e')](_0x226bde[_0xb93a('0x2d')]);_0xbb977d[_0xb93a('0x2f')]=_['intersection'](_0xbb977d['model'],_0xbb977d[_0xb93a('0x2d')]);_0x310b17[_0xb93a('0x30')]=_[_0xb93a('0x31')](_0xbb977d[_0xb93a('0x2c')],qs['fields'](_0x226bde['query'][_0xb93a('0x32')]));_0x310b17[_0xb93a('0x30')]=_0x310b17[_0xb93a('0x30')]['length']?_0x310b17[_0xb93a('0x30')]:_0xbb977d[_0xb93a('0x2c')];if(!_0x226bde[_0xb93a('0x2d')]['hasOwnProperty']('nolimit')){_0x310b17[_0xb93a('0x33')]=qs['limit'](_0x226bde['query']['limit']);_0x310b17[_0xb93a('0x1b')]=qs[_0xb93a('0x1b')](_0x226bde[_0xb93a('0x2d')]['offset']);}_0x310b17[_0xb93a('0x34')]=qs[_0xb93a('0x35')](_0x226bde[_0xb93a('0x2d')]['sort']);_0x310b17['where']=qs[_0xb93a('0x2f')](_[_0xb93a('0x36')](_0x226bde['query'],_0xbb977d['filters']));if(_0x226bde[_0xb93a('0x2d')][_0xb93a('0x37')]){_0x310b17[_0xb93a('0x38')]=_[_0xb93a('0x39')](_0x310b17[_0xb93a('0x38')],{'$or':_[_0xb93a('0x27')](_0x5275ae,function(_0x33716e){if(_0x33716e['type']!==_0xb93a('0x3a')){var _0x39190d={};_0x39190d[_0x33716e[_0xb93a('0x24')]]={'$like':'%'+_0x226bde[_0xb93a('0x2d')]['filter']+'%'};return _0x39190d;}})});}_0x310b17=_[_0xb93a('0x39')]({},_0x310b17,_0x226bde[_0xb93a('0x3b')]);var _0x1f4488={'where':_0x310b17['where']};return db[_0xb93a('0x28')]['count'](_0x1f4488)[_0xb93a('0x20')](function(_0x565f8b){_0x133874['count']=_0x565f8b;if(_0x226bde[_0xb93a('0x2d')]['includeAll']){_0x310b17['include']=[{'all':!![]}];}return db[_0xb93a('0x28')][_0xb93a('0x3c')](_0x310b17);})[_0xb93a('0x20')](function(_0x32fdeb){_0x133874[_0xb93a('0x3d')]=_0x32fdeb;return _0x133874;})[_0xb93a('0x20')](respondWithFilteredResult(_0x3410ee,_0x310b17))[_0xb93a('0x3e')](handleError(_0x3410ee,null));};exports[_0xb93a('0x3f')]=function(_0x562041,_0xa011db){var _0x922c68={'raw':![],'where':{'id':_0x562041[_0xb93a('0x40')]['id']}},_0x252f88={};_0x252f88['model']=_[_0xb93a('0x2e')](db[_0xb93a('0x28')][_0xb93a('0x29')]);_0x252f88[_0xb93a('0x2d')]=_[_0xb93a('0x2e')](_0x562041['query']);_0x252f88[_0xb93a('0x2f')]=_[_0xb93a('0x31')](_0x252f88[_0xb93a('0x2c')],_0x252f88[_0xb93a('0x2d')]);_0x922c68[_0xb93a('0x30')]=_[_0xb93a('0x31')](_0x252f88[_0xb93a('0x2c')],qs[_0xb93a('0x32')](_0x562041[_0xb93a('0x2d')][_0xb93a('0x32')]));_0x922c68[_0xb93a('0x30')]=_0x922c68[_0xb93a('0x30')]['length']?_0x922c68['attributes']:_0x252f88['model'];if(_0x562041[_0xb93a('0x2d')][_0xb93a('0x41')]){_0x922c68[_0xb93a('0x42')]=[{'all':!![]}];}_0x922c68=_[_0xb93a('0x39')]({},_0x922c68,_0x562041[_0xb93a('0x3b')]);return db[_0xb93a('0x28')][_0xb93a('0x43')](_0x922c68)[_0xb93a('0x20')](handleEntityNotFound(_0xa011db,null))[_0xb93a('0x20')](respondWithResult(_0xa011db,null))['catch'](handleError(_0xa011db,null));};exports[_0xb93a('0x44')]=function(_0xcd5ca3,_0x3eedfb){return db['JscriptyProject']['create'](_0xcd5ca3[_0xb93a('0x45')],{})[_0xb93a('0x20')](function(_0x47a06b){var _0x1b8290=_0xcd5ca3[_0xb93a('0x46')][_0xb93a('0x47')]({'plain':!![]});if(!_0x1b8290)throw new Error(_0xb93a('0x48'));if(_0x1b8290[_0xb93a('0x49')]===_0xb93a('0x46')){var _0xed8709=_0x47a06b[_0xb93a('0x47')]({'plain':!![]});var _0x425cc6=_0xb93a('0x22');return db[_0xb93a('0x4a')][_0xb93a('0x43')]({'where':{'name':_0x425cc6,'userProfileId':_0x1b8290[_0xb93a('0x4b')]},'raw':!![]})['then'](function(_0x3275c3){if(_0x3275c3&&_0x3275c3[_0xb93a('0x4c')]===0x0){return db[_0xb93a('0x4d')][_0xb93a('0x44')]({'name':_0xed8709[_0xb93a('0x24')],'resourceId':_0xed8709['id'],'type':_0x3275c3[_0xb93a('0x24')],'sectionId':_0x3275c3['id']},{})[_0xb93a('0x20')](function(){return _0x47a06b;});}else{return _0x47a06b;}})['catch'](function(_0x4f09aa){logger[_0xb93a('0x23')](_0xb93a('0x4e'),_0x4f09aa);throw _0x4f09aa;});}return _0x47a06b;})[_0xb93a('0x20')](respondWithResult(_0x3eedfb,0xc9))[_0xb93a('0x3e')](handleError(_0x3eedfb,null));};exports[_0xb93a('0x4f')]=function(_0x18086c,_0x32308d){var _0x3e21a2={'where':{'id':_0x18086c[_0xb93a('0x40')]['id']}},_0x172a5c={};_0x172a5c['model']=_[_0xb93a('0x2e')](db[_0xb93a('0x28')][_0xb93a('0x29')]);_0x3e21a2[_0xb93a('0x30')]=_[_0xb93a('0x31')](_0x172a5c[_0xb93a('0x2c')],qs[_0xb93a('0x32')](_0x18086c['query'][_0xb93a('0x32')]));_0x3e21a2['attributes']=_0x3e21a2[_0xb93a('0x30')]['length']?_0x3e21a2[_0xb93a('0x30')]:_0x172a5c[_0xb93a('0x2c')];if(_0x18086c[_0xb93a('0x2d')]['includeAll']){_0x3e21a2[_0xb93a('0x42')]=[{'all':!![]}];}_0x3e21a2=_[_0xb93a('0x39')]({},_0x3e21a2,_0x18086c['options']);return db[_0xb93a('0x28')][_0xb93a('0x43')](_0x3e21a2)[_0xb93a('0x20')](handleEntityNotFound(_0x32308d,null))[_0xb93a('0x20')](function(_0x2679bb){if(_0x2679bb){var _0x4f07e9=_0x2679bb['get']({'plain':!![]});_0x4f07e9=qs[_0xb93a('0x50')](_0x4f07e9,['id','createdAt',_0xb93a('0x51')]);_0x18086c[_0xb93a('0x45')]=_[_0xb93a('0x50')](_0x18086c[_0xb93a('0x45')],['id',_0xb93a('0x52'),_0xb93a('0x51')]);return db[_0xb93a('0x28')][_0xb93a('0x44')](_['merge'](_0x4f07e9,_0x18086c['body']),{'include':_0x18086c[_0xb93a('0x2d')][_0xb93a('0x41')]?[{'all':!![]}]:undefined})[_0xb93a('0x20')](function(_0x3174ed){var _0x153e7c=_0x18086c[_0xb93a('0x46')][_0xb93a('0x47')]({'plain':!![]});if(!_0x153e7c)throw new Error(_0xb93a('0x48'));if(_0x153e7c[_0xb93a('0x49')]===_0xb93a('0x46')){var _0x4c5758=_0x3174ed[_0xb93a('0x47')]({'plain':!![]});var _0xdb60ed=_0xb93a('0x22');return db['UserProfileSection']['find']({'where':{'name':_0xdb60ed,'userProfileId':_0x153e7c[_0xb93a('0x4b')]},'raw':!![]})[_0xb93a('0x20')](function(_0x18dff2){if(_0x18dff2&&_0x18dff2['autoAssociation']===0x0){return db['UserProfileResource'][_0xb93a('0x44')]({'name':_0x4c5758[_0xb93a('0x24')],'resourceId':_0x4c5758['id'],'type':_0x18dff2[_0xb93a('0x24')],'sectionId':_0x18dff2['id']},{})[_0xb93a('0x20')](function(){return _0x3174ed;});}else{return _0x3174ed;}})[_0xb93a('0x3e')](function(_0xebedf8){logger[_0xb93a('0x23')](_0xb93a('0x4e'),_0xebedf8);throw _0xebedf8;});}return _0x3174ed;});}})['then'](respondWithResult(_0x32308d,0xc9))[_0xb93a('0x3e')](handleError(_0x32308d,null));};exports['update']=function(_0x4b72ad,_0x5d19f6){if(_0x4b72ad['body']['id']){delete _0x4b72ad[_0xb93a('0x45')]['id'];}return db[_0xb93a('0x28')][_0xb93a('0x43')]({'where':{'id':_0x4b72ad['params']['id']}})[_0xb93a('0x20')](handleEntityNotFound(_0x5d19f6,null))[_0xb93a('0x20')](saveUpdates(_0x4b72ad[_0xb93a('0x45')],null))['then'](respondWithResult(_0x5d19f6,null))[_0xb93a('0x3e')](handleError(_0x5d19f6,null));};exports['destroy']=function(_0x1b540d,_0x51032e){return db[_0xb93a('0x28')][_0xb93a('0x43')]({'where':{'id':_0x1b540d[_0xb93a('0x40')]['id']}})['then'](handleEntityNotFound(_0x51032e,null))[_0xb93a('0x20')](removeEntity(_0x51032e,null))[_0xb93a('0x3e')](handleError(_0x51032e,null));};exports[_0xb93a('0x53')]=function(_0x42bf72,_0x172c83,_0x1c5bf0){var _0x106443={'raw':!![],'where':{}};var _0xd0250b={};var _0x175ea6={'count':0x0,'rows':[]};return db[_0xb93a('0x28')]['findOne']({'where':{'id':_0x42bf72[_0xb93a('0x40')]['id']}})['then'](handleEntityNotFound(_0x172c83,null))['then'](function(_0x2d8e2a){if(_0x2d8e2a){_0xd0250b[_0xb93a('0x2c')]=_[_0xb93a('0x2e')](db['JscriptySessionReport']['rawAttributes']);_0xd0250b[_0xb93a('0x2d')]=_[_0xb93a('0x2e')](_0x42bf72['query']);_0xd0250b[_0xb93a('0x2f')]=_[_0xb93a('0x31')](_0xd0250b['model'],_0xd0250b['query']);_0x106443[_0xb93a('0x30')]=_[_0xb93a('0x31')](_0xd0250b[_0xb93a('0x2c')],qs[_0xb93a('0x32')](_0x42bf72[_0xb93a('0x2d')]['fields']));_0x106443['attributes']=_0x106443[_0xb93a('0x30')][_0xb93a('0x54')]?_0x106443[_0xb93a('0x30')]:_0xd0250b['model'];if(!_0x42bf72[_0xb93a('0x2d')][_0xb93a('0x55')]('nolimit')){_0x106443[_0xb93a('0x33')]=qs[_0xb93a('0x33')](_0x42bf72[_0xb93a('0x2d')][_0xb93a('0x33')]);_0x106443[_0xb93a('0x1b')]=qs['offset'](_0x42bf72[_0xb93a('0x2d')][_0xb93a('0x1b')]);}_0x106443[_0xb93a('0x34')]=qs['sort'](_0x42bf72[_0xb93a('0x2d')]['sort']);_0x106443[_0xb93a('0x38')]=qs['filters'](_[_0xb93a('0x36')](_0x42bf72[_0xb93a('0x2d')],_0xd0250b[_0xb93a('0x2f')]));_0x106443[_0xb93a('0x38')][_0xb93a('0x56')]=_0x2d8e2a['id'];if(_0x42bf72[_0xb93a('0x2d')][_0xb93a('0x37')]){_0x106443[_0xb93a('0x38')]=_[_0xb93a('0x39')](_0x106443[_0xb93a('0x38')],{'$or':_[_0xb93a('0x27')](_0x106443['attributes'],function(_0x26c019){var _0x21e50a={};_0x21e50a[_0x26c019]={'$like':'%'+_0x42bf72['query']['filter']+'%'};return _0x21e50a;})});}_0x106443=_['merge']({},_0x106443,_0x42bf72[_0xb93a('0x3b')]);return db[_0xb93a('0x57')][_0xb93a('0x1a')]({'where':_0x106443[_0xb93a('0x38')]})[_0xb93a('0x20')](function(_0x59b28e){_0x175ea6['count']=_0x59b28e;if(_0x42bf72[_0xb93a('0x2d')][_0xb93a('0x41')]){_0x106443[_0xb93a('0x42')]=[{'all':!![]}];}return db[_0xb93a('0x57')][_0xb93a('0x3c')](_0x106443);})[_0xb93a('0x20')](function(_0x1e2a14){_0x175ea6[_0xb93a('0x3d')]=_0x1e2a14;return _0x175ea6;});}})[_0xb93a('0x20')](respondWithFilteredResult(_0x172c83,_0x106443))[_0xb93a('0x3e')](handleError(_0x172c83,null));};exports[_0xb93a('0x58')]=function(_0x42e305,_0x42e443,_0x56b1fe){var _0xfc85be={'raw':!![],'where':{}};var _0xcf6875={};var _0x4f4148={'count':0x0,'rows':[]};return db[_0xb93a('0x28')][_0xb93a('0x59')]({'where':{'id':_0x42e305[_0xb93a('0x40')]['id']}})['then'](handleEntityNotFound(_0x42e443,null))[_0xb93a('0x20')](function(_0x5ce2a1){if(_0x5ce2a1){_0xcf6875['model']=_[_0xb93a('0x2e')](db[_0xb93a('0x5a')]['rawAttributes']);_0xcf6875[_0xb93a('0x2d')]=_[_0xb93a('0x2e')](_0x42e305[_0xb93a('0x2d')]);_0xcf6875[_0xb93a('0x2f')]=_[_0xb93a('0x31')](_0xcf6875[_0xb93a('0x2c')],_0xcf6875['query']);_0xfc85be['attributes']=_['intersection'](_0xcf6875[_0xb93a('0x2c')],qs[_0xb93a('0x32')](_0x42e305['query'][_0xb93a('0x32')]));_0xfc85be['attributes']=_0xfc85be[_0xb93a('0x30')][_0xb93a('0x54')]?_0xfc85be[_0xb93a('0x30')]:_0xcf6875[_0xb93a('0x2c')];if(!_0x42e305[_0xb93a('0x2d')][_0xb93a('0x55')](_0xb93a('0x5b'))){_0xfc85be[_0xb93a('0x33')]=qs[_0xb93a('0x33')](_0x42e305['query'][_0xb93a('0x33')]);_0xfc85be[_0xb93a('0x1b')]=qs[_0xb93a('0x1b')](_0x42e305['query'][_0xb93a('0x1b')]);}_0xfc85be[_0xb93a('0x34')]=qs['sort'](_0x42e305[_0xb93a('0x2d')][_0xb93a('0x35')]);_0xfc85be[_0xb93a('0x38')]=qs[_0xb93a('0x2f')](_[_0xb93a('0x36')](_0x42e305[_0xb93a('0x2d')],_0xcf6875[_0xb93a('0x2f')]));_0xfc85be[_0xb93a('0x38')][_0xb93a('0x56')]=_0x5ce2a1['id'];if(_0x42e305['query'][_0xb93a('0x37')]){_0xfc85be[_0xb93a('0x38')]=_[_0xb93a('0x39')](_0xfc85be[_0xb93a('0x38')],{'$or':_[_0xb93a('0x27')](_0xfc85be[_0xb93a('0x30')],function(_0x84cd88){var _0x456cdc={};_0x456cdc[_0x84cd88]={'$like':'%'+_0x42e305['query'][_0xb93a('0x37')]+'%'};return _0x456cdc;})});}_0xfc85be=_[_0xb93a('0x39')]({},_0xfc85be,_0x42e305['options']);return db['JscriptyAnswerReport'][_0xb93a('0x1a')]({'where':_0xfc85be[_0xb93a('0x38')]})['then'](function(_0xfdaf38){_0x4f4148[_0xb93a('0x1a')]=_0xfdaf38;if(_0x42e305[_0xb93a('0x2d')][_0xb93a('0x41')]){_0xfc85be[_0xb93a('0x42')]=[{'all':!![]}];}return db[_0xb93a('0x5a')][_0xb93a('0x3c')](_0xfc85be);})[_0xb93a('0x20')](function(_0x592f03){_0x4f4148[_0xb93a('0x3d')]=_0x592f03;return _0x4f4148;});}})[_0xb93a('0x20')](respondWithFilteredResult(_0x42e443,_0xfc85be))[_0xb93a('0x3e')](handleError(_0x42e443,null));};function char(_0x37a2a2){return _0xb93a('0x5c')===typeof _0x37a2a2?String['fromCharCode'][_0xb93a('0x5d')](null,arguments):_0x37a2a2;}function needsEncapsulation(_0x763c3e){return!!_0x763c3e&&(_0x763c3e[_0xb93a('0x5e')]()['indexOf'](char(0xd))>=0x0||_0x763c3e[_0xb93a('0x5e')]()[_0xb93a('0x5f')](char(0xa))>=0x0||_0x763c3e[_0xb93a('0x5e')]()[_0xb93a('0x5f')](char(0x2c))>=0x0||_0x763c3e['toString']()[_0xb93a('0x5f')](char(0x22))>=0x0);}function encapsulate(_0x270c04){var _0x3217eb=char(0x22),_0x4af10a='\x5c'+char(0x22),_0x12239f=_0x270c04[_0xb93a('0x5e')]()[_0xb93a('0x60')](new RegExp(_0x3217eb,'g'),_0x4af10a);return _0x3217eb+_0x12239f+_0x3217eb;}exports[_0xb93a('0x61')]=function(_0x3a1202,_0x2c46b5,_0x252278){var _0x5097ca,_0x79796;var _0x106689={'where':{'ProjectId':_0x3a1202[_0xb93a('0x40')]['id']}};if(_0x3a1202['query'][_0xb93a('0x62')]){_0x106689[_0xb93a('0x38')]['starttime']=JSON['parse'](_0x3a1202[_0xb93a('0x2d')]['startTime']);}return db[_0xb93a('0x57')][_0xb93a('0x3c')](_0x106689)[_0xb93a('0x20')](handleEntityNotFound(_0x2c46b5,null))['then'](function(_0x683372){if(_0x683372){_0x5097ca=_0x683372;return db[_0xb93a('0x63')][_0xb93a('0x3c')]({'where':{'SessionId':{'$in':_[_0xb93a('0x27')](_0x5097ca,'id')},'ProjectId':_0x3a1202[_0xb93a('0x40')]['id']},'order':_0xb93a('0x64')});}})[_0xb93a('0x20')](handleEntityNotFound(_0x2c46b5,null))[_0xb93a('0x20')](function(_0x1969e7){if(_0x1969e7){_0x79796=_0x1969e7;var _0x408af6={};for(var _0x58a0d7=0x0,_0x1d0842=_0x79796['length'];_0x58a0d7<_0x1d0842;_0x58a0d7++){if(!_0x408af6[_0xb93a('0x55')](_0x79796[_0x58a0d7][_0xb93a('0x65')])){_0x408af6[_0x79796[_0x58a0d7][_0xb93a('0x65')]]=needsEncapsulation(_0x79796[_0x58a0d7][_0xb93a('0x66')])?encapsulate(_0x79796[_0x58a0d7]['question']):_0x79796[_0x58a0d7]['question'];}}var _0x5e473e=[],_0x239ca0={};for(var _0x12bb32=0x0,_0x349809=_0x5097ca[_0xb93a('0x54')];_0x12bb32<_0x349809;_0x12bb32++){_0x239ca0={'ProjectId':_0x3a1202['params']['id'],'SessionId':_0x5097ca[_0x12bb32]['id'],'StartTime':moment(_0x5097ca[_0x12bb32]['starttime'])['format']('YYYY-MM-DD\x20HH:mm:ss')};for(var _0x3a86ee=0x0,_0x4d2cc6=_0x79796['length'];_0x3a86ee<_0x4d2cc6;_0x3a86ee++){if(_0x79796[_0x3a86ee][_0xb93a('0x67')]==_0x5097ca[_0x12bb32]['id']&&_0x408af6[_0xb93a('0x55')](_0x79796[_0x3a86ee][_0xb93a('0x65')])){_0x239ca0[_0x408af6[_0x79796[_0x3a86ee][_0xb93a('0x65')]]]=_0x79796[_0x3a86ee][_0xb93a('0x68')];}}for(var _0x468557 in _0x408af6){if(!_0x239ca0[_0xb93a('0x55')](_0x408af6[_0x468557])){_0x239ca0[_0x408af6[_0x468557]]=null;}}_0x5e473e['push'](_0x239ca0);}return _0x5e473e;}})[_0xb93a('0x20')](function(_0x170cd9){if(!_[_0xb93a('0x69')](_0x170cd9)){var _0x53971e=toCsv(_0x170cd9);var _0x4b657c=Date[_0xb93a('0x6a')]();fs[_0xb93a('0x6b')](util[_0xb93a('0x6c')](_0xb93a('0x6d'),_0x3a1202[_0xb93a('0x40')]['id'],_0x4b657c),_0x53971e);_0x2c46b5[_0xb93a('0x6e')](_0xb93a('0x6f'),_0xb93a('0x70')+util[_0xb93a('0x6c')]('Jscripty_Project_%d_Summary_%s.csv',_0x3a1202[_0xb93a('0x40')]['id'],_0x4b657c));_0x2c46b5['setHeader'](_0xb93a('0x71'),'text/csv');return _0x2c46b5[_0xb93a('0x72')](util[_0xb93a('0x6c')](_0xb93a('0x6d'),_0x3a1202[_0xb93a('0x40')]['id'],_0x4b657c));}else{return _0x2c46b5[_0xb93a('0x17')](0xcc);}})[_0xb93a('0x3e')](handleError(_0x2c46b5,null));}; \ No newline at end of file +var _0xd8fa=['setHeader','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','Content-type','html-pdf','rimraf','zip-dir','fast-json-patch','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','then','destroy','get','Projects','error','stack','name','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','JscriptyProject','include','findAll','rows','catch','show','params','length','includeAll','find','create','user','role','UserProfileSection','userProfileId','autoAssociation','createdAt','updatedAt','omit','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getSessions','findOne','JscriptySessionReport','ProjectId','JscriptyAnswerReport','number','fromCharCode','toString','indexOf','replace','getSummary','startTime','starttime','parse','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','push','isEmpty','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv'];(function(_0x162a7c,_0x13c3ae){var _0x721185=function(_0x3ce55c){while(--_0x3ce55c){_0x162a7c['push'](_0x162a7c['shift']());}};_0x721185(++_0x13c3ae);}(_0xd8fa,0x167));var _0xad8f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd8fa[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0xad8f('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xad8f('0x1'));var zipdir=require(_0xad8f('0x2'));var jsonpatch=require(_0xad8f('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xad8f('0x4'));var Mustache=require(_0xad8f('0x5'));var util=require('util');var path=require(_0xad8f('0x6'));var sox=require(_0xad8f('0x7'));var csv=require(_0xad8f('0x8'));var ejs=require(_0xad8f('0x9'));var fs=require('fs');var _=require(_0xad8f('0xa'));var squel=require(_0xad8f('0xb'));var crypto=require(_0xad8f('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xad8f('0xd'));var toCsv=require(_0xad8f('0x8'));var querystring=require(_0xad8f('0xe'));var Papa=require(_0xad8f('0xf'));var Redis=require(_0xad8f('0x10'));var authService=require(_0xad8f('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xad8f('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xad8f('0x13'))(_0xad8f('0x14'));var utils=require(_0xad8f('0x15'));var config=require(_0xad8f('0x16'));var db=require(_0xad8f('0x17'))['db'];function respondWithStatusCode(_0x328890,_0x1e4c0f){_0x1e4c0f=_0x1e4c0f||0xcc;return function(_0x17d703){if(_0x17d703){return _0x328890[_0xad8f('0x18')](_0x1e4c0f);}return _0x328890[_0xad8f('0x19')](_0x1e4c0f)[_0xad8f('0x1a')]();};}function respondWithResult(_0x4154be,_0x137e11){_0x137e11=_0x137e11||0xc8;return function(_0x1fa411){if(_0x1fa411){return _0x4154be['status'](_0x137e11)[_0xad8f('0x1b')](_0x1fa411);}};}function respondWithFilteredResult(_0x10a5d3,_0x2f3034){return function(_0x417ffd){if(_0x417ffd){var _0x5a99fc=_0x417ffd[_0xad8f('0x1c')],_0x7f9b42=_0x2f3034['offset'],_0x558831=_0x2f3034[_0xad8f('0x1d')]+_0x2f3034[_0xad8f('0x1e')],_0x3914e6;if(_0x558831>=_0x5a99fc){_0x558831=_0x5a99fc;_0x3914e6=0xc8;}else{_0x3914e6=0xce;}_0x10a5d3[_0xad8f('0x19')](_0x3914e6);return _0x10a5d3[_0xad8f('0x1f')]('Content-Range',_0x7f9b42+'-'+_0x558831+'/'+_0x5a99fc)['json'](_0x417ffd);}return null;};}function patchUpdates(_0x5af68f){return function(_0x1911e1){try{jsonpatch[_0xad8f('0x20')](_0x1911e1,_0x5af68f,!![]);}catch(_0x5629f3){return BPromise[_0xad8f('0x21')](_0x5629f3);}return _0x1911e1[_0xad8f('0x22')]();};}function saveUpdates(_0x1d6cd0,_0x23c405){return function(_0x1f10df){if(_0x1f10df){return _0x1f10df[_0xad8f('0x23')](_0x1d6cd0)[_0xad8f('0x24')](function(_0x221fb6){return _0x221fb6;});}return null;};}function removeEntity(_0xf81dfd,_0x4a50a6){return function(_0xedb87e){if(_0xedb87e){return _0xedb87e[_0xad8f('0x25')]()[_0xad8f('0x24')](function(){var _0xf94049=_0xedb87e[_0xad8f('0x26')]({'plain':!![]});var _0x53bc2d=_0xad8f('0x27');return db['UserProfileResource']['destroy']({'where':{'type':_0x53bc2d,'resourceId':_0xf94049['id']}})[_0xad8f('0x24')](function(){return _0xedb87e;});})[_0xad8f('0x24')](function(){_0xf81dfd[_0xad8f('0x19')](0xcc)[_0xad8f('0x1a')]();});}};}function handleEntityNotFound(_0x56768a,_0x128f0a){return function(_0x2e2f4f){if(!_0x2e2f4f){_0x56768a['sendStatus'](0x194);}return _0x2e2f4f;};}function handleError(_0x561b37,_0x42f147){_0x42f147=_0x42f147||0x1f4;return function(_0x59d96a){logger[_0xad8f('0x28')](_0x59d96a[_0xad8f('0x29')]);if(_0x59d96a[_0xad8f('0x2a')]){delete _0x59d96a[_0xad8f('0x2a')];}_0x561b37[_0xad8f('0x19')](_0x42f147)['send'](_0x59d96a);};}exports[_0xad8f('0x2b')]=function(_0x460908,_0x2f90f6){var _0x55ec69={},_0x260056={},_0x2a943f={'count':0x0,'rows':[]};var _0x38a248=_[_0xad8f('0x2c')](db['JscriptyProject'][_0xad8f('0x2d')],function(_0x13045e){return{'name':_0x13045e[_0xad8f('0x2e')],'type':_0x13045e[_0xad8f('0x2f')]['key']};});_0x260056[_0xad8f('0x30')]=_[_0xad8f('0x2c')](_0x38a248,_0xad8f('0x2a'));_0x260056[_0xad8f('0x31')]=_[_0xad8f('0x32')](_0x460908['query']);_0x260056[_0xad8f('0x33')]=_[_0xad8f('0x34')](_0x260056[_0xad8f('0x30')],_0x260056['query']);_0x55ec69[_0xad8f('0x35')]=_['intersection'](_0x260056[_0xad8f('0x30')],qs[_0xad8f('0x36')](_0x460908[_0xad8f('0x31')][_0xad8f('0x36')]));_0x55ec69[_0xad8f('0x35')]=_0x55ec69[_0xad8f('0x35')]['length']?_0x55ec69[_0xad8f('0x35')]:_0x260056['model'];if(!_0x460908[_0xad8f('0x31')][_0xad8f('0x37')](_0xad8f('0x38'))){_0x55ec69[_0xad8f('0x1e')]=qs[_0xad8f('0x1e')](_0x460908[_0xad8f('0x31')][_0xad8f('0x1e')]);_0x55ec69[_0xad8f('0x1d')]=qs[_0xad8f('0x1d')](_0x460908[_0xad8f('0x31')][_0xad8f('0x1d')]);}_0x55ec69[_0xad8f('0x39')]=qs['sort'](_0x460908[_0xad8f('0x31')][_0xad8f('0x3a')]);_0x55ec69[_0xad8f('0x3b')]=qs['filters'](_[_0xad8f('0x3c')](_0x460908[_0xad8f('0x31')],_0x260056[_0xad8f('0x33')]));if(_0x460908['query'][_0xad8f('0x3d')]){_0x55ec69[_0xad8f('0x3b')]=_[_0xad8f('0x3e')](_0x55ec69[_0xad8f('0x3b')],{'$or':_[_0xad8f('0x2c')](_0x38a248,function(_0xb6d3ad){if(_0xb6d3ad['type']!==_0xad8f('0x3f')){var _0x4fcd77={};_0x4fcd77[_0xb6d3ad['name']]={'$like':'%'+_0x460908[_0xad8f('0x31')]['filter']+'%'};return _0x4fcd77;}})});}_0x55ec69=_[_0xad8f('0x3e')]({},_0x55ec69,_0x460908[_0xad8f('0x40')]);var _0x26e96f={'where':_0x55ec69[_0xad8f('0x3b')]};return db[_0xad8f('0x41')]['count'](_0x26e96f)[_0xad8f('0x24')](function(_0xe04d09){_0x2a943f['count']=_0xe04d09;if(_0x460908['query']['includeAll']){_0x55ec69[_0xad8f('0x42')]=[{'all':!![]}];}return db[_0xad8f('0x41')][_0xad8f('0x43')](_0x55ec69);})[_0xad8f('0x24')](function(_0x4f7779){_0x2a943f[_0xad8f('0x44')]=_0x4f7779;return _0x2a943f;})['then'](respondWithFilteredResult(_0x2f90f6,_0x55ec69))[_0xad8f('0x45')](handleError(_0x2f90f6,null));};exports[_0xad8f('0x46')]=function(_0x1553be,_0xc28590){var _0x59c71b={'raw':![],'where':{'id':_0x1553be[_0xad8f('0x47')]['id']}},_0x13d07b={};_0x13d07b[_0xad8f('0x30')]=_[_0xad8f('0x32')](db[_0xad8f('0x41')]['rawAttributes']);_0x13d07b[_0xad8f('0x31')]=_[_0xad8f('0x32')](_0x1553be[_0xad8f('0x31')]);_0x13d07b['filters']=_['intersection'](_0x13d07b[_0xad8f('0x30')],_0x13d07b['query']);_0x59c71b['attributes']=_[_0xad8f('0x34')](_0x13d07b[_0xad8f('0x30')],qs[_0xad8f('0x36')](_0x1553be[_0xad8f('0x31')][_0xad8f('0x36')]));_0x59c71b['attributes']=_0x59c71b[_0xad8f('0x35')][_0xad8f('0x48')]?_0x59c71b['attributes']:_0x13d07b[_0xad8f('0x30')];if(_0x1553be[_0xad8f('0x31')][_0xad8f('0x49')]){_0x59c71b[_0xad8f('0x42')]=[{'all':!![]}];}_0x59c71b=_[_0xad8f('0x3e')]({},_0x59c71b,_0x1553be[_0xad8f('0x40')]);return db[_0xad8f('0x41')][_0xad8f('0x4a')](_0x59c71b)[_0xad8f('0x24')](handleEntityNotFound(_0xc28590,null))[_0xad8f('0x24')](respondWithResult(_0xc28590,null))['catch'](handleError(_0xc28590,null));};exports[_0xad8f('0x4b')]=function(_0x55cd4e,_0x5b1efa){return db[_0xad8f('0x41')][_0xad8f('0x4b')](_0x55cd4e['body'],{})[_0xad8f('0x24')](function(_0x176168){var _0x33fcfe=_0x55cd4e[_0xad8f('0x4c')][_0xad8f('0x26')]({'plain':!![]});if(!_0x33fcfe)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x33fcfe[_0xad8f('0x4d')]==='user'){var _0x456d8b=_0x176168['get']({'plain':!![]});var _0x4b8dcf=_0xad8f('0x27');return db[_0xad8f('0x4e')][_0xad8f('0x4a')]({'where':{'name':_0x4b8dcf,'userProfileId':_0x33fcfe[_0xad8f('0x4f')]},'raw':!![]})[_0xad8f('0x24')](function(_0x31fbbe){if(_0x31fbbe&&_0x31fbbe[_0xad8f('0x50')]===0x0){return db['UserProfileResource'][_0xad8f('0x4b')]({'name':_0x456d8b[_0xad8f('0x2a')],'resourceId':_0x456d8b['id'],'type':_0x31fbbe['name'],'sectionId':_0x31fbbe['id']},{})[_0xad8f('0x24')](function(){return _0x176168;});}else{return _0x176168;}})[_0xad8f('0x45')](function(_0x3c03de){logger[_0xad8f('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3c03de);throw _0x3c03de;});}return _0x176168;})[_0xad8f('0x24')](respondWithResult(_0x5b1efa,0xc9))[_0xad8f('0x45')](handleError(_0x5b1efa,null));};exports['clone']=function(_0x2bc4d5,_0x2d84d3){var _0x208e3b={'where':{'id':_0x2bc4d5[_0xad8f('0x47')]['id']}},_0x131f03={};_0x131f03[_0xad8f('0x30')]=_[_0xad8f('0x32')](db[_0xad8f('0x41')][_0xad8f('0x2d')]);_0x208e3b[_0xad8f('0x35')]=_['intersection'](_0x131f03[_0xad8f('0x30')],qs[_0xad8f('0x36')](_0x2bc4d5[_0xad8f('0x31')][_0xad8f('0x36')]));_0x208e3b[_0xad8f('0x35')]=_0x208e3b[_0xad8f('0x35')][_0xad8f('0x48')]?_0x208e3b[_0xad8f('0x35')]:_0x131f03[_0xad8f('0x30')];if(_0x2bc4d5[_0xad8f('0x31')][_0xad8f('0x49')]){_0x208e3b[_0xad8f('0x42')]=[{'all':!![]}];}_0x208e3b=_[_0xad8f('0x3e')]({},_0x208e3b,_0x2bc4d5[_0xad8f('0x40')]);return db[_0xad8f('0x41')][_0xad8f('0x4a')](_0x208e3b)[_0xad8f('0x24')](handleEntityNotFound(_0x2d84d3,null))[_0xad8f('0x24')](function(_0x6a49a8){if(_0x6a49a8){var _0x5a4b22=_0x6a49a8[_0xad8f('0x26')]({'plain':!![]});_0x5a4b22=qs['omit'](_0x5a4b22,['id',_0xad8f('0x51'),_0xad8f('0x52')]);_0x2bc4d5['body']=_[_0xad8f('0x53')](_0x2bc4d5[_0xad8f('0x54')],['id','createdAt',_0xad8f('0x52')]);return db[_0xad8f('0x41')]['create'](_[_0xad8f('0x3e')](_0x5a4b22,_0x2bc4d5[_0xad8f('0x54')]),{'include':_0x2bc4d5[_0xad8f('0x31')][_0xad8f('0x49')]?[{'all':!![]}]:undefined})['then'](function(_0x3cb641){var _0x39de67=_0x2bc4d5[_0xad8f('0x4c')][_0xad8f('0x26')]({'plain':!![]});if(!_0x39de67)throw new Error(_0xad8f('0x55'));if(_0x39de67[_0xad8f('0x4d')]===_0xad8f('0x4c')){var _0x442fe2=_0x3cb641[_0xad8f('0x26')]({'plain':!![]});var _0x1cba97=_0xad8f('0x27');return db[_0xad8f('0x4e')][_0xad8f('0x4a')]({'where':{'name':_0x1cba97,'userProfileId':_0x39de67[_0xad8f('0x4f')]},'raw':!![]})[_0xad8f('0x24')](function(_0x54ea89){if(_0x54ea89&&_0x54ea89['autoAssociation']===0x0){return db[_0xad8f('0x56')][_0xad8f('0x4b')]({'name':_0x442fe2[_0xad8f('0x2a')],'resourceId':_0x442fe2['id'],'type':_0x54ea89[_0xad8f('0x2a')],'sectionId':_0x54ea89['id']},{})['then'](function(){return _0x3cb641;});}else{return _0x3cb641;}})[_0xad8f('0x45')](function(_0xce4e9e){logger[_0xad8f('0x28')](_0xad8f('0x57'),_0xce4e9e);throw _0xce4e9e;});}return _0x3cb641;});}})[_0xad8f('0x24')](respondWithResult(_0x2d84d3,0xc9))[_0xad8f('0x45')](handleError(_0x2d84d3,null));};exports[_0xad8f('0x23')]=function(_0x13c0c6,_0x3222da){if(_0x13c0c6[_0xad8f('0x54')]['id']){delete _0x13c0c6[_0xad8f('0x54')]['id'];}return db[_0xad8f('0x41')][_0xad8f('0x4a')]({'where':{'id':_0x13c0c6[_0xad8f('0x47')]['id']}})[_0xad8f('0x24')](handleEntityNotFound(_0x3222da,null))[_0xad8f('0x24')](saveUpdates(_0x13c0c6[_0xad8f('0x54')],null))['then'](respondWithResult(_0x3222da,null))[_0xad8f('0x45')](handleError(_0x3222da,null));};exports['destroy']=function(_0x214134,_0x4c9d10){return db[_0xad8f('0x41')][_0xad8f('0x4a')]({'where':{'id':_0x214134[_0xad8f('0x47')]['id']}})[_0xad8f('0x24')](handleEntityNotFound(_0x4c9d10,null))[_0xad8f('0x24')](removeEntity(_0x4c9d10,null))[_0xad8f('0x45')](handleError(_0x4c9d10,null));};exports[_0xad8f('0x58')]=function(_0x1d4643,_0x2436ba,_0x5b3505){var _0x2110e9={'raw':!![],'where':{}};var _0x33f37f={};var _0x5895f5={'count':0x0,'rows':[]};return db[_0xad8f('0x41')][_0xad8f('0x59')]({'where':{'id':_0x1d4643[_0xad8f('0x47')]['id']}})[_0xad8f('0x24')](handleEntityNotFound(_0x2436ba,null))[_0xad8f('0x24')](function(_0x3b84b8){if(_0x3b84b8){_0x33f37f[_0xad8f('0x30')]=_[_0xad8f('0x32')](db[_0xad8f('0x5a')][_0xad8f('0x2d')]);_0x33f37f[_0xad8f('0x31')]=_[_0xad8f('0x32')](_0x1d4643[_0xad8f('0x31')]);_0x33f37f['filters']=_[_0xad8f('0x34')](_0x33f37f['model'],_0x33f37f['query']);_0x2110e9[_0xad8f('0x35')]=_[_0xad8f('0x34')](_0x33f37f[_0xad8f('0x30')],qs[_0xad8f('0x36')](_0x1d4643['query'][_0xad8f('0x36')]));_0x2110e9[_0xad8f('0x35')]=_0x2110e9['attributes']['length']?_0x2110e9[_0xad8f('0x35')]:_0x33f37f[_0xad8f('0x30')];if(!_0x1d4643[_0xad8f('0x31')]['hasOwnProperty'](_0xad8f('0x38'))){_0x2110e9[_0xad8f('0x1e')]=qs[_0xad8f('0x1e')](_0x1d4643['query']['limit']);_0x2110e9['offset']=qs['offset'](_0x1d4643[_0xad8f('0x31')]['offset']);}_0x2110e9[_0xad8f('0x39')]=qs['sort'](_0x1d4643[_0xad8f('0x31')][_0xad8f('0x3a')]);_0x2110e9[_0xad8f('0x3b')]=qs['filters'](_[_0xad8f('0x3c')](_0x1d4643[_0xad8f('0x31')],_0x33f37f[_0xad8f('0x33')]));_0x2110e9[_0xad8f('0x3b')][_0xad8f('0x5b')]=_0x3b84b8['id'];if(_0x1d4643[_0xad8f('0x31')][_0xad8f('0x3d')]){_0x2110e9['where']=_['merge'](_0x2110e9[_0xad8f('0x3b')],{'$or':_[_0xad8f('0x2c')](_0x2110e9['attributes'],function(_0x44b69f){var _0x51bbea={};_0x51bbea[_0x44b69f]={'$like':'%'+_0x1d4643[_0xad8f('0x31')][_0xad8f('0x3d')]+'%'};return _0x51bbea;})});}_0x2110e9=_[_0xad8f('0x3e')]({},_0x2110e9,_0x1d4643[_0xad8f('0x40')]);return db[_0xad8f('0x5a')]['count']({'where':_0x2110e9[_0xad8f('0x3b')]})['then'](function(_0x34144e){_0x5895f5[_0xad8f('0x1c')]=_0x34144e;if(_0x1d4643['query'][_0xad8f('0x49')]){_0x2110e9[_0xad8f('0x42')]=[{'all':!![]}];}return db[_0xad8f('0x5a')][_0xad8f('0x43')](_0x2110e9);})[_0xad8f('0x24')](function(_0x3ce31a){_0x5895f5[_0xad8f('0x44')]=_0x3ce31a;return _0x5895f5;});}})[_0xad8f('0x24')](respondWithFilteredResult(_0x2436ba,_0x2110e9))[_0xad8f('0x45')](handleError(_0x2436ba,null));};exports['getAnswers']=function(_0x211414,_0x1e1685,_0x535ff6){var _0x3f15ab={'raw':!![],'where':{}};var _0x28fee7={};var _0x53b4c8={'count':0x0,'rows':[]};return db['JscriptyProject'][_0xad8f('0x59')]({'where':{'id':_0x211414['params']['id']}})[_0xad8f('0x24')](handleEntityNotFound(_0x1e1685,null))['then'](function(_0x361373){if(_0x361373){_0x28fee7[_0xad8f('0x30')]=_[_0xad8f('0x32')](db[_0xad8f('0x5c')][_0xad8f('0x2d')]);_0x28fee7['query']=_[_0xad8f('0x32')](_0x211414[_0xad8f('0x31')]);_0x28fee7['filters']=_[_0xad8f('0x34')](_0x28fee7[_0xad8f('0x30')],_0x28fee7[_0xad8f('0x31')]);_0x3f15ab[_0xad8f('0x35')]=_[_0xad8f('0x34')](_0x28fee7['model'],qs[_0xad8f('0x36')](_0x211414[_0xad8f('0x31')][_0xad8f('0x36')]));_0x3f15ab['attributes']=_0x3f15ab[_0xad8f('0x35')][_0xad8f('0x48')]?_0x3f15ab[_0xad8f('0x35')]:_0x28fee7[_0xad8f('0x30')];if(!_0x211414[_0xad8f('0x31')][_0xad8f('0x37')](_0xad8f('0x38'))){_0x3f15ab[_0xad8f('0x1e')]=qs[_0xad8f('0x1e')](_0x211414[_0xad8f('0x31')][_0xad8f('0x1e')]);_0x3f15ab[_0xad8f('0x1d')]=qs[_0xad8f('0x1d')](_0x211414[_0xad8f('0x31')][_0xad8f('0x1d')]);}_0x3f15ab[_0xad8f('0x39')]=qs['sort'](_0x211414[_0xad8f('0x31')][_0xad8f('0x3a')]);_0x3f15ab[_0xad8f('0x3b')]=qs[_0xad8f('0x33')](_['pick'](_0x211414[_0xad8f('0x31')],_0x28fee7[_0xad8f('0x33')]));_0x3f15ab[_0xad8f('0x3b')][_0xad8f('0x5b')]=_0x361373['id'];if(_0x211414[_0xad8f('0x31')][_0xad8f('0x3d')]){_0x3f15ab[_0xad8f('0x3b')]=_[_0xad8f('0x3e')](_0x3f15ab['where'],{'$or':_[_0xad8f('0x2c')](_0x3f15ab[_0xad8f('0x35')],function(_0x521f08){var _0x5c5d8a={};_0x5c5d8a[_0x521f08]={'$like':'%'+_0x211414[_0xad8f('0x31')][_0xad8f('0x3d')]+'%'};return _0x5c5d8a;})});}_0x3f15ab=_[_0xad8f('0x3e')]({},_0x3f15ab,_0x211414[_0xad8f('0x40')]);return db['JscriptyAnswerReport'][_0xad8f('0x1c')]({'where':_0x3f15ab[_0xad8f('0x3b')]})[_0xad8f('0x24')](function(_0x4d3dc3){_0x53b4c8[_0xad8f('0x1c')]=_0x4d3dc3;if(_0x211414[_0xad8f('0x31')][_0xad8f('0x49')]){_0x3f15ab['include']=[{'all':!![]}];}return db[_0xad8f('0x5c')][_0xad8f('0x43')](_0x3f15ab);})[_0xad8f('0x24')](function(_0x1b9355){_0x53b4c8['rows']=_0x1b9355;return _0x53b4c8;});}})['then'](respondWithFilteredResult(_0x1e1685,_0x3f15ab))[_0xad8f('0x45')](handleError(_0x1e1685,null));};function char(_0xd72bc){return _0xad8f('0x5d')===typeof _0xd72bc?String[_0xad8f('0x5e')][_0xad8f('0x20')](null,arguments):_0xd72bc;}function needsEncapsulation(_0x4e88b9){return!!_0x4e88b9&&(_0x4e88b9[_0xad8f('0x5f')]()['indexOf'](char(0xd))>=0x0||_0x4e88b9['toString']()[_0xad8f('0x60')](char(0xa))>=0x0||_0x4e88b9[_0xad8f('0x5f')]()[_0xad8f('0x60')](char(0x2c))>=0x0||_0x4e88b9[_0xad8f('0x5f')]()[_0xad8f('0x60')](char(0x22))>=0x0);}function encapsulate(_0x3b354b){var _0x505a14=char(0x22),_0x17df1a='\x5c'+char(0x22),_0xf0cdd=_0x3b354b[_0xad8f('0x5f')]()[_0xad8f('0x61')](new RegExp(_0x505a14,'g'),_0x17df1a);return _0x505a14+_0xf0cdd+_0x505a14;}exports[_0xad8f('0x62')]=function(_0xe10587,_0x285623,_0x76fd98){var _0x54058b,_0x3420ae;var _0x2d05a8={'where':{'ProjectId':_0xe10587[_0xad8f('0x47')]['id']}};if(_0xe10587[_0xad8f('0x31')][_0xad8f('0x63')]){_0x2d05a8[_0xad8f('0x3b')][_0xad8f('0x64')]=JSON[_0xad8f('0x65')](_0xe10587['query']['startTime']);}return db[_0xad8f('0x5a')][_0xad8f('0x43')](_0x2d05a8)[_0xad8f('0x24')](handleEntityNotFound(_0x285623,null))['then'](function(_0x3f3316){if(_0x3f3316){_0x54058b=_0x3f3316;return db['JscriptyQuestionReport'][_0xad8f('0x43')]({'where':{'SessionId':{'$in':_['map'](_0x54058b,'id')},'ProjectId':_0xe10587[_0xad8f('0x47')]['id']},'order':'-createdAt'});}})[_0xad8f('0x24')](handleEntityNotFound(_0x285623,null))['then'](function(_0x32e3e5){if(_0x32e3e5){_0x3420ae=_0x32e3e5;var _0x30c1a5={};for(var _0x4aa70d=0x0,_0x570087=_0x3420ae['length'];_0x4aa70d<_0x570087;_0x4aa70d++){if(!_0x30c1a5[_0xad8f('0x37')](_0x3420ae[_0x4aa70d]['questionId'])){_0x30c1a5[_0x3420ae[_0x4aa70d][_0xad8f('0x66')]]=needsEncapsulation(_0x3420ae[_0x4aa70d][_0xad8f('0x67')])?encapsulate(_0x3420ae[_0x4aa70d][_0xad8f('0x67')]):_0x3420ae[_0x4aa70d][_0xad8f('0x67')];}}var _0x29bfc8=[],_0xc94c21={};for(var _0x5c195c=0x0,_0x20bec1=_0x54058b[_0xad8f('0x48')];_0x5c195c<_0x20bec1;_0x5c195c++){_0xc94c21={'ProjectId':_0xe10587[_0xad8f('0x47')]['id'],'SessionId':_0x54058b[_0x5c195c]['id'],'StartTime':moment(_0x54058b[_0x5c195c]['starttime'])[_0xad8f('0x68')](_0xad8f('0x69'))};for(var _0x26d53f=0x0,_0x2eaf99=_0x3420ae['length'];_0x26d53f<_0x2eaf99;_0x26d53f++){if(_0x3420ae[_0x26d53f][_0xad8f('0x6a')]==_0x54058b[_0x5c195c]['id']&&_0x30c1a5[_0xad8f('0x37')](_0x3420ae[_0x26d53f]['questionId'])){_0xc94c21[_0x30c1a5[_0x3420ae[_0x26d53f][_0xad8f('0x66')]]]=_0x3420ae[_0x26d53f][_0xad8f('0x6b')];}}for(var _0x278aeb in _0x30c1a5){if(!_0xc94c21[_0xad8f('0x37')](_0x30c1a5[_0x278aeb])){_0xc94c21[_0x30c1a5[_0x278aeb]]=null;}}_0x29bfc8[_0xad8f('0x6c')](_0xc94c21);}return _0x29bfc8;}})[_0xad8f('0x24')](function(_0x34d20a){if(!_[_0xad8f('0x6d')](_0x34d20a)){var _0x479559=toCsv(_0x34d20a);var _0x2a5e15=Date[_0xad8f('0x6e')]();fs[_0xad8f('0x6f')](util[_0xad8f('0x68')](_0xad8f('0x70'),_0xe10587['params']['id'],_0x2a5e15),_0x479559);_0x285623[_0xad8f('0x71')](_0xad8f('0x72'),_0xad8f('0x73')+util[_0xad8f('0x68')](_0xad8f('0x74'),_0xe10587[_0xad8f('0x47')]['id'],_0x2a5e15));_0x285623[_0xad8f('0x71')](_0xad8f('0x75'),'text/csv');return _0x285623['download'](util[_0xad8f('0x68')](_0xad8f('0x70'),_0xe10587[_0xad8f('0x47')]['id'],_0x2a5e15));}else{return _0x285623[_0xad8f('0x18')](0xcc);}})['catch'](handleError(_0x285623,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index 993e19c..62d5503 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 _0x52b8=['rimraf','./jscriptyProject.attributes','exports','define','JscriptyProject','jscripty_projects','lodash','util','../../config/logger','moment','bluebird'];(function(_0x547ea1,_0x2b5245){var _0x483330=function(_0x21b796){while(--_0x21b796){_0x547ea1['push'](_0x547ea1['shift']());}};_0x483330(++_0x2b5245);}(_0x52b8,0xd7));var _0x852b=function(_0x380ca9,_0x27db03){_0x380ca9=_0x380ca9-0x0;var _0xfc8089=_0x52b8[_0x380ca9];return _0xfc8089;};'use strict';var _=require(_0x852b('0x0'));var util=require(_0x852b('0x1'));var logger=require(_0x852b('0x2'))('api');var moment=require(_0x852b('0x3'));var BPromise=require(_0x852b('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x852b('0x5'));var config=require('../../config/environment');var attributes=require(_0x852b('0x6'));module[_0x852b('0x7')]=function(_0x39ee07,_0x1ebf77){return _0x39ee07[_0x852b('0x8')](_0x852b('0x9'),attributes,{'tableName':_0x852b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x872f=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','jscripty_projects','lodash'];(function(_0x3c37b3,_0x244416){var _0x3794a8=function(_0x1bce43){while(--_0x1bce43){_0x3c37b3['push'](_0x3c37b3['shift']());}};_0x3794a8(++_0x244416);}(_0x872f,0x143));var _0xf872=function(_0x3bb63a,_0x15af8f){_0x3bb63a=_0x3bb63a-0x0;var _0x3b822a=_0x872f[_0x3bb63a];return _0x3b822a;};'use strict';var _=require(_0xf872('0x0'));var util=require(_0xf872('0x1'));var logger=require(_0xf872('0x2'))(_0xf872('0x3'));var moment=require(_0xf872('0x4'));var BPromise=require(_0xf872('0x5'));var rp=require(_0xf872('0x6'));var fs=require('fs');var path=require(_0xf872('0x7'));var rimraf=require(_0xf872('0x8'));var config=require(_0xf872('0x9'));var attributes=require('./jscriptyProject.attributes');module[_0xf872('0xa')]=function(_0x51e579,_0x11759f){return _0x51e579['define']('JscriptyProject',attributes,{'tableName':_0xf872('0xb'),'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 245f5be..d35a214 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 _0x229d=['then','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','error','message','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','request'];(function(_0xf73c09,_0x4e424e){var _0xa8923c=function(_0x4831c1){while(--_0x4831c1){_0xf73c09['push'](_0xf73c09['shift']());}};_0xa8923c(++_0x4e424e);}(_0x229d,0x1ca));var _0xd229=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x229d[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0xd229('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xd229('0x1'));var rs=require(_0xd229('0x2'));var fs=require('fs');var Redis=require(_0xd229('0x3'));var db=require(_0xd229('0x4'))['db'];var utils=require(_0xd229('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xd229('0x6'));var jayson=require(_0xd229('0x7'));var client=jayson[_0xd229('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x155c11,_0x3de536,_0x42fd7e){return new BPromise(function(_0x4be1da,_0x15efa8){return client[_0xd229('0x9')](_0x155c11,_0x42fd7e)[_0xd229('0xa')](function(_0x2b721a){logger[_0xd229('0xb')](_0xd229('0xc'),_0x3de536,_0xd229('0xd'));logger[_0xd229('0xe')]('JscriptyProject,\x20%s,\x20%s,\x20%s',_0x3de536,_0xd229('0xd'),JSON['stringify'](_0x2b721a));if(_0x2b721a[_0xd229('0xf')]){if(_0x2b721a['error']['code']===0x1f4){logger['error'](_0xd229('0xc'),_0x3de536,_0x2b721a[_0xd229('0xf')]['message']);return _0x15efa8(_0x2b721a[_0xd229('0xf')][_0xd229('0x10')]);}logger[_0xd229('0xf')](_0xd229('0xc'),_0x3de536,_0x2b721a[_0xd229('0xf')][_0xd229('0x10')]);return _0x4be1da(_0x2b721a[_0xd229('0xf')][_0xd229('0x10')]);}else{logger['info']('JscriptyProject,\x20%s,\x20%s',_0x3de536,_0xd229('0xd'));_0x4be1da(_0x2b721a['result'][_0xd229('0x10')]);}})[_0xd229('0x11')](function(_0x2daf62){logger[_0xd229('0xf')](_0xd229('0xc'),_0x3de536,_0x2daf62);_0x15efa8(_0x2daf62);});});} \ No newline at end of file +var _0x19b5=['JscriptyProject,\x20%s,\x20%s','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','info'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x19b5,0x12a));var _0x519b=function(_0xe5f249,_0x50d0a2){_0xe5f249=_0xe5f249-0x0;var _0x130d89=_0x19b5[_0xe5f249];return _0x130d89;};'use strict';var _=require(_0x519b('0x0'));var util=require(_0x519b('0x1'));var moment=require(_0x519b('0x2'));var BPromise=require(_0x519b('0x3'));var rs=require(_0x519b('0x4'));var fs=require('fs');var Redis=require(_0x519b('0x5'));var db=require(_0x519b('0x6'))['db'];var utils=require(_0x519b('0x7'));var logger=require(_0x519b('0x8'))(_0x519b('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x519b('0xa')][_0x519b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x542cea,_0x4b77b7,_0x5894ea){return new BPromise(function(_0x8a3b56,_0xfdbbeb){return client[_0x519b('0xc')](_0x542cea,_0x5894ea)['then'](function(_0x47ee7d){logger[_0x519b('0xd')](_0x519b('0xe'),_0x4b77b7,'request\x20sent');logger[_0x519b('0xf')](_0x519b('0x10'),_0x4b77b7,_0x519b('0x11'),JSON[_0x519b('0x12')](_0x47ee7d));if(_0x47ee7d[_0x519b('0x13')]){if(_0x47ee7d[_0x519b('0x13')][_0x519b('0x14')]===0x1f4){logger[_0x519b('0x13')](_0x519b('0xe'),_0x4b77b7,_0x47ee7d[_0x519b('0x13')][_0x519b('0x15')]);return _0xfdbbeb(_0x47ee7d[_0x519b('0x13')][_0x519b('0x15')]);}logger[_0x519b('0x13')](_0x519b('0xe'),_0x4b77b7,_0x47ee7d[_0x519b('0x13')]['message']);return _0x8a3b56(_0x47ee7d[_0x519b('0x13')]['message']);}else{logger['info'](_0x519b('0xe'),_0x4b77b7,_0x519b('0x11'));_0x8a3b56(_0x47ee7d[_0x519b('0x16')][_0x519b('0x15')]);}})[_0x519b('0x17')](function(_0x3cddad){logger[_0x519b('0x13')](_0x519b('0xe'),_0x4b77b7,_0x3cddad);_0xfdbbeb(_0x3cddad);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 2efdbf0..634520f 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 _0x57df=['exports','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','get','isAuthenticated','index','/describe','describe','show','post','create','put','update','delete','destroy'];(function(_0xce2001,_0x53564f){var _0x439820=function(_0x22cfef){while(--_0x22cfef){_0xce2001['push'](_0xce2001['shift']());}};_0x439820(++_0x53564f);}(_0x57df,0x99));var _0xf57d=function(_0x35a11e,_0xb2f21c){_0x35a11e=_0x35a11e-0x0;var _0x175f9b=_0x57df[_0x35a11e];return _0x175f9b;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xf57d('0x0'));var express=require(_0xf57d('0x1'));var router=express['Router']();var auth=require(_0xf57d('0x2'));var interaction=require(_0xf57d('0x3'));var config=require(_0xf57d('0x4'));var controller=require(_0xf57d('0x5'));router[_0xf57d('0x6')]('/',auth[_0xf57d('0x7')](),controller[_0xf57d('0x8')]);router['get'](_0xf57d('0x9'),auth['isAuthenticated'](),controller[_0xf57d('0xa')]);router[_0xf57d('0x6')]('/:id',auth[_0xf57d('0x7')](),controller[_0xf57d('0xb')]);router[_0xf57d('0xc')]('/',auth['isAuthenticated'](),controller[_0xf57d('0xd')]);router[_0xf57d('0xe')]('/:id',auth['isAuthenticated'](),controller[_0xf57d('0xf')]);router[_0xf57d('0x10')]('/:id',auth[_0xf57d('0x7')](),controller[_0xf57d('0x11')]);module[_0xf57d('0x12')]=router; \ No newline at end of file +var _0xb63c=['../../config/environment','./jscriptyQuestionReport.controller','index','isAuthenticated','get','/:id','post','put','update','delete','exports','multer','util','connect-timeout','../../components/auth/service'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0xb63c,0x92));var _0xcb63=function(_0x644cf9,_0x338b30){_0x644cf9=_0x644cf9-0x0;var _0x1b09e5=_0xb63c[_0x644cf9];return _0x1b09e5;};'use strict';var multer=require(_0xcb63('0x0'));var util=require(_0xcb63('0x1'));var path=require('path');var timeout=require(_0xcb63('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0xcb63('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xcb63('0x4'));var controller=require(_0xcb63('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0xcb63('0x6')]);router['get']('/describe',auth[_0xcb63('0x7')](),controller['describe']);router[_0xcb63('0x8')](_0xcb63('0x9'),auth[_0xcb63('0x7')](),controller['show']);router[_0xcb63('0xa')]('/',auth[_0xcb63('0x7')](),controller['create']);router[_0xcb63('0xb')](_0xcb63('0x9'),auth[_0xcb63('0x7')](),controller[_0xcb63('0xc')]);router[_0xcb63('0xd')](_0xcb63('0x9'),auth[_0xcb63('0x7')](),controller['destroy']);module[_0xcb63('0xe')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index 917698d..11d2e96 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 _0xe986=['exports','TEXT','long','STRING'];(function(_0x282483,_0x59ee19){var _0x5d1b1f=function(_0x52bf16){while(--_0x52bf16){_0x282483['push'](_0x282483['shift']());}};_0x5d1b1f(++_0x59ee19);}(_0xe986,0x9c));var _0x6e98=function(_0x319209,_0x4907a3){_0x319209=_0x319209-0x0;var _0x2000c7=_0xe986[_0x319209];return _0x2000c7;};'use strict';var Sequelize=require('sequelize');module[_0x6e98('0x0')]={'question':{'type':Sequelize['STRING']},'answer':{'type':Sequelize[_0x6e98('0x1')](_0x6e98('0x2'))},'membername':{'type':Sequelize[_0x6e98('0x3')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x6e98('0x3')]},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x6e98('0x3')]},'questionId':{'type':Sequelize[_0x6e98('0x3')]}}; \ No newline at end of file +var _0x4bc7=['TEXT','exports','STRING'];(function(_0x36326d,_0x2bac19){var _0x495c5e=function(_0xe8dbb2){while(--_0xe8dbb2){_0x36326d['push'](_0x36326d['shift']());}};_0x495c5e(++_0x2bac19);}(_0x4bc7,0xee));var _0x74bc=function(_0x3eea50,_0x54d651){_0x3eea50=_0x3eea50-0x0;var _0x3f1f0e=_0x4bc7[_0x3eea50];return _0x3f1f0e;};'use strict';var Sequelize=require('sequelize');module[_0x74bc('0x0')]={'question':{'type':Sequelize[_0x74bc('0x1')]},'answer':{'type':Sequelize[_0x74bc('0x2')]('long')},'membername':{'type':Sequelize[_0x74bc('0x1')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x74bc('0x1')]},'uniqueid':{'type':Sequelize[_0x74bc('0x1')]},'calleridname':{'type':Sequelize[_0x74bc('0x1')]},'calleridnum':{'type':Sequelize[_0x74bc('0x1')]},'questionId':{'type':Sequelize[_0x74bc('0x1')]}}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js index 6d90f7d..9464284 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 _0x0d51=['zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','jsforce','desk.js','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','json','apply','reject','save','update','then','destroy','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','VIRTUAL','options','JscriptyQuestionReport','includeAll','include','findAll','rows','catch','show','params','fields','find','create','body','describe','html-pdf','eml-format','rimraf'];(function(_0x35cff0,_0x2e162c){var _0x4a9414=function(_0x569e67){while(--_0x569e67){_0x35cff0['push'](_0x35cff0['shift']());}};_0x4a9414(++_0x2e162c);}(_0x0d51,0xe1));var _0x10d5=function(_0x1793de,_0x4d7233){_0x1793de=_0x1793de-0x0;var _0x4f0309=_0x0d51[_0x1793de];return _0x4f0309;};'use strict';var pdf=require(_0x10d5('0x0'));var emlformat=require(_0x10d5('0x1'));var rimraf=require(_0x10d5('0x2'));var zipdir=require(_0x10d5('0x3'));var jsonpatch=require(_0x10d5('0x4'));var rp=require(_0x10d5('0x5'));var moment=require(_0x10d5('0x6'));var BPromise=require(_0x10d5('0x7'));var Mustache=require(_0x10d5('0x8'));var util=require(_0x10d5('0x9'));var path=require(_0x10d5('0xa'));var sox=require(_0x10d5('0xb'));var csv=require(_0x10d5('0xc'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x10d5('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x10d5('0xe'));var deskjs=require(_0x10d5('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x10d5('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x10d5('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x10d5('0x12'));var logger=require(_0x10d5('0x13'))(_0x10d5('0x14'));var utils=require(_0x10d5('0x15'));var config=require(_0x10d5('0x16'));var db=require(_0x10d5('0x17'))['db'];function respondWithStatusCode(_0x4fd46a,_0x473fc2){_0x473fc2=_0x473fc2||0xcc;return function(_0x37cd00){if(_0x37cd00){return _0x4fd46a[_0x10d5('0x18')](_0x473fc2);}return _0x4fd46a[_0x10d5('0x19')](_0x473fc2)[_0x10d5('0x1a')]();};}function respondWithResult(_0x147144,_0x22f29e){_0x22f29e=_0x22f29e||0xc8;return function(_0x17421d){if(_0x17421d){return _0x147144['status'](_0x22f29e)['json'](_0x17421d);}};}function respondWithFilteredResult(_0x1ecade,_0x5b5040){return function(_0x303f10){if(_0x303f10){var _0x1be580=_0x303f10[_0x10d5('0x1b')],_0x355220=_0x5b5040[_0x10d5('0x1c')],_0x579f0b=_0x5b5040[_0x10d5('0x1c')]+_0x5b5040[_0x10d5('0x1d')],_0x355241;if(_0x579f0b>=_0x1be580){_0x579f0b=_0x1be580;_0x355241=0xc8;}else{_0x355241=0xce;}_0x1ecade['status'](_0x355241);return _0x1ecade[_0x10d5('0x1e')]('Content-Range',_0x355220+'-'+_0x579f0b+'/'+_0x1be580)[_0x10d5('0x1f')](_0x303f10);}return null;};}function patchUpdates(_0xc6619a){return function(_0x310704){try{jsonpatch[_0x10d5('0x20')](_0x310704,_0xc6619a,!![]);}catch(_0x13ac62){return BPromise[_0x10d5('0x21')](_0x13ac62);}return _0x310704[_0x10d5('0x22')]();};}function saveUpdates(_0x37bd3c,_0x324254){return function(_0x5ea947){if(_0x5ea947){return _0x5ea947[_0x10d5('0x23')](_0x37bd3c)[_0x10d5('0x24')](function(_0x58f523){return _0x58f523;});}return null;};}function removeEntity(_0xa16a3d,_0x27438f){return function(_0x5c9d0b){if(_0x5c9d0b){return _0x5c9d0b[_0x10d5('0x25')]()['then'](function(){_0xa16a3d[_0x10d5('0x19')](0xcc)[_0x10d5('0x1a')]();});}};}function handleEntityNotFound(_0x58dd27,_0x58ea26){return function(_0x51c54e){if(!_0x51c54e){_0x58dd27['sendStatus'](0x194);}return _0x51c54e;};}function handleError(_0x5b8db0,_0x2fba44){_0x2fba44=_0x2fba44||0x1f4;return function(_0x1d1d77){logger[_0x10d5('0x26')](_0x1d1d77[_0x10d5('0x27')]);if(_0x1d1d77[_0x10d5('0x28')]){delete _0x1d1d77[_0x10d5('0x28')];}_0x5b8db0[_0x10d5('0x19')](_0x2fba44)[_0x10d5('0x29')](_0x1d1d77);};}exports['index']=function(_0x2b165c,_0x179e6e){var _0x1fd54d={},_0x464e79={},_0xcf3e14={'count':0x0,'rows':[]};var _0x3e8a81=_[_0x10d5('0x2a')](db['JscriptyQuestionReport'][_0x10d5('0x2b')],function(_0x2b2211){return{'name':_0x2b2211[_0x10d5('0x2c')],'type':_0x2b2211[_0x10d5('0x2d')][_0x10d5('0x2e')]};});_0x464e79[_0x10d5('0x2f')]=_[_0x10d5('0x2a')](_0x3e8a81,'name');_0x464e79[_0x10d5('0x30')]=_[_0x10d5('0x31')](_0x2b165c[_0x10d5('0x30')]);_0x464e79[_0x10d5('0x32')]=_[_0x10d5('0x33')](_0x464e79[_0x10d5('0x2f')],_0x464e79[_0x10d5('0x30')]);_0x1fd54d[_0x10d5('0x34')]=_[_0x10d5('0x33')](_0x464e79[_0x10d5('0x2f')],qs['fields'](_0x2b165c[_0x10d5('0x30')]['fields']));_0x1fd54d[_0x10d5('0x34')]=_0x1fd54d['attributes'][_0x10d5('0x35')]?_0x1fd54d[_0x10d5('0x34')]:_0x464e79['model'];if(!_0x2b165c[_0x10d5('0x30')][_0x10d5('0x36')](_0x10d5('0x37'))){_0x1fd54d['limit']=qs[_0x10d5('0x1d')](_0x2b165c[_0x10d5('0x30')]['limit']);_0x1fd54d['offset']=qs[_0x10d5('0x1c')](_0x2b165c['query'][_0x10d5('0x1c')]);}_0x1fd54d[_0x10d5('0x38')]=qs[_0x10d5('0x39')](_0x2b165c[_0x10d5('0x30')][_0x10d5('0x39')]);_0x1fd54d['where']=qs[_0x10d5('0x32')](_[_0x10d5('0x3a')](_0x2b165c[_0x10d5('0x30')],_0x464e79[_0x10d5('0x32')]));if(_0x2b165c[_0x10d5('0x30')][_0x10d5('0x3b')]){_0x1fd54d['where']=_[_0x10d5('0x3c')](_0x1fd54d['where'],{'$or':_[_0x10d5('0x2a')](_0x3e8a81,function(_0x440b07){if(_0x440b07[_0x10d5('0x2d')]!==_0x10d5('0x3d')){var _0x2dbf70={};_0x2dbf70[_0x440b07[_0x10d5('0x28')]]={'$like':'%'+_0x2b165c[_0x10d5('0x30')][_0x10d5('0x3b')]+'%'};return _0x2dbf70;}})});}_0x1fd54d=_['merge']({},_0x1fd54d,_0x2b165c[_0x10d5('0x3e')]);var _0x2b9519={'where':_0x1fd54d['where']};return db[_0x10d5('0x3f')][_0x10d5('0x1b')](_0x2b9519)[_0x10d5('0x24')](function(_0x160521){_0xcf3e14['count']=_0x160521;if(_0x2b165c[_0x10d5('0x30')][_0x10d5('0x40')]){_0x1fd54d[_0x10d5('0x41')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0x10d5('0x42')](_0x1fd54d);})[_0x10d5('0x24')](function(_0x2675ea){_0xcf3e14[_0x10d5('0x43')]=_0x2675ea;return _0xcf3e14;})[_0x10d5('0x24')](respondWithFilteredResult(_0x179e6e,_0x1fd54d))[_0x10d5('0x44')](handleError(_0x179e6e,null));};exports[_0x10d5('0x45')]=function(_0x13512a,_0x25c0e5){var _0x54ef75={'raw':!![],'where':{'id':_0x13512a[_0x10d5('0x46')]['id']}},_0x35e51c={};_0x35e51c[_0x10d5('0x2f')]=_[_0x10d5('0x31')](db[_0x10d5('0x3f')][_0x10d5('0x2b')]);_0x35e51c[_0x10d5('0x30')]=_[_0x10d5('0x31')](_0x13512a[_0x10d5('0x30')]);_0x35e51c['filters']=_[_0x10d5('0x33')](_0x35e51c[_0x10d5('0x2f')],_0x35e51c[_0x10d5('0x30')]);_0x54ef75[_0x10d5('0x34')]=_[_0x10d5('0x33')](_0x35e51c[_0x10d5('0x2f')],qs[_0x10d5('0x47')](_0x13512a[_0x10d5('0x30')]['fields']));_0x54ef75[_0x10d5('0x34')]=_0x54ef75[_0x10d5('0x34')][_0x10d5('0x35')]?_0x54ef75[_0x10d5('0x34')]:_0x35e51c['model'];if(_0x13512a['query'][_0x10d5('0x40')]){_0x54ef75[_0x10d5('0x41')]=[{'all':!![]}];}_0x54ef75=_[_0x10d5('0x3c')]({},_0x54ef75,_0x13512a['options']);return db['JscriptyQuestionReport'][_0x10d5('0x48')](_0x54ef75)[_0x10d5('0x24')](handleEntityNotFound(_0x25c0e5,null))['then'](respondWithResult(_0x25c0e5,null))[_0x10d5('0x44')](handleError(_0x25c0e5,null));};exports[_0x10d5('0x49')]=function(_0x1cc17e,_0x411ba3){return db[_0x10d5('0x3f')][_0x10d5('0x49')](_0x1cc17e[_0x10d5('0x4a')],{})[_0x10d5('0x24')](respondWithResult(_0x411ba3,0xc9))[_0x10d5('0x44')](handleError(_0x411ba3,null));};exports[_0x10d5('0x23')]=function(_0x2ec65e,_0x51231a){if(_0x2ec65e[_0x10d5('0x4a')]['id']){delete _0x2ec65e[_0x10d5('0x4a')]['id'];}return db[_0x10d5('0x3f')]['find']({'where':{'id':_0x2ec65e['params']['id']}})[_0x10d5('0x24')](handleEntityNotFound(_0x51231a,null))['then'](saveUpdates(_0x2ec65e[_0x10d5('0x4a')],null))['then'](respondWithResult(_0x51231a,null))[_0x10d5('0x44')](handleError(_0x51231a,null));};exports[_0x10d5('0x25')]=function(_0x280d63,_0x20054c){return db['JscriptyQuestionReport'][_0x10d5('0x48')]({'where':{'id':_0x280d63[_0x10d5('0x46')]['id']}})[_0x10d5('0x24')](handleEntityNotFound(_0x20054c,null))[_0x10d5('0x24')](removeEntity(_0x20054c,null))[_0x10d5('0x44')](handleError(_0x20054c,null));};exports[_0x10d5('0x4b')]=function(_0x4f5617,_0x14ce5e){return db[_0x10d5('0x3f')][_0x10d5('0x4b')]()[_0x10d5('0x24')](respondWithResult(_0x14ce5e,null))[_0x10d5('0x44')](handleError(_0x14ce5e,null));}; \ No newline at end of file +var _0x5862=['rawAttributes','include','find','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','lodash','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','apply','reject','update','then','destroy','error','stack','name','send','index','map','JscriptyQuestionReport','fieldName','type','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','merge','where','VIRTUAL','filter','options','count','includeAll','findAll','rows','catch','params','keys'];(function(_0x15fc7a,_0xd21741){var _0x3aa9f4=function(_0x313108){while(--_0x313108){_0x15fc7a['push'](_0x15fc7a['shift']());}};_0x3aa9f4(++_0xd21741);}(_0x5862,0x169));var _0x2586=function(_0x484032,_0x11ce70){_0x484032=_0x484032-0x0;var _0xec7c10=_0x5862[_0x484032];return _0xec7c10;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x2586('0x0'));var rimraf=require(_0x2586('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2586('0x2'));var rp=require(_0x2586('0x3'));var moment=require(_0x2586('0x4'));var BPromise=require(_0x2586('0x5'));var Mustache=require(_0x2586('0x6'));var util=require(_0x2586('0x7'));var path=require('path');var sox=require(_0x2586('0x8'));var csv=require(_0x2586('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x2586('0xa'));var squel=require('squel');var crypto=require(_0x2586('0xb'));var jsforce=require(_0x2586('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x2586('0xd'));var Papa=require(_0x2586('0xe'));var Redis=require('ioredis');var authService=require(_0x2586('0xf'));var qs=require(_0x2586('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x2586('0x11'))(_0x2586('0x12'));var utils=require(_0x2586('0x13'));var config=require(_0x2586('0x14'));var db=require(_0x2586('0x15'))['db'];function respondWithStatusCode(_0x3d0ba7,_0x5aaf18){_0x5aaf18=_0x5aaf18||0xcc;return function(_0x26bbae){if(_0x26bbae){return _0x3d0ba7[_0x2586('0x16')](_0x5aaf18);}return _0x3d0ba7[_0x2586('0x17')](_0x5aaf18)[_0x2586('0x18')]();};}function respondWithResult(_0x5cf69e,_0x2c32e0){_0x2c32e0=_0x2c32e0||0xc8;return function(_0xe4359e){if(_0xe4359e){return _0x5cf69e[_0x2586('0x17')](_0x2c32e0)[_0x2586('0x19')](_0xe4359e);}};}function respondWithFilteredResult(_0x64902e,_0x18809c){return function(_0x529a15){if(_0x529a15){var _0x2381ea=_0x529a15['count'],_0x4a7fd1=_0x18809c[_0x2586('0x1a')],_0x2df46c=_0x18809c['offset']+_0x18809c[_0x2586('0x1b')],_0x3a0d0a;if(_0x2df46c>=_0x2381ea){_0x2df46c=_0x2381ea;_0x3a0d0a=0xc8;}else{_0x3a0d0a=0xce;}_0x64902e[_0x2586('0x17')](_0x3a0d0a);return _0x64902e[_0x2586('0x1c')]('Content-Range',_0x4a7fd1+'-'+_0x2df46c+'/'+_0x2381ea)[_0x2586('0x19')](_0x529a15);}return null;};}function patchUpdates(_0xc3c4f0){return function(_0x4c03f9){try{jsonpatch[_0x2586('0x1d')](_0x4c03f9,_0xc3c4f0,!![]);}catch(_0xaea16b){return BPromise[_0x2586('0x1e')](_0xaea16b);}return _0x4c03f9['save']();};}function saveUpdates(_0x1ea75b,_0x366f45){return function(_0x30ca60){if(_0x30ca60){return _0x30ca60[_0x2586('0x1f')](_0x1ea75b)[_0x2586('0x20')](function(_0x53e0c3){return _0x53e0c3;});}return null;};}function removeEntity(_0x4c0e36,_0x439708){return function(_0x1bcd6e){if(_0x1bcd6e){return _0x1bcd6e[_0x2586('0x21')]()[_0x2586('0x20')](function(){_0x4c0e36[_0x2586('0x17')](0xcc)[_0x2586('0x18')]();});}};}function handleEntityNotFound(_0x4d7928,_0x2c3249){return function(_0x5b4e61){if(!_0x5b4e61){_0x4d7928['sendStatus'](0x194);}return _0x5b4e61;};}function handleError(_0x4cb7f5,_0x391250){_0x391250=_0x391250||0x1f4;return function(_0x58149f){logger[_0x2586('0x22')](_0x58149f[_0x2586('0x23')]);if(_0x58149f['name']){delete _0x58149f[_0x2586('0x24')];}_0x4cb7f5['status'](_0x391250)[_0x2586('0x25')](_0x58149f);};}exports[_0x2586('0x26')]=function(_0x101568,_0x36a288){var _0x22bd2e={},_0x21d8d2={},_0x4c6abe={'count':0x0,'rows':[]};var _0x150e67=_[_0x2586('0x27')](db[_0x2586('0x28')]['rawAttributes'],function(_0x24421c){return{'name':_0x24421c[_0x2586('0x29')],'type':_0x24421c[_0x2586('0x2a')]['key']};});_0x21d8d2[_0x2586('0x2b')]=_[_0x2586('0x27')](_0x150e67,_0x2586('0x24'));_0x21d8d2[_0x2586('0x2c')]=_['keys'](_0x101568['query']);_0x21d8d2[_0x2586('0x2d')]=_[_0x2586('0x2e')](_0x21d8d2[_0x2586('0x2b')],_0x21d8d2[_0x2586('0x2c')]);_0x22bd2e[_0x2586('0x2f')]=_[_0x2586('0x2e')](_0x21d8d2[_0x2586('0x2b')],qs[_0x2586('0x30')](_0x101568[_0x2586('0x2c')]['fields']));_0x22bd2e['attributes']=_0x22bd2e[_0x2586('0x2f')][_0x2586('0x31')]?_0x22bd2e[_0x2586('0x2f')]:_0x21d8d2[_0x2586('0x2b')];if(!_0x101568[_0x2586('0x2c')]['hasOwnProperty'](_0x2586('0x32'))){_0x22bd2e[_0x2586('0x1b')]=qs['limit'](_0x101568[_0x2586('0x2c')][_0x2586('0x1b')]);_0x22bd2e['offset']=qs[_0x2586('0x1a')](_0x101568[_0x2586('0x2c')][_0x2586('0x1a')]);}_0x22bd2e[_0x2586('0x33')]=qs[_0x2586('0x34')](_0x101568[_0x2586('0x2c')][_0x2586('0x34')]);_0x22bd2e['where']=qs['filters'](_['pick'](_0x101568[_0x2586('0x2c')],_0x21d8d2[_0x2586('0x2d')]));if(_0x101568[_0x2586('0x2c')]['filter']){_0x22bd2e['where']=_[_0x2586('0x35')](_0x22bd2e[_0x2586('0x36')],{'$or':_[_0x2586('0x27')](_0x150e67,function(_0x2aff41){if(_0x2aff41['type']!==_0x2586('0x37')){var _0x3c19c6={};_0x3c19c6[_0x2aff41[_0x2586('0x24')]]={'$like':'%'+_0x101568[_0x2586('0x2c')][_0x2586('0x38')]+'%'};return _0x3c19c6;}})});}_0x22bd2e=_['merge']({},_0x22bd2e,_0x101568[_0x2586('0x39')]);var _0x1a1f68={'where':_0x22bd2e[_0x2586('0x36')]};return db['JscriptyQuestionReport']['count'](_0x1a1f68)[_0x2586('0x20')](function(_0x11698d){_0x4c6abe[_0x2586('0x3a')]=_0x11698d;if(_0x101568[_0x2586('0x2c')][_0x2586('0x3b')]){_0x22bd2e['include']=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0x2586('0x3c')](_0x22bd2e);})[_0x2586('0x20')](function(_0x93bfd5){_0x4c6abe[_0x2586('0x3d')]=_0x93bfd5;return _0x4c6abe;})['then'](respondWithFilteredResult(_0x36a288,_0x22bd2e))[_0x2586('0x3e')](handleError(_0x36a288,null));};exports['show']=function(_0x5b4725,_0x4b18e3){var _0x15a18c={'raw':!![],'where':{'id':_0x5b4725[_0x2586('0x3f')]['id']}},_0xc9b2bd={};_0xc9b2bd[_0x2586('0x2b')]=_[_0x2586('0x40')](db[_0x2586('0x28')][_0x2586('0x41')]);_0xc9b2bd[_0x2586('0x2c')]=_[_0x2586('0x40')](_0x5b4725['query']);_0xc9b2bd[_0x2586('0x2d')]=_['intersection'](_0xc9b2bd[_0x2586('0x2b')],_0xc9b2bd[_0x2586('0x2c')]);_0x15a18c[_0x2586('0x2f')]=_[_0x2586('0x2e')](_0xc9b2bd[_0x2586('0x2b')],qs['fields'](_0x5b4725[_0x2586('0x2c')][_0x2586('0x30')]));_0x15a18c[_0x2586('0x2f')]=_0x15a18c['attributes'][_0x2586('0x31')]?_0x15a18c[_0x2586('0x2f')]:_0xc9b2bd[_0x2586('0x2b')];if(_0x5b4725[_0x2586('0x2c')]['includeAll']){_0x15a18c[_0x2586('0x42')]=[{'all':!![]}];}_0x15a18c=_[_0x2586('0x35')]({},_0x15a18c,_0x5b4725[_0x2586('0x39')]);return db['JscriptyQuestionReport'][_0x2586('0x43')](_0x15a18c)[_0x2586('0x20')](handleEntityNotFound(_0x4b18e3,null))[_0x2586('0x20')](respondWithResult(_0x4b18e3,null))['catch'](handleError(_0x4b18e3,null));};exports[_0x2586('0x44')]=function(_0x1358c5,_0x87d15b){return db[_0x2586('0x28')]['create'](_0x1358c5['body'],{})['then'](respondWithResult(_0x87d15b,0xc9))['catch'](handleError(_0x87d15b,null));};exports['update']=function(_0x2c9292,_0x6ad67){if(_0x2c9292[_0x2586('0x45')]['id']){delete _0x2c9292[_0x2586('0x45')]['id'];}return db[_0x2586('0x28')][_0x2586('0x43')]({'where':{'id':_0x2c9292[_0x2586('0x3f')]['id']}})['then'](handleEntityNotFound(_0x6ad67,null))[_0x2586('0x20')](saveUpdates(_0x2c9292[_0x2586('0x45')],null))['then'](respondWithResult(_0x6ad67,null))['catch'](handleError(_0x6ad67,null));};exports['destroy']=function(_0x51b039,_0x3cc034){return db['JscriptyQuestionReport']['find']({'where':{'id':_0x51b039[_0x2586('0x3f')]['id']}})[_0x2586('0x20')](handleEntityNotFound(_0x3cc034,null))[_0x2586('0x20')](removeEntity(_0x3cc034,null))[_0x2586('0x3e')](handleError(_0x3cc034,null));};exports[_0x2586('0x46')]=function(_0x11ffa3,_0x3dffa9){return db[_0x2586('0x28')][_0x2586('0x46')]()[_0x2586('0x20')](respondWithResult(_0x3dffa9,null))[_0x2586('0x3e')](handleError(_0x3dffa9,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 3044546..03c5a4c 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 _0xd952=['moment','bluebird','path','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','define','report_jscripty_questions','lodash','util','../../config/logger'];(function(_0x247fba,_0xa355ba){var _0x5ac525=function(_0x481605){while(--_0x481605){_0x247fba['push'](_0x247fba['shift']());}};_0x5ac525(++_0xa355ba);}(_0xd952,0xd9));var _0x2d95=function(_0x2debcc,_0x286edd){_0x2debcc=_0x2debcc-0x0;var _0x379535=_0xd952[_0x2debcc];return _0x379535;};'use strict';var _=require(_0x2d95('0x0'));var util=require(_0x2d95('0x1'));var logger=require(_0x2d95('0x2'))('api');var moment=require(_0x2d95('0x3'));var BPromise=require(_0x2d95('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2d95('0x5'));var rimraf=require(_0x2d95('0x6'));var config=require(_0x2d95('0x7'));var attributes=require(_0x2d95('0x8'));module['exports']=function(_0x42507d,_0x1b0da){return _0x42507d[_0x2d95('0x9')]('JscriptyQuestionReport',attributes,{'tableName':_0x2d95('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xab5b=['report_jscripty_questions','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','JscriptyQuestionReport'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xab5b,0x109));var _0xbab5=function(_0x1aec04,_0x2b5a76){_0x1aec04=_0x1aec04-0x0;var _0xa59c2d=_0xab5b[_0x1aec04];return _0xa59c2d;};'use strict';var _=require(_0xbab5('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xbab5('0x1'));var moment=require(_0xbab5('0x2'));var BPromise=require(_0xbab5('0x3'));var rp=require(_0xbab5('0x4'));var fs=require('fs');var path=require(_0xbab5('0x5'));var rimraf=require(_0xbab5('0x6'));var config=require(_0xbab5('0x7'));var attributes=require('./jscriptyQuestionReport.attributes');module[_0xbab5('0x8')]=function(_0x579caf,_0x58452a){return _0x579caf[_0xbab5('0x9')](_0xbab5('0xa'),attributes,{'tableName':_0xbab5('0xb'),'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 b0c1707..0f0bebc 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 _0x0676=['jayson/promise','client','http','request','then','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x2e3dfc,_0x454d6c){var _0x4b1245=function(_0x5e9faa){while(--_0x5e9faa){_0x2e3dfc['push'](_0x2e3dfc['shift']());}};_0x4b1245(++_0x454d6c);}(_0x0676,0xff));var _0x6067=function(_0x209990,_0x15cba3){_0x209990=_0x209990-0x0;var _0x5b2325=_0x0676[_0x209990];return _0x5b2325;};'use strict';var _=require(_0x6067('0x0'));var util=require(_0x6067('0x1'));var moment=require('moment');var BPromise=require(_0x6067('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6067('0x3'));var db=require(_0x6067('0x4'))['db'];var utils=require(_0x6067('0x5'));var logger=require(_0x6067('0x6'))(_0x6067('0x7'));var config=require(_0x6067('0x8'));var jayson=require(_0x6067('0x9'));var client=jayson[_0x6067('0xa')][_0x6067('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x220aaa,_0x3d0585,_0x15d108){return new BPromise(function(_0x590d30,_0x5a2fc0){return client[_0x6067('0xc')](_0x220aaa,_0x15d108)[_0x6067('0xd')](function(_0x3c9b74){logger[_0x6067('0xe')](_0x6067('0xf'),_0x3d0585,_0x6067('0x10'));logger[_0x6067('0x11')](_0x6067('0x12'),_0x3d0585,_0x6067('0x10'),JSON['stringify'](_0x3c9b74));if(_0x3c9b74['error']){if(_0x3c9b74[_0x6067('0x13')][_0x6067('0x14')]===0x1f4){logger[_0x6067('0x13')](_0x6067('0xf'),_0x3d0585,_0x3c9b74[_0x6067('0x13')][_0x6067('0x15')]);return _0x5a2fc0(_0x3c9b74[_0x6067('0x13')][_0x6067('0x15')]);}logger[_0x6067('0x13')](_0x6067('0xf'),_0x3d0585,_0x3c9b74[_0x6067('0x13')][_0x6067('0x15')]);return _0x590d30(_0x3c9b74[_0x6067('0x13')][_0x6067('0x15')]);}else{logger[_0x6067('0xe')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x3d0585,_0x6067('0x10'));_0x590d30(_0x3c9b74[_0x6067('0x16')][_0x6067('0x15')]);}})[_0x6067('0x17')](function(_0x56b3f9){logger[_0x6067('0x13')](_0x6067('0xf'),_0x3d0585,_0x56b3f9);_0x5a2fc0(_0x56b3f9);});});} \ No newline at end of file +var _0x9c1e=['http','request','JscriptyQuestionReport,\x20%s,\x20%s','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client'];(function(_0x382e89,_0x4768c0){var _0x3a1318=function(_0x79e1ce){while(--_0x79e1ce){_0x382e89['push'](_0x382e89['shift']());}};_0x3a1318(++_0x4768c0);}(_0x9c1e,0xae));var _0xe9c1=function(_0xbcf1e4,_0x55703){_0xbcf1e4=_0xbcf1e4-0x0;var _0x3d8626=_0x9c1e[_0xbcf1e4];return _0x3d8626;};'use strict';var _=require(_0xe9c1('0x0'));var util=require('util');var moment=require(_0xe9c1('0x1'));var BPromise=require(_0xe9c1('0x2'));var rs=require(_0xe9c1('0x3'));var fs=require('fs');var Redis=require(_0xe9c1('0x4'));var db=require(_0xe9c1('0x5'))['db'];var utils=require(_0xe9c1('0x6'));var logger=require(_0xe9c1('0x7'))(_0xe9c1('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xe9c1('0x9')][_0xe9c1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x42104f,_0x426500,_0x16e9ee){return new BPromise(function(_0x325872,_0x1fbbd7){return client[_0xe9c1('0xb')](_0x42104f,_0x16e9ee)['then'](function(_0x24570f){logger['info'](_0xe9c1('0xc'),_0x426500,'request\x20sent');logger[_0xe9c1('0xd')](_0xe9c1('0xe'),_0x426500,'request\x20sent',JSON[_0xe9c1('0xf')](_0x24570f));if(_0x24570f[_0xe9c1('0x10')]){if(_0x24570f[_0xe9c1('0x10')][_0xe9c1('0x11')]===0x1f4){logger[_0xe9c1('0x10')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x426500,_0x24570f[_0xe9c1('0x10')][_0xe9c1('0x12')]);return _0x1fbbd7(_0x24570f[_0xe9c1('0x10')][_0xe9c1('0x12')]);}logger[_0xe9c1('0x10')](_0xe9c1('0xc'),_0x426500,_0x24570f[_0xe9c1('0x10')][_0xe9c1('0x12')]);return _0x325872(_0x24570f[_0xe9c1('0x10')][_0xe9c1('0x12')]);}else{logger[_0xe9c1('0x13')](_0xe9c1('0xc'),_0x426500,_0xe9c1('0x14'));_0x325872(_0x24570f[_0xe9c1('0x15')][_0xe9c1('0x12')]);}})[_0xe9c1('0x16')](function(_0x5d4722){logger[_0xe9c1('0x10')](_0xe9c1('0xc'),_0x426500,_0x5d4722);_0x1fbbd7(_0x5d4722);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 421f8c3..ea02ffc 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 _0xd58c=['isAuthenticated','index','describe','/:id','/:id/questions','getQuestions','create','put','delete','destroy','exports','multer','util','path','express','../../components/auth/service','../../config/environment','./jscriptySessionReport.controller','get'];(function(_0x4ba6f9,_0x4016fd){var _0x2ba828=function(_0x58f147){while(--_0x58f147){_0x4ba6f9['push'](_0x4ba6f9['shift']());}};_0x2ba828(++_0x4016fd);}(_0xd58c,0xb6));var _0xcd58=function(_0x4e341a,_0x3c2382){_0x4e341a=_0x4e341a-0x0;var _0x15f550=_0xd58c[_0x4e341a];return _0x15f550;};'use strict';var multer=require(_0xcd58('0x0'));var util=require(_0xcd58('0x1'));var path=require(_0xcd58('0x2'));var timeout=require('connect-timeout');var express=require(_0xcd58('0x3'));var router=express['Router']();var auth=require(_0xcd58('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xcd58('0x5'));var controller=require(_0xcd58('0x6'));router[_0xcd58('0x7')]('/',auth[_0xcd58('0x8')](),controller[_0xcd58('0x9')]);router['get']('/describe',auth[_0xcd58('0x8')](),controller[_0xcd58('0xa')]);router[_0xcd58('0x7')](_0xcd58('0xb'),auth[_0xcd58('0x8')](),controller['show']);router[_0xcd58('0x7')](_0xcd58('0xc'),auth['isAuthenticated'](),controller[_0xcd58('0xd')]);router['post']('/',auth[_0xcd58('0x8')](),controller[_0xcd58('0xe')]);router[_0xcd58('0xf')]('/:id',auth[_0xcd58('0x8')](),controller['update']);router[_0xcd58('0x10')]('/:id',auth[_0xcd58('0x8')](),controller[_0xcd58('0x11')]);module[_0xcd58('0x12')]=router; \ No newline at end of file +var _0x5455=['getQuestions','post','create','put','update','delete','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/describe','/:id','show','/:id/questions'];(function(_0x2ec068,_0x177353){var _0x1b1558=function(_0x5e13fc){while(--_0x5e13fc){_0x2ec068['push'](_0x2ec068['shift']());}};_0x1b1558(++_0x177353);}(_0x5455,0x197));var _0x5545=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x5455[_0x199572];return _0x13cfa3;};'use strict';var multer=require('multer');var util=require(_0x5545('0x0'));var path=require(_0x5545('0x1'));var timeout=require(_0x5545('0x2'));var express=require(_0x5545('0x3'));var router=express[_0x5545('0x4')]();var auth=require(_0x5545('0x5'));var interaction=require(_0x5545('0x6'));var config=require('../../config/environment');var controller=require('./jscriptySessionReport.controller');router[_0x5545('0x7')]('/',auth[_0x5545('0x8')](),controller['index']);router['get'](_0x5545('0x9'),auth[_0x5545('0x8')](),controller['describe']);router[_0x5545('0x7')](_0x5545('0xa'),auth['isAuthenticated'](),controller[_0x5545('0xb')]);router[_0x5545('0x7')](_0x5545('0xc'),auth[_0x5545('0x8')](),controller[_0x5545('0xd')]);router[_0x5545('0xe')]('/',auth[_0x5545('0x8')](),controller[_0x5545('0xf')]);router[_0x5545('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x5545('0x11')]);router[_0x5545('0x12')](_0x5545('0xa'),auth[_0x5545('0x8')](),controller['destroy']);module[_0x5545('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 75a40e6..12e8bea 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 _0x03d4=['STRING','moment','sequelize','exports','DATE','setDataValue','starttime','endtime','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x3ab353,_0x5d5283){var _0x1e2285=function(_0x55804f){while(--_0x55804f){_0x3ab353['push'](_0x3ab353['shift']());}};_0x1e2285(++_0x5d5283);}(_0x03d4,0xf4));var _0x403d=function(_0x1a597e,_0xf1346b){_0x1a597e=_0x1a597e-0x0;var _0xc5ab41=_0x03d4[_0x1a597e];return _0xc5ab41;};'use strict';var moment=require(_0x403d('0x0'));var Sequelize=require(_0x403d('0x1'));module[_0x403d('0x2')]={'starttime':{'type':Sequelize[_0x403d('0x3')],'set':function(_0x308406){this[_0x403d('0x4')](_0x403d('0x5'),_0x308406);this[_0x403d('0x4')](_0x403d('0x6'),moment()['format'](_0x403d('0x7')));}},'endtime':{'type':Sequelize[_0x403d('0x3')]},'membername':{'type':Sequelize[_0x403d('0x8')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x403d('0x8')]},'calleridname':{'type':Sequelize[_0x403d('0x8')]},'calleridnum':{'type':Sequelize[_0x403d('0x8')]},'completed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xbaa1=['endtime','DATE','STRING','moment','exports','setDataValue'];(function(_0x38831b,_0x4611ea){var _0x5a508a=function(_0x2df441){while(--_0x2df441){_0x38831b['push'](_0x38831b['shift']());}};_0x5a508a(++_0x4611ea);}(_0xbaa1,0xcf));var _0x1baa=function(_0x54a129,_0x5bec9c){_0x54a129=_0x54a129-0x0;var _0x2f5d97=_0xbaa1[_0x54a129];return _0x2f5d97;};'use strict';var moment=require(_0x1baa('0x0'));var Sequelize=require('sequelize');module[_0x1baa('0x1')]={'starttime':{'type':Sequelize['DATE'],'set':function(_0x7cf160){this[_0x1baa('0x2')]('starttime',_0x7cf160);this[_0x1baa('0x2')](_0x1baa('0x3'),moment()['format']('YYYY-MM-DD\x20HH:mm:ss'));}},'endtime':{'type':Sequelize[_0x1baa('0x4')]},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize[_0x1baa('0x5')]},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x1baa('0x5')]},'calleridname':{'type':Sequelize[_0x1baa('0x5')]},'calleridnum':{'type':Sequelize['STRING']},'completed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index c4677c5..6b31395 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 _0x252b=['fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','VIRTUAL','count','includeAll','include','findAll','rows','catch','show','params','merge','create','body','find','describe','getQuestions','findOne','JscriptyQuestionReport','length','SessionId','options','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','JscriptySessionReport'];(function(_0x433a86,_0x175b5c){var _0x23000c=function(_0x4b1fa0){while(--_0x4b1fa0){_0x433a86['push'](_0x433a86['shift']());}};_0x23000c(++_0x175b5c);}(_0x252b,0x119));var _0xb252=function(_0x5df25b,_0x1bc928){_0x5df25b=_0x5df25b-0x0;var _0x19f252=_0x252b[_0x5df25b];return _0x19f252;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xb252('0x0'));var rimraf=require(_0xb252('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb252('0x2'));var rp=require(_0xb252('0x3'));var moment=require('moment');var BPromise=require(_0xb252('0x4'));var Mustache=require(_0xb252('0x5'));var util=require(_0xb252('0x6'));var path=require('path');var sox=require(_0xb252('0x7'));var csv=require(_0xb252('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xb252('0x9'));var squel=require('squel');var crypto=require(_0xb252('0xa'));var jsforce=require(_0xb252('0xb'));var deskjs=require(_0xb252('0xc'));var toCsv=require('to-csv');var querystring=require(_0xb252('0xd'));var Papa=require(_0xb252('0xe'));var Redis=require(_0xb252('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xb252('0x10'));var as=require(_0xb252('0x11'));var hardwareService=require(_0xb252('0x12'));var logger=require(_0xb252('0x13'))(_0xb252('0x14'));var utils=require(_0xb252('0x15'));var config=require(_0xb252('0x16'));var db=require(_0xb252('0x17'))['db'];function respondWithStatusCode(_0x1ebb5f,_0x4fbb92){_0x4fbb92=_0x4fbb92||0xcc;return function(_0x1df046){if(_0x1df046){return _0x1ebb5f[_0xb252('0x18')](_0x4fbb92);}return _0x1ebb5f[_0xb252('0x19')](_0x4fbb92)[_0xb252('0x1a')]();};}function respondWithResult(_0x2deb27,_0x44142a){_0x44142a=_0x44142a||0xc8;return function(_0x348e33){if(_0x348e33){return _0x2deb27[_0xb252('0x19')](_0x44142a)[_0xb252('0x1b')](_0x348e33);}};}function respondWithFilteredResult(_0x437156,_0x1d47fb){return function(_0xf06028){if(_0xf06028){var _0x3da747=_0xf06028['count'],_0x55319b=_0x1d47fb[_0xb252('0x1c')],_0x31b105=_0x1d47fb[_0xb252('0x1c')]+_0x1d47fb['limit'],_0x2c37bd;if(_0x31b105>=_0x3da747){_0x31b105=_0x3da747;_0x2c37bd=0xc8;}else{_0x2c37bd=0xce;}_0x437156[_0xb252('0x19')](_0x2c37bd);return _0x437156[_0xb252('0x1d')](_0xb252('0x1e'),_0x55319b+'-'+_0x31b105+'/'+_0x3da747)[_0xb252('0x1b')](_0xf06028);}return null;};}function patchUpdates(_0xcb36b5){return function(_0xa66884){try{jsonpatch[_0xb252('0x1f')](_0xa66884,_0xcb36b5,!![]);}catch(_0x3677f9){return BPromise[_0xb252('0x20')](_0x3677f9);}return _0xa66884[_0xb252('0x21')]();};}function saveUpdates(_0x2be149,_0x15f497){return function(_0x14494b){if(_0x14494b){return _0x14494b[_0xb252('0x22')](_0x2be149)[_0xb252('0x23')](function(_0x4e66e5){return _0x4e66e5;});}return null;};}function removeEntity(_0x19f17b,_0x4bb978){return function(_0x509cb5){if(_0x509cb5){return _0x509cb5[_0xb252('0x24')]()[_0xb252('0x23')](function(){_0x19f17b[_0xb252('0x19')](0xcc)[_0xb252('0x1a')]();});}};}function handleEntityNotFound(_0x6288ca,_0x349076){return function(_0x224d7e){if(!_0x224d7e){_0x6288ca['sendStatus'](0x194);}return _0x224d7e;};}function handleError(_0x520d5c,_0x58340a){_0x58340a=_0x58340a||0x1f4;return function(_0x596d7d){logger[_0xb252('0x25')](_0x596d7d['stack']);if(_0x596d7d[_0xb252('0x26')]){delete _0x596d7d[_0xb252('0x26')];}_0x520d5c[_0xb252('0x19')](_0x58340a)[_0xb252('0x27')](_0x596d7d);};}exports[_0xb252('0x28')]=function(_0xad39af,_0x4176d2){var _0x1a4f13={},_0x55f5ae={},_0x14501b={'count':0x0,'rows':[]};var _0x223f9d=_[_0xb252('0x29')](db[_0xb252('0x2a')]['rawAttributes'],function(_0x18dc38){return{'name':_0x18dc38[_0xb252('0x2b')],'type':_0x18dc38[_0xb252('0x2c')][_0xb252('0x2d')]};});_0x55f5ae[_0xb252('0x2e')]=_[_0xb252('0x29')](_0x223f9d,_0xb252('0x26'));_0x55f5ae[_0xb252('0x2f')]=_[_0xb252('0x30')](_0xad39af[_0xb252('0x2f')]);_0x55f5ae[_0xb252('0x31')]=_[_0xb252('0x32')](_0x55f5ae[_0xb252('0x2e')],_0x55f5ae[_0xb252('0x2f')]);_0x1a4f13[_0xb252('0x33')]=_['intersection'](_0x55f5ae[_0xb252('0x2e')],qs[_0xb252('0x34')](_0xad39af['query']['fields']));_0x1a4f13[_0xb252('0x33')]=_0x1a4f13[_0xb252('0x33')]['length']?_0x1a4f13['attributes']:_0x55f5ae[_0xb252('0x2e')];if(!_0xad39af[_0xb252('0x2f')][_0xb252('0x35')](_0xb252('0x36'))){_0x1a4f13[_0xb252('0x37')]=qs[_0xb252('0x37')](_0xad39af[_0xb252('0x2f')][_0xb252('0x37')]);_0x1a4f13[_0xb252('0x1c')]=qs[_0xb252('0x1c')](_0xad39af[_0xb252('0x2f')]['offset']);}_0x1a4f13[_0xb252('0x38')]=qs[_0xb252('0x39')](_0xad39af[_0xb252('0x2f')][_0xb252('0x39')]);_0x1a4f13['where']=qs[_0xb252('0x31')](_[_0xb252('0x3a')](_0xad39af[_0xb252('0x2f')],_0x55f5ae[_0xb252('0x31')]));if(_0xad39af[_0xb252('0x2f')][_0xb252('0x3b')]){_0x1a4f13[_0xb252('0x3c')]=_['merge'](_0x1a4f13[_0xb252('0x3c')],{'$or':_['map'](_0x223f9d,function(_0x35a740){if(_0x35a740[_0xb252('0x2c')]!==_0xb252('0x3d')){var _0x1da354={};_0x1da354[_0x35a740[_0xb252('0x26')]]={'$like':'%'+_0xad39af[_0xb252('0x2f')][_0xb252('0x3b')]+'%'};return _0x1da354;}})});}_0x1a4f13=_['merge']({},_0x1a4f13,_0xad39af['options']);var _0x3b91be={'where':_0x1a4f13[_0xb252('0x3c')]};return db[_0xb252('0x2a')][_0xb252('0x3e')](_0x3b91be)[_0xb252('0x23')](function(_0x723a3c){_0x14501b[_0xb252('0x3e')]=_0x723a3c;if(_0xad39af[_0xb252('0x2f')][_0xb252('0x3f')]){_0x1a4f13[_0xb252('0x40')]=[{'all':!![]}];}return db[_0xb252('0x2a')][_0xb252('0x41')](_0x1a4f13);})[_0xb252('0x23')](function(_0x548d92){_0x14501b[_0xb252('0x42')]=_0x548d92;return _0x14501b;})['then'](respondWithFilteredResult(_0x4176d2,_0x1a4f13))[_0xb252('0x43')](handleError(_0x4176d2,null));};exports[_0xb252('0x44')]=function(_0x5765bf,_0x45c0b5){var _0x1ec083={'raw':!![],'where':{'id':_0x5765bf[_0xb252('0x45')]['id']}},_0x528e36={};_0x528e36[_0xb252('0x2e')]=_['keys'](db[_0xb252('0x2a')]['rawAttributes']);_0x528e36[_0xb252('0x2f')]=_[_0xb252('0x30')](_0x5765bf[_0xb252('0x2f')]);_0x528e36[_0xb252('0x31')]=_[_0xb252('0x32')](_0x528e36[_0xb252('0x2e')],_0x528e36['query']);_0x1ec083[_0xb252('0x33')]=_[_0xb252('0x32')](_0x528e36[_0xb252('0x2e')],qs[_0xb252('0x34')](_0x5765bf[_0xb252('0x2f')]['fields']));_0x1ec083[_0xb252('0x33')]=_0x1ec083[_0xb252('0x33')]['length']?_0x1ec083[_0xb252('0x33')]:_0x528e36[_0xb252('0x2e')];if(_0x5765bf['query']['includeAll']){_0x1ec083[_0xb252('0x40')]=[{'all':!![]}];}_0x1ec083=_[_0xb252('0x46')]({},_0x1ec083,_0x5765bf['options']);return db[_0xb252('0x2a')]['find'](_0x1ec083)[_0xb252('0x23')](handleEntityNotFound(_0x45c0b5,null))[_0xb252('0x23')](respondWithResult(_0x45c0b5,null))['catch'](handleError(_0x45c0b5,null));};exports[_0xb252('0x47')]=function(_0x4e7dae,_0xf57d42){return db[_0xb252('0x2a')]['create'](_0x4e7dae[_0xb252('0x48')],{})[_0xb252('0x23')](respondWithResult(_0xf57d42,0xc9))[_0xb252('0x43')](handleError(_0xf57d42,null));};exports[_0xb252('0x22')]=function(_0x484495,_0x149874){if(_0x484495[_0xb252('0x48')]['id']){delete _0x484495['body']['id'];}return db['JscriptySessionReport']['find']({'where':{'id':_0x484495[_0xb252('0x45')]['id']}})[_0xb252('0x23')](handleEntityNotFound(_0x149874,null))['then'](saveUpdates(_0x484495['body'],null))[_0xb252('0x23')](respondWithResult(_0x149874,null))[_0xb252('0x43')](handleError(_0x149874,null));};exports[_0xb252('0x24')]=function(_0x48f601,_0x3f1d7a){return db[_0xb252('0x2a')][_0xb252('0x49')]({'where':{'id':_0x48f601[_0xb252('0x45')]['id']}})[_0xb252('0x23')](handleEntityNotFound(_0x3f1d7a,null))[_0xb252('0x23')](removeEntity(_0x3f1d7a,null))['catch'](handleError(_0x3f1d7a,null));};exports[_0xb252('0x4a')]=function(_0x598d38,_0x111337){return db[_0xb252('0x2a')][_0xb252('0x4a')]()[_0xb252('0x23')](respondWithResult(_0x111337,null))[_0xb252('0x43')](handleError(_0x111337,null));};exports[_0xb252('0x4b')]=function(_0x54ed30,_0x14ba93,_0x9ffa4c){var _0xae8c3a={'raw':!![],'where':{}};var _0x6c5cf9={};var _0x391982={'count':0x0,'rows':[]};return db['JscriptySessionReport'][_0xb252('0x4c')]({'where':{'id':_0x54ed30[_0xb252('0x45')]['id']}})[_0xb252('0x23')](handleEntityNotFound(_0x14ba93,null))[_0xb252('0x23')](function(_0x56a502){if(_0x56a502){_0x6c5cf9[_0xb252('0x2e')]=_['keys'](db[_0xb252('0x4d')]['rawAttributes']);_0x6c5cf9[_0xb252('0x2f')]=_[_0xb252('0x30')](_0x54ed30[_0xb252('0x2f')]);_0x6c5cf9[_0xb252('0x31')]=_[_0xb252('0x32')](_0x6c5cf9['model'],_0x6c5cf9[_0xb252('0x2f')]);_0xae8c3a[_0xb252('0x33')]=_[_0xb252('0x32')](_0x6c5cf9[_0xb252('0x2e')],qs[_0xb252('0x34')](_0x54ed30[_0xb252('0x2f')][_0xb252('0x34')]));_0xae8c3a[_0xb252('0x33')]=_0xae8c3a[_0xb252('0x33')][_0xb252('0x4e')]?_0xae8c3a[_0xb252('0x33')]:_0x6c5cf9['model'];if(!_0x54ed30[_0xb252('0x2f')][_0xb252('0x35')]('nolimit')){_0xae8c3a['limit']=qs[_0xb252('0x37')](_0x54ed30[_0xb252('0x2f')][_0xb252('0x37')]);_0xae8c3a[_0xb252('0x1c')]=qs[_0xb252('0x1c')](_0x54ed30[_0xb252('0x2f')]['offset']);}_0xae8c3a[_0xb252('0x38')]=qs['sort'](_0x54ed30[_0xb252('0x2f')][_0xb252('0x39')]);_0xae8c3a[_0xb252('0x3c')]=qs[_0xb252('0x31')](_[_0xb252('0x3a')](_0x54ed30['query'],_0x6c5cf9[_0xb252('0x31')]));_0xae8c3a[_0xb252('0x3c')][_0xb252('0x4f')]=_0x56a502['id'];if(_0x54ed30[_0xb252('0x2f')]['filter']){_0xae8c3a[_0xb252('0x3c')]=_[_0xb252('0x46')](_0xae8c3a[_0xb252('0x3c')],{'$or':_[_0xb252('0x29')](_0xae8c3a['attributes'],function(_0x16dc09){var _0x43c227={};_0x43c227[_0x16dc09]={'$like':'%'+_0x54ed30[_0xb252('0x2f')][_0xb252('0x3b')]+'%'};return _0x43c227;})});}_0xae8c3a=_[_0xb252('0x46')]({},_0xae8c3a,_0x54ed30[_0xb252('0x50')]);return db[_0xb252('0x4d')][_0xb252('0x3e')]({'where':_0xae8c3a['where']})[_0xb252('0x23')](function(_0x2d772b){_0x391982[_0xb252('0x3e')]=_0x2d772b;if(_0x54ed30[_0xb252('0x2f')]['includeAll']){_0xae8c3a[_0xb252('0x40')]=[{'all':!![]}];}return db[_0xb252('0x4d')]['findAll'](_0xae8c3a);})[_0xb252('0x23')](function(_0x500874){_0x391982[_0xb252('0x42')]=_0x500874;return _0x391982;});}})[_0xb252('0x23')](respondWithFilteredResult(_0x14ba93,_0xae8c3a))[_0xb252('0x43')](handleError(_0x14ba93,null));}; \ No newline at end of file +var _0xd143=['filters','intersection','model','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','options','then','count','includeAll','include','findAll','rows','catch','show','length','create','body','find','params','describe','getQuestions','JscriptyQuestionReport','nolimit','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','update','destroy','error','stack','name','index','JscriptySessionReport','rawAttributes','type','key','map','keys','query'];(function(_0x5e9ae9,_0x5a45a6){var _0x50caff=function(_0x239f80){while(--_0x239f80){_0x5e9ae9['push'](_0x5e9ae9['shift']());}};_0x50caff(++_0x5a45a6);}(_0xd143,0x195));var _0x3d14=function(_0x3303d3,_0xe6a9a8){_0x3303d3=_0x3303d3-0x0;var _0xcec931=_0xd143[_0x3303d3];return _0xcec931;};'use strict';var pdf=require(_0x3d14('0x0'));var emlformat=require(_0x3d14('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x3d14('0x2'));var jsonpatch=require(_0x3d14('0x3'));var rp=require(_0x3d14('0x4'));var moment=require('moment');var BPromise=require(_0x3d14('0x5'));var Mustache=require('mustache');var util=require(_0x3d14('0x6'));var path=require(_0x3d14('0x7'));var sox=require(_0x3d14('0x8'));var csv=require(_0x3d14('0x9'));var ejs=require(_0x3d14('0xa'));var fs=require('fs');var _=require(_0x3d14('0xb'));var squel=require(_0x3d14('0xc'));var crypto=require(_0x3d14('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x3d14('0xe'));var toCsv=require('to-csv');var querystring=require(_0x3d14('0xf'));var Papa=require(_0x3d14('0x10'));var Redis=require(_0x3d14('0x11'));var authService=require(_0x3d14('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3d14('0x13'));var logger=require('../../config/logger')(_0x3d14('0x14'));var utils=require(_0x3d14('0x15'));var config=require(_0x3d14('0x16'));var db=require(_0x3d14('0x17'))['db'];function respondWithStatusCode(_0x524351,_0x10f6fa){_0x10f6fa=_0x10f6fa||0xcc;return function(_0x18083f){if(_0x18083f){return _0x524351[_0x3d14('0x18')](_0x10f6fa);}return _0x524351[_0x3d14('0x19')](_0x10f6fa)[_0x3d14('0x1a')]();};}function respondWithResult(_0x4a51a7,_0x2b21d5){_0x2b21d5=_0x2b21d5||0xc8;return function(_0x373db7){if(_0x373db7){return _0x4a51a7[_0x3d14('0x19')](_0x2b21d5)[_0x3d14('0x1b')](_0x373db7);}};}function respondWithFilteredResult(_0x2852be,_0x3de74f){return function(_0x34a0ab){if(_0x34a0ab){var _0xa88453=_0x34a0ab['count'],_0x28e35d=_0x3de74f[_0x3d14('0x1c')],_0x5933ef=_0x3de74f[_0x3d14('0x1c')]+_0x3de74f[_0x3d14('0x1d')],_0x33ea5f;if(_0x5933ef>=_0xa88453){_0x5933ef=_0xa88453;_0x33ea5f=0xc8;}else{_0x33ea5f=0xce;}_0x2852be[_0x3d14('0x19')](_0x33ea5f);return _0x2852be[_0x3d14('0x1e')](_0x3d14('0x1f'),_0x28e35d+'-'+_0x5933ef+'/'+_0xa88453)['json'](_0x34a0ab);}return null;};}function patchUpdates(_0x2290c2){return function(_0x4fcdcc){try{jsonpatch['apply'](_0x4fcdcc,_0x2290c2,!![]);}catch(_0x16537b){return BPromise['reject'](_0x16537b);}return _0x4fcdcc['save']();};}function saveUpdates(_0x10ec10,_0x39b103){return function(_0xd56158){if(_0xd56158){return _0xd56158[_0x3d14('0x20')](_0x10ec10)['then'](function(_0x27caac){return _0x27caac;});}return null;};}function removeEntity(_0x3dc685,_0x38d884){return function(_0x4d9a07){if(_0x4d9a07){return _0x4d9a07[_0x3d14('0x21')]()['then'](function(){_0x3dc685[_0x3d14('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x411560,_0x55ba96){return function(_0x25638a){if(!_0x25638a){_0x411560[_0x3d14('0x18')](0x194);}return _0x25638a;};}function handleError(_0xbdb914,_0x24388b){_0x24388b=_0x24388b||0x1f4;return function(_0x3449f1){logger[_0x3d14('0x22')](_0x3449f1[_0x3d14('0x23')]);if(_0x3449f1[_0x3d14('0x24')]){delete _0x3449f1[_0x3d14('0x24')];}_0xbdb914[_0x3d14('0x19')](_0x24388b)['send'](_0x3449f1);};}exports[_0x3d14('0x25')]=function(_0x58b592,_0x45d276){var _0x164c0={},_0x18d09e={},_0x12f861={'count':0x0,'rows':[]};var _0x14c4f0=_['map'](db[_0x3d14('0x26')][_0x3d14('0x27')],function(_0x5c4d3c){return{'name':_0x5c4d3c['fieldName'],'type':_0x5c4d3c[_0x3d14('0x28')][_0x3d14('0x29')]};});_0x18d09e['model']=_[_0x3d14('0x2a')](_0x14c4f0,_0x3d14('0x24'));_0x18d09e['query']=_[_0x3d14('0x2b')](_0x58b592[_0x3d14('0x2c')]);_0x18d09e[_0x3d14('0x2d')]=_[_0x3d14('0x2e')](_0x18d09e[_0x3d14('0x2f')],_0x18d09e[_0x3d14('0x2c')]);_0x164c0[_0x3d14('0x30')]=_[_0x3d14('0x2e')](_0x18d09e['model'],qs[_0x3d14('0x31')](_0x58b592[_0x3d14('0x2c')][_0x3d14('0x31')]));_0x164c0[_0x3d14('0x30')]=_0x164c0[_0x3d14('0x30')]['length']?_0x164c0[_0x3d14('0x30')]:_0x18d09e['model'];if(!_0x58b592[_0x3d14('0x2c')][_0x3d14('0x32')]('nolimit')){_0x164c0['limit']=qs[_0x3d14('0x1d')](_0x58b592[_0x3d14('0x2c')][_0x3d14('0x1d')]);_0x164c0[_0x3d14('0x1c')]=qs[_0x3d14('0x1c')](_0x58b592[_0x3d14('0x2c')][_0x3d14('0x1c')]);}_0x164c0[_0x3d14('0x33')]=qs[_0x3d14('0x34')](_0x58b592[_0x3d14('0x2c')][_0x3d14('0x34')]);_0x164c0[_0x3d14('0x35')]=qs[_0x3d14('0x2d')](_[_0x3d14('0x36')](_0x58b592[_0x3d14('0x2c')],_0x18d09e[_0x3d14('0x2d')]));if(_0x58b592[_0x3d14('0x2c')][_0x3d14('0x37')]){_0x164c0[_0x3d14('0x35')]=_[_0x3d14('0x38')](_0x164c0['where'],{'$or':_[_0x3d14('0x2a')](_0x14c4f0,function(_0x3c6f50){if(_0x3c6f50[_0x3d14('0x28')]!=='VIRTUAL'){var _0x24616e={};_0x24616e[_0x3c6f50['name']]={'$like':'%'+_0x58b592[_0x3d14('0x2c')][_0x3d14('0x37')]+'%'};return _0x24616e;}})});}_0x164c0=_[_0x3d14('0x38')]({},_0x164c0,_0x58b592[_0x3d14('0x39')]);var _0x552b94={'where':_0x164c0['where']};return db[_0x3d14('0x26')]['count'](_0x552b94)[_0x3d14('0x3a')](function(_0x27d2a4){_0x12f861[_0x3d14('0x3b')]=_0x27d2a4;if(_0x58b592[_0x3d14('0x2c')][_0x3d14('0x3c')]){_0x164c0[_0x3d14('0x3d')]=[{'all':!![]}];}return db[_0x3d14('0x26')][_0x3d14('0x3e')](_0x164c0);})[_0x3d14('0x3a')](function(_0x2c6559){_0x12f861[_0x3d14('0x3f')]=_0x2c6559;return _0x12f861;})[_0x3d14('0x3a')](respondWithFilteredResult(_0x45d276,_0x164c0))[_0x3d14('0x40')](handleError(_0x45d276,null));};exports[_0x3d14('0x41')]=function(_0x4d8512,_0x515621){var _0x3a2d00={'raw':!![],'where':{'id':_0x4d8512['params']['id']}},_0x609991={};_0x609991[_0x3d14('0x2f')]=_[_0x3d14('0x2b')](db[_0x3d14('0x26')][_0x3d14('0x27')]);_0x609991[_0x3d14('0x2c')]=_[_0x3d14('0x2b')](_0x4d8512['query']);_0x609991['filters']=_['intersection'](_0x609991[_0x3d14('0x2f')],_0x609991['query']);_0x3a2d00[_0x3d14('0x30')]=_['intersection'](_0x609991[_0x3d14('0x2f')],qs[_0x3d14('0x31')](_0x4d8512[_0x3d14('0x2c')][_0x3d14('0x31')]));_0x3a2d00[_0x3d14('0x30')]=_0x3a2d00[_0x3d14('0x30')][_0x3d14('0x42')]?_0x3a2d00[_0x3d14('0x30')]:_0x609991['model'];if(_0x4d8512[_0x3d14('0x2c')][_0x3d14('0x3c')]){_0x3a2d00[_0x3d14('0x3d')]=[{'all':!![]}];}_0x3a2d00=_[_0x3d14('0x38')]({},_0x3a2d00,_0x4d8512[_0x3d14('0x39')]);return db[_0x3d14('0x26')]['find'](_0x3a2d00)[_0x3d14('0x3a')](handleEntityNotFound(_0x515621,null))['then'](respondWithResult(_0x515621,null))['catch'](handleError(_0x515621,null));};exports[_0x3d14('0x43')]=function(_0x4f9f4c,_0x1651d7){return db[_0x3d14('0x26')][_0x3d14('0x43')](_0x4f9f4c[_0x3d14('0x44')],{})[_0x3d14('0x3a')](respondWithResult(_0x1651d7,0xc9))[_0x3d14('0x40')](handleError(_0x1651d7,null));};exports[_0x3d14('0x20')]=function(_0x5da695,_0x265765){if(_0x5da695[_0x3d14('0x44')]['id']){delete _0x5da695['body']['id'];}return db[_0x3d14('0x26')][_0x3d14('0x45')]({'where':{'id':_0x5da695[_0x3d14('0x46')]['id']}})[_0x3d14('0x3a')](handleEntityNotFound(_0x265765,null))[_0x3d14('0x3a')](saveUpdates(_0x5da695[_0x3d14('0x44')],null))[_0x3d14('0x3a')](respondWithResult(_0x265765,null))[_0x3d14('0x40')](handleError(_0x265765,null));};exports[_0x3d14('0x21')]=function(_0x547f7d,_0x235248){return db[_0x3d14('0x26')][_0x3d14('0x45')]({'where':{'id':_0x547f7d[_0x3d14('0x46')]['id']}})[_0x3d14('0x3a')](handleEntityNotFound(_0x235248,null))[_0x3d14('0x3a')](removeEntity(_0x235248,null))[_0x3d14('0x40')](handleError(_0x235248,null));};exports[_0x3d14('0x47')]=function(_0x484db7,_0x15928c){return db['JscriptySessionReport'][_0x3d14('0x47')]()[_0x3d14('0x3a')](respondWithResult(_0x15928c,null))[_0x3d14('0x40')](handleError(_0x15928c,null));};exports[_0x3d14('0x48')]=function(_0x11c31a,_0x43ae84,_0x243b51){var _0x54d84a={'raw':!![],'where':{}};var _0x20258e={};var _0x11f79d={'count':0x0,'rows':[]};return db['JscriptySessionReport']['findOne']({'where':{'id':_0x11c31a[_0x3d14('0x46')]['id']}})['then'](handleEntityNotFound(_0x43ae84,null))[_0x3d14('0x3a')](function(_0x2ea4ac){if(_0x2ea4ac){_0x20258e[_0x3d14('0x2f')]=_[_0x3d14('0x2b')](db[_0x3d14('0x49')]['rawAttributes']);_0x20258e[_0x3d14('0x2c')]=_[_0x3d14('0x2b')](_0x11c31a[_0x3d14('0x2c')]);_0x20258e[_0x3d14('0x2d')]=_[_0x3d14('0x2e')](_0x20258e[_0x3d14('0x2f')],_0x20258e[_0x3d14('0x2c')]);_0x54d84a[_0x3d14('0x30')]=_[_0x3d14('0x2e')](_0x20258e[_0x3d14('0x2f')],qs[_0x3d14('0x31')](_0x11c31a[_0x3d14('0x2c')][_0x3d14('0x31')]));_0x54d84a[_0x3d14('0x30')]=_0x54d84a[_0x3d14('0x30')]['length']?_0x54d84a[_0x3d14('0x30')]:_0x20258e['model'];if(!_0x11c31a[_0x3d14('0x2c')][_0x3d14('0x32')](_0x3d14('0x4a'))){_0x54d84a[_0x3d14('0x1d')]=qs[_0x3d14('0x1d')](_0x11c31a[_0x3d14('0x2c')][_0x3d14('0x1d')]);_0x54d84a[_0x3d14('0x1c')]=qs['offset'](_0x11c31a[_0x3d14('0x2c')][_0x3d14('0x1c')]);}_0x54d84a[_0x3d14('0x33')]=qs[_0x3d14('0x34')](_0x11c31a[_0x3d14('0x2c')][_0x3d14('0x34')]);_0x54d84a['where']=qs[_0x3d14('0x2d')](_['pick'](_0x11c31a[_0x3d14('0x2c')],_0x20258e['filters']));_0x54d84a['where']['SessionId']=_0x2ea4ac['id'];if(_0x11c31a[_0x3d14('0x2c')]['filter']){_0x54d84a[_0x3d14('0x35')]=_[_0x3d14('0x38')](_0x54d84a[_0x3d14('0x35')],{'$or':_['map'](_0x54d84a['attributes'],function(_0x2242b3){var _0x8efbd2={};_0x8efbd2[_0x2242b3]={'$like':'%'+_0x11c31a['query']['filter']+'%'};return _0x8efbd2;})});}_0x54d84a=_[_0x3d14('0x38')]({},_0x54d84a,_0x11c31a['options']);return db['JscriptyQuestionReport'][_0x3d14('0x3b')]({'where':_0x54d84a[_0x3d14('0x35')]})[_0x3d14('0x3a')](function(_0x1e1e03){_0x11f79d[_0x3d14('0x3b')]=_0x1e1e03;if(_0x11c31a[_0x3d14('0x2c')][_0x3d14('0x3c')]){_0x54d84a['include']=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0x3d14('0x3e')](_0x54d84a);})[_0x3d14('0x3a')](function(_0x25d498){_0x11f79d['rows']=_0x25d498;return _0x11f79d;});}})[_0x3d14('0x3a')](respondWithFilteredResult(_0x43ae84,_0x54d84a))[_0x3d14('0x40')](handleError(_0x43ae84,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index ceee8bc..3112c8f 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 _0x7c74=['report_jscripty_sessions','lodash','util','api','moment','bluebird','request-promise','path','./jscriptySessionReport.attributes','exports','define'];(function(_0x5959c9,_0x2ed153){var _0x4ffcbc=function(_0x459b7a){while(--_0x459b7a){_0x5959c9['push'](_0x5959c9['shift']());}};_0x4ffcbc(++_0x2ed153);}(_0x7c74,0x11f));var _0x47c7=function(_0x39f34f,_0x298f45){_0x39f34f=_0x39f34f-0x0;var _0x59fee1=_0x7c74[_0x39f34f];return _0x59fee1;};'use strict';var _=require(_0x47c7('0x0'));var util=require(_0x47c7('0x1'));var logger=require('../../config/logger')(_0x47c7('0x2'));var moment=require(_0x47c7('0x3'));var BPromise=require(_0x47c7('0x4'));var rp=require(_0x47c7('0x5'));var fs=require('fs');var path=require(_0x47c7('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x47c7('0x7'));module[_0x47c7('0x8')]=function(_0x3a20fb,_0x48351a){return _0x3a20fb[_0x47c7('0x9')]('JscriptySessionReport',attributes,{'tableName':_0x47c7('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0b8e=['moment','bluebird','request-promise','../../config/environment','./jscriptySessionReport.attributes','exports','report_jscripty_sessions','lodash'];(function(_0x78ddb9,_0x32ba6d){var _0x25952f=function(_0x1828d1){while(--_0x1828d1){_0x78ddb9['push'](_0x78ddb9['shift']());}};_0x25952f(++_0x32ba6d);}(_0x0b8e,0x1df));var _0xe0b8=function(_0x483805,_0x44d802){_0x483805=_0x483805-0x0;var _0x3b1f37=_0x0b8e[_0x483805];return _0x3b1f37;};'use strict';var _=require(_0xe0b8('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xe0b8('0x1'));var BPromise=require(_0xe0b8('0x2'));var rp=require(_0xe0b8('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xe0b8('0x4'));var attributes=require(_0xe0b8('0x5'));module[_0xe0b8('0x6')]=function(_0x4f6cf9,_0x2d542d){return _0x4f6cf9['define']('JscriptySessionReport',attributes,{'tableName':_0xe0b8('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js b/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js index 1f512b9..2dd750f 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 _0xc16f=['http','then','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x473f60,_0x6ff2ba){var _0x2ceacc=function(_0x19ec7){while(--_0x19ec7){_0x473f60['push'](_0x473f60['shift']());}};_0x2ceacc(++_0x6ff2ba);}(_0xc16f,0x15c));var _0xfc16=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc16f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xfc16('0x0'));var util=require(_0xfc16('0x1'));var moment=require(_0xfc16('0x2'));var BPromise=require(_0xfc16('0x3'));var rs=require(_0xfc16('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xfc16('0x5'))(_0xfc16('0x6'));var config=require(_0xfc16('0x7'));var jayson=require(_0xfc16('0x8'));var client=jayson['client'][_0xfc16('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x55d786,_0x1f8f56,_0xcff08){return new BPromise(function(_0x47f386,_0x24d01e){return client['request'](_0x55d786,_0xcff08)[_0xfc16('0xa')](function(_0x3be31d){logger[_0xfc16('0xb')](_0xfc16('0xc'),_0x1f8f56,_0xfc16('0xd'));logger['debug'](_0xfc16('0xe'),_0x1f8f56,'request\x20sent',JSON[_0xfc16('0xf')](_0x3be31d));if(_0x3be31d['error']){if(_0x3be31d[_0xfc16('0x10')][_0xfc16('0x11')]===0x1f4){logger[_0xfc16('0x10')](_0xfc16('0xc'),_0x1f8f56,_0x3be31d['error']['message']);return _0x24d01e(_0x3be31d[_0xfc16('0x10')][_0xfc16('0x12')]);}logger[_0xfc16('0x10')](_0xfc16('0xc'),_0x1f8f56,_0x3be31d[_0xfc16('0x10')][_0xfc16('0x12')]);return _0x47f386(_0x3be31d[_0xfc16('0x10')]['message']);}else{logger['info']('JscriptySessionReport,\x20%s,\x20%s',_0x1f8f56,_0xfc16('0xd'));_0x47f386(_0x3be31d[_0xfc16('0x13')][_0xfc16('0x12')]);}})[_0xfc16('0x14')](function(_0x15ada7){logger['error'](_0xfc16('0xc'),_0x1f8f56,_0x15ada7);_0x24d01e(_0x15ada7);});});} \ No newline at end of file +var _0xf19d=['message','info','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x3caba0,_0x18acfe){var _0x1a8185=function(_0xc29078){while(--_0xc29078){_0x3caba0['push'](_0x3caba0['shift']());}};_0x1a8185(++_0x18acfe);}(_0xf19d,0x164));var _0xdf19=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0xf19d[_0x4baae2];return _0x1a2285;};'use strict';var _=require(_0xdf19('0x0'));var util=require(_0xdf19('0x1'));var moment=require(_0xdf19('0x2'));var BPromise=require(_0xdf19('0x3'));var rs=require(_0xdf19('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xdf19('0x5'));var logger=require('../../config/logger')(_0xdf19('0x6'));var config=require(_0xdf19('0x7'));var jayson=require(_0xdf19('0x8'));var client=jayson[_0xdf19('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x33fab6,_0x79b9d5,_0xb93039){return new BPromise(function(_0x5eae63,_0x2ac56e){return client[_0xdf19('0xa')](_0x33fab6,_0xb93039)['then'](function(_0x41bf59){logger['info'](_0xdf19('0xb'),_0x79b9d5,_0xdf19('0xc'));logger[_0xdf19('0xd')](_0xdf19('0xe'),_0x79b9d5,'request\x20sent',JSON[_0xdf19('0xf')](_0x41bf59));if(_0x41bf59[_0xdf19('0x10')]){if(_0x41bf59[_0xdf19('0x10')][_0xdf19('0x11')]===0x1f4){logger[_0xdf19('0x10')](_0xdf19('0xb'),_0x79b9d5,_0x41bf59[_0xdf19('0x10')][_0xdf19('0x12')]);return _0x2ac56e(_0x41bf59[_0xdf19('0x10')][_0xdf19('0x12')]);}logger[_0xdf19('0x10')](_0xdf19('0xb'),_0x79b9d5,_0x41bf59['error'][_0xdf19('0x12')]);return _0x5eae63(_0x41bf59[_0xdf19('0x10')][_0xdf19('0x12')]);}else{logger[_0xdf19('0x13')](_0xdf19('0xb'),_0x79b9d5,_0xdf19('0xc'));_0x5eae63(_0x41bf59[_0xdf19('0x14')][_0xdf19('0x12')]);}})[_0xdf19('0x15')](function(_0xb1a50b){logger[_0xdf19('0x10')]('JscriptySessionReport,\x20%s,\x20%s',_0x79b9d5,_0xb1a50b);_0x2ac56e(_0xb1a50b);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index 5474939..f7103d3 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 _0x481a=['get','put','/:id','isAuthenticated','exports','multer','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./license.controller'];(function(_0x17823f,_0xffd807){var _0x51fc21=function(_0x5e4921){while(--_0x5e4921){_0x17823f['push'](_0x17823f['shift']());}};_0x51fc21(++_0xffd807);}(_0x481a,0xf5));var _0xa481=function(_0x224ad0,_0x2482bd){_0x224ad0=_0x224ad0-0x0;var _0x2e04fc=_0x481a[_0x224ad0];return _0x2e04fc;};'use strict';var multer=require(_0xa481('0x0'));var util=require('util');var path=require(_0xa481('0x1'));var timeout=require(_0xa481('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0xa481('0x3'));var interaction=require(_0xa481('0x4'));var config=require(_0xa481('0x5'));var controller=require(_0xa481('0x6'));router[_0xa481('0x7')]('/',controller['index']);router[_0xa481('0x8')](_0xa481('0x9'),auth[_0xa481('0xa')](),controller['update']);module[_0xa481('0xb')]=router; \ No newline at end of file +var _0x31cd=['../../config/environment','./license.controller','get','index','put','/:id','isAuthenticated','update','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service'];(function(_0x543084,_0x4337f5){var _0x306a57=function(_0x2769ed){while(--_0x2769ed){_0x543084['push'](_0x543084['shift']());}};_0x306a57(++_0x4337f5);}(_0x31cd,0x90));var _0xd31c=function(_0x48b06e,_0x980feb){_0x48b06e=_0x48b06e-0x0;var _0x176439=_0x31cd[_0x48b06e];return _0x176439;};'use strict';var multer=require(_0xd31c('0x0'));var util=require(_0xd31c('0x1'));var path=require(_0xd31c('0x2'));var timeout=require(_0xd31c('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0xd31c('0x4'));var interaction=require(_0xd31c('0x5'));var config=require(_0xd31c('0x6'));var controller=require(_0xd31c('0x7'));router[_0xd31c('0x8')]('/',controller[_0xd31c('0x9')]);router[_0xd31c('0xa')](_0xd31c('0xb'),auth[_0xd31c('0xc')](),controller[_0xd31c('0xd')]);module[_0xd31c('0xe')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index a1e37e7..40435cd 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 _0xe2fe=['STRING','INTEGER','sequelize'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xe2fe,0x86));var _0xee2f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe2fe[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xee2f('0x0'));module['exports']={'license':{'type':Sequelize['TEXT']},'data1':{'type':Sequelize[_0xee2f('0x1')]},'data2':{'type':Sequelize['STRING']},'chatLicenseExceeded':{'type':Sequelize[_0xee2f('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x814b=['TEXT','STRING','INTEGER','sequelize','exports'];(function(_0x12b833,_0x7582e6){var _0x3613a2=function(_0xd94268){while(--_0xd94268){_0x12b833['push'](_0x12b833['shift']());}};_0x3613a2(++_0x7582e6);}(_0x814b,0x1a2));var _0xb814=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0x814b[_0x5f0089];return _0x193892;};'use strict';var Sequelize=require(_0xb814('0x0'));module[_0xb814('0x1')]={'license':{'type':Sequelize[_0xb814('0x2')]},'data1':{'type':Sequelize[_0xb814('0x3')]},'data2':{'type':Sequelize[_0xb814('0x3')]},'chatLicenseExceeded':{'type':Sequelize[_0xb814('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/license/license.controller.js b/server/api/license/license.controller.js index 81fd079..f689763 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 _0x9aad=['filters','intersection','attributes','fields','length','merge','options','getLicense','catch','update','body','find','get','checkLicense','key','demo','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','set','Content-Range','json','reject','then','destroy','error','stack','name','../../config/license/util','index','model','License','query'];(function(_0x34d114,_0x4e1883){var _0x12caca=function(_0x5dda50){while(--_0x5dda50){_0x34d114['push'](_0x34d114['shift']());}};_0x12caca(++_0x4e1883);}(_0x9aad,0xc1));var _0xd9aa=function(_0x180beb,_0xd4e423){_0x180beb=_0x180beb-0x0;var _0x2deb1c=_0x9aad[_0x180beb];return _0x2deb1c;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xd9aa('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd9aa('0x1'));var jsonpatch=require(_0xd9aa('0x2'));var rp=require(_0xd9aa('0x3'));var moment=require(_0xd9aa('0x4'));var BPromise=require(_0xd9aa('0x5'));var Mustache=require(_0xd9aa('0x6'));var util=require(_0xd9aa('0x7'));var path=require(_0xd9aa('0x8'));var sox=require(_0xd9aa('0x9'));var csv=require(_0xd9aa('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xd9aa('0xb'));var squel=require('squel');var crypto=require(_0xd9aa('0xc'));var jsforce=require(_0xd9aa('0xd'));var deskjs=require(_0xd9aa('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xd9aa('0xf'));var authService=require(_0xd9aa('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xd9aa('0x11'));var hardwareService=require(_0xd9aa('0x12'));var logger=require(_0xd9aa('0x13'))(_0xd9aa('0x14'));var utils=require(_0xd9aa('0x15'));var config=require(_0xd9aa('0x16'));var db=require(_0xd9aa('0x17'))['db'];function respondWithStatusCode(_0x4957e8,_0x5348d5){_0x5348d5=_0x5348d5||0xcc;return function(_0x43d642){if(_0x43d642){return _0x4957e8[_0xd9aa('0x18')](_0x5348d5);}return _0x4957e8[_0xd9aa('0x19')](_0x5348d5)[_0xd9aa('0x1a')]();};}function respondWithResult(_0x1101f3,_0x1ee638){_0x1ee638=_0x1ee638||0xc8;return function(_0x1226a8){if(_0x1226a8){return _0x1101f3['status'](_0x1ee638)['json'](_0x1226a8);}};}function respondWithFilteredResult(_0x22f8bf,_0x58803f){return function(_0x21d8c5){if(_0x21d8c5){var _0x45dd59=_0x21d8c5[_0xd9aa('0x1b')],_0x37f499=_0x58803f[_0xd9aa('0x1c')],_0x41fe75=_0x58803f[_0xd9aa('0x1c')]+_0x58803f['limit'],_0x1919a9;if(_0x41fe75>=_0x45dd59){_0x41fe75=_0x45dd59;_0x1919a9=0xc8;}else{_0x1919a9=0xce;}_0x22f8bf['status'](_0x1919a9);return _0x22f8bf[_0xd9aa('0x1d')](_0xd9aa('0x1e'),_0x37f499+'-'+_0x41fe75+'/'+_0x45dd59)[_0xd9aa('0x1f')](_0x21d8c5);}return null;};}function patchUpdates(_0x316e37){return function(_0x3519af){try{jsonpatch['apply'](_0x3519af,_0x316e37,!![]);}catch(_0x29759d){return BPromise[_0xd9aa('0x20')](_0x29759d);}return _0x3519af['save']();};}function saveUpdates(_0x4d6c93,_0x3dbe84){return function(_0x108035){if(_0x108035){return _0x108035['update'](_0x4d6c93)[_0xd9aa('0x21')](function(_0x3213a4){return _0x3213a4;});}return null;};}function removeEntity(_0x118c05,_0x44b723){return function(_0xbb614d){if(_0xbb614d){return _0xbb614d[_0xd9aa('0x22')]()[_0xd9aa('0x21')](function(){_0x118c05[_0xd9aa('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x15ef84,_0x330503){return function(_0x3d605e){if(!_0x3d605e){_0x15ef84[_0xd9aa('0x18')](0x194);}return _0x3d605e;};}function handleError(_0xb57060,_0x315a8d){_0x315a8d=_0x315a8d||0x1f4;return function(_0x452371){logger[_0xd9aa('0x23')](_0x452371[_0xd9aa('0x24')]);if(_0x452371['name']){delete _0x452371[_0xd9aa('0x25')];}_0xb57060['status'](_0x315a8d)['send'](_0x452371);};}var utilLicense=require(_0xd9aa('0x26'));exports[_0xd9aa('0x27')]=function(_0x36870c,_0x30a115){var _0xd117ec={'raw':!![],'where':{'id':0x1}},_0x61b28e={};_0x61b28e[_0xd9aa('0x28')]=_['keys'](db[_0xd9aa('0x29')]['rawAttributes']);_0x61b28e['query']=_['keys'](_0x36870c[_0xd9aa('0x2a')]);_0x61b28e[_0xd9aa('0x2b')]=_[_0xd9aa('0x2c')](_0x61b28e[_0xd9aa('0x28')],_0x61b28e['query']);_0xd117ec[_0xd9aa('0x2d')]=_['intersection'](_0x61b28e[_0xd9aa('0x28')],qs[_0xd9aa('0x2e')](_0x36870c[_0xd9aa('0x2a')]['fields']));_0xd117ec[_0xd9aa('0x2d')]=_0xd117ec[_0xd9aa('0x2d')][_0xd9aa('0x2f')]?_0xd117ec[_0xd9aa('0x2d')]:_0x61b28e['model'];_0xd117ec=_[_0xd9aa('0x30')]({},_0xd117ec,_0x36870c[_0xd9aa('0x31')]);return utilLicense[_0xd9aa('0x32')](_0xd117ec)[_0xd9aa('0x21')](respondWithResult(_0x30a115,null))[_0xd9aa('0x33')](handleError(_0x30a115,null));};exports[_0xd9aa('0x34')]=function(_0xf4a471,_0x88fdd4){if(_0xf4a471['body']['id']){delete _0xf4a471[_0xd9aa('0x35')]['id'];}return db[_0xd9aa('0x29')][_0xd9aa('0x36')]({'where':{'id':_0xf4a471['params']['id']}})[_0xd9aa('0x21')](handleEntityNotFound(_0x88fdd4,null))['then'](function(_0x2dbb57){var _0x5b8b65=_0x2dbb57[_0xd9aa('0x37')]({'plain':!![]});return utilLicense[_0xd9aa('0x38')](_0x5b8b65,_0xf4a471[_0xd9aa('0x35')][_0xd9aa('0x39')]);})['then'](function(_0x108d52){if(!_0x108d52[_0xd9aa('0x3a')]){return saveUpdates(_0xf4a471[_0xd9aa('0x35')],null);}return _0x108d52;})[_0xd9aa('0x21')](respondWithResult(_0x88fdd4,null))[_0xd9aa('0x33')](handleError(_0x88fdd4,null));}; \ No newline at end of file +var _0x6909=['jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','json','count','offset','limit','status','set','apply','reject','save','then','destroy','error','name','send','../../config/license/util','index','model','keys','rawAttributes','query','filters','intersection','fields','attributes','merge','getLicense','catch','update','body','License','params','checkLicense','demo','eml-format','rimraf','fast-json-patch','moment','path','sox','to-csv','ejs','lodash','squel','crypto'];(function(_0x1e4360,_0x930b9b){var _0x31e6b4=function(_0x49dd8e){while(--_0x49dd8e){_0x1e4360['push'](_0x1e4360['shift']());}};_0x31e6b4(++_0x930b9b);}(_0x6909,0x17d));var _0x9690=function(_0x130b8,_0x385dc1){_0x130b8=_0x130b8-0x0;var _0xc73cd5=_0x6909[_0x130b8];return _0xc73cd5;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x9690('0x0'));var rimraf=require(_0x9690('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9690('0x2'));var rp=require('request-promise');var moment=require(_0x9690('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x9690('0x4'));var sox=require(_0x9690('0x5'));var csv=require(_0x9690('0x6'));var ejs=require(_0x9690('0x7'));var fs=require('fs');var _=require(_0x9690('0x8'));var squel=require(_0x9690('0x9'));var crypto=require(_0x9690('0xa'));var jsforce=require(_0x9690('0xb'));var deskjs=require(_0x9690('0xc'));var toCsv=require(_0x9690('0x6'));var querystring=require(_0x9690('0xd'));var Papa=require(_0x9690('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x9690('0xf'));var as=require(_0x9690('0x10'));var hardwareService=require(_0x9690('0x11'));var logger=require('../../config/logger')(_0x9690('0x12'));var utils=require(_0x9690('0x13'));var config=require(_0x9690('0x14'));var db=require(_0x9690('0x15'))['db'];function respondWithStatusCode(_0x373081,_0x2fb504){_0x2fb504=_0x2fb504||0xcc;return function(_0x2164fa){if(_0x2164fa){return _0x373081[_0x9690('0x16')](_0x2fb504);}return _0x373081['status'](_0x2fb504)['end']();};}function respondWithResult(_0x4d385f,_0x50f445){_0x50f445=_0x50f445||0xc8;return function(_0xf4af1){if(_0xf4af1){return _0x4d385f['status'](_0x50f445)[_0x9690('0x17')](_0xf4af1);}};}function respondWithFilteredResult(_0x3d0d0e,_0x4183e1){return function(_0x33233a){if(_0x33233a){var _0x21ba48=_0x33233a[_0x9690('0x18')],_0x350a4a=_0x4183e1[_0x9690('0x19')],_0x221043=_0x4183e1['offset']+_0x4183e1[_0x9690('0x1a')],_0x3f5093;if(_0x221043>=_0x21ba48){_0x221043=_0x21ba48;_0x3f5093=0xc8;}else{_0x3f5093=0xce;}_0x3d0d0e[_0x9690('0x1b')](_0x3f5093);return _0x3d0d0e[_0x9690('0x1c')]('Content-Range',_0x350a4a+'-'+_0x221043+'/'+_0x21ba48)[_0x9690('0x17')](_0x33233a);}return null;};}function patchUpdates(_0x2428c5){return function(_0xc6fb51){try{jsonpatch[_0x9690('0x1d')](_0xc6fb51,_0x2428c5,!![]);}catch(_0x1087e7){return BPromise[_0x9690('0x1e')](_0x1087e7);}return _0xc6fb51[_0x9690('0x1f')]();};}function saveUpdates(_0x466ea3,_0x3b045d){return function(_0x3132e4){if(_0x3132e4){return _0x3132e4['update'](_0x466ea3)[_0x9690('0x20')](function(_0x2976dd){return _0x2976dd;});}return null;};}function removeEntity(_0x45c037,_0x30ead2){return function(_0x28f379){if(_0x28f379){return _0x28f379[_0x9690('0x21')]()[_0x9690('0x20')](function(){_0x45c037['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x132420,_0x26732d){return function(_0x3f833c){if(!_0x3f833c){_0x132420[_0x9690('0x16')](0x194);}return _0x3f833c;};}function handleError(_0x2085d3,_0xe51bf2){_0xe51bf2=_0xe51bf2||0x1f4;return function(_0x436b08){logger[_0x9690('0x22')](_0x436b08['stack']);if(_0x436b08[_0x9690('0x23')]){delete _0x436b08[_0x9690('0x23')];}_0x2085d3['status'](_0xe51bf2)[_0x9690('0x24')](_0x436b08);};}var utilLicense=require(_0x9690('0x25'));exports[_0x9690('0x26')]=function(_0x5dc51e,_0x2da83d){var _0x3f112c={'raw':!![],'where':{'id':0x1}},_0x53c370={};_0x53c370[_0x9690('0x27')]=_[_0x9690('0x28')](db['License'][_0x9690('0x29')]);_0x53c370['query']=_['keys'](_0x5dc51e[_0x9690('0x2a')]);_0x53c370[_0x9690('0x2b')]=_['intersection'](_0x53c370[_0x9690('0x27')],_0x53c370['query']);_0x3f112c['attributes']=_[_0x9690('0x2c')](_0x53c370[_0x9690('0x27')],qs[_0x9690('0x2d')](_0x5dc51e['query']['fields']));_0x3f112c['attributes']=_0x3f112c[_0x9690('0x2e')]['length']?_0x3f112c[_0x9690('0x2e')]:_0x53c370[_0x9690('0x27')];_0x3f112c=_[_0x9690('0x2f')]({},_0x3f112c,_0x5dc51e['options']);return utilLicense[_0x9690('0x30')](_0x3f112c)['then'](respondWithResult(_0x2da83d,null))[_0x9690('0x31')](handleError(_0x2da83d,null));};exports[_0x9690('0x32')]=function(_0x122fe7,_0x46588a){if(_0x122fe7[_0x9690('0x33')]['id']){delete _0x122fe7[_0x9690('0x33')]['id'];}return db[_0x9690('0x34')]['find']({'where':{'id':_0x122fe7[_0x9690('0x35')]['id']}})[_0x9690('0x20')](handleEntityNotFound(_0x46588a,null))[_0x9690('0x20')](function(_0x40a223){var _0x3c5744=_0x40a223['get']({'plain':!![]});return utilLicense[_0x9690('0x36')](_0x3c5744,_0x122fe7[_0x9690('0x33')]['key']);})['then'](function(_0x4799c6){if(!_0x4799c6[_0x9690('0x37')]){return saveUpdates(_0x122fe7[_0x9690('0x33')],null);}return _0x4799c6;})[_0x9690('0x20')](respondWithResult(_0x46588a,null))[_0x9690('0x31')](handleError(_0x46588a,null));}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 7449d42..b6aee70 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 _0x8cb5=['util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./license.attributes','exports','define','License','lodash'];(function(_0x1e8c7e,_0x5dce55){var _0xf8fb10=function(_0x3e18d4){while(--_0x3e18d4){_0x1e8c7e['push'](_0x1e8c7e['shift']());}};_0xf8fb10(++_0x5dce55);}(_0x8cb5,0x19f));var _0x58cb=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x8cb5[_0x21a9d9];return _0x46adce;};'use strict';var _=require(_0x58cb('0x0'));var util=require(_0x58cb('0x1'));var logger=require(_0x58cb('0x2'))(_0x58cb('0x3'));var moment=require(_0x58cb('0x4'));var BPromise=require(_0x58cb('0x5'));var rp=require(_0x58cb('0x6'));var fs=require('fs');var path=require(_0x58cb('0x7'));var rimraf=require('rimraf');var config=require(_0x58cb('0x8'));var attributes=require(_0x58cb('0x9'));module[_0x58cb('0xa')]=function(_0x369626,_0x2798de){return _0x369626[_0x58cb('0xb')](_0x58cb('0xc'),attributes,{'tableName':'license','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3456=['path','rimraf','../../config/environment','./license.attributes','exports','define','License','util','api','moment','bluebird','request-promise'];(function(_0x26eb44,_0xa701be){var _0x1c1c23=function(_0x38775d){while(--_0x38775d){_0x26eb44['push'](_0x26eb44['shift']());}};_0x1c1c23(++_0xa701be);}(_0x3456,0x193));var _0x6345=function(_0x343e70,_0xe5f373){_0x343e70=_0x343e70-0x0;var _0x2742fd=_0x3456[_0x343e70];return _0x2742fd;};'use strict';var _=require('lodash');var util=require(_0x6345('0x0'));var logger=require('../../config/logger')(_0x6345('0x1'));var moment=require(_0x6345('0x2'));var BPromise=require(_0x6345('0x3'));var rp=require(_0x6345('0x4'));var fs=require('fs');var path=require(_0x6345('0x5'));var rimraf=require(_0x6345('0x6'));var config=require(_0x6345('0x7'));var attributes=require(_0x6345('0x8'));module[_0x6345('0x9')]=function(_0x2c8f10,_0x4840b8){return _0x2c8f10[_0x6345('0xa')](_0x6345('0xb'),attributes,{'tableName':'license','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/license/license.rpc.js b/server/api/license/license.rpc.js index c20d4ce..585c3e7 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 _0xe148=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','info','License,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','catch','lodash','util'];(function(_0x358fd3,_0x4a9c44){var _0x1ad0f3=function(_0x3c098d){while(--_0x3c098d){_0x358fd3['push'](_0x358fd3['shift']());}};_0x1ad0f3(++_0x4a9c44);}(_0xe148,0x9e));var _0x8e14=function(_0x1e9ae1,_0x10dc5d){_0x1e9ae1=_0x1e9ae1-0x0;var _0xc6bc15=_0xe148[_0x1e9ae1];return _0xc6bc15;};'use strict';var _=require(_0x8e14('0x0'));var util=require(_0x8e14('0x1'));var moment=require('moment');var BPromise=require(_0x8e14('0x2'));var rs=require(_0x8e14('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8e14('0x4'))['db'];var utils=require(_0x8e14('0x5'));var logger=require(_0x8e14('0x6'))(_0x8e14('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x8e14('0x8')][_0x8e14('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5d5232,_0x1a8608,_0x231d97){return new BPromise(function(_0x1e5825,_0x4149b8){return client['request'](_0x5d5232,_0x231d97)[_0x8e14('0xa')](function(_0x52bf23){logger[_0x8e14('0xb')](_0x8e14('0xc'),_0x1a8608,'request\x20sent');logger[_0x8e14('0xd')]('License,\x20%s,\x20%s,\x20%s',_0x1a8608,'request\x20sent',JSON[_0x8e14('0xe')](_0x52bf23));if(_0x52bf23[_0x8e14('0xf')]){if(_0x52bf23[_0x8e14('0xf')][_0x8e14('0x10')]===0x1f4){logger['error'](_0x8e14('0xc'),_0x1a8608,_0x52bf23['error']['message']);return _0x4149b8(_0x52bf23[_0x8e14('0xf')]['message']);}logger[_0x8e14('0xf')](_0x8e14('0xc'),_0x1a8608,_0x52bf23['error']['message']);return _0x1e5825(_0x52bf23[_0x8e14('0xf')][_0x8e14('0x11')]);}else{logger[_0x8e14('0xb')](_0x8e14('0xc'),_0x1a8608,_0x8e14('0x12'));_0x1e5825(_0x52bf23['result'][_0x8e14('0x11')]);}})[_0x8e14('0x13')](function(_0x56cbdc){logger[_0x8e14('0xf')](_0x8e14('0xc'),_0x1a8608,_0x56cbdc);_0x4149b8(_0x56cbdc);});});} \ No newline at end of file +var _0x5a8c=['client','http','request','then','License,\x20%s,\x20%s','debug','License,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise'];(function(_0x2bf948,_0x3e3c93){var _0x2aa47d=function(_0x494e9b){while(--_0x494e9b){_0x2bf948['push'](_0x2bf948['shift']());}};_0x2aa47d(++_0x3e3c93);}(_0x5a8c,0x1da));var _0xc5a8=function(_0x59e3a9,_0x5f2db3){_0x59e3a9=_0x59e3a9-0x0;var _0x1cbe89=_0x5a8c[_0x59e3a9];return _0x1cbe89;};'use strict';var _=require(_0xc5a8('0x0'));var util=require(_0xc5a8('0x1'));var moment=require('moment');var BPromise=require(_0xc5a8('0x2'));var rs=require(_0xc5a8('0x3'));var fs=require('fs');var Redis=require(_0xc5a8('0x4'));var db=require(_0xc5a8('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc5a8('0x6'))(_0xc5a8('0x7'));var config=require('../../config/environment');var jayson=require(_0xc5a8('0x8'));var client=jayson[_0xc5a8('0x9')][_0xc5a8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x20e700,_0x1be8e7,_0x2eb2a5){return new BPromise(function(_0x414555,_0xe7ce8f){return client[_0xc5a8('0xb')](_0x20e700,_0x2eb2a5)[_0xc5a8('0xc')](function(_0x46e3b7){logger['info'](_0xc5a8('0xd'),_0x1be8e7,'request\x20sent');logger[_0xc5a8('0xe')](_0xc5a8('0xf'),_0x1be8e7,_0xc5a8('0x10'),JSON['stringify'](_0x46e3b7));if(_0x46e3b7['error']){if(_0x46e3b7[_0xc5a8('0x11')][_0xc5a8('0x12')]===0x1f4){logger[_0xc5a8('0x11')](_0xc5a8('0xd'),_0x1be8e7,_0x46e3b7[_0xc5a8('0x11')]['message']);return _0xe7ce8f(_0x46e3b7[_0xc5a8('0x11')][_0xc5a8('0x13')]);}logger[_0xc5a8('0x11')](_0xc5a8('0xd'),_0x1be8e7,_0x46e3b7[_0xc5a8('0x11')][_0xc5a8('0x13')]);return _0x414555(_0x46e3b7[_0xc5a8('0x11')][_0xc5a8('0x13')]);}else{logger[_0xc5a8('0x14')](_0xc5a8('0xd'),_0x1be8e7,_0xc5a8('0x10'));_0x414555(_0x46e3b7[_0xc5a8('0x15')][_0xc5a8('0x13')]);}})[_0xc5a8('0x16')](function(_0x1ac555){logger[_0xc5a8('0x11')](_0xc5a8('0xd'),_0x1be8e7,_0x1ac555);_0xe7ce8f(_0x1ac555);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 76561aa..c18726c 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 _0xd78c=['getApplications','/:id/messages','getMessages','/:id/verify','verifySmtp','/:id/users','getAgents','addDisposition','post','create','addImap','addInteraction','/:id/applications','addApplications','/:id/send','send','put','delete','removeDispositions','removeImap','destroy','removeAgents','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getImap','/:id/out_servers','getSmtp','/:id/interactions','getInteractions'];(function(_0x20f292,_0x4c8b90){var _0x355c92=function(_0x59386d){while(--_0x59386d){_0x20f292['push'](_0x20f292['shift']());}};_0x355c92(++_0x4c8b90);}(_0xd78c,0xd3));var _0xcd78=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0xd78c[_0x1d1779];return _0x2377e9;};'use strict';var multer=require(_0xcd78('0x0'));var util=require(_0xcd78('0x1'));var path=require(_0xcd78('0x2'));var timeout=require(_0xcd78('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0xcd78('0x4'));var interaction=require(_0xcd78('0x5'));var config=require(_0xcd78('0x6'));var controller=require('./mailAccount.controller');router[_0xcd78('0x7')]('/',auth[_0xcd78('0x8')](),controller[_0xcd78('0x9')]);router['get'](_0xcd78('0xa'),auth[_0xcd78('0x8')](),controller[_0xcd78('0xb')]);router[_0xcd78('0x7')](_0xcd78('0xc'),auth['isAuthenticated'](),controller[_0xcd78('0xd')]);router[_0xcd78('0x7')](_0xcd78('0xe'),auth[_0xcd78('0x8')](),controller[_0xcd78('0xf')]);router[_0xcd78('0x7')](_0xcd78('0x10'),auth[_0xcd78('0x8')](),controller[_0xcd78('0x11')]);router[_0xcd78('0x7')](_0xcd78('0x12'),auth['isAuthenticated'](),controller[_0xcd78('0x13')]);router[_0xcd78('0x7')](_0xcd78('0x14'),auth[_0xcd78('0x8')](),controller[_0xcd78('0x15')]);router['get'](_0xcd78('0x16'),auth[_0xcd78('0x8')](),controller[_0xcd78('0x17')]);router[_0xcd78('0x7')]('/:id/applications',auth[_0xcd78('0x8')](),controller[_0xcd78('0x18')]);router[_0xcd78('0x7')](_0xcd78('0x19'),auth[_0xcd78('0x8')](),controller[_0xcd78('0x1a')]);router[_0xcd78('0x7')](_0xcd78('0x1b'),auth[_0xcd78('0x8')](),controller[_0xcd78('0x1c')]);router[_0xcd78('0x7')](_0xcd78('0x1d'),auth['isAuthenticated'](),controller[_0xcd78('0x1e')]);router['post'](_0xcd78('0xe'),auth['isAuthenticated'](),controller[_0xcd78('0x1f')]);router['post'](_0xcd78('0x10'),auth[_0xcd78('0x8')](),controller['addAnswer']);router[_0xcd78('0x20')]('/',auth[_0xcd78('0x8')](),controller[_0xcd78('0x21')]);router['post'](_0xcd78('0x12'),auth[_0xcd78('0x8')](),controller[_0xcd78('0x22')]);router[_0xcd78('0x20')](_0xcd78('0x14'),auth[_0xcd78('0x8')](),controller['addSmtp']);router['post'](_0xcd78('0x16'),auth['isAuthenticated'](),controller[_0xcd78('0x23')]);router['post'](_0xcd78('0x24'),auth['isAuthenticated'](),controller[_0xcd78('0x25')]);router['post'](_0xcd78('0x26'),auth['isAuthenticated'](),controller[_0xcd78('0x27')]);router[_0xcd78('0x20')](_0xcd78('0x1d'),auth[_0xcd78('0x8')](),controller['addAgents']);router[_0xcd78('0x28')](_0xcd78('0xc'),auth[_0xcd78('0x8')](),controller['update']);router[_0xcd78('0x29')](_0xcd78('0xe'),auth[_0xcd78('0x8')](),controller[_0xcd78('0x2a')]);router[_0xcd78('0x29')](_0xcd78('0x10'),auth[_0xcd78('0x8')](),controller['removeAnswers']);router['delete'](_0xcd78('0x12'),auth[_0xcd78('0x8')](),controller[_0xcd78('0x2b')]);router[_0xcd78('0x29')](_0xcd78('0x14'),auth['isAuthenticated'](),controller['removeSmtp']);router[_0xcd78('0x29')]('/:id',auth[_0xcd78('0x8')](),controller[_0xcd78('0x2c')]);router[_0xcd78('0x29')](_0xcd78('0x1d'),auth['isAuthenticated'](),controller[_0xcd78('0x2d')]);module[_0xcd78('0x2e')]=router; \ No newline at end of file +var _0x1cff=['describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getImap','/:id/out_servers','getSmtp','/:id/interactions','getInteractions','/:id/applications','/:id/messages','getMessages','verifySmtp','/:id/users','getAgents','post','addDisposition','create','addImap','addSmtp','addInteraction','addApplications','/:id/send','send','addAgents','put','update','delete','removeAnswers','removeSmtp','exports','multer','util','path','Router','../../components/interaction/service','./mailAccount.controller','get','isAuthenticated'];(function(_0x4f33cd,_0x92a213){var _0x245ae4=function(_0x4544f7){while(--_0x4544f7){_0x4f33cd['push'](_0x4f33cd['shift']());}};_0x245ae4(++_0x92a213);}(_0x1cff,0xfa));var _0xf1cf=function(_0x3d09b7,_0x4a9a9d){_0x3d09b7=_0x3d09b7-0x0;var _0x16c745=_0x1cff[_0x3d09b7];return _0x16c745;};'use strict';var multer=require(_0xf1cf('0x0'));var util=require(_0xf1cf('0x1'));var path=require(_0xf1cf('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xf1cf('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xf1cf('0x4'));var config=require('../../config/environment');var controller=require(_0xf1cf('0x5'));router[_0xf1cf('0x6')]('/',auth[_0xf1cf('0x7')](),controller['index']);router[_0xf1cf('0x6')]('/describe',auth[_0xf1cf('0x7')](),controller[_0xf1cf('0x8')]);router[_0xf1cf('0x6')](_0xf1cf('0x9'),auth[_0xf1cf('0x7')](),controller[_0xf1cf('0xa')]);router[_0xf1cf('0x6')](_0xf1cf('0xb'),auth[_0xf1cf('0x7')](),controller[_0xf1cf('0xc')]);router[_0xf1cf('0x6')](_0xf1cf('0xd'),auth[_0xf1cf('0x7')](),controller[_0xf1cf('0xe')]);router[_0xf1cf('0x6')](_0xf1cf('0xf'),auth[_0xf1cf('0x7')](),controller[_0xf1cf('0x10')]);router[_0xf1cf('0x6')](_0xf1cf('0x11'),auth[_0xf1cf('0x7')](),controller[_0xf1cf('0x12')]);router[_0xf1cf('0x6')](_0xf1cf('0x13'),auth[_0xf1cf('0x7')](),controller[_0xf1cf('0x14')]);router[_0xf1cf('0x6')](_0xf1cf('0x15'),auth['isAuthenticated'](),controller['getApplications']);router['get'](_0xf1cf('0x16'),auth[_0xf1cf('0x7')](),controller[_0xf1cf('0x17')]);router['get']('/:id/verify',auth[_0xf1cf('0x7')](),controller[_0xf1cf('0x18')]);router[_0xf1cf('0x6')](_0xf1cf('0x19'),auth['isAuthenticated'](),controller[_0xf1cf('0x1a')]);router[_0xf1cf('0x1b')](_0xf1cf('0xb'),auth[_0xf1cf('0x7')](),controller[_0xf1cf('0x1c')]);router['post'](_0xf1cf('0xd'),auth['isAuthenticated'](),controller['addAnswer']);router[_0xf1cf('0x1b')]('/',auth[_0xf1cf('0x7')](),controller[_0xf1cf('0x1d')]);router[_0xf1cf('0x1b')](_0xf1cf('0xf'),auth[_0xf1cf('0x7')](),controller[_0xf1cf('0x1e')]);router[_0xf1cf('0x1b')](_0xf1cf('0x11'),auth[_0xf1cf('0x7')](),controller[_0xf1cf('0x1f')]);router[_0xf1cf('0x1b')](_0xf1cf('0x13'),auth[_0xf1cf('0x7')](),controller[_0xf1cf('0x20')]);router[_0xf1cf('0x1b')](_0xf1cf('0x15'),auth[_0xf1cf('0x7')](),controller[_0xf1cf('0x21')]);router[_0xf1cf('0x1b')](_0xf1cf('0x22'),auth['isAuthenticated'](),controller[_0xf1cf('0x23')]);router['post']('/:id/users',auth[_0xf1cf('0x7')](),controller[_0xf1cf('0x24')]);router[_0xf1cf('0x25')](_0xf1cf('0x9'),auth['isAuthenticated'](),controller[_0xf1cf('0x26')]);router[_0xf1cf('0x27')]('/:id/dispositions',auth[_0xf1cf('0x7')](),controller['removeDispositions']);router[_0xf1cf('0x27')](_0xf1cf('0xd'),auth[_0xf1cf('0x7')](),controller[_0xf1cf('0x28')]);router[_0xf1cf('0x27')](_0xf1cf('0xf'),auth['isAuthenticated'](),controller['removeImap']);router[_0xf1cf('0x27')]('/:id/out_servers',auth[_0xf1cf('0x7')](),controller[_0xf1cf('0x29')]);router['delete']('/:id',auth[_0xf1cf('0x7')](),controller['destroy']);router[_0xf1cf('0x27')](_0xf1cf('0x19'),auth[_0xf1cf('0x7')](),controller['removeAgents']);module[_0xf1cf('0x2a')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index 7733cab..fa3ca74 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 _0xa6fc=['Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','sequelize','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED'];(function(_0x57645b,_0x25f73a){var _0xe82f00=function(_0x526b4){while(--_0x526b4){_0x57645b['push'](_0x57645b['shift']());}};_0xe82f00(++_0x25f73a);}(_0xa6fc,0xc9));var _0xca6f=function(_0x8d348f,_0xf4ff71){_0x8d348f=_0x8d348f-0x0;var _0x5c679a=_0xa6fc[_0x8d348f];return _0x5c679a;};'use strict';var Sequelize=require(_0xca6f('0x0'));module['exports']={'description':{'type':Sequelize[_0xca6f('0x1')]},'name':{'type':Sequelize[_0xca6f('0x1')],'allowNull':![]},'service':{'type':Sequelize[_0xca6f('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0xca6f('0x1')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0xca6f('0x2')],'defaultValue':!![]},'key':{'type':Sequelize[_0xca6f('0x1')],'allowNull':![]},'template':{'type':Sequelize[_0xca6f('0x3')]},'markAsUnread':{'type':Sequelize[_0xca6f('0x2')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0xca6f('0x1')],'allowNull':![],'defaultValue':_0xca6f('0x4')},'fontSize':{'type':Sequelize[_0xca6f('0x5')](0x2)[_0xca6f('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0xca6f('0x3')],'defaultValue':function(){return _0xca6f('0x7');}},'notificationSound':{'type':Sequelize[_0xca6f('0x2')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xca6f('0x2')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xca6f('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xca6f('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xca6f('0x2')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0xca6f('0x8')},'mandatoryDisposition':{'type':Sequelize[_0xca6f('0x2')],'defaultValue':![],'comment':_0xca6f('0x9'),'set':function(_0x545ae5){if(!_0x545ae5)this['setDataValue'](_0xca6f('0xa'),null);this[_0xca6f('0xb')](_0xca6f('0xc'),_0x545ae5);}}}; \ No newline at end of file +var _0x3066=['setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x3066,0x121));var _0x6306=function(_0x184a1f,_0xb67f9d){_0x184a1f=_0x184a1f-0x0;var _0x599177=_0x3066[_0x184a1f];return _0x599177;};'use strict';var Sequelize=require(_0x6306('0x0'));module[_0x6306('0x1')]={'description':{'type':Sequelize[_0x6306('0x2')]},'name':{'type':Sequelize[_0x6306('0x2')],'allowNull':![]},'service':{'type':Sequelize[_0x6306('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x6306('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x6306('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0x6306('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0x6306('0x4')]},'markAsUnread':{'type':Sequelize[_0x6306('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x6306('0x5')},'fontSize':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x6306('0x4')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}';}},'notificationSound':{'type':Sequelize[_0x6306('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x6306('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x6306('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x6306('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x6306('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x6306('0x6')],'allowNull':!![],'defaultValue':null,'comment':_0x6306('0x7')},'mandatoryDisposition':{'type':Sequelize[_0x6306('0x3')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x302b4f){if(!_0x302b4f)this[_0x6306('0x8')](_0x6306('0x9'),null);this[_0x6306('0x8')](_0x6306('0xa'),_0x302b4f);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 6c9d08e..d0083cf 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 _0x5adc=['List','Contacts','updatedAt','from','%s\x20<%s>','attachments','join','server/files/attachments','basename','auth','secure','SendMail','sendMail','List\x20not\x20found','messageId','subject','attach','out','Interaction','Messages','verifySmtp','VerifySmtp','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','sendStatus','status','end','offset','limit','set','Content-Range','json','reject','save','MailAccounts','UserProfileResource','destroy','name','send','index','Imap','MailServerOut','mandatoryDispositionPause','map','MailAccount','rawAttributes','model','query','filters','intersection','attributes','fields','length','order','sort','where','pick','merge','VIRTUAL','filter','options','count','includeAll','include','findAll','rows','params','Smtp','Pause','keys','find','update','body','MailServerIn','describe','addDisposition','MailAccountId','Disposition','removeDispositions','addAnswer','create','getAnswers','findOne','CannedAnswer','hasOwnProperty','nolimit','removeAnswers','ids','key','email','ListId','isNil','active','description','user','cuser','password','pass','authentication','host','port','service','cservice','cpassword','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','getSmtp','addSmtp','addInteraction','MailInteraction','omit','getInteractions','CmContact','User','Owner','fullname','internal','Tag','Tags','tag','addApplications','transaction','MailApplication','bulkCreate','findAndCountAll','getApplications','$gte','format','YYYY-MM-DD\x20HH:mm:ss','MailMessage','split'];(function(_0x31c6ca,_0x5b37b3){var _0x1b5088=function(_0x3c840b){while(--_0x3c840b){_0x31c6ca['push'](_0x31c6ca['shift']());}};_0x1b5088(++_0x5b37b3);}(_0x5adc,0xe2));var _0xc5ad=function(_0x503a5d,_0x59e4f6){_0x503a5d=_0x503a5d-0x0;var _0x3448b0=_0x5adc[_0x503a5d];return _0x3448b0;};'use strict';var pdf=require(_0xc5ad('0x0'));var emlformat=require(_0xc5ad('0x1'));var rimraf=require(_0xc5ad('0x2'));var zipdir=require(_0xc5ad('0x3'));var jsonpatch=require(_0xc5ad('0x4'));var rp=require(_0xc5ad('0x5'));var moment=require(_0xc5ad('0x6'));var BPromise=require(_0xc5ad('0x7'));var Mustache=require(_0xc5ad('0x8'));var util=require('util');var path=require(_0xc5ad('0x9'));var sox=require(_0xc5ad('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xc5ad('0xb'));var squel=require(_0xc5ad('0xc'));var crypto=require(_0xc5ad('0xd'));var jsforce=require(_0xc5ad('0xe'));var deskjs=require(_0xc5ad('0xf'));var toCsv=require(_0xc5ad('0x10'));var querystring=require(_0xc5ad('0x11'));var Papa=require(_0xc5ad('0x12'));var Redis=require('ioredis');var authService=require(_0xc5ad('0x13'));var qs=require(_0xc5ad('0x14'));var as=require(_0xc5ad('0x15'));var hardwareService=require(_0xc5ad('0x16'));var logger=require(_0xc5ad('0x17'))(_0xc5ad('0x18'));var utils=require(_0xc5ad('0x19'));var config=require(_0xc5ad('0x1a'));var db=require('../../mysqldb')['db'];config[_0xc5ad('0x1b')]=_[_0xc5ad('0x1c')](config[_0xc5ad('0x1b')],{'host':_0xc5ad('0x1d'),'port':0x18eb});var socket=require(_0xc5ad('0x1e'))(new Redis(config['redis']));require(_0xc5ad('0x1f'))['register'](socket);var jayson=require(_0xc5ad('0x20'));var client=jayson[_0xc5ad('0x21')][_0xc5ad('0x22')]({'port':0x232b});function checkPasswordPattern(_0x1bd988,_0x85908b,_0x5068f5){if(_0x5068f5){var _0x5dab14=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5dab14[_0xc5ad('0x23')](_0x85908b)){return _0x1bd988;}else{throw new db[(_0xc5ad('0x24'))][(_0xc5ad('0x25'))](_0xc5ad('0x26'));}}else{return _0x1bd988;}}function respondWithRpcPromise(_0x527459,_0x172b40,_0x277639,_0x3fc7ea){return new BPromise(function(_0x492778,_0x116bda){var _0x383c7f=_0x3fc7ea||client;return _0x383c7f[_0xc5ad('0x27')](_0x527459,_0x277639)[_0xc5ad('0x28')](function(_0x4bc5f1){logger[_0xc5ad('0x29')](_0xc5ad('0x2a'),_0x172b40,_0xc5ad('0x2b'));logger[_0xc5ad('0x2c')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x172b40,'request\x20sent',JSON[_0xc5ad('0x2d')](_0x4bc5f1));if(_0x4bc5f1[_0xc5ad('0x2e')]){if(_0x4bc5f1['error']['code']===0x1f4){logger[_0xc5ad('0x2e')]('MailAccount,\x20%s,\x20%s',_0x172b40,_0x4bc5f1[_0xc5ad('0x2e')]['message']);return _0x116bda(_0x4bc5f1['error']['message']);}logger[_0xc5ad('0x2e')](_0xc5ad('0x2a'),_0x172b40,_0x4bc5f1[_0xc5ad('0x2e')][_0xc5ad('0x2f')]);return _0x492778(_0x4bc5f1['error'][_0xc5ad('0x2f')]);}else{logger[_0xc5ad('0x29')](_0xc5ad('0x2a'),_0x172b40,_0xc5ad('0x2b'));_0x492778(_0x4bc5f1['result']['message']);}})[_0xc5ad('0x30')](function(_0x5647b1){logger[_0xc5ad('0x2e')](_0xc5ad('0x2a'),_0x172b40,_0x5647b1);_0x116bda(_0x5647b1);});});}function respondWithStatusCode(_0x2b0bfc,_0x154e3a){_0x154e3a=_0x154e3a||0xcc;return function(_0x5ca176){if(_0x5ca176){return _0x2b0bfc[_0xc5ad('0x31')](_0x154e3a);}return _0x2b0bfc[_0xc5ad('0x32')](_0x154e3a)[_0xc5ad('0x33')]();};}function respondWithResult(_0xb733b7,_0x5e9b98){_0x5e9b98=_0x5e9b98||0xc8;return function(_0x526972){if(_0x526972){return _0xb733b7['status'](_0x5e9b98)['json'](_0x526972);}};}function respondWithFilteredResult(_0x188d02,_0xf509f9){return function(_0x42dd1f){if(_0x42dd1f){var _0x326468=_0x42dd1f['count'],_0x105afa=_0xf509f9[_0xc5ad('0x34')],_0x392469=_0xf509f9[_0xc5ad('0x34')]+_0xf509f9[_0xc5ad('0x35')],_0x453423;if(_0x392469>=_0x326468){_0x392469=_0x326468;_0x453423=0xc8;}else{_0x453423=0xce;}_0x188d02[_0xc5ad('0x32')](_0x453423);return _0x188d02[_0xc5ad('0x36')](_0xc5ad('0x37'),_0x105afa+'-'+_0x392469+'/'+_0x326468)[_0xc5ad('0x38')](_0x42dd1f);}return null;};}function patchUpdates(_0x4c603a){return function(_0x6417a7){try{jsonpatch['apply'](_0x6417a7,_0x4c603a,!![]);}catch(_0x486aa2){return BPromise[_0xc5ad('0x39')](_0x486aa2);}return _0x6417a7[_0xc5ad('0x3a')]();};}function saveUpdates(_0x26dba7,_0x5c1120){return function(_0x2e67fe){if(_0x2e67fe){return _0x2e67fe['update'](_0x26dba7)[_0xc5ad('0x28')](function(_0x2b1c29){return _0x2b1c29;});}return null;};}function removeEntity(_0x1bf8fe,_0x316a08){return function(_0x2108ab){if(_0x2108ab){return _0x2108ab['destroy']()[_0xc5ad('0x28')](function(){var _0x22c929=_0x2108ab['get']({'plain':!![]});var _0x34063f=_0xc5ad('0x3b');return db[_0xc5ad('0x3c')][_0xc5ad('0x3d')]({'where':{'type':_0x34063f,'resourceId':_0x22c929['id']}})[_0xc5ad('0x28')](function(){return _0x2108ab;});})[_0xc5ad('0x28')](function(){_0x1bf8fe[_0xc5ad('0x32')](0xcc)[_0xc5ad('0x33')]();});}};}function handleEntityNotFound(_0x547a09,_0x569c18){return function(_0x231397){if(!_0x231397){_0x547a09['sendStatus'](0x194);}return _0x231397;};}function handleError(_0x49bb56,_0x5da57d){_0x5da57d=_0x5da57d||0x1f4;return function(_0x487cef){logger[_0xc5ad('0x2e')](_0x487cef['stack']);if(_0x487cef[_0xc5ad('0x3e')]){delete _0x487cef[_0xc5ad('0x3e')];}_0x49bb56[_0xc5ad('0x32')](_0x5da57d)[_0xc5ad('0x3f')](_0x487cef);};}exports[_0xc5ad('0x40')]=function(_0x126d25,_0x5be217){var _0x5d21ba={'include':[{'model':db['MailServerIn'],'as':_0xc5ad('0x41')},{'model':db[_0xc5ad('0x42')],'as':'Smtp'},{'model':db['Pause'],'as':_0xc5ad('0x43')}]},_0x19e118={},_0x1a5fe7={'count':0x0,'rows':[]};var _0x5c5310=_[_0xc5ad('0x44')](db[_0xc5ad('0x45')][_0xc5ad('0x46')],function(_0x133171){return{'name':_0x133171['fieldName'],'type':_0x133171['type']['key']};});_0x19e118[_0xc5ad('0x47')]=_[_0xc5ad('0x44')](_0x5c5310,_0xc5ad('0x3e'));_0x19e118[_0xc5ad('0x48')]=_['keys'](_0x126d25[_0xc5ad('0x48')]);_0x19e118[_0xc5ad('0x49')]=_[_0xc5ad('0x4a')](_0x19e118[_0xc5ad('0x47')],_0x19e118[_0xc5ad('0x48')]);_0x5d21ba[_0xc5ad('0x4b')]=_[_0xc5ad('0x4a')](_0x19e118[_0xc5ad('0x47')],qs['fields'](_0x126d25[_0xc5ad('0x48')][_0xc5ad('0x4c')]));_0x5d21ba['attributes']=_0x5d21ba[_0xc5ad('0x4b')][_0xc5ad('0x4d')]?_0x5d21ba[_0xc5ad('0x4b')]:_0x19e118[_0xc5ad('0x47')];if(!_0x126d25[_0xc5ad('0x48')]['hasOwnProperty']('nolimit')){_0x5d21ba[_0xc5ad('0x35')]=qs[_0xc5ad('0x35')](_0x126d25[_0xc5ad('0x48')][_0xc5ad('0x35')]);_0x5d21ba['offset']=qs[_0xc5ad('0x34')](_0x126d25['query']['offset']);}_0x5d21ba[_0xc5ad('0x4e')]=qs[_0xc5ad('0x4f')](_0x126d25['query'][_0xc5ad('0x4f')]);_0x5d21ba[_0xc5ad('0x50')]=qs[_0xc5ad('0x49')](_[_0xc5ad('0x51')](_0x126d25[_0xc5ad('0x48')],_0x19e118[_0xc5ad('0x49')]));if(_0x126d25[_0xc5ad('0x48')]['filter']){_0x5d21ba[_0xc5ad('0x50')]=_[_0xc5ad('0x52')](_0x5d21ba['where'],{'$or':_[_0xc5ad('0x44')](_0x5c5310,function(_0xf471ff){if(_0xf471ff['type']!==_0xc5ad('0x53')){var _0x464d3e={};_0x464d3e[_0xf471ff[_0xc5ad('0x3e')]]={'$like':'%'+_0x126d25[_0xc5ad('0x48')][_0xc5ad('0x54')]+'%'};return _0x464d3e;}})});}_0x5d21ba=_[_0xc5ad('0x52')]({},_0x5d21ba,_0x126d25[_0xc5ad('0x55')]);var _0x1bb1d5={'where':_0x5d21ba[_0xc5ad('0x50')]};return db[_0xc5ad('0x45')][_0xc5ad('0x56')](_0x1bb1d5)[_0xc5ad('0x28')](function(_0x41b5e3){_0x1a5fe7[_0xc5ad('0x56')]=_0x41b5e3;if(_0x126d25[_0xc5ad('0x48')][_0xc5ad('0x57')]){_0x5d21ba[_0xc5ad('0x58')]=[{'all':!![]}];}return db[_0xc5ad('0x45')][_0xc5ad('0x59')](_0x5d21ba);})['then'](function(_0xa7f356){_0x1a5fe7[_0xc5ad('0x5a')]=_0xa7f356;return _0x1a5fe7;})[_0xc5ad('0x28')](respondWithFilteredResult(_0x5be217,_0x5d21ba))[_0xc5ad('0x30')](handleError(_0x5be217,null));};exports['show']=function(_0x6cd31c,_0x527abf){var _0x1585c2={'raw':![],'where':{'id':_0x6cd31c[_0xc5ad('0x5b')]['id']},'include':[{'model':db['MailServerIn'],'as':_0xc5ad('0x41')},{'model':db['MailServerOut'],'as':_0xc5ad('0x5c')},{'model':db[_0xc5ad('0x5d')],'as':_0xc5ad('0x43')}]},_0x2ef143={};_0x2ef143['model']=_[_0xc5ad('0x5e')](db[_0xc5ad('0x45')][_0xc5ad('0x46')]);_0x2ef143['query']=_['keys'](_0x6cd31c[_0xc5ad('0x48')]);_0x2ef143[_0xc5ad('0x49')]=_[_0xc5ad('0x4a')](_0x2ef143[_0xc5ad('0x47')],_0x2ef143[_0xc5ad('0x48')]);_0x1585c2[_0xc5ad('0x4b')]=_[_0xc5ad('0x4a')](_0x2ef143[_0xc5ad('0x47')],qs[_0xc5ad('0x4c')](_0x6cd31c[_0xc5ad('0x48')]['fields']));_0x1585c2['attributes']=_0x1585c2[_0xc5ad('0x4b')][_0xc5ad('0x4d')]?_0x1585c2['attributes']:_0x2ef143[_0xc5ad('0x47')];if(_0x6cd31c[_0xc5ad('0x48')][_0xc5ad('0x57')]){_0x1585c2['include']=[{'all':!![]}];}_0x1585c2=_[_0xc5ad('0x52')]({},_0x1585c2,_0x6cd31c[_0xc5ad('0x55')]);return db[_0xc5ad('0x45')][_0xc5ad('0x5f')](_0x1585c2)[_0xc5ad('0x28')](handleEntityNotFound(_0x527abf,null))[_0xc5ad('0x28')](respondWithResult(_0x527abf,null))[_0xc5ad('0x30')](handleError(_0x527abf,null));};exports[_0xc5ad('0x60')]=function(_0x501fa2,_0x5e6f34){if(_0x501fa2[_0xc5ad('0x61')]['id']){delete _0x501fa2[_0xc5ad('0x61')]['id'];}return db['MailAccount']['find']({'where':{'id':_0x501fa2[_0xc5ad('0x5b')]['id']},'include':[{'model':db[_0xc5ad('0x62')],'as':'Imap'},{'model':db[_0xc5ad('0x42')],'as':_0xc5ad('0x5c')},{'model':db[_0xc5ad('0x5d')],'as':_0xc5ad('0x43')}]})[_0xc5ad('0x28')](handleEntityNotFound(_0x5e6f34,null))[_0xc5ad('0x28')](saveUpdates(_0x501fa2[_0xc5ad('0x61')],null))[_0xc5ad('0x28')](function(_0x4b236f){if(_0x4b236f&&_0x501fa2['body'][_0xc5ad('0x41')]){return db[_0xc5ad('0x62')][_0xc5ad('0x60')](_0x501fa2[_0xc5ad('0x61')]['Imap'],{'where':{'MailAccountId':_0x4b236f['id']}})['then'](function(){return _0x4b236f;});}return _0x4b236f;})[_0xc5ad('0x28')](function(_0x50c839){if(_0x50c839&&_0x501fa2[_0xc5ad('0x61')][_0xc5ad('0x5c')]){return db['MailServerOut'][_0xc5ad('0x60')](_0x501fa2[_0xc5ad('0x61')][_0xc5ad('0x5c')],{'where':{'MailAccountId':_0x50c839['id']}})['then'](function(){return _0x50c839;});}return _0x50c839;})[_0xc5ad('0x28')](respondWithResult(_0x5e6f34,null))['catch'](handleError(_0x5e6f34,null));};exports[_0xc5ad('0x63')]=function(_0x403536,_0x5b8b9f){return db[_0xc5ad('0x45')]['describe']()[_0xc5ad('0x28')](respondWithResult(_0x5b8b9f,null))['catch'](handleError(_0x5b8b9f,null));};exports[_0xc5ad('0x64')]=function(_0x440c2a,_0x2bf1c2,_0x5680f6){if(_0x440c2a['body']['id']){delete _0x440c2a[_0xc5ad('0x61')]['id'];}return db[_0xc5ad('0x45')][_0xc5ad('0x5f')]({'where':{'id':_0x440c2a[_0xc5ad('0x5b')]['id']}})[_0xc5ad('0x28')](handleEntityNotFound(_0x2bf1c2,null))['then'](function(_0x1c8ef9){if(_0x1c8ef9){_0x440c2a['body'][_0xc5ad('0x65')]=_0x1c8ef9['id'];return db[_0xc5ad('0x66')]['create'](_0x440c2a['body']);}})['then'](respondWithResult(_0x2bf1c2,null))['catch'](handleError(_0x2bf1c2,null));};exports['getDispositions']=function(_0x271069,_0x1279b3,_0x34611b){var _0x5e5030={'raw':![],'where':{}};var _0x3dfa78={};var _0x52f2c8={'count':0x0,'rows':[]};return db['MailAccount']['findOne']({'where':{'id':_0x271069['params']['id']}})['then'](handleEntityNotFound(_0x1279b3,null))[_0xc5ad('0x28')](function(_0x257adc){if(_0x257adc){_0x3dfa78['model']=_[_0xc5ad('0x5e')](db[_0xc5ad('0x66')]['rawAttributes']);_0x3dfa78['query']=_[_0xc5ad('0x5e')](_0x271069[_0xc5ad('0x48')]);_0x3dfa78[_0xc5ad('0x49')]=_[_0xc5ad('0x4a')](_0x3dfa78[_0xc5ad('0x47')],_0x3dfa78[_0xc5ad('0x48')]);_0x5e5030[_0xc5ad('0x4b')]=_['intersection'](_0x3dfa78['model'],qs['fields'](_0x271069[_0xc5ad('0x48')][_0xc5ad('0x4c')]));_0x5e5030[_0xc5ad('0x4b')]=_0x5e5030[_0xc5ad('0x4b')][_0xc5ad('0x4d')]?_0x5e5030[_0xc5ad('0x4b')]:_0x3dfa78[_0xc5ad('0x47')];if(!_0x271069[_0xc5ad('0x48')]['hasOwnProperty']('nolimit')){_0x5e5030['limit']=qs[_0xc5ad('0x35')](_0x271069[_0xc5ad('0x48')][_0xc5ad('0x35')]);_0x5e5030[_0xc5ad('0x34')]=qs[_0xc5ad('0x34')](_0x271069[_0xc5ad('0x48')][_0xc5ad('0x34')]);}_0x5e5030[_0xc5ad('0x4e')]=qs[_0xc5ad('0x4f')](_0x271069['query'][_0xc5ad('0x4f')]);_0x5e5030[_0xc5ad('0x50')]=qs['filters'](_[_0xc5ad('0x51')](_0x271069[_0xc5ad('0x48')],_0x3dfa78[_0xc5ad('0x49')]));_0x5e5030[_0xc5ad('0x50')][_0xc5ad('0x65')]=_0x257adc['id'];if(_0x271069[_0xc5ad('0x48')][_0xc5ad('0x54')]){_0x5e5030[_0xc5ad('0x50')]=_['merge'](_0x5e5030[_0xc5ad('0x50')],{'$or':_[_0xc5ad('0x44')](_0x5e5030[_0xc5ad('0x4b')],function(_0x521e63){var _0x628fdd={};_0x628fdd[_0x521e63]={'$like':'%'+_0x271069[_0xc5ad('0x48')][_0xc5ad('0x54')]+'%'};return _0x628fdd;})});}_0x5e5030=_[_0xc5ad('0x52')]({},_0x5e5030,_0x271069['options']);return db['Disposition'][_0xc5ad('0x56')]({'where':_0x5e5030['where']})[_0xc5ad('0x28')](function(_0x27b6f3){_0x52f2c8['count']=_0x27b6f3;if(_0x271069[_0xc5ad('0x48')][_0xc5ad('0x57')]){_0x5e5030[_0xc5ad('0x58')]=[{'all':!![]}];}return db[_0xc5ad('0x66')][_0xc5ad('0x59')](_0x5e5030);})[_0xc5ad('0x28')](function(_0x1c1509){_0x52f2c8[_0xc5ad('0x5a')]=_0x1c1509;return _0x52f2c8;});}})[_0xc5ad('0x28')](respondWithFilteredResult(_0x1279b3,_0x5e5030))[_0xc5ad('0x30')](handleError(_0x1279b3,null));};exports[_0xc5ad('0x67')]=function(_0x111f86,_0x5cf0b9,_0x520a76){return db[_0xc5ad('0x45')]['find']({'where':{'id':_0x111f86['params']['id']}})['then'](handleEntityNotFound(_0x5cf0b9,null))[_0xc5ad('0x28')](function(_0x121b09){if(_0x121b09){return _0x121b09['removeDispositions'](_0x111f86[_0xc5ad('0x48')]['ids']);}})['then'](respondWithStatusCode(_0x5cf0b9,null))['catch'](handleError(_0x5cf0b9,null));};exports[_0xc5ad('0x68')]=function(_0x344b15,_0x32a5c9,_0xb0f278){if(_0x344b15[_0xc5ad('0x61')]['id']){delete _0x344b15[_0xc5ad('0x61')]['id'];}return db[_0xc5ad('0x45')][_0xc5ad('0x5f')]({'where':{'id':_0x344b15['params']['id']}})[_0xc5ad('0x28')](handleEntityNotFound(_0x32a5c9,null))[_0xc5ad('0x28')](function(_0xa9cdb4){if(_0xa9cdb4){_0x344b15['body'][_0xc5ad('0x65')]=_0xa9cdb4['id'];return db['CannedAnswer'][_0xc5ad('0x69')](_0x344b15['body']);}})['then'](respondWithResult(_0x32a5c9,null))[_0xc5ad('0x30')](handleError(_0x32a5c9,null));};exports[_0xc5ad('0x6a')]=function(_0x546061,_0x2379be,_0x1c7e1){var _0x1f8da6={'raw':![],'where':{}};var _0x3ba9b1={};var _0x3ffb3a={'count':0x0,'rows':[]};return db[_0xc5ad('0x45')][_0xc5ad('0x6b')]({'where':{'id':_0x546061[_0xc5ad('0x5b')]['id']}})[_0xc5ad('0x28')](handleEntityNotFound(_0x2379be,null))[_0xc5ad('0x28')](function(_0xfa9b0d){if(_0xfa9b0d){_0x3ba9b1[_0xc5ad('0x47')]=_[_0xc5ad('0x5e')](db[_0xc5ad('0x6c')][_0xc5ad('0x46')]);_0x3ba9b1[_0xc5ad('0x48')]=_[_0xc5ad('0x5e')](_0x546061[_0xc5ad('0x48')]);_0x3ba9b1[_0xc5ad('0x49')]=_[_0xc5ad('0x4a')](_0x3ba9b1[_0xc5ad('0x47')],_0x3ba9b1[_0xc5ad('0x48')]);_0x1f8da6[_0xc5ad('0x4b')]=_[_0xc5ad('0x4a')](_0x3ba9b1[_0xc5ad('0x47')],qs[_0xc5ad('0x4c')](_0x546061[_0xc5ad('0x48')][_0xc5ad('0x4c')]));_0x1f8da6[_0xc5ad('0x4b')]=_0x1f8da6[_0xc5ad('0x4b')][_0xc5ad('0x4d')]?_0x1f8da6[_0xc5ad('0x4b')]:_0x3ba9b1[_0xc5ad('0x47')];if(!_0x546061['query'][_0xc5ad('0x6d')](_0xc5ad('0x6e'))){_0x1f8da6[_0xc5ad('0x35')]=qs[_0xc5ad('0x35')](_0x546061[_0xc5ad('0x48')]['limit']);_0x1f8da6[_0xc5ad('0x34')]=qs[_0xc5ad('0x34')](_0x546061['query']['offset']);}_0x1f8da6[_0xc5ad('0x4e')]=qs[_0xc5ad('0x4f')](_0x546061[_0xc5ad('0x48')][_0xc5ad('0x4f')]);_0x1f8da6['where']=qs[_0xc5ad('0x49')](_[_0xc5ad('0x51')](_0x546061[_0xc5ad('0x48')],_0x3ba9b1['filters']));_0x1f8da6[_0xc5ad('0x50')][_0xc5ad('0x65')]=_0xfa9b0d['id'];if(_0x546061[_0xc5ad('0x48')][_0xc5ad('0x54')]){_0x1f8da6[_0xc5ad('0x50')]=_[_0xc5ad('0x52')](_0x1f8da6[_0xc5ad('0x50')],{'$or':_['map'](_0x1f8da6['attributes'],function(_0x149623){var _0x30611b={};_0x30611b[_0x149623]={'$like':'%'+_0x546061['query'][_0xc5ad('0x54')]+'%'};return _0x30611b;})});}_0x1f8da6=_['merge']({},_0x1f8da6,_0x546061[_0xc5ad('0x55')]);return db['CannedAnswer'][_0xc5ad('0x56')]({'where':_0x1f8da6[_0xc5ad('0x50')]})['then'](function(_0x3b81a2){_0x3ffb3a[_0xc5ad('0x56')]=_0x3b81a2;if(_0x546061[_0xc5ad('0x48')][_0xc5ad('0x57')]){_0x1f8da6[_0xc5ad('0x58')]=[{'all':!![]}];}return db[_0xc5ad('0x6c')][_0xc5ad('0x59')](_0x1f8da6);})[_0xc5ad('0x28')](function(_0x2ccb14){_0x3ffb3a[_0xc5ad('0x5a')]=_0x2ccb14;return _0x3ffb3a;});}})[_0xc5ad('0x28')](respondWithFilteredResult(_0x2379be,_0x1f8da6))[_0xc5ad('0x30')](handleError(_0x2379be,null));};exports[_0xc5ad('0x6f')]=function(_0x45a0de,_0x49d7b7,_0x16c44b){return db[_0xc5ad('0x45')][_0xc5ad('0x5f')]({'where':{'id':_0x45a0de[_0xc5ad('0x5b')]['id']}})[_0xc5ad('0x28')](handleEntityNotFound(_0x49d7b7,null))['then'](function(_0x588902){if(_0x588902){return _0x588902[_0xc5ad('0x6f')](_0x45a0de[_0xc5ad('0x48')][_0xc5ad('0x70')]);}})[_0xc5ad('0x28')](respondWithStatusCode(_0x49d7b7,null))[_0xc5ad('0x30')](handleError(_0x49d7b7,null));};exports['create']=function(_0x1b133c,_0x362449){var _0x2eb860={'name':_0x1b133c[_0xc5ad('0x61')][_0xc5ad('0x3e')],'key':_0x1b133c[_0xc5ad('0x61')][_0xc5ad('0x71')],'email':_0x1b133c['body'][_0xc5ad('0x72')],'ListId':_0x1b133c[_0xc5ad('0x61')][_0xc5ad('0x73')],'active':!_[_0xc5ad('0x74')](_0x1b133c[_0xc5ad('0x61')][_0xc5ad('0x75')])?_0x1b133c[_0xc5ad('0x61')][_0xc5ad('0x75')]:!![],'description':_0x1b133c['body'][_0xc5ad('0x76')]||null,'Imap':{},'Smtp':{}};if(_['isNil'](_0x1b133c['body']['cservice'])){if(_0x1b133c['body']['cauthentication']){_0x2eb860[_0xc5ad('0x41')][_0xc5ad('0x77')]=_0x2eb860[_0xc5ad('0x5c')]['user']=_0x1b133c[_0xc5ad('0x61')][_0xc5ad('0x78')];_0x2eb860[_0xc5ad('0x41')][_0xc5ad('0x79')]=_0x2eb860['Smtp'][_0xc5ad('0x7a')]=_0x1b133c[_0xc5ad('0x61')]['cpassword'];}else{_0x2eb860['Imap']['authentication']=_0x2eb860[_0xc5ad('0x5c')][_0xc5ad('0x7b')]=![];}_0x2eb860['Imap'][_0xc5ad('0x7c')]=_0x1b133c[_0xc5ad('0x61')]['Imap']['host'];_0x2eb860[_0xc5ad('0x41')]['port']=_0x1b133c['body'][_0xc5ad('0x41')][_0xc5ad('0x7d')];_0x2eb860[_0xc5ad('0x5c')][_0xc5ad('0x7c')]=_0x1b133c[_0xc5ad('0x61')]['Smtp'][_0xc5ad('0x7c')];_0x2eb860[_0xc5ad('0x5c')]['port']=_0x1b133c['body'][_0xc5ad('0x5c')][_0xc5ad('0x7d')];}else{_0x2eb860[_0xc5ad('0x41')][_0xc5ad('0x7e')]=_0x2eb860[_0xc5ad('0x5c')]['service']=_0x1b133c[_0xc5ad('0x61')][_0xc5ad('0x7f')];_0x2eb860['Imap'][_0xc5ad('0x77')]=_0x2eb860[_0xc5ad('0x5c')][_0xc5ad('0x77')]=_0x1b133c[_0xc5ad('0x61')][_0xc5ad('0x78')];_0x2eb860[_0xc5ad('0x41')][_0xc5ad('0x79')]=_0x2eb860[_0xc5ad('0x5c')][_0xc5ad('0x7a')]=_0x1b133c[_0xc5ad('0x61')][_0xc5ad('0x80')];}return db[_0xc5ad('0x45')][_0xc5ad('0x69')](_0x2eb860,{'include':[{'model':db[_0xc5ad('0x42')],'as':'Smtp'},{'model':db[_0xc5ad('0x62')],'as':_0xc5ad('0x41')}]})[_0xc5ad('0x28')](function(_0xfbddb4){var _0x5a80d1=_0x1b133c['user'][_0xc5ad('0x81')]({'plain':!![]});if(!_0x5a80d1)throw new Error(_0xc5ad('0x82'));if(_0x5a80d1[_0xc5ad('0x83')]===_0xc5ad('0x77')){var _0x2f6d66=_0xfbddb4[_0xc5ad('0x81')]({'plain':!![]});return db[_0xc5ad('0x84')][_0xc5ad('0x5f')]({'where':{'name':_0xc5ad('0x3b'),'userProfileId':_0x5a80d1[_0xc5ad('0x85')]},'raw':!![]})[_0xc5ad('0x28')](function(_0xb7c5c3){if(_0xb7c5c3&&_0xb7c5c3[_0xc5ad('0x86')]===0x0){return db[_0xc5ad('0x3c')][_0xc5ad('0x69')]({'name':_0x2f6d66[_0xc5ad('0x3e')],'resourceId':_0x2f6d66['id'],'type':_0xb7c5c3['name'],'sectionId':_0xb7c5c3['id']},{})['then'](function(){return _0xfbddb4;});}else{return _0xfbddb4;}})[_0xc5ad('0x30')](function(_0x476b27){logger['error'](_0xc5ad('0x87'),_0x476b27);throw _0x476b27;});}return _0xfbddb4;})[_0xc5ad('0x28')](respondWithResult(_0x362449,0xc9))[_0xc5ad('0x30')](handleError(_0x362449,null));};exports[_0xc5ad('0x88')]=function(_0x5810c2,_0x24f8e4,_0x1b3e2d){return db[_0xc5ad('0x45')][_0xc5ad('0x6b')]({'where':{'id':_0x5810c2[_0xc5ad('0x5b')]['id']}})[_0xc5ad('0x28')](handleEntityNotFound(_0x24f8e4,null))[_0xc5ad('0x28')](function(_0x15a142){if(_0x15a142){return _0x15a142['getImap']();}return null;})[_0xc5ad('0x28')](respondWithResult(_0x24f8e4,null))[_0xc5ad('0x30')](handleError(_0x24f8e4,null));};exports[_0xc5ad('0x89')]=function(_0x5eb01f,_0x5e3285,_0x35f485){if(_0x5eb01f[_0xc5ad('0x61')]['id']){delete _0x5eb01f['body']['id'];}return db['MailAccount'][_0xc5ad('0x5f')]({'where':{'id':_0x5eb01f['params']['id']}})[_0xc5ad('0x28')](handleEntityNotFound(_0x5e3285,null))[_0xc5ad('0x28')](function(_0x4cbd21){if(_0x4cbd21){_0x5eb01f[_0xc5ad('0x61')]['MailAccountId']=_0x4cbd21['id'];return db[_0xc5ad('0x62')][_0xc5ad('0x69')](_0x5eb01f[_0xc5ad('0x61')]);}})[_0xc5ad('0x28')](respondWithResult(_0x5e3285,null))[_0xc5ad('0x30')](handleError(_0x5e3285,null));};exports[_0xc5ad('0x8a')]=function(_0x277a3e,_0x4f9666,_0x2dedda){return db['MailAccount'][_0xc5ad('0x6b')]({'where':{'id':_0x277a3e[_0xc5ad('0x5b')]['id']}})[_0xc5ad('0x28')](handleEntityNotFound(_0x4f9666,null))[_0xc5ad('0x28')](function(_0x5d44a2){if(_0x5d44a2){return _0x5d44a2['setImap'](null);}return null;})[_0xc5ad('0x28')](respondWithStatusCode(_0x4f9666,null))[_0xc5ad('0x30')](handleError(_0x4f9666,null));};exports[_0xc5ad('0x8b')]=function(_0x3af0e5,_0xbc86f9,_0xd91c8a){return db[_0xc5ad('0x45')][_0xc5ad('0x6b')]({'where':{'id':_0x3af0e5[_0xc5ad('0x5b')]['id']}})['then'](handleEntityNotFound(_0xbc86f9,null))[_0xc5ad('0x28')](function(_0x2a93a8){if(_0x2a93a8){return _0x2a93a8[_0xc5ad('0x8b')]();}return null;})[_0xc5ad('0x28')](respondWithResult(_0xbc86f9,null))[_0xc5ad('0x30')](handleError(_0xbc86f9,null));};exports[_0xc5ad('0x8c')]=function(_0x544649,_0xdb11ca,_0x468a41){if(_0x544649['body']['id']){delete _0x544649['body']['id'];}return db[_0xc5ad('0x45')][_0xc5ad('0x5f')]({'where':{'id':_0x544649[_0xc5ad('0x5b')]['id']}})[_0xc5ad('0x28')](handleEntityNotFound(_0xdb11ca,null))[_0xc5ad('0x28')](function(_0x444c4c){if(_0x444c4c){_0x544649[_0xc5ad('0x61')][_0xc5ad('0x65')]=_0x444c4c['id'];return db[_0xc5ad('0x42')]['create'](_0x544649['body']);}})['then'](respondWithResult(_0xdb11ca,null))[_0xc5ad('0x30')](handleError(_0xdb11ca,null));};exports['removeSmtp']=function(_0x148940,_0x266a81,_0x428fde){return db[_0xc5ad('0x45')][_0xc5ad('0x6b')]({'where':{'id':_0x148940['params']['id']}})[_0xc5ad('0x28')](handleEntityNotFound(_0x266a81,null))[_0xc5ad('0x28')](function(_0x2a6b2f){if(_0x2a6b2f){return _0x2a6b2f['setSmtp'](null);}return null;})[_0xc5ad('0x28')](respondWithStatusCode(_0x266a81,null))[_0xc5ad('0x30')](handleError(_0x266a81,null));};exports[_0xc5ad('0x8d')]=function(_0x211882,_0x2a635c,_0x46704e){return db[_0xc5ad('0x8e')]['find']({'where':{'id':_0x211882[_0xc5ad('0x5b')]['id']}})['then'](handleEntityNotFound(_0x2a635c,null))[_0xc5ad('0x28')](function(_0x827527){if(_0x827527){return _0x827527[_0xc5ad('0x8d')](_0x211882[_0xc5ad('0x61')][_0xc5ad('0x70')],_[_0xc5ad('0x8f')](_0x211882['body'],[_0xc5ad('0x70'),'id'])||{});}})['then'](respondWithResult(_0x2a635c,null))[_0xc5ad('0x30')](handleError(_0x2a635c,null));};exports[_0xc5ad('0x90')]=function(_0x3dc42f,_0x59d39a,_0x6dae80){var _0x5c161f={'raw':![],'where':{}};var _0x5abcd6={};var _0x22e8ee={'count':0x0,'rows':[]};return db[_0xc5ad('0x45')][_0xc5ad('0x6b')]({'where':{'id':_0x3dc42f[_0xc5ad('0x5b')]['id']}})[_0xc5ad('0x28')](handleEntityNotFound(_0x59d39a,null))['then'](function(_0x3d9cdc){if(_0x3d9cdc){_0x5abcd6[_0xc5ad('0x47')]=_[_0xc5ad('0x5e')](db[_0xc5ad('0x8e')]['rawAttributes']);_0x5abcd6[_0xc5ad('0x48')]=_[_0xc5ad('0x5e')](_0x3dc42f[_0xc5ad('0x48')]);_0x5abcd6['filters']=_[_0xc5ad('0x4a')](_0x5abcd6[_0xc5ad('0x47')],_0x5abcd6[_0xc5ad('0x48')]);_0x5c161f['attributes']=_[_0xc5ad('0x4a')](_0x5abcd6[_0xc5ad('0x47')],qs[_0xc5ad('0x4c')](_0x3dc42f[_0xc5ad('0x48')][_0xc5ad('0x4c')]));_0x5c161f[_0xc5ad('0x4b')]=_0x5c161f[_0xc5ad('0x4b')][_0xc5ad('0x4d')]?_0x5c161f[_0xc5ad('0x4b')]:_0x5abcd6[_0xc5ad('0x47')];if(!_0x3dc42f[_0xc5ad('0x48')][_0xc5ad('0x6d')](_0xc5ad('0x6e'))){_0x5c161f[_0xc5ad('0x35')]=qs[_0xc5ad('0x35')](_0x3dc42f[_0xc5ad('0x48')][_0xc5ad('0x35')]);_0x5c161f['offset']=qs['offset'](_0x3dc42f['query'][_0xc5ad('0x34')]);}_0x5c161f[_0xc5ad('0x4e')]=qs['sort'](_0x3dc42f[_0xc5ad('0x48')][_0xc5ad('0x4f')]);_0x5c161f['where']=qs[_0xc5ad('0x49')](_[_0xc5ad('0x51')](_0x3dc42f[_0xc5ad('0x48')],_0x5abcd6['filters']));_0x5c161f['where'][_0xc5ad('0x65')]=_0x3d9cdc['id'];if(_0x3dc42f[_0xc5ad('0x48')][_0xc5ad('0x54')]){_0x5c161f[_0xc5ad('0x50')]=_[_0xc5ad('0x52')](_0x5c161f['where'],{'$or':_[_0xc5ad('0x44')](_0x5c161f[_0xc5ad('0x4b')],function(_0x6b0b8b){var _0x542a57={};_0x542a57[_0x6b0b8b]={'$like':'%'+_0x3dc42f[_0xc5ad('0x48')]['filter']+'%'};return _0x542a57;})});}_0x5c161f=_[_0xc5ad('0x52')]({},_0x5c161f,_0x3dc42f['options']);return db[_0xc5ad('0x8e')]['count']({'where':_0x5c161f[_0xc5ad('0x50')]})['then'](function(_0x16395c){_0x22e8ee[_0xc5ad('0x56')]=_0x16395c;if(_0x3dc42f[_0xc5ad('0x48')]['includeAll']){_0x5c161f[_0xc5ad('0x58')]=[{'model':db[_0xc5ad('0x91')],'as':'Contact','required':![]},{'model':db[_0xc5ad('0x92')],'as':_0xc5ad('0x93'),'attributes':['name',_0xc5ad('0x94'),_0xc5ad('0x95')],'required':![]},{'model':db[_0xc5ad('0x96')],'as':_0xc5ad('0x97'),'attributes':['id','name','color'],'where':_0x3dc42f[_0xc5ad('0x48')][_0xc5ad('0x98')]?{'id':_0x3dc42f[_0xc5ad('0x48')][_0xc5ad('0x98')]}:undefined,'required':_0x3dc42f[_0xc5ad('0x48')][_0xc5ad('0x98')]?!![]:![]}];}return db[_0xc5ad('0x8e')][_0xc5ad('0x59')](_0x5c161f);})[_0xc5ad('0x28')](function(_0x21383a){_0x22e8ee[_0xc5ad('0x5a')]=_0x21383a;return _0x22e8ee;});}})[_0xc5ad('0x28')](respondWithFilteredResult(_0x59d39a,_0x5c161f))[_0xc5ad('0x30')](handleError(_0x59d39a,null));};exports[_0xc5ad('0x99')]=function(_0x4c35a9,_0x38071c,_0x724b83){return db['MailAccount'][_0xc5ad('0x6b')]({'where':{'id':_0x4c35a9[_0xc5ad('0x5b')]['id']}})[_0xc5ad('0x28')](handleEntityNotFound(_0x38071c,null))[_0xc5ad('0x28')](function(_0x4a1c67){if(_0x4a1c67){return db['sequelize'][_0xc5ad('0x9a')](function(_0x53601e){return db[_0xc5ad('0x9b')][_0xc5ad('0x3d')]({'where':{'MailAccountId':_0x4c35a9[_0xc5ad('0x5b')]['id']},'transaction':_0x53601e})[_0xc5ad('0x28')](function(_0x344966){var _0x5df821=_['map'](_0x4c35a9[_0xc5ad('0x61')],function(_0xa75fcd){_0xa75fcd[_0xc5ad('0x65')]=_0x4c35a9[_0xc5ad('0x5b')]['id'];return _0xa75fcd;});return db[_0xc5ad('0x9b')][_0xc5ad('0x9c')](_0x5df821,{'transaction':_0x53601e});});})[_0xc5ad('0x28')](function(){return db[_0xc5ad('0x9b')][_0xc5ad('0x9d')]({'where':{'MailAccountId':_0x4c35a9[_0xc5ad('0x5b')]['id']},'order':'priority'});});}})[_0xc5ad('0x28')](respondWithResult(_0x38071c,null))['catch'](handleError(_0x38071c,null));};exports[_0xc5ad('0x9e')]=function(_0x57594b,_0x200c37,_0x2afe5e){var _0x42fb38={};var _0x2f4680={};var _0x523b02;var _0x1f4398;return db[_0xc5ad('0x45')][_0xc5ad('0x6b')]({'where':{'id':_0x57594b[_0xc5ad('0x5b')]['id']}})[_0xc5ad('0x28')](handleEntityNotFound(_0x200c37,null))['then'](function(_0x252f62){if(_0x252f62){_0x523b02=_0x252f62;_0x2f4680[_0xc5ad('0x47')]=_[_0xc5ad('0x5e')](db[_0xc5ad('0x9b')][_0xc5ad('0x46')]);_0x2f4680['query']=_['keys'](_0x57594b['query']);_0x2f4680[_0xc5ad('0x49')]=_[_0xc5ad('0x4a')](_0x2f4680['model'],_0x2f4680[_0xc5ad('0x48')]);_0x42fb38[_0xc5ad('0x4b')]=_[_0xc5ad('0x4a')](_0x2f4680['model'],qs[_0xc5ad('0x4c')](_0x57594b[_0xc5ad('0x48')]['fields']));_0x42fb38[_0xc5ad('0x4b')]=_0x42fb38['attributes'][_0xc5ad('0x4d')]?_0x42fb38[_0xc5ad('0x4b')]:_0x2f4680[_0xc5ad('0x47')];_0x42fb38['order']=qs[_0xc5ad('0x4f')](_0x57594b[_0xc5ad('0x48')][_0xc5ad('0x4f')]);_0x42fb38['where']=qs[_0xc5ad('0x49')](_[_0xc5ad('0x51')](_0x57594b['query'],_0x2f4680[_0xc5ad('0x49')]));if(_0x57594b[_0xc5ad('0x48')][_0xc5ad('0x54')]){_0x42fb38['where']=_[_0xc5ad('0x52')](_0x42fb38[_0xc5ad('0x50')],{'$or':_[_0xc5ad('0x44')](_0x42fb38[_0xc5ad('0x4b')],function(_0x53103c){var _0xf5f7be={};_0xf5f7be[_0x53103c]={'$like':'%'+_0x57594b[_0xc5ad('0x48')][_0xc5ad('0x54')]+'%'};return _0xf5f7be;})});}_0x42fb38=_[_0xc5ad('0x52')]({},_0x42fb38,_0x57594b[_0xc5ad('0x55')]);return _0x523b02[_0xc5ad('0x9e')](_0x42fb38);}})[_0xc5ad('0x28')](function(_0x51c0e8){if(_0x51c0e8){_0x1f4398=_0x51c0e8[_0xc5ad('0x4d')];if(!_0x57594b['query'][_0xc5ad('0x6d')]('nolimit')){_0x42fb38[_0xc5ad('0x35')]=qs[_0xc5ad('0x35')](_0x57594b[_0xc5ad('0x48')][_0xc5ad('0x35')]);_0x42fb38[_0xc5ad('0x34')]=qs[_0xc5ad('0x34')](_0x57594b[_0xc5ad('0x48')]['offset']);}return _0x523b02[_0xc5ad('0x9e')](_0x42fb38);}})[_0xc5ad('0x28')](function(_0x598b38){if(_0x598b38){return _0x598b38?{'count':_0x1f4398,'rows':_0x598b38}:null;}})[_0xc5ad('0x28')](respondWithResult(_0x200c37,null))[_0xc5ad('0x30')](handleError(_0x200c37,null));};exports['getMessages']=function(_0x59363d,_0x5194a9,_0x4dec08){var _0x2a833d={'raw':!![],'where':{}};var _0x8b6753={};var _0x286af6={'count':0x0,'rows':[]};return db[_0xc5ad('0x45')][_0xc5ad('0x6b')]({'where':{'id':_0x59363d[_0xc5ad('0x5b')]['id']}})[_0xc5ad('0x28')](handleEntityNotFound(_0x5194a9,null))[_0xc5ad('0x28')](function(_0x28e6c9){if(_0x28e6c9){_0x8b6753['model']=_[_0xc5ad('0x5e')](db['MailMessage']['rawAttributes']);_0x8b6753[_0xc5ad('0x48')]=_[_0xc5ad('0x5e')](_0x59363d[_0xc5ad('0x48')]);_0x8b6753['filters']=_[_0xc5ad('0x4a')](_0x8b6753[_0xc5ad('0x47')],_0x8b6753[_0xc5ad('0x48')]);_0x2a833d[_0xc5ad('0x4b')]=_[_0xc5ad('0x4a')](_0x8b6753[_0xc5ad('0x47')],qs['fields'](_0x59363d['query']['fields']));_0x2a833d[_0xc5ad('0x4b')]=_0x2a833d[_0xc5ad('0x4b')][_0xc5ad('0x4d')]?_0x2a833d[_0xc5ad('0x4b')]:_0x8b6753['model'];if(!_0x59363d[_0xc5ad('0x48')][_0xc5ad('0x6d')](_0xc5ad('0x6e'))){_0x2a833d[_0xc5ad('0x35')]=qs['limit'](_0x59363d[_0xc5ad('0x48')][_0xc5ad('0x35')]);_0x2a833d['offset']=qs[_0xc5ad('0x34')](_0x59363d[_0xc5ad('0x48')]['offset']);}_0x2a833d['order']=qs[_0xc5ad('0x4f')](_0x59363d['query'][_0xc5ad('0x4f')]);_0x2a833d['where']=qs['filters'](_['pick'](_0x59363d['query'],_0x8b6753['filters']));_0x2a833d[_0xc5ad('0x50')]['MailAccountId']=_0x28e6c9['id'];if(_0x59363d['query']['filter']){_0x2a833d[_0xc5ad('0x50')]=_['merge'](_0x2a833d['where'],{'$or':_['map'](_0x2a833d[_0xc5ad('0x4b')],function(_0x9df5d6){var _0x101b46={};_0x101b46[_0x9df5d6]={'$like':'%'+_0x59363d['query'][_0xc5ad('0x54')]+'%'};return _0x101b46;})});}if(_0x59363d[_0xc5ad('0x48')][_0xc5ad('0x9f')]){var _0x2da1dc=_0x59363d[_0xc5ad('0x48')][_0xc5ad('0x9f')]['split'](',');var _0x4bd609={};_0x4bd609[_0x2da1dc[0x0]]={'$gte':moment(_0x2da1dc[0x1])[_0xc5ad('0xa0')](_0xc5ad('0xa1'))};_0x2a833d[_0xc5ad('0x50')]=_[_0xc5ad('0x52')](_0x2a833d[_0xc5ad('0x50')],_0x4bd609);}_0x2a833d=_[_0xc5ad('0x52')]({},_0x2a833d,_0x59363d[_0xc5ad('0x55')]);return db[_0xc5ad('0xa2')][_0xc5ad('0x56')]({'where':_0x2a833d[_0xc5ad('0x50')]})[_0xc5ad('0x28')](function(_0x465160){_0x286af6[_0xc5ad('0x56')]=_0x465160;if(_0x59363d[_0xc5ad('0x48')][_0xc5ad('0x57')]){_0x2a833d[_0xc5ad('0x58')]=[{'all':!![]}];}return db['MailMessage'][_0xc5ad('0x59')](_0x2a833d);})[_0xc5ad('0x28')](function(_0xa46dd3){_0x286af6[_0xc5ad('0x5a')]=_0xa46dd3;return _0x286af6;});}})[_0xc5ad('0x28')](respondWithFilteredResult(_0x5194a9,_0x2a833d))[_0xc5ad('0x30')](handleError(_0x5194a9,null));};exports[_0xc5ad('0x3f')]=function(_0x36c43b,_0x499ffd,_0x1865ea){var _0x147975,_0x4c18d4={},_0x3946dc;if(_0x36c43b[_0xc5ad('0x61')]['to']){_0x3946dc=_0x36c43b[_0xc5ad('0x61')]['to'][_0xc5ad('0xa3')](',')[0x0];}return db[_0xc5ad('0x45')]['find']({'where':{'id':_0x36c43b[_0xc5ad('0x5b')]['id']},'include':[{'model':db['CmList'],'as':_0xc5ad('0xa4'),'include':[{'model':db[_0xc5ad('0x91')],'as':_0xc5ad('0xa5'),'where':{'email':_0x3946dc},'limit':0x1,'order':[[_0xc5ad('0xa6'),'DESC']]}]},{'model':db[_0xc5ad('0x42')],'as':'Smtp','raw':!![]}]})['then'](handleEntityNotFound(_0x499ffd,null))[_0xc5ad('0x28')](function(_0xc48219){if(_0xc48219){_0x147975=_0xc48219;if(_0xc48219['Smtp']){if(_[_0xc5ad('0x74')](_0x36c43b[_0xc5ad('0x61')][_0xc5ad('0xa7')])){_0x36c43b[_0xc5ad('0x61')]['from']=util[_0xc5ad('0xa0')](_0xc5ad('0xa8'),_0xc48219['name'],_0xc48219[_0xc5ad('0x72')]||_0xc48219[_0xc5ad('0x5c')][_0xc5ad('0x77')]);}if(_0x36c43b[_0xc5ad('0x61')][_0xc5ad('0xa9')]&&_0x36c43b[_0xc5ad('0x61')][_0xc5ad('0xa9')][_0xc5ad('0x4d')]){for(var _0x107571=0x0;_0x107571<_0x36c43b['body']['attachments'][_0xc5ad('0x4d')];_0x107571+=0x1){_0x36c43b[_0xc5ad('0x61')][_0xc5ad('0xa9')][_0x107571]={'filename':_0x36c43b[_0xc5ad('0x61')][_0xc5ad('0xa9')][_0x107571]['name'],'path':path[_0xc5ad('0xaa')](config['root'],_0xc5ad('0xab'),_0x36c43b[_0xc5ad('0x61')][_0xc5ad('0xa9')][_0x107571][_0xc5ad('0xac')])};}}var _0x4d0dab={'tls':{'rejectUnauthorized':![]}};if(_['isNil'](_0xc48219[_0xc5ad('0x5c')][_0xc5ad('0x7e')])){if(_0xc48219['Smtp'][_0xc5ad('0x7b')]){_0x4d0dab[_0xc5ad('0xad')]={'user':_0xc48219['Smtp'][_0xc5ad('0x77')],'pass':_0xc48219[_0xc5ad('0x5c')][_0xc5ad('0x7a')]};}_0x4d0dab['host']=_0xc48219[_0xc5ad('0x5c')][_0xc5ad('0x7c')];_0x4d0dab['port']=_0xc48219[_0xc5ad('0x5c')][_0xc5ad('0x7d')];_0x4d0dab[_0xc5ad('0xae')]=_0xc48219[_0xc5ad('0x5c')][_0xc5ad('0xae')];}else{_0x4d0dab['service']=_0xc48219[_0xc5ad('0x5c')][_0xc5ad('0x7e')];_0x4d0dab[_0xc5ad('0xad')]={'user':_0xc48219[_0xc5ad('0x5c')][_0xc5ad('0x77')],'pass':_0xc48219[_0xc5ad('0x5c')][_0xc5ad('0x7a')]};}return respondWithRpcPromise(_0xc5ad('0xaf'),_0xc5ad('0xb0'),{'account':_0x4d0dab,'message':_0x36c43b['body']});}else{throw new Error(_0xc5ad('0xb1'));}}})[_0xc5ad('0x28')](function(_0x3bac6d){if(_0x3bac6d){_0x4c18d4=_0x3bac6d;if(_0x147975[_0xc5ad('0xa4')]){if(_0x147975[_0xc5ad('0xa4')][_0xc5ad('0xa5')][_0xc5ad('0x4d')]){return _0x147975['List'][_0xc5ad('0xa5')][0x0];}else{return db[_0xc5ad('0x91')][_0xc5ad('0x69')](_[_0xc5ad('0x1c')](_0x36c43b[_0xc5ad('0x61')],{'firstName':_0x36c43b[_0xc5ad('0x61')]['to'],'email':_0x36c43b[_0xc5ad('0x61')]['to'],'phone':_0x36c43b[_0xc5ad('0x61')]['to'],'ListId':_0x147975[_0xc5ad('0x73')]}));}}else{throw new Error(_0xc5ad('0xb1'));}}})[_0xc5ad('0x28')](function(_0x204c03){if(_0x204c03){var _0x464457={'UserId':_0x36c43b[_0xc5ad('0x77')]['id'],'ContactId':_0x204c03['id'],'MailAccountId':_0x147975['id'],'inReplyTo':_0x4c18d4[_0xc5ad('0xb2')],'to':_0x36c43b[_0xc5ad('0x61')][_0xc5ad('0xa7')],'cc':_0x36c43b[_0xc5ad('0x61')]['cc'],'subject':_0x36c43b[_0xc5ad('0x61')][_0xc5ad('0xb3')],'attach':_0x36c43b['body'][_0xc5ad('0xb4')],'firstMsgDirection':'out','lastMsgAt':moment()[_0xc5ad('0xa0')](_0xc5ad('0xa1')),'lastMsgDirection':_0xc5ad('0xb5'),'lastMsgBody':_0x36c43b['body']['body'],'Messages':[_[_0xc5ad('0x52')](_0x36c43b[_0xc5ad('0x61')],{'messageId':_0x4c18d4[_0xc5ad('0xb2')],'sentAt':moment()[_0xc5ad('0xa0')](_0xc5ad('0xa1')),'read':!![],'MailAccountId':_0x147975['id'],'UserId':_0x36c43b[_0xc5ad('0x77')]['id'],'ContactId':_0x204c03['id']})]};if(_0x36c43b['body']['Interaction']){_0x464457=_[_0xc5ad('0x52')](_0x464457,_0x36c43b[_0xc5ad('0x61')][_0xc5ad('0xb6')]);}return db['MailInteraction'][_0xc5ad('0x69')](_0x464457,{'include':[{'model':db[_0xc5ad('0xa2')],'as':_0xc5ad('0xb7')}]});}})['then'](respondWithResult(_0x499ffd,null))[_0xc5ad('0x30')](handleError(_0x499ffd,null));};exports[_0xc5ad('0xb8')]=function(_0x39db2a,_0x2c8ed3,_0x126aac){return db[_0xc5ad('0x45')]['find']({'where':{'id':_0x39db2a[_0xc5ad('0x5b')]['id']},'include':[{'model':db[_0xc5ad('0x42')],'as':_0xc5ad('0x5c'),'raw':!![]}]})['then'](handleEntityNotFound(_0x2c8ed3,null))['then'](function(_0xce786a){if(_0xce786a&&_0xce786a['Smtp']){var _0x6c7e41={'id':_0xce786a['id'],'tls':{'rejectUnauthorized':![]}};if(_0xce786a[_0xc5ad('0x5c')][_0xc5ad('0x7e')]){_0x6c7e41[_0xc5ad('0x7e')]=_0xce786a[_0xc5ad('0x5c')][_0xc5ad('0x7e')];}else{_0x6c7e41[_0xc5ad('0x7c')]=_0xce786a[_0xc5ad('0x5c')]['host'];_0x6c7e41[_0xc5ad('0x7d')]=_0xce786a[_0xc5ad('0x5c')][_0xc5ad('0x7d')];_0x6c7e41[_0xc5ad('0xae')]=_0xce786a[_0xc5ad('0x5c')][_0xc5ad('0xae')];}if(_0xce786a[_0xc5ad('0x5c')][_0xc5ad('0x7b')]){_0x6c7e41[_0xc5ad('0xad')]={'user':_0xce786a['Smtp'][_0xc5ad('0x77')],'pass':_0xce786a[_0xc5ad('0x5c')][_0xc5ad('0x7a')]};}return respondWithRpcPromise(_0xc5ad('0xb9'),_0xc5ad('0xb8'),{'account':_0x6c7e41});}})[_0xc5ad('0x28')](respondWithResult(_0x2c8ed3,null))[_0xc5ad('0x30')](handleError(_0x2c8ed3,null));};exports[_0xc5ad('0x3d')]=function(_0x4d36ca,_0x72b6ca){return db[_0xc5ad('0x45')][_0xc5ad('0x5f')]({'where':{'id':_0x4d36ca['params']['id']}})[_0xc5ad('0x28')](handleEntityNotFound(_0x72b6ca,null))[_0xc5ad('0x28')](function(_0x32d191){if(_0x32d191&&_0x32d191[_0xc5ad('0x7e')]){throw new db[(_0xc5ad('0x24'))][(_0xc5ad('0x25'))](_0xc5ad('0xba'));}return _0x32d191;})[_0xc5ad('0x28')](removeEntity(_0x72b6ca,null))['catch'](handleError(_0x72b6ca,null));};exports[_0xc5ad('0xbb')]=function(_0x4dc517,_0x34ed5d,_0xccb7b9){return db[_0xc5ad('0x45')][_0xc5ad('0x5f')]({'where':{'id':_0x4dc517[_0xc5ad('0x5b')]['id']}})[_0xc5ad('0x28')](handleEntityNotFound(_0x34ed5d,null))[_0xc5ad('0x28')](function(_0x2b27d2){if(_0x2b27d2){return _0x2b27d2[_0xc5ad('0xbb')](_0x4dc517[_0xc5ad('0x61')]['ids'],_[_0xc5ad('0x8f')](_0x4dc517['body'],[_0xc5ad('0x70'),'id'])||{})[_0xc5ad('0xbc')](function(_0x15513b){for(var _0x5b712f=0x0;_0x5b712f<_0x4dc517[_0xc5ad('0x61')]['ids'][_0xc5ad('0x4d')];_0x5b712f+=0x1){socket[_0xc5ad('0xbd')](_0xc5ad('0xbe'),{'UserId':_0x4dc517[_0xc5ad('0x61')][_0xc5ad('0x70')][_0x5b712f],'MailAccountId':_0x4dc517[_0xc5ad('0x5b')]['id']});}return _0x15513b;});}})[_0xc5ad('0x28')](respondWithResult(_0x34ed5d,null))[_0xc5ad('0x30')](handleError(_0x34ed5d,null));};exports[_0xc5ad('0xbf')]=function(_0x5b8cd5,_0x3173f3,_0x2d7400){return db['MailAccount'][_0xc5ad('0x5f')]({'where':{'id':_0x5b8cd5[_0xc5ad('0x5b')]['id']}})[_0xc5ad('0x28')](handleEntityNotFound(_0x3173f3,null))[_0xc5ad('0x28')](function(_0x3295e8){if(_0x3295e8){return _0x3295e8[_0xc5ad('0xbf')](_0x5b8cd5[_0xc5ad('0x48')][_0xc5ad('0x70')])[_0xc5ad('0x28')](function(){if(_[_0xc5ad('0xc0')](_0x5b8cd5[_0xc5ad('0x48')][_0xc5ad('0x70')])){for(var _0x4aae3f=0x0;_0x4aae3f<_0x5b8cd5[_0xc5ad('0x48')]['ids'][_0xc5ad('0x4d')];_0x4aae3f+=0x1){socket[_0xc5ad('0xbd')](_0xc5ad('0xc1'),{'UserId':Number(_0x5b8cd5[_0xc5ad('0x48')][_0xc5ad('0x70')][_0x4aae3f]),'MailAccountId':Number(_0x5b8cd5[_0xc5ad('0x5b')]['id'])});}}else{socket[_0xc5ad('0xbd')](_0xc5ad('0xc1'),{'UserId':Number(_0x5b8cd5[_0xc5ad('0x48')]['ids']),'MailAccountId':Number(_0x5b8cd5['params']['id'])});}});}})['then'](respondWithStatusCode(_0x3173f3,null))['catch'](handleError(_0x3173f3,null));};exports[_0xc5ad('0xc2')]=function(_0x342e56,_0xcf9d31,_0x26f670){var _0x400d97={};var _0x582c0c={};var _0x6e1a18;var _0x2e9f18;return db[_0xc5ad('0x45')][_0xc5ad('0x6b')]({'where':{'id':_0x342e56['params']['id']}})[_0xc5ad('0x28')](handleEntityNotFound(_0xcf9d31,null))[_0xc5ad('0x28')](function(_0x3455c1){if(_0x3455c1){_0x6e1a18=_0x3455c1;_0x582c0c[_0xc5ad('0x47')]=_[_0xc5ad('0x5e')](db[_0xc5ad('0x92')][_0xc5ad('0x46')]);_0x582c0c['query']=_[_0xc5ad('0x5e')](_0x342e56['query']);_0x582c0c[_0xc5ad('0x49')]=_[_0xc5ad('0x4a')](_0x582c0c[_0xc5ad('0x47')],_0x582c0c[_0xc5ad('0x48')]);_0x400d97[_0xc5ad('0x4b')]=_[_0xc5ad('0x4a')](_0x582c0c[_0xc5ad('0x47')],qs[_0xc5ad('0x4c')](_0x342e56['query'][_0xc5ad('0x4c')]));_0x400d97[_0xc5ad('0x4b')]=_0x400d97['attributes'][_0xc5ad('0x4d')]?_0x400d97[_0xc5ad('0x4b')]:_0x582c0c[_0xc5ad('0x47')];_0x400d97[_0xc5ad('0x4e')]=qs['sort'](_0x342e56[_0xc5ad('0x48')][_0xc5ad('0x4f')]);_0x400d97[_0xc5ad('0x50')]=qs['filters'](_[_0xc5ad('0x51')](_0x342e56[_0xc5ad('0x48')],_0x582c0c['filters']));if(_0x342e56[_0xc5ad('0x48')][_0xc5ad('0x54')]){_0x400d97[_0xc5ad('0x50')]=_['merge'](_0x400d97['where'],{'$or':_['map'](_0x400d97['attributes'],function(_0x1a00da){var _0x31383b={};_0x31383b[_0x1a00da]={'$like':'%'+_0x342e56[_0xc5ad('0x48')][_0xc5ad('0x54')]+'%'};return _0x31383b;})});}_0x400d97=_[_0xc5ad('0x52')]({},_0x400d97,_0x342e56[_0xc5ad('0x55')]);return _0x6e1a18['getAgents'](_0x400d97);}})[_0xc5ad('0x28')](function(_0x19d13c){if(_0x19d13c){_0x2e9f18=_0x19d13c[_0xc5ad('0x4d')];if(!_0x342e56[_0xc5ad('0x48')][_0xc5ad('0x6d')](_0xc5ad('0x6e'))){_0x400d97[_0xc5ad('0x35')]=qs[_0xc5ad('0x35')](_0x342e56['query'][_0xc5ad('0x35')]);_0x400d97[_0xc5ad('0x34')]=qs[_0xc5ad('0x34')](_0x342e56['query'][_0xc5ad('0x34')]);}return _0x6e1a18['getAgents'](_0x400d97);}})['then'](function(_0x1f61fb){if(_0x1f61fb){return _0x1f61fb?{'count':_0x2e9f18,'rows':_0x1f61fb}:null;}})[_0xc5ad('0x28')](respondWithResult(_0xcf9d31,null))[_0xc5ad('0x30')](handleError(_0xcf9d31,null));}; \ No newline at end of file +var _0xc6b6=['send','Imap','MailServerOut','Smtp','Pause','mandatoryDispositionPause','map','MailAccount','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','pick','filter','where','VIRTUAL','merge','include','findAll','rows','show','params','MailServerIn','includeAll','options','find','body','describe','addDisposition','MailAccountId','Disposition','getDispositions','findOne','sort','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','create','email','ListId','isNil','active','description','cservice','cauthentication','user','pass','cpassword','authentication','host','port','service','cuser','password','role','UserProfileSection','userProfileId','autoAssociation','getImap','addImap','removeImap','setImap','getSmtp','addSmtp','setSmtp','addInteraction','omit','getInteractions','MailInteraction','Contact','User','Owner','fullname','internal','Tags','tag','addApplications','transaction','MailApplication','priority','getApplications','MailMessage','$gte','split','format','CmList','List','CmContact','Contacts','updatedAt','DESC','from','%s\x20<%s>','attachments','server/files/attachments','basename','secure','auth','SendMail','sendMail','List\x20not\x20found','subject','attach','YYYY-MM-DD\x20HH:mm:ss','out','Interaction','Messages','verifySmtp','VerifySmtp','Sequelize','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','emit','userMailAccount:save','removeAgents','userMailAccount:remove','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','./mailAccount.socket','jayson/promise','client','http','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','json','count','offset','limit','Content-Range','reject','save','update','destroy','get','MailAccounts','UserProfileResource','stack','name'];(function(_0x3a6efd,_0x2a5102){var _0x487b9a=function(_0x104f89){while(--_0x104f89){_0x3a6efd['push'](_0x3a6efd['shift']());}};_0x487b9a(++_0x2a5102);}(_0xc6b6,0x83));var _0x6c6b=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xc6b6[_0x3ab51d];return _0x29a04e;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x6c6b('0x0'));var zipdir=require(_0x6c6b('0x1'));var jsonpatch=require(_0x6c6b('0x2'));var rp=require(_0x6c6b('0x3'));var moment=require(_0x6c6b('0x4'));var BPromise=require(_0x6c6b('0x5'));var Mustache=require(_0x6c6b('0x6'));var util=require(_0x6c6b('0x7'));var path=require(_0x6c6b('0x8'));var sox=require(_0x6c6b('0x9'));var csv=require('to-csv');var ejs=require(_0x6c6b('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x6c6b('0xb'));var crypto=require(_0x6c6b('0xc'));var jsforce=require(_0x6c6b('0xd'));var deskjs=require(_0x6c6b('0xe'));var toCsv=require(_0x6c6b('0xf'));var querystring=require(_0x6c6b('0x10'));var Papa=require(_0x6c6b('0x11'));var Redis=require(_0x6c6b('0x12'));var authService=require(_0x6c6b('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x6c6b('0x14'));var hardwareService=require(_0x6c6b('0x15'));var logger=require(_0x6c6b('0x16'))(_0x6c6b('0x17'));var utils=require(_0x6c6b('0x18'));var config=require(_0x6c6b('0x19'));var db=require(_0x6c6b('0x1a'))['db'];config[_0x6c6b('0x1b')]=_[_0x6c6b('0x1c')](config[_0x6c6b('0x1b')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6c6b('0x1b')]));require(_0x6c6b('0x1d'))['register'](socket);var jayson=require(_0x6c6b('0x1e'));var client=jayson[_0x6c6b('0x1f')][_0x6c6b('0x20')]({'port':0x232b});function checkPasswordPattern(_0x2a0191,_0x34f70a,_0x16bddf){if(_0x16bddf){var _0x8648cd=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x8648cd[_0x6c6b('0x21')](_0x34f70a)){return _0x2a0191;}else{throw new db['Sequelize'][(_0x6c6b('0x22'))](_0x6c6b('0x23'));}}else{return _0x2a0191;}}function respondWithRpcPromise(_0x10d964,_0xd568df,_0x5e3b2d,_0x5d6eec){return new BPromise(function(_0x1f9b66,_0x50220f){var _0x2fe3d9=_0x5d6eec||client;return _0x2fe3d9[_0x6c6b('0x24')](_0x10d964,_0x5e3b2d)[_0x6c6b('0x25')](function(_0x17daea){logger[_0x6c6b('0x26')](_0x6c6b('0x27'),_0xd568df,_0x6c6b('0x28'));logger[_0x6c6b('0x29')]('MailAccount,\x20%s,\x20%s,\x20%s',_0xd568df,_0x6c6b('0x28'),JSON[_0x6c6b('0x2a')](_0x17daea));if(_0x17daea[_0x6c6b('0x2b')]){if(_0x17daea[_0x6c6b('0x2b')][_0x6c6b('0x2c')]===0x1f4){logger[_0x6c6b('0x2b')]('MailAccount,\x20%s,\x20%s',_0xd568df,_0x17daea[_0x6c6b('0x2b')][_0x6c6b('0x2d')]);return _0x50220f(_0x17daea[_0x6c6b('0x2b')][_0x6c6b('0x2d')]);}logger['error']('MailAccount,\x20%s,\x20%s',_0xd568df,_0x17daea['error'][_0x6c6b('0x2d')]);return _0x1f9b66(_0x17daea[_0x6c6b('0x2b')][_0x6c6b('0x2d')]);}else{logger[_0x6c6b('0x26')](_0x6c6b('0x27'),_0xd568df,_0x6c6b('0x28'));_0x1f9b66(_0x17daea[_0x6c6b('0x2e')][_0x6c6b('0x2d')]);}})[_0x6c6b('0x2f')](function(_0x5c3fea){logger[_0x6c6b('0x2b')](_0x6c6b('0x27'),_0xd568df,_0x5c3fea);_0x50220f(_0x5c3fea);});});}function respondWithStatusCode(_0x355fdd,_0x46476d){_0x46476d=_0x46476d||0xcc;return function(_0x2d7cea){if(_0x2d7cea){return _0x355fdd[_0x6c6b('0x30')](_0x46476d);}return _0x355fdd[_0x6c6b('0x31')](_0x46476d)['end']();};}function respondWithResult(_0x16956c,_0x169c28){_0x169c28=_0x169c28||0xc8;return function(_0x57b125){if(_0x57b125){return _0x16956c['status'](_0x169c28)[_0x6c6b('0x32')](_0x57b125);}};}function respondWithFilteredResult(_0x2ab40a,_0x44b85a){return function(_0x2e5671){if(_0x2e5671){var _0x1ff167=_0x2e5671[_0x6c6b('0x33')],_0x2a63d1=_0x44b85a[_0x6c6b('0x34')],_0x36b277=_0x44b85a['offset']+_0x44b85a[_0x6c6b('0x35')],_0x537afe;if(_0x36b277>=_0x1ff167){_0x36b277=_0x1ff167;_0x537afe=0xc8;}else{_0x537afe=0xce;}_0x2ab40a['status'](_0x537afe);return _0x2ab40a['set'](_0x6c6b('0x36'),_0x2a63d1+'-'+_0x36b277+'/'+_0x1ff167)[_0x6c6b('0x32')](_0x2e5671);}return null;};}function patchUpdates(_0x9f9925){return function(_0x4c414b){try{jsonpatch['apply'](_0x4c414b,_0x9f9925,!![]);}catch(_0x171e2d){return BPromise[_0x6c6b('0x37')](_0x171e2d);}return _0x4c414b[_0x6c6b('0x38')]();};}function saveUpdates(_0xd61559,_0x2b61be){return function(_0xb0d4c2){if(_0xb0d4c2){return _0xb0d4c2[_0x6c6b('0x39')](_0xd61559)[_0x6c6b('0x25')](function(_0x3de37c){return _0x3de37c;});}return null;};}function removeEntity(_0xa053df,_0x1364e2){return function(_0x4961db){if(_0x4961db){return _0x4961db[_0x6c6b('0x3a')]()[_0x6c6b('0x25')](function(){var _0x469028=_0x4961db[_0x6c6b('0x3b')]({'plain':!![]});var _0x5295d3=_0x6c6b('0x3c');return db[_0x6c6b('0x3d')][_0x6c6b('0x3a')]({'where':{'type':_0x5295d3,'resourceId':_0x469028['id']}})[_0x6c6b('0x25')](function(){return _0x4961db;});})['then'](function(){_0xa053df['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x28caa4,_0x4d7d16){return function(_0x1c7b19){if(!_0x1c7b19){_0x28caa4[_0x6c6b('0x30')](0x194);}return _0x1c7b19;};}function handleError(_0x5cefb1,_0x4a2b74){_0x4a2b74=_0x4a2b74||0x1f4;return function(_0x38d3c7){logger[_0x6c6b('0x2b')](_0x38d3c7[_0x6c6b('0x3e')]);if(_0x38d3c7[_0x6c6b('0x3f')]){delete _0x38d3c7[_0x6c6b('0x3f')];}_0x5cefb1[_0x6c6b('0x31')](_0x4a2b74)[_0x6c6b('0x40')](_0x38d3c7);};}exports['index']=function(_0x4c58b9,_0x48596d){var _0x15d012={'include':[{'model':db['MailServerIn'],'as':_0x6c6b('0x41')},{'model':db[_0x6c6b('0x42')],'as':_0x6c6b('0x43')},{'model':db[_0x6c6b('0x44')],'as':_0x6c6b('0x45')}]},_0x11aea5={},_0x12f35c={'count':0x0,'rows':[]};var _0x17ec13=_[_0x6c6b('0x46')](db[_0x6c6b('0x47')][_0x6c6b('0x48')],function(_0x4dc882){return{'name':_0x4dc882[_0x6c6b('0x49')],'type':_0x4dc882[_0x6c6b('0x4a')][_0x6c6b('0x4b')]};});_0x11aea5[_0x6c6b('0x4c')]=_['map'](_0x17ec13,'name');_0x11aea5['query']=_[_0x6c6b('0x4d')](_0x4c58b9[_0x6c6b('0x4e')]);_0x11aea5[_0x6c6b('0x4f')]=_['intersection'](_0x11aea5['model'],_0x11aea5[_0x6c6b('0x4e')]);_0x15d012[_0x6c6b('0x50')]=_[_0x6c6b('0x51')](_0x11aea5[_0x6c6b('0x4c')],qs[_0x6c6b('0x52')](_0x4c58b9['query']['fields']));_0x15d012[_0x6c6b('0x50')]=_0x15d012['attributes'][_0x6c6b('0x53')]?_0x15d012[_0x6c6b('0x50')]:_0x11aea5[_0x6c6b('0x4c')];if(!_0x4c58b9[_0x6c6b('0x4e')][_0x6c6b('0x54')](_0x6c6b('0x55'))){_0x15d012[_0x6c6b('0x35')]=qs['limit'](_0x4c58b9[_0x6c6b('0x4e')][_0x6c6b('0x35')]);_0x15d012[_0x6c6b('0x34')]=qs[_0x6c6b('0x34')](_0x4c58b9[_0x6c6b('0x4e')][_0x6c6b('0x34')]);}_0x15d012[_0x6c6b('0x56')]=qs['sort'](_0x4c58b9['query']['sort']);_0x15d012['where']=qs[_0x6c6b('0x4f')](_[_0x6c6b('0x57')](_0x4c58b9[_0x6c6b('0x4e')],_0x11aea5[_0x6c6b('0x4f')]));if(_0x4c58b9[_0x6c6b('0x4e')][_0x6c6b('0x58')]){_0x15d012[_0x6c6b('0x59')]=_['merge'](_0x15d012['where'],{'$or':_[_0x6c6b('0x46')](_0x17ec13,function(_0x49f342){if(_0x49f342[_0x6c6b('0x4a')]!==_0x6c6b('0x5a')){var _0x387aa7={};_0x387aa7[_0x49f342['name']]={'$like':'%'+_0x4c58b9[_0x6c6b('0x4e')][_0x6c6b('0x58')]+'%'};return _0x387aa7;}})});}_0x15d012=_[_0x6c6b('0x5b')]({},_0x15d012,_0x4c58b9['options']);var _0x16ff2d={'where':_0x15d012[_0x6c6b('0x59')]};return db[_0x6c6b('0x47')][_0x6c6b('0x33')](_0x16ff2d)['then'](function(_0x2c099c){_0x12f35c[_0x6c6b('0x33')]=_0x2c099c;if(_0x4c58b9['query']['includeAll']){_0x15d012[_0x6c6b('0x5c')]=[{'all':!![]}];}return db[_0x6c6b('0x47')][_0x6c6b('0x5d')](_0x15d012);})[_0x6c6b('0x25')](function(_0x55b508){_0x12f35c[_0x6c6b('0x5e')]=_0x55b508;return _0x12f35c;})['then'](respondWithFilteredResult(_0x48596d,_0x15d012))[_0x6c6b('0x2f')](handleError(_0x48596d,null));};exports[_0x6c6b('0x5f')]=function(_0x218381,_0x4bba61){var _0x2e9b3={'raw':![],'where':{'id':_0x218381[_0x6c6b('0x60')]['id']},'include':[{'model':db[_0x6c6b('0x61')],'as':_0x6c6b('0x41')},{'model':db[_0x6c6b('0x42')],'as':_0x6c6b('0x43')},{'model':db[_0x6c6b('0x44')],'as':_0x6c6b('0x45')}]},_0x1f77d2={};_0x1f77d2['model']=_['keys'](db[_0x6c6b('0x47')][_0x6c6b('0x48')]);_0x1f77d2['query']=_[_0x6c6b('0x4d')](_0x218381[_0x6c6b('0x4e')]);_0x1f77d2[_0x6c6b('0x4f')]=_[_0x6c6b('0x51')](_0x1f77d2[_0x6c6b('0x4c')],_0x1f77d2[_0x6c6b('0x4e')]);_0x2e9b3['attributes']=_[_0x6c6b('0x51')](_0x1f77d2[_0x6c6b('0x4c')],qs['fields'](_0x218381['query']['fields']));_0x2e9b3[_0x6c6b('0x50')]=_0x2e9b3[_0x6c6b('0x50')]['length']?_0x2e9b3['attributes']:_0x1f77d2[_0x6c6b('0x4c')];if(_0x218381[_0x6c6b('0x4e')][_0x6c6b('0x62')]){_0x2e9b3[_0x6c6b('0x5c')]=[{'all':!![]}];}_0x2e9b3=_[_0x6c6b('0x5b')]({},_0x2e9b3,_0x218381[_0x6c6b('0x63')]);return db['MailAccount'][_0x6c6b('0x64')](_0x2e9b3)[_0x6c6b('0x25')](handleEntityNotFound(_0x4bba61,null))[_0x6c6b('0x25')](respondWithResult(_0x4bba61,null))[_0x6c6b('0x2f')](handleError(_0x4bba61,null));};exports[_0x6c6b('0x39')]=function(_0x19a13d,_0x2bcc1d){if(_0x19a13d[_0x6c6b('0x65')]['id']){delete _0x19a13d[_0x6c6b('0x65')]['id'];}return db['MailAccount'][_0x6c6b('0x64')]({'where':{'id':_0x19a13d[_0x6c6b('0x60')]['id']},'include':[{'model':db[_0x6c6b('0x61')],'as':_0x6c6b('0x41')},{'model':db[_0x6c6b('0x42')],'as':_0x6c6b('0x43')},{'model':db['Pause'],'as':_0x6c6b('0x45')}]})[_0x6c6b('0x25')](handleEntityNotFound(_0x2bcc1d,null))[_0x6c6b('0x25')](saveUpdates(_0x19a13d['body'],null))[_0x6c6b('0x25')](function(_0x70bead){if(_0x70bead&&_0x19a13d['body'][_0x6c6b('0x41')]){return db[_0x6c6b('0x61')][_0x6c6b('0x39')](_0x19a13d['body'][_0x6c6b('0x41')],{'where':{'MailAccountId':_0x70bead['id']}})[_0x6c6b('0x25')](function(){return _0x70bead;});}return _0x70bead;})[_0x6c6b('0x25')](function(_0x2c4882){if(_0x2c4882&&_0x19a13d[_0x6c6b('0x65')][_0x6c6b('0x43')]){return db['MailServerOut'][_0x6c6b('0x39')](_0x19a13d[_0x6c6b('0x65')]['Smtp'],{'where':{'MailAccountId':_0x2c4882['id']}})[_0x6c6b('0x25')](function(){return _0x2c4882;});}return _0x2c4882;})[_0x6c6b('0x25')](respondWithResult(_0x2bcc1d,null))['catch'](handleError(_0x2bcc1d,null));};exports[_0x6c6b('0x66')]=function(_0x209917,_0x2b1aef){return db[_0x6c6b('0x47')][_0x6c6b('0x66')]()[_0x6c6b('0x25')](respondWithResult(_0x2b1aef,null))[_0x6c6b('0x2f')](handleError(_0x2b1aef,null));};exports[_0x6c6b('0x67')]=function(_0x1bc134,_0x36c4b3,_0x9c8bb6){if(_0x1bc134[_0x6c6b('0x65')]['id']){delete _0x1bc134[_0x6c6b('0x65')]['id'];}return db['MailAccount'][_0x6c6b('0x64')]({'where':{'id':_0x1bc134[_0x6c6b('0x60')]['id']}})['then'](handleEntityNotFound(_0x36c4b3,null))[_0x6c6b('0x25')](function(_0x13281a){if(_0x13281a){_0x1bc134[_0x6c6b('0x65')][_0x6c6b('0x68')]=_0x13281a['id'];return db[_0x6c6b('0x69')]['create'](_0x1bc134[_0x6c6b('0x65')]);}})['then'](respondWithResult(_0x36c4b3,null))[_0x6c6b('0x2f')](handleError(_0x36c4b3,null));};exports[_0x6c6b('0x6a')]=function(_0x17146e,_0x33560d,_0x3f83d2){var _0x23d5ee={'raw':![],'where':{}};var _0x407bb7={};var _0x530cd6={'count':0x0,'rows':[]};return db[_0x6c6b('0x47')][_0x6c6b('0x6b')]({'where':{'id':_0x17146e[_0x6c6b('0x60')]['id']}})[_0x6c6b('0x25')](handleEntityNotFound(_0x33560d,null))[_0x6c6b('0x25')](function(_0x8abe16){if(_0x8abe16){_0x407bb7[_0x6c6b('0x4c')]=_[_0x6c6b('0x4d')](db[_0x6c6b('0x69')]['rawAttributes']);_0x407bb7[_0x6c6b('0x4e')]=_[_0x6c6b('0x4d')](_0x17146e['query']);_0x407bb7['filters']=_['intersection'](_0x407bb7['model'],_0x407bb7[_0x6c6b('0x4e')]);_0x23d5ee[_0x6c6b('0x50')]=_['intersection'](_0x407bb7['model'],qs[_0x6c6b('0x52')](_0x17146e['query']['fields']));_0x23d5ee[_0x6c6b('0x50')]=_0x23d5ee[_0x6c6b('0x50')][_0x6c6b('0x53')]?_0x23d5ee[_0x6c6b('0x50')]:_0x407bb7['model'];if(!_0x17146e[_0x6c6b('0x4e')][_0x6c6b('0x54')](_0x6c6b('0x55'))){_0x23d5ee[_0x6c6b('0x35')]=qs['limit'](_0x17146e[_0x6c6b('0x4e')][_0x6c6b('0x35')]);_0x23d5ee[_0x6c6b('0x34')]=qs[_0x6c6b('0x34')](_0x17146e[_0x6c6b('0x4e')][_0x6c6b('0x34')]);}_0x23d5ee[_0x6c6b('0x56')]=qs[_0x6c6b('0x6c')](_0x17146e[_0x6c6b('0x4e')][_0x6c6b('0x6c')]);_0x23d5ee['where']=qs['filters'](_[_0x6c6b('0x57')](_0x17146e['query'],_0x407bb7[_0x6c6b('0x4f')]));_0x23d5ee[_0x6c6b('0x59')][_0x6c6b('0x68')]=_0x8abe16['id'];if(_0x17146e[_0x6c6b('0x4e')]['filter']){_0x23d5ee[_0x6c6b('0x59')]=_[_0x6c6b('0x5b')](_0x23d5ee['where'],{'$or':_[_0x6c6b('0x46')](_0x23d5ee[_0x6c6b('0x50')],function(_0x1a12af){var _0xf932d5={};_0xf932d5[_0x1a12af]={'$like':'%'+_0x17146e[_0x6c6b('0x4e')]['filter']+'%'};return _0xf932d5;})});}_0x23d5ee=_['merge']({},_0x23d5ee,_0x17146e[_0x6c6b('0x63')]);return db[_0x6c6b('0x69')][_0x6c6b('0x33')]({'where':_0x23d5ee[_0x6c6b('0x59')]})[_0x6c6b('0x25')](function(_0x3943a6){_0x530cd6[_0x6c6b('0x33')]=_0x3943a6;if(_0x17146e[_0x6c6b('0x4e')]['includeAll']){_0x23d5ee[_0x6c6b('0x5c')]=[{'all':!![]}];}return db[_0x6c6b('0x69')][_0x6c6b('0x5d')](_0x23d5ee);})[_0x6c6b('0x25')](function(_0x5c9977){_0x530cd6[_0x6c6b('0x5e')]=_0x5c9977;return _0x530cd6;});}})['then'](respondWithFilteredResult(_0x33560d,_0x23d5ee))[_0x6c6b('0x2f')](handleError(_0x33560d,null));};exports[_0x6c6b('0x6d')]=function(_0x598621,_0x15ed5c,_0x448ec0){return db[_0x6c6b('0x47')]['find']({'where':{'id':_0x598621[_0x6c6b('0x60')]['id']}})[_0x6c6b('0x25')](handleEntityNotFound(_0x15ed5c,null))['then'](function(_0x452935){if(_0x452935){return _0x452935[_0x6c6b('0x6d')](_0x598621[_0x6c6b('0x4e')][_0x6c6b('0x6e')]);}})[_0x6c6b('0x25')](respondWithStatusCode(_0x15ed5c,null))['catch'](handleError(_0x15ed5c,null));};exports[_0x6c6b('0x6f')]=function(_0x1db5b1,_0x34e2e1,_0x4b47ea){if(_0x1db5b1[_0x6c6b('0x65')]['id']){delete _0x1db5b1[_0x6c6b('0x65')]['id'];}return db[_0x6c6b('0x47')][_0x6c6b('0x64')]({'where':{'id':_0x1db5b1[_0x6c6b('0x60')]['id']}})['then'](handleEntityNotFound(_0x34e2e1,null))['then'](function(_0x2a206a){if(_0x2a206a){_0x1db5b1[_0x6c6b('0x65')]['MailAccountId']=_0x2a206a['id'];return db[_0x6c6b('0x70')]['create'](_0x1db5b1[_0x6c6b('0x65')]);}})[_0x6c6b('0x25')](respondWithResult(_0x34e2e1,null))[_0x6c6b('0x2f')](handleError(_0x34e2e1,null));};exports[_0x6c6b('0x71')]=function(_0x4bea4d,_0x5ab449,_0x3df30a){var _0x103bd9={'raw':![],'where':{}};var _0x59fadc={};var _0x25cf6f={'count':0x0,'rows':[]};return db[_0x6c6b('0x47')][_0x6c6b('0x6b')]({'where':{'id':_0x4bea4d['params']['id']}})[_0x6c6b('0x25')](handleEntityNotFound(_0x5ab449,null))[_0x6c6b('0x25')](function(_0x5b39da){if(_0x5b39da){_0x59fadc[_0x6c6b('0x4c')]=_['keys'](db[_0x6c6b('0x70')][_0x6c6b('0x48')]);_0x59fadc[_0x6c6b('0x4e')]=_[_0x6c6b('0x4d')](_0x4bea4d[_0x6c6b('0x4e')]);_0x59fadc['filters']=_[_0x6c6b('0x51')](_0x59fadc['model'],_0x59fadc[_0x6c6b('0x4e')]);_0x103bd9[_0x6c6b('0x50')]=_[_0x6c6b('0x51')](_0x59fadc['model'],qs['fields'](_0x4bea4d['query'][_0x6c6b('0x52')]));_0x103bd9[_0x6c6b('0x50')]=_0x103bd9['attributes']['length']?_0x103bd9[_0x6c6b('0x50')]:_0x59fadc[_0x6c6b('0x4c')];if(!_0x4bea4d[_0x6c6b('0x4e')][_0x6c6b('0x54')](_0x6c6b('0x55'))){_0x103bd9[_0x6c6b('0x35')]=qs[_0x6c6b('0x35')](_0x4bea4d[_0x6c6b('0x4e')]['limit']);_0x103bd9[_0x6c6b('0x34')]=qs[_0x6c6b('0x34')](_0x4bea4d[_0x6c6b('0x4e')][_0x6c6b('0x34')]);}_0x103bd9[_0x6c6b('0x56')]=qs['sort'](_0x4bea4d[_0x6c6b('0x4e')][_0x6c6b('0x6c')]);_0x103bd9[_0x6c6b('0x59')]=qs[_0x6c6b('0x4f')](_['pick'](_0x4bea4d['query'],_0x59fadc['filters']));_0x103bd9[_0x6c6b('0x59')][_0x6c6b('0x68')]=_0x5b39da['id'];if(_0x4bea4d[_0x6c6b('0x4e')][_0x6c6b('0x58')]){_0x103bd9[_0x6c6b('0x59')]=_[_0x6c6b('0x5b')](_0x103bd9[_0x6c6b('0x59')],{'$or':_[_0x6c6b('0x46')](_0x103bd9[_0x6c6b('0x50')],function(_0x2b3bdc){var _0x2f9777={};_0x2f9777[_0x2b3bdc]={'$like':'%'+_0x4bea4d[_0x6c6b('0x4e')][_0x6c6b('0x58')]+'%'};return _0x2f9777;})});}_0x103bd9=_[_0x6c6b('0x5b')]({},_0x103bd9,_0x4bea4d[_0x6c6b('0x63')]);return db[_0x6c6b('0x70')][_0x6c6b('0x33')]({'where':_0x103bd9[_0x6c6b('0x59')]})['then'](function(_0x243dc2){_0x25cf6f['count']=_0x243dc2;if(_0x4bea4d['query'][_0x6c6b('0x62')]){_0x103bd9[_0x6c6b('0x5c')]=[{'all':!![]}];}return db['CannedAnswer'][_0x6c6b('0x5d')](_0x103bd9);})[_0x6c6b('0x25')](function(_0x5bb812){_0x25cf6f[_0x6c6b('0x5e')]=_0x5bb812;return _0x25cf6f;});}})[_0x6c6b('0x25')](respondWithFilteredResult(_0x5ab449,_0x103bd9))[_0x6c6b('0x2f')](handleError(_0x5ab449,null));};exports[_0x6c6b('0x72')]=function(_0x117d21,_0x52e27d,_0xf7b76f){return db[_0x6c6b('0x47')][_0x6c6b('0x64')]({'where':{'id':_0x117d21[_0x6c6b('0x60')]['id']}})[_0x6c6b('0x25')](handleEntityNotFound(_0x52e27d,null))[_0x6c6b('0x25')](function(_0x3bad14){if(_0x3bad14){return _0x3bad14[_0x6c6b('0x72')](_0x117d21[_0x6c6b('0x4e')][_0x6c6b('0x6e')]);}})[_0x6c6b('0x25')](respondWithStatusCode(_0x52e27d,null))[_0x6c6b('0x2f')](handleError(_0x52e27d,null));};exports[_0x6c6b('0x73')]=function(_0x5d16c8,_0x27ce23){var _0x346600={'name':_0x5d16c8['body'][_0x6c6b('0x3f')],'key':_0x5d16c8[_0x6c6b('0x65')][_0x6c6b('0x4b')],'email':_0x5d16c8[_0x6c6b('0x65')][_0x6c6b('0x74')],'ListId':_0x5d16c8['body'][_0x6c6b('0x75')],'active':!_[_0x6c6b('0x76')](_0x5d16c8[_0x6c6b('0x65')][_0x6c6b('0x77')])?_0x5d16c8[_0x6c6b('0x65')][_0x6c6b('0x77')]:!![],'description':_0x5d16c8[_0x6c6b('0x65')][_0x6c6b('0x78')]||null,'Imap':{},'Smtp':{}};if(_[_0x6c6b('0x76')](_0x5d16c8['body'][_0x6c6b('0x79')])){if(_0x5d16c8['body'][_0x6c6b('0x7a')]){_0x346600['Imap'][_0x6c6b('0x7b')]=_0x346600[_0x6c6b('0x43')][_0x6c6b('0x7b')]=_0x5d16c8[_0x6c6b('0x65')]['cuser'];_0x346600[_0x6c6b('0x41')]['password']=_0x346600[_0x6c6b('0x43')][_0x6c6b('0x7c')]=_0x5d16c8[_0x6c6b('0x65')][_0x6c6b('0x7d')];}else{_0x346600[_0x6c6b('0x41')][_0x6c6b('0x7e')]=_0x346600[_0x6c6b('0x43')][_0x6c6b('0x7e')]=![];}_0x346600['Imap'][_0x6c6b('0x7f')]=_0x5d16c8[_0x6c6b('0x65')][_0x6c6b('0x41')][_0x6c6b('0x7f')];_0x346600[_0x6c6b('0x41')][_0x6c6b('0x80')]=_0x5d16c8[_0x6c6b('0x65')][_0x6c6b('0x41')][_0x6c6b('0x80')];_0x346600['Smtp'][_0x6c6b('0x7f')]=_0x5d16c8['body'][_0x6c6b('0x43')]['host'];_0x346600['Smtp'][_0x6c6b('0x80')]=_0x5d16c8[_0x6c6b('0x65')][_0x6c6b('0x43')]['port'];}else{_0x346600[_0x6c6b('0x41')]['service']=_0x346600[_0x6c6b('0x43')][_0x6c6b('0x81')]=_0x5d16c8[_0x6c6b('0x65')][_0x6c6b('0x79')];_0x346600['Imap'][_0x6c6b('0x7b')]=_0x346600[_0x6c6b('0x43')]['user']=_0x5d16c8['body'][_0x6c6b('0x82')];_0x346600[_0x6c6b('0x41')][_0x6c6b('0x83')]=_0x346600[_0x6c6b('0x43')][_0x6c6b('0x7c')]=_0x5d16c8[_0x6c6b('0x65')][_0x6c6b('0x7d')];}return db[_0x6c6b('0x47')]['create'](_0x346600,{'include':[{'model':db[_0x6c6b('0x42')],'as':_0x6c6b('0x43')},{'model':db['MailServerIn'],'as':_0x6c6b('0x41')}]})['then'](function(_0x29e196){var _0x33261d=_0x5d16c8[_0x6c6b('0x7b')][_0x6c6b('0x3b')]({'plain':!![]});if(!_0x33261d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x33261d[_0x6c6b('0x84')]===_0x6c6b('0x7b')){var _0x48823b=_0x29e196[_0x6c6b('0x3b')]({'plain':!![]});return db[_0x6c6b('0x85')]['find']({'where':{'name':_0x6c6b('0x3c'),'userProfileId':_0x33261d[_0x6c6b('0x86')]},'raw':!![]})[_0x6c6b('0x25')](function(_0x2d284c){if(_0x2d284c&&_0x2d284c[_0x6c6b('0x87')]===0x0){return db['UserProfileResource'][_0x6c6b('0x73')]({'name':_0x48823b[_0x6c6b('0x3f')],'resourceId':_0x48823b['id'],'type':_0x2d284c[_0x6c6b('0x3f')],'sectionId':_0x2d284c['id']},{})[_0x6c6b('0x25')](function(){return _0x29e196;});}else{return _0x29e196;}})[_0x6c6b('0x2f')](function(_0x348cf2){logger[_0x6c6b('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x348cf2);throw _0x348cf2;});}return _0x29e196;})[_0x6c6b('0x25')](respondWithResult(_0x27ce23,0xc9))[_0x6c6b('0x2f')](handleError(_0x27ce23,null));};exports[_0x6c6b('0x88')]=function(_0x984373,_0x579777,_0x91757d){return db[_0x6c6b('0x47')][_0x6c6b('0x6b')]({'where':{'id':_0x984373['params']['id']}})['then'](handleEntityNotFound(_0x579777,null))['then'](function(_0x5a8592){if(_0x5a8592){return _0x5a8592[_0x6c6b('0x88')]();}return null;})[_0x6c6b('0x25')](respondWithResult(_0x579777,null))[_0x6c6b('0x2f')](handleError(_0x579777,null));};exports[_0x6c6b('0x89')]=function(_0x452bfb,_0x4fa0c5,_0x2f7015){if(_0x452bfb[_0x6c6b('0x65')]['id']){delete _0x452bfb[_0x6c6b('0x65')]['id'];}return db[_0x6c6b('0x47')]['find']({'where':{'id':_0x452bfb[_0x6c6b('0x60')]['id']}})['then'](handleEntityNotFound(_0x4fa0c5,null))['then'](function(_0x3844e5){if(_0x3844e5){_0x452bfb[_0x6c6b('0x65')][_0x6c6b('0x68')]=_0x3844e5['id'];return db[_0x6c6b('0x61')][_0x6c6b('0x73')](_0x452bfb[_0x6c6b('0x65')]);}})[_0x6c6b('0x25')](respondWithResult(_0x4fa0c5,null))[_0x6c6b('0x2f')](handleError(_0x4fa0c5,null));};exports[_0x6c6b('0x8a')]=function(_0x222f02,_0x25ee6a,_0x2f9bad){return db['MailAccount'][_0x6c6b('0x6b')]({'where':{'id':_0x222f02[_0x6c6b('0x60')]['id']}})['then'](handleEntityNotFound(_0x25ee6a,null))[_0x6c6b('0x25')](function(_0x3481ce){if(_0x3481ce){return _0x3481ce[_0x6c6b('0x8b')](null);}return null;})[_0x6c6b('0x25')](respondWithStatusCode(_0x25ee6a,null))[_0x6c6b('0x2f')](handleError(_0x25ee6a,null));};exports[_0x6c6b('0x8c')]=function(_0x310f89,_0x449c31,_0x5afec4){return db['MailAccount'][_0x6c6b('0x6b')]({'where':{'id':_0x310f89[_0x6c6b('0x60')]['id']}})[_0x6c6b('0x25')](handleEntityNotFound(_0x449c31,null))[_0x6c6b('0x25')](function(_0x37a1b3){if(_0x37a1b3){return _0x37a1b3[_0x6c6b('0x8c')]();}return null;})[_0x6c6b('0x25')](respondWithResult(_0x449c31,null))[_0x6c6b('0x2f')](handleError(_0x449c31,null));};exports[_0x6c6b('0x8d')]=function(_0x101b3b,_0x58caa5,_0x56a4b1){if(_0x101b3b[_0x6c6b('0x65')]['id']){delete _0x101b3b['body']['id'];}return db[_0x6c6b('0x47')][_0x6c6b('0x64')]({'where':{'id':_0x101b3b[_0x6c6b('0x60')]['id']}})[_0x6c6b('0x25')](handleEntityNotFound(_0x58caa5,null))[_0x6c6b('0x25')](function(_0x1fa8e4){if(_0x1fa8e4){_0x101b3b[_0x6c6b('0x65')][_0x6c6b('0x68')]=_0x1fa8e4['id'];return db[_0x6c6b('0x42')][_0x6c6b('0x73')](_0x101b3b[_0x6c6b('0x65')]);}})[_0x6c6b('0x25')](respondWithResult(_0x58caa5,null))[_0x6c6b('0x2f')](handleError(_0x58caa5,null));};exports['removeSmtp']=function(_0x2ab470,_0x2cfc9c,_0x22fc6e){return db['MailAccount'][_0x6c6b('0x6b')]({'where':{'id':_0x2ab470[_0x6c6b('0x60')]['id']}})[_0x6c6b('0x25')](handleEntityNotFound(_0x2cfc9c,null))[_0x6c6b('0x25')](function(_0x259b8f){if(_0x259b8f){return _0x259b8f[_0x6c6b('0x8e')](null);}return null;})[_0x6c6b('0x25')](respondWithStatusCode(_0x2cfc9c,null))['catch'](handleError(_0x2cfc9c,null));};exports['addInteraction']=function(_0x50dd6e,_0x4ade51,_0x398c2f){return db['MailInteraction'][_0x6c6b('0x64')]({'where':{'id':_0x50dd6e[_0x6c6b('0x60')]['id']}})[_0x6c6b('0x25')](handleEntityNotFound(_0x4ade51,null))[_0x6c6b('0x25')](function(_0x886e5){if(_0x886e5){return _0x886e5[_0x6c6b('0x8f')](_0x50dd6e['body'][_0x6c6b('0x6e')],_[_0x6c6b('0x90')](_0x50dd6e['body'],['ids','id'])||{});}})[_0x6c6b('0x25')](respondWithResult(_0x4ade51,null))[_0x6c6b('0x2f')](handleError(_0x4ade51,null));};exports[_0x6c6b('0x91')]=function(_0x32f30c,_0x23beba,_0xcce013){var _0x431fb4={'raw':![],'where':{}};var _0x25249c={};var _0x1af774={'count':0x0,'rows':[]};return db[_0x6c6b('0x47')][_0x6c6b('0x6b')]({'where':{'id':_0x32f30c[_0x6c6b('0x60')]['id']}})[_0x6c6b('0x25')](handleEntityNotFound(_0x23beba,null))['then'](function(_0x2c1ca4){if(_0x2c1ca4){_0x25249c[_0x6c6b('0x4c')]=_['keys'](db[_0x6c6b('0x92')][_0x6c6b('0x48')]);_0x25249c[_0x6c6b('0x4e')]=_[_0x6c6b('0x4d')](_0x32f30c[_0x6c6b('0x4e')]);_0x25249c[_0x6c6b('0x4f')]=_[_0x6c6b('0x51')](_0x25249c[_0x6c6b('0x4c')],_0x25249c['query']);_0x431fb4[_0x6c6b('0x50')]=_[_0x6c6b('0x51')](_0x25249c[_0x6c6b('0x4c')],qs['fields'](_0x32f30c[_0x6c6b('0x4e')]['fields']));_0x431fb4[_0x6c6b('0x50')]=_0x431fb4[_0x6c6b('0x50')]['length']?_0x431fb4[_0x6c6b('0x50')]:_0x25249c['model'];if(!_0x32f30c['query'][_0x6c6b('0x54')]('nolimit')){_0x431fb4[_0x6c6b('0x35')]=qs[_0x6c6b('0x35')](_0x32f30c[_0x6c6b('0x4e')]['limit']);_0x431fb4[_0x6c6b('0x34')]=qs[_0x6c6b('0x34')](_0x32f30c[_0x6c6b('0x4e')][_0x6c6b('0x34')]);}_0x431fb4[_0x6c6b('0x56')]=qs[_0x6c6b('0x6c')](_0x32f30c[_0x6c6b('0x4e')][_0x6c6b('0x6c')]);_0x431fb4['where']=qs['filters'](_[_0x6c6b('0x57')](_0x32f30c['query'],_0x25249c['filters']));_0x431fb4[_0x6c6b('0x59')]['MailAccountId']=_0x2c1ca4['id'];if(_0x32f30c[_0x6c6b('0x4e')]['filter']){_0x431fb4['where']=_['merge'](_0x431fb4[_0x6c6b('0x59')],{'$or':_[_0x6c6b('0x46')](_0x431fb4[_0x6c6b('0x50')],function(_0x1b42a8){var _0x216c65={};_0x216c65[_0x1b42a8]={'$like':'%'+_0x32f30c[_0x6c6b('0x4e')]['filter']+'%'};return _0x216c65;})});}_0x431fb4=_['merge']({},_0x431fb4,_0x32f30c[_0x6c6b('0x63')]);return db[_0x6c6b('0x92')][_0x6c6b('0x33')]({'where':_0x431fb4[_0x6c6b('0x59')]})[_0x6c6b('0x25')](function(_0x49ee46){_0x1af774['count']=_0x49ee46;if(_0x32f30c[_0x6c6b('0x4e')][_0x6c6b('0x62')]){_0x431fb4['include']=[{'model':db['CmContact'],'as':_0x6c6b('0x93'),'required':![]},{'model':db[_0x6c6b('0x94')],'as':_0x6c6b('0x95'),'attributes':['name',_0x6c6b('0x96'),_0x6c6b('0x97')],'required':![]},{'model':db['Tag'],'as':_0x6c6b('0x98'),'attributes':['id',_0x6c6b('0x3f'),'color'],'where':_0x32f30c[_0x6c6b('0x4e')][_0x6c6b('0x99')]?{'id':_0x32f30c[_0x6c6b('0x4e')][_0x6c6b('0x99')]}:undefined,'required':_0x32f30c['query'][_0x6c6b('0x99')]?!![]:![]}];}return db[_0x6c6b('0x92')][_0x6c6b('0x5d')](_0x431fb4);})[_0x6c6b('0x25')](function(_0x2df7ec){_0x1af774['rows']=_0x2df7ec;return _0x1af774;});}})[_0x6c6b('0x25')](respondWithFilteredResult(_0x23beba,_0x431fb4))[_0x6c6b('0x2f')](handleError(_0x23beba,null));};exports[_0x6c6b('0x9a')]=function(_0x80ced1,_0x131af8,_0x356458){return db[_0x6c6b('0x47')][_0x6c6b('0x6b')]({'where':{'id':_0x80ced1[_0x6c6b('0x60')]['id']}})[_0x6c6b('0x25')](handleEntityNotFound(_0x131af8,null))[_0x6c6b('0x25')](function(_0x18add0){if(_0x18add0){return db['sequelize'][_0x6c6b('0x9b')](function(_0x477d52){return db[_0x6c6b('0x9c')][_0x6c6b('0x3a')]({'where':{'MailAccountId':_0x80ced1[_0x6c6b('0x60')]['id']},'transaction':_0x477d52})['then'](function(_0xf0d483){var _0x563946=_[_0x6c6b('0x46')](_0x80ced1[_0x6c6b('0x65')],function(_0xd6483f){_0xd6483f[_0x6c6b('0x68')]=_0x80ced1['params']['id'];return _0xd6483f;});return db[_0x6c6b('0x9c')]['bulkCreate'](_0x563946,{'transaction':_0x477d52});});})[_0x6c6b('0x25')](function(){return db[_0x6c6b('0x9c')]['findAndCountAll']({'where':{'MailAccountId':_0x80ced1[_0x6c6b('0x60')]['id']},'order':_0x6c6b('0x9d')});});}})[_0x6c6b('0x25')](respondWithResult(_0x131af8,null))[_0x6c6b('0x2f')](handleError(_0x131af8,null));};exports[_0x6c6b('0x9e')]=function(_0x3ee9f6,_0x1a0879,_0x3b2b34){var _0x3c9d17={};var _0x28766c={};var _0x58c1b;var _0x44fad2;return db['MailAccount'][_0x6c6b('0x6b')]({'where':{'id':_0x3ee9f6[_0x6c6b('0x60')]['id']}})[_0x6c6b('0x25')](handleEntityNotFound(_0x1a0879,null))['then'](function(_0x973d13){if(_0x973d13){_0x58c1b=_0x973d13;_0x28766c[_0x6c6b('0x4c')]=_[_0x6c6b('0x4d')](db['MailApplication']['rawAttributes']);_0x28766c[_0x6c6b('0x4e')]=_[_0x6c6b('0x4d')](_0x3ee9f6[_0x6c6b('0x4e')]);_0x28766c['filters']=_[_0x6c6b('0x51')](_0x28766c[_0x6c6b('0x4c')],_0x28766c['query']);_0x3c9d17['attributes']=_[_0x6c6b('0x51')](_0x28766c['model'],qs[_0x6c6b('0x52')](_0x3ee9f6['query']['fields']));_0x3c9d17[_0x6c6b('0x50')]=_0x3c9d17['attributes'][_0x6c6b('0x53')]?_0x3c9d17[_0x6c6b('0x50')]:_0x28766c[_0x6c6b('0x4c')];_0x3c9d17[_0x6c6b('0x56')]=qs['sort'](_0x3ee9f6[_0x6c6b('0x4e')][_0x6c6b('0x6c')]);_0x3c9d17[_0x6c6b('0x59')]=qs[_0x6c6b('0x4f')](_[_0x6c6b('0x57')](_0x3ee9f6[_0x6c6b('0x4e')],_0x28766c[_0x6c6b('0x4f')]));if(_0x3ee9f6[_0x6c6b('0x4e')][_0x6c6b('0x58')]){_0x3c9d17['where']=_[_0x6c6b('0x5b')](_0x3c9d17[_0x6c6b('0x59')],{'$or':_[_0x6c6b('0x46')](_0x3c9d17[_0x6c6b('0x50')],function(_0x42873f){var _0x115c3d={};_0x115c3d[_0x42873f]={'$like':'%'+_0x3ee9f6['query']['filter']+'%'};return _0x115c3d;})});}_0x3c9d17=_[_0x6c6b('0x5b')]({},_0x3c9d17,_0x3ee9f6[_0x6c6b('0x63')]);return _0x58c1b[_0x6c6b('0x9e')](_0x3c9d17);}})[_0x6c6b('0x25')](function(_0x30bdc2){if(_0x30bdc2){_0x44fad2=_0x30bdc2[_0x6c6b('0x53')];if(!_0x3ee9f6['query']['hasOwnProperty'](_0x6c6b('0x55'))){_0x3c9d17[_0x6c6b('0x35')]=qs[_0x6c6b('0x35')](_0x3ee9f6[_0x6c6b('0x4e')][_0x6c6b('0x35')]);_0x3c9d17['offset']=qs['offset'](_0x3ee9f6[_0x6c6b('0x4e')][_0x6c6b('0x34')]);}return _0x58c1b[_0x6c6b('0x9e')](_0x3c9d17);}})['then'](function(_0x316f5f){if(_0x316f5f){return _0x316f5f?{'count':_0x44fad2,'rows':_0x316f5f}:null;}})[_0x6c6b('0x25')](respondWithResult(_0x1a0879,null))[_0x6c6b('0x2f')](handleError(_0x1a0879,null));};exports['getMessages']=function(_0x4cd8c7,_0x44a0a9,_0x3e9a31){var _0x478ecc={'raw':!![],'where':{}};var _0x548374={};var _0x3834d3={'count':0x0,'rows':[]};return db[_0x6c6b('0x47')][_0x6c6b('0x6b')]({'where':{'id':_0x4cd8c7[_0x6c6b('0x60')]['id']}})[_0x6c6b('0x25')](handleEntityNotFound(_0x44a0a9,null))[_0x6c6b('0x25')](function(_0x46c885){if(_0x46c885){_0x548374['model']=_[_0x6c6b('0x4d')](db[_0x6c6b('0x9f')][_0x6c6b('0x48')]);_0x548374[_0x6c6b('0x4e')]=_[_0x6c6b('0x4d')](_0x4cd8c7[_0x6c6b('0x4e')]);_0x548374[_0x6c6b('0x4f')]=_[_0x6c6b('0x51')](_0x548374[_0x6c6b('0x4c')],_0x548374[_0x6c6b('0x4e')]);_0x478ecc[_0x6c6b('0x50')]=_[_0x6c6b('0x51')](_0x548374[_0x6c6b('0x4c')],qs[_0x6c6b('0x52')](_0x4cd8c7[_0x6c6b('0x4e')][_0x6c6b('0x52')]));_0x478ecc[_0x6c6b('0x50')]=_0x478ecc['attributes'][_0x6c6b('0x53')]?_0x478ecc['attributes']:_0x548374[_0x6c6b('0x4c')];if(!_0x4cd8c7['query']['hasOwnProperty'](_0x6c6b('0x55'))){_0x478ecc['limit']=qs['limit'](_0x4cd8c7['query'][_0x6c6b('0x35')]);_0x478ecc['offset']=qs[_0x6c6b('0x34')](_0x4cd8c7[_0x6c6b('0x4e')][_0x6c6b('0x34')]);}_0x478ecc[_0x6c6b('0x56')]=qs[_0x6c6b('0x6c')](_0x4cd8c7[_0x6c6b('0x4e')][_0x6c6b('0x6c')]);_0x478ecc[_0x6c6b('0x59')]=qs[_0x6c6b('0x4f')](_['pick'](_0x4cd8c7['query'],_0x548374['filters']));_0x478ecc['where']['MailAccountId']=_0x46c885['id'];if(_0x4cd8c7[_0x6c6b('0x4e')][_0x6c6b('0x58')]){_0x478ecc[_0x6c6b('0x59')]=_[_0x6c6b('0x5b')](_0x478ecc[_0x6c6b('0x59')],{'$or':_['map'](_0x478ecc[_0x6c6b('0x50')],function(_0x427aa0){var _0x7c352f={};_0x7c352f[_0x427aa0]={'$like':'%'+_0x4cd8c7[_0x6c6b('0x4e')][_0x6c6b('0x58')]+'%'};return _0x7c352f;})});}if(_0x4cd8c7[_0x6c6b('0x4e')][_0x6c6b('0xa0')]){var _0x1583c7=_0x4cd8c7[_0x6c6b('0x4e')]['$gte'][_0x6c6b('0xa1')](',');var _0x181b89={};_0x181b89[_0x1583c7[0x0]]={'$gte':moment(_0x1583c7[0x1])[_0x6c6b('0xa2')]('YYYY-MM-DD\x20HH:mm:ss')};_0x478ecc[_0x6c6b('0x59')]=_['merge'](_0x478ecc[_0x6c6b('0x59')],_0x181b89);}_0x478ecc=_[_0x6c6b('0x5b')]({},_0x478ecc,_0x4cd8c7[_0x6c6b('0x63')]);return db[_0x6c6b('0x9f')][_0x6c6b('0x33')]({'where':_0x478ecc[_0x6c6b('0x59')]})[_0x6c6b('0x25')](function(_0x107140){_0x3834d3[_0x6c6b('0x33')]=_0x107140;if(_0x4cd8c7['query']['includeAll']){_0x478ecc[_0x6c6b('0x5c')]=[{'all':!![]}];}return db['MailMessage'][_0x6c6b('0x5d')](_0x478ecc);})[_0x6c6b('0x25')](function(_0x4b64c7){_0x3834d3[_0x6c6b('0x5e')]=_0x4b64c7;return _0x3834d3;});}})[_0x6c6b('0x25')](respondWithFilteredResult(_0x44a0a9,_0x478ecc))[_0x6c6b('0x2f')](handleError(_0x44a0a9,null));};exports[_0x6c6b('0x40')]=function(_0x3bd33f,_0x203dc7,_0x4ca430){var _0x273b2e,_0x5f0f7c={},_0x5d6465;if(_0x3bd33f[_0x6c6b('0x65')]['to']){_0x5d6465=_0x3bd33f[_0x6c6b('0x65')]['to'][_0x6c6b('0xa1')](',')[0x0];}return db[_0x6c6b('0x47')][_0x6c6b('0x64')]({'where':{'id':_0x3bd33f[_0x6c6b('0x60')]['id']},'include':[{'model':db[_0x6c6b('0xa3')],'as':_0x6c6b('0xa4'),'include':[{'model':db[_0x6c6b('0xa5')],'as':_0x6c6b('0xa6'),'where':{'email':_0x5d6465},'limit':0x1,'order':[[_0x6c6b('0xa7'),_0x6c6b('0xa8')]]}]},{'model':db[_0x6c6b('0x42')],'as':'Smtp','raw':!![]}]})[_0x6c6b('0x25')](handleEntityNotFound(_0x203dc7,null))[_0x6c6b('0x25')](function(_0xb9c2fa){if(_0xb9c2fa){_0x273b2e=_0xb9c2fa;if(_0xb9c2fa[_0x6c6b('0x43')]){if(_[_0x6c6b('0x76')](_0x3bd33f[_0x6c6b('0x65')][_0x6c6b('0xa9')])){_0x3bd33f[_0x6c6b('0x65')][_0x6c6b('0xa9')]=util[_0x6c6b('0xa2')](_0x6c6b('0xaa'),_0xb9c2fa[_0x6c6b('0x3f')],_0xb9c2fa[_0x6c6b('0x74')]||_0xb9c2fa['Smtp']['user']);}if(_0x3bd33f[_0x6c6b('0x65')][_0x6c6b('0xab')]&&_0x3bd33f[_0x6c6b('0x65')][_0x6c6b('0xab')][_0x6c6b('0x53')]){for(var _0xabbc21=0x0;_0xabbc21<_0x3bd33f[_0x6c6b('0x65')]['attachments'][_0x6c6b('0x53')];_0xabbc21+=0x1){_0x3bd33f[_0x6c6b('0x65')][_0x6c6b('0xab')][_0xabbc21]={'filename':_0x3bd33f[_0x6c6b('0x65')][_0x6c6b('0xab')][_0xabbc21]['name'],'path':path['join'](config['root'],_0x6c6b('0xac'),_0x3bd33f['body'][_0x6c6b('0xab')][_0xabbc21][_0x6c6b('0xad')])};}}var _0x5c0772={'tls':{'rejectUnauthorized':![]}};if(_['isNil'](_0xb9c2fa[_0x6c6b('0x43')]['service'])){if(_0xb9c2fa['Smtp'][_0x6c6b('0x7e')]){_0x5c0772['auth']={'user':_0xb9c2fa['Smtp']['user'],'pass':_0xb9c2fa['Smtp']['pass']};}_0x5c0772['host']=_0xb9c2fa[_0x6c6b('0x43')][_0x6c6b('0x7f')];_0x5c0772[_0x6c6b('0x80')]=_0xb9c2fa[_0x6c6b('0x43')]['port'];_0x5c0772[_0x6c6b('0xae')]=_0xb9c2fa['Smtp'][_0x6c6b('0xae')];}else{_0x5c0772[_0x6c6b('0x81')]=_0xb9c2fa['Smtp']['service'];_0x5c0772[_0x6c6b('0xaf')]={'user':_0xb9c2fa[_0x6c6b('0x43')]['user'],'pass':_0xb9c2fa[_0x6c6b('0x43')][_0x6c6b('0x7c')]};}return respondWithRpcPromise(_0x6c6b('0xb0'),_0x6c6b('0xb1'),{'account':_0x5c0772,'message':_0x3bd33f[_0x6c6b('0x65')]});}else{throw new Error(_0x6c6b('0xb2'));}}})['then'](function(_0x3e124b){if(_0x3e124b){_0x5f0f7c=_0x3e124b;if(_0x273b2e[_0x6c6b('0xa4')]){if(_0x273b2e['List'][_0x6c6b('0xa6')][_0x6c6b('0x53')]){return _0x273b2e[_0x6c6b('0xa4')]['Contacts'][0x0];}else{return db['CmContact'][_0x6c6b('0x73')](_['defaults'](_0x3bd33f[_0x6c6b('0x65')],{'firstName':_0x3bd33f[_0x6c6b('0x65')]['to'],'email':_0x3bd33f[_0x6c6b('0x65')]['to'],'phone':_0x3bd33f[_0x6c6b('0x65')]['to'],'ListId':_0x273b2e['ListId']}));}}else{throw new Error('List\x20not\x20found');}}})[_0x6c6b('0x25')](function(_0x2e7dbe){if(_0x2e7dbe){var _0x3f471e={'UserId':_0x3bd33f['user']['id'],'ContactId':_0x2e7dbe['id'],'MailAccountId':_0x273b2e['id'],'inReplyTo':_0x5f0f7c['messageId'],'to':_0x3bd33f[_0x6c6b('0x65')][_0x6c6b('0xa9')],'cc':_0x3bd33f['body']['cc'],'subject':_0x3bd33f[_0x6c6b('0x65')][_0x6c6b('0xb3')],'attach':_0x3bd33f['body'][_0x6c6b('0xb4')],'firstMsgDirection':'out','lastMsgAt':moment()[_0x6c6b('0xa2')](_0x6c6b('0xb5')),'lastMsgDirection':_0x6c6b('0xb6'),'lastMsgBody':_0x3bd33f[_0x6c6b('0x65')]['body'],'Messages':[_[_0x6c6b('0x5b')](_0x3bd33f[_0x6c6b('0x65')],{'messageId':_0x5f0f7c['messageId'],'sentAt':moment()[_0x6c6b('0xa2')](_0x6c6b('0xb5')),'read':!![],'MailAccountId':_0x273b2e['id'],'UserId':_0x3bd33f[_0x6c6b('0x7b')]['id'],'ContactId':_0x2e7dbe['id']})]};if(_0x3bd33f[_0x6c6b('0x65')][_0x6c6b('0xb7')]){_0x3f471e=_[_0x6c6b('0x5b')](_0x3f471e,_0x3bd33f[_0x6c6b('0x65')][_0x6c6b('0xb7')]);}return db['MailInteraction'][_0x6c6b('0x73')](_0x3f471e,{'include':[{'model':db[_0x6c6b('0x9f')],'as':_0x6c6b('0xb8')}]});}})[_0x6c6b('0x25')](respondWithResult(_0x203dc7,null))[_0x6c6b('0x2f')](handleError(_0x203dc7,null));};exports[_0x6c6b('0xb9')]=function(_0x269bd5,_0x17a02b,_0x3894c7){return db[_0x6c6b('0x47')]['find']({'where':{'id':_0x269bd5[_0x6c6b('0x60')]['id']},'include':[{'model':db[_0x6c6b('0x42')],'as':_0x6c6b('0x43'),'raw':!![]}]})[_0x6c6b('0x25')](handleEntityNotFound(_0x17a02b,null))['then'](function(_0x2a231e){if(_0x2a231e&&_0x2a231e[_0x6c6b('0x43')]){var _0x162b00={'id':_0x2a231e['id'],'tls':{'rejectUnauthorized':![]}};if(_0x2a231e[_0x6c6b('0x43')][_0x6c6b('0x81')]){_0x162b00[_0x6c6b('0x81')]=_0x2a231e[_0x6c6b('0x43')][_0x6c6b('0x81')];}else{_0x162b00[_0x6c6b('0x7f')]=_0x2a231e['Smtp'][_0x6c6b('0x7f')];_0x162b00[_0x6c6b('0x80')]=_0x2a231e[_0x6c6b('0x43')][_0x6c6b('0x80')];_0x162b00['secure']=_0x2a231e[_0x6c6b('0x43')]['secure'];}if(_0x2a231e[_0x6c6b('0x43')][_0x6c6b('0x7e')]){_0x162b00[_0x6c6b('0xaf')]={'user':_0x2a231e['Smtp'][_0x6c6b('0x7b')],'pass':_0x2a231e[_0x6c6b('0x43')][_0x6c6b('0x7c')]};}return respondWithRpcPromise(_0x6c6b('0xba'),_0x6c6b('0xb9'),{'account':_0x162b00});}})['then'](respondWithResult(_0x17a02b,null))[_0x6c6b('0x2f')](handleError(_0x17a02b,null));};exports[_0x6c6b('0x3a')]=function(_0x506fe0,_0x1393e2){return db[_0x6c6b('0x47')][_0x6c6b('0x64')]({'where':{'id':_0x506fe0[_0x6c6b('0x60')]['id']}})[_0x6c6b('0x25')](handleEntityNotFound(_0x1393e2,null))['then'](function(_0x1f387c){if(_0x1f387c&&_0x1f387c['service']){throw new db[(_0x6c6b('0xbb'))][(_0x6c6b('0x22'))](_0x6c6b('0xbc'));}return _0x1f387c;})['then'](removeEntity(_0x1393e2,null))['catch'](handleError(_0x1393e2,null));};exports[_0x6c6b('0xbd')]=function(_0x502647,_0x449ef9,_0x42fdfa){return db[_0x6c6b('0x47')][_0x6c6b('0x64')]({'where':{'id':_0x502647[_0x6c6b('0x60')]['id']}})[_0x6c6b('0x25')](handleEntityNotFound(_0x449ef9,null))['then'](function(_0x3a8a06){if(_0x3a8a06){return _0x3a8a06[_0x6c6b('0xbd')](_0x502647[_0x6c6b('0x65')][_0x6c6b('0x6e')],_[_0x6c6b('0x90')](_0x502647['body'],[_0x6c6b('0x6e'),'id'])||{})['spread'](function(_0x111b94){for(var _0x3254aa=0x0;_0x3254aa<_0x502647[_0x6c6b('0x65')][_0x6c6b('0x6e')][_0x6c6b('0x53')];_0x3254aa+=0x1){socket[_0x6c6b('0xbe')](_0x6c6b('0xbf'),{'UserId':_0x502647['body'][_0x6c6b('0x6e')][_0x3254aa],'MailAccountId':_0x502647[_0x6c6b('0x60')]['id']});}return _0x111b94;});}})[_0x6c6b('0x25')](respondWithResult(_0x449ef9,null))[_0x6c6b('0x2f')](handleError(_0x449ef9,null));};exports[_0x6c6b('0xc0')]=function(_0x617550,_0x571466,_0x4d3529){return db[_0x6c6b('0x47')]['find']({'where':{'id':_0x617550['params']['id']}})[_0x6c6b('0x25')](handleEntityNotFound(_0x571466,null))['then'](function(_0x423a95){if(_0x423a95){return _0x423a95['removeAgents'](_0x617550[_0x6c6b('0x4e')][_0x6c6b('0x6e')])[_0x6c6b('0x25')](function(){if(_['isArray'](_0x617550['query'][_0x6c6b('0x6e')])){for(var _0x1c2808=0x0;_0x1c2808<_0x617550[_0x6c6b('0x4e')][_0x6c6b('0x6e')][_0x6c6b('0x53')];_0x1c2808+=0x1){socket[_0x6c6b('0xbe')](_0x6c6b('0xc1'),{'UserId':Number(_0x617550[_0x6c6b('0x4e')]['ids'][_0x1c2808]),'MailAccountId':Number(_0x617550[_0x6c6b('0x60')]['id'])});}}else{socket[_0x6c6b('0xbe')](_0x6c6b('0xc1'),{'UserId':Number(_0x617550[_0x6c6b('0x4e')][_0x6c6b('0x6e')]),'MailAccountId':Number(_0x617550[_0x6c6b('0x60')]['id'])});}});}})['then'](respondWithStatusCode(_0x571466,null))[_0x6c6b('0x2f')](handleError(_0x571466,null));};exports['getAgents']=function(_0x53d60f,_0x3c0be7,_0x24ab81){var _0x249ab8={};var _0xf1c7d2={};var _0x5c1037;var _0x1b8a65;return db[_0x6c6b('0x47')]['findOne']({'where':{'id':_0x53d60f[_0x6c6b('0x60')]['id']}})[_0x6c6b('0x25')](handleEntityNotFound(_0x3c0be7,null))[_0x6c6b('0x25')](function(_0x45075b){if(_0x45075b){_0x5c1037=_0x45075b;_0xf1c7d2['model']=_[_0x6c6b('0x4d')](db[_0x6c6b('0x94')][_0x6c6b('0x48')]);_0xf1c7d2[_0x6c6b('0x4e')]=_[_0x6c6b('0x4d')](_0x53d60f['query']);_0xf1c7d2[_0x6c6b('0x4f')]=_[_0x6c6b('0x51')](_0xf1c7d2[_0x6c6b('0x4c')],_0xf1c7d2[_0x6c6b('0x4e')]);_0x249ab8[_0x6c6b('0x50')]=_[_0x6c6b('0x51')](_0xf1c7d2[_0x6c6b('0x4c')],qs[_0x6c6b('0x52')](_0x53d60f['query'][_0x6c6b('0x52')]));_0x249ab8[_0x6c6b('0x50')]=_0x249ab8[_0x6c6b('0x50')]['length']?_0x249ab8[_0x6c6b('0x50')]:_0xf1c7d2['model'];_0x249ab8[_0x6c6b('0x56')]=qs['sort'](_0x53d60f['query'][_0x6c6b('0x6c')]);_0x249ab8[_0x6c6b('0x59')]=qs[_0x6c6b('0x4f')](_[_0x6c6b('0x57')](_0x53d60f['query'],_0xf1c7d2['filters']));if(_0x53d60f[_0x6c6b('0x4e')][_0x6c6b('0x58')]){_0x249ab8[_0x6c6b('0x59')]=_[_0x6c6b('0x5b')](_0x249ab8['where'],{'$or':_[_0x6c6b('0x46')](_0x249ab8['attributes'],function(_0x27df32){var _0x5762ff={};_0x5762ff[_0x27df32]={'$like':'%'+_0x53d60f[_0x6c6b('0x4e')]['filter']+'%'};return _0x5762ff;})});}_0x249ab8=_[_0x6c6b('0x5b')]({},_0x249ab8,_0x53d60f[_0x6c6b('0x63')]);return _0x5c1037[_0x6c6b('0xc2')](_0x249ab8);}})[_0x6c6b('0x25')](function(_0x5f0439){if(_0x5f0439){_0x1b8a65=_0x5f0439[_0x6c6b('0x53')];if(!_0x53d60f[_0x6c6b('0x4e')][_0x6c6b('0x54')](_0x6c6b('0x55'))){_0x249ab8[_0x6c6b('0x35')]=qs[_0x6c6b('0x35')](_0x53d60f['query'][_0x6c6b('0x35')]);_0x249ab8[_0x6c6b('0x34')]=qs[_0x6c6b('0x34')](_0x53d60f[_0x6c6b('0x4e')][_0x6c6b('0x34')]);}return _0x5c1037[_0x6c6b('0xc2')](_0x249ab8);}})['then'](function(_0x1ba869){if(_0x1ba869){return _0x1ba869?{'count':_0x1b8a65,'rows':_0x1ba869}:null;}})['then'](respondWithResult(_0x3c0be7,null))[_0x6c6b('0x2f')](handleError(_0x3c0be7,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index e880cec..5a37387 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 _0x9127=['setMaxListeners','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','MailAccount'];(function(_0x2064f4,_0x4f6a5b){var _0x428481=function(_0x3f7434){while(--_0x3f7434){_0x2064f4['push'](_0x2064f4['shift']());}};_0x428481(++_0x4f6a5b);}(_0x9127,0x180));var _0x7912=function(_0x297eea,_0x5060be){_0x297eea=_0x297eea-0x0;var _0x1c42d2=_0x9127[_0x297eea];return _0x1c42d2;};'use strict';var EventEmitter=require(_0x7912('0x0'));var MailAccount=require(_0x7912('0x1'))['db'][_0x7912('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x7912('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x7912('0x4')};function emitEvent(_0x4c87ba){return function(_0x30df4d,_0x3792fc,_0x39baab){MailAccountEvents[_0x7912('0x5')](_0x4c87ba+':'+_0x30df4d['id'],_0x30df4d);MailAccountEvents[_0x7912('0x5')](_0x4c87ba,_0x30df4d);_0x39baab(null);};}for(var e in events){if(events[_0x7912('0x6')](e)){var event=events[e];MailAccount[_0x7912('0x7')](e,emitEvent(event));}}module[_0x7912('0x8')]=MailAccountEvents; \ No newline at end of file +var _0xb722=['hasOwnProperty','../../mysqldb','MailAccount','setMaxListeners','save','emit'];(function(_0x5102eb,_0x73cfe5){var _0x36bae9=function(_0x52dea9){while(--_0x52dea9){_0x5102eb['push'](_0x5102eb['shift']());}};_0x36bae9(++_0x73cfe5);}(_0xb722,0x1e1));var _0x2b72=function(_0x3898ee,_0x3e6ba2){_0x3898ee=_0x3898ee-0x0;var _0x1b041d=_0xb722[_0x3898ee];return _0x1b041d;};'use strict';var EventEmitter=require('events');var MailAccount=require(_0x2b72('0x0'))['db'][_0x2b72('0x1')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x2b72('0x2')](0x0);var events={'afterCreate':_0x2b72('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x37a158){return function(_0x4f99ed,_0x245219,_0x48d2b0){MailAccountEvents[_0x2b72('0x4')](_0x37a158+':'+_0x4f99ed['id'],_0x4f99ed);MailAccountEvents['emit'](_0x37a158,_0x4f99ed);_0x48d2b0(null);};}for(var e in events){if(events[_0x2b72('0x5')](e)){var event=events[e];MailAccount['hook'](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 8401e28..71368d4 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 _0x9cc0=['api','moment','bluebird','request-promise','path','rimraf','./mailAccount.attributes','exports','mail_accounts','lodash','util','../../config/logger'];(function(_0xcfe8cc,_0xb83aeb){var _0x55ac53=function(_0x4067d4){while(--_0x4067d4){_0xcfe8cc['push'](_0xcfe8cc['shift']());}};_0x55ac53(++_0xb83aeb);}(_0x9cc0,0x81));var _0x09cc=function(_0x22e101,_0x412840){_0x22e101=_0x22e101-0x0;var _0xa51f61=_0x9cc0[_0x22e101];return _0xa51f61;};'use strict';var _=require(_0x09cc('0x0'));var util=require(_0x09cc('0x1'));var logger=require(_0x09cc('0x2'))(_0x09cc('0x3'));var moment=require(_0x09cc('0x4'));var BPromise=require(_0x09cc('0x5'));var rp=require(_0x09cc('0x6'));var fs=require('fs');var path=require(_0x09cc('0x7'));var rimraf=require(_0x09cc('0x8'));var config=require('../../config/environment');var attributes=require(_0x09cc('0x9'));module[_0x09cc('0xa')]=function(_0x16d6b9,_0xc7fbd1){return _0x16d6b9['define']('MailAccount',attributes,{'tableName':_0x09cc('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1c2d=['path','rimraf','../../config/environment','exports','MailAccount','mail_accounts','lodash','util','../../config/logger','api','request-promise'];(function(_0x18c1d6,_0x50b09c){var _0x5f225e=function(_0x3146ff){while(--_0x3146ff){_0x18c1d6['push'](_0x18c1d6['shift']());}};_0x5f225e(++_0x50b09c);}(_0x1c2d,0x103));var _0xd1c2=function(_0x3cf550,_0x51e786){_0x3cf550=_0x3cf550-0x0;var _0x3a6231=_0x1c2d[_0x3cf550];return _0x3a6231;};'use strict';var _=require(_0xd1c2('0x0'));var util=require(_0xd1c2('0x1'));var logger=require(_0xd1c2('0x2'))(_0xd1c2('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xd1c2('0x4'));var fs=require('fs');var path=require(_0xd1c2('0x5'));var rimraf=require(_0xd1c2('0x6'));var config=require(_0xd1c2('0x7'));var attributes=require('./mailAccount.attributes');module[_0xd1c2('0x8')]=function(_0xe0a7be,_0xfe7ea1){return _0xe0a7be['define'](_0xd1c2('0x9'),attributes,{'tableName':_0xd1c2('0xa'),'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 408165c..43660f3 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 _0x2557=['request','then','info','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','MailAccount,\x20%s,\x20%s','result','catch','GetMailAccount','MailAccount','findAll','options','raw','where','attributes','limit','map','include','model','debug','ShowMailAccount','body','mail','difference','keys','rawAttributes','createdAt','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','account','CmList','List','DESC','Smtp','omit','applications','Applications','priority','asc','length','close','autoclose','*,*,*,*','Contacts','CmContact','create','List\x20not\x20found','contact','messageId','generate','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','Messages','inReplyTo','Contact\x20not\x20found','spread','subject','attach','interaction','created','MailMessage','originTo','bcc','Attachment','Attachments','User','UserId','unshift','name','waitForTheAssignedAgent','Start','startRouting','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','http','redis','defaults','socket.io-emitter','./mailAccount.socket'];(function(_0x539e89,_0x2b67c6){var _0x3d557b=function(_0x5c49e8){while(--_0x5c49e8){_0x539e89['push'](_0x539e89['shift']());}};_0x3d557b(++_0x2b67c6);}(_0x2557,0x11e));var _0x7255=function(_0x2f8860,_0x3ff6aa){_0x2f8860=_0x2f8860-0x0;var _0x21761f=_0x2557[_0x2f8860];return _0x21761f;};'use strict';var _=require(_0x7255('0x0'));var util=require('util');var moment=require(_0x7255('0x1'));var BPromise=require(_0x7255('0x2'));var rs=require(_0x7255('0x3'));var fs=require('fs');var Redis=require(_0x7255('0x4'));var db=require(_0x7255('0x5'))['db'];var utils=require(_0x7255('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x7255('0x7'));var client=jayson[_0x7255('0x8')][_0x7255('0x9')]({'port':0x232c});config[_0x7255('0xa')]=_[_0x7255('0xb')](config[_0x7255('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x7255('0xc'))(new Redis(config[_0x7255('0xa')]));require(_0x7255('0xd'))['register'](socket);function respondWithRpcPromise(_0x426b05,_0x18f985,_0x17a5c7){return new BPromise(function(_0xdf5bc3,_0x34f9ef){return client[_0x7255('0xe')](_0x426b05,_0x17a5c7)[_0x7255('0xf')](function(_0x532392){logger[_0x7255('0x10')]('MailAccount,\x20%s,\x20%s',_0x18f985,'request\x20sent');logger['debug'](_0x7255('0x11'),_0x18f985,_0x7255('0x12'),JSON[_0x7255('0x13')](_0x532392));if(_0x532392[_0x7255('0x14')]){if(_0x532392[_0x7255('0x14')][_0x7255('0x15')]===0x1f4){logger[_0x7255('0x14')]('MailAccount,\x20%s,\x20%s',_0x18f985,_0x532392[_0x7255('0x14')][_0x7255('0x16')]);return _0x34f9ef(_0x532392[_0x7255('0x14')][_0x7255('0x16')]);}logger[_0x7255('0x14')](_0x7255('0x17'),_0x18f985,_0x532392[_0x7255('0x14')][_0x7255('0x16')]);return _0xdf5bc3(_0x532392[_0x7255('0x14')][_0x7255('0x16')]);}else{logger[_0x7255('0x10')](_0x7255('0x17'),_0x18f985,_0x7255('0x12'));_0xdf5bc3(_0x532392[_0x7255('0x18')][_0x7255('0x16')]);}})[_0x7255('0x19')](function(_0x461f7f){logger['error']('MailAccount,\x20%s,\x20%s',_0x18f985,_0x461f7f);_0x34f9ef(_0x461f7f);});});}exports[_0x7255('0x1a')]=function(_0xb9653){var _0x1d47d8=this;return new Promise(function(_0xf8fb0,_0x4bff12){return db[_0x7255('0x1b')][_0x7255('0x1c')]({'raw':_0xb9653[_0x7255('0x1d')]?_0xb9653[_0x7255('0x1d')][_0x7255('0x1e')]===undefined?!![]:![]:!![],'where':_0xb9653[_0x7255('0x1d')]?_0xb9653[_0x7255('0x1d')][_0x7255('0x1f')]||null:null,'attributes':_0xb9653['options']?_0xb9653[_0x7255('0x1d')][_0x7255('0x20')]||null:null,'limit':_0xb9653[_0x7255('0x1d')]?_0xb9653[_0x7255('0x1d')][_0x7255('0x21')]||null:null,'include':_0xb9653[_0x7255('0x1d')]?_0xb9653[_0x7255('0x1d')]['include']?_[_0x7255('0x22')](_0xb9653[_0x7255('0x1d')][_0x7255('0x23')],function(_0x568068){return{'model':db[_0x568068[_0x7255('0x24')]],'as':_0x568068['as'],'attributes':_0x568068['attributes'],'include':_0x568068[_0x7255('0x23')]?_[_0x7255('0x22')](_0x568068['include'],function(_0xe0b108){return{'model':db[_0xe0b108[_0x7255('0x24')]],'as':_0xe0b108['as'],'attributes':_0xe0b108[_0x7255('0x20')],'include':_0xe0b108[_0x7255('0x23')]?_[_0x7255('0x22')](_0xe0b108[_0x7255('0x23')],function(_0x54e53a){return{'model':db[_0x54e53a[_0x7255('0x24')]],'as':_0x54e53a['as'],'attributes':_0x54e53a[_0x7255('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x56dee8){logger[_0x7255('0x10')](_0x7255('0x1a'),_0xb9653);logger[_0x7255('0x25')](_0x7255('0x1a'),_0xb9653,JSON[_0x7255('0x13')](_0x56dee8));_0xf8fb0(_0x56dee8);})[_0x7255('0x19')](function(_0x9436cc){logger[_0x7255('0x14')]('GetMailAccount',_0x9436cc[_0x7255('0x16')],_0xb9653);_0x4bff12(_0x1d47d8['error'](0x1f4,_0x9436cc[_0x7255('0x16')]));});});};exports['ShowMailAccount']=function(_0x11635f){var _0x28b698=this;return new Promise(function(_0xb7d092,_0x576583){return db['MailAccount']['find']({'raw':_0x11635f[_0x7255('0x1d')]?_0x11635f[_0x7255('0x1d')][_0x7255('0x1e')]===undefined?!![]:![]:!![],'where':_0x11635f[_0x7255('0x1d')]?_0x11635f[_0x7255('0x1d')][_0x7255('0x1f')]||null:null,'attributes':_0x11635f[_0x7255('0x1d')]?_0x11635f[_0x7255('0x1d')]['attributes']||null:null,'include':_0x11635f[_0x7255('0x1d')]?_0x11635f[_0x7255('0x1d')]['include']?_[_0x7255('0x22')](_0x11635f[_0x7255('0x1d')][_0x7255('0x23')],function(_0x44dc3a){return{'model':db[_0x44dc3a[_0x7255('0x24')]],'as':_0x44dc3a['as'],'attributes':_0x44dc3a[_0x7255('0x20')],'include':_0x44dc3a['include']?_[_0x7255('0x22')](_0x44dc3a[_0x7255('0x23')],function(_0xa62226){return{'model':db[_0xa62226['model']],'as':_0xa62226['as'],'attributes':_0xa62226[_0x7255('0x20')],'include':_0xa62226['include']?_[_0x7255('0x22')](_0xa62226[_0x7255('0x23')],function(_0x148dd1){return{'model':db[_0x148dd1[_0x7255('0x24')]],'as':_0x148dd1['as'],'attributes':_0x148dd1[_0x7255('0x20')]};}):[]};}):[]};}):[]:[]})[_0x7255('0xf')](function(_0x30776b){logger['info'](_0x7255('0x26'),_0x11635f);logger[_0x7255('0x25')](_0x7255('0x26'),_0x11635f,JSON[_0x7255('0x13')](_0x30776b));_0xb7d092(_0x30776b);})[_0x7255('0x19')](function(_0x12cae9){logger['error'](_0x7255('0x26'),_0x12cae9[_0x7255('0x16')],_0x11635f);_0x576583(_0x28b698[_0x7255('0x14')](0x1f4,_0x12cae9[_0x7255('0x16')]));});});};exports['NotifyMailAccount']=function(_0x449396){var _0x4e1c47=this;return new Promise(function(_0x4d5147,_0x4837de){var _0x512928={'body':_0x449396[_0x7255('0x27')],'channel':_0x7255('0x28')};var _0x505c50=_[_0x7255('0x29')](_[_0x7255('0x2a')](db['CmContact'][_0x7255('0x2b')]),[_0x7255('0x2c'),_0x7255('0x2d'),_0x7255('0x2e'),_0x7255('0x2f')]);var _0x3713cc=![];if(_0x449396['body']['id']){delete _0x449396[_0x7255('0x27')]['id'];}if(_[_0x7255('0x30')](_0x449396[_0x7255('0x27')][_0x7255('0x31')])){return _0x4837de(_0x4e1c47[_0x7255('0x14')](0x1f4,_0x7255('0x32')));}if(_[_0x7255('0x30')](_0x449396[_0x7255('0x27')][_0x7255('0x27')])||_0x449396[_0x7255('0x27')]['body']===''){return _0x4837de(_0x4e1c47[_0x7255('0x14')](0x1f4,'body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0x7255('0x30')](_0x449396[_0x7255('0x27')][_0x7255('0x33')])){return _0x4837de(_0x4e1c47['error'](0x1f4,_0x7255('0x34')+_0x505c50));}if(!_[_0x7255('0x35')](_0x505c50,_0x449396[_0x7255('0x27')][_0x7255('0x33')])){return _0x4837de(_0x4e1c47[_0x7255('0x14')](0x1f4,_0x7255('0x36')+_0x505c50));}var _0x25f1c6={};_0x25f1c6[_0x449396[_0x7255('0x27')][_0x7255('0x33')]]=_0x449396['body'][_0x7255('0x31')];return db[_0x7255('0x1b')][_0x7255('0x37')]({'where':{'id':_0x449396[_0x7255('0x38')]['id']},'include':[{'model':db[_0x7255('0x39')],'as':_0x7255('0x3a'),'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x25f1c6,'limit':0x1,'order':[[_0x7255('0x2d'),_0x7255('0x3b')]]}]},{'model':db['MailApplication'],'as':'Applications'},{'model':db['MailServerOut'],'as':_0x7255('0x3c')}]})[_0x7255('0xf')](function(_0x2d12d2){if(_0x2d12d2&&_0x2d12d2[_0x7255('0x3a')]){var _0x5d7c86=_0x2d12d2['get']({'plain':!![]});_0x512928['account']=_[_0x7255('0x3d')](_0x5d7c86,['Applications',_0x7255('0x3a')]);_0x512928[_0x7255('0x3e')]=_0x5d7c86[_0x7255('0x3f')];_0x512928['list']=_0x5d7c86[_0x7255('0x3a')];_0x512928[_0x7255('0x3e')]=_['orderBy'](_0x512928['applications'],[_0x7255('0x40')],[_0x7255('0x41')]);if(_0x512928['account']&&_0x512928[_0x7255('0x38')]['autoclose']){_0x512928[_0x7255('0x3e')]['push']({'id':0x0,'priority':_0x512928[_0x7255('0x3e')][_0x7255('0x42')]+0x1,'app':_0x7255('0x43'),'appdata':_0x7255('0x44'),'interval':_0x7255('0x45')});}if(_0x512928['account']['Applications']){delete _0x512928[_0x7255('0x38')]['Applications'];}if(_0x512928[_0x7255('0x38')][_0x7255('0x3a')]){delete _0x512928[_0x7255('0x38')][_0x7255('0x3a')];}if(_0x5d7c86[_0x7255('0x3a')][_0x7255('0x46')]['length']){return _0x5d7c86[_0x7255('0x3a')][_0x7255('0x46')][0x0];}var _0x53371c=_['defaults'](_0x449396[_0x7255('0x27')],{'firstName':_0x449396[_0x7255('0x27')][_0x7255('0x31')],'ListId':_0x5d7c86['ListId']});_0x53371c[_0x449396['body'][_0x7255('0x33')]]=_0x449396['body'][_0x7255('0x31')];return db[_0x7255('0x47')][_0x7255('0x48')](_0x53371c);}else{throw new Error(_0x7255('0x49'));}})[_0x7255('0xf')](function(_0x424d93){_0x512928[_0x7255('0x4a')]=_0x424d93;if(_0x424d93){if(!_0x449396[_0x7255('0x27')][_0x7255('0x16')][_0x7255('0x4b')]){_0x449396[_0x7255('0x27')][_0x7255('0x16')][_0x7255('0x4b')]=rs[_0x7255('0x4c')]()+'\x20'+_0x449396[_0x7255('0x27')]['message']['from'];}var _0x114aa4={'ContactId':_0x424d93['id'],'MailAccountId':_0x449396[_0x7255('0x38')]['id'],'inReplyTo':_0x449396[_0x7255('0x27')][_0x7255('0x16')][_0x7255('0x4b')],'to':_0x449396['body'][_0x7255('0x16')][_0x7255('0x31')],'cc':_0x449396[_0x7255('0x27')][_0x7255('0x16')]['cc'],'subject':_0x449396[_0x7255('0x27')]['message']['subject'],'attach':_0x449396[_0x7255('0x27')][_0x7255('0x16')]['attach'],'lastMsgAt':moment()[_0x7255('0x4d')](_0x7255('0x4e')),'lastMsgDirection':'in','lastMsgBody':_0x449396[_0x7255('0x27')]['body']};return db[_0x7255('0x4f')]['find']({'where':{'closed':![],'MailAccountId':_0x449396[_0x7255('0x38')]['id']},'include':[{'model':db['MailMessage'],'as':_0x7255('0x50'),'attributes':[_0x7255('0x4b')],'where':{'messageId':_0x449396['body'][_0x7255('0x16')][_0x7255('0x51')]}}]})[_0x7255('0xf')](function(_0xff168f){if(_0xff168f){return[_0xff168f,![]];}return db[_0x7255('0x4f')][_0x7255('0x48')](_0x114aa4)['then'](function(_0x3ac8f3){return[_0x3ac8f3,!![]];});});}else{throw new Error(_0x7255('0x52'));}})[_0x7255('0x53')](function(_0x223754,_0x5e3389){if(_0x223754){_0x3713cc=_0x5e3389;if(!_0x5e3389){return _0x223754['update']({'inReplyTo':_0x449396[_0x7255('0x27')][_0x7255('0x16')][_0x7255('0x4b')],'to':_0x449396['body'][_0x7255('0x16')][_0x7255('0x31')],'cc':_0x449396[_0x7255('0x27')][_0x7255('0x16')]['cc'],'subject':_0x449396['body']['message'][_0x7255('0x54')],'attach':_0x223754['attach']?_0x223754[_0x7255('0x55')]:_0x449396[_0x7255('0x27')][_0x7255('0x16')][_0x7255('0x55')],'substatus':null,'substatusAt':moment()['format'](_0x7255('0x4e')),'lastMsgAt':moment()['format'](_0x7255('0x4e')),'lastMsgDirection':'in','lastMsgBody':_0x449396[_0x7255('0x27')][_0x7255('0x27')]});}else{return _0x223754;}}})[_0x7255('0xf')](function(_0xdc5cf){_0x512928[_0x7255('0x56')]=_0xdc5cf['get']({'plain':!![]});_0x512928[_0x7255('0x56')][_0x7255('0x57')]=_0x3713cc;return db[_0x7255('0x58')]['create']({'body':_0x449396[_0x7255('0x27')][_0x7255('0x27')],'MailAccountId':_0x449396['account']['id'],'MailInteractionId':_0xdc5cf['id'],'direction':'in','ContactId':_0x512928[_0x7255('0x4a')]['id'],'messageId':_0x449396[_0x7255('0x27')]['message'][_0x7255('0x4b')],'from':_0x449396['body'][_0x7255('0x16')]['from'],'to':_0x449396['body'][_0x7255('0x16')]['to'],'cc':_0x449396[_0x7255('0x27')][_0x7255('0x16')]['cc'],'subject':_0x449396[_0x7255('0x27')][_0x7255('0x16')]['subject'],'attach':_0x449396[_0x7255('0x27')]['message']['attach'],'Attachments':_0x449396[_0x7255('0x27')][_0x7255('0x16')]['attachments'],'originTo':_0x449396['body'][_0x7255('0x16')][_0x7255('0x59')],'originCc':_0x449396[_0x7255('0x27')][_0x7255('0x16')]['originCc'],'bcc':_0x449396[_0x7255('0x27')][_0x7255('0x16')][_0x7255('0x5a')]},{'include':[{'model':db[_0x7255('0x5b')],'as':_0x7255('0x5c')}]});})[_0x7255('0xf')](function(_0x4d15cc){_0x512928['message']=_0x4d15cc;if(_0x512928[_0x7255('0x56')]['UserId']){return db[_0x7255('0x5d')]['find']({'attributes':['id','name'],'where':{'id':_0x512928['interaction'][_0x7255('0x5e')]}})[_0x7255('0xf')](function(_0x38c8c6){if(_0x38c8c6){_0x512928[_0x7255('0x3e')][_0x7255('0x5f')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x38c8c6[_0x7255('0x60')]+','+(_0x512928[_0x7255('0x38')][_0x7255('0x61')]||0xa),'interval':_0x7255('0x45')});}return respondWithRpcPromise('Start','startRouting',_0x512928);});}return respondWithRpcPromise(_0x7255('0x62'),_0x7255('0x63'),_0x512928);})[_0x7255('0xf')](function(_0xb095fa){_0x4d5147(_0xb095fa);})[_0x7255('0x19')](function(_0xb80358){_0x4837de(_0x4e1c47[_0x7255('0x14')](0x1f4,_0xb80358[_0x7255('0x16')]));});});}; \ No newline at end of file +var _0x1782=['push','length','close','autoclose','defaults','create','contact','messageId','attach','format','MailInteraction','MailMessage','Messages','inReplyTo','Contact\x20not\x20found','spread','subject','YYYY-MM-DD\x20HH:mm:ss','interaction','created','originCc','Attachment','Attachments','UserId','name','unshift','startRouting','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','http','localhost','socket.io-emitter','redis','./mailAccount.socket','register','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetMailAccount','MailAccount','options','raw','where','attributes','limit','include','map','model','find','ShowMailAccount','NotifyMailAccount','body','mail','keys','CmContact','rawAttributes','createdAt','updatedAt','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList','List','Contacts','DESC','Applications','MailServerOut','Smtp','get','applications','list','orderBy','priority','asc'];(function(_0x274638,_0x578968){var _0x5755df=function(_0x3227d5){while(--_0x3227d5){_0x274638['push'](_0x274638['shift']());}};_0x5755df(++_0x578968);}(_0x1782,0x13e));var _0x2178=function(_0x26a50d,_0x1b2424){_0x26a50d=_0x26a50d-0x0;var _0x1dbc76=_0x1782[_0x26a50d];return _0x1dbc76;};'use strict';var _=require(_0x2178('0x0'));var util=require('util');var moment=require(_0x2178('0x1'));var BPromise=require(_0x2178('0x2'));var rs=require(_0x2178('0x3'));var fs=require('fs');var Redis=require(_0x2178('0x4'));var db=require(_0x2178('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x2178('0x6'))(_0x2178('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x2178('0x8')][_0x2178('0x9')]({'port':0x232c});config['redis']=_['defaults'](config['redis'],{'host':_0x2178('0xa'),'port':0x18eb});var socket=require(_0x2178('0xb'))(new Redis(config[_0x2178('0xc')]));require(_0x2178('0xd'))[_0x2178('0xe')](socket);function respondWithRpcPromise(_0x5ac52e,_0x5119ea,_0x380ab6){return new BPromise(function(_0x201b7b,_0x33a201){return client[_0x2178('0xf')](_0x5ac52e,_0x380ab6)[_0x2178('0x10')](function(_0x2de258){logger[_0x2178('0x11')](_0x2178('0x12'),_0x5119ea,_0x2178('0x13'));logger[_0x2178('0x14')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x5119ea,_0x2178('0x13'),JSON[_0x2178('0x15')](_0x2de258));if(_0x2de258['error']){if(_0x2de258[_0x2178('0x16')][_0x2178('0x17')]===0x1f4){logger[_0x2178('0x16')](_0x2178('0x12'),_0x5119ea,_0x2de258[_0x2178('0x16')]['message']);return _0x33a201(_0x2de258['error']['message']);}logger[_0x2178('0x16')]('MailAccount,\x20%s,\x20%s',_0x5119ea,_0x2de258[_0x2178('0x16')][_0x2178('0x18')]);return _0x201b7b(_0x2de258['error']['message']);}else{logger[_0x2178('0x11')](_0x2178('0x12'),_0x5119ea,'request\x20sent');_0x201b7b(_0x2de258[_0x2178('0x19')][_0x2178('0x18')]);}})[_0x2178('0x1a')](function(_0x3a6493){logger[_0x2178('0x16')](_0x2178('0x12'),_0x5119ea,_0x3a6493);_0x33a201(_0x3a6493);});});}exports[_0x2178('0x1b')]=function(_0x1833be){var _0x3e308b=this;return new Promise(function(_0x2cb878,_0x1d2dd5){return db[_0x2178('0x1c')]['findAll']({'raw':_0x1833be[_0x2178('0x1d')]?_0x1833be[_0x2178('0x1d')][_0x2178('0x1e')]===undefined?!![]:![]:!![],'where':_0x1833be[_0x2178('0x1d')]?_0x1833be[_0x2178('0x1d')][_0x2178('0x1f')]||null:null,'attributes':_0x1833be[_0x2178('0x1d')]?_0x1833be[_0x2178('0x1d')][_0x2178('0x20')]||null:null,'limit':_0x1833be[_0x2178('0x1d')]?_0x1833be[_0x2178('0x1d')][_0x2178('0x21')]||null:null,'include':_0x1833be[_0x2178('0x1d')]?_0x1833be[_0x2178('0x1d')][_0x2178('0x22')]?_[_0x2178('0x23')](_0x1833be[_0x2178('0x1d')][_0x2178('0x22')],function(_0x27179c){return{'model':db[_0x27179c[_0x2178('0x24')]],'as':_0x27179c['as'],'attributes':_0x27179c[_0x2178('0x20')],'include':_0x27179c[_0x2178('0x22')]?_[_0x2178('0x23')](_0x27179c['include'],function(_0x403087){return{'model':db[_0x403087[_0x2178('0x24')]],'as':_0x403087['as'],'attributes':_0x403087['attributes'],'include':_0x403087['include']?_[_0x2178('0x23')](_0x403087['include'],function(_0xffcd00){return{'model':db[_0xffcd00[_0x2178('0x24')]],'as':_0xffcd00['as'],'attributes':_0xffcd00[_0x2178('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x50f596){logger[_0x2178('0x11')](_0x2178('0x1b'),_0x1833be);logger[_0x2178('0x14')]('GetMailAccount',_0x1833be,JSON['stringify'](_0x50f596));_0x2cb878(_0x50f596);})[_0x2178('0x1a')](function(_0x22df8a){logger[_0x2178('0x16')](_0x2178('0x1b'),_0x22df8a[_0x2178('0x18')],_0x1833be);_0x1d2dd5(_0x3e308b[_0x2178('0x16')](0x1f4,_0x22df8a[_0x2178('0x18')]));});});};exports['ShowMailAccount']=function(_0x84b7a5){var _0x3a8d6a=this;return new Promise(function(_0x4e67f7,_0x4332ac){return db[_0x2178('0x1c')][_0x2178('0x25')]({'raw':_0x84b7a5[_0x2178('0x1d')]?_0x84b7a5['options'][_0x2178('0x1e')]===undefined?!![]:![]:!![],'where':_0x84b7a5['options']?_0x84b7a5['options'][_0x2178('0x1f')]||null:null,'attributes':_0x84b7a5[_0x2178('0x1d')]?_0x84b7a5[_0x2178('0x1d')][_0x2178('0x20')]||null:null,'include':_0x84b7a5[_0x2178('0x1d')]?_0x84b7a5[_0x2178('0x1d')][_0x2178('0x22')]?_['map'](_0x84b7a5[_0x2178('0x1d')]['include'],function(_0x3f063a){return{'model':db[_0x3f063a[_0x2178('0x24')]],'as':_0x3f063a['as'],'attributes':_0x3f063a['attributes'],'include':_0x3f063a[_0x2178('0x22')]?_[_0x2178('0x23')](_0x3f063a[_0x2178('0x22')],function(_0x3a4e5d){return{'model':db[_0x3a4e5d[_0x2178('0x24')]],'as':_0x3a4e5d['as'],'attributes':_0x3a4e5d[_0x2178('0x20')],'include':_0x3a4e5d[_0x2178('0x22')]?_['map'](_0x3a4e5d['include'],function(_0x5c91a5){return{'model':db[_0x5c91a5['model']],'as':_0x5c91a5['as'],'attributes':_0x5c91a5[_0x2178('0x20')]};}):[]};}):[]};}):[]:[]})[_0x2178('0x10')](function(_0x43a5fb){logger[_0x2178('0x11')](_0x2178('0x26'),_0x84b7a5);logger['debug']('ShowMailAccount',_0x84b7a5,JSON['stringify'](_0x43a5fb));_0x4e67f7(_0x43a5fb);})['catch'](function(_0x99f039){logger[_0x2178('0x16')](_0x2178('0x26'),_0x99f039['message'],_0x84b7a5);_0x4332ac(_0x3a8d6a[_0x2178('0x16')](0x1f4,_0x99f039[_0x2178('0x18')]));});});};exports[_0x2178('0x27')]=function(_0x165167){var _0x2ff473=this;return new Promise(function(_0xa6b7d2,_0x1b31cd){var _0x2730c6={'body':_0x165167[_0x2178('0x28')],'channel':_0x2178('0x29')};var _0x4656bd=_['difference'](_[_0x2178('0x2a')](db[_0x2178('0x2b')][_0x2178('0x2c')]),[_0x2178('0x2d'),_0x2178('0x2e'),'CompanyId',_0x2178('0x2f')]);var _0x2e1b35=![];if(_0x165167[_0x2178('0x28')]['id']){delete _0x165167[_0x2178('0x28')]['id'];}if(_[_0x2178('0x30')](_0x165167[_0x2178('0x28')][_0x2178('0x31')])){return _0x1b31cd(_0x2ff473[_0x2178('0x16')](0x1f4,_0x2178('0x32')));}if(_[_0x2178('0x30')](_0x165167[_0x2178('0x28')]['body'])||_0x165167[_0x2178('0x28')]['body']===''){return _0x1b31cd(_0x2ff473[_0x2178('0x16')](0x1f4,_0x2178('0x33')));}if(_[_0x2178('0x30')](_0x165167[_0x2178('0x28')][_0x2178('0x34')])){return _0x1b31cd(_0x2ff473[_0x2178('0x16')](0x1f4,_0x2178('0x35')+_0x4656bd));}if(!_[_0x2178('0x36')](_0x4656bd,_0x165167['body'][_0x2178('0x34')])){return _0x1b31cd(_0x2ff473[_0x2178('0x16')](0x1f4,_0x2178('0x37')+_0x4656bd));}var _0xf69d6={};_0xf69d6[_0x165167[_0x2178('0x28')][_0x2178('0x34')]]=_0x165167[_0x2178('0x28')][_0x2178('0x31')];return db[_0x2178('0x1c')][_0x2178('0x25')]({'where':{'id':_0x165167[_0x2178('0x38')]['id']},'include':[{'model':db[_0x2178('0x39')],'as':_0x2178('0x3a'),'include':[{'model':db[_0x2178('0x2b')],'as':_0x2178('0x3b'),'where':_0xf69d6,'limit':0x1,'order':[['updatedAt',_0x2178('0x3c')]]}]},{'model':db['MailApplication'],'as':_0x2178('0x3d')},{'model':db[_0x2178('0x3e')],'as':_0x2178('0x3f')}]})['then'](function(_0x3b63f0){if(_0x3b63f0&&_0x3b63f0[_0x2178('0x3a')]){var _0x2f7c21=_0x3b63f0[_0x2178('0x40')]({'plain':!![]});_0x2730c6[_0x2178('0x38')]=_['omit'](_0x2f7c21,[_0x2178('0x3d'),_0x2178('0x3a')]);_0x2730c6[_0x2178('0x41')]=_0x2f7c21[_0x2178('0x3d')];_0x2730c6[_0x2178('0x42')]=_0x2f7c21['List'];_0x2730c6['applications']=_[_0x2178('0x43')](_0x2730c6[_0x2178('0x41')],[_0x2178('0x44')],[_0x2178('0x45')]);if(_0x2730c6['account']&&_0x2730c6['account']['autoclose']){_0x2730c6[_0x2178('0x41')][_0x2178('0x46')]({'id':0x0,'priority':_0x2730c6[_0x2178('0x41')][_0x2178('0x47')]+0x1,'app':_0x2178('0x48'),'appdata':_0x2178('0x49'),'interval':'*,*,*,*'});}if(_0x2730c6['account'][_0x2178('0x3d')]){delete _0x2730c6[_0x2178('0x38')]['Applications'];}if(_0x2730c6['account']['List']){delete _0x2730c6[_0x2178('0x38')][_0x2178('0x3a')];}if(_0x2f7c21[_0x2178('0x3a')][_0x2178('0x3b')]['length']){return _0x2f7c21['List'][_0x2178('0x3b')][0x0];}var _0x1f6a69=_[_0x2178('0x4a')](_0x165167[_0x2178('0x28')],{'firstName':_0x165167[_0x2178('0x28')][_0x2178('0x31')],'ListId':_0x2f7c21['ListId']});_0x1f6a69[_0x165167[_0x2178('0x28')]['mapKey']]=_0x165167['body']['from'];return db['CmContact'][_0x2178('0x4b')](_0x1f6a69);}else{throw new Error('List\x20not\x20found');}})[_0x2178('0x10')](function(_0x22b91f){_0x2730c6[_0x2178('0x4c')]=_0x22b91f;if(_0x22b91f){if(!_0x165167[_0x2178('0x28')][_0x2178('0x18')][_0x2178('0x4d')]){_0x165167[_0x2178('0x28')]['message'][_0x2178('0x4d')]=rs['generate']()+'\x20'+_0x165167['body'][_0x2178('0x18')][_0x2178('0x31')];}var _0x350ef5={'ContactId':_0x22b91f['id'],'MailAccountId':_0x165167[_0x2178('0x38')]['id'],'inReplyTo':_0x165167[_0x2178('0x28')]['message']['messageId'],'to':_0x165167[_0x2178('0x28')][_0x2178('0x18')][_0x2178('0x31')],'cc':_0x165167[_0x2178('0x28')]['message']['cc'],'subject':_0x165167[_0x2178('0x28')][_0x2178('0x18')]['subject'],'attach':_0x165167['body'][_0x2178('0x18')][_0x2178('0x4e')],'lastMsgAt':moment()[_0x2178('0x4f')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in','lastMsgBody':_0x165167['body'][_0x2178('0x28')]};return db[_0x2178('0x50')][_0x2178('0x25')]({'where':{'closed':![],'MailAccountId':_0x165167[_0x2178('0x38')]['id']},'include':[{'model':db[_0x2178('0x51')],'as':_0x2178('0x52'),'attributes':[_0x2178('0x4d')],'where':{'messageId':_0x165167['body'][_0x2178('0x18')][_0x2178('0x53')]}}]})[_0x2178('0x10')](function(_0x5d7991){if(_0x5d7991){return[_0x5d7991,![]];}return db[_0x2178('0x50')][_0x2178('0x4b')](_0x350ef5)[_0x2178('0x10')](function(_0xbf22f2){return[_0xbf22f2,!![]];});});}else{throw new Error(_0x2178('0x54'));}})[_0x2178('0x55')](function(_0x446caa,_0x2d1e88){if(_0x446caa){_0x2e1b35=_0x2d1e88;if(!_0x2d1e88){return _0x446caa['update']({'inReplyTo':_0x165167['body'][_0x2178('0x18')]['messageId'],'to':_0x165167[_0x2178('0x28')][_0x2178('0x18')][_0x2178('0x31')],'cc':_0x165167[_0x2178('0x28')][_0x2178('0x18')]['cc'],'subject':_0x165167['body'][_0x2178('0x18')][_0x2178('0x56')],'attach':_0x446caa[_0x2178('0x4e')]?_0x446caa[_0x2178('0x4e')]:_0x165167[_0x2178('0x28')]['message'][_0x2178('0x4e')],'substatus':null,'substatusAt':moment()[_0x2178('0x4f')](_0x2178('0x57')),'lastMsgAt':moment()['format'](_0x2178('0x57')),'lastMsgDirection':'in','lastMsgBody':_0x165167['body'][_0x2178('0x28')]});}else{return _0x446caa;}}})[_0x2178('0x10')](function(_0x26540f){_0x2730c6[_0x2178('0x58')]=_0x26540f[_0x2178('0x40')]({'plain':!![]});_0x2730c6[_0x2178('0x58')][_0x2178('0x59')]=_0x2e1b35;return db[_0x2178('0x51')]['create']({'body':_0x165167['body'][_0x2178('0x28')],'MailAccountId':_0x165167[_0x2178('0x38')]['id'],'MailInteractionId':_0x26540f['id'],'direction':'in','ContactId':_0x2730c6['contact']['id'],'messageId':_0x165167['body'][_0x2178('0x18')]['messageId'],'from':_0x165167['body'][_0x2178('0x18')][_0x2178('0x31')],'to':_0x165167[_0x2178('0x28')][_0x2178('0x18')]['to'],'cc':_0x165167[_0x2178('0x28')][_0x2178('0x18')]['cc'],'subject':_0x165167[_0x2178('0x28')][_0x2178('0x18')][_0x2178('0x56')],'attach':_0x165167[_0x2178('0x28')][_0x2178('0x18')][_0x2178('0x4e')],'Attachments':_0x165167[_0x2178('0x28')][_0x2178('0x18')]['attachments'],'originTo':_0x165167[_0x2178('0x28')][_0x2178('0x18')]['originTo'],'originCc':_0x165167[_0x2178('0x28')]['message'][_0x2178('0x5a')],'bcc':_0x165167[_0x2178('0x28')][_0x2178('0x18')]['bcc']},{'include':[{'model':db[_0x2178('0x5b')],'as':_0x2178('0x5c')}]});})['then'](function(_0x11c825){_0x2730c6[_0x2178('0x18')]=_0x11c825;if(_0x2730c6[_0x2178('0x58')][_0x2178('0x5d')]){return db['User'][_0x2178('0x25')]({'attributes':['id',_0x2178('0x5e')],'where':{'id':_0x2730c6['interaction'][_0x2178('0x5d')]}})[_0x2178('0x10')](function(_0x23d610){if(_0x23d610){_0x2730c6[_0x2178('0x41')][_0x2178('0x5f')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x23d610['name']+','+(_0x2730c6[_0x2178('0x38')]['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise('Start',_0x2178('0x60'),_0x2730c6);});}return respondWithRpcPromise('Start',_0x2178('0x60'),_0x2730c6);})[_0x2178('0x10')](function(_0x66e500){_0xa6b7d2(_0x66e500);})[_0x2178('0x1a')](function(_0x1d77e4){_0x1b31cd(_0x2ff473[_0x2178('0x16')](0x1f4,_0x1d77e4['message']));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 919400f..b140b65 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 _0x7c22=['removeListener','length','mailAccount:','./mailAccount.events','save','update','emit'];(function(_0x531666,_0x40f09a){var _0x1e3a05=function(_0x5e74d1){while(--_0x5e74d1){_0x531666['push'](_0x531666['shift']());}};_0x1e3a05(++_0x40f09a);}(_0x7c22,0x6c));var _0x27c2=function(_0x13140e,_0x414f44){_0x13140e=_0x13140e-0x0;var _0x4da2b0=_0x7c22[_0x13140e];return _0x4da2b0;};'use strict';var MailAccountEvents=require(_0x27c2('0x0'));var events=[_0x27c2('0x1'),'remove',_0x27c2('0x2')];function createListener(_0x117d29,_0x4d6d12){return function(_0x10f765){_0x4d6d12[_0x27c2('0x3')](_0x117d29,_0x10f765);};}function removeListener(_0x59004d,_0x4ce950){return function(){MailAccountEvents[_0x27c2('0x4')](_0x59004d,_0x4ce950);};}exports['register']=function(_0x28548d){for(var _0x5006bd=0x0,_0x32ec44=events[_0x27c2('0x5')];_0x5006bd<_0x32ec44;_0x5006bd++){var _0x56736f=events[_0x5006bd];var _0xb57ae1=createListener(_0x27c2('0x6')+_0x56736f,_0x28548d);MailAccountEvents['on'](_0x56736f,_0xb57ae1);}}; \ No newline at end of file +var _0xabe8=['./mailAccount.events','save','remove','emit','removeListener','register','mailAccount:'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xabe8,0x8c));var _0x8abe=function(_0x142e9c,_0x1c3a9c){_0x142e9c=_0x142e9c-0x0;var _0x88608b=_0xabe8[_0x142e9c];return _0x88608b;};'use strict';var MailAccountEvents=require(_0x8abe('0x0'));var events=[_0x8abe('0x1'),_0x8abe('0x2'),'update'];function createListener(_0x813df4,_0x322fd9){return function(_0x4985b4){_0x322fd9[_0x8abe('0x3')](_0x813df4,_0x4985b4);};}function removeListener(_0x512339,_0x43d155){return function(){MailAccountEvents[_0x8abe('0x4')](_0x512339,_0x43d155);};}exports[_0x8abe('0x5')]=function(_0x3a24e6){for(var _0x7619bb=0x0,_0x4e49d7=events['length'];_0x7619bb<_0x4e49d7;_0x7619bb++){var _0x27ebd9=events[_0x7619bb];var _0xd686ac=createListener(_0x8abe('0x6')+_0x27ebd9,_0x3a24e6);MailAccountEvents['on'](_0x27ebd9,_0xd686ac);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 79d8d84..108af9c 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 _0x0102=['isAuthenticated','show','update','delete','destroy','exports','util','path','connect-timeout','express','get','/:id'];(function(_0x30f307,_0x4ba377){var _0x3fe792=function(_0x565000){while(--_0x565000){_0x30f307['push'](_0x30f307['shift']());}};_0x3fe792(++_0x4ba377);}(_0x0102,0x186));var _0x2010=function(_0x92670d,_0x57644c){_0x92670d=_0x92670d-0x0;var _0x1ba423=_0x0102[_0x92670d];return _0x1ba423;};'use strict';var multer=require('multer');var util=require(_0x2010('0x0'));var path=require(_0x2010('0x1'));var timeout=require(_0x2010('0x2'));var express=require(_0x2010('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('./mailApplication.controller');router[_0x2010('0x4')](_0x2010('0x5'),auth[_0x2010('0x6')](),controller[_0x2010('0x7')]);router['put'](_0x2010('0x5'),auth['isAuthenticated'](),controller[_0x2010('0x8')]);router[_0x2010('0x9')]('/:id',auth[_0x2010('0x6')](),controller[_0x2010('0xa')]);module[_0x2010('0xb')]=router; \ No newline at end of file +var _0x3f8c=['/:id','isAuthenticated','show','put','delete','destroy','exports','path','connect-timeout','express','Router'];(function(_0x2ac5de,_0x2cebca){var _0x1415b2=function(_0x11e3e9){while(--_0x11e3e9){_0x2ac5de['push'](_0x2ac5de['shift']());}};_0x1415b2(++_0x2cebca);}(_0x3f8c,0x104));var _0xc3f8=function(_0x1a17dc,_0x453f0e){_0x1a17dc=_0x1a17dc-0x0;var _0x4a8585=_0x3f8c[_0x1a17dc];return _0x4a8585;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xc3f8('0x0'));var timeout=require(_0xc3f8('0x1'));var express=require(_0xc3f8('0x2'));var router=express[_0xc3f8('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./mailApplication.controller');router['get'](_0xc3f8('0x4'),auth[_0xc3f8('0x5')](),controller[_0xc3f8('0x6')]);router[_0xc3f8('0x7')](_0xc3f8('0x4'),auth[_0xc3f8('0x5')](),controller['update']);router[_0xc3f8('0x8')](_0xc3f8('0x4'),auth[_0xc3f8('0x5')](),controller[_0xc3f8('0x9')]);module[_0xc3f8('0xa')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index f4cb681..62833e0 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 _0xc31d=['INTEGER','TEXT','STRING','*,*,*,*','sequelize','exports'];(function(_0x58ceb9,_0x5601df){var _0x3d0ff5=function(_0x3a79d0){while(--_0x3a79d0){_0x58ceb9['push'](_0x58ceb9['shift']());}};_0x3d0ff5(++_0x5601df);}(_0xc31d,0x18a));var _0xdc31=function(_0x424357,_0x9ebe3e){_0x424357=_0x424357-0x0;var _0x29c68e=_0xc31d[_0x424357];return _0x29c68e;};'use strict';var Sequelize=require(_0xdc31('0x0'));module[_0xdc31('0x1')]={'priority':{'type':Sequelize[_0xdc31('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xdc31('0x3')]()},'description':{'type':Sequelize[_0xdc31('0x4')]},'interval':{'type':Sequelize[_0xdc31('0x4')],'defaultValue':_0xdc31('0x5')}}; \ No newline at end of file +var _0x054d=['*,*,*,*','sequelize','exports','INTEGER','STRING','noop','TEXT'];(function(_0xd22d95,_0xc59f8f){var _0x15d7a3=function(_0x3db95c){while(--_0x3db95c){_0xd22d95['push'](_0xd22d95['shift']());}};_0x15d7a3(++_0xc59f8f);}(_0x054d,0x71));var _0xd054=function(_0x44971d,_0xabeabf){_0x44971d=_0x44971d-0x0;var _0x1e1924=_0x054d[_0x44971d];return _0x1e1924;};'use strict';var Sequelize=require(_0xd054('0x0'));module[_0xd054('0x1')]={'priority':{'type':Sequelize[_0xd054('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xd054('0x3')],'allowNull':![],'defaultValue':_0xd054('0x4')},'appdata':{'type':Sequelize[_0xd054('0x5')]()},'description':{'type':Sequelize[_0xd054('0x3')]},'interval':{'type':Sequelize[_0xd054('0x3')],'defaultValue':_0xd054('0x6')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index b0e6fab..16ae328 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 _0x683c=['includeAll','find','body','catch','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','end','status','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','sendStatus','error','name','send','show','params','model','keys','MailApplication','rawAttributes','query','filters','intersection','attributes','fields','length'];(function(_0x5608a3,_0x5b33c5){var _0x1ed50a=function(_0x959171){while(--_0x959171){_0x5608a3['push'](_0x5608a3['shift']());}};_0x1ed50a(++_0x5b33c5);}(_0x683c,0xac));var _0xc683=function(_0x53eb93,_0x2ef2c2){_0x53eb93=_0x53eb93-0x0;var _0x79e083=_0x683c[_0x53eb93];return _0x79e083;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xc683('0x0'));var zipdir=require(_0xc683('0x1'));var jsonpatch=require(_0xc683('0x2'));var rp=require(_0xc683('0x3'));var moment=require(_0xc683('0x4'));var BPromise=require(_0xc683('0x5'));var Mustache=require('mustache');var util=require(_0xc683('0x6'));var path=require(_0xc683('0x7'));var sox=require(_0xc683('0x8'));var csv=require(_0xc683('0x9'));var ejs=require(_0xc683('0xa'));var fs=require('fs');var _=require(_0xc683('0xb'));var squel=require('squel');var crypto=require(_0xc683('0xc'));var jsforce=require(_0xc683('0xd'));var deskjs=require(_0xc683('0xe'));var toCsv=require(_0xc683('0x9'));var querystring=require(_0xc683('0xf'));var Papa=require(_0xc683('0x10'));var Redis=require(_0xc683('0x11'));var authService=require(_0xc683('0x12'));var qs=require(_0xc683('0x13'));var as=require(_0xc683('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc683('0x15'))(_0xc683('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x10d6a0,_0x40dec7){_0x40dec7=_0x40dec7||0xcc;return function(_0x287430){if(_0x287430){return _0x10d6a0['sendStatus'](_0x40dec7);}return _0x10d6a0['status'](_0x40dec7)[_0xc683('0x17')]();};}function respondWithResult(_0x575a6a,_0x5aab62){_0x5aab62=_0x5aab62||0xc8;return function(_0x272938){if(_0x272938){return _0x575a6a[_0xc683('0x18')](_0x5aab62)[_0xc683('0x19')](_0x272938);}};}function respondWithFilteredResult(_0x551af4,_0x475a58){return function(_0x1fb8bf){if(_0x1fb8bf){var _0x3c6f25=_0x1fb8bf[_0xc683('0x1a')],_0x40f088=_0x475a58['offset'],_0x53c208=_0x475a58[_0xc683('0x1b')]+_0x475a58[_0xc683('0x1c')],_0x378bcb;if(_0x53c208>=_0x3c6f25){_0x53c208=_0x3c6f25;_0x378bcb=0xc8;}else{_0x378bcb=0xce;}_0x551af4[_0xc683('0x18')](_0x378bcb);return _0x551af4[_0xc683('0x1d')](_0xc683('0x1e'),_0x40f088+'-'+_0x53c208+'/'+_0x3c6f25)[_0xc683('0x19')](_0x1fb8bf);}return null;};}function patchUpdates(_0x3c3195){return function(_0x226be5){try{jsonpatch[_0xc683('0x1f')](_0x226be5,_0x3c3195,!![]);}catch(_0x41188c){return BPromise['reject'](_0x41188c);}return _0x226be5[_0xc683('0x20')]();};}function saveUpdates(_0x186a12,_0x1d1853){return function(_0x18601c){if(_0x18601c){return _0x18601c[_0xc683('0x21')](_0x186a12)[_0xc683('0x22')](function(_0x53252d){return _0x53252d;});}return null;};}function removeEntity(_0x183e1a,_0x59b4a1){return function(_0x51f84a){if(_0x51f84a){return _0x51f84a[_0xc683('0x23')]()[_0xc683('0x22')](function(){_0x183e1a[_0xc683('0x18')](0xcc)[_0xc683('0x17')]();});}};}function handleEntityNotFound(_0x2e4eba,_0x3c7c6e){return function(_0x16420b){if(!_0x16420b){_0x2e4eba[_0xc683('0x24')](0x194);}return _0x16420b;};}function handleError(_0x4f99f2,_0x4254e3){_0x4254e3=_0x4254e3||0x1f4;return function(_0x4b1f74){logger[_0xc683('0x25')](_0x4b1f74['stack']);if(_0x4b1f74[_0xc683('0x26')]){delete _0x4b1f74['name'];}_0x4f99f2['status'](_0x4254e3)[_0xc683('0x27')](_0x4b1f74);};}exports[_0xc683('0x28')]=function(_0x5a98d1,_0x5ad7c7){var _0x586537={'raw':!![],'where':{'id':_0x5a98d1[_0xc683('0x29')]['id']}},_0x33792a={};_0x33792a[_0xc683('0x2a')]=_[_0xc683('0x2b')](db[_0xc683('0x2c')][_0xc683('0x2d')]);_0x33792a[_0xc683('0x2e')]=_[_0xc683('0x2b')](_0x5a98d1[_0xc683('0x2e')]);_0x33792a[_0xc683('0x2f')]=_[_0xc683('0x30')](_0x33792a[_0xc683('0x2a')],_0x33792a[_0xc683('0x2e')]);_0x586537[_0xc683('0x31')]=_[_0xc683('0x30')](_0x33792a[_0xc683('0x2a')],qs[_0xc683('0x32')](_0x5a98d1['query'][_0xc683('0x32')]));_0x586537[_0xc683('0x31')]=_0x586537['attributes'][_0xc683('0x33')]?_0x586537[_0xc683('0x31')]:_0x33792a[_0xc683('0x2a')];if(_0x5a98d1['query'][_0xc683('0x34')]){_0x586537['include']=[{'all':!![]}];}_0x586537=_['merge']({},_0x586537,_0x5a98d1['options']);return db['MailApplication'][_0xc683('0x35')](_0x586537)[_0xc683('0x22')](handleEntityNotFound(_0x5ad7c7,null))['then'](respondWithResult(_0x5ad7c7,null))['catch'](handleError(_0x5ad7c7,null));};exports[_0xc683('0x21')]=function(_0x47f705,_0x4c3ed5){if(_0x47f705[_0xc683('0x36')]['id']){delete _0x47f705[_0xc683('0x36')]['id'];}return db[_0xc683('0x2c')][_0xc683('0x35')]({'where':{'id':_0x47f705['params']['id']}})['then'](handleEntityNotFound(_0x4c3ed5,null))['then'](saveUpdates(_0x47f705[_0xc683('0x36')],null))[_0xc683('0x22')](respondWithResult(_0x4c3ed5,null))['catch'](handleError(_0x4c3ed5,null));};exports[_0xc683('0x23')]=function(_0x28ac34,_0xf8b91e){return db[_0xc683('0x2c')][_0xc683('0x35')]({'where':{'id':_0x28ac34[_0xc683('0x29')]['id']}})[_0xc683('0x22')](handleEntityNotFound(_0xf8b91e,null))[_0xc683('0x22')](removeEntity(_0xf8b91e,null))[_0xc683('0x37')](handleError(_0xf8b91e,null));}; \ No newline at end of file +var _0x285f=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','stack','name','send','params','model','keys','MailApplication','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','merge','options','find','catch','body','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring'];(function(_0x2246cd,_0x466a23){var _0x46e8a1=function(_0x501fea){while(--_0x501fea){_0x2246cd['push'](_0x2246cd['shift']());}};_0x46e8a1(++_0x466a23);}(_0x285f,0x18d));var _0xf285=function(_0x58bdc8,_0x141b0f){_0x58bdc8=_0x58bdc8-0x0;var _0x4d4506=_0x285f[_0x58bdc8];return _0x4d4506;};'use strict';var pdf=require(_0xf285('0x0'));var emlformat=require(_0xf285('0x1'));var rimraf=require(_0xf285('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf285('0x3'));var rp=require(_0xf285('0x4'));var moment=require(_0xf285('0x5'));var BPromise=require(_0xf285('0x6'));var Mustache=require(_0xf285('0x7'));var util=require(_0xf285('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0xf285('0x9'));var ejs=require(_0xf285('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xf285('0xb'));var crypto=require(_0xf285('0xc'));var jsforce=require(_0xf285('0xd'));var deskjs=require(_0xf285('0xe'));var toCsv=require('to-csv');var querystring=require(_0xf285('0xf'));var Papa=require(_0xf285('0x10'));var Redis=require(_0xf285('0x11'));var authService=require(_0xf285('0x12'));var qs=require(_0xf285('0x13'));var as=require(_0xf285('0x14'));var hardwareService=require(_0xf285('0x15'));var logger=require('../../config/logger')(_0xf285('0x16'));var utils=require('../../config/utils');var config=require(_0xf285('0x17'));var db=require(_0xf285('0x18'))['db'];function respondWithStatusCode(_0x5621f5,_0x530ff2){_0x530ff2=_0x530ff2||0xcc;return function(_0x50f625){if(_0x50f625){return _0x5621f5[_0xf285('0x19')](_0x530ff2);}return _0x5621f5['status'](_0x530ff2)[_0xf285('0x1a')]();};}function respondWithResult(_0x556f58,_0x43e201){_0x43e201=_0x43e201||0xc8;return function(_0xcfea45){if(_0xcfea45){return _0x556f58[_0xf285('0x1b')](_0x43e201)[_0xf285('0x1c')](_0xcfea45);}};}function respondWithFilteredResult(_0x23b997,_0x1d1342){return function(_0x55c1b4){if(_0x55c1b4){var _0x38cfb9=_0x55c1b4[_0xf285('0x1d')],_0x247aad=_0x1d1342[_0xf285('0x1e')],_0x3d7b0d=_0x1d1342[_0xf285('0x1e')]+_0x1d1342[_0xf285('0x1f')],_0x1bcc15;if(_0x3d7b0d>=_0x38cfb9){_0x3d7b0d=_0x38cfb9;_0x1bcc15=0xc8;}else{_0x1bcc15=0xce;}_0x23b997[_0xf285('0x1b')](_0x1bcc15);return _0x23b997[_0xf285('0x20')](_0xf285('0x21'),_0x247aad+'-'+_0x3d7b0d+'/'+_0x38cfb9)[_0xf285('0x1c')](_0x55c1b4);}return null;};}function patchUpdates(_0x2ab8d2){return function(_0x1097ce){try{jsonpatch[_0xf285('0x22')](_0x1097ce,_0x2ab8d2,!![]);}catch(_0x3d5cad){return BPromise['reject'](_0x3d5cad);}return _0x1097ce[_0xf285('0x23')]();};}function saveUpdates(_0x2e6b76,_0xa94242){return function(_0x513708){if(_0x513708){return _0x513708[_0xf285('0x24')](_0x2e6b76)[_0xf285('0x25')](function(_0x4835e4){return _0x4835e4;});}return null;};}function removeEntity(_0x54fd42,_0x5f0a5a){return function(_0x547d8d){if(_0x547d8d){return _0x547d8d[_0xf285('0x26')]()[_0xf285('0x25')](function(){_0x54fd42[_0xf285('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2b43bb,_0x40dcc8){return function(_0x39acb){if(!_0x39acb){_0x2b43bb[_0xf285('0x19')](0x194);}return _0x39acb;};}function handleError(_0x27ab33,_0x4196a8){_0x4196a8=_0x4196a8||0x1f4;return function(_0x1c063b){logger['error'](_0x1c063b[_0xf285('0x27')]);if(_0x1c063b[_0xf285('0x28')]){delete _0x1c063b[_0xf285('0x28')];}_0x27ab33[_0xf285('0x1b')](_0x4196a8)[_0xf285('0x29')](_0x1c063b);};}exports['show']=function(_0x1b73eb,_0x15f7bd){var _0x4977d1={'raw':!![],'where':{'id':_0x1b73eb[_0xf285('0x2a')]['id']}},_0x42c451={};_0x42c451[_0xf285('0x2b')]=_[_0xf285('0x2c')](db[_0xf285('0x2d')][_0xf285('0x2e')]);_0x42c451[_0xf285('0x2f')]=_[_0xf285('0x2c')](_0x1b73eb[_0xf285('0x2f')]);_0x42c451[_0xf285('0x30')]=_[_0xf285('0x31')](_0x42c451['model'],_0x42c451[_0xf285('0x2f')]);_0x4977d1[_0xf285('0x32')]=_[_0xf285('0x31')](_0x42c451[_0xf285('0x2b')],qs['fields'](_0x1b73eb[_0xf285('0x2f')][_0xf285('0x33')]));_0x4977d1['attributes']=_0x4977d1[_0xf285('0x32')][_0xf285('0x34')]?_0x4977d1[_0xf285('0x32')]:_0x42c451[_0xf285('0x2b')];if(_0x1b73eb['query'][_0xf285('0x35')]){_0x4977d1['include']=[{'all':!![]}];}_0x4977d1=_[_0xf285('0x36')]({},_0x4977d1,_0x1b73eb[_0xf285('0x37')]);return db[_0xf285('0x2d')][_0xf285('0x38')](_0x4977d1)[_0xf285('0x25')](handleEntityNotFound(_0x15f7bd,null))[_0xf285('0x25')](respondWithResult(_0x15f7bd,null))[_0xf285('0x39')](handleError(_0x15f7bd,null));};exports[_0xf285('0x24')]=function(_0x211b56,_0x24e092){if(_0x211b56['body']['id']){delete _0x211b56[_0xf285('0x3a')]['id'];}return db[_0xf285('0x2d')]['find']({'where':{'id':_0x211b56[_0xf285('0x2a')]['id']}})[_0xf285('0x25')](handleEntityNotFound(_0x24e092,null))['then'](saveUpdates(_0x211b56[_0xf285('0x3a')],null))[_0xf285('0x25')](respondWithResult(_0x24e092,null))[_0xf285('0x39')](handleError(_0x24e092,null));};exports[_0xf285('0x26')]=function(_0x416e5c,_0x4b5ffd){return db[_0xf285('0x2d')][_0xf285('0x38')]({'where':{'id':_0x416e5c[_0xf285('0x2a')]['id']}})[_0xf285('0x25')](handleEntityNotFound(_0x4b5ffd,null))[_0xf285('0x25')](removeEntity(_0x4b5ffd,null))['catch'](handleError(_0x4b5ffd,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index 5aa7c9b..ac19d39 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 _0x2ff5=['utf8mb4_unicode_ci','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','MailApplication','mail_applications','utf8mb4'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0x2ff5,0x1d5));var _0x52ff=function(_0x35b699,_0x4508f4){_0x35b699=_0x35b699-0x0;var _0x38243d=_0x2ff5[_0x35b699];return _0x38243d;};'use strict';var _=require('lodash');var util=require(_0x52ff('0x0'));var logger=require(_0x52ff('0x1'))('api');var moment=require(_0x52ff('0x2'));var BPromise=require(_0x52ff('0x3'));var rp=require(_0x52ff('0x4'));var fs=require('fs');var path=require(_0x52ff('0x5'));var rimraf=require(_0x52ff('0x6'));var config=require(_0x52ff('0x7'));var attributes=require('./mailApplication.attributes');module[_0x52ff('0x8')]=function(_0x285f60,_0x26906c){return _0x285f60['define'](_0x52ff('0x9'),attributes,{'tableName':_0x52ff('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x52ff('0xb'),'collate':_0x52ff('0xc')});}; \ No newline at end of file +var _0x1921=['utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailApplication.attributes','exports','MailApplication','mail_applications'];(function(_0x1d8dc9,_0x33811f){var _0x1e0fa7=function(_0x4291e2){while(--_0x4291e2){_0x1d8dc9['push'](_0x1d8dc9['shift']());}};_0x1e0fa7(++_0x33811f);}(_0x1921,0xf2));var _0x1192=function(_0x4da681,_0x5d0b77){_0x4da681=_0x4da681-0x0;var _0x571bcd=_0x1921[_0x4da681];return _0x571bcd;};'use strict';var _=require(_0x1192('0x0'));var util=require('util');var logger=require(_0x1192('0x1'))(_0x1192('0x2'));var moment=require(_0x1192('0x3'));var BPromise=require(_0x1192('0x4'));var rp=require(_0x1192('0x5'));var fs=require('fs');var path=require(_0x1192('0x6'));var rimraf=require(_0x1192('0x7'));var config=require(_0x1192('0x8'));var attributes=require(_0x1192('0x9'));module[_0x1192('0xa')]=function(_0x56cb6f,_0x5be2d2){return _0x56cb6f['define'](_0x1192('0xb'),attributes,{'tableName':_0x1192('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x1192('0xd'),'collate':_0x1192('0xe')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index ca004f6..cae6ed8 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 _0x8098=['error','code','message','result','catch','UpdateMailApplication','MailApplication','update','body','options','raw','where','attributes','limit','info','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client','request','then','MailApplication,\x20%s,\x20%s','MailApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x2bda14,_0x4fab1b){var _0xb5dd49=function(_0x1da71e){while(--_0x1da71e){_0x2bda14['push'](_0x2bda14['shift']());}};_0xb5dd49(++_0x4fab1b);}(_0x8098,0x70));var _0x8809=function(_0x3be468,_0x20280a){_0x3be468=_0x3be468-0x0;var _0x467807=_0x8098[_0x3be468];return _0x467807;};'use strict';var _=require(_0x8809('0x0'));var util=require(_0x8809('0x1'));var moment=require(_0x8809('0x2'));var BPromise=require(_0x8809('0x3'));var rs=require(_0x8809('0x4'));var fs=require('fs');var Redis=require(_0x8809('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x8809('0x6'));var logger=require(_0x8809('0x7'))('rpc');var config=require(_0x8809('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x8809('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x97ef81,_0x17809b,_0x10eea4){return new BPromise(function(_0x672d08,_0x2a7ad6){return client[_0x8809('0xa')](_0x97ef81,_0x10eea4)[_0x8809('0xb')](function(_0x1b3604){logger['info'](_0x8809('0xc'),_0x17809b,'request\x20sent');logger['debug'](_0x8809('0xd'),_0x17809b,_0x8809('0xe'),JSON[_0x8809('0xf')](_0x1b3604));if(_0x1b3604[_0x8809('0x10')]){if(_0x1b3604[_0x8809('0x10')][_0x8809('0x11')]===0x1f4){logger[_0x8809('0x10')](_0x8809('0xc'),_0x17809b,_0x1b3604['error'][_0x8809('0x12')]);return _0x2a7ad6(_0x1b3604['error'][_0x8809('0x12')]);}logger[_0x8809('0x10')]('MailApplication,\x20%s,\x20%s',_0x17809b,_0x1b3604[_0x8809('0x10')][_0x8809('0x12')]);return _0x672d08(_0x1b3604[_0x8809('0x10')]['message']);}else{logger['info'](_0x8809('0xc'),_0x17809b,_0x8809('0xe'));_0x672d08(_0x1b3604[_0x8809('0x13')][_0x8809('0x12')]);}})[_0x8809('0x14')](function(_0x2fd70a){logger[_0x8809('0x10')](_0x8809('0xc'),_0x17809b,_0x2fd70a);_0x2a7ad6(_0x2fd70a);});});}exports[_0x8809('0x15')]=function(_0x58e68a){var _0x50bc8e=this;return new Promise(function(_0x91d09,_0x64491){return db[_0x8809('0x16')][_0x8809('0x17')](_0x58e68a[_0x8809('0x18')],{'raw':_0x58e68a[_0x8809('0x19')]?_0x58e68a['options'][_0x8809('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x58e68a['options']?_0x58e68a['options'][_0x8809('0x1b')]||null:null,'attributes':_0x58e68a[_0x8809('0x19')]?_0x58e68a[_0x8809('0x19')][_0x8809('0x1c')]||null:null,'limit':_0x58e68a[_0x8809('0x19')]?_0x58e68a[_0x8809('0x19')][_0x8809('0x1d')]||null:null})[_0x8809('0xb')](function(_0x13b72a){logger[_0x8809('0x1e')](_0x8809('0x15'),_0x58e68a);logger[_0x8809('0x1f')](_0x8809('0x15'),_0x58e68a,JSON['stringify'](_0x13b72a));_0x91d09(_0x13b72a);})[_0x8809('0x14')](function(_0x12a6d3){logger[_0x8809('0x10')](_0x8809('0x15'),_0x12a6d3[_0x8809('0x12')],_0x58e68a);_0x64491(_0x50bc8e[_0x8809('0x10')](0x1f4,_0x12a6d3['message']));});});}; \ No newline at end of file +var _0xd455=['update','body','options','raw','where','limit','UpdateMailApplication','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','MailApplication,\x20%s,\x20%s','debug','MailApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','MailApplication'];(function(_0xaa367e,_0x14d57c){var _0x21ae43=function(_0x2679e3){while(--_0x2679e3){_0xaa367e['push'](_0xaa367e['shift']());}};_0x21ae43(++_0x14d57c);}(_0xd455,0x1b5));var _0x5d45=function(_0x21b4bd,_0xfd5c97){_0x21b4bd=_0x21b4bd-0x0;var _0x4fcff0=_0xd455[_0x21b4bd];return _0x4fcff0;};'use strict';var _=require('lodash');var util=require(_0x5d45('0x0'));var moment=require(_0x5d45('0x1'));var BPromise=require(_0x5d45('0x2'));var rs=require(_0x5d45('0x3'));var fs=require('fs');var Redis=require(_0x5d45('0x4'));var db=require(_0x5d45('0x5'))['db'];var utils=require(_0x5d45('0x6'));var logger=require(_0x5d45('0x7'))('rpc');var config=require(_0x5d45('0x8'));var jayson=require(_0x5d45('0x9'));var client=jayson[_0x5d45('0xa')][_0x5d45('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x18a5b4,_0x113c41,_0x2e7b5a){return new BPromise(function(_0x32ce27,_0x2df818){return client[_0x5d45('0xc')](_0x18a5b4,_0x2e7b5a)[_0x5d45('0xd')](function(_0x21dcf7){logger['info'](_0x5d45('0xe'),_0x113c41,'request\x20sent');logger[_0x5d45('0xf')](_0x5d45('0x10'),_0x113c41,_0x5d45('0x11'),JSON[_0x5d45('0x12')](_0x21dcf7));if(_0x21dcf7[_0x5d45('0x13')]){if(_0x21dcf7[_0x5d45('0x13')][_0x5d45('0x14')]===0x1f4){logger[_0x5d45('0x13')]('MailApplication,\x20%s,\x20%s',_0x113c41,_0x21dcf7[_0x5d45('0x13')][_0x5d45('0x15')]);return _0x2df818(_0x21dcf7[_0x5d45('0x13')][_0x5d45('0x15')]);}logger['error'](_0x5d45('0xe'),_0x113c41,_0x21dcf7[_0x5d45('0x13')][_0x5d45('0x15')]);return _0x32ce27(_0x21dcf7[_0x5d45('0x13')][_0x5d45('0x15')]);}else{logger[_0x5d45('0x16')]('MailApplication,\x20%s,\x20%s',_0x113c41,_0x5d45('0x11'));_0x32ce27(_0x21dcf7[_0x5d45('0x17')]['message']);}})['catch'](function(_0x52ec37){logger[_0x5d45('0x13')](_0x5d45('0xe'),_0x113c41,_0x52ec37);_0x2df818(_0x52ec37);});});}exports['UpdateMailApplication']=function(_0x20fe4c){var _0x1722d8=this;return new Promise(function(_0x1b4a00,_0x31c0a5){return db[_0x5d45('0x18')][_0x5d45('0x19')](_0x20fe4c[_0x5d45('0x1a')],{'raw':_0x20fe4c['options']?_0x20fe4c[_0x5d45('0x1b')][_0x5d45('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x20fe4c[_0x5d45('0x1b')]?_0x20fe4c[_0x5d45('0x1b')][_0x5d45('0x1d')]||null:null,'attributes':_0x20fe4c[_0x5d45('0x1b')]?_0x20fe4c[_0x5d45('0x1b')]['attributes']||null:null,'limit':_0x20fe4c['options']?_0x20fe4c['options'][_0x5d45('0x1e')]||null:null})[_0x5d45('0xd')](function(_0x581112){logger[_0x5d45('0x16')](_0x5d45('0x1f'),_0x20fe4c);logger[_0x5d45('0xf')](_0x5d45('0x1f'),_0x20fe4c,JSON[_0x5d45('0x12')](_0x581112));_0x1b4a00(_0x581112);})[_0x5d45('0x20')](function(_0x222050){logger[_0x5d45('0x13')](_0x5d45('0x1f'),_0x222050[_0x5d45('0x15')],_0x20fe4c);_0x31c0a5(_0x1722d8[_0x5d45('0x13')](0x1f4,_0x222050[_0x5d45('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index aff2647..e8c56c7 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 _0x24ca=['/:id/tags','tracked','mail','addTags','mailinteraction:update','update','delete','mailinteraction:destroy','destroy','exports','multer','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','get','isAuthenticated','describe','/:id','show','/:id/messages','getMessages','download','post','create'];(function(_0x42c750,_0x41dcdc){var _0x319429=function(_0x43a70a){while(--_0x43a70a){_0x42c750['push'](_0x42c750['shift']());}};_0x319429(++_0x41dcdc);}(_0x24ca,0x8c));var _0xa24c=function(_0x5b3950,_0x4e5556){_0x5b3950=_0x5b3950-0x0;var _0x41e436=_0x24ca[_0x5b3950];return _0x41e436;};'use strict';var multer=require(_0xa24c('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xa24c('0x1'));var express=require('express');var router=express[_0xa24c('0x2')]();var auth=require(_0xa24c('0x3'));var interaction=require(_0xa24c('0x4'));var config=require('../../config/environment');var controller=require(_0xa24c('0x5'));router[_0xa24c('0x6')]('/',auth[_0xa24c('0x7')](),controller['index']);router['get']('/describe',auth[_0xa24c('0x7')](),controller[_0xa24c('0x8')]);router[_0xa24c('0x6')](_0xa24c('0x9'),auth[_0xa24c('0x7')](),controller[_0xa24c('0xa')]);router['get'](_0xa24c('0xb'),auth[_0xa24c('0x7')](),controller[_0xa24c('0xc')]);router['get']('/:id/download',auth[_0xa24c('0x7')](),controller[_0xa24c('0xd')]);router[_0xa24c('0xe')]('/',auth[_0xa24c('0x7')](),controller[_0xa24c('0xf')]);router[_0xa24c('0xe')]('/:id/messages',auth['isAuthenticated'](),controller['addMessage']);router[_0xa24c('0xe')](_0xa24c('0x10'),auth[_0xa24c('0x7')](),interaction[_0xa24c('0x11')](_0xa24c('0x12'),'mailinteraction:addtags'),controller[_0xa24c('0x13')]);router['put']('/:id',auth['isAuthenticated'](),interaction[_0xa24c('0x11')](_0xa24c('0x12'),_0xa24c('0x14')),controller[_0xa24c('0x15')]);router[_0xa24c('0x16')](_0xa24c('0x9'),auth[_0xa24c('0x7')](),interaction[_0xa24c('0x11')](_0xa24c('0x12'),_0xa24c('0x17')),controller[_0xa24c('0x18')]);router[_0xa24c('0x16')](_0xa24c('0x10'),auth[_0xa24c('0x7')](),controller['removeTags']);module[_0xa24c('0x19')]=router; \ No newline at end of file +var _0x004c=['mail','mailinteraction:addtags','addTags','put','mailinteraction:update','update','delete','mailinteraction:destroy','destroy','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','describe','/:id','isAuthenticated','/:id/messages','getMessages','/:id/download','download','post','addMessage','/:id/tags','tracked'];(function(_0x550d12,_0x5384bd){var _0x12103d=function(_0x2a9834){while(--_0x2a9834){_0x550d12['push'](_0x550d12['shift']());}};_0x12103d(++_0x5384bd);}(_0x004c,0x85));var _0xc004=function(_0x29d915,_0x54a040){_0x29d915=_0x29d915-0x0;var _0x160f86=_0x004c[_0x29d915];return _0x160f86;};'use strict';var multer=require(_0xc004('0x0'));var util=require(_0xc004('0x1'));var path=require(_0xc004('0x2'));var timeout=require(_0xc004('0x3'));var express=require('express');var router=express[_0xc004('0x4')]();var auth=require(_0xc004('0x5'));var interaction=require(_0xc004('0x6'));var config=require(_0xc004('0x7'));var controller=require('./mailInteraction.controller');router[_0xc004('0x8')]('/',auth['isAuthenticated'](),controller[_0xc004('0x9')]);router[_0xc004('0x8')](_0xc004('0xa'),auth['isAuthenticated'](),controller[_0xc004('0xb')]);router[_0xc004('0x8')](_0xc004('0xc'),auth[_0xc004('0xd')](),controller['show']);router[_0xc004('0x8')](_0xc004('0xe'),auth[_0xc004('0xd')](),controller[_0xc004('0xf')]);router[_0xc004('0x8')](_0xc004('0x10'),auth[_0xc004('0xd')](),controller[_0xc004('0x11')]);router[_0xc004('0x12')]('/',auth[_0xc004('0xd')](),controller['create']);router[_0xc004('0x12')](_0xc004('0xe'),auth[_0xc004('0xd')](),controller[_0xc004('0x13')]);router[_0xc004('0x12')](_0xc004('0x14'),auth[_0xc004('0xd')](),interaction[_0xc004('0x15')](_0xc004('0x16'),_0xc004('0x17')),controller[_0xc004('0x18')]);router[_0xc004('0x19')](_0xc004('0xc'),auth[_0xc004('0xd')](),interaction['tracked'](_0xc004('0x16'),_0xc004('0x1a')),controller[_0xc004('0x1b')]);router[_0xc004('0x1c')](_0xc004('0xc'),auth['isAuthenticated'](),interaction[_0xc004('0x15')](_0xc004('0x16'),_0xc004('0x1d')),controller[_0xc004('0x1e')]);router[_0xc004('0x1c')](_0xc004('0x14'),auth[_0xc004('0xd')](),controller['removeTags']);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index 6cb5d80..a0deebb 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 _0x7c78=['BOOLEAN','DATE','STRING','TEXT','long','out','sequelize','exports'];(function(_0xe97c99,_0x138258){var _0x18fbb3=function(_0x4e98e0){while(--_0x4e98e0){_0xe97c99['push'](_0xe97c99['shift']());}};_0x18fbb3(++_0x138258);}(_0x7c78,0x13e));var _0x87c7=function(_0x2ceb96,_0x16d3ff){_0x2ceb96=_0x2ceb96-0x0;var _0x3582ca=_0x7c78[_0x2ceb96];return _0x3582ca;};'use strict';var Sequelize=require(_0x87c7('0x0'));var iconv=require('iconv');module[_0x87c7('0x1')]={'closed':{'type':Sequelize[_0x87c7('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x87c7('0x3')]},'disposition':{'type':Sequelize[_0x87c7('0x4')]},'note':{'type':Sequelize[_0x87c7('0x4')]},'inReplyTo':{'type':Sequelize[_0x87c7('0x4')](0x1fe)},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x87c7('0x5')](_0x87c7('0x6'))},'subject':{'type':Sequelize[_0x87c7('0x5')]()},'attach':{'type':Sequelize[_0x87c7('0x2')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x87c7('0x3')]},'substatus':{'type':Sequelize[_0x87c7('0x4')](0x3c)},'substatusAt':{'type':Sequelize[_0x87c7('0x3')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x87c7('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x87c7('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgBody':{'type':Sequelize['TEXT'](_0x87c7('0x6'))},'lastMsgText':{'type':Sequelize[_0x87c7('0x5')]('long')}}; \ No newline at end of file +var _0xa89c=['TEXT','DATE','out','ENUM','sequelize','iconv','BOOLEAN','STRING','long'];(function(_0xbe826a,_0x1883ff){var _0x4cf30a=function(_0x321228){while(--_0x321228){_0xbe826a['push'](_0xbe826a['shift']());}};_0x4cf30a(++_0x1883ff);}(_0xa89c,0x15a));var _0xca89=function(_0x3e2200,_0x13a720){_0x3e2200=_0x3e2200-0x0;var _0x1fe0db=_0xa89c[_0x3e2200];return _0x1fe0db;};'use strict';var Sequelize=require(_0xca89('0x0'));var iconv=require(_0xca89('0x1'));module['exports']={'closed':{'type':Sequelize[_0xca89('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xca89('0x3')]},'note':{'type':Sequelize[_0xca89('0x3')]},'inReplyTo':{'type':Sequelize[_0xca89('0x3')](0x1fe)},'to':{'type':Sequelize[_0xca89('0x3')]},'cc':{'type':Sequelize['TEXT'](_0xca89('0x4'))},'subject':{'type':Sequelize[_0xca89('0x5')]()},'attach':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xca89('0x6')]},'substatus':{'type':Sequelize['STRING'](0x3c)},'substatusAt':{'type':Sequelize[_0xca89('0x6')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0xca89('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xca89('0x6')]},'lastMsgDirection':{'type':Sequelize[_0xca89('0x8')]('in',_0xca89('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgBody':{'type':Sequelize[_0xca89('0x5')](_0xca89('0x4'))},'lastMsgText':{'type':Sequelize[_0xca89('0x5')](_0xca89('0x4'))}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index b8b695b..5566f1d 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 _0x4024=['model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','select','field','color','from','tools_tags','u.id','ui.MailInteractionId','user_has_mail_interactions','left_join','u.id\x20=\x20ui.UserId','mail_interactions','a.id\x20=\x20i.MailAccountId','me.MailInteractionId\x20=\x20i.id','it.MailInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','unreadMessages','having','`\x20=\x200','Contact','operator','$substring','value','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','find','ContactId','buildExpression','text','start','Tag','split','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','plainBody','keys','isEmpty','MailAccountId','i.MailAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','filter','replace','\x27\x27\x27\x27','isEmail','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','t.id\x20IN\x20?','i.MailAccountId\x20IS\x20NOT\x20NULL','user','getMailAccounts','i.MailAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.createdAt','i.updatedAt','i.closed','i.closedAt','i.lastMsgAt','i.subject','i.disposition','i.to','i.ContactId','i.UserId','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','ui.MailInteractionId\x20IN\x20?','groupBy','Setting','enableEmailPreview','show','params','includeAll','include','options','body','destroy','describe','addMessage','MailMessage','ids','omit','getMessages','hasOwnProperty','MailInteractionId','format','YYYY-MM-DD\x20HH:mm:ss','findAll','rows','addTags','setTags','spread','mailInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp','transcript-%d-%s.zip','attachments','Attachment','Attachments','Messages','bcc','subject','get','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','existsSync','writeFileSync','log','err','html-pdf','eml-format','rimraf','zip-dir','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','redis','defaults','localhost','./mailInteraction.socket','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','then','error','stack','name','send','Users','map','fullname','TagIds','forEach','Tags','push','MailInteraction','findOne','lastMsgBody','lastMsgText','trimStart','fromString','catch','index','rawAttributes','fieldName','type','key'];(function(_0x3ff92d,_0x288286){var _0x2b7fd8=function(_0x349b4c){while(--_0x349b4c){_0x3ff92d['push'](_0x3ff92d['shift']());}};_0x2b7fd8(++_0x288286);}(_0x4024,0xa9));var _0x4402=function(_0x2119bf,_0x1580c8){_0x2119bf=_0x2119bf-0x0;var _0x3f049b=_0x4024[_0x2119bf];return _0x3f049b;};'use strict';var pdf=require(_0x4402('0x0'));var emlformat=require(_0x4402('0x1'));var rimraf=require(_0x4402('0x2'));var zipdir=require(_0x4402('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x4402('0x4'));var Mustache=require(_0x4402('0x5'));var util=require(_0x4402('0x6'));var path=require(_0x4402('0x7'));var sox=require(_0x4402('0x8'));var csv=require(_0x4402('0x9'));var ejs=require(_0x4402('0xa'));var fs=require('fs');var _=require(_0x4402('0xb'));var squel=require(_0x4402('0xc'));var crypto=require(_0x4402('0xd'));var jsforce=require(_0x4402('0xe'));var deskjs=require(_0x4402('0xf'));var toCsv=require(_0x4402('0x9'));var querystring=require(_0x4402('0x10'));var Papa=require(_0x4402('0x11'));var htmlToText=require('html-to-text');var Redis=require('ioredis');var authService=require(_0x4402('0x12'));var qs=require(_0x4402('0x13'));var as=require(_0x4402('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4402('0x15'))(_0x4402('0x16'));var utils=require('../../config/utils');var config=require(_0x4402('0x17'));var db=require('../../mysqldb')['db'];config[_0x4402('0x18')]=_[_0x4402('0x19')](config['redis'],{'host':_0x4402('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x4402('0x1b'))[_0x4402('0x1c')](socket);function respondWithStatusCode(_0x216fd3,_0x4f247f){_0x4f247f=_0x4f247f||0xcc;return function(_0x153506){if(_0x153506){return _0x216fd3[_0x4402('0x1d')](_0x4f247f);}return _0x216fd3[_0x4402('0x1e')](_0x4f247f)[_0x4402('0x1f')]();};}function respondWithResult(_0x2b58df,_0x1f6209){_0x1f6209=_0x1f6209||0xc8;return function(_0x36f425){if(_0x36f425){return _0x2b58df[_0x4402('0x1e')](_0x1f6209)[_0x4402('0x20')](_0x36f425);}};}function respondWithFilteredResult(_0x1e950f,_0x4c75fd){return function(_0x571f6c){if(_0x571f6c){var _0x18856f=_0x571f6c[_0x4402('0x21')],_0x34e38f=_0x4c75fd[_0x4402('0x22')],_0x106a2e=_0x4c75fd[_0x4402('0x22')]+_0x4c75fd[_0x4402('0x23')],_0xf0a307;if(_0x106a2e>=_0x18856f){_0x106a2e=_0x18856f;_0xf0a307=0xc8;}else{_0xf0a307=0xce;}_0x1e950f[_0x4402('0x1e')](_0xf0a307);return _0x1e950f[_0x4402('0x24')](_0x4402('0x25'),_0x34e38f+'-'+_0x106a2e+'/'+_0x18856f)[_0x4402('0x20')](_0x571f6c);}return null;};}function patchUpdates(_0x9a86bd){return function(_0xfe37d9){try{jsonpatch['apply'](_0xfe37d9,_0x9a86bd,!![]);}catch(_0x5b77af){return BPromise[_0x4402('0x26')](_0x5b77af);}return _0xfe37d9[_0x4402('0x27')]();};}function saveUpdates(_0x43a433,_0x300bf5){return function(_0x33819b){if(_0x33819b){return _0x33819b[_0x4402('0x28')](_0x43a433)[_0x4402('0x29')](function(_0x532a66){return _0x532a66;});}return null;};}function removeEntity(_0x52cde9,_0x15b74f){return function(_0x591bd8){if(_0x591bd8){return _0x591bd8['destroy']()[_0x4402('0x29')](function(){_0x52cde9[_0x4402('0x1e')](0xcc)[_0x4402('0x1f')]();});}};}function handleEntityNotFound(_0x3dde6a,_0x283c9b){return function(_0xef452d){if(!_0xef452d){_0x3dde6a[_0x4402('0x1d')](0x194);}return _0xef452d;};}function handleError(_0x3c87f8,_0x31c688){_0x31c688=_0x31c688||0x1f4;return function(_0x44b1){logger[_0x4402('0x2a')](_0x44b1[_0x4402('0x2b')]);if(_0x44b1[_0x4402('0x2c')]){delete _0x44b1[_0x4402('0x2c')];}_0x3c87f8[_0x4402('0x1e')](_0x31c688)[_0x4402('0x2d')](_0x44b1);};}function getInteractionUsers(_0x2930a4,_0x381ae6){return new BPromise(function(_0x18bda0,_0x4467f7){try{if(_0x381ae6[_0x2930a4['id']]){_0x2930a4[_0x4402('0x2e')]=_[_0x4402('0x2f')](_0x381ae6[_0x2930a4['id']],function(_0x75141e){return{'id':_0x75141e['id'],'fullname':_0x75141e[_0x4402('0x30')]};});}}catch(_0x50d3d4){_0x4467f7(_0x50d3d4);}_0x18bda0(_0x2930a4);});}function getInteractionTags(_0xca9ca7,_0x2abb31){return new BPromise(function(_0x4d3eef,_0x2fcdaa){try{if(_0xca9ca7[_0x4402('0x31')]){_0xca9ca7['Tags']=[];_0xca9ca7['TagIds']['split'](',')[_0x4402('0x32')](function(_0xd42df0){_0xca9ca7[_0x4402('0x33')][_0x4402('0x34')](_0x2abb31[_0xd42df0]);});}delete _0xca9ca7[_0x4402('0x31')];}catch(_0x6ea8ef){_0x2fcdaa(_0x6ea8ef);}_0x4d3eef(_0xca9ca7);});}function getLastMessageText(_0x3e476c){return new BPromise(function(_0x397172,_0x437d3e){return db[_0x4402('0x35')][_0x4402('0x36')]({'where':{'id':_0x3e476c['id']},'attributes':[_0x4402('0x37'),_0x4402('0x38')],'raw':!![]})[_0x4402('0x29')](function(_0x53892a){if(!_0x53892a[_0x4402('0x38')]){_0x3e476c[_0x4402('0x38')]=_[_0x4402('0x39')](htmlToText[_0x4402('0x3a')](_0x53892a[_0x4402('0x37')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]}));}else{_0x3e476c[_0x4402('0x38')]=_0x53892a[_0x4402('0x38')];}_0x397172(_0x3e476c);})[_0x4402('0x3b')](function(_0x30c16c){_0x437d3e(_0x30c16c);});});}function updateMailInteraction(_0x4a5a37,_0x2499b2,_0x12167f,_0x1f47ee){return new BPromise(function(_0x4f2a5b,_0x35d4b4){return getInteractionUsers(_0x4a5a37,_0x12167f)[_0x4402('0x29')](function(_0x181403){return getInteractionTags(_0x181403,_0x2499b2);})[_0x4402('0x29')](function(_0x1d8b8b){if(_0x1f47ee){_0x4f2a5b(getLastMessageText(_0x1d8b8b));}else{_0x4f2a5b(_0x1d8b8b);}})[_0x4402('0x3b')](function(_0x53eb66){_0x35d4b4(_0x53eb66);});});}exports[_0x4402('0x3c')]=function(_0x133b77,_0x1fbfbf){var _0x431875={},_0x5b25b1={},_0x3c8c42={'count':0x0,'rows':[]};var _0x282cff=_['map'](db['MailInteraction'][_0x4402('0x3d')],function(_0x389b21){return{'name':_0x389b21[_0x4402('0x3e')],'type':_0x389b21[_0x4402('0x3f')][_0x4402('0x40')]};});_0x5b25b1[_0x4402('0x41')]=_[_0x4402('0x2f')](_0x282cff,'name');_0x5b25b1[_0x4402('0x42')]=_['keys'](_0x133b77[_0x4402('0x42')]);_0x5b25b1[_0x4402('0x43')]=_[_0x4402('0x44')](_0x5b25b1[_0x4402('0x41')],_0x5b25b1['query']);_0x431875[_0x4402('0x45')]=_['intersection'](_0x5b25b1[_0x4402('0x41')],qs[_0x4402('0x46')](_0x133b77[_0x4402('0x42')][_0x4402('0x46')]));_0x431875['attributes']=_0x431875['attributes'][_0x4402('0x47')]?_0x431875['attributes']:_0x5b25b1[_0x4402('0x41')];if(!_0x133b77[_0x4402('0x42')]['hasOwnProperty'](_0x4402('0x48'))){_0x431875['limit']=qs['limit'](_0x133b77[_0x4402('0x42')][_0x4402('0x23')]);_0x431875[_0x4402('0x22')]=qs[_0x4402('0x22')](_0x133b77['query'][_0x4402('0x22')]);}_0x431875[_0x4402('0x49')]=qs[_0x4402('0x4a')](_0x133b77[_0x4402('0x42')]['sort']);_0x431875[_0x4402('0x4b')]=qs[_0x4402('0x43')](_[_0x4402('0x4c')](_0x133b77['query'],_0x5b25b1[_0x4402('0x43')]));var _0x31871b=[];var _0x365880=squel[_0x4402('0x4d')]()[_0x4402('0x4e')]('id')[_0x4402('0x4e')](_0x4402('0x2c'))[_0x4402('0x4e')](_0x4402('0x4f'))[_0x4402('0x50')](_0x4402('0x51'));var _0x499e12=squel[_0x4402('0x4d')]()['field'](_0x4402('0x52'))[_0x4402('0x4e')]('u.fullname')[_0x4402('0x4e')](_0x4402('0x53'))['from'](_0x4402('0x54'),'ui')[_0x4402('0x55')]('users','u',_0x4402('0x56'));var _0x2b6795=squel['select']()[_0x4402('0x50')](_0x4402('0x57'),'i')[_0x4402('0x55')]('cm_contacts','c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x4402('0x55')]('users','o','o.id\x20=\x20i.UserId')['left_join']('mail_accounts','a',_0x4402('0x58'))[_0x4402('0x55')]('mail_messages','me',_0x4402('0x59'))[_0x4402('0x55')]('mail_interaction_has_tags','it',_0x4402('0x5a'))[_0x4402('0x55')](_0x4402('0x51'),'t',_0x4402('0x5b'));var _0x4b53de=squel[_0x4402('0x5c')]();var _0x18b3b1=[];var _0x20cb22=squel['expr']();var _0x1439ec;if(_0x133b77[_0x4402('0x42')][_0x4402('0x5d')]){_0x1439ec=as[_0x4402('0x5e')](_0x133b77[_0x4402('0x42')][_0x4402('0x5d')]);var _0x39246d=_0x1439ec[_0x4402('0x5f')];for(var _0x3c12c6=0x0;_0x3c12c6<_0x1439ec['conditions'][_0x4402('0x47')];_0x3c12c6++){var _0xa29fca=_0x1439ec['conditions'][_0x3c12c6];var _0x1dbb9a='i';var _0x4a09b5=_['find'](_0x282cff,['name',_0xa29fca[_0x4402('0x4e')]]);if(!_0x4a09b5){switch(_0xa29fca[_0x4402('0x4e')]){case _0x4402('0x60'):if(_0xa29fca['value']==0x1){_0x2b6795[_0x4402('0x61')]('`'+_0xa29fca[_0x4402('0x4e')]+_0x4402('0x62'));}else{_0x2b6795[_0x4402('0x61')]('`'+_0xa29fca[_0x4402('0x4e')]+'`\x20>\x200');}break;case _0x4402('0x63'):if(_0xa29fca[_0x4402('0x64')]===_0x4402('0x65')){if(_0xa29fca[_0x4402('0x66')]['split']('\x20')['length']>0x1){_0x4b53de[_0x39246d](_0x4402('0x67'),qs['getFullTextValue'](_0xa29fca[_0x4402('0x66')]),null);}else{var _0x3b57fd='%'+_0xa29fca['value']+'%';_0x4b53de[_0x39246d]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x3b57fd,_0x3b57fd,_0x3b57fd);}}else{_0x4a09b5=_[_0x4402('0x68')](_0x282cff,[_0x4402('0x2c'),_0x4402('0x69')]);_0xa29fca[_0x4402('0x4e')]=_0x4402('0x69');_0x1b6ccb=as[_0x4402('0x6a')](_0x1dbb9a,_0x4a09b5['type'],_0xa29fca);_0x4b53de[_0x39246d](_0x1b6ccb[_0x4402('0x6b')],_0x1b6ccb['value'][_0x4402('0x6c')],_0x1b6ccb[_0x4402('0x66')]['end']);}break;case _0x4402('0x6d'):var _0x1da957=_0xa29fca[_0x4402('0x66')][_0x4402('0x6e')](',')[_0x4402('0x2f')](function(_0x2cbdc3){return Number(_0x2cbdc3);});_0x1da957[_0x4402('0x32')](function(_0x39f2f0){_0x20cb22['or'](_0x4402('0x6f'),'%,'+_0x39f2f0+',%');});_0x18b3b1=_[_0x4402('0x70')](_0x18b3b1,_0x1da957);break;case'User':if(_0xa29fca['operator']===_0x4402('0x65')){_0x4b53de[_0x39246d](_0x4402('0x71'),'%'+_0xa29fca[_0x4402('0x66')]+'%',null);}else{_0x4a09b5=_['find'](_0x282cff,[_0x4402('0x2c'),'UserId']);_0xa29fca['field']=_0x4402('0x72');_0x1b6ccb=as['buildExpression'](_0x1dbb9a,_0x4a09b5['type'],_0xa29fca);_0x4b53de[_0x39246d](_0x1b6ccb[_0x4402('0x6b')],_0x1b6ccb[_0x4402('0x66')][_0x4402('0x6c')],_0x1b6ccb[_0x4402('0x66')][_0x4402('0x1f')]);}break;case _0x4402('0x73'):_0x1b6ccb=as[_0x4402('0x6a')]('me',null,_0xa29fca);_0x4b53de[_0x39246d](_0x1b6ccb['text'],_0x1b6ccb[_0x4402('0x66')][_0x4402('0x6c')],_0x1b6ccb['value'][_0x4402('0x1f')]);break;}}else{var _0x1b6ccb=as[_0x4402('0x6a')](_0x1dbb9a,_0x4a09b5['type'],_0xa29fca);_0x4b53de[_0x39246d](_0x1b6ccb[_0x4402('0x6b')],_0x1b6ccb[_0x4402('0x66')][_0x4402('0x6c')],_0x1b6ccb['value']['end']);}}}else{var _0x494be2=_(_0x133b77['query'])[_0x4402('0x74')]()[_0x4402('0x2f')](function(_0x16dc83){return _['some'](_0x282cff,[_0x4402('0x2c'),_0x16dc83])?_0x16dc83:undefined;})['compact']()[_0x4402('0x66')]();if(!_[_0x4402('0x75')](_0x494be2)){_0x494be2[_0x4402('0x32')](function(_0x19c282){if(_0x19c282===_0x4402('0x76')){_0x2b6795['where'](_0x4402('0x77'),[][_0x4402('0x78')](_0x133b77['query'][_0x19c282]));}else if(_0x19c282===_0x4402('0x79')){var _0x4b4eb4=JSON[_0x4402('0x7a')](_0x133b77[_0x4402('0x42')][_0x19c282])[_0x4402('0x7b')];var _0x516fd6=JSON[_0x4402('0x7a')](_0x133b77[_0x4402('0x42')][_0x19c282])[_0x4402('0x7c')];_0x2b6795[_0x4402('0x4b')](_0x4402('0x7d'),_0x4b4eb4,_0x516fd6);}else{if(_0x133b77[_0x4402('0x42')][_0x19c282]===_0x4402('0x7e')){_0x2b6795[_0x4402('0x4b')]('i.'+_0x19c282+_0x4402('0x7f'));}else{_0x2b6795[_0x4402('0x4b')]('i.'+_0x19c282+'\x20=\x20?',_0x133b77['query'][_0x19c282]);}}});}if(_0x133b77[_0x4402('0x42')][_0x4402('0x80')]){if(_0x133b77[_0x4402('0x42')][_0x4402('0x80')]==0x1){_0x2b6795[_0x4402('0x61')](_0x4402('0x81'));}else{_0x2b6795['having'](_0x4402('0x82'));}}if(_0x133b77[_0x4402('0x42')]['tag']){_0x18b3b1=_[_0x4402('0x83')](_0x133b77[_0x4402('0x42')][_0x4402('0x84')])?_0x133b77['query'][_0x4402('0x84')]:new Array(_0x133b77[_0x4402('0x42')]['tag']);_0x18b3b1[_0x4402('0x32')](function(_0x21383a){_0x20cb22['or'](_0x4402('0x6f'),'%,'+_0x21383a+',%');});}if(_0x133b77[_0x4402('0x42')][_0x4402('0x85')]){var _0x4bb26a=_0x133b77[_0x4402('0x42')][_0x4402('0x85')][_0x4402('0x86')]('\x5c','\x5c\x5c')['replace']('\x27\x27',_0x4402('0x87'));if(qs['isNumeric'](_0x4bb26a)){_0x4b53de['or']('i.id\x20LIKE\x20?',_0x4bb26a+'%');}else if(qs[_0x4402('0x88')](_0x4bb26a)){_0x4b53de['or'](_0x4402('0x89'),_0x4bb26a+'%');}else{_0x4b53de['or'](_0x4402('0x8a'),qs['getFullTextValue'](_0x4bb26a))['or'](_0x4402('0x8b'),qs[_0x4402('0x8c')](_0x4bb26a));}}}_0x2b6795['where'](_0x4b53de);_0x2b6795[_0x4402('0x8d')](_0x4402('0x8e'));var _0x5b8cf1={'type':db[_0x4402('0x8f')][_0x4402('0x90')][_0x4402('0x91')],'raw':!![]};var _0x5c7795=_0x2b6795[_0x4402('0x92')]();_0x5c7795[_0x4402('0x4e')]('i.id');_0x5c7795[_0x4402('0x4e')](_0x4402('0x93'),'unreadMessages');if(_0x431875['order']){_0x431875['order'][_0x4402('0x32')](function(_0x47b44a){_0x2b6795['order']('i.'+_0x47b44a[0x0],_0x47b44a[0x1]===_0x4402('0x94')?![]:!![]);});}if(!_[_0x4402('0x75')](_0x18b3b1)){_0x2b6795[_0x4402('0x61')](_0x20cb22);_0x5c7795[_0x4402('0x4b')](_0x4402('0x95'),_0x18b3b1);}BPromise['resolve']()[_0x4402('0x29')](function(){if(!_0x1439ec){if(_0x133b77['query'][_0x4402('0x76')]||_0x133b77[_0x4402('0x42')]['journey'])return;_0x5c7795[_0x4402('0x4b')](_0x4402('0x96'));_0x2b6795[_0x4402('0x4b')](_0x4402('0x96'));return;}return _0x133b77[_0x4402('0x97')][_0x4402('0x98')]({'attributes':['id'],'raw':!![]})[_0x4402('0x29')](function(_0x49a0e6){if(_[_0x4402('0x75')](_0x49a0e6)){_0x5c7795[_0x4402('0x4b')]('i.MailAccountId\x20IS\x20NULL');_0x2b6795['where'](_0x4402('0x99'));}else{_0x5c7795['where'](_0x4402('0x77'),_[_0x4402('0x2f')](_0x49a0e6,'id'));_0x2b6795[_0x4402('0x4b')]('i.MailAccountId\x20IN\x20?',_[_0x4402('0x2f')](_0x49a0e6,'id'));}});})[_0x4402('0x29')](function(){db[_0x4402('0x9a')][_0x4402('0x42')](_0x5c7795[_0x4402('0x9b')](),_0x5b8cf1)[_0x4402('0x29')](function(_0x131a34){_0x3c8c42[_0x4402('0x21')]=_0x131a34[_0x4402('0x47')];if(_0x3c8c42[_0x4402('0x21')]===0x0)return[];return db[_0x4402('0x9a')][_0x4402('0x42')](_0x365880[_0x4402('0x9b')](),_0x5b8cf1)[_0x4402('0x29')](function(_0x27c77f){_0x31871b=_[_0x4402('0x9c')](_0x27c77f,'id');_0x5b8cf1=_[_0x4402('0x9d')](_0x5b8cf1,{'model':db['MailInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x133b77[_0x4402('0x42')]['fields']){_0x431875['attributes'][_0x4402('0x32')](function(_0x581773){_0x2b6795[_0x4402('0x4e')]('i.'+_0x581773);});}else{_0x2b6795['field'](_0x4402('0x93'),'unreadMessages');_0x2b6795[_0x4402('0x4e')]('a.key',_0x4402('0x9e'));_0x2b6795[_0x4402('0x4e')](_0x4402('0x9f'),_0x4402('0xa0'));_0x2b6795[_0x4402('0x4e')](_0x4402('0x8e'));_0x2b6795[_0x4402('0x4e')](_0x4402('0xa1'));_0x2b6795[_0x4402('0x4e')](_0x4402('0xa2'));_0x2b6795[_0x4402('0x4e')](_0x4402('0xa3'));_0x2b6795[_0x4402('0x4e')](_0x4402('0xa4'));_0x2b6795['field']('i.attach');_0x2b6795[_0x4402('0x4e')](_0x4402('0xa5'));_0x2b6795[_0x4402('0x4e')]('i.lastMsgDirection');_0x2b6795[_0x4402('0x4e')](_0x4402('0xa6'));_0x2b6795[_0x4402('0x4e')](_0x4402('0xa7'));_0x2b6795[_0x4402('0x4e')]('i.substatus');_0x2b6795['field'](_0x4402('0xa8'));_0x2b6795[_0x4402('0x4e')](_0x4402('0xa9'));_0x2b6795[_0x4402('0x4e')]('i.MailAccountId');_0x2b6795[_0x4402('0x4e')](_0x4402('0xaa'));_0x2b6795[_0x4402('0x4e')](_0x4402('0xab'),_0x4402('0xac'));_0x2b6795['field'](_0x4402('0xad'),_0x4402('0xae'));_0x2b6795[_0x4402('0x4e')](_0x4402('0xaf'),_0x4402('0xb0'));_0x2b6795[_0x4402('0x4e')](_0x4402('0xb1'),_0x4402('0xb2'));_0x2b6795[_0x4402('0x4e')](_0x4402('0xb3'),'Contact.mobile');_0x2b6795[_0x4402('0x4e')]('c.fax',_0x4402('0xb4'));_0x2b6795['field'](_0x4402('0xb5'),_0x4402('0xb6'));_0x2b6795[_0x4402('0x4e')](_0x4402('0xb7'),_0x4402('0xb8'));_0x2b6795[_0x4402('0x4e')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x4402('0x31'));}_0x2b6795[_0x4402('0x23')](_0x431875['limit']);_0x2b6795[_0x4402('0x22')](_0x431875[_0x4402('0x22')]);return db['sequelize'][_0x4402('0x42')](_0x2b6795[_0x4402('0x9b')](),_0x5b8cf1);})[_0x4402('0x29')](function(_0x341c18){_0x499e12[_0x4402('0x4b')](_0x4402('0xb9'),_[_0x4402('0x2f')](_0x341c18,'id'));return db[_0x4402('0x9a')][_0x4402('0x42')](_0x499e12[_0x4402('0x9b')](),_0x5b8cf1)[_0x4402('0x29')](function(_0x28e417){var _0x1a5b04=_[_0x4402('0xba')](_0x28e417,'MailInteractionId');var _0x3fa338=[];return db[_0x4402('0xbb')][_0x4402('0x36')]({'attributes':[_0x4402('0xbc')],'raw':!![]})[_0x4402('0x29')](function(_0x4fc3c2){var _0x2ec3de=_0x4fc3c2[_0x4402('0xbc')];_0x341c18[_0x4402('0x32')](function(_0x5d6887){_0x3fa338[_0x4402('0x34')](updateMailInteraction(_0x5d6887,_0x31871b,_0x1a5b04,_0x2ec3de));});return BPromise['all'](_0x3fa338);});});});})[_0x4402('0x29')](function(_0x5a8139){_0x3c8c42['rows']=_0x5a8139;return _0x3c8c42;})['then'](respondWithFilteredResult(_0x1fbfbf,_0x431875));})[_0x4402('0x3b')](handleError(_0x1fbfbf,null));};exports[_0x4402('0xbd')]=function(_0x442f20,_0xda6bed){var _0xd1fa37={'raw':![],'where':{'id':_0x442f20[_0x4402('0xbe')]['id']}},_0x433c7d={};_0x433c7d[_0x4402('0x41')]=_[_0x4402('0x74')](db[_0x4402('0x35')][_0x4402('0x3d')]);_0x433c7d[_0x4402('0x42')]=_[_0x4402('0x74')](_0x442f20['query']);_0x433c7d[_0x4402('0x43')]=_[_0x4402('0x44')](_0x433c7d['model'],_0x433c7d[_0x4402('0x42')]);_0xd1fa37[_0x4402('0x45')]=_[_0x4402('0x44')](_0x433c7d['model'],qs[_0x4402('0x46')](_0x442f20[_0x4402('0x42')][_0x4402('0x46')]));_0xd1fa37[_0x4402('0x45')]=_0xd1fa37[_0x4402('0x45')][_0x4402('0x47')]?_0xd1fa37[_0x4402('0x45')]:_0x433c7d[_0x4402('0x41')];if(_0x442f20[_0x4402('0x42')][_0x4402('0xbf')]){_0xd1fa37[_0x4402('0xc0')]=[{'all':!![]}];}_0xd1fa37=_[_0x4402('0x9d')]({},_0xd1fa37,_0x442f20[_0x4402('0xc1')]);return db[_0x4402('0x35')][_0x4402('0x68')](_0xd1fa37)[_0x4402('0x29')](handleEntityNotFound(_0xda6bed,null))[_0x4402('0x29')](respondWithResult(_0xda6bed,null))['catch'](handleError(_0xda6bed,null));};exports['create']=function(_0x4224b4,_0x49e6b4){return db[_0x4402('0x35')]['create'](_0x4224b4[_0x4402('0xc2')],{})['then'](respondWithResult(_0x49e6b4,0xc9))[_0x4402('0x3b')](handleError(_0x49e6b4,null));};exports[_0x4402('0x28')]=function(_0x5ba8f7,_0x20efbd){if(_0x5ba8f7[_0x4402('0xc2')]['id']){delete _0x5ba8f7[_0x4402('0xc2')]['id'];}return db[_0x4402('0x35')][_0x4402('0x68')]({'where':{'id':_0x5ba8f7['params']['id']}})[_0x4402('0x29')](handleEntityNotFound(_0x20efbd,null))['then'](saveUpdates(_0x5ba8f7['body'],null))[_0x4402('0x29')](respondWithResult(_0x20efbd,null))[_0x4402('0x3b')](handleError(_0x20efbd,null));};exports[_0x4402('0xc3')]=function(_0x54b781,_0x2322f9){return db[_0x4402('0x35')][_0x4402('0x68')]({'where':{'id':_0x54b781[_0x4402('0xbe')]['id']}})[_0x4402('0x29')](handleEntityNotFound(_0x2322f9,null))[_0x4402('0x29')](removeEntity(_0x2322f9,null))[_0x4402('0x3b')](handleError(_0x2322f9,null));};exports['describe']=function(_0x2e66ad,_0x3d7f09){return db[_0x4402('0x35')][_0x4402('0xc4')]()[_0x4402('0x29')](respondWithResult(_0x3d7f09,null))[_0x4402('0x3b')](handleError(_0x3d7f09,null));};exports[_0x4402('0xc5')]=function(_0x238c60,_0x2701a2,_0x562e33){return db[_0x4402('0xc6')][_0x4402('0x68')]({'where':{'id':_0x238c60['params']['id']}})[_0x4402('0x29')](handleEntityNotFound(_0x2701a2,null))[_0x4402('0x29')](function(_0x4db23e){if(_0x4db23e){return _0x4db23e[_0x4402('0xc5')](_0x238c60[_0x4402('0xc2')][_0x4402('0xc7')],_[_0x4402('0xc8')](_0x238c60[_0x4402('0xc2')],[_0x4402('0xc7'),'id'])||{});}})[_0x4402('0x29')](respondWithResult(_0x2701a2,null))[_0x4402('0x3b')](handleError(_0x2701a2,null));};exports[_0x4402('0xc9')]=function(_0x1db876,_0x165e5f,_0x49f8cc){var _0x6219bd={'raw':![],'where':{}};var _0x5f05b0={};var _0x589a7c={'count':0x0,'rows':[]};return db[_0x4402('0x35')][_0x4402('0x36')]({'where':{'id':_0x1db876[_0x4402('0xbe')]['id']}})['then'](handleEntityNotFound(_0x165e5f,null))['then'](function(_0x148106){if(_0x148106){_0x5f05b0[_0x4402('0x41')]=_[_0x4402('0x74')](db['MailMessage'][_0x4402('0x3d')]);_0x5f05b0[_0x4402('0x42')]=_['keys'](_0x1db876[_0x4402('0x42')]);_0x5f05b0[_0x4402('0x43')]=_[_0x4402('0x44')](_0x5f05b0['model'],_0x5f05b0[_0x4402('0x42')]);_0x6219bd[_0x4402('0x45')]=_[_0x4402('0x44')](_0x5f05b0['model'],qs['fields'](_0x1db876[_0x4402('0x42')][_0x4402('0x46')]));_0x6219bd['attributes']=_0x6219bd[_0x4402('0x45')][_0x4402('0x47')]?_0x6219bd[_0x4402('0x45')]:_0x5f05b0[_0x4402('0x41')];if(!_0x1db876[_0x4402('0x42')][_0x4402('0xca')](_0x4402('0x48'))){_0x6219bd[_0x4402('0x23')]=qs[_0x4402('0x23')](_0x1db876[_0x4402('0x42')]['limit']);_0x6219bd[_0x4402('0x22')]=qs[_0x4402('0x22')](_0x1db876[_0x4402('0x42')]['offset']);}_0x6219bd[_0x4402('0x49')]=qs['sort'](_0x1db876[_0x4402('0x42')][_0x4402('0x4a')]);_0x6219bd[_0x4402('0x4b')]=qs['filters'](_['pick'](_0x1db876[_0x4402('0x42')],_0x5f05b0['filters']));_0x6219bd[_0x4402('0x4b')][_0x4402('0xcb')]=_0x148106['id'];if(_0x1db876[_0x4402('0x42')][_0x4402('0x85')]){_0x6219bd[_0x4402('0x4b')]=_[_0x4402('0x9d')](_0x6219bd['where'],{'$or':_[_0x4402('0x2f')](_0x6219bd[_0x4402('0x45')],function(_0x5a482f){var _0x3b6fda={};_0x3b6fda[_0x5a482f]={'$like':'%'+_0x1db876[_0x4402('0x42')][_0x4402('0x85')]+'%'};return _0x3b6fda;})});}if(_0x1db876['query'][_0x4402('0x7b')]){var _0x25615c=_0x1db876['query'][_0x4402('0x7b')][_0x4402('0x6e')](',');var _0x2f7d68={};_0x2f7d68[_0x25615c[0x0]]={'$gte':moment(_0x25615c[0x1])[_0x4402('0xcc')](_0x4402('0xcd'))};_0x6219bd[_0x4402('0x4b')]=_[_0x4402('0x9d')](_0x6219bd[_0x4402('0x4b')],_0x2f7d68);}_0x6219bd=_[_0x4402('0x9d')]({},_0x6219bd,_0x1db876[_0x4402('0xc1')]);return db[_0x4402('0xc6')][_0x4402('0x21')]({'where':_0x6219bd[_0x4402('0x4b')]})['then'](function(_0x45f652){_0x589a7c['count']=_0x45f652;if(_0x1db876[_0x4402('0x42')][_0x4402('0xbf')]){_0x6219bd[_0x4402('0xc0')]=[{'all':!![]}];}return db[_0x4402('0xc6')][_0x4402('0xce')](_0x6219bd);})[_0x4402('0x29')](function(_0x2b5560){_0x589a7c[_0x4402('0xcf')]=_0x2b5560;return _0x589a7c;});}})['then'](respondWithFilteredResult(_0x165e5f,_0x6219bd))[_0x4402('0x3b')](handleError(_0x165e5f,null));};exports[_0x4402('0xd0')]=function(_0x43c064,_0x292a3e,_0x31cc97){return db[_0x4402('0x35')][_0x4402('0x68')]({'where':{'id':_0x43c064[_0x4402('0xbe')]['id']}})[_0x4402('0x29')](handleEntityNotFound(_0x292a3e,null))[_0x4402('0x29')](function(_0x45215a){if(_0x45215a){return _0x45215a[_0x4402('0xd1')](_0x43c064[_0x4402('0xc2')][_0x4402('0xc7')],_[_0x4402('0xc8')](_0x43c064[_0x4402('0xc2')],[_0x4402('0xc7'),'id'])||{})[_0x4402('0xd2')](function(){return db[_0x4402('0x6d')][_0x4402('0xce')]({'attributes':['id',_0x4402('0x2c'),'color'],'where':{'id':_0x43c064['body'][_0x4402('0xc7')]}});})['then'](function(_0x3de6af){socket['emit'](_0x4402('0xd3'),{'id':Number(_0x43c064[_0x4402('0xbe')]['id']),'tags':_0x3de6af||[]});return{'id':Number(_0x43c064[_0x4402('0xbe')]['id']),'tags':_0x3de6af||[]};});}})[_0x4402('0x29')](respondWithResult(_0x292a3e,null))['catch'](handleError(_0x292a3e,null));};exports[_0x4402('0xd4')]=function(_0x5b9588,_0x40807c,_0x5af8e6){return db[_0x4402('0x35')][_0x4402('0x68')]({'where':{'id':_0x5b9588[_0x4402('0xbe')]['id']}})[_0x4402('0x29')](handleEntityNotFound(_0x40807c,null))[_0x4402('0x29')](function(_0x4eda66){if(_0x4eda66){return _0x4eda66[_0x4402('0xd4')](_0x5b9588['query'][_0x4402('0xc7')]);}})[_0x4402('0x29')](respondWithStatusCode(_0x40807c,null))[_0x4402('0x3b')](handleError(_0x40807c,null));};exports[_0x4402('0xd5')]=function(_0x3516cf,_0xf1d416){var _0x53efd8=moment()[_0x4402('0xd6')]()[_0x4402('0x9b')]();var _0x530d2e=path[_0x4402('0xd7')](config[_0x4402('0xd8')],_0x4402('0xd9'),_0x4402('0xda'),_0x4402('0xdb'));var _0x541207=path[_0x4402('0xd7')](config[_0x4402('0xd8')],_0x4402('0xd9'),_0x4402('0xda'),'attachments');var _0x1f9559=path[_0x4402('0xd7')](_0x530d2e,_0x53efd8);var _0x50a49a=util[_0x4402('0xcc')](_0x4402('0xdc'),_0x3516cf[_0x4402('0xbe')]['id'],_0x53efd8);var _0x55e474=path[_0x4402('0xd7')](_0x530d2e,_0x50a49a);var _0x5cd106=[];if(_0x3516cf[_0x4402('0x42')][_0x4402('0xdd')]){_0x5cd106['push']({'model':db[_0x4402('0xde')],'as':_0x4402('0xdf'),'raw':!![]});}var _0x397665=[{'model':db[_0x4402('0xc6')],'as':_0x4402('0xe0'),'attributes':['id',_0x4402('0xc2'),_0x4402('0x50'),'to','cc',_0x4402('0xe1'),_0x4402('0xe2'),_0x4402('0x79')],'where':{'secret':![]},'order':qs[_0x4402('0x4a')]('id'),'include':_0x5cd106}];return db[_0x4402('0x35')]['find']({'where':{'id':_0x3516cf[_0x4402('0xbe')]['id']},'include':_0x397665})[_0x4402('0x29')](handleEntityNotFound(_0xf1d416,null))[_0x4402('0x29')](function(_0x2ae275){if(_0x2ae275&&_0x2ae275[_0x4402('0xe0')]){var _0x1e1de0=_0x2ae275[_0x4402('0xe3')]({'plain':!![]});fs['mkdirSync'](_0x1f9559);return BPromise['each'](_0x1e1de0[_0x4402('0xe0')],function(_0x382d06,_0x2bda31){var _0x29d7a0={'from':_0x382d06[_0x4402('0x50')],'to':_0x382d06['to'],'subject':_0x382d06['subject'],'html':_0x382d06[_0x4402('0xc2')],'headers':{'Date':moment(_0x382d06[_0x4402('0x79')])[_0x4402('0xcc')](_0x4402('0xe4'))},'attachments':[]};if(_0x382d06['cc']){_0x29d7a0[_0x4402('0xe5')]['Cc']=_0x382d06['cc'];}if(_0x382d06['bcc']){_0x29d7a0[_0x4402('0xe5')]['Bcc']=_0x382d06[_0x4402('0xe1')];}return new BPromise(function(_0x10a0f9,_0x3a3a4c){if(_0x382d06['Attachments']){for(var _0x180c5d=0x0;_0x180c5d<_0x382d06[_0x4402('0xdf')][_0x4402('0x47')];_0x180c5d++){var _0xe868ff=_0x382d06[_0x4402('0xdf')][_0x180c5d];var _0x44cb21=path[_0x4402('0xd7')](_0x541207,_0xe868ff['basename']);if(fs[_0x4402('0xe6')](_0x44cb21)){_0x29d7a0['attachments'][_0x4402('0x34')]({'name':_0xe868ff[_0x4402('0x2c')],'contentType':_0xe868ff[_0x4402('0x3f')],'data':fs['readFileSync'](_0x44cb21)});}}}emlformat['build'](_0x29d7a0,function(_0x2d26a5,_0x31cfbc){if(_0x2d26a5)return _0x3a3a4c(_0x2d26a5);fs[_0x4402('0xe7')](path[_0x4402('0xd7')](_0x1f9559,util[_0x4402('0xcc')]('message%d.eml',_0x2bda31)),_0x31cfbc);return _0x10a0f9(_0x31cfbc);});});})[_0x4402('0x29')](function(){return new BPromise(function(_0x562aff,_0x49377b){zipdir(_0x1f9559,{'saveTo':_0x55e474},function(_0x152365,_0x56361c){if(_0x152365)return _0x49377b(_0x152365);return _0x562aff(_0x56361c);});})['then'](function(){return new BPromise(function(_0x4470d2,_0x520114){rimraf(_0x1f9559,function(_0x3cf892){if(_0x3cf892)_0x520114(_0x3cf892);return _0x4470d2();});});})[_0x4402('0x29')](function(){return _0xf1d416['download'](_0x55e474,_0x50a49a,function(_0x30b06a){if(_0x30b06a){console[_0x4402('0xe8')](_0x4402('0xe9'),_0x30b06a);}else{fs['unlinkSync'](_0x55e474);}});});});}else{return _0xf1d416[_0x4402('0x1d')](0xc8);}})[_0x4402('0x3b')](handleError(_0xf1d416,null));}; \ No newline at end of file +var _0x2d26=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','sendStatus','status','end','json','count','offset','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','Users','map','fullname','Tags','TagIds','MailInteraction','findOne','lastMsgBody','lastMsgText','trimStart','fromString','catch','fieldName','type','query','filters','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','field','color','from','tools_tags','u.id','u.fullname','ui.MailInteractionId','user_has_mail_interactions','left_join','u.id\x20=\x20ui.UserId','select','mail_interactions','cm_contacts','users','mail_accounts','a.id\x20=\x20i.MailAccountId','mail_messages','me.MailInteractionId\x20=\x20i.id','mail_interaction_has_tags','t.id\x20=\x20it.TagId','expr','sqlOperator','conditions','find','having','`\x20>\x200','Contact','$substring','value','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','ContactId','buildExpression','text','Tag','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','start','plainBody','keys','compact','isEmpty','where','concat','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','\x27\x27\x27\x27','i.id\x20LIKE\x20?','isEmail','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','Sequelize','QueryTypes','SELECT','clone','DESC','resolve','MailAccountId','journey','i.MailAccountId\x20IS\x20NOT\x20NULL','user','getMailAccounts','i.MailAccountId\x20IS\x20NULL','i.MailAccountId\x20IN\x20?','sequelize','toString','keyBy','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.createdAt','i.closed','i.closedAt','i.attach','i.subject','i.substatus','i.ContactId','i.MailAccountId','i.UserId','c.firstName','Contact.firstName','Contact.lastName','Contact.email','Contact.phone','c.mobile','Contact.mobile','c.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','Setting','enableEmailPreview','push','all','rows','show','params','intersection','includeAll','include','create','body','describe','MailMessage','addMessage','ids','omit','getMessages','rawAttributes','MailInteractionId','merge','format','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','setTags','spread','emit','mailInteractionTags:save','removeTags','download','unix','server','files','tmp','join','root','attachments','Messages','bcc','mkdirSync','each','subject','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','Attachments','basename','existsSync','readFileSync','build','writeFileSync','log','err','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis'];(function(_0x31d6c2,_0x422dcd){var _0x295dd0=function(_0x2b5dd1){while(--_0x2b5dd1){_0x31d6c2['push'](_0x31d6c2['shift']());}};_0x295dd0(++_0x422dcd);}(_0x2d26,0xdb));var _0x62d2=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0x2d26[_0x4ea69d];return _0x5318e0;};'use strict';var pdf=require(_0x62d2('0x0'));var emlformat=require(_0x62d2('0x1'));var rimraf=require(_0x62d2('0x2'));var zipdir=require(_0x62d2('0x3'));var jsonpatch=require(_0x62d2('0x4'));var rp=require('request-promise');var moment=require(_0x62d2('0x5'));var BPromise=require(_0x62d2('0x6'));var Mustache=require(_0x62d2('0x7'));var util=require(_0x62d2('0x8'));var path=require(_0x62d2('0x9'));var sox=require('sox');var csv=require(_0x62d2('0xa'));var ejs=require(_0x62d2('0xb'));var fs=require('fs');var _=require(_0x62d2('0xc'));var squel=require(_0x62d2('0xd'));var crypto=require(_0x62d2('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x62d2('0xf'));var toCsv=require(_0x62d2('0xa'));var querystring=require(_0x62d2('0x10'));var Papa=require('papaparse');var htmlToText=require('html-to-text');var Redis=require(_0x62d2('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x62d2('0x12'));var as=require(_0x62d2('0x13'));var hardwareService=require(_0x62d2('0x14'));var logger=require(_0x62d2('0x15'))(_0x62d2('0x16'));var utils=require('../../config/utils');var config=require(_0x62d2('0x17'));var db=require(_0x62d2('0x18'))['db'];config['redis']=_[_0x62d2('0x19')](config[_0x62d2('0x1a')],{'host':_0x62d2('0x1b'),'port':0x18eb});var socket=require(_0x62d2('0x1c'))(new Redis(config[_0x62d2('0x1a')]));require('./mailInteraction.socket')[_0x62d2('0x1d')](socket);function respondWithStatusCode(_0x23a3d0,_0x108de3){_0x108de3=_0x108de3||0xcc;return function(_0x4934b6){if(_0x4934b6){return _0x23a3d0[_0x62d2('0x1e')](_0x108de3);}return _0x23a3d0[_0x62d2('0x1f')](_0x108de3)[_0x62d2('0x20')]();};}function respondWithResult(_0x2842b8,_0x565cbf){_0x565cbf=_0x565cbf||0xc8;return function(_0x33a698){if(_0x33a698){return _0x2842b8[_0x62d2('0x1f')](_0x565cbf)[_0x62d2('0x21')](_0x33a698);}};}function respondWithFilteredResult(_0x4256c4,_0x105760){return function(_0x48a96f){if(_0x48a96f){var _0x247086=_0x48a96f[_0x62d2('0x22')],_0x860236=_0x105760[_0x62d2('0x23')],_0x33a7f4=_0x105760[_0x62d2('0x23')]+_0x105760['limit'],_0x561ef9;if(_0x33a7f4>=_0x247086){_0x33a7f4=_0x247086;_0x561ef9=0xc8;}else{_0x561ef9=0xce;}_0x4256c4[_0x62d2('0x1f')](_0x561ef9);return _0x4256c4['set'](_0x62d2('0x24'),_0x860236+'-'+_0x33a7f4+'/'+_0x247086)['json'](_0x48a96f);}return null;};}function patchUpdates(_0x15f71b){return function(_0x37c17a){try{jsonpatch[_0x62d2('0x25')](_0x37c17a,_0x15f71b,!![]);}catch(_0x376417){return BPromise[_0x62d2('0x26')](_0x376417);}return _0x37c17a[_0x62d2('0x27')]();};}function saveUpdates(_0x4fa218,_0x1c8874){return function(_0x4cf7fd){if(_0x4cf7fd){return _0x4cf7fd[_0x62d2('0x28')](_0x4fa218)[_0x62d2('0x29')](function(_0x11137f){return _0x11137f;});}return null;};}function removeEntity(_0x4ecf3d,_0x5538ec){return function(_0x467de3){if(_0x467de3){return _0x467de3[_0x62d2('0x2a')]()[_0x62d2('0x29')](function(){_0x4ecf3d[_0x62d2('0x1f')](0xcc)[_0x62d2('0x20')]();});}};}function handleEntityNotFound(_0xfba189,_0x59c130){return function(_0x44ed98){if(!_0x44ed98){_0xfba189['sendStatus'](0x194);}return _0x44ed98;};}function handleError(_0xed996,_0x565b02){_0x565b02=_0x565b02||0x1f4;return function(_0xb988d4){logger[_0x62d2('0x2b')](_0xb988d4[_0x62d2('0x2c')]);if(_0xb988d4[_0x62d2('0x2d')]){delete _0xb988d4[_0x62d2('0x2d')];}_0xed996[_0x62d2('0x1f')](_0x565b02)[_0x62d2('0x2e')](_0xb988d4);};}function getInteractionUsers(_0x27c2b2,_0x47cd33){return new BPromise(function(_0x38470a,_0x52d040){try{if(_0x47cd33[_0x27c2b2['id']]){_0x27c2b2[_0x62d2('0x2f')]=_[_0x62d2('0x30')](_0x47cd33[_0x27c2b2['id']],function(_0x3986e4){return{'id':_0x3986e4['id'],'fullname':_0x3986e4[_0x62d2('0x31')]};});}}catch(_0x2dfa77){_0x52d040(_0x2dfa77);}_0x38470a(_0x27c2b2);});}function getInteractionTags(_0x1dba42,_0x379a6f){return new BPromise(function(_0x2caa80,_0xc50c1a){try{if(_0x1dba42['TagIds']){_0x1dba42[_0x62d2('0x32')]=[];_0x1dba42['TagIds']['split'](',')['forEach'](function(_0x2febf5){_0x1dba42[_0x62d2('0x32')]['push'](_0x379a6f[_0x2febf5]);});}delete _0x1dba42[_0x62d2('0x33')];}catch(_0x560245){_0xc50c1a(_0x560245);}_0x2caa80(_0x1dba42);});}function getLastMessageText(_0x22ffc7){return new BPromise(function(_0x27b05a,_0x5d75e1){return db[_0x62d2('0x34')][_0x62d2('0x35')]({'where':{'id':_0x22ffc7['id']},'attributes':[_0x62d2('0x36'),_0x62d2('0x37')],'raw':!![]})['then'](function(_0x4fe7c2){if(!_0x4fe7c2[_0x62d2('0x37')]){_0x22ffc7[_0x62d2('0x37')]=_[_0x62d2('0x38')](htmlToText[_0x62d2('0x39')](_0x4fe7c2['lastMsgBody'],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]}));}else{_0x22ffc7[_0x62d2('0x37')]=_0x4fe7c2[_0x62d2('0x37')];}_0x27b05a(_0x22ffc7);})[_0x62d2('0x3a')](function(_0x13a996){_0x5d75e1(_0x13a996);});});}function updateMailInteraction(_0x175400,_0x40fa50,_0x1aaf9e,_0x2a2bcf){return new BPromise(function(_0x2baff8,_0x3ac30b){return getInteractionUsers(_0x175400,_0x1aaf9e)[_0x62d2('0x29')](function(_0x1a9ebc){return getInteractionTags(_0x1a9ebc,_0x40fa50);})[_0x62d2('0x29')](function(_0x175190){if(_0x2a2bcf){_0x2baff8(getLastMessageText(_0x175190));}else{_0x2baff8(_0x175190);}})['catch'](function(_0x4c8670){_0x3ac30b(_0x4c8670);});});}exports['index']=function(_0x19ca84,_0x38053e){var _0x5342e7={},_0x2bf2f6={},_0x1ccc06={'count':0x0,'rows':[]};var _0x2231e6=_[_0x62d2('0x30')](db[_0x62d2('0x34')]['rawAttributes'],function(_0x2432ff){return{'name':_0x2432ff[_0x62d2('0x3b')],'type':_0x2432ff[_0x62d2('0x3c')]['key']};});_0x2bf2f6['model']=_['map'](_0x2231e6,_0x62d2('0x2d'));_0x2bf2f6['query']=_['keys'](_0x19ca84[_0x62d2('0x3d')]);_0x2bf2f6[_0x62d2('0x3e')]=_['intersection'](_0x2bf2f6[_0x62d2('0x3f')],_0x2bf2f6[_0x62d2('0x3d')]);_0x5342e7[_0x62d2('0x40')]=_['intersection'](_0x2bf2f6[_0x62d2('0x3f')],qs[_0x62d2('0x41')](_0x19ca84[_0x62d2('0x3d')][_0x62d2('0x41')]));_0x5342e7[_0x62d2('0x40')]=_0x5342e7[_0x62d2('0x40')][_0x62d2('0x42')]?_0x5342e7[_0x62d2('0x40')]:_0x2bf2f6[_0x62d2('0x3f')];if(!_0x19ca84[_0x62d2('0x3d')][_0x62d2('0x43')](_0x62d2('0x44'))){_0x5342e7['limit']=qs[_0x62d2('0x45')](_0x19ca84['query']['limit']);_0x5342e7[_0x62d2('0x23')]=qs['offset'](_0x19ca84[_0x62d2('0x3d')][_0x62d2('0x23')]);}_0x5342e7[_0x62d2('0x46')]=qs[_0x62d2('0x47')](_0x19ca84['query'][_0x62d2('0x47')]);_0x5342e7['where']=qs[_0x62d2('0x3e')](_['pick'](_0x19ca84['query'],_0x2bf2f6[_0x62d2('0x3e')]));var _0x174dd8=[];var _0x3d4886=squel['select']()['field']('id')[_0x62d2('0x48')](_0x62d2('0x2d'))[_0x62d2('0x48')](_0x62d2('0x49'))[_0x62d2('0x4a')](_0x62d2('0x4b'));var _0x1cd604=squel['select']()[_0x62d2('0x48')](_0x62d2('0x4c'))[_0x62d2('0x48')](_0x62d2('0x4d'))[_0x62d2('0x48')](_0x62d2('0x4e'))[_0x62d2('0x4a')](_0x62d2('0x4f'),'ui')[_0x62d2('0x50')]('users','u',_0x62d2('0x51'));var _0x2f67af=squel[_0x62d2('0x52')]()[_0x62d2('0x4a')](_0x62d2('0x53'),'i')[_0x62d2('0x50')](_0x62d2('0x54'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')['left_join'](_0x62d2('0x55'),'o','o.id\x20=\x20i.UserId')[_0x62d2('0x50')](_0x62d2('0x56'),'a',_0x62d2('0x57'))[_0x62d2('0x50')](_0x62d2('0x58'),'me',_0x62d2('0x59'))[_0x62d2('0x50')](_0x62d2('0x5a'),'it','it.MailInteractionId\x20=\x20i.id')[_0x62d2('0x50')]('tools_tags','t',_0x62d2('0x5b'));var _0x2ac87d=squel[_0x62d2('0x5c')]();var _0x3a6b15=[];var _0x461a0d=squel[_0x62d2('0x5c')]();var _0x459412;if(_0x19ca84[_0x62d2('0x3d')]['search']){_0x459412=as['parseSearch'](_0x19ca84[_0x62d2('0x3d')]['search']);var _0x1f8397=_0x459412[_0x62d2('0x5d')];for(var _0x371f5a=0x0;_0x371f5a<_0x459412[_0x62d2('0x5e')][_0x62d2('0x42')];_0x371f5a++){var _0x4aeb3a=_0x459412[_0x62d2('0x5e')][_0x371f5a];var _0x29b098='i';var _0x1db5b1=_[_0x62d2('0x5f')](_0x2231e6,['name',_0x4aeb3a[_0x62d2('0x48')]]);if(!_0x1db5b1){switch(_0x4aeb3a['field']){case'unreadMessages':if(_0x4aeb3a['value']==0x1){_0x2f67af[_0x62d2('0x60')]('`'+_0x4aeb3a['field']+'`\x20=\x200');}else{_0x2f67af[_0x62d2('0x60')]('`'+_0x4aeb3a[_0x62d2('0x48')]+_0x62d2('0x61'));}break;case _0x62d2('0x62'):if(_0x4aeb3a['operator']===_0x62d2('0x63')){if(_0x4aeb3a[_0x62d2('0x64')][_0x62d2('0x65')]('\x20')[_0x62d2('0x42')]>0x1){_0x2ac87d[_0x1f8397](_0x62d2('0x66'),qs[_0x62d2('0x67')](_0x4aeb3a[_0x62d2('0x64')]),null);}else{var _0x2a5179='%'+_0x4aeb3a[_0x62d2('0x64')]+'%';_0x2ac87d[_0x1f8397]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x2a5179,_0x2a5179,_0x2a5179);}}else{_0x1db5b1=_[_0x62d2('0x5f')](_0x2231e6,[_0x62d2('0x2d'),'ContactId']);_0x4aeb3a[_0x62d2('0x48')]=_0x62d2('0x68');_0x523792=as[_0x62d2('0x69')](_0x29b098,_0x1db5b1[_0x62d2('0x3c')],_0x4aeb3a);_0x2ac87d[_0x1f8397](_0x523792[_0x62d2('0x6a')],_0x523792[_0x62d2('0x64')]['start'],_0x523792[_0x62d2('0x64')]['end']);}break;case _0x62d2('0x6b'):var _0x2bfbf4=_0x4aeb3a[_0x62d2('0x64')][_0x62d2('0x65')](',')['map'](function(_0x537cf8){return Number(_0x537cf8);});_0x2bfbf4[_0x62d2('0x6c')](function(_0x169fdb){_0x461a0d['or'](_0x62d2('0x6d'),'%,'+_0x169fdb+',%');});_0x3a6b15=_[_0x62d2('0x6e')](_0x3a6b15,_0x2bfbf4);break;case _0x62d2('0x6f'):if(_0x4aeb3a['operator']==='$substring'){_0x2ac87d[_0x1f8397]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x4aeb3a[_0x62d2('0x64')]+'%',null);}else{_0x1db5b1=_[_0x62d2('0x5f')](_0x2231e6,[_0x62d2('0x2d'),'UserId']);_0x4aeb3a['field']='UserId';_0x523792=as[_0x62d2('0x69')](_0x29b098,_0x1db5b1[_0x62d2('0x3c')],_0x4aeb3a);_0x2ac87d[_0x1f8397](_0x523792['text'],_0x523792['value'][_0x62d2('0x70')],_0x523792['value']['end']);}break;case _0x62d2('0x71'):_0x523792=as['buildExpression']('me',null,_0x4aeb3a);_0x2ac87d[_0x1f8397](_0x523792[_0x62d2('0x6a')],_0x523792[_0x62d2('0x64')][_0x62d2('0x70')],_0x523792[_0x62d2('0x64')]['end']);break;}}else{var _0x523792=as[_0x62d2('0x69')](_0x29b098,_0x1db5b1['type'],_0x4aeb3a);_0x2ac87d[_0x1f8397](_0x523792['text'],_0x523792[_0x62d2('0x64')][_0x62d2('0x70')],_0x523792[_0x62d2('0x64')][_0x62d2('0x20')]);}}}else{var _0x57615c=_(_0x19ca84[_0x62d2('0x3d')])[_0x62d2('0x72')]()[_0x62d2('0x30')](function(_0xd04130){return _['some'](_0x2231e6,[_0x62d2('0x2d'),_0xd04130])?_0xd04130:undefined;})[_0x62d2('0x73')]()[_0x62d2('0x64')]();if(!_[_0x62d2('0x74')](_0x57615c)){_0x57615c['forEach'](function(_0x579451){if(_0x579451==='MailAccountId'){_0x2f67af[_0x62d2('0x75')]('i.MailAccountId\x20IN\x20?',[][_0x62d2('0x76')](_0x19ca84[_0x62d2('0x3d')][_0x579451]));}else if(_0x579451==='createdAt'){var _0x52dabb=JSON[_0x62d2('0x77')](_0x19ca84['query'][_0x579451])[_0x62d2('0x78')];var _0x26f9e7=JSON[_0x62d2('0x77')](_0x19ca84[_0x62d2('0x3d')][_0x579451])[_0x62d2('0x79')];_0x2f67af['where'](_0x62d2('0x7a'),_0x52dabb,_0x26f9e7);}else{if(_0x19ca84['query'][_0x579451]==='null'){_0x2f67af[_0x62d2('0x75')]('i.'+_0x579451+_0x62d2('0x7b'));}else{_0x2f67af[_0x62d2('0x75')]('i.'+_0x579451+_0x62d2('0x7c'),_0x19ca84[_0x62d2('0x3d')][_0x579451]);}}});}if(_0x19ca84[_0x62d2('0x3d')][_0x62d2('0x7d')]){if(_0x19ca84[_0x62d2('0x3d')][_0x62d2('0x7d')]==0x1){_0x2f67af[_0x62d2('0x60')](_0x62d2('0x7e'));}else{_0x2f67af[_0x62d2('0x60')](_0x62d2('0x7f'));}}if(_0x19ca84[_0x62d2('0x3d')][_0x62d2('0x80')]){_0x3a6b15=_[_0x62d2('0x81')](_0x19ca84[_0x62d2('0x3d')][_0x62d2('0x80')])?_0x19ca84[_0x62d2('0x3d')][_0x62d2('0x80')]:new Array(_0x19ca84[_0x62d2('0x3d')][_0x62d2('0x80')]);_0x3a6b15[_0x62d2('0x6c')](function(_0x2ecd55){_0x461a0d['or'](_0x62d2('0x6d'),'%,'+_0x2ecd55+',%');});}if(_0x19ca84['query'][_0x62d2('0x82')]){var _0x1e8ed1=_0x19ca84[_0x62d2('0x3d')]['filter']['replace']('\x5c','\x5c\x5c')[_0x62d2('0x83')]('\x27\x27',_0x62d2('0x84'));if(qs['isNumeric'](_0x1e8ed1)){_0x2ac87d['or'](_0x62d2('0x85'),_0x1e8ed1+'%');}else if(qs[_0x62d2('0x86')](_0x1e8ed1)){_0x2ac87d['or']('c.email\x20LIKE\x20?',_0x1e8ed1+'%');}else{_0x2ac87d['or'](_0x62d2('0x87'),qs[_0x62d2('0x67')](_0x1e8ed1))['or']('MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x62d2('0x67')](_0x1e8ed1));}}}_0x2f67af[_0x62d2('0x75')](_0x2ac87d);_0x2f67af[_0x62d2('0x88')](_0x62d2('0x89'));var _0x3b1696={'type':db[_0x62d2('0x8a')][_0x62d2('0x8b')][_0x62d2('0x8c')],'raw':!![]};var _0x3aa927=_0x2f67af[_0x62d2('0x8d')]();_0x3aa927[_0x62d2('0x48')](_0x62d2('0x89'));_0x3aa927[_0x62d2('0x48')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');if(_0x5342e7['order']){_0x5342e7[_0x62d2('0x46')]['forEach'](function(_0x5b775f){_0x2f67af['order']('i.'+_0x5b775f[0x0],_0x5b775f[0x1]===_0x62d2('0x8e')?![]:!![]);});}if(!_[_0x62d2('0x74')](_0x3a6b15)){_0x2f67af['having'](_0x461a0d);_0x3aa927[_0x62d2('0x75')]('t.id\x20IN\x20?',_0x3a6b15);}BPromise[_0x62d2('0x8f')]()[_0x62d2('0x29')](function(){if(!_0x459412){if(_0x19ca84[_0x62d2('0x3d')][_0x62d2('0x90')]||_0x19ca84[_0x62d2('0x3d')][_0x62d2('0x91')])return;_0x3aa927[_0x62d2('0x75')](_0x62d2('0x92'));_0x2f67af[_0x62d2('0x75')](_0x62d2('0x92'));return;}return _0x19ca84[_0x62d2('0x93')][_0x62d2('0x94')]({'attributes':['id'],'raw':!![]})[_0x62d2('0x29')](function(_0xb6f6c7){if(_[_0x62d2('0x74')](_0xb6f6c7)){_0x3aa927[_0x62d2('0x75')](_0x62d2('0x95'));_0x2f67af[_0x62d2('0x75')](_0x62d2('0x95'));}else{_0x3aa927[_0x62d2('0x75')]('i.MailAccountId\x20IN\x20?',_[_0x62d2('0x30')](_0xb6f6c7,'id'));_0x2f67af[_0x62d2('0x75')](_0x62d2('0x96'),_['map'](_0xb6f6c7,'id'));}});})['then'](function(){db[_0x62d2('0x97')][_0x62d2('0x3d')](_0x3aa927[_0x62d2('0x98')](),_0x3b1696)[_0x62d2('0x29')](function(_0x4aaf06){_0x1ccc06[_0x62d2('0x22')]=_0x4aaf06[_0x62d2('0x42')];if(_0x1ccc06[_0x62d2('0x22')]===0x0)return[];return db[_0x62d2('0x97')][_0x62d2('0x3d')](_0x3d4886[_0x62d2('0x98')](),_0x3b1696)[_0x62d2('0x29')](function(_0x507b2f){_0x174dd8=_[_0x62d2('0x99')](_0x507b2f,'id');_0x3b1696=_['merge'](_0x3b1696,{'model':db[_0x62d2('0x34')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x19ca84['query'][_0x62d2('0x41')]){_0x5342e7[_0x62d2('0x40')][_0x62d2('0x6c')](function(_0x598514){_0x2f67af['field']('i.'+_0x598514);});}else{_0x2f67af[_0x62d2('0x48')](_0x62d2('0x9a'),'unreadMessages');_0x2f67af['field'](_0x62d2('0x9b'),_0x62d2('0x9c'));_0x2f67af[_0x62d2('0x48')](_0x62d2('0x9d'),_0x62d2('0x9e'));_0x2f67af[_0x62d2('0x48')](_0x62d2('0x89'));_0x2f67af[_0x62d2('0x48')](_0x62d2('0x9f'));_0x2f67af[_0x62d2('0x48')]('i.updatedAt');_0x2f67af[_0x62d2('0x48')](_0x62d2('0xa0'));_0x2f67af['field'](_0x62d2('0xa1'));_0x2f67af[_0x62d2('0x48')](_0x62d2('0xa2'));_0x2f67af[_0x62d2('0x48')]('i.lastMsgAt');_0x2f67af['field']('i.lastMsgDirection');_0x2f67af['field'](_0x62d2('0xa3'));_0x2f67af[_0x62d2('0x48')]('i.disposition');_0x2f67af[_0x62d2('0x48')](_0x62d2('0xa4'));_0x2f67af[_0x62d2('0x48')]('i.to');_0x2f67af['field'](_0x62d2('0xa5'));_0x2f67af[_0x62d2('0x48')](_0x62d2('0xa6'));_0x2f67af['field'](_0x62d2('0xa7'));_0x2f67af[_0x62d2('0x48')](_0x62d2('0xa8'),_0x62d2('0xa9'));_0x2f67af['field']('c.lastName',_0x62d2('0xaa'));_0x2f67af[_0x62d2('0x48')]('c.email',_0x62d2('0xab'));_0x2f67af[_0x62d2('0x48')]('c.phone',_0x62d2('0xac'));_0x2f67af[_0x62d2('0x48')](_0x62d2('0xad'),_0x62d2('0xae'));_0x2f67af[_0x62d2('0x48')](_0x62d2('0xaf'),'Contact.fax');_0x2f67af[_0x62d2('0x48')](_0x62d2('0xb0'),_0x62d2('0xb1'));_0x2f67af[_0x62d2('0x48')](_0x62d2('0xb2'),_0x62d2('0xb3'));_0x2f67af[_0x62d2('0x48')](_0x62d2('0xb4'),_0x62d2('0x33'));}_0x2f67af[_0x62d2('0x45')](_0x5342e7[_0x62d2('0x45')]);_0x2f67af[_0x62d2('0x23')](_0x5342e7[_0x62d2('0x23')]);return db[_0x62d2('0x97')][_0x62d2('0x3d')](_0x2f67af['toString'](),_0x3b1696);})[_0x62d2('0x29')](function(_0x113a31){_0x1cd604['where']('ui.MailInteractionId\x20IN\x20?',_[_0x62d2('0x30')](_0x113a31,'id'));return db[_0x62d2('0x97')][_0x62d2('0x3d')](_0x1cd604[_0x62d2('0x98')](),_0x3b1696)['then'](function(_0x262c85){var _0x4de313=_[_0x62d2('0xb5')](_0x262c85,'MailInteractionId');var _0x282cef=[];return db[_0x62d2('0xb6')][_0x62d2('0x35')]({'attributes':[_0x62d2('0xb7')],'raw':!![]})[_0x62d2('0x29')](function(_0x220a24){var _0x58f481=_0x220a24[_0x62d2('0xb7')];_0x113a31['forEach'](function(_0xc51948){_0x282cef[_0x62d2('0xb8')](updateMailInteraction(_0xc51948,_0x174dd8,_0x4de313,_0x58f481));});return BPromise[_0x62d2('0xb9')](_0x282cef);});});});})[_0x62d2('0x29')](function(_0x38aa74){_0x1ccc06[_0x62d2('0xba')]=_0x38aa74;return _0x1ccc06;})[_0x62d2('0x29')](respondWithFilteredResult(_0x38053e,_0x5342e7));})['catch'](handleError(_0x38053e,null));};exports[_0x62d2('0xbb')]=function(_0xc50712,_0xce9758){var _0x35110d={'raw':![],'where':{'id':_0xc50712[_0x62d2('0xbc')]['id']}},_0x473266={};_0x473266[_0x62d2('0x3f')]=_[_0x62d2('0x72')](db['MailInteraction']['rawAttributes']);_0x473266[_0x62d2('0x3d')]=_['keys'](_0xc50712[_0x62d2('0x3d')]);_0x473266[_0x62d2('0x3e')]=_[_0x62d2('0xbd')](_0x473266[_0x62d2('0x3f')],_0x473266['query']);_0x35110d[_0x62d2('0x40')]=_[_0x62d2('0xbd')](_0x473266['model'],qs['fields'](_0xc50712[_0x62d2('0x3d')][_0x62d2('0x41')]));_0x35110d[_0x62d2('0x40')]=_0x35110d[_0x62d2('0x40')][_0x62d2('0x42')]?_0x35110d['attributes']:_0x473266['model'];if(_0xc50712[_0x62d2('0x3d')][_0x62d2('0xbe')]){_0x35110d[_0x62d2('0xbf')]=[{'all':!![]}];}_0x35110d=_['merge']({},_0x35110d,_0xc50712['options']);return db[_0x62d2('0x34')][_0x62d2('0x5f')](_0x35110d)[_0x62d2('0x29')](handleEntityNotFound(_0xce9758,null))['then'](respondWithResult(_0xce9758,null))[_0x62d2('0x3a')](handleError(_0xce9758,null));};exports[_0x62d2('0xc0')]=function(_0x61744b,_0x153cdc){return db[_0x62d2('0x34')][_0x62d2('0xc0')](_0x61744b[_0x62d2('0xc1')],{})[_0x62d2('0x29')](respondWithResult(_0x153cdc,0xc9))[_0x62d2('0x3a')](handleError(_0x153cdc,null));};exports['update']=function(_0x5b7b7b,_0x1959a4){if(_0x5b7b7b['body']['id']){delete _0x5b7b7b[_0x62d2('0xc1')]['id'];}return db['MailInteraction'][_0x62d2('0x5f')]({'where':{'id':_0x5b7b7b[_0x62d2('0xbc')]['id']}})[_0x62d2('0x29')](handleEntityNotFound(_0x1959a4,null))[_0x62d2('0x29')](saveUpdates(_0x5b7b7b[_0x62d2('0xc1')],null))['then'](respondWithResult(_0x1959a4,null))[_0x62d2('0x3a')](handleError(_0x1959a4,null));};exports['destroy']=function(_0x177344,_0x802fc2){return db[_0x62d2('0x34')]['find']({'where':{'id':_0x177344[_0x62d2('0xbc')]['id']}})[_0x62d2('0x29')](handleEntityNotFound(_0x802fc2,null))['then'](removeEntity(_0x802fc2,null))[_0x62d2('0x3a')](handleError(_0x802fc2,null));};exports[_0x62d2('0xc2')]=function(_0xe3dff4,_0x46e147){return db[_0x62d2('0x34')][_0x62d2('0xc2')]()['then'](respondWithResult(_0x46e147,null))[_0x62d2('0x3a')](handleError(_0x46e147,null));};exports['addMessage']=function(_0xb3ac37,_0x47e23d,_0x424bb0){return db[_0x62d2('0xc3')][_0x62d2('0x5f')]({'where':{'id':_0xb3ac37[_0x62d2('0xbc')]['id']}})[_0x62d2('0x29')](handleEntityNotFound(_0x47e23d,null))[_0x62d2('0x29')](function(_0x5e6db0){if(_0x5e6db0){return _0x5e6db0[_0x62d2('0xc4')](_0xb3ac37['body'][_0x62d2('0xc5')],_[_0x62d2('0xc6')](_0xb3ac37[_0x62d2('0xc1')],[_0x62d2('0xc5'),'id'])||{});}})[_0x62d2('0x29')](respondWithResult(_0x47e23d,null))[_0x62d2('0x3a')](handleError(_0x47e23d,null));};exports[_0x62d2('0xc7')]=function(_0x54ff39,_0x271031,_0x32c5e3){var _0x4506df={'raw':![],'where':{}};var _0x329f05={};var _0x53a62f={'count':0x0,'rows':[]};return db[_0x62d2('0x34')][_0x62d2('0x35')]({'where':{'id':_0x54ff39[_0x62d2('0xbc')]['id']}})[_0x62d2('0x29')](handleEntityNotFound(_0x271031,null))[_0x62d2('0x29')](function(_0x207ac3){if(_0x207ac3){_0x329f05[_0x62d2('0x3f')]=_[_0x62d2('0x72')](db['MailMessage'][_0x62d2('0xc8')]);_0x329f05[_0x62d2('0x3d')]=_[_0x62d2('0x72')](_0x54ff39['query']);_0x329f05[_0x62d2('0x3e')]=_['intersection'](_0x329f05['model'],_0x329f05['query']);_0x4506df[_0x62d2('0x40')]=_['intersection'](_0x329f05[_0x62d2('0x3f')],qs[_0x62d2('0x41')](_0x54ff39[_0x62d2('0x3d')][_0x62d2('0x41')]));_0x4506df[_0x62d2('0x40')]=_0x4506df[_0x62d2('0x40')][_0x62d2('0x42')]?_0x4506df[_0x62d2('0x40')]:_0x329f05[_0x62d2('0x3f')];if(!_0x54ff39[_0x62d2('0x3d')]['hasOwnProperty'](_0x62d2('0x44'))){_0x4506df[_0x62d2('0x45')]=qs[_0x62d2('0x45')](_0x54ff39[_0x62d2('0x3d')][_0x62d2('0x45')]);_0x4506df[_0x62d2('0x23')]=qs['offset'](_0x54ff39[_0x62d2('0x3d')]['offset']);}_0x4506df['order']=qs[_0x62d2('0x47')](_0x54ff39['query']['sort']);_0x4506df[_0x62d2('0x75')]=qs['filters'](_['pick'](_0x54ff39[_0x62d2('0x3d')],_0x329f05[_0x62d2('0x3e')]));_0x4506df['where'][_0x62d2('0xc9')]=_0x207ac3['id'];if(_0x54ff39[_0x62d2('0x3d')][_0x62d2('0x82')]){_0x4506df[_0x62d2('0x75')]=_[_0x62d2('0xca')](_0x4506df['where'],{'$or':_[_0x62d2('0x30')](_0x4506df[_0x62d2('0x40')],function(_0x92102e){var _0x1c0727={};_0x1c0727[_0x92102e]={'$like':'%'+_0x54ff39[_0x62d2('0x3d')]['filter']+'%'};return _0x1c0727;})});}if(_0x54ff39[_0x62d2('0x3d')][_0x62d2('0x78')]){var _0x181e3e=_0x54ff39['query'][_0x62d2('0x78')][_0x62d2('0x65')](',');var _0x57e789={};_0x57e789[_0x181e3e[0x0]]={'$gte':moment(_0x181e3e[0x1])[_0x62d2('0xcb')](_0x62d2('0xcc'))};_0x4506df[_0x62d2('0x75')]=_[_0x62d2('0xca')](_0x4506df[_0x62d2('0x75')],_0x57e789);}_0x4506df=_['merge']({},_0x4506df,_0x54ff39['options']);return db['MailMessage'][_0x62d2('0x22')]({'where':_0x4506df['where']})[_0x62d2('0x29')](function(_0x50cae2){_0x53a62f[_0x62d2('0x22')]=_0x50cae2;if(_0x54ff39[_0x62d2('0x3d')]['includeAll']){_0x4506df[_0x62d2('0xbf')]=[{'all':!![]}];}return db[_0x62d2('0xc3')][_0x62d2('0xcd')](_0x4506df);})[_0x62d2('0x29')](function(_0x2d5258){_0x53a62f[_0x62d2('0xba')]=_0x2d5258;return _0x53a62f;});}})[_0x62d2('0x29')](respondWithFilteredResult(_0x271031,_0x4506df))[_0x62d2('0x3a')](handleError(_0x271031,null));};exports[_0x62d2('0xce')]=function(_0x284fbd,_0x9266db,_0x4002d1){return db[_0x62d2('0x34')][_0x62d2('0x5f')]({'where':{'id':_0x284fbd[_0x62d2('0xbc')]['id']}})[_0x62d2('0x29')](handleEntityNotFound(_0x9266db,null))[_0x62d2('0x29')](function(_0x3cdb93){if(_0x3cdb93){return _0x3cdb93[_0x62d2('0xcf')](_0x284fbd[_0x62d2('0xc1')][_0x62d2('0xc5')],_[_0x62d2('0xc6')](_0x284fbd['body'],[_0x62d2('0xc5'),'id'])||{})[_0x62d2('0xd0')](function(){return db[_0x62d2('0x6b')]['findAll']({'attributes':['id',_0x62d2('0x2d'),_0x62d2('0x49')],'where':{'id':_0x284fbd['body'][_0x62d2('0xc5')]}});})[_0x62d2('0x29')](function(_0x43d5f8){socket[_0x62d2('0xd1')](_0x62d2('0xd2'),{'id':Number(_0x284fbd[_0x62d2('0xbc')]['id']),'tags':_0x43d5f8||[]});return{'id':Number(_0x284fbd[_0x62d2('0xbc')]['id']),'tags':_0x43d5f8||[]};});}})['then'](respondWithResult(_0x9266db,null))['catch'](handleError(_0x9266db,null));};exports[_0x62d2('0xd3')]=function(_0x1f7227,_0x2e3c39,_0x5412b9){return db[_0x62d2('0x34')][_0x62d2('0x5f')]({'where':{'id':_0x1f7227[_0x62d2('0xbc')]['id']}})[_0x62d2('0x29')](handleEntityNotFound(_0x2e3c39,null))[_0x62d2('0x29')](function(_0x438627){if(_0x438627){return _0x438627[_0x62d2('0xd3')](_0x1f7227[_0x62d2('0x3d')][_0x62d2('0xc5')]);}})[_0x62d2('0x29')](respondWithStatusCode(_0x2e3c39,null))[_0x62d2('0x3a')](handleError(_0x2e3c39,null));};exports[_0x62d2('0xd4')]=function(_0x3682b1,_0x44b05d){var _0x46494d=moment()[_0x62d2('0xd5')]()['toString']();var _0x19f055=path['join'](config['root'],_0x62d2('0xd6'),_0x62d2('0xd7'),_0x62d2('0xd8'));var _0x2c53e4=path[_0x62d2('0xd9')](config[_0x62d2('0xda')],_0x62d2('0xd6'),_0x62d2('0xd7'),_0x62d2('0xdb'));var _0x241cd4=path['join'](_0x19f055,_0x46494d);var _0x3b4548=util[_0x62d2('0xcb')]('transcript-%d-%s.zip',_0x3682b1[_0x62d2('0xbc')]['id'],_0x46494d);var _0x36ea2c=path[_0x62d2('0xd9')](_0x19f055,_0x3b4548);var _0x16fe89=[];if(_0x3682b1[_0x62d2('0x3d')][_0x62d2('0xdb')]){_0x16fe89[_0x62d2('0xb8')]({'model':db['Attachment'],'as':'Attachments','raw':!![]});}var _0x4954be=[{'model':db[_0x62d2('0xc3')],'as':_0x62d2('0xdc'),'attributes':['id',_0x62d2('0xc1'),'from','to','cc',_0x62d2('0xdd'),'subject','createdAt'],'where':{'secret':![]},'order':qs[_0x62d2('0x47')]('id'),'include':_0x16fe89}];return db[_0x62d2('0x34')]['find']({'where':{'id':_0x3682b1[_0x62d2('0xbc')]['id']},'include':_0x4954be})[_0x62d2('0x29')](handleEntityNotFound(_0x44b05d,null))[_0x62d2('0x29')](function(_0x29a407){if(_0x29a407&&_0x29a407[_0x62d2('0xdc')]){var _0x4e0e97=_0x29a407['get']({'plain':!![]});fs[_0x62d2('0xde')](_0x241cd4);return BPromise[_0x62d2('0xdf')](_0x4e0e97['Messages'],function(_0x26b08a,_0x3808c3){var _0x209c70={'from':_0x26b08a[_0x62d2('0x4a')],'to':_0x26b08a['to'],'subject':_0x26b08a[_0x62d2('0xe0')],'html':_0x26b08a[_0x62d2('0xc1')],'headers':{'Date':moment(_0x26b08a['createdAt'])[_0x62d2('0xcb')](_0x62d2('0xe1'))},'attachments':[]};if(_0x26b08a['cc']){_0x209c70[_0x62d2('0xe2')]['Cc']=_0x26b08a['cc'];}if(_0x26b08a[_0x62d2('0xdd')]){_0x209c70[_0x62d2('0xe2')][_0x62d2('0xe3')]=_0x26b08a[_0x62d2('0xdd')];}return new BPromise(function(_0x52ab49,_0x30f0e7){if(_0x26b08a[_0x62d2('0xe4')]){for(var _0x592b8d=0x0;_0x592b8d<_0x26b08a['Attachments']['length'];_0x592b8d++){var _0x451fd2=_0x26b08a[_0x62d2('0xe4')][_0x592b8d];var _0x2c419a=path[_0x62d2('0xd9')](_0x2c53e4,_0x451fd2[_0x62d2('0xe5')]);if(fs[_0x62d2('0xe6')](_0x2c419a)){_0x209c70['attachments'][_0x62d2('0xb8')]({'name':_0x451fd2[_0x62d2('0x2d')],'contentType':_0x451fd2[_0x62d2('0x3c')],'data':fs[_0x62d2('0xe7')](_0x2c419a)});}}}emlformat[_0x62d2('0xe8')](_0x209c70,function(_0x1d0924,_0x5eb0de){if(_0x1d0924)return _0x30f0e7(_0x1d0924);fs[_0x62d2('0xe9')](path[_0x62d2('0xd9')](_0x241cd4,util[_0x62d2('0xcb')]('message%d.eml',_0x3808c3)),_0x5eb0de);return _0x52ab49(_0x5eb0de);});});})['then'](function(){return new BPromise(function(_0x25d132,_0x500257){zipdir(_0x241cd4,{'saveTo':_0x36ea2c},function(_0x40710d,_0x4315d1){if(_0x40710d)return _0x500257(_0x40710d);return _0x25d132(_0x4315d1);});})[_0x62d2('0x29')](function(){return new BPromise(function(_0x148558,_0x17744d){rimraf(_0x241cd4,function(_0x35b072){if(_0x35b072)_0x17744d(_0x35b072);return _0x148558();});});})['then'](function(){return _0x44b05d[_0x62d2('0xd4')](_0x36ea2c,_0x3b4548,function(_0xa3b2bb){if(_0xa3b2bb){console[_0x62d2('0xea')](_0x62d2('0xeb'),_0xa3b2bb);}else{fs[_0x62d2('0xec')](_0x36ea2c);}});});});}else{return _0x44b05d[_0x62d2('0x1e')](0xc8);}})[_0x62d2('0x3a')](handleError(_0x44b05d,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index 08edca6..1f6569a 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 _0x6d4a=['../../mysqldb','MailInteraction','MailMessage','setMaxListeners','update','getUsers','setDataValue','Users','map','findAll','then','length','emit','catch','hasOwnProperty','hook','exports'];(function(_0x5ce280,_0x227dc1){var _0x1afbb5=function(_0xf60fbf){while(--_0xf60fbf){_0x5ce280['push'](_0x5ce280['shift']());}};_0x1afbb5(++_0x227dc1);}(_0x6d4a,0x187));var _0xa6d4=function(_0x42152b,_0xd2b7f9){_0x42152b=_0x42152b-0x0;var _0x4d732c=_0x6d4a[_0x42152b];return _0x4d732c;};'use strict';var EventEmitter=require('events');var MailInteraction=require(_0xa6d4('0x0'))['db'][_0xa6d4('0x1')];var MailMessage=require(_0xa6d4('0x0'))['db'][_0xa6d4('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0xa6d4('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xa6d4('0x4'),'afterDestroy':'remove'};function emitEvent(_0x337369){return function(_0x31eb16,_0x459760,_0x592280){_0x31eb16[_0xa6d4('0x5')]({'attributes':['id'],'raw':!![]})['then'](function(_0x2bb178){_0x31eb16[_0xa6d4('0x6')](_0xa6d4('0x7'),_0x2bb178[_0xa6d4('0x8')](function(_0x32b8c4){return{'id':_0x32b8c4['id']};}));return MailMessage[_0xa6d4('0x9')]({'where':{'MailInteractionId':_0x31eb16['id'],'direction':'in','read':![]},'raw':!![]});})[_0xa6d4('0xa')](function(_0x25ff28){_0x31eb16[_0xa6d4('0x6')]('unreadMessages',_0x25ff28[_0xa6d4('0xb')]);MailInteractionEvents[_0xa6d4('0xc')](_0x337369+':'+_0x31eb16['id'],_0x31eb16);MailInteractionEvents[_0xa6d4('0xc')](_0x337369,_0x31eb16);_0x592280(null);})[_0xa6d4('0xd')](_0x592280(null));};}for(var e in events){if(events[_0xa6d4('0xe')](e)){var event=events[e];MailInteraction[_0xa6d4('0xf')](e,emitEvent(event));}}module[_0xa6d4('0x10')]=MailInteractionEvents; \ No newline at end of file +var _0xc4de=['setDataValue','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','MailInteraction','MailMessage','setMaxListeners','update','remove','then'];(function(_0xc4001c,_0x1bf8f0){var _0x49f7bc=function(_0x1059b8){while(--_0x1059b8){_0xc4001c['push'](_0xc4001c['shift']());}};_0x49f7bc(++_0x1bf8f0);}(_0xc4de,0xac));var _0xec4d=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0xc4de[_0x8c43de];return _0xa6591b;};'use strict';var EventEmitter=require(_0xec4d('0x0'));var MailInteraction=require(_0xec4d('0x1'))['db'][_0xec4d('0x2')];var MailMessage=require('../../mysqldb')['db'][_0xec4d('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0xec4d('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0xec4d('0x5'),'afterDestroy':_0xec4d('0x6')};function emitEvent(_0x2baa15){return function(_0x4fc4fc,_0xdb5327,_0x47d214){_0x4fc4fc['getUsers']({'attributes':['id'],'raw':!![]})[_0xec4d('0x7')](function(_0x382215){_0x4fc4fc[_0xec4d('0x8')]('Users',_0x382215[_0xec4d('0x9')](function(_0x42fe25){return{'id':_0x42fe25['id']};}));return MailMessage[_0xec4d('0xa')]({'where':{'MailInteractionId':_0x4fc4fc['id'],'direction':'in','read':![]},'raw':!![]});})[_0xec4d('0x7')](function(_0x6a6278){_0x4fc4fc['setDataValue'](_0xec4d('0xb'),_0x6a6278[_0xec4d('0xc')]);MailInteractionEvents[_0xec4d('0xd')](_0x2baa15+':'+_0x4fc4fc['id'],_0x4fc4fc);MailInteractionEvents[_0xec4d('0xd')](_0x2baa15,_0x4fc4fc);_0x47d214(null);})[_0xec4d('0xe')](_0x47d214(null));};}for(var e in events){if(events[_0xec4d('0xf')](e)){var event=events[e];MailInteraction[_0xec4d('0x10')](e,emitEvent(event));}}module[_0xec4d('0x11')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index a238875..044a403 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 _0x05e2=['utf8mb4','utf8mb4_unicode_ci','lodash','util','api','request-promise','rimraf','./mailInteraction.attributes','define','mail_interactions','fti_mail_interactions','subject','substatus','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','changed','models','get','update','then'];(function(_0x7d66d8,_0x29eb9c){var _0x2ad963=function(_0x8bce47){while(--_0x8bce47){_0x7d66d8['push'](_0x7d66d8['shift']());}};_0x2ad963(++_0x29eb9c);}(_0x05e2,0x116));var _0x205e=function(_0x4283c0,_0xc694d5){_0x4283c0=_0x4283c0-0x0;var _0x6b47ab=_0x05e2[_0x4283c0];return _0x6b47ab;};'use strict';var _=require(_0x205e('0x0'));var util=require(_0x205e('0x1'));var logger=require('../../config/logger')(_0x205e('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x205e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x205e('0x4'));var config=require('../../config/environment');var attributes=require(_0x205e('0x5'));module['exports']=function(_0x4f5e78,_0x118391){return _0x4f5e78[_0x205e('0x6')]('MailInteraction',attributes,{'tableName':_0x205e('0x7'),'paranoid':![],'indexes':[{'name':_0x205e('0x8'),'fields':[_0x205e('0x9'),'to'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x5721ec,_0x4182e9,_0x4b88fd){if(_0x5721ec[_0x205e('0xa')]){_0x5721ec[_0x205e('0xb')]=moment()[_0x205e('0xc')](_0x205e('0xd'));}if(_0x5721ec[_0x205e('0xe')]){_0x5721ec[_0x205e('0xf')]=moment()[_0x205e('0xc')]('YYYY-MM-DD\x20HH:mm:ss');}_0x4b88fd(null,_0x4182e9);},'beforeUpdate':function(_0x14fb28,_0x105795,_0x109ca0){if(_0x14fb28[_0x205e('0x10')](_0x205e('0xa'))){_0x14fb28[_0x205e('0xb')]=_0x14fb28['substatus']?moment()[_0x205e('0xc')](_0x205e('0xd')):null;}if(_0x14fb28[_0x205e('0x10')](_0x205e('0xe'))){_0x14fb28[_0x205e('0xf')]=moment()['format'](_0x205e('0xd'));_0x14fb28['substatus']=null;_0x14fb28[_0x205e('0xb')]=null;}_0x109ca0(null,_0x14fb28);},'afterUpdate':function(_0x1b779f,_0x55e2ae,_0x2f3a4b){var _0x42a3f2=_0x4f5e78[_0x205e('0x11')];var _0x508a3b=_0x1b779f[_0x205e('0x12')]({'plain':!![]});if(_0x508a3b[_0x205e('0xe')]){return _0x42a3f2['MailMessage'][_0x205e('0x13')]({'read':!![]},{'where':{'MailInteractionId':_0x508a3b['id']}})[_0x205e('0x14')](function(){_0x2f3a4b();})['catch'](function(_0x41d4f5){_0x2f3a4b(_0x41d4f5);});}else{_0x2f3a4b();}}},'charset':_0x205e('0x15'),'collate':_0x205e('0x16')});}; \ No newline at end of file +var _0x1ea1=['subject','substatus','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','changed','models','get','MailMessage','update','catch','utf8mb4_unicode_ci','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment','MailInteraction','mail_interactions'];(function(_0x39e62c,_0x296b08){var _0x37c42b=function(_0x3f8ed5){while(--_0x3f8ed5){_0x39e62c['push'](_0x39e62c['shift']());}};_0x37c42b(++_0x296b08);}(_0x1ea1,0xce));var _0x11ea=function(_0x8a7e38,_0x473a5d){_0x8a7e38=_0x8a7e38-0x0;var _0x228609=_0x1ea1[_0x8a7e38];return _0x228609;};'use strict';var _=require(_0x11ea('0x0'));var util=require(_0x11ea('0x1'));var logger=require('../../config/logger')(_0x11ea('0x2'));var moment=require(_0x11ea('0x3'));var BPromise=require('bluebird');var rp=require(_0x11ea('0x4'));var fs=require('fs');var path=require(_0x11ea('0x5'));var rimraf=require(_0x11ea('0x6'));var config=require(_0x11ea('0x7'));var attributes=require('./mailInteraction.attributes');module['exports']=function(_0x437188,_0x5afd4e){return _0x437188['define'](_0x11ea('0x8'),attributes,{'tableName':_0x11ea('0x9'),'paranoid':![],'indexes':[{'name':'fti_mail_interactions','fields':[_0x11ea('0xa'),'to'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x46515a,_0x5903dc,_0xe6faf6){if(_0x46515a[_0x11ea('0xb')]){_0x46515a[_0x11ea('0xc')]=moment()[_0x11ea('0xd')](_0x11ea('0xe'));}if(_0x46515a[_0x11ea('0xf')]){_0x46515a[_0x11ea('0x10')]=moment()['format'](_0x11ea('0xe'));}_0xe6faf6(null,_0x5903dc);},'beforeUpdate':function(_0x1ef328,_0x2c92b5,_0x3ec847){if(_0x1ef328[_0x11ea('0x11')](_0x11ea('0xb'))){_0x1ef328['substatusAt']=_0x1ef328['substatus']?moment()['format'](_0x11ea('0xe')):null;}if(_0x1ef328[_0x11ea('0x11')]('closed')){_0x1ef328[_0x11ea('0x10')]=moment()[_0x11ea('0xd')](_0x11ea('0xe'));_0x1ef328[_0x11ea('0xb')]=null;_0x1ef328[_0x11ea('0xc')]=null;}_0x3ec847(null,_0x1ef328);},'afterUpdate':function(_0x42fdd5,_0x263dbe,_0x5a6933){var _0xb3c2c4=_0x437188[_0x11ea('0x12')];var _0x156b35=_0x42fdd5[_0x11ea('0x13')]({'plain':!![]});if(_0x156b35[_0x11ea('0xf')]){return _0xb3c2c4[_0x11ea('0x14')][_0x11ea('0x15')]({'read':!![]},{'where':{'MailInteractionId':_0x156b35['id']}})['then'](function(){_0x5a6933();})[_0x11ea('0x16')](function(_0xa384ec){_0x5a6933(_0xa384ec);});}else{_0x5a6933();}}},'charset':'utf8mb4','collate':_0x11ea('0x17')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index 95f57d3..611883b 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 _0x3b59=['defaults','socket.io-emitter','./mailInteraction.socket','register','request','then','info','MailInteraction,\x20%s,\x20%s','debug','MailInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','UpdateMailInteraction','MailInteraction','options','where','attributes','limit','AddTagsToMailInteraction','find','addTags','body','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis'];(function(_0x52f1e6,_0xf70489){var _0x21f104=function(_0xb89f9e){while(--_0xb89f9e){_0x52f1e6['push'](_0x52f1e6['shift']());}};_0x21f104(++_0xf70489);}(_0x3b59,0x9c));var _0x93b5=function(_0x27cbf1,_0x14613c){_0x27cbf1=_0x27cbf1-0x0;var _0x1cfb81=_0x3b59[_0x27cbf1];return _0x1cfb81;};'use strict';var _=require(_0x93b5('0x0'));var util=require(_0x93b5('0x1'));var moment=require(_0x93b5('0x2'));var BPromise=require(_0x93b5('0x3'));var rs=require(_0x93b5('0x4'));var fs=require('fs');var Redis=require(_0x93b5('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x93b5('0x6'));var logger=require('../../config/logger')(_0x93b5('0x7'));var config=require(_0x93b5('0x8'));var jayson=require(_0x93b5('0x9'));var client=jayson[_0x93b5('0xa')]['http']({'port':0x232a});config[_0x93b5('0xb')]=_[_0x93b5('0xc')](config[_0x93b5('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x93b5('0xd'))(new Redis(config[_0x93b5('0xb')]));require(_0x93b5('0xe'))[_0x93b5('0xf')](socket);function respondWithRpcPromise(_0x2a49bb,_0x490b0d,_0x576916){return new BPromise(function(_0x13ebc9,_0x7787e5){return client[_0x93b5('0x10')](_0x2a49bb,_0x576916)[_0x93b5('0x11')](function(_0x47c236){logger[_0x93b5('0x12')](_0x93b5('0x13'),_0x490b0d,'request\x20sent');logger[_0x93b5('0x14')](_0x93b5('0x15'),_0x490b0d,_0x93b5('0x16'),JSON[_0x93b5('0x17')](_0x47c236));if(_0x47c236[_0x93b5('0x18')]){if(_0x47c236['error'][_0x93b5('0x19')]===0x1f4){logger[_0x93b5('0x18')]('MailInteraction,\x20%s,\x20%s',_0x490b0d,_0x47c236[_0x93b5('0x18')][_0x93b5('0x1a')]);return _0x7787e5(_0x47c236[_0x93b5('0x18')]['message']);}logger[_0x93b5('0x18')]('MailInteraction,\x20%s,\x20%s',_0x490b0d,_0x47c236['error'][_0x93b5('0x1a')]);return _0x13ebc9(_0x47c236['error'][_0x93b5('0x1a')]);}else{logger[_0x93b5('0x12')](_0x93b5('0x13'),_0x490b0d,'request\x20sent');_0x13ebc9(_0x47c236['result']['message']);}})[_0x93b5('0x1b')](function(_0x28f5cc){logger[_0x93b5('0x18')](_0x93b5('0x13'),_0x490b0d,_0x28f5cc);_0x7787e5(_0x28f5cc);});});}exports[_0x93b5('0x1c')]=function(_0x1f0196){var _0x2dd622=this;return new Promise(function(_0x2bd21b,_0x352cbe){return db[_0x93b5('0x1d')]['update'](_0x1f0196['body'],{'raw':_0x1f0196[_0x93b5('0x1e')]?_0x1f0196[_0x93b5('0x1e')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1f0196[_0x93b5('0x1e')]?_0x1f0196[_0x93b5('0x1e')][_0x93b5('0x1f')]||null:null,'attributes':_0x1f0196[_0x93b5('0x1e')]?_0x1f0196[_0x93b5('0x1e')][_0x93b5('0x20')]||null:null,'limit':_0x1f0196[_0x93b5('0x1e')]?_0x1f0196[_0x93b5('0x1e')][_0x93b5('0x21')]||null:null})[_0x93b5('0x11')](function(_0xf7b6fc){logger[_0x93b5('0x12')](_0x93b5('0x1c'),_0x1f0196);logger[_0x93b5('0x14')](_0x93b5('0x1c'),_0x1f0196,JSON[_0x93b5('0x17')](_0xf7b6fc));_0x2bd21b(_0xf7b6fc);})[_0x93b5('0x1b')](function(_0x11add6){logger['error'](_0x93b5('0x1c'),_0x11add6[_0x93b5('0x1a')],_0x1f0196);_0x352cbe(_0x2dd622[_0x93b5('0x18')](0x1f4,_0x11add6[_0x93b5('0x1a')]));});});};exports[_0x93b5('0x22')]=function(_0x3d3ace){return new Promise(function(_0x2dad64,_0x2905a8){return db['MailInteraction'][_0x93b5('0x23')]({'where':_0x3d3ace[_0x93b5('0x1e')]?_0x3d3ace['options'][_0x93b5('0x1f')]||null:null})['then'](function(_0x393b6b){if(_0x393b6b){return _0x393b6b[_0x93b5('0x24')](_0x3d3ace[_0x93b5('0x25')][_0x93b5('0x26')],_[_0x93b5('0x27')](_0x3d3ace[_0x93b5('0x25')],[_0x93b5('0x26'),'id'])||{});}})[_0x93b5('0x28')](function(_0x8504b8){logger[_0x93b5('0x12')]('AddTags',_0x3d3ace);logger[_0x93b5('0x14')]('AddTags',_0x3d3ace,JSON['stringify'](_0x8504b8));_0x2dad64(_0x8504b8);})['catch'](function(_0x5af234){logger[_0x93b5('0x18')](_0x93b5('0x29'),_0x5af234[_0x93b5('0x1a')],_0x3d3ace);_0x2905a8(_this[_0x93b5('0x18')](0x1f4,_0x5af234[_0x93b5('0x1a')]));});});}; \ No newline at end of file +var _0x1152=['UpdateMailInteraction','MailInteraction','update','body','options','raw','attributes','limit','AddTagsToMailInteraction','find','where','then','addTags','ids','spread','AddTags','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','socket.io-emitter','redis','./mailInteraction.socket','request','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','error','code','message','info','catch'];(function(_0x3c2a69,_0x4c8b41){var _0x596bc8=function(_0x1b4b7c){while(--_0x1b4b7c){_0x3c2a69['push'](_0x3c2a69['shift']());}};_0x596bc8(++_0x4c8b41);}(_0x1152,0x182));var _0x2115=function(_0x4fb6b6,_0x5eb1c7){_0x4fb6b6=_0x4fb6b6-0x0;var _0x3ea470=_0x1152[_0x4fb6b6];return _0x3ea470;};'use strict';var _=require(_0x2115('0x0'));var util=require(_0x2115('0x1'));var moment=require(_0x2115('0x2'));var BPromise=require(_0x2115('0x3'));var rs=require(_0x2115('0x4'));var fs=require('fs');var Redis=require(_0x2115('0x5'));var db=require(_0x2115('0x6'))['db'];var utils=require(_0x2115('0x7'));var logger=require('../../config/logger')(_0x2115('0x8'));var config=require('../../config/environment');var jayson=require(_0x2115('0x9'));var client=jayson[_0x2115('0xa')]['http']({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x2115('0xb'))(new Redis(config[_0x2115('0xc')]));require(_0x2115('0xd'))['register'](socket);function respondWithRpcPromise(_0x254648,_0x534958,_0x5ca468){return new BPromise(function(_0x225a1c,_0x272a95){return client[_0x2115('0xe')](_0x254648,_0x5ca468)['then'](function(_0x400b19){logger['info'](_0x2115('0xf'),_0x534958,_0x2115('0x10'));logger[_0x2115('0x11')](_0x2115('0x12'),_0x534958,_0x2115('0x10'),JSON['stringify'](_0x400b19));if(_0x400b19[_0x2115('0x13')]){if(_0x400b19['error'][_0x2115('0x14')]===0x1f4){logger[_0x2115('0x13')](_0x2115('0xf'),_0x534958,_0x400b19[_0x2115('0x13')][_0x2115('0x15')]);return _0x272a95(_0x400b19[_0x2115('0x13')][_0x2115('0x15')]);}logger['error'](_0x2115('0xf'),_0x534958,_0x400b19[_0x2115('0x13')][_0x2115('0x15')]);return _0x225a1c(_0x400b19[_0x2115('0x13')][_0x2115('0x15')]);}else{logger[_0x2115('0x16')](_0x2115('0xf'),_0x534958,_0x2115('0x10'));_0x225a1c(_0x400b19['result'][_0x2115('0x15')]);}})[_0x2115('0x17')](function(_0x38c26f){logger['error'](_0x2115('0xf'),_0x534958,_0x38c26f);_0x272a95(_0x38c26f);});});}exports[_0x2115('0x18')]=function(_0x1ca693){var _0x244cba=this;return new Promise(function(_0x534543,_0xcc2d7b){return db[_0x2115('0x19')][_0x2115('0x1a')](_0x1ca693[_0x2115('0x1b')],{'raw':_0x1ca693[_0x2115('0x1c')]?_0x1ca693[_0x2115('0x1c')][_0x2115('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1ca693[_0x2115('0x1c')]?_0x1ca693[_0x2115('0x1c')]['where']||null:null,'attributes':_0x1ca693[_0x2115('0x1c')]?_0x1ca693[_0x2115('0x1c')][_0x2115('0x1e')]||null:null,'limit':_0x1ca693[_0x2115('0x1c')]?_0x1ca693[_0x2115('0x1c')][_0x2115('0x1f')]||null:null})['then'](function(_0x485092){logger['info'](_0x2115('0x18'),_0x1ca693);logger[_0x2115('0x11')](_0x2115('0x18'),_0x1ca693,JSON['stringify'](_0x485092));_0x534543(_0x485092);})[_0x2115('0x17')](function(_0x115800){logger[_0x2115('0x13')](_0x2115('0x18'),_0x115800[_0x2115('0x15')],_0x1ca693);_0xcc2d7b(_0x244cba['error'](0x1f4,_0x115800[_0x2115('0x15')]));});});};exports[_0x2115('0x20')]=function(_0x4f3e8d){return new Promise(function(_0x358bf5,_0x33d81c){return db[_0x2115('0x19')][_0x2115('0x21')]({'where':_0x4f3e8d['options']?_0x4f3e8d[_0x2115('0x1c')][_0x2115('0x22')]||null:null})[_0x2115('0x23')](function(_0x314a4c){if(_0x314a4c){return _0x314a4c[_0x2115('0x24')](_0x4f3e8d[_0x2115('0x1b')]['ids'],_['omit'](_0x4f3e8d[_0x2115('0x1b')],[_0x2115('0x25'),'id'])||{});}})[_0x2115('0x26')](function(_0x1cab53){logger[_0x2115('0x16')]('AddTags',_0x4f3e8d);logger[_0x2115('0x11')](_0x2115('0x27'),_0x4f3e8d,JSON[_0x2115('0x28')](_0x1cab53));_0x358bf5(_0x1cab53);})['catch'](function(_0x26268b){logger['error'](_0x2115('0x27'),_0x26268b['message'],_0x4f3e8d);_0x33d81c(_this[_0x2115('0x13')](0x1f4,_0x26268b[_0x2115('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index b1fccfe..adf3ca4 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 _0x9391=['update','emit','removeListener','register','./mailInteraction.events','save'];(function(_0x35f7b3,_0x14ca65){var _0x5bcdef=function(_0x2796fb){while(--_0x2796fb){_0x35f7b3['push'](_0x35f7b3['shift']());}};_0x5bcdef(++_0x14ca65);}(_0x9391,0x1e4));var _0x1939=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x9391[_0x4a9fb1];return _0x348672;};'use strict';var MailInteractionEvents=require(_0x1939('0x0'));var events=[_0x1939('0x1'),'remove',_0x1939('0x2')];function createListener(_0x5c28e8,_0x3b1b2f){return function(_0xb78beb){_0x3b1b2f[_0x1939('0x3')](_0x5c28e8,_0xb78beb);};}function removeListener(_0x28c64b,_0x350261){return function(){MailInteractionEvents[_0x1939('0x4')](_0x28c64b,_0x350261);};}exports[_0x1939('0x5')]=function(_0x56f3a0){for(var _0x20530d=0x0,_0x184868=events['length'];_0x20530d<_0x184868;_0x20530d++){var _0x21193e=events[_0x20530d];var _0x6164f9=createListener('mailInteraction:'+_0x21193e,_0x56f3a0);MailInteractionEvents['on'](_0x21193e,_0x6164f9);}}; \ No newline at end of file +var _0x17b7=['update','emit','removeListener','register','mailInteraction:','./mailInteraction.events','save','remove'];(function(_0x1d9393,_0x3d1aaf){var _0x337720=function(_0x193863){while(--_0x193863){_0x1d9393['push'](_0x1d9393['shift']());}};_0x337720(++_0x3d1aaf);}(_0x17b7,0x1ad));var _0x717b=function(_0x5afe66,_0x3ec6bb){_0x5afe66=_0x5afe66-0x0;var _0x2e32ef=_0x17b7[_0x5afe66];return _0x2e32ef;};'use strict';var MailInteractionEvents=require(_0x717b('0x0'));var events=[_0x717b('0x1'),_0x717b('0x2'),_0x717b('0x3')];function createListener(_0x3881e,_0x5c7d8a){return function(_0x47f9e4){_0x5c7d8a[_0x717b('0x4')](_0x3881e,_0x47f9e4);};}function removeListener(_0x3505e3,_0xfe135f){return function(){MailInteractionEvents[_0x717b('0x5')](_0x3505e3,_0xfe135f);};}exports[_0x717b('0x6')]=function(_0x3796d1){for(var _0xf8d62b=0x0,_0x2085d1=events['length'];_0xf8d62b<_0x2085d1;_0xf8d62b++){var _0x2f6c56=events[_0xf8d62b];var _0x49ca14=createListener(_0x717b('0x7')+_0x2f6c56,_0x3796d1);MailInteractionEvents['on'](_0x2f6c56,_0x49ca14);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index ae6dac2..05288d0 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 _0x3e74=['path','connect-timeout','express','../../components/interaction/service','./mailMessage.controller','get','isAuthenticated','index','describe','/:id','download','post','tracked','mailmessage:create','create','update','put','accept','/:id/reject','delete','destroy','multer'];(function(_0x5ecc4d,_0x192051){var _0x5412f3=function(_0xd38f1b){while(--_0xd38f1b){_0x5ecc4d['push'](_0x5ecc4d['shift']());}};_0x5412f3(++_0x192051);}(_0x3e74,0x175));var _0x43e7=function(_0x2cf987,_0x33206c){_0x2cf987=_0x2cf987-0x0;var _0x20159b=_0x3e74[_0x2cf987];return _0x20159b;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x43e7('0x4'));var config=require('../../config/environment');var controller=require(_0x43e7('0x5'));router[_0x43e7('0x6')]('/',auth[_0x43e7('0x7')](),controller[_0x43e7('0x8')]);router[_0x43e7('0x6')]('/describe',auth[_0x43e7('0x7')](),controller[_0x43e7('0x9')]);router[_0x43e7('0x6')](_0x43e7('0xa'),auth[_0x43e7('0x7')](),controller['show']);router[_0x43e7('0x6')]('/:id/download',auth['isAuthenticated'](),controller[_0x43e7('0xb')]);router[_0x43e7('0xc')]('/',auth['isAuthenticated'](),interaction[_0x43e7('0xd')]('mail',_0x43e7('0xe')),controller[_0x43e7('0xf')]);router['put'](_0x43e7('0xa'),auth[_0x43e7('0x7')](),controller[_0x43e7('0x10')]);router[_0x43e7('0x11')]('/:id/accept',auth['isAuthenticated'](),controller[_0x43e7('0x12')]);router[_0x43e7('0x11')](_0x43e7('0x13'),auth['isAuthenticated'](),controller['reject']);router[_0x43e7('0x14')](_0x43e7('0xa'),auth[_0x43e7('0x7')](),controller[_0x43e7('0x15')]);module['exports']=router; \ No newline at end of file +var _0x55ca=['get','isAuthenticated','index','/describe','describe','show','download','post','tracked','mail','mailmessage:create','create','put','/:id','/:id/reject','reject','delete','destroy','exports','multer','util','Router','../../components/auth/service','../../config/environment','./mailMessage.controller'];(function(_0x4df33c,_0x214b29){var _0xfe7b04=function(_0x2d8243){while(--_0x2d8243){_0x4df33c['push'](_0x4df33c['shift']());}};_0xfe7b04(++_0x214b29);}(_0x55ca,0x126));var _0xa55c=function(_0x5e8eae,_0x4f81e0){_0x5e8eae=_0x5e8eae-0x0;var _0xdd09cd=_0x55ca[_0x5e8eae];return _0xdd09cd;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var auth=require(_0xa55c('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xa55c('0x4'));var controller=require(_0xa55c('0x5'));router[_0xa55c('0x6')]('/',auth[_0xa55c('0x7')](),controller[_0xa55c('0x8')]);router[_0xa55c('0x6')](_0xa55c('0x9'),auth['isAuthenticated'](),controller[_0xa55c('0xa')]);router[_0xa55c('0x6')]('/:id',auth[_0xa55c('0x7')](),controller[_0xa55c('0xb')]);router['get']('/:id/download',auth[_0xa55c('0x7')](),controller[_0xa55c('0xc')]);router[_0xa55c('0xd')]('/',auth[_0xa55c('0x7')](),interaction[_0xa55c('0xe')](_0xa55c('0xf'),_0xa55c('0x10')),controller[_0xa55c('0x11')]);router[_0xa55c('0x12')](_0xa55c('0x13'),auth['isAuthenticated'](),controller['update']);router[_0xa55c('0x12')]('/:id/accept',auth['isAuthenticated'](),controller['accept']);router[_0xa55c('0x12')](_0xa55c('0x14'),auth[_0xa55c('0x7')](),controller[_0xa55c('0x15')]);router[_0xa55c('0x16')](_0xa55c('0x13'),auth['isAuthenticated'](),controller[_0xa55c('0x17')]);module[_0xa55c('0x18')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index d5f95e3..9cd79c2 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 _0xe5af=['medium','ENUM','STRING','DATE','lodash','exports','long','TEXT'];(function(_0x5b5ae3,_0xff9830){var _0x242c57=function(_0x1f63ab){while(--_0x1f63ab){_0x5b5ae3['push'](_0x5b5ae3['shift']());}};_0x242c57(++_0xff9830);}(_0xe5af,0x9c));var _0xfe5a=function(_0x3d145d,_0x3aa561){_0x3d145d=_0x3d145d-0x0;var _0x200285=_0xe5af[_0x3d145d];return _0x200285;};'use strict';var Sequelize=require('sequelize');var _=require(_0xfe5a('0x0'));module[_0xfe5a('0x1')]={'body':{'type':Sequelize['TEXT'](_0xfe5a('0x2')),'allowNull':![]},'plainBody':{'type':Sequelize[_0xfe5a('0x3')](_0xfe5a('0x4'))},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xfe5a('0x5')]('in','out'),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0xfe5a('0x6')](0x1fe)},'from':{'type':Sequelize[_0xfe5a('0x6')]},'to':{'type':Sequelize['TEXT']('long')},'cc':{'type':Sequelize[_0xfe5a('0x3')](_0xfe5a('0x2'))},'bcc':{'type':Sequelize[_0xfe5a('0x3')](_0xfe5a('0x2'))},'subject':{'type':Sequelize['TEXT']},'sentAt':{'type':Sequelize[_0xfe5a('0x7')]},'attach':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'readAt':{'type':Sequelize[_0xfe5a('0x7')]},'originTo':{'type':Sequelize[_0xfe5a('0x3')]('long')},'originCc':{'type':Sequelize[_0xfe5a('0x3')](_0xfe5a('0x2'))}}; \ No newline at end of file +var _0x6209=['long','medium','ENUM','out','STRING','DATE','INTEGER','BOOLEAN','sequelize','lodash','exports','TEXT'];(function(_0x3e5c15,_0x9c7e77){var _0x44e954=function(_0x192e9b){while(--_0x192e9b){_0x3e5c15['push'](_0x3e5c15['shift']());}};_0x44e954(++_0x9c7e77);}(_0x6209,0x1e8));var _0x9620=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0x6209[_0x5b561d];return _0x431060;};'use strict';var Sequelize=require(_0x9620('0x0'));var _=require(_0x9620('0x1'));module[_0x9620('0x2')]={'body':{'type':Sequelize[_0x9620('0x3')](_0x9620('0x4')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x9620('0x3')](_0x9620('0x5'))},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x9620('0x6')]('in',_0x9620('0x7')),'defaultValue':_0x9620('0x7'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0x1fe)},'from':{'type':Sequelize[_0x9620('0x8')]},'to':{'type':Sequelize[_0x9620('0x3')](_0x9620('0x4'))},'cc':{'type':Sequelize[_0x9620('0x3')]('long')},'bcc':{'type':Sequelize['TEXT'](_0x9620('0x4'))},'subject':{'type':Sequelize['TEXT']},'sentAt':{'type':Sequelize[_0x9620('0x9')]},'attach':{'type':Sequelize[_0x9620('0xa')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x9620('0xb')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x9620('0x9')]},'originTo':{'type':Sequelize[_0x9620('0x3')](_0x9620('0x4'))},'originCc':{'type':Sequelize[_0x9620('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 1012e0f..ef1dd1b 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 _0x9f0e=['sendStatus','stack','name','send','index','fieldName','type','key','model','map','keys','filters','query','attributes','fields','length','hasOwnProperty','offset','order','sort','pick','filter','merge','where','VIRTUAL','options','MailMessage','includeAll','rows','params','rawAttributes','intersection','include','find','body','describe','create','direction','out','split','MailAccount','List','CmContact','Contacts','updatedAt','DESC','MailServerOut','Smtp','isNil','service','host','port','secure','auth','user','pass','attachments','join','server/files/attachments','basename','defaults','ListId','List\x20not\x20found','YYYY-MM-DD\x20HH:mm:ss','mail-interactions','accept','read','UserId','Contact','get','read1stAt','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','interface','SIP/%s','channel','event','EventManager','acceptmessage','mail','agent','MailInteraction','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectmessage','download','unix','toString','root','server','files','format','from','bcc','subject','createdAt','Attachment','Attachments','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','push','readFileSync','writeFileSync','err','unlinkSync','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','redis','socket.io-emitter','./mailMessage.socket','jayson/promise','client','http','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','request\x20sent','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','MailMessage,\x20%s,\x20%s','message','result','catch','status','end','count','limit','set','json','apply','reject','save','update','destroy'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x9f0e,0x111));var _0xe9f0=function(_0xee9611,_0x59e13c){_0xee9611=_0xee9611-0x0;var _0x1d2c94=_0x9f0e[_0xee9611];return _0x1d2c94;};'use strict';var pdf=require(_0xe9f0('0x0'));var emlformat=require(_0xe9f0('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xe9f0('0x2'));var jsonpatch=require(_0xe9f0('0x3'));var rp=require(_0xe9f0('0x4'));var moment=require(_0xe9f0('0x5'));var BPromise=require(_0xe9f0('0x6'));var Mustache=require(_0xe9f0('0x7'));var util=require(_0xe9f0('0x8'));var path=require(_0xe9f0('0x9'));var sox=require(_0xe9f0('0xa'));var csv=require(_0xe9f0('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xe9f0('0xc'));var squel=require(_0xe9f0('0xd'));var crypto=require('crypto');var jsforce=require(_0xe9f0('0xe'));var deskjs=require(_0xe9f0('0xf'));var toCsv=require(_0xe9f0('0xb'));var querystring=require(_0xe9f0('0x10'));var Papa=require(_0xe9f0('0x11'));var Redis=require(_0xe9f0('0x12'));var authService=require(_0xe9f0('0x13'));var qs=require(_0xe9f0('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe9f0('0x15'));var logger=require(_0xe9f0('0x16'))('api');var utils=require('../../config/utils');var config=require(_0xe9f0('0x17'));var db=require(_0xe9f0('0x18'))['db'];config[_0xe9f0('0x19')]=_['defaults'](config[_0xe9f0('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0xe9f0('0x1a'))(new Redis(config['redis']));require(_0xe9f0('0x1b'))['register'](socket);var jayson=require(_0xe9f0('0x1c'));var client=jayson[_0xe9f0('0x1d')][_0xe9f0('0x1e')]({'port':0x232c});var client9003=jayson[_0xe9f0('0x1d')][_0xe9f0('0x1e')]({'port':0x232b});var client9002=jayson['client'][_0xe9f0('0x1e')]({'port':0x232a});function checkPasswordPattern(_0x5a2549,_0x5efc61,_0x369287){if(_0x369287){var _0x470a8c=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x470a8c['test'](_0x5efc61)){return _0x5a2549;}else{throw new db['Sequelize']['ValidationError'](_0xe9f0('0x1f'));}}else{return _0x5a2549;}}function respondWithRpcPromise(_0x501089,_0x5096d3,_0x5752d8,_0x22404b){return new BPromise(function(_0x2f1c01,_0x36dee6){var _0x1f1780=_0x22404b||client;return _0x1f1780[_0xe9f0('0x20')](_0x501089,_0x5752d8)[_0xe9f0('0x21')](function(_0x65bcdb){logger[_0xe9f0('0x22')]('MailMessage,\x20%s,\x20%s',_0x5096d3,_0xe9f0('0x23'));logger['debug'](_0xe9f0('0x24'),_0x5096d3,'request\x20sent',JSON[_0xe9f0('0x25')](_0x65bcdb));if(_0x65bcdb[_0xe9f0('0x26')]){if(_0x65bcdb[_0xe9f0('0x26')][_0xe9f0('0x27')]===0x1f4){logger[_0xe9f0('0x26')](_0xe9f0('0x28'),_0x5096d3,_0x65bcdb[_0xe9f0('0x26')]['message']);return _0x36dee6(_0x65bcdb['error'][_0xe9f0('0x29')]);}logger['error'](_0xe9f0('0x28'),_0x5096d3,_0x65bcdb[_0xe9f0('0x26')]['message']);return _0x2f1c01(_0x65bcdb[_0xe9f0('0x26')][_0xe9f0('0x29')]);}else{logger[_0xe9f0('0x22')]('MailMessage,\x20%s,\x20%s',_0x5096d3,'request\x20sent');_0x2f1c01(_0x65bcdb[_0xe9f0('0x2a')][_0xe9f0('0x29')]);}})[_0xe9f0('0x2b')](function(_0x1f4b8b){logger[_0xe9f0('0x26')](_0xe9f0('0x28'),_0x5096d3,_0x1f4b8b);_0x36dee6(_0x1f4b8b);});});}function respondWithStatusCode(_0x40d5dd,_0x2cd187){_0x2cd187=_0x2cd187||0xcc;return function(_0x7ff662){if(_0x7ff662){return _0x40d5dd['sendStatus'](_0x2cd187);}return _0x40d5dd[_0xe9f0('0x2c')](_0x2cd187)[_0xe9f0('0x2d')]();};}function respondWithResult(_0x3db536,_0x299524){_0x299524=_0x299524||0xc8;return function(_0x95eb06){if(_0x95eb06){return _0x3db536['status'](_0x299524)['json'](_0x95eb06);}};}function respondWithFilteredResult(_0x316eb1,_0x16784d){return function(_0x21ad89){if(_0x21ad89){var _0x3247ea=_0x21ad89[_0xe9f0('0x2e')],_0x15586a=_0x16784d['offset'],_0x38b2c5=_0x16784d['offset']+_0x16784d[_0xe9f0('0x2f')],_0x1f002e;if(_0x38b2c5>=_0x3247ea){_0x38b2c5=_0x3247ea;_0x1f002e=0xc8;}else{_0x1f002e=0xce;}_0x316eb1[_0xe9f0('0x2c')](_0x1f002e);return _0x316eb1[_0xe9f0('0x30')]('Content-Range',_0x15586a+'-'+_0x38b2c5+'/'+_0x3247ea)[_0xe9f0('0x31')](_0x21ad89);}return null;};}function patchUpdates(_0x3a9861){return function(_0x27c2da){try{jsonpatch[_0xe9f0('0x32')](_0x27c2da,_0x3a9861,!![]);}catch(_0x478385){return BPromise[_0xe9f0('0x33')](_0x478385);}return _0x27c2da[_0xe9f0('0x34')]();};}function saveUpdates(_0x40e530,_0x1bdbb4){return function(_0x1cdf0d){if(_0x1cdf0d){return _0x1cdf0d[_0xe9f0('0x35')](_0x40e530)[_0xe9f0('0x21')](function(_0x57302d){return _0x57302d;});}return null;};}function removeEntity(_0x5334aa,_0x1e9d3f){return function(_0x41cf8f){if(_0x41cf8f){return _0x41cf8f[_0xe9f0('0x36')]()[_0xe9f0('0x21')](function(){_0x5334aa[_0xe9f0('0x2c')](0xcc)[_0xe9f0('0x2d')]();});}};}function handleEntityNotFound(_0x5bcc7d,_0x44f852){return function(_0x17cfed){if(!_0x17cfed){_0x5bcc7d[_0xe9f0('0x37')](0x194);}return _0x17cfed;};}function handleError(_0x2f8845,_0x4e151f){_0x4e151f=_0x4e151f||0x1f4;return function(_0x24bf8d){logger['error'](_0x24bf8d[_0xe9f0('0x38')]);if(_0x24bf8d[_0xe9f0('0x39')]){delete _0x24bf8d[_0xe9f0('0x39')];}_0x2f8845[_0xe9f0('0x2c')](_0x4e151f)[_0xe9f0('0x3a')](_0x24bf8d);};}exports[_0xe9f0('0x3b')]=function(_0x1061c9,_0x20a819){var _0x2243fe={},_0x52e614={},_0x3f4195={'count':0x0,'rows':[]};var _0x44c1a5=_['map'](db['MailMessage']['rawAttributes'],function(_0x611d3e){return{'name':_0x611d3e[_0xe9f0('0x3c')],'type':_0x611d3e[_0xe9f0('0x3d')][_0xe9f0('0x3e')]};});_0x52e614[_0xe9f0('0x3f')]=_[_0xe9f0('0x40')](_0x44c1a5,_0xe9f0('0x39'));_0x52e614['query']=_[_0xe9f0('0x41')](_0x1061c9['query']);_0x52e614[_0xe9f0('0x42')]=_['intersection'](_0x52e614[_0xe9f0('0x3f')],_0x52e614[_0xe9f0('0x43')]);_0x2243fe[_0xe9f0('0x44')]=_['intersection'](_0x52e614[_0xe9f0('0x3f')],qs['fields'](_0x1061c9[_0xe9f0('0x43')][_0xe9f0('0x45')]));_0x2243fe[_0xe9f0('0x44')]=_0x2243fe[_0xe9f0('0x44')][_0xe9f0('0x46')]?_0x2243fe[_0xe9f0('0x44')]:_0x52e614[_0xe9f0('0x3f')];if(!_0x1061c9[_0xe9f0('0x43')][_0xe9f0('0x47')]('nolimit')){_0x2243fe[_0xe9f0('0x2f')]=qs[_0xe9f0('0x2f')](_0x1061c9[_0xe9f0('0x43')][_0xe9f0('0x2f')]);_0x2243fe[_0xe9f0('0x48')]=qs[_0xe9f0('0x48')](_0x1061c9[_0xe9f0('0x43')][_0xe9f0('0x48')]);}_0x2243fe[_0xe9f0('0x49')]=qs[_0xe9f0('0x4a')](_0x1061c9[_0xe9f0('0x43')]['sort']);_0x2243fe['where']=qs[_0xe9f0('0x42')](_[_0xe9f0('0x4b')](_0x1061c9[_0xe9f0('0x43')],_0x52e614[_0xe9f0('0x42')]));if(_0x1061c9['query'][_0xe9f0('0x4c')]){_0x2243fe['where']=_[_0xe9f0('0x4d')](_0x2243fe[_0xe9f0('0x4e')],{'$or':_['map'](_0x44c1a5,function(_0x44764c){if(_0x44764c[_0xe9f0('0x3d')]!==_0xe9f0('0x4f')){var _0x10a139={};_0x10a139[_0x44764c[_0xe9f0('0x39')]]={'$like':'%'+_0x1061c9['query']['filter']+'%'};return _0x10a139;}})});}_0x2243fe=_[_0xe9f0('0x4d')]({},_0x2243fe,_0x1061c9[_0xe9f0('0x50')]);var _0x57a45d={'where':_0x2243fe[_0xe9f0('0x4e')]};return db[_0xe9f0('0x51')][_0xe9f0('0x2e')](_0x57a45d)['then'](function(_0x2e6c2e){_0x3f4195[_0xe9f0('0x2e')]=_0x2e6c2e;if(_0x1061c9['query'][_0xe9f0('0x52')]){_0x2243fe['include']=[{'all':!![]}];}return db['MailMessage']['findAll'](_0x2243fe);})[_0xe9f0('0x21')](function(_0x547ba2){_0x3f4195[_0xe9f0('0x53')]=_0x547ba2;return _0x3f4195;})[_0xe9f0('0x21')](respondWithFilteredResult(_0x20a819,_0x2243fe))['catch'](handleError(_0x20a819,null));};exports['show']=function(_0x149dac,_0x2bbbc2){var _0x53453b={'raw':!![],'where':{'id':_0x149dac[_0xe9f0('0x54')]['id']}},_0x3fd7c6={};_0x3fd7c6['model']=_[_0xe9f0('0x41')](db[_0xe9f0('0x51')][_0xe9f0('0x55')]);_0x3fd7c6[_0xe9f0('0x43')]=_[_0xe9f0('0x41')](_0x149dac[_0xe9f0('0x43')]);_0x3fd7c6[_0xe9f0('0x42')]=_[_0xe9f0('0x56')](_0x3fd7c6[_0xe9f0('0x3f')],_0x3fd7c6[_0xe9f0('0x43')]);_0x53453b[_0xe9f0('0x44')]=_[_0xe9f0('0x56')](_0x3fd7c6[_0xe9f0('0x3f')],qs[_0xe9f0('0x45')](_0x149dac[_0xe9f0('0x43')][_0xe9f0('0x45')]));_0x53453b[_0xe9f0('0x44')]=_0x53453b[_0xe9f0('0x44')][_0xe9f0('0x46')]?_0x53453b[_0xe9f0('0x44')]:_0x3fd7c6['model'];if(_0x149dac[_0xe9f0('0x43')][_0xe9f0('0x52')]){_0x53453b[_0xe9f0('0x57')]=[{'all':!![]}];}_0x53453b=_[_0xe9f0('0x4d')]({},_0x53453b,_0x149dac[_0xe9f0('0x50')]);return db['MailMessage'][_0xe9f0('0x58')](_0x53453b)['then'](handleEntityNotFound(_0x2bbbc2,null))[_0xe9f0('0x21')](respondWithResult(_0x2bbbc2,null))['catch'](handleError(_0x2bbbc2,null));};exports[_0xe9f0('0x35')]=function(_0x367f51,_0x547409){if(_0x367f51[_0xe9f0('0x59')]['id']){delete _0x367f51['body']['id'];}return db[_0xe9f0('0x51')][_0xe9f0('0x58')]({'where':{'id':_0x367f51[_0xe9f0('0x54')]['id']}})[_0xe9f0('0x21')](handleEntityNotFound(_0x547409,null))['then'](saveUpdates(_0x367f51['body'],null))['then'](respondWithResult(_0x547409,null))[_0xe9f0('0x2b')](handleError(_0x547409,null));};exports['destroy']=function(_0x3281a0,_0xb69a9){return db[_0xe9f0('0x51')]['find']({'where':{'id':_0x3281a0[_0xe9f0('0x54')]['id']}})['then'](handleEntityNotFound(_0xb69a9,null))[_0xe9f0('0x21')](removeEntity(_0xb69a9,null))[_0xe9f0('0x2b')](handleError(_0xb69a9,null));};exports[_0xe9f0('0x5a')]=function(_0x47ffbe,_0x570d88){return db[_0xe9f0('0x51')][_0xe9f0('0x5a')]()[_0xe9f0('0x21')](respondWithResult(_0x570d88,null))[_0xe9f0('0x2b')](handleError(_0x570d88,null));};exports[_0xe9f0('0x5b')]=function(_0x26a987,_0x9be278){return db[_0xe9f0('0x51')][_0xe9f0('0x5b')](_0x26a987[_0xe9f0('0x59')])['then'](function(_0x1bbf2f){if(_0x1bbf2f){if(_0x1bbf2f[_0xe9f0('0x5c')]===_0xe9f0('0x5d')&&!_0x1bbf2f['secret']){var _0x3fa1fa,_0x2e036b,_0x4bec9f;if(_0x26a987[_0xe9f0('0x59')]['to']){_0x2e036b=_0x26a987[_0xe9f0('0x59')]['to'][_0xe9f0('0x5e')](',')[0x0];}return db[_0xe9f0('0x5f')]['findOne']({'where':{'id':_0x1bbf2f['MailAccountId']},'include':[{'model':db['CmList'],'as':_0xe9f0('0x60'),'include':[{'model':db[_0xe9f0('0x61')],'as':_0xe9f0('0x62'),'where':{'email':_0x2e036b},'limit':0x1,'order':[[_0xe9f0('0x63'),_0xe9f0('0x64')]]}]},{'model':db[_0xe9f0('0x65')],'as':_0xe9f0('0x66'),'raw':!![]}]})[_0xe9f0('0x21')](function(_0x82d200){_0x3fa1fa=_0x82d200;if(_0x3fa1fa&&_0x3fa1fa[_0xe9f0('0x66')]){var _0x1a3a7e={'tls':{'rejectUnauthorized':![]}};if(_[_0xe9f0('0x67')](_0x3fa1fa[_0xe9f0('0x66')][_0xe9f0('0x68')])){_0x1a3a7e[_0xe9f0('0x69')]=_0x3fa1fa[_0xe9f0('0x66')][_0xe9f0('0x69')];_0x1a3a7e[_0xe9f0('0x6a')]=_0x3fa1fa[_0xe9f0('0x66')][_0xe9f0('0x6a')];_0x1a3a7e[_0xe9f0('0x6b')]=_0x3fa1fa['Smtp'][_0xe9f0('0x6b')];if(_0x3fa1fa['Smtp']['authentication']){_0x1a3a7e[_0xe9f0('0x6c')]={'user':_0x3fa1fa['Smtp'][_0xe9f0('0x6d')],'pass':_0x3fa1fa[_0xe9f0('0x66')][_0xe9f0('0x6e')]};}}else{_0x1a3a7e['service']=_0x3fa1fa[_0xe9f0('0x66')][_0xe9f0('0x68')];_0x1a3a7e[_0xe9f0('0x6c')]={'user':_0x3fa1fa[_0xe9f0('0x66')][_0xe9f0('0x6d')],'pass':_0x3fa1fa[_0xe9f0('0x66')][_0xe9f0('0x6e')]};_0x1a3a7e[_0xe9f0('0x6b')]=_0x3fa1fa[_0xe9f0('0x66')]['secure'];}if(_0x26a987[_0xe9f0('0x59')][_0xe9f0('0x6f')]&&_0x26a987[_0xe9f0('0x59')][_0xe9f0('0x6f')]['length']){for(var _0x155312=0x0;_0x155312<_0x26a987['body'][_0xe9f0('0x6f')][_0xe9f0('0x46')];_0x155312+=0x1){_0x26a987[_0xe9f0('0x59')][_0xe9f0('0x6f')][_0x155312]={'filename':_0x26a987[_0xe9f0('0x59')]['attachments'][_0x155312][_0xe9f0('0x39')],'path':path[_0xe9f0('0x70')](config['root'],_0xe9f0('0x71'),_0x26a987[_0xe9f0('0x59')][_0xe9f0('0x6f')][_0x155312][_0xe9f0('0x72')])};}}_0x4bec9f={'account':_0x1a3a7e,'message':_0x26a987[_0xe9f0('0x59')]};return;}})[_0xe9f0('0x21')](function(){if(_0x3fa1fa[_0xe9f0('0x60')]){if(_0x3fa1fa[_0xe9f0('0x60')][_0xe9f0('0x62')][_0xe9f0('0x46')]){return _0x3fa1fa[_0xe9f0('0x60')]['Contacts'][0x0];}else{return db['CmContact'][_0xe9f0('0x5b')](_[_0xe9f0('0x73')](_0x26a987[_0xe9f0('0x59')],{'firstName':_0x26a987[_0xe9f0('0x59')]['to'],'email':_0x26a987['body']['to'],'phone':_0x26a987[_0xe9f0('0x59')]['to'],'ListId':_0x3fa1fa[_0xe9f0('0x74')]}));}}else{throw new Error(_0xe9f0('0x75'));}})[_0xe9f0('0x21')](function(){if(_0x4bec9f){return respondWithRpcPromise('SendMail','sendMail',_0x4bec9f,client9003)[_0xe9f0('0x21')](function(_0x519a24){return _0x1bbf2f['update']({'read':!![],'messageId':_0x519a24['messageId'],'sentAt':moment()['format'](_0xe9f0('0x76'))});})[_0xe9f0('0x2b')](function(_0x22924e){logger['error']('%s',JSON[_0xe9f0('0x25')](_0x22924e));return _0x1bbf2f;});}return _0x1bbf2f;});}return _0x1bbf2f;}})[_0xe9f0('0x21')](respondWithResult(_0x9be278,0xc9))[_0xe9f0('0x2b')](handleError(_0x9be278,null));};var interaction_log=require('../../config/logger')(_0xe9f0('0x77'));exports[_0xe9f0('0x78')]=function(_0x17376b,_0x40c955,_0x1c8a9a){var _0x2ee4c0={'channel':'mail'};if(_0x17376b[_0xe9f0('0x59')]['id']){delete _0x17376b[_0xe9f0('0x59')]['id'];}_0x17376b[_0xe9f0('0x59')][_0xe9f0('0x79')]=!![];_0x17376b[_0xe9f0('0x59')]['readAt']=moment()['format'](_0xe9f0('0x76'));_0x17376b[_0xe9f0('0x59')]['UserId']=_0x17376b[_0xe9f0('0x59')][_0xe9f0('0x7a')]||_0x17376b[_0xe9f0('0x6d')]['id'];return db[_0xe9f0('0x51')][_0xe9f0('0x58')]({'where':{'id':_0x17376b['params']['id'],'UserId':null},'include':[{'model':db[_0xe9f0('0x61')],'as':_0xe9f0('0x7b')}]})[_0xe9f0('0x21')](handleEntityNotFound(_0x40c955,null))[_0xe9f0('0x21')](saveUpdates(_0x17376b[_0xe9f0('0x59')],null))[_0xe9f0('0x21')](function(_0x129e10){if(_0x129e10){_0x2ee4c0[_0xe9f0('0x29')]=_0x129e10[_0xe9f0('0x7c')]({'plain':!![]});return db['MailInteraction'][_0xe9f0('0x58')]({'where':{'id':_0x129e10['MailInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x40c955,null))[_0xe9f0('0x21')](function(_0x3c5f53){if(_0x3c5f53){return _0x3c5f53[_0xe9f0('0x35')]({'UserId':_0x17376b['body']['UserId'],'read1stAt':_[_0xe9f0('0x67')](_0x3c5f53[_0xe9f0('0x7d')])?moment()['format'](_0xe9f0('0x76')):undefined});}return null;})['then'](function(_0x52d3c2){if(_0x52d3c2){_0x2ee4c0[_0xe9f0('0x7e')]=_0x52d3c2[_0xe9f0('0x7c')]({'plain':!![]});interaction_log[_0xe9f0('0x22')](_0xe9f0('0x7f'),_0x17376b[_0xe9f0('0x6d')]['id'],_0x17376b[_0xe9f0('0x6d')][_0xe9f0('0x39')],_0x17376b[_0xe9f0('0x6d')][_0xe9f0('0x80')],_0x2ee4c0[_0xe9f0('0x7e')]['id'],_0x17376b[_0xe9f0('0x59')]?JSON[_0xe9f0('0x25')](_0x17376b[_0xe9f0('0x59')]):_0xe9f0('0x81'));return respondWithRpcPromise(_0xe9f0('0x82'),_0xe9f0('0x83'),_0x2ee4c0);}return null;})[_0xe9f0('0x21')](function(_0xbe1eb9){if(_0xbe1eb9){if(_0x17376b[_0xe9f0('0x59')]['manual']){_0x2ee4c0[_0xe9f0('0x29')][_0xe9f0('0x84')]=util['format'](_0xe9f0('0x85'),_0x17376b[_0xe9f0('0x6d')]['name']);_0x2ee4c0['message'][_0xe9f0('0x86')]=_0x2ee4c0[_0xe9f0('0x86')];_0x2ee4c0[_0xe9f0('0x29')][_0xe9f0('0x87')]=_0xe9f0('0x78');return respondWithRpcPromise('EventManager',_0xe9f0('0x88'),{'event':_0xe9f0('0x89'),'message':_0x2ee4c0[_0xe9f0('0x29')]},client9002)[_0xe9f0('0x21')](function(){return _0x2ee4c0;});}return _0x2ee4c0;}return null;})[_0xe9f0('0x21')](respondWithResult(_0x40c955,null))[_0xe9f0('0x2b')](handleError(_0x40c955,null));};var interaction_log=require('../../config/logger')(_0xe9f0('0x77'));exports[_0xe9f0('0x33')]=function(_0x4de113,_0x40dc5a,_0x20a817){var _0x25e121={'agent':{},'channel':_0xe9f0('0x8a')};if(_0x4de113[_0xe9f0('0x59')]['id']){delete _0x4de113[_0xe9f0('0x59')]['id'];}_0x4de113['body']['UserId']=_0x4de113['body'][_0xe9f0('0x7a')]||_0x4de113[_0xe9f0('0x6d')]['id'];_0x25e121[_0xe9f0('0x8b')]['id']=_0x4de113[_0xe9f0('0x59')]['UserId'];return db[_0xe9f0('0x51')][_0xe9f0('0x58')]({'where':{'id':_0x4de113[_0xe9f0('0x54')]['id'],'UserId':null}})[_0xe9f0('0x21')](handleEntityNotFound(_0x40dc5a,null))[_0xe9f0('0x21')](function(_0x5c7269){if(_0x5c7269){_0x25e121['message']=_0x5c7269[_0xe9f0('0x7c')]({'plain':!![]});return db[_0xe9f0('0x8c')][_0xe9f0('0x58')]({'where':{'id':_0x5c7269['MailInteractionId']}});}return null;})[_0xe9f0('0x21')](handleEntityNotFound(_0x40dc5a,null))[_0xe9f0('0x21')](function(_0x28f5f5){if(_0x28f5f5){_0x25e121[_0xe9f0('0x7e')]=_0x28f5f5[_0xe9f0('0x7c')]({'plain':!![]});interaction_log['info'](_0xe9f0('0x8d'),_0x4de113[_0xe9f0('0x6d')]['id'],_0x4de113[_0xe9f0('0x6d')][_0xe9f0('0x39')],_0x4de113[_0xe9f0('0x6d')][_0xe9f0('0x80')],_0x25e121[_0xe9f0('0x7e')]['id'],_0x4de113['body']?JSON[_0xe9f0('0x25')](_0x4de113[_0xe9f0('0x59')]):'null');return respondWithRpcPromise('RejectMessage','rejectMessage',_0x25e121);}return null;})['then'](function(_0x3e273d){if(_0x3e273d){_0x3e273d['message']['interface']=util['format'](_0xe9f0('0x85'),_0x4de113['user'][_0xe9f0('0x39')]);_0x3e273d[_0xe9f0('0x29')][_0xe9f0('0x86')]=_0x25e121[_0xe9f0('0x86')];_0x3e273d['message']['event']='reject';respondWithRpcPromise(_0xe9f0('0x88'),_0xe9f0('0x88'),{'event':_0xe9f0('0x8e'),'message':_0x3e273d[_0xe9f0('0x29')]},client9002);return _0x25e121;}return null;})['then'](respondWithResult(_0x40dc5a,null))[_0xe9f0('0x2b')](handleError(_0x40dc5a,null));};exports[_0xe9f0('0x8f')]=function(_0x43ea07,_0x144d9a){var _0x32285e=moment()[_0xe9f0('0x90')]()[_0xe9f0('0x91')]();var _0x4b25fe=path[_0xe9f0('0x70')](config[_0xe9f0('0x92')],_0xe9f0('0x93'),_0xe9f0('0x94'),'tmp');var _0x2d53c9=path[_0xe9f0('0x70')](config[_0xe9f0('0x92')],_0xe9f0('0x93'),_0xe9f0('0x94'),'attachments');var _0x5396e2=util[_0xe9f0('0x95')]('message-%s.eml',_0x32285e);return db[_0xe9f0('0x51')][_0xe9f0('0x58')]({'where':{'id':_0x43ea07['params']['id']},'attributes':['id',_0xe9f0('0x59'),_0xe9f0('0x96'),'to','cc',_0xe9f0('0x97'),_0xe9f0('0x98'),_0xe9f0('0x99')],'include':_0x43ea07[_0xe9f0('0x43')][_0xe9f0('0x6f')]?[{'model':db[_0xe9f0('0x9a')],'as':_0xe9f0('0x9b')}]:undefined})[_0xe9f0('0x21')](handleEntityNotFound(_0x144d9a,null))[_0xe9f0('0x21')](function(_0x9c2ab5){if(_0x9c2ab5){var _0x5ce4f4=_0x9c2ab5;var _0x33fe7f={'from':_0x5ce4f4[_0xe9f0('0x96')],'to':_0x5ce4f4['to'],'subject':_0x5ce4f4[_0xe9f0('0x98')],'html':_0x5ce4f4['body'],'headers':{'Date':moment(_0x5ce4f4['createdAt'])[_0xe9f0('0x95')](_0xe9f0('0x9c'))},'attachments':[]};if(_0x9c2ab5['cc']){_0x33fe7f[_0xe9f0('0x9d')]['Cc']=_0x9c2ab5['cc'];}if(_0x9c2ab5['bcc']){_0x33fe7f[_0xe9f0('0x9d')][_0xe9f0('0x9e')]=_0x9c2ab5[_0xe9f0('0x97')];}return new BPromise(function(_0x2a9acb,_0x49177b){if(_0x9c2ab5[_0xe9f0('0x9b')]){for(var _0x3b5654=0x0;_0x3b5654<_0x9c2ab5['Attachments'][_0xe9f0('0x46')];_0x3b5654++){var _0x3c7b30=_0x9c2ab5['Attachments'][_0x3b5654];var _0x6fed93=path[_0xe9f0('0x70')](_0x2d53c9,_0x3c7b30['basename']);if(fs['existsSync'](_0x6fed93)){_0x33fe7f['attachments'][_0xe9f0('0x9f')]({'name':_0x3c7b30['name'],'contentType':_0x3c7b30[_0xe9f0('0x3d')],'data':fs[_0xe9f0('0xa0')](_0x6fed93)});}}}emlformat['build'](_0x33fe7f,function(_0x187388,_0x3aa4c1){if(_0x187388)return _0x49177b(_0x187388);fs[_0xe9f0('0xa1')](path[_0xe9f0('0x70')](_0x4b25fe,_0x5396e2),_0x3aa4c1);return _0x2a9acb(_0x3aa4c1);});});}})['then'](function(_0x177988){if(_0x177988){return _0x144d9a[_0xe9f0('0x8f')](path['join'](_0x4b25fe,_0x5396e2),_0x5396e2,function(_0x487484){if(_0x487484){console['log'](_0xe9f0('0xa2'),_0x487484);}else{fs[_0xe9f0('0xa3')](path[_0xe9f0('0x70')](_0x4b25fe,_0x5396e2));}});}})[_0xe9f0('0x2b')](handleError(_0x144d9a,null));}; \ No newline at end of file +var _0x1065=['update','destroy','stack','name','index','map','MailMessage','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','rows','show','params','rawAttributes','find','body','describe','create','direction','out','secret','split','MailAccount','findOne','MailAccountId','CmList','CmContact','Contacts','updatedAt','DESC','MailServerOut','Smtp','isNil','host','port','secure','authentication','auth','user','pass','service','attachments','join','server/files/attachments','basename','ListId','List\x20not\x20found','SendMail','sendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','mail-interactions','accept','mail','read','UserId','Contact','get','MailInteraction','MailInteractionId','read1stAt','interaction','info','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','interface','channel','event','EventManager','acceptmessage','agent','RejectMessage','rejectMessage','SIP/%s','rejectmessage','download','unix','toString','root','server','files','tmp','message-%s.eml','bcc','subject','createdAt','Attachment','Attachments','from','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','existsSync','push','readFileSync','build','writeFileSync','log','err','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','redis','defaults','socket.io-emitter','./mailMessage.socket','register','jayson/promise','client','http','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save'];(function(_0x147f4c,_0x264b0c){var _0x45ccec=function(_0x425ce7){while(--_0x425ce7){_0x147f4c['push'](_0x147f4c['shift']());}};_0x45ccec(++_0x264b0c);}(_0x1065,0x79));var _0x5106=function(_0x50a1fe,_0x3766de){_0x50a1fe=_0x50a1fe-0x0;var _0x40a11c=_0x1065[_0x50a1fe];return _0x40a11c;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x5106('0x0'));var rimraf=require(_0x5106('0x1'));var zipdir=require(_0x5106('0x2'));var jsonpatch=require(_0x5106('0x3'));var rp=require(_0x5106('0x4'));var moment=require(_0x5106('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x5106('0x6'));var util=require(_0x5106('0x7'));var path=require(_0x5106('0x8'));var sox=require(_0x5106('0x9'));var csv=require(_0x5106('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x5106('0xb'));var squel=require(_0x5106('0xc'));var crypto=require('crypto');var jsforce=require(_0x5106('0xd'));var deskjs=require(_0x5106('0xe'));var toCsv=require('to-csv');var querystring=require(_0x5106('0xf'));var Papa=require(_0x5106('0x10'));var Redis=require('ioredis');var authService=require(_0x5106('0x11'));var qs=require(_0x5106('0x12'));var as=require(_0x5106('0x13'));var hardwareService=require(_0x5106('0x14'));var logger=require(_0x5106('0x15'))(_0x5106('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x5106('0x17'))['db'];config[_0x5106('0x18')]=_[_0x5106('0x19')](config[_0x5106('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x5106('0x1a'))(new Redis(config[_0x5106('0x18')]));require(_0x5106('0x1b'))[_0x5106('0x1c')](socket);var jayson=require(_0x5106('0x1d'));var client=jayson[_0x5106('0x1e')][_0x5106('0x1f')]({'port':0x232c});var client9003=jayson['client'][_0x5106('0x1f')]({'port':0x232b});var client9002=jayson[_0x5106('0x1e')][_0x5106('0x1f')]({'port':0x232a});function checkPasswordPattern(_0x3210de,_0x15ceb8,_0x4a9d83){if(_0x4a9d83){var _0x5dba0c=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5dba0c[_0x5106('0x20')](_0x15ceb8)){return _0x3210de;}else{throw new db['Sequelize'][(_0x5106('0x21'))](_0x5106('0x22'));}}else{return _0x3210de;}}function respondWithRpcPromise(_0x384e29,_0x24140b,_0x416fa4,_0x93a68a){return new BPromise(function(_0x111496,_0x2673a8){var _0x5407f8=_0x93a68a||client;return _0x5407f8[_0x5106('0x23')](_0x384e29,_0x416fa4)[_0x5106('0x24')](function(_0x59a8b1){logger['info'](_0x5106('0x25'),_0x24140b,_0x5106('0x26'));logger[_0x5106('0x27')](_0x5106('0x28'),_0x24140b,_0x5106('0x26'),JSON[_0x5106('0x29')](_0x59a8b1));if(_0x59a8b1[_0x5106('0x2a')]){if(_0x59a8b1[_0x5106('0x2a')][_0x5106('0x2b')]===0x1f4){logger[_0x5106('0x2a')]('MailMessage,\x20%s,\x20%s',_0x24140b,_0x59a8b1['error'][_0x5106('0x2c')]);return _0x2673a8(_0x59a8b1[_0x5106('0x2a')][_0x5106('0x2c')]);}logger[_0x5106('0x2a')](_0x5106('0x25'),_0x24140b,_0x59a8b1[_0x5106('0x2a')][_0x5106('0x2c')]);return _0x111496(_0x59a8b1[_0x5106('0x2a')][_0x5106('0x2c')]);}else{logger['info'](_0x5106('0x25'),_0x24140b,_0x5106('0x26'));_0x111496(_0x59a8b1[_0x5106('0x2d')]['message']);}})[_0x5106('0x2e')](function(_0x26eae8){logger[_0x5106('0x2a')](_0x5106('0x25'),_0x24140b,_0x26eae8);_0x2673a8(_0x26eae8);});});}function respondWithStatusCode(_0x28d19a,_0x58b30b){_0x58b30b=_0x58b30b||0xcc;return function(_0x1581d8){if(_0x1581d8){return _0x28d19a[_0x5106('0x2f')](_0x58b30b);}return _0x28d19a[_0x5106('0x30')](_0x58b30b)[_0x5106('0x31')]();};}function respondWithResult(_0x47f6e,_0x262398){_0x262398=_0x262398||0xc8;return function(_0x59a6d6){if(_0x59a6d6){return _0x47f6e[_0x5106('0x30')](_0x262398)[_0x5106('0x32')](_0x59a6d6);}};}function respondWithFilteredResult(_0x1ef906,_0xe0a771){return function(_0x1be2e4){if(_0x1be2e4){var _0x1615b2=_0x1be2e4[_0x5106('0x33')],_0x9b924d=_0xe0a771[_0x5106('0x34')],_0x3d7a5c=_0xe0a771[_0x5106('0x34')]+_0xe0a771[_0x5106('0x35')],_0x12d246;if(_0x3d7a5c>=_0x1615b2){_0x3d7a5c=_0x1615b2;_0x12d246=0xc8;}else{_0x12d246=0xce;}_0x1ef906[_0x5106('0x30')](_0x12d246);return _0x1ef906[_0x5106('0x36')](_0x5106('0x37'),_0x9b924d+'-'+_0x3d7a5c+'/'+_0x1615b2)[_0x5106('0x32')](_0x1be2e4);}return null;};}function patchUpdates(_0x2e04db){return function(_0x4d1d76){try{jsonpatch[_0x5106('0x38')](_0x4d1d76,_0x2e04db,!![]);}catch(_0x390571){return BPromise[_0x5106('0x39')](_0x390571);}return _0x4d1d76[_0x5106('0x3a')]();};}function saveUpdates(_0x2ab453,_0x256d3d){return function(_0x302c33){if(_0x302c33){return _0x302c33[_0x5106('0x3b')](_0x2ab453)[_0x5106('0x24')](function(_0x258d18){return _0x258d18;});}return null;};}function removeEntity(_0x3f58f3,_0x383c8b){return function(_0x32cf48){if(_0x32cf48){return _0x32cf48[_0x5106('0x3c')]()[_0x5106('0x24')](function(){_0x3f58f3[_0x5106('0x30')](0xcc)[_0x5106('0x31')]();});}};}function handleEntityNotFound(_0x376513,_0x22eb65){return function(_0x37ea24){if(!_0x37ea24){_0x376513[_0x5106('0x2f')](0x194);}return _0x37ea24;};}function handleError(_0x49de7b,_0x346952){_0x346952=_0x346952||0x1f4;return function(_0xa29487){logger['error'](_0xa29487[_0x5106('0x3d')]);if(_0xa29487['name']){delete _0xa29487[_0x5106('0x3e')];}_0x49de7b['status'](_0x346952)['send'](_0xa29487);};}exports[_0x5106('0x3f')]=function(_0x4aee58,_0x1438de){var _0x3c5c21={},_0x1dbe0c={},_0x8ac27a={'count':0x0,'rows':[]};var _0xfc6ed6=_[_0x5106('0x40')](db[_0x5106('0x41')]['rawAttributes'],function(_0x2110bf){return{'name':_0x2110bf['fieldName'],'type':_0x2110bf['type'][_0x5106('0x42')]};});_0x1dbe0c[_0x5106('0x43')]=_[_0x5106('0x40')](_0xfc6ed6,'name');_0x1dbe0c[_0x5106('0x44')]=_[_0x5106('0x45')](_0x4aee58['query']);_0x1dbe0c[_0x5106('0x46')]=_[_0x5106('0x47')](_0x1dbe0c['model'],_0x1dbe0c[_0x5106('0x44')]);_0x3c5c21[_0x5106('0x48')]=_[_0x5106('0x47')](_0x1dbe0c['model'],qs['fields'](_0x4aee58[_0x5106('0x44')][_0x5106('0x49')]));_0x3c5c21[_0x5106('0x48')]=_0x3c5c21[_0x5106('0x48')][_0x5106('0x4a')]?_0x3c5c21[_0x5106('0x48')]:_0x1dbe0c[_0x5106('0x43')];if(!_0x4aee58[_0x5106('0x44')]['hasOwnProperty'](_0x5106('0x4b'))){_0x3c5c21[_0x5106('0x35')]=qs[_0x5106('0x35')](_0x4aee58['query'][_0x5106('0x35')]);_0x3c5c21[_0x5106('0x34')]=qs[_0x5106('0x34')](_0x4aee58[_0x5106('0x44')][_0x5106('0x34')]);}_0x3c5c21[_0x5106('0x4c')]=qs[_0x5106('0x4d')](_0x4aee58['query']['sort']);_0x3c5c21[_0x5106('0x4e')]=qs[_0x5106('0x46')](_[_0x5106('0x4f')](_0x4aee58[_0x5106('0x44')],_0x1dbe0c['filters']));if(_0x4aee58[_0x5106('0x44')][_0x5106('0x50')]){_0x3c5c21[_0x5106('0x4e')]=_[_0x5106('0x51')](_0x3c5c21[_0x5106('0x4e')],{'$or':_[_0x5106('0x40')](_0xfc6ed6,function(_0x1d2c92){if(_0x1d2c92[_0x5106('0x52')]!==_0x5106('0x53')){var _0x5f1f36={};_0x5f1f36[_0x1d2c92[_0x5106('0x3e')]]={'$like':'%'+_0x4aee58[_0x5106('0x44')][_0x5106('0x50')]+'%'};return _0x5f1f36;}})});}_0x3c5c21=_[_0x5106('0x51')]({},_0x3c5c21,_0x4aee58[_0x5106('0x54')]);var _0x5ac88e={'where':_0x3c5c21['where']};return db[_0x5106('0x41')][_0x5106('0x33')](_0x5ac88e)[_0x5106('0x24')](function(_0x508b20){_0x8ac27a[_0x5106('0x33')]=_0x508b20;if(_0x4aee58[_0x5106('0x44')][_0x5106('0x55')]){_0x3c5c21[_0x5106('0x56')]=[{'all':!![]}];}return db[_0x5106('0x41')]['findAll'](_0x3c5c21);})['then'](function(_0x429838){_0x8ac27a[_0x5106('0x57')]=_0x429838;return _0x8ac27a;})['then'](respondWithFilteredResult(_0x1438de,_0x3c5c21))[_0x5106('0x2e')](handleError(_0x1438de,null));};exports[_0x5106('0x58')]=function(_0x4f7d3e,_0x51a61a){var _0x241b8d={'raw':!![],'where':{'id':_0x4f7d3e[_0x5106('0x59')]['id']}},_0x38cf2e={};_0x38cf2e[_0x5106('0x43')]=_['keys'](db['MailMessage'][_0x5106('0x5a')]);_0x38cf2e[_0x5106('0x44')]=_['keys'](_0x4f7d3e['query']);_0x38cf2e[_0x5106('0x46')]=_[_0x5106('0x47')](_0x38cf2e[_0x5106('0x43')],_0x38cf2e[_0x5106('0x44')]);_0x241b8d[_0x5106('0x48')]=_['intersection'](_0x38cf2e[_0x5106('0x43')],qs['fields'](_0x4f7d3e['query'][_0x5106('0x49')]));_0x241b8d[_0x5106('0x48')]=_0x241b8d[_0x5106('0x48')][_0x5106('0x4a')]?_0x241b8d['attributes']:_0x38cf2e[_0x5106('0x43')];if(_0x4f7d3e[_0x5106('0x44')][_0x5106('0x55')]){_0x241b8d[_0x5106('0x56')]=[{'all':!![]}];}_0x241b8d=_[_0x5106('0x51')]({},_0x241b8d,_0x4f7d3e[_0x5106('0x54')]);return db[_0x5106('0x41')][_0x5106('0x5b')](_0x241b8d)['then'](handleEntityNotFound(_0x51a61a,null))[_0x5106('0x24')](respondWithResult(_0x51a61a,null))[_0x5106('0x2e')](handleError(_0x51a61a,null));};exports[_0x5106('0x3b')]=function(_0x1d0fd8,_0x19bda3){if(_0x1d0fd8[_0x5106('0x5c')]['id']){delete _0x1d0fd8[_0x5106('0x5c')]['id'];}return db[_0x5106('0x41')][_0x5106('0x5b')]({'where':{'id':_0x1d0fd8[_0x5106('0x59')]['id']}})[_0x5106('0x24')](handleEntityNotFound(_0x19bda3,null))[_0x5106('0x24')](saveUpdates(_0x1d0fd8['body'],null))[_0x5106('0x24')](respondWithResult(_0x19bda3,null))[_0x5106('0x2e')](handleError(_0x19bda3,null));};exports[_0x5106('0x3c')]=function(_0x1e0997,_0x3e6ea6){return db['MailMessage'][_0x5106('0x5b')]({'where':{'id':_0x1e0997[_0x5106('0x59')]['id']}})[_0x5106('0x24')](handleEntityNotFound(_0x3e6ea6,null))[_0x5106('0x24')](removeEntity(_0x3e6ea6,null))['catch'](handleError(_0x3e6ea6,null));};exports[_0x5106('0x5d')]=function(_0x28dc68,_0x436216){return db[_0x5106('0x41')][_0x5106('0x5d')]()[_0x5106('0x24')](respondWithResult(_0x436216,null))['catch'](handleError(_0x436216,null));};exports[_0x5106('0x5e')]=function(_0x4266a3,_0x70935c){return db[_0x5106('0x41')][_0x5106('0x5e')](_0x4266a3[_0x5106('0x5c')])['then'](function(_0x4d3a4e){if(_0x4d3a4e){if(_0x4d3a4e[_0x5106('0x5f')]===_0x5106('0x60')&&!_0x4d3a4e[_0x5106('0x61')]){var _0x392e25,_0x30b0a2,_0x907686;if(_0x4266a3[_0x5106('0x5c')]['to']){_0x30b0a2=_0x4266a3['body']['to'][_0x5106('0x62')](',')[0x0];}return db[_0x5106('0x63')][_0x5106('0x64')]({'where':{'id':_0x4d3a4e[_0x5106('0x65')]},'include':[{'model':db[_0x5106('0x66')],'as':'List','include':[{'model':db[_0x5106('0x67')],'as':_0x5106('0x68'),'where':{'email':_0x30b0a2},'limit':0x1,'order':[[_0x5106('0x69'),_0x5106('0x6a')]]}]},{'model':db[_0x5106('0x6b')],'as':_0x5106('0x6c'),'raw':!![]}]})[_0x5106('0x24')](function(_0x3d9a66){_0x392e25=_0x3d9a66;if(_0x392e25&&_0x392e25[_0x5106('0x6c')]){var _0x19fe3e={'tls':{'rejectUnauthorized':![]}};if(_[_0x5106('0x6d')](_0x392e25[_0x5106('0x6c')]['service'])){_0x19fe3e[_0x5106('0x6e')]=_0x392e25[_0x5106('0x6c')][_0x5106('0x6e')];_0x19fe3e[_0x5106('0x6f')]=_0x392e25['Smtp'][_0x5106('0x6f')];_0x19fe3e[_0x5106('0x70')]=_0x392e25[_0x5106('0x6c')][_0x5106('0x70')];if(_0x392e25[_0x5106('0x6c')][_0x5106('0x71')]){_0x19fe3e[_0x5106('0x72')]={'user':_0x392e25[_0x5106('0x6c')][_0x5106('0x73')],'pass':_0x392e25[_0x5106('0x6c')][_0x5106('0x74')]};}}else{_0x19fe3e[_0x5106('0x75')]=_0x392e25[_0x5106('0x6c')][_0x5106('0x75')];_0x19fe3e[_0x5106('0x72')]={'user':_0x392e25[_0x5106('0x6c')][_0x5106('0x73')],'pass':_0x392e25[_0x5106('0x6c')][_0x5106('0x74')]};_0x19fe3e['secure']=_0x392e25['Smtp'][_0x5106('0x70')];}if(_0x4266a3[_0x5106('0x5c')][_0x5106('0x76')]&&_0x4266a3[_0x5106('0x5c')][_0x5106('0x76')][_0x5106('0x4a')]){for(var _0x191334=0x0;_0x191334<_0x4266a3[_0x5106('0x5c')]['attachments'][_0x5106('0x4a')];_0x191334+=0x1){_0x4266a3['body'][_0x5106('0x76')][_0x191334]={'filename':_0x4266a3[_0x5106('0x5c')][_0x5106('0x76')][_0x191334][_0x5106('0x3e')],'path':path[_0x5106('0x77')](config['root'],_0x5106('0x78'),_0x4266a3[_0x5106('0x5c')]['attachments'][_0x191334][_0x5106('0x79')])};}}_0x907686={'account':_0x19fe3e,'message':_0x4266a3[_0x5106('0x5c')]};return;}})['then'](function(){if(_0x392e25['List']){if(_0x392e25['List'][_0x5106('0x68')][_0x5106('0x4a')]){return _0x392e25['List'][_0x5106('0x68')][0x0];}else{return db['CmContact'][_0x5106('0x5e')](_['defaults'](_0x4266a3[_0x5106('0x5c')],{'firstName':_0x4266a3[_0x5106('0x5c')]['to'],'email':_0x4266a3[_0x5106('0x5c')]['to'],'phone':_0x4266a3['body']['to'],'ListId':_0x392e25[_0x5106('0x7a')]}));}}else{throw new Error(_0x5106('0x7b'));}})['then'](function(){if(_0x907686){return respondWithRpcPromise(_0x5106('0x7c'),_0x5106('0x7d'),_0x907686,client9003)['then'](function(_0x32c8dc){return _0x4d3a4e[_0x5106('0x3b')]({'read':!![],'messageId':_0x32c8dc[_0x5106('0x7e')],'sentAt':moment()[_0x5106('0x7f')](_0x5106('0x80'))});})[_0x5106('0x2e')](function(_0x5dd18f){logger['error']('%s',JSON[_0x5106('0x29')](_0x5dd18f));return _0x4d3a4e;});}return _0x4d3a4e;});}return _0x4d3a4e;}})[_0x5106('0x24')](respondWithResult(_0x70935c,0xc9))['catch'](handleError(_0x70935c,null));};var interaction_log=require(_0x5106('0x15'))(_0x5106('0x81'));exports[_0x5106('0x82')]=function(_0x1ee54d,_0x2ed2e2,_0x6a26f2){var _0x544135={'channel':_0x5106('0x83')};if(_0x1ee54d[_0x5106('0x5c')]['id']){delete _0x1ee54d['body']['id'];}_0x1ee54d['body'][_0x5106('0x84')]=!![];_0x1ee54d[_0x5106('0x5c')]['readAt']=moment()['format'](_0x5106('0x80'));_0x1ee54d[_0x5106('0x5c')][_0x5106('0x85')]=_0x1ee54d[_0x5106('0x5c')][_0x5106('0x85')]||_0x1ee54d[_0x5106('0x73')]['id'];return db[_0x5106('0x41')][_0x5106('0x5b')]({'where':{'id':_0x1ee54d['params']['id'],'UserId':null},'include':[{'model':db[_0x5106('0x67')],'as':_0x5106('0x86')}]})[_0x5106('0x24')](handleEntityNotFound(_0x2ed2e2,null))[_0x5106('0x24')](saveUpdates(_0x1ee54d[_0x5106('0x5c')],null))['then'](function(_0x44fe61){if(_0x44fe61){_0x544135['message']=_0x44fe61[_0x5106('0x87')]({'plain':!![]});return db[_0x5106('0x88')]['find']({'where':{'id':_0x44fe61[_0x5106('0x89')]}});}return null;})[_0x5106('0x24')](handleEntityNotFound(_0x2ed2e2,null))[_0x5106('0x24')](function(_0x31f841){if(_0x31f841){return _0x31f841[_0x5106('0x3b')]({'UserId':_0x1ee54d[_0x5106('0x5c')][_0x5106('0x85')],'read1stAt':_['isNil'](_0x31f841[_0x5106('0x8a')])?moment()[_0x5106('0x7f')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x5106('0x24')](function(_0x407259){if(_0x407259){_0x544135[_0x5106('0x8b')]=_0x407259[_0x5106('0x87')]({'plain':!![]});interaction_log[_0x5106('0x8c')](_0x5106('0x8d'),_0x1ee54d['user']['id'],_0x1ee54d['user'][_0x5106('0x3e')],_0x1ee54d[_0x5106('0x73')][_0x5106('0x8e')],_0x544135[_0x5106('0x8b')]['id'],_0x1ee54d[_0x5106('0x5c')]?JSON[_0x5106('0x29')](_0x1ee54d[_0x5106('0x5c')]):_0x5106('0x8f'));return respondWithRpcPromise(_0x5106('0x90'),_0x5106('0x91'),_0x544135);}return null;})[_0x5106('0x24')](function(_0x48a795){if(_0x48a795){if(_0x1ee54d['body']['manual']){_0x544135[_0x5106('0x2c')][_0x5106('0x92')]=util[_0x5106('0x7f')]('SIP/%s',_0x1ee54d[_0x5106('0x73')][_0x5106('0x3e')]);_0x544135['message'][_0x5106('0x93')]=_0x544135[_0x5106('0x93')];_0x544135['message'][_0x5106('0x94')]=_0x5106('0x82');return respondWithRpcPromise(_0x5106('0x95'),_0x5106('0x95'),{'event':_0x5106('0x96'),'message':_0x544135[_0x5106('0x2c')]},client9002)[_0x5106('0x24')](function(){return _0x544135;});}return _0x544135;}return null;})['then'](respondWithResult(_0x2ed2e2,null))['catch'](handleError(_0x2ed2e2,null));};var interaction_log=require(_0x5106('0x15'))(_0x5106('0x81'));exports[_0x5106('0x39')]=function(_0x1eefb2,_0x1eb425,_0x2abfa8){var _0x820024={'agent':{},'channel':'mail'};if(_0x1eefb2[_0x5106('0x5c')]['id']){delete _0x1eefb2[_0x5106('0x5c')]['id'];}_0x1eefb2[_0x5106('0x5c')][_0x5106('0x85')]=_0x1eefb2[_0x5106('0x5c')][_0x5106('0x85')]||_0x1eefb2[_0x5106('0x73')]['id'];_0x820024[_0x5106('0x97')]['id']=_0x1eefb2[_0x5106('0x5c')][_0x5106('0x85')];return db[_0x5106('0x41')][_0x5106('0x5b')]({'where':{'id':_0x1eefb2[_0x5106('0x59')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x1eb425,null))['then'](function(_0x14d84a){if(_0x14d84a){_0x820024[_0x5106('0x2c')]=_0x14d84a[_0x5106('0x87')]({'plain':!![]});return db['MailInteraction']['find']({'where':{'id':_0x14d84a[_0x5106('0x89')]}});}return null;})[_0x5106('0x24')](handleEntityNotFound(_0x1eb425,null))[_0x5106('0x24')](function(_0x4cba91){if(_0x4cba91){_0x820024[_0x5106('0x8b')]=_0x4cba91[_0x5106('0x87')]({'plain':!![]});interaction_log['info']('[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x1eefb2['user']['id'],_0x1eefb2[_0x5106('0x73')][_0x5106('0x3e')],_0x1eefb2[_0x5106('0x73')][_0x5106('0x8e')],_0x820024['interaction']['id'],_0x1eefb2[_0x5106('0x5c')]?JSON[_0x5106('0x29')](_0x1eefb2['body']):'null');return respondWithRpcPromise(_0x5106('0x98'),_0x5106('0x99'),_0x820024);}return null;})['then'](function(_0x411bc0){if(_0x411bc0){_0x411bc0[_0x5106('0x2c')][_0x5106('0x92')]=util['format'](_0x5106('0x9a'),_0x1eefb2['user']['name']);_0x411bc0[_0x5106('0x2c')]['channel']=_0x820024[_0x5106('0x93')];_0x411bc0[_0x5106('0x2c')][_0x5106('0x94')]=_0x5106('0x39');respondWithRpcPromise(_0x5106('0x95'),_0x5106('0x95'),{'event':_0x5106('0x9b'),'message':_0x411bc0['message']},client9002);return _0x820024;}return null;})[_0x5106('0x24')](respondWithResult(_0x1eb425,null))[_0x5106('0x2e')](handleError(_0x1eb425,null));};exports[_0x5106('0x9c')]=function(_0x391897,_0x363a49){var _0x4b0177=moment()[_0x5106('0x9d')]()[_0x5106('0x9e')]();var _0x2d4fc1=path[_0x5106('0x77')](config[_0x5106('0x9f')],_0x5106('0xa0'),_0x5106('0xa1'),_0x5106('0xa2'));var _0x41115e=path[_0x5106('0x77')](config[_0x5106('0x9f')],'server','files','attachments');var _0x27569a=util[_0x5106('0x7f')](_0x5106('0xa3'),_0x4b0177);return db[_0x5106('0x41')]['find']({'where':{'id':_0x391897[_0x5106('0x59')]['id']},'attributes':['id',_0x5106('0x5c'),'from','to','cc',_0x5106('0xa4'),_0x5106('0xa5'),_0x5106('0xa6')],'include':_0x391897[_0x5106('0x44')][_0x5106('0x76')]?[{'model':db[_0x5106('0xa7')],'as':_0x5106('0xa8')}]:undefined})[_0x5106('0x24')](handleEntityNotFound(_0x363a49,null))[_0x5106('0x24')](function(_0x50c1c2){if(_0x50c1c2){var _0x1e8b7e=_0x50c1c2;var _0x58020d={'from':_0x1e8b7e[_0x5106('0xa9')],'to':_0x1e8b7e['to'],'subject':_0x1e8b7e[_0x5106('0xa5')],'html':_0x1e8b7e['body'],'headers':{'Date':moment(_0x1e8b7e[_0x5106('0xa6')])[_0x5106('0x7f')](_0x5106('0xaa'))},'attachments':[]};if(_0x50c1c2['cc']){_0x58020d[_0x5106('0xab')]['Cc']=_0x50c1c2['cc'];}if(_0x50c1c2[_0x5106('0xa4')]){_0x58020d[_0x5106('0xab')][_0x5106('0xac')]=_0x50c1c2['bcc'];}return new BPromise(function(_0x4a1d55,_0x35ba4f){if(_0x50c1c2['Attachments']){for(var _0x2926c7=0x0;_0x2926c7<_0x50c1c2[_0x5106('0xa8')][_0x5106('0x4a')];_0x2926c7++){var _0x700b75=_0x50c1c2[_0x5106('0xa8')][_0x2926c7];var _0x19ef85=path['join'](_0x41115e,_0x700b75[_0x5106('0x79')]);if(fs[_0x5106('0xad')](_0x19ef85)){_0x58020d[_0x5106('0x76')][_0x5106('0xae')]({'name':_0x700b75[_0x5106('0x3e')],'contentType':_0x700b75[_0x5106('0x52')],'data':fs[_0x5106('0xaf')](_0x19ef85)});}}}emlformat[_0x5106('0xb0')](_0x58020d,function(_0x4003c9,_0x305275){if(_0x4003c9)return _0x35ba4f(_0x4003c9);fs[_0x5106('0xb1')](path[_0x5106('0x77')](_0x2d4fc1,_0x27569a),_0x305275);return _0x4a1d55(_0x305275);});});}})['then'](function(_0x4f3180){if(_0x4f3180){return _0x363a49[_0x5106('0x9c')](path[_0x5106('0x77')](_0x2d4fc1,_0x27569a),_0x27569a,function(_0x55601a){if(_0x55601a){console[_0x5106('0xb2')](_0x5106('0xb3'),_0x55601a);}else{fs['unlinkSync'](path[_0x5106('0x77')](_0x2d4fc1,_0x27569a));}});}})[_0x5106('0x2e')](handleError(_0x363a49,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index 7becac0..d59e45f 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 _0x44be=['update','remove','emit','hook','exports','../../mysqldb','setMaxListeners'];(function(_0x549928,_0x363b7a){var _0x941e27=function(_0x280fe6){while(--_0x280fe6){_0x549928['push'](_0x549928['shift']());}};_0x941e27(++_0x363b7a);}(_0x44be,0x186));var _0xe44b=function(_0x3f2fea,_0x3c4ea8){_0x3f2fea=_0x3f2fea-0x0;var _0x69a4d5=_0x44be[_0x3f2fea];return _0x69a4d5;};'use strict';var EventEmitter=require('events');var MailMessage=require(_0xe44b('0x0'))['db']['MailMessage'];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0xe44b('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0xe44b('0x2'),'afterDestroy':_0xe44b('0x3')};function emitEvent(_0x57f52e){return function(_0x40126f,_0xc1084d,_0x1a65fe){MailMessageEvents[_0xe44b('0x4')](_0x57f52e+':'+_0x40126f['id'],_0x40126f);MailMessageEvents[_0xe44b('0x4')](_0x57f52e,_0x40126f);_0x1a65fe(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailMessage[_0xe44b('0x5')](e,emitEvent(event));}}module[_0xe44b('0x6')]=MailMessageEvents; \ No newline at end of file +var _0x7afd=['hook','events','MailMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7afd,0x184));var _0xd7af=function(_0x3d71ba,_0x49a38b){_0x3d71ba=_0x3d71ba-0x0;var _0x5e0ed0=_0x7afd[_0x3d71ba];return _0x5e0ed0;};'use strict';var EventEmitter=require(_0xd7af('0x0'));var MailMessage=require('../../mysqldb')['db'][_0xd7af('0x1')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0xd7af('0x2')](0x0);var events={'afterCreate':_0xd7af('0x3'),'afterUpdate':_0xd7af('0x4'),'afterDestroy':_0xd7af('0x5')};function emitEvent(_0x386854){return function(_0x3d7483,_0x2613b2,_0x149904){MailMessageEvents['emit'](_0x386854+':'+_0x3d7483['id'],_0x3d7483);MailMessageEvents[_0xd7af('0x6')](_0x386854,_0x3d7483);_0x149904(null);};}for(var e in events){if(events[_0xd7af('0x7')](e)){var event=events[e];MailMessage[_0xd7af('0x8')](e,emitEvent(event));}}module['exports']=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index 498491f..1402ec8 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 _0xa991=['html-to-text','rimraf','./mailMessage.attributes','define','messageId','plainBody','subject','FULLTEXT','fromString','get','toLowerCase','secret','isNil','UserId','MailInteraction','findOne','MailInteractionId','then','update','createdAt','direction','body','error','utf8mb4','utf8mb4_unicode_ci','../../config/logger','bluebird'];(function(_0x19e469,_0x426f29){var _0x5f2b41=function(_0x5cc5c8){while(--_0x5cc5c8){_0x19e469['push'](_0x19e469['shift']());}};_0x5f2b41(++_0x426f29);}(_0xa991,0x10c));var _0x1a99=function(_0x1e4360,_0x930b9b){_0x1e4360=_0x1e4360-0x0;var _0x31e6b4=_0xa991[_0x1e4360];return _0x31e6b4;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1a99('0x0'))('api');var moment=require('moment');var BPromise=require(_0x1a99('0x1'));var rp=require('request-promise');var htmlToText=require(_0x1a99('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1a99('0x3'));var config=require('../../config/environment');var attributes=require(_0x1a99('0x4'));module['exports']=function(_0x5f157c,_0x33f0fe){return _0x5f157c[_0x1a99('0x5')]('MailMessage',attributes,{'tableName':'mail_messages','paranoid':![],'indexes':[{'name':_0x1a99('0x6'),'fields':[_0x1a99('0x6')]},{'name':'fti_mail_messages','fields':[_0x1a99('0x7'),_0x1a99('0x8')],'type':_0x1a99('0x9')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x2d5685,_0x38cf52,_0x525e8d){if(_0x2d5685['body']){_0x2d5685['plainBody']=htmlToText[_0x1a99('0xa')](_0x2d5685['body'],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x525e8d(null,_0x38cf52);},'afterCreate':function(_0x31ab45,_0x360a5d,_0xa78bad){var _0xc8f6d1=_0x5f157c['models'];var _0x1bfb71=_0x31ab45[_0x1a99('0xb')]({'plain':!![]});if(_0x1bfb71['direction'][_0x1a99('0xc')]()==='in'||_0x1bfb71['direction'][_0x1a99('0xc')]()==='out'&&!_0x1bfb71[_0x1a99('0xd')]&&!_[_0x1a99('0xe')](_0x1bfb71[_0x1a99('0xf')])){_0xc8f6d1[_0x1a99('0x10')][_0x1a99('0x11')]({'where':{'id':_0x1bfb71[_0x1a99('0x12')]}})[_0x1a99('0x13')](function(_0x2e33a2){if(_0x2e33a2){_0x2e33a2[_0x1a99('0x14')]({'lastMsgAt':_0x1bfb71[_0x1a99('0x15')],'lastMsgDirection':_0x1bfb71[_0x1a99('0x16')][_0x1a99('0xc')](),'lastMsgBody':_0x1bfb71[_0x1a99('0x17')]});}})['catch'](function(_0xbc0d3b){console[_0x1a99('0x18')](_0xbc0d3b);});}_0xa78bad();}},'charset':_0x1a99('0x19'),'collate':_0x1a99('0x1a')});}; \ No newline at end of file +var _0xbdd9=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','mail_messages','messageId','fti_mail_messages','plainBody','subject','FULLTEXT','fromString','models','get','direction','toLowerCase','out','secret','then','createdAt','body','error','utf8mb4','lodash'];(function(_0x2093f0,_0x1f903c){var _0x37829f=function(_0x27d3bc){while(--_0x27d3bc){_0x2093f0['push'](_0x2093f0['shift']());}};_0x37829f(++_0x1f903c);}(_0xbdd9,0x6b));var _0x9bdd=function(_0x4d79bc,_0x32c905){_0x4d79bc=_0x4d79bc-0x0;var _0x4b4760=_0xbdd9[_0x4d79bc];return _0x4b4760;};'use strict';var _=require(_0x9bdd('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x9bdd('0x1'));var BPromise=require(_0x9bdd('0x2'));var rp=require(_0x9bdd('0x3'));var htmlToText=require('html-to-text');var fs=require('fs');var path=require(_0x9bdd('0x4'));var rimraf=require(_0x9bdd('0x5'));var config=require(_0x9bdd('0x6'));var attributes=require('./mailMessage.attributes');module[_0x9bdd('0x7')]=function(_0x186376,_0x381e06){return _0x186376[_0x9bdd('0x8')]('MailMessage',attributes,{'tableName':_0x9bdd('0x9'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0x9bdd('0xa')]},{'name':_0x9bdd('0xb'),'fields':[_0x9bdd('0xc'),_0x9bdd('0xd')],'type':_0x9bdd('0xe')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x55a16b,_0x10765d,_0x3448e9){if(_0x55a16b['body']){_0x55a16b[_0x9bdd('0xc')]=htmlToText[_0x9bdd('0xf')](_0x55a16b['body'],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x3448e9(null,_0x10765d);},'afterCreate':function(_0x48647b,_0x163519,_0x1d9d4c){var _0x38ee3a=_0x186376[_0x9bdd('0x10')];var _0x32713f=_0x48647b[_0x9bdd('0x11')]({'plain':!![]});if(_0x32713f[_0x9bdd('0x12')][_0x9bdd('0x13')]()==='in'||_0x32713f[_0x9bdd('0x12')][_0x9bdd('0x13')]()===_0x9bdd('0x14')&&!_0x32713f[_0x9bdd('0x15')]&&!_['isNil'](_0x32713f['UserId'])){_0x38ee3a['MailInteraction']['findOne']({'where':{'id':_0x32713f['MailInteractionId']}})[_0x9bdd('0x16')](function(_0x237de2){if(_0x237de2){_0x237de2['update']({'lastMsgAt':_0x32713f[_0x9bdd('0x17')],'lastMsgDirection':_0x32713f['direction'][_0x9bdd('0x13')](),'lastMsgBody':_0x32713f[_0x9bdd('0x18')]});}})['catch'](function(_0x5a8fa8){console[_0x9bdd('0x19')](_0x5a8fa8);});}_0x1d9d4c();}},'charset':_0x9bdd('0x1a'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index 8fad065..ac2fd8b 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 _0xa5aa=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','defaults','redis','socket.io-emitter','./mailMessage.socket','request','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateMailMessage','MailMessage','create','options','raw','then','lodash'];(function(_0x469eba,_0x39471c){var _0x355f69=function(_0x2ca612){while(--_0x2ca612){_0x469eba['push'](_0x469eba['shift']());}};_0x355f69(++_0x39471c);}(_0xa5aa,0x1ac));var _0xaa5a=function(_0x179aa2,_0x41e1ab){_0x179aa2=_0x179aa2-0x0;var _0x15e0e9=_0xa5aa[_0x179aa2];return _0x15e0e9;};'use strict';var _=require(_0xaa5a('0x0'));var util=require(_0xaa5a('0x1'));var moment=require('moment');var BPromise=require(_0xaa5a('0x2'));var rs=require(_0xaa5a('0x3'));var fs=require('fs');var Redis=require(_0xaa5a('0x4'));var db=require(_0xaa5a('0x5'))['db'];var utils=require(_0xaa5a('0x6'));var logger=require(_0xaa5a('0x7'))('rpc');var config=require(_0xaa5a('0x8'));var jayson=require(_0xaa5a('0x9'));var client=jayson[_0xaa5a('0xa')]['http']({'port':0x232a});config['redis']=_[_0xaa5a('0xb')](config[_0xaa5a('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xaa5a('0xd'))(new Redis(config[_0xaa5a('0xc')]));require(_0xaa5a('0xe'))['register'](socket);function respondWithRpcPromise(_0x1711cc,_0x1f57cd,_0x771d06){return new BPromise(function(_0x338653,_0x2db481){return client[_0xaa5a('0xf')](_0x1711cc,_0x771d06)['then'](function(_0x7dc4c2){logger[_0xaa5a('0x10')](_0xaa5a('0x11'),_0x1f57cd,_0xaa5a('0x12'));logger[_0xaa5a('0x13')](_0xaa5a('0x14'),_0x1f57cd,_0xaa5a('0x12'),JSON[_0xaa5a('0x15')](_0x7dc4c2));if(_0x7dc4c2[_0xaa5a('0x16')]){if(_0x7dc4c2[_0xaa5a('0x16')][_0xaa5a('0x17')]===0x1f4){logger[_0xaa5a('0x16')]('MailMessage,\x20%s,\x20%s',_0x1f57cd,_0x7dc4c2[_0xaa5a('0x16')][_0xaa5a('0x18')]);return _0x2db481(_0x7dc4c2[_0xaa5a('0x16')]['message']);}logger[_0xaa5a('0x16')](_0xaa5a('0x11'),_0x1f57cd,_0x7dc4c2[_0xaa5a('0x16')][_0xaa5a('0x18')]);return _0x338653(_0x7dc4c2[_0xaa5a('0x16')][_0xaa5a('0x18')]);}else{logger[_0xaa5a('0x10')](_0xaa5a('0x11'),_0x1f57cd,_0xaa5a('0x12'));_0x338653(_0x7dc4c2[_0xaa5a('0x19')][_0xaa5a('0x18')]);}})[_0xaa5a('0x1a')](function(_0x127d71){logger[_0xaa5a('0x16')](_0xaa5a('0x11'),_0x1f57cd,_0x127d71);_0x2db481(_0x127d71);});});}exports[_0xaa5a('0x1b')]=function(_0x222e5e){var _0x57cc60=this;return new Promise(function(_0x20ec46,_0xb9156c){return db[_0xaa5a('0x1c')][_0xaa5a('0x1d')](_0x222e5e['body'],{'raw':_0x222e5e[_0xaa5a('0x1e')]?_0x222e5e[_0xaa5a('0x1e')][_0xaa5a('0x1f')]===undefined?!![]:![]:!![]})[_0xaa5a('0x20')](function(_0xf50dd0){logger[_0xaa5a('0x10')](_0xaa5a('0x1b'),_0x222e5e);logger[_0xaa5a('0x13')](_0xaa5a('0x1b'),_0x222e5e,JSON['stringify'](_0xf50dd0));_0x20ec46(_0xf50dd0);})[_0xaa5a('0x1a')](function(_0x4c9035){logger[_0xaa5a('0x16')](_0xaa5a('0x1b'),_0x4c9035[_0xaa5a('0x18')],_0x222e5e);_0xb9156c(_0x57cc60[_0xaa5a('0x16')](0x1f4,_0x4c9035[_0xaa5a('0x18')]));});});}; \ No newline at end of file +var _0xf611=['stringify','error','code','message','result','catch','CreateMailMessage','MailMessage','create','body','options','util','moment','bluebird','../../config/utils','rpc','../../config/environment','http','redis','defaults','socket.io-emitter','./mailMessage.socket','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x208bc9,_0x4f36f6){var _0x2675a8=function(_0x452e72){while(--_0x452e72){_0x208bc9['push'](_0x208bc9['shift']());}};_0x2675a8(++_0x4f36f6);}(_0xf611,0x7b));var _0x1f61=function(_0x2ea08a,_0x240f73){_0x2ea08a=_0x2ea08a-0x0;var _0x5401ad=_0xf611[_0x2ea08a];return _0x5401ad;};'use strict';var _=require('lodash');var util=require(_0x1f61('0x0'));var moment=require(_0x1f61('0x1'));var BPromise=require(_0x1f61('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x1f61('0x3'));var logger=require('../../config/logger')(_0x1f61('0x4'));var config=require(_0x1f61('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1f61('0x6')]({'port':0x232a});config[_0x1f61('0x7')]=_[_0x1f61('0x8')](config[_0x1f61('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0x1f61('0x9'))(new Redis(config[_0x1f61('0x7')]));require(_0x1f61('0xa'))['register'](socket);function respondWithRpcPromise(_0x27a10a,_0x1ce344,_0x548156){return new BPromise(function(_0x5c4358,_0x1970db){return client[_0x1f61('0xb')](_0x27a10a,_0x548156)[_0x1f61('0xc')](function(_0x2ee15e){logger[_0x1f61('0xd')](_0x1f61('0xe'),_0x1ce344,_0x1f61('0xf'));logger[_0x1f61('0x10')]('MailMessage,\x20%s,\x20%s,\x20%s',_0x1ce344,_0x1f61('0xf'),JSON[_0x1f61('0x11')](_0x2ee15e));if(_0x2ee15e[_0x1f61('0x12')]){if(_0x2ee15e[_0x1f61('0x12')][_0x1f61('0x13')]===0x1f4){logger[_0x1f61('0x12')](_0x1f61('0xe'),_0x1ce344,_0x2ee15e[_0x1f61('0x12')][_0x1f61('0x14')]);return _0x1970db(_0x2ee15e[_0x1f61('0x12')][_0x1f61('0x14')]);}logger[_0x1f61('0x12')](_0x1f61('0xe'),_0x1ce344,_0x2ee15e[_0x1f61('0x12')][_0x1f61('0x14')]);return _0x5c4358(_0x2ee15e[_0x1f61('0x12')][_0x1f61('0x14')]);}else{logger[_0x1f61('0xd')](_0x1f61('0xe'),_0x1ce344,_0x1f61('0xf'));_0x5c4358(_0x2ee15e[_0x1f61('0x15')]['message']);}})[_0x1f61('0x16')](function(_0x4484e9){logger[_0x1f61('0x12')]('MailMessage,\x20%s,\x20%s',_0x1ce344,_0x4484e9);_0x1970db(_0x4484e9);});});}exports[_0x1f61('0x17')]=function(_0x43f643){var _0x3e052=this;return new Promise(function(_0x42b543,_0x994383){return db[_0x1f61('0x18')][_0x1f61('0x19')](_0x43f643[_0x1f61('0x1a')],{'raw':_0x43f643[_0x1f61('0x1b')]?_0x43f643[_0x1f61('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0x1f61('0xc')](function(_0x5de4c9){logger[_0x1f61('0xd')]('CreateMailMessage',_0x43f643);logger[_0x1f61('0x10')](_0x1f61('0x17'),_0x43f643,JSON[_0x1f61('0x11')](_0x5de4c9));_0x42b543(_0x5de4c9);})[_0x1f61('0x16')](function(_0x484556){logger[_0x1f61('0x12')]('CreateMailMessage',_0x484556[_0x1f61('0x14')],_0x43f643);_0x994383(_0x3e052[_0x1f61('0x12')](0x1f4,_0x484556['message']));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 25ac633..8d6f82e 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 _0x6737=['mailMessage:','./mailMessage.events','save','emit','removeListener','length'];(function(_0x3a2e8c,_0x4001d3){var _0x588177=function(_0x2dbc02){while(--_0x2dbc02){_0x3a2e8c['push'](_0x3a2e8c['shift']());}};_0x588177(++_0x4001d3);}(_0x6737,0xaf));var _0x7673=function(_0x3372f6,_0x519b41){_0x3372f6=_0x3372f6-0x0;var _0x772d8a=_0x6737[_0x3372f6];return _0x772d8a;};'use strict';var MailMessageEvents=require(_0x7673('0x0'));var events=[_0x7673('0x1'),'remove','update'];function createListener(_0x3a4fff,_0x45df21){return function(_0x34301f){_0x45df21[_0x7673('0x2')](_0x3a4fff,_0x34301f);};}function removeListener(_0x3aa2e3,_0xc33628){return function(){MailMessageEvents[_0x7673('0x3')](_0x3aa2e3,_0xc33628);};}exports['register']=function(_0x4021df){for(var _0x4d5324=0x0,_0x335c7b=events[_0x7673('0x4')];_0x4d5324<_0x335c7b;_0x4d5324++){var _0x4abd31=events[_0x4d5324];var _0x70a5e0=createListener(_0x7673('0x5')+_0x4abd31,_0x4021df);MailMessageEvents['on'](_0x4abd31,_0x70a5e0);}}; \ No newline at end of file +var _0x7ba0=['length','mailMessage:','./mailMessage.events','save','remove','removeListener','register'];(function(_0x3ff7e9,_0x51ed46){var _0x501f5a=function(_0xddbbef){while(--_0xddbbef){_0x3ff7e9['push'](_0x3ff7e9['shift']());}};_0x501f5a(++_0x51ed46);}(_0x7ba0,0x1e5));var _0x07ba=function(_0x57354d,_0x4a5c16){_0x57354d=_0x57354d-0x0;var _0x33b396=_0x7ba0[_0x57354d];return _0x33b396;};'use strict';var MailMessageEvents=require(_0x07ba('0x0'));var events=[_0x07ba('0x1'),_0x07ba('0x2'),'update'];function createListener(_0xcfa74b,_0x3f3649){return function(_0x5331b7){_0x3f3649['emit'](_0xcfa74b,_0x5331b7);};}function removeListener(_0x39b3e5,_0x509302){return function(){MailMessageEvents[_0x07ba('0x3')](_0x39b3e5,_0x509302);};}exports[_0x07ba('0x4')]=function(_0x374dc7){for(var _0x47138e=0x0,_0xcfdf97=events[_0x07ba('0x5')];_0x47138e<_0xcfdf97;_0x47138e++){var _0x5edbf0=events[_0x47138e];var _0x112dec=createListener(_0x07ba('0x6')+_0x5edbf0,_0x374dc7);MailMessageEvents['on'](_0x5edbf0,_0x112dec);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index 9cf495a..8cfa3a2 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 _0x37ab=['post','create','addTeams','addAgents','put','update','destroy','delete','exports','util','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users'];(function(_0x5cb1af,_0x4bdc8c){var _0x8d7940=function(_0x3db70a){while(--_0x3db70a){_0x5cb1af['push'](_0x5cb1af['shift']());}};_0x8d7940(++_0x4bdc8c);}(_0x37ab,0x183));var _0xb37a=function(_0x4d32e9,_0x390d44){_0x4d32e9=_0x4d32e9-0x0;var _0x2d9ece=_0x37ab[_0x4d32e9];return _0x2d9ece;};'use strict';var multer=require('multer');var util=require(_0xb37a('0x0'));var path=require('path');var timeout=require(_0xb37a('0x1'));var express=require('express');var router=express['Router']();var auth=require(_0xb37a('0x2'));var interaction=require(_0xb37a('0x3'));var config=require(_0xb37a('0x4'));var controller=require(_0xb37a('0x5'));router[_0xb37a('0x6')]('/',auth[_0xb37a('0x7')](),controller[_0xb37a('0x8')]);router[_0xb37a('0x6')](_0xb37a('0x9'),auth[_0xb37a('0x7')](),controller[_0xb37a('0xa')]);router[_0xb37a('0x6')](_0xb37a('0xb'),auth[_0xb37a('0x7')](),controller[_0xb37a('0xc')]);router[_0xb37a('0x6')](_0xb37a('0xd'),auth[_0xb37a('0x7')](),controller[_0xb37a('0xe')]);router[_0xb37a('0x6')](_0xb37a('0xf'),auth['isAuthenticated'](),controller[_0xb37a('0x10')]);router[_0xb37a('0x6')](_0xb37a('0x11'),auth['isAuthenticated'](),controller['getAgents']);router[_0xb37a('0x12')]('/',auth[_0xb37a('0x7')](),controller[_0xb37a('0x13')]);router[_0xb37a('0x12')](_0xb37a('0xf'),auth[_0xb37a('0x7')](),controller[_0xb37a('0x14')]);router[_0xb37a('0x12')]('/:id/users',auth[_0xb37a('0x7')](),controller[_0xb37a('0x15')]);router[_0xb37a('0x16')](_0xb37a('0xb'),auth['isAuthenticated'](),controller[_0xb37a('0x17')]);router['delete'](_0xb37a('0xb'),auth[_0xb37a('0x7')](),controller[_0xb37a('0x18')]);router[_0xb37a('0x19')](_0xb37a('0xf'),auth['isAuthenticated'](),controller['removeTeams']);router[_0xb37a('0x19')]('/:id/users',auth[_0xb37a('0x7')](),controller['removeAgents']);module[_0xb37a('0x1a')]=router; \ No newline at end of file +var _0x9d47=['getMembers','/:id/teams','getTeams','getAgents','post','create','addTeams','/:id/users','update','destroy','delete','removeTeams','removeAgents','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','/:id/members'];(function(_0x24db2f,_0x5dff51){var _0x42fe50=function(_0x421d0e){while(--_0x421d0e){_0x24db2f['push'](_0x24db2f['shift']());}};_0x42fe50(++_0x5dff51);}(_0x9d47,0x82));var _0x79d4=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9d47[_0x3b380d];return _0x54502b;};'use strict';var multer=require('multer');var util=require(_0x79d4('0x0'));var path=require(_0x79d4('0x1'));var timeout=require(_0x79d4('0x2'));var express=require(_0x79d4('0x3'));var router=express[_0x79d4('0x4')]();var auth=require(_0x79d4('0x5'));var interaction=require(_0x79d4('0x6'));var config=require(_0x79d4('0x7'));var controller=require('./mailQueue.controller');router[_0x79d4('0x8')]('/',auth[_0x79d4('0x9')](),controller['index']);router[_0x79d4('0x8')](_0x79d4('0xa'),auth[_0x79d4('0x9')](),controller[_0x79d4('0xb')]);router['get'](_0x79d4('0xc'),auth[_0x79d4('0x9')](),controller[_0x79d4('0xd')]);router['get'](_0x79d4('0xe'),auth[_0x79d4('0x9')](),controller[_0x79d4('0xf')]);router[_0x79d4('0x8')](_0x79d4('0x10'),auth['isAuthenticated'](),controller[_0x79d4('0x11')]);router['get']('/:id/users',auth[_0x79d4('0x9')](),controller[_0x79d4('0x12')]);router[_0x79d4('0x13')]('/',auth['isAuthenticated'](),controller[_0x79d4('0x14')]);router['post']('/:id/teams',auth[_0x79d4('0x9')](),controller[_0x79d4('0x15')]);router[_0x79d4('0x13')](_0x79d4('0x16'),auth[_0x79d4('0x9')](),controller['addAgents']);router['put']('/:id',auth[_0x79d4('0x9')](),controller[_0x79d4('0x17')]);router['delete'](_0x79d4('0xc'),auth[_0x79d4('0x9')](),controller[_0x79d4('0x18')]);router[_0x79d4('0x19')](_0x79d4('0x10'),auth[_0x79d4('0x9')](),controller[_0x79d4('0x1a')]);router[_0x79d4('0x19')](_0x79d4('0x16'),auth[_0x79d4('0x9')](),controller[_0x79d4('0x1b')]);module[_0x79d4('0x1c')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index 01ff612..2c495dd 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 _0x8e4f=['roundrobin','sequelize','exports','STRING','INTEGER','ENUM','rrmemory'];(function(_0x2c0acf,_0x4d2823){var _0x2455fc=function(_0x33c1fd){while(--_0x33c1fd){_0x2c0acf['push'](_0x2c0acf['shift']());}};_0x2455fc(++_0x4d2823);}(_0x8e4f,0xa9));var _0xf8e4=function(_0x3c5fec,_0x4fecdf){_0x3c5fec=_0x3c5fec-0x0;var _0x47eafa=_0x8e4f[_0x3c5fec];return _0x47eafa;};'use strict';var Sequelize=require(_0xf8e4('0x0'));module[_0xf8e4('0x1')]={'name':{'type':Sequelize[_0xf8e4('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xf8e4('0x2')]},'timeout':{'type':Sequelize[_0xf8e4('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xf8e4('0x4')](_0xf8e4('0x5'),'beepall',_0xf8e4('0x6'))}}; \ No newline at end of file +var _0x775e=['rrmemory','beepall','sequelize','exports','STRING','INTEGER'];(function(_0xb6b285,_0x596e01){var _0x11393c=function(_0x506469){while(--_0x506469){_0xb6b285['push'](_0xb6b285['shift']());}};_0x11393c(++_0x596e01);}(_0x775e,0xda));var _0xe775=function(_0x13d5ac,_0x19334f){_0x13d5ac=_0x13d5ac-0x0;var _0x22aadd=_0x775e[_0x13d5ac];return _0x22aadd;};'use strict';var Sequelize=require(_0xe775('0x0'));module[_0xe775('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xe775('0x2')]},'timeout':{'type':Sequelize[_0xe775('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xe775('0x4'),_0xe775('0x5'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 5d1d071..1b4998f 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 _0x0aba=['Team','getTeams','addTeams','ids','User','Agents','voicePause','flatMap','sequelize','transaction','each','findOrCreate','forEach','userMailQueue:save','removeTeams','field','tq.TeamId','from','team_has_mail_queues','user_has_teams','push','toString','SELECT','every','TeamId','includes','all','union','value','isEmpty','removeAgents','userMailQueue:remove','addAgents','omit','spread','emit','isArray','getAgents','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','sendStatus','end','status','json','count','offset','limit','set','Content-Range','reject','update','then','destroy','MailQueues','UserProfileResource','error','stack','name','send','index','MailQueue','rawAttributes','key','map','query','model','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','pick','filters','filter','where','merge','VIRTUAL','includeAll','include','rows','show','params','keys','options','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','length','MailQueueId','UserMailQueue','findAll','findAndCountAll','UserId','agent','updatedAt','createdAt','format','%s/%s','SIP','mailPause'];(function(_0x50ca0d,_0x55d111){var _0x1d93b1=function(_0x25d750){while(--_0x25d750){_0x50ca0d['push'](_0x50ca0d['shift']());}};_0x1d93b1(++_0x55d111);}(_0x0aba,0x140));var _0xa0ab=function(_0x5608a3,_0x5b33c5){_0x5608a3=_0x5608a3-0x0;var _0x1ed50a=_0x0aba[_0x5608a3];return _0x1ed50a;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xa0ab('0x0'));var zipdir=require(_0xa0ab('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa0ab('0x2'));var moment=require(_0xa0ab('0x3'));var BPromise=require(_0xa0ab('0x4'));var Mustache=require(_0xa0ab('0x5'));var util=require(_0xa0ab('0x6'));var path=require('path');var sox=require(_0xa0ab('0x7'));var csv=require(_0xa0ab('0x8'));var ejs=require(_0xa0ab('0x9'));var fs=require('fs');var _=require(_0xa0ab('0xa'));var squel=require('squel');var crypto=require(_0xa0ab('0xb'));var jsforce=require(_0xa0ab('0xc'));var deskjs=require(_0xa0ab('0xd'));var toCsv=require(_0xa0ab('0x8'));var querystring=require(_0xa0ab('0xe'));var Papa=require(_0xa0ab('0xf'));var Redis=require(_0xa0ab('0x10'));var authService=require(_0xa0ab('0x11'));var qs=require(_0xa0ab('0x12'));var as=require(_0xa0ab('0x13'));var hardwareService=require(_0xa0ab('0x14'));var logger=require(_0xa0ab('0x15'))('api');var utils=require('../../config/utils');var config=require(_0xa0ab('0x16'));var db=require(_0xa0ab('0x17'))['db'];config[_0xa0ab('0x18')]=_[_0xa0ab('0x19')](config[_0xa0ab('0x18')],{'host':_0xa0ab('0x1a'),'port':0x18eb});var socket=require(_0xa0ab('0x1b'))(new Redis(config['redis']));require(_0xa0ab('0x1c'))[_0xa0ab('0x1d')](socket);function respondWithStatusCode(_0x42019b,_0x15bb89){_0x15bb89=_0x15bb89||0xcc;return function(_0x1f563f){if(_0x1f563f){return _0x42019b[_0xa0ab('0x1e')](_0x15bb89);}return _0x42019b['status'](_0x15bb89)[_0xa0ab('0x1f')]();};}function respondWithResult(_0x4acb49,_0x3adfe1){_0x3adfe1=_0x3adfe1||0xc8;return function(_0x515193){if(_0x515193){return _0x4acb49[_0xa0ab('0x20')](_0x3adfe1)[_0xa0ab('0x21')](_0x515193);}};}function respondWithFilteredResult(_0x103b48,_0x546ebd){return function(_0x45aa87){if(_0x45aa87){var _0x3032cf=_0x45aa87[_0xa0ab('0x22')],_0x4fb504=_0x546ebd['offset'],_0x516ed4=_0x546ebd[_0xa0ab('0x23')]+_0x546ebd[_0xa0ab('0x24')],_0x560354;if(_0x516ed4>=_0x3032cf){_0x516ed4=_0x3032cf;_0x560354=0xc8;}else{_0x560354=0xce;}_0x103b48['status'](_0x560354);return _0x103b48[_0xa0ab('0x25')](_0xa0ab('0x26'),_0x4fb504+'-'+_0x516ed4+'/'+_0x3032cf)[_0xa0ab('0x21')](_0x45aa87);}return null;};}function patchUpdates(_0x22fc61){return function(_0x5c315){try{jsonpatch['apply'](_0x5c315,_0x22fc61,!![]);}catch(_0x2f1d75){return BPromise[_0xa0ab('0x27')](_0x2f1d75);}return _0x5c315['save']();};}function saveUpdates(_0x3a1e1c,_0x46da02){return function(_0x5f526a){if(_0x5f526a){return _0x5f526a[_0xa0ab('0x28')](_0x3a1e1c)[_0xa0ab('0x29')](function(_0x2f396b){return _0x2f396b;});}return null;};}function removeEntity(_0xd94cc8,_0x36e4bd){return function(_0x5cffff){if(_0x5cffff){return _0x5cffff[_0xa0ab('0x2a')]()[_0xa0ab('0x29')](function(){var _0xb0797e=_0x5cffff['get']({'plain':!![]});var _0x47a8e5=_0xa0ab('0x2b');return db[_0xa0ab('0x2c')][_0xa0ab('0x2a')]({'where':{'type':_0x47a8e5,'resourceId':_0xb0797e['id']}})[_0xa0ab('0x29')](function(){return _0x5cffff;});})[_0xa0ab('0x29')](function(){_0xd94cc8[_0xa0ab('0x20')](0xcc)[_0xa0ab('0x1f')]();});}};}function handleEntityNotFound(_0x56324e,_0x1ad0c5){return function(_0x57c687){if(!_0x57c687){_0x56324e[_0xa0ab('0x1e')](0x194);}return _0x57c687;};}function handleError(_0x2b6cb6,_0x546137){_0x546137=_0x546137||0x1f4;return function(_0x42bba1){logger[_0xa0ab('0x2d')](_0x42bba1[_0xa0ab('0x2e')]);if(_0x42bba1[_0xa0ab('0x2f')]){delete _0x42bba1[_0xa0ab('0x2f')];}_0x2b6cb6[_0xa0ab('0x20')](_0x546137)[_0xa0ab('0x30')](_0x42bba1);};}exports[_0xa0ab('0x31')]=function(_0xa08bed,_0x3bea4c){var _0x14f309={},_0x3ade31={},_0x35d4d3={'count':0x0,'rows':[]};var _0x27a3d0=_['map'](db[_0xa0ab('0x32')][_0xa0ab('0x33')],function(_0x1d96a1){return{'name':_0x1d96a1['fieldName'],'type':_0x1d96a1['type'][_0xa0ab('0x34')]};});_0x3ade31['model']=_[_0xa0ab('0x35')](_0x27a3d0,_0xa0ab('0x2f'));_0x3ade31[_0xa0ab('0x36')]=_['keys'](_0xa08bed[_0xa0ab('0x36')]);_0x3ade31['filters']=_['intersection'](_0x3ade31[_0xa0ab('0x37')],_0x3ade31[_0xa0ab('0x36')]);_0x14f309[_0xa0ab('0x38')]=_[_0xa0ab('0x39')](_0x3ade31['model'],qs[_0xa0ab('0x3a')](_0xa08bed['query'][_0xa0ab('0x3a')]));_0x14f309[_0xa0ab('0x38')]=_0x14f309['attributes']['length']?_0x14f309[_0xa0ab('0x38')]:_0x3ade31[_0xa0ab('0x37')];if(!_0xa08bed[_0xa0ab('0x36')][_0xa0ab('0x3b')](_0xa0ab('0x3c'))){_0x14f309[_0xa0ab('0x24')]=qs[_0xa0ab('0x24')](_0xa08bed[_0xa0ab('0x36')][_0xa0ab('0x24')]);_0x14f309[_0xa0ab('0x23')]=qs[_0xa0ab('0x23')](_0xa08bed[_0xa0ab('0x36')][_0xa0ab('0x23')]);}_0x14f309[_0xa0ab('0x3d')]=qs[_0xa0ab('0x3e')](_0xa08bed['query']['sort']);_0x14f309['where']=qs['filters'](_[_0xa0ab('0x3f')](_0xa08bed[_0xa0ab('0x36')],_0x3ade31[_0xa0ab('0x40')]));if(_0xa08bed[_0xa0ab('0x36')][_0xa0ab('0x41')]){_0x14f309[_0xa0ab('0x42')]=_[_0xa0ab('0x43')](_0x14f309[_0xa0ab('0x42')],{'$or':_[_0xa0ab('0x35')](_0x27a3d0,function(_0x1267f4){if(_0x1267f4['type']!==_0xa0ab('0x44')){var _0x1492bd={};_0x1492bd[_0x1267f4['name']]={'$like':'%'+_0xa08bed[_0xa0ab('0x36')][_0xa0ab('0x41')]+'%'};return _0x1492bd;}})});}_0x14f309=_[_0xa0ab('0x43')]({},_0x14f309,_0xa08bed['options']);var _0x738886={'where':_0x14f309['where']};return db[_0xa0ab('0x32')][_0xa0ab('0x22')](_0x738886)[_0xa0ab('0x29')](function(_0x800819){_0x35d4d3[_0xa0ab('0x22')]=_0x800819;if(_0xa08bed[_0xa0ab('0x36')][_0xa0ab('0x45')]){_0x14f309[_0xa0ab('0x46')]=[{'all':!![]}];}return db[_0xa0ab('0x32')]['findAll'](_0x14f309);})['then'](function(_0x218210){_0x35d4d3[_0xa0ab('0x47')]=_0x218210;return _0x35d4d3;})[_0xa0ab('0x29')](respondWithFilteredResult(_0x3bea4c,_0x14f309))['catch'](handleError(_0x3bea4c,null));};exports[_0xa0ab('0x48')]=function(_0x5074ff,_0x46da90){var _0x5bd400={'raw':!![],'where':{'id':_0x5074ff[_0xa0ab('0x49')]['id']}},_0x127901={};_0x127901[_0xa0ab('0x37')]=_[_0xa0ab('0x4a')](db[_0xa0ab('0x32')][_0xa0ab('0x33')]);_0x127901[_0xa0ab('0x36')]=_[_0xa0ab('0x4a')](_0x5074ff[_0xa0ab('0x36')]);_0x127901[_0xa0ab('0x40')]=_[_0xa0ab('0x39')](_0x127901[_0xa0ab('0x37')],_0x127901['query']);_0x5bd400[_0xa0ab('0x38')]=_['intersection'](_0x127901['model'],qs[_0xa0ab('0x3a')](_0x5074ff[_0xa0ab('0x36')][_0xa0ab('0x3a')]));_0x5bd400[_0xa0ab('0x38')]=_0x5bd400[_0xa0ab('0x38')]['length']?_0x5bd400[_0xa0ab('0x38')]:_0x127901['model'];if(_0x5074ff['query'][_0xa0ab('0x45')]){_0x5bd400[_0xa0ab('0x46')]=[{'all':!![]}];}_0x5bd400=_[_0xa0ab('0x43')]({},_0x5bd400,_0x5074ff[_0xa0ab('0x4b')]);return db[_0xa0ab('0x32')][_0xa0ab('0x4c')](_0x5bd400)[_0xa0ab('0x29')](handleEntityNotFound(_0x46da90,null))[_0xa0ab('0x29')](respondWithResult(_0x46da90,null))['catch'](handleError(_0x46da90,null));};exports['create']=function(_0x30ddd6,_0x4216a7){return db[_0xa0ab('0x32')][_0xa0ab('0x4d')](_0x30ddd6[_0xa0ab('0x4e')],{})[_0xa0ab('0x29')](function(_0x48d464){var _0x2c5bdb=_0x30ddd6['user'][_0xa0ab('0x4f')]({'plain':!![]});if(!_0x2c5bdb)throw new Error(_0xa0ab('0x50'));if(_0x2c5bdb[_0xa0ab('0x51')]===_0xa0ab('0x52')){var _0x1637ba=_0x48d464[_0xa0ab('0x4f')]({'plain':!![]});var _0x21d4d3=_0xa0ab('0x2b');return db[_0xa0ab('0x53')]['find']({'where':{'name':_0x21d4d3,'userProfileId':_0x2c5bdb[_0xa0ab('0x54')]},'raw':!![]})[_0xa0ab('0x29')](function(_0x46f682){if(_0x46f682&&_0x46f682['autoAssociation']===0x0){return db[_0xa0ab('0x2c')][_0xa0ab('0x4d')]({'name':_0x1637ba[_0xa0ab('0x2f')],'resourceId':_0x1637ba['id'],'type':_0x46f682['name'],'sectionId':_0x46f682['id']},{})[_0xa0ab('0x29')](function(){return _0x48d464;});}else{return _0x48d464;}})[_0xa0ab('0x55')](function(_0x164312){logger['error'](_0xa0ab('0x56'),_0x164312);throw _0x164312;});}return _0x48d464;})[_0xa0ab('0x29')](respondWithResult(_0x4216a7,0xc9))[_0xa0ab('0x55')](handleError(_0x4216a7,null));};exports[_0xa0ab('0x28')]=function(_0x4f8f6e,_0x2685ea){if(_0x4f8f6e[_0xa0ab('0x4e')]['id']){delete _0x4f8f6e[_0xa0ab('0x4e')]['id'];}return db[_0xa0ab('0x32')][_0xa0ab('0x4c')]({'where':{'id':_0x4f8f6e[_0xa0ab('0x49')]['id']}})['then'](handleEntityNotFound(_0x2685ea,null))['then'](saveUpdates(_0x4f8f6e['body'],null))[_0xa0ab('0x29')](respondWithResult(_0x2685ea,null))[_0xa0ab('0x55')](handleError(_0x2685ea,null));};exports[_0xa0ab('0x2a')]=function(_0x19f467,_0xa03f00){return db['MailQueue'][_0xa0ab('0x4c')]({'where':{'id':_0x19f467['params']['id']}})[_0xa0ab('0x29')](handleEntityNotFound(_0xa03f00,null))[_0xa0ab('0x29')](removeEntity(_0xa03f00,null))['catch'](handleError(_0xa03f00,null));};exports[_0xa0ab('0x57')]=function(_0x3c7c6b,_0x3008a0){return db[_0xa0ab('0x32')][_0xa0ab('0x57')]()['then'](respondWithResult(_0x3008a0,null))['catch'](handleError(_0x3008a0,null));};exports[_0xa0ab('0x58')]=function(_0x4e1049,_0x26a475,_0x2655fd){var _0x3fa9ad={'raw':!![],'where':{}},_0x42904c={},_0x32d655;return db[_0xa0ab('0x32')][_0xa0ab('0x59')]({'where':{'id':_0x4e1049[_0xa0ab('0x49')]['id']}})[_0xa0ab('0x29')](handleEntityNotFound(_0x26a475,null))['then'](function(_0x19e220){if(_0x19e220){_0x32d655=_0x19e220[_0xa0ab('0x4f')]({'plain':!![]});_0x42904c[_0xa0ab('0x37')]=_[_0xa0ab('0x4a')](db['UserMailQueue']['rawAttributes']);_0x42904c['query']=_[_0xa0ab('0x4a')](_0x4e1049[_0xa0ab('0x36')]);_0x42904c[_0xa0ab('0x40')]=_[_0xa0ab('0x39')](_0x42904c[_0xa0ab('0x37')],_0x42904c['query']);_0x3fa9ad[_0xa0ab('0x38')]=_[_0xa0ab('0x39')](_0x42904c[_0xa0ab('0x37')],qs[_0xa0ab('0x3a')](_0x4e1049[_0xa0ab('0x36')][_0xa0ab('0x3a')]));_0x3fa9ad[_0xa0ab('0x38')]=_0x3fa9ad[_0xa0ab('0x38')][_0xa0ab('0x5a')]?_0x3fa9ad[_0xa0ab('0x38')]:_0x42904c[_0xa0ab('0x37')];if(!_0x4e1049[_0xa0ab('0x36')][_0xa0ab('0x3b')](_0xa0ab('0x3c'))){_0x3fa9ad[_0xa0ab('0x24')]=qs['limit'](_0x4e1049[_0xa0ab('0x36')][_0xa0ab('0x24')]);_0x3fa9ad[_0xa0ab('0x23')]=qs[_0xa0ab('0x23')](_0x4e1049[_0xa0ab('0x36')][_0xa0ab('0x23')]);}_0x3fa9ad[_0xa0ab('0x3d')]=qs[_0xa0ab('0x3e')](_0x4e1049[_0xa0ab('0x36')]['sort']);_0x3fa9ad['where']=qs['filters'](_[_0xa0ab('0x3f')](_0x4e1049[_0xa0ab('0x36')],_0x42904c[_0xa0ab('0x40')]));_0x3fa9ad[_0xa0ab('0x42')][_0xa0ab('0x5b')]=_0x19e220['id'];if(_0x4e1049[_0xa0ab('0x36')][_0xa0ab('0x41')]){_0x3fa9ad['where']=_['merge'](_0x3fa9ad[_0xa0ab('0x42')],{'$or':_[_0xa0ab('0x35')](_0x3fa9ad[_0xa0ab('0x38')],function(_0x1603c4){var _0x14bcdd={};_0x14bcdd[_0x1603c4]={'$like':'%'+_0x4e1049[_0xa0ab('0x36')][_0xa0ab('0x41')]+'%'};return _0x14bcdd;})});}_0x3fa9ad=_[_0xa0ab('0x43')]({},_0x3fa9ad,_0x4e1049['options']);return db[_0xa0ab('0x5c')][_0xa0ab('0x5d')](_0x3fa9ad);}})[_0xa0ab('0x29')](function(_0x10a491){if(_0x10a491){return db['User'][_0xa0ab('0x5e')]({'where':{'id':_['map'](_0x10a491,_0xa0ab('0x5f')),'role':_0xa0ab('0x60')},'attributes':['id',_0xa0ab('0x2f'),'mailPause',_0xa0ab('0x61'),_0xa0ab('0x62')]});}})[_0xa0ab('0x29')](function(_0x345965){if(_0x345965){return{'count':_0x345965[_0xa0ab('0x22')],'rows':_[_0xa0ab('0x35')](_0x345965[_0xa0ab('0x47')],function(_0x196dc6){return{'membername':_0x196dc6[_0xa0ab('0x2f')],'UserId':_0x196dc6['id'],'queue_name':_0x32d655[_0xa0ab('0x2f')],'MailQueueId':_0x32d655['id'],'interface':util[_0xa0ab('0x63')](_0xa0ab('0x64'),_0xa0ab('0x65'),_0x196dc6[_0xa0ab('0x2f')]),'penalty':0x0,'paused':_0x196dc6[_0xa0ab('0x66')],'createdAt':_0x196dc6[_0xa0ab('0x62')],'updatedAt':_0x196dc6[_0xa0ab('0x61')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xa0ab('0x29')](respondWithFilteredResult(_0x26a475,_0x3fa9ad))[_0xa0ab('0x55')](handleError(_0x26a475,null));};exports['getTeams']=function(_0x4fa447,_0x52c73d,_0x1b2ceb){var _0x206367={};var _0xd9339b={};var _0x394745;var _0x687109;return db[_0xa0ab('0x32')]['findOne']({'where':{'id':_0x4fa447[_0xa0ab('0x49')]['id']}})[_0xa0ab('0x29')](handleEntityNotFound(_0x52c73d,null))['then'](function(_0x4ea854){if(_0x4ea854){_0x394745=_0x4ea854;_0xd9339b[_0xa0ab('0x37')]=_[_0xa0ab('0x4a')](db[_0xa0ab('0x67')][_0xa0ab('0x33')]);_0xd9339b['query']=_['keys'](_0x4fa447['query']);_0xd9339b[_0xa0ab('0x40')]=_[_0xa0ab('0x39')](_0xd9339b[_0xa0ab('0x37')],_0xd9339b[_0xa0ab('0x36')]);_0x206367[_0xa0ab('0x38')]=_['intersection'](_0xd9339b['model'],qs['fields'](_0x4fa447[_0xa0ab('0x36')]['fields']));_0x206367[_0xa0ab('0x38')]=_0x206367[_0xa0ab('0x38')][_0xa0ab('0x5a')]?_0x206367[_0xa0ab('0x38')]:_0xd9339b[_0xa0ab('0x37')];_0x206367[_0xa0ab('0x3d')]=qs[_0xa0ab('0x3e')](_0x4fa447[_0xa0ab('0x36')][_0xa0ab('0x3e')]);_0x206367['where']=qs['filters'](_[_0xa0ab('0x3f')](_0x4fa447[_0xa0ab('0x36')],_0xd9339b[_0xa0ab('0x40')]));if(_0x4fa447[_0xa0ab('0x36')][_0xa0ab('0x41')]){_0x206367[_0xa0ab('0x42')]=_['merge'](_0x206367[_0xa0ab('0x42')],{'$or':_[_0xa0ab('0x35')](_0x206367[_0xa0ab('0x38')],function(_0x189ca4){var _0x247227={};_0x247227[_0x189ca4]={'$like':'%'+_0x4fa447['query'][_0xa0ab('0x41')]+'%'};return _0x247227;})});}_0x206367=_['merge']({},_0x206367,_0x4fa447[_0xa0ab('0x4b')]);return _0x394745[_0xa0ab('0x68')](_0x206367);}})[_0xa0ab('0x29')](function(_0x5ede7c){if(_0x5ede7c){_0x687109=_0x5ede7c[_0xa0ab('0x5a')];if(!_0x4fa447['query'][_0xa0ab('0x3b')](_0xa0ab('0x3c'))){_0x206367[_0xa0ab('0x24')]=qs[_0xa0ab('0x24')](_0x4fa447[_0xa0ab('0x36')][_0xa0ab('0x24')]);_0x206367[_0xa0ab('0x23')]=qs['offset'](_0x4fa447['query'][_0xa0ab('0x23')]);}return _0x394745[_0xa0ab('0x68')](_0x206367);}})[_0xa0ab('0x29')](function(_0x53285e){if(_0x53285e){return _0x53285e?{'count':_0x687109,'rows':_0x53285e}:null;}})[_0xa0ab('0x29')](respondWithResult(_0x52c73d,null))['catch'](handleError(_0x52c73d,null));};exports[_0xa0ab('0x69')]=function(_0x16bf1f,_0x201eb9,_0x16bac3){var _0x3f9860=_0x16bf1f[_0xa0ab('0x4e')][_0xa0ab('0x6a')];return db[_0xa0ab('0x67')][_0xa0ab('0x5d')]({'where':{'id':_0x3f9860},'attributes':['id'],'include':[{'model':db[_0xa0ab('0x6b')],'as':_0xa0ab('0x6c'),'attributes':['id',_0xa0ab('0x2f'),'online',_0xa0ab('0x6d'),'interface'],'raw':!![]}]})[_0xa0ab('0x29')](function(_0x12e050){if(_0x12e050){var _0x43f581=_[_0xa0ab('0x6e')](_0x12e050,function(_0x3e269d){var _0x286eb0=_0x3e269d[_0xa0ab('0x4f')]({'plain':!![]});return _0x286eb0[_0xa0ab('0x6c')];});return db['MailQueue'][_0xa0ab('0x4c')]({'where':{'id':_0x16bf1f[_0xa0ab('0x49')]['id']}})[_0xa0ab('0x29')](function(_0x2b88e4){return db[_0xa0ab('0x6f')][_0xa0ab('0x70')](function(_0x2b66ae){return _0x2b88e4[_0xa0ab('0x69')](_0x3f9860,{'transaction':_0x2b66ae})[_0xa0ab('0x29')](function(){return BPromise[_0xa0ab('0x71')](_0x43f581,function(_0x51205a){return db[_0xa0ab('0x5c')][_0xa0ab('0x72')]({'where':{'UserId':_0x51205a['id'],'MailQueueId':_0x16bf1f['params']['id']},'transaction':_0x2b66ae});});})['then'](function(){_0x43f581[_0xa0ab('0x73')](function(_0x12489c){socket['emit'](_0xa0ab('0x74'),{'UserId':_0x12489c['id'],'MailQueueId':_0x2b88e4['id']});});});});});}})['then'](respondWithStatusCode(_0x201eb9,null))[_0xa0ab('0x55')](handleError(_0x201eb9,null));};exports[_0xa0ab('0x75')]=function(_0x16e1eb,_0x5c7f1e,_0x37aec7){return db[_0xa0ab('0x67')]['findAll']({'where':{'id':_0x16e1eb[_0xa0ab('0x36')]['ids']},'attributes':['id'],'include':[{'model':db[_0xa0ab('0x6b')],'as':_0xa0ab('0x6c'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x5c7f1e,null))[_0xa0ab('0x29')](function(_0x3cbec0){var _0x2e741d=_[_0xa0ab('0x35')](_0x3cbec0,'id');var _0xea861d=[];var _0x4e387c=[];var _0x5d6ac1=squel['select']();_0x5d6ac1[_0xa0ab('0x76')](_0xa0ab('0x77'))[_0xa0ab('0x78')](_0xa0ab('0x79'),'tq')['join'](_0xa0ab('0x7a'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xa0ab('0x42')]('MailQueueId\x20=\x20?',_0x16e1eb['params']['id']);for(var _0x2e2a4b=0x0;_0x2e2a4b<_0x3cbec0[_0xa0ab('0x5a')];_0x2e2a4b+=0x1){let _0x113db7=_0x3cbec0[_0x2e2a4b];for(var _0xff8745=0x0;_0xff8745<_0x113db7['Agents']['length'];_0xff8745+=0x1){let _0x3f45bb=_0x113db7[_0xa0ab('0x6c')][_0xff8745];var _0xe04631=_0x5d6ac1['clone']();_0xe04631[_0xa0ab('0x42')]('ut.UserId\x20=\x20?',_0x3f45bb['id']);_0x4e387c[_0xa0ab('0x7b')](db[_0xa0ab('0x6f')][_0xa0ab('0x36')](_0xe04631[_0xa0ab('0x7c')](),{'type':db['sequelize']['QueryTypes'][_0xa0ab('0x7d')]})[_0xa0ab('0x29')](function(_0x2556e3){if(_0x2556e3[_0xa0ab('0x5a')]===0x1){return _0x3f45bb['id'];}else{var _0x4f6bb3=_[_0xa0ab('0x7e')](_[_0xa0ab('0x35')](_0x2556e3,_0xa0ab('0x7f')),function(_0x37e3ee){return _[_0xa0ab('0x80')](_0x2e741d,_0x37e3ee);});if(_0x4f6bb3){return _0x3f45bb['id'];}}}));}}return BPromise[_0xa0ab('0x81')](_0x4e387c)['then'](function(_0x4520f6){_0xea861d=_(_0xea861d)[_0xa0ab('0x82')](_0x4520f6)['compact']()[_0xa0ab('0x83')]();return db[_0xa0ab('0x32')][_0xa0ab('0x4c')]({'where':{'id':_0x16e1eb[_0xa0ab('0x49')]['id']}})[_0xa0ab('0x29')](function(_0x2323b4){return db['sequelize'][_0xa0ab('0x70')](function(_0x42a17b){return _0x2323b4[_0xa0ab('0x75')](_0x16e1eb[_0xa0ab('0x36')][_0xa0ab('0x6a')],{'transaction':_0x42a17b})[_0xa0ab('0x29')](function(){if(!_[_0xa0ab('0x84')](_0xea861d)){return _0x2323b4[_0xa0ab('0x85')](_0xea861d,{'transaction':_0x42a17b});}})[_0xa0ab('0x29')](function(){_0xea861d[_0xa0ab('0x73')](function(_0x166877){socket['emit'](_0xa0ab('0x86'),{'UserId':_0x166877,'MailQueueId':_0x2323b4['id']});});});});});});})[_0xa0ab('0x29')](respondWithStatusCode(_0x5c7f1e,null))[_0xa0ab('0x55')](handleError(_0x5c7f1e,null));};exports[_0xa0ab('0x87')]=function(_0x5875f0,_0x4fb2de,_0x1d1559){return db['MailQueue'][_0xa0ab('0x4c')]({'where':{'id':_0x5875f0[_0xa0ab('0x49')]['id']}})[_0xa0ab('0x29')](handleEntityNotFound(_0x4fb2de,null))[_0xa0ab('0x29')](function(_0x257525){if(_0x257525){return _0x257525[_0xa0ab('0x87')](_0x5875f0[_0xa0ab('0x4e')][_0xa0ab('0x6a')],_[_0xa0ab('0x88')](_0x5875f0['body'],[_0xa0ab('0x6a'),'id'])||{})[_0xa0ab('0x89')](function(_0x486668){for(var _0xe002b6=0x0;_0xe002b6<_0x5875f0[_0xa0ab('0x4e')]['ids']['length'];_0xe002b6+=0x1){socket[_0xa0ab('0x8a')](_0xa0ab('0x74'),{'UserId':_0x5875f0[_0xa0ab('0x4e')]['ids'][_0xe002b6],'MailQueueId':_0x5875f0['params']['id']});}return _0x486668;});}})[_0xa0ab('0x29')](respondWithResult(_0x4fb2de,null))[_0xa0ab('0x55')](handleError(_0x4fb2de,null));};exports[_0xa0ab('0x85')]=function(_0x2dbb21,_0x470120,_0x5e6e44){return db[_0xa0ab('0x32')]['find']({'where':{'id':_0x2dbb21['params']['id']}})[_0xa0ab('0x29')](handleEntityNotFound(_0x470120,null))[_0xa0ab('0x29')](function(_0x2d6208){if(_0x2d6208){return _0x2d6208[_0xa0ab('0x85')](_0x2dbb21['query'][_0xa0ab('0x6a')])[_0xa0ab('0x29')](function(){if(_[_0xa0ab('0x8b')](_0x2dbb21[_0xa0ab('0x36')][_0xa0ab('0x6a')])){for(var _0xd507a9=0x0;_0xd507a9<_0x2dbb21['query'][_0xa0ab('0x6a')]['length'];_0xd507a9+=0x1){socket[_0xa0ab('0x8a')](_0xa0ab('0x86'),{'UserId':Number(_0x2dbb21[_0xa0ab('0x36')][_0xa0ab('0x6a')][_0xd507a9]),'MailQueueId':Number(_0x2dbb21['params']['id'])});}}else{socket[_0xa0ab('0x8a')](_0xa0ab('0x86'),{'UserId':Number(_0x2dbb21[_0xa0ab('0x36')]['ids']),'MailQueueId':Number(_0x2dbb21['params']['id'])});}});}})[_0xa0ab('0x29')](respondWithStatusCode(_0x470120,null))[_0xa0ab('0x55')](handleError(_0x470120,null));};exports['getAgents']=function(_0x3fdc07,_0x279a2a,_0x3f4cb7){var _0x2590c8={};var _0x133d66={};var _0x3b8027;var _0x48e5b0;return db[_0xa0ab('0x32')][_0xa0ab('0x59')]({'where':{'id':_0x3fdc07['params']['id']}})[_0xa0ab('0x29')](handleEntityNotFound(_0x279a2a,null))[_0xa0ab('0x29')](function(_0x466c30){if(_0x466c30){_0x3b8027=_0x466c30;_0x133d66[_0xa0ab('0x37')]=_[_0xa0ab('0x4a')](db[_0xa0ab('0x6b')][_0xa0ab('0x33')]);_0x133d66[_0xa0ab('0x36')]=_[_0xa0ab('0x4a')](_0x3fdc07[_0xa0ab('0x36')]);_0x133d66[_0xa0ab('0x40')]=_[_0xa0ab('0x39')](_0x133d66[_0xa0ab('0x37')],_0x133d66[_0xa0ab('0x36')]);_0x2590c8[_0xa0ab('0x38')]=_[_0xa0ab('0x39')](_0x133d66[_0xa0ab('0x37')],qs[_0xa0ab('0x3a')](_0x3fdc07['query']['fields']));_0x2590c8[_0xa0ab('0x38')]=_0x2590c8['attributes'][_0xa0ab('0x5a')]?_0x2590c8[_0xa0ab('0x38')]:_0x133d66['model'];_0x2590c8[_0xa0ab('0x3d')]=qs[_0xa0ab('0x3e')](_0x3fdc07['query']['sort']);_0x2590c8[_0xa0ab('0x42')]=qs[_0xa0ab('0x40')](_[_0xa0ab('0x3f')](_0x3fdc07[_0xa0ab('0x36')],_0x133d66[_0xa0ab('0x40')]));if(_0x3fdc07[_0xa0ab('0x36')]['filter']){_0x2590c8[_0xa0ab('0x42')]=_[_0xa0ab('0x43')](_0x2590c8[_0xa0ab('0x42')],{'$or':_[_0xa0ab('0x35')](_0x2590c8[_0xa0ab('0x38')],function(_0x181209){var _0x4573a9={};_0x4573a9[_0x181209]={'$like':'%'+_0x3fdc07[_0xa0ab('0x36')][_0xa0ab('0x41')]+'%'};return _0x4573a9;})});}_0x2590c8=_[_0xa0ab('0x43')]({},_0x2590c8,_0x3fdc07[_0xa0ab('0x4b')]);return _0x3b8027['getAgents'](_0x2590c8);}})[_0xa0ab('0x29')](function(_0x3e97fe){if(_0x3e97fe){_0x48e5b0=_0x3e97fe[_0xa0ab('0x5a')];if(!_0x3fdc07[_0xa0ab('0x36')][_0xa0ab('0x3b')]('nolimit')){_0x2590c8[_0xa0ab('0x24')]=qs['limit'](_0x3fdc07[_0xa0ab('0x36')][_0xa0ab('0x24')]);_0x2590c8[_0xa0ab('0x23')]=qs[_0xa0ab('0x23')](_0x3fdc07[_0xa0ab('0x36')][_0xa0ab('0x23')]);}return _0x3b8027[_0xa0ab('0x8c')](_0x2590c8);}})['then'](function(_0xb40bd8){if(_0xb40bd8){return _0xb40bd8?{'count':_0x48e5b0,'rows':_0xb40bd8}:null;}})['then'](respondWithResult(_0x279a2a,null))[_0xa0ab('0x55')](handleError(_0x279a2a,null));}; \ No newline at end of file +var _0xd1bb=['offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','get','MailQueues','UserProfileResource','sendStatus','error','stack','name','send','MailQueue','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','sort','where','filters','pick','merge','map','filter','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getMembers','UserMailQueue','hasOwnProperty','order','MailQueueId','UserId','agent','mailPause','updatedAt','format','%s/%s','SIP','getTeams','findOne','Team','addTeams','ids','User','Agents','online','transaction','each','forEach','userMailQueue:save','field','from','team_has_mail_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','sequelize','QueryTypes','SELECT','TeamId','includes','all','union','compact','value','removeTeams','isEmpty','removeAgents','emit','userMailQueue:remove','addAgents','omit','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','defaults','localhost','socket.io-emitter','register','status','end','count'];(function(_0x14502d,_0x2f9cda){var _0x2843eb=function(_0x3647e7){while(--_0x3647e7){_0x14502d['push'](_0x14502d['shift']());}};_0x2843eb(++_0x2f9cda);}(_0xd1bb,0xf7));var _0xbd1b=function(_0x343811,_0x43bef0){_0x343811=_0x343811-0x0;var _0x3f35a0=_0xd1bb[_0x343811];return _0x3f35a0;};'use strict';var pdf=require(_0xbd1b('0x0'));var emlformat=require(_0xbd1b('0x1'));var rimraf=require(_0xbd1b('0x2'));var zipdir=require(_0xbd1b('0x3'));var jsonpatch=require(_0xbd1b('0x4'));var rp=require('request-promise');var moment=require(_0xbd1b('0x5'));var BPromise=require(_0xbd1b('0x6'));var Mustache=require(_0xbd1b('0x7'));var util=require('util');var path=require(_0xbd1b('0x8'));var sox=require(_0xbd1b('0x9'));var csv=require('to-csv');var ejs=require(_0xbd1b('0xa'));var fs=require('fs');var _=require(_0xbd1b('0xb'));var squel=require(_0xbd1b('0xc'));var crypto=require(_0xbd1b('0xd'));var jsforce=require(_0xbd1b('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xbd1b('0xf'));var querystring=require(_0xbd1b('0x10'));var Papa=require(_0xbd1b('0x11'));var Redis=require('ioredis');var authService=require(_0xbd1b('0x12'));var qs=require(_0xbd1b('0x13'));var as=require(_0xbd1b('0x14'));var hardwareService=require(_0xbd1b('0x15'));var logger=require('../../config/logger')(_0xbd1b('0x16'));var utils=require('../../config/utils');var config=require(_0xbd1b('0x17'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xbd1b('0x18')](config['redis'],{'host':_0xbd1b('0x19'),'port':0x18eb});var socket=require(_0xbd1b('0x1a'))(new Redis(config['redis']));require('./mailQueue.socket')[_0xbd1b('0x1b')](socket);function respondWithStatusCode(_0x2a14e3,_0x344ceb){_0x344ceb=_0x344ceb||0xcc;return function(_0x12a1a0){if(_0x12a1a0){return _0x2a14e3['sendStatus'](_0x344ceb);}return _0x2a14e3[_0xbd1b('0x1c')](_0x344ceb)[_0xbd1b('0x1d')]();};}function respondWithResult(_0x3d11b7,_0x1d1545){_0x1d1545=_0x1d1545||0xc8;return function(_0x329840){if(_0x329840){return _0x3d11b7[_0xbd1b('0x1c')](_0x1d1545)['json'](_0x329840);}};}function respondWithFilteredResult(_0x226333,_0x13407a){return function(_0x3575ae){if(_0x3575ae){var _0x35b4d4=_0x3575ae[_0xbd1b('0x1e')],_0x326f76=_0x13407a[_0xbd1b('0x1f')],_0x2040c1=_0x13407a[_0xbd1b('0x1f')]+_0x13407a[_0xbd1b('0x20')],_0x361aa7;if(_0x2040c1>=_0x35b4d4){_0x2040c1=_0x35b4d4;_0x361aa7=0xc8;}else{_0x361aa7=0xce;}_0x226333['status'](_0x361aa7);return _0x226333[_0xbd1b('0x21')](_0xbd1b('0x22'),_0x326f76+'-'+_0x2040c1+'/'+_0x35b4d4)[_0xbd1b('0x23')](_0x3575ae);}return null;};}function patchUpdates(_0x217538){return function(_0x14d2b0){try{jsonpatch[_0xbd1b('0x24')](_0x14d2b0,_0x217538,!![]);}catch(_0x47792e){return BPromise[_0xbd1b('0x25')](_0x47792e);}return _0x14d2b0[_0xbd1b('0x26')]();};}function saveUpdates(_0x5e621e,_0xc4467f){return function(_0x37feb6){if(_0x37feb6){return _0x37feb6[_0xbd1b('0x27')](_0x5e621e)[_0xbd1b('0x28')](function(_0x313ae2){return _0x313ae2;});}return null;};}function removeEntity(_0x2613c6,_0x4c3060){return function(_0x10994c){if(_0x10994c){return _0x10994c[_0xbd1b('0x29')]()[_0xbd1b('0x28')](function(){var _0x48dfb0=_0x10994c[_0xbd1b('0x2a')]({'plain':!![]});var _0xc88aab=_0xbd1b('0x2b');return db[_0xbd1b('0x2c')][_0xbd1b('0x29')]({'where':{'type':_0xc88aab,'resourceId':_0x48dfb0['id']}})['then'](function(){return _0x10994c;});})[_0xbd1b('0x28')](function(){_0x2613c6[_0xbd1b('0x1c')](0xcc)[_0xbd1b('0x1d')]();});}};}function handleEntityNotFound(_0x5746e8,_0x47162f){return function(_0x40b4ca){if(!_0x40b4ca){_0x5746e8[_0xbd1b('0x2d')](0x194);}return _0x40b4ca;};}function handleError(_0x2817b3,_0x4054e4){_0x4054e4=_0x4054e4||0x1f4;return function(_0x371119){logger[_0xbd1b('0x2e')](_0x371119[_0xbd1b('0x2f')]);if(_0x371119[_0xbd1b('0x30')]){delete _0x371119['name'];}_0x2817b3['status'](_0x4054e4)[_0xbd1b('0x31')](_0x371119);};}exports['index']=function(_0x2fb573,_0x197a24){var _0x19c290={},_0x426a43={},_0x5c1a5c={'count':0x0,'rows':[]};var _0x29f698=_['map'](db[_0xbd1b('0x32')][_0xbd1b('0x33')],function(_0x17f8da){return{'name':_0x17f8da[_0xbd1b('0x34')],'type':_0x17f8da[_0xbd1b('0x35')][_0xbd1b('0x36')]};});_0x426a43[_0xbd1b('0x37')]=_['map'](_0x29f698,'name');_0x426a43[_0xbd1b('0x38')]=_[_0xbd1b('0x39')](_0x2fb573[_0xbd1b('0x38')]);_0x426a43['filters']=_[_0xbd1b('0x3a')](_0x426a43[_0xbd1b('0x37')],_0x426a43['query']);_0x19c290[_0xbd1b('0x3b')]=_[_0xbd1b('0x3a')](_0x426a43['model'],qs[_0xbd1b('0x3c')](_0x2fb573[_0xbd1b('0x38')][_0xbd1b('0x3c')]));_0x19c290[_0xbd1b('0x3b')]=_0x19c290[_0xbd1b('0x3b')][_0xbd1b('0x3d')]?_0x19c290[_0xbd1b('0x3b')]:_0x426a43[_0xbd1b('0x37')];if(!_0x2fb573[_0xbd1b('0x38')]['hasOwnProperty'](_0xbd1b('0x3e'))){_0x19c290[_0xbd1b('0x20')]=qs[_0xbd1b('0x20')](_0x2fb573[_0xbd1b('0x38')]['limit']);_0x19c290[_0xbd1b('0x1f')]=qs[_0xbd1b('0x1f')](_0x2fb573['query']['offset']);}_0x19c290['order']=qs[_0xbd1b('0x3f')](_0x2fb573['query']['sort']);_0x19c290[_0xbd1b('0x40')]=qs[_0xbd1b('0x41')](_[_0xbd1b('0x42')](_0x2fb573[_0xbd1b('0x38')],_0x426a43[_0xbd1b('0x41')]));if(_0x2fb573[_0xbd1b('0x38')]['filter']){_0x19c290[_0xbd1b('0x40')]=_[_0xbd1b('0x43')](_0x19c290[_0xbd1b('0x40')],{'$or':_[_0xbd1b('0x44')](_0x29f698,function(_0x31b3d2){if(_0x31b3d2[_0xbd1b('0x35')]!=='VIRTUAL'){var _0x43ee5b={};_0x43ee5b[_0x31b3d2[_0xbd1b('0x30')]]={'$like':'%'+_0x2fb573[_0xbd1b('0x38')][_0xbd1b('0x45')]+'%'};return _0x43ee5b;}})});}_0x19c290=_['merge']({},_0x19c290,_0x2fb573[_0xbd1b('0x46')]);var _0x4982f0={'where':_0x19c290['where']};return db[_0xbd1b('0x32')][_0xbd1b('0x1e')](_0x4982f0)[_0xbd1b('0x28')](function(_0x5027c4){_0x5c1a5c[_0xbd1b('0x1e')]=_0x5027c4;if(_0x2fb573[_0xbd1b('0x38')][_0xbd1b('0x47')]){_0x19c290[_0xbd1b('0x48')]=[{'all':!![]}];}return db[_0xbd1b('0x32')][_0xbd1b('0x49')](_0x19c290);})[_0xbd1b('0x28')](function(_0x5f226c){_0x5c1a5c[_0xbd1b('0x4a')]=_0x5f226c;return _0x5c1a5c;})[_0xbd1b('0x28')](respondWithFilteredResult(_0x197a24,_0x19c290))[_0xbd1b('0x4b')](handleError(_0x197a24,null));};exports[_0xbd1b('0x4c')]=function(_0x1edac5,_0x466962){var _0x35a828={'raw':!![],'where':{'id':_0x1edac5[_0xbd1b('0x4d')]['id']}},_0x111150={};_0x111150[_0xbd1b('0x37')]=_[_0xbd1b('0x39')](db['MailQueue']['rawAttributes']);_0x111150[_0xbd1b('0x38')]=_[_0xbd1b('0x39')](_0x1edac5['query']);_0x111150[_0xbd1b('0x41')]=_[_0xbd1b('0x3a')](_0x111150['model'],_0x111150[_0xbd1b('0x38')]);_0x35a828[_0xbd1b('0x3b')]=_[_0xbd1b('0x3a')](_0x111150[_0xbd1b('0x37')],qs[_0xbd1b('0x3c')](_0x1edac5['query'][_0xbd1b('0x3c')]));_0x35a828['attributes']=_0x35a828[_0xbd1b('0x3b')][_0xbd1b('0x3d')]?_0x35a828[_0xbd1b('0x3b')]:_0x111150[_0xbd1b('0x37')];if(_0x1edac5[_0xbd1b('0x38')][_0xbd1b('0x47')]){_0x35a828[_0xbd1b('0x48')]=[{'all':!![]}];}_0x35a828=_[_0xbd1b('0x43')]({},_0x35a828,_0x1edac5['options']);return db['MailQueue'][_0xbd1b('0x4e')](_0x35a828)['then'](handleEntityNotFound(_0x466962,null))[_0xbd1b('0x28')](respondWithResult(_0x466962,null))[_0xbd1b('0x4b')](handleError(_0x466962,null));};exports[_0xbd1b('0x4f')]=function(_0x56f597,_0x23e1d5){return db[_0xbd1b('0x32')][_0xbd1b('0x4f')](_0x56f597[_0xbd1b('0x50')],{})[_0xbd1b('0x28')](function(_0x54ba08){var _0x5929df=_0x56f597['user'][_0xbd1b('0x2a')]({'plain':!![]});if(!_0x5929df)throw new Error(_0xbd1b('0x51'));if(_0x5929df[_0xbd1b('0x52')]===_0xbd1b('0x53')){var _0x4457fd=_0x54ba08[_0xbd1b('0x2a')]({'plain':!![]});var _0x1d0428=_0xbd1b('0x2b');return db[_0xbd1b('0x54')]['find']({'where':{'name':_0x1d0428,'userProfileId':_0x5929df[_0xbd1b('0x55')]},'raw':!![]})['then'](function(_0x315e17){if(_0x315e17&&_0x315e17[_0xbd1b('0x56')]===0x0){return db[_0xbd1b('0x2c')][_0xbd1b('0x4f')]({'name':_0x4457fd[_0xbd1b('0x30')],'resourceId':_0x4457fd['id'],'type':_0x315e17[_0xbd1b('0x30')],'sectionId':_0x315e17['id']},{})[_0xbd1b('0x28')](function(){return _0x54ba08;});}else{return _0x54ba08;}})['catch'](function(_0x3e92fc){logger[_0xbd1b('0x2e')](_0xbd1b('0x57'),_0x3e92fc);throw _0x3e92fc;});}return _0x54ba08;})[_0xbd1b('0x28')](respondWithResult(_0x23e1d5,0xc9))[_0xbd1b('0x4b')](handleError(_0x23e1d5,null));};exports['update']=function(_0x5e81ee,_0x4e4c11){if(_0x5e81ee[_0xbd1b('0x50')]['id']){delete _0x5e81ee[_0xbd1b('0x50')]['id'];}return db['MailQueue'][_0xbd1b('0x4e')]({'where':{'id':_0x5e81ee['params']['id']}})[_0xbd1b('0x28')](handleEntityNotFound(_0x4e4c11,null))['then'](saveUpdates(_0x5e81ee[_0xbd1b('0x50')],null))[_0xbd1b('0x28')](respondWithResult(_0x4e4c11,null))[_0xbd1b('0x4b')](handleError(_0x4e4c11,null));};exports[_0xbd1b('0x29')]=function(_0x443d0a,_0x5a7645){return db[_0xbd1b('0x32')][_0xbd1b('0x4e')]({'where':{'id':_0x443d0a[_0xbd1b('0x4d')]['id']}})[_0xbd1b('0x28')](handleEntityNotFound(_0x5a7645,null))[_0xbd1b('0x28')](removeEntity(_0x5a7645,null))['catch'](handleError(_0x5a7645,null));};exports['describe']=function(_0x66de0b,_0x9e07fa){return db[_0xbd1b('0x32')]['describe']()[_0xbd1b('0x28')](respondWithResult(_0x9e07fa,null))[_0xbd1b('0x4b')](handleError(_0x9e07fa,null));};exports[_0xbd1b('0x58')]=function(_0x27c728,_0x339839,_0x11d844){var _0x26367f={'raw':!![],'where':{}},_0x3c587b={},_0x46e444;return db[_0xbd1b('0x32')]['findOne']({'where':{'id':_0x27c728[_0xbd1b('0x4d')]['id']}})[_0xbd1b('0x28')](handleEntityNotFound(_0x339839,null))[_0xbd1b('0x28')](function(_0x58f137){if(_0x58f137){_0x46e444=_0x58f137[_0xbd1b('0x2a')]({'plain':!![]});_0x3c587b[_0xbd1b('0x37')]=_[_0xbd1b('0x39')](db[_0xbd1b('0x59')][_0xbd1b('0x33')]);_0x3c587b[_0xbd1b('0x38')]=_[_0xbd1b('0x39')](_0x27c728[_0xbd1b('0x38')]);_0x3c587b[_0xbd1b('0x41')]=_['intersection'](_0x3c587b[_0xbd1b('0x37')],_0x3c587b[_0xbd1b('0x38')]);_0x26367f['attributes']=_[_0xbd1b('0x3a')](_0x3c587b[_0xbd1b('0x37')],qs[_0xbd1b('0x3c')](_0x27c728[_0xbd1b('0x38')][_0xbd1b('0x3c')]));_0x26367f[_0xbd1b('0x3b')]=_0x26367f['attributes'][_0xbd1b('0x3d')]?_0x26367f[_0xbd1b('0x3b')]:_0x3c587b[_0xbd1b('0x37')];if(!_0x27c728['query'][_0xbd1b('0x5a')](_0xbd1b('0x3e'))){_0x26367f[_0xbd1b('0x20')]=qs[_0xbd1b('0x20')](_0x27c728[_0xbd1b('0x38')][_0xbd1b('0x20')]);_0x26367f[_0xbd1b('0x1f')]=qs['offset'](_0x27c728['query']['offset']);}_0x26367f[_0xbd1b('0x5b')]=qs[_0xbd1b('0x3f')](_0x27c728[_0xbd1b('0x38')]['sort']);_0x26367f[_0xbd1b('0x40')]=qs[_0xbd1b('0x41')](_[_0xbd1b('0x42')](_0x27c728['query'],_0x3c587b['filters']));_0x26367f[_0xbd1b('0x40')][_0xbd1b('0x5c')]=_0x58f137['id'];if(_0x27c728['query'][_0xbd1b('0x45')]){_0x26367f['where']=_[_0xbd1b('0x43')](_0x26367f[_0xbd1b('0x40')],{'$or':_[_0xbd1b('0x44')](_0x26367f[_0xbd1b('0x3b')],function(_0x1bb6ca){var _0x129ee5={};_0x129ee5[_0x1bb6ca]={'$like':'%'+_0x27c728[_0xbd1b('0x38')]['filter']+'%'};return _0x129ee5;})});}_0x26367f=_[_0xbd1b('0x43')]({},_0x26367f,_0x27c728[_0xbd1b('0x46')]);return db['UserMailQueue'][_0xbd1b('0x49')](_0x26367f);}})[_0xbd1b('0x28')](function(_0x192756){if(_0x192756){return db['User']['findAndCountAll']({'where':{'id':_[_0xbd1b('0x44')](_0x192756,_0xbd1b('0x5d')),'role':_0xbd1b('0x5e')},'attributes':['id','name',_0xbd1b('0x5f'),_0xbd1b('0x60'),'createdAt']});}})[_0xbd1b('0x28')](function(_0x8bac25){if(_0x8bac25){return{'count':_0x8bac25['count'],'rows':_[_0xbd1b('0x44')](_0x8bac25[_0xbd1b('0x4a')],function(_0x5573a5){return{'membername':_0x5573a5['name'],'UserId':_0x5573a5['id'],'queue_name':_0x46e444[_0xbd1b('0x30')],'MailQueueId':_0x46e444['id'],'interface':util[_0xbd1b('0x61')](_0xbd1b('0x62'),_0xbd1b('0x63'),_0x5573a5[_0xbd1b('0x30')]),'penalty':0x0,'paused':_0x5573a5['mailPause'],'createdAt':_0x5573a5['createdAt'],'updatedAt':_0x5573a5[_0xbd1b('0x60')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xbd1b('0x28')](respondWithFilteredResult(_0x339839,_0x26367f))[_0xbd1b('0x4b')](handleError(_0x339839,null));};exports[_0xbd1b('0x64')]=function(_0xffe7,_0x248630,_0x55ffa5){var _0x2448ea={};var _0x48aaa5={};var _0x4900ed;var _0x58c6e4;return db[_0xbd1b('0x32')][_0xbd1b('0x65')]({'where':{'id':_0xffe7[_0xbd1b('0x4d')]['id']}})[_0xbd1b('0x28')](handleEntityNotFound(_0x248630,null))[_0xbd1b('0x28')](function(_0x245328){if(_0x245328){_0x4900ed=_0x245328;_0x48aaa5['model']=_[_0xbd1b('0x39')](db[_0xbd1b('0x66')][_0xbd1b('0x33')]);_0x48aaa5['query']=_[_0xbd1b('0x39')](_0xffe7['query']);_0x48aaa5[_0xbd1b('0x41')]=_[_0xbd1b('0x3a')](_0x48aaa5['model'],_0x48aaa5[_0xbd1b('0x38')]);_0x2448ea['attributes']=_[_0xbd1b('0x3a')](_0x48aaa5[_0xbd1b('0x37')],qs[_0xbd1b('0x3c')](_0xffe7[_0xbd1b('0x38')][_0xbd1b('0x3c')]));_0x2448ea[_0xbd1b('0x3b')]=_0x2448ea[_0xbd1b('0x3b')]['length']?_0x2448ea['attributes']:_0x48aaa5['model'];_0x2448ea[_0xbd1b('0x5b')]=qs[_0xbd1b('0x3f')](_0xffe7['query'][_0xbd1b('0x3f')]);_0x2448ea[_0xbd1b('0x40')]=qs['filters'](_['pick'](_0xffe7[_0xbd1b('0x38')],_0x48aaa5[_0xbd1b('0x41')]));if(_0xffe7[_0xbd1b('0x38')][_0xbd1b('0x45')]){_0x2448ea[_0xbd1b('0x40')]=_['merge'](_0x2448ea['where'],{'$or':_[_0xbd1b('0x44')](_0x2448ea[_0xbd1b('0x3b')],function(_0xe19c43){var _0x271cdb={};_0x271cdb[_0xe19c43]={'$like':'%'+_0xffe7[_0xbd1b('0x38')][_0xbd1b('0x45')]+'%'};return _0x271cdb;})});}_0x2448ea=_[_0xbd1b('0x43')]({},_0x2448ea,_0xffe7[_0xbd1b('0x46')]);return _0x4900ed['getTeams'](_0x2448ea);}})[_0xbd1b('0x28')](function(_0x49fa9e){if(_0x49fa9e){_0x58c6e4=_0x49fa9e[_0xbd1b('0x3d')];if(!_0xffe7[_0xbd1b('0x38')]['hasOwnProperty']('nolimit')){_0x2448ea[_0xbd1b('0x20')]=qs['limit'](_0xffe7['query'][_0xbd1b('0x20')]);_0x2448ea[_0xbd1b('0x1f')]=qs[_0xbd1b('0x1f')](_0xffe7[_0xbd1b('0x38')][_0xbd1b('0x1f')]);}return _0x4900ed[_0xbd1b('0x64')](_0x2448ea);}})['then'](function(_0x3020b7){if(_0x3020b7){return _0x3020b7?{'count':_0x58c6e4,'rows':_0x3020b7}:null;}})[_0xbd1b('0x28')](respondWithResult(_0x248630,null))[_0xbd1b('0x4b')](handleError(_0x248630,null));};exports[_0xbd1b('0x67')]=function(_0x3f8736,_0x8b82aa,_0x433e01){var _0xde4ef0=_0x3f8736['body'][_0xbd1b('0x68')];return db[_0xbd1b('0x66')][_0xbd1b('0x49')]({'where':{'id':_0xde4ef0},'attributes':['id'],'include':[{'model':db[_0xbd1b('0x69')],'as':_0xbd1b('0x6a'),'attributes':['id',_0xbd1b('0x30'),_0xbd1b('0x6b'),'voicePause','interface'],'raw':!![]}]})[_0xbd1b('0x28')](function(_0x5b0da0){if(_0x5b0da0){var _0x4632df=_['flatMap'](_0x5b0da0,function(_0x175050){var _0x1976ab=_0x175050['get']({'plain':!![]});return _0x1976ab['Agents'];});return db[_0xbd1b('0x32')]['find']({'where':{'id':_0x3f8736[_0xbd1b('0x4d')]['id']}})[_0xbd1b('0x28')](function(_0x1009d1){return db['sequelize'][_0xbd1b('0x6c')](function(_0x2c71b6){return _0x1009d1[_0xbd1b('0x67')](_0xde4ef0,{'transaction':_0x2c71b6})[_0xbd1b('0x28')](function(){return BPromise[_0xbd1b('0x6d')](_0x4632df,function(_0x1e2ae1){return db[_0xbd1b('0x59')]['findOrCreate']({'where':{'UserId':_0x1e2ae1['id'],'MailQueueId':_0x3f8736[_0xbd1b('0x4d')]['id']},'transaction':_0x2c71b6});});})[_0xbd1b('0x28')](function(){_0x4632df[_0xbd1b('0x6e')](function(_0x4806ca){socket['emit'](_0xbd1b('0x6f'),{'UserId':_0x4806ca['id'],'MailQueueId':_0x1009d1['id']});});});});});}})['then'](respondWithStatusCode(_0x8b82aa,null))['catch'](handleError(_0x8b82aa,null));};exports['removeTeams']=function(_0x2dadab,_0x23fe99,_0x4ad782){return db[_0xbd1b('0x66')]['findAll']({'where':{'id':_0x2dadab[_0xbd1b('0x38')][_0xbd1b('0x68')]},'attributes':['id'],'include':[{'model':db[_0xbd1b('0x69')],'as':_0xbd1b('0x6a'),'attributes':['id'],'raw':!![]}]})[_0xbd1b('0x28')](handleEntityNotFound(_0x23fe99,null))[_0xbd1b('0x28')](function(_0x2ebc90){var _0x5be9be=_[_0xbd1b('0x44')](_0x2ebc90,'id');var _0x5098f9=[];var _0xe597df=[];var _0x608666=squel['select']();_0x608666[_0xbd1b('0x70')]('tq.TeamId')[_0xbd1b('0x71')](_0xbd1b('0x72'),'tq')['join'](_0xbd1b('0x73'),'ut',_0xbd1b('0x74'))['where'](_0xbd1b('0x75'),_0x2dadab[_0xbd1b('0x4d')]['id']);for(var _0x24592d=0x0;_0x24592d<_0x2ebc90[_0xbd1b('0x3d')];_0x24592d+=0x1){let _0x3960a7=_0x2ebc90[_0x24592d];for(var _0x4ef616=0x0;_0x4ef616<_0x3960a7[_0xbd1b('0x6a')][_0xbd1b('0x3d')];_0x4ef616+=0x1){let _0x36648c=_0x3960a7[_0xbd1b('0x6a')][_0x4ef616];var _0xeec8db=_0x608666[_0xbd1b('0x76')]();_0xeec8db[_0xbd1b('0x40')](_0xbd1b('0x77'),_0x36648c['id']);_0xe597df[_0xbd1b('0x78')](db['sequelize'][_0xbd1b('0x38')](_0xeec8db[_0xbd1b('0x79')](),{'type':db[_0xbd1b('0x7a')][_0xbd1b('0x7b')][_0xbd1b('0x7c')]})[_0xbd1b('0x28')](function(_0x32916e){if(_0x32916e['length']===0x1){return _0x36648c['id'];}else{var _0x57afad=_['every'](_[_0xbd1b('0x44')](_0x32916e,_0xbd1b('0x7d')),function(_0x37889f){return _[_0xbd1b('0x7e')](_0x5be9be,_0x37889f);});if(_0x57afad){return _0x36648c['id'];}}}));}}return BPromise[_0xbd1b('0x7f')](_0xe597df)[_0xbd1b('0x28')](function(_0x302ff2){_0x5098f9=_(_0x5098f9)[_0xbd1b('0x80')](_0x302ff2)[_0xbd1b('0x81')]()[_0xbd1b('0x82')]();return db[_0xbd1b('0x32')]['find']({'where':{'id':_0x2dadab[_0xbd1b('0x4d')]['id']}})['then'](function(_0x164749){return db[_0xbd1b('0x7a')][_0xbd1b('0x6c')](function(_0xec2b06){return _0x164749[_0xbd1b('0x83')](_0x2dadab[_0xbd1b('0x38')][_0xbd1b('0x68')],{'transaction':_0xec2b06})['then'](function(){if(!_[_0xbd1b('0x84')](_0x5098f9)){return _0x164749[_0xbd1b('0x85')](_0x5098f9,{'transaction':_0xec2b06});}})['then'](function(){_0x5098f9[_0xbd1b('0x6e')](function(_0x7a5091){socket[_0xbd1b('0x86')](_0xbd1b('0x87'),{'UserId':_0x7a5091,'MailQueueId':_0x164749['id']});});});});});});})[_0xbd1b('0x28')](respondWithStatusCode(_0x23fe99,null))[_0xbd1b('0x4b')](handleError(_0x23fe99,null));};exports[_0xbd1b('0x88')]=function(_0x23d556,_0x3c3b68,_0x2d1283){return db['MailQueue'][_0xbd1b('0x4e')]({'where':{'id':_0x23d556[_0xbd1b('0x4d')]['id']}})['then'](handleEntityNotFound(_0x3c3b68,null))['then'](function(_0x1cafd4){if(_0x1cafd4){return _0x1cafd4[_0xbd1b('0x88')](_0x23d556['body'][_0xbd1b('0x68')],_[_0xbd1b('0x89')](_0x23d556[_0xbd1b('0x50')],['ids','id'])||{})['spread'](function(_0x3e15eb){for(var _0x3b4c37=0x0;_0x3b4c37<_0x23d556[_0xbd1b('0x50')][_0xbd1b('0x68')][_0xbd1b('0x3d')];_0x3b4c37+=0x1){socket[_0xbd1b('0x86')](_0xbd1b('0x6f'),{'UserId':_0x23d556[_0xbd1b('0x50')][_0xbd1b('0x68')][_0x3b4c37],'MailQueueId':_0x23d556[_0xbd1b('0x4d')]['id']});}return _0x3e15eb;});}})[_0xbd1b('0x28')](respondWithResult(_0x3c3b68,null))['catch'](handleError(_0x3c3b68,null));};exports[_0xbd1b('0x85')]=function(_0x1efb02,_0xbe78eb,_0x34d16f){return db[_0xbd1b('0x32')][_0xbd1b('0x4e')]({'where':{'id':_0x1efb02[_0xbd1b('0x4d')]['id']}})[_0xbd1b('0x28')](handleEntityNotFound(_0xbe78eb,null))[_0xbd1b('0x28')](function(_0x4b7296){if(_0x4b7296){return _0x4b7296['removeAgents'](_0x1efb02[_0xbd1b('0x38')]['ids'])[_0xbd1b('0x28')](function(){if(_['isArray'](_0x1efb02[_0xbd1b('0x38')]['ids'])){for(var _0x58ab2a=0x0;_0x58ab2a<_0x1efb02[_0xbd1b('0x38')][_0xbd1b('0x68')][_0xbd1b('0x3d')];_0x58ab2a+=0x1){socket['emit'](_0xbd1b('0x87'),{'UserId':Number(_0x1efb02['query'][_0xbd1b('0x68')][_0x58ab2a]),'MailQueueId':Number(_0x1efb02['params']['id'])});}}else{socket['emit']('userMailQueue:remove',{'UserId':Number(_0x1efb02['query']['ids']),'MailQueueId':Number(_0x1efb02[_0xbd1b('0x4d')]['id'])});}});}})['then'](respondWithStatusCode(_0xbe78eb,null))[_0xbd1b('0x4b')](handleError(_0xbe78eb,null));};exports[_0xbd1b('0x8a')]=function(_0x1835ea,_0x318e02,_0x3c4cb1){var _0x5c84ba={};var _0x406ec0={};var _0x56cb14;var _0x588c8f;return db[_0xbd1b('0x32')]['findOne']({'where':{'id':_0x1835ea['params']['id']}})['then'](handleEntityNotFound(_0x318e02,null))[_0xbd1b('0x28')](function(_0x234f68){if(_0x234f68){_0x56cb14=_0x234f68;_0x406ec0['model']=_[_0xbd1b('0x39')](db['User'][_0xbd1b('0x33')]);_0x406ec0[_0xbd1b('0x38')]=_[_0xbd1b('0x39')](_0x1835ea['query']);_0x406ec0['filters']=_[_0xbd1b('0x3a')](_0x406ec0[_0xbd1b('0x37')],_0x406ec0[_0xbd1b('0x38')]);_0x5c84ba['attributes']=_['intersection'](_0x406ec0[_0xbd1b('0x37')],qs[_0xbd1b('0x3c')](_0x1835ea[_0xbd1b('0x38')][_0xbd1b('0x3c')]));_0x5c84ba[_0xbd1b('0x3b')]=_0x5c84ba[_0xbd1b('0x3b')][_0xbd1b('0x3d')]?_0x5c84ba[_0xbd1b('0x3b')]:_0x406ec0['model'];_0x5c84ba['order']=qs[_0xbd1b('0x3f')](_0x1835ea['query'][_0xbd1b('0x3f')]);_0x5c84ba[_0xbd1b('0x40')]=qs[_0xbd1b('0x41')](_[_0xbd1b('0x42')](_0x1835ea[_0xbd1b('0x38')],_0x406ec0['filters']));if(_0x1835ea['query'][_0xbd1b('0x45')]){_0x5c84ba[_0xbd1b('0x40')]=_[_0xbd1b('0x43')](_0x5c84ba[_0xbd1b('0x40')],{'$or':_[_0xbd1b('0x44')](_0x5c84ba[_0xbd1b('0x3b')],function(_0xe2a8e6){var _0x50ca8d={};_0x50ca8d[_0xe2a8e6]={'$like':'%'+_0x1835ea[_0xbd1b('0x38')][_0xbd1b('0x45')]+'%'};return _0x50ca8d;})});}_0x5c84ba=_[_0xbd1b('0x43')]({},_0x5c84ba,_0x1835ea['options']);return _0x56cb14[_0xbd1b('0x8a')](_0x5c84ba);}})['then'](function(_0x14a992){if(_0x14a992){_0x588c8f=_0x14a992['length'];if(!_0x1835ea[_0xbd1b('0x38')]['hasOwnProperty']('nolimit')){_0x5c84ba['limit']=qs['limit'](_0x1835ea[_0xbd1b('0x38')]['limit']);_0x5c84ba[_0xbd1b('0x1f')]=qs['offset'](_0x1835ea[_0xbd1b('0x38')][_0xbd1b('0x1f')]);}return _0x56cb14[_0xbd1b('0x8a')](_0x5c84ba);}})[_0xbd1b('0x28')](function(_0xe153){if(_0xe153){return _0xe153?{'count':_0x588c8f,'rows':_0xe153}:null;}})['then'](respondWithResult(_0x318e02,null))[_0xbd1b('0x4b')](handleError(_0x318e02,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index cf131e7..42f87d1 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 _0x41e9=['events','../../mysqldb','MailQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports'];(function(_0x254e65,_0x5e32e5){var _0x22bd9d=function(_0x3c34aa){while(--_0x3c34aa){_0x254e65['push'](_0x254e65['shift']());}};_0x22bd9d(++_0x5e32e5);}(_0x41e9,0x140));var _0x941e=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x41e9[_0x17d9e3];return _0x14192d;};'use strict';var EventEmitter=require(_0x941e('0x0'));var MailQueue=require(_0x941e('0x1'))['db'][_0x941e('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x941e('0x3')](0x0);var events={'afterCreate':_0x941e('0x4'),'afterUpdate':_0x941e('0x5'),'afterDestroy':_0x941e('0x6')};function emitEvent(_0x50d629){return function(_0x2c997d,_0x16da36,_0x15e008){MailQueueEvents[_0x941e('0x7')](_0x50d629+':'+_0x2c997d['id'],_0x2c997d);MailQueueEvents['emit'](_0x50d629,_0x2c997d);_0x15e008(null);};}for(var e in events){if(events[_0x941e('0x8')](e)){var event=events[e];MailQueue['hook'](e,emitEvent(event));}}module[_0x941e('0x9')]=MailQueueEvents; \ No newline at end of file +var _0x8198=['save','remove','emit','exports','events','MailQueue'];(function(_0x2d13b1,_0x2678d5){var _0x18c844=function(_0x4b0e6c){while(--_0x4b0e6c){_0x2d13b1['push'](_0x2d13b1['shift']());}};_0x18c844(++_0x2678d5);}(_0x8198,0x1ea));var _0x8819=function(_0x18a436,_0x1dbe06){_0x18a436=_0x18a436-0x0;var _0x5c2cf8=_0x8198[_0x18a436];return _0x5c2cf8;};'use strict';var EventEmitter=require(_0x8819('0x0'));var MailQueue=require('../../mysqldb')['db'][_0x8819('0x1')];var MailQueueEvents=new EventEmitter();MailQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x8819('0x2'),'afterUpdate':'update','afterDestroy':_0x8819('0x3')};function emitEvent(_0x50fe02){return function(_0x2931c9,_0x2de67a,_0x357790){MailQueueEvents[_0x8819('0x4')](_0x50fe02+':'+_0x2931c9['id'],_0x2931c9);MailQueueEvents['emit'](_0x50fe02,_0x2931c9);_0x357790(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailQueue['hook'](e,emitEvent(event));}}module[_0x8819('0x5')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index 127853f..666c9f0 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 _0xacd2=['./mailQueue.attributes','exports','define','MailQueue','mail_queues','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x261e29,_0x10fffd){var _0x25ef43=function(_0x21b8e7){while(--_0x21b8e7){_0x261e29['push'](_0x261e29['shift']());}};_0x25ef43(++_0x10fffd);}(_0xacd2,0x14a));var _0x2acd=function(_0x1de2bb,_0x23435b){_0x1de2bb=_0x1de2bb-0x0;var _0x48a090=_0xacd2[_0x1de2bb];return _0x48a090;};'use strict';var _=require('lodash');var util=require(_0x2acd('0x0'));var logger=require(_0x2acd('0x1'))(_0x2acd('0x2'));var moment=require(_0x2acd('0x3'));var BPromise=require('bluebird');var rp=require(_0x2acd('0x4'));var fs=require('fs');var path=require(_0x2acd('0x5'));var rimraf=require(_0x2acd('0x6'));var config=require(_0x2acd('0x7'));var attributes=require(_0x2acd('0x8'));module[_0x2acd('0x9')]=function(_0x19538f,_0x4c7420){return _0x19538f[_0x2acd('0xa')](_0x2acd('0xb'),attributes,{'tableName':_0x2acd('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xec5b=['util','api','moment','request-promise','path','rimraf','../../config/environment','./mailQueue.attributes','MailQueue','mail_queues','lodash'];(function(_0xcf15d7,_0x405a21){var _0x299737=function(_0x501406){while(--_0x501406){_0xcf15d7['push'](_0xcf15d7['shift']());}};_0x299737(++_0x405a21);}(_0xec5b,0x8e));var _0xbec5=function(_0x2cfb9e,_0x4b74ba){_0x2cfb9e=_0x2cfb9e-0x0;var _0x233a54=_0xec5b[_0x2cfb9e];return _0x233a54;};'use strict';var _=require(_0xbec5('0x0'));var util=require(_0xbec5('0x1'));var logger=require('../../config/logger')(_0xbec5('0x2'));var moment=require(_0xbec5('0x3'));var BPromise=require('bluebird');var rp=require(_0xbec5('0x4'));var fs=require('fs');var path=require(_0xbec5('0x5'));var rimraf=require(_0xbec5('0x6'));var config=require(_0xbec5('0x7'));var attributes=require(_0xbec5('0x8'));module['exports']=function(_0x2520ab,_0x13e901){return _0x2520ab['define'](_0xbec5('0x9'),attributes,{'tableName':_0xbec5('0xa'),'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 391217f..fd0cdbb 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 _0x2080=['debug','ShowMailQueue','find','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','then','info','MailQueue,\x20%s,\x20%s','request\x20sent','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetMailQueue','MailQueue','options','raw','where','limit','include','map','model','attributes'];(function(_0x1ccba0,_0x23280c){var _0x14ecda=function(_0xbc8e3b){while(--_0xbc8e3b){_0x1ccba0['push'](_0x1ccba0['shift']());}};_0x14ecda(++_0x23280c);}(_0x2080,0x1c6));var _0x0208=function(_0x292fbe,_0x1148ec){_0x292fbe=_0x292fbe-0x0;var _0x53ddce=_0x2080[_0x292fbe];return _0x53ddce;};'use strict';var _=require(_0x0208('0x0'));var util=require(_0x0208('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x0208('0x2'));var fs=require('fs');var Redis=require(_0x0208('0x3'));var db=require(_0x0208('0x4'))['db'];var utils=require(_0x0208('0x5'));var logger=require(_0x0208('0x6'))(_0x0208('0x7'));var config=require(_0x0208('0x8'));var jayson=require(_0x0208('0x9'));var client=jayson[_0x0208('0xa')][_0x0208('0xb')]({'port':0x232a});config[_0x0208('0xc')]=_[_0x0208('0xd')](config['redis'],{'host':_0x0208('0xe'),'port':0x18eb});var socket=require(_0x0208('0xf'))(new Redis(config[_0x0208('0xc')]));require('./mailQueue.socket')[_0x0208('0x10')](socket);function respondWithRpcPromise(_0x449780,_0x5143ac,_0x2b914b){return new BPromise(function(_0xdad1fc,_0x539752){return client['request'](_0x449780,_0x2b914b)[_0x0208('0x11')](function(_0x5447eb){logger[_0x0208('0x12')](_0x0208('0x13'),_0x5143ac,_0x0208('0x14'));logger['debug'](_0x0208('0x15'),_0x5143ac,'request\x20sent',JSON[_0x0208('0x16')](_0x5447eb));if(_0x5447eb[_0x0208('0x17')]){if(_0x5447eb['error'][_0x0208('0x18')]===0x1f4){logger[_0x0208('0x17')](_0x0208('0x13'),_0x5143ac,_0x5447eb[_0x0208('0x17')][_0x0208('0x19')]);return _0x539752(_0x5447eb[_0x0208('0x17')][_0x0208('0x19')]);}logger[_0x0208('0x17')](_0x0208('0x13'),_0x5143ac,_0x5447eb[_0x0208('0x17')]['message']);return _0xdad1fc(_0x5447eb['error']['message']);}else{logger['info'](_0x0208('0x13'),_0x5143ac,_0x0208('0x14'));_0xdad1fc(_0x5447eb[_0x0208('0x1a')][_0x0208('0x19')]);}})[_0x0208('0x1b')](function(_0x4f37e6){logger[_0x0208('0x17')](_0x0208('0x13'),_0x5143ac,_0x4f37e6);_0x539752(_0x4f37e6);});});}exports[_0x0208('0x1c')]=function(_0x334136){var _0x4bd983=this;return new Promise(function(_0x4bf0b1,_0x4d1458){return db[_0x0208('0x1d')]['findAll']({'raw':_0x334136[_0x0208('0x1e')]?_0x334136[_0x0208('0x1e')][_0x0208('0x1f')]===undefined?!![]:![]:!![],'where':_0x334136[_0x0208('0x1e')]?_0x334136['options'][_0x0208('0x20')]||null:null,'attributes':_0x334136[_0x0208('0x1e')]?_0x334136[_0x0208('0x1e')]['attributes']||null:null,'limit':_0x334136['options']?_0x334136[_0x0208('0x1e')][_0x0208('0x21')]||null:null,'include':_0x334136[_0x0208('0x1e')]?_0x334136[_0x0208('0x1e')][_0x0208('0x22')]?_[_0x0208('0x23')](_0x334136[_0x0208('0x1e')][_0x0208('0x22')],function(_0x4e2ed5){return{'model':db[_0x4e2ed5[_0x0208('0x24')]],'as':_0x4e2ed5['as'],'attributes':_0x4e2ed5['attributes'],'include':_0x4e2ed5['include']?_[_0x0208('0x23')](_0x4e2ed5[_0x0208('0x22')],function(_0x42f1eb){return{'model':db[_0x42f1eb[_0x0208('0x24')]],'as':_0x42f1eb['as'],'attributes':_0x42f1eb[_0x0208('0x25')],'include':_0x42f1eb['include']?_['map'](_0x42f1eb[_0x0208('0x22')],function(_0x50835f){return{'model':db[_0x50835f[_0x0208('0x24')]],'as':_0x50835f['as'],'attributes':_0x50835f[_0x0208('0x25')]};}):[]};}):[]};}):[]:[]})[_0x0208('0x11')](function(_0xc85954){logger[_0x0208('0x12')](_0x0208('0x1c'),_0x334136);logger[_0x0208('0x26')](_0x0208('0x1c'),_0x334136,JSON[_0x0208('0x16')](_0xc85954));_0x4bf0b1(_0xc85954);})['catch'](function(_0x12ae5f){logger[_0x0208('0x17')]('GetMailQueue',_0x12ae5f[_0x0208('0x19')],_0x334136);_0x4d1458(_0x4bd983['error'](0x1f4,_0x12ae5f[_0x0208('0x19')]));});});};exports[_0x0208('0x27')]=function(_0x55a33b){var _0x292631=this;return new Promise(function(_0x518661,_0x476796){return db['MailQueue'][_0x0208('0x28')]({'raw':_0x55a33b[_0x0208('0x1e')]?_0x55a33b[_0x0208('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x55a33b['options']?_0x55a33b[_0x0208('0x1e')][_0x0208('0x20')]||null:null,'attributes':_0x55a33b[_0x0208('0x1e')]?_0x55a33b['options'][_0x0208('0x25')]||null:null,'include':_0x55a33b['options']?_0x55a33b['options'][_0x0208('0x22')]?_[_0x0208('0x23')](_0x55a33b[_0x0208('0x1e')]['include'],function(_0x45c7a9){return{'model':db[_0x45c7a9[_0x0208('0x24')]],'as':_0x45c7a9['as'],'attributes':_0x45c7a9['attributes'],'include':_0x45c7a9['include']?_[_0x0208('0x23')](_0x45c7a9[_0x0208('0x22')],function(_0x4923e3){return{'model':db[_0x4923e3[_0x0208('0x24')]],'as':_0x4923e3['as'],'attributes':_0x4923e3[_0x0208('0x25')],'include':_0x4923e3[_0x0208('0x22')]?_[_0x0208('0x23')](_0x4923e3[_0x0208('0x22')],function(_0x17c5fa){return{'model':db[_0x17c5fa[_0x0208('0x24')]],'as':_0x17c5fa['as'],'attributes':_0x17c5fa['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x1ecef9){logger[_0x0208('0x12')](_0x0208('0x27'),_0x55a33b);logger['debug'](_0x0208('0x27'),_0x55a33b,JSON[_0x0208('0x16')](_0x1ecef9));_0x518661(_0x1ecef9);})[_0x0208('0x1b')](function(_0x1290b4){logger['error'](_0x0208('0x27'),_0x1290b4[_0x0208('0x19')],_0x55a33b);_0x476796(_0x292631[_0x0208('0x17')](0x1f4,_0x1290b4[_0x0208('0x19')]));});});}; \ No newline at end of file +var _0xff57=['request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','GetMailQueue','MailQueue','options','raw','where','attributes','limit','map','include','model','then','ShowMailQueue','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','request','MailQueue,\x20%s,\x20%s'];(function(_0x139f86,_0x48fa6d){var _0x4a5b23=function(_0x2fd40c){while(--_0x2fd40c){_0x139f86['push'](_0x139f86['shift']());}};_0x4a5b23(++_0x48fa6d);}(_0xff57,0x105));var _0x7ff5=function(_0x4c4a43,_0x1a0c4b){_0x4c4a43=_0x4c4a43-0x0;var _0x39e886=_0xff57[_0x4c4a43];return _0x39e886;};'use strict';var _=require('lodash');var util=require(_0x7ff5('0x0'));var moment=require('moment');var BPromise=require(_0x7ff5('0x1'));var rs=require(_0x7ff5('0x2'));var fs=require('fs');var Redis=require(_0x7ff5('0x3'));var db=require(_0x7ff5('0x4'))['db'];var utils=require(_0x7ff5('0x5'));var logger=require(_0x7ff5('0x6'))('rpc');var config=require(_0x7ff5('0x7'));var jayson=require(_0x7ff5('0x8'));var client=jayson[_0x7ff5('0x9')][_0x7ff5('0xa')]({'port':0x232a});config[_0x7ff5('0xb')]=_[_0x7ff5('0xc')](config[_0x7ff5('0xb')],{'host':_0x7ff5('0xd'),'port':0x18eb});var socket=require(_0x7ff5('0xe'))(new Redis(config['redis']));require(_0x7ff5('0xf'))[_0x7ff5('0x10')](socket);function respondWithRpcPromise(_0x99b849,_0x5b7393,_0x1cae2a){return new BPromise(function(_0x479a60,_0x1c051c){return client[_0x7ff5('0x11')](_0x99b849,_0x1cae2a)['then'](function(_0x3a148a){logger['info'](_0x7ff5('0x12'),_0x5b7393,_0x7ff5('0x13'));logger[_0x7ff5('0x14')](_0x7ff5('0x15'),_0x5b7393,'request\x20sent',JSON[_0x7ff5('0x16')](_0x3a148a));if(_0x3a148a[_0x7ff5('0x17')]){if(_0x3a148a[_0x7ff5('0x17')]['code']===0x1f4){logger[_0x7ff5('0x17')](_0x7ff5('0x12'),_0x5b7393,_0x3a148a[_0x7ff5('0x17')][_0x7ff5('0x18')]);return _0x1c051c(_0x3a148a[_0x7ff5('0x17')][_0x7ff5('0x18')]);}logger[_0x7ff5('0x17')](_0x7ff5('0x12'),_0x5b7393,_0x3a148a[_0x7ff5('0x17')]['message']);return _0x479a60(_0x3a148a[_0x7ff5('0x17')][_0x7ff5('0x18')]);}else{logger[_0x7ff5('0x19')](_0x7ff5('0x12'),_0x5b7393,_0x7ff5('0x13'));_0x479a60(_0x3a148a[_0x7ff5('0x1a')][_0x7ff5('0x18')]);}})[_0x7ff5('0x1b')](function(_0x58902e){logger[_0x7ff5('0x17')](_0x7ff5('0x12'),_0x5b7393,_0x58902e);_0x1c051c(_0x58902e);});});}exports[_0x7ff5('0x1c')]=function(_0x20665c){var _0x3bdfbd=this;return new Promise(function(_0x326b48,_0x54f5f4){return db[_0x7ff5('0x1d')]['findAll']({'raw':_0x20665c['options']?_0x20665c[_0x7ff5('0x1e')][_0x7ff5('0x1f')]===undefined?!![]:![]:!![],'where':_0x20665c[_0x7ff5('0x1e')]?_0x20665c[_0x7ff5('0x1e')][_0x7ff5('0x20')]||null:null,'attributes':_0x20665c[_0x7ff5('0x1e')]?_0x20665c['options'][_0x7ff5('0x21')]||null:null,'limit':_0x20665c[_0x7ff5('0x1e')]?_0x20665c[_0x7ff5('0x1e')][_0x7ff5('0x22')]||null:null,'include':_0x20665c[_0x7ff5('0x1e')]?_0x20665c[_0x7ff5('0x1e')]['include']?_[_0x7ff5('0x23')](_0x20665c[_0x7ff5('0x1e')][_0x7ff5('0x24')],function(_0x17a351){return{'model':db[_0x17a351[_0x7ff5('0x25')]],'as':_0x17a351['as'],'attributes':_0x17a351[_0x7ff5('0x21')],'include':_0x17a351['include']?_[_0x7ff5('0x23')](_0x17a351['include'],function(_0x33b1b3){return{'model':db[_0x33b1b3[_0x7ff5('0x25')]],'as':_0x33b1b3['as'],'attributes':_0x33b1b3[_0x7ff5('0x21')],'include':_0x33b1b3['include']?_[_0x7ff5('0x23')](_0x33b1b3[_0x7ff5('0x24')],function(_0x57681f){return{'model':db[_0x57681f[_0x7ff5('0x25')]],'as':_0x57681f['as'],'attributes':_0x57681f[_0x7ff5('0x21')]};}):[]};}):[]};}):[]:[]})[_0x7ff5('0x26')](function(_0x3f48ac){logger[_0x7ff5('0x19')](_0x7ff5('0x1c'),_0x20665c);logger[_0x7ff5('0x14')]('GetMailQueue',_0x20665c,JSON[_0x7ff5('0x16')](_0x3f48ac));_0x326b48(_0x3f48ac);})[_0x7ff5('0x1b')](function(_0x6b98d2){logger[_0x7ff5('0x17')](_0x7ff5('0x1c'),_0x6b98d2[_0x7ff5('0x18')],_0x20665c);_0x54f5f4(_0x3bdfbd[_0x7ff5('0x17')](0x1f4,_0x6b98d2[_0x7ff5('0x18')]));});});};exports[_0x7ff5('0x27')]=function(_0x1f161f){var _0x4034da=this;return new Promise(function(_0x451e25,_0xd9d2e6){return db[_0x7ff5('0x1d')]['find']({'raw':_0x1f161f[_0x7ff5('0x1e')]?_0x1f161f['options'][_0x7ff5('0x1f')]===undefined?!![]:![]:!![],'where':_0x1f161f[_0x7ff5('0x1e')]?_0x1f161f[_0x7ff5('0x1e')]['where']||null:null,'attributes':_0x1f161f['options']?_0x1f161f[_0x7ff5('0x1e')][_0x7ff5('0x21')]||null:null,'include':_0x1f161f[_0x7ff5('0x1e')]?_0x1f161f[_0x7ff5('0x1e')]['include']?_[_0x7ff5('0x23')](_0x1f161f[_0x7ff5('0x1e')][_0x7ff5('0x24')],function(_0xec77af){return{'model':db[_0xec77af[_0x7ff5('0x25')]],'as':_0xec77af['as'],'attributes':_0xec77af[_0x7ff5('0x21')],'include':_0xec77af['include']?_[_0x7ff5('0x23')](_0xec77af['include'],function(_0x405e1b){return{'model':db[_0x405e1b[_0x7ff5('0x25')]],'as':_0x405e1b['as'],'attributes':_0x405e1b[_0x7ff5('0x21')],'include':_0x405e1b[_0x7ff5('0x24')]?_['map'](_0x405e1b[_0x7ff5('0x24')],function(_0x16f470){return{'model':db[_0x16f470[_0x7ff5('0x25')]],'as':_0x16f470['as'],'attributes':_0x16f470[_0x7ff5('0x21')]};}):[]};}):[]};}):[]:[]})[_0x7ff5('0x26')](function(_0x459ac1){logger[_0x7ff5('0x19')](_0x7ff5('0x27'),_0x1f161f);logger['debug'](_0x7ff5('0x27'),_0x1f161f,JSON['stringify'](_0x459ac1));_0x451e25(_0x459ac1);})['catch'](function(_0x454d41){logger['error'](_0x7ff5('0x27'),_0x454d41[_0x7ff5('0x18')],_0x1f161f);_0xd9d2e6(_0x4034da[_0x7ff5('0x17')](0x1f4,_0x454d41[_0x7ff5('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 12a5720..1bcd461 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 _0x9861=['update','emit','removeListener','register','mailQueue:','./mailQueue.events','remove'];(function(_0x4a5f5d,_0x577702){var _0x3344b4=function(_0x4ee75c){while(--_0x4ee75c){_0x4a5f5d['push'](_0x4a5f5d['shift']());}};_0x3344b4(++_0x577702);}(_0x9861,0x91));var _0x1986=function(_0x4ccb19,_0x16e232){_0x4ccb19=_0x4ccb19-0x0;var _0x28b9b6=_0x9861[_0x4ccb19];return _0x28b9b6;};'use strict';var MailQueueEvents=require(_0x1986('0x0'));var events=['save',_0x1986('0x1'),_0x1986('0x2')];function createListener(_0x5678bb,_0x40a324){return function(_0x22c762){_0x40a324[_0x1986('0x3')](_0x5678bb,_0x22c762);};}function removeListener(_0xcfefd2,_0x2d850d){return function(){MailQueueEvents[_0x1986('0x4')](_0xcfefd2,_0x2d850d);};}exports[_0x1986('0x5')]=function(_0x45c9dd){for(var _0x3163f8=0x0,_0x1396b4=events['length'];_0x3163f8<_0x1396b4;_0x3163f8++){var _0x531847=events[_0x3163f8];var _0x39b75d=createListener(_0x1986('0x6')+_0x531847,_0x45c9dd);MailQueueEvents['on'](_0x531847,_0x39b75d);}}; \ No newline at end of file +var _0xf17b=['mailQueue:','./mailQueue.events','remove','emit','removeListener','register'];(function(_0x3fd07d,_0x53cf53){var _0x3e90ca=function(_0x4961d5){while(--_0x4961d5){_0x3fd07d['push'](_0x3fd07d['shift']());}};_0x3e90ca(++_0x53cf53);}(_0xf17b,0x11b));var _0xbf17=function(_0x40f145,_0x25c1b2){_0x40f145=_0x40f145-0x0;var _0x531722=_0xf17b[_0x40f145];return _0x531722;};'use strict';var MailQueueEvents=require(_0xbf17('0x0'));var events=['save',_0xbf17('0x1'),'update'];function createListener(_0x43bf08,_0x263bfd){return function(_0x261c34){_0x263bfd[_0xbf17('0x2')](_0x43bf08,_0x261c34);};}function removeListener(_0x463b1b,_0x41b60b){return function(){MailQueueEvents[_0xbf17('0x3')](_0x463b1b,_0x41b60b);};}exports[_0xbf17('0x4')]=function(_0x7d4804){for(var _0x2a7c48=0x0,_0x5ccf08=events['length'];_0x2a7c48<_0x5ccf08;_0x2a7c48++){var _0x5f43f0=events[_0x2a7c48];var _0x1bf287=createListener(_0xbf17('0x5')+_0x5f43f0,_0x7d4804);MailQueueEvents['on'](_0x5f43f0,_0x1bf287);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index d7a9a9e..6de3cdf 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 _0x598b=['update','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','./mailQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x598b,0x17d));var _0xb598=function(_0xc7b78b,_0x1f852e){_0xc7b78b=_0xc7b78b-0x0;var _0x4b5e17=_0x598b[_0xc7b78b];return _0x4b5e17;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xb598('0x0'));var timeout=require(_0xb598('0x1'));var express=require(_0xb598('0x2'));var router=express[_0xb598('0x3')]();var auth=require(_0xb598('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xb598('0x5'));router[_0xb598('0x6')]('/',auth[_0xb598('0x7')](),controller[_0xb598('0x8')]);router[_0xb598('0x6')](_0xb598('0x9'),auth[_0xb598('0x7')](),controller[_0xb598('0xa')]);router[_0xb598('0x6')](_0xb598('0xb'),auth[_0xb598('0x7')](),controller[_0xb598('0xc')]);router[_0xb598('0xd')]('/',auth[_0xb598('0x7')](),controller[_0xb598('0xe')]);router['put'](_0xb598('0xb'),auth['isAuthenticated'](),controller[_0xb598('0xf')]);router['delete'](_0xb598('0xb'),auth[_0xb598('0x7')](),controller[_0xb598('0x10')]);module[_0xb598('0x11')]=router; \ No newline at end of file +var _0x71a9=['create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post'];(function(_0x3f84d8,_0x3c4b41){var _0x20b85d=function(_0x555cb4){while(--_0x555cb4){_0x3f84d8['push'](_0x3f84d8['shift']());}};_0x20b85d(++_0x3c4b41);}(_0x71a9,0x1a8));var _0x971a=function(_0x1e4f14,_0xf96283){_0x1e4f14=_0x1e4f14-0x0;var _0x34d4ea=_0x71a9[_0x1e4f14];return _0x34d4ea;};'use strict';var multer=require(_0x971a('0x0'));var util=require(_0x971a('0x1'));var path=require(_0x971a('0x2'));var timeout=require(_0x971a('0x3'));var express=require(_0x971a('0x4'));var router=express[_0x971a('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x971a('0x6'));var config=require(_0x971a('0x7'));var controller=require('./mailQueueReport.controller');router[_0x971a('0x8')]('/',auth[_0x971a('0x9')](),controller[_0x971a('0xa')]);router[_0x971a('0x8')](_0x971a('0xb'),auth['isAuthenticated'](),controller[_0x971a('0xc')]);router[_0x971a('0x8')](_0x971a('0xd'),auth[_0x971a('0x9')](),controller[_0x971a('0xe')]);router[_0x971a('0xf')]('/',auth[_0x971a('0x9')](),controller[_0x971a('0x10')]);router[_0x971a('0x11')]('/:id',auth[_0x971a('0x9')](),controller[_0x971a('0x12')]);router[_0x971a('0x13')](_0x971a('0xd'),auth[_0x971a('0x9')](),controller[_0x971a('0x14')]);module[_0x971a('0x15')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index 2a61c43..c4cd2a8 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 _0xeb51=['moment','sequelize','exports','STRING','DATE'];(function(_0x1c546c,_0x5c57cb){var _0x2cc384=function(_0x4dee11){while(--_0x4dee11){_0x1c546c['push'](_0x1c546c['shift']());}};_0x2cc384(++_0x5c57cb);}(_0xeb51,0x181));var _0x1eb5=function(_0x3d6650,_0x4ede52){_0x3d6650=_0x3d6650-0x0;var _0x20406e=_0xeb51[_0x3d6650];return _0x20406e;};'use strict';var moment=require(_0x1eb5('0x0'));var Sequelize=require(_0x1eb5('0x1'));module[_0x1eb5('0x2')]={'uniqueid':{'type':Sequelize[_0x1eb5('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x1eb5('0x3')]},'joinAt':{'type':Sequelize[_0x1eb5('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x1eb5('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x6d05=['DATE','moment','sequelize','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6d05,0x1d1));var _0x56d0=function(_0x4c0c4b,_0x2d9210){_0x4c0c4b=_0x4c0c4b-0x0;var _0x5f05b7=_0x6d05[_0x4c0c4b];return _0x5f05b7;};'use strict';var moment=require(_0x56d0('0x0'));var Sequelize=require(_0x56d0('0x1'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x56d0('0x2')]},'joinAt':{'type':Sequelize[_0x56d0('0x3')]},'leaveAt':{'type':Sequelize[_0x56d0('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x56d0('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index 07ec29e..8bb3732 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 _0x3fdf=['filter','options','includeAll','rows','catch','params','keys','find','create','body','destroy','describe','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','set','Content-Range','reject','update','then','stack','name','map','MailQueueReport','fieldName','key','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','merge','VIRTUAL'];(function(_0x117ea2,_0x40c74c){var _0x3884c1=function(_0x4ee834){while(--_0x4ee834){_0x117ea2['push'](_0x117ea2['shift']());}};_0x3884c1(++_0x40c74c);}(_0x3fdf,0x124));var _0xf3fd=function(_0x168283,_0x42976a){_0x168283=_0x168283-0x0;var _0x22c638=_0x3fdf[_0x168283];return _0x22c638;};'use strict';var pdf=require(_0xf3fd('0x0'));var emlformat=require(_0xf3fd('0x1'));var rimraf=require(_0xf3fd('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xf3fd('0x3'));var moment=require(_0xf3fd('0x4'));var BPromise=require(_0xf3fd('0x5'));var Mustache=require('mustache');var util=require(_0xf3fd('0x6'));var path=require(_0xf3fd('0x7'));var sox=require(_0xf3fd('0x8'));var csv=require('to-csv');var ejs=require(_0xf3fd('0x9'));var fs=require('fs');var _=require(_0xf3fd('0xa'));var squel=require(_0xf3fd('0xb'));var crypto=require(_0xf3fd('0xc'));var jsforce=require(_0xf3fd('0xd'));var deskjs=require(_0xf3fd('0xe'));var toCsv=require('to-csv');var querystring=require(_0xf3fd('0xf'));var Papa=require('papaparse');var Redis=require(_0xf3fd('0x10'));var authService=require(_0xf3fd('0x11'));var qs=require(_0xf3fd('0x12'));var as=require(_0xf3fd('0x13'));var hardwareService=require(_0xf3fd('0x14'));var logger=require(_0xf3fd('0x15'))(_0xf3fd('0x16'));var utils=require(_0xf3fd('0x17'));var config=require(_0xf3fd('0x18'));var db=require(_0xf3fd('0x19'))['db'];function respondWithStatusCode(_0x5d377d,_0x234eb3){_0x234eb3=_0x234eb3||0xcc;return function(_0x2a2503){if(_0x2a2503){return _0x5d377d['sendStatus'](_0x234eb3);}return _0x5d377d[_0xf3fd('0x1a')](_0x234eb3)[_0xf3fd('0x1b')]();};}function respondWithResult(_0x449bf3,_0x523ecc){_0x523ecc=_0x523ecc||0xc8;return function(_0x2acdd7){if(_0x2acdd7){return _0x449bf3[_0xf3fd('0x1a')](_0x523ecc)[_0xf3fd('0x1c')](_0x2acdd7);}};}function respondWithFilteredResult(_0x13b46b,_0x333299){return function(_0x8ed0c){if(_0x8ed0c){var _0x5b44ef=_0x8ed0c[_0xf3fd('0x1d')],_0x45df14=_0x333299['offset'],_0x25ee4a=_0x333299[_0xf3fd('0x1e')]+_0x333299['limit'],_0x4b498d;if(_0x25ee4a>=_0x5b44ef){_0x25ee4a=_0x5b44ef;_0x4b498d=0xc8;}else{_0x4b498d=0xce;}_0x13b46b[_0xf3fd('0x1a')](_0x4b498d);return _0x13b46b[_0xf3fd('0x1f')](_0xf3fd('0x20'),_0x45df14+'-'+_0x25ee4a+'/'+_0x5b44ef)[_0xf3fd('0x1c')](_0x8ed0c);}return null;};}function patchUpdates(_0x55dbe9){return function(_0x2f8d46){try{jsonpatch['apply'](_0x2f8d46,_0x55dbe9,!![]);}catch(_0x5a1208){return BPromise[_0xf3fd('0x21')](_0x5a1208);}return _0x2f8d46['save']();};}function saveUpdates(_0x58d43f,_0x45af21){return function(_0x5489b0){if(_0x5489b0){return _0x5489b0[_0xf3fd('0x22')](_0x58d43f)['then'](function(_0x1d88be){return _0x1d88be;});}return null;};}function removeEntity(_0x5acbc9,_0x4c1664){return function(_0x450995){if(_0x450995){return _0x450995['destroy']()[_0xf3fd('0x23')](function(){_0x5acbc9[_0xf3fd('0x1a')](0xcc)[_0xf3fd('0x1b')]();});}};}function handleEntityNotFound(_0x305bfb,_0x910e18){return function(_0x437fac){if(!_0x437fac){_0x305bfb['sendStatus'](0x194);}return _0x437fac;};}function handleError(_0x1eef57,_0x4dbcf0){_0x4dbcf0=_0x4dbcf0||0x1f4;return function(_0x20eb13){logger['error'](_0x20eb13[_0xf3fd('0x24')]);if(_0x20eb13[_0xf3fd('0x25')]){delete _0x20eb13['name'];}_0x1eef57[_0xf3fd('0x1a')](_0x4dbcf0)['send'](_0x20eb13);};}exports['index']=function(_0x137b62,_0x4c0547){var _0x8dc693={},_0xbffd93={},_0xa3d128={'count':0x0,'rows':[]};var _0x23950d=_[_0xf3fd('0x26')](db[_0xf3fd('0x27')]['rawAttributes'],function(_0xad2303){return{'name':_0xad2303[_0xf3fd('0x28')],'type':_0xad2303['type'][_0xf3fd('0x29')]};});_0xbffd93[_0xf3fd('0x2a')]=_[_0xf3fd('0x26')](_0x23950d,_0xf3fd('0x25'));_0xbffd93['query']=_['keys'](_0x137b62[_0xf3fd('0x2b')]);_0xbffd93['filters']=_[_0xf3fd('0x2c')](_0xbffd93[_0xf3fd('0x2a')],_0xbffd93[_0xf3fd('0x2b')]);_0x8dc693['attributes']=_[_0xf3fd('0x2c')](_0xbffd93['model'],qs[_0xf3fd('0x2d')](_0x137b62[_0xf3fd('0x2b')][_0xf3fd('0x2d')]));_0x8dc693[_0xf3fd('0x2e')]=_0x8dc693['attributes'][_0xf3fd('0x2f')]?_0x8dc693[_0xf3fd('0x2e')]:_0xbffd93[_0xf3fd('0x2a')];if(!_0x137b62[_0xf3fd('0x2b')][_0xf3fd('0x30')](_0xf3fd('0x31'))){_0x8dc693[_0xf3fd('0x32')]=qs[_0xf3fd('0x32')](_0x137b62[_0xf3fd('0x2b')]['limit']);_0x8dc693[_0xf3fd('0x1e')]=qs[_0xf3fd('0x1e')](_0x137b62[_0xf3fd('0x2b')]['offset']);}_0x8dc693[_0xf3fd('0x33')]=qs[_0xf3fd('0x34')](_0x137b62[_0xf3fd('0x2b')][_0xf3fd('0x34')]);_0x8dc693[_0xf3fd('0x35')]=qs[_0xf3fd('0x36')](_[_0xf3fd('0x37')](_0x137b62['query'],_0xbffd93['filters']));if(_0x137b62[_0xf3fd('0x2b')]['filter']){_0x8dc693[_0xf3fd('0x35')]=_[_0xf3fd('0x38')](_0x8dc693[_0xf3fd('0x35')],{'$or':_[_0xf3fd('0x26')](_0x23950d,function(_0x329996){if(_0x329996['type']!==_0xf3fd('0x39')){var _0x597f40={};_0x597f40[_0x329996[_0xf3fd('0x25')]]={'$like':'%'+_0x137b62[_0xf3fd('0x2b')][_0xf3fd('0x3a')]+'%'};return _0x597f40;}})});}_0x8dc693=_[_0xf3fd('0x38')]({},_0x8dc693,_0x137b62[_0xf3fd('0x3b')]);var _0x28d22a={'where':_0x8dc693[_0xf3fd('0x35')]};return db[_0xf3fd('0x27')][_0xf3fd('0x1d')](_0x28d22a)[_0xf3fd('0x23')](function(_0xbb6ff1){_0xa3d128[_0xf3fd('0x1d')]=_0xbb6ff1;if(_0x137b62[_0xf3fd('0x2b')][_0xf3fd('0x3c')]){_0x8dc693['include']=[{'all':!![]}];}return db[_0xf3fd('0x27')]['findAll'](_0x8dc693);})[_0xf3fd('0x23')](function(_0x339e1d){_0xa3d128[_0xf3fd('0x3d')]=_0x339e1d;return _0xa3d128;})['then'](respondWithFilteredResult(_0x4c0547,_0x8dc693))[_0xf3fd('0x3e')](handleError(_0x4c0547,null));};exports['show']=function(_0x1310e7,_0x10be9a){var _0x2ff389={'raw':!![],'where':{'id':_0x1310e7[_0xf3fd('0x3f')]['id']}},_0x1bdbc9={};_0x1bdbc9[_0xf3fd('0x2a')]=_[_0xf3fd('0x40')](db['MailQueueReport']['rawAttributes']);_0x1bdbc9[_0xf3fd('0x2b')]=_[_0xf3fd('0x40')](_0x1310e7[_0xf3fd('0x2b')]);_0x1bdbc9[_0xf3fd('0x36')]=_['intersection'](_0x1bdbc9[_0xf3fd('0x2a')],_0x1bdbc9[_0xf3fd('0x2b')]);_0x2ff389[_0xf3fd('0x2e')]=_[_0xf3fd('0x2c')](_0x1bdbc9['model'],qs[_0xf3fd('0x2d')](_0x1310e7[_0xf3fd('0x2b')][_0xf3fd('0x2d')]));_0x2ff389[_0xf3fd('0x2e')]=_0x2ff389[_0xf3fd('0x2e')][_0xf3fd('0x2f')]?_0x2ff389[_0xf3fd('0x2e')]:_0x1bdbc9[_0xf3fd('0x2a')];if(_0x1310e7[_0xf3fd('0x2b')][_0xf3fd('0x3c')]){_0x2ff389['include']=[{'all':!![]}];}_0x2ff389=_[_0xf3fd('0x38')]({},_0x2ff389,_0x1310e7['options']);return db['MailQueueReport'][_0xf3fd('0x41')](_0x2ff389)[_0xf3fd('0x23')](handleEntityNotFound(_0x10be9a,null))[_0xf3fd('0x23')](respondWithResult(_0x10be9a,null))[_0xf3fd('0x3e')](handleError(_0x10be9a,null));};exports['create']=function(_0x44f4be,_0x277806){return db[_0xf3fd('0x27')][_0xf3fd('0x42')](_0x44f4be['body'],{})[_0xf3fd('0x23')](respondWithResult(_0x277806,0xc9))[_0xf3fd('0x3e')](handleError(_0x277806,null));};exports[_0xf3fd('0x22')]=function(_0x53f040,_0x97e07a){if(_0x53f040[_0xf3fd('0x43')]['id']){delete _0x53f040[_0xf3fd('0x43')]['id'];}return db['MailQueueReport']['find']({'where':{'id':_0x53f040[_0xf3fd('0x3f')]['id']}})[_0xf3fd('0x23')](handleEntityNotFound(_0x97e07a,null))[_0xf3fd('0x23')](saveUpdates(_0x53f040[_0xf3fd('0x43')],null))[_0xf3fd('0x23')](respondWithResult(_0x97e07a,null))[_0xf3fd('0x3e')](handleError(_0x97e07a,null));};exports[_0xf3fd('0x44')]=function(_0x5a7ce9,_0x2f4935){return db[_0xf3fd('0x27')]['find']({'where':{'id':_0x5a7ce9[_0xf3fd('0x3f')]['id']}})['then'](handleEntityNotFound(_0x2f4935,null))['then'](removeEntity(_0x2f4935,null))[_0xf3fd('0x3e')](handleError(_0x2f4935,null));};exports[_0xf3fd('0x45')]=function(_0x25af8e,_0x18df9c){return db[_0xf3fd('0x27')]['describe']()['then'](respondWithResult(_0x18df9c,null))[_0xf3fd('0x3e')](handleError(_0x18df9c,null));}; \ No newline at end of file +var _0xc897=['find','create','body','update','describe','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','end','count','offset','set','apply','reject','save','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','model','intersection','fields','attributes','length','hasOwnProperty','order','sort','pick','filter','where','merge','options','MailQueueReport','then','includeAll','findAll','catch','show','params','include'];(function(_0x89943a,_0xcd9e4f){var _0x4cad76=function(_0x198b56){while(--_0x198b56){_0x89943a['push'](_0x89943a['shift']());}};_0x4cad76(++_0xcd9e4f);}(_0xc897,0x168));var _0x7c89=function(_0x547456,_0x1de17e){_0x547456=_0x547456-0x0;var _0xc1fd7b=_0xc897[_0x547456];return _0xc1fd7b;};'use strict';var pdf=require(_0x7c89('0x0'));var emlformat=require(_0x7c89('0x1'));var rimraf=require(_0x7c89('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7c89('0x3'));var rp=require('request-promise');var moment=require(_0x7c89('0x4'));var BPromise=require(_0x7c89('0x5'));var Mustache=require(_0x7c89('0x6'));var util=require(_0x7c89('0x7'));var path=require('path');var sox=require(_0x7c89('0x8'));var csv=require(_0x7c89('0x9'));var ejs=require(_0x7c89('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x7c89('0xb'));var crypto=require('crypto');var jsforce=require(_0x7c89('0xc'));var deskjs=require(_0x7c89('0xd'));var toCsv=require(_0x7c89('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x7c89('0xe'));var authService=require(_0x7c89('0xf'));var qs=require(_0x7c89('0x10'));var as=require(_0x7c89('0x11'));var hardwareService=require(_0x7c89('0x12'));var logger=require(_0x7c89('0x13'))(_0x7c89('0x14'));var utils=require('../../config/utils');var config=require(_0x7c89('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x44b332,_0x2bd1b0){_0x2bd1b0=_0x2bd1b0||0xcc;return function(_0x2ae52a){if(_0x2ae52a){return _0x44b332[_0x7c89('0x16')](_0x2bd1b0);}return _0x44b332[_0x7c89('0x17')](_0x2bd1b0)[_0x7c89('0x18')]();};}function respondWithResult(_0xce1c51,_0x28edd8){_0x28edd8=_0x28edd8||0xc8;return function(_0x5bfbd8){if(_0x5bfbd8){return _0xce1c51[_0x7c89('0x17')](_0x28edd8)['json'](_0x5bfbd8);}};}function respondWithFilteredResult(_0x30eaf5,_0x206844){return function(_0x45538f){if(_0x45538f){var _0x4bfd16=_0x45538f[_0x7c89('0x19')],_0x5c04c1=_0x206844[_0x7c89('0x1a')],_0x3ccbc0=_0x206844[_0x7c89('0x1a')]+_0x206844['limit'],_0x4b72f0;if(_0x3ccbc0>=_0x4bfd16){_0x3ccbc0=_0x4bfd16;_0x4b72f0=0xc8;}else{_0x4b72f0=0xce;}_0x30eaf5[_0x7c89('0x17')](_0x4b72f0);return _0x30eaf5[_0x7c89('0x1b')]('Content-Range',_0x5c04c1+'-'+_0x3ccbc0+'/'+_0x4bfd16)['json'](_0x45538f);}return null;};}function patchUpdates(_0x2ed1e6){return function(_0x396f72){try{jsonpatch[_0x7c89('0x1c')](_0x396f72,_0x2ed1e6,!![]);}catch(_0x2c411c){return BPromise[_0x7c89('0x1d')](_0x2c411c);}return _0x396f72[_0x7c89('0x1e')]();};}function saveUpdates(_0x5a9334,_0x415a4f){return function(_0x68c4cd){if(_0x68c4cd){return _0x68c4cd['update'](_0x5a9334)['then'](function(_0x15a42f){return _0x15a42f;});}return null;};}function removeEntity(_0xb447ac,_0x54fddd){return function(_0x3c1978){if(_0x3c1978){return _0x3c1978[_0x7c89('0x1f')]()['then'](function(){_0xb447ac['status'](0xcc)[_0x7c89('0x18')]();});}};}function handleEntityNotFound(_0x1bec19,_0x5b422b){return function(_0x653feb){if(!_0x653feb){_0x1bec19[_0x7c89('0x16')](0x194);}return _0x653feb;};}function handleError(_0x5ee0fb,_0x295953){_0x295953=_0x295953||0x1f4;return function(_0x3705ce){logger[_0x7c89('0x20')](_0x3705ce[_0x7c89('0x21')]);if(_0x3705ce[_0x7c89('0x22')]){delete _0x3705ce['name'];}_0x5ee0fb[_0x7c89('0x17')](_0x295953)[_0x7c89('0x23')](_0x3705ce);};}exports[_0x7c89('0x24')]=function(_0x24f47b,_0x43a3c4){var _0x1e4910={},_0x54c4ac={},_0x32106b={'count':0x0,'rows':[]};var _0x27ac1d=_[_0x7c89('0x25')](db['MailQueueReport'][_0x7c89('0x26')],function(_0x2978a3){return{'name':_0x2978a3[_0x7c89('0x27')],'type':_0x2978a3[_0x7c89('0x28')][_0x7c89('0x29')]};});_0x54c4ac['model']=_[_0x7c89('0x25')](_0x27ac1d,_0x7c89('0x22'));_0x54c4ac[_0x7c89('0x2a')]=_[_0x7c89('0x2b')](_0x24f47b[_0x7c89('0x2a')]);_0x54c4ac[_0x7c89('0x2c')]=_['intersection'](_0x54c4ac[_0x7c89('0x2d')],_0x54c4ac[_0x7c89('0x2a')]);_0x1e4910['attributes']=_[_0x7c89('0x2e')](_0x54c4ac[_0x7c89('0x2d')],qs[_0x7c89('0x2f')](_0x24f47b[_0x7c89('0x2a')]['fields']));_0x1e4910[_0x7c89('0x30')]=_0x1e4910['attributes'][_0x7c89('0x31')]?_0x1e4910[_0x7c89('0x30')]:_0x54c4ac['model'];if(!_0x24f47b[_0x7c89('0x2a')][_0x7c89('0x32')]('nolimit')){_0x1e4910['limit']=qs['limit'](_0x24f47b[_0x7c89('0x2a')]['limit']);_0x1e4910[_0x7c89('0x1a')]=qs[_0x7c89('0x1a')](_0x24f47b[_0x7c89('0x2a')][_0x7c89('0x1a')]);}_0x1e4910[_0x7c89('0x33')]=qs[_0x7c89('0x34')](_0x24f47b[_0x7c89('0x2a')][_0x7c89('0x34')]);_0x1e4910['where']=qs[_0x7c89('0x2c')](_[_0x7c89('0x35')](_0x24f47b[_0x7c89('0x2a')],_0x54c4ac[_0x7c89('0x2c')]));if(_0x24f47b[_0x7c89('0x2a')][_0x7c89('0x36')]){_0x1e4910[_0x7c89('0x37')]=_[_0x7c89('0x38')](_0x1e4910['where'],{'$or':_['map'](_0x27ac1d,function(_0x2bdac1){if(_0x2bdac1['type']!=='VIRTUAL'){var _0x558653={};_0x558653[_0x2bdac1[_0x7c89('0x22')]]={'$like':'%'+_0x24f47b[_0x7c89('0x2a')][_0x7c89('0x36')]+'%'};return _0x558653;}})});}_0x1e4910=_[_0x7c89('0x38')]({},_0x1e4910,_0x24f47b[_0x7c89('0x39')]);var _0x1bcc29={'where':_0x1e4910[_0x7c89('0x37')]};return db[_0x7c89('0x3a')][_0x7c89('0x19')](_0x1bcc29)[_0x7c89('0x3b')](function(_0x2c95e){_0x32106b[_0x7c89('0x19')]=_0x2c95e;if(_0x24f47b[_0x7c89('0x2a')][_0x7c89('0x3c')]){_0x1e4910['include']=[{'all':!![]}];}return db[_0x7c89('0x3a')][_0x7c89('0x3d')](_0x1e4910);})[_0x7c89('0x3b')](function(_0x358f72){_0x32106b['rows']=_0x358f72;return _0x32106b;})[_0x7c89('0x3b')](respondWithFilteredResult(_0x43a3c4,_0x1e4910))[_0x7c89('0x3e')](handleError(_0x43a3c4,null));};exports[_0x7c89('0x3f')]=function(_0x7126e9,_0x2cf164){var _0x3335da={'raw':!![],'where':{'id':_0x7126e9[_0x7c89('0x40')]['id']}},_0x51661b={};_0x51661b[_0x7c89('0x2d')]=_[_0x7c89('0x2b')](db[_0x7c89('0x3a')][_0x7c89('0x26')]);_0x51661b[_0x7c89('0x2a')]=_[_0x7c89('0x2b')](_0x7126e9[_0x7c89('0x2a')]);_0x51661b[_0x7c89('0x2c')]=_[_0x7c89('0x2e')](_0x51661b[_0x7c89('0x2d')],_0x51661b[_0x7c89('0x2a')]);_0x3335da[_0x7c89('0x30')]=_['intersection'](_0x51661b[_0x7c89('0x2d')],qs[_0x7c89('0x2f')](_0x7126e9[_0x7c89('0x2a')][_0x7c89('0x2f')]));_0x3335da[_0x7c89('0x30')]=_0x3335da[_0x7c89('0x30')][_0x7c89('0x31')]?_0x3335da['attributes']:_0x51661b[_0x7c89('0x2d')];if(_0x7126e9[_0x7c89('0x2a')][_0x7c89('0x3c')]){_0x3335da[_0x7c89('0x41')]=[{'all':!![]}];}_0x3335da=_[_0x7c89('0x38')]({},_0x3335da,_0x7126e9[_0x7c89('0x39')]);return db['MailQueueReport'][_0x7c89('0x42')](_0x3335da)[_0x7c89('0x3b')](handleEntityNotFound(_0x2cf164,null))['then'](respondWithResult(_0x2cf164,null))[_0x7c89('0x3e')](handleError(_0x2cf164,null));};exports[_0x7c89('0x43')]=function(_0x570fc3,_0xca4839){return db[_0x7c89('0x3a')][_0x7c89('0x43')](_0x570fc3[_0x7c89('0x44')],{})['then'](respondWithResult(_0xca4839,0xc9))[_0x7c89('0x3e')](handleError(_0xca4839,null));};exports[_0x7c89('0x45')]=function(_0x2c941a,_0x18a6d3){if(_0x2c941a[_0x7c89('0x44')]['id']){delete _0x2c941a[_0x7c89('0x44')]['id'];}return db[_0x7c89('0x3a')]['find']({'where':{'id':_0x2c941a[_0x7c89('0x40')]['id']}})[_0x7c89('0x3b')](handleEntityNotFound(_0x18a6d3,null))[_0x7c89('0x3b')](saveUpdates(_0x2c941a['body'],null))[_0x7c89('0x3b')](respondWithResult(_0x18a6d3,null))[_0x7c89('0x3e')](handleError(_0x18a6d3,null));};exports[_0x7c89('0x1f')]=function(_0x24c013,_0x39869c){return db[_0x7c89('0x3a')][_0x7c89('0x42')]({'where':{'id':_0x24c013['params']['id']}})[_0x7c89('0x3b')](handleEntityNotFound(_0x39869c,null))['then'](removeEntity(_0x39869c,null))[_0x7c89('0x3e')](handleError(_0x39869c,null));};exports[_0x7c89('0x46')]=function(_0x285311,_0x330937){return db[_0x7c89('0x3a')][_0x7c89('0x46')]()[_0x7c89('0x3b')](respondWithResult(_0x330937,null))[_0x7c89('0x3e')](handleError(_0x330937,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 7393b49..5a2473c 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 _0x6c16=['./mailQueueReport.attributes','exports','define','MailQueueReport','report_mail_queue','uniqueid','lodash','util','moment','../../config/environment'];(function(_0x358161,_0x31172c){var _0x2ca39d=function(_0x5e2a7e){while(--_0x5e2a7e){_0x358161['push'](_0x358161['shift']());}};_0x2ca39d(++_0x31172c);}(_0x6c16,0x11e));var _0x66c1=function(_0x196585,_0x1e2e9e){_0x196585=_0x196585-0x0;var _0x223bf2=_0x6c16[_0x196585];return _0x223bf2;};'use strict';var _=require(_0x66c1('0x0'));var util=require(_0x66c1('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x66c1('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x66c1('0x3'));var attributes=require(_0x66c1('0x4'));module[_0x66c1('0x5')]=function(_0x4a12b7,_0x40f537){return _0x4a12b7[_0x66c1('0x6')](_0x66c1('0x7'),attributes,{'tableName':_0x66c1('0x8'),'paranoid':![],'indexes':[{'name':_0x66c1('0x9'),'fields':[_0x66c1('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe035=['uniqueid','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./mailQueueReport.attributes','exports','define','MailQueueReport','report_mail_queue'];(function(_0x2763f2,_0x416af8){var _0x3ef471=function(_0x288aa2){while(--_0x288aa2){_0x2763f2['push'](_0x2763f2['shift']());}};_0x3ef471(++_0x416af8);}(_0xe035,0x1eb));var _0x5e03=function(_0x4fd319,_0x378fea){_0x4fd319=_0x4fd319-0x0;var _0x59bb24=_0xe035[_0x4fd319];return _0x59bb24;};'use strict';var _=require(_0x5e03('0x0'));var util=require(_0x5e03('0x1'));var logger=require(_0x5e03('0x2'))('api');var moment=require('moment');var BPromise=require(_0x5e03('0x3'));var rp=require(_0x5e03('0x4'));var fs=require('fs');var path=require(_0x5e03('0x5'));var rimraf=require(_0x5e03('0x6'));var config=require(_0x5e03('0x7'));var attributes=require(_0x5e03('0x8'));module[_0x5e03('0x9')]=function(_0x1f8c8e,_0x1cfa7d){return _0x1f8c8e[_0x5e03('0xa')](_0x5e03('0xb'),attributes,{'tableName':_0x5e03('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x5e03('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index c3b115e..a4bdecc 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 _0x1623=['catch','CreateMailQueueReport','MailQueueReport','create','body','options','update','raw','where','limit','UpdateMailQueueReport','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','request','then','info','debug','MailQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','MailQueueReport,\x20%s,\x20%s','message','result'];(function(_0x571a17,_0x63fb3d){var _0x3ef337=function(_0x12096b){while(--_0x12096b){_0x571a17['push'](_0x571a17['shift']());}};_0x3ef337(++_0x63fb3d);}(_0x1623,0xab));var _0x3162=function(_0x1f38dd,_0x4c1995){_0x1f38dd=_0x1f38dd-0x0;var _0x4afc77=_0x1623[_0x1f38dd];return _0x4afc77;};'use strict';var _=require(_0x3162('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x3162('0x1'));var rs=require(_0x3162('0x2'));var fs=require('fs');var Redis=require(_0x3162('0x3'));var db=require(_0x3162('0x4'))['db'];var utils=require(_0x3162('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x3162('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x3162('0x7')][_0x3162('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x53260d,_0xffe9b6,_0x2dc07e){return new BPromise(function(_0x26ee32,_0x36609e){return client[_0x3162('0x9')](_0x53260d,_0x2dc07e)[_0x3162('0xa')](function(_0xe43099){logger[_0x3162('0xb')]('MailQueueReport,\x20%s,\x20%s',_0xffe9b6,'request\x20sent');logger[_0x3162('0xc')](_0x3162('0xd'),_0xffe9b6,_0x3162('0xe'),JSON[_0x3162('0xf')](_0xe43099));if(_0xe43099[_0x3162('0x10')]){if(_0xe43099[_0x3162('0x10')][_0x3162('0x11')]===0x1f4){logger[_0x3162('0x10')](_0x3162('0x12'),_0xffe9b6,_0xe43099['error'][_0x3162('0x13')]);return _0x36609e(_0xe43099['error'][_0x3162('0x13')]);}logger[_0x3162('0x10')]('MailQueueReport,\x20%s,\x20%s',_0xffe9b6,_0xe43099['error'][_0x3162('0x13')]);return _0x26ee32(_0xe43099[_0x3162('0x10')][_0x3162('0x13')]);}else{logger['info'](_0x3162('0x12'),_0xffe9b6,_0x3162('0xe'));_0x26ee32(_0xe43099[_0x3162('0x14')]['message']);}})[_0x3162('0x15')](function(_0x42cf7d){logger[_0x3162('0x10')](_0x3162('0x12'),_0xffe9b6,_0x42cf7d);_0x36609e(_0x42cf7d);});});}exports[_0x3162('0x16')]=function(_0x1eed46){var _0x391d97=this;return new Promise(function(_0x4b2bf3,_0x42f283){return db[_0x3162('0x17')][_0x3162('0x18')](_0x1eed46[_0x3162('0x19')],{'raw':_0x1eed46['options']?_0x1eed46[_0x3162('0x1a')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0xa5c62b){logger[_0x3162('0xb')](_0x3162('0x16'),_0x1eed46);logger['debug']('CreateMailQueueReport',_0x1eed46,JSON[_0x3162('0xf')](_0xa5c62b));_0x4b2bf3(_0xa5c62b);})[_0x3162('0x15')](function(_0x32c051){logger[_0x3162('0x10')](_0x3162('0x16'),_0x32c051[_0x3162('0x13')],_0x1eed46);_0x42f283(_0x391d97[_0x3162('0x10')](0x1f4,_0x32c051[_0x3162('0x13')]));});});};exports['UpdateMailQueueReport']=function(_0xd283d6){var _0x2433f8=this;return new Promise(function(_0x3919e7,_0x1fd76f){return db[_0x3162('0x17')][_0x3162('0x1b')](_0xd283d6[_0x3162('0x19')],{'raw':_0xd283d6[_0x3162('0x1a')]?_0xd283d6[_0x3162('0x1a')][_0x3162('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xd283d6[_0x3162('0x1a')]?_0xd283d6[_0x3162('0x1a')][_0x3162('0x1d')]||null:null,'attributes':_0xd283d6['options']?_0xd283d6[_0x3162('0x1a')]['attributes']||null:null,'limit':_0xd283d6[_0x3162('0x1a')]?_0xd283d6[_0x3162('0x1a')][_0x3162('0x1e')]||null:null})['then'](function(_0x4903e7){logger[_0x3162('0xb')](_0x3162('0x1f'),_0xd283d6);logger[_0x3162('0xc')](_0x3162('0x1f'),_0xd283d6,JSON[_0x3162('0xf')](_0x4903e7));_0x3919e7(_0x4903e7);})['catch'](function(_0x8a7bce){logger['error'](_0x3162('0x1f'),_0x8a7bce[_0x3162('0x13')],_0xd283d6);_0x1fd76f(_0x2433f8[_0x3162('0x10')](0x1f4,_0x8a7bce[_0x3162('0x13')]));});});}; \ No newline at end of file +var _0x2ef3=['options','raw','UpdateMailQueueReport','where','attributes','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','MailQueueReport,\x20%s,\x20%s','MailQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','CreateMailQueueReport','MailQueueReport','body'];(function(_0x389c94,_0x2a93d9){var _0x1455cb=function(_0x5903d6){while(--_0x5903d6){_0x389c94['push'](_0x389c94['shift']());}};_0x1455cb(++_0x2a93d9);}(_0x2ef3,0xba));var _0x32ef=function(_0x184e9e,_0x5450ec){_0x184e9e=_0x184e9e-0x0;var _0x5f38d0=_0x2ef3[_0x184e9e];return _0x5f38d0;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var moment=require(_0x32ef('0x2'));var BPromise=require(_0x32ef('0x3'));var rs=require(_0x32ef('0x4'));var fs=require('fs');var Redis=require(_0x32ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('rpc');var config=require(_0x32ef('0x8'));var jayson=require(_0x32ef('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2c0089,_0x4bfcf8,_0x367c39){return new BPromise(function(_0x2fb8eb,_0x234863){return client[_0x32ef('0xa')](_0x2c0089,_0x367c39)[_0x32ef('0xb')](function(_0x2bbb50){logger[_0x32ef('0xc')](_0x32ef('0xd'),_0x4bfcf8,'request\x20sent');logger['debug'](_0x32ef('0xe'),_0x4bfcf8,_0x32ef('0xf'),JSON[_0x32ef('0x10')](_0x2bbb50));if(_0x2bbb50[_0x32ef('0x11')]){if(_0x2bbb50['error'][_0x32ef('0x12')]===0x1f4){logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x234863(_0x2bbb50[_0x32ef('0x11')]['message']);}logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x2fb8eb(_0x2bbb50[_0x32ef('0x11')][_0x32ef('0x13')]);}else{logger[_0x32ef('0xc')]('MailQueueReport,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('MailQueueReport,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});}exports[_0x32ef('0x15')]=function(_0x1a9476){var _0x286bfb=this;return new Promise(function(_0x57863c,_0xbe37f6){return db[_0x32ef('0x16')]['create'](_0x1a9476[_0x32ef('0x17')],{'raw':_0x1a9476[_0x32ef('0x18')]?_0x1a9476[_0x32ef('0x18')][_0x32ef('0x19')]===undefined?!![]:![]:!![]})[_0x32ef('0xb')](function(_0x3aec05){logger['info'](_0x32ef('0x15'),_0x1a9476);logger['debug'](_0x32ef('0x15'),_0x1a9476,JSON[_0x32ef('0x10')](_0x3aec05));_0x57863c(_0x3aec05);})['catch'](function(_0x1af371){logger[_0x32ef('0x11')](_0x32ef('0x15'),_0x1af371['message'],_0x1a9476);_0xbe37f6(_0x286bfb['error'](0x1f4,_0x1af371[_0x32ef('0x13')]));});});};exports[_0x32ef('0x1a')]=function(_0x225feb){var _0x478bef=this;return new Promise(function(_0x59585f,_0x19ea6){return db['MailQueueReport']['update'](_0x225feb[_0x32ef('0x17')],{'raw':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')][_0x32ef('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')][_0x32ef('0x1b')]||null:null,'attributes':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')][_0x32ef('0x1c')]||null:null,'limit':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')]['limit']||null:null})[_0x32ef('0xb')](function(_0x2f5d06){logger['info'](_0x32ef('0x1a'),_0x225feb);logger[_0x32ef('0x1d')](_0x32ef('0x1a'),_0x225feb,JSON[_0x32ef('0x10')](_0x2f5d06));_0x59585f(_0x2f5d06);})['catch'](function(_0x10e38c){logger[_0x32ef('0x11')](_0x32ef('0x1a'),_0x10e38c[_0x32ef('0x13')],_0x225feb);_0x19ea6(_0x478bef[_0x32ef('0x11')](0x1f4,_0x10e38c[_0x32ef('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index 73c21c5..3d03893 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 _0x76c7=['../../config/environment','exports','path','connect-timeout','../../components/auth/service'];(function(_0x3ad61a,_0x5bb429){var _0x3aa927=function(_0x54e3f1){while(--_0x54e3f1){_0x3ad61a['push'](_0x3ad61a['shift']());}};_0x3aa927(++_0x5bb429);}(_0x76c7,0x1c9));var _0x776c=function(_0x57c880,_0x3c9f1f){_0x57c880=_0x57c880-0x0;var _0x371a92=_0x76c7[_0x57c880];return _0x371a92;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x776c('0x0'));var timeout=require(_0x776c('0x1'));var express=require('express');var router=express['Router']();var auth=require(_0x776c('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0x776c('0x3'));module[_0x776c('0x4')]=router; \ No newline at end of file +var _0xf14e=['connect-timeout','Router','../../components/interaction/service','../../config/environment','util','path'];(function(_0x513545,_0x158f2e){var _0x18b7c5=function(_0x58514c){while(--_0x58514c){_0x513545['push'](_0x513545['shift']());}};_0x18b7c5(++_0x158f2e);}(_0xf14e,0x17e));var _0xef14=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0xf14e[_0x3ff085];return _0x2b68c3;};'use strict';var multer=require('multer');var util=require(_0xef14('0x0'));var path=require(_0xef14('0x1'));var timeout=require(_0xef14('0x2'));var express=require('express');var router=express[_0xef14('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xef14('0x4'));var config=require(_0xef14('0x5'));module['exports']=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index 212604d..3c1c93d 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 _0xe955=['STRING','username','INTEGER','BOOLEAN','INBOX','sequelize','exports'];(function(_0x24c4c7,_0x607498){var _0x36fa37=function(_0x39eac2){while(--_0x39eac2){_0x24c4c7['push'](_0x24c4c7['shift']());}};_0x36fa37(++_0x607498);}(_0xe955,0x139));var _0x5e95=function(_0x202cc1,_0x3b0a1b){_0x202cc1=_0x202cc1-0x0;var _0x399915=_0xe955[_0x202cc1];return _0x399915;};'use strict';var Sequelize=require(_0x5e95('0x0'));module[_0x5e95('0x1')]={'description':{'type':Sequelize[_0x5e95('0x2')]},'host':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'user':{'type':Sequelize['STRING'],'unique':_0x5e95('0x3')},'password':{'type':Sequelize[_0x5e95('0x2')]},'port':{'type':Sequelize[_0x5e95('0x4')]},'tls':{'type':Sequelize[_0x5e95('0x5')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x5e95('0x2')],'defaultValue':_0x5e95('0x6')},'connTimeout':{'type':Sequelize[_0x5e95('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x5e95('0x4')],'defaultValue':0x5},'service':{'type':Sequelize[_0x5e95('0x2')]}}; \ No newline at end of file +var _0x469d=['INBOX','INTEGER','sequelize','exports','STRING','BOOLEAN','username'];(function(_0x16ea66,_0x29a7c7){var _0x5dc508=function(_0x4376bf){while(--_0x4376bf){_0x16ea66['push'](_0x16ea66['shift']());}};_0x5dc508(++_0x29a7c7);}(_0x469d,0x136));var _0xd469=function(_0x4d71cf,_0x89c52){_0x4d71cf=_0x4d71cf-0x0;var _0x2c5904=_0x469d[_0x4d71cf];return _0x2c5904;};'use strict';var Sequelize=require(_0xd469('0x0'));module[_0xd469('0x1')]={'description':{'type':Sequelize[_0xd469('0x2')]},'host':{'type':Sequelize[_0xd469('0x2')]},'authentication':{'type':Sequelize[_0xd469('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0xd469('0x2')],'unique':_0xd469('0x4')},'password':{'type':Sequelize[_0xd469('0x2')]},'port':{'type':Sequelize['INTEGER']},'tls':{'type':Sequelize[_0xd469('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0xd469('0x2')],'defaultValue':_0xd469('0x5')},'connTimeout':{'type':Sequelize[_0xd469('0x6')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0xd469('0x6')],'defaultValue':0x5},'service':{'type':Sequelize[_0xd469('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index 7703059..959b143 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 _0xd070=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailServerIn.attributes','exports','define','mail_servers_in','lodash'];(function(_0x52b7b9,_0x43ed4b){var _0x5b5d30=function(_0x4a5b9c){while(--_0x4a5b9c){_0x52b7b9['push'](_0x52b7b9['shift']());}};_0x5b5d30(++_0x43ed4b);}(_0xd070,0x8e));var _0x0d07=function(_0x5a2024,_0x4e1034){_0x5a2024=_0x5a2024-0x0;var _0x403e0d=_0xd070[_0x5a2024];return _0x403e0d;};'use strict';var _=require(_0x0d07('0x0'));var util=require('util');var logger=require(_0x0d07('0x1'))(_0x0d07('0x2'));var moment=require(_0x0d07('0x3'));var BPromise=require(_0x0d07('0x4'));var rp=require(_0x0d07('0x5'));var fs=require('fs');var path=require(_0x0d07('0x6'));var rimraf=require(_0x0d07('0x7'));var config=require(_0x0d07('0x8'));var attributes=require(_0x0d07('0x9'));module[_0x0d07('0xa')]=function(_0x18943f,_0x495815){return _0x18943f[_0x0d07('0xb')]('MailServerIn',attributes,{'tableName':_0x0d07('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x63a5=['../../config/logger','moment','request-promise','path','rimraf','../../config/environment','define','MailServerIn','lodash','util'];(function(_0x4b4950,_0x103d19){var _0x401a6e=function(_0x5e2d58){while(--_0x5e2d58){_0x4b4950['push'](_0x4b4950['shift']());}};_0x401a6e(++_0x103d19);}(_0x63a5,0x18e));var _0x563a=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0x63a5[_0xa148b7];return _0x51efd3;};'use strict';var _=require(_0x563a('0x0'));var util=require(_0x563a('0x1'));var logger=require(_0x563a('0x2'))('api');var moment=require(_0x563a('0x3'));var BPromise=require('bluebird');var rp=require(_0x563a('0x4'));var fs=require('fs');var path=require(_0x563a('0x5'));var rimraf=require(_0x563a('0x6'));var config=require(_0x563a('0x7'));var attributes=require('./mailServerIn.attributes');module['exports']=function(_0x1fdcb0,_0x5a6458){return _0x1fdcb0[_0x563a('0x8')](_0x563a('0x9'),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 fdf5689..bc2eb4c 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 _0x3b97=['debug','MailServerIn,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','MailServerIn,\x20%s,\x20%s','message','result','catch','GetMailServerIn','MailServerIn','findAll','options','raw','where','attributes','limit','include','map','model','then','stringify','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','request','info'];(function(_0x50ffa5,_0x4b91f1){var _0x98a14d=function(_0x546ed0){while(--_0x546ed0){_0x50ffa5['push'](_0x50ffa5['shift']());}};_0x98a14d(++_0x4b91f1);}(_0x3b97,0x9e));var _0x73b9=function(_0x284319,_0x580b32){_0x284319=_0x284319-0x0;var _0x37e9b4=_0x3b97[_0x284319];return _0x37e9b4;};'use strict';var _=require('lodash');var util=require(_0x73b9('0x0'));var moment=require(_0x73b9('0x1'));var BPromise=require(_0x73b9('0x2'));var rs=require(_0x73b9('0x3'));var fs=require('fs');var Redis=require(_0x73b9('0x4'));var db=require(_0x73b9('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x73b9('0x6'))('rpc');var config=require(_0x73b9('0x7'));var jayson=require(_0x73b9('0x8'));var client=jayson[_0x73b9('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1710fc,_0xc45f5c,_0x2dd1fd){return new BPromise(function(_0x8b830c,_0x25d42d){return client[_0x73b9('0xa')](_0x1710fc,_0x2dd1fd)['then'](function(_0x2b4660){logger[_0x73b9('0xb')]('MailServerIn,\x20%s,\x20%s',_0xc45f5c,'request\x20sent');logger[_0x73b9('0xc')](_0x73b9('0xd'),_0xc45f5c,_0x73b9('0xe'),JSON['stringify'](_0x2b4660));if(_0x2b4660['error']){if(_0x2b4660[_0x73b9('0xf')][_0x73b9('0x10')]===0x1f4){logger[_0x73b9('0xf')](_0x73b9('0x11'),_0xc45f5c,_0x2b4660['error']['message']);return _0x25d42d(_0x2b4660[_0x73b9('0xf')][_0x73b9('0x12')]);}logger[_0x73b9('0xf')](_0x73b9('0x11'),_0xc45f5c,_0x2b4660[_0x73b9('0xf')]['message']);return _0x8b830c(_0x2b4660[_0x73b9('0xf')][_0x73b9('0x12')]);}else{logger[_0x73b9('0xb')](_0x73b9('0x11'),_0xc45f5c,_0x73b9('0xe'));_0x8b830c(_0x2b4660[_0x73b9('0x13')][_0x73b9('0x12')]);}})[_0x73b9('0x14')](function(_0x4a42af){logger[_0x73b9('0xf')](_0x73b9('0x11'),_0xc45f5c,_0x4a42af);_0x25d42d(_0x4a42af);});});}exports[_0x73b9('0x15')]=function(_0x188176){var _0x485868=this;return new Promise(function(_0x3441b4,_0x3a1bc5){return db[_0x73b9('0x16')][_0x73b9('0x17')]({'raw':_0x188176[_0x73b9('0x18')]?_0x188176[_0x73b9('0x18')][_0x73b9('0x19')]===undefined?!![]:![]:!![],'where':_0x188176['options']?_0x188176[_0x73b9('0x18')][_0x73b9('0x1a')]||null:null,'attributes':_0x188176[_0x73b9('0x18')]?_0x188176['options'][_0x73b9('0x1b')]||null:null,'limit':_0x188176[_0x73b9('0x18')]?_0x188176[_0x73b9('0x18')][_0x73b9('0x1c')]||null:null,'include':_0x188176[_0x73b9('0x18')]?_0x188176[_0x73b9('0x18')][_0x73b9('0x1d')]?_[_0x73b9('0x1e')](_0x188176[_0x73b9('0x18')]['include'],function(_0x38ee42){return{'model':db[_0x38ee42[_0x73b9('0x1f')]],'as':_0x38ee42['as'],'attributes':_0x38ee42[_0x73b9('0x1b')],'include':_0x38ee42[_0x73b9('0x1d')]?_[_0x73b9('0x1e')](_0x38ee42[_0x73b9('0x1d')],function(_0xd60e6e){return{'model':db[_0xd60e6e[_0x73b9('0x1f')]],'as':_0xd60e6e['as'],'attributes':_0xd60e6e[_0x73b9('0x1b')],'include':_0xd60e6e[_0x73b9('0x1d')]?_[_0x73b9('0x1e')](_0xd60e6e[_0x73b9('0x1d')],function(_0x112658){return{'model':db[_0x112658['model']],'as':_0x112658['as'],'attributes':_0x112658[_0x73b9('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x73b9('0x20')](function(_0x5bab31){logger['info'](_0x73b9('0x15'),_0x188176);logger[_0x73b9('0xc')](_0x73b9('0x15'),_0x188176,JSON[_0x73b9('0x21')](_0x5bab31));_0x3441b4(_0x5bab31);})[_0x73b9('0x14')](function(_0x298731){logger[_0x73b9('0xf')](_0x73b9('0x15'),_0x298731['message'],_0x188176);_0x3a1bc5(_0x485868[_0x73b9('0xf')](0x1f4,_0x298731['message']));});});}; \ No newline at end of file +var _0x240f=['debug','lodash','bluebird','randomstring','ioredis','../../config/environment','http','then','MailServerIn,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','GetMailServerIn','MailServerIn','findAll','options','attributes','limit','include','map','model'];(function(_0x53afa6,_0x59e786){var _0x51f86a=function(_0x368385){while(--_0x368385){_0x53afa6['push'](_0x53afa6['shift']());}};_0x51f86a(++_0x59e786);}(_0x240f,0x69));var _0xf240=function(_0x12c169,_0x286b28){_0x12c169=_0x12c169-0x0;var _0x4e2c4f=_0x240f[_0x12c169];return _0x4e2c4f;};'use strict';var _=require(_0xf240('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xf240('0x1'));var rs=require(_0xf240('0x2'));var fs=require('fs');var Redis=require(_0xf240('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xf240('0x4'));var jayson=require('jayson/promise');var client=jayson['client'][_0xf240('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x1fa079,_0x41e617,_0xecbf4a){return new BPromise(function(_0x28a251,_0x232215){return client['request'](_0x1fa079,_0xecbf4a)[_0xf240('0x6')](function(_0xd6e05d){logger['info'](_0xf240('0x7'),_0x41e617,_0xf240('0x8'));logger['debug']('MailServerIn,\x20%s,\x20%s,\x20%s',_0x41e617,_0xf240('0x8'),JSON[_0xf240('0x9')](_0xd6e05d));if(_0xd6e05d[_0xf240('0xa')]){if(_0xd6e05d['error'][_0xf240('0xb')]===0x1f4){logger[_0xf240('0xa')]('MailServerIn,\x20%s,\x20%s',_0x41e617,_0xd6e05d[_0xf240('0xa')][_0xf240('0xc')]);return _0x232215(_0xd6e05d['error'][_0xf240('0xc')]);}logger[_0xf240('0xa')](_0xf240('0x7'),_0x41e617,_0xd6e05d['error'][_0xf240('0xc')]);return _0x28a251(_0xd6e05d['error']['message']);}else{logger[_0xf240('0xd')](_0xf240('0x7'),_0x41e617,'request\x20sent');_0x28a251(_0xd6e05d[_0xf240('0xe')][_0xf240('0xc')]);}})[_0xf240('0xf')](function(_0x5f3b30){logger['error'](_0xf240('0x7'),_0x41e617,_0x5f3b30);_0x232215(_0x5f3b30);});});}exports[_0xf240('0x10')]=function(_0x4d3147){var _0x40ae90=this;return new Promise(function(_0x54aeea,_0x87c166){return db[_0xf240('0x11')][_0xf240('0x12')]({'raw':_0x4d3147[_0xf240('0x13')]?_0x4d3147[_0xf240('0x13')]['raw']===undefined?!![]:![]:!![],'where':_0x4d3147[_0xf240('0x13')]?_0x4d3147['options']['where']||null:null,'attributes':_0x4d3147[_0xf240('0x13')]?_0x4d3147[_0xf240('0x13')][_0xf240('0x14')]||null:null,'limit':_0x4d3147['options']?_0x4d3147[_0xf240('0x13')][_0xf240('0x15')]||null:null,'include':_0x4d3147[_0xf240('0x13')]?_0x4d3147[_0xf240('0x13')][_0xf240('0x16')]?_[_0xf240('0x17')](_0x4d3147[_0xf240('0x13')][_0xf240('0x16')],function(_0x5e45f3){return{'model':db[_0x5e45f3[_0xf240('0x18')]],'as':_0x5e45f3['as'],'attributes':_0x5e45f3[_0xf240('0x14')],'include':_0x5e45f3['include']?_[_0xf240('0x17')](_0x5e45f3[_0xf240('0x16')],function(_0x3211d7){return{'model':db[_0x3211d7[_0xf240('0x18')]],'as':_0x3211d7['as'],'attributes':_0x3211d7['attributes'],'include':_0x3211d7[_0xf240('0x16')]?_['map'](_0x3211d7['include'],function(_0x1704de){return{'model':db[_0x1704de[_0xf240('0x18')]],'as':_0x1704de['as'],'attributes':_0x1704de['attributes']};}):[]};}):[]};}):[]:[]})[_0xf240('0x6')](function(_0x55e3c4){logger['info']('GetMailServerIn',_0x4d3147);logger[_0xf240('0x19')](_0xf240('0x10'),_0x4d3147,JSON[_0xf240('0x9')](_0x55e3c4));_0x54aeea(_0x55e3c4);})[_0xf240('0xf')](function(_0x578f81){logger['error'](_0xf240('0x10'),_0x578f81[_0xf240('0xc')],_0x4d3147);_0x87c166(_0x40ae90['error'](0x1f4,_0x578f81[_0xf240('0xc')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 559cf77..19edcde 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 _0xb8ff=['./mailServerOut.controller','get','isAuthenticated','/:id','post','create','put','update','delete','destroy','multer','util','path','express','../../components/interaction/service'];(function(_0x37643f,_0x72bf3c){var _0x3b4d95=function(_0x1d45e4){while(--_0x1d45e4){_0x37643f['push'](_0x37643f['shift']());}};_0x3b4d95(++_0x72bf3c);}(_0xb8ff,0x1db));var _0xfb8f=function(_0x4fd3ce,_0x4b0fbe){_0x4fd3ce=_0x4fd3ce-0x0;var _0x4d1a6e=_0xb8ff[_0x4fd3ce];return _0x4d1a6e;};'use strict';var multer=require(_0xfb8f('0x0'));var util=require(_0xfb8f('0x1'));var path=require(_0xfb8f('0x2'));var timeout=require('connect-timeout');var express=require(_0xfb8f('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xfb8f('0x4'));var config=require('../../config/environment');var controller=require(_0xfb8f('0x5'));router[_0xfb8f('0x6')]('/',auth[_0xfb8f('0x7')](),controller['index']);router[_0xfb8f('0x6')](_0xfb8f('0x8'),auth[_0xfb8f('0x7')](),controller['show']);router[_0xfb8f('0x9')]('/',auth[_0xfb8f('0x7')](),controller[_0xfb8f('0xa')]);router[_0xfb8f('0xb')]('/:id',auth['isAuthenticated'](),controller[_0xfb8f('0xc')]);router[_0xfb8f('0xd')](_0xfb8f('0x8'),auth['isAuthenticated'](),controller[_0xfb8f('0xe')]);module['exports']=router; \ No newline at end of file +var _0x26b6=['/:id','update','delete','destroy','exports','multer','path','connect-timeout','Router','./mailServerOut.controller','get','index','isAuthenticated','show','post','create','put'];(function(_0x442d52,_0x47060f){var _0x35d696=function(_0x355a0b){while(--_0x355a0b){_0x442d52['push'](_0x442d52['shift']());}};_0x35d696(++_0x47060f);}(_0x26b6,0x148));var _0x626b=function(_0x2c7b48,_0x55c46f){_0x2c7b48=_0x2c7b48-0x0;var _0x4ed622=_0x26b6[_0x2c7b48];return _0x4ed622;};'use strict';var multer=require(_0x626b('0x0'));var util=require('util');var path=require(_0x626b('0x1'));var timeout=require(_0x626b('0x2'));var express=require('express');var router=express[_0x626b('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x626b('0x4'));router[_0x626b('0x5')]('/',auth['isAuthenticated'](),controller[_0x626b('0x6')]);router[_0x626b('0x5')]('/:id',auth[_0x626b('0x7')](),controller[_0x626b('0x8')]);router[_0x626b('0x9')]('/',auth[_0x626b('0x7')](),controller[_0x626b('0xa')]);router[_0x626b('0xb')](_0x626b('0xc'),auth[_0x626b('0x7')](),controller[_0x626b('0xd')]);router[_0x626b('0xe')](_0x626b('0xc'),auth['isAuthenticated'](),controller[_0x626b('0xf')]);module[_0x626b('0x10')]=router; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index b958c93..d7beddf 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 _0xa93a=['STRING','BOOLEAN'];(function(_0x116d56,_0x1eef34){var _0x4b4f63=function(_0x55574e){while(--_0x55574e){_0x116d56['push'](_0x116d56['shift']());}};_0x4b4f63(++_0x1eef34);}(_0xa93a,0xb8));var _0xaa93=function(_0x35f1d9,_0x52952b){_0x35f1d9=_0x35f1d9-0x0;var _0x274edd=_0xa93a[_0x35f1d9];return _0x274edd;};'use strict';var Sequelize=require('sequelize');module['exports']={'description':{'type':Sequelize[_0xaa93('0x0')]},'host':{'type':Sequelize['STRING']},'user':{'type':Sequelize['STRING']},'pass':{'type':Sequelize[_0xaa93('0x0')]},'port':{'type':Sequelize['INTEGER']},'secure':{'type':Sequelize[_0xaa93('0x1')],'defaultValue':![]},'service':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0xaa93('0x1')],'defaultValue':!![]}}; \ No newline at end of file +var _0x89b8=['exports','STRING','BOOLEAN','sequelize'];(function(_0x47b58b,_0x41a189){var _0x46bebe=function(_0x22bbfa){while(--_0x22bbfa){_0x47b58b['push'](_0x47b58b['shift']());}};_0x46bebe(++_0x41a189);}(_0x89b8,0x19f));var _0x889b=function(_0x2f96d3,_0x172eda){_0x2f96d3=_0x2f96d3-0x0;var _0x52225=_0x89b8[_0x2f96d3];return _0x52225;};'use strict';var Sequelize=require(_0x889b('0x0'));module[_0x889b('0x1')]={'description':{'type':Sequelize[_0x889b('0x2')]},'host':{'type':Sequelize[_0x889b('0x2')]},'user':{'type':Sequelize[_0x889b('0x2')]},'pass':{'type':Sequelize[_0x889b('0x2')]},'port':{'type':Sequelize['INTEGER']},'secure':{'type':Sequelize[_0x889b('0x3')],'defaultValue':![]},'service':{'type':Sequelize[_0x889b('0x2')]},'authentication':{'type':Sequelize[_0x889b('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index e536e77..7c1c878 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 _0x9236=['name','send','index','MailServerOut','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','map','VIRTUAL','options','include','findAll','rows','show','params','includeAll','find','catch','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','then','error','stack'];(function(_0x3bdb89,_0xcf4053){var _0x487001=function(_0x516d10){while(--_0x516d10){_0x3bdb89['push'](_0x3bdb89['shift']());}};_0x487001(++_0xcf4053);}(_0x9236,0x72));var _0x6923=function(_0xedf78e,_0xcc19d7){_0xedf78e=_0xedf78e-0x0;var _0x3ba904=_0x9236[_0xedf78e];return _0x3ba904;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x6923('0x0'));var rimraf=require(_0x6923('0x1'));var zipdir=require(_0x6923('0x2'));var jsonpatch=require(_0x6923('0x3'));var rp=require(_0x6923('0x4'));var moment=require(_0x6923('0x5'));var BPromise=require(_0x6923('0x6'));var Mustache=require(_0x6923('0x7'));var util=require(_0x6923('0x8'));var path=require(_0x6923('0x9'));var sox=require(_0x6923('0xa'));var csv=require(_0x6923('0xb'));var ejs=require(_0x6923('0xc'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x6923('0xd'));var jsforce=require(_0x6923('0xe'));var deskjs=require(_0x6923('0xf'));var toCsv=require(_0x6923('0xb'));var querystring=require(_0x6923('0x10'));var Papa=require(_0x6923('0x11'));var Redis=require(_0x6923('0x12'));var authService=require(_0x6923('0x13'));var qs=require(_0x6923('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x6923('0x15'))(_0x6923('0x16'));var utils=require('../../config/utils');var config=require(_0x6923('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x379b1d,_0x581d0d){_0x581d0d=_0x581d0d||0xcc;return function(_0x33b909){if(_0x33b909){return _0x379b1d[_0x6923('0x18')](_0x581d0d);}return _0x379b1d[_0x6923('0x19')](_0x581d0d)[_0x6923('0x1a')]();};}function respondWithResult(_0x37115c,_0x7e92fb){_0x7e92fb=_0x7e92fb||0xc8;return function(_0x54ff4b){if(_0x54ff4b){return _0x37115c[_0x6923('0x19')](_0x7e92fb)[_0x6923('0x1b')](_0x54ff4b);}};}function respondWithFilteredResult(_0xcf90b7,_0x4976e6){return function(_0x11dc4c){if(_0x11dc4c){var _0x3b2f0d=_0x11dc4c[_0x6923('0x1c')],_0x78c892=_0x4976e6[_0x6923('0x1d')],_0x3b785c=_0x4976e6['offset']+_0x4976e6[_0x6923('0x1e')],_0x33b591;if(_0x3b785c>=_0x3b2f0d){_0x3b785c=_0x3b2f0d;_0x33b591=0xc8;}else{_0x33b591=0xce;}_0xcf90b7[_0x6923('0x19')](_0x33b591);return _0xcf90b7[_0x6923('0x1f')](_0x6923('0x20'),_0x78c892+'-'+_0x3b785c+'/'+_0x3b2f0d)['json'](_0x11dc4c);}return null;};}function patchUpdates(_0x1f4f34){return function(_0x33f9d5){try{jsonpatch['apply'](_0x33f9d5,_0x1f4f34,!![]);}catch(_0x579d84){return BPromise[_0x6923('0x21')](_0x579d84);}return _0x33f9d5[_0x6923('0x22')]();};}function saveUpdates(_0x2f8f31,_0x13dc73){return function(_0x135752){if(_0x135752){return _0x135752['update'](_0x2f8f31)[_0x6923('0x23')](function(_0x5e077c){return _0x5e077c;});}return null;};}function removeEntity(_0x892495,_0xdd646c){return function(_0x31a357){if(_0x31a357){return _0x31a357['destroy']()[_0x6923('0x23')](function(){_0x892495[_0x6923('0x19')](0xcc)[_0x6923('0x1a')]();});}};}function handleEntityNotFound(_0x3d6f81,_0x33aa85){return function(_0x4683da){if(!_0x4683da){_0x3d6f81['sendStatus'](0x194);}return _0x4683da;};}function handleError(_0x3c940b,_0x3dc82f){_0x3dc82f=_0x3dc82f||0x1f4;return function(_0x2b2e2e){logger[_0x6923('0x24')](_0x2b2e2e[_0x6923('0x25')]);if(_0x2b2e2e['name']){delete _0x2b2e2e[_0x6923('0x26')];}_0x3c940b[_0x6923('0x19')](_0x3dc82f)[_0x6923('0x27')](_0x2b2e2e);};}exports[_0x6923('0x28')]=function(_0x5f0b6d,_0x492d97){var _0xbc657a={},_0x4d790b={},_0x12399c={'count':0x0,'rows':[]};var _0x2a77df=_['map'](db[_0x6923('0x29')][_0x6923('0x2a')],function(_0x315aa0){return{'name':_0x315aa0[_0x6923('0x2b')],'type':_0x315aa0[_0x6923('0x2c')][_0x6923('0x2d')]};});_0x4d790b['model']=_['map'](_0x2a77df,_0x6923('0x26'));_0x4d790b[_0x6923('0x2e')]=_[_0x6923('0x2f')](_0x5f0b6d[_0x6923('0x2e')]);_0x4d790b[_0x6923('0x30')]=_[_0x6923('0x31')](_0x4d790b[_0x6923('0x32')],_0x4d790b[_0x6923('0x2e')]);_0xbc657a[_0x6923('0x33')]=_[_0x6923('0x31')](_0x4d790b[_0x6923('0x32')],qs['fields'](_0x5f0b6d['query'][_0x6923('0x34')]));_0xbc657a[_0x6923('0x33')]=_0xbc657a[_0x6923('0x33')][_0x6923('0x35')]?_0xbc657a[_0x6923('0x33')]:_0x4d790b[_0x6923('0x32')];if(!_0x5f0b6d[_0x6923('0x2e')][_0x6923('0x36')](_0x6923('0x37'))){_0xbc657a[_0x6923('0x1e')]=qs[_0x6923('0x1e')](_0x5f0b6d[_0x6923('0x2e')][_0x6923('0x1e')]);_0xbc657a['offset']=qs[_0x6923('0x1d')](_0x5f0b6d['query']['offset']);}_0xbc657a[_0x6923('0x38')]=qs[_0x6923('0x39')](_0x5f0b6d[_0x6923('0x2e')]['sort']);_0xbc657a['where']=qs[_0x6923('0x30')](_[_0x6923('0x3a')](_0x5f0b6d['query'],_0x4d790b[_0x6923('0x30')]));if(_0x5f0b6d[_0x6923('0x2e')][_0x6923('0x3b')]){_0xbc657a[_0x6923('0x3c')]=_[_0x6923('0x3d')](_0xbc657a[_0x6923('0x3c')],{'$or':_[_0x6923('0x3e')](_0x2a77df,function(_0x30f625){if(_0x30f625['type']!==_0x6923('0x3f')){var _0x3161da={};_0x3161da[_0x30f625['name']]={'$like':'%'+_0x5f0b6d[_0x6923('0x2e')]['filter']+'%'};return _0x3161da;}})});}_0xbc657a=_[_0x6923('0x3d')]({},_0xbc657a,_0x5f0b6d[_0x6923('0x40')]);var _0x5e5d16={'where':_0xbc657a[_0x6923('0x3c')]};return db[_0x6923('0x29')][_0x6923('0x1c')](_0x5e5d16)['then'](function(_0x3d43c6){_0x12399c['count']=_0x3d43c6;if(_0x5f0b6d[_0x6923('0x2e')]['includeAll']){_0xbc657a[_0x6923('0x41')]=[{'all':!![]}];}return db[_0x6923('0x29')][_0x6923('0x42')](_0xbc657a);})[_0x6923('0x23')](function(_0x2a1360){_0x12399c[_0x6923('0x43')]=_0x2a1360;return _0x12399c;})[_0x6923('0x23')](respondWithFilteredResult(_0x492d97,_0xbc657a))['catch'](handleError(_0x492d97,null));};exports[_0x6923('0x44')]=function(_0x94df81,_0x42e4fb){var _0x47e4ac={'raw':!![],'where':{'id':_0x94df81[_0x6923('0x45')]['id']}},_0x1d3c21={};_0x1d3c21[_0x6923('0x32')]=_[_0x6923('0x2f')](db['MailServerOut'][_0x6923('0x2a')]);_0x1d3c21['query']=_[_0x6923('0x2f')](_0x94df81[_0x6923('0x2e')]);_0x1d3c21['filters']=_['intersection'](_0x1d3c21[_0x6923('0x32')],_0x1d3c21[_0x6923('0x2e')]);_0x47e4ac[_0x6923('0x33')]=_[_0x6923('0x31')](_0x1d3c21[_0x6923('0x32')],qs[_0x6923('0x34')](_0x94df81[_0x6923('0x2e')][_0x6923('0x34')]));_0x47e4ac['attributes']=_0x47e4ac['attributes']['length']?_0x47e4ac[_0x6923('0x33')]:_0x1d3c21[_0x6923('0x32')];if(_0x94df81[_0x6923('0x2e')][_0x6923('0x46')]){_0x47e4ac[_0x6923('0x41')]=[{'all':!![]}];}_0x47e4ac=_[_0x6923('0x3d')]({},_0x47e4ac,_0x94df81[_0x6923('0x40')]);return db['MailServerOut'][_0x6923('0x47')](_0x47e4ac)[_0x6923('0x23')](handleEntityNotFound(_0x42e4fb,null))[_0x6923('0x23')](respondWithResult(_0x42e4fb,null))[_0x6923('0x48')](handleError(_0x42e4fb,null));};exports[_0x6923('0x49')]=function(_0x2ed48d,_0x4c244f){return db[_0x6923('0x29')][_0x6923('0x49')](_0x2ed48d[_0x6923('0x4a')],{})[_0x6923('0x23')](respondWithResult(_0x4c244f,0xc9))[_0x6923('0x48')](handleError(_0x4c244f,null));};exports['update']=function(_0x3cadb3,_0x4c829b){if(_0x3cadb3[_0x6923('0x4a')]['id']){delete _0x3cadb3[_0x6923('0x4a')]['id'];}return db[_0x6923('0x29')][_0x6923('0x47')]({'where':{'id':_0x3cadb3['params']['id']}})[_0x6923('0x23')](handleEntityNotFound(_0x4c829b,null))[_0x6923('0x23')](saveUpdates(_0x3cadb3['body'],null))['then'](respondWithResult(_0x4c829b,null))[_0x6923('0x48')](handleError(_0x4c829b,null));};exports[_0x6923('0x4b')]=function(_0x1685b6,_0x44ece5){return db[_0x6923('0x29')][_0x6923('0x47')]({'where':{'id':_0x1685b6[_0x6923('0x45')]['id']}})[_0x6923('0x23')](handleEntityNotFound(_0x44ece5,null))[_0x6923('0x23')](removeEntity(_0x44ece5,null))['catch'](handleError(_0x44ece5,null));}; \ No newline at end of file +var _0xa054=['crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','count','offset','limit','set','apply','reject','update','then','end','error','stack','name','send','index','map','MailServerOut','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','includeAll','include','findAll','catch','show','params','options','create','body','find','html-pdf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','lodash'];(function(_0x533156,_0x4488ba){var _0x5cd5f9=function(_0x13e8fd){while(--_0x13e8fd){_0x533156['push'](_0x533156['shift']());}};_0x5cd5f9(++_0x4488ba);}(_0xa054,0x106));var _0x4a05=function(_0x33bc64,_0x4d1e92){_0x33bc64=_0x33bc64-0x0;var _0x3fdd34=_0xa054[_0x33bc64];return _0x3fdd34;};'use strict';var pdf=require(_0x4a05('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4a05('0x1'));var jsonpatch=require(_0x4a05('0x2'));var rp=require(_0x4a05('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x4a05('0x4'));var path=require(_0x4a05('0x5'));var sox=require(_0x4a05('0x6'));var csv=require(_0x4a05('0x7'));var ejs=require(_0x4a05('0x8'));var fs=require('fs');var _=require(_0x4a05('0x9'));var squel=require('squel');var crypto=require(_0x4a05('0xa'));var jsforce=require(_0x4a05('0xb'));var deskjs=require(_0x4a05('0xc'));var toCsv=require(_0x4a05('0x7'));var querystring=require('querystring');var Papa=require(_0x4a05('0xd'));var Redis=require(_0x4a05('0xe'));var authService=require(_0x4a05('0xf'));var qs=require(_0x4a05('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4a05('0x11'));var logger=require('../../config/logger')(_0x4a05('0x12'));var utils=require(_0x4a05('0x13'));var config=require('../../config/environment');var db=require(_0x4a05('0x14'))['db'];function respondWithStatusCode(_0x2ddb47,_0x1b318f){_0x1b318f=_0x1b318f||0xcc;return function(_0x1d30f0){if(_0x1d30f0){return _0x2ddb47[_0x4a05('0x15')](_0x1b318f);}return _0x2ddb47[_0x4a05('0x16')](_0x1b318f)['end']();};}function respondWithResult(_0x3d3d53,_0x54c209){_0x54c209=_0x54c209||0xc8;return function(_0x2e1530){if(_0x2e1530){return _0x3d3d53[_0x4a05('0x16')](_0x54c209)['json'](_0x2e1530);}};}function respondWithFilteredResult(_0x1c9e08,_0x5b0d93){return function(_0x1771f3){if(_0x1771f3){var _0x26283c=_0x1771f3[_0x4a05('0x17')],_0x2d99fa=_0x5b0d93['offset'],_0x2eb989=_0x5b0d93[_0x4a05('0x18')]+_0x5b0d93[_0x4a05('0x19')],_0x15f697;if(_0x2eb989>=_0x26283c){_0x2eb989=_0x26283c;_0x15f697=0xc8;}else{_0x15f697=0xce;}_0x1c9e08[_0x4a05('0x16')](_0x15f697);return _0x1c9e08[_0x4a05('0x1a')]('Content-Range',_0x2d99fa+'-'+_0x2eb989+'/'+_0x26283c)['json'](_0x1771f3);}return null;};}function patchUpdates(_0x59d5dd){return function(_0x41b71d){try{jsonpatch[_0x4a05('0x1b')](_0x41b71d,_0x59d5dd,!![]);}catch(_0x14abfc){return BPromise[_0x4a05('0x1c')](_0x14abfc);}return _0x41b71d['save']();};}function saveUpdates(_0x2811c7,_0x59ebe1){return function(_0x44123c){if(_0x44123c){return _0x44123c[_0x4a05('0x1d')](_0x2811c7)[_0x4a05('0x1e')](function(_0x65e0bc){return _0x65e0bc;});}return null;};}function removeEntity(_0x1ddfcd,_0x477cc1){return function(_0x414dc6){if(_0x414dc6){return _0x414dc6['destroy']()['then'](function(){_0x1ddfcd[_0x4a05('0x16')](0xcc)[_0x4a05('0x1f')]();});}};}function handleEntityNotFound(_0xb972a4,_0x45c115){return function(_0x102173){if(!_0x102173){_0xb972a4[_0x4a05('0x15')](0x194);}return _0x102173;};}function handleError(_0x2232a4,_0x162cd3){_0x162cd3=_0x162cd3||0x1f4;return function(_0x40183c){logger[_0x4a05('0x20')](_0x40183c[_0x4a05('0x21')]);if(_0x40183c[_0x4a05('0x22')]){delete _0x40183c[_0x4a05('0x22')];}_0x2232a4[_0x4a05('0x16')](_0x162cd3)[_0x4a05('0x23')](_0x40183c);};}exports[_0x4a05('0x24')]=function(_0x36ea5c,_0x49f69b){var _0x153f03={},_0x28a6d6={},_0x119577={'count':0x0,'rows':[]};var _0x279ffe=_[_0x4a05('0x25')](db[_0x4a05('0x26')][_0x4a05('0x27')],function(_0x3bb47e){return{'name':_0x3bb47e[_0x4a05('0x28')],'type':_0x3bb47e[_0x4a05('0x29')]['key']};});_0x28a6d6[_0x4a05('0x2a')]=_[_0x4a05('0x25')](_0x279ffe,_0x4a05('0x22'));_0x28a6d6[_0x4a05('0x2b')]=_[_0x4a05('0x2c')](_0x36ea5c[_0x4a05('0x2b')]);_0x28a6d6[_0x4a05('0x2d')]=_['intersection'](_0x28a6d6['model'],_0x28a6d6['query']);_0x153f03[_0x4a05('0x2e')]=_[_0x4a05('0x2f')](_0x28a6d6[_0x4a05('0x2a')],qs[_0x4a05('0x30')](_0x36ea5c['query'][_0x4a05('0x30')]));_0x153f03['attributes']=_0x153f03['attributes'][_0x4a05('0x31')]?_0x153f03['attributes']:_0x28a6d6['model'];if(!_0x36ea5c[_0x4a05('0x2b')][_0x4a05('0x32')](_0x4a05('0x33'))){_0x153f03[_0x4a05('0x19')]=qs['limit'](_0x36ea5c[_0x4a05('0x2b')][_0x4a05('0x19')]);_0x153f03[_0x4a05('0x18')]=qs[_0x4a05('0x18')](_0x36ea5c['query'][_0x4a05('0x18')]);}_0x153f03[_0x4a05('0x34')]=qs['sort'](_0x36ea5c[_0x4a05('0x2b')][_0x4a05('0x35')]);_0x153f03[_0x4a05('0x36')]=qs[_0x4a05('0x2d')](_[_0x4a05('0x37')](_0x36ea5c[_0x4a05('0x2b')],_0x28a6d6[_0x4a05('0x2d')]));if(_0x36ea5c[_0x4a05('0x2b')]['filter']){_0x153f03[_0x4a05('0x36')]=_['merge'](_0x153f03[_0x4a05('0x36')],{'$or':_[_0x4a05('0x25')](_0x279ffe,function(_0x3b5c2a){if(_0x3b5c2a[_0x4a05('0x29')]!=='VIRTUAL'){var _0x5c8add={};_0x5c8add[_0x3b5c2a[_0x4a05('0x22')]]={'$like':'%'+_0x36ea5c['query'][_0x4a05('0x38')]+'%'};return _0x5c8add;}})});}_0x153f03=_[_0x4a05('0x39')]({},_0x153f03,_0x36ea5c['options']);var _0x1c305f={'where':_0x153f03[_0x4a05('0x36')]};return db[_0x4a05('0x26')][_0x4a05('0x17')](_0x1c305f)[_0x4a05('0x1e')](function(_0x25b254){_0x119577[_0x4a05('0x17')]=_0x25b254;if(_0x36ea5c[_0x4a05('0x2b')][_0x4a05('0x3a')]){_0x153f03[_0x4a05('0x3b')]=[{'all':!![]}];}return db['MailServerOut'][_0x4a05('0x3c')](_0x153f03);})['then'](function(_0x311472){_0x119577['rows']=_0x311472;return _0x119577;})['then'](respondWithFilteredResult(_0x49f69b,_0x153f03))[_0x4a05('0x3d')](handleError(_0x49f69b,null));};exports[_0x4a05('0x3e')]=function(_0x3ed36f,_0x3b66a7){var _0x4f5107={'raw':!![],'where':{'id':_0x3ed36f[_0x4a05('0x3f')]['id']}},_0x2a33e7={};_0x2a33e7['model']=_[_0x4a05('0x2c')](db['MailServerOut']['rawAttributes']);_0x2a33e7[_0x4a05('0x2b')]=_[_0x4a05('0x2c')](_0x3ed36f['query']);_0x2a33e7[_0x4a05('0x2d')]=_[_0x4a05('0x2f')](_0x2a33e7[_0x4a05('0x2a')],_0x2a33e7[_0x4a05('0x2b')]);_0x4f5107['attributes']=_[_0x4a05('0x2f')](_0x2a33e7[_0x4a05('0x2a')],qs['fields'](_0x3ed36f[_0x4a05('0x2b')][_0x4a05('0x30')]));_0x4f5107[_0x4a05('0x2e')]=_0x4f5107['attributes']['length']?_0x4f5107[_0x4a05('0x2e')]:_0x2a33e7['model'];if(_0x3ed36f[_0x4a05('0x2b')][_0x4a05('0x3a')]){_0x4f5107['include']=[{'all':!![]}];}_0x4f5107=_[_0x4a05('0x39')]({},_0x4f5107,_0x3ed36f[_0x4a05('0x40')]);return db[_0x4a05('0x26')]['find'](_0x4f5107)[_0x4a05('0x1e')](handleEntityNotFound(_0x3b66a7,null))['then'](respondWithResult(_0x3b66a7,null))['catch'](handleError(_0x3b66a7,null));};exports[_0x4a05('0x41')]=function(_0x314df9,_0x205f33){return db[_0x4a05('0x26')][_0x4a05('0x41')](_0x314df9[_0x4a05('0x42')],{})[_0x4a05('0x1e')](respondWithResult(_0x205f33,0xc9))[_0x4a05('0x3d')](handleError(_0x205f33,null));};exports[_0x4a05('0x1d')]=function(_0x4569d3,_0x5d6d32){if(_0x4569d3['body']['id']){delete _0x4569d3[_0x4a05('0x42')]['id'];}return db[_0x4a05('0x26')][_0x4a05('0x43')]({'where':{'id':_0x4569d3[_0x4a05('0x3f')]['id']}})[_0x4a05('0x1e')](handleEntityNotFound(_0x5d6d32,null))['then'](saveUpdates(_0x4569d3[_0x4a05('0x42')],null))['then'](respondWithResult(_0x5d6d32,null))[_0x4a05('0x3d')](handleError(_0x5d6d32,null));};exports['destroy']=function(_0x46aac8,_0x5ce860){return db[_0x4a05('0x26')]['find']({'where':{'id':_0x46aac8[_0x4a05('0x3f')]['id']}})[_0x4a05('0x1e')](handleEntityNotFound(_0x5ce860,null))[_0x4a05('0x1e')](removeEntity(_0x5ce860,null))[_0x4a05('0x3d')](handleError(_0x5ce860,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index 6042d63..75a6cbf 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 _0x24ca=['MailServerOut','mail_servers_out','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./mailServerOut.attributes','exports','define'];(function(_0x5e97c6,_0x288f15){var _0x298d3c=function(_0x36ac9e){while(--_0x36ac9e){_0x5e97c6['push'](_0x5e97c6['shift']());}};_0x298d3c(++_0x288f15);}(_0x24ca,0x1bc));var _0xa24c=function(_0x16aaef,_0x410651){_0x16aaef=_0x16aaef-0x0;var _0x1c82ef=_0x24ca[_0x16aaef];return _0x1c82ef;};'use strict';var _=require(_0xa24c('0x0'));var util=require('util');var logger=require(_0xa24c('0x1'))(_0xa24c('0x2'));var moment=require(_0xa24c('0x3'));var BPromise=require('bluebird');var rp=require(_0xa24c('0x4'));var fs=require('fs');var path=require(_0xa24c('0x5'));var rimraf=require(_0xa24c('0x6'));var config=require(_0xa24c('0x7'));var attributes=require(_0xa24c('0x8'));module[_0xa24c('0x9')]=function(_0xf0511,_0x3c0aaa){return _0xf0511[_0xa24c('0xa')](_0xa24c('0xb'),attributes,{'tableName':_0xa24c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x31f0=['./mailServerOut.attributes','define','mail_servers_out','lodash','../../config/logger','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x380d69,_0xf6f596){var _0x6a9617=function(_0x179007){while(--_0x179007){_0x380d69['push'](_0x380d69['shift']());}};_0x6a9617(++_0xf6f596);}(_0x31f0,0xb7));var _0x031f=function(_0x199288,_0x2cbd8e){_0x199288=_0x199288-0x0;var _0x3a1415=_0x31f0[_0x199288];return _0x3a1415;};'use strict';var _=require(_0x031f('0x0'));var util=require('util');var logger=require(_0x031f('0x1'))('api');var moment=require(_0x031f('0x2'));var BPromise=require(_0x031f('0x3'));var rp=require(_0x031f('0x4'));var fs=require('fs');var path=require(_0x031f('0x5'));var rimraf=require('rimraf');var config=require(_0x031f('0x6'));var attributes=require(_0x031f('0x7'));module['exports']=function(_0x4c0f94,_0x56328c){return _0x4c0f94[_0x031f('0x8')]('MailServerOut',attributes,{'tableName':_0x031f('0x9'),'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 ba2c688..02b5bf7 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 _0xf4fd=['message','result','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','request\x20sent','debug','stringify','error','MailServerOut,\x20%s,\x20%s'];(function(_0xd2d54,_0x5329f7){var _0x78b113=function(_0x7d2b29){while(--_0x7d2b29){_0xd2d54['push'](_0xd2d54['shift']());}};_0x78b113(++_0x5329f7);}(_0xf4fd,0xa2));var _0xdf4f=function(_0x1f5879,_0x2b34c1){_0x1f5879=_0x1f5879-0x0;var _0xf93552=_0xf4fd[_0x1f5879];return _0xf93552;};'use strict';var _=require('lodash');var util=require(_0xdf4f('0x0'));var moment=require(_0xdf4f('0x1'));var BPromise=require(_0xdf4f('0x2'));var rs=require(_0xdf4f('0x3'));var fs=require('fs');var Redis=require(_0xdf4f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xdf4f('0x5'));var logger=require(_0xdf4f('0x6'))(_0xdf4f('0x7'));var config=require('../../config/environment');var jayson=require(_0xdf4f('0x8'));var client=jayson[_0xdf4f('0x9')][_0xdf4f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4e1eba,_0x464236,_0x10675d){return new BPromise(function(_0x4c3f6c,_0x1872b7){return client['request'](_0x4e1eba,_0x10675d)[_0xdf4f('0xb')](function(_0x2a2a47){logger[_0xdf4f('0xc')]('MailServerOut,\x20%s,\x20%s',_0x464236,_0xdf4f('0xd'));logger[_0xdf4f('0xe')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x464236,_0xdf4f('0xd'),JSON[_0xdf4f('0xf')](_0x2a2a47));if(_0x2a2a47['error']){if(_0x2a2a47[_0xdf4f('0x10')]['code']===0x1f4){logger['error'](_0xdf4f('0x11'),_0x464236,_0x2a2a47[_0xdf4f('0x10')]['message']);return _0x1872b7(_0x2a2a47['error']['message']);}logger[_0xdf4f('0x10')](_0xdf4f('0x11'),_0x464236,_0x2a2a47['error']['message']);return _0x4c3f6c(_0x2a2a47['error'][_0xdf4f('0x12')]);}else{logger[_0xdf4f('0xc')]('MailServerOut,\x20%s,\x20%s',_0x464236,_0xdf4f('0xd'));_0x4c3f6c(_0x2a2a47[_0xdf4f('0x13')][_0xdf4f('0x12')]);}})['catch'](function(_0x5e8e45){logger[_0xdf4f('0x10')](_0xdf4f('0x11'),_0x464236,_0x5e8e45);_0x1872b7(_0x5e8e45);});});} \ No newline at end of file +var _0xe684=['info','request\x20sent','debug','MailServerOut,\x20%s,\x20%s,\x20%s','error','MailServerOut,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x5d03f6,_0xd8835f){var _0x13b2cd=function(_0x8d8277){while(--_0x8d8277){_0x5d03f6['push'](_0x5d03f6['shift']());}};_0x13b2cd(++_0xd8835f);}(_0xe684,0x99));var _0x4e68=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xe684[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x4e68('0x0'));var util=require(_0x4e68('0x1'));var moment=require(_0x4e68('0x2'));var BPromise=require('bluebird');var rs=require(_0x4e68('0x3'));var fs=require('fs');var Redis=require(_0x4e68('0x4'));var db=require(_0x4e68('0x5'))['db'];var utils=require(_0x4e68('0x6'));var logger=require(_0x4e68('0x7'))(_0x4e68('0x8'));var config=require(_0x4e68('0x9'));var jayson=require(_0x4e68('0xa'));var client=jayson[_0x4e68('0xb')][_0x4e68('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xa3b5e1,_0x595747,_0x2df10f){return new BPromise(function(_0x552230,_0x2b0214){return client[_0x4e68('0xd')](_0xa3b5e1,_0x2df10f)[_0x4e68('0xe')](function(_0x248152){logger[_0x4e68('0xf')]('MailServerOut,\x20%s,\x20%s',_0x595747,_0x4e68('0x10'));logger[_0x4e68('0x11')](_0x4e68('0x12'),_0x595747,_0x4e68('0x10'),JSON['stringify'](_0x248152));if(_0x248152[_0x4e68('0x13')]){if(_0x248152['error']['code']===0x1f4){logger[_0x4e68('0x13')](_0x4e68('0x14'),_0x595747,_0x248152['error']['message']);return _0x2b0214(_0x248152[_0x4e68('0x13')][_0x4e68('0x15')]);}logger[_0x4e68('0x13')](_0x4e68('0x14'),_0x595747,_0x248152[_0x4e68('0x13')][_0x4e68('0x15')]);return _0x552230(_0x248152['error']['message']);}else{logger[_0x4e68('0xf')]('MailServerOut,\x20%s,\x20%s',_0x595747,_0x4e68('0x10'));_0x552230(_0x248152[_0x4e68('0x16')][_0x4e68('0x15')]);}})[_0x4e68('0x17')](function(_0xb21e8e){logger[_0x4e68('0x13')](_0x4e68('0x14'),_0x595747,_0xb21e8e);_0x2b0214(_0xb21e8e);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index 5a0566f..afc94a6 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 _0xf3c6=['connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create','put','update','delete','destroy','exports','multer','util','path'];(function(_0x29f324,_0x194384){var _0x502d6d=function(_0x171e3d){while(--_0x171e3d){_0x29f324['push'](_0x29f324['shift']());}};_0x502d6d(++_0x194384);}(_0xf3c6,0xc3));var _0x6f3c=function(_0x1783d6,_0xb976f1){_0x1783d6=_0x1783d6-0x0;var _0x326ad6=_0xf3c6[_0x1783d6];return _0x326ad6;};'use strict';var multer=require(_0x6f3c('0x0'));var util=require(_0x6f3c('0x1'));var path=require(_0x6f3c('0x2'));var timeout=require(_0x6f3c('0x3'));var express=require(_0x6f3c('0x4'));var router=express['Router']();var auth=require(_0x6f3c('0x5'));var interaction=require(_0x6f3c('0x6'));var config=require(_0x6f3c('0x7'));var controller=require(_0x6f3c('0x8'));router[_0x6f3c('0x9')]('/',auth[_0x6f3c('0xa')](),controller[_0x6f3c('0xb')]);router['get'](_0x6f3c('0xc'),auth[_0x6f3c('0xa')](),controller[_0x6f3c('0xd')]);router[_0x6f3c('0x9')](_0x6f3c('0xe'),auth[_0x6f3c('0xa')](),controller['show']);router[_0x6f3c('0xf')]('/',auth['isAuthenticated'](),controller[_0x6f3c('0x10')]);router[_0x6f3c('0x11')]('/:id',auth[_0x6f3c('0xa')](),controller[_0x6f3c('0x12')]);router[_0x6f3c('0x13')](_0x6f3c('0xe'),auth[_0x6f3c('0xa')](),controller[_0x6f3c('0x14')]);module[_0x6f3c('0x15')]=router; \ No newline at end of file +var _0xd32c=['isAuthenticated','index','describe','get','/:id','show','post','create','put','delete','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller'];(function(_0x3e9097,_0x488f2e){var _0x37bfb8=function(_0x210f29){while(--_0x210f29){_0x3e9097['push'](_0x3e9097['shift']());}};_0x37bfb8(++_0x488f2e);}(_0xd32c,0x64));var _0xcd32=function(_0x2d36a6,_0x2f8cd0){_0x2d36a6=_0x2d36a6-0x0;var _0x59cec0=_0xd32c[_0x2d36a6];return _0x59cec0;};'use strict';var multer=require(_0xcd32('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xcd32('0x1'));var express=require(_0xcd32('0x2'));var router=express[_0xcd32('0x3')]();var auth=require(_0xcd32('0x4'));var interaction=require(_0xcd32('0x5'));var config=require(_0xcd32('0x6'));var controller=require(_0xcd32('0x7'));router['get']('/',auth[_0xcd32('0x8')](),controller[_0xcd32('0x9')]);router['get']('/describe',auth[_0xcd32('0x8')](),controller[_0xcd32('0xa')]);router[_0xcd32('0xb')](_0xcd32('0xc'),auth[_0xcd32('0x8')](),controller[_0xcd32('0xd')]);router[_0xcd32('0xe')]('/',auth[_0xcd32('0x8')](),controller[_0xcd32('0xf')]);router[_0xcd32('0x10')]('/:id',auth[_0xcd32('0x8')](),controller['update']);router[_0xcd32('0x11')](_0xcd32('0xc'),auth[_0xcd32('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index 4d52a23..41932b2 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 _0x4a03=['exports','STRING','name'];(function(_0x9729d7,_0x1b79a8){var _0x3c4ac6=function(_0x401ba6){while(--_0x401ba6){_0x9729d7['push'](_0x9729d7['shift']());}};_0x3c4ac6(++_0x1b79a8);}(_0x4a03,0x16e));var _0x34a0=function(_0x1bee34,_0x5b2e47){_0x1bee34=_0x1bee34-0x0;var _0x4fb2ce=_0x4a03[_0x1bee34];return _0x4fb2ce;};'use strict';var Sequelize=require('sequelize');module[_0x34a0('0x0')]={'name':{'type':Sequelize[_0x34a0('0x1')],'unique':_0x34a0('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x761c=['name','sequelize','STRING'];(function(_0x52b17d,_0x26c3be){var _0x59d959=function(_0x5c3cde){while(--_0x5c3cde){_0x52b17d['push'](_0x52b17d['shift']());}};_0x59d959(++_0x26c3be);}(_0x761c,0x18a));var _0xc761=function(_0x492099,_0x31229f){_0x492099=_0x492099-0x0;var _0x2bf394=_0x761c[_0x492099];return _0x2bf394;};'use strict';var Sequelize=require(_0xc761('0x0'));module['exports']={'name':{'type':Sequelize[_0xc761('0x1')],'unique':_0xc761('0x2'),'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 226a61c..d6d5c72 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 _0xe3da=['order','sort','pick','filter','where','merge','options','includeAll','include','rows','catch','show','create','body','find','params','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','set','apply','reject','update','then','destroy','error','stack','name','send','index','map','MailSubstatus','rawAttributes','type','key','query','keys','filters','attributes','intersection','model','fields','length','nolimit'];(function(_0x2e4136,_0x3eca4c){var _0x5e7d84=function(_0x245756){while(--_0x245756){_0x2e4136['push'](_0x2e4136['shift']());}};_0x5e7d84(++_0x3eca4c);}(_0xe3da,0x1cd));var _0xae3d=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xe3da[_0x57b54c];return _0x59cc19;};'use strict';var pdf=require(_0xae3d('0x0'));var emlformat=require(_0xae3d('0x1'));var rimraf=require(_0xae3d('0x2'));var zipdir=require(_0xae3d('0x3'));var jsonpatch=require(_0xae3d('0x4'));var rp=require(_0xae3d('0x5'));var moment=require(_0xae3d('0x6'));var BPromise=require(_0xae3d('0x7'));var Mustache=require(_0xae3d('0x8'));var util=require(_0xae3d('0x9'));var path=require(_0xae3d('0xa'));var sox=require(_0xae3d('0xb'));var csv=require(_0xae3d('0xc'));var ejs=require(_0xae3d('0xd'));var fs=require('fs');var _=require(_0xae3d('0xe'));var squel=require(_0xae3d('0xf'));var crypto=require('crypto');var jsforce=require(_0xae3d('0x10'));var deskjs=require(_0xae3d('0x11'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xae3d('0x12'));var Redis=require(_0xae3d('0x13'));var authService=require(_0xae3d('0x14'));var qs=require(_0xae3d('0x15'));var as=require(_0xae3d('0x16'));var hardwareService=require(_0xae3d('0x17'));var logger=require('../../config/logger')(_0xae3d('0x18'));var utils=require('../../config/utils');var config=require(_0xae3d('0x19'));var db=require(_0xae3d('0x1a'))['db'];function respondWithStatusCode(_0x7770eb,_0x172f7a){_0x172f7a=_0x172f7a||0xcc;return function(_0x48aa74){if(_0x48aa74){return _0x7770eb[_0xae3d('0x1b')](_0x172f7a);}return _0x7770eb[_0xae3d('0x1c')](_0x172f7a)[_0xae3d('0x1d')]();};}function respondWithResult(_0x1605ac,_0x2afdd3){_0x2afdd3=_0x2afdd3||0xc8;return function(_0x430659){if(_0x430659){return _0x1605ac[_0xae3d('0x1c')](_0x2afdd3)['json'](_0x430659);}};}function respondWithFilteredResult(_0x1fb7a9,_0x42f4b4){return function(_0x46295b){if(_0x46295b){var _0x230afb=_0x46295b[_0xae3d('0x1e')],_0x192c13=_0x42f4b4[_0xae3d('0x1f')],_0x2da957=_0x42f4b4[_0xae3d('0x1f')]+_0x42f4b4['limit'],_0x585160;if(_0x2da957>=_0x230afb){_0x2da957=_0x230afb;_0x585160=0xc8;}else{_0x585160=0xce;}_0x1fb7a9[_0xae3d('0x1c')](_0x585160);return _0x1fb7a9[_0xae3d('0x20')]('Content-Range',_0x192c13+'-'+_0x2da957+'/'+_0x230afb)['json'](_0x46295b);}return null;};}function patchUpdates(_0x8a37cc){return function(_0x46a6d7){try{jsonpatch[_0xae3d('0x21')](_0x46a6d7,_0x8a37cc,!![]);}catch(_0x377546){return BPromise[_0xae3d('0x22')](_0x377546);}return _0x46a6d7['save']();};}function saveUpdates(_0x121024,_0x48f00e){return function(_0x4a09c2){if(_0x4a09c2){return _0x4a09c2[_0xae3d('0x23')](_0x121024)[_0xae3d('0x24')](function(_0x263b0e){return _0x263b0e;});}return null;};}function removeEntity(_0x1facc1,_0x3e7afc){return function(_0x26c419){if(_0x26c419){return _0x26c419[_0xae3d('0x25')]()[_0xae3d('0x24')](function(){_0x1facc1[_0xae3d('0x1c')](0xcc)[_0xae3d('0x1d')]();});}};}function handleEntityNotFound(_0x9bf34a,_0x37f5ff){return function(_0x1b2acb){if(!_0x1b2acb){_0x9bf34a[_0xae3d('0x1b')](0x194);}return _0x1b2acb;};}function handleError(_0x1fe90f,_0xfb54f6){_0xfb54f6=_0xfb54f6||0x1f4;return function(_0x21b608){logger[_0xae3d('0x26')](_0x21b608[_0xae3d('0x27')]);if(_0x21b608['name']){delete _0x21b608[_0xae3d('0x28')];}_0x1fe90f[_0xae3d('0x1c')](_0xfb54f6)[_0xae3d('0x29')](_0x21b608);};}exports[_0xae3d('0x2a')]=function(_0x256bd0,_0x4391db){var _0x8de288={},_0x54c1e1={},_0x57864e={'count':0x0,'rows':[]};var _0x12e3a5=_[_0xae3d('0x2b')](db[_0xae3d('0x2c')][_0xae3d('0x2d')],function(_0xb69ec9){return{'name':_0xb69ec9['fieldName'],'type':_0xb69ec9[_0xae3d('0x2e')][_0xae3d('0x2f')]};});_0x54c1e1['model']=_[_0xae3d('0x2b')](_0x12e3a5,_0xae3d('0x28'));_0x54c1e1[_0xae3d('0x30')]=_[_0xae3d('0x31')](_0x256bd0[_0xae3d('0x30')]);_0x54c1e1[_0xae3d('0x32')]=_['intersection'](_0x54c1e1['model'],_0x54c1e1['query']);_0x8de288[_0xae3d('0x33')]=_[_0xae3d('0x34')](_0x54c1e1[_0xae3d('0x35')],qs[_0xae3d('0x36')](_0x256bd0['query'][_0xae3d('0x36')]));_0x8de288[_0xae3d('0x33')]=_0x8de288[_0xae3d('0x33')][_0xae3d('0x37')]?_0x8de288[_0xae3d('0x33')]:_0x54c1e1[_0xae3d('0x35')];if(!_0x256bd0[_0xae3d('0x30')]['hasOwnProperty'](_0xae3d('0x38'))){_0x8de288['limit']=qs['limit'](_0x256bd0[_0xae3d('0x30')]['limit']);_0x8de288[_0xae3d('0x1f')]=qs['offset'](_0x256bd0['query'][_0xae3d('0x1f')]);}_0x8de288[_0xae3d('0x39')]=qs[_0xae3d('0x3a')](_0x256bd0['query'][_0xae3d('0x3a')]);_0x8de288['where']=qs[_0xae3d('0x32')](_[_0xae3d('0x3b')](_0x256bd0[_0xae3d('0x30')],_0x54c1e1[_0xae3d('0x32')]));if(_0x256bd0[_0xae3d('0x30')][_0xae3d('0x3c')]){_0x8de288[_0xae3d('0x3d')]=_[_0xae3d('0x3e')](_0x8de288[_0xae3d('0x3d')],{'$or':_[_0xae3d('0x2b')](_0x12e3a5,function(_0x18855c){if(_0x18855c['type']!=='VIRTUAL'){var _0x3992eb={};_0x3992eb[_0x18855c['name']]={'$like':'%'+_0x256bd0[_0xae3d('0x30')][_0xae3d('0x3c')]+'%'};return _0x3992eb;}})});}_0x8de288=_[_0xae3d('0x3e')]({},_0x8de288,_0x256bd0[_0xae3d('0x3f')]);var _0x2c2892={'where':_0x8de288[_0xae3d('0x3d')]};return db[_0xae3d('0x2c')][_0xae3d('0x1e')](_0x2c2892)[_0xae3d('0x24')](function(_0xd8cd66){_0x57864e[_0xae3d('0x1e')]=_0xd8cd66;if(_0x256bd0['query'][_0xae3d('0x40')]){_0x8de288[_0xae3d('0x41')]=[{'all':!![]}];}return db[_0xae3d('0x2c')]['findAll'](_0x8de288);})['then'](function(_0x99184f){_0x57864e[_0xae3d('0x42')]=_0x99184f;return _0x57864e;})['then'](respondWithFilteredResult(_0x4391db,_0x8de288))[_0xae3d('0x43')](handleError(_0x4391db,null));};exports[_0xae3d('0x44')]=function(_0xf2fb60,_0x1786a9){var _0x436a04={'raw':!![],'where':{'id':_0xf2fb60['params']['id']}},_0x1a483a={};_0x1a483a[_0xae3d('0x35')]=_[_0xae3d('0x31')](db[_0xae3d('0x2c')][_0xae3d('0x2d')]);_0x1a483a[_0xae3d('0x30')]=_['keys'](_0xf2fb60[_0xae3d('0x30')]);_0x1a483a['filters']=_[_0xae3d('0x34')](_0x1a483a[_0xae3d('0x35')],_0x1a483a[_0xae3d('0x30')]);_0x436a04[_0xae3d('0x33')]=_['intersection'](_0x1a483a['model'],qs['fields'](_0xf2fb60[_0xae3d('0x30')][_0xae3d('0x36')]));_0x436a04['attributes']=_0x436a04['attributes']['length']?_0x436a04[_0xae3d('0x33')]:_0x1a483a[_0xae3d('0x35')];if(_0xf2fb60[_0xae3d('0x30')][_0xae3d('0x40')]){_0x436a04[_0xae3d('0x41')]=[{'all':!![]}];}_0x436a04=_[_0xae3d('0x3e')]({},_0x436a04,_0xf2fb60[_0xae3d('0x3f')]);return db['MailSubstatus']['find'](_0x436a04)['then'](handleEntityNotFound(_0x1786a9,null))[_0xae3d('0x24')](respondWithResult(_0x1786a9,null))['catch'](handleError(_0x1786a9,null));};exports[_0xae3d('0x45')]=function(_0x14fad3,_0x41cb63){return db[_0xae3d('0x2c')][_0xae3d('0x45')](_0x14fad3[_0xae3d('0x46')],{})[_0xae3d('0x24')](respondWithResult(_0x41cb63,0xc9))[_0xae3d('0x43')](handleError(_0x41cb63,null));};exports[_0xae3d('0x23')]=function(_0x4ed0f9,_0x49b8df){if(_0x4ed0f9['body']['id']){delete _0x4ed0f9['body']['id'];}return db['MailSubstatus'][_0xae3d('0x47')]({'where':{'id':_0x4ed0f9[_0xae3d('0x48')]['id']}})[_0xae3d('0x24')](handleEntityNotFound(_0x49b8df,null))[_0xae3d('0x24')](saveUpdates(_0x4ed0f9['body'],null))['then'](respondWithResult(_0x49b8df,null))[_0xae3d('0x43')](handleError(_0x49b8df,null));};exports[_0xae3d('0x25')]=function(_0x3a7610,_0x247a37){return db['MailSubstatus'][_0xae3d('0x47')]({'where':{'id':_0x3a7610[_0xae3d('0x48')]['id']}})[_0xae3d('0x24')](handleEntityNotFound(_0x247a37,null))[_0xae3d('0x24')](removeEntity(_0x247a37,null))[_0xae3d('0x43')](handleError(_0x247a37,null));};exports[_0xae3d('0x49')]=function(_0x3e30ea,_0x291c7d){return db[_0xae3d('0x2c')][_0xae3d('0x49')]()[_0xae3d('0x24')](respondWithResult(_0x291c7d,null))[_0xae3d('0x43')](handleError(_0x291c7d,null));}; \ No newline at end of file +var _0x8958=['include','findAll','catch','length','options','find','create','body','params','destroy','describe','eml-format','moment','mustache','util','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','count','offset','limit','set','Content-Range','json','apply','update','then','error','name','map','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','MailSubstatus','includeAll'];(function(_0x435238,_0x3b434f){var _0x34f5fa=function(_0x30ca6e){while(--_0x30ca6e){_0x435238['push'](_0x435238['shift']());}};_0x34f5fa(++_0x3b434f);}(_0x8958,0x93));var _0x8895=function(_0x2c55e8,_0x42b59a){_0x2c55e8=_0x2c55e8-0x0;var _0x2b10e2=_0x8958[_0x2c55e8];return _0x2b10e2;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x8895('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x8895('0x1'));var BPromise=require('bluebird');var Mustache=require(_0x8895('0x2'));var util=require(_0x8895('0x3'));var path=require(_0x8895('0x4'));var sox=require('sox');var csv=require(_0x8895('0x5'));var ejs=require(_0x8895('0x6'));var fs=require('fs');var _=require(_0x8895('0x7'));var squel=require(_0x8895('0x8'));var crypto=require(_0x8895('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x8895('0xa'));var toCsv=require(_0x8895('0x5'));var querystring=require(_0x8895('0xb'));var Papa=require(_0x8895('0xc'));var Redis=require(_0x8895('0xd'));var authService=require(_0x8895('0xe'));var qs=require(_0x8895('0xf'));var as=require(_0x8895('0x10'));var hardwareService=require(_0x8895('0x11'));var logger=require(_0x8895('0x12'))('api');var utils=require(_0x8895('0x13'));var config=require(_0x8895('0x14'));var db=require(_0x8895('0x15'))['db'];function respondWithStatusCode(_0x301bec,_0x446e1a){_0x446e1a=_0x446e1a||0xcc;return function(_0xaf93bc){if(_0xaf93bc){return _0x301bec['sendStatus'](_0x446e1a);}return _0x301bec[_0x8895('0x16')](_0x446e1a)[_0x8895('0x17')]();};}function respondWithResult(_0x56c18e,_0x57d40a){_0x57d40a=_0x57d40a||0xc8;return function(_0x47b9fe){if(_0x47b9fe){return _0x56c18e[_0x8895('0x16')](_0x57d40a)['json'](_0x47b9fe);}};}function respondWithFilteredResult(_0x4156f5,_0x337101){return function(_0x195789){if(_0x195789){var _0x3d7b59=_0x195789[_0x8895('0x18')],_0x2c9d40=_0x337101[_0x8895('0x19')],_0x5b4c2e=_0x337101[_0x8895('0x19')]+_0x337101[_0x8895('0x1a')],_0x4128e2;if(_0x5b4c2e>=_0x3d7b59){_0x5b4c2e=_0x3d7b59;_0x4128e2=0xc8;}else{_0x4128e2=0xce;}_0x4156f5[_0x8895('0x16')](_0x4128e2);return _0x4156f5[_0x8895('0x1b')](_0x8895('0x1c'),_0x2c9d40+'-'+_0x5b4c2e+'/'+_0x3d7b59)[_0x8895('0x1d')](_0x195789);}return null;};}function patchUpdates(_0x2da618){return function(_0x24fef0){try{jsonpatch[_0x8895('0x1e')](_0x24fef0,_0x2da618,!![]);}catch(_0x2df795){return BPromise['reject'](_0x2df795);}return _0x24fef0['save']();};}function saveUpdates(_0x4fcbc3,_0x3daf43){return function(_0x456282){if(_0x456282){return _0x456282[_0x8895('0x1f')](_0x4fcbc3)[_0x8895('0x20')](function(_0x3f7d5a){return _0x3f7d5a;});}return null;};}function removeEntity(_0x35bda5,_0x461346){return function(_0xc1ce17){if(_0xc1ce17){return _0xc1ce17['destroy']()[_0x8895('0x20')](function(){_0x35bda5[_0x8895('0x16')](0xcc)[_0x8895('0x17')]();});}};}function handleEntityNotFound(_0x1f71f3,_0x29223d){return function(_0x4d092d){if(!_0x4d092d){_0x1f71f3['sendStatus'](0x194);}return _0x4d092d;};}function handleError(_0x278c81,_0x398382){_0x398382=_0x398382||0x1f4;return function(_0x38f7ad){logger[_0x8895('0x21')](_0x38f7ad['stack']);if(_0x38f7ad[_0x8895('0x22')]){delete _0x38f7ad[_0x8895('0x22')];}_0x278c81[_0x8895('0x16')](_0x398382)['send'](_0x38f7ad);};}exports['index']=function(_0x78b57,_0x555e60){var _0x3d51b0={},_0x3e3b48={},_0x10b48f={'count':0x0,'rows':[]};var _0xf5fb66=_[_0x8895('0x23')](db['MailSubstatus']['rawAttributes'],function(_0x6e449d){return{'name':_0x6e449d[_0x8895('0x24')],'type':_0x6e449d[_0x8895('0x25')][_0x8895('0x26')]};});_0x3e3b48[_0x8895('0x27')]=_['map'](_0xf5fb66,'name');_0x3e3b48[_0x8895('0x28')]=_[_0x8895('0x29')](_0x78b57[_0x8895('0x28')]);_0x3e3b48[_0x8895('0x2a')]=_[_0x8895('0x2b')](_0x3e3b48['model'],_0x3e3b48[_0x8895('0x28')]);_0x3d51b0['attributes']=_[_0x8895('0x2b')](_0x3e3b48['model'],qs[_0x8895('0x2c')](_0x78b57[_0x8895('0x28')][_0x8895('0x2c')]));_0x3d51b0[_0x8895('0x2d')]=_0x3d51b0[_0x8895('0x2d')]['length']?_0x3d51b0[_0x8895('0x2d')]:_0x3e3b48[_0x8895('0x27')];if(!_0x78b57[_0x8895('0x28')][_0x8895('0x2e')](_0x8895('0x2f'))){_0x3d51b0['limit']=qs[_0x8895('0x1a')](_0x78b57['query'][_0x8895('0x1a')]);_0x3d51b0['offset']=qs[_0x8895('0x19')](_0x78b57[_0x8895('0x28')][_0x8895('0x19')]);}_0x3d51b0[_0x8895('0x30')]=qs[_0x8895('0x31')](_0x78b57['query'][_0x8895('0x31')]);_0x3d51b0['where']=qs[_0x8895('0x2a')](_[_0x8895('0x32')](_0x78b57[_0x8895('0x28')],_0x3e3b48[_0x8895('0x2a')]));if(_0x78b57[_0x8895('0x28')][_0x8895('0x33')]){_0x3d51b0['where']=_[_0x8895('0x34')](_0x3d51b0[_0x8895('0x35')],{'$or':_['map'](_0xf5fb66,function(_0x2557fc){if(_0x2557fc['type']!==_0x8895('0x36')){var _0x332a79={};_0x332a79[_0x2557fc['name']]={'$like':'%'+_0x78b57[_0x8895('0x28')][_0x8895('0x33')]+'%'};return _0x332a79;}})});}_0x3d51b0=_['merge']({},_0x3d51b0,_0x78b57['options']);var _0x202130={'where':_0x3d51b0[_0x8895('0x35')]};return db[_0x8895('0x37')][_0x8895('0x18')](_0x202130)[_0x8895('0x20')](function(_0x4917d1){_0x10b48f[_0x8895('0x18')]=_0x4917d1;if(_0x78b57[_0x8895('0x28')][_0x8895('0x38')]){_0x3d51b0[_0x8895('0x39')]=[{'all':!![]}];}return db[_0x8895('0x37')][_0x8895('0x3a')](_0x3d51b0);})['then'](function(_0x174be1){_0x10b48f['rows']=_0x174be1;return _0x10b48f;})[_0x8895('0x20')](respondWithFilteredResult(_0x555e60,_0x3d51b0))[_0x8895('0x3b')](handleError(_0x555e60,null));};exports['show']=function(_0x1ca234,_0x4e8fbc){var _0x1e6395={'raw':!![],'where':{'id':_0x1ca234['params']['id']}},_0x5e6413={};_0x5e6413['model']=_['keys'](db['MailSubstatus']['rawAttributes']);_0x5e6413[_0x8895('0x28')]=_[_0x8895('0x29')](_0x1ca234['query']);_0x5e6413['filters']=_[_0x8895('0x2b')](_0x5e6413[_0x8895('0x27')],_0x5e6413['query']);_0x1e6395[_0x8895('0x2d')]=_[_0x8895('0x2b')](_0x5e6413[_0x8895('0x27')],qs[_0x8895('0x2c')](_0x1ca234[_0x8895('0x28')]['fields']));_0x1e6395['attributes']=_0x1e6395['attributes'][_0x8895('0x3c')]?_0x1e6395['attributes']:_0x5e6413[_0x8895('0x27')];if(_0x1ca234[_0x8895('0x28')][_0x8895('0x38')]){_0x1e6395[_0x8895('0x39')]=[{'all':!![]}];}_0x1e6395=_['merge']({},_0x1e6395,_0x1ca234[_0x8895('0x3d')]);return db[_0x8895('0x37')][_0x8895('0x3e')](_0x1e6395)[_0x8895('0x20')](handleEntityNotFound(_0x4e8fbc,null))[_0x8895('0x20')](respondWithResult(_0x4e8fbc,null))[_0x8895('0x3b')](handleError(_0x4e8fbc,null));};exports[_0x8895('0x3f')]=function(_0x34e91e,_0x55fb78){return db[_0x8895('0x37')][_0x8895('0x3f')](_0x34e91e['body'],{})[_0x8895('0x20')](respondWithResult(_0x55fb78,0xc9))['catch'](handleError(_0x55fb78,null));};exports['update']=function(_0x13546d,_0x337a9f){if(_0x13546d[_0x8895('0x40')]['id']){delete _0x13546d['body']['id'];}return db[_0x8895('0x37')]['find']({'where':{'id':_0x13546d[_0x8895('0x41')]['id']}})[_0x8895('0x20')](handleEntityNotFound(_0x337a9f,null))[_0x8895('0x20')](saveUpdates(_0x13546d[_0x8895('0x40')],null))[_0x8895('0x20')](respondWithResult(_0x337a9f,null))[_0x8895('0x3b')](handleError(_0x337a9f,null));};exports[_0x8895('0x42')]=function(_0x4dde7c,_0x47c4b9){return db[_0x8895('0x37')][_0x8895('0x3e')]({'where':{'id':_0x4dde7c['params']['id']}})[_0x8895('0x20')](handleEntityNotFound(_0x47c4b9,null))['then'](removeEntity(_0x47c4b9,null))['catch'](handleError(_0x47c4b9,null));};exports[_0x8895('0x43')]=function(_0x4d52ac,_0x130203){return db[_0x8895('0x37')][_0x8895('0x43')]()[_0x8895('0x20')](respondWithResult(_0x130203,null))[_0x8895('0x3b')](handleError(_0x130203,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index 7ccab62..9fa059e 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 _0x9805=['define','MailSubstatus','mail_substatuses','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment'];(function(_0x237da8,_0x37b77a){var _0x558825=function(_0x45d7f1){while(--_0x45d7f1){_0x237da8['push'](_0x237da8['shift']());}};_0x558825(++_0x37b77a);}(_0x9805,0x18f));var _0x5980=function(_0x400b64,_0x5eb1bf){_0x400b64=_0x400b64-0x0;var _0x1d615d=_0x9805[_0x400b64];return _0x1d615d;};'use strict';var _=require(_0x5980('0x0'));var util=require(_0x5980('0x1'));var logger=require(_0x5980('0x2'))(_0x5980('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x5980('0x4'));var fs=require('fs');var path=require(_0x5980('0x5'));var rimraf=require(_0x5980('0x6'));var config=require(_0x5980('0x7'));var attributes=require('./mailSubstatus.attributes');module['exports']=function(_0x1b1c8d,_0x255321){return _0x1b1c8d[_0x5980('0x8')](_0x5980('0x9'),attributes,{'tableName':_0x5980('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x896e=['request-promise','path','rimraf','../../config/environment','./mailSubstatus.attributes','exports','define','MailSubstatus','mail_substatuses','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x61971d,_0x23e57e){var _0x31549b=function(_0x5f54da){while(--_0x5f54da){_0x61971d['push'](_0x61971d['shift']());}};_0x31549b(++_0x23e57e);}(_0x896e,0x1e9));var _0xe896=function(_0x430480,_0x4c5bf9){_0x430480=_0x430480-0x0;var _0x4c922b=_0x896e[_0x430480];return _0x4c922b;};'use strict';var _=require(_0xe896('0x0'));var util=require(_0xe896('0x1'));var logger=require(_0xe896('0x2'))(_0xe896('0x3'));var moment=require(_0xe896('0x4'));var BPromise=require(_0xe896('0x5'));var rp=require(_0xe896('0x6'));var fs=require('fs');var path=require(_0xe896('0x7'));var rimraf=require(_0xe896('0x8'));var config=require(_0xe896('0x9'));var attributes=require(_0xe896('0xa'));module[_0xe896('0xb')]=function(_0x52ac80,_0x24c430){return _0x52ac80[_0xe896('0xc')](_0xe896('0xd'),attributes,{'tableName':_0xe896('0xe'),'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 03108c1..14b5e5d 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 _0x1339=['info','MailSubstatus,\x20%s,\x20%s','request\x20sent','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then'];(function(_0x351000,_0x22b335){var _0x1234d5=function(_0x2fc0ab){while(--_0x2fc0ab){_0x351000['push'](_0x351000['shift']());}};_0x1234d5(++_0x22b335);}(_0x1339,0x1ed));var _0x9133=function(_0x4e5e73,_0x812206){_0x4e5e73=_0x4e5e73-0x0;var _0x52ead4=_0x1339[_0x4e5e73];return _0x52ead4;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x9133('0x0'));var BPromise=require(_0x9133('0x1'));var rs=require(_0x9133('0x2'));var fs=require('fs');var Redis=require(_0x9133('0x3'));var db=require(_0x9133('0x4'))['db'];var utils=require(_0x9133('0x5'));var logger=require(_0x9133('0x6'))(_0x9133('0x7'));var config=require('../../config/environment');var jayson=require(_0x9133('0x8'));var client=jayson[_0x9133('0x9')][_0x9133('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x539af6,_0x2758e2,_0x334dcd){return new BPromise(function(_0x3059c4,_0x431a55){return client[_0x9133('0xb')](_0x539af6,_0x334dcd)[_0x9133('0xc')](function(_0x4294b7){logger[_0x9133('0xd')](_0x9133('0xe'),_0x2758e2,_0x9133('0xf'));logger['debug'](_0x9133('0x10'),_0x2758e2,_0x9133('0xf'),JSON[_0x9133('0x11')](_0x4294b7));if(_0x4294b7[_0x9133('0x12')]){if(_0x4294b7[_0x9133('0x12')][_0x9133('0x13')]===0x1f4){logger['error'](_0x9133('0xe'),_0x2758e2,_0x4294b7[_0x9133('0x12')]['message']);return _0x431a55(_0x4294b7['error'][_0x9133('0x14')]);}logger['error'](_0x9133('0xe'),_0x2758e2,_0x4294b7[_0x9133('0x12')][_0x9133('0x14')]);return _0x3059c4(_0x4294b7[_0x9133('0x12')][_0x9133('0x14')]);}else{logger[_0x9133('0xd')]('MailSubstatus,\x20%s,\x20%s',_0x2758e2,_0x9133('0xf'));_0x3059c4(_0x4294b7[_0x9133('0x15')]['message']);}})[_0x9133('0x16')](function(_0xa46eb1){logger[_0x9133('0x12')](_0x9133('0xe'),_0x2758e2,_0xa46eb1);_0x431a55(_0xa46eb1);});});} \ No newline at end of file +var _0x878f=['../../config/logger','rpc','../../config/environment','jayson/promise','request','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','MailSubstatus,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x26d579,_0x205cef){var _0x3e1cd4=function(_0x556b84){while(--_0x556b84){_0x26d579['push'](_0x26d579['shift']());}};_0x3e1cd4(++_0x205cef);}(_0x878f,0x173));var _0xf878=function(_0x400dd5,_0x413e2c){_0x400dd5=_0x400dd5-0x0;var _0x160cb6=_0x878f[_0x400dd5];return _0x160cb6;};'use strict';var _=require('lodash');var util=require(_0xf878('0x0'));var moment=require(_0xf878('0x1'));var BPromise=require(_0xf878('0x2'));var rs=require(_0xf878('0x3'));var fs=require('fs');var Redis=require(_0xf878('0x4'));var db=require(_0xf878('0x5'))['db'];var utils=require(_0xf878('0x6'));var logger=require(_0xf878('0x7'))(_0xf878('0x8'));var config=require(_0xf878('0x9'));var jayson=require(_0xf878('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3c5f5c,_0x62b420,_0x59e564){return new BPromise(function(_0x52851e,_0x530767){return client[_0xf878('0xb')](_0x3c5f5c,_0x59e564)['then'](function(_0x4a9d79){logger[_0xf878('0xc')](_0xf878('0xd'),_0x62b420,_0xf878('0xe'));logger['debug'](_0xf878('0xf'),_0x62b420,_0xf878('0xe'),JSON['stringify'](_0x4a9d79));if(_0x4a9d79[_0xf878('0x10')]){if(_0x4a9d79['error'][_0xf878('0x11')]===0x1f4){logger[_0xf878('0x10')](_0xf878('0xd'),_0x62b420,_0x4a9d79['error'][_0xf878('0x12')]);return _0x530767(_0x4a9d79[_0xf878('0x10')][_0xf878('0x12')]);}logger['error'](_0xf878('0xd'),_0x62b420,_0x4a9d79[_0xf878('0x10')][_0xf878('0x12')]);return _0x52851e(_0x4a9d79['error']['message']);}else{logger[_0xf878('0xc')](_0xf878('0xd'),_0x62b420,_0xf878('0xe'));_0x52851e(_0x4a9d79[_0xf878('0x13')][_0xf878('0x12')]);}})[_0xf878('0x14')](function(_0x415056){logger[_0xf878('0x10')](_0xf878('0xd'),_0x62b420,_0x415056);_0x530767(_0x415056);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index b321782..0334ca4 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 _0x9aa3=['isAuthenticated','describe','/:id','post','create','put','update','delete','destroy','exports','util','path','express','Router','../../components/interaction/service','../../config/environment','./mailTransferReport.controller','get','/describe'];(function(_0x42d1d0,_0x281ece){var _0x39a59e=function(_0x5bb5eb){while(--_0x5bb5eb){_0x42d1d0['push'](_0x42d1d0['shift']());}};_0x39a59e(++_0x281ece);}(_0x9aa3,0x13a));var _0x39aa=function(_0x5cb2e5,_0x3e6211){_0x5cb2e5=_0x5cb2e5-0x0;var _0x1b3639=_0x9aa3[_0x5cb2e5];return _0x1b3639;};'use strict';var multer=require('multer');var util=require(_0x39aa('0x0'));var path=require(_0x39aa('0x1'));var timeout=require('connect-timeout');var express=require(_0x39aa('0x2'));var router=express[_0x39aa('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x39aa('0x4'));var config=require(_0x39aa('0x5'));var controller=require(_0x39aa('0x6'));router[_0x39aa('0x7')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x39aa('0x8'),auth[_0x39aa('0x9')](),controller[_0x39aa('0xa')]);router[_0x39aa('0x7')](_0x39aa('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x39aa('0xc')]('/',auth[_0x39aa('0x9')](),controller[_0x39aa('0xd')]);router[_0x39aa('0xe')](_0x39aa('0xb'),auth['isAuthenticated'](),controller[_0x39aa('0xf')]);router[_0x39aa('0x10')](_0x39aa('0xb'),auth['isAuthenticated'](),controller[_0x39aa('0x11')]);module[_0x39aa('0x12')]=router; \ No newline at end of file +var _0x287f=['index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailTransferReport.controller','get','isAuthenticated'];(function(_0x4a848a,_0x2e09e1){var _0x396f47=function(_0x51bd0a){while(--_0x51bd0a){_0x4a848a['push'](_0x4a848a['shift']());}};_0x396f47(++_0x2e09e1);}(_0x287f,0x84));var _0xf287=function(_0x136ca7,_0x1c3d4c){_0x136ca7=_0x136ca7-0x0;var _0x102351=_0x287f[_0x136ca7];return _0x102351;};'use strict';var multer=require(_0xf287('0x0'));var util=require(_0xf287('0x1'));var path=require(_0xf287('0x2'));var timeout=require(_0xf287('0x3'));var express=require(_0xf287('0x4'));var router=express[_0xf287('0x5')]();var auth=require(_0xf287('0x6'));var interaction=require(_0xf287('0x7'));var config=require(_0xf287('0x8'));var controller=require(_0xf287('0x9'));router[_0xf287('0xa')]('/',auth[_0xf287('0xb')](),controller[_0xf287('0xc')]);router['get'](_0xf287('0xd'),auth[_0xf287('0xb')](),controller[_0xf287('0xe')]);router[_0xf287('0xa')](_0xf287('0xf'),auth[_0xf287('0xb')](),controller[_0xf287('0x10')]);router[_0xf287('0x11')]('/',auth[_0xf287('0xb')](),controller[_0xf287('0x12')]);router[_0xf287('0x13')](_0xf287('0xf'),auth['isAuthenticated'](),controller[_0xf287('0x14')]);router[_0xf287('0x15')](_0xf287('0xf'),auth['isAuthenticated'](),controller[_0xf287('0x16')]);module[_0xf287('0x17')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index 3d1c1cc..847203d 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 _0x5972=['DATE','NOW','moment','sequelize','exports','STRING','ENUM','agent','queue'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x5972,0xc8));var _0x2597=function(_0x247fa1,_0x4ec37c){_0x247fa1=_0x247fa1-0x0;var _0x244f35=_0x5972[_0x247fa1];return _0x244f35;};'use strict';var moment=require(_0x2597('0x0'));var Sequelize=require(_0x2597('0x1'));module[_0x2597('0x2')]={'uniqueid':{'type':Sequelize[_0x2597('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x2597('0x4')]('account',_0x2597('0x5'),_0x2597('0x6')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0x2597('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x2597('0x8')]}}; \ No newline at end of file +var _0xa094=['sequelize','STRING','account','agent','queue','DATE','NOW','moment'];(function(_0x369353,_0x17bf7b){var _0x2daad8=function(_0x13e4c3){while(--_0x13e4c3){_0x369353['push'](_0x369353['shift']());}};_0x2daad8(++_0x17bf7b);}(_0xa094,0x14f));var _0x4a09=function(_0x419ce2,_0x43991c){_0x419ce2=_0x419ce2-0x0;var _0x643f55=_0xa094[_0x419ce2];return _0x643f55;};'use strict';var moment=require(_0x4a09('0x0'));var Sequelize=require(_0x4a09('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x4a09('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x4a09('0x3'),_0x4a09('0x4'),_0x4a09('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0x4a09('0x6')],'allowNull':![],'defaultValue':Sequelize[_0x4a09('0x7')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 5925ad2..220ff6e 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 _0x7a54=['Content-Range','apply','reject','save','then','destroy','sendStatus','error','name','send','map','MailTransferReport','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','where','merge','VIRTUAL','count','includeAll','findAll','rows','catch','show','params','include','options','find','create','body','update','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','set'];(function(_0x478373,_0x5292e2){var _0x2fe374=function(_0x3cd1b9){while(--_0x3cd1b9){_0x478373['push'](_0x478373['shift']());}};_0x2fe374(++_0x5292e2);}(_0x7a54,0x106));var _0x47a5=function(_0x529d50,_0x508e87){_0x529d50=_0x529d50-0x0;var _0x35a97d=_0x7a54[_0x529d50];return _0x35a97d;};'use strict';var pdf=require(_0x47a5('0x0'));var emlformat=require(_0x47a5('0x1'));var rimraf=require(_0x47a5('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x47a5('0x3'));var rp=require(_0x47a5('0x4'));var moment=require('moment');var BPromise=require(_0x47a5('0x5'));var Mustache=require(_0x47a5('0x6'));var util=require(_0x47a5('0x7'));var path=require(_0x47a5('0x8'));var sox=require(_0x47a5('0x9'));var csv=require('to-csv');var ejs=require(_0x47a5('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var db=require(_0x47a5('0x14'))['db'];function respondWithStatusCode(_0xd612dd,_0xd308b8){_0xd308b8=_0xd308b8||0xcc;return function(_0x1eae59){if(_0x1eae59){return _0xd612dd['sendStatus'](_0xd308b8);}return _0xd612dd[_0x47a5('0x15')](_0xd308b8)[_0x47a5('0x16')]();};}function respondWithResult(_0x1cf309,_0x711793){_0x711793=_0x711793||0xc8;return function(_0x139f25){if(_0x139f25){return _0x1cf309[_0x47a5('0x15')](_0x711793)[_0x47a5('0x17')](_0x139f25);}};}function respondWithFilteredResult(_0x190faa,_0x4e99a8){return function(_0x362359){if(_0x362359){var _0x11faf5=_0x362359['count'],_0x3b001e=_0x4e99a8['offset'],_0x2a2cbb=_0x4e99a8[_0x47a5('0x18')]+_0x4e99a8['limit'],_0x1ef44c;if(_0x2a2cbb>=_0x11faf5){_0x2a2cbb=_0x11faf5;_0x1ef44c=0xc8;}else{_0x1ef44c=0xce;}_0x190faa['status'](_0x1ef44c);return _0x190faa[_0x47a5('0x19')](_0x47a5('0x1a'),_0x3b001e+'-'+_0x2a2cbb+'/'+_0x11faf5)[_0x47a5('0x17')](_0x362359);}return null;};}function patchUpdates(_0x1ef371){return function(_0x477b1d){try{jsonpatch[_0x47a5('0x1b')](_0x477b1d,_0x1ef371,!![]);}catch(_0x2763d6){return BPromise[_0x47a5('0x1c')](_0x2763d6);}return _0x477b1d[_0x47a5('0x1d')]();};}function saveUpdates(_0x4a9fcb,_0x1570bc){return function(_0xf160ba){if(_0xf160ba){return _0xf160ba['update'](_0x4a9fcb)[_0x47a5('0x1e')](function(_0x1f03f7){return _0x1f03f7;});}return null;};}function removeEntity(_0x36874d,_0x4c5910){return function(_0xb8ae6c){if(_0xb8ae6c){return _0xb8ae6c[_0x47a5('0x1f')]()[_0x47a5('0x1e')](function(){_0x36874d[_0x47a5('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0xe2dea9,_0x385687){return function(_0x513981){if(!_0x513981){_0xe2dea9[_0x47a5('0x20')](0x194);}return _0x513981;};}function handleError(_0xc4cd63,_0x4437f1){_0x4437f1=_0x4437f1||0x1f4;return function(_0x129ce5){logger[_0x47a5('0x21')](_0x129ce5['stack']);if(_0x129ce5['name']){delete _0x129ce5[_0x47a5('0x22')];}_0xc4cd63['status'](_0x4437f1)[_0x47a5('0x23')](_0x129ce5);};}exports['index']=function(_0x23cb77,_0x378208){var _0x36ad34={},_0x1dac65={},_0x21f296={'count':0x0,'rows':[]};var _0x3ba0b7=_[_0x47a5('0x24')](db[_0x47a5('0x25')][_0x47a5('0x26')],function(_0x361bfa){return{'name':_0x361bfa[_0x47a5('0x27')],'type':_0x361bfa[_0x47a5('0x28')][_0x47a5('0x29')]};});_0x1dac65['model']=_[_0x47a5('0x24')](_0x3ba0b7,'name');_0x1dac65[_0x47a5('0x2a')]=_[_0x47a5('0x2b')](_0x23cb77[_0x47a5('0x2a')]);_0x1dac65['filters']=_[_0x47a5('0x2c')](_0x1dac65[_0x47a5('0x2d')],_0x1dac65[_0x47a5('0x2a')]);_0x36ad34[_0x47a5('0x2e')]=_['intersection'](_0x1dac65['model'],qs[_0x47a5('0x2f')](_0x23cb77[_0x47a5('0x2a')]['fields']));_0x36ad34['attributes']=_0x36ad34[_0x47a5('0x2e')][_0x47a5('0x30')]?_0x36ad34['attributes']:_0x1dac65[_0x47a5('0x2d')];if(!_0x23cb77['query'][_0x47a5('0x31')](_0x47a5('0x32'))){_0x36ad34['limit']=qs['limit'](_0x23cb77[_0x47a5('0x2a')]['limit']);_0x36ad34[_0x47a5('0x18')]=qs[_0x47a5('0x18')](_0x23cb77[_0x47a5('0x2a')]['offset']);}_0x36ad34[_0x47a5('0x33')]=qs['sort'](_0x23cb77['query'][_0x47a5('0x34')]);_0x36ad34['where']=qs[_0x47a5('0x35')](_['pick'](_0x23cb77[_0x47a5('0x2a')],_0x1dac65[_0x47a5('0x35')]));if(_0x23cb77[_0x47a5('0x2a')][_0x47a5('0x36')]){_0x36ad34[_0x47a5('0x37')]=_[_0x47a5('0x38')](_0x36ad34[_0x47a5('0x37')],{'$or':_[_0x47a5('0x24')](_0x3ba0b7,function(_0x1a0d23){if(_0x1a0d23['type']!==_0x47a5('0x39')){var _0x10f136={};_0x10f136[_0x1a0d23['name']]={'$like':'%'+_0x23cb77[_0x47a5('0x2a')][_0x47a5('0x36')]+'%'};return _0x10f136;}})});}_0x36ad34=_[_0x47a5('0x38')]({},_0x36ad34,_0x23cb77['options']);var _0x101f70={'where':_0x36ad34[_0x47a5('0x37')]};return db['MailTransferReport'][_0x47a5('0x3a')](_0x101f70)[_0x47a5('0x1e')](function(_0x54ae35){_0x21f296['count']=_0x54ae35;if(_0x23cb77['query'][_0x47a5('0x3b')]){_0x36ad34['include']=[{'all':!![]}];}return db[_0x47a5('0x25')][_0x47a5('0x3c')](_0x36ad34);})[_0x47a5('0x1e')](function(_0x111f0d){_0x21f296[_0x47a5('0x3d')]=_0x111f0d;return _0x21f296;})[_0x47a5('0x1e')](respondWithFilteredResult(_0x378208,_0x36ad34))[_0x47a5('0x3e')](handleError(_0x378208,null));};exports[_0x47a5('0x3f')]=function(_0x3fa2a8,_0x36a24e){var _0x280500={'raw':!![],'where':{'id':_0x3fa2a8[_0x47a5('0x40')]['id']}},_0x1658e8={};_0x1658e8['model']=_[_0x47a5('0x2b')](db[_0x47a5('0x25')][_0x47a5('0x26')]);_0x1658e8[_0x47a5('0x2a')]=_['keys'](_0x3fa2a8[_0x47a5('0x2a')]);_0x1658e8['filters']=_['intersection'](_0x1658e8['model'],_0x1658e8['query']);_0x280500[_0x47a5('0x2e')]=_['intersection'](_0x1658e8[_0x47a5('0x2d')],qs[_0x47a5('0x2f')](_0x3fa2a8[_0x47a5('0x2a')]['fields']));_0x280500[_0x47a5('0x2e')]=_0x280500[_0x47a5('0x2e')]['length']?_0x280500['attributes']:_0x1658e8[_0x47a5('0x2d')];if(_0x3fa2a8['query'][_0x47a5('0x3b')]){_0x280500[_0x47a5('0x41')]=[{'all':!![]}];}_0x280500=_[_0x47a5('0x38')]({},_0x280500,_0x3fa2a8[_0x47a5('0x42')]);return db[_0x47a5('0x25')][_0x47a5('0x43')](_0x280500)[_0x47a5('0x1e')](handleEntityNotFound(_0x36a24e,null))[_0x47a5('0x1e')](respondWithResult(_0x36a24e,null))[_0x47a5('0x3e')](handleError(_0x36a24e,null));};exports[_0x47a5('0x44')]=function(_0x24ecb1,_0x3c3ebf){return db[_0x47a5('0x25')][_0x47a5('0x44')](_0x24ecb1[_0x47a5('0x45')],{})[_0x47a5('0x1e')](respondWithResult(_0x3c3ebf,0xc9))['catch'](handleError(_0x3c3ebf,null));};exports[_0x47a5('0x46')]=function(_0x23bb04,_0x49eab1){if(_0x23bb04['body']['id']){delete _0x23bb04[_0x47a5('0x45')]['id'];}return db['MailTransferReport'][_0x47a5('0x43')]({'where':{'id':_0x23bb04[_0x47a5('0x40')]['id']}})['then'](handleEntityNotFound(_0x49eab1,null))['then'](saveUpdates(_0x23bb04[_0x47a5('0x45')],null))['then'](respondWithResult(_0x49eab1,null))[_0x47a5('0x3e')](handleError(_0x49eab1,null));};exports[_0x47a5('0x1f')]=function(_0x3548bc,_0x3e12a7){return db[_0x47a5('0x25')][_0x47a5('0x43')]({'where':{'id':_0x3548bc[_0x47a5('0x40')]['id']}})['then'](handleEntityNotFound(_0x3e12a7,null))['then'](removeEntity(_0x3e12a7,null))[_0x47a5('0x3e')](handleError(_0x3e12a7,null));};exports[_0x47a5('0x47')]=function(_0x1163e3,_0x9ea93e){return db[_0x47a5('0x25')][_0x47a5('0x47')]()[_0x47a5('0x1e')](respondWithResult(_0x9ea93e,null))['catch'](handleError(_0x9ea93e,null));}; \ No newline at end of file +var _0x9957=['eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','reject','save','then','destroy','error','stack','name','send','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','pick','filter','where','merge','VIRTUAL','options','MailTransferReport','count','includeAll','include','findAll','rows','show','find','catch','create','body','update','params','describe','html-pdf'];(function(_0x572d36,_0x2cab77){var _0x5872d0=function(_0x2637fe){while(--_0x2637fe){_0x572d36['push'](_0x572d36['shift']());}};_0x5872d0(++_0x2cab77);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'use strict';var pdf=require(_0x7995('0x0'));var emlformat=require(_0x7995('0x1'));var rimraf=require(_0x7995('0x2'));var zipdir=require(_0x7995('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7995('0x4'));var moment=require(_0x7995('0x5'));var BPromise=require(_0x7995('0x6'));var Mustache=require(_0x7995('0x7'));var util=require('util');var path=require(_0x7995('0x8'));var sox=require(_0x7995('0x9'));var csv=require(_0x7995('0xa'));var ejs=require(_0x7995('0xb'));var fs=require('fs');var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var db=require(_0x7995('0x19'))['db'];function respondWithStatusCode(_0x2cb37a,_0x19a27e){_0x19a27e=_0x19a27e||0xcc;return function(_0x385f00){if(_0x385f00){return _0x2cb37a[_0x7995('0x1a')](_0x19a27e);}return _0x2cb37a[_0x7995('0x1b')](_0x19a27e)[_0x7995('0x1c')]();};}function respondWithResult(_0x4cc004,_0x58f5ad){_0x58f5ad=_0x58f5ad||0xc8;return function(_0x2b4e94){if(_0x2b4e94){return _0x4cc004[_0x7995('0x1b')](_0x58f5ad)[_0x7995('0x1d')](_0x2b4e94);}};}function respondWithFilteredResult(_0x321ae8,_0x3f1d3e){return function(_0x1a5310){if(_0x1a5310){var _0x2202ce=_0x1a5310['count'],_0x41cbf0=_0x3f1d3e[_0x7995('0x1e')],_0x5377e5=_0x3f1d3e[_0x7995('0x1e')]+_0x3f1d3e[_0x7995('0x1f')],_0x2eeacc;if(_0x5377e5>=_0x2202ce){_0x5377e5=_0x2202ce;_0x2eeacc=0xc8;}else{_0x2eeacc=0xce;}_0x321ae8[_0x7995('0x1b')](_0x2eeacc);return _0x321ae8[_0x7995('0x20')](_0x7995('0x21'),_0x41cbf0+'-'+_0x5377e5+'/'+_0x2202ce)['json'](_0x1a5310);}return null;};}function patchUpdates(_0x54c9ae){return function(_0x2536c8){try{jsonpatch['apply'](_0x2536c8,_0x54c9ae,!![]);}catch(_0x555f74){return BPromise[_0x7995('0x22')](_0x555f74);}return _0x2536c8[_0x7995('0x23')]();};}function saveUpdates(_0x4cbe10,_0x3a9b54){return function(_0x51f276){if(_0x51f276){return _0x51f276['update'](_0x4cbe10)[_0x7995('0x24')](function(_0x327b1f){return _0x327b1f;});}return null;};}function removeEntity(_0x350fd9,_0x1a8568){return function(_0x460924){if(_0x460924){return _0x460924[_0x7995('0x25')]()['then'](function(){_0x350fd9[_0x7995('0x1b')](0xcc)[_0x7995('0x1c')]();});}};}function handleEntityNotFound(_0x204507,_0x285437){return function(_0x563799){if(!_0x563799){_0x204507[_0x7995('0x1a')](0x194);}return _0x563799;};}function handleError(_0x475351,_0x472195){_0x472195=_0x472195||0x1f4;return function(_0x59405a){logger[_0x7995('0x26')](_0x59405a[_0x7995('0x27')]);if(_0x59405a[_0x7995('0x28')]){delete _0x59405a[_0x7995('0x28')];}_0x475351[_0x7995('0x1b')](_0x472195)[_0x7995('0x29')](_0x59405a);};}exports['index']=function(_0x47625f,_0x5911c3){var _0x229742={},_0x49bc7e={},_0xf16cc2={'count':0x0,'rows':[]};var _0x132a42=_[_0x7995('0x2a')](db['MailTransferReport'][_0x7995('0x2b')],function(_0x514445){return{'name':_0x514445[_0x7995('0x2c')],'type':_0x514445[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x49bc7e['model']=_['map'](_0x132a42,'name');_0x49bc7e[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x47625f[_0x7995('0x2f')]);_0x49bc7e[_0x7995('0x31')]=_[_0x7995('0x32')](_0x49bc7e[_0x7995('0x33')],_0x49bc7e['query']);_0x229742['attributes']=_[_0x7995('0x32')](_0x49bc7e['model'],qs[_0x7995('0x34')](_0x47625f[_0x7995('0x2f')][_0x7995('0x34')]));_0x229742[_0x7995('0x35')]=_0x229742[_0x7995('0x35')]['length']?_0x229742[_0x7995('0x35')]:_0x49bc7e[_0x7995('0x33')];if(!_0x47625f['query']['hasOwnProperty']('nolimit')){_0x229742[_0x7995('0x1f')]=qs[_0x7995('0x1f')](_0x47625f['query'][_0x7995('0x1f')]);_0x229742['offset']=qs[_0x7995('0x1e')](_0x47625f[_0x7995('0x2f')][_0x7995('0x1e')]);}_0x229742['order']=qs['sort'](_0x47625f[_0x7995('0x2f')]['sort']);_0x229742['where']=qs[_0x7995('0x31')](_[_0x7995('0x36')](_0x47625f['query'],_0x49bc7e[_0x7995('0x31')]));if(_0x47625f[_0x7995('0x2f')][_0x7995('0x37')]){_0x229742[_0x7995('0x38')]=_[_0x7995('0x39')](_0x229742['where'],{'$or':_[_0x7995('0x2a')](_0x132a42,function(_0x242713){if(_0x242713[_0x7995('0x2d')]!==_0x7995('0x3a')){var _0x4b1541={};_0x4b1541[_0x242713[_0x7995('0x28')]]={'$like':'%'+_0x47625f[_0x7995('0x2f')][_0x7995('0x37')]+'%'};return _0x4b1541;}})});}_0x229742=_[_0x7995('0x39')]({},_0x229742,_0x47625f[_0x7995('0x3b')]);var _0x1035dc={'where':_0x229742['where']};return db[_0x7995('0x3c')][_0x7995('0x3d')](_0x1035dc)[_0x7995('0x24')](function(_0x2ea47f){_0xf16cc2[_0x7995('0x3d')]=_0x2ea47f;if(_0x47625f[_0x7995('0x2f')][_0x7995('0x3e')]){_0x229742[_0x7995('0x3f')]=[{'all':!![]}];}return db[_0x7995('0x3c')][_0x7995('0x40')](_0x229742);})[_0x7995('0x24')](function(_0x270d52){_0xf16cc2[_0x7995('0x41')]=_0x270d52;return _0xf16cc2;})['then'](respondWithFilteredResult(_0x5911c3,_0x229742))['catch'](handleError(_0x5911c3,null));};exports[_0x7995('0x42')]=function(_0x7325e8,_0x58523e){var _0x4b0855={'raw':!![],'where':{'id':_0x7325e8['params']['id']}},_0x3f8522={};_0x3f8522['model']=_[_0x7995('0x30')](db[_0x7995('0x3c')][_0x7995('0x2b')]);_0x3f8522['query']=_[_0x7995('0x30')](_0x7325e8['query']);_0x3f8522[_0x7995('0x31')]=_['intersection'](_0x3f8522['model'],_0x3f8522[_0x7995('0x2f')]);_0x4b0855[_0x7995('0x35')]=_[_0x7995('0x32')](_0x3f8522[_0x7995('0x33')],qs['fields'](_0x7325e8[_0x7995('0x2f')][_0x7995('0x34')]));_0x4b0855[_0x7995('0x35')]=_0x4b0855[_0x7995('0x35')]['length']?_0x4b0855['attributes']:_0x3f8522[_0x7995('0x33')];if(_0x7325e8['query'][_0x7995('0x3e')]){_0x4b0855['include']=[{'all':!![]}];}_0x4b0855=_[_0x7995('0x39')]({},_0x4b0855,_0x7325e8['options']);return db[_0x7995('0x3c')][_0x7995('0x43')](_0x4b0855)['then'](handleEntityNotFound(_0x58523e,null))[_0x7995('0x24')](respondWithResult(_0x58523e,null))[_0x7995('0x44')](handleError(_0x58523e,null));};exports[_0x7995('0x45')]=function(_0xb70a51,_0x4c6837){return db[_0x7995('0x3c')][_0x7995('0x45')](_0xb70a51[_0x7995('0x46')],{})['then'](respondWithResult(_0x4c6837,0xc9))[_0x7995('0x44')](handleError(_0x4c6837,null));};exports[_0x7995('0x47')]=function(_0x511567,_0x3d8ae3){if(_0x511567[_0x7995('0x46')]['id']){delete _0x511567['body']['id'];}return db[_0x7995('0x3c')][_0x7995('0x43')]({'where':{'id':_0x511567['params']['id']}})[_0x7995('0x24')](handleEntityNotFound(_0x3d8ae3,null))['then'](saveUpdates(_0x511567[_0x7995('0x46')],null))[_0x7995('0x24')](respondWithResult(_0x3d8ae3,null))[_0x7995('0x44')](handleError(_0x3d8ae3,null));};exports[_0x7995('0x25')]=function(_0xddf537,_0x14b537){return db[_0x7995('0x3c')]['find']({'where':{'id':_0xddf537[_0x7995('0x48')]['id']}})[_0x7995('0x24')](handleEntityNotFound(_0x14b537,null))[_0x7995('0x24')](removeEntity(_0x14b537,null))['catch'](handleError(_0x14b537,null));};exports[_0x7995('0x49')]=function(_0x1fe77e,_0x12d4b8){return db['MailTransferReport']['describe']()['then'](respondWithResult(_0x12d4b8,null))[_0x7995('0x44')](handleError(_0x12d4b8,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index 79eb301..851fe27 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 _0x3217=['MailTransferReport','report_mail_transfer','uniqueid','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailTransferReport.attributes','exports'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x3217,0x17c));var _0x7321=function(_0x5c0099,_0x5d7a3d){_0x5c0099=_0x5c0099-0x0;var _0x55ab84=_0x3217[_0x5c0099];return _0x55ab84;};'use strict';var _=require(_0x7321('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x7321('0x1'));var moment=require(_0x7321('0x2'));var BPromise=require(_0x7321('0x3'));var rp=require(_0x7321('0x4'));var fs=require('fs');var path=require(_0x7321('0x5'));var rimraf=require(_0x7321('0x6'));var config=require(_0x7321('0x7'));var attributes=require(_0x7321('0x8'));module[_0x7321('0x9')]=function(_0x323545,_0x346c92){return _0x323545['define'](_0x7321('0xa'),attributes,{'tableName':_0x7321('0xb'),'paranoid':![],'indexes':[{'name':_0x7321('0xc'),'fields':[_0x7321('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x293c=['bluebird','request-promise','path','rimraf','./mailTransferReport.attributes','define','MailTransferReport','report_mail_transfer','uniqueid','util','../../config/logger','api'];(function(_0x1565df,_0x4095cf){var _0x4b5f21=function(_0x2a4fee){while(--_0x2a4fee){_0x1565df['push'](_0x1565df['shift']());}};_0x4b5f21(++_0x4095cf);}(_0x293c,0x135));var _0xc293=function(_0x2aa291,_0xda03df){_0x2aa291=_0x2aa291-0x0;var _0x2eb822=_0x293c[_0x2aa291];return _0x2eb822;};'use strict';var _=require('lodash');var util=require(_0xc293('0x0'));var logger=require(_0xc293('0x1'))(_0xc293('0x2'));var moment=require('moment');var BPromise=require(_0xc293('0x3'));var rp=require(_0xc293('0x4'));var fs=require('fs');var path=require(_0xc293('0x5'));var rimraf=require(_0xc293('0x6'));var config=require('../../config/environment');var attributes=require(_0xc293('0x7'));module['exports']=function(_0x1795d2,_0x4bffc0){return _0x1795d2[_0xc293('0x8')](_0xc293('0x9'),attributes,{'tableName':_0xc293('0xa'),'paranoid':![],'indexes':[{'name':_0xc293('0xb'),'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 98cf048..0f55b00 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 _0xe4ee=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','MailTransferReport,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','lodash','util'];(function(_0x1788e8,_0x488ae9){var _0x697cf=function(_0x32cd04){while(--_0x32cd04){_0x1788e8['push'](_0x1788e8['shift']());}};_0x697cf(++_0x488ae9);}(_0xe4ee,0xb6));var _0xee4e=function(_0x410ed1,_0x57e525){_0x410ed1=_0x410ed1-0x0;var _0x2f526b=_0xe4ee[_0x410ed1];return _0x2f526b;};'use strict';var _=require(_0xee4e('0x0'));var util=require(_0xee4e('0x1'));var moment=require(_0xee4e('0x2'));var BPromise=require(_0xee4e('0x3'));var rs=require(_0xee4e('0x4'));var fs=require('fs');var Redis=require(_0xee4e('0x5'));var db=require(_0xee4e('0x6'))['db'];var utils=require(_0xee4e('0x7'));var logger=require(_0xee4e('0x8'))(_0xee4e('0x9'));var config=require(_0xee4e('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xee4e('0xb')][_0xee4e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5600df,_0x32ca88,_0x43f192){return new BPromise(function(_0xcf42e7,_0x2d4eb6){return client[_0xee4e('0xd')](_0x5600df,_0x43f192)[_0xee4e('0xe')](function(_0x4cff2e){logger[_0xee4e('0xf')](_0xee4e('0x10'),_0x32ca88,'request\x20sent');logger['debug']('MailTransferReport,\x20%s,\x20%s,\x20%s',_0x32ca88,'request\x20sent',JSON[_0xee4e('0x11')](_0x4cff2e));if(_0x4cff2e[_0xee4e('0x12')]){if(_0x4cff2e[_0xee4e('0x12')][_0xee4e('0x13')]===0x1f4){logger[_0xee4e('0x12')](_0xee4e('0x10'),_0x32ca88,_0x4cff2e[_0xee4e('0x12')][_0xee4e('0x14')]);return _0x2d4eb6(_0x4cff2e[_0xee4e('0x12')][_0xee4e('0x14')]);}logger[_0xee4e('0x12')](_0xee4e('0x10'),_0x32ca88,_0x4cff2e[_0xee4e('0x12')][_0xee4e('0x14')]);return _0xcf42e7(_0x4cff2e[_0xee4e('0x12')][_0xee4e('0x14')]);}else{logger[_0xee4e('0xf')](_0xee4e('0x10'),_0x32ca88,_0xee4e('0x15'));_0xcf42e7(_0x4cff2e[_0xee4e('0x16')]['message']);}})['catch'](function(_0x1f7566){logger[_0xee4e('0x12')](_0xee4e('0x10'),_0x32ca88,_0x1f7566);_0x2d4eb6(_0x1f7566);});});} \ No newline at end of file +var _0xa313=['../../config/environment','jayson/promise','request','MailTransferReport,\x20%s,\x20%s','request\x20sent','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','rpc'];(function(_0x1df2ae,_0x29d29a){var _0x2a0808=function(_0x13cb87){while(--_0x13cb87){_0x1df2ae['push'](_0x1df2ae['shift']());}};_0x2a0808(++_0x29d29a);}(_0xa313,0x119));var _0x3a31=function(_0x403fc7,_0x32931a){_0x403fc7=_0x403fc7-0x0;var _0x5d0827=_0xa313[_0x403fc7];return _0x5d0827;};'use strict';var _=require(_0x3a31('0x0'));var util=require(_0x3a31('0x1'));var moment=require(_0x3a31('0x2'));var BPromise=require(_0x3a31('0x3'));var rs=require(_0x3a31('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3a31('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x3a31('0x6'));var config=require(_0x3a31('0x7'));var jayson=require(_0x3a31('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x56a6e1,_0x47717f,_0x5cb093){return new BPromise(function(_0x3a5e96,_0x1cf143){return client[_0x3a31('0x9')](_0x56a6e1,_0x5cb093)['then'](function(_0x294056){logger['info'](_0x3a31('0xa'),_0x47717f,_0x3a31('0xb'));logger['debug'](_0x3a31('0xc'),_0x47717f,_0x3a31('0xb'),JSON[_0x3a31('0xd')](_0x294056));if(_0x294056[_0x3a31('0xe')]){if(_0x294056['error'][_0x3a31('0xf')]===0x1f4){logger[_0x3a31('0xe')](_0x3a31('0xa'),_0x47717f,_0x294056['error'][_0x3a31('0x10')]);return _0x1cf143(_0x294056[_0x3a31('0xe')][_0x3a31('0x10')]);}logger[_0x3a31('0xe')](_0x3a31('0xa'),_0x47717f,_0x294056[_0x3a31('0xe')][_0x3a31('0x10')]);return _0x3a5e96(_0x294056['error'][_0x3a31('0x10')]);}else{logger['info'](_0x3a31('0xa'),_0x47717f,_0x3a31('0xb'));_0x3a5e96(_0x294056['result'][_0x3a31('0x10')]);}})[_0x3a31('0x11')](function(_0x6dcb10){logger[_0x3a31('0xe')](_0x3a31('0xa'),_0x47717f,_0x6dcb10);_0x1cf143(_0x6dcb10);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 97de5ec..39f438c 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 _0x3f1d=['get','index','isAuthenticated','describe','/:id','show','post','delete','destroy','multer','util','path','connect-timeout','express','Router','./memberReport.controller'];(function(_0x4badf6,_0x4100f1){var _0xd33657=function(_0x1377c7){while(--_0x1377c7){_0x4badf6['push'](_0x4badf6['shift']());}};_0xd33657(++_0x4100f1);}(_0x3f1d,0x189));var _0xd3f1=function(_0x3ff7d2,_0x4584d3){_0x3ff7d2=_0x3ff7d2-0x0;var _0xe3f7ec=_0x3f1d[_0x3ff7d2];return _0xe3f7ec;};'use strict';var multer=require(_0xd3f1('0x0'));var util=require(_0xd3f1('0x1'));var path=require(_0xd3f1('0x2'));var timeout=require(_0xd3f1('0x3'));var express=require(_0xd3f1('0x4'));var router=express[_0xd3f1('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xd3f1('0x6'));router[_0xd3f1('0x7')]('/',auth['isAuthenticated'](),controller[_0xd3f1('0x8')]);router[_0xd3f1('0x7')]('/describe',auth[_0xd3f1('0x9')](),controller[_0xd3f1('0xa')]);router[_0xd3f1('0x7')](_0xd3f1('0xb'),auth['isAuthenticated'](),controller[_0xd3f1('0xc')]);router[_0xd3f1('0xd')]('/',auth[_0xd3f1('0x9')](),controller['create']);router['put'](_0xd3f1('0xb'),auth[_0xd3f1('0x9')](),controller['update']);router[_0xd3f1('0xe')]('/:id',auth['isAuthenticated'](),controller[_0xd3f1('0xf')]);module['exports']=router; \ No newline at end of file +var _0x6b11=['get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','destroy','exports','multer','path','connect-timeout','express','../../components/interaction/service','../../config/environment'];(function(_0x5578f5,_0x80e048){var _0xf26e1c=function(_0x88d775){while(--_0x88d775){_0x5578f5['push'](_0x5578f5['shift']());}};_0xf26e1c(++_0x80e048);}(_0x6b11,0x6c));var _0x16b1=function(_0x623e7,_0x1bef7d){_0x623e7=_0x623e7-0x0;var _0x121131=_0x6b11[_0x623e7];return _0x121131;};'use strict';var multer=require(_0x16b1('0x0'));var util=require('util');var path=require(_0x16b1('0x1'));var timeout=require(_0x16b1('0x2'));var express=require(_0x16b1('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x16b1('0x4'));var config=require(_0x16b1('0x5'));var controller=require('./memberReport.controller');router[_0x16b1('0x6')]('/',auth[_0x16b1('0x7')](),controller[_0x16b1('0x8')]);router[_0x16b1('0x6')](_0x16b1('0x9'),auth[_0x16b1('0x7')](),controller[_0x16b1('0xa')]);router['get'](_0x16b1('0xb'),auth['isAuthenticated'](),controller[_0x16b1('0xc')]);router[_0x16b1('0xd')]('/',auth[_0x16b1('0x7')](),controller[_0x16b1('0xe')]);router[_0x16b1('0xf')](_0x16b1('0xb'),auth[_0x16b1('0x7')](),controller[_0x16b1('0x10')]);router['delete'](_0x16b1('0xb'),auth['isAuthenticated'](),controller[_0x16b1('0x11')]);module[_0x16b1('0x12')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index 08992fc..3a6f91e 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 _0xeffe=['exitAt','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[queue]','moment','exports','STRING','INTEGER','DATE','getDataValue','enterAt','diff','seconds','setDataValue'];(function(_0x5d78f0,_0x3784f9){var _0x4d1012=function(_0x23d0ba){while(--_0x23d0ba){_0x5d78f0['push'](_0x5d78f0['shift']());}};_0x4d1012(++_0x3784f9);}(_0xeffe,0x7d));var _0xeeff=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xeffe[_0x17d9e3];return _0x14192d;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xeeff('0x0'));module[_0xeeff('0x1')]={'channel':{'type':Sequelize[_0xeeff('0x2')]},'membername':{'type':Sequelize[_0xeeff('0x2')]},'interface':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING'],'defaultValue':'DEFAULT\x20PAUSE','comment':'LOGIN,\x20PAUSE,\x20TALKING'},'duration':{'type':Sequelize[_0xeeff('0x3')]},'enterAt':{'type':Sequelize[_0xeeff('0x4')]},'exitAt':{'type':Sequelize[_0xeeff('0x4')],'set':function(_0x21e6dd){var _0x215bf4=moment(_0x21e6dd);var _0x4a0534=moment(this[_0xeeff('0x5')](_0xeeff('0x6')));var _0x34ca6a=_0x215bf4[_0xeeff('0x7')](_0x4a0534,_0xeeff('0x8'));this[_0xeeff('0x9')](_0xeeff('0xa'),_0x21e6dd);this[_0xeeff('0x9')](_0xeeff('0xb'),_0x34ca6a||null);}},'data1':{'type':Sequelize[_0xeeff('0x2')],'comment':_0xeeff('0xc')},'data2':{'type':Sequelize['STRING'],'comment':_0xeeff('0xd')},'data3':{'type':Sequelize['STRING'],'comment':'talk:[destination]'},'data4':{'type':Sequelize[_0xeeff('0x2')],'comment':'talk:[dial\x20string]'},'data5':{'type':Sequelize[_0xeeff('0x2')],'comment':_0xeeff('0xe')},'role':{'type':Sequelize[_0xeeff('0x2')]},'internal':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x2a3a=['setDataValue','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','sequelize','moment','STRING','DEFAULT\x20PAUSE','INTEGER','DATE','getDataValue','seconds'];(function(_0x478288,_0x5cdb14){var _0x21242d=function(_0x4b58f0){while(--_0x4b58f0){_0x478288['push'](_0x478288['shift']());}};_0x21242d(++_0x5cdb14);}(_0x2a3a,0xca));var _0xa2a3=function(_0x49c9ec,_0x34f16a){_0x49c9ec=_0x49c9ec-0x0;var _0x474b0a=_0x2a3a[_0x49c9ec];return _0x474b0a;};'use strict';var Sequelize=require(_0xa2a3('0x0'));var moment=require(_0xa2a3('0x1'));module['exports']={'channel':{'type':Sequelize[_0xa2a3('0x2')]},'membername':{'type':Sequelize[_0xa2a3('0x2')]},'interface':{'type':Sequelize[_0xa2a3('0x2')]},'type':{'type':Sequelize['STRING'],'defaultValue':_0xa2a3('0x3'),'comment':'LOGIN,\x20PAUSE,\x20TALKING'},'duration':{'type':Sequelize[_0xa2a3('0x4')]},'enterAt':{'type':Sequelize[_0xa2a3('0x5')]},'exitAt':{'type':Sequelize['DATE'],'set':function(_0xb05193){var _0x17191d=moment(_0xb05193);var _0x25f0f9=moment(this[_0xa2a3('0x6')]('enterAt'));var _0x2b10eb=_0x17191d['diff'](_0x25f0f9,_0xa2a3('0x7'));this[_0xa2a3('0x8')]('exitAt',_0xb05193);this[_0xa2a3('0x8')](_0xa2a3('0x9'),_0x2b10eb||null);}},'data1':{'type':Sequelize['STRING'],'comment':_0xa2a3('0xa')},'data2':{'type':Sequelize[_0xa2a3('0x2')],'comment':_0xa2a3('0xb')},'data3':{'type':Sequelize[_0xa2a3('0x2')],'comment':_0xa2a3('0xc')},'data4':{'type':Sequelize[_0xa2a3('0x2')],'comment':_0xa2a3('0xd')},'data5':{'type':Sequelize[_0xa2a3('0x2')],'comment':_0xa2a3('0xe')},'role':{'type':Sequelize[_0xa2a3('0x2')]},'internal':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0xa2a3('0x2')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index d494222..f3d5ba6 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 _0x7de2=['filter','merge','type','VIRTUAL','options','count','includeAll','findAll','rows','catch','params','find','create','body','describe','html-pdf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','end','offset','limit','status','set','Content-Range','json','apply','save','update','destroy','then','sendStatus','error','stack','name','send','index','MemberReport','rawAttributes','model','map','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters'];(function(_0x3b0675,_0x17502a){var _0x11b775=function(_0x30e206){while(--_0x30e206){_0x3b0675['push'](_0x3b0675['shift']());}};_0x11b775(++_0x17502a);}(_0x7de2,0x1bf));var _0x27de=function(_0x135f97,_0xc5bfab){_0x135f97=_0x135f97-0x0;var _0x1b8dd1=_0x7de2[_0x135f97];return _0x1b8dd1;};'use strict';var pdf=require(_0x27de('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x27de('0x1'));var rp=require(_0x27de('0x2'));var moment=require(_0x27de('0x3'));var BPromise=require(_0x27de('0x4'));var Mustache=require(_0x27de('0x5'));var util=require(_0x27de('0x6'));var path=require('path');var sox=require(_0x27de('0x7'));var csv=require('to-csv');var ejs=require(_0x27de('0x8'));var fs=require('fs');var _=require(_0x27de('0x9'));var squel=require(_0x27de('0xa'));var crypto=require(_0x27de('0xb'));var jsforce=require(_0x27de('0xc'));var deskjs=require(_0x27de('0xd'));var toCsv=require('to-csv');var querystring=require(_0x27de('0xe'));var Papa=require('papaparse');var Redis=require(_0x27de('0xf'));var authService=require(_0x27de('0x10'));var qs=require(_0x27de('0x11'));var as=require(_0x27de('0x12'));var hardwareService=require(_0x27de('0x13'));var logger=require(_0x27de('0x14'))(_0x27de('0x15'));var utils=require(_0x27de('0x16'));var config=require('../../config/environment');var db=require(_0x27de('0x17'))['db'];function respondWithStatusCode(_0x15c27a,_0x134129){_0x134129=_0x134129||0xcc;return function(_0x2f7913){if(_0x2f7913){return _0x15c27a['sendStatus'](_0x134129);}return _0x15c27a['status'](_0x134129)[_0x27de('0x18')]();};}function respondWithResult(_0xdb4bcd,_0x5dcb80){_0x5dcb80=_0x5dcb80||0xc8;return function(_0x4d7600){if(_0x4d7600){return _0xdb4bcd['status'](_0x5dcb80)['json'](_0x4d7600);}};}function respondWithFilteredResult(_0x5495b4,_0x1583f3){return function(_0x5e9b62){if(_0x5e9b62){var _0xb9b276=_0x5e9b62['count'],_0x50d217=_0x1583f3['offset'],_0x42847d=_0x1583f3[_0x27de('0x19')]+_0x1583f3[_0x27de('0x1a')],_0x5df352;if(_0x42847d>=_0xb9b276){_0x42847d=_0xb9b276;_0x5df352=0xc8;}else{_0x5df352=0xce;}_0x5495b4[_0x27de('0x1b')](_0x5df352);return _0x5495b4[_0x27de('0x1c')](_0x27de('0x1d'),_0x50d217+'-'+_0x42847d+'/'+_0xb9b276)[_0x27de('0x1e')](_0x5e9b62);}return null;};}function patchUpdates(_0x406022){return function(_0x530952){try{jsonpatch[_0x27de('0x1f')](_0x530952,_0x406022,!![]);}catch(_0x1c6da8){return BPromise['reject'](_0x1c6da8);}return _0x530952[_0x27de('0x20')]();};}function saveUpdates(_0x307c65,_0x3c87cd){return function(_0xb075c1){if(_0xb075c1){return _0xb075c1[_0x27de('0x21')](_0x307c65)['then'](function(_0x439d86){return _0x439d86;});}return null;};}function removeEntity(_0x5788e1,_0x1c46d4){return function(_0x1b71c3){if(_0x1b71c3){return _0x1b71c3[_0x27de('0x22')]()[_0x27de('0x23')](function(){_0x5788e1[_0x27de('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x358748,_0x4858d7){return function(_0x3935c4){if(!_0x3935c4){_0x358748[_0x27de('0x24')](0x194);}return _0x3935c4;};}function handleError(_0x16b9a8,_0x44026b){_0x44026b=_0x44026b||0x1f4;return function(_0x416a17){logger[_0x27de('0x25')](_0x416a17[_0x27de('0x26')]);if(_0x416a17[_0x27de('0x27')]){delete _0x416a17['name'];}_0x16b9a8['status'](_0x44026b)[_0x27de('0x28')](_0x416a17);};}exports[_0x27de('0x29')]=function(_0xce2880,_0x40a2f8){var _0x3e20bb={},_0xa4a11e={},_0x4f716d={'count':0x0,'rows':[]};var _0x377372=_['map'](db[_0x27de('0x2a')][_0x27de('0x2b')],function(_0xcd46d){return{'name':_0xcd46d['fieldName'],'type':_0xcd46d['type']['key']};});_0xa4a11e[_0x27de('0x2c')]=_[_0x27de('0x2d')](_0x377372,_0x27de('0x27'));_0xa4a11e[_0x27de('0x2e')]=_[_0x27de('0x2f')](_0xce2880[_0x27de('0x2e')]);_0xa4a11e['filters']=_[_0x27de('0x30')](_0xa4a11e['model'],_0xa4a11e[_0x27de('0x2e')]);_0x3e20bb['attributes']=_['intersection'](_0xa4a11e[_0x27de('0x2c')],qs[_0x27de('0x31')](_0xce2880[_0x27de('0x2e')]['fields']));_0x3e20bb[_0x27de('0x32')]=_0x3e20bb[_0x27de('0x32')][_0x27de('0x33')]?_0x3e20bb[_0x27de('0x32')]:_0xa4a11e[_0x27de('0x2c')];if(!_0xce2880[_0x27de('0x2e')][_0x27de('0x34')](_0x27de('0x35'))){_0x3e20bb['limit']=qs[_0x27de('0x1a')](_0xce2880[_0x27de('0x2e')][_0x27de('0x1a')]);_0x3e20bb[_0x27de('0x19')]=qs[_0x27de('0x19')](_0xce2880['query'][_0x27de('0x19')]);}_0x3e20bb['order']=qs[_0x27de('0x36')](_0xce2880['query'][_0x27de('0x36')]);_0x3e20bb[_0x27de('0x37')]=qs[_0x27de('0x38')](_['pick'](_0xce2880[_0x27de('0x2e')],_0xa4a11e[_0x27de('0x38')]));if(_0xce2880[_0x27de('0x2e')][_0x27de('0x39')]){_0x3e20bb[_0x27de('0x37')]=_[_0x27de('0x3a')](_0x3e20bb[_0x27de('0x37')],{'$or':_[_0x27de('0x2d')](_0x377372,function(_0x450e19){if(_0x450e19[_0x27de('0x3b')]!==_0x27de('0x3c')){var _0x25d19a={};_0x25d19a[_0x450e19['name']]={'$like':'%'+_0xce2880[_0x27de('0x2e')][_0x27de('0x39')]+'%'};return _0x25d19a;}})});}_0x3e20bb=_[_0x27de('0x3a')]({},_0x3e20bb,_0xce2880[_0x27de('0x3d')]);var _0x3cb302={'where':_0x3e20bb[_0x27de('0x37')]};return db['MemberReport'][_0x27de('0x3e')](_0x3cb302)[_0x27de('0x23')](function(_0x564d46){_0x4f716d[_0x27de('0x3e')]=_0x564d46;if(_0xce2880[_0x27de('0x2e')][_0x27de('0x3f')]){_0x3e20bb['include']=[{'all':!![]}];}return db['MemberReport'][_0x27de('0x40')](_0x3e20bb);})[_0x27de('0x23')](function(_0x44efbb){_0x4f716d[_0x27de('0x41')]=_0x44efbb;return _0x4f716d;})[_0x27de('0x23')](respondWithFilteredResult(_0x40a2f8,_0x3e20bb))[_0x27de('0x42')](handleError(_0x40a2f8,null));};exports['show']=function(_0xd3390,_0x6009a2){var _0x5476bd={'raw':!![],'where':{'id':_0xd3390[_0x27de('0x43')]['id']}},_0x51fb2f={};_0x51fb2f['model']=_[_0x27de('0x2f')](db[_0x27de('0x2a')][_0x27de('0x2b')]);_0x51fb2f[_0x27de('0x2e')]=_[_0x27de('0x2f')](_0xd3390[_0x27de('0x2e')]);_0x51fb2f[_0x27de('0x38')]=_['intersection'](_0x51fb2f[_0x27de('0x2c')],_0x51fb2f['query']);_0x5476bd[_0x27de('0x32')]=_['intersection'](_0x51fb2f[_0x27de('0x2c')],qs[_0x27de('0x31')](_0xd3390[_0x27de('0x2e')]['fields']));_0x5476bd['attributes']=_0x5476bd[_0x27de('0x32')][_0x27de('0x33')]?_0x5476bd[_0x27de('0x32')]:_0x51fb2f[_0x27de('0x2c')];if(_0xd3390[_0x27de('0x2e')][_0x27de('0x3f')]){_0x5476bd['include']=[{'all':!![]}];}_0x5476bd=_['merge']({},_0x5476bd,_0xd3390[_0x27de('0x3d')]);return db[_0x27de('0x2a')][_0x27de('0x44')](_0x5476bd)[_0x27de('0x23')](handleEntityNotFound(_0x6009a2,null))[_0x27de('0x23')](respondWithResult(_0x6009a2,null))[_0x27de('0x42')](handleError(_0x6009a2,null));};exports[_0x27de('0x45')]=function(_0x585dad,_0x45abde){return db['MemberReport'][_0x27de('0x45')](_0x585dad[_0x27de('0x46')],{})['then'](respondWithResult(_0x45abde,0xc9))[_0x27de('0x42')](handleError(_0x45abde,null));};exports[_0x27de('0x21')]=function(_0x3f50dd,_0x295435){if(_0x3f50dd['body']['id']){delete _0x3f50dd[_0x27de('0x46')]['id'];}return db[_0x27de('0x2a')][_0x27de('0x44')]({'where':{'id':_0x3f50dd[_0x27de('0x43')]['id']}})[_0x27de('0x23')](handleEntityNotFound(_0x295435,null))[_0x27de('0x23')](saveUpdates(_0x3f50dd[_0x27de('0x46')],null))[_0x27de('0x23')](respondWithResult(_0x295435,null))[_0x27de('0x42')](handleError(_0x295435,null));};exports['destroy']=function(_0x58e2b2,_0x177699){return db['MemberReport'][_0x27de('0x44')]({'where':{'id':_0x58e2b2[_0x27de('0x43')]['id']}})[_0x27de('0x23')](handleEntityNotFound(_0x177699,null))[_0x27de('0x23')](removeEntity(_0x177699,null))['catch'](handleError(_0x177699,null));};exports['describe']=function(_0x10e4df,_0x2b3abf){return db[_0x27de('0x2a')][_0x27de('0x47')]()[_0x27de('0x23')](respondWithResult(_0x2b3abf,null))['catch'](handleError(_0x2b3abf,null));}; \ No newline at end of file +var _0x2f10=['merge','VIRTUAL','include','rows','catch','show','params','keys','includeAll','options','find','create','body','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','save','update','then','destroy','error','stack','name','index','map','MemberReport','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filters','pick','filter'];(function(_0x55fe72,_0x43479d){var _0x3527f6=function(_0x274291){while(--_0x274291){_0x55fe72['push'](_0x55fe72['shift']());}};_0x3527f6(++_0x43479d);}(_0x2f10,0x1c4));var _0x02f1=function(_0x20b1b1,_0x2341f5){_0x20b1b1=_0x20b1b1-0x0;var _0x40d75a=_0x2f10[_0x20b1b1];return _0x40d75a;};'use strict';var pdf=require(_0x02f1('0x0'));var emlformat=require(_0x02f1('0x1'));var rimraf=require(_0x02f1('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x02f1('0x3'));var rp=require(_0x02f1('0x4'));var moment=require('moment');var BPromise=require(_0x02f1('0x5'));var Mustache=require('mustache');var util=require(_0x02f1('0x6'));var path=require(_0x02f1('0x7'));var sox=require(_0x02f1('0x8'));var csv=require(_0x02f1('0x9'));var ejs=require(_0x02f1('0xa'));var fs=require('fs');var _=require(_0x02f1('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x02f1('0xc'));var deskjs=require(_0x02f1('0xd'));var toCsv=require(_0x02f1('0x9'));var querystring=require(_0x02f1('0xe'));var Papa=require(_0x02f1('0xf'));var Redis=require('ioredis');var authService=require(_0x02f1('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x02f1('0x11'));var hardwareService=require(_0x02f1('0x12'));var logger=require(_0x02f1('0x13'))(_0x02f1('0x14'));var utils=require(_0x02f1('0x15'));var config=require('../../config/environment');var db=require(_0x02f1('0x16'))['db'];function respondWithStatusCode(_0x191394,_0x1e5817){_0x1e5817=_0x1e5817||0xcc;return function(_0x2d6cb7){if(_0x2d6cb7){return _0x191394[_0x02f1('0x17')](_0x1e5817);}return _0x191394[_0x02f1('0x18')](_0x1e5817)[_0x02f1('0x19')]();};}function respondWithResult(_0x38bd30,_0xfed639){_0xfed639=_0xfed639||0xc8;return function(_0x419a09){if(_0x419a09){return _0x38bd30[_0x02f1('0x18')](_0xfed639)[_0x02f1('0x1a')](_0x419a09);}};}function respondWithFilteredResult(_0x158df4,_0x1d088f){return function(_0x10de32){if(_0x10de32){var _0x4b2083=_0x10de32[_0x02f1('0x1b')],_0x1763bc=_0x1d088f[_0x02f1('0x1c')],_0x441bfc=_0x1d088f[_0x02f1('0x1c')]+_0x1d088f[_0x02f1('0x1d')],_0x3675d2;if(_0x441bfc>=_0x4b2083){_0x441bfc=_0x4b2083;_0x3675d2=0xc8;}else{_0x3675d2=0xce;}_0x158df4['status'](_0x3675d2);return _0x158df4[_0x02f1('0x1e')](_0x02f1('0x1f'),_0x1763bc+'-'+_0x441bfc+'/'+_0x4b2083)[_0x02f1('0x1a')](_0x10de32);}return null;};}function patchUpdates(_0x51f6e0){return function(_0x1ae5ba){try{jsonpatch['apply'](_0x1ae5ba,_0x51f6e0,!![]);}catch(_0x3ba374){return BPromise['reject'](_0x3ba374);}return _0x1ae5ba[_0x02f1('0x20')]();};}function saveUpdates(_0x16b27e,_0x18665a){return function(_0x3b7ac5){if(_0x3b7ac5){return _0x3b7ac5[_0x02f1('0x21')](_0x16b27e)[_0x02f1('0x22')](function(_0x5d312f){return _0x5d312f;});}return null;};}function removeEntity(_0x4129f5,_0x4f09b1){return function(_0x48eecf){if(_0x48eecf){return _0x48eecf[_0x02f1('0x23')]()[_0x02f1('0x22')](function(){_0x4129f5[_0x02f1('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x55737d,_0x503d8a){return function(_0x4efd4c){if(!_0x4efd4c){_0x55737d[_0x02f1('0x17')](0x194);}return _0x4efd4c;};}function handleError(_0x8aee09,_0x1ba5da){_0x1ba5da=_0x1ba5da||0x1f4;return function(_0x56c6b8){logger[_0x02f1('0x24')](_0x56c6b8[_0x02f1('0x25')]);if(_0x56c6b8[_0x02f1('0x26')]){delete _0x56c6b8['name'];}_0x8aee09['status'](_0x1ba5da)['send'](_0x56c6b8);};}exports[_0x02f1('0x27')]=function(_0x105fa5,_0x379c95){var _0x4d6aff={},_0x1075d9={},_0x482f43={'count':0x0,'rows':[]};var _0x17cb83=_[_0x02f1('0x28')](db[_0x02f1('0x29')][_0x02f1('0x2a')],function(_0x2c7a80){return{'name':_0x2c7a80[_0x02f1('0x2b')],'type':_0x2c7a80[_0x02f1('0x2c')][_0x02f1('0x2d')]};});_0x1075d9[_0x02f1('0x2e')]=_[_0x02f1('0x28')](_0x17cb83,_0x02f1('0x26'));_0x1075d9[_0x02f1('0x2f')]=_['keys'](_0x105fa5[_0x02f1('0x2f')]);_0x1075d9['filters']=_['intersection'](_0x1075d9['model'],_0x1075d9[_0x02f1('0x2f')]);_0x4d6aff['attributes']=_[_0x02f1('0x30')](_0x1075d9[_0x02f1('0x2e')],qs[_0x02f1('0x31')](_0x105fa5['query'][_0x02f1('0x31')]));_0x4d6aff[_0x02f1('0x32')]=_0x4d6aff['attributes'][_0x02f1('0x33')]?_0x4d6aff[_0x02f1('0x32')]:_0x1075d9[_0x02f1('0x2e')];if(!_0x105fa5['query'][_0x02f1('0x34')]('nolimit')){_0x4d6aff[_0x02f1('0x1d')]=qs[_0x02f1('0x1d')](_0x105fa5[_0x02f1('0x2f')][_0x02f1('0x1d')]);_0x4d6aff[_0x02f1('0x1c')]=qs[_0x02f1('0x1c')](_0x105fa5[_0x02f1('0x2f')][_0x02f1('0x1c')]);}_0x4d6aff[_0x02f1('0x35')]=qs[_0x02f1('0x36')](_0x105fa5['query'][_0x02f1('0x36')]);_0x4d6aff[_0x02f1('0x37')]=qs[_0x02f1('0x38')](_[_0x02f1('0x39')](_0x105fa5[_0x02f1('0x2f')],_0x1075d9['filters']));if(_0x105fa5[_0x02f1('0x2f')][_0x02f1('0x3a')]){_0x4d6aff[_0x02f1('0x37')]=_[_0x02f1('0x3b')](_0x4d6aff['where'],{'$or':_[_0x02f1('0x28')](_0x17cb83,function(_0x215d67){if(_0x215d67[_0x02f1('0x2c')]!==_0x02f1('0x3c')){var _0x5249e5={};_0x5249e5[_0x215d67[_0x02f1('0x26')]]={'$like':'%'+_0x105fa5['query']['filter']+'%'};return _0x5249e5;}})});}_0x4d6aff=_[_0x02f1('0x3b')]({},_0x4d6aff,_0x105fa5['options']);var _0xd0c4f6={'where':_0x4d6aff[_0x02f1('0x37')]};return db[_0x02f1('0x29')]['count'](_0xd0c4f6)[_0x02f1('0x22')](function(_0x5a07fa){_0x482f43[_0x02f1('0x1b')]=_0x5a07fa;if(_0x105fa5[_0x02f1('0x2f')]['includeAll']){_0x4d6aff[_0x02f1('0x3d')]=[{'all':!![]}];}return db['MemberReport']['findAll'](_0x4d6aff);})[_0x02f1('0x22')](function(_0x13f917){_0x482f43[_0x02f1('0x3e')]=_0x13f917;return _0x482f43;})[_0x02f1('0x22')](respondWithFilteredResult(_0x379c95,_0x4d6aff))[_0x02f1('0x3f')](handleError(_0x379c95,null));};exports[_0x02f1('0x40')]=function(_0x45bae8,_0x1a4434){var _0x2422c3={'raw':!![],'where':{'id':_0x45bae8[_0x02f1('0x41')]['id']}},_0x5b7f58={};_0x5b7f58[_0x02f1('0x2e')]=_[_0x02f1('0x42')](db[_0x02f1('0x29')][_0x02f1('0x2a')]);_0x5b7f58['query']=_[_0x02f1('0x42')](_0x45bae8[_0x02f1('0x2f')]);_0x5b7f58['filters']=_[_0x02f1('0x30')](_0x5b7f58[_0x02f1('0x2e')],_0x5b7f58['query']);_0x2422c3[_0x02f1('0x32')]=_[_0x02f1('0x30')](_0x5b7f58['model'],qs[_0x02f1('0x31')](_0x45bae8['query'][_0x02f1('0x31')]));_0x2422c3[_0x02f1('0x32')]=_0x2422c3[_0x02f1('0x32')][_0x02f1('0x33')]?_0x2422c3[_0x02f1('0x32')]:_0x5b7f58[_0x02f1('0x2e')];if(_0x45bae8[_0x02f1('0x2f')][_0x02f1('0x43')]){_0x2422c3[_0x02f1('0x3d')]=[{'all':!![]}];}_0x2422c3=_[_0x02f1('0x3b')]({},_0x2422c3,_0x45bae8[_0x02f1('0x44')]);return db[_0x02f1('0x29')][_0x02f1('0x45')](_0x2422c3)[_0x02f1('0x22')](handleEntityNotFound(_0x1a4434,null))[_0x02f1('0x22')](respondWithResult(_0x1a4434,null))[_0x02f1('0x3f')](handleError(_0x1a4434,null));};exports[_0x02f1('0x46')]=function(_0x236eb3,_0x1e3ae8){return db[_0x02f1('0x29')][_0x02f1('0x46')](_0x236eb3[_0x02f1('0x47')],{})[_0x02f1('0x22')](respondWithResult(_0x1e3ae8,0xc9))[_0x02f1('0x3f')](handleError(_0x1e3ae8,null));};exports[_0x02f1('0x21')]=function(_0x1b7ffc,_0x1d8fe6){if(_0x1b7ffc[_0x02f1('0x47')]['id']){delete _0x1b7ffc['body']['id'];}return db[_0x02f1('0x29')][_0x02f1('0x45')]({'where':{'id':_0x1b7ffc[_0x02f1('0x41')]['id']}})[_0x02f1('0x22')](handleEntityNotFound(_0x1d8fe6,null))['then'](saveUpdates(_0x1b7ffc[_0x02f1('0x47')],null))[_0x02f1('0x22')](respondWithResult(_0x1d8fe6,null))['catch'](handleError(_0x1d8fe6,null));};exports[_0x02f1('0x23')]=function(_0x300aee,_0x2afb94){return db[_0x02f1('0x29')][_0x02f1('0x45')]({'where':{'id':_0x300aee[_0x02f1('0x41')]['id']}})['then'](handleEntityNotFound(_0x2afb94,null))['then'](removeEntity(_0x2afb94,null))[_0x02f1('0x3f')](handleError(_0x2afb94,null));};exports[_0x02f1('0x48')]=function(_0x5aece7,_0x1e996b){return db[_0x02f1('0x29')][_0x02f1('0x48')]()['then'](respondWithResult(_0x1e996b,null))[_0x02f1('0x3f')](handleError(_0x1e996b,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index 99fb0db..9a07dfd 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 _0xcff2=['path','rimraf','../../config/environment','./memberReport.attributes','exports','define','MemberReport','report_member','membername_interface','membername','lodash','util','api','moment','bluebird'];(function(_0x20e439,_0x1c2abd){var _0xc2dac9=function(_0x1e322d){while(--_0x1e322d){_0x20e439['push'](_0x20e439['shift']());}};_0xc2dac9(++_0x1c2abd);}(_0xcff2,0xa0));var _0x2cff=function(_0x30b0d8,_0x57470c){_0x30b0d8=_0x30b0d8-0x0;var _0x459c09=_0xcff2[_0x30b0d8];return _0x459c09;};'use strict';var _=require(_0x2cff('0x0'));var util=require(_0x2cff('0x1'));var logger=require('../../config/logger')(_0x2cff('0x2'));var moment=require(_0x2cff('0x3'));var BPromise=require(_0x2cff('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2cff('0x5'));var rimraf=require(_0x2cff('0x6'));var config=require(_0x2cff('0x7'));var attributes=require(_0x2cff('0x8'));module[_0x2cff('0x9')]=function(_0x440ab8,_0x224159){return _0x440ab8[_0x2cff('0xa')](_0x2cff('0xb'),attributes,{'tableName':_0x2cff('0xc'),'paranoid':![],'indexes':[{'name':_0x2cff('0xd'),'fields':[_0x2cff('0xe'),'interface']}],'timestamps':!![]});}; \ No newline at end of file +var _0xa0d8=['path','rimraf','../../config/environment','./memberReport.attributes','exports','define','report_member','membername_interface','membername','util','../../config/logger','api','bluebird','request-promise'];(function(_0xd92e35,_0x6004d0){var _0x18e1fc=function(_0x4a647b){while(--_0x4a647b){_0xd92e35['push'](_0xd92e35['shift']());}};_0x18e1fc(++_0x6004d0);}(_0xa0d8,0x113));var _0x8a0d=function(_0x2dedd1,_0x3b36bc){_0x2dedd1=_0x2dedd1-0x0;var _0x70dfd8=_0xa0d8[_0x2dedd1];return _0x70dfd8;};'use strict';var _=require('lodash');var util=require(_0x8a0d('0x0'));var logger=require(_0x8a0d('0x1'))(_0x8a0d('0x2'));var moment=require('moment');var BPromise=require(_0x8a0d('0x3'));var rp=require(_0x8a0d('0x4'));var fs=require('fs');var path=require(_0x8a0d('0x5'));var rimraf=require(_0x8a0d('0x6'));var config=require(_0x8a0d('0x7'));var attributes=require(_0x8a0d('0x8'));module[_0x8a0d('0x9')]=function(_0x2c36ae,_0x5675bb){return _0x2c36ae[_0x8a0d('0xa')]('MemberReport',attributes,{'tableName':_0x8a0d('0xb'),'paranoid':![],'indexes':[{'name':_0x8a0d('0xc'),'fields':[_0x8a0d('0xd'),'interface']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index 758dfd9..8e32f06 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 _0x6f3d=['catch','GetMemberReport','MemberReport','findAll','options','raw','attributes','include','map','model','create','body','CreateMemberReport','UpdateMemberReport','where','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','stringify','error','code','MemberReport,\x20%s,\x20%s','message','result'];(function(_0x1f1be2,_0x357b81){var _0x46c7bd=function(_0x1e28c5){while(--_0x1e28c5){_0x1f1be2['push'](_0x1f1be2['shift']());}};_0x46c7bd(++_0x357b81);}(_0x6f3d,0x7e));var _0xd6f3=function(_0x6bb9,_0x10f2b6){_0x6bb9=_0x6bb9-0x0;var _0xe3b3bc=_0x6f3d[_0x6bb9];return _0xe3b3bc;};'use strict';var _=require(_0xd6f3('0x0'));var util=require(_0xd6f3('0x1'));var moment=require(_0xd6f3('0x2'));var BPromise=require(_0xd6f3('0x3'));var rs=require(_0xd6f3('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xd6f3('0x5'));var logger=require(_0xd6f3('0x6'))(_0xd6f3('0x7'));var config=require(_0xd6f3('0x8'));var jayson=require(_0xd6f3('0x9'));var client=jayson[_0xd6f3('0xa')][_0xd6f3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xd04c0c,_0x5e1979,_0x2da365){return new BPromise(function(_0xe6809c,_0x44e6af){return client['request'](_0xd04c0c,_0x2da365)[_0xd6f3('0xc')](function(_0x3325ba){logger[_0xd6f3('0xd')]('MemberReport,\x20%s,\x20%s',_0x5e1979,_0xd6f3('0xe'));logger[_0xd6f3('0xf')]('MemberReport,\x20%s,\x20%s,\x20%s',_0x5e1979,_0xd6f3('0xe'),JSON[_0xd6f3('0x10')](_0x3325ba));if(_0x3325ba[_0xd6f3('0x11')]){if(_0x3325ba[_0xd6f3('0x11')][_0xd6f3('0x12')]===0x1f4){logger[_0xd6f3('0x11')](_0xd6f3('0x13'),_0x5e1979,_0x3325ba[_0xd6f3('0x11')][_0xd6f3('0x14')]);return _0x44e6af(_0x3325ba[_0xd6f3('0x11')][_0xd6f3('0x14')]);}logger['error'](_0xd6f3('0x13'),_0x5e1979,_0x3325ba[_0xd6f3('0x11')][_0xd6f3('0x14')]);return _0xe6809c(_0x3325ba[_0xd6f3('0x11')][_0xd6f3('0x14')]);}else{logger['info'](_0xd6f3('0x13'),_0x5e1979,_0xd6f3('0xe'));_0xe6809c(_0x3325ba[_0xd6f3('0x15')][_0xd6f3('0x14')]);}})[_0xd6f3('0x16')](function(_0x5a4ecc){logger[_0xd6f3('0x11')](_0xd6f3('0x13'),_0x5e1979,_0x5a4ecc);_0x44e6af(_0x5a4ecc);});});}exports[_0xd6f3('0x17')]=function(_0x1d030d){var _0x1ac4d9=this;return new Promise(function(_0x524c20,_0x1ce3a8){return db[_0xd6f3('0x18')][_0xd6f3('0x19')]({'raw':_0x1d030d[_0xd6f3('0x1a')]?_0x1d030d[_0xd6f3('0x1a')][_0xd6f3('0x1b')]===undefined?!![]:![]:!![],'where':_0x1d030d[_0xd6f3('0x1a')]?_0x1d030d[_0xd6f3('0x1a')]['where']||null:null,'attributes':_0x1d030d[_0xd6f3('0x1a')]?_0x1d030d[_0xd6f3('0x1a')][_0xd6f3('0x1c')]||null:null,'limit':_0x1d030d[_0xd6f3('0x1a')]?_0x1d030d[_0xd6f3('0x1a')]['limit']||null:null,'include':_0x1d030d[_0xd6f3('0x1a')]?_0x1d030d[_0xd6f3('0x1a')][_0xd6f3('0x1d')]?_[_0xd6f3('0x1e')](_0x1d030d['options'][_0xd6f3('0x1d')],function(_0x34d338){return{'model':db[_0x34d338[_0xd6f3('0x1f')]],'as':_0x34d338['as'],'attributes':_0x34d338[_0xd6f3('0x1c')],'include':_0x34d338[_0xd6f3('0x1d')]?_[_0xd6f3('0x1e')](_0x34d338[_0xd6f3('0x1d')],function(_0x4b245e){return{'model':db[_0x4b245e[_0xd6f3('0x1f')]],'as':_0x4b245e['as'],'attributes':_0x4b245e[_0xd6f3('0x1c')],'include':_0x4b245e[_0xd6f3('0x1d')]?_[_0xd6f3('0x1e')](_0x4b245e['include'],function(_0x5e1935){return{'model':db[_0x5e1935[_0xd6f3('0x1f')]],'as':_0x5e1935['as'],'attributes':_0x5e1935['attributes']};}):[]};}):[]};}):[]:[]})[_0xd6f3('0xc')](function(_0x2fed66){logger[_0xd6f3('0xd')](_0xd6f3('0x17'),_0x1d030d);logger[_0xd6f3('0xf')]('GetMemberReport',_0x1d030d,JSON[_0xd6f3('0x10')](_0x2fed66));_0x524c20(_0x2fed66);})['catch'](function(_0x3b34aa){logger[_0xd6f3('0x11')](_0xd6f3('0x17'),_0x3b34aa[_0xd6f3('0x14')],_0x1d030d);_0x1ce3a8(_0x1ac4d9['error'](0x1f4,_0x3b34aa['message']));});});};exports['CreateMemberReport']=function(_0x41b668){var _0x1b76b7=this;return new Promise(function(_0x46abbe,_0x5701ae){return db['MemberReport'][_0xd6f3('0x20')](_0x41b668[_0xd6f3('0x21')],{'raw':_0x41b668[_0xd6f3('0x1a')]?_0x41b668['options'][_0xd6f3('0x1b')]===undefined?!![]:![]:!![]})[_0xd6f3('0xc')](function(_0x13dd41){logger['info'](_0xd6f3('0x22'),_0x41b668);logger[_0xd6f3('0xf')]('CreateMemberReport',_0x41b668,JSON[_0xd6f3('0x10')](_0x13dd41));_0x46abbe(_0x13dd41);})[_0xd6f3('0x16')](function(_0x7fa138){logger['error'](_0xd6f3('0x22'),_0x7fa138[_0xd6f3('0x14')],_0x41b668);_0x5701ae(_0x1b76b7[_0xd6f3('0x11')](0x1f4,_0x7fa138['message']));});});};exports[_0xd6f3('0x23')]=function(_0x268e1b){var _0x251b87=this;return new Promise(function(_0x438678,_0xf71396){return db[_0xd6f3('0x18')]['update'](_0x268e1b['body'],{'raw':_0x268e1b[_0xd6f3('0x1a')]?_0x268e1b[_0xd6f3('0x1a')][_0xd6f3('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x268e1b[_0xd6f3('0x1a')]?_0x268e1b[_0xd6f3('0x1a')][_0xd6f3('0x24')]||null:null,'attributes':_0x268e1b[_0xd6f3('0x1a')]?_0x268e1b['options'][_0xd6f3('0x1c')]||null:null,'limit':_0x268e1b[_0xd6f3('0x1a')]?_0x268e1b[_0xd6f3('0x1a')]['limit']||null:null})[_0xd6f3('0xc')](function(_0x17ede5){logger[_0xd6f3('0xd')](_0xd6f3('0x23'),_0x268e1b);logger[_0xd6f3('0xf')](_0xd6f3('0x23'),_0x268e1b,JSON[_0xd6f3('0x10')](_0x17ede5));_0x438678(_0x17ede5);})[_0xd6f3('0x16')](function(_0x45c505){logger['error'](_0xd6f3('0x23'),_0x45c505['message'],_0x268e1b);_0xf71396(_0x251b87[_0xd6f3('0x11')](0x1f4,_0x45c505['message']));});});}; \ No newline at end of file +var _0xf590=['debug','CreateMemberReport','body','then','UpdateMemberReport','update','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','info','MemberReport,\x20%s,\x20%s','MemberReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','catch','GetMemberReport','MemberReport','options','raw','where','attributes','limit','include','map','model'];(function(_0x35c7ee,_0x1377c4){var _0x2e9f30=function(_0x4ac503){while(--_0x4ac503){_0x35c7ee['push'](_0x35c7ee['shift']());}};_0x2e9f30(++_0x1377c4);}(_0xf590,0x1c2));var _0x0f59=function(_0x127d55,_0x90027b){_0x127d55=_0x127d55-0x0;var _0x508ed8=_0xf590[_0x127d55];return _0x508ed8;};'use strict';var _=require(_0x0f59('0x0'));var util=require(_0x0f59('0x1'));var moment=require(_0x0f59('0x2'));var BPromise=require(_0x0f59('0x3'));var rs=require(_0x0f59('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0f59('0x5'))['db'];var utils=require(_0x0f59('0x6'));var logger=require(_0x0f59('0x7'))(_0x0f59('0x8'));var config=require('../../config/environment');var jayson=require(_0x0f59('0x9'));var client=jayson['client'][_0x0f59('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x18f681,_0x52c169,_0x154615){return new BPromise(function(_0x54bda3,_0x2def77){return client[_0x0f59('0xb')](_0x18f681,_0x154615)['then'](function(_0x33b5c5){logger[_0x0f59('0xc')](_0x0f59('0xd'),_0x52c169,'request\x20sent');logger['debug'](_0x0f59('0xe'),_0x52c169,_0x0f59('0xf'),JSON[_0x0f59('0x10')](_0x33b5c5));if(_0x33b5c5['error']){if(_0x33b5c5['error'][_0x0f59('0x11')]===0x1f4){logger[_0x0f59('0x12')](_0x0f59('0xd'),_0x52c169,_0x33b5c5[_0x0f59('0x12')][_0x0f59('0x13')]);return _0x2def77(_0x33b5c5[_0x0f59('0x12')][_0x0f59('0x13')]);}logger[_0x0f59('0x12')](_0x0f59('0xd'),_0x52c169,_0x33b5c5[_0x0f59('0x12')][_0x0f59('0x13')]);return _0x54bda3(_0x33b5c5[_0x0f59('0x12')][_0x0f59('0x13')]);}else{logger[_0x0f59('0xc')](_0x0f59('0xd'),_0x52c169,_0x0f59('0xf'));_0x54bda3(_0x33b5c5['result'][_0x0f59('0x13')]);}})[_0x0f59('0x14')](function(_0x3fc487){logger[_0x0f59('0x12')](_0x0f59('0xd'),_0x52c169,_0x3fc487);_0x2def77(_0x3fc487);});});}exports[_0x0f59('0x15')]=function(_0x1ed4a6){var _0x35c9ad=this;return new Promise(function(_0x3f69cc,_0x45fcf5){return db[_0x0f59('0x16')]['findAll']({'raw':_0x1ed4a6[_0x0f59('0x17')]?_0x1ed4a6[_0x0f59('0x17')][_0x0f59('0x18')]===undefined?!![]:![]:!![],'where':_0x1ed4a6[_0x0f59('0x17')]?_0x1ed4a6[_0x0f59('0x17')][_0x0f59('0x19')]||null:null,'attributes':_0x1ed4a6['options']?_0x1ed4a6[_0x0f59('0x17')][_0x0f59('0x1a')]||null:null,'limit':_0x1ed4a6['options']?_0x1ed4a6[_0x0f59('0x17')][_0x0f59('0x1b')]||null:null,'include':_0x1ed4a6[_0x0f59('0x17')]?_0x1ed4a6[_0x0f59('0x17')][_0x0f59('0x1c')]?_[_0x0f59('0x1d')](_0x1ed4a6[_0x0f59('0x17')]['include'],function(_0x4b9718){return{'model':db[_0x4b9718[_0x0f59('0x1e')]],'as':_0x4b9718['as'],'attributes':_0x4b9718[_0x0f59('0x1a')],'include':_0x4b9718[_0x0f59('0x1c')]?_[_0x0f59('0x1d')](_0x4b9718['include'],function(_0x550b41){return{'model':db[_0x550b41[_0x0f59('0x1e')]],'as':_0x550b41['as'],'attributes':_0x550b41[_0x0f59('0x1a')],'include':_0x550b41[_0x0f59('0x1c')]?_[_0x0f59('0x1d')](_0x550b41['include'],function(_0x3bcddd){return{'model':db[_0x3bcddd[_0x0f59('0x1e')]],'as':_0x3bcddd['as'],'attributes':_0x3bcddd['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x2fe99e){logger[_0x0f59('0xc')](_0x0f59('0x15'),_0x1ed4a6);logger[_0x0f59('0x1f')](_0x0f59('0x15'),_0x1ed4a6,JSON[_0x0f59('0x10')](_0x2fe99e));_0x3f69cc(_0x2fe99e);})['catch'](function(_0x117661){logger[_0x0f59('0x12')](_0x0f59('0x15'),_0x117661[_0x0f59('0x13')],_0x1ed4a6);_0x45fcf5(_0x35c9ad[_0x0f59('0x12')](0x1f4,_0x117661[_0x0f59('0x13')]));});});};exports[_0x0f59('0x20')]=function(_0x222fd3){var _0x41d337=this;return new Promise(function(_0x35019d,_0x4189e6){return db['MemberReport']['create'](_0x222fd3[_0x0f59('0x21')],{'raw':_0x222fd3[_0x0f59('0x17')]?_0x222fd3[_0x0f59('0x17')][_0x0f59('0x18')]===undefined?!![]:![]:!![]})[_0x0f59('0x22')](function(_0x185b75){logger[_0x0f59('0xc')]('CreateMemberReport',_0x222fd3);logger[_0x0f59('0x1f')](_0x0f59('0x20'),_0x222fd3,JSON['stringify'](_0x185b75));_0x35019d(_0x185b75);})['catch'](function(_0x2e295c){logger[_0x0f59('0x12')](_0x0f59('0x20'),_0x2e295c[_0x0f59('0x13')],_0x222fd3);_0x4189e6(_0x41d337[_0x0f59('0x12')](0x1f4,_0x2e295c[_0x0f59('0x13')]));});});};exports[_0x0f59('0x23')]=function(_0x1e1691){var _0x307177=this;return new Promise(function(_0x4e70bc,_0x3cadb2){return db[_0x0f59('0x16')][_0x0f59('0x24')](_0x1e1691[_0x0f59('0x21')],{'raw':_0x1e1691[_0x0f59('0x17')]?_0x1e1691[_0x0f59('0x17')][_0x0f59('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1e1691[_0x0f59('0x17')]?_0x1e1691[_0x0f59('0x17')]['where']||null:null,'attributes':_0x1e1691[_0x0f59('0x17')]?_0x1e1691[_0x0f59('0x17')]['attributes']||null:null,'limit':_0x1e1691[_0x0f59('0x17')]?_0x1e1691[_0x0f59('0x17')][_0x0f59('0x1b')]||null:null})[_0x0f59('0x22')](function(_0x4923b9){logger[_0x0f59('0xc')](_0x0f59('0x23'),_0x1e1691);logger['debug'](_0x0f59('0x23'),_0x1e1691,JSON[_0x0f59('0x10')](_0x4923b9));_0x4e70bc(_0x4923b9);})[_0x0f59('0x14')](function(_0x161400){logger['error']('UpdateMemberReport',_0x161400['message'],_0x1e1691);_0x3cadb2(_0x307177[_0x0f59('0x12')](0x1f4,_0x161400[_0x0f59('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index b77b6fc..a0e8289 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 _0x96cc=['exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./migration.controller','get','index'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x96cc,0x16c));var _0xc96c=function(_0x15542f,_0x3d79d6){_0x15542f=_0x15542f-0x0;var _0x3f2d03=_0x96cc[_0x15542f];return _0x3f2d03;};'use strict';var multer=require(_0xc96c('0x0'));var util=require('util');var path=require(_0xc96c('0x1'));var timeout=require('connect-timeout');var express=require(_0xc96c('0x2'));var router=express[_0xc96c('0x3')]();var auth=require(_0xc96c('0x4'));var interaction=require(_0xc96c('0x5'));var config=require(_0xc96c('0x6'));var controller=require(_0xc96c('0x7'));router[_0xc96c('0x8')]('/',controller[_0xc96c('0x9')]);module[_0xc96c('0xa')]=router; \ No newline at end of file +var _0x7d25=['../../components/interaction/service','exports','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x7d25,0x8a));var _0x57d2=function(_0x616290,_0x280b7f){_0x616290=_0x616290-0x0;var _0x453879=_0x7d25[_0x616290];return _0x453879;};'use strict';var multer=require('multer');var util=require(_0x57d2('0x0'));var path=require(_0x57d2('0x1'));var timeout=require(_0x57d2('0x2'));var express=require(_0x57d2('0x3'));var router=express[_0x57d2('0x4')]();var auth=require(_0x57d2('0x5'));var interaction=require(_0x57d2('0x6'));var config=require('../../config/environment');var controller=require('./migration.controller');router['get']('/',controller['index']);module[_0x57d2('0x7')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index 55a3bef..97cc8b3 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 _0xa0fb=['version','exports','STRING'];(function(_0x587dd0,_0x273922){var _0x56f153=function(_0x27fb33){while(--_0x27fb33){_0x587dd0['push'](_0x587dd0['shift']());}};_0x56f153(++_0x273922);}(_0xa0fb,0x1cf));var _0xba0f=function(_0x4019e5,_0xce1e39){_0x4019e5=_0x4019e5-0x0;var _0x5084af=_0xa0fb[_0x4019e5];return _0x5084af;};'use strict';var Sequelize=require('sequelize');module[_0xba0f('0x0')]={'version':{'type':Sequelize[_0xba0f('0x1')],'unique':_0xba0f('0x2')}}; \ No newline at end of file +var _0xd45c=['STRING','version','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd45c,0x9e));var _0xcd45=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xd45c[_0x2c91e9];return _0x13f0ff;};'use strict';var Sequelize=require(_0xcd45('0x0'));module[_0xcd45('0x1')]={'version':{'type':Sequelize[_0xcd45('0x2')],'unique':_0xcd45('0x3')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 9d1c6a8..1853c26 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 _0x5f2f=['desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','end','error','stack','name','send','index','map','fieldName','type','query','keys','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','Migration','then','include','rows','catch','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','jsforce'];(function(_0x3e332b,_0x54cde6){var _0x1794ef=function(_0x408708){while(--_0x408708){_0x3e332b['push'](_0x3e332b['shift']());}};_0x1794ef(++_0x54cde6);}(_0x5f2f,0x73));var _0xf5f2=function(_0x1b6a50,_0x596246){_0x1b6a50=_0x1b6a50-0x0;var _0x4d5212=_0x5f2f[_0x1b6a50];return _0x4d5212;};'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 Redis=require(_0xf5f2('0x11'));var authService=require(_0xf5f2('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xf5f2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf5f2('0x14'));var utils=require(_0xf5f2('0x15'));var config=require('../../config/environment');var db=require(_0xf5f2('0x16'))['db'];function respondWithStatusCode(_0x14b51f,_0x331482){_0x331482=_0x331482||0xcc;return function(_0x3f2997){if(_0x3f2997){return _0x14b51f[_0xf5f2('0x17')](_0x331482);}return _0x14b51f[_0xf5f2('0x18')](_0x331482)['end']();};}function respondWithResult(_0x5850f4,_0xea612c){_0xea612c=_0xea612c||0xc8;return function(_0x269909){if(_0x269909){return _0x5850f4[_0xf5f2('0x18')](_0xea612c)[_0xf5f2('0x19')](_0x269909);}};}function respondWithFilteredResult(_0x4d97fc,_0xafe430){return function(_0x286197){if(_0x286197){var _0x17d656=_0x286197[_0xf5f2('0x1a')],_0x1b6dd2=_0xafe430[_0xf5f2('0x1b')],_0x23e23a=_0xafe430[_0xf5f2('0x1b')]+_0xafe430[_0xf5f2('0x1c')],_0x3a9dbb;if(_0x23e23a>=_0x17d656){_0x23e23a=_0x17d656;_0x3a9dbb=0xc8;}else{_0x3a9dbb=0xce;}_0x4d97fc[_0xf5f2('0x18')](_0x3a9dbb);return _0x4d97fc[_0xf5f2('0x1d')](_0xf5f2('0x1e'),_0x1b6dd2+'-'+_0x23e23a+'/'+_0x17d656)[_0xf5f2('0x19')](_0x286197);}return null;};}function patchUpdates(_0x3cf5ea){return function(_0x626999){try{jsonpatch[_0xf5f2('0x1f')](_0x626999,_0x3cf5ea,!![]);}catch(_0x56acc5){return BPromise[_0xf5f2('0x20')](_0x56acc5);}return _0x626999[_0xf5f2('0x21')]();};}function saveUpdates(_0x49dac2,_0x47acfc){return function(_0x2d2805){if(_0x2d2805){return _0x2d2805[_0xf5f2('0x22')](_0x49dac2)['then'](function(_0x45b74f){return _0x45b74f;});}return null;};}function removeEntity(_0x170042,_0x39e44a){return function(_0x39c024){if(_0x39c024){return _0x39c024[_0xf5f2('0x23')]()['then'](function(){_0x170042[_0xf5f2('0x18')](0xcc)[_0xf5f2('0x24')]();});}};}function handleEntityNotFound(_0x4e8bda,_0x2833fe){return function(_0x287ad5){if(!_0x287ad5){_0x4e8bda['sendStatus'](0x194);}return _0x287ad5;};}function handleError(_0x529f07,_0x5f1124){_0x5f1124=_0x5f1124||0x1f4;return function(_0x3f79d5){logger[_0xf5f2('0x25')](_0x3f79d5[_0xf5f2('0x26')]);if(_0x3f79d5[_0xf5f2('0x27')]){delete _0x3f79d5[_0xf5f2('0x27')];}_0x529f07[_0xf5f2('0x18')](_0x5f1124)[_0xf5f2('0x28')](_0x3f79d5);};}exports[_0xf5f2('0x29')]=function(_0x4ab014,_0xaa2602){var _0x102449={},_0x375ca8={},_0x31bfcb={'count':0x0,'rows':[]};var _0x198c73=_[_0xf5f2('0x2a')](db['Migration']['rawAttributes'],function(_0x22c826){return{'name':_0x22c826[_0xf5f2('0x2b')],'type':_0x22c826[_0xf5f2('0x2c')]['key']};});_0x375ca8['model']=_[_0xf5f2('0x2a')](_0x198c73,_0xf5f2('0x27'));_0x375ca8[_0xf5f2('0x2d')]=_[_0xf5f2('0x2e')](_0x4ab014[_0xf5f2('0x2d')]);_0x375ca8['filters']=_['intersection'](_0x375ca8[_0xf5f2('0x2f')],_0x375ca8['query']);_0x102449[_0xf5f2('0x30')]=_['intersection'](_0x375ca8[_0xf5f2('0x2f')],qs[_0xf5f2('0x31')](_0x4ab014[_0xf5f2('0x2d')][_0xf5f2('0x31')]));_0x102449[_0xf5f2('0x30')]=_0x102449[_0xf5f2('0x30')][_0xf5f2('0x32')]?_0x102449[_0xf5f2('0x30')]:_0x375ca8['model'];if(!_0x4ab014[_0xf5f2('0x2d')][_0xf5f2('0x33')](_0xf5f2('0x34'))){_0x102449[_0xf5f2('0x1c')]=qs[_0xf5f2('0x1c')](_0x4ab014[_0xf5f2('0x2d')][_0xf5f2('0x1c')]);_0x102449['offset']=qs[_0xf5f2('0x1b')](_0x4ab014[_0xf5f2('0x2d')]['offset']);}_0x102449[_0xf5f2('0x35')]=qs['sort'](_0x4ab014[_0xf5f2('0x2d')][_0xf5f2('0x36')]);_0x102449[_0xf5f2('0x37')]=qs[_0xf5f2('0x38')](_['pick'](_0x4ab014['query'],_0x375ca8[_0xf5f2('0x38')]));if(_0x4ab014[_0xf5f2('0x2d')][_0xf5f2('0x39')]){_0x102449['where']=_[_0xf5f2('0x3a')](_0x102449['where'],{'$or':_[_0xf5f2('0x2a')](_0x198c73,function(_0x566c47){if(_0x566c47[_0xf5f2('0x2c')]!==_0xf5f2('0x3b')){var _0x5337a6={};_0x5337a6[_0x566c47[_0xf5f2('0x27')]]={'$like':'%'+_0x4ab014[_0xf5f2('0x2d')][_0xf5f2('0x39')]+'%'};return _0x5337a6;}})});}_0x102449=_[_0xf5f2('0x3a')]({},_0x102449,_0x4ab014['options']);var _0x5d2d82={'where':_0x102449[_0xf5f2('0x37')]};return db[_0xf5f2('0x3c')][_0xf5f2('0x1a')](_0x5d2d82)[_0xf5f2('0x3d')](function(_0x2c7f65){_0x31bfcb[_0xf5f2('0x1a')]=_0x2c7f65;if(_0x4ab014[_0xf5f2('0x2d')]['includeAll']){_0x102449[_0xf5f2('0x3e')]=[{'all':!![]}];}return db[_0xf5f2('0x3c')]['findAll'](_0x102449);})[_0xf5f2('0x3d')](function(_0x3f3895){_0x31bfcb[_0xf5f2('0x3f')]=_0x3f3895;return _0x31bfcb;})[_0xf5f2('0x3d')](respondWithFilteredResult(_0xaa2602,_0x102449))[_0xf5f2('0x40')](handleError(_0xaa2602,null));}; \ No newline at end of file +var _0xb10b=['papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','then','destroy','name','send','map','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','Migration','include','rows','catch','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring'];(function(_0x5d7cfe,_0x33dee5){var _0x555164=function(_0x2f241e){while(--_0x2f241e){_0x5d7cfe['push'](_0x5d7cfe['shift']());}};_0x555164(++_0x33dee5);}(_0xb10b,0x12a));var _0xbb10=function(_0x5404e9,_0x132866){_0x5404e9=_0x5404e9-0x0;var _0x2d7c75=_0xb10b[_0x5404e9];return _0x2d7c75;};'use strict';var pdf=require(_0xbb10('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xbb10('0x1'));var zipdir=require(_0xbb10('0x2'));var jsonpatch=require(_0xbb10('0x3'));var rp=require('request-promise');var moment=require(_0xbb10('0x4'));var BPromise=require(_0xbb10('0x5'));var Mustache=require(_0xbb10('0x6'));var util=require(_0xbb10('0x7'));var path=require(_0xbb10('0x8'));var sox=require(_0xbb10('0x9'));var csv=require('to-csv');var ejs=require(_0xbb10('0xa'));var fs=require('fs');var _=require(_0xbb10('0xb'));var squel=require('squel');var crypto=require(_0xbb10('0xc'));var jsforce=require(_0xbb10('0xd'));var deskjs=require(_0xbb10('0xe'));var toCsv=require(_0xbb10('0xf'));var querystring=require(_0xbb10('0x10'));var Papa=require(_0xbb10('0x11'));var Redis=require(_0xbb10('0x12'));var authService=require(_0xbb10('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbb10('0x14'));var logger=require(_0xbb10('0x15'))(_0xbb10('0x16'));var utils=require('../../config/utils');var config=require(_0xbb10('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x44fb19,_0x916a32){_0x916a32=_0x916a32||0xcc;return function(_0x285009){if(_0x285009){return _0x44fb19[_0xbb10('0x18')](_0x916a32);}return _0x44fb19[_0xbb10('0x19')](_0x916a32)[_0xbb10('0x1a')]();};}function respondWithResult(_0x58a612,_0x26e021){_0x26e021=_0x26e021||0xc8;return function(_0x42d7e4){if(_0x42d7e4){return _0x58a612[_0xbb10('0x19')](_0x26e021)[_0xbb10('0x1b')](_0x42d7e4);}};}function respondWithFilteredResult(_0x3df17b,_0x2f2ebf){return function(_0x24a57b){if(_0x24a57b){var _0x36b5e8=_0x24a57b[_0xbb10('0x1c')],_0x3e26f4=_0x2f2ebf[_0xbb10('0x1d')],_0x2b184e=_0x2f2ebf[_0xbb10('0x1d')]+_0x2f2ebf[_0xbb10('0x1e')],_0x4a2bfc;if(_0x2b184e>=_0x36b5e8){_0x2b184e=_0x36b5e8;_0x4a2bfc=0xc8;}else{_0x4a2bfc=0xce;}_0x3df17b[_0xbb10('0x19')](_0x4a2bfc);return _0x3df17b[_0xbb10('0x1f')](_0xbb10('0x20'),_0x3e26f4+'-'+_0x2b184e+'/'+_0x36b5e8)[_0xbb10('0x1b')](_0x24a57b);}return null;};}function patchUpdates(_0xbf2906){return function(_0xe1c665){try{jsonpatch['apply'](_0xe1c665,_0xbf2906,!![]);}catch(_0x5ff0cf){return BPromise[_0xbb10('0x21')](_0x5ff0cf);}return _0xe1c665[_0xbb10('0x22')]();};}function saveUpdates(_0x109908,_0xdf237d){return function(_0x44e563){if(_0x44e563){return _0x44e563['update'](_0x109908)[_0xbb10('0x23')](function(_0x12ef77){return _0x12ef77;});}return null;};}function removeEntity(_0x50aea1,_0x4c4b0d){return function(_0x8e2b97){if(_0x8e2b97){return _0x8e2b97[_0xbb10('0x24')]()[_0xbb10('0x23')](function(){_0x50aea1[_0xbb10('0x19')](0xcc)[_0xbb10('0x1a')]();});}};}function handleEntityNotFound(_0x1824b7,_0x407cb4){return function(_0x436104){if(!_0x436104){_0x1824b7[_0xbb10('0x18')](0x194);}return _0x436104;};}function handleError(_0x395404,_0x3ba6cd){_0x3ba6cd=_0x3ba6cd||0x1f4;return function(_0x26ad93){logger['error'](_0x26ad93['stack']);if(_0x26ad93['name']){delete _0x26ad93[_0xbb10('0x25')];}_0x395404[_0xbb10('0x19')](_0x3ba6cd)[_0xbb10('0x26')](_0x26ad93);};}exports['index']=function(_0x2fdde9,_0x24d586){var _0x6ed43b={},_0x1d5e95={},_0x1acce9={'count':0x0,'rows':[]};var _0x20d946=_[_0xbb10('0x27')](db['Migration'][_0xbb10('0x28')],function(_0x21ac54){return{'name':_0x21ac54[_0xbb10('0x29')],'type':_0x21ac54[_0xbb10('0x2a')][_0xbb10('0x2b')]};});_0x1d5e95[_0xbb10('0x2c')]=_['map'](_0x20d946,_0xbb10('0x25'));_0x1d5e95['query']=_[_0xbb10('0x2d')](_0x2fdde9['query']);_0x1d5e95[_0xbb10('0x2e')]=_[_0xbb10('0x2f')](_0x1d5e95[_0xbb10('0x2c')],_0x1d5e95['query']);_0x6ed43b['attributes']=_[_0xbb10('0x2f')](_0x1d5e95[_0xbb10('0x2c')],qs['fields'](_0x2fdde9[_0xbb10('0x30')][_0xbb10('0x31')]));_0x6ed43b[_0xbb10('0x32')]=_0x6ed43b[_0xbb10('0x32')][_0xbb10('0x33')]?_0x6ed43b[_0xbb10('0x32')]:_0x1d5e95[_0xbb10('0x2c')];if(!_0x2fdde9['query'][_0xbb10('0x34')](_0xbb10('0x35'))){_0x6ed43b[_0xbb10('0x1e')]=qs[_0xbb10('0x1e')](_0x2fdde9[_0xbb10('0x30')][_0xbb10('0x1e')]);_0x6ed43b[_0xbb10('0x1d')]=qs[_0xbb10('0x1d')](_0x2fdde9[_0xbb10('0x30')]['offset']);}_0x6ed43b[_0xbb10('0x36')]=qs[_0xbb10('0x37')](_0x2fdde9[_0xbb10('0x30')][_0xbb10('0x37')]);_0x6ed43b['where']=qs[_0xbb10('0x2e')](_['pick'](_0x2fdde9['query'],_0x1d5e95[_0xbb10('0x2e')]));if(_0x2fdde9[_0xbb10('0x30')][_0xbb10('0x38')]){_0x6ed43b[_0xbb10('0x39')]=_[_0xbb10('0x3a')](_0x6ed43b[_0xbb10('0x39')],{'$or':_['map'](_0x20d946,function(_0x1e5bbd){if(_0x1e5bbd[_0xbb10('0x2a')]!=='VIRTUAL'){var _0x5e3fbd={};_0x5e3fbd[_0x1e5bbd['name']]={'$like':'%'+_0x2fdde9[_0xbb10('0x30')][_0xbb10('0x38')]+'%'};return _0x5e3fbd;}})});}_0x6ed43b=_[_0xbb10('0x3a')]({},_0x6ed43b,_0x2fdde9['options']);var _0x3c0cd7={'where':_0x6ed43b[_0xbb10('0x39')]};return db[_0xbb10('0x3b')]['count'](_0x3c0cd7)[_0xbb10('0x23')](function(_0x12238a){_0x1acce9[_0xbb10('0x1c')]=_0x12238a;if(_0x2fdde9[_0xbb10('0x30')]['includeAll']){_0x6ed43b[_0xbb10('0x3c')]=[{'all':!![]}];}return db[_0xbb10('0x3b')]['findAll'](_0x6ed43b);})[_0xbb10('0x23')](function(_0x2e3214){_0x1acce9[_0xbb10('0x3d')]=_0x2e3214;return _0x1acce9;})[_0xbb10('0x23')](respondWithFilteredResult(_0x24d586,_0x6ed43b))[_0xbb10('0x3e')](handleError(_0x24d586,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index 70e4a81..533f666 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 _0x8949=['request-promise','path','../../config/environment','./migration.attributes','define','Migration','migrations','util','api','moment','bluebird'];(function(_0x39e2d7,_0x1b15f6){var _0x413d0d=function(_0x3af71d){while(--_0x3af71d){_0x39e2d7['push'](_0x39e2d7['shift']());}};_0x413d0d(++_0x1b15f6);}(_0x8949,0x1b4));var _0x9894=function(_0x3590ed,_0x3a4587){_0x3590ed=_0x3590ed-0x0;var _0x21f72f=_0x8949[_0x3590ed];return _0x21f72f;};'use strict';var _=require('lodash');var util=require(_0x9894('0x0'));var logger=require('../../config/logger')(_0x9894('0x1'));var moment=require(_0x9894('0x2'));var BPromise=require(_0x9894('0x3'));var rp=require(_0x9894('0x4'));var fs=require('fs');var path=require(_0x9894('0x5'));var rimraf=require('rimraf');var config=require(_0x9894('0x6'));var attributes=require(_0x9894('0x7'));module['exports']=function(_0x524d84,_0x13ec6d){return _0x524d84[_0x9894('0x8')](_0x9894('0x9'),attributes,{'tableName':_0x9894('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xce6f=['exports','define','Migration','migrations','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./migration.attributes'];(function(_0x4899a6,_0x166884){var _0x4753cf=function(_0x6c54d7){while(--_0x6c54d7){_0x4899a6['push'](_0x4899a6['shift']());}};_0x4753cf(++_0x166884);}(_0xce6f,0xba));var _0xfce6=function(_0x1e2a9e,_0x3183ef){_0x1e2a9e=_0x1e2a9e-0x0;var _0x2283b6=_0xce6f[_0x1e2a9e];return _0x2283b6;};'use strict';var _=require('lodash');var util=require(_0xfce6('0x0'));var logger=require(_0xfce6('0x1'))(_0xfce6('0x2'));var moment=require(_0xfce6('0x3'));var BPromise=require('bluebird');var rp=require(_0xfce6('0x4'));var fs=require('fs');var path=require(_0xfce6('0x5'));var rimraf=require(_0xfce6('0x6'));var config=require(_0xfce6('0x7'));var attributes=require(_0xfce6('0x8'));module[_0xfce6('0x9')]=function(_0xbdf070,_0x387738){return _0xbdf070[_0xfce6('0xa')](_0xfce6('0xb'),attributes,{'tableName':_0xfce6('0xc'),'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 eb537c7..3510143 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 _0x560e=['../../config/environment','jayson/promise','http','request','then','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x19d433,_0x4b63f8){var _0x18d114=function(_0x3f3d45){while(--_0x3f3d45){_0x19d433['push'](_0x19d433['shift']());}};_0x18d114(++_0x4b63f8);}(_0x560e,0x1ee));var _0xe560=function(_0x2eb6f6,_0x2476fa){_0x2eb6f6=_0x2eb6f6-0x0;var _0x2387f6=_0x560e[_0x2eb6f6];return _0x2387f6;};'use strict';var _=require(_0xe560('0x0'));var util=require(_0xe560('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe560('0x2'))['db'];var utils=require(_0xe560('0x3'));var logger=require(_0xe560('0x4'))(_0xe560('0x5'));var config=require(_0xe560('0x6'));var jayson=require(_0xe560('0x7'));var client=jayson['client'][_0xe560('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4d75b7,_0x91d4c4,_0x35137f){return new BPromise(function(_0x2db1d2,_0x4cc43a){return client[_0xe560('0x9')](_0x4d75b7,_0x35137f)[_0xe560('0xa')](function(_0x3e4995){logger['info'](_0xe560('0xb'),_0x91d4c4,_0xe560('0xc'));logger[_0xe560('0xd')](_0xe560('0xe'),_0x91d4c4,_0xe560('0xc'),JSON[_0xe560('0xf')](_0x3e4995));if(_0x3e4995['error']){if(_0x3e4995[_0xe560('0x10')][_0xe560('0x11')]===0x1f4){logger[_0xe560('0x10')](_0xe560('0xb'),_0x91d4c4,_0x3e4995[_0xe560('0x10')]['message']);return _0x4cc43a(_0x3e4995[_0xe560('0x10')][_0xe560('0x12')]);}logger[_0xe560('0x10')](_0xe560('0xb'),_0x91d4c4,_0x3e4995[_0xe560('0x10')]['message']);return _0x2db1d2(_0x3e4995['error'][_0xe560('0x12')]);}else{logger['info'](_0xe560('0xb'),_0x91d4c4,_0xe560('0xc'));_0x2db1d2(_0x3e4995['result'][_0xe560('0x12')]);}})[_0xe560('0x13')](function(_0x4c0c9e){logger[_0xe560('0x10')](_0xe560('0xb'),_0x91d4c4,_0x4c0c9e);_0x4cc43a(_0x4c0c9e);});});} \ No newline at end of file +var _0xdf9f=['../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util'];(function(_0x7791d5,_0xdab65f){var _0x5ce288=function(_0x2b818d){while(--_0x2b818d){_0x7791d5['push'](_0x7791d5['shift']());}};_0x5ce288(++_0xdab65f);}(_0xdf9f,0x10f));var _0xfdf9=function(_0x4d149c,_0x3efebe){_0x4d149c=_0x4d149c-0x0;var _0x293ed7=_0xdf9f[_0x4d149c];return _0x293ed7;};'use strict';var _=require(_0xfdf9('0x0'));var util=require(_0xfdf9('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfdf9('0x2'))['db'];var utils=require(_0xfdf9('0x3'));var logger=require('../../config/logger')(_0xfdf9('0x4'));var config=require('../../config/environment');var jayson=require(_0xfdf9('0x5'));var client=jayson[_0xfdf9('0x6')][_0xfdf9('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x14b7f7,_0x41e57d,_0x2b0bc2){return new BPromise(function(_0x57bfe3,_0x4330b8){return client[_0xfdf9('0x8')](_0x14b7f7,_0x2b0bc2)[_0xfdf9('0x9')](function(_0x111514){logger[_0xfdf9('0xa')](_0xfdf9('0xb'),_0x41e57d,_0xfdf9('0xc'));logger[_0xfdf9('0xd')](_0xfdf9('0xe'),_0x41e57d,_0xfdf9('0xc'),JSON[_0xfdf9('0xf')](_0x111514));if(_0x111514[_0xfdf9('0x10')]){if(_0x111514['error'][_0xfdf9('0x11')]===0x1f4){logger[_0xfdf9('0x10')](_0xfdf9('0xb'),_0x41e57d,_0x111514['error'][_0xfdf9('0x12')]);return _0x4330b8(_0x111514[_0xfdf9('0x10')][_0xfdf9('0x12')]);}logger[_0xfdf9('0x10')](_0xfdf9('0xb'),_0x41e57d,_0x111514[_0xfdf9('0x10')]['message']);return _0x57bfe3(_0x111514[_0xfdf9('0x10')][_0xfdf9('0x12')]);}else{logger['info']('Migration,\x20%s,\x20%s',_0x41e57d,_0xfdf9('0xc'));_0x57bfe3(_0x111514[_0xfdf9('0x13')]['message']);}})[_0xfdf9('0x14')](function(_0x3adccd){logger[_0xfdf9('0x10')](_0xfdf9('0xb'),_0x41e57d,_0x3adccd);_0x4330b8(_0x3adccd);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 33e3c24..9532105 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 _0xebc8=['/:id','update','delete','destroy','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','post','create','put'];(function(_0x3d469c,_0x12086f){var _0x40749b=function(_0x20132c){while(--_0x20132c){_0x3d469c['push'](_0x3d469c['shift']());}};_0x40749b(++_0x12086f);}(_0xebc8,0x94));var _0x8ebc=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xebc8[_0x6c993a];return _0x27f547;};'use strict';var multer=require('multer');var util=require(_0x8ebc('0x0'));var path=require('path');var timeout=require(_0x8ebc('0x1'));var express=require(_0x8ebc('0x2'));var router=express[_0x8ebc('0x3')]();var auth=require(_0x8ebc('0x4'));var interaction=require(_0x8ebc('0x5'));var config=require(_0x8ebc('0x6'));var controller=require('./network.controller');router['get']('/',auth[_0x8ebc('0x7')](),controller['index']);router[_0x8ebc('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x8ebc('0x9')]('/',auth[_0x8ebc('0x7')](),controller[_0x8ebc('0xa')]);router[_0x8ebc('0xb')](_0x8ebc('0xc'),auth[_0x8ebc('0x7')](),controller[_0x8ebc('0xd')]);router[_0x8ebc('0xe')]('/:id',auth[_0x8ebc('0x7')](),controller[_0x8ebc('0xf')]);module['exports']=router; \ No newline at end of file +var _0x39c7=['isAuthenticated','put','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./network.controller','get','/:id','post'];(function(_0x4166b0,_0x3b5e5a){var _0x50b286=function(_0x494d11){while(--_0x494d11){_0x4166b0['push'](_0x4166b0['shift']());}};_0x50b286(++_0x3b5e5a);}(_0x39c7,0x85));var _0x739c=function(_0x40c345,_0xae1650){_0x40c345=_0x40c345-0x0;var _0x5c8bed=_0x39c7[_0x40c345];return _0x5c8bed;};'use strict';var multer=require('multer');var util=require(_0x739c('0x0'));var path=require(_0x739c('0x1'));var timeout=require(_0x739c('0x2'));var express=require(_0x739c('0x3'));var router=express[_0x739c('0x4')]();var auth=require(_0x739c('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x739c('0x6'));var controller=require(_0x739c('0x7'));router[_0x739c('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x739c('0x8')](_0x739c('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x739c('0xa')]('/',auth[_0x739c('0xb')](),controller['create']);router[_0x739c('0xc')](_0x739c('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x739c('0xd')](_0x739c('0x9'),auth[_0x739c('0xb')](),controller[_0x739c('0xe')]);module[_0x739c('0xf')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index 6c6e91e..b8e7925 100644 --- a/server/api/network/network.attributes.js +++ b/server/api/network/network.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['STRING','sequelize','exports','ENUM','stun'];(function(_0x510164,_0x38128b){var _0x51ab16=function(_0x5c86a9){while(--_0x5c86a9){_0x510164['push'](_0x510164['shift']());}};_0x51ab16(++_0x38128b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0xa9e0[_0x187ee1];return _0x388160;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'type':{'type':Sequelize[_0x0a9e('0x2')]('localnet','externip',_0x0a9e('0x3'),'turn')},'value':{'type':Sequelize[_0x0a9e('0x4')]},'username':{'type':Sequelize[_0x0a9e('0x4')]},'password':{'type':Sequelize[_0x0a9e('0x4')]}}; \ No newline at end of file +var _0xa9e0=['STRING','sequelize','exports','ENUM','stun'];(function(_0x265ed7,_0x9bc8f7){var _0x2648a2=function(_0x10bbbe){while(--_0x10bbbe){_0x265ed7['push'](_0x265ed7['shift']());}};_0x2648a2(++_0x9bc8f7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xa9e0[_0x2bf141];return _0x48277b;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'type':{'type':Sequelize[_0x0a9e('0x2')]('localnet','externip',_0x0a9e('0x3'),'turn')},'value':{'type':Sequelize[_0x0a9e('0x4')]},'username':{'type':Sequelize[_0x0a9e('0x4')]},'password':{'type':Sequelize[_0x0a9e('0x4')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index 3b899a7..9c97897 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 _0xcae8=['to-csv','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info','request\x20sent','debug','stringify','error','code','Network,\x20%s,\x20%s','message','result','catch','status','end','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','sendStatus','stack','name','index','map','Network','rawAttributes','type','key','model','keys','query','intersection','attributes','fields','limit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','create','sequelize','body','toUpperCase','STUN','readFileSync','join','root','server/files/templates/stun_multiple.ejs','utf8','render','writeFileSync','Reload','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','transaction','find','/etc/asterisk/stun_xcally.conf','res_stun_monitor.so','TURN','server/files/templates/turn_multiple.ejs','server/files/templates/network.ejs','/etc/asterisk/turn_xcally.conf','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','sox'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0xcae8,0xcb));var _0x8cae=function(_0x1306f3,_0x1da761){_0x1306f3=_0x1306f3-0x0;var _0xc1c7bf=_0xcae8[_0x1306f3];return _0xc1c7bf;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x8cae('0x0'));var zipdir=require(_0x8cae('0x1'));var jsonpatch=require(_0x8cae('0x2'));var rp=require(_0x8cae('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x8cae('0x4'));var util=require(_0x8cae('0x5'));var path=require('path');var sox=require(_0x8cae('0x6'));var csv=require(_0x8cae('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x8cae('0x8'));var squel=require(_0x8cae('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x8cae('0xa'));var toCsv=require(_0x8cae('0x7'));var querystring=require('querystring');var Papa=require(_0x8cae('0xb'));var Redis=require(_0x8cae('0xc'));var authService=require(_0x8cae('0xd'));var qs=require(_0x8cae('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8cae('0xf'));var logger=require('../../config/logger')('api');var utils=require(_0x8cae('0x10'));var config=require(_0x8cae('0x11'));var db=require(_0x8cae('0x12'))['db'];var jayson=require(_0x8cae('0x13'));var client=jayson[_0x8cae('0x14')][_0x8cae('0x15')]({'port':0x232a});function checkPasswordPattern(_0x1c420a,_0x2d526d,_0x3ec480){if(_0x3ec480){var _0x5a5e24=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5a5e24[_0x8cae('0x16')](_0x2d526d)){return _0x1c420a;}else{throw new db[(_0x8cae('0x17'))][(_0x8cae('0x18'))](_0x8cae('0x19'));}}else{return _0x1c420a;}}function respondWithRpcPromise(_0x180ac4,_0x10c941,_0x154076,_0x25e9fa){return new BPromise(function(_0x378724,_0x207861){var _0x356675=_0x25e9fa||client;return _0x356675[_0x8cae('0x1a')](_0x180ac4,_0x154076)['then'](function(_0x14999d){logger[_0x8cae('0x1b')]('Network,\x20%s,\x20%s',_0x10c941,_0x8cae('0x1c'));logger[_0x8cae('0x1d')]('Network,\x20%s,\x20%s,\x20%s',_0x10c941,_0x8cae('0x1c'),JSON[_0x8cae('0x1e')](_0x14999d));if(_0x14999d[_0x8cae('0x1f')]){if(_0x14999d[_0x8cae('0x1f')][_0x8cae('0x20')]===0x1f4){logger[_0x8cae('0x1f')](_0x8cae('0x21'),_0x10c941,_0x14999d[_0x8cae('0x1f')]['message']);return _0x207861(_0x14999d[_0x8cae('0x1f')][_0x8cae('0x22')]);}logger['error'](_0x8cae('0x21'),_0x10c941,_0x14999d['error'][_0x8cae('0x22')]);return _0x378724(_0x14999d[_0x8cae('0x1f')][_0x8cae('0x22')]);}else{logger[_0x8cae('0x1b')](_0x8cae('0x21'),_0x10c941,_0x8cae('0x1c'));_0x378724(_0x14999d[_0x8cae('0x23')][_0x8cae('0x22')]);}})[_0x8cae('0x24')](function(_0x4302b1){logger[_0x8cae('0x1f')](_0x8cae('0x21'),_0x10c941,_0x4302b1);_0x207861(_0x4302b1);});});}function respondWithStatusCode(_0x516dd3,_0x51257f){_0x51257f=_0x51257f||0xcc;return function(_0x54e478){if(_0x54e478){return _0x516dd3['sendStatus'](_0x51257f);}return _0x516dd3[_0x8cae('0x25')](_0x51257f)[_0x8cae('0x26')]();};}function respondWithResult(_0x4a19b4,_0x60f6f2){_0x60f6f2=_0x60f6f2||0xc8;return function(_0xd843d){if(_0xd843d){return _0x4a19b4[_0x8cae('0x25')](_0x60f6f2)['json'](_0xd843d);}};}function respondWithFilteredResult(_0x2d143c,_0x197345){return function(_0x38962c){if(_0x38962c){var _0x186af2=_0x38962c[_0x8cae('0x27')],_0x25cc1e=_0x197345[_0x8cae('0x28')],_0x5b8573=_0x197345[_0x8cae('0x28')]+_0x197345['limit'],_0x41366f;if(_0x5b8573>=_0x186af2){_0x5b8573=_0x186af2;_0x41366f=0xc8;}else{_0x41366f=0xce;}_0x2d143c[_0x8cae('0x25')](_0x41366f);return _0x2d143c[_0x8cae('0x29')](_0x8cae('0x2a'),_0x25cc1e+'-'+_0x5b8573+'/'+_0x186af2)[_0x8cae('0x2b')](_0x38962c);}return null;};}function patchUpdates(_0x54497f){return function(_0x2b9412){try{jsonpatch[_0x8cae('0x2c')](_0x2b9412,_0x54497f,!![]);}catch(_0x32c112){return BPromise[_0x8cae('0x2d')](_0x32c112);}return _0x2b9412[_0x8cae('0x2e')]();};}function saveUpdates(_0x851cd4,_0xfc988d){return function(_0x16c3e8){if(_0x16c3e8){return _0x16c3e8[_0x8cae('0x2f')](_0x851cd4)[_0x8cae('0x30')](function(_0x107b06){return _0x107b06;});}return null;};}function removeEntity(_0x461ca7,_0x2480d4){return function(_0x5b263b){if(_0x5b263b){return _0x5b263b[_0x8cae('0x31')]()[_0x8cae('0x30')](function(){_0x461ca7[_0x8cae('0x25')](0xcc)[_0x8cae('0x26')]();});}};}function handleEntityNotFound(_0x3b4384,_0x3c3ea3){return function(_0x388432){if(!_0x388432){_0x3b4384[_0x8cae('0x32')](0x194);}return _0x388432;};}function handleError(_0x5d39fc,_0x499482){_0x499482=_0x499482||0x1f4;return function(_0x398058){logger[_0x8cae('0x1f')](_0x398058[_0x8cae('0x33')]);if(_0x398058[_0x8cae('0x34')]){delete _0x398058[_0x8cae('0x34')];}_0x5d39fc[_0x8cae('0x25')](_0x499482)['send'](_0x398058);};}exports[_0x8cae('0x35')]=function(_0x1f3433,_0x142b19){var _0x152345={},_0x4e9c68={},_0x41755a={'count':0x0,'rows':[]};var _0x2f625a=_[_0x8cae('0x36')](db[_0x8cae('0x37')][_0x8cae('0x38')],function(_0x519d29){return{'name':_0x519d29['fieldName'],'type':_0x519d29[_0x8cae('0x39')][_0x8cae('0x3a')]};});_0x4e9c68[_0x8cae('0x3b')]=_[_0x8cae('0x36')](_0x2f625a,'name');_0x4e9c68['query']=_[_0x8cae('0x3c')](_0x1f3433[_0x8cae('0x3d')]);_0x4e9c68['filters']=_[_0x8cae('0x3e')](_0x4e9c68[_0x8cae('0x3b')],_0x4e9c68['query']);_0x152345[_0x8cae('0x3f')]=_[_0x8cae('0x3e')](_0x4e9c68[_0x8cae('0x3b')],qs[_0x8cae('0x40')](_0x1f3433[_0x8cae('0x3d')][_0x8cae('0x40')]));_0x152345[_0x8cae('0x3f')]=_0x152345[_0x8cae('0x3f')]['length']?_0x152345[_0x8cae('0x3f')]:_0x4e9c68[_0x8cae('0x3b')];if(!_0x1f3433[_0x8cae('0x3d')]['hasOwnProperty']('nolimit')){_0x152345[_0x8cae('0x41')]=qs[_0x8cae('0x41')](_0x1f3433[_0x8cae('0x3d')][_0x8cae('0x41')]);_0x152345['offset']=qs[_0x8cae('0x28')](_0x1f3433[_0x8cae('0x3d')]['offset']);}_0x152345[_0x8cae('0x42')]=qs['sort'](_0x1f3433['query'][_0x8cae('0x43')]);_0x152345['where']=qs['filters'](_[_0x8cae('0x44')](_0x1f3433[_0x8cae('0x3d')],_0x4e9c68['filters']));if(_0x1f3433[_0x8cae('0x3d')][_0x8cae('0x45')]){_0x152345[_0x8cae('0x46')]=_[_0x8cae('0x47')](_0x152345[_0x8cae('0x46')],{'$or':_[_0x8cae('0x36')](_0x2f625a,function(_0x4d15ca){if(_0x4d15ca[_0x8cae('0x39')]!==_0x8cae('0x48')){var _0x8921cc={};_0x8921cc[_0x4d15ca[_0x8cae('0x34')]]={'$like':'%'+_0x1f3433['query']['filter']+'%'};return _0x8921cc;}})});}_0x152345=_[_0x8cae('0x47')]({},_0x152345,_0x1f3433[_0x8cae('0x49')]);var _0x4df3ad={'where':_0x152345['where']};return db['Network'][_0x8cae('0x27')](_0x4df3ad)[_0x8cae('0x30')](function(_0x42ee8a){_0x41755a[_0x8cae('0x27')]=_0x42ee8a;if(_0x1f3433[_0x8cae('0x3d')][_0x8cae('0x4a')]){_0x152345[_0x8cae('0x4b')]=[{'all':!![]}];}return db['Network'][_0x8cae('0x4c')](_0x152345);})[_0x8cae('0x30')](function(_0x56faab){_0x41755a[_0x8cae('0x4d')]=_0x56faab;return _0x41755a;})[_0x8cae('0x30')](respondWithFilteredResult(_0x142b19,_0x152345))[_0x8cae('0x24')](handleError(_0x142b19,null));};exports[_0x8cae('0x4e')]=function(_0xb438ea,_0x46c91a){var _0x5860f4={'raw':!![],'where':{'id':_0xb438ea[_0x8cae('0x4f')]['id']}},_0x4aed4c={};_0x4aed4c['model']=_[_0x8cae('0x3c')](db[_0x8cae('0x37')]['rawAttributes']);_0x4aed4c[_0x8cae('0x3d')]=_[_0x8cae('0x3c')](_0xb438ea[_0x8cae('0x3d')]);_0x4aed4c['filters']=_[_0x8cae('0x3e')](_0x4aed4c[_0x8cae('0x3b')],_0x4aed4c['query']);_0x5860f4[_0x8cae('0x3f')]=_[_0x8cae('0x3e')](_0x4aed4c[_0x8cae('0x3b')],qs[_0x8cae('0x40')](_0xb438ea['query']['fields']));_0x5860f4[_0x8cae('0x3f')]=_0x5860f4['attributes']['length']?_0x5860f4['attributes']:_0x4aed4c[_0x8cae('0x3b')];if(_0xb438ea[_0x8cae('0x3d')]['includeAll']){_0x5860f4['include']=[{'all':!![]}];}_0x5860f4=_[_0x8cae('0x47')]({},_0x5860f4,_0xb438ea[_0x8cae('0x49')]);return db[_0x8cae('0x37')]['find'](_0x5860f4)[_0x8cae('0x30')](handleEntityNotFound(_0x46c91a,null))[_0x8cae('0x30')](respondWithResult(_0x46c91a,null))[_0x8cae('0x24')](handleError(_0x46c91a,null));};exports[_0x8cae('0x50')]=function(_0x4691f8,_0x3135c8,_0x2e4b59){var _0x5e3e51;return db[_0x8cae('0x51')]['transaction'](function(_0x29a65d){return db[_0x8cae('0x37')][_0x8cae('0x50')](_0x4691f8[_0x8cae('0x52')],{'raw':!![]})['then'](function(_0x4baf63){_0x5e3e51=_0x4baf63;return db[_0x8cae('0x37')][_0x8cae('0x4c')]({'where':{'type':_0x4691f8['body'][_0x8cae('0x39')]},'raw':!![]});})[_0x8cae('0x30')](function(_0x3b490f){if(_0x5e3e51[_0x8cae('0x39')][_0x8cae('0x53')]()==_0x8cae('0x54')){var _0x497ddd=fs[_0x8cae('0x55')](path[_0x8cae('0x56')](config[_0x8cae('0x57')],_0x8cae('0x58')),_0x8cae('0x59'));var _0x224bcc=ejs[_0x8cae('0x5a')](_0x497ddd,{'networks':_0x3b490f||[]});fs[_0x8cae('0x5b')]('/etc/asterisk/stun_xcally.conf',_0x224bcc);return respondWithRpcPromise(_0x8cae('0x5c'),_0x8cae('0x50'),{'module':'res_stun_monitor.so'});}else if(_0x5e3e51[_0x8cae('0x39')][_0x8cae('0x53')]()=='TURN'){var _0x421ce2=fs[_0x8cae('0x55')](path[_0x8cae('0x56')](config[_0x8cae('0x57')],'server/files/templates/turn_multiple.ejs'),'utf8');var _0x5a6e33=ejs[_0x8cae('0x5a')](_0x421ce2,{'networks':_0x3b490f||[]});fs['writeFileSync']('/etc/asterisk/turn_xcally.conf',_0x5a6e33);return respondWithRpcPromise(_0x8cae('0x5c'),_0x8cae('0x50'),{'module':'res_stun_monitor.so'});}else{var _0x57ab27=fs['readFileSync'](path['join'](config[_0x8cae('0x57')],'server/files/templates/network.ejs'),'utf8');var _0x127b66=ejs[_0x8cae('0x5a')](_0x57ab27,{'networks':_0x3b490f||[]});fs[_0x8cae('0x5b')](util[_0x8cae('0x5d')](_0x8cae('0x5e'),_0x4691f8[_0x8cae('0x52')][_0x8cae('0x39')][_0x8cae('0x5f')]()),_0x127b66);return respondWithRpcPromise(_0x8cae('0x5c'),_0x8cae('0x50'),{'module':_0x8cae('0x60')});}return null;})['then'](function(){return _0x5e3e51;});})[_0x8cae('0x30')](respondWithResult(_0x3135c8,0xc9))[_0x8cae('0x24')](handleError(_0x3135c8,null));};exports[_0x8cae('0x2f')]=function(_0x1d7e82,_0x45a3aa,_0x70ff80){var _0x53dfed;return db[_0x8cae('0x51')][_0x8cae('0x61')](function(_0x5c0a02){return db[_0x8cae('0x37')][_0x8cae('0x62')]({'where':{'id':_0x1d7e82[_0x8cae('0x4f')]['id']}})['then'](handleEntityNotFound(_0x45a3aa,null))[_0x8cae('0x30')](saveUpdates(_0x1d7e82[_0x8cae('0x52')],null))[_0x8cae('0x30')](function(_0xc661f){if(_0xc661f){_0x53dfed=_0xc661f;return db[_0x8cae('0x37')][_0x8cae('0x4c')]({'where':{'type':_0x53dfed[_0x8cae('0x39')]},'raw':!![]});}return null;})[_0x8cae('0x30')](function(_0x276695){if(_0x53dfed[_0x8cae('0x39')][_0x8cae('0x53')]()==_0x8cae('0x54')){var _0x2ed53a=fs[_0x8cae('0x55')](path[_0x8cae('0x56')](config[_0x8cae('0x57')],_0x8cae('0x58')),_0x8cae('0x59'));var _0x2dd84d=ejs['render'](_0x2ed53a,{'networks':_0x276695||[]});fs[_0x8cae('0x5b')](_0x8cae('0x63'),_0x2dd84d);return respondWithRpcPromise(_0x8cae('0x5c'),_0x8cae('0x2f'),{'module':_0x8cae('0x64')});}else if(_0x53dfed['type']['toUpperCase']()==_0x8cae('0x65')){var _0x476f80=fs[_0x8cae('0x55')](path[_0x8cae('0x56')](config[_0x8cae('0x57')],_0x8cae('0x66')),_0x8cae('0x59'));var _0xf2fc21=ejs[_0x8cae('0x5a')](_0x476f80,{'networks':_0x276695||[]});fs['writeFileSync']('/etc/asterisk/turn_xcally.conf',_0xf2fc21);return respondWithRpcPromise(_0x8cae('0x5c'),_0x8cae('0x2f'),{'module':_0x8cae('0x64')});}else{var _0xd37bf5=fs[_0x8cae('0x55')](path[_0x8cae('0x56')](config[_0x8cae('0x57')],_0x8cae('0x67')),_0x8cae('0x59'));var _0x205686=ejs['render'](_0xd37bf5,{'networks':_0x276695||[]});fs[_0x8cae('0x5b')](util[_0x8cae('0x5d')]('/etc/asterisk/sip_xcally_%s.conf',_0x1d7e82[_0x8cae('0x52')][_0x8cae('0x39')][_0x8cae('0x5f')]()),_0x205686);return respondWithRpcPromise(_0x8cae('0x5c'),_0x8cae('0x2f'),{'module':_0x8cae('0x60')});}return null;})[_0x8cae('0x30')](function(_0x3045b0){if(_0x3045b0){return _0x53dfed;}return null;});})[_0x8cae('0x30')](respondWithResult(_0x45a3aa,null))[_0x8cae('0x24')](handleError(_0x45a3aa,null));};exports['destroy']=function(_0x5ca8d2,_0x409182,_0x4dcce5){var _0x2e0be1;return db[_0x8cae('0x37')][_0x8cae('0x62')]({'where':{'id':_0x5ca8d2['params']['id']}})['then'](function(_0x2a115e){_0x2e0be1=_0x2a115e;return _0x2a115e;})[_0x8cae('0x30')](handleEntityNotFound(_0x409182,null))['then'](removeEntity(_0x409182,null))[_0x8cae('0x30')](function(){if(_0x2e0be1){return db['Network']['findAll']({'where':{'type':_0x2e0be1['type']},'raw':!![]});}})[_0x8cae('0x30')](function(_0x35a874){if(_0x2e0be1['type'][_0x8cae('0x53')]()==_0x8cae('0x54')){var _0x81a5d4=fs['readFileSync'](path[_0x8cae('0x56')](config[_0x8cae('0x57')],_0x8cae('0x58')),_0x8cae('0x59'));var _0xc1489e=ejs['render'](_0x81a5d4,{'networks':_0x35a874||[]});fs[_0x8cae('0x5b')](_0x8cae('0x63'),_0xc1489e);return respondWithRpcPromise('Reload',_0x8cae('0x31'),{'module':_0x8cae('0x64')});}else if(_0x2e0be1[_0x8cae('0x39')][_0x8cae('0x53')]()==_0x8cae('0x65')){var _0x486165=fs[_0x8cae('0x55')](path[_0x8cae('0x56')](config['root'],_0x8cae('0x66')),'utf8');var _0x5cecc0=ejs[_0x8cae('0x5a')](_0x486165,{'networks':_0x35a874||[]});fs['writeFileSync'](_0x8cae('0x68'),_0x5cecc0);return respondWithRpcPromise(_0x8cae('0x5c'),_0x8cae('0x31'),{'module':_0x8cae('0x64')});}else{var _0x2e4abe=fs[_0x8cae('0x55')](path[_0x8cae('0x56')](config[_0x8cae('0x57')],_0x8cae('0x67')),_0x8cae('0x59'));var _0x1c3a3e=ejs[_0x8cae('0x5a')](_0x2e4abe,{'networks':_0x35a874||[]});fs[_0x8cae('0x5b')](util[_0x8cae('0x5d')](_0x8cae('0x5e'),_0x5ca8d2[_0x8cae('0x52')]['type'][_0x8cae('0x5f')]()),_0x1c3a3e);return respondWithRpcPromise('Reload','destroy',{'module':'chan_sip.so'});}return null;})[_0x8cae('0x24')](handleError(_0x409182,null));}; \ No newline at end of file +var _0xf44b=['pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','show','params','length','find','create','sequelize','toUpperCase','readFileSync','join','root','server/files/templates/stun_multiple.ejs','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','TURN','server/files/templates/turn_multiple.ejs','utf8','server/files/templates/network.ejs','render','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','STUN','/etc/asterisk/turn_xcally.conf','body','chan_sip.so','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','lodash','squel','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../mysqldb','jayson/promise','client','Sequelize','ValidationError','then','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','Network,\x20%s,\x20%s','message','info','result','catch','status','end','count','offset','limit','set','Content-Range','json','save','update','destroy','sendStatus','name','send','index','Network','rawAttributes','type','key','model','map','query','keys','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','filters'];(function(_0x29df1e,_0x879678){var _0x2ff27a=function(_0x582a7b){while(--_0x582a7b){_0x29df1e['push'](_0x29df1e['shift']());}};_0x2ff27a(++_0x879678);}(_0xf44b,0x8a));var _0xbf44=function(_0x5f3f88,_0x562baf){_0x5f3f88=_0x5f3f88-0x0;var _0xd08119=_0xf44b[_0x5f3f88];return _0xd08119;};'use strict';var pdf=require(_0xbf44('0x0'));var emlformat=require(_0xbf44('0x1'));var rimraf=require(_0xbf44('0x2'));var zipdir=require(_0xbf44('0x3'));var jsonpatch=require(_0xbf44('0x4'));var rp=require('request-promise');var moment=require(_0xbf44('0x5'));var BPromise=require(_0xbf44('0x6'));var Mustache=require(_0xbf44('0x7'));var util=require(_0xbf44('0x8'));var path=require(_0xbf44('0x9'));var sox=require(_0xbf44('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xbf44('0xb'));var squel=require(_0xbf44('0xc'));var crypto=require('crypto');var jsforce=require(_0xbf44('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xbf44('0xe'));var authService=require(_0xbf44('0xf'));var qs=require(_0xbf44('0x10'));var as=require(_0xbf44('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xbf44('0x12'));var utils=require('../../config/utils');var config=require(_0xbf44('0x13'));var db=require(_0xbf44('0x14'))['db'];var jayson=require(_0xbf44('0x15'));var client=jayson[_0xbf44('0x16')]['http']({'port':0x232a});function checkPasswordPattern(_0x4c2761,_0x3bfb5b,_0x59eb2d){if(_0x59eb2d){var _0x35b41e=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x35b41e['test'](_0x3bfb5b)){return _0x4c2761;}else{throw new db[(_0xbf44('0x17'))][(_0xbf44('0x18'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x4c2761;}}function respondWithRpcPromise(_0x59092b,_0x17e657,_0x34461b,_0x1d5ede){return new BPromise(function(_0x370f9e,_0x359877){var _0x388830=_0x1d5ede||client;return _0x388830['request'](_0x59092b,_0x34461b)[_0xbf44('0x19')](function(_0x10419a){logger['info']('Network,\x20%s,\x20%s',_0x17e657,_0xbf44('0x1a'));logger[_0xbf44('0x1b')](_0xbf44('0x1c'),_0x17e657,'request\x20sent',JSON[_0xbf44('0x1d')](_0x10419a));if(_0x10419a[_0xbf44('0x1e')]){if(_0x10419a[_0xbf44('0x1e')]['code']===0x1f4){logger[_0xbf44('0x1e')](_0xbf44('0x1f'),_0x17e657,_0x10419a['error'][_0xbf44('0x20')]);return _0x359877(_0x10419a[_0xbf44('0x1e')]['message']);}logger[_0xbf44('0x1e')](_0xbf44('0x1f'),_0x17e657,_0x10419a[_0xbf44('0x1e')]['message']);return _0x370f9e(_0x10419a[_0xbf44('0x1e')][_0xbf44('0x20')]);}else{logger[_0xbf44('0x21')](_0xbf44('0x1f'),_0x17e657,_0xbf44('0x1a'));_0x370f9e(_0x10419a[_0xbf44('0x22')][_0xbf44('0x20')]);}})[_0xbf44('0x23')](function(_0x4ef42d){logger['error'](_0xbf44('0x1f'),_0x17e657,_0x4ef42d);_0x359877(_0x4ef42d);});});}function respondWithStatusCode(_0x200f2a,_0xabb2ea){_0xabb2ea=_0xabb2ea||0xcc;return function(_0x763c5c){if(_0x763c5c){return _0x200f2a['sendStatus'](_0xabb2ea);}return _0x200f2a[_0xbf44('0x24')](_0xabb2ea)[_0xbf44('0x25')]();};}function respondWithResult(_0x163dec,_0x1b49d9){_0x1b49d9=_0x1b49d9||0xc8;return function(_0x4d19e6){if(_0x4d19e6){return _0x163dec[_0xbf44('0x24')](_0x1b49d9)['json'](_0x4d19e6);}};}function respondWithFilteredResult(_0x5538c6,_0x548f31){return function(_0x1739f3){if(_0x1739f3){var _0x2cefdc=_0x1739f3[_0xbf44('0x26')],_0x814b68=_0x548f31['offset'],_0x18a30f=_0x548f31[_0xbf44('0x27')]+_0x548f31[_0xbf44('0x28')],_0x2b3aee;if(_0x18a30f>=_0x2cefdc){_0x18a30f=_0x2cefdc;_0x2b3aee=0xc8;}else{_0x2b3aee=0xce;}_0x5538c6[_0xbf44('0x24')](_0x2b3aee);return _0x5538c6[_0xbf44('0x29')](_0xbf44('0x2a'),_0x814b68+'-'+_0x18a30f+'/'+_0x2cefdc)[_0xbf44('0x2b')](_0x1739f3);}return null;};}function patchUpdates(_0x4d7ef3){return function(_0x3035b9){try{jsonpatch['apply'](_0x3035b9,_0x4d7ef3,!![]);}catch(_0xb62149){return BPromise['reject'](_0xb62149);}return _0x3035b9[_0xbf44('0x2c')]();};}function saveUpdates(_0x40f035,_0x12b4ad){return function(_0x1062c0){if(_0x1062c0){return _0x1062c0[_0xbf44('0x2d')](_0x40f035)['then'](function(_0x3c82eb){return _0x3c82eb;});}return null;};}function removeEntity(_0x427ac8,_0x15d47c){return function(_0x1dd8ff){if(_0x1dd8ff){return _0x1dd8ff[_0xbf44('0x2e')]()[_0xbf44('0x19')](function(){_0x427ac8['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xa4bb9e,_0x4373d8){return function(_0x19a30e){if(!_0x19a30e){_0xa4bb9e[_0xbf44('0x2f')](0x194);}return _0x19a30e;};}function handleError(_0x14bd2a,_0x5ea80c){_0x5ea80c=_0x5ea80c||0x1f4;return function(_0x3a52db){logger['error'](_0x3a52db['stack']);if(_0x3a52db[_0xbf44('0x30')]){delete _0x3a52db[_0xbf44('0x30')];}_0x14bd2a[_0xbf44('0x24')](_0x5ea80c)[_0xbf44('0x31')](_0x3a52db);};}exports[_0xbf44('0x32')]=function(_0x21ad3d,_0x48d194){var _0x1f1d8d={},_0xe3bec={},_0x396931={'count':0x0,'rows':[]};var _0x5cf827=_['map'](db[_0xbf44('0x33')][_0xbf44('0x34')],function(_0x538a2a){return{'name':_0x538a2a['fieldName'],'type':_0x538a2a[_0xbf44('0x35')][_0xbf44('0x36')]};});_0xe3bec[_0xbf44('0x37')]=_[_0xbf44('0x38')](_0x5cf827,'name');_0xe3bec[_0xbf44('0x39')]=_[_0xbf44('0x3a')](_0x21ad3d[_0xbf44('0x39')]);_0xe3bec['filters']=_['intersection'](_0xe3bec[_0xbf44('0x37')],_0xe3bec[_0xbf44('0x39')]);_0x1f1d8d[_0xbf44('0x3b')]=_[_0xbf44('0x3c')](_0xe3bec[_0xbf44('0x37')],qs[_0xbf44('0x3d')](_0x21ad3d[_0xbf44('0x39')]['fields']));_0x1f1d8d[_0xbf44('0x3b')]=_0x1f1d8d[_0xbf44('0x3b')]['length']?_0x1f1d8d['attributes']:_0xe3bec[_0xbf44('0x37')];if(!_0x21ad3d[_0xbf44('0x39')][_0xbf44('0x3e')](_0xbf44('0x3f'))){_0x1f1d8d[_0xbf44('0x28')]=qs['limit'](_0x21ad3d['query'][_0xbf44('0x28')]);_0x1f1d8d[_0xbf44('0x27')]=qs[_0xbf44('0x27')](_0x21ad3d[_0xbf44('0x39')][_0xbf44('0x27')]);}_0x1f1d8d[_0xbf44('0x40')]=qs['sort'](_0x21ad3d[_0xbf44('0x39')][_0xbf44('0x41')]);_0x1f1d8d[_0xbf44('0x42')]=qs[_0xbf44('0x43')](_[_0xbf44('0x44')](_0x21ad3d[_0xbf44('0x39')],_0xe3bec[_0xbf44('0x43')]));if(_0x21ad3d['query'][_0xbf44('0x45')]){_0x1f1d8d[_0xbf44('0x42')]=_['merge'](_0x1f1d8d['where'],{'$or':_[_0xbf44('0x38')](_0x5cf827,function(_0x9e91a4){if(_0x9e91a4[_0xbf44('0x35')]!==_0xbf44('0x46')){var _0x473c49={};_0x473c49[_0x9e91a4[_0xbf44('0x30')]]={'$like':'%'+_0x21ad3d['query'][_0xbf44('0x45')]+'%'};return _0x473c49;}})});}_0x1f1d8d=_[_0xbf44('0x47')]({},_0x1f1d8d,_0x21ad3d[_0xbf44('0x48')]);var _0x4e518f={'where':_0x1f1d8d['where']};return db[_0xbf44('0x33')][_0xbf44('0x26')](_0x4e518f)['then'](function(_0x6bded2){_0x396931[_0xbf44('0x26')]=_0x6bded2;if(_0x21ad3d[_0xbf44('0x39')][_0xbf44('0x49')]){_0x1f1d8d[_0xbf44('0x4a')]=[{'all':!![]}];}return db[_0xbf44('0x33')][_0xbf44('0x4b')](_0x1f1d8d);})['then'](function(_0x2a1548){_0x396931['rows']=_0x2a1548;return _0x396931;})['then'](respondWithFilteredResult(_0x48d194,_0x1f1d8d))['catch'](handleError(_0x48d194,null));};exports[_0xbf44('0x4c')]=function(_0x494ace,_0x12a833){var _0x3626f4={'raw':!![],'where':{'id':_0x494ace[_0xbf44('0x4d')]['id']}},_0x2c49d5={};_0x2c49d5['model']=_[_0xbf44('0x3a')](db['Network'][_0xbf44('0x34')]);_0x2c49d5[_0xbf44('0x39')]=_['keys'](_0x494ace[_0xbf44('0x39')]);_0x2c49d5[_0xbf44('0x43')]=_[_0xbf44('0x3c')](_0x2c49d5['model'],_0x2c49d5[_0xbf44('0x39')]);_0x3626f4[_0xbf44('0x3b')]=_[_0xbf44('0x3c')](_0x2c49d5[_0xbf44('0x37')],qs[_0xbf44('0x3d')](_0x494ace[_0xbf44('0x39')][_0xbf44('0x3d')]));_0x3626f4['attributes']=_0x3626f4['attributes'][_0xbf44('0x4e')]?_0x3626f4[_0xbf44('0x3b')]:_0x2c49d5[_0xbf44('0x37')];if(_0x494ace[_0xbf44('0x39')][_0xbf44('0x49')]){_0x3626f4[_0xbf44('0x4a')]=[{'all':!![]}];}_0x3626f4=_[_0xbf44('0x47')]({},_0x3626f4,_0x494ace[_0xbf44('0x48')]);return db[_0xbf44('0x33')][_0xbf44('0x4f')](_0x3626f4)[_0xbf44('0x19')](handleEntityNotFound(_0x12a833,null))[_0xbf44('0x19')](respondWithResult(_0x12a833,null))[_0xbf44('0x23')](handleError(_0x12a833,null));};exports[_0xbf44('0x50')]=function(_0x2359bc,_0x4a98e7,_0x5a12b4){var _0x5bec17;return db[_0xbf44('0x51')]['transaction'](function(_0x5a974f){return db['Network'][_0xbf44('0x50')](_0x2359bc['body'],{'raw':!![]})[_0xbf44('0x19')](function(_0xbc9d03){_0x5bec17=_0xbc9d03;return db['Network'][_0xbf44('0x4b')]({'where':{'type':_0x2359bc['body'][_0xbf44('0x35')]},'raw':!![]});})['then'](function(_0x21790a){if(_0x5bec17[_0xbf44('0x35')][_0xbf44('0x52')]()=='STUN'){var _0x4245c2=fs[_0xbf44('0x53')](path[_0xbf44('0x54')](config[_0xbf44('0x55')],_0xbf44('0x56')),'utf8');var _0xd3a0=ejs['render'](_0x4245c2,{'networks':_0x21790a||[]});fs[_0xbf44('0x57')](_0xbf44('0x58'),_0xd3a0);return respondWithRpcPromise(_0xbf44('0x59'),'create',{'module':_0xbf44('0x5a')});}else if(_0x5bec17[_0xbf44('0x35')][_0xbf44('0x52')]()==_0xbf44('0x5b')){var _0x5016b3=fs[_0xbf44('0x53')](path[_0xbf44('0x54')](config[_0xbf44('0x55')],_0xbf44('0x5c')),_0xbf44('0x5d'));var _0x5e131c=ejs['render'](_0x5016b3,{'networks':_0x21790a||[]});fs[_0xbf44('0x57')]('/etc/asterisk/turn_xcally.conf',_0x5e131c);return respondWithRpcPromise(_0xbf44('0x59'),'create',{'module':_0xbf44('0x5a')});}else{var _0x3bfcfa=fs[_0xbf44('0x53')](path[_0xbf44('0x54')](config[_0xbf44('0x55')],_0xbf44('0x5e')),'utf8');var _0x3b8b44=ejs[_0xbf44('0x5f')](_0x3bfcfa,{'networks':_0x21790a||[]});fs[_0xbf44('0x57')](util[_0xbf44('0x60')](_0xbf44('0x61'),_0x2359bc['body'][_0xbf44('0x35')][_0xbf44('0x62')]()),_0x3b8b44);return respondWithRpcPromise(_0xbf44('0x59'),'create',{'module':'chan_sip.so'});}return null;})[_0xbf44('0x19')](function(){return _0x5bec17;});})[_0xbf44('0x19')](respondWithResult(_0x4a98e7,0xc9))[_0xbf44('0x23')](handleError(_0x4a98e7,null));};exports[_0xbf44('0x2d')]=function(_0x47565b,_0x43fc64,_0x54c581){var _0x35b88c;return db['sequelize']['transaction'](function(_0x133171){return db[_0xbf44('0x33')][_0xbf44('0x4f')]({'where':{'id':_0x47565b[_0xbf44('0x4d')]['id']}})[_0xbf44('0x19')](handleEntityNotFound(_0x43fc64,null))[_0xbf44('0x19')](saveUpdates(_0x47565b['body'],null))['then'](function(_0x22f09c){if(_0x22f09c){_0x35b88c=_0x22f09c;return db[_0xbf44('0x33')][_0xbf44('0x4b')]({'where':{'type':_0x35b88c['type']},'raw':!![]});}return null;})[_0xbf44('0x19')](function(_0x2bb535){if(_0x35b88c[_0xbf44('0x35')]['toUpperCase']()==_0xbf44('0x63')){var _0x49db3f=fs[_0xbf44('0x53')](path[_0xbf44('0x54')](config[_0xbf44('0x55')],_0xbf44('0x56')),_0xbf44('0x5d'));var _0x48d832=ejs[_0xbf44('0x5f')](_0x49db3f,{'networks':_0x2bb535||[]});fs[_0xbf44('0x57')](_0xbf44('0x58'),_0x48d832);return respondWithRpcPromise(_0xbf44('0x59'),_0xbf44('0x2d'),{'module':_0xbf44('0x5a')});}else if(_0x35b88c['type'][_0xbf44('0x52')]()=='TURN'){var _0x4cb708=fs[_0xbf44('0x53')](path[_0xbf44('0x54')](config[_0xbf44('0x55')],_0xbf44('0x5c')),_0xbf44('0x5d'));var _0x55434d=ejs['render'](_0x4cb708,{'networks':_0x2bb535||[]});fs['writeFileSync'](_0xbf44('0x64'),_0x55434d);return respondWithRpcPromise(_0xbf44('0x59'),_0xbf44('0x2d'),{'module':_0xbf44('0x5a')});}else{var _0xbaaa95=fs[_0xbf44('0x53')](path[_0xbf44('0x54')](config['root'],'server/files/templates/network.ejs'),_0xbf44('0x5d'));var _0x400dae=ejs[_0xbf44('0x5f')](_0xbaaa95,{'networks':_0x2bb535||[]});fs['writeFileSync'](util[_0xbf44('0x60')]('/etc/asterisk/sip_xcally_%s.conf',_0x47565b[_0xbf44('0x65')][_0xbf44('0x35')]['toLowerCase']()),_0x400dae);return respondWithRpcPromise('Reload','update',{'module':_0xbf44('0x66')});}return null;})[_0xbf44('0x19')](function(_0x487a16){if(_0x487a16){return _0x35b88c;}return null;});})['then'](respondWithResult(_0x43fc64,null))[_0xbf44('0x23')](handleError(_0x43fc64,null));};exports[_0xbf44('0x2e')]=function(_0x28af2d,_0x22768d,_0x10089e){var _0x1bb2a6;return db[_0xbf44('0x33')][_0xbf44('0x4f')]({'where':{'id':_0x28af2d[_0xbf44('0x4d')]['id']}})['then'](function(_0x1847f7){_0x1bb2a6=_0x1847f7;return _0x1847f7;})[_0xbf44('0x19')](handleEntityNotFound(_0x22768d,null))[_0xbf44('0x19')](removeEntity(_0x22768d,null))[_0xbf44('0x19')](function(){if(_0x1bb2a6){return db[_0xbf44('0x33')][_0xbf44('0x4b')]({'where':{'type':_0x1bb2a6[_0xbf44('0x35')]},'raw':!![]});}})[_0xbf44('0x19')](function(_0x4f32a1){if(_0x1bb2a6['type'][_0xbf44('0x52')]()==_0xbf44('0x63')){var _0x47f0f2=fs[_0xbf44('0x53')](path[_0xbf44('0x54')](config[_0xbf44('0x55')],'server/files/templates/stun_multiple.ejs'),_0xbf44('0x5d'));var _0x5ded3a=ejs[_0xbf44('0x5f')](_0x47f0f2,{'networks':_0x4f32a1||[]});fs['writeFileSync'](_0xbf44('0x58'),_0x5ded3a);return respondWithRpcPromise(_0xbf44('0x59'),_0xbf44('0x2e'),{'module':'res_stun_monitor.so'});}else if(_0x1bb2a6['type'][_0xbf44('0x52')]()==_0xbf44('0x5b')){var _0x2a4a8d=fs[_0xbf44('0x53')](path[_0xbf44('0x54')](config[_0xbf44('0x55')],_0xbf44('0x5c')),'utf8');var _0x2bff9e=ejs['render'](_0x2a4a8d,{'networks':_0x4f32a1||[]});fs[_0xbf44('0x57')]('/etc/asterisk/turn_xcally.conf',_0x2bff9e);return respondWithRpcPromise(_0xbf44('0x59'),_0xbf44('0x2e'),{'module':_0xbf44('0x5a')});}else{var _0x59a48e=fs[_0xbf44('0x53')](path[_0xbf44('0x54')](config[_0xbf44('0x55')],_0xbf44('0x5e')),_0xbf44('0x5d'));var _0x31edc6=ejs[_0xbf44('0x5f')](_0x59a48e,{'networks':_0x4f32a1||[]});fs[_0xbf44('0x57')](util['format']('/etc/asterisk/sip_xcally_%s.conf',_0x28af2d[_0xbf44('0x65')][_0xbf44('0x35')]['toLowerCase']()),_0x31edc6);return respondWithRpcPromise('Reload',_0xbf44('0x2e'),{'module':'chan_sip.so'});}return null;})[_0xbf44('0x23')](handleError(_0x22768d,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index f65903d..322e557 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 _0x6466=['./network.attributes','exports','define','Network','lodash','util','../../config/logger','moment','bluebird','request-promise','../../config/environment'];(function(_0x441f6e,_0x56459e){var _0x46e675=function(_0xc0320b){while(--_0xc0320b){_0x441f6e['push'](_0x441f6e['shift']());}};_0x46e675(++_0x56459e);}(_0x6466,0x122));var _0x6646=function(_0x2e9999,_0x559e9a){_0x2e9999=_0x2e9999-0x0;var _0x3d034c=_0x6466[_0x2e9999];return _0x3d034c;};'use strict';var _=require(_0x6646('0x0'));var util=require(_0x6646('0x1'));var logger=require(_0x6646('0x2'))('api');var moment=require(_0x6646('0x3'));var BPromise=require(_0x6646('0x4'));var rp=require(_0x6646('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x6646('0x6'));var attributes=require(_0x6646('0x7'));module[_0x6646('0x8')]=function(_0x3a7a1e,_0x34f6d2){return _0x3a7a1e[_0x6646('0x9')](_0x6646('0xa'),attributes,{'tableName':'network','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x15cd=['./network.attributes','exports','define','network','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x36fbef,_0x4ffc84){var _0x45e270=function(_0x32dd95){while(--_0x32dd95){_0x36fbef['push'](_0x36fbef['shift']());}};_0x45e270(++_0x4ffc84);}(_0x15cd,0x1c0));var _0xd15c=function(_0x1ec9d1,_0x35ecaf){_0x1ec9d1=_0x1ec9d1-0x0;var _0x4b6bc2=_0x15cd[_0x1ec9d1];return _0x4b6bc2;};'use strict';var _=require('lodash');var util=require(_0xd15c('0x0'));var logger=require(_0xd15c('0x1'))(_0xd15c('0x2'));var moment=require(_0xd15c('0x3'));var BPromise=require(_0xd15c('0x4'));var rp=require(_0xd15c('0x5'));var fs=require('fs');var path=require(_0xd15c('0x6'));var rimraf=require('rimraf');var config=require(_0xd15c('0x7'));var attributes=require(_0xd15c('0x8'));module[_0xd15c('0x9')]=function(_0x51b369,_0x3446ee){return _0x51b369[_0xd15c('0xa')]('Network',attributes,{'tableName':_0xd15c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/network/network.rpc.js b/server/api/network/network.rpc.js index 259d5a4..10ce859 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 _0xc1e2=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','Network,\x20%s,\x20%s','request\x20sent','Network,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util'];(function(_0x42cb0c,_0x148d03){var _0x4ac84b=function(_0x5c4516){while(--_0x5c4516){_0x42cb0c['push'](_0x42cb0c['shift']());}};_0x4ac84b(++_0x148d03);}(_0xc1e2,0x139));var _0x2c1e=function(_0x9edf8f,_0x129e70){_0x9edf8f=_0x9edf8f-0x0;var _0x4882c1=_0xc1e2[_0x9edf8f];return _0x4882c1;};'use strict';var _=require(_0x2c1e('0x0'));var util=require(_0x2c1e('0x1'));var moment=require('moment');var BPromise=require(_0x2c1e('0x2'));var rs=require(_0x2c1e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2c1e('0x4'))['db'];var utils=require(_0x2c1e('0x5'));var logger=require(_0x2c1e('0x6'))('rpc');var config=require(_0x2c1e('0x7'));var jayson=require(_0x2c1e('0x8'));var client=jayson[_0x2c1e('0x9')][_0x2c1e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xac1181,_0x5e4c51,_0x1847e7){return new BPromise(function(_0x32e173,_0x264f9c){return client[_0x2c1e('0xb')](_0xac1181,_0x1847e7)['then'](function(_0x2374c6){logger[_0x2c1e('0xc')](_0x2c1e('0xd'),_0x5e4c51,_0x2c1e('0xe'));logger['debug'](_0x2c1e('0xf'),_0x5e4c51,'request\x20sent',JSON['stringify'](_0x2374c6));if(_0x2374c6[_0x2c1e('0x10')]){if(_0x2374c6[_0x2c1e('0x10')][_0x2c1e('0x11')]===0x1f4){logger[_0x2c1e('0x10')](_0x2c1e('0xd'),_0x5e4c51,_0x2374c6[_0x2c1e('0x10')][_0x2c1e('0x12')]);return _0x264f9c(_0x2374c6['error']['message']);}logger[_0x2c1e('0x10')](_0x2c1e('0xd'),_0x5e4c51,_0x2374c6[_0x2c1e('0x10')][_0x2c1e('0x12')]);return _0x32e173(_0x2374c6[_0x2c1e('0x10')][_0x2c1e('0x12')]);}else{logger[_0x2c1e('0xc')]('Network,\x20%s,\x20%s',_0x5e4c51,_0x2c1e('0xe'));_0x32e173(_0x2374c6[_0x2c1e('0x13')][_0x2c1e('0x12')]);}})[_0x2c1e('0x14')](function(_0x138881){logger[_0x2c1e('0x10')](_0x2c1e('0xd'),_0x5e4c51,_0x138881);_0x264f9c(_0x138881);});});} \ No newline at end of file +var _0x00be=['message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','request','then','info','Network,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x192ec2,_0xc3a237){var _0x4abd11=function(_0x2d0745){while(--_0x2d0745){_0x192ec2['push'](_0x192ec2['shift']());}};_0x4abd11(++_0xc3a237);}(_0x00be,0xf9));var _0xe00b=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x00be[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require(_0xe00b('0x0'));var moment=require(_0xe00b('0x1'));var BPromise=require(_0xe00b('0x2'));var rs=require(_0xe00b('0x3'));var fs=require('fs');var Redis=require(_0xe00b('0x4'));var db=require(_0xe00b('0x5'))['db'];var utils=require(_0xe00b('0x6'));var logger=require('../../config/logger')(_0xe00b('0x7'));var config=require('../../config/environment');var jayson=require(_0xe00b('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x36654c,_0x235810,_0x20269e){return new BPromise(function(_0xf4938e,_0x1e0a6d){return client[_0xe00b('0x9')](_0x36654c,_0x20269e)[_0xe00b('0xa')](function(_0x355955){logger[_0xe00b('0xb')](_0xe00b('0xc'),_0x235810,_0xe00b('0xd'));logger['debug']('Network,\x20%s,\x20%s,\x20%s',_0x235810,_0xe00b('0xd'),JSON[_0xe00b('0xe')](_0x355955));if(_0x355955['error']){if(_0x355955[_0xe00b('0xf')][_0xe00b('0x10')]===0x1f4){logger[_0xe00b('0xf')]('Network,\x20%s,\x20%s',_0x235810,_0x355955[_0xe00b('0xf')][_0xe00b('0x11')]);return _0x1e0a6d(_0x355955['error'][_0xe00b('0x11')]);}logger['error'](_0xe00b('0xc'),_0x235810,_0x355955[_0xe00b('0xf')]['message']);return _0xf4938e(_0x355955[_0xe00b('0xf')][_0xe00b('0x11')]);}else{logger[_0xe00b('0xb')](_0xe00b('0xc'),_0x235810,_0xe00b('0xd'));_0xf4938e(_0x355955['result'][_0xe00b('0x11')]);}})[_0xe00b('0x12')](function(_0x17398e){logger[_0xe00b('0xf')](_0xe00b('0xc'),_0x235810,_0x17398e);_0x1e0a6d(_0x17398e);});});} \ No newline at end of file diff --git a/server/api/notification/index.js b/server/api/notification/index.js index 8cdabc0..5f8b930 100644 --- a/server/api/notification/index.js +++ b/server/api/notification/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4117=['util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','post','isAuthenticated','sendNotification','multer'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4117,0x1e9));var _0x7411=function(_0x2c42d7,_0x5941a8){_0x2c42d7=_0x2c42d7-0x0;var _0x1adb20=_0x4117[_0x2c42d7];return _0x1adb20;};'use strict';var multer=require(_0x7411('0x0'));var util=require(_0x7411('0x1'));var path=require('path');var timeout=require(_0x7411('0x2'));var express=require(_0x7411('0x3'));var router=express[_0x7411('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x7411('0x5'));var config=require(_0x7411('0x6'));var controller=require('./notification.controller');router[_0x7411('0x7')]('/',auth[_0x7411('0x8')](),controller[_0x7411('0x9')]);module['exports']=router; \ No newline at end of file +var _0xf8d4=['util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./notification.controller','isAuthenticated','sendNotification','multer'];(function(_0x1908b8,_0x576b10){var _0x391081=function(_0x1b67d7){while(--_0x1b67d7){_0x1908b8['push'](_0x1908b8['shift']());}};_0x391081(++_0x576b10);}(_0xf8d4,0x1df));var _0x4f8d=function(_0x5e3ba8,_0x330069){_0x5e3ba8=_0x5e3ba8-0x0;var _0x442f6c=_0xf8d4[_0x5e3ba8];return _0x442f6c;};'use strict';var multer=require(_0x4f8d('0x0'));var util=require(_0x4f8d('0x1'));var path=require(_0x4f8d('0x2'));var timeout=require(_0x4f8d('0x3'));var express=require(_0x4f8d('0x4'));var router=express['Router']();var auth=require(_0x4f8d('0x5'));var interaction=require(_0x4f8d('0x6'));var config=require('../../config/environment');var controller=require(_0x4f8d('0x7'));router['post']('/',auth[_0x4f8d('0x8')](),controller[_0x4f8d('0x9')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/notification/notification.attributes.js b/server/api/notification/notification.attributes.js index ebdf54b..b911686 100644 --- a/server/api/notification/notification.attributes.js +++ b/server/api/notification/notification.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x83d3=['STRING','BOOLEAN','exports','TEXT'];(function(_0xa4efd9,_0x32e05c){var _0x2e708a=function(_0x36320e){while(--_0x36320e){_0xa4efd9['push'](_0xa4efd9['shift']());}};_0x2e708a(++_0x32e05c);}(_0x83d3,0x1ce));var _0x383d=function(_0x1a0600,_0x41feef){_0x1a0600=_0x1a0600-0x0;var _0x734670=_0x83d3[_0x1a0600];return _0x734670;};'use strict';var Sequelize=require('sequelize');module[_0x383d('0x0')]={'body':{'type':Sequelize[_0x383d('0x1')]},'senderName':{'type':Sequelize[_0x383d('0x2')]},'recipientsId':{'type':Sequelize[_0x383d('0x1')]},'recipientsDescription':{'type':Sequelize['STRING']},'beep':{'type':Sequelize[_0x383d('0x3')]}}; \ No newline at end of file +var _0xe688=['TEXT','STRING','exports'];(function(_0x45241c,_0x42a412){var _0x736427=function(_0x444fb0){while(--_0x444fb0){_0x45241c['push'](_0x45241c['shift']());}};_0x736427(++_0x42a412);}(_0xe688,0x140));var _0x8e68=function(_0x730f60,_0x3f32a3){_0x730f60=_0x730f60-0x0;var _0x2b4daa=_0xe688[_0x730f60];return _0x2b4daa;};'use strict';var Sequelize=require('sequelize');module[_0x8e68('0x0')]={'body':{'type':Sequelize[_0x8e68('0x1')]},'senderName':{'type':Sequelize['STRING']},'recipientsId':{'type':Sequelize[_0x8e68('0x1')]},'recipientsDescription':{'type':Sequelize[_0x8e68('0x2')]},'beep':{'type':Sequelize['BOOLEAN']}}; \ No newline at end of file diff --git a/server/api/notification/notification.controller.js b/server/api/notification/notification.controller.js index 7395fa9..8eda267 100644 --- a/server/api/notification/notification.controller.js +++ b/server/api/notification/notification.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1ac8=['mailqueue','smsqueue','voicequeue','whatsappqueue','team','user','some','includes','model','senderName','fullname','recipientsDescription','beep','SenderId','recipientsId','sortBy','join','sequelize','transaction','Notification','create','forEach','emit','notification:send','catch','Template','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','startCase','toLowerCase','User','union','ids','queue','replace','Queue','push','all','flatten','getAgents','map','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','register','sendStatus','status','end','offset','limit','set','Content-Range','json','apply','reject','save','update','then','name','send','sendNotification','body','hasOwnProperty','text','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','error','Invalid\x20\x27recipients\x27\x20object','faxqueue'];(function(_0x4ab4bf,_0x37241e){var _0x45424e=function(_0x2666f7){while(--_0x2666f7){_0x4ab4bf['push'](_0x4ab4bf['shift']());}};_0x45424e(++_0x37241e);}(_0x1ac8,0x154));var _0x81ac=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x1ac8[_0x59ee6f];return _0x4c0979;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x81ac('0x0'));var rimraf=require(_0x81ac('0x1'));var zipdir=require(_0x81ac('0x2'));var jsonpatch=require(_0x81ac('0x3'));var rp=require(_0x81ac('0x4'));var moment=require(_0x81ac('0x5'));var BPromise=require(_0x81ac('0x6'));var Mustache=require('mustache');var util=require(_0x81ac('0x7'));var path=require(_0x81ac('0x8'));var sox=require(_0x81ac('0x9'));var csv=require(_0x81ac('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x81ac('0xb'));var crypto=require(_0x81ac('0xc'));var jsforce=require(_0x81ac('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x81ac('0xe'));var Redis=require('ioredis');var authService=require(_0x81ac('0xf'));var qs=require(_0x81ac('0x10'));var as=require(_0x81ac('0x11'));var hardwareService=require(_0x81ac('0x12'));var logger=require(_0x81ac('0x13'))(_0x81ac('0x14'));var utils=require('../../config/utils');var config=require(_0x81ac('0x15'));var db=require(_0x81ac('0x16'))['db'];config['redis']=_['defaults'](config[_0x81ac('0x17')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x81ac('0x17')]));require('./notification.socket')[_0x81ac('0x18')](socket);function respondWithStatusCode(_0x40aea6,_0x38a945){_0x38a945=_0x38a945||0xcc;return function(_0x55b859){if(_0x55b859){return _0x40aea6[_0x81ac('0x19')](_0x38a945);}return _0x40aea6[_0x81ac('0x1a')](_0x38a945)[_0x81ac('0x1b')]();};}function respondWithResult(_0x25d694,_0x4502c4){_0x4502c4=_0x4502c4||0xc8;return function(_0x4a4d8e){if(_0x4a4d8e){return _0x25d694[_0x81ac('0x1a')](_0x4502c4)['json'](_0x4a4d8e);}};}function respondWithFilteredResult(_0x3508f0,_0x368623){return function(_0x56b6b6){if(_0x56b6b6){var _0x29dfd7=_0x56b6b6['count'],_0x397ce9=_0x368623['offset'],_0x54eacf=_0x368623[_0x81ac('0x1c')]+_0x368623[_0x81ac('0x1d')],_0x30a6d1;if(_0x54eacf>=_0x29dfd7){_0x54eacf=_0x29dfd7;_0x30a6d1=0xc8;}else{_0x30a6d1=0xce;}_0x3508f0[_0x81ac('0x1a')](_0x30a6d1);return _0x3508f0[_0x81ac('0x1e')](_0x81ac('0x1f'),_0x397ce9+'-'+_0x54eacf+'/'+_0x29dfd7)[_0x81ac('0x20')](_0x56b6b6);}return null;};}function patchUpdates(_0x239c20){return function(_0x2ead89){try{jsonpatch[_0x81ac('0x21')](_0x2ead89,_0x239c20,!![]);}catch(_0x3b53b5){return BPromise[_0x81ac('0x22')](_0x3b53b5);}return _0x2ead89[_0x81ac('0x23')]();};}function saveUpdates(_0x1723d4,_0x2a5b34){return function(_0x291ad7){if(_0x291ad7){return _0x291ad7[_0x81ac('0x24')](_0x1723d4)[_0x81ac('0x25')](function(_0x4c4ada){return _0x4c4ada;});}return null;};}function removeEntity(_0x5d44a9,_0x1fbd76){return function(_0x3bdf47){if(_0x3bdf47){return _0x3bdf47['destroy']()['then'](function(){_0x5d44a9[_0x81ac('0x1a')](0xcc)[_0x81ac('0x1b')]();});}};}function handleEntityNotFound(_0x3aacc6,_0x1757e3){return function(_0x450e10){if(!_0x450e10){_0x3aacc6[_0x81ac('0x19')](0x194);}return _0x450e10;};}function handleError(_0x54c896,_0x1937a7){_0x1937a7=_0x1937a7||0x1f4;return function(_0x420362){logger['error'](_0x420362['stack']);if(_0x420362[_0x81ac('0x26')]){delete _0x420362[_0x81ac('0x26')];}_0x54c896[_0x81ac('0x1a')](_0x1937a7)[_0x81ac('0x27')](_0x420362);};}exports[_0x81ac('0x28')]=function(_0x2d5e17,_0x2de446,_0x18ae89){if(!_0x2d5e17[_0x81ac('0x29')][_0x81ac('0x2a')](_0x81ac('0x2b'))&&!_0x2d5e17[_0x81ac('0x29')][_0x81ac('0x2a')](_0x81ac('0x2c'))){throw new db[(_0x81ac('0x2d'))][(_0x81ac('0x2e'))](_0x81ac('0x2f'));}else{if(_0x2d5e17['body'][_0x81ac('0x2a')](_0x81ac('0x2c'))&&!_0x2d5e17['body'][_0x81ac('0x2a')](_0x81ac('0x30'))){throw new db[(_0x81ac('0x2d'))]['ValidationError'](_0x81ac('0x31'));}if(!_0x2d5e17[_0x81ac('0x29')][_0x81ac('0x2a')](_0x81ac('0x32'))){throw new db[(_0x81ac('0x2d'))]['ValidationError'](_0x81ac('0x33'));}else{try{var _0x305b79=JSON[_0x81ac('0x34')](_0x2d5e17['body'][_0x81ac('0x32')]);}catch(_0x2608f7){logger[_0x81ac('0x35')](_0x2608f7);throw new db['Sequelize'][(_0x81ac('0x2e'))](_0x81ac('0x36'));}var _0x127aaf=['chatqueue',_0x81ac('0x37'),_0x81ac('0x38'),'openchannelqueue',_0x81ac('0x39'),_0x81ac('0x3a'),_0x81ac('0x3b'),_0x81ac('0x3c'),_0x81ac('0x3d')];if(_[_0x81ac('0x3e')](_0x305b79,function(_0x1d5317){return!_[_0x81ac('0x3f')](_0x127aaf,_0x1d5317[_0x81ac('0x40')]['toLowerCase']());})){throw new db[(_0x81ac('0x2d'))][(_0x81ac('0x2e'))]('Invalid\x20model\x20in\x20\x27recipients\x27\x20object');}}}var _0x2c6553={};_0x2c6553['senderName']=_0x2d5e17[_0x81ac('0x29')]['hasOwnProperty']('senderName')?_0x2d5e17[_0x81ac('0x29')][_0x81ac('0x41')]:_0x2d5e17[_0x81ac('0x3d')][_0x81ac('0x42')];_0x2c6553[_0x81ac('0x43')]=_['isEmpty'](_0x2d5e17['body']['recipientsDescription'])?null:_0x2d5e17['body'][_0x81ac('0x43')];_0x2c6553[_0x81ac('0x44')]=_0x2d5e17[_0x81ac('0x29')]['beep']||![];_0x2c6553[_0x81ac('0x45')]=_0x2d5e17[_0x81ac('0x3d')]['id'];return getContent(_0x2d5e17['body'])[_0x81ac('0x25')](function(_0x84c9a2){_0x2c6553[_0x81ac('0x29')]=_0x84c9a2;return getRecipients(_0x305b79);})[_0x81ac('0x25')](function(_0x504ceb){_0x2c6553[_0x81ac('0x46')]=_[_0x81ac('0x47')](_0x504ceb)[_0x81ac('0x48')](',');return db[_0x81ac('0x49')][_0x81ac('0x4a')](function(_0x1c6dbc){return db[_0x81ac('0x4b')][_0x81ac('0x4c')](_0x2c6553,{'raw':!![],'transaction':_0x1c6dbc})[_0x81ac('0x25')](function(_0x537e59){var _0x1590a0={'sender':_0x2c6553[_0x81ac('0x41')],'description':_0x2c6553[_0x81ac('0x43')],'content':_0x2c6553[_0x81ac('0x29')],'beep':_0x2c6553[_0x81ac('0x44')]};_0x504ceb[_0x81ac('0x4d')](function(_0xd271ba){_0x1590a0['recipient']=_0xd271ba;socket[_0x81ac('0x4e')](_0x81ac('0x4f'),_0x1590a0);});return _0x537e59;});});})[_0x81ac('0x25')](respondWithResult(_0x2de446,0xc9))[_0x81ac('0x50')](handleError(_0x2de446,null));};function getContent(_0x19eefb){return new BPromise(function(_0x44347e,_0x141f4e){if(_0x19eefb[_0x81ac('0x2b')]){_0x44347e(_0x19eefb['text']);return;}return db[_0x81ac('0x51')][_0x81ac('0x52')]({'attributes':[_0x81ac('0x53')],'where':{'id':_0x19eefb[_0x81ac('0x2c')]},'raw':!![]})['then'](function(_0x12850d){if(!_0x12850d)throw new db[(_0x81ac('0x2d'))][(_0x81ac('0x2e'))](_0x81ac('0x54'));var _0x515a1f=Mustache[_0x81ac('0x55')](_0x12850d[_0x81ac('0x53')],_0x19eefb[_0x81ac('0x30')]);_0x44347e(_0x515a1f);})[_0x81ac('0x50')](function(_0x1cda33){_0x141f4e(_0x1cda33);});});}function getRecipients(_0x453910){return new BPromise(function(_0x1aad83,_0x42d1e4){var _0x5b3993=[];var _0x442325=[];_0x453910[_0x81ac('0x4d')](function(_0x57a435){var _0x4d34f6=_[_0x81ac('0x56')](_0x57a435['model'][_0x81ac('0x57')]());if(_0x4d34f6===_0x81ac('0x58')){_0x5b3993=_[_0x81ac('0x59')](_0x5b3993,_0x57a435[_0x81ac('0x5a')]);}else{if(_[_0x81ac('0x3f')](_0x4d34f6,_0x81ac('0x5b')))_0x4d34f6=_0x4d34f6[_0x81ac('0x5c')](_0x81ac('0x5b'),_0x81ac('0x5d'));_0x57a435[_0x81ac('0x5a')][_0x81ac('0x4d')](function(_0x451c8a){_0x442325[_0x81ac('0x5e')](getAgents(_0x4d34f6,_0x451c8a));});}});return BPromise[_0x81ac('0x5f')](_0x442325)[_0x81ac('0x25')](function(_0x5e9d58){_0x5b3993=_[_0x81ac('0x59')](_0x5b3993,_[_0x81ac('0x60')](_0x5e9d58));_0x1aad83(_0x5b3993);})['catch'](function(_0xfa4278){_0x42d1e4(_0xfa4278);});});}function getAgents(_0x410377,_0xc1b01b){return new BPromise(function(_0x4f3ba0,_0x544505){return db[_0x410377][_0x81ac('0x52')]({'where':{'id':_0xc1b01b}})[_0x81ac('0x25')](function(_0xf7b739){return _0xf7b739[_0x81ac('0x61')]({'attributes':['id'],'raw':!![]})['then'](function(_0x3de784){var _0x14adf8=_[_0x81ac('0x62')](_0x3de784,'id');_0x4f3ba0(_0x14adf8);});})['catch'](function(_0x3fcc18){_0x544505(_0x3fcc18);});});} \ No newline at end of file +var _0xebc0=['sortBy','join','sequelize','Notification','forEach','recipient','notification:send','catch','Template','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','startCase','union','ids','queue','replace','Queue','push','all','flatten','findOne','getAgents','map','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','redis','localhost','socket.io-emitter','./notification.socket','register','status','end','count','offset','limit','set','json','apply','reject','update','then','sendStatus','error','stack','send','sendNotification','body','hasOwnProperty','text','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Missing\x20\x27view\x27\x20parameter','parse','Invalid\x20\x27recipients\x27\x20object','chatqueue','mailqueue','openchannelqueue','smsqueue','voicequeue','user','some','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','isEmpty','beep','SenderId','recipientsId'];(function(_0x14705b,_0x32b5ef){var _0x59d4a8=function(_0x598a83){while(--_0x598a83){_0x14705b['push'](_0x14705b['shift']());}};_0x59d4a8(++_0x32b5ef);}(_0xebc0,0xda));var _0x0ebc=function(_0x19a1ad,_0x44ec36){_0x19a1ad=_0x19a1ad-0x0;var _0x1971fe=_0xebc0[_0x19a1ad];return _0x1971fe;};'use strict';var pdf=require(_0x0ebc('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x0ebc('0x1'));var zipdir=require(_0x0ebc('0x2'));var jsonpatch=require(_0x0ebc('0x3'));var rp=require(_0x0ebc('0x4'));var moment=require(_0x0ebc('0x5'));var BPromise=require(_0x0ebc('0x6'));var Mustache=require(_0x0ebc('0x7'));var util=require(_0x0ebc('0x8'));var path=require(_0x0ebc('0x9'));var sox=require(_0x0ebc('0xa'));var csv=require(_0x0ebc('0xb'));var ejs=require(_0x0ebc('0xc'));var fs=require('fs');var _=require(_0x0ebc('0xd'));var squel=require(_0x0ebc('0xe'));var crypto=require(_0x0ebc('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x0ebc('0x10'));var toCsv=require('to-csv');var querystring=require(_0x0ebc('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x0ebc('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x0ebc('0x13'));var hardwareService=require(_0x0ebc('0x14'));var logger=require(_0x0ebc('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x0ebc('0x16'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0x0ebc('0x17')],{'host':_0x0ebc('0x18'),'port':0x18eb});var socket=require(_0x0ebc('0x19'))(new Redis(config['redis']));require(_0x0ebc('0x1a'))[_0x0ebc('0x1b')](socket);function respondWithStatusCode(_0x438643,_0x371855){_0x371855=_0x371855||0xcc;return function(_0x569447){if(_0x569447){return _0x438643['sendStatus'](_0x371855);}return _0x438643[_0x0ebc('0x1c')](_0x371855)[_0x0ebc('0x1d')]();};}function respondWithResult(_0x4f0667,_0x532f8a){_0x532f8a=_0x532f8a||0xc8;return function(_0x47afba){if(_0x47afba){return _0x4f0667[_0x0ebc('0x1c')](_0x532f8a)['json'](_0x47afba);}};}function respondWithFilteredResult(_0x143d8e,_0x2130b3){return function(_0x5e7af5){if(_0x5e7af5){var _0x5ed62e=_0x5e7af5[_0x0ebc('0x1e')],_0x596786=_0x2130b3[_0x0ebc('0x1f')],_0x8bd689=_0x2130b3['offset']+_0x2130b3[_0x0ebc('0x20')],_0x1c461d;if(_0x8bd689>=_0x5ed62e){_0x8bd689=_0x5ed62e;_0x1c461d=0xc8;}else{_0x1c461d=0xce;}_0x143d8e[_0x0ebc('0x1c')](_0x1c461d);return _0x143d8e[_0x0ebc('0x21')]('Content-Range',_0x596786+'-'+_0x8bd689+'/'+_0x5ed62e)[_0x0ebc('0x22')](_0x5e7af5);}return null;};}function patchUpdates(_0x42a032){return function(_0x5e1ea0){try{jsonpatch[_0x0ebc('0x23')](_0x5e1ea0,_0x42a032,!![]);}catch(_0x51b2e1){return BPromise[_0x0ebc('0x24')](_0x51b2e1);}return _0x5e1ea0['save']();};}function saveUpdates(_0x5d47bc,_0x49a4d5){return function(_0x5718ea){if(_0x5718ea){return _0x5718ea[_0x0ebc('0x25')](_0x5d47bc)['then'](function(_0x28b73f){return _0x28b73f;});}return null;};}function removeEntity(_0x41afd3,_0x50f013){return function(_0x1a32bb){if(_0x1a32bb){return _0x1a32bb['destroy']()[_0x0ebc('0x26')](function(){_0x41afd3[_0x0ebc('0x1c')](0xcc)[_0x0ebc('0x1d')]();});}};}function handleEntityNotFound(_0x557cba,_0x57490d){return function(_0x44fa62){if(!_0x44fa62){_0x557cba[_0x0ebc('0x27')](0x194);}return _0x44fa62;};}function handleError(_0x506aa9,_0x1148da){_0x1148da=_0x1148da||0x1f4;return function(_0x162f0d){logger[_0x0ebc('0x28')](_0x162f0d[_0x0ebc('0x29')]);if(_0x162f0d['name']){delete _0x162f0d['name'];}_0x506aa9[_0x0ebc('0x1c')](_0x1148da)[_0x0ebc('0x2a')](_0x162f0d);};}exports[_0x0ebc('0x2b')]=function(_0x1737fe,_0x123646,_0x231fbb){if(!_0x1737fe[_0x0ebc('0x2c')][_0x0ebc('0x2d')](_0x0ebc('0x2e'))&&!_0x1737fe[_0x0ebc('0x2c')][_0x0ebc('0x2d')](_0x0ebc('0x2f'))){throw new db[(_0x0ebc('0x30'))][(_0x0ebc('0x31'))](_0x0ebc('0x32'));}else{if(_0x1737fe[_0x0ebc('0x2c')][_0x0ebc('0x2d')]('TemplateId')&&!_0x1737fe[_0x0ebc('0x2c')][_0x0ebc('0x2d')](_0x0ebc('0x33'))){throw new db[(_0x0ebc('0x30'))][(_0x0ebc('0x31'))](_0x0ebc('0x34'));}if(!_0x1737fe[_0x0ebc('0x2c')][_0x0ebc('0x2d')]('recipients')){throw new db['Sequelize'][(_0x0ebc('0x31'))]('Missing\x20\x27recipients\x27\x20parameter');}else{try{var _0x4627a4=JSON[_0x0ebc('0x35')](_0x1737fe['body']['recipients']);}catch(_0x5c585d){logger[_0x0ebc('0x28')](_0x5c585d);throw new db[(_0x0ebc('0x30'))][(_0x0ebc('0x31'))](_0x0ebc('0x36'));}var _0x477126=[_0x0ebc('0x37'),'faxqueue',_0x0ebc('0x38'),_0x0ebc('0x39'),_0x0ebc('0x3a'),_0x0ebc('0x3b'),'whatsappqueue','team',_0x0ebc('0x3c')];if(_[_0x0ebc('0x3d')](_0x4627a4,function(_0x212be5){return!_[_0x0ebc('0x3e')](_0x477126,_0x212be5[_0x0ebc('0x3f')][_0x0ebc('0x40')]());})){throw new db[(_0x0ebc('0x30'))][(_0x0ebc('0x31'))](_0x0ebc('0x41'));}}}var _0x183b3a={};_0x183b3a[_0x0ebc('0x42')]=_0x1737fe[_0x0ebc('0x2c')][_0x0ebc('0x2d')](_0x0ebc('0x42'))?_0x1737fe[_0x0ebc('0x2c')][_0x0ebc('0x42')]:_0x1737fe[_0x0ebc('0x3c')][_0x0ebc('0x43')];_0x183b3a[_0x0ebc('0x44')]=_[_0x0ebc('0x45')](_0x1737fe[_0x0ebc('0x2c')]['recipientsDescription'])?null:_0x1737fe[_0x0ebc('0x2c')][_0x0ebc('0x44')];_0x183b3a[_0x0ebc('0x46')]=_0x1737fe[_0x0ebc('0x2c')][_0x0ebc('0x46')]||![];_0x183b3a[_0x0ebc('0x47')]=_0x1737fe[_0x0ebc('0x3c')]['id'];return getContent(_0x1737fe[_0x0ebc('0x2c')])[_0x0ebc('0x26')](function(_0x2273fb){_0x183b3a[_0x0ebc('0x2c')]=_0x2273fb;return getRecipients(_0x4627a4);})['then'](function(_0x501411){_0x183b3a[_0x0ebc('0x48')]=_[_0x0ebc('0x49')](_0x501411)[_0x0ebc('0x4a')](',');return db[_0x0ebc('0x4b')]['transaction'](function(_0x85fdc8){return db[_0x0ebc('0x4c')]['create'](_0x183b3a,{'raw':!![],'transaction':_0x85fdc8})[_0x0ebc('0x26')](function(_0xe8b195){var _0x1d9b8c={'sender':_0x183b3a['senderName'],'description':_0x183b3a[_0x0ebc('0x44')],'content':_0x183b3a[_0x0ebc('0x2c')],'beep':_0x183b3a[_0x0ebc('0x46')]};_0x501411[_0x0ebc('0x4d')](function(_0x2f63a0){_0x1d9b8c[_0x0ebc('0x4e')]=_0x2f63a0;socket['emit'](_0x0ebc('0x4f'),_0x1d9b8c);});return _0xe8b195;});});})['then'](respondWithResult(_0x123646,0xc9))[_0x0ebc('0x50')](handleError(_0x123646,null));};function getContent(_0x45e984){return new BPromise(function(_0xd9b93,_0x32fc3d){if(_0x45e984['text']){_0xd9b93(_0x45e984['text']);return;}return db[_0x0ebc('0x51')]['findOne']({'attributes':[_0x0ebc('0x52')],'where':{'id':_0x45e984[_0x0ebc('0x2f')]},'raw':!![]})[_0x0ebc('0x26')](function(_0xc46a67){if(!_0xc46a67)throw new db[(_0x0ebc('0x30'))][(_0x0ebc('0x31'))](_0x0ebc('0x53'));var _0x4b31fd=Mustache[_0x0ebc('0x54')](_0xc46a67[_0x0ebc('0x52')],_0x45e984[_0x0ebc('0x33')]);_0xd9b93(_0x4b31fd);})[_0x0ebc('0x50')](function(_0x496808){_0x32fc3d(_0x496808);});});}function getRecipients(_0x5846b6){return new BPromise(function(_0x464631,_0x19b0c4){var _0x171ad4=[];var _0x125664=[];_0x5846b6[_0x0ebc('0x4d')](function(_0x580e1c){var _0x46adcb=_[_0x0ebc('0x55')](_0x580e1c[_0x0ebc('0x3f')]['toLowerCase']());if(_0x46adcb==='User'){_0x171ad4=_[_0x0ebc('0x56')](_0x171ad4,_0x580e1c[_0x0ebc('0x57')]);}else{if(_[_0x0ebc('0x3e')](_0x46adcb,_0x0ebc('0x58')))_0x46adcb=_0x46adcb[_0x0ebc('0x59')](_0x0ebc('0x58'),_0x0ebc('0x5a'));_0x580e1c['ids']['forEach'](function(_0x12cafc){_0x125664[_0x0ebc('0x5b')](getAgents(_0x46adcb,_0x12cafc));});}});return BPromise[_0x0ebc('0x5c')](_0x125664)[_0x0ebc('0x26')](function(_0x1b6524){_0x171ad4=_[_0x0ebc('0x56')](_0x171ad4,_[_0x0ebc('0x5d')](_0x1b6524));_0x464631(_0x171ad4);})[_0x0ebc('0x50')](function(_0x298bf3){_0x19b0c4(_0x298bf3);});});}function getAgents(_0x6c9da7,_0x34f918){return new BPromise(function(_0x2fafc9,_0x50459a){return db[_0x6c9da7][_0x0ebc('0x5e')]({'where':{'id':_0x34f918}})[_0x0ebc('0x26')](function(_0x384a37){return _0x384a37[_0x0ebc('0x5f')]({'attributes':['id'],'raw':!![]})[_0x0ebc('0x26')](function(_0xfc814e){var _0x1f7ea3=_[_0x0ebc('0x60')](_0xfc814e,'id');_0x2fafc9(_0x1f7ea3);});})[_0x0ebc('0x50')](function(_0x33c496){_0x50459a(_0x33c496);});});} \ No newline at end of file diff --git a/server/api/notification/notification.events.js b/server/api/notification/notification.events.js index b7ee1c3..64da8fb 100644 --- a/server/api/notification/notification.events.js +++ b/server/api/notification/notification.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f66=['remove','emit','exports','../../mysqldb','setMaxListeners','save','update'];(function(_0x1ba427,_0x386726){var _0x189323=function(_0x5a64f0){while(--_0x5a64f0){_0x1ba427['push'](_0x1ba427['shift']());}};_0x189323(++_0x386726);}(_0x5f66,0x1a0));var _0x65f6=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x5f66[_0x19e35c];return _0x3e1fe8;};'use strict';var EventEmitter=require('events');var Notification=require(_0x65f6('0x0'))['db']['Notification'];var NotificationEvents=new EventEmitter();NotificationEvents[_0x65f6('0x1')](0x0);var events={'afterCreate':_0x65f6('0x2'),'afterUpdate':_0x65f6('0x3'),'afterDestroy':_0x65f6('0x4')};function emitEvent(_0x1a330c){return function(_0x5eb9ad,_0x3c5029,_0x5150c8){NotificationEvents[_0x65f6('0x5')](_0x1a330c+':'+_0x5eb9ad['id'],_0x5eb9ad);NotificationEvents[_0x65f6('0x5')](_0x1a330c,_0x5eb9ad);_0x5150c8(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Notification['hook'](e,emitEvent(event));}}module[_0x65f6('0x6')]=NotificationEvents; \ No newline at end of file +var _0x5f2f=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','Notification','setMaxListeners','save','update'];(function(_0x31a9b7,_0x48c4ce){var _0x3d4aa3=function(_0xbe0b60){while(--_0xbe0b60){_0x31a9b7['push'](_0x31a9b7['shift']());}};_0x3d4aa3(++_0x48c4ce);}(_0x5f2f,0x73));var _0xf5f2=function(_0x1e6d0e,_0x3c2caf){_0x1e6d0e=_0x1e6d0e-0x0;var _0x437125=_0x5f2f[_0x1e6d0e];return _0x437125;};'use strict';var EventEmitter=require(_0xf5f2('0x0'));var Notification=require(_0xf5f2('0x1'))['db'][_0xf5f2('0x2')];var NotificationEvents=new EventEmitter();NotificationEvents[_0xf5f2('0x3')](0x0);var events={'afterCreate':_0xf5f2('0x4'),'afterUpdate':_0xf5f2('0x5'),'afterDestroy':_0xf5f2('0x6')};function emitEvent(_0x107cf){return function(_0x501fbd,_0x4854b6,_0x1665c7){NotificationEvents[_0xf5f2('0x7')](_0x107cf+':'+_0x501fbd['id'],_0x501fbd);NotificationEvents[_0xf5f2('0x7')](_0x107cf,_0x501fbd);_0x1665c7(null);};}for(var e in events){if(events[_0xf5f2('0x8')](e)){var event=events[e];Notification[_0xf5f2('0x9')](e,emitEvent(event));}}module[_0xf5f2('0xa')]=NotificationEvents; \ No newline at end of file diff --git a/server/api/notification/notification.model.js b/server/api/notification/notification.model.js index 1649ad5..02cec48 100644 --- a/server/api/notification/notification.model.js +++ b/server/api/notification/notification.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6297=['./notification.attributes','exports','define','Notification','notifications','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x1c0991,_0x4f22d2){var _0x5034de=function(_0x520f49){while(--_0x520f49){_0x1c0991['push'](_0x1c0991['shift']());}};_0x5034de(++_0x4f22d2);}(_0x6297,0x106));var _0x7629=function(_0x3cb7d1,_0x47c94c){_0x3cb7d1=_0x3cb7d1-0x0;var _0x39db46=_0x6297[_0x3cb7d1];return _0x39db46;};'use strict';var _=require(_0x7629('0x0'));var util=require(_0x7629('0x1'));var logger=require(_0x7629('0x2'))(_0x7629('0x3'));var moment=require(_0x7629('0x4'));var BPromise=require(_0x7629('0x5'));var rp=require(_0x7629('0x6'));var fs=require('fs');var path=require(_0x7629('0x7'));var rimraf=require(_0x7629('0x8'));var config=require(_0x7629('0x9'));var attributes=require(_0x7629('0xa'));module[_0x7629('0xb')]=function(_0x585974,_0x2ed10e){return _0x585974[_0x7629('0xc')](_0x7629('0xd'),attributes,{'tableName':_0x7629('0xe'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x7629('0xf')});}; \ No newline at end of file +var _0xfd23=['utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./notification.attributes','exports','Notification','utf8mb4'];(function(_0x43559c,_0x2fae4c){var _0x8672f1=function(_0x17c39d){while(--_0x17c39d){_0x43559c['push'](_0x43559c['shift']());}};_0x8672f1(++_0x2fae4c);}(_0xfd23,0x1ae));var _0x3fd2=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xfd23[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0x3fd2('0x0'));var util=require(_0x3fd2('0x1'));var logger=require(_0x3fd2('0x2'))(_0x3fd2('0x3'));var moment=require(_0x3fd2('0x4'));var BPromise=require(_0x3fd2('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3fd2('0x6'));var rimraf=require(_0x3fd2('0x7'));var config=require('../../config/environment');var attributes=require(_0x3fd2('0x8'));module[_0x3fd2('0x9')]=function(_0x1d5936,_0x3b922f){return _0x1d5936['define'](_0x3fd2('0xa'),attributes,{'tableName':'notifications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x3fd2('0xb'),'collate':_0x3fd2('0xc')});}; \ No newline at end of file diff --git a/server/api/notification/notification.rpc.js b/server/api/notification/notification.rpc.js index fb8ffb7..f72e556 100644 --- a/server/api/notification/notification.rpc.js +++ b/server/api/notification/notification.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc472=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','request\x20sent','debug','error','code','Notification,\x20%s,\x20%s','message','info','result','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xc472,0xe4));var _0x2c47=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0xc472[_0x311c35];return _0x5cc50c;};'use strict';var _=require('lodash');var util=require(_0x2c47('0x0'));var moment=require(_0x2c47('0x1'));var BPromise=require('bluebird');var rs=require(_0x2c47('0x2'));var fs=require('fs');var Redis=require(_0x2c47('0x3'));var db=require(_0x2c47('0x4'))['db'];var utils=require(_0x2c47('0x5'));var logger=require(_0x2c47('0x6'))(_0x2c47('0x7'));var config=require(_0x2c47('0x8'));var jayson=require(_0x2c47('0x9'));var client=jayson[_0x2c47('0xa')][_0x2c47('0xb')]({'port':0x232a});config[_0x2c47('0xc')]=_[_0x2c47('0xd')](config['redis'],{'host':_0x2c47('0xe'),'port':0x18eb});var socket=require(_0x2c47('0xf'))(new Redis(config[_0x2c47('0xc')]));require('./notification.socket')[_0x2c47('0x10')](socket);function respondWithRpcPromise(_0x58190c,_0x5985ef,_0x1057aa){return new BPromise(function(_0x497c2c,_0x31f53d){return client[_0x2c47('0x11')](_0x58190c,_0x1057aa)['then'](function(_0x16771e){logger['info']('Notification,\x20%s,\x20%s',_0x5985ef,_0x2c47('0x12'));logger[_0x2c47('0x13')]('Notification,\x20%s,\x20%s,\x20%s',_0x5985ef,_0x2c47('0x12'),JSON['stringify'](_0x16771e));if(_0x16771e[_0x2c47('0x14')]){if(_0x16771e[_0x2c47('0x14')][_0x2c47('0x15')]===0x1f4){logger['error'](_0x2c47('0x16'),_0x5985ef,_0x16771e[_0x2c47('0x14')][_0x2c47('0x17')]);return _0x31f53d(_0x16771e[_0x2c47('0x14')][_0x2c47('0x17')]);}logger[_0x2c47('0x14')](_0x2c47('0x16'),_0x5985ef,_0x16771e[_0x2c47('0x14')][_0x2c47('0x17')]);return _0x497c2c(_0x16771e[_0x2c47('0x14')][_0x2c47('0x17')]);}else{logger[_0x2c47('0x18')](_0x2c47('0x16'),_0x5985ef,_0x2c47('0x12'));_0x497c2c(_0x16771e[_0x2c47('0x19')][_0x2c47('0x17')]);}})['catch'](function(_0x2516b0){logger[_0x2c47('0x14')](_0x2c47('0x16'),_0x5985ef,_0x2516b0);_0x31f53d(_0x2516b0);});});} \ No newline at end of file +var _0xf1a1=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./notification.socket','register','request','info','debug','Notification,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','Notification,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','ioredis'];(function(_0x562f3b,_0x4c65ae){var _0x1edd55=function(_0xe67e06){while(--_0xe67e06){_0x562f3b['push'](_0x562f3b['shift']());}};_0x1edd55(++_0x4c65ae);}(_0xf1a1,0x1cb));var _0x1f1a=function(_0xd5ba4e,_0x5ebd34){_0xd5ba4e=_0xd5ba4e-0x0;var _0x52d47f=_0xf1a1[_0xd5ba4e];return _0x52d47f;};'use strict';var _=require(_0x1f1a('0x0'));var util=require(_0x1f1a('0x1'));var moment=require(_0x1f1a('0x2'));var BPromise=require(_0x1f1a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1f1a('0x4'));var db=require(_0x1f1a('0x5'))['db'];var utils=require(_0x1f1a('0x6'));var logger=require(_0x1f1a('0x7'))('rpc');var config=require(_0x1f1a('0x8'));var jayson=require(_0x1f1a('0x9'));var client=jayson[_0x1f1a('0xa')][_0x1f1a('0xb')]({'port':0x232a});config[_0x1f1a('0xc')]=_[_0x1f1a('0xd')](config[_0x1f1a('0xc')],{'host':_0x1f1a('0xe'),'port':0x18eb});var socket=require(_0x1f1a('0xf'))(new Redis(config['redis']));require(_0x1f1a('0x10'))[_0x1f1a('0x11')](socket);function respondWithRpcPromise(_0x194802,_0x214178,_0x38f871){return new BPromise(function(_0x47fea9,_0x1995d0){return client[_0x1f1a('0x12')](_0x194802,_0x38f871)['then'](function(_0x11d9dc){logger[_0x1f1a('0x13')]('Notification,\x20%s,\x20%s',_0x214178,'request\x20sent');logger[_0x1f1a('0x14')](_0x1f1a('0x15'),_0x214178,_0x1f1a('0x16'),JSON[_0x1f1a('0x17')](_0x11d9dc));if(_0x11d9dc['error']){if(_0x11d9dc[_0x1f1a('0x18')][_0x1f1a('0x19')]===0x1f4){logger[_0x1f1a('0x18')](_0x1f1a('0x1a'),_0x214178,_0x11d9dc[_0x1f1a('0x18')][_0x1f1a('0x1b')]);return _0x1995d0(_0x11d9dc[_0x1f1a('0x18')]['message']);}logger[_0x1f1a('0x18')]('Notification,\x20%s,\x20%s',_0x214178,_0x11d9dc[_0x1f1a('0x18')][_0x1f1a('0x1b')]);return _0x47fea9(_0x11d9dc[_0x1f1a('0x18')][_0x1f1a('0x1b')]);}else{logger[_0x1f1a('0x13')](_0x1f1a('0x1a'),_0x214178,_0x1f1a('0x16'));_0x47fea9(_0x11d9dc[_0x1f1a('0x1c')]['message']);}})['catch'](function(_0x1ce8cc){logger[_0x1f1a('0x18')](_0x1f1a('0x1a'),_0x214178,_0x1ce8cc);_0x1995d0(_0x1ce8cc);});});} \ No newline at end of file diff --git a/server/api/notification/notification.socket.js b/server/api/notification/notification.socket.js index eea18a8..1556d24 100644 --- a/server/api/notification/notification.socket.js +++ b/server/api/notification/notification.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbab9=['removeListener','register','length','notification:','./notification.events','remove'];(function(_0x540a70,_0xad64aa){var _0xebf67e=function(_0x8455b6){while(--_0x8455b6){_0x540a70['push'](_0x540a70['shift']());}};_0xebf67e(++_0xad64aa);}(_0xbab9,0x136));var _0x9bab=function(_0x15ff2d,_0x4db217){_0x15ff2d=_0x15ff2d-0x0;var _0x2c0756=_0xbab9[_0x15ff2d];return _0x2c0756;};'use strict';var NotificationEvents=require(_0x9bab('0x0'));var events=['save',_0x9bab('0x1'),'update'];function createListener(_0xf9c4fe,_0x5473d8){return function(_0x15852d){_0x5473d8['emit'](_0xf9c4fe,_0x15852d);};}function removeListener(_0x329395,_0x43fa51){return function(){NotificationEvents[_0x9bab('0x2')](_0x329395,_0x43fa51);};}exports[_0x9bab('0x3')]=function(_0x39af45){for(var _0x6b453a=0x0,_0x5c6f23=events[_0x9bab('0x4')];_0x6b453a<_0x5c6f23;_0x6b453a++){var _0x3e01a1=events[_0x6b453a];var _0x374a22=createListener(_0x9bab('0x5')+_0x3e01a1,_0x39af45);NotificationEvents['on'](_0x3e01a1,_0x374a22);}}; \ No newline at end of file +var _0xc3ac=['remove','update','emit','removeListener','register','length','notification:','./notification.events','save'];(function(_0x1d130e,_0x314633){var _0x156c2f=function(_0x5751d2){while(--_0x5751d2){_0x1d130e['push'](_0x1d130e['shift']());}};_0x156c2f(++_0x314633);}(_0xc3ac,0x10c));var _0xcc3a=function(_0x3135e1,_0x49be2e){_0x3135e1=_0x3135e1-0x0;var _0x32984a=_0xc3ac[_0x3135e1];return _0x32984a;};'use strict';var NotificationEvents=require(_0xcc3a('0x0'));var events=[_0xcc3a('0x1'),_0xcc3a('0x2'),_0xcc3a('0x3')];function createListener(_0x176f51,_0x18c259){return function(_0x4ad30d){_0x18c259[_0xcc3a('0x4')](_0x176f51,_0x4ad30d);};}function removeListener(_0x556650,_0x14caa4){return function(){NotificationEvents[_0xcc3a('0x5')](_0x556650,_0x14caa4);};}exports[_0xcc3a('0x6')]=function(_0x3a7407){for(var _0x111d3e=0x0,_0x3ca4c9=events[_0xcc3a('0x7')];_0x111d3e<_0x3ca4c9;_0x111d3e++){var _0x4f5196=events[_0x111d3e];var _0x43679b=createListener(_0xcc3a('0x8')+_0x4f5196,_0x3a7407);NotificationEvents['on'](_0x4f5196,_0x43679b);}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index f0ae1b2..c852f94 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 _0x1200=['exports','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/interactions','getInteractions','/:id/users','getAgents','create','post','addDisposition','/:id/notify','notify','/:id/applications','addApplications','/:id/send','update','delete','removeAgents'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1200,0x111));var _0x0120=function(_0x571c1d,_0x3b0586){_0x571c1d=_0x571c1d-0x0;var _0x33c609=_0x1200[_0x571c1d];return _0x33c609;};'use strict';var multer=require(_0x0120('0x0'));var util=require(_0x0120('0x1'));var path=require(_0x0120('0x2'));var timeout=require('connect-timeout');var express=require(_0x0120('0x3'));var router=express[_0x0120('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x0120('0x5'));var config=require(_0x0120('0x6'));var controller=require('./openchannelAccount.controller');router[_0x0120('0x7')]('/',auth['isAuthenticated'](),controller[_0x0120('0x8')]);router['get'](_0x0120('0x9'),auth[_0x0120('0xa')](),controller[_0x0120('0xb')]);router['get'](_0x0120('0xc'),auth[_0x0120('0xa')](),controller[_0x0120('0xd')]);router[_0x0120('0x7')](_0x0120('0xe'),auth[_0x0120('0xa')](),controller[_0x0120('0xf')]);router['get'](_0x0120('0x10'),auth[_0x0120('0xa')](),controller[_0x0120('0x11')]);router[_0x0120('0x7')]('/:id/applications',auth[_0x0120('0xa')](),controller['getApplications']);router[_0x0120('0x7')](_0x0120('0x12'),auth[_0x0120('0xa')](),controller[_0x0120('0x13')]);router[_0x0120('0x7')](_0x0120('0x14'),auth[_0x0120('0xa')](),controller[_0x0120('0x15')]);router['post']('/',auth[_0x0120('0xa')](),controller[_0x0120('0x16')]);router[_0x0120('0x17')](_0x0120('0xe'),auth['isAuthenticated'](),controller[_0x0120('0x18')]);router[_0x0120('0x17')](_0x0120('0x10'),auth['isAuthenticated'](),controller['addAnswer']);router['post'](_0x0120('0x19'),controller[_0x0120('0x1a')]);router[_0x0120('0x17')](_0x0120('0x1b'),auth['isAuthenticated'](),controller[_0x0120('0x1c')]);router[_0x0120('0x17')](_0x0120('0x14'),auth['isAuthenticated'](),controller['addAgents']);router['post'](_0x0120('0x1d'),auth[_0x0120('0xa')](),controller['send']);router['put'](_0x0120('0xc'),auth[_0x0120('0xa')](),controller[_0x0120('0x1e')]);router[_0x0120('0x1f')](_0x0120('0xc'),auth['isAuthenticated'](),controller['destroy']);router[_0x0120('0x1f')](_0x0120('0xe'),auth[_0x0120('0xa')](),controller['removeDispositions']);router[_0x0120('0x1f')](_0x0120('0x10'),auth[_0x0120('0xa')](),controller['removeAnswers']);router['delete'](_0x0120('0x14'),auth[_0x0120('0xa')](),controller[_0x0120('0x20')]);module[_0x0120('0x21')]=router; \ No newline at end of file +var _0x865e=['get','isAuthenticated','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/interactions','getInteractions','/:id/users','getAgents','post','create','addAnswer','/:id/notify','notify','/:id/applications','addApplications','/:id/send','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelAccount.controller'];(function(_0x5201a0,_0x388ee9){var _0x3926e2=function(_0x4a4634){while(--_0x4a4634){_0x5201a0['push'](_0x5201a0['shift']());}};_0x3926e2(++_0x388ee9);}(_0x865e,0x190));var _0xe865=function(_0xe73080,_0x24c56d){_0xe73080=_0xe73080-0x0;var _0x12cbc4=_0x865e[_0xe73080];return _0x12cbc4;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xe865('0x0'));var express=require(_0xe865('0x1'));var router=express[_0xe865('0x2')]();var auth=require(_0xe865('0x3'));var interaction=require(_0xe865('0x4'));var config=require(_0xe865('0x5'));var controller=require(_0xe865('0x6'));router[_0xe865('0x7')]('/',auth[_0xe865('0x8')](),controller['index']);router['get'](_0xe865('0x9'),auth[_0xe865('0x8')](),controller[_0xe865('0xa')]);router[_0xe865('0x7')](_0xe865('0xb'),auth[_0xe865('0x8')](),controller[_0xe865('0xc')]);router['get'](_0xe865('0xd'),auth[_0xe865('0x8')](),controller[_0xe865('0xe')]);router[_0xe865('0x7')](_0xe865('0xf'),auth[_0xe865('0x8')](),controller[_0xe865('0x10')]);router[_0xe865('0x7')]('/:id/applications',auth[_0xe865('0x8')](),controller['getApplications']);router['get'](_0xe865('0x11'),auth[_0xe865('0x8')](),controller[_0xe865('0x12')]);router[_0xe865('0x7')](_0xe865('0x13'),auth['isAuthenticated'](),controller[_0xe865('0x14')]);router[_0xe865('0x15')]('/',auth[_0xe865('0x8')](),controller[_0xe865('0x16')]);router[_0xe865('0x15')](_0xe865('0xd'),auth[_0xe865('0x8')](),controller['addDisposition']);router[_0xe865('0x15')](_0xe865('0xf'),auth['isAuthenticated'](),controller[_0xe865('0x17')]);router['post'](_0xe865('0x18'),controller[_0xe865('0x19')]);router[_0xe865('0x15')](_0xe865('0x1a'),auth[_0xe865('0x8')](),controller[_0xe865('0x1b')]);router['post'](_0xe865('0x13'),auth[_0xe865('0x8')](),controller['addAgents']);router[_0xe865('0x15')](_0xe865('0x1c'),auth[_0xe865('0x8')](),controller['send']);router[_0xe865('0x1d')](_0xe865('0xb'),auth['isAuthenticated'](),controller[_0xe865('0x1e')]);router[_0xe865('0x1f')](_0xe865('0xb'),auth['isAuthenticated'](),controller[_0xe865('0x20')]);router[_0xe865('0x1f')](_0xe865('0xd'),auth[_0xe865('0x8')](),controller[_0xe865('0x21')]);router[_0xe865('0x1f')](_0xe865('0xf'),auth[_0xe865('0x8')](),controller[_0xe865('0x22')]);router[_0xe865('0x1f')]('/:id/users',auth[_0xe865('0x8')](),controller[_0xe865('0x23')]);module[_0xe865('0x24')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index cc532f9..efb9233 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 _0xa61a=['sequelize','randomstring','STRING','name','generate','BOOLEAN','INTEGER','setDataValue','mandatoryDisposition'];(function(_0xd3756e,_0x526342){var _0x385776=function(_0x12d073){while(--_0x12d073){_0xd3756e['push'](_0xd3756e['shift']());}};_0x385776(++_0x526342);}(_0xa61a,0x99));var _0xaa61=function(_0x591db7,_0x150445){_0x591db7=_0x591db7-0x0;var _0x4ad760=_0xa61a[_0x591db7];return _0x4ad760;};'use strict';var Sequelize=require(_0xaa61('0x0'));var rs=require(_0xaa61('0x1'));module['exports']={'name':{'type':Sequelize[_0xaa61('0x2')],'unique':_0xaa61('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0xaa61('0x2')]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0xaa61('0x4')]();}},'replyUri':{'type':Sequelize[_0xaa61('0x2')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize['STRING'],'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[_0xaa61('0x5')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xaa61('0x5')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0xaa61('0x2')]},'queueTransfer':{'type':Sequelize[_0xaa61('0x5')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xaa61('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xaa61('0x5')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xaa61('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xaa61('0x6')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xaa61('0x5')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x461438){if(!_0x461438)this[_0xaa61('0x7')]('mandatoryDispositionPauseId',null);this['setDataValue'](_0xaa61('0x8'),_0x461438);}}}; \ No newline at end of file +var _0x1b94=['Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','randomstring','exports','STRING','generate'];(function(_0x37bdec,_0x2587e2){var _0x36a2b9=function(_0x18c76b){while(--_0x18c76b){_0x37bdec['push'](_0x37bdec['shift']());}};_0x36a2b9(++_0x2587e2);}(_0x1b94,0x19e));var _0x41b9=function(_0x344a3f,_0x579a22){_0x344a3f=_0x344a3f-0x0;var _0x264712=_0x1b94[_0x344a3f];return _0x264712;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x41b9('0x0'));module[_0x41b9('0x1')]={'name':{'type':Sequelize[_0x41b9('0x2')],'unique':'name','allowNull':![]},'description':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x41b9('0x2')],'defaultValue':function(){return rs[_0x41b9('0x3')]();}},'replyUri':{'type':Sequelize[_0x41b9('0x2')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x41b9('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x41b9('0x4');}},'notificationSound':{'type':Sequelize[_0x41b9('0x5')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x41b9('0x5')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x41b9('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x41b9('0x2')]},'queueTransfer':{'type':Sequelize[_0x41b9('0x5')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x41b9('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x41b9('0x5')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x41b9('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x41b9('0x6')],'allowNull':!![],'defaultValue':null,'comment':_0x41b9('0x7')},'mandatoryDisposition':{'type':Sequelize[_0x41b9('0x5')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x4f150a){if(!_0x4f150a)this[_0x41b9('0x8')](_0x41b9('0x9'),null);this[_0x41b9('0x8')](_0x41b9('0xa'),_0x4f150a);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index ea69ecb..5c2c514 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 _0xc1b9=['moment','bluebird','util','path','sox','ejs','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','register','jayson/promise','client','http','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','end','count','offset','set','Content-Range','json','apply','reject','save','update','destroy','stack','name','send','index','Pause','mandatoryDispositionPause','map','OpenchannelAccount','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','findAll','rows','show','params','keys','include','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','OpenchannelAccounts','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','OpnechannelAccountId','Disposition','findOne','OpenchannelAccountId','addAnswer','CannedAnswer','removeAnswers','ids','openchannel','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','List','CmContact','Contacts','DESC','OpenchannelApplication','Applications','account','applications','orderBy','priority','asc','contact','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','messageId','interaction','created','push','close','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','User','UserId','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','notify','bulkCreate','findAndCountAll','getApplications','getInteractions','Contact','Owner','Tag','Tags','color','tag','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','CmList','out','Messages','dataValues','html-pdf','eml-format','rimraf','fast-json-patch','request-promise'];(function(_0x2285be,_0x39728b){var _0x59ce16=function(_0x24abea){while(--_0x24abea){_0x2285be['push'](_0x2285be['shift']());}};_0x59ce16(++_0x39728b);}(_0xc1b9,0xb8));var _0x9c1b=function(_0x4c05da,_0x414720){_0x4c05da=_0x4c05da-0x0;var _0x1614db=_0xc1b9[_0x4c05da];return _0x1614db;};'use strict';var pdf=require(_0x9c1b('0x0'));var emlformat=require(_0x9c1b('0x1'));var rimraf=require(_0x9c1b('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9c1b('0x3'));var rp=require(_0x9c1b('0x4'));var moment=require(_0x9c1b('0x5'));var BPromise=require(_0x9c1b('0x6'));var Mustache=require('mustache');var util=require(_0x9c1b('0x7'));var path=require(_0x9c1b('0x8'));var sox=require(_0x9c1b('0x9'));var csv=require('to-csv');var ejs=require(_0x9c1b('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x9c1b('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x9c1b('0xc'));var toCsv=require('to-csv');var querystring=require(_0x9c1b('0xd'));var Papa=require(_0x9c1b('0xe'));var Redis=require(_0x9c1b('0xf'));var authService=require(_0x9c1b('0x10'));var qs=require(_0x9c1b('0x11'));var as=require(_0x9c1b('0x12'));var hardwareService=require(_0x9c1b('0x13'));var logger=require(_0x9c1b('0x14'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x9c1b('0x15'))['db'];config[_0x9c1b('0x16')]=_[_0x9c1b('0x17')](config[_0x9c1b('0x16')],{'host':_0x9c1b('0x18'),'port':0x18eb});var socket=require(_0x9c1b('0x19'))(new Redis(config['redis']));require(_0x9c1b('0x1a'))[_0x9c1b('0x1b')](socket);var jayson=require(_0x9c1b('0x1c'));var client=jayson[_0x9c1b('0x1d')]['http']({'port':0x232c});var client9002=jayson['client'][_0x9c1b('0x1e')]({'port':0x232a});function checkPasswordPattern(_0xb33928,_0x51307c,_0x4a7260){if(_0x4a7260){var _0x390ba8=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x390ba8[_0x9c1b('0x1f')](_0x51307c)){return _0xb33928;}else{throw new db[(_0x9c1b('0x20'))]['ValidationError'](_0x9c1b('0x21'));}}else{return _0xb33928;}}function respondWithRpcPromise(_0x508010,_0x2564a7,_0x26462f,_0x17912c){return new BPromise(function(_0x5c8d89,_0x202109){var _0x201fd=_0x17912c||client;return _0x201fd[_0x9c1b('0x22')](_0x508010,_0x26462f)[_0x9c1b('0x23')](function(_0xe976b9){logger[_0x9c1b('0x24')](_0x9c1b('0x25'),_0x2564a7,_0x9c1b('0x26'));logger[_0x9c1b('0x27')](_0x9c1b('0x28'),_0x2564a7,_0x9c1b('0x26'),JSON[_0x9c1b('0x29')](_0xe976b9));if(_0xe976b9['error']){if(_0xe976b9['error']['code']===0x1f4){logger[_0x9c1b('0x2a')](_0x9c1b('0x25'),_0x2564a7,_0xe976b9[_0x9c1b('0x2a')][_0x9c1b('0x2b')]);return _0x202109(_0xe976b9['error'][_0x9c1b('0x2b')]);}logger[_0x9c1b('0x2a')](_0x9c1b('0x25'),_0x2564a7,_0xe976b9[_0x9c1b('0x2a')][_0x9c1b('0x2b')]);return _0x5c8d89(_0xe976b9['error'][_0x9c1b('0x2b')]);}else{logger[_0x9c1b('0x24')](_0x9c1b('0x25'),_0x2564a7,_0x9c1b('0x26'));_0x5c8d89(_0xe976b9[_0x9c1b('0x2c')][_0x9c1b('0x2b')]);}})[_0x9c1b('0x2d')](function(_0x4adb60){logger[_0x9c1b('0x2a')](_0x9c1b('0x25'),_0x2564a7,_0x4adb60);_0x202109(_0x4adb60);});});}function respondWithStatusCode(_0x3aa337,_0x3a8cf2){_0x3a8cf2=_0x3a8cf2||0xcc;return function(_0x158ccd){if(_0x158ccd){return _0x3aa337[_0x9c1b('0x2e')](_0x3a8cf2);}return _0x3aa337[_0x9c1b('0x2f')](_0x3a8cf2)[_0x9c1b('0x30')]();};}function respondWithResult(_0x30711a,_0x3cc409){_0x3cc409=_0x3cc409||0xc8;return function(_0x287358){if(_0x287358){return _0x30711a[_0x9c1b('0x2f')](_0x3cc409)['json'](_0x287358);}};}function respondWithFilteredResult(_0x401aa7,_0x3e01e2){return function(_0x48913a){if(_0x48913a){var _0x3bcbf4=_0x48913a[_0x9c1b('0x31')],_0x8d23f7=_0x3e01e2[_0x9c1b('0x32')],_0x173102=_0x3e01e2['offset']+_0x3e01e2['limit'],_0x22d4a3;if(_0x173102>=_0x3bcbf4){_0x173102=_0x3bcbf4;_0x22d4a3=0xc8;}else{_0x22d4a3=0xce;}_0x401aa7['status'](_0x22d4a3);return _0x401aa7[_0x9c1b('0x33')](_0x9c1b('0x34'),_0x8d23f7+'-'+_0x173102+'/'+_0x3bcbf4)[_0x9c1b('0x35')](_0x48913a);}return null;};}function patchUpdates(_0x18305d){return function(_0x3060c6){try{jsonpatch[_0x9c1b('0x36')](_0x3060c6,_0x18305d,!![]);}catch(_0x86bfb5){return BPromise[_0x9c1b('0x37')](_0x86bfb5);}return _0x3060c6[_0x9c1b('0x38')]();};}function saveUpdates(_0x5cd852,_0x4b75eb){return function(_0x43062e){if(_0x43062e){return _0x43062e[_0x9c1b('0x39')](_0x5cd852)['then'](function(_0x534fee){return _0x534fee;});}return null;};}function removeEntity(_0x2f2050,_0x120477){return function(_0x5cca92){if(_0x5cca92){return _0x5cca92[_0x9c1b('0x3a')]()[_0x9c1b('0x23')](function(){var _0x17001d=_0x5cca92['get']({'plain':!![]});var _0x5dc154='OpenchannelAccounts';return db['UserProfileResource'][_0x9c1b('0x3a')]({'where':{'type':_0x5dc154,'resourceId':_0x17001d['id']}})[_0x9c1b('0x23')](function(){return _0x5cca92;});})[_0x9c1b('0x23')](function(){_0x2f2050['status'](0xcc)[_0x9c1b('0x30')]();});}};}function handleEntityNotFound(_0x2bbeef,_0xe56bcc){return function(_0x21749c){if(!_0x21749c){_0x2bbeef[_0x9c1b('0x2e')](0x194);}return _0x21749c;};}function handleError(_0x3b0636,_0x5d0bd6){_0x5d0bd6=_0x5d0bd6||0x1f4;return function(_0x40baa2){logger[_0x9c1b('0x2a')](_0x40baa2[_0x9c1b('0x3b')]);if(_0x40baa2[_0x9c1b('0x3c')]){delete _0x40baa2['name'];}_0x3b0636[_0x9c1b('0x2f')](_0x5d0bd6)[_0x9c1b('0x3d')](_0x40baa2);};}exports[_0x9c1b('0x3e')]=function(_0x35e268,_0x2a983f){var _0x106bdc={'include':[{'model':db[_0x9c1b('0x3f')],'as':_0x9c1b('0x40')}]},_0x1cd508={},_0x19e0ec={'count':0x0,'rows':[]};var _0x16fc2a=_[_0x9c1b('0x41')](db[_0x9c1b('0x42')][_0x9c1b('0x43')],function(_0x582c04){return{'name':_0x582c04[_0x9c1b('0x44')],'type':_0x582c04[_0x9c1b('0x45')][_0x9c1b('0x46')]};});_0x1cd508[_0x9c1b('0x47')]=_[_0x9c1b('0x41')](_0x16fc2a,_0x9c1b('0x3c'));_0x1cd508['query']=_['keys'](_0x35e268[_0x9c1b('0x48')]);_0x1cd508[_0x9c1b('0x49')]=_[_0x9c1b('0x4a')](_0x1cd508[_0x9c1b('0x47')],_0x1cd508[_0x9c1b('0x48')]);_0x106bdc['attributes']=_[_0x9c1b('0x4a')](_0x1cd508[_0x9c1b('0x47')],qs[_0x9c1b('0x4b')](_0x35e268[_0x9c1b('0x48')][_0x9c1b('0x4b')]));_0x106bdc['attributes']=_0x106bdc[_0x9c1b('0x4c')][_0x9c1b('0x4d')]?_0x106bdc[_0x9c1b('0x4c')]:_0x1cd508[_0x9c1b('0x47')];if(!_0x35e268['query'][_0x9c1b('0x4e')](_0x9c1b('0x4f'))){_0x106bdc['limit']=qs[_0x9c1b('0x50')](_0x35e268[_0x9c1b('0x48')][_0x9c1b('0x50')]);_0x106bdc[_0x9c1b('0x32')]=qs['offset'](_0x35e268[_0x9c1b('0x48')][_0x9c1b('0x32')]);}_0x106bdc[_0x9c1b('0x51')]=qs['sort'](_0x35e268[_0x9c1b('0x48')][_0x9c1b('0x52')]);_0x106bdc[_0x9c1b('0x53')]=qs['filters'](_[_0x9c1b('0x54')](_0x35e268[_0x9c1b('0x48')],_0x1cd508[_0x9c1b('0x49')]));if(_0x35e268[_0x9c1b('0x48')]['filter']){_0x106bdc[_0x9c1b('0x53')]=_[_0x9c1b('0x55')](_0x106bdc[_0x9c1b('0x53')],{'$or':_[_0x9c1b('0x41')](_0x16fc2a,function(_0x5e749d){if(_0x5e749d[_0x9c1b('0x45')]!==_0x9c1b('0x56')){var _0x428732={};_0x428732[_0x5e749d['name']]={'$like':'%'+_0x35e268['query'][_0x9c1b('0x57')]+'%'};return _0x428732;}})});}_0x106bdc=_['merge']({},_0x106bdc,_0x35e268['options']);var _0x5e706a={'where':_0x106bdc[_0x9c1b('0x53')]};return db[_0x9c1b('0x42')][_0x9c1b('0x31')](_0x5e706a)[_0x9c1b('0x23')](function(_0xc48b99){_0x19e0ec[_0x9c1b('0x31')]=_0xc48b99;if(_0x35e268[_0x9c1b('0x48')][_0x9c1b('0x58')]){_0x106bdc['include']=[{'all':!![]}];}return db['OpenchannelAccount'][_0x9c1b('0x59')](_0x106bdc);})[_0x9c1b('0x23')](function(_0x3b9691){_0x19e0ec[_0x9c1b('0x5a')]=_0x3b9691;return _0x19e0ec;})['then'](respondWithFilteredResult(_0x2a983f,_0x106bdc))[_0x9c1b('0x2d')](handleError(_0x2a983f,null));};exports[_0x9c1b('0x5b')]=function(_0x2fd544,_0x294e69){var _0x4bcc89={'raw':![],'where':{'id':_0x2fd544[_0x9c1b('0x5c')]['id']},'include':[{'model':db[_0x9c1b('0x3f')],'as':_0x9c1b('0x40')}]},_0x21c9da={};_0x21c9da['model']=_[_0x9c1b('0x5d')](db['OpenchannelAccount'][_0x9c1b('0x43')]);_0x21c9da[_0x9c1b('0x48')]=_['keys'](_0x2fd544[_0x9c1b('0x48')]);_0x21c9da['filters']=_[_0x9c1b('0x4a')](_0x21c9da[_0x9c1b('0x47')],_0x21c9da['query']);_0x4bcc89[_0x9c1b('0x4c')]=_[_0x9c1b('0x4a')](_0x21c9da[_0x9c1b('0x47')],qs[_0x9c1b('0x4b')](_0x2fd544[_0x9c1b('0x48')]['fields']));_0x4bcc89[_0x9c1b('0x4c')]=_0x4bcc89[_0x9c1b('0x4c')][_0x9c1b('0x4d')]?_0x4bcc89[_0x9c1b('0x4c')]:_0x21c9da[_0x9c1b('0x47')];if(_0x2fd544[_0x9c1b('0x48')][_0x9c1b('0x58')]){_0x4bcc89[_0x9c1b('0x5e')]=[{'all':!![]}];}_0x4bcc89=_[_0x9c1b('0x55')]({},_0x4bcc89,_0x2fd544[_0x9c1b('0x5f')]);return db[_0x9c1b('0x42')][_0x9c1b('0x60')](_0x4bcc89)[_0x9c1b('0x23')](handleEntityNotFound(_0x294e69,null))['then'](respondWithResult(_0x294e69,null))[_0x9c1b('0x2d')](handleError(_0x294e69,null));};exports[_0x9c1b('0x61')]=function(_0x502bc8,_0x78f791){return db[_0x9c1b('0x42')][_0x9c1b('0x61')](_0x502bc8[_0x9c1b('0x62')],{})[_0x9c1b('0x23')](function(_0x5e28f1){var _0x29132f=_0x502bc8[_0x9c1b('0x63')][_0x9c1b('0x64')]({'plain':!![]});if(!_0x29132f)throw new Error(_0x9c1b('0x65'));if(_0x29132f[_0x9c1b('0x66')]===_0x9c1b('0x63')){var _0x46c16b=_0x5e28f1[_0x9c1b('0x64')]({'plain':!![]});var _0x48df7a=_0x9c1b('0x67');return db[_0x9c1b('0x68')][_0x9c1b('0x60')]({'where':{'name':_0x48df7a,'userProfileId':_0x29132f[_0x9c1b('0x69')]},'raw':!![]})[_0x9c1b('0x23')](function(_0x326d44){if(_0x326d44&&_0x326d44['autoAssociation']===0x0){return db['UserProfileResource'][_0x9c1b('0x61')]({'name':_0x46c16b['name'],'resourceId':_0x46c16b['id'],'type':_0x326d44[_0x9c1b('0x3c')],'sectionId':_0x326d44['id']},{})[_0x9c1b('0x23')](function(){return _0x5e28f1;});}else{return _0x5e28f1;}})[_0x9c1b('0x2d')](function(_0x1f87dd){logger[_0x9c1b('0x2a')](_0x9c1b('0x6a'),_0x1f87dd);throw _0x1f87dd;});}return _0x5e28f1;})[_0x9c1b('0x23')](respondWithResult(_0x78f791,0xc9))[_0x9c1b('0x2d')](handleError(_0x78f791,null));};exports[_0x9c1b('0x39')]=function(_0xf3e58,_0x5094d8){if(_0xf3e58[_0x9c1b('0x62')]['id']){delete _0xf3e58[_0x9c1b('0x62')]['id'];}return db[_0x9c1b('0x42')][_0x9c1b('0x60')]({'where':{'id':_0xf3e58[_0x9c1b('0x5c')]['id']},'include':[{'model':db[_0x9c1b('0x3f')],'as':_0x9c1b('0x40')}]})['then'](handleEntityNotFound(_0x5094d8,null))['then'](saveUpdates(_0xf3e58[_0x9c1b('0x62')],null))[_0x9c1b('0x23')](respondWithResult(_0x5094d8,null))[_0x9c1b('0x2d')](handleError(_0x5094d8,null));};exports[_0x9c1b('0x3a')]=function(_0x54ea6c,_0x9f971c){return db[_0x9c1b('0x42')][_0x9c1b('0x60')]({'where':{'id':_0x54ea6c['params']['id']}})[_0x9c1b('0x23')](handleEntityNotFound(_0x9f971c,null))[_0x9c1b('0x23')](removeEntity(_0x9f971c,null))[_0x9c1b('0x2d')](handleError(_0x9f971c,null));};exports[_0x9c1b('0x6b')]=function(_0x454ed2,_0x505956){return db[_0x9c1b('0x42')]['describe']()[_0x9c1b('0x23')](respondWithResult(_0x505956,null))['catch'](handleError(_0x505956,null));};exports[_0x9c1b('0x6c')]=function(_0xfe9fa3,_0x306513,_0x8f3074){if(_0xfe9fa3['body']['id']){delete _0xfe9fa3[_0x9c1b('0x62')]['id'];}return db[_0x9c1b('0x42')]['find']({'where':{'id':_0xfe9fa3[_0x9c1b('0x5c')]['id']}})[_0x9c1b('0x23')](handleEntityNotFound(_0x306513,null))[_0x9c1b('0x23')](function(_0x2f1949){if(_0x2f1949){_0xfe9fa3['body'][_0x9c1b('0x6d')]=_0x2f1949['id'];return db[_0x9c1b('0x6e')]['create'](_0xfe9fa3['body']);}})[_0x9c1b('0x23')](respondWithResult(_0x306513,null))[_0x9c1b('0x2d')](handleError(_0x306513,null));};exports['getDispositions']=function(_0x37613a,_0x5c0dcd,_0x19ec66){var _0x4521b3={'raw':![],'where':{}};var _0x2a07ad={};var _0x32a504={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x9c1b('0x6f')]({'where':{'id':_0x37613a['params']['id']}})['then'](handleEntityNotFound(_0x5c0dcd,null))[_0x9c1b('0x23')](function(_0xe5496b){if(_0xe5496b){_0x2a07ad[_0x9c1b('0x47')]=_[_0x9c1b('0x5d')](db['Disposition']['rawAttributes']);_0x2a07ad[_0x9c1b('0x48')]=_[_0x9c1b('0x5d')](_0x37613a[_0x9c1b('0x48')]);_0x2a07ad[_0x9c1b('0x49')]=_[_0x9c1b('0x4a')](_0x2a07ad['model'],_0x2a07ad[_0x9c1b('0x48')]);_0x4521b3[_0x9c1b('0x4c')]=_['intersection'](_0x2a07ad[_0x9c1b('0x47')],qs['fields'](_0x37613a[_0x9c1b('0x48')]['fields']));_0x4521b3[_0x9c1b('0x4c')]=_0x4521b3['attributes'][_0x9c1b('0x4d')]?_0x4521b3[_0x9c1b('0x4c')]:_0x2a07ad['model'];if(!_0x37613a['query']['hasOwnProperty'](_0x9c1b('0x4f'))){_0x4521b3[_0x9c1b('0x50')]=qs['limit'](_0x37613a[_0x9c1b('0x48')][_0x9c1b('0x50')]);_0x4521b3[_0x9c1b('0x32')]=qs[_0x9c1b('0x32')](_0x37613a['query'][_0x9c1b('0x32')]);}_0x4521b3[_0x9c1b('0x51')]=qs[_0x9c1b('0x52')](_0x37613a[_0x9c1b('0x48')][_0x9c1b('0x52')]);_0x4521b3[_0x9c1b('0x53')]=qs[_0x9c1b('0x49')](_[_0x9c1b('0x54')](_0x37613a['query'],_0x2a07ad[_0x9c1b('0x49')]));_0x4521b3[_0x9c1b('0x53')][_0x9c1b('0x70')]=_0xe5496b['id'];if(_0x37613a['query'][_0x9c1b('0x57')]){_0x4521b3['where']=_[_0x9c1b('0x55')](_0x4521b3[_0x9c1b('0x53')],{'$or':_['map'](_0x4521b3['attributes'],function(_0x652dc8){var _0xd98e80={};_0xd98e80[_0x652dc8]={'$like':'%'+_0x37613a['query'][_0x9c1b('0x57')]+'%'};return _0xd98e80;})});}_0x4521b3=_[_0x9c1b('0x55')]({},_0x4521b3,_0x37613a[_0x9c1b('0x5f')]);return db[_0x9c1b('0x6e')][_0x9c1b('0x31')]({'where':_0x4521b3[_0x9c1b('0x53')]})[_0x9c1b('0x23')](function(_0x276a12){_0x32a504['count']=_0x276a12;if(_0x37613a[_0x9c1b('0x48')][_0x9c1b('0x58')]){_0x4521b3[_0x9c1b('0x5e')]=[{'all':!![]}];}return db[_0x9c1b('0x6e')][_0x9c1b('0x59')](_0x4521b3);})['then'](function(_0x4ad7d9){_0x32a504[_0x9c1b('0x5a')]=_0x4ad7d9;return _0x32a504;});}})[_0x9c1b('0x23')](respondWithFilteredResult(_0x5c0dcd,_0x4521b3))['catch'](handleError(_0x5c0dcd,null));};exports['removeDispositions']=function(_0x4b79c9,_0x5b8edb,_0x4b0bc9){return db[_0x9c1b('0x42')][_0x9c1b('0x60')]({'where':{'id':_0x4b79c9['params']['id']}})['then'](handleEntityNotFound(_0x5b8edb,null))['then'](function(_0x398321){if(_0x398321){return _0x398321['removeDispositions'](_0x4b79c9[_0x9c1b('0x48')]['ids']);}})[_0x9c1b('0x23')](respondWithStatusCode(_0x5b8edb,null))['catch'](handleError(_0x5b8edb,null));};exports[_0x9c1b('0x71')]=function(_0x47b243,_0x388e06,_0x2cc8dd){if(_0x47b243['body']['id']){delete _0x47b243[_0x9c1b('0x62')]['id'];}return db[_0x9c1b('0x42')][_0x9c1b('0x60')]({'where':{'id':_0x47b243['params']['id']}})['then'](handleEntityNotFound(_0x388e06,null))[_0x9c1b('0x23')](function(_0x5f495e){if(_0x5f495e){_0x47b243['body'][_0x9c1b('0x70')]=_0x5f495e['id'];return db[_0x9c1b('0x72')][_0x9c1b('0x61')](_0x47b243['body']);}})[_0x9c1b('0x23')](respondWithResult(_0x388e06,null))[_0x9c1b('0x2d')](handleError(_0x388e06,null));};exports['getAnswers']=function(_0x1a279b,_0x46fe2d,_0x47151f){var _0x90ad4e={'raw':![],'where':{}};var _0x13a281={};var _0xcb1125={'count':0x0,'rows':[]};return db[_0x9c1b('0x42')][_0x9c1b('0x6f')]({'where':{'id':_0x1a279b[_0x9c1b('0x5c')]['id']}})[_0x9c1b('0x23')](handleEntityNotFound(_0x46fe2d,null))[_0x9c1b('0x23')](function(_0x58c89e){if(_0x58c89e){_0x13a281[_0x9c1b('0x47')]=_[_0x9c1b('0x5d')](db[_0x9c1b('0x72')][_0x9c1b('0x43')]);_0x13a281[_0x9c1b('0x48')]=_['keys'](_0x1a279b[_0x9c1b('0x48')]);_0x13a281[_0x9c1b('0x49')]=_[_0x9c1b('0x4a')](_0x13a281[_0x9c1b('0x47')],_0x13a281['query']);_0x90ad4e['attributes']=_[_0x9c1b('0x4a')](_0x13a281[_0x9c1b('0x47')],qs[_0x9c1b('0x4b')](_0x1a279b[_0x9c1b('0x48')][_0x9c1b('0x4b')]));_0x90ad4e[_0x9c1b('0x4c')]=_0x90ad4e[_0x9c1b('0x4c')][_0x9c1b('0x4d')]?_0x90ad4e['attributes']:_0x13a281[_0x9c1b('0x47')];if(!_0x1a279b['query']['hasOwnProperty'](_0x9c1b('0x4f'))){_0x90ad4e['limit']=qs[_0x9c1b('0x50')](_0x1a279b['query'][_0x9c1b('0x50')]);_0x90ad4e[_0x9c1b('0x32')]=qs[_0x9c1b('0x32')](_0x1a279b[_0x9c1b('0x48')][_0x9c1b('0x32')]);}_0x90ad4e[_0x9c1b('0x51')]=qs['sort'](_0x1a279b['query'][_0x9c1b('0x52')]);_0x90ad4e[_0x9c1b('0x53')]=qs[_0x9c1b('0x49')](_[_0x9c1b('0x54')](_0x1a279b[_0x9c1b('0x48')],_0x13a281[_0x9c1b('0x49')]));_0x90ad4e['where'][_0x9c1b('0x70')]=_0x58c89e['id'];if(_0x1a279b[_0x9c1b('0x48')][_0x9c1b('0x57')]){_0x90ad4e['where']=_['merge'](_0x90ad4e[_0x9c1b('0x53')],{'$or':_['map'](_0x90ad4e[_0x9c1b('0x4c')],function(_0x3bf746){var _0xbbcd04={};_0xbbcd04[_0x3bf746]={'$like':'%'+_0x1a279b[_0x9c1b('0x48')]['filter']+'%'};return _0xbbcd04;})});}_0x90ad4e=_['merge']({},_0x90ad4e,_0x1a279b[_0x9c1b('0x5f')]);return db['CannedAnswer'][_0x9c1b('0x31')]({'where':_0x90ad4e[_0x9c1b('0x53')]})[_0x9c1b('0x23')](function(_0x1242bf){_0xcb1125[_0x9c1b('0x31')]=_0x1242bf;if(_0x1a279b[_0x9c1b('0x48')][_0x9c1b('0x58')]){_0x90ad4e['include']=[{'all':!![]}];}return db[_0x9c1b('0x72')]['findAll'](_0x90ad4e);})[_0x9c1b('0x23')](function(_0xdc767f){_0xcb1125[_0x9c1b('0x5a')]=_0xdc767f;return _0xcb1125;});}})[_0x9c1b('0x23')](respondWithFilteredResult(_0x46fe2d,_0x90ad4e))[_0x9c1b('0x2d')](handleError(_0x46fe2d,null));};exports[_0x9c1b('0x73')]=function(_0x2199fb,_0x7535a5,_0x3e679f){return db[_0x9c1b('0x42')][_0x9c1b('0x60')]({'where':{'id':_0x2199fb[_0x9c1b('0x5c')]['id']}})[_0x9c1b('0x23')](handleEntityNotFound(_0x7535a5,null))[_0x9c1b('0x23')](function(_0x24628e){if(_0x24628e){return _0x24628e[_0x9c1b('0x73')](_0x2199fb[_0x9c1b('0x48')][_0x9c1b('0x74')]);}})[_0x9c1b('0x23')](respondWithStatusCode(_0x7535a5,null))[_0x9c1b('0x2d')](handleError(_0x7535a5,null));};exports['notify']=function(_0x431f5e,_0x26e608,_0x56f523){var _0x3345a6={'body':_0x431f5e[_0x9c1b('0x62')],'channel':_0x9c1b('0x75')};var _0x596c2f=[];var _0x2d4115=[];var _0x1ab892={};var _0xbfa049=![];return db['CmContact'][_0x9c1b('0x6b')]()[_0x9c1b('0x23')](function(_0x401a90){if(!_0x401a90){throw new db[(_0x9c1b('0x20'))][(_0x9c1b('0x76'))](_0x9c1b('0x77'));}_0x596c2f=_[_0x9c1b('0x78')](_['keys'](_0x401a90),[_0x9c1b('0x79'),_0x9c1b('0x7a')]);_0x2d4115=_[_0x9c1b('0x78')](_[_0x9c1b('0x5d')](_0x401a90),[_0x9c1b('0x79'),_0x9c1b('0x7a'),_0x9c1b('0x7b'),_0x9c1b('0x7c')]);if(_0x431f5e[_0x9c1b('0x62')]['id']){delete _0x431f5e[_0x9c1b('0x62')]['id'];}if(_[_0x9c1b('0x7d')](_0x431f5e['body'][_0x9c1b('0x7e')])){throw new db[(_0x9c1b('0x20'))][(_0x9c1b('0x76'))](_0x9c1b('0x7f'));}if(_[_0x9c1b('0x7d')](_0x431f5e[_0x9c1b('0x62')][_0x9c1b('0x62')])||_0x431f5e[_0x9c1b('0x62')]['body']===''){throw new db[(_0x9c1b('0x20'))][(_0x9c1b('0x76'))](_0x9c1b('0x80'));}if(_[_0x9c1b('0x7d')](_0x431f5e[_0x9c1b('0x62')][_0x9c1b('0x81')])){throw new db[(_0x9c1b('0x20'))][(_0x9c1b('0x76'))](_0x9c1b('0x82')+_0x2d4115);}if(!_[_0x9c1b('0x83')](_0x2d4115,_0x431f5e['body'][_0x9c1b('0x81')])){throw new db[(_0x9c1b('0x20'))]['ValidationError'](_0x9c1b('0x84')+_0x2d4115);}_0x1ab892[_0x431f5e[_0x9c1b('0x62')]['mapKey']]=_0x431f5e[_0x9c1b('0x62')][_0x9c1b('0x7e')];})[_0x9c1b('0x23')](function(){return db['OpenchannelAccount'][_0x9c1b('0x60')]({'where':{'id':_0x431f5e[_0x9c1b('0x5c')]['id']},'include':[{'model':db['CmList'],'as':_0x9c1b('0x85'),'include':[{'model':db[_0x9c1b('0x86')],'as':_0x9c1b('0x87'),'where':_0x1ab892,'limit':0x1,'order':[['updatedAt',_0x9c1b('0x88')]]}]},{'model':db[_0x9c1b('0x89')],'as':_0x9c1b('0x8a')}]});})[_0x9c1b('0x23')](handleEntityNotFound(_0x26e608,null))[_0x9c1b('0x23')](function(_0x3107be){if(_0x3107be&&_0x3107be['List']){_0x3345a6[_0x9c1b('0x8b')]=_0x3107be;_0x3345a6['applications']=_0x3107be[_0x9c1b('0x8a')];_0x3345a6['list']=_0x3107be[_0x9c1b('0x85')];_0x3345a6[_0x9c1b('0x8c')]=_[_0x9c1b('0x8d')](_0x3345a6[_0x9c1b('0x8c')],[_0x9c1b('0x8e')],[_0x9c1b('0x8f')]);if(_0x3345a6[_0x9c1b('0x8b')][_0x9c1b('0x8a')]){delete _0x3345a6['account'][_0x9c1b('0x8a')];}if(_0x3345a6[_0x9c1b('0x8b')][_0x9c1b('0x85')]&&_0x3345a6['account'][_0x9c1b('0x85')][_0x9c1b('0x87')]['length']){return _0x3345a6[_0x9c1b('0x8b')]['List'][_0x9c1b('0x87')][0x0];}var _0x1a133b=_['defaults'](_0x431f5e[_0x9c1b('0x62')],{'firstName':_0x431f5e[_0x9c1b('0x62')][_0x9c1b('0x7e')],'ListId':_0x3107be[_0x9c1b('0x7c')]});_0x1a133b[_0x431f5e[_0x9c1b('0x62')][_0x9c1b('0x81')]]=_0x431f5e['body'][_0x9c1b('0x7e')];return db['CmContact']['create'](_0x1a133b,{'fields':_0x596c2f,'raw':!![]});}})[_0x9c1b('0x23')](handleEntityNotFound(_0x26e608,null))[_0x9c1b('0x23')](function(_0x713701){_0x3345a6[_0x9c1b('0x90')]=_0x713701;if(_0x713701){var _0x2230a7={'ContactId':_0x713701['id'],'OpenchannelAccountId':_0x431f5e[_0x9c1b('0x5c')]['id'],'from':(_0x713701[_0x9c1b('0x91')]||'')+'\x20'+(_0x713701[_0x9c1b('0x92')]||'')};var _0x1f6e0c={'OpenchannelAccountId':_0x431f5e[_0x9c1b('0x5c')]['id'],'closed':![]};if(_0x431f5e['body'][_0x9c1b('0x93')]){_0x1f6e0c[_0x9c1b('0x93')]=_0x431f5e[_0x9c1b('0x62')][_0x9c1b('0x93')];return db[_0x9c1b('0x94')][_0x9c1b('0x60')]({'where':_0x1f6e0c})[_0x9c1b('0x23')](function(_0x127318){if(_0x127318){return[_0x127318,![]];}_0x2230a7[_0x9c1b('0x93')]=_0x431f5e[_0x9c1b('0x62')][_0x9c1b('0x93')];_0x2230a7['externalUrl']=_0x431f5e['body'][_0x9c1b('0x95')];return db[_0x9c1b('0x94')][_0x9c1b('0x61')](_0x2230a7)[_0x9c1b('0x23')](function(_0x25edfe){return[_0x25edfe,!![]];});});}else{_0x1f6e0c['threadId']=null;}_0x1f6e0c[_0x9c1b('0x96')]=_0x713701['id'];return db[_0x9c1b('0x94')][_0x9c1b('0x60')]({'where':_0x1f6e0c})[_0x9c1b('0x23')](function(_0x35a98b){if(_0x35a98b){return[_0x35a98b,![]];}return db[_0x9c1b('0x94')][_0x9c1b('0x61')](_0x2230a7)['then'](function(_0x1bd306){return[_0x1bd306,!![]];});});}})[_0x9c1b('0x97')](function(_0x5aa03f,_0x3eaee4){if(_0x5aa03f){_0xbfa049=_0x3eaee4;if(!_0x3eaee4){var _0x5e9873={'from':(_0x3345a6['contact'][_0x9c1b('0x91')]||'')+'\x20'+(_0x3345a6[_0x9c1b('0x90')][_0x9c1b('0x92')]||'')};if(_0x431f5e[_0x9c1b('0x62')][_0x9c1b('0x93')]&&_0x431f5e['body']['messageId']&&_0x431f5e[_0x9c1b('0x62')]['threadId']!=_0x431f5e['body']['messageId']){_0x5e9873[_0x9c1b('0x93')]=_0x431f5e[_0x9c1b('0x62')][_0x9c1b('0x98')];}return _0x5aa03f[_0x9c1b('0x39')](_0x5e9873);}else{return _0x5aa03f;}}})[_0x9c1b('0x23')](function(_0x34b3bb){_0x3345a6[_0x9c1b('0x99')]=_0x34b3bb['get']({'plain':!![]});_0x3345a6[_0x9c1b('0x99')][_0x9c1b('0x9a')]=_0xbfa049;if(_0x3345a6['interaction']['created']){if(_0x3345a6['account']['autoclose']){_0x3345a6[_0x9c1b('0x8c')][_0x9c1b('0x9b')]({'id':0x0,'priority':_0x3345a6['applications']['length']+0x1,'app':_0x9c1b('0x9c'),'appdata':_0x9c1b('0x9d'),'interval':_0x9c1b('0x9e')});}}return db[_0x9c1b('0x9f')][_0x9c1b('0x61')]({'body':_0x431f5e[_0x9c1b('0x62')][_0x9c1b('0x62')],'OpenchannelAccountId':_0x431f5e[_0x9c1b('0x5c')]['id'],'OpenchannelInteractionId':_0x34b3bb['id'],'direction':'in','ContactId':_0x3345a6[_0x9c1b('0x90')]['id'],'AttachmentId':_0x431f5e[_0x9c1b('0x62')][_0x9c1b('0xa0')]});})[_0x9c1b('0x23')](function(_0x2d49ee){_0x3345a6['message']=_0x2d49ee;if(_0x3345a6['interaction']['UserId']){return db[_0x9c1b('0xa1')][_0x9c1b('0x60')]({'attributes':['id',_0x9c1b('0x3c')],'where':{'id':_0x3345a6[_0x9c1b('0x99')][_0x9c1b('0xa2')]}})[_0x9c1b('0x23')](function(_0x52b20a){if(_0x52b20a){_0x3345a6['applications']['unshift']({'id':0x0,'priority':0x0,'app':_0x9c1b('0xa3'),'appdata':_0x52b20a[_0x9c1b('0x3c')]+','+(_0x3345a6[_0x9c1b('0x8b')][_0x9c1b('0xa4')]||0xa),'interval':_0x9c1b('0x9e')});_0x3345a6[_0x9c1b('0xa5')]=![];}return respondWithRpcPromise(_0x9c1b('0xa6'),_0x9c1b('0xa7'),_0x3345a6);});}return respondWithRpcPromise(_0x9c1b('0xa6'),'startRouting',_0x3345a6);})[_0x9c1b('0x23')](function(_0x3206c3){respondWithRpcPromise('EventManager','EventManager',{'event':_0x9c1b('0xa8'),'message':_0x3206c3},client9002);return _0x3206c3;})[_0x9c1b('0x23')](respondWithResult(_0x26e608,null))['catch'](handleError(_0x26e608,null));};exports['addApplications']=function(_0x3303da,_0x40444f,_0x33ebe8){return db[_0x9c1b('0x42')][_0x9c1b('0x6f')]({'where':{'id':_0x3303da[_0x9c1b('0x5c')]['id']}})[_0x9c1b('0x23')](handleEntityNotFound(_0x40444f,null))[_0x9c1b('0x23')](function(_0x26f774){if(_0x26f774){return db['sequelize']['transaction'](function(_0x500c67){return db['OpenchannelApplication'][_0x9c1b('0x3a')]({'where':{'OpenchannelAccountId':_0x3303da['params']['id']},'transaction':_0x500c67})[_0x9c1b('0x23')](function(_0x348147){var _0x2f82e9=_[_0x9c1b('0x41')](_0x3303da[_0x9c1b('0x62')],function(_0x104491){_0x104491[_0x9c1b('0x70')]=_0x3303da[_0x9c1b('0x5c')]['id'];return _0x104491;});return db[_0x9c1b('0x89')][_0x9c1b('0xa9')](_0x2f82e9,{'transaction':_0x500c67});});})[_0x9c1b('0x23')](function(){return db[_0x9c1b('0x89')][_0x9c1b('0xaa')]({'where':{'OpenchannelAccountId':_0x3303da['params']['id']},'order':'priority'});});}})[_0x9c1b('0x23')](respondWithResult(_0x40444f,null))[_0x9c1b('0x2d')](handleError(_0x40444f,null));};exports[_0x9c1b('0xab')]=function(_0x2a9a9c,_0x3fbc89,_0x279f8c){var _0x1f4d29={};var _0xfaab8f={};var _0x3c788e;var _0x50310b;return db[_0x9c1b('0x42')][_0x9c1b('0x6f')]({'where':{'id':_0x2a9a9c[_0x9c1b('0x5c')]['id']}})[_0x9c1b('0x23')](handleEntityNotFound(_0x3fbc89,null))[_0x9c1b('0x23')](function(_0x35d9e3){if(_0x35d9e3){_0x3c788e=_0x35d9e3;_0xfaab8f['model']=_['keys'](db[_0x9c1b('0x89')][_0x9c1b('0x43')]);_0xfaab8f[_0x9c1b('0x48')]=_[_0x9c1b('0x5d')](_0x2a9a9c[_0x9c1b('0x48')]);_0xfaab8f[_0x9c1b('0x49')]=_['intersection'](_0xfaab8f[_0x9c1b('0x47')],_0xfaab8f[_0x9c1b('0x48')]);_0x1f4d29[_0x9c1b('0x4c')]=_[_0x9c1b('0x4a')](_0xfaab8f['model'],qs[_0x9c1b('0x4b')](_0x2a9a9c[_0x9c1b('0x48')][_0x9c1b('0x4b')]));_0x1f4d29[_0x9c1b('0x4c')]=_0x1f4d29['attributes'][_0x9c1b('0x4d')]?_0x1f4d29['attributes']:_0xfaab8f[_0x9c1b('0x47')];_0x1f4d29[_0x9c1b('0x51')]=qs[_0x9c1b('0x52')](_0x2a9a9c['query'][_0x9c1b('0x52')]);_0x1f4d29[_0x9c1b('0x53')]=qs[_0x9c1b('0x49')](_[_0x9c1b('0x54')](_0x2a9a9c[_0x9c1b('0x48')],_0xfaab8f[_0x9c1b('0x49')]));if(_0x2a9a9c['query']['filter']){_0x1f4d29['where']=_[_0x9c1b('0x55')](_0x1f4d29['where'],{'$or':_[_0x9c1b('0x41')](_0x1f4d29[_0x9c1b('0x4c')],function(_0x22e666){var _0x4f4f9c={};_0x4f4f9c[_0x22e666]={'$like':'%'+_0x2a9a9c['query'][_0x9c1b('0x57')]+'%'};return _0x4f4f9c;})});}_0x1f4d29=_[_0x9c1b('0x55')]({},_0x1f4d29,_0x2a9a9c[_0x9c1b('0x5f')]);return _0x3c788e[_0x9c1b('0xab')](_0x1f4d29);}})[_0x9c1b('0x23')](function(_0x22beb4){if(_0x22beb4){_0x50310b=_0x22beb4[_0x9c1b('0x4d')];if(!_0x2a9a9c[_0x9c1b('0x48')][_0x9c1b('0x4e')](_0x9c1b('0x4f'))){_0x1f4d29[_0x9c1b('0x50')]=qs[_0x9c1b('0x50')](_0x2a9a9c['query']['limit']);_0x1f4d29[_0x9c1b('0x32')]=qs[_0x9c1b('0x32')](_0x2a9a9c[_0x9c1b('0x48')][_0x9c1b('0x32')]);}return _0x3c788e[_0x9c1b('0xab')](_0x1f4d29);}})[_0x9c1b('0x23')](function(_0x5bc039){if(_0x5bc039){return _0x5bc039?{'count':_0x50310b,'rows':_0x5bc039}:null;}})[_0x9c1b('0x23')](respondWithResult(_0x3fbc89,null))['catch'](handleError(_0x3fbc89,null));};exports[_0x9c1b('0xac')]=function(_0x53974d,_0xeb6b31,_0x48003f){var _0x49ca7a={'raw':![],'where':{}};var _0x3c65b5={};var _0x54cc1b={'count':0x0,'rows':[]};return db[_0x9c1b('0x42')][_0x9c1b('0x6f')]({'where':{'id':_0x53974d[_0x9c1b('0x5c')]['id']}})[_0x9c1b('0x23')](handleEntityNotFound(_0xeb6b31,null))[_0x9c1b('0x23')](function(_0x4c555f){if(_0x4c555f){_0x3c65b5[_0x9c1b('0x47')]=_[_0x9c1b('0x5d')](db[_0x9c1b('0x94')][_0x9c1b('0x43')]);_0x3c65b5['query']=_['keys'](_0x53974d['query']);_0x3c65b5[_0x9c1b('0x49')]=_[_0x9c1b('0x4a')](_0x3c65b5[_0x9c1b('0x47')],_0x3c65b5[_0x9c1b('0x48')]);_0x49ca7a['attributes']=_[_0x9c1b('0x4a')](_0x3c65b5[_0x9c1b('0x47')],qs['fields'](_0x53974d[_0x9c1b('0x48')][_0x9c1b('0x4b')]));_0x49ca7a[_0x9c1b('0x4c')]=_0x49ca7a[_0x9c1b('0x4c')][_0x9c1b('0x4d')]?_0x49ca7a[_0x9c1b('0x4c')]:_0x3c65b5['model'];if(!_0x53974d[_0x9c1b('0x48')][_0x9c1b('0x4e')](_0x9c1b('0x4f'))){_0x49ca7a[_0x9c1b('0x50')]=qs[_0x9c1b('0x50')](_0x53974d[_0x9c1b('0x48')][_0x9c1b('0x50')]);_0x49ca7a[_0x9c1b('0x32')]=qs[_0x9c1b('0x32')](_0x53974d[_0x9c1b('0x48')][_0x9c1b('0x32')]);}_0x49ca7a[_0x9c1b('0x51')]=qs[_0x9c1b('0x52')](_0x53974d[_0x9c1b('0x48')]['sort']);_0x49ca7a['where']=qs[_0x9c1b('0x49')](_['pick'](_0x53974d[_0x9c1b('0x48')],_0x3c65b5['filters']));_0x49ca7a[_0x9c1b('0x53')][_0x9c1b('0x70')]=_0x4c555f['id'];if(_0x53974d[_0x9c1b('0x48')][_0x9c1b('0x57')]){_0x49ca7a[_0x9c1b('0x53')]=_['merge'](_0x49ca7a['where'],{'$or':_[_0x9c1b('0x41')](_0x49ca7a[_0x9c1b('0x4c')],function(_0x33a51f){var _0x4c1467={};_0x4c1467[_0x33a51f]={'$like':'%'+_0x53974d[_0x9c1b('0x48')][_0x9c1b('0x57')]+'%'};return _0x4c1467;})});}_0x49ca7a=_[_0x9c1b('0x55')]({},_0x49ca7a,_0x53974d[_0x9c1b('0x5f')]);return db[_0x9c1b('0x94')][_0x9c1b('0x31')]({'where':_0x49ca7a[_0x9c1b('0x53')]})[_0x9c1b('0x23')](function(_0xbdfc28){_0x54cc1b[_0x9c1b('0x31')]=_0xbdfc28;if(_0x53974d['query']['includeAll']){_0x49ca7a[_0x9c1b('0x5e')]=[{'model':db['CmContact'],'as':_0x9c1b('0xad'),'required':![]},{'model':db[_0x9c1b('0xa1')],'as':_0x9c1b('0xae'),'attributes':[_0x9c1b('0x3c'),'fullname','internal'],'required':![]},{'model':db[_0x9c1b('0xaf')],'as':_0x9c1b('0xb0'),'attributes':['id',_0x9c1b('0x3c'),_0x9c1b('0xb1')],'where':_0x53974d[_0x9c1b('0x48')][_0x9c1b('0xb2')]?{'id':_0x53974d[_0x9c1b('0x48')][_0x9c1b('0xb2')]}:undefined,'required':_0x53974d[_0x9c1b('0x48')][_0x9c1b('0xb2')]?!![]:![]}];}return db['OpenchannelInteraction']['findAll'](_0x49ca7a);})[_0x9c1b('0x23')](function(_0x15f3f1){_0x54cc1b[_0x9c1b('0x5a')]=_0x15f3f1;return _0x54cc1b;});}})[_0x9c1b('0x23')](respondWithFilteredResult(_0xeb6b31,_0x49ca7a))[_0x9c1b('0x2d')](handleError(_0xeb6b31,null));};exports['addAgents']=function(_0xc61ffc,_0x5bb200,_0x28aab5){return db[_0x9c1b('0x42')][_0x9c1b('0x60')]({'where':{'id':_0xc61ffc[_0x9c1b('0x5c')]['id']}})[_0x9c1b('0x23')](handleEntityNotFound(_0x5bb200,null))[_0x9c1b('0x23')](function(_0x382bc5){if(_0x382bc5){return _0x382bc5['addAgents'](_0xc61ffc[_0x9c1b('0x62')][_0x9c1b('0x74')],_['omit'](_0xc61ffc[_0x9c1b('0x62')],[_0x9c1b('0x74'),'id'])||{})[_0x9c1b('0x97')](function(_0x5dee65){for(var _0xc2d093=0x0;_0xc2d093<_0xc61ffc['body'][_0x9c1b('0x74')][_0x9c1b('0x4d')];_0xc2d093+=0x1){socket[_0x9c1b('0xb3')](_0x9c1b('0xb4'),{'UserId':_0xc61ffc['body'][_0x9c1b('0x74')][_0xc2d093],'OpenchannelAccountId':_0xc61ffc[_0x9c1b('0x5c')]['id']});}return _0x5dee65;});}})[_0x9c1b('0x23')](respondWithResult(_0x5bb200,null))[_0x9c1b('0x2d')](handleError(_0x5bb200,null));};exports['removeAgents']=function(_0x52eafe,_0x1bfe23,_0x20e90f){return db[_0x9c1b('0x42')][_0x9c1b('0x60')]({'where':{'id':_0x52eafe[_0x9c1b('0x5c')]['id']}})[_0x9c1b('0x23')](handleEntityNotFound(_0x1bfe23,null))[_0x9c1b('0x23')](function(_0x2cd51a){if(_0x2cd51a){return _0x2cd51a[_0x9c1b('0xb5')](_0x52eafe['query'][_0x9c1b('0x74')])[_0x9c1b('0x23')](function(){if(_[_0x9c1b('0xb6')](_0x52eafe['query'][_0x9c1b('0x74')])){for(var _0x237ff4=0x0;_0x237ff4<_0x52eafe[_0x9c1b('0x48')]['ids'][_0x9c1b('0x4d')];_0x237ff4+=0x1){socket['emit']('userOpenchannelAccount:remove',{'UserId':Number(_0x52eafe[_0x9c1b('0x48')]['ids'][_0x237ff4]),'OpenchannelAccountId':Number(_0x52eafe[_0x9c1b('0x5c')]['id'])});}}else{socket[_0x9c1b('0xb3')](_0x9c1b('0xb7'),{'UserId':Number(_0x52eafe['query'][_0x9c1b('0x74')]),'OpenchannelAccountId':Number(_0x52eafe['params']['id'])});}});}})[_0x9c1b('0x23')](respondWithStatusCode(_0x1bfe23,null))[_0x9c1b('0x2d')](handleError(_0x1bfe23,null));};exports['getAgents']=function(_0x2ba8e0,_0x4e1278,_0x503b9e){var _0x52ef75={};var _0x3d35f3={};var _0x1d69ba;var _0x3bd638;return db[_0x9c1b('0x42')]['findOne']({'where':{'id':_0x2ba8e0[_0x9c1b('0x5c')]['id']}})[_0x9c1b('0x23')](handleEntityNotFound(_0x4e1278,null))[_0x9c1b('0x23')](function(_0x54ebb2){if(_0x54ebb2){_0x1d69ba=_0x54ebb2;_0x3d35f3[_0x9c1b('0x47')]=_['keys'](db['User'][_0x9c1b('0x43')]);_0x3d35f3[_0x9c1b('0x48')]=_['keys'](_0x2ba8e0[_0x9c1b('0x48')]);_0x3d35f3[_0x9c1b('0x49')]=_['intersection'](_0x3d35f3[_0x9c1b('0x47')],_0x3d35f3[_0x9c1b('0x48')]);_0x52ef75[_0x9c1b('0x4c')]=_[_0x9c1b('0x4a')](_0x3d35f3['model'],qs[_0x9c1b('0x4b')](_0x2ba8e0[_0x9c1b('0x48')][_0x9c1b('0x4b')]));_0x52ef75[_0x9c1b('0x4c')]=_0x52ef75[_0x9c1b('0x4c')][_0x9c1b('0x4d')]?_0x52ef75['attributes']:_0x3d35f3[_0x9c1b('0x47')];_0x52ef75['order']=qs[_0x9c1b('0x52')](_0x2ba8e0[_0x9c1b('0x48')][_0x9c1b('0x52')]);_0x52ef75[_0x9c1b('0x53')]=qs[_0x9c1b('0x49')](_[_0x9c1b('0x54')](_0x2ba8e0[_0x9c1b('0x48')],_0x3d35f3[_0x9c1b('0x49')]));if(_0x2ba8e0['query'][_0x9c1b('0x57')]){_0x52ef75['where']=_[_0x9c1b('0x55')](_0x52ef75[_0x9c1b('0x53')],{'$or':_[_0x9c1b('0x41')](_0x52ef75[_0x9c1b('0x4c')],function(_0x33925c){var _0x4d6058={};_0x4d6058[_0x33925c]={'$like':'%'+_0x2ba8e0[_0x9c1b('0x48')]['filter']+'%'};return _0x4d6058;})});}_0x52ef75=_['merge']({},_0x52ef75,_0x2ba8e0[_0x9c1b('0x5f')]);return _0x1d69ba[_0x9c1b('0xb8')](_0x52ef75);}})[_0x9c1b('0x23')](function(_0x262049){if(_0x262049){_0x3bd638=_0x262049[_0x9c1b('0x4d')];if(!_0x2ba8e0['query'][_0x9c1b('0x4e')](_0x9c1b('0x4f'))){_0x52ef75[_0x9c1b('0x50')]=qs['limit'](_0x2ba8e0['query'][_0x9c1b('0x50')]);_0x52ef75[_0x9c1b('0x32')]=qs[_0x9c1b('0x32')](_0x2ba8e0[_0x9c1b('0x48')]['offset']);}return _0x1d69ba[_0x9c1b('0xb8')](_0x52ef75);}})['then'](function(_0xd63f6d){if(_0xd63f6d){return _0xd63f6d?{'count':_0x3bd638,'rows':_0xd63f6d}:null;}})[_0x9c1b('0x23')](respondWithResult(_0x4e1278,null))[_0x9c1b('0x2d')](handleError(_0x4e1278,null));};exports['send']=function(_0x2d9e7b,_0x5b6afe,_0x1b0c10){var _0x23e056,_0x2608f8,_0x66871a;if(_['isNil'](_0x2d9e7b['body'][_0x9c1b('0x62')])||_0x2d9e7b[_0x9c1b('0x62')][_0x9c1b('0x62')]===''){throw new db['Sequelize']['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x2d9e7b[_0x9c1b('0x62')]['to'])){}_0x23e056=_0x2d9e7b[_0x9c1b('0x62')]['to'];return db['OpenchannelAccount']['findOne']({'where':{'id':_0x2d9e7b['params']['id']}})['then'](handleEntityNotFound(_0x5b6afe,null))['then'](function(_0x292ae3){if(_0x292ae3){return db[_0x9c1b('0x42')][_0x9c1b('0x60')]({'where':{'id':_0x292ae3['id']},'include':[{'model':db[_0x9c1b('0xb9')],'as':_0x9c1b('0x85'),'include':[{'model':db[_0x9c1b('0x86')],'as':_0x9c1b('0x87'),'where':{[_0x292ae3[_0x9c1b('0x81')]]:_0x23e056},'limit':0x1,'order':[['updatedAt',_0x9c1b('0x88')]]}]}]})[_0x9c1b('0x23')](handleEntityNotFound(_0x5b6afe,null))[_0x9c1b('0x23')](function(_0x4238e1){if(_0x4238e1&&_0x4238e1[_0x9c1b('0x85')]){_0x2608f8=_0x4238e1['get']({'plain':!![]});if(_0x2608f8[_0x9c1b('0x85')]&&_0x2608f8[_0x9c1b('0x85')]['Contacts'][_0x9c1b('0x4d')]){return _0x2608f8[_0x9c1b('0x85')][_0x9c1b('0x87')][0x0];}return db[_0x9c1b('0x86')][_0x9c1b('0x61')](_[_0x9c1b('0x17')](_0x2d9e7b[_0x9c1b('0x62')],{'firstName':_0x23e056,[_0x4238e1[_0x9c1b('0x81')]]:_0x23e056,'phone':_0x23e056,'ListId':_0x2608f8['ListId']}));}})[_0x9c1b('0x23')](handleEntityNotFound(_0x5b6afe,null))[_0x9c1b('0x23')](function(_0x3c1201){if(_0x3c1201){_0x66871a=_0x3c1201;return db[_0x9c1b('0x94')]['find']({'where':{'ContactId':_0x66871a['id'],'closed':![],'OpenchannelAccountId':_0x2608f8['id']}})[_0x9c1b('0x23')](function(_0x2f5716){if(_0x2f5716){return[_0x2f5716,![]];}return db['OpenchannelInteraction'][_0x9c1b('0x61')]({'UserId':_0x2d9e7b[_0x9c1b('0x63')]['id'],'ContactId':_0x66871a['id'],'OpenchannelAccountId':_0x2608f8['id'],'lastMsgDirection':_0x9c1b('0xba'),'Messages':[_[_0x9c1b('0x55')](_0x2d9e7b[_0x9c1b('0x62')],{'read':![],'body':_0x2d9e7b[_0x9c1b('0x62')][_0x9c1b('0x62')],'OpenchannelAccountId':_0x2608f8['id'],'UserId':_0x2d9e7b['user']['id'],'ContactId':_0x66871a['id']})]},{'include':[{'model':db[_0x9c1b('0x9f')],'as':_0x9c1b('0xbb')}]})['then'](function(_0x4c3dc5){return[_0x4c3dc5,!![]];});});}})['spread'](function(_0x4df146,_0x59e6fe){if(_0x59e6fe){return _0x4df146;}return db[_0x9c1b('0x9f')][_0x9c1b('0x61')](_[_0x9c1b('0x55')](_0x2d9e7b['body'],{'read':![],'body':_0x2d9e7b[_0x9c1b('0x62')][_0x9c1b('0x62')],'OpenchannelAccountId':_0x2608f8['id'],'OpenchannelInteractionId':_0x4df146['id'],'UserId':_0x2d9e7b[_0x9c1b('0x63')]['id'],'ContactId':_0x66871a['id']}))['then'](function(_0xeb063b){_0x4df146['dataValues'][_0x9c1b('0xbb')]=[];_0x4df146['dataValues'][_0x9c1b('0xbb')][_0x9c1b('0x9b')](_0xeb063b[_0x9c1b('0xbc')]);return _0x4df146;});});}})[_0x9c1b('0x23')](respondWithResult(_0x5b6afe,null))[_0x9c1b('0x2d')](handleError(_0x5b6afe,null));}; \ No newline at end of file +var _0x835c=['from','List','Contacts','DESC','OpenchannelApplication','Applications','account','list','applications','orderBy','priority','asc','contact','threadId','OpenchannelInteraction','externalUrl','lastName','messageId','interaction','created','push','close','OpenchannelMessage','AttachmentId','UserId','User','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','EventManager','addApplications','sequelize','transaction','bulkCreate','findAndCountAll','getApplications','Contact','fullname','internal','Tag','Tags','color','addAgents','omit','spread','userOpenchannelAccount:save','removeAgents','isArray','emit','userOpenchannelAccount:remove','getAgents','out','Messages','dataValues','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','lodash','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','defaults','redis','localhost','socket.io-emitter','register','jayson/promise','client','http','ValidationError','request','then','info','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','OpenchannelAccount,\x20%s,\x20%s','message','result','catch','end','status','count','offset','limit','set','json','reject','update','destroy','get','sendStatus','stack','name','send','index','Pause','map','OpenchannelAccount','rawAttributes','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filters','filter','merge','where','VIRTUAL','options','includeAll','include','findAll','rows','params','mandatoryDispositionPause','keys','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','OpenchannelAccounts','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','OpnechannelAccountId','Disposition','getDispositions','findOne','pick','OpenchannelAccountId','removeDispositions','ids','getAnswers','CannedAnswer','order','removeAnswers','notify','CmContact','Sequelize','difference','updatedAt','createdAt','CompanyId','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'];(function(_0x3bbd32,_0xed71c5){var _0xffad7d=function(_0x597aae){while(--_0x597aae){_0x3bbd32['push'](_0x3bbd32['shift']());}};_0xffad7d(++_0xed71c5);}(_0x835c,0xeb));var _0xc835=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x835c[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0xc835('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xc835('0x1'));var zipdir=require(_0xc835('0x2'));var jsonpatch=require(_0xc835('0x3'));var rp=require(_0xc835('0x4'));var moment=require(_0xc835('0x5'));var BPromise=require(_0xc835('0x6'));var Mustache=require(_0xc835('0x7'));var util=require(_0xc835('0x8'));var path=require('path');var sox=require(_0xc835('0x9'));var csv=require(_0xc835('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xc835('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xc835('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xc835('0xa'));var querystring=require('querystring');var Papa=require(_0xc835('0xd'));var Redis=require(_0xc835('0xe'));var authService=require(_0xc835('0xf'));var qs=require(_0xc835('0x10'));var as=require(_0xc835('0x11'));var hardwareService=require(_0xc835('0x12'));var logger=require('../../config/logger')(_0xc835('0x13'));var utils=require(_0xc835('0x14'));var config=require(_0xc835('0x15'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xc835('0x16')](config[_0xc835('0x17')],{'host':_0xc835('0x18'),'port':0x18eb});var socket=require(_0xc835('0x19'))(new Redis(config[_0xc835('0x17')]));require('./openchannelAccount.socket')[_0xc835('0x1a')](socket);var jayson=require(_0xc835('0x1b'));var client=jayson[_0xc835('0x1c')][_0xc835('0x1d')]({'port':0x232c});var client9002=jayson[_0xc835('0x1c')][_0xc835('0x1d')]({'port':0x232a});function checkPasswordPattern(_0xf878fe,_0x5612d8,_0x17be2e){if(_0x17be2e){var _0x5e8b55=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5e8b55['test'](_0x5612d8)){return _0xf878fe;}else{throw new db['Sequelize'][(_0xc835('0x1e'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0xf878fe;}}function respondWithRpcPromise(_0x4670e2,_0x20b260,_0x288a25,_0x21229c){return new BPromise(function(_0x4cb0b6,_0x27185a){var _0x5b578b=_0x21229c||client;return _0x5b578b[_0xc835('0x1f')](_0x4670e2,_0x288a25)[_0xc835('0x20')](function(_0x1668db){logger[_0xc835('0x21')]('OpenchannelAccount,\x20%s,\x20%s',_0x20b260,'request\x20sent');logger[_0xc835('0x22')](_0xc835('0x23'),_0x20b260,_0xc835('0x24'),JSON[_0xc835('0x25')](_0x1668db));if(_0x1668db[_0xc835('0x26')]){if(_0x1668db['error'][_0xc835('0x27')]===0x1f4){logger[_0xc835('0x26')](_0xc835('0x28'),_0x20b260,_0x1668db[_0xc835('0x26')][_0xc835('0x29')]);return _0x27185a(_0x1668db['error']['message']);}logger[_0xc835('0x26')](_0xc835('0x28'),_0x20b260,_0x1668db[_0xc835('0x26')][_0xc835('0x29')]);return _0x4cb0b6(_0x1668db[_0xc835('0x26')][_0xc835('0x29')]);}else{logger['info'](_0xc835('0x28'),_0x20b260,_0xc835('0x24'));_0x4cb0b6(_0x1668db[_0xc835('0x2a')][_0xc835('0x29')]);}})[_0xc835('0x2b')](function(_0x1fadb7){logger[_0xc835('0x26')](_0xc835('0x28'),_0x20b260,_0x1fadb7);_0x27185a(_0x1fadb7);});});}function respondWithStatusCode(_0x1c1cad,_0x3c042d){_0x3c042d=_0x3c042d||0xcc;return function(_0x4b1fde){if(_0x4b1fde){return _0x1c1cad['sendStatus'](_0x3c042d);}return _0x1c1cad['status'](_0x3c042d)[_0xc835('0x2c')]();};}function respondWithResult(_0x4a266f,_0x26837e){_0x26837e=_0x26837e||0xc8;return function(_0x358128){if(_0x358128){return _0x4a266f[_0xc835('0x2d')](_0x26837e)['json'](_0x358128);}};}function respondWithFilteredResult(_0xb14ee0,_0x27692f){return function(_0x18ed8e){if(_0x18ed8e){var _0x2ca4e3=_0x18ed8e[_0xc835('0x2e')],_0x86928f=_0x27692f[_0xc835('0x2f')],_0x5535e8=_0x27692f[_0xc835('0x2f')]+_0x27692f[_0xc835('0x30')],_0xf3ac67;if(_0x5535e8>=_0x2ca4e3){_0x5535e8=_0x2ca4e3;_0xf3ac67=0xc8;}else{_0xf3ac67=0xce;}_0xb14ee0[_0xc835('0x2d')](_0xf3ac67);return _0xb14ee0[_0xc835('0x31')]('Content-Range',_0x86928f+'-'+_0x5535e8+'/'+_0x2ca4e3)[_0xc835('0x32')](_0x18ed8e);}return null;};}function patchUpdates(_0x2078cf){return function(_0x23ae6d){try{jsonpatch['apply'](_0x23ae6d,_0x2078cf,!![]);}catch(_0x59cebd){return BPromise[_0xc835('0x33')](_0x59cebd);}return _0x23ae6d['save']();};}function saveUpdates(_0x3ac7ed,_0x1d6641){return function(_0x5c6603){if(_0x5c6603){return _0x5c6603[_0xc835('0x34')](_0x3ac7ed)['then'](function(_0x5c5607){return _0x5c5607;});}return null;};}function removeEntity(_0x1ec00e,_0x17fe42){return function(_0x4f8b87){if(_0x4f8b87){return _0x4f8b87[_0xc835('0x35')]()[_0xc835('0x20')](function(){var _0x50047d=_0x4f8b87[_0xc835('0x36')]({'plain':!![]});var _0xd2cebb='OpenchannelAccounts';return db['UserProfileResource'][_0xc835('0x35')]({'where':{'type':_0xd2cebb,'resourceId':_0x50047d['id']}})['then'](function(){return _0x4f8b87;});})[_0xc835('0x20')](function(){_0x1ec00e[_0xc835('0x2d')](0xcc)[_0xc835('0x2c')]();});}};}function handleEntityNotFound(_0x3b3936,_0x4ca259){return function(_0x28a9a5){if(!_0x28a9a5){_0x3b3936[_0xc835('0x37')](0x194);}return _0x28a9a5;};}function handleError(_0x3d2d28,_0x2dcaf4){_0x2dcaf4=_0x2dcaf4||0x1f4;return function(_0x1bf98b){logger[_0xc835('0x26')](_0x1bf98b[_0xc835('0x38')]);if(_0x1bf98b[_0xc835('0x39')]){delete _0x1bf98b[_0xc835('0x39')];}_0x3d2d28[_0xc835('0x2d')](_0x2dcaf4)[_0xc835('0x3a')](_0x1bf98b);};}exports[_0xc835('0x3b')]=function(_0x324ca4,_0x523c34){var _0x3430d6={'include':[{'model':db[_0xc835('0x3c')],'as':'mandatoryDispositionPause'}]},_0x94ec0={},_0x18678c={'count':0x0,'rows':[]};var _0x1e1d27=_[_0xc835('0x3d')](db[_0xc835('0x3e')][_0xc835('0x3f')],function(_0x227a11){return{'name':_0x227a11['fieldName'],'type':_0x227a11[_0xc835('0x40')][_0xc835('0x41')]};});_0x94ec0[_0xc835('0x42')]=_[_0xc835('0x3d')](_0x1e1d27,_0xc835('0x39'));_0x94ec0[_0xc835('0x43')]=_['keys'](_0x324ca4[_0xc835('0x43')]);_0x94ec0['filters']=_[_0xc835('0x44')](_0x94ec0[_0xc835('0x42')],_0x94ec0[_0xc835('0x43')]);_0x3430d6[_0xc835('0x45')]=_[_0xc835('0x44')](_0x94ec0[_0xc835('0x42')],qs[_0xc835('0x46')](_0x324ca4[_0xc835('0x43')][_0xc835('0x46')]));_0x3430d6[_0xc835('0x45')]=_0x3430d6[_0xc835('0x45')][_0xc835('0x47')]?_0x3430d6[_0xc835('0x45')]:_0x94ec0[_0xc835('0x42')];if(!_0x324ca4[_0xc835('0x43')][_0xc835('0x48')](_0xc835('0x49'))){_0x3430d6[_0xc835('0x30')]=qs[_0xc835('0x30')](_0x324ca4[_0xc835('0x43')][_0xc835('0x30')]);_0x3430d6['offset']=qs[_0xc835('0x2f')](_0x324ca4[_0xc835('0x43')]['offset']);}_0x3430d6['order']=qs[_0xc835('0x4a')](_0x324ca4[_0xc835('0x43')][_0xc835('0x4a')]);_0x3430d6['where']=qs['filters'](_['pick'](_0x324ca4[_0xc835('0x43')],_0x94ec0[_0xc835('0x4b')]));if(_0x324ca4['query'][_0xc835('0x4c')]){_0x3430d6['where']=_[_0xc835('0x4d')](_0x3430d6[_0xc835('0x4e')],{'$or':_['map'](_0x1e1d27,function(_0x278f1e){if(_0x278f1e[_0xc835('0x40')]!==_0xc835('0x4f')){var _0x5e2dc7={};_0x5e2dc7[_0x278f1e[_0xc835('0x39')]]={'$like':'%'+_0x324ca4['query'][_0xc835('0x4c')]+'%'};return _0x5e2dc7;}})});}_0x3430d6=_['merge']({},_0x3430d6,_0x324ca4[_0xc835('0x50')]);var _0x28c480={'where':_0x3430d6[_0xc835('0x4e')]};return db[_0xc835('0x3e')][_0xc835('0x2e')](_0x28c480)[_0xc835('0x20')](function(_0x461be3){_0x18678c[_0xc835('0x2e')]=_0x461be3;if(_0x324ca4['query'][_0xc835('0x51')]){_0x3430d6[_0xc835('0x52')]=[{'all':!![]}];}return db[_0xc835('0x3e')][_0xc835('0x53')](_0x3430d6);})['then'](function(_0x46ec2e){_0x18678c[_0xc835('0x54')]=_0x46ec2e;return _0x18678c;})[_0xc835('0x20')](respondWithFilteredResult(_0x523c34,_0x3430d6))[_0xc835('0x2b')](handleError(_0x523c34,null));};exports['show']=function(_0xc7e538,_0x235ad0){var _0x4f404f={'raw':![],'where':{'id':_0xc7e538[_0xc835('0x55')]['id']},'include':[{'model':db[_0xc835('0x3c')],'as':_0xc835('0x56')}]},_0x5de6fc={};_0x5de6fc[_0xc835('0x42')]=_[_0xc835('0x57')](db['OpenchannelAccount'][_0xc835('0x3f')]);_0x5de6fc[_0xc835('0x43')]=_['keys'](_0xc7e538['query']);_0x5de6fc[_0xc835('0x4b')]=_[_0xc835('0x44')](_0x5de6fc[_0xc835('0x42')],_0x5de6fc['query']);_0x4f404f[_0xc835('0x45')]=_[_0xc835('0x44')](_0x5de6fc[_0xc835('0x42')],qs[_0xc835('0x46')](_0xc7e538[_0xc835('0x43')][_0xc835('0x46')]));_0x4f404f[_0xc835('0x45')]=_0x4f404f['attributes'][_0xc835('0x47')]?_0x4f404f['attributes']:_0x5de6fc[_0xc835('0x42')];if(_0xc7e538[_0xc835('0x43')][_0xc835('0x51')]){_0x4f404f[_0xc835('0x52')]=[{'all':!![]}];}_0x4f404f=_[_0xc835('0x4d')]({},_0x4f404f,_0xc7e538[_0xc835('0x50')]);return db[_0xc835('0x3e')]['find'](_0x4f404f)[_0xc835('0x20')](handleEntityNotFound(_0x235ad0,null))[_0xc835('0x20')](respondWithResult(_0x235ad0,null))[_0xc835('0x2b')](handleError(_0x235ad0,null));};exports[_0xc835('0x58')]=function(_0x26a79f,_0x2910f2){return db[_0xc835('0x3e')]['create'](_0x26a79f[_0xc835('0x59')],{})['then'](function(_0x464245){var _0xb1eb5=_0x26a79f[_0xc835('0x5a')][_0xc835('0x36')]({'plain':!![]});if(!_0xb1eb5)throw new Error(_0xc835('0x5b'));if(_0xb1eb5[_0xc835('0x5c')]===_0xc835('0x5a')){var _0xe91903=_0x464245[_0xc835('0x36')]({'plain':!![]});var _0x501886=_0xc835('0x5d');return db['UserProfileSection'][_0xc835('0x5e')]({'where':{'name':_0x501886,'userProfileId':_0xb1eb5['userProfileId']},'raw':!![]})['then'](function(_0x43c81c){if(_0x43c81c&&_0x43c81c[_0xc835('0x5f')]===0x0){return db['UserProfileResource'][_0xc835('0x58')]({'name':_0xe91903[_0xc835('0x39')],'resourceId':_0xe91903['id'],'type':_0x43c81c[_0xc835('0x39')],'sectionId':_0x43c81c['id']},{})[_0xc835('0x20')](function(){return _0x464245;});}else{return _0x464245;}})['catch'](function(_0x2d847f){logger[_0xc835('0x26')](_0xc835('0x60'),_0x2d847f);throw _0x2d847f;});}return _0x464245;})[_0xc835('0x20')](respondWithResult(_0x2910f2,0xc9))[_0xc835('0x2b')](handleError(_0x2910f2,null));};exports['update']=function(_0x239f5b,_0x281ff9){if(_0x239f5b[_0xc835('0x59')]['id']){delete _0x239f5b['body']['id'];}return db[_0xc835('0x3e')][_0xc835('0x5e')]({'where':{'id':_0x239f5b[_0xc835('0x55')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x281ff9,null))[_0xc835('0x20')](saveUpdates(_0x239f5b[_0xc835('0x59')],null))[_0xc835('0x20')](respondWithResult(_0x281ff9,null))[_0xc835('0x2b')](handleError(_0x281ff9,null));};exports[_0xc835('0x35')]=function(_0x446099,_0x1feeda){return db[_0xc835('0x3e')][_0xc835('0x5e')]({'where':{'id':_0x446099['params']['id']}})[_0xc835('0x20')](handleEntityNotFound(_0x1feeda,null))[_0xc835('0x20')](removeEntity(_0x1feeda,null))['catch'](handleError(_0x1feeda,null));};exports[_0xc835('0x61')]=function(_0x24014a,_0x4069d7){return db[_0xc835('0x3e')][_0xc835('0x61')]()['then'](respondWithResult(_0x4069d7,null))[_0xc835('0x2b')](handleError(_0x4069d7,null));};exports[_0xc835('0x62')]=function(_0x269a3a,_0x31d49c,_0x568e2d){if(_0x269a3a[_0xc835('0x59')]['id']){delete _0x269a3a[_0xc835('0x59')]['id'];}return db[_0xc835('0x3e')][_0xc835('0x5e')]({'where':{'id':_0x269a3a[_0xc835('0x55')]['id']}})[_0xc835('0x20')](handleEntityNotFound(_0x31d49c,null))[_0xc835('0x20')](function(_0x1b919e){if(_0x1b919e){_0x269a3a[_0xc835('0x59')][_0xc835('0x63')]=_0x1b919e['id'];return db[_0xc835('0x64')][_0xc835('0x58')](_0x269a3a[_0xc835('0x59')]);}})['then'](respondWithResult(_0x31d49c,null))['catch'](handleError(_0x31d49c,null));};exports[_0xc835('0x65')]=function(_0x586528,_0xe8b29d,_0x52418d){var _0x51eb29={'raw':![],'where':{}};var _0x15f878={};var _0x225134={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0xc835('0x66')]({'where':{'id':_0x586528[_0xc835('0x55')]['id']}})[_0xc835('0x20')](handleEntityNotFound(_0xe8b29d,null))[_0xc835('0x20')](function(_0x42ad81){if(_0x42ad81){_0x15f878['model']=_[_0xc835('0x57')](db[_0xc835('0x64')][_0xc835('0x3f')]);_0x15f878[_0xc835('0x43')]=_['keys'](_0x586528[_0xc835('0x43')]);_0x15f878[_0xc835('0x4b')]=_[_0xc835('0x44')](_0x15f878[_0xc835('0x42')],_0x15f878[_0xc835('0x43')]);_0x51eb29[_0xc835('0x45')]=_[_0xc835('0x44')](_0x15f878[_0xc835('0x42')],qs['fields'](_0x586528[_0xc835('0x43')][_0xc835('0x46')]));_0x51eb29[_0xc835('0x45')]=_0x51eb29[_0xc835('0x45')][_0xc835('0x47')]?_0x51eb29[_0xc835('0x45')]:_0x15f878[_0xc835('0x42')];if(!_0x586528[_0xc835('0x43')]['hasOwnProperty'](_0xc835('0x49'))){_0x51eb29[_0xc835('0x30')]=qs[_0xc835('0x30')](_0x586528[_0xc835('0x43')][_0xc835('0x30')]);_0x51eb29['offset']=qs[_0xc835('0x2f')](_0x586528['query'][_0xc835('0x2f')]);}_0x51eb29['order']=qs[_0xc835('0x4a')](_0x586528[_0xc835('0x43')][_0xc835('0x4a')]);_0x51eb29[_0xc835('0x4e')]=qs['filters'](_[_0xc835('0x67')](_0x586528['query'],_0x15f878[_0xc835('0x4b')]));_0x51eb29[_0xc835('0x4e')][_0xc835('0x68')]=_0x42ad81['id'];if(_0x586528[_0xc835('0x43')][_0xc835('0x4c')]){_0x51eb29[_0xc835('0x4e')]=_[_0xc835('0x4d')](_0x51eb29[_0xc835('0x4e')],{'$or':_[_0xc835('0x3d')](_0x51eb29[_0xc835('0x45')],function(_0x476a2a){var _0x226375={};_0x226375[_0x476a2a]={'$like':'%'+_0x586528['query'][_0xc835('0x4c')]+'%'};return _0x226375;})});}_0x51eb29=_['merge']({},_0x51eb29,_0x586528[_0xc835('0x50')]);return db['Disposition']['count']({'where':_0x51eb29[_0xc835('0x4e')]})['then'](function(_0x1e9471){_0x225134['count']=_0x1e9471;if(_0x586528[_0xc835('0x43')][_0xc835('0x51')]){_0x51eb29[_0xc835('0x52')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x51eb29);})[_0xc835('0x20')](function(_0x368e8f){_0x225134[_0xc835('0x54')]=_0x368e8f;return _0x225134;});}})[_0xc835('0x20')](respondWithFilteredResult(_0xe8b29d,_0x51eb29))[_0xc835('0x2b')](handleError(_0xe8b29d,null));};exports[_0xc835('0x69')]=function(_0x2a2650,_0x10c296,_0x4cb01e){return db[_0xc835('0x3e')][_0xc835('0x5e')]({'where':{'id':_0x2a2650[_0xc835('0x55')]['id']}})[_0xc835('0x20')](handleEntityNotFound(_0x10c296,null))['then'](function(_0x2b7ee){if(_0x2b7ee){return _0x2b7ee[_0xc835('0x69')](_0x2a2650[_0xc835('0x43')][_0xc835('0x6a')]);}})[_0xc835('0x20')](respondWithStatusCode(_0x10c296,null))['catch'](handleError(_0x10c296,null));};exports['addAnswer']=function(_0x57f51b,_0x1058ee,_0x402124){if(_0x57f51b['body']['id']){delete _0x57f51b[_0xc835('0x59')]['id'];}return db[_0xc835('0x3e')]['find']({'where':{'id':_0x57f51b['params']['id']}})[_0xc835('0x20')](handleEntityNotFound(_0x1058ee,null))[_0xc835('0x20')](function(_0x167f1c){if(_0x167f1c){_0x57f51b[_0xc835('0x59')][_0xc835('0x68')]=_0x167f1c['id'];return db['CannedAnswer'][_0xc835('0x58')](_0x57f51b[_0xc835('0x59')]);}})[_0xc835('0x20')](respondWithResult(_0x1058ee,null))[_0xc835('0x2b')](handleError(_0x1058ee,null));};exports[_0xc835('0x6b')]=function(_0x7c4f54,_0x4c3f4a,_0x391142){var _0x1e3042={'raw':![],'where':{}};var _0x26c100={};var _0xe09406={'count':0x0,'rows':[]};return db[_0xc835('0x3e')][_0xc835('0x66')]({'where':{'id':_0x7c4f54['params']['id']}})['then'](handleEntityNotFound(_0x4c3f4a,null))['then'](function(_0x99c558){if(_0x99c558){_0x26c100['model']=_[_0xc835('0x57')](db[_0xc835('0x6c')][_0xc835('0x3f')]);_0x26c100['query']=_[_0xc835('0x57')](_0x7c4f54[_0xc835('0x43')]);_0x26c100[_0xc835('0x4b')]=_[_0xc835('0x44')](_0x26c100['model'],_0x26c100[_0xc835('0x43')]);_0x1e3042['attributes']=_[_0xc835('0x44')](_0x26c100[_0xc835('0x42')],qs[_0xc835('0x46')](_0x7c4f54[_0xc835('0x43')][_0xc835('0x46')]));_0x1e3042[_0xc835('0x45')]=_0x1e3042['attributes'][_0xc835('0x47')]?_0x1e3042['attributes']:_0x26c100['model'];if(!_0x7c4f54[_0xc835('0x43')][_0xc835('0x48')](_0xc835('0x49'))){_0x1e3042['limit']=qs[_0xc835('0x30')](_0x7c4f54[_0xc835('0x43')][_0xc835('0x30')]);_0x1e3042['offset']=qs[_0xc835('0x2f')](_0x7c4f54[_0xc835('0x43')][_0xc835('0x2f')]);}_0x1e3042[_0xc835('0x6d')]=qs[_0xc835('0x4a')](_0x7c4f54[_0xc835('0x43')][_0xc835('0x4a')]);_0x1e3042[_0xc835('0x4e')]=qs[_0xc835('0x4b')](_[_0xc835('0x67')](_0x7c4f54[_0xc835('0x43')],_0x26c100['filters']));_0x1e3042[_0xc835('0x4e')][_0xc835('0x68')]=_0x99c558['id'];if(_0x7c4f54['query']['filter']){_0x1e3042['where']=_[_0xc835('0x4d')](_0x1e3042[_0xc835('0x4e')],{'$or':_[_0xc835('0x3d')](_0x1e3042[_0xc835('0x45')],function(_0x156809){var _0x5bb3ef={};_0x5bb3ef[_0x156809]={'$like':'%'+_0x7c4f54[_0xc835('0x43')][_0xc835('0x4c')]+'%'};return _0x5bb3ef;})});}_0x1e3042=_[_0xc835('0x4d')]({},_0x1e3042,_0x7c4f54[_0xc835('0x50')]);return db[_0xc835('0x6c')]['count']({'where':_0x1e3042['where']})[_0xc835('0x20')](function(_0x24e98f){_0xe09406[_0xc835('0x2e')]=_0x24e98f;if(_0x7c4f54[_0xc835('0x43')][_0xc835('0x51')]){_0x1e3042[_0xc835('0x52')]=[{'all':!![]}];}return db['CannedAnswer'][_0xc835('0x53')](_0x1e3042);})['then'](function(_0x322d19){_0xe09406[_0xc835('0x54')]=_0x322d19;return _0xe09406;});}})[_0xc835('0x20')](respondWithFilteredResult(_0x4c3f4a,_0x1e3042))['catch'](handleError(_0x4c3f4a,null));};exports[_0xc835('0x6e')]=function(_0x2740ad,_0x4257a9,_0x1c557c){return db[_0xc835('0x3e')]['find']({'where':{'id':_0x2740ad[_0xc835('0x55')]['id']}})[_0xc835('0x20')](handleEntityNotFound(_0x4257a9,null))['then'](function(_0xd76f0){if(_0xd76f0){return _0xd76f0[_0xc835('0x6e')](_0x2740ad[_0xc835('0x43')]['ids']);}})[_0xc835('0x20')](respondWithStatusCode(_0x4257a9,null))['catch'](handleError(_0x4257a9,null));};exports[_0xc835('0x6f')]=function(_0x29544b,_0x4710da,_0x3c0119){var _0x31e3ad={'body':_0x29544b[_0xc835('0x59')],'channel':'openchannel'};var _0x412eab=[];var _0x353988=[];var _0x22cf36={};var _0x18555c=![];return db[_0xc835('0x70')]['describe']()[_0xc835('0x20')](function(_0x1d09ce){if(!_0x1d09ce){throw new db[(_0xc835('0x71'))]['ValidationError']('no\x20available\x20attributes');}_0x412eab=_[_0xc835('0x72')](_['keys'](_0x1d09ce),['createdAt',_0xc835('0x73')]);_0x353988=_[_0xc835('0x72')](_['keys'](_0x1d09ce),[_0xc835('0x74'),'updatedAt',_0xc835('0x75'),'ListId']);if(_0x29544b[_0xc835('0x59')]['id']){delete _0x29544b[_0xc835('0x59')]['id'];}if(_['isNil'](_0x29544b['body']['from'])){throw new db[(_0xc835('0x71'))]['ValidationError'](_0xc835('0x76'));}if(_[_0xc835('0x77')](_0x29544b[_0xc835('0x59')][_0xc835('0x59')])||_0x29544b[_0xc835('0x59')][_0xc835('0x59')]===''){throw new db[(_0xc835('0x71'))][(_0xc835('0x1e'))](_0xc835('0x78'));}if(_[_0xc835('0x77')](_0x29544b[_0xc835('0x59')]['mapKey'])){throw new db['Sequelize'][(_0xc835('0x1e'))](_0xc835('0x79')+_0x353988);}if(!_[_0xc835('0x7a')](_0x353988,_0x29544b[_0xc835('0x59')][_0xc835('0x7b')])){throw new db['Sequelize'][(_0xc835('0x1e'))](_0xc835('0x7c')+_0x353988);}_0x22cf36[_0x29544b[_0xc835('0x59')][_0xc835('0x7b')]]=_0x29544b[_0xc835('0x59')][_0xc835('0x7d')];})['then'](function(){return db[_0xc835('0x3e')][_0xc835('0x5e')]({'where':{'id':_0x29544b[_0xc835('0x55')]['id']},'include':[{'model':db['CmList'],'as':_0xc835('0x7e'),'include':[{'model':db[_0xc835('0x70')],'as':_0xc835('0x7f'),'where':_0x22cf36,'limit':0x1,'order':[[_0xc835('0x73'),_0xc835('0x80')]]}]},{'model':db[_0xc835('0x81')],'as':_0xc835('0x82')}]});})[_0xc835('0x20')](handleEntityNotFound(_0x4710da,null))[_0xc835('0x20')](function(_0x89aa6b){if(_0x89aa6b&&_0x89aa6b[_0xc835('0x7e')]){_0x31e3ad[_0xc835('0x83')]=_0x89aa6b;_0x31e3ad['applications']=_0x89aa6b[_0xc835('0x82')];_0x31e3ad[_0xc835('0x84')]=_0x89aa6b[_0xc835('0x7e')];_0x31e3ad[_0xc835('0x85')]=_[_0xc835('0x86')](_0x31e3ad[_0xc835('0x85')],[_0xc835('0x87')],[_0xc835('0x88')]);if(_0x31e3ad[_0xc835('0x83')][_0xc835('0x82')]){delete _0x31e3ad[_0xc835('0x83')][_0xc835('0x82')];}if(_0x31e3ad[_0xc835('0x83')][_0xc835('0x7e')]&&_0x31e3ad[_0xc835('0x83')]['List'][_0xc835('0x7f')]['length']){return _0x31e3ad[_0xc835('0x83')][_0xc835('0x7e')][_0xc835('0x7f')][0x0];}var _0x5cef6e=_[_0xc835('0x16')](_0x29544b[_0xc835('0x59')],{'firstName':_0x29544b[_0xc835('0x59')][_0xc835('0x7d')],'ListId':_0x89aa6b['ListId']});_0x5cef6e[_0x29544b[_0xc835('0x59')][_0xc835('0x7b')]]=_0x29544b['body'][_0xc835('0x7d')];return db[_0xc835('0x70')][_0xc835('0x58')](_0x5cef6e,{'fields':_0x412eab,'raw':!![]});}})[_0xc835('0x20')](handleEntityNotFound(_0x4710da,null))['then'](function(_0x29af35){_0x31e3ad[_0xc835('0x89')]=_0x29af35;if(_0x29af35){var _0x9b3336={'ContactId':_0x29af35['id'],'OpenchannelAccountId':_0x29544b[_0xc835('0x55')]['id'],'from':(_0x29af35['firstName']||'')+'\x20'+(_0x29af35['lastName']||'')};var _0x119693={'OpenchannelAccountId':_0x29544b[_0xc835('0x55')]['id'],'closed':![]};if(_0x29544b[_0xc835('0x59')]['threadId']){_0x119693[_0xc835('0x8a')]=_0x29544b['body'][_0xc835('0x8a')];return db[_0xc835('0x8b')][_0xc835('0x5e')]({'where':_0x119693})['then'](function(_0x346e38){if(_0x346e38){return[_0x346e38,![]];}_0x9b3336['threadId']=_0x29544b[_0xc835('0x59')]['threadId'];_0x9b3336[_0xc835('0x8c')]=_0x29544b['body'][_0xc835('0x8c')];return db[_0xc835('0x8b')][_0xc835('0x58')](_0x9b3336)[_0xc835('0x20')](function(_0x4870a4){return[_0x4870a4,!![]];});});}else{_0x119693[_0xc835('0x8a')]=null;}_0x119693['ContactId']=_0x29af35['id'];return db[_0xc835('0x8b')][_0xc835('0x5e')]({'where':_0x119693})[_0xc835('0x20')](function(_0xe9f331){if(_0xe9f331){return[_0xe9f331,![]];}return db['OpenchannelInteraction'][_0xc835('0x58')](_0x9b3336)['then'](function(_0x4ad47b){return[_0x4ad47b,!![]];});});}})['spread'](function(_0x15dcf3,_0xe7ecd6){if(_0x15dcf3){_0x18555c=_0xe7ecd6;if(!_0xe7ecd6){var _0x574bae={'from':(_0x31e3ad[_0xc835('0x89')]['firstName']||'')+'\x20'+(_0x31e3ad[_0xc835('0x89')][_0xc835('0x8d')]||'')};if(_0x29544b['body'][_0xc835('0x8a')]&&_0x29544b['body']['messageId']&&_0x29544b['body']['threadId']!=_0x29544b[_0xc835('0x59')][_0xc835('0x8e')]){_0x574bae['threadId']=_0x29544b[_0xc835('0x59')]['messageId'];}return _0x15dcf3[_0xc835('0x34')](_0x574bae);}else{return _0x15dcf3;}}})[_0xc835('0x20')](function(_0x165f62){_0x31e3ad[_0xc835('0x8f')]=_0x165f62[_0xc835('0x36')]({'plain':!![]});_0x31e3ad[_0xc835('0x8f')][_0xc835('0x90')]=_0x18555c;if(_0x31e3ad[_0xc835('0x8f')][_0xc835('0x90')]){if(_0x31e3ad[_0xc835('0x83')]['autoclose']){_0x31e3ad[_0xc835('0x85')][_0xc835('0x91')]({'id':0x0,'priority':_0x31e3ad[_0xc835('0x85')][_0xc835('0x47')]+0x1,'app':_0xc835('0x92'),'appdata':'unmanaged','interval':'*,*,*,*'});}}return db[_0xc835('0x93')][_0xc835('0x58')]({'body':_0x29544b['body'][_0xc835('0x59')],'OpenchannelAccountId':_0x29544b[_0xc835('0x55')]['id'],'OpenchannelInteractionId':_0x165f62['id'],'direction':'in','ContactId':_0x31e3ad[_0xc835('0x89')]['id'],'AttachmentId':_0x29544b[_0xc835('0x59')][_0xc835('0x94')]});})[_0xc835('0x20')](function(_0xac0d97){_0x31e3ad[_0xc835('0x29')]=_0xac0d97;if(_0x31e3ad['interaction'][_0xc835('0x95')]){return db[_0xc835('0x96')][_0xc835('0x5e')]({'attributes':['id',_0xc835('0x39')],'where':{'id':_0x31e3ad[_0xc835('0x8f')]['UserId']}})['then'](function(_0x3602bd){if(_0x3602bd){_0x31e3ad[_0xc835('0x85')]['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x3602bd[_0xc835('0x39')]+','+(_0x31e3ad[_0xc835('0x83')][_0xc835('0x97')]||0xa),'interval':_0xc835('0x98')});_0x31e3ad['forcedOwnership']=![];}return respondWithRpcPromise(_0xc835('0x99'),'startRouting',_0x31e3ad);});}return respondWithRpcPromise(_0xc835('0x99'),_0xc835('0x9a'),_0x31e3ad);})[_0xc835('0x20')](function(_0x2a0045){respondWithRpcPromise(_0xc835('0x9b'),_0xc835('0x9b'),{'event':'notify','message':_0x2a0045},client9002);return _0x2a0045;})[_0xc835('0x20')](respondWithResult(_0x4710da,null))[_0xc835('0x2b')](handleError(_0x4710da,null));};exports[_0xc835('0x9c')]=function(_0x4a5781,_0x59acd,_0x280042){return db['OpenchannelAccount']['findOne']({'where':{'id':_0x4a5781[_0xc835('0x55')]['id']}})[_0xc835('0x20')](handleEntityNotFound(_0x59acd,null))['then'](function(_0x5ba40b){if(_0x5ba40b){return db[_0xc835('0x9d')][_0xc835('0x9e')](function(_0x30c390){return db[_0xc835('0x81')][_0xc835('0x35')]({'where':{'OpenchannelAccountId':_0x4a5781[_0xc835('0x55')]['id']},'transaction':_0x30c390})[_0xc835('0x20')](function(_0x4d7496){var _0x3026ae=_['map'](_0x4a5781[_0xc835('0x59')],function(_0x236b7f){_0x236b7f[_0xc835('0x68')]=_0x4a5781[_0xc835('0x55')]['id'];return _0x236b7f;});return db[_0xc835('0x81')][_0xc835('0x9f')](_0x3026ae,{'transaction':_0x30c390});});})['then'](function(){return db['OpenchannelApplication'][_0xc835('0xa0')]({'where':{'OpenchannelAccountId':_0x4a5781['params']['id']},'order':_0xc835('0x87')});});}})['then'](respondWithResult(_0x59acd,null))[_0xc835('0x2b')](handleError(_0x59acd,null));};exports[_0xc835('0xa1')]=function(_0xb80867,_0x466c63,_0x6662a){var _0x5b40b3={};var _0x34e0e4={};var _0x401a1a;var _0x1483ef;return db[_0xc835('0x3e')][_0xc835('0x66')]({'where':{'id':_0xb80867[_0xc835('0x55')]['id']}})['then'](handleEntityNotFound(_0x466c63,null))['then'](function(_0x4eb3d8){if(_0x4eb3d8){_0x401a1a=_0x4eb3d8;_0x34e0e4[_0xc835('0x42')]=_[_0xc835('0x57')](db['OpenchannelApplication'][_0xc835('0x3f')]);_0x34e0e4[_0xc835('0x43')]=_[_0xc835('0x57')](_0xb80867[_0xc835('0x43')]);_0x34e0e4[_0xc835('0x4b')]=_[_0xc835('0x44')](_0x34e0e4[_0xc835('0x42')],_0x34e0e4[_0xc835('0x43')]);_0x5b40b3['attributes']=_[_0xc835('0x44')](_0x34e0e4[_0xc835('0x42')],qs['fields'](_0xb80867[_0xc835('0x43')][_0xc835('0x46')]));_0x5b40b3[_0xc835('0x45')]=_0x5b40b3[_0xc835('0x45')][_0xc835('0x47')]?_0x5b40b3[_0xc835('0x45')]:_0x34e0e4[_0xc835('0x42')];_0x5b40b3['order']=qs[_0xc835('0x4a')](_0xb80867['query']['sort']);_0x5b40b3[_0xc835('0x4e')]=qs[_0xc835('0x4b')](_[_0xc835('0x67')](_0xb80867[_0xc835('0x43')],_0x34e0e4[_0xc835('0x4b')]));if(_0xb80867[_0xc835('0x43')][_0xc835('0x4c')]){_0x5b40b3['where']=_[_0xc835('0x4d')](_0x5b40b3[_0xc835('0x4e')],{'$or':_[_0xc835('0x3d')](_0x5b40b3[_0xc835('0x45')],function(_0x1da0cb){var _0xe9e18f={};_0xe9e18f[_0x1da0cb]={'$like':'%'+_0xb80867['query'][_0xc835('0x4c')]+'%'};return _0xe9e18f;})});}_0x5b40b3=_[_0xc835('0x4d')]({},_0x5b40b3,_0xb80867[_0xc835('0x50')]);return _0x401a1a[_0xc835('0xa1')](_0x5b40b3);}})[_0xc835('0x20')](function(_0x565299){if(_0x565299){_0x1483ef=_0x565299['length'];if(!_0xb80867[_0xc835('0x43')][_0xc835('0x48')](_0xc835('0x49'))){_0x5b40b3[_0xc835('0x30')]=qs[_0xc835('0x30')](_0xb80867[_0xc835('0x43')][_0xc835('0x30')]);_0x5b40b3[_0xc835('0x2f')]=qs[_0xc835('0x2f')](_0xb80867[_0xc835('0x43')][_0xc835('0x2f')]);}return _0x401a1a[_0xc835('0xa1')](_0x5b40b3);}})['then'](function(_0x362475){if(_0x362475){return _0x362475?{'count':_0x1483ef,'rows':_0x362475}:null;}})[_0xc835('0x20')](respondWithResult(_0x466c63,null))['catch'](handleError(_0x466c63,null));};exports['getInteractions']=function(_0x2fc743,_0x36336e,_0x1e51f0){var _0x16b8c9={'raw':![],'where':{}};var _0x1fa86f={};var _0x32b79d={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0xc835('0x66')]({'where':{'id':_0x2fc743[_0xc835('0x55')]['id']}})[_0xc835('0x20')](handleEntityNotFound(_0x36336e,null))[_0xc835('0x20')](function(_0x35bbba){if(_0x35bbba){_0x1fa86f[_0xc835('0x42')]=_[_0xc835('0x57')](db[_0xc835('0x8b')][_0xc835('0x3f')]);_0x1fa86f[_0xc835('0x43')]=_['keys'](_0x2fc743[_0xc835('0x43')]);_0x1fa86f[_0xc835('0x4b')]=_['intersection'](_0x1fa86f[_0xc835('0x42')],_0x1fa86f[_0xc835('0x43')]);_0x16b8c9['attributes']=_[_0xc835('0x44')](_0x1fa86f[_0xc835('0x42')],qs[_0xc835('0x46')](_0x2fc743[_0xc835('0x43')]['fields']));_0x16b8c9[_0xc835('0x45')]=_0x16b8c9[_0xc835('0x45')]['length']?_0x16b8c9[_0xc835('0x45')]:_0x1fa86f[_0xc835('0x42')];if(!_0x2fc743['query']['hasOwnProperty'](_0xc835('0x49'))){_0x16b8c9[_0xc835('0x30')]=qs[_0xc835('0x30')](_0x2fc743['query']['limit']);_0x16b8c9[_0xc835('0x2f')]=qs[_0xc835('0x2f')](_0x2fc743['query'][_0xc835('0x2f')]);}_0x16b8c9[_0xc835('0x6d')]=qs[_0xc835('0x4a')](_0x2fc743['query'][_0xc835('0x4a')]);_0x16b8c9['where']=qs[_0xc835('0x4b')](_[_0xc835('0x67')](_0x2fc743[_0xc835('0x43')],_0x1fa86f[_0xc835('0x4b')]));_0x16b8c9[_0xc835('0x4e')][_0xc835('0x68')]=_0x35bbba['id'];if(_0x2fc743[_0xc835('0x43')]['filter']){_0x16b8c9[_0xc835('0x4e')]=_['merge'](_0x16b8c9[_0xc835('0x4e')],{'$or':_[_0xc835('0x3d')](_0x16b8c9[_0xc835('0x45')],function(_0x77ef39){var _0x2a5a28={};_0x2a5a28[_0x77ef39]={'$like':'%'+_0x2fc743['query'][_0xc835('0x4c')]+'%'};return _0x2a5a28;})});}_0x16b8c9=_['merge']({},_0x16b8c9,_0x2fc743['options']);return db['OpenchannelInteraction'][_0xc835('0x2e')]({'where':_0x16b8c9['where']})[_0xc835('0x20')](function(_0x26405d){_0x32b79d[_0xc835('0x2e')]=_0x26405d;if(_0x2fc743[_0xc835('0x43')][_0xc835('0x51')]){_0x16b8c9['include']=[{'model':db[_0xc835('0x70')],'as':_0xc835('0xa2'),'required':![]},{'model':db[_0xc835('0x96')],'as':'Owner','attributes':[_0xc835('0x39'),_0xc835('0xa3'),_0xc835('0xa4')],'required':![]},{'model':db[_0xc835('0xa5')],'as':_0xc835('0xa6'),'attributes':['id',_0xc835('0x39'),_0xc835('0xa7')],'where':_0x2fc743[_0xc835('0x43')]['tag']?{'id':_0x2fc743[_0xc835('0x43')]['tag']}:undefined,'required':_0x2fc743[_0xc835('0x43')]['tag']?!![]:![]}];}return db[_0xc835('0x8b')][_0xc835('0x53')](_0x16b8c9);})['then'](function(_0x2797f9){_0x32b79d['rows']=_0x2797f9;return _0x32b79d;});}})[_0xc835('0x20')](respondWithFilteredResult(_0x36336e,_0x16b8c9))[_0xc835('0x2b')](handleError(_0x36336e,null));};exports[_0xc835('0xa8')]=function(_0x2a0876,_0x223dae,_0x3645ca){return db['OpenchannelAccount'][_0xc835('0x5e')]({'where':{'id':_0x2a0876['params']['id']}})[_0xc835('0x20')](handleEntityNotFound(_0x223dae,null))['then'](function(_0xde6c89){if(_0xde6c89){return _0xde6c89[_0xc835('0xa8')](_0x2a0876[_0xc835('0x59')][_0xc835('0x6a')],_[_0xc835('0xa9')](_0x2a0876[_0xc835('0x59')],[_0xc835('0x6a'),'id'])||{})[_0xc835('0xaa')](function(_0x3bd8eb){for(var _0x298de5=0x0;_0x298de5<_0x2a0876[_0xc835('0x59')][_0xc835('0x6a')][_0xc835('0x47')];_0x298de5+=0x1){socket['emit'](_0xc835('0xab'),{'UserId':_0x2a0876[_0xc835('0x59')]['ids'][_0x298de5],'OpenchannelAccountId':_0x2a0876['params']['id']});}return _0x3bd8eb;});}})['then'](respondWithResult(_0x223dae,null))[_0xc835('0x2b')](handleError(_0x223dae,null));};exports['removeAgents']=function(_0x20a84a,_0x2e236d,_0x26ad03){return db[_0xc835('0x3e')][_0xc835('0x5e')]({'where':{'id':_0x20a84a[_0xc835('0x55')]['id']}})['then'](handleEntityNotFound(_0x2e236d,null))[_0xc835('0x20')](function(_0x5aef53){if(_0x5aef53){return _0x5aef53[_0xc835('0xac')](_0x20a84a[_0xc835('0x43')]['ids'])['then'](function(){if(_[_0xc835('0xad')](_0x20a84a[_0xc835('0x43')][_0xc835('0x6a')])){for(var _0x42b594=0x0;_0x42b594<_0x20a84a[_0xc835('0x43')][_0xc835('0x6a')]['length'];_0x42b594+=0x1){socket[_0xc835('0xae')](_0xc835('0xaf'),{'UserId':Number(_0x20a84a[_0xc835('0x43')]['ids'][_0x42b594]),'OpenchannelAccountId':Number(_0x20a84a[_0xc835('0x55')]['id'])});}}else{socket[_0xc835('0xae')]('userOpenchannelAccount:remove',{'UserId':Number(_0x20a84a[_0xc835('0x43')]['ids']),'OpenchannelAccountId':Number(_0x20a84a[_0xc835('0x55')]['id'])});}});}})[_0xc835('0x20')](respondWithStatusCode(_0x2e236d,null))[_0xc835('0x2b')](handleError(_0x2e236d,null));};exports['getAgents']=function(_0x599c42,_0x53bae7,_0x4818b1){var _0x4cb3df={};var _0x25d443={};var _0x520e1c;var _0x433dba;return db[_0xc835('0x3e')]['findOne']({'where':{'id':_0x599c42[_0xc835('0x55')]['id']}})[_0xc835('0x20')](handleEntityNotFound(_0x53bae7,null))[_0xc835('0x20')](function(_0x475384){if(_0x475384){_0x520e1c=_0x475384;_0x25d443['model']=_['keys'](db[_0xc835('0x96')][_0xc835('0x3f')]);_0x25d443[_0xc835('0x43')]=_[_0xc835('0x57')](_0x599c42[_0xc835('0x43')]);_0x25d443['filters']=_[_0xc835('0x44')](_0x25d443['model'],_0x25d443[_0xc835('0x43')]);_0x4cb3df[_0xc835('0x45')]=_[_0xc835('0x44')](_0x25d443['model'],qs[_0xc835('0x46')](_0x599c42[_0xc835('0x43')][_0xc835('0x46')]));_0x4cb3df[_0xc835('0x45')]=_0x4cb3df['attributes'][_0xc835('0x47')]?_0x4cb3df[_0xc835('0x45')]:_0x25d443[_0xc835('0x42')];_0x4cb3df[_0xc835('0x6d')]=qs[_0xc835('0x4a')](_0x599c42['query'][_0xc835('0x4a')]);_0x4cb3df[_0xc835('0x4e')]=qs[_0xc835('0x4b')](_['pick'](_0x599c42[_0xc835('0x43')],_0x25d443[_0xc835('0x4b')]));if(_0x599c42['query']['filter']){_0x4cb3df['where']=_[_0xc835('0x4d')](_0x4cb3df[_0xc835('0x4e')],{'$or':_['map'](_0x4cb3df[_0xc835('0x45')],function(_0x34c53a){var _0x2e403a={};_0x2e403a[_0x34c53a]={'$like':'%'+_0x599c42[_0xc835('0x43')][_0xc835('0x4c')]+'%'};return _0x2e403a;})});}_0x4cb3df=_['merge']({},_0x4cb3df,_0x599c42[_0xc835('0x50')]);return _0x520e1c[_0xc835('0xb0')](_0x4cb3df);}})[_0xc835('0x20')](function(_0x178e56){if(_0x178e56){_0x433dba=_0x178e56[_0xc835('0x47')];if(!_0x599c42[_0xc835('0x43')]['hasOwnProperty'](_0xc835('0x49'))){_0x4cb3df['limit']=qs[_0xc835('0x30')](_0x599c42[_0xc835('0x43')]['limit']);_0x4cb3df[_0xc835('0x2f')]=qs[_0xc835('0x2f')](_0x599c42['query']['offset']);}return _0x520e1c[_0xc835('0xb0')](_0x4cb3df);}})['then'](function(_0x3c11c8){if(_0x3c11c8){return _0x3c11c8?{'count':_0x433dba,'rows':_0x3c11c8}:null;}})[_0xc835('0x20')](respondWithResult(_0x53bae7,null))[_0xc835('0x2b')](handleError(_0x53bae7,null));};exports['send']=function(_0x385a66,_0xfb2d7a,_0x439f26){var _0x41f019,_0x2c5f2d,_0x2a1b63;if(_['isNil'](_0x385a66[_0xc835('0x59')][_0xc835('0x59')])||_0x385a66['body'][_0xc835('0x59')]===''){throw new db[(_0xc835('0x71'))][(_0xc835('0x1e'))](_0xc835('0x78'));}if(_['isNil'](_0x385a66[_0xc835('0x59')]['to'])){}_0x41f019=_0x385a66['body']['to'];return db[_0xc835('0x3e')][_0xc835('0x66')]({'where':{'id':_0x385a66['params']['id']}})['then'](handleEntityNotFound(_0xfb2d7a,null))[_0xc835('0x20')](function(_0x4350ad){if(_0x4350ad){return db[_0xc835('0x3e')][_0xc835('0x5e')]({'where':{'id':_0x4350ad['id']},'include':[{'model':db['CmList'],'as':_0xc835('0x7e'),'include':[{'model':db['CmContact'],'as':_0xc835('0x7f'),'where':{[_0x4350ad[_0xc835('0x7b')]]:_0x41f019},'limit':0x1,'order':[[_0xc835('0x73'),_0xc835('0x80')]]}]}]})['then'](handleEntityNotFound(_0xfb2d7a,null))['then'](function(_0x5c900c){if(_0x5c900c&&_0x5c900c[_0xc835('0x7e')]){_0x2c5f2d=_0x5c900c[_0xc835('0x36')]({'plain':!![]});if(_0x2c5f2d[_0xc835('0x7e')]&&_0x2c5f2d['List'][_0xc835('0x7f')]['length']){return _0x2c5f2d[_0xc835('0x7e')][_0xc835('0x7f')][0x0];}return db['CmContact']['create'](_[_0xc835('0x16')](_0x385a66[_0xc835('0x59')],{'firstName':_0x41f019,[_0x5c900c[_0xc835('0x7b')]]:_0x41f019,'phone':_0x41f019,'ListId':_0x2c5f2d['ListId']}));}})['then'](handleEntityNotFound(_0xfb2d7a,null))[_0xc835('0x20')](function(_0x46ef05){if(_0x46ef05){_0x2a1b63=_0x46ef05;return db[_0xc835('0x8b')][_0xc835('0x5e')]({'where':{'ContactId':_0x2a1b63['id'],'closed':![],'OpenchannelAccountId':_0x2c5f2d['id']}})[_0xc835('0x20')](function(_0x3c44b4){if(_0x3c44b4){return[_0x3c44b4,![]];}return db[_0xc835('0x8b')][_0xc835('0x58')]({'UserId':_0x385a66['user']['id'],'ContactId':_0x2a1b63['id'],'OpenchannelAccountId':_0x2c5f2d['id'],'lastMsgDirection':_0xc835('0xb1'),'Messages':[_[_0xc835('0x4d')](_0x385a66['body'],{'read':![],'body':_0x385a66[_0xc835('0x59')][_0xc835('0x59')],'OpenchannelAccountId':_0x2c5f2d['id'],'UserId':_0x385a66['user']['id'],'ContactId':_0x2a1b63['id']})]},{'include':[{'model':db[_0xc835('0x93')],'as':_0xc835('0xb2')}]})['then'](function(_0x3ea734){return[_0x3ea734,!![]];});});}})[_0xc835('0xaa')](function(_0xe9d9cf,_0x372b7d){if(_0x372b7d){return _0xe9d9cf;}return db[_0xc835('0x93')][_0xc835('0x58')](_[_0xc835('0x4d')](_0x385a66['body'],{'read':![],'body':_0x385a66[_0xc835('0x59')][_0xc835('0x59')],'OpenchannelAccountId':_0x2c5f2d['id'],'OpenchannelInteractionId':_0xe9d9cf['id'],'UserId':_0x385a66[_0xc835('0x5a')]['id'],'ContactId':_0x2a1b63['id']}))[_0xc835('0x20')](function(_0xf7062){_0xe9d9cf[_0xc835('0xb3')]['Messages']=[];_0xe9d9cf['dataValues'][_0xc835('0xb2')]['push'](_0xf7062['dataValues']);return _0xe9d9cf;});});}})['then'](respondWithResult(_0xfb2d7a,null))['catch'](handleError(_0xfb2d7a,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index c02dbfb..b786ba7 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 _0xc1fd=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelAccount'];(function(_0x7e2eb0,_0x17cd58){var _0xd92de4=function(_0x5d005b){while(--_0x5d005b){_0x7e2eb0['push'](_0x7e2eb0['shift']());}};_0xd92de4(++_0x17cd58);}(_0xc1fd,0x115));var _0xdc1f=function(_0x4b059a,_0xa69702){_0x4b059a=_0x4b059a-0x0;var _0xc128cc=_0xc1fd[_0x4b059a];return _0xc128cc;};'use strict';var EventEmitter=require(_0xdc1f('0x0'));var OpenchannelAccount=require(_0xdc1f('0x1'))['db'][_0xdc1f('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0xdc1f('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xdc1f('0x4'),'afterDestroy':_0xdc1f('0x5')};function emitEvent(_0x466362){return function(_0x2fb636,_0x3abb4f,_0x14c7ac){OpenchannelAccountEvents[_0xdc1f('0x6')](_0x466362+':'+_0x2fb636['id'],_0x2fb636);OpenchannelAccountEvents[_0xdc1f('0x6')](_0x466362,_0x2fb636);_0x14c7ac(null);};}for(var e in events){if(events[_0xdc1f('0x7')](e)){var event=events[e];OpenchannelAccount[_0xdc1f('0x8')](e,emitEvent(event));}}module[_0xdc1f('0x9')]=OpenchannelAccountEvents; \ No newline at end of file +var _0x9049=['save','update','remove','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x9049,0x8d));var _0x9904=function(_0x42fc97,_0x7096fd){_0x42fc97=_0x42fc97-0x0;var _0x3e0816=_0x9049[_0x42fc97];return _0x3e0816;};'use strict';var EventEmitter=require(_0x9904('0x0'));var OpenchannelAccount=require(_0x9904('0x1'))['db']['OpenchannelAccount'];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x9904('0x2')](0x0);var events={'afterCreate':_0x9904('0x3'),'afterUpdate':_0x9904('0x4'),'afterDestroy':_0x9904('0x5')};function emitEvent(_0x177a3f){return function(_0x39b2af,_0x2996cf,_0x38308e){OpenchannelAccountEvents['emit'](_0x177a3f+':'+_0x39b2af['id'],_0x39b2af);OpenchannelAccountEvents['emit'](_0x177a3f,_0x39b2af);_0x38308e(null);};}for(var e in events){if(events[_0x9904('0x6')](e)){var event=events[e];OpenchannelAccount[_0x9904('0x7')](e,emitEvent(event));}}module[_0x9904('0x8')]=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index abefd34..514d383 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 _0xe7f8=['OpenchannelAccount','openchannel_accounts','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelAccount.attributes','exports','define'];(function(_0x4d79bc,_0x32c905){var _0x4b4760=function(_0x212302){while(--_0x212302){_0x4d79bc['push'](_0x4d79bc['shift']());}};_0x4b4760(++_0x32c905);}(_0xe7f8,0x18a));var _0x8e7f=function(_0x562043,_0x475d72){_0x562043=_0x562043-0x0;var _0x376ea5=_0xe7f8[_0x562043];return _0x376ea5;};'use strict';var _=require(_0x8e7f('0x0'));var util=require(_0x8e7f('0x1'));var logger=require('../../config/logger')(_0x8e7f('0x2'));var moment=require(_0x8e7f('0x3'));var BPromise=require(_0x8e7f('0x4'));var rp=require(_0x8e7f('0x5'));var fs=require('fs');var path=require(_0x8e7f('0x6'));var rimraf=require(_0x8e7f('0x7'));var config=require(_0x8e7f('0x8'));var attributes=require(_0x8e7f('0x9'));module[_0x8e7f('0xa')]=function(_0x105b14,_0x42791e){return _0x105b14[_0x8e7f('0xb')](_0x8e7f('0xc'),attributes,{'tableName':_0x8e7f('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf776=['path','rimraf','../../config/environment','./openchannelAccount.attributes','exports','define','openchannel_accounts','util','api','bluebird','request-promise'];(function(_0x5457d2,_0x212c2b){var _0x311ac6=function(_0x539fbd){while(--_0x539fbd){_0x5457d2['push'](_0x5457d2['shift']());}};_0x311ac6(++_0x212c2b);}(_0xf776,0x1d5));var _0x6f77=function(_0xd3d862,_0x129e98){_0xd3d862=_0xd3d862-0x0;var _0x27d9e7=_0xf776[_0xd3d862];return _0x27d9e7;};'use strict';var _=require('lodash');var util=require(_0x6f77('0x0'));var logger=require('../../config/logger')(_0x6f77('0x1'));var moment=require('moment');var BPromise=require(_0x6f77('0x2'));var rp=require(_0x6f77('0x3'));var fs=require('fs');var path=require(_0x6f77('0x4'));var rimraf=require(_0x6f77('0x5'));var config=require(_0x6f77('0x6'));var attributes=require(_0x6f77('0x7'));module[_0x6f77('0x8')]=function(_0x5d0bb3,_0x5f122d){return _0x5d0bb3[_0x6f77('0x9')]('OpenchannelAccount',attributes,{'tableName':_0x6f77('0xa'),'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 1f6da20..ad70cc9 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 _0x70a9=['OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','localhost','./openchannelAccount.socket','register','info'];(function(_0x4792c8,_0x5158a1){var _0x35edb1=function(_0x2472d3){while(--_0x2472d3){_0x4792c8['push'](_0x4792c8['shift']());}};_0x35edb1(++_0x5158a1);}(_0x70a9,0x181));var _0x970a=function(_0x903373,_0x587aea){_0x903373=_0x903373-0x0;var _0x5aa4c0=_0x70a9[_0x903373];return _0x5aa4c0;};'use strict';var _=require(_0x970a('0x0'));var util=require('util');var moment=require(_0x970a('0x1'));var BPromise=require(_0x970a('0x2'));var rs=require(_0x970a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x970a('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x970a('0x5'))(_0x970a('0x6'));var config=require(_0x970a('0x7'));var jayson=require(_0x970a('0x8'));var client=jayson[_0x970a('0x9')]['http']({'port':0x232a});config['redis']=_[_0x970a('0xa')](config['redis'],{'host':_0x970a('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x970a('0xc'))[_0x970a('0xd')](socket);function respondWithRpcPromise(_0x15e62f,_0x30fc25,_0x1641e5){return new BPromise(function(_0xcbdd61,_0x142ad1){return client['request'](_0x15e62f,_0x1641e5)['then'](function(_0x100e47){logger[_0x970a('0xe')](_0x970a('0xf'),_0x30fc25,_0x970a('0x10'));logger[_0x970a('0x11')](_0x970a('0x12'),_0x30fc25,'request\x20sent',JSON[_0x970a('0x13')](_0x100e47));if(_0x100e47['error']){if(_0x100e47[_0x970a('0x14')][_0x970a('0x15')]===0x1f4){logger[_0x970a('0x14')](_0x970a('0xf'),_0x30fc25,_0x100e47['error'][_0x970a('0x16')]);return _0x142ad1(_0x100e47[_0x970a('0x14')][_0x970a('0x16')]);}logger[_0x970a('0x14')](_0x970a('0xf'),_0x30fc25,_0x100e47['error'][_0x970a('0x16')]);return _0xcbdd61(_0x100e47[_0x970a('0x14')][_0x970a('0x16')]);}else{logger[_0x970a('0xe')](_0x970a('0xf'),_0x30fc25,'request\x20sent');_0xcbdd61(_0x100e47[_0x970a('0x17')][_0x970a('0x16')]);}})[_0x970a('0x18')](function(_0x36d48f){logger[_0x970a('0x14')](_0x970a('0xf'),_0x30fc25,_0x36d48f);_0x142ad1(_0x36d48f);});});} \ No newline at end of file +var _0xb4a7=['register','info','OpenchannelAccount,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter'];(function(_0xaaaef9,_0x411748){var _0x525e49=function(_0x5512c4){while(--_0x5512c4){_0xaaaef9['push'](_0xaaaef9['shift']());}};_0x525e49(++_0x411748);}(_0xb4a7,0x1a1));var _0x7b4a=function(_0x3d38bb,_0x4cb6d7){_0x3d38bb=_0x3d38bb-0x0;var _0x2b473d=_0xb4a7[_0x3d38bb];return _0x2b473d;};'use strict';var _=require('lodash');var util=require(_0x7b4a('0x0'));var moment=require(_0x7b4a('0x1'));var BPromise=require('bluebird');var rs=require(_0x7b4a('0x2'));var fs=require('fs');var Redis=require(_0x7b4a('0x3'));var db=require(_0x7b4a('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x7b4a('0x5'))(_0x7b4a('0x6'));var config=require(_0x7b4a('0x7'));var jayson=require(_0x7b4a('0x8'));var client=jayson[_0x7b4a('0x9')][_0x7b4a('0xa')]({'port':0x232a});config[_0x7b4a('0xb')]=_[_0x7b4a('0xc')](config[_0x7b4a('0xb')],{'host':_0x7b4a('0xd'),'port':0x18eb});var socket=require(_0x7b4a('0xe'))(new Redis(config[_0x7b4a('0xb')]));require('./openchannelAccount.socket')[_0x7b4a('0xf')](socket);function respondWithRpcPromise(_0xbc0fd6,_0x729f4f,_0x402b47){return new BPromise(function(_0x2ee580,_0x3724cc){return client['request'](_0xbc0fd6,_0x402b47)['then'](function(_0x2d6f5b){logger[_0x7b4a('0x10')](_0x7b4a('0x11'),_0x729f4f,'request\x20sent');logger['debug']('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x729f4f,'request\x20sent',JSON[_0x7b4a('0x12')](_0x2d6f5b));if(_0x2d6f5b[_0x7b4a('0x13')]){if(_0x2d6f5b[_0x7b4a('0x13')]['code']===0x1f4){logger[_0x7b4a('0x13')](_0x7b4a('0x11'),_0x729f4f,_0x2d6f5b[_0x7b4a('0x13')][_0x7b4a('0x14')]);return _0x3724cc(_0x2d6f5b[_0x7b4a('0x13')]['message']);}logger[_0x7b4a('0x13')](_0x7b4a('0x11'),_0x729f4f,_0x2d6f5b['error'][_0x7b4a('0x14')]);return _0x2ee580(_0x2d6f5b[_0x7b4a('0x13')][_0x7b4a('0x14')]);}else{logger[_0x7b4a('0x10')](_0x7b4a('0x11'),_0x729f4f,_0x7b4a('0x15'));_0x2ee580(_0x2d6f5b[_0x7b4a('0x16')]['message']);}})[_0x7b4a('0x17')](function(_0x2e3ece){logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x729f4f,_0x2e3ece);_0x3724cc(_0x2e3ece);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 0a54489..27f98fa 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 _0xcba4=['emit','register','length','openchannelAccount:','save','remove','update'];(function(_0x17ac5b,_0x1a2d16){var _0x2dcec9=function(_0x4bbe8d){while(--_0x4bbe8d){_0x17ac5b['push'](_0x17ac5b['shift']());}};_0x2dcec9(++_0x1a2d16);}(_0xcba4,0xe4));var _0x4cba=function(_0x5933ab,_0x596b26){_0x5933ab=_0x5933ab-0x0;var _0x4734df=_0xcba4[_0x5933ab];return _0x4734df;};'use strict';var OpenchannelAccountEvents=require('./openchannelAccount.events');var events=[_0x4cba('0x0'),_0x4cba('0x1'),_0x4cba('0x2')];function createListener(_0x41075e,_0x3c4469){return function(_0x39f45f){_0x3c4469[_0x4cba('0x3')](_0x41075e,_0x39f45f);};}function removeListener(_0xe5e04a,_0x7af0de){return function(){OpenchannelAccountEvents['removeListener'](_0xe5e04a,_0x7af0de);};}exports[_0x4cba('0x4')]=function(_0x5d4203){for(var _0x1acf1e=0x0,_0x28a3e6=events[_0x4cba('0x5')];_0x1acf1e<_0x28a3e6;_0x1acf1e++){var _0x8cdf8c=events[_0x1acf1e];var _0x373e18=createListener(_0x4cba('0x6')+_0x8cdf8c,_0x5d4203);OpenchannelAccountEvents['on'](_0x8cdf8c,_0x373e18);}}; \ No newline at end of file +var _0xefd6=['remove','update','emit','removeListener','register','length','openchannelAccount:'];(function(_0x16dc15,_0x5188db){var _0x58da19=function(_0x12f660){while(--_0x12f660){_0x16dc15['push'](_0x16dc15['shift']());}};_0x58da19(++_0x5188db);}(_0xefd6,0xe0));var _0x6efd=function(_0x49d49d,_0x55d7a7){_0x49d49d=_0x49d49d-0x0;var _0x20787a=_0xefd6[_0x49d49d];return _0x20787a;};'use strict';var OpenchannelAccountEvents=require('./openchannelAccount.events');var events=['save',_0x6efd('0x0'),_0x6efd('0x1')];function createListener(_0x30d0ca,_0x1919dc){return function(_0x4331fd){_0x1919dc[_0x6efd('0x2')](_0x30d0ca,_0x4331fd);};}function removeListener(_0x43486d,_0x5009b7){return function(){OpenchannelAccountEvents[_0x6efd('0x3')](_0x43486d,_0x5009b7);};}exports[_0x6efd('0x4')]=function(_0x5e35c){for(var _0x599a53=0x0,_0x2573bc=events[_0x6efd('0x5')];_0x599a53<_0x2573bc;_0x599a53++){var _0x3db897=events[_0x599a53];var _0x163216=createListener(_0x6efd('0x6')+_0x3db897,_0x5e35c);OpenchannelAccountEvents['on'](_0x3db897,_0x163216);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 3057960..f0c0e66 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 _0x3e72=['express','Router','../../components/interaction/service','./openchannelApplication.controller','get','isAuthenticated','/:id','show','post','create','put','delete','destroy','exports','multer','util','path'];(function(_0x1b6828,_0x240c5c){var _0x14e66f=function(_0x49a0f0){while(--_0x49a0f0){_0x1b6828['push'](_0x1b6828['shift']());}};_0x14e66f(++_0x240c5c);}(_0x3e72,0x140));var _0x23e7=function(_0x53afe9,_0x2c9f40){_0x53afe9=_0x53afe9-0x0;var _0x396396=_0x3e72[_0x53afe9];return _0x396396;};'use strict';var multer=require(_0x23e7('0x0'));var util=require(_0x23e7('0x1'));var path=require(_0x23e7('0x2'));var timeout=require('connect-timeout');var express=require(_0x23e7('0x3'));var router=express[_0x23e7('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x23e7('0x5'));var config=require('../../config/environment');var controller=require(_0x23e7('0x6'));router[_0x23e7('0x7')]('/',auth[_0x23e7('0x8')](),controller['index']);router['get'](_0x23e7('0x9'),auth[_0x23e7('0x8')](),controller[_0x23e7('0xa')]);router[_0x23e7('0xb')]('/',auth[_0x23e7('0x8')](),controller[_0x23e7('0xc')]);router[_0x23e7('0xd')](_0x23e7('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x23e7('0xe')](_0x23e7('0x9'),auth['isAuthenticated'](),controller[_0x23e7('0xf')]);module[_0x23e7('0x10')]=router; \ No newline at end of file +var _0x06db=['../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','get','isAuthenticated','index','/:id','show','put','update','delete','destroy','exports','multer','util','express','Router'];(function(_0x1dac7a,_0x1828ce){var _0x4cb363=function(_0x80f6de){while(--_0x80f6de){_0x1dac7a['push'](_0x1dac7a['shift']());}};_0x4cb363(++_0x1828ce);}(_0x06db,0xd4));var _0xb06d=function(_0x2cd916,_0xf4572d){_0x2cd916=_0x2cd916-0x0;var _0x4eaa40=_0x06db[_0x2cd916];return _0x4eaa40;};'use strict';var multer=require(_0xb06d('0x0'));var util=require(_0xb06d('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb06d('0x2'));var router=express[_0xb06d('0x3')]();var auth=require(_0xb06d('0x4'));var interaction=require(_0xb06d('0x5'));var config=require(_0xb06d('0x6'));var controller=require(_0xb06d('0x7'));router[_0xb06d('0x8')]('/',auth[_0xb06d('0x9')](),controller[_0xb06d('0xa')]);router[_0xb06d('0x8')](_0xb06d('0xb'),auth[_0xb06d('0x9')](),controller[_0xb06d('0xc')]);router['post']('/',auth[_0xb06d('0x9')](),controller['create']);router[_0xb06d('0xd')](_0xb06d('0xb'),auth[_0xb06d('0x9')](),controller[_0xb06d('0xe')]);router[_0xb06d('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xb06d('0x10')]);module[_0xb06d('0x11')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index feaa71c..437c293 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 _0xde83=['*,*,*,*','sequelize','INTEGER','STRING','noop','TEXT'];(function(_0x408753,_0x5176e1){var _0x1ba6f1=function(_0x2ed00d){while(--_0x2ed00d){_0x408753['push'](_0x408753['shift']());}};_0x1ba6f1(++_0x5176e1);}(_0xde83,0x1e1));var _0x3de8=function(_0x350182,_0x2a9feb){_0x350182=_0x350182-0x0;var _0x4a0892=_0xde83[_0x350182];return _0x4a0892;};'use strict';var Sequelize=require(_0x3de8('0x0'));module['exports']={'priority':{'type':Sequelize[_0x3de8('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x3de8('0x2')],'allowNull':![],'defaultValue':_0x3de8('0x3')},'appdata':{'type':Sequelize[_0x3de8('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x3de8('0x2')],'defaultValue':_0x3de8('0x5')}}; \ No newline at end of file +var _0xd2c1=['*,*,*,*','exports','INTEGER','STRING','noop','TEXT'];(function(_0x118740,_0x18a399){var _0x21aac5=function(_0x412175){while(--_0x412175){_0x118740['push'](_0x118740['shift']());}};_0x21aac5(++_0x18a399);}(_0xd2c1,0x91));var _0x1d2c=function(_0x12f688,_0x585c25){_0x12f688=_0x12f688-0x0;var _0x59c3de=_0xd2c1[_0x12f688];return _0x59c3de;};'use strict';var Sequelize=require('sequelize');module[_0x1d2c('0x0')]={'priority':{'type':Sequelize[_0x1d2c('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x1d2c('0x2')],'allowNull':![],'defaultValue':_0x1d2c('0x3')},'appdata':{'type':Sequelize[_0x1d2c('0x4')]()},'description':{'type':Sequelize[_0x1d2c('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x1d2c('0x5')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index 056a124..9440cd4 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 _0x15cd=['params','find','create','update','body','zip-dir','fast-json-patch','request-promise','moment','mustache','util','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','json','count','offset','limit','status','Content-Range','apply','reject','then','destroy','error','stack','name','send','index','map','OpenchannelApplication','rawAttributes','type','key','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','options','includeAll','include','catch','show'];(function(_0xdd827a,_0x482ad2){var _0x2f46f1=function(_0x221046){while(--_0x221046){_0xdd827a['push'](_0xdd827a['shift']());}};_0x2f46f1(++_0x482ad2);}(_0x15cd,0xd4));var _0xd15c=function(_0x57645b,_0x25f73a){_0x57645b=_0x57645b-0x0;var _0xe82f00=_0x15cd[_0x57645b];return _0xe82f00;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xd15c('0x0'));var jsonpatch=require(_0xd15c('0x1'));var rp=require(_0xd15c('0x2'));var moment=require(_0xd15c('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xd15c('0x4'));var util=require(_0xd15c('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0xd15c('0x6'));var ejs=require(_0xd15c('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0xd15c('0x8'));var crypto=require(_0xd15c('0x9'));var jsforce=require(_0xd15c('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xd15c('0x6'));var querystring=require(_0xd15c('0xb'));var Papa=require(_0xd15c('0xc'));var Redis=require(_0xd15c('0xd'));var authService=require(_0xd15c('0xe'));var qs=require(_0xd15c('0xf'));var as=require(_0xd15c('0x10'));var hardwareService=require(_0xd15c('0x11'));var logger=require(_0xd15c('0x12'))(_0xd15c('0x13'));var utils=require(_0xd15c('0x14'));var config=require(_0xd15c('0x15'));var db=require(_0xd15c('0x16'))['db'];function respondWithStatusCode(_0x8f3a5b,_0xa09ca6){_0xa09ca6=_0xa09ca6||0xcc;return function(_0x18fafc){if(_0x18fafc){return _0x8f3a5b[_0xd15c('0x17')](_0xa09ca6);}return _0x8f3a5b['status'](_0xa09ca6)['end']();};}function respondWithResult(_0x388f95,_0x6c5ea3){_0x6c5ea3=_0x6c5ea3||0xc8;return function(_0x4225b8){if(_0x4225b8){return _0x388f95['status'](_0x6c5ea3)[_0xd15c('0x18')](_0x4225b8);}};}function respondWithFilteredResult(_0xc5d37d,_0x2b28a4){return function(_0x452e60){if(_0x452e60){var _0x3faaa6=_0x452e60[_0xd15c('0x19')],_0x38f8c0=_0x2b28a4[_0xd15c('0x1a')],_0x5124e3=_0x2b28a4[_0xd15c('0x1a')]+_0x2b28a4[_0xd15c('0x1b')],_0x4bc850;if(_0x5124e3>=_0x3faaa6){_0x5124e3=_0x3faaa6;_0x4bc850=0xc8;}else{_0x4bc850=0xce;}_0xc5d37d[_0xd15c('0x1c')](_0x4bc850);return _0xc5d37d['set'](_0xd15c('0x1d'),_0x38f8c0+'-'+_0x5124e3+'/'+_0x3faaa6)[_0xd15c('0x18')](_0x452e60);}return null;};}function patchUpdates(_0x13153a){return function(_0x520629){try{jsonpatch[_0xd15c('0x1e')](_0x520629,_0x13153a,!![]);}catch(_0x321813){return BPromise[_0xd15c('0x1f')](_0x321813);}return _0x520629['save']();};}function saveUpdates(_0x420f27,_0x132010){return function(_0x5dcba0){if(_0x5dcba0){return _0x5dcba0['update'](_0x420f27)[_0xd15c('0x20')](function(_0x4c9a53){return _0x4c9a53;});}return null;};}function removeEntity(_0x170b81,_0x2e9f79){return function(_0x14fe62){if(_0x14fe62){return _0x14fe62[_0xd15c('0x21')]()[_0xd15c('0x20')](function(){_0x170b81[_0xd15c('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x427218,_0x4b3677){return function(_0x28505f){if(!_0x28505f){_0x427218['sendStatus'](0x194);}return _0x28505f;};}function handleError(_0x32cb9e,_0x683267){_0x683267=_0x683267||0x1f4;return function(_0x46de0a){logger[_0xd15c('0x22')](_0x46de0a[_0xd15c('0x23')]);if(_0x46de0a['name']){delete _0x46de0a[_0xd15c('0x24')];}_0x32cb9e['status'](_0x683267)[_0xd15c('0x25')](_0x46de0a);};}exports[_0xd15c('0x26')]=function(_0x2dc24d,_0x1d11b8){var _0x552cc2={},_0x3c40e9={},_0x424480={'count':0x0,'rows':[]};var _0x663877=_[_0xd15c('0x27')](db[_0xd15c('0x28')][_0xd15c('0x29')],function(_0x1b527e){return{'name':_0x1b527e['fieldName'],'type':_0x1b527e[_0xd15c('0x2a')][_0xd15c('0x2b')]};});_0x3c40e9[_0xd15c('0x2c')]=_[_0xd15c('0x27')](_0x663877,_0xd15c('0x24'));_0x3c40e9['query']=_[_0xd15c('0x2d')](_0x2dc24d[_0xd15c('0x2e')]);_0x3c40e9['filters']=_[_0xd15c('0x2f')](_0x3c40e9['model'],_0x3c40e9[_0xd15c('0x2e')]);_0x552cc2['attributes']=_[_0xd15c('0x2f')](_0x3c40e9['model'],qs['fields'](_0x2dc24d['query'][_0xd15c('0x30')]));_0x552cc2[_0xd15c('0x31')]=_0x552cc2['attributes'][_0xd15c('0x32')]?_0x552cc2[_0xd15c('0x31')]:_0x3c40e9['model'];if(!_0x2dc24d[_0xd15c('0x2e')][_0xd15c('0x33')](_0xd15c('0x34'))){_0x552cc2[_0xd15c('0x1b')]=qs[_0xd15c('0x1b')](_0x2dc24d['query'][_0xd15c('0x1b')]);_0x552cc2['offset']=qs[_0xd15c('0x1a')](_0x2dc24d[_0xd15c('0x2e')][_0xd15c('0x1a')]);}_0x552cc2['order']=qs[_0xd15c('0x35')](_0x2dc24d[_0xd15c('0x2e')][_0xd15c('0x35')]);_0x552cc2[_0xd15c('0x36')]=qs[_0xd15c('0x37')](_[_0xd15c('0x38')](_0x2dc24d[_0xd15c('0x2e')],_0x3c40e9[_0xd15c('0x37')]));if(_0x2dc24d['query'][_0xd15c('0x39')]){_0x552cc2[_0xd15c('0x36')]=_[_0xd15c('0x3a')](_0x552cc2['where'],{'$or':_[_0xd15c('0x27')](_0x663877,function(_0x562a39){if(_0x562a39[_0xd15c('0x2a')]!=='VIRTUAL'){var _0x5c3229={};_0x5c3229[_0x562a39['name']]={'$like':'%'+_0x2dc24d[_0xd15c('0x2e')]['filter']+'%'};return _0x5c3229;}})});}_0x552cc2=_['merge']({},_0x552cc2,_0x2dc24d[_0xd15c('0x3b')]);var _0x20b41c={'where':_0x552cc2['where']};return db['OpenchannelApplication'][_0xd15c('0x19')](_0x20b41c)[_0xd15c('0x20')](function(_0x222e4a){_0x424480[_0xd15c('0x19')]=_0x222e4a;if(_0x2dc24d[_0xd15c('0x2e')][_0xd15c('0x3c')]){_0x552cc2[_0xd15c('0x3d')]=[{'all':!![]}];}return db[_0xd15c('0x28')]['findAll'](_0x552cc2);})[_0xd15c('0x20')](function(_0x25a18e){_0x424480['rows']=_0x25a18e;return _0x424480;})[_0xd15c('0x20')](respondWithFilteredResult(_0x1d11b8,_0x552cc2))[_0xd15c('0x3e')](handleError(_0x1d11b8,null));};exports[_0xd15c('0x3f')]=function(_0x2cacea,_0x3aeff6){var _0x5ac946={'raw':!![],'where':{'id':_0x2cacea[_0xd15c('0x40')]['id']}},_0x546d03={};_0x546d03[_0xd15c('0x2c')]=_[_0xd15c('0x2d')](db[_0xd15c('0x28')][_0xd15c('0x29')]);_0x546d03[_0xd15c('0x2e')]=_[_0xd15c('0x2d')](_0x2cacea[_0xd15c('0x2e')]);_0x546d03['filters']=_['intersection'](_0x546d03[_0xd15c('0x2c')],_0x546d03[_0xd15c('0x2e')]);_0x5ac946[_0xd15c('0x31')]=_[_0xd15c('0x2f')](_0x546d03[_0xd15c('0x2c')],qs['fields'](_0x2cacea[_0xd15c('0x2e')]['fields']));_0x5ac946[_0xd15c('0x31')]=_0x5ac946[_0xd15c('0x31')][_0xd15c('0x32')]?_0x5ac946[_0xd15c('0x31')]:_0x546d03['model'];if(_0x2cacea['query'][_0xd15c('0x3c')]){_0x5ac946[_0xd15c('0x3d')]=[{'all':!![]}];}_0x5ac946=_[_0xd15c('0x3a')]({},_0x5ac946,_0x2cacea[_0xd15c('0x3b')]);return db[_0xd15c('0x28')][_0xd15c('0x41')](_0x5ac946)[_0xd15c('0x20')](handleEntityNotFound(_0x3aeff6,null))[_0xd15c('0x20')](respondWithResult(_0x3aeff6,null))[_0xd15c('0x3e')](handleError(_0x3aeff6,null));};exports[_0xd15c('0x42')]=function(_0xf3346d,_0x5373f4){return db[_0xd15c('0x28')][_0xd15c('0x42')](_0xf3346d['body'],{})['then'](respondWithResult(_0x5373f4,0xc9))[_0xd15c('0x3e')](handleError(_0x5373f4,null));};exports[_0xd15c('0x43')]=function(_0x3304ba,_0x8afe3d){if(_0x3304ba[_0xd15c('0x44')]['id']){delete _0x3304ba[_0xd15c('0x44')]['id'];}return db[_0xd15c('0x28')][_0xd15c('0x41')]({'where':{'id':_0x3304ba[_0xd15c('0x40')]['id']}})[_0xd15c('0x20')](handleEntityNotFound(_0x8afe3d,null))['then'](saveUpdates(_0x3304ba['body'],null))[_0xd15c('0x20')](respondWithResult(_0x8afe3d,null))[_0xd15c('0x3e')](handleError(_0x8afe3d,null));};exports[_0xd15c('0x21')]=function(_0x707491,_0x5ac4e5){return db[_0xd15c('0x28')][_0xd15c('0x41')]({'where':{'id':_0x707491['params']['id']}})[_0xd15c('0x20')](handleEntityNotFound(_0x5ac4e5,null))[_0xd15c('0x20')](removeEntity(_0x5ac4e5,null))[_0xd15c('0x3e')](handleError(_0x5ac4e5,null));}; \ No newline at end of file +var _0xa66d=['rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','catch','params','intersection','length','find','body','update','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','save','then','destroy','stack','name','send','index','map','OpenchannelApplication'];(function(_0x14dfd6,_0x392fa4){var _0x36c19a=function(_0x453179){while(--_0x453179){_0x14dfd6['push'](_0x14dfd6['shift']());}};_0x36c19a(++_0x392fa4);}(_0xa66d,0x66));var _0xda66=function(_0x501509,_0x534984){_0x501509=_0x501509-0x0;var _0x40a053=_0xa66d[_0x501509];return _0x40a053;};'use strict';var pdf=require(_0xda66('0x0'));var emlformat=require(_0xda66('0x1'));var rimraf=require(_0xda66('0x2'));var zipdir=require(_0xda66('0x3'));var jsonpatch=require(_0xda66('0x4'));var rp=require(_0xda66('0x5'));var moment=require(_0xda66('0x6'));var BPromise=require(_0xda66('0x7'));var Mustache=require(_0xda66('0x8'));var util=require('util');var path=require('path');var sox=require(_0xda66('0x9'));var csv=require(_0xda66('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xda66('0xb'));var squel=require(_0xda66('0xc'));var crypto=require('crypto');var jsforce=require(_0xda66('0xd'));var deskjs=require(_0xda66('0xe'));var toCsv=require(_0xda66('0xa'));var querystring=require(_0xda66('0xf'));var Papa=require('papaparse');var Redis=require(_0xda66('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xda66('0x11'));var as=require(_0xda66('0x12'));var hardwareService=require(_0xda66('0x13'));var logger=require(_0xda66('0x14'))(_0xda66('0x15'));var utils=require(_0xda66('0x16'));var config=require(_0xda66('0x17'));var db=require(_0xda66('0x18'))['db'];function respondWithStatusCode(_0x39040f,_0x281030){_0x281030=_0x281030||0xcc;return function(_0x378921){if(_0x378921){return _0x39040f[_0xda66('0x19')](_0x281030);}return _0x39040f['status'](_0x281030)[_0xda66('0x1a')]();};}function respondWithResult(_0x69d547,_0x744bf8){_0x744bf8=_0x744bf8||0xc8;return function(_0x2db59e){if(_0x2db59e){return _0x69d547[_0xda66('0x1b')](_0x744bf8)[_0xda66('0x1c')](_0x2db59e);}};}function respondWithFilteredResult(_0x1ea5bb,_0x1cc837){return function(_0x17c376){if(_0x17c376){var _0x4d1364=_0x17c376[_0xda66('0x1d')],_0x197299=_0x1cc837[_0xda66('0x1e')],_0x2b2786=_0x1cc837['offset']+_0x1cc837[_0xda66('0x1f')],_0x2b8512;if(_0x2b2786>=_0x4d1364){_0x2b2786=_0x4d1364;_0x2b8512=0xc8;}else{_0x2b8512=0xce;}_0x1ea5bb[_0xda66('0x1b')](_0x2b8512);return _0x1ea5bb[_0xda66('0x20')](_0xda66('0x21'),_0x197299+'-'+_0x2b2786+'/'+_0x4d1364)[_0xda66('0x1c')](_0x17c376);}return null;};}function patchUpdates(_0x3b81da){return function(_0x3b30b1){try{jsonpatch[_0xda66('0x22')](_0x3b30b1,_0x3b81da,!![]);}catch(_0x2d1634){return BPromise['reject'](_0x2d1634);}return _0x3b30b1[_0xda66('0x23')]();};}function saveUpdates(_0x1c16f5,_0xfc977c){return function(_0x180c89){if(_0x180c89){return _0x180c89['update'](_0x1c16f5)[_0xda66('0x24')](function(_0x8c2286){return _0x8c2286;});}return null;};}function removeEntity(_0x43da01,_0x4ca513){return function(_0xeff5de){if(_0xeff5de){return _0xeff5de[_0xda66('0x25')]()['then'](function(){_0x43da01[_0xda66('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5167a3,_0x563698){return function(_0x202b87){if(!_0x202b87){_0x5167a3[_0xda66('0x19')](0x194);}return _0x202b87;};}function handleError(_0xc69357,_0x5684fa){_0x5684fa=_0x5684fa||0x1f4;return function(_0x24fe0a){logger['error'](_0x24fe0a[_0xda66('0x26')]);if(_0x24fe0a[_0xda66('0x27')]){delete _0x24fe0a[_0xda66('0x27')];}_0xc69357[_0xda66('0x1b')](_0x5684fa)[_0xda66('0x28')](_0x24fe0a);};}exports[_0xda66('0x29')]=function(_0x4aa65f,_0x3fce30){var _0x5c2615={},_0x2a45d4={},_0x38dee7={'count':0x0,'rows':[]};var _0x1c410a=_[_0xda66('0x2a')](db[_0xda66('0x2b')][_0xda66('0x2c')],function(_0x9608a7){return{'name':_0x9608a7[_0xda66('0x2d')],'type':_0x9608a7[_0xda66('0x2e')][_0xda66('0x2f')]};});_0x2a45d4[_0xda66('0x30')]=_[_0xda66('0x2a')](_0x1c410a,'name');_0x2a45d4[_0xda66('0x31')]=_[_0xda66('0x32')](_0x4aa65f[_0xda66('0x31')]);_0x2a45d4[_0xda66('0x33')]=_['intersection'](_0x2a45d4['model'],_0x2a45d4['query']);_0x5c2615[_0xda66('0x34')]=_['intersection'](_0x2a45d4[_0xda66('0x30')],qs[_0xda66('0x35')](_0x4aa65f[_0xda66('0x31')][_0xda66('0x35')]));_0x5c2615['attributes']=_0x5c2615[_0xda66('0x34')]['length']?_0x5c2615[_0xda66('0x34')]:_0x2a45d4['model'];if(!_0x4aa65f[_0xda66('0x31')][_0xda66('0x36')](_0xda66('0x37'))){_0x5c2615[_0xda66('0x1f')]=qs[_0xda66('0x1f')](_0x4aa65f[_0xda66('0x31')]['limit']);_0x5c2615[_0xda66('0x1e')]=qs['offset'](_0x4aa65f[_0xda66('0x31')]['offset']);}_0x5c2615[_0xda66('0x38')]=qs[_0xda66('0x39')](_0x4aa65f[_0xda66('0x31')][_0xda66('0x39')]);_0x5c2615[_0xda66('0x3a')]=qs[_0xda66('0x33')](_[_0xda66('0x3b')](_0x4aa65f[_0xda66('0x31')],_0x2a45d4['filters']));if(_0x4aa65f[_0xda66('0x31')]['filter']){_0x5c2615['where']=_[_0xda66('0x3c')](_0x5c2615[_0xda66('0x3a')],{'$or':_['map'](_0x1c410a,function(_0x44e39e){if(_0x44e39e[_0xda66('0x2e')]!==_0xda66('0x3d')){var _0x4d551e={};_0x4d551e[_0x44e39e['name']]={'$like':'%'+_0x4aa65f[_0xda66('0x31')][_0xda66('0x3e')]+'%'};return _0x4d551e;}})});}_0x5c2615=_[_0xda66('0x3c')]({},_0x5c2615,_0x4aa65f[_0xda66('0x3f')]);var _0x3d8655={'where':_0x5c2615[_0xda66('0x3a')]};return db[_0xda66('0x2b')][_0xda66('0x1d')](_0x3d8655)[_0xda66('0x24')](function(_0x1219a6){_0x38dee7[_0xda66('0x1d')]=_0x1219a6;if(_0x4aa65f['query'][_0xda66('0x40')]){_0x5c2615[_0xda66('0x41')]=[{'all':!![]}];}return db[_0xda66('0x2b')]['findAll'](_0x5c2615);})['then'](function(_0x41e7a9){_0x38dee7['rows']=_0x41e7a9;return _0x38dee7;})[_0xda66('0x24')](respondWithFilteredResult(_0x3fce30,_0x5c2615))[_0xda66('0x42')](handleError(_0x3fce30,null));};exports['show']=function(_0x4e9378,_0x3c70cb){var _0x5e02f8={'raw':!![],'where':{'id':_0x4e9378[_0xda66('0x43')]['id']}},_0x11f56c={};_0x11f56c[_0xda66('0x30')]=_['keys'](db['OpenchannelApplication'][_0xda66('0x2c')]);_0x11f56c[_0xda66('0x31')]=_[_0xda66('0x32')](_0x4e9378[_0xda66('0x31')]);_0x11f56c[_0xda66('0x33')]=_[_0xda66('0x44')](_0x11f56c[_0xda66('0x30')],_0x11f56c['query']);_0x5e02f8[_0xda66('0x34')]=_[_0xda66('0x44')](_0x11f56c[_0xda66('0x30')],qs[_0xda66('0x35')](_0x4e9378[_0xda66('0x31')][_0xda66('0x35')]));_0x5e02f8[_0xda66('0x34')]=_0x5e02f8[_0xda66('0x34')][_0xda66('0x45')]?_0x5e02f8['attributes']:_0x11f56c[_0xda66('0x30')];if(_0x4e9378['query'][_0xda66('0x40')]){_0x5e02f8['include']=[{'all':!![]}];}_0x5e02f8=_[_0xda66('0x3c')]({},_0x5e02f8,_0x4e9378[_0xda66('0x3f')]);return db[_0xda66('0x2b')][_0xda66('0x46')](_0x5e02f8)[_0xda66('0x24')](handleEntityNotFound(_0x3c70cb,null))[_0xda66('0x24')](respondWithResult(_0x3c70cb,null))['catch'](handleError(_0x3c70cb,null));};exports['create']=function(_0x462b80,_0x4fc5de){return db['OpenchannelApplication']['create'](_0x462b80[_0xda66('0x47')],{})[_0xda66('0x24')](respondWithResult(_0x4fc5de,0xc9))[_0xda66('0x42')](handleError(_0x4fc5de,null));};exports[_0xda66('0x48')]=function(_0x2a7ea4,_0x422430){if(_0x2a7ea4[_0xda66('0x47')]['id']){delete _0x2a7ea4[_0xda66('0x47')]['id'];}return db[_0xda66('0x2b')][_0xda66('0x46')]({'where':{'id':_0x2a7ea4['params']['id']}})['then'](handleEntityNotFound(_0x422430,null))[_0xda66('0x24')](saveUpdates(_0x2a7ea4[_0xda66('0x47')],null))[_0xda66('0x24')](respondWithResult(_0x422430,null))['catch'](handleError(_0x422430,null));};exports['destroy']=function(_0x2b6213,_0x217f3c){return db[_0xda66('0x2b')]['find']({'where':{'id':_0x2b6213[_0xda66('0x43')]['id']}})['then'](handleEntityNotFound(_0x217f3c,null))[_0xda66('0x24')](removeEntity(_0x217f3c,null))[_0xda66('0x42')](handleError(_0x217f3c,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index cb8ef1d..732b976 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 _0xf88b=['../../config/environment','./openchannelApplication.attributes','exports','OpenchannelApplication','openchannel_applications','utf8mb4','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x5e9817,_0xa29439){var _0x25b437=function(_0x46851b){while(--_0x46851b){_0x5e9817['push'](_0x5e9817['shift']());}};_0x25b437(++_0xa29439);}(_0xf88b,0x68));var _0xbf88=function(_0x360819,_0x5557f9){_0x360819=_0x360819-0x0;var _0x5a1c45=_0xf88b[_0x360819];return _0x5a1c45;};'use strict';var _=require(_0xbf88('0x0'));var util=require('util');var logger=require(_0xbf88('0x1'))(_0xbf88('0x2'));var moment=require(_0xbf88('0x3'));var BPromise=require(_0xbf88('0x4'));var rp=require(_0xbf88('0x5'));var fs=require('fs');var path=require(_0xbf88('0x6'));var rimraf=require(_0xbf88('0x7'));var config=require(_0xbf88('0x8'));var attributes=require(_0xbf88('0x9'));module[_0xbf88('0xa')]=function(_0x1e60ef,_0x58afef){return _0x1e60ef['define'](_0xbf88('0xb'),attributes,{'tableName':_0xbf88('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xbf88('0xd'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xd2c8=['OpenchannelApplication','openchannel_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','exports','define'];(function(_0x2a1bc2,_0x4ad4b9){var _0x2ca785=function(_0x481a6a){while(--_0x481a6a){_0x2a1bc2['push'](_0x2a1bc2['shift']());}};_0x2ca785(++_0x4ad4b9);}(_0xd2c8,0x1e0));var _0x8d2c=function(_0x579bc0,_0x34c0cc){_0x579bc0=_0x579bc0-0x0;var _0x379218=_0xd2c8[_0x579bc0];return _0x379218;};'use strict';var _=require(_0x8d2c('0x0'));var util=require(_0x8d2c('0x1'));var logger=require(_0x8d2c('0x2'))(_0x8d2c('0x3'));var moment=require('moment');var BPromise=require(_0x8d2c('0x4'));var rp=require(_0x8d2c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8d2c('0x6'));var config=require(_0x8d2c('0x7'));var attributes=require('./openchannelApplication.attributes');module[_0x8d2c('0x8')]=function(_0x5f5677,_0x40f5c0){return _0x5f5677[_0x8d2c('0x9')](_0x8d2c('0xa'),attributes,{'tableName':_0x8d2c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x8d2c('0xc'),'collate':_0x8d2c('0xd')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index 4033500..d3d5cd3 100644 --- a/server/api/openchannelApplication/openchannelApplication.rpc.js +++ b/server/api/openchannelApplication/openchannelApplication.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['OpenchannelApplication','body','options','raw','where','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateOpenchannelApplication'];(function(_0x46361e,_0x243aaf){var _0x14e302=function(_0x9ebecf){while(--_0x9ebecf){_0x46361e['push'](_0x46361e['shift']());}};_0x14e302(++_0x243aaf);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0d8b('0x2'));var db=require(_0x0d8b('0x3'))['db'];var utils=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0d8b('0x7')][_0x0d8b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x39f43a,_0x4a4470,_0x413284){return new BPromise(function(_0x284169,_0x58e4e2){return client[_0x0d8b('0x9')](_0x39f43a,_0x413284)[_0x0d8b('0xa')](function(_0x3b027f){logger[_0x0d8b('0xb')](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));logger[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x4a4470,'request\x20sent',JSON[_0x0d8b('0x10')](_0x3b027f));if(_0x3b027f['error']){if(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x12')]===0x1f4){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x58e4e2(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x284169(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}else{logger['info'](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));_0x284169(_0x3b027f[_0x0d8b('0x14')][_0x0d8b('0x13')]);}})[_0x0d8b('0x15')](function(_0x5cd485){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x5cd485);_0x58e4e2(_0x5cd485);});});}exports[_0x0d8b('0x16')]=function(_0x5fecbd){var _0x333674=this;return new Promise(function(_0x18dd2d,_0x264b39){return db[_0x0d8b('0x17')]['update'](_0x5fecbd[_0x0d8b('0x18')],{'raw':_0x5fecbd[_0x0d8b('0x19')]?_0x5fecbd[_0x0d8b('0x19')][_0x0d8b('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5fecbd[_0x0d8b('0x19')]?_0x5fecbd[_0x0d8b('0x19')][_0x0d8b('0x1b')]||null:null,'attributes':_0x5fecbd[_0x0d8b('0x19')]?_0x5fecbd['options']['attributes']||null:null,'limit':_0x5fecbd[_0x0d8b('0x19')]?_0x5fecbd['options']['limit']||null:null})['then'](function(_0x238728){logger[_0x0d8b('0xb')](_0x0d8b('0x16'),_0x5fecbd);logger[_0x0d8b('0xe')](_0x0d8b('0x16'),_0x5fecbd,JSON[_0x0d8b('0x10')](_0x238728));_0x18dd2d(_0x238728);})[_0x0d8b('0x15')](function(_0x4562cb){logger[_0x0d8b('0x11')]('UpdateOpenchannelApplication',_0x4562cb[_0x0d8b('0x13')],_0x5fecbd);_0x264b39(_0x333674[_0x0d8b('0x11')](0x1f4,_0x4562cb['message']));});});}; \ No newline at end of file +var _0xd8b0=['OpenchannelApplication','body','options','raw','where','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateOpenchannelApplication'];(function(_0xf168d3,_0x43dcfc){var _0x17fb54=function(_0x3d9674){while(--_0x3d9674){_0xf168d3['push'](_0xf168d3['shift']());}};_0x17fb54(++_0x43dcfc);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0d8b('0x2'));var db=require(_0x0d8b('0x3'))['db'];var utils=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0d8b('0x7')][_0x0d8b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x39f43a,_0x4a4470,_0x413284){return new BPromise(function(_0x284169,_0x58e4e2){return client[_0x0d8b('0x9')](_0x39f43a,_0x413284)[_0x0d8b('0xa')](function(_0x3b027f){logger[_0x0d8b('0xb')](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));logger[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x4a4470,'request\x20sent',JSON[_0x0d8b('0x10')](_0x3b027f));if(_0x3b027f['error']){if(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x12')]===0x1f4){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x58e4e2(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x284169(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}else{logger['info'](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));_0x284169(_0x3b027f[_0x0d8b('0x14')][_0x0d8b('0x13')]);}})[_0x0d8b('0x15')](function(_0x5cd485){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x5cd485);_0x58e4e2(_0x5cd485);});});}exports[_0x0d8b('0x16')]=function(_0x5fecbd){var _0x333674=this;return new Promise(function(_0x18dd2d,_0x264b39){return db[_0x0d8b('0x17')]['update'](_0x5fecbd[_0x0d8b('0x18')],{'raw':_0x5fecbd[_0x0d8b('0x19')]?_0x5fecbd[_0x0d8b('0x19')][_0x0d8b('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5fecbd[_0x0d8b('0x19')]?_0x5fecbd[_0x0d8b('0x19')][_0x0d8b('0x1b')]||null:null,'attributes':_0x5fecbd[_0x0d8b('0x19')]?_0x5fecbd['options']['attributes']||null:null,'limit':_0x5fecbd[_0x0d8b('0x19')]?_0x5fecbd['options']['limit']||null:null})['then'](function(_0x238728){logger[_0x0d8b('0xb')](_0x0d8b('0x16'),_0x5fecbd);logger[_0x0d8b('0xe')](_0x0d8b('0x16'),_0x5fecbd,JSON[_0x0d8b('0x10')](_0x238728));_0x18dd2d(_0x238728);})[_0x0d8b('0x15')](function(_0x4562cb){logger[_0x0d8b('0x11')]('UpdateOpenchannelApplication',_0x4562cb[_0x0d8b('0x13')],_0x5fecbd);_0x264b39(_0x333674[_0x0d8b('0x11')](0x1f4,_0x4562cb['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index d80153d..a2afe5b 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 _0x4789=['../../config/environment','./openchannelInteraction.controller','get','index','/describe','isAuthenticated','describe','/:id','show','getMessages','/:id/download','download','create','post','addMessage','/:id/tags','tracked','openchannel','addTags','put','openchannelinteraction:update','delete','openchannelinteraction:destroy','removeTags','exports','multer','util','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x4789,0x19f));var _0x9478=function(_0x2a3c4d,_0x9c6b37){_0x2a3c4d=_0x2a3c4d-0x0;var _0x55c390=_0x4789[_0x2a3c4d];return _0x55c390;};'use strict';var multer=require(_0x9478('0x0'));var util=require(_0x9478('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x9478('0x2')]();var auth=require(_0x9478('0x3'));var interaction=require(_0x9478('0x4'));var config=require(_0x9478('0x5'));var controller=require(_0x9478('0x6'));router[_0x9478('0x7')]('/',auth['isAuthenticated'](),controller[_0x9478('0x8')]);router[_0x9478('0x7')](_0x9478('0x9'),auth[_0x9478('0xa')](),controller[_0x9478('0xb')]);router[_0x9478('0x7')](_0x9478('0xc'),auth['isAuthenticated'](),controller[_0x9478('0xd')]);router[_0x9478('0x7')]('/:id/messages',auth[_0x9478('0xa')](),controller[_0x9478('0xe')]);router[_0x9478('0x7')](_0x9478('0xf'),auth['isAuthenticated'](),controller[_0x9478('0x10')]);router['post']('/',auth[_0x9478('0xa')](),controller[_0x9478('0x11')]);router[_0x9478('0x12')]('/:id/messages',auth['isAuthenticated'](),controller[_0x9478('0x13')]);router['post'](_0x9478('0x14'),auth[_0x9478('0xa')](),interaction[_0x9478('0x15')](_0x9478('0x16'),'openchannelinteraction:addtags'),controller[_0x9478('0x17')]);router[_0x9478('0x18')](_0x9478('0xc'),auth['isAuthenticated'](),interaction[_0x9478('0x15')]('openchannel',_0x9478('0x19')),controller['update']);router[_0x9478('0x1a')]('/:id',auth[_0x9478('0xa')](),interaction[_0x9478('0x15')](_0x9478('0x16'),_0x9478('0x1b')),controller['destroy']);router['delete'](_0x9478('0x14'),auth[_0x9478('0xa')](),controller[_0x9478('0x1c')]);module[_0x9478('0x1d')]=router; \ No newline at end of file +var _0x593d=['/:id/tags','tracked','openchannel','openchannelinteraction:addtags','addTags','put','openchannelinteraction:update','update','delete','destroy','removeTags','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','create','post','addMessage'];(function(_0x1d94d1,_0x347bb8){var _0x23c397=function(_0x489441){while(--_0x489441){_0x1d94d1['push'](_0x1d94d1['shift']());}};_0x23c397(++_0x347bb8);}(_0x593d,0x108));var _0xd593=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x593d[_0x432682];return _0x463d05;};'use strict';var multer=require(_0xd593('0x0'));var util=require(_0xd593('0x1'));var path=require(_0xd593('0x2'));var timeout=require(_0xd593('0x3'));var express=require(_0xd593('0x4'));var router=express[_0xd593('0x5')]();var auth=require(_0xd593('0x6'));var interaction=require(_0xd593('0x7'));var config=require(_0xd593('0x8'));var controller=require(_0xd593('0x9'));router[_0xd593('0xa')]('/',auth[_0xd593('0xb')](),controller[_0xd593('0xc')]);router['get'](_0xd593('0xd'),auth[_0xd593('0xb')](),controller[_0xd593('0xe')]);router['get'](_0xd593('0xf'),auth[_0xd593('0xb')](),controller[_0xd593('0x10')]);router[_0xd593('0xa')](_0xd593('0x11'),auth['isAuthenticated'](),controller[_0xd593('0x12')]);router[_0xd593('0xa')](_0xd593('0x13'),auth[_0xd593('0xb')](),controller[_0xd593('0x14')]);router['post']('/',auth[_0xd593('0xb')](),controller[_0xd593('0x15')]);router[_0xd593('0x16')]('/:id/messages',auth[_0xd593('0xb')](),controller[_0xd593('0x17')]);router[_0xd593('0x16')](_0xd593('0x18'),auth[_0xd593('0xb')](),interaction[_0xd593('0x19')](_0xd593('0x1a'),_0xd593('0x1b')),controller[_0xd593('0x1c')]);router[_0xd593('0x1d')](_0xd593('0xf'),auth[_0xd593('0xb')](),interaction[_0xd593('0x19')](_0xd593('0x1a'),_0xd593('0x1e')),controller[_0xd593('0x1f')]);router[_0xd593('0x20')]('/:id',auth[_0xd593('0xb')](),interaction[_0xd593('0x19')](_0xd593('0x1a'),'openchannelinteraction:destroy'),controller[_0xd593('0x21')]);router[_0xd593('0x20')]('/:id/tags',auth[_0xd593('0xb')](),controller[_0xd593('0x22')]);module[_0xd593('0x23')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index 9d02662..1b14cec 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 _0x76d6=['DATE','ENUM','sequelize','BOOLEAN','STRING'];(function(_0x31784c,_0x1cf34c){var _0x4af226=function(_0x2a98f0){while(--_0x2a98f0){_0x31784c['push'](_0x31784c['shift']());}};_0x4af226(++_0x1cf34c);}(_0x76d6,0x192));var _0x676d=function(_0x46eca1,_0x4ca010){_0x46eca1=_0x46eca1-0x0;var _0x3b5b16=_0x76d6[_0x46eca1];return _0x3b5b16;};'use strict';var Sequelize=require(_0x676d('0x0'));module['exports']={'closed':{'type':Sequelize[_0x676d('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x676d('0x2')]},'note':{'type':Sequelize[_0x676d('0x2')]},'read1stAt':{'type':Sequelize[_0x676d('0x3')]},'threadId':{'type':Sequelize['STRING']},'externalUrl':{'type':Sequelize[_0x676d('0x2')]},'lastMsgAt':{'type':Sequelize[_0x676d('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x676d('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x676d('0x2')]}}; \ No newline at end of file +var _0xc987=['STRING','out','sequelize','BOOLEAN','DATE'];(function(_0x474bc0,_0x26989c){var _0x4b24cf=function(_0x4be866){while(--_0x4be866){_0x474bc0['push'](_0x474bc0['shift']());}};_0x4b24cf(++_0x26989c);}(_0xc987,0x98));var _0x7c98=function(_0x269ee8,_0x477226){_0x269ee8=_0x269ee8-0x0;var _0x4d98bd=_0xc987[_0x269ee8];return _0x4d98bd;};'use strict';var Sequelize=require(_0x7c98('0x0'));module['exports']={'closed':{'type':Sequelize[_0x7c98('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x7c98('0x2')]},'disposition':{'type':Sequelize[_0x7c98('0x3')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x7c98('0x2')]},'threadId':{'type':Sequelize[_0x7c98('0x3')]},'externalUrl':{'type':Sequelize['STRING']},'lastMsgAt':{'type':Sequelize[_0x7c98('0x2')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x7c98('0x4')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x7c98('0x3')]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index 31df45a..7ecf782 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 _0x614f=['createWriteStream','System','out','renderFile','views','downloadInteraction.html','toFile','.pdf','log','err','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','sendStatus','end','status','offset','set','json','apply','reject','save','update','destroy','then','error','stack','name','Users','map','fullname','TagIds','split','forEach','catch','index','rawAttributes','key','model','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','field','color','from','tools_tags','select','u.id','u.fullname','ui.OpenchannelInteractionId','left_join','u.id\x20=\x20ui.UserId','openchannel_interactions','cm_contacts','openchannel_accounts','openchannel_messages','me.OpenchannelInteractionId\x20=\x20i.id','openchannel_interaction_has_tags','it.OpenchannelInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','find','unreadMessages','value','`\x20=\x200','having','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','ContactId','buildExpression','type','text','start','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','body','keys','some','isEmpty','OpenchannelAccountId','i.OpenchannelAccountId\x20IN\x20?','concat','createdAt','$gte','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','tag','isArray','filter','replace','isNumeric','i.from\x20LIKE\x20?','group','Sequelize','QueryTypes','SELECT','clone','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','t.id\x20IN\x20?','resolve','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','sequelize','toString','count','keyBy','OpenchannelInteraction','a.key','a.mandatoryDisposition','i.*','c.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','ui.OpenchannelInteractionId\x20IN\x20?','all','rows','show','fields','includeAll','include','merge','create','params','describe','OpenchannelMessage','addMessage','ids','omit','getMessages','findOne','format','YYYY-MM-DD\x20HH:mm:ss','options','findAll','addTags','setTags','spread','Tag','openchannelInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','push','firstName','lastName','Attachment','Messages','direction','secret','OpenchannelAccount','mkdirSync','40px','30px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','YYYY-MM-DD','Account','closed','disposition','threadId','Public','Private','basename','existsSync'];(function(_0x39cce9,_0x2bfdfc){var _0x12e796=function(_0x1e7b17){while(--_0x1e7b17){_0x39cce9['push'](_0x39cce9['shift']());}};_0x12e796(++_0x2bfdfc);}(_0x614f,0x1d4));var _0xf614=function(_0x40dfe8,_0x473123){_0x40dfe8=_0x40dfe8-0x0;var _0x2cdc1b=_0x614f[_0x40dfe8];return _0x2cdc1b;};'use strict';var pdf=require(_0xf614('0x0'));var emlformat=require(_0xf614('0x1'));var rimraf=require(_0xf614('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf614('0x3'));var rp=require(_0xf614('0x4'));var moment=require(_0xf614('0x5'));var BPromise=require(_0xf614('0x6'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xf614('0x7'));var csv=require(_0xf614('0x8'));var ejs=require(_0xf614('0x9'));var fs=require('fs');var _=require(_0xf614('0xa'));var squel=require(_0xf614('0xb'));var crypto=require(_0xf614('0xc'));var jsforce=require(_0xf614('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xf614('0x8'));var querystring=require('querystring');var Papa=require(_0xf614('0xe'));var Redis=require(_0xf614('0xf'));var authService=require(_0xf614('0x10'));var qs=require(_0xf614('0x11'));var as=require(_0xf614('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xf614('0x13'));var db=require(_0xf614('0x14'))['db'];config['redis']=_[_0xf614('0x15')](config[_0xf614('0x16')],{'host':_0xf614('0x17'),'port':0x18eb});var socket=require(_0xf614('0x18'))(new Redis(config[_0xf614('0x16')]));require('./openchannelInteraction.socket')[_0xf614('0x19')](socket);function respondWithStatusCode(_0x1a2c44,_0x3caea7){_0x3caea7=_0x3caea7||0xcc;return function(_0x50789d){if(_0x50789d){return _0x1a2c44[_0xf614('0x1a')](_0x3caea7);}return _0x1a2c44['status'](_0x3caea7)[_0xf614('0x1b')]();};}function respondWithResult(_0x137901,_0x2d8df1){_0x2d8df1=_0x2d8df1||0xc8;return function(_0x4ac1db){if(_0x4ac1db){return _0x137901[_0xf614('0x1c')](_0x2d8df1)['json'](_0x4ac1db);}};}function respondWithFilteredResult(_0x324207,_0x1a4571){return function(_0x2db77c){if(_0x2db77c){var _0x267de5=_0x2db77c['count'],_0x269672=_0x1a4571['offset'],_0x319217=_0x1a4571[_0xf614('0x1d')]+_0x1a4571['limit'],_0x23a2e0;if(_0x319217>=_0x267de5){_0x319217=_0x267de5;_0x23a2e0=0xc8;}else{_0x23a2e0=0xce;}_0x324207[_0xf614('0x1c')](_0x23a2e0);return _0x324207[_0xf614('0x1e')]('Content-Range',_0x269672+'-'+_0x319217+'/'+_0x267de5)[_0xf614('0x1f')](_0x2db77c);}return null;};}function patchUpdates(_0x1a83b2){return function(_0x1e0516){try{jsonpatch[_0xf614('0x20')](_0x1e0516,_0x1a83b2,!![]);}catch(_0x2cc707){return BPromise[_0xf614('0x21')](_0x2cc707);}return _0x1e0516[_0xf614('0x22')]();};}function saveUpdates(_0x20d70b,_0x2d603d){return function(_0x5278ef){if(_0x5278ef){return _0x5278ef[_0xf614('0x23')](_0x20d70b)['then'](function(_0x41a8b7){return _0x41a8b7;});}return null;};}function removeEntity(_0x554472,_0x3790e1){return function(_0x270ad1){if(_0x270ad1){return _0x270ad1[_0xf614('0x24')]()[_0xf614('0x25')](function(){_0x554472[_0xf614('0x1c')](0xcc)[_0xf614('0x1b')]();});}};}function handleEntityNotFound(_0x48b2ac,_0x564b75){return function(_0x1df094){if(!_0x1df094){_0x48b2ac['sendStatus'](0x194);}return _0x1df094;};}function handleError(_0x35167e,_0x44a7d9){_0x44a7d9=_0x44a7d9||0x1f4;return function(_0x1832ef){logger[_0xf614('0x26')](_0x1832ef[_0xf614('0x27')]);if(_0x1832ef['name']){delete _0x1832ef[_0xf614('0x28')];}_0x35167e['status'](_0x44a7d9)['send'](_0x1832ef);};}function getInteractionUsers(_0x281bfd,_0x58571f){return new BPromise(function(_0x5ae0bb,_0xdb210c){try{if(_0x58571f[_0x281bfd['id']]){_0x281bfd[_0xf614('0x29')]=_[_0xf614('0x2a')](_0x58571f[_0x281bfd['id']],function(_0x3e1acb){return{'id':_0x3e1acb['id'],'fullname':_0x3e1acb[_0xf614('0x2b')]};});}}catch(_0x25c034){_0xdb210c(_0x25c034);}_0x5ae0bb(_0x281bfd);});}function getInteractionTags(_0x4578c9,_0x343a43){return new BPromise(function(_0x2d232e,_0x266c24){try{if(_0x4578c9[_0xf614('0x2c')]){_0x4578c9['Tags']=[];_0x4578c9[_0xf614('0x2c')][_0xf614('0x2d')](',')[_0xf614('0x2e')](function(_0x17fc32){_0x4578c9['Tags']['push'](_0x343a43[_0x17fc32]);});}delete _0x4578c9[_0xf614('0x2c')];}catch(_0x173d05){_0x266c24(_0x173d05);}_0x2d232e(_0x4578c9);});}function updateOpenchannelInteraction(_0x456896,_0x1e4e53,_0x3899f8){return new BPromise(function(_0xb65767,_0x31ff0b){return getInteractionUsers(_0x456896,_0x3899f8)[_0xf614('0x25')](function(_0x380be7){return getInteractionTags(_0x380be7,_0x1e4e53);})[_0xf614('0x25')](function(_0x3f20af){_0xb65767(_0x3f20af);})[_0xf614('0x2f')](function(_0x50573d){_0x31ff0b(_0x50573d);});});}exports[_0xf614('0x30')]=function(_0x44c0a6,_0xf31848){var _0x46b757={},_0x1ea442={},_0xaf5fa7={'count':0x0,'rows':[]};var _0x308060=_[_0xf614('0x2a')](db['OpenchannelInteraction'][_0xf614('0x31')],function(_0x1384d3){return{'name':_0x1384d3['fieldName'],'type':_0x1384d3['type'][_0xf614('0x32')]};});_0x1ea442[_0xf614('0x33')]=_[_0xf614('0x2a')](_0x308060,_0xf614('0x28'));_0x1ea442[_0xf614('0x34')]=_['keys'](_0x44c0a6['query']);_0x1ea442[_0xf614('0x35')]=_[_0xf614('0x36')](_0x1ea442[_0xf614('0x33')],_0x1ea442['query']);_0x46b757['attributes']=_[_0xf614('0x36')](_0x1ea442[_0xf614('0x33')],qs['fields'](_0x44c0a6['query']['fields']));_0x46b757[_0xf614('0x37')]=_0x46b757[_0xf614('0x37')][_0xf614('0x38')]?_0x46b757['attributes']:_0x1ea442[_0xf614('0x33')];if(!_0x44c0a6['query'][_0xf614('0x39')](_0xf614('0x3a'))){_0x46b757[_0xf614('0x3b')]=qs[_0xf614('0x3b')](_0x44c0a6[_0xf614('0x34')][_0xf614('0x3b')]);_0x46b757[_0xf614('0x1d')]=qs[_0xf614('0x1d')](_0x44c0a6[_0xf614('0x34')][_0xf614('0x1d')]);}_0x46b757[_0xf614('0x3c')]=qs[_0xf614('0x3d')](_0x44c0a6[_0xf614('0x34')][_0xf614('0x3d')]);_0x46b757[_0xf614('0x3e')]=qs[_0xf614('0x35')](_[_0xf614('0x3f')](_0x44c0a6[_0xf614('0x34')],_0x1ea442[_0xf614('0x35')]));var _0xce6f5e=[];var _0x803ca9=squel['select']()[_0xf614('0x40')]('id')[_0xf614('0x40')](_0xf614('0x28'))['field'](_0xf614('0x41'))[_0xf614('0x42')](_0xf614('0x43'));var _0x9073b8=squel[_0xf614('0x44')]()[_0xf614('0x40')](_0xf614('0x45'))[_0xf614('0x40')](_0xf614('0x46'))[_0xf614('0x40')](_0xf614('0x47'))[_0xf614('0x42')]('user_has_openchannel_interactions','ui')[_0xf614('0x48')]('users','u',_0xf614('0x49'));var _0x221593=squel[_0xf614('0x44')]()[_0xf614('0x42')](_0xf614('0x4a'),'i')[_0xf614('0x48')](_0xf614('0x4b'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0xf614('0x48')]('users','o','o.id\x20=\x20i.UserId')['left_join'](_0xf614('0x4c'),'a','a.id\x20=\x20i.OpenchannelAccountId')[_0xf614('0x48')](_0xf614('0x4d'),'me',_0xf614('0x4e'))[_0xf614('0x48')](_0xf614('0x4f'),'it',_0xf614('0x50'))['left_join']('tools_tags','t',_0xf614('0x51'));var _0x3b5f46=squel[_0xf614('0x52')]();var _0x52b18e=[];var _0x475932=squel[_0xf614('0x52')]();var _0x2c409a;if(_0x44c0a6[_0xf614('0x34')][_0xf614('0x53')]){_0x2c409a=as['parseSearch'](_0x44c0a6[_0xf614('0x34')][_0xf614('0x53')]);var _0x2c9675=_0x2c409a[_0xf614('0x54')];for(var _0x5a4dfc=0x0;_0x5a4dfc<_0x2c409a['conditions']['length'];_0x5a4dfc++){var _0x734d66=_0x2c409a[_0xf614('0x55')][_0x5a4dfc];var _0x403635='i';var _0x24bb0f=_[_0xf614('0x56')](_0x308060,[_0xf614('0x28'),_0x734d66[_0xf614('0x40')]]);if(!_0x24bb0f){switch(_0x734d66['field']){case _0xf614('0x57'):if(_0x734d66[_0xf614('0x58')]==0x1){_0x221593['having']('`'+_0x734d66[_0xf614('0x40')]+_0xf614('0x59'));}else{_0x221593[_0xf614('0x5a')]('`'+_0x734d66[_0xf614('0x40')]+_0xf614('0x5b'));}break;case _0xf614('0x5c'):if(_0x734d66[_0xf614('0x5d')]===_0xf614('0x5e')){if(_0x734d66[_0xf614('0x58')][_0xf614('0x2d')]('\x20')[_0xf614('0x38')]>0x1){_0x3b5f46[_0x2c9675](_0xf614('0x5f'),qs[_0xf614('0x60')](_0x734d66['value']),null);}else{var _0x1a94e4='%'+_0x734d66[_0xf614('0x58')]+'%';_0x3b5f46[_0x2c9675]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x1a94e4,_0x1a94e4,_0x1a94e4);}}else{_0x24bb0f=_['find'](_0x308060,[_0xf614('0x28'),_0xf614('0x61')]);_0x734d66[_0xf614('0x40')]=_0xf614('0x61');_0x1535cc=as[_0xf614('0x62')](_0x403635,_0x24bb0f[_0xf614('0x63')],_0x734d66);_0x3b5f46[_0x2c9675](_0x1535cc[_0xf614('0x64')],_0x1535cc[_0xf614('0x58')][_0xf614('0x65')],_0x1535cc[_0xf614('0x58')][_0xf614('0x1b')]);}break;case'Tag':var _0x45eea4=_0x734d66[_0xf614('0x58')]['split'](',')['map'](function(_0x34c4b0){return Number(_0x34c4b0);});_0x45eea4[_0xf614('0x2e')](function(_0x28f049){_0x475932['or'](_0xf614('0x66'),'%,'+_0x28f049+',%');});_0x52b18e=_[_0xf614('0x67')](_0x52b18e,_0x45eea4);break;case _0xf614('0x68'):if(_0x734d66[_0xf614('0x5d')]===_0xf614('0x5e')){_0x3b5f46[_0x2c9675]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x734d66[_0xf614('0x58')]+'%',null);}else{_0x24bb0f=_[_0xf614('0x56')](_0x308060,['name','UserId']);_0x734d66['field']='UserId';_0x1535cc=as['buildExpression'](_0x403635,_0x24bb0f[_0xf614('0x63')],_0x734d66);_0x3b5f46[_0x2c9675](_0x1535cc['text'],_0x1535cc['value'][_0xf614('0x65')],_0x1535cc['value'][_0xf614('0x1b')]);}break;case _0xf614('0x69'):_0x1535cc=as[_0xf614('0x62')]('me',null,_0x734d66);_0x3b5f46[_0x2c9675](_0x1535cc[_0xf614('0x64')],_0x1535cc['value'][_0xf614('0x65')],_0x1535cc['value'][_0xf614('0x1b')]);break;}}else{var _0x1535cc=as[_0xf614('0x62')](_0x403635,_0x24bb0f['type'],_0x734d66);_0x3b5f46[_0x2c9675](_0x1535cc['text'],_0x1535cc['value'][_0xf614('0x65')],_0x1535cc[_0xf614('0x58')][_0xf614('0x1b')]);}}}else{var _0x494c1c=_(_0x44c0a6[_0xf614('0x34')])[_0xf614('0x6a')]()['map'](function(_0x24a307){return _[_0xf614('0x6b')](_0x308060,[_0xf614('0x28'),_0x24a307])?_0x24a307:undefined;})['compact']()[_0xf614('0x58')]();if(!_[_0xf614('0x6c')](_0x494c1c)){_0x494c1c[_0xf614('0x2e')](function(_0x419ff8){if(_0x419ff8===_0xf614('0x6d')){_0x221593[_0xf614('0x3e')](_0xf614('0x6e'),[][_0xf614('0x6f')](_0x44c0a6[_0xf614('0x34')][_0x419ff8]));}else if(_0x419ff8===_0xf614('0x70')){var _0x252b29=JSON['parse'](_0x44c0a6[_0xf614('0x34')][_0x419ff8])[_0xf614('0x71')];var _0x1a0928=JSON[_0xf614('0x72')](_0x44c0a6[_0xf614('0x34')][_0x419ff8])[_0xf614('0x73')];_0x221593[_0xf614('0x3e')](_0xf614('0x74'),_0x252b29,_0x1a0928);}else{if(_0x44c0a6['query'][_0x419ff8]===_0xf614('0x75')){_0x221593[_0xf614('0x3e')]('i.'+_0x419ff8+_0xf614('0x76'));}else{_0x221593[_0xf614('0x3e')]('i.'+_0x419ff8+_0xf614('0x77'),_0x44c0a6[_0xf614('0x34')][_0x419ff8]);}}});}if(_0x44c0a6[_0xf614('0x34')][_0xf614('0x78')]){if(_0x44c0a6[_0xf614('0x34')]['read']==0x1){_0x221593[_0xf614('0x5a')](_0xf614('0x79'));}else{_0x221593[_0xf614('0x5a')]('`unreadMessages`\x20>\x200');}}if(_0x44c0a6[_0xf614('0x34')][_0xf614('0x7a')]){_0x52b18e=_[_0xf614('0x7b')](_0x44c0a6[_0xf614('0x34')][_0xf614('0x7a')])?_0x44c0a6[_0xf614('0x34')][_0xf614('0x7a')]:new Array(_0x44c0a6[_0xf614('0x34')][_0xf614('0x7a')]);_0x52b18e[_0xf614('0x2e')](function(_0x462ee5){_0x475932['or'](_0xf614('0x66'),'%,'+_0x462ee5+',%');});}if(_0x44c0a6[_0xf614('0x34')][_0xf614('0x7c')]){var _0x286089=_0x44c0a6['query'][_0xf614('0x7c')]['replace']('\x5c','\x5c\x5c')[_0xf614('0x7d')]('\x27\x27','\x27\x27\x27\x27');if(qs[_0xf614('0x7e')](_0x286089)){_0x3b5f46['or']('i.id\x20LIKE\x20?',_0x286089+'%');}else{_0x3b5f46['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xf614('0x60')](_0x286089))['or'](_0xf614('0x7f'),_0x286089+'%')['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x286089+'%');}}}_0x221593[_0xf614('0x3e')](_0x3b5f46);_0x221593[_0xf614('0x80')]('i.id');var _0x5eb3f0={'type':db[_0xf614('0x81')][_0xf614('0x82')][_0xf614('0x83')],'raw':!![]};var _0x13a6e8=_0x221593[_0xf614('0x84')]();_0x13a6e8[_0xf614('0x40')](_0xf614('0x85'));_0x13a6e8['field'](_0xf614('0x86'),_0xf614('0x57'));if(_0x46b757[_0xf614('0x3c')]){_0x46b757[_0xf614('0x3c')]['forEach'](function(_0x37953c){_0x221593['order']('i.'+_0x37953c[0x0],_0x37953c[0x1]===_0xf614('0x87')?![]:!![]);});}if(!_[_0xf614('0x6c')](_0x52b18e)){_0x221593[_0xf614('0x5a')](_0x475932);_0x13a6e8[_0xf614('0x3e')](_0xf614('0x88'),_0x52b18e);}BPromise[_0xf614('0x89')]()['then'](function(){if(!_0x2c409a){if(_0x44c0a6['query']['OpenchannelAccountId']||_0x44c0a6[_0xf614('0x34')]['journey'])return;_0x13a6e8[_0xf614('0x3e')](_0xf614('0x8a'));_0x221593[_0xf614('0x3e')](_0xf614('0x8a'));return;}return _0x44c0a6['user'][_0xf614('0x8b')]({'attributes':['id'],'raw':!![]})[_0xf614('0x25')](function(_0x5c8b4c){if(_[_0xf614('0x6c')](_0x5c8b4c)){_0x13a6e8['where']('i.OpenchannelAccountId\x20IS\x20NULL');_0x221593[_0xf614('0x3e')](_0xf614('0x8c'));}else{_0x13a6e8[_0xf614('0x3e')](_0xf614('0x6e'),_[_0xf614('0x2a')](_0x5c8b4c,'id'));_0x221593[_0xf614('0x3e')](_0xf614('0x6e'),_[_0xf614('0x2a')](_0x5c8b4c,'id'));}});})['then'](function(){db[_0xf614('0x8d')][_0xf614('0x34')](_0x13a6e8[_0xf614('0x8e')](),_0x5eb3f0)[_0xf614('0x25')](function(_0x349218){_0xaf5fa7[_0xf614('0x8f')]=_0x349218[_0xf614('0x38')];if(_0xaf5fa7[_0xf614('0x8f')]===0x0)return[];return db['sequelize'][_0xf614('0x34')](_0x803ca9['toString'](),_0x5eb3f0)[_0xf614('0x25')](function(_0x19eb46){_0xce6f5e=_[_0xf614('0x90')](_0x19eb46,'id');_0x5eb3f0=_['merge'](_0x5eb3f0,{'model':db[_0xf614('0x91')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x44c0a6[_0xf614('0x34')]['fields']){_0x46b757[_0xf614('0x37')]['forEach'](function(_0x411eeb){_0x221593[_0xf614('0x40')]('i.'+_0x411eeb);});}else{_0x221593[_0xf614('0x40')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xf614('0x57'));_0x221593[_0xf614('0x40')](_0xf614('0x92'),'Account.key');_0x221593[_0xf614('0x40')](_0xf614('0x93'),'Account.mandatoryDisposition');_0x221593['field'](_0xf614('0x94'));_0x221593['field'](_0xf614('0x95'),'Contact.firstName');_0x221593['field'](_0xf614('0x96'),_0xf614('0x97'));_0x221593[_0xf614('0x40')](_0xf614('0x98'),_0xf614('0x99'));_0x221593['field'](_0xf614('0x9a'),'Contact.phone');_0x221593[_0xf614('0x40')](_0xf614('0x9b'),_0xf614('0x9c'));_0x221593[_0xf614('0x40')](_0xf614('0x9d'),_0xf614('0x9e'));_0x221593[_0xf614('0x40')](_0xf614('0x9f'),_0xf614('0xa0'));_0x221593['field'](_0xf614('0xa1'),'Owner.internal');_0x221593['field']('GROUP_CONCAT(DISTINCT\x20t.id)',_0xf614('0x2c'));}_0x221593['limit'](_0x46b757[_0xf614('0x3b')]);_0x221593[_0xf614('0x1d')](_0x46b757['offset']);return db[_0xf614('0x8d')][_0xf614('0x34')](_0x221593[_0xf614('0x8e')](),_0x5eb3f0);})[_0xf614('0x25')](function(_0x5afe87){_0x9073b8[_0xf614('0x3e')](_0xf614('0xa2'),_[_0xf614('0x2a')](_0x5afe87,'id'));return db[_0xf614('0x8d')][_0xf614('0x34')](_0x9073b8['toString'](),_0x5eb3f0)[_0xf614('0x25')](function(_0x4e3e79){var _0x2ed0be=_['groupBy'](_0x4e3e79,'OpenchannelInteractionId');var _0x204141=[];_0x5afe87[_0xf614('0x2e')](function(_0x2e9cca){_0x204141['push'](updateOpenchannelInteraction(_0x2e9cca,_0xce6f5e,_0x2ed0be));});return BPromise[_0xf614('0xa3')](_0x204141);});});})['then'](function(_0x40716a){_0xaf5fa7[_0xf614('0xa4')]=_0x40716a;return _0xaf5fa7;})['then'](respondWithFilteredResult(_0xf31848,_0x46b757));})[_0xf614('0x2f')](handleError(_0xf31848,null));};exports[_0xf614('0xa5')]=function(_0x1d0c92,_0x54a55b){var _0x54fc7f={'raw':![],'where':{'id':_0x1d0c92['params']['id']}},_0x78ec6c={};_0x78ec6c[_0xf614('0x33')]=_['keys'](db[_0xf614('0x91')]['rawAttributes']);_0x78ec6c[_0xf614('0x34')]=_[_0xf614('0x6a')](_0x1d0c92[_0xf614('0x34')]);_0x78ec6c[_0xf614('0x35')]=_[_0xf614('0x36')](_0x78ec6c['model'],_0x78ec6c[_0xf614('0x34')]);_0x54fc7f['attributes']=_[_0xf614('0x36')](_0x78ec6c[_0xf614('0x33')],qs[_0xf614('0xa6')](_0x1d0c92[_0xf614('0x34')][_0xf614('0xa6')]));_0x54fc7f[_0xf614('0x37')]=_0x54fc7f['attributes'][_0xf614('0x38')]?_0x54fc7f['attributes']:_0x78ec6c[_0xf614('0x33')];if(_0x1d0c92[_0xf614('0x34')][_0xf614('0xa7')]){_0x54fc7f[_0xf614('0xa8')]=[{'all':!![]}];}_0x54fc7f=_[_0xf614('0xa9')]({},_0x54fc7f,_0x1d0c92['options']);return db[_0xf614('0x91')]['find'](_0x54fc7f)[_0xf614('0x25')](handleEntityNotFound(_0x54a55b,null))['then'](respondWithResult(_0x54a55b,null))['catch'](handleError(_0x54a55b,null));};exports[_0xf614('0xaa')]=function(_0x55bcc3,_0x8fb17a){return db[_0xf614('0x91')]['create'](_0x55bcc3['body'],{})[_0xf614('0x25')](respondWithResult(_0x8fb17a,0xc9))[_0xf614('0x2f')](handleError(_0x8fb17a,null));};exports[_0xf614('0x23')]=function(_0x25ad8a,_0x5d688f){if(_0x25ad8a['body']['id']){delete _0x25ad8a[_0xf614('0x69')]['id'];}return db[_0xf614('0x91')][_0xf614('0x56')]({'where':{'id':_0x25ad8a['params']['id']}})[_0xf614('0x25')](handleEntityNotFound(_0x5d688f,null))['then'](saveUpdates(_0x25ad8a[_0xf614('0x69')],null))[_0xf614('0x25')](respondWithResult(_0x5d688f,null))[_0xf614('0x2f')](handleError(_0x5d688f,null));};exports['destroy']=function(_0x2e8428,_0x59c809){return db['OpenchannelInteraction']['find']({'where':{'id':_0x2e8428[_0xf614('0xab')]['id']}})[_0xf614('0x25')](handleEntityNotFound(_0x59c809,null))['then'](removeEntity(_0x59c809,null))[_0xf614('0x2f')](handleError(_0x59c809,null));};exports[_0xf614('0xac')]=function(_0x568bd0,_0x11a881){return db[_0xf614('0x91')][_0xf614('0xac')]()['then'](respondWithResult(_0x11a881,null))['catch'](handleError(_0x11a881,null));};exports['addMessage']=function(_0x5a887c,_0x4dba6b,_0x54ad91){return db[_0xf614('0xad')][_0xf614('0x56')]({'where':{'id':_0x5a887c[_0xf614('0xab')]['id']}})['then'](handleEntityNotFound(_0x4dba6b,null))[_0xf614('0x25')](function(_0x5f0040){if(_0x5f0040){return _0x5f0040[_0xf614('0xae')](_0x5a887c[_0xf614('0x69')][_0xf614('0xaf')],_[_0xf614('0xb0')](_0x5a887c[_0xf614('0x69')],[_0xf614('0xaf'),'id'])||{});}})[_0xf614('0x25')](respondWithResult(_0x4dba6b,null))[_0xf614('0x2f')](handleError(_0x4dba6b,null));};exports[_0xf614('0xb1')]=function(_0x140b05,_0x201c88,_0x14b668){var _0x35a5da={'raw':![],'where':{}};var _0x4332a0={};var _0x250bec={'count':0x0,'rows':[]};return db[_0xf614('0x91')][_0xf614('0xb2')]({'where':{'id':_0x140b05[_0xf614('0xab')]['id']}})[_0xf614('0x25')](handleEntityNotFound(_0x201c88,null))[_0xf614('0x25')](function(_0x328a7e){if(_0x328a7e){_0x4332a0[_0xf614('0x33')]=_['keys'](db[_0xf614('0xad')][_0xf614('0x31')]);_0x4332a0['query']=_[_0xf614('0x6a')](_0x140b05[_0xf614('0x34')]);_0x4332a0[_0xf614('0x35')]=_[_0xf614('0x36')](_0x4332a0['model'],_0x4332a0[_0xf614('0x34')]);_0x35a5da[_0xf614('0x37')]=_['intersection'](_0x4332a0[_0xf614('0x33')],qs['fields'](_0x140b05[_0xf614('0x34')][_0xf614('0xa6')]));_0x35a5da[_0xf614('0x37')]=_0x35a5da[_0xf614('0x37')][_0xf614('0x38')]?_0x35a5da[_0xf614('0x37')]:_0x4332a0['model'];if(!_0x140b05['query'][_0xf614('0x39')](_0xf614('0x3a'))){_0x35a5da['limit']=qs[_0xf614('0x3b')](_0x140b05[_0xf614('0x34')][_0xf614('0x3b')]);_0x35a5da[_0xf614('0x1d')]=qs['offset'](_0x140b05[_0xf614('0x34')][_0xf614('0x1d')]);}_0x35a5da[_0xf614('0x3c')]=qs['sort'](_0x140b05[_0xf614('0x34')][_0xf614('0x3d')]);_0x35a5da['where']=qs[_0xf614('0x35')](_[_0xf614('0x3f')](_0x140b05[_0xf614('0x34')],_0x4332a0[_0xf614('0x35')]));_0x35a5da[_0xf614('0x3e')]['OpenchannelInteractionId']=_0x328a7e['id'];if(_0x140b05[_0xf614('0x34')]['filter']){_0x35a5da[_0xf614('0x3e')]=_[_0xf614('0xa9')](_0x35a5da[_0xf614('0x3e')],{'$or':_[_0xf614('0x2a')](_0x35a5da[_0xf614('0x37')],function(_0x545f29){var _0xa93d0a={};_0xa93d0a[_0x545f29]={'$like':'%'+_0x140b05[_0xf614('0x34')]['filter']+'%'};return _0xa93d0a;})});}if(_0x140b05[_0xf614('0x34')][_0xf614('0x71')]){var _0x2e8f99=_0x140b05[_0xf614('0x34')][_0xf614('0x71')]['split'](',');var _0x342113={};_0x342113[_0x2e8f99[0x0]]={'$gte':moment(_0x2e8f99[0x1])[_0xf614('0xb3')](_0xf614('0xb4'))};_0x35a5da[_0xf614('0x3e')]=_[_0xf614('0xa9')](_0x35a5da[_0xf614('0x3e')],_0x342113);}_0x35a5da=_[_0xf614('0xa9')]({},_0x35a5da,_0x140b05[_0xf614('0xb5')]);return db[_0xf614('0xad')]['count']({'where':_0x35a5da[_0xf614('0x3e')]})[_0xf614('0x25')](function(_0x16786d){_0x250bec['count']=_0x16786d;if(_0x140b05[_0xf614('0x34')][_0xf614('0xa7')]){_0x35a5da[_0xf614('0xa8')]=[{'all':!![]}];}return db[_0xf614('0xad')][_0xf614('0xb6')](_0x35a5da);})['then'](function(_0x487625){_0x250bec[_0xf614('0xa4')]=_0x487625;return _0x250bec;});}})[_0xf614('0x25')](respondWithFilteredResult(_0x201c88,_0x35a5da))[_0xf614('0x2f')](handleError(_0x201c88,null));};exports[_0xf614('0xb7')]=function(_0xb5f8da,_0x18988d,_0x315b07){return db[_0xf614('0x91')][_0xf614('0x56')]({'where':{'id':_0xb5f8da[_0xf614('0xab')]['id']}})['then'](handleEntityNotFound(_0x18988d,null))[_0xf614('0x25')](function(_0x4eec41){if(_0x4eec41){return _0x4eec41[_0xf614('0xb8')](_0xb5f8da[_0xf614('0x69')][_0xf614('0xaf')],_['omit'](_0xb5f8da[_0xf614('0x69')],[_0xf614('0xaf'),'id'])||{})[_0xf614('0xb9')](function(){return db[_0xf614('0xba')][_0xf614('0xb6')]({'attributes':['id',_0xf614('0x28'),_0xf614('0x41')],'where':{'id':_0xb5f8da[_0xf614('0x69')]['ids']}});})[_0xf614('0x25')](function(_0x3527ea){socket['emit'](_0xf614('0xbb'),{'id':Number(_0xb5f8da[_0xf614('0xab')]['id']),'tags':_0x3527ea||[]});return{'id':Number(_0xb5f8da[_0xf614('0xab')]['id']),'tags':_0x3527ea||[]};});}})[_0xf614('0x25')](respondWithResult(_0x18988d,null))[_0xf614('0x2f')](handleError(_0x18988d,null));};exports[_0xf614('0xbc')]=function(_0x55512a,_0x1c1087,_0x2b90eb){return db[_0xf614('0x91')][_0xf614('0x56')]({'where':{'id':_0x55512a[_0xf614('0xab')]['id']}})[_0xf614('0x25')](handleEntityNotFound(_0x1c1087,null))[_0xf614('0x25')](function(_0x14d4a8){if(_0x14d4a8){return _0x14d4a8[_0xf614('0xbc')](_0x55512a[_0xf614('0x34')][_0xf614('0xaf')]);}})[_0xf614('0x25')](respondWithStatusCode(_0x1c1087,null))[_0xf614('0x2f')](handleError(_0x1c1087,null));};exports[_0xf614('0xbd')]=function(_0x101692,_0x47362f){var _0x392d77=moment()[_0xf614('0xbe')]()[_0xf614('0x8e')]();var _0xbad9bf=path[_0xf614('0xbf')](config[_0xf614('0xc0')],_0xf614('0xc1'),_0xf614('0xc2'),_0xf614('0xc3'));var _0x3498ad=path['join'](config[_0xf614('0xc0')],_0xf614('0xc1'),'files',_0xf614('0xc4'));var _0x3ee00b=path['join'](_0xbad9bf,_0x392d77);var _0x54c351=util[_0xf614('0xb3')](_0xf614('0xc5'),_0x101692['params']['id'],_0x392d77);var _0x53d9e4=path['join'](_0xbad9bf,_0x54c351);var _0x13900a=[];_0x13900a[_0xf614('0xc6')]({'model':db[_0xf614('0x68')],'as':_0xf614('0x68'),'attributes':['id','fullname'],'raw':!![]});_0x13900a[_0xf614('0xc6')]({'model':db['CmContact'],'as':'Contact','attributes':['id',_0xf614('0xc7'),_0xf614('0xc8')],'raw':!![]});if(_0x101692[_0xf614('0x34')][_0xf614('0xc4')]){_0x13900a[_0xf614('0xc6')]({'model':db[_0xf614('0xc9')],'as':_0xf614('0xc9'),'raw':!![]});}var _0xc8ed96=[{'model':db['OpenchannelMessage'],'as':_0xf614('0xca'),'attributes':['id','body',_0xf614('0x70'),_0xf614('0xcb'),_0xf614('0xcc'),'read'],'include':_0x13900a}];_0xc8ed96[_0xf614('0xc6')]({'model':db[_0xf614('0xcd')],'as':'Account','attributes':['id',_0xf614('0x28')]});_0xc8ed96[_0xf614('0xc6')]({'model':db[_0xf614('0x68')],'as':'Owner','attributes':['id',_0xf614('0x2b')]});return db['OpenchannelInteraction'][_0xf614('0x56')]({'where':{'id':_0x101692[_0xf614('0xab')]['id']},'include':_0xc8ed96})[_0xf614('0x25')](handleEntityNotFound(_0x47362f,null))[_0xf614('0x25')](function(_0xabdfe0){if(_0xabdfe0){var _0x1bd46a=_0xabdfe0['get']({'plain':!![]});fs[_0xf614('0xce')](_0x3ee00b);var _0x3d6f9b={'format':'A4','border':'10px','header':{'height':_0xf614('0xcf'),'contents':{'first':'\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20'}},'footer':{'height':_0xf614('0xd0'),'contents':{'default':util[_0xf614('0xb3')](_0xf614('0xd1'),util[_0xf614('0xb3')]('%s\x20#%d','Openchannel',_0x1bd46a['id']),moment()[_0xf614('0xb3')](_0xf614('0xd2'))[_0xf614('0x8e')]())}}};var _0x45d464={'channel':'Openchannel','account':_0x1bd46a[_0xf614('0xd3')][_0xf614('0x28')],'agent':_0x1bd46a['Owner']?_0x1bd46a['Owner']['fullname']:'N.A.','createdAt':moment(_0x1bd46a[_0xf614('0x70')])[_0xf614('0xb3')]('YYYY-MM-DD\x20HH:mm:ss')[_0xf614('0x8e')](),'closedAt':_0x1bd46a[_0xf614('0xd4')]?moment(_0x1bd46a['closedAt'])[_0xf614('0xb3')](_0xf614('0xb4'))[_0xf614('0x8e')]():'','disposition':_0x1bd46a[_0xf614('0xd5')],'visibility':_0x1bd46a[_0xf614('0xd6')]?_0xf614('0xd7'):_0xf614('0xd8'),'messages':_(_0x1bd46a[_0xf614('0xca')])[_0xf614('0x7c')]({'secret':![]})[_0xf614('0x2a')](function(_0x51c68f){if(_0x51c68f['Attachment']){var _0x1cc606=path['join'](_0x3498ad,_0x51c68f[_0xf614('0xc9')][_0xf614('0xd9')]);if(fs[_0xf614('0xda')](_0x1cc606)){fs['createReadStream'](_0x1cc606)['pipe'](fs[_0xf614('0xdb')](path[_0xf614('0xbf')](_0x3ee00b,_0x51c68f[_0xf614('0xc9')][_0xf614('0xd9')])));}}return{'date':moment(_0x51c68f[_0xf614('0x70')])[_0xf614('0xb3')](_0xf614('0xb4'))[_0xf614('0x8e')](),'sender':_0x51c68f[_0xf614('0xcb')]==='out'?_0x51c68f[_0xf614('0x68')]?_0x51c68f[_0xf614('0x68')][_0xf614('0x2b')]:_0xf614('0xdc'):_0x51c68f['Contact'][_0xf614('0xc7')]+(_0x51c68f[_0xf614('0x5c')]['lastName']?'\x20'+_0x51c68f[_0xf614('0x5c')]['lastName']:''),'body':_0x51c68f[_0xf614('0xc9')]?_0x51c68f[_0xf614('0xc9')][_0xf614('0xd9')]:_0x51c68f[_0xf614('0x69')],'direction':_0x51c68f[_0xf614('0xcb')]===_0xf614('0xdd')?'A':'C','secret':_0x51c68f[_0xf614('0xcc')],'read':_0x51c68f[_0xf614('0x78')],'attachment':_0x51c68f['Attachment']};})[_0xf614('0x58')]()};return ejs[_0xf614('0xde')](path['join'](config[_0xf614('0xc0')],_0xf614('0xc1'),_0xf614('0xdf'),_0xf614('0xe0')),{'interaction':_0x45d464})[_0xf614('0x25')](function(_0x2f98a2){return new BPromise(function(_0x364915,_0x117f61){pdf[_0xf614('0xaa')](_0x2f98a2,_0x3d6f9b)[_0xf614('0xe1')](path[_0xf614('0xbf')](_0x3ee00b,'transcript-'+_0x1bd46a['id']+'-'+_0x392d77+_0xf614('0xe2')),function(_0x3b1a09,_0x42ecb0){if(_0x3b1a09)return _0x117f61(_0x3b1a09);_0x364915(_0x42ecb0);});});})[_0xf614('0x25')](function(){return new BPromise(function(_0x20d930,_0xd30cae){zipdir(_0x3ee00b,{'saveTo':_0x53d9e4},function(_0x493321,_0xc6306){if(_0x493321)return _0xd30cae(_0x493321);return _0x20d930(_0xc6306);});})['then'](function(){return new BPromise(function(_0x4c5430,_0x27b9e3){rimraf(_0x3ee00b,function(_0xee41dc){if(_0xee41dc)_0x27b9e3(_0xee41dc);return _0x4c5430();});});})[_0xf614('0x25')](function(){return _0x47362f[_0xf614('0xbd')](_0x53d9e4,_0x54c351,function(_0x21c93b){if(_0x21c93b){console[_0xf614('0xe3')](_0xf614('0xe4'),_0x21c93b);}else{fs['unlinkSync'](_0x53d9e4);}});});});}else{return _0x47362f[_0xf614('0x1a')](0xc8);}})[_0xf614('0x2f')](handleError(_0x47362f,null));}; \ No newline at end of file +var _0xf7c4=['concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20>\x200','isArray','tag','filter','replace','\x27\x27\x27\x27','isNumeric','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','i.from\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','t.id\x20IN\x20?','resolve','OpenchannelAccountId','journey','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','a.key','Account.key','Contact.firstName','c.lastName','Contact.lastName','c.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','Owner.fullname','GROUP_CONCAT(DISTINCT\x20t.id)','ui.OpenchannelInteractionId\x20IN\x20?','groupBy','OpenchannelInteractionId','all','rows','show','rawAttributes','includeAll','create','body','params','describe','addMessage','OpenchannelMessage','ids','omit','getMessages','findOne','format','options','include','addTags','setTags','spread','findAll','emit','removeTags','download','unix','join','root','files','tmp','server','attachments','lastName','Attachment','direction','secret','OpenchannelAccount','Account','Owner','get','mkdirSync','10px','40px','30px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','%s\x20#%d','YYYY-MM-DD','N.A.','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','disposition','threadId','Private','Messages','basename','existsSync','createReadStream','createWriteStream','out','System','Contact','firstName','renderFile','views','downloadInteraction.html','toFile','log','unlinkSync','html-pdf','zip-dir','moment','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','register','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','save','error','stack','name','send','Users','map','fullname','TagIds','Tags','split','push','then','catch','OpenchannelInteraction','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','select','field','color','from','tools_tags','u.id','u.fullname','left_join','users','u.id\x20=\x20ui.UserId','openchannel_interactions','cm_contacts','o.id\x20=\x20i.UserId','a.id\x20=\x20i.OpenchannelAccountId','openchannel_interaction_has_tags','it.OpenchannelInteractionId\x20=\x20i.id','expr','parseSearch','search','sqlOperator','conditions','find','unreadMessages','value','`\x20=\x200','having','`\x20>\x200','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','Tag','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','end','isEmpty','i.OpenchannelAccountId\x20IN\x20?'];(function(_0x563239,_0x2bd1c4){var _0x1471e9=function(_0x3c6ee1){while(--_0x3c6ee1){_0x563239['push'](_0x563239['shift']());}};_0x1471e9(++_0x2bd1c4);}(_0xf7c4,0x167));var _0x4f7c=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0xf7c4[_0x1d9aa0];return _0x226868;};'use strict';var pdf=require(_0x4f7c('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4f7c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x4f7c('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x4f7c('0x3'));var util=require(_0x4f7c('0x4'));var path=require('path');var sox=require(_0x4f7c('0x5'));var csv=require(_0x4f7c('0x6'));var ejs=require(_0x4f7c('0x7'));var fs=require('fs');var _=require(_0x4f7c('0x8'));var squel=require(_0x4f7c('0x9'));var crypto=require(_0x4f7c('0xa'));var jsforce=require(_0x4f7c('0xb'));var deskjs=require(_0x4f7c('0xc'));var toCsv=require(_0x4f7c('0x6'));var querystring=require(_0x4f7c('0xd'));var Papa=require(_0x4f7c('0xe'));var Redis=require(_0x4f7c('0xf'));var authService=require(_0x4f7c('0x10'));var qs=require(_0x4f7c('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4f7c('0x12'));var logger=require(_0x4f7c('0x13'))('api');var utils=require(_0x4f7c('0x14'));var config=require(_0x4f7c('0x15'));var db=require(_0x4f7c('0x16'))['db'];config[_0x4f7c('0x17')]=_[_0x4f7c('0x18')](config[_0x4f7c('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0x4f7c('0x19'))(new Redis(config[_0x4f7c('0x17')]));require('./openchannelInteraction.socket')[_0x4f7c('0x1a')](socket);function respondWithStatusCode(_0x228c88,_0x16b973){_0x16b973=_0x16b973||0xcc;return function(_0x2dbbb1){if(_0x2dbbb1){return _0x228c88[_0x4f7c('0x1b')](_0x16b973);}return _0x228c88[_0x4f7c('0x1c')](_0x16b973)['end']();};}function respondWithResult(_0x35452c,_0x2e15b5){_0x2e15b5=_0x2e15b5||0xc8;return function(_0x3334d0){if(_0x3334d0){return _0x35452c[_0x4f7c('0x1c')](_0x2e15b5)[_0x4f7c('0x1d')](_0x3334d0);}};}function respondWithFilteredResult(_0x4aeb71,_0x33cc9e){return function(_0x236302){if(_0x236302){var _0x5883e9=_0x236302[_0x4f7c('0x1e')],_0x573057=_0x33cc9e[_0x4f7c('0x1f')],_0x4a9c24=_0x33cc9e[_0x4f7c('0x1f')]+_0x33cc9e[_0x4f7c('0x20')],_0x35a32b;if(_0x4a9c24>=_0x5883e9){_0x4a9c24=_0x5883e9;_0x35a32b=0xc8;}else{_0x35a32b=0xce;}_0x4aeb71[_0x4f7c('0x1c')](_0x35a32b);return _0x4aeb71[_0x4f7c('0x21')](_0x4f7c('0x22'),_0x573057+'-'+_0x4a9c24+'/'+_0x5883e9)[_0x4f7c('0x1d')](_0x236302);}return null;};}function patchUpdates(_0x47184a){return function(_0x7587fa){try{jsonpatch[_0x4f7c('0x23')](_0x7587fa,_0x47184a,!![]);}catch(_0x995184){return BPromise['reject'](_0x995184);}return _0x7587fa[_0x4f7c('0x24')]();};}function saveUpdates(_0x56b425,_0x172408){return function(_0x54feec){if(_0x54feec){return _0x54feec['update'](_0x56b425)['then'](function(_0x5c45c9){return _0x5c45c9;});}return null;};}function removeEntity(_0x5912f7,_0x2ff664){return function(_0x11c3de){if(_0x11c3de){return _0x11c3de['destroy']()['then'](function(){_0x5912f7[_0x4f7c('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5d3c43,_0x1d0c8a){return function(_0x122bb8){if(!_0x122bb8){_0x5d3c43['sendStatus'](0x194);}return _0x122bb8;};}function handleError(_0x11b79e,_0x418222){_0x418222=_0x418222||0x1f4;return function(_0x1dfbd0){logger[_0x4f7c('0x25')](_0x1dfbd0[_0x4f7c('0x26')]);if(_0x1dfbd0['name']){delete _0x1dfbd0[_0x4f7c('0x27')];}_0x11b79e[_0x4f7c('0x1c')](_0x418222)[_0x4f7c('0x28')](_0x1dfbd0);};}function getInteractionUsers(_0x11240a,_0x3c643b){return new BPromise(function(_0x5007e3,_0x9f8bd0){try{if(_0x3c643b[_0x11240a['id']]){_0x11240a[_0x4f7c('0x29')]=_[_0x4f7c('0x2a')](_0x3c643b[_0x11240a['id']],function(_0x5a346a){return{'id':_0x5a346a['id'],'fullname':_0x5a346a[_0x4f7c('0x2b')]};});}}catch(_0x23d6ce){_0x9f8bd0(_0x23d6ce);}_0x5007e3(_0x11240a);});}function getInteractionTags(_0x10882b,_0x494126){return new BPromise(function(_0x1346fd,_0x5247e7){try{if(_0x10882b[_0x4f7c('0x2c')]){_0x10882b[_0x4f7c('0x2d')]=[];_0x10882b['TagIds'][_0x4f7c('0x2e')](',')['forEach'](function(_0x36f29d){_0x10882b['Tags'][_0x4f7c('0x2f')](_0x494126[_0x36f29d]);});}delete _0x10882b[_0x4f7c('0x2c')];}catch(_0x35d7d8){_0x5247e7(_0x35d7d8);}_0x1346fd(_0x10882b);});}function updateOpenchannelInteraction(_0x5674c1,_0x4faa6b,_0x42e092){return new BPromise(function(_0x1f07d6,_0x1a6e42){return getInteractionUsers(_0x5674c1,_0x42e092)[_0x4f7c('0x30')](function(_0x37c0a3){return getInteractionTags(_0x37c0a3,_0x4faa6b);})[_0x4f7c('0x30')](function(_0x38ebc6){_0x1f07d6(_0x38ebc6);})[_0x4f7c('0x31')](function(_0x6d4001){_0x1a6e42(_0x6d4001);});});}exports['index']=function(_0x202b9f,_0x34322d){var _0x52bdcc={},_0x1e0abc={},_0x512f0b={'count':0x0,'rows':[]};var _0x30996d=_[_0x4f7c('0x2a')](db[_0x4f7c('0x32')]['rawAttributes'],function(_0x4249ad){return{'name':_0x4249ad[_0x4f7c('0x33')],'type':_0x4249ad[_0x4f7c('0x34')]['key']};});_0x1e0abc[_0x4f7c('0x35')]=_[_0x4f7c('0x2a')](_0x30996d,'name');_0x1e0abc[_0x4f7c('0x36')]=_[_0x4f7c('0x37')](_0x202b9f[_0x4f7c('0x36')]);_0x1e0abc[_0x4f7c('0x38')]=_[_0x4f7c('0x39')](_0x1e0abc['model'],_0x1e0abc[_0x4f7c('0x36')]);_0x52bdcc[_0x4f7c('0x3a')]=_[_0x4f7c('0x39')](_0x1e0abc['model'],qs[_0x4f7c('0x3b')](_0x202b9f['query'][_0x4f7c('0x3b')]));_0x52bdcc[_0x4f7c('0x3a')]=_0x52bdcc['attributes'][_0x4f7c('0x3c')]?_0x52bdcc[_0x4f7c('0x3a')]:_0x1e0abc[_0x4f7c('0x35')];if(!_0x202b9f[_0x4f7c('0x36')][_0x4f7c('0x3d')](_0x4f7c('0x3e'))){_0x52bdcc[_0x4f7c('0x20')]=qs[_0x4f7c('0x20')](_0x202b9f[_0x4f7c('0x36')][_0x4f7c('0x20')]);_0x52bdcc[_0x4f7c('0x1f')]=qs[_0x4f7c('0x1f')](_0x202b9f[_0x4f7c('0x36')][_0x4f7c('0x1f')]);}_0x52bdcc[_0x4f7c('0x3f')]=qs[_0x4f7c('0x40')](_0x202b9f[_0x4f7c('0x36')]['sort']);_0x52bdcc[_0x4f7c('0x41')]=qs['filters'](_[_0x4f7c('0x42')](_0x202b9f[_0x4f7c('0x36')],_0x1e0abc[_0x4f7c('0x38')]));var _0x3e0234=[];var _0x31164e=squel[_0x4f7c('0x43')]()[_0x4f7c('0x44')]('id')[_0x4f7c('0x44')](_0x4f7c('0x27'))['field'](_0x4f7c('0x45'))[_0x4f7c('0x46')](_0x4f7c('0x47'));var _0x3fadb2=squel[_0x4f7c('0x43')]()[_0x4f7c('0x44')](_0x4f7c('0x48'))[_0x4f7c('0x44')](_0x4f7c('0x49'))['field']('ui.OpenchannelInteractionId')[_0x4f7c('0x46')]('user_has_openchannel_interactions','ui')[_0x4f7c('0x4a')](_0x4f7c('0x4b'),'u',_0x4f7c('0x4c'));var _0x1065af=squel[_0x4f7c('0x43')]()[_0x4f7c('0x46')](_0x4f7c('0x4d'),'i')['left_join'](_0x4f7c('0x4e'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x4f7c('0x4a')](_0x4f7c('0x4b'),'o',_0x4f7c('0x4f'))['left_join']('openchannel_accounts','a',_0x4f7c('0x50'))['left_join']('openchannel_messages','me','me.OpenchannelInteractionId\x20=\x20i.id')[_0x4f7c('0x4a')](_0x4f7c('0x51'),'it',_0x4f7c('0x52'))[_0x4f7c('0x4a')](_0x4f7c('0x47'),'t','t.id\x20=\x20it.TagId');var _0x14b961=squel[_0x4f7c('0x53')]();var _0x16ca2e=[];var _0x401f41=squel[_0x4f7c('0x53')]();var _0x3b94be;if(_0x202b9f[_0x4f7c('0x36')]['search']){_0x3b94be=as[_0x4f7c('0x54')](_0x202b9f['query'][_0x4f7c('0x55')]);var _0x32b904=_0x3b94be[_0x4f7c('0x56')];for(var _0x2cb6f3=0x0;_0x2cb6f3<_0x3b94be[_0x4f7c('0x57')][_0x4f7c('0x3c')];_0x2cb6f3++){var _0x55998e=_0x3b94be[_0x4f7c('0x57')][_0x2cb6f3];var _0x2bb803='i';var _0xf1d775=_[_0x4f7c('0x58')](_0x30996d,['name',_0x55998e[_0x4f7c('0x44')]]);if(!_0xf1d775){switch(_0x55998e[_0x4f7c('0x44')]){case _0x4f7c('0x59'):if(_0x55998e[_0x4f7c('0x5a')]==0x1){_0x1065af['having']('`'+_0x55998e[_0x4f7c('0x44')]+_0x4f7c('0x5b'));}else{_0x1065af[_0x4f7c('0x5c')]('`'+_0x55998e['field']+_0x4f7c('0x5d'));}break;case'Contact':if(_0x55998e[_0x4f7c('0x5e')]===_0x4f7c('0x5f')){if(_0x55998e['value'][_0x4f7c('0x2e')]('\x20')[_0x4f7c('0x3c')]>0x1){_0x14b961[_0x32b904](_0x4f7c('0x60'),qs['getFullTextValue'](_0x55998e[_0x4f7c('0x5a')]),null);}else{var _0x2534d7='%'+_0x55998e[_0x4f7c('0x5a')]+'%';_0x14b961[_0x32b904](_0x4f7c('0x61'),_0x2534d7,_0x2534d7,_0x2534d7);}}else{_0xf1d775=_[_0x4f7c('0x58')](_0x30996d,[_0x4f7c('0x27'),_0x4f7c('0x62')]);_0x55998e[_0x4f7c('0x44')]='ContactId';_0x1de6b3=as[_0x4f7c('0x63')](_0x2bb803,_0xf1d775[_0x4f7c('0x34')],_0x55998e);_0x14b961[_0x32b904](_0x1de6b3[_0x4f7c('0x64')],_0x1de6b3[_0x4f7c('0x5a')][_0x4f7c('0x65')],_0x1de6b3['value']['end']);}break;case _0x4f7c('0x66'):var _0x4ef737=_0x55998e[_0x4f7c('0x5a')][_0x4f7c('0x2e')](',')[_0x4f7c('0x2a')](function(_0x3fb876){return Number(_0x3fb876);});_0x4ef737[_0x4f7c('0x67')](function(_0x284cc6){_0x401f41['or'](_0x4f7c('0x68'),'%,'+_0x284cc6+',%');});_0x16ca2e=_[_0x4f7c('0x69')](_0x16ca2e,_0x4ef737);break;case _0x4f7c('0x6a'):if(_0x55998e[_0x4f7c('0x5e')]===_0x4f7c('0x5f')){_0x14b961[_0x32b904](_0x4f7c('0x6b'),'%'+_0x55998e[_0x4f7c('0x5a')]+'%',null);}else{_0xf1d775=_[_0x4f7c('0x58')](_0x30996d,[_0x4f7c('0x27'),'UserId']);_0x55998e[_0x4f7c('0x44')]='UserId';_0x1de6b3=as[_0x4f7c('0x63')](_0x2bb803,_0xf1d775['type'],_0x55998e);_0x14b961[_0x32b904](_0x1de6b3[_0x4f7c('0x64')],_0x1de6b3[_0x4f7c('0x5a')][_0x4f7c('0x65')],_0x1de6b3[_0x4f7c('0x5a')]['end']);}break;case'body':_0x1de6b3=as[_0x4f7c('0x63')]('me',null,_0x55998e);_0x14b961[_0x32b904](_0x1de6b3[_0x4f7c('0x64')],_0x1de6b3[_0x4f7c('0x5a')][_0x4f7c('0x65')],_0x1de6b3['value']['end']);break;}}else{var _0x1de6b3=as[_0x4f7c('0x63')](_0x2bb803,_0xf1d775[_0x4f7c('0x34')],_0x55998e);_0x14b961[_0x32b904](_0x1de6b3['text'],_0x1de6b3[_0x4f7c('0x5a')][_0x4f7c('0x65')],_0x1de6b3[_0x4f7c('0x5a')][_0x4f7c('0x6c')]);}}}else{var _0x333539=_(_0x202b9f[_0x4f7c('0x36')])[_0x4f7c('0x37')]()[_0x4f7c('0x2a')](function(_0x2d4cb2){return _['some'](_0x30996d,[_0x4f7c('0x27'),_0x2d4cb2])?_0x2d4cb2:undefined;})['compact']()[_0x4f7c('0x5a')]();if(!_[_0x4f7c('0x6d')](_0x333539)){_0x333539[_0x4f7c('0x67')](function(_0x1fa4eb){if(_0x1fa4eb==='OpenchannelAccountId'){_0x1065af['where'](_0x4f7c('0x6e'),[][_0x4f7c('0x6f')](_0x202b9f[_0x4f7c('0x36')][_0x1fa4eb]));}else if(_0x1fa4eb===_0x4f7c('0x70')){var _0x47d3b5=JSON[_0x4f7c('0x71')](_0x202b9f[_0x4f7c('0x36')][_0x1fa4eb])[_0x4f7c('0x72')];var _0x3c9a9d=JSON[_0x4f7c('0x71')](_0x202b9f[_0x4f7c('0x36')][_0x1fa4eb])[_0x4f7c('0x73')];_0x1065af[_0x4f7c('0x41')](_0x4f7c('0x74'),_0x47d3b5,_0x3c9a9d);}else{if(_0x202b9f['query'][_0x1fa4eb]===_0x4f7c('0x75')){_0x1065af['where']('i.'+_0x1fa4eb+_0x4f7c('0x76'));}else{_0x1065af[_0x4f7c('0x41')]('i.'+_0x1fa4eb+_0x4f7c('0x77'),_0x202b9f[_0x4f7c('0x36')][_0x1fa4eb]);}}});}if(_0x202b9f[_0x4f7c('0x36')][_0x4f7c('0x78')]){if(_0x202b9f[_0x4f7c('0x36')]['read']==0x1){_0x1065af[_0x4f7c('0x5c')]('`unreadMessages`\x20=\x200');}else{_0x1065af[_0x4f7c('0x5c')](_0x4f7c('0x79'));}}if(_0x202b9f[_0x4f7c('0x36')]['tag']){_0x16ca2e=_[_0x4f7c('0x7a')](_0x202b9f[_0x4f7c('0x36')]['tag'])?_0x202b9f[_0x4f7c('0x36')][_0x4f7c('0x7b')]:new Array(_0x202b9f['query'][_0x4f7c('0x7b')]);_0x16ca2e[_0x4f7c('0x67')](function(_0x1c5dbc){_0x401f41['or'](_0x4f7c('0x68'),'%,'+_0x1c5dbc+',%');});}if(_0x202b9f['query'][_0x4f7c('0x7c')]){var _0x1bfd7e=_0x202b9f[_0x4f7c('0x36')][_0x4f7c('0x7c')]['replace']('\x5c','\x5c\x5c')[_0x4f7c('0x7d')]('\x27\x27',_0x4f7c('0x7e'));if(qs[_0x4f7c('0x7f')](_0x1bfd7e)){_0x14b961['or']('i.id\x20LIKE\x20?',_0x1bfd7e+'%');}else{_0x14b961['or'](_0x4f7c('0x80'),qs[_0x4f7c('0x81')](_0x1bfd7e))['or'](_0x4f7c('0x82'),_0x1bfd7e+'%')['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x1bfd7e+'%');}}}_0x1065af[_0x4f7c('0x41')](_0x14b961);_0x1065af[_0x4f7c('0x83')](_0x4f7c('0x84'));var _0x54a8d0={'type':db[_0x4f7c('0x85')][_0x4f7c('0x86')][_0x4f7c('0x87')],'raw':!![]};var _0x3b0227=_0x1065af[_0x4f7c('0x88')]();_0x3b0227[_0x4f7c('0x44')](_0x4f7c('0x84'));_0x3b0227[_0x4f7c('0x44')](_0x4f7c('0x89'),_0x4f7c('0x59'));if(_0x52bdcc[_0x4f7c('0x3f')]){_0x52bdcc[_0x4f7c('0x3f')][_0x4f7c('0x67')](function(_0x5aeeb5){_0x1065af[_0x4f7c('0x3f')]('i.'+_0x5aeeb5[0x0],_0x5aeeb5[0x1]===_0x4f7c('0x8a')?![]:!![]);});}if(!_[_0x4f7c('0x6d')](_0x16ca2e)){_0x1065af['having'](_0x401f41);_0x3b0227['where'](_0x4f7c('0x8b'),_0x16ca2e);}BPromise[_0x4f7c('0x8c')]()[_0x4f7c('0x30')](function(){if(!_0x3b94be){if(_0x202b9f[_0x4f7c('0x36')][_0x4f7c('0x8d')]||_0x202b9f['query'][_0x4f7c('0x8e')])return;_0x3b0227[_0x4f7c('0x41')]('i.OpenchannelAccountId\x20IS\x20NOT\x20NULL');_0x1065af[_0x4f7c('0x41')](_0x4f7c('0x8f'));return;}return _0x202b9f[_0x4f7c('0x90')][_0x4f7c('0x91')]({'attributes':['id'],'raw':!![]})[_0x4f7c('0x30')](function(_0xf48a32){if(_[_0x4f7c('0x6d')](_0xf48a32)){_0x3b0227[_0x4f7c('0x41')](_0x4f7c('0x92'));_0x1065af[_0x4f7c('0x41')](_0x4f7c('0x92'));}else{_0x3b0227[_0x4f7c('0x41')](_0x4f7c('0x6e'),_['map'](_0xf48a32,'id'));_0x1065af[_0x4f7c('0x41')](_0x4f7c('0x6e'),_[_0x4f7c('0x2a')](_0xf48a32,'id'));}});})[_0x4f7c('0x30')](function(){db[_0x4f7c('0x93')][_0x4f7c('0x36')](_0x3b0227[_0x4f7c('0x94')](),_0x54a8d0)['then'](function(_0x137307){_0x512f0b['count']=_0x137307[_0x4f7c('0x3c')];if(_0x512f0b[_0x4f7c('0x1e')]===0x0)return[];return db['sequelize'][_0x4f7c('0x36')](_0x31164e['toString'](),_0x54a8d0)['then'](function(_0x1b8d7a){_0x3e0234=_[_0x4f7c('0x95')](_0x1b8d7a,'id');_0x54a8d0=_[_0x4f7c('0x96')](_0x54a8d0,{'model':db[_0x4f7c('0x32')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x202b9f['query'][_0x4f7c('0x3b')]){_0x52bdcc[_0x4f7c('0x3a')]['forEach'](function(_0x478ffc){_0x1065af[_0x4f7c('0x44')]('i.'+_0x478ffc);});}else{_0x1065af[_0x4f7c('0x44')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x4f7c('0x59'));_0x1065af['field'](_0x4f7c('0x97'),_0x4f7c('0x98'));_0x1065af[_0x4f7c('0x44')]('a.mandatoryDisposition','Account.mandatoryDisposition');_0x1065af[_0x4f7c('0x44')]('i.*');_0x1065af['field']('c.firstName',_0x4f7c('0x99'));_0x1065af[_0x4f7c('0x44')](_0x4f7c('0x9a'),_0x4f7c('0x9b'));_0x1065af[_0x4f7c('0x44')]('c.email','Contact.email');_0x1065af[_0x4f7c('0x44')](_0x4f7c('0x9c'),'Contact.phone');_0x1065af['field'](_0x4f7c('0x9d'),_0x4f7c('0x9e'));_0x1065af[_0x4f7c('0x44')](_0x4f7c('0x9f'),_0x4f7c('0xa0'));_0x1065af['field']('o.fullname',_0x4f7c('0xa1'));_0x1065af[_0x4f7c('0x44')]('o.internal','Owner.internal');_0x1065af[_0x4f7c('0x44')](_0x4f7c('0xa2'),_0x4f7c('0x2c'));}_0x1065af[_0x4f7c('0x20')](_0x52bdcc[_0x4f7c('0x20')]);_0x1065af[_0x4f7c('0x1f')](_0x52bdcc[_0x4f7c('0x1f')]);return db[_0x4f7c('0x93')][_0x4f7c('0x36')](_0x1065af[_0x4f7c('0x94')](),_0x54a8d0);})[_0x4f7c('0x30')](function(_0x161b67){_0x3fadb2[_0x4f7c('0x41')](_0x4f7c('0xa3'),_[_0x4f7c('0x2a')](_0x161b67,'id'));return db[_0x4f7c('0x93')]['query'](_0x3fadb2[_0x4f7c('0x94')](),_0x54a8d0)[_0x4f7c('0x30')](function(_0x33c9de){var _0x106bc8=_[_0x4f7c('0xa4')](_0x33c9de,_0x4f7c('0xa5'));var _0x36c6ca=[];_0x161b67[_0x4f7c('0x67')](function(_0x230c93){_0x36c6ca[_0x4f7c('0x2f')](updateOpenchannelInteraction(_0x230c93,_0x3e0234,_0x106bc8));});return BPromise[_0x4f7c('0xa6')](_0x36c6ca);});});})[_0x4f7c('0x30')](function(_0x54586b){_0x512f0b[_0x4f7c('0xa7')]=_0x54586b;return _0x512f0b;})[_0x4f7c('0x30')](respondWithFilteredResult(_0x34322d,_0x52bdcc));})[_0x4f7c('0x31')](handleError(_0x34322d,null));};exports[_0x4f7c('0xa8')]=function(_0x28d4d0,_0x280698){var _0x4b2a4c={'raw':![],'where':{'id':_0x28d4d0['params']['id']}},_0x43c1c1={};_0x43c1c1[_0x4f7c('0x35')]=_[_0x4f7c('0x37')](db[_0x4f7c('0x32')][_0x4f7c('0xa9')]);_0x43c1c1[_0x4f7c('0x36')]=_[_0x4f7c('0x37')](_0x28d4d0[_0x4f7c('0x36')]);_0x43c1c1[_0x4f7c('0x38')]=_[_0x4f7c('0x39')](_0x43c1c1[_0x4f7c('0x35')],_0x43c1c1['query']);_0x4b2a4c[_0x4f7c('0x3a')]=_[_0x4f7c('0x39')](_0x43c1c1['model'],qs[_0x4f7c('0x3b')](_0x28d4d0[_0x4f7c('0x36')][_0x4f7c('0x3b')]));_0x4b2a4c[_0x4f7c('0x3a')]=_0x4b2a4c[_0x4f7c('0x3a')]['length']?_0x4b2a4c[_0x4f7c('0x3a')]:_0x43c1c1[_0x4f7c('0x35')];if(_0x28d4d0[_0x4f7c('0x36')][_0x4f7c('0xaa')]){_0x4b2a4c['include']=[{'all':!![]}];}_0x4b2a4c=_[_0x4f7c('0x96')]({},_0x4b2a4c,_0x28d4d0['options']);return db['OpenchannelInteraction'][_0x4f7c('0x58')](_0x4b2a4c)[_0x4f7c('0x30')](handleEntityNotFound(_0x280698,null))[_0x4f7c('0x30')](respondWithResult(_0x280698,null))['catch'](handleError(_0x280698,null));};exports[_0x4f7c('0xab')]=function(_0x662ac8,_0x575e91){return db[_0x4f7c('0x32')][_0x4f7c('0xab')](_0x662ac8['body'],{})[_0x4f7c('0x30')](respondWithResult(_0x575e91,0xc9))['catch'](handleError(_0x575e91,null));};exports['update']=function(_0x55abb2,_0x17ac1d){if(_0x55abb2[_0x4f7c('0xac')]['id']){delete _0x55abb2[_0x4f7c('0xac')]['id'];}return db[_0x4f7c('0x32')]['find']({'where':{'id':_0x55abb2['params']['id']}})[_0x4f7c('0x30')](handleEntityNotFound(_0x17ac1d,null))['then'](saveUpdates(_0x55abb2[_0x4f7c('0xac')],null))[_0x4f7c('0x30')](respondWithResult(_0x17ac1d,null))[_0x4f7c('0x31')](handleError(_0x17ac1d,null));};exports['destroy']=function(_0x2b40ce,_0x39dce0){return db[_0x4f7c('0x32')]['find']({'where':{'id':_0x2b40ce[_0x4f7c('0xad')]['id']}})[_0x4f7c('0x30')](handleEntityNotFound(_0x39dce0,null))[_0x4f7c('0x30')](removeEntity(_0x39dce0,null))['catch'](handleError(_0x39dce0,null));};exports[_0x4f7c('0xae')]=function(_0x58bb44,_0x3c8957){return db[_0x4f7c('0x32')][_0x4f7c('0xae')]()[_0x4f7c('0x30')](respondWithResult(_0x3c8957,null))[_0x4f7c('0x31')](handleError(_0x3c8957,null));};exports[_0x4f7c('0xaf')]=function(_0x168bf8,_0x1e87cf,_0x2520f0){return db[_0x4f7c('0xb0')]['find']({'where':{'id':_0x168bf8[_0x4f7c('0xad')]['id']}})[_0x4f7c('0x30')](handleEntityNotFound(_0x1e87cf,null))[_0x4f7c('0x30')](function(_0x2c30fd){if(_0x2c30fd){return _0x2c30fd['addMessage'](_0x168bf8[_0x4f7c('0xac')][_0x4f7c('0xb1')],_[_0x4f7c('0xb2')](_0x168bf8[_0x4f7c('0xac')],[_0x4f7c('0xb1'),'id'])||{});}})[_0x4f7c('0x30')](respondWithResult(_0x1e87cf,null))[_0x4f7c('0x31')](handleError(_0x1e87cf,null));};exports[_0x4f7c('0xb3')]=function(_0x113835,_0xced835,_0x17ec18){var _0x250a50={'raw':![],'where':{}};var _0x1120bb={};var _0x29beb2={'count':0x0,'rows':[]};return db[_0x4f7c('0x32')][_0x4f7c('0xb4')]({'where':{'id':_0x113835[_0x4f7c('0xad')]['id']}})[_0x4f7c('0x30')](handleEntityNotFound(_0xced835,null))[_0x4f7c('0x30')](function(_0x16ea97){if(_0x16ea97){_0x1120bb['model']=_[_0x4f7c('0x37')](db['OpenchannelMessage'][_0x4f7c('0xa9')]);_0x1120bb[_0x4f7c('0x36')]=_[_0x4f7c('0x37')](_0x113835['query']);_0x1120bb[_0x4f7c('0x38')]=_[_0x4f7c('0x39')](_0x1120bb[_0x4f7c('0x35')],_0x1120bb[_0x4f7c('0x36')]);_0x250a50[_0x4f7c('0x3a')]=_['intersection'](_0x1120bb[_0x4f7c('0x35')],qs[_0x4f7c('0x3b')](_0x113835[_0x4f7c('0x36')]['fields']));_0x250a50[_0x4f7c('0x3a')]=_0x250a50[_0x4f7c('0x3a')][_0x4f7c('0x3c')]?_0x250a50[_0x4f7c('0x3a')]:_0x1120bb[_0x4f7c('0x35')];if(!_0x113835[_0x4f7c('0x36')][_0x4f7c('0x3d')](_0x4f7c('0x3e'))){_0x250a50[_0x4f7c('0x20')]=qs[_0x4f7c('0x20')](_0x113835['query'][_0x4f7c('0x20')]);_0x250a50[_0x4f7c('0x1f')]=qs[_0x4f7c('0x1f')](_0x113835[_0x4f7c('0x36')][_0x4f7c('0x1f')]);}_0x250a50[_0x4f7c('0x3f')]=qs[_0x4f7c('0x40')](_0x113835[_0x4f7c('0x36')][_0x4f7c('0x40')]);_0x250a50[_0x4f7c('0x41')]=qs[_0x4f7c('0x38')](_['pick'](_0x113835[_0x4f7c('0x36')],_0x1120bb[_0x4f7c('0x38')]));_0x250a50[_0x4f7c('0x41')][_0x4f7c('0xa5')]=_0x16ea97['id'];if(_0x113835['query'][_0x4f7c('0x7c')]){_0x250a50[_0x4f7c('0x41')]=_[_0x4f7c('0x96')](_0x250a50[_0x4f7c('0x41')],{'$or':_[_0x4f7c('0x2a')](_0x250a50[_0x4f7c('0x3a')],function(_0x472ea5){var _0x5e42d5={};_0x5e42d5[_0x472ea5]={'$like':'%'+_0x113835[_0x4f7c('0x36')][_0x4f7c('0x7c')]+'%'};return _0x5e42d5;})});}if(_0x113835[_0x4f7c('0x36')][_0x4f7c('0x72')]){var _0x2720b3=_0x113835[_0x4f7c('0x36')][_0x4f7c('0x72')][_0x4f7c('0x2e')](',');var _0x4c5dcd={};_0x4c5dcd[_0x2720b3[0x0]]={'$gte':moment(_0x2720b3[0x1])[_0x4f7c('0xb5')]('YYYY-MM-DD\x20HH:mm:ss')};_0x250a50['where']=_[_0x4f7c('0x96')](_0x250a50['where'],_0x4c5dcd);}_0x250a50=_[_0x4f7c('0x96')]({},_0x250a50,_0x113835[_0x4f7c('0xb6')]);return db['OpenchannelMessage'][_0x4f7c('0x1e')]({'where':_0x250a50[_0x4f7c('0x41')]})[_0x4f7c('0x30')](function(_0x2fad47){_0x29beb2['count']=_0x2fad47;if(_0x113835[_0x4f7c('0x36')]['includeAll']){_0x250a50[_0x4f7c('0xb7')]=[{'all':!![]}];}return db[_0x4f7c('0xb0')]['findAll'](_0x250a50);})[_0x4f7c('0x30')](function(_0x54e573){_0x29beb2[_0x4f7c('0xa7')]=_0x54e573;return _0x29beb2;});}})[_0x4f7c('0x30')](respondWithFilteredResult(_0xced835,_0x250a50))[_0x4f7c('0x31')](handleError(_0xced835,null));};exports[_0x4f7c('0xb8')]=function(_0x588d81,_0x2fac39,_0x2a92ce){return db[_0x4f7c('0x32')][_0x4f7c('0x58')]({'where':{'id':_0x588d81[_0x4f7c('0xad')]['id']}})[_0x4f7c('0x30')](handleEntityNotFound(_0x2fac39,null))[_0x4f7c('0x30')](function(_0x141ab5){if(_0x141ab5){return _0x141ab5[_0x4f7c('0xb9')](_0x588d81[_0x4f7c('0xac')][_0x4f7c('0xb1')],_[_0x4f7c('0xb2')](_0x588d81[_0x4f7c('0xac')],[_0x4f7c('0xb1'),'id'])||{})[_0x4f7c('0xba')](function(){return db[_0x4f7c('0x66')][_0x4f7c('0xbb')]({'attributes':['id',_0x4f7c('0x27'),_0x4f7c('0x45')],'where':{'id':_0x588d81[_0x4f7c('0xac')][_0x4f7c('0xb1')]}});})[_0x4f7c('0x30')](function(_0x2ccb8a){socket[_0x4f7c('0xbc')]('openchannelInteractionTags:save',{'id':Number(_0x588d81[_0x4f7c('0xad')]['id']),'tags':_0x2ccb8a||[]});return{'id':Number(_0x588d81[_0x4f7c('0xad')]['id']),'tags':_0x2ccb8a||[]};});}})['then'](respondWithResult(_0x2fac39,null))[_0x4f7c('0x31')](handleError(_0x2fac39,null));};exports['removeTags']=function(_0x342bff,_0x47208b,_0x4ac87b){return db[_0x4f7c('0x32')][_0x4f7c('0x58')]({'where':{'id':_0x342bff['params']['id']}})[_0x4f7c('0x30')](handleEntityNotFound(_0x47208b,null))[_0x4f7c('0x30')](function(_0x204501){if(_0x204501){return _0x204501[_0x4f7c('0xbd')](_0x342bff[_0x4f7c('0x36')][_0x4f7c('0xb1')]);}})['then'](respondWithStatusCode(_0x47208b,null))['catch'](handleError(_0x47208b,null));};exports[_0x4f7c('0xbe')]=function(_0x18aa99,_0x1a940e){var _0x263f74=moment()[_0x4f7c('0xbf')]()[_0x4f7c('0x94')]();var _0x233dd0=path[_0x4f7c('0xc0')](config[_0x4f7c('0xc1')],'server',_0x4f7c('0xc2'),_0x4f7c('0xc3'));var _0x275e48=path['join'](config[_0x4f7c('0xc1')],_0x4f7c('0xc4'),_0x4f7c('0xc2'),_0x4f7c('0xc5'));var _0x18c593=path[_0x4f7c('0xc0')](_0x233dd0,_0x263f74);var _0x39dc6a=util[_0x4f7c('0xb5')]('transcript-%d-%s.zip',_0x18aa99['params']['id'],_0x263f74);var _0x36e95c=path[_0x4f7c('0xc0')](_0x233dd0,_0x39dc6a);var _0x32dfd7=[];_0x32dfd7[_0x4f7c('0x2f')]({'model':db[_0x4f7c('0x6a')],'as':_0x4f7c('0x6a'),'attributes':['id','fullname'],'raw':!![]});_0x32dfd7[_0x4f7c('0x2f')]({'model':db['CmContact'],'as':'Contact','attributes':['id','firstName',_0x4f7c('0xc6')],'raw':!![]});if(_0x18aa99[_0x4f7c('0x36')][_0x4f7c('0xc5')]){_0x32dfd7[_0x4f7c('0x2f')]({'model':db[_0x4f7c('0xc7')],'as':_0x4f7c('0xc7'),'raw':!![]});}var _0x20a58b=[{'model':db[_0x4f7c('0xb0')],'as':'Messages','attributes':['id',_0x4f7c('0xac'),_0x4f7c('0x70'),_0x4f7c('0xc8'),_0x4f7c('0xc9'),'read'],'include':_0x32dfd7}];_0x20a58b[_0x4f7c('0x2f')]({'model':db[_0x4f7c('0xca')],'as':_0x4f7c('0xcb'),'attributes':['id',_0x4f7c('0x27')]});_0x20a58b[_0x4f7c('0x2f')]({'model':db['User'],'as':_0x4f7c('0xcc'),'attributes':['id','fullname']});return db['OpenchannelInteraction'][_0x4f7c('0x58')]({'where':{'id':_0x18aa99['params']['id']},'include':_0x20a58b})['then'](handleEntityNotFound(_0x1a940e,null))[_0x4f7c('0x30')](function(_0x2ad0e8){if(_0x2ad0e8){var _0x2e5b86=_0x2ad0e8[_0x4f7c('0xcd')]({'plain':!![]});fs[_0x4f7c('0xce')](_0x18c593);var _0x417310={'format':'A4','border':_0x4f7c('0xcf'),'header':{'height':_0x4f7c('0xd0'),'contents':{'first':'\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20'}},'footer':{'height':_0x4f7c('0xd1'),'contents':{'default':util[_0x4f7c('0xb5')](_0x4f7c('0xd2'),util[_0x4f7c('0xb5')](_0x4f7c('0xd3'),'Openchannel',_0x2e5b86['id']),moment()[_0x4f7c('0xb5')](_0x4f7c('0xd4'))[_0x4f7c('0x94')]())}}};var _0x460b07={'channel':'Openchannel','account':_0x2e5b86[_0x4f7c('0xcb')][_0x4f7c('0x27')],'agent':_0x2e5b86[_0x4f7c('0xcc')]?_0x2e5b86[_0x4f7c('0xcc')]['fullname']:_0x4f7c('0xd5'),'createdAt':moment(_0x2e5b86['createdAt'])['format'](_0x4f7c('0xd6'))[_0x4f7c('0x94')](),'closedAt':_0x2e5b86[_0x4f7c('0xd7')]?moment(_0x2e5b86[_0x4f7c('0xd8')])['format'](_0x4f7c('0xd6'))[_0x4f7c('0x94')]():'','disposition':_0x2e5b86[_0x4f7c('0xd9')],'visibility':_0x2e5b86[_0x4f7c('0xda')]?'Public':_0x4f7c('0xdb'),'messages':_(_0x2e5b86[_0x4f7c('0xdc')])['filter']({'secret':![]})[_0x4f7c('0x2a')](function(_0x6162f9){if(_0x6162f9[_0x4f7c('0xc7')]){var _0x3eabc4=path[_0x4f7c('0xc0')](_0x275e48,_0x6162f9['Attachment'][_0x4f7c('0xdd')]);if(fs[_0x4f7c('0xde')](_0x3eabc4)){fs[_0x4f7c('0xdf')](_0x3eabc4)['pipe'](fs[_0x4f7c('0xe0')](path['join'](_0x18c593,_0x6162f9[_0x4f7c('0xc7')][_0x4f7c('0xdd')])));}}return{'date':moment(_0x6162f9[_0x4f7c('0x70')])[_0x4f7c('0xb5')](_0x4f7c('0xd6'))[_0x4f7c('0x94')](),'sender':_0x6162f9[_0x4f7c('0xc8')]===_0x4f7c('0xe1')?_0x6162f9[_0x4f7c('0x6a')]?_0x6162f9[_0x4f7c('0x6a')][_0x4f7c('0x2b')]:_0x4f7c('0xe2'):_0x6162f9[_0x4f7c('0xe3')][_0x4f7c('0xe4')]+(_0x6162f9[_0x4f7c('0xe3')][_0x4f7c('0xc6')]?'\x20'+_0x6162f9[_0x4f7c('0xe3')][_0x4f7c('0xc6')]:''),'body':_0x6162f9[_0x4f7c('0xc7')]?_0x6162f9[_0x4f7c('0xc7')][_0x4f7c('0xdd')]:_0x6162f9['body'],'direction':_0x6162f9[_0x4f7c('0xc8')]===_0x4f7c('0xe1')?'A':'C','secret':_0x6162f9[_0x4f7c('0xc9')],'read':_0x6162f9[_0x4f7c('0x78')],'attachment':_0x6162f9['Attachment']};})[_0x4f7c('0x5a')]()};return ejs[_0x4f7c('0xe5')](path['join'](config[_0x4f7c('0xc1')],_0x4f7c('0xc4'),_0x4f7c('0xe6'),_0x4f7c('0xe7')),{'interaction':_0x460b07})['then'](function(_0x4b00a2){return new BPromise(function(_0x594025,_0x24b64c){pdf['create'](_0x4b00a2,_0x417310)[_0x4f7c('0xe8')](path['join'](_0x18c593,'transcript-'+_0x2e5b86['id']+'-'+_0x263f74+'.pdf'),function(_0x339b09,_0x36823b){if(_0x339b09)return _0x24b64c(_0x339b09);_0x594025(_0x36823b);});});})[_0x4f7c('0x30')](function(){return new BPromise(function(_0x46859d,_0x233eb4){zipdir(_0x18c593,{'saveTo':_0x36e95c},function(_0x5334b4,_0x477740){if(_0x5334b4)return _0x233eb4(_0x5334b4);return _0x46859d(_0x477740);});})[_0x4f7c('0x30')](function(){return new BPromise(function(_0x5c0ed7,_0x56654c){rimraf(_0x18c593,function(_0x3d6940){if(_0x3d6940)_0x56654c(_0x3d6940);return _0x5c0ed7();});});})[_0x4f7c('0x30')](function(){return _0x1a940e[_0x4f7c('0xbe')](_0x36e95c,_0x39dc6a,function(_0x46bdb9){if(_0x46bdb9){console[_0x4f7c('0xe9')]('err',_0x46bdb9);}else{fs[_0x4f7c('0xea')](_0x36e95c);}});});});}else{return _0x1a940e[_0x4f7c('0x1b')](0xc8);}})[_0x4f7c('0x31')](handleError(_0x1a940e,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index c82c0c3..5d17333 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 _0x4675=['Users','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','update','remove','getUsers','then','setDataValue'];(function(_0x2beff4,_0x3e5f84){var _0x402c9f=function(_0x434231){while(--_0x434231){_0x2beff4['push'](_0x2beff4['shift']());}};_0x402c9f(++_0x3e5f84);}(_0x4675,0x141));var _0x5467=function(_0x52d73c,_0x5ce553){_0x52d73c=_0x52d73c-0x0;var _0x506cf7=_0x4675[_0x52d73c];return _0x506cf7;};'use strict';var EventEmitter=require(_0x5467('0x0'));var OpenchannelInteraction=require(_0x5467('0x1'))['db']['OpenchannelInteraction'];var OpenchannelMessage=require('../../mysqldb')['db']['OpenchannelMessage'];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x5467('0x2')](0x0);var events={'afterCreate':_0x5467('0x3'),'afterUpdate':_0x5467('0x4'),'afterDestroy':_0x5467('0x5')};function emitEvent(_0x550353){return function(_0xcc2e3c,_0x1a02db,_0x3bd694){_0xcc2e3c[_0x5467('0x6')]({'attributes':['id'],'raw':!![]})[_0x5467('0x7')](function(_0x21e548){_0xcc2e3c[_0x5467('0x8')](_0x5467('0x9'),_0x21e548['map'](function(_0x5390d3){return{'id':_0x5390d3['id']};}));return OpenchannelMessage['findAll']({'where':{'OpenchannelInteractionId':_0xcc2e3c['id'],'direction':'in','read':![]},'raw':!![]});})[_0x5467('0x7')](function(_0x4f9d26){_0xcc2e3c[_0x5467('0x8')]('unreadMessages',_0x4f9d26['length']);OpenchannelInteractionEvents[_0x5467('0xa')](_0x550353+':'+_0xcc2e3c['id'],_0xcc2e3c);OpenchannelInteractionEvents[_0x5467('0xa')](_0x550353,_0xcc2e3c);_0x3bd694(null);})[_0x5467('0xb')](_0x3bd694(null));};}for(var e in events){if(events[_0x5467('0xc')](e)){var event=events[e];OpenchannelInteraction[_0x5467('0xd')](e,emitEvent(event));}}module[_0x5467('0xe')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0xe2c7=['setDataValue','Users','findAll','unreadMessages','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelInteraction','OpenchannelMessage','setMaxListeners','update','remove','getUsers','then'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xe2c7,0x129));var _0x7e2c=function(_0x2dffd7,_0x50e766){_0x2dffd7=_0x2dffd7-0x0;var _0x55e83f=_0xe2c7[_0x2dffd7];return _0x55e83f;};'use strict';var EventEmitter=require(_0x7e2c('0x0'));var OpenchannelInteraction=require(_0x7e2c('0x1'))['db'][_0x7e2c('0x2')];var OpenchannelMessage=require(_0x7e2c('0x1'))['db'][_0x7e2c('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x7e2c('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7e2c('0x5'),'afterDestroy':_0x7e2c('0x6')};function emitEvent(_0x338d65){return function(_0x306a05,_0x1e3bc3,_0x2a50f6){_0x306a05[_0x7e2c('0x7')]({'attributes':['id'],'raw':!![]})[_0x7e2c('0x8')](function(_0x13ed32){_0x306a05[_0x7e2c('0x9')](_0x7e2c('0xa'),_0x13ed32['map'](function(_0x735d59){return{'id':_0x735d59['id']};}));return OpenchannelMessage[_0x7e2c('0xb')]({'where':{'OpenchannelInteractionId':_0x306a05['id'],'direction':'in','read':![]},'raw':!![]});})[_0x7e2c('0x8')](function(_0x4c7add){_0x306a05['setDataValue'](_0x7e2c('0xc'),_0x4c7add['length']);OpenchannelInteractionEvents[_0x7e2c('0xd')](_0x338d65+':'+_0x306a05['id'],_0x306a05);OpenchannelInteractionEvents[_0x7e2c('0xd')](_0x338d65,_0x306a05);_0x2a50f6(null);})[_0x7e2c('0xe')](_0x2a50f6(null));};}for(var e in events){if(events[_0x7e2c('0xf')](e)){var event=events[e];OpenchannelInteraction[_0x7e2c('0x10')](e,emitEvent(event));}}module[_0x7e2c('0x11')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index ce9040b..8407481 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 _0xf69d=['request-promise','path','rimraf','../../config/environment','./openchannelInteraction.attributes','exports','define','OpenchannelInteraction','openchannel_interactions','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment'];(function(_0x1259e9,_0x11d4a5){var _0x55e926=function(_0x27cbdd){while(--_0x27cbdd){_0x1259e9['push'](_0x1259e9['shift']());}};_0x55e926(++_0x11d4a5);}(_0xf69d,0xd3));var _0xdf69=function(_0x360f8e,_0x56871a){_0x360f8e=_0x360f8e-0x0;var _0xf23bd3=_0xf69d[_0x360f8e];return _0xf23bd3;};'use strict';var _=require(_0xdf69('0x0'));var util=require(_0xdf69('0x1'));var logger=require(_0xdf69('0x2'))(_0xdf69('0x3'));var moment=require(_0xdf69('0x4'));var BPromise=require('bluebird');var rp=require(_0xdf69('0x5'));var fs=require('fs');var path=require(_0xdf69('0x6'));var rimraf=require(_0xdf69('0x7'));var config=require(_0xdf69('0x8'));var attributes=require(_0xdf69('0x9'));module[_0xdf69('0xa')]=function(_0x2d456f,_0x465b1b){return _0x2d456f[_0xdf69('0xb')](_0xdf69('0xc'),attributes,{'tableName':_0xdf69('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xc1b77e,_0x38909e,_0x466c26){if(_0xc1b77e[_0xdf69('0xe')](_0xdf69('0xf'))){_0xc1b77e[_0xdf69('0x10')]=moment()['format'](_0xdf69('0x11'));}_0x466c26(null,_0xc1b77e);}}});}; \ No newline at end of file +var _0x6eed=['request-promise','path','./openchannelInteraction.attributes','exports','define','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6eed,0xff));var _0xd6ee=function(_0x22e543,_0x80e31c){_0x22e543=_0x22e543-0x0;var _0x4ae80a=_0x6eed[_0x22e543];return _0x4ae80a;};'use strict';var _=require(_0xd6ee('0x0'));var util=require(_0xd6ee('0x1'));var logger=require(_0xd6ee('0x2'))(_0xd6ee('0x3'));var moment=require(_0xd6ee('0x4'));var BPromise=require('bluebird');var rp=require(_0xd6ee('0x5'));var fs=require('fs');var path=require(_0xd6ee('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xd6ee('0x7'));module[_0xd6ee('0x8')]=function(_0x1c4f36,_0x37abca){return _0x1c4f36[_0xd6ee('0x9')]('OpenchannelInteraction',attributes,{'tableName':'openchannel_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2e6369,_0x5134ea,_0x50e3eb){if(_0x2e6369['changed'](_0xd6ee('0xa'))){_0x2e6369[_0xd6ee('0xb')]=moment()['format'](_0xd6ee('0xc'));}_0x50e3eb(null,_0x2e6369);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 7aa42d4..612e674 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 _0x89be=['attributes','stringify','AddTagsToOpenchannelInteraction','find','addTags','body','ids','omit','spread','AddTags','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','localhost','./openchannelInteraction.socket','request','then','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','update','options','raw','where'];(function(_0xd9a87d,_0x1ab290){var _0x23863b=function(_0x422107){while(--_0x422107){_0xd9a87d['push'](_0xd9a87d['shift']());}};_0x23863b(++_0x1ab290);}(_0x89be,0x18d));var _0xe89b=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x89be[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xe89b('0x0'));var util=require(_0xe89b('0x1'));var moment=require('moment');var BPromise=require(_0xe89b('0x2'));var rs=require(_0xe89b('0x3'));var fs=require('fs');var Redis=require(_0xe89b('0x4'));var db=require(_0xe89b('0x5'))['db'];var utils=require(_0xe89b('0x6'));var logger=require(_0xe89b('0x7'))(_0xe89b('0x8'));var config=require('../../config/environment');var jayson=require(_0xe89b('0x9'));var client=jayson[_0xe89b('0xa')][_0xe89b('0xb')]({'port':0x232a});config[_0xe89b('0xc')]=_['defaults'](config[_0xe89b('0xc')],{'host':_0xe89b('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe89b('0xc')]));require(_0xe89b('0xe'))['register'](socket);function respondWithRpcPromise(_0x303e49,_0x184acf,_0x19132c){return new BPromise(function(_0x117b4b,_0x1c29ad){return client[_0xe89b('0xf')](_0x303e49,_0x19132c)[_0xe89b('0x10')](function(_0x402450){logger[_0xe89b('0x11')](_0xe89b('0x12'),_0x184acf,_0xe89b('0x13'));logger[_0xe89b('0x14')](_0xe89b('0x15'),_0x184acf,_0xe89b('0x13'),JSON['stringify'](_0x402450));if(_0x402450[_0xe89b('0x16')]){if(_0x402450[_0xe89b('0x16')][_0xe89b('0x17')]===0x1f4){logger[_0xe89b('0x16')](_0xe89b('0x12'),_0x184acf,_0x402450[_0xe89b('0x16')][_0xe89b('0x18')]);return _0x1c29ad(_0x402450['error'][_0xe89b('0x18')]);}logger[_0xe89b('0x16')](_0xe89b('0x12'),_0x184acf,_0x402450[_0xe89b('0x16')][_0xe89b('0x18')]);return _0x117b4b(_0x402450['error'][_0xe89b('0x18')]);}else{logger['info'](_0xe89b('0x12'),_0x184acf,_0xe89b('0x13'));_0x117b4b(_0x402450[_0xe89b('0x19')]['message']);}})[_0xe89b('0x1a')](function(_0x67ab41){logger[_0xe89b('0x16')]('OpenchannelInteraction,\x20%s,\x20%s',_0x184acf,_0x67ab41);_0x1c29ad(_0x67ab41);});});}exports[_0xe89b('0x1b')]=function(_0x5a80a8){var _0x54bdac=this;return new Promise(function(_0x3028de,_0x3c51d2){return db[_0xe89b('0x1c')][_0xe89b('0x1d')](_0x5a80a8['body'],{'raw':_0x5a80a8['options']?_0x5a80a8[_0xe89b('0x1e')][_0xe89b('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5a80a8['options']?_0x5a80a8[_0xe89b('0x1e')][_0xe89b('0x20')]||null:null,'attributes':_0x5a80a8[_0xe89b('0x1e')]?_0x5a80a8['options'][_0xe89b('0x21')]||null:null,'limit':_0x5a80a8[_0xe89b('0x1e')]?_0x5a80a8['options']['limit']||null:null})[_0xe89b('0x10')](function(_0x180223){logger[_0xe89b('0x11')](_0xe89b('0x1b'),_0x5a80a8);logger['debug'](_0xe89b('0x1b'),_0x5a80a8,JSON[_0xe89b('0x22')](_0x180223));_0x3028de(_0x180223);})[_0xe89b('0x1a')](function(_0xf9b01d){logger['error'](_0xe89b('0x1b'),_0xf9b01d[_0xe89b('0x18')],_0x5a80a8);_0x3c51d2(_0x54bdac[_0xe89b('0x16')](0x1f4,_0xf9b01d[_0xe89b('0x18')]));});});};exports[_0xe89b('0x23')]=function(_0x388d9c){return new Promise(function(_0x2c9249,_0x513b17){return db[_0xe89b('0x1c')][_0xe89b('0x24')]({'where':_0x388d9c[_0xe89b('0x1e')]?_0x388d9c[_0xe89b('0x1e')][_0xe89b('0x20')]||null:null})[_0xe89b('0x10')](function(_0x46c80c){if(_0x46c80c){return _0x46c80c[_0xe89b('0x25')](_0x388d9c[_0xe89b('0x26')][_0xe89b('0x27')],_[_0xe89b('0x28')](_0x388d9c[_0xe89b('0x26')],[_0xe89b('0x27'),'id'])||{});}})[_0xe89b('0x29')](function(_0x77d7a5){logger[_0xe89b('0x11')]('AddTags',_0x388d9c);logger[_0xe89b('0x14')](_0xe89b('0x2a'),_0x388d9c,JSON[_0xe89b('0x22')](_0x77d7a5));_0x2c9249(_0x77d7a5);})[_0xe89b('0x1a')](function(_0x5aa478){logger[_0xe89b('0x16')](_0xe89b('0x2a'),_0x5aa478['message'],_0x388d9c);_0x513b17(_this['error'](0x1f4,_0x5aa478['message']));});});}; \ No newline at end of file +var _0xd1d8=['addTags','ids','AddTags','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','client','redis','socket.io-emitter','./openchannelInteraction.socket','register','info','OpenchannelInteraction,\x20%s,\x20%s','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','error','code','message','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','body','options','raw','attributes','limit','debug','stringify','AddTagsToOpenchannelInteraction','where','then'];(function(_0x3a53c8,_0x8edd4c){var _0x397e02=function(_0x2683cf){while(--_0x2683cf){_0x3a53c8['push'](_0x3a53c8['shift']());}};_0x397e02(++_0x8edd4c);}(_0xd1d8,0x13e));var _0x8d1d=function(_0x1dc8ce,_0x46f0a2){_0x1dc8ce=_0x1dc8ce-0x0;var _0xc1fadd=_0xd1d8[_0x1dc8ce];return _0xc1fadd;};'use strict';var _=require(_0x8d1d('0x0'));var util=require(_0x8d1d('0x1'));var moment=require(_0x8d1d('0x2'));var BPromise=require(_0x8d1d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8d1d('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x8d1d('0x5'))(_0x8d1d('0x6'));var config=require(_0x8d1d('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x8d1d('0x8')]['http']({'port':0x232a});config[_0x8d1d('0x9')]=_['defaults'](config[_0x8d1d('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x8d1d('0xa'))(new Redis(config[_0x8d1d('0x9')]));require(_0x8d1d('0xb'))[_0x8d1d('0xc')](socket);function respondWithRpcPromise(_0x3e901f,_0x371b17,_0x33177d){return new BPromise(function(_0x1798b5,_0x5944d8){return client['request'](_0x3e901f,_0x33177d)['then'](function(_0x567d35){logger[_0x8d1d('0xd')](_0x8d1d('0xe'),_0x371b17,'request\x20sent');logger['debug'](_0x8d1d('0xf'),_0x371b17,'request\x20sent',JSON['stringify'](_0x567d35));if(_0x567d35[_0x8d1d('0x10')]){if(_0x567d35[_0x8d1d('0x10')][_0x8d1d('0x11')]===0x1f4){logger[_0x8d1d('0x10')]('OpenchannelInteraction,\x20%s,\x20%s',_0x371b17,_0x567d35[_0x8d1d('0x10')]['message']);return _0x5944d8(_0x567d35[_0x8d1d('0x10')][_0x8d1d('0x12')]);}logger[_0x8d1d('0x10')](_0x8d1d('0xe'),_0x371b17,_0x567d35[_0x8d1d('0x10')][_0x8d1d('0x12')]);return _0x1798b5(_0x567d35[_0x8d1d('0x10')][_0x8d1d('0x12')]);}else{logger[_0x8d1d('0xd')](_0x8d1d('0xe'),_0x371b17,'request\x20sent');_0x1798b5(_0x567d35['result']['message']);}})[_0x8d1d('0x13')](function(_0x4786d1){logger[_0x8d1d('0x10')]('OpenchannelInteraction,\x20%s,\x20%s',_0x371b17,_0x4786d1);_0x5944d8(_0x4786d1);});});}exports[_0x8d1d('0x14')]=function(_0x13d944){var _0x298ca4=this;return new Promise(function(_0x295dc2,_0x3cd888){return db[_0x8d1d('0x15')]['update'](_0x13d944[_0x8d1d('0x16')],{'raw':_0x13d944[_0x8d1d('0x17')]?_0x13d944[_0x8d1d('0x17')][_0x8d1d('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x13d944[_0x8d1d('0x17')]?_0x13d944[_0x8d1d('0x17')]['where']||null:null,'attributes':_0x13d944[_0x8d1d('0x17')]?_0x13d944[_0x8d1d('0x17')][_0x8d1d('0x19')]||null:null,'limit':_0x13d944[_0x8d1d('0x17')]?_0x13d944['options'][_0x8d1d('0x1a')]||null:null})['then'](function(_0x5cabc1){logger[_0x8d1d('0xd')](_0x8d1d('0x14'),_0x13d944);logger[_0x8d1d('0x1b')](_0x8d1d('0x14'),_0x13d944,JSON[_0x8d1d('0x1c')](_0x5cabc1));_0x295dc2(_0x5cabc1);})[_0x8d1d('0x13')](function(_0x2ed1f8){logger[_0x8d1d('0x10')]('UpdateOpenchannelInteraction',_0x2ed1f8[_0x8d1d('0x12')],_0x13d944);_0x3cd888(_0x298ca4['error'](0x1f4,_0x2ed1f8[_0x8d1d('0x12')]));});});};exports[_0x8d1d('0x1d')]=function(_0x1c9d03){return new Promise(function(_0x672032,_0x18176c){return db[_0x8d1d('0x15')]['find']({'where':_0x1c9d03['options']?_0x1c9d03['options'][_0x8d1d('0x1e')]||null:null})[_0x8d1d('0x1f')](function(_0x3d07e5){if(_0x3d07e5){return _0x3d07e5[_0x8d1d('0x20')](_0x1c9d03[_0x8d1d('0x16')]['ids'],_['omit'](_0x1c9d03['body'],[_0x8d1d('0x21'),'id'])||{});}})['spread'](function(_0x39a885){logger[_0x8d1d('0xd')](_0x8d1d('0x22'),_0x1c9d03);logger[_0x8d1d('0x1b')](_0x8d1d('0x22'),_0x1c9d03,JSON[_0x8d1d('0x1c')](_0x39a885));_0x672032(_0x39a885);})[_0x8d1d('0x13')](function(_0x2f18f1){logger[_0x8d1d('0x10')](_0x8d1d('0x22'),_0x2f18f1[_0x8d1d('0x12')],_0x1c9d03);_0x18176c(_this[_0x8d1d('0x10')](0x1f4,_0x2f18f1[_0x8d1d('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index abc1b31..dae4628 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 _0xc468=['removeListener','register','openchannelInteraction:','./openchannelInteraction.events','update','emit'];(function(_0x18eca4,_0x14cc23){var _0x1bb25f=function(_0x2d2bc3){while(--_0x2d2bc3){_0x18eca4['push'](_0x18eca4['shift']());}};_0x1bb25f(++_0x14cc23);}(_0xc468,0x75));var _0x8c46=function(_0x11988d,_0xf629b8){_0x11988d=_0x11988d-0x0;var _0x34397b=_0xc468[_0x11988d];return _0x34397b;};'use strict';var OpenchannelInteractionEvents=require(_0x8c46('0x0'));var events=['save','remove',_0x8c46('0x1')];function createListener(_0x4c8378,_0x2d934d){return function(_0x38f4b8){_0x2d934d[_0x8c46('0x2')](_0x4c8378,_0x38f4b8);};}function removeListener(_0x2c01e1,_0x37c735){return function(){OpenchannelInteractionEvents[_0x8c46('0x3')](_0x2c01e1,_0x37c735);};}exports[_0x8c46('0x4')]=function(_0x1d79d6){for(var _0x419580=0x0,_0x374ff5=events['length'];_0x419580<_0x374ff5;_0x419580++){var _0xec46c5=events[_0x419580];var _0x585b87=createListener(_0x8c46('0x5')+_0xec46c5,_0x1d79d6);OpenchannelInteractionEvents['on'](_0xec46c5,_0x585b87);}}; \ No newline at end of file +var _0x127e=['openchannelInteraction:','./openchannelInteraction.events','save','update','removeListener','register','length'];(function(_0x4599b6,_0x40c254){var _0x2e014c=function(_0x3c4d90){while(--_0x3c4d90){_0x4599b6['push'](_0x4599b6['shift']());}};_0x2e014c(++_0x40c254);}(_0x127e,0x19e));var _0xe127=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x127e[_0x20a584];return _0x4b41a8;};'use strict';var OpenchannelInteractionEvents=require(_0xe127('0x0'));var events=[_0xe127('0x1'),'remove',_0xe127('0x2')];function createListener(_0x5e2ee3,_0x206c8e){return function(_0x4f6d8c){_0x206c8e['emit'](_0x5e2ee3,_0x4f6d8c);};}function removeListener(_0x15a8f1,_0x51fbc2){return function(){OpenchannelInteractionEvents[_0xe127('0x3')](_0x15a8f1,_0x51fbc2);};}exports[_0xe127('0x4')]=function(_0x5dd7f5){for(var _0x86b956=0x0,_0x4fa105=events[_0xe127('0x5')];_0x86b956<_0x4fa105;_0x86b956++){var _0x11c89d=events[_0x86b956];var _0x138fca=createListener(_0xe127('0x6')+_0x11c89d,_0x5dd7f5);OpenchannelInteractionEvents['on'](_0x11c89d,_0x138fca);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index e9cf18c..77d61b4 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 _0xadb1=['multer','util','path','connect-timeout','Router','../../config/environment','./openchannelMessage.controller','get','isAuthenticated','index','describe','/:id','show','tracked','create','put','accept','/:id/reject','reject','delete','destroy'];(function(_0x42fc8e,_0x26620d){var _0x4ad7b5=function(_0x4b217b){while(--_0x4b217b){_0x42fc8e['push'](_0x42fc8e['shift']());}};_0x4ad7b5(++_0x26620d);}(_0xadb1,0x7e));var _0x1adb=function(_0x508222,_0x35a1c8){_0x508222=_0x508222-0x0;var _0x15d49a=_0xadb1[_0x508222];return _0x15d49a;};'use strict';var multer=require(_0x1adb('0x0'));var util=require(_0x1adb('0x1'));var path=require(_0x1adb('0x2'));var timeout=require(_0x1adb('0x3'));var express=require('express');var router=express[_0x1adb('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x1adb('0x5'));var controller=require(_0x1adb('0x6'));router[_0x1adb('0x7')]('/',auth[_0x1adb('0x8')](),controller[_0x1adb('0x9')]);router['get']('/describe',auth[_0x1adb('0x8')](),controller[_0x1adb('0xa')]);router[_0x1adb('0x7')](_0x1adb('0xb'),auth['isAuthenticated'](),controller[_0x1adb('0xc')]);router['post']('/',auth[_0x1adb('0x8')](),interaction[_0x1adb('0xd')]('openchannel','openchannelmessage:create'),controller[_0x1adb('0xe')]);router[_0x1adb('0xf')](_0x1adb('0xb'),auth[_0x1adb('0x8')](),controller['update']);router[_0x1adb('0xf')]('/:id/accept',auth[_0x1adb('0x8')](),controller[_0x1adb('0x10')]);router[_0x1adb('0xf')](_0x1adb('0x11'),auth[_0x1adb('0x8')](),controller[_0x1adb('0x12')]);router[_0x1adb('0x13')]('/:id',auth[_0x1adb('0x8')](),controller[_0x1adb('0x14')]);module['exports']=router; \ No newline at end of file +var _0x77b5=['show','openchannel','openchannelmessage:create','create','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','index','/describe','describe','get','/:id','isAuthenticated'];(function(_0x27250c,_0x3e6637){var _0x7e3095=function(_0x1bbce7){while(--_0x1bbce7){_0x27250c['push'](_0x27250c['shift']());}};_0x7e3095(++_0x3e6637);}(_0x77b5,0x1d4));var _0x577b=function(_0x4338db,_0x13d55e){_0x4338db=_0x4338db-0x0;var _0x586a5d=_0x77b5[_0x4338db];return _0x586a5d;};'use strict';var multer=require('multer');var util=require(_0x577b('0x0'));var path=require(_0x577b('0x1'));var timeout=require(_0x577b('0x2'));var express=require(_0x577b('0x3'));var router=express[_0x577b('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x577b('0x5'));var config=require('../../config/environment');var controller=require('./openchannelMessage.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x577b('0x6')]);router['get'](_0x577b('0x7'),auth['isAuthenticated'](),controller[_0x577b('0x8')]);router[_0x577b('0x9')](_0x577b('0xa'),auth[_0x577b('0xb')](),controller[_0x577b('0xc')]);router['post']('/',auth[_0x577b('0xb')](),interaction['tracked'](_0x577b('0xd'),_0x577b('0xe')),controller[_0x577b('0xf')]);router['put'](_0x577b('0xa'),auth[_0x577b('0xb')](),controller[_0x577b('0x10')]);router['put'](_0x577b('0x11'),auth['isAuthenticated'](),controller[_0x577b('0x12')]);router['put'](_0x577b('0x13'),auth[_0x577b('0xb')](),controller[_0x577b('0x14')]);router[_0x577b('0x15')]('/:id',auth[_0x577b('0xb')](),controller[_0x577b('0x16')]);module[_0x577b('0x17')]=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index 0e6c133..34f6d42 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 _0xcff4=['DATE','sequelize','exports','TEXT','BOOLEAN','out'];(function(_0x47add9,_0x54ac9a){var _0x7cfccc=function(_0x668b61){while(--_0x668b61){_0x47add9['push'](_0x47add9['shift']());}};_0x7cfccc(++_0x54ac9a);}(_0xcff4,0xa9));var _0x4cff=function(_0x18f9cc,_0x3a3fe2){_0x18f9cc=_0x18f9cc-0x0;var _0x149e0b=_0xcff4[_0x18f9cc];return _0x149e0b;};'use strict';var Sequelize=require(_0x4cff('0x0'));module[_0x4cff('0x1')]={'body':{'type':Sequelize[_0x4cff('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0x4cff('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x4cff('0x4')),'defaultValue':_0x4cff('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0x4cff('0x5')]}}; \ No newline at end of file +var _0x70fb=['BOOLEAN','ENUM','out','sequelize','exports','TEXT','medium'];(function(_0x2df507,_0x553862){var _0x1f7167=function(_0x11319e){while(--_0x11319e){_0x2df507['push'](_0x2df507['shift']());}};_0x1f7167(++_0x553862);}(_0x70fb,0xdc));var _0xb70f=function(_0x2ff1f6,_0x1bc588){_0x2ff1f6=_0x2ff1f6-0x0;var _0xbae96d=_0x70fb[_0x2ff1f6];return _0xbae96d;};'use strict';var Sequelize=require(_0xb70f('0x0'));module[_0xb70f('0x1')]={'body':{'type':Sequelize[_0xb70f('0x2')](_0xb70f('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xb70f('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0xb70f('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xb70f('0x5')]('in',_0xb70f('0x6')),'defaultValue':_0xb70f('0x6'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index 8d58ff7..cb8e8c7 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 _0x3a6c=['read1stAt','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','stringify','null','AcceptMessage','acceptMessage','manual','format','SIP/%s','channel','event','EventManager','openchannel-interactions','reject','agent','RejectMessage','rejectMessage','interface','rejectmessage','eml-format','rimraf','zip-dir','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','error','code','OpenchannelMessage,\x20%s,\x20%s','message','result','end','status','json','count','limit','set','Content-Range','apply','save','update','destroy','sendStatus','stack','name','send','index','OpenchannelMessage','rawAttributes','fieldName','map','query','keys','filters','model','intersection','fields','length','nolimit','offset','order','pick','filter','where','merge','options','includeAll','include','rows','params','attributes','create','catch','body','find','describe','accept','openchannel','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','Contact','get','OpenchannelInteraction','OpenchannelInteractionId'];(function(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0x3a6c,0x10c));var _0xc3a6=function(_0x2d2b83,_0x133632){_0x2d2b83=_0x2d2b83-0x0;var _0x7afc29=_0x3a6c[_0x2d2b83];return _0x7afc29;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xc3a6('0x0'));var rimraf=require(_0xc3a6('0x1'));var zipdir=require(_0xc3a6('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xc3a6('0x3'));var util=require(_0xc3a6('0x4'));var path=require(_0xc3a6('0x5'));var sox=require(_0xc3a6('0x6'));var csv=require(_0xc3a6('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xc3a6('0x8'));var squel=require(_0xc3a6('0x9'));var crypto=require(_0xc3a6('0xa'));var jsforce=require(_0xc3a6('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xc3a6('0x7'));var querystring=require(_0xc3a6('0xc'));var Papa=require(_0xc3a6('0xd'));var Redis=require(_0xc3a6('0xe'));var authService=require(_0xc3a6('0xf'));var qs=require(_0xc3a6('0x10'));var as=require(_0xc3a6('0x11'));var hardwareService=require(_0xc3a6('0x12'));var logger=require(_0xc3a6('0x13'))(_0xc3a6('0x14'));var utils=require(_0xc3a6('0x15'));var config=require('../../config/environment');var db=require(_0xc3a6('0x16'))['db'];config[_0xc3a6('0x17')]=_[_0xc3a6('0x18')](config[_0xc3a6('0x17')],{'host':_0xc3a6('0x19'),'port':0x18eb});var socket=require(_0xc3a6('0x1a'))(new Redis(config['redis']));require('./openchannelMessage.socket')[_0xc3a6('0x1b')](socket);var jayson=require(_0xc3a6('0x1c'));var client=jayson[_0xc3a6('0x1d')][_0xc3a6('0x1e')]({'port':0x232c});var client9002=jayson[_0xc3a6('0x1d')]['http']({'port':0x232a});function checkPasswordPattern(_0x355b02,_0x2f20c8,_0x1e4289){if(_0x1e4289){var _0x566a4b=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x566a4b[_0xc3a6('0x1f')](_0x2f20c8)){return _0x355b02;}else{throw new db[(_0xc3a6('0x20'))][(_0xc3a6('0x21'))](_0xc3a6('0x22'));}}else{return _0x355b02;}}function respondWithRpcPromise(_0x5b4ab7,_0x12029e,_0x1aa90f,_0x41c8f7){return new BPromise(function(_0x4f6c73,_0x1743c3){var _0x4b4aaa=_0x41c8f7||client;return _0x4b4aaa[_0xc3a6('0x23')](_0x5b4ab7,_0x1aa90f)[_0xc3a6('0x24')](function(_0x411ba6){logger[_0xc3a6('0x25')]('OpenchannelMessage,\x20%s,\x20%s',_0x12029e,_0xc3a6('0x26'));logger[_0xc3a6('0x27')](_0xc3a6('0x28'),_0x12029e,_0xc3a6('0x26'),JSON['stringify'](_0x411ba6));if(_0x411ba6[_0xc3a6('0x29')]){if(_0x411ba6[_0xc3a6('0x29')][_0xc3a6('0x2a')]===0x1f4){logger['error'](_0xc3a6('0x2b'),_0x12029e,_0x411ba6[_0xc3a6('0x29')][_0xc3a6('0x2c')]);return _0x1743c3(_0x411ba6['error'][_0xc3a6('0x2c')]);}logger[_0xc3a6('0x29')](_0xc3a6('0x2b'),_0x12029e,_0x411ba6[_0xc3a6('0x29')][_0xc3a6('0x2c')]);return _0x4f6c73(_0x411ba6[_0xc3a6('0x29')][_0xc3a6('0x2c')]);}else{logger[_0xc3a6('0x25')](_0xc3a6('0x2b'),_0x12029e,_0xc3a6('0x26'));_0x4f6c73(_0x411ba6[_0xc3a6('0x2d')]['message']);}})['catch'](function(_0x58dc5c){logger[_0xc3a6('0x29')](_0xc3a6('0x2b'),_0x12029e,_0x58dc5c);_0x1743c3(_0x58dc5c);});});}function respondWithStatusCode(_0x444758,_0x4512b5){_0x4512b5=_0x4512b5||0xcc;return function(_0x40fa80){if(_0x40fa80){return _0x444758['sendStatus'](_0x4512b5);}return _0x444758['status'](_0x4512b5)[_0xc3a6('0x2e')]();};}function respondWithResult(_0xdbbb81,_0x417aad){_0x417aad=_0x417aad||0xc8;return function(_0x41de02){if(_0x41de02){return _0xdbbb81[_0xc3a6('0x2f')](_0x417aad)[_0xc3a6('0x30')](_0x41de02);}};}function respondWithFilteredResult(_0x2aa537,_0x1fec1a){return function(_0x3764fc){if(_0x3764fc){var _0x5de3a2=_0x3764fc[_0xc3a6('0x31')],_0x3c643b=_0x1fec1a['offset'],_0x4a36d9=_0x1fec1a['offset']+_0x1fec1a[_0xc3a6('0x32')],_0x36e8ac;if(_0x4a36d9>=_0x5de3a2){_0x4a36d9=_0x5de3a2;_0x36e8ac=0xc8;}else{_0x36e8ac=0xce;}_0x2aa537[_0xc3a6('0x2f')](_0x36e8ac);return _0x2aa537[_0xc3a6('0x33')](_0xc3a6('0x34'),_0x3c643b+'-'+_0x4a36d9+'/'+_0x5de3a2)['json'](_0x3764fc);}return null;};}function patchUpdates(_0x48ee81){return function(_0x55b92e){try{jsonpatch[_0xc3a6('0x35')](_0x55b92e,_0x48ee81,!![]);}catch(_0x5197d0){return BPromise['reject'](_0x5197d0);}return _0x55b92e[_0xc3a6('0x36')]();};}function saveUpdates(_0x1b0a4e,_0x233065){return function(_0x12b122){if(_0x12b122){return _0x12b122[_0xc3a6('0x37')](_0x1b0a4e)[_0xc3a6('0x24')](function(_0x2b8901){return _0x2b8901;});}return null;};}function removeEntity(_0x1913e8,_0x5f553e){return function(_0x5cdb2a){if(_0x5cdb2a){return _0x5cdb2a[_0xc3a6('0x38')]()[_0xc3a6('0x24')](function(){_0x1913e8[_0xc3a6('0x2f')](0xcc)[_0xc3a6('0x2e')]();});}};}function handleEntityNotFound(_0x3699b0,_0x5aea86){return function(_0x3608c1){if(!_0x3608c1){_0x3699b0[_0xc3a6('0x39')](0x194);}return _0x3608c1;};}function handleError(_0x3b27ac,_0x37122a){_0x37122a=_0x37122a||0x1f4;return function(_0xd56069){logger[_0xc3a6('0x29')](_0xd56069[_0xc3a6('0x3a')]);if(_0xd56069[_0xc3a6('0x3b')]){delete _0xd56069[_0xc3a6('0x3b')];}_0x3b27ac[_0xc3a6('0x2f')](_0x37122a)[_0xc3a6('0x3c')](_0xd56069);};}exports[_0xc3a6('0x3d')]=function(_0x2faa5a,_0x4b1a3){var _0x3cc12d={},_0x177499={},_0x2c0723={'count':0x0,'rows':[]};var _0x21a05d=_['map'](db[_0xc3a6('0x3e')][_0xc3a6('0x3f')],function(_0x593da2){return{'name':_0x593da2[_0xc3a6('0x40')],'type':_0x593da2['type']['key']};});_0x177499['model']=_[_0xc3a6('0x41')](_0x21a05d,'name');_0x177499[_0xc3a6('0x42')]=_[_0xc3a6('0x43')](_0x2faa5a[_0xc3a6('0x42')]);_0x177499[_0xc3a6('0x44')]=_['intersection'](_0x177499[_0xc3a6('0x45')],_0x177499[_0xc3a6('0x42')]);_0x3cc12d['attributes']=_[_0xc3a6('0x46')](_0x177499[_0xc3a6('0x45')],qs['fields'](_0x2faa5a['query'][_0xc3a6('0x47')]));_0x3cc12d['attributes']=_0x3cc12d['attributes'][_0xc3a6('0x48')]?_0x3cc12d['attributes']:_0x177499[_0xc3a6('0x45')];if(!_0x2faa5a[_0xc3a6('0x42')]['hasOwnProperty'](_0xc3a6('0x49'))){_0x3cc12d[_0xc3a6('0x32')]=qs['limit'](_0x2faa5a[_0xc3a6('0x42')][_0xc3a6('0x32')]);_0x3cc12d[_0xc3a6('0x4a')]=qs[_0xc3a6('0x4a')](_0x2faa5a['query'][_0xc3a6('0x4a')]);}_0x3cc12d[_0xc3a6('0x4b')]=qs['sort'](_0x2faa5a[_0xc3a6('0x42')]['sort']);_0x3cc12d['where']=qs[_0xc3a6('0x44')](_[_0xc3a6('0x4c')](_0x2faa5a['query'],_0x177499['filters']));if(_0x2faa5a[_0xc3a6('0x42')][_0xc3a6('0x4d')]){_0x3cc12d[_0xc3a6('0x4e')]=_[_0xc3a6('0x4f')](_0x3cc12d[_0xc3a6('0x4e')],{'$or':_[_0xc3a6('0x41')](_0x21a05d,function(_0x328593){if(_0x328593['type']!=='VIRTUAL'){var _0x91f677={};_0x91f677[_0x328593[_0xc3a6('0x3b')]]={'$like':'%'+_0x2faa5a[_0xc3a6('0x42')][_0xc3a6('0x4d')]+'%'};return _0x91f677;}})});}_0x3cc12d=_['merge']({},_0x3cc12d,_0x2faa5a[_0xc3a6('0x50')]);var _0x214d74={'where':_0x3cc12d[_0xc3a6('0x4e')]};return db[_0xc3a6('0x3e')][_0xc3a6('0x31')](_0x214d74)['then'](function(_0x5acaa6){_0x2c0723[_0xc3a6('0x31')]=_0x5acaa6;if(_0x2faa5a[_0xc3a6('0x42')][_0xc3a6('0x51')]){_0x3cc12d[_0xc3a6('0x52')]=[{'all':!![]}];}return db[_0xc3a6('0x3e')]['findAll'](_0x3cc12d);})[_0xc3a6('0x24')](function(_0x75bdac){_0x2c0723[_0xc3a6('0x53')]=_0x75bdac;return _0x2c0723;})[_0xc3a6('0x24')](respondWithFilteredResult(_0x4b1a3,_0x3cc12d))['catch'](handleError(_0x4b1a3,null));};exports['show']=function(_0x5c4e8b,_0x1a23de){var _0x1e0a0f={'raw':!![],'where':{'id':_0x5c4e8b[_0xc3a6('0x54')]['id']}},_0x24179b={};_0x24179b[_0xc3a6('0x45')]=_[_0xc3a6('0x43')](db[_0xc3a6('0x3e')][_0xc3a6('0x3f')]);_0x24179b[_0xc3a6('0x42')]=_[_0xc3a6('0x43')](_0x5c4e8b['query']);_0x24179b[_0xc3a6('0x44')]=_[_0xc3a6('0x46')](_0x24179b['model'],_0x24179b[_0xc3a6('0x42')]);_0x1e0a0f[_0xc3a6('0x55')]=_[_0xc3a6('0x46')](_0x24179b[_0xc3a6('0x45')],qs['fields'](_0x5c4e8b[_0xc3a6('0x42')][_0xc3a6('0x47')]));_0x1e0a0f[_0xc3a6('0x55')]=_0x1e0a0f['attributes'][_0xc3a6('0x48')]?_0x1e0a0f[_0xc3a6('0x55')]:_0x24179b[_0xc3a6('0x45')];if(_0x5c4e8b[_0xc3a6('0x42')][_0xc3a6('0x51')]){_0x1e0a0f[_0xc3a6('0x52')]=[{'all':!![]}];}_0x1e0a0f=_[_0xc3a6('0x4f')]({},_0x1e0a0f,_0x5c4e8b[_0xc3a6('0x50')]);return db[_0xc3a6('0x3e')]['find'](_0x1e0a0f)[_0xc3a6('0x24')](handleEntityNotFound(_0x1a23de,null))['then'](respondWithResult(_0x1a23de,null))['catch'](handleError(_0x1a23de,null));};exports['create']=function(_0x1e7f21,_0x4dada5){return db[_0xc3a6('0x3e')][_0xc3a6('0x56')](_0x1e7f21['body'],{})[_0xc3a6('0x24')](respondWithResult(_0x4dada5,0xc9))[_0xc3a6('0x57')](handleError(_0x4dada5,null));};exports['update']=function(_0x7d4429,_0x490643){if(_0x7d4429[_0xc3a6('0x58')]['id']){delete _0x7d4429[_0xc3a6('0x58')]['id'];}return db[_0xc3a6('0x3e')]['find']({'where':{'id':_0x7d4429[_0xc3a6('0x54')]['id']}})[_0xc3a6('0x24')](handleEntityNotFound(_0x490643,null))['then'](saveUpdates(_0x7d4429[_0xc3a6('0x58')],null))[_0xc3a6('0x24')](respondWithResult(_0x490643,null))[_0xc3a6('0x57')](handleError(_0x490643,null));};exports[_0xc3a6('0x38')]=function(_0x372bde,_0x14cca7){return db[_0xc3a6('0x3e')][_0xc3a6('0x59')]({'where':{'id':_0x372bde[_0xc3a6('0x54')]['id']}})[_0xc3a6('0x24')](handleEntityNotFound(_0x14cca7,null))['then'](removeEntity(_0x14cca7,null))[_0xc3a6('0x57')](handleError(_0x14cca7,null));};exports[_0xc3a6('0x5a')]=function(_0x1a40de,_0x57aef3){return db[_0xc3a6('0x3e')][_0xc3a6('0x5a')]()[_0xc3a6('0x24')](respondWithResult(_0x57aef3,null))[_0xc3a6('0x57')](handleError(_0x57aef3,null));};var interaction_log=require(_0xc3a6('0x13'))('openchannel-interactions');exports[_0xc3a6('0x5b')]=function(_0x5d4626,_0x48ba7e,_0x1094b1){var _0x409df4={'channel':_0xc3a6('0x5c')};if(_0x5d4626[_0xc3a6('0x58')]['id']){delete _0x5d4626[_0xc3a6('0x58')]['id'];}_0x5d4626[_0xc3a6('0x58')][_0xc3a6('0x5d')]=!![];_0x5d4626[_0xc3a6('0x58')][_0xc3a6('0x5e')]=moment()['format'](_0xc3a6('0x5f'));_0x5d4626[_0xc3a6('0x58')][_0xc3a6('0x60')]=_0x5d4626['body'][_0xc3a6('0x60')]||_0x5d4626['user']['id'];return db['OpenchannelMessage'][_0xc3a6('0x59')]({'where':{'id':_0x5d4626['params']['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0xc3a6('0x61')}]})['then'](handleEntityNotFound(_0x48ba7e,null))[_0xc3a6('0x24')](saveUpdates(_0x5d4626['body'],null))[_0xc3a6('0x24')](function(_0x3f9183){if(_0x3f9183){_0x409df4[_0xc3a6('0x2c')]=_0x3f9183[_0xc3a6('0x62')]({'plain':!![]});return db[_0xc3a6('0x63')]['find']({'where':{'id':_0x3f9183[_0xc3a6('0x64')]}});}return null;})[_0xc3a6('0x24')](handleEntityNotFound(_0x48ba7e,null))[_0xc3a6('0x24')](function(_0x272080){if(_0x272080){return _0x272080['update']({'UserId':_0x5d4626['body']['UserId'],'read1stAt':_['isNil'](_0x272080[_0xc3a6('0x65')])?moment()['format'](_0xc3a6('0x5f')):undefined});}return null;})['then'](function(_0x46b90c){if(_0x46b90c){_0x409df4[_0xc3a6('0x66')]=_0x46b90c[_0xc3a6('0x62')]({'plain':!![]});interaction_log[_0xc3a6('0x25')](_0xc3a6('0x67'),_0x5d4626[_0xc3a6('0x68')]['id'],_0x5d4626[_0xc3a6('0x68')]['name'],_0x5d4626[_0xc3a6('0x68')][_0xc3a6('0x69')],_0x409df4['interaction']['id'],_0x5d4626[_0xc3a6('0x58')]?JSON[_0xc3a6('0x6a')](_0x5d4626[_0xc3a6('0x58')]):_0xc3a6('0x6b'));return respondWithRpcPromise(_0xc3a6('0x6c'),_0xc3a6('0x6d'),_0x409df4);}return null;})['then'](function(_0x4cf13f){if(_0x4cf13f){if(_0x5d4626[_0xc3a6('0x58')][_0xc3a6('0x6e')]){_0x409df4[_0xc3a6('0x2c')]['interface']=util[_0xc3a6('0x6f')](_0xc3a6('0x70'),_0x5d4626['user'][_0xc3a6('0x3b')]);_0x409df4[_0xc3a6('0x2c')][_0xc3a6('0x71')]=_0x409df4[_0xc3a6('0x71')];_0x409df4[_0xc3a6('0x2c')][_0xc3a6('0x72')]='accept';return respondWithRpcPromise(_0xc3a6('0x73'),_0xc3a6('0x73'),{'event':'acceptmessage','message':_0x409df4[_0xc3a6('0x2c')]},client9002)['then'](function(){return _0x409df4;});}return _0x409df4;}return null;})[_0xc3a6('0x24')](respondWithResult(_0x48ba7e,null))[_0xc3a6('0x57')](handleError(_0x48ba7e,null));};var interaction_log=require('../../config/logger')(_0xc3a6('0x74'));exports[_0xc3a6('0x75')]=function(_0x2ba4a1,_0x35b58e,_0x114fa0){var _0x159217={'agent':{},'channel':'openchannel'};if(_0x2ba4a1[_0xc3a6('0x58')]['id']){delete _0x2ba4a1[_0xc3a6('0x58')]['id'];}_0x2ba4a1[_0xc3a6('0x58')][_0xc3a6('0x60')]=_0x2ba4a1['body'][_0xc3a6('0x60')]||_0x2ba4a1[_0xc3a6('0x68')]['id'];_0x159217[_0xc3a6('0x76')]['id']=_0x2ba4a1[_0xc3a6('0x58')][_0xc3a6('0x60')];return db[_0xc3a6('0x3e')][_0xc3a6('0x59')]({'where':{'id':_0x2ba4a1[_0xc3a6('0x54')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x35b58e,null))[_0xc3a6('0x24')](function(_0x2337b5){if(_0x2337b5){_0x159217[_0xc3a6('0x2c')]=_0x2337b5[_0xc3a6('0x62')]({'plain':!![]});return db[_0xc3a6('0x63')][_0xc3a6('0x59')]({'where':{'id':_0x2337b5[_0xc3a6('0x64')]}});}return null;})[_0xc3a6('0x24')](handleEntityNotFound(_0x35b58e,null))[_0xc3a6('0x24')](function(_0x163ed1){if(_0x163ed1){_0x159217['interaction']=_0x163ed1[_0xc3a6('0x62')]({'plain':!![]});interaction_log[_0xc3a6('0x25')]('[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x2ba4a1[_0xc3a6('0x68')]['id'],_0x2ba4a1[_0xc3a6('0x68')]['name'],_0x2ba4a1[_0xc3a6('0x68')][_0xc3a6('0x69')],_0x159217[_0xc3a6('0x66')]['id'],_0x2ba4a1[_0xc3a6('0x58')]?JSON['stringify'](_0x2ba4a1[_0xc3a6('0x58')]):_0xc3a6('0x6b'));return respondWithRpcPromise(_0xc3a6('0x77'),_0xc3a6('0x78'),_0x159217);}return null;})['then'](function(_0x564de5){if(_0x564de5){_0x564de5[_0xc3a6('0x2c')][_0xc3a6('0x79')]=util[_0xc3a6('0x6f')](_0xc3a6('0x70'),_0x2ba4a1['user']['name']);_0x564de5[_0xc3a6('0x2c')][_0xc3a6('0x71')]=_0x159217[_0xc3a6('0x71')];_0x564de5[_0xc3a6('0x2c')]['event']=_0xc3a6('0x75');respondWithRpcPromise(_0xc3a6('0x73'),_0xc3a6('0x73'),{'event':_0xc3a6('0x7a'),'message':_0x564de5['message']},client9002);return _0x159217;}return null;})['then'](respondWithResult(_0x35b58e,null))[_0xc3a6('0x57')](handleError(_0x35b58e,null));}; \ No newline at end of file +var _0x394d=['event','accept','EventManager','openchannel','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','RejectMessage','interface','channel','rejectmessage','html-pdf','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','sendStatus','status','end','json','count','limit','Content-Range','reject','save','update','destroy','name','send','map','rawAttributes','fieldName','key','model','keys','query','filters','attributes','intersection','fields','length','nolimit','offset','order','sort','where','pick','filter','merge','VIRTUAL','options','include','OpenchannelMessage','findAll','rows','show','includeAll','find','create','body','params','describe','openchannel-interactions','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','CmContact','Contact','get','OpenchannelInteraction','OpenchannelInteractionId','isNil','read1stAt','interaction','user','AcceptMessage','acceptMessage','SIP/%s'];(function(_0x24f31b,_0x44b8f3){var _0x488401=function(_0x204caf){while(--_0x204caf){_0x24f31b['push'](_0x24f31b['shift']());}};_0x488401(++_0x44b8f3);}(_0x394d,0x173));var _0xd394=function(_0x500419,_0x549162){_0x500419=_0x500419-0x0;var _0x241c1a=_0x394d[_0x500419];return _0x241c1a;};'use strict';var pdf=require(_0xd394('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xd394('0x1'));var zipdir=require(_0xd394('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xd394('0x3'));var BPromise=require(_0xd394('0x4'));var Mustache=require(_0xd394('0x5'));var util=require(_0xd394('0x6'));var path=require(_0xd394('0x7'));var sox=require(_0xd394('0x8'));var csv=require(_0xd394('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xd394('0xa'));var squel=require(_0xd394('0xb'));var crypto=require('crypto');var jsforce=require(_0xd394('0xc'));var deskjs=require(_0xd394('0xd'));var toCsv=require(_0xd394('0x9'));var querystring=require('querystring');var Papa=require(_0xd394('0xe'));var Redis=require(_0xd394('0xf'));var authService=require(_0xd394('0x10'));var qs=require(_0xd394('0x11'));var as=require(_0xd394('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd394('0x13'))(_0xd394('0x14'));var utils=require(_0xd394('0x15'));var config=require('../../config/environment');var db=require(_0xd394('0x16'))['db'];config[_0xd394('0x17')]=_[_0xd394('0x18')](config[_0xd394('0x17')],{'host':_0xd394('0x19'),'port':0x18eb});var socket=require(_0xd394('0x1a'))(new Redis(config[_0xd394('0x17')]));require(_0xd394('0x1b'))[_0xd394('0x1c')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0xd394('0x1d')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function checkPasswordPattern(_0x2dc482,_0x25d756,_0x35183b){if(_0x35183b){var _0x1673e9=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1673e9[_0xd394('0x1e')](_0x25d756)){return _0x2dc482;}else{throw new db[(_0xd394('0x1f'))][(_0xd394('0x20'))](_0xd394('0x21'));}}else{return _0x2dc482;}}function respondWithRpcPromise(_0x563c9e,_0x4054f8,_0x54eb64,_0x3e9f45){return new BPromise(function(_0x4ee379,_0x459cc9){var _0x54b7bd=_0x3e9f45||client;return _0x54b7bd[_0xd394('0x22')](_0x563c9e,_0x54eb64)[_0xd394('0x23')](function(_0x1a2e0b){logger[_0xd394('0x24')](_0xd394('0x25'),_0x4054f8,_0xd394('0x26'));logger[_0xd394('0x27')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x4054f8,'request\x20sent',JSON[_0xd394('0x28')](_0x1a2e0b));if(_0x1a2e0b[_0xd394('0x29')]){if(_0x1a2e0b[_0xd394('0x29')]['code']===0x1f4){logger[_0xd394('0x29')](_0xd394('0x25'),_0x4054f8,_0x1a2e0b[_0xd394('0x29')][_0xd394('0x2a')]);return _0x459cc9(_0x1a2e0b[_0xd394('0x29')][_0xd394('0x2a')]);}logger[_0xd394('0x29')](_0xd394('0x25'),_0x4054f8,_0x1a2e0b[_0xd394('0x29')]['message']);return _0x4ee379(_0x1a2e0b[_0xd394('0x29')]['message']);}else{logger[_0xd394('0x24')](_0xd394('0x25'),_0x4054f8,_0xd394('0x26'));_0x4ee379(_0x1a2e0b[_0xd394('0x2b')]['message']);}})[_0xd394('0x2c')](function(_0x30d48a){logger[_0xd394('0x29')]('OpenchannelMessage,\x20%s,\x20%s',_0x4054f8,_0x30d48a);_0x459cc9(_0x30d48a);});});}function respondWithStatusCode(_0x4de64d,_0x2486d3){_0x2486d3=_0x2486d3||0xcc;return function(_0x368590){if(_0x368590){return _0x4de64d[_0xd394('0x2d')](_0x2486d3);}return _0x4de64d[_0xd394('0x2e')](_0x2486d3)[_0xd394('0x2f')]();};}function respondWithResult(_0x20e51c,_0x4c4759){_0x4c4759=_0x4c4759||0xc8;return function(_0x3bdf7d){if(_0x3bdf7d){return _0x20e51c[_0xd394('0x2e')](_0x4c4759)[_0xd394('0x30')](_0x3bdf7d);}};}function respondWithFilteredResult(_0x4a1820,_0x1e1614){return function(_0x2f5e3e){if(_0x2f5e3e){var _0x57d589=_0x2f5e3e[_0xd394('0x31')],_0x49d4eb=_0x1e1614['offset'],_0x27e811=_0x1e1614['offset']+_0x1e1614[_0xd394('0x32')],_0x19df38;if(_0x27e811>=_0x57d589){_0x27e811=_0x57d589;_0x19df38=0xc8;}else{_0x19df38=0xce;}_0x4a1820[_0xd394('0x2e')](_0x19df38);return _0x4a1820['set'](_0xd394('0x33'),_0x49d4eb+'-'+_0x27e811+'/'+_0x57d589)[_0xd394('0x30')](_0x2f5e3e);}return null;};}function patchUpdates(_0x28658e){return function(_0x5cc157){try{jsonpatch['apply'](_0x5cc157,_0x28658e,!![]);}catch(_0x1664d5){return BPromise[_0xd394('0x34')](_0x1664d5);}return _0x5cc157[_0xd394('0x35')]();};}function saveUpdates(_0x2a45a8,_0x32556f){return function(_0x40149d){if(_0x40149d){return _0x40149d[_0xd394('0x36')](_0x2a45a8)[_0xd394('0x23')](function(_0x6d8fda){return _0x6d8fda;});}return null;};}function removeEntity(_0x2f710e,_0x371fa5){return function(_0x107046){if(_0x107046){return _0x107046[_0xd394('0x37')]()[_0xd394('0x23')](function(){_0x2f710e['status'](0xcc)[_0xd394('0x2f')]();});}};}function handleEntityNotFound(_0x5e57d0,_0x8d6043){return function(_0x361178){if(!_0x361178){_0x5e57d0[_0xd394('0x2d')](0x194);}return _0x361178;};}function handleError(_0x2fbdad,_0x456258){_0x456258=_0x456258||0x1f4;return function(_0x1d9f3a){logger[_0xd394('0x29')](_0x1d9f3a['stack']);if(_0x1d9f3a[_0xd394('0x38')]){delete _0x1d9f3a[_0xd394('0x38')];}_0x2fbdad[_0xd394('0x2e')](_0x456258)[_0xd394('0x39')](_0x1d9f3a);};}exports['index']=function(_0x802b2f,_0x144619){var _0x50482e={},_0x47c62d={},_0x11633c={'count':0x0,'rows':[]};var _0xac0fd=_[_0xd394('0x3a')](db['OpenchannelMessage'][_0xd394('0x3b')],function(_0x4e9642){return{'name':_0x4e9642[_0xd394('0x3c')],'type':_0x4e9642['type'][_0xd394('0x3d')]};});_0x47c62d[_0xd394('0x3e')]=_[_0xd394('0x3a')](_0xac0fd,_0xd394('0x38'));_0x47c62d['query']=_[_0xd394('0x3f')](_0x802b2f[_0xd394('0x40')]);_0x47c62d[_0xd394('0x41')]=_['intersection'](_0x47c62d['model'],_0x47c62d['query']);_0x50482e[_0xd394('0x42')]=_[_0xd394('0x43')](_0x47c62d[_0xd394('0x3e')],qs['fields'](_0x802b2f[_0xd394('0x40')][_0xd394('0x44')]));_0x50482e[_0xd394('0x42')]=_0x50482e[_0xd394('0x42')][_0xd394('0x45')]?_0x50482e[_0xd394('0x42')]:_0x47c62d[_0xd394('0x3e')];if(!_0x802b2f[_0xd394('0x40')]['hasOwnProperty'](_0xd394('0x46'))){_0x50482e['limit']=qs[_0xd394('0x32')](_0x802b2f[_0xd394('0x40')][_0xd394('0x32')]);_0x50482e[_0xd394('0x47')]=qs[_0xd394('0x47')](_0x802b2f[_0xd394('0x40')]['offset']);}_0x50482e[_0xd394('0x48')]=qs[_0xd394('0x49')](_0x802b2f[_0xd394('0x40')]['sort']);_0x50482e[_0xd394('0x4a')]=qs[_0xd394('0x41')](_[_0xd394('0x4b')](_0x802b2f['query'],_0x47c62d[_0xd394('0x41')]));if(_0x802b2f[_0xd394('0x40')][_0xd394('0x4c')]){_0x50482e['where']=_[_0xd394('0x4d')](_0x50482e[_0xd394('0x4a')],{'$or':_['map'](_0xac0fd,function(_0x1409fc){if(_0x1409fc['type']!==_0xd394('0x4e')){var _0x4dc6e3={};_0x4dc6e3[_0x1409fc[_0xd394('0x38')]]={'$like':'%'+_0x802b2f[_0xd394('0x40')][_0xd394('0x4c')]+'%'};return _0x4dc6e3;}})});}_0x50482e=_[_0xd394('0x4d')]({},_0x50482e,_0x802b2f[_0xd394('0x4f')]);var _0x671f67={'where':_0x50482e['where']};return db['OpenchannelMessage'][_0xd394('0x31')](_0x671f67)[_0xd394('0x23')](function(_0x4af86c){_0x11633c[_0xd394('0x31')]=_0x4af86c;if(_0x802b2f[_0xd394('0x40')]['includeAll']){_0x50482e[_0xd394('0x50')]=[{'all':!![]}];}return db[_0xd394('0x51')][_0xd394('0x52')](_0x50482e);})['then'](function(_0x29c51c){_0x11633c[_0xd394('0x53')]=_0x29c51c;return _0x11633c;})[_0xd394('0x23')](respondWithFilteredResult(_0x144619,_0x50482e))[_0xd394('0x2c')](handleError(_0x144619,null));};exports[_0xd394('0x54')]=function(_0x122b8c,_0x114d56){var _0x1ce969={'raw':!![],'where':{'id':_0x122b8c['params']['id']}},_0x115cd3={};_0x115cd3[_0xd394('0x3e')]=_[_0xd394('0x3f')](db[_0xd394('0x51')][_0xd394('0x3b')]);_0x115cd3[_0xd394('0x40')]=_['keys'](_0x122b8c['query']);_0x115cd3[_0xd394('0x41')]=_['intersection'](_0x115cd3['model'],_0x115cd3['query']);_0x1ce969[_0xd394('0x42')]=_[_0xd394('0x43')](_0x115cd3[_0xd394('0x3e')],qs[_0xd394('0x44')](_0x122b8c[_0xd394('0x40')]['fields']));_0x1ce969[_0xd394('0x42')]=_0x1ce969[_0xd394('0x42')]['length']?_0x1ce969[_0xd394('0x42')]:_0x115cd3[_0xd394('0x3e')];if(_0x122b8c['query'][_0xd394('0x55')]){_0x1ce969['include']=[{'all':!![]}];}_0x1ce969=_[_0xd394('0x4d')]({},_0x1ce969,_0x122b8c[_0xd394('0x4f')]);return db[_0xd394('0x51')][_0xd394('0x56')](_0x1ce969)['then'](handleEntityNotFound(_0x114d56,null))[_0xd394('0x23')](respondWithResult(_0x114d56,null))[_0xd394('0x2c')](handleError(_0x114d56,null));};exports[_0xd394('0x57')]=function(_0x493190,_0xbac22e){return db['OpenchannelMessage'][_0xd394('0x57')](_0x493190[_0xd394('0x58')],{})['then'](respondWithResult(_0xbac22e,0xc9))[_0xd394('0x2c')](handleError(_0xbac22e,null));};exports['update']=function(_0x594473,_0x101ddf){if(_0x594473['body']['id']){delete _0x594473[_0xd394('0x58')]['id'];}return db[_0xd394('0x51')][_0xd394('0x56')]({'where':{'id':_0x594473[_0xd394('0x59')]['id']}})[_0xd394('0x23')](handleEntityNotFound(_0x101ddf,null))[_0xd394('0x23')](saveUpdates(_0x594473[_0xd394('0x58')],null))[_0xd394('0x23')](respondWithResult(_0x101ddf,null))[_0xd394('0x2c')](handleError(_0x101ddf,null));};exports[_0xd394('0x37')]=function(_0x796693,_0x22d8fb){return db['OpenchannelMessage'][_0xd394('0x56')]({'where':{'id':_0x796693['params']['id']}})[_0xd394('0x23')](handleEntityNotFound(_0x22d8fb,null))[_0xd394('0x23')](removeEntity(_0x22d8fb,null))[_0xd394('0x2c')](handleError(_0x22d8fb,null));};exports[_0xd394('0x5a')]=function(_0x46cbcf,_0x49edba){return db[_0xd394('0x51')]['describe']()['then'](respondWithResult(_0x49edba,null))[_0xd394('0x2c')](handleError(_0x49edba,null));};var interaction_log=require(_0xd394('0x13'))(_0xd394('0x5b'));exports['accept']=function(_0x31a3b6,_0x2e6157,_0x210b40){var _0x3979ed={'channel':'openchannel'};if(_0x31a3b6[_0xd394('0x58')]['id']){delete _0x31a3b6[_0xd394('0x58')]['id'];}_0x31a3b6['body'][_0xd394('0x5c')]=!![];_0x31a3b6[_0xd394('0x58')][_0xd394('0x5d')]=moment()[_0xd394('0x5e')](_0xd394('0x5f'));_0x31a3b6[_0xd394('0x58')][_0xd394('0x60')]=_0x31a3b6['body']['UserId']||_0x31a3b6['user']['id'];return db[_0xd394('0x51')][_0xd394('0x56')]({'where':{'id':_0x31a3b6[_0xd394('0x59')]['id'],'UserId':null},'include':[{'model':db[_0xd394('0x61')],'as':_0xd394('0x62')}]})[_0xd394('0x23')](handleEntityNotFound(_0x2e6157,null))['then'](saveUpdates(_0x31a3b6['body'],null))[_0xd394('0x23')](function(_0x116e7f){if(_0x116e7f){_0x3979ed['message']=_0x116e7f[_0xd394('0x63')]({'plain':!![]});return db[_0xd394('0x64')][_0xd394('0x56')]({'where':{'id':_0x116e7f[_0xd394('0x65')]}});}return null;})[_0xd394('0x23')](handleEntityNotFound(_0x2e6157,null))[_0xd394('0x23')](function(_0x28602f){if(_0x28602f){return _0x28602f['update']({'UserId':_0x31a3b6[_0xd394('0x58')][_0xd394('0x60')],'read1stAt':_[_0xd394('0x66')](_0x28602f[_0xd394('0x67')])?moment()[_0xd394('0x5e')](_0xd394('0x5f')):undefined});}return null;})[_0xd394('0x23')](function(_0x41de5c){if(_0x41de5c){_0x3979ed[_0xd394('0x68')]=_0x41de5c[_0xd394('0x63')]({'plain':!![]});interaction_log[_0xd394('0x24')]('[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x31a3b6[_0xd394('0x69')]['id'],_0x31a3b6[_0xd394('0x69')]['name'],_0x31a3b6[_0xd394('0x69')]['role'],_0x3979ed[_0xd394('0x68')]['id'],_0x31a3b6[_0xd394('0x58')]?JSON[_0xd394('0x28')](_0x31a3b6[_0xd394('0x58')]):'null');return respondWithRpcPromise(_0xd394('0x6a'),_0xd394('0x6b'),_0x3979ed);}return null;})[_0xd394('0x23')](function(_0x31bf90){if(_0x31bf90){if(_0x31a3b6[_0xd394('0x58')]['manual']){_0x3979ed['message']['interface']=util['format'](_0xd394('0x6c'),_0x31a3b6[_0xd394('0x69')]['name']);_0x3979ed[_0xd394('0x2a')]['channel']=_0x3979ed['channel'];_0x3979ed[_0xd394('0x2a')][_0xd394('0x6d')]=_0xd394('0x6e');return respondWithRpcPromise(_0xd394('0x6f'),'EventManager',{'event':'acceptmessage','message':_0x3979ed['message']},client9002)[_0xd394('0x23')](function(){return _0x3979ed;});}return _0x3979ed;}return null;})[_0xd394('0x23')](respondWithResult(_0x2e6157,null))['catch'](handleError(_0x2e6157,null));};var interaction_log=require(_0xd394('0x13'))(_0xd394('0x5b'));exports[_0xd394('0x34')]=function(_0x444523,_0x25e3a3,_0x2eb043){var _0x379bf1={'agent':{},'channel':_0xd394('0x70')};if(_0x444523[_0xd394('0x58')]['id']){delete _0x444523[_0xd394('0x58')]['id'];}_0x444523[_0xd394('0x58')][_0xd394('0x60')]=_0x444523['body'][_0xd394('0x60')]||_0x444523[_0xd394('0x69')]['id'];_0x379bf1['agent']['id']=_0x444523[_0xd394('0x58')][_0xd394('0x60')];return db['OpenchannelMessage'][_0xd394('0x56')]({'where':{'id':_0x444523[_0xd394('0x59')]['id'],'UserId':null}})[_0xd394('0x23')](handleEntityNotFound(_0x25e3a3,null))[_0xd394('0x23')](function(_0x3cf58a){if(_0x3cf58a){_0x379bf1['message']=_0x3cf58a[_0xd394('0x63')]({'plain':!![]});return db['OpenchannelInteraction'][_0xd394('0x56')]({'where':{'id':_0x3cf58a[_0xd394('0x65')]}});}return null;})['then'](handleEntityNotFound(_0x25e3a3,null))[_0xd394('0x23')](function(_0x43f9df){if(_0x43f9df){_0x379bf1[_0xd394('0x68')]=_0x43f9df['get']({'plain':!![]});interaction_log['info'](_0xd394('0x71'),_0x444523[_0xd394('0x69')]['id'],_0x444523['user'][_0xd394('0x38')],_0x444523[_0xd394('0x69')][_0xd394('0x72')],_0x379bf1[_0xd394('0x68')]['id'],_0x444523[_0xd394('0x58')]?JSON[_0xd394('0x28')](_0x444523[_0xd394('0x58')]):_0xd394('0x73'));return respondWithRpcPromise(_0xd394('0x74'),'rejectMessage',_0x379bf1);}return null;})[_0xd394('0x23')](function(_0x22e57c){if(_0x22e57c){_0x22e57c['message'][_0xd394('0x75')]=util['format'](_0xd394('0x6c'),_0x444523[_0xd394('0x69')][_0xd394('0x38')]);_0x22e57c['message'][_0xd394('0x76')]=_0x379bf1[_0xd394('0x76')];_0x22e57c[_0xd394('0x2a')][_0xd394('0x6d')]=_0xd394('0x34');respondWithRpcPromise('EventManager',_0xd394('0x6f'),{'event':_0xd394('0x77'),'message':_0x22e57c[_0xd394('0x2a')]},client9002);return _0x379bf1;}return null;})[_0xd394('0x23')](respondWithResult(_0x25e3a3,null))[_0xd394('0x2c')](handleError(_0x25e3a3,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index 9a8023e..36b2659 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 _0xe6a6=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0x5bebfe,_0x5b1a52){var _0x182a8a=function(_0xe398fa){while(--_0xe398fa){_0x5bebfe['push'](_0x5bebfe['shift']());}};_0x182a8a(++_0x5b1a52);}(_0xe6a6,0x18b));var _0x6e6a=function(_0x3087cb,_0x360413){_0x3087cb=_0x3087cb-0x0;var _0x3256e7=_0xe6a6[_0x3087cb];return _0x3256e7;};'use strict';var EventEmitter=require('events');var OpenchannelMessage=require(_0x6e6a('0x0'))['db']['OpenchannelMessage'];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x6e6a('0x1')](0x0);var events={'afterCreate':_0x6e6a('0x2'),'afterUpdate':_0x6e6a('0x3'),'afterDestroy':_0x6e6a('0x4')};function emitEvent(_0x518818){return function(_0x3eeb3b,_0x172a68,_0x15c214){OpenchannelMessageEvents[_0x6e6a('0x5')](_0x518818+':'+_0x3eeb3b['id'],_0x3eeb3b);OpenchannelMessageEvents[_0x6e6a('0x5')](_0x518818,_0x3eeb3b);_0x15c214(null);};}for(var e in events){if(events[_0x6e6a('0x6')](e)){var event=events[e];OpenchannelMessage[_0x6e6a('0x7')](e,emitEvent(event));}}module[_0x6e6a('0x8')]=OpenchannelMessageEvents; \ No newline at end of file +var _0x8512=['exports','events','../../mysqldb','setMaxListeners','save','emit','hook'];(function(_0x1698df,_0x37d2a1){var _0x47da8f=function(_0x5d2332){while(--_0x5d2332){_0x1698df['push'](_0x1698df['shift']());}};_0x47da8f(++_0x37d2a1);}(_0x8512,0xcc));var _0x2851=function(_0x21b974,_0x37fad9){_0x21b974=_0x21b974-0x0;var _0x261af0=_0x8512[_0x21b974];return _0x261af0;};'use strict';var EventEmitter=require(_0x2851('0x0'));var OpenchannelMessage=require(_0x2851('0x1'))['db']['OpenchannelMessage'];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x2851('0x2')](0x0);var events={'afterCreate':_0x2851('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x29ad93){return function(_0xaff03f,_0x1e7144,_0x29fbee){OpenchannelMessageEvents[_0x2851('0x4')](_0x29ad93+':'+_0xaff03f['id'],_0xaff03f);OpenchannelMessageEvents[_0x2851('0x4')](_0x29ad93,_0xaff03f);_0x29fbee(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelMessage[_0x2851('0x5')](e,emitEvent(event));}}module[_0x2851('0x6')]=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index 7bf6fd0..a756305 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 _0x17dd=['error','CmContact','OpenchannelAccount','find','OpenchannelAccountId','OpenchannelInteraction','Contact','keys','get','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','Forwarding\x20message\x20%d\x20to\x20%s','Interactions','length','Interaction','omit','method','GET','POST','threadId','catch','inspect','finally','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelMessage.attributes','define','OpenchannelMessage','openchannel_messages','body','FULLTEXT','models','direction','toLowerCase','out','secret','UserId','findOne','OpenchannelInteractionId','then','update','createdAt'];(function(_0x5b1db5,_0x559cd7){var _0x39995c=function(_0x18c72f){while(--_0x18c72f){_0x5b1db5['push'](_0x5b1db5['shift']());}};_0x39995c(++_0x559cd7);}(_0x17dd,0x7f));var _0xd17d=function(_0x48e88c,_0x4ede23){_0x48e88c=_0x48e88c-0x0;var _0x37dd62=_0x17dd[_0x48e88c];return _0x37dd62;};'use strict';var _=require(_0xd17d('0x0'));var util=require('util');var logger=require(_0xd17d('0x1'))(_0xd17d('0x2'));var moment=require(_0xd17d('0x3'));var BPromise=require(_0xd17d('0x4'));var rp=require(_0xd17d('0x5'));var fs=require('fs');var path=require(_0xd17d('0x6'));var rimraf=require(_0xd17d('0x7'));var config=require(_0xd17d('0x8'));var attributes=require(_0xd17d('0x9'));module['exports']=function(_0x1b34ae,_0x26270e){return _0x1b34ae[_0xd17d('0xa')](_0xd17d('0xb'),attributes,{'tableName':_0xd17d('0xc'),'paranoid':![],'indexes':[{'name':'fti_openchannel_messages','fields':[_0xd17d('0xd')],'type':_0xd17d('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3c8097,_0x5a604a,_0x3bff6f){var _0x52995b=_0x1b34ae[_0xd17d('0xf')];var _0x23e732=_0x3c8097['get']({'plain':!![]});if(_0x23e732[_0xd17d('0x10')][_0xd17d('0x11')]()==='in'||_0x23e732['direction']['toLowerCase']()===_0xd17d('0x12')&&!_0x23e732[_0xd17d('0x13')]&&!_['isNil'](_0x23e732[_0xd17d('0x14')])){_0x52995b['OpenchannelInteraction'][_0xd17d('0x15')]({'where':{'id':_0x23e732[_0xd17d('0x16')]}})[_0xd17d('0x17')](function(_0x381524){if(_0x381524){_0x381524[_0xd17d('0x18')]({'lastMsgAt':_0x23e732[_0xd17d('0x19')],'lastMsgDirection':_0x23e732[_0xd17d('0x10')][_0xd17d('0x11')]()});}})['catch'](function(_0x5dc94e){console[_0xd17d('0x1a')](_0x5dc94e);});}if(_0x23e732[_0xd17d('0x10')]===_0xd17d('0x12')&&!_0x23e732[_0xd17d('0x13')]){var _0x48e29a;_0x52995b[_0xd17d('0x1b')]['describe']()[_0xd17d('0x17')](function(_0x1fab75){return _0x52995b[_0xd17d('0x1c')][_0xd17d('0x1d')]({'where':{'id':_0x23e732[_0xd17d('0x1e')]},'include':[{'model':_0x52995b[_0xd17d('0x1f')],'as':'Interactions','where':{'id':_0x23e732[_0xd17d('0x16')]},'limit':0x1,'include':[{'model':_0x52995b[_0xd17d('0x1b')],'as':_0xd17d('0x20'),'attributes':_[_0xd17d('0x21')](_0x1fab75)}]}]});})[_0xd17d('0x17')](function(_0x481a68){_0x48e29a=_0x481a68[_0xd17d('0x22')]({'plain':!![]});if(_0x48e29a&&_0x48e29a[_0xd17d('0x23')]){logger[_0xd17d('0x24')](_0xd17d('0x25'),_0xd17d('0x26'),util['format'](_0xd17d('0x27'),_0x23e732['id'],_0x48e29a[_0xd17d('0x23')]));if(_0x48e29a[_0xd17d('0x28')]&&_0x48e29a[_0xd17d('0x28')][_0xd17d('0x29')]){_0x23e732[_0xd17d('0x2a')]=_[_0xd17d('0x2b')](_0x48e29a[_0xd17d('0x28')][0x0],_0xd17d('0x20'));_0x23e732['Contact']=_0x48e29a[_0xd17d('0x28')][0x0][_0xd17d('0x20')];}var _0x5a604a={'method':'POST','uri':encodeURI(_0x48e29a['replyUri']),'json':!![],'resolveWithFullResponse':!![]};switch(_0x5a604a[_0xd17d('0x2c')]){case _0xd17d('0x2d'):_0x5a604a['qs']=_0x23e732;break;case _0xd17d('0x2e'):_0x5a604a[_0xd17d('0xd')]=_0x23e732;break;}return rp(_0x5a604a)[_0xd17d('0x17')](function(_0x4b37b0){logger['info'](_0xd17d('0x25'),'afterCreate',util['format']('Message\x20%d\x20forwarded\x20to\x20%s',_0x23e732['id'],_0x48e29a[_0xd17d('0x23')]));if(_0x4b37b0['body'][_0xd17d('0x2f')]&&_0x4b37b0['body'][_0xd17d('0x2f')]!=_0x23e732[_0xd17d('0x2a')][_0xd17d('0x2f')]){return _0x52995b[_0xd17d('0x1f')][_0xd17d('0x18')]({'threadId':_0x4b37b0[_0xd17d('0xd')]['threadId']},{'logging':!![],'where':{'id':_0x23e732[_0xd17d('0x2a')]['id']}});}else{return;}})['then'](function(){return _0x3c8097['update']({'read':!![]});})[_0xd17d('0x30')](function(_0x538c93){logger[_0xd17d('0x1a')](_0xd17d('0x25'),'afterCreate',util[_0xd17d('0x31')](_0x538c93,{'showHidden':![],'depth':null}));_0x3bff6f();});}else{_0x3bff6f();}})[_0xd17d('0x32')](function(){_0x3bff6f();});}else{_0x3bff6f();}}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xcf3e=['isNil','UserId','findOne','OpenchannelInteractionId','then','update','catch','error','CmContact','OpenchannelAccount','OpenchannelAccountId','OpenchannelInteraction','Interactions','keys','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','omit','Contact','POST','method','GET','Message\x20%d\x20forwarded\x20to\x20%s','threadId','Interaction','finally','utf8mb4_unicode_ci','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelMessage.attributes','exports','define','fti_openchannel_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret'];(function(_0x4154a6,_0x2c0b8e){var _0x3b2786=function(_0x2f5936){while(--_0x2f5936){_0x4154a6['push'](_0x4154a6['shift']());}};_0x3b2786(++_0x2c0b8e);}(_0xcf3e,0x1d7));var _0xecf3=function(_0x2a77eb,_0x26d237){_0x2a77eb=_0x2a77eb-0x0;var _0x291423=_0xcf3e[_0x2a77eb];return _0x291423;};'use strict';var _=require('lodash');var util=require(_0xecf3('0x0'));var logger=require('../../config/logger')(_0xecf3('0x1'));var moment=require('moment');var BPromise=require(_0xecf3('0x2'));var rp=require(_0xecf3('0x3'));var fs=require('fs');var path=require(_0xecf3('0x4'));var rimraf=require(_0xecf3('0x5'));var config=require(_0xecf3('0x6'));var attributes=require(_0xecf3('0x7'));module[_0xecf3('0x8')]=function(_0x173646,_0x226be8){return _0x173646[_0xecf3('0x9')]('OpenchannelMessage',attributes,{'tableName':'openchannel_messages','paranoid':![],'indexes':[{'name':_0xecf3('0xa'),'fields':[_0xecf3('0xb')],'type':_0xecf3('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5c2bb2,_0x20cc9b,_0x2484fe){var _0x6281c3=_0x173646[_0xecf3('0xd')];var _0x595628=_0x5c2bb2[_0xecf3('0xe')]({'plain':!![]});if(_0x595628[_0xecf3('0xf')]['toLowerCase']()==='in'||_0x595628[_0xecf3('0xf')][_0xecf3('0x10')]()===_0xecf3('0x11')&&!_0x595628[_0xecf3('0x12')]&&!_[_0xecf3('0x13')](_0x595628[_0xecf3('0x14')])){_0x6281c3['OpenchannelInteraction'][_0xecf3('0x15')]({'where':{'id':_0x595628[_0xecf3('0x16')]}})[_0xecf3('0x17')](function(_0x4095cf){if(_0x4095cf){_0x4095cf[_0xecf3('0x18')]({'lastMsgAt':_0x595628['createdAt'],'lastMsgDirection':_0x595628[_0xecf3('0xf')][_0xecf3('0x10')]()});}})[_0xecf3('0x19')](function(_0x51e2ed){console[_0xecf3('0x1a')](_0x51e2ed);});}if(_0x595628['direction']===_0xecf3('0x11')&&!_0x595628[_0xecf3('0x12')]){var _0x22952d;_0x6281c3[_0xecf3('0x1b')]['describe']()[_0xecf3('0x17')](function(_0x13bf33){return _0x6281c3[_0xecf3('0x1c')]['find']({'where':{'id':_0x595628[_0xecf3('0x1d')]},'include':[{'model':_0x6281c3[_0xecf3('0x1e')],'as':_0xecf3('0x1f'),'where':{'id':_0x595628['OpenchannelInteractionId']},'limit':0x1,'include':[{'model':_0x6281c3[_0xecf3('0x1b')],'as':'Contact','attributes':_[_0xecf3('0x20')](_0x13bf33)}]}]});})[_0xecf3('0x17')](function(_0x54f682){_0x22952d=_0x54f682['get']({'plain':!![]});if(_0x22952d&&_0x22952d[_0xecf3('0x21')]){logger[_0xecf3('0x22')](_0xecf3('0x23'),_0xecf3('0x24'),util[_0xecf3('0x25')](_0xecf3('0x26'),_0x595628['id'],_0x22952d[_0xecf3('0x21')]));if(_0x22952d[_0xecf3('0x1f')]&&_0x22952d['Interactions']['length']){_0x595628['Interaction']=_[_0xecf3('0x27')](_0x22952d[_0xecf3('0x1f')][0x0],_0xecf3('0x28'));_0x595628['Contact']=_0x22952d[_0xecf3('0x1f')][0x0]['Contact'];}var _0x20cc9b={'method':_0xecf3('0x29'),'uri':encodeURI(_0x22952d['replyUri']),'json':!![],'resolveWithFullResponse':!![]};switch(_0x20cc9b[_0xecf3('0x2a')]){case _0xecf3('0x2b'):_0x20cc9b['qs']=_0x595628;break;case _0xecf3('0x29'):_0x20cc9b[_0xecf3('0xb')]=_0x595628;break;}return rp(_0x20cc9b)[_0xecf3('0x17')](function(_0xb5f0a8){logger['info'](_0xecf3('0x23'),_0xecf3('0x24'),util[_0xecf3('0x25')](_0xecf3('0x2c'),_0x595628['id'],_0x22952d[_0xecf3('0x21')]));if(_0xb5f0a8[_0xecf3('0xb')]['threadId']&&_0xb5f0a8[_0xecf3('0xb')][_0xecf3('0x2d')]!=_0x595628[_0xecf3('0x2e')][_0xecf3('0x2d')]){return _0x6281c3[_0xecf3('0x1e')][_0xecf3('0x18')]({'threadId':_0xb5f0a8[_0xecf3('0xb')][_0xecf3('0x2d')]},{'logging':!![],'where':{'id':_0x595628[_0xecf3('0x2e')]['id']}});}else{return;}})[_0xecf3('0x17')](function(){return _0x5c2bb2['update']({'read':!![]});})[_0xecf3('0x19')](function(_0x425490){logger[_0xecf3('0x1a')]('OpenchannelMessage,\x20%s,\x20%s',_0xecf3('0x24'),util['inspect'](_0x425490,{'showHidden':![],'depth':null}));_0x2484fe();});}else{_0x2484fe();}})[_0xecf3('0x2f')](function(){_0x2484fe();});}else{_0x2484fe();}}},'charset':'utf8mb4','collate':_0xecf3('0x30')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index f6e2faa..dbce175 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 _0x6050=['moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','http','localhost','socket.io-emitter','redis','./openchannelMessage.socket','register','request','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateOpenchannelMessage','OpenchannelMessage','create','body','options','raw','lodash','util'];(function(_0x32f70c,_0x53af77){var _0x78375e=function(_0x4268e3){while(--_0x4268e3){_0x32f70c['push'](_0x32f70c['shift']());}};_0x78375e(++_0x53af77);}(_0x6050,0x196));var _0x0605=function(_0x4c17b0,_0x44e5a7){_0x4c17b0=_0x4c17b0-0x0;var _0x4857f3=_0x6050[_0x4c17b0];return _0x4857f3;};'use strict';var _=require(_0x0605('0x0'));var util=require(_0x0605('0x1'));var moment=require(_0x0605('0x2'));var BPromise=require(_0x0605('0x3'));var rs=require(_0x0605('0x4'));var fs=require('fs');var Redis=require(_0x0605('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x0605('0x6'));var logger=require(_0x0605('0x7'))(_0x0605('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x0605('0x9')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0x0605('0xa'),'port':0x18eb});var socket=require(_0x0605('0xb'))(new Redis(config[_0x0605('0xc')]));require(_0x0605('0xd'))[_0x0605('0xe')](socket);function respondWithRpcPromise(_0x52bb63,_0x1882e6,_0x23dc2b){return new BPromise(function(_0xe54b22,_0x2c5e23){return client[_0x0605('0xf')](_0x52bb63,_0x23dc2b)[_0x0605('0x10')](function(_0x4385d3){logger[_0x0605('0x11')](_0x0605('0x12'),_0x1882e6,_0x0605('0x13'));logger[_0x0605('0x14')](_0x0605('0x15'),_0x1882e6,_0x0605('0x13'),JSON[_0x0605('0x16')](_0x4385d3));if(_0x4385d3[_0x0605('0x17')]){if(_0x4385d3[_0x0605('0x17')][_0x0605('0x18')]===0x1f4){logger[_0x0605('0x17')](_0x0605('0x12'),_0x1882e6,_0x4385d3['error'][_0x0605('0x19')]);return _0x2c5e23(_0x4385d3[_0x0605('0x17')][_0x0605('0x19')]);}logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x1882e6,_0x4385d3[_0x0605('0x17')][_0x0605('0x19')]);return _0xe54b22(_0x4385d3[_0x0605('0x17')][_0x0605('0x19')]);}else{logger[_0x0605('0x11')](_0x0605('0x12'),_0x1882e6,_0x0605('0x13'));_0xe54b22(_0x4385d3[_0x0605('0x1a')][_0x0605('0x19')]);}})[_0x0605('0x1b')](function(_0x3a22e9){logger[_0x0605('0x17')](_0x0605('0x12'),_0x1882e6,_0x3a22e9);_0x2c5e23(_0x3a22e9);});});}exports[_0x0605('0x1c')]=function(_0x59bc87){var _0x254020=this;return new Promise(function(_0x14a920,_0x430f28){return db[_0x0605('0x1d')][_0x0605('0x1e')](_0x59bc87[_0x0605('0x1f')],{'raw':_0x59bc87[_0x0605('0x20')]?_0x59bc87[_0x0605('0x20')][_0x0605('0x21')]===undefined?!![]:![]:!![]})['then'](function(_0xc334b8){logger['info'](_0x0605('0x1c'),_0x59bc87);logger[_0x0605('0x14')](_0x0605('0x1c'),_0x59bc87,JSON[_0x0605('0x16')](_0xc334b8));_0x14a920(_0xc334b8);})[_0x0605('0x1b')](function(_0xb4d805){logger[_0x0605('0x17')](_0x0605('0x1c'),_0xb4d805[_0x0605('0x19')],_0x59bc87);_0x430f28(_0x254020[_0x0605('0x17')](0x1f4,_0xb4d805[_0x0605('0x19')]));});});}; \ No newline at end of file +var _0x11c1=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateOpenchannelMessage','OpenchannelMessage','body','options','then','lodash','moment','bluebird'];(function(_0x1a71b3,_0x560f48){var _0x136d4d=function(_0x5f0abc){while(--_0x5f0abc){_0x1a71b3['push'](_0x1a71b3['shift']());}};_0x136d4d(++_0x560f48);}(_0x11c1,0x1cb));var _0x111c=function(_0x420fcc,_0x2f6284){_0x420fcc=_0x420fcc-0x0;var _0x32351c=_0x11c1[_0x420fcc];return _0x32351c;};'use strict';var _=require(_0x111c('0x0'));var util=require('util');var moment=require(_0x111c('0x1'));var BPromise=require(_0x111c('0x2'));var rs=require(_0x111c('0x3'));var fs=require('fs');var Redis=require(_0x111c('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x111c('0x5'));var logger=require(_0x111c('0x6'))(_0x111c('0x7'));var config=require(_0x111c('0x8'));var jayson=require(_0x111c('0x9'));var client=jayson[_0x111c('0xa')]['http']({'port':0x232a});config[_0x111c('0xb')]=_[_0x111c('0xc')](config[_0x111c('0xb')],{'host':_0x111c('0xd'),'port':0x18eb});var socket=require(_0x111c('0xe'))(new Redis(config[_0x111c('0xb')]));require(_0x111c('0xf'))[_0x111c('0x10')](socket);function respondWithRpcPromise(_0xb23a4c,_0x273726,_0x40eba4){return new BPromise(function(_0x4ab95c,_0x48e851){return client['request'](_0xb23a4c,_0x40eba4)['then'](function(_0x117dcb){logger[_0x111c('0x11')](_0x111c('0x12'),_0x273726,_0x111c('0x13'));logger[_0x111c('0x14')](_0x111c('0x15'),_0x273726,_0x111c('0x13'),JSON[_0x111c('0x16')](_0x117dcb));if(_0x117dcb[_0x111c('0x17')]){if(_0x117dcb[_0x111c('0x17')][_0x111c('0x18')]===0x1f4){logger[_0x111c('0x17')](_0x111c('0x12'),_0x273726,_0x117dcb[_0x111c('0x17')][_0x111c('0x19')]);return _0x48e851(_0x117dcb[_0x111c('0x17')][_0x111c('0x19')]);}logger[_0x111c('0x17')](_0x111c('0x12'),_0x273726,_0x117dcb['error']['message']);return _0x4ab95c(_0x117dcb['error'][_0x111c('0x19')]);}else{logger['info']('OpenchannelMessage,\x20%s,\x20%s',_0x273726,_0x111c('0x13'));_0x4ab95c(_0x117dcb[_0x111c('0x1a')][_0x111c('0x19')]);}})[_0x111c('0x1b')](function(_0x368802){logger[_0x111c('0x17')]('OpenchannelMessage,\x20%s,\x20%s',_0x273726,_0x368802);_0x48e851(_0x368802);});});}exports[_0x111c('0x1c')]=function(_0x38a66c){var _0x4a7a5d=this;return new Promise(function(_0x43a45d,_0x211de8){return db[_0x111c('0x1d')]['create'](_0x38a66c[_0x111c('0x1e')],{'raw':_0x38a66c[_0x111c('0x1f')]?_0x38a66c[_0x111c('0x1f')]['raw']===undefined?!![]:![]:!![]})[_0x111c('0x20')](function(_0x17d02b){logger[_0x111c('0x11')](_0x111c('0x1c'),_0x38a66c);logger[_0x111c('0x14')](_0x111c('0x1c'),_0x38a66c,JSON[_0x111c('0x16')](_0x17d02b));_0x43a45d(_0x17d02b);})[_0x111c('0x1b')](function(_0x9a580c){logger['error'](_0x111c('0x1c'),_0x9a580c['message'],_0x38a66c);_0x211de8(_0x4a7a5d[_0x111c('0x17')](0x1f4,_0x9a580c[_0x111c('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index f9ef5cf..53fd0d6 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 _0x70e0=['openchannelMessage:','./openchannelMessage.events','save','remove','emit','removeListener'];(function(_0xc5c7a5,_0x1c5205){var _0xae0b01=function(_0x376cd4){while(--_0x376cd4){_0xc5c7a5['push'](_0xc5c7a5['shift']());}};_0xae0b01(++_0x1c5205);}(_0x70e0,0x17b));var _0x070e=function(_0x2aff6f,_0x5bb4bb){_0x2aff6f=_0x2aff6f-0x0;var _0x2eb580=_0x70e0[_0x2aff6f];return _0x2eb580;};'use strict';var OpenchannelMessageEvents=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(){OpenchannelMessageEvents[_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);OpenchannelMessageEvents['on'](_0x35ab0c,_0x1e11f0);}}; \ No newline at end of file +var _0xac4a=['save','remove','update','removeListener','./openchannelMessage.events'];(function(_0x3ba9ec,_0x49c244){var _0x39f681=function(_0x5da9c0){while(--_0x5da9c0){_0x3ba9ec['push'](_0x3ba9ec['shift']());}};_0x39f681(++_0x49c244);}(_0xac4a,0x13f));var _0xaac4=function(_0x1096e9,_0x4d1491){_0x1096e9=_0x1096e9-0x0;var _0x1ccc41=_0xac4a[_0x1096e9];return _0x1ccc41;};'use strict';var OpenchannelMessageEvents=require(_0xaac4('0x0'));var events=[_0xaac4('0x1'),_0xaac4('0x2'),_0xaac4('0x3')];function createListener(_0x38f4f4,_0x1dc251){return function(_0x5aeb7d){_0x1dc251['emit'](_0x38f4f4,_0x5aeb7d);};}function removeListener(_0x2af0f6,_0x2a5762){return function(){OpenchannelMessageEvents[_0xaac4('0x4')](_0x2af0f6,_0x2a5762);};}exports['register']=function(_0x1283a5){for(var _0x53d03a=0x0,_0x1cdfc5=events['length'];_0x53d03a<_0x1cdfc5;_0x53d03a++){var _0x1e4283=events[_0x53d03a];var _0x27354c=createListener('openchannelMessage:'+_0x1e4283,_0x1283a5);OpenchannelMessageEvents['on'](_0x1e4283,_0x27354c);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 0ff5895..51fa0cf 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 _0x106f=['update','delete','destroy','removeTeams','removeAgents','exports','multer','util','connect-timeout','express','../../components/auth/service','../../config/environment','./openchannelQueue.controller','get','isAuthenticated','index','/describe','describe','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','/:id'];(function(_0x5a86da,_0x5cdde2){var _0x348bd3=function(_0x332a72){while(--_0x332a72){_0x5a86da['push'](_0x5a86da['shift']());}};_0x348bd3(++_0x5cdde2);}(_0x106f,0x162));var _0xf106=function(_0x54cf0d,_0x3732c2){_0x54cf0d=_0x54cf0d-0x0;var _0x4d292b=_0x106f[_0x54cf0d];return _0x4d292b;};'use strict';var multer=require(_0xf106('0x0'));var util=require(_0xf106('0x1'));var path=require('path');var timeout=require(_0xf106('0x2'));var express=require(_0xf106('0x3'));var router=express['Router']();var auth=require(_0xf106('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xf106('0x5'));var controller=require(_0xf106('0x6'));router[_0xf106('0x7')]('/',auth[_0xf106('0x8')](),controller[_0xf106('0x9')]);router[_0xf106('0x7')](_0xf106('0xa'),auth['isAuthenticated'](),controller[_0xf106('0xb')]);router[_0xf106('0x7')]('/:id',auth['isAuthenticated'](),controller['show']);router['get']('/:id/members',auth[_0xf106('0x8')](),controller[_0xf106('0xc')]);router[_0xf106('0x7')](_0xf106('0xd'),auth[_0xf106('0x8')](),controller[_0xf106('0xe')]);router[_0xf106('0x7')](_0xf106('0xf'),auth[_0xf106('0x8')](),controller[_0xf106('0x10')]);router[_0xf106('0x11')]('/',auth['isAuthenticated'](),controller[_0xf106('0x12')]);router[_0xf106('0x11')]('/:id/teams',auth['isAuthenticated'](),controller[_0xf106('0x13')]);router[_0xf106('0x11')](_0xf106('0xf'),auth['isAuthenticated'](),controller[_0xf106('0x14')]);router[_0xf106('0x15')](_0xf106('0x16'),auth['isAuthenticated'](),controller[_0xf106('0x17')]);router[_0xf106('0x18')]('/:id',auth[_0xf106('0x8')](),controller[_0xf106('0x19')]);router[_0xf106('0x18')]('/:id/teams',auth['isAuthenticated'](),controller[_0xf106('0x1a')]);router[_0xf106('0x18')](_0xf106('0xf'),auth['isAuthenticated'](),controller[_0xf106('0x1b')]);module[_0xf106('0x1c')]=router; \ No newline at end of file +var _0xcd05=['update','destroy','delete','removeAgents','exports','multer','express','Router','../../components/auth/service','../../components/interaction/service','./openchannelQueue.controller','get','/describe','isAuthenticated','describe','/:id','show','/:id/members','getMembers','getTeams','/:id/users','getAgents','post','create','addAgents'];(function(_0x58d090,_0x44abe5){var _0x47360e=function(_0x57309e){while(--_0x57309e){_0x58d090['push'](_0x58d090['shift']());}};_0x47360e(++_0x44abe5);}(_0xcd05,0x163));var _0x5cd0=function(_0x15e6fe,_0x1a5c39){_0x15e6fe=_0x15e6fe-0x0;var _0x34894d=_0xcd05[_0x15e6fe];return _0x34894d;};'use strict';var multer=require(_0x5cd0('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5cd0('0x1'));var router=express[_0x5cd0('0x2')]();var auth=require(_0x5cd0('0x3'));var interaction=require(_0x5cd0('0x4'));var config=require('../../config/environment');var controller=require(_0x5cd0('0x5'));router[_0x5cd0('0x6')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x5cd0('0x7'),auth[_0x5cd0('0x8')](),controller[_0x5cd0('0x9')]);router[_0x5cd0('0x6')](_0x5cd0('0xa'),auth[_0x5cd0('0x8')](),controller[_0x5cd0('0xb')]);router['get'](_0x5cd0('0xc'),auth[_0x5cd0('0x8')](),controller[_0x5cd0('0xd')]);router[_0x5cd0('0x6')]('/:id/teams',auth[_0x5cd0('0x8')](),controller[_0x5cd0('0xe')]);router[_0x5cd0('0x6')](_0x5cd0('0xf'),auth[_0x5cd0('0x8')](),controller[_0x5cd0('0x10')]);router[_0x5cd0('0x11')]('/',auth[_0x5cd0('0x8')](),controller[_0x5cd0('0x12')]);router[_0x5cd0('0x11')]('/:id/teams',auth['isAuthenticated'](),controller['addTeams']);router[_0x5cd0('0x11')](_0x5cd0('0xf'),auth['isAuthenticated'](),controller[_0x5cd0('0x13')]);router['put'](_0x5cd0('0xa'),auth[_0x5cd0('0x8')](),controller[_0x5cd0('0x14')]);router['delete']('/:id',auth[_0x5cd0('0x8')](),controller[_0x5cd0('0x15')]);router[_0x5cd0('0x16')]('/:id/teams',auth['isAuthenticated'](),controller['removeTeams']);router[_0x5cd0('0x16')](_0x5cd0('0xf'),auth['isAuthenticated'](),controller[_0x5cd0('0x17')]);module[_0x5cd0('0x18')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index 56a7fd7..03d4f3a 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 _0xa1c9=['name','INTEGER','ENUM','rrmemory','beepall','sequelize','exports','STRING'];(function(_0x47c28c,_0xda58f9){var _0x4b3012=function(_0x4ac294){while(--_0x4ac294){_0x47c28c['push'](_0x47c28c['shift']());}};_0x4b3012(++_0xda58f9);}(_0xa1c9,0x135));var _0x9a1c=function(_0x53eeac,_0x1babff){_0x53eeac=_0x53eeac-0x0;var _0x41dddf=_0xa1c9[_0x53eeac];return _0x41dddf;};'use strict';var Sequelize=require(_0x9a1c('0x0'));module[_0x9a1c('0x1')]={'name':{'type':Sequelize[_0x9a1c('0x2')],'unique':_0x9a1c('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x9a1c('0x2')]},'timeout':{'type':Sequelize[_0x9a1c('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x9a1c('0x5')](_0x9a1c('0x6'),_0x9a1c('0x7'),'roundrobin')}}; \ No newline at end of file +var _0xd72d=['ENUM','rrmemory','beepall','roundrobin','sequelize','STRING','INTEGER'];(function(_0x50f28c,_0x56b0c2){var _0x2659c0=function(_0x15397a){while(--_0x15397a){_0x50f28c['push'](_0x50f28c['shift']());}};_0x2659c0(++_0x56b0c2);}(_0xd72d,0x17e));var _0xdd72=function(_0x180955,_0x2bebf6){_0x180955=_0x180955-0x0;var _0x102e4c=_0xd72d[_0x180955];return _0x102e4c;};'use strict';var Sequelize=require(_0xdd72('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xdd72('0x1')]},'timeout':{'type':Sequelize[_0xdd72('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xdd72('0x3')](_0xdd72('0x4'),_0xdd72('0x5'),_0xdd72('0x6'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 63f8506..33c7de7 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 _0xf6fb=['compact','value','removeTeams','userOpenchannelQueue:remove','addAgents','spread','userOpenchannelQueue:save','removeAgents','getAgents','rimraf','zip-dir','request-promise','moment','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','redis','defaults','socket.io-emitter','./openchannelQueue.socket','register','sendStatus','status','end','count','offset','limit','Content-Range','apply','reject','save','then','destroy','get','UserProfileResource','error','name','index','map','OpenchannelQueue','rawAttributes','fieldName','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','rows','catch','show','params','keys','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','OpenchannelQueues','UserProfileSection','userProfileId','update','describe','getMembers','findOne','OpenchannelQueueId','UserOpenchannelQueue','findAll','User','findAndCountAll','UserId','agent','openchannelPause','updatedAt','format','SIP','createdAt','getTeams','addTeams','online','voicePause','interface','Agents','sequelize','transaction','each','findOrCreate','forEach','emit','ids','select','tq.TeamId','from','team_has_openchannel_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','QueryTypes','every','includes','all','union'];(function(_0x269e2d,_0x561780){var _0x42c9e2=function(_0x3c0dbb){while(--_0x3c0dbb){_0x269e2d['push'](_0x269e2d['shift']());}};_0x42c9e2(++_0x561780);}(_0xf6fb,0x111));var _0xbf6f=function(_0x30285a,_0x1de145){_0x30285a=_0x30285a-0x0;var _0x45023f=_0xf6fb[_0x30285a];return _0x45023f;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xbf6f('0x0'));var zipdir=require(_0xbf6f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbf6f('0x2'));var moment=require(_0xbf6f('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xbf6f('0x4'));var util=require('util');var path=require(_0xbf6f('0x5'));var sox=require(_0xbf6f('0x6'));var csv=require(_0xbf6f('0x7'));var ejs=require(_0xbf6f('0x8'));var fs=require('fs');var _=require(_0xbf6f('0x9'));var squel=require(_0xbf6f('0xa'));var crypto=require(_0xbf6f('0xb'));var jsforce=require(_0xbf6f('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xbf6f('0x7'));var querystring=require(_0xbf6f('0xd'));var Papa=require(_0xbf6f('0xe'));var Redis=require(_0xbf6f('0xf'));var authService=require(_0xbf6f('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbf6f('0x11'));var logger=require(_0xbf6f('0x12'))(_0xbf6f('0x13'));var utils=require('../../config/utils');var config=require(_0xbf6f('0x14'));var db=require('../../mysqldb')['db'];config[_0xbf6f('0x15')]=_[_0xbf6f('0x16')](config[_0xbf6f('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0xbf6f('0x17'))(new Redis(config[_0xbf6f('0x15')]));require(_0xbf6f('0x18'))[_0xbf6f('0x19')](socket);function respondWithStatusCode(_0xce557a,_0x1dd2f1){_0x1dd2f1=_0x1dd2f1||0xcc;return function(_0x5100d4){if(_0x5100d4){return _0xce557a[_0xbf6f('0x1a')](_0x1dd2f1);}return _0xce557a[_0xbf6f('0x1b')](_0x1dd2f1)[_0xbf6f('0x1c')]();};}function respondWithResult(_0x40ad56,_0x270ec6){_0x270ec6=_0x270ec6||0xc8;return function(_0x2abe87){if(_0x2abe87){return _0x40ad56[_0xbf6f('0x1b')](_0x270ec6)['json'](_0x2abe87);}};}function respondWithFilteredResult(_0x4b2006,_0x734fe8){return function(_0x1a37bd){if(_0x1a37bd){var _0x21b485=_0x1a37bd[_0xbf6f('0x1d')],_0x4b3c33=_0x734fe8[_0xbf6f('0x1e')],_0x56b4da=_0x734fe8[_0xbf6f('0x1e')]+_0x734fe8[_0xbf6f('0x1f')],_0x2a0537;if(_0x56b4da>=_0x21b485){_0x56b4da=_0x21b485;_0x2a0537=0xc8;}else{_0x2a0537=0xce;}_0x4b2006['status'](_0x2a0537);return _0x4b2006['set'](_0xbf6f('0x20'),_0x4b3c33+'-'+_0x56b4da+'/'+_0x21b485)['json'](_0x1a37bd);}return null;};}function patchUpdates(_0x3bd472){return function(_0x117a43){try{jsonpatch[_0xbf6f('0x21')](_0x117a43,_0x3bd472,!![]);}catch(_0x4e71e9){return BPromise[_0xbf6f('0x22')](_0x4e71e9);}return _0x117a43[_0xbf6f('0x23')]();};}function saveUpdates(_0x3a0087,_0x528bf0){return function(_0x446857){if(_0x446857){return _0x446857['update'](_0x3a0087)[_0xbf6f('0x24')](function(_0xb9e8bc){return _0xb9e8bc;});}return null;};}function removeEntity(_0xba4b6a,_0x49979a){return function(_0x28d8f6){if(_0x28d8f6){return _0x28d8f6[_0xbf6f('0x25')]()[_0xbf6f('0x24')](function(){var _0x17fe26=_0x28d8f6[_0xbf6f('0x26')]({'plain':!![]});var _0x442f60='OpenchannelQueues';return db[_0xbf6f('0x27')][_0xbf6f('0x25')]({'where':{'type':_0x442f60,'resourceId':_0x17fe26['id']}})['then'](function(){return _0x28d8f6;});})['then'](function(){_0xba4b6a['status'](0xcc)[_0xbf6f('0x1c')]();});}};}function handleEntityNotFound(_0x588fbe,_0x3588c0){return function(_0x153304){if(!_0x153304){_0x588fbe[_0xbf6f('0x1a')](0x194);}return _0x153304;};}function handleError(_0x34cd97,_0xb440e8){_0xb440e8=_0xb440e8||0x1f4;return function(_0x237b67){logger[_0xbf6f('0x28')](_0x237b67['stack']);if(_0x237b67['name']){delete _0x237b67[_0xbf6f('0x29')];}_0x34cd97[_0xbf6f('0x1b')](_0xb440e8)['send'](_0x237b67);};}exports[_0xbf6f('0x2a')]=function(_0x4f2430,_0x36ff7e){var _0x386911={},_0x7f92e9={},_0x44f7fe={'count':0x0,'rows':[]};var _0x37bf96=_[_0xbf6f('0x2b')](db[_0xbf6f('0x2c')][_0xbf6f('0x2d')],function(_0xed5db){return{'name':_0xed5db[_0xbf6f('0x2e')],'type':_0xed5db['type']['key']};});_0x7f92e9[_0xbf6f('0x2f')]=_[_0xbf6f('0x2b')](_0x37bf96,_0xbf6f('0x29'));_0x7f92e9[_0xbf6f('0x30')]=_['keys'](_0x4f2430[_0xbf6f('0x30')]);_0x7f92e9[_0xbf6f('0x31')]=_[_0xbf6f('0x32')](_0x7f92e9[_0xbf6f('0x2f')],_0x7f92e9[_0xbf6f('0x30')]);_0x386911['attributes']=_[_0xbf6f('0x32')](_0x7f92e9[_0xbf6f('0x2f')],qs[_0xbf6f('0x33')](_0x4f2430['query'][_0xbf6f('0x33')]));_0x386911['attributes']=_0x386911[_0xbf6f('0x34')][_0xbf6f('0x35')]?_0x386911[_0xbf6f('0x34')]:_0x7f92e9[_0xbf6f('0x2f')];if(!_0x4f2430[_0xbf6f('0x30')][_0xbf6f('0x36')](_0xbf6f('0x37'))){_0x386911[_0xbf6f('0x1f')]=qs[_0xbf6f('0x1f')](_0x4f2430[_0xbf6f('0x30')][_0xbf6f('0x1f')]);_0x386911[_0xbf6f('0x1e')]=qs['offset'](_0x4f2430[_0xbf6f('0x30')][_0xbf6f('0x1e')]);}_0x386911[_0xbf6f('0x38')]=qs[_0xbf6f('0x39')](_0x4f2430[_0xbf6f('0x30')][_0xbf6f('0x39')]);_0x386911[_0xbf6f('0x3a')]=qs['filters'](_[_0xbf6f('0x3b')](_0x4f2430[_0xbf6f('0x30')],_0x7f92e9[_0xbf6f('0x31')]));if(_0x4f2430['query'][_0xbf6f('0x3c')]){_0x386911[_0xbf6f('0x3a')]=_[_0xbf6f('0x3d')](_0x386911['where'],{'$or':_[_0xbf6f('0x2b')](_0x37bf96,function(_0x26da28){if(_0x26da28[_0xbf6f('0x3e')]!==_0xbf6f('0x3f')){var _0x30732c={};_0x30732c[_0x26da28[_0xbf6f('0x29')]]={'$like':'%'+_0x4f2430[_0xbf6f('0x30')][_0xbf6f('0x3c')]+'%'};return _0x30732c;}})});}_0x386911=_[_0xbf6f('0x3d')]({},_0x386911,_0x4f2430[_0xbf6f('0x40')]);var _0x126376={'where':_0x386911[_0xbf6f('0x3a')]};return db[_0xbf6f('0x2c')][_0xbf6f('0x1d')](_0x126376)['then'](function(_0x30f8ce){_0x44f7fe['count']=_0x30f8ce;if(_0x4f2430[_0xbf6f('0x30')][_0xbf6f('0x41')]){_0x386911['include']=[{'all':!![]}];}return db[_0xbf6f('0x2c')]['findAll'](_0x386911);})[_0xbf6f('0x24')](function(_0x186757){_0x44f7fe[_0xbf6f('0x42')]=_0x186757;return _0x44f7fe;})[_0xbf6f('0x24')](respondWithFilteredResult(_0x36ff7e,_0x386911))[_0xbf6f('0x43')](handleError(_0x36ff7e,null));};exports[_0xbf6f('0x44')]=function(_0x3b5f5b,_0x2f184a){var _0x39727e={'raw':!![],'where':{'id':_0x3b5f5b[_0xbf6f('0x45')]['id']}},_0x1c5c1d={};_0x1c5c1d[_0xbf6f('0x2f')]=_[_0xbf6f('0x46')](db[_0xbf6f('0x2c')][_0xbf6f('0x2d')]);_0x1c5c1d[_0xbf6f('0x30')]=_[_0xbf6f('0x46')](_0x3b5f5b[_0xbf6f('0x30')]);_0x1c5c1d[_0xbf6f('0x31')]=_[_0xbf6f('0x32')](_0x1c5c1d[_0xbf6f('0x2f')],_0x1c5c1d['query']);_0x39727e[_0xbf6f('0x34')]=_[_0xbf6f('0x32')](_0x1c5c1d['model'],qs[_0xbf6f('0x33')](_0x3b5f5b[_0xbf6f('0x30')][_0xbf6f('0x33')]));_0x39727e[_0xbf6f('0x34')]=_0x39727e['attributes'][_0xbf6f('0x35')]?_0x39727e['attributes']:_0x1c5c1d[_0xbf6f('0x2f')];if(_0x3b5f5b[_0xbf6f('0x30')][_0xbf6f('0x41')]){_0x39727e[_0xbf6f('0x47')]=[{'all':!![]}];}_0x39727e=_[_0xbf6f('0x3d')]({},_0x39727e,_0x3b5f5b['options']);return db[_0xbf6f('0x2c')][_0xbf6f('0x48')](_0x39727e)[_0xbf6f('0x24')](handleEntityNotFound(_0x2f184a,null))[_0xbf6f('0x24')](respondWithResult(_0x2f184a,null))['catch'](handleError(_0x2f184a,null));};exports['create']=function(_0x3b62e5,_0x89536e){return db[_0xbf6f('0x2c')][_0xbf6f('0x49')](_0x3b62e5[_0xbf6f('0x4a')],{})[_0xbf6f('0x24')](function(_0x4a5ee8){var _0x396272=_0x3b62e5[_0xbf6f('0x4b')][_0xbf6f('0x26')]({'plain':!![]});if(!_0x396272)throw new Error(_0xbf6f('0x4c'));if(_0x396272[_0xbf6f('0x4d')]===_0xbf6f('0x4b')){var _0x4a293=_0x4a5ee8[_0xbf6f('0x26')]({'plain':!![]});var _0x1ed880=_0xbf6f('0x4e');return db[_0xbf6f('0x4f')][_0xbf6f('0x48')]({'where':{'name':_0x1ed880,'userProfileId':_0x396272[_0xbf6f('0x50')]},'raw':!![]})[_0xbf6f('0x24')](function(_0xa5edf3){if(_0xa5edf3&&_0xa5edf3['autoAssociation']===0x0){return db[_0xbf6f('0x27')][_0xbf6f('0x49')]({'name':_0x4a293['name'],'resourceId':_0x4a293['id'],'type':_0xa5edf3[_0xbf6f('0x29')],'sectionId':_0xa5edf3['id']},{})[_0xbf6f('0x24')](function(){return _0x4a5ee8;});}else{return _0x4a5ee8;}})[_0xbf6f('0x43')](function(_0x45afea){logger[_0xbf6f('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x45afea);throw _0x45afea;});}return _0x4a5ee8;})[_0xbf6f('0x24')](respondWithResult(_0x89536e,0xc9))['catch'](handleError(_0x89536e,null));};exports[_0xbf6f('0x51')]=function(_0x2e5a1a,_0x497d9a){if(_0x2e5a1a[_0xbf6f('0x4a')]['id']){delete _0x2e5a1a[_0xbf6f('0x4a')]['id'];}return db[_0xbf6f('0x2c')][_0xbf6f('0x48')]({'where':{'id':_0x2e5a1a[_0xbf6f('0x45')]['id']}})[_0xbf6f('0x24')](handleEntityNotFound(_0x497d9a,null))[_0xbf6f('0x24')](saveUpdates(_0x2e5a1a[_0xbf6f('0x4a')],null))[_0xbf6f('0x24')](respondWithResult(_0x497d9a,null))[_0xbf6f('0x43')](handleError(_0x497d9a,null));};exports['destroy']=function(_0x3a1b3a,_0x2e80a5){return db[_0xbf6f('0x2c')]['find']({'where':{'id':_0x3a1b3a[_0xbf6f('0x45')]['id']}})[_0xbf6f('0x24')](handleEntityNotFound(_0x2e80a5,null))[_0xbf6f('0x24')](removeEntity(_0x2e80a5,null))[_0xbf6f('0x43')](handleError(_0x2e80a5,null));};exports[_0xbf6f('0x52')]=function(_0x1f08e2,_0x2949c5){return db[_0xbf6f('0x2c')][_0xbf6f('0x52')]()['then'](respondWithResult(_0x2949c5,null))[_0xbf6f('0x43')](handleError(_0x2949c5,null));};exports[_0xbf6f('0x53')]=function(_0x1040a8,_0x575beb,_0x39699b){var _0x32d825={'raw':!![],'where':{}},_0xd0c897={},_0xa4f86f;return db['OpenchannelQueue'][_0xbf6f('0x54')]({'where':{'id':_0x1040a8[_0xbf6f('0x45')]['id']}})[_0xbf6f('0x24')](handleEntityNotFound(_0x575beb,null))[_0xbf6f('0x24')](function(_0x54d268){if(_0x54d268){_0xa4f86f=_0x54d268[_0xbf6f('0x26')]({'plain':!![]});_0xd0c897[_0xbf6f('0x2f')]=_[_0xbf6f('0x46')](db['UserOpenchannelQueue'][_0xbf6f('0x2d')]);_0xd0c897[_0xbf6f('0x30')]=_['keys'](_0x1040a8[_0xbf6f('0x30')]);_0xd0c897[_0xbf6f('0x31')]=_[_0xbf6f('0x32')](_0xd0c897[_0xbf6f('0x2f')],_0xd0c897[_0xbf6f('0x30')]);_0x32d825[_0xbf6f('0x34')]=_[_0xbf6f('0x32')](_0xd0c897['model'],qs[_0xbf6f('0x33')](_0x1040a8[_0xbf6f('0x30')][_0xbf6f('0x33')]));_0x32d825[_0xbf6f('0x34')]=_0x32d825['attributes'][_0xbf6f('0x35')]?_0x32d825['attributes']:_0xd0c897['model'];if(!_0x1040a8[_0xbf6f('0x30')][_0xbf6f('0x36')]('nolimit')){_0x32d825[_0xbf6f('0x1f')]=qs[_0xbf6f('0x1f')](_0x1040a8[_0xbf6f('0x30')][_0xbf6f('0x1f')]);_0x32d825[_0xbf6f('0x1e')]=qs[_0xbf6f('0x1e')](_0x1040a8['query'][_0xbf6f('0x1e')]);}_0x32d825[_0xbf6f('0x38')]=qs[_0xbf6f('0x39')](_0x1040a8[_0xbf6f('0x30')][_0xbf6f('0x39')]);_0x32d825[_0xbf6f('0x3a')]=qs[_0xbf6f('0x31')](_['pick'](_0x1040a8['query'],_0xd0c897[_0xbf6f('0x31')]));_0x32d825['where'][_0xbf6f('0x55')]=_0x54d268['id'];if(_0x1040a8[_0xbf6f('0x30')][_0xbf6f('0x3c')]){_0x32d825[_0xbf6f('0x3a')]=_[_0xbf6f('0x3d')](_0x32d825['where'],{'$or':_[_0xbf6f('0x2b')](_0x32d825[_0xbf6f('0x34')],function(_0x346567){var _0x596f34={};_0x596f34[_0x346567]={'$like':'%'+_0x1040a8[_0xbf6f('0x30')]['filter']+'%'};return _0x596f34;})});}_0x32d825=_[_0xbf6f('0x3d')]({},_0x32d825,_0x1040a8[_0xbf6f('0x40')]);return db[_0xbf6f('0x56')][_0xbf6f('0x57')](_0x32d825);}})[_0xbf6f('0x24')](function(_0x462519){if(_0x462519){return db[_0xbf6f('0x58')][_0xbf6f('0x59')]({'where':{'id':_[_0xbf6f('0x2b')](_0x462519,_0xbf6f('0x5a')),'role':_0xbf6f('0x5b')},'attributes':['id',_0xbf6f('0x29'),_0xbf6f('0x5c'),_0xbf6f('0x5d'),'createdAt']});}})[_0xbf6f('0x24')](function(_0x193ae2){if(_0x193ae2){return{'count':_0x193ae2[_0xbf6f('0x1d')],'rows':_[_0xbf6f('0x2b')](_0x193ae2['rows'],function(_0x340b19){return{'membername':_0x340b19[_0xbf6f('0x29')],'UserId':_0x340b19['id'],'queue_name':_0xa4f86f['name'],'OpenchannelQueueId':_0xa4f86f['id'],'interface':util[_0xbf6f('0x5e')]('%s/%s',_0xbf6f('0x5f'),_0x340b19['name']),'penalty':0x0,'paused':_0x340b19[_0xbf6f('0x5c')],'createdAt':_0x340b19[_0xbf6f('0x60')],'updatedAt':_0x340b19[_0xbf6f('0x5d')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xbf6f('0x24')](respondWithFilteredResult(_0x575beb,_0x32d825))[_0xbf6f('0x43')](handleError(_0x575beb,null));};exports['getTeams']=function(_0x72260,_0x48a919,_0x5ba3f2){var _0x5641e0={};var _0x291966={};var _0x3df0fe;var _0x58011d;return db[_0xbf6f('0x2c')][_0xbf6f('0x54')]({'where':{'id':_0x72260[_0xbf6f('0x45')]['id']}})[_0xbf6f('0x24')](handleEntityNotFound(_0x48a919,null))[_0xbf6f('0x24')](function(_0x42aac9){if(_0x42aac9){_0x3df0fe=_0x42aac9;_0x291966[_0xbf6f('0x2f')]=_[_0xbf6f('0x46')](db['Team'][_0xbf6f('0x2d')]);_0x291966[_0xbf6f('0x30')]=_[_0xbf6f('0x46')](_0x72260[_0xbf6f('0x30')]);_0x291966[_0xbf6f('0x31')]=_[_0xbf6f('0x32')](_0x291966[_0xbf6f('0x2f')],_0x291966[_0xbf6f('0x30')]);_0x5641e0[_0xbf6f('0x34')]=_[_0xbf6f('0x32')](_0x291966['model'],qs[_0xbf6f('0x33')](_0x72260['query'][_0xbf6f('0x33')]));_0x5641e0[_0xbf6f('0x34')]=_0x5641e0[_0xbf6f('0x34')]['length']?_0x5641e0[_0xbf6f('0x34')]:_0x291966[_0xbf6f('0x2f')];_0x5641e0[_0xbf6f('0x38')]=qs[_0xbf6f('0x39')](_0x72260[_0xbf6f('0x30')][_0xbf6f('0x39')]);_0x5641e0['where']=qs[_0xbf6f('0x31')](_['pick'](_0x72260[_0xbf6f('0x30')],_0x291966[_0xbf6f('0x31')]));if(_0x72260[_0xbf6f('0x30')]['filter']){_0x5641e0['where']=_[_0xbf6f('0x3d')](_0x5641e0[_0xbf6f('0x3a')],{'$or':_[_0xbf6f('0x2b')](_0x5641e0[_0xbf6f('0x34')],function(_0x5e7342){var _0x541aae={};_0x541aae[_0x5e7342]={'$like':'%'+_0x72260[_0xbf6f('0x30')][_0xbf6f('0x3c')]+'%'};return _0x541aae;})});}_0x5641e0=_[_0xbf6f('0x3d')]({},_0x5641e0,_0x72260[_0xbf6f('0x40')]);return _0x3df0fe[_0xbf6f('0x61')](_0x5641e0);}})[_0xbf6f('0x24')](function(_0x473fac){if(_0x473fac){_0x58011d=_0x473fac['length'];if(!_0x72260[_0xbf6f('0x30')]['hasOwnProperty']('nolimit')){_0x5641e0[_0xbf6f('0x1f')]=qs['limit'](_0x72260[_0xbf6f('0x30')][_0xbf6f('0x1f')]);_0x5641e0[_0xbf6f('0x1e')]=qs[_0xbf6f('0x1e')](_0x72260[_0xbf6f('0x30')][_0xbf6f('0x1e')]);}return _0x3df0fe['getTeams'](_0x5641e0);}})[_0xbf6f('0x24')](function(_0xdd5678){if(_0xdd5678){return _0xdd5678?{'count':_0x58011d,'rows':_0xdd5678}:null;}})[_0xbf6f('0x24')](respondWithResult(_0x48a919,null))[_0xbf6f('0x43')](handleError(_0x48a919,null));};exports[_0xbf6f('0x62')]=function(_0x3da311,_0x514413,_0x40ef92){var _0x216582=_0x3da311[_0xbf6f('0x4a')]['ids'];return db['Team'][_0xbf6f('0x57')]({'where':{'id':_0x216582},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id','name',_0xbf6f('0x63'),_0xbf6f('0x64'),_0xbf6f('0x65')],'raw':!![]}]})['then'](function(_0x4286ef){if(_0x4286ef){var _0x401122=_['flatMap'](_0x4286ef,function(_0x5ed81d){var _0x1e99d0=_0x5ed81d[_0xbf6f('0x26')]({'plain':!![]});return _0x1e99d0[_0xbf6f('0x66')];});return db[_0xbf6f('0x2c')][_0xbf6f('0x48')]({'where':{'id':_0x3da311[_0xbf6f('0x45')]['id']}})[_0xbf6f('0x24')](function(_0x10b503){return db[_0xbf6f('0x67')][_0xbf6f('0x68')](function(_0x11cf95){return _0x10b503[_0xbf6f('0x62')](_0x216582,{'transaction':_0x11cf95})['then'](function(){return BPromise[_0xbf6f('0x69')](_0x401122,function(_0x26e6f6){return db[_0xbf6f('0x56')][_0xbf6f('0x6a')]({'where':{'UserId':_0x26e6f6['id'],'OpenchannelQueueId':_0x3da311[_0xbf6f('0x45')]['id']},'transaction':_0x11cf95});});})[_0xbf6f('0x24')](function(){_0x401122[_0xbf6f('0x6b')](function(_0x371579){socket[_0xbf6f('0x6c')]('userOpenchannelQueue:save',{'UserId':_0x371579['id'],'OpenchannelQueueId':_0x10b503['id']});});});});});}})[_0xbf6f('0x24')](respondWithStatusCode(_0x514413,null))[_0xbf6f('0x43')](handleError(_0x514413,null));};exports['removeTeams']=function(_0x1961fd,_0xd04e05,_0x1ded6c){return db['Team']['findAll']({'where':{'id':_0x1961fd[_0xbf6f('0x30')][_0xbf6f('0x6d')]},'attributes':['id'],'include':[{'model':db[_0xbf6f('0x58')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xbf6f('0x24')](handleEntityNotFound(_0xd04e05,null))['then'](function(_0xf023f4){var _0x4c978e=_[_0xbf6f('0x2b')](_0xf023f4,'id');var _0xd2c6af=[];var _0x2dd70f=[];var _0x5240db=squel[_0xbf6f('0x6e')]();_0x5240db['field'](_0xbf6f('0x6f'))[_0xbf6f('0x70')](_0xbf6f('0x71'),'tq')['join'](_0xbf6f('0x72'),'ut',_0xbf6f('0x73'))[_0xbf6f('0x3a')]('OpenchannelQueueId\x20=\x20?',_0x1961fd[_0xbf6f('0x45')]['id']);for(var _0x18f196=0x0;_0x18f196<_0xf023f4[_0xbf6f('0x35')];_0x18f196+=0x1){let _0x37fcbf=_0xf023f4[_0x18f196];for(var _0x1e6fd3=0x0;_0x1e6fd3<_0x37fcbf[_0xbf6f('0x66')][_0xbf6f('0x35')];_0x1e6fd3+=0x1){let _0x4f0b9a=_0x37fcbf['Agents'][_0x1e6fd3];var _0x9f768f=_0x5240db[_0xbf6f('0x74')]();_0x9f768f[_0xbf6f('0x3a')](_0xbf6f('0x75'),_0x4f0b9a['id']);_0x2dd70f['push'](db[_0xbf6f('0x67')][_0xbf6f('0x30')](_0x9f768f['toString'](),{'type':db[_0xbf6f('0x67')][_0xbf6f('0x76')]['SELECT']})[_0xbf6f('0x24')](function(_0x3d631d){if(_0x3d631d['length']===0x1){return _0x4f0b9a['id'];}else{var _0x495409=_[_0xbf6f('0x77')](_[_0xbf6f('0x2b')](_0x3d631d,'TeamId'),function(_0x3354c3){return _[_0xbf6f('0x78')](_0x4c978e,_0x3354c3);});if(_0x495409){return _0x4f0b9a['id'];}}}));}}return BPromise[_0xbf6f('0x79')](_0x2dd70f)['then'](function(_0x311a7a){_0xd2c6af=_(_0xd2c6af)[_0xbf6f('0x7a')](_0x311a7a)[_0xbf6f('0x7b')]()[_0xbf6f('0x7c')]();return db['OpenchannelQueue'][_0xbf6f('0x48')]({'where':{'id':_0x1961fd[_0xbf6f('0x45')]['id']}})[_0xbf6f('0x24')](function(_0x5d3cc9){return db['sequelize'][_0xbf6f('0x68')](function(_0x139a21){return _0x5d3cc9[_0xbf6f('0x7d')](_0x1961fd[_0xbf6f('0x30')]['ids'],{'transaction':_0x139a21})[_0xbf6f('0x24')](function(){if(!_['isEmpty'](_0xd2c6af)){return _0x5d3cc9['removeAgents'](_0xd2c6af,{'transaction':_0x139a21});}})[_0xbf6f('0x24')](function(){_0xd2c6af[_0xbf6f('0x6b')](function(_0x3beaca){socket['emit'](_0xbf6f('0x7e'),{'UserId':_0x3beaca,'OpenchannelQueueId':_0x5d3cc9['id']});});});});});});})['then'](respondWithStatusCode(_0xd04e05,null))[_0xbf6f('0x43')](handleError(_0xd04e05,null));};exports[_0xbf6f('0x7f')]=function(_0x3e2664,_0x76da8f,_0x18e147){return db[_0xbf6f('0x2c')]['find']({'where':{'id':_0x3e2664[_0xbf6f('0x45')]['id']}})[_0xbf6f('0x24')](handleEntityNotFound(_0x76da8f,null))['then'](function(_0x1e0df2){if(_0x1e0df2){return _0x1e0df2['addAgents'](_0x3e2664[_0xbf6f('0x4a')][_0xbf6f('0x6d')],_['omit'](_0x3e2664[_0xbf6f('0x4a')],[_0xbf6f('0x6d'),'id'])||{})[_0xbf6f('0x80')](function(_0x1d302b){for(var _0x4b3497=0x0;_0x4b3497<_0x3e2664[_0xbf6f('0x4a')][_0xbf6f('0x6d')][_0xbf6f('0x35')];_0x4b3497+=0x1){socket[_0xbf6f('0x6c')](_0xbf6f('0x81'),{'UserId':_0x3e2664['body'][_0xbf6f('0x6d')][_0x4b3497],'OpenchannelQueueId':_0x3e2664[_0xbf6f('0x45')]['id']});}return _0x1d302b;});}})[_0xbf6f('0x24')](respondWithResult(_0x76da8f,null))[_0xbf6f('0x43')](handleError(_0x76da8f,null));};exports['removeAgents']=function(_0x183f6c,_0x477fc9,_0x49b9f3){return db[_0xbf6f('0x2c')][_0xbf6f('0x48')]({'where':{'id':_0x183f6c[_0xbf6f('0x45')]['id']}})[_0xbf6f('0x24')](handleEntityNotFound(_0x477fc9,null))[_0xbf6f('0x24')](function(_0x5527d4){if(_0x5527d4){return _0x5527d4[_0xbf6f('0x82')](_0x183f6c[_0xbf6f('0x30')][_0xbf6f('0x6d')])[_0xbf6f('0x24')](function(){if(_['isArray'](_0x183f6c[_0xbf6f('0x30')][_0xbf6f('0x6d')])){for(var _0x454206=0x0;_0x454206<_0x183f6c['query'][_0xbf6f('0x6d')]['length'];_0x454206+=0x1){socket['emit'](_0xbf6f('0x7e'),{'UserId':Number(_0x183f6c[_0xbf6f('0x30')][_0xbf6f('0x6d')][_0x454206]),'OpenchannelQueueId':Number(_0x183f6c['params']['id'])});}}else{socket[_0xbf6f('0x6c')]('userOpenchannelQueue:remove',{'UserId':Number(_0x183f6c['query'][_0xbf6f('0x6d')]),'OpenchannelQueueId':Number(_0x183f6c[_0xbf6f('0x45')]['id'])});}});}})[_0xbf6f('0x24')](respondWithStatusCode(_0x477fc9,null))[_0xbf6f('0x43')](handleError(_0x477fc9,null));};exports['getAgents']=function(_0x30c109,_0x5cc225,_0x4afa81){var _0x5f68b2={};var _0x357adc={};var _0x3a17de;var _0x2e9dc2;return db[_0xbf6f('0x2c')][_0xbf6f('0x54')]({'where':{'id':_0x30c109['params']['id']}})[_0xbf6f('0x24')](handleEntityNotFound(_0x5cc225,null))[_0xbf6f('0x24')](function(_0x33fb35){if(_0x33fb35){_0x3a17de=_0x33fb35;_0x357adc[_0xbf6f('0x2f')]=_[_0xbf6f('0x46')](db[_0xbf6f('0x58')]['rawAttributes']);_0x357adc[_0xbf6f('0x30')]=_['keys'](_0x30c109[_0xbf6f('0x30')]);_0x357adc['filters']=_[_0xbf6f('0x32')](_0x357adc['model'],_0x357adc[_0xbf6f('0x30')]);_0x5f68b2[_0xbf6f('0x34')]=_[_0xbf6f('0x32')](_0x357adc[_0xbf6f('0x2f')],qs[_0xbf6f('0x33')](_0x30c109[_0xbf6f('0x30')][_0xbf6f('0x33')]));_0x5f68b2[_0xbf6f('0x34')]=_0x5f68b2[_0xbf6f('0x34')]['length']?_0x5f68b2[_0xbf6f('0x34')]:_0x357adc['model'];_0x5f68b2[_0xbf6f('0x38')]=qs['sort'](_0x30c109['query'][_0xbf6f('0x39')]);_0x5f68b2[_0xbf6f('0x3a')]=qs[_0xbf6f('0x31')](_[_0xbf6f('0x3b')](_0x30c109[_0xbf6f('0x30')],_0x357adc['filters']));if(_0x30c109['query'][_0xbf6f('0x3c')]){_0x5f68b2[_0xbf6f('0x3a')]=_[_0xbf6f('0x3d')](_0x5f68b2['where'],{'$or':_[_0xbf6f('0x2b')](_0x5f68b2[_0xbf6f('0x34')],function(_0x1bef03){var _0x1bb19b={};_0x1bb19b[_0x1bef03]={'$like':'%'+_0x30c109[_0xbf6f('0x30')][_0xbf6f('0x3c')]+'%'};return _0x1bb19b;})});}_0x5f68b2=_[_0xbf6f('0x3d')]({},_0x5f68b2,_0x30c109[_0xbf6f('0x40')]);return _0x3a17de[_0xbf6f('0x83')](_0x5f68b2);}})[_0xbf6f('0x24')](function(_0x2baa3b){if(_0x2baa3b){_0x2e9dc2=_0x2baa3b[_0xbf6f('0x35')];if(!_0x30c109[_0xbf6f('0x30')][_0xbf6f('0x36')](_0xbf6f('0x37'))){_0x5f68b2[_0xbf6f('0x1f')]=qs[_0xbf6f('0x1f')](_0x30c109[_0xbf6f('0x30')][_0xbf6f('0x1f')]);_0x5f68b2[_0xbf6f('0x1e')]=qs[_0xbf6f('0x1e')](_0x30c109['query'][_0xbf6f('0x1e')]);}return _0x3a17de['getAgents'](_0x5f68b2);}})[_0xbf6f('0x24')](function(_0x18a547){if(_0x18a547){return _0x18a547?{'count':_0x2e9dc2,'rows':_0x18a547}:null;}})[_0xbf6f('0x24')](respondWithResult(_0x5cc225,null))['catch'](handleError(_0x5cc225,null));}; \ No newline at end of file +var _0xa229=['get','find','describe','getMembers','findOne','OpenchannelQueueId','UserOpenchannelQueue','User','findAndCountAll','UserId','agent','updatedAt','createdAt','format','SIP','openchannelPause','getTeams','Team','addTeams','ids','Agents','online','voicePause','interface','flatMap','transaction','each','findOrCreate','emit','userOpenchannelQueue:save','field','tq.TeamId','from','team_has_openchannel_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','sequelize','toString','QueryTypes','SELECT','TeamId','includes','all','union','compact','value','removeTeams','isEmpty','removeAgents','addAgents','omit','spread','isArray','userOpenchannelQueue:remove','getAgents','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','OpenchannelQueues','UserProfileResource','error','name','send','index','map','OpenchannelQueue','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','create','body','user','role'];(function(_0xae7c2f,_0xf31e04){var _0x5d7001=function(_0x4eeadb){while(--_0x4eeadb){_0xae7c2f['push'](_0xae7c2f['shift']());}};_0x5d7001(++_0xf31e04);}(_0xa229,0x156));var _0x9a22=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xa229[_0x321bb2];return _0x9c12ed;};'use strict';var pdf=require(_0x9a22('0x0'));var emlformat=require(_0x9a22('0x1'));var rimraf=require(_0x9a22('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9a22('0x3'));var rp=require('request-promise');var moment=require(_0x9a22('0x4'));var BPromise=require(_0x9a22('0x5'));var Mustache=require('mustache');var util=require(_0x9a22('0x6'));var path=require(_0x9a22('0x7'));var sox=require(_0x9a22('0x8'));var csv=require(_0x9a22('0x9'));var ejs=require(_0x9a22('0xa'));var fs=require('fs');var _=require(_0x9a22('0xb'));var squel=require('squel');var crypto=require(_0x9a22('0xc'));var jsforce=require(_0x9a22('0xd'));var deskjs=require(_0x9a22('0xe'));var toCsv=require(_0x9a22('0x9'));var querystring=require(_0x9a22('0xf'));var Papa=require(_0x9a22('0x10'));var Redis=require(_0x9a22('0x11'));var authService=require(_0x9a22('0x12'));var qs=require(_0x9a22('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x9a22('0x14'))(_0x9a22('0x15'));var utils=require(_0x9a22('0x16'));var config=require(_0x9a22('0x17'));var db=require('../../mysqldb')['db'];config[_0x9a22('0x18')]=_[_0x9a22('0x19')](config['redis'],{'host':_0x9a22('0x1a'),'port':0x18eb});var socket=require(_0x9a22('0x1b'))(new Redis(config[_0x9a22('0x18')]));require(_0x9a22('0x1c'))['register'](socket);function respondWithStatusCode(_0x5ab1bd,_0x5cecb7){_0x5cecb7=_0x5cecb7||0xcc;return function(_0xa99f0){if(_0xa99f0){return _0x5ab1bd[_0x9a22('0x1d')](_0x5cecb7);}return _0x5ab1bd[_0x9a22('0x1e')](_0x5cecb7)[_0x9a22('0x1f')]();};}function respondWithResult(_0x20da78,_0x4f38b2){_0x4f38b2=_0x4f38b2||0xc8;return function(_0xf5edf6){if(_0xf5edf6){return _0x20da78[_0x9a22('0x1e')](_0x4f38b2)[_0x9a22('0x20')](_0xf5edf6);}};}function respondWithFilteredResult(_0x10b988,_0x550519){return function(_0x8b2d67){if(_0x8b2d67){var _0x7b5719=_0x8b2d67[_0x9a22('0x21')],_0x42566f=_0x550519[_0x9a22('0x22')],_0x21f5dd=_0x550519[_0x9a22('0x22')]+_0x550519['limit'],_0x3d8a4c;if(_0x21f5dd>=_0x7b5719){_0x21f5dd=_0x7b5719;_0x3d8a4c=0xc8;}else{_0x3d8a4c=0xce;}_0x10b988[_0x9a22('0x1e')](_0x3d8a4c);return _0x10b988[_0x9a22('0x23')](_0x9a22('0x24'),_0x42566f+'-'+_0x21f5dd+'/'+_0x7b5719)['json'](_0x8b2d67);}return null;};}function patchUpdates(_0x56cc8f){return function(_0x5cde8c){try{jsonpatch[_0x9a22('0x25')](_0x5cde8c,_0x56cc8f,!![]);}catch(_0x3a956a){return BPromise[_0x9a22('0x26')](_0x3a956a);}return _0x5cde8c[_0x9a22('0x27')]();};}function saveUpdates(_0x1416b7,_0x2f38b8){return function(_0x4e274a){if(_0x4e274a){return _0x4e274a[_0x9a22('0x28')](_0x1416b7)[_0x9a22('0x29')](function(_0x2a6133){return _0x2a6133;});}return null;};}function removeEntity(_0x343cf4,_0x1c0889){return function(_0xced595){if(_0xced595){return _0xced595[_0x9a22('0x2a')]()[_0x9a22('0x29')](function(){var _0xf47663=_0xced595['get']({'plain':!![]});var _0x218101=_0x9a22('0x2b');return db[_0x9a22('0x2c')][_0x9a22('0x2a')]({'where':{'type':_0x218101,'resourceId':_0xf47663['id']}})[_0x9a22('0x29')](function(){return _0xced595;});})[_0x9a22('0x29')](function(){_0x343cf4[_0x9a22('0x1e')](0xcc)[_0x9a22('0x1f')]();});}};}function handleEntityNotFound(_0x384dd4,_0x6b93ec){return function(_0x2def3b){if(!_0x2def3b){_0x384dd4[_0x9a22('0x1d')](0x194);}return _0x2def3b;};}function handleError(_0x1b3d28,_0x6750c2){_0x6750c2=_0x6750c2||0x1f4;return function(_0x8438e2){logger[_0x9a22('0x2d')](_0x8438e2['stack']);if(_0x8438e2['name']){delete _0x8438e2[_0x9a22('0x2e')];}_0x1b3d28[_0x9a22('0x1e')](_0x6750c2)[_0x9a22('0x2f')](_0x8438e2);};}exports[_0x9a22('0x30')]=function(_0x41253c,_0x409de9){var _0x118354={},_0xc70608={},_0x514964={'count':0x0,'rows':[]};var _0x609534=_[_0x9a22('0x31')](db[_0x9a22('0x32')][_0x9a22('0x33')],function(_0x359d78){return{'name':_0x359d78[_0x9a22('0x34')],'type':_0x359d78['type'][_0x9a22('0x35')]};});_0xc70608[_0x9a22('0x36')]=_[_0x9a22('0x31')](_0x609534,'name');_0xc70608[_0x9a22('0x37')]=_[_0x9a22('0x38')](_0x41253c[_0x9a22('0x37')]);_0xc70608[_0x9a22('0x39')]=_[_0x9a22('0x3a')](_0xc70608[_0x9a22('0x36')],_0xc70608[_0x9a22('0x37')]);_0x118354['attributes']=_[_0x9a22('0x3a')](_0xc70608[_0x9a22('0x36')],qs[_0x9a22('0x3b')](_0x41253c[_0x9a22('0x37')][_0x9a22('0x3b')]));_0x118354[_0x9a22('0x3c')]=_0x118354[_0x9a22('0x3c')][_0x9a22('0x3d')]?_0x118354[_0x9a22('0x3c')]:_0xc70608['model'];if(!_0x41253c[_0x9a22('0x37')][_0x9a22('0x3e')](_0x9a22('0x3f'))){_0x118354[_0x9a22('0x40')]=qs['limit'](_0x41253c['query'][_0x9a22('0x40')]);_0x118354[_0x9a22('0x22')]=qs[_0x9a22('0x22')](_0x41253c['query'][_0x9a22('0x22')]);}_0x118354[_0x9a22('0x41')]=qs[_0x9a22('0x42')](_0x41253c['query'][_0x9a22('0x42')]);_0x118354['where']=qs['filters'](_[_0x9a22('0x43')](_0x41253c[_0x9a22('0x37')],_0xc70608[_0x9a22('0x39')]));if(_0x41253c['query'][_0x9a22('0x44')]){_0x118354[_0x9a22('0x45')]=_[_0x9a22('0x46')](_0x118354[_0x9a22('0x45')],{'$or':_[_0x9a22('0x31')](_0x609534,function(_0x109902){if(_0x109902[_0x9a22('0x47')]!==_0x9a22('0x48')){var _0xf57a1={};_0xf57a1[_0x109902[_0x9a22('0x2e')]]={'$like':'%'+_0x41253c[_0x9a22('0x37')]['filter']+'%'};return _0xf57a1;}})});}_0x118354=_[_0x9a22('0x46')]({},_0x118354,_0x41253c[_0x9a22('0x49')]);var _0x5a79d6={'where':_0x118354['where']};return db['OpenchannelQueue'][_0x9a22('0x21')](_0x5a79d6)[_0x9a22('0x29')](function(_0x4d6a5a){_0x514964[_0x9a22('0x21')]=_0x4d6a5a;if(_0x41253c[_0x9a22('0x37')][_0x9a22('0x4a')]){_0x118354[_0x9a22('0x4b')]=[{'all':!![]}];}return db['OpenchannelQueue'][_0x9a22('0x4c')](_0x118354);})[_0x9a22('0x29')](function(_0x2f049f){_0x514964[_0x9a22('0x4d')]=_0x2f049f;return _0x514964;})['then'](respondWithFilteredResult(_0x409de9,_0x118354))[_0x9a22('0x4e')](handleError(_0x409de9,null));};exports['show']=function(_0xfdf1e6,_0x17e439){var _0x5ec0a0={'raw':!![],'where':{'id':_0xfdf1e6[_0x9a22('0x4f')]['id']}},_0x34cf50={};_0x34cf50[_0x9a22('0x36')]=_[_0x9a22('0x38')](db['OpenchannelQueue'][_0x9a22('0x33')]);_0x34cf50[_0x9a22('0x37')]=_[_0x9a22('0x38')](_0xfdf1e6[_0x9a22('0x37')]);_0x34cf50['filters']=_[_0x9a22('0x3a')](_0x34cf50[_0x9a22('0x36')],_0x34cf50[_0x9a22('0x37')]);_0x5ec0a0['attributes']=_['intersection'](_0x34cf50[_0x9a22('0x36')],qs[_0x9a22('0x3b')](_0xfdf1e6[_0x9a22('0x37')][_0x9a22('0x3b')]));_0x5ec0a0[_0x9a22('0x3c')]=_0x5ec0a0[_0x9a22('0x3c')][_0x9a22('0x3d')]?_0x5ec0a0[_0x9a22('0x3c')]:_0x34cf50[_0x9a22('0x36')];if(_0xfdf1e6[_0x9a22('0x37')]['includeAll']){_0x5ec0a0[_0x9a22('0x4b')]=[{'all':!![]}];}_0x5ec0a0=_['merge']({},_0x5ec0a0,_0xfdf1e6['options']);return db[_0x9a22('0x32')]['find'](_0x5ec0a0)[_0x9a22('0x29')](handleEntityNotFound(_0x17e439,null))['then'](respondWithResult(_0x17e439,null))[_0x9a22('0x4e')](handleError(_0x17e439,null));};exports['create']=function(_0x5a2130,_0x240dda){return db[_0x9a22('0x32')][_0x9a22('0x50')](_0x5a2130[_0x9a22('0x51')],{})[_0x9a22('0x29')](function(_0x4e5799){var _0x165df5=_0x5a2130[_0x9a22('0x52')]['get']({'plain':!![]});if(!_0x165df5)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x165df5[_0x9a22('0x53')]===_0x9a22('0x52')){var _0x4a7e2c=_0x4e5799[_0x9a22('0x54')]({'plain':!![]});var _0xb3d9d4=_0x9a22('0x2b');return db['UserProfileSection']['find']({'where':{'name':_0xb3d9d4,'userProfileId':_0x165df5['userProfileId']},'raw':!![]})[_0x9a22('0x29')](function(_0x9547f4){if(_0x9547f4&&_0x9547f4['autoAssociation']===0x0){return db[_0x9a22('0x2c')][_0x9a22('0x50')]({'name':_0x4a7e2c[_0x9a22('0x2e')],'resourceId':_0x4a7e2c['id'],'type':_0x9547f4[_0x9a22('0x2e')],'sectionId':_0x9547f4['id']},{})[_0x9a22('0x29')](function(){return _0x4e5799;});}else{return _0x4e5799;}})[_0x9a22('0x4e')](function(_0xb54f84){logger[_0x9a22('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xb54f84);throw _0xb54f84;});}return _0x4e5799;})[_0x9a22('0x29')](respondWithResult(_0x240dda,0xc9))['catch'](handleError(_0x240dda,null));};exports[_0x9a22('0x28')]=function(_0x103c8e,_0x3efc32){if(_0x103c8e[_0x9a22('0x51')]['id']){delete _0x103c8e['body']['id'];}return db['OpenchannelQueue'][_0x9a22('0x55')]({'where':{'id':_0x103c8e['params']['id']}})[_0x9a22('0x29')](handleEntityNotFound(_0x3efc32,null))['then'](saveUpdates(_0x103c8e['body'],null))['then'](respondWithResult(_0x3efc32,null))['catch'](handleError(_0x3efc32,null));};exports[_0x9a22('0x2a')]=function(_0x18ed53,_0x4b7085){return db[_0x9a22('0x32')]['find']({'where':{'id':_0x18ed53[_0x9a22('0x4f')]['id']}})['then'](handleEntityNotFound(_0x4b7085,null))['then'](removeEntity(_0x4b7085,null))[_0x9a22('0x4e')](handleError(_0x4b7085,null));};exports['describe']=function(_0xa10757,_0x32df2b){return db[_0x9a22('0x32')][_0x9a22('0x56')]()[_0x9a22('0x29')](respondWithResult(_0x32df2b,null))[_0x9a22('0x4e')](handleError(_0x32df2b,null));};exports[_0x9a22('0x57')]=function(_0x4d0cc1,_0x231b59,_0x42cc4d){var _0x463286={'raw':!![],'where':{}},_0x3b82e9={},_0x43e3df;return db[_0x9a22('0x32')][_0x9a22('0x58')]({'where':{'id':_0x4d0cc1['params']['id']}})[_0x9a22('0x29')](handleEntityNotFound(_0x231b59,null))[_0x9a22('0x29')](function(_0x4d540d){if(_0x4d540d){_0x43e3df=_0x4d540d[_0x9a22('0x54')]({'plain':!![]});_0x3b82e9[_0x9a22('0x36')]=_[_0x9a22('0x38')](db['UserOpenchannelQueue'][_0x9a22('0x33')]);_0x3b82e9['query']=_[_0x9a22('0x38')](_0x4d0cc1[_0x9a22('0x37')]);_0x3b82e9[_0x9a22('0x39')]=_[_0x9a22('0x3a')](_0x3b82e9['model'],_0x3b82e9[_0x9a22('0x37')]);_0x463286[_0x9a22('0x3c')]=_['intersection'](_0x3b82e9[_0x9a22('0x36')],qs[_0x9a22('0x3b')](_0x4d0cc1['query'][_0x9a22('0x3b')]));_0x463286[_0x9a22('0x3c')]=_0x463286[_0x9a22('0x3c')]['length']?_0x463286[_0x9a22('0x3c')]:_0x3b82e9[_0x9a22('0x36')];if(!_0x4d0cc1[_0x9a22('0x37')][_0x9a22('0x3e')](_0x9a22('0x3f'))){_0x463286[_0x9a22('0x40')]=qs[_0x9a22('0x40')](_0x4d0cc1[_0x9a22('0x37')][_0x9a22('0x40')]);_0x463286[_0x9a22('0x22')]=qs[_0x9a22('0x22')](_0x4d0cc1[_0x9a22('0x37')][_0x9a22('0x22')]);}_0x463286[_0x9a22('0x41')]=qs['sort'](_0x4d0cc1[_0x9a22('0x37')]['sort']);_0x463286[_0x9a22('0x45')]=qs[_0x9a22('0x39')](_['pick'](_0x4d0cc1[_0x9a22('0x37')],_0x3b82e9[_0x9a22('0x39')]));_0x463286[_0x9a22('0x45')][_0x9a22('0x59')]=_0x4d540d['id'];if(_0x4d0cc1['query']['filter']){_0x463286['where']=_[_0x9a22('0x46')](_0x463286[_0x9a22('0x45')],{'$or':_[_0x9a22('0x31')](_0x463286[_0x9a22('0x3c')],function(_0x4de455){var _0xb18cb3={};_0xb18cb3[_0x4de455]={'$like':'%'+_0x4d0cc1[_0x9a22('0x37')][_0x9a22('0x44')]+'%'};return _0xb18cb3;})});}_0x463286=_['merge']({},_0x463286,_0x4d0cc1[_0x9a22('0x49')]);return db[_0x9a22('0x5a')][_0x9a22('0x4c')](_0x463286);}})[_0x9a22('0x29')](function(_0x5be700){if(_0x5be700){return db[_0x9a22('0x5b')][_0x9a22('0x5c')]({'where':{'id':_['map'](_0x5be700,_0x9a22('0x5d')),'role':_0x9a22('0x5e')},'attributes':['id',_0x9a22('0x2e'),'openchannelPause',_0x9a22('0x5f'),_0x9a22('0x60')]});}})[_0x9a22('0x29')](function(_0x2ed199){if(_0x2ed199){return{'count':_0x2ed199[_0x9a22('0x21')],'rows':_[_0x9a22('0x31')](_0x2ed199[_0x9a22('0x4d')],function(_0x1b65f2){return{'membername':_0x1b65f2[_0x9a22('0x2e')],'UserId':_0x1b65f2['id'],'queue_name':_0x43e3df['name'],'OpenchannelQueueId':_0x43e3df['id'],'interface':util[_0x9a22('0x61')]('%s/%s',_0x9a22('0x62'),_0x1b65f2[_0x9a22('0x2e')]),'penalty':0x0,'paused':_0x1b65f2[_0x9a22('0x63')],'createdAt':_0x1b65f2[_0x9a22('0x60')],'updatedAt':_0x1b65f2[_0x9a22('0x5f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x9a22('0x29')](respondWithFilteredResult(_0x231b59,_0x463286))[_0x9a22('0x4e')](handleError(_0x231b59,null));};exports[_0x9a22('0x64')]=function(_0x29e81f,_0x2bb5e7,_0x5d0b33){var _0x1ed3db={};var _0x5877bd={};var _0x354722;var _0x1c3e3b;return db[_0x9a22('0x32')][_0x9a22('0x58')]({'where':{'id':_0x29e81f[_0x9a22('0x4f')]['id']}})['then'](handleEntityNotFound(_0x2bb5e7,null))[_0x9a22('0x29')](function(_0x1cce31){if(_0x1cce31){_0x354722=_0x1cce31;_0x5877bd['model']=_[_0x9a22('0x38')](db[_0x9a22('0x65')]['rawAttributes']);_0x5877bd[_0x9a22('0x37')]=_['keys'](_0x29e81f['query']);_0x5877bd[_0x9a22('0x39')]=_[_0x9a22('0x3a')](_0x5877bd[_0x9a22('0x36')],_0x5877bd[_0x9a22('0x37')]);_0x1ed3db[_0x9a22('0x3c')]=_[_0x9a22('0x3a')](_0x5877bd[_0x9a22('0x36')],qs['fields'](_0x29e81f[_0x9a22('0x37')]['fields']));_0x1ed3db[_0x9a22('0x3c')]=_0x1ed3db['attributes']['length']?_0x1ed3db[_0x9a22('0x3c')]:_0x5877bd[_0x9a22('0x36')];_0x1ed3db['order']=qs[_0x9a22('0x42')](_0x29e81f[_0x9a22('0x37')][_0x9a22('0x42')]);_0x1ed3db[_0x9a22('0x45')]=qs[_0x9a22('0x39')](_[_0x9a22('0x43')](_0x29e81f[_0x9a22('0x37')],_0x5877bd[_0x9a22('0x39')]));if(_0x29e81f['query'][_0x9a22('0x44')]){_0x1ed3db[_0x9a22('0x45')]=_['merge'](_0x1ed3db[_0x9a22('0x45')],{'$or':_[_0x9a22('0x31')](_0x1ed3db[_0x9a22('0x3c')],function(_0x1ee9ce){var _0x15f05e={};_0x15f05e[_0x1ee9ce]={'$like':'%'+_0x29e81f[_0x9a22('0x37')][_0x9a22('0x44')]+'%'};return _0x15f05e;})});}_0x1ed3db=_[_0x9a22('0x46')]({},_0x1ed3db,_0x29e81f['options']);return _0x354722[_0x9a22('0x64')](_0x1ed3db);}})[_0x9a22('0x29')](function(_0x206b32){if(_0x206b32){_0x1c3e3b=_0x206b32[_0x9a22('0x3d')];if(!_0x29e81f[_0x9a22('0x37')][_0x9a22('0x3e')](_0x9a22('0x3f'))){_0x1ed3db['limit']=qs[_0x9a22('0x40')](_0x29e81f[_0x9a22('0x37')][_0x9a22('0x40')]);_0x1ed3db['offset']=qs['offset'](_0x29e81f[_0x9a22('0x37')][_0x9a22('0x22')]);}return _0x354722[_0x9a22('0x64')](_0x1ed3db);}})[_0x9a22('0x29')](function(_0x564476){if(_0x564476){return _0x564476?{'count':_0x1c3e3b,'rows':_0x564476}:null;}})[_0x9a22('0x29')](respondWithResult(_0x2bb5e7,null))['catch'](handleError(_0x2bb5e7,null));};exports[_0x9a22('0x66')]=function(_0x3f621b,_0x16d129,_0xfc03ad){var _0x4e3226=_0x3f621b[_0x9a22('0x51')][_0x9a22('0x67')];return db[_0x9a22('0x65')]['findAll']({'where':{'id':_0x4e3226},'attributes':['id'],'include':[{'model':db[_0x9a22('0x5b')],'as':_0x9a22('0x68'),'attributes':['id',_0x9a22('0x2e'),_0x9a22('0x69'),_0x9a22('0x6a'),_0x9a22('0x6b')],'raw':!![]}]})[_0x9a22('0x29')](function(_0x3fa567){if(_0x3fa567){var _0x183b22=_[_0x9a22('0x6c')](_0x3fa567,function(_0x2c8153){var _0x3c3c51=_0x2c8153['get']({'plain':!![]});return _0x3c3c51['Agents'];});return db['OpenchannelQueue']['find']({'where':{'id':_0x3f621b[_0x9a22('0x4f')]['id']}})['then'](function(_0x19c6ff){return db['sequelize'][_0x9a22('0x6d')](function(_0x2091a9){return _0x19c6ff['addTeams'](_0x4e3226,{'transaction':_0x2091a9})[_0x9a22('0x29')](function(){return BPromise[_0x9a22('0x6e')](_0x183b22,function(_0x2a0e36){return db[_0x9a22('0x5a')][_0x9a22('0x6f')]({'where':{'UserId':_0x2a0e36['id'],'OpenchannelQueueId':_0x3f621b[_0x9a22('0x4f')]['id']},'transaction':_0x2091a9});});})[_0x9a22('0x29')](function(){_0x183b22['forEach'](function(_0x736f3a){socket[_0x9a22('0x70')](_0x9a22('0x71'),{'UserId':_0x736f3a['id'],'OpenchannelQueueId':_0x19c6ff['id']});});});});});}})[_0x9a22('0x29')](respondWithStatusCode(_0x16d129,null))['catch'](handleError(_0x16d129,null));};exports['removeTeams']=function(_0x171fe5,_0x380ea5,_0x4f5738){return db[_0x9a22('0x65')]['findAll']({'where':{'id':_0x171fe5[_0x9a22('0x37')]['ids']},'attributes':['id'],'include':[{'model':db[_0x9a22('0x5b')],'as':_0x9a22('0x68'),'attributes':['id'],'raw':!![]}]})[_0x9a22('0x29')](handleEntityNotFound(_0x380ea5,null))['then'](function(_0x2a7442){var _0x3ec3dd=_[_0x9a22('0x31')](_0x2a7442,'id');var _0x30fe15=[];var _0xb6e6c0=[];var _0x2ac8ea=squel['select']();_0x2ac8ea[_0x9a22('0x72')](_0x9a22('0x73'))[_0x9a22('0x74')](_0x9a22('0x75'),'tq')['join'](_0x9a22('0x76'),'ut',_0x9a22('0x77'))[_0x9a22('0x45')](_0x9a22('0x78'),_0x171fe5['params']['id']);for(var _0x4102ea=0x0;_0x4102ea<_0x2a7442['length'];_0x4102ea+=0x1){let _0x2c0992=_0x2a7442[_0x4102ea];for(var _0x46585b=0x0;_0x46585b<_0x2c0992[_0x9a22('0x68')][_0x9a22('0x3d')];_0x46585b+=0x1){let _0x29d9ff=_0x2c0992[_0x9a22('0x68')][_0x46585b];var _0x32e6da=_0x2ac8ea[_0x9a22('0x79')]();_0x32e6da[_0x9a22('0x45')](_0x9a22('0x7a'),_0x29d9ff['id']);_0xb6e6c0['push'](db[_0x9a22('0x7b')][_0x9a22('0x37')](_0x32e6da[_0x9a22('0x7c')](),{'type':db[_0x9a22('0x7b')][_0x9a22('0x7d')][_0x9a22('0x7e')]})[_0x9a22('0x29')](function(_0xa9ba82){if(_0xa9ba82[_0x9a22('0x3d')]===0x1){return _0x29d9ff['id'];}else{var _0x1b25ae=_['every'](_[_0x9a22('0x31')](_0xa9ba82,_0x9a22('0x7f')),function(_0x20e2eb){return _[_0x9a22('0x80')](_0x3ec3dd,_0x20e2eb);});if(_0x1b25ae){return _0x29d9ff['id'];}}}));}}return BPromise[_0x9a22('0x81')](_0xb6e6c0)[_0x9a22('0x29')](function(_0x912df7){_0x30fe15=_(_0x30fe15)[_0x9a22('0x82')](_0x912df7)[_0x9a22('0x83')]()[_0x9a22('0x84')]();return db[_0x9a22('0x32')][_0x9a22('0x55')]({'where':{'id':_0x171fe5['params']['id']}})['then'](function(_0x3a14d3){return db[_0x9a22('0x7b')]['transaction'](function(_0x8074ad){return _0x3a14d3[_0x9a22('0x85')](_0x171fe5[_0x9a22('0x37')][_0x9a22('0x67')],{'transaction':_0x8074ad})['then'](function(){if(!_[_0x9a22('0x86')](_0x30fe15)){return _0x3a14d3[_0x9a22('0x87')](_0x30fe15,{'transaction':_0x8074ad});}})[_0x9a22('0x29')](function(){_0x30fe15['forEach'](function(_0x51f423){socket[_0x9a22('0x70')]('userOpenchannelQueue:remove',{'UserId':_0x51f423,'OpenchannelQueueId':_0x3a14d3['id']});});});});});});})[_0x9a22('0x29')](respondWithStatusCode(_0x380ea5,null))[_0x9a22('0x4e')](handleError(_0x380ea5,null));};exports[_0x9a22('0x88')]=function(_0x27a44c,_0x506a20,_0x33a5a0){return db[_0x9a22('0x32')][_0x9a22('0x55')]({'where':{'id':_0x27a44c['params']['id']}})[_0x9a22('0x29')](handleEntityNotFound(_0x506a20,null))[_0x9a22('0x29')](function(_0x5924da){if(_0x5924da){return _0x5924da[_0x9a22('0x88')](_0x27a44c['body'][_0x9a22('0x67')],_[_0x9a22('0x89')](_0x27a44c[_0x9a22('0x51')],['ids','id'])||{})[_0x9a22('0x8a')](function(_0x1eb337){for(var _0x58df08=0x0;_0x58df08<_0x27a44c['body'][_0x9a22('0x67')][_0x9a22('0x3d')];_0x58df08+=0x1){socket[_0x9a22('0x70')](_0x9a22('0x71'),{'UserId':_0x27a44c['body'][_0x9a22('0x67')][_0x58df08],'OpenchannelQueueId':_0x27a44c['params']['id']});}return _0x1eb337;});}})[_0x9a22('0x29')](respondWithResult(_0x506a20,null))[_0x9a22('0x4e')](handleError(_0x506a20,null));};exports[_0x9a22('0x87')]=function(_0x36bae7,_0x411a4b,_0x32ad06){return db['OpenchannelQueue'][_0x9a22('0x55')]({'where':{'id':_0x36bae7['params']['id']}})[_0x9a22('0x29')](handleEntityNotFound(_0x411a4b,null))[_0x9a22('0x29')](function(_0x4feaf6){if(_0x4feaf6){return _0x4feaf6[_0x9a22('0x87')](_0x36bae7['query'][_0x9a22('0x67')])['then'](function(){if(_[_0x9a22('0x8b')](_0x36bae7[_0x9a22('0x37')][_0x9a22('0x67')])){for(var _0x40fe7a=0x0;_0x40fe7a<_0x36bae7[_0x9a22('0x37')]['ids'][_0x9a22('0x3d')];_0x40fe7a+=0x1){socket[_0x9a22('0x70')](_0x9a22('0x8c'),{'UserId':Number(_0x36bae7['query'][_0x9a22('0x67')][_0x40fe7a]),'OpenchannelQueueId':Number(_0x36bae7[_0x9a22('0x4f')]['id'])});}}else{socket[_0x9a22('0x70')](_0x9a22('0x8c'),{'UserId':Number(_0x36bae7['query']['ids']),'OpenchannelQueueId':Number(_0x36bae7[_0x9a22('0x4f')]['id'])});}});}})['then'](respondWithStatusCode(_0x411a4b,null))[_0x9a22('0x4e')](handleError(_0x411a4b,null));};exports[_0x9a22('0x8d')]=function(_0x22e624,_0x469ae2,_0x3b5022){var _0x4f7a5c={};var _0x220fc7={};var _0x46050c;var _0xd064d2;return db[_0x9a22('0x32')]['findOne']({'where':{'id':_0x22e624[_0x9a22('0x4f')]['id']}})[_0x9a22('0x29')](handleEntityNotFound(_0x469ae2,null))[_0x9a22('0x29')](function(_0xe2c696){if(_0xe2c696){_0x46050c=_0xe2c696;_0x220fc7[_0x9a22('0x36')]=_[_0x9a22('0x38')](db[_0x9a22('0x5b')][_0x9a22('0x33')]);_0x220fc7[_0x9a22('0x37')]=_[_0x9a22('0x38')](_0x22e624[_0x9a22('0x37')]);_0x220fc7[_0x9a22('0x39')]=_[_0x9a22('0x3a')](_0x220fc7[_0x9a22('0x36')],_0x220fc7['query']);_0x4f7a5c[_0x9a22('0x3c')]=_[_0x9a22('0x3a')](_0x220fc7['model'],qs[_0x9a22('0x3b')](_0x22e624[_0x9a22('0x37')]['fields']));_0x4f7a5c[_0x9a22('0x3c')]=_0x4f7a5c[_0x9a22('0x3c')][_0x9a22('0x3d')]?_0x4f7a5c[_0x9a22('0x3c')]:_0x220fc7[_0x9a22('0x36')];_0x4f7a5c[_0x9a22('0x41')]=qs[_0x9a22('0x42')](_0x22e624['query'][_0x9a22('0x42')]);_0x4f7a5c[_0x9a22('0x45')]=qs['filters'](_[_0x9a22('0x43')](_0x22e624[_0x9a22('0x37')],_0x220fc7[_0x9a22('0x39')]));if(_0x22e624[_0x9a22('0x37')][_0x9a22('0x44')]){_0x4f7a5c['where']=_[_0x9a22('0x46')](_0x4f7a5c[_0x9a22('0x45')],{'$or':_['map'](_0x4f7a5c[_0x9a22('0x3c')],function(_0x1f0205){var _0x47e0a5={};_0x47e0a5[_0x1f0205]={'$like':'%'+_0x22e624[_0x9a22('0x37')][_0x9a22('0x44')]+'%'};return _0x47e0a5;})});}_0x4f7a5c=_['merge']({},_0x4f7a5c,_0x22e624[_0x9a22('0x49')]);return _0x46050c[_0x9a22('0x8d')](_0x4f7a5c);}})['then'](function(_0xff6de7){if(_0xff6de7){_0xd064d2=_0xff6de7[_0x9a22('0x3d')];if(!_0x22e624[_0x9a22('0x37')]['hasOwnProperty'](_0x9a22('0x3f'))){_0x4f7a5c[_0x9a22('0x40')]=qs[_0x9a22('0x40')](_0x22e624['query'][_0x9a22('0x40')]);_0x4f7a5c[_0x9a22('0x22')]=qs[_0x9a22('0x22')](_0x22e624[_0x9a22('0x37')]['offset']);}return _0x46050c[_0x9a22('0x8d')](_0x4f7a5c);}})[_0x9a22('0x29')](function(_0x35a86d){if(_0x35a86d){return _0x35a86d?{'count':_0xd064d2,'rows':_0x35a86d}:null;}})['then'](respondWithResult(_0x469ae2,null))[_0x9a22('0x4e')](handleError(_0x469ae2,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 2a1d1c4..b1660ee 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 _0x7122=['update','remove','emit','events','../../mysqldb','OpenchannelQueue','setMaxListeners','save'];(function(_0x1b4919,_0x55d152){var _0x4d66d8=function(_0x2fc6a4){while(--_0x2fc6a4){_0x1b4919['push'](_0x1b4919['shift']());}};_0x4d66d8(++_0x55d152);}(_0x7122,0x1eb));var _0x2712=function(_0x4f6a80,_0xa3e4c1){_0x4f6a80=_0x4f6a80-0x0;var _0x296ea6=_0x7122[_0x4f6a80];return _0x296ea6;};'use strict';var EventEmitter=require(_0x2712('0x0'));var OpenchannelQueue=require(_0x2712('0x1'))['db'][_0x2712('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x2712('0x3')](0x0);var events={'afterCreate':_0x2712('0x4'),'afterUpdate':_0x2712('0x5'),'afterDestroy':_0x2712('0x6')};function emitEvent(_0x3d9ff1){return function(_0x23919d,_0x28ff44,_0x771f1e){OpenchannelQueueEvents[_0x2712('0x7')](_0x3d9ff1+':'+_0x23919d['id'],_0x23919d);OpenchannelQueueEvents['emit'](_0x3d9ff1,_0x23919d);_0x771f1e(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelQueue['hook'](e,emitEvent(event));}}module['exports']=OpenchannelQueueEvents; \ No newline at end of file +var _0x67c6=['setMaxListeners','update','emit','hasOwnProperty','hook','exports','events','OpenchannelQueue'];(function(_0x340380,_0x4bd2a8){var _0x49ce1c=function(_0x4cb9e2){while(--_0x4cb9e2){_0x340380['push'](_0x340380['shift']());}};_0x49ce1c(++_0x4bd2a8);}(_0x67c6,0x1b6));var _0x667c=function(_0x1acdf3,_0x214af0){_0x1acdf3=_0x1acdf3-0x0;var _0x447022=_0x67c6[_0x1acdf3];return _0x447022;};'use strict';var EventEmitter=require(_0x667c('0x0'));var OpenchannelQueue=require('../../mysqldb')['db'][_0x667c('0x1')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x667c('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x667c('0x3'),'afterDestroy':'remove'};function emitEvent(_0xedd2c7){return function(_0x119a46,_0x2d1d4a,_0x56b8e8){OpenchannelQueueEvents[_0x667c('0x4')](_0xedd2c7+':'+_0x119a46['id'],_0x119a46);OpenchannelQueueEvents[_0x667c('0x4')](_0xedd2c7,_0x119a46);_0x56b8e8(null);};}for(var e in events){if(events[_0x667c('0x5')](e)){var event=events[e];OpenchannelQueue[_0x667c('0x6')](e,emitEvent(event));}}module[_0x667c('0x7')]=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index c6c83b8..44995b1 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 _0x9e2d=['define','OpenchannelQueue','lodash','util','../../config/logger','moment','bluebird','rimraf','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9e2d,0x16a));var _0xd9e2=function(_0x35a97b,_0x3a045b){_0x35a97b=_0x35a97b-0x0;var _0x1a4189=_0x9e2d[_0x35a97b];return _0x1a4189;};'use strict';var _=require(_0xd9e2('0x0'));var util=require(_0xd9e2('0x1'));var logger=require(_0xd9e2('0x2'))('api');var moment=require(_0xd9e2('0x3'));var BPromise=require(_0xd9e2('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xd9e2('0x5'));var config=require(_0xd9e2('0x6'));var attributes=require('./openchannelQueue.attributes');module['exports']=function(_0x57ac27,_0x4bbc40){return _0x57ac27[_0xd9e2('0x7')](_0xd9e2('0x8'),attributes,{'tableName':'openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaac7=['exports','define','OpenchannelQueue','openchannel_queues','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueue.attributes'];(function(_0x2f93c9,_0x486d2f){var _0x1bf1e1=function(_0x171cca){while(--_0x171cca){_0x2f93c9['push'](_0x2f93c9['shift']());}};_0x1bf1e1(++_0x486d2f);}(_0xaac7,0x122));var _0x7aac=function(_0x1646fa,_0x4e5bd7){_0x1646fa=_0x1646fa-0x0;var _0x5a47a5=_0xaac7[_0x1646fa];return _0x5a47a5;};'use strict';var _=require(_0x7aac('0x0'));var util=require(_0x7aac('0x1'));var logger=require(_0x7aac('0x2'))('api');var moment=require('moment');var BPromise=require(_0x7aac('0x3'));var rp=require(_0x7aac('0x4'));var fs=require('fs');var path=require(_0x7aac('0x5'));var rimraf=require(_0x7aac('0x6'));var config=require(_0x7aac('0x7'));var attributes=require(_0x7aac('0x8'));module[_0x7aac('0x9')]=function(_0x3604ed,_0x2ad8c3){return _0x3604ed[_0x7aac('0xa')](_0x7aac('0xb'),attributes,{'tableName':_0x7aac('0xc'),'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 4d682aa..7547287 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 _0xfa81=['client','http','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','request','then','info','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','OpenchannelQueue,\x20%s,\x20%s','message','result','GetOpenchannelQueue','OpenchannelQueue','findAll','options','raw','where','attributes','limit','include','map','model','find','ShowOpenchannelQueue','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x99d066,_0x13a9d0){var _0x548c90=function(_0x4cbe26){while(--_0x4cbe26){_0x99d066['push'](_0x99d066['shift']());}};_0x548c90(++_0x13a9d0);}(_0xfa81,0x1c4));var _0x1fa8=function(_0x40c49a,_0xe860fc){_0x40c49a=_0x40c49a-0x0;var _0x464aa9=_0xfa81[_0x40c49a];return _0x464aa9;};'use strict';var _=require(_0x1fa8('0x0'));var util=require(_0x1fa8('0x1'));var moment=require(_0x1fa8('0x2'));var BPromise=require(_0x1fa8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1fa8('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x1fa8('0x5'));var logger=require(_0x1fa8('0x6'))(_0x1fa8('0x7'));var config=require(_0x1fa8('0x8'));var jayson=require(_0x1fa8('0x9'));var client=jayson[_0x1fa8('0xa')][_0x1fa8('0xb')]({'port':0x232a});config[_0x1fa8('0xc')]=_[_0x1fa8('0xd')](config['redis'],{'host':_0x1fa8('0xe'),'port':0x18eb});var socket=require(_0x1fa8('0xf'))(new Redis(config[_0x1fa8('0xc')]));require(_0x1fa8('0x10'))['register'](socket);function respondWithRpcPromise(_0x260329,_0x1b93d9,_0x2af4c3){return new BPromise(function(_0x2357a7,_0x59d483){return client[_0x1fa8('0x11')](_0x260329,_0x2af4c3)[_0x1fa8('0x12')](function(_0x44eed6){logger[_0x1fa8('0x13')]('OpenchannelQueue,\x20%s,\x20%s',_0x1b93d9,_0x1fa8('0x14'));logger[_0x1fa8('0x15')](_0x1fa8('0x16'),_0x1b93d9,_0x1fa8('0x14'),JSON[_0x1fa8('0x17')](_0x44eed6));if(_0x44eed6[_0x1fa8('0x18')]){if(_0x44eed6[_0x1fa8('0x18')]['code']===0x1f4){logger[_0x1fa8('0x18')](_0x1fa8('0x19'),_0x1b93d9,_0x44eed6[_0x1fa8('0x18')][_0x1fa8('0x1a')]);return _0x59d483(_0x44eed6[_0x1fa8('0x18')][_0x1fa8('0x1a')]);}logger[_0x1fa8('0x18')](_0x1fa8('0x19'),_0x1b93d9,_0x44eed6[_0x1fa8('0x18')]['message']);return _0x2357a7(_0x44eed6[_0x1fa8('0x18')]['message']);}else{logger['info'](_0x1fa8('0x19'),_0x1b93d9,'request\x20sent');_0x2357a7(_0x44eed6[_0x1fa8('0x1b')][_0x1fa8('0x1a')]);}})['catch'](function(_0x6549a5){logger[_0x1fa8('0x18')]('OpenchannelQueue,\x20%s,\x20%s',_0x1b93d9,_0x6549a5);_0x59d483(_0x6549a5);});});}exports[_0x1fa8('0x1c')]=function(_0x297f0b){var _0x196b42=this;return new Promise(function(_0x3ee912,_0x180663){return db[_0x1fa8('0x1d')][_0x1fa8('0x1e')]({'raw':_0x297f0b[_0x1fa8('0x1f')]?_0x297f0b[_0x1fa8('0x1f')][_0x1fa8('0x20')]===undefined?!![]:![]:!![],'where':_0x297f0b['options']?_0x297f0b['options'][_0x1fa8('0x21')]||null:null,'attributes':_0x297f0b[_0x1fa8('0x1f')]?_0x297f0b['options'][_0x1fa8('0x22')]||null:null,'limit':_0x297f0b['options']?_0x297f0b[_0x1fa8('0x1f')][_0x1fa8('0x23')]||null:null,'include':_0x297f0b[_0x1fa8('0x1f')]?_0x297f0b['options']['include']?_['map'](_0x297f0b[_0x1fa8('0x1f')][_0x1fa8('0x24')],function(_0x2da735){return{'model':db[_0x2da735['model']],'as':_0x2da735['as'],'attributes':_0x2da735[_0x1fa8('0x22')],'include':_0x2da735[_0x1fa8('0x24')]?_[_0x1fa8('0x25')](_0x2da735[_0x1fa8('0x24')],function(_0x2b64b8){return{'model':db[_0x2b64b8[_0x1fa8('0x26')]],'as':_0x2b64b8['as'],'attributes':_0x2b64b8['attributes'],'include':_0x2b64b8[_0x1fa8('0x24')]?_[_0x1fa8('0x25')](_0x2b64b8[_0x1fa8('0x24')],function(_0x27f0f6){return{'model':db[_0x27f0f6[_0x1fa8('0x26')]],'as':_0x27f0f6['as'],'attributes':_0x27f0f6[_0x1fa8('0x22')]};}):[]};}):[]};}):[]:[]})[_0x1fa8('0x12')](function(_0x318673){logger[_0x1fa8('0x13')](_0x1fa8('0x1c'),_0x297f0b);logger[_0x1fa8('0x15')]('GetOpenchannelQueue',_0x297f0b,JSON[_0x1fa8('0x17')](_0x318673));_0x3ee912(_0x318673);})['catch'](function(_0x16fdb1){logger[_0x1fa8('0x18')](_0x1fa8('0x1c'),_0x16fdb1[_0x1fa8('0x1a')],_0x297f0b);_0x180663(_0x196b42[_0x1fa8('0x18')](0x1f4,_0x16fdb1['message']));});});};exports['ShowOpenchannelQueue']=function(_0x30e355){var _0x4ba5bf=this;return new Promise(function(_0x214370,_0x260259){return db[_0x1fa8('0x1d')][_0x1fa8('0x27')]({'raw':_0x30e355[_0x1fa8('0x1f')]?_0x30e355[_0x1fa8('0x1f')][_0x1fa8('0x20')]===undefined?!![]:![]:!![],'where':_0x30e355[_0x1fa8('0x1f')]?_0x30e355[_0x1fa8('0x1f')][_0x1fa8('0x21')]||null:null,'attributes':_0x30e355[_0x1fa8('0x1f')]?_0x30e355['options'][_0x1fa8('0x22')]||null:null,'include':_0x30e355['options']?_0x30e355[_0x1fa8('0x1f')][_0x1fa8('0x24')]?_[_0x1fa8('0x25')](_0x30e355[_0x1fa8('0x1f')][_0x1fa8('0x24')],function(_0x15ad29){return{'model':db[_0x15ad29[_0x1fa8('0x26')]],'as':_0x15ad29['as'],'attributes':_0x15ad29[_0x1fa8('0x22')],'include':_0x15ad29[_0x1fa8('0x24')]?_[_0x1fa8('0x25')](_0x15ad29[_0x1fa8('0x24')],function(_0xe225ca){return{'model':db[_0xe225ca[_0x1fa8('0x26')]],'as':_0xe225ca['as'],'attributes':_0xe225ca[_0x1fa8('0x22')],'include':_0xe225ca[_0x1fa8('0x24')]?_[_0x1fa8('0x25')](_0xe225ca[_0x1fa8('0x24')],function(_0x26c7a8){return{'model':db[_0x26c7a8[_0x1fa8('0x26')]],'as':_0x26c7a8['as'],'attributes':_0x26c7a8[_0x1fa8('0x22')]};}):[]};}):[]};}):[]:[]})[_0x1fa8('0x12')](function(_0xb39ecf){logger[_0x1fa8('0x13')]('ShowOpenchannelQueue',_0x30e355);logger[_0x1fa8('0x15')](_0x1fa8('0x28'),_0x30e355,JSON[_0x1fa8('0x17')](_0xb39ecf));_0x214370(_0xb39ecf);})[_0x1fa8('0x29')](function(_0x378044){logger[_0x1fa8('0x18')](_0x1fa8('0x28'),_0x378044[_0x1fa8('0x1a')],_0x30e355);_0x260259(_0x4ba5bf[_0x1fa8('0x18')](0x1f4,_0x378044[_0x1fa8('0x1a')]));});});}; \ No newline at end of file +var _0x9d9c=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','register','request','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','OpenchannelQueue','findAll','options','raw','where','attributes','include','map','model','then','GetOpenchannelQueue','ShowOpenchannelQueue','find','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x1b9797,_0x9b2f13){var _0x7e4738=function(_0x7b95ad){while(--_0x7b95ad){_0x1b9797['push'](_0x1b9797['shift']());}};_0x7e4738(++_0x9b2f13);}(_0x9d9c,0xf0));var _0xc9d9=function(_0x24f31b,_0x44b8f3){_0x24f31b=_0x24f31b-0x0;var _0x488401=_0x9d9c[_0x24f31b];return _0x488401;};'use strict';var _=require('lodash');var util=require(_0xc9d9('0x0'));var moment=require(_0xc9d9('0x1'));var BPromise=require(_0xc9d9('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc9d9('0x3'));var db=require(_0xc9d9('0x4'))['db'];var utils=require(_0xc9d9('0x5'));var logger=require(_0xc9d9('0x6'))(_0xc9d9('0x7'));var config=require(_0xc9d9('0x8'));var jayson=require(_0xc9d9('0x9'));var client=jayson[_0xc9d9('0xa')][_0xc9d9('0xb')]({'port':0x232a});config[_0xc9d9('0xc')]=_[_0xc9d9('0xd')](config[_0xc9d9('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xc9d9('0xe'))(new Redis(config[_0xc9d9('0xc')]));require('./openchannelQueue.socket')[_0xc9d9('0xf')](socket);function respondWithRpcPromise(_0x5871c6,_0x51d8d5,_0x20af9b){return new BPromise(function(_0x514b9d,_0xf56faa){return client[_0xc9d9('0x10')](_0x5871c6,_0x20af9b)['then'](function(_0x2d47ac){logger[_0xc9d9('0x11')](_0xc9d9('0x12'),_0x51d8d5,_0xc9d9('0x13'));logger[_0xc9d9('0x14')](_0xc9d9('0x15'),_0x51d8d5,_0xc9d9('0x13'),JSON[_0xc9d9('0x16')](_0x2d47ac));if(_0x2d47ac[_0xc9d9('0x17')]){if(_0x2d47ac[_0xc9d9('0x17')][_0xc9d9('0x18')]===0x1f4){logger[_0xc9d9('0x17')](_0xc9d9('0x12'),_0x51d8d5,_0x2d47ac['error']['message']);return _0xf56faa(_0x2d47ac[_0xc9d9('0x17')][_0xc9d9('0x19')]);}logger[_0xc9d9('0x17')](_0xc9d9('0x12'),_0x51d8d5,_0x2d47ac[_0xc9d9('0x17')][_0xc9d9('0x19')]);return _0x514b9d(_0x2d47ac[_0xc9d9('0x17')][_0xc9d9('0x19')]);}else{logger[_0xc9d9('0x11')](_0xc9d9('0x12'),_0x51d8d5,_0xc9d9('0x13'));_0x514b9d(_0x2d47ac[_0xc9d9('0x1a')]['message']);}})[_0xc9d9('0x1b')](function(_0x4375b9){logger[_0xc9d9('0x17')](_0xc9d9('0x12'),_0x51d8d5,_0x4375b9);_0xf56faa(_0x4375b9);});});}exports['GetOpenchannelQueue']=function(_0x22638b){var _0x4f3a4d=this;return new Promise(function(_0x4fa0bd,_0x451be4){return db[_0xc9d9('0x1c')][_0xc9d9('0x1d')]({'raw':_0x22638b[_0xc9d9('0x1e')]?_0x22638b['options'][_0xc9d9('0x1f')]===undefined?!![]:![]:!![],'where':_0x22638b[_0xc9d9('0x1e')]?_0x22638b['options'][_0xc9d9('0x20')]||null:null,'attributes':_0x22638b[_0xc9d9('0x1e')]?_0x22638b['options'][_0xc9d9('0x21')]||null:null,'limit':_0x22638b[_0xc9d9('0x1e')]?_0x22638b[_0xc9d9('0x1e')]['limit']||null:null,'include':_0x22638b['options']?_0x22638b[_0xc9d9('0x1e')][_0xc9d9('0x22')]?_[_0xc9d9('0x23')](_0x22638b[_0xc9d9('0x1e')][_0xc9d9('0x22')],function(_0xbd16fa){return{'model':db[_0xbd16fa['model']],'as':_0xbd16fa['as'],'attributes':_0xbd16fa[_0xc9d9('0x21')],'include':_0xbd16fa[_0xc9d9('0x22')]?_[_0xc9d9('0x23')](_0xbd16fa[_0xc9d9('0x22')],function(_0x381843){return{'model':db[_0x381843[_0xc9d9('0x24')]],'as':_0x381843['as'],'attributes':_0x381843[_0xc9d9('0x21')],'include':_0x381843[_0xc9d9('0x22')]?_[_0xc9d9('0x23')](_0x381843['include'],function(_0x3ac6ad){return{'model':db[_0x3ac6ad['model']],'as':_0x3ac6ad['as'],'attributes':_0x3ac6ad[_0xc9d9('0x21')]};}):[]};}):[]};}):[]:[]})[_0xc9d9('0x25')](function(_0x391718){logger[_0xc9d9('0x11')](_0xc9d9('0x26'),_0x22638b);logger[_0xc9d9('0x14')](_0xc9d9('0x26'),_0x22638b,JSON['stringify'](_0x391718));_0x4fa0bd(_0x391718);})[_0xc9d9('0x1b')](function(_0x14abfd){logger[_0xc9d9('0x17')]('GetOpenchannelQueue',_0x14abfd[_0xc9d9('0x19')],_0x22638b);_0x451be4(_0x4f3a4d[_0xc9d9('0x17')](0x1f4,_0x14abfd['message']));});});};exports[_0xc9d9('0x27')]=function(_0x5defa5){var _0xd30257=this;return new Promise(function(_0x2c4805,_0x287d4a){return db[_0xc9d9('0x1c')][_0xc9d9('0x28')]({'raw':_0x5defa5[_0xc9d9('0x1e')]?_0x5defa5[_0xc9d9('0x1e')][_0xc9d9('0x1f')]===undefined?!![]:![]:!![],'where':_0x5defa5[_0xc9d9('0x1e')]?_0x5defa5[_0xc9d9('0x1e')][_0xc9d9('0x20')]||null:null,'attributes':_0x5defa5[_0xc9d9('0x1e')]?_0x5defa5['options'][_0xc9d9('0x21')]||null:null,'include':_0x5defa5[_0xc9d9('0x1e')]?_0x5defa5['options'][_0xc9d9('0x22')]?_[_0xc9d9('0x23')](_0x5defa5[_0xc9d9('0x1e')]['include'],function(_0x1da2eb){return{'model':db[_0x1da2eb[_0xc9d9('0x24')]],'as':_0x1da2eb['as'],'attributes':_0x1da2eb[_0xc9d9('0x21')],'include':_0x1da2eb['include']?_['map'](_0x1da2eb[_0xc9d9('0x22')],function(_0x4414aa){return{'model':db[_0x4414aa[_0xc9d9('0x24')]],'as':_0x4414aa['as'],'attributes':_0x4414aa[_0xc9d9('0x21')],'include':_0x4414aa[_0xc9d9('0x22')]?_[_0xc9d9('0x23')](_0x4414aa[_0xc9d9('0x22')],function(_0xa8cdd4){return{'model':db[_0xa8cdd4[_0xc9d9('0x24')]],'as':_0xa8cdd4['as'],'attributes':_0xa8cdd4['attributes']};}):[]};}):[]};}):[]:[]})[_0xc9d9('0x25')](function(_0x5aed3a){logger[_0xc9d9('0x11')](_0xc9d9('0x27'),_0x5defa5);logger[_0xc9d9('0x14')]('ShowOpenchannelQueue',_0x5defa5,JSON[_0xc9d9('0x16')](_0x5aed3a));_0x2c4805(_0x5aed3a);})[_0xc9d9('0x1b')](function(_0x43ed82){logger[_0xc9d9('0x17')](_0xc9d9('0x27'),_0x43ed82['message'],_0x5defa5);_0x287d4a(_0xd30257[_0xc9d9('0x17')](0x1f4,_0x43ed82[_0xc9d9('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index b590fab..92dadac 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 _0x183e=['save','remove','update','emit','register','length','openchannelQueue:','./openchannelQueue.events'];(function(_0x3cb83f,_0x2bc6dd){var _0x105d68=function(_0x18bd0f){while(--_0x18bd0f){_0x3cb83f['push'](_0x3cb83f['shift']());}};_0x105d68(++_0x2bc6dd);}(_0x183e,0x157));var _0xe183=function(_0x3c1ad0,_0x1b3ac3){_0x3c1ad0=_0x3c1ad0-0x0;var _0x504171=_0x183e[_0x3c1ad0];return _0x504171;};'use strict';var OpenchannelQueueEvents=require(_0xe183('0x0'));var events=[_0xe183('0x1'),_0xe183('0x2'),_0xe183('0x3')];function createListener(_0x7dc637,_0x1de1ca){return function(_0x27e224){_0x1de1ca[_0xe183('0x4')](_0x7dc637,_0x27e224);};}function removeListener(_0x13034a,_0x1ebd5f){return function(){OpenchannelQueueEvents['removeListener'](_0x13034a,_0x1ebd5f);};}exports[_0xe183('0x5')]=function(_0x55aeb7){for(var _0x13abdc=0x0,_0x4ddc1b=events[_0xe183('0x6')];_0x13abdc<_0x4ddc1b;_0x13abdc++){var _0x342a4b=events[_0x13abdc];var _0x2e21a6=createListener(_0xe183('0x7')+_0x342a4b,_0x55aeb7);OpenchannelQueueEvents['on'](_0x342a4b,_0x2e21a6);}}; \ No newline at end of file +var _0xa76f=['length','openchannelQueue:','./openchannelQueue.events','remove','emit','removeListener','register'];(function(_0x1e5170,_0x3318c4){var _0x598b0a=function(_0x36b3db){while(--_0x36b3db){_0x1e5170['push'](_0x1e5170['shift']());}};_0x598b0a(++_0x3318c4);}(_0xa76f,0x18a));var _0xfa76=function(_0x5dd8ab,_0x27460d){_0x5dd8ab=_0x5dd8ab-0x0;var _0x1dcba3=_0xa76f[_0x5dd8ab];return _0x1dcba3;};'use strict';var OpenchannelQueueEvents=require(_0xfa76('0x0'));var events=['save',_0xfa76('0x1'),'update'];function createListener(_0x8304ba,_0x441955){return function(_0xd73e24){_0x441955[_0xfa76('0x2')](_0x8304ba,_0xd73e24);};}function removeListener(_0x433359,_0x4dd6bd){return function(){OpenchannelQueueEvents[_0xfa76('0x3')](_0x433359,_0x4dd6bd);};}exports[_0xfa76('0x4')]=function(_0x2aedcc){for(var _0x2e2129=0x0,_0x29b065=events[_0xfa76('0x5')];_0x2e2129<_0x29b065;_0x2e2129++){var _0x56b95b=events[_0x2e2129];var _0x579c44=createListener(_0xfa76('0x6')+_0x56b95b,_0x2aedcc);OpenchannelQueueEvents['on'](_0x56b95b,_0x579c44);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index 7b26f2a..101b8bf 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 _0x1e95=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','delete','exports','util','connect-timeout','express','Router'];(function(_0x12a201,_0x30aaba){var _0x52a4d2=function(_0x5ca28d){while(--_0x5ca28d){_0x12a201['push'](_0x12a201['shift']());}};_0x52a4d2(++_0x30aaba);}(_0x1e95,0x18b));var _0x51e9=function(_0x1a8c9b,_0x21cb32){_0x1a8c9b=_0x1a8c9b-0x0;var _0x4ac363=_0x1e95[_0x1a8c9b];return _0x4ac363;};'use strict';var multer=require('multer');var util=require(_0x51e9('0x0'));var path=require('path');var timeout=require(_0x51e9('0x1'));var express=require(_0x51e9('0x2'));var router=express[_0x51e9('0x3')]();var auth=require(_0x51e9('0x4'));var interaction=require(_0x51e9('0x5'));var config=require(_0x51e9('0x6'));var controller=require('./openchannelQueueReport.controller');router[_0x51e9('0x7')]('/',auth[_0x51e9('0x8')](),controller[_0x51e9('0x9')]);router[_0x51e9('0x7')](_0x51e9('0xa'),auth[_0x51e9('0x8')](),controller[_0x51e9('0xb')]);router[_0x51e9('0x7')](_0x51e9('0xc'),auth[_0x51e9('0x8')](),controller[_0x51e9('0xd')]);router[_0x51e9('0xe')]('/',auth[_0x51e9('0x8')](),controller[_0x51e9('0xf')]);router[_0x51e9('0x10')](_0x51e9('0xc'),auth[_0x51e9('0x8')](),controller['update']);router[_0x51e9('0x11')](_0x51e9('0xc'),auth[_0x51e9('0x8')](),controller['destroy']);module[_0x51e9('0x12')]=router; \ No newline at end of file +var _0xe774=['isAuthenticated','index','/describe','describe','/:id','show','create','update','delete','destroy','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','get'];(function(_0x13ca44,_0x56a27d){var _0x62f21f=function(_0x199d67){while(--_0x199d67){_0x13ca44['push'](_0x13ca44['shift']());}};_0x62f21f(++_0x56a27d);}(_0xe774,0x83));var _0x4e77=function(_0x31a8f0,_0x875daf){_0x31a8f0=_0x31a8f0-0x0;var _0x54562d=_0xe774[_0x31a8f0];return _0x54562d;};'use strict';var multer=require(_0x4e77('0x0'));var util=require('util');var path=require(_0x4e77('0x1'));var timeout=require('connect-timeout');var express=require(_0x4e77('0x2'));var router=express[_0x4e77('0x3')]();var auth=require(_0x4e77('0x4'));var interaction=require(_0x4e77('0x5'));var config=require(_0x4e77('0x6'));var controller=require(_0x4e77('0x7'));router[_0x4e77('0x8')]('/',auth[_0x4e77('0x9')](),controller[_0x4e77('0xa')]);router[_0x4e77('0x8')](_0x4e77('0xb'),auth[_0x4e77('0x9')](),controller[_0x4e77('0xc')]);router[_0x4e77('0x8')](_0x4e77('0xd'),auth['isAuthenticated'](),controller[_0x4e77('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x4e77('0xf')]);router['put'](_0x4e77('0xd'),auth['isAuthenticated'](),controller[_0x4e77('0x10')]);router[_0x4e77('0x11')]('/:id',auth[_0x4e77('0x9')](),controller[_0x4e77('0x12')]);module[_0x4e77('0x13')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index d20d9eb..d1e89e7 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 _0xba97=['sequelize','exports','DATE','STRING'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xba97,0xfc));var _0x7ba9=function(_0x562e2d,_0xb96daf){_0x562e2d=_0x562e2d-0x0;var _0x23f7c=_0xba97[_0x562e2d];return _0x23f7c;};'use strict';var moment=require('moment');var Sequelize=require(_0x7ba9('0x0'));module[_0x7ba9('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x7ba9('0x2')]},'leaveAt':{'type':Sequelize[_0x7ba9('0x2')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x7ba9('0x2')]},'reason':{'type':Sequelize[_0x7ba9('0x3')]}}; \ No newline at end of file +var _0x4c48=['STRING','DATE','moment','sequelize'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x4c48,0x1e2));var _0x84c4=function(_0x49bdc4,_0x1e2507){_0x49bdc4=_0x49bdc4-0x0;var _0x1f7437=_0x4c48[_0x49bdc4];return _0x1f7437;};'use strict';var moment=require(_0x84c4('0x0'));var Sequelize=require(_0x84c4('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x84c4('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x84c4('0x2')]},'joinAt':{'type':Sequelize[_0x84c4('0x3')]},'leaveAt':{'type':Sequelize[_0x84c4('0x3')]},'acceptAt':{'type':Sequelize[_0x84c4('0x3')]},'exitAt':{'type':Sequelize[_0x84c4('0x3')]},'reason':{'type':Sequelize[_0x84c4('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index 4096dce..a49dc68 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 _0xa5c1=['destroy','sendStatus','stack','name','send','index','map','OpenchannelQueueReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','limit','order','sort','where','filters','pick','filter','VIRTUAL','options','includeAll','include','rows','catch','show','params','merge','find','create','body','describe','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then'];(function(_0xf7c892,_0x4c030f){var _0x74459e=function(_0x15cebf){while(--_0x15cebf){_0xf7c892['push'](_0xf7c892['shift']());}};_0x74459e(++_0x4c030f);}(_0xa5c1,0x19f));var _0x1a5c=function(_0x5998e3,_0x3f77cf){_0x5998e3=_0x5998e3-0x0;var _0x114287=_0xa5c1[_0x5998e3];return _0x114287;};'use strict';var pdf=require(_0x1a5c('0x0'));var emlformat=require(_0x1a5c('0x1'));var rimraf=require(_0x1a5c('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x1a5c('0x3'));var moment=require('moment');var BPromise=require(_0x1a5c('0x4'));var Mustache=require(_0x1a5c('0x5'));var util=require(_0x1a5c('0x6'));var path=require(_0x1a5c('0x7'));var sox=require(_0x1a5c('0x8'));var csv=require(_0x1a5c('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x1a5c('0xa'));var squel=require('squel');var crypto=require(_0x1a5c('0xb'));var jsforce=require(_0x1a5c('0xc'));var deskjs=require(_0x1a5c('0xd'));var toCsv=require('to-csv');var querystring=require(_0x1a5c('0xe'));var Papa=require('papaparse');var Redis=require(_0x1a5c('0xf'));var authService=require(_0x1a5c('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x1a5c('0x11'));var hardwareService=require(_0x1a5c('0x12'));var logger=require('../../config/logger')(_0x1a5c('0x13'));var utils=require(_0x1a5c('0x14'));var config=require(_0x1a5c('0x15'));var db=require(_0x1a5c('0x16'))['db'];function respondWithStatusCode(_0x3e344e,_0x2b8a65){_0x2b8a65=_0x2b8a65||0xcc;return function(_0x38c7d7){if(_0x38c7d7){return _0x3e344e['sendStatus'](_0x2b8a65);}return _0x3e344e[_0x1a5c('0x17')](_0x2b8a65)[_0x1a5c('0x18')]();};}function respondWithResult(_0x4b240a,_0x157ebb){_0x157ebb=_0x157ebb||0xc8;return function(_0x207899){if(_0x207899){return _0x4b240a['status'](_0x157ebb)[_0x1a5c('0x19')](_0x207899);}};}function respondWithFilteredResult(_0x115aa6,_0xf76c73){return function(_0x170112){if(_0x170112){var _0x555b63=_0x170112[_0x1a5c('0x1a')],_0x2f3ba7=_0xf76c73[_0x1a5c('0x1b')],_0x4e9b28=_0xf76c73['offset']+_0xf76c73['limit'],_0x24dfa0;if(_0x4e9b28>=_0x555b63){_0x4e9b28=_0x555b63;_0x24dfa0=0xc8;}else{_0x24dfa0=0xce;}_0x115aa6[_0x1a5c('0x17')](_0x24dfa0);return _0x115aa6[_0x1a5c('0x1c')](_0x1a5c('0x1d'),_0x2f3ba7+'-'+_0x4e9b28+'/'+_0x555b63)[_0x1a5c('0x19')](_0x170112);}return null;};}function patchUpdates(_0x232798){return function(_0x57edcd){try{jsonpatch[_0x1a5c('0x1e')](_0x57edcd,_0x232798,!![]);}catch(_0x505162){return BPromise[_0x1a5c('0x1f')](_0x505162);}return _0x57edcd[_0x1a5c('0x20')]();};}function saveUpdates(_0x1de306,_0x5b4dfd){return function(_0x31d957){if(_0x31d957){return _0x31d957[_0x1a5c('0x21')](_0x1de306)[_0x1a5c('0x22')](function(_0x3502cb){return _0x3502cb;});}return null;};}function removeEntity(_0x144abf,_0x4d04d0){return function(_0x11964c){if(_0x11964c){return _0x11964c[_0x1a5c('0x23')]()[_0x1a5c('0x22')](function(){_0x144abf[_0x1a5c('0x17')](0xcc)[_0x1a5c('0x18')]();});}};}function handleEntityNotFound(_0x2a2f54,_0x1991f6){return function(_0x414482){if(!_0x414482){_0x2a2f54[_0x1a5c('0x24')](0x194);}return _0x414482;};}function handleError(_0x751c88,_0x38244c){_0x38244c=_0x38244c||0x1f4;return function(_0x323272){logger['error'](_0x323272[_0x1a5c('0x25')]);if(_0x323272['name']){delete _0x323272[_0x1a5c('0x26')];}_0x751c88['status'](_0x38244c)[_0x1a5c('0x27')](_0x323272);};}exports[_0x1a5c('0x28')]=function(_0x12784b,_0x1ba1cf){var _0xcd3e0a={},_0x1e5e87={},_0x157376={'count':0x0,'rows':[]};var _0x3e3dd1=_[_0x1a5c('0x29')](db[_0x1a5c('0x2a')][_0x1a5c('0x2b')],function(_0x4e2fe3){return{'name':_0x4e2fe3[_0x1a5c('0x2c')],'type':_0x4e2fe3[_0x1a5c('0x2d')][_0x1a5c('0x2e')]};});_0x1e5e87[_0x1a5c('0x2f')]=_[_0x1a5c('0x29')](_0x3e3dd1,_0x1a5c('0x26'));_0x1e5e87[_0x1a5c('0x30')]=_[_0x1a5c('0x31')](_0x12784b[_0x1a5c('0x30')]);_0x1e5e87['filters']=_[_0x1a5c('0x32')](_0x1e5e87[_0x1a5c('0x2f')],_0x1e5e87[_0x1a5c('0x30')]);_0xcd3e0a[_0x1a5c('0x33')]=_['intersection'](_0x1e5e87[_0x1a5c('0x2f')],qs[_0x1a5c('0x34')](_0x12784b[_0x1a5c('0x30')][_0x1a5c('0x34')]));_0xcd3e0a[_0x1a5c('0x33')]=_0xcd3e0a[_0x1a5c('0x33')][_0x1a5c('0x35')]?_0xcd3e0a['attributes']:_0x1e5e87[_0x1a5c('0x2f')];if(!_0x12784b[_0x1a5c('0x30')]['hasOwnProperty'](_0x1a5c('0x36'))){_0xcd3e0a[_0x1a5c('0x37')]=qs[_0x1a5c('0x37')](_0x12784b[_0x1a5c('0x30')]['limit']);_0xcd3e0a[_0x1a5c('0x1b')]=qs[_0x1a5c('0x1b')](_0x12784b['query'][_0x1a5c('0x1b')]);}_0xcd3e0a[_0x1a5c('0x38')]=qs[_0x1a5c('0x39')](_0x12784b[_0x1a5c('0x30')][_0x1a5c('0x39')]);_0xcd3e0a[_0x1a5c('0x3a')]=qs[_0x1a5c('0x3b')](_[_0x1a5c('0x3c')](_0x12784b[_0x1a5c('0x30')],_0x1e5e87[_0x1a5c('0x3b')]));if(_0x12784b['query'][_0x1a5c('0x3d')]){_0xcd3e0a[_0x1a5c('0x3a')]=_['merge'](_0xcd3e0a[_0x1a5c('0x3a')],{'$or':_[_0x1a5c('0x29')](_0x3e3dd1,function(_0x4ba8cf){if(_0x4ba8cf['type']!==_0x1a5c('0x3e')){var _0xefaf30={};_0xefaf30[_0x4ba8cf[_0x1a5c('0x26')]]={'$like':'%'+_0x12784b[_0x1a5c('0x30')]['filter']+'%'};return _0xefaf30;}})});}_0xcd3e0a=_['merge']({},_0xcd3e0a,_0x12784b[_0x1a5c('0x3f')]);var _0x387152={'where':_0xcd3e0a[_0x1a5c('0x3a')]};return db['OpenchannelQueueReport'][_0x1a5c('0x1a')](_0x387152)[_0x1a5c('0x22')](function(_0x129cd1){_0x157376[_0x1a5c('0x1a')]=_0x129cd1;if(_0x12784b[_0x1a5c('0x30')][_0x1a5c('0x40')]){_0xcd3e0a[_0x1a5c('0x41')]=[{'all':!![]}];}return db[_0x1a5c('0x2a')]['findAll'](_0xcd3e0a);})['then'](function(_0x5354eb){_0x157376[_0x1a5c('0x42')]=_0x5354eb;return _0x157376;})['then'](respondWithFilteredResult(_0x1ba1cf,_0xcd3e0a))[_0x1a5c('0x43')](handleError(_0x1ba1cf,null));};exports[_0x1a5c('0x44')]=function(_0x420f66,_0x4a7b07){var _0x1072d5={'raw':!![],'where':{'id':_0x420f66[_0x1a5c('0x45')]['id']}},_0x29aec3={};_0x29aec3['model']=_[_0x1a5c('0x31')](db[_0x1a5c('0x2a')][_0x1a5c('0x2b')]);_0x29aec3['query']=_[_0x1a5c('0x31')](_0x420f66[_0x1a5c('0x30')]);_0x29aec3[_0x1a5c('0x3b')]=_['intersection'](_0x29aec3[_0x1a5c('0x2f')],_0x29aec3[_0x1a5c('0x30')]);_0x1072d5['attributes']=_[_0x1a5c('0x32')](_0x29aec3[_0x1a5c('0x2f')],qs['fields'](_0x420f66['query']['fields']));_0x1072d5[_0x1a5c('0x33')]=_0x1072d5[_0x1a5c('0x33')]['length']?_0x1072d5[_0x1a5c('0x33')]:_0x29aec3[_0x1a5c('0x2f')];if(_0x420f66[_0x1a5c('0x30')][_0x1a5c('0x40')]){_0x1072d5[_0x1a5c('0x41')]=[{'all':!![]}];}_0x1072d5=_[_0x1a5c('0x46')]({},_0x1072d5,_0x420f66[_0x1a5c('0x3f')]);return db[_0x1a5c('0x2a')][_0x1a5c('0x47')](_0x1072d5)[_0x1a5c('0x22')](handleEntityNotFound(_0x4a7b07,null))['then'](respondWithResult(_0x4a7b07,null))[_0x1a5c('0x43')](handleError(_0x4a7b07,null));};exports[_0x1a5c('0x48')]=function(_0x3e03f5,_0x11f4c2){return db[_0x1a5c('0x2a')][_0x1a5c('0x48')](_0x3e03f5[_0x1a5c('0x49')],{})[_0x1a5c('0x22')](respondWithResult(_0x11f4c2,0xc9))[_0x1a5c('0x43')](handleError(_0x11f4c2,null));};exports['update']=function(_0x572a01,_0x511c19){if(_0x572a01[_0x1a5c('0x49')]['id']){delete _0x572a01[_0x1a5c('0x49')]['id'];}return db[_0x1a5c('0x2a')]['find']({'where':{'id':_0x572a01[_0x1a5c('0x45')]['id']}})[_0x1a5c('0x22')](handleEntityNotFound(_0x511c19,null))[_0x1a5c('0x22')](saveUpdates(_0x572a01[_0x1a5c('0x49')],null))[_0x1a5c('0x22')](respondWithResult(_0x511c19,null))['catch'](handleError(_0x511c19,null));};exports[_0x1a5c('0x23')]=function(_0x59d583,_0x24e1e9){return db[_0x1a5c('0x2a')][_0x1a5c('0x47')]({'where':{'id':_0x59d583[_0x1a5c('0x45')]['id']}})['then'](handleEntityNotFound(_0x24e1e9,null))[_0x1a5c('0x22')](removeEntity(_0x24e1e9,null))[_0x1a5c('0x43')](handleError(_0x24e1e9,null));};exports[_0x1a5c('0x4a')]=function(_0xd51a84,_0x3d0f37){return db[_0x1a5c('0x2a')][_0x1a5c('0x4a')]()['then'](respondWithResult(_0x3d0f37,null))[_0x1a5c('0x43')](handleError(_0x3d0f37,null));}; \ No newline at end of file +var _0xa3fe=['find','catch','create','body','update','describe','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','util','sox','to-csv','ejs','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../mysqldb','end','status','count','offset','limit','set','Content-Range','json','apply','reject','save','destroy','then','sendStatus','error','stack','name','send','index','map','OpenchannelQueueReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','include','findAll','show','params'];(function(_0x4c3296,_0x262566){var _0x5260de=function(_0x2543c6){while(--_0x2543c6){_0x4c3296['push'](_0x4c3296['shift']());}};_0x5260de(++_0x262566);}(_0xa3fe,0xd8));var _0xea3f=function(_0x5926b8,_0x10b9bb){_0x5926b8=_0x5926b8-0x0;var _0x1640ad=_0xa3fe[_0x5926b8];return _0x1640ad;};'use strict';var pdf=require(_0xea3f('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xea3f('0x1'));var zipdir=require(_0xea3f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xea3f('0x3'));var moment=require(_0xea3f('0x4'));var BPromise=require(_0xea3f('0x5'));var Mustache=require('mustache');var util=require(_0xea3f('0x6'));var path=require('path');var sox=require(_0xea3f('0x7'));var csv=require(_0xea3f('0x8'));var ejs=require(_0xea3f('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xea3f('0xa'));var jsforce=require(_0xea3f('0xb'));var deskjs=require(_0xea3f('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xea3f('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xea3f('0xe'));var as=require(_0xea3f('0xf'));var hardwareService=require(_0xea3f('0x10'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xea3f('0x11'));var db=require(_0xea3f('0x12'))['db'];function respondWithStatusCode(_0x426577,_0x363046){_0x363046=_0x363046||0xcc;return function(_0x4a36da){if(_0x4a36da){return _0x426577['sendStatus'](_0x363046);}return _0x426577['status'](_0x363046)[_0xea3f('0x13')]();};}function respondWithResult(_0x347578,_0x5b246b){_0x5b246b=_0x5b246b||0xc8;return function(_0x260985){if(_0x260985){return _0x347578[_0xea3f('0x14')](_0x5b246b)['json'](_0x260985);}};}function respondWithFilteredResult(_0x1786f6,_0x307409){return function(_0x153f0e){if(_0x153f0e){var _0x4becc3=_0x153f0e[_0xea3f('0x15')],_0x32c2f=_0x307409[_0xea3f('0x16')],_0x15e057=_0x307409[_0xea3f('0x16')]+_0x307409[_0xea3f('0x17')],_0x7470e3;if(_0x15e057>=_0x4becc3){_0x15e057=_0x4becc3;_0x7470e3=0xc8;}else{_0x7470e3=0xce;}_0x1786f6[_0xea3f('0x14')](_0x7470e3);return _0x1786f6[_0xea3f('0x18')](_0xea3f('0x19'),_0x32c2f+'-'+_0x15e057+'/'+_0x4becc3)[_0xea3f('0x1a')](_0x153f0e);}return null;};}function patchUpdates(_0xc199e4){return function(_0x24d3b5){try{jsonpatch[_0xea3f('0x1b')](_0x24d3b5,_0xc199e4,!![]);}catch(_0x4bbd3c){return BPromise[_0xea3f('0x1c')](_0x4bbd3c);}return _0x24d3b5[_0xea3f('0x1d')]();};}function saveUpdates(_0x3ed181,_0xe50958){return function(_0x11f66c){if(_0x11f66c){return _0x11f66c['update'](_0x3ed181)['then'](function(_0xd55dea){return _0xd55dea;});}return null;};}function removeEntity(_0x29dd1f,_0x4c6d50){return function(_0x284f3b){if(_0x284f3b){return _0x284f3b[_0xea3f('0x1e')]()[_0xea3f('0x1f')](function(){_0x29dd1f[_0xea3f('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5bd381,_0x5c2eb0){return function(_0x2f8bdc){if(!_0x2f8bdc){_0x5bd381[_0xea3f('0x20')](0x194);}return _0x2f8bdc;};}function handleError(_0x1499f2,_0x17b381){_0x17b381=_0x17b381||0x1f4;return function(_0x37fefb){logger[_0xea3f('0x21')](_0x37fefb[_0xea3f('0x22')]);if(_0x37fefb['name']){delete _0x37fefb[_0xea3f('0x23')];}_0x1499f2['status'](_0x17b381)[_0xea3f('0x24')](_0x37fefb);};}exports[_0xea3f('0x25')]=function(_0x1f66b3,_0x1e2932){var _0x2a3860={},_0x50b6f5={},_0xaf81bb={'count':0x0,'rows':[]};var _0x52a401=_[_0xea3f('0x26')](db[_0xea3f('0x27')][_0xea3f('0x28')],function(_0x4cd4e9){return{'name':_0x4cd4e9[_0xea3f('0x29')],'type':_0x4cd4e9[_0xea3f('0x2a')]['key']};});_0x50b6f5[_0xea3f('0x2b')]=_[_0xea3f('0x26')](_0x52a401,_0xea3f('0x23'));_0x50b6f5[_0xea3f('0x2c')]=_[_0xea3f('0x2d')](_0x1f66b3[_0xea3f('0x2c')]);_0x50b6f5[_0xea3f('0x2e')]=_[_0xea3f('0x2f')](_0x50b6f5[_0xea3f('0x2b')],_0x50b6f5[_0xea3f('0x2c')]);_0x2a3860[_0xea3f('0x30')]=_[_0xea3f('0x2f')](_0x50b6f5[_0xea3f('0x2b')],qs[_0xea3f('0x31')](_0x1f66b3[_0xea3f('0x2c')][_0xea3f('0x31')]));_0x2a3860[_0xea3f('0x30')]=_0x2a3860[_0xea3f('0x30')][_0xea3f('0x32')]?_0x2a3860['attributes']:_0x50b6f5[_0xea3f('0x2b')];if(!_0x1f66b3[_0xea3f('0x2c')][_0xea3f('0x33')](_0xea3f('0x34'))){_0x2a3860[_0xea3f('0x17')]=qs[_0xea3f('0x17')](_0x1f66b3[_0xea3f('0x2c')][_0xea3f('0x17')]);_0x2a3860[_0xea3f('0x16')]=qs['offset'](_0x1f66b3[_0xea3f('0x2c')][_0xea3f('0x16')]);}_0x2a3860[_0xea3f('0x35')]=qs[_0xea3f('0x36')](_0x1f66b3[_0xea3f('0x2c')]['sort']);_0x2a3860['where']=qs[_0xea3f('0x2e')](_['pick'](_0x1f66b3[_0xea3f('0x2c')],_0x50b6f5[_0xea3f('0x2e')]));if(_0x1f66b3[_0xea3f('0x2c')][_0xea3f('0x37')]){_0x2a3860[_0xea3f('0x38')]=_[_0xea3f('0x39')](_0x2a3860['where'],{'$or':_[_0xea3f('0x26')](_0x52a401,function(_0x557b8d){if(_0x557b8d['type']!==_0xea3f('0x3a')){var _0x236757={};_0x236757[_0x557b8d[_0xea3f('0x23')]]={'$like':'%'+_0x1f66b3[_0xea3f('0x2c')][_0xea3f('0x37')]+'%'};return _0x236757;}})});}_0x2a3860=_[_0xea3f('0x39')]({},_0x2a3860,_0x1f66b3[_0xea3f('0x3b')]);var _0x2d07ef={'where':_0x2a3860[_0xea3f('0x38')]};return db[_0xea3f('0x27')][_0xea3f('0x15')](_0x2d07ef)[_0xea3f('0x1f')](function(_0x2adbb0){_0xaf81bb['count']=_0x2adbb0;if(_0x1f66b3[_0xea3f('0x2c')]['includeAll']){_0x2a3860[_0xea3f('0x3c')]=[{'all':!![]}];}return db[_0xea3f('0x27')][_0xea3f('0x3d')](_0x2a3860);})[_0xea3f('0x1f')](function(_0x115a60){_0xaf81bb['rows']=_0x115a60;return _0xaf81bb;})[_0xea3f('0x1f')](respondWithFilteredResult(_0x1e2932,_0x2a3860))['catch'](handleError(_0x1e2932,null));};exports[_0xea3f('0x3e')]=function(_0x3b1109,_0x313a92){var _0x26b06a={'raw':!![],'where':{'id':_0x3b1109[_0xea3f('0x3f')]['id']}},_0xf9b89f={};_0xf9b89f[_0xea3f('0x2b')]=_[_0xea3f('0x2d')](db[_0xea3f('0x27')][_0xea3f('0x28')]);_0xf9b89f[_0xea3f('0x2c')]=_[_0xea3f('0x2d')](_0x3b1109[_0xea3f('0x2c')]);_0xf9b89f[_0xea3f('0x2e')]=_[_0xea3f('0x2f')](_0xf9b89f['model'],_0xf9b89f[_0xea3f('0x2c')]);_0x26b06a['attributes']=_[_0xea3f('0x2f')](_0xf9b89f['model'],qs[_0xea3f('0x31')](_0x3b1109[_0xea3f('0x2c')]['fields']));_0x26b06a[_0xea3f('0x30')]=_0x26b06a[_0xea3f('0x30')]['length']?_0x26b06a[_0xea3f('0x30')]:_0xf9b89f[_0xea3f('0x2b')];if(_0x3b1109[_0xea3f('0x2c')]['includeAll']){_0x26b06a[_0xea3f('0x3c')]=[{'all':!![]}];}_0x26b06a=_[_0xea3f('0x39')]({},_0x26b06a,_0x3b1109[_0xea3f('0x3b')]);return db[_0xea3f('0x27')][_0xea3f('0x40')](_0x26b06a)[_0xea3f('0x1f')](handleEntityNotFound(_0x313a92,null))[_0xea3f('0x1f')](respondWithResult(_0x313a92,null))[_0xea3f('0x41')](handleError(_0x313a92,null));};exports[_0xea3f('0x42')]=function(_0x28c927,_0x1d8e5f){return db[_0xea3f('0x27')][_0xea3f('0x42')](_0x28c927[_0xea3f('0x43')],{})['then'](respondWithResult(_0x1d8e5f,0xc9))['catch'](handleError(_0x1d8e5f,null));};exports[_0xea3f('0x44')]=function(_0x521d33,_0x1739a6){if(_0x521d33[_0xea3f('0x43')]['id']){delete _0x521d33['body']['id'];}return db['OpenchannelQueueReport']['find']({'where':{'id':_0x521d33['params']['id']}})[_0xea3f('0x1f')](handleEntityNotFound(_0x1739a6,null))[_0xea3f('0x1f')](saveUpdates(_0x521d33[_0xea3f('0x43')],null))[_0xea3f('0x1f')](respondWithResult(_0x1739a6,null))[_0xea3f('0x41')](handleError(_0x1739a6,null));};exports[_0xea3f('0x1e')]=function(_0x5cbe02,_0x3328ed){return db['OpenchannelQueueReport'][_0xea3f('0x40')]({'where':{'id':_0x5cbe02[_0xea3f('0x3f')]['id']}})['then'](handleEntityNotFound(_0x3328ed,null))[_0xea3f('0x1f')](removeEntity(_0x3328ed,null))[_0xea3f('0x41')](handleError(_0x3328ed,null));};exports['describe']=function(_0x254547,_0x40d579){return db[_0xea3f('0x27')][_0xea3f('0x45')]()[_0xea3f('0x1f')](respondWithResult(_0x40d579,null))[_0xea3f('0x41')](handleError(_0x40d579,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 1ba9282..fdeede4 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 _0xccdc=['bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','exports','OpenchannelQueueReport','report_openchannel_queue','uniqueid','lodash','util','moment'];(function(_0x555b2f,_0x43b622){var _0x81c0a6=function(_0x4629e6){while(--_0x4629e6){_0x555b2f['push'](_0x555b2f['shift']());}};_0x81c0a6(++_0x43b622);}(_0xccdc,0x1c4));var _0xcccd=function(_0x11ce46,_0x177a85){_0x11ce46=_0x11ce46-0x0;var _0x368a1e=_0xccdc[_0x11ce46];return _0x368a1e;};'use strict';var _=require(_0xcccd('0x0'));var util=require(_0xcccd('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xcccd('0x2'));var BPromise=require(_0xcccd('0x3'));var rp=require(_0xcccd('0x4'));var fs=require('fs');var path=require(_0xcccd('0x5'));var rimraf=require(_0xcccd('0x6'));var config=require(_0xcccd('0x7'));var attributes=require(_0xcccd('0x8'));module[_0xcccd('0x9')]=function(_0x2da46a,_0x18365a){return _0x2da46a['define'](_0xcccd('0xa'),attributes,{'tableName':_0xcccd('0xb'),'paranoid':![],'indexes':[{'name':_0xcccd('0xc'),'fields':[_0xcccd('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x75f0=['exports','OpenchannelQueueReport','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./openchannelQueueReport.attributes'];(function(_0xb06ec8,_0x79339e){var _0x3698c9=function(_0x398776){while(--_0x398776){_0xb06ec8['push'](_0xb06ec8['shift']());}};_0x3698c9(++_0x79339e);}(_0x75f0,0x196));var _0x075f=function(_0x1031ab,_0x11a0e6){_0x1031ab=_0x1031ab-0x0;var _0x15ba29=_0x75f0[_0x1031ab];return _0x15ba29;};'use strict';var _=require(_0x075f('0x0'));var util=require(_0x075f('0x1'));var logger=require(_0x075f('0x2'))(_0x075f('0x3'));var moment=require(_0x075f('0x4'));var BPromise=require(_0x075f('0x5'));var rp=require(_0x075f('0x6'));var fs=require('fs');var path=require(_0x075f('0x7'));var rimraf=require(_0x075f('0x8'));var config=require('../../config/environment');var attributes=require(_0x075f('0x9'));module[_0x075f('0xa')]=function(_0x1270b4,_0x590f0e){return _0x1270b4['define'](_0x075f('0xb'),attributes,{'tableName':'report_openchannel_queue','paranoid':![],'indexes':[{'name':_0x075f('0xc'),'fields':[_0x075f('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index dd11e05..a368a12 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 _0x7880=['body','options','then','stringify','update','raw','where','attributes','limit','UpdateOpenchannelQueueReport','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','CreateOpenchannelQueueReport','create'];(function(_0x5817bb,_0x47d407){var _0x16c4d7=function(_0x319d47){while(--_0x319d47){_0x5817bb['push'](_0x5817bb['shift']());}};_0x16c4d7(++_0x47d407);}(_0x7880,0x1f4));var _0x0788=function(_0x53c552,_0x129587){_0x53c552=_0x53c552-0x0;var _0x599000=_0x7880[_0x53c552];return _0x599000;};'use strict';var _=require('lodash');var util=require(_0x0788('0x0'));var moment=require(_0x0788('0x1'));var BPromise=require(_0x0788('0x2'));var rs=require(_0x0788('0x3'));var fs=require('fs');var Redis=require(_0x0788('0x4'));var db=require(_0x0788('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0788('0x6'))(_0x0788('0x7'));var config=require(_0x0788('0x8'));var jayson=require(_0x0788('0x9'));var client=jayson[_0x0788('0xa')][_0x0788('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3f9cb8,_0x44bbb5,_0x3c29f3){return new BPromise(function(_0x422f8b,_0x55e48a){return client[_0x0788('0xc')](_0x3f9cb8,_0x3c29f3)['then'](function(_0xabaf81){logger['info'](_0x0788('0xd'),_0x44bbb5,_0x0788('0xe'));logger[_0x0788('0xf')](_0x0788('0x10'),_0x44bbb5,_0x0788('0xe'),JSON['stringify'](_0xabaf81));if(_0xabaf81[_0x0788('0x11')]){if(_0xabaf81[_0x0788('0x11')][_0x0788('0x12')]===0x1f4){logger[_0x0788('0x11')](_0x0788('0xd'),_0x44bbb5,_0xabaf81[_0x0788('0x11')][_0x0788('0x13')]);return _0x55e48a(_0xabaf81['error'][_0x0788('0x13')]);}logger[_0x0788('0x11')](_0x0788('0xd'),_0x44bbb5,_0xabaf81[_0x0788('0x11')]['message']);return _0x422f8b(_0xabaf81[_0x0788('0x11')]['message']);}else{logger[_0x0788('0x14')](_0x0788('0xd'),_0x44bbb5,_0x0788('0xe'));_0x422f8b(_0xabaf81[_0x0788('0x15')][_0x0788('0x13')]);}})[_0x0788('0x16')](function(_0x5e1a29){logger['error'](_0x0788('0xd'),_0x44bbb5,_0x5e1a29);_0x55e48a(_0x5e1a29);});});}exports[_0x0788('0x17')]=function(_0x5b2bdc){var _0x654e4b=this;return new Promise(function(_0x415f19,_0x17ae59){return db['OpenchannelQueueReport'][_0x0788('0x18')](_0x5b2bdc[_0x0788('0x19')],{'raw':_0x5b2bdc['options']?_0x5b2bdc[_0x0788('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0x0788('0x1b')](function(_0x48bc5f){logger[_0x0788('0x14')](_0x0788('0x17'),_0x5b2bdc);logger[_0x0788('0xf')](_0x0788('0x17'),_0x5b2bdc,JSON[_0x0788('0x1c')](_0x48bc5f));_0x415f19(_0x48bc5f);})['catch'](function(_0x48ec43){logger[_0x0788('0x11')](_0x0788('0x17'),_0x48ec43[_0x0788('0x13')],_0x5b2bdc);_0x17ae59(_0x654e4b[_0x0788('0x11')](0x1f4,_0x48ec43['message']));});});};exports['UpdateOpenchannelQueueReport']=function(_0x79204e){var _0x18cc33=this;return new Promise(function(_0x40309d,_0x50b65c){return db['OpenchannelQueueReport'][_0x0788('0x1d')](_0x79204e[_0x0788('0x19')],{'raw':_0x79204e['options']?_0x79204e['options'][_0x0788('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x79204e[_0x0788('0x1a')]?_0x79204e['options'][_0x0788('0x1f')]||null:null,'attributes':_0x79204e[_0x0788('0x1a')]?_0x79204e[_0x0788('0x1a')][_0x0788('0x20')]||null:null,'limit':_0x79204e[_0x0788('0x1a')]?_0x79204e[_0x0788('0x1a')][_0x0788('0x21')]||null:null})[_0x0788('0x1b')](function(_0x5b7594){logger['info'](_0x0788('0x22'),_0x79204e);logger[_0x0788('0xf')]('UpdateOpenchannelQueueReport',_0x79204e,JSON['stringify'](_0x5b7594));_0x40309d(_0x5b7594);})[_0x0788('0x16')](function(_0x68658a){logger[_0x0788('0x11')](_0x0788('0x22'),_0x68658a[_0x0788('0x13')],_0x79204e);_0x50b65c(_0x18cc33[_0x0788('0x11')](0x1f4,_0x68658a[_0x0788('0x13')]));});});}; \ No newline at end of file +var _0x0b7f=['CreateOpenchannelQueueReport','OpenchannelQueueReport','create','options','raw','debug','stringify','catch','UpdateOpenchannelQueueReport','update','body','attributes','limit','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','error','code','OpenchannelQueueReport,\x20%s,\x20%s','message','request\x20sent','result'];(function(_0x1a4ac4,_0x56ab81){var _0x5e6230=function(_0x34b81e){while(--_0x34b81e){_0x1a4ac4['push'](_0x1a4ac4['shift']());}};_0x5e6230(++_0x56ab81);}(_0x0b7f,0x115));var _0xf0b7=function(_0xed4e3c,_0x39e976){_0xed4e3c=_0xed4e3c-0x0;var _0x4297cc=_0x0b7f[_0xed4e3c];return _0x4297cc;};'use strict';var _=require(_0xf0b7('0x0'));var util=require(_0xf0b7('0x1'));var moment=require('moment');var BPromise=require(_0xf0b7('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf0b7('0x3'));var db=require(_0xf0b7('0x4'))['db'];var utils=require(_0xf0b7('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xf0b7('0x6'));var jayson=require(_0xf0b7('0x7'));var client=jayson[_0xf0b7('0x8')][_0xf0b7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2b2de8,_0x5e449a,_0x1408ee){return new BPromise(function(_0x276f09,_0x275a13){return client[_0xf0b7('0xa')](_0x2b2de8,_0x1408ee)[_0xf0b7('0xb')](function(_0x588b46){logger[_0xf0b7('0xc')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x5e449a,'request\x20sent');logger['debug'](_0xf0b7('0xd'),_0x5e449a,'request\x20sent',JSON['stringify'](_0x588b46));if(_0x588b46[_0xf0b7('0xe')]){if(_0x588b46[_0xf0b7('0xe')][_0xf0b7('0xf')]===0x1f4){logger[_0xf0b7('0xe')](_0xf0b7('0x10'),_0x5e449a,_0x588b46[_0xf0b7('0xe')][_0xf0b7('0x11')]);return _0x275a13(_0x588b46[_0xf0b7('0xe')]['message']);}logger['error'](_0xf0b7('0x10'),_0x5e449a,_0x588b46[_0xf0b7('0xe')][_0xf0b7('0x11')]);return _0x276f09(_0x588b46[_0xf0b7('0xe')][_0xf0b7('0x11')]);}else{logger['info'](_0xf0b7('0x10'),_0x5e449a,_0xf0b7('0x12'));_0x276f09(_0x588b46[_0xf0b7('0x13')][_0xf0b7('0x11')]);}})['catch'](function(_0x303db6){logger[_0xf0b7('0xe')](_0xf0b7('0x10'),_0x5e449a,_0x303db6);_0x275a13(_0x303db6);});});}exports[_0xf0b7('0x14')]=function(_0x52b27e){var _0x1e5fc9=this;return new Promise(function(_0x153d23,_0x28fd36){return db[_0xf0b7('0x15')][_0xf0b7('0x16')](_0x52b27e['body'],{'raw':_0x52b27e[_0xf0b7('0x17')]?_0x52b27e['options'][_0xf0b7('0x18')]===undefined?!![]:![]:!![]})[_0xf0b7('0xb')](function(_0x374496){logger['info']('CreateOpenchannelQueueReport',_0x52b27e);logger[_0xf0b7('0x19')](_0xf0b7('0x14'),_0x52b27e,JSON[_0xf0b7('0x1a')](_0x374496));_0x153d23(_0x374496);})[_0xf0b7('0x1b')](function(_0xb90b3c){logger[_0xf0b7('0xe')](_0xf0b7('0x14'),_0xb90b3c[_0xf0b7('0x11')],_0x52b27e);_0x28fd36(_0x1e5fc9[_0xf0b7('0xe')](0x1f4,_0xb90b3c['message']));});});};exports[_0xf0b7('0x1c')]=function(_0x2cfb7b){var _0x14782a=this;return new Promise(function(_0x210afa,_0x2ba0da){return db[_0xf0b7('0x15')][_0xf0b7('0x1d')](_0x2cfb7b[_0xf0b7('0x1e')],{'raw':_0x2cfb7b[_0xf0b7('0x17')]?_0x2cfb7b[_0xf0b7('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2cfb7b[_0xf0b7('0x17')]?_0x2cfb7b[_0xf0b7('0x17')]['where']||null:null,'attributes':_0x2cfb7b[_0xf0b7('0x17')]?_0x2cfb7b[_0xf0b7('0x17')][_0xf0b7('0x1f')]||null:null,'limit':_0x2cfb7b['options']?_0x2cfb7b[_0xf0b7('0x17')][_0xf0b7('0x20')]||null:null})[_0xf0b7('0xb')](function(_0x4fda93){logger[_0xf0b7('0xc')](_0xf0b7('0x1c'),_0x2cfb7b);logger[_0xf0b7('0x19')](_0xf0b7('0x1c'),_0x2cfb7b,JSON[_0xf0b7('0x1a')](_0x4fda93));_0x210afa(_0x4fda93);})[_0xf0b7('0x1b')](function(_0x10643f){logger[_0xf0b7('0xe')](_0xf0b7('0x1c'),_0x10643f[_0xf0b7('0x11')],_0x2cfb7b);_0x2ba0da(_0x14782a['error'](0x1f4,_0x10643f[_0xf0b7('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 06e6f98..554e816 100644 --- a/server/api/openchannelTransferReport/index.js +++ b/server/api/openchannelTransferReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['put','destroy','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','get','isAuthenticated','/describe','/:id','post','create'];(function(_0x1c9c24,_0x2a517b){var _0x349c69=function(_0x259ff7){while(--_0x259ff7){_0x1c9c24['push'](_0x1c9c24['shift']());}};_0x349c69(++_0x2a517b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xa9e0[_0x2b10c6];return _0x3789d2;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x0a9e('0x4'));var config=require(_0x0a9e('0x5'));var controller=require(_0x0a9e('0x6'));router[_0x0a9e('0x7')]('/',auth[_0x0a9e('0x8')](),controller['index']);router[_0x0a9e('0x7')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller['describe']);router['get'](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0xb')]('/',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xc')]);router[_0x0a9e('0xd')](_0x0a9e('0xa'),auth[_0x0a9e('0x8')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xe')]);module[_0x0a9e('0xf')]=router; \ No newline at end of file +var _0xa9e0=['put','destroy','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','get','isAuthenticated','/describe','/:id','post','create'];(function(_0x4fc9e6,_0xc51915){var _0x551d28=function(_0x1a603b){while(--_0x1a603b){_0x4fc9e6['push'](_0x4fc9e6['shift']());}};_0x551d28(++_0xc51915);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0xa9e0[_0xbe200f];return _0x192597;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x0a9e('0x4'));var config=require(_0x0a9e('0x5'));var controller=require(_0x0a9e('0x6'));router[_0x0a9e('0x7')]('/',auth[_0x0a9e('0x8')](),controller['index']);router[_0x0a9e('0x7')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller['describe']);router['get'](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0xb')]('/',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xc')]);router[_0x0a9e('0xd')](_0x0a9e('0xa'),auth[_0x0a9e('0x8')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xe')]);module[_0x0a9e('0xf')]=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index 39605dc..b1d2990 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 _0xa8c7=['queue','DATE','NOW','moment','exports','STRING','ENUM'];(function(_0x314f0d,_0x47d027){var _0x546dee=function(_0x7fc401){while(--_0x7fc401){_0x314f0d['push'](_0x314f0d['shift']());}};_0x546dee(++_0x47d027);}(_0xa8c7,0x15a));var _0x7a8c=function(_0x1402a2,_0x34beff){_0x1402a2=_0x1402a2-0x0;var _0x9f6c1f=_0xa8c7[_0x1402a2];return _0x9f6c1f;};'use strict';var moment=require(_0x7a8c('0x0'));var Sequelize=require('sequelize');module[_0x7a8c('0x1')]={'uniqueid':{'type':Sequelize[_0x7a8c('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x7a8c('0x3')]('account','agent','queue'),'allowNull':![],'defaultValue':_0x7a8c('0x4')},'transferredAt':{'type':Sequelize[_0x7a8c('0x5')],'allowNull':![],'defaultValue':Sequelize[_0x7a8c('0x6')]}}; \ No newline at end of file +var _0x0bfb=['moment','sequelize','exports','STRING','ENUM','queue','DATE'];(function(_0x54814d,_0x5e432f){var _0x4e77ca=function(_0x272ba2){while(--_0x272ba2){_0x54814d['push'](_0x54814d['shift']());}};_0x4e77ca(++_0x5e432f);}(_0x0bfb,0x93));var _0xb0bf=function(_0xb3ba1b,_0x5745b6){_0xb3ba1b=_0xb3ba1b-0x0;var _0x22d20d=_0x0bfb[_0xb3ba1b];return _0x22d20d;};'use strict';var moment=require(_0xb0bf('0x0'));var Sequelize=require(_0xb0bf('0x1'));module[_0xb0bf('0x2')]={'uniqueid':{'type':Sequelize[_0xb0bf('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xb0bf('0x4')]('account','agent',_0xb0bf('0x5')),'allowNull':![],'defaultValue':_0xb0bf('0x5')},'transferredAt':{'type':Sequelize[_0xb0bf('0x6')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index c64c98b..ff1d1a8 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 _0x3d4a=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','index','OpenchannelTransferReport','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','merge','where','includeAll','include','findAll','catch','show','params','keys','rawAttributes','options','create','body','find','describe','eml-format','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x136604,_0x2990ce){var _0x444cc6=function(_0x5ee8c6){while(--_0x5ee8c6){_0x136604['push'](_0x136604['shift']());}};_0x444cc6(++_0x2990ce);}(_0x3d4a,0x87));var _0xa3d4=function(_0x5cc623,_0x2013e){_0x5cc623=_0x5cc623-0x0;var _0x31799e=_0x3d4a[_0x5cc623];return _0x31799e;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xa3d4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa3d4('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa3d4('0x2'));var BPromise=require(_0xa3d4('0x3'));var Mustache=require(_0xa3d4('0x4'));var util=require(_0xa3d4('0x5'));var path=require(_0xa3d4('0x6'));var sox=require(_0xa3d4('0x7'));var csv=require(_0xa3d4('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xa3d4('0x9'));var crypto=require(_0xa3d4('0xa'));var jsforce=require(_0xa3d4('0xb'));var deskjs=require(_0xa3d4('0xc'));var toCsv=require(_0xa3d4('0x8'));var querystring=require(_0xa3d4('0xd'));var Papa=require('papaparse');var Redis=require(_0xa3d4('0xe'));var authService=require(_0xa3d4('0xf'));var qs=require(_0xa3d4('0x10'));var as=require(_0xa3d4('0x11'));var hardwareService=require(_0xa3d4('0x12'));var logger=require(_0xa3d4('0x13'))(_0xa3d4('0x14'));var utils=require(_0xa3d4('0x15'));var config=require(_0xa3d4('0x16'));var db=require(_0xa3d4('0x17'))['db'];function respondWithStatusCode(_0x31cc29,_0x43d7dc){_0x43d7dc=_0x43d7dc||0xcc;return function(_0x2aed25){if(_0x2aed25){return _0x31cc29[_0xa3d4('0x18')](_0x43d7dc);}return _0x31cc29[_0xa3d4('0x19')](_0x43d7dc)[_0xa3d4('0x1a')]();};}function respondWithResult(_0x27c0ee,_0x51b7fd){_0x51b7fd=_0x51b7fd||0xc8;return function(_0x46e0e6){if(_0x46e0e6){return _0x27c0ee['status'](_0x51b7fd)[_0xa3d4('0x1b')](_0x46e0e6);}};}function respondWithFilteredResult(_0x45b57c,_0x6c568f){return function(_0x33ea38){if(_0x33ea38){var _0x2f33d4=_0x33ea38[_0xa3d4('0x1c')],_0x1d98f0=_0x6c568f[_0xa3d4('0x1d')],_0x238b0c=_0x6c568f[_0xa3d4('0x1d')]+_0x6c568f[_0xa3d4('0x1e')],_0x1ce082;if(_0x238b0c>=_0x2f33d4){_0x238b0c=_0x2f33d4;_0x1ce082=0xc8;}else{_0x1ce082=0xce;}_0x45b57c[_0xa3d4('0x19')](_0x1ce082);return _0x45b57c[_0xa3d4('0x1f')](_0xa3d4('0x20'),_0x1d98f0+'-'+_0x238b0c+'/'+_0x2f33d4)[_0xa3d4('0x1b')](_0x33ea38);}return null;};}function patchUpdates(_0x4aa4da){return function(_0x567a77){try{jsonpatch[_0xa3d4('0x21')](_0x567a77,_0x4aa4da,!![]);}catch(_0x3612d6){return BPromise[_0xa3d4('0x22')](_0x3612d6);}return _0x567a77[_0xa3d4('0x23')]();};}function saveUpdates(_0x36e3ed,_0x25beae){return function(_0x27c948){if(_0x27c948){return _0x27c948[_0xa3d4('0x24')](_0x36e3ed)['then'](function(_0x4fd104){return _0x4fd104;});}return null;};}function removeEntity(_0x74d534,_0x4b6847){return function(_0x104c79){if(_0x104c79){return _0x104c79[_0xa3d4('0x25')]()[_0xa3d4('0x26')](function(){_0x74d534['status'](0xcc)[_0xa3d4('0x1a')]();});}};}function handleEntityNotFound(_0x9205dc,_0x1285c1){return function(_0x3dc319){if(!_0x3dc319){_0x9205dc[_0xa3d4('0x18')](0x194);}return _0x3dc319;};}function handleError(_0x204fd6,_0x2a5ac5){_0x2a5ac5=_0x2a5ac5||0x1f4;return function(_0x296bc1){logger[_0xa3d4('0x27')](_0x296bc1[_0xa3d4('0x28')]);if(_0x296bc1[_0xa3d4('0x29')]){delete _0x296bc1['name'];}_0x204fd6[_0xa3d4('0x19')](_0x2a5ac5)[_0xa3d4('0x2a')](_0x296bc1);};}exports[_0xa3d4('0x2b')]=function(_0x1891fa,_0x86386){var _0x248561={},_0x4a4176={},_0x401553={'count':0x0,'rows':[]};var _0x3a2da5=_['map'](db[_0xa3d4('0x2c')]['rawAttributes'],function(_0xc057c8){return{'name':_0xc057c8[_0xa3d4('0x2d')],'type':_0xc057c8[_0xa3d4('0x2e')][_0xa3d4('0x2f')]};});_0x4a4176[_0xa3d4('0x30')]=_[_0xa3d4('0x31')](_0x3a2da5,_0xa3d4('0x29'));_0x4a4176['query']=_['keys'](_0x1891fa[_0xa3d4('0x32')]);_0x4a4176[_0xa3d4('0x33')]=_[_0xa3d4('0x34')](_0x4a4176[_0xa3d4('0x30')],_0x4a4176['query']);_0x248561[_0xa3d4('0x35')]=_['intersection'](_0x4a4176[_0xa3d4('0x30')],qs[_0xa3d4('0x36')](_0x1891fa[_0xa3d4('0x32')]['fields']));_0x248561[_0xa3d4('0x35')]=_0x248561[_0xa3d4('0x35')][_0xa3d4('0x37')]?_0x248561[_0xa3d4('0x35')]:_0x4a4176[_0xa3d4('0x30')];if(!_0x1891fa['query'][_0xa3d4('0x38')]('nolimit')){_0x248561[_0xa3d4('0x1e')]=qs[_0xa3d4('0x1e')](_0x1891fa[_0xa3d4('0x32')]['limit']);_0x248561['offset']=qs[_0xa3d4('0x1d')](_0x1891fa[_0xa3d4('0x32')][_0xa3d4('0x1d')]);}_0x248561[_0xa3d4('0x39')]=qs[_0xa3d4('0x3a')](_0x1891fa[_0xa3d4('0x32')]['sort']);_0x248561['where']=qs[_0xa3d4('0x33')](_[_0xa3d4('0x3b')](_0x1891fa[_0xa3d4('0x32')],_0x4a4176[_0xa3d4('0x33')]));if(_0x1891fa[_0xa3d4('0x32')][_0xa3d4('0x3c')]){_0x248561['where']=_[_0xa3d4('0x3d')](_0x248561[_0xa3d4('0x3e')],{'$or':_[_0xa3d4('0x31')](_0x3a2da5,function(_0x18f69b){if(_0x18f69b[_0xa3d4('0x2e')]!=='VIRTUAL'){var _0x2d80dc={};_0x2d80dc[_0x18f69b[_0xa3d4('0x29')]]={'$like':'%'+_0x1891fa['query']['filter']+'%'};return _0x2d80dc;}})});}_0x248561=_[_0xa3d4('0x3d')]({},_0x248561,_0x1891fa['options']);var _0x8fcd1c={'where':_0x248561[_0xa3d4('0x3e')]};return db[_0xa3d4('0x2c')]['count'](_0x8fcd1c)['then'](function(_0x1ff106){_0x401553['count']=_0x1ff106;if(_0x1891fa[_0xa3d4('0x32')][_0xa3d4('0x3f')]){_0x248561[_0xa3d4('0x40')]=[{'all':!![]}];}return db[_0xa3d4('0x2c')][_0xa3d4('0x41')](_0x248561);})[_0xa3d4('0x26')](function(_0x46c91b){_0x401553['rows']=_0x46c91b;return _0x401553;})[_0xa3d4('0x26')](respondWithFilteredResult(_0x86386,_0x248561))[_0xa3d4('0x42')](handleError(_0x86386,null));};exports[_0xa3d4('0x43')]=function(_0x556b0c,_0x538ab6){var _0x257f83={'raw':!![],'where':{'id':_0x556b0c[_0xa3d4('0x44')]['id']}},_0x39acb5={};_0x39acb5['model']=_[_0xa3d4('0x45')](db[_0xa3d4('0x2c')][_0xa3d4('0x46')]);_0x39acb5[_0xa3d4('0x32')]=_[_0xa3d4('0x45')](_0x556b0c[_0xa3d4('0x32')]);_0x39acb5['filters']=_[_0xa3d4('0x34')](_0x39acb5['model'],_0x39acb5[_0xa3d4('0x32')]);_0x257f83[_0xa3d4('0x35')]=_[_0xa3d4('0x34')](_0x39acb5[_0xa3d4('0x30')],qs[_0xa3d4('0x36')](_0x556b0c[_0xa3d4('0x32')][_0xa3d4('0x36')]));_0x257f83['attributes']=_0x257f83[_0xa3d4('0x35')]['length']?_0x257f83[_0xa3d4('0x35')]:_0x39acb5[_0xa3d4('0x30')];if(_0x556b0c[_0xa3d4('0x32')][_0xa3d4('0x3f')]){_0x257f83[_0xa3d4('0x40')]=[{'all':!![]}];}_0x257f83=_['merge']({},_0x257f83,_0x556b0c[_0xa3d4('0x47')]);return db['OpenchannelTransferReport']['find'](_0x257f83)[_0xa3d4('0x26')](handleEntityNotFound(_0x538ab6,null))[_0xa3d4('0x26')](respondWithResult(_0x538ab6,null))[_0xa3d4('0x42')](handleError(_0x538ab6,null));};exports[_0xa3d4('0x48')]=function(_0x4cb56e,_0x361c7a){return db[_0xa3d4('0x2c')]['create'](_0x4cb56e['body'],{})[_0xa3d4('0x26')](respondWithResult(_0x361c7a,0xc9))['catch'](handleError(_0x361c7a,null));};exports[_0xa3d4('0x24')]=function(_0x17e2b4,_0x21f672){if(_0x17e2b4[_0xa3d4('0x49')]['id']){delete _0x17e2b4['body']['id'];}return db['OpenchannelTransferReport'][_0xa3d4('0x4a')]({'where':{'id':_0x17e2b4['params']['id']}})[_0xa3d4('0x26')](handleEntityNotFound(_0x21f672,null))[_0xa3d4('0x26')](saveUpdates(_0x17e2b4[_0xa3d4('0x49')],null))[_0xa3d4('0x26')](respondWithResult(_0x21f672,null))[_0xa3d4('0x42')](handleError(_0x21f672,null));};exports['destroy']=function(_0x450d6f,_0x40a9c2){return db['OpenchannelTransferReport'][_0xa3d4('0x4a')]({'where':{'id':_0x450d6f[_0xa3d4('0x44')]['id']}})[_0xa3d4('0x26')](handleEntityNotFound(_0x40a9c2,null))[_0xa3d4('0x26')](removeEntity(_0x40a9c2,null))[_0xa3d4('0x42')](handleError(_0x40a9c2,null));};exports[_0xa3d4('0x4b')]=function(_0x479c00,_0x217e85){return db['OpenchannelTransferReport']['describe']()[_0xa3d4('0x26')](respondWithResult(_0x217e85,null))[_0xa3d4('0x42')](handleError(_0x217e85,null));}; \ No newline at end of file +var _0x825b=['json','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','OpenchannelTransferReport','rawAttributes','fieldName','key','model','query','keys','filters','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','findAll','catch','show','intersection','length','includeAll','include','create','body','find','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../mysqldb','status','end','count','offset','limit','set'];(function(_0x592e04,_0x253712){var _0x1de137=function(_0x1aee0c){while(--_0x1aee0c){_0x592e04['push'](_0x592e04['shift']());}};_0x1de137(++_0x253712);}(_0x825b,0xc1));var _0xb825=function(_0x2070da,_0x45e586){_0x2070da=_0x2070da-0x0;var _0x4f9fe1=_0x825b[_0x2070da];return _0x4f9fe1;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xb825('0x0'));var rimraf=require(_0xb825('0x1'));var zipdir=require(_0xb825('0x2'));var jsonpatch=require(_0xb825('0x3'));var rp=require(_0xb825('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xb825('0x5'));var util=require(_0xb825('0x6'));var path=require(_0xb825('0x7'));var sox=require(_0xb825('0x8'));var csv=require(_0xb825('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xb825('0xa'));var squel=require(_0xb825('0xb'));var crypto=require(_0xb825('0xc'));var jsforce=require(_0xb825('0xd'));var deskjs=require(_0xb825('0xe'));var toCsv=require(_0xb825('0x9'));var querystring=require(_0xb825('0xf'));var Papa=require(_0xb825('0x10'));var Redis=require(_0xb825('0x11'));var authService=require(_0xb825('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xb825('0x13'));var hardwareService=require(_0xb825('0x14'));var logger=require(_0xb825('0x15'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xb825('0x16'))['db'];function respondWithStatusCode(_0x90aac8,_0x1af739){_0x1af739=_0x1af739||0xcc;return function(_0x1bcd9b){if(_0x1bcd9b){return _0x90aac8['sendStatus'](_0x1af739);}return _0x90aac8[_0xb825('0x17')](_0x1af739)[_0xb825('0x18')]();};}function respondWithResult(_0x559d32,_0xd2cf27){_0xd2cf27=_0xd2cf27||0xc8;return function(_0x3c7ab7){if(_0x3c7ab7){return _0x559d32[_0xb825('0x17')](_0xd2cf27)['json'](_0x3c7ab7);}};}function respondWithFilteredResult(_0x57450b,_0x265d53){return function(_0x265eb9){if(_0x265eb9){var _0x23625f=_0x265eb9[_0xb825('0x19')],_0xf0e1e8=_0x265d53['offset'],_0x31e7c1=_0x265d53[_0xb825('0x1a')]+_0x265d53[_0xb825('0x1b')],_0x3b6da7;if(_0x31e7c1>=_0x23625f){_0x31e7c1=_0x23625f;_0x3b6da7=0xc8;}else{_0x3b6da7=0xce;}_0x57450b[_0xb825('0x17')](_0x3b6da7);return _0x57450b[_0xb825('0x1c')]('Content-Range',_0xf0e1e8+'-'+_0x31e7c1+'/'+_0x23625f)[_0xb825('0x1d')](_0x265eb9);}return null;};}function patchUpdates(_0x25b88b){return function(_0x4d03a5){try{jsonpatch[_0xb825('0x1e')](_0x4d03a5,_0x25b88b,!![]);}catch(_0x45d2bb){return BPromise[_0xb825('0x1f')](_0x45d2bb);}return _0x4d03a5[_0xb825('0x20')]();};}function saveUpdates(_0x2481fd,_0x4c9384){return function(_0x150327){if(_0x150327){return _0x150327[_0xb825('0x21')](_0x2481fd)[_0xb825('0x22')](function(_0x2cfae8){return _0x2cfae8;});}return null;};}function removeEntity(_0x218355,_0x5b1ab){return function(_0x563a09){if(_0x563a09){return _0x563a09[_0xb825('0x23')]()['then'](function(){_0x218355[_0xb825('0x17')](0xcc)[_0xb825('0x18')]();});}};}function handleEntityNotFound(_0x5b4efb,_0x20d8ba){return function(_0x3db1c7){if(!_0x3db1c7){_0x5b4efb[_0xb825('0x24')](0x194);}return _0x3db1c7;};}function handleError(_0xea4023,_0x40cb2c){_0x40cb2c=_0x40cb2c||0x1f4;return function(_0xba5e58){logger[_0xb825('0x25')](_0xba5e58[_0xb825('0x26')]);if(_0xba5e58[_0xb825('0x27')]){delete _0xba5e58[_0xb825('0x27')];}_0xea4023[_0xb825('0x17')](_0x40cb2c)[_0xb825('0x28')](_0xba5e58);};}exports[_0xb825('0x29')]=function(_0x56f83d,_0x40d23a){var _0x2bd5ff={},_0x47bf93={},_0x241bf5={'count':0x0,'rows':[]};var _0x367193=_[_0xb825('0x2a')](db[_0xb825('0x2b')][_0xb825('0x2c')],function(_0x4121bc){return{'name':_0x4121bc[_0xb825('0x2d')],'type':_0x4121bc['type'][_0xb825('0x2e')]};});_0x47bf93[_0xb825('0x2f')]=_[_0xb825('0x2a')](_0x367193,_0xb825('0x27'));_0x47bf93[_0xb825('0x30')]=_[_0xb825('0x31')](_0x56f83d[_0xb825('0x30')]);_0x47bf93[_0xb825('0x32')]=_['intersection'](_0x47bf93[_0xb825('0x2f')],_0x47bf93['query']);_0x2bd5ff[_0xb825('0x33')]=_['intersection'](_0x47bf93[_0xb825('0x2f')],qs[_0xb825('0x34')](_0x56f83d[_0xb825('0x30')][_0xb825('0x34')]));_0x2bd5ff[_0xb825('0x33')]=_0x2bd5ff[_0xb825('0x33')]['length']?_0x2bd5ff[_0xb825('0x33')]:_0x47bf93[_0xb825('0x2f')];if(!_0x56f83d[_0xb825('0x30')][_0xb825('0x35')]('nolimit')){_0x2bd5ff[_0xb825('0x1b')]=qs[_0xb825('0x1b')](_0x56f83d['query'][_0xb825('0x1b')]);_0x2bd5ff[_0xb825('0x1a')]=qs[_0xb825('0x1a')](_0x56f83d[_0xb825('0x30')][_0xb825('0x1a')]);}_0x2bd5ff[_0xb825('0x36')]=qs[_0xb825('0x37')](_0x56f83d[_0xb825('0x30')][_0xb825('0x37')]);_0x2bd5ff[_0xb825('0x38')]=qs[_0xb825('0x32')](_[_0xb825('0x39')](_0x56f83d[_0xb825('0x30')],_0x47bf93[_0xb825('0x32')]));if(_0x56f83d[_0xb825('0x30')][_0xb825('0x3a')]){_0x2bd5ff[_0xb825('0x38')]=_[_0xb825('0x3b')](_0x2bd5ff['where'],{'$or':_[_0xb825('0x2a')](_0x367193,function(_0x285edc){if(_0x285edc[_0xb825('0x3c')]!==_0xb825('0x3d')){var _0x4dcfab={};_0x4dcfab[_0x285edc['name']]={'$like':'%'+_0x56f83d[_0xb825('0x30')][_0xb825('0x3a')]+'%'};return _0x4dcfab;}})});}_0x2bd5ff=_[_0xb825('0x3b')]({},_0x2bd5ff,_0x56f83d['options']);var _0x4c5f0c={'where':_0x2bd5ff[_0xb825('0x38')]};return db[_0xb825('0x2b')][_0xb825('0x19')](_0x4c5f0c)[_0xb825('0x22')](function(_0x57a9ea){_0x241bf5['count']=_0x57a9ea;if(_0x56f83d[_0xb825('0x30')]['includeAll']){_0x2bd5ff['include']=[{'all':!![]}];}return db[_0xb825('0x2b')][_0xb825('0x3e')](_0x2bd5ff);})[_0xb825('0x22')](function(_0x38bf83){_0x241bf5['rows']=_0x38bf83;return _0x241bf5;})[_0xb825('0x22')](respondWithFilteredResult(_0x40d23a,_0x2bd5ff))[_0xb825('0x3f')](handleError(_0x40d23a,null));};exports[_0xb825('0x40')]=function(_0x2453da,_0x1e6582){var _0x204a8c={'raw':!![],'where':{'id':_0x2453da['params']['id']}},_0x486bbb={};_0x486bbb[_0xb825('0x2f')]=_['keys'](db['OpenchannelTransferReport'][_0xb825('0x2c')]);_0x486bbb[_0xb825('0x30')]=_[_0xb825('0x31')](_0x2453da[_0xb825('0x30')]);_0x486bbb[_0xb825('0x32')]=_[_0xb825('0x41')](_0x486bbb[_0xb825('0x2f')],_0x486bbb['query']);_0x204a8c[_0xb825('0x33')]=_['intersection'](_0x486bbb[_0xb825('0x2f')],qs[_0xb825('0x34')](_0x2453da[_0xb825('0x30')][_0xb825('0x34')]));_0x204a8c[_0xb825('0x33')]=_0x204a8c[_0xb825('0x33')][_0xb825('0x42')]?_0x204a8c[_0xb825('0x33')]:_0x486bbb[_0xb825('0x2f')];if(_0x2453da[_0xb825('0x30')][_0xb825('0x43')]){_0x204a8c[_0xb825('0x44')]=[{'all':!![]}];}_0x204a8c=_[_0xb825('0x3b')]({},_0x204a8c,_0x2453da['options']);return db[_0xb825('0x2b')]['find'](_0x204a8c)['then'](handleEntityNotFound(_0x1e6582,null))[_0xb825('0x22')](respondWithResult(_0x1e6582,null))[_0xb825('0x3f')](handleError(_0x1e6582,null));};exports[_0xb825('0x45')]=function(_0x5be045,_0x53f6ec){return db[_0xb825('0x2b')][_0xb825('0x45')](_0x5be045['body'],{})[_0xb825('0x22')](respondWithResult(_0x53f6ec,0xc9))[_0xb825('0x3f')](handleError(_0x53f6ec,null));};exports[_0xb825('0x21')]=function(_0x3d7612,_0x53c3d3){if(_0x3d7612[_0xb825('0x46')]['id']){delete _0x3d7612[_0xb825('0x46')]['id'];}return db[_0xb825('0x2b')][_0xb825('0x47')]({'where':{'id':_0x3d7612[_0xb825('0x48')]['id']}})[_0xb825('0x22')](handleEntityNotFound(_0x53c3d3,null))['then'](saveUpdates(_0x3d7612['body'],null))[_0xb825('0x22')](respondWithResult(_0x53c3d3,null))['catch'](handleError(_0x53c3d3,null));};exports[_0xb825('0x23')]=function(_0x121fac,_0x99f036){return db[_0xb825('0x2b')][_0xb825('0x47')]({'where':{'id':_0x121fac[_0xb825('0x48')]['id']}})[_0xb825('0x22')](handleEntityNotFound(_0x99f036,null))['then'](removeEntity(_0x99f036,null))['catch'](handleError(_0x99f036,null));};exports[_0xb825('0x49')]=function(_0x3609ef,_0x498a8f){return db['OpenchannelTransferReport'][_0xb825('0x49')]()[_0xb825('0x22')](respondWithResult(_0x498a8f,null))[_0xb825('0x3f')](handleError(_0x498a8f,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index ad95ea2..8528fa6 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 _0x898e=['bluebird','request-promise','path','rimraf','../../config/environment','./openchannelTransferReport.attributes','exports','define','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','api','moment'];(function(_0x47b15f,_0x103e93){var _0x55bf25=function(_0x51fe7f){while(--_0x51fe7f){_0x47b15f['push'](_0x47b15f['shift']());}};_0x55bf25(++_0x103e93);}(_0x898e,0x8d));var _0xe898=function(_0x4bed77,_0x34df35){_0x4bed77=_0x4bed77-0x0;var _0x45835d=_0x898e[_0x4bed77];return _0x45835d;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xe898('0x0'));var moment=require(_0xe898('0x1'));var BPromise=require(_0xe898('0x2'));var rp=require(_0xe898('0x3'));var fs=require('fs');var path=require(_0xe898('0x4'));var rimraf=require(_0xe898('0x5'));var config=require(_0xe898('0x6'));var attributes=require(_0xe898('0x7'));module[_0xe898('0x8')]=function(_0xc7a2b,_0x4d4102){return _0xc7a2b[_0xe898('0x9')](_0xe898('0xa'),attributes,{'tableName':_0xe898('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xe898('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb249=['rimraf','../../config/environment','./openchannelTransferReport.attributes','exports','define','OpenchannelTransferReport','uniqueid','util','../../config/logger','api','moment','path'];(function(_0x125ff8,_0x41925f){var _0x2d9ef=function(_0x4ef34c){while(--_0x4ef34c){_0x125ff8['push'](_0x125ff8['shift']());}};_0x2d9ef(++_0x41925f);}(_0xb249,0xbb));var _0x9b24=function(_0x5a4771,_0x307c12){_0x5a4771=_0x5a4771-0x0;var _0x35294e=_0xb249[_0x5a4771];return _0x35294e;};'use strict';var _=require('lodash');var util=require(_0x9b24('0x0'));var logger=require(_0x9b24('0x1'))(_0x9b24('0x2'));var moment=require(_0x9b24('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x9b24('0x4'));var rimraf=require(_0x9b24('0x5'));var config=require(_0x9b24('0x6'));var attributes=require(_0x9b24('0x7'));module[_0x9b24('0x8')]=function(_0x44fa77,_0x2aff01){return _0x44fa77[_0x9b24('0x9')](_0x9b24('0xa'),attributes,{'tableName':'report_openchannel_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x9b24('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index 6d9a529..053541f 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 _0x2e23=['jayson/promise','client','request','then','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x222f3a,_0x3d4f8b){var _0x2012f1=function(_0x411d29){while(--_0x411d29){_0x222f3a['push'](_0x222f3a['shift']());}};_0x2012f1(++_0x3d4f8b);}(_0x2e23,0xb5));var _0x32e2=function(_0x4e9628,_0x250573){_0x4e9628=_0x4e9628-0x0;var _0x27bc8c=_0x2e23[_0x4e9628];return _0x27bc8c;};'use strict';var _=require(_0x32e2('0x0'));var util=require(_0x32e2('0x1'));var moment=require(_0x32e2('0x2'));var BPromise=require(_0x32e2('0x3'));var rs=require(_0x32e2('0x4'));var fs=require('fs');var Redis=require(_0x32e2('0x5'));var db=require(_0x32e2('0x6'))['db'];var utils=require(_0x32e2('0x7'));var logger=require(_0x32e2('0x8'))(_0x32e2('0x9'));var config=require(_0x32e2('0xa'));var jayson=require(_0x32e2('0xb'));var client=jayson[_0x32e2('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x491709,_0x571acf,_0xfe35a3){return new BPromise(function(_0xb2cde6,_0x48322f){return client[_0x32e2('0xd')](_0x491709,_0xfe35a3)[_0x32e2('0xe')](function(_0x3df391){logger[_0x32e2('0xf')](_0x32e2('0x10'),_0x571acf,_0x32e2('0x11'));logger['debug'](_0x32e2('0x12'),_0x571acf,_0x32e2('0x11'),JSON[_0x32e2('0x13')](_0x3df391));if(_0x3df391[_0x32e2('0x14')]){if(_0x3df391[_0x32e2('0x14')]['code']===0x1f4){logger[_0x32e2('0x14')](_0x32e2('0x10'),_0x571acf,_0x3df391[_0x32e2('0x14')][_0x32e2('0x15')]);return _0x48322f(_0x3df391['error'][_0x32e2('0x15')]);}logger[_0x32e2('0x14')](_0x32e2('0x10'),_0x571acf,_0x3df391['error'][_0x32e2('0x15')]);return _0xb2cde6(_0x3df391['error'][_0x32e2('0x15')]);}else{logger['info'](_0x32e2('0x10'),_0x571acf,'request\x20sent');_0xb2cde6(_0x3df391[_0x32e2('0x16')][_0x32e2('0x15')]);}})[_0x32e2('0x17')](function(_0x4fdc82){logger[_0x32e2('0x14')](_0x32e2('0x10'),_0x571acf,_0x4fdc82);_0x48322f(_0x4fdc82);});});} \ No newline at end of file +var _0x398a=['stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','then','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s'];(function(_0x2cff1a,_0x225eae){var _0x6d3bbc=function(_0x139623){while(--_0x139623){_0x2cff1a['push'](_0x2cff1a['shift']());}};_0x6d3bbc(++_0x225eae);}(_0x398a,0x11a));var _0xa398=function(_0x402669,_0x45795d){_0x402669=_0x402669-0x0;var _0x22d239=_0x398a[_0x402669];return _0x22d239;};'use strict';var _=require(_0xa398('0x0'));var util=require(_0xa398('0x1'));var moment=require(_0xa398('0x2'));var BPromise=require(_0xa398('0x3'));var rs=require(_0xa398('0x4'));var fs=require('fs');var Redis=require(_0xa398('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xa398('0x6'));var config=require(_0xa398('0x7'));var jayson=require(_0xa398('0x8'));var client=jayson[_0xa398('0x9')][_0xa398('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2ac561,_0x1fa6cb,_0x24e456){return new BPromise(function(_0x468a9d,_0x2e26f0){return client['request'](_0x2ac561,_0x24e456)[_0xa398('0xb')](function(_0x3c7f25){logger[_0xa398('0xc')](_0xa398('0xd'),_0x1fa6cb,_0xa398('0xe'));logger[_0xa398('0xf')](_0xa398('0x10'),_0x1fa6cb,'request\x20sent',JSON[_0xa398('0x11')](_0x3c7f25));if(_0x3c7f25[_0xa398('0x12')]){if(_0x3c7f25[_0xa398('0x12')][_0xa398('0x13')]===0x1f4){logger[_0xa398('0x12')](_0xa398('0xd'),_0x1fa6cb,_0x3c7f25[_0xa398('0x12')][_0xa398('0x14')]);return _0x2e26f0(_0x3c7f25['error'][_0xa398('0x14')]);}logger[_0xa398('0x12')](_0xa398('0xd'),_0x1fa6cb,_0x3c7f25[_0xa398('0x12')][_0xa398('0x14')]);return _0x468a9d(_0x3c7f25[_0xa398('0x12')][_0xa398('0x14')]);}else{logger[_0xa398('0xc')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x1fa6cb,_0xa398('0xe'));_0x468a9d(_0x3c7f25[_0xa398('0x15')]['message']);}})[_0xa398('0x16')](function(_0x42a001){logger[_0xa398('0x12')](_0xa398('0xd'),_0x1fa6cb,_0x42a001);_0x2e26f0(_0x42a001);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index 13a4d0c..455e3b7 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 _0x528f=['get','isAuthenticated','index','show','post','create','put','update','delete','/:id','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./pause.controller'];(function(_0x5ee582,_0x5c1898){var _0x176a90=function(_0x302057){while(--_0x302057){_0x5ee582['push'](_0x5ee582['shift']());}};_0x176a90(++_0x5c1898);}(_0x528f,0x131));var _0xf528=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x528f[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xf528('0x0'));var util=require(_0xf528('0x1'));var path=require(_0xf528('0x2'));var timeout=require(_0xf528('0x3'));var express=require(_0xf528('0x4'));var router=express[_0xf528('0x5')]();var auth=require(_0xf528('0x6'));var interaction=require(_0xf528('0x7'));var config=require(_0xf528('0x8'));var controller=require(_0xf528('0x9'));router[_0xf528('0xa')]('/',auth[_0xf528('0xb')](),controller[_0xf528('0xc')]);router[_0xf528('0xa')]('/:id',auth[_0xf528('0xb')](),controller[_0xf528('0xd')]);router[_0xf528('0xe')]('/',auth[_0xf528('0xb')](),controller[_0xf528('0xf')]);router[_0xf528('0x10')]('/:id',auth[_0xf528('0xb')](),controller[_0xf528('0x11')]);router[_0xf528('0x12')](_0xf528('0x13'),auth[_0xf528('0xb')](),controller[_0xf528('0x14')]);module['exports']=router; \ No newline at end of file +var _0xf079=['create','put','/:id','update','delete','destroy','multer','util','path','express','../../components/auth/service','./pause.controller','get','isAuthenticated','index','post'];(function(_0x476b00,_0x250877){var _0x44ec8e=function(_0xec6b23){while(--_0xec6b23){_0x476b00['push'](_0x476b00['shift']());}};_0x44ec8e(++_0x250877);}(_0xf079,0xb6));var _0x9f07=function(_0x1798da,_0x1f9180){_0x1798da=_0x1798da-0x0;var _0x2b0ba8=_0xf079[_0x1798da];return _0x2b0ba8;};'use strict';var multer=require(_0x9f07('0x0'));var util=require(_0x9f07('0x1'));var path=require(_0x9f07('0x2'));var timeout=require('connect-timeout');var express=require(_0x9f07('0x3'));var router=express['Router']();var auth=require(_0x9f07('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x9f07('0x5'));router[_0x9f07('0x6')]('/',auth[_0x9f07('0x7')](),controller[_0x9f07('0x8')]);router[_0x9f07('0x6')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x9f07('0x9')]('/',auth[_0x9f07('0x7')](),controller[_0x9f07('0xa')]);router[_0x9f07('0xb')](_0x9f07('0xc'),auth[_0x9f07('0x7')](),controller[_0x9f07('0xd')]);router[_0x9f07('0xe')]('/:id',auth[_0x9f07('0x7')](),controller[_0x9f07('0xf')]);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 253f52e..729c949 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 _0x31a2=['STRING','name','sequelize'];(function(_0x2e4582,_0x2b2c22){var _0x7ed577=function(_0x4256de){while(--_0x4256de){_0x2e4582['push'](_0x2e4582['shift']());}};_0x7ed577(++_0x2b2c22);}(_0x31a2,0x10d));var _0x231a=function(_0x33b07c,_0x429a14){_0x33b07c=_0x33b07c-0x0;var _0x175ee0=_0x31a2[_0x33b07c];return _0x175ee0;};'use strict';var Sequelize=require(_0x231a('0x0'));module['exports']={'name':{'type':Sequelize[_0x231a('0x1')],'unique':_0x231a('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x231a('0x1')]}}; \ No newline at end of file +var _0x445a=['name','STRING','sequelize'];(function(_0x45ae0f,_0x410a77){var _0x2ab33b=function(_0x299a62){while(--_0x299a62){_0x45ae0f['push'](_0x45ae0f['shift']());}};_0x2ab33b(++_0x410a77);}(_0x445a,0x12e));var _0xa445=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x445a[_0x432682];return _0x463d05;};'use strict';var Sequelize=require(_0xa445('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xa445('0x1'),'allowNull':![]},'description':{'type':Sequelize[_0xa445('0x2')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index d5a8a77..0c10601 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 _0x03fe=['querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../mysqldb','status','count','offset','limit','set','Content-Range','json','save','then','get','Pauses','UserProfileResource','end','sendStatus','error','stack','name','index','map','rawAttributes','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','Pause','includeAll','include','rows','catch','show','params','keys','options','create','body','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','find','destroy','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','util','sox','ejs','lodash','squel','crypto','desk.js','to-csv'];(function(_0x1a0600,_0x41feef){var _0x734670=function(_0x2da4e4){while(--_0x2da4e4){_0x1a0600['push'](_0x1a0600['shift']());}};_0x734670(++_0x41feef);}(_0x03fe,0x17d));var _0xe03f=function(_0x1c2802,_0xc1d15d){_0x1c2802=_0x1c2802-0x0;var _0x29f295=_0x03fe[_0x1c2802];return _0x29f295;};'use strict';var pdf=require(_0xe03f('0x0'));var emlformat=require(_0xe03f('0x1'));var rimraf=require(_0xe03f('0x2'));var zipdir=require(_0xe03f('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xe03f('0x4'));var BPromise=require(_0xe03f('0x5'));var Mustache=require('mustache');var util=require(_0xe03f('0x6'));var path=require('path');var sox=require(_0xe03f('0x7'));var csv=require('to-csv');var ejs=require(_0xe03f('0x8'));var fs=require('fs');var _=require(_0xe03f('0x9'));var squel=require(_0xe03f('0xa'));var crypto=require(_0xe03f('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xe03f('0xc'));var toCsv=require(_0xe03f('0xd'));var querystring=require(_0xe03f('0xe'));var Papa=require(_0xe03f('0xf'));var Redis=require('ioredis');var authService=require(_0xe03f('0x10'));var qs=require(_0xe03f('0x11'));var as=require(_0xe03f('0x12'));var hardwareService=require(_0xe03f('0x13'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xe03f('0x14'));var db=require(_0xe03f('0x15'))['db'];function respondWithStatusCode(_0x3d0bdf,_0x30b476){_0x30b476=_0x30b476||0xcc;return function(_0x1c444d){if(_0x1c444d){return _0x3d0bdf['sendStatus'](_0x30b476);}return _0x3d0bdf[_0xe03f('0x16')](_0x30b476)['end']();};}function respondWithResult(_0x234f6c,_0x213193){_0x213193=_0x213193||0xc8;return function(_0x5e3eb4){if(_0x5e3eb4){return _0x234f6c['status'](_0x213193)['json'](_0x5e3eb4);}};}function respondWithFilteredResult(_0x36bf06,_0x26e83b){return function(_0x183623){if(_0x183623){var _0x5e91cf=_0x183623[_0xe03f('0x17')],_0x32a0f9=_0x26e83b[_0xe03f('0x18')],_0x857c58=_0x26e83b['offset']+_0x26e83b[_0xe03f('0x19')],_0x4067f0;if(_0x857c58>=_0x5e91cf){_0x857c58=_0x5e91cf;_0x4067f0=0xc8;}else{_0x4067f0=0xce;}_0x36bf06[_0xe03f('0x16')](_0x4067f0);return _0x36bf06[_0xe03f('0x1a')](_0xe03f('0x1b'),_0x32a0f9+'-'+_0x857c58+'/'+_0x5e91cf)[_0xe03f('0x1c')](_0x183623);}return null;};}function patchUpdates(_0xbe7e78){return function(_0x223aeb){try{jsonpatch['apply'](_0x223aeb,_0xbe7e78,!![]);}catch(_0x87ecc1){return BPromise['reject'](_0x87ecc1);}return _0x223aeb[_0xe03f('0x1d')]();};}function saveUpdates(_0x3a4bc1,_0x1f8cde){return function(_0x3df109){if(_0x3df109){return _0x3df109['update'](_0x3a4bc1)[_0xe03f('0x1e')](function(_0x1c191a){return _0x1c191a;});}return null;};}function removeEntity(_0x32b343,_0x156e82){return function(_0x4162b3){if(_0x4162b3){return _0x4162b3['destroy']()[_0xe03f('0x1e')](function(){var _0x5b4c4f=_0x4162b3[_0xe03f('0x1f')]({'plain':!![]});var _0x104617=_0xe03f('0x20');return db[_0xe03f('0x21')]['destroy']({'where':{'type':_0x104617,'resourceId':_0x5b4c4f['id']}})[_0xe03f('0x1e')](function(){return _0x4162b3;});})[_0xe03f('0x1e')](function(){_0x32b343['status'](0xcc)[_0xe03f('0x22')]();});}};}function handleEntityNotFound(_0x116c3d,_0x51cc98){return function(_0x1e154f){if(!_0x1e154f){_0x116c3d[_0xe03f('0x23')](0x194);}return _0x1e154f;};}function handleError(_0xdfa55b,_0x4fc526){_0x4fc526=_0x4fc526||0x1f4;return function(_0x1a9fa1){logger[_0xe03f('0x24')](_0x1a9fa1[_0xe03f('0x25')]);if(_0x1a9fa1['name']){delete _0x1a9fa1[_0xe03f('0x26')];}_0xdfa55b[_0xe03f('0x16')](_0x4fc526)['send'](_0x1a9fa1);};}exports[_0xe03f('0x27')]=function(_0x17c1a8,_0x5ca943){var _0x3a6b7b={},_0x55811f={},_0x65e56b={'count':0x0,'rows':[]};var _0x36b08d=_[_0xe03f('0x28')](db['Pause'][_0xe03f('0x29')],function(_0x2208e4){return{'name':_0x2208e4['fieldName'],'type':_0x2208e4[_0xe03f('0x2a')][_0xe03f('0x2b')]};});_0x55811f[_0xe03f('0x2c')]=_[_0xe03f('0x28')](_0x36b08d,_0xe03f('0x26'));_0x55811f[_0xe03f('0x2d')]=_['keys'](_0x17c1a8['query']);_0x55811f[_0xe03f('0x2e')]=_['intersection'](_0x55811f['model'],_0x55811f[_0xe03f('0x2d')]);_0x3a6b7b[_0xe03f('0x2f')]=_[_0xe03f('0x30')](_0x55811f[_0xe03f('0x2c')],qs[_0xe03f('0x31')](_0x17c1a8['query'][_0xe03f('0x31')]));_0x3a6b7b['attributes']=_0x3a6b7b[_0xe03f('0x2f')][_0xe03f('0x32')]?_0x3a6b7b[_0xe03f('0x2f')]:_0x55811f['model'];if(!_0x17c1a8[_0xe03f('0x2d')][_0xe03f('0x33')](_0xe03f('0x34'))){_0x3a6b7b[_0xe03f('0x19')]=qs[_0xe03f('0x19')](_0x17c1a8[_0xe03f('0x2d')][_0xe03f('0x19')]);_0x3a6b7b['offset']=qs['offset'](_0x17c1a8[_0xe03f('0x2d')]['offset']);}_0x3a6b7b[_0xe03f('0x35')]=qs[_0xe03f('0x36')](_0x17c1a8[_0xe03f('0x2d')][_0xe03f('0x36')]);_0x3a6b7b[_0xe03f('0x37')]=qs['filters'](_[_0xe03f('0x38')](_0x17c1a8[_0xe03f('0x2d')],_0x55811f['filters']));if(_0x17c1a8['query'][_0xe03f('0x39')]){_0x3a6b7b[_0xe03f('0x37')]=_[_0xe03f('0x3a')](_0x3a6b7b['where'],{'$or':_['map'](_0x36b08d,function(_0x2ae672){if(_0x2ae672[_0xe03f('0x2a')]!==_0xe03f('0x3b')){var _0x45aa6b={};_0x45aa6b[_0x2ae672[_0xe03f('0x26')]]={'$like':'%'+_0x17c1a8[_0xe03f('0x2d')][_0xe03f('0x39')]+'%'};return _0x45aa6b;}})});}_0x3a6b7b=_['merge']({},_0x3a6b7b,_0x17c1a8['options']);var _0x3c1346={'where':_0x3a6b7b[_0xe03f('0x37')]};return db[_0xe03f('0x3c')][_0xe03f('0x17')](_0x3c1346)[_0xe03f('0x1e')](function(_0x34e3bd){_0x65e56b[_0xe03f('0x17')]=_0x34e3bd;if(_0x17c1a8[_0xe03f('0x2d')][_0xe03f('0x3d')]){_0x3a6b7b[_0xe03f('0x3e')]=[{'all':!![]}];}return db[_0xe03f('0x3c')]['findAll'](_0x3a6b7b);})[_0xe03f('0x1e')](function(_0x3fe2c5){_0x65e56b[_0xe03f('0x3f')]=_0x3fe2c5;return _0x65e56b;})['then'](respondWithFilteredResult(_0x5ca943,_0x3a6b7b))[_0xe03f('0x40')](handleError(_0x5ca943,null));};exports[_0xe03f('0x41')]=function(_0x407784,_0x4a3bf0){var _0xb95c76={'raw':!![],'where':{'id':_0x407784[_0xe03f('0x42')]['id']}},_0x40bb48={};_0x40bb48[_0xe03f('0x2c')]=_[_0xe03f('0x43')](db[_0xe03f('0x3c')][_0xe03f('0x29')]);_0x40bb48[_0xe03f('0x2d')]=_[_0xe03f('0x43')](_0x407784[_0xe03f('0x2d')]);_0x40bb48[_0xe03f('0x2e')]=_['intersection'](_0x40bb48[_0xe03f('0x2c')],_0x40bb48[_0xe03f('0x2d')]);_0xb95c76[_0xe03f('0x2f')]=_[_0xe03f('0x30')](_0x40bb48[_0xe03f('0x2c')],qs[_0xe03f('0x31')](_0x407784[_0xe03f('0x2d')]['fields']));_0xb95c76[_0xe03f('0x2f')]=_0xb95c76[_0xe03f('0x2f')][_0xe03f('0x32')]?_0xb95c76['attributes']:_0x40bb48[_0xe03f('0x2c')];if(_0x407784[_0xe03f('0x2d')][_0xe03f('0x3d')]){_0xb95c76['include']=[{'all':!![]}];}_0xb95c76=_[_0xe03f('0x3a')]({},_0xb95c76,_0x407784[_0xe03f('0x44')]);return db['Pause']['find'](_0xb95c76)[_0xe03f('0x1e')](handleEntityNotFound(_0x4a3bf0,null))['then'](respondWithResult(_0x4a3bf0,null))[_0xe03f('0x40')](handleError(_0x4a3bf0,null));};exports['create']=function(_0x4f5ce3,_0x15b7e1){return db[_0xe03f('0x3c')][_0xe03f('0x45')](_0x4f5ce3[_0xe03f('0x46')],{})[_0xe03f('0x1e')](function(_0x45fc3b){var _0x25f954=_0x4f5ce3[_0xe03f('0x47')][_0xe03f('0x1f')]({'plain':!![]});if(!_0x25f954)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x25f954['role']===_0xe03f('0x47')){var _0xb3389a=_0x45fc3b[_0xe03f('0x1f')]({'plain':!![]});var _0x3b1677=_0xe03f('0x20');return db[_0xe03f('0x48')]['find']({'where':{'name':_0x3b1677,'userProfileId':_0x25f954[_0xe03f('0x49')]},'raw':!![]})[_0xe03f('0x1e')](function(_0x55fe37){if(_0x55fe37&&_0x55fe37[_0xe03f('0x4a')]===0x0){return db[_0xe03f('0x21')]['create']({'name':_0xb3389a['name'],'resourceId':_0xb3389a['id'],'type':_0x55fe37[_0xe03f('0x26')],'sectionId':_0x55fe37['id']},{})[_0xe03f('0x1e')](function(){return _0x45fc3b;});}else{return _0x45fc3b;}})[_0xe03f('0x40')](function(_0x159172){logger[_0xe03f('0x24')](_0xe03f('0x4b'),_0x159172);throw _0x159172;});}return _0x45fc3b;})['then'](respondWithResult(_0x15b7e1,0xc9))[_0xe03f('0x40')](handleError(_0x15b7e1,null));};exports[_0xe03f('0x4c')]=function(_0x248928,_0x2da2d2){if(_0x248928[_0xe03f('0x46')]['id']){delete _0x248928['body']['id'];}return db[_0xe03f('0x3c')][_0xe03f('0x4d')]({'where':{'id':_0x248928[_0xe03f('0x42')]['id']}})[_0xe03f('0x1e')](handleEntityNotFound(_0x2da2d2,null))[_0xe03f('0x1e')](saveUpdates(_0x248928['body'],null))['then'](respondWithResult(_0x2da2d2,null))[_0xe03f('0x40')](handleError(_0x2da2d2,null));};exports[_0xe03f('0x4e')]=function(_0x46f994,_0x5b51d8){return db[_0xe03f('0x3c')][_0xe03f('0x4d')]({'where':{'id':_0x46f994['params']['id']}})[_0xe03f('0x1e')](handleEntityNotFound(_0x5b51d8,null))[_0xe03f('0x1e')](removeEntity(_0x5b51d8,null))['catch'](handleError(_0x5b51d8,null));}; \ No newline at end of file +var _0xa6b5=['crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','end','json','count','offset','limit','Content-Range','reject','save','update','then','destroy','get','Pauses','UserProfileResource','error','name','index','Pause','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','catch','show','params','fields','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','util','lodash','squel'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0xa6b5,0x117));var _0x5a6b=function(_0x2ad8e8,_0x501c86){_0x2ad8e8=_0x2ad8e8-0x0;var _0x514f54=_0xa6b5[_0x2ad8e8];return _0x514f54;};'use strict';var pdf=require(_0x5a6b('0x0'));var emlformat=require(_0x5a6b('0x1'));var rimraf=require(_0x5a6b('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5a6b('0x3'));var rp=require(_0x5a6b('0x4'));var moment=require(_0x5a6b('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x5a6b('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x5a6b('0x7'));var squel=require(_0x5a6b('0x8'));var crypto=require(_0x5a6b('0x9'));var jsforce=require(_0x5a6b('0xa'));var deskjs=require(_0x5a6b('0xb'));var toCsv=require(_0x5a6b('0xc'));var querystring=require(_0x5a6b('0xd'));var Papa=require(_0x5a6b('0xe'));var Redis=require(_0x5a6b('0xf'));var authService=require(_0x5a6b('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x5a6b('0x11'));var hardwareService=require(_0x5a6b('0x12'));var logger=require(_0x5a6b('0x13'))(_0x5a6b('0x14'));var utils=require('../../config/utils');var config=require(_0x5a6b('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x27c16c,_0x192e6c){_0x192e6c=_0x192e6c||0xcc;return function(_0x13b945){if(_0x13b945){return _0x27c16c[_0x5a6b('0x16')](_0x192e6c);}return _0x27c16c[_0x5a6b('0x17')](_0x192e6c)[_0x5a6b('0x18')]();};}function respondWithResult(_0x4ed630,_0x27b889){_0x27b889=_0x27b889||0xc8;return function(_0x12e876){if(_0x12e876){return _0x4ed630[_0x5a6b('0x17')](_0x27b889)[_0x5a6b('0x19')](_0x12e876);}};}function respondWithFilteredResult(_0x319335,_0x7b7b67){return function(_0x5ef68d){if(_0x5ef68d){var _0xd37ad2=_0x5ef68d[_0x5a6b('0x1a')],_0x886f22=_0x7b7b67[_0x5a6b('0x1b')],_0x170f67=_0x7b7b67[_0x5a6b('0x1b')]+_0x7b7b67[_0x5a6b('0x1c')],_0x5ba2ab;if(_0x170f67>=_0xd37ad2){_0x170f67=_0xd37ad2;_0x5ba2ab=0xc8;}else{_0x5ba2ab=0xce;}_0x319335[_0x5a6b('0x17')](_0x5ba2ab);return _0x319335['set'](_0x5a6b('0x1d'),_0x886f22+'-'+_0x170f67+'/'+_0xd37ad2)[_0x5a6b('0x19')](_0x5ef68d);}return null;};}function patchUpdates(_0x3bbd87){return function(_0x52a58c){try{jsonpatch['apply'](_0x52a58c,_0x3bbd87,!![]);}catch(_0x3559bf){return BPromise[_0x5a6b('0x1e')](_0x3559bf);}return _0x52a58c[_0x5a6b('0x1f')]();};}function saveUpdates(_0x5d48fa,_0x5cb69b){return function(_0x571ca6){if(_0x571ca6){return _0x571ca6[_0x5a6b('0x20')](_0x5d48fa)[_0x5a6b('0x21')](function(_0x35364b){return _0x35364b;});}return null;};}function removeEntity(_0x18a100,_0x2e4fce){return function(_0x44b2af){if(_0x44b2af){return _0x44b2af[_0x5a6b('0x22')]()['then'](function(){var _0x3b71e9=_0x44b2af[_0x5a6b('0x23')]({'plain':!![]});var _0x4ce565=_0x5a6b('0x24');return db[_0x5a6b('0x25')]['destroy']({'where':{'type':_0x4ce565,'resourceId':_0x3b71e9['id']}})['then'](function(){return _0x44b2af;});})['then'](function(){_0x18a100[_0x5a6b('0x17')](0xcc)[_0x5a6b('0x18')]();});}};}function handleEntityNotFound(_0x2f651b,_0x2278ff){return function(_0x1e860e){if(!_0x1e860e){_0x2f651b[_0x5a6b('0x16')](0x194);}return _0x1e860e;};}function handleError(_0x494478,_0x4d68a5){_0x4d68a5=_0x4d68a5||0x1f4;return function(_0x465608){logger[_0x5a6b('0x26')](_0x465608['stack']);if(_0x465608[_0x5a6b('0x27')]){delete _0x465608['name'];}_0x494478[_0x5a6b('0x17')](_0x4d68a5)['send'](_0x465608);};}exports[_0x5a6b('0x28')]=function(_0x47a83d,_0x47a80b){var _0x1da319={},_0x274353={},_0x4b2d11={'count':0x0,'rows':[]};var _0x1cab0f=_['map'](db[_0x5a6b('0x29')][_0x5a6b('0x2a')],function(_0x496890){return{'name':_0x496890[_0x5a6b('0x2b')],'type':_0x496890[_0x5a6b('0x2c')]['key']};});_0x274353[_0x5a6b('0x2d')]=_['map'](_0x1cab0f,'name');_0x274353[_0x5a6b('0x2e')]=_[_0x5a6b('0x2f')](_0x47a83d[_0x5a6b('0x2e')]);_0x274353[_0x5a6b('0x30')]=_[_0x5a6b('0x31')](_0x274353['model'],_0x274353[_0x5a6b('0x2e')]);_0x1da319[_0x5a6b('0x32')]=_[_0x5a6b('0x31')](_0x274353[_0x5a6b('0x2d')],qs['fields'](_0x47a83d[_0x5a6b('0x2e')]['fields']));_0x1da319[_0x5a6b('0x32')]=_0x1da319[_0x5a6b('0x32')][_0x5a6b('0x33')]?_0x1da319[_0x5a6b('0x32')]:_0x274353['model'];if(!_0x47a83d[_0x5a6b('0x2e')]['hasOwnProperty'](_0x5a6b('0x34'))){_0x1da319[_0x5a6b('0x1c')]=qs[_0x5a6b('0x1c')](_0x47a83d['query'][_0x5a6b('0x1c')]);_0x1da319['offset']=qs[_0x5a6b('0x1b')](_0x47a83d[_0x5a6b('0x2e')][_0x5a6b('0x1b')]);}_0x1da319[_0x5a6b('0x35')]=qs[_0x5a6b('0x36')](_0x47a83d[_0x5a6b('0x2e')][_0x5a6b('0x36')]);_0x1da319[_0x5a6b('0x37')]=qs[_0x5a6b('0x30')](_[_0x5a6b('0x38')](_0x47a83d[_0x5a6b('0x2e')],_0x274353[_0x5a6b('0x30')]));if(_0x47a83d[_0x5a6b('0x2e')][_0x5a6b('0x39')]){_0x1da319['where']=_[_0x5a6b('0x3a')](_0x1da319[_0x5a6b('0x37')],{'$or':_['map'](_0x1cab0f,function(_0x536e9d){if(_0x536e9d[_0x5a6b('0x2c')]!==_0x5a6b('0x3b')){var _0x191ff6={};_0x191ff6[_0x536e9d[_0x5a6b('0x27')]]={'$like':'%'+_0x47a83d['query']['filter']+'%'};return _0x191ff6;}})});}_0x1da319=_[_0x5a6b('0x3a')]({},_0x1da319,_0x47a83d[_0x5a6b('0x3c')]);var _0x4ff959={'where':_0x1da319[_0x5a6b('0x37')]};return db[_0x5a6b('0x29')]['count'](_0x4ff959)[_0x5a6b('0x21')](function(_0x11c965){_0x4b2d11[_0x5a6b('0x1a')]=_0x11c965;if(_0x47a83d['query']['includeAll']){_0x1da319[_0x5a6b('0x3d')]=[{'all':!![]}];}return db[_0x5a6b('0x29')]['findAll'](_0x1da319);})[_0x5a6b('0x21')](function(_0x434da8){_0x4b2d11['rows']=_0x434da8;return _0x4b2d11;})[_0x5a6b('0x21')](respondWithFilteredResult(_0x47a80b,_0x1da319))[_0x5a6b('0x3e')](handleError(_0x47a80b,null));};exports[_0x5a6b('0x3f')]=function(_0x37266c,_0x5dfe0b){var _0x23ffa0={'raw':!![],'where':{'id':_0x37266c[_0x5a6b('0x40')]['id']}},_0x31a46d={};_0x31a46d[_0x5a6b('0x2d')]=_['keys'](db[_0x5a6b('0x29')][_0x5a6b('0x2a')]);_0x31a46d['query']=_['keys'](_0x37266c[_0x5a6b('0x2e')]);_0x31a46d['filters']=_[_0x5a6b('0x31')](_0x31a46d[_0x5a6b('0x2d')],_0x31a46d[_0x5a6b('0x2e')]);_0x23ffa0[_0x5a6b('0x32')]=_['intersection'](_0x31a46d[_0x5a6b('0x2d')],qs[_0x5a6b('0x41')](_0x37266c[_0x5a6b('0x2e')][_0x5a6b('0x41')]));_0x23ffa0[_0x5a6b('0x32')]=_0x23ffa0[_0x5a6b('0x32')][_0x5a6b('0x33')]?_0x23ffa0['attributes']:_0x31a46d['model'];if(_0x37266c['query']['includeAll']){_0x23ffa0['include']=[{'all':!![]}];}_0x23ffa0=_['merge']({},_0x23ffa0,_0x37266c[_0x5a6b('0x3c')]);return db[_0x5a6b('0x29')][_0x5a6b('0x42')](_0x23ffa0)['then'](handleEntityNotFound(_0x5dfe0b,null))[_0x5a6b('0x21')](respondWithResult(_0x5dfe0b,null))[_0x5a6b('0x3e')](handleError(_0x5dfe0b,null));};exports[_0x5a6b('0x43')]=function(_0x7d7ee9,_0x1c585e){return db['Pause'][_0x5a6b('0x43')](_0x7d7ee9['body'],{})['then'](function(_0x360dbe){var _0x1dbbf3=_0x7d7ee9['user']['get']({'plain':!![]});if(!_0x1dbbf3)throw new Error(_0x5a6b('0x44'));if(_0x1dbbf3['role']==='user'){var _0x15d6da=_0x360dbe[_0x5a6b('0x23')]({'plain':!![]});var _0xd58881=_0x5a6b('0x24');return db[_0x5a6b('0x45')][_0x5a6b('0x42')]({'where':{'name':_0xd58881,'userProfileId':_0x1dbbf3[_0x5a6b('0x46')]},'raw':!![]})[_0x5a6b('0x21')](function(_0x3d6ff2){if(_0x3d6ff2&&_0x3d6ff2[_0x5a6b('0x47')]===0x0){return db[_0x5a6b('0x25')][_0x5a6b('0x43')]({'name':_0x15d6da[_0x5a6b('0x27')],'resourceId':_0x15d6da['id'],'type':_0x3d6ff2[_0x5a6b('0x27')],'sectionId':_0x3d6ff2['id']},{})[_0x5a6b('0x21')](function(){return _0x360dbe;});}else{return _0x360dbe;}})[_0x5a6b('0x3e')](function(_0xad54a2){logger[_0x5a6b('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xad54a2);throw _0xad54a2;});}return _0x360dbe;})['then'](respondWithResult(_0x1c585e,0xc9))[_0x5a6b('0x3e')](handleError(_0x1c585e,null));};exports[_0x5a6b('0x20')]=function(_0x189efd,_0x5965a6){if(_0x189efd['body']['id']){delete _0x189efd['body']['id'];}return db['Pause'][_0x5a6b('0x42')]({'where':{'id':_0x189efd[_0x5a6b('0x40')]['id']}})[_0x5a6b('0x21')](handleEntityNotFound(_0x5965a6,null))['then'](saveUpdates(_0x189efd['body'],null))[_0x5a6b('0x21')](respondWithResult(_0x5965a6,null))[_0x5a6b('0x3e')](handleError(_0x5965a6,null));};exports['destroy']=function(_0x3d5828,_0x5f0139){return db[_0x5a6b('0x29')][_0x5a6b('0x42')]({'where':{'id':_0x3d5828[_0x5a6b('0x40')]['id']}})[_0x5a6b('0x21')](handleEntityNotFound(_0x5f0139,null))[_0x5a6b('0x21')](removeEntity(_0x5f0139,null))[_0x5a6b('0x3e')](handleError(_0x5f0139,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 9ae50a1..f3099e7 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 _0xed3c=['util','../../config/logger','api','bluebird','request-promise','path','./pause.attributes','exports','lodash'];(function(_0x5b88f7,_0x5e0acd){var _0x43a5c0=function(_0x5ec0f3){while(--_0x5ec0f3){_0x5b88f7['push'](_0x5b88f7['shift']());}};_0x43a5c0(++_0x5e0acd);}(_0xed3c,0x1a6));var _0xced3=function(_0x131c81,_0x12fe63){_0x131c81=_0x131c81-0x0;var _0x241e7a=_0xed3c[_0x131c81];return _0x241e7a;};'use strict';var _=require(_0xced3('0x0'));var util=require(_0xced3('0x1'));var logger=require(_0xced3('0x2'))(_0xced3('0x3'));var moment=require('moment');var BPromise=require(_0xced3('0x4'));var rp=require(_0xced3('0x5'));var fs=require('fs');var path=require(_0xced3('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xced3('0x7'));module[_0xced3('0x8')]=function(_0x2f92f8,_0x1cd694){return _0x2f92f8['define']('Pause',attributes,{'tableName':'tools_pauses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x578c=['../../config/environment','./pause.attributes','exports','define','Pause','tools_pauses','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x578c,0x158));var _0xc578=function(_0x189031,_0x157f39){_0x189031=_0x189031-0x0;var _0x44b1da=_0x578c[_0x189031];return _0x44b1da;};'use strict';var _=require(_0xc578('0x0'));var util=require(_0xc578('0x1'));var logger=require(_0xc578('0x2'))('api');var moment=require(_0xc578('0x3'));var BPromise=require(_0xc578('0x4'));var rp=require(_0xc578('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc578('0x6'));var config=require(_0xc578('0x7'));var attributes=require(_0xc578('0x8'));module[_0xc578('0x9')]=function(_0x178786,_0x3305c9){return _0x178786[_0xc578('0xa')](_0xc578('0xb'),attributes,{'tableName':_0xc578('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/pause/pause.rpc.js b/server/api/pause/pause.rpc.js index 44836f9..af18846 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 _0x68ef=['message','result','catch','ShowPause','Pause','find','options','raw','where','attributes','include','map','model','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','then','info','request\x20sent','Pause,\x20%s,\x20%s,\x20%s','stringify','error','Pause,\x20%s,\x20%s'];(function(_0x23f0e1,_0x11d94b){var _0x257f0d=function(_0xab63c7){while(--_0xab63c7){_0x23f0e1['push'](_0x23f0e1['shift']());}};_0x257f0d(++_0x11d94b);}(_0x68ef,0x9e));var _0xf68e=function(_0x31dd25,_0x237baa){_0x31dd25=_0x31dd25-0x0;var _0x2d76a4=_0x68ef[_0x31dd25];return _0x2d76a4;};'use strict';var _=require(_0xf68e('0x0'));var util=require(_0xf68e('0x1'));var moment=require('moment');var BPromise=require(_0xf68e('0x2'));var rs=require(_0xf68e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xf68e('0x4'));var logger=require(_0xf68e('0x5'))(_0xf68e('0x6'));var config=require(_0xf68e('0x7'));var jayson=require(_0xf68e('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x34cba6,_0x3643c9,_0x49b91d){return new BPromise(function(_0x518e73,_0x2beee9){return client['request'](_0x34cba6,_0x49b91d)[_0xf68e('0x9')](function(_0x2d11f7){logger[_0xf68e('0xa')]('Pause,\x20%s,\x20%s',_0x3643c9,_0xf68e('0xb'));logger['debug'](_0xf68e('0xc'),_0x3643c9,_0xf68e('0xb'),JSON[_0xf68e('0xd')](_0x2d11f7));if(_0x2d11f7[_0xf68e('0xe')]){if(_0x2d11f7[_0xf68e('0xe')]['code']===0x1f4){logger['error'](_0xf68e('0xf'),_0x3643c9,_0x2d11f7['error'][_0xf68e('0x10')]);return _0x2beee9(_0x2d11f7[_0xf68e('0xe')][_0xf68e('0x10')]);}logger['error']('Pause,\x20%s,\x20%s',_0x3643c9,_0x2d11f7['error']['message']);return _0x518e73(_0x2d11f7[_0xf68e('0xe')][_0xf68e('0x10')]);}else{logger[_0xf68e('0xa')]('Pause,\x20%s,\x20%s',_0x3643c9,'request\x20sent');_0x518e73(_0x2d11f7[_0xf68e('0x11')]['message']);}})[_0xf68e('0x12')](function(_0x38540b){logger[_0xf68e('0xe')](_0xf68e('0xf'),_0x3643c9,_0x38540b);_0x2beee9(_0x38540b);});});}exports[_0xf68e('0x13')]=function(_0x3c8f8a){var _0x161412=this;return new Promise(function(_0x123a43,_0x337958){return db[_0xf68e('0x14')][_0xf68e('0x15')]({'raw':_0x3c8f8a[_0xf68e('0x16')]?_0x3c8f8a[_0xf68e('0x16')][_0xf68e('0x17')]===undefined?!![]:![]:!![],'where':_0x3c8f8a[_0xf68e('0x16')]?_0x3c8f8a[_0xf68e('0x16')][_0xf68e('0x18')]||null:null,'attributes':_0x3c8f8a['options']?_0x3c8f8a[_0xf68e('0x16')][_0xf68e('0x19')]||null:null,'include':_0x3c8f8a['options']?_0x3c8f8a[_0xf68e('0x16')][_0xf68e('0x1a')]?_[_0xf68e('0x1b')](_0x3c8f8a[_0xf68e('0x16')]['include'],function(_0x56ce38){return{'model':db[_0x56ce38['model']],'as':_0x56ce38['as'],'attributes':_0x56ce38[_0xf68e('0x19')],'include':_0x56ce38['include']?_[_0xf68e('0x1b')](_0x56ce38[_0xf68e('0x1a')],function(_0x34408e){return{'model':db[_0x34408e[_0xf68e('0x1c')]],'as':_0x34408e['as'],'attributes':_0x34408e['attributes'],'include':_0x34408e[_0xf68e('0x1a')]?_[_0xf68e('0x1b')](_0x34408e['include'],function(_0x4d2c91){return{'model':db[_0x4d2c91['model']],'as':_0x4d2c91['as'],'attributes':_0x4d2c91[_0xf68e('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5778fa){logger[_0xf68e('0xa')](_0xf68e('0x13'),_0x3c8f8a);logger['debug'](_0xf68e('0x13'),_0x3c8f8a,JSON[_0xf68e('0xd')](_0x5778fa));_0x123a43(_0x5778fa);})[_0xf68e('0x12')](function(_0xb8aa){logger[_0xf68e('0xe')]('ShowPause',_0xb8aa[_0xf68e('0x10')],_0x3c8f8a);_0x337958(_0x161412[_0xf68e('0xe')](0x1f4,_0xb8aa[_0xf68e('0x10')]));});});}; \ No newline at end of file +var _0xa854=['../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','Pause,\x20%s,\x20%s','request\x20sent','debug','Pause,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','ShowPause','Pause','find','raw','options','where','attributes','include','model','map','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x1b014f,_0x6b24fe){var _0x361ea1=function(_0x474660){while(--_0x474660){_0x1b014f['push'](_0x1b014f['shift']());}};_0x361ea1(++_0x6b24fe);}(_0xa854,0x103));var _0x4a85=function(_0x12a32f,_0x26d2f0){_0x12a32f=_0x12a32f-0x0;var _0x5e351b=_0xa854[_0x12a32f];return _0x5e351b;};'use strict';var _=require(_0x4a85('0x0'));var util=require(_0x4a85('0x1'));var moment=require(_0x4a85('0x2'));var BPromise=require(_0x4a85('0x3'));var rs=require(_0x4a85('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4a85('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x4a85('0x6'))('rpc');var config=require(_0x4a85('0x7'));var jayson=require(_0x4a85('0x8'));var client=jayson['client'][_0x4a85('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x142b27,_0x545fce,_0xb1605c){return new BPromise(function(_0x507c59,_0x2a3050){return client[_0x4a85('0xa')](_0x142b27,_0xb1605c)[_0x4a85('0xb')](function(_0x1cb2dc){logger[_0x4a85('0xc')](_0x4a85('0xd'),_0x545fce,_0x4a85('0xe'));logger[_0x4a85('0xf')](_0x4a85('0x10'),_0x545fce,'request\x20sent',JSON[_0x4a85('0x11')](_0x1cb2dc));if(_0x1cb2dc[_0x4a85('0x12')]){if(_0x1cb2dc[_0x4a85('0x12')][_0x4a85('0x13')]===0x1f4){logger[_0x4a85('0x12')](_0x4a85('0xd'),_0x545fce,_0x1cb2dc[_0x4a85('0x12')][_0x4a85('0x14')]);return _0x2a3050(_0x1cb2dc[_0x4a85('0x12')]['message']);}logger[_0x4a85('0x12')](_0x4a85('0xd'),_0x545fce,_0x1cb2dc[_0x4a85('0x12')][_0x4a85('0x14')]);return _0x507c59(_0x1cb2dc[_0x4a85('0x12')][_0x4a85('0x14')]);}else{logger[_0x4a85('0xc')](_0x4a85('0xd'),_0x545fce,_0x4a85('0xe'));_0x507c59(_0x1cb2dc[_0x4a85('0x15')][_0x4a85('0x14')]);}})['catch'](function(_0x28a7d3){logger[_0x4a85('0x12')]('Pause,\x20%s,\x20%s',_0x545fce,_0x28a7d3);_0x2a3050(_0x28a7d3);});});}exports[_0x4a85('0x16')]=function(_0x159ed0){var _0x4435db=this;return new Promise(function(_0x50e210,_0x374f34){return db[_0x4a85('0x17')][_0x4a85('0x18')]({'raw':_0x159ed0['options']?_0x159ed0['options'][_0x4a85('0x19')]===undefined?!![]:![]:!![],'where':_0x159ed0[_0x4a85('0x1a')]?_0x159ed0[_0x4a85('0x1a')][_0x4a85('0x1b')]||null:null,'attributes':_0x159ed0[_0x4a85('0x1a')]?_0x159ed0[_0x4a85('0x1a')][_0x4a85('0x1c')]||null:null,'include':_0x159ed0[_0x4a85('0x1a')]?_0x159ed0['options']['include']?_['map'](_0x159ed0[_0x4a85('0x1a')][_0x4a85('0x1d')],function(_0x444bf6){return{'model':db[_0x444bf6[_0x4a85('0x1e')]],'as':_0x444bf6['as'],'attributes':_0x444bf6['attributes'],'include':_0x444bf6[_0x4a85('0x1d')]?_[_0x4a85('0x1f')](_0x444bf6[_0x4a85('0x1d')],function(_0x3f3894){return{'model':db[_0x3f3894[_0x4a85('0x1e')]],'as':_0x3f3894['as'],'attributes':_0x3f3894['attributes'],'include':_0x3f3894[_0x4a85('0x1d')]?_[_0x4a85('0x1f')](_0x3f3894[_0x4a85('0x1d')],function(_0x3a640c){return{'model':db[_0x3a640c[_0x4a85('0x1e')]],'as':_0x3a640c['as'],'attributes':_0x3a640c[_0x4a85('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x4a85('0xb')](function(_0x462656){logger[_0x4a85('0xc')](_0x4a85('0x16'),_0x159ed0);logger['debug'](_0x4a85('0x16'),_0x159ed0,JSON['stringify'](_0x462656));_0x50e210(_0x462656);})[_0x4a85('0x20')](function(_0x1b91ec){logger[_0x4a85('0x12')](_0x4a85('0x16'),_0x1b91ec[_0x4a85('0x14')],_0x159ed0);_0x374f34(_0x4435db[_0x4a85('0x12')](0x1f4,_0x1b91ec[_0x4a85('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index a9c24d3..8cda410 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 _0xf056=['util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./plugin.controller','get','index','/:id','isAuthenticated','/:id/download','download','diskStorage','server/files/plugins','originalname','replace','format','%s-%s%s','extname','now','single','file','upload','post','/webhook','put','update','delete','exports'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0xf056,0x1e0));var _0x6f05=function(_0x2a81b6,_0x248e4e){_0x2a81b6=_0x2a81b6-0x0;var _0x2e8ed6=_0xf056[_0x2a81b6];return _0x2e8ed6;};'use strict';var multer=require('multer');var util=require(_0x6f05('0x0'));var path=require(_0x6f05('0x1'));var timeout=require(_0x6f05('0x2'));var express=require('express');var router=express[_0x6f05('0x3')]();var auth=require(_0x6f05('0x4'));var interaction=require(_0x6f05('0x5'));var config=require('../../config/environment');var controller=require(_0x6f05('0x6'));router[_0x6f05('0x7')]('/',auth['isAuthenticated'](),controller[_0x6f05('0x8')]);router[_0x6f05('0x7')]('/webhook',controller['webhookGet']);router[_0x6f05('0x7')](_0x6f05('0x9'),auth[_0x6f05('0xa')](),controller['show']);router[_0x6f05('0x7')](_0x6f05('0xb'),auth['isAuthenticated'](),controller[_0x6f05('0xc')]);var upload=multer({'storage':multer[_0x6f05('0xd')]({'destination':function(_0x44cb9c,_0x42f518,_0x2356f0){_0x2356f0(null,path['join'](config['root'],_0x6f05('0xe')));},'filename':function(_0x3b7f5c,_0x335615,_0x26a218){_0x335615[_0x6f05('0xf')]=_0x335615[_0x6f05('0xf')][_0x6f05('0x10')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x26a218(null,util[_0x6f05('0x11')](_0x6f05('0x12'),path['basename'](_0x335615[_0x6f05('0xf')],path[_0x6f05('0x13')](_0x335615[_0x6f05('0xf')])),Date[_0x6f05('0x14')](),path['extname'](_0x335615[_0x6f05('0xf')])));}})});router['post']('/',upload[_0x6f05('0x15')](_0x6f05('0x16')),controller[_0x6f05('0x17')]);router[_0x6f05('0x18')](_0x6f05('0x19'),controller['webhookPost']);router[_0x6f05('0x1a')](_0x6f05('0x9'),auth[_0x6f05('0xa')](),controller[_0x6f05('0x1b')]);router[_0x6f05('0x1c')](_0x6f05('0x9'),auth[_0x6f05('0xa')](),controller[_0x6f05('0x1c')]);module[_0x6f05('0x1d')]=router; \ No newline at end of file +var _0x77f4=['format','%s-%s%s','extname','post','file','upload','webhookPost','put','update','delete','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','/webhook','webhookGet','/:id','show','diskStorage','join','root','originalname'];(function(_0x4bb66f,_0x3cd682){var _0xf2772f=function(_0x2e3698){while(--_0x2e3698){_0x4bb66f['push'](_0x4bb66f['shift']());}};_0xf2772f(++_0x3cd682);}(_0x77f4,0x1ba));var _0x477f=function(_0x47306b,_0x109656){_0x47306b=_0x47306b-0x0;var _0x27001a=_0x77f4[_0x47306b];return _0x27001a;};'use strict';var multer=require('multer');var util=require(_0x477f('0x0'));var path=require(_0x477f('0x1'));var timeout=require(_0x477f('0x2'));var express=require(_0x477f('0x3'));var router=express[_0x477f('0x4')]();var auth=require(_0x477f('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x477f('0x6'));var controller=require('./plugin.controller');router[_0x477f('0x7')]('/',auth[_0x477f('0x8')](),controller['index']);router['get'](_0x477f('0x9'),controller[_0x477f('0xa')]);router[_0x477f('0x7')](_0x477f('0xb'),auth[_0x477f('0x8')](),controller[_0x477f('0xc')]);router[_0x477f('0x7')]('/:id/download',auth[_0x477f('0x8')](),controller['download']);var upload=multer({'storage':multer[_0x477f('0xd')]({'destination':function(_0x453d1b,_0x22369f,_0x53b407){_0x53b407(null,path[_0x477f('0xe')](config[_0x477f('0xf')],'server/files/plugins'));},'filename':function(_0x255b81,_0x5d115b,_0x2b1434){_0x5d115b[_0x477f('0x10')]=_0x5d115b[_0x477f('0x10')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x2b1434(null,util[_0x477f('0x11')](_0x477f('0x12'),path['basename'](_0x5d115b[_0x477f('0x10')],path[_0x477f('0x13')](_0x5d115b[_0x477f('0x10')])),Date['now'](),path['extname'](_0x5d115b[_0x477f('0x10')])));}})});router[_0x477f('0x14')]('/',upload['single'](_0x477f('0x15')),controller[_0x477f('0x16')]);router[_0x477f('0x14')](_0x477f('0x9'),controller[_0x477f('0x17')]);router[_0x477f('0x18')]('/:id',auth[_0x477f('0x8')](),controller[_0x477f('0x19')]);router[_0x477f('0x1a')](_0x477f('0xb'),auth[_0x477f('0x8')](),controller[_0x477f('0x1a')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index bfdce7d..8053362 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 _0xf527=['exports','STRING','html','script','TEXT','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','ENUM','adminOnly','agentOnly','always','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize'];(function(_0xd09668,_0x1435b2){var _0x68726=function(_0x54a030){while(--_0x54a030){_0xd09668['push'](_0xd09668['shift']());}};_0x68726(++_0x1435b2);}(_0xf527,0x110));var _0x7f52=function(_0x5856ba,_0x3ceebb){_0x5856ba=_0x5856ba-0x0;var _0x170028=_0xf527[_0x5856ba];return _0x170028;};'use strict';var Sequelize=require(_0x7f52('0x0'));module[_0x7f52('0x1')]={'name':{'type':Sequelize[_0x7f52('0x2')]},'type':{'type':Sequelize['ENUM'](_0x7f52('0x3'),_0x7f52('0x4'))},'description':{'type':Sequelize[_0x7f52('0x5')]},'version':{'type':Sequelize[_0x7f52('0x5')]},'path':{'type':Sequelize[_0x7f52('0x2')],'comment':'The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'},'active':{'type':Sequelize[_0x7f52('0x6')],'defaultValue':0x0,'comment':_0x7f52('0x7')},'sidebar':{'type':Sequelize[_0x7f52('0x8')](_0x7f52('0x9'),_0x7f52('0xa'),_0x7f52('0xb'),'never'),'defaultValue':_0x7f52('0xb'),'comment':_0x7f52('0xc')},'icon':{'type':Sequelize[_0x7f52('0x2')]},'adminUrl':{'type':Sequelize['STRING']},'agentUrl':{'type':Sequelize[_0x7f52('0x2')]},'scriptName':{'type':Sequelize[_0x7f52('0x2')]},'scriptPath':{'type':Sequelize[_0x7f52('0x2')]}}; \ No newline at end of file +var _0x00b7=['html','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','ENUM','adminOnly','agentOnly','always','never','sequelize','exports','STRING'];(function(_0x4f165e,_0x3be429){var _0x49d041=function(_0xd1c4f9){while(--_0xd1c4f9){_0x4f165e['push'](_0x4f165e['shift']());}};_0x49d041(++_0x3be429);}(_0x00b7,0x8d));var _0x700b=function(_0x685fb2,_0x3f71f2){_0x685fb2=_0x685fb2-0x0;var _0xdff0a9=_0x00b7[_0x685fb2];return _0xdff0a9;};'use strict';var Sequelize=require(_0x700b('0x0'));module[_0x700b('0x1')]={'name':{'type':Sequelize[_0x700b('0x2')]},'type':{'type':Sequelize['ENUM'](_0x700b('0x3'),'script')},'description':{'type':Sequelize[_0x700b('0x4')]},'version':{'type':Sequelize[_0x700b('0x4')]},'path':{'type':Sequelize[_0x700b('0x2')],'comment':_0x700b('0x5')},'active':{'type':Sequelize[_0x700b('0x6')],'defaultValue':0x0,'comment':'Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'},'sidebar':{'type':Sequelize[_0x700b('0x7')](_0x700b('0x8'),_0x700b('0x9'),_0x700b('0xa'),_0x700b('0xb')),'defaultValue':'always','comment':'Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'},'icon':{'type':Sequelize['STRING']},'adminUrl':{'type':Sequelize[_0x700b('0x2')]},'agentUrl':{'type':Sequelize['STRING']},'scriptName':{'type':Sequelize[_0x700b('0x2')]},'scriptPath':{'type':Sequelize[_0x700b('0x2')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index fb29dcd..a273238 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 _0x9174=['statusCode','webhookPost','%s%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','extract-zip','archiver','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','end','status','json','count','offset','limit','set','apply','save','then','get','UserProfileResource','error','stack','name','send','Plugin','rawAttributes','fieldName','key','model','map','attributes','intersection','fields','query','length','hasOwnProperty','nolimit','order','where','filters','pick','filter','merge','VIRTUAL','catch','show','params','keys','includeAll','include','options','find','download','root','server/files/plugins','%s.zip','basename','createWriteStream','zip','warning','code','Error\x20while\x20generating\x20the\x20zip\x20archive','Sequelize','Error','glob','**/*','join','dirname','node_modules/**/*','attachments/**/*','finalize','close','Plugin\x20not\x20found','format','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','upload','filename','file','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','some','Plugin\x20manifest\x20missing','readFileSync','parse','undefined','Invalid\x20manifest:\x20name\x20missing','type','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','views','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','icon-apps','test','plugins','Warning:\x20agent\x20view\x20not\x20specified','scriptName','create','role','Unable\x20to\x20retrieve\x20the\x20current\x20user','Plugins','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','body','delete','destroy','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','method','headers','content-length','content-type','endsWith'];(function(_0x1fcde2,_0xa49b11){var _0x378d7b=function(_0x3a75ad){while(--_0x3a75ad){_0x1fcde2['push'](_0x1fcde2['shift']());}};_0x378d7b(++_0xa49b11);}(_0x9174,0xa9));var _0x4917=function(_0x19792d,_0x1984a9){_0x19792d=_0x19792d-0x0;var _0x4f2117=_0x9174[_0x19792d];return _0x4f2117;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x4917('0x0'));var rimraf=require(_0x4917('0x1'));var zipdir=require(_0x4917('0x2'));var jsonpatch=require(_0x4917('0x3'));var rp=require(_0x4917('0x4'));var moment=require('moment');var BPromise=require(_0x4917('0x5'));var Mustache=require('mustache');var util=require(_0x4917('0x6'));var path=require(_0x4917('0x7'));var sox=require(_0x4917('0x8'));var csv=require('to-csv');var ejs=require(_0x4917('0x9'));var fs=require('fs');var _=require(_0x4917('0xa'));var squel=require(_0x4917('0xb'));var crypto=require('crypto');var jsforce=require(_0x4917('0xc'));var deskjs=require(_0x4917('0xd'));var toCsv=require(_0x4917('0xe'));var querystring=require(_0x4917('0xf'));var Papa=require('papaparse');var extract=require(_0x4917('0x10'));var rimraf=require(_0x4917('0x1'));var archiver=require(_0x4917('0x11'));var Redis=require(_0x4917('0x12'));var authService=require(_0x4917('0x13'));var qs=require(_0x4917('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4917('0x15'));var logger=require(_0x4917('0x16'))(_0x4917('0x17'));var utils=require(_0x4917('0x18'));var config=require('../../config/environment');var db=require(_0x4917('0x19'))['db'];config[_0x4917('0x1a')]=_[_0x4917('0x1b')](config['redis'],{'host':_0x4917('0x1c'),'port':0x18eb});var socket=require(_0x4917('0x1d'))(new Redis(config[_0x4917('0x1a')]));require('./plugin.socket')[_0x4917('0x1e')](socket);function respondWithStatusCode(_0x534e68,_0x152048){_0x152048=_0x152048||0xcc;return function(_0x48d96c){if(_0x48d96c){return _0x534e68[_0x4917('0x1f')](_0x152048);}return _0x534e68['status'](_0x152048)[_0x4917('0x20')]();};}function respondWithResult(_0x10922c,_0x30384a){_0x30384a=_0x30384a||0xc8;return function(_0x402f51){if(_0x402f51){return _0x10922c[_0x4917('0x21')](_0x30384a)[_0x4917('0x22')](_0x402f51);}};}function respondWithFilteredResult(_0x4860cf,_0x584e81){return function(_0x923de1){if(_0x923de1){var _0x1defa8=_0x923de1[_0x4917('0x23')],_0x433ffb=_0x584e81['offset'],_0xe9fa2c=_0x584e81[_0x4917('0x24')]+_0x584e81[_0x4917('0x25')],_0x2b2c22;if(_0xe9fa2c>=_0x1defa8){_0xe9fa2c=_0x1defa8;_0x2b2c22=0xc8;}else{_0x2b2c22=0xce;}_0x4860cf[_0x4917('0x21')](_0x2b2c22);return _0x4860cf[_0x4917('0x26')]('Content-Range',_0x433ffb+'-'+_0xe9fa2c+'/'+_0x1defa8)['json'](_0x923de1);}return null;};}function patchUpdates(_0x47d12a){return function(_0x21b24b){try{jsonpatch[_0x4917('0x27')](_0x21b24b,_0x47d12a,!![]);}catch(_0x430f74){return BPromise['reject'](_0x430f74);}return _0x21b24b[_0x4917('0x28')]();};}function saveUpdates(_0x5b3577,_0x6bf290){return function(_0x4c3ca5){if(_0x4c3ca5){return _0x4c3ca5['update'](_0x5b3577)['then'](function(_0x165e91){return _0x165e91;});}return null;};}function removeEntity(_0x5184ab,_0x3b2064){return function(_0x1d0017){if(_0x1d0017){return _0x1d0017['destroy']()[_0x4917('0x29')](function(){var _0x27a3b3=_0x1d0017[_0x4917('0x2a')]({'plain':!![]});var _0x49a929='Plugins';return db[_0x4917('0x2b')]['destroy']({'where':{'type':_0x49a929,'resourceId':_0x27a3b3['id']}})[_0x4917('0x29')](function(){return _0x1d0017;});})['then'](function(){_0x5184ab['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x570579,_0x4694b6){return function(_0x12dcd2){if(!_0x12dcd2){_0x570579[_0x4917('0x1f')](0x194);}return _0x12dcd2;};}function handleError(_0x1f5551,_0x21ce8f){_0x21ce8f=_0x21ce8f||0x1f4;return function(_0x1635f1){logger[_0x4917('0x2c')](_0x1635f1[_0x4917('0x2d')]);if(_0x1635f1[_0x4917('0x2e')]){delete _0x1635f1[_0x4917('0x2e')];}_0x1f5551[_0x4917('0x21')](_0x21ce8f)[_0x4917('0x2f')](_0x1635f1);};}exports['index']=function(_0xfb42b3,_0x4cdcbf){var _0x13c687={},_0x207ebb={},_0x4fdda0={'count':0x0,'rows':[]};var _0x3c702e=_['map'](db[_0x4917('0x30')][_0x4917('0x31')],function(_0x103d2b){return{'name':_0x103d2b[_0x4917('0x32')],'type':_0x103d2b['type'][_0x4917('0x33')]};});_0x207ebb[_0x4917('0x34')]=_[_0x4917('0x35')](_0x3c702e,_0x4917('0x2e'));_0x207ebb['query']=_['keys'](_0xfb42b3['query']);_0x207ebb['filters']=_['intersection'](_0x207ebb['model'],_0x207ebb['query']);_0x13c687[_0x4917('0x36')]=_[_0x4917('0x37')](_0x207ebb[_0x4917('0x34')],qs[_0x4917('0x38')](_0xfb42b3[_0x4917('0x39')][_0x4917('0x38')]));_0x13c687[_0x4917('0x36')]=_0x13c687[_0x4917('0x36')][_0x4917('0x3a')]?_0x13c687[_0x4917('0x36')]:_0x207ebb[_0x4917('0x34')];if(!_0xfb42b3[_0x4917('0x39')][_0x4917('0x3b')](_0x4917('0x3c'))){_0x13c687[_0x4917('0x25')]=qs['limit'](_0xfb42b3[_0x4917('0x39')]['limit']);_0x13c687[_0x4917('0x24')]=qs[_0x4917('0x24')](_0xfb42b3['query'][_0x4917('0x24')]);}_0x13c687[_0x4917('0x3d')]=qs['sort'](_0xfb42b3[_0x4917('0x39')]['sort']);_0x13c687[_0x4917('0x3e')]=qs[_0x4917('0x3f')](_[_0x4917('0x40')](_0xfb42b3['query'],_0x207ebb[_0x4917('0x3f')]));if(_0xfb42b3[_0x4917('0x39')][_0x4917('0x41')]){_0x13c687[_0x4917('0x3e')]=_[_0x4917('0x42')](_0x13c687[_0x4917('0x3e')],{'$or':_[_0x4917('0x35')](_0x3c702e,function(_0x354f14){if(_0x354f14['type']!==_0x4917('0x43')){var _0x1da742={};_0x1da742[_0x354f14[_0x4917('0x2e')]]={'$like':'%'+_0xfb42b3['query']['filter']+'%'};return _0x1da742;}})});}_0x13c687=_[_0x4917('0x42')]({},_0x13c687,_0xfb42b3['options']);var _0x5c5f2c={'where':_0x13c687['where']};return db['Plugin']['count'](_0x5c5f2c)[_0x4917('0x29')](function(_0x3beeb0){_0x4fdda0[_0x4917('0x23')]=_0x3beeb0;if(_0xfb42b3[_0x4917('0x39')]['includeAll']){_0x13c687['include']=[{'all':!![]}];}return db['Plugin']['findAll'](_0x13c687);})['then'](function(_0x118a25){_0x4fdda0['rows']=_0x118a25;return _0x4fdda0;})[_0x4917('0x29')](respondWithFilteredResult(_0x4cdcbf,_0x13c687))[_0x4917('0x44')](handleError(_0x4cdcbf,null));};exports[_0x4917('0x45')]=function(_0x4d680c,_0x5bb2f0){var _0x311baa={'raw':!![],'where':{'id':_0x4d680c[_0x4917('0x46')]['id']}},_0x4e05fd={};_0x4e05fd['model']=_[_0x4917('0x47')](db[_0x4917('0x30')]['rawAttributes']);_0x4e05fd[_0x4917('0x39')]=_[_0x4917('0x47')](_0x4d680c[_0x4917('0x39')]);_0x4e05fd[_0x4917('0x3f')]=_[_0x4917('0x37')](_0x4e05fd[_0x4917('0x34')],_0x4e05fd[_0x4917('0x39')]);_0x311baa['attributes']=_[_0x4917('0x37')](_0x4e05fd[_0x4917('0x34')],qs[_0x4917('0x38')](_0x4d680c[_0x4917('0x39')][_0x4917('0x38')]));_0x311baa[_0x4917('0x36')]=_0x311baa[_0x4917('0x36')][_0x4917('0x3a')]?_0x311baa['attributes']:_0x4e05fd[_0x4917('0x34')];if(_0x4d680c[_0x4917('0x39')][_0x4917('0x48')]){_0x311baa[_0x4917('0x49')]=[{'all':!![]}];}_0x311baa=_[_0x4917('0x42')]({},_0x311baa,_0x4d680c[_0x4917('0x4a')]);return db[_0x4917('0x30')][_0x4917('0x4b')](_0x311baa)['then'](handleEntityNotFound(_0x5bb2f0,null))['then'](respondWithResult(_0x5bb2f0,null))[_0x4917('0x44')](handleError(_0x5bb2f0,null));};exports[_0x4917('0x4c')]=function(_0x387aff,_0x3a1c48,_0x2ac3d7){return db[_0x4917('0x30')][_0x4917('0x4b')]({'where':{'id':_0x387aff[_0x4917('0x46')]['id']},'attributes':[_0x4917('0x2e'),_0x4917('0x7')],'raw':!![]})['then'](handleEntityNotFound(_0x3a1c48,null))['then'](function(_0x400105){if(_0x400105){var _0x3eb526=path['join'](config[_0x4917('0x4d')],_0x4917('0x4e'),util['format'](_0x4917('0x4f'),path[_0x4917('0x50')](_0x400105[_0x4917('0x7')])));var _0x2d04d7=fs[_0x4917('0x51')](_0x3eb526);var _0x5a73d6=archiver(_0x4917('0x52'),{'zlib':{'level':0x9}});_0x5a73d6['on'](_0x4917('0x53'),function(_0x245d5c){if(_0x245d5c[_0x4917('0x54')]==='ENOENT'){logger[_0x4917('0x2c')](_0x245d5c);}else{throw new db['Sequelize']['Error'](_0x4917('0x55'));}});_0x5a73d6['on'](_0x4917('0x2c'),function(_0x438810){throw new db[(_0x4917('0x56'))][(_0x4917('0x57'))](_0x4917('0x55'));});_0x5a73d6['pipe'](_0x2d04d7);_0x5a73d6[_0x4917('0x58')](_0x4917('0x59'),{'cwd':path[_0x4917('0x5a')](config[_0x4917('0x4d')],_0x4917('0x4e'),path[_0x4917('0x5b')](_0x400105[_0x4917('0x7')])),'ignore':[path[_0x4917('0x5a')](path[_0x4917('0x50')](_0x400105[_0x4917('0x7')]),_0x4917('0x5c')),path[_0x4917('0x5a')](path[_0x4917('0x50')](_0x400105[_0x4917('0x7')]),_0x4917('0x5d'))],'nodir':!![]})[_0x4917('0x5e')]();_0x2d04d7['on'](_0x4917('0x5f'),function(){if(!fs['existsSync'](_0x3eb526)){throw new db[(_0x4917('0x56'))][(_0x4917('0x57'))](_0x4917('0x60'));}return _0x3a1c48[_0x4917('0x4c')](_0x3eb526,util[_0x4917('0x61')]('%s.zip',path['basename'](_0x400105[_0x4917('0x7')])),function(_0xa5d1f3){if(_0xa5d1f3){throw new db[(_0x4917('0x56'))][(_0x4917('0x57'))](_0x4917('0x62'));}fs[_0x4917('0x63')](_0x3eb526);logger[_0x4917('0x64')]('Download\x20completed');logger[_0x4917('0x64')]('Temporary\x20file\x20removed');});});}return null;})['catch'](handleError(_0x3a1c48,null));};exports[_0x4917('0x65')]=function(_0x53af0f,_0x502999,_0x485a91){var _0x3fa7a0=path[_0x4917('0x50')](_0x53af0f['file'][_0x4917('0x66')],path['extname'](_0x53af0f[_0x4917('0x67')][_0x4917('0x66')]));var _0x16baeb=path['join'](config[_0x4917('0x4d')],_0x4917('0x4e'),_0x53af0f[_0x4917('0x67')][_0x4917('0x66')]);var _0x274182=path[_0x4917('0x5a')](config[_0x4917('0x4d')],_0x4917('0x4e'),_0x3fa7a0);logger[_0x4917('0x64')]('Plugin\x20upload\x20filepath:\x20%s',_0x16baeb);logger[_0x4917('0x64')](_0x4917('0x68'),_0x274182);try{fs[_0x4917('0x69')](_0x16baeb,parseInt(_0x4917('0x6a'),0x8));extract(_0x16baeb,{'dir':_0x274182},function(_0x4f5ffa){if(_0x4f5ffa){logger['error'](_0x4f5ffa);handleError(_0x4f5ffa,!![]);};var _0x212ed5=fs[_0x4917('0x6b')](_0x274182);if(_0x212ed5[_0x4917('0x3a')]>0x1){removeReferences(_0x16baeb,_0x274182);logger[_0x4917('0x2c')]('Invalid\x20plugin\x20structure');return _0x485a91(new Error(_0x4917('0x6c')));}var _0x164f3e=fs[_0x4917('0x6d')](path['join'](_0x274182,_0x212ed5[0x0]));if(_0x164f3e[_0x4917('0x6e')]()){removeReferences(_0x16baeb,_0x274182);logger[_0x4917('0x2c')](_0x4917('0x6c'));return _0x485a91(new Error('Invalid\x20plugin\x20structure'));}if(_0x164f3e[_0x4917('0x6f')]()){var _0x4ecab5=fs['readdirSync'](path['join'](_0x274182,_0x212ed5[0x0]));if(_0x4ecab5[_0x4917('0x3a')]===0x0){removeReferences(_0x16baeb,_0x274182);logger[_0x4917('0x2c')](_0x4917('0x6c'));return _0x485a91(new Error(_0x4917('0x6c')));}var _0x4544a3=_0x4ecab5[_0x4917('0x70')](function(_0x33a2b3){return _0x33a2b3==='manifest.json';});if(!_0x4544a3){return _0x485a91(new Error(_0x4917('0x71')));}var _0x36ea1e=fs[_0x4917('0x72')](path[_0x4917('0x5a')](_0x274182,_0x212ed5[0x0],'manifest.json'));var _0x36b07c=JSON[_0x4917('0x73')](_0x36ea1e);if(_0x4917('0x74')==typeof _0x36b07c[_0x4917('0x2e')]){return _0x485a91(new Error(_0x4917('0x75')));}if(_0x4917('0x74')==typeof _0x36b07c[_0x4917('0x76')]){return _0x485a91(new Error('Invalid\x20manifest:\x20type\x20missing'));}if('undefined'==typeof _0x36b07c[_0x4917('0x77')]){return _0x485a91(new Error(_0x4917('0x78')));}if(_0x4917('0x74')==typeof _0x36b07c[_0x4917('0x79')]){return _0x485a91(new Error(_0x4917('0x7a')));}if(_0x36b07c[_0x4917('0x76')]===_0x4917('0x7b')){if(_0x4917('0x74')==typeof _0x36b07c[_0x4917('0x79')]['views']){return _0x485a91(new Error('Invalid\x20manifest:\x20views\x20missing'));}if(_0x4917('0x74')==typeof _0x36b07c['parameters'][_0x4917('0x7c')][_0x4917('0x7d')]&&'undefined'==typeof _0x36b07c[_0x4917('0x79')][_0x4917('0x7c')][_0x4917('0x7e')]){return _0x485a91(new Error(_0x4917('0x7f')));}}else if(_0x36b07c[_0x4917('0x76')]==='script'){if(_0x4917('0x74')==typeof _0x36b07c[_0x4917('0x79')]['scriptName']){return _0x485a91(new Error('Invalid\x20manifest:\x20script\x20name\x20missing'));}if(_0x4917('0x74')==typeof _0x36b07c[_0x4917('0x79')][_0x4917('0x80')]){return _0x485a91(new Error(_0x4917('0x81')));}}else{return _0x485a91(new Error(_0x4917('0x82')));}var _0x470ac0=_0x36b07c[_0x4917('0x2e')];var _0x4a9518=_0x36b07c[_0x4917('0x83')];var _0xb1085e=_0x36b07c['type'];var _0x4a1bf1=_0x36b07c[_0x4917('0x84')]?_0x36b07c[_0x4917('0x84')]:_0x4917('0x85');var _0x3f6074=_0x36b07c[_0x4917('0x86')]?_0x36b07c[_0x4917('0x86')]:_0x4917('0x87');var _0x5b011d='';var _0x21d81d='';var _0x2cd60a='';var _0x25da6f='';var _0x4a30fb=_0x36b07c['version'];if(_0xb1085e===_0x4917('0x7b')){if(_0x4917('0x74')!=typeof _0x36b07c[_0x4917('0x79')][_0x4917('0x7c')][_0x4917('0x7d')]){var _0x59d75f=_0x36b07c[_0x4917('0x79')][_0x4917('0x7c')][_0x4917('0x7d')];if(!/^(f|ht)tps?:\/\//i[_0x4917('0x88')](_0x59d75f)){_0x5b011d=path[_0x4917('0x5a')](_0x4917('0x89'),_0x3fa7a0,_0x212ed5[0x0],_0x59d75f);}else{_0x5b011d=_0x59d75f;}}else{logger[_0x4917('0x64')]('Warning:\x20admin\x20view\x20not\x20specified');}if(_0x4917('0x74')!=typeof _0x36b07c['parameters']['views'][_0x4917('0x7e')]){var _0x58d3aa=_0x36b07c['parameters'][_0x4917('0x7c')]['agent'];if(!/^(f|ht)tps?:\/\//i[_0x4917('0x88')](_0x58d3aa)){_0x21d81d=path[_0x4917('0x5a')](_0x4917('0x89'),_0x3fa7a0,_0x212ed5[0x0],_0x58d3aa);}else{_0x21d81d=_0x58d3aa;}}else{logger[_0x4917('0x64')](_0x4917('0x8a'));}}else if(_0xb1085e==='script'){_0x2cd60a=_0x36b07c[_0x4917('0x79')][_0x4917('0x8b')];_0x25da6f=_0x36b07c[_0x4917('0x79')][_0x4917('0x80')];if(_0x4917('0x74')!=typeof _0x36b07c[_0x4917('0x79')]['views']){if(_0x4917('0x74')!=typeof _0x36b07c[_0x4917('0x79')][_0x4917('0x7c')][_0x4917('0x7d')]){var _0x59d75f=_0x36b07c[_0x4917('0x79')][_0x4917('0x7c')]['admin'];if(!/^(f|ht)tps?:\/\//i[_0x4917('0x88')](_0x59d75f)){_0x5b011d=path[_0x4917('0x5a')](_0x4917('0x89'),_0x3fa7a0,_0x212ed5[0x0],_0x59d75f);}else{_0x5b011d=_0x59d75f;}}if(_0x4917('0x74')!=typeof _0x36b07c['parameters'][_0x4917('0x7c')]['agent']){var _0x58d3aa=_0x36b07c[_0x4917('0x79')][_0x4917('0x7c')][_0x4917('0x7e')];if(!/^(f|ht)tps?:\/\//i['test'](_0x58d3aa)){_0x21d81d=path[_0x4917('0x5a')](_0x4917('0x89'),_0x3fa7a0,_0x212ed5[0x0],_0x58d3aa);}else{_0x21d81d=_0x58d3aa;}}}}var _0x1e3187={'name':_0x470ac0,'description':_0x4a9518,'path':path[_0x4917('0x5a')](_0x3fa7a0,_0x212ed5[0x0]),'type':_0xb1085e,'sidebar':_0x4a1bf1,'icon':_0x3f6074,'adminUrl':_0x5b011d,'agentUrl':_0x21d81d,'scriptName':_0x2cd60a,'scriptPath':_0x25da6f,'version':_0x4a30fb};removeReferences(_0x16baeb,null);return db[_0x4917('0x30')][_0x4917('0x8c')](_0x1e3187)['then'](function(_0x1b7d97){var _0x497139={'role':_0x53af0f['body'][_0x4917('0x8d')],'userProfileId':_0x53af0f['body']['userProfileId']};if(!_0x497139)throw new Error(_0x4917('0x8e'));if(_0x497139[_0x4917('0x8d')]==='user'){var _0x98f311=_0x1b7d97[_0x4917('0x2a')]({'plain':!![]});return db['UserProfileSection'][_0x4917('0x4b')]({'where':{'name':_0x4917('0x8f'),'userProfileId':_0x497139['userProfileId']},'raw':!![]})[_0x4917('0x29')](function(_0x473d1c){if(_0x473d1c&&_0x473d1c[_0x4917('0x90')]===0x0){return db['UserProfileResource']['create']({'name':_0x98f311[_0x4917('0x2e')],'resourceId':_0x98f311['id'],'type':_0x473d1c[_0x4917('0x2e')],'sectionId':_0x473d1c['id']},{})[_0x4917('0x29')](function(){return _0x1b7d97;});}else{return _0x1b7d97;}})[_0x4917('0x44')](function(_0x4e9634){logger['error'](_0x4917('0x91'),_0x4e9634);throw _0x4e9634;});}return _0x1b7d97;})[_0x4917('0x29')](respondWithResult(_0x502999,null))[_0x4917('0x44')](handleError(_0x502999,null));}});}catch(_0x24bdba){_0x502999['status'](0x1f4)[_0x4917('0x2f')](_0x24bdba);}};function removeReferences(_0x58bf7b,_0x35b49d){try{if(_0x58bf7b){fs[_0x4917('0x63')](_0x58bf7b);logger[_0x4917('0x64')](_0x4917('0x92'));}if(_0x35b49d){rimraf(_0x35b49d,function(){});logger[_0x4917('0x64')]('Extracted\x20folder\x20removed');}}catch(_0x20e01c){logger[_0x4917('0x2c')](_0x20e01c);}}exports['update']=function(_0x1b0fd7,_0x5f24f6,_0x4de241){return db['Plugin'][_0x4917('0x4b')]({'where':{'id':_0x1b0fd7['params']['id']}})['then'](handleEntityNotFound(_0x5f24f6,null))[_0x4917('0x29')](saveUpdates(_0x1b0fd7[_0x4917('0x93')],null))['then'](respondWithResult(_0x5f24f6,null))['catch'](handleError(_0x5f24f6,null));};exports[_0x4917('0x94')]=function(_0x655b89,_0x234bb4,_0x29f014){return db[_0x4917('0x30')][_0x4917('0x4b')]({'where':{'id':_0x655b89[_0x4917('0x46')]['id']}})['then'](function(_0xd4e897){if(_0xd4e897){return _0xd4e897[_0x4917('0x95')]();}})[_0x4917('0x29')](function(_0x517d65){rimraf(path[_0x4917('0x5a')](config[_0x4917('0x4d')],_0x4917('0x4e'),path[_0x4917('0x5b')](_0x517d65['path'])),function(){});return _0x517d65;})['then'](handleEntityNotFound(_0x234bb4,null))[_0x4917('0x29')](respondWithStatusCode(_0x234bb4,null))[_0x4917('0x44')](handleError(_0x234bb4,null));};exports[_0x4917('0x96')]=function(_0x181aa0,_0x4c22d5,_0x311016){return BPromise[_0x4917('0x97')]()[_0x4917('0x29')](function(){if(!_0x181aa0['query'][_0x4917('0x7')]){throw new Error(_0x4917('0x98'));}if(!_0x181aa0[_0x4917('0x39')][_0x4917('0x99')]){throw new Error(_0x4917('0x9a'));}var _0x56e785=_0x181aa0[_0x4917('0x39')][_0x4917('0x9b')]?_0x181aa0[_0x4917('0x39')][_0x4917('0x9b')]+':'+_0x181aa0[_0x4917('0x39')][_0x4917('0x99')]:_0x4917('0x9c')+_0x181aa0['query'][_0x4917('0x99')];var _0x14ceab=_0x181aa0[_0x4917('0x39')][_0x4917('0x22')]?_0x181aa0[_0x4917('0x39')]['json']:!![];var _0x4c9dcc=_0x181aa0[_0x4917('0x39')][_0x4917('0x9d')]?_0x181aa0[_0x4917('0x39')][_0x4917('0x9d')]:null;var _0x3ac8a1={'method':_0x181aa0[_0x4917('0x9e')],'uri':util[_0x4917('0x61')]('%s%s',_0x56e785,_0x181aa0[_0x4917('0x39')][_0x4917('0x7')]),'json':_0x14ceab,'resolveWithFullResponse':!![],'encoding':_0x4c9dcc,'qs':_0x181aa0['query']};if(_0x181aa0[_0x4917('0x9f')]){_0x3ac8a1[_0x4917('0x9f')]=_0x181aa0[_0x4917('0x9f')];if(_0x3ac8a1[_0x4917('0x9f')][_0x4917('0xa0')]){delete _0x3ac8a1[_0x4917('0x9f')][_0x4917('0xa0')];}}if(_0x3ac8a1[_0x4917('0x9f')]['content-type']){delete _0x3ac8a1[_0x4917('0x9f')][_0x4917('0xa1')];}return rp(_0x3ac8a1);})[_0x4917('0x29')](function(_0x473843){if(_0x473843){_0x4c22d5['set'](_0x473843[_0x4917('0x9f')]);logger[_0x4917('0x64')](_0x473843[_0x4917('0x93')]);if(_[_0x4917('0xa2')](_0x181aa0[_0x4917('0x39')][_0x4917('0x7')],_0x4917('0x4c'))&&_0x473843[_0x4917('0xa3')]==0x1f4){return _0x4c22d5[_0x4917('0x1f')](_0x473843['statusCode']);}else{return _0x4c22d5[_0x4917('0x21')](_0x473843['statusCode'])[_0x4917('0x2f')](_0x473843['body']);}}else{return _0x4c22d5[_0x4917('0x1f')](0xc8);}})[_0x4917('0x44')](handleError(_0x4c22d5,null));};exports[_0x4917('0xa4')]=function(_0x4ca69d,_0x45580c,_0x45e866){return BPromise[_0x4917('0x97')]()[_0x4917('0x29')](function(){if(!_0x4ca69d[_0x4917('0x39')][_0x4917('0x7')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x4ca69d[_0x4917('0x39')][_0x4917('0x99')]){throw new Error(_0x4917('0x9a'));}var _0x1a3559=_0x4ca69d[_0x4917('0x39')][_0x4917('0x9b')]?_0x4ca69d[_0x4917('0x39')]['hostname']+':'+_0x4ca69d[_0x4917('0x39')][_0x4917('0x99')]:'http://localhost:'+_0x4ca69d[_0x4917('0x39')][_0x4917('0x99')];var _0x453ee1=_0x4ca69d[_0x4917('0x39')][_0x4917('0x22')]?_0x4ca69d[_0x4917('0x39')][_0x4917('0x22')]:!![];var _0x56595b=_0x4ca69d[_0x4917('0x39')][_0x4917('0x9d')]?_0x4ca69d[_0x4917('0x39')][_0x4917('0x9d')]:null;var _0x518bc8={'method':_0x4ca69d[_0x4917('0x9e')],'uri':util[_0x4917('0x61')](_0x4917('0xa5'),_0x1a3559,_0x4ca69d[_0x4917('0x39')][_0x4917('0x7')]),'json':_0x453ee1,'resolveWithFullResponse':!![],'encoding':_0x56595b,'body':_0x4ca69d['body']};if(_0x4ca69d[_0x4917('0x9f')]){_0x518bc8[_0x4917('0x9f')]=_0x4ca69d[_0x4917('0x9f')];if(_0x518bc8[_0x4917('0x9f')][_0x4917('0xa0')]){delete _0x518bc8[_0x4917('0x9f')][_0x4917('0xa0')];}}if(_0x518bc8[_0x4917('0x9f')][_0x4917('0xa1')]){delete _0x518bc8[_0x4917('0x9f')]['content-type'];}return rp(_0x518bc8);})[_0x4917('0x29')](function(_0x424b46){if(_0x424b46){_0x45580c[_0x4917('0x26')](_0x424b46['headers']);logger[_0x4917('0x64')](_0x424b46['body']);return _0x45580c[_0x4917('0x21')](_0x424b46[_0x4917('0xa3')])[_0x4917('0x2f')](_0x424b46['body']);}else{return _0x45580c[_0x4917('0x1f')](0xc8);}})[_0x4917('0x44')](handleError(_0x45580c,null));}; \ No newline at end of file +var _0x10bb=['method','html-pdf','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','extract-zip','rimraf','archiver','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./plugin.socket','register','sendStatus','status','set','Content-Range','json','apply','reject','save','update','then','destroy','Plugins','UserProfileResource','end','error','name','send','index','map','Plugin','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','nolimit','limit','offset','order','sort','where','filter','VIRTUAL','merge','options','count','includeAll','include','findAll','rows','catch','show','params','keys','find','download','path','join','server/files/plugins','format','basename','createWriteStream','zip','warning','code','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','**/*','dirname','node_modules/**/*','attachments/**/*','finalize','existsSync','Plugin\x20not\x20found','%s.zip','unlinkSync','Temporary\x20file\x20removed','upload','file','filename','root','info','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','undefined','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','views','Invalid\x20manifest:\x20views\x20missing','Invalid\x20manifest:\x20no\x20view\x20specified','script','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','icon-apps','html','admin','plugins','agent','test','Warning:\x20agent\x20view\x20not\x20specified','scriptName','create','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','get','UserProfileSection','autoAssociation','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','delete','webhookGet','resolve','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','encoding','%s%s','headers','content-length','content-type','endsWith','statusCode','webhookPost','\x27PATH\x27\x20parameter\x20not\x20specified','http://localhost:'];(function(_0x4ef24e,_0x265500){var _0xd08163=function(_0x35ea42){while(--_0x35ea42){_0x4ef24e['push'](_0x4ef24e['shift']());}};_0xd08163(++_0x265500);}(_0x10bb,0x167));var _0xb10b=function(_0x353491,_0x2764b3){_0x353491=_0x353491-0x0;var _0x52782d=_0x10bb[_0x353491];return _0x52782d;};'use strict';var pdf=require(_0xb10b('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xb10b('0x1'));var rp=require(_0xb10b('0x2'));var moment=require(_0xb10b('0x3'));var BPromise=require(_0xb10b('0x4'));var Mustache=require(_0xb10b('0x5'));var util=require('util');var path=require('path');var sox=require(_0xb10b('0x6'));var csv=require('to-csv');var ejs=require(_0xb10b('0x7'));var fs=require('fs');var _=require(_0xb10b('0x8'));var squel=require(_0xb10b('0x9'));var crypto=require(_0xb10b('0xa'));var jsforce=require(_0xb10b('0xb'));var deskjs=require(_0xb10b('0xc'));var toCsv=require(_0xb10b('0xd'));var querystring=require('querystring');var Papa=require(_0xb10b('0xe'));var extract=require(_0xb10b('0xf'));var rimraf=require(_0xb10b('0x10'));var archiver=require(_0xb10b('0x11'));var Redis=require(_0xb10b('0x12'));var authService=require(_0xb10b('0x13'));var qs=require(_0xb10b('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xb10b('0x15'))(_0xb10b('0x16'));var utils=require(_0xb10b('0x17'));var config=require(_0xb10b('0x18'));var db=require(_0xb10b('0x19'))['db'];config['redis']=_['defaults'](config[_0xb10b('0x1a')],{'host':_0xb10b('0x1b'),'port':0x18eb});var socket=require(_0xb10b('0x1c'))(new Redis(config[_0xb10b('0x1a')]));require(_0xb10b('0x1d'))[_0xb10b('0x1e')](socket);function respondWithStatusCode(_0x4d2fe0,_0x17e63d){_0x17e63d=_0x17e63d||0xcc;return function(_0x1b1896){if(_0x1b1896){return _0x4d2fe0[_0xb10b('0x1f')](_0x17e63d);}return _0x4d2fe0[_0xb10b('0x20')](_0x17e63d)['end']();};}function respondWithResult(_0x434f0f,_0x3dd235){_0x3dd235=_0x3dd235||0xc8;return function(_0x13b96e){if(_0x13b96e){return _0x434f0f[_0xb10b('0x20')](_0x3dd235)['json'](_0x13b96e);}};}function respondWithFilteredResult(_0x2683e9,_0xaca66){return function(_0x20e19a){if(_0x20e19a){var _0x49c046=_0x20e19a['count'],_0x4520f1=_0xaca66['offset'],_0x3bf38b=_0xaca66['offset']+_0xaca66['limit'],_0x2378a4;if(_0x3bf38b>=_0x49c046){_0x3bf38b=_0x49c046;_0x2378a4=0xc8;}else{_0x2378a4=0xce;}_0x2683e9[_0xb10b('0x20')](_0x2378a4);return _0x2683e9[_0xb10b('0x21')](_0xb10b('0x22'),_0x4520f1+'-'+_0x3bf38b+'/'+_0x49c046)[_0xb10b('0x23')](_0x20e19a);}return null;};}function patchUpdates(_0x2e33a4){return function(_0x16d83c){try{jsonpatch[_0xb10b('0x24')](_0x16d83c,_0x2e33a4,!![]);}catch(_0x5c4578){return BPromise[_0xb10b('0x25')](_0x5c4578);}return _0x16d83c[_0xb10b('0x26')]();};}function saveUpdates(_0x475d65,_0x3e6ec1){return function(_0x263136){if(_0x263136){return _0x263136[_0xb10b('0x27')](_0x475d65)[_0xb10b('0x28')](function(_0xcdcac6){return _0xcdcac6;});}return null;};}function removeEntity(_0x517a33,_0x16be17){return function(_0x512321){if(_0x512321){return _0x512321[_0xb10b('0x29')]()[_0xb10b('0x28')](function(){var _0x45c180=_0x512321['get']({'plain':!![]});var _0x1a220e=_0xb10b('0x2a');return db[_0xb10b('0x2b')][_0xb10b('0x29')]({'where':{'type':_0x1a220e,'resourceId':_0x45c180['id']}})[_0xb10b('0x28')](function(){return _0x512321;});})[_0xb10b('0x28')](function(){_0x517a33[_0xb10b('0x20')](0xcc)[_0xb10b('0x2c')]();});}};}function handleEntityNotFound(_0x4f7414,_0x1e98bf){return function(_0x58a38c){if(!_0x58a38c){_0x4f7414[_0xb10b('0x1f')](0x194);}return _0x58a38c;};}function handleError(_0x5a669b,_0x5cabd1){_0x5cabd1=_0x5cabd1||0x1f4;return function(_0x4583b7){logger[_0xb10b('0x2d')](_0x4583b7['stack']);if(_0x4583b7[_0xb10b('0x2e')]){delete _0x4583b7[_0xb10b('0x2e')];}_0x5a669b[_0xb10b('0x20')](_0x5cabd1)[_0xb10b('0x2f')](_0x4583b7);};}exports[_0xb10b('0x30')]=function(_0x3c6c17,_0x258365){var _0x52d99f={},_0xebf5b9={},_0x53da16={'count':0x0,'rows':[]};var _0x34261a=_[_0xb10b('0x31')](db[_0xb10b('0x32')][_0xb10b('0x33')],function(_0x480bb6){return{'name':_0x480bb6[_0xb10b('0x34')],'type':_0x480bb6[_0xb10b('0x35')][_0xb10b('0x36')]};});_0xebf5b9[_0xb10b('0x37')]=_[_0xb10b('0x31')](_0x34261a,_0xb10b('0x2e'));_0xebf5b9[_0xb10b('0x38')]=_['keys'](_0x3c6c17['query']);_0xebf5b9[_0xb10b('0x39')]=_[_0xb10b('0x3a')](_0xebf5b9[_0xb10b('0x37')],_0xebf5b9[_0xb10b('0x38')]);_0x52d99f['attributes']=_[_0xb10b('0x3a')](_0xebf5b9[_0xb10b('0x37')],qs[_0xb10b('0x3b')](_0x3c6c17[_0xb10b('0x38')]['fields']));_0x52d99f['attributes']=_0x52d99f[_0xb10b('0x3c')][_0xb10b('0x3d')]?_0x52d99f[_0xb10b('0x3c')]:_0xebf5b9['model'];if(!_0x3c6c17[_0xb10b('0x38')]['hasOwnProperty'](_0xb10b('0x3e'))){_0x52d99f['limit']=qs[_0xb10b('0x3f')](_0x3c6c17['query'][_0xb10b('0x3f')]);_0x52d99f[_0xb10b('0x40')]=qs[_0xb10b('0x40')](_0x3c6c17[_0xb10b('0x38')][_0xb10b('0x40')]);}_0x52d99f[_0xb10b('0x41')]=qs[_0xb10b('0x42')](_0x3c6c17[_0xb10b('0x38')]['sort']);_0x52d99f[_0xb10b('0x43')]=qs[_0xb10b('0x39')](_['pick'](_0x3c6c17[_0xb10b('0x38')],_0xebf5b9['filters']));if(_0x3c6c17[_0xb10b('0x38')][_0xb10b('0x44')]){_0x52d99f[_0xb10b('0x43')]=_['merge'](_0x52d99f[_0xb10b('0x43')],{'$or':_[_0xb10b('0x31')](_0x34261a,function(_0x5acf75){if(_0x5acf75['type']!==_0xb10b('0x45')){var _0x12af8f={};_0x12af8f[_0x5acf75[_0xb10b('0x2e')]]={'$like':'%'+_0x3c6c17['query'][_0xb10b('0x44')]+'%'};return _0x12af8f;}})});}_0x52d99f=_[_0xb10b('0x46')]({},_0x52d99f,_0x3c6c17[_0xb10b('0x47')]);var _0x521be7={'where':_0x52d99f[_0xb10b('0x43')]};return db[_0xb10b('0x32')][_0xb10b('0x48')](_0x521be7)[_0xb10b('0x28')](function(_0x269fa1){_0x53da16['count']=_0x269fa1;if(_0x3c6c17[_0xb10b('0x38')][_0xb10b('0x49')]){_0x52d99f[_0xb10b('0x4a')]=[{'all':!![]}];}return db['Plugin'][_0xb10b('0x4b')](_0x52d99f);})['then'](function(_0x5e4687){_0x53da16[_0xb10b('0x4c')]=_0x5e4687;return _0x53da16;})[_0xb10b('0x28')](respondWithFilteredResult(_0x258365,_0x52d99f))[_0xb10b('0x4d')](handleError(_0x258365,null));};exports[_0xb10b('0x4e')]=function(_0x5ea150,_0x9179ee){var _0x484fed={'raw':!![],'where':{'id':_0x5ea150[_0xb10b('0x4f')]['id']}},_0xcc4252={};_0xcc4252['model']=_[_0xb10b('0x50')](db['Plugin'][_0xb10b('0x33')]);_0xcc4252[_0xb10b('0x38')]=_[_0xb10b('0x50')](_0x5ea150[_0xb10b('0x38')]);_0xcc4252[_0xb10b('0x39')]=_[_0xb10b('0x3a')](_0xcc4252[_0xb10b('0x37')],_0xcc4252[_0xb10b('0x38')]);_0x484fed[_0xb10b('0x3c')]=_['intersection'](_0xcc4252[_0xb10b('0x37')],qs[_0xb10b('0x3b')](_0x5ea150[_0xb10b('0x38')]['fields']));_0x484fed[_0xb10b('0x3c')]=_0x484fed[_0xb10b('0x3c')]['length']?_0x484fed[_0xb10b('0x3c')]:_0xcc4252[_0xb10b('0x37')];if(_0x5ea150['query']['includeAll']){_0x484fed[_0xb10b('0x4a')]=[{'all':!![]}];}_0x484fed=_[_0xb10b('0x46')]({},_0x484fed,_0x5ea150[_0xb10b('0x47')]);return db[_0xb10b('0x32')][_0xb10b('0x51')](_0x484fed)[_0xb10b('0x28')](handleEntityNotFound(_0x9179ee,null))[_0xb10b('0x28')](respondWithResult(_0x9179ee,null))['catch'](handleError(_0x9179ee,null));};exports[_0xb10b('0x52')]=function(_0xe74ec7,_0x3684c9,_0x22c07a){return db[_0xb10b('0x32')][_0xb10b('0x51')]({'where':{'id':_0xe74ec7[_0xb10b('0x4f')]['id']},'attributes':['name',_0xb10b('0x53')],'raw':!![]})[_0xb10b('0x28')](handleEntityNotFound(_0x3684c9,null))[_0xb10b('0x28')](function(_0x57b558){if(_0x57b558){var _0x1b3214=path[_0xb10b('0x54')](config['root'],_0xb10b('0x55'),util[_0xb10b('0x56')]('%s.zip',path[_0xb10b('0x57')](_0x57b558[_0xb10b('0x53')])));var _0x2f182a=fs[_0xb10b('0x58')](_0x1b3214);var _0x40b4c7=archiver(_0xb10b('0x59'),{'zlib':{'level':0x9}});_0x40b4c7['on'](_0xb10b('0x5a'),function(_0x12554c){if(_0x12554c[_0xb10b('0x5b')]===_0xb10b('0x5c')){logger[_0xb10b('0x2d')](_0x12554c);}else{throw new db[(_0xb10b('0x5d'))][(_0xb10b('0x5e'))](_0xb10b('0x5f'));}});_0x40b4c7['on'](_0xb10b('0x2d'),function(_0x1eb490){throw new db[(_0xb10b('0x5d'))][(_0xb10b('0x5e'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');});_0x40b4c7[_0xb10b('0x60')](_0x2f182a);_0x40b4c7[_0xb10b('0x61')](_0xb10b('0x62'),{'cwd':path[_0xb10b('0x54')](config['root'],_0xb10b('0x55'),path[_0xb10b('0x63')](_0x57b558['path'])),'ignore':[path[_0xb10b('0x54')](path['basename'](_0x57b558['path']),_0xb10b('0x64')),path[_0xb10b('0x54')](path[_0xb10b('0x57')](_0x57b558[_0xb10b('0x53')]),_0xb10b('0x65'))],'nodir':!![]})[_0xb10b('0x66')]();_0x2f182a['on']('close',function(){if(!fs[_0xb10b('0x67')](_0x1b3214)){throw new db['Sequelize'][(_0xb10b('0x5e'))](_0xb10b('0x68'));}return _0x3684c9[_0xb10b('0x52')](_0x1b3214,util['format'](_0xb10b('0x69'),path[_0xb10b('0x57')](_0x57b558[_0xb10b('0x53')])),function(_0x3e8adc){if(_0x3e8adc){throw new db[(_0xb10b('0x5d'))][(_0xb10b('0x5e'))]('Error\x20while\x20downloading\x20the\x20plugin');}fs[_0xb10b('0x6a')](_0x1b3214);logger['info']('Download\x20completed');logger['info'](_0xb10b('0x6b'));});});}return null;})[_0xb10b('0x4d')](handleError(_0x3684c9,null));};exports[_0xb10b('0x6c')]=function(_0x5e0b24,_0xdb8a5a,_0x5c4160){var _0xec8ef6=path['basename'](_0x5e0b24[_0xb10b('0x6d')][_0xb10b('0x6e')],path['extname'](_0x5e0b24['file'][_0xb10b('0x6e')]));var _0x1f5bb2=path[_0xb10b('0x54')](config[_0xb10b('0x6f')],_0xb10b('0x55'),_0x5e0b24[_0xb10b('0x6d')][_0xb10b('0x6e')]);var _0x41993=path['join'](config[_0xb10b('0x6f')],_0xb10b('0x55'),_0xec8ef6);logger[_0xb10b('0x70')](_0xb10b('0x71'),_0x1f5bb2);logger[_0xb10b('0x70')](_0xb10b('0x72'),_0x41993);try{fs[_0xb10b('0x73')](_0x1f5bb2,parseInt('0777',0x8));extract(_0x1f5bb2,{'dir':_0x41993},function(_0x18a8de){if(_0x18a8de){logger[_0xb10b('0x2d')](_0x18a8de);handleError(_0x18a8de,!![]);};var _0x30a674=fs[_0xb10b('0x74')](_0x41993);if(_0x30a674[_0xb10b('0x3d')]>0x1){removeReferences(_0x1f5bb2,_0x41993);logger[_0xb10b('0x2d')](_0xb10b('0x75'));return _0x5c4160(new Error(_0xb10b('0x75')));}var _0x46b9e2=fs[_0xb10b('0x76')](path[_0xb10b('0x54')](_0x41993,_0x30a674[0x0]));if(_0x46b9e2[_0xb10b('0x77')]()){removeReferences(_0x1f5bb2,_0x41993);logger[_0xb10b('0x2d')](_0xb10b('0x75'));return _0x5c4160(new Error(_0xb10b('0x75')));}if(_0x46b9e2[_0xb10b('0x78')]()){var _0x5a18e0=fs[_0xb10b('0x74')](path[_0xb10b('0x54')](_0x41993,_0x30a674[0x0]));if(_0x5a18e0[_0xb10b('0x3d')]===0x0){removeReferences(_0x1f5bb2,_0x41993);logger[_0xb10b('0x2d')](_0xb10b('0x75'));return _0x5c4160(new Error(_0xb10b('0x75')));}var _0x162580=_0x5a18e0[_0xb10b('0x79')](function(_0x1fc1dc){return _0x1fc1dc===_0xb10b('0x7a');});if(!_0x162580){return _0x5c4160(new Error(_0xb10b('0x7b')));}var _0x3916f0=fs[_0xb10b('0x7c')](path['join'](_0x41993,_0x30a674[0x0],_0xb10b('0x7a')));var _0x1981d9=JSON['parse'](_0x3916f0);if(_0xb10b('0x7d')==typeof _0x1981d9[_0xb10b('0x2e')]){return _0x5c4160(new Error(_0xb10b('0x7e')));}if(_0xb10b('0x7d')==typeof _0x1981d9[_0xb10b('0x35')]){return _0x5c4160(new Error(_0xb10b('0x7f')));}if(_0xb10b('0x7d')==typeof _0x1981d9[_0xb10b('0x80')]){return _0x5c4160(new Error(_0xb10b('0x81')));}if('undefined'==typeof _0x1981d9[_0xb10b('0x82')]){return _0x5c4160(new Error('Invalid\x20manifest:\x20parameters\x20missing'));}if(_0x1981d9[_0xb10b('0x35')]==='html'){if(_0xb10b('0x7d')==typeof _0x1981d9['parameters'][_0xb10b('0x83')]){return _0x5c4160(new Error(_0xb10b('0x84')));}if('undefined'==typeof _0x1981d9['parameters'][_0xb10b('0x83')]['admin']&&_0xb10b('0x7d')==typeof _0x1981d9[_0xb10b('0x82')]['views']['agent']){return _0x5c4160(new Error(_0xb10b('0x85')));}}else if(_0x1981d9[_0xb10b('0x35')]===_0xb10b('0x86')){if(_0xb10b('0x7d')==typeof _0x1981d9[_0xb10b('0x82')]['scriptName']){return _0x5c4160(new Error(_0xb10b('0x87')));}if(_0xb10b('0x7d')==typeof _0x1981d9['parameters'][_0xb10b('0x88')]){return _0x5c4160(new Error(_0xb10b('0x89')));}}else{return _0x5c4160(new Error(_0xb10b('0x8a')));}var _0x113f86=_0x1981d9['name'];var _0x81b387=_0x1981d9[_0xb10b('0x8b')];var _0x278b63=_0x1981d9[_0xb10b('0x35')];var _0x26e123=_0x1981d9[_0xb10b('0x8c')]?_0x1981d9[_0xb10b('0x8c')]:_0xb10b('0x8d');var _0x3f6448=_0x1981d9[_0xb10b('0x8e')]?_0x1981d9[_0xb10b('0x8e')]:_0xb10b('0x8f');var _0x556e25='';var _0x3dfc43='';var _0x336328='';var _0x1c031f='';var _0x554417=_0x1981d9[_0xb10b('0x80')];if(_0x278b63===_0xb10b('0x90')){if(_0xb10b('0x7d')!=typeof _0x1981d9['parameters'][_0xb10b('0x83')][_0xb10b('0x91')]){var _0x50598f=_0x1981d9[_0xb10b('0x82')][_0xb10b('0x83')][_0xb10b('0x91')];if(!/^(f|ht)tps?:\/\//i['test'](_0x50598f)){_0x556e25=path[_0xb10b('0x54')](_0xb10b('0x92'),_0xec8ef6,_0x30a674[0x0],_0x50598f);}else{_0x556e25=_0x50598f;}}else{logger[_0xb10b('0x70')]('Warning:\x20admin\x20view\x20not\x20specified');}if(_0xb10b('0x7d')!=typeof _0x1981d9[_0xb10b('0x82')]['views'][_0xb10b('0x93')]){var _0x3f3c30=_0x1981d9[_0xb10b('0x82')][_0xb10b('0x83')][_0xb10b('0x93')];if(!/^(f|ht)tps?:\/\//i[_0xb10b('0x94')](_0x3f3c30)){_0x3dfc43=path[_0xb10b('0x54')]('plugins',_0xec8ef6,_0x30a674[0x0],_0x3f3c30);}else{_0x3dfc43=_0x3f3c30;}}else{logger[_0xb10b('0x70')](_0xb10b('0x95'));}}else if(_0x278b63===_0xb10b('0x86')){_0x336328=_0x1981d9['parameters'][_0xb10b('0x96')];_0x1c031f=_0x1981d9[_0xb10b('0x82')][_0xb10b('0x88')];if(_0xb10b('0x7d')!=typeof _0x1981d9[_0xb10b('0x82')][_0xb10b('0x83')]){if(_0xb10b('0x7d')!=typeof _0x1981d9[_0xb10b('0x82')]['views']['admin']){var _0x50598f=_0x1981d9[_0xb10b('0x82')]['views'][_0xb10b('0x91')];if(!/^(f|ht)tps?:\/\//i[_0xb10b('0x94')](_0x50598f)){_0x556e25=path[_0xb10b('0x54')](_0xb10b('0x92'),_0xec8ef6,_0x30a674[0x0],_0x50598f);}else{_0x556e25=_0x50598f;}}if(_0xb10b('0x7d')!=typeof _0x1981d9['parameters'][_0xb10b('0x83')][_0xb10b('0x93')]){var _0x3f3c30=_0x1981d9[_0xb10b('0x82')][_0xb10b('0x83')][_0xb10b('0x93')];if(!/^(f|ht)tps?:\/\//i[_0xb10b('0x94')](_0x3f3c30)){_0x3dfc43=path[_0xb10b('0x54')](_0xb10b('0x92'),_0xec8ef6,_0x30a674[0x0],_0x3f3c30);}else{_0x3dfc43=_0x3f3c30;}}}}var _0x14ab51={'name':_0x113f86,'description':_0x81b387,'path':path[_0xb10b('0x54')](_0xec8ef6,_0x30a674[0x0]),'type':_0x278b63,'sidebar':_0x26e123,'icon':_0x3f6448,'adminUrl':_0x556e25,'agentUrl':_0x3dfc43,'scriptName':_0x336328,'scriptPath':_0x1c031f,'version':_0x554417};removeReferences(_0x1f5bb2,null);return db[_0xb10b('0x32')][_0xb10b('0x97')](_0x14ab51)[_0xb10b('0x28')](function(_0x28927c){var _0x41ea3d={'role':_0x5e0b24[_0xb10b('0x98')]['role'],'userProfileId':_0x5e0b24[_0xb10b('0x98')][_0xb10b('0x99')]};if(!_0x41ea3d)throw new Error(_0xb10b('0x9a'));if(_0x41ea3d[_0xb10b('0x9b')]===_0xb10b('0x9c')){var _0x147198=_0x28927c[_0xb10b('0x9d')]({'plain':!![]});return db[_0xb10b('0x9e')]['find']({'where':{'name':_0xb10b('0x2a'),'userProfileId':_0x41ea3d[_0xb10b('0x99')]},'raw':!![]})[_0xb10b('0x28')](function(_0x461df6){if(_0x461df6&&_0x461df6[_0xb10b('0x9f')]===0x0){return db[_0xb10b('0x2b')][_0xb10b('0x97')]({'name':_0x147198[_0xb10b('0x2e')],'resourceId':_0x147198['id'],'type':_0x461df6[_0xb10b('0x2e')],'sectionId':_0x461df6['id']},{})[_0xb10b('0x28')](function(){return _0x28927c;});}else{return _0x28927c;}})['catch'](function(_0x268e3a){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x268e3a);throw _0x268e3a;});}return _0x28927c;})[_0xb10b('0x28')](respondWithResult(_0xdb8a5a,null))[_0xb10b('0x4d')](handleError(_0xdb8a5a,null));}});}catch(_0x4b36df){_0xdb8a5a['status'](0x1f4)[_0xb10b('0x2f')](_0x4b36df);}};function removeReferences(_0x485edc,_0x271cd3){try{if(_0x485edc){fs[_0xb10b('0x6a')](_0x485edc);logger[_0xb10b('0x70')](_0xb10b('0xa0'));}if(_0x271cd3){rimraf(_0x271cd3,function(){});logger[_0xb10b('0x70')](_0xb10b('0xa1'));}}catch(_0x28ffbc){logger[_0xb10b('0x2d')](_0x28ffbc);}}exports[_0xb10b('0x27')]=function(_0x29aaa8,_0x22d441,_0x3197fa){return db['Plugin'][_0xb10b('0x51')]({'where':{'id':_0x29aaa8['params']['id']}})[_0xb10b('0x28')](handleEntityNotFound(_0x22d441,null))[_0xb10b('0x28')](saveUpdates(_0x29aaa8[_0xb10b('0x98')],null))['then'](respondWithResult(_0x22d441,null))[_0xb10b('0x4d')](handleError(_0x22d441,null));};exports[_0xb10b('0xa2')]=function(_0x38ca07,_0x96cbf5,_0x31697d){return db['Plugin'][_0xb10b('0x51')]({'where':{'id':_0x38ca07[_0xb10b('0x4f')]['id']}})['then'](function(_0x4d49d3){if(_0x4d49d3){return _0x4d49d3[_0xb10b('0x29')]();}})[_0xb10b('0x28')](function(_0x18a734){rimraf(path[_0xb10b('0x54')](config[_0xb10b('0x6f')],'server/files/plugins',path[_0xb10b('0x63')](_0x18a734['path'])),function(){});return _0x18a734;})[_0xb10b('0x28')](handleEntityNotFound(_0x96cbf5,null))[_0xb10b('0x28')](respondWithStatusCode(_0x96cbf5,null))['catch'](handleError(_0x96cbf5,null));};exports[_0xb10b('0xa3')]=function(_0x4049a1,_0x4510ad,_0xd5a636){return BPromise[_0xb10b('0xa4')]()['then'](function(){if(!_0x4049a1[_0xb10b('0x38')][_0xb10b('0x53')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x4049a1[_0xb10b('0x38')][_0xb10b('0xa5')]){throw new Error(_0xb10b('0xa6'));}var _0x3d0f22=_0x4049a1[_0xb10b('0x38')]['hostname']?_0x4049a1['query'][_0xb10b('0xa7')]+':'+_0x4049a1[_0xb10b('0x38')]['port']:'http://localhost:'+_0x4049a1[_0xb10b('0x38')]['port'];var _0x37405f=_0x4049a1[_0xb10b('0x38')][_0xb10b('0x23')]?_0x4049a1[_0xb10b('0x38')][_0xb10b('0x23')]:!![];var _0x53574c=_0x4049a1[_0xb10b('0x38')][_0xb10b('0xa8')]?_0x4049a1[_0xb10b('0x38')]['encoding']:null;var _0xc53669={'method':_0x4049a1['method'],'uri':util[_0xb10b('0x56')](_0xb10b('0xa9'),_0x3d0f22,_0x4049a1[_0xb10b('0x38')][_0xb10b('0x53')]),'json':_0x37405f,'resolveWithFullResponse':!![],'encoding':_0x53574c,'qs':_0x4049a1[_0xb10b('0x38')]};if(_0x4049a1['headers']){_0xc53669[_0xb10b('0xaa')]=_0x4049a1['headers'];if(_0xc53669[_0xb10b('0xaa')][_0xb10b('0xab')]){delete _0xc53669[_0xb10b('0xaa')][_0xb10b('0xab')];}}if(_0xc53669[_0xb10b('0xaa')]['content-type']){delete _0xc53669[_0xb10b('0xaa')][_0xb10b('0xac')];}return rp(_0xc53669);})[_0xb10b('0x28')](function(_0x4ec829){if(_0x4ec829){_0x4510ad[_0xb10b('0x21')](_0x4ec829[_0xb10b('0xaa')]);logger[_0xb10b('0x70')](_0x4ec829[_0xb10b('0x98')]);if(_[_0xb10b('0xad')](_0x4049a1['query']['path'],'download')&&_0x4ec829[_0xb10b('0xae')]==0x1f4){return _0x4510ad['sendStatus'](_0x4ec829[_0xb10b('0xae')]);}else{return _0x4510ad[_0xb10b('0x20')](_0x4ec829[_0xb10b('0xae')])[_0xb10b('0x2f')](_0x4ec829[_0xb10b('0x98')]);}}else{return _0x4510ad[_0xb10b('0x1f')](0xc8);}})[_0xb10b('0x4d')](handleError(_0x4510ad,null));};exports[_0xb10b('0xaf')]=function(_0x56e2d3,_0x2e03ba,_0x356ea7){return BPromise[_0xb10b('0xa4')]()[_0xb10b('0x28')](function(){if(!_0x56e2d3['query'][_0xb10b('0x53')]){throw new Error(_0xb10b('0xb0'));}if(!_0x56e2d3[_0xb10b('0x38')][_0xb10b('0xa5')]){throw new Error(_0xb10b('0xa6'));}var _0x2de57e=_0x56e2d3['query'][_0xb10b('0xa7')]?_0x56e2d3['query'][_0xb10b('0xa7')]+':'+_0x56e2d3[_0xb10b('0x38')][_0xb10b('0xa5')]:_0xb10b('0xb1')+_0x56e2d3[_0xb10b('0x38')][_0xb10b('0xa5')];var _0x30e4c2=_0x56e2d3['query'][_0xb10b('0x23')]?_0x56e2d3[_0xb10b('0x38')]['json']:!![];var _0x45f834=_0x56e2d3[_0xb10b('0x38')][_0xb10b('0xa8')]?_0x56e2d3['query']['encoding']:null;var _0x5e2441={'method':_0x56e2d3[_0xb10b('0xb2')],'uri':util[_0xb10b('0x56')]('%s%s',_0x2de57e,_0x56e2d3['query'][_0xb10b('0x53')]),'json':_0x30e4c2,'resolveWithFullResponse':!![],'encoding':_0x45f834,'body':_0x56e2d3['body']};if(_0x56e2d3[_0xb10b('0xaa')]){_0x5e2441[_0xb10b('0xaa')]=_0x56e2d3['headers'];if(_0x5e2441[_0xb10b('0xaa')][_0xb10b('0xab')]){delete _0x5e2441[_0xb10b('0xaa')][_0xb10b('0xab')];}}if(_0x5e2441[_0xb10b('0xaa')]['content-type']){delete _0x5e2441['headers']['content-type'];}return rp(_0x5e2441);})['then'](function(_0x185fb2){if(_0x185fb2){_0x2e03ba[_0xb10b('0x21')](_0x185fb2[_0xb10b('0xaa')]);logger[_0xb10b('0x70')](_0x185fb2['body']);return _0x2e03ba[_0xb10b('0x20')](_0x185fb2['statusCode'])[_0xb10b('0x2f')](_0x185fb2[_0xb10b('0x98')]);}else{return _0x2e03ba[_0xb10b('0x1f')](0xc8);}})[_0xb10b('0x4d')](handleError(_0x2e03ba,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index e66fbb1..38eaad9 100644 --- a/server/api/plugin/plugin.events.js +++ b/server/api/plugin/plugin.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdf55=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save'];(function(_0x107b7a,_0x251df1){var _0x2917cd=function(_0x3e8996){while(--_0x3e8996){_0x107b7a['push'](_0x107b7a['shift']());}};_0x2917cd(++_0x251df1);}(_0xdf55,0x83));var _0x5df5=function(_0x283952,_0x442596){_0x283952=_0x283952-0x0;var _0x57bb99=_0xdf55[_0x283952];return _0x57bb99;};'use strict';var EventEmitter=require(_0x5df5('0x0'));var Plugin=require(_0x5df5('0x1'))['db']['Plugin'];var PluginEvents=new EventEmitter();PluginEvents[_0x5df5('0x2')](0x0);var events={'afterCreate':_0x5df5('0x3'),'afterUpdate':'update','afterDestroy':_0x5df5('0x4')};function emitEvent(_0x773e15){return function(_0x381a4c,_0x521007,_0x289af4){PluginEvents[_0x5df5('0x5')](_0x773e15+':'+_0x381a4c['id'],_0x381a4c);PluginEvents[_0x5df5('0x5')](_0x773e15,_0x381a4c);_0x289af4(null);};}for(var e in events){if(events[_0x5df5('0x6')](e)){var event=events[e];Plugin[_0x5df5('0x7')](e,emitEvent(event));}}module[_0x5df5('0x8')]=PluginEvents; \ No newline at end of file +var _0x3a6d=['../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3a6d,0x143));var _0xd3a6=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x3a6d[_0x19950b];return _0x3c6b41;};'use strict';var EventEmitter=require(_0xd3a6('0x0'));var Plugin=require(_0xd3a6('0x1'))['db']['Plugin'];var PluginEvents=new EventEmitter();PluginEvents[_0xd3a6('0x2')](0x0);var events={'afterCreate':_0xd3a6('0x3'),'afterUpdate':_0xd3a6('0x4'),'afterDestroy':_0xd3a6('0x5')};function emitEvent(_0x3d37ff){return function(_0x585473,_0x1cb966,_0x27d641){PluginEvents[_0xd3a6('0x6')](_0x3d37ff+':'+_0x585473['id'],_0x585473);PluginEvents[_0xd3a6('0x6')](_0x3d37ff,_0x585473);_0x27d641(null);};}for(var e in events){if(events[_0xd3a6('0x7')](e)){var event=events[e];Plugin[_0xd3a6('0x8')](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 f06ce6d..7b2bdd6 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 _0x4b84=['moment','path','rimraf','../../config/environment','Plugin','lodash','util'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x4b84,0x1cc));var _0x44b8=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0x4b84[_0x18ab2a];return _0x16dcee;};'use strict';var _=require(_0x44b8('0x0'));var util=require(_0x44b8('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x44b8('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x44b8('0x3'));var rimraf=require(_0x44b8('0x4'));var config=require(_0x44b8('0x5'));var attributes=require('./plugin.attributes');module['exports']=function(_0x55f25d,_0x996a8b){return _0x55f25d['define'](_0x44b8('0x6'),attributes,{'tableName':'plugins','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5c12=['./plugin.attributes','define','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0xb74774,_0x33681d){var _0x57e076=function(_0x138cae){while(--_0x138cae){_0xb74774['push'](_0xb74774['shift']());}};_0x57e076(++_0x33681d);}(_0x5c12,0x188));var _0x25c1=function(_0x11c573,_0x9e7c6e){_0x11c573=_0x11c573-0x0;var _0x6b72de=_0x5c12[_0x11c573];return _0x6b72de;};'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 fs=require('fs');var path=require(_0x25c1('0x5'));var rimraf=require(_0x25c1('0x6'));var config=require(_0x25c1('0x7'));var attributes=require(_0x25c1('0x8'));module['exports']=function(_0x204287,_0x42ac16){return _0x204287[_0x25c1('0x9')]('Plugin',attributes,{'tableName':'plugins','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.rpc.js b/server/api/plugin/plugin.rpc.js index 085ffb8..15e553c 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 _0xe083=['redis','socket.io-emitter','./plugin.socket','register','request','then','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','code','Plugin,\x20%s,\x20%s','message','info','result','catch','CreatePlugin','Plugin','create','options','raw','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults'];(function(_0x283e90,_0x154e08){var _0x53aad8=function(_0x163aeb){while(--_0x163aeb){_0x283e90['push'](_0x283e90['shift']());}};_0x53aad8(++_0x154e08);}(_0xe083,0x174));var _0x3e08=function(_0x158de2,_0x3cf71d){_0x158de2=_0x158de2-0x0;var _0x5171dc=_0xe083[_0x158de2];return _0x5171dc;};'use strict';var _=require(_0x3e08('0x0'));var util=require(_0x3e08('0x1'));var moment=require(_0x3e08('0x2'));var BPromise=require('bluebird');var rs=require(_0x3e08('0x3'));var fs=require('fs');var Redis=require(_0x3e08('0x4'));var db=require(_0x3e08('0x5'))['db'];var utils=require(_0x3e08('0x6'));var logger=require(_0x3e08('0x7'))(_0x3e08('0x8'));var config=require(_0x3e08('0x9'));var jayson=require(_0x3e08('0xa'));var client=jayson[_0x3e08('0xb')]['http']({'port':0x232a});config['redis']=_[_0x3e08('0xc')](config[_0x3e08('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x3e08('0xe'))(new Redis(config['redis']));require(_0x3e08('0xf'))[_0x3e08('0x10')](socket);function respondWithRpcPromise(_0x10c00b,_0x128910,_0x5632ca){return new BPromise(function(_0x1d32b5,_0x56c5e3){return client[_0x3e08('0x11')](_0x10c00b,_0x5632ca)[_0x3e08('0x12')](function(_0x111988){logger['info']('Plugin,\x20%s,\x20%s',_0x128910,_0x3e08('0x13'));logger[_0x3e08('0x14')](_0x3e08('0x15'),_0x128910,_0x3e08('0x13'),JSON[_0x3e08('0x16')](_0x111988));if(_0x111988[_0x3e08('0x17')]){if(_0x111988[_0x3e08('0x17')][_0x3e08('0x18')]===0x1f4){logger['error'](_0x3e08('0x19'),_0x128910,_0x111988[_0x3e08('0x17')][_0x3e08('0x1a')]);return _0x56c5e3(_0x111988[_0x3e08('0x17')][_0x3e08('0x1a')]);}logger[_0x3e08('0x17')](_0x3e08('0x19'),_0x128910,_0x111988[_0x3e08('0x17')][_0x3e08('0x1a')]);return _0x1d32b5(_0x111988['error'][_0x3e08('0x1a')]);}else{logger[_0x3e08('0x1b')]('Plugin,\x20%s,\x20%s',_0x128910,_0x3e08('0x13'));_0x1d32b5(_0x111988[_0x3e08('0x1c')][_0x3e08('0x1a')]);}})[_0x3e08('0x1d')](function(_0x4b89e1){logger[_0x3e08('0x17')](_0x3e08('0x19'),_0x128910,_0x4b89e1);_0x56c5e3(_0x4b89e1);});});}exports[_0x3e08('0x1e')]=function(_0x25cee5){var _0x3c8853=this;return new Promise(function(_0x53f510,_0x46de02){return db[_0x3e08('0x1f')][_0x3e08('0x20')](_0x25cee5['body'],{'raw':_0x25cee5['options']?_0x25cee5[_0x3e08('0x21')][_0x3e08('0x22')]===undefined?!![]:![]:!![]})[_0x3e08('0x12')](function(_0xa2af90){logger[_0x3e08('0x1b')](_0x3e08('0x1e'),_0x25cee5);logger[_0x3e08('0x14')](_0x3e08('0x1e'),_0x25cee5,JSON[_0x3e08('0x16')](_0xa2af90));_0x53f510(_0xa2af90);})[_0x3e08('0x1d')](function(_0x47970a){logger[_0x3e08('0x17')](_0x3e08('0x1e'),_0x47970a[_0x3e08('0x1a')],_0x25cee5);_0x46de02(_0x3c8853['error'](0x1f4,_0x47970a[_0x3e08('0x1a')]));});});}; \ No newline at end of file +var _0x6a32=['Plugin,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','CreatePlugin','Plugin','create','options','raw','debug','lodash','util','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','client','http','redis','socket.io-emitter','./plugin.socket','register','request','then','Plugin,\x20%s,\x20%s'];(function(_0x5a59d1,_0x3d7c22){var _0x228155=function(_0xa9661d){while(--_0xa9661d){_0x5a59d1['push'](_0x5a59d1['shift']());}};_0x228155(++_0x3d7c22);}(_0x6a32,0xd8));var _0x26a3=function(_0x133833,_0x1efbd9){_0x133833=_0x133833-0x0;var _0x492d42=_0x6a32[_0x133833];return _0x492d42;};'use strict';var _=require(_0x26a3('0x0'));var util=require(_0x26a3('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x26a3('0x2'));var fs=require('fs');var Redis=require(_0x26a3('0x3'));var db=require(_0x26a3('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x26a3('0x5'));var config=require('../../config/environment');var jayson=require(_0x26a3('0x6'));var client=jayson[_0x26a3('0x7')][_0x26a3('0x8')]({'port':0x232a});config[_0x26a3('0x9')]=_['defaults'](config[_0x26a3('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x26a3('0xa'))(new Redis(config[_0x26a3('0x9')]));require(_0x26a3('0xb'))[_0x26a3('0xc')](socket);function respondWithRpcPromise(_0x1af2e5,_0x2e89b6,_0x96b36f){return new BPromise(function(_0x5a4819,_0x1b7904){return client[_0x26a3('0xd')](_0x1af2e5,_0x96b36f)[_0x26a3('0xe')](function(_0x2a494e){logger['info'](_0x26a3('0xf'),_0x2e89b6,'request\x20sent');logger['debug'](_0x26a3('0x10'),_0x2e89b6,'request\x20sent',JSON[_0x26a3('0x11')](_0x2a494e));if(_0x2a494e[_0x26a3('0x12')]){if(_0x2a494e[_0x26a3('0x12')][_0x26a3('0x13')]===0x1f4){logger[_0x26a3('0x12')](_0x26a3('0xf'),_0x2e89b6,_0x2a494e[_0x26a3('0x12')][_0x26a3('0x14')]);return _0x1b7904(_0x2a494e[_0x26a3('0x12')][_0x26a3('0x14')]);}logger[_0x26a3('0x12')]('Plugin,\x20%s,\x20%s',_0x2e89b6,_0x2a494e[_0x26a3('0x12')]['message']);return _0x5a4819(_0x2a494e[_0x26a3('0x12')][_0x26a3('0x14')]);}else{logger['info'](_0x26a3('0xf'),_0x2e89b6,_0x26a3('0x15'));_0x5a4819(_0x2a494e['result'][_0x26a3('0x14')]);}})[_0x26a3('0x16')](function(_0x4cd32d){logger[_0x26a3('0x12')]('Plugin,\x20%s,\x20%s',_0x2e89b6,_0x4cd32d);_0x1b7904(_0x4cd32d);});});}exports[_0x26a3('0x17')]=function(_0x4571f1){var _0x3e919f=this;return new Promise(function(_0x354626,_0x9a217b){return db[_0x26a3('0x18')][_0x26a3('0x19')](_0x4571f1['body'],{'raw':_0x4571f1['options']?_0x4571f1[_0x26a3('0x1a')][_0x26a3('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x4f8fea){logger['info'](_0x26a3('0x17'),_0x4571f1);logger[_0x26a3('0x1c')](_0x26a3('0x17'),_0x4571f1,JSON['stringify'](_0x4f8fea));_0x354626(_0x4f8fea);})['catch'](function(_0x493312){logger[_0x26a3('0x12')](_0x26a3('0x17'),_0x493312[_0x26a3('0x14')],_0x4571f1);_0x9a217b(_0x3e919f['error'](0x1f4,_0x493312[_0x26a3('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index cf87a5d..be1516f 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 _0x9233=['register','length','plugin:','./plugin.events','save','remove','update'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x9233,0x1a0));var _0x3923=function(_0xb19de0,_0x28572e){_0xb19de0=_0xb19de0-0x0;var _0x4d39ec=_0x9233[_0xb19de0];return _0x4d39ec;};'use strict';var PluginEvents=require(_0x3923('0x0'));var events=[_0x3923('0x1'),_0x3923('0x2'),_0x3923('0x3')];function createListener(_0x55b372,_0x434ef4){return function(_0x3d0ae6){_0x434ef4['emit'](_0x55b372,_0x3d0ae6);};}function removeListener(_0x259305,_0x9f09e0){return function(){PluginEvents['removeListener'](_0x259305,_0x9f09e0);};}exports[_0x3923('0x4')]=function(_0xd066){for(var _0x19eab0=0x0,_0x4f3117=events[_0x3923('0x5')];_0x19eab0<_0x4f3117;_0x19eab0++){var _0x43a615=events[_0x19eab0];var _0x46bdf5=createListener(_0x3923('0x6')+_0x43a615,_0xd066);PluginEvents['on'](_0x43a615,_0x46bdf5);}}; \ No newline at end of file +var _0x48ac=['register','plugin:','save','update','emit','removeListener'];(function(_0x541b0c,_0x940548){var _0x13259e=function(_0x2699b3){while(--_0x2699b3){_0x541b0c['push'](_0x541b0c['shift']());}};_0x13259e(++_0x940548);}(_0x48ac,0xe0));var _0xc48a=function(_0x226e7e,_0x4d1fbe){_0x226e7e=_0x226e7e-0x0;var _0x143d24=_0x48ac[_0x226e7e];return _0x143d24;};'use strict';var PluginEvents=require('./plugin.events');var events=[_0xc48a('0x0'),'remove',_0xc48a('0x1')];function createListener(_0xbfd8aa,_0x3b8221){return function(_0x585c5c){_0x3b8221[_0xc48a('0x2')](_0xbfd8aa,_0x585c5c);};}function removeListener(_0x11a4da,_0xcd83ab){return function(){PluginEvents[_0xc48a('0x3')](_0x11a4da,_0xcd83ab);};}exports[_0xc48a('0x4')]=function(_0x499749){for(var _0x48205f=0x0,_0x5df462=events['length'];_0x48205f<_0x5df462;_0x48205f++){var _0x1e1e1a=events[_0x48205f];var _0xf0c31b=createListener(_0xc48a('0x5')+_0x1e1e1a,_0x499749);PluginEvents['on'](_0x1e1e1a,_0xf0c31b);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index a9eb9fc..9fc9827 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 _0x1647=['/:id','show','post','update','Router','./pm2.controller','get','isAuthenticated','index'];(function(_0x3246a6,_0x2a685a){var _0x1df64d=function(_0x4868ad){while(--_0x4868ad){_0x3246a6['push'](_0x3246a6['shift']());}};_0x1df64d(++_0x2a685a);}(_0x1647,0x1e1));var _0x7164=function(_0x4cb5ee,_0x497b9a){_0x4cb5ee=_0x4cb5ee-0x0;var _0x32cba2=_0x1647[_0x4cb5ee];return _0x32cba2;};'use strict';var express=require('express');var router=express[_0x7164('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x7164('0x1'));router[_0x7164('0x2')]('/',auth[_0x7164('0x3')](),controller[_0x7164('0x4')]);router[_0x7164('0x2')](_0x7164('0x5'),auth[_0x7164('0x3')](),controller[_0x7164('0x6')]);router[_0x7164('0x7')]('/',auth[_0x7164('0x3')](),controller['create']);router['put']('/:id',auth[_0x7164('0x3')](),controller[_0x7164('0x8')]);router['delete'](_0x7164('0x5'),auth[_0x7164('0x3')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xe574=['./pm2.controller','get','isAuthenticated','index','/:id','post','create','put','update','delete','exports','express','Router','../../components/auth/service'];(function(_0x2e6f02,_0x20186d){var _0x2358ff=function(_0x329450){while(--_0x329450){_0x2e6f02['push'](_0x2e6f02['shift']());}};_0x2358ff(++_0x20186d);}(_0xe574,0x1bd));var _0x4e57=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0xe574[_0x4e676e];return _0x336a3c;};'use strict';var express=require(_0x4e57('0x0'));var router=express[_0x4e57('0x1')]();var auth=require(_0x4e57('0x2'));var controller=require(_0x4e57('0x3'));router[_0x4e57('0x4')]('/',auth[_0x4e57('0x5')](),controller[_0x4e57('0x6')]);router[_0x4e57('0x4')](_0x4e57('0x7'),auth[_0x4e57('0x5')](),controller['show']);router[_0x4e57('0x8')]('/',auth['isAuthenticated'](),controller[_0x4e57('0x9')]);router[_0x4e57('0xa')](_0x4e57('0x7'),auth[_0x4e57('0x5')](),controller[_0x4e57('0xb')]);router[_0x4e57('0xc')](_0x4e57('0x7'),auth[_0x4e57('0x5')](),controller['destroy']);module[_0x4e57('0xd')]=router; \ No newline at end of file diff --git a/server/api/pm2/pm2.controller.js b/server/api/pm2/pm2.controller.js index c6c9e18..ca149f7 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 _0x84f0=['list','reject','motion2','length','then','catch','show','describe','params','create','body','script','join','../../files/plugins','cwd','chdir','start','dump','Missing\x20name\x20and/or\x20path','restart','stop','hasOwnProperty','Unknown\x20status','destroy','delete','Unknown\x20id','lodash','../../config/pm2','../../config/logger','api','child_process','exec','bluebird','status','json','stack','name','send','info','error'];(function(_0x125aeb,_0x29238c){var _0x35d4b8=function(_0xde4166){while(--_0xde4166){_0x125aeb['push'](_0x125aeb['shift']());}};_0x35d4b8(++_0x29238c);}(_0x84f0,0x132));var _0x084f=function(_0x243869,_0x18bf48){_0x243869=_0x243869-0x0;var _0x1173f1=_0x84f0[_0x243869];return _0x1173f1;};'use strict';var _=require(_0x084f('0x0'));var pm2=require(_0x084f('0x1'));var logger=require(_0x084f('0x2'))(_0x084f('0x3'));var path=require('path');var exec=require(_0x084f('0x4'))[_0x084f('0x5')];var BPromise=require(_0x084f('0x6'));function handleEntityNotFound(_0x139aeb,_0x17c446){return function(_0x1e6953){if(!_0x1e6953){_0x139aeb['sendStatus'](0x194);;}return _0x1e6953;};}function respondWithResult(_0x544b8a,_0xb6907){_0xb6907=_0xb6907||0xc8;return function(_0x2ba965){if(_0x2ba965){return _0x544b8a[_0x084f('0x7')](_0xb6907)[_0x084f('0x8')](_0x2ba965);}return null;};}function handleError(_0x5f2793,_0x405f33){_0x405f33=_0x405f33||0x1f4;return function(_0x412ca3){logger['error'](_0x412ca3[_0x084f('0x9')]);if(_0x412ca3[_0x084f('0xa')]){delete _0x412ca3[_0x084f('0xa')];}_0x5f2793[_0x084f('0x7')](_0x405f33)[_0x084f('0xb')](_0x412ca3);};}function execChildProcess(){return new BPromise(function(_0x145e28,_0xde14d8){exec('npm\x20install',function(_0x15c94a,_0x2bf68c,_0x1e101c){logger[_0x084f('0xc')](_0x2bf68c);logger[_0x084f('0xc')](_0x1e101c);if(_0x15c94a){logger[_0x084f('0xd')](_0x15c94a);return _0xde14d8(_0x15c94a);}return _0x145e28(_0x2bf68c);});});}exports['index']=function(_0x3dd3eb,_0x375fda){return pm2[_0x084f('0xe')]()['then'](function(_0x4a0089){if(_0x4a0089){var _0x185983=_[_0x084f('0xf')](_0x4a0089,function(_0x582d91){return _0x582d91[_0x084f('0xa')]==='express'||_0x582d91['name']===_0x084f('0x10');});return{'rows':_0x185983,'count':_0x185983[_0x084f('0x11')]};}return null;})[_0x084f('0x12')](respondWithResult(_0x375fda,null))[_0x084f('0x13')](handleError(_0x375fda,null));};exports[_0x084f('0x14')]=function(_0x3311ca,_0xd67ed1){return pm2[_0x084f('0x15')](_0x3311ca[_0x084f('0x16')]['id'])[_0x084f('0x12')](respondWithResult(_0xd67ed1,null))[_0x084f('0x12')](handleEntityNotFound(_0xd67ed1,null))['catch'](handleError(_0xd67ed1,null));};exports[_0x084f('0x17')]=function(_0x18408f,_0x47371b){if(_0x18408f['body'][_0x084f('0xa')]&&_0x18408f[_0x084f('0x18')][_0x084f('0x19')]){var _0x46c5e5=path[_0x084f('0x1a')](__dirname,_0x084f('0x1b'),_0x18408f[_0x084f('0x18')]['script']);var _0x2f95e2=process[_0x084f('0x1c')]();process[_0x084f('0x1d')](path['dirname'](_0x46c5e5));return execChildProcess()[_0x084f('0x12')](function(_0x3f4e40){process[_0x084f('0x1d')](_0x2f95e2);return pm2[_0x084f('0x1e')]({'name':_0x18408f[_0x084f('0x18')]['name'],'script':_0x46c5e5});})[_0x084f('0x12')](function(_0x24a17b){pm2[_0x084f('0x1f')]();return _0x24a17b[0x0];})['then'](respondWithResult(_0x47371b,0xc9))['catch'](handleError(_0x47371b,null));}else{return _0x47371b[_0x084f('0x7')](0x1f4)['send']({'message':_0x084f('0x20')});}};exports['update']=function(_0x487630,_0x4eada8){if(_0x487630[_0x084f('0x18')]['id']){delete _0x487630['body']['id'];}var _0x3d3bfc={'online':_0x084f('0x21'),'stopped':_0x084f('0x22')};if(_0x3d3bfc[_0x084f('0x23')](_0x487630[_0x084f('0x18')]['status'])){return pm2[_0x3d3bfc[_0x487630[_0x084f('0x18')][_0x084f('0x7')]]](_0x487630['params']['id'])['then'](respondWithResult(_0x4eada8,0xc8))[_0x084f('0x13')](handleError(_0x4eada8,null));}else{return _0x4eada8['status'](0x1f4)[_0x084f('0xb')]({'message':_0x084f('0x24')});}};exports[_0x084f('0x25')]=function(_0x520185,_0x3e4c7c){if(_0x520185[_0x084f('0x18')]['id']){delete _0x520185[_0x084f('0x18')]['id'];}if(_0x520185[_0x084f('0x16')]['id']){return pm2[_0x084f('0x26')](_0x520185[_0x084f('0x16')]['id'])[_0x084f('0x12')](function(_0x2e5636){pm2['dump']();return _0x2e5636[0x0];})[_0x084f('0x12')](respondWithResult(_0x3e4c7c,null))[_0x084f('0x13')](handleError(_0x3e4c7c,null));}else{return _0x3e4c7c['status'](0x1f4)[_0x084f('0xb')]({'message':_0x084f('0x27')});}}; \ No newline at end of file +var _0xbce1=['error','name','npm\x20install','info','index','reject','express','motion2','length','catch','show','describe','params','then','create','body','script','join','../../files/plugins','cwd','chdir','dirname','dump','send','Missing\x20name\x20and/or\x20path','update','hasOwnProperty','Unknown\x20status','destroy','delete','Unknown\x20id','../../config/pm2','../../config/logger','path','exec','sendStatus','status','json'];(function(_0xf47b54,_0x2f9e7f){var _0x22a3e6=function(_0x147af3){while(--_0x147af3){_0xf47b54['push'](_0xf47b54['shift']());}};_0x22a3e6(++_0x2f9e7f);}(_0xbce1,0x14f));var _0x1bce=function(_0x4a5e4a,_0x12b8a3){_0x4a5e4a=_0x4a5e4a-0x0;var _0xd800cd=_0xbce1[_0x4a5e4a];return _0xd800cd;};'use strict';var _=require('lodash');var pm2=require(_0x1bce('0x0'));var logger=require(_0x1bce('0x1'))('api');var path=require(_0x1bce('0x2'));var exec=require('child_process')[_0x1bce('0x3')];var BPromise=require('bluebird');function handleEntityNotFound(_0x22c015,_0x3cd7b0){return function(_0x468fe7){if(!_0x468fe7){_0x22c015[_0x1bce('0x4')](0x194);;}return _0x468fe7;};}function respondWithResult(_0x238a06,_0x4fc405){_0x4fc405=_0x4fc405||0xc8;return function(_0x609800){if(_0x609800){return _0x238a06[_0x1bce('0x5')](_0x4fc405)[_0x1bce('0x6')](_0x609800);}return null;};}function handleError(_0x35dbf4,_0x1ff8a4){_0x1ff8a4=_0x1ff8a4||0x1f4;return function(_0x18ba89){logger[_0x1bce('0x7')](_0x18ba89['stack']);if(_0x18ba89[_0x1bce('0x8')]){delete _0x18ba89[_0x1bce('0x8')];}_0x35dbf4[_0x1bce('0x5')](_0x1ff8a4)['send'](_0x18ba89);};}function execChildProcess(){return new BPromise(function(_0x26afab,_0x16cf53){exec(_0x1bce('0x9'),function(_0x2c74ec,_0x32a0ae,_0x8cfe61){logger[_0x1bce('0xa')](_0x32a0ae);logger[_0x1bce('0xa')](_0x8cfe61);if(_0x2c74ec){logger['error'](_0x2c74ec);return _0x16cf53(_0x2c74ec);}return _0x26afab(_0x32a0ae);});});}exports[_0x1bce('0xb')]=function(_0x4ade37,_0x32029b){return pm2['list']()['then'](function(_0x255bc0){if(_0x255bc0){var _0x5115aa=_[_0x1bce('0xc')](_0x255bc0,function(_0x54c576){return _0x54c576[_0x1bce('0x8')]===_0x1bce('0xd')||_0x54c576[_0x1bce('0x8')]===_0x1bce('0xe');});return{'rows':_0x5115aa,'count':_0x5115aa[_0x1bce('0xf')]};}return null;})['then'](respondWithResult(_0x32029b,null))[_0x1bce('0x10')](handleError(_0x32029b,null));};exports[_0x1bce('0x11')]=function(_0x58c44e,_0x33f4d8){return pm2[_0x1bce('0x12')](_0x58c44e[_0x1bce('0x13')]['id'])[_0x1bce('0x14')](respondWithResult(_0x33f4d8,null))[_0x1bce('0x14')](handleEntityNotFound(_0x33f4d8,null))[_0x1bce('0x10')](handleError(_0x33f4d8,null));};exports[_0x1bce('0x15')]=function(_0x45bc31,_0xb7620d){if(_0x45bc31[_0x1bce('0x16')][_0x1bce('0x8')]&&_0x45bc31[_0x1bce('0x16')][_0x1bce('0x17')]){var _0x33e052=path[_0x1bce('0x18')](__dirname,_0x1bce('0x19'),_0x45bc31[_0x1bce('0x16')]['script']);var _0x443787=process[_0x1bce('0x1a')]();process[_0x1bce('0x1b')](path[_0x1bce('0x1c')](_0x33e052));return execChildProcess()[_0x1bce('0x14')](function(_0x10bb91){process[_0x1bce('0x1b')](_0x443787);return pm2['start']({'name':_0x45bc31['body'][_0x1bce('0x8')],'script':_0x33e052});})['then'](function(_0x52650b){pm2[_0x1bce('0x1d')]();return _0x52650b[0x0];})[_0x1bce('0x14')](respondWithResult(_0xb7620d,0xc9))[_0x1bce('0x10')](handleError(_0xb7620d,null));}else{return _0xb7620d[_0x1bce('0x5')](0x1f4)[_0x1bce('0x1e')]({'message':_0x1bce('0x1f')});}};exports[_0x1bce('0x20')]=function(_0x39b7b7,_0xb449ae){if(_0x39b7b7['body']['id']){delete _0x39b7b7[_0x1bce('0x16')]['id'];}var _0x4097c5={'online':'restart','stopped':'stop'};if(_0x4097c5[_0x1bce('0x21')](_0x39b7b7[_0x1bce('0x16')][_0x1bce('0x5')])){return pm2[_0x4097c5[_0x39b7b7[_0x1bce('0x16')][_0x1bce('0x5')]]](_0x39b7b7[_0x1bce('0x13')]['id'])[_0x1bce('0x14')](respondWithResult(_0xb449ae,0xc8))[_0x1bce('0x10')](handleError(_0xb449ae,null));}else{return _0xb449ae[_0x1bce('0x5')](0x1f4)[_0x1bce('0x1e')]({'message':_0x1bce('0x22')});}};exports[_0x1bce('0x23')]=function(_0x13f4e6,_0x1a92ce){if(_0x13f4e6[_0x1bce('0x16')]['id']){delete _0x13f4e6[_0x1bce('0x16')]['id'];}if(_0x13f4e6[_0x1bce('0x13')]['id']){return pm2[_0x1bce('0x24')](_0x13f4e6['params']['id'])[_0x1bce('0x14')](function(_0x901696){pm2['dump']();return _0x901696[0x0];})['then'](respondWithResult(_0x1a92ce,null))[_0x1bce('0x10')](handleError(_0x1a92ce,null));}else{return _0x1a92ce[_0x1bce('0x5')](0x1f4)[_0x1bce('0x1e')]({'message':_0x1bce('0x25')});}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index b6843ef..5406062 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 _0x816f=['../../components/interaction/service','util','path','connect-timeout','../../components/auth/service'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x816f,0x1af));var _0xf816=function(_0x1362e7,_0x8f4ed2){_0x1362e7=_0x1362e7-0x0;var _0x184bf0=_0x816f[_0x1362e7];return _0x184bf0;};'use strict';var multer=require('multer');var util=require(_0xf816('0x0'));var path=require(_0xf816('0x1'));var timeout=require(_0xf816('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0xf816('0x3'));var interaction=require(_0xf816('0x4'));var config=require('../../config/environment');module['exports']=router; \ No newline at end of file +var _0x0917=['multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports'];(function(_0x4e4b1f,_0x4b9c3c){var _0xb0138=function(_0x201196){while(--_0x201196){_0x4e4b1f['push'](_0x4e4b1f['shift']());}};_0xb0138(++_0x4b9c3c);}(_0x0917,0x129));var _0x7091=function(_0x2bc2a2,_0x51e95f){_0x2bc2a2=_0x2bc2a2-0x0;var _0x20de67=_0x0917[_0x2bc2a2];return _0x20de67;};'use strict';var multer=require(_0x7091('0x0'));var util=require(_0x7091('0x1'));var path=require('path');var timeout=require(_0x7091('0x2'));var express=require(_0x7091('0x3'));var router=express[_0x7091('0x4')]();var auth=require(_0x7091('0x5'));var interaction=require(_0x7091('0x6'));var config=require(_0x7091('0x7'));module[_0x7091('0x8')]=router; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index ba66661..adeb386 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 _0xe5be=['STRING','sequelize','exports','INTEGER'];(function(_0x2bb19a,_0x3cde55){var _0x6f236c=function(_0x3483f1){while(--_0x3483f1){_0x2bb19a['push'](_0x2bb19a['shift']());}};_0x6f236c(++_0x3cde55);}(_0xe5be,0x179));var _0xee5b=function(_0x57e71a,_0x62c8e2){_0x57e71a=_0x57e71a-0x0;var _0x499942=_0xe5be[_0x57e71a];return _0x499942;};'use strict';var Sequelize=require(_0xee5b('0x0'));module[_0xee5b('0x1')]={'state':{'type':Sequelize[_0xee5b('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xee5b('0x3')]},'scheduledat':{'type':Sequelize['DATE']},'uniqueid':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0xee5b('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0xee5b('0x3')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xee5b('0x3')]}}; \ No newline at end of file +var _0x95e7=['DATE','sequelize','exports','INTEGER','STRING'];(function(_0xa86c9a,_0x528387){var _0x2df484=function(_0x1bccfe){while(--_0x1bccfe){_0xa86c9a['push'](_0xa86c9a['shift']());}};_0x2df484(++_0x528387);}(_0x95e7,0xa1));var _0x795e=function(_0x4a6f60,_0x10aa96){_0x4a6f60=_0x4a6f60-0x0;var _0x2e1290=_0x95e7[_0x4a6f60];return _0x2e1290;};'use strict';var Sequelize=require(_0x795e('0x0'));module[_0x795e('0x1')]={'state':{'type':Sequelize[_0x795e('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x795e('0x3')]},'scheduledat':{'type':Sequelize[_0x795e('0x4')]},'uniqueid':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x795e('0x4')]},'responsetime':{'type':Sequelize[_0x795e('0x4')]},'ringtime':{'type':Sequelize[_0x795e('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x795e('0x3')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x795e('0x3')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 40abc3a..4ca0efb 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 _0x6f39=['./reportAgentPreview.attributes','exports','define','report_agent_preview','lodash','api','moment','bluebird','path','../../config/environment'];(function(_0x478094,_0x3145b3){var _0x57cff8=function(_0x596962){while(--_0x596962){_0x478094['push'](_0x478094['shift']());}};_0x57cff8(++_0x3145b3);}(_0x6f39,0xea));var _0x96f3=function(_0x50cfc3,_0x526cc6){_0x50cfc3=_0x50cfc3-0x0;var _0x5c11ef=_0x6f39[_0x50cfc3];return _0x5c11ef;};'use strict';var _=require(_0x96f3('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x96f3('0x1'));var moment=require(_0x96f3('0x2'));var BPromise=require(_0x96f3('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x96f3('0x4'));var rimraf=require('rimraf');var config=require(_0x96f3('0x5'));var attributes=require(_0x96f3('0x6'));module[_0x96f3('0x7')]=function(_0x574b77,_0x2f911e){return _0x574b77[_0x96f3('0x8')]('ReportAgentPreview',attributes,{'tableName':_0x96f3('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfeb4=['api','moment','request-promise','path','rimraf','../../config/environment','./reportAgentPreview.attributes','exports','define','ReportAgentPreview','lodash','util','../../config/logger'];(function(_0x12ca5f,_0x223d98){var _0xfc3ae9=function(_0x1928fb){while(--_0x1928fb){_0x12ca5f['push'](_0x12ca5f['shift']());}};_0xfc3ae9(++_0x223d98);}(_0xfeb4,0x19d));var _0x4feb=function(_0x263a74,_0xc31414){_0x263a74=_0x263a74-0x0;var _0x2aa86c=_0xfeb4[_0x263a74];return _0x2aa86c;};'use strict';var _=require(_0x4feb('0x0'));var util=require(_0x4feb('0x1'));var logger=require(_0x4feb('0x2'))(_0x4feb('0x3'));var moment=require(_0x4feb('0x4'));var BPromise=require('bluebird');var rp=require(_0x4feb('0x5'));var fs=require('fs');var path=require(_0x4feb('0x6'));var rimraf=require(_0x4feb('0x7'));var config=require(_0x4feb('0x8'));var attributes=require(_0x4feb('0x9'));module[_0x4feb('0xa')]=function(_0x4c7c02,_0x3aa238){return _0x4c7c02[_0x4feb('0xb')](_0x4feb('0xc'),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 988837a..95c1abd 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 _0x8a83=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','ReportAgentPreview,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','ReportAgentPreview,\x20%s,\x20%s','message','info','catch','ReportAgentPreview','create','body','options','CreateReportAgentPreview','debug','stringify','lodash','util','moment','bluebird','randomstring','../../mysqldb'];(function(_0x26da15,_0x43252d){var _0x263987=function(_0xd619a5){while(--_0xd619a5){_0x26da15['push'](_0x26da15['shift']());}};_0x263987(++_0x43252d);}(_0x8a83,0x173));var _0x38a8=function(_0x59e821,_0x86c723){_0x59e821=_0x59e821-0x0;var _0x5333f6=_0x8a83[_0x59e821];return _0x5333f6;};'use strict';var _=require(_0x38a8('0x0'));var util=require(_0x38a8('0x1'));var moment=require(_0x38a8('0x2'));var BPromise=require(_0x38a8('0x3'));var rs=require(_0x38a8('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x38a8('0x5'))['db'];var utils=require(_0x38a8('0x6'));var logger=require(_0x38a8('0x7'))(_0x38a8('0x8'));var config=require(_0x38a8('0x9'));var jayson=require(_0x38a8('0xa'));var client=jayson['client'][_0x38a8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x26950a,_0x58432b,_0x5f42a1){return new BPromise(function(_0x2822e8,_0x196137){return client[_0x38a8('0xc')](_0x26950a,_0x5f42a1)[_0x38a8('0xd')](function(_0x3bc5cf){logger['info']('ReportAgentPreview,\x20%s,\x20%s',_0x58432b,'request\x20sent');logger['debug'](_0x38a8('0xe'),_0x58432b,_0x38a8('0xf'),JSON['stringify'](_0x3bc5cf));if(_0x3bc5cf[_0x38a8('0x10')]){if(_0x3bc5cf[_0x38a8('0x10')][_0x38a8('0x11')]===0x1f4){logger['error'](_0x38a8('0x12'),_0x58432b,_0x3bc5cf[_0x38a8('0x10')][_0x38a8('0x13')]);return _0x196137(_0x3bc5cf['error']['message']);}logger[_0x38a8('0x10')]('ReportAgentPreview,\x20%s,\x20%s',_0x58432b,_0x3bc5cf[_0x38a8('0x10')]['message']);return _0x2822e8(_0x3bc5cf['error'][_0x38a8('0x13')]);}else{logger[_0x38a8('0x14')]('ReportAgentPreview,\x20%s,\x20%s',_0x58432b,_0x38a8('0xf'));_0x2822e8(_0x3bc5cf['result']['message']);}})[_0x38a8('0x15')](function(_0x376ffc){logger['error']('ReportAgentPreview,\x20%s,\x20%s',_0x58432b,_0x376ffc);_0x196137(_0x376ffc);});});}exports['CreateReportAgentPreview']=function(_0x4cab60){var _0x532bc0=this;return new Promise(function(_0x4ab425,_0x5acc49){return db[_0x38a8('0x16')][_0x38a8('0x17')](_0x4cab60[_0x38a8('0x18')],{'raw':_0x4cab60[_0x38a8('0x19')]?_0x4cab60[_0x38a8('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x38a8('0xd')](function(_0x5bc693){logger[_0x38a8('0x14')](_0x38a8('0x1a'),_0x4cab60);logger[_0x38a8('0x1b')]('CreateReportAgentPreview',_0x4cab60,JSON[_0x38a8('0x1c')](_0x5bc693));_0x4ab425(_0x5bc693);})['catch'](function(_0x2a33bd){logger[_0x38a8('0x10')](_0x38a8('0x1a'),_0x2a33bd[_0x38a8('0x13')],_0x4cab60);_0x5acc49(_0x532bc0[_0x38a8('0x10')](0x1f4,_0x2a33bd[_0x38a8('0x13')]));});});}; \ No newline at end of file +var _0xd9a6=['error','code','message','result','catch','CreateReportAgentPreview','ReportAgentPreview','create','body','options','raw','then','lodash','util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','info','ReportAgentPreview,\x20%s,\x20%s','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0xa4d25a,_0x36f160){var _0xa4d37a=function(_0x36ab58){while(--_0x36ab58){_0xa4d25a['push'](_0xa4d25a['shift']());}};_0xa4d37a(++_0x36f160);}(_0xd9a6,0x124));var _0x6d9a=function(_0x21de40,_0x5ad29a){_0x21de40=_0x21de40-0x0;var _0x517999=_0xd9a6[_0x21de40];return _0x517999;};'use strict';var _=require(_0x6d9a('0x0'));var util=require(_0x6d9a('0x1'));var moment=require('moment');var BPromise=require(_0x6d9a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6d9a('0x3'));var db=require(_0x6d9a('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x6d9a('0x5'))(_0x6d9a('0x6'));var config=require(_0x6d9a('0x7'));var jayson=require(_0x6d9a('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5da9a2,_0x1007a0,_0x46ea54){return new BPromise(function(_0x3c3b63,_0x3fcd91){return client[_0x6d9a('0x9')](_0x5da9a2,_0x46ea54)['then'](function(_0x227f3e){logger[_0x6d9a('0xa')](_0x6d9a('0xb'),_0x1007a0,'request\x20sent');logger[_0x6d9a('0xc')](_0x6d9a('0xd'),_0x1007a0,_0x6d9a('0xe'),JSON[_0x6d9a('0xf')](_0x227f3e));if(_0x227f3e[_0x6d9a('0x10')]){if(_0x227f3e[_0x6d9a('0x10')][_0x6d9a('0x11')]===0x1f4){logger[_0x6d9a('0x10')](_0x6d9a('0xb'),_0x1007a0,_0x227f3e[_0x6d9a('0x10')][_0x6d9a('0x12')]);return _0x3fcd91(_0x227f3e[_0x6d9a('0x10')][_0x6d9a('0x12')]);}logger[_0x6d9a('0x10')](_0x6d9a('0xb'),_0x1007a0,_0x227f3e['error'][_0x6d9a('0x12')]);return _0x3c3b63(_0x227f3e[_0x6d9a('0x10')][_0x6d9a('0x12')]);}else{logger[_0x6d9a('0xa')](_0x6d9a('0xb'),_0x1007a0,_0x6d9a('0xe'));_0x3c3b63(_0x227f3e[_0x6d9a('0x13')][_0x6d9a('0x12')]);}})[_0x6d9a('0x14')](function(_0x3524a1){logger['error'](_0x6d9a('0xb'),_0x1007a0,_0x3524a1);_0x3fcd91(_0x3524a1);});});}exports[_0x6d9a('0x15')]=function(_0x15410d){var _0x59e099=this;return new Promise(function(_0x4ef142,_0x44b60b){return db[_0x6d9a('0x16')][_0x6d9a('0x17')](_0x15410d[_0x6d9a('0x18')],{'raw':_0x15410d['options']?_0x15410d[_0x6d9a('0x19')][_0x6d9a('0x1a')]===undefined?!![]:![]:!![]})[_0x6d9a('0x1b')](function(_0x45bba4){logger[_0x6d9a('0xa')]('CreateReportAgentPreview',_0x15410d);logger['debug']('CreateReportAgentPreview',_0x15410d,JSON[_0x6d9a('0xf')](_0x45bba4));_0x4ef142(_0x45bba4);})[_0x6d9a('0x14')](function(_0x56ec8c){logger[_0x6d9a('0x10')](_0x6d9a('0x15'),_0x56ec8c[_0x6d9a('0x12')],_0x15410d);_0x44b60b(_0x59e099['error'](0x1f4,_0x56ec8c[_0x6d9a('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index 34506d7..8ecebfb 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 _0x86bc=['/fax/accounts','faxAccounts','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','mail','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','queueNotify','showChatQueues','fax','showFaxQueues','openchannel','showOpenchannelQueues','/sms/queues/:id/notify','sms','showSmsQueues','/agents/:id/notify','agentNotify','exports','multer','path','express','Router','../../components/auth/service','./rpc.controller','get','voiceChannels','/voice/channels/:uniqueid/mixmonitor','/voice/channels/:uniqueid/stopmixmonitor','isAuthenticated','voiceChannelStopMixMonitor','voiceQueues','/chat/queues','chatQueues','/mail/queues','mailQueues','/mail/accounts','mailAccounts','openchannelQueues','/sms/queues','smsQueues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','voiceQueuesChannelHangup','showVoiceQueues','/outbound','outbound','/outbound/channels','/agents','agents','put','agentCapacity','/telephones','/trunks','trunks','/campaigns','campaigns'];(function(_0x1e6509,_0x181af6){var _0x1f9b28=function(_0x5557e2){while(--_0x5557e2){_0x1e6509['push'](_0x1e6509['shift']());}};_0x1f9b28(++_0x181af6);}(_0x86bc,0x1b1));var _0xc86b=function(_0x35b17e,_0xb17617){_0x35b17e=_0x35b17e-0x0;var _0x54ae4f=_0x86bc[_0x35b17e];return _0x54ae4f;};'use strict';var multer=require(_0xc86b('0x0'));var util=require('util');var path=require(_0xc86b('0x1'));var express=require(_0xc86b('0x2'));var router=express[_0xc86b('0x3')]();var auth=require(_0xc86b('0x4'));var controller=require(_0xc86b('0x5'));router[_0xc86b('0x6')]('/voice/channels',auth['isAuthenticated'](),controller[_0xc86b('0x7')]);router['get'](_0xc86b('0x8'),auth['isAuthenticated'](),controller['voiceChannelMixMonitor']);router[_0xc86b('0x6')](_0xc86b('0x9'),auth[_0xc86b('0xa')](),controller[_0xc86b('0xb')]);router[_0xc86b('0x6')]('/voice/queues',auth[_0xc86b('0xa')](),controller[_0xc86b('0xc')]);router[_0xc86b('0x6')](_0xc86b('0xd'),auth[_0xc86b('0xa')](),controller[_0xc86b('0xe')]);router[_0xc86b('0x6')](_0xc86b('0xf'),auth['isAuthenticated'](),controller[_0xc86b('0x10')]);router[_0xc86b('0x6')](_0xc86b('0x11'),auth['isAuthenticated'](),controller[_0xc86b('0x12')]);router['get']('/openchannel/queues',auth[_0xc86b('0xa')](),controller[_0xc86b('0x13')]);router['get'](_0xc86b('0x14'),auth['isAuthenticated'](),controller[_0xc86b('0x15')]);router[_0xc86b('0x6')](_0xc86b('0x16'),auth[_0xc86b('0xa')](),controller[_0xc86b('0x17')]);router['get'](_0xc86b('0x18'),auth[_0xc86b('0xa')](),controller[_0xc86b('0x19')]);router[_0xc86b('0x6')]('/voice/queues/channels',auth[_0xc86b('0xa')](),controller[_0xc86b('0x1a')]);router[_0xc86b('0x6')](_0xc86b('0x1b'),auth['isAuthenticated'](),controller[_0xc86b('0x1c')]);router[_0xc86b('0x6')]('/voice/queues/channels/:uniqueid/hangup',auth[_0xc86b('0xa')](),controller[_0xc86b('0x1d')]);router['get']('/voice/queues/channels/:uniqueid/redirect/:exten',auth[_0xc86b('0xa')](),controller['voiceQueuesChannelRedirect']);router[_0xc86b('0x6')]('/voice/queues/:id',auth[_0xc86b('0xa')](),controller[_0xc86b('0x1e')]);router['get'](_0xc86b('0x1f'),auth['isAuthenticated'](),controller[_0xc86b('0x20')]);router[_0xc86b('0x6')](_0xc86b('0x21'),auth[_0xc86b('0xa')](),controller['outboundChannels']);router[_0xc86b('0x6')](_0xc86b('0x22'),auth[_0xc86b('0xa')](),controller[_0xc86b('0x23')]);router[_0xc86b('0x24')]('/agents/:id/capacity',auth[_0xc86b('0xa')](),controller[_0xc86b('0x25')]);router[_0xc86b('0x6')](_0xc86b('0x26'),auth[_0xc86b('0xa')](),controller['telephones']);router[_0xc86b('0x6')](_0xc86b('0x27'),auth[_0xc86b('0xa')](),controller[_0xc86b('0x28')]);router[_0xc86b('0x6')](_0xc86b('0x29'),auth[_0xc86b('0xa')](),controller[_0xc86b('0x2a')]);router[_0xc86b('0x6')](_0xc86b('0x2b'),auth[_0xc86b('0xa')](),controller[_0xc86b('0x2c')]);router[_0xc86b('0x6')]('/chat/queues/waitinginteractions',auth['isAuthenticated'](),controller['chatQueuesWaitingInteractions']);router[_0xc86b('0x6')]('/mail/queues/waitinginteractions',auth['isAuthenticated'](),controller[_0xc86b('0x2d')]);router[_0xc86b('0x6')](_0xc86b('0x2e'),auth[_0xc86b('0xa')](),controller[_0xc86b('0x2f')]);router['get']('/sms/queues/waitinginteractions',auth[_0xc86b('0xa')](),controller[_0xc86b('0x30')]);router[_0xc86b('0x6')](_0xc86b('0x31'),auth[_0xc86b('0xa')](),controller[_0xc86b('0x32')]);router[_0xc86b('0x33')]('/mail/queues/:id/notify',auth[_0xc86b('0xa')](),controller['queueNotify'](_0xc86b('0x34')));router[_0xc86b('0x6')](_0xc86b('0x35'),auth[_0xc86b('0xa')](),controller[_0xc86b('0x36')]);router['post'](_0xc86b('0x37'),auth[_0xc86b('0xa')](),controller[_0xc86b('0x38')]('chat'));router[_0xc86b('0x6')]('/chat/queues/:id',auth['isAuthenticated'](),controller[_0xc86b('0x39')]);router['post']('/fax/queues/:id/notify',auth[_0xc86b('0xa')](),controller[_0xc86b('0x38')](_0xc86b('0x3a')));router['get']('/fax/queues/:id',auth[_0xc86b('0xa')](),controller[_0xc86b('0x3b')]);router['post']('/openchannel/queues/:id/notify',auth[_0xc86b('0xa')](),controller[_0xc86b('0x38')](_0xc86b('0x3c')));router[_0xc86b('0x6')]('/openchannel/queues/:id',auth[_0xc86b('0xa')](),controller[_0xc86b('0x3d')]);router[_0xc86b('0x33')](_0xc86b('0x3e'),auth[_0xc86b('0xa')](),controller[_0xc86b('0x38')](_0xc86b('0x3f')));router[_0xc86b('0x6')]('/sms/queues/:id',auth[_0xc86b('0xa')](),controller[_0xc86b('0x40')]);router[_0xc86b('0x33')](_0xc86b('0x41'),auth[_0xc86b('0xa')](),controller[_0xc86b('0x42')]);module[_0xc86b('0x43')]=router; \ No newline at end of file +var _0x6515=['/voice/queues/preview/:id','/voice/queues/channels','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','/outbound','outbound','/outbound/channels','outboundChannels','/agents','put','/trunks','/campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','smsQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','post','/chat/queues/:id/notify','chat','/chat/queues/:id','/fax/queues/:id/notify','fax','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','sms','/agents/:id/notify','agentNotify','exports','multer','util','path','Router','../../components/auth/service','./rpc.controller','get','/voice/channels','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues','chatQueues','mailQueues','/mail/accounts','/openchannel/queues','openchannelQueues','/sms/queues','smsQueues','/fax/queues','faxQueues'];(function(_0xe9c346,_0x464b42){var _0x35ebc7=function(_0x205cdc){while(--_0x205cdc){_0xe9c346['push'](_0xe9c346['shift']());}};_0x35ebc7(++_0x464b42);}(_0x6515,0x1e5));var _0x5651=function(_0x3da8ea,_0x2905a4){_0x3da8ea=_0x3da8ea-0x0;var _0x33a5e8=_0x6515[_0x3da8ea];return _0x33a5e8;};'use strict';var multer=require(_0x5651('0x0'));var util=require(_0x5651('0x1'));var path=require(_0x5651('0x2'));var express=require('express');var router=express[_0x5651('0x3')]();var auth=require(_0x5651('0x4'));var controller=require(_0x5651('0x5'));router[_0x5651('0x6')](_0x5651('0x7'),auth[_0x5651('0x8')](),controller[_0x5651('0x9')]);router[_0x5651('0x6')](_0x5651('0xa'),auth['isAuthenticated'](),controller[_0x5651('0xb')]);router[_0x5651('0x6')](_0x5651('0xc'),auth[_0x5651('0x8')](),controller[_0x5651('0xd')]);router[_0x5651('0x6')](_0x5651('0xe'),auth[_0x5651('0x8')](),controller[_0x5651('0xf')]);router[_0x5651('0x6')](_0x5651('0x10'),auth[_0x5651('0x8')](),controller[_0x5651('0x11')]);router[_0x5651('0x6')]('/mail/queues',auth['isAuthenticated'](),controller[_0x5651('0x12')]);router[_0x5651('0x6')](_0x5651('0x13'),auth[_0x5651('0x8')](),controller['mailAccounts']);router['get'](_0x5651('0x14'),auth[_0x5651('0x8')](),controller[_0x5651('0x15')]);router[_0x5651('0x6')](_0x5651('0x16'),auth[_0x5651('0x8')](),controller[_0x5651('0x17')]);router['get'](_0x5651('0x18'),auth[_0x5651('0x8')](),controller[_0x5651('0x19')]);router[_0x5651('0x6')](_0x5651('0x1a'),auth[_0x5651('0x8')](),controller['voiceQueuesPreview']);router[_0x5651('0x6')](_0x5651('0x1b'),auth[_0x5651('0x8')](),controller['voiceQueuesChannels']);router[_0x5651('0x6')]('/voice/queues/channels/:uniqueid',auth['isAuthenticated'](),controller['voiceQueuesChannel']);router['get'](_0x5651('0x1c'),auth[_0x5651('0x8')](),controller[_0x5651('0x1d')]);router[_0x5651('0x6')](_0x5651('0x1e'),auth[_0x5651('0x8')](),controller[_0x5651('0x1f')]);router[_0x5651('0x6')](_0x5651('0x20'),auth[_0x5651('0x8')](),controller[_0x5651('0x21')]);router['get'](_0x5651('0x22'),auth[_0x5651('0x8')](),controller[_0x5651('0x23')]);router[_0x5651('0x6')](_0x5651('0x24'),auth[_0x5651('0x8')](),controller[_0x5651('0x25')]);router[_0x5651('0x6')](_0x5651('0x26'),auth[_0x5651('0x8')](),controller['agents']);router[_0x5651('0x27')]('/agents/:id/capacity',auth[_0x5651('0x8')](),controller['agentCapacity']);router[_0x5651('0x6')]('/telephones',auth['isAuthenticated'](),controller['telephones']);router['get'](_0x5651('0x28'),auth[_0x5651('0x8')](),controller['trunks']);router[_0x5651('0x6')](_0x5651('0x29'),auth[_0x5651('0x8')](),controller['campaigns']);router[_0x5651('0x6')](_0x5651('0x2a'),auth[_0x5651('0x8')](),controller[_0x5651('0x2b')]);router[_0x5651('0x6')](_0x5651('0x2c'),auth[_0x5651('0x8')](),controller[_0x5651('0x2d')]);router['get'](_0x5651('0x2e'),auth[_0x5651('0x8')](),controller[_0x5651('0x2f')]);router[_0x5651('0x6')](_0x5651('0x30'),auth[_0x5651('0x8')](),controller['openchannelQueuesWaitingInteractions']);router['get']('/sms/queues/waitinginteractions',auth[_0x5651('0x8')](),controller[_0x5651('0x31')]);router['get'](_0x5651('0x32'),auth[_0x5651('0x8')](),controller[_0x5651('0x33')]);router['post'](_0x5651('0x34'),auth[_0x5651('0x8')](),controller[_0x5651('0x35')](_0x5651('0x36')));router[_0x5651('0x6')](_0x5651('0x37'),auth[_0x5651('0x8')](),controller['showMailQueues']);router[_0x5651('0x38')](_0x5651('0x39'),auth[_0x5651('0x8')](),controller[_0x5651('0x35')](_0x5651('0x3a')));router['get'](_0x5651('0x3b'),auth[_0x5651('0x8')](),controller['showChatQueues']);router['post'](_0x5651('0x3c'),auth[_0x5651('0x8')](),controller['queueNotify'](_0x5651('0x3d')));router[_0x5651('0x6')](_0x5651('0x3e'),auth[_0x5651('0x8')](),controller[_0x5651('0x3f')]);router[_0x5651('0x38')](_0x5651('0x40'),auth[_0x5651('0x8')](),controller[_0x5651('0x35')](_0x5651('0x41')));router[_0x5651('0x6')](_0x5651('0x42'),auth[_0x5651('0x8')](),controller[_0x5651('0x43')]);router[_0x5651('0x38')](_0x5651('0x44'),auth[_0x5651('0x8')](),controller[_0x5651('0x35')](_0x5651('0x45')));router[_0x5651('0x6')]('/sms/queues/:id',auth[_0x5651('0x8')](),controller['showSmsQueues']);router[_0x5651('0x38')](_0x5651('0x46'),auth[_0x5651('0x8')](),controller[_0x5651('0x47')]);module[_0x5651('0x48')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index 87c8276..1cda1ff 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 _0x5832=['Trunks','campaigns','chatQueues','showChatQueues','ChatQueues','MailQueues','showMailQueues','MailAccounts','showOpenchannelQueues','smsQueues','showSmsQueues','SmsQueues','faxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','FaxQueuesWaitingInteractions','capitalize','chat','Website','Account','Queue','findOne','\x20Queue\x20not\x20found','Message','Interaction','\x20Message\x20not\x20found','update','queue','InteractionId','From','QueueId','create','Start','queueTransferTimeout','*,*,*,*','agentNotify','channel','User','Agent\x20not\x20found','MessageId','TransferReport','bluebird','lodash','util','../../config/logger','api','jayson/promise','client','http','request','then','error','code','message','result','catch','status','sendStatus','stack','name','isNil','rows','find','voiceChannels','query','VoiceChannelMixMonitor','merge','params','VoiceChannelStopMixMonitor','voiceQueues','VoiceQueues','showVoiceQueues','voiceQueuesPreview','voiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','Outbound','OutboundChannels','agents','Agents','agentCapacity','body','interaction','user','MemberReport','findAll','INTERACTION','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','findOrCreate','interface','SIP/%s','agent','AgentCapacity','telephones','Telephones'];(function(_0x53b263,_0x59bd53){var _0x3a153d=function(_0x27ecdc){while(--_0x27ecdc){_0x53b263['push'](_0x53b263['shift']());}};_0x3a153d(++_0x59bd53);}(_0x5832,0x177));var _0x2583=function(_0x4cbf20,_0x1bfa66){_0x4cbf20=_0x4cbf20-0x0;var _0x582ae4=_0x5832[_0x4cbf20];return _0x582ae4;};'use strict';var BPromise=require(_0x2583('0x0'));var moment=require('moment');var _=require(_0x2583('0x1'));var util=require(_0x2583('0x2'));var db=require('../../mysqldb')['db'];var logger=require(_0x2583('0x3'))(_0x2583('0x4'));var jayson=require(_0x2583('0x5'));var amiClient=jayson[_0x2583('0x6')][_0x2583('0x7')]({'port':0x232a});var mailClient=jayson[_0x2583('0x6')][_0x2583('0x7')]({'port':0x232b});var routingClient=jayson[_0x2583('0x6')][_0x2583('0x7')]({'port':0x232c});function respondWithRpcPromise(_0x3e4204,_0x32f11f,_0x3f374d){return new BPromise(function(_0x524cbb,_0x6e36d2){var _0x2e1a6b=_0x3f374d?_0x3f374d:amiClient;return _0x2e1a6b[_0x2583('0x8')](_0x3e4204,_0x32f11f)[_0x2583('0x9')](function(_0x1aa2ad){if(_0x1aa2ad['error']){if(_0x1aa2ad[_0x2583('0xa')][_0x2583('0xb')]===0x1f4){return _0x6e36d2(_0x1aa2ad['error']['message']);}return _0x524cbb(_0x1aa2ad[_0x2583('0xa')][_0x2583('0xc')]);}else{_0x524cbb(_0x1aa2ad[_0x2583('0xd')]);}})[_0x2583('0xe')](function(_0x53cbd4){_0x6e36d2(_0x53cbd4);});});}function respondWithResult(_0x99c615,_0x20487a){_0x20487a=_0x20487a||0xc8;return function(_0x2f4d3e){if(_0x2f4d3e){return _0x99c615[_0x2583('0xf')](_0x20487a)['json'](_0x2f4d3e);}return _0x99c615[_0x2583('0x10')](0x194);};}function handleError(_0x4acbcf,_0x2f1a25){_0x2f1a25=_0x2f1a25||0x1f4;return function(_0x20eac2){logger[_0x2583('0xa')](_0x20eac2[_0x2583('0x11')]);if(_0x20eac2['name']){delete _0x20eac2[_0x2583('0x12')];}_0x4acbcf['status'](_0x2f1a25)['send'](_0x20eac2);};}function findById(_0x363562){return function(_0x5449ed){if(!_[_0x2583('0x13')](_0x363562)&&!_[_0x2583('0x13')](_0x5449ed)&&!_[_0x2583('0x13')](_0x5449ed[_0x2583('0x14')])){return _[_0x2583('0x15')](_0x5449ed['rows'],function(_0x9776b0){return _0x9776b0['id']==_0x363562;});}return null;};}exports[_0x2583('0x16')]=function(_0x54e8ba,_0x5a7b60){return respondWithRpcPromise('VoiceChannels',_0x54e8ba[_0x2583('0x17')])['then'](respondWithResult(_0x5a7b60,null))['catch'](handleError(_0x5a7b60,null));};exports['voiceChannelMixMonitor']=function(_0x274a77,_0x34e7da){return respondWithRpcPromise(_0x2583('0x18'),_[_0x2583('0x19')](_0x274a77[_0x2583('0x17')],_0x274a77[_0x2583('0x1a')]))['then'](respondWithResult(_0x34e7da,null))[_0x2583('0xe')](handleError(_0x34e7da,null));};exports['voiceChannelStopMixMonitor']=function(_0x36353b,_0xda4a69){return respondWithRpcPromise(_0x2583('0x1b'),_[_0x2583('0x19')](_0x36353b[_0x2583('0x17')],_0x36353b['params']))[_0x2583('0x9')](respondWithResult(_0xda4a69,null))[_0x2583('0xe')](handleError(_0xda4a69,null));};exports[_0x2583('0x1c')]=function(_0x25579a,_0x221eab){return respondWithRpcPromise(_0x2583('0x1d'),_0x25579a[_0x2583('0x17')])[_0x2583('0x9')](respondWithResult(_0x221eab,null))[_0x2583('0xe')](handleError(_0x221eab,null));};exports[_0x2583('0x1e')]=function(_0x2c5016,_0x2403b2){return respondWithRpcPromise(_0x2583('0x1d'),_0x2c5016[_0x2583('0x17')])[_0x2583('0x9')](findById(_0x2c5016[_0x2583('0x1a')]['id']))[_0x2583('0x9')](respondWithResult(_0x2403b2,null))['catch'](handleError(_0x2403b2,null));};exports[_0x2583('0x1f')]=function(_0x24a34d,_0x2728aa){return respondWithRpcPromise('VoiceQueuesPreview',_[_0x2583('0x19')](_0x24a34d[_0x2583('0x17')],_0x24a34d[_0x2583('0x1a')]))[_0x2583('0x9')](respondWithResult(_0x2728aa,null))['catch'](handleError(_0x2728aa,null));};exports[_0x2583('0x20')]=function(_0xa7de19,_0x262758){return respondWithRpcPromise('VoiceQueuesChannels',_0xa7de19[_0x2583('0x17')])[_0x2583('0x9')](respondWithResult(_0x262758,null))[_0x2583('0xe')](handleError(_0x262758,null));};exports[_0x2583('0x21')]=function(_0x43bf91,_0x55bc69){return respondWithRpcPromise(_0x2583('0x22'),_[_0x2583('0x19')](_0x43bf91[_0x2583('0x17')],_0x43bf91[_0x2583('0x1a')]))['then'](respondWithResult(_0x55bc69,null))[_0x2583('0xe')](handleError(_0x55bc69,null));};exports[_0x2583('0x23')]=function(_0x28fd2c,_0x89b935){return respondWithRpcPromise(_0x2583('0x24'),_['merge'](_0x28fd2c[_0x2583('0x17')],_0x28fd2c['params']))[_0x2583('0x9')](respondWithResult(_0x89b935,null))[_0x2583('0xe')](handleError(_0x89b935,null));};exports[_0x2583('0x25')]=function(_0x5ba295,_0x196ac9){return respondWithRpcPromise(_0x2583('0x26'),_[_0x2583('0x19')](_0x5ba295[_0x2583('0x17')],_0x5ba295[_0x2583('0x1a')]))['then'](respondWithResult(_0x196ac9,null))['catch'](handleError(_0x196ac9,null));};exports['outbound']=function(_0x3131f8,_0x1fb458){return respondWithRpcPromise(_0x2583('0x27'),_0x3131f8[_0x2583('0x17')])[_0x2583('0x9')](respondWithResult(_0x1fb458,null))['catch'](handleError(_0x1fb458,null));};exports['outboundChannels']=function(_0x473081,_0x20f3e9){return respondWithRpcPromise(_0x2583('0x28'),_0x473081[_0x2583('0x17')])[_0x2583('0x9')](respondWithResult(_0x20f3e9,null))[_0x2583('0xe')](handleError(_0x20f3e9,null));};exports[_0x2583('0x29')]=function(_0x1bc8d7,_0x256b67){var _0x8cad7;return respondWithRpcPromise(_0x2583('0x2a'),_0x1bc8d7[_0x2583('0x17')])[_0x2583('0x9')](function(_0x9f0fac){_0x8cad7=_0x9f0fac;return respondWithRpcPromise(_0x2583('0x2a'),_0x1bc8d7['query'],routingClient);})[_0x2583('0x9')](function(_0xbf1b77){return _[_0x2583('0x19')]({},_0xbf1b77,_0x8cad7);})[_0x2583('0x9')](respondWithResult(_0x256b67,null))[_0x2583('0xe')](handleError(_0x256b67,null));};exports[_0x2583('0x2b')]=function(_0x5e1651,_0x2820b6){if(_0x5e1651[_0x2583('0x2c')]&&_0x5e1651['body'][_0x2583('0x2d')]&&_0x5e1651[_0x2583('0x2e')]&&_0x5e1651['user'][_0x2583('0x12')]){for(var _0xdda01d in _0x5e1651[_0x2583('0x2c')]['interaction']){if(_0x5e1651[_0x2583('0x2c')][_0x2583('0x2d')]['hasOwnProperty'](_0xdda01d)){db[_0x2583('0x2f')][_0x2583('0x30')]({'where':{'channel':_0xdda01d,'membername':_0x5e1651['user'][_0x2583('0x12')],'type':_0x2583('0x31'),'exitAt':null,'uniqueid':_0x5e1651['body'][_0x2583('0x2d')][_0xdda01d]&&_0x5e1651[_0x2583('0x2c')]['interaction'][_0xdda01d][_0x2583('0x32')]?{'$notIn':_0x5e1651['body'][_0x2583('0x2d')][_0xdda01d]}:{'$ne':null}}})[_0x2583('0x9')](function(_0x4c830d){var _0x3eafbc=moment()[_0x2583('0x33')](_0x2583('0x34'));for(var _0x11da4b=0x0,_0x57fdba=_0x4c830d[_0x2583('0x32')];_0x11da4b<_0x57fdba;_0x11da4b+=0x1){_0x4c830d[_0x11da4b][_0x2583('0x35')]({'exitAt':_0x3eafbc});}});for(var _0x5d358b=0x0;_0x5d358b<_0x5e1651[_0x2583('0x2c')][_0x2583('0x2d')][_0xdda01d][_0x2583('0x32')];_0x5d358b+=0x1){db[_0x2583('0x2f')][_0x2583('0x36')]({'where':{'channel':_0xdda01d,'membername':_0x5e1651[_0x2583('0x2e')][_0x2583('0x12')],'type':_0x2583('0x31'),'uniqueid':_0x5e1651[_0x2583('0x2c')][_0x2583('0x2d')][_0xdda01d][_0x5d358b],'exitAt':null},'defaults':{'channel':_0xdda01d,'membername':_0x5e1651[_0x2583('0x2e')]['name'],'interface':_[_0x2583('0x13')](_0x5e1651['user'][_0x2583('0x37')])?util['format'](_0x2583('0x38'),_0x5e1651[_0x2583('0x2e')]['name']):_0x5e1651['user'][_0x2583('0x37')],'type':_0x2583('0x31'),'enterAt':moment()[_0x2583('0x33')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x2583('0x39'),'internal':_0x5e1651[_0x2583('0x2e')]['internal'],'uniqueid':_0x5e1651['body'][_0x2583('0x2d')][_0xdda01d][_0x5d358b]}});}}}}return respondWithRpcPromise(_0x2583('0x3a'),{'id':_0x5e1651[_0x2583('0x1a')]['id'],'capacity':_0x5e1651[_0x2583('0x2c')]['capacity']},routingClient)[_0x2583('0x9')](respondWithResult(_0x2820b6,null))[_0x2583('0xe')](handleError(_0x2820b6,null));};exports[_0x2583('0x3b')]=function(_0x26cbce,_0x3a8450){return respondWithRpcPromise(_0x2583('0x3c'),_0x26cbce[_0x2583('0x17')])[_0x2583('0x9')](respondWithResult(_0x3a8450,null))[_0x2583('0xe')](handleError(_0x3a8450,null));};exports['trunks']=function(_0x541483,_0x3b072c){return respondWithRpcPromise(_0x2583('0x3d'),_0x541483[_0x2583('0x17')])[_0x2583('0x9')](respondWithResult(_0x3b072c,null))[_0x2583('0xe')](handleError(_0x3b072c,null));};exports[_0x2583('0x3e')]=function(_0x1bea0c,_0x16df8c){return respondWithRpcPromise('Campaigns',_0x1bea0c[_0x2583('0x17')])['then'](respondWithResult(_0x16df8c,null))[_0x2583('0xe')](handleError(_0x16df8c,null));};exports[_0x2583('0x3f')]=function(_0x3df9e5,_0x5bed55){return respondWithRpcPromise('ChatQueues',_0x3df9e5[_0x2583('0x17')],routingClient)[_0x2583('0x9')](respondWithResult(_0x5bed55,null))['catch'](handleError(_0x5bed55,null));};exports[_0x2583('0x40')]=function(_0x50f9ed,_0x5552cc){return respondWithRpcPromise(_0x2583('0x41'),_0x50f9ed[_0x2583('0x17')],routingClient)[_0x2583('0x9')](findById(_0x50f9ed[_0x2583('0x1a')]['id']))[_0x2583('0x9')](respondWithResult(_0x5552cc,null))['catch'](handleError(_0x5552cc,null));};exports['mailQueues']=function(_0x528181,_0x4037f5){return respondWithRpcPromise(_0x2583('0x42'),_0x528181['query'],routingClient)['then'](respondWithResult(_0x4037f5,null))[_0x2583('0xe')](handleError(_0x4037f5,null));};exports[_0x2583('0x43')]=function(_0x4cf5c1,_0x18325d){return respondWithRpcPromise(_0x2583('0x42'),_0x4cf5c1['query'],routingClient)[_0x2583('0x9')](findById(_0x4cf5c1['params']['id']))[_0x2583('0x9')](respondWithResult(_0x18325d,null))[_0x2583('0xe')](handleError(_0x18325d,null));};exports['mailAccounts']=function(_0x232475,_0x352321){return respondWithRpcPromise(_0x2583('0x44'),_0x232475[_0x2583('0x17')],mailClient)['then'](respondWithResult(_0x352321,null))[_0x2583('0xe')](handleError(_0x352321,null));};exports['openchannelQueues']=function(_0x280da0,_0xb0a26d){return respondWithRpcPromise('OpenchannelQueues',_0x280da0[_0x2583('0x17')],routingClient)[_0x2583('0x9')](respondWithResult(_0xb0a26d,null))[_0x2583('0xe')](handleError(_0xb0a26d,null));};exports[_0x2583('0x45')]=function(_0x4a335d,_0x3bbc50){return respondWithRpcPromise('OpenchannelQueues',_0x4a335d[_0x2583('0x17')],routingClient)['then'](findById(_0x4a335d[_0x2583('0x1a')]['id']))[_0x2583('0x9')](respondWithResult(_0x3bbc50,null))[_0x2583('0xe')](handleError(_0x3bbc50,null));};exports[_0x2583('0x46')]=function(_0x2c093d,_0x35cf96){return respondWithRpcPromise('SmsQueues',_0x2c093d[_0x2583('0x17')],routingClient)[_0x2583('0x9')](respondWithResult(_0x35cf96,null))[_0x2583('0xe')](handleError(_0x35cf96,null));};exports[_0x2583('0x47')]=function(_0x4d026b,_0x2da346){return respondWithRpcPromise(_0x2583('0x48'),_0x4d026b[_0x2583('0x17')],routingClient)['then'](findById(_0x4d026b[_0x2583('0x1a')]['id']))[_0x2583('0x9')](respondWithResult(_0x2da346,null))[_0x2583('0xe')](handleError(_0x2da346,null));};exports[_0x2583('0x49')]=function(_0x29d9be,_0x58e438){return respondWithRpcPromise('FaxQueues',_0x29d9be['query'],routingClient)[_0x2583('0x9')](respondWithResult(_0x58e438,null))[_0x2583('0xe')](handleError(_0x58e438,null));};exports[_0x2583('0x4a')]=function(_0x4479f5,_0x358d33){return respondWithRpcPromise('FaxQueues',_0x4479f5[_0x2583('0x17')],routingClient)['then'](findById(_0x4479f5[_0x2583('0x1a')]['id']))[_0x2583('0x9')](respondWithResult(_0x358d33,null))['catch'](handleError(_0x358d33,null));};exports[_0x2583('0x4b')]=function(_0x57506a,_0x4b7ed0){return respondWithRpcPromise(_0x2583('0x4c'),_0x57506a['query'])[_0x2583('0x9')](respondWithResult(_0x4b7ed0,null))[_0x2583('0xe')](handleError(_0x4b7ed0,null));};exports[_0x2583('0x4d')]=function(_0x66cd53,_0x3a727a){return respondWithRpcPromise(_0x2583('0x4e'),_0x66cd53[_0x2583('0x17')],routingClient)[_0x2583('0x9')](respondWithResult(_0x3a727a,null))['catch'](handleError(_0x3a727a,null));};exports['mailQueuesWaitingInteractions']=function(_0x3e3775,_0x42b961){return respondWithRpcPromise(_0x2583('0x4f'),_0x3e3775[_0x2583('0x17')],routingClient)[_0x2583('0x9')](respondWithResult(_0x42b961,null))[_0x2583('0xe')](handleError(_0x42b961,null));};exports[_0x2583('0x50')]=function(_0x266379,_0x5e7136){return respondWithRpcPromise(_0x2583('0x51'),_0x266379[_0x2583('0x17')],routingClient)[_0x2583('0x9')](respondWithResult(_0x5e7136,null))[_0x2583('0xe')](handleError(_0x5e7136,null));};exports[_0x2583('0x52')]=function(_0x2f6cf7,_0x3fc8ac){return respondWithRpcPromise('SmsQueuesWaitingInteractions',_0x2f6cf7[_0x2583('0x17')],routingClient)[_0x2583('0x9')](respondWithResult(_0x3fc8ac,null))[_0x2583('0xe')](handleError(_0x3fc8ac,null));};exports['faxQueuesWaitingInteractions']=function(_0x1a1879,_0x32c0ba){return respondWithRpcPromise(_0x2583('0x53'),_0x1a1879[_0x2583('0x17')],routingClient)[_0x2583('0x9')](respondWithResult(_0x32c0ba,null))[_0x2583('0xe')](handleError(_0x32c0ba,null));};exports['queueNotify']=function(_0x40369a){return function(_0x329190,_0x507f51){var _0x29c974,_0x123429;var _0x21955d=_[_0x2583('0x54')](_0x40369a);var _0x3f96d4=_0x40369a===_0x2583('0x55')?_0x2583('0x56'):_0x2583('0x57');return db[_0x21955d+_0x2583('0x58')][_0x2583('0x59')]({'raw':!![],'where':{'id':_0x329190[_0x2583('0x1a')]['id']}})[_0x2583('0x9')](function(_0x1e4831){if(_[_0x2583('0x13')](_0x1e4831)){throw new Error(_0x21955d+_0x2583('0x5a'));}_0x29c974=_0x1e4831;return db[_0x21955d+_0x2583('0x5b')]['findOne']({'where':{'id':_0x329190['body']['messageId']},'include':[{'model':db[_0x21955d+_0x2583('0x5c')],'as':_0x2583('0x5c')},{'model':db[_0x21955d+_0x3f96d4],'as':_0x2583('0x57')}]});})[_0x2583('0x9')](function(_0x115a7c){if(_['isNil'](_0x115a7c)){throw new Error(_0x21955d+_0x2583('0x5d'));}_0x123429=_0x115a7c;return _0x115a7c[_0x2583('0x5e')]({'read':0x0,'readAt':null,'UserId':null});})[_0x2583('0x9')](function(){var _0x57cdaa={'uniqueid':_0x40369a+'.'+_0x123429['id']+'.'+_0x123429[_0x2583('0x5c')]['id'],'FromUserId':_0x329190[_0x2583('0x2e')]['id'],'type':_0x2583('0x5f')};_0x57cdaa[_0x21955d+'MessageId']=_0x123429['id'];_0x57cdaa[_0x21955d+_0x2583('0x60')]=_0x123429[_0x2583('0x5c')]['id'];_0x57cdaa[_0x2583('0x61')+_0x21955d+_0x3f96d4+'Id']=_0x123429[_0x2583('0x57')]['id'];_0x57cdaa['To'+_0x21955d+_0x2583('0x62')]=_0x29c974['id'];return db[_0x21955d+'TransferReport'][_0x2583('0x63')](_0x57cdaa);})[_0x2583('0x9')](function(){return respondWithRpcPromise(_0x2583('0x64'),{'channel':_0x40369a,'interaction':_0x123429['Interaction'],'message':_0x123429,'account':_0x123429[_0x2583('0x57')],'applications':[{'id':0x0,'priority':0x1,'app':_0x2583('0x5f'),'appdata':_0x29c974[_0x2583('0x12')]+','+(_0x123429[_0x2583('0x57')][_0x2583('0x65')]||0x12c),'interval':_0x2583('0x66')}]},routingClient);})[_0x2583('0x9')](respondWithResult(_0x507f51,null))[_0x2583('0xe')](handleError(_0x507f51,null));};};exports[_0x2583('0x67')]=function(_0x1c7528,_0x333103){var _0x6751c1,_0x691c1f;if(_[_0x2583('0x13')](_0x1c7528[_0x2583('0x2c')][_0x2583('0x68')])){throw new Error('Channel\x20field\x20is\x20mandatory');}var _0x41b3c3=_0x1c7528['body'][_0x2583('0x68')];var _0x1e9c20=_[_0x2583('0x54')](_0x41b3c3);var _0x3bf400=_0x41b3c3===_0x2583('0x55')?_0x2583('0x56'):_0x2583('0x57');return db[_0x2583('0x69')]['findOne']({'raw':!![],'where':{'id':_0x1c7528[_0x2583('0x1a')]['id'],'role':'agent'}})['then'](function(_0x52060d){if(_[_0x2583('0x13')](_0x52060d)){throw new Error(_0x2583('0x6a'));}_0x6751c1=_0x52060d;return db[_0x1e9c20+'Message'][_0x2583('0x59')]({'where':{'id':_0x1c7528[_0x2583('0x2c')]['messageId']},'include':[{'model':db[_0x1e9c20+'Interaction'],'as':_0x2583('0x5c')},{'model':db[_0x1e9c20+_0x3bf400],'as':_0x2583('0x57')}]});})[_0x2583('0x9')](function(_0x8e697b){if(_[_0x2583('0x13')](_0x8e697b)){throw new Error(_0x1e9c20+_0x2583('0x5d'));}_0x691c1f=_0x8e697b;return _0x8e697b['update']({'read':0x0,'readAt':null,'UserId':null});})[_0x2583('0x9')](function(){var _0x328a17={'uniqueid':_0x41b3c3+'.'+_0x691c1f['id']+'.'+_0x691c1f[_0x2583('0x5c')]['id'],'FromUserId':_0x1c7528[_0x2583('0x2e')]['id'],'type':_0x2583('0x5f'),'ToUserId':_0x6751c1['id']};_0x328a17[_0x1e9c20+_0x2583('0x6b')]=_0x691c1f['id'];_0x328a17[_0x1e9c20+'InteractionId']=_0x691c1f[_0x2583('0x5c')]['id'];_0x328a17['From'+_0x1e9c20+_0x3bf400+'Id']=_0x691c1f['Account']['id'];return db[_0x1e9c20+_0x2583('0x6c')][_0x2583('0x63')](_0x328a17);})['then'](function(){return respondWithRpcPromise(_0x2583('0x64'),{'channel':_0x41b3c3,'interaction':_0x691c1f[_0x2583('0x5c')],'message':_0x691c1f,'account':_0x691c1f[_0x2583('0x57')],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0x6751c1[_0x2583('0x12')]+','+(_0x691c1f[_0x2583('0x57')]['agentTransferTimeout']||0x12c),'interval':_0x2583('0x66')}]},routingClient);})['then'](respondWithResult(_0x333103,null))[_0x2583('0xe')](handleError(_0x333103,null));}; \ No newline at end of file +var _0x91d1=['../../mysqldb','../../config/logger','api','jayson/promise','client','http','request','then','error','code','message','result','catch','status','json','sendStatus','stack','name','send','isNil','rows','voiceChannels','VoiceChannels','query','merge','params','VoiceQueues','showVoiceQueues','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','outboundChannels','Agents','interaction','body','hasOwnProperty','MemberReport','findAll','user','INTERACTION','format','YYYY-MM-DD\x20HH:mm:ss','length','updateAttributes','interface','SIP/%s','internal','AgentCapacity','Telephones','Trunks','campaigns','Campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','MailQueues','showMailQueues','mailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','SmsQueues','showSmsQueues','showFaxQueues','FaxQueues','faxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','chat','Account','\x20Queue\x20not\x20found','findOne','messageId','Interaction','\x20Message\x20not\x20found','update','queue','MessageId','InteractionId','From','QueueId','Start','queueTransferTimeout','*,*,*,*','channel','Channel\x20field\x20is\x20mandatory','Website','User','agent','Agent\x20not\x20found','Message','TransferReport','create','agentTransferTimeout','bluebird','moment','lodash','util'];(function(_0x368dbc,_0x1b3ddc){var _0x257b6b=function(_0x4cef54){while(--_0x4cef54){_0x368dbc['push'](_0x368dbc['shift']());}};_0x257b6b(++_0x1b3ddc);}(_0x91d1,0xe0));var _0x191d=function(_0x567751,_0x4287c3){_0x567751=_0x567751-0x0;var _0x21a84c=_0x91d1[_0x567751];return _0x21a84c;};'use strict';var BPromise=require(_0x191d('0x0'));var moment=require(_0x191d('0x1'));var _=require(_0x191d('0x2'));var util=require(_0x191d('0x3'));var db=require(_0x191d('0x4'))['db'];var logger=require(_0x191d('0x5'))(_0x191d('0x6'));var jayson=require(_0x191d('0x7'));var amiClient=jayson[_0x191d('0x8')][_0x191d('0x9')]({'port':0x232a});var mailClient=jayson['client'][_0x191d('0x9')]({'port':0x232b});var routingClient=jayson[_0x191d('0x8')][_0x191d('0x9')]({'port':0x232c});function respondWithRpcPromise(_0x16bf50,_0x196e24,_0x562570){return new BPromise(function(_0x2ba188,_0x165ea4){var _0x2ab2be=_0x562570?_0x562570:amiClient;return _0x2ab2be[_0x191d('0xa')](_0x16bf50,_0x196e24)[_0x191d('0xb')](function(_0xe2b28a){if(_0xe2b28a[_0x191d('0xc')]){if(_0xe2b28a[_0x191d('0xc')][_0x191d('0xd')]===0x1f4){return _0x165ea4(_0xe2b28a[_0x191d('0xc')][_0x191d('0xe')]);}return _0x2ba188(_0xe2b28a[_0x191d('0xc')]['message']);}else{_0x2ba188(_0xe2b28a[_0x191d('0xf')]);}})[_0x191d('0x10')](function(_0x47247c){_0x165ea4(_0x47247c);});});}function respondWithResult(_0x4808a7,_0x3f5ff1){_0x3f5ff1=_0x3f5ff1||0xc8;return function(_0x254238){if(_0x254238){return _0x4808a7[_0x191d('0x11')](_0x3f5ff1)[_0x191d('0x12')](_0x254238);}return _0x4808a7[_0x191d('0x13')](0x194);};}function handleError(_0x3e221f,_0x2e14f4){_0x2e14f4=_0x2e14f4||0x1f4;return function(_0x1745a8){logger[_0x191d('0xc')](_0x1745a8[_0x191d('0x14')]);if(_0x1745a8[_0x191d('0x15')]){delete _0x1745a8[_0x191d('0x15')];}_0x3e221f[_0x191d('0x11')](_0x2e14f4)[_0x191d('0x16')](_0x1745a8);};}function findById(_0x86465b){return function(_0x47bfad){if(!_['isNil'](_0x86465b)&&!_[_0x191d('0x17')](_0x47bfad)&&!_['isNil'](_0x47bfad['rows'])){return _['find'](_0x47bfad[_0x191d('0x18')],function(_0xfcd170){return _0xfcd170['id']==_0x86465b;});}return null;};}exports[_0x191d('0x19')]=function(_0x278c6c,_0x2b5888){return respondWithRpcPromise(_0x191d('0x1a'),_0x278c6c[_0x191d('0x1b')])[_0x191d('0xb')](respondWithResult(_0x2b5888,null))['catch'](handleError(_0x2b5888,null));};exports['voiceChannelMixMonitor']=function(_0x569c7b,_0x39aa97){return respondWithRpcPromise('VoiceChannelMixMonitor',_[_0x191d('0x1c')](_0x569c7b['query'],_0x569c7b[_0x191d('0x1d')]))['then'](respondWithResult(_0x39aa97,null))[_0x191d('0x10')](handleError(_0x39aa97,null));};exports['voiceChannelStopMixMonitor']=function(_0x98cf43,_0xb16f64){return respondWithRpcPromise('VoiceChannelStopMixMonitor',_[_0x191d('0x1c')](_0x98cf43[_0x191d('0x1b')],_0x98cf43['params']))[_0x191d('0xb')](respondWithResult(_0xb16f64,null))['catch'](handleError(_0xb16f64,null));};exports['voiceQueues']=function(_0x1d3085,_0xcc7a6b){return respondWithRpcPromise(_0x191d('0x1e'),_0x1d3085[_0x191d('0x1b')])[_0x191d('0xb')](respondWithResult(_0xcc7a6b,null))[_0x191d('0x10')](handleError(_0xcc7a6b,null));};exports[_0x191d('0x1f')]=function(_0x1abd93,_0x1f4115){return respondWithRpcPromise(_0x191d('0x1e'),_0x1abd93[_0x191d('0x1b')])[_0x191d('0xb')](findById(_0x1abd93[_0x191d('0x1d')]['id']))[_0x191d('0xb')](respondWithResult(_0x1f4115,null))[_0x191d('0x10')](handleError(_0x1f4115,null));};exports[_0x191d('0x20')]=function(_0x41fdcd,_0x4f5655){return respondWithRpcPromise(_0x191d('0x21'),_[_0x191d('0x1c')](_0x41fdcd[_0x191d('0x1b')],_0x41fdcd[_0x191d('0x1d')]))[_0x191d('0xb')](respondWithResult(_0x4f5655,null))['catch'](handleError(_0x4f5655,null));};exports[_0x191d('0x22')]=function(_0x3d75a2,_0x2ce9a5){return respondWithRpcPromise(_0x191d('0x23'),_0x3d75a2['query'])[_0x191d('0xb')](respondWithResult(_0x2ce9a5,null))['catch'](handleError(_0x2ce9a5,null));};exports[_0x191d('0x24')]=function(_0x493f62,_0x521402){return respondWithRpcPromise('VoiceQueuesChannel',_[_0x191d('0x1c')](_0x493f62['query'],_0x493f62[_0x191d('0x1d')]))[_0x191d('0xb')](respondWithResult(_0x521402,null))['catch'](handleError(_0x521402,null));};exports[_0x191d('0x25')]=function(_0x2442cc,_0x4cf0d0){return respondWithRpcPromise(_0x191d('0x26'),_[_0x191d('0x1c')](_0x2442cc[_0x191d('0x1b')],_0x2442cc[_0x191d('0x1d')]))[_0x191d('0xb')](respondWithResult(_0x4cf0d0,null))[_0x191d('0x10')](handleError(_0x4cf0d0,null));};exports[_0x191d('0x27')]=function(_0x5db759,_0x2eb7a5){return respondWithRpcPromise(_0x191d('0x28'),_[_0x191d('0x1c')](_0x5db759['query'],_0x5db759[_0x191d('0x1d')]))[_0x191d('0xb')](respondWithResult(_0x2eb7a5,null))[_0x191d('0x10')](handleError(_0x2eb7a5,null));};exports[_0x191d('0x29')]=function(_0xb0096c,_0x3bcf1c){return respondWithRpcPromise('Outbound',_0xb0096c[_0x191d('0x1b')])[_0x191d('0xb')](respondWithResult(_0x3bcf1c,null))['catch'](handleError(_0x3bcf1c,null));};exports[_0x191d('0x2a')]=function(_0x577691,_0x34b12b){return respondWithRpcPromise('OutboundChannels',_0x577691[_0x191d('0x1b')])[_0x191d('0xb')](respondWithResult(_0x34b12b,null))[_0x191d('0x10')](handleError(_0x34b12b,null));};exports['agents']=function(_0x10a272,_0x5bcdc7){var _0x5bc586;return respondWithRpcPromise(_0x191d('0x2b'),_0x10a272['query'])[_0x191d('0xb')](function(_0x2c44bc){_0x5bc586=_0x2c44bc;return respondWithRpcPromise(_0x191d('0x2b'),_0x10a272['query'],routingClient);})[_0x191d('0xb')](function(_0x1ea465){return _['merge']({},_0x1ea465,_0x5bc586);})[_0x191d('0xb')](respondWithResult(_0x5bcdc7,null))[_0x191d('0x10')](handleError(_0x5bcdc7,null));};exports['agentCapacity']=function(_0x553e2c,_0x6308e8){if(_0x553e2c['body']&&_0x553e2c['body'][_0x191d('0x2c')]&&_0x553e2c['user']&&_0x553e2c['user'][_0x191d('0x15')]){for(var _0xbf7123 in _0x553e2c[_0x191d('0x2d')][_0x191d('0x2c')]){if(_0x553e2c[_0x191d('0x2d')][_0x191d('0x2c')][_0x191d('0x2e')](_0xbf7123)){db[_0x191d('0x2f')][_0x191d('0x30')]({'where':{'channel':_0xbf7123,'membername':_0x553e2c[_0x191d('0x31')][_0x191d('0x15')],'type':_0x191d('0x32'),'exitAt':null,'uniqueid':_0x553e2c[_0x191d('0x2d')]['interaction'][_0xbf7123]&&_0x553e2c[_0x191d('0x2d')][_0x191d('0x2c')][_0xbf7123]['length']?{'$notIn':_0x553e2c[_0x191d('0x2d')]['interaction'][_0xbf7123]}:{'$ne':null}}})[_0x191d('0xb')](function(_0x5ee72b){var _0x599199=moment()[_0x191d('0x33')](_0x191d('0x34'));for(var _0x4e957b=0x0,_0x16fbf3=_0x5ee72b[_0x191d('0x35')];_0x4e957b<_0x16fbf3;_0x4e957b+=0x1){_0x5ee72b[_0x4e957b][_0x191d('0x36')]({'exitAt':_0x599199});}});for(var _0x164d3d=0x0;_0x164d3d<_0x553e2c[_0x191d('0x2d')][_0x191d('0x2c')][_0xbf7123][_0x191d('0x35')];_0x164d3d+=0x1){db[_0x191d('0x2f')]['findOrCreate']({'where':{'channel':_0xbf7123,'membername':_0x553e2c['user']['name'],'type':'INTERACTION','uniqueid':_0x553e2c['body'][_0x191d('0x2c')][_0xbf7123][_0x164d3d],'exitAt':null},'defaults':{'channel':_0xbf7123,'membername':_0x553e2c[_0x191d('0x31')]['name'],'interface':_[_0x191d('0x17')](_0x553e2c[_0x191d('0x31')][_0x191d('0x37')])?util[_0x191d('0x33')](_0x191d('0x38'),_0x553e2c[_0x191d('0x31')]['name']):_0x553e2c[_0x191d('0x31')][_0x191d('0x37')],'type':_0x191d('0x32'),'enterAt':moment()[_0x191d('0x33')]('YYYY-MM-DD\x20HH:mm:ss'),'role':'agent','internal':_0x553e2c[_0x191d('0x31')][_0x191d('0x39')],'uniqueid':_0x553e2c['body'][_0x191d('0x2c')][_0xbf7123][_0x164d3d]}});}}}}return respondWithRpcPromise(_0x191d('0x3a'),{'id':_0x553e2c[_0x191d('0x1d')]['id'],'capacity':_0x553e2c[_0x191d('0x2d')]['capacity']},routingClient)['then'](respondWithResult(_0x6308e8,null))[_0x191d('0x10')](handleError(_0x6308e8,null));};exports['telephones']=function(_0x49e39c,_0x50178c){return respondWithRpcPromise(_0x191d('0x3b'),_0x49e39c[_0x191d('0x1b')])[_0x191d('0xb')](respondWithResult(_0x50178c,null))[_0x191d('0x10')](handleError(_0x50178c,null));};exports['trunks']=function(_0x1aaa77,_0xe6d71a){return respondWithRpcPromise(_0x191d('0x3c'),_0x1aaa77[_0x191d('0x1b')])[_0x191d('0xb')](respondWithResult(_0xe6d71a,null))[_0x191d('0x10')](handleError(_0xe6d71a,null));};exports[_0x191d('0x3d')]=function(_0x4dc6fa,_0x285caf){return respondWithRpcPromise(_0x191d('0x3e'),_0x4dc6fa[_0x191d('0x1b')])[_0x191d('0xb')](respondWithResult(_0x285caf,null))[_0x191d('0x10')](handleError(_0x285caf,null));};exports[_0x191d('0x3f')]=function(_0x3e28ff,_0x5ef739){return respondWithRpcPromise(_0x191d('0x40'),_0x3e28ff[_0x191d('0x1b')],routingClient)[_0x191d('0xb')](respondWithResult(_0x5ef739,null))['catch'](handleError(_0x5ef739,null));};exports[_0x191d('0x41')]=function(_0x5826e4,_0x235a42){return respondWithRpcPromise(_0x191d('0x40'),_0x5826e4['query'],routingClient)[_0x191d('0xb')](findById(_0x5826e4[_0x191d('0x1d')]['id']))[_0x191d('0xb')](respondWithResult(_0x235a42,null))['catch'](handleError(_0x235a42,null));};exports[_0x191d('0x42')]=function(_0x147aa3,_0x35a106){return respondWithRpcPromise(_0x191d('0x43'),_0x147aa3[_0x191d('0x1b')],routingClient)[_0x191d('0xb')](respondWithResult(_0x35a106,null))[_0x191d('0x10')](handleError(_0x35a106,null));};exports[_0x191d('0x44')]=function(_0x3b8a26,_0x183436){return respondWithRpcPromise(_0x191d('0x43'),_0x3b8a26[_0x191d('0x1b')],routingClient)[_0x191d('0xb')](findById(_0x3b8a26['params']['id']))[_0x191d('0xb')](respondWithResult(_0x183436,null))[_0x191d('0x10')](handleError(_0x183436,null));};exports[_0x191d('0x45')]=function(_0x397cd0,_0x5c1ae8){return respondWithRpcPromise('MailAccounts',_0x397cd0[_0x191d('0x1b')],mailClient)[_0x191d('0xb')](respondWithResult(_0x5c1ae8,null))[_0x191d('0x10')](handleError(_0x5c1ae8,null));};exports[_0x191d('0x46')]=function(_0xa27094,_0xe70012){return respondWithRpcPromise(_0x191d('0x47'),_0xa27094[_0x191d('0x1b')],routingClient)[_0x191d('0xb')](respondWithResult(_0xe70012,null))['catch'](handleError(_0xe70012,null));};exports[_0x191d('0x48')]=function(_0xbbfb21,_0x1d6334){return respondWithRpcPromise(_0x191d('0x47'),_0xbbfb21[_0x191d('0x1b')],routingClient)[_0x191d('0xb')](findById(_0xbbfb21[_0x191d('0x1d')]['id']))['then'](respondWithResult(_0x1d6334,null))[_0x191d('0x10')](handleError(_0x1d6334,null));};exports['smsQueues']=function(_0x1d8cee,_0x1a39ea){return respondWithRpcPromise(_0x191d('0x49'),_0x1d8cee[_0x191d('0x1b')],routingClient)[_0x191d('0xb')](respondWithResult(_0x1a39ea,null))[_0x191d('0x10')](handleError(_0x1a39ea,null));};exports[_0x191d('0x4a')]=function(_0x5b7e77,_0x119909){return respondWithRpcPromise(_0x191d('0x49'),_0x5b7e77[_0x191d('0x1b')],routingClient)['then'](findById(_0x5b7e77[_0x191d('0x1d')]['id']))['then'](respondWithResult(_0x119909,null))[_0x191d('0x10')](handleError(_0x119909,null));};exports['faxQueues']=function(_0x49be3d,_0x123a1f){return respondWithRpcPromise('FaxQueues',_0x49be3d[_0x191d('0x1b')],routingClient)[_0x191d('0xb')](respondWithResult(_0x123a1f,null))[_0x191d('0x10')](handleError(_0x123a1f,null));};exports[_0x191d('0x4b')]=function(_0x3055e7,_0x1e8aea){return respondWithRpcPromise(_0x191d('0x4c'),_0x3055e7[_0x191d('0x1b')],routingClient)[_0x191d('0xb')](findById(_0x3055e7[_0x191d('0x1d')]['id']))['then'](respondWithResult(_0x1e8aea,null))['catch'](handleError(_0x1e8aea,null));};exports[_0x191d('0x4d')]=function(_0x3a916a,_0x46b822){return respondWithRpcPromise('FaxAccounts',_0x3a916a[_0x191d('0x1b')])[_0x191d('0xb')](respondWithResult(_0x46b822,null))[_0x191d('0x10')](handleError(_0x46b822,null));};exports[_0x191d('0x4e')]=function(_0x1a1b69,_0x4943c3){return respondWithRpcPromise(_0x191d('0x4f'),_0x1a1b69[_0x191d('0x1b')],routingClient)['then'](respondWithResult(_0x4943c3,null))[_0x191d('0x10')](handleError(_0x4943c3,null));};exports[_0x191d('0x50')]=function(_0x1c0152,_0xee390a){return respondWithRpcPromise('MailQueuesWaitingInteractions',_0x1c0152[_0x191d('0x1b')],routingClient)[_0x191d('0xb')](respondWithResult(_0xee390a,null))['catch'](handleError(_0xee390a,null));};exports[_0x191d('0x51')]=function(_0x1353ad,_0x15827f){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x1353ad[_0x191d('0x1b')],routingClient)[_0x191d('0xb')](respondWithResult(_0x15827f,null))[_0x191d('0x10')](handleError(_0x15827f,null));};exports[_0x191d('0x52')]=function(_0x3d85a1,_0x46a076){return respondWithRpcPromise(_0x191d('0x53'),_0x3d85a1[_0x191d('0x1b')],routingClient)[_0x191d('0xb')](respondWithResult(_0x46a076,null))[_0x191d('0x10')](handleError(_0x46a076,null));};exports[_0x191d('0x54')]=function(_0xc109d0,_0x49d4f3){return respondWithRpcPromise(_0x191d('0x55'),_0xc109d0['query'],routingClient)[_0x191d('0xb')](respondWithResult(_0x49d4f3,null))[_0x191d('0x10')](handleError(_0x49d4f3,null));};exports[_0x191d('0x56')]=function(_0x1646da){return function(_0x31426f,_0x433aa9){var _0x166658,_0x368886;var _0x15bb89=_[_0x191d('0x57')](_0x1646da);var _0xa7f590=_0x1646da===_0x191d('0x58')?'Website':_0x191d('0x59');return db[_0x15bb89+'Queue']['findOne']({'raw':!![],'where':{'id':_0x31426f['params']['id']}})[_0x191d('0xb')](function(_0x2dc477){if(_['isNil'](_0x2dc477)){throw new Error(_0x15bb89+_0x191d('0x5a'));}_0x166658=_0x2dc477;return db[_0x15bb89+'Message'][_0x191d('0x5b')]({'where':{'id':_0x31426f[_0x191d('0x2d')][_0x191d('0x5c')]},'include':[{'model':db[_0x15bb89+_0x191d('0x5d')],'as':_0x191d('0x5d')},{'model':db[_0x15bb89+_0xa7f590],'as':'Account'}]});})[_0x191d('0xb')](function(_0x23ed90){if(_[_0x191d('0x17')](_0x23ed90)){throw new Error(_0x15bb89+_0x191d('0x5e'));}_0x368886=_0x23ed90;return _0x23ed90[_0x191d('0x5f')]({'read':0x0,'readAt':null,'UserId':null});})[_0x191d('0xb')](function(){var _0x487b5e={'uniqueid':_0x1646da+'.'+_0x368886['id']+'.'+_0x368886['Interaction']['id'],'FromUserId':_0x31426f[_0x191d('0x31')]['id'],'type':_0x191d('0x60')};_0x487b5e[_0x15bb89+_0x191d('0x61')]=_0x368886['id'];_0x487b5e[_0x15bb89+_0x191d('0x62')]=_0x368886[_0x191d('0x5d')]['id'];_0x487b5e[_0x191d('0x63')+_0x15bb89+_0xa7f590+'Id']=_0x368886[_0x191d('0x59')]['id'];_0x487b5e['To'+_0x15bb89+_0x191d('0x64')]=_0x166658['id'];return db[_0x15bb89+'TransferReport']['create'](_0x487b5e);})[_0x191d('0xb')](function(){return respondWithRpcPromise(_0x191d('0x65'),{'channel':_0x1646da,'interaction':_0x368886[_0x191d('0x5d')],'message':_0x368886,'account':_0x368886[_0x191d('0x59')],'applications':[{'id':0x0,'priority':0x1,'app':'queue','appdata':_0x166658[_0x191d('0x15')]+','+(_0x368886[_0x191d('0x59')][_0x191d('0x66')]||0x12c),'interval':_0x191d('0x67')}]},routingClient);})['then'](respondWithResult(_0x433aa9,null))['catch'](handleError(_0x433aa9,null));};};exports['agentNotify']=function(_0x37196f,_0x42ab19){var _0x511d0f,_0x3c349b;if(_[_0x191d('0x17')](_0x37196f['body'][_0x191d('0x68')])){throw new Error(_0x191d('0x69'));}var _0x4116bd=_0x37196f[_0x191d('0x2d')][_0x191d('0x68')];var _0x49212f=_[_0x191d('0x57')](_0x4116bd);var _0x49dbc6=_0x4116bd===_0x191d('0x58')?_0x191d('0x6a'):_0x191d('0x59');return db[_0x191d('0x6b')][_0x191d('0x5b')]({'raw':!![],'where':{'id':_0x37196f[_0x191d('0x1d')]['id'],'role':_0x191d('0x6c')}})[_0x191d('0xb')](function(_0x545c19){if(_['isNil'](_0x545c19)){throw new Error(_0x191d('0x6d'));}_0x511d0f=_0x545c19;return db[_0x49212f+_0x191d('0x6e')][_0x191d('0x5b')]({'where':{'id':_0x37196f[_0x191d('0x2d')]['messageId']},'include':[{'model':db[_0x49212f+_0x191d('0x5d')],'as':_0x191d('0x5d')},{'model':db[_0x49212f+_0x49dbc6],'as':_0x191d('0x59')}]});})[_0x191d('0xb')](function(_0x5bf810){if(_[_0x191d('0x17')](_0x5bf810)){throw new Error(_0x49212f+'\x20Message\x20not\x20found');}_0x3c349b=_0x5bf810;return _0x5bf810[_0x191d('0x5f')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x49265e={'uniqueid':_0x4116bd+'.'+_0x3c349b['id']+'.'+_0x3c349b[_0x191d('0x5d')]['id'],'FromUserId':_0x37196f[_0x191d('0x31')]['id'],'type':'queue','ToUserId':_0x511d0f['id']};_0x49265e[_0x49212f+_0x191d('0x61')]=_0x3c349b['id'];_0x49265e[_0x49212f+_0x191d('0x62')]=_0x3c349b[_0x191d('0x5d')]['id'];_0x49265e[_0x191d('0x63')+_0x49212f+_0x49dbc6+'Id']=_0x3c349b['Account']['id'];return db[_0x49212f+_0x191d('0x6f')][_0x191d('0x70')](_0x49265e);})[_0x191d('0xb')](function(){return respondWithRpcPromise(_0x191d('0x65'),{'channel':_0x4116bd,'interaction':_0x3c349b[_0x191d('0x5d')],'message':_0x3c349b,'account':_0x3c349b[_0x191d('0x59')],'applications':[{'id':0x0,'priority':0x1,'app':_0x191d('0x6c'),'appdata':_0x511d0f[_0x191d('0x15')]+','+(_0x3c349b['Account'][_0x191d('0x71')]||0x12c),'interval':_0x191d('0x67')}]},routingClient);})[_0x191d('0xb')](respondWithResult(_0x42ab19,null))[_0x191d('0x10')](handleError(_0x42ab19,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 9aca56d..c20d7e0 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 _0x94af=['create','put','update','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./schedule.controller','get','isAuthenticated','index','/:id','show','/:id/run','run','post'];(function(_0x5a186e,_0xbf9a12){var _0x20447a=function(_0x5af8d2){while(--_0x5af8d2){_0x5a186e['push'](_0x5a186e['shift']());}};_0x20447a(++_0xbf9a12);}(_0x94af,0x145));var _0xf94a=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0x94af[_0x297fd3];return _0x2af381;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xf94a('0x0'));var timeout=require(_0xf94a('0x1'));var express=require(_0xf94a('0x2'));var router=express[_0xf94a('0x3')]();var auth=require(_0xf94a('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xf94a('0x5'));var controller=require(_0xf94a('0x6'));router[_0xf94a('0x7')]('/',auth[_0xf94a('0x8')](),controller[_0xf94a('0x9')]);router['get'](_0xf94a('0xa'),auth[_0xf94a('0x8')](),controller[_0xf94a('0xb')]);router[_0xf94a('0x7')](_0xf94a('0xc'),auth[_0xf94a('0x8')](),controller[_0xf94a('0xd')]);router[_0xf94a('0xe')]('/',auth[_0xf94a('0x8')](),controller[_0xf94a('0xf')]);router[_0xf94a('0x10')](_0xf94a('0xa'),auth[_0xf94a('0x8')](),controller[_0xf94a('0x11')]);router['delete'](_0xf94a('0xa'),auth[_0xf94a('0x8')](),controller[_0xf94a('0x12')]);module[_0xf94a('0x13')]=router; \ No newline at end of file +var _0xe0c7=['post','create','put','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./schedule.controller','isAuthenticated','index','get','/:id','show','/:id/run','run'];(function(_0x401609,_0x5eb61d){var _0x35fd57=function(_0x5dcddd){while(--_0x5dcddd){_0x401609['push'](_0x401609['shift']());}};_0x35fd57(++_0x5eb61d);}(_0xe0c7,0x1d4));var _0x7e0c=function(_0x137c7d,_0x24221e){_0x137c7d=_0x137c7d-0x0;var _0x6b5ab3=_0xe0c7[_0x137c7d];return _0x6b5ab3;};'use strict';var multer=require(_0x7e0c('0x0'));var util=require(_0x7e0c('0x1'));var path=require(_0x7e0c('0x2'));var timeout=require('connect-timeout');var express=require(_0x7e0c('0x3'));var router=express[_0x7e0c('0x4')]();var auth=require(_0x7e0c('0x5'));var interaction=require(_0x7e0c('0x6'));var config=require(_0x7e0c('0x7'));var controller=require(_0x7e0c('0x8'));router['get']('/',auth[_0x7e0c('0x9')](),controller[_0x7e0c('0xa')]);router[_0x7e0c('0xb')](_0x7e0c('0xc'),auth['isAuthenticated'](),controller[_0x7e0c('0xd')]);router[_0x7e0c('0xb')](_0x7e0c('0xe'),auth[_0x7e0c('0x9')](),controller[_0x7e0c('0xf')]);router[_0x7e0c('0x10')]('/',auth['isAuthenticated'](),controller[_0x7e0c('0x11')]);router[_0x7e0c('0x12')](_0x7e0c('0xc'),auth[_0x7e0c('0x9')](),controller['update']);router[_0x7e0c('0x13')](_0x7e0c('0xc'),auth[_0x7e0c('0x9')](),controller[_0x7e0c('0x14')]);module[_0x7e0c('0x15')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index 74a4438..9b913ff 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 _0x1b9b=['DATE','quarters','months','days','hours','minutes','ENUM','csv','pdf','custom','TEXT','sequelize','STRING','BOOLEAN'];(function(_0xcd9d6,_0x895125){var _0x3801fe=function(_0x79c3af){while(--_0x79c3af){_0xcd9d6['push'](_0xcd9d6['shift']());}};_0x3801fe(++_0x895125);}(_0x1b9b,0x89));var _0xb1b9=function(_0x6f3bd0,_0x93f449){_0x6f3bd0=_0x6f3bd0-0x0;var _0x1c0461=_0x1b9b[_0x6f3bd0];return _0x1c0461;};'use strict';var Sequelize=require(_0xb1b9('0x0'));module['exports']={'name':{'type':Sequelize[_0xb1b9('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xb1b9('0x1')]},'active':{'type':Sequelize[_0xb1b9('0x2')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0xb1b9('0x1')],'allowNull':![],'defaultValue':'0\x200\x20*\x20*\x20*'},'startAt':{'type':Sequelize[_0xb1b9('0x3')],'allowNull':![]},'endAt':{'type':Sequelize[_0xb1b9('0x3')],'allowNull':![]},'subtractNumber':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize['ENUM']('years',_0xb1b9('0x4'),_0xb1b9('0x5'),'weeks',_0xb1b9('0x6'),_0xb1b9('0x7'),_0xb1b9('0x8')),'allowNull':![],'defaultValue':'days'},'output':{'type':Sequelize[_0xb1b9('0x9')](_0xb1b9('0xa'),_0xb1b9('0xb'),'xlsx'),'allowNull':![],'defaultValue':_0xb1b9('0xa')},'type':{'type':Sequelize['ENUM'](_0xb1b9('0xc'),'default'),'allowNull':![],'defaultValue':_0xb1b9('0xc')},'sendMail':{'type':Sequelize[_0xb1b9('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0xb1b9('0x1')]},'cc':{'type':Sequelize[_0xb1b9('0xd')]},'bcc':{'type':Sequelize[_0xb1b9('0xd')]},'sendIfEmpty':{'type':Sequelize[_0xb1b9('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0xfcbe=['BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','months','hours','days','ENUM','csv','xlsx','default','custom','TEXT','exports','STRING'];(function(_0x3988dc,_0x2a9348){var _0x45351a=function(_0x411986){while(--_0x411986){_0x3988dc['push'](_0x3988dc['shift']());}};_0x45351a(++_0x2a9348);}(_0xfcbe,0x1b1));var _0xefcb=function(_0x4bb8fc,_0x264e42){_0x4bb8fc=_0x4bb8fc-0x0;var _0x3fb9ab=_0xfcbe[_0x4bb8fc];return _0x3fb9ab;};'use strict';var Sequelize=require('sequelize');module[_0xefcb('0x0')]={'name':{'type':Sequelize[_0xefcb('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xefcb('0x1')]},'active':{'type':Sequelize[_0xefcb('0x2')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0xefcb('0x1')],'allowNull':![],'defaultValue':_0xefcb('0x3')},'startAt':{'type':Sequelize['DATE'],'allowNull':![]},'endAt':{'type':Sequelize[_0xefcb('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0xefcb('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize['ENUM']('years','quarters',_0xefcb('0x6'),'weeks','days',_0xefcb('0x7'),'minutes'),'allowNull':![],'defaultValue':_0xefcb('0x8')},'output':{'type':Sequelize[_0xefcb('0x9')](_0xefcb('0xa'),'pdf',_0xefcb('0xb')),'allowNull':![],'defaultValue':_0xefcb('0xa')},'type':{'type':Sequelize['ENUM']('custom',_0xefcb('0xc')),'allowNull':![],'defaultValue':_0xefcb('0xd')},'sendMail':{'type':Sequelize[_0xefcb('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0xefcb('0x1')]},'cc':{'type':Sequelize[_0xefcb('0xe')]},'bcc':{'type':Sequelize[_0xefcb('0xe')]},'sendIfEmpty':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index 6376932..eb8804a 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 _0x08cc=['zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','save','update','then','destroy','UserProfileResource','error','stack','name','send','index','Schedule','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','includeAll','include','findAll','rows','catch','params','length','find','create','user','role','get','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','run','eml-format'];(function(_0x387f93,_0x3266ca){var _0x41b457=function(_0x46f80e){while(--_0x46f80e){_0x387f93['push'](_0x387f93['shift']());}};_0x41b457(++_0x3266ca);}(_0x08cc,0x1df));var _0xc08c=function(_0x126f8f,_0x475057){_0x126f8f=_0x126f8f-0x0;var _0x5d19d0=_0x08cc[_0x126f8f];return _0x5d19d0;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xc08c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc08c('0x1'));var jsonpatch=require(_0xc08c('0x2'));var rp=require(_0xc08c('0x3'));var moment=require('moment');var BPromise=require(_0xc08c('0x4'));var Mustache=require(_0xc08c('0x5'));var util=require('util');var path=require(_0xc08c('0x6'));var sox=require(_0xc08c('0x7'));var csv=require(_0xc08c('0x8'));var ejs=require(_0xc08c('0x9'));var fs=require('fs');var _=require(_0xc08c('0xa'));var squel=require(_0xc08c('0xb'));var crypto=require(_0xc08c('0xc'));var jsforce=require(_0xc08c('0xd'));var deskjs=require(_0xc08c('0xe'));var toCsv=require(_0xc08c('0x8'));var querystring=require(_0xc08c('0xf'));var Papa=require(_0xc08c('0x10'));var Redis=require('ioredis');var authService=require(_0xc08c('0x11'));var qs=require(_0xc08c('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc08c('0x13'));var logger=require('../../config/logger')(_0xc08c('0x14'));var utils=require(_0xc08c('0x15'));var config=require(_0xc08c('0x16'));var db=require(_0xc08c('0x17'))['db'];function respondWithStatusCode(_0x4010cf,_0x3008a1){_0x3008a1=_0x3008a1||0xcc;return function(_0x88898a){if(_0x88898a){return _0x4010cf[_0xc08c('0x18')](_0x3008a1);}return _0x4010cf[_0xc08c('0x19')](_0x3008a1)[_0xc08c('0x1a')]();};}function respondWithResult(_0x532810,_0x348763){_0x348763=_0x348763||0xc8;return function(_0x57d00c){if(_0x57d00c){return _0x532810[_0xc08c('0x19')](_0x348763)[_0xc08c('0x1b')](_0x57d00c);}};}function respondWithFilteredResult(_0x279882,_0x1df954){return function(_0x1abcfd){if(_0x1abcfd){var _0x3031b8=_0x1abcfd[_0xc08c('0x1c')],_0x482f08=_0x1df954[_0xc08c('0x1d')],_0x12aed2=_0x1df954[_0xc08c('0x1d')]+_0x1df954[_0xc08c('0x1e')],_0xc413fb;if(_0x12aed2>=_0x3031b8){_0x12aed2=_0x3031b8;_0xc413fb=0xc8;}else{_0xc413fb=0xce;}_0x279882['status'](_0xc413fb);return _0x279882[_0xc08c('0x1f')]('Content-Range',_0x482f08+'-'+_0x12aed2+'/'+_0x3031b8)[_0xc08c('0x1b')](_0x1abcfd);}return null;};}function patchUpdates(_0x57c73a){return function(_0x35186a){try{jsonpatch['apply'](_0x35186a,_0x57c73a,!![]);}catch(_0x4ca620){return BPromise['reject'](_0x4ca620);}return _0x35186a[_0xc08c('0x20')]();};}function saveUpdates(_0x40470b,_0x4b7ece){return function(_0x17e66c){if(_0x17e66c){return _0x17e66c[_0xc08c('0x21')](_0x40470b)[_0xc08c('0x22')](function(_0x59a92e){return _0x59a92e;});}return null;};}function removeEntity(_0x286f52,_0x3bb185){return function(_0x69d3b3){if(_0x69d3b3){return _0x69d3b3[_0xc08c('0x23')]()[_0xc08c('0x22')](function(){var _0x1c2413=_0x69d3b3['get']({'plain':!![]});var _0x226565='Scheduler';return db[_0xc08c('0x24')][_0xc08c('0x23')]({'where':{'type':_0x226565,'resourceId':_0x1c2413['id']}})['then'](function(){return _0x69d3b3;});})[_0xc08c('0x22')](function(){_0x286f52[_0xc08c('0x19')](0xcc)[_0xc08c('0x1a')]();});}};}function handleEntityNotFound(_0x1bfcc6,_0x1cd67c){return function(_0x3938e2){if(!_0x3938e2){_0x1bfcc6[_0xc08c('0x18')](0x194);}return _0x3938e2;};}function handleError(_0x23c2f9,_0x136127){_0x136127=_0x136127||0x1f4;return function(_0x2b3c97){logger[_0xc08c('0x25')](_0x2b3c97[_0xc08c('0x26')]);if(_0x2b3c97[_0xc08c('0x27')]){delete _0x2b3c97[_0xc08c('0x27')];}_0x23c2f9[_0xc08c('0x19')](_0x136127)[_0xc08c('0x28')](_0x2b3c97);};}exports[_0xc08c('0x29')]=function(_0x950f04,_0x5aaeb9){var _0x979c9c={},_0x37c6ba={},_0x4d3f18={'count':0x0,'rows':[]};var _0x3eddce=_['map'](db[_0xc08c('0x2a')][_0xc08c('0x2b')],function(_0x2536d2){return{'name':_0x2536d2['fieldName'],'type':_0x2536d2[_0xc08c('0x2c')][_0xc08c('0x2d')]};});_0x37c6ba[_0xc08c('0x2e')]=_[_0xc08c('0x2f')](_0x3eddce,_0xc08c('0x27'));_0x37c6ba[_0xc08c('0x30')]=_[_0xc08c('0x31')](_0x950f04[_0xc08c('0x30')]);_0x37c6ba[_0xc08c('0x32')]=_[_0xc08c('0x33')](_0x37c6ba[_0xc08c('0x2e')],_0x37c6ba['query']);_0x979c9c[_0xc08c('0x34')]=_[_0xc08c('0x33')](_0x37c6ba['model'],qs[_0xc08c('0x35')](_0x950f04[_0xc08c('0x30')]['fields']));_0x979c9c['attributes']=_0x979c9c[_0xc08c('0x34')]['length']?_0x979c9c[_0xc08c('0x34')]:_0x37c6ba[_0xc08c('0x2e')];if(!_0x950f04[_0xc08c('0x30')][_0xc08c('0x36')](_0xc08c('0x37'))){_0x979c9c[_0xc08c('0x1e')]=qs['limit'](_0x950f04[_0xc08c('0x30')][_0xc08c('0x1e')]);_0x979c9c[_0xc08c('0x1d')]=qs[_0xc08c('0x1d')](_0x950f04[_0xc08c('0x30')][_0xc08c('0x1d')]);}_0x979c9c[_0xc08c('0x38')]=qs['sort'](_0x950f04[_0xc08c('0x30')][_0xc08c('0x39')]);_0x979c9c[_0xc08c('0x3a')]=qs['filters'](_[_0xc08c('0x3b')](_0x950f04[_0xc08c('0x30')],_0x37c6ba[_0xc08c('0x32')]));if(_0x950f04['query'][_0xc08c('0x3c')]){_0x979c9c[_0xc08c('0x3a')]=_[_0xc08c('0x3d')](_0x979c9c[_0xc08c('0x3a')],{'$or':_['map'](_0x3eddce,function(_0x2c82b5){if(_0x2c82b5[_0xc08c('0x2c')]!=='VIRTUAL'){var _0x176d37={};_0x176d37[_0x2c82b5[_0xc08c('0x27')]]={'$like':'%'+_0x950f04['query'][_0xc08c('0x3c')]+'%'};return _0x176d37;}})});}_0x979c9c=_[_0xc08c('0x3d')]({},_0x979c9c,_0x950f04['options']);var _0x19c23a={'where':_0x979c9c[_0xc08c('0x3a')]};return db[_0xc08c('0x2a')][_0xc08c('0x1c')](_0x19c23a)[_0xc08c('0x22')](function(_0x15b5b1){_0x4d3f18['count']=_0x15b5b1;if(_0x950f04[_0xc08c('0x30')][_0xc08c('0x3e')]){_0x979c9c[_0xc08c('0x3f')]=[{'all':!![]}];}return db[_0xc08c('0x2a')][_0xc08c('0x40')](_0x979c9c);})[_0xc08c('0x22')](function(_0x1f614c){_0x4d3f18[_0xc08c('0x41')]=_0x1f614c;return _0x4d3f18;})[_0xc08c('0x22')](respondWithFilteredResult(_0x5aaeb9,_0x979c9c))[_0xc08c('0x42')](handleError(_0x5aaeb9,null));};exports['show']=function(_0x319c8c,_0x351eca){var _0xf3e0e7={'raw':![],'where':{'id':_0x319c8c[_0xc08c('0x43')]['id']}},_0x2eb048={};_0x2eb048[_0xc08c('0x2e')]=_[_0xc08c('0x31')](db['Schedule']['rawAttributes']);_0x2eb048[_0xc08c('0x30')]=_['keys'](_0x319c8c[_0xc08c('0x30')]);_0x2eb048[_0xc08c('0x32')]=_[_0xc08c('0x33')](_0x2eb048[_0xc08c('0x2e')],_0x2eb048[_0xc08c('0x30')]);_0xf3e0e7['attributes']=_[_0xc08c('0x33')](_0x2eb048[_0xc08c('0x2e')],qs[_0xc08c('0x35')](_0x319c8c[_0xc08c('0x30')][_0xc08c('0x35')]));_0xf3e0e7['attributes']=_0xf3e0e7[_0xc08c('0x34')][_0xc08c('0x44')]?_0xf3e0e7[_0xc08c('0x34')]:_0x2eb048['model'];if(_0x319c8c[_0xc08c('0x30')][_0xc08c('0x3e')]){_0xf3e0e7[_0xc08c('0x3f')]=[{'all':!![]}];}_0xf3e0e7=_[_0xc08c('0x3d')]({},_0xf3e0e7,_0x319c8c['options']);return db[_0xc08c('0x2a')][_0xc08c('0x45')](_0xf3e0e7)[_0xc08c('0x22')](handleEntityNotFound(_0x351eca,null))[_0xc08c('0x22')](respondWithResult(_0x351eca,null))['catch'](handleError(_0x351eca,null));};exports[_0xc08c('0x46')]=function(_0x44b0f4,_0x27780e){return db[_0xc08c('0x2a')][_0xc08c('0x46')](_0x44b0f4['body'],{})['then'](function(_0x4d968f){var _0x316ab9=_0x44b0f4[_0xc08c('0x47')]['get']({'plain':!![]});if(!_0x316ab9)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x316ab9[_0xc08c('0x48')]===_0xc08c('0x47')){var _0x4c26de=_0x4d968f[_0xc08c('0x49')]({'plain':!![]});var _0x58d2c3='Scheduler';return db[_0xc08c('0x4a')][_0xc08c('0x45')]({'where':{'name':_0x58d2c3,'userProfileId':_0x316ab9[_0xc08c('0x4b')]},'raw':!![]})[_0xc08c('0x22')](function(_0x2c09f4){if(_0x2c09f4&&_0x2c09f4[_0xc08c('0x4c')]===0x0){return db[_0xc08c('0x24')][_0xc08c('0x46')]({'name':_0x4c26de['name'],'resourceId':_0x4c26de['id'],'type':_0x2c09f4[_0xc08c('0x27')],'sectionId':_0x2c09f4['id']},{})[_0xc08c('0x22')](function(){return _0x4d968f;});}else{return _0x4d968f;}})[_0xc08c('0x42')](function(_0x2dc915){logger['error'](_0xc08c('0x4d'),_0x2dc915);throw _0x2dc915;});}return _0x4d968f;})['then'](respondWithResult(_0x27780e,0xc9))[_0xc08c('0x42')](handleError(_0x27780e,null));};exports[_0xc08c('0x21')]=function(_0x48db70,_0x24dddb){if(_0x48db70[_0xc08c('0x4e')]['id']){delete _0x48db70[_0xc08c('0x4e')]['id'];}return db[_0xc08c('0x2a')]['find']({'where':{'id':_0x48db70[_0xc08c('0x43')]['id']}})[_0xc08c('0x22')](handleEntityNotFound(_0x24dddb,null))['then'](saveUpdates(_0x48db70[_0xc08c('0x4e')],null))['then'](respondWithResult(_0x24dddb,null))['catch'](handleError(_0x24dddb,null));};exports[_0xc08c('0x23')]=function(_0x3568db,_0x2e3627){return db['Schedule'][_0xc08c('0x45')]({'where':{'id':_0x3568db[_0xc08c('0x43')]['id']}})[_0xc08c('0x22')](handleEntityNotFound(_0x2e3627,null))[_0xc08c('0x22')](removeEntity(_0x2e3627,null))['catch'](handleError(_0x2e3627,null));};exports[_0xc08c('0x4f')]=function(_0x53a5f5,_0x12d6c9,_0x3ecaf5){var _0x3cd73c=require('../../config/schedule');return db[_0xc08c('0x2a')][_0xc08c('0x45')]({'where':{'id':_0x53a5f5[_0xc08c('0x43')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x12d6c9,null))[_0xc08c('0x22')](function(){_0x3cd73c[_0xc08c('0x4f')](_0x53a5f5[_0xc08c('0x43')]['id']);})[_0xc08c('0x22')](respondWithStatusCode(_0x12d6c9,null))[_0xc08c('0x42')](handleError(_0x12d6c9,null));}; \ No newline at end of file +var _0x458c=['includeAll','merge','create','body','user','get','role','find','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','run','../../config/schedule','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','limit','set','Content-Range','json','reject','save','update','then','destroy','Scheduler','UserProfileResource','stack','name','index','map','Schedule','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','where','type','VIRTUAL','count','include','findAll','catch','show','params','length'];(function(_0x120214,_0x35b5cd){var _0x205e3c=function(_0x182c77){while(--_0x182c77){_0x120214['push'](_0x120214['shift']());}};_0x205e3c(++_0x35b5cd);}(_0x458c,0xba));var _0xc458=function(_0x3cbe1c,_0x4bcabd){_0x3cbe1c=_0x3cbe1c-0x0;var _0x5ee08b=_0x458c[_0x3cbe1c];return _0x5ee08b;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xc458('0x0'));var rimraf=require(_0xc458('0x1'));var zipdir=require(_0xc458('0x2'));var jsonpatch=require(_0xc458('0x3'));var rp=require(_0xc458('0x4'));var moment=require(_0xc458('0x5'));var BPromise=require(_0xc458('0x6'));var Mustache=require(_0xc458('0x7'));var util=require('util');var path=require('path');var sox=require(_0xc458('0x8'));var csv=require('to-csv');var ejs=require(_0xc458('0x9'));var fs=require('fs');var _=require(_0xc458('0xa'));var squel=require(_0xc458('0xb'));var crypto=require(_0xc458('0xc'));var jsforce=require(_0xc458('0xd'));var deskjs=require(_0xc458('0xe'));var toCsv=require(_0xc458('0xf'));var querystring=require(_0xc458('0x10'));var Papa=require(_0xc458('0x11'));var Redis=require(_0xc458('0x12'));var authService=require(_0xc458('0x13'));var qs=require(_0xc458('0x14'));var as=require(_0xc458('0x15'));var hardwareService=require(_0xc458('0x16'));var logger=require('../../config/logger')(_0xc458('0x17'));var utils=require(_0xc458('0x18'));var config=require(_0xc458('0x19'));var db=require(_0xc458('0x1a'))['db'];function respondWithStatusCode(_0x3162bf,_0x282b4c){_0x282b4c=_0x282b4c||0xcc;return function(_0x2ad471){if(_0x2ad471){return _0x3162bf[_0xc458('0x1b')](_0x282b4c);}return _0x3162bf[_0xc458('0x1c')](_0x282b4c)[_0xc458('0x1d')]();};}function respondWithResult(_0x338941,_0x20e8b9){_0x20e8b9=_0x20e8b9||0xc8;return function(_0x26a149){if(_0x26a149){return _0x338941[_0xc458('0x1c')](_0x20e8b9)['json'](_0x26a149);}};}function respondWithFilteredResult(_0x205a9d,_0x497028){return function(_0x5e9da8){if(_0x5e9da8){var _0x2d234d=_0x5e9da8['count'],_0x158287=_0x497028[_0xc458('0x1e')],_0xae1e24=_0x497028['offset']+_0x497028[_0xc458('0x1f')],_0x3844f8;if(_0xae1e24>=_0x2d234d){_0xae1e24=_0x2d234d;_0x3844f8=0xc8;}else{_0x3844f8=0xce;}_0x205a9d[_0xc458('0x1c')](_0x3844f8);return _0x205a9d[_0xc458('0x20')](_0xc458('0x21'),_0x158287+'-'+_0xae1e24+'/'+_0x2d234d)[_0xc458('0x22')](_0x5e9da8);}return null;};}function patchUpdates(_0x9853f6){return function(_0x112dc6){try{jsonpatch['apply'](_0x112dc6,_0x9853f6,!![]);}catch(_0x29156d){return BPromise[_0xc458('0x23')](_0x29156d);}return _0x112dc6[_0xc458('0x24')]();};}function saveUpdates(_0x3a748f,_0xda5b89){return function(_0x34ee32){if(_0x34ee32){return _0x34ee32[_0xc458('0x25')](_0x3a748f)[_0xc458('0x26')](function(_0x402ff4){return _0x402ff4;});}return null;};}function removeEntity(_0x218364,_0xc99222){return function(_0x55262c){if(_0x55262c){return _0x55262c[_0xc458('0x27')]()['then'](function(){var _0x5825e7=_0x55262c['get']({'plain':!![]});var _0xe1bd4b=_0xc458('0x28');return db[_0xc458('0x29')][_0xc458('0x27')]({'where':{'type':_0xe1bd4b,'resourceId':_0x5825e7['id']}})[_0xc458('0x26')](function(){return _0x55262c;});})['then'](function(){_0x218364[_0xc458('0x1c')](0xcc)[_0xc458('0x1d')]();});}};}function handleEntityNotFound(_0x201245,_0x23a2a4){return function(_0x3a0ca0){if(!_0x3a0ca0){_0x201245[_0xc458('0x1b')](0x194);}return _0x3a0ca0;};}function handleError(_0x357daa,_0x1604b8){_0x1604b8=_0x1604b8||0x1f4;return function(_0x25c52a){logger['error'](_0x25c52a[_0xc458('0x2a')]);if(_0x25c52a['name']){delete _0x25c52a[_0xc458('0x2b')];}_0x357daa[_0xc458('0x1c')](_0x1604b8)['send'](_0x25c52a);};}exports[_0xc458('0x2c')]=function(_0x46d078,_0x1d767c){var _0xb62a52={},_0x40bf7c={},_0x45037b={'count':0x0,'rows':[]};var _0x152110=_[_0xc458('0x2d')](db[_0xc458('0x2e')][_0xc458('0x2f')],function(_0x457d2a){return{'name':_0x457d2a[_0xc458('0x30')],'type':_0x457d2a['type'][_0xc458('0x31')]};});_0x40bf7c[_0xc458('0x32')]=_[_0xc458('0x2d')](_0x152110,_0xc458('0x2b'));_0x40bf7c['query']=_['keys'](_0x46d078[_0xc458('0x33')]);_0x40bf7c[_0xc458('0x34')]=_[_0xc458('0x35')](_0x40bf7c[_0xc458('0x32')],_0x40bf7c[_0xc458('0x33')]);_0xb62a52['attributes']=_[_0xc458('0x35')](_0x40bf7c[_0xc458('0x32')],qs['fields'](_0x46d078['query'][_0xc458('0x36')]));_0xb62a52[_0xc458('0x37')]=_0xb62a52[_0xc458('0x37')]['length']?_0xb62a52[_0xc458('0x37')]:_0x40bf7c['model'];if(!_0x46d078[_0xc458('0x33')][_0xc458('0x38')](_0xc458('0x39'))){_0xb62a52[_0xc458('0x1f')]=qs[_0xc458('0x1f')](_0x46d078[_0xc458('0x33')][_0xc458('0x1f')]);_0xb62a52['offset']=qs['offset'](_0x46d078[_0xc458('0x33')]['offset']);}_0xb62a52[_0xc458('0x3a')]=qs[_0xc458('0x3b')](_0x46d078['query']['sort']);_0xb62a52['where']=qs[_0xc458('0x34')](_[_0xc458('0x3c')](_0x46d078[_0xc458('0x33')],_0x40bf7c['filters']));if(_0x46d078[_0xc458('0x33')][_0xc458('0x3d')]){_0xb62a52[_0xc458('0x3e')]=_['merge'](_0xb62a52[_0xc458('0x3e')],{'$or':_['map'](_0x152110,function(_0x131441){if(_0x131441[_0xc458('0x3f')]!==_0xc458('0x40')){var _0x19f1c5={};_0x19f1c5[_0x131441[_0xc458('0x2b')]]={'$like':'%'+_0x46d078[_0xc458('0x33')][_0xc458('0x3d')]+'%'};return _0x19f1c5;}})});}_0xb62a52=_['merge']({},_0xb62a52,_0x46d078['options']);var _0x4cd3a7={'where':_0xb62a52[_0xc458('0x3e')]};return db[_0xc458('0x2e')][_0xc458('0x41')](_0x4cd3a7)[_0xc458('0x26')](function(_0x1b55f3){_0x45037b['count']=_0x1b55f3;if(_0x46d078['query']['includeAll']){_0xb62a52[_0xc458('0x42')]=[{'all':!![]}];}return db[_0xc458('0x2e')][_0xc458('0x43')](_0xb62a52);})[_0xc458('0x26')](function(_0xdc5bf0){_0x45037b['rows']=_0xdc5bf0;return _0x45037b;})[_0xc458('0x26')](respondWithFilteredResult(_0x1d767c,_0xb62a52))[_0xc458('0x44')](handleError(_0x1d767c,null));};exports[_0xc458('0x45')]=function(_0x1bab8c,_0x3af0ea){var _0x2d1c27={'raw':![],'where':{'id':_0x1bab8c[_0xc458('0x46')]['id']}},_0x4c91b2={};_0x4c91b2['model']=_['keys'](db[_0xc458('0x2e')][_0xc458('0x2f')]);_0x4c91b2[_0xc458('0x33')]=_['keys'](_0x1bab8c[_0xc458('0x33')]);_0x4c91b2[_0xc458('0x34')]=_['intersection'](_0x4c91b2[_0xc458('0x32')],_0x4c91b2[_0xc458('0x33')]);_0x2d1c27[_0xc458('0x37')]=_[_0xc458('0x35')](_0x4c91b2['model'],qs[_0xc458('0x36')](_0x1bab8c[_0xc458('0x33')]['fields']));_0x2d1c27[_0xc458('0x37')]=_0x2d1c27['attributes'][_0xc458('0x47')]?_0x2d1c27['attributes']:_0x4c91b2['model'];if(_0x1bab8c[_0xc458('0x33')][_0xc458('0x48')]){_0x2d1c27['include']=[{'all':!![]}];}_0x2d1c27=_[_0xc458('0x49')]({},_0x2d1c27,_0x1bab8c['options']);return db['Schedule']['find'](_0x2d1c27)['then'](handleEntityNotFound(_0x3af0ea,null))[_0xc458('0x26')](respondWithResult(_0x3af0ea,null))[_0xc458('0x44')](handleError(_0x3af0ea,null));};exports[_0xc458('0x4a')]=function(_0x49fdcb,_0x546dee){return db[_0xc458('0x2e')][_0xc458('0x4a')](_0x49fdcb[_0xc458('0x4b')],{})[_0xc458('0x26')](function(_0x23558f){var _0x29567b=_0x49fdcb[_0xc458('0x4c')][_0xc458('0x4d')]({'plain':!![]});if(!_0x29567b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x29567b[_0xc458('0x4e')]===_0xc458('0x4c')){var _0x2af875=_0x23558f['get']({'plain':!![]});var _0x5919dd='Scheduler';return db['UserProfileSection'][_0xc458('0x4f')]({'where':{'name':_0x5919dd,'userProfileId':_0x29567b[_0xc458('0x50')]},'raw':!![]})[_0xc458('0x26')](function(_0x26b6f9){if(_0x26b6f9&&_0x26b6f9[_0xc458('0x51')]===0x0){return db['UserProfileResource'][_0xc458('0x4a')]({'name':_0x2af875[_0xc458('0x2b')],'resourceId':_0x2af875['id'],'type':_0x26b6f9[_0xc458('0x2b')],'sectionId':_0x26b6f9['id']},{})['then'](function(){return _0x23558f;});}else{return _0x23558f;}})[_0xc458('0x44')](function(_0x47cbc6){logger[_0xc458('0x52')](_0xc458('0x53'),_0x47cbc6);throw _0x47cbc6;});}return _0x23558f;})[_0xc458('0x26')](respondWithResult(_0x546dee,0xc9))['catch'](handleError(_0x546dee,null));};exports[_0xc458('0x25')]=function(_0x480011,_0x7fd3ef){if(_0x480011[_0xc458('0x4b')]['id']){delete _0x480011['body']['id'];}return db['Schedule'][_0xc458('0x4f')]({'where':{'id':_0x480011['params']['id']}})[_0xc458('0x26')](handleEntityNotFound(_0x7fd3ef,null))[_0xc458('0x26')](saveUpdates(_0x480011[_0xc458('0x4b')],null))[_0xc458('0x26')](respondWithResult(_0x7fd3ef,null))[_0xc458('0x44')](handleError(_0x7fd3ef,null));};exports['destroy']=function(_0x582f9e,_0x796b58){return db[_0xc458('0x2e')]['find']({'where':{'id':_0x582f9e[_0xc458('0x46')]['id']}})['then'](handleEntityNotFound(_0x796b58,null))['then'](removeEntity(_0x796b58,null))[_0xc458('0x44')](handleError(_0x796b58,null));};exports[_0xc458('0x54')]=function(_0x18ad29,_0x59b523,_0x4fce5a){var _0x4a98c5=require(_0xc458('0x55'));return db[_0xc458('0x2e')][_0xc458('0x4f')]({'where':{'id':_0x18ad29['params']['id']},'raw':!![]})[_0xc458('0x26')](handleEntityNotFound(_0x59b523,null))[_0xc458('0x26')](function(){_0x4a98c5['run'](_0x18ad29[_0xc458('0x46')]['id']);})[_0xc458('0x26')](respondWithStatusCode(_0x59b523,null))[_0xc458('0x44')](handleError(_0x59b523,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 54a33c7..08464a1 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 _0xe13d=['tools_schedules','api','request-promise','rimraf','./schedule.attributes','exports','define','Schedule'];(function(_0x56e3c8,_0x498fc3){var _0x1c86e7=function(_0x59eac4){while(--_0x59eac4){_0x56e3c8['push'](_0x56e3c8['shift']());}};_0x1c86e7(++_0x498fc3);}(_0xe13d,0x101));var _0xde13=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0xe13d[_0x4baae2];return _0x1a2285;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xde13('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xde13('0x1'));var fs=require('fs');var path=require('path');var rimraf=require(_0xde13('0x2'));var config=require('../../config/environment');var attributes=require(_0xde13('0x3'));module[_0xde13('0x4')]=function(_0x32b9f7,_0x3a1b28){return _0x32b9f7[_0xde13('0x5')](_0xde13('0x6'),attributes,{'tableName':_0xde13('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x70eb=['path','rimraf','../../config/environment','./schedule.attributes','exports','define','Schedule','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x70eb,0xfe));var _0xb70e=function(_0x256b72,_0x340985){_0x256b72=_0x256b72-0x0;var _0x2183e3=_0x70eb[_0x256b72];return _0x2183e3;};'use strict';var _=require('lodash');var util=require(_0xb70e('0x0'));var logger=require(_0xb70e('0x1'))(_0xb70e('0x2'));var moment=require(_0xb70e('0x3'));var BPromise=require(_0xb70e('0x4'));var rp=require(_0xb70e('0x5'));var fs=require('fs');var path=require(_0xb70e('0x6'));var rimraf=require(_0xb70e('0x7'));var config=require(_0xb70e('0x8'));var attributes=require(_0xb70e('0x9'));module[_0xb70e('0xa')]=function(_0x2861d9,_0xca9e11){return _0x2861d9[_0xb70e('0xb')](_0xb70e('0xc'),attributes,{'tableName':'tools_schedules','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/schedule/schedule.rpc.js b/server/api/schedule/schedule.rpc.js index e1c02ae..82e0ba1 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 _0xba54=['message','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x29c306,_0x5e0918){var _0x32451c=function(_0x23f34f){while(--_0x23f34f){_0x29c306['push'](_0x29c306['shift']());}};_0x32451c(++_0x5e0918);}(_0xba54,0x1ba));var _0x4ba5=function(_0x140c71,_0x495992){_0x140c71=_0x140c71-0x0;var _0x5e5fa0=_0xba54[_0x140c71];return _0x5e5fa0;};'use strict';var _=require(_0x4ba5('0x0'));var util=require(_0x4ba5('0x1'));var moment=require(_0x4ba5('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4ba5('0x3'));var db=require(_0x4ba5('0x4'))['db'];var utils=require(_0x4ba5('0x5'));var logger=require('../../config/logger')(_0x4ba5('0x6'));var config=require(_0x4ba5('0x7'));var jayson=require(_0x4ba5('0x8'));var client=jayson[_0x4ba5('0x9')][_0x4ba5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1a661f,_0x526002,_0x165e3b){return new BPromise(function(_0x50b53b,_0x1d0db9){return client[_0x4ba5('0xb')](_0x1a661f,_0x165e3b)[_0x4ba5('0xc')](function(_0x2f3dde){logger[_0x4ba5('0xd')](_0x4ba5('0xe'),_0x526002,_0x4ba5('0xf'));logger[_0x4ba5('0x10')](_0x4ba5('0x11'),_0x526002,_0x4ba5('0xf'),JSON['stringify'](_0x2f3dde));if(_0x2f3dde[_0x4ba5('0x12')]){if(_0x2f3dde[_0x4ba5('0x12')][_0x4ba5('0x13')]===0x1f4){logger[_0x4ba5('0x12')](_0x4ba5('0xe'),_0x526002,_0x2f3dde['error'][_0x4ba5('0x14')]);return _0x1d0db9(_0x2f3dde['error'][_0x4ba5('0x14')]);}logger[_0x4ba5('0x12')](_0x4ba5('0xe'),_0x526002,_0x2f3dde[_0x4ba5('0x12')]['message']);return _0x50b53b(_0x2f3dde['error']['message']);}else{logger[_0x4ba5('0xd')](_0x4ba5('0xe'),_0x526002,_0x4ba5('0xf'));_0x50b53b(_0x2f3dde['result'][_0x4ba5('0x14')]);}})['catch'](function(_0x245c99){logger['error'](_0x4ba5('0xe'),_0x526002,_0x245c99);_0x1d0db9(_0x245c99);});});} \ No newline at end of file +var _0xa490=['result','catch','lodash','util','moment','bluebird','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','Schedule,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info'];(function(_0x43d11d,_0xccff91){var _0x38cd08=function(_0x131ae2){while(--_0x131ae2){_0x43d11d['push'](_0x43d11d['shift']());}};_0x38cd08(++_0xccff91);}(_0xa490,0x167));var _0x0a49=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xa490[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x0a49('0x0'));var util=require(_0x0a49('0x1'));var moment=require(_0x0a49('0x2'));var BPromise=require(_0x0a49('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x0a49('0x4'));var logger=require('../../config/logger')(_0x0a49('0x5'));var config=require(_0x0a49('0x6'));var jayson=require(_0x0a49('0x7'));var client=jayson[_0x0a49('0x8')][_0x0a49('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xad341e,_0x3a21ee,_0x594185){return new BPromise(function(_0x1ecf2e,_0x1e5b21){return client[_0x0a49('0xa')](_0xad341e,_0x594185)[_0x0a49('0xb')](function(_0x39b5c2){logger['info'](_0x0a49('0xc'),_0x3a21ee,_0x0a49('0xd'));logger[_0x0a49('0xe')]('Schedule,\x20%s,\x20%s,\x20%s',_0x3a21ee,_0x0a49('0xd'),JSON[_0x0a49('0xf')](_0x39b5c2));if(_0x39b5c2['error']){if(_0x39b5c2[_0x0a49('0x10')]['code']===0x1f4){logger[_0x0a49('0x10')]('Schedule,\x20%s,\x20%s',_0x3a21ee,_0x39b5c2[_0x0a49('0x10')][_0x0a49('0x11')]);return _0x1e5b21(_0x39b5c2[_0x0a49('0x10')][_0x0a49('0x11')]);}logger[_0x0a49('0x10')](_0x0a49('0xc'),_0x3a21ee,_0x39b5c2[_0x0a49('0x10')][_0x0a49('0x11')]);return _0x1ecf2e(_0x39b5c2[_0x0a49('0x10')][_0x0a49('0x11')]);}else{logger[_0x0a49('0x12')](_0x0a49('0xc'),_0x3a21ee,_0x0a49('0xd'));_0x1ecf2e(_0x39b5c2[_0x0a49('0x13')][_0x0a49('0x11')]);}})[_0x0a49('0x14')](function(_0x49ed86){logger[_0x0a49('0x10')](_0x0a49('0xc'),_0x3a21ee,_0x49ed86);_0x1e5b21(_0x49ed86);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index 28b60b5..0dacbe7 100644 --- a/server/api/screenRecording/index.js +++ b/server/api/screenRecording/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe1a0=['isAuthenticated','index','/describe','describe','show','/:id/download','download','post','/:id','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./screenRecording.controller','get'];(function(_0xef8146,_0x459c34){var _0x5a6cb0=function(_0x2f84ec){while(--_0x2f84ec){_0xef8146['push'](_0xef8146['shift']());}};_0x5a6cb0(++_0x459c34);}(_0xe1a0,0x132));var _0x0e1a=function(_0x45f111,_0x3a1a4a){_0x45f111=_0x45f111-0x0;var _0x483508=_0xe1a0[_0x45f111];return _0x483508;};'use strict';var multer=require(_0x0e1a('0x0'));var util=require(_0x0e1a('0x1'));var path=require(_0x0e1a('0x2'));var timeout=require(_0x0e1a('0x3'));var express=require('express');var router=express[_0x0e1a('0x4')]();var auth=require(_0x0e1a('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0e1a('0x6'));var controller=require(_0x0e1a('0x7'));router[_0x0e1a('0x8')]('/',auth[_0x0e1a('0x9')](),controller[_0x0e1a('0xa')]);router['get'](_0x0e1a('0xb'),auth['isAuthenticated'](),controller[_0x0e1a('0xc')]);router['get']('/:id',auth[_0x0e1a('0x9')](),controller[_0x0e1a('0xd')]);router[_0x0e1a('0x8')](_0x0e1a('0xe'),auth[_0x0e1a('0x9')](),controller[_0x0e1a('0xf')]);router[_0x0e1a('0x10')]('/',auth[_0x0e1a('0x9')](),controller['create']);router['put'](_0x0e1a('0x11'),auth['isAuthenticated'](),controller['update']);router[_0x0e1a('0x12')](_0x0e1a('0x11'),auth['isAuthenticated'](),controller[_0x0e1a('0x13')]);module[_0x0e1a('0x14')]=router; \ No newline at end of file +var _0x7676=['get','isAuthenticated','/describe','describe','/:id','show','/:id/download','download','create','put','update','delete','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./screenRecording.controller'];(function(_0x15ea09,_0x2f30ab){var _0x3e9c78=function(_0x15f8ba){while(--_0x15f8ba){_0x15ea09['push'](_0x15ea09['shift']());}};_0x3e9c78(++_0x2f30ab);}(_0x7676,0x189));var _0x6767=function(_0xccfc8,_0x30ed6a){_0xccfc8=_0xccfc8-0x0;var _0x30bd6e=_0x7676[_0xccfc8];return _0x30bd6e;};'use strict';var multer=require(_0x6767('0x0'));var util=require('util');var path=require(_0x6767('0x1'));var timeout=require(_0x6767('0x2'));var express=require('express');var router=express[_0x6767('0x3')]();var auth=require(_0x6767('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x6767('0x5'));var controller=require(_0x6767('0x6'));router[_0x6767('0x7')]('/',auth[_0x6767('0x8')](),controller['index']);router[_0x6767('0x7')](_0x6767('0x9'),auth[_0x6767('0x8')](),controller[_0x6767('0xa')]);router[_0x6767('0x7')](_0x6767('0xb'),auth['isAuthenticated'](),controller[_0x6767('0xc')]);router[_0x6767('0x7')](_0x6767('0xd'),auth[_0x6767('0x8')](),controller[_0x6767('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x6767('0xf')]);router[_0x6767('0x10')](_0x6767('0xb'),auth[_0x6767('0x8')](),controller[_0x6767('0x11')]);router[_0x6767('0x12')](_0x6767('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x6767('0x13')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index c714eac..4ba3a7d 100644 --- a/server/api/screenRecording/screenRecording.attributes.js +++ b/server/api/screenRecording/screenRecording.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7bae=['setDataValue','INTEGER','startedAt','subtract','closedAt','duration','DATE','format','toString','MM-DD-YYYY\x20HH:mm','createdAt','path','../../config/environment','VIRTUAL','value','extname','getDataValue','STRING','replace'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x7bae,0x13b));var _0xe7ba=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0x7bae[_0x24237f];return _0x48298e;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');var path=require(_0xe7ba('0x0'));var config=require(_0xe7ba('0x1'));module['exports']={'format':{'type':Sequelize[_0xe7ba('0x2')],'get':function(){return this['getDataValue'](_0xe7ba('0x3'))?path[_0xe7ba('0x4')](this[_0xe7ba('0x5')](_0xe7ba('0x3'))):undefined;}},'interactionid':{'type':Sequelize[_0xe7ba('0x6')]},'channel':{'type':Sequelize[_0xe7ba('0x6')]},'value':{'type':Sequelize[_0xe7ba('0x6')],'set':function(_0x3c5e59){var _0x10b307=_0x3c5e59[_0xe7ba('0x7')](/\\/g,'/');this[_0xe7ba('0x8')](_0xe7ba('0x3'),_0x10b307);}},'rating':{'type':Sequelize[_0xe7ba('0x9')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0xe7ba('0x9')],'set':function(_0x588f08){this[_0xe7ba('0x8')](_0xe7ba('0xa'),moment()[_0xe7ba('0xb')](_0x588f08,'ms'));this[_0xe7ba('0x8')](_0xe7ba('0xc'),moment());this[_0xe7ba('0x8')](_0xe7ba('0xd'),_0x588f08);}},'startedAt':{'type':Sequelize[_0xe7ba('0xe')],'get':function(){return moment(this[_0xe7ba('0x5')]('startedAt'))[_0xe7ba('0xf')]('MM-DD-YYYY\x20HH:mm')[_0xe7ba('0x10')]();}},'closedAt':{'type':Sequelize[_0xe7ba('0xe')],'get':function(){return moment(this[_0xe7ba('0x5')](_0xe7ba('0xc')))[_0xe7ba('0xf')](_0xe7ba('0x11'))['toString']();}},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0xe7ba('0x5')](_0xe7ba('0x12')))[_0xe7ba('0xf')]('MM-DD-YYYY\x20HH:mm')[_0xe7ba('0x10')]();}},'updatedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this['getDataValue']('updatedAt'))[_0xe7ba('0xf')]('MM-DD-YYYY\x20HH:mm')[_0xe7ba('0x10')]();}}}; \ No newline at end of file +var _0xdbf5=['getDataValue','value','extname','STRING','replace','INTEGER','setDataValue','startedAt','duration','MM-DD-YYYY\x20HH:mm','toString','DATE','closedAt','createdAt','format','updatedAt','moment','exports','VIRTUAL'];(function(_0x6ebc6c,_0x4c29ab){var _0x5b8cb9=function(_0x3c4693){while(--_0x3c4693){_0x6ebc6c['push'](_0x6ebc6c['shift']());}};_0x5b8cb9(++_0x4c29ab);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x22606d,_0xc75cd9){_0x22606d=_0x22606d-0x0;var _0x3265d1=_0xdbf5[_0x22606d];return _0x3265d1;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x5dbf('0x0'));var path=require('path');var config=require('../../config/environment');module[_0x5dbf('0x1')]={'format':{'type':Sequelize[_0x5dbf('0x2')],'get':function(){return this[_0x5dbf('0x3')](_0x5dbf('0x4'))?path[_0x5dbf('0x5')](this[_0x5dbf('0x3')](_0x5dbf('0x4'))):undefined;}},'interactionid':{'type':Sequelize[_0x5dbf('0x6')]},'channel':{'type':Sequelize[_0x5dbf('0x6')]},'value':{'type':Sequelize[_0x5dbf('0x6')],'set':function(_0x209b7d){var _0x88128e=_0x209b7d[_0x5dbf('0x7')](/\\/g,'/');this['setDataValue'](_0x5dbf('0x4'),_0x88128e);}},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x5dbf('0x8')],'set':function(_0x3bec50){this[_0x5dbf('0x9')](_0x5dbf('0xa'),moment()['subtract'](_0x3bec50,'ms'));this[_0x5dbf('0x9')]('closedAt',moment());this['setDataValue'](_0x5dbf('0xb'),_0x3bec50);}},'startedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this['getDataValue'](_0x5dbf('0xa')))['format'](_0x5dbf('0xc'))[_0x5dbf('0xd')]();}},'closedAt':{'type':Sequelize[_0x5dbf('0xe')],'get':function(){return moment(this[_0x5dbf('0x3')](_0x5dbf('0xf')))['format']('MM-DD-YYYY\x20HH:mm')[_0x5dbf('0xd')]();}},'createdAt':{'type':Sequelize[_0x5dbf('0xe')],'get':function(){return moment(this['getDataValue'](_0x5dbf('0x10')))[_0x5dbf('0x11')](_0x5dbf('0xc'))[_0x5dbf('0xd')]();}},'updatedAt':{'type':Sequelize[_0x5dbf('0xe')],'get':function(){return moment(this[_0x5dbf('0x3')](_0x5dbf('0x12')))['format']('MM-DD-YYYY\x20HH:mm')[_0x5dbf('0xd')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index ad54add..13aea97 100644 --- a/server/api/screenRecording/screenRecording.controller.js +++ b/server/api/screenRecording/screenRecording.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x56e9=['recording','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','download','unlink','Not\x20found','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','unlinkSync','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','limit','set','Content-Range','reject','save','update','then','destroy','end','stack','name','send','index','map','ScreenRecording','rawAttributes','fieldName','type','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','filters','pick','filter','merge','where','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','keys','find','body','duration','createdAt','closedAt','value','describe','../../components/encryptor','uniqueid','join','root','server/files/screen_recordings','format','existsSync'];(function(_0xd081f2,_0x58e091){var _0x298d29=function(_0x4039bd){while(--_0x4039bd){_0xd081f2['push'](_0xd081f2['shift']());}};_0x298d29(++_0x58e091);}(_0x56e9,0x1e9));var _0x956e=function(_0x16ef9c,_0x55568f){_0x16ef9c=_0x16ef9c-0x0;var _0x38ad91=_0x56e9[_0x16ef9c];return _0x38ad91;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x956e('0x0'));var jsonpatch=require(_0x956e('0x1'));var rp=require('request-promise');var moment=require(_0x956e('0x2'));var BPromise=require(_0x956e('0x3'));var Mustache=require(_0x956e('0x4'));var util=require(_0x956e('0x5'));var path=require(_0x956e('0x6'));var sox=require(_0x956e('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x956e('0x8'));var crypto=require('crypto');var jsforce=require(_0x956e('0x9'));var deskjs=require(_0x956e('0xa'));var toCsv=require('to-csv');var querystring=require(_0x956e('0xb'));var Papa=require(_0x956e('0xc'));var Redis=require(_0x956e('0xd'));var authService=require(_0x956e('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x956e('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x956e('0x10'));var utils=require(_0x956e('0x11'));var config=require(_0x956e('0x12'));var db=require(_0x956e('0x13'))['db'];function respondWithStatusCode(_0x3e1044,_0x196da7){_0x196da7=_0x196da7||0xcc;return function(_0x5a0507){if(_0x5a0507){return _0x3e1044[_0x956e('0x14')](_0x196da7);}return _0x3e1044['status'](_0x196da7)['end']();};}function respondWithResult(_0x146b25,_0x842c75){_0x842c75=_0x842c75||0xc8;return function(_0x32320f){if(_0x32320f){return _0x146b25[_0x956e('0x15')](_0x842c75)[_0x956e('0x16')](_0x32320f);}};}function respondWithFilteredResult(_0x32b3cd,_0x27550d){return function(_0x317b57){if(_0x317b57){var _0xdaf72=_0x317b57[_0x956e('0x17')],_0x2ae14b=_0x27550d['offset'],_0x3fc3cb=_0x27550d['offset']+_0x27550d[_0x956e('0x18')],_0x5a3c7a;if(_0x3fc3cb>=_0xdaf72){_0x3fc3cb=_0xdaf72;_0x5a3c7a=0xc8;}else{_0x5a3c7a=0xce;}_0x32b3cd[_0x956e('0x15')](_0x5a3c7a);return _0x32b3cd[_0x956e('0x19')](_0x956e('0x1a'),_0x2ae14b+'-'+_0x3fc3cb+'/'+_0xdaf72)[_0x956e('0x16')](_0x317b57);}return null;};}function patchUpdates(_0x61458e){return function(_0x33340b){try{jsonpatch['apply'](_0x33340b,_0x61458e,!![]);}catch(_0x37b6ae){return BPromise[_0x956e('0x1b')](_0x37b6ae);}return _0x33340b[_0x956e('0x1c')]();};}function saveUpdates(_0x4c58d4,_0x3c00b5){return function(_0x488b5c){if(_0x488b5c){return _0x488b5c[_0x956e('0x1d')](_0x4c58d4)[_0x956e('0x1e')](function(_0x5355cb){return _0x5355cb;});}return null;};}function removeEntity(_0x16dbd4,_0x3f00af){return function(_0x540b32){if(_0x540b32){return _0x540b32[_0x956e('0x1f')]()[_0x956e('0x1e')](function(){_0x16dbd4[_0x956e('0x15')](0xcc)[_0x956e('0x20')]();});}};}function handleEntityNotFound(_0x18869d,_0x23fd6f){return function(_0x5d8c41){if(!_0x5d8c41){_0x18869d[_0x956e('0x14')](0x194);}return _0x5d8c41;};}function handleError(_0xb58fba,_0x30acd2){_0x30acd2=_0x30acd2||0x1f4;return function(_0x4011ce){logger['error'](_0x4011ce[_0x956e('0x21')]);if(_0x4011ce['name']){delete _0x4011ce[_0x956e('0x22')];}_0xb58fba[_0x956e('0x15')](_0x30acd2)[_0x956e('0x23')](_0x4011ce);};}exports[_0x956e('0x24')]=function(_0x3019be,_0x469f63){var _0x1ff945={},_0x22333d={},_0x14716b={'count':0x0,'rows':[]};var _0x3860c7=_[_0x956e('0x25')](db[_0x956e('0x26')][_0x956e('0x27')],function(_0x184539){return{'name':_0x184539[_0x956e('0x28')],'type':_0x184539[_0x956e('0x29')]['key']};});_0x22333d[_0x956e('0x2a')]=_['differenceBy'](_[_0x956e('0x25')](_0x3860c7,_0x956e('0x22')),['format']);_0x22333d['query']=_['keys'](_0x3019be[_0x956e('0x2b')]);_0x22333d['filters']=_[_0x956e('0x2c')](_0x22333d[_0x956e('0x2a')],_0x22333d['query']);_0x1ff945[_0x956e('0x2d')]=_[_0x956e('0x2c')](_0x22333d[_0x956e('0x2a')],qs[_0x956e('0x2e')](_0x3019be['query'][_0x956e('0x2e')]));_0x1ff945[_0x956e('0x2d')]=_0x1ff945[_0x956e('0x2d')][_0x956e('0x2f')]?_0x1ff945[_0x956e('0x2d')]:_0x22333d[_0x956e('0x2a')];if(!_0x3019be[_0x956e('0x2b')][_0x956e('0x30')](_0x956e('0x31'))){_0x1ff945[_0x956e('0x18')]=qs[_0x956e('0x18')](_0x3019be[_0x956e('0x2b')]['limit']);_0x1ff945[_0x956e('0x32')]=qs[_0x956e('0x32')](_0x3019be[_0x956e('0x2b')][_0x956e('0x32')]);}_0x1ff945[_0x956e('0x33')]=qs[_0x956e('0x34')](_0x3019be[_0x956e('0x2b')][_0x956e('0x34')]);_0x1ff945['where']=qs[_0x956e('0x35')](_[_0x956e('0x36')](_0x3019be['query'],_0x22333d[_0x956e('0x35')]));if(_0x3019be[_0x956e('0x2b')][_0x956e('0x37')]){_0x1ff945['where']=_[_0x956e('0x38')](_0x1ff945[_0x956e('0x39')],{'$or':_[_0x956e('0x25')](_0x3860c7,function(_0x29f91b){if(_0x29f91b[_0x956e('0x29')]!==_0x956e('0x3a')){var _0x59dd7={};_0x59dd7[_0x29f91b[_0x956e('0x22')]]={'$like':'%'+_0x3019be['query']['filter']+'%'};return _0x59dd7;}})});}_0x1ff945=_[_0x956e('0x38')]({},_0x1ff945,_0x3019be[_0x956e('0x3b')]);var _0x2209c7={'where':_0x1ff945['where']};return db['ScreenRecording']['count'](_0x2209c7)['then'](function(_0x3538a8){_0x14716b[_0x956e('0x17')]=_0x3538a8;if(_0x3019be[_0x956e('0x2b')][_0x956e('0x3c')]){_0x1ff945[_0x956e('0x3d')]=[{'all':!![]}];}return db[_0x956e('0x26')][_0x956e('0x3e')](_0x1ff945);})[_0x956e('0x1e')](function(_0x391c4b){_0x14716b[_0x956e('0x3f')]=_0x391c4b;return _0x14716b;})[_0x956e('0x1e')](respondWithFilteredResult(_0x469f63,_0x1ff945))[_0x956e('0x40')](handleError(_0x469f63,null));};exports['show']=function(_0x2baad7,_0x1fd0f9){var _0x51e88c={'raw':![],'where':{'id':_0x2baad7[_0x956e('0x41')]['id']}},_0x577838={};_0x577838[_0x956e('0x2a')]=_[_0x956e('0x42')](db['ScreenRecording'][_0x956e('0x27')]);_0x577838[_0x956e('0x2b')]=_['keys'](_0x2baad7[_0x956e('0x2b')]);_0x577838[_0x956e('0x35')]=_[_0x956e('0x2c')](_0x577838[_0x956e('0x2a')],_0x577838[_0x956e('0x2b')]);_0x51e88c[_0x956e('0x2d')]=_[_0x956e('0x2c')](_0x577838['model'],qs[_0x956e('0x2e')](_0x2baad7[_0x956e('0x2b')][_0x956e('0x2e')]));_0x51e88c[_0x956e('0x2d')]=_0x51e88c['attributes'][_0x956e('0x2f')]?_0x51e88c[_0x956e('0x2d')]:_0x577838[_0x956e('0x2a')];if(_0x2baad7[_0x956e('0x2b')]['includeAll']){_0x51e88c[_0x956e('0x3d')]=[{'all':!![]}];}_0x51e88c=_[_0x956e('0x38')]({},_0x51e88c,_0x2baad7['options']);return db[_0x956e('0x26')][_0x956e('0x43')](_0x51e88c)['then'](handleEntityNotFound(_0x1fd0f9,null))[_0x956e('0x1e')](respondWithResult(_0x1fd0f9,null))[_0x956e('0x40')](handleError(_0x1fd0f9,null));};exports['create']=function(_0x2cbd38,_0x5960b4){return db['ScreenRecording']['create'](_0x2cbd38[_0x956e('0x44')],{})[_0x956e('0x1e')](respondWithResult(_0x5960b4,0xc9))[_0x956e('0x40')](handleError(_0x5960b4,null));};exports[_0x956e('0x1d')]=function(_0x2f17a1,_0x4dcef1){if(_0x2f17a1[_0x956e('0x44')]['id']){delete _0x2f17a1[_0x956e('0x44')]['id'];}delete _0x2f17a1[_0x956e('0x44')][_0x956e('0x45')];delete _0x2f17a1['body'][_0x956e('0x46')];delete _0x2f17a1[_0x956e('0x44')][_0x956e('0x47')];delete _0x2f17a1[_0x956e('0x44')][_0x956e('0x48')];return db['ScreenRecording'][_0x956e('0x43')]({'where':{'id':_0x2f17a1[_0x956e('0x41')]['id']}})[_0x956e('0x1e')](handleEntityNotFound(_0x4dcef1,null))[_0x956e('0x1e')](saveUpdates(_0x2f17a1[_0x956e('0x44')],null))[_0x956e('0x1e')](respondWithResult(_0x4dcef1,null))[_0x956e('0x40')](handleError(_0x4dcef1,null));};exports[_0x956e('0x49')]=function(_0x4bb6aa,_0x18ce22){return db['ScreenRecording']['describe']()[_0x956e('0x1e')](respondWithResult(_0x18ce22,null))[_0x956e('0x40')](handleError(_0x18ce22,null));};exports['download']=function(_0x5ad838,_0x42f7b8,_0xeaf6cf){var _0x414fb6=require(_0x956e('0x4a'));var _0x3ccf4b=![];var _0x30ba05={};if(_0x5ad838[_0x956e('0x2b')][_0x956e('0x29')]&&_0x5ad838[_0x956e('0x2b')][_0x956e('0x29')]===_0x956e('0x4b')){_0x30ba05[_0x956e('0x4b')]=_0x5ad838['params']['id'];}else{_0x30ba05['id']=_0x5ad838[_0x956e('0x41')]['id'];}return db[_0x956e('0x26')][_0x956e('0x43')]({'where':_0x30ba05,'attributes':['id',_0x956e('0x48')],'raw':!![]})[_0x956e('0x1e')](handleEntityNotFound(_0x42f7b8,null))[_0x956e('0x1e')](function(_0x555a5c){if(_0x555a5c){var _0x1e17c4=path[_0x956e('0x4c')](config[_0x956e('0x4d')],_0x956e('0x4e'),_0x555a5c[_0x956e('0x48')]);var _0x574f23=util[_0x956e('0x4f')]('%s.cypher',_0x1e17c4);if(fs[_0x956e('0x50')](_0x574f23)){_0x3ccf4b=!![];return _0x414fb6['decryptFile'](_0x574f23,_0x1e17c4,config['secrets'][_0x956e('0x51')])[_0x956e('0x1e')](function(){return _0x555a5c;});}return _0x555a5c;}})[_0x956e('0x1e')](function(_0x37f7a9){if(_0x37f7a9){var _0x1107df=path['join'](config[_0x956e('0x4d')],'server/files/screen_recordings',_0x37f7a9['value']);if(!fs['existsSync'](_0x1107df)){throw new db[(_0x956e('0x52'))][(_0x956e('0x53'))](_0x956e('0x54'));}if(_0x37f7a9[_0x956e('0x55')]){return _0x42f7b8[_0x956e('0x56')](_0x1107df,_0x37f7a9[_0x956e('0x55')]+path['extname'](_0x1107df),function(){if(_0x3ccf4b){fs[_0x956e('0x57')](_0x1107df);}});}else{return _0x42f7b8[_0x956e('0x56')](_0x1107df,function(_0x5c588d){if(_0x3ccf4b){fs[_0x956e('0x57')](_0x1107df);}});}}})[_0x956e('0x40')](function(_0x585bd0){if(_0x585bd0['message']===_0x956e('0x54')){_0x42f7b8[_0x956e('0x15')](0x194)[_0x956e('0x23')](_0x956e('0x58'));}else{return handleError(_0x42f7b8,null);}});};exports['destroy']=function(_0x38e78f,_0x2107af){return db[_0x956e('0x26')][_0x956e('0x43')]({'where':{'id':_0x38e78f['params']['id']}})[_0x956e('0x1e')](function(_0x32b1c5){if(!_0x32b1c5)throw new ReferenceError(_0x956e('0x59'));return _0x32b1c5;})['then'](function(_0x200183){var _0x13dd4c=path[_0x956e('0x4c')](config['root'],_0x956e('0x4e'),_0x200183[_0x956e('0x48')]);logger[_0x956e('0x5a')](_0x956e('0x5b'),_0x13dd4c);if(!_[_0x956e('0x5c')](_0x200183[_0x956e('0x48')])&&fs[_0x956e('0x50')](_0x13dd4c)){logger[_0x956e('0x5a')](_0x956e('0x5d')+_0x13dd4c+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x956e('0x5e')](_0x13dd4c);}_0x13dd4c=_0x13dd4c+'.cypher';if(!_[_0x956e('0x5c')](_0x200183['value'])&&fs[_0x956e('0x50')](_0x13dd4c)){logger[_0x956e('0x5a')](_0x956e('0x5d')+_0x13dd4c+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x13dd4c);}return _0x200183;})[_0x956e('0x1e')](function(_0x3b607b){if(!_0x3b607b)throw new InternalError();return _0x3b607b[_0x956e('0x1f')]();})[_0x956e('0x1e')](function(){_0x2107af[_0x956e('0x15')](0xcc)[_0x956e('0x20')]();})[_0x956e('0x40')](handleError(_0x2107af,null));}; \ No newline at end of file +var _0xe894=['../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','then','destroy','error','stack','name','send','index','map','ScreenRecording','rawAttributes','fieldName','key','format','query','filters','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','findAll','catch','params','keys','include','create','body','createdAt','closedAt','value','find','describe','../../components/encryptor','type','uniqueid','join','root','%s.cypher','existsSync','decryptFile','secrets','recording','server/files/screen_recordings','Sequelize','ScreenRecording\x20not\x20found','filename','download','unlink','message','Not\x20found','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','html-pdf','eml-format','request-promise','moment','bluebird','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs'];(function(_0x376b45,_0x5964fb){var _0x2341b3=function(_0x5a7f01){while(--_0x5a7f01){_0x376b45['push'](_0x376b45['shift']());}};_0x2341b3(++_0x5964fb);}(_0xe894,0x17d));var _0x4e89=function(_0x303c30,_0x16edcb){_0x303c30=_0x303c30-0x0;var _0x43161b=_0xe894[_0x303c30];return _0x43161b;};'use strict';var pdf=require(_0x4e89('0x0'));var emlformat=require(_0x4e89('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x4e89('0x2'));var moment=require(_0x4e89('0x3'));var BPromise=require(_0x4e89('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x4e89('0x5'));var sox=require(_0x4e89('0x6'));var csv=require(_0x4e89('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x4e89('0x8'));var squel=require('squel');var crypto=require(_0x4e89('0x9'));var jsforce=require(_0x4e89('0xa'));var deskjs=require(_0x4e89('0xb'));var toCsv=require('to-csv');var querystring=require(_0x4e89('0xc'));var Papa=require('papaparse');var Redis=require(_0x4e89('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x4e89('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x4e89('0xf'))(_0x4e89('0x10'));var utils=require(_0x4e89('0x11'));var config=require(_0x4e89('0x12'));var db=require(_0x4e89('0x13'))['db'];function respondWithStatusCode(_0x5bb501,_0x36351a){_0x36351a=_0x36351a||0xcc;return function(_0x59109d){if(_0x59109d){return _0x5bb501[_0x4e89('0x14')](_0x36351a);}return _0x5bb501[_0x4e89('0x15')](_0x36351a)[_0x4e89('0x16')]();};}function respondWithResult(_0x5df3a6,_0x52fd91){_0x52fd91=_0x52fd91||0xc8;return function(_0x49882c){if(_0x49882c){return _0x5df3a6[_0x4e89('0x15')](_0x52fd91)[_0x4e89('0x17')](_0x49882c);}};}function respondWithFilteredResult(_0x39ece8,_0x3aec27){return function(_0x4b8185){if(_0x4b8185){var _0x43e3a3=_0x4b8185[_0x4e89('0x18')],_0x50c54a=_0x3aec27[_0x4e89('0x19')],_0x565395=_0x3aec27[_0x4e89('0x19')]+_0x3aec27[_0x4e89('0x1a')],_0x162060;if(_0x565395>=_0x43e3a3){_0x565395=_0x43e3a3;_0x162060=0xc8;}else{_0x162060=0xce;}_0x39ece8['status'](_0x162060);return _0x39ece8[_0x4e89('0x1b')]('Content-Range',_0x50c54a+'-'+_0x565395+'/'+_0x43e3a3)['json'](_0x4b8185);}return null;};}function patchUpdates(_0x2ed662){return function(_0x5daf38){try{jsonpatch[_0x4e89('0x1c')](_0x5daf38,_0x2ed662,!![]);}catch(_0x31aad8){return BPromise[_0x4e89('0x1d')](_0x31aad8);}return _0x5daf38[_0x4e89('0x1e')]();};}function saveUpdates(_0x4565ea,_0x4d825b){return function(_0x3d7a1a){if(_0x3d7a1a){return _0x3d7a1a['update'](_0x4565ea)[_0x4e89('0x1f')](function(_0x72dfc8){return _0x72dfc8;});}return null;};}function removeEntity(_0x2709d9,_0x4d8ac7){return function(_0x10522c){if(_0x10522c){return _0x10522c[_0x4e89('0x20')]()[_0x4e89('0x1f')](function(){_0x2709d9['status'](0xcc)[_0x4e89('0x16')]();});}};}function handleEntityNotFound(_0xd438b,_0x2a1178){return function(_0xc072e0){if(!_0xc072e0){_0xd438b[_0x4e89('0x14')](0x194);}return _0xc072e0;};}function handleError(_0x5b6a5f,_0x4dc893){_0x4dc893=_0x4dc893||0x1f4;return function(_0x19b1b7){logger[_0x4e89('0x21')](_0x19b1b7[_0x4e89('0x22')]);if(_0x19b1b7[_0x4e89('0x23')]){delete _0x19b1b7['name'];}_0x5b6a5f[_0x4e89('0x15')](_0x4dc893)[_0x4e89('0x24')](_0x19b1b7);};}exports[_0x4e89('0x25')]=function(_0x13654c,_0x53cd69){var _0x298c9a={},_0x43a4ae={},_0xda0590={'count':0x0,'rows':[]};var _0x428e6a=_[_0x4e89('0x26')](db[_0x4e89('0x27')][_0x4e89('0x28')],function(_0x182b58){return{'name':_0x182b58[_0x4e89('0x29')],'type':_0x182b58['type'][_0x4e89('0x2a')]};});_0x43a4ae['model']=_['differenceBy'](_[_0x4e89('0x26')](_0x428e6a,'name'),[_0x4e89('0x2b')]);_0x43a4ae['query']=_['keys'](_0x13654c[_0x4e89('0x2c')]);_0x43a4ae[_0x4e89('0x2d')]=_['intersection'](_0x43a4ae['model'],_0x43a4ae[_0x4e89('0x2c')]);_0x298c9a[_0x4e89('0x2e')]=_[_0x4e89('0x2f')](_0x43a4ae[_0x4e89('0x30')],qs[_0x4e89('0x31')](_0x13654c['query']['fields']));_0x298c9a[_0x4e89('0x2e')]=_0x298c9a[_0x4e89('0x2e')][_0x4e89('0x32')]?_0x298c9a[_0x4e89('0x2e')]:_0x43a4ae['model'];if(!_0x13654c['query'][_0x4e89('0x33')](_0x4e89('0x34'))){_0x298c9a[_0x4e89('0x1a')]=qs[_0x4e89('0x1a')](_0x13654c[_0x4e89('0x2c')][_0x4e89('0x1a')]);_0x298c9a['offset']=qs[_0x4e89('0x19')](_0x13654c['query'][_0x4e89('0x19')]);}_0x298c9a[_0x4e89('0x35')]=qs[_0x4e89('0x36')](_0x13654c[_0x4e89('0x2c')][_0x4e89('0x36')]);_0x298c9a[_0x4e89('0x37')]=qs[_0x4e89('0x2d')](_[_0x4e89('0x38')](_0x13654c[_0x4e89('0x2c')],_0x43a4ae[_0x4e89('0x2d')]));if(_0x13654c['query']['filter']){_0x298c9a[_0x4e89('0x37')]=_[_0x4e89('0x39')](_0x298c9a['where'],{'$or':_['map'](_0x428e6a,function(_0x26260b){if(_0x26260b['type']!==_0x4e89('0x3a')){var _0x2c9dec={};_0x2c9dec[_0x26260b['name']]={'$like':'%'+_0x13654c[_0x4e89('0x2c')][_0x4e89('0x3b')]+'%'};return _0x2c9dec;}})});}_0x298c9a=_['merge']({},_0x298c9a,_0x13654c['options']);var _0xbfdda={'where':_0x298c9a[_0x4e89('0x37')]};return db[_0x4e89('0x27')][_0x4e89('0x18')](_0xbfdda)['then'](function(_0x4094b1){_0xda0590[_0x4e89('0x18')]=_0x4094b1;if(_0x13654c[_0x4e89('0x2c')][_0x4e89('0x3c')]){_0x298c9a['include']=[{'all':!![]}];}return db[_0x4e89('0x27')][_0x4e89('0x3d')](_0x298c9a);})['then'](function(_0x5b82ce){_0xda0590['rows']=_0x5b82ce;return _0xda0590;})[_0x4e89('0x1f')](respondWithFilteredResult(_0x53cd69,_0x298c9a))[_0x4e89('0x3e')](handleError(_0x53cd69,null));};exports['show']=function(_0x3bff37,_0x276cd9){var _0x4acac5={'raw':![],'where':{'id':_0x3bff37[_0x4e89('0x3f')]['id']}},_0x5b50d9={};_0x5b50d9['model']=_[_0x4e89('0x40')](db[_0x4e89('0x27')][_0x4e89('0x28')]);_0x5b50d9[_0x4e89('0x2c')]=_[_0x4e89('0x40')](_0x3bff37['query']);_0x5b50d9[_0x4e89('0x2d')]=_[_0x4e89('0x2f')](_0x5b50d9[_0x4e89('0x30')],_0x5b50d9[_0x4e89('0x2c')]);_0x4acac5[_0x4e89('0x2e')]=_[_0x4e89('0x2f')](_0x5b50d9[_0x4e89('0x30')],qs[_0x4e89('0x31')](_0x3bff37[_0x4e89('0x2c')]['fields']));_0x4acac5[_0x4e89('0x2e')]=_0x4acac5[_0x4e89('0x2e')][_0x4e89('0x32')]?_0x4acac5[_0x4e89('0x2e')]:_0x5b50d9[_0x4e89('0x30')];if(_0x3bff37[_0x4e89('0x2c')][_0x4e89('0x3c')]){_0x4acac5[_0x4e89('0x41')]=[{'all':!![]}];}_0x4acac5=_[_0x4e89('0x39')]({},_0x4acac5,_0x3bff37['options']);return db['ScreenRecording']['find'](_0x4acac5)[_0x4e89('0x1f')](handleEntityNotFound(_0x276cd9,null))[_0x4e89('0x1f')](respondWithResult(_0x276cd9,null))[_0x4e89('0x3e')](handleError(_0x276cd9,null));};exports[_0x4e89('0x42')]=function(_0x24010f,_0x28e7da){return db[_0x4e89('0x27')]['create'](_0x24010f['body'],{})[_0x4e89('0x1f')](respondWithResult(_0x28e7da,0xc9))[_0x4e89('0x3e')](handleError(_0x28e7da,null));};exports['update']=function(_0x34b9f1,_0x4072d8){if(_0x34b9f1['body']['id']){delete _0x34b9f1['body']['id'];}delete _0x34b9f1[_0x4e89('0x43')]['duration'];delete _0x34b9f1[_0x4e89('0x43')][_0x4e89('0x44')];delete _0x34b9f1[_0x4e89('0x43')][_0x4e89('0x45')];delete _0x34b9f1[_0x4e89('0x43')][_0x4e89('0x46')];return db[_0x4e89('0x27')][_0x4e89('0x47')]({'where':{'id':_0x34b9f1[_0x4e89('0x3f')]['id']}})[_0x4e89('0x1f')](handleEntityNotFound(_0x4072d8,null))[_0x4e89('0x1f')](saveUpdates(_0x34b9f1[_0x4e89('0x43')],null))[_0x4e89('0x1f')](respondWithResult(_0x4072d8,null))[_0x4e89('0x3e')](handleError(_0x4072d8,null));};exports[_0x4e89('0x48')]=function(_0x2f2798,_0x1cc3f1){return db[_0x4e89('0x27')][_0x4e89('0x48')]()[_0x4e89('0x1f')](respondWithResult(_0x1cc3f1,null))[_0x4e89('0x3e')](handleError(_0x1cc3f1,null));};exports['download']=function(_0x26a508,_0x520473,_0x237c47){var _0x12184f=require(_0x4e89('0x49'));var _0x1f4f94=![];var _0x3a5d30={};if(_0x26a508['query'][_0x4e89('0x4a')]&&_0x26a508[_0x4e89('0x2c')][_0x4e89('0x4a')]===_0x4e89('0x4b')){_0x3a5d30[_0x4e89('0x4b')]=_0x26a508[_0x4e89('0x3f')]['id'];}else{_0x3a5d30['id']=_0x26a508[_0x4e89('0x3f')]['id'];}return db['ScreenRecording'][_0x4e89('0x47')]({'where':_0x3a5d30,'attributes':['id',_0x4e89('0x46')],'raw':!![]})['then'](handleEntityNotFound(_0x520473,null))[_0x4e89('0x1f')](function(_0x1abf76){if(_0x1abf76){var _0x25e2ec=path[_0x4e89('0x4c')](config[_0x4e89('0x4d')],'server/files/screen_recordings',_0x1abf76[_0x4e89('0x46')]);var _0x42f967=util[_0x4e89('0x2b')](_0x4e89('0x4e'),_0x25e2ec);if(fs[_0x4e89('0x4f')](_0x42f967)){_0x1f4f94=!![];return _0x12184f[_0x4e89('0x50')](_0x42f967,_0x25e2ec,config[_0x4e89('0x51')][_0x4e89('0x52')])['then'](function(){return _0x1abf76;});}return _0x1abf76;}})[_0x4e89('0x1f')](function(_0x2c3a3b){if(_0x2c3a3b){var _0x4805ba=path[_0x4e89('0x4c')](config[_0x4e89('0x4d')],_0x4e89('0x53'),_0x2c3a3b[_0x4e89('0x46')]);if(!fs['existsSync'](_0x4805ba)){throw new db[(_0x4e89('0x54'))]['ValidationError'](_0x4e89('0x55'));}if(_0x2c3a3b[_0x4e89('0x56')]){return _0x520473[_0x4e89('0x57')](_0x4805ba,_0x2c3a3b[_0x4e89('0x56')]+path['extname'](_0x4805ba),function(){if(_0x1f4f94){fs[_0x4e89('0x58')](_0x4805ba);}});}else{return _0x520473[_0x4e89('0x57')](_0x4805ba,function(_0x537d16){if(_0x1f4f94){fs[_0x4e89('0x58')](_0x4805ba);}});}}})[_0x4e89('0x3e')](function(_0x442816){if(_0x442816[_0x4e89('0x59')]===_0x4e89('0x55')){_0x520473[_0x4e89('0x15')](0x194)['send'](_0x4e89('0x5a'));}else{return handleError(_0x520473,null);}});};exports[_0x4e89('0x20')]=function(_0x33e4b2,_0x1e8ce8){return db['ScreenRecording'][_0x4e89('0x47')]({'where':{'id':_0x33e4b2['params']['id']}})[_0x4e89('0x1f')](function(_0x4b71e5){if(!_0x4b71e5)throw new ReferenceError(_0x4e89('0x5b'));return _0x4b71e5;})[_0x4e89('0x1f')](function(_0x4d75de){var _0x2d5ca9=path[_0x4e89('0x4c')](config[_0x4e89('0x4d')],_0x4e89('0x53'),_0x4d75de['value']);logger[_0x4e89('0x5c')](_0x4e89('0x5d'),_0x2d5ca9);if(!_[_0x4e89('0x5e')](_0x4d75de[_0x4e89('0x46')])&&fs['existsSync'](_0x2d5ca9)){logger[_0x4e89('0x5c')](_0x4e89('0x5f')+_0x2d5ca9+_0x4e89('0x60'));fs[_0x4e89('0x61')](_0x2d5ca9);}_0x2d5ca9=_0x2d5ca9+_0x4e89('0x62');if(!_[_0x4e89('0x5e')](_0x4d75de[_0x4e89('0x46')])&&fs[_0x4e89('0x4f')](_0x2d5ca9)){logger[_0x4e89('0x5c')](_0x4e89('0x5f')+_0x2d5ca9+_0x4e89('0x60'));fs[_0x4e89('0x61')](_0x2d5ca9);}return _0x4d75de;})[_0x4e89('0x1f')](function(_0x158175){if(!_0x158175)throw new InternalError();return _0x158175['destroy']();})[_0x4e89('0x1f')](function(){_0x1e8ce8['status'](0xcc)[_0x4e89('0x16')]();})['catch'](handleError(_0x1e8ce8,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index 52f07d9..e6093a2 100644 --- a/server/api/screenRecording/screenRecording.model.js +++ b/server/api/screenRecording/screenRecording.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x93e5=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./screenRecording.attributes','ScreenRecording','screen_recordings','interactionid'];(function(_0x442c6b,_0xd3a99c){var _0x2c6525=function(_0x199e41){while(--_0x199e41){_0x442c6b['push'](_0x442c6b['shift']());}};_0x2c6525(++_0xd3a99c);}(_0x93e5,0x180));var _0x593e=function(_0x4b33e4,_0x2023be){_0x4b33e4=_0x4b33e4-0x0;var _0x9d9a43=_0x93e5[_0x4b33e4];return _0x9d9a43;};'use strict';var _=require('lodash');var util=require(_0x593e('0x0'));var logger=require(_0x593e('0x1'))(_0x593e('0x2'));var moment=require(_0x593e('0x3'));var BPromise=require(_0x593e('0x4'));var rp=require(_0x593e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x593e('0x6'));var config=require(_0x593e('0x7'));var attributes=require(_0x593e('0x8'));module['exports']=function(_0x54c636,_0x11b1f7){return _0x54c636['define'](_0x593e('0x9'),attributes,{'tableName':_0x593e('0xa'),'paranoid':![],'indexes':[{'name':_0x593e('0xb'),'fields':['interactionid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x0763=['request-promise','../../config/environment','./screenRecording.attributes','exports','define','ScreenRecording','screen_recordings','lodash','../../config/logger','api','moment','bluebird'];(function(_0x58ff8e,_0x39fe0d){var _0x701683=function(_0x163930){while(--_0x163930){_0x58ff8e['push'](_0x58ff8e['shift']());}};_0x701683(++_0x39fe0d);}(_0x0763,0x1f3));var _0x3076=function(_0x4ce1b9,_0x397a4b){_0x4ce1b9=_0x4ce1b9-0x0;var _0x2bb15d=_0x0763[_0x4ce1b9];return _0x2bb15d;};'use strict';var _=require(_0x3076('0x0'));var util=require('util');var logger=require(_0x3076('0x1'))(_0x3076('0x2'));var moment=require(_0x3076('0x3'));var BPromise=require(_0x3076('0x4'));var rp=require(_0x3076('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x3076('0x6'));var attributes=require(_0x3076('0x7'));module[_0x3076('0x8')]=function(_0x5d1ef6,_0x5210fe){return _0x5d1ef6[_0x3076('0x9')](_0x3076('0xa'),attributes,{'tableName':_0x3076('0xb'),'paranoid':![],'indexes':[{'name':'interactionid','fields':['interactionid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index 9edc714..cba72f1 100644 --- a/server/api/screenRecording/screenRecording.rpc.js +++ b/server/api/screenRecording/screenRecording.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['http','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x12340b,_0xedab89){var _0x4a6a43=function(_0x36542f){while(--_0x36542f){_0x12340b['push'](_0x12340b['shift']());}};_0x4a6a43(++_0xedab89);}(_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 moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file +var _0xa9e0=['http','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0xffd6a9,_0x4cb6e3){var _0x342d68=function(_0x10f9c8){while(--_0x10f9c8){_0xffd6a9['push'](_0xffd6a9['shift']());}};_0x342d68(++_0x4cb6e3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0xa9e0[_0x4709c0];return _0x13348b;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index b362185..a92d34e 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 _0x7b86=['/:id/preferred','getPreferred','/:id/favicon','getFavicon','join','root','server/files/images/logos/','logo','extname','originalname','post','file','addLogo','diskStorage','format','%s%s','logologin','single','favicon','addFavicon','put','update','exports','multer','util','path','express','../../components/interaction/service','../../config/environment','./setting.controller','get','isAuthenticated','index','/:id','/:id/logo','/:id/logo_login','getLogoLogin','/:id/gdpr','gdpr'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x7b86,0xb3));var _0x67b8=function(_0x27e0a9,_0x25ad01){_0x27e0a9=_0x27e0a9-0x0;var _0x51d645=_0x7b86[_0x27e0a9];return _0x51d645;};'use strict';var multer=require(_0x67b8('0x0'));var util=require(_0x67b8('0x1'));var path=require(_0x67b8('0x2'));var timeout=require('connect-timeout');var express=require(_0x67b8('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x67b8('0x4'));var config=require(_0x67b8('0x5'));var controller=require(_0x67b8('0x6'));router[_0x67b8('0x7')]('/',auth[_0x67b8('0x8')](),controller[_0x67b8('0x9')]);router[_0x67b8('0x7')](_0x67b8('0xa'),controller['show']);router[_0x67b8('0x7')](_0x67b8('0xb'),controller['getLogo']);router[_0x67b8('0x7')](_0x67b8('0xc'),controller[_0x67b8('0xd')]);router[_0x67b8('0x7')](_0x67b8('0xe'),controller[_0x67b8('0xf')]);router[_0x67b8('0x7')](_0x67b8('0x10'),controller[_0x67b8('0x11')]);router['get'](_0x67b8('0x12'),controller[_0x67b8('0x13')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x187442,_0x1d444f,_0x212bcd){_0x212bcd(null,path[_0x67b8('0x14')](config[_0x67b8('0x15')],_0x67b8('0x16')));},'filename':function(_0x389b5d,_0x31c1ce,_0xea979){_0xea979(null,util['format']('%s%s',_0x67b8('0x17'),path[_0x67b8('0x18')](_0x31c1ce[_0x67b8('0x19')])));}})});router[_0x67b8('0x1a')](_0x67b8('0xb'),upload['single'](_0x67b8('0x1b')),controller[_0x67b8('0x1c')]);var upload=multer({'storage':multer[_0x67b8('0x1d')]({'destination':function(_0x4be2af,_0x4a01d1,_0x2fc2d2){_0x2fc2d2(null,path[_0x67b8('0x14')](config[_0x67b8('0x15')],_0x67b8('0x16')));},'filename':function(_0x3d624c,_0x380001,_0x378fce){_0x378fce(null,util[_0x67b8('0x1e')](_0x67b8('0x1f'),_0x67b8('0x20'),path[_0x67b8('0x18')](_0x380001[_0x67b8('0x19')])));}})});router[_0x67b8('0x1a')](_0x67b8('0xc'),upload[_0x67b8('0x21')]('file'),controller['addLogoLogin']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x153311,_0x20c2a3,_0x3eabe5){_0x3eabe5(null,path[_0x67b8('0x14')](config[_0x67b8('0x15')],_0x67b8('0x16')));},'filename':function(_0x32ab2c,_0x4c4ad9,_0x604421){_0x604421(null,util[_0x67b8('0x1e')](_0x67b8('0x1f'),'preferred',path[_0x67b8('0x18')](_0x4c4ad9[_0x67b8('0x19')])));}})});router[_0x67b8('0x1a')]('/:id/preferred',upload[_0x67b8('0x21')](_0x67b8('0x1b')),controller['addPreferred']);var upload=multer({'storage':multer[_0x67b8('0x1d')]({'destination':function(_0x521a0f,_0x3305d1,_0x3fb6f5){_0x3fb6f5(null,path[_0x67b8('0x14')](config['root'],_0x67b8('0x16')));},'filename':function(_0x320ae9,_0x1f83fa,_0x2aa91f){_0x2aa91f(null,util['format'](_0x67b8('0x1f'),_0x67b8('0x22'),path[_0x67b8('0x18')](_0x1f83fa[_0x67b8('0x19')])));}})});router['post'](_0x67b8('0x12'),upload[_0x67b8('0x21')]('file'),controller[_0x67b8('0x23')]);router[_0x67b8('0x24')](_0x67b8('0xa'),auth[_0x67b8('0x8')](),controller[_0x67b8('0x25')]);module[_0x67b8('0x26')]=router; \ No newline at end of file +var _0x02c9=['express','Router','../../components/auth/service','../../components/interaction/service','./setting.controller','get','isAuthenticated','index','/:id','show','/:id/logo_login','/:id/gdpr','gdpr','/:id/preferred','/:id/favicon','getFavicon','diskStorage','format','%s%s','logo','extname','originalname','post','single','addLogo','join','root','server/files/images/logos/','logologin','addLogoLogin','file','favicon','addFavicon','put','update','exports','multer','util','path'];(function(_0x489f09,_0x3f3db2){var _0x4f09b0=function(_0x4646c2){while(--_0x4646c2){_0x489f09['push'](_0x489f09['shift']());}};_0x4f09b0(++_0x3f3db2);}(_0x02c9,0x72));var _0x902c=function(_0x20add8,_0x29e5f6){_0x20add8=_0x20add8-0x0;var _0x22655e=_0x02c9[_0x20add8];return _0x22655e;};'use strict';var multer=require(_0x902c('0x0'));var util=require(_0x902c('0x1'));var path=require(_0x902c('0x2'));var timeout=require('connect-timeout');var express=require(_0x902c('0x3'));var router=express[_0x902c('0x4')]();var auth=require(_0x902c('0x5'));var interaction=require(_0x902c('0x6'));var config=require('../../config/environment');var controller=require(_0x902c('0x7'));router[_0x902c('0x8')]('/',auth[_0x902c('0x9')](),controller[_0x902c('0xa')]);router[_0x902c('0x8')](_0x902c('0xb'),controller[_0x902c('0xc')]);router[_0x902c('0x8')]('/:id/logo',controller['getLogo']);router[_0x902c('0x8')](_0x902c('0xd'),controller['getLogoLogin']);router[_0x902c('0x8')](_0x902c('0xe'),controller[_0x902c('0xf')]);router['get'](_0x902c('0x10'),controller['getPreferred']);router['get'](_0x902c('0x11'),controller[_0x902c('0x12')]);var upload=multer({'storage':multer[_0x902c('0x13')]({'destination':function(_0x1709dd,_0x1f4179,_0x55bc72){_0x55bc72(null,path['join'](config['root'],'server/files/images/logos/'));},'filename':function(_0x3575e1,_0x5b4c05,_0x1cc1fd){_0x1cc1fd(null,util[_0x902c('0x14')](_0x902c('0x15'),_0x902c('0x16'),path[_0x902c('0x17')](_0x5b4c05[_0x902c('0x18')])));}})});router[_0x902c('0x19')]('/:id/logo',upload[_0x902c('0x1a')]('file'),controller[_0x902c('0x1b')]);var upload=multer({'storage':multer[_0x902c('0x13')]({'destination':function(_0x58d514,_0x5cca5f,_0x4f6f5b){_0x4f6f5b(null,path[_0x902c('0x1c')](config[_0x902c('0x1d')],_0x902c('0x1e')));},'filename':function(_0x5aac25,_0x55e482,_0x23fe3e){_0x23fe3e(null,util[_0x902c('0x14')](_0x902c('0x15'),_0x902c('0x1f'),path['extname'](_0x55e482['originalname'])));}})});router[_0x902c('0x19')]('/:id/logo_login',upload[_0x902c('0x1a')]('file'),controller[_0x902c('0x20')]);var upload=multer({'storage':multer[_0x902c('0x13')]({'destination':function(_0x55c3c7,_0x42592f,_0x564ba2){_0x564ba2(null,path[_0x902c('0x1c')](config['root'],_0x902c('0x1e')));},'filename':function(_0x385c1b,_0x212958,_0x15ef62){_0x15ef62(null,util[_0x902c('0x14')](_0x902c('0x15'),'preferred',path[_0x902c('0x17')](_0x212958['originalname'])));}})});router[_0x902c('0x19')](_0x902c('0x10'),upload[_0x902c('0x1a')](_0x902c('0x21')),controller['addPreferred']);var upload=multer({'storage':multer[_0x902c('0x13')]({'destination':function(_0x533d19,_0x5cd2f0,_0x3daa87){_0x3daa87(null,path['join'](config[_0x902c('0x1d')],'server/files/images/logos/'));},'filename':function(_0x2a79e9,_0x55b62b,_0x54981a){_0x54981a(null,util[_0x902c('0x14')]('%s%s',_0x902c('0x22'),path[_0x902c('0x17')](_0x55b62b[_0x902c('0x18')])));}})});router[_0x902c('0x19')](_0x902c('0x11'),upload['single']('file'),controller[_0x902c('0x23')]);router[_0x902c('0x24')](_0x902c('0xb'),auth[_0x902c('0x9')](),controller[_0x902c('0x25')]);module[_0x902c('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 eb4b9ae..5592c58 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 _0x8eb7=['/var/opt/motion2/server/files/sounds/converted','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate','sequelize','exports','INTEGER','min_internal','min_mailbox','STRING'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x8eb7,0x1a8));var _0x78eb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8eb7[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x78eb('0x0'));module[_0x78eb('0x1')]={'min_internal':{'type':Sequelize[_0x78eb('0x2')](0xb),'unique':_0x78eb('0x3'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x78eb('0x2')](0xb),'unique':_0x78eb('0x4'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x78eb('0x2')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x78eb('0x5')],'defaultValue':_0x78eb('0x6')},'logo':{'type':Sequelize[_0x78eb('0x5')]},'defaultLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x78eb('0x5')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x78eb('0x5')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x78eb('0x7')],'defaultValue':!![]},'securePassword':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x78eb('0x7')],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0x78eb('0x5')]},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize[_0x78eb('0x5')]},'pageTitle':{'type':Sequelize[_0x78eb('0x5')]},'defaultPageTitle':{'type':Sequelize[_0x78eb('0x7')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x78eb('0x7')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x78eb('0x7')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize['STRING'],'defaultValue':_0x78eb('0x8')},'enableEmailPreview':{'type':Sequelize[_0x78eb('0x7')],'defaultValue':![]},'split':{'type':Sequelize[_0x78eb('0x7')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x78eb('0x2')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x78eb('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x78eb('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x78eb('0x5')],'defaultValue':_0x78eb('0x9')},'chatTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x78eb('0x7')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x78eb('0x5')]},'defaultPreferred':{'type':Sequelize[_0x78eb('0x7')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x78eb('0x7')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x78eb('0x5')]},'allowedLoginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x78eb('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x78eb('0x5')]},'defaultFavicon':{'type':Sequelize[_0x78eb('0x7')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x78eb('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'googleSsoEnabled':{'type':Sequelize[_0x78eb('0x7')],'defaultValue':![]}}; \ No newline at end of file +var _0xa79b=['BOOLEAN','sequelize','INTEGER','min_internal','STRING'];(function(_0x185ff6,_0x5d4ced){var _0x96be8a=function(_0xc328a4){while(--_0xc328a4){_0x185ff6['push'](_0x185ff6['shift']());}};_0x96be8a(++_0x5d4ced);}(_0xa79b,0x105));var _0xba79=function(_0x59bef2,_0x45d81f){_0x59bef2=_0x59bef2-0x0;var _0xda3a99=_0xa79b[_0x59bef2];return _0xda3a99;};'use strict';var Sequelize=require(_0xba79('0x0'));module['exports']={'min_internal':{'type':Sequelize[_0xba79('0x1')](0xb),'unique':_0xba79('0x2'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0xba79('0x1')](0xb),'unique':'min_mailbox','defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0xba79('0x1')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0xba79('0x3')],'defaultValue':'/var/opt/motion2/server/files/sounds/converted'},'logo':{'type':Sequelize['STRING']},'defaultLogo':{'type':Sequelize[_0xba79('0x4')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0xba79('0x3')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize['STRING']},'defaultHeaderWhiteLabel':{'type':Sequelize[_0xba79('0x4')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0xba79('0x4')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0xba79('0x4')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0xba79('0x3')]},'turnaddr':{'type':Sequelize[_0xba79('0x3')]},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize[_0xba79('0x3')]},'pageTitle':{'type':Sequelize[_0xba79('0x3')]},'defaultPageTitle':{'type':Sequelize[_0xba79('0x4')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0xba79('0x4')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0xba79('0x1')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0xba79('0x4')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0xba79('0x3')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize[_0xba79('0x4')],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0xba79('0x1')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0xba79('0x1')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':'alternate'},'chatTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'preferred':{'type':Sequelize[_0xba79('0x3')]},'defaultPreferred':{'type':Sequelize[_0xba79('0x4')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0xba79('0x4')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0xba79('0x3')]},'allowedLoginAttempts':{'type':Sequelize[_0xba79('0x1')],'defaultValue':0x5},'blockDuration':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'favicon':{'type':Sequelize[_0xba79('0x3')]},'defaultFavicon':{'type':Sequelize[_0xba79('0x4')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize['INTEGER'],'defaultValue':0xa,'validate':{'min':0xa}},'googleSsoEnabled':{'type':Sequelize[_0xba79('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index 01f01d7..2e841e8 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 _0xea4d=['intersection','fields','attributes','length','order','sort','where','pick','filter','merge','VIRTUAL','count','findAll','show','params','rawAttributes','includeAll','include','find','body','file','filename','logo','addLogoLogin','loginLogo','getLogo','server/files/images/logos','getLicense','defaultLoginLogo','defaultFavicon','existsSync','join','root','toLower','default_logo.png','default','custom','ValidationError','upperFirst','\x20not\x20found','download','../../config/license/util','getLogoLogin','preferred','favicon','defaultLogo','defaultPreferred','default_loginLogo.png','Sequelize','gdpr','getPreferred','default_preferred.png','addFavicon','default_favicon.ico','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','client','http','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','json','offset','limit','set','Content-Range','apply','save','update','destroy','end','stack','name','send','map','Setting','fieldName','type','key','model','query','keys','filters'];(function(_0x28de53,_0x306310){var _0x16d1e0=function(_0x3611c6){while(--_0x3611c6){_0x28de53['push'](_0x28de53['shift']());}};_0x16d1e0(++_0x306310);}(_0xea4d,0x195));var _0xdea4=function(_0x3d6afd,_0x3873ab){_0x3d6afd=_0x3d6afd-0x0;var _0x46d4d8=_0xea4d[_0x3d6afd];return _0x46d4d8;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xdea4('0x0'));var rimraf=require(_0xdea4('0x1'));var zipdir=require(_0xdea4('0x2'));var jsonpatch=require(_0xdea4('0x3'));var rp=require(_0xdea4('0x4'));var moment=require(_0xdea4('0x5'));var BPromise=require(_0xdea4('0x6'));var Mustache=require('mustache');var util=require(_0xdea4('0x7'));var path=require('path');var sox=require(_0xdea4('0x8'));var csv=require(_0xdea4('0x9'));var ejs=require(_0xdea4('0xa'));var fs=require('fs');var _=require(_0xdea4('0xb'));var squel=require(_0xdea4('0xc'));var crypto=require(_0xdea4('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xdea4('0xe'));var toCsv=require(_0xdea4('0x9'));var querystring=require(_0xdea4('0xf'));var Papa=require(_0xdea4('0x10'));var Redis=require(_0xdea4('0x11'));var authService=require(_0xdea4('0x12'));var qs=require(_0xdea4('0x13'));var as=require(_0xdea4('0x14'));var hardwareService=require(_0xdea4('0x15'));var logger=require(_0xdea4('0x16'))(_0xdea4('0x17'));var utils=require(_0xdea4('0x18'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson[_0xdea4('0x19')][_0xdea4('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x5867f3,_0x5b942d,_0x1ae4a1){if(_0x1ae4a1){var _0x32083d=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x32083d['test'](_0x5b942d)){return _0x5867f3;}else{throw new db['Sequelize']['ValidationError'](_0xdea4('0x1b'));}}else{return _0x5867f3;}}function respondWithRpcPromise(_0x25c8d7,_0x24b3a6,_0x500854,_0x375fb8){return new BPromise(function(_0x19845f,_0xd562d){var _0xe2d5fd=_0x375fb8||client;return _0xe2d5fd[_0xdea4('0x1c')](_0x25c8d7,_0x500854)[_0xdea4('0x1d')](function(_0x18cff5){logger[_0xdea4('0x1e')](_0xdea4('0x1f'),_0x24b3a6,_0xdea4('0x20'));logger['debug'](_0xdea4('0x21'),_0x24b3a6,_0xdea4('0x20'),JSON[_0xdea4('0x22')](_0x18cff5));if(_0x18cff5[_0xdea4('0x23')]){if(_0x18cff5[_0xdea4('0x23')][_0xdea4('0x24')]===0x1f4){logger[_0xdea4('0x23')](_0xdea4('0x1f'),_0x24b3a6,_0x18cff5[_0xdea4('0x23')][_0xdea4('0x25')]);return _0xd562d(_0x18cff5[_0xdea4('0x23')][_0xdea4('0x25')]);}logger[_0xdea4('0x23')](_0xdea4('0x1f'),_0x24b3a6,_0x18cff5[_0xdea4('0x23')][_0xdea4('0x25')]);return _0x19845f(_0x18cff5[_0xdea4('0x23')][_0xdea4('0x25')]);}else{logger[_0xdea4('0x1e')]('Setting,\x20%s,\x20%s',_0x24b3a6,_0xdea4('0x20'));_0x19845f(_0x18cff5['result'][_0xdea4('0x25')]);}})[_0xdea4('0x26')](function(_0xe111c9){logger[_0xdea4('0x23')](_0xdea4('0x1f'),_0x24b3a6,_0xe111c9);_0xd562d(_0xe111c9);});});}function respondWithStatusCode(_0x40a5b1,_0x4a2982){_0x4a2982=_0x4a2982||0xcc;return function(_0x1c6c39){if(_0x1c6c39){return _0x40a5b1[_0xdea4('0x27')](_0x4a2982);}return _0x40a5b1[_0xdea4('0x28')](_0x4a2982)['end']();};}function respondWithResult(_0x5502aa,_0x521ac4){_0x521ac4=_0x521ac4||0xc8;return function(_0x3c95c5){if(_0x3c95c5){return _0x5502aa[_0xdea4('0x28')](_0x521ac4)[_0xdea4('0x29')](_0x3c95c5);}};}function respondWithFilteredResult(_0x17eb23,_0x1c3e41){return function(_0x1bef4a){if(_0x1bef4a){var _0x20890f=_0x1bef4a['count'],_0xe55180=_0x1c3e41[_0xdea4('0x2a')],_0x289698=_0x1c3e41[_0xdea4('0x2a')]+_0x1c3e41[_0xdea4('0x2b')],_0x38e3a1;if(_0x289698>=_0x20890f){_0x289698=_0x20890f;_0x38e3a1=0xc8;}else{_0x38e3a1=0xce;}_0x17eb23[_0xdea4('0x28')](_0x38e3a1);return _0x17eb23[_0xdea4('0x2c')](_0xdea4('0x2d'),_0xe55180+'-'+_0x289698+'/'+_0x20890f)[_0xdea4('0x29')](_0x1bef4a);}return null;};}function patchUpdates(_0x4cefe6){return function(_0x3f770e){try{jsonpatch[_0xdea4('0x2e')](_0x3f770e,_0x4cefe6,!![]);}catch(_0x24b06d){return BPromise['reject'](_0x24b06d);}return _0x3f770e[_0xdea4('0x2f')]();};}function saveUpdates(_0x3ebf58,_0x424016){return function(_0xf6ea1d){if(_0xf6ea1d){return _0xf6ea1d[_0xdea4('0x30')](_0x3ebf58)[_0xdea4('0x1d')](function(_0x25e931){return _0x25e931;});}return null;};}function removeEntity(_0x345c1f,_0x3a3d5e){return function(_0x3ed030){if(_0x3ed030){return _0x3ed030[_0xdea4('0x31')]()[_0xdea4('0x1d')](function(){_0x345c1f['status'](0xcc)[_0xdea4('0x32')]();});}};}function handleEntityNotFound(_0x39bc82,_0x5752f2){return function(_0x189a16){if(!_0x189a16){_0x39bc82[_0xdea4('0x27')](0x194);}return _0x189a16;};}function handleError(_0x405ec9,_0x4b99af){_0x4b99af=_0x4b99af||0x1f4;return function(_0x2770eb){logger['error'](_0x2770eb[_0xdea4('0x33')]);if(_0x2770eb[_0xdea4('0x34')]){delete _0x2770eb[_0xdea4('0x34')];}_0x405ec9[_0xdea4('0x28')](_0x4b99af)[_0xdea4('0x35')](_0x2770eb);};}exports['index']=function(_0x40a534,_0x5809af){var _0x5ae4e7={},_0x149c54={},_0x39eac3={'count':0x0,'rows':[]};var _0x14c5a3=_[_0xdea4('0x36')](db[_0xdea4('0x37')]['rawAttributes'],function(_0x40cec1){return{'name':_0x40cec1[_0xdea4('0x38')],'type':_0x40cec1[_0xdea4('0x39')][_0xdea4('0x3a')]};});_0x149c54[_0xdea4('0x3b')]=_[_0xdea4('0x36')](_0x14c5a3,_0xdea4('0x34'));_0x149c54[_0xdea4('0x3c')]=_[_0xdea4('0x3d')](_0x40a534[_0xdea4('0x3c')]);_0x149c54[_0xdea4('0x3e')]=_['intersection'](_0x149c54[_0xdea4('0x3b')],_0x149c54[_0xdea4('0x3c')]);_0x5ae4e7['attributes']=_[_0xdea4('0x3f')](_0x149c54[_0xdea4('0x3b')],qs[_0xdea4('0x40')](_0x40a534[_0xdea4('0x3c')][_0xdea4('0x40')]));_0x5ae4e7[_0xdea4('0x41')]=_0x5ae4e7[_0xdea4('0x41')][_0xdea4('0x42')]?_0x5ae4e7['attributes']:_0x149c54[_0xdea4('0x3b')];if(!_0x40a534[_0xdea4('0x3c')]['hasOwnProperty']('nolimit')){_0x5ae4e7[_0xdea4('0x2b')]=qs[_0xdea4('0x2b')](_0x40a534[_0xdea4('0x3c')][_0xdea4('0x2b')]);_0x5ae4e7[_0xdea4('0x2a')]=qs[_0xdea4('0x2a')](_0x40a534[_0xdea4('0x3c')]['offset']);}_0x5ae4e7[_0xdea4('0x43')]=qs[_0xdea4('0x44')](_0x40a534[_0xdea4('0x3c')][_0xdea4('0x44')]);_0x5ae4e7[_0xdea4('0x45')]=qs['filters'](_[_0xdea4('0x46')](_0x40a534[_0xdea4('0x3c')],_0x149c54[_0xdea4('0x3e')]));if(_0x40a534['query'][_0xdea4('0x47')]){_0x5ae4e7[_0xdea4('0x45')]=_[_0xdea4('0x48')](_0x5ae4e7[_0xdea4('0x45')],{'$or':_['map'](_0x14c5a3,function(_0x360221){if(_0x360221[_0xdea4('0x39')]!==_0xdea4('0x49')){var _0xc93d7={};_0xc93d7[_0x360221[_0xdea4('0x34')]]={'$like':'%'+_0x40a534[_0xdea4('0x3c')][_0xdea4('0x47')]+'%'};return _0xc93d7;}})});}_0x5ae4e7=_['merge']({},_0x5ae4e7,_0x40a534['options']);var _0x2d9ad1={'where':_0x5ae4e7[_0xdea4('0x45')]};return db['Setting']['count'](_0x2d9ad1)[_0xdea4('0x1d')](function(_0x257c58){_0x39eac3[_0xdea4('0x4a')]=_0x257c58;if(_0x40a534[_0xdea4('0x3c')]['includeAll']){_0x5ae4e7['include']=[{'all':!![]}];}return db['Setting'][_0xdea4('0x4b')](_0x5ae4e7);})[_0xdea4('0x1d')](function(_0x1b3844){_0x39eac3['rows']=_0x1b3844;return _0x39eac3;})[_0xdea4('0x1d')](respondWithFilteredResult(_0x5809af,_0x5ae4e7))[_0xdea4('0x26')](handleError(_0x5809af,null));};exports[_0xdea4('0x4c')]=function(_0x320641,_0x3e6799){var _0x553048={'raw':![],'where':{'id':_0x320641[_0xdea4('0x4d')]['id']}},_0x489bbf={};_0x489bbf[_0xdea4('0x3b')]=_[_0xdea4('0x3d')](db['Setting'][_0xdea4('0x4e')]);_0x489bbf[_0xdea4('0x3c')]=_[_0xdea4('0x3d')](_0x320641[_0xdea4('0x3c')]);_0x489bbf[_0xdea4('0x3e')]=_[_0xdea4('0x3f')](_0x489bbf['model'],_0x489bbf[_0xdea4('0x3c')]);_0x553048[_0xdea4('0x41')]=_[_0xdea4('0x3f')](_0x489bbf[_0xdea4('0x3b')],qs['fields'](_0x320641['query'][_0xdea4('0x40')]));_0x553048[_0xdea4('0x41')]=_0x553048[_0xdea4('0x41')][_0xdea4('0x42')]?_0x553048[_0xdea4('0x41')]:_0x489bbf[_0xdea4('0x3b')];if(_0x320641[_0xdea4('0x3c')][_0xdea4('0x4f')]){_0x553048[_0xdea4('0x50')]=[{'all':!![]}];}_0x553048=_[_0xdea4('0x48')]({},_0x553048,_0x320641['options']);return db[_0xdea4('0x37')][_0xdea4('0x51')](_0x553048)[_0xdea4('0x1d')](handleEntityNotFound(_0x3e6799,null))[_0xdea4('0x1d')](respondWithResult(_0x3e6799,null))[_0xdea4('0x26')](handleError(_0x3e6799,null));};exports['update']=function(_0x219090,_0xe77b8e){if(_0x219090[_0xdea4('0x52')]['id']){delete _0x219090['body']['id'];}return db[_0xdea4('0x37')][_0xdea4('0x51')]({'where':{'id':_0x219090['params']['id']}})['then'](handleEntityNotFound(_0xe77b8e,null))[_0xdea4('0x1d')](saveUpdates(_0x219090[_0xdea4('0x52')],null))[_0xdea4('0x1d')](respondWithResult(_0xe77b8e,null))['catch'](handleError(_0xe77b8e,null));};exports['addLogo']=function(_0x4065d7,_0x39c0db,_0x22effa){if(_0x4065d7['file']&&_0x4065d7[_0xdea4('0x53')][_0xdea4('0x54')]){_0x4065d7[_0xdea4('0x52')][_0xdea4('0x55')]=_0x4065d7['file'][_0xdea4('0x54')];}return db[_0xdea4('0x37')]['find']({'where':{'id':_0x4065d7[_0xdea4('0x4d')]['id']}})['then'](handleEntityNotFound(_0x39c0db,null))[_0xdea4('0x1d')](saveUpdates(_0x4065d7['body'],null))[_0xdea4('0x1d')](respondWithResult(_0x39c0db,null))[_0xdea4('0x26')](handleError(_0x39c0db,null));};exports[_0xdea4('0x56')]=function(_0x1b851d,_0xfb10e7,_0x2e989d){if(_0x1b851d['file']&&_0x1b851d[_0xdea4('0x53')][_0xdea4('0x54')]){_0x1b851d[_0xdea4('0x52')][_0xdea4('0x57')]=_0x1b851d[_0xdea4('0x53')]['filename'];}return db['Setting'][_0xdea4('0x51')]({'where':{'id':_0x1b851d['params']['id']}})[_0xdea4('0x1d')](handleEntityNotFound(_0xfb10e7,null))['then'](saveUpdates(_0x1b851d[_0xdea4('0x52')],null))[_0xdea4('0x1d')](respondWithResult(_0xfb10e7,null))[_0xdea4('0x26')](handleError(_0xfb10e7,null));};var utilLicense=require('../../config/license/util');exports[_0xdea4('0x58')]=function(_0x571db1,_0x2fe736,_0x11afd4){var _0x3e94a9=_0xdea4('0x59');var _0x45d0d7={'custom':![]};return utilLicense[_0xdea4('0x5a')]()[_0xdea4('0x1d')](function(_0x5445dc){if(_0x5445dc){_0x45d0d7=_0x5445dc;}return db[_0xdea4('0x37')][_0xdea4('0x51')]({'where':{'id':_0x571db1['params']['id']},'attributes':[_0xdea4('0x55'),_0xdea4('0x57'),'preferred','favicon','defaultLogo',_0xdea4('0x5b'),'defaultPreferred',_0xdea4('0x5c')],'raw':!![]});})[_0xdea4('0x1d')](handleEntityNotFound(_0x2fe736,null))[_0xdea4('0x1d')](function(_0x21bb38){if(_0x21bb38){var _0x2737b0=_0x21bb38[_0xdea4('0x55')]&&fs[_0xdea4('0x5d')](path[_0xdea4('0x5e')](config[_0xdea4('0x5f')],_0x3e94a9,_[_0xdea4('0x60')](_0x21bb38[_0xdea4('0x55')])))?path[_0xdea4('0x5e')](config[_0xdea4('0x5f')],_0x3e94a9,_[_0xdea4('0x60')](_0x21bb38[_0xdea4('0x55')])):path[_0xdea4('0x5e')](config[_0xdea4('0x5f')],_0x3e94a9,_[_0xdea4('0x60')](_0xdea4('0x61')));var _0x1aeb9a=_0xdea4('0x62')+_['upperFirst'](_0xdea4('0x55'));if(_0x21bb38[_0x1aeb9a]||!_0x45d0d7[_0xdea4('0x63')]){_0x2737b0=path['join'](config['root'],_0x3e94a9,_[_0xdea4('0x60')]('default_logo.png'));}if(!fs[_0xdea4('0x5d')](_0x2737b0)){throw new db['Sequelize'][(_0xdea4('0x64'))](_[_0xdea4('0x65')](_0xdea4('0x55'))+_0xdea4('0x66'));}return _0x2fe736[_0xdea4('0x67')](_0x2737b0);}})[_0xdea4('0x26')](handleError(_0x2fe736,null));};var utilLicense=require(_0xdea4('0x68'));exports[_0xdea4('0x69')]=function(_0xcddacb,_0x3213d3,_0x51cfa1){var _0x57f01d=_0xdea4('0x59');var _0x2de8c5={'custom':![]};return utilLicense[_0xdea4('0x5a')]()['then'](function(_0x16b6b7){if(_0x16b6b7){_0x2de8c5=_0x16b6b7;}return db[_0xdea4('0x37')][_0xdea4('0x51')]({'where':{'id':_0xcddacb['params']['id']},'attributes':[_0xdea4('0x55'),_0xdea4('0x57'),_0xdea4('0x6a'),_0xdea4('0x6b'),_0xdea4('0x6c'),'defaultLoginLogo',_0xdea4('0x6d'),_0xdea4('0x5c')],'raw':!![]});})[_0xdea4('0x1d')](handleEntityNotFound(_0x3213d3,null))['then'](function(_0x2cef5b){if(_0x2cef5b){var _0x44156f=_0x2cef5b[_0xdea4('0x57')]&&fs[_0xdea4('0x5d')](path['join'](config[_0xdea4('0x5f')],_0x57f01d,_[_0xdea4('0x60')](_0x2cef5b[_0xdea4('0x57')])))?path[_0xdea4('0x5e')](config['root'],_0x57f01d,_[_0xdea4('0x60')](_0x2cef5b['loginLogo'])):path[_0xdea4('0x5e')](config[_0xdea4('0x5f')],_0x57f01d,_[_0xdea4('0x60')](_0xdea4('0x6e')));var _0x4e3cc0=_0xdea4('0x62')+_[_0xdea4('0x65')](_0xdea4('0x57'));if(_0x2cef5b[_0x4e3cc0]||!_0x2de8c5['custom']){_0x44156f=path['join'](config[_0xdea4('0x5f')],_0x57f01d,_['toLower'](_0xdea4('0x6e')));}if(!fs['existsSync'](_0x44156f)){throw new db[(_0xdea4('0x6f'))][(_0xdea4('0x64'))](_[_0xdea4('0x65')](_0xdea4('0x57'))+'\x20not\x20found');}return _0x3213d3[_0xdea4('0x67')](_0x44156f);}})[_0xdea4('0x26')](handleError(_0x3213d3,null));};exports[_0xdea4('0x70')]=function(_0x5626c4,_0x1166f7){return db['Setting']['find']({'where':{'id':_0x5626c4[_0xdea4('0x4d')]['id']},'attributes':['securePassword']})['then'](respondWithResult(_0x1166f7,null))[_0xdea4('0x26')](handleError(_0x1166f7,null));};exports['addPreferred']=function(_0x4d260a,_0x4e7455,_0x5d732e){if(_0x4d260a[_0xdea4('0x53')]&&_0x4d260a['file'][_0xdea4('0x54')]){_0x4d260a[_0xdea4('0x52')]['preferred']=_0x4d260a[_0xdea4('0x53')][_0xdea4('0x54')];}return db['Setting'][_0xdea4('0x51')]({'where':{'id':_0x4d260a[_0xdea4('0x4d')]['id']}})[_0xdea4('0x1d')](handleEntityNotFound(_0x4e7455,null))[_0xdea4('0x1d')](saveUpdates(_0x4d260a[_0xdea4('0x52')],null))[_0xdea4('0x1d')](respondWithResult(_0x4e7455,null))[_0xdea4('0x26')](handleError(_0x4e7455,null));};var utilLicense=require(_0xdea4('0x68'));exports[_0xdea4('0x71')]=function(_0x425c70,_0x4d3cb9,_0x3cbaaf){var _0x24175b='server/files/images/logos';var _0x4a4c3a={'custom':![]};return utilLicense[_0xdea4('0x5a')]()[_0xdea4('0x1d')](function(_0x39674c){if(_0x39674c){_0x4a4c3a=_0x39674c;}return db[_0xdea4('0x37')]['find']({'where':{'id':_0x425c70[_0xdea4('0x4d')]['id']},'attributes':[_0xdea4('0x55'),_0xdea4('0x57'),'preferred',_0xdea4('0x6b'),_0xdea4('0x6c'),_0xdea4('0x5b'),_0xdea4('0x6d'),_0xdea4('0x5c')],'raw':!![]});})[_0xdea4('0x1d')](handleEntityNotFound(_0x4d3cb9,null))[_0xdea4('0x1d')](function(_0x5ba160){if(_0x5ba160){var _0xc7e16e=_0x5ba160[_0xdea4('0x6a')]&&fs[_0xdea4('0x5d')](path[_0xdea4('0x5e')](config[_0xdea4('0x5f')],_0x24175b,_[_0xdea4('0x60')](_0x5ba160[_0xdea4('0x6a')])))?path['join'](config['root'],_0x24175b,_[_0xdea4('0x60')](_0x5ba160[_0xdea4('0x6a')])):path[_0xdea4('0x5e')](config[_0xdea4('0x5f')],_0x24175b,_['toLower'](_0xdea4('0x72')));var _0x25b223='default'+_[_0xdea4('0x65')](_0xdea4('0x6a'));if(_0x5ba160[_0x25b223]||!_0x4a4c3a[_0xdea4('0x63')]||!_0x4a4c3a[_0xdea4('0x6a')]){_0xc7e16e=path[_0xdea4('0x5e')](config[_0xdea4('0x5f')],_0x24175b,_[_0xdea4('0x60')]('default_preferred.png'));}if(!fs[_0xdea4('0x5d')](_0xc7e16e)){throw new db[(_0xdea4('0x6f'))]['ValidationError'](_[_0xdea4('0x65')](_0xdea4('0x6a'))+'\x20not\x20found');}return _0x4d3cb9['download'](_0xc7e16e);}})[_0xdea4('0x26')](handleError(_0x4d3cb9,null));};exports[_0xdea4('0x73')]=function(_0x4183e8,_0x574dc3,_0x355573){if(_0x4183e8[_0xdea4('0x53')]&&_0x4183e8[_0xdea4('0x53')][_0xdea4('0x54')]){_0x4183e8[_0xdea4('0x52')]['favicon']=_0x4183e8[_0xdea4('0x53')][_0xdea4('0x54')];}return db['Setting'][_0xdea4('0x51')]({'where':{'id':_0x4183e8[_0xdea4('0x4d')]['id']}})[_0xdea4('0x1d')](handleEntityNotFound(_0x574dc3,null))[_0xdea4('0x1d')](saveUpdates(_0x4183e8[_0xdea4('0x52')],null))[_0xdea4('0x1d')](respondWithResult(_0x574dc3,null))['catch'](handleError(_0x574dc3,null));};var utilLicense=require(_0xdea4('0x68'));exports['getFavicon']=function(_0x52f9bf,_0x5ae672,_0x84ad1c){var _0x8b65a8=_0xdea4('0x59');var _0x5341fd={'custom':![]};return utilLicense[_0xdea4('0x5a')]()[_0xdea4('0x1d')](function(_0x1b4aad){if(_0x1b4aad){_0x5341fd=_0x1b4aad;}return db[_0xdea4('0x37')]['find']({'where':{'id':_0x52f9bf['params']['id']},'attributes':[_0xdea4('0x55'),'loginLogo',_0xdea4('0x6a'),_0xdea4('0x6b'),'defaultLogo',_0xdea4('0x5b'),_0xdea4('0x6d'),'defaultFavicon'],'raw':!![]});})[_0xdea4('0x1d')](handleEntityNotFound(_0x5ae672,null))[_0xdea4('0x1d')](function(_0x4767d4){if(_0x4767d4){var _0x5cc08b=_0x4767d4['favicon']&&fs[_0xdea4('0x5d')](path[_0xdea4('0x5e')](config['root'],_0x8b65a8,_[_0xdea4('0x60')](_0x4767d4[_0xdea4('0x6b')])))?path[_0xdea4('0x5e')](config[_0xdea4('0x5f')],_0x8b65a8,_[_0xdea4('0x60')](_0x4767d4[_0xdea4('0x6b')])):path['join'](config['root'],_0x8b65a8,_[_0xdea4('0x60')](_0xdea4('0x74')));var _0x304719=_0xdea4('0x62')+_['upperFirst'](_0xdea4('0x6b'));if(_0x4767d4[_0x304719]||!_0x5341fd[_0xdea4('0x63')]){_0x5cc08b=path[_0xdea4('0x5e')](config['root'],_0x8b65a8,_[_0xdea4('0x60')](_0xdea4('0x74')));}if(!fs[_0xdea4('0x5d')](_0x5cc08b)){throw new db[(_0xdea4('0x6f'))][(_0xdea4('0x64'))](_[_0xdea4('0x65')](_0xdea4('0x6b'))+_0xdea4('0x66'));}return _0x5ae672[_0xdea4('0x67')](_0x5cc08b);}})[_0xdea4('0x26')](handleError(_0x5ae672,null));}; \ No newline at end of file +var _0x0b68=['../../config/license/hardware','../../config/logger','api','../../config/utils','jayson/promise','client','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info','Setting,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','sendStatus','end','status','json','count','offset','limit','Content-Range','apply','save','then','destroy','name','send','index','map','Setting','rawAttributes','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','options','include','show','update','body','find','file','filename','params','addLogoLogin','loginLogo','../../config/license/util','server/files/images/logos','getLicense','logo','preferred','favicon','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','existsSync','join','toLower','default_logo.png','default','upperFirst','custom','root','Sequelize','\x20not\x20found','getLogoLogin','default_loginLogo.png','download','gdpr','securePassword','addPreferred','getPreferred','default_preferred.png','addFavicon','getFavicon','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x4ef4d4,_0x131cda){var _0xd62bc7=function(_0x237204){while(--_0x237204){_0x4ef4d4['push'](_0x4ef4d4['shift']());}};_0xd62bc7(++_0x131cda);}(_0x0b68,0xd7));var _0x80b6=function(_0x46a1e3,_0x52f903){_0x46a1e3=_0x46a1e3-0x0;var _0x50d177=_0x0b68[_0x46a1e3];return _0x50d177;};'use strict';var pdf=require(_0x80b6('0x0'));var emlformat=require(_0x80b6('0x1'));var rimraf=require(_0x80b6('0x2'));var zipdir=require(_0x80b6('0x3'));var jsonpatch=require(_0x80b6('0x4'));var rp=require(_0x80b6('0x5'));var moment=require(_0x80b6('0x6'));var BPromise=require(_0x80b6('0x7'));var Mustache=require(_0x80b6('0x8'));var util=require(_0x80b6('0x9'));var path=require(_0x80b6('0xa'));var sox=require('sox');var csv=require(_0x80b6('0xb'));var ejs=require(_0x80b6('0xc'));var fs=require('fs');var _=require(_0x80b6('0xd'));var squel=require(_0x80b6('0xe'));var crypto=require(_0x80b6('0xf'));var jsforce=require(_0x80b6('0x10'));var deskjs=require(_0x80b6('0x11'));var toCsv=require(_0x80b6('0xb'));var querystring=require(_0x80b6('0x12'));var Papa=require('papaparse');var Redis=require(_0x80b6('0x13'));var authService=require(_0x80b6('0x14'));var qs=require(_0x80b6('0x15'));var as=require(_0x80b6('0x16'));var hardwareService=require(_0x80b6('0x17'));var logger=require(_0x80b6('0x18'))(_0x80b6('0x19'));var utils=require(_0x80b6('0x1a'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var jayson=require(_0x80b6('0x1b'));var client=jayson[_0x80b6('0x1c')]['http']({'port':0x232a});function checkPasswordPattern(_0x213bae,_0x33fc9e,_0x594d4e){if(_0x594d4e){var _0x389f33=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x389f33[_0x80b6('0x1d')](_0x33fc9e)){return _0x213bae;}else{throw new db['Sequelize'][(_0x80b6('0x1e'))](_0x80b6('0x1f'));}}else{return _0x213bae;}}function respondWithRpcPromise(_0x311d76,_0x436a8c,_0x614388,_0x3148d3){return new BPromise(function(_0x22fbf0,_0x36564e){var _0x185096=_0x3148d3||client;return _0x185096[_0x80b6('0x20')](_0x311d76,_0x614388)['then'](function(_0x462519){logger[_0x80b6('0x21')](_0x80b6('0x22'),_0x436a8c,'request\x20sent');logger[_0x80b6('0x23')]('Setting,\x20%s,\x20%s,\x20%s',_0x436a8c,_0x80b6('0x24'),JSON[_0x80b6('0x25')](_0x462519));if(_0x462519[_0x80b6('0x26')]){if(_0x462519[_0x80b6('0x26')][_0x80b6('0x27')]===0x1f4){logger[_0x80b6('0x26')](_0x80b6('0x22'),_0x436a8c,_0x462519[_0x80b6('0x26')][_0x80b6('0x28')]);return _0x36564e(_0x462519['error'][_0x80b6('0x28')]);}logger[_0x80b6('0x26')](_0x80b6('0x22'),_0x436a8c,_0x462519['error'][_0x80b6('0x28')]);return _0x22fbf0(_0x462519['error']['message']);}else{logger[_0x80b6('0x21')](_0x80b6('0x22'),_0x436a8c,_0x80b6('0x24'));_0x22fbf0(_0x462519[_0x80b6('0x29')]['message']);}})[_0x80b6('0x2a')](function(_0x4925aa){logger[_0x80b6('0x26')](_0x80b6('0x22'),_0x436a8c,_0x4925aa);_0x36564e(_0x4925aa);});});}function respondWithStatusCode(_0x169292,_0x37320a){_0x37320a=_0x37320a||0xcc;return function(_0x39f5e3){if(_0x39f5e3){return _0x169292[_0x80b6('0x2b')](_0x37320a);}return _0x169292['status'](_0x37320a)[_0x80b6('0x2c')]();};}function respondWithResult(_0x550913,_0x1d83ca){_0x1d83ca=_0x1d83ca||0xc8;return function(_0x5e3dbd){if(_0x5e3dbd){return _0x550913[_0x80b6('0x2d')](_0x1d83ca)[_0x80b6('0x2e')](_0x5e3dbd);}};}function respondWithFilteredResult(_0x5a5b91,_0x4c94a8){return function(_0x4ba89b){if(_0x4ba89b){var _0x53b565=_0x4ba89b[_0x80b6('0x2f')],_0x5f1464=_0x4c94a8[_0x80b6('0x30')],_0x51022d=_0x4c94a8['offset']+_0x4c94a8[_0x80b6('0x31')],_0x35cc12;if(_0x51022d>=_0x53b565){_0x51022d=_0x53b565;_0x35cc12=0xc8;}else{_0x35cc12=0xce;}_0x5a5b91[_0x80b6('0x2d')](_0x35cc12);return _0x5a5b91['set'](_0x80b6('0x32'),_0x5f1464+'-'+_0x51022d+'/'+_0x53b565)[_0x80b6('0x2e')](_0x4ba89b);}return null;};}function patchUpdates(_0x5e8e6c){return function(_0x3f3643){try{jsonpatch[_0x80b6('0x33')](_0x3f3643,_0x5e8e6c,!![]);}catch(_0x2ef7d8){return BPromise['reject'](_0x2ef7d8);}return _0x3f3643[_0x80b6('0x34')]();};}function saveUpdates(_0x49b4bd,_0xfea31e){return function(_0x2c4b73){if(_0x2c4b73){return _0x2c4b73['update'](_0x49b4bd)[_0x80b6('0x35')](function(_0x5c044f){return _0x5c044f;});}return null;};}function removeEntity(_0xa7aca0,_0x167b5a){return function(_0x3252e8){if(_0x3252e8){return _0x3252e8[_0x80b6('0x36')]()[_0x80b6('0x35')](function(){_0xa7aca0[_0x80b6('0x2d')](0xcc)[_0x80b6('0x2c')]();});}};}function handleEntityNotFound(_0xbb1fe4,_0x2cc5f6){return function(_0x4ed604){if(!_0x4ed604){_0xbb1fe4[_0x80b6('0x2b')](0x194);}return _0x4ed604;};}function handleError(_0x18533e,_0x49af08){_0x49af08=_0x49af08||0x1f4;return function(_0x2646e8){logger[_0x80b6('0x26')](_0x2646e8['stack']);if(_0x2646e8[_0x80b6('0x37')]){delete _0x2646e8[_0x80b6('0x37')];}_0x18533e[_0x80b6('0x2d')](_0x49af08)[_0x80b6('0x38')](_0x2646e8);};}exports[_0x80b6('0x39')]=function(_0x8f92f2,_0x55d1a3){var _0x198744={},_0x183fb6={},_0xfe8be5={'count':0x0,'rows':[]};var _0x387f6d=_[_0x80b6('0x3a')](db[_0x80b6('0x3b')][_0x80b6('0x3c')],function(_0x41a2ba){return{'name':_0x41a2ba['fieldName'],'type':_0x41a2ba[_0x80b6('0x3d')][_0x80b6('0x3e')]};});_0x183fb6['model']=_[_0x80b6('0x3a')](_0x387f6d,_0x80b6('0x37'));_0x183fb6[_0x80b6('0x3f')]=_[_0x80b6('0x40')](_0x8f92f2[_0x80b6('0x3f')]);_0x183fb6['filters']=_[_0x80b6('0x41')](_0x183fb6[_0x80b6('0x42')],_0x183fb6[_0x80b6('0x3f')]);_0x198744[_0x80b6('0x43')]=_[_0x80b6('0x41')](_0x183fb6[_0x80b6('0x42')],qs[_0x80b6('0x44')](_0x8f92f2[_0x80b6('0x3f')][_0x80b6('0x44')]));_0x198744[_0x80b6('0x43')]=_0x198744[_0x80b6('0x43')][_0x80b6('0x45')]?_0x198744[_0x80b6('0x43')]:_0x183fb6[_0x80b6('0x42')];if(!_0x8f92f2[_0x80b6('0x3f')][_0x80b6('0x46')](_0x80b6('0x47'))){_0x198744[_0x80b6('0x31')]=qs['limit'](_0x8f92f2[_0x80b6('0x3f')][_0x80b6('0x31')]);_0x198744[_0x80b6('0x30')]=qs[_0x80b6('0x30')](_0x8f92f2['query'][_0x80b6('0x30')]);}_0x198744[_0x80b6('0x48')]=qs[_0x80b6('0x49')](_0x8f92f2[_0x80b6('0x3f')][_0x80b6('0x49')]);_0x198744[_0x80b6('0x4a')]=qs[_0x80b6('0x4b')](_['pick'](_0x8f92f2['query'],_0x183fb6[_0x80b6('0x4b')]));if(_0x8f92f2['query'][_0x80b6('0x4c')]){_0x198744['where']=_[_0x80b6('0x4d')](_0x198744[_0x80b6('0x4a')],{'$or':_['map'](_0x387f6d,function(_0x49e4ff){if(_0x49e4ff[_0x80b6('0x3d')]!=='VIRTUAL'){var _0x32e8cd={};_0x32e8cd[_0x49e4ff['name']]={'$like':'%'+_0x8f92f2[_0x80b6('0x3f')][_0x80b6('0x4c')]+'%'};return _0x32e8cd;}})});}_0x198744=_[_0x80b6('0x4d')]({},_0x198744,_0x8f92f2[_0x80b6('0x4e')]);var _0x5bcb67={'where':_0x198744[_0x80b6('0x4a')]};return db[_0x80b6('0x3b')][_0x80b6('0x2f')](_0x5bcb67)[_0x80b6('0x35')](function(_0x37efe6){_0xfe8be5[_0x80b6('0x2f')]=_0x37efe6;if(_0x8f92f2[_0x80b6('0x3f')]['includeAll']){_0x198744[_0x80b6('0x4f')]=[{'all':!![]}];}return db[_0x80b6('0x3b')]['findAll'](_0x198744);})[_0x80b6('0x35')](function(_0x4b9404){_0xfe8be5['rows']=_0x4b9404;return _0xfe8be5;})['then'](respondWithFilteredResult(_0x55d1a3,_0x198744))[_0x80b6('0x2a')](handleError(_0x55d1a3,null));};exports[_0x80b6('0x50')]=function(_0x26859e,_0x26904b){var _0x764c03={'raw':![],'where':{'id':_0x26859e['params']['id']}},_0x574383={};_0x574383[_0x80b6('0x42')]=_['keys'](db[_0x80b6('0x3b')]['rawAttributes']);_0x574383[_0x80b6('0x3f')]=_[_0x80b6('0x40')](_0x26859e[_0x80b6('0x3f')]);_0x574383['filters']=_[_0x80b6('0x41')](_0x574383[_0x80b6('0x42')],_0x574383[_0x80b6('0x3f')]);_0x764c03[_0x80b6('0x43')]=_[_0x80b6('0x41')](_0x574383[_0x80b6('0x42')],qs[_0x80b6('0x44')](_0x26859e[_0x80b6('0x3f')][_0x80b6('0x44')]));_0x764c03[_0x80b6('0x43')]=_0x764c03['attributes'][_0x80b6('0x45')]?_0x764c03[_0x80b6('0x43')]:_0x574383[_0x80b6('0x42')];if(_0x26859e[_0x80b6('0x3f')]['includeAll']){_0x764c03['include']=[{'all':!![]}];}_0x764c03=_[_0x80b6('0x4d')]({},_0x764c03,_0x26859e[_0x80b6('0x4e')]);return db[_0x80b6('0x3b')]['find'](_0x764c03)[_0x80b6('0x35')](handleEntityNotFound(_0x26904b,null))[_0x80b6('0x35')](respondWithResult(_0x26904b,null))['catch'](handleError(_0x26904b,null));};exports[_0x80b6('0x51')]=function(_0x24e021,_0x175128){if(_0x24e021[_0x80b6('0x52')]['id']){delete _0x24e021[_0x80b6('0x52')]['id'];}return db[_0x80b6('0x3b')][_0x80b6('0x53')]({'where':{'id':_0x24e021['params']['id']}})['then'](handleEntityNotFound(_0x175128,null))[_0x80b6('0x35')](saveUpdates(_0x24e021[_0x80b6('0x52')],null))[_0x80b6('0x35')](respondWithResult(_0x175128,null))[_0x80b6('0x2a')](handleError(_0x175128,null));};exports['addLogo']=function(_0x26dc76,_0x58e175,_0x1d0d1d){if(_0x26dc76['file']&&_0x26dc76[_0x80b6('0x54')][_0x80b6('0x55')]){_0x26dc76[_0x80b6('0x52')]['logo']=_0x26dc76[_0x80b6('0x54')]['filename'];}return db[_0x80b6('0x3b')][_0x80b6('0x53')]({'where':{'id':_0x26dc76[_0x80b6('0x56')]['id']}})[_0x80b6('0x35')](handleEntityNotFound(_0x58e175,null))[_0x80b6('0x35')](saveUpdates(_0x26dc76[_0x80b6('0x52')],null))[_0x80b6('0x35')](respondWithResult(_0x58e175,null))['catch'](handleError(_0x58e175,null));};exports[_0x80b6('0x57')]=function(_0x234104,_0x19c4be,_0x3c6cf7){if(_0x234104[_0x80b6('0x54')]&&_0x234104[_0x80b6('0x54')][_0x80b6('0x55')]){_0x234104[_0x80b6('0x52')][_0x80b6('0x58')]=_0x234104[_0x80b6('0x54')]['filename'];}return db[_0x80b6('0x3b')][_0x80b6('0x53')]({'where':{'id':_0x234104[_0x80b6('0x56')]['id']}})[_0x80b6('0x35')](handleEntityNotFound(_0x19c4be,null))[_0x80b6('0x35')](saveUpdates(_0x234104['body'],null))['then'](respondWithResult(_0x19c4be,null))[_0x80b6('0x2a')](handleError(_0x19c4be,null));};var utilLicense=require(_0x80b6('0x59'));exports['getLogo']=function(_0x16e7d5,_0x2dbeee,_0xe892ab){var _0x112800=_0x80b6('0x5a');var _0x3074aa={'custom':![]};return utilLicense[_0x80b6('0x5b')]()[_0x80b6('0x35')](function(_0x4f8638){if(_0x4f8638){_0x3074aa=_0x4f8638;}return db['Setting'][_0x80b6('0x53')]({'where':{'id':_0x16e7d5[_0x80b6('0x56')]['id']},'attributes':[_0x80b6('0x5c'),_0x80b6('0x58'),_0x80b6('0x5d'),_0x80b6('0x5e'),_0x80b6('0x5f'),_0x80b6('0x60'),_0x80b6('0x61'),_0x80b6('0x62')],'raw':!![]});})[_0x80b6('0x35')](handleEntityNotFound(_0x2dbeee,null))[_0x80b6('0x35')](function(_0x547005){if(_0x547005){var _0x54c84=_0x547005[_0x80b6('0x5c')]&&fs[_0x80b6('0x63')](path[_0x80b6('0x64')](config['root'],_0x112800,_[_0x80b6('0x65')](_0x547005[_0x80b6('0x5c')])))?path[_0x80b6('0x64')](config['root'],_0x112800,_[_0x80b6('0x65')](_0x547005[_0x80b6('0x5c')])):path['join'](config['root'],_0x112800,_[_0x80b6('0x65')](_0x80b6('0x66')));var _0x33b27b=_0x80b6('0x67')+_[_0x80b6('0x68')](_0x80b6('0x5c'));if(_0x547005[_0x33b27b]||!_0x3074aa[_0x80b6('0x69')]){_0x54c84=path[_0x80b6('0x64')](config[_0x80b6('0x6a')],_0x112800,_[_0x80b6('0x65')]('default_logo.png'));}if(!fs[_0x80b6('0x63')](_0x54c84)){throw new db[(_0x80b6('0x6b'))]['ValidationError'](_['upperFirst'](_0x80b6('0x5c'))+_0x80b6('0x6c'));}return _0x2dbeee['download'](_0x54c84);}})['catch'](handleError(_0x2dbeee,null));};var utilLicense=require(_0x80b6('0x59'));exports[_0x80b6('0x6d')]=function(_0x38265f,_0x462b2e,_0x342a56){var _0x566dac='server/files/images/logos';var _0x383569={'custom':![]};return utilLicense[_0x80b6('0x5b')]()[_0x80b6('0x35')](function(_0x54f99f){if(_0x54f99f){_0x383569=_0x54f99f;}return db[_0x80b6('0x3b')][_0x80b6('0x53')]({'where':{'id':_0x38265f['params']['id']},'attributes':[_0x80b6('0x5c'),'loginLogo','preferred',_0x80b6('0x5e'),'defaultLogo',_0x80b6('0x60'),_0x80b6('0x61'),_0x80b6('0x62')],'raw':!![]});})[_0x80b6('0x35')](handleEntityNotFound(_0x462b2e,null))[_0x80b6('0x35')](function(_0x5bdd90){if(_0x5bdd90){var _0x1ad52c=_0x5bdd90['loginLogo']&&fs[_0x80b6('0x63')](path[_0x80b6('0x64')](config[_0x80b6('0x6a')],_0x566dac,_[_0x80b6('0x65')](_0x5bdd90[_0x80b6('0x58')])))?path[_0x80b6('0x64')](config[_0x80b6('0x6a')],_0x566dac,_[_0x80b6('0x65')](_0x5bdd90[_0x80b6('0x58')])):path[_0x80b6('0x64')](config[_0x80b6('0x6a')],_0x566dac,_[_0x80b6('0x65')]('default_loginLogo.png'));var _0x5b0bf2='default'+_[_0x80b6('0x68')](_0x80b6('0x58'));if(_0x5bdd90[_0x5b0bf2]||!_0x383569[_0x80b6('0x69')]){_0x1ad52c=path['join'](config[_0x80b6('0x6a')],_0x566dac,_[_0x80b6('0x65')](_0x80b6('0x6e')));}if(!fs[_0x80b6('0x63')](_0x1ad52c)){throw new db[(_0x80b6('0x6b'))][(_0x80b6('0x1e'))](_[_0x80b6('0x68')](_0x80b6('0x58'))+_0x80b6('0x6c'));}return _0x462b2e[_0x80b6('0x6f')](_0x1ad52c);}})[_0x80b6('0x2a')](handleError(_0x462b2e,null));};exports[_0x80b6('0x70')]=function(_0x2d1391,_0x5dbb38){return db['Setting'][_0x80b6('0x53')]({'where':{'id':_0x2d1391[_0x80b6('0x56')]['id']},'attributes':[_0x80b6('0x71')]})['then'](respondWithResult(_0x5dbb38,null))[_0x80b6('0x2a')](handleError(_0x5dbb38,null));};exports[_0x80b6('0x72')]=function(_0x546aa4,_0x395c70,_0x288978){if(_0x546aa4['file']&&_0x546aa4[_0x80b6('0x54')][_0x80b6('0x55')]){_0x546aa4['body'][_0x80b6('0x5d')]=_0x546aa4[_0x80b6('0x54')][_0x80b6('0x55')];}return db[_0x80b6('0x3b')][_0x80b6('0x53')]({'where':{'id':_0x546aa4[_0x80b6('0x56')]['id']}})['then'](handleEntityNotFound(_0x395c70,null))['then'](saveUpdates(_0x546aa4['body'],null))[_0x80b6('0x35')](respondWithResult(_0x395c70,null))[_0x80b6('0x2a')](handleError(_0x395c70,null));};var utilLicense=require(_0x80b6('0x59'));exports[_0x80b6('0x73')]=function(_0x1734d1,_0x50551d,_0xfb7af8){var _0x45349d=_0x80b6('0x5a');var _0x2625b2={'custom':![]};return utilLicense[_0x80b6('0x5b')]()[_0x80b6('0x35')](function(_0x316af8){if(_0x316af8){_0x2625b2=_0x316af8;}return db[_0x80b6('0x3b')][_0x80b6('0x53')]({'where':{'id':_0x1734d1['params']['id']},'attributes':[_0x80b6('0x5c'),_0x80b6('0x58'),_0x80b6('0x5d'),'favicon',_0x80b6('0x5f'),_0x80b6('0x60'),_0x80b6('0x61'),_0x80b6('0x62')],'raw':!![]});})['then'](handleEntityNotFound(_0x50551d,null))[_0x80b6('0x35')](function(_0x2d1517){if(_0x2d1517){var _0x28d104=_0x2d1517[_0x80b6('0x5d')]&&fs[_0x80b6('0x63')](path['join'](config[_0x80b6('0x6a')],_0x45349d,_[_0x80b6('0x65')](_0x2d1517[_0x80b6('0x5d')])))?path[_0x80b6('0x64')](config[_0x80b6('0x6a')],_0x45349d,_[_0x80b6('0x65')](_0x2d1517[_0x80b6('0x5d')])):path[_0x80b6('0x64')](config['root'],_0x45349d,_['toLower'](_0x80b6('0x74')));var _0x249fed=_0x80b6('0x67')+_[_0x80b6('0x68')]('preferred');if(_0x2d1517[_0x249fed]||!_0x2625b2[_0x80b6('0x69')]||!_0x2625b2[_0x80b6('0x5d')]){_0x28d104=path['join'](config[_0x80b6('0x6a')],_0x45349d,_[_0x80b6('0x65')](_0x80b6('0x74')));}if(!fs[_0x80b6('0x63')](_0x28d104)){throw new db['Sequelize'][(_0x80b6('0x1e'))](_[_0x80b6('0x68')]('preferred')+_0x80b6('0x6c'));}return _0x50551d[_0x80b6('0x6f')](_0x28d104);}})['catch'](handleError(_0x50551d,null));};exports[_0x80b6('0x75')]=function(_0x1b4541,_0x595cbe,_0x96fa58){if(_0x1b4541[_0x80b6('0x54')]&&_0x1b4541[_0x80b6('0x54')][_0x80b6('0x55')]){_0x1b4541[_0x80b6('0x52')][_0x80b6('0x5e')]=_0x1b4541[_0x80b6('0x54')]['filename'];}return db[_0x80b6('0x3b')]['find']({'where':{'id':_0x1b4541[_0x80b6('0x56')]['id']}})[_0x80b6('0x35')](handleEntityNotFound(_0x595cbe,null))[_0x80b6('0x35')](saveUpdates(_0x1b4541[_0x80b6('0x52')],null))['then'](respondWithResult(_0x595cbe,null))[_0x80b6('0x2a')](handleError(_0x595cbe,null));};var utilLicense=require(_0x80b6('0x59'));exports[_0x80b6('0x76')]=function(_0x762149,_0x123582,_0x2cb329){var _0x47445a=_0x80b6('0x5a');var _0x41d878={'custom':![]};return utilLicense[_0x80b6('0x5b')]()[_0x80b6('0x35')](function(_0x2beff1){if(_0x2beff1){_0x41d878=_0x2beff1;}return db[_0x80b6('0x3b')][_0x80b6('0x53')]({'where':{'id':_0x762149['params']['id']},'attributes':[_0x80b6('0x5c'),'loginLogo',_0x80b6('0x5d'),_0x80b6('0x5e'),_0x80b6('0x5f'),_0x80b6('0x60'),_0x80b6('0x61'),_0x80b6('0x62')],'raw':!![]});})[_0x80b6('0x35')](handleEntityNotFound(_0x123582,null))[_0x80b6('0x35')](function(_0x343d1e){if(_0x343d1e){var _0x493ba7=_0x343d1e[_0x80b6('0x5e')]&&fs[_0x80b6('0x63')](path[_0x80b6('0x64')](config[_0x80b6('0x6a')],_0x47445a,_[_0x80b6('0x65')](_0x343d1e[_0x80b6('0x5e')])))?path[_0x80b6('0x64')](config['root'],_0x47445a,_[_0x80b6('0x65')](_0x343d1e['favicon'])):path[_0x80b6('0x64')](config[_0x80b6('0x6a')],_0x47445a,_[_0x80b6('0x65')]('default_favicon.ico'));var _0x55fa4c=_0x80b6('0x67')+_[_0x80b6('0x68')](_0x80b6('0x5e'));if(_0x343d1e[_0x55fa4c]||!_0x41d878[_0x80b6('0x69')]){_0x493ba7=path[_0x80b6('0x64')](config['root'],_0x47445a,_[_0x80b6('0x65')]('default_favicon.ico'));}if(!fs[_0x80b6('0x63')](_0x493ba7)){throw new db[(_0x80b6('0x6b'))][(_0x80b6('0x1e'))](_[_0x80b6('0x68')](_0x80b6('0x5e'))+_0x80b6('0x6c'));}return _0x123582[_0x80b6('0x6f')](_0x493ba7);}})[_0x80b6('0x2a')](handleError(_0x123582,null));}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index dd12e0c..fbc1fe5 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 _0x8a02=['settings','lodash','../../config/logger','moment','bluebird','rimraf','../../config/environment','exports','define','Setting'];(function(_0x3a0c4f,_0x5dd1a3){var _0x247049=function(_0x144695){while(--_0x144695){_0x3a0c4f['push'](_0x3a0c4f['shift']());}};_0x247049(++_0x5dd1a3);}(_0x8a02,0x15f));var _0x28a0=function(_0x2a210b,_0x49de5b){_0x2a210b=_0x2a210b-0x0;var _0x1bfc83=_0x8a02[_0x2a210b];return _0x1bfc83;};'use strict';var _=require(_0x28a0('0x0'));var util=require('util');var logger=require(_0x28a0('0x1'))('api');var moment=require(_0x28a0('0x2'));var BPromise=require(_0x28a0('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x28a0('0x4'));var config=require(_0x28a0('0x5'));var attributes=require('./setting.attributes');module[_0x28a0('0x6')]=function(_0x5d2f01,_0x4385de){return _0x5d2f01[_0x28a0('0x7')](_0x28a0('0x8'),attributes,{'tableName':_0x28a0('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd47f=['define','Setting','settings','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./setting.attributes'];(function(_0x2f9cbc,_0x42cf1b){var _0xd91e8=function(_0x183a29){while(--_0x183a29){_0x2f9cbc['push'](_0x2f9cbc['shift']());}};_0xd91e8(++_0x42cf1b);}(_0xd47f,0x121));var _0xfd47=function(_0x164df2,_0x4083ee){_0x164df2=_0x164df2-0x0;var _0x4abfa1=_0xd47f[_0x164df2];return _0x4abfa1;};'use strict';var _=require(_0xfd47('0x0'));var util=require(_0xfd47('0x1'));var logger=require(_0xfd47('0x2'))('api');var moment=require(_0xfd47('0x3'));var BPromise=require(_0xfd47('0x4'));var rp=require(_0xfd47('0x5'));var fs=require('fs');var path=require(_0xfd47('0x6'));var rimraf=require(_0xfd47('0x7'));var config=require(_0xfd47('0x8'));var attributes=require(_0xfd47('0x9'));module['exports']=function(_0x5db050,_0x3d7fb2){return _0x5db050[_0xfd47('0xa')](_0xfd47('0xb'),attributes,{'tableName':_0xfd47('0xc'),'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 2857bcb..4a7df4a 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 _0x1a19=['request','then','info','request\x20sent','Setting,\x20%s,\x20%s,\x20%s','stringify','error','message','Setting,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x3bee55,_0x4e25c8){var _0x5649d2=function(_0x13d730){while(--_0x13d730){_0x3bee55['push'](_0x3bee55['shift']());}};_0x5649d2(++_0x4e25c8);}(_0x1a19,0x155));var _0x91a1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1a19[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x91a1('0x0'));var util=require(_0x91a1('0x1'));var moment=require(_0x91a1('0x2'));var BPromise=require(_0x91a1('0x3'));var rs=require(_0x91a1('0x4'));var fs=require('fs');var Redis=require(_0x91a1('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x91a1('0x6'))(_0x91a1('0x7'));var config=require(_0x91a1('0x8'));var jayson=require(_0x91a1('0x9'));var client=jayson[_0x91a1('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4845f1,_0x10cae0,_0x75813d){return new BPromise(function(_0xeee062,_0x12c6d3){return client[_0x91a1('0xb')](_0x4845f1,_0x75813d)[_0x91a1('0xc')](function(_0xdfe80f){logger[_0x91a1('0xd')]('Setting,\x20%s,\x20%s',_0x10cae0,_0x91a1('0xe'));logger['debug'](_0x91a1('0xf'),_0x10cae0,_0x91a1('0xe'),JSON[_0x91a1('0x10')](_0xdfe80f));if(_0xdfe80f[_0x91a1('0x11')]){if(_0xdfe80f[_0x91a1('0x11')]['code']===0x1f4){logger['error']('Setting,\x20%s,\x20%s',_0x10cae0,_0xdfe80f[_0x91a1('0x11')][_0x91a1('0x12')]);return _0x12c6d3(_0xdfe80f[_0x91a1('0x11')][_0x91a1('0x12')]);}logger[_0x91a1('0x11')]('Setting,\x20%s,\x20%s',_0x10cae0,_0xdfe80f[_0x91a1('0x11')]['message']);return _0xeee062(_0xdfe80f[_0x91a1('0x11')][_0x91a1('0x12')]);}else{logger[_0x91a1('0xd')](_0x91a1('0x13'),_0x10cae0,_0x91a1('0xe'));_0xeee062(_0xdfe80f[_0x91a1('0x14')][_0x91a1('0x12')]);}})[_0x91a1('0x15')](function(_0x1d6a31){logger[_0x91a1('0x11')]('Setting,\x20%s,\x20%s',_0x10cae0,_0x1d6a31);_0x12c6d3(_0x1d6a31);});});} \ No newline at end of file +var _0x51c5=['http','then','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x2964c0,_0x21c112){var _0x1bf4d9=function(_0x324bc5){while(--_0x324bc5){_0x2964c0['push'](_0x2964c0['shift']());}};_0x1bf4d9(++_0x21c112);}(_0x51c5,0xfd));var _0x551c=function(_0x29d915,_0x54a040){_0x29d915=_0x29d915-0x0;var _0x160f86=_0x51c5[_0x29d915];return _0x160f86;};'use strict';var _=require(_0x551c('0x0'));var util=require(_0x551c('0x1'));var moment=require(_0x551c('0x2'));var BPromise=require(_0x551c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x551c('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x551c('0x5'));var logger=require(_0x551c('0x6'))(_0x551c('0x7'));var config=require(_0x551c('0x8'));var jayson=require(_0x551c('0x9'));var client=jayson[_0x551c('0xa')][_0x551c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x46e3f8,_0x551f50,_0x4b4b60){return new BPromise(function(_0x2e97cf,_0x38fe38){return client['request'](_0x46e3f8,_0x4b4b60)[_0x551c('0xc')](function(_0x2791fa){logger['info'](_0x551c('0xd'),_0x551f50,_0x551c('0xe'));logger[_0x551c('0xf')](_0x551c('0x10'),_0x551f50,_0x551c('0xe'),JSON[_0x551c('0x11')](_0x2791fa));if(_0x2791fa[_0x551c('0x12')]){if(_0x2791fa[_0x551c('0x12')][_0x551c('0x13')]===0x1f4){logger[_0x551c('0x12')](_0x551c('0xd'),_0x551f50,_0x2791fa[_0x551c('0x12')][_0x551c('0x14')]);return _0x38fe38(_0x2791fa['error'][_0x551c('0x14')]);}logger['error']('Setting,\x20%s,\x20%s',_0x551f50,_0x2791fa[_0x551c('0x12')][_0x551c('0x14')]);return _0x2e97cf(_0x2791fa['error']['message']);}else{logger[_0x551c('0x15')](_0x551c('0xd'),_0x551f50,_0x551c('0xe'));_0x2e97cf(_0x2791fa[_0x551c('0x16')]['message']);}})[_0x551c('0x17')](function(_0x2b3b96){logger[_0x551c('0x12')](_0x551c('0xd'),_0x551f50,_0x2b3b96);_0x38fe38(_0x2b3b96);});});} \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 75427d5..32d3368 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 _0x2e63=['isAuthenticated','index','/describe','/:id','/:id/dispositions','getAnswers','getApplications','/:id/interactions','getInteractions','/:id/status','/:id/users','getAgents','post','addDisposition','/:id/canned_answers','addAnswer','/:id/notify','notify','/:id/applications','addApplications','/:id/send','send','addAgents','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./smsAccount.controller','get'];(function(_0x21b9c7,_0x4b4ad6){var _0x21fed3=function(_0x209e50){while(--_0x209e50){_0x21b9c7['push'](_0x21b9c7['shift']());}};_0x21fed3(++_0x4b4ad6);}(_0x2e63,0x6f));var _0x32e6=function(_0x39e8f5,_0xb151a6){_0x39e8f5=_0x39e8f5-0x0;var _0x346526=_0x2e63[_0x39e8f5];return _0x346526;};'use strict';var multer=require('multer');var util=require(_0x32e6('0x0'));var path=require(_0x32e6('0x1'));var timeout=require(_0x32e6('0x2'));var express=require(_0x32e6('0x3'));var router=express[_0x32e6('0x4')]();var auth=require(_0x32e6('0x5'));var interaction=require(_0x32e6('0x6'));var config=require('../../config/environment');var controller=require(_0x32e6('0x7'));router[_0x32e6('0x8')]('/',auth[_0x32e6('0x9')](),controller[_0x32e6('0xa')]);router[_0x32e6('0x8')](_0x32e6('0xb'),auth[_0x32e6('0x9')](),controller['describe']);router[_0x32e6('0x8')](_0x32e6('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x32e6('0x8')](_0x32e6('0xd'),auth['isAuthenticated'](),controller['getDispositions']);router[_0x32e6('0x8')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x32e6('0xe')]);router['get']('/:id/applications',auth[_0x32e6('0x9')](),controller[_0x32e6('0xf')]);router[_0x32e6('0x8')](_0x32e6('0x10'),auth[_0x32e6('0x9')](),controller[_0x32e6('0x11')]);router[_0x32e6('0x8')](_0x32e6('0x12'),controller['statusGet']);router[_0x32e6('0x8')](_0x32e6('0x13'),auth['isAuthenticated'](),controller[_0x32e6('0x14')]);router[_0x32e6('0x15')]('/',auth[_0x32e6('0x9')](),controller['create']);router['post'](_0x32e6('0xd'),auth[_0x32e6('0x9')](),controller[_0x32e6('0x16')]);router['post'](_0x32e6('0x17'),auth[_0x32e6('0x9')](),controller[_0x32e6('0x18')]);router[_0x32e6('0x15')](_0x32e6('0x19'),controller[_0x32e6('0x1a')]);router['post'](_0x32e6('0x1b'),auth['isAuthenticated'](),controller[_0x32e6('0x1c')]);router[_0x32e6('0x15')](_0x32e6('0x1d'),auth['isAuthenticated'](),controller[_0x32e6('0x1e')]);router['post'](_0x32e6('0x12'),controller['status']);router[_0x32e6('0x15')](_0x32e6('0x13'),auth['isAuthenticated'](),controller[_0x32e6('0x1f')]);router[_0x32e6('0x20')]('/:id',auth['isAuthenticated'](),controller[_0x32e6('0x21')]);router[_0x32e6('0x22')](_0x32e6('0xc'),auth['isAuthenticated'](),controller[_0x32e6('0x23')]);router[_0x32e6('0x22')]('/:id/dispositions',auth[_0x32e6('0x9')](),controller[_0x32e6('0x24')]);router[_0x32e6('0x22')](_0x32e6('0x17'),auth['isAuthenticated'](),controller[_0x32e6('0x25')]);router[_0x32e6('0x22')]('/:id/users',auth[_0x32e6('0x9')](),controller[_0x32e6('0x26')]);module[_0x32e6('0x27')]=router; \ No newline at end of file +var _0x971d=['update','delete','destroy','/:id/canned_answers','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','isAuthenticated','index','/describe','describe','show','/:id/dispositions','getDispositions','getAnswers','/:id/applications','getInteractions','/:id/status','/:id/users','getAgents','post','addDisposition','addAnswer','/:id/notify','notify','status','addAgents','put','/:id'];(function(_0x53a872,_0x4fb992){var _0x410c49=function(_0x84b3e7){while(--_0x84b3e7){_0x53a872['push'](_0x53a872['shift']());}};_0x410c49(++_0x4fb992);}(_0x971d,0xc5));var _0xd971=function(_0x5a129a,_0x3c2fb0){_0x5a129a=_0x5a129a-0x0;var _0x40daf2=_0x971d[_0x5a129a];return _0x40daf2;};'use strict';var multer=require(_0xd971('0x0'));var util=require(_0xd971('0x1'));var path=require(_0xd971('0x2'));var timeout=require(_0xd971('0x3'));var express=require('express');var router=express[_0xd971('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xd971('0x5'));var config=require(_0xd971('0x6'));var controller=require(_0xd971('0x7'));router[_0xd971('0x8')]('/',auth[_0xd971('0x9')](),controller[_0xd971('0xa')]);router[_0xd971('0x8')](_0xd971('0xb'),auth[_0xd971('0x9')](),controller[_0xd971('0xc')]);router[_0xd971('0x8')]('/:id',auth[_0xd971('0x9')](),controller[_0xd971('0xd')]);router['get'](_0xd971('0xe'),auth[_0xd971('0x9')](),controller[_0xd971('0xf')]);router[_0xd971('0x8')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0xd971('0x10')]);router[_0xd971('0x8')](_0xd971('0x11'),auth[_0xd971('0x9')](),controller['getApplications']);router[_0xd971('0x8')]('/:id/interactions',auth[_0xd971('0x9')](),controller[_0xd971('0x12')]);router['get'](_0xd971('0x13'),controller['statusGet']);router[_0xd971('0x8')](_0xd971('0x14'),auth[_0xd971('0x9')](),controller[_0xd971('0x15')]);router[_0xd971('0x16')]('/',auth[_0xd971('0x9')](),controller['create']);router[_0xd971('0x16')]('/:id/dispositions',auth[_0xd971('0x9')](),controller[_0xd971('0x17')]);router[_0xd971('0x16')]('/:id/canned_answers',auth[_0xd971('0x9')](),controller[_0xd971('0x18')]);router[_0xd971('0x16')](_0xd971('0x19'),controller[_0xd971('0x1a')]);router['post'](_0xd971('0x11'),auth['isAuthenticated'](),controller['addApplications']);router[_0xd971('0x16')]('/:id/send',auth[_0xd971('0x9')](),controller['send']);router[_0xd971('0x16')](_0xd971('0x13'),controller[_0xd971('0x1b')]);router[_0xd971('0x16')](_0xd971('0x14'),auth[_0xd971('0x9')](),controller[_0xd971('0x1c')]);router[_0xd971('0x1d')](_0xd971('0x1e'),auth[_0xd971('0x9')](),controller[_0xd971('0x1f')]);router[_0xd971('0x20')](_0xd971('0x1e'),auth[_0xd971('0x9')](),controller[_0xd971('0x21')]);router[_0xd971('0x20')](_0xd971('0xe'),auth[_0xd971('0x9')](),controller['removeDispositions']);router[_0xd971('0x20')](_0xd971('0x22'),auth[_0xd971('0x9')](),controller[_0xd971('0x23')]);router[_0xd971('0x20')](_0xd971('0x14'),auth[_0xd971('0x9')](),controller[_0xd971('0x24')]);module[_0xd971('0x25')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index 3ae9de3..d0277ae 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 _0xf253=['connectel','clicksend','plivo','clickatell','csc','infobip','ENUM','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','randomstring','name','STRING','generate','twilio','skebby'];(function(_0x383f4b,_0x25800d){var _0x195528=function(_0x360523){while(--_0x360523){_0x383f4b['push'](_0x383f4b['shift']());}};_0x195528(++_0x25800d);}(_0xf253,0x1b1));var _0x3f25=function(_0x17d0ea,_0x227e5e){_0x17d0ea=_0x17d0ea-0x0;var _0x36f095=_0xf253[_0x17d0ea];return _0x36f095;};'use strict';var Sequelize=require(_0x3f25('0x0'));var rs=require(_0x3f25('0x1'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x3f25('0x2'),'allowNull':![]},'key':{'type':Sequelize[_0x3f25('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0x3f25('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0x3f25('0x3')],'defaultValue':function(){return rs[_0x3f25('0x4')]();}},'phone':{'type':Sequelize[_0x3f25('0x3')]},'type':{'type':Sequelize['ENUM'](_0x3f25('0x5'),_0x3f25('0x6'),_0x3f25('0x7'),_0x3f25('0x8'),_0x3f25('0x9'),_0x3f25('0xa'),_0x3f25('0xb'),_0x3f25('0xc'),'intelepeer')},'accountSid':{'type':Sequelize[_0x3f25('0x3')]},'authId':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0x3f25('0x3')]},'smsMethod':{'type':Sequelize[_0x3f25('0xd')]('SI','TI','GP')},'username':{'type':Sequelize[_0x3f25('0x3')]},'password':{'type':Sequelize['STRING']},'apiKey':{'type':Sequelize[_0x3f25('0x3')]},'senderString':{'type':Sequelize[_0x3f25('0x3')]},'deliveryReport':{'type':Sequelize[_0x3f25('0xe')],'defaultValue':![]},'description':{'type':Sequelize[_0x3f25('0x3')]},'notificationTemplate':{'type':Sequelize[_0x3f25('0xf')],'defaultValue':function(){return _0x3f25('0x10');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x3f25('0xe')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x3f25('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x3f25('0xe')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x3f25('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize['STRING']},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x3f25('0x12')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x3f25('0x13'),'set':function(_0x34b93a){if(!_0x34b93a)this['setDataValue']('mandatoryDispositionPauseId',null);this[_0x3f25('0x14')](_0x3f25('0x15'),_0x34b93a);}}}; \ No newline at end of file +var _0xbe7e=['intelepeer','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','generate','ENUM','twilio','skebby','connectel','csc'];(function(_0x4a1f45,_0x4d2af6){var _0xcea73e=function(_0x28d604){while(--_0x28d604){_0x4a1f45['push'](_0x4a1f45['shift']());}};_0xcea73e(++_0x4d2af6);}(_0xbe7e,0x170));var _0xebe7=function(_0x5a8a5e,_0x3541bc){_0x5a8a5e=_0x5a8a5e-0x0;var _0x2f6ef9=_0xbe7e[_0x5a8a5e];return _0x2f6ef9;};'use strict';var Sequelize=require(_0xebe7('0x0'));var rs=require(_0xebe7('0x1'));module[_0xebe7('0x2')]={'name':{'type':Sequelize[_0xebe7('0x3')],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0xebe7('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0xebe7('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0xebe7('0x3')],'defaultValue':function(){return rs[_0xebe7('0x4')]();}},'phone':{'type':Sequelize[_0xebe7('0x3')]},'type':{'type':Sequelize[_0xebe7('0x5')](_0xebe7('0x6'),_0xebe7('0x7'),_0xebe7('0x8'),'clicksend','plivo','clickatell',_0xebe7('0x9'),'infobip',_0xebe7('0xa'))},'accountSid':{'type':Sequelize[_0xebe7('0x3')]},'authId':{'type':Sequelize[_0xebe7('0x3')]},'authToken':{'type':Sequelize[_0xebe7('0x3')]},'smsMethod':{'type':Sequelize['ENUM']('SI','TI','GP')},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xebe7('0x3')]},'apiKey':{'type':Sequelize[_0xebe7('0x3')]},'senderString':{'type':Sequelize[_0xebe7('0x3')]},'deliveryReport':{'type':Sequelize[_0xebe7('0xb')],'defaultValue':![]},'description':{'type':Sequelize[_0xebe7('0x3')]},'notificationTemplate':{'type':Sequelize[_0xebe7('0xc')],'defaultValue':function(){return _0xebe7('0xd');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xebe7('0xb')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xebe7('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xebe7('0xb')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xebe7('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize['STRING']},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xebe7('0xb')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x5543cf){if(!_0x5543cf)this[_0xebe7('0xf')](_0xebe7('0x10'),null);this[_0xebe7('0xf')](_0xebe7('0x11'),_0x5543cf);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index 4e79739..d4ec321 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 _0x9f37=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','redis','defaults','localhost','./smsAccount.socket','register','jayson/promise','client','http','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','end','json','count','offset','limit','set','Content-Range','apply','update','get','SmsAccounts','UserProfileResource','destroy','stack','name','send','index','Pause','mandatoryDispositionPause','map','SmsAccount','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','params','rawAttributes','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','SmsAccountId','Disposition','getDispositions','findOne','hasOwnProperty','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','notify','sms','SmsApplication','account','applications','Applications','priority','asc','CmContact','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','from','From','Body','messageId','MessageSid','sender','connectel','clicksend','message_id','plivo','Text','MessageUUID','infobip','results','text','csc','originatingAddress','segmentedMessage','clickatell','intelepeer','refid','isNil','from\x20is\x20mandatory','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','Contacts','DESC','contact','SmsInteraction','spread','interaction','created','autoclose','close','unmanaged','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','receiveMessage','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','\x0a','sequelize','transaction','bulkCreate','findAndCountAll','getApplications','Contact','Owner','internal','Tag','Tags','color','tag','to\x20is\x20mandatory','List','SmsMessage','Messages','dataValues','push','log','inspect','skebby','skebby_dispatch_id','requestid','statusInt','status_code','groupName','DELIVERED','redif','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','ACCEPTD','statusGet','received\x20delivery\x20report\x20from','state','message-id','addAgents','omit','emit','userSmsAccount:save','removeAgents','isArray','getAgents','html-pdf','eml-format','zip-dir','moment','bluebird','mustache','path','sox','lodash','squel','crypto','jsforce','to-csv','querystring','ioredis','../../components/auth/service'];(function(_0x24ca79,_0x41b9b4){var _0x273007=function(_0x4eed7a){while(--_0x4eed7a){_0x24ca79['push'](_0x24ca79['shift']());}};_0x273007(++_0x41b9b4);}(_0x9f37,0xd1));var _0x79f3=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0x9f37[_0x5f0089];return _0x193892;};'use strict';var pdf=require(_0x79f3('0x0'));var emlformat=require(_0x79f3('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x79f3('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x79f3('0x3'));var BPromise=require(_0x79f3('0x4'));var Mustache=require(_0x79f3('0x5'));var util=require('util');var path=require(_0x79f3('0x6'));var sox=require(_0x79f3('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x79f3('0x8'));var squel=require(_0x79f3('0x9'));var crypto=require(_0x79f3('0xa'));var jsforce=require(_0x79f3('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x79f3('0xc'));var querystring=require(_0x79f3('0xd'));var Papa=require('papaparse');var Redis=require(_0x79f3('0xe'));var authService=require(_0x79f3('0xf'));var qs=require(_0x79f3('0x10'));var as=require(_0x79f3('0x11'));var hardwareService=require(_0x79f3('0x12'));var logger=require('../../config/logger')(_0x79f3('0x13'));var utils=require(_0x79f3('0x14'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x79f3('0x15')]=_[_0x79f3('0x16')](config[_0x79f3('0x15')],{'host':_0x79f3('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x79f3('0x15')]));require(_0x79f3('0x18'))[_0x79f3('0x19')](socket);var jayson=require(_0x79f3('0x1a'));var client=jayson[_0x79f3('0x1b')][_0x79f3('0x1c')]({'port':0x232c});function checkPasswordPattern(_0x5a79eb,_0x5764d4,_0x39c0bb){if(_0x39c0bb){var _0x7bf340=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x7bf340['test'](_0x5764d4)){return _0x5a79eb;}else{throw new db[(_0x79f3('0x1d'))][(_0x79f3('0x1e'))](_0x79f3('0x1f'));}}else{return _0x5a79eb;}}function respondWithRpcPromise(_0x162f71,_0x51685f,_0x31e411,_0x897f98){return new BPromise(function(_0x2179d0,_0x331b30){var _0x430f4c=_0x897f98||client;return _0x430f4c[_0x79f3('0x20')](_0x162f71,_0x31e411)[_0x79f3('0x21')](function(_0x4064b5){logger[_0x79f3('0x22')](_0x79f3('0x23'),_0x51685f,_0x79f3('0x24'));logger[_0x79f3('0x25')](_0x79f3('0x26'),_0x51685f,_0x79f3('0x24'),JSON[_0x79f3('0x27')](_0x4064b5));if(_0x4064b5[_0x79f3('0x28')]){if(_0x4064b5[_0x79f3('0x28')][_0x79f3('0x29')]===0x1f4){logger[_0x79f3('0x28')](_0x79f3('0x23'),_0x51685f,_0x4064b5[_0x79f3('0x28')][_0x79f3('0x2a')]);return _0x331b30(_0x4064b5[_0x79f3('0x28')][_0x79f3('0x2a')]);}logger[_0x79f3('0x28')]('SmsAccount,\x20%s,\x20%s',_0x51685f,_0x4064b5[_0x79f3('0x28')]['message']);return _0x2179d0(_0x4064b5[_0x79f3('0x28')][_0x79f3('0x2a')]);}else{logger[_0x79f3('0x22')]('SmsAccount,\x20%s,\x20%s',_0x51685f,'request\x20sent');_0x2179d0(_0x4064b5[_0x79f3('0x2b')][_0x79f3('0x2a')]);}})[_0x79f3('0x2c')](function(_0x2e0bcb){logger[_0x79f3('0x28')](_0x79f3('0x23'),_0x51685f,_0x2e0bcb);_0x331b30(_0x2e0bcb);});});}function respondWithStatusCode(_0x5d7954,_0x31efe8){_0x31efe8=_0x31efe8||0xcc;return function(_0x30b394){if(_0x30b394){return _0x5d7954['sendStatus'](_0x31efe8);}return _0x5d7954[_0x79f3('0x2d')](_0x31efe8)[_0x79f3('0x2e')]();};}function respondWithResult(_0x39ab86,_0x4c3c11){_0x4c3c11=_0x4c3c11||0xc8;return function(_0x4b0670){if(_0x4b0670){return _0x39ab86[_0x79f3('0x2d')](_0x4c3c11)[_0x79f3('0x2f')](_0x4b0670);}};}function respondWithFilteredResult(_0x1cb0c5,_0x337911){return function(_0x205267){if(_0x205267){var _0x69d14f=_0x205267[_0x79f3('0x30')],_0x3db9cd=_0x337911[_0x79f3('0x31')],_0x250a48=_0x337911[_0x79f3('0x31')]+_0x337911[_0x79f3('0x32')],_0x3b30ce;if(_0x250a48>=_0x69d14f){_0x250a48=_0x69d14f;_0x3b30ce=0xc8;}else{_0x3b30ce=0xce;}_0x1cb0c5[_0x79f3('0x2d')](_0x3b30ce);return _0x1cb0c5[_0x79f3('0x33')](_0x79f3('0x34'),_0x3db9cd+'-'+_0x250a48+'/'+_0x69d14f)[_0x79f3('0x2f')](_0x205267);}return null;};}function patchUpdates(_0x29e665){return function(_0x20108a){try{jsonpatch[_0x79f3('0x35')](_0x20108a,_0x29e665,!![]);}catch(_0x9fe9){return BPromise['reject'](_0x9fe9);}return _0x20108a['save']();};}function saveUpdates(_0x36554f,_0x4f154f){return function(_0x98195e){if(_0x98195e){return _0x98195e[_0x79f3('0x36')](_0x36554f)[_0x79f3('0x21')](function(_0x518dca){return _0x518dca;});}return null;};}function removeEntity(_0x356a48,_0x323414){return function(_0x22b732){if(_0x22b732){return _0x22b732['destroy']()[_0x79f3('0x21')](function(){var _0x5a77d2=_0x22b732[_0x79f3('0x37')]({'plain':!![]});var _0x49a237=_0x79f3('0x38');return db[_0x79f3('0x39')][_0x79f3('0x3a')]({'where':{'type':_0x49a237,'resourceId':_0x5a77d2['id']}})[_0x79f3('0x21')](function(){return _0x22b732;});})[_0x79f3('0x21')](function(){_0x356a48['status'](0xcc)[_0x79f3('0x2e')]();});}};}function handleEntityNotFound(_0x118ec3,_0xd34738){return function(_0x559429){if(!_0x559429){_0x118ec3['sendStatus'](0x194);}return _0x559429;};}function handleError(_0x90ff00,_0xa88d7c){_0xa88d7c=_0xa88d7c||0x1f4;return function(_0x4e20a2){logger[_0x79f3('0x28')](_0x4e20a2[_0x79f3('0x3b')]);if(_0x4e20a2['name']){delete _0x4e20a2[_0x79f3('0x3c')];}_0x90ff00['status'](_0xa88d7c)[_0x79f3('0x3d')](_0x4e20a2);};}exports[_0x79f3('0x3e')]=function(_0x1c94cb,_0x1cad9e){var _0x552ae6={'include':[{'model':db[_0x79f3('0x3f')],'as':_0x79f3('0x40')}]},_0x4440fc={},_0x5372ea={'count':0x0,'rows':[]};var _0x5bc78b=_[_0x79f3('0x41')](db[_0x79f3('0x42')]['rawAttributes'],function(_0x447cfb){return{'name':_0x447cfb[_0x79f3('0x43')],'type':_0x447cfb[_0x79f3('0x44')][_0x79f3('0x45')]};});_0x4440fc[_0x79f3('0x46')]=_[_0x79f3('0x41')](_0x5bc78b,'name');_0x4440fc[_0x79f3('0x47')]=_[_0x79f3('0x48')](_0x1c94cb[_0x79f3('0x47')]);_0x4440fc[_0x79f3('0x49')]=_['intersection'](_0x4440fc['model'],_0x4440fc[_0x79f3('0x47')]);_0x552ae6['attributes']=_[_0x79f3('0x4a')](_0x4440fc[_0x79f3('0x46')],qs[_0x79f3('0x4b')](_0x1c94cb[_0x79f3('0x47')][_0x79f3('0x4b')]));_0x552ae6[_0x79f3('0x4c')]=_0x552ae6['attributes'][_0x79f3('0x4d')]?_0x552ae6[_0x79f3('0x4c')]:_0x4440fc['model'];if(!_0x1c94cb[_0x79f3('0x47')]['hasOwnProperty'](_0x79f3('0x4e'))){_0x552ae6[_0x79f3('0x32')]=qs['limit'](_0x1c94cb[_0x79f3('0x47')][_0x79f3('0x32')]);_0x552ae6[_0x79f3('0x31')]=qs[_0x79f3('0x31')](_0x1c94cb[_0x79f3('0x47')][_0x79f3('0x31')]);}_0x552ae6[_0x79f3('0x4f')]=qs['sort'](_0x1c94cb[_0x79f3('0x47')][_0x79f3('0x50')]);_0x552ae6['where']=qs[_0x79f3('0x49')](_[_0x79f3('0x51')](_0x1c94cb[_0x79f3('0x47')],_0x4440fc[_0x79f3('0x49')]));if(_0x1c94cb[_0x79f3('0x47')][_0x79f3('0x52')]){_0x552ae6[_0x79f3('0x53')]=_['merge'](_0x552ae6[_0x79f3('0x53')],{'$or':_['map'](_0x5bc78b,function(_0x3f69e8){if(_0x3f69e8[_0x79f3('0x44')]!==_0x79f3('0x54')){var _0x1a75f9={};_0x1a75f9[_0x3f69e8[_0x79f3('0x3c')]]={'$like':'%'+_0x1c94cb[_0x79f3('0x47')][_0x79f3('0x52')]+'%'};return _0x1a75f9;}})});}_0x552ae6=_[_0x79f3('0x55')]({},_0x552ae6,_0x1c94cb[_0x79f3('0x56')]);var _0x405bcd={'where':_0x552ae6[_0x79f3('0x53')]};return db['SmsAccount'][_0x79f3('0x30')](_0x405bcd)[_0x79f3('0x21')](function(_0x3498b1){_0x5372ea['count']=_0x3498b1;if(_0x1c94cb[_0x79f3('0x47')][_0x79f3('0x57')]){_0x552ae6[_0x79f3('0x58')]=[{'all':!![]}];}return db[_0x79f3('0x42')][_0x79f3('0x59')](_0x552ae6);})[_0x79f3('0x21')](function(_0x159fd4){_0x5372ea[_0x79f3('0x5a')]=_0x159fd4;return _0x5372ea;})[_0x79f3('0x21')](respondWithFilteredResult(_0x1cad9e,_0x552ae6))[_0x79f3('0x2c')](handleError(_0x1cad9e,null));};exports['show']=function(_0xd9e6bf,_0x349943){var _0x2935ff={'raw':![],'where':{'id':_0xd9e6bf[_0x79f3('0x5b')]['id']},'include':[{'model':db[_0x79f3('0x3f')],'as':_0x79f3('0x40')}]},_0x2aed12={};_0x2aed12[_0x79f3('0x46')]=_[_0x79f3('0x48')](db[_0x79f3('0x42')][_0x79f3('0x5c')]);_0x2aed12[_0x79f3('0x47')]=_[_0x79f3('0x48')](_0xd9e6bf[_0x79f3('0x47')]);_0x2aed12[_0x79f3('0x49')]=_[_0x79f3('0x4a')](_0x2aed12[_0x79f3('0x46')],_0x2aed12[_0x79f3('0x47')]);_0x2935ff[_0x79f3('0x4c')]=_[_0x79f3('0x4a')](_0x2aed12[_0x79f3('0x46')],qs[_0x79f3('0x4b')](_0xd9e6bf[_0x79f3('0x47')]['fields']));_0x2935ff[_0x79f3('0x4c')]=_0x2935ff['attributes']['length']?_0x2935ff[_0x79f3('0x4c')]:_0x2aed12['model'];if(_0xd9e6bf[_0x79f3('0x47')][_0x79f3('0x57')]){_0x2935ff[_0x79f3('0x58')]=[{'all':!![]}];}_0x2935ff=_[_0x79f3('0x55')]({},_0x2935ff,_0xd9e6bf[_0x79f3('0x56')]);return db[_0x79f3('0x42')]['find'](_0x2935ff)[_0x79f3('0x21')](handleEntityNotFound(_0x349943,null))[_0x79f3('0x21')](respondWithResult(_0x349943,null))[_0x79f3('0x2c')](handleError(_0x349943,null));};exports[_0x79f3('0x5d')]=function(_0x53674f,_0x1c0e78){return db[_0x79f3('0x42')][_0x79f3('0x5d')](_0x53674f[_0x79f3('0x5e')],{})[_0x79f3('0x21')](function(_0x38279c){var _0x114b26=_0x53674f[_0x79f3('0x5f')][_0x79f3('0x37')]({'plain':!![]});if(!_0x114b26)throw new Error(_0x79f3('0x60'));if(_0x114b26[_0x79f3('0x61')]===_0x79f3('0x5f')){var _0x5c753d=_0x38279c['get']({'plain':!![]});var _0x177654='SmsAccounts';return db['UserProfileSection'][_0x79f3('0x62')]({'where':{'name':_0x177654,'userProfileId':_0x114b26[_0x79f3('0x63')]},'raw':!![]})[_0x79f3('0x21')](function(_0x39023e){if(_0x39023e&&_0x39023e[_0x79f3('0x64')]===0x0){return db[_0x79f3('0x39')][_0x79f3('0x5d')]({'name':_0x5c753d[_0x79f3('0x3c')],'resourceId':_0x5c753d['id'],'type':_0x39023e['name'],'sectionId':_0x39023e['id']},{})[_0x79f3('0x21')](function(){return _0x38279c;});}else{return _0x38279c;}})[_0x79f3('0x2c')](function(_0x190dd9){logger['error'](_0x79f3('0x65'),_0x190dd9);throw _0x190dd9;});}return _0x38279c;})[_0x79f3('0x21')](respondWithResult(_0x1c0e78,0xc9))[_0x79f3('0x2c')](handleError(_0x1c0e78,null));};exports[_0x79f3('0x36')]=function(_0xdd72e0,_0x2ced4e){if(_0xdd72e0[_0x79f3('0x5e')]['id']){delete _0xdd72e0[_0x79f3('0x5e')]['id'];}return db[_0x79f3('0x42')]['find']({'where':{'id':_0xdd72e0['params']['id']},'include':[{'model':db[_0x79f3('0x3f')],'as':_0x79f3('0x40')}]})[_0x79f3('0x21')](handleEntityNotFound(_0x2ced4e,null))[_0x79f3('0x21')](saveUpdates(_0xdd72e0['body'],null))[_0x79f3('0x21')](respondWithResult(_0x2ced4e,null))['catch'](handleError(_0x2ced4e,null));};exports[_0x79f3('0x3a')]=function(_0x5720f9,_0x4e7e80){return db[_0x79f3('0x42')][_0x79f3('0x62')]({'where':{'id':_0x5720f9[_0x79f3('0x5b')]['id']}})[_0x79f3('0x21')](handleEntityNotFound(_0x4e7e80,null))[_0x79f3('0x21')](removeEntity(_0x4e7e80,null))[_0x79f3('0x2c')](handleError(_0x4e7e80,null));};exports['describe']=function(_0x9fe4bf,_0x1ebc6a){return db[_0x79f3('0x42')][_0x79f3('0x66')]()[_0x79f3('0x21')](respondWithResult(_0x1ebc6a,null))[_0x79f3('0x2c')](handleError(_0x1ebc6a,null));};exports[_0x79f3('0x67')]=function(_0x16864d,_0x4c992d,_0x51726f){if(_0x16864d[_0x79f3('0x5e')]['id']){delete _0x16864d[_0x79f3('0x5e')]['id'];}return db['SmsAccount']['find']({'where':{'id':_0x16864d[_0x79f3('0x5b')]['id']}})[_0x79f3('0x21')](handleEntityNotFound(_0x4c992d,null))['then'](function(_0x44f55a){if(_0x44f55a){_0x16864d['body'][_0x79f3('0x68')]=_0x44f55a['id'];return db[_0x79f3('0x69')]['create'](_0x16864d[_0x79f3('0x5e')]);}})[_0x79f3('0x21')](respondWithResult(_0x4c992d,null))[_0x79f3('0x2c')](handleError(_0x4c992d,null));};exports[_0x79f3('0x6a')]=function(_0x33ea04,_0x1be89d,_0x36fd30){var _0x1cca8f={'raw':![],'where':{}};var _0x1b97d9={};var _0x2b5b6d={'count':0x0,'rows':[]};return db[_0x79f3('0x42')][_0x79f3('0x6b')]({'where':{'id':_0x33ea04[_0x79f3('0x5b')]['id']}})[_0x79f3('0x21')](handleEntityNotFound(_0x1be89d,null))[_0x79f3('0x21')](function(_0x268442){if(_0x268442){_0x1b97d9[_0x79f3('0x46')]=_['keys'](db['Disposition']['rawAttributes']);_0x1b97d9[_0x79f3('0x47')]=_['keys'](_0x33ea04[_0x79f3('0x47')]);_0x1b97d9[_0x79f3('0x49')]=_[_0x79f3('0x4a')](_0x1b97d9[_0x79f3('0x46')],_0x1b97d9['query']);_0x1cca8f['attributes']=_[_0x79f3('0x4a')](_0x1b97d9[_0x79f3('0x46')],qs[_0x79f3('0x4b')](_0x33ea04[_0x79f3('0x47')][_0x79f3('0x4b')]));_0x1cca8f[_0x79f3('0x4c')]=_0x1cca8f[_0x79f3('0x4c')][_0x79f3('0x4d')]?_0x1cca8f[_0x79f3('0x4c')]:_0x1b97d9[_0x79f3('0x46')];if(!_0x33ea04[_0x79f3('0x47')][_0x79f3('0x6c')](_0x79f3('0x4e'))){_0x1cca8f[_0x79f3('0x32')]=qs[_0x79f3('0x32')](_0x33ea04['query'][_0x79f3('0x32')]);_0x1cca8f[_0x79f3('0x31')]=qs[_0x79f3('0x31')](_0x33ea04[_0x79f3('0x47')][_0x79f3('0x31')]);}_0x1cca8f[_0x79f3('0x4f')]=qs[_0x79f3('0x50')](_0x33ea04[_0x79f3('0x47')][_0x79f3('0x50')]);_0x1cca8f[_0x79f3('0x53')]=qs['filters'](_[_0x79f3('0x51')](_0x33ea04[_0x79f3('0x47')],_0x1b97d9[_0x79f3('0x49')]));_0x1cca8f[_0x79f3('0x53')]['SmsAccountId']=_0x268442['id'];if(_0x33ea04[_0x79f3('0x47')][_0x79f3('0x52')]){_0x1cca8f['where']=_[_0x79f3('0x55')](_0x1cca8f[_0x79f3('0x53')],{'$or':_['map'](_0x1cca8f[_0x79f3('0x4c')],function(_0x2e9cf0){var _0x51097a={};_0x51097a[_0x2e9cf0]={'$like':'%'+_0x33ea04['query'][_0x79f3('0x52')]+'%'};return _0x51097a;})});}_0x1cca8f=_[_0x79f3('0x55')]({},_0x1cca8f,_0x33ea04[_0x79f3('0x56')]);return db[_0x79f3('0x69')][_0x79f3('0x30')]({'where':_0x1cca8f['where']})[_0x79f3('0x21')](function(_0x58c671){_0x2b5b6d[_0x79f3('0x30')]=_0x58c671;if(_0x33ea04[_0x79f3('0x47')]['includeAll']){_0x1cca8f[_0x79f3('0x58')]=[{'all':!![]}];}return db[_0x79f3('0x69')]['findAll'](_0x1cca8f);})[_0x79f3('0x21')](function(_0x1ea9a4){_0x2b5b6d['rows']=_0x1ea9a4;return _0x2b5b6d;});}})[_0x79f3('0x21')](respondWithFilteredResult(_0x1be89d,_0x1cca8f))[_0x79f3('0x2c')](handleError(_0x1be89d,null));};exports['removeDispositions']=function(_0x357982,_0x232198,_0x16efa0){return db[_0x79f3('0x42')][_0x79f3('0x62')]({'where':{'id':_0x357982[_0x79f3('0x5b')]['id']}})[_0x79f3('0x21')](handleEntityNotFound(_0x232198,null))['then'](function(_0x438030){if(_0x438030){return _0x438030['removeDispositions'](_0x357982['query'][_0x79f3('0x6d')]);}})[_0x79f3('0x21')](respondWithStatusCode(_0x232198,null))[_0x79f3('0x2c')](handleError(_0x232198,null));};exports[_0x79f3('0x6e')]=function(_0x4e0ec5,_0x4a8e49,_0x3a9c11){if(_0x4e0ec5[_0x79f3('0x5e')]['id']){delete _0x4e0ec5[_0x79f3('0x5e')]['id'];}return db[_0x79f3('0x42')]['find']({'where':{'id':_0x4e0ec5[_0x79f3('0x5b')]['id']}})[_0x79f3('0x21')](handleEntityNotFound(_0x4a8e49,null))[_0x79f3('0x21')](function(_0x427774){if(_0x427774){_0x4e0ec5[_0x79f3('0x5e')][_0x79f3('0x68')]=_0x427774['id'];return db[_0x79f3('0x6f')][_0x79f3('0x5d')](_0x4e0ec5[_0x79f3('0x5e')]);}})[_0x79f3('0x21')](respondWithResult(_0x4a8e49,null))[_0x79f3('0x2c')](handleError(_0x4a8e49,null));};exports[_0x79f3('0x70')]=function(_0x54262e,_0x47db63,_0x2fc340){var _0x283c1e={'raw':![],'where':{}};var _0x528975={};var _0x135606={'count':0x0,'rows':[]};return db[_0x79f3('0x42')]['findOne']({'where':{'id':_0x54262e['params']['id']}})['then'](handleEntityNotFound(_0x47db63,null))[_0x79f3('0x21')](function(_0x1bacb2){if(_0x1bacb2){_0x528975[_0x79f3('0x46')]=_['keys'](db[_0x79f3('0x6f')]['rawAttributes']);_0x528975['query']=_[_0x79f3('0x48')](_0x54262e[_0x79f3('0x47')]);_0x528975['filters']=_['intersection'](_0x528975[_0x79f3('0x46')],_0x528975[_0x79f3('0x47')]);_0x283c1e[_0x79f3('0x4c')]=_[_0x79f3('0x4a')](_0x528975[_0x79f3('0x46')],qs[_0x79f3('0x4b')](_0x54262e[_0x79f3('0x47')][_0x79f3('0x4b')]));_0x283c1e[_0x79f3('0x4c')]=_0x283c1e[_0x79f3('0x4c')][_0x79f3('0x4d')]?_0x283c1e['attributes']:_0x528975[_0x79f3('0x46')];if(!_0x54262e[_0x79f3('0x47')][_0x79f3('0x6c')]('nolimit')){_0x283c1e[_0x79f3('0x32')]=qs['limit'](_0x54262e['query']['limit']);_0x283c1e['offset']=qs[_0x79f3('0x31')](_0x54262e[_0x79f3('0x47')][_0x79f3('0x31')]);}_0x283c1e['order']=qs[_0x79f3('0x50')](_0x54262e['query']['sort']);_0x283c1e[_0x79f3('0x53')]=qs[_0x79f3('0x49')](_[_0x79f3('0x51')](_0x54262e[_0x79f3('0x47')],_0x528975['filters']));_0x283c1e[_0x79f3('0x53')][_0x79f3('0x68')]=_0x1bacb2['id'];if(_0x54262e[_0x79f3('0x47')][_0x79f3('0x52')]){_0x283c1e[_0x79f3('0x53')]=_[_0x79f3('0x55')](_0x283c1e[_0x79f3('0x53')],{'$or':_[_0x79f3('0x41')](_0x283c1e['attributes'],function(_0x1ca3bd){var _0x24cc98={};_0x24cc98[_0x1ca3bd]={'$like':'%'+_0x54262e[_0x79f3('0x47')][_0x79f3('0x52')]+'%'};return _0x24cc98;})});}_0x283c1e=_[_0x79f3('0x55')]({},_0x283c1e,_0x54262e[_0x79f3('0x56')]);return db['CannedAnswer'][_0x79f3('0x30')]({'where':_0x283c1e['where']})[_0x79f3('0x21')](function(_0xd2c1b5){_0x135606[_0x79f3('0x30')]=_0xd2c1b5;if(_0x54262e[_0x79f3('0x47')][_0x79f3('0x57')]){_0x283c1e['include']=[{'all':!![]}];}return db[_0x79f3('0x6f')]['findAll'](_0x283c1e);})[_0x79f3('0x21')](function(_0xf76ea8){_0x135606['rows']=_0xf76ea8;return _0x135606;});}})['then'](respondWithFilteredResult(_0x47db63,_0x283c1e))[_0x79f3('0x2c')](handleError(_0x47db63,null));};exports[_0x79f3('0x71')]=function(_0x171dfd,_0x53202e,_0x5d69b2){return db[_0x79f3('0x42')]['find']({'where':{'id':_0x171dfd[_0x79f3('0x5b')]['id']}})['then'](handleEntityNotFound(_0x53202e,null))['then'](function(_0x325b2b){if(_0x325b2b){return _0x325b2b[_0x79f3('0x71')](_0x171dfd['query']['ids']);}})[_0x79f3('0x21')](respondWithStatusCode(_0x53202e,null))[_0x79f3('0x2c')](handleError(_0x53202e,null));};exports[_0x79f3('0x72')]=function(_0x4f914b,_0x42fcc9,_0x2dda2f){var _0x17a04f={'channel':_0x79f3('0x73')};var _0x1b1a56=[];var _0x32837f=[];var _0x5662fb={};return db[_0x79f3('0x42')][_0x79f3('0x62')]({'where':{'id':_0x4f914b[_0x79f3('0x5b')]['id']},'include':[{'model':db[_0x79f3('0x74')],'as':'Applications'}]})[_0x79f3('0x21')](handleEntityNotFound(_0x42fcc9,null))['then'](function(_0x3fcb0f){_0x17a04f[_0x79f3('0x75')]=_0x3fcb0f;_0x17a04f[_0x79f3('0x76')]=_['orderBy'](_0x3fcb0f[_0x79f3('0x77')],[_0x79f3('0x78')],[_0x79f3('0x79')]);if(_0x17a04f[_0x79f3('0x75')]['Applications']){delete _0x17a04f[_0x79f3('0x75')][_0x79f3('0x77')];}return db[_0x79f3('0x7a')]['describe']();})[_0x79f3('0x21')](function(_0x22b4f5){if(!_0x22b4f5){throw new db[(_0x79f3('0x1d'))]['ValidationError'](_0x79f3('0x7b'));}_0x1b1a56=_[_0x79f3('0x7c')](_[_0x79f3('0x48')](_0x22b4f5),[_0x79f3('0x7d'),_0x79f3('0x7e')]);_0x32837f=_[_0x79f3('0x7c')](_['keys'](_0x22b4f5),[_0x79f3('0x7d'),'updatedAt',_0x79f3('0x7f'),_0x79f3('0x80')]);_0x17a04f[_0x79f3('0x5e')]={'mapKey':_0x79f3('0x81')};if(_0x17a04f[_0x79f3('0x75')][_0x79f3('0x44')]){switch(_0x17a04f[_0x79f3('0x75')][_0x79f3('0x44')]){case _0x79f3('0x82'):_0x17a04f[_0x79f3('0x5e')][_0x79f3('0x83')]=_0x4f914b['body'][_0x79f3('0x84')];_0x17a04f[_0x79f3('0x5e')]['body']=_0x4f914b[_0x79f3('0x5e')][_0x79f3('0x85')];_0x17a04f[_0x79f3('0x5e')][_0x79f3('0x86')]=_0x4f914b[_0x79f3('0x5e')][_0x79f3('0x87')];break;case'skebby':_0x17a04f['body'][_0x79f3('0x83')]='+'+_0x4f914b[_0x79f3('0x5e')][_0x79f3('0x88')];_0x17a04f[_0x79f3('0x5e')][_0x79f3('0x5e')]=_0x4f914b[_0x79f3('0x5e')]['text'];break;case _0x79f3('0x89'):_0x17a04f['body'][_0x79f3('0x83')]=_0x4f914b[_0x79f3('0x5e')]['from'];_0x17a04f[_0x79f3('0x5e')][_0x79f3('0x5e')]=_0x4f914b[_0x79f3('0x5e')]['message'];break;case _0x79f3('0x8a'):_0x17a04f[_0x79f3('0x5e')][_0x79f3('0x83')]=_0x4f914b[_0x79f3('0x5e')]['from'];_0x17a04f[_0x79f3('0x5e')][_0x79f3('0x5e')]=_0x4f914b[_0x79f3('0x5e')][_0x79f3('0x5e')];_0x17a04f['body'][_0x79f3('0x86')]=_0x4f914b['body'][_0x79f3('0x8b')];break;case _0x79f3('0x8c'):_0x17a04f[_0x79f3('0x5e')][_0x79f3('0x83')]=_0x4f914b['body'][_0x79f3('0x84')];_0x17a04f[_0x79f3('0x5e')][_0x79f3('0x5e')]=_0x4f914b[_0x79f3('0x5e')][_0x79f3('0x8d')];_0x17a04f[_0x79f3('0x5e')]['messageId']=_0x4f914b[_0x79f3('0x5e')][_0x79f3('0x8e')];break;case _0x79f3('0x8f'):_0x17a04f[_0x79f3('0x5e')][_0x79f3('0x83')]='+'+_0x4f914b[_0x79f3('0x5e')]['results'][0x0][_0x79f3('0x83')];_0x17a04f['body'][_0x79f3('0x5e')]=_0x4f914b[_0x79f3('0x5e')][_0x79f3('0x90')][0x0][_0x79f3('0x91')];_0x17a04f[_0x79f3('0x5e')][_0x79f3('0x86')]=_0x4f914b[_0x79f3('0x5e')]['results'][0x0][_0x79f3('0x86')];break;case _0x79f3('0x92'):_0x17a04f[_0x79f3('0x5e')][_0x79f3('0x83')]=_0x4f914b['body'][_0x79f3('0x93')];_0x17a04f[_0x79f3('0x5e')][_0x79f3('0x5e')]=_0x4f914b[_0x79f3('0x5e')][_0x79f3('0x94')]['message'];break;case _0x79f3('0x95'):_0x17a04f['body'][_0x79f3('0x83')]=_0x4f914b['body']['fromNumber'];_0x17a04f['body'][_0x79f3('0x5e')]=_0x4f914b[_0x79f3('0x5e')][_0x79f3('0x91')];_0x17a04f[_0x79f3('0x5e')]['messageId']=_0x4f914b['body']['replyMessageId'];break;case _0x79f3('0x96'):_0x17a04f['body'][_0x79f3('0x83')]=_0x4f914b[_0x79f3('0x5e')]['from'];_0x17a04f[_0x79f3('0x5e')][_0x79f3('0x5e')]=_0x4f914b[_0x79f3('0x5e')]['message'];_0x17a04f[_0x79f3('0x5e')][_0x79f3('0x86')]=_0x4f914b[_0x79f3('0x5e')][_0x79f3('0x97')];break;}}if(_0x17a04f[_0x79f3('0x5e')]['id']){delete _0x17a04f[_0x79f3('0x5e')]['id'];}if(_[_0x79f3('0x98')](_0x17a04f[_0x79f3('0x5e')][_0x79f3('0x83')])){throw new db[(_0x79f3('0x1d'))][(_0x79f3('0x1e'))](_0x79f3('0x99'));}if(_[_0x79f3('0x98')](_0x17a04f[_0x79f3('0x5e')][_0x79f3('0x5e')])||_0x17a04f['body']['body']===''){throw new db[(_0x79f3('0x1d'))][(_0x79f3('0x1e'))](_0x79f3('0x9a'));}if(_['isNil'](_0x17a04f[_0x79f3('0x5e')][_0x79f3('0x9b')])){throw new db[(_0x79f3('0x1d'))]['ValidationError'](_0x79f3('0x9c')+_0x32837f);}if(!_['includes'](_0x32837f,_0x17a04f[_0x79f3('0x5e')][_0x79f3('0x9b')])){throw new db[(_0x79f3('0x1d'))][(_0x79f3('0x1e'))](_0x79f3('0x9d')+_0x32837f);}_0x5662fb[_0x17a04f[_0x79f3('0x5e')][_0x79f3('0x9b')]]=_0x17a04f['body'][_0x79f3('0x83')];return db[_0x79f3('0x9e')][_0x79f3('0x62')]({'where':{'id':_0x17a04f['account'][_0x79f3('0x80')]},'include':[{'model':db['CmContact'],'as':_0x79f3('0x9f'),'where':_0x5662fb,'limit':0x1,'order':[[_0x79f3('0x7e'),_0x79f3('0xa0')]]}]});})[_0x79f3('0x21')](handleEntityNotFound(_0x42fcc9,null))[_0x79f3('0x21')](function(_0x4d9450){if(_0x4d9450){_0x17a04f['list']=_['omit'](_0x4d9450,[_0x79f3('0x9f')]);if(_0x4d9450[_0x79f3('0x9f')][_0x79f3('0x4d')]){return _0x4d9450[_0x79f3('0x9f')][0x0];}var _0x2c2b50=_[_0x79f3('0x16')](_0x17a04f[_0x79f3('0x5e')],{'firstName':_0x17a04f[_0x79f3('0x5e')][_0x79f3('0x83')],'ListId':_0x4d9450['id']});_0x2c2b50[_0x17a04f[_0x79f3('0x5e')]['mapKey']]=_0x17a04f['body'][_0x79f3('0x83')];return db['CmContact'][_0x79f3('0x5d')](_0x2c2b50,{'fields':_0x1b1a56,'raw':!![]});}})[_0x79f3('0x21')](handleEntityNotFound(_0x42fcc9,null))[_0x79f3('0x21')](function(_0x3df77f){if(_0x3df77f){_0x17a04f[_0x79f3('0xa1')]=_0x3df77f;var _0x556167={'ContactId':_0x3df77f['id'],'phone':_0x17a04f[_0x79f3('0x5e')]['from'],'SmsAccountId':_0x4f914b['params']['id']};var _0x534bbd={'ContactId':_0x3df77f['id'],'SmsAccountId':_0x4f914b[_0x79f3('0x5b')]['id'],'closed':![]};return db[_0x79f3('0xa2')][_0x79f3('0x62')]({'where':_0x534bbd})['then'](function(_0x2b9572){if(_0x2b9572){return[_0x2b9572,![]];}return db[_0x79f3('0xa2')][_0x79f3('0x5d')](_0x556167)[_0x79f3('0x21')](function(_0x4f9b57){return[_0x4f9b57,!![]];});});}})[_0x79f3('0xa3')](function(_0x91d36e,_0x265793){_0x17a04f['interaction']=_0x91d36e[_0x79f3('0x37')]({'plain':!![]});_0x17a04f[_0x79f3('0xa4')][_0x79f3('0xa5')]=![];if(_0x265793){if(_0x17a04f[_0x79f3('0x75')][_0x79f3('0xa6')]){_0x17a04f[_0x79f3('0x76')]['push']({'id':0x0,'priority':_0x17a04f[_0x79f3('0x76')]['length']+0x1,'app':_0x79f3('0xa7'),'appdata':_0x79f3('0xa8'),'interval':'*,*,*,*'});}_0x17a04f[_0x79f3('0xa4')][_0x79f3('0xa5')]=!![];}return db['SmsMessage'][_0x79f3('0x5d')]({'phone':_0x17a04f[_0x79f3('0x5e')][_0x79f3('0x83')],'messageId':_0x17a04f[_0x79f3('0x5e')][_0x79f3('0x86')],'body':_0x17a04f['body'][_0x79f3('0x5e')],'SmsAccountId':_0x4f914b[_0x79f3('0x5b')]['id'],'SmsInteractionId':_0x91d36e['id'],'direction':'in','ContactId':_0x91d36e['ContactId'],'AttachmentId':_0x17a04f[_0x79f3('0x5e')][_0x79f3('0xa9')]});})[_0x79f3('0x21')](function(_0x1ca7ae){_0x17a04f[_0x79f3('0x2a')]=_0x1ca7ae;if(_0x17a04f[_0x79f3('0xa4')][_0x79f3('0xaa')]){return db[_0x79f3('0xab')][_0x79f3('0x62')]({'attributes':['id',_0x79f3('0x3c')],'where':{'id':_0x17a04f[_0x79f3('0xa4')]['UserId']}})[_0x79f3('0x21')](function(_0xab9f66){if(_0xab9f66){_0x17a04f['applications'][_0x79f3('0xac')]({'id':0x0,'priority':0x0,'app':_0x79f3('0xad'),'appdata':_0xab9f66[_0x79f3('0x3c')]+','+(_0x17a04f['account'][_0x79f3('0xae')]||0xa),'interval':_0x79f3('0xaf')});}return respondWithRpcPromise(_0x79f3('0xb0'),_0x79f3('0xb1'),_0x17a04f);});}return respondWithRpcPromise('Start','startRouting',_0x17a04f);})[_0x79f3('0x21')](function(_0x5cd69e){if(_0x5cd69e){var _0x21e11c=0xc8;var _0x9d2068=_0x79f3('0xb2');logger[_0x79f3('0x22')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x9d2068,_0x21e11c,_0x79f3('0xb3'));logger[_0x79f3('0x25')](_0x79f3('0xb4'),_0x9d2068,_0x21e11c,_0x79f3('0xb3'),JSON['stringify'](_0x5cd69e));if(_0x17a04f['account'][_0x79f3('0x44')]==='twilio'){return _0x42fcc9[_0x79f3('0x2d')](_0x21e11c)[_0x79f3('0x33')](_0x79f3('0xb5'),'text/xml')[_0x79f3('0x3d')](_0x79f3('0xb6'));}else{return _0x42fcc9[_0x79f3('0x2d')](_0x21e11c)['json'](_0x5cd69e);}}})[_0x79f3('0x2c')](handleError(_0x42fcc9,null));};exports['addApplications']=function(_0x493061,_0x24d14a,_0x2e8c20){return db[_0x79f3('0x42')]['findOne']({'where':{'id':_0x493061['params']['id']}})[_0x79f3('0x21')](handleEntityNotFound(_0x24d14a,null))[_0x79f3('0x21')](function(_0x49d17a){if(_0x49d17a){return db[_0x79f3('0xb7')][_0x79f3('0xb8')](function(_0x399e60){return db[_0x79f3('0x74')][_0x79f3('0x3a')]({'where':{'SmsAccountId':_0x493061[_0x79f3('0x5b')]['id']},'transaction':_0x399e60})[_0x79f3('0x21')](function(_0x1c3e9a){var _0x301979=_['map'](_0x493061[_0x79f3('0x5e')],function(_0x5421b2){_0x5421b2[_0x79f3('0x68')]=_0x493061[_0x79f3('0x5b')]['id'];return _0x5421b2;});return db[_0x79f3('0x74')][_0x79f3('0xb9')](_0x301979,{'transaction':_0x399e60});});})[_0x79f3('0x21')](function(){return db[_0x79f3('0x74')][_0x79f3('0xba')]({'where':{'SmsAccountId':_0x493061[_0x79f3('0x5b')]['id']},'order':'priority'});});}})[_0x79f3('0x21')](respondWithResult(_0x24d14a,null))[_0x79f3('0x2c')](handleError(_0x24d14a,null));};exports[_0x79f3('0xbb')]=function(_0x21adb9,_0x169b65,_0x5856e7){var _0x203931={};var _0x5ab249={};var _0x3c310b;var _0x588d13;return db['SmsAccount'][_0x79f3('0x6b')]({'where':{'id':_0x21adb9[_0x79f3('0x5b')]['id']}})[_0x79f3('0x21')](handleEntityNotFound(_0x169b65,null))['then'](function(_0x45bd37){if(_0x45bd37){_0x3c310b=_0x45bd37;_0x5ab249[_0x79f3('0x46')]=_['keys'](db[_0x79f3('0x74')][_0x79f3('0x5c')]);_0x5ab249[_0x79f3('0x47')]=_[_0x79f3('0x48')](_0x21adb9[_0x79f3('0x47')]);_0x5ab249[_0x79f3('0x49')]=_['intersection'](_0x5ab249[_0x79f3('0x46')],_0x5ab249[_0x79f3('0x47')]);_0x203931['attributes']=_[_0x79f3('0x4a')](_0x5ab249['model'],qs[_0x79f3('0x4b')](_0x21adb9['query'][_0x79f3('0x4b')]));_0x203931[_0x79f3('0x4c')]=_0x203931[_0x79f3('0x4c')][_0x79f3('0x4d')]?_0x203931[_0x79f3('0x4c')]:_0x5ab249[_0x79f3('0x46')];_0x203931[_0x79f3('0x4f')]=qs['sort'](_0x21adb9[_0x79f3('0x47')]['sort']);_0x203931['where']=qs[_0x79f3('0x49')](_[_0x79f3('0x51')](_0x21adb9['query'],_0x5ab249[_0x79f3('0x49')]));if(_0x21adb9[_0x79f3('0x47')][_0x79f3('0x52')]){_0x203931[_0x79f3('0x53')]=_[_0x79f3('0x55')](_0x203931[_0x79f3('0x53')],{'$or':_[_0x79f3('0x41')](_0x203931[_0x79f3('0x4c')],function(_0x5f478e){var _0x196ace={};_0x196ace[_0x5f478e]={'$like':'%'+_0x21adb9['query'][_0x79f3('0x52')]+'%'};return _0x196ace;})});}_0x203931=_[_0x79f3('0x55')]({},_0x203931,_0x21adb9[_0x79f3('0x56')]);return _0x3c310b[_0x79f3('0xbb')](_0x203931);}})[_0x79f3('0x21')](function(_0x1c45f){if(_0x1c45f){_0x588d13=_0x1c45f[_0x79f3('0x4d')];if(!_0x21adb9[_0x79f3('0x47')][_0x79f3('0x6c')]('nolimit')){_0x203931[_0x79f3('0x32')]=qs[_0x79f3('0x32')](_0x21adb9[_0x79f3('0x47')]['limit']);_0x203931[_0x79f3('0x31')]=qs[_0x79f3('0x31')](_0x21adb9[_0x79f3('0x47')][_0x79f3('0x31')]);}return _0x3c310b['getApplications'](_0x203931);}})[_0x79f3('0x21')](function(_0x72bb05){if(_0x72bb05){return _0x72bb05?{'count':_0x588d13,'rows':_0x72bb05}:null;}})[_0x79f3('0x21')](respondWithResult(_0x169b65,null))[_0x79f3('0x2c')](handleError(_0x169b65,null));};exports['getInteractions']=function(_0x58d7ef,_0x97ad2f,_0x555761){var _0x3cede9={'raw':![],'where':{}};var _0x52d5a4={};var _0x140b8b={'count':0x0,'rows':[]};return db['SmsAccount'][_0x79f3('0x6b')]({'where':{'id':_0x58d7ef[_0x79f3('0x5b')]['id']}})[_0x79f3('0x21')](handleEntityNotFound(_0x97ad2f,null))[_0x79f3('0x21')](function(_0x5c9e38){if(_0x5c9e38){_0x52d5a4[_0x79f3('0x46')]=_[_0x79f3('0x48')](db[_0x79f3('0xa2')][_0x79f3('0x5c')]);_0x52d5a4[_0x79f3('0x47')]=_['keys'](_0x58d7ef[_0x79f3('0x47')]);_0x52d5a4[_0x79f3('0x49')]=_[_0x79f3('0x4a')](_0x52d5a4[_0x79f3('0x46')],_0x52d5a4[_0x79f3('0x47')]);_0x3cede9[_0x79f3('0x4c')]=_[_0x79f3('0x4a')](_0x52d5a4[_0x79f3('0x46')],qs[_0x79f3('0x4b')](_0x58d7ef[_0x79f3('0x47')][_0x79f3('0x4b')]));_0x3cede9[_0x79f3('0x4c')]=_0x3cede9[_0x79f3('0x4c')][_0x79f3('0x4d')]?_0x3cede9[_0x79f3('0x4c')]:_0x52d5a4[_0x79f3('0x46')];if(!_0x58d7ef[_0x79f3('0x47')][_0x79f3('0x6c')]('nolimit')){_0x3cede9[_0x79f3('0x32')]=qs[_0x79f3('0x32')](_0x58d7ef['query']['limit']);_0x3cede9['offset']=qs[_0x79f3('0x31')](_0x58d7ef['query'][_0x79f3('0x31')]);}_0x3cede9[_0x79f3('0x4f')]=qs[_0x79f3('0x50')](_0x58d7ef[_0x79f3('0x47')][_0x79f3('0x50')]);_0x3cede9[_0x79f3('0x53')]=qs[_0x79f3('0x49')](_[_0x79f3('0x51')](_0x58d7ef[_0x79f3('0x47')],_0x52d5a4[_0x79f3('0x49')]));_0x3cede9[_0x79f3('0x53')][_0x79f3('0x68')]=_0x5c9e38['id'];if(_0x58d7ef['query'][_0x79f3('0x52')]){_0x3cede9['where']=_['merge'](_0x3cede9[_0x79f3('0x53')],{'$or':_['map'](_0x3cede9[_0x79f3('0x4c')],function(_0xb9fa35){var _0xdcbe8b={};_0xdcbe8b[_0xb9fa35]={'$like':'%'+_0x58d7ef['query'][_0x79f3('0x52')]+'%'};return _0xdcbe8b;})});}_0x3cede9=_['merge']({},_0x3cede9,_0x58d7ef[_0x79f3('0x56')]);return db[_0x79f3('0xa2')][_0x79f3('0x30')]({'where':_0x3cede9[_0x79f3('0x53')]})[_0x79f3('0x21')](function(_0x51899e){_0x140b8b[_0x79f3('0x30')]=_0x51899e;if(_0x58d7ef[_0x79f3('0x47')]['includeAll']){_0x3cede9['include']=[{'model':db[_0x79f3('0x7a')],'as':_0x79f3('0xbc'),'required':![]},{'model':db[_0x79f3('0xab')],'as':_0x79f3('0xbd'),'attributes':[_0x79f3('0x3c'),'fullname',_0x79f3('0xbe')],'required':![]},{'model':db[_0x79f3('0xbf')],'as':_0x79f3('0xc0'),'attributes':['id',_0x79f3('0x3c'),_0x79f3('0xc1')],'where':_0x58d7ef[_0x79f3('0x47')][_0x79f3('0xc2')]?{'id':_0x58d7ef[_0x79f3('0x47')][_0x79f3('0xc2')]}:undefined,'required':_0x58d7ef[_0x79f3('0x47')]['tag']?!![]:![]}];}return db[_0x79f3('0xa2')]['findAll'](_0x3cede9);})[_0x79f3('0x21')](function(_0x5b0dd5){_0x140b8b[_0x79f3('0x5a')]=_0x5b0dd5;return _0x140b8b;});}})[_0x79f3('0x21')](respondWithFilteredResult(_0x97ad2f,_0x3cede9))[_0x79f3('0x2c')](handleError(_0x97ad2f,null));};exports['send']=function(_0x567389,_0x3011c3,_0x10b8ba){var _0x37e7e0,_0x4fa1df,_0x133d7c;if(_[_0x79f3('0x98')](_0x567389[_0x79f3('0x5e')]['body'])||_0x567389[_0x79f3('0x5e')][_0x79f3('0x5e')]===''){throw new db[(_0x79f3('0x1d'))][(_0x79f3('0x1e'))](_0x79f3('0x9a'));}if(_[_0x79f3('0x98')](_0x567389[_0x79f3('0x5e')]['to'])){throw new db[(_0x79f3('0x1d'))]['ValidationError'](_0x79f3('0xc3'));}_0x37e7e0=_0x567389[_0x79f3('0x5e')]['to'];return db[_0x79f3('0x42')]['find']({'where':{'id':_0x567389[_0x79f3('0x5b')]['id']},'include':[{'model':db['CmList'],'as':_0x79f3('0xc4'),'include':[{'model':db[_0x79f3('0x7a')],'as':_0x79f3('0x9f'),'where':{'mobile':_0x37e7e0},'limit':0x1,'order':[['updatedAt',_0x79f3('0xa0')]]}]}]})[_0x79f3('0x21')](handleEntityNotFound(_0x3011c3,null))['then'](function(_0x2ac3af){if(_0x2ac3af&&_0x2ac3af[_0x79f3('0xc4')]){_0x4fa1df=_0x2ac3af[_0x79f3('0x37')]({'plain':!![]});if(_0x4fa1df['List']&&_0x4fa1df[_0x79f3('0xc4')][_0x79f3('0x9f')][_0x79f3('0x4d')]){return _0x4fa1df[_0x79f3('0xc4')][_0x79f3('0x9f')][0x0];}return db[_0x79f3('0x7a')][_0x79f3('0x5d')](_[_0x79f3('0x16')](_0x567389['body'],{'firstName':_0x37e7e0,'mobile':_0x37e7e0,'phone':_0x37e7e0,'ListId':_0x4fa1df[_0x79f3('0x80')]}));}})[_0x79f3('0x21')](handleEntityNotFound(_0x3011c3,null))['then'](function(_0x31472d){if(_0x31472d){_0x133d7c=_0x31472d;return db[_0x79f3('0xa2')][_0x79f3('0x62')]({'where':{'ContactId':_0x133d7c['id'],'closed':![],'SmsAccountId':_0x4fa1df['id']}})[_0x79f3('0x21')](function(_0x560dfe){if(_0x560dfe){return[_0x560dfe,![]];}return db[_0x79f3('0xa2')][_0x79f3('0x5d')]({'UserId':_0x567389['user']['id'],'ContactId':_0x133d7c['id'],'SmsAccountId':_0x4fa1df['id'],'phone':_0x37e7e0,'firstMsgDirection':'out','Messages':[_[_0x79f3('0x55')](_0x567389[_0x79f3('0x5e')],{'read':![],'body':_0x567389[_0x79f3('0x5e')]['body'],'phone':_0x37e7e0,'SmsAccountId':_0x4fa1df['id'],'UserId':_0x567389['user']['id'],'ContactId':_0x133d7c['id']})]},{'include':[{'model':db[_0x79f3('0xc5')],'as':'Messages'}]})[_0x79f3('0x21')](function(_0x4a647f){return[_0x4a647f,!![]];});});}})[_0x79f3('0xa3')](function(_0x316b87,_0x181ca2){if(_0x181ca2){return _0x316b87;}return db['SmsMessage']['create'](_['merge'](_0x567389['body'],{'read':![],'body':_0x567389[_0x79f3('0x5e')][_0x79f3('0x5e')],'phone':_0x37e7e0,'SmsAccountId':_0x4fa1df['id'],'SmsInteractionId':_0x316b87['id'],'UserId':_0x567389[_0x79f3('0x5f')]['id'],'ContactId':_0x133d7c['id']}))['then'](function(_0x3cb0df){_0x316b87['dataValues'][_0x79f3('0xc6')]=[];_0x316b87[_0x79f3('0xc7')]['Messages'][_0x79f3('0xc8')](_0x3cb0df['dataValues']);return _0x316b87;});})['then'](respondWithResult(_0x3011c3,null))['catch'](handleError(_0x3011c3,null));};exports['status']=function(_0x151fac,_0x3a694d,_0x5da41e){if(_0x151fac[_0x79f3('0x5e')]['id']){delete _0x151fac[_0x79f3('0x5e')]['id'];}console[_0x79f3('0xc9')]('endpoint\x20/status\x20POST\x20/',_0x151fac[_0x79f3('0x5e')]);var _0x1f261a,_0x3e28de,_0x46a13c;return db[_0x79f3('0x42')][_0x79f3('0x62')]({'where':{'id':_0x151fac[_0x79f3('0x5b')]['id']}})[_0x79f3('0x21')](handleEntityNotFound(_0x3a694d,null))[_0x79f3('0x21')](function(_0x2a5d99){if(_0x2a5d99){_0x46a13c=_0x2a5d99;logger[_0x79f3('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s','status','received\x20delivery\x20report\x20from',_0x2a5d99['type'],util[_0x79f3('0xca')](_0x151fac[_0x79f3('0x5e')],{'showHidden':![],'depth':null}));switch(_0x2a5d99[_0x79f3('0x44')]){case _0x79f3('0xcb'):if(_0x151fac['body'][_0x79f3('0xcc')]&&_0x151fac[_0x79f3('0x5e')]['status']){_0x3e28de=_0x151fac[_0x79f3('0x5e')][_0x79f3('0x2d')];return db['SmsMessage'][_0x79f3('0x62')]({'where':{'messageId':_0x151fac[_0x79f3('0x5e')][_0x79f3('0xcc')]}});}break;case _0x79f3('0x89'):if(_0x151fac['body'][_0x79f3('0xcd')]&&_0x151fac['body'][_0x79f3('0xce')]){_0x3e28de=_0x151fac[_0x79f3('0x5e')]['statusInt'];return db[_0x79f3('0xc5')]['find']({'where':{'messageId':_0x151fac[_0x79f3('0x5e')][_0x79f3('0xcd')]}});}break;case _0x79f3('0x8a'):if(_0x151fac['body']['message_id']&&_0x151fac[_0x79f3('0x5e')]['status_code']){_0x3e28de=_0x151fac[_0x79f3('0x5e')][_0x79f3('0xcf')];return db[_0x79f3('0xc5')][_0x79f3('0x62')]({'where':{'messageId':_0x151fac[_0x79f3('0x5e')][_0x79f3('0x8b')]}});}break;case _0x79f3('0x8f'):var _0x527dd3=_0x151fac['body']['results'][0x0];if(_0x527dd3[_0x79f3('0x86')]&&_0x527dd3[_0x79f3('0x2d')][_0x79f3('0xd0')]===_0x79f3('0xd1')){_0x3e28de=_0x527dd3[_0x79f3('0x2d')]['groupName'];return db['SmsMessage'][_0x79f3('0x62')]({'where':{'messageId':_0x527dd3[_0x79f3('0x86')]}});}break;case _0x79f3('0x95'):if(_0x151fac[_0x79f3('0x5e')][_0x79f3('0x86')]&&_0x151fac[_0x79f3('0x5e')][_0x79f3('0x2d')]){_0x3e28de=_0x151fac['body']['status'];return db[_0x79f3('0xc5')][_0x79f3('0x62')]({'where':{'messageId':_0x151fac['body'][_0x79f3('0x86')]}});}break;case _0x79f3('0x96'):if(_0x151fac[_0x79f3('0x5e')][_0x79f3('0xd2')]&&_0x151fac[_0x79f3('0x5e')][_0x79f3('0x2d')]){_0x3e28de=_0x151fac[_0x79f3('0x5e')][_0x79f3('0x2d')];return db['SmsMessage'][_0x79f3('0x62')]({'where':{'messageId':_0x151fac['body'][_0x79f3('0xd2')]}});}break;}}})[_0x79f3('0x21')](handleEntityNotFound(_0x3a694d,null))[_0x79f3('0x21')](function(_0x4ea21a){if(_0x4ea21a){_0x1f261a=_0x4ea21a;switch(_0x46a13c[_0x79f3('0x44')]){case _0x79f3('0xcb'):if(_0x3e28de==='DELIVERED'){return _0x1f261a[_0x79f3('0x36')]({'read':!![]});}else{logger['error'](_0x79f3('0x26'),_0x79f3('0x2d'),'skebby',util[_0x79f3('0xca')](_0x151fac[_0x79f3('0x5e')],{'showHidden':![],'depth':null}));}break;case'connectel':if(_0x3e28de==='1'){return _0x1f261a[_0x79f3('0x36')]({'read':!![]});}else{logger[_0x79f3('0x28')](_0x79f3('0x26'),_0x79f3('0x2d'),_0x79f3('0xcb'),util[_0x79f3('0xca')](_0x151fac[_0x79f3('0x5e')],{'showHidden':![],'depth':null}));}break;case'clicksend':if(!_0x151fac[_0x79f3('0x5e')]['error_code']&&_0x3e28de>=0xc8&&_0x3e28de<=0xce){return _0x1f261a['update']({'read':!![]});}else{logger[_0x79f3('0x28')](_0x79f3('0x26'),_0x79f3('0x2d'),'clicksend',util[_0x79f3('0xca')](_0x151fac[_0x79f3('0x5e')],{'showHidden':![],'depth':null}));}break;case _0x79f3('0x8f'):var _0x12b2e7=_0x151fac['body']['results'][0x0];if(_0x12b2e7[_0x79f3('0x2d')]['groupName']===_0x79f3('0xd1')){return _0x1f261a[_0x79f3('0x36')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x79f3('0x2d'),'infobip',util[_0x79f3('0xca')](_0x151fac[_0x79f3('0x5e')],{'showHidden':![],'depth':null}));}break;case'clickatell':if(_0x3e28de==_0x79f3('0xd3')||_0x3e28de==_0x79f3('0xd4')){return _0x1f261a['update']({'read':!![]});}else{logger[_0x79f3('0x28')](_0x79f3('0x26'),_0x79f3('0x2d'),_0x79f3('0x95'),util[_0x79f3('0xca')](_0x151fac[_0x79f3('0x5e')],{'showHidden':![],'depth':null}));}break;case _0x79f3('0x96'):if(_0x3e28de==='DELIVRD'||_0x3e28de===_0x79f3('0xd5')){return _0x1f261a['update']({'read':!![]});}else{logger[_0x79f3('0x28')](_0x79f3('0x26'),'status',_0x79f3('0x96'),util[_0x79f3('0xca')](_0x151fac[_0x79f3('0x5e')],{'showHidden':![],'depth':null}));}break;}return _0x1f261a;}})['then'](respondWithResult(_0x3a694d,null))[_0x79f3('0x2c')](handleError(_0x3a694d,null));};exports[_0x79f3('0xd6')]=function(_0x14c48e,_0x15b40d,_0x43c046){var _0x1ee058,_0x4d1ef1,_0x1b5c2a;return db[_0x79f3('0x42')][_0x79f3('0x62')]({'where':{'id':_0x14c48e[_0x79f3('0x5b')]['id']}})[_0x79f3('0x21')](handleEntityNotFound(_0x15b40d,null))[_0x79f3('0x21')](function(_0xb23c3b){if(_0xb23c3b){_0x1b5c2a=_0xb23c3b;logger['debug'](_0x79f3('0x26'),_0x79f3('0x2d'),_0x79f3('0xd7'),_0xb23c3b[_0x79f3('0x44')],util[_0x79f3('0xca')](_0x14c48e[_0x79f3('0x47')],{'showHidden':![],'depth':null}));switch(_0xb23c3b[_0x79f3('0x44')]){case _0x79f3('0x92'):if(_0x14c48e[_0x79f3('0x47')]['message-id']&&_0x14c48e[_0x79f3('0x47')][_0x79f3('0xd8')]){_0x4d1ef1=_0x14c48e[_0x79f3('0x47')][_0x79f3('0xd8')];return db[_0x79f3('0xc5')][_0x79f3('0x62')]({'where':{'messageId':_0x14c48e['query'][_0x79f3('0xd9')]}});}break;}}})['then'](handleEntityNotFound(_0x15b40d,null))[_0x79f3('0x21')](function(_0x9607a1){if(_0x9607a1){_0x1ee058=_0x9607a1;switch(_0x1b5c2a['type']){case _0x79f3('0x92'):if(_0x4d1ef1==='2'||_0x4d1ef1==='6'){return _0x1ee058['update']({'read':!![]});}else{logger[_0x79f3('0x28')](_0x79f3('0x26'),'status','csc',util[_0x79f3('0xca')](_0x14c48e[_0x79f3('0x47')],{'showHidden':![],'depth':null}));};break;}return _0x1ee058;}})[_0x79f3('0x21')](respondWithResult(_0x15b40d,null))[_0x79f3('0x2c')](handleError(_0x15b40d,null));};exports['addAgents']=function(_0x4d5b5c,_0x419123,_0x49b8ae){return db[_0x79f3('0x42')]['find']({'where':{'id':_0x4d5b5c[_0x79f3('0x5b')]['id']}})[_0x79f3('0x21')](handleEntityNotFound(_0x419123,null))[_0x79f3('0x21')](function(_0x3d4e9c){if(_0x3d4e9c){return _0x3d4e9c[_0x79f3('0xda')](_0x4d5b5c[_0x79f3('0x5e')]['ids'],_[_0x79f3('0xdb')](_0x4d5b5c[_0x79f3('0x5e')],[_0x79f3('0x6d'),'id'])||{})[_0x79f3('0xa3')](function(_0x4a8258){for(var _0x44c404=0x0;_0x44c404<_0x4d5b5c[_0x79f3('0x5e')]['ids'][_0x79f3('0x4d')];_0x44c404+=0x1){socket[_0x79f3('0xdc')](_0x79f3('0xdd'),{'UserId':_0x4d5b5c[_0x79f3('0x5e')][_0x79f3('0x6d')][_0x44c404],'SmsAccountId':_0x4d5b5c['params']['id']});}return _0x4a8258;});}})[_0x79f3('0x21')](respondWithResult(_0x419123,null))[_0x79f3('0x2c')](handleError(_0x419123,null));};exports[_0x79f3('0xde')]=function(_0x4b9c76,_0x5a0f66,_0x1749cb){return db[_0x79f3('0x42')]['find']({'where':{'id':_0x4b9c76['params']['id']}})[_0x79f3('0x21')](handleEntityNotFound(_0x5a0f66,null))[_0x79f3('0x21')](function(_0x21edaa){if(_0x21edaa){return _0x21edaa[_0x79f3('0xde')](_0x4b9c76[_0x79f3('0x47')]['ids'])[_0x79f3('0x21')](function(){if(_[_0x79f3('0xdf')](_0x4b9c76[_0x79f3('0x47')][_0x79f3('0x6d')])){for(var _0x1633b4=0x0;_0x1633b4<_0x4b9c76[_0x79f3('0x47')][_0x79f3('0x6d')][_0x79f3('0x4d')];_0x1633b4+=0x1){socket['emit']('userSmsAccount:remove',{'UserId':Number(_0x4b9c76[_0x79f3('0x47')]['ids'][_0x1633b4]),'SmsAccountId':Number(_0x4b9c76[_0x79f3('0x5b')]['id'])});}}else{socket[_0x79f3('0xdc')]('userSmsAccount:remove',{'UserId':Number(_0x4b9c76[_0x79f3('0x47')]['ids']),'SmsAccountId':Number(_0x4b9c76[_0x79f3('0x5b')]['id'])});}});}})[_0x79f3('0x21')](respondWithStatusCode(_0x5a0f66,null))[_0x79f3('0x2c')](handleError(_0x5a0f66,null));};exports[_0x79f3('0xe0')]=function(_0x3c4fc6,_0xd7b1cf,_0x5d6025){var _0x21013c={};var _0x2db78b={};var _0x16efc0;var _0x702393;return db['SmsAccount'][_0x79f3('0x6b')]({'where':{'id':_0x3c4fc6['params']['id']}})[_0x79f3('0x21')](handleEntityNotFound(_0xd7b1cf,null))[_0x79f3('0x21')](function(_0xa091b7){if(_0xa091b7){_0x16efc0=_0xa091b7;_0x2db78b['model']=_[_0x79f3('0x48')](db[_0x79f3('0xab')][_0x79f3('0x5c')]);_0x2db78b['query']=_[_0x79f3('0x48')](_0x3c4fc6['query']);_0x2db78b[_0x79f3('0x49')]=_[_0x79f3('0x4a')](_0x2db78b['model'],_0x2db78b[_0x79f3('0x47')]);_0x21013c['attributes']=_['intersection'](_0x2db78b[_0x79f3('0x46')],qs[_0x79f3('0x4b')](_0x3c4fc6[_0x79f3('0x47')][_0x79f3('0x4b')]));_0x21013c[_0x79f3('0x4c')]=_0x21013c[_0x79f3('0x4c')][_0x79f3('0x4d')]?_0x21013c[_0x79f3('0x4c')]:_0x2db78b['model'];_0x21013c[_0x79f3('0x4f')]=qs[_0x79f3('0x50')](_0x3c4fc6['query'][_0x79f3('0x50')]);_0x21013c['where']=qs[_0x79f3('0x49')](_[_0x79f3('0x51')](_0x3c4fc6[_0x79f3('0x47')],_0x2db78b[_0x79f3('0x49')]));if(_0x3c4fc6[_0x79f3('0x47')][_0x79f3('0x52')]){_0x21013c[_0x79f3('0x53')]=_[_0x79f3('0x55')](_0x21013c['where'],{'$or':_[_0x79f3('0x41')](_0x21013c[_0x79f3('0x4c')],function(_0x105d20){var _0x150322={};_0x150322[_0x105d20]={'$like':'%'+_0x3c4fc6[_0x79f3('0x47')][_0x79f3('0x52')]+'%'};return _0x150322;})});}_0x21013c=_[_0x79f3('0x55')]({},_0x21013c,_0x3c4fc6[_0x79f3('0x56')]);return _0x16efc0[_0x79f3('0xe0')](_0x21013c);}})[_0x79f3('0x21')](function(_0x263b43){if(_0x263b43){_0x702393=_0x263b43[_0x79f3('0x4d')];if(!_0x3c4fc6[_0x79f3('0x47')][_0x79f3('0x6c')](_0x79f3('0x4e'))){_0x21013c['limit']=qs[_0x79f3('0x32')](_0x3c4fc6[_0x79f3('0x47')][_0x79f3('0x32')]);_0x21013c[_0x79f3('0x31')]=qs[_0x79f3('0x31')](_0x3c4fc6['query'][_0x79f3('0x31')]);}return _0x16efc0[_0x79f3('0xe0')](_0x21013c);}})['then'](function(_0x3ae2eb){if(_0x3ae2eb){return _0x3ae2eb?{'count':_0x702393,'rows':_0x3ae2eb}:null;}})[_0x79f3('0x21')](respondWithResult(_0xd7b1cf,null))['catch'](handleError(_0xd7b1cf,null));}; \ No newline at end of file +var _0x6a55=['squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','test','ValidationError','then','info','SmsAccount,\x20%s,\x20%s','debug','SmsAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','status','end','json','offset','limit','set','apply','reject','save','UserProfileResource','destroy','sendStatus','name','send','index','Pause','mandatoryDispositionPause','map','SmsAccount','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','order','where','VIRTUAL','options','count','includeAll','findAll','rows','show','params','include','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','get','SmsAccounts','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addDisposition','Disposition','getDispositions','findOne','nolimit','sort','SmsAccountId','filter','merge','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','pick','removeAnswers','sms','Applications','account','applications','orderBy','priority','Sequelize','no\x20available\x20attributes','updatedAt','difference','CompanyId','ListId','mobile','twilio','messageId','MessageSid','skebby','sender','text','connectel','clicksend','from','message_id','From','Text','MessageUUID','infobip','results','originatingAddress','refid','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','CmContact','Contacts','DESC','list','omit','contact','SmsInteraction','spread','interaction','created','autoclose','close','unmanaged','*,*,*,*','SmsMessage','ContactId','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','addApplications','sequelize','transaction','SmsApplication','bulkCreate','findAndCountAll','getApplications','getInteractions','Contact','User','Owner','fullname','Tag','Tags','tag','to\x20is\x20mandatory','List','out','Messages','dataValues','push','log','endpoint\x20/status\x20POST\x20/','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','requestid','statusInt','status_code','groupName','DELIVERED','clickatell','redif','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','intelepeer','DELIVRD','statusGet','csc','message-id','state','addAgents','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','html-pdf','fast-json-patch','bluebird','util','sox','to-csv','ejs','lodash'];(function(_0x404a27,_0x2984b4){var _0x26f9f4=function(_0xf2b41c){while(--_0xf2b41c){_0x404a27['push'](_0x404a27['shift']());}};_0x26f9f4(++_0x2984b4);}(_0x6a55,0xdb));var _0x56a5=function(_0x24c135,_0xdb4450){_0x24c135=_0x24c135-0x0;var _0x290c66=_0x6a55[_0x24c135];return _0x290c66;};'use strict';var pdf=require(_0x56a5('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x56a5('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x56a5('0x2'));var Mustache=require('mustache');var util=require(_0x56a5('0x3'));var path=require('path');var sox=require(_0x56a5('0x4'));var csv=require(_0x56a5('0x5'));var ejs=require(_0x56a5('0x6'));var fs=require('fs');var _=require(_0x56a5('0x7'));var squel=require(_0x56a5('0x8'));var crypto=require(_0x56a5('0x9'));var jsforce=require(_0x56a5('0xa'));var deskjs=require(_0x56a5('0xb'));var toCsv=require('to-csv');var querystring=require(_0x56a5('0xc'));var Papa=require(_0x56a5('0xd'));var Redis=require(_0x56a5('0xe'));var authService=require(_0x56a5('0xf'));var qs=require(_0x56a5('0x10'));var as=require(_0x56a5('0x11'));var hardwareService=require(_0x56a5('0x12'));var logger=require(_0x56a5('0x13'))(_0x56a5('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x56a5('0x15'))['db'];config[_0x56a5('0x16')]=_[_0x56a5('0x17')](config[_0x56a5('0x16')],{'host':_0x56a5('0x18'),'port':0x18eb});var socket=require(_0x56a5('0x19'))(new Redis(config['redis']));require('./smsAccount.socket')[_0x56a5('0x1a')](socket);var jayson=require(_0x56a5('0x1b'));var client=jayson[_0x56a5('0x1c')][_0x56a5('0x1d')]({'port':0x232c});function checkPasswordPattern(_0x310c32,_0x2db112,_0xe3091f){if(_0xe3091f){var _0x5c4028=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5c4028[_0x56a5('0x1e')](_0x2db112)){return _0x310c32;}else{throw new db['Sequelize'][(_0x56a5('0x1f'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x310c32;}}function respondWithRpcPromise(_0x14ab5b,_0x3f3e5b,_0x173c65,_0x28fe74){return new BPromise(function(_0x1ba472,_0x143f3d){var _0x1dddec=_0x28fe74||client;return _0x1dddec['request'](_0x14ab5b,_0x173c65)[_0x56a5('0x20')](function(_0x3db687){logger[_0x56a5('0x21')](_0x56a5('0x22'),_0x3f3e5b,'request\x20sent');logger[_0x56a5('0x23')](_0x56a5('0x24'),_0x3f3e5b,_0x56a5('0x25'),JSON[_0x56a5('0x26')](_0x3db687));if(_0x3db687[_0x56a5('0x27')]){if(_0x3db687['error']['code']===0x1f4){logger[_0x56a5('0x27')](_0x56a5('0x22'),_0x3f3e5b,_0x3db687['error'][_0x56a5('0x28')]);return _0x143f3d(_0x3db687[_0x56a5('0x27')][_0x56a5('0x28')]);}logger[_0x56a5('0x27')](_0x56a5('0x22'),_0x3f3e5b,_0x3db687[_0x56a5('0x27')][_0x56a5('0x28')]);return _0x1ba472(_0x3db687[_0x56a5('0x27')][_0x56a5('0x28')]);}else{logger[_0x56a5('0x21')](_0x56a5('0x22'),_0x3f3e5b,_0x56a5('0x25'));_0x1ba472(_0x3db687[_0x56a5('0x29')]['message']);}})[_0x56a5('0x2a')](function(_0x2d8e68){logger[_0x56a5('0x27')](_0x56a5('0x22'),_0x3f3e5b,_0x2d8e68);_0x143f3d(_0x2d8e68);});});}function respondWithStatusCode(_0x43a815,_0x527e84){_0x527e84=_0x527e84||0xcc;return function(_0x18e863){if(_0x18e863){return _0x43a815['sendStatus'](_0x527e84);}return _0x43a815[_0x56a5('0x2b')](_0x527e84)[_0x56a5('0x2c')]();};}function respondWithResult(_0x1b27b5,_0x284ee5){_0x284ee5=_0x284ee5||0xc8;return function(_0x4e7afd){if(_0x4e7afd){return _0x1b27b5[_0x56a5('0x2b')](_0x284ee5)[_0x56a5('0x2d')](_0x4e7afd);}};}function respondWithFilteredResult(_0x178f11,_0x51ef6f){return function(_0x22ceab){if(_0x22ceab){var _0x29dbe7=_0x22ceab['count'],_0xeb4378=_0x51ef6f[_0x56a5('0x2e')],_0x214649=_0x51ef6f[_0x56a5('0x2e')]+_0x51ef6f[_0x56a5('0x2f')],_0x55978e;if(_0x214649>=_0x29dbe7){_0x214649=_0x29dbe7;_0x55978e=0xc8;}else{_0x55978e=0xce;}_0x178f11[_0x56a5('0x2b')](_0x55978e);return _0x178f11[_0x56a5('0x30')]('Content-Range',_0xeb4378+'-'+_0x214649+'/'+_0x29dbe7)['json'](_0x22ceab);}return null;};}function patchUpdates(_0x200c4e){return function(_0xe17c5e){try{jsonpatch[_0x56a5('0x31')](_0xe17c5e,_0x200c4e,!![]);}catch(_0x58cb48){return BPromise[_0x56a5('0x32')](_0x58cb48);}return _0xe17c5e[_0x56a5('0x33')]();};}function saveUpdates(_0x5135fd,_0x5c1b6a){return function(_0x48b078){if(_0x48b078){return _0x48b078['update'](_0x5135fd)[_0x56a5('0x20')](function(_0x29c8f1){return _0x29c8f1;});}return null;};}function removeEntity(_0x129cb9,_0x5cb9c8){return function(_0x5e778a){if(_0x5e778a){return _0x5e778a['destroy']()[_0x56a5('0x20')](function(){var _0x2a1d66=_0x5e778a['get']({'plain':!![]});var _0x1dbd9a='SmsAccounts';return db[_0x56a5('0x34')][_0x56a5('0x35')]({'where':{'type':_0x1dbd9a,'resourceId':_0x2a1d66['id']}})[_0x56a5('0x20')](function(){return _0x5e778a;});})['then'](function(){_0x129cb9[_0x56a5('0x2b')](0xcc)[_0x56a5('0x2c')]();});}};}function handleEntityNotFound(_0x4240eb,_0x5de387){return function(_0x2ec273){if(!_0x2ec273){_0x4240eb[_0x56a5('0x36')](0x194);}return _0x2ec273;};}function handleError(_0xce6a1d,_0x2fa206){_0x2fa206=_0x2fa206||0x1f4;return function(_0x2633f6){logger['error'](_0x2633f6['stack']);if(_0x2633f6[_0x56a5('0x37')]){delete _0x2633f6[_0x56a5('0x37')];}_0xce6a1d[_0x56a5('0x2b')](_0x2fa206)[_0x56a5('0x38')](_0x2633f6);};}exports[_0x56a5('0x39')]=function(_0xaeda55,_0x16e747){var _0x652028={'include':[{'model':db[_0x56a5('0x3a')],'as':_0x56a5('0x3b')}]},_0x1fe853={},_0x2f175c={'count':0x0,'rows':[]};var _0x184186=_[_0x56a5('0x3c')](db[_0x56a5('0x3d')][_0x56a5('0x3e')],function(_0x46dfa3){return{'name':_0x46dfa3[_0x56a5('0x3f')],'type':_0x46dfa3[_0x56a5('0x40')][_0x56a5('0x41')]};});_0x1fe853[_0x56a5('0x42')]=_[_0x56a5('0x3c')](_0x184186,'name');_0x1fe853['query']=_[_0x56a5('0x43')](_0xaeda55['query']);_0x1fe853[_0x56a5('0x44')]=_[_0x56a5('0x45')](_0x1fe853[_0x56a5('0x42')],_0x1fe853[_0x56a5('0x46')]);_0x652028[_0x56a5('0x47')]=_[_0x56a5('0x45')](_0x1fe853['model'],qs['fields'](_0xaeda55[_0x56a5('0x46')][_0x56a5('0x48')]));_0x652028[_0x56a5('0x47')]=_0x652028[_0x56a5('0x47')][_0x56a5('0x49')]?_0x652028[_0x56a5('0x47')]:_0x1fe853['model'];if(!_0xaeda55[_0x56a5('0x46')][_0x56a5('0x4a')]('nolimit')){_0x652028[_0x56a5('0x2f')]=qs[_0x56a5('0x2f')](_0xaeda55[_0x56a5('0x46')][_0x56a5('0x2f')]);_0x652028['offset']=qs[_0x56a5('0x2e')](_0xaeda55['query'][_0x56a5('0x2e')]);}_0x652028[_0x56a5('0x4b')]=qs['sort'](_0xaeda55[_0x56a5('0x46')]['sort']);_0x652028[_0x56a5('0x4c')]=qs[_0x56a5('0x44')](_['pick'](_0xaeda55[_0x56a5('0x46')],_0x1fe853['filters']));if(_0xaeda55[_0x56a5('0x46')]['filter']){_0x652028[_0x56a5('0x4c')]=_['merge'](_0x652028[_0x56a5('0x4c')],{'$or':_[_0x56a5('0x3c')](_0x184186,function(_0x30b5a6){if(_0x30b5a6[_0x56a5('0x40')]!==_0x56a5('0x4d')){var _0x43196d={};_0x43196d[_0x30b5a6[_0x56a5('0x37')]]={'$like':'%'+_0xaeda55['query']['filter']+'%'};return _0x43196d;}})});}_0x652028=_['merge']({},_0x652028,_0xaeda55[_0x56a5('0x4e')]);var _0x1bec14={'where':_0x652028[_0x56a5('0x4c')]};return db['SmsAccount'][_0x56a5('0x4f')](_0x1bec14)[_0x56a5('0x20')](function(_0xa7de69){_0x2f175c['count']=_0xa7de69;if(_0xaeda55[_0x56a5('0x46')][_0x56a5('0x50')]){_0x652028['include']=[{'all':!![]}];}return db[_0x56a5('0x3d')][_0x56a5('0x51')](_0x652028);})[_0x56a5('0x20')](function(_0x12c1c9){_0x2f175c[_0x56a5('0x52')]=_0x12c1c9;return _0x2f175c;})['then'](respondWithFilteredResult(_0x16e747,_0x652028))[_0x56a5('0x2a')](handleError(_0x16e747,null));};exports[_0x56a5('0x53')]=function(_0x2f9577,_0x4444ed){var _0x3705dd={'raw':![],'where':{'id':_0x2f9577[_0x56a5('0x54')]['id']},'include':[{'model':db[_0x56a5('0x3a')],'as':'mandatoryDispositionPause'}]},_0x495c85={};_0x495c85[_0x56a5('0x42')]=_[_0x56a5('0x43')](db[_0x56a5('0x3d')]['rawAttributes']);_0x495c85[_0x56a5('0x46')]=_['keys'](_0x2f9577[_0x56a5('0x46')]);_0x495c85['filters']=_[_0x56a5('0x45')](_0x495c85[_0x56a5('0x42')],_0x495c85[_0x56a5('0x46')]);_0x3705dd[_0x56a5('0x47')]=_['intersection'](_0x495c85[_0x56a5('0x42')],qs['fields'](_0x2f9577[_0x56a5('0x46')][_0x56a5('0x48')]));_0x3705dd[_0x56a5('0x47')]=_0x3705dd[_0x56a5('0x47')][_0x56a5('0x49')]?_0x3705dd[_0x56a5('0x47')]:_0x495c85[_0x56a5('0x42')];if(_0x2f9577[_0x56a5('0x46')][_0x56a5('0x50')]){_0x3705dd[_0x56a5('0x55')]=[{'all':!![]}];}_0x3705dd=_['merge']({},_0x3705dd,_0x2f9577[_0x56a5('0x4e')]);return db[_0x56a5('0x3d')]['find'](_0x3705dd)[_0x56a5('0x20')](handleEntityNotFound(_0x4444ed,null))['then'](respondWithResult(_0x4444ed,null))[_0x56a5('0x2a')](handleError(_0x4444ed,null));};exports[_0x56a5('0x56')]=function(_0x100b17,_0x238657){return db[_0x56a5('0x3d')]['create'](_0x100b17[_0x56a5('0x57')],{})[_0x56a5('0x20')](function(_0x97b0ed){var _0x1a5689=_0x100b17['user']['get']({'plain':!![]});if(!_0x1a5689)throw new Error(_0x56a5('0x58'));if(_0x1a5689[_0x56a5('0x59')]===_0x56a5('0x5a')){var _0xe5f854=_0x97b0ed[_0x56a5('0x5b')]({'plain':!![]});var _0x222f87=_0x56a5('0x5c');return db['UserProfileSection'][_0x56a5('0x5d')]({'where':{'name':_0x222f87,'userProfileId':_0x1a5689[_0x56a5('0x5e')]},'raw':!![]})[_0x56a5('0x20')](function(_0x4fb2c5){if(_0x4fb2c5&&_0x4fb2c5['autoAssociation']===0x0){return db[_0x56a5('0x34')][_0x56a5('0x56')]({'name':_0xe5f854[_0x56a5('0x37')],'resourceId':_0xe5f854['id'],'type':_0x4fb2c5[_0x56a5('0x37')],'sectionId':_0x4fb2c5['id']},{})[_0x56a5('0x20')](function(){return _0x97b0ed;});}else{return _0x97b0ed;}})[_0x56a5('0x2a')](function(_0x3624b1){logger['error'](_0x56a5('0x5f'),_0x3624b1);throw _0x3624b1;});}return _0x97b0ed;})[_0x56a5('0x20')](respondWithResult(_0x238657,0xc9))[_0x56a5('0x2a')](handleError(_0x238657,null));};exports[_0x56a5('0x60')]=function(_0x29fbbc,_0x2d46a6){if(_0x29fbbc[_0x56a5('0x57')]['id']){delete _0x29fbbc[_0x56a5('0x57')]['id'];}return db[_0x56a5('0x3d')][_0x56a5('0x5d')]({'where':{'id':_0x29fbbc[_0x56a5('0x54')]['id']},'include':[{'model':db[_0x56a5('0x3a')],'as':_0x56a5('0x3b')}]})['then'](handleEntityNotFound(_0x2d46a6,null))['then'](saveUpdates(_0x29fbbc[_0x56a5('0x57')],null))[_0x56a5('0x20')](respondWithResult(_0x2d46a6,null))[_0x56a5('0x2a')](handleError(_0x2d46a6,null));};exports['destroy']=function(_0x3e243f,_0x189bf0){return db[_0x56a5('0x3d')][_0x56a5('0x5d')]({'where':{'id':_0x3e243f[_0x56a5('0x54')]['id']}})[_0x56a5('0x20')](handleEntityNotFound(_0x189bf0,null))[_0x56a5('0x20')](removeEntity(_0x189bf0,null))[_0x56a5('0x2a')](handleError(_0x189bf0,null));};exports['describe']=function(_0x96093a,_0x453702){return db[_0x56a5('0x3d')][_0x56a5('0x61')]()[_0x56a5('0x20')](respondWithResult(_0x453702,null))[_0x56a5('0x2a')](handleError(_0x453702,null));};exports[_0x56a5('0x62')]=function(_0x7cdca3,_0x3bdd70,_0x6f470b){if(_0x7cdca3[_0x56a5('0x57')]['id']){delete _0x7cdca3[_0x56a5('0x57')]['id'];}return db[_0x56a5('0x3d')][_0x56a5('0x5d')]({'where':{'id':_0x7cdca3[_0x56a5('0x54')]['id']}})['then'](handleEntityNotFound(_0x3bdd70,null))[_0x56a5('0x20')](function(_0x2530c8){if(_0x2530c8){_0x7cdca3[_0x56a5('0x57')]['SmsAccountId']=_0x2530c8['id'];return db[_0x56a5('0x63')]['create'](_0x7cdca3[_0x56a5('0x57')]);}})[_0x56a5('0x20')](respondWithResult(_0x3bdd70,null))[_0x56a5('0x2a')](handleError(_0x3bdd70,null));};exports[_0x56a5('0x64')]=function(_0x1a4195,_0x16120e,_0x5a5fcb){var _0x16fbd0={'raw':![],'where':{}};var _0x43efa1={};var _0x2f641b={'count':0x0,'rows':[]};return db[_0x56a5('0x3d')][_0x56a5('0x65')]({'where':{'id':_0x1a4195[_0x56a5('0x54')]['id']}})[_0x56a5('0x20')](handleEntityNotFound(_0x16120e,null))['then'](function(_0x1c36fc){if(_0x1c36fc){_0x43efa1['model']=_['keys'](db[_0x56a5('0x63')][_0x56a5('0x3e')]);_0x43efa1[_0x56a5('0x46')]=_[_0x56a5('0x43')](_0x1a4195['query']);_0x43efa1[_0x56a5('0x44')]=_[_0x56a5('0x45')](_0x43efa1[_0x56a5('0x42')],_0x43efa1['query']);_0x16fbd0[_0x56a5('0x47')]=_['intersection'](_0x43efa1[_0x56a5('0x42')],qs[_0x56a5('0x48')](_0x1a4195[_0x56a5('0x46')][_0x56a5('0x48')]));_0x16fbd0[_0x56a5('0x47')]=_0x16fbd0['attributes'][_0x56a5('0x49')]?_0x16fbd0[_0x56a5('0x47')]:_0x43efa1['model'];if(!_0x1a4195[_0x56a5('0x46')][_0x56a5('0x4a')](_0x56a5('0x66'))){_0x16fbd0['limit']=qs[_0x56a5('0x2f')](_0x1a4195[_0x56a5('0x46')][_0x56a5('0x2f')]);_0x16fbd0[_0x56a5('0x2e')]=qs[_0x56a5('0x2e')](_0x1a4195[_0x56a5('0x46')][_0x56a5('0x2e')]);}_0x16fbd0[_0x56a5('0x4b')]=qs[_0x56a5('0x67')](_0x1a4195[_0x56a5('0x46')][_0x56a5('0x67')]);_0x16fbd0[_0x56a5('0x4c')]=qs['filters'](_['pick'](_0x1a4195[_0x56a5('0x46')],_0x43efa1[_0x56a5('0x44')]));_0x16fbd0[_0x56a5('0x4c')][_0x56a5('0x68')]=_0x1c36fc['id'];if(_0x1a4195[_0x56a5('0x46')][_0x56a5('0x69')]){_0x16fbd0[_0x56a5('0x4c')]=_[_0x56a5('0x6a')](_0x16fbd0[_0x56a5('0x4c')],{'$or':_[_0x56a5('0x3c')](_0x16fbd0[_0x56a5('0x47')],function(_0x3b1cdc){var _0x2b9276={};_0x2b9276[_0x3b1cdc]={'$like':'%'+_0x1a4195[_0x56a5('0x46')][_0x56a5('0x69')]+'%'};return _0x2b9276;})});}_0x16fbd0=_['merge']({},_0x16fbd0,_0x1a4195[_0x56a5('0x4e')]);return db['Disposition'][_0x56a5('0x4f')]({'where':_0x16fbd0[_0x56a5('0x4c')]})[_0x56a5('0x20')](function(_0x474c42){_0x2f641b[_0x56a5('0x4f')]=_0x474c42;if(_0x1a4195['query'][_0x56a5('0x50')]){_0x16fbd0[_0x56a5('0x55')]=[{'all':!![]}];}return db[_0x56a5('0x63')]['findAll'](_0x16fbd0);})[_0x56a5('0x20')](function(_0x11f696){_0x2f641b[_0x56a5('0x52')]=_0x11f696;return _0x2f641b;});}})[_0x56a5('0x20')](respondWithFilteredResult(_0x16120e,_0x16fbd0))[_0x56a5('0x2a')](handleError(_0x16120e,null));};exports[_0x56a5('0x6b')]=function(_0x4f8986,_0x4dc201,_0x1aa3dd){return db[_0x56a5('0x3d')]['find']({'where':{'id':_0x4f8986['params']['id']}})['then'](handleEntityNotFound(_0x4dc201,null))[_0x56a5('0x20')](function(_0x4c2253){if(_0x4c2253){return _0x4c2253[_0x56a5('0x6b')](_0x4f8986[_0x56a5('0x46')][_0x56a5('0x6c')]);}})['then'](respondWithStatusCode(_0x4dc201,null))[_0x56a5('0x2a')](handleError(_0x4dc201,null));};exports[_0x56a5('0x6d')]=function(_0x420674,_0x5d590,_0x28f16d){if(_0x420674['body']['id']){delete _0x420674['body']['id'];}return db[_0x56a5('0x3d')][_0x56a5('0x5d')]({'where':{'id':_0x420674[_0x56a5('0x54')]['id']}})[_0x56a5('0x20')](handleEntityNotFound(_0x5d590,null))[_0x56a5('0x20')](function(_0x4db1cc){if(_0x4db1cc){_0x420674['body'][_0x56a5('0x68')]=_0x4db1cc['id'];return db['CannedAnswer'][_0x56a5('0x56')](_0x420674['body']);}})[_0x56a5('0x20')](respondWithResult(_0x5d590,null))[_0x56a5('0x2a')](handleError(_0x5d590,null));};exports[_0x56a5('0x6e')]=function(_0x5aebb1,_0x1ef44d,_0x2470ce){var _0x2bfa59={'raw':![],'where':{}};var _0x9bb895={};var _0x441668={'count':0x0,'rows':[]};return db[_0x56a5('0x3d')][_0x56a5('0x65')]({'where':{'id':_0x5aebb1[_0x56a5('0x54')]['id']}})['then'](handleEntityNotFound(_0x1ef44d,null))[_0x56a5('0x20')](function(_0x2ae5ae){if(_0x2ae5ae){_0x9bb895['model']=_[_0x56a5('0x43')](db[_0x56a5('0x6f')]['rawAttributes']);_0x9bb895[_0x56a5('0x46')]=_[_0x56a5('0x43')](_0x5aebb1[_0x56a5('0x46')]);_0x9bb895[_0x56a5('0x44')]=_['intersection'](_0x9bb895['model'],_0x9bb895[_0x56a5('0x46')]);_0x2bfa59[_0x56a5('0x47')]=_[_0x56a5('0x45')](_0x9bb895['model'],qs[_0x56a5('0x48')](_0x5aebb1[_0x56a5('0x46')][_0x56a5('0x48')]));_0x2bfa59['attributes']=_0x2bfa59[_0x56a5('0x47')][_0x56a5('0x49')]?_0x2bfa59['attributes']:_0x9bb895[_0x56a5('0x42')];if(!_0x5aebb1['query'][_0x56a5('0x4a')](_0x56a5('0x66'))){_0x2bfa59[_0x56a5('0x2f')]=qs[_0x56a5('0x2f')](_0x5aebb1[_0x56a5('0x46')][_0x56a5('0x2f')]);_0x2bfa59[_0x56a5('0x2e')]=qs[_0x56a5('0x2e')](_0x5aebb1['query'][_0x56a5('0x2e')]);}_0x2bfa59[_0x56a5('0x4b')]=qs[_0x56a5('0x67')](_0x5aebb1['query'][_0x56a5('0x67')]);_0x2bfa59[_0x56a5('0x4c')]=qs[_0x56a5('0x44')](_[_0x56a5('0x70')](_0x5aebb1[_0x56a5('0x46')],_0x9bb895[_0x56a5('0x44')]));_0x2bfa59['where'][_0x56a5('0x68')]=_0x2ae5ae['id'];if(_0x5aebb1['query']['filter']){_0x2bfa59[_0x56a5('0x4c')]=_[_0x56a5('0x6a')](_0x2bfa59[_0x56a5('0x4c')],{'$or':_[_0x56a5('0x3c')](_0x2bfa59['attributes'],function(_0x4a87a3){var _0x5bd07b={};_0x5bd07b[_0x4a87a3]={'$like':'%'+_0x5aebb1[_0x56a5('0x46')][_0x56a5('0x69')]+'%'};return _0x5bd07b;})});}_0x2bfa59=_[_0x56a5('0x6a')]({},_0x2bfa59,_0x5aebb1[_0x56a5('0x4e')]);return db[_0x56a5('0x6f')]['count']({'where':_0x2bfa59[_0x56a5('0x4c')]})[_0x56a5('0x20')](function(_0x37cacc){_0x441668[_0x56a5('0x4f')]=_0x37cacc;if(_0x5aebb1[_0x56a5('0x46')][_0x56a5('0x50')]){_0x2bfa59[_0x56a5('0x55')]=[{'all':!![]}];}return db[_0x56a5('0x6f')]['findAll'](_0x2bfa59);})['then'](function(_0x5118fd){_0x441668[_0x56a5('0x52')]=_0x5118fd;return _0x441668;});}})[_0x56a5('0x20')](respondWithFilteredResult(_0x1ef44d,_0x2bfa59))[_0x56a5('0x2a')](handleError(_0x1ef44d,null));};exports['removeAnswers']=function(_0x17b87e,_0x401cda,_0x3f7a7a){return db[_0x56a5('0x3d')][_0x56a5('0x5d')]({'where':{'id':_0x17b87e[_0x56a5('0x54')]['id']}})['then'](handleEntityNotFound(_0x401cda,null))[_0x56a5('0x20')](function(_0x150636){if(_0x150636){return _0x150636[_0x56a5('0x71')](_0x17b87e[_0x56a5('0x46')][_0x56a5('0x6c')]);}})[_0x56a5('0x20')](respondWithStatusCode(_0x401cda,null))[_0x56a5('0x2a')](handleError(_0x401cda,null));};exports['notify']=function(_0x5bd49c,_0x5c44a8,_0x4bc3c2){var _0x47e038={'channel':_0x56a5('0x72')};var _0x137128=[];var _0x877ecd=[];var _0x16153e={};return db['SmsAccount'][_0x56a5('0x5d')]({'where':{'id':_0x5bd49c[_0x56a5('0x54')]['id']},'include':[{'model':db['SmsApplication'],'as':_0x56a5('0x73')}]})[_0x56a5('0x20')](handleEntityNotFound(_0x5c44a8,null))[_0x56a5('0x20')](function(_0x38d257){_0x47e038[_0x56a5('0x74')]=_0x38d257;_0x47e038[_0x56a5('0x75')]=_[_0x56a5('0x76')](_0x38d257[_0x56a5('0x73')],[_0x56a5('0x77')],['asc']);if(_0x47e038['account'][_0x56a5('0x73')]){delete _0x47e038['account'][_0x56a5('0x73')];}return db['CmContact'][_0x56a5('0x61')]();})[_0x56a5('0x20')](function(_0x21b426){if(!_0x21b426){throw new db[(_0x56a5('0x78'))][(_0x56a5('0x1f'))](_0x56a5('0x79'));}_0x137128=_['difference'](_[_0x56a5('0x43')](_0x21b426),['createdAt',_0x56a5('0x7a')]);_0x877ecd=_[_0x56a5('0x7b')](_['keys'](_0x21b426),['createdAt',_0x56a5('0x7a'),_0x56a5('0x7c'),_0x56a5('0x7d')]);_0x47e038[_0x56a5('0x57')]={'mapKey':_0x56a5('0x7e')};if(_0x47e038[_0x56a5('0x74')]['type']){switch(_0x47e038[_0x56a5('0x74')][_0x56a5('0x40')]){case _0x56a5('0x7f'):_0x47e038[_0x56a5('0x57')]['from']=_0x5bd49c[_0x56a5('0x57')]['From'];_0x47e038['body'][_0x56a5('0x57')]=_0x5bd49c[_0x56a5('0x57')]['Body'];_0x47e038[_0x56a5('0x57')][_0x56a5('0x80')]=_0x5bd49c[_0x56a5('0x57')][_0x56a5('0x81')];break;case _0x56a5('0x82'):_0x47e038['body']['from']='+'+_0x5bd49c[_0x56a5('0x57')][_0x56a5('0x83')];_0x47e038[_0x56a5('0x57')]['body']=_0x5bd49c[_0x56a5('0x57')][_0x56a5('0x84')];break;case _0x56a5('0x85'):_0x47e038['body']['from']=_0x5bd49c[_0x56a5('0x57')]['from'];_0x47e038[_0x56a5('0x57')][_0x56a5('0x57')]=_0x5bd49c[_0x56a5('0x57')][_0x56a5('0x28')];break;case _0x56a5('0x86'):_0x47e038[_0x56a5('0x57')]['from']=_0x5bd49c[_0x56a5('0x57')][_0x56a5('0x87')];_0x47e038[_0x56a5('0x57')][_0x56a5('0x57')]=_0x5bd49c[_0x56a5('0x57')][_0x56a5('0x57')];_0x47e038[_0x56a5('0x57')][_0x56a5('0x80')]=_0x5bd49c[_0x56a5('0x57')][_0x56a5('0x88')];break;case'plivo':_0x47e038[_0x56a5('0x57')]['from']=_0x5bd49c['body'][_0x56a5('0x89')];_0x47e038[_0x56a5('0x57')]['body']=_0x5bd49c[_0x56a5('0x57')][_0x56a5('0x8a')];_0x47e038[_0x56a5('0x57')][_0x56a5('0x80')]=_0x5bd49c[_0x56a5('0x57')][_0x56a5('0x8b')];break;case _0x56a5('0x8c'):_0x47e038['body'][_0x56a5('0x87')]='+'+_0x5bd49c[_0x56a5('0x57')][_0x56a5('0x8d')][0x0][_0x56a5('0x87')];_0x47e038[_0x56a5('0x57')][_0x56a5('0x57')]=_0x5bd49c[_0x56a5('0x57')][_0x56a5('0x8d')][0x0][_0x56a5('0x84')];_0x47e038[_0x56a5('0x57')]['messageId']=_0x5bd49c[_0x56a5('0x57')][_0x56a5('0x8d')][0x0]['messageId'];break;case'csc':_0x47e038[_0x56a5('0x57')][_0x56a5('0x87')]=_0x5bd49c[_0x56a5('0x57')][_0x56a5('0x8e')];_0x47e038[_0x56a5('0x57')][_0x56a5('0x57')]=_0x5bd49c[_0x56a5('0x57')]['segmentedMessage'][_0x56a5('0x28')];break;case'clickatell':_0x47e038['body'][_0x56a5('0x87')]=_0x5bd49c[_0x56a5('0x57')]['fromNumber'];_0x47e038[_0x56a5('0x57')]['body']=_0x5bd49c[_0x56a5('0x57')]['text'];_0x47e038[_0x56a5('0x57')][_0x56a5('0x80')]=_0x5bd49c[_0x56a5('0x57')]['replyMessageId'];break;case'intelepeer':_0x47e038[_0x56a5('0x57')][_0x56a5('0x87')]=_0x5bd49c[_0x56a5('0x57')]['from'];_0x47e038[_0x56a5('0x57')]['body']=_0x5bd49c['body']['message'];_0x47e038['body'][_0x56a5('0x80')]=_0x5bd49c[_0x56a5('0x57')][_0x56a5('0x8f')];break;}}if(_0x47e038[_0x56a5('0x57')]['id']){delete _0x47e038[_0x56a5('0x57')]['id'];}if(_['isNil'](_0x47e038[_0x56a5('0x57')]['from'])){throw new db[(_0x56a5('0x78'))][(_0x56a5('0x1f'))](_0x56a5('0x90'));}if(_[_0x56a5('0x91')](_0x47e038[_0x56a5('0x57')][_0x56a5('0x57')])||_0x47e038[_0x56a5('0x57')][_0x56a5('0x57')]===''){throw new db[(_0x56a5('0x78'))][(_0x56a5('0x1f'))](_0x56a5('0x92'));}if(_[_0x56a5('0x91')](_0x47e038[_0x56a5('0x57')][_0x56a5('0x93')])){throw new db['Sequelize'][(_0x56a5('0x1f'))](_0x56a5('0x94')+_0x877ecd);}if(!_[_0x56a5('0x95')](_0x877ecd,_0x47e038['body']['mapKey'])){throw new db['Sequelize'][(_0x56a5('0x1f'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x877ecd);}_0x16153e[_0x47e038[_0x56a5('0x57')]['mapKey']]=_0x47e038[_0x56a5('0x57')][_0x56a5('0x87')];return db['CmList'][_0x56a5('0x5d')]({'where':{'id':_0x47e038[_0x56a5('0x74')][_0x56a5('0x7d')]},'include':[{'model':db[_0x56a5('0x96')],'as':_0x56a5('0x97'),'where':_0x16153e,'limit':0x1,'order':[[_0x56a5('0x7a'),_0x56a5('0x98')]]}]});})[_0x56a5('0x20')](handleEntityNotFound(_0x5c44a8,null))[_0x56a5('0x20')](function(_0x3f7332){if(_0x3f7332){_0x47e038[_0x56a5('0x99')]=_[_0x56a5('0x9a')](_0x3f7332,[_0x56a5('0x97')]);if(_0x3f7332['Contacts'][_0x56a5('0x49')]){return _0x3f7332['Contacts'][0x0];}var _0x105c75=_['defaults'](_0x47e038[_0x56a5('0x57')],{'firstName':_0x47e038[_0x56a5('0x57')][_0x56a5('0x87')],'ListId':_0x3f7332['id']});_0x105c75[_0x47e038[_0x56a5('0x57')][_0x56a5('0x93')]]=_0x47e038['body'][_0x56a5('0x87')];return db[_0x56a5('0x96')][_0x56a5('0x56')](_0x105c75,{'fields':_0x137128,'raw':!![]});}})[_0x56a5('0x20')](handleEntityNotFound(_0x5c44a8,null))[_0x56a5('0x20')](function(_0x15c12a){if(_0x15c12a){_0x47e038[_0x56a5('0x9b')]=_0x15c12a;var _0x56df52={'ContactId':_0x15c12a['id'],'phone':_0x47e038[_0x56a5('0x57')][_0x56a5('0x87')],'SmsAccountId':_0x5bd49c[_0x56a5('0x54')]['id']};var _0x4dd09f={'ContactId':_0x15c12a['id'],'SmsAccountId':_0x5bd49c[_0x56a5('0x54')]['id'],'closed':![]};return db[_0x56a5('0x9c')][_0x56a5('0x5d')]({'where':_0x4dd09f})[_0x56a5('0x20')](function(_0x2d73a9){if(_0x2d73a9){return[_0x2d73a9,![]];}return db[_0x56a5('0x9c')]['create'](_0x56df52)[_0x56a5('0x20')](function(_0x325c97){return[_0x325c97,!![]];});});}})[_0x56a5('0x9d')](function(_0xb78c2b,_0x5eafd4){_0x47e038['interaction']=_0xb78c2b[_0x56a5('0x5b')]({'plain':!![]});_0x47e038[_0x56a5('0x9e')][_0x56a5('0x9f')]=![];if(_0x5eafd4){if(_0x47e038[_0x56a5('0x74')][_0x56a5('0xa0')]){_0x47e038[_0x56a5('0x75')]['push']({'id':0x0,'priority':_0x47e038[_0x56a5('0x75')][_0x56a5('0x49')]+0x1,'app':_0x56a5('0xa1'),'appdata':_0x56a5('0xa2'),'interval':_0x56a5('0xa3')});}_0x47e038[_0x56a5('0x9e')][_0x56a5('0x9f')]=!![];}return db[_0x56a5('0xa4')][_0x56a5('0x56')]({'phone':_0x47e038[_0x56a5('0x57')][_0x56a5('0x87')],'messageId':_0x47e038[_0x56a5('0x57')][_0x56a5('0x80')],'body':_0x47e038[_0x56a5('0x57')][_0x56a5('0x57')],'SmsAccountId':_0x5bd49c[_0x56a5('0x54')]['id'],'SmsInteractionId':_0xb78c2b['id'],'direction':'in','ContactId':_0xb78c2b[_0x56a5('0xa5')],'AttachmentId':_0x47e038[_0x56a5('0x57')][_0x56a5('0xa6')]});})[_0x56a5('0x20')](function(_0x6c1e0c){_0x47e038[_0x56a5('0x28')]=_0x6c1e0c;if(_0x47e038[_0x56a5('0x9e')][_0x56a5('0xa7')]){return db['User'][_0x56a5('0x5d')]({'attributes':['id',_0x56a5('0x37')],'where':{'id':_0x47e038[_0x56a5('0x9e')][_0x56a5('0xa7')]}})[_0x56a5('0x20')](function(_0x16b1d5){if(_0x16b1d5){_0x47e038[_0x56a5('0x75')][_0x56a5('0xa8')]({'id':0x0,'priority':0x0,'app':_0x56a5('0xa9'),'appdata':_0x16b1d5[_0x56a5('0x37')]+','+(_0x47e038['account'][_0x56a5('0xaa')]||0xa),'interval':_0x56a5('0xa3')});}return respondWithRpcPromise(_0x56a5('0xab'),'startRouting',_0x47e038);});}return respondWithRpcPromise(_0x56a5('0xab'),_0x56a5('0xac'),_0x47e038);})[_0x56a5('0x20')](function(_0x537bfc){if(_0x537bfc){var _0x3062c2=0xc8;var _0xe175de=_0x56a5('0xad');logger[_0x56a5('0x21')](_0x56a5('0x24'),_0xe175de,_0x3062c2,_0x56a5('0xae'));logger[_0x56a5('0x23')](_0x56a5('0xaf'),_0xe175de,_0x3062c2,_0x56a5('0xae'),JSON[_0x56a5('0x26')](_0x537bfc));if(_0x47e038[_0x56a5('0x74')][_0x56a5('0x40')]===_0x56a5('0x7f')){return _0x5c44a8[_0x56a5('0x2b')](_0x3062c2)[_0x56a5('0x30')](_0x56a5('0xb0'),_0x56a5('0xb1'))['send']('\x0a');}else{return _0x5c44a8[_0x56a5('0x2b')](_0x3062c2)[_0x56a5('0x2d')](_0x537bfc);}}})['catch'](handleError(_0x5c44a8,null));};exports[_0x56a5('0xb2')]=function(_0x5d49eb,_0x2dd8bb,_0x4b6731){return db['SmsAccount'][_0x56a5('0x65')]({'where':{'id':_0x5d49eb[_0x56a5('0x54')]['id']}})[_0x56a5('0x20')](handleEntityNotFound(_0x2dd8bb,null))['then'](function(_0x149e09){if(_0x149e09){return db[_0x56a5('0xb3')][_0x56a5('0xb4')](function(_0x5b7759){return db[_0x56a5('0xb5')][_0x56a5('0x35')]({'where':{'SmsAccountId':_0x5d49eb[_0x56a5('0x54')]['id']},'transaction':_0x5b7759})[_0x56a5('0x20')](function(_0x58bda4){var _0x470c74=_[_0x56a5('0x3c')](_0x5d49eb[_0x56a5('0x57')],function(_0x58fdd0){_0x58fdd0['SmsAccountId']=_0x5d49eb[_0x56a5('0x54')]['id'];return _0x58fdd0;});return db[_0x56a5('0xb5')][_0x56a5('0xb6')](_0x470c74,{'transaction':_0x5b7759});});})['then'](function(){return db[_0x56a5('0xb5')][_0x56a5('0xb7')]({'where':{'SmsAccountId':_0x5d49eb[_0x56a5('0x54')]['id']},'order':_0x56a5('0x77')});});}})[_0x56a5('0x20')](respondWithResult(_0x2dd8bb,null))[_0x56a5('0x2a')](handleError(_0x2dd8bb,null));};exports[_0x56a5('0xb8')]=function(_0x12ca83,_0x5bd2a3,_0x40eedc){var _0x4bc112={};var _0x4c61bc={};var _0x35b335;var _0x210c64;return db[_0x56a5('0x3d')][_0x56a5('0x65')]({'where':{'id':_0x12ca83[_0x56a5('0x54')]['id']}})['then'](handleEntityNotFound(_0x5bd2a3,null))[_0x56a5('0x20')](function(_0x3d4d42){if(_0x3d4d42){_0x35b335=_0x3d4d42;_0x4c61bc['model']=_['keys'](db['SmsApplication']['rawAttributes']);_0x4c61bc[_0x56a5('0x46')]=_[_0x56a5('0x43')](_0x12ca83[_0x56a5('0x46')]);_0x4c61bc[_0x56a5('0x44')]=_['intersection'](_0x4c61bc[_0x56a5('0x42')],_0x4c61bc[_0x56a5('0x46')]);_0x4bc112[_0x56a5('0x47')]=_[_0x56a5('0x45')](_0x4c61bc[_0x56a5('0x42')],qs[_0x56a5('0x48')](_0x12ca83['query'][_0x56a5('0x48')]));_0x4bc112[_0x56a5('0x47')]=_0x4bc112[_0x56a5('0x47')]['length']?_0x4bc112[_0x56a5('0x47')]:_0x4c61bc[_0x56a5('0x42')];_0x4bc112[_0x56a5('0x4b')]=qs[_0x56a5('0x67')](_0x12ca83[_0x56a5('0x46')][_0x56a5('0x67')]);_0x4bc112['where']=qs[_0x56a5('0x44')](_[_0x56a5('0x70')](_0x12ca83[_0x56a5('0x46')],_0x4c61bc[_0x56a5('0x44')]));if(_0x12ca83[_0x56a5('0x46')][_0x56a5('0x69')]){_0x4bc112['where']=_[_0x56a5('0x6a')](_0x4bc112[_0x56a5('0x4c')],{'$or':_[_0x56a5('0x3c')](_0x4bc112[_0x56a5('0x47')],function(_0x3d4c2d){var _0x1a0b1a={};_0x1a0b1a[_0x3d4c2d]={'$like':'%'+_0x12ca83[_0x56a5('0x46')][_0x56a5('0x69')]+'%'};return _0x1a0b1a;})});}_0x4bc112=_['merge']({},_0x4bc112,_0x12ca83[_0x56a5('0x4e')]);return _0x35b335[_0x56a5('0xb8')](_0x4bc112);}})['then'](function(_0x40f125){if(_0x40f125){_0x210c64=_0x40f125[_0x56a5('0x49')];if(!_0x12ca83[_0x56a5('0x46')][_0x56a5('0x4a')](_0x56a5('0x66'))){_0x4bc112[_0x56a5('0x2f')]=qs['limit'](_0x12ca83['query']['limit']);_0x4bc112['offset']=qs[_0x56a5('0x2e')](_0x12ca83[_0x56a5('0x46')][_0x56a5('0x2e')]);}return _0x35b335['getApplications'](_0x4bc112);}})[_0x56a5('0x20')](function(_0x106699){if(_0x106699){return _0x106699?{'count':_0x210c64,'rows':_0x106699}:null;}})[_0x56a5('0x20')](respondWithResult(_0x5bd2a3,null))['catch'](handleError(_0x5bd2a3,null));};exports[_0x56a5('0xb9')]=function(_0xc2a484,_0x29c397,_0x50a02c){var _0x4a235={'raw':![],'where':{}};var _0x4565a7={};var _0x3da9f6={'count':0x0,'rows':[]};return db['SmsAccount'][_0x56a5('0x65')]({'where':{'id':_0xc2a484[_0x56a5('0x54')]['id']}})['then'](handleEntityNotFound(_0x29c397,null))[_0x56a5('0x20')](function(_0x1fef17){if(_0x1fef17){_0x4565a7[_0x56a5('0x42')]=_[_0x56a5('0x43')](db[_0x56a5('0x9c')][_0x56a5('0x3e')]);_0x4565a7[_0x56a5('0x46')]=_[_0x56a5('0x43')](_0xc2a484[_0x56a5('0x46')]);_0x4565a7['filters']=_['intersection'](_0x4565a7[_0x56a5('0x42')],_0x4565a7[_0x56a5('0x46')]);_0x4a235['attributes']=_[_0x56a5('0x45')](_0x4565a7['model'],qs[_0x56a5('0x48')](_0xc2a484[_0x56a5('0x46')]['fields']));_0x4a235[_0x56a5('0x47')]=_0x4a235['attributes']['length']?_0x4a235[_0x56a5('0x47')]:_0x4565a7['model'];if(!_0xc2a484[_0x56a5('0x46')][_0x56a5('0x4a')](_0x56a5('0x66'))){_0x4a235[_0x56a5('0x2f')]=qs['limit'](_0xc2a484[_0x56a5('0x46')][_0x56a5('0x2f')]);_0x4a235['offset']=qs[_0x56a5('0x2e')](_0xc2a484[_0x56a5('0x46')][_0x56a5('0x2e')]);}_0x4a235[_0x56a5('0x4b')]=qs[_0x56a5('0x67')](_0xc2a484[_0x56a5('0x46')][_0x56a5('0x67')]);_0x4a235[_0x56a5('0x4c')]=qs[_0x56a5('0x44')](_['pick'](_0xc2a484['query'],_0x4565a7['filters']));_0x4a235[_0x56a5('0x4c')][_0x56a5('0x68')]=_0x1fef17['id'];if(_0xc2a484['query']['filter']){_0x4a235['where']=_['merge'](_0x4a235['where'],{'$or':_[_0x56a5('0x3c')](_0x4a235[_0x56a5('0x47')],function(_0x1fc219){var _0x11f82c={};_0x11f82c[_0x1fc219]={'$like':'%'+_0xc2a484[_0x56a5('0x46')][_0x56a5('0x69')]+'%'};return _0x11f82c;})});}_0x4a235=_[_0x56a5('0x6a')]({},_0x4a235,_0xc2a484[_0x56a5('0x4e')]);return db[_0x56a5('0x9c')][_0x56a5('0x4f')]({'where':_0x4a235[_0x56a5('0x4c')]})['then'](function(_0x505e9c){_0x3da9f6['count']=_0x505e9c;if(_0xc2a484[_0x56a5('0x46')][_0x56a5('0x50')]){_0x4a235[_0x56a5('0x55')]=[{'model':db['CmContact'],'as':_0x56a5('0xba'),'required':![]},{'model':db[_0x56a5('0xbb')],'as':_0x56a5('0xbc'),'attributes':['name',_0x56a5('0xbd'),'internal'],'required':![]},{'model':db[_0x56a5('0xbe')],'as':_0x56a5('0xbf'),'attributes':['id',_0x56a5('0x37'),'color'],'where':_0xc2a484[_0x56a5('0x46')][_0x56a5('0xc0')]?{'id':_0xc2a484[_0x56a5('0x46')][_0x56a5('0xc0')]}:undefined,'required':_0xc2a484[_0x56a5('0x46')][_0x56a5('0xc0')]?!![]:![]}];}return db[_0x56a5('0x9c')][_0x56a5('0x51')](_0x4a235);})['then'](function(_0x39360c){_0x3da9f6['rows']=_0x39360c;return _0x3da9f6;});}})[_0x56a5('0x20')](respondWithFilteredResult(_0x29c397,_0x4a235))['catch'](handleError(_0x29c397,null));};exports['send']=function(_0x1360aa,_0x2cf45a,_0x4eaf07){var _0x4f2d72,_0x497520,_0x9c8419;if(_[_0x56a5('0x91')](_0x1360aa[_0x56a5('0x57')][_0x56a5('0x57')])||_0x1360aa[_0x56a5('0x57')]['body']===''){throw new db[(_0x56a5('0x78'))][(_0x56a5('0x1f'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x56a5('0x91')](_0x1360aa[_0x56a5('0x57')]['to'])){throw new db[(_0x56a5('0x78'))][(_0x56a5('0x1f'))](_0x56a5('0xc1'));}_0x4f2d72=_0x1360aa[_0x56a5('0x57')]['to'];return db[_0x56a5('0x3d')][_0x56a5('0x5d')]({'where':{'id':_0x1360aa['params']['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x56a5('0x96')],'as':'Contacts','where':{'mobile':_0x4f2d72},'limit':0x1,'order':[['updatedAt',_0x56a5('0x98')]]}]}]})['then'](handleEntityNotFound(_0x2cf45a,null))[_0x56a5('0x20')](function(_0x239f2d){if(_0x239f2d&&_0x239f2d['List']){_0x497520=_0x239f2d['get']({'plain':!![]});if(_0x497520[_0x56a5('0xc2')]&&_0x497520[_0x56a5('0xc2')]['Contacts'][_0x56a5('0x49')]){return _0x497520[_0x56a5('0xc2')][_0x56a5('0x97')][0x0];}return db['CmContact'][_0x56a5('0x56')](_[_0x56a5('0x17')](_0x1360aa['body'],{'firstName':_0x4f2d72,'mobile':_0x4f2d72,'phone':_0x4f2d72,'ListId':_0x497520[_0x56a5('0x7d')]}));}})['then'](handleEntityNotFound(_0x2cf45a,null))[_0x56a5('0x20')](function(_0x298faf){if(_0x298faf){_0x9c8419=_0x298faf;return db[_0x56a5('0x9c')][_0x56a5('0x5d')]({'where':{'ContactId':_0x9c8419['id'],'closed':![],'SmsAccountId':_0x497520['id']}})[_0x56a5('0x20')](function(_0x4f61f8){if(_0x4f61f8){return[_0x4f61f8,![]];}return db['SmsInteraction'][_0x56a5('0x56')]({'UserId':_0x1360aa[_0x56a5('0x5a')]['id'],'ContactId':_0x9c8419['id'],'SmsAccountId':_0x497520['id'],'phone':_0x4f2d72,'firstMsgDirection':_0x56a5('0xc3'),'Messages':[_[_0x56a5('0x6a')](_0x1360aa[_0x56a5('0x57')],{'read':![],'body':_0x1360aa[_0x56a5('0x57')][_0x56a5('0x57')],'phone':_0x4f2d72,'SmsAccountId':_0x497520['id'],'UserId':_0x1360aa['user']['id'],'ContactId':_0x9c8419['id']})]},{'include':[{'model':db[_0x56a5('0xa4')],'as':_0x56a5('0xc4')}]})['then'](function(_0xd569e){return[_0xd569e,!![]];});});}})[_0x56a5('0x9d')](function(_0x3a30db,_0x3fe050){if(_0x3fe050){return _0x3a30db;}return db[_0x56a5('0xa4')][_0x56a5('0x56')](_['merge'](_0x1360aa[_0x56a5('0x57')],{'read':![],'body':_0x1360aa['body'][_0x56a5('0x57')],'phone':_0x4f2d72,'SmsAccountId':_0x497520['id'],'SmsInteractionId':_0x3a30db['id'],'UserId':_0x1360aa[_0x56a5('0x5a')]['id'],'ContactId':_0x9c8419['id']}))['then'](function(_0x1ca271){_0x3a30db['dataValues'][_0x56a5('0xc4')]=[];_0x3a30db[_0x56a5('0xc5')][_0x56a5('0xc4')][_0x56a5('0xc6')](_0x1ca271[_0x56a5('0xc5')]);return _0x3a30db;});})['then'](respondWithResult(_0x2cf45a,null))[_0x56a5('0x2a')](handleError(_0x2cf45a,null));};exports['status']=function(_0x542508,_0x2e5583,_0x3684e1){if(_0x542508[_0x56a5('0x57')]['id']){delete _0x542508['body']['id'];}console[_0x56a5('0xc7')](_0x56a5('0xc8'),_0x542508[_0x56a5('0x57')]);var _0x41952e,_0x196f09,_0x9f1a3;return db[_0x56a5('0x3d')][_0x56a5('0x5d')]({'where':{'id':_0x542508[_0x56a5('0x54')]['id']}})[_0x56a5('0x20')](handleEntityNotFound(_0x2e5583,null))[_0x56a5('0x20')](function(_0x41a746){if(_0x41a746){_0x9f1a3=_0x41a746;logger[_0x56a5('0x23')](_0x56a5('0x24'),_0x56a5('0x2b'),_0x56a5('0xc9'),_0x41a746[_0x56a5('0x40')],util[_0x56a5('0xca')](_0x542508[_0x56a5('0x57')],{'showHidden':![],'depth':null}));switch(_0x41a746[_0x56a5('0x40')]){case _0x56a5('0x82'):if(_0x542508[_0x56a5('0x57')][_0x56a5('0xcb')]&&_0x542508[_0x56a5('0x57')][_0x56a5('0x2b')]){_0x196f09=_0x542508['body']['status'];return db[_0x56a5('0xa4')][_0x56a5('0x5d')]({'where':{'messageId':_0x542508['body']['skebby_dispatch_id']}});}break;case _0x56a5('0x85'):if(_0x542508[_0x56a5('0x57')][_0x56a5('0xcc')]&&_0x542508[_0x56a5('0x57')][_0x56a5('0xcd')]){_0x196f09=_0x542508[_0x56a5('0x57')][_0x56a5('0xcd')];return db[_0x56a5('0xa4')]['find']({'where':{'messageId':_0x542508[_0x56a5('0x57')][_0x56a5('0xcc')]}});}break;case'clicksend':if(_0x542508['body']['message_id']&&_0x542508[_0x56a5('0x57')][_0x56a5('0xce')]){_0x196f09=_0x542508[_0x56a5('0x57')][_0x56a5('0xce')];return db[_0x56a5('0xa4')][_0x56a5('0x5d')]({'where':{'messageId':_0x542508[_0x56a5('0x57')]['message_id']}});}break;case _0x56a5('0x8c'):var _0x511d78=_0x542508['body'][_0x56a5('0x8d')][0x0];if(_0x511d78[_0x56a5('0x80')]&&_0x511d78[_0x56a5('0x2b')][_0x56a5('0xcf')]===_0x56a5('0xd0')){_0x196f09=_0x511d78[_0x56a5('0x2b')]['groupName'];return db[_0x56a5('0xa4')][_0x56a5('0x5d')]({'where':{'messageId':_0x511d78[_0x56a5('0x80')]}});}break;case _0x56a5('0xd1'):if(_0x542508['body']['messageId']&&_0x542508[_0x56a5('0x57')][_0x56a5('0x2b')]){_0x196f09=_0x542508[_0x56a5('0x57')][_0x56a5('0x2b')];return db[_0x56a5('0xa4')][_0x56a5('0x5d')]({'where':{'messageId':_0x542508[_0x56a5('0x57')][_0x56a5('0x80')]}});}break;case'intelepeer':if(_0x542508['body'][_0x56a5('0xd2')]&&_0x542508['body'][_0x56a5('0x2b')]){_0x196f09=_0x542508['body'][_0x56a5('0x2b')];return db[_0x56a5('0xa4')][_0x56a5('0x5d')]({'where':{'messageId':_0x542508[_0x56a5('0x57')][_0x56a5('0xd2')]}});}break;}}})['then'](handleEntityNotFound(_0x2e5583,null))[_0x56a5('0x20')](function(_0x52a91e){if(_0x52a91e){_0x41952e=_0x52a91e;switch(_0x9f1a3[_0x56a5('0x40')]){case _0x56a5('0x82'):if(_0x196f09==='DELIVERED'){return _0x41952e['update']({'read':!![]});}else{logger[_0x56a5('0x27')](_0x56a5('0x24'),_0x56a5('0x2b'),_0x56a5('0x82'),util['inspect'](_0x542508[_0x56a5('0x57')],{'showHidden':![],'depth':null}));}break;case _0x56a5('0x85'):if(_0x196f09==='1'){return _0x41952e[_0x56a5('0x60')]({'read':!![]});}else{logger['error'](_0x56a5('0x24'),_0x56a5('0x2b'),_0x56a5('0x82'),util[_0x56a5('0xca')](_0x542508[_0x56a5('0x57')],{'showHidden':![],'depth':null}));}break;case'clicksend':if(!_0x542508['body'][_0x56a5('0xd3')]&&_0x196f09>=0xc8&&_0x196f09<=0xce){return _0x41952e['update']({'read':!![]});}else{logger['error'](_0x56a5('0x24'),_0x56a5('0x2b'),'clicksend',util['inspect'](_0x542508[_0x56a5('0x57')],{'showHidden':![],'depth':null}));}break;case _0x56a5('0x8c'):var _0x4f8749=_0x542508[_0x56a5('0x57')][_0x56a5('0x8d')][0x0];if(_0x4f8749[_0x56a5('0x2b')][_0x56a5('0xcf')]===_0x56a5('0xd0')){return _0x41952e[_0x56a5('0x60')]({'read':!![]});}else{logger[_0x56a5('0x27')](_0x56a5('0x24'),_0x56a5('0x2b'),_0x56a5('0x8c'),util['inspect'](_0x542508['body'],{'showHidden':![],'depth':null}));}break;case _0x56a5('0xd1'):if(_0x196f09==_0x56a5('0xd4')||_0x196f09==_0x56a5('0xd5')){return _0x41952e[_0x56a5('0x60')]({'read':!![]});}else{logger[_0x56a5('0x27')](_0x56a5('0x24'),_0x56a5('0x2b'),_0x56a5('0xd1'),util['inspect'](_0x542508[_0x56a5('0x57')],{'showHidden':![],'depth':null}));}break;case _0x56a5('0xd6'):if(_0x196f09===_0x56a5('0xd7')||_0x196f09==='ACCEPTD'){return _0x41952e[_0x56a5('0x60')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x56a5('0xd6'),util[_0x56a5('0xca')](_0x542508[_0x56a5('0x57')],{'showHidden':![],'depth':null}));}break;}return _0x41952e;}})[_0x56a5('0x20')](respondWithResult(_0x2e5583,null))[_0x56a5('0x2a')](handleError(_0x2e5583,null));};exports[_0x56a5('0xd8')]=function(_0x394553,_0x23732c,_0x1db316){var _0x11dfb3,_0x56686e,_0x4e5afc;return db['SmsAccount']['find']({'where':{'id':_0x394553['params']['id']}})[_0x56a5('0x20')](handleEntityNotFound(_0x23732c,null))[_0x56a5('0x20')](function(_0x47931f){if(_0x47931f){_0x4e5afc=_0x47931f;logger[_0x56a5('0x23')](_0x56a5('0x24'),_0x56a5('0x2b'),_0x56a5('0xc9'),_0x47931f['type'],util[_0x56a5('0xca')](_0x394553[_0x56a5('0x46')],{'showHidden':![],'depth':null}));switch(_0x47931f[_0x56a5('0x40')]){case _0x56a5('0xd9'):if(_0x394553[_0x56a5('0x46')][_0x56a5('0xda')]&&_0x394553[_0x56a5('0x46')][_0x56a5('0xdb')]){_0x56686e=_0x394553['query']['state'];return db['SmsMessage'][_0x56a5('0x5d')]({'where':{'messageId':_0x394553[_0x56a5('0x46')][_0x56a5('0xda')]}});}break;}}})[_0x56a5('0x20')](handleEntityNotFound(_0x23732c,null))['then'](function(_0x226f8b){if(_0x226f8b){_0x11dfb3=_0x226f8b;switch(_0x4e5afc[_0x56a5('0x40')]){case _0x56a5('0xd9'):if(_0x56686e==='2'||_0x56686e==='6'){return _0x11dfb3[_0x56a5('0x60')]({'read':!![]});}else{logger[_0x56a5('0x27')](_0x56a5('0x24'),'status',_0x56a5('0xd9'),util[_0x56a5('0xca')](_0x394553[_0x56a5('0x46')],{'showHidden':![],'depth':null}));};break;}return _0x11dfb3;}})[_0x56a5('0x20')](respondWithResult(_0x23732c,null))[_0x56a5('0x2a')](handleError(_0x23732c,null));};exports[_0x56a5('0xdc')]=function(_0x1da1d4,_0x20e12d,_0x4016de){return db[_0x56a5('0x3d')]['find']({'where':{'id':_0x1da1d4[_0x56a5('0x54')]['id']}})[_0x56a5('0x20')](handleEntityNotFound(_0x20e12d,null))['then'](function(_0x134c30){if(_0x134c30){return _0x134c30[_0x56a5('0xdc')](_0x1da1d4['body'][_0x56a5('0x6c')],_[_0x56a5('0x9a')](_0x1da1d4['body'],[_0x56a5('0x6c'),'id'])||{})[_0x56a5('0x9d')](function(_0x453237){for(var _0x902dac=0x0;_0x902dac<_0x1da1d4[_0x56a5('0x57')]['ids'][_0x56a5('0x49')];_0x902dac+=0x1){socket[_0x56a5('0xdd')](_0x56a5('0xde'),{'UserId':_0x1da1d4[_0x56a5('0x57')]['ids'][_0x902dac],'SmsAccountId':_0x1da1d4['params']['id']});}return _0x453237;});}})['then'](respondWithResult(_0x20e12d,null))[_0x56a5('0x2a')](handleError(_0x20e12d,null));};exports[_0x56a5('0xdf')]=function(_0x18d06e,_0x37df4a,_0x480924){return db['SmsAccount']['find']({'where':{'id':_0x18d06e['params']['id']}})[_0x56a5('0x20')](handleEntityNotFound(_0x37df4a,null))[_0x56a5('0x20')](function(_0x3c133d){if(_0x3c133d){return _0x3c133d[_0x56a5('0xdf')](_0x18d06e[_0x56a5('0x46')][_0x56a5('0x6c')])[_0x56a5('0x20')](function(){if(_[_0x56a5('0xe0')](_0x18d06e[_0x56a5('0x46')][_0x56a5('0x6c')])){for(var _0x2a6774=0x0;_0x2a6774<_0x18d06e[_0x56a5('0x46')][_0x56a5('0x6c')][_0x56a5('0x49')];_0x2a6774+=0x1){socket[_0x56a5('0xdd')](_0x56a5('0xe1'),{'UserId':Number(_0x18d06e['query'][_0x56a5('0x6c')][_0x2a6774]),'SmsAccountId':Number(_0x18d06e[_0x56a5('0x54')]['id'])});}}else{socket[_0x56a5('0xdd')](_0x56a5('0xe1'),{'UserId':Number(_0x18d06e['query'][_0x56a5('0x6c')]),'SmsAccountId':Number(_0x18d06e[_0x56a5('0x54')]['id'])});}});}})[_0x56a5('0x20')](respondWithStatusCode(_0x37df4a,null))[_0x56a5('0x2a')](handleError(_0x37df4a,null));};exports['getAgents']=function(_0x4ef9d5,_0x5e8bc4,_0x290290){var _0x541d78={};var _0x4b504c={};var _0x4eadc4;var _0x2e3c9f;return db[_0x56a5('0x3d')][_0x56a5('0x65')]({'where':{'id':_0x4ef9d5['params']['id']}})[_0x56a5('0x20')](handleEntityNotFound(_0x5e8bc4,null))[_0x56a5('0x20')](function(_0x292370){if(_0x292370){_0x4eadc4=_0x292370;_0x4b504c['model']=_[_0x56a5('0x43')](db[_0x56a5('0xbb')]['rawAttributes']);_0x4b504c[_0x56a5('0x46')]=_[_0x56a5('0x43')](_0x4ef9d5[_0x56a5('0x46')]);_0x4b504c[_0x56a5('0x44')]=_[_0x56a5('0x45')](_0x4b504c[_0x56a5('0x42')],_0x4b504c[_0x56a5('0x46')]);_0x541d78['attributes']=_[_0x56a5('0x45')](_0x4b504c[_0x56a5('0x42')],qs[_0x56a5('0x48')](_0x4ef9d5[_0x56a5('0x46')][_0x56a5('0x48')]));_0x541d78[_0x56a5('0x47')]=_0x541d78['attributes'][_0x56a5('0x49')]?_0x541d78[_0x56a5('0x47')]:_0x4b504c[_0x56a5('0x42')];_0x541d78[_0x56a5('0x4b')]=qs['sort'](_0x4ef9d5['query'][_0x56a5('0x67')]);_0x541d78[_0x56a5('0x4c')]=qs[_0x56a5('0x44')](_[_0x56a5('0x70')](_0x4ef9d5['query'],_0x4b504c['filters']));if(_0x4ef9d5['query'][_0x56a5('0x69')]){_0x541d78['where']=_[_0x56a5('0x6a')](_0x541d78[_0x56a5('0x4c')],{'$or':_[_0x56a5('0x3c')](_0x541d78[_0x56a5('0x47')],function(_0x4d2d4c){var _0x3d4d09={};_0x3d4d09[_0x4d2d4c]={'$like':'%'+_0x4ef9d5['query']['filter']+'%'};return _0x3d4d09;})});}_0x541d78=_[_0x56a5('0x6a')]({},_0x541d78,_0x4ef9d5[_0x56a5('0x4e')]);return _0x4eadc4[_0x56a5('0xe2')](_0x541d78);}})[_0x56a5('0x20')](function(_0x35a616){if(_0x35a616){_0x2e3c9f=_0x35a616['length'];if(!_0x4ef9d5[_0x56a5('0x46')]['hasOwnProperty']('nolimit')){_0x541d78[_0x56a5('0x2f')]=qs['limit'](_0x4ef9d5[_0x56a5('0x46')][_0x56a5('0x2f')]);_0x541d78[_0x56a5('0x2e')]=qs[_0x56a5('0x2e')](_0x4ef9d5['query'][_0x56a5('0x2e')]);}return _0x4eadc4[_0x56a5('0xe2')](_0x541d78);}})[_0x56a5('0x20')](function(_0x2cb769){if(_0x2cb769){return _0x2cb769?{'count':_0x2e3c9f,'rows':_0x2cb769}:null;}})[_0x56a5('0x20')](respondWithResult(_0x5e8bc4,null))['catch'](handleError(_0x5e8bc4,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 47c25dc..d3ef02c 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 _0x76ed=['setMaxListeners','save','update','events','../../mysqldb'];(function(_0x32f679,_0x5b3550){var _0x4333fc=function(_0x209ca4){while(--_0x209ca4){_0x32f679['push'](_0x32f679['shift']());}};_0x4333fc(++_0x5b3550);}(_0x76ed,0x166));var _0xd76e=function(_0x41cc94,_0x41e752){_0x41cc94=_0x41cc94-0x0;var _0x15d020=_0x76ed[_0x41cc94];return _0x15d020;};'use strict';var EventEmitter=require(_0xd76e('0x0'));var SmsAccount=require(_0xd76e('0x1'))['db']['SmsAccount'];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0xd76e('0x2')](0x0);var events={'afterCreate':_0xd76e('0x3'),'afterUpdate':_0xd76e('0x4'),'afterDestroy':'remove'};function emitEvent(_0x46e640){return function(_0x275843,_0x44f316,_0xc7f1da){SmsAccountEvents['emit'](_0x46e640+':'+_0x275843['id'],_0x275843);SmsAccountEvents['emit'](_0x46e640,_0x275843);_0xc7f1da(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsAccount['hook'](e,emitEvent(event));}}module['exports']=SmsAccountEvents; \ No newline at end of file +var _0xc298=['../../mysqldb','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x179db6,_0x15b430){var _0x2a1e3a=function(_0x5e32de){while(--_0x5e32de){_0x179db6['push'](_0x179db6['shift']());}};_0x2a1e3a(++_0x15b430);}(_0xc298,0x68));var _0x8c29=function(_0x40b281,_0x298b72){_0x40b281=_0x40b281-0x0;var _0x3837ae=_0xc298[_0x40b281];return _0x3837ae;};'use strict';var EventEmitter=require('events');var SmsAccount=require(_0x8c29('0x0'))['db']['SmsAccount'];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x8c29('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x8c29('0x2'),'afterDestroy':_0x8c29('0x3')};function emitEvent(_0x38d4cf){return function(_0x1dc8f8,_0x522044,_0x352a2e){SmsAccountEvents[_0x8c29('0x4')](_0x38d4cf+':'+_0x1dc8f8['id'],_0x1dc8f8);SmsAccountEvents['emit'](_0x38d4cf,_0x1dc8f8);_0x352a2e(null);};}for(var e in events){if(events[_0x8c29('0x5')](e)){var event=events[e];SmsAccount[_0x8c29('0x6')](e,emitEvent(event));}}module[_0x8c29('0x7')]=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index 3e1107f..1ccbb1e 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 _0x6e52=['define','SmsAccount','sms_accounts','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsAccount.attributes','exports'];(function(_0xf44d98,_0x12a472){var _0x5ebb04=function(_0x930c33){while(--_0x930c33){_0xf44d98['push'](_0xf44d98['shift']());}};_0x5ebb04(++_0x12a472);}(_0x6e52,0x189));var _0x26e5=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x6e52[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x26e5('0x0'));var util=require('util');var logger=require(_0x26e5('0x1'))('api');var moment=require(_0x26e5('0x2'));var BPromise=require(_0x26e5('0x3'));var rp=require(_0x26e5('0x4'));var fs=require('fs');var path=require(_0x26e5('0x5'));var rimraf=require(_0x26e5('0x6'));var config=require(_0x26e5('0x7'));var attributes=require(_0x26e5('0x8'));module[_0x26e5('0x9')]=function(_0x2f1c73,_0x30e8a9){return _0x2f1c73[_0x26e5('0xa')](_0x26e5('0xb'),attributes,{'tableName':_0x26e5('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa7ae=['SmsAccount','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','define'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0xa7ae,0xd2));var _0xea7a=function(_0x563bbe,_0x351c48){_0x563bbe=_0x563bbe-0x0;var _0x58788d=_0xa7ae[_0x563bbe];return _0x58788d;};'use strict';var _=require(_0xea7a('0x0'));var util=require(_0xea7a('0x1'));var logger=require(_0xea7a('0x2'))(_0xea7a('0x3'));var moment=require(_0xea7a('0x4'));var BPromise=require(_0xea7a('0x5'));var rp=require(_0xea7a('0x6'));var fs=require('fs');var path=require(_0xea7a('0x7'));var rimraf=require('rimraf');var config=require(_0xea7a('0x8'));var attributes=require('./smsAccount.attributes');module['exports']=function(_0x18e29c,_0x5e75db){return _0x18e29c[_0xea7a('0x9')](_0xea7a('0xa'),attributes,{'tableName':'sms_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.rpc.js b/server/api/smsAccount/smsAccount.rpc.js index 4e3009c..e7d8153 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 _0x7141=['catch','lodash','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','request','then','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','ShowSmsAccount','SmsAccount','find','options','raw','where','attributes','include','map','model'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7141,0x13c));var _0x1714=function(_0x2243ac,_0x44c2bb){_0x2243ac=_0x2243ac-0x0;var _0x3e4fd8=_0x7141[_0x2243ac];return _0x3e4fd8;};'use strict';var _=require(_0x1714('0x0'));var util=require('util');var moment=require(_0x1714('0x1'));var BPromise=require(_0x1714('0x2'));var rs=require(_0x1714('0x3'));var fs=require('fs');var Redis=require(_0x1714('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x1714('0x5'))(_0x1714('0x6'));var config=require(_0x1714('0x7'));var jayson=require(_0x1714('0x8'));var client=jayson[_0x1714('0x9')][_0x1714('0xa')]({'port':0x232a});config[_0x1714('0xb')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x1714('0xc'))(new Redis(config['redis']));require('./smsAccount.socket')['register'](socket);function respondWithRpcPromise(_0x5ccd11,_0x4e0921,_0x3b3d40){return new BPromise(function(_0x57ce0e,_0x5acbf0){return client[_0x1714('0xd')](_0x5ccd11,_0x3b3d40)[_0x1714('0xe')](function(_0x2e62f5){logger['info'](_0x1714('0xf'),_0x4e0921,_0x1714('0x10'));logger[_0x1714('0x11')](_0x1714('0x12'),_0x4e0921,'request\x20sent',JSON[_0x1714('0x13')](_0x2e62f5));if(_0x2e62f5[_0x1714('0x14')]){if(_0x2e62f5[_0x1714('0x14')][_0x1714('0x15')]===0x1f4){logger[_0x1714('0x14')]('SmsAccount,\x20%s,\x20%s',_0x4e0921,_0x2e62f5[_0x1714('0x14')][_0x1714('0x16')]);return _0x5acbf0(_0x2e62f5['error']['message']);}logger[_0x1714('0x14')](_0x1714('0xf'),_0x4e0921,_0x2e62f5[_0x1714('0x14')][_0x1714('0x16')]);return _0x57ce0e(_0x2e62f5[_0x1714('0x14')][_0x1714('0x16')]);}else{logger['info'](_0x1714('0xf'),_0x4e0921,_0x1714('0x10'));_0x57ce0e(_0x2e62f5[_0x1714('0x17')][_0x1714('0x16')]);}})['catch'](function(_0x2fe370){logger[_0x1714('0x14')](_0x1714('0xf'),_0x4e0921,_0x2fe370);_0x5acbf0(_0x2fe370);});});}exports[_0x1714('0x18')]=function(_0x10084e){var _0x18b466=this;return new Promise(function(_0x65480e,_0x255f06){return db[_0x1714('0x19')][_0x1714('0x1a')]({'raw':_0x10084e['options']?_0x10084e[_0x1714('0x1b')][_0x1714('0x1c')]===undefined?!![]:![]:!![],'where':_0x10084e['options']?_0x10084e['options'][_0x1714('0x1d')]||null:null,'attributes':_0x10084e['options']?_0x10084e[_0x1714('0x1b')][_0x1714('0x1e')]||null:null,'include':_0x10084e[_0x1714('0x1b')]?_0x10084e[_0x1714('0x1b')][_0x1714('0x1f')]?_[_0x1714('0x20')](_0x10084e[_0x1714('0x1b')][_0x1714('0x1f')],function(_0x2c2202){return{'model':db[_0x2c2202[_0x1714('0x21')]],'as':_0x2c2202['as'],'attributes':_0x2c2202['attributes'],'include':_0x2c2202['include']?_[_0x1714('0x20')](_0x2c2202['include'],function(_0x364b5c){return{'model':db[_0x364b5c[_0x1714('0x21')]],'as':_0x364b5c['as'],'attributes':_0x364b5c[_0x1714('0x1e')],'include':_0x364b5c[_0x1714('0x1f')]?_['map'](_0x364b5c[_0x1714('0x1f')],function(_0x12f7d2){return{'model':db[_0x12f7d2[_0x1714('0x21')]],'as':_0x12f7d2['as'],'attributes':_0x12f7d2['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x49bfe6){logger['info'](_0x1714('0x18'),_0x10084e);logger[_0x1714('0x11')](_0x1714('0x18'),_0x10084e,JSON['stringify'](_0x49bfe6));_0x65480e(_0x49bfe6);})[_0x1714('0x22')](function(_0x2ae8a4){logger[_0x1714('0x14')]('ShowSmsAccount',_0x2ae8a4[_0x1714('0x16')],_0x10084e);_0x255f06(_0x18b466['error'](0x1f4,_0x2ae8a4[_0x1714('0x16')]));});});}; \ No newline at end of file +var _0xc09d=['../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','register','request','then','info','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','error','SmsAccount,\x20%s,\x20%s','message','result','ShowSmsAccount','find','options','attributes','map','include','model','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x32f2b5,_0x3e7573){var _0x4acddb=function(_0x2358bb){while(--_0x2358bb){_0x32f2b5['push'](_0x32f2b5['shift']());}};_0x4acddb(++_0x3e7573);}(_0xc09d,0xda));var _0xdc09=function(_0x3ec390,_0x157f65){_0x3ec390=_0x3ec390-0x0;var _0x1cdbff=_0xc09d[_0x3ec390];return _0x1cdbff;};'use strict';var _=require('lodash');var util=require(_0xdc09('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdc09('0x1'));var db=require(_0xdc09('0x2'))['db'];var utils=require(_0xdc09('0x3'));var logger=require(_0xdc09('0x4'))(_0xdc09('0x5'));var config=require(_0xdc09('0x6'));var jayson=require(_0xdc09('0x7'));var client=jayson['client'][_0xdc09('0x8')]({'port':0x232a});config[_0xdc09('0x9')]=_[_0xdc09('0xa')](config[_0xdc09('0x9')],{'host':_0xdc09('0xb'),'port':0x18eb});var socket=require(_0xdc09('0xc'))(new Redis(config[_0xdc09('0x9')]));require(_0xdc09('0xd'))[_0xdc09('0xe')](socket);function respondWithRpcPromise(_0x15ed81,_0x18d385,_0x586125){return new BPromise(function(_0x20fc61,_0x195afd){return client[_0xdc09('0xf')](_0x15ed81,_0x586125)[_0xdc09('0x10')](function(_0x373206){logger[_0xdc09('0x11')]('SmsAccount,\x20%s,\x20%s',_0x18d385,_0xdc09('0x12'));logger[_0xdc09('0x13')](_0xdc09('0x14'),_0x18d385,_0xdc09('0x12'),JSON['stringify'](_0x373206));if(_0x373206[_0xdc09('0x15')]){if(_0x373206[_0xdc09('0x15')]['code']===0x1f4){logger[_0xdc09('0x15')](_0xdc09('0x16'),_0x18d385,_0x373206[_0xdc09('0x15')]['message']);return _0x195afd(_0x373206[_0xdc09('0x15')][_0xdc09('0x17')]);}logger[_0xdc09('0x15')](_0xdc09('0x16'),_0x18d385,_0x373206[_0xdc09('0x15')][_0xdc09('0x17')]);return _0x20fc61(_0x373206['error']['message']);}else{logger[_0xdc09('0x11')](_0xdc09('0x16'),_0x18d385,_0xdc09('0x12'));_0x20fc61(_0x373206[_0xdc09('0x18')][_0xdc09('0x17')]);}})['catch'](function(_0x2c844d){logger[_0xdc09('0x15')]('SmsAccount,\x20%s,\x20%s',_0x18d385,_0x2c844d);_0x195afd(_0x2c844d);});});}exports[_0xdc09('0x19')]=function(_0x25c885){var _0x60aa3c=this;return new Promise(function(_0x43c4a3,_0x5117fc){return db['SmsAccount'][_0xdc09('0x1a')]({'raw':_0x25c885[_0xdc09('0x1b')]?_0x25c885['options']['raw']===undefined?!![]:![]:!![],'where':_0x25c885[_0xdc09('0x1b')]?_0x25c885['options']['where']||null:null,'attributes':_0x25c885[_0xdc09('0x1b')]?_0x25c885[_0xdc09('0x1b')][_0xdc09('0x1c')]||null:null,'include':_0x25c885[_0xdc09('0x1b')]?_0x25c885[_0xdc09('0x1b')]['include']?_[_0xdc09('0x1d')](_0x25c885[_0xdc09('0x1b')][_0xdc09('0x1e')],function(_0x55e9fd){return{'model':db[_0x55e9fd[_0xdc09('0x1f')]],'as':_0x55e9fd['as'],'attributes':_0x55e9fd[_0xdc09('0x1c')],'include':_0x55e9fd[_0xdc09('0x1e')]?_[_0xdc09('0x1d')](_0x55e9fd[_0xdc09('0x1e')],function(_0xf5289){return{'model':db[_0xf5289[_0xdc09('0x1f')]],'as':_0xf5289['as'],'attributes':_0xf5289[_0xdc09('0x1c')],'include':_0xf5289['include']?_[_0xdc09('0x1d')](_0xf5289['include'],function(_0x5cc878){return{'model':db[_0x5cc878[_0xdc09('0x1f')]],'as':_0x5cc878['as'],'attributes':_0x5cc878['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x111eed){logger[_0xdc09('0x11')](_0xdc09('0x19'),_0x25c885);logger[_0xdc09('0x13')](_0xdc09('0x19'),_0x25c885,JSON['stringify'](_0x111eed));_0x43c4a3(_0x111eed);})['catch'](function(_0x3e2278){logger[_0xdc09('0x15')]('ShowSmsAccount',_0x3e2278[_0xdc09('0x17')],_0x25c885);_0x5117fc(_0x60aa3c[_0xdc09('0x15')](0x1f4,_0x3e2278[_0xdc09('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 407fb38..2660d6a 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 _0x7bb1=['update','emit','removeListener','smsAccount:','./smsAccount.events','save','remove'];(function(_0x3607d9,_0x495135){var _0x1cf173=function(_0x29be75){while(--_0x29be75){_0x3607d9['push'](_0x3607d9['shift']());}};_0x1cf173(++_0x495135);}(_0x7bb1,0x1bd));var _0x17bb=function(_0x500419,_0x549162){_0x500419=_0x500419-0x0;var _0x241c1a=_0x7bb1[_0x500419];return _0x241c1a;};'use strict';var SmsAccountEvents=require(_0x17bb('0x0'));var events=[_0x17bb('0x1'),_0x17bb('0x2'),_0x17bb('0x3')];function createListener(_0x281b93,_0x327529){return function(_0x440800){_0x327529[_0x17bb('0x4')](_0x281b93,_0x440800);};}function removeListener(_0x536571,_0xb5974a){return function(){SmsAccountEvents[_0x17bb('0x5')](_0x536571,_0xb5974a);};}exports['register']=function(_0x3dba3b){for(var _0x3a70f6=0x0,_0x39410d=events['length'];_0x3a70f6<_0x39410d;_0x3a70f6++){var _0x5e9748=events[_0x3a70f6];var _0x563376=createListener(_0x17bb('0x6')+_0x5e9748,_0x3dba3b);SmsAccountEvents['on'](_0x5e9748,_0x563376);}}; \ No newline at end of file +var _0x30ca=['register','length','smsAccount:','save','removeListener'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x30ca,0xda));var _0xa30c=function(_0xea897b,_0x269096){_0xea897b=_0xea897b-0x0;var _0x8a736e=_0x30ca[_0xea897b];return _0x8a736e;};'use strict';var SmsAccountEvents=require('./smsAccount.events');var events=[_0xa30c('0x0'),'remove','update'];function createListener(_0x53d710,_0x501ed0){return function(_0x2452a5){_0x501ed0['emit'](_0x53d710,_0x2452a5);};}function removeListener(_0x8edfc9,_0x157af7){return function(){SmsAccountEvents[_0xa30c('0x1')](_0x8edfc9,_0x157af7);};}exports[_0xa30c('0x2')]=function(_0x203d8a){for(var _0x5d56dd=0x0,_0x5ca79a=events[_0xa30c('0x3')];_0x5d56dd<_0x5ca79a;_0x5d56dd++){var _0x3d1632=events[_0x5d56dd];var _0x4ad41f=createListener(_0xa30c('0x4')+_0x3d1632,_0x203d8a);SmsAccountEvents['on'](_0x3d1632,_0x4ad41f);}}; \ No newline at end of file diff --git a/server/api/smsApplication/index.js b/server/api/smsApplication/index.js index c77c91f..c28c91b 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 _0x44b8=['show','put','update','/:id','destroy','exports','multer','Router','../../components/interaction/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','index'];(function(_0x49d8b3,_0xeac856){var _0x2c124e=function(_0x2b7545){while(--_0x2b7545){_0x49d8b3['push'](_0x49d8b3['shift']());}};_0x2c124e(++_0xeac856);}(_0x44b8,0x11e));var _0x844b=function(_0x3f31ce,_0x468d32){_0x3f31ce=_0x3f31ce-0x0;var _0x13d692=_0x44b8[_0x3f31ce];return _0x13d692;};'use strict';var multer=require(_0x844b('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x844b('0x1')]();var auth=require('../../components/auth/service');var interaction=require(_0x844b('0x2'));var config=require(_0x844b('0x3'));var controller=require(_0x844b('0x4'));router[_0x844b('0x5')]('/',auth[_0x844b('0x6')](),controller[_0x844b('0x7')]);router[_0x844b('0x5')]('/:id',auth[_0x844b('0x6')](),controller[_0x844b('0x8')]);router['post']('/',auth[_0x844b('0x6')](),controller['create']);router[_0x844b('0x9')]('/:id',auth[_0x844b('0x6')](),controller[_0x844b('0xa')]);router['delete'](_0x844b('0xb'),auth[_0x844b('0x6')](),controller[_0x844b('0xc')]);module[_0x844b('0xd')]=router; \ No newline at end of file +var _0x5960=['get','/:id','show','create','put','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./smsApplication.controller','isAuthenticated','index'];(function(_0x4a2689,_0x314a16){var _0x463450=function(_0x5388b8){while(--_0x5388b8){_0x4a2689['push'](_0x4a2689['shift']());}};_0x463450(++_0x314a16);}(_0x5960,0x104));var _0x0596=function(_0x5ee44c,_0x1cf21a){_0x5ee44c=_0x5ee44c-0x0;var _0x12d690=_0x5960[_0x5ee44c];return _0x12d690;};'use strict';var multer=require(_0x0596('0x0'));var util=require('util');var path=require(_0x0596('0x1'));var timeout=require(_0x0596('0x2'));var express=require(_0x0596('0x3'));var router=express[_0x0596('0x4')]();var auth=require(_0x0596('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0596('0x6'));var controller=require(_0x0596('0x7'));router['get']('/',auth[_0x0596('0x8')](),controller[_0x0596('0x9')]);router[_0x0596('0xa')](_0x0596('0xb'),auth[_0x0596('0x8')](),controller[_0x0596('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x0596('0xd')]);router[_0x0596('0xe')]('/:id',auth[_0x0596('0x8')](),controller['update']);router[_0x0596('0xf')](_0x0596('0xb'),auth['isAuthenticated'](),controller[_0x0596('0x10')]);module[_0x0596('0x11')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index 95d7fb2..70766b8 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 _0xc31e=['noop','TEXT','*,*,*,*','exports','INTEGER'];(function(_0x2f8431,_0x10a4b4){var _0x2640c7=function(_0x3ecf4b){while(--_0x3ecf4b){_0x2f8431['push'](_0x2f8431['shift']());}};_0x2640c7(++_0x10a4b4);}(_0xc31e,0x111));var _0xec31=function(_0x4f711d,_0x364b1c){_0x4f711d=_0x4f711d-0x0;var _0x592067=_0xc31e[_0x4f711d];return _0x592067;};'use strict';var Sequelize=require('sequelize');module[_0xec31('0x0')]={'priority':{'type':Sequelize[_0xec31('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xec31('0x2')},'appdata':{'type':Sequelize[_0xec31('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xec31('0x4')}}; \ No newline at end of file +var _0xb1ec=['sequelize','exports','INTEGER','STRING','noop','TEXT','*,*,*,*'];(function(_0x514757,_0x3e9c1b){var _0x1f4e84=function(_0x38b1b9){while(--_0x38b1b9){_0x514757['push'](_0x514757['shift']());}};_0x1f4e84(++_0x3e9c1b);}(_0xb1ec,0xfc));var _0xcb1e=function(_0x4bef18,_0x4bd694){_0x4bef18=_0x4bef18-0x0;var _0x17cff3=_0xb1ec[_0x4bef18];return _0x17cff3;};'use strict';var Sequelize=require(_0xcb1e('0x0'));module[_0xcb1e('0x1')]={'priority':{'type':Sequelize[_0xcb1e('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xcb1e('0x3')],'allowNull':![],'defaultValue':_0xcb1e('0x4')},'appdata':{'type':Sequelize[_0xcb1e('0x5')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xcb1e('0x3')],'defaultValue':_0xcb1e('0x6')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index 99d5d3d..068b22c 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 _0x50c1=['limit','apply','reject','save','update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','sort','filter','where','merge','VIRTUAL','count','includeAll','SmsApplication','rows','catch','show','params','include','find','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x50c1,0xf9));var _0x150c=function(_0x1bd7dd,_0x2402ad){_0x1bd7dd=_0x1bd7dd-0x0;var _0x2a2c05=_0x50c1[_0x1bd7dd];return _0x2a2c05;};'use strict';var pdf=require(_0x150c('0x0'));var emlformat=require(_0x150c('0x1'));var rimraf=require(_0x150c('0x2'));var zipdir=require(_0x150c('0x3'));var jsonpatch=require(_0x150c('0x4'));var rp=require(_0x150c('0x5'));var moment=require(_0x150c('0x6'));var BPromise=require(_0x150c('0x7'));var Mustache=require(_0x150c('0x8'));var util=require(_0x150c('0x9'));var path=require('path');var sox=require(_0x150c('0xa'));var csv=require(_0x150c('0xb'));var ejs=require(_0x150c('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0x150c('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x150c('0xe'));var toCsv=require(_0x150c('0xb'));var querystring=require(_0x150c('0xf'));var Papa=require(_0x150c('0x10'));var Redis=require(_0x150c('0x11'));var authService=require(_0x150c('0x12'));var qs=require(_0x150c('0x13'));var as=require(_0x150c('0x14'));var hardwareService=require(_0x150c('0x15'));var logger=require(_0x150c('0x16'))(_0x150c('0x17'));var utils=require(_0x150c('0x18'));var config=require(_0x150c('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5ae79b,_0x225cd2){_0x225cd2=_0x225cd2||0xcc;return function(_0x155f5b){if(_0x155f5b){return _0x5ae79b[_0x150c('0x1a')](_0x225cd2);}return _0x5ae79b[_0x150c('0x1b')](_0x225cd2)[_0x150c('0x1c')]();};}function respondWithResult(_0x24bafb,_0x29a0a2){_0x29a0a2=_0x29a0a2||0xc8;return function(_0x21a07d){if(_0x21a07d){return _0x24bafb[_0x150c('0x1b')](_0x29a0a2)[_0x150c('0x1d')](_0x21a07d);}};}function respondWithFilteredResult(_0x56d97b,_0x4223dd){return function(_0x2f64d5){if(_0x2f64d5){var _0x4bbe58=_0x2f64d5['count'],_0x4b39fc=_0x4223dd[_0x150c('0x1e')],_0x118131=_0x4223dd[_0x150c('0x1e')]+_0x4223dd[_0x150c('0x1f')],_0x310a06;if(_0x118131>=_0x4bbe58){_0x118131=_0x4bbe58;_0x310a06=0xc8;}else{_0x310a06=0xce;}_0x56d97b[_0x150c('0x1b')](_0x310a06);return _0x56d97b['set']('Content-Range',_0x4b39fc+'-'+_0x118131+'/'+_0x4bbe58)[_0x150c('0x1d')](_0x2f64d5);}return null;};}function patchUpdates(_0x227a7e){return function(_0x3fba62){try{jsonpatch[_0x150c('0x20')](_0x3fba62,_0x227a7e,!![]);}catch(_0x577427){return BPromise[_0x150c('0x21')](_0x577427);}return _0x3fba62[_0x150c('0x22')]();};}function saveUpdates(_0x14074d,_0x513759){return function(_0x148eae){if(_0x148eae){return _0x148eae[_0x150c('0x23')](_0x14074d)[_0x150c('0x24')](function(_0xc614a6){return _0xc614a6;});}return null;};}function removeEntity(_0x3d8272,_0x3b24e2){return function(_0x4f77cc){if(_0x4f77cc){return _0x4f77cc[_0x150c('0x25')]()[_0x150c('0x24')](function(){_0x3d8272[_0x150c('0x1b')](0xcc)[_0x150c('0x1c')]();});}};}function handleEntityNotFound(_0x345bcd,_0x23856f){return function(_0x52b72e){if(!_0x52b72e){_0x345bcd['sendStatus'](0x194);}return _0x52b72e;};}function handleError(_0x538fdb,_0x3e0ce1){_0x3e0ce1=_0x3e0ce1||0x1f4;return function(_0x142b23){logger['error'](_0x142b23[_0x150c('0x26')]);if(_0x142b23[_0x150c('0x27')]){delete _0x142b23['name'];}_0x538fdb[_0x150c('0x1b')](_0x3e0ce1)[_0x150c('0x28')](_0x142b23);};}exports[_0x150c('0x29')]=function(_0x4aff86,_0x26a4cc){var _0x264523={},_0x3b68ac={},_0x1d2102={'count':0x0,'rows':[]};var _0x521b42=_[_0x150c('0x2a')](db['SmsApplication'][_0x150c('0x2b')],function(_0x235f39){return{'name':_0x235f39[_0x150c('0x2c')],'type':_0x235f39[_0x150c('0x2d')]['key']};});_0x3b68ac['model']=_[_0x150c('0x2a')](_0x521b42,_0x150c('0x27'));_0x3b68ac[_0x150c('0x2e')]=_[_0x150c('0x2f')](_0x4aff86[_0x150c('0x2e')]);_0x3b68ac[_0x150c('0x30')]=_[_0x150c('0x31')](_0x3b68ac[_0x150c('0x32')],_0x3b68ac[_0x150c('0x2e')]);_0x264523[_0x150c('0x33')]=_['intersection'](_0x3b68ac['model'],qs['fields'](_0x4aff86[_0x150c('0x2e')][_0x150c('0x34')]));_0x264523['attributes']=_0x264523[_0x150c('0x33')][_0x150c('0x35')]?_0x264523[_0x150c('0x33')]:_0x3b68ac[_0x150c('0x32')];if(!_0x4aff86[_0x150c('0x2e')]['hasOwnProperty']('nolimit')){_0x264523['limit']=qs[_0x150c('0x1f')](_0x4aff86[_0x150c('0x2e')]['limit']);_0x264523[_0x150c('0x1e')]=qs[_0x150c('0x1e')](_0x4aff86[_0x150c('0x2e')][_0x150c('0x1e')]);}_0x264523['order']=qs[_0x150c('0x36')](_0x4aff86[_0x150c('0x2e')]['sort']);_0x264523['where']=qs[_0x150c('0x30')](_['pick'](_0x4aff86[_0x150c('0x2e')],_0x3b68ac[_0x150c('0x30')]));if(_0x4aff86['query'][_0x150c('0x37')]){_0x264523[_0x150c('0x38')]=_[_0x150c('0x39')](_0x264523[_0x150c('0x38')],{'$or':_['map'](_0x521b42,function(_0x2b8a50){if(_0x2b8a50[_0x150c('0x2d')]!==_0x150c('0x3a')){var _0x511794={};_0x511794[_0x2b8a50['name']]={'$like':'%'+_0x4aff86['query'][_0x150c('0x37')]+'%'};return _0x511794;}})});}_0x264523=_[_0x150c('0x39')]({},_0x264523,_0x4aff86['options']);var _0x551060={'where':_0x264523[_0x150c('0x38')]};return db['SmsApplication'][_0x150c('0x3b')](_0x551060)[_0x150c('0x24')](function(_0x39e527){_0x1d2102[_0x150c('0x3b')]=_0x39e527;if(_0x4aff86[_0x150c('0x2e')][_0x150c('0x3c')]){_0x264523['include']=[{'all':!![]}];}return db[_0x150c('0x3d')]['findAll'](_0x264523);})[_0x150c('0x24')](function(_0x381557){_0x1d2102[_0x150c('0x3e')]=_0x381557;return _0x1d2102;})[_0x150c('0x24')](respondWithFilteredResult(_0x26a4cc,_0x264523))[_0x150c('0x3f')](handleError(_0x26a4cc,null));};exports[_0x150c('0x40')]=function(_0x47357e,_0x101a95){var _0x57204f={'raw':!![],'where':{'id':_0x47357e[_0x150c('0x41')]['id']}},_0x16365a={};_0x16365a[_0x150c('0x32')]=_[_0x150c('0x2f')](db[_0x150c('0x3d')]['rawAttributes']);_0x16365a[_0x150c('0x2e')]=_[_0x150c('0x2f')](_0x47357e['query']);_0x16365a[_0x150c('0x30')]=_['intersection'](_0x16365a['model'],_0x16365a[_0x150c('0x2e')]);_0x57204f[_0x150c('0x33')]=_[_0x150c('0x31')](_0x16365a[_0x150c('0x32')],qs['fields'](_0x47357e['query'][_0x150c('0x34')]));_0x57204f[_0x150c('0x33')]=_0x57204f['attributes'][_0x150c('0x35')]?_0x57204f['attributes']:_0x16365a[_0x150c('0x32')];if(_0x47357e[_0x150c('0x2e')][_0x150c('0x3c')]){_0x57204f[_0x150c('0x42')]=[{'all':!![]}];}_0x57204f=_[_0x150c('0x39')]({},_0x57204f,_0x47357e['options']);return db[_0x150c('0x3d')][_0x150c('0x43')](_0x57204f)[_0x150c('0x24')](handleEntityNotFound(_0x101a95,null))[_0x150c('0x24')](respondWithResult(_0x101a95,null))[_0x150c('0x3f')](handleError(_0x101a95,null));};exports[_0x150c('0x44')]=function(_0x6b6154,_0x5aa058){return db[_0x150c('0x3d')]['create'](_0x6b6154['body'],{})[_0x150c('0x24')](respondWithResult(_0x5aa058,0xc9))[_0x150c('0x3f')](handleError(_0x5aa058,null));};exports[_0x150c('0x23')]=function(_0x56288b,_0x3b7893){if(_0x56288b['body']['id']){delete _0x56288b[_0x150c('0x45')]['id'];}return db['SmsApplication'][_0x150c('0x43')]({'where':{'id':_0x56288b['params']['id']}})[_0x150c('0x24')](handleEntityNotFound(_0x3b7893,null))[_0x150c('0x24')](saveUpdates(_0x56288b['body'],null))[_0x150c('0x24')](respondWithResult(_0x3b7893,null))[_0x150c('0x3f')](handleError(_0x3b7893,null));};exports[_0x150c('0x25')]=function(_0x32c14a,_0x2db391){return db[_0x150c('0x3d')][_0x150c('0x43')]({'where':{'id':_0x32c14a[_0x150c('0x41')]['id']}})[_0x150c('0x24')](handleEntityNotFound(_0x2db391,null))[_0x150c('0x24')](removeEntity(_0x2db391,null))[_0x150c('0x3f')](handleError(_0x2db391,null));}; \ No newline at end of file +var _0x3ac2=['length','find','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','SmsApplication','rawAttributes','type','key','query','filters','model','attributes','intersection','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','params','keys','fields'];(function(_0xdd27d1,_0xb6f0da){var _0x58220e=function(_0x52bbff){while(--_0x52bbff){_0xdd27d1['push'](_0xdd27d1['shift']());}};_0x58220e(++_0xb6f0da);}(_0x3ac2,0x1c0));var _0x23ac=function(_0x4e80d2,_0x96a6d8){_0x4e80d2=_0x4e80d2-0x0;var _0x1297b1=_0x3ac2[_0x4e80d2];return _0x1297b1;};'use strict';var pdf=require(_0x23ac('0x0'));var emlformat=require(_0x23ac('0x1'));var rimraf=require(_0x23ac('0x2'));var zipdir=require(_0x23ac('0x3'));var jsonpatch=require(_0x23ac('0x4'));var rp=require(_0x23ac('0x5'));var moment=require(_0x23ac('0x6'));var BPromise=require(_0x23ac('0x7'));var Mustache=require(_0x23ac('0x8'));var util=require(_0x23ac('0x9'));var path=require(_0x23ac('0xa'));var sox=require('sox');var csv=require(_0x23ac('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x23ac('0xc'));var jsforce=require(_0x23ac('0xd'));var deskjs=require(_0x23ac('0xe'));var toCsv=require('to-csv');var querystring=require(_0x23ac('0xf'));var Papa=require('papaparse');var Redis=require(_0x23ac('0x10'));var authService=require(_0x23ac('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x23ac('0x12'));var hardwareService=require(_0x23ac('0x13'));var logger=require('../../config/logger')(_0x23ac('0x14'));var utils=require(_0x23ac('0x15'));var config=require(_0x23ac('0x16'));var db=require(_0x23ac('0x17'))['db'];function respondWithStatusCode(_0x1e18c7,_0x16dd26){_0x16dd26=_0x16dd26||0xcc;return function(_0x43582c){if(_0x43582c){return _0x1e18c7[_0x23ac('0x18')](_0x16dd26);}return _0x1e18c7[_0x23ac('0x19')](_0x16dd26)[_0x23ac('0x1a')]();};}function respondWithResult(_0xcf692a,_0x58b318){_0x58b318=_0x58b318||0xc8;return function(_0x57b40a){if(_0x57b40a){return _0xcf692a[_0x23ac('0x19')](_0x58b318)[_0x23ac('0x1b')](_0x57b40a);}};}function respondWithFilteredResult(_0x1d63fc,_0x5eeea2){return function(_0x5da1eb){if(_0x5da1eb){var _0x897436=_0x5da1eb[_0x23ac('0x1c')],_0x4a5c4f=_0x5eeea2[_0x23ac('0x1d')],_0x29586b=_0x5eeea2[_0x23ac('0x1d')]+_0x5eeea2[_0x23ac('0x1e')],_0x1dc214;if(_0x29586b>=_0x897436){_0x29586b=_0x897436;_0x1dc214=0xc8;}else{_0x1dc214=0xce;}_0x1d63fc[_0x23ac('0x19')](_0x1dc214);return _0x1d63fc[_0x23ac('0x1f')]('Content-Range',_0x4a5c4f+'-'+_0x29586b+'/'+_0x897436)[_0x23ac('0x1b')](_0x5da1eb);}return null;};}function patchUpdates(_0xc76711){return function(_0x1d7834){try{jsonpatch[_0x23ac('0x20')](_0x1d7834,_0xc76711,!![]);}catch(_0x4175b6){return BPromise[_0x23ac('0x21')](_0x4175b6);}return _0x1d7834[_0x23ac('0x22')]();};}function saveUpdates(_0x24a943,_0x3b5179){return function(_0x2a1274){if(_0x2a1274){return _0x2a1274[_0x23ac('0x23')](_0x24a943)['then'](function(_0x20096e){return _0x20096e;});}return null;};}function removeEntity(_0x2233cc,_0x5c9e63){return function(_0xef48ee){if(_0xef48ee){return _0xef48ee[_0x23ac('0x24')]()[_0x23ac('0x25')](function(){_0x2233cc['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x30a0e6,_0x43046a){return function(_0x54c136){if(!_0x54c136){_0x30a0e6['sendStatus'](0x194);}return _0x54c136;};}function handleError(_0x781a55,_0x22f49c){_0x22f49c=_0x22f49c||0x1f4;return function(_0x5ca963){logger[_0x23ac('0x26')](_0x5ca963[_0x23ac('0x27')]);if(_0x5ca963[_0x23ac('0x28')]){delete _0x5ca963[_0x23ac('0x28')];}_0x781a55['status'](_0x22f49c)[_0x23ac('0x29')](_0x5ca963);};}exports[_0x23ac('0x2a')]=function(_0x56e256,_0x473f49){var _0x11ac17={},_0x27e221={},_0x5caa3f={'count':0x0,'rows':[]};var _0x1f7cb3=_[_0x23ac('0x2b')](db[_0x23ac('0x2c')][_0x23ac('0x2d')],function(_0x58d42c){return{'name':_0x58d42c['fieldName'],'type':_0x58d42c[_0x23ac('0x2e')][_0x23ac('0x2f')]};});_0x27e221['model']=_[_0x23ac('0x2b')](_0x1f7cb3,'name');_0x27e221[_0x23ac('0x30')]=_['keys'](_0x56e256[_0x23ac('0x30')]);_0x27e221[_0x23ac('0x31')]=_['intersection'](_0x27e221[_0x23ac('0x32')],_0x27e221[_0x23ac('0x30')]);_0x11ac17[_0x23ac('0x33')]=_[_0x23ac('0x34')](_0x27e221[_0x23ac('0x32')],qs['fields'](_0x56e256[_0x23ac('0x30')]['fields']));_0x11ac17['attributes']=_0x11ac17[_0x23ac('0x33')]['length']?_0x11ac17[_0x23ac('0x33')]:_0x27e221[_0x23ac('0x32')];if(!_0x56e256['query'][_0x23ac('0x35')](_0x23ac('0x36'))){_0x11ac17[_0x23ac('0x1e')]=qs['limit'](_0x56e256[_0x23ac('0x30')][_0x23ac('0x1e')]);_0x11ac17[_0x23ac('0x1d')]=qs['offset'](_0x56e256[_0x23ac('0x30')][_0x23ac('0x1d')]);}_0x11ac17[_0x23ac('0x37')]=qs[_0x23ac('0x38')](_0x56e256[_0x23ac('0x30')][_0x23ac('0x38')]);_0x11ac17[_0x23ac('0x39')]=qs[_0x23ac('0x31')](_[_0x23ac('0x3a')](_0x56e256['query'],_0x27e221['filters']));if(_0x56e256[_0x23ac('0x30')][_0x23ac('0x3b')]){_0x11ac17['where']=_[_0x23ac('0x3c')](_0x11ac17['where'],{'$or':_[_0x23ac('0x2b')](_0x1f7cb3,function(_0x4da70c){if(_0x4da70c[_0x23ac('0x2e')]!=='VIRTUAL'){var _0x496d14={};_0x496d14[_0x4da70c[_0x23ac('0x28')]]={'$like':'%'+_0x56e256[_0x23ac('0x30')][_0x23ac('0x3b')]+'%'};return _0x496d14;}})});}_0x11ac17=_[_0x23ac('0x3c')]({},_0x11ac17,_0x56e256[_0x23ac('0x3d')]);var _0x13a1c0={'where':_0x11ac17[_0x23ac('0x39')]};return db[_0x23ac('0x2c')]['count'](_0x13a1c0)['then'](function(_0x2b36c1){_0x5caa3f[_0x23ac('0x1c')]=_0x2b36c1;if(_0x56e256[_0x23ac('0x30')][_0x23ac('0x3e')]){_0x11ac17[_0x23ac('0x3f')]=[{'all':!![]}];}return db['SmsApplication'][_0x23ac('0x40')](_0x11ac17);})[_0x23ac('0x25')](function(_0x2eb707){_0x5caa3f[_0x23ac('0x41')]=_0x2eb707;return _0x5caa3f;})[_0x23ac('0x25')](respondWithFilteredResult(_0x473f49,_0x11ac17))[_0x23ac('0x42')](handleError(_0x473f49,null));};exports['show']=function(_0x560018,_0x489bc0){var _0x517792={'raw':!![],'where':{'id':_0x560018[_0x23ac('0x43')]['id']}},_0x51395e={};_0x51395e[_0x23ac('0x32')]=_[_0x23ac('0x44')](db[_0x23ac('0x2c')][_0x23ac('0x2d')]);_0x51395e[_0x23ac('0x30')]=_[_0x23ac('0x44')](_0x560018[_0x23ac('0x30')]);_0x51395e[_0x23ac('0x31')]=_[_0x23ac('0x34')](_0x51395e['model'],_0x51395e[_0x23ac('0x30')]);_0x517792[_0x23ac('0x33')]=_[_0x23ac('0x34')](_0x51395e[_0x23ac('0x32')],qs[_0x23ac('0x45')](_0x560018['query'][_0x23ac('0x45')]));_0x517792[_0x23ac('0x33')]=_0x517792[_0x23ac('0x33')][_0x23ac('0x46')]?_0x517792[_0x23ac('0x33')]:_0x51395e[_0x23ac('0x32')];if(_0x560018[_0x23ac('0x30')][_0x23ac('0x3e')]){_0x517792[_0x23ac('0x3f')]=[{'all':!![]}];}_0x517792=_[_0x23ac('0x3c')]({},_0x517792,_0x560018[_0x23ac('0x3d')]);return db[_0x23ac('0x2c')][_0x23ac('0x47')](_0x517792)[_0x23ac('0x25')](handleEntityNotFound(_0x489bc0,null))[_0x23ac('0x25')](respondWithResult(_0x489bc0,null))['catch'](handleError(_0x489bc0,null));};exports[_0x23ac('0x48')]=function(_0x57b4b7,_0x349bb7){return db[_0x23ac('0x2c')][_0x23ac('0x48')](_0x57b4b7[_0x23ac('0x49')],{})[_0x23ac('0x25')](respondWithResult(_0x349bb7,0xc9))[_0x23ac('0x42')](handleError(_0x349bb7,null));};exports[_0x23ac('0x23')]=function(_0x66ed0c,_0x4fbe3d){if(_0x66ed0c[_0x23ac('0x49')]['id']){delete _0x66ed0c[_0x23ac('0x49')]['id'];}return db[_0x23ac('0x2c')][_0x23ac('0x47')]({'where':{'id':_0x66ed0c['params']['id']}})['then'](handleEntityNotFound(_0x4fbe3d,null))[_0x23ac('0x25')](saveUpdates(_0x66ed0c['body'],null))['then'](respondWithResult(_0x4fbe3d,null))['catch'](handleError(_0x4fbe3d,null));};exports['destroy']=function(_0x1d17c0,_0x138820){return db[_0x23ac('0x2c')][_0x23ac('0x47')]({'where':{'id':_0x1d17c0[_0x23ac('0x43')]['id']}})[_0x23ac('0x25')](handleEntityNotFound(_0x138820,null))['then'](removeEntity(_0x138820,null))[_0x23ac('0x42')](handleError(_0x138820,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index 131c58a..5d2e17a 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 _0x1195=['bluebird','path','rimraf','../../config/environment','./smsApplication.attributes','exports','utf8mb4','utf8mb4_unicode_ci'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1195,0x70));var _0x5119=function(_0x585b83,_0x25d403){_0x585b83=_0x585b83-0x0;var _0x2faa24=_0x1195[_0x585b83];return _0x2faa24;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x5119('0x0'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5119('0x1'));var rimraf=require(_0x5119('0x2'));var config=require(_0x5119('0x3'));var attributes=require(_0x5119('0x4'));module[_0x5119('0x5')]=function(_0x35045a,_0x1e9057){return _0x35045a['define']('SmsApplication',attributes,{'tableName':'sms_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x5119('0x6'),'collate':_0x5119('0x7')});}; \ No newline at end of file +var _0x7773=['utf8mb4','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./smsApplication.attributes','exports','define','SmsApplication'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x7773,0xde));var _0x3777=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x7773[_0x46e363];return _0x3fb059;};'use strict';var _=require(_0x3777('0x0'));var util=require('util');var logger=require(_0x3777('0x1'))(_0x3777('0x2'));var moment=require(_0x3777('0x3'));var BPromise=require(_0x3777('0x4'));var rp=require(_0x3777('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3777('0x6'));var config=require(_0x3777('0x7'));var attributes=require(_0x3777('0x8'));module[_0x3777('0x9')]=function(_0xc41e64,_0x42e615){return _0xc41e64[_0x3777('0xa')](_0x3777('0xb'),attributes,{'tableName':'sms_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x3777('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index ccc3973..87196ae 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 _0xa87e=['then','info','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request'];(function(_0x5608d7,_0x2e74b6){var _0xd4aa72=function(_0x446c36){while(--_0x446c36){_0x5608d7['push'](_0x5608d7['shift']());}};_0xd4aa72(++_0x2e74b6);}(_0xa87e,0x1c2));var _0xea87=function(_0x2b84f7,_0x3eeb07){_0x2b84f7=_0x2b84f7-0x0;var _0x18f7f1=_0xa87e[_0x2b84f7];return _0x18f7f1;};'use strict';var _=require(_0xea87('0x0'));var util=require(_0xea87('0x1'));var moment=require(_0xea87('0x2'));var BPromise=require(_0xea87('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xea87('0x4'));var db=require(_0xea87('0x5'))['db'];var utils=require(_0xea87('0x6'));var logger=require('../../config/logger')(_0xea87('0x7'));var config=require(_0xea87('0x8'));var jayson=require(_0xea87('0x9'));var client=jayson[_0xea87('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0xa4b0bc,_0x329f85,_0x284019){return new BPromise(function(_0x415772,_0xe43a6a){return client[_0xea87('0xb')](_0xa4b0bc,_0x284019)[_0xea87('0xc')](function(_0x36d16c){logger[_0xea87('0xd')](_0xea87('0xe'),_0x329f85,_0xea87('0xf'));logger[_0xea87('0x10')]('SmsApplication,\x20%s,\x20%s,\x20%s',_0x329f85,_0xea87('0xf'),JSON[_0xea87('0x11')](_0x36d16c));if(_0x36d16c[_0xea87('0x12')]){if(_0x36d16c['error'][_0xea87('0x13')]===0x1f4){logger['error'](_0xea87('0xe'),_0x329f85,_0x36d16c[_0xea87('0x12')][_0xea87('0x14')]);return _0xe43a6a(_0x36d16c['error'][_0xea87('0x14')]);}logger[_0xea87('0x12')](_0xea87('0xe'),_0x329f85,_0x36d16c[_0xea87('0x12')][_0xea87('0x14')]);return _0x415772(_0x36d16c[_0xea87('0x12')][_0xea87('0x14')]);}else{logger['info'](_0xea87('0xe'),_0x329f85,'request\x20sent');_0x415772(_0x36d16c['result']['message']);}})['catch'](function(_0x27be9b){logger[_0xea87('0x12')](_0xea87('0xe'),_0x329f85,_0x27be9b);_0xe43a6a(_0x27be9b);});});} \ No newline at end of file +var _0x269f=['request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','SmsApplication,\x20%s,\x20%s'];(function(_0x28669c,_0x1f62c4){var _0x4a3af6=function(_0x3e25d5){while(--_0x3e25d5){_0x28669c['push'](_0x28669c['shift']());}};_0x4a3af6(++_0x1f62c4);}(_0x269f,0xee));var _0xf269=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x269f[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0xf269('0x0'));var util=require(_0xf269('0x1'));var moment=require(_0xf269('0x2'));var BPromise=require('bluebird');var rs=require(_0xf269('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf269('0x4'))['db'];var utils=require(_0xf269('0x5'));var logger=require(_0xf269('0x6'))(_0xf269('0x7'));var config=require(_0xf269('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xf269('0x9')][_0xf269('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x36d30c,_0x48058a,_0x3ffba3){return new BPromise(function(_0x43c60c,_0x3ef428){return client['request'](_0x36d30c,_0x3ffba3)[_0xf269('0xb')](function(_0x31be8e){logger[_0xf269('0xc')](_0xf269('0xd'),_0x48058a,_0xf269('0xe'));logger[_0xf269('0xf')](_0xf269('0x10'),_0x48058a,_0xf269('0xe'),JSON['stringify'](_0x31be8e));if(_0x31be8e['error']){if(_0x31be8e['error']['code']===0x1f4){logger['error'](_0xf269('0xd'),_0x48058a,_0x31be8e[_0xf269('0x11')][_0xf269('0x12')]);return _0x3ef428(_0x31be8e[_0xf269('0x11')][_0xf269('0x12')]);}logger[_0xf269('0x11')](_0xf269('0xd'),_0x48058a,_0x31be8e[_0xf269('0x11')][_0xf269('0x12')]);return _0x43c60c(_0x31be8e[_0xf269('0x11')][_0xf269('0x12')]);}else{logger[_0xf269('0xc')](_0xf269('0xd'),_0x48058a,_0xf269('0xe'));_0x43c60c(_0x31be8e[_0xf269('0x13')][_0xf269('0x12')]);}})[_0xf269('0x14')](function(_0x2ab68c){logger[_0xf269('0x11')](_0xf269('0xd'),_0x48058a,_0x2ab68c);_0x3ef428(_0x2ab68c);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index f17d5a8..5343122 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 _0x34bd=['exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsInteraction.controller','isAuthenticated','describe','get','/:id','show','/:id/messages','getMessages','/:id/download','download','create','post','addMessage','/:id/tags','sms','smsinteraction:addtags','addTags','update','delete','tracked','smsinteraction:destroy','destroy','removeTags'];(function(_0xfc6247,_0x5cbddb){var _0x291245=function(_0x41d7ba){while(--_0x41d7ba){_0xfc6247['push'](_0xfc6247['shift']());}};_0x291245(++_0x5cbddb);}(_0x34bd,0x1d2));var _0xd34b=function(_0x7025b0,_0x9533f1){_0x7025b0=_0x7025b0-0x0;var _0x6e444c=_0x34bd[_0x7025b0];return _0x6e444c;};'use strict';var multer=require(_0xd34b('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xd34b('0x1'));var express=require(_0xd34b('0x2'));var router=express[_0xd34b('0x3')]();var auth=require(_0xd34b('0x4'));var interaction=require(_0xd34b('0x5'));var config=require(_0xd34b('0x6'));var controller=require(_0xd34b('0x7'));router['get']('/',auth[_0xd34b('0x8')](),controller['index']);router['get']('/describe',auth[_0xd34b('0x8')](),controller[_0xd34b('0x9')]);router[_0xd34b('0xa')](_0xd34b('0xb'),auth[_0xd34b('0x8')](),controller[_0xd34b('0xc')]);router[_0xd34b('0xa')](_0xd34b('0xd'),auth[_0xd34b('0x8')](),controller[_0xd34b('0xe')]);router[_0xd34b('0xa')](_0xd34b('0xf'),auth['isAuthenticated'](),controller[_0xd34b('0x10')]);router['post']('/',auth[_0xd34b('0x8')](),controller[_0xd34b('0x11')]);router[_0xd34b('0x12')](_0xd34b('0xd'),auth[_0xd34b('0x8')](),controller[_0xd34b('0x13')]);router['post'](_0xd34b('0x14'),auth[_0xd34b('0x8')](),interaction['tracked'](_0xd34b('0x15'),_0xd34b('0x16')),controller[_0xd34b('0x17')]);router['put'](_0xd34b('0xb'),auth[_0xd34b('0x8')](),interaction['tracked'](_0xd34b('0x15'),'smsinteraction:update'),controller[_0xd34b('0x18')]);router[_0xd34b('0x19')](_0xd34b('0xb'),auth['isAuthenticated'](),interaction[_0xd34b('0x1a')](_0xd34b('0x15'),_0xd34b('0x1b')),controller[_0xd34b('0x1c')]);router[_0xd34b('0x19')]('/:id/tags',auth['isAuthenticated'](),controller[_0xd34b('0x1d')]);module[_0xd34b('0x1e')]=router; \ No newline at end of file +var _0x36d3=['../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','download','post','create','addMessage','/:id/tags','tracked','sms','smsinteraction:addtags','addTags','smsinteraction:update','delete','smsinteraction:destroy','destroy','removeTags','multer','util','path','Router','../../components/auth/service'];(function(_0x59371d,_0x22785c){var _0x1e2298=function(_0x4cc63f){while(--_0x4cc63f){_0x59371d['push'](_0x59371d['shift']());}};_0x1e2298(++_0x22785c);}(_0x36d3,0xb5));var _0x336d=function(_0x5ed7be,_0x2ca3fd){_0x5ed7be=_0x5ed7be-0x0;var _0x538a76=_0x36d3[_0x5ed7be];return _0x538a76;};'use strict';var multer=require(_0x336d('0x0'));var util=require(_0x336d('0x1'));var path=require(_0x336d('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x336d('0x3')]();var auth=require(_0x336d('0x4'));var interaction=require(_0x336d('0x5'));var config=require(_0x336d('0x6'));var controller=require(_0x336d('0x7'));router[_0x336d('0x8')]('/',auth[_0x336d('0x9')](),controller[_0x336d('0xa')]);router[_0x336d('0x8')](_0x336d('0xb'),auth[_0x336d('0x9')](),controller[_0x336d('0xc')]);router[_0x336d('0x8')](_0x336d('0xd'),auth[_0x336d('0x9')](),controller[_0x336d('0xe')]);router['get'](_0x336d('0xf'),auth[_0x336d('0x9')](),controller[_0x336d('0x10')]);router[_0x336d('0x8')]('/:id/download',auth[_0x336d('0x9')](),controller[_0x336d('0x11')]);router[_0x336d('0x12')]('/',auth[_0x336d('0x9')](),controller[_0x336d('0x13')]);router[_0x336d('0x12')](_0x336d('0xf'),auth[_0x336d('0x9')](),controller[_0x336d('0x14')]);router[_0x336d('0x12')](_0x336d('0x15'),auth[_0x336d('0x9')](),interaction[_0x336d('0x16')](_0x336d('0x17'),_0x336d('0x18')),controller[_0x336d('0x19')]);router['put'](_0x336d('0xd'),auth[_0x336d('0x9')](),interaction[_0x336d('0x16')](_0x336d('0x17'),_0x336d('0x1a')),controller['update']);router[_0x336d('0x1b')]('/:id',auth[_0x336d('0x9')](),interaction[_0x336d('0x16')](_0x336d('0x17'),_0x336d('0x1c')),controller[_0x336d('0x1d')]);router[_0x336d('0x1b')]('/:id/tags',auth[_0x336d('0x9')](),controller[_0x336d('0x1e')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index 76032db..f1f71f6 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 _0xbaf0=['DATE','STRING','ENUM','out','moment','exports','BOOLEAN'];(function(_0x269a18,_0x19ff44){var _0x490e13=function(_0x4fcd8d){while(--_0x4fcd8d){_0x269a18['push'](_0x269a18['shift']());}};_0x490e13(++_0x19ff44);}(_0xbaf0,0x12a));var _0x0baf=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xbaf0[_0x3947c9];return _0x2e7871;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x0baf('0x0'));module[_0x0baf('0x1')]={'closed':{'type':Sequelize[_0x0baf('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x0baf('0x3')]},'disposition':{'type':Sequelize[_0x0baf('0x4')]},'note':{'type':Sequelize[_0x0baf('0x4')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x0baf('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x0baf('0x5')]('in',_0x0baf('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x0baf('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x0baf('0x5')]('in',_0x0baf('0x6')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x0713=['DATE','STRING','ENUM','out','exports','BOOLEAN'];(function(_0x16aaef,_0x410651){var _0x1c82ef=function(_0x3d802b){while(--_0x3d802b){_0x16aaef['push'](_0x16aaef['shift']());}};_0x1c82ef(++_0x410651);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0x3071('0x0')]={'closed':{'type':Sequelize[_0x3071('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x3071('0x2')]},'disposition':{'type':Sequelize[_0x3071('0x3')]},'note':{'type':Sequelize[_0x3071('0x3')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x3071('0x2')]},'firstMsgDirection':{'type':Sequelize[_0x3071('0x4')]('in',_0x3071('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x3071('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x3071('0x4')]('in',_0x3071('0x5')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index 36bce7a..192d453 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 _0x6a95=['request-promise','moment','util','path','sox','to-csv','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./smsInteraction.socket','register','status','end','count','offset','limit','set','Content-Range','apply','reject','update','destroy','error','stack','name','TagIds','Tags','split','forEach','push','then','index','map','SmsInteraction','rawAttributes','fieldName','type','key','keys','query','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filters','field','color','from','u.id','u.fullname','ui.SmsInteractionId','user_has_sms_interactions','left_join','users','u.id\x20=\x20ui.UserId','select','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','sms_accounts','a.id\x20=\x20i.SmsAccountId','sms_messages','sms_interaction_has_tags','it.SmsInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','length','find','unreadMessages','value','having','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','some','isEmpty','concat','createdAt','$gte','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','\x27\x27\x27\x27','isNumeric','i.phone\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','SmsAccountId','journey','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','i.SmsAccountId\x20IN\x20?','sequelize','toString','keyBy','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.SmsInteractionId\x20IN\x20?','groupBy','SmsInteractionId','all','rows','show','params','merge','options','catch','create','describe','addMessage','SmsMessage','omit','ids','getMessages','findOne','YYYY-MM-DD\x20HH:mm:ss','includeAll','include','findAll','addTags','removeTags','download','unix','join','files','tmp','root','server','format','transcript-%d-%s.zip','fullname','firstName','lastName','Messages','direction','secret','SmsAccount','Owner','get','mkdirSync','10px','40px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','%s\x20#%d','Account','N.A.','closed','closedAt','disposition','out','System','renderFile','views','downloadInteraction.html','toFile','transcript-','.pdf','log','err','unlinkSync','sendStatus','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x4653f7,_0x3d3ae3){var _0x5454da=function(_0x448f55){while(--_0x448f55){_0x4653f7['push'](_0x4653f7['shift']());}};_0x5454da(++_0x3d3ae3);}(_0x6a95,0x1db));var _0x56a9=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x6a95[_0x6c993a];return _0x27f547;};'use strict';var pdf=require(_0x56a9('0x0'));var emlformat=require(_0x56a9('0x1'));var rimraf=require(_0x56a9('0x2'));var zipdir=require(_0x56a9('0x3'));var jsonpatch=require(_0x56a9('0x4'));var rp=require(_0x56a9('0x5'));var moment=require(_0x56a9('0x6'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x56a9('0x7'));var path=require(_0x56a9('0x8'));var sox=require(_0x56a9('0x9'));var csv=require(_0x56a9('0xa'));var ejs=require(_0x56a9('0xb'));var fs=require('fs');var _=require(_0x56a9('0xc'));var squel=require(_0x56a9('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x56a9('0xe'));var toCsv=require(_0x56a9('0xa'));var querystring=require('querystring');var Papa=require(_0x56a9('0xf'));var Redis=require(_0x56a9('0x10'));var authService=require(_0x56a9('0x11'));var qs=require(_0x56a9('0x12'));var as=require(_0x56a9('0x13'));var hardwareService=require(_0x56a9('0x14'));var logger=require(_0x56a9('0x15'))(_0x56a9('0x16'));var utils=require(_0x56a9('0x17'));var config=require('../../config/environment');var db=require(_0x56a9('0x18'))['db'];config['redis']=_[_0x56a9('0x19')](config[_0x56a9('0x1a')],{'host':_0x56a9('0x1b'),'port':0x18eb});var socket=require(_0x56a9('0x1c'))(new Redis(config[_0x56a9('0x1a')]));require(_0x56a9('0x1d'))[_0x56a9('0x1e')](socket);function respondWithStatusCode(_0x1a2eb4,_0x40b2cb){_0x40b2cb=_0x40b2cb||0xcc;return function(_0x561bec){if(_0x561bec){return _0x1a2eb4['sendStatus'](_0x40b2cb);}return _0x1a2eb4[_0x56a9('0x1f')](_0x40b2cb)[_0x56a9('0x20')]();};}function respondWithResult(_0x42007b,_0x46f854){_0x46f854=_0x46f854||0xc8;return function(_0x5b2637){if(_0x5b2637){return _0x42007b[_0x56a9('0x1f')](_0x46f854)['json'](_0x5b2637);}};}function respondWithFilteredResult(_0x5e5218,_0x4e292f){return function(_0x312e58){if(_0x312e58){var _0x576bdf=_0x312e58[_0x56a9('0x21')],_0x59c0ec=_0x4e292f[_0x56a9('0x22')],_0x105fe5=_0x4e292f[_0x56a9('0x22')]+_0x4e292f[_0x56a9('0x23')],_0x459a87;if(_0x105fe5>=_0x576bdf){_0x105fe5=_0x576bdf;_0x459a87=0xc8;}else{_0x459a87=0xce;}_0x5e5218[_0x56a9('0x1f')](_0x459a87);return _0x5e5218[_0x56a9('0x24')](_0x56a9('0x25'),_0x59c0ec+'-'+_0x105fe5+'/'+_0x576bdf)['json'](_0x312e58);}return null;};}function patchUpdates(_0x5bc03a){return function(_0x3a2e5e){try{jsonpatch[_0x56a9('0x26')](_0x3a2e5e,_0x5bc03a,!![]);}catch(_0x64d4a7){return BPromise[_0x56a9('0x27')](_0x64d4a7);}return _0x3a2e5e['save']();};}function saveUpdates(_0x6100fe,_0x3355c4){return function(_0x4036e5){if(_0x4036e5){return _0x4036e5[_0x56a9('0x28')](_0x6100fe)['then'](function(_0x44762e){return _0x44762e;});}return null;};}function removeEntity(_0x32839b,_0x21ab38){return function(_0xd029f7){if(_0xd029f7){return _0xd029f7[_0x56a9('0x29')]()['then'](function(){_0x32839b[_0x56a9('0x1f')](0xcc)[_0x56a9('0x20')]();});}};}function handleEntityNotFound(_0x35fe6d,_0x5e3052){return function(_0x1099ba){if(!_0x1099ba){_0x35fe6d['sendStatus'](0x194);}return _0x1099ba;};}function handleError(_0x22744f,_0x8d41d6){_0x8d41d6=_0x8d41d6||0x1f4;return function(_0x216464){logger[_0x56a9('0x2a')](_0x216464[_0x56a9('0x2b')]);if(_0x216464[_0x56a9('0x2c')]){delete _0x216464[_0x56a9('0x2c')];}_0x22744f[_0x56a9('0x1f')](_0x8d41d6)['send'](_0x216464);};}function getInteractionUsers(_0x437ccf,_0x2bb1eb){return new BPromise(function(_0x5f23e1,_0x4441ce){try{if(_0x2bb1eb[_0x437ccf['id']]){_0x437ccf['Users']=_['map'](_0x2bb1eb[_0x437ccf['id']],function(_0x20d940){return{'id':_0x20d940['id'],'fullname':_0x20d940['fullname']};});}}catch(_0x2f933a){_0x4441ce(_0x2f933a);}_0x5f23e1(_0x437ccf);});}function getInteractionTags(_0x11002a,_0x2fbd5d){return new BPromise(function(_0x2c1c3d,_0x5879db){try{if(_0x11002a[_0x56a9('0x2d')]){_0x11002a[_0x56a9('0x2e')]=[];_0x11002a[_0x56a9('0x2d')][_0x56a9('0x2f')](',')[_0x56a9('0x30')](function(_0x1fa0a6){_0x11002a[_0x56a9('0x2e')][_0x56a9('0x31')](_0x2fbd5d[_0x1fa0a6]);});}delete _0x11002a[_0x56a9('0x2d')];}catch(_0x392b72){_0x5879db(_0x392b72);}_0x2c1c3d(_0x11002a);});}function updateSmsInteraction(_0x243f1c,_0x277a04,_0x5738fe){return new BPromise(function(_0x142bd2,_0x1bb817){return getInteractionUsers(_0x243f1c,_0x5738fe)[_0x56a9('0x32')](function(_0x524765){return getInteractionTags(_0x524765,_0x277a04);})[_0x56a9('0x32')](function(_0x51ce05){_0x142bd2(_0x51ce05);})['catch'](function(_0x5732fb){_0x1bb817(_0x5732fb);});});}exports[_0x56a9('0x33')]=function(_0x134dfc,_0x5914b5){var _0x5473cb={},_0x164652={},_0x18d7d0={'count':0x0,'rows':[]};var _0x1ba22e=_[_0x56a9('0x34')](db[_0x56a9('0x35')][_0x56a9('0x36')],function(_0x269268){return{'name':_0x269268[_0x56a9('0x37')],'type':_0x269268[_0x56a9('0x38')][_0x56a9('0x39')]};});_0x164652['model']=_['map'](_0x1ba22e,'name');_0x164652['query']=_[_0x56a9('0x3a')](_0x134dfc[_0x56a9('0x3b')]);_0x164652['filters']=_[_0x56a9('0x3c')](_0x164652[_0x56a9('0x3d')],_0x164652[_0x56a9('0x3b')]);_0x5473cb[_0x56a9('0x3e')]=_[_0x56a9('0x3c')](_0x164652[_0x56a9('0x3d')],qs[_0x56a9('0x3f')](_0x134dfc['query'][_0x56a9('0x3f')]));_0x5473cb[_0x56a9('0x3e')]=_0x5473cb['attributes']['length']?_0x5473cb[_0x56a9('0x3e')]:_0x164652[_0x56a9('0x3d')];if(!_0x134dfc[_0x56a9('0x3b')][_0x56a9('0x40')](_0x56a9('0x41'))){_0x5473cb[_0x56a9('0x23')]=qs[_0x56a9('0x23')](_0x134dfc[_0x56a9('0x3b')][_0x56a9('0x23')]);_0x5473cb[_0x56a9('0x22')]=qs[_0x56a9('0x22')](_0x134dfc[_0x56a9('0x3b')][_0x56a9('0x22')]);}_0x5473cb[_0x56a9('0x42')]=qs[_0x56a9('0x43')](_0x134dfc[_0x56a9('0x3b')][_0x56a9('0x43')]);_0x5473cb[_0x56a9('0x44')]=qs['filters'](_[_0x56a9('0x45')](_0x134dfc[_0x56a9('0x3b')],_0x164652[_0x56a9('0x46')]));var _0x5ce001=[];var _0x1f8b30=squel['select']()[_0x56a9('0x47')]('id')['field'](_0x56a9('0x2c'))[_0x56a9('0x47')](_0x56a9('0x48'))[_0x56a9('0x49')]('tools_tags');var _0x4f541b=squel['select']()[_0x56a9('0x47')](_0x56a9('0x4a'))[_0x56a9('0x47')](_0x56a9('0x4b'))[_0x56a9('0x47')](_0x56a9('0x4c'))[_0x56a9('0x49')](_0x56a9('0x4d'),'ui')[_0x56a9('0x4e')](_0x56a9('0x4f'),'u',_0x56a9('0x50'));var _0x49e6a4=squel[_0x56a9('0x51')]()[_0x56a9('0x49')]('sms_interactions','i')[_0x56a9('0x4e')](_0x56a9('0x52'),'c',_0x56a9('0x53'))['left_join'](_0x56a9('0x4f'),'o',_0x56a9('0x54'))['left_join'](_0x56a9('0x55'),'a',_0x56a9('0x56'))[_0x56a9('0x4e')](_0x56a9('0x57'),'me','me.SmsInteractionId\x20=\x20i.id')[_0x56a9('0x4e')](_0x56a9('0x58'),'it',_0x56a9('0x59'))[_0x56a9('0x4e')](_0x56a9('0x5a'),'t',_0x56a9('0x5b'));var _0x31aaf5=squel[_0x56a9('0x5c')]();var _0x2b1324=[];var _0x2c3794=squel[_0x56a9('0x5c')]();var _0x500656;if(_0x134dfc['query'][_0x56a9('0x5d')]){_0x500656=as[_0x56a9('0x5e')](_0x134dfc[_0x56a9('0x3b')][_0x56a9('0x5d')]);var _0x4a3cd3=_0x500656[_0x56a9('0x5f')];for(var _0x942bee=0x0;_0x942bee<_0x500656[_0x56a9('0x60')][_0x56a9('0x61')];_0x942bee++){var _0x52ba21=_0x500656[_0x56a9('0x60')][_0x942bee];var _0x1f905b='i';var _0x52dc06=_[_0x56a9('0x62')](_0x1ba22e,[_0x56a9('0x2c'),_0x52ba21['field']]);if(!_0x52dc06){switch(_0x52ba21[_0x56a9('0x47')]){case _0x56a9('0x63'):if(_0x52ba21[_0x56a9('0x64')]==0x1){_0x49e6a4[_0x56a9('0x65')]('`'+_0x52ba21['field']+'`\x20=\x200');}else{_0x49e6a4[_0x56a9('0x65')]('`'+_0x52ba21[_0x56a9('0x47')]+_0x56a9('0x66'));}break;case _0x56a9('0x67'):if(_0x52ba21[_0x56a9('0x68')]===_0x56a9('0x69')){if(_0x52ba21[_0x56a9('0x64')][_0x56a9('0x2f')]('\x20')[_0x56a9('0x61')]>0x1){_0x31aaf5[_0x4a3cd3](_0x56a9('0x6a'),qs['getFullTextValue'](_0x52ba21[_0x56a9('0x64')]),null);}else{var _0x20ce89='%'+_0x52ba21[_0x56a9('0x64')]+'%';_0x31aaf5[_0x4a3cd3](_0x56a9('0x6b'),_0x20ce89,_0x20ce89,_0x20ce89);}}else{_0x52dc06=_[_0x56a9('0x62')](_0x1ba22e,[_0x56a9('0x2c'),_0x56a9('0x6c')]);_0x52ba21['field']=_0x56a9('0x6c');_0x57d1d9=as[_0x56a9('0x6d')](_0x1f905b,_0x52dc06[_0x56a9('0x38')],_0x52ba21);_0x31aaf5[_0x4a3cd3](_0x57d1d9[_0x56a9('0x6e')],_0x57d1d9[_0x56a9('0x64')][_0x56a9('0x6f')],_0x57d1d9[_0x56a9('0x64')]['end']);}break;case _0x56a9('0x70'):var _0x5667e4=_0x52ba21['value'][_0x56a9('0x2f')](',')['map'](function(_0x229c12){return Number(_0x229c12);});_0x5667e4[_0x56a9('0x30')](function(_0x3dfd55){_0x2c3794['or'](_0x56a9('0x71'),'%,'+_0x3dfd55+',%');});_0x2b1324=_[_0x56a9('0x72')](_0x2b1324,_0x5667e4);break;case _0x56a9('0x73'):if(_0x52ba21[_0x56a9('0x68')]===_0x56a9('0x69')){_0x31aaf5[_0x4a3cd3](_0x56a9('0x74'),'%'+_0x52ba21['value']+'%',null);}else{_0x52dc06=_[_0x56a9('0x62')](_0x1ba22e,[_0x56a9('0x2c'),_0x56a9('0x75')]);_0x52ba21[_0x56a9('0x47')]=_0x56a9('0x75');_0x57d1d9=as[_0x56a9('0x6d')](_0x1f905b,_0x52dc06[_0x56a9('0x38')],_0x52ba21);_0x31aaf5[_0x4a3cd3](_0x57d1d9[_0x56a9('0x6e')],_0x57d1d9[_0x56a9('0x64')][_0x56a9('0x6f')],_0x57d1d9['value'][_0x56a9('0x20')]);}break;case _0x56a9('0x76'):_0x57d1d9=as[_0x56a9('0x6d')]('me',null,_0x52ba21);_0x31aaf5[_0x4a3cd3](_0x57d1d9['text'],_0x57d1d9[_0x56a9('0x64')][_0x56a9('0x6f')],_0x57d1d9[_0x56a9('0x64')]['end']);break;}}else{var _0x57d1d9=as[_0x56a9('0x6d')](_0x1f905b,_0x52dc06[_0x56a9('0x38')],_0x52ba21);_0x31aaf5[_0x4a3cd3](_0x57d1d9[_0x56a9('0x6e')],_0x57d1d9[_0x56a9('0x64')][_0x56a9('0x6f')],_0x57d1d9['value'][_0x56a9('0x20')]);}}}else{var _0x52bc63=_(_0x134dfc[_0x56a9('0x3b')])[_0x56a9('0x3a')]()[_0x56a9('0x34')](function(_0x23ed84){return _[_0x56a9('0x77')](_0x1ba22e,['name',_0x23ed84])?_0x23ed84:undefined;})['compact']()['value']();if(!_[_0x56a9('0x78')](_0x52bc63)){_0x52bc63[_0x56a9('0x30')](function(_0x41ca05){if(_0x41ca05==='SmsAccountId'){_0x49e6a4[_0x56a9('0x44')]('i.SmsAccountId\x20IN\x20?',[][_0x56a9('0x79')](_0x134dfc[_0x56a9('0x3b')][_0x41ca05]));}else if(_0x41ca05===_0x56a9('0x7a')){var _0x5c114d=JSON['parse'](_0x134dfc[_0x56a9('0x3b')][_0x41ca05])[_0x56a9('0x7b')];var _0x46a834=JSON[_0x56a9('0x7c')](_0x134dfc[_0x56a9('0x3b')][_0x41ca05])[_0x56a9('0x7d')];_0x49e6a4['where'](_0x56a9('0x7e'),_0x5c114d,_0x46a834);}else{if(_0x134dfc[_0x56a9('0x3b')][_0x41ca05]===_0x56a9('0x7f')){_0x49e6a4['where']('i.'+_0x41ca05+'\x20IS\x20NULL');}else{_0x49e6a4['where']('i.'+_0x41ca05+'\x20=\x20?',_0x134dfc[_0x56a9('0x3b')][_0x41ca05]);}}});}if(_0x134dfc[_0x56a9('0x3b')]['read']){if(_0x134dfc[_0x56a9('0x3b')][_0x56a9('0x80')]==0x1){_0x49e6a4[_0x56a9('0x65')](_0x56a9('0x81'));}else{_0x49e6a4['having'](_0x56a9('0x82'));}}if(_0x134dfc[_0x56a9('0x3b')][_0x56a9('0x83')]){_0x2b1324=_[_0x56a9('0x84')](_0x134dfc[_0x56a9('0x3b')][_0x56a9('0x83')])?_0x134dfc[_0x56a9('0x3b')][_0x56a9('0x83')]:new Array(_0x134dfc[_0x56a9('0x3b')][_0x56a9('0x83')]);_0x2b1324[_0x56a9('0x30')](function(_0x1e3c64){_0x2c3794['or'](_0x56a9('0x71'),'%,'+_0x1e3c64+',%');});}if(_0x134dfc[_0x56a9('0x3b')][_0x56a9('0x85')]){var _0x4c8e31=_0x134dfc['query'][_0x56a9('0x85')]['replace']('\x5c','\x5c\x5c')[_0x56a9('0x86')]('\x27\x27',_0x56a9('0x87'));if(qs[_0x56a9('0x88')](_0x4c8e31)){_0x31aaf5['or']('i.id\x20LIKE\x20?',_0x4c8e31+'%')['or'](_0x56a9('0x89'),_0x4c8e31+'%');}else{_0x31aaf5['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x4c8e31))['or'](_0x56a9('0x8a'),_0x4c8e31+'%');}}}_0x49e6a4[_0x56a9('0x44')](_0x31aaf5);_0x49e6a4[_0x56a9('0x8b')](_0x56a9('0x8c'));var _0x500ddf={'type':db[_0x56a9('0x8d')][_0x56a9('0x8e')][_0x56a9('0x8f')],'raw':!![]};var _0x7321ab=_0x49e6a4['clone']();_0x7321ab['field']('i.id');_0x7321ab[_0x56a9('0x47')](_0x56a9('0x90'),_0x56a9('0x63'));if(_0x5473cb[_0x56a9('0x42')]){_0x5473cb[_0x56a9('0x42')][_0x56a9('0x30')](function(_0x106017){_0x49e6a4[_0x56a9('0x42')]('i.'+_0x106017[0x0],_0x106017[0x1]==='DESC'?![]:!![]);});}if(!_['isEmpty'](_0x2b1324)){_0x49e6a4['having'](_0x2c3794);_0x7321ab[_0x56a9('0x44')]('t.id\x20IN\x20?',_0x2b1324);}BPromise['resolve']()['then'](function(){if(!_0x500656){if(_0x134dfc['query'][_0x56a9('0x91')]||_0x134dfc[_0x56a9('0x3b')][_0x56a9('0x92')])return;_0x7321ab[_0x56a9('0x44')]('i.SmsAccountId\x20IS\x20NOT\x20NULL');_0x49e6a4[_0x56a9('0x44')](_0x56a9('0x93'));return;}return _0x134dfc[_0x56a9('0x94')][_0x56a9('0x95')]({'attributes':['id'],'raw':!![]})[_0x56a9('0x32')](function(_0x469bf6){if(_[_0x56a9('0x78')](_0x469bf6)){_0x7321ab[_0x56a9('0x44')](_0x56a9('0x96'));_0x49e6a4[_0x56a9('0x44')](_0x56a9('0x96'));}else{_0x7321ab[_0x56a9('0x44')](_0x56a9('0x97'),_['map'](_0x469bf6,'id'));_0x49e6a4['where']('i.SmsAccountId\x20IN\x20?',_['map'](_0x469bf6,'id'));}});})[_0x56a9('0x32')](function(){db[_0x56a9('0x98')]['query'](_0x7321ab[_0x56a9('0x99')](),_0x500ddf)[_0x56a9('0x32')](function(_0x2a39dd){_0x18d7d0[_0x56a9('0x21')]=_0x2a39dd[_0x56a9('0x61')];if(_0x18d7d0[_0x56a9('0x21')]===0x0)return[];return db['sequelize'][_0x56a9('0x3b')](_0x1f8b30['toString'](),_0x500ddf)[_0x56a9('0x32')](function(_0x296203){_0x5ce001=_[_0x56a9('0x9a')](_0x296203,'id');_0x500ddf=_['merge'](_0x500ddf,{'model':db[_0x56a9('0x35')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x134dfc[_0x56a9('0x3b')][_0x56a9('0x3f')]){_0x5473cb[_0x56a9('0x3e')][_0x56a9('0x30')](function(_0x3e37fa){_0x49e6a4['field']('i.'+_0x3e37fa);});}else{_0x49e6a4[_0x56a9('0x47')](_0x56a9('0x90'),_0x56a9('0x63'));_0x49e6a4[_0x56a9('0x47')](_0x56a9('0x9b'),'Account.key');_0x49e6a4[_0x56a9('0x47')](_0x56a9('0x9c'),_0x56a9('0x9d'));_0x49e6a4[_0x56a9('0x47')](_0x56a9('0x9e'));_0x49e6a4['field'](_0x56a9('0x9f'),_0x56a9('0xa0'));_0x49e6a4['field'](_0x56a9('0xa1'),_0x56a9('0xa2'));_0x49e6a4[_0x56a9('0x47')]('c.email',_0x56a9('0xa3'));_0x49e6a4[_0x56a9('0x47')](_0x56a9('0xa4'),_0x56a9('0xa5'));_0x49e6a4[_0x56a9('0x47')](_0x56a9('0xa6'),_0x56a9('0xa7'));_0x49e6a4[_0x56a9('0x47')](_0x56a9('0xa8'),_0x56a9('0xa9'));_0x49e6a4['field'](_0x56a9('0xaa'),_0x56a9('0xab'));_0x49e6a4[_0x56a9('0x47')](_0x56a9('0xac'),_0x56a9('0xad'));_0x49e6a4[_0x56a9('0x47')](_0x56a9('0xae'),'TagIds');}_0x49e6a4[_0x56a9('0x23')](_0x5473cb['limit']);_0x49e6a4[_0x56a9('0x22')](_0x5473cb[_0x56a9('0x22')]);return db[_0x56a9('0x98')][_0x56a9('0x3b')](_0x49e6a4[_0x56a9('0x99')](),_0x500ddf);})['then'](function(_0x4453b4){_0x4f541b['where'](_0x56a9('0xaf'),_[_0x56a9('0x34')](_0x4453b4,'id'));return db[_0x56a9('0x98')][_0x56a9('0x3b')](_0x4f541b[_0x56a9('0x99')](),_0x500ddf)[_0x56a9('0x32')](function(_0x2bd95a){var _0x26b133=_[_0x56a9('0xb0')](_0x2bd95a,_0x56a9('0xb1'));var _0x497222=[];_0x4453b4[_0x56a9('0x30')](function(_0x47fb34){_0x497222['push'](updateSmsInteraction(_0x47fb34,_0x5ce001,_0x26b133));});return BPromise[_0x56a9('0xb2')](_0x497222);});});})[_0x56a9('0x32')](function(_0x5a2080){_0x18d7d0[_0x56a9('0xb3')]=_0x5a2080;return _0x18d7d0;})[_0x56a9('0x32')](respondWithFilteredResult(_0x5914b5,_0x5473cb));})['catch'](handleError(_0x5914b5,null));};exports[_0x56a9('0xb4')]=function(_0x5eb05d,_0x2cf047){var _0x18fd5e={'raw':![],'where':{'id':_0x5eb05d[_0x56a9('0xb5')]['id']}},_0x5f5db6={};_0x5f5db6['model']=_[_0x56a9('0x3a')](db['SmsInteraction'][_0x56a9('0x36')]);_0x5f5db6[_0x56a9('0x3b')]=_[_0x56a9('0x3a')](_0x5eb05d[_0x56a9('0x3b')]);_0x5f5db6[_0x56a9('0x46')]=_['intersection'](_0x5f5db6[_0x56a9('0x3d')],_0x5f5db6[_0x56a9('0x3b')]);_0x18fd5e[_0x56a9('0x3e')]=_[_0x56a9('0x3c')](_0x5f5db6[_0x56a9('0x3d')],qs['fields'](_0x5eb05d[_0x56a9('0x3b')][_0x56a9('0x3f')]));_0x18fd5e[_0x56a9('0x3e')]=_0x18fd5e['attributes'][_0x56a9('0x61')]?_0x18fd5e[_0x56a9('0x3e')]:_0x5f5db6[_0x56a9('0x3d')];if(_0x5eb05d[_0x56a9('0x3b')]['includeAll']){_0x18fd5e['include']=[{'all':!![]}];}_0x18fd5e=_[_0x56a9('0xb6')]({},_0x18fd5e,_0x5eb05d[_0x56a9('0xb7')]);return db[_0x56a9('0x35')][_0x56a9('0x62')](_0x18fd5e)[_0x56a9('0x32')](handleEntityNotFound(_0x2cf047,null))[_0x56a9('0x32')](respondWithResult(_0x2cf047,null))[_0x56a9('0xb8')](handleError(_0x2cf047,null));};exports[_0x56a9('0xb9')]=function(_0x3a082d,_0x562a74){return db[_0x56a9('0x35')]['create'](_0x3a082d[_0x56a9('0x76')],{})[_0x56a9('0x32')](respondWithResult(_0x562a74,0xc9))[_0x56a9('0xb8')](handleError(_0x562a74,null));};exports[_0x56a9('0x28')]=function(_0x7153f5,_0x4d2bf5){if(_0x7153f5[_0x56a9('0x76')]['id']){delete _0x7153f5[_0x56a9('0x76')]['id'];}return db[_0x56a9('0x35')][_0x56a9('0x62')]({'where':{'id':_0x7153f5[_0x56a9('0xb5')]['id']}})[_0x56a9('0x32')](handleEntityNotFound(_0x4d2bf5,null))[_0x56a9('0x32')](saveUpdates(_0x7153f5['body'],null))[_0x56a9('0x32')](respondWithResult(_0x4d2bf5,null))[_0x56a9('0xb8')](handleError(_0x4d2bf5,null));};exports[_0x56a9('0x29')]=function(_0x1957b6,_0x17c62e){return db[_0x56a9('0x35')]['find']({'where':{'id':_0x1957b6[_0x56a9('0xb5')]['id']}})['then'](handleEntityNotFound(_0x17c62e,null))[_0x56a9('0x32')](removeEntity(_0x17c62e,null))[_0x56a9('0xb8')](handleError(_0x17c62e,null));};exports[_0x56a9('0xba')]=function(_0x581ebe,_0x38c70){return db[_0x56a9('0x35')][_0x56a9('0xba')]()[_0x56a9('0x32')](respondWithResult(_0x38c70,null))[_0x56a9('0xb8')](handleError(_0x38c70,null));};exports[_0x56a9('0xbb')]=function(_0x371e20,_0x54d046,_0x4fee66){return db[_0x56a9('0xbc')][_0x56a9('0x62')]({'where':{'id':_0x371e20['params']['id']}})[_0x56a9('0x32')](handleEntityNotFound(_0x54d046,null))[_0x56a9('0x32')](function(_0x14d54d){if(_0x14d54d){return _0x14d54d['addMessage'](_0x371e20[_0x56a9('0x76')]['ids'],_[_0x56a9('0xbd')](_0x371e20['body'],[_0x56a9('0xbe'),'id'])||{});}})[_0x56a9('0x32')](respondWithResult(_0x54d046,null))['catch'](handleError(_0x54d046,null));};exports[_0x56a9('0xbf')]=function(_0x41c07e,_0x11a6ab,_0xc803d2){var _0x474ae4={'raw':![],'where':{}};var _0x3fe3e9={};var _0x51f4e0={'count':0x0,'rows':[]};return db[_0x56a9('0x35')][_0x56a9('0xc0')]({'where':{'id':_0x41c07e[_0x56a9('0xb5')]['id']}})['then'](handleEntityNotFound(_0x11a6ab,null))[_0x56a9('0x32')](function(_0x22f222){if(_0x22f222){_0x3fe3e9[_0x56a9('0x3d')]=_[_0x56a9('0x3a')](db[_0x56a9('0xbc')][_0x56a9('0x36')]);_0x3fe3e9[_0x56a9('0x3b')]=_[_0x56a9('0x3a')](_0x41c07e[_0x56a9('0x3b')]);_0x3fe3e9['filters']=_[_0x56a9('0x3c')](_0x3fe3e9['model'],_0x3fe3e9[_0x56a9('0x3b')]);_0x474ae4[_0x56a9('0x3e')]=_[_0x56a9('0x3c')](_0x3fe3e9[_0x56a9('0x3d')],qs[_0x56a9('0x3f')](_0x41c07e['query'][_0x56a9('0x3f')]));_0x474ae4[_0x56a9('0x3e')]=_0x474ae4['attributes'][_0x56a9('0x61')]?_0x474ae4[_0x56a9('0x3e')]:_0x3fe3e9[_0x56a9('0x3d')];if(!_0x41c07e[_0x56a9('0x3b')]['hasOwnProperty'](_0x56a9('0x41'))){_0x474ae4['limit']=qs[_0x56a9('0x23')](_0x41c07e[_0x56a9('0x3b')][_0x56a9('0x23')]);_0x474ae4[_0x56a9('0x22')]=qs['offset'](_0x41c07e[_0x56a9('0x3b')][_0x56a9('0x22')]);}_0x474ae4[_0x56a9('0x42')]=qs['sort'](_0x41c07e[_0x56a9('0x3b')][_0x56a9('0x43')]);_0x474ae4[_0x56a9('0x44')]=qs['filters'](_['pick'](_0x41c07e[_0x56a9('0x3b')],_0x3fe3e9[_0x56a9('0x46')]));_0x474ae4['where'][_0x56a9('0xb1')]=_0x22f222['id'];if(_0x41c07e[_0x56a9('0x3b')][_0x56a9('0x85')]){_0x474ae4['where']=_[_0x56a9('0xb6')](_0x474ae4[_0x56a9('0x44')],{'$or':_[_0x56a9('0x34')](_0x474ae4[_0x56a9('0x3e')],function(_0x2d9e98){var _0xff2bfb={};_0xff2bfb[_0x2d9e98]={'$like':'%'+_0x41c07e[_0x56a9('0x3b')][_0x56a9('0x85')]+'%'};return _0xff2bfb;})});}if(_0x41c07e[_0x56a9('0x3b')][_0x56a9('0x7b')]){var _0x10eca5=_0x41c07e[_0x56a9('0x3b')][_0x56a9('0x7b')][_0x56a9('0x2f')](',');var _0x842c62={};_0x842c62[_0x10eca5[0x0]]={'$gte':moment(_0x10eca5[0x1])['format'](_0x56a9('0xc1'))};_0x474ae4[_0x56a9('0x44')]=_['merge'](_0x474ae4['where'],_0x842c62);}_0x474ae4=_[_0x56a9('0xb6')]({},_0x474ae4,_0x41c07e['options']);return db[_0x56a9('0xbc')][_0x56a9('0x21')]({'where':_0x474ae4['where']})[_0x56a9('0x32')](function(_0x5025a4){_0x51f4e0['count']=_0x5025a4;if(_0x41c07e[_0x56a9('0x3b')][_0x56a9('0xc2')]){_0x474ae4[_0x56a9('0xc3')]=[{'all':!![]}];}return db[_0x56a9('0xbc')][_0x56a9('0xc4')](_0x474ae4);})[_0x56a9('0x32')](function(_0xa16c9b){_0x51f4e0[_0x56a9('0xb3')]=_0xa16c9b;return _0x51f4e0;});}})[_0x56a9('0x32')](respondWithFilteredResult(_0x11a6ab,_0x474ae4))[_0x56a9('0xb8')](handleError(_0x11a6ab,null));};exports[_0x56a9('0xc5')]=function(_0xce980c,_0x28388a,_0x332380){return db[_0x56a9('0x35')]['find']({'where':{'id':_0xce980c[_0x56a9('0xb5')]['id']}})[_0x56a9('0x32')](handleEntityNotFound(_0x28388a,null))[_0x56a9('0x32')](function(_0x44b579){if(_0x44b579){return _0x44b579['setTags'](_0xce980c[_0x56a9('0x76')][_0x56a9('0xbe')],_[_0x56a9('0xbd')](_0xce980c[_0x56a9('0x76')],[_0x56a9('0xbe'),'id'])||{})['spread'](function(){return db[_0x56a9('0x70')][_0x56a9('0xc4')]({'attributes':['id',_0x56a9('0x2c'),_0x56a9('0x48')],'where':{'id':_0xce980c[_0x56a9('0x76')][_0x56a9('0xbe')]}});})[_0x56a9('0x32')](function(_0x56b8c3){socket['emit']('smsInteractionTags:save',{'id':Number(_0xce980c[_0x56a9('0xb5')]['id']),'tags':_0x56b8c3||[]});return{'id':Number(_0xce980c[_0x56a9('0xb5')]['id']),'tags':_0x56b8c3||[]};});}})['then'](respondWithResult(_0x28388a,null))[_0x56a9('0xb8')](handleError(_0x28388a,null));};exports['removeTags']=function(_0x5cb040,_0x216da3,_0x1e8a01){return db[_0x56a9('0x35')][_0x56a9('0x62')]({'where':{'id':_0x5cb040[_0x56a9('0xb5')]['id']}})[_0x56a9('0x32')](handleEntityNotFound(_0x216da3,null))[_0x56a9('0x32')](function(_0x1e586a){if(_0x1e586a){return _0x1e586a[_0x56a9('0xc6')](_0x5cb040[_0x56a9('0x3b')][_0x56a9('0xbe')]);}})[_0x56a9('0x32')](respondWithStatusCode(_0x216da3,null))[_0x56a9('0xb8')](handleError(_0x216da3,null));};exports[_0x56a9('0xc7')]=function(_0x1f54f0,_0x28b021){var _0xca0341=moment()[_0x56a9('0xc8')]()[_0x56a9('0x99')]();var _0x1d2d96=path[_0x56a9('0xc9')](config['root'],'server',_0x56a9('0xca'),_0x56a9('0xcb'));var _0x570eec=path[_0x56a9('0xc9')](config[_0x56a9('0xcc')],_0x56a9('0xcd'),'files','attachments');var _0x33cb31=path[_0x56a9('0xc9')](_0x1d2d96,_0xca0341);var _0xb16d5f=util[_0x56a9('0xce')](_0x56a9('0xcf'),_0x1f54f0[_0x56a9('0xb5')]['id'],_0xca0341);var _0x93f849=path[_0x56a9('0xc9')](_0x1d2d96,_0xb16d5f);var _0x5c6232=[];_0x5c6232[_0x56a9('0x31')]({'model':db[_0x56a9('0x73')],'as':_0x56a9('0x73'),'attributes':['id',_0x56a9('0xd0')],'raw':!![]});_0x5c6232[_0x56a9('0x31')]({'model':db['CmContact'],'as':_0x56a9('0x67'),'attributes':['id',_0x56a9('0xd1'),_0x56a9('0xd2')],'raw':!![]});var _0x83f4bc=[{'model':db[_0x56a9('0xbc')],'as':_0x56a9('0xd3'),'attributes':['id',_0x56a9('0x76'),_0x56a9('0x7a'),_0x56a9('0xd4'),_0x56a9('0xd5'),_0x56a9('0x80')],'include':_0x5c6232}];_0x83f4bc['push']({'model':db[_0x56a9('0xd6')],'as':'Account','attributes':['id',_0x56a9('0x2c')]});_0x83f4bc[_0x56a9('0x31')]({'model':db['User'],'as':_0x56a9('0xd7'),'attributes':['id','fullname']});return db['SmsInteraction'][_0x56a9('0x62')]({'where':{'id':_0x1f54f0['params']['id']},'include':_0x83f4bc})['then'](handleEntityNotFound(_0x28b021,null))[_0x56a9('0x32')](function(_0x493d19){if(_0x493d19){var _0x5790fc=_0x493d19[_0x56a9('0xd8')]({'plain':!![]});fs[_0x56a9('0xd9')](_0x33cb31);var _0x30d844={'format':'A4','border':_0x56a9('0xda'),'header':{'height':_0x56a9('0xdb'),'contents':{'first':_0x56a9('0xdc')}},'footer':{'height':'30px','contents':{'default':util[_0x56a9('0xce')](_0x56a9('0xdd'),util['format'](_0x56a9('0xde'),'Sms',_0x5790fc['id']),moment()['format']('YYYY-MM-DD')['toString']())}}};var _0x2fb76a={'channel':'Sms','account':_0x5790fc[_0x56a9('0xdf')][_0x56a9('0x2c')],'agent':_0x5790fc[_0x56a9('0xd7')]?_0x5790fc['Owner'][_0x56a9('0xd0')]:_0x56a9('0xe0'),'createdAt':moment(_0x5790fc[_0x56a9('0x7a')])['format'](_0x56a9('0xc1'))[_0x56a9('0x99')](),'closedAt':_0x5790fc[_0x56a9('0xe1')]?moment(_0x5790fc[_0x56a9('0xe2')])[_0x56a9('0xce')](_0x56a9('0xc1'))[_0x56a9('0x99')]():'','disposition':_0x5790fc[_0x56a9('0xe3')],'messages':_(_0x5790fc[_0x56a9('0xd3')])[_0x56a9('0x85')]({'secret':![]})[_0x56a9('0x34')](function(_0x3026fe){return{'date':moment(_0x3026fe[_0x56a9('0x7a')])['format'](_0x56a9('0xc1'))[_0x56a9('0x99')](),'sender':_0x3026fe[_0x56a9('0xd4')]===_0x56a9('0xe4')?_0x3026fe[_0x56a9('0x73')]?_0x3026fe[_0x56a9('0x73')][_0x56a9('0xd0')]:_0x56a9('0xe5'):_0x3026fe[_0x56a9('0x67')][_0x56a9('0xd1')]+(_0x3026fe[_0x56a9('0x67')]['lastName']?'\x20'+_0x3026fe[_0x56a9('0x67')][_0x56a9('0xd2')]:''),'body':_0x3026fe[_0x56a9('0x76')],'direction':_0x3026fe[_0x56a9('0xd4')]===_0x56a9('0xe4')?'A':'C','secret':_0x3026fe[_0x56a9('0xd5')],'read':_0x3026fe['read']};})['value']()};return ejs[_0x56a9('0xe6')](path['join'](config['root'],_0x56a9('0xcd'),_0x56a9('0xe7'),_0x56a9('0xe8')),{'interaction':_0x2fb76a})[_0x56a9('0x32')](function(_0x30ee7b){return new BPromise(function(_0x4c6583,_0x559542){pdf[_0x56a9('0xb9')](_0x30ee7b,_0x30d844)[_0x56a9('0xe9')](path['join'](_0x33cb31,_0x56a9('0xea')+_0x5790fc['id']+'-'+_0xca0341+_0x56a9('0xeb')),function(_0x884fa1,_0x1ab213){if(_0x884fa1)return _0x559542(_0x884fa1);_0x4c6583(_0x1ab213);});});})[_0x56a9('0x32')](function(){return new BPromise(function(_0x1ae51e,_0x83ee4c){zipdir(_0x33cb31,{'saveTo':_0x93f849},function(_0x2c4bb1,_0x32b972){if(_0x2c4bb1)return _0x83ee4c(_0x2c4bb1);return _0x1ae51e(_0x32b972);});})[_0x56a9('0x32')](function(){return new BPromise(function(_0x4aad76,_0xa80c04){rimraf(_0x33cb31,function(_0x4db636){if(_0x4db636)_0xa80c04(_0x4db636);return _0x4aad76();});});})[_0x56a9('0x32')](function(){return _0x28b021[_0x56a9('0xc7')](_0x93f849,_0xb16d5f,function(_0x43db44){if(_0x43db44){console[_0x56a9('0xec')](_0x56a9('0xed'),_0x43db44);}else{fs[_0x56a9('0xee')](_0x93f849);}});});});}else{return _0x28b021[_0x56a9('0xef')](0xc8);}})[_0x56a9('0xb8')](handleError(_0x28b021,null));}; \ No newline at end of file +var _0x7a54=['spread','emit','removeTags','download','unix','root','files','join','attachments','transcript-%d-%s.zip','User','CmContact','lastName','Messages','direction','secret','Account','Owner','get','30px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','YYYY-MM-DD','N.A.','closed','closedAt','disposition','out','System','firstName','views','downloadInteraction.html','toFile','transcript-','.pdf','log','err','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./smsInteraction.socket','register','sendStatus','end','status','count','offset','limit','set','json','apply','reject','update','destroy','then','error','stack','name','send','Users','map','fullname','TagIds','Tags','split','push','catch','index','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filters','select','color','tools_tags','u.id','field','ui.SmsInteractionId','user_has_sms_interactions','left_join','users','u.id\x20=\x20ui.UserId','from','sms_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','sms_accounts','sms_messages','sms_interaction_has_tags','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','value','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','text','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','UserId','buildExpression','start','body','isEmpty','SmsAccountId','i.SmsAccountId\x20IN\x20?','concat','createdAt','$gte','parse','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','filter','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','forEach','DESC','t.id\x20IN\x20?','resolve','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','i.SmsAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','Account.key','Account.mandatoryDisposition','i.*','c.firstName','c.lastName','Contact.lastName','c.email','Contact.email','Contact.phone','c.mobile','c.fax','Contact.fax','Owner.fullname','o.internal','Owner.internal','ui.SmsInteractionId\x20IN\x20?','groupBy','SmsInteractionId','rows','show','params','includeAll','include','options','SmsInteraction','create','describe','addMessage','SmsMessage','ids','omit','getMessages','findOne','nolimit','format','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','setTags'];(function(_0x24f31b,_0x44b8f3){var _0x488401=function(_0x204caf){while(--_0x204caf){_0x24f31b['push'](_0x24f31b['shift']());}};_0x488401(++_0x44b8f3);}(_0x7a54,0x106));var _0x47a5=function(_0x4af9f4,_0x282f8c){_0x4af9f4=_0x4af9f4-0x0;var _0x4eac62=_0x7a54[_0x4af9f4];return _0x4eac62;};'use strict';var pdf=require(_0x47a5('0x0'));var emlformat=require(_0x47a5('0x1'));var rimraf=require(_0x47a5('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x47a5('0x3'));var rp=require(_0x47a5('0x4'));var moment=require('moment');var BPromise=require(_0x47a5('0x5'));var Mustache=require(_0x47a5('0x6'));var util=require(_0x47a5('0x7'));var path=require(_0x47a5('0x8'));var sox=require(_0x47a5('0x9'));var csv=require('to-csv');var ejs=require(_0x47a5('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var db=require(_0x47a5('0x14'))['db'];config[_0x47a5('0x15')]=_[_0x47a5('0x16')](config[_0x47a5('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0x47a5('0x17'))(new Redis(config[_0x47a5('0x15')]));require(_0x47a5('0x18'))[_0x47a5('0x19')](socket);function respondWithStatusCode(_0x139f25,_0x620ee9){_0x620ee9=_0x620ee9||0xcc;return function(_0x3c6c46){if(_0x3c6c46){return _0x139f25[_0x47a5('0x1a')](_0x620ee9);}return _0x139f25['status'](_0x620ee9)[_0x47a5('0x1b')]();};}function respondWithResult(_0x11faf5,_0x3b001e){_0x3b001e=_0x3b001e||0xc8;return function(_0x2a2cbb){if(_0x2a2cbb){return _0x11faf5[_0x47a5('0x1c')](_0x3b001e)['json'](_0x2a2cbb);}};}function respondWithFilteredResult(_0x549de3,_0x138bc0){return function(_0x4b966e){if(_0x4b966e){var _0x5247fd=_0x4b966e[_0x47a5('0x1d')],_0x423a81=_0x138bc0[_0x47a5('0x1e')],_0xaf70a6=_0x138bc0[_0x47a5('0x1e')]+_0x138bc0[_0x47a5('0x1f')],_0x2ce454;if(_0xaf70a6>=_0x5247fd){_0xaf70a6=_0x5247fd;_0x2ce454=0xc8;}else{_0x2ce454=0xce;}_0x549de3[_0x47a5('0x1c')](_0x2ce454);return _0x549de3[_0x47a5('0x20')]('Content-Range',_0x423a81+'-'+_0xaf70a6+'/'+_0x5247fd)[_0x47a5('0x21')](_0x4b966e);}return null;};}function patchUpdates(_0xf160ba){return function(_0x47cf3c){try{jsonpatch[_0x47a5('0x22')](_0x47cf3c,_0xf160ba,!![]);}catch(_0x1f03f7){return BPromise[_0x47a5('0x23')](_0x1f03f7);}return _0x47cf3c['save']();};}function saveUpdates(_0xb8ae6c,_0x2f142b){return function(_0x23db32){if(_0x23db32){return _0x23db32[_0x47a5('0x24')](_0xb8ae6c)['then'](function(_0xe2dea9){return _0xe2dea9;});}return null;};}function removeEntity(_0x385687,_0x513981){return function(_0x28747d){if(_0x28747d){return _0x28747d[_0x47a5('0x25')]()[_0x47a5('0x26')](function(){_0x385687[_0x47a5('0x1c')](0xcc)[_0x47a5('0x1b')]();});}};}function handleEntityNotFound(_0x50bf17,_0x53078a){return function(_0x136745){if(!_0x136745){_0x50bf17['sendStatus'](0x194);}return _0x136745;};}function handleError(_0x1ea9c8,_0x5b6c4e){_0x5b6c4e=_0x5b6c4e||0x1f4;return function(_0x23cb77){logger[_0x47a5('0x27')](_0x23cb77[_0x47a5('0x28')]);if(_0x23cb77[_0x47a5('0x29')]){delete _0x23cb77[_0x47a5('0x29')];}_0x1ea9c8[_0x47a5('0x1c')](_0x5b6c4e)[_0x47a5('0x2a')](_0x23cb77);};}function getInteractionUsers(_0x136b14,_0x16631f){return new BPromise(function(_0x361bfa,_0x1127f8){try{if(_0x16631f[_0x136b14['id']]){_0x136b14[_0x47a5('0x2b')]=_[_0x47a5('0x2c')](_0x16631f[_0x136b14['id']],function(_0x528582){return{'id':_0x528582['id'],'fullname':_0x528582[_0x47a5('0x2d')]};});}}catch(_0x51833b){_0x1127f8(_0x51833b);}_0x361bfa(_0x136b14);});}function getInteractionTags(_0x2ef875,_0x9ac908){return new BPromise(function(_0x16901f,_0x4d6b57){try{if(_0x2ef875[_0x47a5('0x2e')]){_0x2ef875[_0x47a5('0x2f')]=[];_0x2ef875[_0x47a5('0x2e')][_0x47a5('0x30')](',')['forEach'](function(_0x50d875){_0x2ef875[_0x47a5('0x2f')][_0x47a5('0x31')](_0x9ac908[_0x50d875]);});}delete _0x2ef875['TagIds'];}catch(_0x4e1006){_0x4d6b57(_0x4e1006);}_0x16901f(_0x2ef875);});}function updateSmsInteraction(_0x836303,_0x51544e,_0x57bff6){return new BPromise(function(_0x42f70c,_0x53119b){return getInteractionUsers(_0x836303,_0x57bff6)[_0x47a5('0x26')](function(_0xd972c){return getInteractionTags(_0xd972c,_0x51544e);})['then'](function(_0x4843c0){_0x42f70c(_0x4843c0);})[_0x47a5('0x32')](function(_0x5910bb){_0x53119b(_0x5910bb);});});}exports[_0x47a5('0x33')]=function(_0x87e4c9,_0xf269a8){var _0x52749b={},_0x18f7e9={},_0x50c086={'count':0x0,'rows':[]};var _0x53c754=_[_0x47a5('0x2c')](db['SmsInteraction'][_0x47a5('0x34')],function(_0x5ef577){return{'name':_0x5ef577[_0x47a5('0x35')],'type':_0x5ef577[_0x47a5('0x36')][_0x47a5('0x37')]};});_0x18f7e9[_0x47a5('0x38')]=_[_0x47a5('0x2c')](_0x53c754,_0x47a5('0x29'));_0x18f7e9[_0x47a5('0x39')]=_[_0x47a5('0x3a')](_0x87e4c9[_0x47a5('0x39')]);_0x18f7e9['filters']=_[_0x47a5('0x3b')](_0x18f7e9[_0x47a5('0x38')],_0x18f7e9['query']);_0x52749b[_0x47a5('0x3c')]=_[_0x47a5('0x3b')](_0x18f7e9[_0x47a5('0x38')],qs['fields'](_0x87e4c9[_0x47a5('0x39')][_0x47a5('0x3d')]));_0x52749b['attributes']=_0x52749b[_0x47a5('0x3c')][_0x47a5('0x3e')]?_0x52749b['attributes']:_0x18f7e9['model'];if(!_0x87e4c9['query'][_0x47a5('0x3f')]('nolimit')){_0x52749b[_0x47a5('0x1f')]=qs[_0x47a5('0x1f')](_0x87e4c9[_0x47a5('0x39')][_0x47a5('0x1f')]);_0x52749b[_0x47a5('0x1e')]=qs[_0x47a5('0x1e')](_0x87e4c9[_0x47a5('0x39')][_0x47a5('0x1e')]);}_0x52749b[_0x47a5('0x40')]=qs[_0x47a5('0x41')](_0x87e4c9[_0x47a5('0x39')][_0x47a5('0x41')]);_0x52749b[_0x47a5('0x42')]=qs['filters'](_[_0x47a5('0x43')](_0x87e4c9[_0x47a5('0x39')],_0x18f7e9[_0x47a5('0x44')]));var _0x23bd8d=[];var _0x586f4f=squel[_0x47a5('0x45')]()['field']('id')['field']('name')['field'](_0x47a5('0x46'))['from'](_0x47a5('0x47'));var _0x3a740b=squel[_0x47a5('0x45')]()['field'](_0x47a5('0x48'))[_0x47a5('0x49')]('u.fullname')['field'](_0x47a5('0x4a'))['from'](_0x47a5('0x4b'),'ui')[_0x47a5('0x4c')](_0x47a5('0x4d'),'u',_0x47a5('0x4e'));var _0x34a9ae=squel[_0x47a5('0x45')]()[_0x47a5('0x4f')](_0x47a5('0x50'),'i')[_0x47a5('0x4c')](_0x47a5('0x51'),'c',_0x47a5('0x52'))[_0x47a5('0x4c')](_0x47a5('0x4d'),'o',_0x47a5('0x53'))[_0x47a5('0x4c')](_0x47a5('0x54'),'a','a.id\x20=\x20i.SmsAccountId')[_0x47a5('0x4c')](_0x47a5('0x55'),'me','me.SmsInteractionId\x20=\x20i.id')['left_join'](_0x47a5('0x56'),'it','it.SmsInteractionId\x20=\x20i.id')[_0x47a5('0x4c')](_0x47a5('0x47'),'t','t.id\x20=\x20it.TagId');var _0x4f62d3=squel[_0x47a5('0x57')]();var _0x52d409=[];var _0x2d147c=squel[_0x47a5('0x57')]();var _0x3548bc;if(_0x87e4c9[_0x47a5('0x39')][_0x47a5('0x58')]){_0x3548bc=as[_0x47a5('0x59')](_0x87e4c9[_0x47a5('0x39')]['search']);var _0x48a0ef=_0x3548bc[_0x47a5('0x5a')];for(var _0x411230=0x0;_0x411230<_0x3548bc[_0x47a5('0x5b')][_0x47a5('0x3e')];_0x411230++){var _0x2c7020=_0x3548bc[_0x47a5('0x5b')][_0x411230];var _0x249de5='i';var _0x492cf7=_[_0x47a5('0x5c')](_0x53c754,[_0x47a5('0x29'),_0x2c7020[_0x47a5('0x49')]]);if(!_0x492cf7){switch(_0x2c7020['field']){case _0x47a5('0x5d'):if(_0x2c7020['value']==0x1){_0x34a9ae[_0x47a5('0x5e')]('`'+_0x2c7020[_0x47a5('0x49')]+_0x47a5('0x5f'));}else{_0x34a9ae[_0x47a5('0x5e')]('`'+_0x2c7020['field']+_0x47a5('0x60'));}break;case _0x47a5('0x61'):if(_0x2c7020[_0x47a5('0x62')]===_0x47a5('0x63')){if(_0x2c7020[_0x47a5('0x64')][_0x47a5('0x30')]('\x20')[_0x47a5('0x3e')]>0x1){_0x4f62d3[_0x48a0ef]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x47a5('0x65')](_0x2c7020[_0x47a5('0x64')]),null);}else{var _0x187d7e='%'+_0x2c7020[_0x47a5('0x64')]+'%';_0x4f62d3[_0x48a0ef](_0x47a5('0x66'),_0x187d7e,_0x187d7e,_0x187d7e);}}else{_0x492cf7=_[_0x47a5('0x5c')](_0x53c754,['name',_0x47a5('0x67')]);_0x2c7020[_0x47a5('0x49')]=_0x47a5('0x67');_0x5cbe97=as['buildExpression'](_0x249de5,_0x492cf7[_0x47a5('0x36')],_0x2c7020);_0x4f62d3[_0x48a0ef](_0x5cbe97[_0x47a5('0x68')],_0x5cbe97[_0x47a5('0x64')]['start'],_0x5cbe97['value'][_0x47a5('0x1b')]);}break;case _0x47a5('0x69'):var _0x4fa1da=_0x2c7020['value'][_0x47a5('0x30')](',')['map'](function(_0x16bb8a){return Number(_0x16bb8a);});_0x4fa1da['forEach'](function(_0x482de6){_0x2d147c['or'](_0x47a5('0x6a'),'%,'+_0x482de6+',%');});_0x52d409=_[_0x47a5('0x6b')](_0x52d409,_0x4fa1da);break;case'User':if(_0x2c7020[_0x47a5('0x62')]===_0x47a5('0x63')){_0x4f62d3[_0x48a0ef]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x2c7020['value']+'%',null);}else{_0x492cf7=_[_0x47a5('0x5c')](_0x53c754,[_0x47a5('0x29'),_0x47a5('0x6c')]);_0x2c7020[_0x47a5('0x49')]='UserId';_0x5cbe97=as[_0x47a5('0x6d')](_0x249de5,_0x492cf7[_0x47a5('0x36')],_0x2c7020);_0x4f62d3[_0x48a0ef](_0x5cbe97[_0x47a5('0x68')],_0x5cbe97['value'][_0x47a5('0x6e')],_0x5cbe97['value'][_0x47a5('0x1b')]);}break;case _0x47a5('0x6f'):_0x5cbe97=as[_0x47a5('0x6d')]('me',null,_0x2c7020);_0x4f62d3[_0x48a0ef](_0x5cbe97[_0x47a5('0x68')],_0x5cbe97[_0x47a5('0x64')]['start'],_0x5cbe97[_0x47a5('0x64')]['end']);break;}}else{var _0x5cbe97=as['buildExpression'](_0x249de5,_0x492cf7['type'],_0x2c7020);_0x4f62d3[_0x48a0ef](_0x5cbe97[_0x47a5('0x68')],_0x5cbe97[_0x47a5('0x64')][_0x47a5('0x6e')],_0x5cbe97['value']['end']);}}}else{var _0x139229=_(_0x87e4c9[_0x47a5('0x39')])[_0x47a5('0x3a')]()[_0x47a5('0x2c')](function(_0xc45e25){return _['some'](_0x53c754,[_0x47a5('0x29'),_0xc45e25])?_0xc45e25:undefined;})['compact']()[_0x47a5('0x64')]();if(!_[_0x47a5('0x70')](_0x139229)){_0x139229['forEach'](function(_0x32b4de){if(_0x32b4de===_0x47a5('0x71')){_0x34a9ae[_0x47a5('0x42')](_0x47a5('0x72'),[][_0x47a5('0x73')](_0x87e4c9[_0x47a5('0x39')][_0x32b4de]));}else if(_0x32b4de===_0x47a5('0x74')){var _0x3ac38c=JSON['parse'](_0x87e4c9[_0x47a5('0x39')][_0x32b4de])[_0x47a5('0x75')];var _0x3c75c6=JSON[_0x47a5('0x76')](_0x87e4c9[_0x47a5('0x39')][_0x32b4de])['$lte'];_0x34a9ae[_0x47a5('0x42')](_0x47a5('0x77'),_0x3ac38c,_0x3c75c6);}else{if(_0x87e4c9[_0x47a5('0x39')][_0x32b4de]===_0x47a5('0x78')){_0x34a9ae[_0x47a5('0x42')]('i.'+_0x32b4de+_0x47a5('0x79'));}else{_0x34a9ae[_0x47a5('0x42')]('i.'+_0x32b4de+_0x47a5('0x7a'),_0x87e4c9[_0x47a5('0x39')][_0x32b4de]);}}});}if(_0x87e4c9[_0x47a5('0x39')][_0x47a5('0x7b')]){if(_0x87e4c9[_0x47a5('0x39')][_0x47a5('0x7b')]==0x1){_0x34a9ae[_0x47a5('0x5e')](_0x47a5('0x7c'));}else{_0x34a9ae['having'](_0x47a5('0x7d'));}}if(_0x87e4c9[_0x47a5('0x39')][_0x47a5('0x7e')]){_0x52d409=_['isArray'](_0x87e4c9[_0x47a5('0x39')][_0x47a5('0x7e')])?_0x87e4c9[_0x47a5('0x39')][_0x47a5('0x7e')]:new Array(_0x87e4c9['query'][_0x47a5('0x7e')]);_0x52d409['forEach'](function(_0x2d5ee6){_0x2d147c['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x2d5ee6+',%');});}if(_0x87e4c9[_0x47a5('0x39')]['filter']){var _0x7c1190=_0x87e4c9[_0x47a5('0x39')][_0x47a5('0x7f')]['replace']('\x5c','\x5c\x5c')['replace']('\x27\x27','\x27\x27\x27\x27');if(qs[_0x47a5('0x80')](_0x7c1190)){_0x4f62d3['or'](_0x47a5('0x81'),_0x7c1190+'%')['or'](_0x47a5('0x82'),_0x7c1190+'%');}else{_0x4f62d3['or'](_0x47a5('0x83'),qs['getFullTextValue'](_0x7c1190))['or'](_0x47a5('0x84'),_0x7c1190+'%');}}}_0x34a9ae[_0x47a5('0x42')](_0x4f62d3);_0x34a9ae[_0x47a5('0x85')](_0x47a5('0x86'));var _0x308c9a={'type':db[_0x47a5('0x87')][_0x47a5('0x88')][_0x47a5('0x89')],'raw':!![]};var _0x4618a0=_0x34a9ae[_0x47a5('0x8a')]();_0x4618a0[_0x47a5('0x49')](_0x47a5('0x86'));_0x4618a0['field'](_0x47a5('0x8b'),'unreadMessages');if(_0x52749b[_0x47a5('0x40')]){_0x52749b[_0x47a5('0x40')][_0x47a5('0x8c')](function(_0x12fec9){_0x34a9ae[_0x47a5('0x40')]('i.'+_0x12fec9[0x0],_0x12fec9[0x1]===_0x47a5('0x8d')?![]:!![]);});}if(!_[_0x47a5('0x70')](_0x52d409)){_0x34a9ae[_0x47a5('0x5e')](_0x2d147c);_0x4618a0[_0x47a5('0x42')](_0x47a5('0x8e'),_0x52d409);}BPromise[_0x47a5('0x8f')]()[_0x47a5('0x26')](function(){if(!_0x3548bc){if(_0x87e4c9[_0x47a5('0x39')][_0x47a5('0x71')]||_0x87e4c9[_0x47a5('0x39')]['journey'])return;_0x4618a0['where']('i.SmsAccountId\x20IS\x20NOT\x20NULL');_0x34a9ae['where'](_0x47a5('0x90'));return;}return _0x87e4c9[_0x47a5('0x91')]['getSmsAccounts']({'attributes':['id'],'raw':!![]})[_0x47a5('0x26')](function(_0x44dda2){if(_[_0x47a5('0x70')](_0x44dda2)){_0x4618a0[_0x47a5('0x42')](_0x47a5('0x92'));_0x34a9ae[_0x47a5('0x42')](_0x47a5('0x92'));}else{_0x4618a0[_0x47a5('0x42')](_0x47a5('0x72'),_[_0x47a5('0x2c')](_0x44dda2,'id'));_0x34a9ae[_0x47a5('0x42')]('i.SmsAccountId\x20IN\x20?',_[_0x47a5('0x2c')](_0x44dda2,'id'));}});})[_0x47a5('0x26')](function(){db[_0x47a5('0x93')]['query'](_0x4618a0[_0x47a5('0x94')](),_0x308c9a)[_0x47a5('0x26')](function(_0x17b61d){_0x50c086['count']=_0x17b61d[_0x47a5('0x3e')];if(_0x50c086['count']===0x0)return[];return db['sequelize'][_0x47a5('0x39')](_0x586f4f[_0x47a5('0x94')](),_0x308c9a)[_0x47a5('0x26')](function(_0x27333e){_0x23bd8d=_[_0x47a5('0x95')](_0x27333e,'id');_0x308c9a=_[_0x47a5('0x96')](_0x308c9a,{'model':db['SmsInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x87e4c9['query'][_0x47a5('0x3d')]){_0x52749b['attributes'][_0x47a5('0x8c')](function(_0x3fffd1){_0x34a9ae[_0x47a5('0x49')]('i.'+_0x3fffd1);});}else{_0x34a9ae[_0x47a5('0x49')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x47a5('0x5d'));_0x34a9ae['field']('a.key',_0x47a5('0x97'));_0x34a9ae[_0x47a5('0x49')]('a.mandatoryDisposition',_0x47a5('0x98'));_0x34a9ae[_0x47a5('0x49')](_0x47a5('0x99'));_0x34a9ae['field'](_0x47a5('0x9a'),'Contact.firstName');_0x34a9ae[_0x47a5('0x49')](_0x47a5('0x9b'),_0x47a5('0x9c'));_0x34a9ae['field'](_0x47a5('0x9d'),_0x47a5('0x9e'));_0x34a9ae[_0x47a5('0x49')]('c.phone',_0x47a5('0x9f'));_0x34a9ae['field'](_0x47a5('0xa0'),'Contact.mobile');_0x34a9ae[_0x47a5('0x49')](_0x47a5('0xa1'),_0x47a5('0xa2'));_0x34a9ae[_0x47a5('0x49')]('o.fullname',_0x47a5('0xa3'));_0x34a9ae[_0x47a5('0x49')](_0x47a5('0xa4'),_0x47a5('0xa5'));_0x34a9ae[_0x47a5('0x49')]('GROUP_CONCAT(DISTINCT\x20t.id)','TagIds');}_0x34a9ae[_0x47a5('0x1f')](_0x52749b['limit']);_0x34a9ae[_0x47a5('0x1e')](_0x52749b[_0x47a5('0x1e')]);return db[_0x47a5('0x93')]['query'](_0x34a9ae[_0x47a5('0x94')](),_0x308c9a);})[_0x47a5('0x26')](function(_0x565fbe){_0x3a740b[_0x47a5('0x42')](_0x47a5('0xa6'),_[_0x47a5('0x2c')](_0x565fbe,'id'));return db[_0x47a5('0x93')]['query'](_0x3a740b['toString'](),_0x308c9a)[_0x47a5('0x26')](function(_0x263046){var _0x48e7f3=_[_0x47a5('0xa7')](_0x263046,_0x47a5('0xa8'));var _0x5a0901=[];_0x565fbe[_0x47a5('0x8c')](function(_0x2a02cd){_0x5a0901[_0x47a5('0x31')](updateSmsInteraction(_0x2a02cd,_0x23bd8d,_0x48e7f3));});return BPromise['all'](_0x5a0901);});});})[_0x47a5('0x26')](function(_0x59b4a5){_0x50c086[_0x47a5('0xa9')]=_0x59b4a5;return _0x50c086;})['then'](respondWithFilteredResult(_0xf269a8,_0x52749b));})[_0x47a5('0x32')](handleError(_0xf269a8,null));};exports[_0x47a5('0xaa')]=function(_0x4995be,_0x35d9f0){var _0x597cb2={'raw':![],'where':{'id':_0x4995be[_0x47a5('0xab')]['id']}},_0x1eabef={};_0x1eabef[_0x47a5('0x38')]=_[_0x47a5('0x3a')](db['SmsInteraction'][_0x47a5('0x34')]);_0x1eabef['query']=_['keys'](_0x4995be[_0x47a5('0x39')]);_0x1eabef[_0x47a5('0x44')]=_[_0x47a5('0x3b')](_0x1eabef[_0x47a5('0x38')],_0x1eabef[_0x47a5('0x39')]);_0x597cb2['attributes']=_[_0x47a5('0x3b')](_0x1eabef[_0x47a5('0x38')],qs[_0x47a5('0x3d')](_0x4995be[_0x47a5('0x39')]['fields']));_0x597cb2[_0x47a5('0x3c')]=_0x597cb2['attributes'][_0x47a5('0x3e')]?_0x597cb2[_0x47a5('0x3c')]:_0x1eabef[_0x47a5('0x38')];if(_0x4995be[_0x47a5('0x39')][_0x47a5('0xac')]){_0x597cb2[_0x47a5('0xad')]=[{'all':!![]}];}_0x597cb2=_[_0x47a5('0x96')]({},_0x597cb2,_0x4995be[_0x47a5('0xae')]);return db[_0x47a5('0xaf')]['find'](_0x597cb2)[_0x47a5('0x26')](handleEntityNotFound(_0x35d9f0,null))[_0x47a5('0x26')](respondWithResult(_0x35d9f0,null))['catch'](handleError(_0x35d9f0,null));};exports[_0x47a5('0xb0')]=function(_0x32035e,_0x6d6a5){return db['SmsInteraction']['create'](_0x32035e[_0x47a5('0x6f')],{})[_0x47a5('0x26')](respondWithResult(_0x6d6a5,0xc9))['catch'](handleError(_0x6d6a5,null));};exports['update']=function(_0x91aa99,_0x17f82d){if(_0x91aa99['body']['id']){delete _0x91aa99[_0x47a5('0x6f')]['id'];}return db[_0x47a5('0xaf')]['find']({'where':{'id':_0x91aa99[_0x47a5('0xab')]['id']}})[_0x47a5('0x26')](handleEntityNotFound(_0x17f82d,null))[_0x47a5('0x26')](saveUpdates(_0x91aa99[_0x47a5('0x6f')],null))[_0x47a5('0x26')](respondWithResult(_0x17f82d,null))[_0x47a5('0x32')](handleError(_0x17f82d,null));};exports['destroy']=function(_0x4c9894,_0x5bd86e){return db[_0x47a5('0xaf')][_0x47a5('0x5c')]({'where':{'id':_0x4c9894['params']['id']}})[_0x47a5('0x26')](handleEntityNotFound(_0x5bd86e,null))[_0x47a5('0x26')](removeEntity(_0x5bd86e,null))[_0x47a5('0x32')](handleError(_0x5bd86e,null));};exports[_0x47a5('0xb1')]=function(_0xcdbfd7,_0x5084d6){return db[_0x47a5('0xaf')]['describe']()['then'](respondWithResult(_0x5084d6,null))['catch'](handleError(_0x5084d6,null));};exports[_0x47a5('0xb2')]=function(_0x4d23c8,_0xe5fbf8,_0xf3edc8){return db[_0x47a5('0xb3')]['find']({'where':{'id':_0x4d23c8[_0x47a5('0xab')]['id']}})[_0x47a5('0x26')](handleEntityNotFound(_0xe5fbf8,null))[_0x47a5('0x26')](function(_0x121750){if(_0x121750){return _0x121750[_0x47a5('0xb2')](_0x4d23c8['body'][_0x47a5('0xb4')],_[_0x47a5('0xb5')](_0x4d23c8['body'],[_0x47a5('0xb4'),'id'])||{});}})[_0x47a5('0x26')](respondWithResult(_0xe5fbf8,null))[_0x47a5('0x32')](handleError(_0xe5fbf8,null));};exports[_0x47a5('0xb6')]=function(_0x3c117a,_0x186aad,_0x5112d7){var _0x6a8174={'raw':![],'where':{}};var _0x2e418d={};var _0x50b236={'count':0x0,'rows':[]};return db[_0x47a5('0xaf')][_0x47a5('0xb7')]({'where':{'id':_0x3c117a[_0x47a5('0xab')]['id']}})[_0x47a5('0x26')](handleEntityNotFound(_0x186aad,null))['then'](function(_0x4a68b0){if(_0x4a68b0){_0x2e418d['model']=_['keys'](db[_0x47a5('0xb3')][_0x47a5('0x34')]);_0x2e418d[_0x47a5('0x39')]=_[_0x47a5('0x3a')](_0x3c117a[_0x47a5('0x39')]);_0x2e418d[_0x47a5('0x44')]=_[_0x47a5('0x3b')](_0x2e418d[_0x47a5('0x38')],_0x2e418d['query']);_0x6a8174[_0x47a5('0x3c')]=_[_0x47a5('0x3b')](_0x2e418d[_0x47a5('0x38')],qs[_0x47a5('0x3d')](_0x3c117a['query']['fields']));_0x6a8174[_0x47a5('0x3c')]=_0x6a8174['attributes']['length']?_0x6a8174[_0x47a5('0x3c')]:_0x2e418d[_0x47a5('0x38')];if(!_0x3c117a['query'][_0x47a5('0x3f')](_0x47a5('0xb8'))){_0x6a8174[_0x47a5('0x1f')]=qs['limit'](_0x3c117a[_0x47a5('0x39')][_0x47a5('0x1f')]);_0x6a8174['offset']=qs[_0x47a5('0x1e')](_0x3c117a[_0x47a5('0x39')][_0x47a5('0x1e')]);}_0x6a8174[_0x47a5('0x40')]=qs[_0x47a5('0x41')](_0x3c117a[_0x47a5('0x39')]['sort']);_0x6a8174[_0x47a5('0x42')]=qs['filters'](_[_0x47a5('0x43')](_0x3c117a[_0x47a5('0x39')],_0x2e418d[_0x47a5('0x44')]));_0x6a8174[_0x47a5('0x42')]['SmsInteractionId']=_0x4a68b0['id'];if(_0x3c117a[_0x47a5('0x39')][_0x47a5('0x7f')]){_0x6a8174[_0x47a5('0x42')]=_[_0x47a5('0x96')](_0x6a8174[_0x47a5('0x42')],{'$or':_[_0x47a5('0x2c')](_0x6a8174[_0x47a5('0x3c')],function(_0x359fd8){var _0x1b3e82={};_0x1b3e82[_0x359fd8]={'$like':'%'+_0x3c117a[_0x47a5('0x39')][_0x47a5('0x7f')]+'%'};return _0x1b3e82;})});}if(_0x3c117a[_0x47a5('0x39')]['$gte']){var _0x4218fd=_0x3c117a[_0x47a5('0x39')]['$gte'][_0x47a5('0x30')](',');var _0x2c15a6={};_0x2c15a6[_0x4218fd[0x0]]={'$gte':moment(_0x4218fd[0x1])[_0x47a5('0xb9')](_0x47a5('0xba'))};_0x6a8174[_0x47a5('0x42')]=_['merge'](_0x6a8174[_0x47a5('0x42')],_0x2c15a6);}_0x6a8174=_[_0x47a5('0x96')]({},_0x6a8174,_0x3c117a[_0x47a5('0xae')]);return db[_0x47a5('0xb3')][_0x47a5('0x1d')]({'where':_0x6a8174[_0x47a5('0x42')]})[_0x47a5('0x26')](function(_0x5e4387){_0x50b236['count']=_0x5e4387;if(_0x3c117a[_0x47a5('0x39')]['includeAll']){_0x6a8174[_0x47a5('0xad')]=[{'all':!![]}];}return db['SmsMessage'][_0x47a5('0xbb')](_0x6a8174);})[_0x47a5('0x26')](function(_0x134c1a){_0x50b236[_0x47a5('0xa9')]=_0x134c1a;return _0x50b236;});}})['then'](respondWithFilteredResult(_0x186aad,_0x6a8174))[_0x47a5('0x32')](handleError(_0x186aad,null));};exports[_0x47a5('0xbc')]=function(_0xaca12c,_0x5a150a,_0x581759){return db[_0x47a5('0xaf')][_0x47a5('0x5c')]({'where':{'id':_0xaca12c[_0x47a5('0xab')]['id']}})[_0x47a5('0x26')](handleEntityNotFound(_0x5a150a,null))[_0x47a5('0x26')](function(_0x402bba){if(_0x402bba){return _0x402bba[_0x47a5('0xbd')](_0xaca12c[_0x47a5('0x6f')]['ids'],_[_0x47a5('0xb5')](_0xaca12c['body'],[_0x47a5('0xb4'),'id'])||{})[_0x47a5('0xbe')](function(){return db['Tag']['findAll']({'attributes':['id',_0x47a5('0x29'),_0x47a5('0x46')],'where':{'id':_0xaca12c['body'][_0x47a5('0xb4')]}});})[_0x47a5('0x26')](function(_0x29e3ee){socket[_0x47a5('0xbf')]('smsInteractionTags:save',{'id':Number(_0xaca12c[_0x47a5('0xab')]['id']),'tags':_0x29e3ee||[]});return{'id':Number(_0xaca12c['params']['id']),'tags':_0x29e3ee||[]};});}})['then'](respondWithResult(_0x5a150a,null))['catch'](handleError(_0x5a150a,null));};exports[_0x47a5('0xc0')]=function(_0x5a975d,_0x16bf1a,_0x156d51){return db[_0x47a5('0xaf')][_0x47a5('0x5c')]({'where':{'id':_0x5a975d[_0x47a5('0xab')]['id']}})[_0x47a5('0x26')](handleEntityNotFound(_0x16bf1a,null))[_0x47a5('0x26')](function(_0x62d3a4){if(_0x62d3a4){return _0x62d3a4[_0x47a5('0xc0')](_0x5a975d[_0x47a5('0x39')][_0x47a5('0xb4')]);}})[_0x47a5('0x26')](respondWithStatusCode(_0x16bf1a,null))[_0x47a5('0x32')](handleError(_0x16bf1a,null));};exports[_0x47a5('0xc1')]=function(_0xff64fb,_0x5e17cb){var _0xdd95c8=moment()[_0x47a5('0xc2')]()[_0x47a5('0x94')]();var _0x2fa5e3=path['join'](config[_0x47a5('0xc3')],'server',_0x47a5('0xc4'),'tmp');var _0x28c125=path[_0x47a5('0xc5')](config[_0x47a5('0xc3')],'server',_0x47a5('0xc4'),_0x47a5('0xc6'));var _0x14771b=path['join'](_0x2fa5e3,_0xdd95c8);var _0x52798d=util[_0x47a5('0xb9')](_0x47a5('0xc7'),_0xff64fb[_0x47a5('0xab')]['id'],_0xdd95c8);var _0x4594df=path[_0x47a5('0xc5')](_0x2fa5e3,_0x52798d);var _0x579e5c=[];_0x579e5c[_0x47a5('0x31')]({'model':db['User'],'as':_0x47a5('0xc8'),'attributes':['id',_0x47a5('0x2d')],'raw':!![]});_0x579e5c[_0x47a5('0x31')]({'model':db[_0x47a5('0xc9')],'as':'Contact','attributes':['id','firstName',_0x47a5('0xca')],'raw':!![]});var _0x20034a=[{'model':db[_0x47a5('0xb3')],'as':_0x47a5('0xcb'),'attributes':['id',_0x47a5('0x6f'),_0x47a5('0x74'),_0x47a5('0xcc'),_0x47a5('0xcd'),_0x47a5('0x7b')],'include':_0x579e5c}];_0x20034a['push']({'model':db['SmsAccount'],'as':_0x47a5('0xce'),'attributes':['id','name']});_0x20034a[_0x47a5('0x31')]({'model':db[_0x47a5('0xc8')],'as':_0x47a5('0xcf'),'attributes':['id','fullname']});return db[_0x47a5('0xaf')][_0x47a5('0x5c')]({'where':{'id':_0xff64fb['params']['id']},'include':_0x20034a})[_0x47a5('0x26')](handleEntityNotFound(_0x5e17cb,null))['then'](function(_0x277255){if(_0x277255){var _0x3900d8=_0x277255[_0x47a5('0xd0')]({'plain':!![]});fs['mkdirSync'](_0x14771b);var _0x55b454={'format':'A4','border':'10px','header':{'height':'40px','contents':{'first':'\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20'}},'footer':{'height':_0x47a5('0xd1'),'contents':{'default':util['format'](_0x47a5('0xd2'),util[_0x47a5('0xb9')]('%s\x20#%d','Sms',_0x3900d8['id']),moment()['format'](_0x47a5('0xd3'))['toString']())}}};var _0x4ec4a8={'channel':'Sms','account':_0x3900d8[_0x47a5('0xce')][_0x47a5('0x29')],'agent':_0x3900d8[_0x47a5('0xcf')]?_0x3900d8[_0x47a5('0xcf')]['fullname']:_0x47a5('0xd4'),'createdAt':moment(_0x3900d8['createdAt'])[_0x47a5('0xb9')]('YYYY-MM-DD\x20HH:mm:ss')[_0x47a5('0x94')](),'closedAt':_0x3900d8[_0x47a5('0xd5')]?moment(_0x3900d8[_0x47a5('0xd6')])['format'](_0x47a5('0xba'))[_0x47a5('0x94')]():'','disposition':_0x3900d8[_0x47a5('0xd7')],'messages':_(_0x3900d8[_0x47a5('0xcb')])['filter']({'secret':![]})[_0x47a5('0x2c')](function(_0x9a7edc){return{'date':moment(_0x9a7edc[_0x47a5('0x74')])[_0x47a5('0xb9')](_0x47a5('0xba'))[_0x47a5('0x94')](),'sender':_0x9a7edc['direction']===_0x47a5('0xd8')?_0x9a7edc[_0x47a5('0xc8')]?_0x9a7edc[_0x47a5('0xc8')][_0x47a5('0x2d')]:_0x47a5('0xd9'):_0x9a7edc[_0x47a5('0x61')][_0x47a5('0xda')]+(_0x9a7edc[_0x47a5('0x61')][_0x47a5('0xca')]?'\x20'+_0x9a7edc[_0x47a5('0x61')][_0x47a5('0xca')]:''),'body':_0x9a7edc[_0x47a5('0x6f')],'direction':_0x9a7edc[_0x47a5('0xcc')]===_0x47a5('0xd8')?'A':'C','secret':_0x9a7edc[_0x47a5('0xcd')],'read':_0x9a7edc[_0x47a5('0x7b')]};})[_0x47a5('0x64')]()};return ejs['renderFile'](path[_0x47a5('0xc5')](config['root'],'server',_0x47a5('0xdb'),_0x47a5('0xdc')),{'interaction':_0x4ec4a8})[_0x47a5('0x26')](function(_0x4d4039){return new BPromise(function(_0x1f8e28,_0xd8381b){pdf[_0x47a5('0xb0')](_0x4d4039,_0x55b454)[_0x47a5('0xdd')](path[_0x47a5('0xc5')](_0x14771b,_0x47a5('0xde')+_0x3900d8['id']+'-'+_0xdd95c8+_0x47a5('0xdf')),function(_0x46cb3a,_0x176e71){if(_0x46cb3a)return _0xd8381b(_0x46cb3a);_0x1f8e28(_0x176e71);});});})[_0x47a5('0x26')](function(){return new BPromise(function(_0x10952f,_0x399026){zipdir(_0x14771b,{'saveTo':_0x4594df},function(_0x203bc9,_0x4d7fd4){if(_0x203bc9)return _0x399026(_0x203bc9);return _0x10952f(_0x4d7fd4);});})['then'](function(){return new BPromise(function(_0x2884c9,_0x5e7d56){rimraf(_0x14771b,function(_0x249339){if(_0x249339)_0x5e7d56(_0x249339);return _0x2884c9();});});})[_0x47a5('0x26')](function(){return _0x5e17cb[_0x47a5('0xc1')](_0x4594df,_0x52798d,function(_0x3112db){if(_0x3112db){console[_0x47a5('0xe0')](_0x47a5('0xe1'),_0x3112db);}else{fs['unlinkSync'](_0x4594df);}});});});}else{return _0x5e17cb[_0x47a5('0x1a')](0xc8);}})[_0x47a5('0x32')](handleError(_0x5e17cb,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index 95dfcb9..b815c53 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 _0x106f=['hook','exports','events','../../mysqldb','SmsMessage','save','remove','getUsers','then','setDataValue','Users','unreadMessages','length','emit','catch','hasOwnProperty'];(function(_0x21ce79,_0x55e60e){var _0xf6d9e3=function(_0x31c6d6){while(--_0x31c6d6){_0x21ce79['push'](_0x21ce79['shift']());}};_0xf6d9e3(++_0x55e60e);}(_0x106f,0x162));var _0xf106=function(_0x38ff83,_0x2fc816){_0x38ff83=_0x38ff83-0x0;var _0x3ce5dc=_0x106f[_0x38ff83];return _0x3ce5dc;};'use strict';var EventEmitter=require(_0xf106('0x0'));var SmsInteraction=require(_0xf106('0x1'))['db']['SmsInteraction'];var SmsMessage=require(_0xf106('0x1'))['db'][_0xf106('0x2')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf106('0x3'),'afterUpdate':'update','afterDestroy':_0xf106('0x4')};function emitEvent(_0x370f6a){return function(_0x1f2919,_0x318376,_0x253f6d){_0x1f2919[_0xf106('0x5')]({'attributes':['id'],'raw':!![]})[_0xf106('0x6')](function(_0x546acc){_0x1f2919[_0xf106('0x7')](_0xf106('0x8'),_0x546acc['map'](function(_0x4a35bc){return{'id':_0x4a35bc['id']};}));return SmsMessage['findAll']({'where':{'SmsInteractionId':_0x1f2919['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x52befe){_0x1f2919[_0xf106('0x7')](_0xf106('0x9'),_0x52befe[_0xf106('0xa')]);SmsInteractionEvents[_0xf106('0xb')](_0x370f6a+':'+_0x1f2919['id'],_0x1f2919);SmsInteractionEvents[_0xf106('0xb')](_0x370f6a,_0x1f2919);_0x253f6d(null);})[_0xf106('0xc')](_0x253f6d(null));};}for(var e in events){if(events[_0xf106('0xd')](e)){var event=events[e];SmsInteraction[_0xf106('0xe')](e,emitEvent(event));}}module[_0xf106('0xf')]=SmsInteractionEvents; \ No newline at end of file +var _0x8ce1=['setDataValue','unreadMessages','length','catch','hasOwnProperty','hook','exports','events','../../mysqldb','SmsInteraction','SmsMessage','setMaxListeners','save','update','remove','getUsers','then','Users','map','findAll'];(function(_0x1cd23d,_0xec4ea5){var _0x5e8ad5=function(_0x1603d8){while(--_0x1603d8){_0x1cd23d['push'](_0x1cd23d['shift']());}};_0x5e8ad5(++_0xec4ea5);}(_0x8ce1,0x183));var _0x18ce=function(_0x48fdc2,_0x4619b9){_0x48fdc2=_0x48fdc2-0x0;var _0x5f056b=_0x8ce1[_0x48fdc2];return _0x5f056b;};'use strict';var EventEmitter=require(_0x18ce('0x0'));var SmsInteraction=require(_0x18ce('0x1'))['db'][_0x18ce('0x2')];var SmsMessage=require(_0x18ce('0x1'))['db'][_0x18ce('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x18ce('0x4')](0x0);var events={'afterCreate':_0x18ce('0x5'),'afterUpdate':_0x18ce('0x6'),'afterDestroy':_0x18ce('0x7')};function emitEvent(_0x15f55e){return function(_0x1797e6,_0x280142,_0x13ff9d){_0x1797e6[_0x18ce('0x8')]({'attributes':['id'],'raw':!![]})[_0x18ce('0x9')](function(_0x359094){_0x1797e6['setDataValue'](_0x18ce('0xa'),_0x359094[_0x18ce('0xb')](function(_0x29f1ea){return{'id':_0x29f1ea['id']};}));return SmsMessage[_0x18ce('0xc')]({'where':{'SmsInteractionId':_0x1797e6['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x3082bb){_0x1797e6[_0x18ce('0xd')](_0x18ce('0xe'),_0x3082bb[_0x18ce('0xf')]);SmsInteractionEvents['emit'](_0x15f55e+':'+_0x1797e6['id'],_0x1797e6);SmsInteractionEvents['emit'](_0x15f55e,_0x1797e6);_0x13ff9d(null);})[_0x18ce('0x10')](_0x13ff9d(null));};}for(var e in events){if(events[_0x18ce('0x11')](e)){var event=events[e];SmsInteraction[_0x18ce('0x12')](e,emitEvent(event));}}module[_0x18ce('0x13')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index fd47a59..bba87b2 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 _0x272b=['api','moment','bluebird','rimraf','../../config/environment','define','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger'];(function(_0x294870,_0x496744){var _0x26c818=function(_0xc830e9){while(--_0xc830e9){_0x294870['push'](_0x294870['shift']());}};_0x26c818(++_0x496744);}(_0x272b,0x136));var _0xb272=function(_0x53dcac,_0x351c81){_0x53dcac=_0x53dcac-0x0;var _0x372c8e=_0x272b[_0x53dcac];return _0x372c8e;};'use strict';var _=require(_0xb272('0x0'));var util=require('util');var logger=require(_0xb272('0x1'))(_0xb272('0x2'));var moment=require(_0xb272('0x3'));var BPromise=require(_0xb272('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xb272('0x5'));var config=require(_0xb272('0x6'));var attributes=require('./smsInteraction.attributes');module['exports']=function(_0xb2bc8,_0x379dbc){return _0xb2bc8[_0xb272('0x7')]('SmsInteraction',attributes,{'tableName':'sms_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2e31f9,_0x2dbe92,_0x47a041){if(_0x2e31f9['changed'](_0xb272('0x8'))){_0x2e31f9[_0xb272('0x9')]=moment()[_0xb272('0xa')](_0xb272('0xb'));}_0x47a041(null,_0x2e31f9);}}});}; \ No newline at end of file +var _0x36b3=['lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsInteraction.attributes','exports','define','sms_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x2dd92e,_0x5fb8e4){var _0x1c75e8=function(_0x229437){while(--_0x229437){_0x2dd92e['push'](_0x2dd92e['shift']());}};_0x1c75e8(++_0x5fb8e4);}(_0x36b3,0x6c));var _0x336b=function(_0x2564a7,_0x5d447f){_0x2564a7=_0x2564a7-0x0;var _0x4d90a1=_0x36b3[_0x2564a7];return _0x4d90a1;};'use strict';var _=require(_0x336b('0x0'));var util=require(_0x336b('0x1'));var logger=require('../../config/logger')(_0x336b('0x2'));var moment=require(_0x336b('0x3'));var BPromise=require(_0x336b('0x4'));var rp=require(_0x336b('0x5'));var fs=require('fs');var path=require(_0x336b('0x6'));var rimraf=require(_0x336b('0x7'));var config=require(_0x336b('0x8'));var attributes=require(_0x336b('0x9'));module[_0x336b('0xa')]=function(_0x1ab99b,_0x44f246){return _0x1ab99b[_0x336b('0xb')]('SmsInteraction',attributes,{'tableName':_0x336b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x7c21f8,_0x31e75f,_0x4040a5){if(_0x7c21f8[_0x336b('0xd')](_0x336b('0xe'))){_0x7c21f8[_0x336b('0xf')]=moment()[_0x336b('0x10')](_0x336b('0x11'));}_0x4040a5(null,_0x7c21f8);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index fa998e1..bc66303 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 _0x787a=['where','limit','debug','stringify','AddTagsToSmsInteraction','find','omit','ids','spread','AddTags','lodash','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','request','then','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','error','code','message','catch','UpdateSmsInteraction','SmsInteraction','body','options','raw'];(function(_0x1dd2cc,_0x36ddfe){var _0x305d8e=function(_0x27df09){while(--_0x27df09){_0x1dd2cc['push'](_0x1dd2cc['shift']());}};_0x305d8e(++_0x36ddfe);}(_0x787a,0x157));var _0xa787=function(_0x26aa44,_0x4bc900){_0x26aa44=_0x26aa44-0x0;var _0x25ce6b=_0x787a[_0x26aa44];return _0x25ce6b;};'use strict';var _=require(_0xa787('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa787('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa787('0x2'))['db'];var utils=require(_0xa787('0x3'));var logger=require('../../config/logger')(_0xa787('0x4'));var config=require(_0xa787('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xa787('0x6')][_0xa787('0x7')]({'port':0x232a});config[_0xa787('0x8')]=_[_0xa787('0x9')](config[_0xa787('0x8')],{'host':_0xa787('0xa'),'port':0x18eb});var socket=require(_0xa787('0xb'))(new Redis(config[_0xa787('0x8')]));require(_0xa787('0xc'))['register'](socket);function respondWithRpcPromise(_0x5ae0d9,_0xa0662b,_0x534e43){return new BPromise(function(_0x15e8a3,_0x51bc77){return client[_0xa787('0xd')](_0x5ae0d9,_0x534e43)[_0xa787('0xe')](function(_0x2371bc){logger[_0xa787('0xf')](_0xa787('0x10'),_0xa0662b,_0xa787('0x11'));logger['debug']('SmsInteraction,\x20%s,\x20%s,\x20%s',_0xa0662b,'request\x20sent',JSON['stringify'](_0x2371bc));if(_0x2371bc[_0xa787('0x12')]){if(_0x2371bc[_0xa787('0x12')][_0xa787('0x13')]===0x1f4){logger[_0xa787('0x12')](_0xa787('0x10'),_0xa0662b,_0x2371bc['error'][_0xa787('0x14')]);return _0x51bc77(_0x2371bc[_0xa787('0x12')][_0xa787('0x14')]);}logger[_0xa787('0x12')](_0xa787('0x10'),_0xa0662b,_0x2371bc[_0xa787('0x12')][_0xa787('0x14')]);return _0x15e8a3(_0x2371bc[_0xa787('0x12')][_0xa787('0x14')]);}else{logger['info'](_0xa787('0x10'),_0xa0662b,'request\x20sent');_0x15e8a3(_0x2371bc['result'][_0xa787('0x14')]);}})[_0xa787('0x15')](function(_0x3606b3){logger['error'](_0xa787('0x10'),_0xa0662b,_0x3606b3);_0x51bc77(_0x3606b3);});});}exports[_0xa787('0x16')]=function(_0x1a701d){var _0x1b77c2=this;return new Promise(function(_0x207caf,_0x4d85e2){return db[_0xa787('0x17')]['update'](_0x1a701d[_0xa787('0x18')],{'raw':_0x1a701d['options']?_0x1a701d[_0xa787('0x19')][_0xa787('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1a701d['options']?_0x1a701d[_0xa787('0x19')][_0xa787('0x1b')]||null:null,'attributes':_0x1a701d['options']?_0x1a701d[_0xa787('0x19')]['attributes']||null:null,'limit':_0x1a701d['options']?_0x1a701d[_0xa787('0x19')][_0xa787('0x1c')]||null:null})[_0xa787('0xe')](function(_0x37a042){logger[_0xa787('0xf')](_0xa787('0x16'),_0x1a701d);logger[_0xa787('0x1d')](_0xa787('0x16'),_0x1a701d,JSON[_0xa787('0x1e')](_0x37a042));_0x207caf(_0x37a042);})[_0xa787('0x15')](function(_0x1734b0){logger['error'](_0xa787('0x16'),_0x1734b0[_0xa787('0x14')],_0x1a701d);_0x4d85e2(_0x1b77c2['error'](0x1f4,_0x1734b0[_0xa787('0x14')]));});});};exports[_0xa787('0x1f')]=function(_0x11f963){return new Promise(function(_0x4dff1b,_0x4217bc){return db[_0xa787('0x17')][_0xa787('0x20')]({'where':_0x11f963[_0xa787('0x19')]?_0x11f963[_0xa787('0x19')]['where']||null:null})[_0xa787('0xe')](function(_0x79fe36){if(_0x79fe36){return _0x79fe36['addTags'](_0x11f963[_0xa787('0x18')]['ids'],_[_0xa787('0x21')](_0x11f963[_0xa787('0x18')],[_0xa787('0x22'),'id'])||{});}})[_0xa787('0x23')](function(_0x153306){logger['info'](_0xa787('0x24'),_0x11f963);logger['debug'](_0xa787('0x24'),_0x11f963,JSON['stringify'](_0x153306));_0x4dff1b(_0x153306);})[_0xa787('0x15')](function(_0x50d499){logger['error']('AddTags',_0x50d499[_0xa787('0x14')],_0x11f963);_0x4217bc(_this['error'](0x1f4,_0x50d499[_0xa787('0x14')]));});});}; \ No newline at end of file +var _0x4c60=['omit','ids','spread','AddTags','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','request','then','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','error','message','result','UpdateSmsInteraction','update','body','options','where','attributes','limit','catch','SmsInteraction','find'];(function(_0x4f1da5,_0x4ced17){var _0xe972a8=function(_0x278ba3){while(--_0x278ba3){_0x4f1da5['push'](_0x4f1da5['shift']());}};_0xe972a8(++_0x4ced17);}(_0x4c60,0x1bc));var _0x04c6=function(_0x49b842,_0x37ffc2){_0x49b842=_0x49b842-0x0;var _0x160d72=_0x4c60[_0x49b842];return _0x160d72;};'use strict';var _=require(_0x04c6('0x0'));var util=require('util');var moment=require(_0x04c6('0x1'));var BPromise=require(_0x04c6('0x2'));var rs=require(_0x04c6('0x3'));var fs=require('fs');var Redis=require(_0x04c6('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x04c6('0x5'));var logger=require(_0x04c6('0x6'))(_0x04c6('0x7'));var config=require('../../config/environment');var jayson=require(_0x04c6('0x8'));var client=jayson[_0x04c6('0x9')]['http']({'port':0x232a});config[_0x04c6('0xa')]=_[_0x04c6('0xb')](config[_0x04c6('0xa')],{'host':_0x04c6('0xc'),'port':0x18eb});var socket=require(_0x04c6('0xd'))(new Redis(config[_0x04c6('0xa')]));require(_0x04c6('0xe'))[_0x04c6('0xf')](socket);function respondWithRpcPromise(_0x538045,_0x24c0e5,_0x1bfe25){return new BPromise(function(_0x88db90,_0x280b5d){return client[_0x04c6('0x10')](_0x538045,_0x1bfe25)[_0x04c6('0x11')](function(_0x3440f4){logger[_0x04c6('0x12')](_0x04c6('0x13'),_0x24c0e5,_0x04c6('0x14'));logger[_0x04c6('0x15')](_0x04c6('0x16'),_0x24c0e5,_0x04c6('0x14'),JSON['stringify'](_0x3440f4));if(_0x3440f4[_0x04c6('0x17')]){if(_0x3440f4[_0x04c6('0x17')]['code']===0x1f4){logger[_0x04c6('0x17')](_0x04c6('0x13'),_0x24c0e5,_0x3440f4[_0x04c6('0x17')][_0x04c6('0x18')]);return _0x280b5d(_0x3440f4['error']['message']);}logger[_0x04c6('0x17')]('SmsInteraction,\x20%s,\x20%s',_0x24c0e5,_0x3440f4[_0x04c6('0x17')]['message']);return _0x88db90(_0x3440f4[_0x04c6('0x17')][_0x04c6('0x18')]);}else{logger[_0x04c6('0x12')](_0x04c6('0x13'),_0x24c0e5,_0x04c6('0x14'));_0x88db90(_0x3440f4[_0x04c6('0x19')][_0x04c6('0x18')]);}})['catch'](function(_0x161ee1){logger[_0x04c6('0x17')](_0x04c6('0x13'),_0x24c0e5,_0x161ee1);_0x280b5d(_0x161ee1);});});}exports[_0x04c6('0x1a')]=function(_0x4b449d){var _0x44dab8=this;return new Promise(function(_0x55c1d7,_0x11b751){return db['SmsInteraction'][_0x04c6('0x1b')](_0x4b449d[_0x04c6('0x1c')],{'raw':_0x4b449d[_0x04c6('0x1d')]?_0x4b449d['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4b449d[_0x04c6('0x1d')]?_0x4b449d['options'][_0x04c6('0x1e')]||null:null,'attributes':_0x4b449d['options']?_0x4b449d[_0x04c6('0x1d')][_0x04c6('0x1f')]||null:null,'limit':_0x4b449d[_0x04c6('0x1d')]?_0x4b449d['options'][_0x04c6('0x20')]||null:null})[_0x04c6('0x11')](function(_0x555ed6){logger[_0x04c6('0x12')](_0x04c6('0x1a'),_0x4b449d);logger[_0x04c6('0x15')](_0x04c6('0x1a'),_0x4b449d,JSON['stringify'](_0x555ed6));_0x55c1d7(_0x555ed6);})[_0x04c6('0x21')](function(_0x198577){logger[_0x04c6('0x17')](_0x04c6('0x1a'),_0x198577[_0x04c6('0x18')],_0x4b449d);_0x11b751(_0x44dab8[_0x04c6('0x17')](0x1f4,_0x198577[_0x04c6('0x18')]));});});};exports['AddTagsToSmsInteraction']=function(_0x1b59b4){return new Promise(function(_0x7f3d56,_0x5e8ff6){return db[_0x04c6('0x22')][_0x04c6('0x23')]({'where':_0x1b59b4[_0x04c6('0x1d')]?_0x1b59b4['options'][_0x04c6('0x1e')]||null:null})[_0x04c6('0x11')](function(_0x1fc1e7){if(_0x1fc1e7){return _0x1fc1e7['addTags'](_0x1b59b4[_0x04c6('0x1c')]['ids'],_[_0x04c6('0x24')](_0x1b59b4[_0x04c6('0x1c')],[_0x04c6('0x25'),'id'])||{});}})[_0x04c6('0x26')](function(_0x233899){logger[_0x04c6('0x12')]('AddTags',_0x1b59b4);logger['debug'](_0x04c6('0x27'),_0x1b59b4,JSON['stringify'](_0x233899));_0x7f3d56(_0x233899);})[_0x04c6('0x21')](function(_0x57bc70){logger[_0x04c6('0x17')](_0x04c6('0x27'),_0x57bc70[_0x04c6('0x18')],_0x1b59b4);_0x5e8ff6(_this['error'](0x1f4,_0x57bc70[_0x04c6('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index 1e98d91..a8d92dc 100644 --- a/server/api/smsInteraction/smsInteraction.socket.js +++ b/server/api/smsInteraction/smsInteraction.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb7e7=['remove','removeListener','length','smsInteraction:','./smsInteraction.events'];(function(_0x3e87da,_0x74fa1d){var _0x39f4b7=function(_0x37705a){while(--_0x37705a){_0x3e87da['push'](_0x3e87da['shift']());}};_0x39f4b7(++_0x74fa1d);}(_0xb7e7,0x121));var _0x7b7e=function(_0x68ee8b,_0x3cc6c5){_0x68ee8b=_0x68ee8b-0x0;var _0x5148f7=_0xb7e7[_0x68ee8b];return _0x5148f7;};'use strict';var SmsInteractionEvents=require(_0x7b7e('0x0'));var events=['save',_0x7b7e('0x1'),'update'];function createListener(_0x1b7cc7,_0x54a37f){return function(_0x3f5804){_0x54a37f['emit'](_0x1b7cc7,_0x3f5804);};}function removeListener(_0x31d0ed,_0x118577){return function(){SmsInteractionEvents[_0x7b7e('0x2')](_0x31d0ed,_0x118577);};}exports['register']=function(_0x53ed64){for(var _0x333fa4=0x0,_0x372bde=events[_0x7b7e('0x3')];_0x333fa4<_0x372bde;_0x333fa4++){var _0x55ce81=events[_0x333fa4];var _0x42b871=createListener(_0x7b7e('0x4')+_0x55ce81,_0x53ed64);SmsInteractionEvents['on'](_0x55ce81,_0x42b871);}}; \ No newline at end of file +var _0x5f66=['length','smsInteraction:','save','update','emit','register'];(function(_0x1b2005,_0x445e66){var _0x3a9efc=function(_0x326bc1){while(--_0x326bc1){_0x1b2005['push'](_0x1b2005['shift']());}};_0x3a9efc(++_0x445e66);}(_0x5f66,0x1a0));var _0x65f6=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x5f66[_0x465028];return _0xb783d4;};'use strict';var SmsInteractionEvents=require('./smsInteraction.events');var events=[_0x65f6('0x0'),'remove',_0x65f6('0x1')];function createListener(_0x2f06ae,_0x3461cd){return function(_0xbce843){_0x3461cd[_0x65f6('0x2')](_0x2f06ae,_0xbce843);};}function removeListener(_0x5eb9ad,_0x3c5029){return function(){SmsInteractionEvents['removeListener'](_0x5eb9ad,_0x3c5029);};}exports[_0x65f6('0x3')]=function(_0x22b017){for(var _0x4ec221=0x0,_0x4ed98f=events[_0x65f6('0x4')];_0x4ec221<_0x4ed98f;_0x4ec221++){var _0x2c6571=events[_0x4ec221];var _0x112079=createListener(_0x65f6('0x5')+_0x2c6571,_0x22b017);SmsInteractionEvents['on'](_0x2c6571,_0x112079);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index 2c37815..e14f79d 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 _0x2016=['reject','delete','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','/:id','show','post','tracked','sms','smsmessage:create','create','/:id/status','put','accept','/:id/reject'];(function(_0x4a4743,_0x3cc5b0){var _0x1aa3b7=function(_0x409ffa){while(--_0x409ffa){_0x4a4743['push'](_0x4a4743['shift']());}};_0x1aa3b7(++_0x3cc5b0);}(_0x2016,0x6c));var _0x6201=function(_0x36de36,_0xa58ad1){_0x36de36=_0x36de36-0x0;var _0x5a35a1=_0x2016[_0x36de36];return _0x5a35a1;};'use strict';var multer=require(_0x6201('0x0'));var util=require('util');var path=require(_0x6201('0x1'));var timeout=require(_0x6201('0x2'));var express=require(_0x6201('0x3'));var router=express['Router']();var auth=require(_0x6201('0x4'));var interaction=require(_0x6201('0x5'));var config=require(_0x6201('0x6'));var controller=require('./smsMessage.controller');router['get']('/',auth[_0x6201('0x7')](),controller[_0x6201('0x8')]);router[_0x6201('0x9')](_0x6201('0xa'),auth[_0x6201('0x7')](),controller['describe']);router['get'](_0x6201('0xb'),auth[_0x6201('0x7')](),controller[_0x6201('0xc')]);router[_0x6201('0xd')]('/',auth[_0x6201('0x7')](),interaction[_0x6201('0xe')](_0x6201('0xf'),_0x6201('0x10')),controller[_0x6201('0x11')]);router[_0x6201('0xd')](_0x6201('0x12'),controller['status']);router[_0x6201('0x13')](_0x6201('0xb'),auth[_0x6201('0x7')](),controller['update']);router[_0x6201('0x13')]('/:id/accept',auth[_0x6201('0x7')](),controller[_0x6201('0x14')]);router['put'](_0x6201('0x15'),auth['isAuthenticated'](),controller[_0x6201('0x16')]);router[_0x6201('0x17')]('/:id',auth['isAuthenticated'](),controller[_0x6201('0x18')]);module[_0x6201('0x19')]=router; \ No newline at end of file +var _0x6ebf=['/:id/reject','reject','delete','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','/describe','isAuthenticated','describe','/:id','show','post','tracked','smsmessage:create','create','/:id/status','status','put','update','/:id/accept','accept'];(function(_0x3b159c,_0x4fc72e){var _0x3aefcf=function(_0x19c142){while(--_0x19c142){_0x3b159c['push'](_0x3b159c['shift']());}};_0x3aefcf(++_0x4fc72e);}(_0x6ebf,0x149));var _0xf6eb=function(_0x351b46,_0x26b265){_0x351b46=_0x351b46-0x0;var _0x1515df=_0x6ebf[_0x351b46];return _0x1515df;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xf6eb('0x0'));var timeout=require(_0xf6eb('0x1'));var express=require(_0xf6eb('0x2'));var router=express[_0xf6eb('0x3')]();var auth=require(_0xf6eb('0x4'));var interaction=require(_0xf6eb('0x5'));var config=require('../../config/environment');var controller=require('./smsMessage.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xf6eb('0x6')](_0xf6eb('0x7'),auth[_0xf6eb('0x8')](),controller[_0xf6eb('0x9')]);router['get'](_0xf6eb('0xa'),auth[_0xf6eb('0x8')](),controller[_0xf6eb('0xb')]);router[_0xf6eb('0xc')]('/',auth[_0xf6eb('0x8')](),interaction[_0xf6eb('0xd')]('sms',_0xf6eb('0xe')),controller[_0xf6eb('0xf')]);router[_0xf6eb('0xc')](_0xf6eb('0x10'),controller[_0xf6eb('0x11')]);router[_0xf6eb('0x12')]('/:id',auth[_0xf6eb('0x8')](),controller[_0xf6eb('0x13')]);router[_0xf6eb('0x12')](_0xf6eb('0x14'),auth[_0xf6eb('0x8')](),controller[_0xf6eb('0x15')]);router[_0xf6eb('0x12')](_0xf6eb('0x16'),auth[_0xf6eb('0x8')](),controller[_0xf6eb('0x17')]);router[_0xf6eb('0x18')](_0xf6eb('0xa'),auth['isAuthenticated'](),controller[_0xf6eb('0x19')]);module[_0xf6eb('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 9091d4a..eb3900f 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 _0x57f8=['exports','TEXT','medium','BOOLEAN','ENUM','out','STRING','DATE'];(function(_0x531c2c,_0x3d7191){var _0x430f77=function(_0x1ff8a9){while(--_0x1ff8a9){_0x531c2c['push'](_0x531c2c['shift']());}};_0x430f77(++_0x3d7191);}(_0x57f8,0x198));var _0x857f=function(_0x51bda1,_0x44f80d){_0x51bda1=_0x51bda1-0x0;var _0x1ce08c=_0x57f8[_0x51bda1];return _0x1ce08c;};'use strict';var Sequelize=require('sequelize');module[_0x857f('0x0')]={'body':{'type':Sequelize[_0x857f('0x1')](_0x857f('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x857f('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x857f('0x4')]('in',_0x857f('0x5')),'defaultValue':_0x857f('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0x857f('0x6')](0xbe)},'phone':{'type':Sequelize[_0x857f('0x6')]},'readAt':{'type':Sequelize[_0x857f('0x7')]},'secret':{'type':Sequelize[_0x857f('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x9931=['medium','ENUM','out','STRING','DATE','BOOLEAN','sequelize','exports','TEXT'];(function(_0x46a42f,_0x50d1e5){var _0x4c1539=function(_0x1268eb){while(--_0x1268eb){_0x46a42f['push'](_0x46a42f['shift']());}};_0x4c1539(++_0x50d1e5);}(_0x9931,0xb1));var _0x1993=function(_0x1541f1,_0x40e594){_0x1541f1=_0x1541f1-0x0;var _0x2e4ee6=_0x9931[_0x1541f1];return _0x2e4ee6;};'use strict';var Sequelize=require(_0x1993('0x0'));module[_0x1993('0x1')]={'body':{'type':Sequelize[_0x1993('0x2')](_0x1993('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x1993('0x4')]('in',_0x1993('0x5')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0x1993('0x6')]},'readAt':{'type':Sequelize[_0x1993('0x7')]},'secret':{'type':Sequelize[_0x1993('0x8')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index dc6c9a0..19a993a 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 _0xb89f=['save','then','destroy','stack','name','send','index','map','SmsMessage','rawAttributes','fieldName','query','keys','filters','intersection','model','fields','hasOwnProperty','order','sort','where','merge','type','VIRTUAL','filter','includeAll','attributes','length','include','find','create','body','params','describe','accept','sms','read','readAt','format','UserId','user','Contact','get','SmsInteraction','SmsInteractionId','update','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','interface','channel','event','EventManager','acceptmessage','agent','stringify','RejectMessage','SIP/%s','SmsAccount','SmsAccountId','SmsMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','indexOf','sent','delivered','Status','inspect','infobip','results','groupName','DELIVERED','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','register','jayson/promise','client','http','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','SmsMessage,\x20%s,\x20%s','debug','request\x20sent','error','code','message','info','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject'];(function(_0x476ddb,_0x5e4456){var _0x4e78a9=function(_0x1146ac){while(--_0x1146ac){_0x476ddb['push'](_0x476ddb['shift']());}};_0x4e78a9(++_0x5e4456);}(_0xb89f,0x16a));var _0xfb89=function(_0x4e2665,_0x55b326){_0x4e2665=_0x4e2665-0x0;var _0x2bd882=_0xb89f[_0x4e2665];return _0x2bd882;};'use strict';var pdf=require(_0xfb89('0x0'));var emlformat=require(_0xfb89('0x1'));var rimraf=require(_0xfb89('0x2'));var zipdir=require(_0xfb89('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xfb89('0x4'));var moment=require(_0xfb89('0x5'));var BPromise=require(_0xfb89('0x6'));var Mustache=require(_0xfb89('0x7'));var util=require(_0xfb89('0x8'));var path=require(_0xfb89('0x9'));var sox=require('sox');var csv=require(_0xfb89('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xfb89('0xb'));var squel=require(_0xfb89('0xc'));var crypto=require('crypto');var jsforce=require(_0xfb89('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xfb89('0xa'));var querystring=require(_0xfb89('0xe'));var Papa=require(_0xfb89('0xf'));var Redis=require(_0xfb89('0x10'));var authService=require(_0xfb89('0x11'));var qs=require(_0xfb89('0x12'));var as=require(_0xfb89('0x13'));var hardwareService=require(_0xfb89('0x14'));var logger=require(_0xfb89('0x15'))(_0xfb89('0x16'));var utils=require(_0xfb89('0x17'));var config=require('../../config/environment');var db=require(_0xfb89('0x18'))['db'];config[_0xfb89('0x19')]=_[_0xfb89('0x1a')](config[_0xfb89('0x19')],{'host':_0xfb89('0x1b'),'port':0x18eb});var socket=require(_0xfb89('0x1c'))(new Redis(config[_0xfb89('0x19')]));require(_0xfb89('0x1d'))[_0xfb89('0x1e')](socket);var jayson=require(_0xfb89('0x1f'));var client=jayson[_0xfb89('0x20')][_0xfb89('0x21')]({'port':0x232c});var client9002=jayson[_0xfb89('0x20')][_0xfb89('0x21')]({'port':0x232a});function checkPasswordPattern(_0x951e85,_0x56a5c1,_0x4eed64){if(_0x4eed64){var _0x43585e=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x43585e['test'](_0x56a5c1)){return _0x951e85;}else{throw new db[(_0xfb89('0x22'))][(_0xfb89('0x23'))](_0xfb89('0x24'));}}else{return _0x951e85;}}function respondWithRpcPromise(_0x5f1066,_0x9b3e65,_0x3fcc7b,_0x2a1608){return new BPromise(function(_0x447e25,_0x2d2d41){var _0x442675=_0x2a1608||client;return _0x442675[_0xfb89('0x25')](_0x5f1066,_0x3fcc7b)['then'](function(_0x205999){logger['info'](_0xfb89('0x26'),_0x9b3e65,'request\x20sent');logger[_0xfb89('0x27')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x9b3e65,_0xfb89('0x28'),JSON['stringify'](_0x205999));if(_0x205999[_0xfb89('0x29')]){if(_0x205999[_0xfb89('0x29')][_0xfb89('0x2a')]===0x1f4){logger['error'](_0xfb89('0x26'),_0x9b3e65,_0x205999['error'][_0xfb89('0x2b')]);return _0x2d2d41(_0x205999['error'][_0xfb89('0x2b')]);}logger['error'](_0xfb89('0x26'),_0x9b3e65,_0x205999[_0xfb89('0x29')][_0xfb89('0x2b')]);return _0x447e25(_0x205999['error'][_0xfb89('0x2b')]);}else{logger[_0xfb89('0x2c')]('SmsMessage,\x20%s,\x20%s',_0x9b3e65,_0xfb89('0x28'));_0x447e25(_0x205999[_0xfb89('0x2d')][_0xfb89('0x2b')]);}})[_0xfb89('0x2e')](function(_0xec4d9e){logger[_0xfb89('0x29')](_0xfb89('0x26'),_0x9b3e65,_0xec4d9e);_0x2d2d41(_0xec4d9e);});});}function respondWithStatusCode(_0x18df97,_0x4a3ac4){_0x4a3ac4=_0x4a3ac4||0xcc;return function(_0x2c5170){if(_0x2c5170){return _0x18df97[_0xfb89('0x2f')](_0x4a3ac4);}return _0x18df97[_0xfb89('0x30')](_0x4a3ac4)[_0xfb89('0x31')]();};}function respondWithResult(_0x5cd5a9,_0x2e2834){_0x2e2834=_0x2e2834||0xc8;return function(_0x3746a9){if(_0x3746a9){return _0x5cd5a9[_0xfb89('0x30')](_0x2e2834)[_0xfb89('0x32')](_0x3746a9);}};}function respondWithFilteredResult(_0x521555,_0x2d9bd7){return function(_0x5c5b0e){if(_0x5c5b0e){var _0x2edd30=_0x5c5b0e[_0xfb89('0x33')],_0x575f8b=_0x2d9bd7[_0xfb89('0x34')],_0x3a1c64=_0x2d9bd7[_0xfb89('0x34')]+_0x2d9bd7[_0xfb89('0x35')],_0x31bd11;if(_0x3a1c64>=_0x2edd30){_0x3a1c64=_0x2edd30;_0x31bd11=0xc8;}else{_0x31bd11=0xce;}_0x521555[_0xfb89('0x30')](_0x31bd11);return _0x521555[_0xfb89('0x36')](_0xfb89('0x37'),_0x575f8b+'-'+_0x3a1c64+'/'+_0x2edd30)[_0xfb89('0x32')](_0x5c5b0e);}return null;};}function patchUpdates(_0x38b8da){return function(_0x1155e3){try{jsonpatch[_0xfb89('0x38')](_0x1155e3,_0x38b8da,!![]);}catch(_0x274bf0){return BPromise[_0xfb89('0x39')](_0x274bf0);}return _0x1155e3[_0xfb89('0x3a')]();};}function saveUpdates(_0x447144,_0x51f94c){return function(_0x486f2c){if(_0x486f2c){return _0x486f2c['update'](_0x447144)[_0xfb89('0x3b')](function(_0x151ad6){return _0x151ad6;});}return null;};}function removeEntity(_0x2a9acf,_0x34f751){return function(_0x50af50){if(_0x50af50){return _0x50af50[_0xfb89('0x3c')]()['then'](function(){_0x2a9acf[_0xfb89('0x30')](0xcc)[_0xfb89('0x31')]();});}};}function handleEntityNotFound(_0x3c98e1,_0x3c803e){return function(_0x5952fc){if(!_0x5952fc){_0x3c98e1[_0xfb89('0x2f')](0x194);}return _0x5952fc;};}function handleError(_0x338db5,_0x249bd5){_0x249bd5=_0x249bd5||0x1f4;return function(_0x38c159){logger[_0xfb89('0x29')](_0x38c159[_0xfb89('0x3d')]);if(_0x38c159[_0xfb89('0x3e')]){delete _0x38c159[_0xfb89('0x3e')];}_0x338db5[_0xfb89('0x30')](_0x249bd5)[_0xfb89('0x3f')](_0x38c159);};}exports[_0xfb89('0x40')]=function(_0x5bd447,_0x47f4f4){var _0x5d3d09={},_0xf640ca={},_0x1bb3c4={'count':0x0,'rows':[]};var _0x3843a7=_[_0xfb89('0x41')](db[_0xfb89('0x42')][_0xfb89('0x43')],function(_0x5b9869){return{'name':_0x5b9869[_0xfb89('0x44')],'type':_0x5b9869['type']['key']};});_0xf640ca['model']=_[_0xfb89('0x41')](_0x3843a7,_0xfb89('0x3e'));_0xf640ca[_0xfb89('0x45')]=_[_0xfb89('0x46')](_0x5bd447[_0xfb89('0x45')]);_0xf640ca[_0xfb89('0x47')]=_[_0xfb89('0x48')](_0xf640ca[_0xfb89('0x49')],_0xf640ca[_0xfb89('0x45')]);_0x5d3d09['attributes']=_['intersection'](_0xf640ca[_0xfb89('0x49')],qs[_0xfb89('0x4a')](_0x5bd447[_0xfb89('0x45')][_0xfb89('0x4a')]));_0x5d3d09['attributes']=_0x5d3d09['attributes']['length']?_0x5d3d09['attributes']:_0xf640ca[_0xfb89('0x49')];if(!_0x5bd447[_0xfb89('0x45')][_0xfb89('0x4b')]('nolimit')){_0x5d3d09[_0xfb89('0x35')]=qs[_0xfb89('0x35')](_0x5bd447['query']['limit']);_0x5d3d09[_0xfb89('0x34')]=qs[_0xfb89('0x34')](_0x5bd447[_0xfb89('0x45')][_0xfb89('0x34')]);}_0x5d3d09[_0xfb89('0x4c')]=qs[_0xfb89('0x4d')](_0x5bd447[_0xfb89('0x45')]['sort']);_0x5d3d09[_0xfb89('0x4e')]=qs[_0xfb89('0x47')](_['pick'](_0x5bd447[_0xfb89('0x45')],_0xf640ca[_0xfb89('0x47')]));if(_0x5bd447[_0xfb89('0x45')]['filter']){_0x5d3d09['where']=_[_0xfb89('0x4f')](_0x5d3d09[_0xfb89('0x4e')],{'$or':_[_0xfb89('0x41')](_0x3843a7,function(_0xec43d1){if(_0xec43d1[_0xfb89('0x50')]!==_0xfb89('0x51')){var _0x13d484={};_0x13d484[_0xec43d1[_0xfb89('0x3e')]]={'$like':'%'+_0x5bd447['query'][_0xfb89('0x52')]+'%'};return _0x13d484;}})});}_0x5d3d09=_[_0xfb89('0x4f')]({},_0x5d3d09,_0x5bd447['options']);var _0x505360={'where':_0x5d3d09['where']};return db[_0xfb89('0x42')][_0xfb89('0x33')](_0x505360)[_0xfb89('0x3b')](function(_0xdb1ed1){_0x1bb3c4[_0xfb89('0x33')]=_0xdb1ed1;if(_0x5bd447[_0xfb89('0x45')][_0xfb89('0x53')]){_0x5d3d09['include']=[{'all':!![]}];}return db[_0xfb89('0x42')]['findAll'](_0x5d3d09);})['then'](function(_0x51cb2e){_0x1bb3c4['rows']=_0x51cb2e;return _0x1bb3c4;})[_0xfb89('0x3b')](respondWithFilteredResult(_0x47f4f4,_0x5d3d09))[_0xfb89('0x2e')](handleError(_0x47f4f4,null));};exports['show']=function(_0x205293,_0x5c980d){var _0xeea6b8={'raw':!![],'where':{'id':_0x205293['params']['id']}},_0x227e1b={};_0x227e1b[_0xfb89('0x49')]=_['keys'](db['SmsMessage'][_0xfb89('0x43')]);_0x227e1b['query']=_[_0xfb89('0x46')](_0x205293[_0xfb89('0x45')]);_0x227e1b[_0xfb89('0x47')]=_['intersection'](_0x227e1b[_0xfb89('0x49')],_0x227e1b[_0xfb89('0x45')]);_0xeea6b8[_0xfb89('0x54')]=_[_0xfb89('0x48')](_0x227e1b[_0xfb89('0x49')],qs[_0xfb89('0x4a')](_0x205293[_0xfb89('0x45')][_0xfb89('0x4a')]));_0xeea6b8[_0xfb89('0x54')]=_0xeea6b8[_0xfb89('0x54')][_0xfb89('0x55')]?_0xeea6b8[_0xfb89('0x54')]:_0x227e1b[_0xfb89('0x49')];if(_0x205293[_0xfb89('0x45')][_0xfb89('0x53')]){_0xeea6b8[_0xfb89('0x56')]=[{'all':!![]}];}_0xeea6b8=_[_0xfb89('0x4f')]({},_0xeea6b8,_0x205293['options']);return db[_0xfb89('0x42')][_0xfb89('0x57')](_0xeea6b8)[_0xfb89('0x3b')](handleEntityNotFound(_0x5c980d,null))[_0xfb89('0x3b')](respondWithResult(_0x5c980d,null))[_0xfb89('0x2e')](handleError(_0x5c980d,null));};exports[_0xfb89('0x58')]=function(_0x6b4485,_0x55d3c4){return db[_0xfb89('0x42')][_0xfb89('0x58')](_0x6b4485[_0xfb89('0x59')],{})[_0xfb89('0x3b')](respondWithResult(_0x55d3c4,0xc9))[_0xfb89('0x2e')](handleError(_0x55d3c4,null));};exports['update']=function(_0x18a510,_0x2a4e5c){if(_0x18a510[_0xfb89('0x59')]['id']){delete _0x18a510[_0xfb89('0x59')]['id'];}return db[_0xfb89('0x42')][_0xfb89('0x57')]({'where':{'id':_0x18a510[_0xfb89('0x5a')]['id']}})[_0xfb89('0x3b')](handleEntityNotFound(_0x2a4e5c,null))['then'](saveUpdates(_0x18a510[_0xfb89('0x59')],null))[_0xfb89('0x3b')](respondWithResult(_0x2a4e5c,null))[_0xfb89('0x2e')](handleError(_0x2a4e5c,null));};exports['destroy']=function(_0x33925d,_0x558bd9){return db[_0xfb89('0x42')][_0xfb89('0x57')]({'where':{'id':_0x33925d[_0xfb89('0x5a')]['id']}})[_0xfb89('0x3b')](handleEntityNotFound(_0x558bd9,null))[_0xfb89('0x3b')](removeEntity(_0x558bd9,null))[_0xfb89('0x2e')](handleError(_0x558bd9,null));};exports['describe']=function(_0x4a2300,_0x84f52){return db[_0xfb89('0x42')][_0xfb89('0x5b')]()[_0xfb89('0x3b')](respondWithResult(_0x84f52,null))[_0xfb89('0x2e')](handleError(_0x84f52,null));};var interaction_log=require(_0xfb89('0x15'))('sms-interactions');exports[_0xfb89('0x5c')]=function(_0x13c64a,_0x414c33,_0x1eb1b0){var _0xff346b={'channel':_0xfb89('0x5d')};if(_0x13c64a['body']['id']){delete _0x13c64a[_0xfb89('0x59')]['id'];}_0x13c64a[_0xfb89('0x59')][_0xfb89('0x5e')]=!![];_0x13c64a['body'][_0xfb89('0x5f')]=moment()[_0xfb89('0x60')]('YYYY-MM-DD\x20HH:mm:ss');_0x13c64a['body'][_0xfb89('0x61')]=_0x13c64a['body'][_0xfb89('0x61')]||_0x13c64a[_0xfb89('0x62')]['id'];return db[_0xfb89('0x42')][_0xfb89('0x57')]({'where':{'id':_0x13c64a[_0xfb89('0x5a')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0xfb89('0x63')}]})[_0xfb89('0x3b')](handleEntityNotFound(_0x414c33,null))['then'](saveUpdates(_0x13c64a[_0xfb89('0x59')],null))['then'](function(_0x3c0d87){if(_0x3c0d87){_0xff346b['message']=_0x3c0d87[_0xfb89('0x64')]({'plain':!![]});return db[_0xfb89('0x65')][_0xfb89('0x57')]({'where':{'id':_0x3c0d87[_0xfb89('0x66')]}});}return null;})[_0xfb89('0x3b')](handleEntityNotFound(_0x414c33,null))[_0xfb89('0x3b')](function(_0x3f2508){if(_0x3f2508){return _0x3f2508[_0xfb89('0x67')]({'UserId':_0x13c64a['body'][_0xfb89('0x61')],'read1stAt':_[_0xfb89('0x68')](_0x3f2508[_0xfb89('0x69')])?moment()[_0xfb89('0x60')](_0xfb89('0x6a')):undefined});}return null;})[_0xfb89('0x3b')](function(_0xe5512d){if(_0xe5512d){_0xff346b[_0xfb89('0x6b')]=_0xe5512d['get']({'plain':!![]});interaction_log['info'](_0xfb89('0x6c'),_0x13c64a['user']['id'],_0x13c64a[_0xfb89('0x62')][_0xfb89('0x3e')],_0x13c64a['user'][_0xfb89('0x6d')],_0xff346b[_0xfb89('0x6b')]['id'],_0x13c64a[_0xfb89('0x59')]?JSON['stringify'](_0x13c64a[_0xfb89('0x59')]):_0xfb89('0x6e'));return respondWithRpcPromise(_0xfb89('0x6f'),'acceptMessage',_0xff346b);}return null;})[_0xfb89('0x3b')](function(_0x29398e){if(_0x29398e){if(_0x13c64a[_0xfb89('0x59')]['manual']){_0xff346b[_0xfb89('0x2b')][_0xfb89('0x70')]=util['format']('SIP/%s',_0x13c64a['user']['name']);_0xff346b['message'][_0xfb89('0x71')]=_0xff346b[_0xfb89('0x71')];_0xff346b[_0xfb89('0x2b')][_0xfb89('0x72')]='accept';return respondWithRpcPromise('EventManager',_0xfb89('0x73'),{'event':_0xfb89('0x74'),'message':_0xff346b[_0xfb89('0x2b')]},client9002)[_0xfb89('0x3b')](function(){return _0xff346b;});}return _0xff346b;}return null;})[_0xfb89('0x3b')](respondWithResult(_0x414c33,null))[_0xfb89('0x2e')](handleError(_0x414c33,null));};var interaction_log=require('../../config/logger')('sms-interactions');exports[_0xfb89('0x39')]=function(_0x551843,_0x34884d,_0x2dcf2d){var _0x3adb52={'agent':{},'channel':'sms'};if(_0x551843[_0xfb89('0x59')]['id']){delete _0x551843[_0xfb89('0x59')]['id'];}_0x551843[_0xfb89('0x59')]['UserId']=_0x551843[_0xfb89('0x59')][_0xfb89('0x61')]||_0x551843[_0xfb89('0x62')]['id'];_0x3adb52[_0xfb89('0x75')]['id']=_0x551843[_0xfb89('0x59')][_0xfb89('0x61')];return db[_0xfb89('0x42')]['find']({'where':{'id':_0x551843[_0xfb89('0x5a')]['id'],'UserId':null}})[_0xfb89('0x3b')](handleEntityNotFound(_0x34884d,null))[_0xfb89('0x3b')](function(_0x558054){if(_0x558054){_0x3adb52['message']=_0x558054[_0xfb89('0x64')]({'plain':!![]});return db[_0xfb89('0x65')][_0xfb89('0x57')]({'where':{'id':_0x558054[_0xfb89('0x66')]}});}return null;})[_0xfb89('0x3b')](handleEntityNotFound(_0x34884d,null))[_0xfb89('0x3b')](function(_0xf32c12){if(_0xf32c12){_0x3adb52[_0xfb89('0x6b')]=_0xf32c12['get']({'plain':!![]});interaction_log[_0xfb89('0x2c')]('[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x551843[_0xfb89('0x62')]['id'],_0x551843[_0xfb89('0x62')][_0xfb89('0x3e')],_0x551843['user']['role'],_0x3adb52['interaction']['id'],_0x551843[_0xfb89('0x59')]?JSON[_0xfb89('0x76')](_0x551843['body']):_0xfb89('0x6e'));return respondWithRpcPromise(_0xfb89('0x77'),'rejectMessage',_0x3adb52);}return null;})[_0xfb89('0x3b')](function(_0x16ced2){if(_0x16ced2){_0x16ced2[_0xfb89('0x2b')]['interface']=util['format'](_0xfb89('0x78'),_0x551843[_0xfb89('0x62')][_0xfb89('0x3e')]);_0x16ced2[_0xfb89('0x2b')][_0xfb89('0x71')]=_0x3adb52[_0xfb89('0x71')];_0x16ced2['message'][_0xfb89('0x72')]=_0xfb89('0x39');respondWithRpcPromise(_0xfb89('0x73'),'EventManager',{'event':'rejectmessage','message':_0x16ced2[_0xfb89('0x2b')]},client9002);return _0x3adb52;}return null;})['then'](respondWithResult(_0x34884d,null))[_0xfb89('0x2e')](handleError(_0x34884d,null));};exports[_0xfb89('0x30')]=function(_0xd3b375,_0x388999,_0x257b80){if(_0xd3b375['body']['id']){delete _0xd3b375['body']['id'];}var _0x366409;return db[_0xfb89('0x42')][_0xfb89('0x57')]({'where':{'id':_0xd3b375[_0xfb89('0x5a')]['id']}})[_0xfb89('0x3b')](handleEntityNotFound(_0x388999,null))['then'](function(_0x5947bc){if(_0x5947bc){_0x366409=_0x5947bc;return db[_0xfb89('0x79')][_0xfb89('0x57')]({'where':{'id':_0x5947bc[_0xfb89('0x7a')]}});}})[_0xfb89('0x3b')](handleEntityNotFound(_0x388999,null))[_0xfb89('0x3b')](function(_0x4f316f){if(_0x4f316f){logger['debug'](_0xfb89('0x7b'),'status',_0xfb89('0x7c'),_0x4f316f['type'],util['inspect'](_0xd3b375['body'],{'showHidden':![],'depth':null}));switch(_0x4f316f[_0xfb89('0x50')]){case _0xfb89('0x7d'):if(_0xd3b375['body'][_0xfb89('0x7e')]&&_0xd3b375[_0xfb89('0x59')][_0xfb89('0x7e')]===_0x366409[_0xfb89('0x7f')]){return _0x366409[_0xfb89('0x67')]({'read':!![]});}else{logger['error'](_0xfb89('0x80'),_0xfb89('0x30'),_0xfb89('0x7d'),util['inspect'](_0xd3b375[_0xfb89('0x59')],{'showHidden':![],'depth':null}));}break;case _0xfb89('0x81'):if(_0xd3b375[_0xfb89('0x59')][_0xfb89('0x82')]&&_0xd3b375['body'][_0xfb89('0x82')]===_0x366409[_0xfb89('0x7f')]&&_[_0xfb89('0x83')]([_0xfb89('0x84'),_0xfb89('0x85')],_0xd3b375[_0xfb89('0x59')][_0xfb89('0x86')])>=0x0){return _0x366409[_0xfb89('0x67')]({'read':!![]});}else{logger[_0xfb89('0x29')](_0xfb89('0x80'),'status','plivio',util[_0xfb89('0x87')](_0xd3b375[_0xfb89('0x59')],{'showHidden':![],'depth':null}));}break;case _0xfb89('0x88'):var _0x1f08b3=_0xd3b375['body'][_0xfb89('0x89')][0x0];if(_0x1f08b3['status'][_0xfb89('0x8a')]===_0xfb89('0x8b')){return _0x366409['update']({'read':!![]});}else{logger[_0xfb89('0x29')](_0xfb89('0x80'),_0xfb89('0x30'),_0xfb89('0x88'),util[_0xfb89('0x87')](_0xd3b375['body'],{'showHidden':![],'depth':null}));}break;}return _0x366409;}})[_0xfb89('0x3b')](respondWithResult(_0x388999,null))[_0xfb89('0x2e')](handleError(_0x388999,null));}; \ No newline at end of file +var _0xa017=['register','jayson/promise','client','http','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','json','offset','limit','Content-Range','reject','save','update','end','stack','name','send','map','SmsMessage','rawAttributes','fieldName','type','key','query','keys','filters','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','count','includeAll','include','findAll','show','params','intersection','create','body','find','destroy','describe','sms','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','Contact','get','SmsInteraction','SmsInteractionId','format','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','AcceptMessage','interface','channel','accept','EventManager','acceptmessage','sms-interactions','interaction','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','rejectMessage','SIP/%s','rejectmessage','SmsAccountId','received\x20delivery\x20report\x20from','inspect','twilio','SmsAccount,\x20%s,\x20%s,\x20%s','MessageUUID','messageId','indexOf','Status','infobip','results','groupName','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','lodash','squel','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket'];(function(_0x4d2d18,_0x1a10cc){var _0x36b4ac=function(_0x4035c0){while(--_0x4035c0){_0x4d2d18['push'](_0x4d2d18['shift']());}};_0x36b4ac(++_0x1a10cc);}(_0xa017,0x1f1));var _0x7a01=function(_0x356d14,_0x335981){_0x356d14=_0x356d14-0x0;var _0x454990=_0xa017[_0x356d14];return _0x454990;};'use strict';var pdf=require(_0x7a01('0x0'));var emlformat=require(_0x7a01('0x1'));var rimraf=require(_0x7a01('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x7a01('0x3'));var moment=require(_0x7a01('0x4'));var BPromise=require(_0x7a01('0x5'));var Mustache=require(_0x7a01('0x6'));var util=require(_0x7a01('0x7'));var path=require(_0x7a01('0x8'));var sox=require(_0x7a01('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x7a01('0xa'));var squel=require(_0x7a01('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x7a01('0xc'));var querystring=require('querystring');var Papa=require(_0x7a01('0xd'));var Redis=require(_0x7a01('0xe'));var authService=require(_0x7a01('0xf'));var qs=require(_0x7a01('0x10'));var as=require(_0x7a01('0x11'));var hardwareService=require(_0x7a01('0x12'));var logger=require(_0x7a01('0x13'))('api');var utils=require(_0x7a01('0x14'));var config=require('../../config/environment');var db=require(_0x7a01('0x15'))['db'];config[_0x7a01('0x16')]=_[_0x7a01('0x17')](config['redis'],{'host':_0x7a01('0x18'),'port':0x18eb});var socket=require(_0x7a01('0x19'))(new Redis(config[_0x7a01('0x16')]));require(_0x7a01('0x1a'))[_0x7a01('0x1b')](socket);var jayson=require(_0x7a01('0x1c'));var client=jayson[_0x7a01('0x1d')][_0x7a01('0x1e')]({'port':0x232c});var client9002=jayson[_0x7a01('0x1d')][_0x7a01('0x1e')]({'port':0x232a});function checkPasswordPattern(_0x4416ab,_0x26c0b2,_0x558d65){if(_0x558d65){var _0x544248=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x544248['test'](_0x26c0b2)){return _0x4416ab;}else{throw new db[(_0x7a01('0x1f'))]['ValidationError'](_0x7a01('0x20'));}}else{return _0x4416ab;}}function respondWithRpcPromise(_0x40fb92,_0x280b49,_0x489ad9,_0x21bdd8){return new BPromise(function(_0xd8aef3,_0x1f013c){var _0x51cec3=_0x21bdd8||client;return _0x51cec3[_0x7a01('0x21')](_0x40fb92,_0x489ad9)[_0x7a01('0x22')](function(_0x3e1842){logger[_0x7a01('0x23')](_0x7a01('0x24'),_0x280b49,_0x7a01('0x25'));logger[_0x7a01('0x26')](_0x7a01('0x27'),_0x280b49,_0x7a01('0x25'),JSON[_0x7a01('0x28')](_0x3e1842));if(_0x3e1842[_0x7a01('0x29')]){if(_0x3e1842[_0x7a01('0x29')][_0x7a01('0x2a')]===0x1f4){logger[_0x7a01('0x29')](_0x7a01('0x24'),_0x280b49,_0x3e1842[_0x7a01('0x29')]['message']);return _0x1f013c(_0x3e1842[_0x7a01('0x29')]['message']);}logger[_0x7a01('0x29')](_0x7a01('0x24'),_0x280b49,_0x3e1842[_0x7a01('0x29')][_0x7a01('0x2b')]);return _0xd8aef3(_0x3e1842['error'][_0x7a01('0x2b')]);}else{logger[_0x7a01('0x23')](_0x7a01('0x24'),_0x280b49,_0x7a01('0x25'));_0xd8aef3(_0x3e1842[_0x7a01('0x2c')][_0x7a01('0x2b')]);}})[_0x7a01('0x2d')](function(_0x10d857){logger[_0x7a01('0x29')]('SmsMessage,\x20%s,\x20%s',_0x280b49,_0x10d857);_0x1f013c(_0x10d857);});});}function respondWithStatusCode(_0x4d5374,_0xb90835){_0xb90835=_0xb90835||0xcc;return function(_0x27f09b){if(_0x27f09b){return _0x4d5374[_0x7a01('0x2e')](_0xb90835);}return _0x4d5374[_0x7a01('0x2f')](_0xb90835)['end']();};}function respondWithResult(_0xb219a3,_0xaf8c9b){_0xaf8c9b=_0xaf8c9b||0xc8;return function(_0x281b64){if(_0x281b64){return _0xb219a3[_0x7a01('0x2f')](_0xaf8c9b)[_0x7a01('0x30')](_0x281b64);}};}function respondWithFilteredResult(_0x1f5767,_0x55b7dc){return function(_0x8dd642){if(_0x8dd642){var _0x541890=_0x8dd642['count'],_0xca0c9a=_0x55b7dc[_0x7a01('0x31')],_0x4d01be=_0x55b7dc['offset']+_0x55b7dc[_0x7a01('0x32')],_0x2bbc28;if(_0x4d01be>=_0x541890){_0x4d01be=_0x541890;_0x2bbc28=0xc8;}else{_0x2bbc28=0xce;}_0x1f5767['status'](_0x2bbc28);return _0x1f5767['set'](_0x7a01('0x33'),_0xca0c9a+'-'+_0x4d01be+'/'+_0x541890)[_0x7a01('0x30')](_0x8dd642);}return null;};}function patchUpdates(_0x43652d){return function(_0x2b5484){try{jsonpatch['apply'](_0x2b5484,_0x43652d,!![]);}catch(_0x561211){return BPromise[_0x7a01('0x34')](_0x561211);}return _0x2b5484[_0x7a01('0x35')]();};}function saveUpdates(_0x419213,_0x23281c){return function(_0x25ebeb){if(_0x25ebeb){return _0x25ebeb[_0x7a01('0x36')](_0x419213)[_0x7a01('0x22')](function(_0x39417a){return _0x39417a;});}return null;};}function removeEntity(_0x2aec6b,_0x3b75c4){return function(_0x6a2d5c){if(_0x6a2d5c){return _0x6a2d5c['destroy']()[_0x7a01('0x22')](function(){_0x2aec6b[_0x7a01('0x2f')](0xcc)[_0x7a01('0x37')]();});}};}function handleEntityNotFound(_0x394511,_0x1b902f){return function(_0x5c8846){if(!_0x5c8846){_0x394511[_0x7a01('0x2e')](0x194);}return _0x5c8846;};}function handleError(_0x1acbb5,_0x45a1a4){_0x45a1a4=_0x45a1a4||0x1f4;return function(_0x87c2da){logger[_0x7a01('0x29')](_0x87c2da[_0x7a01('0x38')]);if(_0x87c2da[_0x7a01('0x39')]){delete _0x87c2da[_0x7a01('0x39')];}_0x1acbb5['status'](_0x45a1a4)[_0x7a01('0x3a')](_0x87c2da);};}exports['index']=function(_0x3fb504,_0x308ca4){var _0x516e39={},_0xd58352={},_0x16cff9={'count':0x0,'rows':[]};var _0x502167=_[_0x7a01('0x3b')](db[_0x7a01('0x3c')][_0x7a01('0x3d')],function(_0x6e8f39){return{'name':_0x6e8f39[_0x7a01('0x3e')],'type':_0x6e8f39[_0x7a01('0x3f')][_0x7a01('0x40')]};});_0xd58352['model']=_[_0x7a01('0x3b')](_0x502167,_0x7a01('0x39'));_0xd58352[_0x7a01('0x41')]=_[_0x7a01('0x42')](_0x3fb504[_0x7a01('0x41')]);_0xd58352[_0x7a01('0x43')]=_['intersection'](_0xd58352[_0x7a01('0x44')],_0xd58352[_0x7a01('0x41')]);_0x516e39['attributes']=_['intersection'](_0xd58352['model'],qs[_0x7a01('0x45')](_0x3fb504[_0x7a01('0x41')][_0x7a01('0x45')]));_0x516e39['attributes']=_0x516e39[_0x7a01('0x46')][_0x7a01('0x47')]?_0x516e39['attributes']:_0xd58352[_0x7a01('0x44')];if(!_0x3fb504[_0x7a01('0x41')][_0x7a01('0x48')](_0x7a01('0x49'))){_0x516e39[_0x7a01('0x32')]=qs[_0x7a01('0x32')](_0x3fb504[_0x7a01('0x41')][_0x7a01('0x32')]);_0x516e39[_0x7a01('0x31')]=qs[_0x7a01('0x31')](_0x3fb504[_0x7a01('0x41')][_0x7a01('0x31')]);}_0x516e39[_0x7a01('0x4a')]=qs[_0x7a01('0x4b')](_0x3fb504[_0x7a01('0x41')]['sort']);_0x516e39[_0x7a01('0x4c')]=qs['filters'](_[_0x7a01('0x4d')](_0x3fb504[_0x7a01('0x41')],_0xd58352[_0x7a01('0x43')]));if(_0x3fb504[_0x7a01('0x41')][_0x7a01('0x4e')]){_0x516e39[_0x7a01('0x4c')]=_['merge'](_0x516e39['where'],{'$or':_[_0x7a01('0x3b')](_0x502167,function(_0xc1cc1f){if(_0xc1cc1f[_0x7a01('0x3f')]!=='VIRTUAL'){var _0x539872={};_0x539872[_0xc1cc1f[_0x7a01('0x39')]]={'$like':'%'+_0x3fb504[_0x7a01('0x41')][_0x7a01('0x4e')]+'%'};return _0x539872;}})});}_0x516e39=_[_0x7a01('0x4f')]({},_0x516e39,_0x3fb504[_0x7a01('0x50')]);var _0x5d99f5={'where':_0x516e39[_0x7a01('0x4c')]};return db['SmsMessage'][_0x7a01('0x51')](_0x5d99f5)[_0x7a01('0x22')](function(_0x3f0045){_0x16cff9[_0x7a01('0x51')]=_0x3f0045;if(_0x3fb504['query'][_0x7a01('0x52')]){_0x516e39[_0x7a01('0x53')]=[{'all':!![]}];}return db[_0x7a01('0x3c')][_0x7a01('0x54')](_0x516e39);})[_0x7a01('0x22')](function(_0x6f9763){_0x16cff9['rows']=_0x6f9763;return _0x16cff9;})['then'](respondWithFilteredResult(_0x308ca4,_0x516e39))['catch'](handleError(_0x308ca4,null));};exports[_0x7a01('0x55')]=function(_0x54262e,_0x170110){var _0xfbc995={'raw':!![],'where':{'id':_0x54262e[_0x7a01('0x56')]['id']}},_0x5aa2ec={};_0x5aa2ec[_0x7a01('0x44')]=_['keys'](db[_0x7a01('0x3c')][_0x7a01('0x3d')]);_0x5aa2ec[_0x7a01('0x41')]=_['keys'](_0x54262e[_0x7a01('0x41')]);_0x5aa2ec[_0x7a01('0x43')]=_['intersection'](_0x5aa2ec[_0x7a01('0x44')],_0x5aa2ec[_0x7a01('0x41')]);_0xfbc995[_0x7a01('0x46')]=_[_0x7a01('0x57')](_0x5aa2ec[_0x7a01('0x44')],qs[_0x7a01('0x45')](_0x54262e[_0x7a01('0x41')][_0x7a01('0x45')]));_0xfbc995[_0x7a01('0x46')]=_0xfbc995[_0x7a01('0x46')]['length']?_0xfbc995[_0x7a01('0x46')]:_0x5aa2ec[_0x7a01('0x44')];if(_0x54262e['query']['includeAll']){_0xfbc995[_0x7a01('0x53')]=[{'all':!![]}];}_0xfbc995=_['merge']({},_0xfbc995,_0x54262e[_0x7a01('0x50')]);return db[_0x7a01('0x3c')]['find'](_0xfbc995)['then'](handleEntityNotFound(_0x170110,null))[_0x7a01('0x22')](respondWithResult(_0x170110,null))[_0x7a01('0x2d')](handleError(_0x170110,null));};exports[_0x7a01('0x58')]=function(_0x2849b7,_0xbd2e52){return db[_0x7a01('0x3c')][_0x7a01('0x58')](_0x2849b7['body'],{})[_0x7a01('0x22')](respondWithResult(_0xbd2e52,0xc9))[_0x7a01('0x2d')](handleError(_0xbd2e52,null));};exports['update']=function(_0x4a00e4,_0x4323eb){if(_0x4a00e4[_0x7a01('0x59')]['id']){delete _0x4a00e4[_0x7a01('0x59')]['id'];}return db[_0x7a01('0x3c')][_0x7a01('0x5a')]({'where':{'id':_0x4a00e4['params']['id']}})['then'](handleEntityNotFound(_0x4323eb,null))[_0x7a01('0x22')](saveUpdates(_0x4a00e4[_0x7a01('0x59')],null))[_0x7a01('0x22')](respondWithResult(_0x4323eb,null))[_0x7a01('0x2d')](handleError(_0x4323eb,null));};exports[_0x7a01('0x5b')]=function(_0x5e7792,_0x21380d){return db['SmsMessage']['find']({'where':{'id':_0x5e7792[_0x7a01('0x56')]['id']}})[_0x7a01('0x22')](handleEntityNotFound(_0x21380d,null))['then'](removeEntity(_0x21380d,null))[_0x7a01('0x2d')](handleError(_0x21380d,null));};exports[_0x7a01('0x5c')]=function(_0x15f7d9,_0x48bbc2){return db[_0x7a01('0x3c')][_0x7a01('0x5c')]()[_0x7a01('0x22')](respondWithResult(_0x48bbc2,null))[_0x7a01('0x2d')](handleError(_0x48bbc2,null));};var interaction_log=require(_0x7a01('0x13'))('sms-interactions');exports['accept']=function(_0x18a0f0,_0xd67b8a,_0x316450){var _0x30b6df={'channel':_0x7a01('0x5d')};if(_0x18a0f0[_0x7a01('0x59')]['id']){delete _0x18a0f0[_0x7a01('0x59')]['id'];}_0x18a0f0[_0x7a01('0x59')][_0x7a01('0x5e')]=!![];_0x18a0f0[_0x7a01('0x59')][_0x7a01('0x5f')]=moment()['format'](_0x7a01('0x60'));_0x18a0f0[_0x7a01('0x59')][_0x7a01('0x61')]=_0x18a0f0[_0x7a01('0x59')][_0x7a01('0x61')]||_0x18a0f0['user']['id'];return db['SmsMessage'][_0x7a01('0x5a')]({'where':{'id':_0x18a0f0[_0x7a01('0x56')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0x7a01('0x62')}]})[_0x7a01('0x22')](handleEntityNotFound(_0xd67b8a,null))[_0x7a01('0x22')](saveUpdates(_0x18a0f0[_0x7a01('0x59')],null))[_0x7a01('0x22')](function(_0x446e40){if(_0x446e40){_0x30b6df[_0x7a01('0x2b')]=_0x446e40[_0x7a01('0x63')]({'plain':!![]});return db[_0x7a01('0x64')][_0x7a01('0x5a')]({'where':{'id':_0x446e40[_0x7a01('0x65')]}});}return null;})[_0x7a01('0x22')](handleEntityNotFound(_0xd67b8a,null))[_0x7a01('0x22')](function(_0x21181b){if(_0x21181b){return _0x21181b[_0x7a01('0x36')]({'UserId':_0x18a0f0[_0x7a01('0x59')][_0x7a01('0x61')],'read1stAt':_['isNil'](_0x21181b['read1stAt'])?moment()[_0x7a01('0x66')](_0x7a01('0x60')):undefined});}return null;})[_0x7a01('0x22')](function(_0x1398fa){if(_0x1398fa){_0x30b6df['interaction']=_0x1398fa[_0x7a01('0x63')]({'plain':!![]});interaction_log[_0x7a01('0x23')](_0x7a01('0x67'),_0x18a0f0[_0x7a01('0x68')]['id'],_0x18a0f0['user'][_0x7a01('0x39')],_0x18a0f0[_0x7a01('0x68')][_0x7a01('0x69')],_0x30b6df['interaction']['id'],_0x18a0f0[_0x7a01('0x59')]?JSON['stringify'](_0x18a0f0[_0x7a01('0x59')]):'null');return respondWithRpcPromise(_0x7a01('0x6a'),'acceptMessage',_0x30b6df);}return null;})[_0x7a01('0x22')](function(_0x3fc05d){if(_0x3fc05d){if(_0x18a0f0['body']['manual']){_0x30b6df[_0x7a01('0x2b')][_0x7a01('0x6b')]=util[_0x7a01('0x66')]('SIP/%s',_0x18a0f0['user'][_0x7a01('0x39')]);_0x30b6df[_0x7a01('0x2b')][_0x7a01('0x6c')]=_0x30b6df['channel'];_0x30b6df['message']['event']=_0x7a01('0x6d');return respondWithRpcPromise('EventManager',_0x7a01('0x6e'),{'event':_0x7a01('0x6f'),'message':_0x30b6df[_0x7a01('0x2b')]},client9002)[_0x7a01('0x22')](function(){return _0x30b6df;});}return _0x30b6df;}return null;})[_0x7a01('0x22')](respondWithResult(_0xd67b8a,null))[_0x7a01('0x2d')](handleError(_0xd67b8a,null));};var interaction_log=require(_0x7a01('0x13'))(_0x7a01('0x70'));exports['reject']=function(_0x503cb7,_0x501aa9,_0x4e68a9){var _0x4d8b3e={'agent':{},'channel':'sms'};if(_0x503cb7[_0x7a01('0x59')]['id']){delete _0x503cb7[_0x7a01('0x59')]['id'];}_0x503cb7[_0x7a01('0x59')][_0x7a01('0x61')]=_0x503cb7[_0x7a01('0x59')][_0x7a01('0x61')]||_0x503cb7[_0x7a01('0x68')]['id'];_0x4d8b3e['agent']['id']=_0x503cb7[_0x7a01('0x59')][_0x7a01('0x61')];return db[_0x7a01('0x3c')][_0x7a01('0x5a')]({'where':{'id':_0x503cb7[_0x7a01('0x56')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x501aa9,null))[_0x7a01('0x22')](function(_0x3b549d){if(_0x3b549d){_0x4d8b3e[_0x7a01('0x2b')]=_0x3b549d[_0x7a01('0x63')]({'plain':!![]});return db[_0x7a01('0x64')]['find']({'where':{'id':_0x3b549d['SmsInteractionId']}});}return null;})[_0x7a01('0x22')](handleEntityNotFound(_0x501aa9,null))['then'](function(_0x4de313){if(_0x4de313){_0x4d8b3e[_0x7a01('0x71')]=_0x4de313[_0x7a01('0x63')]({'plain':!![]});interaction_log[_0x7a01('0x23')](_0x7a01('0x72'),_0x503cb7[_0x7a01('0x68')]['id'],_0x503cb7[_0x7a01('0x68')][_0x7a01('0x39')],_0x503cb7[_0x7a01('0x68')][_0x7a01('0x69')],_0x4d8b3e[_0x7a01('0x71')]['id'],_0x503cb7[_0x7a01('0x59')]?JSON['stringify'](_0x503cb7[_0x7a01('0x59')]):_0x7a01('0x73'));return respondWithRpcPromise('RejectMessage',_0x7a01('0x74'),_0x4d8b3e);}return null;})['then'](function(_0xb606c2){if(_0xb606c2){_0xb606c2[_0x7a01('0x2b')][_0x7a01('0x6b')]=util[_0x7a01('0x66')](_0x7a01('0x75'),_0x503cb7[_0x7a01('0x68')][_0x7a01('0x39')]);_0xb606c2['message'][_0x7a01('0x6c')]=_0x4d8b3e[_0x7a01('0x6c')];_0xb606c2[_0x7a01('0x2b')]['event']=_0x7a01('0x34');respondWithRpcPromise(_0x7a01('0x6e'),_0x7a01('0x6e'),{'event':_0x7a01('0x76'),'message':_0xb606c2[_0x7a01('0x2b')]},client9002);return _0x4d8b3e;}return null;})[_0x7a01('0x22')](respondWithResult(_0x501aa9,null))['catch'](handleError(_0x501aa9,null));};exports[_0x7a01('0x2f')]=function(_0xf18e6e,_0x317e27,_0x2f5ce3){if(_0xf18e6e[_0x7a01('0x59')]['id']){delete _0xf18e6e[_0x7a01('0x59')]['id'];}var _0x562c9e;return db[_0x7a01('0x3c')]['find']({'where':{'id':_0xf18e6e[_0x7a01('0x56')]['id']}})[_0x7a01('0x22')](handleEntityNotFound(_0x317e27,null))[_0x7a01('0x22')](function(_0x5c9675){if(_0x5c9675){_0x562c9e=_0x5c9675;return db['SmsAccount']['find']({'where':{'id':_0x5c9675[_0x7a01('0x77')]}});}})[_0x7a01('0x22')](handleEntityNotFound(_0x317e27,null))[_0x7a01('0x22')](function(_0x4662b4){if(_0x4662b4){logger['debug'](_0x7a01('0x27'),_0x7a01('0x2f'),_0x7a01('0x78'),_0x4662b4[_0x7a01('0x3f')],util[_0x7a01('0x79')](_0xf18e6e['body'],{'showHidden':![],'depth':null}));switch(_0x4662b4['type']){case _0x7a01('0x7a'):if(_0xf18e6e['body']['MessageSid']&&_0xf18e6e[_0x7a01('0x59')]['MessageSid']===_0x562c9e['messageId']){return _0x562c9e[_0x7a01('0x36')]({'read':!![]});}else{logger[_0x7a01('0x29')](_0x7a01('0x7b'),'status',_0x7a01('0x7a'),util[_0x7a01('0x79')](_0xf18e6e[_0x7a01('0x59')],{'showHidden':![],'depth':null}));}break;case'plivo':if(_0xf18e6e[_0x7a01('0x59')]['MessageUUID']&&_0xf18e6e[_0x7a01('0x59')][_0x7a01('0x7c')]===_0x562c9e[_0x7a01('0x7d')]&&_[_0x7a01('0x7e')](['sent','delivered'],_0xf18e6e[_0x7a01('0x59')][_0x7a01('0x7f')])>=0x0){return _0x562c9e[_0x7a01('0x36')]({'read':!![]});}else{logger['error'](_0x7a01('0x7b'),_0x7a01('0x2f'),'plivio',util[_0x7a01('0x79')](_0xf18e6e[_0x7a01('0x59')],{'showHidden':![],'depth':null}));}break;case _0x7a01('0x80'):var _0x25db13=_0xf18e6e['body'][_0x7a01('0x81')][0x0];if(_0x25db13[_0x7a01('0x2f')][_0x7a01('0x82')]==='DELIVERED'){return _0x562c9e[_0x7a01('0x36')]({'read':!![]});}else{logger[_0x7a01('0x29')](_0x7a01('0x7b'),_0x7a01('0x2f'),'infobip',util[_0x7a01('0x79')](_0xf18e6e[_0x7a01('0x59')],{'showHidden':![],'depth':null}));}break;}return _0x562c9e;}})[_0x7a01('0x22')](respondWithResult(_0x317e27,null))[_0x7a01('0x2d')](handleError(_0x317e27,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index 35d7087..4a26bc0 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 _0x42fd=['../../mysqldb','SmsMessage','setMaxListeners','save','update','remove','emit','hook','exports','events'];(function(_0x5cff4e,_0x4daca2){var _0x23ebd5=function(_0x2e275d){while(--_0x2e275d){_0x5cff4e['push'](_0x5cff4e['shift']());}};_0x23ebd5(++_0x4daca2);}(_0x42fd,0x12b));var _0xd42f=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0x42fd[_0x2160a9];return _0xa88cf7;};'use strict';var EventEmitter=require(_0xd42f('0x0'));var SmsMessage=require(_0xd42f('0x1'))['db'][_0xd42f('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0xd42f('0x3')](0x0);var events={'afterCreate':_0xd42f('0x4'),'afterUpdate':_0xd42f('0x5'),'afterDestroy':_0xd42f('0x6')};function emitEvent(_0x5253aa){return function(_0x47b833,_0x374166,_0x392791){SmsMessageEvents['emit'](_0x5253aa+':'+_0x47b833['id'],_0x47b833);SmsMessageEvents[_0xd42f('0x7')](_0x5253aa,_0x47b833);_0x392791(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsMessage[_0xd42f('0x8')](e,emitEvent(event));}}module[_0xd42f('0x9')]=SmsMessageEvents; \ No newline at end of file +var _0xb705=['hasOwnProperty','hook','exports','events','../../mysqldb','SmsMessage','setMaxListeners','update','remove','emit'];(function(_0xbca15c,_0x5ac4cc){var _0x2f2a88=function(_0x1ab4b6){while(--_0x1ab4b6){_0xbca15c['push'](_0xbca15c['shift']());}};_0x2f2a88(++_0x5ac4cc);}(_0xb705,0x1ed));var _0x5b70=function(_0x127687,_0x3e1464){_0x127687=_0x127687-0x0;var _0x3f0b7e=_0xb705[_0x127687];return _0x3f0b7e;};'use strict';var EventEmitter=require(_0x5b70('0x0'));var SmsMessage=require(_0x5b70('0x1'))['db'][_0x5b70('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x5b70('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x5b70('0x4'),'afterDestroy':_0x5b70('0x5')};function emitEvent(_0x247ea4){return function(_0x1f60f2,_0x40013a,_0x4f3e2a){SmsMessageEvents['emit'](_0x247ea4+':'+_0x1f60f2['id'],_0x1f60f2);SmsMessageEvents[_0x5b70('0x6')](_0x247ea4,_0x1f60f2);_0x4f3e2a(null);};}for(var e in events){if(events[_0x5b70('0x7')](e)){var event=events[e];SmsMessage[_0x5b70('0x8')](e,emitEvent(event));}}module[_0x5b70('0x9')]=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index c5a7f91..c9502f6 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 _0x5cdd=['status','message','refid','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','./smsMessage.attributes','exports','define','SmsMessage','sms_messages','messageId','fti_sms_messages','body','FULLTEXT','models','direction','toLowerCase','SmsInteraction','findOne','SmsInteractionId','then','update','catch','error','secret','SmsAccount','find','SmsAccountId','type','twilio','accountSid','authToken','phone','messages','create','/api/sms/messages/','sid','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','sender','&password=','GET','POST','user_key','session_key','total_sent','internal_order_id','deliveryReport','read','skebby','inspect','Missing\x20parameters:\x20username,\x20password','https://smsapi.connectel.se/api/send/','requestid','connectel','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','senderString','format','%s:%s','base64','http_code','data','head','message_id','clickSend','plivo','authId','remote','/status?token=','token','Basic\x20%s','toString','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/sms/2/text/advanced','application/json','Missing\x20parameters:\x20base_url','csc','crypto','apiKey','timestamp','sort','createHash','md5','digest','hex','signature=','id_sms','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','uuid','apiMessageId','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','code','https://api.intelepeer.com/_rest/v4/app/sms/mdr','Bearer\x20'];(function(_0x2adac5,_0x38fea6){var _0x1661ab=function(_0x10797b){while(--_0x10797b){_0x2adac5['push'](_0x2adac5['shift']());}};_0x1661ab(++_0x38fea6);}(_0x5cdd,0x1db));var _0xd5cd=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x5cdd[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0xd5cd('0x0'));var util=require(_0xd5cd('0x1'));var logger=require(_0xd5cd('0x2'))(_0xd5cd('0x3'));var moment=require(_0xd5cd('0x4'));var BPromise=require(_0xd5cd('0x5'));var rp=require(_0xd5cd('0x6'));var fs=require('fs');var path=require(_0xd5cd('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xd5cd('0x8'));module[_0xd5cd('0x9')]=function(_0x5efa43,_0x3b4728){return _0x5efa43[_0xd5cd('0xa')](_0xd5cd('0xb'),attributes,{'tableName':_0xd5cd('0xc'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0xd5cd('0xd')]},{'name':_0xd5cd('0xe'),'fields':[_0xd5cd('0xf')],'type':_0xd5cd('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2a995a,_0x434c8e,_0x3fcc6f){var _0x4382de=_0x5efa43[_0xd5cd('0x11')];var _0xdfcf09=_0x2a995a['get']({'plain':!![]});if(_0xdfcf09[_0xd5cd('0x12')][_0xd5cd('0x13')]()==='in'||_0xdfcf09[_0xd5cd('0x12')][_0xd5cd('0x13')]()==='out'&&!_0xdfcf09['secret']&&!_['isNil'](_0xdfcf09['UserId'])){_0x4382de[_0xd5cd('0x14')][_0xd5cd('0x15')]({'where':{'id':_0xdfcf09[_0xd5cd('0x16')]}})[_0xd5cd('0x17')](function(_0x5c69f8){if(_0x5c69f8){_0x5c69f8[_0xd5cd('0x18')]({'lastMsgAt':_0xdfcf09['createdAt'],'lastMsgDirection':_0xdfcf09[_0xd5cd('0x12')][_0xd5cd('0x13')]()});}})[_0xd5cd('0x19')](function(_0x185d62){console[_0xd5cd('0x1a')](_0x185d62);});}if(_0xdfcf09['direction']==='out'&&!_0xdfcf09[_0xd5cd('0x1b')]){var _0x153724;_0x4382de[_0xd5cd('0x1c')][_0xd5cd('0x1d')]({'where':{'id':_0xdfcf09[_0xd5cd('0x1e')]},'raw':!![]})['then'](function(_0x142c6c){_0x153724=_0x142c6c;if(_0x153724&&_0x153724[_0xd5cd('0x1f')]){switch(_0x153724[_0xd5cd('0x1f')]){case _0xd5cd('0x20'):var _0x3cefbd=require('twilio');if(_0x153724[_0xd5cd('0x21')]&&_0x153724[_0xd5cd('0x22')]&&_0x153724[_0xd5cd('0x23')]){var _0x1180d4=new _0x3cefbd(_0x153724[_0xd5cd('0x21')],_0x153724[_0xd5cd('0x22')]);_0x1180d4[_0xd5cd('0x24')][_0xd5cd('0x25')]({'body':_0xdfcf09[_0xd5cd('0xf')],'to':_0xdfcf09[_0xd5cd('0x23')],'from':_0x153724['phone'],'statusCallback':_0x153724['remote']+_0xd5cd('0x26')+_0xdfcf09['id']+'/status?token='+_0x153724['token']})['then'](function(_0x56cc80){if(_0x56cc80[_0xd5cd('0x27')]){return _0x2a995a[_0xd5cd('0x18')]({'messageId':_0x56cc80[_0xd5cd('0x27')]});}})[_0xd5cd('0x19')](function(_0x299dea){logger['error'](_0xd5cd('0x28'),'afterCreate',_0xd5cd('0x20'),util['inspect'](_0x299dea,{'showHidden':![],'depth':null}));});}else{logger[_0xd5cd('0x1a')](_0xd5cd('0x28'),_0xd5cd('0x29'),'twilio',_0xd5cd('0x2a'));}break;case'skebby':var _0x347b6b=_0xd5cd('0x2b');if(_0x153724[_0xd5cd('0x2c')]&&_0x153724[_0xd5cd('0x2d')]){var _0x1d5611={'recipient':[_0xdfcf09['phone']],'message':_0xdfcf09[_0xd5cd('0xf')],'message_type':_0x153724[_0xd5cd('0x2e')]};if(_0x153724[_0xd5cd('0x2e')]&&_0x153724['smsMethod']!=='SI'){_0x1d5611[_0xd5cd('0x2f')]=_0x153724[_0xd5cd('0x23')];}var _0x17d5b6={'url':_0x347b6b+'login?username='+_0x153724['username']+_0xd5cd('0x30')+_0x153724[_0xd5cd('0x2d')],'method':_0xd5cd('0x31')};rp(_0x17d5b6)[_0xd5cd('0x17')](function(_0x6b03bb){var _0xcdbcf=_0x6b03bb['split'](';');var _0x548bc8={'user_key':_0xcdbcf[0x0],'session_key':_0xcdbcf[0x1]};_0x17d5b6={'url':_0x347b6b+'sms','method':_0xd5cd('0x32'),'headers':{'user_key':_0x548bc8[_0xd5cd('0x33')],'Session_key':_0x548bc8[_0xd5cd('0x34')]},'json':!![],'body':_0x1d5611};return rp(_0x17d5b6);})[_0xd5cd('0x17')](function(_0x5a4e44){if(_0x5a4e44[_0xd5cd('0x35')]>=0x1){var _0x57af9f={'messageId':_0x5a4e44[_0xd5cd('0x36')]};if(_0x153724['smsMethod']!=='GP'||!_0x153724[_0xd5cd('0x37')]){_0x57af9f[_0xd5cd('0x38')]=!![];}return _0x2a995a[_0xd5cd('0x18')](_0x57af9f);}else{return logger[_0xd5cd('0x1a')](_0xd5cd('0x28'),'afterCreate',_0xd5cd('0x39'),util[_0xd5cd('0x3a')](_0x5a4e44,{'showHidden':![],'depth':null}));}})[_0xd5cd('0x19')](function(_0x481fc7){return logger[_0xd5cd('0x1a')](_0xd5cd('0x28'),_0xd5cd('0x29'),_0xd5cd('0x39'),util['inspect'](_0x481fc7,{'showHidden':![],'depth':null}));});}else{logger[_0xd5cd('0x1a')](_0xd5cd('0x28'),_0xd5cd('0x29'),_0xd5cd('0x39'),_0xd5cd('0x3b'));}break;case'connectel':if(_0x153724['authToken']){var _0xe7835d={'recipient':_0xdfcf09[_0xd5cd('0x23')],'message':_0xdfcf09['body'],'sender':_0x153724['senderString']||_0x153724[_0xd5cd('0x23')],'authorization':_0x153724['authToken']};var _0x434c8e={'method':_0xd5cd('0x32'),'uri':_0xd5cd('0x3c'),'body':_0xe7835d,'json':!![]};rp(_0x434c8e)[_0xd5cd('0x17')](function(_0x3acf67){var _0x52d597={'messageId':_0x3acf67[_0xd5cd('0x3d')]};if(!_0x153724[_0xd5cd('0x37')]){_0x52d597[_0xd5cd('0x38')]=!![];}return _0x2a995a['update'](_0x52d597);})['catch'](function(_0x554bc6){logger[_0xd5cd('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xd5cd('0x29'),'connectel',util[_0xd5cd('0x3a')](_0x554bc6,{'showHidden':![],'depth':null}));});}else{logger[_0xd5cd('0x1a')](_0xd5cd('0x28'),_0xd5cd('0x29'),_0xd5cd('0x3e'),_0xd5cd('0x3f'));}break;case _0xd5cd('0x40'):if(_0x153724[_0xd5cd('0x2c')]&&_0x153724[_0xd5cd('0x2d')]){var _0xe7835d={'messages':[{'source':_0xd5cd('0x41'),'to':_0xdfcf09[_0xd5cd('0x23')],'body':_0xdfcf09['body'],'from':_0x153724[_0xd5cd('0x42')]||_0x153724[_0xd5cd('0x23')]}]};var _0x4e0324=util[_0xd5cd('0x43')](_0xd5cd('0x44'),_0x153724[_0xd5cd('0x2c')],_0x153724[_0xd5cd('0x2d')]);var _0x434c8e={'method':_0xd5cd('0x32'),'uri':'https://rest.clicksend.com/v3/sms/send','body':_0xe7835d,'headers':{'Authorization':util[_0xd5cd('0x43')]('Basic\x20%s',new Buffer(_0x4e0324)['toString'](_0xd5cd('0x45')))},'json':!![]};rp(_0x434c8e)[_0xd5cd('0x17')](function(_0x17d63e){if(_0x17d63e[_0xd5cd('0x46')]>=0xc8&&_0x17d63e[_0xd5cd('0x46')]<=0xce){if(_0x17d63e[_0xd5cd('0x47')]&&_0x17d63e['data']['queued_count']>0x0){var _0x33234f=_[_0xd5cd('0x48')](_0x17d63e[_0xd5cd('0x47')]['messages']);var _0x18ec4a={'messageId':_0x33234f[_0xd5cd('0x49')]};if(!_0x153724[_0xd5cd('0x37')]){_0x18ec4a['read']=!![];}return _0x2a995a['update'](_0x18ec4a);}else{logger[_0xd5cd('0x1a')](_0xd5cd('0x28'),_0xd5cd('0x29'),_0xd5cd('0x4a'),util[_0xd5cd('0x3a')](_0x17d63e,{'showHidden':![],'depth':null}));}}else{logger[_0xd5cd('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xd5cd('0x29'),_0xd5cd('0x4a'),util[_0xd5cd('0x3a')](_0x17d63e,{'showHidden':![],'depth':null}));}})[_0xd5cd('0x19')](function(_0x1b5f4f){logger[_0xd5cd('0x1a')](_0xd5cd('0x28'),_0xd5cd('0x29'),_0xd5cd('0x4a'),util[_0xd5cd('0x3a')](_0x1b5f4f,{'showHidden':![],'depth':null}));});}else{logger[_0xd5cd('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xd5cd('0x4a'),_0xd5cd('0x3b'));}break;case _0xd5cd('0x4b'):if(_0x153724[_0xd5cd('0x4c')]&&_0x153724[_0xd5cd('0x22')]){var _0xe7835d={'dst':_0xdfcf09[_0xd5cd('0x23')],'text':_0xdfcf09['body'],'src':_0x153724[_0xd5cd('0x42')]||_0x153724[_0xd5cd('0x23')],'url':_0x153724[_0xd5cd('0x4d')]+_0xd5cd('0x26')+_0xdfcf09['id']+_0xd5cd('0x4e')+_0x153724[_0xd5cd('0x4f')]};var _0x4e0324=util[_0xd5cd('0x43')](_0xd5cd('0x44'),_0x153724[_0xd5cd('0x4c')],_0x153724['authToken']);var _0x434c8e={'method':_0xd5cd('0x32'),'uri':util['format']('https://api.plivo.com/v1/Account/%s/Message/',_0x153724[_0xd5cd('0x4c')]),'body':_0xe7835d,'headers':{'Authorization':util[_0xd5cd('0x43')](_0xd5cd('0x50'),new Buffer(_0x4e0324)[_0xd5cd('0x51')](_0xd5cd('0x45')))},'json':!![]};rp(_0x434c8e)[_0xd5cd('0x17')](function(_0x3914d3){var _0x36ecb5={'messageId':_0x3914d3[_0xd5cd('0x52')][0x0]};return _0x2a995a['update'](_0x36ecb5);})['catch'](function(_0x2fccd1){logger[_0xd5cd('0x1a')](_0xd5cd('0x28'),_0xd5cd('0x29'),_0xd5cd('0x4b'),util['inspect'](_0x2fccd1,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xd5cd('0x28'),_0xd5cd('0x29'),_0xd5cd('0x4b'),_0xd5cd('0x53'));}break;case _0xd5cd('0x54'):if(_0x153724[_0xd5cd('0x2c')]&&_0x153724[_0xd5cd('0x2d')]){if(_0x153724[_0xd5cd('0x55')]){var _0x2cbaa0={'method':_0xd5cd('0x32'),'uri':_0x153724[_0xd5cd('0x55')]+'/auth/1/session','body':{'username':_0x153724[_0xd5cd('0x2c')],'password':_0x153724[_0xd5cd('0x2d')]},'json':!![]};return rp(_0x2cbaa0)[_0xd5cd('0x17')](function(_0x2b09b9){var _0x132320={'method':'POST','uri':_0x153724[_0xd5cd('0x55')]+_0xd5cd('0x56'),'body':{'messages':[{'from':_0x153724['phone'],'destinations':[{'to':_0xdfcf09[_0xd5cd('0x23')]}],'text':_0xdfcf09[_0xd5cd('0xf')],'notifyUrl':_0x153724[_0xd5cd('0x4d')]+'/api/sms/messages/'+_0xdfcf09['id']+'/status?token='+_0x153724['token'],'notifyContentType':_0xd5cd('0x57'),'callbackData':_0x153724[_0xd5cd('0x23')]+';'+_0xdfcf09[_0xd5cd('0xf')]}]},'headers':{'Authorization':'IBSSO\x20'+_0x2b09b9[_0xd5cd('0x4f')]},'json':!![]};return rp(_0x132320)[_0xd5cd('0x17')](function(_0x305008){if(_0x305008['messages']){var _0x4463c1={'messageId':_0x305008['messages'][0x0]['messageId']};if(!_0x153724['deliveryReport']){_0x4463c1['read']=!![];}return _0x2a995a['update'](_0x4463c1);}else{return logger['error'](_0xd5cd('0x28'),_0xd5cd('0x29'),_0xd5cd('0x54'),util['inspect'](_0x305008,{'showHidden':![],'depth':null}));}});})['catch'](function(_0x25111e){return logger[_0xd5cd('0x1a')](_0xd5cd('0x28'),_0xd5cd('0x29'),_0xd5cd('0x54'),util[_0xd5cd('0x3a')](_0x25111e,{'showHidden':![],'depth':null}));});}else{logger[_0xd5cd('0x1a')](_0xd5cd('0x28'),_0xd5cd('0x29'),_0xd5cd('0x54'),_0xd5cd('0x58'));}}else{logger[_0xd5cd('0x1a')](_0xd5cd('0x28'),_0xd5cd('0x29'),'infobip','Missing\x20parameters:\x20username,\x20password');}break;case _0xd5cd('0x59'):var _0x339e99=require(_0xd5cd('0x5a'));if(_0x153724[_0xd5cd('0x5b')]){var _0x7e0408={};_0x7e0408['login']=_0x153724[_0xd5cd('0x2c')];_0x7e0408[_0xd5cd('0x23')]=_0xdfcf09['phone'];_0x7e0408[_0xd5cd('0x2f')]=_0x153724[_0xd5cd('0x23')];_0x7e0408['text']=_0xdfcf09['body'];_0x7e0408[_0xd5cd('0x5c')]=+new Date();var _0x2a8b6c='';var _0x5064b3='';var _0x192f7a=Object['keys'](_0x7e0408);_0x192f7a[_0xd5cd('0x5d')]();for(var _0x107a0c=0x0;_0x107a0c<_0x192f7a['length'];_0x107a0c++){if(_0x2a8b6c!=''){_0x2a8b6c+='&';}_0x2a8b6c+=_0x192f7a[_0x107a0c]+'='+encodeURIComponent(_0x7e0408[_0x192f7a[_0x107a0c]]);_0x5064b3+=_0x7e0408[_0x192f7a[_0x107a0c]];}_0x5064b3+=_0x153724[_0xd5cd('0x5b')];_0x5064b3=_0x339e99[_0xd5cd('0x5e')](_0xd5cd('0x5f'))[_0xd5cd('0x18')](_0x5064b3)[_0xd5cd('0x60')](_0xd5cd('0x61'));if(_0x2a8b6c!==''){_0x2a8b6c+='&';}_0x2a8b6c+=_0xd5cd('0x62')+_0x5064b3;var _0x17d5b6={'method':_0xd5cd('0x31'),'uri':_0x153724['baseUrl']+'/external/get/send.php?'+_0x2a8b6c,'json':!![]};return rp(_0x17d5b6)[_0xd5cd('0x17')](function(_0x2c62a1){var _0x3c05b6=Object['keys'](_0x2c62a1);if(_0x2c62a1[_0x3c05b6[0x0]][_0xd5cd('0x1a')]&&parseInt(_0x2c62a1[_0x3c05b6[0x0]][_0xd5cd('0x1a')])===0x0){var _0x46dc7c={'messageId':_0x2c62a1[_0x3c05b6[0x0]][_0xd5cd('0x63')]};if(!_0x153724['deliveryReport']){_0x46dc7c['read']=!![];}return _0x2a995a[_0xd5cd('0x18')](_0x46dc7c);}else{return logger['error'](_0xd5cd('0x28'),_0xd5cd('0x29'),_0xd5cd('0x59'),util[_0xd5cd('0x3a')](_0x2c62a1[_0xd5cd('0x1a')],{'showHidden':![],'depth':null}));}})[_0xd5cd('0x19')](function(_0xc69d8a){return logger[_0xd5cd('0x1a')](_0xd5cd('0x28'),_0xd5cd('0x29'),_0xd5cd('0x59'),util['inspect'](_0xc69d8a,{'showHidden':![],'depth':null}));});}else{logger[_0xd5cd('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xd5cd('0x29'),_0xd5cd('0x59'),_0xd5cd('0x64'));}break;case _0xd5cd('0x65'):if(_0x153724['apiKey']){var _0x5aebd6={'method':_0xd5cd('0x32'),'uri':_0xd5cd('0x66'),'headers':{'Authorization':_0x153724[_0xd5cd('0x5b')]},'body':{'content':_0xdfcf09['body'],'to':[_0xdfcf09[_0xd5cd('0x23')]],'from':_0x153724[_0xd5cd('0x23')],'binary':![],'clientMessageId':_0xd5cd('0x67'),'charset':'UTF-8'},'json':!![]};rp(_0x5aebd6)['then'](function(_0x25d14a){if(!_0x25d14a[_0xd5cd('0x1a')]){var _0x18b403={'messageId':_0x25d14a[_0xd5cd('0x24')][0x0][_0xd5cd('0x68')]};if(!_0x153724[_0xd5cd('0x37')]){_0x18b403[_0xd5cd('0x38')]=!![];}return _0x2a995a['update'](_0x18b403);}else{return logger[_0xd5cd('0x1a')](_0xd5cd('0x28'),_0xd5cd('0x29'),_0xd5cd('0x65'),util['inspect'](_0x25d14a[_0xd5cd('0x1a')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x5c7c12){return logger[_0xd5cd('0x1a')](_0xd5cd('0x28'),_0xd5cd('0x29'),_0xd5cd('0x65'),util[_0xd5cd('0x3a')](_0x5c7c12,{'showHidden':![],'depth':null}));});}else{logger[_0xd5cd('0x1a')](_0xd5cd('0x28'),_0xd5cd('0x29'),_0xd5cd('0x65'),'Missing\x20parameters:\x20apiKey');}break;case _0xd5cd('0x69'):if(_0x153724[_0xd5cd('0x5b')]){var _0x4c2030={};var _0x17d5b6={'method':'POST','uri':_0xd5cd('0x6a'),'headers':{'Authorization':'Bearer\x20'+_0x153724[_0xd5cd('0x5b')],'Content-Type':_0xd5cd('0x57')},'body':{'from':_0x153724[_0xd5cd('0x23')],'to':_0xdfcf09[_0xd5cd('0x23')],'text':_0xdfcf09[_0xd5cd('0xf')]},'json':!![]};return rp(_0x17d5b6)[_0xd5cd('0x17')](function(_0x59ce6c){if(_0x59ce6c[_0xd5cd('0x6b')]==0xca){_0x4c2030['message']=_0x59ce6c;var _0x5aca95={'method':'POST','uri':_0xd5cd('0x6c'),'headers':{'Authorization':_0xd5cd('0x6d')+_0x153724[_0xd5cd('0x5b')],'Content-Type':_0xd5cd('0x57')},'body':{'refid':_0x4c2030['message']['refid']},'json':!![]};return rp(_0x5aca95)[_0xd5cd('0x17')](function(_0x4deaf4){_0x4c2030[_0xd5cd('0x6e')]=_0x4deaf4;var _0x22191b={'messageId':_0x4c2030[_0xd5cd('0x6f')][_0xd5cd('0x70')],'read':!![]};return _0x2a995a[_0xd5cd('0x18')](_0x22191b);});}else{return logger[_0xd5cd('0x1a')](_0xd5cd('0x28'),'afterCreate',_0xd5cd('0x69'),util[_0xd5cd('0x3a')](_0x59ce6c,{'showHidden':![],'depth':null}));}})[_0xd5cd('0x19')](function(_0x25029b){return logger[_0xd5cd('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','intelepeer',util['inspect'](_0x25029b,{'showHidden':![],'depth':null}));});}else{return logger[_0xd5cd('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xd5cd('0x29'),_0xd5cd('0x69'),_0xd5cd('0x71'));}break;}}})[_0xd5cd('0x72')](function(){_0x3fcc6f();});}else{_0x3fcc6f();}}},'charset':_0xd5cd('0x73'),'collate':_0xd5cd('0x74')});}; \ No newline at end of file +var _0xce35=['get','direction','toLowerCase','secret','isNil','UserId','SmsInteraction','findOne','SmsInteractionId','then','update','catch','SmsAccount','find','SmsAccountId','type','twilio','accountSid','phone','authToken','messages','create','remote','/status?token=','token','sid','error','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','sender','login?username=','&password=','GET','split','sms','POST','user_key','total_sent','deliveryReport','read','inspect','Missing\x20parameters:\x20username,\x20password','https://smsapi.connectel.se/api/send/','requestid','connectel','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','senderString','format','%s:%s','https://rest.clicksend.com/v3/sms/send','toString','base64','http_code','data','queued_count','message_id','clickSend','authId','https://api.plivo.com/v1/Account/%s/Message/','Basic\x20%s','plivo','Missing\x20parameters:\x20authId,\x20authToken','baseUrl','/sms/2/text/advanced','/api/sms/messages/','IBSSO\x20','infobip','Missing\x20parameters:\x20base_url','csc','apiKey','login','text','timestamp','keys','sort','length','createHash','md5','digest','signature=','/external/get/send.php?','Missing\x20parameters:\x20apiKey','clickatell','UTF-8','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','application/json','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','status','finally','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsMessage.attributes','exports','define','SmsMessage','messageId','fti_sms_messages','body','FULLTEXT','models'];(function(_0x26d671,_0x10b2f0){var _0x2837e5=function(_0x6f0c93){while(--_0x6f0c93){_0x26d671['push'](_0x26d671['shift']());}};_0x2837e5(++_0x10b2f0);}(_0xce35,0x15b));var _0x5ce3=function(_0x270d1f,_0x58541d){_0x270d1f=_0x270d1f-0x0;var _0x1e3de3=_0xce35[_0x270d1f];return _0x1e3de3;};'use strict';var _=require(_0x5ce3('0x0'));var util=require(_0x5ce3('0x1'));var logger=require(_0x5ce3('0x2'))(_0x5ce3('0x3'));var moment=require(_0x5ce3('0x4'));var BPromise=require(_0x5ce3('0x5'));var rp=require(_0x5ce3('0x6'));var fs=require('fs');var path=require(_0x5ce3('0x7'));var rimraf=require(_0x5ce3('0x8'));var config=require(_0x5ce3('0x9'));var attributes=require(_0x5ce3('0xa'));module[_0x5ce3('0xb')]=function(_0x236919,_0x28ab15){return _0x236919[_0x5ce3('0xc')](_0x5ce3('0xd'),attributes,{'tableName':'sms_messages','paranoid':![],'indexes':[{'name':'messageId','fields':[_0x5ce3('0xe')]},{'name':_0x5ce3('0xf'),'fields':[_0x5ce3('0x10')],'type':_0x5ce3('0x11')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x22e5bc,_0x197b00,_0x117c32){var _0x413772=_0x236919[_0x5ce3('0x12')];var _0x66426=_0x22e5bc[_0x5ce3('0x13')]({'plain':!![]});if(_0x66426['direction']['toLowerCase']()==='in'||_0x66426[_0x5ce3('0x14')][_0x5ce3('0x15')]()==='out'&&!_0x66426[_0x5ce3('0x16')]&&!_[_0x5ce3('0x17')](_0x66426[_0x5ce3('0x18')])){_0x413772[_0x5ce3('0x19')][_0x5ce3('0x1a')]({'where':{'id':_0x66426[_0x5ce3('0x1b')]}})[_0x5ce3('0x1c')](function(_0x579c2b){if(_0x579c2b){_0x579c2b[_0x5ce3('0x1d')]({'lastMsgAt':_0x66426['createdAt'],'lastMsgDirection':_0x66426[_0x5ce3('0x14')][_0x5ce3('0x15')]()});}})[_0x5ce3('0x1e')](function(_0x8b4a38){console['error'](_0x8b4a38);});}if(_0x66426[_0x5ce3('0x14')]==='out'&&!_0x66426[_0x5ce3('0x16')]){var _0x18125b;_0x413772[_0x5ce3('0x1f')][_0x5ce3('0x20')]({'where':{'id':_0x66426[_0x5ce3('0x21')]},'raw':!![]})['then'](function(_0x3152ac){_0x18125b=_0x3152ac;if(_0x18125b&&_0x18125b[_0x5ce3('0x22')]){switch(_0x18125b[_0x5ce3('0x22')]){case'twilio':var _0x3276e6=require(_0x5ce3('0x23'));if(_0x18125b[_0x5ce3('0x24')]&&_0x18125b['authToken']&&_0x18125b[_0x5ce3('0x25')]){var _0x45031f=new _0x3276e6(_0x18125b[_0x5ce3('0x24')],_0x18125b[_0x5ce3('0x26')]);_0x45031f[_0x5ce3('0x27')][_0x5ce3('0x28')]({'body':_0x66426['body'],'to':_0x66426[_0x5ce3('0x25')],'from':_0x18125b[_0x5ce3('0x25')],'statusCallback':_0x18125b[_0x5ce3('0x29')]+'/api/sms/messages/'+_0x66426['id']+_0x5ce3('0x2a')+_0x18125b[_0x5ce3('0x2b')]})['then'](function(_0x1068b6){if(_0x1068b6[_0x5ce3('0x2c')]){return _0x22e5bc['update']({'messageId':_0x1068b6['sid']});}})['catch'](function(_0x17e148){logger[_0x5ce3('0x2d')](_0x5ce3('0x2e'),_0x5ce3('0x2f'),'twilio',util['inspect'](_0x17e148,{'showHidden':![],'depth':null}));});}else{logger[_0x5ce3('0x2d')](_0x5ce3('0x2e'),'afterCreate',_0x5ce3('0x23'),_0x5ce3('0x30'));}break;case _0x5ce3('0x31'):var _0x46ec27=_0x5ce3('0x32');if(_0x18125b[_0x5ce3('0x33')]&&_0x18125b[_0x5ce3('0x34')]){var _0x3dff01={'recipient':[_0x66426[_0x5ce3('0x25')]],'message':_0x66426[_0x5ce3('0x10')],'message_type':_0x18125b[_0x5ce3('0x35')]};if(_0x18125b[_0x5ce3('0x35')]&&_0x18125b[_0x5ce3('0x35')]!=='SI'){_0x3dff01[_0x5ce3('0x36')]=_0x18125b['phone'];}var _0x38b3fe={'url':_0x46ec27+_0x5ce3('0x37')+_0x18125b[_0x5ce3('0x33')]+_0x5ce3('0x38')+_0x18125b[_0x5ce3('0x34')],'method':_0x5ce3('0x39')};rp(_0x38b3fe)[_0x5ce3('0x1c')](function(_0x95e179){var _0x580186=_0x95e179[_0x5ce3('0x3a')](';');var _0x1d0533={'user_key':_0x580186[0x0],'session_key':_0x580186[0x1]};_0x38b3fe={'url':_0x46ec27+_0x5ce3('0x3b'),'method':_0x5ce3('0x3c'),'headers':{'user_key':_0x1d0533[_0x5ce3('0x3d')],'Session_key':_0x1d0533['session_key']},'json':!![],'body':_0x3dff01};return rp(_0x38b3fe);})[_0x5ce3('0x1c')](function(_0x5833ed){if(_0x5833ed[_0x5ce3('0x3e')]>=0x1){var _0x309b5f={'messageId':_0x5833ed['internal_order_id']};if(_0x18125b[_0x5ce3('0x35')]!=='GP'||!_0x18125b[_0x5ce3('0x3f')]){_0x309b5f[_0x5ce3('0x40')]=!![];}return _0x22e5bc['update'](_0x309b5f);}else{return logger[_0x5ce3('0x2d')](_0x5ce3('0x2e'),_0x5ce3('0x2f'),'skebby',util[_0x5ce3('0x41')](_0x5833ed,{'showHidden':![],'depth':null}));}})[_0x5ce3('0x1e')](function(_0x3ade2e){return logger['error'](_0x5ce3('0x2e'),_0x5ce3('0x2f'),_0x5ce3('0x31'),util[_0x5ce3('0x41')](_0x3ade2e,{'showHidden':![],'depth':null}));});}else{logger[_0x5ce3('0x2d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x5ce3('0x2f'),_0x5ce3('0x31'),_0x5ce3('0x42'));}break;case'connectel':if(_0x18125b[_0x5ce3('0x26')]){var _0xe0a4ea={'recipient':_0x66426['phone'],'message':_0x66426[_0x5ce3('0x10')],'sender':_0x18125b['senderString']||_0x18125b[_0x5ce3('0x25')],'authorization':_0x18125b[_0x5ce3('0x26')]};var _0x197b00={'method':_0x5ce3('0x3c'),'uri':_0x5ce3('0x43'),'body':_0xe0a4ea,'json':!![]};rp(_0x197b00)['then'](function(_0x226d7b){var _0x33e022={'messageId':_0x226d7b[_0x5ce3('0x44')]};if(!_0x18125b['deliveryReport']){_0x33e022[_0x5ce3('0x40')]=!![];}return _0x22e5bc[_0x5ce3('0x1d')](_0x33e022);})[_0x5ce3('0x1e')](function(_0x120121){logger[_0x5ce3('0x2d')](_0x5ce3('0x2e'),_0x5ce3('0x2f'),'connectel',util[_0x5ce3('0x41')](_0x120121,{'showHidden':![],'depth':null}));});}else{logger[_0x5ce3('0x2d')](_0x5ce3('0x2e'),_0x5ce3('0x2f'),_0x5ce3('0x45'),_0x5ce3('0x46'));}break;case _0x5ce3('0x47'):if(_0x18125b[_0x5ce3('0x33')]&&_0x18125b[_0x5ce3('0x34')]){var _0xe0a4ea={'messages':[{'source':_0x5ce3('0x48'),'to':_0x66426[_0x5ce3('0x25')],'body':_0x66426[_0x5ce3('0x10')],'from':_0x18125b[_0x5ce3('0x49')]||_0x18125b[_0x5ce3('0x25')]}]};var _0x2ad47a=util[_0x5ce3('0x4a')](_0x5ce3('0x4b'),_0x18125b[_0x5ce3('0x33')],_0x18125b[_0x5ce3('0x34')]);var _0x197b00={'method':_0x5ce3('0x3c'),'uri':_0x5ce3('0x4c'),'body':_0xe0a4ea,'headers':{'Authorization':util[_0x5ce3('0x4a')]('Basic\x20%s',new Buffer(_0x2ad47a)[_0x5ce3('0x4d')](_0x5ce3('0x4e')))},'json':!![]};rp(_0x197b00)[_0x5ce3('0x1c')](function(_0x3058e5){if(_0x3058e5['http_code']>=0xc8&&_0x3058e5[_0x5ce3('0x4f')]<=0xce){if(_0x3058e5[_0x5ce3('0x50')]&&_0x3058e5[_0x5ce3('0x50')][_0x5ce3('0x51')]>0x0){var _0x499e50=_['head'](_0x3058e5[_0x5ce3('0x50')][_0x5ce3('0x27')]);var _0x10160a={'messageId':_0x499e50[_0x5ce3('0x52')]};if(!_0x18125b[_0x5ce3('0x3f')]){_0x10160a[_0x5ce3('0x40')]=!![];}return _0x22e5bc[_0x5ce3('0x1d')](_0x10160a);}else{logger['error'](_0x5ce3('0x2e'),_0x5ce3('0x2f'),_0x5ce3('0x53'),util['inspect'](_0x3058e5,{'showHidden':![],'depth':null}));}}else{logger[_0x5ce3('0x2d')](_0x5ce3('0x2e'),_0x5ce3('0x2f'),_0x5ce3('0x53'),util['inspect'](_0x3058e5,{'showHidden':![],'depth':null}));}})[_0x5ce3('0x1e')](function(_0x1b8f9d){logger[_0x5ce3('0x2d')](_0x5ce3('0x2e'),_0x5ce3('0x2f'),_0x5ce3('0x53'),util[_0x5ce3('0x41')](_0x1b8f9d,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x5ce3('0x2e'),_0x5ce3('0x2f'),_0x5ce3('0x53'),'Missing\x20parameters:\x20username,\x20password');}break;case'plivo':if(_0x18125b[_0x5ce3('0x54')]&&_0x18125b['authToken']){var _0xe0a4ea={'dst':_0x66426['phone'],'text':_0x66426[_0x5ce3('0x10')],'src':_0x18125b[_0x5ce3('0x49')]||_0x18125b['phone'],'url':_0x18125b[_0x5ce3('0x29')]+'/api/sms/messages/'+_0x66426['id']+_0x5ce3('0x2a')+_0x18125b['token']};var _0x2ad47a=util['format'](_0x5ce3('0x4b'),_0x18125b[_0x5ce3('0x54')],_0x18125b[_0x5ce3('0x26')]);var _0x197b00={'method':_0x5ce3('0x3c'),'uri':util[_0x5ce3('0x4a')](_0x5ce3('0x55'),_0x18125b[_0x5ce3('0x54')]),'body':_0xe0a4ea,'headers':{'Authorization':util[_0x5ce3('0x4a')](_0x5ce3('0x56'),new Buffer(_0x2ad47a)[_0x5ce3('0x4d')](_0x5ce3('0x4e')))},'json':!![]};rp(_0x197b00)[_0x5ce3('0x1c')](function(_0x2a68da){var _0x23e384={'messageId':_0x2a68da['message_uuid'][0x0]};return _0x22e5bc[_0x5ce3('0x1d')](_0x23e384);})[_0x5ce3('0x1e')](function(_0x7de548){logger['error'](_0x5ce3('0x2e'),'afterCreate',_0x5ce3('0x57'),util[_0x5ce3('0x41')](_0x7de548,{'showHidden':![],'depth':null}));});}else{logger[_0x5ce3('0x2d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x5ce3('0x2f'),'plivo',_0x5ce3('0x58'));}break;case'infobip':if(_0x18125b[_0x5ce3('0x33')]&&_0x18125b['password']){if(_0x18125b[_0x5ce3('0x59')]){var _0x4f5ee2={'method':'POST','uri':_0x18125b['baseUrl']+'/auth/1/session','body':{'username':_0x18125b[_0x5ce3('0x33')],'password':_0x18125b[_0x5ce3('0x34')]},'json':!![]};return rp(_0x4f5ee2)[_0x5ce3('0x1c')](function(_0x78225a){var _0x72e000={'method':'POST','uri':_0x18125b[_0x5ce3('0x59')]+_0x5ce3('0x5a'),'body':{'messages':[{'from':_0x18125b[_0x5ce3('0x25')],'destinations':[{'to':_0x66426['phone']}],'text':_0x66426[_0x5ce3('0x10')],'notifyUrl':_0x18125b[_0x5ce3('0x29')]+_0x5ce3('0x5b')+_0x66426['id']+_0x5ce3('0x2a')+_0x18125b[_0x5ce3('0x2b')],'notifyContentType':'application/json','callbackData':_0x18125b[_0x5ce3('0x25')]+';'+_0x66426['body']}]},'headers':{'Authorization':_0x5ce3('0x5c')+_0x78225a['token']},'json':!![]};return rp(_0x72e000)['then'](function(_0x122397){if(_0x122397['messages']){var _0x3a8595={'messageId':_0x122397[_0x5ce3('0x27')][0x0]['messageId']};if(!_0x18125b[_0x5ce3('0x3f')]){_0x3a8595['read']=!![];}return _0x22e5bc['update'](_0x3a8595);}else{return logger['error'](_0x5ce3('0x2e'),_0x5ce3('0x2f'),_0x5ce3('0x5d'),util[_0x5ce3('0x41')](_0x122397,{'showHidden':![],'depth':null}));}});})[_0x5ce3('0x1e')](function(_0x1535c1){return logger[_0x5ce3('0x2d')](_0x5ce3('0x2e'),_0x5ce3('0x2f'),_0x5ce3('0x5d'),util[_0x5ce3('0x41')](_0x1535c1,{'showHidden':![],'depth':null}));});}else{logger[_0x5ce3('0x2d')](_0x5ce3('0x2e'),'afterCreate',_0x5ce3('0x5d'),_0x5ce3('0x5e'));}}else{logger[_0x5ce3('0x2d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x5ce3('0x2f'),'infobip','Missing\x20parameters:\x20username,\x20password');}break;case _0x5ce3('0x5f'):var _0x2fe32b=require('crypto');if(_0x18125b[_0x5ce3('0x60')]){var _0x58e52f={};_0x58e52f[_0x5ce3('0x61')]=_0x18125b['username'];_0x58e52f[_0x5ce3('0x25')]=_0x66426[_0x5ce3('0x25')];_0x58e52f['sender']=_0x18125b['phone'];_0x58e52f[_0x5ce3('0x62')]=_0x66426[_0x5ce3('0x10')];_0x58e52f[_0x5ce3('0x63')]=+new Date();var _0x26ce0a='';var _0x34064b='';var _0x40c6c8=Object[_0x5ce3('0x64')](_0x58e52f);_0x40c6c8[_0x5ce3('0x65')]();for(var _0xca6908=0x0;_0xca6908<_0x40c6c8[_0x5ce3('0x66')];_0xca6908++){if(_0x26ce0a!=''){_0x26ce0a+='&';}_0x26ce0a+=_0x40c6c8[_0xca6908]+'='+encodeURIComponent(_0x58e52f[_0x40c6c8[_0xca6908]]);_0x34064b+=_0x58e52f[_0x40c6c8[_0xca6908]];}_0x34064b+=_0x18125b[_0x5ce3('0x60')];_0x34064b=_0x2fe32b[_0x5ce3('0x67')](_0x5ce3('0x68'))[_0x5ce3('0x1d')](_0x34064b)[_0x5ce3('0x69')]('hex');if(_0x26ce0a!==''){_0x26ce0a+='&';}_0x26ce0a+=_0x5ce3('0x6a')+_0x34064b;var _0x38b3fe={'method':_0x5ce3('0x39'),'uri':_0x18125b[_0x5ce3('0x59')]+_0x5ce3('0x6b')+_0x26ce0a,'json':!![]};return rp(_0x38b3fe)[_0x5ce3('0x1c')](function(_0x13d14f){var _0x368af7=Object[_0x5ce3('0x64')](_0x13d14f);if(_0x13d14f[_0x368af7[0x0]][_0x5ce3('0x2d')]&&parseInt(_0x13d14f[_0x368af7[0x0]][_0x5ce3('0x2d')])===0x0){var _0x12baf5={'messageId':_0x13d14f[_0x368af7[0x0]]['id_sms']};if(!_0x18125b[_0x5ce3('0x3f')]){_0x12baf5[_0x5ce3('0x40')]=!![];}return _0x22e5bc[_0x5ce3('0x1d')](_0x12baf5);}else{return logger[_0x5ce3('0x2d')](_0x5ce3('0x2e'),'afterCreate',_0x5ce3('0x5f'),util[_0x5ce3('0x41')](_0x13d14f[_0x5ce3('0x2d')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x56cc8e){return logger[_0x5ce3('0x2d')](_0x5ce3('0x2e'),_0x5ce3('0x2f'),_0x5ce3('0x5f'),util[_0x5ce3('0x41')](_0x56cc8e,{'showHidden':![],'depth':null}));});}else{logger[_0x5ce3('0x2d')](_0x5ce3('0x2e'),_0x5ce3('0x2f'),_0x5ce3('0x5f'),_0x5ce3('0x6c'));}break;case _0x5ce3('0x6d'):if(_0x18125b[_0x5ce3('0x60')]){var _0x4fdbc0={'method':_0x5ce3('0x3c'),'uri':'https://platform.clickatell.com/messages','headers':{'Authorization':_0x18125b[_0x5ce3('0x60')]},'body':{'content':_0x66426[_0x5ce3('0x10')],'to':[_0x66426['phone']],'from':_0x18125b['phone'],'binary':![],'clientMessageId':'uuid','charset':_0x5ce3('0x6e')},'json':!![]};rp(_0x4fdbc0)[_0x5ce3('0x1c')](function(_0x5cd7f3){if(!_0x5cd7f3['error']){var _0x26fa92={'messageId':_0x5cd7f3[_0x5ce3('0x27')][0x0]['apiMessageId']};if(!_0x18125b[_0x5ce3('0x3f')]){_0x26fa92['read']=!![];}return _0x22e5bc[_0x5ce3('0x1d')](_0x26fa92);}else{return logger['error'](_0x5ce3('0x2e'),_0x5ce3('0x2f'),'clickatell',util[_0x5ce3('0x41')](_0x5cd7f3[_0x5ce3('0x2d')],{'showHidden':![],'depth':null}));}})['catch'](function(_0xae7b5d){return logger[_0x5ce3('0x2d')](_0x5ce3('0x2e'),_0x5ce3('0x2f'),_0x5ce3('0x6d'),util[_0x5ce3('0x41')](_0xae7b5d,{'showHidden':![],'depth':null}));});}else{logger[_0x5ce3('0x2d')](_0x5ce3('0x2e'),_0x5ce3('0x2f'),_0x5ce3('0x6d'),_0x5ce3('0x6c'));}break;case _0x5ce3('0x6f'):if(_0x18125b[_0x5ce3('0x60')]){var _0x2f6d83={};var _0x38b3fe={'method':_0x5ce3('0x3c'),'uri':_0x5ce3('0x70'),'headers':{'Authorization':_0x5ce3('0x71')+_0x18125b[_0x5ce3('0x60')],'Content-Type':_0x5ce3('0x72')},'body':{'from':_0x18125b[_0x5ce3('0x25')],'to':_0x66426['phone'],'text':_0x66426[_0x5ce3('0x10')]},'json':!![]};return rp(_0x38b3fe)[_0x5ce3('0x1c')](function(_0x2f4934){if(_0x2f4934[_0x5ce3('0x73')]==0xca){_0x2f6d83[_0x5ce3('0x74')]=_0x2f4934;var _0x3529e5={'method':_0x5ce3('0x3c'),'uri':_0x5ce3('0x75'),'headers':{'Authorization':'Bearer\x20'+_0x18125b[_0x5ce3('0x60')],'Content-Type':_0x5ce3('0x72')},'body':{'refid':_0x2f6d83[_0x5ce3('0x74')][_0x5ce3('0x76')]},'json':!![]};return rp(_0x3529e5)[_0x5ce3('0x1c')](function(_0x2532f3){_0x2f6d83[_0x5ce3('0x77')]=_0x2532f3;var _0x54a8d0={'messageId':_0x2f6d83[_0x5ce3('0x74')][_0x5ce3('0x76')],'read':!![]};return _0x22e5bc['update'](_0x54a8d0);});}else{return logger[_0x5ce3('0x2d')](_0x5ce3('0x2e'),_0x5ce3('0x2f'),_0x5ce3('0x6f'),util['inspect'](_0x2f4934,{'showHidden':![],'depth':null}));}})[_0x5ce3('0x1e')](function(_0x3f2761){return logger[_0x5ce3('0x2d')](_0x5ce3('0x2e'),_0x5ce3('0x2f'),_0x5ce3('0x6f'),util['inspect'](_0x3f2761,{'showHidden':![],'depth':null}));});}else{return logger[_0x5ce3('0x2d')](_0x5ce3('0x2e'),'afterCreate',_0x5ce3('0x6f'),'Token\x20not\x20received');}break;}}})[_0x5ce3('0x78')](function(){_0x117c32();});}else{_0x117c32();}}},'charset':_0x5ce3('0x79'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index e0c2c19..c90c211 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 _0x1a85=['info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSmsMessage','SmsMessage','create','options','raw','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','http','defaults','redis','socket.io-emitter','register','request','then'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x1a85,0x178));var _0x51a8=function(_0x481778,_0x3591a2){_0x481778=_0x481778-0x0;var _0x180616=_0x1a85[_0x481778];return _0x180616;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x51a8('0x0'));var BPromise=require(_0x51a8('0x1'));var rs=require(_0x51a8('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x51a8('0x3'));var logger=require(_0x51a8('0x4'))(_0x51a8('0x5'));var config=require('../../config/environment');var jayson=require(_0x51a8('0x6'));var client=jayson['client'][_0x51a8('0x7')]({'port':0x232a});config['redis']=_[_0x51a8('0x8')](config[_0x51a8('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x51a8('0xa'))(new Redis(config['redis']));require('./smsMessage.socket')[_0x51a8('0xb')](socket);function respondWithRpcPromise(_0x2f276b,_0x1a476d,_0x45a3f4){return new BPromise(function(_0x418f06,_0x421fa4){return client[_0x51a8('0xc')](_0x2f276b,_0x45a3f4)[_0x51a8('0xd')](function(_0x34c887){logger[_0x51a8('0xe')](_0x51a8('0xf'),_0x1a476d,_0x51a8('0x10'));logger[_0x51a8('0x11')](_0x51a8('0x12'),_0x1a476d,_0x51a8('0x10'),JSON[_0x51a8('0x13')](_0x34c887));if(_0x34c887[_0x51a8('0x14')]){if(_0x34c887['error'][_0x51a8('0x15')]===0x1f4){logger[_0x51a8('0x14')](_0x51a8('0xf'),_0x1a476d,_0x34c887['error'][_0x51a8('0x16')]);return _0x421fa4(_0x34c887['error'][_0x51a8('0x16')]);}logger[_0x51a8('0x14')](_0x51a8('0xf'),_0x1a476d,_0x34c887[_0x51a8('0x14')][_0x51a8('0x16')]);return _0x418f06(_0x34c887[_0x51a8('0x14')][_0x51a8('0x16')]);}else{logger['info'](_0x51a8('0xf'),_0x1a476d,_0x51a8('0x10'));_0x418f06(_0x34c887[_0x51a8('0x17')][_0x51a8('0x16')]);}})[_0x51a8('0x18')](function(_0x544886){logger['error'](_0x51a8('0xf'),_0x1a476d,_0x544886);_0x421fa4(_0x544886);});});}exports[_0x51a8('0x19')]=function(_0x2217ce){var _0x2f2681=this;return new Promise(function(_0x2a4c4c,_0x3bc044){return db[_0x51a8('0x1a')][_0x51a8('0x1b')](_0x2217ce['body'],{'raw':_0x2217ce[_0x51a8('0x1c')]?_0x2217ce['options'][_0x51a8('0x1d')]===undefined?!![]:![]:!![]})[_0x51a8('0xd')](function(_0x8bda40){logger[_0x51a8('0xe')]('CreateSmsMessage',_0x2217ce);logger[_0x51a8('0x11')]('CreateSmsMessage',_0x2217ce,JSON['stringify'](_0x8bda40));_0x2a4c4c(_0x8bda40);})[_0x51a8('0x18')](function(_0x52e503){logger[_0x51a8('0x14')](_0x51a8('0x19'),_0x52e503[_0x51a8('0x16')],_0x2217ce);_0x3bc044(_0x2f2681[_0x51a8('0x14')](0x1f4,_0x52e503[_0x51a8('0x16')]));});});}; \ No newline at end of file +var _0x4fc2=['message','info','result','catch','CreateSmsMessage','SmsMessage','body','options','debug','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter','./smsMessage.socket','request','then','SmsMessage,\x20%s,\x20%s','request\x20sent','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x80d733,_0x266211){var _0x435868=function(_0x2ae0f0){while(--_0x2ae0f0){_0x80d733['push'](_0x80d733['shift']());}};_0x435868(++_0x266211);}(_0x4fc2,0x111));var _0x24fc=function(_0x4511e6,_0x2c3afe){_0x4511e6=_0x4511e6-0x0;var _0x573951=_0x4fc2[_0x4511e6];return _0x573951;};'use strict';var _=require(_0x24fc('0x0'));var util=require(_0x24fc('0x1'));var moment=require(_0x24fc('0x2'));var BPromise=require(_0x24fc('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x24fc('0x4'));var db=require(_0x24fc('0x5'))['db'];var utils=require(_0x24fc('0x6'));var logger=require('../../config/logger')(_0x24fc('0x7'));var config=require(_0x24fc('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x24fc('0x9')][_0x24fc('0xa')]({'port':0x232a});config['redis']=_[_0x24fc('0xb')](config[_0x24fc('0xc')],{'host':_0x24fc('0xd'),'port':0x18eb});var socket=require(_0x24fc('0xe'))(new Redis(config[_0x24fc('0xc')]));require(_0x24fc('0xf'))['register'](socket);function respondWithRpcPromise(_0x44caca,_0x1819a5,_0x1a4462){return new BPromise(function(_0x133438,_0x24998d){return client[_0x24fc('0x10')](_0x44caca,_0x1a4462)[_0x24fc('0x11')](function(_0x9a1673){logger['info'](_0x24fc('0x12'),_0x1819a5,_0x24fc('0x13'));logger['debug'](_0x24fc('0x14'),_0x1819a5,_0x24fc('0x13'),JSON[_0x24fc('0x15')](_0x9a1673));if(_0x9a1673[_0x24fc('0x16')]){if(_0x9a1673[_0x24fc('0x16')][_0x24fc('0x17')]===0x1f4){logger['error'](_0x24fc('0x12'),_0x1819a5,_0x9a1673[_0x24fc('0x16')][_0x24fc('0x18')]);return _0x24998d(_0x9a1673[_0x24fc('0x16')]['message']);}logger[_0x24fc('0x16')]('SmsMessage,\x20%s,\x20%s',_0x1819a5,_0x9a1673[_0x24fc('0x16')][_0x24fc('0x18')]);return _0x133438(_0x9a1673[_0x24fc('0x16')][_0x24fc('0x18')]);}else{logger[_0x24fc('0x19')]('SmsMessage,\x20%s,\x20%s',_0x1819a5,_0x24fc('0x13'));_0x133438(_0x9a1673[_0x24fc('0x1a')][_0x24fc('0x18')]);}})[_0x24fc('0x1b')](function(_0x4c5a43){logger[_0x24fc('0x16')](_0x24fc('0x12'),_0x1819a5,_0x4c5a43);_0x24998d(_0x4c5a43);});});}exports[_0x24fc('0x1c')]=function(_0x5b0516){var _0x32a57d=this;return new Promise(function(_0x36a771,_0xbf1d6b){return db[_0x24fc('0x1d')]['create'](_0x5b0516[_0x24fc('0x1e')],{'raw':_0x5b0516['options']?_0x5b0516[_0x24fc('0x1f')]['raw']===undefined?!![]:![]:!![]})[_0x24fc('0x11')](function(_0x44c121){logger[_0x24fc('0x19')]('CreateSmsMessage',_0x5b0516);logger[_0x24fc('0x20')]('CreateSmsMessage',_0x5b0516,JSON[_0x24fc('0x15')](_0x44c121));_0x36a771(_0x44c121);})[_0x24fc('0x1b')](function(_0x36a9b4){logger[_0x24fc('0x16')](_0x24fc('0x1c'),_0x36a9b4[_0x24fc('0x18')],_0x5b0516);_0xbf1d6b(_0x32a57d[_0x24fc('0x16')](0x1f4,_0x36a9b4[_0x24fc('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index 9786265..2b8b990 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 _0x9d63=['length','smsMessage:','save','remove','update','emit','removeListener','register'];(function(_0x49c84e,_0x597200){var _0x25e64d=function(_0x1aab65){while(--_0x1aab65){_0x49c84e['push'](_0x49c84e['shift']());}};_0x25e64d(++_0x597200);}(_0x9d63,0x15a));var _0x39d6=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0x9d63[_0x138f59];return _0x3d114d;};'use strict';var SmsMessageEvents=require('./smsMessage.events');var events=[_0x39d6('0x0'),_0x39d6('0x1'),_0x39d6('0x2')];function createListener(_0x5ce728,_0x354af9){return function(_0x25d7d9){_0x354af9[_0x39d6('0x3')](_0x5ce728,_0x25d7d9);};}function removeListener(_0x3c1c21,_0x3a9870){return function(){SmsMessageEvents[_0x39d6('0x4')](_0x3c1c21,_0x3a9870);};}exports[_0x39d6('0x5')]=function(_0x271d9c){for(var _0x26dbae=0x0,_0x560146=events[_0x39d6('0x6')];_0x26dbae<_0x560146;_0x26dbae++){var _0x23eb58=events[_0x26dbae];var _0x31d3a8=createListener(_0x39d6('0x7')+_0x23eb58,_0x271d9c);SmsMessageEvents['on'](_0x23eb58,_0x31d3a8);}}; \ No newline at end of file +var _0x1289=['length','./smsMessage.events','save','emit','register'];(function(_0x544c7e,_0x276067){var _0x3c20e5=function(_0x26a74e){while(--_0x26a74e){_0x544c7e['push'](_0x544c7e['shift']());}};_0x3c20e5(++_0x276067);}(_0x1289,0x150));var _0x9128=function(_0x37ae30,_0x193ffc){_0x37ae30=_0x37ae30-0x0;var _0x3f125d=_0x1289[_0x37ae30];return _0x3f125d;};'use strict';var SmsMessageEvents=require(_0x9128('0x0'));var events=[_0x9128('0x1'),'remove','update'];function createListener(_0xc181a6,_0x5c7e56){return function(_0x1f3f6b){_0x5c7e56[_0x9128('0x2')](_0xc181a6,_0x1f3f6b);};}function removeListener(_0xee9723,_0x34f68d){return function(){SmsMessageEvents['removeListener'](_0xee9723,_0x34f68d);};}exports[_0x9128('0x3')]=function(_0x55047a){for(var _0x4bf11b=0x0,_0x192ffe=events[_0x9128('0x4')];_0x4bf11b<_0x192ffe;_0x4bf11b++){var _0x11d859=events[_0x4bf11b];var _0x34eb92=createListener('smsMessage:'+_0x11d859,_0x55047a);SmsMessageEvents['on'](_0x11d859,_0x34eb92);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 66213b4..5626a72 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 _0x01d9=['describe','/:id','show','/:id/members','getMembers','/:id/users','getAgents','post','create','/:id/teams','addTeams','addAgents','put','update','delete','destroy','removeTeams','removeAgents','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueue.controller','get','isAuthenticated','/describe'];(function(_0x317faf,_0x354aa9){var _0x432a45=function(_0x2b6819){while(--_0x2b6819){_0x317faf['push'](_0x317faf['shift']());}};_0x432a45(++_0x354aa9);}(_0x01d9,0x6c));var _0x901d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x01d9[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x901d('0x0'));var util=require(_0x901d('0x1'));var path=require(_0x901d('0x2'));var timeout=require(_0x901d('0x3'));var express=require('express');var router=express[_0x901d('0x4')]();var auth=require(_0x901d('0x5'));var interaction=require(_0x901d('0x6'));var config=require(_0x901d('0x7'));var controller=require(_0x901d('0x8'));router[_0x901d('0x9')]('/',auth[_0x901d('0xa')](),controller['index']);router[_0x901d('0x9')](_0x901d('0xb'),auth[_0x901d('0xa')](),controller[_0x901d('0xc')]);router[_0x901d('0x9')](_0x901d('0xd'),auth[_0x901d('0xa')](),controller[_0x901d('0xe')]);router[_0x901d('0x9')](_0x901d('0xf'),auth[_0x901d('0xa')](),controller[_0x901d('0x10')]);router[_0x901d('0x9')]('/:id/teams',auth[_0x901d('0xa')](),controller['getTeams']);router[_0x901d('0x9')](_0x901d('0x11'),auth[_0x901d('0xa')](),controller[_0x901d('0x12')]);router[_0x901d('0x13')]('/',auth['isAuthenticated'](),controller[_0x901d('0x14')]);router[_0x901d('0x13')](_0x901d('0x15'),auth[_0x901d('0xa')](),controller[_0x901d('0x16')]);router[_0x901d('0x13')]('/:id/users',auth[_0x901d('0xa')](),controller[_0x901d('0x17')]);router[_0x901d('0x18')](_0x901d('0xd'),auth[_0x901d('0xa')](),controller[_0x901d('0x19')]);router[_0x901d('0x1a')](_0x901d('0xd'),auth[_0x901d('0xa')](),controller[_0x901d('0x1b')]);router[_0x901d('0x1a')](_0x901d('0x15'),auth[_0x901d('0xa')](),controller[_0x901d('0x1c')]);router[_0x901d('0x1a')](_0x901d('0x11'),auth[_0x901d('0xa')](),controller[_0x901d('0x1d')]);module['exports']=router; \ No newline at end of file +var _0xc051=['util','express','Router','../../components/auth/service','../../components/interaction/service','./smsQueue.controller','get','isAuthenticated','index','/describe','describe','show','/:id/members','getMembers','/:id/teams','getAgents','post','create','addTeams','/:id/users','put','/:id','delete','destroy','exports','multer'];(function(_0x40663b,_0x29fbd2){var _0x202b9d=function(_0xd05979){while(--_0xd05979){_0x40663b['push'](_0x40663b['shift']());}};_0x202b9d(++_0x29fbd2);}(_0xc051,0xb5));var _0x1c05=function(_0x2dbe03,_0x1ab9a7){_0x2dbe03=_0x2dbe03-0x0;var _0x1ea62d=_0xc051[_0x2dbe03];return _0x1ea62d;};'use strict';var multer=require(_0x1c05('0x0'));var util=require(_0x1c05('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x1c05('0x2'));var router=express[_0x1c05('0x3')]();var auth=require(_0x1c05('0x4'));var interaction=require(_0x1c05('0x5'));var config=require('../../config/environment');var controller=require(_0x1c05('0x6'));router[_0x1c05('0x7')]('/',auth[_0x1c05('0x8')](),controller[_0x1c05('0x9')]);router[_0x1c05('0x7')](_0x1c05('0xa'),auth[_0x1c05('0x8')](),controller[_0x1c05('0xb')]);router[_0x1c05('0x7')]('/:id',auth[_0x1c05('0x8')](),controller[_0x1c05('0xc')]);router[_0x1c05('0x7')](_0x1c05('0xd'),auth['isAuthenticated'](),controller[_0x1c05('0xe')]);router[_0x1c05('0x7')](_0x1c05('0xf'),auth[_0x1c05('0x8')](),controller['getTeams']);router[_0x1c05('0x7')]('/:id/users',auth[_0x1c05('0x8')](),controller[_0x1c05('0x10')]);router[_0x1c05('0x11')]('/',auth[_0x1c05('0x8')](),controller[_0x1c05('0x12')]);router[_0x1c05('0x11')](_0x1c05('0xf'),auth[_0x1c05('0x8')](),controller[_0x1c05('0x13')]);router[_0x1c05('0x11')](_0x1c05('0x14'),auth[_0x1c05('0x8')](),controller['addAgents']);router[_0x1c05('0x15')](_0x1c05('0x16'),auth[_0x1c05('0x8')](),controller['update']);router[_0x1c05('0x17')]('/:id',auth[_0x1c05('0x8')](),controller[_0x1c05('0x18')]);router[_0x1c05('0x17')](_0x1c05('0xf'),auth[_0x1c05('0x8')](),controller['removeTeams']);router[_0x1c05('0x17')](_0x1c05('0x14'),auth[_0x1c05('0x8')](),controller['removeAgents']);module[_0x1c05('0x19')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index 9b4079f..ab7a5d1 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 _0xcef6=['rrmemory','beepall','roundrobin','sequelize','exports','name','STRING','ENUM'];(function(_0x4fe007,_0x159d81){var _0x21b59c=function(_0x3f70f1){while(--_0x3f70f1){_0x4fe007['push'](_0x4fe007['shift']());}};_0x21b59c(++_0x159d81);}(_0xcef6,0xa3));var _0x6cef=function(_0x3422bf,_0x21b1da){_0x3422bf=_0x3422bf-0x0;var _0x4de668=_0xcef6[_0x3422bf];return _0x4de668;};'use strict';var Sequelize=require(_0x6cef('0x0'));module[_0x6cef('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x6cef('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x6cef('0x3')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x6cef('0x4')](_0x6cef('0x5'),_0x6cef('0x6'),_0x6cef('0x7'))}}; \ No newline at end of file +var _0x7792=['beepall','roundrobin','name','STRING','INTEGER','ENUM','rrmemory'];(function(_0x4ca276,_0x3e55dc){var _0x129f98=function(_0xcf63b5){while(--_0xcf63b5){_0x4ca276['push'](_0x4ca276['shift']());}};_0x129f98(++_0x3e55dc);}(_0x7792,0xbf));var _0x2779=function(_0x36e0e9,_0x138073){_0x36e0e9=_0x36e0e9-0x0;var _0x4591f5=_0x7792[_0x36e0e9];return _0x4591f5;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x2779('0x0'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x2779('0x1')]},'timeout':{'type':Sequelize[_0x2779('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x2779('0x3')](_0x2779('0x4'),_0x2779('0x5'),_0x2779('0x6'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index 092f65f..84616f3 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 _0x8603=['../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','SmsQueues','UserProfileResource','error','name','send','index','SmsQueue','fieldName','type','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','where','VIRTUAL','filter','merge','then','includeAll','include','findAll','rows','show','keys','rawAttributes','options','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','getMembers','SmsQueueId','UserSmsQueue','User','UserId','agent','smsPause','updatedAt','createdAt','%s/%s','getTeams','Team','addTeams','ids','Agents','online','interface','flatMap','each','findOrCreate','emit','userSmsQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_sms_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','sequelize','SELECT','every','includes','all','compact','transaction','isEmpty','removeAgents','forEach','addAgents','omit','spread','isArray','userSmsQueue:remove','getAgents','order','eml-format','rimraf','zip-dir','moment','bluebird','mustache','path','to-csv','ejs','lodash','squel','crypto','querystring','papaparse'];(function(_0x153597,_0x492f6f){var _0x27d9de=function(_0x42f31f){while(--_0x42f31f){_0x153597['push'](_0x153597['shift']());}};_0x27d9de(++_0x492f6f);}(_0x8603,0x190));var _0x3860=function(_0x28a180,_0x5bb5b0){_0x28a180=_0x28a180-0x0;var _0x1161d3=_0x8603[_0x28a180];return _0x1161d3;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x3860('0x0'));var rimraf=require(_0x3860('0x1'));var zipdir=require(_0x3860('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x3860('0x3'));var BPromise=require(_0x3860('0x4'));var Mustache=require(_0x3860('0x5'));var util=require('util');var path=require(_0x3860('0x6'));var sox=require('sox');var csv=require(_0x3860('0x7'));var ejs=require(_0x3860('0x8'));var fs=require('fs');var _=require(_0x3860('0x9'));var squel=require(_0x3860('0xa'));var crypto=require(_0x3860('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x3860('0xc'));var Papa=require(_0x3860('0xd'));var Redis=require('ioredis');var authService=require(_0x3860('0xe'));var qs=require(_0x3860('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3860('0x10'));var logger=require(_0x3860('0x11'))('api');var utils=require(_0x3860('0x12'));var config=require(_0x3860('0x13'));var db=require('../../mysqldb')['db'];config[_0x3860('0x14')]=_[_0x3860('0x15')](config[_0x3860('0x14')],{'host':_0x3860('0x16'),'port':0x18eb});var socket=require(_0x3860('0x17'))(new Redis(config[_0x3860('0x14')]));require(_0x3860('0x18'))[_0x3860('0x19')](socket);function respondWithStatusCode(_0x465d8d,_0x46264d){_0x46264d=_0x46264d||0xcc;return function(_0x54dbc3){if(_0x54dbc3){return _0x465d8d[_0x3860('0x1a')](_0x46264d);}return _0x465d8d[_0x3860('0x1b')](_0x46264d)[_0x3860('0x1c')]();};}function respondWithResult(_0x37d9ab,_0x1055b3){_0x1055b3=_0x1055b3||0xc8;return function(_0xfa0c9a){if(_0xfa0c9a){return _0x37d9ab[_0x3860('0x1b')](_0x1055b3)[_0x3860('0x1d')](_0xfa0c9a);}};}function respondWithFilteredResult(_0x311fdb,_0x3c0d91){return function(_0x3e51b4){if(_0x3e51b4){var _0x45b799=_0x3e51b4[_0x3860('0x1e')],_0x4b6b15=_0x3c0d91[_0x3860('0x1f')],_0x4863bd=_0x3c0d91['offset']+_0x3c0d91[_0x3860('0x20')],_0x373b06;if(_0x4863bd>=_0x45b799){_0x4863bd=_0x45b799;_0x373b06=0xc8;}else{_0x373b06=0xce;}_0x311fdb[_0x3860('0x1b')](_0x373b06);return _0x311fdb[_0x3860('0x21')](_0x3860('0x22'),_0x4b6b15+'-'+_0x4863bd+'/'+_0x45b799)[_0x3860('0x1d')](_0x3e51b4);}return null;};}function patchUpdates(_0x45081f){return function(_0xc06ba1){try{jsonpatch[_0x3860('0x23')](_0xc06ba1,_0x45081f,!![]);}catch(_0x21d179){return BPromise[_0x3860('0x24')](_0x21d179);}return _0xc06ba1[_0x3860('0x25')]();};}function saveUpdates(_0x2e0b6e,_0x280ea9){return function(_0x9eaaa1){if(_0x9eaaa1){return _0x9eaaa1[_0x3860('0x26')](_0x2e0b6e)['then'](function(_0xfc10a5){return _0xfc10a5;});}return null;};}function removeEntity(_0x133093,_0x2b91f2){return function(_0x301e03){if(_0x301e03){return _0x301e03[_0x3860('0x27')]()['then'](function(){var _0x29ea87=_0x301e03['get']({'plain':!![]});var _0x577750=_0x3860('0x28');return db[_0x3860('0x29')]['destroy']({'where':{'type':_0x577750,'resourceId':_0x29ea87['id']}})['then'](function(){return _0x301e03;});})['then'](function(){_0x133093[_0x3860('0x1b')](0xcc)[_0x3860('0x1c')]();});}};}function handleEntityNotFound(_0xb25cc2,_0x371f3a){return function(_0x9332a5){if(!_0x9332a5){_0xb25cc2[_0x3860('0x1a')](0x194);}return _0x9332a5;};}function handleError(_0x544b9a,_0x4c4314){_0x4c4314=_0x4c4314||0x1f4;return function(_0x389bd0){logger[_0x3860('0x2a')](_0x389bd0['stack']);if(_0x389bd0[_0x3860('0x2b')]){delete _0x389bd0[_0x3860('0x2b')];}_0x544b9a[_0x3860('0x1b')](_0x4c4314)[_0x3860('0x2c')](_0x389bd0);};}exports[_0x3860('0x2d')]=function(_0x4bbae9,_0x36ae2b){var _0xf624ba={},_0x367b14={},_0x4bd90c={'count':0x0,'rows':[]};var _0x45d24f=_['map'](db[_0x3860('0x2e')]['rawAttributes'],function(_0x1c498c){return{'name':_0x1c498c[_0x3860('0x2f')],'type':_0x1c498c[_0x3860('0x30')]['key']};});_0x367b14[_0x3860('0x31')]=_[_0x3860('0x32')](_0x45d24f,'name');_0x367b14[_0x3860('0x33')]=_['keys'](_0x4bbae9[_0x3860('0x33')]);_0x367b14[_0x3860('0x34')]=_[_0x3860('0x35')](_0x367b14[_0x3860('0x31')],_0x367b14[_0x3860('0x33')]);_0xf624ba[_0x3860('0x36')]=_[_0x3860('0x35')](_0x367b14['model'],qs[_0x3860('0x37')](_0x4bbae9[_0x3860('0x33')]['fields']));_0xf624ba[_0x3860('0x36')]=_0xf624ba[_0x3860('0x36')][_0x3860('0x38')]?_0xf624ba['attributes']:_0x367b14['model'];if(!_0x4bbae9[_0x3860('0x33')][_0x3860('0x39')](_0x3860('0x3a'))){_0xf624ba[_0x3860('0x20')]=qs['limit'](_0x4bbae9['query'][_0x3860('0x20')]);_0xf624ba[_0x3860('0x1f')]=qs[_0x3860('0x1f')](_0x4bbae9[_0x3860('0x33')][_0x3860('0x1f')]);}_0xf624ba['order']=qs[_0x3860('0x3b')](_0x4bbae9[_0x3860('0x33')]['sort']);_0xf624ba['where']=qs[_0x3860('0x34')](_[_0x3860('0x3c')](_0x4bbae9[_0x3860('0x33')],_0x367b14[_0x3860('0x34')]));if(_0x4bbae9[_0x3860('0x33')]['filter']){_0xf624ba[_0x3860('0x3d')]=_['merge'](_0xf624ba[_0x3860('0x3d')],{'$or':_[_0x3860('0x32')](_0x45d24f,function(_0x53d443){if(_0x53d443[_0x3860('0x30')]!==_0x3860('0x3e')){var _0x4f3303={};_0x4f3303[_0x53d443[_0x3860('0x2b')]]={'$like':'%'+_0x4bbae9[_0x3860('0x33')][_0x3860('0x3f')]+'%'};return _0x4f3303;}})});}_0xf624ba=_[_0x3860('0x40')]({},_0xf624ba,_0x4bbae9['options']);var _0x312ffc={'where':_0xf624ba[_0x3860('0x3d')]};return db[_0x3860('0x2e')]['count'](_0x312ffc)[_0x3860('0x41')](function(_0x4e27c4){_0x4bd90c[_0x3860('0x1e')]=_0x4e27c4;if(_0x4bbae9[_0x3860('0x33')][_0x3860('0x42')]){_0xf624ba[_0x3860('0x43')]=[{'all':!![]}];}return db[_0x3860('0x2e')][_0x3860('0x44')](_0xf624ba);})['then'](function(_0xbbbf01){_0x4bd90c[_0x3860('0x45')]=_0xbbbf01;return _0x4bd90c;})['then'](respondWithFilteredResult(_0x36ae2b,_0xf624ba))['catch'](handleError(_0x36ae2b,null));};exports[_0x3860('0x46')]=function(_0x5840f7,_0x4f2f53){var _0x164a77={'raw':!![],'where':{'id':_0x5840f7['params']['id']}},_0x30d8eb={};_0x30d8eb[_0x3860('0x31')]=_[_0x3860('0x47')](db[_0x3860('0x2e')][_0x3860('0x48')]);_0x30d8eb[_0x3860('0x33')]=_[_0x3860('0x47')](_0x5840f7[_0x3860('0x33')]);_0x30d8eb[_0x3860('0x34')]=_[_0x3860('0x35')](_0x30d8eb[_0x3860('0x31')],_0x30d8eb[_0x3860('0x33')]);_0x164a77[_0x3860('0x36')]=_[_0x3860('0x35')](_0x30d8eb['model'],qs[_0x3860('0x37')](_0x5840f7['query'][_0x3860('0x37')]));_0x164a77[_0x3860('0x36')]=_0x164a77[_0x3860('0x36')][_0x3860('0x38')]?_0x164a77[_0x3860('0x36')]:_0x30d8eb[_0x3860('0x31')];if(_0x5840f7[_0x3860('0x33')][_0x3860('0x42')]){_0x164a77['include']=[{'all':!![]}];}_0x164a77=_[_0x3860('0x40')]({},_0x164a77,_0x5840f7[_0x3860('0x49')]);return db[_0x3860('0x2e')]['find'](_0x164a77)[_0x3860('0x41')](handleEntityNotFound(_0x4f2f53,null))[_0x3860('0x41')](respondWithResult(_0x4f2f53,null))[_0x3860('0x4a')](handleError(_0x4f2f53,null));};exports[_0x3860('0x4b')]=function(_0x5ed2db,_0x5bb2d1){return db[_0x3860('0x2e')]['create'](_0x5ed2db[_0x3860('0x4c')],{})[_0x3860('0x41')](function(_0x410dab){var _0x52456e=_0x5ed2db[_0x3860('0x4d')]['get']({'plain':!![]});if(!_0x52456e)throw new Error(_0x3860('0x4e'));if(_0x52456e['role']===_0x3860('0x4d')){var _0x25d22f=_0x410dab[_0x3860('0x4f')]({'plain':!![]});var _0x4b5790='SmsQueues';return db[_0x3860('0x50')][_0x3860('0x51')]({'where':{'name':_0x4b5790,'userProfileId':_0x52456e['userProfileId']},'raw':!![]})[_0x3860('0x41')](function(_0x58237e){if(_0x58237e&&_0x58237e[_0x3860('0x52')]===0x0){return db[_0x3860('0x29')][_0x3860('0x4b')]({'name':_0x25d22f[_0x3860('0x2b')],'resourceId':_0x25d22f['id'],'type':_0x58237e[_0x3860('0x2b')],'sectionId':_0x58237e['id']},{})[_0x3860('0x41')](function(){return _0x410dab;});}else{return _0x410dab;}})[_0x3860('0x4a')](function(_0x5a9987){logger[_0x3860('0x2a')](_0x3860('0x53'),_0x5a9987);throw _0x5a9987;});}return _0x410dab;})[_0x3860('0x41')](respondWithResult(_0x5bb2d1,0xc9))[_0x3860('0x4a')](handleError(_0x5bb2d1,null));};exports[_0x3860('0x26')]=function(_0x447163,_0x47ff99){if(_0x447163[_0x3860('0x4c')]['id']){delete _0x447163[_0x3860('0x4c')]['id'];}return db[_0x3860('0x2e')][_0x3860('0x51')]({'where':{'id':_0x447163[_0x3860('0x54')]['id']}})[_0x3860('0x41')](handleEntityNotFound(_0x47ff99,null))[_0x3860('0x41')](saveUpdates(_0x447163[_0x3860('0x4c')],null))['then'](respondWithResult(_0x47ff99,null))[_0x3860('0x4a')](handleError(_0x47ff99,null));};exports[_0x3860('0x27')]=function(_0x53a669,_0x1fe680){return db[_0x3860('0x2e')][_0x3860('0x51')]({'where':{'id':_0x53a669['params']['id']}})[_0x3860('0x41')](handleEntityNotFound(_0x1fe680,null))['then'](removeEntity(_0x1fe680,null))[_0x3860('0x4a')](handleError(_0x1fe680,null));};exports[_0x3860('0x55')]=function(_0x13b978,_0x2cc119){return db[_0x3860('0x2e')][_0x3860('0x55')]()[_0x3860('0x41')](respondWithResult(_0x2cc119,null))[_0x3860('0x4a')](handleError(_0x2cc119,null));};exports[_0x3860('0x56')]=function(_0x151492,_0x3ba9a1,_0x2bac24){var _0x58147d={'raw':!![],'where':{}},_0x5ce9a4={},_0x5111e0;return db[_0x3860('0x2e')]['findOne']({'where':{'id':_0x151492['params']['id']}})[_0x3860('0x41')](handleEntityNotFound(_0x3ba9a1,null))[_0x3860('0x41')](function(_0x2ff440){if(_0x2ff440){_0x5111e0=_0x2ff440[_0x3860('0x4f')]({'plain':!![]});_0x5ce9a4[_0x3860('0x31')]=_[_0x3860('0x47')](db['UserSmsQueue']['rawAttributes']);_0x5ce9a4['query']=_[_0x3860('0x47')](_0x151492[_0x3860('0x33')]);_0x5ce9a4[_0x3860('0x34')]=_['intersection'](_0x5ce9a4[_0x3860('0x31')],_0x5ce9a4['query']);_0x58147d[_0x3860('0x36')]=_[_0x3860('0x35')](_0x5ce9a4['model'],qs[_0x3860('0x37')](_0x151492[_0x3860('0x33')][_0x3860('0x37')]));_0x58147d[_0x3860('0x36')]=_0x58147d['attributes'][_0x3860('0x38')]?_0x58147d[_0x3860('0x36')]:_0x5ce9a4[_0x3860('0x31')];if(!_0x151492['query']['hasOwnProperty'](_0x3860('0x3a'))){_0x58147d[_0x3860('0x20')]=qs[_0x3860('0x20')](_0x151492[_0x3860('0x33')][_0x3860('0x20')]);_0x58147d[_0x3860('0x1f')]=qs['offset'](_0x151492[_0x3860('0x33')][_0x3860('0x1f')]);}_0x58147d['order']=qs[_0x3860('0x3b')](_0x151492[_0x3860('0x33')][_0x3860('0x3b')]);_0x58147d[_0x3860('0x3d')]=qs[_0x3860('0x34')](_[_0x3860('0x3c')](_0x151492['query'],_0x5ce9a4[_0x3860('0x34')]));_0x58147d[_0x3860('0x3d')][_0x3860('0x57')]=_0x2ff440['id'];if(_0x151492[_0x3860('0x33')][_0x3860('0x3f')]){_0x58147d[_0x3860('0x3d')]=_['merge'](_0x58147d[_0x3860('0x3d')],{'$or':_[_0x3860('0x32')](_0x58147d[_0x3860('0x36')],function(_0x5ebf70){var _0x4e386e={};_0x4e386e[_0x5ebf70]={'$like':'%'+_0x151492[_0x3860('0x33')][_0x3860('0x3f')]+'%'};return _0x4e386e;})});}_0x58147d=_[_0x3860('0x40')]({},_0x58147d,_0x151492[_0x3860('0x49')]);return db[_0x3860('0x58')]['findAll'](_0x58147d);}})['then'](function(_0x2db53f){if(_0x2db53f){return db[_0x3860('0x59')]['findAndCountAll']({'where':{'id':_['map'](_0x2db53f,_0x3860('0x5a')),'role':_0x3860('0x5b')},'attributes':['id','name',_0x3860('0x5c'),_0x3860('0x5d'),_0x3860('0x5e')]});}})[_0x3860('0x41')](function(_0x495167){if(_0x495167){return{'count':_0x495167[_0x3860('0x1e')],'rows':_[_0x3860('0x32')](_0x495167['rows'],function(_0x57e944){return{'membername':_0x57e944[_0x3860('0x2b')],'UserId':_0x57e944['id'],'queue_name':_0x5111e0[_0x3860('0x2b')],'SmsQueueId':_0x5111e0['id'],'interface':util['format'](_0x3860('0x5f'),'SIP',_0x57e944[_0x3860('0x2b')]),'penalty':0x0,'paused':_0x57e944['smsPause'],'createdAt':_0x57e944['createdAt'],'updatedAt':_0x57e944[_0x3860('0x5d')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x3ba9a1,_0x58147d))[_0x3860('0x4a')](handleError(_0x3ba9a1,null));};exports[_0x3860('0x60')]=function(_0x29eb2c,_0x2fd2f4,_0x19f717){var _0x43c5a1={};var _0x4b3447={};var _0x3756b3;var _0x297321;return db[_0x3860('0x2e')]['findOne']({'where':{'id':_0x29eb2c[_0x3860('0x54')]['id']}})['then'](handleEntityNotFound(_0x2fd2f4,null))[_0x3860('0x41')](function(_0x3dc2c5){if(_0x3dc2c5){_0x3756b3=_0x3dc2c5;_0x4b3447['model']=_[_0x3860('0x47')](db[_0x3860('0x61')][_0x3860('0x48')]);_0x4b3447['query']=_['keys'](_0x29eb2c['query']);_0x4b3447['filters']=_[_0x3860('0x35')](_0x4b3447[_0x3860('0x31')],_0x4b3447[_0x3860('0x33')]);_0x43c5a1[_0x3860('0x36')]=_['intersection'](_0x4b3447['model'],qs[_0x3860('0x37')](_0x29eb2c[_0x3860('0x33')][_0x3860('0x37')]));_0x43c5a1[_0x3860('0x36')]=_0x43c5a1['attributes'][_0x3860('0x38')]?_0x43c5a1[_0x3860('0x36')]:_0x4b3447['model'];_0x43c5a1['order']=qs[_0x3860('0x3b')](_0x29eb2c[_0x3860('0x33')][_0x3860('0x3b')]);_0x43c5a1[_0x3860('0x3d')]=qs['filters'](_['pick'](_0x29eb2c[_0x3860('0x33')],_0x4b3447['filters']));if(_0x29eb2c[_0x3860('0x33')][_0x3860('0x3f')]){_0x43c5a1['where']=_['merge'](_0x43c5a1['where'],{'$or':_[_0x3860('0x32')](_0x43c5a1[_0x3860('0x36')],function(_0x507480){var _0x22177b={};_0x22177b[_0x507480]={'$like':'%'+_0x29eb2c[_0x3860('0x33')][_0x3860('0x3f')]+'%'};return _0x22177b;})});}_0x43c5a1=_[_0x3860('0x40')]({},_0x43c5a1,_0x29eb2c[_0x3860('0x49')]);return _0x3756b3['getTeams'](_0x43c5a1);}})[_0x3860('0x41')](function(_0x31e791){if(_0x31e791){_0x297321=_0x31e791[_0x3860('0x38')];if(!_0x29eb2c[_0x3860('0x33')][_0x3860('0x39')]('nolimit')){_0x43c5a1[_0x3860('0x20')]=qs[_0x3860('0x20')](_0x29eb2c[_0x3860('0x33')][_0x3860('0x20')]);_0x43c5a1[_0x3860('0x1f')]=qs['offset'](_0x29eb2c['query'][_0x3860('0x1f')]);}return _0x3756b3[_0x3860('0x60')](_0x43c5a1);}})[_0x3860('0x41')](function(_0xf950d8){if(_0xf950d8){return _0xf950d8?{'count':_0x297321,'rows':_0xf950d8}:null;}})[_0x3860('0x41')](respondWithResult(_0x2fd2f4,null))[_0x3860('0x4a')](handleError(_0x2fd2f4,null));};exports[_0x3860('0x62')]=function(_0x532163,_0x458c1b,_0x3eb292){var _0x58eddd=_0x532163[_0x3860('0x4c')][_0x3860('0x63')];return db[_0x3860('0x61')]['findAll']({'where':{'id':_0x58eddd},'attributes':['id'],'include':[{'model':db[_0x3860('0x59')],'as':_0x3860('0x64'),'attributes':['id','name',_0x3860('0x65'),'voicePause',_0x3860('0x66')],'raw':!![]}]})[_0x3860('0x41')](function(_0x479d65){if(_0x479d65){var _0x330fd0=_[_0x3860('0x67')](_0x479d65,function(_0x361113){var _0x37b34a=_0x361113[_0x3860('0x4f')]({'plain':!![]});return _0x37b34a['Agents'];});return db[_0x3860('0x2e')][_0x3860('0x51')]({'where':{'id':_0x532163[_0x3860('0x54')]['id']}})[_0x3860('0x41')](function(_0x3c9837){return db['sequelize']['transaction'](function(_0x170554){return _0x3c9837[_0x3860('0x62')](_0x58eddd,{'transaction':_0x170554})['then'](function(){return BPromise[_0x3860('0x68')](_0x330fd0,function(_0x27ef52){return db[_0x3860('0x58')][_0x3860('0x69')]({'where':{'UserId':_0x27ef52['id'],'SmsQueueId':_0x532163['params']['id']},'transaction':_0x170554});});})[_0x3860('0x41')](function(){_0x330fd0['forEach'](function(_0x1a0768){socket[_0x3860('0x6a')](_0x3860('0x6b'),{'UserId':_0x1a0768['id'],'SmsQueueId':_0x3c9837['id']});});});});});}})[_0x3860('0x41')](respondWithStatusCode(_0x458c1b,null))[_0x3860('0x4a')](handleError(_0x458c1b,null));};exports[_0x3860('0x6c')]=function(_0x467b1b,_0x4936e7,_0x277aba){return db[_0x3860('0x61')]['findAll']({'where':{'id':_0x467b1b['query']['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0x3860('0x64'),'attributes':['id'],'raw':!![]}]})[_0x3860('0x41')](handleEntityNotFound(_0x4936e7,null))[_0x3860('0x41')](function(_0x1482cd){var _0x1d989c=_[_0x3860('0x32')](_0x1482cd,'id');var _0x51999d=[];var _0x204da6=[];var _0x5e2959=squel[_0x3860('0x6d')]();_0x5e2959[_0x3860('0x6e')](_0x3860('0x6f'))[_0x3860('0x70')](_0x3860('0x71'),'tq')[_0x3860('0x72')](_0x3860('0x73'),'ut',_0x3860('0x74'))[_0x3860('0x3d')](_0x3860('0x75'),_0x467b1b[_0x3860('0x54')]['id']);for(var _0x5bdd94=0x0;_0x5bdd94<_0x1482cd[_0x3860('0x38')];_0x5bdd94+=0x1){let _0x304c95=_0x1482cd[_0x5bdd94];for(var _0x1c87bd=0x0;_0x1c87bd<_0x304c95['Agents'][_0x3860('0x38')];_0x1c87bd+=0x1){let _0x2fb8fc=_0x304c95[_0x3860('0x64')][_0x1c87bd];var _0x3d4469=_0x5e2959['clone']();_0x3d4469[_0x3860('0x3d')](_0x3860('0x76'),_0x2fb8fc['id']);_0x204da6[_0x3860('0x77')](db['sequelize'][_0x3860('0x33')](_0x3d4469[_0x3860('0x78')](),{'type':db[_0x3860('0x79')]['QueryTypes'][_0x3860('0x7a')]})[_0x3860('0x41')](function(_0x171400){if(_0x171400['length']===0x1){return _0x2fb8fc['id'];}else{var _0x11d103=_[_0x3860('0x7b')](_[_0x3860('0x32')](_0x171400,'TeamId'),function(_0x3c6005){return _[_0x3860('0x7c')](_0x1d989c,_0x3c6005);});if(_0x11d103){return _0x2fb8fc['id'];}}}));}}return BPromise[_0x3860('0x7d')](_0x204da6)['then'](function(_0x213c8f){_0x51999d=_(_0x51999d)['union'](_0x213c8f)[_0x3860('0x7e')]()['value']();return db[_0x3860('0x2e')][_0x3860('0x51')]({'where':{'id':_0x467b1b[_0x3860('0x54')]['id']}})[_0x3860('0x41')](function(_0xcf291){return db[_0x3860('0x79')][_0x3860('0x7f')](function(_0x3c9ccc){return _0xcf291[_0x3860('0x6c')](_0x467b1b[_0x3860('0x33')][_0x3860('0x63')],{'transaction':_0x3c9ccc})[_0x3860('0x41')](function(){if(!_[_0x3860('0x80')](_0x51999d)){return _0xcf291[_0x3860('0x81')](_0x51999d,{'transaction':_0x3c9ccc});}})[_0x3860('0x41')](function(){_0x51999d[_0x3860('0x82')](function(_0x46661f){socket[_0x3860('0x6a')]('userSmsQueue:remove',{'UserId':_0x46661f,'SmsQueueId':_0xcf291['id']});});});});});});})[_0x3860('0x41')](respondWithStatusCode(_0x4936e7,null))[_0x3860('0x4a')](handleError(_0x4936e7,null));};exports[_0x3860('0x83')]=function(_0x28cf53,_0x3e6bf8,_0x27802b){return db[_0x3860('0x2e')][_0x3860('0x51')]({'where':{'id':_0x28cf53[_0x3860('0x54')]['id']}})[_0x3860('0x41')](handleEntityNotFound(_0x3e6bf8,null))[_0x3860('0x41')](function(_0x50a18b){if(_0x50a18b){return _0x50a18b[_0x3860('0x83')](_0x28cf53[_0x3860('0x4c')][_0x3860('0x63')],_[_0x3860('0x84')](_0x28cf53['body'],[_0x3860('0x63'),'id'])||{})[_0x3860('0x85')](function(_0x2fcf2c){for(var _0x20d615=0x0;_0x20d615<_0x28cf53['body'][_0x3860('0x63')]['length'];_0x20d615+=0x1){socket['emit'](_0x3860('0x6b'),{'UserId':_0x28cf53[_0x3860('0x4c')][_0x3860('0x63')][_0x20d615],'SmsQueueId':_0x28cf53[_0x3860('0x54')]['id']});}return _0x2fcf2c;});}})[_0x3860('0x41')](respondWithResult(_0x3e6bf8,null))[_0x3860('0x4a')](handleError(_0x3e6bf8,null));};exports[_0x3860('0x81')]=function(_0x273fed,_0x3e4a88,_0x468e83){return db[_0x3860('0x2e')][_0x3860('0x51')]({'where':{'id':_0x273fed[_0x3860('0x54')]['id']}})['then'](handleEntityNotFound(_0x3e4a88,null))[_0x3860('0x41')](function(_0x509122){if(_0x509122){return _0x509122[_0x3860('0x81')](_0x273fed[_0x3860('0x33')]['ids'])[_0x3860('0x41')](function(){if(_[_0x3860('0x86')](_0x273fed[_0x3860('0x33')][_0x3860('0x63')])){for(var _0x959e5b=0x0;_0x959e5b<_0x273fed[_0x3860('0x33')][_0x3860('0x63')]['length'];_0x959e5b+=0x1){socket[_0x3860('0x6a')](_0x3860('0x87'),{'UserId':Number(_0x273fed[_0x3860('0x33')][_0x3860('0x63')][_0x959e5b]),'SmsQueueId':Number(_0x273fed[_0x3860('0x54')]['id'])});}}else{socket['emit'](_0x3860('0x87'),{'UserId':Number(_0x273fed['query']['ids']),'SmsQueueId':Number(_0x273fed['params']['id'])});}});}})[_0x3860('0x41')](respondWithStatusCode(_0x3e4a88,null))[_0x3860('0x4a')](handleError(_0x3e4a88,null));};exports[_0x3860('0x88')]=function(_0x1558dc,_0x161efa,_0x276a75){var _0x270ca1={};var _0xe24a1d={};var _0x59c203;var _0x3c738a;return db[_0x3860('0x2e')]['findOne']({'where':{'id':_0x1558dc['params']['id']}})[_0x3860('0x41')](handleEntityNotFound(_0x161efa,null))[_0x3860('0x41')](function(_0x1cf541){if(_0x1cf541){_0x59c203=_0x1cf541;_0xe24a1d['model']=_[_0x3860('0x47')](db['User'][_0x3860('0x48')]);_0xe24a1d['query']=_[_0x3860('0x47')](_0x1558dc[_0x3860('0x33')]);_0xe24a1d['filters']=_[_0x3860('0x35')](_0xe24a1d[_0x3860('0x31')],_0xe24a1d['query']);_0x270ca1[_0x3860('0x36')]=_[_0x3860('0x35')](_0xe24a1d[_0x3860('0x31')],qs['fields'](_0x1558dc[_0x3860('0x33')]['fields']));_0x270ca1[_0x3860('0x36')]=_0x270ca1[_0x3860('0x36')]['length']?_0x270ca1[_0x3860('0x36')]:_0xe24a1d[_0x3860('0x31')];_0x270ca1[_0x3860('0x89')]=qs[_0x3860('0x3b')](_0x1558dc[_0x3860('0x33')]['sort']);_0x270ca1[_0x3860('0x3d')]=qs[_0x3860('0x34')](_['pick'](_0x1558dc['query'],_0xe24a1d[_0x3860('0x34')]));if(_0x1558dc['query'][_0x3860('0x3f')]){_0x270ca1[_0x3860('0x3d')]=_['merge'](_0x270ca1[_0x3860('0x3d')],{'$or':_['map'](_0x270ca1[_0x3860('0x36')],function(_0x4b8128){var _0x10c82d={};_0x10c82d[_0x4b8128]={'$like':'%'+_0x1558dc[_0x3860('0x33')][_0x3860('0x3f')]+'%'};return _0x10c82d;})});}_0x270ca1=_[_0x3860('0x40')]({},_0x270ca1,_0x1558dc['options']);return _0x59c203[_0x3860('0x88')](_0x270ca1);}})[_0x3860('0x41')](function(_0x20071c){if(_0x20071c){_0x3c738a=_0x20071c[_0x3860('0x38')];if(!_0x1558dc['query'][_0x3860('0x39')](_0x3860('0x3a'))){_0x270ca1['limit']=qs[_0x3860('0x20')](_0x1558dc[_0x3860('0x33')][_0x3860('0x20')]);_0x270ca1[_0x3860('0x1f')]=qs['offset'](_0x1558dc[_0x3860('0x33')][_0x3860('0x1f')]);}return _0x59c203[_0x3860('0x88')](_0x270ca1);}})[_0x3860('0x41')](function(_0x48b8a8){if(_0x48b8a8){return _0x48b8a8?{'count':_0x3c738a,'rows':_0x48b8a8}:null;}})[_0x3860('0x41')](respondWithResult(_0x161efa,null))['catch'](handleError(_0x161efa,null));}; \ No newline at end of file +var _0x0b0e=['../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','register','status','offset','Content-Range','apply','reject','update','then','get','SmsQueues','destroy','end','error','stack','name','send','index','map','SmsQueue','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','options','count','includeAll','findAll','rows','show','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','UserProfileResource','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','describe','getMembers','findOne','UserSmsQueue','findAndCountAll','UserId','format','%s/%s','SIP','createdAt','updatedAt','getTeams','Team','addTeams','ids','User','Agents','online','voicePause','interface','transaction','each','findOrCreate','emit','userSmsQueue:save','removeTeams','tq.TeamId','from','team_has_sms_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','removeAgents','forEach','omit','spread','userSmsQueue:remove','getAgents','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','ioredis'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x0b0e,0x187));var _0xe0b0=function(_0xcfeff4,_0x3f2e19){_0xcfeff4=_0xcfeff4-0x0;var _0xb2fadc=_0x0b0e[_0xcfeff4];return _0xb2fadc;};'use strict';var pdf=require(_0xe0b0('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xe0b0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe0b0('0x2'));var rp=require(_0xe0b0('0x3'));var moment=require(_0xe0b0('0x4'));var BPromise=require(_0xe0b0('0x5'));var Mustache=require(_0xe0b0('0x6'));var util=require(_0xe0b0('0x7'));var path=require(_0xe0b0('0x8'));var sox=require(_0xe0b0('0x9'));var csv=require(_0xe0b0('0xa'));var ejs=require(_0xe0b0('0xb'));var fs=require('fs');var _=require(_0xe0b0('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe0b0('0xd'));var deskjs=require(_0xe0b0('0xe'));var toCsv=require(_0xe0b0('0xa'));var querystring=require(_0xe0b0('0xf'));var Papa=require('papaparse');var Redis=require(_0xe0b0('0x10'));var authService=require(_0xe0b0('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xe0b0('0x12'));var hardwareService=require(_0xe0b0('0x13'));var logger=require('../../config/logger')(_0xe0b0('0x14'));var utils=require(_0xe0b0('0x15'));var config=require(_0xe0b0('0x16'));var db=require('../../mysqldb')['db'];config[_0xe0b0('0x17')]=_[_0xe0b0('0x18')](config[_0xe0b0('0x17')],{'host':_0xe0b0('0x19'),'port':0x18eb});var socket=require(_0xe0b0('0x1a'))(new Redis(config['redis']));require(_0xe0b0('0x1b'))[_0xe0b0('0x1c')](socket);function respondWithStatusCode(_0x743318,_0x24babd){_0x24babd=_0x24babd||0xcc;return function(_0x177c24){if(_0x177c24){return _0x743318['sendStatus'](_0x24babd);}return _0x743318[_0xe0b0('0x1d')](_0x24babd)['end']();};}function respondWithResult(_0x35cb40,_0xadee6e){_0xadee6e=_0xadee6e||0xc8;return function(_0x519ae8){if(_0x519ae8){return _0x35cb40[_0xe0b0('0x1d')](_0xadee6e)['json'](_0x519ae8);}};}function respondWithFilteredResult(_0x2d6fb6,_0x100204){return function(_0x56bcc7){if(_0x56bcc7){var _0x54a3eb=_0x56bcc7['count'],_0x46bb44=_0x100204[_0xe0b0('0x1e')],_0x50a441=_0x100204['offset']+_0x100204['limit'],_0x4df8da;if(_0x50a441>=_0x54a3eb){_0x50a441=_0x54a3eb;_0x4df8da=0xc8;}else{_0x4df8da=0xce;}_0x2d6fb6[_0xe0b0('0x1d')](_0x4df8da);return _0x2d6fb6['set'](_0xe0b0('0x1f'),_0x46bb44+'-'+_0x50a441+'/'+_0x54a3eb)['json'](_0x56bcc7);}return null;};}function patchUpdates(_0x2c84cc){return function(_0x1cd7c4){try{jsonpatch[_0xe0b0('0x20')](_0x1cd7c4,_0x2c84cc,!![]);}catch(_0x310a6d){return BPromise[_0xe0b0('0x21')](_0x310a6d);}return _0x1cd7c4['save']();};}function saveUpdates(_0x4cae54,_0x2fa820){return function(_0x5512bb){if(_0x5512bb){return _0x5512bb[_0xe0b0('0x22')](_0x4cae54)[_0xe0b0('0x23')](function(_0x513e63){return _0x513e63;});}return null;};}function removeEntity(_0x170ad8,_0x503883){return function(_0x2208d0){if(_0x2208d0){return _0x2208d0['destroy']()[_0xe0b0('0x23')](function(){var _0x576352=_0x2208d0[_0xe0b0('0x24')]({'plain':!![]});var _0x4de537=_0xe0b0('0x25');return db['UserProfileResource'][_0xe0b0('0x26')]({'where':{'type':_0x4de537,'resourceId':_0x576352['id']}})['then'](function(){return _0x2208d0;});})[_0xe0b0('0x23')](function(){_0x170ad8[_0xe0b0('0x1d')](0xcc)[_0xe0b0('0x27')]();});}};}function handleEntityNotFound(_0x1d91ad,_0x3ec2){return function(_0x10745d){if(!_0x10745d){_0x1d91ad['sendStatus'](0x194);}return _0x10745d;};}function handleError(_0x1444b9,_0x1b8aa8){_0x1b8aa8=_0x1b8aa8||0x1f4;return function(_0x5b7a64){logger[_0xe0b0('0x28')](_0x5b7a64[_0xe0b0('0x29')]);if(_0x5b7a64[_0xe0b0('0x2a')]){delete _0x5b7a64[_0xe0b0('0x2a')];}_0x1444b9[_0xe0b0('0x1d')](_0x1b8aa8)[_0xe0b0('0x2b')](_0x5b7a64);};}exports[_0xe0b0('0x2c')]=function(_0x4fb3b7,_0x1854b8){var _0x3c0109={},_0x48a9b5={},_0x4fe400={'count':0x0,'rows':[]};var _0x158b7f=_[_0xe0b0('0x2d')](db[_0xe0b0('0x2e')][_0xe0b0('0x2f')],function(_0x2ab1b1){return{'name':_0x2ab1b1['fieldName'],'type':_0x2ab1b1[_0xe0b0('0x30')][_0xe0b0('0x31')]};});_0x48a9b5[_0xe0b0('0x32')]=_[_0xe0b0('0x2d')](_0x158b7f,_0xe0b0('0x2a'));_0x48a9b5['query']=_[_0xe0b0('0x33')](_0x4fb3b7[_0xe0b0('0x34')]);_0x48a9b5[_0xe0b0('0x35')]=_[_0xe0b0('0x36')](_0x48a9b5[_0xe0b0('0x32')],_0x48a9b5[_0xe0b0('0x34')]);_0x3c0109[_0xe0b0('0x37')]=_[_0xe0b0('0x36')](_0x48a9b5[_0xe0b0('0x32')],qs[_0xe0b0('0x38')](_0x4fb3b7[_0xe0b0('0x34')][_0xe0b0('0x38')]));_0x3c0109[_0xe0b0('0x37')]=_0x3c0109[_0xe0b0('0x37')][_0xe0b0('0x39')]?_0x3c0109['attributes']:_0x48a9b5[_0xe0b0('0x32')];if(!_0x4fb3b7[_0xe0b0('0x34')][_0xe0b0('0x3a')](_0xe0b0('0x3b'))){_0x3c0109[_0xe0b0('0x3c')]=qs[_0xe0b0('0x3c')](_0x4fb3b7[_0xe0b0('0x34')]['limit']);_0x3c0109['offset']=qs['offset'](_0x4fb3b7['query'][_0xe0b0('0x1e')]);}_0x3c0109[_0xe0b0('0x3d')]=qs[_0xe0b0('0x3e')](_0x4fb3b7['query'][_0xe0b0('0x3e')]);_0x3c0109[_0xe0b0('0x3f')]=qs[_0xe0b0('0x35')](_[_0xe0b0('0x40')](_0x4fb3b7['query'],_0x48a9b5[_0xe0b0('0x35')]));if(_0x4fb3b7[_0xe0b0('0x34')][_0xe0b0('0x41')]){_0x3c0109[_0xe0b0('0x3f')]=_[_0xe0b0('0x42')](_0x3c0109[_0xe0b0('0x3f')],{'$or':_[_0xe0b0('0x2d')](_0x158b7f,function(_0x115a69){if(_0x115a69[_0xe0b0('0x30')]!=='VIRTUAL'){var _0x3e349b={};_0x3e349b[_0x115a69['name']]={'$like':'%'+_0x4fb3b7[_0xe0b0('0x34')][_0xe0b0('0x41')]+'%'};return _0x3e349b;}})});}_0x3c0109=_[_0xe0b0('0x42')]({},_0x3c0109,_0x4fb3b7[_0xe0b0('0x43')]);var _0x4d0f98={'where':_0x3c0109[_0xe0b0('0x3f')]};return db[_0xe0b0('0x2e')][_0xe0b0('0x44')](_0x4d0f98)[_0xe0b0('0x23')](function(_0x19c80e){_0x4fe400[_0xe0b0('0x44')]=_0x19c80e;if(_0x4fb3b7[_0xe0b0('0x34')][_0xe0b0('0x45')]){_0x3c0109['include']=[{'all':!![]}];}return db[_0xe0b0('0x2e')][_0xe0b0('0x46')](_0x3c0109);})['then'](function(_0x515bd2){_0x4fe400[_0xe0b0('0x47')]=_0x515bd2;return _0x4fe400;})[_0xe0b0('0x23')](respondWithFilteredResult(_0x1854b8,_0x3c0109))['catch'](handleError(_0x1854b8,null));};exports[_0xe0b0('0x48')]=function(_0x285d61,_0x6bca5c){var _0x1c869d={'raw':!![],'where':{'id':_0x285d61['params']['id']}},_0x1a8cc7={};_0x1a8cc7['model']=_['keys'](db[_0xe0b0('0x2e')][_0xe0b0('0x2f')]);_0x1a8cc7['query']=_[_0xe0b0('0x33')](_0x285d61[_0xe0b0('0x34')]);_0x1a8cc7[_0xe0b0('0x35')]=_[_0xe0b0('0x36')](_0x1a8cc7[_0xe0b0('0x32')],_0x1a8cc7['query']);_0x1c869d['attributes']=_[_0xe0b0('0x36')](_0x1a8cc7[_0xe0b0('0x32')],qs[_0xe0b0('0x38')](_0x285d61[_0xe0b0('0x34')][_0xe0b0('0x38')]));_0x1c869d['attributes']=_0x1c869d[_0xe0b0('0x37')][_0xe0b0('0x39')]?_0x1c869d['attributes']:_0x1a8cc7['model'];if(_0x285d61['query'][_0xe0b0('0x45')]){_0x1c869d[_0xe0b0('0x49')]=[{'all':!![]}];}_0x1c869d=_[_0xe0b0('0x42')]({},_0x1c869d,_0x285d61[_0xe0b0('0x43')]);return db['SmsQueue'][_0xe0b0('0x4a')](_0x1c869d)[_0xe0b0('0x23')](handleEntityNotFound(_0x6bca5c,null))['then'](respondWithResult(_0x6bca5c,null))['catch'](handleError(_0x6bca5c,null));};exports[_0xe0b0('0x4b')]=function(_0x1bc6e0,_0x497f4f){return db[_0xe0b0('0x2e')][_0xe0b0('0x4b')](_0x1bc6e0['body'],{})['then'](function(_0x123ad2){var _0x511679=_0x1bc6e0[_0xe0b0('0x4c')][_0xe0b0('0x24')]({'plain':!![]});if(!_0x511679)throw new Error(_0xe0b0('0x4d'));if(_0x511679[_0xe0b0('0x4e')]===_0xe0b0('0x4c')){var _0xf9e694=_0x123ad2['get']({'plain':!![]});var _0x5d018d=_0xe0b0('0x25');return db['UserProfileSection']['find']({'where':{'name':_0x5d018d,'userProfileId':_0x511679[_0xe0b0('0x4f')]},'raw':!![]})[_0xe0b0('0x23')](function(_0x54cf7b){if(_0x54cf7b&&_0x54cf7b['autoAssociation']===0x0){return db[_0xe0b0('0x50')][_0xe0b0('0x4b')]({'name':_0xf9e694[_0xe0b0('0x2a')],'resourceId':_0xf9e694['id'],'type':_0x54cf7b[_0xe0b0('0x2a')],'sectionId':_0x54cf7b['id']},{})[_0xe0b0('0x23')](function(){return _0x123ad2;});}else{return _0x123ad2;}})[_0xe0b0('0x51')](function(_0x84fabb){logger['error'](_0xe0b0('0x52'),_0x84fabb);throw _0x84fabb;});}return _0x123ad2;})['then'](respondWithResult(_0x497f4f,0xc9))[_0xe0b0('0x51')](handleError(_0x497f4f,null));};exports['update']=function(_0x5b2055,_0x33822e){if(_0x5b2055[_0xe0b0('0x53')]['id']){delete _0x5b2055[_0xe0b0('0x53')]['id'];}return db[_0xe0b0('0x2e')][_0xe0b0('0x4a')]({'where':{'id':_0x5b2055[_0xe0b0('0x54')]['id']}})[_0xe0b0('0x23')](handleEntityNotFound(_0x33822e,null))[_0xe0b0('0x23')](saveUpdates(_0x5b2055[_0xe0b0('0x53')],null))['then'](respondWithResult(_0x33822e,null))[_0xe0b0('0x51')](handleError(_0x33822e,null));};exports['destroy']=function(_0x2b5553,_0x3ae36e){return db[_0xe0b0('0x2e')][_0xe0b0('0x4a')]({'where':{'id':_0x2b5553[_0xe0b0('0x54')]['id']}})[_0xe0b0('0x23')](handleEntityNotFound(_0x3ae36e,null))['then'](removeEntity(_0x3ae36e,null))[_0xe0b0('0x51')](handleError(_0x3ae36e,null));};exports[_0xe0b0('0x55')]=function(_0x437a15,_0x271445){return db[_0xe0b0('0x2e')][_0xe0b0('0x55')]()[_0xe0b0('0x23')](respondWithResult(_0x271445,null))[_0xe0b0('0x51')](handleError(_0x271445,null));};exports[_0xe0b0('0x56')]=function(_0xf331df,_0x1eb5d6,_0x18ab99){var _0xc719d2={'raw':!![],'where':{}},_0x10eb99={},_0xcdf97;return db[_0xe0b0('0x2e')][_0xe0b0('0x57')]({'where':{'id':_0xf331df[_0xe0b0('0x54')]['id']}})['then'](handleEntityNotFound(_0x1eb5d6,null))[_0xe0b0('0x23')](function(_0xe7fbac){if(_0xe7fbac){_0xcdf97=_0xe7fbac[_0xe0b0('0x24')]({'plain':!![]});_0x10eb99[_0xe0b0('0x32')]=_[_0xe0b0('0x33')](db[_0xe0b0('0x58')][_0xe0b0('0x2f')]);_0x10eb99['query']=_['keys'](_0xf331df[_0xe0b0('0x34')]);_0x10eb99[_0xe0b0('0x35')]=_[_0xe0b0('0x36')](_0x10eb99['model'],_0x10eb99[_0xe0b0('0x34')]);_0xc719d2[_0xe0b0('0x37')]=_[_0xe0b0('0x36')](_0x10eb99[_0xe0b0('0x32')],qs[_0xe0b0('0x38')](_0xf331df['query'][_0xe0b0('0x38')]));_0xc719d2[_0xe0b0('0x37')]=_0xc719d2[_0xe0b0('0x37')]['length']?_0xc719d2[_0xe0b0('0x37')]:_0x10eb99[_0xe0b0('0x32')];if(!_0xf331df['query'][_0xe0b0('0x3a')]('nolimit')){_0xc719d2['limit']=qs[_0xe0b0('0x3c')](_0xf331df['query']['limit']);_0xc719d2[_0xe0b0('0x1e')]=qs[_0xe0b0('0x1e')](_0xf331df[_0xe0b0('0x34')][_0xe0b0('0x1e')]);}_0xc719d2['order']=qs[_0xe0b0('0x3e')](_0xf331df[_0xe0b0('0x34')][_0xe0b0('0x3e')]);_0xc719d2[_0xe0b0('0x3f')]=qs[_0xe0b0('0x35')](_[_0xe0b0('0x40')](_0xf331df[_0xe0b0('0x34')],_0x10eb99[_0xe0b0('0x35')]));_0xc719d2['where']['SmsQueueId']=_0xe7fbac['id'];if(_0xf331df[_0xe0b0('0x34')][_0xe0b0('0x41')]){_0xc719d2[_0xe0b0('0x3f')]=_['merge'](_0xc719d2['where'],{'$or':_[_0xe0b0('0x2d')](_0xc719d2[_0xe0b0('0x37')],function(_0x5d7cf4){var _0x5eca3d={};_0x5eca3d[_0x5d7cf4]={'$like':'%'+_0xf331df[_0xe0b0('0x34')][_0xe0b0('0x41')]+'%'};return _0x5eca3d;})});}_0xc719d2=_[_0xe0b0('0x42')]({},_0xc719d2,_0xf331df[_0xe0b0('0x43')]);return db[_0xe0b0('0x58')][_0xe0b0('0x46')](_0xc719d2);}})[_0xe0b0('0x23')](function(_0x1b997d){if(_0x1b997d){return db['User'][_0xe0b0('0x59')]({'where':{'id':_[_0xe0b0('0x2d')](_0x1b997d,_0xe0b0('0x5a')),'role':'agent'},'attributes':['id','name','smsPause','updatedAt','createdAt']});}})['then'](function(_0x252527){if(_0x252527){return{'count':_0x252527['count'],'rows':_['map'](_0x252527[_0xe0b0('0x47')],function(_0x2dc06d){return{'membername':_0x2dc06d[_0xe0b0('0x2a')],'UserId':_0x2dc06d['id'],'queue_name':_0xcdf97[_0xe0b0('0x2a')],'SmsQueueId':_0xcdf97['id'],'interface':util[_0xe0b0('0x5b')](_0xe0b0('0x5c'),_0xe0b0('0x5d'),_0x2dc06d[_0xe0b0('0x2a')]),'penalty':0x0,'paused':_0x2dc06d['smsPause'],'createdAt':_0x2dc06d[_0xe0b0('0x5e')],'updatedAt':_0x2dc06d[_0xe0b0('0x5f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xe0b0('0x23')](respondWithFilteredResult(_0x1eb5d6,_0xc719d2))[_0xe0b0('0x51')](handleError(_0x1eb5d6,null));};exports[_0xe0b0('0x60')]=function(_0x1f70fb,_0x16a2ae,_0x5e3e28){var _0xaf2607={};var _0x5981a3={};var _0x2c9147;var _0x28b927;return db[_0xe0b0('0x2e')][_0xe0b0('0x57')]({'where':{'id':_0x1f70fb['params']['id']}})[_0xe0b0('0x23')](handleEntityNotFound(_0x16a2ae,null))[_0xe0b0('0x23')](function(_0x49deef){if(_0x49deef){_0x2c9147=_0x49deef;_0x5981a3['model']=_[_0xe0b0('0x33')](db[_0xe0b0('0x61')][_0xe0b0('0x2f')]);_0x5981a3[_0xe0b0('0x34')]=_[_0xe0b0('0x33')](_0x1f70fb[_0xe0b0('0x34')]);_0x5981a3[_0xe0b0('0x35')]=_[_0xe0b0('0x36')](_0x5981a3[_0xe0b0('0x32')],_0x5981a3[_0xe0b0('0x34')]);_0xaf2607['attributes']=_['intersection'](_0x5981a3[_0xe0b0('0x32')],qs['fields'](_0x1f70fb['query']['fields']));_0xaf2607['attributes']=_0xaf2607[_0xe0b0('0x37')]['length']?_0xaf2607[_0xe0b0('0x37')]:_0x5981a3[_0xe0b0('0x32')];_0xaf2607[_0xe0b0('0x3d')]=qs[_0xe0b0('0x3e')](_0x1f70fb['query'][_0xe0b0('0x3e')]);_0xaf2607[_0xe0b0('0x3f')]=qs['filters'](_[_0xe0b0('0x40')](_0x1f70fb[_0xe0b0('0x34')],_0x5981a3[_0xe0b0('0x35')]));if(_0x1f70fb[_0xe0b0('0x34')][_0xe0b0('0x41')]){_0xaf2607['where']=_['merge'](_0xaf2607['where'],{'$or':_['map'](_0xaf2607['attributes'],function(_0xfbe16d){var _0x567e1a={};_0x567e1a[_0xfbe16d]={'$like':'%'+_0x1f70fb[_0xe0b0('0x34')]['filter']+'%'};return _0x567e1a;})});}_0xaf2607=_[_0xe0b0('0x42')]({},_0xaf2607,_0x1f70fb[_0xe0b0('0x43')]);return _0x2c9147[_0xe0b0('0x60')](_0xaf2607);}})[_0xe0b0('0x23')](function(_0x199929){if(_0x199929){_0x28b927=_0x199929[_0xe0b0('0x39')];if(!_0x1f70fb['query']['hasOwnProperty']('nolimit')){_0xaf2607['limit']=qs[_0xe0b0('0x3c')](_0x1f70fb[_0xe0b0('0x34')][_0xe0b0('0x3c')]);_0xaf2607[_0xe0b0('0x1e')]=qs[_0xe0b0('0x1e')](_0x1f70fb['query'][_0xe0b0('0x1e')]);}return _0x2c9147[_0xe0b0('0x60')](_0xaf2607);}})[_0xe0b0('0x23')](function(_0xc6090e){if(_0xc6090e){return _0xc6090e?{'count':_0x28b927,'rows':_0xc6090e}:null;}})[_0xe0b0('0x23')](respondWithResult(_0x16a2ae,null))[_0xe0b0('0x51')](handleError(_0x16a2ae,null));};exports[_0xe0b0('0x62')]=function(_0x7beacf,_0x14f721,_0x5565ef){var _0x589c47=_0x7beacf[_0xe0b0('0x53')][_0xe0b0('0x63')];return db['Team'][_0xe0b0('0x46')]({'where':{'id':_0x589c47},'attributes':['id'],'include':[{'model':db[_0xe0b0('0x64')],'as':_0xe0b0('0x65'),'attributes':['id',_0xe0b0('0x2a'),_0xe0b0('0x66'),_0xe0b0('0x67'),_0xe0b0('0x68')],'raw':!![]}]})[_0xe0b0('0x23')](function(_0x50b883){if(_0x50b883){var _0x5f4911=_['flatMap'](_0x50b883,function(_0xc19743){var _0x90d471=_0xc19743['get']({'plain':!![]});return _0x90d471[_0xe0b0('0x65')];});return db[_0xe0b0('0x2e')][_0xe0b0('0x4a')]({'where':{'id':_0x7beacf[_0xe0b0('0x54')]['id']}})['then'](function(_0x56c4b9){return db['sequelize'][_0xe0b0('0x69')](function(_0x266835){return _0x56c4b9['addTeams'](_0x589c47,{'transaction':_0x266835})[_0xe0b0('0x23')](function(){return BPromise[_0xe0b0('0x6a')](_0x5f4911,function(_0x5547ee){return db['UserSmsQueue'][_0xe0b0('0x6b')]({'where':{'UserId':_0x5547ee['id'],'SmsQueueId':_0x7beacf['params']['id']},'transaction':_0x266835});});})[_0xe0b0('0x23')](function(){_0x5f4911['forEach'](function(_0x22e240){socket[_0xe0b0('0x6c')](_0xe0b0('0x6d'),{'UserId':_0x22e240['id'],'SmsQueueId':_0x56c4b9['id']});});});});});}})[_0xe0b0('0x23')](respondWithStatusCode(_0x14f721,null))[_0xe0b0('0x51')](handleError(_0x14f721,null));};exports[_0xe0b0('0x6e')]=function(_0x434dfa,_0x2ebbb5,_0xf76449){return db['Team'][_0xe0b0('0x46')]({'where':{'id':_0x434dfa[_0xe0b0('0x34')][_0xe0b0('0x63')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xe0b0('0x65'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x2ebbb5,null))[_0xe0b0('0x23')](function(_0x350c40){var _0x570402=_[_0xe0b0('0x2d')](_0x350c40,'id');var _0x4e4b45=[];var _0x528932=[];var _0x4e0b18=squel['select']();_0x4e0b18['field'](_0xe0b0('0x6f'))[_0xe0b0('0x70')](_0xe0b0('0x71'),'tq')[_0xe0b0('0x72')](_0xe0b0('0x73'),'ut',_0xe0b0('0x74'))['where'](_0xe0b0('0x75'),_0x434dfa[_0xe0b0('0x54')]['id']);for(var _0x421b3b=0x0;_0x421b3b<_0x350c40['length'];_0x421b3b+=0x1){let _0x2a4f5d=_0x350c40[_0x421b3b];for(var _0x447641=0x0;_0x447641<_0x2a4f5d['Agents']['length'];_0x447641+=0x1){let _0x33f89a=_0x2a4f5d['Agents'][_0x447641];var _0x46ab89=_0x4e0b18[_0xe0b0('0x76')]();_0x46ab89[_0xe0b0('0x3f')](_0xe0b0('0x77'),_0x33f89a['id']);_0x528932[_0xe0b0('0x78')](db[_0xe0b0('0x79')][_0xe0b0('0x34')](_0x46ab89['toString'](),{'type':db[_0xe0b0('0x79')][_0xe0b0('0x7a')][_0xe0b0('0x7b')]})[_0xe0b0('0x23')](function(_0x2b087b){if(_0x2b087b['length']===0x1){return _0x33f89a['id'];}else{var _0x5b91a2=_[_0xe0b0('0x7c')](_[_0xe0b0('0x2d')](_0x2b087b,_0xe0b0('0x7d')),function(_0x268d0c){return _[_0xe0b0('0x7e')](_0x570402,_0x268d0c);});if(_0x5b91a2){return _0x33f89a['id'];}}}));}}return BPromise[_0xe0b0('0x7f')](_0x528932)[_0xe0b0('0x23')](function(_0x387389){_0x4e4b45=_(_0x4e4b45)[_0xe0b0('0x80')](_0x387389)[_0xe0b0('0x81')]()['value']();return db[_0xe0b0('0x2e')][_0xe0b0('0x4a')]({'where':{'id':_0x434dfa[_0xe0b0('0x54')]['id']}})[_0xe0b0('0x23')](function(_0x55e456){return db[_0xe0b0('0x79')][_0xe0b0('0x69')](function(_0x1641dd){return _0x55e456[_0xe0b0('0x6e')](_0x434dfa[_0xe0b0('0x34')]['ids'],{'transaction':_0x1641dd})[_0xe0b0('0x23')](function(){if(!_['isEmpty'](_0x4e4b45)){return _0x55e456[_0xe0b0('0x82')](_0x4e4b45,{'transaction':_0x1641dd});}})[_0xe0b0('0x23')](function(){_0x4e4b45[_0xe0b0('0x83')](function(_0x23c448){socket[_0xe0b0('0x6c')]('userSmsQueue:remove',{'UserId':_0x23c448,'SmsQueueId':_0x55e456['id']});});});});});});})['then'](respondWithStatusCode(_0x2ebbb5,null))[_0xe0b0('0x51')](handleError(_0x2ebbb5,null));};exports['addAgents']=function(_0x436ab9,_0x4c82d6,_0x1b10be){return db[_0xe0b0('0x2e')][_0xe0b0('0x4a')]({'where':{'id':_0x436ab9[_0xe0b0('0x54')]['id']}})[_0xe0b0('0x23')](handleEntityNotFound(_0x4c82d6,null))[_0xe0b0('0x23')](function(_0x43ff30){if(_0x43ff30){return _0x43ff30['addAgents'](_0x436ab9['body'][_0xe0b0('0x63')],_[_0xe0b0('0x84')](_0x436ab9[_0xe0b0('0x53')],[_0xe0b0('0x63'),'id'])||{})[_0xe0b0('0x85')](function(_0x2b4d49){for(var _0x3b7a7a=0x0;_0x3b7a7a<_0x436ab9[_0xe0b0('0x53')][_0xe0b0('0x63')][_0xe0b0('0x39')];_0x3b7a7a+=0x1){socket['emit']('userSmsQueue:save',{'UserId':_0x436ab9[_0xe0b0('0x53')][_0xe0b0('0x63')][_0x3b7a7a],'SmsQueueId':_0x436ab9[_0xe0b0('0x54')]['id']});}return _0x2b4d49;});}})[_0xe0b0('0x23')](respondWithResult(_0x4c82d6,null))[_0xe0b0('0x51')](handleError(_0x4c82d6,null));};exports[_0xe0b0('0x82')]=function(_0x33b67a,_0x51995b,_0x4c4748){return db[_0xe0b0('0x2e')][_0xe0b0('0x4a')]({'where':{'id':_0x33b67a[_0xe0b0('0x54')]['id']}})[_0xe0b0('0x23')](handleEntityNotFound(_0x51995b,null))[_0xe0b0('0x23')](function(_0x19cc74){if(_0x19cc74){return _0x19cc74[_0xe0b0('0x82')](_0x33b67a[_0xe0b0('0x34')][_0xe0b0('0x63')])[_0xe0b0('0x23')](function(){if(_['isArray'](_0x33b67a[_0xe0b0('0x34')][_0xe0b0('0x63')])){for(var _0x47b456=0x0;_0x47b456<_0x33b67a[_0xe0b0('0x34')][_0xe0b0('0x63')][_0xe0b0('0x39')];_0x47b456+=0x1){socket[_0xe0b0('0x6c')](_0xe0b0('0x86'),{'UserId':Number(_0x33b67a['query'][_0xe0b0('0x63')][_0x47b456]),'SmsQueueId':Number(_0x33b67a[_0xe0b0('0x54')]['id'])});}}else{socket[_0xe0b0('0x6c')](_0xe0b0('0x86'),{'UserId':Number(_0x33b67a[_0xe0b0('0x34')]['ids']),'SmsQueueId':Number(_0x33b67a[_0xe0b0('0x54')]['id'])});}});}})['then'](respondWithStatusCode(_0x51995b,null))[_0xe0b0('0x51')](handleError(_0x51995b,null));};exports[_0xe0b0('0x87')]=function(_0x17cc14,_0x539a12,_0x5d5e32){var _0x45ae1a={};var _0x2349df={};var _0x619226;var _0x47d9d1;return db['SmsQueue']['findOne']({'where':{'id':_0x17cc14['params']['id']}})['then'](handleEntityNotFound(_0x539a12,null))['then'](function(_0x3474ab){if(_0x3474ab){_0x619226=_0x3474ab;_0x2349df[_0xe0b0('0x32')]=_['keys'](db[_0xe0b0('0x64')][_0xe0b0('0x2f')]);_0x2349df[_0xe0b0('0x34')]=_[_0xe0b0('0x33')](_0x17cc14[_0xe0b0('0x34')]);_0x2349df['filters']=_['intersection'](_0x2349df[_0xe0b0('0x32')],_0x2349df[_0xe0b0('0x34')]);_0x45ae1a[_0xe0b0('0x37')]=_['intersection'](_0x2349df[_0xe0b0('0x32')],qs[_0xe0b0('0x38')](_0x17cc14[_0xe0b0('0x34')][_0xe0b0('0x38')]));_0x45ae1a[_0xe0b0('0x37')]=_0x45ae1a[_0xe0b0('0x37')]['length']?_0x45ae1a['attributes']:_0x2349df['model'];_0x45ae1a[_0xe0b0('0x3d')]=qs[_0xe0b0('0x3e')](_0x17cc14[_0xe0b0('0x34')][_0xe0b0('0x3e')]);_0x45ae1a[_0xe0b0('0x3f')]=qs[_0xe0b0('0x35')](_[_0xe0b0('0x40')](_0x17cc14[_0xe0b0('0x34')],_0x2349df['filters']));if(_0x17cc14['query'][_0xe0b0('0x41')]){_0x45ae1a[_0xe0b0('0x3f')]=_[_0xe0b0('0x42')](_0x45ae1a['where'],{'$or':_[_0xe0b0('0x2d')](_0x45ae1a[_0xe0b0('0x37')],function(_0x9f1fb){var _0x4949fe={};_0x4949fe[_0x9f1fb]={'$like':'%'+_0x17cc14[_0xe0b0('0x34')]['filter']+'%'};return _0x4949fe;})});}_0x45ae1a=_[_0xe0b0('0x42')]({},_0x45ae1a,_0x17cc14[_0xe0b0('0x43')]);return _0x619226[_0xe0b0('0x87')](_0x45ae1a);}})[_0xe0b0('0x23')](function(_0x3b133a){if(_0x3b133a){_0x47d9d1=_0x3b133a[_0xe0b0('0x39')];if(!_0x17cc14[_0xe0b0('0x34')]['hasOwnProperty'](_0xe0b0('0x3b'))){_0x45ae1a[_0xe0b0('0x3c')]=qs['limit'](_0x17cc14[_0xe0b0('0x34')][_0xe0b0('0x3c')]);_0x45ae1a[_0xe0b0('0x1e')]=qs['offset'](_0x17cc14[_0xe0b0('0x34')][_0xe0b0('0x1e')]);}return _0x619226[_0xe0b0('0x87')](_0x45ae1a);}})['then'](function(_0xed8461){if(_0xed8461){return _0xed8461?{'count':_0x47d9d1,'rows':_0xed8461}:null;}})[_0xe0b0('0x23')](respondWithResult(_0x539a12,null))[_0xe0b0('0x51')](handleError(_0x539a12,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 7a7d26c..0c5bdf8 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 _0x1b95=['emit','hasOwnProperty','hook','exports','events','update','remove'];(function(_0x55f90e,_0x5aee6d){var _0x37a8d8=function(_0x5b640e){while(--_0x5b640e){_0x55f90e['push'](_0x55f90e['shift']());}};_0x37a8d8(++_0x5aee6d);}(_0x1b95,0x115));var _0x51b9=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0x1b95[_0x4709c0];return _0x13348b;};'use strict';var EventEmitter=require(_0x51b9('0x0'));var SmsQueue=require('../../mysqldb')['db']['SmsQueue'];var SmsQueueEvents=new EventEmitter();SmsQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x51b9('0x1'),'afterDestroy':_0x51b9('0x2')};function emitEvent(_0x313174){return function(_0xe107c2,_0x27ff7e,_0x2bbd9e){SmsQueueEvents['emit'](_0x313174+':'+_0xe107c2['id'],_0xe107c2);SmsQueueEvents[_0x51b9('0x3')](_0x313174,_0xe107c2);_0x2bbd9e(null);};}for(var e in events){if(events[_0x51b9('0x4')](e)){var event=events[e];SmsQueue[_0x51b9('0x5')](e,emitEvent(event));}}module[_0x51b9('0x6')]=SmsQueueEvents; \ No newline at end of file +var _0x0cec=['update','emit','exports','events','../../mysqldb','SmsQueue','setMaxListeners','save'];(function(_0x5f09f7,_0x7eb7ab){var _0x26d983=function(_0x3d31de){while(--_0x3d31de){_0x5f09f7['push'](_0x5f09f7['shift']());}};_0x26d983(++_0x7eb7ab);}(_0x0cec,0x103));var _0xc0ce=function(_0x97048e,_0x20d7b8){_0x97048e=_0x97048e-0x0;var _0x5324bc=_0x0cec[_0x97048e];return _0x5324bc;};'use strict';var EventEmitter=require(_0xc0ce('0x0'));var SmsQueue=require(_0xc0ce('0x1'))['db'][_0xc0ce('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0xc0ce('0x3')](0x0);var events={'afterCreate':_0xc0ce('0x4'),'afterUpdate':_0xc0ce('0x5'),'afterDestroy':'remove'};function emitEvent(_0x21ad93){return function(_0x412d0c,_0x48f978,_0xd14e6c){SmsQueueEvents['emit'](_0x21ad93+':'+_0x412d0c['id'],_0x412d0c);SmsQueueEvents[_0xc0ce('0x6')](_0x21ad93,_0x412d0c);_0xd14e6c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsQueue['hook'](e,emitEvent(event));}}module[_0xc0ce('0x7')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index 1799626..ca3829a 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 _0x1dfa=['define','SmsQueue','sms_queues','lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','exports'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x1dfa,0x18f));var _0xa1df=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x1dfa[_0x465028];return _0xb783d4;};'use strict';var _=require(_0xa1df('0x0'));var util=require(_0xa1df('0x1'));var logger=require(_0xa1df('0x2'))('api');var moment=require(_0xa1df('0x3'));var BPromise=require(_0xa1df('0x4'));var rp=require(_0xa1df('0x5'));var fs=require('fs');var path=require(_0xa1df('0x6'));var rimraf=require('rimraf');var config=require(_0xa1df('0x7'));var attributes=require('./smsQueue.attributes');module[_0xa1df('0x8')]=function(_0x1cc8b6,_0x219179){return _0x1cc8b6[_0xa1df('0x9')](_0xa1df('0xa'),attributes,{'tableName':_0xa1df('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd737=['lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./smsQueue.attributes','exports','define','SmsQueue','sms_queues'];(function(_0x1be622,_0x210904){var _0x326be2=function(_0x55fbf4){while(--_0x55fbf4){_0x1be622['push'](_0x1be622['shift']());}};_0x326be2(++_0x210904);}(_0xd737,0xdd));var _0x7d73=function(_0x3f59b1,_0x25cdbe){_0x3f59b1=_0x3f59b1-0x0;var _0x11d2e8=_0xd737[_0x3f59b1];return _0x11d2e8;};'use strict';var _=require(_0x7d73('0x0'));var util=require(_0x7d73('0x1'));var logger=require(_0x7d73('0x2'))('api');var moment=require('moment');var BPromise=require(_0x7d73('0x3'));var rp=require(_0x7d73('0x4'));var fs=require('fs');var path=require(_0x7d73('0x5'));var rimraf=require(_0x7d73('0x6'));var config=require(_0x7d73('0x7'));var attributes=require(_0x7d73('0x8'));module[_0x7d73('0x9')]=function(_0x478b3d,_0x6072fd){return _0x478b3d[_0x7d73('0xa')](_0x7d73('0xb'),attributes,{'tableName':_0x7d73('0xc'),'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 440dbde..c0dc18f 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 _0x5316=['options','raw','where','attributes','limit','include','map','model','GetSmsQueue','ShowSmsQueue','find','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','socket.io-emitter','register','request','then','info','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','SmsQueue','findAll'];(function(_0x1f2020,_0x2738c6){var _0x401e2b=function(_0x32ba94){while(--_0x32ba94){_0x1f2020['push'](_0x1f2020['shift']());}};_0x401e2b(++_0x2738c6);}(_0x5316,0x143));var _0x6531=function(_0x28db4a,_0x6d6d5a){_0x28db4a=_0x28db4a-0x0;var _0x3bf87e=_0x5316[_0x28db4a];return _0x3bf87e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x6531('0x0'));var BPromise=require(_0x6531('0x1'));var rs=require(_0x6531('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6531('0x3'))['db'];var utils=require(_0x6531('0x4'));var logger=require(_0x6531('0x5'))(_0x6531('0x6'));var config=require(_0x6531('0x7'));var jayson=require(_0x6531('0x8'));var client=jayson[_0x6531('0x9')]['http']({'port':0x232a});config[_0x6531('0xa')]=_[_0x6531('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x6531('0xc'))(new Redis(config['redis']));require('./smsQueue.socket')[_0x6531('0xd')](socket);function respondWithRpcPromise(_0x3da628,_0x2a7bee,_0x2689a2){return new BPromise(function(_0x31388b,_0x42e16e){return client[_0x6531('0xe')](_0x3da628,_0x2689a2)[_0x6531('0xf')](function(_0x4fa46f){logger[_0x6531('0x10')](_0x6531('0x11'),_0x2a7bee,_0x6531('0x12'));logger[_0x6531('0x13')](_0x6531('0x14'),_0x2a7bee,_0x6531('0x12'),JSON[_0x6531('0x15')](_0x4fa46f));if(_0x4fa46f[_0x6531('0x16')]){if(_0x4fa46f[_0x6531('0x16')]['code']===0x1f4){logger[_0x6531('0x16')](_0x6531('0x11'),_0x2a7bee,_0x4fa46f[_0x6531('0x16')][_0x6531('0x17')]);return _0x42e16e(_0x4fa46f[_0x6531('0x16')][_0x6531('0x17')]);}logger[_0x6531('0x16')]('SmsQueue,\x20%s,\x20%s',_0x2a7bee,_0x4fa46f[_0x6531('0x16')]['message']);return _0x31388b(_0x4fa46f['error'][_0x6531('0x17')]);}else{logger[_0x6531('0x10')](_0x6531('0x11'),_0x2a7bee,_0x6531('0x12'));_0x31388b(_0x4fa46f[_0x6531('0x18')][_0x6531('0x17')]);}})[_0x6531('0x19')](function(_0x296b94){logger[_0x6531('0x16')](_0x6531('0x11'),_0x2a7bee,_0x296b94);_0x42e16e(_0x296b94);});});}exports['GetSmsQueue']=function(_0x4c6f78){var _0x374677=this;return new Promise(function(_0x3b852d,_0x5e4697){return db[_0x6531('0x1a')][_0x6531('0x1b')]({'raw':_0x4c6f78[_0x6531('0x1c')]?_0x4c6f78[_0x6531('0x1c')][_0x6531('0x1d')]===undefined?!![]:![]:!![],'where':_0x4c6f78[_0x6531('0x1c')]?_0x4c6f78[_0x6531('0x1c')][_0x6531('0x1e')]||null:null,'attributes':_0x4c6f78[_0x6531('0x1c')]?_0x4c6f78[_0x6531('0x1c')][_0x6531('0x1f')]||null:null,'limit':_0x4c6f78[_0x6531('0x1c')]?_0x4c6f78[_0x6531('0x1c')][_0x6531('0x20')]||null:null,'include':_0x4c6f78['options']?_0x4c6f78[_0x6531('0x1c')][_0x6531('0x21')]?_[_0x6531('0x22')](_0x4c6f78[_0x6531('0x1c')][_0x6531('0x21')],function(_0xd80e72){return{'model':db[_0xd80e72[_0x6531('0x23')]],'as':_0xd80e72['as'],'attributes':_0xd80e72['attributes'],'include':_0xd80e72[_0x6531('0x21')]?_[_0x6531('0x22')](_0xd80e72[_0x6531('0x21')],function(_0xad3f27){return{'model':db[_0xad3f27[_0x6531('0x23')]],'as':_0xad3f27['as'],'attributes':_0xad3f27[_0x6531('0x1f')],'include':_0xad3f27[_0x6531('0x21')]?_[_0x6531('0x22')](_0xad3f27[_0x6531('0x21')],function(_0x274727){return{'model':db[_0x274727['model']],'as':_0x274727['as'],'attributes':_0x274727[_0x6531('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x6531('0xf')](function(_0x4ada38){logger['info'](_0x6531('0x24'),_0x4c6f78);logger[_0x6531('0x13')](_0x6531('0x24'),_0x4c6f78,JSON[_0x6531('0x15')](_0x4ada38));_0x3b852d(_0x4ada38);})['catch'](function(_0xedb555){logger['error'](_0x6531('0x24'),_0xedb555[_0x6531('0x17')],_0x4c6f78);_0x5e4697(_0x374677['error'](0x1f4,_0xedb555[_0x6531('0x17')]));});});};exports[_0x6531('0x25')]=function(_0x4bbd53){var _0x4db2de=this;return new Promise(function(_0xad61c8,_0x1270a6){return db[_0x6531('0x1a')][_0x6531('0x26')]({'raw':_0x4bbd53[_0x6531('0x1c')]?_0x4bbd53['options']['raw']===undefined?!![]:![]:!![],'where':_0x4bbd53[_0x6531('0x1c')]?_0x4bbd53['options']['where']||null:null,'attributes':_0x4bbd53['options']?_0x4bbd53['options'][_0x6531('0x1f')]||null:null,'include':_0x4bbd53[_0x6531('0x1c')]?_0x4bbd53[_0x6531('0x1c')][_0x6531('0x21')]?_[_0x6531('0x22')](_0x4bbd53[_0x6531('0x1c')]['include'],function(_0x4d335c){return{'model':db[_0x4d335c[_0x6531('0x23')]],'as':_0x4d335c['as'],'attributes':_0x4d335c[_0x6531('0x1f')],'include':_0x4d335c[_0x6531('0x21')]?_['map'](_0x4d335c[_0x6531('0x21')],function(_0x2b93b9){return{'model':db[_0x2b93b9[_0x6531('0x23')]],'as':_0x2b93b9['as'],'attributes':_0x2b93b9['attributes'],'include':_0x2b93b9['include']?_[_0x6531('0x22')](_0x2b93b9[_0x6531('0x21')],function(_0x7d3c9f){return{'model':db[_0x7d3c9f[_0x6531('0x23')]],'as':_0x7d3c9f['as'],'attributes':_0x7d3c9f['attributes']};}):[]};}):[]};}):[]:[]})[_0x6531('0xf')](function(_0x1eaf3f){logger['info'](_0x6531('0x25'),_0x4bbd53);logger[_0x6531('0x13')]('ShowSmsQueue',_0x4bbd53,JSON[_0x6531('0x15')](_0x1eaf3f));_0xad61c8(_0x1eaf3f);})[_0x6531('0x19')](function(_0x49d97e){logger[_0x6531('0x16')]('ShowSmsQueue',_0x49d97e[_0x6531('0x17')],_0x4bbd53);_0x1270a6(_0x4db2de['error'](0x1f4,_0x49d97e[_0x6531('0x17')]));});});}; \ No newline at end of file +var _0xb313=['util','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','redis','socket.io-emitter','register','request','then','SmsQueue,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','options','raw','include','model','attributes','map','GetSmsQueue','stringify','find','debug','ShowSmsQueue','lodash'];(function(_0x34ff8f,_0x916cd3){var _0x959b29=function(_0x29e3e0){while(--_0x29e3e0){_0x34ff8f['push'](_0x34ff8f['shift']());}};_0x959b29(++_0x916cd3);}(_0xb313,0xed));var _0x3b31=function(_0x491d35,_0x43f6e5){_0x491d35=_0x491d35-0x0;var _0x5a2de7=_0xb313[_0x491d35];return _0x5a2de7;};'use strict';var _=require(_0x3b31('0x0'));var util=require(_0x3b31('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x3b31('0x2'));var fs=require('fs');var Redis=require(_0x3b31('0x3'));var db=require(_0x3b31('0x4'))['db'];var utils=require(_0x3b31('0x5'));var logger=require('../../config/logger')(_0x3b31('0x6'));var config=require(_0x3b31('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x3b31('0x8')][_0x3b31('0x9')]({'port':0x232a});config[_0x3b31('0xa')]=_['defaults'](config[_0x3b31('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x3b31('0xb'))(new Redis(config[_0x3b31('0xa')]));require('./smsQueue.socket')[_0x3b31('0xc')](socket);function respondWithRpcPromise(_0x192bcd,_0x562440,_0x66fc53){return new BPromise(function(_0x49ee37,_0x678248){return client[_0x3b31('0xd')](_0x192bcd,_0x66fc53)[_0x3b31('0xe')](function(_0x5d59e9){logger['info'](_0x3b31('0xf'),_0x562440,_0x3b31('0x10'));logger['debug']('SmsQueue,\x20%s,\x20%s,\x20%s',_0x562440,_0x3b31('0x10'),JSON['stringify'](_0x5d59e9));if(_0x5d59e9[_0x3b31('0x11')]){if(_0x5d59e9[_0x3b31('0x11')][_0x3b31('0x12')]===0x1f4){logger[_0x3b31('0x11')](_0x3b31('0xf'),_0x562440,_0x5d59e9[_0x3b31('0x11')][_0x3b31('0x13')]);return _0x678248(_0x5d59e9[_0x3b31('0x11')]['message']);}logger[_0x3b31('0x11')](_0x3b31('0xf'),_0x562440,_0x5d59e9[_0x3b31('0x11')][_0x3b31('0x13')]);return _0x49ee37(_0x5d59e9[_0x3b31('0x11')][_0x3b31('0x13')]);}else{logger[_0x3b31('0x14')](_0x3b31('0xf'),_0x562440,_0x3b31('0x10'));_0x49ee37(_0x5d59e9[_0x3b31('0x15')]['message']);}})[_0x3b31('0x16')](function(_0x5a5e9a){logger[_0x3b31('0x11')](_0x3b31('0xf'),_0x562440,_0x5a5e9a);_0x678248(_0x5a5e9a);});});}exports['GetSmsQueue']=function(_0x3328da){var _0x891fda=this;return new Promise(function(_0x10aadb,_0x32faf9){return db['SmsQueue']['findAll']({'raw':_0x3328da[_0x3b31('0x17')]?_0x3328da[_0x3b31('0x17')][_0x3b31('0x18')]===undefined?!![]:![]:!![],'where':_0x3328da[_0x3b31('0x17')]?_0x3328da['options']['where']||null:null,'attributes':_0x3328da[_0x3b31('0x17')]?_0x3328da['options']['attributes']||null:null,'limit':_0x3328da[_0x3b31('0x17')]?_0x3328da[_0x3b31('0x17')]['limit']||null:null,'include':_0x3328da[_0x3b31('0x17')]?_0x3328da['options'][_0x3b31('0x19')]?_['map'](_0x3328da[_0x3b31('0x17')][_0x3b31('0x19')],function(_0x11c427){return{'model':db[_0x11c427[_0x3b31('0x1a')]],'as':_0x11c427['as'],'attributes':_0x11c427[_0x3b31('0x1b')],'include':_0x11c427[_0x3b31('0x19')]?_['map'](_0x11c427['include'],function(_0x2723b2){return{'model':db[_0x2723b2[_0x3b31('0x1a')]],'as':_0x2723b2['as'],'attributes':_0x2723b2['attributes'],'include':_0x2723b2[_0x3b31('0x19')]?_[_0x3b31('0x1c')](_0x2723b2[_0x3b31('0x19')],function(_0x3ac919){return{'model':db[_0x3ac919['model']],'as':_0x3ac919['as'],'attributes':_0x3ac919[_0x3b31('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x3b31('0xe')](function(_0x26e739){logger[_0x3b31('0x14')](_0x3b31('0x1d'),_0x3328da);logger['debug'](_0x3b31('0x1d'),_0x3328da,JSON[_0x3b31('0x1e')](_0x26e739));_0x10aadb(_0x26e739);})[_0x3b31('0x16')](function(_0x5bd170){logger[_0x3b31('0x11')]('GetSmsQueue',_0x5bd170[_0x3b31('0x13')],_0x3328da);_0x32faf9(_0x891fda[_0x3b31('0x11')](0x1f4,_0x5bd170['message']));});});};exports['ShowSmsQueue']=function(_0x50edc1){var _0x1583bf=this;return new Promise(function(_0x26b2d0,_0x2764e2){return db['SmsQueue'][_0x3b31('0x1f')]({'raw':_0x50edc1[_0x3b31('0x17')]?_0x50edc1['options'][_0x3b31('0x18')]===undefined?!![]:![]:!![],'where':_0x50edc1['options']?_0x50edc1[_0x3b31('0x17')]['where']||null:null,'attributes':_0x50edc1['options']?_0x50edc1[_0x3b31('0x17')][_0x3b31('0x1b')]||null:null,'include':_0x50edc1[_0x3b31('0x17')]?_0x50edc1[_0x3b31('0x17')][_0x3b31('0x19')]?_[_0x3b31('0x1c')](_0x50edc1[_0x3b31('0x17')][_0x3b31('0x19')],function(_0x54d36d){return{'model':db[_0x54d36d[_0x3b31('0x1a')]],'as':_0x54d36d['as'],'attributes':_0x54d36d[_0x3b31('0x1b')],'include':_0x54d36d[_0x3b31('0x19')]?_['map'](_0x54d36d[_0x3b31('0x19')],function(_0x2d9a03){return{'model':db[_0x2d9a03[_0x3b31('0x1a')]],'as':_0x2d9a03['as'],'attributes':_0x2d9a03[_0x3b31('0x1b')],'include':_0x2d9a03['include']?_[_0x3b31('0x1c')](_0x2d9a03[_0x3b31('0x19')],function(_0x24b835){return{'model':db[_0x24b835[_0x3b31('0x1a')]],'as':_0x24b835['as'],'attributes':_0x24b835[_0x3b31('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x3b31('0xe')](function(_0x5b0c45){logger[_0x3b31('0x14')]('ShowSmsQueue',_0x50edc1);logger[_0x3b31('0x20')]('ShowSmsQueue',_0x50edc1,JSON['stringify'](_0x5b0c45));_0x26b2d0(_0x5b0c45);})[_0x3b31('0x16')](function(_0x1e10aa){logger[_0x3b31('0x11')](_0x3b31('0x21'),_0x1e10aa[_0x3b31('0x13')],_0x50edc1);_0x2764e2(_0x1583bf[_0x3b31('0x11')](0x1f4,_0x1e10aa['message']));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 2fd2c41..0271860 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 _0xb952=['removeListener','register','length','./smsQueue.events','save','emit'];(function(_0x136d42,_0x3c89c3){var _0x4bd8cf=function(_0x5755fc){while(--_0x5755fc){_0x136d42['push'](_0x136d42['shift']());}};_0x4bd8cf(++_0x3c89c3);}(_0xb952,0x14d));var _0x2b95=function(_0x30999c,_0x2623dd){_0x30999c=_0x30999c-0x0;var _0x5f2c04=_0xb952[_0x30999c];return _0x5f2c04;};'use strict';var SmsQueueEvents=require(_0x2b95('0x0'));var events=[_0x2b95('0x1'),'remove','update'];function createListener(_0x3a999c,_0x4cc877){return function(_0x5753f7){_0x4cc877[_0x2b95('0x2')](_0x3a999c,_0x5753f7);};}function removeListener(_0x5e01b1,_0x496a2d){return function(){SmsQueueEvents[_0x2b95('0x3')](_0x5e01b1,_0x496a2d);};}exports[_0x2b95('0x4')]=function(_0x406f83){for(var _0x4b5682=0x0,_0x326e72=events[_0x2b95('0x5')];_0x4b5682<_0x326e72;_0x4b5682++){var _0x399767=events[_0x4b5682];var _0x1b3d4b=createListener('smsQueue:'+_0x399767,_0x406f83);SmsQueueEvents['on'](_0x399767,_0x1b3d4b);}}; \ No newline at end of file +var _0xc38a=['remove','update','emit','register','length','smsQueue:','./smsQueue.events'];(function(_0x46cf00,_0x457a43){var _0x3974dc=function(_0x4b5d0a){while(--_0x4b5d0a){_0x46cf00['push'](_0x46cf00['shift']());}};_0x3974dc(++_0x457a43);}(_0xc38a,0x1b8));var _0xac38=function(_0x5d2c6a,_0x196724){_0x5d2c6a=_0x5d2c6a-0x0;var _0x4420af=_0xc38a[_0x5d2c6a];return _0x4420af;};'use strict';var SmsQueueEvents=require(_0xac38('0x0'));var events=['save',_0xac38('0x1'),_0xac38('0x2')];function createListener(_0x46e28a,_0x4cbfaa){return function(_0x2743f8){_0x4cbfaa[_0xac38('0x3')](_0x46e28a,_0x2743f8);};}function removeListener(_0x5e6f43,_0x137b5d){return function(){SmsQueueEvents['removeListener'](_0x5e6f43,_0x137b5d);};}exports[_0xac38('0x4')]=function(_0x349dea){for(var _0x30b8d7=0x0,_0x47e7e8=events[_0xac38('0x5')];_0x30b8d7<_0x47e7e8;_0x30b8d7++){var _0x5a4d52=events[_0x30b8d7];var _0x27f201=createListener(_0xac38('0x6')+_0x5a4d52,_0x349dea);SmsQueueEvents['on'](_0x5a4d52,_0x27f201);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index f8281f1..c910338 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 _0xdd82=['express','Router','../../config/environment','./smsQueueReport.controller','isAuthenticated','index','/describe','get','/:id','show','post','create','destroy','exports','multer','connect-timeout'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xdd82,0x18e));var _0x2dd8=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xdd82[_0x1facfa];return _0x9ec701;};'use strict';var multer=require(_0x2dd8('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x2dd8('0x1'));var express=require(_0x2dd8('0x2'));var router=express[_0x2dd8('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x2dd8('0x4'));var controller=require(_0x2dd8('0x5'));router['get']('/',auth[_0x2dd8('0x6')](),controller[_0x2dd8('0x7')]);router['get'](_0x2dd8('0x8'),auth[_0x2dd8('0x6')](),controller['describe']);router[_0x2dd8('0x9')](_0x2dd8('0xa'),auth['isAuthenticated'](),controller[_0x2dd8('0xb')]);router[_0x2dd8('0xc')]('/',auth[_0x2dd8('0x6')](),controller[_0x2dd8('0xd')]);router['put']('/:id',auth[_0x2dd8('0x6')](),controller['update']);router['delete']('/:id',auth[_0x2dd8('0x6')](),controller[_0x2dd8('0xe')]);module[_0x2dd8('0xf')]=router; \ No newline at end of file +var _0x5ab9=['../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create','put','delete','multer','util','connect-timeout','express','Router'];(function(_0x5d8fa2,_0xd080b7){var _0xb33132=function(_0x28741d){while(--_0x28741d){_0x5d8fa2['push'](_0x5d8fa2['shift']());}};_0xb33132(++_0xd080b7);}(_0x5ab9,0x1d6));var _0x95ab=function(_0x2d8eac,_0x4d2f89){_0x2d8eac=_0x2d8eac-0x0;var _0x4af6a7=_0x5ab9[_0x2d8eac];return _0x4af6a7;};'use strict';var multer=require(_0x95ab('0x0'));var util=require(_0x95ab('0x1'));var path=require('path');var timeout=require(_0x95ab('0x2'));var express=require(_0x95ab('0x3'));var router=express[_0x95ab('0x4')]();var auth=require(_0x95ab('0x5'));var interaction=require(_0x95ab('0x6'));var config=require(_0x95ab('0x7'));var controller=require(_0x95ab('0x8'));router[_0x95ab('0x9')]('/',auth[_0x95ab('0xa')](),controller[_0x95ab('0xb')]);router['get'](_0x95ab('0xc'),auth[_0x95ab('0xa')](),controller[_0x95ab('0xd')]);router[_0x95ab('0x9')](_0x95ab('0xe'),auth[_0x95ab('0xa')](),controller[_0x95ab('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0x95ab('0x10')]);router[_0x95ab('0x11')](_0x95ab('0xe'),auth[_0x95ab('0xa')](),controller['update']);router[_0x95ab('0x12')](_0x95ab('0xe'),auth[_0x95ab('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index def6011..0ec6f36 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 _0x3dd1=['DATE','moment','sequelize','exports','STRING'];(function(_0x2cc0b3,_0x120bf1){var _0x1667ef=function(_0x3abcb4){while(--_0x3abcb4){_0x2cc0b3['push'](_0x2cc0b3['shift']());}};_0x1667ef(++_0x120bf1);}(_0x3dd1,0x1e6));var _0x13dd=function(_0x4fa3a0,_0x530b99){_0x4fa3a0=_0x4fa3a0-0x0;var _0x38f908=_0x3dd1[_0x4fa3a0];return _0x38f908;};'use strict';var moment=require(_0x13dd('0x0'));var Sequelize=require(_0x13dd('0x1'));module[_0x13dd('0x2')]={'uniqueid':{'type':Sequelize[_0x13dd('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x13dd('0x3')]},'joinAt':{'type':Sequelize[_0x13dd('0x4')]},'leaveAt':{'type':Sequelize[_0x13dd('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x13dd('0x4')]},'reason':{'type':Sequelize[_0x13dd('0x3')]}}; \ No newline at end of file +var _0xda7e=['STRING','DATE','moment','sequelize'];(function(_0x55677b,_0x3e5655){var _0x104b88=function(_0x78d34f){while(--_0x78d34f){_0x55677b['push'](_0x55677b['shift']());}};_0x104b88(++_0x3e5655);}(_0xda7e,0x1b2));var _0xeda7=function(_0x55c1f0,_0x4f574f){_0x55c1f0=_0x55c1f0-0x0;var _0x1530fa=_0xda7e[_0x55c1f0];return _0x1530fa;};'use strict';var moment=require(_0xeda7('0x0'));var Sequelize=require(_0xeda7('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xeda7('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xeda7('0x2')]},'joinAt':{'type':Sequelize[_0xeda7('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xeda7('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index df36bd0..5684f53 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 _0x46a8=['length','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','options','includeAll','findAll','rows','params','keys','rawAttributes','include','catch','create','body','find','describe','html-pdf','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','status','json','count','offset','apply','save','update','then','destroy','sendStatus','error','name','send','index','map','SmsQueueReport','fieldName','type','query','filters','intersection','model','fields','attributes'];(function(_0x15d56e,_0x4c567e){var _0x3cdd8c=function(_0x345851){while(--_0x345851){_0x15d56e['push'](_0x15d56e['shift']());}};_0x3cdd8c(++_0x4c567e);}(_0x46a8,0xe6));var _0x846a=function(_0x2c1450,_0x131773){_0x2c1450=_0x2c1450-0x0;var _0x5ba1de=_0x46a8[_0x2c1450];return _0x5ba1de;};'use strict';var pdf=require(_0x846a('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x846a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x846a('0x2'));var moment=require(_0x846a('0x3'));var BPromise=require(_0x846a('0x4'));var Mustache=require(_0x846a('0x5'));var util=require(_0x846a('0x6'));var path=require(_0x846a('0x7'));var sox=require(_0x846a('0x8'));var csv=require(_0x846a('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x846a('0xa'));var squel=require('squel');var crypto=require(_0x846a('0xb'));var jsforce=require(_0x846a('0xc'));var deskjs=require(_0x846a('0xd'));var toCsv=require(_0x846a('0x9'));var querystring=require(_0x846a('0xe'));var Papa=require(_0x846a('0xf'));var Redis=require(_0x846a('0x10'));var authService=require(_0x846a('0x11'));var qs=require(_0x846a('0x12'));var as=require(_0x846a('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x846a('0x14'));var utils=require(_0x846a('0x15'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5d2db6,_0x42556c){_0x42556c=_0x42556c||0xcc;return function(_0x47adbf){if(_0x47adbf){return _0x5d2db6['sendStatus'](_0x42556c);}return _0x5d2db6[_0x846a('0x16')](_0x42556c)['end']();};}function respondWithResult(_0x49a611,_0x1e1f63){_0x1e1f63=_0x1e1f63||0xc8;return function(_0x10bcde){if(_0x10bcde){return _0x49a611['status'](_0x1e1f63)[_0x846a('0x17')](_0x10bcde);}};}function respondWithFilteredResult(_0x2ea619,_0x4aa05b){return function(_0xc36484){if(_0xc36484){var _0x14b920=_0xc36484[_0x846a('0x18')],_0x3c228b=_0x4aa05b[_0x846a('0x19')],_0x2afb18=_0x4aa05b[_0x846a('0x19')]+_0x4aa05b['limit'],_0x3d5564;if(_0x2afb18>=_0x14b920){_0x2afb18=_0x14b920;_0x3d5564=0xc8;}else{_0x3d5564=0xce;}_0x2ea619[_0x846a('0x16')](_0x3d5564);return _0x2ea619['set']('Content-Range',_0x3c228b+'-'+_0x2afb18+'/'+_0x14b920)['json'](_0xc36484);}return null;};}function patchUpdates(_0x1a55bb){return function(_0x25a5d6){try{jsonpatch[_0x846a('0x1a')](_0x25a5d6,_0x1a55bb,!![]);}catch(_0x239761){return BPromise['reject'](_0x239761);}return _0x25a5d6[_0x846a('0x1b')]();};}function saveUpdates(_0x4d9895,_0x762ce2){return function(_0x56ad0){if(_0x56ad0){return _0x56ad0[_0x846a('0x1c')](_0x4d9895)[_0x846a('0x1d')](function(_0x2a180b){return _0x2a180b;});}return null;};}function removeEntity(_0x2916bd,_0x7655fd){return function(_0x4c94a6){if(_0x4c94a6){return _0x4c94a6[_0x846a('0x1e')]()[_0x846a('0x1d')](function(){_0x2916bd['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1b5d11,_0x5103a2){return function(_0x53b515){if(!_0x53b515){_0x1b5d11[_0x846a('0x1f')](0x194);}return _0x53b515;};}function handleError(_0x50ec4c,_0x283467){_0x283467=_0x283467||0x1f4;return function(_0x500aeb){logger[_0x846a('0x20')](_0x500aeb['stack']);if(_0x500aeb[_0x846a('0x21')]){delete _0x500aeb[_0x846a('0x21')];}_0x50ec4c[_0x846a('0x16')](_0x283467)[_0x846a('0x22')](_0x500aeb);};}exports[_0x846a('0x23')]=function(_0x3e1c13,_0xee5d9f){var _0x4ee54d={},_0x48d0dc={},_0x45f8d9={'count':0x0,'rows':[]};var _0x1d19b5=_[_0x846a('0x24')](db[_0x846a('0x25')]['rawAttributes'],function(_0x5f511e){return{'name':_0x5f511e[_0x846a('0x26')],'type':_0x5f511e[_0x846a('0x27')]['key']};});_0x48d0dc['model']=_['map'](_0x1d19b5,'name');_0x48d0dc[_0x846a('0x28')]=_['keys'](_0x3e1c13[_0x846a('0x28')]);_0x48d0dc[_0x846a('0x29')]=_[_0x846a('0x2a')](_0x48d0dc['model'],_0x48d0dc[_0x846a('0x28')]);_0x4ee54d['attributes']=_[_0x846a('0x2a')](_0x48d0dc[_0x846a('0x2b')],qs[_0x846a('0x2c')](_0x3e1c13['query']['fields']));_0x4ee54d['attributes']=_0x4ee54d[_0x846a('0x2d')][_0x846a('0x2e')]?_0x4ee54d[_0x846a('0x2d')]:_0x48d0dc[_0x846a('0x2b')];if(!_0x3e1c13[_0x846a('0x28')][_0x846a('0x2f')](_0x846a('0x30'))){_0x4ee54d[_0x846a('0x31')]=qs[_0x846a('0x31')](_0x3e1c13[_0x846a('0x28')][_0x846a('0x31')]);_0x4ee54d['offset']=qs[_0x846a('0x19')](_0x3e1c13[_0x846a('0x28')][_0x846a('0x19')]);}_0x4ee54d[_0x846a('0x32')]=qs[_0x846a('0x33')](_0x3e1c13[_0x846a('0x28')]['sort']);_0x4ee54d[_0x846a('0x34')]=qs['filters'](_[_0x846a('0x35')](_0x3e1c13[_0x846a('0x28')],_0x48d0dc[_0x846a('0x29')]));if(_0x3e1c13['query']['filter']){_0x4ee54d[_0x846a('0x34')]=_[_0x846a('0x36')](_0x4ee54d[_0x846a('0x34')],{'$or':_['map'](_0x1d19b5,function(_0x5cfbe5){if(_0x5cfbe5[_0x846a('0x27')]!==_0x846a('0x37')){var _0x5e82f4={};_0x5e82f4[_0x5cfbe5[_0x846a('0x21')]]={'$like':'%'+_0x3e1c13['query']['filter']+'%'};return _0x5e82f4;}})});}_0x4ee54d=_[_0x846a('0x36')]({},_0x4ee54d,_0x3e1c13[_0x846a('0x38')]);var _0x35479f={'where':_0x4ee54d['where']};return db[_0x846a('0x25')][_0x846a('0x18')](_0x35479f)[_0x846a('0x1d')](function(_0x2e1ed1){_0x45f8d9[_0x846a('0x18')]=_0x2e1ed1;if(_0x3e1c13[_0x846a('0x28')][_0x846a('0x39')]){_0x4ee54d['include']=[{'all':!![]}];}return db[_0x846a('0x25')][_0x846a('0x3a')](_0x4ee54d);})['then'](function(_0x5f1b07){_0x45f8d9[_0x846a('0x3b')]=_0x5f1b07;return _0x45f8d9;})['then'](respondWithFilteredResult(_0xee5d9f,_0x4ee54d))['catch'](handleError(_0xee5d9f,null));};exports['show']=function(_0x5d76fb,_0x421087){var _0x20f819={'raw':!![],'where':{'id':_0x5d76fb[_0x846a('0x3c')]['id']}},_0x21a06e={};_0x21a06e[_0x846a('0x2b')]=_[_0x846a('0x3d')](db[_0x846a('0x25')][_0x846a('0x3e')]);_0x21a06e[_0x846a('0x28')]=_[_0x846a('0x3d')](_0x5d76fb[_0x846a('0x28')]);_0x21a06e['filters']=_[_0x846a('0x2a')](_0x21a06e[_0x846a('0x2b')],_0x21a06e['query']);_0x20f819[_0x846a('0x2d')]=_[_0x846a('0x2a')](_0x21a06e[_0x846a('0x2b')],qs[_0x846a('0x2c')](_0x5d76fb[_0x846a('0x28')][_0x846a('0x2c')]));_0x20f819[_0x846a('0x2d')]=_0x20f819[_0x846a('0x2d')][_0x846a('0x2e')]?_0x20f819[_0x846a('0x2d')]:_0x21a06e[_0x846a('0x2b')];if(_0x5d76fb[_0x846a('0x28')]['includeAll']){_0x20f819[_0x846a('0x3f')]=[{'all':!![]}];}_0x20f819=_[_0x846a('0x36')]({},_0x20f819,_0x5d76fb[_0x846a('0x38')]);return db[_0x846a('0x25')]['find'](_0x20f819)['then'](handleEntityNotFound(_0x421087,null))[_0x846a('0x1d')](respondWithResult(_0x421087,null))[_0x846a('0x40')](handleError(_0x421087,null));};exports[_0x846a('0x41')]=function(_0x3649de,_0x576683){return db[_0x846a('0x25')][_0x846a('0x41')](_0x3649de[_0x846a('0x42')],{})[_0x846a('0x1d')](respondWithResult(_0x576683,0xc9))[_0x846a('0x40')](handleError(_0x576683,null));};exports['update']=function(_0xf73b8d,_0x1b91bb){if(_0xf73b8d[_0x846a('0x42')]['id']){delete _0xf73b8d[_0x846a('0x42')]['id'];}return db[_0x846a('0x25')][_0x846a('0x43')]({'where':{'id':_0xf73b8d[_0x846a('0x3c')]['id']}})[_0x846a('0x1d')](handleEntityNotFound(_0x1b91bb,null))[_0x846a('0x1d')](saveUpdates(_0xf73b8d[_0x846a('0x42')],null))[_0x846a('0x1d')](respondWithResult(_0x1b91bb,null))[_0x846a('0x40')](handleError(_0x1b91bb,null));};exports[_0x846a('0x1e')]=function(_0x5c8139,_0x20c0ba){return db[_0x846a('0x25')]['find']({'where':{'id':_0x5c8139['params']['id']}})['then'](handleEntityNotFound(_0x20c0ba,null))[_0x846a('0x1d')](removeEntity(_0x20c0ba,null))[_0x846a('0x40')](handleError(_0x20c0ba,null));};exports[_0x846a('0x44')]=function(_0x16419f,_0x41a335){return db[_0x846a('0x25')][_0x846a('0x44')]()[_0x846a('0x1d')](respondWithResult(_0x41a335,null))['catch'](handleError(_0x41a335,null));}; \ No newline at end of file +var _0xfe32=['api','../../config/utils','../../config/environment','sendStatus','end','status','count','offset','limit','Content-Range','json','apply','reject','update','then','error','stack','name','send','index','map','SmsQueueReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','catch','show','params','keys','length','create','body','find','describe','html-pdf','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x31aa1e,_0x4bb2e2){var _0x421636=function(_0x32a698){while(--_0x32a698){_0x31aa1e['push'](_0x31aa1e['shift']());}};_0x421636(++_0x4bb2e2);}(_0xfe32,0x1e4));var _0x2fe3=function(_0x2d5e63,_0x4b592b){_0x2d5e63=_0x2d5e63-0x0;var _0x4c9f37=_0xfe32[_0x2d5e63];return _0x4c9f37;};'use strict';var pdf=require(_0x2fe3('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x2fe3('0x1'));var BPromise=require(_0x2fe3('0x2'));var Mustache=require(_0x2fe3('0x3'));var util=require('util');var path=require(_0x2fe3('0x4'));var sox=require(_0x2fe3('0x5'));var csv=require(_0x2fe3('0x6'));var ejs=require(_0x2fe3('0x7'));var fs=require('fs');var _=require(_0x2fe3('0x8'));var squel=require(_0x2fe3('0x9'));var crypto=require(_0x2fe3('0xa'));var jsforce=require(_0x2fe3('0xb'));var deskjs=require(_0x2fe3('0xc'));var toCsv=require(_0x2fe3('0x6'));var querystring=require('querystring');var Papa=require(_0x2fe3('0xd'));var Redis=require(_0x2fe3('0xe'));var authService=require(_0x2fe3('0xf'));var qs=require(_0x2fe3('0x10'));var as=require(_0x2fe3('0x11'));var hardwareService=require(_0x2fe3('0x12'));var logger=require(_0x2fe3('0x13'))(_0x2fe3('0x14'));var utils=require(_0x2fe3('0x15'));var config=require(_0x2fe3('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x399b46,_0x3c8616){_0x3c8616=_0x3c8616||0xcc;return function(_0x141db1){if(_0x141db1){return _0x399b46[_0x2fe3('0x17')](_0x3c8616);}return _0x399b46['status'](_0x3c8616)[_0x2fe3('0x18')]();};}function respondWithResult(_0x4f63eb,_0x423f66){_0x423f66=_0x423f66||0xc8;return function(_0xc2416e){if(_0xc2416e){return _0x4f63eb[_0x2fe3('0x19')](_0x423f66)['json'](_0xc2416e);}};}function respondWithFilteredResult(_0x510649,_0x2af443){return function(_0x1315e7){if(_0x1315e7){var _0x5bd55c=_0x1315e7[_0x2fe3('0x1a')],_0x1a26af=_0x2af443[_0x2fe3('0x1b')],_0x52fb19=_0x2af443[_0x2fe3('0x1b')]+_0x2af443[_0x2fe3('0x1c')],_0x2755a6;if(_0x52fb19>=_0x5bd55c){_0x52fb19=_0x5bd55c;_0x2755a6=0xc8;}else{_0x2755a6=0xce;}_0x510649[_0x2fe3('0x19')](_0x2755a6);return _0x510649['set'](_0x2fe3('0x1d'),_0x1a26af+'-'+_0x52fb19+'/'+_0x5bd55c)[_0x2fe3('0x1e')](_0x1315e7);}return null;};}function patchUpdates(_0x3fd046){return function(_0x4f11b9){try{jsonpatch[_0x2fe3('0x1f')](_0x4f11b9,_0x3fd046,!![]);}catch(_0x2d956b){return BPromise[_0x2fe3('0x20')](_0x2d956b);}return _0x4f11b9['save']();};}function saveUpdates(_0x135203,_0x4730cb){return function(_0x3cd4fd){if(_0x3cd4fd){return _0x3cd4fd[_0x2fe3('0x21')](_0x135203)[_0x2fe3('0x22')](function(_0x2a6878){return _0x2a6878;});}return null;};}function removeEntity(_0x1bc2ec,_0x30e51b){return function(_0x1c00a6){if(_0x1c00a6){return _0x1c00a6['destroy']()[_0x2fe3('0x22')](function(){_0x1bc2ec['status'](0xcc)[_0x2fe3('0x18')]();});}};}function handleEntityNotFound(_0x4a45e0,_0x3bc16f){return function(_0x71ab1b){if(!_0x71ab1b){_0x4a45e0['sendStatus'](0x194);}return _0x71ab1b;};}function handleError(_0x1c1358,_0x3c9cfa){_0x3c9cfa=_0x3c9cfa||0x1f4;return function(_0xc3b85e){logger[_0x2fe3('0x23')](_0xc3b85e[_0x2fe3('0x24')]);if(_0xc3b85e['name']){delete _0xc3b85e[_0x2fe3('0x25')];}_0x1c1358[_0x2fe3('0x19')](_0x3c9cfa)[_0x2fe3('0x26')](_0xc3b85e);};}exports[_0x2fe3('0x27')]=function(_0x107b4b,_0x18de8d){var _0x29fe65={},_0x5c4596={},_0x346292={'count':0x0,'rows':[]};var _0x57e48b=_[_0x2fe3('0x28')](db[_0x2fe3('0x29')][_0x2fe3('0x2a')],function(_0x3c21de){return{'name':_0x3c21de[_0x2fe3('0x2b')],'type':_0x3c21de[_0x2fe3('0x2c')][_0x2fe3('0x2d')]};});_0x5c4596[_0x2fe3('0x2e')]=_[_0x2fe3('0x28')](_0x57e48b,_0x2fe3('0x25'));_0x5c4596[_0x2fe3('0x2f')]=_['keys'](_0x107b4b[_0x2fe3('0x2f')]);_0x5c4596[_0x2fe3('0x30')]=_[_0x2fe3('0x31')](_0x5c4596[_0x2fe3('0x2e')],_0x5c4596[_0x2fe3('0x2f')]);_0x29fe65[_0x2fe3('0x32')]=_['intersection'](_0x5c4596[_0x2fe3('0x2e')],qs['fields'](_0x107b4b[_0x2fe3('0x2f')][_0x2fe3('0x33')]));_0x29fe65[_0x2fe3('0x32')]=_0x29fe65[_0x2fe3('0x32')]['length']?_0x29fe65[_0x2fe3('0x32')]:_0x5c4596[_0x2fe3('0x2e')];if(!_0x107b4b['query'][_0x2fe3('0x34')](_0x2fe3('0x35'))){_0x29fe65[_0x2fe3('0x1c')]=qs['limit'](_0x107b4b['query'][_0x2fe3('0x1c')]);_0x29fe65[_0x2fe3('0x1b')]=qs[_0x2fe3('0x1b')](_0x107b4b[_0x2fe3('0x2f')][_0x2fe3('0x1b')]);}_0x29fe65[_0x2fe3('0x36')]=qs['sort'](_0x107b4b[_0x2fe3('0x2f')]['sort']);_0x29fe65['where']=qs[_0x2fe3('0x30')](_[_0x2fe3('0x37')](_0x107b4b[_0x2fe3('0x2f')],_0x5c4596[_0x2fe3('0x30')]));if(_0x107b4b[_0x2fe3('0x2f')][_0x2fe3('0x38')]){_0x29fe65['where']=_['merge'](_0x29fe65['where'],{'$or':_[_0x2fe3('0x28')](_0x57e48b,function(_0x229e6c){if(_0x229e6c[_0x2fe3('0x2c')]!==_0x2fe3('0x39')){var _0x3d17d9={};_0x3d17d9[_0x229e6c['name']]={'$like':'%'+_0x107b4b['query'][_0x2fe3('0x38')]+'%'};return _0x3d17d9;}})});}_0x29fe65=_[_0x2fe3('0x3a')]({},_0x29fe65,_0x107b4b[_0x2fe3('0x3b')]);var _0x207e46={'where':_0x29fe65['where']};return db[_0x2fe3('0x29')][_0x2fe3('0x1a')](_0x207e46)[_0x2fe3('0x22')](function(_0x5701fd){_0x346292[_0x2fe3('0x1a')]=_0x5701fd;if(_0x107b4b['query'][_0x2fe3('0x3c')]){_0x29fe65[_0x2fe3('0x3d')]=[{'all':!![]}];}return db['SmsQueueReport']['findAll'](_0x29fe65);})[_0x2fe3('0x22')](function(_0x85e06f){_0x346292[_0x2fe3('0x3e')]=_0x85e06f;return _0x346292;})[_0x2fe3('0x22')](respondWithFilteredResult(_0x18de8d,_0x29fe65))[_0x2fe3('0x3f')](handleError(_0x18de8d,null));};exports[_0x2fe3('0x40')]=function(_0x454104,_0x2b6d10){var _0x4febe7={'raw':!![],'where':{'id':_0x454104[_0x2fe3('0x41')]['id']}},_0x4e8a48={};_0x4e8a48['model']=_[_0x2fe3('0x42')](db[_0x2fe3('0x29')]['rawAttributes']);_0x4e8a48[_0x2fe3('0x2f')]=_['keys'](_0x454104[_0x2fe3('0x2f')]);_0x4e8a48[_0x2fe3('0x30')]=_['intersection'](_0x4e8a48[_0x2fe3('0x2e')],_0x4e8a48[_0x2fe3('0x2f')]);_0x4febe7[_0x2fe3('0x32')]=_[_0x2fe3('0x31')](_0x4e8a48[_0x2fe3('0x2e')],qs['fields'](_0x454104[_0x2fe3('0x2f')][_0x2fe3('0x33')]));_0x4febe7['attributes']=_0x4febe7[_0x2fe3('0x32')][_0x2fe3('0x43')]?_0x4febe7['attributes']:_0x4e8a48[_0x2fe3('0x2e')];if(_0x454104[_0x2fe3('0x2f')]['includeAll']){_0x4febe7[_0x2fe3('0x3d')]=[{'all':!![]}];}_0x4febe7=_['merge']({},_0x4febe7,_0x454104['options']);return db[_0x2fe3('0x29')]['find'](_0x4febe7)[_0x2fe3('0x22')](handleEntityNotFound(_0x2b6d10,null))[_0x2fe3('0x22')](respondWithResult(_0x2b6d10,null))[_0x2fe3('0x3f')](handleError(_0x2b6d10,null));};exports[_0x2fe3('0x44')]=function(_0x2590c2,_0x4e3bbf){return db['SmsQueueReport'][_0x2fe3('0x44')](_0x2590c2[_0x2fe3('0x45')],{})[_0x2fe3('0x22')](respondWithResult(_0x4e3bbf,0xc9))['catch'](handleError(_0x4e3bbf,null));};exports[_0x2fe3('0x21')]=function(_0x3cb4db,_0x2c93e3){if(_0x3cb4db[_0x2fe3('0x45')]['id']){delete _0x3cb4db[_0x2fe3('0x45')]['id'];}return db[_0x2fe3('0x29')][_0x2fe3('0x46')]({'where':{'id':_0x3cb4db[_0x2fe3('0x41')]['id']}})[_0x2fe3('0x22')](handleEntityNotFound(_0x2c93e3,null))['then'](saveUpdates(_0x3cb4db[_0x2fe3('0x45')],null))[_0x2fe3('0x22')](respondWithResult(_0x2c93e3,null))[_0x2fe3('0x3f')](handleError(_0x2c93e3,null));};exports['destroy']=function(_0x3c25ef,_0x5f4f63){return db[_0x2fe3('0x29')][_0x2fe3('0x46')]({'where':{'id':_0x3c25ef['params']['id']}})[_0x2fe3('0x22')](handleEntityNotFound(_0x5f4f63,null))[_0x2fe3('0x22')](removeEntity(_0x5f4f63,null))[_0x2fe3('0x3f')](handleError(_0x5f4f63,null));};exports['describe']=function(_0x4794a7,_0x1e1acc){return db['SmsQueueReport'][_0x2fe3('0x47')]()[_0x2fe3('0x22')](respondWithResult(_0x1e1acc,null))[_0x2fe3('0x3f')](handleError(_0x1e1acc,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index af2663a..8933927 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 _0x5ed3=['define','SmsQueueReport','report_sms_queue','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./smsQueueReport.attributes'];(function(_0x3e4477,_0x15971e){var _0xd46363=function(_0x4d5b90){while(--_0x4d5b90){_0x3e4477['push'](_0x3e4477['shift']());}};_0xd46363(++_0x15971e);}(_0x5ed3,0x9e));var _0x35ed=function(_0xb5950b,_0x383dfe){_0xb5950b=_0xb5950b-0x0;var _0x123ced=_0x5ed3[_0xb5950b];return _0x123ced;};'use strict';var _=require(_0x35ed('0x0'));var util=require(_0x35ed('0x1'));var logger=require(_0x35ed('0x2'))(_0x35ed('0x3'));var moment=require(_0x35ed('0x4'));var BPromise=require(_0x35ed('0x5'));var rp=require(_0x35ed('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x35ed('0x7'));var config=require(_0x35ed('0x8'));var attributes=require(_0x35ed('0x9'));module['exports']=function(_0x592fe2,_0x1b11ce){return _0x592fe2[_0x35ed('0xa')](_0x35ed('0xb'),attributes,{'tableName':_0x35ed('0xc'),'paranoid':![],'indexes':[{'name':_0x35ed('0xd'),'fields':[_0x35ed('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa1a1=['uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsQueueReport.attributes','exports','define','SmsQueueReport','report_sms_queue'];(function(_0x2cfb58,_0x3d9412){var _0xd99951=function(_0x329afa){while(--_0x329afa){_0x2cfb58['push'](_0x2cfb58['shift']());}};_0xd99951(++_0x3d9412);}(_0xa1a1,0x91));var _0x1a1a=function(_0xad57ee,_0x2823a6){_0xad57ee=_0xad57ee-0x0;var _0x3eaea9=_0xa1a1[_0xad57ee];return _0x3eaea9;};'use strict';var _=require(_0x1a1a('0x0'));var util=require(_0x1a1a('0x1'));var logger=require(_0x1a1a('0x2'))(_0x1a1a('0x3'));var moment=require(_0x1a1a('0x4'));var BPromise=require(_0x1a1a('0x5'));var rp=require(_0x1a1a('0x6'));var fs=require('fs');var path=require(_0x1a1a('0x7'));var rimraf=require(_0x1a1a('0x8'));var config=require(_0x1a1a('0x9'));var attributes=require(_0x1a1a('0xa'));module[_0x1a1a('0xb')]=function(_0x264d5c,_0x1e8807){return _0x264d5c[_0x1a1a('0xc')](_0x1a1a('0xd'),attributes,{'tableName':_0x1a1a('0xe'),'paranoid':![],'indexes':[{'name':_0x1a1a('0xf'),'fields':[_0x1a1a('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index 6311f10..d0ad259 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 _0x8936=['code','SmsQueueReport,\x20%s,\x20%s','message','result','catch','CreateSmsQueueReport','SmsQueueReport','create','body','options','UpdateSmsQueueReport','update','raw','where','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','info','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x16954c,_0x2f3051){var _0x93e220=function(_0x539dd1){while(--_0x539dd1){_0x16954c['push'](_0x16954c['shift']());}};_0x93e220(++_0x2f3051);}(_0x8936,0x1dd));var _0x6893=function(_0x163e4e,_0x44cc89){_0x163e4e=_0x163e4e-0x0;var _0x4d825c=_0x8936[_0x163e4e];return _0x4d825c;};'use strict';var _=require(_0x6893('0x0'));var util=require(_0x6893('0x1'));var moment=require(_0x6893('0x2'));var BPromise=require(_0x6893('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6893('0x4'));var db=require(_0x6893('0x5'))['db'];var utils=require(_0x6893('0x6'));var logger=require(_0x6893('0x7'))(_0x6893('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x6893('0x9')][_0x6893('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2f66f0,_0x33c208,_0x497478){return new BPromise(function(_0x5f51eb,_0x581e7b){return client['request'](_0x2f66f0,_0x497478)[_0x6893('0xb')](function(_0x27bcbe){logger[_0x6893('0xc')]('SmsQueueReport,\x20%s,\x20%s',_0x33c208,_0x6893('0xd'));logger[_0x6893('0xe')](_0x6893('0xf'),_0x33c208,_0x6893('0xd'),JSON[_0x6893('0x10')](_0x27bcbe));if(_0x27bcbe[_0x6893('0x11')]){if(_0x27bcbe[_0x6893('0x11')][_0x6893('0x12')]===0x1f4){logger[_0x6893('0x11')](_0x6893('0x13'),_0x33c208,_0x27bcbe[_0x6893('0x11')][_0x6893('0x14')]);return _0x581e7b(_0x27bcbe[_0x6893('0x11')]['message']);}logger['error'](_0x6893('0x13'),_0x33c208,_0x27bcbe[_0x6893('0x11')][_0x6893('0x14')]);return _0x5f51eb(_0x27bcbe[_0x6893('0x11')]['message']);}else{logger[_0x6893('0xc')](_0x6893('0x13'),_0x33c208,_0x6893('0xd'));_0x5f51eb(_0x27bcbe[_0x6893('0x15')][_0x6893('0x14')]);}})[_0x6893('0x16')](function(_0x1e4516){logger[_0x6893('0x11')](_0x6893('0x13'),_0x33c208,_0x1e4516);_0x581e7b(_0x1e4516);});});}exports[_0x6893('0x17')]=function(_0x1f0f7){var _0x58b26d=this;return new Promise(function(_0xb2b86d,_0x43ef3f){return db[_0x6893('0x18')][_0x6893('0x19')](_0x1f0f7[_0x6893('0x1a')],{'raw':_0x1f0f7[_0x6893('0x1b')]?_0x1f0f7[_0x6893('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0x6893('0xb')](function(_0x5924cb){logger[_0x6893('0xc')](_0x6893('0x17'),_0x1f0f7);logger[_0x6893('0xe')](_0x6893('0x17'),_0x1f0f7,JSON[_0x6893('0x10')](_0x5924cb));_0xb2b86d(_0x5924cb);})[_0x6893('0x16')](function(_0x4c216b){logger[_0x6893('0x11')](_0x6893('0x17'),_0x4c216b['message'],_0x1f0f7);_0x43ef3f(_0x58b26d[_0x6893('0x11')](0x1f4,_0x4c216b[_0x6893('0x14')]));});});};exports[_0x6893('0x1c')]=function(_0x4dafd0){var _0x430ea6=this;return new Promise(function(_0x26963a,_0x362a7d){return db[_0x6893('0x18')][_0x6893('0x1d')](_0x4dafd0[_0x6893('0x1a')],{'raw':_0x4dafd0[_0x6893('0x1b')]?_0x4dafd0[_0x6893('0x1b')][_0x6893('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4dafd0[_0x6893('0x1b')]?_0x4dafd0[_0x6893('0x1b')][_0x6893('0x1f')]||null:null,'attributes':_0x4dafd0[_0x6893('0x1b')]?_0x4dafd0[_0x6893('0x1b')]['attributes']||null:null,'limit':_0x4dafd0[_0x6893('0x1b')]?_0x4dafd0[_0x6893('0x1b')][_0x6893('0x20')]||null:null})['then'](function(_0x203a70){logger['info'](_0x6893('0x1c'),_0x4dafd0);logger[_0x6893('0xe')]('UpdateSmsQueueReport',_0x4dafd0,JSON['stringify'](_0x203a70));_0x26963a(_0x203a70);})['catch'](function(_0x22157d){logger[_0x6893('0x11')](_0x6893('0x1c'),_0x22157d[_0x6893('0x14')],_0x4dafd0);_0x362a7d(_0x430ea6[_0x6893('0x11')](0x1f4,_0x22157d['message']));});});}; \ No newline at end of file +var _0xd3e4=['http','then','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','SmsQueueReport','create','body','options','raw','CreateSmsQueueReport','catch','update','attributes','limit','UpdateSmsQueueReport','lodash','util','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xd3e4,0x6d));var _0x4d3e=function(_0x1cf870,_0x5f172d){_0x1cf870=_0x1cf870-0x0;var _0x439018=_0xd3e4[_0x1cf870];return _0x439018;};'use strict';var _=require(_0x4d3e('0x0'));var util=require(_0x4d3e('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x4d3e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x4d3e('0x3'));var logger=require(_0x4d3e('0x4'))(_0x4d3e('0x5'));var config=require(_0x4d3e('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x4d3e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x200bab,_0xbc347f,_0x3c62f6){return new BPromise(function(_0x1d22be,_0x440245){return client['request'](_0x200bab,_0x3c62f6)[_0x4d3e('0x8')](function(_0x70d1ad){logger[_0x4d3e('0x9')](_0x4d3e('0xa'),_0xbc347f,_0x4d3e('0xb'));logger[_0x4d3e('0xc')](_0x4d3e('0xd'),_0xbc347f,'request\x20sent',JSON[_0x4d3e('0xe')](_0x70d1ad));if(_0x70d1ad['error']){if(_0x70d1ad[_0x4d3e('0xf')]['code']===0x1f4){logger[_0x4d3e('0xf')](_0x4d3e('0xa'),_0xbc347f,_0x70d1ad[_0x4d3e('0xf')]['message']);return _0x440245(_0x70d1ad[_0x4d3e('0xf')][_0x4d3e('0x10')]);}logger[_0x4d3e('0xf')](_0x4d3e('0xa'),_0xbc347f,_0x70d1ad[_0x4d3e('0xf')][_0x4d3e('0x10')]);return _0x1d22be(_0x70d1ad[_0x4d3e('0xf')][_0x4d3e('0x10')]);}else{logger[_0x4d3e('0x9')](_0x4d3e('0xa'),_0xbc347f,_0x4d3e('0xb'));_0x1d22be(_0x70d1ad[_0x4d3e('0x11')][_0x4d3e('0x10')]);}})['catch'](function(_0x23a4c1){logger[_0x4d3e('0xf')]('SmsQueueReport,\x20%s,\x20%s',_0xbc347f,_0x23a4c1);_0x440245(_0x23a4c1);});});}exports['CreateSmsQueueReport']=function(_0x19cdd4){var _0x128e79=this;return new Promise(function(_0x1621be,_0x42ef21){return db[_0x4d3e('0x12')][_0x4d3e('0x13')](_0x19cdd4[_0x4d3e('0x14')],{'raw':_0x19cdd4[_0x4d3e('0x15')]?_0x19cdd4['options'][_0x4d3e('0x16')]===undefined?!![]:![]:!![]})[_0x4d3e('0x8')](function(_0x49f870){logger['info'](_0x4d3e('0x17'),_0x19cdd4);logger[_0x4d3e('0xc')]('CreateSmsQueueReport',_0x19cdd4,JSON[_0x4d3e('0xe')](_0x49f870));_0x1621be(_0x49f870);})[_0x4d3e('0x18')](function(_0x1fb3e5){logger[_0x4d3e('0xf')]('CreateSmsQueueReport',_0x1fb3e5[_0x4d3e('0x10')],_0x19cdd4);_0x42ef21(_0x128e79['error'](0x1f4,_0x1fb3e5[_0x4d3e('0x10')]));});});};exports['UpdateSmsQueueReport']=function(_0x286657){var _0x12da27=this;return new Promise(function(_0x415c94,_0x4620ca){return db['SmsQueueReport'][_0x4d3e('0x19')](_0x286657['body'],{'raw':_0x286657['options']?_0x286657[_0x4d3e('0x15')][_0x4d3e('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x286657[_0x4d3e('0x15')]?_0x286657[_0x4d3e('0x15')]['where']||null:null,'attributes':_0x286657['options']?_0x286657[_0x4d3e('0x15')][_0x4d3e('0x1a')]||null:null,'limit':_0x286657['options']?_0x286657['options'][_0x4d3e('0x1b')]||null:null})[_0x4d3e('0x8')](function(_0xa26368){logger[_0x4d3e('0x9')]('UpdateSmsQueueReport',_0x286657);logger[_0x4d3e('0xc')]('UpdateSmsQueueReport',_0x286657,JSON[_0x4d3e('0xe')](_0xa26368));_0x415c94(_0xa26368);})[_0x4d3e('0x18')](function(_0x3bf9e0){logger[_0x4d3e('0xf')](_0x4d3e('0x1c'),_0x3bf9e0[_0x4d3e('0x10')],_0x286657);_0x4620ca(_0x12da27[_0x4d3e('0xf')](0x1f4,_0x3bf9e0[_0x4d3e('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 9c09ea0..e882cc4 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 _0x3266=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','describe','/:id','isAuthenticated','show','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x2f3b78,_0x4b2ba9){var _0x2c202b=function(_0x5f0b12){while(--_0x5f0b12){_0x2f3b78['push'](_0x2f3b78['shift']());}};_0x2c202b(++_0x4b2ba9);}(_0x3266,0x6a));var _0x6326=function(_0x9c2427,_0x17c865){_0x9c2427=_0x9c2427-0x0;var _0x51984f=_0x3266[_0x9c2427];return _0x51984f;};'use strict';var multer=require(_0x6326('0x0'));var util=require(_0x6326('0x1'));var path=require(_0x6326('0x2'));var timeout=require(_0x6326('0x3'));var express=require(_0x6326('0x4'));var router=express[_0x6326('0x5')]();var auth=require(_0x6326('0x6'));var interaction=require(_0x6326('0x7'));var config=require(_0x6326('0x8'));var controller=require('./smsTransferReport.controller');router[_0x6326('0x9')]('/',auth['isAuthenticated'](),controller[_0x6326('0xa')]);router[_0x6326('0x9')](_0x6326('0xb'),auth['isAuthenticated'](),controller[_0x6326('0xc')]);router['get'](_0x6326('0xd'),auth[_0x6326('0xe')](),controller[_0x6326('0xf')]);router[_0x6326('0x10')]('/',auth[_0x6326('0xe')](),controller['create']);router[_0x6326('0x11')](_0x6326('0xd'),auth[_0x6326('0xe')](),controller[_0x6326('0x12')]);router[_0x6326('0x13')](_0x6326('0xd'),auth[_0x6326('0xe')](),controller[_0x6326('0x14')]);module[_0x6326('0x15')]=router; \ No newline at end of file +var _0x2032=['describe','/:id','post','create','put','update','destroy','exports','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./smsTransferReport.controller','get','isAuthenticated','index','/describe'];(function(_0x165f67,_0x1f440a){var _0x579829=function(_0x5af539){while(--_0x5af539){_0x165f67['push'](_0x165f67['shift']());}};_0x579829(++_0x1f440a);}(_0x2032,0xd9));var _0x2203=function(_0xf7d9b5,_0x33ce3d){_0xf7d9b5=_0xf7d9b5-0x0;var _0x2a16d3=_0x2032[_0xf7d9b5];return _0x2a16d3;};'use strict';var multer=require('multer');var util=require(_0x2203('0x0'));var path=require(_0x2203('0x1'));var timeout=require(_0x2203('0x2'));var express=require('express');var router=express[_0x2203('0x3')]();var auth=require(_0x2203('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x2203('0x5'));var controller=require(_0x2203('0x6'));router[_0x2203('0x7')]('/',auth[_0x2203('0x8')](),controller[_0x2203('0x9')]);router[_0x2203('0x7')](_0x2203('0xa'),auth[_0x2203('0x8')](),controller[_0x2203('0xb')]);router[_0x2203('0x7')](_0x2203('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x2203('0xd')]('/',auth['isAuthenticated'](),controller[_0x2203('0xe')]);router[_0x2203('0xf')](_0x2203('0xc'),auth['isAuthenticated'](),controller[_0x2203('0x10')]);router['delete'](_0x2203('0xc'),auth['isAuthenticated'](),controller[_0x2203('0x11')]);module[_0x2203('0x12')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index 0cf24b0..2d3a52c 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 _0xfe69=['queue','DATE','NOW','moment','exports','STRING','ENUM','account','agent'];(function(_0x14f579,_0x26f578){var _0x52bc49=function(_0x395c88){while(--_0x395c88){_0x14f579['push'](_0x14f579['shift']());}};_0x52bc49(++_0x26f578);}(_0xfe69,0x198));var _0x9fe6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfe69[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require(_0x9fe6('0x0'));var Sequelize=require('sequelize');module[_0x9fe6('0x1')]={'uniqueid':{'type':Sequelize[_0x9fe6('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x9fe6('0x3')](_0x9fe6('0x4'),_0x9fe6('0x5'),'queue'),'allowNull':![],'defaultValue':_0x9fe6('0x6')},'transferredAt':{'type':Sequelize[_0x9fe6('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x9fe6('0x8')]}}; \ No newline at end of file +var _0x4a42=['exports','STRING','account','moment','sequelize'];(function(_0x11c604,_0x1efb85){var _0xb4e8c=function(_0x38ce17){while(--_0x38ce17){_0x11c604['push'](_0x11c604['shift']());}};_0xb4e8c(++_0x1efb85);}(_0x4a42,0x1b6));var _0x24a4=function(_0x245796,_0x2dd75f){_0x245796=_0x245796-0x0;var _0x22f873=_0x4a42[_0x245796];return _0x22f873;};'use strict';var moment=require(_0x24a4('0x0'));var Sequelize=require(_0x24a4('0x1'));module[_0x24a4('0x2')]={'uniqueid':{'type':Sequelize[_0x24a4('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x24a4('0x4'),'agent','queue'),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize['DATE'],'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 a4bb3b8..d2b5464 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 _0xa8e8=['rawAttributes','fieldName','type','key','model','query','attributes','fields','length','nolimit','limit','order','sort','filters','where','merge','VIRTUAL','filter','options','SmsTransferReport','count','includeAll','include','findAll','rows','catch','keys','intersection','find','create','body','params','destroy','describe','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','json','offset','status','set','Content-Range','apply','reject','update','then','name','send','index','map'];(function(_0x568a61,_0x2124f8){var _0x334c3b=function(_0x1afc39){while(--_0x1afc39){_0x568a61['push'](_0x568a61['shift']());}};_0x334c3b(++_0x2124f8);}(_0xa8e8,0x14a));var _0x8a8e=function(_0x536a51,_0x2bf510){_0x536a51=_0x536a51-0x0;var _0x4a4d9e=_0xa8e8[_0x536a51];return _0x4a4d9e;};'use strict';var pdf=require(_0x8a8e('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x8a8e('0x1'));var zipdir=require(_0x8a8e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8a8e('0x3'));var moment=require(_0x8a8e('0x4'));var BPromise=require(_0x8a8e('0x5'));var Mustache=require('mustache');var util=require(_0x8a8e('0x6'));var path=require(_0x8a8e('0x7'));var sox=require(_0x8a8e('0x8'));var csv=require(_0x8a8e('0x9'));var ejs=require(_0x8a8e('0xa'));var fs=require('fs');var _=require(_0x8a8e('0xb'));var squel=require(_0x8a8e('0xc'));var crypto=require(_0x8a8e('0xd'));var jsforce=require(_0x8a8e('0xe'));var deskjs=require(_0x8a8e('0xf'));var toCsv=require(_0x8a8e('0x9'));var querystring=require('querystring');var Papa=require(_0x8a8e('0x10'));var Redis=require(_0x8a8e('0x11'));var authService=require(_0x8a8e('0x12'));var qs=require(_0x8a8e('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8a8e('0x14'));var logger=require(_0x8a8e('0x15'))(_0x8a8e('0x16'));var utils=require(_0x8a8e('0x17'));var config=require(_0x8a8e('0x18'));var db=require(_0x8a8e('0x19'))['db'];function respondWithStatusCode(_0x4a66e7,_0x4871d0){_0x4871d0=_0x4871d0||0xcc;return function(_0x1b4978){if(_0x1b4978){return _0x4a66e7[_0x8a8e('0x1a')](_0x4871d0);}return _0x4a66e7['status'](_0x4871d0)['end']();};}function respondWithResult(_0x57a9d8,_0x3f5382){_0x3f5382=_0x3f5382||0xc8;return function(_0x2f68c7){if(_0x2f68c7){return _0x57a9d8['status'](_0x3f5382)[_0x8a8e('0x1b')](_0x2f68c7);}};}function respondWithFilteredResult(_0x3a0ca2,_0x581097){return function(_0x511d7c){if(_0x511d7c){var _0x29ae57=_0x511d7c['count'],_0x2fa4dd=_0x581097[_0x8a8e('0x1c')],_0xe352ba=_0x581097['offset']+_0x581097['limit'],_0x42d32a;if(_0xe352ba>=_0x29ae57){_0xe352ba=_0x29ae57;_0x42d32a=0xc8;}else{_0x42d32a=0xce;}_0x3a0ca2[_0x8a8e('0x1d')](_0x42d32a);return _0x3a0ca2[_0x8a8e('0x1e')](_0x8a8e('0x1f'),_0x2fa4dd+'-'+_0xe352ba+'/'+_0x29ae57)[_0x8a8e('0x1b')](_0x511d7c);}return null;};}function patchUpdates(_0x4319b0){return function(_0x4005a2){try{jsonpatch[_0x8a8e('0x20')](_0x4005a2,_0x4319b0,!![]);}catch(_0x1e6d14){return BPromise[_0x8a8e('0x21')](_0x1e6d14);}return _0x4005a2['save']();};}function saveUpdates(_0x89bf2e,_0x1fda64){return function(_0x4995fa){if(_0x4995fa){return _0x4995fa[_0x8a8e('0x22')](_0x89bf2e)[_0x8a8e('0x23')](function(_0x4005e4){return _0x4005e4;});}return null;};}function removeEntity(_0x3b12c9,_0x30ae1b){return function(_0x23f602){if(_0x23f602){return _0x23f602['destroy']()['then'](function(){_0x3b12c9[_0x8a8e('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x599e64,_0x5e2af0){return function(_0x1cbace){if(!_0x1cbace){_0x599e64['sendStatus'](0x194);}return _0x1cbace;};}function handleError(_0x19c3a8,_0x3a7169){_0x3a7169=_0x3a7169||0x1f4;return function(_0x65f613){logger['error'](_0x65f613['stack']);if(_0x65f613['name']){delete _0x65f613[_0x8a8e('0x24')];}_0x19c3a8['status'](_0x3a7169)[_0x8a8e('0x25')](_0x65f613);};}exports[_0x8a8e('0x26')]=function(_0x375acf,_0x3b3122){var _0x11982a={},_0x4a11f7={},_0x5ce224={'count':0x0,'rows':[]};var _0x3ace69=_[_0x8a8e('0x27')](db['SmsTransferReport'][_0x8a8e('0x28')],function(_0x226325){return{'name':_0x226325[_0x8a8e('0x29')],'type':_0x226325[_0x8a8e('0x2a')][_0x8a8e('0x2b')]};});_0x4a11f7[_0x8a8e('0x2c')]=_[_0x8a8e('0x27')](_0x3ace69,'name');_0x4a11f7[_0x8a8e('0x2d')]=_['keys'](_0x375acf[_0x8a8e('0x2d')]);_0x4a11f7['filters']=_['intersection'](_0x4a11f7[_0x8a8e('0x2c')],_0x4a11f7['query']);_0x11982a[_0x8a8e('0x2e')]=_['intersection'](_0x4a11f7[_0x8a8e('0x2c')],qs[_0x8a8e('0x2f')](_0x375acf[_0x8a8e('0x2d')][_0x8a8e('0x2f')]));_0x11982a[_0x8a8e('0x2e')]=_0x11982a[_0x8a8e('0x2e')][_0x8a8e('0x30')]?_0x11982a[_0x8a8e('0x2e')]:_0x4a11f7[_0x8a8e('0x2c')];if(!_0x375acf[_0x8a8e('0x2d')]['hasOwnProperty'](_0x8a8e('0x31'))){_0x11982a[_0x8a8e('0x32')]=qs[_0x8a8e('0x32')](_0x375acf[_0x8a8e('0x2d')][_0x8a8e('0x32')]);_0x11982a[_0x8a8e('0x1c')]=qs[_0x8a8e('0x1c')](_0x375acf[_0x8a8e('0x2d')]['offset']);}_0x11982a[_0x8a8e('0x33')]=qs['sort'](_0x375acf[_0x8a8e('0x2d')][_0x8a8e('0x34')]);_0x11982a['where']=qs[_0x8a8e('0x35')](_['pick'](_0x375acf[_0x8a8e('0x2d')],_0x4a11f7[_0x8a8e('0x35')]));if(_0x375acf[_0x8a8e('0x2d')]['filter']){_0x11982a[_0x8a8e('0x36')]=_[_0x8a8e('0x37')](_0x11982a[_0x8a8e('0x36')],{'$or':_[_0x8a8e('0x27')](_0x3ace69,function(_0x3aca58){if(_0x3aca58[_0x8a8e('0x2a')]!==_0x8a8e('0x38')){var _0x1f6610={};_0x1f6610[_0x3aca58['name']]={'$like':'%'+_0x375acf[_0x8a8e('0x2d')][_0x8a8e('0x39')]+'%'};return _0x1f6610;}})});}_0x11982a=_[_0x8a8e('0x37')]({},_0x11982a,_0x375acf[_0x8a8e('0x3a')]);var _0x2b9976={'where':_0x11982a[_0x8a8e('0x36')]};return db[_0x8a8e('0x3b')][_0x8a8e('0x3c')](_0x2b9976)[_0x8a8e('0x23')](function(_0x19eea2){_0x5ce224[_0x8a8e('0x3c')]=_0x19eea2;if(_0x375acf['query'][_0x8a8e('0x3d')]){_0x11982a[_0x8a8e('0x3e')]=[{'all':!![]}];}return db[_0x8a8e('0x3b')][_0x8a8e('0x3f')](_0x11982a);})[_0x8a8e('0x23')](function(_0x1f1c32){_0x5ce224[_0x8a8e('0x40')]=_0x1f1c32;return _0x5ce224;})[_0x8a8e('0x23')](respondWithFilteredResult(_0x3b3122,_0x11982a))[_0x8a8e('0x41')](handleError(_0x3b3122,null));};exports['show']=function(_0x1a6619,_0x377a7d){var _0x4f4512={'raw':!![],'where':{'id':_0x1a6619['params']['id']}},_0x269f07={};_0x269f07['model']=_[_0x8a8e('0x42')](db[_0x8a8e('0x3b')][_0x8a8e('0x28')]);_0x269f07[_0x8a8e('0x2d')]=_[_0x8a8e('0x42')](_0x1a6619['query']);_0x269f07['filters']=_['intersection'](_0x269f07[_0x8a8e('0x2c')],_0x269f07[_0x8a8e('0x2d')]);_0x4f4512[_0x8a8e('0x2e')]=_[_0x8a8e('0x43')](_0x269f07[_0x8a8e('0x2c')],qs[_0x8a8e('0x2f')](_0x1a6619[_0x8a8e('0x2d')][_0x8a8e('0x2f')]));_0x4f4512[_0x8a8e('0x2e')]=_0x4f4512['attributes']['length']?_0x4f4512[_0x8a8e('0x2e')]:_0x269f07[_0x8a8e('0x2c')];if(_0x1a6619['query'][_0x8a8e('0x3d')]){_0x4f4512[_0x8a8e('0x3e')]=[{'all':!![]}];}_0x4f4512=_[_0x8a8e('0x37')]({},_0x4f4512,_0x1a6619[_0x8a8e('0x3a')]);return db['SmsTransferReport'][_0x8a8e('0x44')](_0x4f4512)[_0x8a8e('0x23')](handleEntityNotFound(_0x377a7d,null))[_0x8a8e('0x23')](respondWithResult(_0x377a7d,null))[_0x8a8e('0x41')](handleError(_0x377a7d,null));};exports[_0x8a8e('0x45')]=function(_0x564f47,_0x98ce14){return db[_0x8a8e('0x3b')][_0x8a8e('0x45')](_0x564f47[_0x8a8e('0x46')],{})[_0x8a8e('0x23')](respondWithResult(_0x98ce14,0xc9))['catch'](handleError(_0x98ce14,null));};exports[_0x8a8e('0x22')]=function(_0x541f77,_0x307fcf){if(_0x541f77['body']['id']){delete _0x541f77[_0x8a8e('0x46')]['id'];}return db['SmsTransferReport'][_0x8a8e('0x44')]({'where':{'id':_0x541f77[_0x8a8e('0x47')]['id']}})[_0x8a8e('0x23')](handleEntityNotFound(_0x307fcf,null))[_0x8a8e('0x23')](saveUpdates(_0x541f77[_0x8a8e('0x46')],null))[_0x8a8e('0x23')](respondWithResult(_0x307fcf,null))[_0x8a8e('0x41')](handleError(_0x307fcf,null));};exports[_0x8a8e('0x48')]=function(_0x4bd83d,_0x46620d){return db[_0x8a8e('0x3b')][_0x8a8e('0x44')]({'where':{'id':_0x4bd83d[_0x8a8e('0x47')]['id']}})['then'](handleEntityNotFound(_0x46620d,null))['then'](removeEntity(_0x46620d,null))[_0x8a8e('0x41')](handleError(_0x46620d,null));};exports[_0x8a8e('0x49')]=function(_0x12a47d,_0x539ede){return db[_0x8a8e('0x3b')][_0x8a8e('0x49')]()['then'](respondWithResult(_0x539ede,null))[_0x8a8e('0x41')](handleError(_0x539ede,null));}; \ No newline at end of file +var _0xa64a=['intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','include','SmsTransferReport','findAll','catch','show','params','rawAttributes','includeAll','find','create','body','destroy','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','ioredis','api','../../config/utils','../../config/environment','../../mysqldb','end','status','json','count','offset','limit','set','Content-Range','apply','save','update','then','error','stack','name','send','index','map','fieldName','key','model','query','keys','filters'];(function(_0x436540,_0x2655d8){var _0x4fb5cb=function(_0x400758){while(--_0x400758){_0x436540['push'](_0x436540['shift']());}};_0x4fb5cb(++_0x2655d8);}(_0xa64a,0x140));var _0xaa64=function(_0x228593,_0x2ec009){_0x228593=_0x228593-0x0;var _0x26faf4=_0xa64a[_0x228593];return _0x26faf4;};'use strict';var pdf=require(_0xaa64('0x0'));var emlformat=require(_0xaa64('0x1'));var rimraf=require(_0xaa64('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xaa64('0x3'));var rp=require(_0xaa64('0x4'));var moment=require(_0xaa64('0x5'));var BPromise=require(_0xaa64('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xaa64('0x7'));var sox=require(_0xaa64('0x8'));var csv=require(_0xaa64('0x9'));var ejs=require(_0xaa64('0xa'));var fs=require('fs');var _=require(_0xaa64('0xb'));var squel=require(_0xaa64('0xc'));var crypto=require(_0xaa64('0xd'));var jsforce=require(_0xaa64('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xaa64('0x9'));var querystring=require(_0xaa64('0xf'));var Papa=require('papaparse');var Redis=require(_0xaa64('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xaa64('0x11'));var utils=require(_0xaa64('0x12'));var config=require(_0xaa64('0x13'));var db=require(_0xaa64('0x14'))['db'];function respondWithStatusCode(_0x4bf152,_0x28e3a2){_0x28e3a2=_0x28e3a2||0xcc;return function(_0x2b9954){if(_0x2b9954){return _0x4bf152['sendStatus'](_0x28e3a2);}return _0x4bf152['status'](_0x28e3a2)[_0xaa64('0x15')]();};}function respondWithResult(_0xf77b71,_0x39c723){_0x39c723=_0x39c723||0xc8;return function(_0x2a45e5){if(_0x2a45e5){return _0xf77b71[_0xaa64('0x16')](_0x39c723)[_0xaa64('0x17')](_0x2a45e5);}};}function respondWithFilteredResult(_0x3277b0,_0x4f724d){return function(_0x3048a1){if(_0x3048a1){var _0x1cc259=_0x3048a1[_0xaa64('0x18')],_0x5a5f9b=_0x4f724d[_0xaa64('0x19')],_0x27c1a6=_0x4f724d['offset']+_0x4f724d[_0xaa64('0x1a')],_0x4c9346;if(_0x27c1a6>=_0x1cc259){_0x27c1a6=_0x1cc259;_0x4c9346=0xc8;}else{_0x4c9346=0xce;}_0x3277b0[_0xaa64('0x16')](_0x4c9346);return _0x3277b0[_0xaa64('0x1b')](_0xaa64('0x1c'),_0x5a5f9b+'-'+_0x27c1a6+'/'+_0x1cc259)[_0xaa64('0x17')](_0x3048a1);}return null;};}function patchUpdates(_0x27c56d){return function(_0x452133){try{jsonpatch[_0xaa64('0x1d')](_0x452133,_0x27c56d,!![]);}catch(_0x55653c){return BPromise['reject'](_0x55653c);}return _0x452133[_0xaa64('0x1e')]();};}function saveUpdates(_0x53f3f,_0x10fd93){return function(_0x3b3581){if(_0x3b3581){return _0x3b3581[_0xaa64('0x1f')](_0x53f3f)[_0xaa64('0x20')](function(_0x21bdbd){return _0x21bdbd;});}return null;};}function removeEntity(_0x3ffa05,_0x577f83){return function(_0x3e12ae){if(_0x3e12ae){return _0x3e12ae['destroy']()['then'](function(){_0x3ffa05[_0xaa64('0x16')](0xcc)[_0xaa64('0x15')]();});}};}function handleEntityNotFound(_0x3ffd8c,_0x4756ec){return function(_0x55b708){if(!_0x55b708){_0x3ffd8c['sendStatus'](0x194);}return _0x55b708;};}function handleError(_0x1dc41d,_0x2717a0){_0x2717a0=_0x2717a0||0x1f4;return function(_0xfaa79f){logger[_0xaa64('0x21')](_0xfaa79f[_0xaa64('0x22')]);if(_0xfaa79f[_0xaa64('0x23')]){delete _0xfaa79f[_0xaa64('0x23')];}_0x1dc41d[_0xaa64('0x16')](_0x2717a0)[_0xaa64('0x24')](_0xfaa79f);};}exports[_0xaa64('0x25')]=function(_0x4e7053,_0x3d20dd){var _0x33c98b={},_0x34172b={},_0x55591d={'count':0x0,'rows':[]};var _0x5756d3=_[_0xaa64('0x26')](db['SmsTransferReport']['rawAttributes'],function(_0xb0373f){return{'name':_0xb0373f[_0xaa64('0x27')],'type':_0xb0373f['type'][_0xaa64('0x28')]};});_0x34172b[_0xaa64('0x29')]=_['map'](_0x5756d3,_0xaa64('0x23'));_0x34172b[_0xaa64('0x2a')]=_[_0xaa64('0x2b')](_0x4e7053[_0xaa64('0x2a')]);_0x34172b[_0xaa64('0x2c')]=_[_0xaa64('0x2d')](_0x34172b[_0xaa64('0x29')],_0x34172b['query']);_0x33c98b['attributes']=_['intersection'](_0x34172b[_0xaa64('0x29')],qs[_0xaa64('0x2e')](_0x4e7053[_0xaa64('0x2a')]['fields']));_0x33c98b[_0xaa64('0x2f')]=_0x33c98b[_0xaa64('0x2f')][_0xaa64('0x30')]?_0x33c98b[_0xaa64('0x2f')]:_0x34172b[_0xaa64('0x29')];if(!_0x4e7053[_0xaa64('0x2a')][_0xaa64('0x31')](_0xaa64('0x32'))){_0x33c98b[_0xaa64('0x1a')]=qs[_0xaa64('0x1a')](_0x4e7053[_0xaa64('0x2a')][_0xaa64('0x1a')]);_0x33c98b[_0xaa64('0x19')]=qs[_0xaa64('0x19')](_0x4e7053[_0xaa64('0x2a')][_0xaa64('0x19')]);}_0x33c98b[_0xaa64('0x33')]=qs[_0xaa64('0x34')](_0x4e7053[_0xaa64('0x2a')]['sort']);_0x33c98b[_0xaa64('0x35')]=qs[_0xaa64('0x2c')](_[_0xaa64('0x36')](_0x4e7053[_0xaa64('0x2a')],_0x34172b['filters']));if(_0x4e7053[_0xaa64('0x2a')][_0xaa64('0x37')]){_0x33c98b[_0xaa64('0x35')]=_[_0xaa64('0x38')](_0x33c98b[_0xaa64('0x35')],{'$or':_[_0xaa64('0x26')](_0x5756d3,function(_0x344bfa){if(_0x344bfa[_0xaa64('0x39')]!==_0xaa64('0x3a')){var _0xb5ca4f={};_0xb5ca4f[_0x344bfa[_0xaa64('0x23')]]={'$like':'%'+_0x4e7053[_0xaa64('0x2a')]['filter']+'%'};return _0xb5ca4f;}})});}_0x33c98b=_[_0xaa64('0x38')]({},_0x33c98b,_0x4e7053[_0xaa64('0x3b')]);var _0x3ab268={'where':_0x33c98b[_0xaa64('0x35')]};return db['SmsTransferReport'][_0xaa64('0x18')](_0x3ab268)['then'](function(_0x4b86cd){_0x55591d['count']=_0x4b86cd;if(_0x4e7053[_0xaa64('0x2a')]['includeAll']){_0x33c98b[_0xaa64('0x3c')]=[{'all':!![]}];}return db[_0xaa64('0x3d')][_0xaa64('0x3e')](_0x33c98b);})[_0xaa64('0x20')](function(_0x40de9){_0x55591d['rows']=_0x40de9;return _0x55591d;})[_0xaa64('0x20')](respondWithFilteredResult(_0x3d20dd,_0x33c98b))[_0xaa64('0x3f')](handleError(_0x3d20dd,null));};exports[_0xaa64('0x40')]=function(_0x5ce74e,_0x450476){var _0x299040={'raw':!![],'where':{'id':_0x5ce74e[_0xaa64('0x41')]['id']}},_0x8a67ac={};_0x8a67ac['model']=_['keys'](db[_0xaa64('0x3d')][_0xaa64('0x42')]);_0x8a67ac[_0xaa64('0x2a')]=_['keys'](_0x5ce74e[_0xaa64('0x2a')]);_0x8a67ac[_0xaa64('0x2c')]=_['intersection'](_0x8a67ac[_0xaa64('0x29')],_0x8a67ac['query']);_0x299040[_0xaa64('0x2f')]=_[_0xaa64('0x2d')](_0x8a67ac[_0xaa64('0x29')],qs[_0xaa64('0x2e')](_0x5ce74e[_0xaa64('0x2a')][_0xaa64('0x2e')]));_0x299040[_0xaa64('0x2f')]=_0x299040[_0xaa64('0x2f')][_0xaa64('0x30')]?_0x299040[_0xaa64('0x2f')]:_0x8a67ac[_0xaa64('0x29')];if(_0x5ce74e[_0xaa64('0x2a')][_0xaa64('0x43')]){_0x299040[_0xaa64('0x3c')]=[{'all':!![]}];}_0x299040=_[_0xaa64('0x38')]({},_0x299040,_0x5ce74e[_0xaa64('0x3b')]);return db[_0xaa64('0x3d')][_0xaa64('0x44')](_0x299040)['then'](handleEntityNotFound(_0x450476,null))[_0xaa64('0x20')](respondWithResult(_0x450476,null))[_0xaa64('0x3f')](handleError(_0x450476,null));};exports[_0xaa64('0x45')]=function(_0x377de6,_0x22ebfe){return db[_0xaa64('0x3d')][_0xaa64('0x45')](_0x377de6[_0xaa64('0x46')],{})[_0xaa64('0x20')](respondWithResult(_0x22ebfe,0xc9))[_0xaa64('0x3f')](handleError(_0x22ebfe,null));};exports['update']=function(_0x48665b,_0x1e03de){if(_0x48665b[_0xaa64('0x46')]['id']){delete _0x48665b[_0xaa64('0x46')]['id'];}return db[_0xaa64('0x3d')][_0xaa64('0x44')]({'where':{'id':_0x48665b[_0xaa64('0x41')]['id']}})[_0xaa64('0x20')](handleEntityNotFound(_0x1e03de,null))[_0xaa64('0x20')](saveUpdates(_0x48665b[_0xaa64('0x46')],null))['then'](respondWithResult(_0x1e03de,null))['catch'](handleError(_0x1e03de,null));};exports[_0xaa64('0x47')]=function(_0x5ea7e9,_0x3d484c){return db[_0xaa64('0x3d')][_0xaa64('0x44')]({'where':{'id':_0x5ea7e9[_0xaa64('0x41')]['id']}})[_0xaa64('0x20')](handleEntityNotFound(_0x3d484c,null))[_0xaa64('0x20')](removeEntity(_0x3d484c,null))[_0xaa64('0x3f')](handleError(_0x3d484c,null));};exports[_0xaa64('0x48')]=function(_0x2654de,_0x57e34c){return db[_0xaa64('0x3d')]['describe']()[_0xaa64('0x20')](respondWithResult(_0x57e34c,null))[_0xaa64('0x3f')](handleError(_0x57e34c,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index ed87900..e120736 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 _0xd8fb=['exports','SmsTransferReport','uniqueid','lodash','util','../../config/logger','api','path','rimraf','./smsTransferReport.attributes'];(function(_0x2e9a2e,_0x4d4897){var _0x277729=function(_0x53fff9){while(--_0x53fff9){_0x2e9a2e['push'](_0x2e9a2e['shift']());}};_0x277729(++_0x4d4897);}(_0xd8fb,0x99));var _0xbd8f=function(_0xfc7bd7,_0x8bed1){_0xfc7bd7=_0xfc7bd7-0x0;var _0x2f7f96=_0xd8fb[_0xfc7bd7];return _0x2f7f96;};'use strict';var _=require(_0xbd8f('0x0'));var util=require(_0xbd8f('0x1'));var logger=require(_0xbd8f('0x2'))(_0xbd8f('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xbd8f('0x4'));var rimraf=require(_0xbd8f('0x5'));var config=require('../../config/environment');var attributes=require(_0xbd8f('0x6'));module[_0xbd8f('0x7')]=function(_0x5543b2,_0x33d541){return _0x5543b2['define'](_0xbd8f('0x8'),attributes,{'tableName':'report_sms_transfer','paranoid':![],'indexes':[{'name':_0xbd8f('0x9'),'fields':[_0xbd8f('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0adf=['define','SmsTransferReport','report_sms_transfer','uniqueid','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsTransferReport.attributes'];(function(_0x2c02f0,_0x1b58ee){var _0x544c14=function(_0x4e51e8){while(--_0x4e51e8){_0x2c02f0['push'](_0x2c02f0['shift']());}};_0x544c14(++_0x1b58ee);}(_0x0adf,0x1d2));var _0xf0ad=function(_0xabb0df,_0x479913){_0xabb0df=_0xabb0df-0x0;var _0xd67f28=_0x0adf[_0xabb0df];return _0xd67f28;};'use strict';var _=require(_0xf0ad('0x0'));var util=require(_0xf0ad('0x1'));var logger=require(_0xf0ad('0x2'))('api');var moment=require(_0xf0ad('0x3'));var BPromise=require(_0xf0ad('0x4'));var rp=require(_0xf0ad('0x5'));var fs=require('fs');var path=require(_0xf0ad('0x6'));var rimraf=require(_0xf0ad('0x7'));var config=require(_0xf0ad('0x8'));var attributes=require(_0xf0ad('0x9'));module['exports']=function(_0x3bbf85,_0x53221f){return _0x3bbf85[_0xf0ad('0xa')](_0xf0ad('0xb'),attributes,{'tableName':_0xf0ad('0xc'),'paranoid':![],'indexes':[{'name':_0xf0ad('0xd'),'fields':[_0xf0ad('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index 0ae5440..057f40a 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 _0x19f6=['catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','request','then','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x324103,_0x4fc4e8){var _0x5bb0ed=function(_0x215b1c){while(--_0x215b1c){_0x324103['push'](_0x324103['shift']());}};_0x5bb0ed(++_0x4fc4e8);}(_0x19f6,0x1b9));var _0x619f=function(_0x4c9ed7,_0x3e1f68){_0x4c9ed7=_0x4c9ed7-0x0;var _0x2072c8=_0x19f6[_0x4c9ed7];return _0x2072c8;};'use strict';var _=require(_0x619f('0x0'));var util=require('util');var moment=require(_0x619f('0x1'));var BPromise=require(_0x619f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x619f('0x3'));var db=require(_0x619f('0x4'))['db'];var utils=require(_0x619f('0x5'));var logger=require(_0x619f('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x619f('0x7'));var client=jayson['client'][_0x619f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3f51a0,_0x3894be,_0x2fdab6){return new BPromise(function(_0x21a63a,_0x4e81af){return client[_0x619f('0x9')](_0x3f51a0,_0x2fdab6)[_0x619f('0xa')](function(_0x27c194){logger[_0x619f('0xb')](_0x619f('0xc'),_0x3894be,_0x619f('0xd'));logger[_0x619f('0xe')]('SmsTransferReport,\x20%s,\x20%s,\x20%s',_0x3894be,_0x619f('0xd'),JSON[_0x619f('0xf')](_0x27c194));if(_0x27c194['error']){if(_0x27c194[_0x619f('0x10')][_0x619f('0x11')]===0x1f4){logger[_0x619f('0x10')](_0x619f('0xc'),_0x3894be,_0x27c194['error']['message']);return _0x4e81af(_0x27c194[_0x619f('0x10')]['message']);}logger['error'](_0x619f('0xc'),_0x3894be,_0x27c194['error'][_0x619f('0x12')]);return _0x21a63a(_0x27c194[_0x619f('0x10')][_0x619f('0x12')]);}else{logger['info'](_0x619f('0xc'),_0x3894be,_0x619f('0xd'));_0x21a63a(_0x27c194['result'][_0x619f('0x12')]);}})[_0x619f('0x13')](function(_0x1c3529){logger[_0x619f('0x10')](_0x619f('0xc'),_0x3894be,_0x1c3529);_0x4e81af(_0x1c3529);});});} \ No newline at end of file +var _0x87db=['then','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x9c2427,_0x17c865){var _0x51984f=function(_0x177af6){while(--_0x177af6){_0x9c2427['push'](_0x9c2427['shift']());}};_0x51984f(++_0x17c865);}(_0x87db,0x74));var _0xb87d=function(_0x4e2880,_0x339e23){_0x4e2880=_0x4e2880-0x0;var _0x58571e=_0x87db[_0x4e2880];return _0x58571e;};'use strict';var _=require(_0xb87d('0x0'));var util=require(_0xb87d('0x1'));var moment=require(_0xb87d('0x2'));var BPromise=require(_0xb87d('0x3'));var rs=require(_0xb87d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb87d('0x5'))['db'];var utils=require(_0xb87d('0x6'));var logger=require(_0xb87d('0x7'))(_0xb87d('0x8'));var config=require(_0xb87d('0x9'));var jayson=require(_0xb87d('0xa'));var client=jayson[_0xb87d('0xb')][_0xb87d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5c71be,_0x17868f,_0x547d67){return new BPromise(function(_0x168abe,_0x203d68){return client[_0xb87d('0xd')](_0x5c71be,_0x547d67)[_0xb87d('0xe')](function(_0x37597d){logger[_0xb87d('0xf')](_0xb87d('0x10'),_0x17868f,_0xb87d('0x11'));logger[_0xb87d('0x12')](_0xb87d('0x13'),_0x17868f,_0xb87d('0x11'),JSON[_0xb87d('0x14')](_0x37597d));if(_0x37597d[_0xb87d('0x15')]){if(_0x37597d[_0xb87d('0x15')][_0xb87d('0x16')]===0x1f4){logger['error'](_0xb87d('0x10'),_0x17868f,_0x37597d['error'][_0xb87d('0x17')]);return _0x203d68(_0x37597d[_0xb87d('0x15')][_0xb87d('0x17')]);}logger['error'](_0xb87d('0x10'),_0x17868f,_0x37597d[_0xb87d('0x15')][_0xb87d('0x17')]);return _0x168abe(_0x37597d[_0xb87d('0x15')]['message']);}else{logger[_0xb87d('0xf')](_0xb87d('0x10'),_0x17868f,_0xb87d('0x11'));_0x168abe(_0x37597d[_0xb87d('0x18')][_0xb87d('0x17')]);}})[_0xb87d('0x19')](function(_0x343dd7){logger[_0xb87d('0x15')]('SmsTransferReport,\x20%s,\x20%s',_0x17868f,_0x343dd7);_0x203d68(_0x343dd7);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index b640a8b..ac155f2 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 _0x3bf5=['replace','format','%s-%s%s','extname','now','post','single','file','create','/:id','update','delete','multer','util','connect-timeout','Router','../../components/auth/service','../../config/environment','./sound.controller','get','isAuthenticated','show','/:id/download','download','join','root','originalname'];(function(_0x24d24e,_0x4e17a4){var _0x20e068=function(_0x48d5e5){while(--_0x48d5e5){_0x24d24e['push'](_0x24d24e['shift']());}};_0x20e068(++_0x4e17a4);}(_0x3bf5,0x78));var _0x53bf=function(_0xea6018,_0x4cf082){_0xea6018=_0xea6018-0x0;var _0x57b54d=_0x3bf5[_0xea6018];return _0x57b54d;};'use strict';var multer=require(_0x53bf('0x0'));var util=require(_0x53bf('0x1'));var path=require('path');var timeout=require(_0x53bf('0x2'));var express=require('express');var router=express[_0x53bf('0x3')]();var auth=require(_0x53bf('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x53bf('0x5'));var controller=require(_0x53bf('0x6'));router[_0x53bf('0x7')]('/',auth[_0x53bf('0x8')](),controller['index']);router[_0x53bf('0x7')]('/:id',auth[_0x53bf('0x8')](),controller[_0x53bf('0x9')]);router[_0x53bf('0x7')](_0x53bf('0xa'),auth[_0x53bf('0x8')](),controller[_0x53bf('0xb')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1cf5d2,_0x2124b1,_0x555857){_0x555857(null,path[_0x53bf('0xc')](config[_0x53bf('0xd')],'server/files/sounds/original/'));},'filename':function(_0x39fabc,_0x133a3e,_0x4f1cd6){_0x133a3e[_0x53bf('0xe')]=_0x133a3e[_0x53bf('0xe')][_0x53bf('0xf')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x4f1cd6(null,util[_0x53bf('0x10')](_0x53bf('0x11'),path['basename'](_0x133a3e[_0x53bf('0xe')],path[_0x53bf('0x12')](_0x133a3e[_0x53bf('0xe')])),Date[_0x53bf('0x13')](),path[_0x53bf('0x12')](_0x133a3e[_0x53bf('0xe')])));}})});router[_0x53bf('0x14')]('/',upload[_0x53bf('0x15')](_0x53bf('0x16')),controller[_0x53bf('0x17')]);router['put'](_0x53bf('0x18'),auth[_0x53bf('0x8')](),controller[_0x53bf('0x19')]);router[_0x53bf('0x1a')]('/:id',auth[_0x53bf('0x8')](),controller[_0x53bf('0x1a')]);module['exports']=router; \ No newline at end of file +var _0x7fab=['../../config/environment','./sound.controller','get','index','isAuthenticated','show','/:id/download','download','diskStorage','join','server/files/sounds/original/','originalname','replace','format','%s-%s%s','extname','now','single','file','create','put','/:id','update','delete','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x4e9826,_0x1acf46){var _0x152b27=function(_0x4649be){while(--_0x4649be){_0x4e9826['push'](_0x4e9826['shift']());}};_0x152b27(++_0x1acf46);}(_0x7fab,0x130));var _0xb7fa=function(_0x5c2748,_0x564960){_0x5c2748=_0x5c2748-0x0;var _0x59761d=_0x7fab[_0x5c2748];return _0x59761d;};'use strict';var multer=require(_0xb7fa('0x0'));var util=require('util');var path=require(_0xb7fa('0x1'));var timeout=require(_0xb7fa('0x2'));var express=require('express');var router=express[_0xb7fa('0x3')]();var auth=require(_0xb7fa('0x4'));var interaction=require(_0xb7fa('0x5'));var config=require(_0xb7fa('0x6'));var controller=require(_0xb7fa('0x7'));router[_0xb7fa('0x8')]('/',auth['isAuthenticated'](),controller[_0xb7fa('0x9')]);router[_0xb7fa('0x8')]('/:id',auth[_0xb7fa('0xa')](),controller[_0xb7fa('0xb')]);router[_0xb7fa('0x8')](_0xb7fa('0xc'),auth[_0xb7fa('0xa')](),controller[_0xb7fa('0xd')]);var upload=multer({'storage':multer[_0xb7fa('0xe')]({'destination':function(_0x9d57e7,_0xde55ff,_0x4d9bfb){_0x4d9bfb(null,path[_0xb7fa('0xf')](config['root'],_0xb7fa('0x10')));},'filename':function(_0x18edef,_0x2343b0,_0x2f1409){_0x2343b0[_0xb7fa('0x11')]=_0x2343b0[_0xb7fa('0x11')][_0xb7fa('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x2f1409(null,util[_0xb7fa('0x13')](_0xb7fa('0x14'),path['basename'](_0x2343b0['originalname'],path[_0xb7fa('0x15')](_0x2343b0[_0xb7fa('0x11')])),Date[_0xb7fa('0x16')](),path[_0xb7fa('0x15')](_0x2343b0[_0xb7fa('0x11')])));}})});router['post']('/',upload[_0xb7fa('0x17')](_0xb7fa('0x18')),controller[_0xb7fa('0x19')]);router[_0xb7fa('0x1a')](_0xb7fa('0x1b'),auth[_0xb7fa('0xa')](),controller[_0xb7fa('0x1c')]);router['delete'](_0xb7fa('0x1b'),auth[_0xb7fa('0xa')](),controller[_0xb7fa('0x1d')]);module[_0xb7fa('0x1e')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index 3b0946f..a72f353 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 _0x8c80=['sequelize','exports','STRING','name','FLOAT','BIGINT','INTEGER'];(function(_0x1529a3,_0x529f63){var _0x1a0d4b=function(_0x6f1058){while(--_0x6f1058){_0x1529a3['push'](_0x1529a3['shift']());}};_0x1a0d4b(++_0x529f63);}(_0x8c80,0xf5));var _0x08c8=function(_0x5d8631,_0x44944b){_0x5d8631=_0x5d8631-0x0;var _0x34c15e=_0x8c80[_0x5d8631];return _0x34c15e;};'use strict';var Sequelize=require(_0x08c8('0x0'));module[_0x08c8('0x1')]={'name':{'type':Sequelize[_0x08c8('0x2')],'unique':_0x08c8('0x3'),'allowNull':![]},'save_name':{'type':Sequelize[_0x08c8('0x2')]},'display_name':{'type':Sequelize[_0x08c8('0x2')],'defaultValue':''},'description':{'type':Sequelize[_0x08c8('0x2')]},'original_format':{'type':Sequelize[_0x08c8('0x2')]},'original_duration':{'type':Sequelize[_0x08c8('0x4')]},'original_sampleCount':{'type':Sequelize[_0x08c8('0x5')]},'original_channelCount':{'type':Sequelize[_0x08c8('0x6')]},'original_bitRate':{'type':Sequelize['BIGINT']},'original_sampleRate':{'type':Sequelize[_0x08c8('0x6')]},'converted_format':{'type':Sequelize[_0x08c8('0x2')]},'converted_duration':{'type':Sequelize[_0x08c8('0x4')]},'converted_sampleCount':{'type':Sequelize['BIGINT']},'converted_channelCount':{'type':Sequelize[_0x08c8('0x6')]},'converted_bitRate':{'type':Sequelize[_0x08c8('0x5')]},'converted_sampleRate':{'type':Sequelize[_0x08c8('0x6')]}}; \ No newline at end of file +var _0x75d9=['STRING','FLOAT','BIGINT','INTEGER','exports'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x75d9,0x1d5));var _0x975d=function(_0x3a8db5,_0x31cff7){_0x3a8db5=_0x3a8db5-0x0;var _0x2c03cd=_0x75d9[_0x3a8db5];return _0x2c03cd;};'use strict';var Sequelize=require('sequelize');module[_0x975d('0x0')]={'name':{'type':Sequelize[_0x975d('0x1')],'unique':'name','allowNull':![]},'save_name':{'type':Sequelize['STRING']},'display_name':{'type':Sequelize[_0x975d('0x1')],'defaultValue':''},'description':{'type':Sequelize[_0x975d('0x1')]},'original_format':{'type':Sequelize[_0x975d('0x1')]},'original_duration':{'type':Sequelize[_0x975d('0x2')]},'original_sampleCount':{'type':Sequelize[_0x975d('0x3')]},'original_channelCount':{'type':Sequelize[_0x975d('0x4')]},'original_bitRate':{'type':Sequelize['BIGINT']},'original_sampleRate':{'type':Sequelize[_0x975d('0x4')]},'converted_format':{'type':Sequelize['STRING']},'converted_duration':{'type':Sequelize[_0x975d('0x2')]},'converted_sampleCount':{'type':Sequelize[_0x975d('0x3')]},'converted_channelCount':{'type':Sequelize[_0x975d('0x4')]},'converted_bitRate':{'type':Sequelize[_0x975d('0x3')]},'converted_sampleRate':{'type':Sequelize[_0x975d('0x4')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index ed20592..60afad5 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 _0x19f2=['sampleRate','dest','converted_channelCount','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','delete','server/files/sounds/original','original_format','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','moment','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','json','offset','limit','set','Content-Range','save','update','then','destroy','get','Sounds','end','error','stack','name','send','index','map','Sound','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','count','includeAll','include','rows','catch','show','params','rawAttributes','options','find','save_name','converted_format','existsSync','join','root','server/files/sounds/converted','Sequelize','ValidationError','Sound\x20not\x20found','download','format','%s.%s','create','basename','file','originalname','filename','extname','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','wav','src','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate'];(function(_0x418b98,_0x5dfbb4){var _0x292cb0=function(_0x3b48e0){while(--_0x3b48e0){_0x418b98['push'](_0x418b98['shift']());}};_0x292cb0(++_0x5dfbb4);}(_0x19f2,0x84));var _0x219f=function(_0x581960,_0x1232ff){_0x581960=_0x581960-0x0;var _0x4ee892=_0x19f2[_0x581960];return _0x4ee892;};'use strict';var pdf=require(_0x219f('0x0'));var emlformat=require(_0x219f('0x1'));var rimraf=require(_0x219f('0x2'));var zipdir=require(_0x219f('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x219f('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x219f('0x5'));var path=require(_0x219f('0x6'));var sox=require(_0x219f('0x7'));var csv=require(_0x219f('0x8'));var ejs=require(_0x219f('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x219f('0xa'));var crypto=require(_0x219f('0xb'));var jsforce=require(_0x219f('0xc'));var deskjs=require(_0x219f('0xd'));var toCsv=require(_0x219f('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x219f('0xe'));var as=require(_0x219f('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x219f('0x10'))('api');var utils=require(_0x219f('0x11'));var config=require(_0x219f('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x11ba5d,_0x3a209b){_0x3a209b=_0x3a209b||0xcc;return function(_0x461a94){if(_0x461a94){return _0x11ba5d[_0x219f('0x13')](_0x3a209b);}return _0x11ba5d[_0x219f('0x14')](_0x3a209b)['end']();};}function respondWithResult(_0xda2bf2,_0x460451){_0x460451=_0x460451||0xc8;return function(_0x12b3f4){if(_0x12b3f4){return _0xda2bf2[_0x219f('0x14')](_0x460451)[_0x219f('0x15')](_0x12b3f4);}};}function respondWithFilteredResult(_0x168bea,_0xa11193){return function(_0x1dfa2b){if(_0x1dfa2b){var _0x26a24a=_0x1dfa2b['count'],_0x9997d8=_0xa11193['offset'],_0x2db65a=_0xa11193[_0x219f('0x16')]+_0xa11193[_0x219f('0x17')],_0x12c034;if(_0x2db65a>=_0x26a24a){_0x2db65a=_0x26a24a;_0x12c034=0xc8;}else{_0x12c034=0xce;}_0x168bea[_0x219f('0x14')](_0x12c034);return _0x168bea[_0x219f('0x18')](_0x219f('0x19'),_0x9997d8+'-'+_0x2db65a+'/'+_0x26a24a)[_0x219f('0x15')](_0x1dfa2b);}return null;};}function patchUpdates(_0x4c8788){return function(_0x3566db){try{jsonpatch['apply'](_0x3566db,_0x4c8788,!![]);}catch(_0x2c55ff){return BPromise['reject'](_0x2c55ff);}return _0x3566db[_0x219f('0x1a')]();};}function saveUpdates(_0x522bd0,_0x32b212){return function(_0x37d71e){if(_0x37d71e){return _0x37d71e[_0x219f('0x1b')](_0x522bd0)[_0x219f('0x1c')](function(_0x5ce481){return _0x5ce481;});}return null;};}function removeEntity(_0x4e784a,_0xb2d803){return function(_0x1ef1ad){if(_0x1ef1ad){return _0x1ef1ad[_0x219f('0x1d')]()[_0x219f('0x1c')](function(){var _0x1dc028=_0x1ef1ad[_0x219f('0x1e')]({'plain':!![]});var _0x1b51f2=_0x219f('0x1f');return db['UserProfileResource']['destroy']({'where':{'type':_0x1b51f2,'resourceId':_0x1dc028['id']}})[_0x219f('0x1c')](function(){return _0x1ef1ad;});})['then'](function(){_0x4e784a['status'](0xcc)[_0x219f('0x20')]();});}};}function handleEntityNotFound(_0x3c5920,_0x3fe23e){return function(_0x4dbceb){if(!_0x4dbceb){_0x3c5920[_0x219f('0x13')](0x194);}return _0x4dbceb;};}function handleError(_0x4a2bd4,_0xa74b51){_0xa74b51=_0xa74b51||0x1f4;return function(_0x896911){logger[_0x219f('0x21')](_0x896911[_0x219f('0x22')]);if(_0x896911[_0x219f('0x23')]){delete _0x896911[_0x219f('0x23')];}_0x4a2bd4[_0x219f('0x14')](_0xa74b51)[_0x219f('0x24')](_0x896911);};}exports[_0x219f('0x25')]=function(_0x549c51,_0x1b6c47){var _0x18083c={},_0x5aa823={},_0x2fe358={'count':0x0,'rows':[]};var _0x4c4325=_[_0x219f('0x26')](db[_0x219f('0x27')]['rawAttributes'],function(_0x1ba09d){return{'name':_0x1ba09d[_0x219f('0x28')],'type':_0x1ba09d[_0x219f('0x29')]['key']};});_0x5aa823[_0x219f('0x2a')]=_[_0x219f('0x26')](_0x4c4325,_0x219f('0x23'));_0x5aa823[_0x219f('0x2b')]=_[_0x219f('0x2c')](_0x549c51[_0x219f('0x2b')]);_0x5aa823[_0x219f('0x2d')]=_[_0x219f('0x2e')](_0x5aa823[_0x219f('0x2a')],_0x5aa823[_0x219f('0x2b')]);_0x18083c[_0x219f('0x2f')]=_[_0x219f('0x2e')](_0x5aa823[_0x219f('0x2a')],qs[_0x219f('0x30')](_0x549c51[_0x219f('0x2b')][_0x219f('0x30')]));_0x18083c[_0x219f('0x2f')]=_0x18083c['attributes'][_0x219f('0x31')]?_0x18083c[_0x219f('0x2f')]:_0x5aa823[_0x219f('0x2a')];if(!_0x549c51['query'][_0x219f('0x32')]('nolimit')){_0x18083c['limit']=qs['limit'](_0x549c51[_0x219f('0x2b')]['limit']);_0x18083c[_0x219f('0x16')]=qs[_0x219f('0x16')](_0x549c51[_0x219f('0x2b')]['offset']);}_0x18083c[_0x219f('0x33')]=qs[_0x219f('0x34')](_0x549c51['query'][_0x219f('0x34')]);_0x18083c[_0x219f('0x35')]=qs[_0x219f('0x2d')](_[_0x219f('0x36')](_0x549c51[_0x219f('0x2b')],_0x5aa823['filters']));if(_0x549c51[_0x219f('0x2b')][_0x219f('0x37')]){_0x18083c['where']=_[_0x219f('0x38')](_0x18083c[_0x219f('0x35')],{'$or':_[_0x219f('0x26')](_0x4c4325,function(_0x553a4b){if(_0x553a4b['type']!==_0x219f('0x39')){var _0x19247c={};_0x19247c[_0x553a4b[_0x219f('0x23')]]={'$like':'%'+_0x549c51[_0x219f('0x2b')][_0x219f('0x37')]+'%'};return _0x19247c;}})});}_0x18083c=_['merge']({},_0x18083c,_0x549c51['options']);var _0x3cbbdb={'where':_0x18083c[_0x219f('0x35')]};return db[_0x219f('0x27')][_0x219f('0x3a')](_0x3cbbdb)[_0x219f('0x1c')](function(_0x5898d6){_0x2fe358[_0x219f('0x3a')]=_0x5898d6;if(_0x549c51[_0x219f('0x2b')][_0x219f('0x3b')]){_0x18083c[_0x219f('0x3c')]=[{'all':!![]}];}return db[_0x219f('0x27')]['findAll'](_0x18083c);})[_0x219f('0x1c')](function(_0xeecf4e){_0x2fe358[_0x219f('0x3d')]=_0xeecf4e;return _0x2fe358;})[_0x219f('0x1c')](respondWithFilteredResult(_0x1b6c47,_0x18083c))[_0x219f('0x3e')](handleError(_0x1b6c47,null));};exports[_0x219f('0x3f')]=function(_0x34967d,_0x15370a){var _0x2e72fc={'raw':!![],'where':{'id':_0x34967d[_0x219f('0x40')]['id']}},_0x5ec531={};_0x5ec531[_0x219f('0x2a')]=_['keys'](db[_0x219f('0x27')][_0x219f('0x41')]);_0x5ec531['query']=_[_0x219f('0x2c')](_0x34967d[_0x219f('0x2b')]);_0x5ec531[_0x219f('0x2d')]=_[_0x219f('0x2e')](_0x5ec531['model'],_0x5ec531[_0x219f('0x2b')]);_0x2e72fc[_0x219f('0x2f')]=_[_0x219f('0x2e')](_0x5ec531[_0x219f('0x2a')],qs[_0x219f('0x30')](_0x34967d['query'][_0x219f('0x30')]));_0x2e72fc[_0x219f('0x2f')]=_0x2e72fc[_0x219f('0x2f')][_0x219f('0x31')]?_0x2e72fc['attributes']:_0x5ec531[_0x219f('0x2a')];if(_0x34967d[_0x219f('0x2b')][_0x219f('0x3b')]){_0x2e72fc[_0x219f('0x3c')]=[{'all':!![]}];}_0x2e72fc=_[_0x219f('0x38')]({},_0x2e72fc,_0x34967d[_0x219f('0x42')]);return db[_0x219f('0x27')][_0x219f('0x43')](_0x2e72fc)[_0x219f('0x1c')](handleEntityNotFound(_0x15370a,null))[_0x219f('0x1c')](respondWithResult(_0x15370a,null))['catch'](handleError(_0x15370a,null));};exports['download']=function(_0x24d400,_0xc07c89,_0x16bb8b){return db[_0x219f('0x27')][_0x219f('0x43')]({'where':{'id':_0x24d400[_0x219f('0x40')]['id']},'attributes':[_0x219f('0x23'),_0x219f('0x44'),_0x219f('0x45')],'raw':!![]})[_0x219f('0x1c')](handleEntityNotFound(_0xc07c89,null))['then'](function(_0x314fe7){if(_0x314fe7){if(!fs[_0x219f('0x46')](path[_0x219f('0x47')](config[_0x219f('0x48')],_0x219f('0x49'),_0x314fe7[_0x219f('0x44')]+'.'+_0x314fe7[_0x219f('0x45')]))){throw new db[(_0x219f('0x4a'))][(_0x219f('0x4b'))](_0x219f('0x4c'));}return _0xc07c89[_0x219f('0x4d')](path[_0x219f('0x47')](config['root'],_0x219f('0x49'),util[_0x219f('0x4e')](_0x219f('0x4f'),_0x314fe7['save_name'],_0x314fe7['converted_format'])),util[_0x219f('0x4e')](_0x219f('0x4f'),_0x314fe7['name'],_0x314fe7['converted_format']));}return null;})[_0x219f('0x3e')](handleError(_0xc07c89,null));};exports[_0x219f('0x50')]=function(_0x4b7242,_0x11931a,_0xbd530f){var _0x299bd1={'name':path[_0x219f('0x51')](_0x4b7242[_0x219f('0x52')][_0x219f('0x53')],path['extname'](_0x4b7242['file']['originalname'])),'save_name':path['basename'](_0x4b7242[_0x219f('0x52')][_0x219f('0x54')],path['extname'](_0x4b7242[_0x219f('0x52')][_0x219f('0x54')])),'original_format':path[_0x219f('0x55')](_0x4b7242[_0x219f('0x52')]['originalname'])['substring'](0x1),'converted_format':'wav'};var _0x3970ed=path[_0x219f('0x47')](config[_0x219f('0x48')],'server/files/sounds/original',_0x4b7242[_0x219f('0x52')][_0x219f('0x54')]);var _0xfece7=path[_0x219f('0x47')](config[_0x219f('0x48')],'server/files/sounds/converted',util[_0x219f('0x4e')](_0x219f('0x4f'),path[_0x219f('0x51')](_0x4b7242[_0x219f('0x52')]['filename'],path['extname'](_0x4b7242['file']['filename'])),_0x299bd1[_0x219f('0x45')]));logger[_0x219f('0x56')](_0x219f('0x57'),_0x3970ed);logger[_0x219f('0x56')](_0x219f('0x58'),_0xfece7);try{fs[_0x219f('0x59')](_0x3970ed,parseInt(_0x219f('0x5a'),0x8));var _0x33bde6=sox[_0x219f('0x5b')](_0x3970ed,_0xfece7,{'sampleRate':0x1f40,'format':_0x219f('0x5c'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x33bde6['on'](_0x219f('0x21'),function(_0x28058f){fs['unlinkSync'](_0x3970ed);_0x11931a[_0x219f('0x14')](0x1f4)['send'](_0x28058f);});_0x33bde6['on'](_0x219f('0x5d'),function(_0x53d1fc){_0x299bd1['original_duration']=isNaN(_0x53d1fc['duration'])?null:_0x53d1fc[_0x219f('0x5e')]*0x3e8;_0x299bd1[_0x219f('0x5f')]=isNaN(_0x53d1fc['sampleCount'])?null:_0x53d1fc[_0x219f('0x60')];_0x299bd1[_0x219f('0x61')]=isNaN(_0x53d1fc['channelCount'])?null:_0x53d1fc[_0x219f('0x62')];_0x299bd1[_0x219f('0x63')]=isNaN(_0x53d1fc[_0x219f('0x64')])?null:_0x53d1fc[_0x219f('0x64')];_0x299bd1[_0x219f('0x65')]=isNaN(_0x53d1fc[_0x219f('0x66')])?null:_0x53d1fc[_0x219f('0x66')];});_0x33bde6['on'](_0x219f('0x67'),function(_0x2f54b4){_0x299bd1['converted_duration']=isNaN(_0x2f54b4[_0x219f('0x5e')])?null:_0x2f54b4['duration']*0x3e8;_0x299bd1['converted_sampleCount']=isNaN(_0x2f54b4[_0x219f('0x60')])?null:_0x2f54b4['sampleCount'];_0x299bd1[_0x219f('0x68')]=isNaN(_0x2f54b4[_0x219f('0x62')])?null:_0x2f54b4[_0x219f('0x62')];_0x299bd1['converted_bitRate']=isNaN(_0x2f54b4[_0x219f('0x64')])?null:_0x2f54b4[_0x219f('0x64')];_0x299bd1['converted_sampleRate']=isNaN(_0x2f54b4[_0x219f('0x66')])?null:_0x2f54b4[_0x219f('0x66')];});_0x33bde6['on'](_0x219f('0x20'),function(){fs['chmodSync'](_0xfece7,parseInt(_0x219f('0x5a'),0x8));return db[_0x219f('0x27')][_0x219f('0x50')](_0x299bd1)[_0x219f('0x1c')](function(_0x5207c5){var _0x3ccbf2={'role':_0x4b7242[_0x219f('0x69')][_0x219f('0x6a')],'userProfileId':_0x4b7242['body'][_0x219f('0x6b')]};if(!_0x3ccbf2)throw new Error(_0x219f('0x6c'));if(_0x3ccbf2[_0x219f('0x6a')]===_0x219f('0x6d')){var _0x1d3ed3=_0x5207c5[_0x219f('0x1e')]({'plain':!![]});return db[_0x219f('0x6e')][_0x219f('0x43')]({'where':{'name':'Sounds','userProfileId':_0x3ccbf2[_0x219f('0x6b')]},'raw':!![]})[_0x219f('0x1c')](function(_0x3533b7){if(_0x3533b7&&_0x3533b7[_0x219f('0x6f')]===0x0){return db['UserProfileResource'][_0x219f('0x50')]({'name':_0x1d3ed3[_0x219f('0x23')],'resourceId':_0x1d3ed3['id'],'type':_0x3533b7['name'],'sectionId':_0x3533b7['id']},{})[_0x219f('0x1c')](function(){return _0x5207c5;});}else{return _0x5207c5;}})[_0x219f('0x3e')](function(_0x252a4f){logger[_0x219f('0x21')](_0x219f('0x70'),_0x252a4f);throw _0x252a4f;});}return _0x5207c5;})[_0x219f('0x1c')](respondWithResult(_0x11931a,null))['catch'](handleError(_0x11931a,null));});_0x33bde6['start']();}catch(_0x5ad43a){_0x11931a[_0x219f('0x14')](0x1f4)[_0x219f('0x24')](_0x5ad43a);}};exports['update']=function(_0x2d74ca,_0x33507d,_0x2251f2){return db[_0x219f('0x27')][_0x219f('0x43')]({'where':{'id':_0x2d74ca['params']['id']}})['then'](handleEntityNotFound(_0x33507d,null))['then'](saveUpdates(_[_0x219f('0x36')](_0x2d74ca['body'],[_0x219f('0x23'),'description']),null))[_0x219f('0x1c')](respondWithResult(_0x33507d,null))[_0x219f('0x3e')](handleError(_0x33507d,null));};exports[_0x219f('0x71')]=function(_0x4adcfb,_0x1495e1,_0x1a635b){return db['Sound'][_0x219f('0x43')]({'where':{'id':_0x4adcfb[_0x219f('0x40')]['id']}})[_0x219f('0x1c')](function(_0x2b5f99){if(_0x2b5f99){return _0x2b5f99['destroy']();}})[_0x219f('0x1c')](function(_0x4609b3){var _0x1383d3=path[_0x219f('0x47')](config[_0x219f('0x48')],_0x219f('0x72'),util[_0x219f('0x4e')](_0x219f('0x4f'),_0x4609b3[_0x219f('0x44')],_0x4609b3[_0x219f('0x73')]));var _0x41e9e8=path[_0x219f('0x47')](config[_0x219f('0x48')],_0x219f('0x49'),util[_0x219f('0x4e')]('%s.%s',_0x4609b3['save_name'],_0x4609b3[_0x219f('0x45')]));fs[_0x219f('0x74')](_0x1383d3);fs[_0x219f('0x74')](_0x41e9e8);return _0x4609b3;})[_0x219f('0x1c')](function(_0x3737e1){if(_0x3737e1){return _0x1495e1[_0x219f('0x14')](0xcc)['end']();}})[_0x219f('0x1c')](handleEntityNotFound(_0x1495e1,null))[_0x219f('0x3e')](handleError(_0x1495e1,null));}; \ No newline at end of file +var _0xde79=['ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','set','reject','save','update','then','destroy','get','Sounds','UserProfileResource','end','error','stack','name','send','index','map','Sound','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','options','includeAll','findAll','rows','params','include','find','catch','download','save_name','converted_format','existsSync','root','server/files/sounds/converted','Sequelize','ValidationError','Sound\x20not\x20found','join','%s.%s','format','create','basename','file','originalname','extname','filename','substring','wav','server/files/sounds/original','info','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','unlinkSync','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_sampleCount','converted_channelCount','converted_bitRate','converted_sampleRate','body','role','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','original_format','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','lodash','to-csv','querystring','papaparse'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0xde79,0x164));var _0x9de7=function(_0x3b2f0e,_0x5006f7){_0x3b2f0e=_0x3b2f0e-0x0;var _0xbf95ae=_0xde79[_0x3b2f0e];return _0xbf95ae;};'use strict';var pdf=require(_0x9de7('0x0'));var emlformat=require(_0x9de7('0x1'));var rimraf=require(_0x9de7('0x2'));var zipdir=require(_0x9de7('0x3'));var jsonpatch=require(_0x9de7('0x4'));var rp=require('request-promise');var moment=require(_0x9de7('0x5'));var BPromise=require(_0x9de7('0x6'));var Mustache=require(_0x9de7('0x7'));var util=require(_0x9de7('0x8'));var path=require(_0x9de7('0x9'));var sox=require(_0x9de7('0xa'));var csv=require('to-csv');var ejs=require(_0x9de7('0xb'));var fs=require('fs');var _=require(_0x9de7('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x9de7('0xd'));var querystring=require(_0x9de7('0xe'));var Papa=require(_0x9de7('0xf'));var Redis=require(_0x9de7('0x10'));var authService=require(_0x9de7('0x11'));var qs=require(_0x9de7('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9de7('0x13'));var logger=require(_0x9de7('0x14'))(_0x9de7('0x15'));var utils=require(_0x9de7('0x16'));var config=require(_0x9de7('0x17'));var db=require(_0x9de7('0x18'))['db'];function respondWithStatusCode(_0x26d693,_0xfadf31){_0xfadf31=_0xfadf31||0xcc;return function(_0x3b9d94){if(_0x3b9d94){return _0x26d693[_0x9de7('0x19')](_0xfadf31);}return _0x26d693[_0x9de7('0x1a')](_0xfadf31)['end']();};}function respondWithResult(_0x2dbb2d,_0x22c9f7){_0x22c9f7=_0x22c9f7||0xc8;return function(_0x31b822){if(_0x31b822){return _0x2dbb2d[_0x9de7('0x1a')](_0x22c9f7)[_0x9de7('0x1b')](_0x31b822);}};}function respondWithFilteredResult(_0x2f397b,_0x49000c){return function(_0x2d6e13){if(_0x2d6e13){var _0x463ac7=_0x2d6e13[_0x9de7('0x1c')],_0xaff085=_0x49000c[_0x9de7('0x1d')],_0x1439d8=_0x49000c[_0x9de7('0x1d')]+_0x49000c['limit'],_0x2859be;if(_0x1439d8>=_0x463ac7){_0x1439d8=_0x463ac7;_0x2859be=0xc8;}else{_0x2859be=0xce;}_0x2f397b[_0x9de7('0x1a')](_0x2859be);return _0x2f397b[_0x9de7('0x1e')]('Content-Range',_0xaff085+'-'+_0x1439d8+'/'+_0x463ac7)['json'](_0x2d6e13);}return null;};}function patchUpdates(_0x3a3c69){return function(_0x535436){try{jsonpatch['apply'](_0x535436,_0x3a3c69,!![]);}catch(_0x135408){return BPromise[_0x9de7('0x1f')](_0x135408);}return _0x535436[_0x9de7('0x20')]();};}function saveUpdates(_0x131472,_0x3da7ac){return function(_0x2c208a){if(_0x2c208a){return _0x2c208a[_0x9de7('0x21')](_0x131472)[_0x9de7('0x22')](function(_0x378fd7){return _0x378fd7;});}return null;};}function removeEntity(_0x3f623c,_0x3b39e7){return function(_0x5722dd){if(_0x5722dd){return _0x5722dd[_0x9de7('0x23')]()[_0x9de7('0x22')](function(){var _0x2b1324=_0x5722dd[_0x9de7('0x24')]({'plain':!![]});var _0x11e600=_0x9de7('0x25');return db[_0x9de7('0x26')][_0x9de7('0x23')]({'where':{'type':_0x11e600,'resourceId':_0x2b1324['id']}})[_0x9de7('0x22')](function(){return _0x5722dd;});})['then'](function(){_0x3f623c['status'](0xcc)[_0x9de7('0x27')]();});}};}function handleEntityNotFound(_0x450d54,_0xe8326d){return function(_0x4acdf2){if(!_0x4acdf2){_0x450d54[_0x9de7('0x19')](0x194);}return _0x4acdf2;};}function handleError(_0x5db7c3,_0xaeb1ec){_0xaeb1ec=_0xaeb1ec||0x1f4;return function(_0x2c1fcb){logger[_0x9de7('0x28')](_0x2c1fcb[_0x9de7('0x29')]);if(_0x2c1fcb[_0x9de7('0x2a')]){delete _0x2c1fcb['name'];}_0x5db7c3[_0x9de7('0x1a')](_0xaeb1ec)[_0x9de7('0x2b')](_0x2c1fcb);};}exports[_0x9de7('0x2c')]=function(_0x2dc9a7,_0x19fa15){var _0x485baf={},_0xc2fbf0={},_0x20e0ef={'count':0x0,'rows':[]};var _0x324f01=_[_0x9de7('0x2d')](db[_0x9de7('0x2e')]['rawAttributes'],function(_0x5f38ed){return{'name':_0x5f38ed[_0x9de7('0x2f')],'type':_0x5f38ed[_0x9de7('0x30')][_0x9de7('0x31')]};});_0xc2fbf0[_0x9de7('0x32')]=_[_0x9de7('0x2d')](_0x324f01,_0x9de7('0x2a'));_0xc2fbf0[_0x9de7('0x33')]=_[_0x9de7('0x34')](_0x2dc9a7[_0x9de7('0x33')]);_0xc2fbf0[_0x9de7('0x35')]=_[_0x9de7('0x36')](_0xc2fbf0[_0x9de7('0x32')],_0xc2fbf0['query']);_0x485baf[_0x9de7('0x37')]=_['intersection'](_0xc2fbf0[_0x9de7('0x32')],qs[_0x9de7('0x38')](_0x2dc9a7['query'][_0x9de7('0x38')]));_0x485baf['attributes']=_0x485baf[_0x9de7('0x37')][_0x9de7('0x39')]?_0x485baf[_0x9de7('0x37')]:_0xc2fbf0['model'];if(!_0x2dc9a7[_0x9de7('0x33')][_0x9de7('0x3a')](_0x9de7('0x3b'))){_0x485baf[_0x9de7('0x3c')]=qs[_0x9de7('0x3c')](_0x2dc9a7[_0x9de7('0x33')]['limit']);_0x485baf[_0x9de7('0x1d')]=qs[_0x9de7('0x1d')](_0x2dc9a7[_0x9de7('0x33')]['offset']);}_0x485baf['order']=qs[_0x9de7('0x3d')](_0x2dc9a7[_0x9de7('0x33')][_0x9de7('0x3d')]);_0x485baf[_0x9de7('0x3e')]=qs[_0x9de7('0x35')](_[_0x9de7('0x3f')](_0x2dc9a7['query'],_0xc2fbf0[_0x9de7('0x35')]));if(_0x2dc9a7[_0x9de7('0x33')]['filter']){_0x485baf['where']=_['merge'](_0x485baf['where'],{'$or':_['map'](_0x324f01,function(_0x48dd5e){if(_0x48dd5e[_0x9de7('0x30')]!=='VIRTUAL'){var _0x56c0b1={};_0x56c0b1[_0x48dd5e[_0x9de7('0x2a')]]={'$like':'%'+_0x2dc9a7['query'][_0x9de7('0x40')]+'%'};return _0x56c0b1;}})});}_0x485baf=_[_0x9de7('0x41')]({},_0x485baf,_0x2dc9a7[_0x9de7('0x42')]);var _0x1e475c={'where':_0x485baf[_0x9de7('0x3e')]};return db[_0x9de7('0x2e')][_0x9de7('0x1c')](_0x1e475c)[_0x9de7('0x22')](function(_0x1553cd){_0x20e0ef[_0x9de7('0x1c')]=_0x1553cd;if(_0x2dc9a7[_0x9de7('0x33')][_0x9de7('0x43')]){_0x485baf['include']=[{'all':!![]}];}return db[_0x9de7('0x2e')][_0x9de7('0x44')](_0x485baf);})[_0x9de7('0x22')](function(_0x51474a){_0x20e0ef[_0x9de7('0x45')]=_0x51474a;return _0x20e0ef;})[_0x9de7('0x22')](respondWithFilteredResult(_0x19fa15,_0x485baf))['catch'](handleError(_0x19fa15,null));};exports['show']=function(_0x47141c,_0x48b564){var _0x428f4c={'raw':!![],'where':{'id':_0x47141c[_0x9de7('0x46')]['id']}},_0x8e3c59={};_0x8e3c59[_0x9de7('0x32')]=_[_0x9de7('0x34')](db[_0x9de7('0x2e')]['rawAttributes']);_0x8e3c59[_0x9de7('0x33')]=_['keys'](_0x47141c[_0x9de7('0x33')]);_0x8e3c59['filters']=_[_0x9de7('0x36')](_0x8e3c59[_0x9de7('0x32')],_0x8e3c59[_0x9de7('0x33')]);_0x428f4c[_0x9de7('0x37')]=_[_0x9de7('0x36')](_0x8e3c59[_0x9de7('0x32')],qs[_0x9de7('0x38')](_0x47141c[_0x9de7('0x33')]['fields']));_0x428f4c[_0x9de7('0x37')]=_0x428f4c[_0x9de7('0x37')][_0x9de7('0x39')]?_0x428f4c['attributes']:_0x8e3c59[_0x9de7('0x32')];if(_0x47141c[_0x9de7('0x33')][_0x9de7('0x43')]){_0x428f4c[_0x9de7('0x47')]=[{'all':!![]}];}_0x428f4c=_['merge']({},_0x428f4c,_0x47141c[_0x9de7('0x42')]);return db[_0x9de7('0x2e')][_0x9de7('0x48')](_0x428f4c)['then'](handleEntityNotFound(_0x48b564,null))['then'](respondWithResult(_0x48b564,null))[_0x9de7('0x49')](handleError(_0x48b564,null));};exports[_0x9de7('0x4a')]=function(_0x2bb770,_0x3421ee,_0x7eb4eb){return db[_0x9de7('0x2e')]['find']({'where':{'id':_0x2bb770['params']['id']},'attributes':[_0x9de7('0x2a'),_0x9de7('0x4b'),_0x9de7('0x4c')],'raw':!![]})[_0x9de7('0x22')](handleEntityNotFound(_0x3421ee,null))[_0x9de7('0x22')](function(_0x4462f5){if(_0x4462f5){if(!fs[_0x9de7('0x4d')](path['join'](config[_0x9de7('0x4e')],_0x9de7('0x4f'),_0x4462f5[_0x9de7('0x4b')]+'.'+_0x4462f5[_0x9de7('0x4c')]))){throw new db[(_0x9de7('0x50'))][(_0x9de7('0x51'))](_0x9de7('0x52'));}return _0x3421ee[_0x9de7('0x4a')](path[_0x9de7('0x53')](config[_0x9de7('0x4e')],_0x9de7('0x4f'),util['format'](_0x9de7('0x54'),_0x4462f5[_0x9de7('0x4b')],_0x4462f5[_0x9de7('0x4c')])),util[_0x9de7('0x55')](_0x9de7('0x54'),_0x4462f5[_0x9de7('0x2a')],_0x4462f5[_0x9de7('0x4c')]));}return null;})[_0x9de7('0x49')](handleError(_0x3421ee,null));};exports[_0x9de7('0x56')]=function(_0x5814a4,_0x58f506,_0x421b67){var _0x27ec99={'name':path[_0x9de7('0x57')](_0x5814a4[_0x9de7('0x58')][_0x9de7('0x59')],path[_0x9de7('0x5a')](_0x5814a4[_0x9de7('0x58')][_0x9de7('0x59')])),'save_name':path[_0x9de7('0x57')](_0x5814a4[_0x9de7('0x58')]['filename'],path[_0x9de7('0x5a')](_0x5814a4[_0x9de7('0x58')][_0x9de7('0x5b')])),'original_format':path[_0x9de7('0x5a')](_0x5814a4[_0x9de7('0x58')][_0x9de7('0x59')])[_0x9de7('0x5c')](0x1),'converted_format':_0x9de7('0x5d')};var _0x3b545d=path[_0x9de7('0x53')](config[_0x9de7('0x4e')],_0x9de7('0x5e'),_0x5814a4['file'][_0x9de7('0x5b')]);var _0x156639=path[_0x9de7('0x53')](config[_0x9de7('0x4e')],_0x9de7('0x4f'),util[_0x9de7('0x55')]('%s.%s',path['basename'](_0x5814a4[_0x9de7('0x58')][_0x9de7('0x5b')],path['extname'](_0x5814a4[_0x9de7('0x58')][_0x9de7('0x5b')])),_0x27ec99[_0x9de7('0x4c')]));logger[_0x9de7('0x5f')]('Sound\x20upload\x20filepath:\x20%s',_0x3b545d);logger[_0x9de7('0x5f')](_0x9de7('0x60'),_0x156639);try{fs[_0x9de7('0x61')](_0x3b545d,parseInt(_0x9de7('0x62'),0x8));var _0x525c34=sox[_0x9de7('0x63')](_0x3b545d,_0x156639,{'sampleRate':0x1f40,'format':_0x9de7('0x5d'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x525c34['on'](_0x9de7('0x28'),function(_0x5e1d9a){fs[_0x9de7('0x64')](_0x3b545d);_0x58f506['status'](0x1f4)[_0x9de7('0x2b')](_0x5e1d9a);});_0x525c34['on']('src',function(_0x48f85e){_0x27ec99[_0x9de7('0x65')]=isNaN(_0x48f85e[_0x9de7('0x66')])?null:_0x48f85e['duration']*0x3e8;_0x27ec99[_0x9de7('0x67')]=isNaN(_0x48f85e[_0x9de7('0x68')])?null:_0x48f85e[_0x9de7('0x68')];_0x27ec99[_0x9de7('0x69')]=isNaN(_0x48f85e[_0x9de7('0x6a')])?null:_0x48f85e[_0x9de7('0x6a')];_0x27ec99[_0x9de7('0x6b')]=isNaN(_0x48f85e['bitRate'])?null:_0x48f85e[_0x9de7('0x6c')];_0x27ec99[_0x9de7('0x6d')]=isNaN(_0x48f85e['sampleRate'])?null:_0x48f85e[_0x9de7('0x6e')];});_0x525c34['on'](_0x9de7('0x6f'),function(_0x47bd64){_0x27ec99['converted_duration']=isNaN(_0x47bd64[_0x9de7('0x66')])?null:_0x47bd64[_0x9de7('0x66')]*0x3e8;_0x27ec99[_0x9de7('0x70')]=isNaN(_0x47bd64[_0x9de7('0x68')])?null:_0x47bd64[_0x9de7('0x68')];_0x27ec99[_0x9de7('0x71')]=isNaN(_0x47bd64[_0x9de7('0x6a')])?null:_0x47bd64['channelCount'];_0x27ec99[_0x9de7('0x72')]=isNaN(_0x47bd64[_0x9de7('0x6c')])?null:_0x47bd64[_0x9de7('0x6c')];_0x27ec99[_0x9de7('0x73')]=isNaN(_0x47bd64['sampleRate'])?null:_0x47bd64[_0x9de7('0x6e')];});_0x525c34['on'](_0x9de7('0x27'),function(){fs['chmodSync'](_0x156639,parseInt(_0x9de7('0x62'),0x8));return db[_0x9de7('0x2e')][_0x9de7('0x56')](_0x27ec99)['then'](function(_0x1bf2eb){var _0x6ca570={'role':_0x5814a4[_0x9de7('0x74')][_0x9de7('0x75')],'userProfileId':_0x5814a4[_0x9de7('0x74')]['userProfileId']};if(!_0x6ca570)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x6ca570['role']===_0x9de7('0x76')){var _0x320312=_0x1bf2eb[_0x9de7('0x24')]({'plain':!![]});return db[_0x9de7('0x77')][_0x9de7('0x48')]({'where':{'name':_0x9de7('0x25'),'userProfileId':_0x6ca570['userProfileId']},'raw':!![]})[_0x9de7('0x22')](function(_0x41ead4){if(_0x41ead4&&_0x41ead4[_0x9de7('0x78')]===0x0){return db[_0x9de7('0x26')][_0x9de7('0x56')]({'name':_0x320312['name'],'resourceId':_0x320312['id'],'type':_0x41ead4[_0x9de7('0x2a')],'sectionId':_0x41ead4['id']},{})['then'](function(){return _0x1bf2eb;});}else{return _0x1bf2eb;}})[_0x9de7('0x49')](function(_0x3664dd){logger[_0x9de7('0x28')](_0x9de7('0x79'),_0x3664dd);throw _0x3664dd;});}return _0x1bf2eb;})[_0x9de7('0x22')](respondWithResult(_0x58f506,null))[_0x9de7('0x49')](handleError(_0x58f506,null));});_0x525c34[_0x9de7('0x7a')]();}catch(_0x2207dd){_0x58f506['status'](0x1f4)[_0x9de7('0x2b')](_0x2207dd);}};exports['update']=function(_0x43cc4d,_0x3b8aaf,_0x2e45c9){return db[_0x9de7('0x2e')]['find']({'where':{'id':_0x43cc4d['params']['id']}})[_0x9de7('0x22')](handleEntityNotFound(_0x3b8aaf,null))[_0x9de7('0x22')](saveUpdates(_[_0x9de7('0x3f')](_0x43cc4d[_0x9de7('0x74')],['name','description']),null))[_0x9de7('0x22')](respondWithResult(_0x3b8aaf,null))[_0x9de7('0x49')](handleError(_0x3b8aaf,null));};exports['delete']=function(_0x5a5329,_0xcbab7d,_0x120153){return db['Sound'][_0x9de7('0x48')]({'where':{'id':_0x5a5329[_0x9de7('0x46')]['id']}})[_0x9de7('0x22')](function(_0x5a9d26){if(_0x5a9d26){return _0x5a9d26['destroy']();}})[_0x9de7('0x22')](function(_0x6e3f61){var _0x33dac6=path[_0x9de7('0x53')](config[_0x9de7('0x4e')],_0x9de7('0x5e'),util[_0x9de7('0x55')](_0x9de7('0x54'),_0x6e3f61['save_name'],_0x6e3f61[_0x9de7('0x7b')]));var _0x39929a=path[_0x9de7('0x53')](config['root'],'server/files/sounds/converted',util[_0x9de7('0x55')](_0x9de7('0x54'),_0x6e3f61[_0x9de7('0x4b')],_0x6e3f61['converted_format']));fs[_0x9de7('0x64')](_0x33dac6);fs[_0x9de7('0x64')](_0x39929a);return _0x6e3f61;})[_0x9de7('0x22')](function(_0x1563fe){if(_0x1563fe){return _0xcbab7d[_0x9de7('0x1a')](0xcc)[_0x9de7('0x27')]();}})['then'](handleEntityNotFound(_0xcbab7d,null))['catch'](handleError(_0xcbab7d,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index e267e21..72d623f 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 _0xa107=['./sound.attributes','exports','define','Sound','lodash','util','api','moment','request-promise','path','../../config/environment'];(function(_0x5401ae,_0x5e58ac){var _0x286068=function(_0x2cac88){while(--_0x2cac88){_0x5401ae['push'](_0x5401ae['shift']());}};_0x286068(++_0x5e58ac);}(_0xa107,0xf6));var _0x7a10=function(_0x337066,_0x3d0dd6){_0x337066=_0x337066-0x0;var _0xa47a1=_0xa107[_0x337066];return _0xa47a1;};'use strict';var _=require(_0x7a10('0x0'));var util=require(_0x7a10('0x1'));var logger=require('../../config/logger')(_0x7a10('0x2'));var moment=require(_0x7a10('0x3'));var BPromise=require('bluebird');var rp=require(_0x7a10('0x4'));var fs=require('fs');var path=require(_0x7a10('0x5'));var rimraf=require('rimraf');var config=require(_0x7a10('0x6'));var attributes=require(_0x7a10('0x7'));module[_0x7a10('0x8')]=function(_0x2e3c1f,_0x17c1e1){return _0x2e3c1f[_0x7a10('0x9')](_0x7a10('0xa'),attributes,{'tableName':'tools_sounds','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x258e=['../../config/environment','./sound.attributes','exports','Sound','tools_sounds','util','api','bluebird','request-promise','path','rimraf'];(function(_0x1cfa0d,_0x4391f2){var _0xe33279=function(_0x3ce7c1){while(--_0x3ce7c1){_0x1cfa0d['push'](_0x1cfa0d['shift']());}};_0xe33279(++_0x4391f2);}(_0x258e,0x1f4));var _0xe258=function(_0x5815e5,_0xcf9302){_0x5815e5=_0x5815e5-0x0;var _0x4e4e6d=_0x258e[_0x5815e5];return _0x4e4e6d;};'use strict';var _=require('lodash');var util=require(_0xe258('0x0'));var logger=require('../../config/logger')(_0xe258('0x1'));var moment=require('moment');var BPromise=require(_0xe258('0x2'));var rp=require(_0xe258('0x3'));var fs=require('fs');var path=require(_0xe258('0x4'));var rimraf=require(_0xe258('0x5'));var config=require(_0xe258('0x6'));var attributes=require(_0xe258('0x7'));module[_0xe258('0x8')]=function(_0x21b9f1,_0x3f3efc){return _0x21b9f1['define'](_0xe258('0x9'),attributes,{'tableName':_0xe258('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/sound/sound.rpc.js b/server/api/sound/sound.rpc.js index d32a171..d798d5c 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 _0xc497=['result','catch','ShowSound','Sound','find','options','raw','where','attributes','map','include','model','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','Sound,\x20%s,\x20%s','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x11c573,_0x9e7c6e){var _0x6b72de=function(_0x2e8a61){while(--_0x2e8a61){_0x11c573['push'](_0x11c573['shift']());}};_0x6b72de(++_0x9e7c6e);}(_0xc497,0x18d));var _0x7c49=function(_0x10fa5b,_0x425d90){_0x10fa5b=_0x10fa5b-0x0;var _0x11bd39=_0xc497[_0x10fa5b];return _0x11bd39;};'use strict';var _=require(_0x7c49('0x0'));var util=require(_0x7c49('0x1'));var moment=require(_0x7c49('0x2'));var BPromise=require(_0x7c49('0x3'));var rs=require(_0x7c49('0x4'));var fs=require('fs');var Redis=require(_0x7c49('0x5'));var db=require(_0x7c49('0x6'))['db'];var utils=require(_0x7c49('0x7'));var logger=require(_0x7c49('0x8'))(_0x7c49('0x9'));var config=require('../../config/environment');var jayson=require(_0x7c49('0xa'));var client=jayson[_0x7c49('0xb')][_0x7c49('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x158e59,_0x559e3c,_0x48342b){return new BPromise(function(_0x5eb9b3,_0x4b9725){return client[_0x7c49('0xd')](_0x158e59,_0x48342b)[_0x7c49('0xe')](function(_0x6274af){logger[_0x7c49('0xf')](_0x7c49('0x10'),_0x559e3c,_0x7c49('0x11'));logger[_0x7c49('0x12')](_0x7c49('0x13'),_0x559e3c,_0x7c49('0x11'),JSON[_0x7c49('0x14')](_0x6274af));if(_0x6274af['error']){if(_0x6274af['error']['code']===0x1f4){logger[_0x7c49('0x15')](_0x7c49('0x10'),_0x559e3c,_0x6274af[_0x7c49('0x15')][_0x7c49('0x16')]);return _0x4b9725(_0x6274af[_0x7c49('0x15')]['message']);}logger[_0x7c49('0x15')]('Sound,\x20%s,\x20%s',_0x559e3c,_0x6274af[_0x7c49('0x15')]['message']);return _0x5eb9b3(_0x6274af[_0x7c49('0x15')][_0x7c49('0x16')]);}else{logger[_0x7c49('0xf')](_0x7c49('0x10'),_0x559e3c,_0x7c49('0x11'));_0x5eb9b3(_0x6274af[_0x7c49('0x17')][_0x7c49('0x16')]);}})[_0x7c49('0x18')](function(_0x4256bd){logger[_0x7c49('0x15')](_0x7c49('0x10'),_0x559e3c,_0x4256bd);_0x4b9725(_0x4256bd);});});}exports[_0x7c49('0x19')]=function(_0x4ce005){var _0x4827e=this;return new Promise(function(_0x34b7cb,_0xd2007c){return db[_0x7c49('0x1a')][_0x7c49('0x1b')]({'raw':_0x4ce005[_0x7c49('0x1c')]?_0x4ce005['options'][_0x7c49('0x1d')]===undefined?!![]:![]:!![],'where':_0x4ce005['options']?_0x4ce005['options'][_0x7c49('0x1e')]||null:null,'attributes':_0x4ce005['options']?_0x4ce005[_0x7c49('0x1c')][_0x7c49('0x1f')]||null:null,'include':_0x4ce005[_0x7c49('0x1c')]?_0x4ce005[_0x7c49('0x1c')]['include']?_[_0x7c49('0x20')](_0x4ce005[_0x7c49('0x1c')]['include'],function(_0xdb554d){return{'model':db[_0xdb554d['model']],'as':_0xdb554d['as'],'attributes':_0xdb554d[_0x7c49('0x1f')],'include':_0xdb554d[_0x7c49('0x21')]?_['map'](_0xdb554d[_0x7c49('0x21')],function(_0x5abf72){return{'model':db[_0x5abf72[_0x7c49('0x22')]],'as':_0x5abf72['as'],'attributes':_0x5abf72[_0x7c49('0x1f')],'include':_0x5abf72[_0x7c49('0x21')]?_['map'](_0x5abf72['include'],function(_0x3c8ab5){return{'model':db[_0x3c8ab5[_0x7c49('0x22')]],'as':_0x3c8ab5['as'],'attributes':_0x3c8ab5[_0x7c49('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x7c49('0xe')](function(_0xf46923){logger[_0x7c49('0xf')](_0x7c49('0x19'),_0x4ce005);logger['debug']('ShowSound',_0x4ce005,JSON[_0x7c49('0x14')](_0xf46923));_0x34b7cb(_0xf46923);})[_0x7c49('0x18')](function(_0x4cdffb){logger['error'](_0x7c49('0x19'),_0x4cdffb[_0x7c49('0x16')],_0x4ce005);_0xd2007c(_0x4827e[_0x7c49('0x15')](0x1f4,_0x4cdffb['message']));});});}; \ No newline at end of file +var _0xeea4=['result','catch','Sound','find','options','raw','where','attributes','include','map','model','ShowSound','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','request','then','info','Sound,\x20%s,\x20%s','debug','Sound,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message'];(function(_0x1f6151,_0x24afa4){var _0x4f7b49=function(_0x20a391){while(--_0x20a391){_0x1f6151['push'](_0x1f6151['shift']());}};_0x4f7b49(++_0x24afa4);}(_0xeea4,0x1dd));var _0x4eea=function(_0x5034ec,_0x1e86fb){_0x5034ec=_0x5034ec-0x0;var _0x2b5fea=_0xeea4[_0x5034ec];return _0x2b5fea;};'use strict';var _=require(_0x4eea('0x0'));var util=require(_0x4eea('0x1'));var moment=require(_0x4eea('0x2'));var BPromise=require(_0x4eea('0x3'));var rs=require(_0x4eea('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4eea('0x5'))['db'];var utils=require(_0x4eea('0x6'));var logger=require(_0x4eea('0x7'))('rpc');var config=require(_0x4eea('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5821e6,_0x26b905,_0x57d59d){return new BPromise(function(_0x26fcd3,_0x8910a8){return client[_0x4eea('0x9')](_0x5821e6,_0x57d59d)[_0x4eea('0xa')](function(_0x166355){logger[_0x4eea('0xb')](_0x4eea('0xc'),_0x26b905,'request\x20sent');logger[_0x4eea('0xd')](_0x4eea('0xe'),_0x26b905,_0x4eea('0xf'),JSON[_0x4eea('0x10')](_0x166355));if(_0x166355[_0x4eea('0x11')]){if(_0x166355[_0x4eea('0x11')]['code']===0x1f4){logger[_0x4eea('0x11')](_0x4eea('0xc'),_0x26b905,_0x166355[_0x4eea('0x11')][_0x4eea('0x12')]);return _0x8910a8(_0x166355[_0x4eea('0x11')][_0x4eea('0x12')]);}logger[_0x4eea('0x11')](_0x4eea('0xc'),_0x26b905,_0x166355['error'][_0x4eea('0x12')]);return _0x26fcd3(_0x166355['error']['message']);}else{logger[_0x4eea('0xb')](_0x4eea('0xc'),_0x26b905,_0x4eea('0xf'));_0x26fcd3(_0x166355[_0x4eea('0x13')]['message']);}})[_0x4eea('0x14')](function(_0x349170){logger[_0x4eea('0x11')](_0x4eea('0xc'),_0x26b905,_0x349170);_0x8910a8(_0x349170);});});}exports['ShowSound']=function(_0x14ccae){var _0x35e49e=this;return new Promise(function(_0x30bade,_0x25fbda){return db[_0x4eea('0x15')][_0x4eea('0x16')]({'raw':_0x14ccae['options']?_0x14ccae[_0x4eea('0x17')][_0x4eea('0x18')]===undefined?!![]:![]:!![],'where':_0x14ccae[_0x4eea('0x17')]?_0x14ccae['options'][_0x4eea('0x19')]||null:null,'attributes':_0x14ccae['options']?_0x14ccae[_0x4eea('0x17')][_0x4eea('0x1a')]||null:null,'include':_0x14ccae[_0x4eea('0x17')]?_0x14ccae[_0x4eea('0x17')]['include']?_['map'](_0x14ccae['options'][_0x4eea('0x1b')],function(_0x27c96a){return{'model':db[_0x27c96a['model']],'as':_0x27c96a['as'],'attributes':_0x27c96a[_0x4eea('0x1a')],'include':_0x27c96a[_0x4eea('0x1b')]?_[_0x4eea('0x1c')](_0x27c96a[_0x4eea('0x1b')],function(_0x561aba){return{'model':db[_0x561aba['model']],'as':_0x561aba['as'],'attributes':_0x561aba[_0x4eea('0x1a')],'include':_0x561aba[_0x4eea('0x1b')]?_['map'](_0x561aba[_0x4eea('0x1b')],function(_0x2867e3){return{'model':db[_0x2867e3[_0x4eea('0x1d')]],'as':_0x2867e3['as'],'attributes':_0x2867e3[_0x4eea('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x4eea('0xa')](function(_0x470f1d){logger[_0x4eea('0xb')](_0x4eea('0x1e'),_0x14ccae);logger['debug'](_0x4eea('0x1e'),_0x14ccae,JSON[_0x4eea('0x10')](_0x470f1d));_0x30bade(_0x470f1d);})['catch'](function(_0x58605d){logger[_0x4eea('0x11')](_0x4eea('0x1e'),_0x58605d[_0x4eea('0x12')],_0x14ccae);_0x25fbda(_0x35e49e[_0x4eea('0x11')](0x1f4,_0x58605d[_0x4eea('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index a098270..6a27843 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 _0xd9cc=['index','get','isAuthenticated','show','post','create','/:id','delete','destroy','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./squareMessage.controller'];(function(_0x5718af,_0x438012){var _0x9a0f42=function(_0x3423ef){while(--_0x3423ef){_0x5718af['push'](_0x5718af['shift']());}};_0x9a0f42(++_0x438012);}(_0xd9cc,0x149));var _0xcd9c=function(_0x374283,_0x478549){_0x374283=_0x374283-0x0;var _0x349ef2=_0xd9cc[_0x374283];return _0x349ef2;};'use strict';var multer=require('multer');var util=require(_0xcd9c('0x0'));var path=require(_0xcd9c('0x1'));var timeout=require(_0xcd9c('0x2'));var express=require('express');var router=express[_0xcd9c('0x3')]();var auth=require(_0xcd9c('0x4'));var interaction=require(_0xcd9c('0x5'));var config=require('../../config/environment');var controller=require(_0xcd9c('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0xcd9c('0x7')]);router[_0xcd9c('0x8')]('/:id',auth[_0xcd9c('0x9')](),controller[_0xcd9c('0xa')]);router[_0xcd9c('0xb')]('/',auth['isAuthenticated'](),controller[_0xcd9c('0xc')]);router['put'](_0xcd9c('0xd'),auth[_0xcd9c('0x9')](),controller['update']);router[_0xcd9c('0xe')](_0xcd9c('0xd'),auth['isAuthenticated'](),controller[_0xcd9c('0xf')]);module['exports']=router; \ No newline at end of file +var _0x56a6=['exports','multer','util','path','express','Router','../../components/interaction/service','./squareMessage.controller','get','/:id','isAuthenticated','show','post','create','put','update','delete','destroy'];(function(_0x2d57e0,_0x14b28a){var _0x6f05c5=function(_0x1f87f3){while(--_0x1f87f3){_0x2d57e0['push'](_0x2d57e0['shift']());}};_0x6f05c5(++_0x14b28a);}(_0x56a6,0x145));var _0x656a=function(_0xab0b3b,_0x5e12c0){_0xab0b3b=_0xab0b3b-0x0;var _0x10dd2b=_0x56a6[_0xab0b3b];return _0x10dd2b;};'use strict';var multer=require(_0x656a('0x0'));var util=require(_0x656a('0x1'));var path=require(_0x656a('0x2'));var timeout=require('connect-timeout');var express=require(_0x656a('0x3'));var router=express[_0x656a('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x656a('0x5'));var config=require('../../config/environment');var controller=require(_0x656a('0x6'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x656a('0x7')](_0x656a('0x8'),auth[_0x656a('0x9')](),controller[_0x656a('0xa')]);router[_0x656a('0xb')]('/',auth[_0x656a('0x9')](),controller[_0x656a('0xc')]);router[_0x656a('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x656a('0xe')]);router[_0x656a('0xf')](_0x656a('0x8'),auth[_0x656a('0x9')](),controller[_0x656a('0x10')]);module[_0x656a('0x11')]=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index 4c94463..48b6b0f 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 _0x7239=['STRING','medium','ENUM','out'];(function(_0x17351a,_0x53cd09){var _0x5f38e6=function(_0x14a948){while(--_0x14a948){_0x17351a['push'](_0x17351a['shift']());}};_0x5f38e6(++_0x53cd09);}(_0x7239,0xa0));var _0x9723=function(_0x4141d7,_0x21dd0d){_0x4141d7=_0x4141d7-0x0;var _0xe5674=_0x7239[_0x4141d7];return _0xe5674;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x9723('0x0')]},'body':{'type':Sequelize['TEXT'](_0x9723('0x1')),'allowNull':![]},'direction':{'type':Sequelize[_0x9723('0x2')]('in',_0x9723('0x3')),'defaultValue':'out','allowNull':![]}}; \ No newline at end of file +var _0xa760=['medium','ENUM','out','exports','STRING','TEXT'];(function(_0x51570c,_0x4c1132){var _0x6141d6=function(_0x473633){while(--_0x473633){_0x51570c['push'](_0x51570c['shift']());}};_0x6141d6(++_0x4c1132);}(_0xa760,0x12f));var _0x0a76=function(_0x520945,_0x28b144){_0x520945=_0x520945-0x0;var _0x17067a=_0xa760[_0x520945];return _0x17067a;};'use strict';var Sequelize=require('sequelize');module[_0x0a76('0x0')]={'uniqueid':{'type':Sequelize[_0x0a76('0x1')]},'body':{'type':Sequelize[_0x0a76('0x2')](_0x0a76('0x3')),'allowNull':![]},'direction':{'type':Sequelize[_0x0a76('0x4')]('in','out'),'defaultValue':_0x0a76('0x5'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index e7f68c3..87beeac 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 _0x0b6f=['length','nolimit','sort','where','pick','merge','VIRTUAL','options','include','findAll','rows','catch','create','body','find','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','sendStatus','error','name','send','index','map','SquareMessage','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields'];(function(_0x5d209e,_0x4b1caf){var _0x4ecadd=function(_0x439731){while(--_0x439731){_0x5d209e['push'](_0x5d209e['shift']());}};_0x4ecadd(++_0x4b1caf);}(_0x0b6f,0x134));var _0xf0b6=function(_0x39772f,_0x5605cb){_0x39772f=_0x39772f-0x0;var _0xc9edbf=_0x0b6f[_0x39772f];return _0xc9edbf;};'use strict';var pdf=require(_0xf0b6('0x0'));var emlformat=require(_0xf0b6('0x1'));var rimraf=require(_0xf0b6('0x2'));var zipdir=require(_0xf0b6('0x3'));var jsonpatch=require(_0xf0b6('0x4'));var rp=require(_0xf0b6('0x5'));var moment=require(_0xf0b6('0x6'));var BPromise=require(_0xf0b6('0x7'));var Mustache=require(_0xf0b6('0x8'));var util=require(_0xf0b6('0x9'));var path=require(_0xf0b6('0xa'));var sox=require(_0xf0b6('0xb'));var csv=require(_0xf0b6('0xc'));var ejs=require(_0xf0b6('0xd'));var fs=require('fs');var _=require('lodash');var squel=require(_0xf0b6('0xe'));var crypto=require(_0xf0b6('0xf'));var jsforce=require(_0xf0b6('0x10'));var deskjs=require(_0xf0b6('0x11'));var toCsv=require(_0xf0b6('0xc'));var querystring=require(_0xf0b6('0x12'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xf0b6('0x13'));var qs=require(_0xf0b6('0x14'));var as=require(_0xf0b6('0x15'));var hardwareService=require(_0xf0b6('0x16'));var logger=require(_0xf0b6('0x17'))(_0xf0b6('0x18'));var utils=require(_0xf0b6('0x19'));var config=require(_0xf0b6('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3df117,_0x474524){_0x474524=_0x474524||0xcc;return function(_0x12a702){if(_0x12a702){return _0x3df117['sendStatus'](_0x474524);}return _0x3df117[_0xf0b6('0x1b')](_0x474524)[_0xf0b6('0x1c')]();};}function respondWithResult(_0x3ee732,_0x268cb9){_0x268cb9=_0x268cb9||0xc8;return function(_0x18c314){if(_0x18c314){return _0x3ee732['status'](_0x268cb9)[_0xf0b6('0x1d')](_0x18c314);}};}function respondWithFilteredResult(_0x21b380,_0x40221b){return function(_0xeee677){if(_0xeee677){var _0x324b8a=_0xeee677[_0xf0b6('0x1e')],_0x335b29=_0x40221b[_0xf0b6('0x1f')],_0x2be350=_0x40221b[_0xf0b6('0x1f')]+_0x40221b[_0xf0b6('0x20')],_0x2cd0b8;if(_0x2be350>=_0x324b8a){_0x2be350=_0x324b8a;_0x2cd0b8=0xc8;}else{_0x2cd0b8=0xce;}_0x21b380[_0xf0b6('0x1b')](_0x2cd0b8);return _0x21b380[_0xf0b6('0x21')](_0xf0b6('0x22'),_0x335b29+'-'+_0x2be350+'/'+_0x324b8a)['json'](_0xeee677);}return null;};}function patchUpdates(_0x46a715){return function(_0xc8c2a9){try{jsonpatch[_0xf0b6('0x23')](_0xc8c2a9,_0x46a715,!![]);}catch(_0x49b4ff){return BPromise['reject'](_0x49b4ff);}return _0xc8c2a9[_0xf0b6('0x24')]();};}function saveUpdates(_0x437283,_0x18d36f){return function(_0x52956d){if(_0x52956d){return _0x52956d[_0xf0b6('0x25')](_0x437283)[_0xf0b6('0x26')](function(_0x4ebd05){return _0x4ebd05;});}return null;};}function removeEntity(_0x3162e7,_0x196ae9){return function(_0x1e8263){if(_0x1e8263){return _0x1e8263[_0xf0b6('0x27')]()[_0xf0b6('0x26')](function(){_0x3162e7[_0xf0b6('0x1b')](0xcc)[_0xf0b6('0x1c')]();});}};}function handleEntityNotFound(_0x32d408,_0x3af838){return function(_0x6a6d8a){if(!_0x6a6d8a){_0x32d408[_0xf0b6('0x28')](0x194);}return _0x6a6d8a;};}function handleError(_0x10514a,_0x1d78d9){_0x1d78d9=_0x1d78d9||0x1f4;return function(_0x3cac1c){logger[_0xf0b6('0x29')](_0x3cac1c['stack']);if(_0x3cac1c[_0xf0b6('0x2a')]){delete _0x3cac1c['name'];}_0x10514a['status'](_0x1d78d9)[_0xf0b6('0x2b')](_0x3cac1c);};}exports[_0xf0b6('0x2c')]=function(_0x13e014,_0x40b369){var _0x355d66={},_0xcb3452={},_0x2e80cf={'count':0x0,'rows':[]};var _0xb8d36a=_[_0xf0b6('0x2d')](db[_0xf0b6('0x2e')][_0xf0b6('0x2f')],function(_0x46b774){return{'name':_0x46b774[_0xf0b6('0x30')],'type':_0x46b774[_0xf0b6('0x31')]['key']};});_0xcb3452[_0xf0b6('0x32')]=_[_0xf0b6('0x2d')](_0xb8d36a,_0xf0b6('0x2a'));_0xcb3452[_0xf0b6('0x33')]=_[_0xf0b6('0x34')](_0x13e014[_0xf0b6('0x33')]);_0xcb3452[_0xf0b6('0x35')]=_[_0xf0b6('0x36')](_0xcb3452[_0xf0b6('0x32')],_0xcb3452[_0xf0b6('0x33')]);_0x355d66[_0xf0b6('0x37')]=_['intersection'](_0xcb3452['model'],qs[_0xf0b6('0x38')](_0x13e014[_0xf0b6('0x33')][_0xf0b6('0x38')]));_0x355d66[_0xf0b6('0x37')]=_0x355d66['attributes'][_0xf0b6('0x39')]?_0x355d66[_0xf0b6('0x37')]:_0xcb3452['model'];if(!_0x13e014[_0xf0b6('0x33')]['hasOwnProperty'](_0xf0b6('0x3a'))){_0x355d66['limit']=qs[_0xf0b6('0x20')](_0x13e014[_0xf0b6('0x33')][_0xf0b6('0x20')]);_0x355d66[_0xf0b6('0x1f')]=qs[_0xf0b6('0x1f')](_0x13e014[_0xf0b6('0x33')]['offset']);}_0x355d66['order']=qs[_0xf0b6('0x3b')](_0x13e014[_0xf0b6('0x33')][_0xf0b6('0x3b')]);_0x355d66[_0xf0b6('0x3c')]=qs[_0xf0b6('0x35')](_[_0xf0b6('0x3d')](_0x13e014['query'],_0xcb3452[_0xf0b6('0x35')]));if(_0x13e014[_0xf0b6('0x33')]['filter']){_0x355d66[_0xf0b6('0x3c')]=_[_0xf0b6('0x3e')](_0x355d66[_0xf0b6('0x3c')],{'$or':_[_0xf0b6('0x2d')](_0xb8d36a,function(_0x164b61){if(_0x164b61[_0xf0b6('0x31')]!==_0xf0b6('0x3f')){var _0x41f5d3={};_0x41f5d3[_0x164b61[_0xf0b6('0x2a')]]={'$like':'%'+_0x13e014[_0xf0b6('0x33')]['filter']+'%'};return _0x41f5d3;}})});}_0x355d66=_[_0xf0b6('0x3e')]({},_0x355d66,_0x13e014[_0xf0b6('0x40')]);var _0xda4ecb={'where':_0x355d66[_0xf0b6('0x3c')]};return db[_0xf0b6('0x2e')]['count'](_0xda4ecb)['then'](function(_0x643ab9){_0x2e80cf[_0xf0b6('0x1e')]=_0x643ab9;if(_0x13e014[_0xf0b6('0x33')]['includeAll']){_0x355d66[_0xf0b6('0x41')]=[{'all':!![]}];}return db[_0xf0b6('0x2e')][_0xf0b6('0x42')](_0x355d66);})[_0xf0b6('0x26')](function(_0x5cda0b){_0x2e80cf[_0xf0b6('0x43')]=_0x5cda0b;return _0x2e80cf;})[_0xf0b6('0x26')](respondWithFilteredResult(_0x40b369,_0x355d66))[_0xf0b6('0x44')](handleError(_0x40b369,null));};exports['show']=function(_0x4d1306,_0x5c4b3f){var _0x1334f6={'raw':!![],'where':{'id':_0x4d1306['params']['id']}},_0x42ea8c={};_0x42ea8c['model']=_[_0xf0b6('0x34')](db[_0xf0b6('0x2e')]['rawAttributes']);_0x42ea8c['query']=_['keys'](_0x4d1306[_0xf0b6('0x33')]);_0x42ea8c[_0xf0b6('0x35')]=_['intersection'](_0x42ea8c['model'],_0x42ea8c[_0xf0b6('0x33')]);_0x1334f6[_0xf0b6('0x37')]=_[_0xf0b6('0x36')](_0x42ea8c['model'],qs[_0xf0b6('0x38')](_0x4d1306[_0xf0b6('0x33')][_0xf0b6('0x38')]));_0x1334f6[_0xf0b6('0x37')]=_0x1334f6[_0xf0b6('0x37')][_0xf0b6('0x39')]?_0x1334f6[_0xf0b6('0x37')]:_0x42ea8c[_0xf0b6('0x32')];if(_0x4d1306[_0xf0b6('0x33')]['includeAll']){_0x1334f6['include']=[{'all':!![]}];}_0x1334f6=_[_0xf0b6('0x3e')]({},_0x1334f6,_0x4d1306['options']);return db[_0xf0b6('0x2e')]['find'](_0x1334f6)['then'](handleEntityNotFound(_0x5c4b3f,null))[_0xf0b6('0x26')](respondWithResult(_0x5c4b3f,null))[_0xf0b6('0x44')](handleError(_0x5c4b3f,null));};exports[_0xf0b6('0x45')]=function(_0x502a5a,_0x53ccab){return db['SquareMessage'][_0xf0b6('0x45')](_0x502a5a[_0xf0b6('0x46')],{})[_0xf0b6('0x26')](respondWithResult(_0x53ccab,0xc9))[_0xf0b6('0x44')](handleError(_0x53ccab,null));};exports[_0xf0b6('0x25')]=function(_0x5a0efa,_0x29ae90){if(_0x5a0efa[_0xf0b6('0x46')]['id']){delete _0x5a0efa['body']['id'];}return db['SquareMessage'][_0xf0b6('0x47')]({'where':{'id':_0x5a0efa[_0xf0b6('0x48')]['id']}})['then'](handleEntityNotFound(_0x29ae90,null))[_0xf0b6('0x26')](saveUpdates(_0x5a0efa[_0xf0b6('0x46')],null))['then'](respondWithResult(_0x29ae90,null))[_0xf0b6('0x44')](handleError(_0x29ae90,null));};exports['destroy']=function(_0x1a18d4,_0x477b4c){return db[_0xf0b6('0x2e')][_0xf0b6('0x47')]({'where':{'id':_0x1a18d4[_0xf0b6('0x48')]['id']}})[_0xf0b6('0x26')](handleEntityNotFound(_0x477b4c,null))[_0xf0b6('0x26')](removeEntity(_0x477b4c,null))[_0xf0b6('0x44')](handleError(_0x477b4c,null));}; \ No newline at end of file +var _0x0273=['merge','find','create','body','update','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','count','offset','limit','set','Content-Range','apply','reject','then','destroy','end','sendStatus','stack','name','send','SquareMessage','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filter','map','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','length'];(function(_0x37278c,_0x36c6ec){var _0x43a492=function(_0x70f497){while(--_0x70f497){_0x37278c['push'](_0x37278c['shift']());}};_0x43a492(++_0x36c6ec);}(_0x0273,0x1af));var _0x3027=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x0273[_0x14add3];return _0x4a174f;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x3027('0x0'));var rimraf=require(_0x3027('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3027('0x2'));var rp=require(_0x3027('0x3'));var moment=require('moment');var BPromise=require(_0x3027('0x4'));var Mustache=require(_0x3027('0x5'));var util=require(_0x3027('0x6'));var path=require('path');var sox=require(_0x3027('0x7'));var csv=require(_0x3027('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x3027('0x9'));var crypto=require(_0x3027('0xa'));var jsforce=require(_0x3027('0xb'));var deskjs=require(_0x3027('0xc'));var toCsv=require('to-csv');var querystring=require(_0x3027('0xd'));var Papa=require(_0x3027('0xe'));var Redis=require(_0x3027('0xf'));var authService=require(_0x3027('0x10'));var qs=require(_0x3027('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3027('0x12'));var logger=require(_0x3027('0x13'))(_0x3027('0x14'));var utils=require(_0x3027('0x15'));var config=require(_0x3027('0x16'));var db=require(_0x3027('0x17'))['db'];function respondWithStatusCode(_0x7f88b0,_0x2cc0c3){_0x2cc0c3=_0x2cc0c3||0xcc;return function(_0x3f3ae3){if(_0x3f3ae3){return _0x7f88b0['sendStatus'](_0x2cc0c3);}return _0x7f88b0[_0x3027('0x18')](_0x2cc0c3)['end']();};}function respondWithResult(_0x20defe,_0xdaa075){_0xdaa075=_0xdaa075||0xc8;return function(_0x285a09){if(_0x285a09){return _0x20defe[_0x3027('0x18')](_0xdaa075)['json'](_0x285a09);}};}function respondWithFilteredResult(_0xf22d34,_0x3e9b50){return function(_0x4dfd3b){if(_0x4dfd3b){var _0x1135e3=_0x4dfd3b[_0x3027('0x19')],_0x228aeb=_0x3e9b50[_0x3027('0x1a')],_0x4c264f=_0x3e9b50[_0x3027('0x1a')]+_0x3e9b50[_0x3027('0x1b')],_0x4db0b8;if(_0x4c264f>=_0x1135e3){_0x4c264f=_0x1135e3;_0x4db0b8=0xc8;}else{_0x4db0b8=0xce;}_0xf22d34[_0x3027('0x18')](_0x4db0b8);return _0xf22d34[_0x3027('0x1c')](_0x3027('0x1d'),_0x228aeb+'-'+_0x4c264f+'/'+_0x1135e3)['json'](_0x4dfd3b);}return null;};}function patchUpdates(_0xfac863){return function(_0x4f11d1){try{jsonpatch[_0x3027('0x1e')](_0x4f11d1,_0xfac863,!![]);}catch(_0x5956f2){return BPromise[_0x3027('0x1f')](_0x5956f2);}return _0x4f11d1['save']();};}function saveUpdates(_0x4b9107,_0x6976f1){return function(_0x28decf){if(_0x28decf){return _0x28decf['update'](_0x4b9107)[_0x3027('0x20')](function(_0x3a00a8){return _0x3a00a8;});}return null;};}function removeEntity(_0x2a9878,_0x2534cb){return function(_0x16ac7c){if(_0x16ac7c){return _0x16ac7c[_0x3027('0x21')]()[_0x3027('0x20')](function(){_0x2a9878[_0x3027('0x18')](0xcc)[_0x3027('0x22')]();});}};}function handleEntityNotFound(_0x40b2da,_0x365b8f){return function(_0x3c5647){if(!_0x3c5647){_0x40b2da[_0x3027('0x23')](0x194);}return _0x3c5647;};}function handleError(_0xbb39f4,_0x8a5011){_0x8a5011=_0x8a5011||0x1f4;return function(_0x134145){logger['error'](_0x134145[_0x3027('0x24')]);if(_0x134145['name']){delete _0x134145[_0x3027('0x25')];}_0xbb39f4[_0x3027('0x18')](_0x8a5011)[_0x3027('0x26')](_0x134145);};}exports['index']=function(_0x169471,_0x5462c7){var _0x269e5a={},_0x3f42eb={},_0x2da58d={'count':0x0,'rows':[]};var _0x1e37fa=_['map'](db[_0x3027('0x27')]['rawAttributes'],function(_0xc7bdac){return{'name':_0xc7bdac['fieldName'],'type':_0xc7bdac['type']['key']};});_0x3f42eb[_0x3027('0x28')]=_['map'](_0x1e37fa,'name');_0x3f42eb[_0x3027('0x29')]=_['keys'](_0x169471[_0x3027('0x29')]);_0x3f42eb[_0x3027('0x2a')]=_[_0x3027('0x2b')](_0x3f42eb[_0x3027('0x28')],_0x3f42eb['query']);_0x269e5a['attributes']=_[_0x3027('0x2b')](_0x3f42eb[_0x3027('0x28')],qs[_0x3027('0x2c')](_0x169471['query'][_0x3027('0x2c')]));_0x269e5a[_0x3027('0x2d')]=_0x269e5a[_0x3027('0x2d')]['length']?_0x269e5a[_0x3027('0x2d')]:_0x3f42eb[_0x3027('0x28')];if(!_0x169471[_0x3027('0x29')][_0x3027('0x2e')](_0x3027('0x2f'))){_0x269e5a[_0x3027('0x1b')]=qs[_0x3027('0x1b')](_0x169471[_0x3027('0x29')][_0x3027('0x1b')]);_0x269e5a[_0x3027('0x1a')]=qs[_0x3027('0x1a')](_0x169471[_0x3027('0x29')][_0x3027('0x1a')]);}_0x269e5a[_0x3027('0x30')]=qs['sort'](_0x169471[_0x3027('0x29')][_0x3027('0x31')]);_0x269e5a[_0x3027('0x32')]=qs[_0x3027('0x2a')](_['pick'](_0x169471[_0x3027('0x29')],_0x3f42eb[_0x3027('0x2a')]));if(_0x169471[_0x3027('0x29')][_0x3027('0x33')]){_0x269e5a[_0x3027('0x32')]=_['merge'](_0x269e5a[_0x3027('0x32')],{'$or':_[_0x3027('0x34')](_0x1e37fa,function(_0xe8c546){if(_0xe8c546[_0x3027('0x35')]!==_0x3027('0x36')){var _0x2ede9c={};_0x2ede9c[_0xe8c546[_0x3027('0x25')]]={'$like':'%'+_0x169471['query']['filter']+'%'};return _0x2ede9c;}})});}_0x269e5a=_['merge']({},_0x269e5a,_0x169471[_0x3027('0x37')]);var _0x2633a9={'where':_0x269e5a['where']};return db[_0x3027('0x27')][_0x3027('0x19')](_0x2633a9)[_0x3027('0x20')](function(_0x4f5857){_0x2da58d[_0x3027('0x19')]=_0x4f5857;if(_0x169471[_0x3027('0x29')][_0x3027('0x38')]){_0x269e5a[_0x3027('0x39')]=[{'all':!![]}];}return db[_0x3027('0x27')][_0x3027('0x3a')](_0x269e5a);})['then'](function(_0x1a3ce3){_0x2da58d[_0x3027('0x3b')]=_0x1a3ce3;return _0x2da58d;})['then'](respondWithFilteredResult(_0x5462c7,_0x269e5a))[_0x3027('0x3c')](handleError(_0x5462c7,null));};exports[_0x3027('0x3d')]=function(_0x2e13cd,_0x172f4a){var _0x16fcca={'raw':!![],'where':{'id':_0x2e13cd[_0x3027('0x3e')]['id']}},_0x1c214a={};_0x1c214a['model']=_[_0x3027('0x3f')](db[_0x3027('0x27')][_0x3027('0x40')]);_0x1c214a[_0x3027('0x29')]=_['keys'](_0x2e13cd[_0x3027('0x29')]);_0x1c214a[_0x3027('0x2a')]=_[_0x3027('0x2b')](_0x1c214a[_0x3027('0x28')],_0x1c214a[_0x3027('0x29')]);_0x16fcca[_0x3027('0x2d')]=_[_0x3027('0x2b')](_0x1c214a['model'],qs[_0x3027('0x2c')](_0x2e13cd[_0x3027('0x29')]['fields']));_0x16fcca['attributes']=_0x16fcca['attributes'][_0x3027('0x41')]?_0x16fcca[_0x3027('0x2d')]:_0x1c214a[_0x3027('0x28')];if(_0x2e13cd[_0x3027('0x29')][_0x3027('0x38')]){_0x16fcca[_0x3027('0x39')]=[{'all':!![]}];}_0x16fcca=_[_0x3027('0x42')]({},_0x16fcca,_0x2e13cd[_0x3027('0x37')]);return db[_0x3027('0x27')][_0x3027('0x43')](_0x16fcca)[_0x3027('0x20')](handleEntityNotFound(_0x172f4a,null))[_0x3027('0x20')](respondWithResult(_0x172f4a,null))[_0x3027('0x3c')](handleError(_0x172f4a,null));};exports[_0x3027('0x44')]=function(_0x3d4f3a,_0x543fea){return db[_0x3027('0x27')][_0x3027('0x44')](_0x3d4f3a[_0x3027('0x45')],{})[_0x3027('0x20')](respondWithResult(_0x543fea,0xc9))['catch'](handleError(_0x543fea,null));};exports[_0x3027('0x46')]=function(_0x2b57fe,_0x127c8f){if(_0x2b57fe[_0x3027('0x45')]['id']){delete _0x2b57fe[_0x3027('0x45')]['id'];}return db[_0x3027('0x27')][_0x3027('0x43')]({'where':{'id':_0x2b57fe[_0x3027('0x3e')]['id']}})['then'](handleEntityNotFound(_0x127c8f,null))[_0x3027('0x20')](saveUpdates(_0x2b57fe[_0x3027('0x45')],null))[_0x3027('0x20')](respondWithResult(_0x127c8f,null))[_0x3027('0x3c')](handleError(_0x127c8f,null));};exports[_0x3027('0x21')]=function(_0xdb6d9f,_0x150603){return db[_0x3027('0x27')][_0x3027('0x43')]({'where':{'id':_0xdb6d9f[_0x3027('0x3e')]['id']}})[_0x3027('0x20')](handleEntityNotFound(_0x150603,null))[_0x3027('0x20')](removeEntity(_0x150603,null))[_0x3027('0x3c')](handleError(_0x150603,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 878c72e..8375519 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 _0x49f2=['SquareMessage','square_messages','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./squareMessage.attributes','exports','define'];(function(_0x43d587,_0x498ad0){var _0x5d2108=function(_0x5f4d02){while(--_0x5f4d02){_0x43d587['push'](_0x43d587['shift']());}};_0x5d2108(++_0x498ad0);}(_0x49f2,0x1e3));var _0x249f=function(_0xfc06be,_0x4b6fda){_0xfc06be=_0xfc06be-0x0;var _0x339ae4=_0x49f2[_0xfc06be];return _0x339ae4;};'use strict';var _=require(_0x249f('0x0'));var util=require(_0x249f('0x1'));var logger=require(_0x249f('0x2'))(_0x249f('0x3'));var moment=require(_0x249f('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x249f('0x5'));var rimraf=require(_0x249f('0x6'));var config=require(_0x249f('0x7'));var attributes=require(_0x249f('0x8'));module[_0x249f('0x9')]=function(_0x2757f8,_0x4c4626){return _0x2757f8[_0x249f('0xa')](_0x249f('0xb'),attributes,{'tableName':_0x249f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x73d1=['define','SquareMessage','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./squareMessage.attributes','exports'];(function(_0x8f9ae2,_0x592e96){var _0x39e0e3=function(_0x43a987){while(--_0x43a987){_0x8f9ae2['push'](_0x8f9ae2['shift']());}};_0x39e0e3(++_0x592e96);}(_0x73d1,0x6e));var _0x173d=function(_0x28e79a,_0x5ca484){_0x28e79a=_0x28e79a-0x0;var _0x40b764=_0x73d1[_0x28e79a];return _0x40b764;};'use strict';var _=require(_0x173d('0x0'));var util=require(_0x173d('0x1'));var logger=require(_0x173d('0x2'))('api');var moment=require(_0x173d('0x3'));var BPromise=require(_0x173d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x173d('0x5'));var rimraf=require(_0x173d('0x6'));var config=require(_0x173d('0x7'));var attributes=require(_0x173d('0x8'));module[_0x173d('0x9')]=function(_0x307b58,_0x1577af){return _0x307b58[_0x173d('0xa')](_0x173d('0xb'),attributes,{'tableName':'square_messages','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 e6baecc..511b784 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 _0x23f4=['util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','SquareMessage,\x20%s,\x20%s','debug','SquareMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','CreateSquareMessage','create','options','then'];(function(_0x7e2eb0,_0x17cd58){var _0xd92de4=function(_0x5d005b){while(--_0x5d005b){_0x7e2eb0['push'](_0x7e2eb0['shift']());}};_0xd92de4(++_0x17cd58);}(_0x23f4,0x1ee));var _0x423f=function(_0x534aad,_0x59c653){_0x534aad=_0x534aad-0x0;var _0xecd46a=_0x23f4[_0x534aad];return _0xecd46a;};'use strict';var _=require('lodash');var util=require(_0x423f('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x423f('0x1'));var fs=require('fs');var Redis=require(_0x423f('0x2'));var db=require(_0x423f('0x3'))['db'];var utils=require(_0x423f('0x4'));var logger=require(_0x423f('0x5'))(_0x423f('0x6'));var config=require(_0x423f('0x7'));var jayson=require(_0x423f('0x8'));var client=jayson[_0x423f('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x260eae,_0x47716d,_0x55258d){return new BPromise(function(_0x727b4e,_0x416fb1){return client[_0x423f('0xa')](_0x260eae,_0x55258d)['then'](function(_0x5b5ee6){logger['info'](_0x423f('0xb'),_0x47716d,'request\x20sent');logger[_0x423f('0xc')](_0x423f('0xd'),_0x47716d,_0x423f('0xe'),JSON[_0x423f('0xf')](_0x5b5ee6));if(_0x5b5ee6['error']){if(_0x5b5ee6[_0x423f('0x10')][_0x423f('0x11')]===0x1f4){logger[_0x423f('0x10')](_0x423f('0xb'),_0x47716d,_0x5b5ee6[_0x423f('0x10')]['message']);return _0x416fb1(_0x5b5ee6[_0x423f('0x10')][_0x423f('0x12')]);}logger[_0x423f('0x10')](_0x423f('0xb'),_0x47716d,_0x5b5ee6[_0x423f('0x10')][_0x423f('0x12')]);return _0x727b4e(_0x5b5ee6[_0x423f('0x10')][_0x423f('0x12')]);}else{logger[_0x423f('0x13')](_0x423f('0xb'),_0x47716d,_0x423f('0xe'));_0x727b4e(_0x5b5ee6[_0x423f('0x14')][_0x423f('0x12')]);}})[_0x423f('0x15')](function(_0x9d1487){logger[_0x423f('0x10')](_0x423f('0xb'),_0x47716d,_0x9d1487);_0x416fb1(_0x9d1487);});});}exports[_0x423f('0x16')]=function(_0x26b6d1){var _0x5424e6=this;return new Promise(function(_0x99435f,_0x569fd0){return db['SquareMessage'][_0x423f('0x17')](_0x26b6d1['body'],{'raw':_0x26b6d1[_0x423f('0x18')]?_0x26b6d1[_0x423f('0x18')]['raw']===undefined?!![]:![]:!![]})[_0x423f('0x19')](function(_0x1fc317){logger['info'](_0x423f('0x16'),_0x26b6d1);logger[_0x423f('0xc')]('CreateSquareMessage',_0x26b6d1,JSON[_0x423f('0xf')](_0x1fc317));_0x99435f(_0x1fc317);})[_0x423f('0x15')](function(_0x568dcd){logger[_0x423f('0x10')]('CreateSquareMessage',_0x568dcd[_0x423f('0x12')],_0x26b6d1);_0x569fd0(_0x5424e6[_0x423f('0x10')](0x1f4,_0x568dcd[_0x423f('0x12')]));});});}; \ No newline at end of file +var _0x07e8=['raw','lodash','util','moment','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','http','request','then','info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateSquareMessage','SquareMessage','create','body','options'];(function(_0x53fcd9,_0x435157){var _0x50e7ff=function(_0x48cdaa){while(--_0x48cdaa){_0x53fcd9['push'](_0x53fcd9['shift']());}};_0x50e7ff(++_0x435157);}(_0x07e8,0x10f));var _0x807e=function(_0x161eb7,_0x4c77a2){_0x161eb7=_0x161eb7-0x0;var _0x3c04eb=_0x07e8[_0x161eb7];return _0x3c04eb;};'use strict';var _=require(_0x807e('0x0'));var util=require(_0x807e('0x1'));var moment=require(_0x807e('0x2'));var BPromise=require('bluebird');var rs=require(_0x807e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x807e('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x807e('0x5'));var config=require(_0x807e('0x6'));var jayson=require(_0x807e('0x7'));var client=jayson['client'][_0x807e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xa12efd,_0x30766c,_0x178efb){return new BPromise(function(_0x1845b3,_0x54e3cb){return client[_0x807e('0x9')](_0xa12efd,_0x178efb)[_0x807e('0xa')](function(_0x400374){logger[_0x807e('0xb')](_0x807e('0xc'),_0x30766c,_0x807e('0xd'));logger[_0x807e('0xe')](_0x807e('0xf'),_0x30766c,_0x807e('0xd'),JSON[_0x807e('0x10')](_0x400374));if(_0x400374[_0x807e('0x11')]){if(_0x400374[_0x807e('0x11')][_0x807e('0x12')]===0x1f4){logger[_0x807e('0x11')]('SquareMessage,\x20%s,\x20%s',_0x30766c,_0x400374[_0x807e('0x11')][_0x807e('0x13')]);return _0x54e3cb(_0x400374[_0x807e('0x11')][_0x807e('0x13')]);}logger[_0x807e('0x11')](_0x807e('0xc'),_0x30766c,_0x400374[_0x807e('0x11')]['message']);return _0x1845b3(_0x400374['error'][_0x807e('0x13')]);}else{logger[_0x807e('0xb')](_0x807e('0xc'),_0x30766c,_0x807e('0xd'));_0x1845b3(_0x400374['result'][_0x807e('0x13')]);}})[_0x807e('0x14')](function(_0x1ffc81){logger[_0x807e('0x11')](_0x807e('0xc'),_0x30766c,_0x1ffc81);_0x54e3cb(_0x1ffc81);});});}exports[_0x807e('0x15')]=function(_0x535987){var _0x81676e=this;return new Promise(function(_0x57af7a,_0x3ce49b){return db[_0x807e('0x16')][_0x807e('0x17')](_0x535987[_0x807e('0x18')],{'raw':_0x535987[_0x807e('0x19')]?_0x535987[_0x807e('0x19')][_0x807e('0x1a')]===undefined?!![]:![]:!![]})[_0x807e('0xa')](function(_0x3da4d6){logger['info']('CreateSquareMessage',_0x535987);logger[_0x807e('0xe')](_0x807e('0x15'),_0x535987,JSON[_0x807e('0x10')](_0x3da4d6));_0x57af7a(_0x3da4d6);})[_0x807e('0x14')](function(_0x2c584a){logger[_0x807e('0x11')](_0x807e('0x15'),_0x2c584a[_0x807e('0x13')],_0x535987);_0x3ce49b(_0x81676e['error'](0x1f4,_0x2c584a[_0x807e('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 2fc1e8a..792080c 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 _0xdafe=['test','post','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareOdbc.controller','get','isAuthenticated','show','15s'];(function(_0x33e5e2,_0x10d7a8){var _0x21e5af=function(_0x4b4103){while(--_0x4b4103){_0x33e5e2['push'](_0x33e5e2['shift']());}};_0x21e5af(++_0x10d7a8);}(_0xdafe,0x6a));var _0xedaf=function(_0x50539e,_0x1037ab){_0x50539e=_0x50539e-0x0;var _0x1aa439=_0xdafe[_0x50539e];return _0x1aa439;};'use strict';var multer=require(_0xedaf('0x0'));var util=require(_0xedaf('0x1'));var path=require(_0xedaf('0x2'));var timeout=require(_0xedaf('0x3'));var express=require(_0xedaf('0x4'));var router=express[_0xedaf('0x5')]();var auth=require(_0xedaf('0x6'));var interaction=require(_0xedaf('0x7'));var config=require(_0xedaf('0x8'));var controller=require(_0xedaf('0x9'));router[_0xedaf('0xa')]('/',auth[_0xedaf('0xb')](),controller['index']);router[_0xedaf('0xa')]('/:id',auth[_0xedaf('0xb')](),controller[_0xedaf('0xc')]);router['get']('/:id/test',auth[_0xedaf('0xb')](),timeout(_0xedaf('0xd')),controller[_0xedaf('0xe')]);router[_0xedaf('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['put']('/:id',auth[_0xedaf('0xb')](),controller[_0xedaf('0x10')]);router[_0xedaf('0x11')]('/:id',auth[_0xedaf('0xb')](),controller[_0xedaf('0x12')]);module[_0xedaf('0x13')]=router; \ No newline at end of file +var _0x1d13=['delete','destroy','util','path','../../components/auth/service','../../components/interaction/service','./squareOdbc.controller','get','index','/:id','isAuthenticated','show','/:id/test','test','create','put','update'];(function(_0x18bee8,_0x15e890){var _0x4301a9=function(_0x36c7d3){while(--_0x36c7d3){_0x18bee8['push'](_0x18bee8['shift']());}};_0x4301a9(++_0x15e890);}(_0x1d13,0x123));var _0x31d1=function(_0x11b9e7,_0x3eb099){_0x11b9e7=_0x11b9e7-0x0;var _0x15f283=_0x1d13[_0x11b9e7];return _0x15f283;};'use strict';var multer=require('multer');var util=require(_0x31d1('0x0'));var path=require(_0x31d1('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0x31d1('0x2'));var interaction=require(_0x31d1('0x3'));var config=require('../../config/environment');var controller=require(_0x31d1('0x4'));router[_0x31d1('0x5')]('/',auth['isAuthenticated'](),controller[_0x31d1('0x6')]);router[_0x31d1('0x5')](_0x31d1('0x7'),auth[_0x31d1('0x8')](),controller[_0x31d1('0x9')]);router[_0x31d1('0x5')](_0x31d1('0xa'),auth[_0x31d1('0x8')](),timeout('15s'),controller[_0x31d1('0xb')]);router['post']('/',auth[_0x31d1('0x8')](),controller[_0x31d1('0xc')]);router[_0x31d1('0xd')]('/:id',auth[_0x31d1('0x8')](),controller[_0x31d1('0xe')]);router[_0x31d1('0xf')](_0x31d1('0x7'),auth['isAuthenticated'](),controller[_0x31d1('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index 9df9888..0675f1b 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 _0x0a33=['sequelize','STRING','name'];(function(_0x1eb0dd,_0x5729f){var _0x78e76b=function(_0x2b893d){while(--_0x2b893d){_0x1eb0dd['push'](_0x1eb0dd['shift']());}};_0x78e76b(++_0x5729f);}(_0x0a33,0x1bc));var _0x30a3=function(_0x534f3c,_0x3b079c){_0x534f3c=_0x534f3c-0x0;var _0x14c25e=_0x0a33[_0x534f3c];return _0x14c25e;};'use strict';var Sequelize=require(_0x30a3('0x0'));module['exports']={'name':{'type':Sequelize[_0x30a3('0x1')],'unique':_0x30a3('0x2'),'allowNull':![]},'dsn':{'type':Sequelize[_0x30a3('0x1')]},'description':{'type':Sequelize[_0x30a3('0x1')]}}; \ No newline at end of file +var _0x7e50=['name','STRING','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7e50,0xce));var _0x07e5=function(_0x1635fe,_0x5f1d9f){_0x1635fe=_0x1635fe-0x0;var _0x3c512a=_0x7e50[_0x1635fe];return _0x3c512a;};'use strict';var Sequelize=require(_0x07e5('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x07e5('0x1'),'allowNull':![]},'dsn':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x07e5('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 300e09b..08436b8 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 _0xfa4e=['fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','status','json','offset','Content-Range','apply','update','then','destroy','UserProfileResource','error','stack','name','send','map','SquareOdbc','rawAttributes','fieldName','model','query','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','pick','filter','merge','type','options','count','includeAll','rows','catch','show','keys','include','find','create','body','user','get','role','ODBC','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','dsn','closeSync','html-pdf','eml-format'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xfa4e,0x1d8));var _0xefa4=function(_0x2abf11,_0xde947b){_0x2abf11=_0x2abf11-0x0;var _0x41d602=_0xfa4e[_0x2abf11];return _0x41d602;};'use strict';var pdf=require(_0xefa4('0x0'));var emlformat=require(_0xefa4('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xefa4('0x2'));var rp=require(_0xefa4('0x3'));var moment=require(_0xefa4('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xefa4('0x5'));var util=require(_0xefa4('0x6'));var path=require(_0xefa4('0x7'));var sox=require(_0xefa4('0x8'));var csv=require(_0xefa4('0x9'));var ejs=require(_0xefa4('0xa'));var fs=require('fs');var _=require(_0xefa4('0xb'));var squel=require(_0xefa4('0xc'));var crypto=require(_0xefa4('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xefa4('0xe'));var toCsv=require(_0xefa4('0x9'));var querystring=require(_0xefa4('0xf'));var Papa=require(_0xefa4('0x10'));var Redis=require(_0xefa4('0x11'));var authService=require(_0xefa4('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xefa4('0x13'));var hardwareService=require(_0xefa4('0x14'));var logger=require('../../config/logger')(_0xefa4('0x15'));var utils=require(_0xefa4('0x16'));var config=require(_0xefa4('0x17'));var db=require(_0xefa4('0x18'))['db'];function respondWithStatusCode(_0x4f3db2,_0x9d8991){_0x9d8991=_0x9d8991||0xcc;return function(_0x2b2b0e){if(_0x2b2b0e){return _0x4f3db2['sendStatus'](_0x9d8991);}return _0x4f3db2['status'](_0x9d8991)['end']();};}function respondWithResult(_0x10c150,_0x32c459){_0x32c459=_0x32c459||0xc8;return function(_0x428cb2){if(_0x428cb2){return _0x10c150[_0xefa4('0x19')](_0x32c459)[_0xefa4('0x1a')](_0x428cb2);}};}function respondWithFilteredResult(_0x4ffb2f,_0x3888cf){return function(_0x304201){if(_0x304201){var _0x22370e=_0x304201['count'],_0x40c4ac=_0x3888cf[_0xefa4('0x1b')],_0x36744d=_0x3888cf[_0xefa4('0x1b')]+_0x3888cf['limit'],_0x39848b;if(_0x36744d>=_0x22370e){_0x36744d=_0x22370e;_0x39848b=0xc8;}else{_0x39848b=0xce;}_0x4ffb2f[_0xefa4('0x19')](_0x39848b);return _0x4ffb2f['set'](_0xefa4('0x1c'),_0x40c4ac+'-'+_0x36744d+'/'+_0x22370e)['json'](_0x304201);}return null;};}function patchUpdates(_0x36eb99){return function(_0x2100b8){try{jsonpatch[_0xefa4('0x1d')](_0x2100b8,_0x36eb99,!![]);}catch(_0x481134){return BPromise['reject'](_0x481134);}return _0x2100b8['save']();};}function saveUpdates(_0x3e7508,_0x23343c){return function(_0x539bfc){if(_0x539bfc){return _0x539bfc[_0xefa4('0x1e')](_0x3e7508)[_0xefa4('0x1f')](function(_0x47980b){return _0x47980b;});}return null;};}function removeEntity(_0x538c71,_0x139c27){return function(_0x4be191){if(_0x4be191){return _0x4be191[_0xefa4('0x20')]()[_0xefa4('0x1f')](function(){var _0x468b86=_0x4be191['get']({'plain':!![]});var _0x264805='ODBC';return db[_0xefa4('0x21')][_0xefa4('0x20')]({'where':{'type':_0x264805,'resourceId':_0x468b86['id']}})[_0xefa4('0x1f')](function(){return _0x4be191;});})['then'](function(){_0x538c71[_0xefa4('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x305104,_0x2cdd8a){return function(_0x266e1b){if(!_0x266e1b){_0x305104['sendStatus'](0x194);}return _0x266e1b;};}function handleError(_0x3edc06,_0x26df3b){_0x26df3b=_0x26df3b||0x1f4;return function(_0x26168a){logger[_0xefa4('0x22')](_0x26168a[_0xefa4('0x23')]);if(_0x26168a['name']){delete _0x26168a[_0xefa4('0x24')];}_0x3edc06[_0xefa4('0x19')](_0x26df3b)[_0xefa4('0x25')](_0x26168a);};}exports['index']=function(_0x118959,_0x4fe622){var _0x495944={},_0x129062={},_0x24d9ed={'count':0x0,'rows':[]};var _0x373bca=_[_0xefa4('0x26')](db[_0xefa4('0x27')][_0xefa4('0x28')],function(_0x51b7de){return{'name':_0x51b7de[_0xefa4('0x29')],'type':_0x51b7de['type']['key']};});_0x129062[_0xefa4('0x2a')]=_[_0xefa4('0x26')](_0x373bca,'name');_0x129062[_0xefa4('0x2b')]=_['keys'](_0x118959[_0xefa4('0x2b')]);_0x129062['filters']=_[_0xefa4('0x2c')](_0x129062[_0xefa4('0x2a')],_0x129062['query']);_0x495944[_0xefa4('0x2d')]=_[_0xefa4('0x2c')](_0x129062['model'],qs[_0xefa4('0x2e')](_0x118959[_0xefa4('0x2b')]['fields']));_0x495944[_0xefa4('0x2d')]=_0x495944[_0xefa4('0x2d')][_0xefa4('0x2f')]?_0x495944[_0xefa4('0x2d')]:_0x129062['model'];if(!_0x118959['query'][_0xefa4('0x30')]('nolimit')){_0x495944[_0xefa4('0x31')]=qs[_0xefa4('0x31')](_0x118959['query'][_0xefa4('0x31')]);_0x495944[_0xefa4('0x1b')]=qs[_0xefa4('0x1b')](_0x118959[_0xefa4('0x2b')][_0xefa4('0x1b')]);}_0x495944[_0xefa4('0x32')]=qs[_0xefa4('0x33')](_0x118959['query'][_0xefa4('0x33')]);_0x495944[_0xefa4('0x34')]=qs['filters'](_[_0xefa4('0x35')](_0x118959['query'],_0x129062['filters']));if(_0x118959['query'][_0xefa4('0x36')]){_0x495944[_0xefa4('0x34')]=_[_0xefa4('0x37')](_0x495944[_0xefa4('0x34')],{'$or':_[_0xefa4('0x26')](_0x373bca,function(_0x54e5a5){if(_0x54e5a5[_0xefa4('0x38')]!=='VIRTUAL'){var _0x3c95a0={};_0x3c95a0[_0x54e5a5[_0xefa4('0x24')]]={'$like':'%'+_0x118959[_0xefa4('0x2b')][_0xefa4('0x36')]+'%'};return _0x3c95a0;}})});}_0x495944=_[_0xefa4('0x37')]({},_0x495944,_0x118959[_0xefa4('0x39')]);var _0x13817a={'where':_0x495944[_0xefa4('0x34')]};return db[_0xefa4('0x27')][_0xefa4('0x3a')](_0x13817a)['then'](function(_0x47f705){_0x24d9ed[_0xefa4('0x3a')]=_0x47f705;if(_0x118959[_0xefa4('0x2b')][_0xefa4('0x3b')]){_0x495944['include']=[{'all':!![]}];}return db[_0xefa4('0x27')]['findAll'](_0x495944);})['then'](function(_0x14e9bd){_0x24d9ed[_0xefa4('0x3c')]=_0x14e9bd;return _0x24d9ed;})[_0xefa4('0x1f')](respondWithFilteredResult(_0x4fe622,_0x495944))[_0xefa4('0x3d')](handleError(_0x4fe622,null));};exports[_0xefa4('0x3e')]=function(_0x48d894,_0x5cb79e){var _0x4a31ac={'raw':!![],'where':{'id':_0x48d894['params']['id']}},_0x4742a4={};_0x4742a4['model']=_[_0xefa4('0x3f')](db[_0xefa4('0x27')][_0xefa4('0x28')]);_0x4742a4[_0xefa4('0x2b')]=_['keys'](_0x48d894[_0xefa4('0x2b')]);_0x4742a4['filters']=_['intersection'](_0x4742a4[_0xefa4('0x2a')],_0x4742a4['query']);_0x4a31ac[_0xefa4('0x2d')]=_[_0xefa4('0x2c')](_0x4742a4['model'],qs[_0xefa4('0x2e')](_0x48d894['query'][_0xefa4('0x2e')]));_0x4a31ac['attributes']=_0x4a31ac['attributes']['length']?_0x4a31ac[_0xefa4('0x2d')]:_0x4742a4[_0xefa4('0x2a')];if(_0x48d894[_0xefa4('0x2b')][_0xefa4('0x3b')]){_0x4a31ac[_0xefa4('0x40')]=[{'all':!![]}];}_0x4a31ac=_[_0xefa4('0x37')]({},_0x4a31ac,_0x48d894[_0xefa4('0x39')]);return db[_0xefa4('0x27')][_0xefa4('0x41')](_0x4a31ac)[_0xefa4('0x1f')](handleEntityNotFound(_0x5cb79e,null))['then'](respondWithResult(_0x5cb79e,null))[_0xefa4('0x3d')](handleError(_0x5cb79e,null));};exports[_0xefa4('0x42')]=function(_0x3343b8,_0x26a652){return db[_0xefa4('0x27')]['create'](_0x3343b8[_0xefa4('0x43')],{})[_0xefa4('0x1f')](function(_0x402d2b){var _0x32716e=_0x3343b8[_0xefa4('0x44')][_0xefa4('0x45')]({'plain':!![]});if(!_0x32716e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x32716e[_0xefa4('0x46')]===_0xefa4('0x44')){var _0x573025=_0x402d2b[_0xefa4('0x45')]({'plain':!![]});var _0x144519=_0xefa4('0x47');return db[_0xefa4('0x48')][_0xefa4('0x41')]({'where':{'name':_0x144519,'userProfileId':_0x32716e[_0xefa4('0x49')]},'raw':!![]})[_0xefa4('0x1f')](function(_0x1b0db8){if(_0x1b0db8&&_0x1b0db8[_0xefa4('0x4a')]===0x0){return db['UserProfileResource']['create']({'name':_0x573025[_0xefa4('0x24')],'resourceId':_0x573025['id'],'type':_0x1b0db8[_0xefa4('0x24')],'sectionId':_0x1b0db8['id']},{})[_0xefa4('0x1f')](function(){return _0x402d2b;});}else{return _0x402d2b;}})['catch'](function(_0x154cde){logger['error'](_0xefa4('0x4b'),_0x154cde);throw _0x154cde;});}return _0x402d2b;})['then'](respondWithResult(_0x26a652,0xc9))[_0xefa4('0x3d')](handleError(_0x26a652,null));};exports[_0xefa4('0x1e')]=function(_0x461e30,_0x24a79e){if(_0x461e30[_0xefa4('0x43')]['id']){delete _0x461e30['body']['id'];}return db[_0xefa4('0x27')][_0xefa4('0x41')]({'where':{'id':_0x461e30[_0xefa4('0x4c')]['id']}})[_0xefa4('0x1f')](handleEntityNotFound(_0x24a79e,null))[_0xefa4('0x1f')](saveUpdates(_0x461e30[_0xefa4('0x43')],null))[_0xefa4('0x1f')](respondWithResult(_0x24a79e,null))[_0xefa4('0x3d')](handleError(_0x24a79e,null));};exports[_0xefa4('0x20')]=function(_0x4aa7a5,_0x37b679){return db[_0xefa4('0x27')][_0xefa4('0x41')]({'where':{'id':_0x4aa7a5['params']['id']}})[_0xefa4('0x1f')](handleEntityNotFound(_0x37b679,null))[_0xefa4('0x1f')](removeEntity(_0x37b679,null))[_0xefa4('0x3d')](handleError(_0x37b679,null));};exports['test']=function(_0x2e1891,_0x418568,_0x242e20){var _0x480303;return db[_0xefa4('0x27')][_0xefa4('0x41')]({'where':{'id':_0x2e1891[_0xefa4('0x4c')]['id']},'attributes':['id',_0xefa4('0x4d')]})[_0xefa4('0x1f')](handleEntityNotFound(_0x418568,null))['then'](function(_0x2e5fe0){if(_0x2e5fe0){var _0x162bd5=require('odbc')();_0x162bd5['openSync'](_0x2e5fe0['dsn']);_0x162bd5[_0xefa4('0x4e')]();return _0x2e5fe0;}})[_0xefa4('0x1f')](respondWithResult(_0x418568,null))['catch'](handleError(_0x418568,null));}; \ No newline at end of file +var _0x4fe6=['keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','find','create','body','user','get','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','dsn','odbc','closeSync','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','ODBC','sendStatus','error','stack','name','map','SquareOdbc','rawAttributes','fieldName','type','key','query'];(function(_0x17e75b,_0x4fb952){var _0x3ce6e2=function(_0x58af4d){while(--_0x58af4d){_0x17e75b['push'](_0x17e75b['shift']());}};_0x3ce6e2(++_0x4fb952);}(_0x4fe6,0x1b7));var _0x64fe=function(_0x25f628,_0x2647ea){_0x25f628=_0x25f628-0x0;var _0xe02755=_0x4fe6[_0x25f628];return _0xe02755;};'use strict';var pdf=require(_0x64fe('0x0'));var emlformat=require(_0x64fe('0x1'));var rimraf=require(_0x64fe('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x64fe('0x3'));var moment=require(_0x64fe('0x4'));var BPromise=require(_0x64fe('0x5'));var Mustache=require(_0x64fe('0x6'));var util=require('util');var path=require(_0x64fe('0x7'));var sox=require(_0x64fe('0x8'));var csv=require('to-csv');var ejs=require(_0x64fe('0x9'));var fs=require('fs');var _=require(_0x64fe('0xa'));var squel=require('squel');var crypto=require(_0x64fe('0xb'));var jsforce=require(_0x64fe('0xc'));var deskjs=require(_0x64fe('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x64fe('0xe'));var Redis=require(_0x64fe('0xf'));var authService=require(_0x64fe('0x10'));var qs=require(_0x64fe('0x11'));var as=require(_0x64fe('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x64fe('0x13'));var utils=require('../../config/utils');var config=require(_0x64fe('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5676a2,_0x5b89e8){_0x5b89e8=_0x5b89e8||0xcc;return function(_0x2c7bf2){if(_0x2c7bf2){return _0x5676a2['sendStatus'](_0x5b89e8);}return _0x5676a2[_0x64fe('0x15')](_0x5b89e8)[_0x64fe('0x16')]();};}function respondWithResult(_0x27231c,_0x55a892){_0x55a892=_0x55a892||0xc8;return function(_0x61bb7b){if(_0x61bb7b){return _0x27231c[_0x64fe('0x15')](_0x55a892)[_0x64fe('0x17')](_0x61bb7b);}};}function respondWithFilteredResult(_0x41bdc8,_0x5b1605){return function(_0x5ad249){if(_0x5ad249){var _0x4b048e=_0x5ad249[_0x64fe('0x18')],_0x1d321b=_0x5b1605[_0x64fe('0x19')],_0x456cfd=_0x5b1605['offset']+_0x5b1605[_0x64fe('0x1a')],_0x25619a;if(_0x456cfd>=_0x4b048e){_0x456cfd=_0x4b048e;_0x25619a=0xc8;}else{_0x25619a=0xce;}_0x41bdc8['status'](_0x25619a);return _0x41bdc8[_0x64fe('0x1b')](_0x64fe('0x1c'),_0x1d321b+'-'+_0x456cfd+'/'+_0x4b048e)[_0x64fe('0x17')](_0x5ad249);}return null;};}function patchUpdates(_0x3df43c){return function(_0x158509){try{jsonpatch[_0x64fe('0x1d')](_0x158509,_0x3df43c,!![]);}catch(_0x30bf15){return BPromise[_0x64fe('0x1e')](_0x30bf15);}return _0x158509[_0x64fe('0x1f')]();};}function saveUpdates(_0x38cc26,_0x33416c){return function(_0x434b5d){if(_0x434b5d){return _0x434b5d[_0x64fe('0x20')](_0x38cc26)[_0x64fe('0x21')](function(_0x55f1e1){return _0x55f1e1;});}return null;};}function removeEntity(_0x3c674c,_0x1f6f9a){return function(_0x2ebd09){if(_0x2ebd09){return _0x2ebd09[_0x64fe('0x22')]()[_0x64fe('0x21')](function(){var _0x2431e1=_0x2ebd09['get']({'plain':!![]});var _0x7889ed=_0x64fe('0x23');return db['UserProfileResource'][_0x64fe('0x22')]({'where':{'type':_0x7889ed,'resourceId':_0x2431e1['id']}})[_0x64fe('0x21')](function(){return _0x2ebd09;});})[_0x64fe('0x21')](function(){_0x3c674c[_0x64fe('0x15')](0xcc)[_0x64fe('0x16')]();});}};}function handleEntityNotFound(_0x1d2611,_0xe591d1){return function(_0x1e7ac2){if(!_0x1e7ac2){_0x1d2611[_0x64fe('0x24')](0x194);}return _0x1e7ac2;};}function handleError(_0x4ea551,_0x1e9306){_0x1e9306=_0x1e9306||0x1f4;return function(_0x4ab586){logger[_0x64fe('0x25')](_0x4ab586[_0x64fe('0x26')]);if(_0x4ab586[_0x64fe('0x27')]){delete _0x4ab586['name'];}_0x4ea551['status'](_0x1e9306)['send'](_0x4ab586);};}exports['index']=function(_0x51f322,_0x339535){var _0x4efdbe={},_0x1cabcf={},_0x3d5d43={'count':0x0,'rows':[]};var _0x312514=_[_0x64fe('0x28')](db[_0x64fe('0x29')][_0x64fe('0x2a')],function(_0x228ad0){return{'name':_0x228ad0[_0x64fe('0x2b')],'type':_0x228ad0[_0x64fe('0x2c')][_0x64fe('0x2d')]};});_0x1cabcf['model']=_[_0x64fe('0x28')](_0x312514,_0x64fe('0x27'));_0x1cabcf[_0x64fe('0x2e')]=_[_0x64fe('0x2f')](_0x51f322[_0x64fe('0x2e')]);_0x1cabcf[_0x64fe('0x30')]=_[_0x64fe('0x31')](_0x1cabcf[_0x64fe('0x32')],_0x1cabcf[_0x64fe('0x2e')]);_0x4efdbe[_0x64fe('0x33')]=_[_0x64fe('0x31')](_0x1cabcf[_0x64fe('0x32')],qs[_0x64fe('0x34')](_0x51f322[_0x64fe('0x2e')][_0x64fe('0x34')]));_0x4efdbe[_0x64fe('0x33')]=_0x4efdbe[_0x64fe('0x33')][_0x64fe('0x35')]?_0x4efdbe[_0x64fe('0x33')]:_0x1cabcf[_0x64fe('0x32')];if(!_0x51f322[_0x64fe('0x2e')][_0x64fe('0x36')](_0x64fe('0x37'))){_0x4efdbe[_0x64fe('0x1a')]=qs[_0x64fe('0x1a')](_0x51f322[_0x64fe('0x2e')][_0x64fe('0x1a')]);_0x4efdbe[_0x64fe('0x19')]=qs[_0x64fe('0x19')](_0x51f322[_0x64fe('0x2e')][_0x64fe('0x19')]);}_0x4efdbe[_0x64fe('0x38')]=qs[_0x64fe('0x39')](_0x51f322['query'][_0x64fe('0x39')]);_0x4efdbe[_0x64fe('0x3a')]=qs[_0x64fe('0x30')](_[_0x64fe('0x3b')](_0x51f322['query'],_0x1cabcf[_0x64fe('0x30')]));if(_0x51f322[_0x64fe('0x2e')]['filter']){_0x4efdbe[_0x64fe('0x3a')]=_[_0x64fe('0x3c')](_0x4efdbe[_0x64fe('0x3a')],{'$or':_[_0x64fe('0x28')](_0x312514,function(_0x1a7878){if(_0x1a7878['type']!==_0x64fe('0x3d')){var _0x40bed4={};_0x40bed4[_0x1a7878['name']]={'$like':'%'+_0x51f322[_0x64fe('0x2e')][_0x64fe('0x3e')]+'%'};return _0x40bed4;}})});}_0x4efdbe=_['merge']({},_0x4efdbe,_0x51f322[_0x64fe('0x3f')]);var _0x9b3c3e={'where':_0x4efdbe['where']};return db[_0x64fe('0x29')][_0x64fe('0x18')](_0x9b3c3e)[_0x64fe('0x21')](function(_0xf53c39){_0x3d5d43[_0x64fe('0x18')]=_0xf53c39;if(_0x51f322['query'][_0x64fe('0x40')]){_0x4efdbe[_0x64fe('0x41')]=[{'all':!![]}];}return db[_0x64fe('0x29')][_0x64fe('0x42')](_0x4efdbe);})['then'](function(_0x1020c1){_0x3d5d43[_0x64fe('0x43')]=_0x1020c1;return _0x3d5d43;})['then'](respondWithFilteredResult(_0x339535,_0x4efdbe))[_0x64fe('0x44')](handleError(_0x339535,null));};exports['show']=function(_0x12d6a6,_0x3ac31e){var _0xfb1933={'raw':!![],'where':{'id':_0x12d6a6['params']['id']}},_0x294c15={};_0x294c15['model']=_['keys'](db[_0x64fe('0x29')][_0x64fe('0x2a')]);_0x294c15['query']=_[_0x64fe('0x2f')](_0x12d6a6['query']);_0x294c15[_0x64fe('0x30')]=_[_0x64fe('0x31')](_0x294c15[_0x64fe('0x32')],_0x294c15[_0x64fe('0x2e')]);_0xfb1933[_0x64fe('0x33')]=_[_0x64fe('0x31')](_0x294c15['model'],qs['fields'](_0x12d6a6[_0x64fe('0x2e')][_0x64fe('0x34')]));_0xfb1933[_0x64fe('0x33')]=_0xfb1933['attributes'][_0x64fe('0x35')]?_0xfb1933[_0x64fe('0x33')]:_0x294c15[_0x64fe('0x32')];if(_0x12d6a6[_0x64fe('0x2e')][_0x64fe('0x40')]){_0xfb1933[_0x64fe('0x41')]=[{'all':!![]}];}_0xfb1933=_[_0x64fe('0x3c')]({},_0xfb1933,_0x12d6a6[_0x64fe('0x3f')]);return db[_0x64fe('0x29')][_0x64fe('0x45')](_0xfb1933)[_0x64fe('0x21')](handleEntityNotFound(_0x3ac31e,null))['then'](respondWithResult(_0x3ac31e,null))['catch'](handleError(_0x3ac31e,null));};exports[_0x64fe('0x46')]=function(_0x243491,_0x481026){return db[_0x64fe('0x29')][_0x64fe('0x46')](_0x243491[_0x64fe('0x47')],{})[_0x64fe('0x21')](function(_0x595bbf){var _0x25a857=_0x243491[_0x64fe('0x48')][_0x64fe('0x49')]({'plain':!![]});if(!_0x25a857)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x25a857[_0x64fe('0x4a')]===_0x64fe('0x48')){var _0x276aa1=_0x595bbf[_0x64fe('0x49')]({'plain':!![]});var _0x29051c=_0x64fe('0x23');return db[_0x64fe('0x4b')][_0x64fe('0x45')]({'where':{'name':_0x29051c,'userProfileId':_0x25a857['userProfileId']},'raw':!![]})[_0x64fe('0x21')](function(_0x12cc64){if(_0x12cc64&&_0x12cc64['autoAssociation']===0x0){return db['UserProfileResource'][_0x64fe('0x46')]({'name':_0x276aa1['name'],'resourceId':_0x276aa1['id'],'type':_0x12cc64['name'],'sectionId':_0x12cc64['id']},{})[_0x64fe('0x21')](function(){return _0x595bbf;});}else{return _0x595bbf;}})[_0x64fe('0x44')](function(_0xaeb881){logger[_0x64fe('0x25')](_0x64fe('0x4c'),_0xaeb881);throw _0xaeb881;});}return _0x595bbf;})['then'](respondWithResult(_0x481026,0xc9))[_0x64fe('0x44')](handleError(_0x481026,null));};exports[_0x64fe('0x20')]=function(_0x9e10e0,_0x51035c){if(_0x9e10e0[_0x64fe('0x47')]['id']){delete _0x9e10e0['body']['id'];}return db[_0x64fe('0x29')][_0x64fe('0x45')]({'where':{'id':_0x9e10e0[_0x64fe('0x4d')]['id']}})[_0x64fe('0x21')](handleEntityNotFound(_0x51035c,null))[_0x64fe('0x21')](saveUpdates(_0x9e10e0[_0x64fe('0x47')],null))[_0x64fe('0x21')](respondWithResult(_0x51035c,null))[_0x64fe('0x44')](handleError(_0x51035c,null));};exports['destroy']=function(_0x5d4b2e,_0x367f04){return db['SquareOdbc'][_0x64fe('0x45')]({'where':{'id':_0x5d4b2e['params']['id']}})[_0x64fe('0x21')](handleEntityNotFound(_0x367f04,null))['then'](removeEntity(_0x367f04,null))['catch'](handleError(_0x367f04,null));};exports['test']=function(_0x5360e8,_0x28768c,_0x11848d){var _0x33974f;return db[_0x64fe('0x29')][_0x64fe('0x45')]({'where':{'id':_0x5360e8[_0x64fe('0x4d')]['id']},'attributes':['id',_0x64fe('0x4e')]})[_0x64fe('0x21')](handleEntityNotFound(_0x28768c,null))[_0x64fe('0x21')](function(_0x271695){if(_0x271695){var _0x4d8913=require(_0x64fe('0x4f'))();_0x4d8913['openSync'](_0x271695[_0x64fe('0x4e')]);_0x4d8913[_0x64fe('0x50')]();return _0x271695;}})[_0x64fe('0x21')](respondWithResult(_0x28768c,null))['catch'](handleError(_0x28768c,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index 9af6e46..b5ef97e 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 _0xf3ec=['./squareOdbc.attributes','define','square_odbc','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x5d983c,_0x57b322){var _0x45d2f8=function(_0x4fb48d){while(--_0x4fb48d){_0x5d983c['push'](_0x5d983c['shift']());}};_0x45d2f8(++_0x57b322);}(_0xf3ec,0xbe));var _0xcf3e=function(_0x16ed83,_0x57a007){_0x16ed83=_0x16ed83-0x0;var _0x4325e9=_0xf3ec[_0x16ed83];return _0x4325e9;};'use strict';var _=require(_0xcf3e('0x0'));var util=require(_0xcf3e('0x1'));var logger=require(_0xcf3e('0x2'))(_0xcf3e('0x3'));var moment=require(_0xcf3e('0x4'));var BPromise=require(_0xcf3e('0x5'));var rp=require(_0xcf3e('0x6'));var fs=require('fs');var path=require(_0xcf3e('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xcf3e('0x8'));module['exports']=function(_0x5b38a5,_0x32c5aa){return _0x5b38a5[_0xcf3e('0x9')]('SquareOdbc',attributes,{'tableName':_0xcf3e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcaff=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareOdbc.attributes','exports','define','SquareOdbc','square_odbc'];(function(_0x903228,_0x42c429){var _0xcec81d=function(_0x4da97a){while(--_0x4da97a){_0x903228['push'](_0x903228['shift']());}};_0xcec81d(++_0x42c429);}(_0xcaff,0x96));var _0xfcaf=function(_0x1e7a66,_0x3a0024){_0x1e7a66=_0x1e7a66-0x0;var _0x47df89=_0xcaff[_0x1e7a66];return _0x47df89;};'use strict';var _=require(_0xfcaf('0x0'));var util=require(_0xfcaf('0x1'));var logger=require(_0xfcaf('0x2'))(_0xfcaf('0x3'));var moment=require(_0xfcaf('0x4'));var BPromise=require(_0xfcaf('0x5'));var rp=require(_0xfcaf('0x6'));var fs=require('fs');var path=require(_0xfcaf('0x7'));var rimraf=require(_0xfcaf('0x8'));var config=require(_0xfcaf('0x9'));var attributes=require(_0xfcaf('0xa'));module[_0xfcaf('0xb')]=function(_0x4b1040,_0x31062b){return _0x4b1040[_0xfcaf('0xc')](_0xfcaf('0xd'),attributes,{'tableName':_0xfcaf('0xe'),'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 e5ce6db..b6266f6 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 _0x008c=['stringify','ShowSquareOdbc','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','SquareOdbc,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','SquareOdbc,\x20%s,\x20%s','message','catch','find','options','include','map','attributes','model','then'];(function(_0x2c961d,_0x106e3a){var _0xb29a42=function(_0xc899d8){while(--_0xc899d8){_0x2c961d['push'](_0x2c961d['shift']());}};_0xb29a42(++_0x106e3a);}(_0x008c,0x188));var _0xc008=function(_0x6171c0,_0x127af3){_0x6171c0=_0x6171c0-0x0;var _0x227390=_0x008c[_0x6171c0];return _0x227390;};'use strict';var _=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var moment=require(_0xc008('0x2'));var BPromise=require(_0xc008('0x3'));var rs=require(_0xc008('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc008('0x5'))['db'];var utils=require(_0xc008('0x6'));var logger=require(_0xc008('0x7'))(_0xc008('0x8'));var config=require(_0xc008('0x9'));var jayson=require(_0xc008('0xa'));var client=jayson[_0xc008('0xb')][_0xc008('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x9c8cb2,_0x4af530,_0x428fa9){return new BPromise(function(_0x5aa09b,_0x30be38){return client['request'](_0x9c8cb2,_0x428fa9)['then'](function(_0x27830d){logger[_0xc008('0xd')]('SquareOdbc,\x20%s,\x20%s',_0x4af530,'request\x20sent');logger['debug'](_0xc008('0xe'),_0x4af530,_0xc008('0xf'),JSON['stringify'](_0x27830d));if(_0x27830d[_0xc008('0x10')]){if(_0x27830d[_0xc008('0x10')][_0xc008('0x11')]===0x1f4){logger[_0xc008('0x10')](_0xc008('0x12'),_0x4af530,_0x27830d[_0xc008('0x10')][_0xc008('0x13')]);return _0x30be38(_0x27830d['error']['message']);}logger[_0xc008('0x10')]('SquareOdbc,\x20%s,\x20%s',_0x4af530,_0x27830d[_0xc008('0x10')][_0xc008('0x13')]);return _0x5aa09b(_0x27830d[_0xc008('0x10')][_0xc008('0x13')]);}else{logger[_0xc008('0xd')]('SquareOdbc,\x20%s,\x20%s',_0x4af530,'request\x20sent');_0x5aa09b(_0x27830d['result'][_0xc008('0x13')]);}})[_0xc008('0x14')](function(_0x3cafe3){logger[_0xc008('0x10')]('SquareOdbc,\x20%s,\x20%s',_0x4af530,_0x3cafe3);_0x30be38(_0x3cafe3);});});}exports['ShowSquareOdbc']=function(_0x540e45){var _0x5c2668=this;return new Promise(function(_0x46042b,_0x462af5){return db['SquareOdbc'][_0xc008('0x15')]({'raw':_0x540e45['options']?_0x540e45['options']['raw']===undefined?!![]:![]:!![],'where':_0x540e45['options']?_0x540e45[_0xc008('0x16')]['where']||null:null,'attributes':_0x540e45['options']?_0x540e45['options']['attributes']||null:null,'include':_0x540e45['options']?_0x540e45[_0xc008('0x16')][_0xc008('0x17')]?_[_0xc008('0x18')](_0x540e45[_0xc008('0x16')][_0xc008('0x17')],function(_0x110128){return{'model':db[_0x110128['model']],'as':_0x110128['as'],'attributes':_0x110128[_0xc008('0x19')],'include':_0x110128['include']?_['map'](_0x110128[_0xc008('0x17')],function(_0x36f358){return{'model':db[_0x36f358[_0xc008('0x1a')]],'as':_0x36f358['as'],'attributes':_0x36f358[_0xc008('0x19')],'include':_0x36f358['include']?_['map'](_0x36f358['include'],function(_0x3f7b07){return{'model':db[_0x3f7b07[_0xc008('0x1a')]],'as':_0x3f7b07['as'],'attributes':_0x3f7b07[_0xc008('0x19')]};}):[]};}):[]};}):[]:[]})[_0xc008('0x1b')](function(_0x5bebd9){logger['info']('ShowSquareOdbc',_0x540e45);logger['debug']('ShowSquareOdbc',_0x540e45,JSON[_0xc008('0x1c')](_0x5bebd9));_0x46042b(_0x5bebd9);})[_0xc008('0x14')](function(_0x25eae4){logger['error'](_0xc008('0x1d'),_0x25eae4[_0xc008('0x13')],_0x540e45);_0x462af5(_0x5c2668[_0xc008('0x10')](0x1f4,_0x25eae4[_0xc008('0x13')]));});});}; \ No newline at end of file +var _0xe14b=['ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','then','info','SquareOdbc,\x20%s,\x20%s','SquareOdbc,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','ShowSquareOdbc','SquareOdbc','find','options','raw','where','attributes','map','include','model','stringify','lodash','util','randomstring'];(function(_0x2d638f,_0x828e1e){var _0x5a59ed=function(_0x4bb1af){while(--_0x4bb1af){_0x2d638f['push'](_0x2d638f['shift']());}};_0x5a59ed(++_0x828e1e);}(_0xe14b,0x93));var _0xbe14=function(_0x200c3b,_0x31b915){_0x200c3b=_0x200c3b-0x0;var _0x34b821=_0xe14b[_0x200c3b];return _0x34b821;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xbe14('0x2'));var fs=require('fs');var Redis=require(_0xbe14('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xbe14('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xbe14('0x5'));var jayson=require(_0xbe14('0x6'));var client=jayson[_0xbe14('0x7')][_0xbe14('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1d9ade,_0x39387e,_0x196fca){return new BPromise(function(_0x566ae7,_0x50f909){return client['request'](_0x1d9ade,_0x196fca)[_0xbe14('0x9')](function(_0x6fceff){logger[_0xbe14('0xa')](_0xbe14('0xb'),_0x39387e,'request\x20sent');logger['debug'](_0xbe14('0xc'),_0x39387e,_0xbe14('0xd'),JSON['stringify'](_0x6fceff));if(_0x6fceff[_0xbe14('0xe')]){if(_0x6fceff[_0xbe14('0xe')][_0xbe14('0xf')]===0x1f4){logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);return _0x50f909(_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);}logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);return _0x566ae7(_0x6fceff['error']['message']);}else{logger[_0xbe14('0xa')](_0xbe14('0xb'),_0x39387e,_0xbe14('0xd'));_0x566ae7(_0x6fceff[_0xbe14('0x11')]['message']);}})[_0xbe14('0x12')](function(_0xe9c3ec){logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0xe9c3ec);_0x50f909(_0xe9c3ec);});});}exports[_0xbe14('0x13')]=function(_0x29ab73){var _0x17ae86=this;return new Promise(function(_0x5ea1f8,_0x137ee5){return db[_0xbe14('0x14')][_0xbe14('0x15')]({'raw':_0x29ab73[_0xbe14('0x16')]?_0x29ab73[_0xbe14('0x16')][_0xbe14('0x17')]===undefined?!![]:![]:!![],'where':_0x29ab73['options']?_0x29ab73[_0xbe14('0x16')][_0xbe14('0x18')]||null:null,'attributes':_0x29ab73[_0xbe14('0x16')]?_0x29ab73[_0xbe14('0x16')][_0xbe14('0x19')]||null:null,'include':_0x29ab73['options']?_0x29ab73[_0xbe14('0x16')]['include']?_[_0xbe14('0x1a')](_0x29ab73['options'][_0xbe14('0x1b')],function(_0x4a25fa){return{'model':db[_0x4a25fa[_0xbe14('0x1c')]],'as':_0x4a25fa['as'],'attributes':_0x4a25fa[_0xbe14('0x19')],'include':_0x4a25fa['include']?_[_0xbe14('0x1a')](_0x4a25fa['include'],function(_0x4587a8){return{'model':db[_0x4587a8['model']],'as':_0x4587a8['as'],'attributes':_0x4587a8[_0xbe14('0x19')],'include':_0x4587a8[_0xbe14('0x1b')]?_[_0xbe14('0x1a')](_0x4587a8[_0xbe14('0x1b')],function(_0x15ef02){return{'model':db[_0x15ef02[_0xbe14('0x1c')]],'as':_0x15ef02['as'],'attributes':_0x15ef02['attributes']};}):[]};}):[]};}):[]:[]})[_0xbe14('0x9')](function(_0x1ba46a){logger[_0xbe14('0xa')](_0xbe14('0x13'),_0x29ab73);logger['debug'](_0xbe14('0x13'),_0x29ab73,JSON[_0xbe14('0x1d')](_0x1ba46a));_0x5ea1f8(_0x1ba46a);})['catch'](function(_0x3c3613){logger[_0xbe14('0xe')](_0xbe14('0x13'),_0x3c3613[_0xbe14('0x10')],_0x29ab73);_0x137ee5(_0x17ae86[_0xbe14('0xe')](0x1f4,_0x3c3613[_0xbe14('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index 9742199..eaf7d94 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 _0xb78e=['removeUsers','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareProject.controller','get','index','/:id','isAuthenticated','show','/:id/users','getUsers','post','create','addUsers','put','update','delete','destroy'];(function(_0x37a8ee,_0x87e41c){var _0x1f6588=function(_0x586d4d){while(--_0x586d4d){_0x37a8ee['push'](_0x37a8ee['shift']());}};_0x1f6588(++_0x87e41c);}(_0xb78e,0x1c9));var _0xeb78=function(_0x4b64fe,_0x71b2a4){_0x4b64fe=_0x4b64fe-0x0;var _0x288459=_0xb78e[_0x4b64fe];return _0x288459;};'use strict';var multer=require(_0xeb78('0x0'));var util=require(_0xeb78('0x1'));var path=require('path');var timeout=require(_0xeb78('0x2'));var express=require(_0xeb78('0x3'));var router=express[_0xeb78('0x4')]();var auth=require(_0xeb78('0x5'));var interaction=require(_0xeb78('0x6'));var config=require(_0xeb78('0x7'));var controller=require(_0xeb78('0x8'));router[_0xeb78('0x9')]('/',auth['isAuthenticated'](),controller[_0xeb78('0xa')]);router[_0xeb78('0x9')](_0xeb78('0xb'),auth[_0xeb78('0xc')](),controller[_0xeb78('0xd')]);router[_0xeb78('0x9')](_0xeb78('0xe'),auth['isAuthenticated'](),controller[_0xeb78('0xf')]);router[_0xeb78('0x10')]('/',auth[_0xeb78('0xc')](),controller[_0xeb78('0x11')]);router[_0xeb78('0x10')](_0xeb78('0xe'),auth[_0xeb78('0xc')](),controller[_0xeb78('0x12')]);router[_0xeb78('0x13')]('/:id',auth[_0xeb78('0xc')](),controller[_0xeb78('0x14')]);router[_0xeb78('0x15')](_0xeb78('0xb'),auth[_0xeb78('0xc')](),controller[_0xeb78('0x16')]);router[_0xeb78('0x15')](_0xeb78('0xe'),auth[_0xeb78('0xc')](),controller[_0xeb78('0x17')]);module['exports']=router; \ No newline at end of file +var _0x6cb4=['get','index','/:id','isAuthenticated','show','/:id/users','post','addUsers','put','delete','destroy','removeUsers','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x2cbc19,_0xbc7a7c){var _0x56f661=function(_0x52eb17){while(--_0x52eb17){_0x2cbc19['push'](_0x2cbc19['shift']());}};_0x56f661(++_0xbc7a7c);}(_0x6cb4,0xff));var _0x46cb=function(_0x2a7dfd,_0x21852d){_0x2a7dfd=_0x2a7dfd-0x0;var _0x5b3e2a=_0x6cb4[_0x2a7dfd];return _0x5b3e2a;};'use strict';var multer=require(_0x46cb('0x0'));var util=require(_0x46cb('0x1'));var path=require(_0x46cb('0x2'));var timeout=require(_0x46cb('0x3'));var express=require(_0x46cb('0x4'));var router=express[_0x46cb('0x5')]();var auth=require(_0x46cb('0x6'));var interaction=require(_0x46cb('0x7'));var config=require(_0x46cb('0x8'));var controller=require('./squareProject.controller');router[_0x46cb('0x9')]('/',auth['isAuthenticated'](),controller[_0x46cb('0xa')]);router['get'](_0x46cb('0xb'),auth[_0x46cb('0xc')](),controller[_0x46cb('0xd')]);router[_0x46cb('0x9')](_0x46cb('0xe'),auth[_0x46cb('0xc')](),controller['getUsers']);router[_0x46cb('0xf')]('/',auth[_0x46cb('0xc')](),controller['create']);router[_0x46cb('0xf')](_0x46cb('0xe'),auth['isAuthenticated'](),controller[_0x46cb('0x10')]);router[_0x46cb('0x11')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x46cb('0x12')](_0x46cb('0xb'),auth[_0x46cb('0xc')](),controller[_0x46cb('0x13')]);router['delete'](_0x46cb('0xe'),auth[_0x46cb('0xc')](),controller[_0x46cb('0x14')]);module[_0x46cb('0x15')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index 39fda8e..62a3d8f 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 _0x7a0c=['BLOB','long','getDataValue','preproduction','toString','utf8','production','exports','STRING','name','TEXT'];(function(_0x5e732f,_0x4f3add){var _0x263923=function(_0x325b49){while(--_0x325b49){_0x5e732f['push'](_0x5e732f['shift']());}};_0x263923(++_0x4f3add);}(_0x7a0c,0x1b4));var _0xc7a0=function(_0x163f43,_0x323076){_0x163f43=_0x163f43-0x0;var _0x4449eb=_0x7a0c[_0x163f43];return _0x4449eb;};'use strict';var Sequelize=require('sequelize');module[_0xc7a0('0x0')]={'name':{'type':Sequelize[_0xc7a0('0x1')],'unique':_0xc7a0('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0xc7a0('0x1')]},'notes':{'type':Sequelize[_0xc7a0('0x3')]},'preproduction':{'type':Sequelize[_0xc7a0('0x4')](_0xc7a0('0x5')),'get':function(){if(this[_0xc7a0('0x6')](_0xc7a0('0x7'))){return this[_0xc7a0('0x6')](_0xc7a0('0x7'))[_0xc7a0('0x8')](_0xc7a0('0x9'));}}},'production':{'type':Sequelize[_0xc7a0('0x4')](_0xc7a0('0x5')),'get':function(){if(this[_0xc7a0('0x6')](_0xc7a0('0xa'))){return this[_0xc7a0('0x6')](_0xc7a0('0xa'))[_0xc7a0('0x8')](_0xc7a0('0x9'));}}}}; \ No newline at end of file +var _0x4678=['utf8','production','sequelize','exports','STRING','name','TEXT','long','getDataValue','preproduction','toString'];(function(_0x54c8be,_0x553317){var _0x2a6285=function(_0x660d4f){while(--_0x660d4f){_0x54c8be['push'](_0x54c8be['shift']());}};_0x2a6285(++_0x553317);}(_0x4678,0x1a4));var _0x8467=function(_0x41b0dc,_0x4b0337){_0x41b0dc=_0x41b0dc-0x0;var _0x323d7f=_0x4678[_0x41b0dc];return _0x323d7f;};'use strict';var Sequelize=require(_0x8467('0x0'));module[_0x8467('0x1')]={'name':{'type':Sequelize[_0x8467('0x2')],'unique':_0x8467('0x3'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'notes':{'type':Sequelize[_0x8467('0x4')]},'preproduction':{'type':Sequelize['BLOB'](_0x8467('0x5')),'get':function(){if(this[_0x8467('0x6')]('preproduction')){return this[_0x8467('0x6')](_0x8467('0x7'))[_0x8467('0x8')](_0x8467('0x9'));}}},'production':{'type':Sequelize['BLOB'](_0x8467('0x5')),'get':function(){if(this['getDataValue']('production')){return this['getDataValue'](_0x8467('0xa'))[_0x8467('0x8')]('utf8');}}}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index fc13906..27512a6 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 _0xb49a=['Content-Range','apply','then','SquareProjects','error','name','index','map','rawAttributes','fieldName','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','where','merge','type','VIRTUAL','options','count','includeAll','include','SquareProject','findAll','rows','show','params','find','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','destroy','addUsers','ids','omit','removeUsers','isArray','emit','userSquareProject:remove','findOne','getUsers','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register','sendStatus','status','end','json','offset','limit','set'];(function(_0x4cf369,_0x35f48d){var _0x567f95=function(_0x462605){while(--_0x462605){_0x4cf369['push'](_0x4cf369['shift']());}};_0x567f95(++_0x35f48d);}(_0xb49a,0xfb));var _0xab49=function(_0x8d5844,_0x48eb67){_0x8d5844=_0x8d5844-0x0;var _0x56726c=_0xb49a[_0x8d5844];return _0x56726c;};'use strict';var pdf=require(_0xab49('0x0'));var emlformat=require(_0xab49('0x1'));var rimraf=require(_0xab49('0x2'));var zipdir=require(_0xab49('0x3'));var jsonpatch=require(_0xab49('0x4'));var rp=require('request-promise');var moment=require(_0xab49('0x5'));var BPromise=require(_0xab49('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xab49('0x7'));var sox=require(_0xab49('0x8'));var csv=require(_0xab49('0x9'));var ejs=require(_0xab49('0xa'));var fs=require('fs');var _=require(_0xab49('0xb'));var squel=require(_0xab49('0xc'));var crypto=require(_0xab49('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xab49('0xe'));var toCsv=require(_0xab49('0x9'));var querystring=require(_0xab49('0xf'));var Papa=require(_0xab49('0x10'));var Redis=require(_0xab49('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xab49('0x12'));var hardwareService=require(_0xab49('0x13'));var logger=require(_0xab49('0x14'))(_0xab49('0x15'));var utils=require(_0xab49('0x16'));var config=require('../../config/environment');var db=require(_0xab49('0x17'))['db'];config[_0xab49('0x18')]=_[_0xab49('0x19')](config[_0xab49('0x18')],{'host':_0xab49('0x1a'),'port':0x18eb});var socket=require(_0xab49('0x1b'))(new Redis(config[_0xab49('0x18')]));require(_0xab49('0x1c'))[_0xab49('0x1d')](socket);function respondWithStatusCode(_0x389ebb,_0x40f465){_0x40f465=_0x40f465||0xcc;return function(_0x5ea744){if(_0x5ea744){return _0x389ebb[_0xab49('0x1e')](_0x40f465);}return _0x389ebb[_0xab49('0x1f')](_0x40f465)[_0xab49('0x20')]();};}function respondWithResult(_0x9c59e1,_0x14d8b8){_0x14d8b8=_0x14d8b8||0xc8;return function(_0x589dc4){if(_0x589dc4){return _0x9c59e1[_0xab49('0x1f')](_0x14d8b8)[_0xab49('0x21')](_0x589dc4);}};}function respondWithFilteredResult(_0x311de3,_0xcaa6ca){return function(_0x2bf1ce){if(_0x2bf1ce){var _0x47f977=_0x2bf1ce['count'],_0x167a2a=_0xcaa6ca['offset'],_0x24cb8f=_0xcaa6ca[_0xab49('0x22')]+_0xcaa6ca[_0xab49('0x23')],_0x28449b;if(_0x24cb8f>=_0x47f977){_0x24cb8f=_0x47f977;_0x28449b=0xc8;}else{_0x28449b=0xce;}_0x311de3['status'](_0x28449b);return _0x311de3[_0xab49('0x24')](_0xab49('0x25'),_0x167a2a+'-'+_0x24cb8f+'/'+_0x47f977)['json'](_0x2bf1ce);}return null;};}function patchUpdates(_0x3662b2){return function(_0x588707){try{jsonpatch[_0xab49('0x26')](_0x588707,_0x3662b2,!![]);}catch(_0x1aafa0){return BPromise['reject'](_0x1aafa0);}return _0x588707['save']();};}function saveUpdates(_0x333506,_0x4fa8d2){return function(_0x32a1d1){if(_0x32a1d1){return _0x32a1d1['update'](_0x333506)[_0xab49('0x27')](function(_0x2faeca){return _0x2faeca;});}return null;};}function removeEntity(_0x2ba18a,_0x579039){return function(_0x2bf8e0){if(_0x2bf8e0){return _0x2bf8e0['destroy']()[_0xab49('0x27')](function(){var _0xeb6d91=_0x2bf8e0['get']({'plain':!![]});var _0x29096f=_0xab49('0x28');return db['UserProfileResource']['destroy']({'where':{'type':_0x29096f,'resourceId':_0xeb6d91['id']}})[_0xab49('0x27')](function(){return _0x2bf8e0;});})[_0xab49('0x27')](function(){_0x2ba18a[_0xab49('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1b1fed,_0x237273){return function(_0x4bf0cf){if(!_0x4bf0cf){_0x1b1fed[_0xab49('0x1e')](0x194);}return _0x4bf0cf;};}function handleError(_0x169fd7,_0x342fdf){_0x342fdf=_0x342fdf||0x1f4;return function(_0x57fbad){logger[_0xab49('0x29')](_0x57fbad['stack']);if(_0x57fbad[_0xab49('0x2a')]){delete _0x57fbad['name'];}_0x169fd7[_0xab49('0x1f')](_0x342fdf)['send'](_0x57fbad);};}exports[_0xab49('0x2b')]=function(_0x24bd0f,_0x1c48ef){var _0x211be2={},_0x49f122={},_0x6e83f6={'count':0x0,'rows':[]};var _0x1ea20e=_[_0xab49('0x2c')](db['SquareProject'][_0xab49('0x2d')],function(_0x569569){return{'name':_0x569569[_0xab49('0x2e')],'type':_0x569569['type']['key']};});_0x49f122['model']=_[_0xab49('0x2c')](_0x1ea20e,'name');_0x49f122[_0xab49('0x2f')]=_[_0xab49('0x30')](_0x24bd0f[_0xab49('0x2f')]);_0x49f122['filters']=_[_0xab49('0x31')](_0x49f122[_0xab49('0x32')],_0x49f122[_0xab49('0x2f')]);_0x211be2[_0xab49('0x33')]=_[_0xab49('0x31')](_0x49f122['model'],qs[_0xab49('0x34')](_0x24bd0f[_0xab49('0x2f')]['fields']));_0x211be2['attributes']=_0x211be2[_0xab49('0x33')][_0xab49('0x35')]?_0x211be2[_0xab49('0x33')]:_0x49f122[_0xab49('0x32')];if(!_0x24bd0f[_0xab49('0x2f')][_0xab49('0x36')](_0xab49('0x37'))){_0x211be2[_0xab49('0x23')]=qs[_0xab49('0x23')](_0x24bd0f[_0xab49('0x2f')][_0xab49('0x23')]);_0x211be2[_0xab49('0x22')]=qs[_0xab49('0x22')](_0x24bd0f['query'][_0xab49('0x22')]);}_0x211be2[_0xab49('0x38')]=qs[_0xab49('0x39')](_0x24bd0f[_0xab49('0x2f')][_0xab49('0x39')]);_0x211be2['where']=qs[_0xab49('0x3a')](_['pick'](_0x24bd0f['query'],_0x49f122[_0xab49('0x3a')]));if(_0x24bd0f[_0xab49('0x2f')][_0xab49('0x3b')]){_0x211be2[_0xab49('0x3c')]=_[_0xab49('0x3d')](_0x211be2['where'],{'$or':_[_0xab49('0x2c')](_0x1ea20e,function(_0x2cdcbf){if(_0x2cdcbf[_0xab49('0x3e')]!==_0xab49('0x3f')){var _0x212041={};_0x212041[_0x2cdcbf['name']]={'$like':'%'+_0x24bd0f['query'][_0xab49('0x3b')]+'%'};return _0x212041;}})});}_0x211be2=_[_0xab49('0x3d')]({},_0x211be2,_0x24bd0f[_0xab49('0x40')]);var _0x538cb9={'where':_0x211be2[_0xab49('0x3c')]};return db['SquareProject']['count'](_0x538cb9)['then'](function(_0x5d24e2){_0x6e83f6[_0xab49('0x41')]=_0x5d24e2;if(_0x24bd0f[_0xab49('0x2f')][_0xab49('0x42')]){_0x211be2[_0xab49('0x43')]=[{'all':!![]}];}return db[_0xab49('0x44')][_0xab49('0x45')](_0x211be2);})[_0xab49('0x27')](function(_0x164838){_0x6e83f6[_0xab49('0x46')]=_0x164838;return _0x6e83f6;})[_0xab49('0x27')](respondWithFilteredResult(_0x1c48ef,_0x211be2))['catch'](handleError(_0x1c48ef,null));};exports[_0xab49('0x47')]=function(_0x1ea64d,_0x523dd2){var _0x20ecfb={'raw':![],'where':{'id':_0x1ea64d[_0xab49('0x48')]['id']}},_0x204ff3={};_0x204ff3[_0xab49('0x32')]=_[_0xab49('0x30')](db[_0xab49('0x44')][_0xab49('0x2d')]);_0x204ff3[_0xab49('0x2f')]=_['keys'](_0x1ea64d[_0xab49('0x2f')]);_0x204ff3[_0xab49('0x3a')]=_[_0xab49('0x31')](_0x204ff3['model'],_0x204ff3[_0xab49('0x2f')]);_0x20ecfb[_0xab49('0x33')]=_[_0xab49('0x31')](_0x204ff3[_0xab49('0x32')],qs[_0xab49('0x34')](_0x1ea64d[_0xab49('0x2f')]['fields']));_0x20ecfb[_0xab49('0x33')]=_0x20ecfb[_0xab49('0x33')][_0xab49('0x35')]?_0x20ecfb[_0xab49('0x33')]:_0x204ff3[_0xab49('0x32')];if(_0x1ea64d[_0xab49('0x2f')]['includeAll']){_0x20ecfb[_0xab49('0x43')]=[{'all':!![]}];}_0x20ecfb=_[_0xab49('0x3d')]({},_0x20ecfb,_0x1ea64d[_0xab49('0x40')]);return db[_0xab49('0x44')][_0xab49('0x49')](_0x20ecfb)[_0xab49('0x27')](handleEntityNotFound(_0x523dd2,null))[_0xab49('0x27')](respondWithResult(_0x523dd2,null))[_0xab49('0x4a')](handleError(_0x523dd2,null));};exports[_0xab49('0x4b')]=function(_0xfb7d69,_0x1ceb71){return db[_0xab49('0x44')]['create'](_0xfb7d69[_0xab49('0x4c')],{})[_0xab49('0x27')](function(_0x2d7072){var _0x394c3f=_0xfb7d69[_0xab49('0x4d')][_0xab49('0x4e')]({'plain':!![]});if(!_0x394c3f)throw new Error(_0xab49('0x4f'));if(_0x394c3f['role']===_0xab49('0x4d')){var _0x5316ae=_0x2d7072[_0xab49('0x4e')]({'plain':!![]});var _0x49c9ad=_0xab49('0x28');return db[_0xab49('0x50')]['find']({'where':{'name':_0x49c9ad,'userProfileId':_0x394c3f[_0xab49('0x51')]},'raw':!![]})[_0xab49('0x27')](function(_0x1a5326){if(_0x1a5326&&_0x1a5326[_0xab49('0x52')]===0x0){return db[_0xab49('0x53')][_0xab49('0x4b')]({'name':_0x5316ae[_0xab49('0x2a')],'resourceId':_0x5316ae['id'],'type':_0x1a5326[_0xab49('0x2a')],'sectionId':_0x1a5326['id']},{})[_0xab49('0x27')](function(){return _0x2d7072;});}else{return _0x2d7072;}})[_0xab49('0x4a')](function(_0xceee59){logger[_0xab49('0x29')](_0xab49('0x54'),_0xceee59);throw _0xceee59;});}return _0x2d7072;})[_0xab49('0x27')](respondWithResult(_0x1ceb71,0xc9))[_0xab49('0x4a')](handleError(_0x1ceb71,null));};exports[_0xab49('0x55')]=function(_0x487e52,_0x52e66d){if(_0x487e52[_0xab49('0x4c')]['id']){delete _0x487e52[_0xab49('0x4c')]['id'];}return db[_0xab49('0x44')][_0xab49('0x49')]({'where':{'id':_0x487e52[_0xab49('0x48')]['id']}})['then'](handleEntityNotFound(_0x52e66d,null))[_0xab49('0x27')](saveUpdates(_0x487e52[_0xab49('0x4c')],null))[_0xab49('0x27')](respondWithResult(_0x52e66d,null))[_0xab49('0x4a')](handleError(_0x52e66d,null));};exports[_0xab49('0x56')]=function(_0x122850,_0x5a924b){return db[_0xab49('0x44')][_0xab49('0x49')]({'where':{'id':_0x122850[_0xab49('0x48')]['id']}})[_0xab49('0x27')](handleEntityNotFound(_0x5a924b,null))['then'](removeEntity(_0x5a924b,null))['catch'](handleError(_0x5a924b,null));};exports[_0xab49('0x57')]=function(_0x4d3629,_0x3e4c4a,_0x139705){return db[_0xab49('0x44')][_0xab49('0x49')]({'where':{'id':_0x4d3629[_0xab49('0x48')]['id']}})[_0xab49('0x27')](handleEntityNotFound(_0x3e4c4a,null))[_0xab49('0x27')](function(_0x10da44){if(_0x10da44){return _0x10da44['addUsers'](_0x4d3629[_0xab49('0x4c')][_0xab49('0x58')],_[_0xab49('0x59')](_0x4d3629[_0xab49('0x4c')],[_0xab49('0x58'),'id'])||{});}})['then'](respondWithResult(_0x3e4c4a,null))[_0xab49('0x4a')](handleError(_0x3e4c4a,null));};exports[_0xab49('0x5a')]=function(_0x88ce9b,_0x4464bd,_0x32cdf2){return db[_0xab49('0x44')][_0xab49('0x49')]({'where':{'id':_0x88ce9b[_0xab49('0x48')]['id']}})[_0xab49('0x27')](handleEntityNotFound(_0x4464bd,null))[_0xab49('0x27')](function(_0xeccf30){if(_0xeccf30){return _0xeccf30[_0xab49('0x5a')](_0x88ce9b[_0xab49('0x2f')]['ids'])[_0xab49('0x27')](function(){if(_[_0xab49('0x5b')](_0x88ce9b[_0xab49('0x2f')][_0xab49('0x58')])){for(var _0x106be9=0x0;_0x106be9<_0x88ce9b[_0xab49('0x2f')][_0xab49('0x58')][_0xab49('0x35')];_0x106be9+=0x1){socket[_0xab49('0x5c')](_0xab49('0x5d'),{'UserId':Number(_0x88ce9b['query'][_0xab49('0x58')][_0x106be9]),'SquareProjectId':Number(_0x88ce9b[_0xab49('0x48')]['id'])});}}else{socket['emit'](_0xab49('0x5d'),{'UserId':Number(_0x88ce9b[_0xab49('0x2f')][_0xab49('0x58')]),'SquareProjectId':Number(_0x88ce9b['params']['id'])});}});}})[_0xab49('0x27')](respondWithStatusCode(_0x4464bd,null))[_0xab49('0x4a')](handleError(_0x4464bd,null));};exports['getUsers']=function(_0x47b7f4,_0x425d2e,_0x376163){var _0x2acd68={};var _0x48fb06={};var _0x4c750f;var _0x148ff0;return db[_0xab49('0x44')][_0xab49('0x5e')]({'where':{'id':_0x47b7f4[_0xab49('0x48')]['id']}})[_0xab49('0x27')](handleEntityNotFound(_0x425d2e,null))[_0xab49('0x27')](function(_0x16505d){if(_0x16505d){_0x4c750f=_0x16505d;_0x48fb06[_0xab49('0x32')]=_['keys'](db['User'][_0xab49('0x2d')]);_0x48fb06[_0xab49('0x2f')]=_[_0xab49('0x30')](_0x47b7f4[_0xab49('0x2f')]);_0x48fb06[_0xab49('0x3a')]=_[_0xab49('0x31')](_0x48fb06[_0xab49('0x32')],_0x48fb06[_0xab49('0x2f')]);_0x2acd68[_0xab49('0x33')]=_[_0xab49('0x31')](_0x48fb06['model'],qs[_0xab49('0x34')](_0x47b7f4[_0xab49('0x2f')][_0xab49('0x34')]));_0x2acd68[_0xab49('0x33')]=_0x2acd68[_0xab49('0x33')][_0xab49('0x35')]?_0x2acd68[_0xab49('0x33')]:_0x48fb06[_0xab49('0x32')];_0x2acd68['order']=qs[_0xab49('0x39')](_0x47b7f4['query'][_0xab49('0x39')]);_0x2acd68[_0xab49('0x3c')]=qs[_0xab49('0x3a')](_['pick'](_0x47b7f4[_0xab49('0x2f')],_0x48fb06[_0xab49('0x3a')]));if(_0x47b7f4['query'][_0xab49('0x3b')]){_0x2acd68[_0xab49('0x3c')]=_[_0xab49('0x3d')](_0x2acd68[_0xab49('0x3c')],{'$or':_[_0xab49('0x2c')](_0x2acd68[_0xab49('0x33')],function(_0x35e5cc){var _0x324684={};_0x324684[_0x35e5cc]={'$like':'%'+_0x47b7f4[_0xab49('0x2f')][_0xab49('0x3b')]+'%'};return _0x324684;})});}_0x2acd68=_[_0xab49('0x3d')]({},_0x2acd68,_0x47b7f4[_0xab49('0x40')]);return _0x4c750f[_0xab49('0x5f')](_0x2acd68);}})['then'](function(_0x396686){if(_0x396686){_0x148ff0=_0x396686[_0xab49('0x35')];if(!_0x47b7f4[_0xab49('0x2f')]['hasOwnProperty'](_0xab49('0x37'))){_0x2acd68[_0xab49('0x23')]=qs['limit'](_0x47b7f4[_0xab49('0x2f')][_0xab49('0x23')]);_0x2acd68['offset']=qs[_0xab49('0x22')](_0x47b7f4[_0xab49('0x2f')][_0xab49('0x22')]);}return _0x4c750f[_0xab49('0x5f')](_0x2acd68);}})[_0xab49('0x27')](function(_0x451b31){if(_0x451b31){return _0x451b31?{'count':_0x148ff0,'rows':_0x451b31}:null;}})[_0xab49('0x27')](respondWithResult(_0x425d2e,null))[_0xab49('0x4a')](handleError(_0x425d2e,null));}; \ No newline at end of file +var _0xca66=['fieldName','type','keys','query','filters','model','attributes','intersection','fields','length','nolimit','order','where','pick','filter','VIRTUAL','merge','options','include','SquareProject','rows','catch','show','params','includeAll','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','autoAssociation','create','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','addUsers','ids','omit','removeUsers','isArray','emit','userSquareProject:remove','getUsers','User','sort','html-pdf','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','./squareProject.socket','register','status','json','count','offset','limit','set','Content-Range','apply','reject','save','destroy','get','SquareProjects','UserProfileResource','then','sendStatus','name','send','index','map','rawAttributes'];(function(_0x7c4e76,_0xa43e97){var _0x29f895=function(_0x15773c){while(--_0x15773c){_0x7c4e76['push'](_0x7c4e76['shift']());}};_0x29f895(++_0xa43e97);}(_0xca66,0x8b));var _0x6ca6=function(_0x4e0ad0,_0x424e10){_0x4e0ad0=_0x4e0ad0-0x0;var _0x331780=_0xca66[_0x4e0ad0];return _0x331780;};'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 Redis=require(_0x6ca6('0xf'));var authService=require(_0x6ca6('0x10'));var qs=require(_0x6ca6('0x11'));var as=require(_0x6ca6('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6ca6('0x13'))(_0x6ca6('0x14'));var utils=require(_0x6ca6('0x15'));var config=require(_0x6ca6('0x16'));var db=require(_0x6ca6('0x17'))['db'];config[_0x6ca6('0x18')]=_['defaults'](config[_0x6ca6('0x18')],{'host':_0x6ca6('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6ca6('0x18')]));require(_0x6ca6('0x1a'))[_0x6ca6('0x1b')](socket);function respondWithStatusCode(_0x3570f1,_0xc774c){_0xc774c=_0xc774c||0xcc;return function(_0x1d1d86){if(_0x1d1d86){return _0x3570f1['sendStatus'](_0xc774c);}return _0x3570f1['status'](_0xc774c)['end']();};}function respondWithResult(_0x36ff3e,_0x19e94f){_0x19e94f=_0x19e94f||0xc8;return function(_0x260b56){if(_0x260b56){return _0x36ff3e[_0x6ca6('0x1c')](_0x19e94f)[_0x6ca6('0x1d')](_0x260b56);}};}function respondWithFilteredResult(_0x3d7f3f,_0x25dc6c){return function(_0x4f056d){if(_0x4f056d){var _0x2391ce=_0x4f056d[_0x6ca6('0x1e')],_0x10be57=_0x25dc6c[_0x6ca6('0x1f')],_0xc97f0=_0x25dc6c[_0x6ca6('0x1f')]+_0x25dc6c[_0x6ca6('0x20')],_0x1f21ff;if(_0xc97f0>=_0x2391ce){_0xc97f0=_0x2391ce;_0x1f21ff=0xc8;}else{_0x1f21ff=0xce;}_0x3d7f3f[_0x6ca6('0x1c')](_0x1f21ff);return _0x3d7f3f[_0x6ca6('0x21')](_0x6ca6('0x22'),_0x10be57+'-'+_0xc97f0+'/'+_0x2391ce)['json'](_0x4f056d);}return null;};}function patchUpdates(_0x28a982){return function(_0x254afe){try{jsonpatch[_0x6ca6('0x23')](_0x254afe,_0x28a982,!![]);}catch(_0x195c92){return BPromise[_0x6ca6('0x24')](_0x195c92);}return _0x254afe[_0x6ca6('0x25')]();};}function saveUpdates(_0x593f15,_0xfb962d){return function(_0x108319){if(_0x108319){return _0x108319['update'](_0x593f15)['then'](function(_0xfbf496){return _0xfbf496;});}return null;};}function removeEntity(_0x216701,_0xfe0760){return function(_0x224a1f){if(_0x224a1f){return _0x224a1f[_0x6ca6('0x26')]()['then'](function(){var _0x222373=_0x224a1f[_0x6ca6('0x27')]({'plain':!![]});var _0x1c43ee=_0x6ca6('0x28');return db[_0x6ca6('0x29')][_0x6ca6('0x26')]({'where':{'type':_0x1c43ee,'resourceId':_0x222373['id']}})[_0x6ca6('0x2a')](function(){return _0x224a1f;});})[_0x6ca6('0x2a')](function(){_0x216701['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x144ec5,_0x9467bd){return function(_0xf1d821){if(!_0xf1d821){_0x144ec5[_0x6ca6('0x2b')](0x194);}return _0xf1d821;};}function handleError(_0x552f3e,_0x5ea6f7){_0x5ea6f7=_0x5ea6f7||0x1f4;return function(_0x306583){logger['error'](_0x306583['stack']);if(_0x306583[_0x6ca6('0x2c')]){delete _0x306583[_0x6ca6('0x2c')];}_0x552f3e['status'](_0x5ea6f7)[_0x6ca6('0x2d')](_0x306583);};}exports[_0x6ca6('0x2e')]=function(_0xac50e8,_0x566543){var _0x484411={},_0x28af50={},_0x23112a={'count':0x0,'rows':[]};var _0x35fbb5=_[_0x6ca6('0x2f')](db['SquareProject'][_0x6ca6('0x30')],function(_0x15b962){return{'name':_0x15b962[_0x6ca6('0x31')],'type':_0x15b962[_0x6ca6('0x32')]['key']};});_0x28af50['model']=_['map'](_0x35fbb5,'name');_0x28af50['query']=_[_0x6ca6('0x33')](_0xac50e8[_0x6ca6('0x34')]);_0x28af50[_0x6ca6('0x35')]=_['intersection'](_0x28af50[_0x6ca6('0x36')],_0x28af50[_0x6ca6('0x34')]);_0x484411[_0x6ca6('0x37')]=_[_0x6ca6('0x38')](_0x28af50['model'],qs[_0x6ca6('0x39')](_0xac50e8[_0x6ca6('0x34')][_0x6ca6('0x39')]));_0x484411[_0x6ca6('0x37')]=_0x484411['attributes'][_0x6ca6('0x3a')]?_0x484411['attributes']:_0x28af50[_0x6ca6('0x36')];if(!_0xac50e8['query']['hasOwnProperty'](_0x6ca6('0x3b'))){_0x484411[_0x6ca6('0x20')]=qs[_0x6ca6('0x20')](_0xac50e8[_0x6ca6('0x34')]['limit']);_0x484411['offset']=qs[_0x6ca6('0x1f')](_0xac50e8[_0x6ca6('0x34')]['offset']);}_0x484411[_0x6ca6('0x3c')]=qs['sort'](_0xac50e8[_0x6ca6('0x34')]['sort']);_0x484411[_0x6ca6('0x3d')]=qs[_0x6ca6('0x35')](_[_0x6ca6('0x3e')](_0xac50e8[_0x6ca6('0x34')],_0x28af50[_0x6ca6('0x35')]));if(_0xac50e8[_0x6ca6('0x34')][_0x6ca6('0x3f')]){_0x484411[_0x6ca6('0x3d')]=_['merge'](_0x484411[_0x6ca6('0x3d')],{'$or':_['map'](_0x35fbb5,function(_0x57186c){if(_0x57186c[_0x6ca6('0x32')]!==_0x6ca6('0x40')){var _0x52cc41={};_0x52cc41[_0x57186c[_0x6ca6('0x2c')]]={'$like':'%'+_0xac50e8['query'][_0x6ca6('0x3f')]+'%'};return _0x52cc41;}})});}_0x484411=_[_0x6ca6('0x41')]({},_0x484411,_0xac50e8[_0x6ca6('0x42')]);var _0x3705cc={'where':_0x484411['where']};return db['SquareProject'][_0x6ca6('0x1e')](_0x3705cc)[_0x6ca6('0x2a')](function(_0x197ffa){_0x23112a[_0x6ca6('0x1e')]=_0x197ffa;if(_0xac50e8[_0x6ca6('0x34')]['includeAll']){_0x484411[_0x6ca6('0x43')]=[{'all':!![]}];}return db[_0x6ca6('0x44')]['findAll'](_0x484411);})[_0x6ca6('0x2a')](function(_0x3b60db){_0x23112a[_0x6ca6('0x45')]=_0x3b60db;return _0x23112a;})[_0x6ca6('0x2a')](respondWithFilteredResult(_0x566543,_0x484411))[_0x6ca6('0x46')](handleError(_0x566543,null));};exports[_0x6ca6('0x47')]=function(_0x258c76,_0xe9bce9){var _0x1a8b7e={'raw':![],'where':{'id':_0x258c76[_0x6ca6('0x48')]['id']}},_0x5e424f={};_0x5e424f[_0x6ca6('0x36')]=_[_0x6ca6('0x33')](db[_0x6ca6('0x44')][_0x6ca6('0x30')]);_0x5e424f[_0x6ca6('0x34')]=_[_0x6ca6('0x33')](_0x258c76[_0x6ca6('0x34')]);_0x5e424f['filters']=_['intersection'](_0x5e424f[_0x6ca6('0x36')],_0x5e424f[_0x6ca6('0x34')]);_0x1a8b7e[_0x6ca6('0x37')]=_[_0x6ca6('0x38')](_0x5e424f[_0x6ca6('0x36')],qs[_0x6ca6('0x39')](_0x258c76[_0x6ca6('0x34')]['fields']));_0x1a8b7e['attributes']=_0x1a8b7e[_0x6ca6('0x37')][_0x6ca6('0x3a')]?_0x1a8b7e['attributes']:_0x5e424f[_0x6ca6('0x36')];if(_0x258c76[_0x6ca6('0x34')][_0x6ca6('0x49')]){_0x1a8b7e[_0x6ca6('0x43')]=[{'all':!![]}];}_0x1a8b7e=_[_0x6ca6('0x41')]({},_0x1a8b7e,_0x258c76[_0x6ca6('0x42')]);return db[_0x6ca6('0x44')]['find'](_0x1a8b7e)[_0x6ca6('0x2a')](handleEntityNotFound(_0xe9bce9,null))[_0x6ca6('0x2a')](respondWithResult(_0xe9bce9,null))[_0x6ca6('0x46')](handleError(_0xe9bce9,null));};exports['create']=function(_0x408df3,_0x4dd78d){return db[_0x6ca6('0x44')]['create'](_0x408df3['body'],{})['then'](function(_0x199489){var _0x1603a7=_0x408df3[_0x6ca6('0x4a')]['get']({'plain':!![]});if(!_0x1603a7)throw new Error(_0x6ca6('0x4b'));if(_0x1603a7['role']===_0x6ca6('0x4a')){var _0x1010a6=_0x199489[_0x6ca6('0x27')]({'plain':!![]});var _0x18602d=_0x6ca6('0x28');return db[_0x6ca6('0x4c')][_0x6ca6('0x4d')]({'where':{'name':_0x18602d,'userProfileId':_0x1603a7[_0x6ca6('0x4e')]},'raw':!![]})[_0x6ca6('0x2a')](function(_0x2e4cc5){if(_0x2e4cc5&&_0x2e4cc5[_0x6ca6('0x4f')]===0x0){return db['UserProfileResource'][_0x6ca6('0x50')]({'name':_0x1010a6[_0x6ca6('0x2c')],'resourceId':_0x1010a6['id'],'type':_0x2e4cc5[_0x6ca6('0x2c')],'sectionId':_0x2e4cc5['id']},{})[_0x6ca6('0x2a')](function(){return _0x199489;});}else{return _0x199489;}})[_0x6ca6('0x46')](function(_0x594209){logger[_0x6ca6('0x51')](_0x6ca6('0x52'),_0x594209);throw _0x594209;});}return _0x199489;})[_0x6ca6('0x2a')](respondWithResult(_0x4dd78d,0xc9))['catch'](handleError(_0x4dd78d,null));};exports['update']=function(_0x4fe7a9,_0x4bcb4e){if(_0x4fe7a9[_0x6ca6('0x53')]['id']){delete _0x4fe7a9[_0x6ca6('0x53')]['id'];}return db[_0x6ca6('0x44')]['find']({'where':{'id':_0x4fe7a9['params']['id']}})[_0x6ca6('0x2a')](handleEntityNotFound(_0x4bcb4e,null))[_0x6ca6('0x2a')](saveUpdates(_0x4fe7a9[_0x6ca6('0x53')],null))['then'](respondWithResult(_0x4bcb4e,null))[_0x6ca6('0x46')](handleError(_0x4bcb4e,null));};exports['destroy']=function(_0x281759,_0x40077c){return db[_0x6ca6('0x44')][_0x6ca6('0x4d')]({'where':{'id':_0x281759['params']['id']}})[_0x6ca6('0x2a')](handleEntityNotFound(_0x40077c,null))['then'](removeEntity(_0x40077c,null))['catch'](handleError(_0x40077c,null));};exports[_0x6ca6('0x54')]=function(_0x11538e,_0x1b9da5,_0x35854a){return db['SquareProject'][_0x6ca6('0x4d')]({'where':{'id':_0x11538e[_0x6ca6('0x48')]['id']}})[_0x6ca6('0x2a')](handleEntityNotFound(_0x1b9da5,null))[_0x6ca6('0x2a')](function(_0x43881a){if(_0x43881a){return _0x43881a[_0x6ca6('0x54')](_0x11538e[_0x6ca6('0x53')][_0x6ca6('0x55')],_[_0x6ca6('0x56')](_0x11538e[_0x6ca6('0x53')],[_0x6ca6('0x55'),'id'])||{});}})[_0x6ca6('0x2a')](respondWithResult(_0x1b9da5,null))[_0x6ca6('0x46')](handleError(_0x1b9da5,null));};exports[_0x6ca6('0x57')]=function(_0x2eeed6,_0x290c04,_0x493e5d){return db[_0x6ca6('0x44')][_0x6ca6('0x4d')]({'where':{'id':_0x2eeed6[_0x6ca6('0x48')]['id']}})[_0x6ca6('0x2a')](handleEntityNotFound(_0x290c04,null))[_0x6ca6('0x2a')](function(_0x139144){if(_0x139144){return _0x139144[_0x6ca6('0x57')](_0x2eeed6[_0x6ca6('0x34')][_0x6ca6('0x55')])[_0x6ca6('0x2a')](function(){if(_[_0x6ca6('0x58')](_0x2eeed6[_0x6ca6('0x34')][_0x6ca6('0x55')])){for(var _0x16a4f9=0x0;_0x16a4f9<_0x2eeed6[_0x6ca6('0x34')][_0x6ca6('0x55')]['length'];_0x16a4f9+=0x1){socket[_0x6ca6('0x59')](_0x6ca6('0x5a'),{'UserId':Number(_0x2eeed6[_0x6ca6('0x34')][_0x6ca6('0x55')][_0x16a4f9]),'SquareProjectId':Number(_0x2eeed6[_0x6ca6('0x48')]['id'])});}}else{socket[_0x6ca6('0x59')]('userSquareProject:remove',{'UserId':Number(_0x2eeed6['query']['ids']),'SquareProjectId':Number(_0x2eeed6[_0x6ca6('0x48')]['id'])});}});}})[_0x6ca6('0x2a')](respondWithStatusCode(_0x290c04,null))['catch'](handleError(_0x290c04,null));};exports[_0x6ca6('0x5b')]=function(_0xc6021a,_0x97f23,_0x555b22){var _0x4250a1={};var _0x18e9c1={};var _0x22c621;var _0x1c3064;return db[_0x6ca6('0x44')]['findOne']({'where':{'id':_0xc6021a['params']['id']}})[_0x6ca6('0x2a')](handleEntityNotFound(_0x97f23,null))[_0x6ca6('0x2a')](function(_0x47d420){if(_0x47d420){_0x22c621=_0x47d420;_0x18e9c1[_0x6ca6('0x36')]=_[_0x6ca6('0x33')](db[_0x6ca6('0x5c')][_0x6ca6('0x30')]);_0x18e9c1[_0x6ca6('0x34')]=_[_0x6ca6('0x33')](_0xc6021a[_0x6ca6('0x34')]);_0x18e9c1[_0x6ca6('0x35')]=_[_0x6ca6('0x38')](_0x18e9c1['model'],_0x18e9c1['query']);_0x4250a1[_0x6ca6('0x37')]=_[_0x6ca6('0x38')](_0x18e9c1[_0x6ca6('0x36')],qs[_0x6ca6('0x39')](_0xc6021a[_0x6ca6('0x34')][_0x6ca6('0x39')]));_0x4250a1['attributes']=_0x4250a1[_0x6ca6('0x37')]['length']?_0x4250a1[_0x6ca6('0x37')]:_0x18e9c1[_0x6ca6('0x36')];_0x4250a1[_0x6ca6('0x3c')]=qs[_0x6ca6('0x5d')](_0xc6021a[_0x6ca6('0x34')]['sort']);_0x4250a1['where']=qs[_0x6ca6('0x35')](_[_0x6ca6('0x3e')](_0xc6021a[_0x6ca6('0x34')],_0x18e9c1['filters']));if(_0xc6021a[_0x6ca6('0x34')][_0x6ca6('0x3f')]){_0x4250a1[_0x6ca6('0x3d')]=_[_0x6ca6('0x41')](_0x4250a1['where'],{'$or':_[_0x6ca6('0x2f')](_0x4250a1[_0x6ca6('0x37')],function(_0x3637c9){var _0x48d7cb={};_0x48d7cb[_0x3637c9]={'$like':'%'+_0xc6021a[_0x6ca6('0x34')]['filter']+'%'};return _0x48d7cb;})});}_0x4250a1=_[_0x6ca6('0x41')]({},_0x4250a1,_0xc6021a[_0x6ca6('0x42')]);return _0x22c621[_0x6ca6('0x5b')](_0x4250a1);}})[_0x6ca6('0x2a')](function(_0x2b3fb5){if(_0x2b3fb5){_0x1c3064=_0x2b3fb5[_0x6ca6('0x3a')];if(!_0xc6021a[_0x6ca6('0x34')]['hasOwnProperty']('nolimit')){_0x4250a1[_0x6ca6('0x20')]=qs[_0x6ca6('0x20')](_0xc6021a[_0x6ca6('0x34')]['limit']);_0x4250a1[_0x6ca6('0x1f')]=qs[_0x6ca6('0x1f')](_0xc6021a[_0x6ca6('0x34')][_0x6ca6('0x1f')]);}return _0x22c621[_0x6ca6('0x5b')](_0x4250a1);}})[_0x6ca6('0x2a')](function(_0x5ceb48){if(_0x5ceb48){return _0x5ceb48?{'count':_0x1c3064,'rows':_0x5ceb48}:null;}})['then'](respondWithResult(_0x97f23,null))[_0x6ca6('0x46')](handleError(_0x97f23,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index 115cf71..4fc2794 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 _0x255d=['emit','hasOwnProperty','hook','exports','events','SquareProject','setMaxListeners','save','update'];(function(_0x2f4e5d,_0x48c674){var _0x17136a=function(_0x50a25b){while(--_0x50a25b){_0x2f4e5d['push'](_0x2f4e5d['shift']());}};_0x17136a(++_0x48c674);}(_0x255d,0xc1));var _0xd255=function(_0x441f16,_0x1849ae){_0x441f16=_0x441f16-0x0;var _0x1efcf0=_0x255d[_0x441f16];return _0x1efcf0;};'use strict';var EventEmitter=require(_0xd255('0x0'));var SquareProject=require('../../mysqldb')['db'][_0xd255('0x1')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0xd255('0x2')](0x0);var events={'afterCreate':_0xd255('0x3'),'afterUpdate':_0xd255('0x4'),'afterDestroy':'remove'};function emitEvent(_0x34b542){return function(_0x3db2de,_0x419f45,_0x39548b){SquareProjectEvents[_0xd255('0x5')](_0x34b542+':'+_0x3db2de['id'],_0x3db2de);SquareProjectEvents[_0xd255('0x5')](_0x34b542,_0x3db2de);_0x39548b(null);};}for(var e in events){if(events[_0xd255('0x6')](e)){var event=events[e];SquareProject[_0xd255('0x7')](e,emitEvent(event));}}module[_0xd255('0x8')]=SquareProjectEvents; \ No newline at end of file +var _0x6921=['exports','../../mysqldb','setMaxListeners','update','remove','emit','hasOwnProperty','hook'];(function(_0x1b828b,_0x344400){var _0x98da1a=function(_0x1a0f5b){while(--_0x1a0f5b){_0x1b828b['push'](_0x1b828b['shift']());}};_0x98da1a(++_0x344400);}(_0x6921,0x1d1));var _0x1692=function(_0x128b37,_0x23c638){_0x128b37=_0x128b37-0x0;var _0x1fafae=_0x6921[_0x128b37];return _0x1fafae;};'use strict';var EventEmitter=require('events');var SquareProject=require(_0x1692('0x0'))['db']['SquareProject'];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x1692('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x1692('0x2'),'afterDestroy':_0x1692('0x3')};function emitEvent(_0x4ac00c){return function(_0x3995b3,_0x577497,_0x4581c4){SquareProjectEvents[_0x1692('0x4')](_0x4ac00c+':'+_0x3995b3['id'],_0x3995b3);SquareProjectEvents[_0x1692('0x4')](_0x4ac00c,_0x3995b3);_0x4581c4(null);};}for(var e in events){if(events[_0x1692('0x5')](e)){var event=events[e];SquareProject[_0x1692('0x6')](e,emitEvent(event));}}module[_0x1692('0x7')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index 3ec2ea1..2c045b9 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 _0x208f=['../../config/environment','./squareProject.attributes','exports','define','SquareProject','square_projects','lodash','util','api','bluebird','request-promise','path','rimraf'];(function(_0x12ba49,_0x799605){var _0x259df5=function(_0x204b3a){while(--_0x204b3a){_0x12ba49['push'](_0x12ba49['shift']());}};_0x259df5(++_0x799605);}(_0x208f,0xd6));var _0xf208=function(_0x258973,_0xa768c){_0x258973=_0x258973-0x0;var _0x315ea4=_0x208f[_0x258973];return _0x315ea4;};'use strict';var _=require(_0xf208('0x0'));var util=require(_0xf208('0x1'));var logger=require('../../config/logger')(_0xf208('0x2'));var moment=require('moment');var BPromise=require(_0xf208('0x3'));var rp=require(_0xf208('0x4'));var fs=require('fs');var path=require(_0xf208('0x5'));var rimraf=require(_0xf208('0x6'));var config=require(_0xf208('0x7'));var attributes=require(_0xf208('0x8'));module[_0xf208('0x9')]=function(_0x20bcbc,_0xa3e73e){return _0x20bcbc[_0xf208('0xa')](_0xf208('0xb'),attributes,{'tableName':_0xf208('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd6b1=['define','SquareProject','square_projects','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x37f68f,_0x2d5455){var _0x29a557=function(_0x214e49){while(--_0x214e49){_0x37f68f['push'](_0x37f68f['shift']());}};_0x29a557(++_0x2d5455);}(_0xd6b1,0x1dc));var _0x1d6b=function(_0x2bb190,_0x1be9a2){_0x2bb190=_0x2bb190-0x0;var _0x1a4948=_0xd6b1[_0x2bb190];return _0x1a4948;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1d6b('0x0'))('api');var moment=require(_0x1d6b('0x1'));var BPromise=require(_0x1d6b('0x2'));var rp=require(_0x1d6b('0x3'));var fs=require('fs');var path=require(_0x1d6b('0x4'));var rimraf=require(_0x1d6b('0x5'));var config=require(_0x1d6b('0x6'));var attributes=require('./squareProject.attributes');module[_0x1d6b('0x7')]=function(_0x42066d,_0x6f8c7){return _0x42066d[_0x1d6b('0x8')](_0x1d6b('0x9'),attributes,{'tableName':_0x1d6b('0xa'),'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 ea0a851..220a960 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 _0x318e=['SquareProject','find','options','where','include','model','map','attributes','then','lodash','util','moment','ioredis','../../config/utils','../../config/logger','jayson/promise','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','request','info','SquareProject,\x20%s,\x20%s','SquareProject,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','ShowSquareProject'];(function(_0x3b8ae9,_0x1f4ca7){var _0x323422=function(_0x3026c6){while(--_0x3026c6){_0x3b8ae9['push'](_0x3b8ae9['shift']());}};_0x323422(++_0x1f4ca7);}(_0x318e,0x153));var _0xe318=function(_0x3e83ec,_0x3aa38c){_0x3e83ec=_0x3e83ec-0x0;var _0x3773ce=_0x318e[_0x3e83ec];return _0x3773ce;};'use strict';var _=require(_0xe318('0x0'));var util=require(_0xe318('0x1'));var moment=require(_0xe318('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe318('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xe318('0x4'));var logger=require(_0xe318('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xe318('0x6'));var client=jayson['client']['http']({'port':0x232a});config[_0xe318('0x7')]=_[_0xe318('0x8')](config['redis'],{'host':_0xe318('0x9'),'port':0x18eb});var socket=require(_0xe318('0xa'))(new Redis(config['redis']));require(_0xe318('0xb'))['register'](socket);function respondWithRpcPromise(_0x56d288,_0x4a83d2,_0x4e3f4d){return new BPromise(function(_0x268f8c,_0x563313){return client[_0xe318('0xc')](_0x56d288,_0x4e3f4d)['then'](function(_0x305511){logger[_0xe318('0xd')](_0xe318('0xe'),_0x4a83d2,'request\x20sent');logger['debug'](_0xe318('0xf'),_0x4a83d2,_0xe318('0x10'),JSON[_0xe318('0x11')](_0x305511));if(_0x305511[_0xe318('0x12')]){if(_0x305511['error'][_0xe318('0x13')]===0x1f4){logger['error'](_0xe318('0xe'),_0x4a83d2,_0x305511['error'][_0xe318('0x14')]);return _0x563313(_0x305511['error'][_0xe318('0x14')]);}logger[_0xe318('0x12')](_0xe318('0xe'),_0x4a83d2,_0x305511['error']['message']);return _0x268f8c(_0x305511[_0xe318('0x12')][_0xe318('0x14')]);}else{logger[_0xe318('0xd')](_0xe318('0xe'),_0x4a83d2,_0xe318('0x10'));_0x268f8c(_0x305511[_0xe318('0x15')][_0xe318('0x14')]);}})[_0xe318('0x16')](function(_0x2a7126){logger['error'](_0xe318('0xe'),_0x4a83d2,_0x2a7126);_0x563313(_0x2a7126);});});}exports[_0xe318('0x17')]=function(_0x100fd6){var _0x57d6d1=this;return new Promise(function(_0xc92e6,_0x4a68ed){return db[_0xe318('0x18')][_0xe318('0x19')]({'raw':_0x100fd6[_0xe318('0x1a')]?_0x100fd6[_0xe318('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x100fd6[_0xe318('0x1a')]?_0x100fd6['options'][_0xe318('0x1b')]||null:null,'attributes':_0x100fd6['options']?_0x100fd6[_0xe318('0x1a')]['attributes']||null:null,'include':_0x100fd6[_0xe318('0x1a')]?_0x100fd6['options'][_0xe318('0x1c')]?_['map'](_0x100fd6[_0xe318('0x1a')][_0xe318('0x1c')],function(_0x5d51d4){return{'model':db[_0x5d51d4[_0xe318('0x1d')]],'as':_0x5d51d4['as'],'attributes':_0x5d51d4['attributes'],'include':_0x5d51d4[_0xe318('0x1c')]?_[_0xe318('0x1e')](_0x5d51d4[_0xe318('0x1c')],function(_0x2ed69e){return{'model':db[_0x2ed69e[_0xe318('0x1d')]],'as':_0x2ed69e['as'],'attributes':_0x2ed69e['attributes'],'include':_0x2ed69e[_0xe318('0x1c')]?_[_0xe318('0x1e')](_0x2ed69e[_0xe318('0x1c')],function(_0x1d14d5){return{'model':db[_0x1d14d5[_0xe318('0x1d')]],'as':_0x1d14d5['as'],'attributes':_0x1d14d5[_0xe318('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xe318('0x20')](function(_0x3f6af6){logger['info'](_0xe318('0x17'),_0x100fd6);logger['debug']('ShowSquareProject',_0x100fd6,JSON[_0xe318('0x11')](_0x3f6af6));_0xc92e6(_0x3f6af6);})[_0xe318('0x16')](function(_0x16e29d){logger[_0xe318('0x12')](_0xe318('0x17'),_0x16e29d['message'],_0x100fd6);_0x4a68ed(_0x57d6d1['error'](0x1f4,_0x16e29d[_0xe318('0x14')]));});});}; \ No newline at end of file +var _0xd8b4=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','redis','defaults','localhost','./squareProject.socket','register','request','then','SquareProject,\x20%s,\x20%s','debug','SquareProject,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','ShowSquareProject','SquareProject','find','options','where','attributes','include','map','model','lodash','util','moment','bluebird'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0xd8b4,0x6e));var _0x4d8b=function(_0x1f7072,_0xa6bad6){_0x1f7072=_0x1f7072-0x0;var _0x1fe2bf=_0xd8b4[_0x1f7072];return _0x1fe2bf;};'use strict';var _=require(_0x4d8b('0x0'));var util=require(_0x4d8b('0x1'));var moment=require(_0x4d8b('0x2'));var BPromise=require(_0x4d8b('0x3'));var rs=require(_0x4d8b('0x4'));var fs=require('fs');var Redis=require(_0x4d8b('0x5'));var db=require(_0x4d8b('0x6'))['db'];var utils=require(_0x4d8b('0x7'));var logger=require(_0x4d8b('0x8'))('rpc');var config=require(_0x4d8b('0x9'));var jayson=require(_0x4d8b('0xa'));var client=jayson['client']['http']({'port':0x232a});config[_0x4d8b('0xb')]=_[_0x4d8b('0xc')](config[_0x4d8b('0xb')],{'host':_0x4d8b('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4d8b('0xb')]));require(_0x4d8b('0xe'))[_0x4d8b('0xf')](socket);function respondWithRpcPromise(_0x25e21b,_0x4bf8f5,_0xebf793){return new BPromise(function(_0xd80986,_0xf5125c){return client[_0x4d8b('0x10')](_0x25e21b,_0xebf793)[_0x4d8b('0x11')](function(_0x411fd8){logger['info'](_0x4d8b('0x12'),_0x4bf8f5,'request\x20sent');logger[_0x4d8b('0x13')](_0x4d8b('0x14'),_0x4bf8f5,_0x4d8b('0x15'),JSON[_0x4d8b('0x16')](_0x411fd8));if(_0x411fd8[_0x4d8b('0x17')]){if(_0x411fd8[_0x4d8b('0x17')][_0x4d8b('0x18')]===0x1f4){logger[_0x4d8b('0x17')](_0x4d8b('0x12'),_0x4bf8f5,_0x411fd8[_0x4d8b('0x17')][_0x4d8b('0x19')]);return _0xf5125c(_0x411fd8['error'][_0x4d8b('0x19')]);}logger[_0x4d8b('0x17')]('SquareProject,\x20%s,\x20%s',_0x4bf8f5,_0x411fd8[_0x4d8b('0x17')][_0x4d8b('0x19')]);return _0xd80986(_0x411fd8['error'][_0x4d8b('0x19')]);}else{logger[_0x4d8b('0x1a')](_0x4d8b('0x12'),_0x4bf8f5,_0x4d8b('0x15'));_0xd80986(_0x411fd8[_0x4d8b('0x1b')][_0x4d8b('0x19')]);}})[_0x4d8b('0x1c')](function(_0x4c0991){logger['error'](_0x4d8b('0x12'),_0x4bf8f5,_0x4c0991);_0xf5125c(_0x4c0991);});});}exports[_0x4d8b('0x1d')]=function(_0x29d9fd){var _0x3d0051=this;return new Promise(function(_0x231bdc,_0x53d4ec){return db[_0x4d8b('0x1e')][_0x4d8b('0x1f')]({'raw':_0x29d9fd[_0x4d8b('0x20')]?_0x29d9fd[_0x4d8b('0x20')]['raw']===undefined?!![]:![]:!![],'where':_0x29d9fd['options']?_0x29d9fd[_0x4d8b('0x20')][_0x4d8b('0x21')]||null:null,'attributes':_0x29d9fd[_0x4d8b('0x20')]?_0x29d9fd[_0x4d8b('0x20')][_0x4d8b('0x22')]||null:null,'include':_0x29d9fd[_0x4d8b('0x20')]?_0x29d9fd[_0x4d8b('0x20')][_0x4d8b('0x23')]?_[_0x4d8b('0x24')](_0x29d9fd['options'][_0x4d8b('0x23')],function(_0x17445b){return{'model':db[_0x17445b[_0x4d8b('0x25')]],'as':_0x17445b['as'],'attributes':_0x17445b[_0x4d8b('0x22')],'include':_0x17445b[_0x4d8b('0x23')]?_['map'](_0x17445b[_0x4d8b('0x23')],function(_0x3a886c){return{'model':db[_0x3a886c[_0x4d8b('0x25')]],'as':_0x3a886c['as'],'attributes':_0x3a886c[_0x4d8b('0x22')],'include':_0x3a886c[_0x4d8b('0x23')]?_['map'](_0x3a886c[_0x4d8b('0x23')],function(_0x16b855){return{'model':db[_0x16b855[_0x4d8b('0x25')]],'as':_0x16b855['as'],'attributes':_0x16b855[_0x4d8b('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x149993){logger['info']('ShowSquareProject',_0x29d9fd);logger[_0x4d8b('0x13')](_0x4d8b('0x1d'),_0x29d9fd,JSON[_0x4d8b('0x16')](_0x149993));_0x231bdc(_0x149993);})[_0x4d8b('0x1c')](function(_0x152e07){logger[_0x4d8b('0x17')](_0x4d8b('0x1d'),_0x152e07[_0x4d8b('0x19')],_0x29d9fd);_0x53d4ec(_0x3d0051['error'](0x1f4,_0x152e07[_0x4d8b('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index 508e7e0..a62d87a 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 _0x7c09=['save','remove','emit','removeListener','length','squareProject:'];(function(_0x150ca0,_0x1c8f2a){var _0x3ba4ec=function(_0x1159af){while(--_0x1159af){_0x150ca0['push'](_0x150ca0['shift']());}};_0x3ba4ec(++_0x1c8f2a);}(_0x7c09,0x102));var _0x97c0=function(_0x213cf1,_0x101d86){_0x213cf1=_0x213cf1-0x0;var _0x221d64=_0x7c09[_0x213cf1];return _0x221d64;};'use strict';var SquareProjectEvents=require('./squareProject.events');var events=[_0x97c0('0x0'),_0x97c0('0x1'),'update'];function createListener(_0xfbf689,_0x7d8f6f){return function(_0x2d04b9){_0x7d8f6f[_0x97c0('0x2')](_0xfbf689,_0x2d04b9);};}function removeListener(_0x12eb6d,_0x99bf54){return function(){SquareProjectEvents[_0x97c0('0x3')](_0x12eb6d,_0x99bf54);};}exports['register']=function(_0x4b2f81){for(var _0x590368=0x0,_0x46fdd9=events[_0x97c0('0x4')];_0x590368<_0x46fdd9;_0x590368++){var _0x2c19fa=events[_0x590368];var _0x109bc8=createListener(_0x97c0('0x5')+_0x2c19fa,_0x4b2f81);SquareProjectEvents['on'](_0x2c19fa,_0x109bc8);}}; \ No newline at end of file +var _0x2675=['register','length','squareProject:','./squareProject.events','emit','removeListener'];(function(_0x59b2a1,_0x1f631f){var _0x4908d1=function(_0x14c9b8){while(--_0x14c9b8){_0x59b2a1['push'](_0x59b2a1['shift']());}};_0x4908d1(++_0x1f631f);}(_0x2675,0x75));var _0x5267=function(_0x33bf4a,_0x2684c5){_0x33bf4a=_0x33bf4a-0x0;var _0x8e2921=_0x2675[_0x33bf4a];return _0x8e2921;};'use strict';var SquareProjectEvents=require(_0x5267('0x0'));var events=['save','remove','update'];function createListener(_0x1da342,_0x2ae442){return function(_0x57c95a){_0x2ae442[_0x5267('0x1')](_0x1da342,_0x57c95a);};}function removeListener(_0x36bdf0,_0x4e2548){return function(){SquareProjectEvents[_0x5267('0x2')](_0x36bdf0,_0x4e2548);};}exports[_0x5267('0x3')]=function(_0x4bd042){for(var _0x10f92c=0x0,_0x20f065=events[_0x5267('0x4')];_0x10f92c<_0x20f065;_0x10f92c++){var _0x527c16=events[_0x10f92c];var _0x9e0a27=createListener(_0x5267('0x5')+_0x527c16,_0x4bd042);SquareProjectEvents['on'](_0x527c16,_0x9e0a27);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index 93f662b..07ce554 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 _0xa070=['../../components/interaction/service','../../config/environment','./squareRecording.controller','get','isAuthenticated','index','show','/:id/download','download','post','create','put','/:id','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x45bb11,_0x2a4d7a){var _0x59cf55=function(_0x4858bc){while(--_0x4858bc){_0x45bb11['push'](_0x45bb11['shift']());}};_0x59cf55(++_0x2a4d7a);}(_0xa070,0xc8));var _0x0a07=function(_0x4bc18b,_0x33ecdf){_0x4bc18b=_0x4bc18b-0x0;var _0x5e1d7e=_0xa070[_0x4bc18b];return _0x5e1d7e;};'use strict';var multer=require(_0x0a07('0x0'));var util=require(_0x0a07('0x1'));var path=require(_0x0a07('0x2'));var timeout=require(_0x0a07('0x3'));var express=require(_0x0a07('0x4'));var router=express[_0x0a07('0x5')]();var auth=require(_0x0a07('0x6'));var interaction=require(_0x0a07('0x7'));var config=require(_0x0a07('0x8'));var controller=require(_0x0a07('0x9'));router[_0x0a07('0xa')]('/',auth[_0x0a07('0xb')](),controller[_0x0a07('0xc')]);router[_0x0a07('0xa')]('/:id',auth[_0x0a07('0xb')](),controller[_0x0a07('0xd')]);router[_0x0a07('0xa')](_0x0a07('0xe'),auth['isAuthenticated'](),controller[_0x0a07('0xf')]);router[_0x0a07('0x10')]('/',auth[_0x0a07('0xb')](),controller[_0x0a07('0x11')]);router[_0x0a07('0x12')](_0x0a07('0x13'),auth[_0x0a07('0xb')](),controller[_0x0a07('0x14')]);router[_0x0a07('0x15')]('/:id/delete',auth[_0x0a07('0xb')](),controller[_0x0a07('0x16')]);module['exports']=router; \ No newline at end of file +var _0x526a=['path','connect-timeout','Router','../../config/environment','./squareRecording.controller','get','index','/:id','isAuthenticated','show','/:id/download','download','post','create','put','update','delete','/:id/delete','destroy','multer','util'];(function(_0xf000b1,_0xb2d5e7){var _0x3f5212=function(_0x300f2a){while(--_0x300f2a){_0xf000b1['push'](_0xf000b1['shift']());}};_0x3f5212(++_0xb2d5e7);}(_0x526a,0x124));var _0xa526=function(_0x34021d,_0x753aa6){_0x34021d=_0x34021d-0x0;var _0x16597b=_0x526a[_0x34021d];return _0x16597b;};'use strict';var multer=require(_0xa526('0x0'));var util=require(_0xa526('0x1'));var path=require(_0xa526('0x2'));var timeout=require(_0xa526('0x3'));var express=require('express');var router=express[_0xa526('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xa526('0x5'));var controller=require(_0xa526('0x6'));router[_0xa526('0x7')]('/',auth['isAuthenticated'](),controller[_0xa526('0x8')]);router[_0xa526('0x7')](_0xa526('0x9'),auth[_0xa526('0xa')](),controller[_0xa526('0xb')]);router['get'](_0xa526('0xc'),auth['isAuthenticated'](),controller[_0xa526('0xd')]);router[_0xa526('0xe')]('/',auth[_0xa526('0xa')](),controller[_0xa526('0xf')]);router[_0xa526('0x10')]('/:id',auth[_0xa526('0xa')](),controller[_0xa526('0x11')]);router[_0xa526('0x12')](_0xa526('0x13'),auth['isAuthenticated'](),controller[_0xa526('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index 93f7be4..3ecf687 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 _0x752a=['lastIndexOf','exports','STRING','VIRTUAL','getDataValue','substring'];(function(_0x10a5a4,_0x42fc70){var _0x3933d8=function(_0x2e5ae0){while(--_0x2e5ae0){_0x10a5a4['push'](_0x10a5a4['shift']());}};_0x3933d8(++_0x42fc70);}(_0x752a,0x109));var _0xa752=function(_0x335271,_0x5025f2){_0x335271=_0x335271-0x0;var _0xa9fff8=_0x752a[_0x335271];return _0xa9fff8;};'use strict';var Sequelize=require('sequelize');module[_0xa752('0x0')]={'uniqueid':{'type':Sequelize[_0xa752('0x1')]},'callerid':{'type':Sequelize[_0xa752('0x1')]},'calleridname':{'type':Sequelize[_0xa752('0x1')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0xa752('0x1')]},'priority':{'type':Sequelize[_0xa752('0x1')]},'accountcode':{'type':Sequelize[_0xa752('0x1')]},'dnid':{'type':Sequelize[_0xa752('0x1')]},'projectName':{'type':Sequelize[_0xa752('0x1')]},'saveName':{'type':Sequelize[_0xa752('0x1')]},'filename':{'type':Sequelize[_0xa752('0x1')]},'savePath':{'type':Sequelize[_0xa752('0x1')]},'format':{'type':Sequelize[_0xa752('0x2')],'get':function(){var _0x421793='';var _0x7c6eb3=this[_0xa752('0x3')]('savePath');if(_0x7c6eb3){_0x421793=_0x7c6eb3[_0xa752('0x4')](_0x7c6eb3[_0xa752('0x5')]('.'));}return _0x421793;}}}; \ No newline at end of file +var _0x9c06=['exports','STRING','VIRTUAL','getDataValue','substring','lastIndexOf','sequelize'];(function(_0x2770bd,_0x2fb4d6){var _0x2a7fcc=function(_0x3db9e4){while(--_0x3db9e4){_0x2770bd['push'](_0x2770bd['shift']());}};_0x2a7fcc(++_0x2fb4d6);}(_0x9c06,0x68));var _0x69c0=function(_0x3cf346,_0xf6dffe){_0x3cf346=_0x3cf346-0x0;var _0x1465ff=_0x9c06[_0x3cf346];return _0x1465ff;};'use strict';var Sequelize=require(_0x69c0('0x0'));module[_0x69c0('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x69c0('0x2')]},'calleridname':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x69c0('0x2')]},'extension':{'type':Sequelize[_0x69c0('0x2')]},'priority':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x69c0('0x2')]},'dnid':{'type':Sequelize[_0x69c0('0x2')]},'projectName':{'type':Sequelize['STRING']},'saveName':{'type':Sequelize['STRING']},'filename':{'type':Sequelize[_0x69c0('0x2')]},'savePath':{'type':Sequelize[_0x69c0('0x2')]},'format':{'type':Sequelize[_0x69c0('0x3')],'get':function(){var _0x1d931b='';var _0x1e06a0=this[_0x69c0('0x4')]('savePath');if(_0x1e06a0){_0x1d931b=_0x1e06a0[_0x69c0('0x5')](_0x1e06a0[_0x69c0('0x6')]('.'));}return _0x1d931b;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index 72a7a21..763ea45 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 _0xe654=['sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','status','end','json','offset','limit','apply','update','then','destroy','sendStatus','error','stack','name','send','index','map','SquareRecording','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','VIRTUAL','merge','options','count','includeAll','include','rows','catch','show','params','find','create','body','download','../../components/encryptor','uniqueid','savePath','filename','format','%s.cypher','existsSync','decryptFile','secrets','recording','ValidationError','SquareRecording\x20not\x20found','unlink','message','Not\x20found','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path'];(function(_0x13e197,_0x21b487){var _0x187cdc=function(_0x1634b7){while(--_0x1634b7){_0x13e197['push'](_0x13e197['shift']());}};_0x187cdc(++_0x21b487);}(_0xe654,0x1d7));var _0x4e65=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xe654[_0x2dafbe];return _0x58a45a;};'use strict';var pdf=require(_0x4e65('0x0'));var emlformat=require(_0x4e65('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x4e65('0x2'));var jsonpatch=require(_0x4e65('0x3'));var rp=require(_0x4e65('0x4'));var moment=require('moment');var BPromise=require(_0x4e65('0x5'));var Mustache=require(_0x4e65('0x6'));var util=require(_0x4e65('0x7'));var path=require(_0x4e65('0x8'));var sox=require(_0x4e65('0x9'));var csv=require(_0x4e65('0xa'));var ejs=require(_0x4e65('0xb'));var fs=require('fs');var _=require(_0x4e65('0xc'));var squel=require('squel');var crypto=require(_0x4e65('0xd'));var jsforce=require(_0x4e65('0xe'));var deskjs=require(_0x4e65('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x4e65('0x10'));var Redis=require('ioredis');var authService=require(_0x4e65('0x11'));var qs=require(_0x4e65('0x12'));var as=require(_0x4e65('0x13'));var hardwareService=require(_0x4e65('0x14'));var logger=require('../../config/logger')(_0x4e65('0x15'));var utils=require('../../config/utils');var config=require(_0x4e65('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xa60886,_0x3fb948){_0x3fb948=_0x3fb948||0xcc;return function(_0x585165){if(_0x585165){return _0xa60886['sendStatus'](_0x3fb948);}return _0xa60886[_0x4e65('0x17')](_0x3fb948)[_0x4e65('0x18')]();};}function respondWithResult(_0x264901,_0x3312f4){_0x3312f4=_0x3312f4||0xc8;return function(_0x46bb3a){if(_0x46bb3a){return _0x264901[_0x4e65('0x17')](_0x3312f4)[_0x4e65('0x19')](_0x46bb3a);}};}function respondWithFilteredResult(_0x196999,_0x567c4d){return function(_0x508d32){if(_0x508d32){var _0x50b64d=_0x508d32['count'],_0x4cf2f9=_0x567c4d[_0x4e65('0x1a')],_0x56c865=_0x567c4d[_0x4e65('0x1a')]+_0x567c4d[_0x4e65('0x1b')],_0x860682;if(_0x56c865>=_0x50b64d){_0x56c865=_0x50b64d;_0x860682=0xc8;}else{_0x860682=0xce;}_0x196999[_0x4e65('0x17')](_0x860682);return _0x196999['set']('Content-Range',_0x4cf2f9+'-'+_0x56c865+'/'+_0x50b64d)[_0x4e65('0x19')](_0x508d32);}return null;};}function patchUpdates(_0x35d54){return function(_0x393e4b){try{jsonpatch[_0x4e65('0x1c')](_0x393e4b,_0x35d54,!![]);}catch(_0x3bd9f8){return BPromise['reject'](_0x3bd9f8);}return _0x393e4b['save']();};}function saveUpdates(_0x3588ac,_0x418f60){return function(_0x327d22){if(_0x327d22){return _0x327d22[_0x4e65('0x1d')](_0x3588ac)[_0x4e65('0x1e')](function(_0x5273cd){return _0x5273cd;});}return null;};}function removeEntity(_0x211c7f,_0xa023e0){return function(_0x40f38f){if(_0x40f38f){return _0x40f38f[_0x4e65('0x1f')]()[_0x4e65('0x1e')](function(){_0x211c7f[_0x4e65('0x17')](0xcc)[_0x4e65('0x18')]();});}};}function handleEntityNotFound(_0x220756,_0x99481e){return function(_0x2b0e2b){if(!_0x2b0e2b){_0x220756[_0x4e65('0x20')](0x194);}return _0x2b0e2b;};}function handleError(_0x183f97,_0x59ac62){_0x59ac62=_0x59ac62||0x1f4;return function(_0x2054c7){logger[_0x4e65('0x21')](_0x2054c7[_0x4e65('0x22')]);if(_0x2054c7[_0x4e65('0x23')]){delete _0x2054c7['name'];}_0x183f97['status'](_0x59ac62)[_0x4e65('0x24')](_0x2054c7);};}exports[_0x4e65('0x25')]=function(_0x5ea412,_0x41aca0){var _0x4bdea0={},_0x187338={},_0x195c44={'count':0x0,'rows':[]};var _0xde26f6=_[_0x4e65('0x26')](db[_0x4e65('0x27')][_0x4e65('0x28')],function(_0x2834d4){return{'name':_0x2834d4[_0x4e65('0x29')],'type':_0x2834d4[_0x4e65('0x2a')][_0x4e65('0x2b')]};});_0x187338[_0x4e65('0x2c')]=_[_0x4e65('0x26')](_0xde26f6,_0x4e65('0x23'));_0x187338['query']=_[_0x4e65('0x2d')](_0x5ea412[_0x4e65('0x2e')]);_0x187338['filters']=_[_0x4e65('0x2f')](_0x187338[_0x4e65('0x2c')],_0x187338['query']);_0x4bdea0[_0x4e65('0x30')]=_['intersection'](_0x187338[_0x4e65('0x2c')],qs[_0x4e65('0x31')](_0x5ea412[_0x4e65('0x2e')][_0x4e65('0x31')]));_0x4bdea0['attributes']=_0x4bdea0[_0x4e65('0x30')][_0x4e65('0x32')]?_0x4bdea0[_0x4e65('0x30')]:_0x187338[_0x4e65('0x2c')];if(!_0x5ea412['query'][_0x4e65('0x33')](_0x4e65('0x34'))){_0x4bdea0[_0x4e65('0x1b')]=qs[_0x4e65('0x1b')](_0x5ea412['query'][_0x4e65('0x1b')]);_0x4bdea0['offset']=qs[_0x4e65('0x1a')](_0x5ea412[_0x4e65('0x2e')][_0x4e65('0x1a')]);}_0x4bdea0[_0x4e65('0x35')]=qs[_0x4e65('0x36')](_0x5ea412[_0x4e65('0x2e')][_0x4e65('0x36')]);_0x4bdea0[_0x4e65('0x37')]=qs['filters'](_[_0x4e65('0x38')](_0x5ea412[_0x4e65('0x2e')],_0x187338[_0x4e65('0x39')]));if(_0x5ea412[_0x4e65('0x2e')][_0x4e65('0x3a')]){_0x4bdea0[_0x4e65('0x37')]=_['merge'](_0x4bdea0[_0x4e65('0x37')],{'$or':_[_0x4e65('0x26')](_0xde26f6,function(_0x1a186b){if(_0x1a186b[_0x4e65('0x2a')]!==_0x4e65('0x3b')){var _0x1c8c41={};_0x1c8c41[_0x1a186b[_0x4e65('0x23')]]={'$like':'%'+_0x5ea412[_0x4e65('0x2e')]['filter']+'%'};return _0x1c8c41;}})});}_0x4bdea0=_[_0x4e65('0x3c')]({},_0x4bdea0,_0x5ea412[_0x4e65('0x3d')]);var _0x41142c={'where':_0x4bdea0['where']};return db[_0x4e65('0x27')][_0x4e65('0x3e')](_0x41142c)[_0x4e65('0x1e')](function(_0x2c622f){_0x195c44[_0x4e65('0x3e')]=_0x2c622f;if(_0x5ea412[_0x4e65('0x2e')][_0x4e65('0x3f')]){_0x4bdea0[_0x4e65('0x40')]=[{'all':!![]}];}return db[_0x4e65('0x27')]['findAll'](_0x4bdea0);})['then'](function(_0x29b19e){_0x195c44[_0x4e65('0x41')]=_0x29b19e;return _0x195c44;})['then'](respondWithFilteredResult(_0x41aca0,_0x4bdea0))[_0x4e65('0x42')](handleError(_0x41aca0,null));};exports[_0x4e65('0x43')]=function(_0x189ca3,_0x533b2c){var _0x433640={'raw':!![],'where':{'id':_0x189ca3[_0x4e65('0x44')]['id']}},_0x2bd5ae={};_0x2bd5ae[_0x4e65('0x2c')]=_['keys'](db[_0x4e65('0x27')]['rawAttributes']);_0x2bd5ae[_0x4e65('0x2e')]=_[_0x4e65('0x2d')](_0x189ca3[_0x4e65('0x2e')]);_0x2bd5ae[_0x4e65('0x39')]=_[_0x4e65('0x2f')](_0x2bd5ae[_0x4e65('0x2c')],_0x2bd5ae[_0x4e65('0x2e')]);_0x433640[_0x4e65('0x30')]=_[_0x4e65('0x2f')](_0x2bd5ae['model'],qs[_0x4e65('0x31')](_0x189ca3[_0x4e65('0x2e')]['fields']));_0x433640[_0x4e65('0x30')]=_0x433640[_0x4e65('0x30')][_0x4e65('0x32')]?_0x433640[_0x4e65('0x30')]:_0x2bd5ae[_0x4e65('0x2c')];if(_0x189ca3[_0x4e65('0x2e')][_0x4e65('0x3f')]){_0x433640['include']=[{'all':!![]}];}_0x433640=_[_0x4e65('0x3c')]({},_0x433640,_0x189ca3['options']);return db[_0x4e65('0x27')][_0x4e65('0x45')](_0x433640)[_0x4e65('0x1e')](handleEntityNotFound(_0x533b2c,null))[_0x4e65('0x1e')](respondWithResult(_0x533b2c,null))[_0x4e65('0x42')](handleError(_0x533b2c,null));};exports[_0x4e65('0x46')]=function(_0x363810,_0x47bc91){return db[_0x4e65('0x27')][_0x4e65('0x46')](_0x363810['body'],{})[_0x4e65('0x1e')](respondWithResult(_0x47bc91,0xc9))[_0x4e65('0x42')](handleError(_0x47bc91,null));};exports[_0x4e65('0x1d')]=function(_0x4dde3f,_0x48d8ab){if(_0x4dde3f[_0x4e65('0x47')]['id']){delete _0x4dde3f[_0x4e65('0x47')]['id'];}return db[_0x4e65('0x27')]['find']({'where':{'id':_0x4dde3f[_0x4e65('0x44')]['id']}})[_0x4e65('0x1e')](handleEntityNotFound(_0x48d8ab,null))['then'](saveUpdates(_0x4dde3f[_0x4e65('0x47')],null))[_0x4e65('0x1e')](respondWithResult(_0x48d8ab,null))[_0x4e65('0x42')](handleError(_0x48d8ab,null));};exports[_0x4e65('0x48')]=function(_0x27c988,_0x1bd810,_0x3b0b47){var _0x3699ee=require(_0x4e65('0x49'));var _0x759699=![];var _0xfb5176={};if(_0x27c988[_0x4e65('0x2e')][_0x4e65('0x2a')]&&_0x27c988['query']['type']===_0x4e65('0x4a')){_0xfb5176['uniqueid']=_0x27c988['params']['id'];}else{_0xfb5176['id']=_0x27c988[_0x4e65('0x44')]['id'];}return db[_0x4e65('0x27')]['find']({'where':_0xfb5176,'attributes':['id',_0x4e65('0x4b'),_0x4e65('0x4c')],'raw':!![]})[_0x4e65('0x1e')](handleEntityNotFound(_0x1bd810,null))[_0x4e65('0x1e')](function(_0x41701b){if(_0x41701b){var _0x10c197=_0x41701b['savePath'];var _0x291e34=util[_0x4e65('0x4d')](_0x4e65('0x4e'),_0x10c197);if(fs[_0x4e65('0x4f')](_0x291e34)){_0x759699=!![];return _0x3699ee[_0x4e65('0x50')](_0x291e34,_0x10c197,config[_0x4e65('0x51')][_0x4e65('0x52')])[_0x4e65('0x1e')](function(){return _0x41701b;});}return _0x41701b;}})['then'](function(_0x3ddb81){if(_0x3ddb81){var _0x429e18=_0x3ddb81[_0x4e65('0x4b')];if(!fs[_0x4e65('0x4f')](_0x429e18)){throw new db['Sequelize'][(_0x4e65('0x53'))](_0x4e65('0x54'));}if(_0x3ddb81[_0x4e65('0x4c')]){return _0x1bd810[_0x4e65('0x48')](_0x429e18,_0x3ddb81[_0x4e65('0x4c')]+path['extname'](_0x429e18),function(){if(_0x759699){fs[_0x4e65('0x55')](_0x429e18);}});}else{return _0x1bd810[_0x4e65('0x48')](_0x429e18,function(_0x330d86){if(_0x759699){fs[_0x4e65('0x55')](_0x429e18);}});}}})[_0x4e65('0x42')](function(_0x144782){if(_0x144782[_0x4e65('0x56')]===_0x4e65('0x54')){_0x1bd810['status'](0x194)['send'](_0x4e65('0x57'));}else{return handleError(_0x1bd810,null);}});};exports[_0x4e65('0x1f')]=function(_0x48f8c7,_0x28398d){return db[_0x4e65('0x27')][_0x4e65('0x45')]({'where':{'id':_0x48f8c7[_0x4e65('0x44')]['id']}})[_0x4e65('0x1e')](function(_0x22be42){if(!_0x22be42)throw new ReferenceError(_0x4e65('0x58'));return _0x22be42;})[_0x4e65('0x1e')](function(_0x5c782f){var _0x2cda8f=_0x5c782f[_0x4e65('0x4b')];logger[_0x4e65('0x59')](_0x4e65('0x5a'),_0x2cda8f);if(!_[_0x4e65('0x5b')](_0x5c782f['savePath'])&&fs['existsSync'](_0x2cda8f)){logger[_0x4e65('0x59')](_0x4e65('0x5c')+_0x2cda8f+_0x4e65('0x5d'));fs[_0x4e65('0x5e')](_0x2cda8f);}_0x2cda8f=_0x2cda8f+_0x4e65('0x5f');if(!_[_0x4e65('0x5b')](_0x5c782f[_0x4e65('0x4b')])&&fs['existsSync'](_0x2cda8f)){logger[_0x4e65('0x59')](_0x4e65('0x5c')+_0x2cda8f+_0x4e65('0x5d'));fs['unlinkSync'](_0x2cda8f);}return _0x5c782f;})['then'](function(_0x2f1926){if(!_0x2f1926)throw new InternalError();return _0x2f1926['destroy']();})[_0x4e65('0x1e')](function(){_0x28398d[_0x4e65('0x17')](0xcc)[_0x4e65('0x18')]();})['catch'](handleError(_0x28398d,null));}; \ No newline at end of file +var _0x6068=['apply','reject','save','update','then','error','stack','name','send','index','map','rawAttributes','fieldName','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','sort','where','pick','merge','type','VIRTUAL','filter','includeAll','SquareRecording','rows','catch','params','length','include','find','create','body','../../components/encryptor','uniqueid','savePath','filename','format','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','SquareRecording\x20not\x20found','download','extname','unlink','message','Not\x20found','destroy','cancellazione\x20fisica\x20documento\x20%s','isNil','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','sendStatus','end','status','json','count','offset','limit','set','Content-Range'];(function(_0x2cf256,_0x136276){var _0x48533f=function(_0x76f2e5){while(--_0x76f2e5){_0x2cf256['push'](_0x2cf256['shift']());}};_0x48533f(++_0x136276);}(_0x6068,0xfc));var _0x8606=function(_0x4ca76e,_0xb44607){_0x4ca76e=_0x4ca76e-0x0;var _0x1a670a=_0x6068[_0x4ca76e];return _0x1a670a;};'use strict';var pdf=require(_0x8606('0x0'));var emlformat=require(_0x8606('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x8606('0x2'));var jsonpatch=require(_0x8606('0x3'));var rp=require(_0x8606('0x4'));var moment=require(_0x8606('0x5'));var BPromise=require(_0x8606('0x6'));var Mustache=require(_0x8606('0x7'));var util=require('util');var path=require(_0x8606('0x8'));var sox=require(_0x8606('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x8606('0xa'));var squel=require(_0x8606('0xb'));var crypto=require(_0x8606('0xc'));var jsforce=require(_0x8606('0xd'));var deskjs=require(_0x8606('0xe'));var toCsv=require(_0x8606('0xf'));var querystring=require('querystring');var Papa=require(_0x8606('0x10'));var Redis=require('ioredis');var authService=require(_0x8606('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8606('0x12'));var logger=require(_0x8606('0x13'))('api');var utils=require(_0x8606('0x14'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x288631,_0x148850){_0x148850=_0x148850||0xcc;return function(_0x5d738b){if(_0x5d738b){return _0x288631[_0x8606('0x15')](_0x148850);}return _0x288631['status'](_0x148850)[_0x8606('0x16')]();};}function respondWithResult(_0x2c9dc8,_0x33af07){_0x33af07=_0x33af07||0xc8;return function(_0x234e70){if(_0x234e70){return _0x2c9dc8[_0x8606('0x17')](_0x33af07)[_0x8606('0x18')](_0x234e70);}};}function respondWithFilteredResult(_0x5d348b,_0x5abb75){return function(_0x260aff){if(_0x260aff){var _0x55e42e=_0x260aff[_0x8606('0x19')],_0x8d7904=_0x5abb75[_0x8606('0x1a')],_0x5df997=_0x5abb75[_0x8606('0x1a')]+_0x5abb75[_0x8606('0x1b')],_0x2ce6a2;if(_0x5df997>=_0x55e42e){_0x5df997=_0x55e42e;_0x2ce6a2=0xc8;}else{_0x2ce6a2=0xce;}_0x5d348b['status'](_0x2ce6a2);return _0x5d348b[_0x8606('0x1c')](_0x8606('0x1d'),_0x8d7904+'-'+_0x5df997+'/'+_0x55e42e)['json'](_0x260aff);}return null;};}function patchUpdates(_0x5ccc80){return function(_0x1e5cda){try{jsonpatch[_0x8606('0x1e')](_0x1e5cda,_0x5ccc80,!![]);}catch(_0x4d3173){return BPromise[_0x8606('0x1f')](_0x4d3173);}return _0x1e5cda[_0x8606('0x20')]();};}function saveUpdates(_0x14c699,_0x2efb32){return function(_0x2d5982){if(_0x2d5982){return _0x2d5982[_0x8606('0x21')](_0x14c699)[_0x8606('0x22')](function(_0xcddf48){return _0xcddf48;});}return null;};}function removeEntity(_0x59d024,_0x756a52){return function(_0x3093be){if(_0x3093be){return _0x3093be['destroy']()['then'](function(){_0x59d024[_0x8606('0x17')](0xcc)[_0x8606('0x16')]();});}};}function handleEntityNotFound(_0x5e6106,_0x2143a3){return function(_0x17ab4d){if(!_0x17ab4d){_0x5e6106[_0x8606('0x15')](0x194);}return _0x17ab4d;};}function handleError(_0x3b2290,_0x385293){_0x385293=_0x385293||0x1f4;return function(_0x3a11d7){logger[_0x8606('0x23')](_0x3a11d7[_0x8606('0x24')]);if(_0x3a11d7[_0x8606('0x25')]){delete _0x3a11d7[_0x8606('0x25')];}_0x3b2290[_0x8606('0x17')](_0x385293)[_0x8606('0x26')](_0x3a11d7);};}exports[_0x8606('0x27')]=function(_0x21406c,_0x213cb6){var _0x5909fd={},_0x54d7ed={},_0x4e27d7={'count':0x0,'rows':[]};var _0x406b5f=_[_0x8606('0x28')](db['SquareRecording'][_0x8606('0x29')],function(_0x143f31){return{'name':_0x143f31[_0x8606('0x2a')],'type':_0x143f31['type']['key']};});_0x54d7ed['model']=_['map'](_0x406b5f,'name');_0x54d7ed[_0x8606('0x2b')]=_[_0x8606('0x2c')](_0x21406c[_0x8606('0x2b')]);_0x54d7ed[_0x8606('0x2d')]=_[_0x8606('0x2e')](_0x54d7ed[_0x8606('0x2f')],_0x54d7ed[_0x8606('0x2b')]);_0x5909fd[_0x8606('0x30')]=_[_0x8606('0x2e')](_0x54d7ed[_0x8606('0x2f')],qs[_0x8606('0x31')](_0x21406c['query'][_0x8606('0x31')]));_0x5909fd['attributes']=_0x5909fd[_0x8606('0x30')]['length']?_0x5909fd['attributes']:_0x54d7ed[_0x8606('0x2f')];if(!_0x21406c[_0x8606('0x2b')][_0x8606('0x32')]('nolimit')){_0x5909fd[_0x8606('0x1b')]=qs[_0x8606('0x1b')](_0x21406c[_0x8606('0x2b')]['limit']);_0x5909fd['offset']=qs[_0x8606('0x1a')](_0x21406c[_0x8606('0x2b')][_0x8606('0x1a')]);}_0x5909fd['order']=qs[_0x8606('0x33')](_0x21406c[_0x8606('0x2b')][_0x8606('0x33')]);_0x5909fd[_0x8606('0x34')]=qs[_0x8606('0x2d')](_[_0x8606('0x35')](_0x21406c[_0x8606('0x2b')],_0x54d7ed['filters']));if(_0x21406c[_0x8606('0x2b')]['filter']){_0x5909fd[_0x8606('0x34')]=_[_0x8606('0x36')](_0x5909fd['where'],{'$or':_[_0x8606('0x28')](_0x406b5f,function(_0x488eba){if(_0x488eba[_0x8606('0x37')]!==_0x8606('0x38')){var _0x5afa6e={};_0x5afa6e[_0x488eba['name']]={'$like':'%'+_0x21406c[_0x8606('0x2b')][_0x8606('0x39')]+'%'};return _0x5afa6e;}})});}_0x5909fd=_[_0x8606('0x36')]({},_0x5909fd,_0x21406c['options']);var _0xc5a6fb={'where':_0x5909fd['where']};return db['SquareRecording']['count'](_0xc5a6fb)[_0x8606('0x22')](function(_0x35a50c){_0x4e27d7['count']=_0x35a50c;if(_0x21406c[_0x8606('0x2b')][_0x8606('0x3a')]){_0x5909fd['include']=[{'all':!![]}];}return db[_0x8606('0x3b')]['findAll'](_0x5909fd);})[_0x8606('0x22')](function(_0x3fbc82){_0x4e27d7[_0x8606('0x3c')]=_0x3fbc82;return _0x4e27d7;})[_0x8606('0x22')](respondWithFilteredResult(_0x213cb6,_0x5909fd))[_0x8606('0x3d')](handleError(_0x213cb6,null));};exports['show']=function(_0x4b21ac,_0x584f3b){var _0x4a0cf7={'raw':!![],'where':{'id':_0x4b21ac[_0x8606('0x3e')]['id']}},_0x2f2c18={};_0x2f2c18[_0x8606('0x2f')]=_[_0x8606('0x2c')](db['SquareRecording'][_0x8606('0x29')]);_0x2f2c18[_0x8606('0x2b')]=_['keys'](_0x4b21ac[_0x8606('0x2b')]);_0x2f2c18['filters']=_[_0x8606('0x2e')](_0x2f2c18[_0x8606('0x2f')],_0x2f2c18[_0x8606('0x2b')]);_0x4a0cf7[_0x8606('0x30')]=_[_0x8606('0x2e')](_0x2f2c18[_0x8606('0x2f')],qs[_0x8606('0x31')](_0x4b21ac[_0x8606('0x2b')][_0x8606('0x31')]));_0x4a0cf7['attributes']=_0x4a0cf7[_0x8606('0x30')][_0x8606('0x3f')]?_0x4a0cf7[_0x8606('0x30')]:_0x2f2c18['model'];if(_0x4b21ac[_0x8606('0x2b')][_0x8606('0x3a')]){_0x4a0cf7[_0x8606('0x40')]=[{'all':!![]}];}_0x4a0cf7=_['merge']({},_0x4a0cf7,_0x4b21ac['options']);return db[_0x8606('0x3b')][_0x8606('0x41')](_0x4a0cf7)['then'](handleEntityNotFound(_0x584f3b,null))['then'](respondWithResult(_0x584f3b,null))[_0x8606('0x3d')](handleError(_0x584f3b,null));};exports[_0x8606('0x42')]=function(_0x3b413c,_0x5def24){return db[_0x8606('0x3b')][_0x8606('0x42')](_0x3b413c[_0x8606('0x43')],{})['then'](respondWithResult(_0x5def24,0xc9))['catch'](handleError(_0x5def24,null));};exports[_0x8606('0x21')]=function(_0x2a5aab,_0x5e1c77){if(_0x2a5aab[_0x8606('0x43')]['id']){delete _0x2a5aab[_0x8606('0x43')]['id'];}return db[_0x8606('0x3b')][_0x8606('0x41')]({'where':{'id':_0x2a5aab[_0x8606('0x3e')]['id']}})[_0x8606('0x22')](handleEntityNotFound(_0x5e1c77,null))[_0x8606('0x22')](saveUpdates(_0x2a5aab[_0x8606('0x43')],null))['then'](respondWithResult(_0x5e1c77,null))[_0x8606('0x3d')](handleError(_0x5e1c77,null));};exports['download']=function(_0x36ba83,_0x2c381f,_0x5ad946){var _0x1f19d3=require(_0x8606('0x44'));var _0x1a8511=![];var _0x34ee09={};if(_0x36ba83[_0x8606('0x2b')][_0x8606('0x37')]&&_0x36ba83[_0x8606('0x2b')][_0x8606('0x37')]==='uniqueid'){_0x34ee09[_0x8606('0x45')]=_0x36ba83['params']['id'];}else{_0x34ee09['id']=_0x36ba83['params']['id'];}return db['SquareRecording'][_0x8606('0x41')]({'where':_0x34ee09,'attributes':['id',_0x8606('0x46'),_0x8606('0x47')],'raw':!![]})[_0x8606('0x22')](handleEntityNotFound(_0x2c381f,null))['then'](function(_0x294390){if(_0x294390){var _0x22340d=_0x294390[_0x8606('0x46')];var _0xc02388=util[_0x8606('0x48')](_0x8606('0x49'),_0x22340d);if(fs[_0x8606('0x4a')](_0xc02388)){_0x1a8511=!![];return _0x1f19d3[_0x8606('0x4b')](_0xc02388,_0x22340d,config[_0x8606('0x4c')][_0x8606('0x4d')])[_0x8606('0x22')](function(){return _0x294390;});}return _0x294390;}})['then'](function(_0x11947e){if(_0x11947e){var _0x1be6da=_0x11947e[_0x8606('0x46')];if(!fs[_0x8606('0x4a')](_0x1be6da)){throw new db[(_0x8606('0x4e'))][(_0x8606('0x4f'))](_0x8606('0x50'));}if(_0x11947e['filename']){return _0x2c381f[_0x8606('0x51')](_0x1be6da,_0x11947e['filename']+path[_0x8606('0x52')](_0x1be6da),function(){if(_0x1a8511){fs[_0x8606('0x53')](_0x1be6da);}});}else{return _0x2c381f[_0x8606('0x51')](_0x1be6da,function(_0x34f6f3){if(_0x1a8511){fs[_0x8606('0x53')](_0x1be6da);}});}}})[_0x8606('0x3d')](function(_0x34c814){if(_0x34c814[_0x8606('0x54')]===_0x8606('0x50')){_0x2c381f[_0x8606('0x17')](0x194)[_0x8606('0x26')](_0x8606('0x55'));}else{return handleError(_0x2c381f,null);}});};exports[_0x8606('0x56')]=function(_0x99f01e,_0x53416a){return db[_0x8606('0x3b')]['find']({'where':{'id':_0x99f01e[_0x8606('0x3e')]['id']}})[_0x8606('0x22')](function(_0x178fc6){if(!_0x178fc6)throw new ReferenceError('Entity\x20not\x20found');return _0x178fc6;})['then'](function(_0x5ef1e9){var _0x2ecc3c=_0x5ef1e9['savePath'];logger['info'](_0x8606('0x57'),_0x2ecc3c);if(!_[_0x8606('0x58')](_0x5ef1e9['savePath'])&&fs[_0x8606('0x4a')](_0x2ecc3c)){logger[_0x8606('0x59')](_0x8606('0x5a')+_0x2ecc3c+_0x8606('0x5b'));fs[_0x8606('0x5c')](_0x2ecc3c);}_0x2ecc3c=_0x2ecc3c+_0x8606('0x5d');if(!_[_0x8606('0x58')](_0x5ef1e9['savePath'])&&fs[_0x8606('0x4a')](_0x2ecc3c)){logger[_0x8606('0x59')](_0x8606('0x5a')+_0x2ecc3c+_0x8606('0x5b'));fs[_0x8606('0x5c')](_0x2ecc3c);}return _0x5ef1e9;})[_0x8606('0x22')](function(_0x21ca60){if(!_0x21ca60)throw new InternalError();return _0x21ca60['destroy']();})[_0x8606('0x22')](function(){_0x53416a[_0x8606('0x17')](0xcc)[_0x8606('0x16')]();})['catch'](handleError(_0x53416a,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 0bc075c..f0ac0a4 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 _0x3266=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./squareRecording.attributes','define','square_recordings','lodash','util'];(function(_0x44f6fe,_0x4a1864){var _0x28cf00=function(_0x15396d){while(--_0x15396d){_0x44f6fe['push'](_0x44f6fe['shift']());}};_0x28cf00(++_0x4a1864);}(_0x3266,0x6a));var _0x6326=function(_0x14fad0,_0x278d75){_0x14fad0=_0x14fad0-0x0;var _0x5c665f=_0x3266[_0x14fad0];return _0x5c665f;};'use strict';var _=require(_0x6326('0x0'));var util=require(_0x6326('0x1'));var logger=require(_0x6326('0x2'))(_0x6326('0x3'));var moment=require(_0x6326('0x4'));var BPromise=require(_0x6326('0x5'));var rp=require(_0x6326('0x6'));var fs=require('fs');var path=require(_0x6326('0x7'));var rimraf=require(_0x6326('0x8'));var config=require('../../config/environment');var attributes=require(_0x6326('0x9'));module['exports']=function(_0x25ecd8,_0x44460c){return _0x25ecd8[_0x6326('0xa')]('SquareRecording',attributes,{'tableName':_0x6326('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc900=['api','moment','request-promise','path','../../config/environment','./squareRecording.attributes','exports','define','square_recordings','../../config/logger'];(function(_0x3a7634,_0x2db384){var _0x23bbe9=function(_0x226734){while(--_0x226734){_0x3a7634['push'](_0x3a7634['shift']());}};_0x23bbe9(++_0x2db384);}(_0xc900,0xb3));var _0x0c90=function(_0xa4f137,_0x3e2b54){_0xa4f137=_0xa4f137-0x0;var _0xec3c94=_0xc900[_0xa4f137];return _0xec3c94;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0c90('0x0'))(_0x0c90('0x1'));var moment=require(_0x0c90('0x2'));var BPromise=require('bluebird');var rp=require(_0x0c90('0x3'));var fs=require('fs');var path=require(_0x0c90('0x4'));var rimraf=require('rimraf');var config=require(_0x0c90('0x5'));var attributes=require(_0x0c90('0x6'));module[_0x0c90('0x7')]=function(_0x718a5c,_0x42f9a3){return _0x718a5c[_0x0c90('0x8')]('SquareRecording',attributes,{'tableName':_0x0c90('0x9'),'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 f375750..fd05751 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 _0x03d8=['http','request','then','info','SquareRecording,\x20%s,\x20%s','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSquareRecording','SquareRecording','create','options','raw','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client'];(function(_0x1e6e4e,_0x2b1b09){var _0x3d746b=function(_0x4483dd){while(--_0x4483dd){_0x1e6e4e['push'](_0x1e6e4e['shift']());}};_0x3d746b(++_0x2b1b09);}(_0x03d8,0x1ed));var _0x803d=function(_0x68cae0,_0x7d78cd){_0x68cae0=_0x68cae0-0x0;var _0x5e7200=_0x03d8[_0x68cae0];return _0x5e7200;};'use strict';var _=require(_0x803d('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x803d('0x1'));var fs=require('fs');var Redis=require(_0x803d('0x2'));var db=require(_0x803d('0x3'))['db'];var utils=require(_0x803d('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x803d('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x803d('0x6')][_0x803d('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x950934,_0x2bf82f,_0x4ff3ac){return new BPromise(function(_0xd6cfc,_0x21d920){return client[_0x803d('0x8')](_0x950934,_0x4ff3ac)[_0x803d('0x9')](function(_0x2bdbfd){logger[_0x803d('0xa')](_0x803d('0xb'),_0x2bf82f,'request\x20sent');logger[_0x803d('0xc')](_0x803d('0xd'),_0x2bf82f,'request\x20sent',JSON[_0x803d('0xe')](_0x2bdbfd));if(_0x2bdbfd[_0x803d('0xf')]){if(_0x2bdbfd[_0x803d('0xf')][_0x803d('0x10')]===0x1f4){logger[_0x803d('0xf')](_0x803d('0xb'),_0x2bf82f,_0x2bdbfd[_0x803d('0xf')][_0x803d('0x11')]);return _0x21d920(_0x2bdbfd[_0x803d('0xf')]['message']);}logger[_0x803d('0xf')](_0x803d('0xb'),_0x2bf82f,_0x2bdbfd[_0x803d('0xf')][_0x803d('0x11')]);return _0xd6cfc(_0x2bdbfd[_0x803d('0xf')][_0x803d('0x11')]);}else{logger[_0x803d('0xa')]('SquareRecording,\x20%s,\x20%s',_0x2bf82f,'request\x20sent');_0xd6cfc(_0x2bdbfd[_0x803d('0x12')][_0x803d('0x11')]);}})[_0x803d('0x13')](function(_0x5ec2de){logger[_0x803d('0xf')](_0x803d('0xb'),_0x2bf82f,_0x5ec2de);_0x21d920(_0x5ec2de);});});}exports[_0x803d('0x14')]=function(_0x37fbcd){var _0x4b0456=this;return new Promise(function(_0x558f2b,_0x32740a){return db[_0x803d('0x15')][_0x803d('0x16')](_0x37fbcd['body'],{'raw':_0x37fbcd[_0x803d('0x17')]?_0x37fbcd[_0x803d('0x17')][_0x803d('0x18')]===undefined?!![]:![]:!![]})[_0x803d('0x9')](function(_0x14c18d){logger['info']('CreateSquareRecording',_0x37fbcd);logger[_0x803d('0xc')](_0x803d('0x14'),_0x37fbcd,JSON[_0x803d('0xe')](_0x14c18d));_0x558f2b(_0x14c18d);})[_0x803d('0x13')](function(_0x2d4ca8){logger[_0x803d('0xf')]('CreateSquareRecording',_0x2d4ca8[_0x803d('0x11')],_0x37fbcd);_0x32740a(_0x4b0456[_0x803d('0xf')](0x1f4,_0x2d4ca8[_0x803d('0x11')]));});});}; \ No newline at end of file +var _0x4e18=['request','then','info','SquareRecording,\x20%s,\x20%s','debug','SquareRecording,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','CreateSquareRecording','SquareRecording','create','body','options','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0x4e18,0x1c0));var _0x84e1=function(_0x2f3ecd,_0x57976b){_0x2f3ecd=_0x2f3ecd-0x0;var _0xffdc44=_0x4e18[_0x2f3ecd];return _0xffdc44;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x84e1('0x0'));var BPromise=require('bluebird');var rs=require(_0x84e1('0x1'));var fs=require('fs');var Redis=require(_0x84e1('0x2'));var db=require(_0x84e1('0x3'))['db'];var utils=require(_0x84e1('0x4'));var logger=require(_0x84e1('0x5'))(_0x84e1('0x6'));var config=require(_0x84e1('0x7'));var jayson=require(_0x84e1('0x8'));var client=jayson[_0x84e1('0x9')][_0x84e1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1ab74c,_0x65b6a9,_0x25a8b5){return new BPromise(function(_0x4be0b3,_0x3818a6){return client[_0x84e1('0xb')](_0x1ab74c,_0x25a8b5)[_0x84e1('0xc')](function(_0x54048d){logger[_0x84e1('0xd')](_0x84e1('0xe'),_0x65b6a9,'request\x20sent');logger[_0x84e1('0xf')](_0x84e1('0x10'),_0x65b6a9,_0x84e1('0x11'),JSON[_0x84e1('0x12')](_0x54048d));if(_0x54048d[_0x84e1('0x13')]){if(_0x54048d[_0x84e1('0x13')]['code']===0x1f4){logger['error'](_0x84e1('0xe'),_0x65b6a9,_0x54048d[_0x84e1('0x13')][_0x84e1('0x14')]);return _0x3818a6(_0x54048d[_0x84e1('0x13')][_0x84e1('0x14')]);}logger[_0x84e1('0x13')]('SquareRecording,\x20%s,\x20%s',_0x65b6a9,_0x54048d[_0x84e1('0x13')][_0x84e1('0x14')]);return _0x4be0b3(_0x54048d[_0x84e1('0x13')][_0x84e1('0x14')]);}else{logger[_0x84e1('0xd')](_0x84e1('0xe'),_0x65b6a9,_0x84e1('0x11'));_0x4be0b3(_0x54048d['result']['message']);}})[_0x84e1('0x15')](function(_0x146cb8){logger[_0x84e1('0x13')](_0x84e1('0xe'),_0x65b6a9,_0x146cb8);_0x3818a6(_0x146cb8);});});}exports[_0x84e1('0x16')]=function(_0x1ce40b){var _0x1e73d4=this;return new Promise(function(_0x4ecf23,_0x15c8ab){return db[_0x84e1('0x17')][_0x84e1('0x18')](_0x1ce40b[_0x84e1('0x19')],{'raw':_0x1ce40b[_0x84e1('0x1a')]?_0x1ce40b['options']['raw']===undefined?!![]:![]:!![]})[_0x84e1('0xc')](function(_0x3017a6){logger[_0x84e1('0xd')](_0x84e1('0x16'),_0x1ce40b);logger['debug'](_0x84e1('0x16'),_0x1ce40b,JSON[_0x84e1('0x12')](_0x3017a6));_0x4ecf23(_0x3017a6);})[_0x84e1('0x15')](function(_0x2d4453){logger[_0x84e1('0x13')]('CreateSquareRecording',_0x2d4453['message'],_0x1ce40b);_0x15c8ab(_0x1e73d4[_0x84e1('0x13')](0x1f4,_0x2d4453[_0x84e1('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 9fc8121..e2b6c2b 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 _0x32ec=['express','../../components/interaction/service','./squareReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create','update','delete','destroy','exports','multer','path','connect-timeout'];(function(_0x1001bb,_0x4231f7){var _0x343d7b=function(_0x421c47){while(--_0x421c47){_0x1001bb['push'](_0x1001bb['shift']());}};_0x343d7b(++_0x4231f7);}(_0x32ec,0x12f));var _0xc32e=function(_0x48f510,_0x5eee35){_0x48f510=_0x48f510-0x0;var _0xa37637=_0x32ec[_0x48f510];return _0xa37637;};'use strict';var multer=require(_0xc32e('0x0'));var util=require('util');var path=require(_0xc32e('0x1'));var timeout=require(_0xc32e('0x2'));var express=require(_0xc32e('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xc32e('0x4'));var config=require('../../config/environment');var controller=require(_0xc32e('0x5'));router[_0xc32e('0x6')]('/',auth[_0xc32e('0x7')](),controller['index']);router[_0xc32e('0x6')](_0xc32e('0x8'),auth['isAuthenticated'](),controller[_0xc32e('0x9')]);router[_0xc32e('0x6')](_0xc32e('0xa'),auth['isAuthenticated'](),controller[_0xc32e('0xb')]);router[_0xc32e('0xc')]('/',auth[_0xc32e('0x7')](),controller[_0xc32e('0xd')]);router['put'](_0xc32e('0xa'),auth[_0xc32e('0x7')](),controller[_0xc32e('0xe')]);router[_0xc32e('0xf')]('/:id',auth[_0xc32e('0x7')](),controller[_0xc32e('0x10')]);module[_0xc32e('0x11')]=router; \ No newline at end of file +var _0xd56f=['./squareReport.controller','get','isAuthenticated','index','/describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x411ddc,_0x84e6a0){var _0x159636=function(_0x5343f6){while(--_0x5343f6){_0x411ddc['push'](_0x411ddc['shift']());}};_0x159636(++_0x84e6a0);}(_0xd56f,0x1f2));var _0xfd56=function(_0x22b6e5,_0x2819c8){_0x22b6e5=_0x22b6e5-0x0;var _0x1c21e5=_0xd56f[_0x22b6e5];return _0x1c21e5;};'use strict';var multer=require(_0xfd56('0x0'));var util=require(_0xfd56('0x1'));var path=require(_0xfd56('0x2'));var timeout=require(_0xfd56('0x3'));var express=require(_0xfd56('0x4'));var router=express[_0xfd56('0x5')]();var auth=require(_0xfd56('0x6'));var interaction=require(_0xfd56('0x7'));var config=require('../../config/environment');var controller=require(_0xfd56('0x8'));router[_0xfd56('0x9')]('/',auth[_0xfd56('0xa')](),controller[_0xfd56('0xb')]);router[_0xfd56('0x9')](_0xfd56('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0xfd56('0x9')](_0xfd56('0xd'),auth[_0xfd56('0xa')](),controller[_0xfd56('0xe')]);router[_0xfd56('0xf')]('/',auth[_0xfd56('0xa')](),controller[_0xfd56('0x10')]);router[_0xfd56('0x11')](_0xfd56('0xd'),auth[_0xfd56('0xa')](),controller[_0xfd56('0x12')]);router[_0xfd56('0x13')]('/:id',auth[_0xfd56('0xa')](),controller[_0xfd56('0x14')]);module[_0xfd56('0x15')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index 195ffe9..c4e2b64 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 _0x448f=['exports','STRING','DATE','BOOLEAN','sequelize'];(function(_0x57ccc9,_0x23c47d){var _0x3eab71=function(_0x56ef92){while(--_0x56ef92){_0x57ccc9['push'](_0x57ccc9['shift']());}};_0x3eab71(++_0x23c47d);}(_0x448f,0x17b));var _0xf448=function(_0x28ab2c,_0x4b8e37){_0x28ab2c=_0x28ab2c-0x0;var _0x203d40=_0x448f[_0x28ab2c];return _0x203d40;};'use strict';var Sequelize=require(_0xf448('0x0'));module[_0xf448('0x1')]={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize[_0xf448('0x2')]},'request':{'type':Sequelize[_0xf448('0x2')]},'channel':{'type':Sequelize[_0xf448('0x2')]},'language':{'type':Sequelize[_0xf448('0x2')]},'type':{'type':Sequelize[_0xf448('0x2')]},'uniqueid':{'type':Sequelize[_0xf448('0x2')]},'version':{'type':Sequelize[_0xf448('0x2')]},'callerid':{'type':Sequelize[_0xf448('0x2')]},'calleridname':{'type':Sequelize[_0xf448('0x2')]},'callingpres':{'type':Sequelize[_0xf448('0x2')]},'callingani2':{'type':Sequelize[_0xf448('0x2')]},'callington':{'type':Sequelize[_0xf448('0x2')]},'callingtns':{'type':Sequelize[_0xf448('0x2')]},'dnid':{'type':Sequelize['STRING']},'rdnis':{'type':Sequelize[_0xf448('0x2')]},'context':{'type':Sequelize[_0xf448('0x2')]},'extension':{'type':Sequelize[_0xf448('0x2')]},'priority':{'type':Sequelize['STRING']},'enhanced':{'type':Sequelize[_0xf448('0x2')]},'accountcode':{'type':Sequelize[_0xf448('0x2')]},'threadid':{'type':Sequelize['STRING']},'project_name':{'type':Sequelize[_0xf448('0x2')]},'joinAt':{'type':Sequelize[_0xf448('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'bot':{'type':Sequelize[_0xf448('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0x18bb=['BOOLEAN','sequelize','STRING','DATE'];(function(_0x2e9e81,_0x7821d4){var _0x2f187b=function(_0x454354){while(--_0x454354){_0x2e9e81['push'](_0x2e9e81['shift']());}};_0x2f187b(++_0x7821d4);}(_0x18bb,0x15d));var _0xb18b=function(_0x3e3f27,_0x2c2ecf){_0x3e3f27=_0x3e3f27-0x0;var _0x15c868=_0x18bb[_0x3e3f27];return _0x15c868;};'use strict';var Sequelize=require(_0xb18b('0x0'));module['exports']={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize[_0xb18b('0x1')]},'request':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xb18b('0x1')]},'language':{'type':Sequelize[_0xb18b('0x1')]},'type':{'type':Sequelize[_0xb18b('0x1')]},'uniqueid':{'type':Sequelize[_0xb18b('0x1')]},'version':{'type':Sequelize[_0xb18b('0x1')]},'callerid':{'type':Sequelize[_0xb18b('0x1')]},'calleridname':{'type':Sequelize['STRING']},'callingpres':{'type':Sequelize['STRING']},'callingani2':{'type':Sequelize[_0xb18b('0x1')]},'callington':{'type':Sequelize[_0xb18b('0x1')]},'callingtns':{'type':Sequelize[_0xb18b('0x1')]},'dnid':{'type':Sequelize[_0xb18b('0x1')]},'rdnis':{'type':Sequelize[_0xb18b('0x1')]},'context':{'type':Sequelize[_0xb18b('0x1')]},'extension':{'type':Sequelize[_0xb18b('0x1')]},'priority':{'type':Sequelize[_0xb18b('0x1')]},'enhanced':{'type':Sequelize[_0xb18b('0x1')]},'accountcode':{'type':Sequelize[_0xb18b('0x1')]},'threadid':{'type':Sequelize['STRING']},'project_name':{'type':Sequelize[_0xb18b('0x1')]},'joinAt':{'type':Sequelize[_0xb18b('0x2')]},'leaveAt':{'type':Sequelize['DATE']},'bot':{'type':Sequelize[_0xb18b('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 a8d7595..a8d7ef5 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 _0x4975=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','sendStatus','status','end','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','SquareReport','fieldName','type','key','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filters','filter','map','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','describe','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','squel','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x5d0e85,_0x28b42d){var _0x57202e=function(_0x5f5582){while(--_0x5f5582){_0x5d0e85['push'](_0x5d0e85['shift']());}};_0x57202e(++_0x28b42d);}(_0x4975,0x86));var _0x5497=function(_0x1b1185,_0x4a4e4d){_0x1b1185=_0x1b1185-0x0;var _0x570baa=_0x4975[_0x1b1185];return _0x570baa;};'use strict';var pdf=require(_0x5497('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x5497('0x1'));var zipdir=require(_0x5497('0x2'));var jsonpatch=require(_0x5497('0x3'));var rp=require(_0x5497('0x4'));var moment=require(_0x5497('0x5'));var BPromise=require(_0x5497('0x6'));var Mustache=require(_0x5497('0x7'));var util=require(_0x5497('0x8'));var path=require(_0x5497('0x9'));var sox=require(_0x5497('0xa'));var csv=require('to-csv');var ejs=require(_0x5497('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x5497('0xc'));var crypto=require(_0x5497('0xd'));var jsforce=require(_0x5497('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x5497('0xf'));var querystring=require('querystring');var Papa=require(_0x5497('0x10'));var Redis=require(_0x5497('0x11'));var authService=require(_0x5497('0x12'));var qs=require(_0x5497('0x13'));var as=require(_0x5497('0x14'));var hardwareService=require(_0x5497('0x15'));var logger=require(_0x5497('0x16'))(_0x5497('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xc250bb,_0x1b23df){_0x1b23df=_0x1b23df||0xcc;return function(_0x1bb794){if(_0x1bb794){return _0xc250bb[_0x5497('0x18')](_0x1b23df);}return _0xc250bb[_0x5497('0x19')](_0x1b23df)[_0x5497('0x1a')]();};}function respondWithResult(_0x1f7169,_0xaca97d){_0xaca97d=_0xaca97d||0xc8;return function(_0x363a5b){if(_0x363a5b){return _0x1f7169[_0x5497('0x19')](_0xaca97d)['json'](_0x363a5b);}};}function respondWithFilteredResult(_0x11b0a9,_0x4fb8e9){return function(_0x4237a9){if(_0x4237a9){var _0x2bfd8a=_0x4237a9[_0x5497('0x1b')],_0x19e5f3=_0x4fb8e9[_0x5497('0x1c')],_0x3ce50b=_0x4fb8e9['offset']+_0x4fb8e9['limit'],_0x37c18e;if(_0x3ce50b>=_0x2bfd8a){_0x3ce50b=_0x2bfd8a;_0x37c18e=0xc8;}else{_0x37c18e=0xce;}_0x11b0a9[_0x5497('0x19')](_0x37c18e);return _0x11b0a9[_0x5497('0x1d')](_0x5497('0x1e'),_0x19e5f3+'-'+_0x3ce50b+'/'+_0x2bfd8a)['json'](_0x4237a9);}return null;};}function patchUpdates(_0xbf1ba7){return function(_0xcbd71d){try{jsonpatch[_0x5497('0x1f')](_0xcbd71d,_0xbf1ba7,!![]);}catch(_0x43da2c){return BPromise[_0x5497('0x20')](_0x43da2c);}return _0xcbd71d[_0x5497('0x21')]();};}function saveUpdates(_0x16d378,_0x10226f){return function(_0x2e3960){if(_0x2e3960){return _0x2e3960[_0x5497('0x22')](_0x16d378)[_0x5497('0x23')](function(_0x52c049){return _0x52c049;});}return null;};}function removeEntity(_0x720767,_0x4d1b27){return function(_0x19200a){if(_0x19200a){return _0x19200a[_0x5497('0x24')]()[_0x5497('0x23')](function(){_0x720767[_0x5497('0x19')](0xcc)[_0x5497('0x1a')]();});}};}function handleEntityNotFound(_0x3b2fbc,_0x5018fa){return function(_0x54043a){if(!_0x54043a){_0x3b2fbc[_0x5497('0x18')](0x194);}return _0x54043a;};}function handleError(_0x34b97f,_0x24482a){_0x24482a=_0x24482a||0x1f4;return function(_0x281155){logger['error'](_0x281155[_0x5497('0x25')]);if(_0x281155['name']){delete _0x281155[_0x5497('0x26')];}_0x34b97f[_0x5497('0x19')](_0x24482a)[_0x5497('0x27')](_0x281155);};}exports[_0x5497('0x28')]=function(_0x163a30,_0x31cd01){var _0x48b835={},_0x4af5f4={},_0x5406e2={'count':0x0,'rows':[]};var _0x583d06=_['map'](db[_0x5497('0x29')]['rawAttributes'],function(_0x5e9356){return{'name':_0x5e9356[_0x5497('0x2a')],'type':_0x5e9356[_0x5497('0x2b')][_0x5497('0x2c')]};});_0x4af5f4['model']=_['map'](_0x583d06,'name');_0x4af5f4[_0x5497('0x2d')]=_[_0x5497('0x2e')](_0x163a30[_0x5497('0x2d')]);_0x4af5f4['filters']=_['intersection'](_0x4af5f4['model'],_0x4af5f4[_0x5497('0x2d')]);_0x48b835['attributes']=_[_0x5497('0x2f')](_0x4af5f4[_0x5497('0x30')],qs[_0x5497('0x31')](_0x163a30['query'][_0x5497('0x31')]));_0x48b835[_0x5497('0x32')]=_0x48b835['attributes'][_0x5497('0x33')]?_0x48b835[_0x5497('0x32')]:_0x4af5f4[_0x5497('0x30')];if(!_0x163a30['query'][_0x5497('0x34')](_0x5497('0x35'))){_0x48b835[_0x5497('0x36')]=qs[_0x5497('0x36')](_0x163a30[_0x5497('0x2d')]['limit']);_0x48b835[_0x5497('0x1c')]=qs[_0x5497('0x1c')](_0x163a30['query'][_0x5497('0x1c')]);}_0x48b835[_0x5497('0x37')]=qs[_0x5497('0x38')](_0x163a30[_0x5497('0x2d')][_0x5497('0x38')]);_0x48b835[_0x5497('0x39')]=qs['filters'](_[_0x5497('0x3a')](_0x163a30['query'],_0x4af5f4[_0x5497('0x3b')]));if(_0x163a30[_0x5497('0x2d')][_0x5497('0x3c')]){_0x48b835['where']=_['merge'](_0x48b835[_0x5497('0x39')],{'$or':_[_0x5497('0x3d')](_0x583d06,function(_0x326d48){if(_0x326d48[_0x5497('0x2b')]!==_0x5497('0x3e')){var _0xc8a689={};_0xc8a689[_0x326d48['name']]={'$like':'%'+_0x163a30[_0x5497('0x2d')][_0x5497('0x3c')]+'%'};return _0xc8a689;}})});}_0x48b835=_[_0x5497('0x3f')]({},_0x48b835,_0x163a30[_0x5497('0x40')]);var _0x275aa7={'where':_0x48b835[_0x5497('0x39')]};return db[_0x5497('0x29')][_0x5497('0x1b')](_0x275aa7)[_0x5497('0x23')](function(_0x544065){_0x5406e2[_0x5497('0x1b')]=_0x544065;if(_0x163a30[_0x5497('0x2d')][_0x5497('0x41')]){_0x48b835[_0x5497('0x42')]=[{'all':!![]}];}return db[_0x5497('0x29')][_0x5497('0x43')](_0x48b835);})[_0x5497('0x23')](function(_0x59ed13){_0x5406e2[_0x5497('0x44')]=_0x59ed13;return _0x5406e2;})[_0x5497('0x23')](respondWithFilteredResult(_0x31cd01,_0x48b835))[_0x5497('0x45')](handleError(_0x31cd01,null));};exports[_0x5497('0x46')]=function(_0x1b251b,_0x125526){var _0x114471={'raw':!![],'where':{'id':_0x1b251b[_0x5497('0x47')]['id']}},_0x547437={};_0x547437[_0x5497('0x30')]=_[_0x5497('0x2e')](db[_0x5497('0x29')][_0x5497('0x48')]);_0x547437[_0x5497('0x2d')]=_[_0x5497('0x2e')](_0x1b251b[_0x5497('0x2d')]);_0x547437[_0x5497('0x3b')]=_[_0x5497('0x2f')](_0x547437['model'],_0x547437[_0x5497('0x2d')]);_0x114471['attributes']=_[_0x5497('0x2f')](_0x547437[_0x5497('0x30')],qs[_0x5497('0x31')](_0x1b251b[_0x5497('0x2d')][_0x5497('0x31')]));_0x114471['attributes']=_0x114471[_0x5497('0x32')][_0x5497('0x33')]?_0x114471['attributes']:_0x547437[_0x5497('0x30')];if(_0x1b251b['query'][_0x5497('0x41')]){_0x114471['include']=[{'all':!![]}];}_0x114471=_[_0x5497('0x3f')]({},_0x114471,_0x1b251b[_0x5497('0x40')]);return db[_0x5497('0x29')][_0x5497('0x49')](_0x114471)[_0x5497('0x23')](handleEntityNotFound(_0x125526,null))['then'](respondWithResult(_0x125526,null))['catch'](handleError(_0x125526,null));};exports['create']=function(_0x55f654,_0x3cbe4b){return db[_0x5497('0x29')][_0x5497('0x4a')](_0x55f654[_0x5497('0x4b')],{})[_0x5497('0x23')](respondWithResult(_0x3cbe4b,0xc9))[_0x5497('0x45')](handleError(_0x3cbe4b,null));};exports[_0x5497('0x22')]=function(_0x466287,_0x2626bf){if(_0x466287['body']['id']){delete _0x466287[_0x5497('0x4b')]['id'];}return db[_0x5497('0x29')][_0x5497('0x49')]({'where':{'id':_0x466287['params']['id']}})[_0x5497('0x23')](handleEntityNotFound(_0x2626bf,null))['then'](saveUpdates(_0x466287[_0x5497('0x4b')],null))[_0x5497('0x23')](respondWithResult(_0x2626bf,null))[_0x5497('0x45')](handleError(_0x2626bf,null));};exports['destroy']=function(_0x43bebe,_0x356d61){return db['SquareReport'][_0x5497('0x49')]({'where':{'id':_0x43bebe['params']['id']}})[_0x5497('0x23')](handleEntityNotFound(_0x356d61,null))['then'](removeEntity(_0x356d61,null))[_0x5497('0x45')](handleError(_0x356d61,null));};exports[_0x5497('0x4c')]=function(_0x26fd9f,_0xf07541){return db[_0x5497('0x29')][_0x5497('0x4c')]()[_0x5497('0x23')](respondWithResult(_0xf07541,null))[_0x5497('0x45')](handleError(_0xf07541,null));}; \ No newline at end of file +var _0x4975=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','sendStatus','status','end','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','SquareReport','fieldName','type','key','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filters','filter','map','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','describe','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','squel','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x4f9185,_0x50195d){var _0x5c2cf5=function(_0x3a9448){while(--_0x3a9448){_0x4f9185['push'](_0x4f9185['shift']());}};_0x5c2cf5(++_0x50195d);}(_0x4975,0x86));var _0x5497=function(_0x497458,_0x3f233c){_0x497458=_0x497458-0x0;var _0x5b9bdc=_0x4975[_0x497458];return _0x5b9bdc;};'use strict';var pdf=require(_0x5497('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x5497('0x1'));var zipdir=require(_0x5497('0x2'));var jsonpatch=require(_0x5497('0x3'));var rp=require(_0x5497('0x4'));var moment=require(_0x5497('0x5'));var BPromise=require(_0x5497('0x6'));var Mustache=require(_0x5497('0x7'));var util=require(_0x5497('0x8'));var path=require(_0x5497('0x9'));var sox=require(_0x5497('0xa'));var csv=require('to-csv');var ejs=require(_0x5497('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x5497('0xc'));var crypto=require(_0x5497('0xd'));var jsforce=require(_0x5497('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x5497('0xf'));var querystring=require('querystring');var Papa=require(_0x5497('0x10'));var Redis=require(_0x5497('0x11'));var authService=require(_0x5497('0x12'));var qs=require(_0x5497('0x13'));var as=require(_0x5497('0x14'));var hardwareService=require(_0x5497('0x15'));var logger=require(_0x5497('0x16'))(_0x5497('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xc250bb,_0x1b23df){_0x1b23df=_0x1b23df||0xcc;return function(_0x1bb794){if(_0x1bb794){return _0xc250bb[_0x5497('0x18')](_0x1b23df);}return _0xc250bb[_0x5497('0x19')](_0x1b23df)[_0x5497('0x1a')]();};}function respondWithResult(_0x1f7169,_0xaca97d){_0xaca97d=_0xaca97d||0xc8;return function(_0x363a5b){if(_0x363a5b){return _0x1f7169[_0x5497('0x19')](_0xaca97d)['json'](_0x363a5b);}};}function respondWithFilteredResult(_0x11b0a9,_0x4fb8e9){return function(_0x4237a9){if(_0x4237a9){var _0x2bfd8a=_0x4237a9[_0x5497('0x1b')],_0x19e5f3=_0x4fb8e9[_0x5497('0x1c')],_0x3ce50b=_0x4fb8e9['offset']+_0x4fb8e9['limit'],_0x37c18e;if(_0x3ce50b>=_0x2bfd8a){_0x3ce50b=_0x2bfd8a;_0x37c18e=0xc8;}else{_0x37c18e=0xce;}_0x11b0a9[_0x5497('0x19')](_0x37c18e);return _0x11b0a9[_0x5497('0x1d')](_0x5497('0x1e'),_0x19e5f3+'-'+_0x3ce50b+'/'+_0x2bfd8a)['json'](_0x4237a9);}return null;};}function patchUpdates(_0xbf1ba7){return function(_0xcbd71d){try{jsonpatch[_0x5497('0x1f')](_0xcbd71d,_0xbf1ba7,!![]);}catch(_0x43da2c){return BPromise[_0x5497('0x20')](_0x43da2c);}return _0xcbd71d[_0x5497('0x21')]();};}function saveUpdates(_0x16d378,_0x10226f){return function(_0x2e3960){if(_0x2e3960){return _0x2e3960[_0x5497('0x22')](_0x16d378)[_0x5497('0x23')](function(_0x52c049){return _0x52c049;});}return null;};}function removeEntity(_0x720767,_0x4d1b27){return function(_0x19200a){if(_0x19200a){return _0x19200a[_0x5497('0x24')]()[_0x5497('0x23')](function(){_0x720767[_0x5497('0x19')](0xcc)[_0x5497('0x1a')]();});}};}function handleEntityNotFound(_0x3b2fbc,_0x5018fa){return function(_0x54043a){if(!_0x54043a){_0x3b2fbc[_0x5497('0x18')](0x194);}return _0x54043a;};}function handleError(_0x34b97f,_0x24482a){_0x24482a=_0x24482a||0x1f4;return function(_0x281155){logger['error'](_0x281155[_0x5497('0x25')]);if(_0x281155['name']){delete _0x281155[_0x5497('0x26')];}_0x34b97f[_0x5497('0x19')](_0x24482a)[_0x5497('0x27')](_0x281155);};}exports[_0x5497('0x28')]=function(_0x163a30,_0x31cd01){var _0x48b835={},_0x4af5f4={},_0x5406e2={'count':0x0,'rows':[]};var _0x583d06=_['map'](db[_0x5497('0x29')]['rawAttributes'],function(_0x5e9356){return{'name':_0x5e9356[_0x5497('0x2a')],'type':_0x5e9356[_0x5497('0x2b')][_0x5497('0x2c')]};});_0x4af5f4['model']=_['map'](_0x583d06,'name');_0x4af5f4[_0x5497('0x2d')]=_[_0x5497('0x2e')](_0x163a30[_0x5497('0x2d')]);_0x4af5f4['filters']=_['intersection'](_0x4af5f4['model'],_0x4af5f4[_0x5497('0x2d')]);_0x48b835['attributes']=_[_0x5497('0x2f')](_0x4af5f4[_0x5497('0x30')],qs[_0x5497('0x31')](_0x163a30['query'][_0x5497('0x31')]));_0x48b835[_0x5497('0x32')]=_0x48b835['attributes'][_0x5497('0x33')]?_0x48b835[_0x5497('0x32')]:_0x4af5f4[_0x5497('0x30')];if(!_0x163a30['query'][_0x5497('0x34')](_0x5497('0x35'))){_0x48b835[_0x5497('0x36')]=qs[_0x5497('0x36')](_0x163a30[_0x5497('0x2d')]['limit']);_0x48b835[_0x5497('0x1c')]=qs[_0x5497('0x1c')](_0x163a30['query'][_0x5497('0x1c')]);}_0x48b835[_0x5497('0x37')]=qs[_0x5497('0x38')](_0x163a30[_0x5497('0x2d')][_0x5497('0x38')]);_0x48b835[_0x5497('0x39')]=qs['filters'](_[_0x5497('0x3a')](_0x163a30['query'],_0x4af5f4[_0x5497('0x3b')]));if(_0x163a30[_0x5497('0x2d')][_0x5497('0x3c')]){_0x48b835['where']=_['merge'](_0x48b835[_0x5497('0x39')],{'$or':_[_0x5497('0x3d')](_0x583d06,function(_0x326d48){if(_0x326d48[_0x5497('0x2b')]!==_0x5497('0x3e')){var _0xc8a689={};_0xc8a689[_0x326d48['name']]={'$like':'%'+_0x163a30[_0x5497('0x2d')][_0x5497('0x3c')]+'%'};return _0xc8a689;}})});}_0x48b835=_[_0x5497('0x3f')]({},_0x48b835,_0x163a30[_0x5497('0x40')]);var _0x275aa7={'where':_0x48b835[_0x5497('0x39')]};return db[_0x5497('0x29')][_0x5497('0x1b')](_0x275aa7)[_0x5497('0x23')](function(_0x544065){_0x5406e2[_0x5497('0x1b')]=_0x544065;if(_0x163a30[_0x5497('0x2d')][_0x5497('0x41')]){_0x48b835[_0x5497('0x42')]=[{'all':!![]}];}return db[_0x5497('0x29')][_0x5497('0x43')](_0x48b835);})[_0x5497('0x23')](function(_0x59ed13){_0x5406e2[_0x5497('0x44')]=_0x59ed13;return _0x5406e2;})[_0x5497('0x23')](respondWithFilteredResult(_0x31cd01,_0x48b835))[_0x5497('0x45')](handleError(_0x31cd01,null));};exports[_0x5497('0x46')]=function(_0x1b251b,_0x125526){var _0x114471={'raw':!![],'where':{'id':_0x1b251b[_0x5497('0x47')]['id']}},_0x547437={};_0x547437[_0x5497('0x30')]=_[_0x5497('0x2e')](db[_0x5497('0x29')][_0x5497('0x48')]);_0x547437[_0x5497('0x2d')]=_[_0x5497('0x2e')](_0x1b251b[_0x5497('0x2d')]);_0x547437[_0x5497('0x3b')]=_[_0x5497('0x2f')](_0x547437['model'],_0x547437[_0x5497('0x2d')]);_0x114471['attributes']=_[_0x5497('0x2f')](_0x547437[_0x5497('0x30')],qs[_0x5497('0x31')](_0x1b251b[_0x5497('0x2d')][_0x5497('0x31')]));_0x114471['attributes']=_0x114471[_0x5497('0x32')][_0x5497('0x33')]?_0x114471['attributes']:_0x547437[_0x5497('0x30')];if(_0x1b251b['query'][_0x5497('0x41')]){_0x114471['include']=[{'all':!![]}];}_0x114471=_[_0x5497('0x3f')]({},_0x114471,_0x1b251b[_0x5497('0x40')]);return db[_0x5497('0x29')][_0x5497('0x49')](_0x114471)[_0x5497('0x23')](handleEntityNotFound(_0x125526,null))['then'](respondWithResult(_0x125526,null))['catch'](handleError(_0x125526,null));};exports['create']=function(_0x55f654,_0x3cbe4b){return db[_0x5497('0x29')][_0x5497('0x4a')](_0x55f654[_0x5497('0x4b')],{})[_0x5497('0x23')](respondWithResult(_0x3cbe4b,0xc9))[_0x5497('0x45')](handleError(_0x3cbe4b,null));};exports[_0x5497('0x22')]=function(_0x466287,_0x2626bf){if(_0x466287['body']['id']){delete _0x466287[_0x5497('0x4b')]['id'];}return db[_0x5497('0x29')][_0x5497('0x49')]({'where':{'id':_0x466287['params']['id']}})[_0x5497('0x23')](handleEntityNotFound(_0x2626bf,null))['then'](saveUpdates(_0x466287[_0x5497('0x4b')],null))[_0x5497('0x23')](respondWithResult(_0x2626bf,null))[_0x5497('0x45')](handleError(_0x2626bf,null));};exports['destroy']=function(_0x43bebe,_0x356d61){return db['SquareReport'][_0x5497('0x49')]({'where':{'id':_0x43bebe['params']['id']}})[_0x5497('0x23')](handleEntityNotFound(_0x356d61,null))['then'](removeEntity(_0x356d61,null))[_0x5497('0x45')](handleError(_0x356d61,null));};exports[_0x5497('0x4c')]=function(_0x26fd9f,_0xf07541){return db[_0x5497('0x29')][_0x5497('0x4c')]()[_0x5497('0x23')](respondWithResult(_0xf07541,null))[_0x5497('0x45')](handleError(_0xf07541,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 0f352d2..fc0a198 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 _0x58b7=['report_square','project_name','leaveAt','../../config/logger','api','rimraf','./squareReport.attributes','exports'];(function(_0x2b5408,_0x4a32d8){var _0x54de60=function(_0x18927f){while(--_0x18927f){_0x2b5408['push'](_0x2b5408['shift']());}};_0x54de60(++_0x4a32d8);}(_0x58b7,0xbb));var _0x758b=function(_0x29dcb3,_0x55676f){_0x29dcb3=_0x29dcb3-0x0;var _0x41e2d7=_0x58b7[_0x29dcb3];return _0x41e2d7;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x758b('0x0'))(_0x758b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x758b('0x2'));var config=require('../../config/environment');var attributes=require(_0x758b('0x3'));module[_0x758b('0x4')]=function(_0xc60ec6,_0x3116d4){return _0xc60ec6['define']('SquareReport',attributes,{'tableName':_0x758b('0x5'),'paranoid':![],'indexes':[{'name':'uid_pname','fields':['uniqueid',_0x758b('0x6')]},{'name':_0x758b('0x7'),'fields':[_0x758b('0x7')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x144d=['bluebird','request-promise','path','rimraf','./squareReport.attributes','exports','define','uniqueid','project_name','leaveAt','lodash','util','api','moment'];(function(_0x51fdc2,_0x3a71e8){var _0x58d8d8=function(_0x102f62){while(--_0x102f62){_0x51fdc2['push'](_0x51fdc2['shift']());}};_0x58d8d8(++_0x3a71e8);}(_0x144d,0x88));var _0xd144=function(_0x496734,_0x264319){_0x496734=_0x496734-0x0;var _0x36d312=_0x144d[_0x496734];return _0x36d312;};'use strict';var _=require(_0xd144('0x0'));var util=require(_0xd144('0x1'));var logger=require('../../config/logger')(_0xd144('0x2'));var moment=require(_0xd144('0x3'));var BPromise=require(_0xd144('0x4'));var rp=require(_0xd144('0x5'));var fs=require('fs');var path=require(_0xd144('0x6'));var rimraf=require(_0xd144('0x7'));var config=require('../../config/environment');var attributes=require(_0xd144('0x8'));module[_0xd144('0x9')]=function(_0x3076b0,_0x48394d){return _0x3076b0[_0xd144('0xa')]('SquareReport',attributes,{'tableName':'report_square','paranoid':![],'indexes':[{'name':'uid_pname','fields':[_0xd144('0xb'),_0xd144('0xc')]},{'name':_0xd144('0xd'),'fields':['leaveAt']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index c36e568..07985b3 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 _0x1088=['randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','SquareReport,\x20%s,\x20%s','result','catch','CreateSquareReport','SquareReport','create','body','options','raw','then','info','where','attributes','UpdateSquareReport','lodash','moment','bluebird'];(function(_0x4fd279,_0x1fe081){var _0x48cc96=function(_0x56ef34){while(--_0x56ef34){_0x4fd279['push'](_0x4fd279['shift']());}};_0x48cc96(++_0x1fe081);}(_0x1088,0x11f));var _0x8108=function(_0x89a280,_0x5829fb){_0x89a280=_0x89a280-0x0;var _0x357fe1=_0x1088[_0x89a280];return _0x357fe1;};'use strict';var _=require(_0x8108('0x0'));var util=require('util');var moment=require(_0x8108('0x1'));var BPromise=require(_0x8108('0x2'));var rs=require(_0x8108('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8108('0x4'))['db'];var utils=require(_0x8108('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x8108('0x6'));var jayson=require(_0x8108('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xd86490,_0x535176,_0x3cc6c9){return new BPromise(function(_0x484a06,_0x5d4320){return client['request'](_0xd86490,_0x3cc6c9)['then'](function(_0x12a6ad){logger['info']('SquareReport,\x20%s,\x20%s',_0x535176,_0x8108('0x8'));logger[_0x8108('0x9')](_0x8108('0xa'),_0x535176,'request\x20sent',JSON[_0x8108('0xb')](_0x12a6ad));if(_0x12a6ad[_0x8108('0xc')]){if(_0x12a6ad[_0x8108('0xc')][_0x8108('0xd')]===0x1f4){logger[_0x8108('0xc')]('SquareReport,\x20%s,\x20%s',_0x535176,_0x12a6ad[_0x8108('0xc')][_0x8108('0xe')]);return _0x5d4320(_0x12a6ad[_0x8108('0xc')][_0x8108('0xe')]);}logger['error'](_0x8108('0xf'),_0x535176,_0x12a6ad['error'][_0x8108('0xe')]);return _0x484a06(_0x12a6ad[_0x8108('0xc')]['message']);}else{logger['info'](_0x8108('0xf'),_0x535176,_0x8108('0x8'));_0x484a06(_0x12a6ad[_0x8108('0x10')][_0x8108('0xe')]);}})[_0x8108('0x11')](function(_0x222123){logger[_0x8108('0xc')](_0x8108('0xf'),_0x535176,_0x222123);_0x5d4320(_0x222123);});});}exports[_0x8108('0x12')]=function(_0x53b478){var _0x5a8596=this;return new Promise(function(_0x40e043,_0x61b683){return db[_0x8108('0x13')][_0x8108('0x14')](_0x53b478[_0x8108('0x15')],{'raw':_0x53b478[_0x8108('0x16')]?_0x53b478[_0x8108('0x16')][_0x8108('0x17')]===undefined?!![]:![]:!![]})[_0x8108('0x18')](function(_0x914c1c){logger[_0x8108('0x19')](_0x8108('0x12'),_0x53b478);logger['debug'](_0x8108('0x12'),_0x53b478,JSON[_0x8108('0xb')](_0x914c1c));_0x40e043(_0x914c1c);})['catch'](function(_0x31c62e){logger[_0x8108('0xc')](_0x8108('0x12'),_0x31c62e[_0x8108('0xe')],_0x53b478);_0x61b683(_0x5a8596['error'](0x1f4,_0x31c62e['message']));});});};exports['UpdateSquareReport']=function(_0x40c624){var _0x11d741=this;return new Promise(function(_0x3fc677,_0x470770){return db[_0x8108('0x13')]['update'](_0x40c624['body'],{'raw':_0x40c624[_0x8108('0x16')]?_0x40c624[_0x8108('0x16')][_0x8108('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x40c624[_0x8108('0x16')]?_0x40c624['options'][_0x8108('0x1a')]||null:null,'attributes':_0x40c624['options']?_0x40c624[_0x8108('0x16')][_0x8108('0x1b')]||null:null,'limit':_0x40c624['options']?_0x40c624[_0x8108('0x16')]['limit']||null:null})[_0x8108('0x18')](function(_0x17cf07){logger[_0x8108('0x19')](_0x8108('0x1c'),_0x40c624);logger[_0x8108('0x9')]('UpdateSquareReport',_0x40c624,JSON[_0x8108('0xb')](_0x17cf07));_0x3fc677(_0x17cf07);})[_0x8108('0x11')](function(_0x1c0862){logger['error'](_0x8108('0x1c'),_0x1c0862['message'],_0x40c624);_0x470770(_0x11d741[_0x8108('0xc')](0x1f4,_0x1c0862[_0x8108('0xe')]));});});}; \ No newline at end of file +var _0xe2de=['lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SquareReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateSquareReport','SquareReport','create','body','options','raw','debug','UpdateSquareReport','update','where','attributes','limit'];(function(_0x221b77,_0x482248){var _0x2a6ea9=function(_0x4055d5){while(--_0x4055d5){_0x221b77['push'](_0x221b77['shift']());}};_0x2a6ea9(++_0x482248);}(_0xe2de,0xee));var _0xee2d=function(_0x347de1,_0x279167){_0x347de1=_0x347de1-0x0;var _0x4a7a53=_0xe2de[_0x347de1];return _0x4a7a53;};'use strict';var _=require(_0xee2d('0x0'));var util=require(_0xee2d('0x1'));var moment=require(_0xee2d('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xee2d('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xee2d('0x4'));var logger=require(_0xee2d('0x5'))(_0xee2d('0x6'));var config=require(_0xee2d('0x7'));var jayson=require(_0xee2d('0x8'));var client=jayson[_0xee2d('0x9')][_0xee2d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x23d7b9,_0x493a2d,_0x1be6da){return new BPromise(function(_0xd4c4a6,_0x565d5d){return client[_0xee2d('0xb')](_0x23d7b9,_0x1be6da)[_0xee2d('0xc')](function(_0x512bbb){logger[_0xee2d('0xd')](_0xee2d('0xe'),_0x493a2d,_0xee2d('0xf'));logger['debug']('SquareReport,\x20%s,\x20%s,\x20%s',_0x493a2d,_0xee2d('0xf'),JSON[_0xee2d('0x10')](_0x512bbb));if(_0x512bbb['error']){if(_0x512bbb[_0xee2d('0x11')][_0xee2d('0x12')]===0x1f4){logger['error'](_0xee2d('0xe'),_0x493a2d,_0x512bbb[_0xee2d('0x11')][_0xee2d('0x13')]);return _0x565d5d(_0x512bbb[_0xee2d('0x11')][_0xee2d('0x13')]);}logger['error'](_0xee2d('0xe'),_0x493a2d,_0x512bbb[_0xee2d('0x11')][_0xee2d('0x13')]);return _0xd4c4a6(_0x512bbb[_0xee2d('0x11')]['message']);}else{logger['info']('SquareReport,\x20%s,\x20%s',_0x493a2d,_0xee2d('0xf'));_0xd4c4a6(_0x512bbb[_0xee2d('0x14')][_0xee2d('0x13')]);}})[_0xee2d('0x15')](function(_0x818a93){logger[_0xee2d('0x11')](_0xee2d('0xe'),_0x493a2d,_0x818a93);_0x565d5d(_0x818a93);});});}exports[_0xee2d('0x16')]=function(_0x57fe13){var _0x5b22ba=this;return new Promise(function(_0x2a634c,_0x30d378){return db[_0xee2d('0x17')][_0xee2d('0x18')](_0x57fe13[_0xee2d('0x19')],{'raw':_0x57fe13[_0xee2d('0x1a')]?_0x57fe13[_0xee2d('0x1a')][_0xee2d('0x1b')]===undefined?!![]:![]:!![]})[_0xee2d('0xc')](function(_0x351478){logger['info'](_0xee2d('0x16'),_0x57fe13);logger[_0xee2d('0x1c')](_0xee2d('0x16'),_0x57fe13,JSON[_0xee2d('0x10')](_0x351478));_0x2a634c(_0x351478);})[_0xee2d('0x15')](function(_0x2b460d){logger[_0xee2d('0x11')](_0xee2d('0x16'),_0x2b460d[_0xee2d('0x13')],_0x57fe13);_0x30d378(_0x5b22ba['error'](0x1f4,_0x2b460d['message']));});});};exports[_0xee2d('0x1d')]=function(_0x864e3b){var _0x3a6893=this;return new Promise(function(_0xc5cabc,_0x1157f8){return db[_0xee2d('0x17')][_0xee2d('0x1e')](_0x864e3b[_0xee2d('0x19')],{'raw':_0x864e3b['options']?_0x864e3b[_0xee2d('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x864e3b[_0xee2d('0x1a')]?_0x864e3b[_0xee2d('0x1a')][_0xee2d('0x1f')]||null:null,'attributes':_0x864e3b[_0xee2d('0x1a')]?_0x864e3b['options'][_0xee2d('0x20')]||null:null,'limit':_0x864e3b[_0xee2d('0x1a')]?_0x864e3b[_0xee2d('0x1a')][_0xee2d('0x21')]||null:null})['then'](function(_0x116c34){logger['info']('UpdateSquareReport',_0x864e3b);logger['debug'](_0xee2d('0x1d'),_0x864e3b,JSON[_0xee2d('0x10')](_0x116c34));_0xc5cabc(_0x116c34);})[_0xee2d('0x15')](function(_0x3b5b26){logger[_0xee2d('0x11')](_0xee2d('0x1d'),_0x3b5b26[_0xee2d('0x13')],_0x864e3b);_0x1157f8(_0x3a6893[_0xee2d('0x11')](0x1f4,_0x3b5b26[_0xee2d('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index 4c24ab8..dfeae0c 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 _0x7a54=['describe','/:id','create','delete','destroy','exports','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get','isAuthenticated'];(function(_0x205250,_0x518f3f){var _0x14c680=function(_0x29a5d8){while(--_0x29a5d8){_0x205250['push'](_0x205250['shift']());}};_0x14c680(++_0x518f3f);}(_0x7a54,0x106));var _0x47a5=function(_0x20b5ca,_0x1e15c7){_0x20b5ca=_0x20b5ca-0x0;var _0x5f31c4=_0x7a54[_0x20b5ca];return _0x5f31c4;};'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['show']);router['post']('/',auth[_0x47a5('0x9')](),controller[_0x47a5('0xc')]);router['put'](_0x47a5('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x47a5('0xd')](_0x47a5('0xb'),auth[_0x47a5('0x9')](),controller[_0x47a5('0xe')]);module[_0x47a5('0xf')]=router; \ No newline at end of file +var _0x814b=['path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get','isAuthenticated','index','/describe','/:id','show','post','create','put','update','destroy','exports','multer','util'];(function(_0x4154a6,_0x2c0b8e){var _0x3b2786=function(_0x2f5936){while(--_0x2f5936){_0x4154a6['push'](_0x4154a6['shift']());}};_0x3b2786(++_0x2c0b8e);}(_0x814b,0x1a2));var _0xb814=function(_0xd27ded,_0x1164e2){_0xd27ded=_0xd27ded-0x0;var _0x5ef850=_0x814b[_0xd27ded];return _0x5ef850;};'use strict';var multer=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var path=require(_0xb814('0x2'));var timeout=require(_0xb814('0x3'));var express=require(_0xb814('0x4'));var router=express[_0xb814('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xb814('0x6'));var config=require(_0xb814('0x7'));var controller=require(_0xb814('0x8'));router[_0xb814('0x9')]('/',auth[_0xb814('0xa')](),controller[_0xb814('0xb')]);router['get'](_0xb814('0xc'),auth[_0xb814('0xa')](),controller['describe']);router[_0xb814('0x9')](_0xb814('0xd'),auth[_0xb814('0xa')](),controller[_0xb814('0xe')]);router[_0xb814('0xf')]('/',auth[_0xb814('0xa')](),controller[_0xb814('0x10')]);router[_0xb814('0x11')](_0xb814('0xd'),auth[_0xb814('0xa')](),controller[_0xb814('0x12')]);router['delete'](_0xb814('0xd'),auth['isAuthenticated'](),controller[_0xb814('0x13')]);module[_0xb814('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index 181b5b7..aea8af7 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 _0x7e34=['sequelize','STRING'];(function(_0x510b08,_0x16cd04){var _0xbf9488=function(_0x2bd2bd){while(--_0x2bd2bd){_0x510b08['push'](_0x510b08['shift']());}};_0xbf9488(++_0x16cd04);}(_0x7e34,0x1ea));var _0x47e3=function(_0x109e5a,_0x9e715e){_0x109e5a=_0x109e5a-0x0;var _0x4ee4cf=_0x7e34[_0x109e5a];return _0x4ee4cf;};'use strict';var Sequelize=require(_0x47e3('0x0'));module['exports']={'uniqueid':{'type':Sequelize['STRING']},'node':{'type':Sequelize[_0x47e3('0x1')]},'application':{'type':Sequelize[_0x47e3('0x1')]},'data':{'type':Sequelize['TEXT']},'project_name':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x50ae=['exports','STRING','TEXT','sequelize'];(function(_0x49c77f,_0xa42039){var _0x18752e=function(_0x59c893){while(--_0x59c893){_0x49c77f['push'](_0x49c77f['shift']());}};_0x18752e(++_0xa42039);}(_0x50ae,0x14f));var _0xe50a=function(_0x39c8a4,_0x137a9e){_0x39c8a4=_0x39c8a4-0x0;var _0x41f618=_0x50ae[_0x39c8a4];return _0x41f618;};'use strict';var Sequelize=require(_0xe50a('0x0'));module[_0xe50a('0x1')]={'uniqueid':{'type':Sequelize[_0xe50a('0x2')]},'node':{'type':Sequelize[_0xe50a('0x2')]},'application':{'type':Sequelize[_0xe50a('0x2')]},'data':{'type':Sequelize[_0xe50a('0x3')]},'project_name':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xe50a('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index cf4b8d5..babd40e 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 _0xfaa7=['moment','bluebird','mustache','util','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','keys','query','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','SquareDetailsReport','findAll','rows','catch','show','params','filters','fields','length','find','create','body','update','describe','html-pdf','eml-format','rimraf','request-promise'];(function(_0x24f42f,_0x41e98f){var _0x24df68=function(_0x418b53){while(--_0x418b53){_0x24f42f['push'](_0x24f42f['shift']());}};_0x24df68(++_0x41e98f);}(_0xfaa7,0xe3));var _0x7faa=function(_0xb00a3c,_0xa062e4){_0xb00a3c=_0xb00a3c-0x0;var _0x5427ca=_0xfaa7[_0xb00a3c];return _0x5427ca;};'use strict';var pdf=require(_0x7faa('0x0'));var emlformat=require(_0x7faa('0x1'));var rimraf=require(_0x7faa('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x7faa('0x3'));var moment=require(_0x7faa('0x4'));var BPromise=require(_0x7faa('0x5'));var Mustache=require(_0x7faa('0x6'));var util=require(_0x7faa('0x7'));var path=require(_0x7faa('0x8'));var sox=require(_0x7faa('0x9'));var csv=require('to-csv');var ejs=require(_0x7faa('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x7faa('0xb'));var crypto=require(_0x7faa('0xc'));var jsforce=require(_0x7faa('0xd'));var deskjs=require(_0x7faa('0xe'));var toCsv=require(_0x7faa('0xf'));var querystring=require('querystring');var Papa=require(_0x7faa('0x10'));var Redis=require(_0x7faa('0x11'));var authService=require(_0x7faa('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x7faa('0x13'));var hardwareService=require(_0x7faa('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x7faa('0x15'));var config=require(_0x7faa('0x16'));var db=require(_0x7faa('0x17'))['db'];function respondWithStatusCode(_0x617937,_0x5aad75){_0x5aad75=_0x5aad75||0xcc;return function(_0x4bbaba){if(_0x4bbaba){return _0x617937[_0x7faa('0x18')](_0x5aad75);}return _0x617937[_0x7faa('0x19')](_0x5aad75)[_0x7faa('0x1a')]();};}function respondWithResult(_0x111a00,_0x26a78a){_0x26a78a=_0x26a78a||0xc8;return function(_0x535e74){if(_0x535e74){return _0x111a00['status'](_0x26a78a)[_0x7faa('0x1b')](_0x535e74);}};}function respondWithFilteredResult(_0x5a6638,_0x46dc7){return function(_0x2e695f){if(_0x2e695f){var _0x162cfd=_0x2e695f[_0x7faa('0x1c')],_0x21dd19=_0x46dc7[_0x7faa('0x1d')],_0x184811=_0x46dc7[_0x7faa('0x1d')]+_0x46dc7[_0x7faa('0x1e')],_0x1d5ca3;if(_0x184811>=_0x162cfd){_0x184811=_0x162cfd;_0x1d5ca3=0xc8;}else{_0x1d5ca3=0xce;}_0x5a6638[_0x7faa('0x19')](_0x1d5ca3);return _0x5a6638[_0x7faa('0x1f')](_0x7faa('0x20'),_0x21dd19+'-'+_0x184811+'/'+_0x162cfd)[_0x7faa('0x1b')](_0x2e695f);}return null;};}function patchUpdates(_0x32df92){return function(_0x248950){try{jsonpatch[_0x7faa('0x21')](_0x248950,_0x32df92,!![]);}catch(_0x36039c){return BPromise['reject'](_0x36039c);}return _0x248950[_0x7faa('0x22')]();};}function saveUpdates(_0xb8d3c8,_0x9bb0ac){return function(_0x391bb6){if(_0x391bb6){return _0x391bb6['update'](_0xb8d3c8)[_0x7faa('0x23')](function(_0x5ce235){return _0x5ce235;});}return null;};}function removeEntity(_0x251811,_0x7beb39){return function(_0x3ce8ce){if(_0x3ce8ce){return _0x3ce8ce[_0x7faa('0x24')]()[_0x7faa('0x23')](function(){_0x251811[_0x7faa('0x19')](0xcc)[_0x7faa('0x1a')]();});}};}function handleEntityNotFound(_0x326d3f,_0x59bacc){return function(_0x47bfcd){if(!_0x47bfcd){_0x326d3f[_0x7faa('0x18')](0x194);}return _0x47bfcd;};}function handleError(_0x148789,_0x14efa4){_0x14efa4=_0x14efa4||0x1f4;return function(_0x2c3dc9){logger[_0x7faa('0x25')](_0x2c3dc9[_0x7faa('0x26')]);if(_0x2c3dc9[_0x7faa('0x27')]){delete _0x2c3dc9[_0x7faa('0x27')];}_0x148789['status'](_0x14efa4)[_0x7faa('0x28')](_0x2c3dc9);};}exports[_0x7faa('0x29')]=function(_0x39fc6f,_0x5c9cfb){var _0x4d2e6c={},_0x3cf56e={},_0x519134={'count':0x0,'rows':[]};var _0x544a80=_[_0x7faa('0x2a')](db['SquareDetailsReport'][_0x7faa('0x2b')],function(_0x39fa33){return{'name':_0x39fa33[_0x7faa('0x2c')],'type':_0x39fa33[_0x7faa('0x2d')]['key']};});_0x3cf56e[_0x7faa('0x2e')]=_[_0x7faa('0x2a')](_0x544a80,'name');_0x3cf56e['query']=_[_0x7faa('0x2f')](_0x39fc6f[_0x7faa('0x30')]);_0x3cf56e['filters']=_[_0x7faa('0x31')](_0x3cf56e[_0x7faa('0x2e')],_0x3cf56e[_0x7faa('0x30')]);_0x4d2e6c[_0x7faa('0x32')]=_[_0x7faa('0x31')](_0x3cf56e[_0x7faa('0x2e')],qs['fields'](_0x39fc6f['query']['fields']));_0x4d2e6c[_0x7faa('0x32')]=_0x4d2e6c[_0x7faa('0x32')]['length']?_0x4d2e6c[_0x7faa('0x32')]:_0x3cf56e[_0x7faa('0x2e')];if(!_0x39fc6f['query'][_0x7faa('0x33')](_0x7faa('0x34'))){_0x4d2e6c['limit']=qs[_0x7faa('0x1e')](_0x39fc6f[_0x7faa('0x30')][_0x7faa('0x1e')]);_0x4d2e6c[_0x7faa('0x1d')]=qs[_0x7faa('0x1d')](_0x39fc6f[_0x7faa('0x30')][_0x7faa('0x1d')]);}_0x4d2e6c[_0x7faa('0x35')]=qs[_0x7faa('0x36')](_0x39fc6f[_0x7faa('0x30')][_0x7faa('0x36')]);_0x4d2e6c[_0x7faa('0x37')]=qs['filters'](_[_0x7faa('0x38')](_0x39fc6f[_0x7faa('0x30')],_0x3cf56e['filters']));if(_0x39fc6f['query'][_0x7faa('0x39')]){_0x4d2e6c[_0x7faa('0x37')]=_[_0x7faa('0x3a')](_0x4d2e6c['where'],{'$or':_[_0x7faa('0x2a')](_0x544a80,function(_0x34dcc9){if(_0x34dcc9[_0x7faa('0x2d')]!==_0x7faa('0x3b')){var _0x147dcf={};_0x147dcf[_0x34dcc9[_0x7faa('0x27')]]={'$like':'%'+_0x39fc6f[_0x7faa('0x30')][_0x7faa('0x39')]+'%'};return _0x147dcf;}})});}_0x4d2e6c=_['merge']({},_0x4d2e6c,_0x39fc6f[_0x7faa('0x3c')]);var _0x441624={'where':_0x4d2e6c[_0x7faa('0x37')]};return db['SquareDetailsReport'][_0x7faa('0x1c')](_0x441624)[_0x7faa('0x23')](function(_0x4da551){_0x519134[_0x7faa('0x1c')]=_0x4da551;if(_0x39fc6f['query'][_0x7faa('0x3d')]){_0x4d2e6c[_0x7faa('0x3e')]=[{'all':!![]}];}return db[_0x7faa('0x3f')][_0x7faa('0x40')](_0x4d2e6c);})[_0x7faa('0x23')](function(_0x415661){_0x519134[_0x7faa('0x41')]=_0x415661;return _0x519134;})[_0x7faa('0x23')](respondWithFilteredResult(_0x5c9cfb,_0x4d2e6c))[_0x7faa('0x42')](handleError(_0x5c9cfb,null));};exports[_0x7faa('0x43')]=function(_0x1b55fd,_0x2a5f29){var _0x427e80={'raw':!![],'where':{'id':_0x1b55fd[_0x7faa('0x44')]['id']}},_0x427f3c={};_0x427f3c[_0x7faa('0x2e')]=_['keys'](db[_0x7faa('0x3f')][_0x7faa('0x2b')]);_0x427f3c[_0x7faa('0x30')]=_[_0x7faa('0x2f')](_0x1b55fd['query']);_0x427f3c[_0x7faa('0x45')]=_[_0x7faa('0x31')](_0x427f3c[_0x7faa('0x2e')],_0x427f3c['query']);_0x427e80[_0x7faa('0x32')]=_['intersection'](_0x427f3c[_0x7faa('0x2e')],qs[_0x7faa('0x46')](_0x1b55fd['query'][_0x7faa('0x46')]));_0x427e80[_0x7faa('0x32')]=_0x427e80[_0x7faa('0x32')][_0x7faa('0x47')]?_0x427e80[_0x7faa('0x32')]:_0x427f3c[_0x7faa('0x2e')];if(_0x1b55fd[_0x7faa('0x30')][_0x7faa('0x3d')]){_0x427e80[_0x7faa('0x3e')]=[{'all':!![]}];}_0x427e80=_[_0x7faa('0x3a')]({},_0x427e80,_0x1b55fd[_0x7faa('0x3c')]);return db[_0x7faa('0x3f')][_0x7faa('0x48')](_0x427e80)[_0x7faa('0x23')](handleEntityNotFound(_0x2a5f29,null))[_0x7faa('0x23')](respondWithResult(_0x2a5f29,null))[_0x7faa('0x42')](handleError(_0x2a5f29,null));};exports[_0x7faa('0x49')]=function(_0x112930,_0x30beb6){return db[_0x7faa('0x3f')][_0x7faa('0x49')](_0x112930[_0x7faa('0x4a')],{})['then'](respondWithResult(_0x30beb6,0xc9))[_0x7faa('0x42')](handleError(_0x30beb6,null));};exports[_0x7faa('0x4b')]=function(_0x5c674a,_0x776fa2){if(_0x5c674a[_0x7faa('0x4a')]['id']){delete _0x5c674a['body']['id'];}return db[_0x7faa('0x3f')][_0x7faa('0x48')]({'where':{'id':_0x5c674a[_0x7faa('0x44')]['id']}})['then'](handleEntityNotFound(_0x776fa2,null))[_0x7faa('0x23')](saveUpdates(_0x5c674a[_0x7faa('0x4a')],null))[_0x7faa('0x23')](respondWithResult(_0x776fa2,null))['catch'](handleError(_0x776fa2,null));};exports[_0x7faa('0x24')]=function(_0x1a8c02,_0x19f3bb){return db[_0x7faa('0x3f')][_0x7faa('0x48')]({'where':{'id':_0x1a8c02[_0x7faa('0x44')]['id']}})[_0x7faa('0x23')](handleEntityNotFound(_0x19f3bb,null))[_0x7faa('0x23')](removeEntity(_0x19f3bb,null))[_0x7faa('0x42')](handleError(_0x19f3bb,null));};exports[_0x7faa('0x4c')]=function(_0x3211a5,_0x1d093d){return db[_0x7faa('0x3f')][_0x7faa('0x4c')]()[_0x7faa('0x23')](respondWithResult(_0x1d093d,null))['catch'](handleError(_0x1d093d,null));}; \ No newline at end of file +var _0xf32b=['status','json','offset','limit','apply','reject','save','update','then','stack','name','send','index','map','SquareDetailsReport','type','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','findAll','catch','params','keys','include','find','create','body','destroy','describe','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end'];(function(_0x401a0b,_0xbbfd86){var _0x4a5e66=function(_0x40de64){while(--_0x40de64){_0x401a0b['push'](_0x401a0b['shift']());}};_0x4a5e66(++_0xbbfd86);}(_0xf32b,0x1e2));var _0xbf32=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0xf32b[_0xbb091];return _0x467a04;};'use strict';var pdf=require(_0xbf32('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xbf32('0x1'));var zipdir=require(_0xbf32('0x2'));var jsonpatch=require(_0xbf32('0x3'));var rp=require(_0xbf32('0x4'));var moment=require(_0xbf32('0x5'));var BPromise=require(_0xbf32('0x6'));var Mustache=require(_0xbf32('0x7'));var util=require('util');var path=require(_0xbf32('0x8'));var sox=require(_0xbf32('0x9'));var csv=require(_0xbf32('0xa'));var ejs=require(_0xbf32('0xb'));var fs=require('fs');var _=require(_0xbf32('0xc'));var squel=require(_0xbf32('0xd'));var crypto=require(_0xbf32('0xe'));var jsforce=require(_0xbf32('0xf'));var deskjs=require(_0xbf32('0x10'));var toCsv=require(_0xbf32('0xa'));var querystring=require(_0xbf32('0x11'));var Papa=require(_0xbf32('0x12'));var Redis=require(_0xbf32('0x13'));var authService=require(_0xbf32('0x14'));var qs=require(_0xbf32('0x15'));var as=require(_0xbf32('0x16'));var hardwareService=require(_0xbf32('0x17'));var logger=require('../../config/logger')('api');var utils=require(_0xbf32('0x18'));var config=require(_0xbf32('0x19'));var db=require(_0xbf32('0x1a'))['db'];function respondWithStatusCode(_0x46d449,_0x45cd25){_0x45cd25=_0x45cd25||0xcc;return function(_0x101af8){if(_0x101af8){return _0x46d449[_0xbf32('0x1b')](_0x45cd25);}return _0x46d449['status'](_0x45cd25)[_0xbf32('0x1c')]();};}function respondWithResult(_0x3ce9b1,_0x123888){_0x123888=_0x123888||0xc8;return function(_0x585974){if(_0x585974){return _0x3ce9b1[_0xbf32('0x1d')](_0x123888)[_0xbf32('0x1e')](_0x585974);}};}function respondWithFilteredResult(_0x57b03f,_0x8fe4c4){return function(_0x5ba227){if(_0x5ba227){var _0x2296d8=_0x5ba227['count'],_0x5d5ce2=_0x8fe4c4[_0xbf32('0x1f')],_0x1208f2=_0x8fe4c4[_0xbf32('0x1f')]+_0x8fe4c4[_0xbf32('0x20')],_0x378f46;if(_0x1208f2>=_0x2296d8){_0x1208f2=_0x2296d8;_0x378f46=0xc8;}else{_0x378f46=0xce;}_0x57b03f[_0xbf32('0x1d')](_0x378f46);return _0x57b03f['set']('Content-Range',_0x5d5ce2+'-'+_0x1208f2+'/'+_0x2296d8)['json'](_0x5ba227);}return null;};}function patchUpdates(_0x17348e){return function(_0x1889e6){try{jsonpatch[_0xbf32('0x21')](_0x1889e6,_0x17348e,!![]);}catch(_0x208ff9){return BPromise[_0xbf32('0x22')](_0x208ff9);}return _0x1889e6[_0xbf32('0x23')]();};}function saveUpdates(_0x599e3b,_0x2cc907){return function(_0x2df5e8){if(_0x2df5e8){return _0x2df5e8[_0xbf32('0x24')](_0x599e3b)[_0xbf32('0x25')](function(_0x149222){return _0x149222;});}return null;};}function removeEntity(_0x37e8c7,_0x1eafac){return function(_0x54794a){if(_0x54794a){return _0x54794a['destroy']()[_0xbf32('0x25')](function(){_0x37e8c7['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x524349,_0x3646c2){return function(_0x149239){if(!_0x149239){_0x524349[_0xbf32('0x1b')](0x194);}return _0x149239;};}function handleError(_0x157ff4,_0x525e6d){_0x525e6d=_0x525e6d||0x1f4;return function(_0x599718){logger['error'](_0x599718[_0xbf32('0x26')]);if(_0x599718[_0xbf32('0x27')]){delete _0x599718[_0xbf32('0x27')];}_0x157ff4[_0xbf32('0x1d')](_0x525e6d)[_0xbf32('0x28')](_0x599718);};}exports[_0xbf32('0x29')]=function(_0x5e77db,_0x4bafdb){var _0x56241a={},_0x1a95df={},_0x366d6a={'count':0x0,'rows':[]};var _0x471517=_[_0xbf32('0x2a')](db[_0xbf32('0x2b')]['rawAttributes'],function(_0x8625b2){return{'name':_0x8625b2['fieldName'],'type':_0x8625b2[_0xbf32('0x2c')]['key']};});_0x1a95df[_0xbf32('0x2d')]=_[_0xbf32('0x2a')](_0x471517,_0xbf32('0x27'));_0x1a95df['query']=_['keys'](_0x5e77db[_0xbf32('0x2e')]);_0x1a95df[_0xbf32('0x2f')]=_[_0xbf32('0x30')](_0x1a95df[_0xbf32('0x2d')],_0x1a95df[_0xbf32('0x2e')]);_0x56241a['attributes']=_[_0xbf32('0x30')](_0x1a95df[_0xbf32('0x2d')],qs[_0xbf32('0x31')](_0x5e77db[_0xbf32('0x2e')][_0xbf32('0x31')]));_0x56241a[_0xbf32('0x32')]=_0x56241a['attributes'][_0xbf32('0x33')]?_0x56241a['attributes']:_0x1a95df[_0xbf32('0x2d')];if(!_0x5e77db[_0xbf32('0x2e')][_0xbf32('0x34')]('nolimit')){_0x56241a[_0xbf32('0x20')]=qs[_0xbf32('0x20')](_0x5e77db[_0xbf32('0x2e')][_0xbf32('0x20')]);_0x56241a['offset']=qs[_0xbf32('0x1f')](_0x5e77db[_0xbf32('0x2e')][_0xbf32('0x1f')]);}_0x56241a[_0xbf32('0x35')]=qs[_0xbf32('0x36')](_0x5e77db[_0xbf32('0x2e')][_0xbf32('0x36')]);_0x56241a[_0xbf32('0x37')]=qs[_0xbf32('0x2f')](_[_0xbf32('0x38')](_0x5e77db['query'],_0x1a95df[_0xbf32('0x2f')]));if(_0x5e77db[_0xbf32('0x2e')][_0xbf32('0x39')]){_0x56241a[_0xbf32('0x37')]=_[_0xbf32('0x3a')](_0x56241a[_0xbf32('0x37')],{'$or':_[_0xbf32('0x2a')](_0x471517,function(_0x19c796){if(_0x19c796[_0xbf32('0x2c')]!==_0xbf32('0x3b')){var _0x4383b6={};_0x4383b6[_0x19c796[_0xbf32('0x27')]]={'$like':'%'+_0x5e77db[_0xbf32('0x2e')]['filter']+'%'};return _0x4383b6;}})});}_0x56241a=_[_0xbf32('0x3a')]({},_0x56241a,_0x5e77db[_0xbf32('0x3c')]);var _0x407508={'where':_0x56241a['where']};return db['SquareDetailsReport'][_0xbf32('0x3d')](_0x407508)[_0xbf32('0x25')](function(_0x4415ee){_0x366d6a['count']=_0x4415ee;if(_0x5e77db[_0xbf32('0x2e')][_0xbf32('0x3e')]){_0x56241a['include']=[{'all':!![]}];}return db[_0xbf32('0x2b')][_0xbf32('0x3f')](_0x56241a);})[_0xbf32('0x25')](function(_0x8de417){_0x366d6a['rows']=_0x8de417;return _0x366d6a;})['then'](respondWithFilteredResult(_0x4bafdb,_0x56241a))[_0xbf32('0x40')](handleError(_0x4bafdb,null));};exports['show']=function(_0x3fc9b4,_0x1ddfc2){var _0x436d11={'raw':!![],'where':{'id':_0x3fc9b4[_0xbf32('0x41')]['id']}},_0x43ff74={};_0x43ff74['model']=_['keys'](db[_0xbf32('0x2b')]['rawAttributes']);_0x43ff74[_0xbf32('0x2e')]=_[_0xbf32('0x42')](_0x3fc9b4[_0xbf32('0x2e')]);_0x43ff74[_0xbf32('0x2f')]=_[_0xbf32('0x30')](_0x43ff74[_0xbf32('0x2d')],_0x43ff74[_0xbf32('0x2e')]);_0x436d11[_0xbf32('0x32')]=_[_0xbf32('0x30')](_0x43ff74[_0xbf32('0x2d')],qs[_0xbf32('0x31')](_0x3fc9b4['query'][_0xbf32('0x31')]));_0x436d11[_0xbf32('0x32')]=_0x436d11[_0xbf32('0x32')]['length']?_0x436d11['attributes']:_0x43ff74[_0xbf32('0x2d')];if(_0x3fc9b4['query'][_0xbf32('0x3e')]){_0x436d11[_0xbf32('0x43')]=[{'all':!![]}];}_0x436d11=_['merge']({},_0x436d11,_0x3fc9b4[_0xbf32('0x3c')]);return db['SquareDetailsReport'][_0xbf32('0x44')](_0x436d11)['then'](handleEntityNotFound(_0x1ddfc2,null))[_0xbf32('0x25')](respondWithResult(_0x1ddfc2,null))['catch'](handleError(_0x1ddfc2,null));};exports[_0xbf32('0x45')]=function(_0x23da61,_0x11f2ba){return db[_0xbf32('0x2b')][_0xbf32('0x45')](_0x23da61[_0xbf32('0x46')],{})[_0xbf32('0x25')](respondWithResult(_0x11f2ba,0xc9))[_0xbf32('0x40')](handleError(_0x11f2ba,null));};exports['update']=function(_0x5f37d7,_0x33d850){if(_0x5f37d7[_0xbf32('0x46')]['id']){delete _0x5f37d7[_0xbf32('0x46')]['id'];}return db[_0xbf32('0x2b')]['find']({'where':{'id':_0x5f37d7[_0xbf32('0x41')]['id']}})[_0xbf32('0x25')](handleEntityNotFound(_0x33d850,null))[_0xbf32('0x25')](saveUpdates(_0x5f37d7[_0xbf32('0x46')],null))[_0xbf32('0x25')](respondWithResult(_0x33d850,null))[_0xbf32('0x40')](handleError(_0x33d850,null));};exports[_0xbf32('0x47')]=function(_0x321cc3,_0x36e51c){return db[_0xbf32('0x2b')][_0xbf32('0x44')]({'where':{'id':_0x321cc3['params']['id']}})[_0xbf32('0x25')](handleEntityNotFound(_0x36e51c,null))[_0xbf32('0x25')](removeEntity(_0x36e51c,null))[_0xbf32('0x40')](handleError(_0x36e51c,null));};exports['describe']=function(_0x1086a9,_0x550b00){return db[_0xbf32('0x2b')][_0xbf32('0x48')]()[_0xbf32('0x25')](respondWithResult(_0x550b00,null))[_0xbf32('0x40')](handleError(_0x550b00,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index ee17231..ece7e9d 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 _0x3feb=['moment','bluebird','path','../../config/environment','define','SquareDetailsReport','lodash','api'];(function(_0x384e65,_0x1944de){var _0x547015=function(_0x104f32){while(--_0x104f32){_0x384e65['push'](_0x384e65['shift']());}};_0x547015(++_0x1944de);}(_0x3feb,0x1ce));var _0xb3fe=function(_0x2beda9,_0x31cf95){_0x2beda9=_0x2beda9-0x0;var _0x7c3df6=_0x3feb[_0x2beda9];return _0x7c3df6;};'use strict';var _=require(_0xb3fe('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xb3fe('0x1'));var moment=require(_0xb3fe('0x2'));var BPromise=require(_0xb3fe('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb3fe('0x4'));var rimraf=require('rimraf');var config=require(_0xb3fe('0x5'));var attributes=require('./squareReportDetail.attributes');module['exports']=function(_0x29fcf7,_0x21d1ff){return _0x29fcf7[_0xb3fe('0x6')](_0xb3fe('0x7'),attributes,{'tableName':'report_square_details','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa6d4=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareReportDetail.attributes','exports','define','util','../../config/logger','api'];(function(_0x1d7c1f,_0x339cec){var _0x119ce5=function(_0x46b742){while(--_0x46b742){_0x1d7c1f['push'](_0x1d7c1f['shift']());}};_0x119ce5(++_0x339cec);}(_0xa6d4,0x1dd));var _0x4a6d=function(_0x37c36c,_0x242347){_0x37c36c=_0x37c36c-0x0;var _0x4bc55b=_0xa6d4[_0x37c36c];return _0x4bc55b;};'use strict';var _=require('lodash');var util=require(_0x4a6d('0x0'));var logger=require(_0x4a6d('0x1'))(_0x4a6d('0x2'));var moment=require(_0x4a6d('0x3'));var BPromise=require(_0x4a6d('0x4'));var rp=require(_0x4a6d('0x5'));var fs=require('fs');var path=require(_0x4a6d('0x6'));var rimraf=require(_0x4a6d('0x7'));var config=require(_0x4a6d('0x8'));var attributes=require(_0x4a6d('0x9'));module[_0x4a6d('0xa')]=function(_0x494e7d,_0x1ada8e){return _0x494e7d[_0x4a6d('0xb')]('SquareDetailsReport',attributes,{'tableName':'report_square_details','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 b3ed02a..eff3264 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 _0xf678=['util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SquareDetailsReport,\x20%s,\x20%s','SquareDetailsReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','CreateSquareDetailsReport','create','body','options','raw','lodash'];(function(_0x5aea31,_0x1192ca){var _0x5cc58d=function(_0x519773){while(--_0x519773){_0x5aea31['push'](_0x5aea31['shift']());}};_0x5cc58d(++_0x1192ca);}(_0xf678,0x1cf));var _0x8f67=function(_0x37a997,_0x2a9b5e){_0x37a997=_0x37a997-0x0;var _0x1a24a3=_0xf678[_0x37a997];return _0x1a24a3;};'use strict';var _=require(_0x8f67('0x0'));var util=require(_0x8f67('0x1'));var moment=require(_0x8f67('0x2'));var BPromise=require('bluebird');var rs=require(_0x8f67('0x3'));var fs=require('fs');var Redis=require(_0x8f67('0x4'));var db=require(_0x8f67('0x5'))['db'];var utils=require(_0x8f67('0x6'));var logger=require(_0x8f67('0x7'))(_0x8f67('0x8'));var config=require(_0x8f67('0x9'));var jayson=require(_0x8f67('0xa'));var client=jayson[_0x8f67('0xb')][_0x8f67('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x20f5cc,_0x5f5657,_0xde9d1e){return new BPromise(function(_0x319c87,_0x5140ef){return client[_0x8f67('0xd')](_0x20f5cc,_0xde9d1e)[_0x8f67('0xe')](function(_0x52e94f){logger[_0x8f67('0xf')](_0x8f67('0x10'),_0x5f5657,'request\x20sent');logger['debug'](_0x8f67('0x11'),_0x5f5657,_0x8f67('0x12'),JSON[_0x8f67('0x13')](_0x52e94f));if(_0x52e94f[_0x8f67('0x14')]){if(_0x52e94f[_0x8f67('0x14')][_0x8f67('0x15')]===0x1f4){logger[_0x8f67('0x14')](_0x8f67('0x10'),_0x5f5657,_0x52e94f[_0x8f67('0x14')][_0x8f67('0x16')]);return _0x5140ef(_0x52e94f[_0x8f67('0x14')][_0x8f67('0x16')]);}logger['error'](_0x8f67('0x10'),_0x5f5657,_0x52e94f[_0x8f67('0x14')][_0x8f67('0x16')]);return _0x319c87(_0x52e94f['error'][_0x8f67('0x16')]);}else{logger[_0x8f67('0xf')](_0x8f67('0x10'),_0x5f5657,_0x8f67('0x12'));_0x319c87(_0x52e94f['result'][_0x8f67('0x16')]);}})[_0x8f67('0x17')](function(_0xa614d9){logger[_0x8f67('0x14')](_0x8f67('0x10'),_0x5f5657,_0xa614d9);_0x5140ef(_0xa614d9);});});}exports[_0x8f67('0x18')]=function(_0x590f95){var _0x55c75e=this;return new Promise(function(_0x3bd82c,_0x1ae332){return db['SquareDetailsReport'][_0x8f67('0x19')](_0x590f95[_0x8f67('0x1a')],{'raw':_0x590f95[_0x8f67('0x1b')]?_0x590f95['options'][_0x8f67('0x1c')]===undefined?!![]:![]:!![]})[_0x8f67('0xe')](function(_0x202f94){logger['info'](_0x8f67('0x18'),_0x590f95);logger['debug'](_0x8f67('0x18'),_0x590f95,JSON['stringify'](_0x202f94));_0x3bd82c(_0x202f94);})[_0x8f67('0x17')](function(_0x4b8940){logger['error']('CreateSquareDetailsReport',_0x4b8940[_0x8f67('0x16')],_0x590f95);_0x1ae332(_0x55c75e[_0x8f67('0x14')](0x1f4,_0x4b8940[_0x8f67('0x16')]));});});}; \ No newline at end of file +var _0x84f9=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','error','message','result','catch','CreateSquareDetailsReport','SquareDetailsReport','create','body','options','raw','stringify','lodash','moment','ioredis','../../mysqldb','../../config/utils'];(function(_0x442f12,_0x415693){var _0x2331c4=function(_0x50a392){while(--_0x50a392){_0x442f12['push'](_0x442f12['shift']());}};_0x2331c4(++_0x415693);}(_0x84f9,0x113));var _0x984f=function(_0x57405d,_0x5b87c6){_0x57405d=_0x57405d-0x0;var _0x3cf792=_0x84f9[_0x57405d];return _0x3cf792;};'use strict';var _=require(_0x984f('0x0'));var util=require('util');var moment=require(_0x984f('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x984f('0x2'));var db=require(_0x984f('0x3'))['db'];var utils=require(_0x984f('0x4'));var logger=require(_0x984f('0x5'))(_0x984f('0x6'));var config=require(_0x984f('0x7'));var jayson=require(_0x984f('0x8'));var client=jayson[_0x984f('0x9')][_0x984f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x24bbaf,_0x2099e7,_0x301e6f){return new BPromise(function(_0x593bee,_0x43e4e2){return client['request'](_0x24bbaf,_0x301e6f)[_0x984f('0xb')](function(_0xf88392){logger[_0x984f('0xc')](_0x984f('0xd'),_0x2099e7,_0x984f('0xe'));logger[_0x984f('0xf')](_0x984f('0x10'),_0x2099e7,_0x984f('0xe'),JSON['stringify'](_0xf88392));if(_0xf88392[_0x984f('0x11')]){if(_0xf88392[_0x984f('0x11')]['code']===0x1f4){logger['error'](_0x984f('0xd'),_0x2099e7,_0xf88392['error'][_0x984f('0x12')]);return _0x43e4e2(_0xf88392['error']['message']);}logger[_0x984f('0x11')]('SquareDetailsReport,\x20%s,\x20%s',_0x2099e7,_0xf88392[_0x984f('0x11')]['message']);return _0x593bee(_0xf88392[_0x984f('0x11')][_0x984f('0x12')]);}else{logger[_0x984f('0xc')](_0x984f('0xd'),_0x2099e7,_0x984f('0xe'));_0x593bee(_0xf88392[_0x984f('0x13')][_0x984f('0x12')]);}})[_0x984f('0x14')](function(_0x4d9704){logger[_0x984f('0x11')](_0x984f('0xd'),_0x2099e7,_0x4d9704);_0x43e4e2(_0x4d9704);});});}exports[_0x984f('0x15')]=function(_0x1f26a7){var _0x361c58=this;return new Promise(function(_0x499819,_0x204583){return db[_0x984f('0x16')][_0x984f('0x17')](_0x1f26a7[_0x984f('0x18')],{'raw':_0x1f26a7[_0x984f('0x19')]?_0x1f26a7[_0x984f('0x19')][_0x984f('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x5aea58){logger[_0x984f('0xc')](_0x984f('0x15'),_0x1f26a7);logger[_0x984f('0xf')](_0x984f('0x15'),_0x1f26a7,JSON[_0x984f('0x1b')](_0x5aea58));_0x499819(_0x5aea58);})['catch'](function(_0x1cd802){logger[_0x984f('0x11')](_0x984f('0x15'),_0x1cd802[_0x984f('0x12')],_0x1f26a7);_0x204583(_0x361c58[_0x984f('0x11')](0x1f4,_0x1cd802['message']));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index b6ea4c0..c03c51f 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 _0x6458=['isAuthenticated','/process/:pid/kill','killProcess','exports','express','../../components/auth/service','./system.controller','get'];(function(_0x535650,_0x34099f){var _0x502196=function(_0x4b5ae2){while(--_0x4b5ae2){_0x535650['push'](_0x535650['shift']());}};_0x502196(++_0x34099f);}(_0x6458,0x124));var _0x8645=function(_0x337ef8,_0x3971ab){_0x337ef8=_0x337ef8-0x0;var _0x585b75=_0x6458[_0x337ef8];return _0x585b75;};'use strict';var express=require(_0x8645('0x0'));var router=express['Router']();var auth=require(_0x8645('0x1'));var controller=require(_0x8645('0x2'));router[_0x8645('0x3')]('/',auth[_0x8645('0x4')](),controller['index']);router['get'](_0x8645('0x5'),auth[_0x8645('0x4')](),controller[_0x8645('0x6')]);module[_0x8645('0x7')]=router; \ No newline at end of file +var _0xe619=['get','isAuthenticated','/process/:pid/kill','killProcess','exports','express','Router','../../components/auth/service','./system.controller'];(function(_0xe6e78c,_0x582369){var _0x2a09c8=function(_0x470ccc){while(--_0x470ccc){_0xe6e78c['push'](_0xe6e78c['shift']());}};_0x2a09c8(++_0x582369);}(_0xe619,0xc2));var _0x9e61=function(_0x30d14d,_0x5b7cdc){_0x30d14d=_0x30d14d-0x0;var _0x47054e=_0xe619[_0x30d14d];return _0x47054e;};'use strict';var express=require(_0x9e61('0x0'));var router=express[_0x9e61('0x1')]();var auth=require(_0x9e61('0x2'));var controller=require(_0x9e61('0x3'));router[_0x9e61('0x4')]('/',auth[_0x9e61('0x5')](),controller['index']);router[_0x9e61('0x4')](_0x9e61('0x6'),auth[_0x9e61('0x5')](),controller[_0x9e61('0x7')]);module[_0x9e61('0x8')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index 8a81180..6f09e85 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 _0x3b19=['length','Process\x20with\x20pid\x20%s\x20not\x20found!','kill','json','systeminformation','child_process','exec','util','bluebird','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status','send','index','getAllData','then','catch','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','split'];(function(_0x3a7305,_0x12cb0b){var _0x5a6280=function(_0x53563e){while(--_0x53563e){_0x3a7305['push'](_0x3a7305['shift']());}};_0x5a6280(++_0x12cb0b);}(_0x3b19,0xa5));var _0x93b1=function(_0x6ec12b,_0x89312c){_0x6ec12b=_0x6ec12b-0x0;var _0x494756=_0x3b19[_0x6ec12b];return _0x494756;};'use strict';var info=require(_0x93b1('0x0'));var exec=require(_0x93b1('0x1'))[_0x93b1('0x2')];var logger=require('../../config/logger')('api');var util=require(_0x93b1('0x3'));var BPromise=require(_0x93b1('0x4'));var _=require('lodash');function handleError(_0x3ffab1,_0x289387,_0x31d2d1){_0x289387=_0x289387||0x1f4;return function(_0x3d977e){logger[_0x93b1('0x5')](_0x93b1('0x6'),_0x31d2d1,_0x289387,util[_0x93b1('0x7')](_0x3d977e,{'showHidden':![],'depth':null}));delete _0x3d977e[_0x93b1('0x8')];_0x3ffab1[_0x93b1('0x9')](_0x289387)[_0x93b1('0xa')](_0x3d977e);};}exports[_0x93b1('0xb')]=function(_0x5abc83,_0x67749f){return info[_0x93b1('0xc')]()[_0x93b1('0xd')](function(_0x43c533){return _0x67749f[_0x93b1('0x9')](0xc8)['json'](_0x43c533);})[_0x93b1('0xe')](function(_0x4fd8ad){return _0x67749f[_0x93b1('0x9')](0x1f4)['json'](_0x4fd8ad);});};exports['killProcess']=function(_0x4d8a29,_0x5cb013){var _0x3ceddd=['components/import/cm'];return new BPromise(function(_0x2be257,_0x22007f){return exec(util['format'](_0x93b1('0xf'),_0x4d8a29[_0x93b1('0x10')][_0x93b1('0x11')]),function(_0x5b7870,_0x35ed18,_0x402496){if(_0x5b7870){return _0x22007f(_0x5b7870);}return _0x2be257(_0x35ed18);});})[_0x93b1('0xd')](function(_0x4fe220){var _0x9082ba=![];var _0x3421c4=_0x4fe220[_0x93b1('0x12')](/\n/);for(var _0x1b65e9=0x0,_0x2037b7=_0x3ceddd[_0x93b1('0x13')];_0x1b65e9<_0x2037b7,_0x9082ba===![];_0x1b65e9+=0x1){if(_0x4fe220['indexOf'](_0x3ceddd[_0x1b65e9])>=0x0){_0x9082ba=!![];}}if(!_0x9082ba){throw new Error(util['format'](_0x93b1('0x14'),_0x4d8a29['params'][_0x93b1('0x11')]));}process[_0x93b1('0x15')](_0x4d8a29['params'][_0x93b1('0x11')],'SIGINT');return _0x5cb013[_0x93b1('0x9')](0xc8)[_0x93b1('0x16')]({'message':util['format']('Process\x20with\x20pid\x20%s\x20killed\x20correctly',_0x4d8a29[_0x93b1('0x10')][_0x93b1('0x11')])});})['catch'](handleError(_0x5cb013,null,'killProcess'));}; \ No newline at end of file +var _0xb933=['exec','api','util','bluebird','lodash','error','status','getAllData','then','json','format','params','pid','split','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','killProcess','child_process'];(function(_0x33de8a,_0x494f0b){var _0x296ed2=function(_0x50b4c2){while(--_0x50b4c2){_0x33de8a['push'](_0x33de8a['shift']());}};_0x296ed2(++_0x494f0b);}(_0xb933,0x110));var _0x3b93=function(_0x36dfbd,_0x5bfe2d){_0x36dfbd=_0x36dfbd-0x0;var _0x4ecad9=_0xb933[_0x36dfbd];return _0x4ecad9;};'use strict';var info=require('systeminformation');var exec=require(_0x3b93('0x0'))[_0x3b93('0x1')];var logger=require('../../config/logger')(_0x3b93('0x2'));var util=require(_0x3b93('0x3'));var BPromise=require(_0x3b93('0x4'));var _=require(_0x3b93('0x5'));function handleError(_0x4f274e,_0x2ed053,_0x3f9e38){_0x2ed053=_0x2ed053||0x1f4;return function(_0x339a1a){logger[_0x3b93('0x6')]('<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s',_0x3f9e38,_0x2ed053,util['inspect'](_0x339a1a,{'showHidden':![],'depth':null}));delete _0x339a1a['name'];_0x4f274e[_0x3b93('0x7')](_0x2ed053)['send'](_0x339a1a);};}exports['index']=function(_0xb0de57,_0x2af3e9){return info[_0x3b93('0x8')]()[_0x3b93('0x9')](function(_0x3d895c){return _0x2af3e9[_0x3b93('0x7')](0xc8)[_0x3b93('0xa')](_0x3d895c);})['catch'](function(_0x16b305){return _0x2af3e9[_0x3b93('0x7')](0x1f4)['json'](_0x16b305);});};exports['killProcess']=function(_0x257d2e,_0x3181d3){var _0x70773=['components/import/cm'];return new BPromise(function(_0xb4c6c9,_0x3526ec){return exec(util[_0x3b93('0xb')]('ps\x20-p\x20%s\x20-ww\x20-o\x20args',_0x257d2e[_0x3b93('0xc')][_0x3b93('0xd')]),function(_0x51a43b,_0x4bb674,_0x2cb364){if(_0x51a43b){return _0x3526ec(_0x51a43b);}return _0xb4c6c9(_0x4bb674);});})['then'](function(_0x2110bc){var _0x4893a6=![];var _0x458893=_0x2110bc[_0x3b93('0xe')](/\n/);for(var _0x110d23=0x0,_0x529920=_0x70773[_0x3b93('0xf')];_0x110d23<_0x529920,_0x4893a6===![];_0x110d23+=0x1){if(_0x2110bc[_0x3b93('0x10')](_0x70773[_0x110d23])>=0x0){_0x4893a6=!![];}}if(!_0x4893a6){throw new Error(util['format'](_0x3b93('0x11'),_0x257d2e['params'][_0x3b93('0xd')]));}process['kill'](_0x257d2e[_0x3b93('0xc')][_0x3b93('0xd')],_0x3b93('0x12'));return _0x3181d3[_0x3b93('0x7')](0xc8)[_0x3b93('0xa')]({'message':util[_0x3b93('0xb')](_0x3b93('0x13'),_0x257d2e[_0x3b93('0xc')][_0x3b93('0xd')])});})['catch'](handleError(_0x3181d3,null,_0x3b93('0x14')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index 9aa7bd2..38073c3 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 _0xb821=['post','create','put','update','delete','destroy','exports','util','path','Router','../../config/environment','./tag.controller','get','isAuthenticated','/:id','show'];(function(_0x3d5e2c,_0x32f045){var _0x40e407=function(_0x551d6f){while(--_0x551d6f){_0x3d5e2c['push'](_0x3d5e2c['shift']());}};_0x40e407(++_0x32f045);}(_0xb821,0xa7));var _0x1b82=function(_0x2ee4a6,_0x1acf75){_0x2ee4a6=_0x2ee4a6-0x0;var _0xa783e8=_0xb821[_0x2ee4a6];return _0xa783e8;};'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('0x9')]('/',auth[_0x1b82('0x6')](),controller[_0x1b82('0xa')]);router[_0x1b82('0xb')](_0x1b82('0x7'),auth['isAuthenticated'](),controller[_0x1b82('0xc')]);router[_0x1b82('0xd')](_0x1b82('0x7'),auth[_0x1b82('0x6')](),controller[_0x1b82('0xe')]);module[_0x1b82('0xf')]=router; \ No newline at end of file +var _0x22fb=['delete','destroy','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','post','create','put','update'];(function(_0x138395,_0x327395){var _0x398ea6=function(_0x36c8d4){while(--_0x36c8d4){_0x138395['push'](_0x138395['shift']());}};_0x398ea6(++_0x327395);}(_0x22fb,0x192));var _0xb22f=function(_0x4f27ae,_0x45b001){_0x4f27ae=_0x4f27ae-0x0;var _0x181fd4=_0x22fb[_0x4f27ae];return _0x181fd4;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xb22f('0x0'));var timeout=require('connect-timeout');var express=require(_0xb22f('0x1'));var router=express[_0xb22f('0x2')]();var auth=require(_0xb22f('0x3'));var interaction=require(_0xb22f('0x4'));var config=require(_0xb22f('0x5'));var controller=require('./tag.controller');router[_0xb22f('0x6')]('/',auth[_0xb22f('0x7')](),controller[_0xb22f('0x8')]);router[_0xb22f('0x6')](_0xb22f('0x9'),auth[_0xb22f('0x7')](),controller['show']);router[_0xb22f('0xa')]('/',auth[_0xb22f('0x7')](),controller[_0xb22f('0xb')]);router[_0xb22f('0xc')](_0xb22f('0x9'),auth[_0xb22f('0x7')](),controller[_0xb22f('0xd')]);router[_0xb22f('0xe')](_0xb22f('0x9'),auth[_0xb22f('0x7')](),controller[_0xb22f('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index 3a3b8a7..4c10f90 100644 --- a/server/api/tag/tag.attributes.js +++ b/server/api/tag/tag.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x878f=['STRING','name','#0091EA','exports'];(function(_0x3d951c,_0x4a0695){var _0x1b91b5=function(_0x31c33b){while(--_0x31c33b){_0x3d951c['push'](_0x3d951c['shift']());}};_0x1b91b5(++_0x4a0695);}(_0x878f,0x173));var _0xf878=function(_0x407e2d,_0x214ccc){_0x407e2d=_0x407e2d-0x0;var _0x1e8675=_0x878f[_0x407e2d];return _0x1e8675;};'use strict';var Sequelize=require('sequelize');module[_0xf878('0x0')]={'name':{'type':Sequelize[_0xf878('0x1')],'unique':_0xf878('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0xf878('0x1')],'defaultValue':_0xf878('0x3')},'description':{'type':Sequelize[_0xf878('0x1')]}}; \ No newline at end of file +var _0x9ffd=['STRING','#0091EA','sequelize','exports'];(function(_0x743ee2,_0x59ae46){var _0x131165=function(_0xf6ca01){while(--_0xf6ca01){_0x743ee2['push'](_0x743ee2['shift']());}};_0x131165(++_0x59ae46);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x3af0ab,_0x23866f){_0x3af0ab=_0x3af0ab-0x0;var _0x5a00d3=_0x9ffd[_0x3af0ab];return _0x5a00d3;};'use strict';var Sequelize=require(_0xd9ff('0x0'));module[_0xd9ff('0x1')]={'name':{'type':Sequelize[_0xd9ff('0x2')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0xd9ff('0x2')],'defaultValue':_0xd9ff('0x3')},'description':{'type':Sequelize[_0xd9ff('0x2')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index e608eba..48eb53b 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 _0x8b3f=['squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','save','update','then','destroy','get','Tags','error','name','send','index','Tag','rawAttributes','fieldName','type','keys','intersection','model','query','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','map','VIRTUAL','includeAll','rows','catch','show','params','find','create','user','role','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs'];(function(_0x51a75f,_0x219eba){var _0x2ecef4=function(_0x178f12){while(--_0x178f12){_0x51a75f['push'](_0x51a75f['shift']());}};_0x2ecef4(++_0x219eba);}(_0x8b3f,0x8e));var _0xf8b3=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x8b3f[_0x2641f9];return _0x585741;};'use strict';var pdf=require(_0xf8b3('0x0'));var emlformat=require(_0xf8b3('0x1'));var rimraf=require(_0xf8b3('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf8b3('0x3'));var rp=require(_0xf8b3('0x4'));var moment=require(_0xf8b3('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xf8b3('0x6'));var util=require(_0xf8b3('0x7'));var path=require(_0xf8b3('0x8'));var sox=require(_0xf8b3('0x9'));var csv=require(_0xf8b3('0xa'));var ejs=require(_0xf8b3('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xf8b3('0xc'));var crypto=require(_0xf8b3('0xd'));var jsforce=require(_0xf8b3('0xe'));var deskjs=require(_0xf8b3('0xf'));var toCsv=require(_0xf8b3('0xa'));var querystring=require(_0xf8b3('0x10'));var Papa=require(_0xf8b3('0x11'));var Redis=require('ioredis');var authService=require(_0xf8b3('0x12'));var qs=require(_0xf8b3('0x13'));var as=require(_0xf8b3('0x14'));var hardwareService=require(_0xf8b3('0x15'));var logger=require(_0xf8b3('0x16'))('api');var utils=require('../../config/utils');var config=require(_0xf8b3('0x17'));var db=require(_0xf8b3('0x18'))['db'];function respondWithStatusCode(_0x1a632d,_0x44900d){_0x44900d=_0x44900d||0xcc;return function(_0x5ee179){if(_0x5ee179){return _0x1a632d['sendStatus'](_0x44900d);}return _0x1a632d[_0xf8b3('0x19')](_0x44900d)[_0xf8b3('0x1a')]();};}function respondWithResult(_0x31934e,_0x18cc54){_0x18cc54=_0x18cc54||0xc8;return function(_0x47517b){if(_0x47517b){return _0x31934e[_0xf8b3('0x19')](_0x18cc54)[_0xf8b3('0x1b')](_0x47517b);}};}function respondWithFilteredResult(_0x2b7f0e,_0x341082){return function(_0x2c005e){if(_0x2c005e){var _0x4b0140=_0x2c005e[_0xf8b3('0x1c')],_0x455310=_0x341082['offset'],_0x5c0aba=_0x341082[_0xf8b3('0x1d')]+_0x341082[_0xf8b3('0x1e')],_0x581bb4;if(_0x5c0aba>=_0x4b0140){_0x5c0aba=_0x4b0140;_0x581bb4=0xc8;}else{_0x581bb4=0xce;}_0x2b7f0e['status'](_0x581bb4);return _0x2b7f0e[_0xf8b3('0x1f')](_0xf8b3('0x20'),_0x455310+'-'+_0x5c0aba+'/'+_0x4b0140)[_0xf8b3('0x1b')](_0x2c005e);}return null;};}function patchUpdates(_0x292661){return function(_0x493a85){try{jsonpatch['apply'](_0x493a85,_0x292661,!![]);}catch(_0x5bafa2){return BPromise['reject'](_0x5bafa2);}return _0x493a85[_0xf8b3('0x21')]();};}function saveUpdates(_0x38f5fc,_0xf8acb1){return function(_0x1a8644){if(_0x1a8644){return _0x1a8644[_0xf8b3('0x22')](_0x38f5fc)[_0xf8b3('0x23')](function(_0x5b0dfc){return _0x5b0dfc;});}return null;};}function removeEntity(_0x2c0652,_0x54f3ea){return function(_0x4db6d3){if(_0x4db6d3){return _0x4db6d3[_0xf8b3('0x24')]()[_0xf8b3('0x23')](function(){var _0x5d5014=_0x4db6d3[_0xf8b3('0x25')]({'plain':!![]});var _0x4fee25=_0xf8b3('0x26');return db['UserProfileResource']['destroy']({'where':{'type':_0x4fee25,'resourceId':_0x5d5014['id']}})[_0xf8b3('0x23')](function(){return _0x4db6d3;});})[_0xf8b3('0x23')](function(){_0x2c0652[_0xf8b3('0x19')](0xcc)[_0xf8b3('0x1a')]();});}};}function handleEntityNotFound(_0x43c218,_0x4048ea){return function(_0x5893bd){if(!_0x5893bd){_0x43c218['sendStatus'](0x194);}return _0x5893bd;};}function handleError(_0x374ee6,_0x3ffe75){_0x3ffe75=_0x3ffe75||0x1f4;return function(_0x11dbec){logger[_0xf8b3('0x27')](_0x11dbec['stack']);if(_0x11dbec[_0xf8b3('0x28')]){delete _0x11dbec[_0xf8b3('0x28')];}_0x374ee6[_0xf8b3('0x19')](_0x3ffe75)[_0xf8b3('0x29')](_0x11dbec);};}exports[_0xf8b3('0x2a')]=function(_0x5eecb5,_0x30e911){var _0x44d0d7={},_0x888194={},_0x3a8597={'count':0x0,'rows':[]};var _0x13bbd8=_['map'](db[_0xf8b3('0x2b')][_0xf8b3('0x2c')],function(_0x41c443){return{'name':_0x41c443[_0xf8b3('0x2d')],'type':_0x41c443[_0xf8b3('0x2e')]['key']};});_0x888194['model']=_['map'](_0x13bbd8,_0xf8b3('0x28'));_0x888194['query']=_[_0xf8b3('0x2f')](_0x5eecb5['query']);_0x888194['filters']=_[_0xf8b3('0x30')](_0x888194[_0xf8b3('0x31')],_0x888194[_0xf8b3('0x32')]);_0x44d0d7['attributes']=_[_0xf8b3('0x30')](_0x888194[_0xf8b3('0x31')],qs[_0xf8b3('0x33')](_0x5eecb5['query'][_0xf8b3('0x33')]));_0x44d0d7['attributes']=_0x44d0d7[_0xf8b3('0x34')]['length']?_0x44d0d7['attributes']:_0x888194[_0xf8b3('0x31')];if(!_0x5eecb5[_0xf8b3('0x32')][_0xf8b3('0x35')](_0xf8b3('0x36'))){_0x44d0d7[_0xf8b3('0x1e')]=qs[_0xf8b3('0x1e')](_0x5eecb5[_0xf8b3('0x32')][_0xf8b3('0x1e')]);_0x44d0d7[_0xf8b3('0x1d')]=qs[_0xf8b3('0x1d')](_0x5eecb5[_0xf8b3('0x32')][_0xf8b3('0x1d')]);}_0x44d0d7[_0xf8b3('0x37')]=qs[_0xf8b3('0x38')](_0x5eecb5[_0xf8b3('0x32')][_0xf8b3('0x38')]);_0x44d0d7[_0xf8b3('0x39')]=qs[_0xf8b3('0x3a')](_[_0xf8b3('0x3b')](_0x5eecb5[_0xf8b3('0x32')],_0x888194['filters']));if(_0x5eecb5[_0xf8b3('0x32')][_0xf8b3('0x3c')]){_0x44d0d7['where']=_[_0xf8b3('0x3d')](_0x44d0d7[_0xf8b3('0x39')],{'$or':_[_0xf8b3('0x3e')](_0x13bbd8,function(_0x41c828){if(_0x41c828['type']!==_0xf8b3('0x3f')){var _0x24938d={};_0x24938d[_0x41c828[_0xf8b3('0x28')]]={'$like':'%'+_0x5eecb5['query'][_0xf8b3('0x3c')]+'%'};return _0x24938d;}})});}_0x44d0d7=_[_0xf8b3('0x3d')]({},_0x44d0d7,_0x5eecb5['options']);var _0x3f0cfb={'where':_0x44d0d7['where']};return db[_0xf8b3('0x2b')]['count'](_0x3f0cfb)[_0xf8b3('0x23')](function(_0x24aef0){_0x3a8597[_0xf8b3('0x1c')]=_0x24aef0;if(_0x5eecb5[_0xf8b3('0x32')][_0xf8b3('0x40')]){_0x44d0d7['include']=[{'all':!![]}];}return db['Tag']['findAll'](_0x44d0d7);})[_0xf8b3('0x23')](function(_0x5a879d){_0x3a8597[_0xf8b3('0x41')]=_0x5a879d;return _0x3a8597;})[_0xf8b3('0x23')](respondWithFilteredResult(_0x30e911,_0x44d0d7))[_0xf8b3('0x42')](handleError(_0x30e911,null));};exports[_0xf8b3('0x43')]=function(_0x2b8807,_0xd877e7){var _0x302ce8={'raw':!![],'where':{'id':_0x2b8807[_0xf8b3('0x44')]['id']}},_0x2bd1ff={};_0x2bd1ff[_0xf8b3('0x31')]=_['keys'](db[_0xf8b3('0x2b')][_0xf8b3('0x2c')]);_0x2bd1ff[_0xf8b3('0x32')]=_[_0xf8b3('0x2f')](_0x2b8807[_0xf8b3('0x32')]);_0x2bd1ff[_0xf8b3('0x3a')]=_[_0xf8b3('0x30')](_0x2bd1ff['model'],_0x2bd1ff[_0xf8b3('0x32')]);_0x302ce8[_0xf8b3('0x34')]=_[_0xf8b3('0x30')](_0x2bd1ff[_0xf8b3('0x31')],qs['fields'](_0x2b8807[_0xf8b3('0x32')][_0xf8b3('0x33')]));_0x302ce8[_0xf8b3('0x34')]=_0x302ce8[_0xf8b3('0x34')]['length']?_0x302ce8[_0xf8b3('0x34')]:_0x2bd1ff[_0xf8b3('0x31')];if(_0x2b8807[_0xf8b3('0x32')][_0xf8b3('0x40')]){_0x302ce8['include']=[{'all':!![]}];}_0x302ce8=_['merge']({},_0x302ce8,_0x2b8807['options']);return db[_0xf8b3('0x2b')][_0xf8b3('0x45')](_0x302ce8)['then'](handleEntityNotFound(_0xd877e7,null))[_0xf8b3('0x23')](respondWithResult(_0xd877e7,null))[_0xf8b3('0x42')](handleError(_0xd877e7,null));};exports[_0xf8b3('0x46')]=function(_0x5e5520,_0x4d25b4){return db[_0xf8b3('0x2b')]['create'](_0x5e5520['body'],{})[_0xf8b3('0x23')](function(_0x449662){var _0x44a743=_0x5e5520[_0xf8b3('0x47')][_0xf8b3('0x25')]({'plain':!![]});if(!_0x44a743)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x44a743[_0xf8b3('0x48')]===_0xf8b3('0x47')){var _0x2eb405=_0x449662[_0xf8b3('0x25')]({'plain':!![]});var _0xbca357='Tags';return db['UserProfileSection'][_0xf8b3('0x45')]({'where':{'name':_0xbca357,'userProfileId':_0x44a743[_0xf8b3('0x49')]},'raw':!![]})['then'](function(_0xa42b22){if(_0xa42b22&&_0xa42b22['autoAssociation']===0x0){return db[_0xf8b3('0x4a')][_0xf8b3('0x46')]({'name':_0x2eb405[_0xf8b3('0x28')],'resourceId':_0x2eb405['id'],'type':_0xa42b22[_0xf8b3('0x28')],'sectionId':_0xa42b22['id']},{})['then'](function(){return _0x449662;});}else{return _0x449662;}})[_0xf8b3('0x42')](function(_0x3bd768){logger[_0xf8b3('0x27')](_0xf8b3('0x4b'),_0x3bd768);throw _0x3bd768;});}return _0x449662;})[_0xf8b3('0x23')](respondWithResult(_0x4d25b4,0xc9))[_0xf8b3('0x42')](handleError(_0x4d25b4,null));};exports[_0xf8b3('0x22')]=function(_0x3ee7c9,_0x6e226c){if(_0x3ee7c9[_0xf8b3('0x4c')]['id']){delete _0x3ee7c9[_0xf8b3('0x4c')]['id'];}return db[_0xf8b3('0x2b')]['find']({'where':{'id':_0x3ee7c9[_0xf8b3('0x44')]['id']}})['then'](handleEntityNotFound(_0x6e226c,null))[_0xf8b3('0x23')](saveUpdates(_0x3ee7c9[_0xf8b3('0x4c')],null))[_0xf8b3('0x23')](respondWithResult(_0x6e226c,null))[_0xf8b3('0x42')](handleError(_0x6e226c,null));};exports['destroy']=function(_0x3661f0,_0xaf9bba){return db[_0xf8b3('0x2b')][_0xf8b3('0x45')]({'where':{'id':_0x3661f0[_0xf8b3('0x44')]['id']}})[_0xf8b3('0x23')](handleEntityNotFound(_0xaf9bba,null))[_0xf8b3('0x23')](removeEntity(_0xaf9bba,null))['catch'](handleError(_0xaf9bba,null));}; \ No newline at end of file +var _0x4112=['bluebird','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','Tags','UserProfileResource','error','stack','name','send','map','Tag','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','findAll','rows','catch','show','params','includeAll','include','find','create','body','user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x1fea80,_0x1604bd){var _0x103b97=function(_0xa441b8){while(--_0xa441b8){_0x1fea80['push'](_0x1fea80['shift']());}};_0x103b97(++_0x1604bd);}(_0x4112,0x14e));var _0x2411=function(_0x366ef4,_0x5c8d0c){_0x366ef4=_0x366ef4-0x0;var _0x4440e2=_0x4112[_0x366ef4];return _0x4440e2;};'use strict';var pdf=require(_0x2411('0x0'));var emlformat=require(_0x2411('0x1'));var rimraf=require(_0x2411('0x2'));var zipdir=require(_0x2411('0x3'));var jsonpatch=require(_0x2411('0x4'));var rp=require(_0x2411('0x5'));var moment=require('moment');var BPromise=require(_0x2411('0x6'));var Mustache=require(_0x2411('0x7'));var util=require(_0x2411('0x8'));var path=require(_0x2411('0x9'));var sox=require(_0x2411('0xa'));var csv=require(_0x2411('0xb'));var ejs=require(_0x2411('0xc'));var fs=require('fs');var _=require(_0x2411('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x2411('0xe'));var deskjs=require(_0x2411('0xf'));var toCsv=require('to-csv');var querystring=require(_0x2411('0x10'));var Papa=require(_0x2411('0x11'));var Redis=require(_0x2411('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x2411('0x13'));var hardwareService=require(_0x2411('0x14'));var logger=require(_0x2411('0x15'))(_0x2411('0x16'));var utils=require(_0x2411('0x17'));var config=require(_0x2411('0x18'));var db=require(_0x2411('0x19'))['db'];function respondWithStatusCode(_0x139114,_0x550075){_0x550075=_0x550075||0xcc;return function(_0x18a11b){if(_0x18a11b){return _0x139114[_0x2411('0x1a')](_0x550075);}return _0x139114[_0x2411('0x1b')](_0x550075)[_0x2411('0x1c')]();};}function respondWithResult(_0x3d6206,_0x587168){_0x587168=_0x587168||0xc8;return function(_0x333858){if(_0x333858){return _0x3d6206['status'](_0x587168)[_0x2411('0x1d')](_0x333858);}};}function respondWithFilteredResult(_0x326684,_0x364f13){return function(_0x2b385d){if(_0x2b385d){var _0x113d27=_0x2b385d['count'],_0x46616c=_0x364f13[_0x2411('0x1e')],_0x3fb482=_0x364f13[_0x2411('0x1e')]+_0x364f13[_0x2411('0x1f')],_0x2b36a0;if(_0x3fb482>=_0x113d27){_0x3fb482=_0x113d27;_0x2b36a0=0xc8;}else{_0x2b36a0=0xce;}_0x326684[_0x2411('0x1b')](_0x2b36a0);return _0x326684[_0x2411('0x20')](_0x2411('0x21'),_0x46616c+'-'+_0x3fb482+'/'+_0x113d27)[_0x2411('0x1d')](_0x2b385d);}return null;};}function patchUpdates(_0x58fb4f){return function(_0x3dfa97){try{jsonpatch[_0x2411('0x22')](_0x3dfa97,_0x58fb4f,!![]);}catch(_0x202c36){return BPromise[_0x2411('0x23')](_0x202c36);}return _0x3dfa97[_0x2411('0x24')]();};}function saveUpdates(_0xb6b574,_0x24f70c){return function(_0x599df3){if(_0x599df3){return _0x599df3[_0x2411('0x25')](_0xb6b574)[_0x2411('0x26')](function(_0x16ba78){return _0x16ba78;});}return null;};}function removeEntity(_0x3222c8,_0x145b63){return function(_0x22be13){if(_0x22be13){return _0x22be13[_0x2411('0x27')]()[_0x2411('0x26')](function(){var _0x366319=_0x22be13[_0x2411('0x28')]({'plain':!![]});var _0x353af0=_0x2411('0x29');return db[_0x2411('0x2a')][_0x2411('0x27')]({'where':{'type':_0x353af0,'resourceId':_0x366319['id']}})[_0x2411('0x26')](function(){return _0x22be13;});})[_0x2411('0x26')](function(){_0x3222c8[_0x2411('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x54c350,_0x15a8ec){return function(_0x42b0f5){if(!_0x42b0f5){_0x54c350[_0x2411('0x1a')](0x194);}return _0x42b0f5;};}function handleError(_0x19804b,_0x36617a){_0x36617a=_0x36617a||0x1f4;return function(_0x4ca85c){logger[_0x2411('0x2b')](_0x4ca85c[_0x2411('0x2c')]);if(_0x4ca85c['name']){delete _0x4ca85c[_0x2411('0x2d')];}_0x19804b[_0x2411('0x1b')](_0x36617a)[_0x2411('0x2e')](_0x4ca85c);};}exports['index']=function(_0x4a86c5,_0x5a50e0){var _0x16567a={},_0x49ac29={},_0x4a30a5={'count':0x0,'rows':[]};var _0xc30212=_[_0x2411('0x2f')](db[_0x2411('0x30')]['rawAttributes'],function(_0x242ebe){return{'name':_0x242ebe[_0x2411('0x31')],'type':_0x242ebe[_0x2411('0x32')]['key']};});_0x49ac29[_0x2411('0x33')]=_[_0x2411('0x2f')](_0xc30212,_0x2411('0x2d'));_0x49ac29['query']=_[_0x2411('0x34')](_0x4a86c5[_0x2411('0x35')]);_0x49ac29[_0x2411('0x36')]=_[_0x2411('0x37')](_0x49ac29['model'],_0x49ac29[_0x2411('0x35')]);_0x16567a[_0x2411('0x38')]=_[_0x2411('0x37')](_0x49ac29[_0x2411('0x33')],qs[_0x2411('0x39')](_0x4a86c5[_0x2411('0x35')]['fields']));_0x16567a['attributes']=_0x16567a[_0x2411('0x38')][_0x2411('0x3a')]?_0x16567a[_0x2411('0x38')]:_0x49ac29[_0x2411('0x33')];if(!_0x4a86c5['query'][_0x2411('0x3b')](_0x2411('0x3c'))){_0x16567a[_0x2411('0x1f')]=qs[_0x2411('0x1f')](_0x4a86c5[_0x2411('0x35')][_0x2411('0x1f')]);_0x16567a[_0x2411('0x1e')]=qs[_0x2411('0x1e')](_0x4a86c5['query'][_0x2411('0x1e')]);}_0x16567a[_0x2411('0x3d')]=qs[_0x2411('0x3e')](_0x4a86c5[_0x2411('0x35')][_0x2411('0x3e')]);_0x16567a[_0x2411('0x3f')]=qs[_0x2411('0x36')](_[_0x2411('0x40')](_0x4a86c5['query'],_0x49ac29[_0x2411('0x36')]));if(_0x4a86c5[_0x2411('0x35')][_0x2411('0x41')]){_0x16567a['where']=_[_0x2411('0x42')](_0x16567a['where'],{'$or':_['map'](_0xc30212,function(_0x400ef2){if(_0x400ef2[_0x2411('0x32')]!==_0x2411('0x43')){var _0x18d9ac={};_0x18d9ac[_0x400ef2['name']]={'$like':'%'+_0x4a86c5['query'][_0x2411('0x41')]+'%'};return _0x18d9ac;}})});}_0x16567a=_[_0x2411('0x42')]({},_0x16567a,_0x4a86c5[_0x2411('0x44')]);var _0x2bece2={'where':_0x16567a['where']};return db['Tag'][_0x2411('0x45')](_0x2bece2)[_0x2411('0x26')](function(_0x93b9f7){_0x4a30a5['count']=_0x93b9f7;if(_0x4a86c5[_0x2411('0x35')]['includeAll']){_0x16567a['include']=[{'all':!![]}];}return db[_0x2411('0x30')][_0x2411('0x46')](_0x16567a);})[_0x2411('0x26')](function(_0x2bc7be){_0x4a30a5[_0x2411('0x47')]=_0x2bc7be;return _0x4a30a5;})['then'](respondWithFilteredResult(_0x5a50e0,_0x16567a))[_0x2411('0x48')](handleError(_0x5a50e0,null));};exports[_0x2411('0x49')]=function(_0x19a78f,_0x28acea){var _0x1ac15d={'raw':!![],'where':{'id':_0x19a78f[_0x2411('0x4a')]['id']}},_0x5879a4={};_0x5879a4[_0x2411('0x33')]=_[_0x2411('0x34')](db[_0x2411('0x30')]['rawAttributes']);_0x5879a4[_0x2411('0x35')]=_['keys'](_0x19a78f[_0x2411('0x35')]);_0x5879a4[_0x2411('0x36')]=_[_0x2411('0x37')](_0x5879a4[_0x2411('0x33')],_0x5879a4[_0x2411('0x35')]);_0x1ac15d['attributes']=_[_0x2411('0x37')](_0x5879a4['model'],qs[_0x2411('0x39')](_0x19a78f[_0x2411('0x35')]['fields']));_0x1ac15d['attributes']=_0x1ac15d[_0x2411('0x38')][_0x2411('0x3a')]?_0x1ac15d[_0x2411('0x38')]:_0x5879a4[_0x2411('0x33')];if(_0x19a78f['query'][_0x2411('0x4b')]){_0x1ac15d[_0x2411('0x4c')]=[{'all':!![]}];}_0x1ac15d=_['merge']({},_0x1ac15d,_0x19a78f['options']);return db[_0x2411('0x30')][_0x2411('0x4d')](_0x1ac15d)[_0x2411('0x26')](handleEntityNotFound(_0x28acea,null))['then'](respondWithResult(_0x28acea,null))[_0x2411('0x48')](handleError(_0x28acea,null));};exports[_0x2411('0x4e')]=function(_0x4c4ef2,_0xb169c3){return db[_0x2411('0x30')][_0x2411('0x4e')](_0x4c4ef2[_0x2411('0x4f')],{})['then'](function(_0x588bb1){var _0x4adb8e=_0x4c4ef2[_0x2411('0x50')][_0x2411('0x28')]({'plain':!![]});if(!_0x4adb8e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4adb8e[_0x2411('0x51')]===_0x2411('0x50')){var _0x6ad33f=_0x588bb1[_0x2411('0x28')]({'plain':!![]});var _0x469592=_0x2411('0x29');return db['UserProfileSection'][_0x2411('0x4d')]({'where':{'name':_0x469592,'userProfileId':_0x4adb8e[_0x2411('0x52')]},'raw':!![]})[_0x2411('0x26')](function(_0xee6d18){if(_0xee6d18&&_0xee6d18[_0x2411('0x53')]===0x0){return db[_0x2411('0x2a')][_0x2411('0x4e')]({'name':_0x6ad33f[_0x2411('0x2d')],'resourceId':_0x6ad33f['id'],'type':_0xee6d18[_0x2411('0x2d')],'sectionId':_0xee6d18['id']},{})[_0x2411('0x26')](function(){return _0x588bb1;});}else{return _0x588bb1;}})[_0x2411('0x48')](function(_0x2fa143){logger[_0x2411('0x2b')](_0x2411('0x54'),_0x2fa143);throw _0x2fa143;});}return _0x588bb1;})[_0x2411('0x26')](respondWithResult(_0xb169c3,0xc9))[_0x2411('0x48')](handleError(_0xb169c3,null));};exports[_0x2411('0x25')]=function(_0x4fe86c,_0xffdcee){if(_0x4fe86c[_0x2411('0x4f')]['id']){delete _0x4fe86c[_0x2411('0x4f')]['id'];}return db[_0x2411('0x30')][_0x2411('0x4d')]({'where':{'id':_0x4fe86c[_0x2411('0x4a')]['id']}})[_0x2411('0x26')](handleEntityNotFound(_0xffdcee,null))['then'](saveUpdates(_0x4fe86c[_0x2411('0x4f')],null))['then'](respondWithResult(_0xffdcee,null))[_0x2411('0x48')](handleError(_0xffdcee,null));};exports[_0x2411('0x27')]=function(_0x6c7389,_0x5f34b5){return db[_0x2411('0x30')][_0x2411('0x4d')]({'where':{'id':_0x6c7389[_0x2411('0x4a')]['id']}})[_0x2411('0x26')](handleEntityNotFound(_0x5f34b5,null))[_0x2411('0x26')](removeEntity(_0x5f34b5,null))['catch'](handleError(_0x5f34b5,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index abdf96b..81ee7c3 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 _0xfd49=['../../config/environment','./tag.attributes','tools_tags','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x1ea67e,_0x2f43c5){var _0x1d05fa=function(_0x18c1c5){while(--_0x18c1c5){_0x1ea67e['push'](_0x1ea67e['shift']());}};_0x1d05fa(++_0x2f43c5);}(_0xfd49,0x121));var _0x9fd4=function(_0xf66a57,_0x33033f){_0xf66a57=_0xf66a57-0x0;var _0x1ec530=_0xfd49[_0xf66a57];return _0x1ec530;};'use strict';var _=require(_0x9fd4('0x0'));var util=require(_0x9fd4('0x1'));var logger=require(_0x9fd4('0x2'))(_0x9fd4('0x3'));var moment=require(_0x9fd4('0x4'));var BPromise=require('bluebird');var rp=require(_0x9fd4('0x5'));var fs=require('fs');var path=require(_0x9fd4('0x6'));var rimraf=require(_0x9fd4('0x7'));var config=require(_0x9fd4('0x8'));var attributes=require(_0x9fd4('0x9'));module['exports']=function(_0x5d8420,_0x89e59b){return _0x5d8420['define']('Tag',attributes,{'tableName':_0x9fd4('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1373=['path','rimraf','./tag.attributes','Tag','lodash','api','moment','bluebird','request-promise'];(function(_0x2dcf4b,_0x2b2f19){var _0x21ca9b=function(_0xe5ffe6){while(--_0xe5ffe6){_0x2dcf4b['push'](_0x2dcf4b['shift']());}};_0x21ca9b(++_0x2b2f19);}(_0x1373,0x1e1));var _0x3137=function(_0x39437d,_0x3f246c){_0x39437d=_0x39437d-0x0;var _0x358e8c=_0x1373[_0x39437d];return _0x358e8c;};'use strict';var _=require(_0x3137('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x3137('0x1'));var moment=require(_0x3137('0x2'));var BPromise=require(_0x3137('0x3'));var rp=require(_0x3137('0x4'));var fs=require('fs');var path=require(_0x3137('0x5'));var rimraf=require(_0x3137('0x6'));var config=require('../../config/environment');var attributes=require(_0x3137('0x7'));module['exports']=function(_0x265af1,_0x172999){return _0x265af1['define'](_0x3137('0x8'),attributes,{'tableName':'tools_tags','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 ac2893c..6ba878a 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 _0x13f6=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','Tag,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','lodash','util'];(function(_0x1977c2,_0x19446a){var _0x1f591c=function(_0x33d69d){while(--_0x33d69d){_0x1977c2['push'](_0x1977c2['shift']());}};_0x1f591c(++_0x19446a);}(_0x13f6,0x124));var _0x613f=function(_0x4a4c6d,_0x41392c){_0x4a4c6d=_0x4a4c6d-0x0;var _0x1f3713=_0x13f6[_0x4a4c6d];return _0x1f3713;};'use strict';var _=require(_0x613f('0x0'));var util=require(_0x613f('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x613f('0x2'));var fs=require('fs');var Redis=require(_0x613f('0x3'));var db=require(_0x613f('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x613f('0x5'))(_0x613f('0x6'));var config=require(_0x613f('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x613f('0x8')][_0x613f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5618fa,_0x4b546b,_0x5a84f2){return new BPromise(function(_0x5c93c0,_0x2d5973){return client[_0x613f('0xa')](_0x5618fa,_0x5a84f2)[_0x613f('0xb')](function(_0x35b672){logger['info'](_0x613f('0xc'),_0x4b546b,_0x613f('0xd'));logger[_0x613f('0xe')]('Tag,\x20%s,\x20%s,\x20%s',_0x4b546b,_0x613f('0xd'),JSON[_0x613f('0xf')](_0x35b672));if(_0x35b672[_0x613f('0x10')]){if(_0x35b672['error'][_0x613f('0x11')]===0x1f4){logger[_0x613f('0x10')]('Tag,\x20%s,\x20%s',_0x4b546b,_0x35b672['error']['message']);return _0x2d5973(_0x35b672[_0x613f('0x10')][_0x613f('0x12')]);}logger[_0x613f('0x10')](_0x613f('0xc'),_0x4b546b,_0x35b672[_0x613f('0x10')][_0x613f('0x12')]);return _0x5c93c0(_0x35b672[_0x613f('0x10')][_0x613f('0x12')]);}else{logger[_0x613f('0x13')](_0x613f('0xc'),_0x4b546b,'request\x20sent');_0x5c93c0(_0x35b672[_0x613f('0x14')]['message']);}})['catch'](function(_0x1bc605){logger[_0x613f('0x10')]('Tag,\x20%s,\x20%s',_0x4b546b,_0x1bc605);_0x2d5973(_0x1bc605);});});} \ No newline at end of file +var _0xcb91=['stringify','error','code','message','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','Tag,\x20%s,\x20%s','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s'];(function(_0x5c0279,_0xae6a4d){var _0x4fea12=function(_0x580df0){while(--_0x580df0){_0x5c0279['push'](_0x5c0279['shift']());}};_0x4fea12(++_0xae6a4d);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x4480b9,_0x5c2949){_0x4480b9=_0x4480b9-0x0;var _0x3f0f02=_0xcb91[_0x4480b9];return _0x3f0f02;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1cb9('0x0'));var BPromise=require(_0x1cb9('0x1'));var rs=require(_0x1cb9('0x2'));var fs=require('fs');var Redis=require(_0x1cb9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1cb9('0x4'));var logger=require(_0x1cb9('0x5'))('rpc');var config=require(_0x1cb9('0x6'));var jayson=require(_0x1cb9('0x7'));var client=jayson['client'][_0x1cb9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3f7deb,_0x4ffe20,_0x38737d){return new BPromise(function(_0x12567c,_0x59d1be){return client[_0x1cb9('0x9')](_0x3f7deb,_0x38737d)['then'](function(_0x567139){logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,_0x1cb9('0xc'));logger[_0x1cb9('0xd')](_0x1cb9('0xe'),_0x4ffe20,'request\x20sent',JSON[_0x1cb9('0xf')](_0x567139));if(_0x567139[_0x1cb9('0x10')]){if(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x11')]===0x1f4){logger[_0x1cb9('0x10')]('Tag,\x20%s,\x20%s',_0x4ffe20,_0x567139['error']['message']);return _0x59d1be(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x567139['error'][_0x1cb9('0x12')]);return _0x12567c(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}else{logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,'request\x20sent');_0x12567c(_0x567139['result'][_0x1cb9('0x12')]);}})[_0x1cb9('0x13')](function(_0x3904b7){logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x3904b7);_0x59d1be(_0x3904b7);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index bc9d0fe..3945026 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 _0xe369=['/:id','show','/:id/queues','getQueues','/:id/users','getAgents','create','addQueues','post','addAgents','put','delete','destroy','removeQueues','removeAgents','exports','multer','util','path','connect-timeout','../../components/auth/service','../../config/environment','./team.controller','get','isAuthenticated'];(function(_0x257b0e,_0x563d7e){var _0x27ac2a=function(_0x3a4bbc){while(--_0x3a4bbc){_0x257b0e['push'](_0x257b0e['shift']());}};_0x27ac2a(++_0x563d7e);}(_0xe369,0x16e));var _0x9e36=function(_0x90bc48,_0xc4750e){_0x90bc48=_0x90bc48-0x0;var _0x3c090c=_0xe369[_0x90bc48];return _0x3c090c;};'use strict';var multer=require(_0x9e36('0x0'));var util=require(_0x9e36('0x1'));var path=require(_0x9e36('0x2'));var timeout=require(_0x9e36('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x9e36('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x9e36('0x5'));var controller=require(_0x9e36('0x6'));router[_0x9e36('0x7')]('/',auth[_0x9e36('0x8')](),controller['index']);router[_0x9e36('0x7')](_0x9e36('0x9'),auth[_0x9e36('0x8')](),controller[_0x9e36('0xa')]);router[_0x9e36('0x7')](_0x9e36('0xb'),auth[_0x9e36('0x8')](),controller[_0x9e36('0xc')]);router['get'](_0x9e36('0xd'),auth[_0x9e36('0x8')](),controller[_0x9e36('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x9e36('0xf')]);router['post']('/:id/queues',auth[_0x9e36('0x8')](),controller[_0x9e36('0x10')]);router[_0x9e36('0x11')]('/:id/users',auth[_0x9e36('0x8')](),controller[_0x9e36('0x12')]);router[_0x9e36('0x13')](_0x9e36('0x9'),auth[_0x9e36('0x8')](),controller['update']);router[_0x9e36('0x14')]('/:id',auth[_0x9e36('0x8')](),controller[_0x9e36('0x15')]);router[_0x9e36('0x14')]('/:id/queues',auth['isAuthenticated'](),controller[_0x9e36('0x16')]);router[_0x9e36('0x14')](_0x9e36('0xd'),auth[_0x9e36('0x8')](),controller[_0x9e36('0x17')]);module[_0x9e36('0x18')]=router; \ No newline at end of file +var _0x29c4=['./team.controller','get','isAuthenticated','index','/:id','/:id/queues','/:id/users','getAgents','create','post','addQueues','addAgents','put','delete','destroy','removeQueues','removeAgents','exports','multer','util','express','../../components/interaction/service','../../config/environment'];(function(_0x39ddd4,_0x38ce35){var _0x3d642a=function(_0xa05ced){while(--_0xa05ced){_0x39ddd4['push'](_0x39ddd4['shift']());}};_0x3d642a(++_0x38ce35);}(_0x29c4,0x1b0));var _0x429c=function(_0x41fe30,_0x5bd5bf){_0x41fe30=_0x41fe30-0x0;var _0x1a0a17=_0x29c4[_0x41fe30];return _0x1a0a17;};'use strict';var multer=require(_0x429c('0x0'));var util=require(_0x429c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x429c('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x429c('0x3'));var config=require(_0x429c('0x4'));var controller=require(_0x429c('0x5'));router[_0x429c('0x6')]('/',auth[_0x429c('0x7')](),controller[_0x429c('0x8')]);router['get'](_0x429c('0x9'),auth[_0x429c('0x7')](),controller['show']);router[_0x429c('0x6')](_0x429c('0xa'),auth[_0x429c('0x7')](),controller['getQueues']);router['get'](_0x429c('0xb'),auth[_0x429c('0x7')](),controller[_0x429c('0xc')]);router['post']('/',auth[_0x429c('0x7')](),controller[_0x429c('0xd')]);router[_0x429c('0xe')](_0x429c('0xa'),auth[_0x429c('0x7')](),controller[_0x429c('0xf')]);router['post']('/:id/users',auth[_0x429c('0x7')](),controller[_0x429c('0x10')]);router[_0x429c('0x11')](_0x429c('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x429c('0x12')]('/:id',auth[_0x429c('0x7')](),controller[_0x429c('0x13')]);router[_0x429c('0x12')](_0x429c('0xa'),auth[_0x429c('0x7')](),controller[_0x429c('0x14')]);router['delete'](_0x429c('0xb'),auth[_0x429c('0x7')](),controller[_0x429c('0x15')]);module[_0x429c('0x16')]=router; \ No newline at end of file diff --git a/server/api/team/team.attributes.js b/server/api/team/team.attributes.js index 36cb8ec..d30a7f9 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 _0x090b=['STRING','name','exports'];(function(_0x49b78e,_0x4bd166){var _0xd7ba5b=function(_0x273a05){while(--_0x273a05){_0x49b78e['push'](_0x49b78e['shift']());}};_0xd7ba5b(++_0x4bd166);}(_0x090b,0x155));var _0xb090=function(_0x57cb39,_0x1fe405){_0x57cb39=_0x57cb39-0x0;var _0x90aa1e=_0x090b[_0x57cb39];return _0x90aa1e;};'use strict';var Sequelize=require('sequelize');module[_0xb090('0x0')]={'name':{'type':Sequelize[_0xb090('0x1')],'allowNull':![],'unique':_0xb090('0x2')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x9908=['exports','STRING','name'];(function(_0x517e45,_0x3c89df){var _0x193c73=function(_0x10303e){while(--_0x10303e){_0x517e45['push'](_0x517e45['shift']());}};_0x193c73(++_0x3c89df);}(_0x9908,0x126));var _0x8990=function(_0x15e983,_0x5824c8){_0x15e983=_0x15e983-0x0;var _0x3a1ec0=_0x9908[_0x15e983];return _0x3a1ec0;};'use strict';var Sequelize=require('sequelize');module[_0x8990('0x0')]={'name':{'type':Sequelize[_0x8990('0x1')],'allowNull':![],'unique':_0x8990('0x2')},'description':{'type':Sequelize[_0x8990('0x1')]}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index 94a4bdf..99de749 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 _0x87bc=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','findOne','channel','isValidChannel','Sequelize','ValidationError','Unknown\x20channel','capitalize','toLowerCase','Queues','add','removeQueues','remove','ids','Voice','Chat','Sms','Fax','each','User','online','voicePause','interface','UserVoiceQueueRt','upsert','SIP/%s','addAgents','omit','removeAgents','voice','chat','mail','sms','openchannel','isArray','emit','userTeam:remove','getAgents','html-pdf','eml-format','zip-dir','moment','mustache','to-csv','ejs','lodash','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../mysqldb','redis','defaults','socket.io-emitter','./team.socket','register','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','Teams','UserProfileResource','error','name','index','map','Team','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','includeAll','include','findAll','rows','catch','show','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId'];(function(_0x42daae,_0x167049){var _0x291df4=function(_0x309dc2){while(--_0x309dc2){_0x42daae['push'](_0x42daae['shift']());}};_0x291df4(++_0x167049);}(_0x87bc,0x189));var _0xc87b=function(_0x1ca064,_0xbe096c){_0x1ca064=_0x1ca064-0x0;var _0x3943cd=_0x87bc[_0x1ca064];return _0x3943cd;};'use strict';var pdf=require(_0xc87b('0x0'));var emlformat=require(_0xc87b('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xc87b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xc87b('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xc87b('0x4'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xc87b('0x5'));var ejs=require(_0xc87b('0x6'));var fs=require('fs');var _=require(_0xc87b('0x7'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xc87b('0x8'));var toCsv=require(_0xc87b('0x5'));var querystring=require(_0xc87b('0x9'));var Papa=require(_0xc87b('0xa'));var Redis=require(_0xc87b('0xb'));var authService=require(_0xc87b('0xc'));var qs=require(_0xc87b('0xd'));var as=require(_0xc87b('0xe'));var hardwareService=require(_0xc87b('0xf'));var logger=require('../../config/logger')('api');var utils=require(_0xc87b('0x10'));var config=require('../../config/environment');var db=require(_0xc87b('0x11'))['db'];config[_0xc87b('0x12')]=_[_0xc87b('0x13')](config[_0xc87b('0x12')],{'host':'localhost','port':0x18eb});var socket=require(_0xc87b('0x14'))(new Redis(config['redis']));require(_0xc87b('0x15'))[_0xc87b('0x16')](socket);function respondWithStatusCode(_0x536105,_0x148922){_0x148922=_0x148922||0xcc;return function(_0x25006a){if(_0x25006a){return _0x536105['sendStatus'](_0x148922);}return _0x536105[_0xc87b('0x17')](_0x148922)[_0xc87b('0x18')]();};}function respondWithResult(_0x34195e,_0x1cd9c0){_0x1cd9c0=_0x1cd9c0||0xc8;return function(_0x212813){if(_0x212813){return _0x34195e[_0xc87b('0x17')](_0x1cd9c0)[_0xc87b('0x19')](_0x212813);}};}function respondWithFilteredResult(_0x461bbd,_0x5db718){return function(_0x124962){if(_0x124962){var _0x5b5a36=_0x124962[_0xc87b('0x1a')],_0x30179b=_0x5db718[_0xc87b('0x1b')],_0x67e40e=_0x5db718['offset']+_0x5db718[_0xc87b('0x1c')],_0x534b6d;if(_0x67e40e>=_0x5b5a36){_0x67e40e=_0x5b5a36;_0x534b6d=0xc8;}else{_0x534b6d=0xce;}_0x461bbd['status'](_0x534b6d);return _0x461bbd[_0xc87b('0x1d')](_0xc87b('0x1e'),_0x30179b+'-'+_0x67e40e+'/'+_0x5b5a36)[_0xc87b('0x19')](_0x124962);}return null;};}function patchUpdates(_0x3bd1ee){return function(_0x144d68){try{jsonpatch[_0xc87b('0x1f')](_0x144d68,_0x3bd1ee,!![]);}catch(_0x100159){return BPromise[_0xc87b('0x20')](_0x100159);}return _0x144d68[_0xc87b('0x21')]();};}function saveUpdates(_0x528c54,_0x37c706){return function(_0x5266c2){if(_0x5266c2){return _0x5266c2[_0xc87b('0x22')](_0x528c54)[_0xc87b('0x23')](function(_0x147731){return _0x147731;});}return null;};}function removeEntity(_0x4bff29,_0x540ae5){return function(_0x31b14){if(_0x31b14){return _0x31b14[_0xc87b('0x24')]()[_0xc87b('0x23')](function(){var _0x2e4b16=_0x31b14[_0xc87b('0x25')]({'plain':!![]});var _0x557efe=_0xc87b('0x26');return db[_0xc87b('0x27')][_0xc87b('0x24')]({'where':{'type':_0x557efe,'resourceId':_0x2e4b16['id']}})[_0xc87b('0x23')](function(){return _0x31b14;});})[_0xc87b('0x23')](function(){_0x4bff29['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x56d3d8,_0x9507c0){return function(_0x1c4a82){if(!_0x1c4a82){_0x56d3d8['sendStatus'](0x194);}return _0x1c4a82;};}function handleError(_0x580a7a,_0x281692){_0x281692=_0x281692||0x1f4;return function(_0x5900ad){logger[_0xc87b('0x28')](_0x5900ad['stack']);if(_0x5900ad[_0xc87b('0x29')]){delete _0x5900ad[_0xc87b('0x29')];}_0x580a7a[_0xc87b('0x17')](_0x281692)['send'](_0x5900ad);};}exports[_0xc87b('0x2a')]=function(_0x24fd6f,_0x166456){var _0x384230={},_0x458a86={},_0xd427f5={'count':0x0,'rows':[]};var _0x215be4=_[_0xc87b('0x2b')](db[_0xc87b('0x2c')][_0xc87b('0x2d')],function(_0x210522){return{'name':_0x210522[_0xc87b('0x2e')],'type':_0x210522['type'][_0xc87b('0x2f')]};});_0x458a86[_0xc87b('0x30')]=_['map'](_0x215be4,_0xc87b('0x29'));_0x458a86[_0xc87b('0x31')]=_[_0xc87b('0x32')](_0x24fd6f['query']);_0x458a86[_0xc87b('0x33')]=_[_0xc87b('0x34')](_0x458a86[_0xc87b('0x30')],_0x458a86[_0xc87b('0x31')]);_0x384230[_0xc87b('0x35')]=_['intersection'](_0x458a86['model'],qs[_0xc87b('0x36')](_0x24fd6f['query'][_0xc87b('0x36')]));_0x384230[_0xc87b('0x35')]=_0x384230[_0xc87b('0x35')][_0xc87b('0x37')]?_0x384230['attributes']:_0x458a86[_0xc87b('0x30')];if(!_0x24fd6f[_0xc87b('0x31')][_0xc87b('0x38')](_0xc87b('0x39'))){_0x384230[_0xc87b('0x1c')]=qs[_0xc87b('0x1c')](_0x24fd6f[_0xc87b('0x31')]['limit']);_0x384230[_0xc87b('0x1b')]=qs['offset'](_0x24fd6f['query'][_0xc87b('0x1b')]);}_0x384230[_0xc87b('0x3a')]=qs[_0xc87b('0x3b')](_0x24fd6f[_0xc87b('0x31')][_0xc87b('0x3b')]);_0x384230[_0xc87b('0x3c')]=qs['filters'](_[_0xc87b('0x3d')](_0x24fd6f[_0xc87b('0x31')],_0x458a86[_0xc87b('0x33')]));if(_0x24fd6f[_0xc87b('0x31')]['filter']){_0x384230[_0xc87b('0x3c')]=_[_0xc87b('0x3e')](_0x384230[_0xc87b('0x3c')],{'$or':_[_0xc87b('0x2b')](_0x215be4,function(_0x563ce3){if(_0x563ce3['type']!=='VIRTUAL'){var _0x1295fa={};_0x1295fa[_0x563ce3[_0xc87b('0x29')]]={'$like':'%'+_0x24fd6f['query'][_0xc87b('0x3f')]+'%'};return _0x1295fa;}})});}_0x384230=_[_0xc87b('0x3e')]({},_0x384230,_0x24fd6f[_0xc87b('0x40')]);var _0x24ff7c={'where':_0x384230[_0xc87b('0x3c')]};return db[_0xc87b('0x2c')][_0xc87b('0x1a')](_0x24ff7c)[_0xc87b('0x23')](function(_0x4501ab){_0xd427f5[_0xc87b('0x1a')]=_0x4501ab;if(_0x24fd6f[_0xc87b('0x31')][_0xc87b('0x41')]){_0x384230[_0xc87b('0x42')]=[{'all':!![]}];}return db[_0xc87b('0x2c')][_0xc87b('0x43')](_0x384230);})['then'](function(_0x1fe353){_0xd427f5[_0xc87b('0x44')]=_0x1fe353;return _0xd427f5;})[_0xc87b('0x23')](respondWithFilteredResult(_0x166456,_0x384230))[_0xc87b('0x45')](handleError(_0x166456,null));};exports[_0xc87b('0x46')]=function(_0x56fc5e,_0x51f9a8){var _0xd5f31b={'raw':![],'where':{'id':_0x56fc5e['params']['id']}},_0x3d5d25={};_0x3d5d25[_0xc87b('0x30')]=_[_0xc87b('0x32')](db[_0xc87b('0x2c')][_0xc87b('0x2d')]);_0x3d5d25[_0xc87b('0x31')]=_[_0xc87b('0x32')](_0x56fc5e['query']);_0x3d5d25['filters']=_[_0xc87b('0x34')](_0x3d5d25[_0xc87b('0x30')],_0x3d5d25[_0xc87b('0x31')]);_0xd5f31b[_0xc87b('0x35')]=_[_0xc87b('0x34')](_0x3d5d25[_0xc87b('0x30')],qs[_0xc87b('0x36')](_0x56fc5e[_0xc87b('0x31')][_0xc87b('0x36')]));_0xd5f31b[_0xc87b('0x35')]=_0xd5f31b[_0xc87b('0x35')][_0xc87b('0x37')]?_0xd5f31b[_0xc87b('0x35')]:_0x3d5d25['model'];if(_0x56fc5e[_0xc87b('0x31')][_0xc87b('0x41')]){_0xd5f31b['include']=[{'all':!![]}];}_0xd5f31b=_[_0xc87b('0x3e')]({},_0xd5f31b,_0x56fc5e[_0xc87b('0x40')]);return db[_0xc87b('0x2c')][_0xc87b('0x47')](_0xd5f31b)[_0xc87b('0x23')](handleEntityNotFound(_0x51f9a8,null))[_0xc87b('0x23')](respondWithResult(_0x51f9a8,null))[_0xc87b('0x45')](handleError(_0x51f9a8,null));};exports['create']=function(_0x4c5507,_0x114ef7){return db['Team'][_0xc87b('0x48')](_0x4c5507[_0xc87b('0x49')],{})[_0xc87b('0x23')](function(_0x544437){var _0x3439ba=_0x4c5507[_0xc87b('0x4a')][_0xc87b('0x25')]({'plain':!![]});if(!_0x3439ba)throw new Error(_0xc87b('0x4b'));if(_0x3439ba[_0xc87b('0x4c')]===_0xc87b('0x4a')){var _0x7c4e93=_0x544437['get']({'plain':!![]});var _0x4fb487=_0xc87b('0x26');return db[_0xc87b('0x4d')][_0xc87b('0x47')]({'where':{'name':_0x4fb487,'userProfileId':_0x3439ba[_0xc87b('0x4e')]},'raw':!![]})[_0xc87b('0x23')](function(_0x51a6a9){if(_0x51a6a9&&_0x51a6a9['autoAssociation']===0x0){return db[_0xc87b('0x27')][_0xc87b('0x48')]({'name':_0x7c4e93['name'],'resourceId':_0x7c4e93['id'],'type':_0x51a6a9[_0xc87b('0x29')],'sectionId':_0x51a6a9['id']},{})[_0xc87b('0x23')](function(){return _0x544437;});}else{return _0x544437;}})[_0xc87b('0x45')](function(_0x1918ba){logger['error'](_0xc87b('0x4f'),_0x1918ba);throw _0x1918ba;});}return _0x544437;})[_0xc87b('0x23')](respondWithResult(_0x114ef7,0xc9))[_0xc87b('0x45')](handleError(_0x114ef7,null));};exports['update']=function(_0x2b5c16,_0x1d5a58){if(_0x2b5c16['body']['id']){delete _0x2b5c16[_0xc87b('0x49')]['id'];}return db[_0xc87b('0x2c')][_0xc87b('0x47')]({'where':{'id':_0x2b5c16[_0xc87b('0x50')]['id']}})[_0xc87b('0x23')](handleEntityNotFound(_0x1d5a58,null))[_0xc87b('0x23')](saveUpdates(_0x2b5c16[_0xc87b('0x49')],null))['then'](respondWithResult(_0x1d5a58,null))['catch'](handleError(_0x1d5a58,null));};exports[_0xc87b('0x24')]=function(_0x24fd7d,_0x306a56){return db[_0xc87b('0x2c')][_0xc87b('0x47')]({'where':{'id':_0x24fd7d[_0xc87b('0x50')]['id']}})['then'](handleEntityNotFound(_0x306a56,null))['then'](removeEntity(_0x306a56,null))[_0xc87b('0x45')](handleError(_0x306a56,null));};exports['getQueues']=function(_0x5d45d5,_0x2ef012,_0x20b740){return db[_0xc87b('0x2c')][_0xc87b('0x51')]({'where':{'id':_0x5d45d5[_0xc87b('0x50')]['id']}})[_0xc87b('0x23')](handleEntityNotFound(_0x2ef012,null))[_0xc87b('0x23')](function(_0x5c3134){if(!_0x5d45d5[_0xc87b('0x31')][_0xc87b('0x52')]||!utils[_0xc87b('0x53')](_0x5d45d5[_0xc87b('0x31')][_0xc87b('0x52')])){throw new db[(_0xc87b('0x54'))][(_0xc87b('0x55'))](_0xc87b('0x56'));}var _0x81d8f5={};var _0x5f4553={};_0x5f4553[_0xc87b('0x30')]=_[_0xc87b('0x32')](db[_[_0xc87b('0x57')](_0x5d45d5[_0xc87b('0x31')]['channel'][_0xc87b('0x58')]())+'Queue'][_0xc87b('0x2d')]);_0x5f4553[_0xc87b('0x31')]=_[_0xc87b('0x32')](_0x5d45d5['query']);_0x5f4553[_0xc87b('0x33')]=_[_0xc87b('0x34')](_0x5f4553[_0xc87b('0x30')],_0x5f4553[_0xc87b('0x31')]);_0x81d8f5[_0xc87b('0x35')]=_[_0xc87b('0x34')](_0x5f4553[_0xc87b('0x30')],qs[_0xc87b('0x36')](_0x5d45d5[_0xc87b('0x31')][_0xc87b('0x36')]));_0x81d8f5[_0xc87b('0x35')]=_0x81d8f5[_0xc87b('0x35')][_0xc87b('0x37')]?_0x81d8f5['attributes']:_0x5f4553['model'];_0x81d8f5[_0xc87b('0x1c')]=qs[_0xc87b('0x1c')](_0x5d45d5[_0xc87b('0x31')][_0xc87b('0x1c')]);_0x81d8f5['offset']=qs[_0xc87b('0x1b')](_0x5d45d5[_0xc87b('0x31')]['offset']);_0x81d8f5[_0xc87b('0x3a')]=qs[_0xc87b('0x3b')](_0x5d45d5[_0xc87b('0x31')][_0xc87b('0x3b')]);_0x81d8f5[_0xc87b('0x3c')]=qs[_0xc87b('0x33')](_[_0xc87b('0x3d')](_0x5d45d5[_0xc87b('0x31')],_0x5f4553[_0xc87b('0x33')]));_0x81d8f5=_['merge']({},_0x81d8f5,_0x5d45d5['options']);return _0x5c3134[_0xc87b('0x25')+_[_0xc87b('0x57')](_0x5d45d5[_0xc87b('0x31')][_0xc87b('0x52')][_0xc87b('0x58')]())+_0xc87b('0x59')](_0x81d8f5);})[_0xc87b('0x23')](respondWithResult(_0x2ef012,null))[_0xc87b('0x45')](handleError(_0x2ef012,null));};exports['addQueues']=function(_0x12c54e,_0x112d54,_0x41d93b){return db[_0xc87b('0x2c')]['findOne']({'where':{'id':_0x12c54e[_0xc87b('0x50')]['id']}})[_0xc87b('0x23')](function(_0x3bc08a){if(_0x3bc08a){if(!_0x12c54e['body'][_0xc87b('0x52')]||!utils[_0xc87b('0x53')](_0x12c54e[_0xc87b('0x49')][_0xc87b('0x52')])){throw new db[(_0xc87b('0x54'))][(_0xc87b('0x55'))](_0xc87b('0x56'));}return _0x3bc08a[_0xc87b('0x5a')+_['capitalize'](_0x12c54e['body']['channel'][_0xc87b('0x58')]())+_0xc87b('0x59')](_0x12c54e[_0xc87b('0x49')]['ids']);}return null;})[_0xc87b('0x23')](handleEntityNotFound(_0x112d54,null))[_0xc87b('0x23')](respondWithStatusCode(_0x112d54,null))[_0xc87b('0x45')](handleError(_0x112d54,null));};exports[_0xc87b('0x5b')]=function(_0x1b0242,_0x3dffc5,_0x3729e8){return db[_0xc87b('0x2c')][_0xc87b('0x51')]({'where':{'id':_0x1b0242[_0xc87b('0x50')]['id']}})[_0xc87b('0x23')](function(_0x55189a){if(_0x55189a){if(!_0x1b0242[_0xc87b('0x31')]['channel']||!utils[_0xc87b('0x53')](_0x1b0242[_0xc87b('0x31')]['channel'])){throw new db[(_0xc87b('0x54'))]['ValidationError']('Unknown\x20channel');}return _0x55189a[_0xc87b('0x5c')+_[_0xc87b('0x57')](_0x1b0242[_0xc87b('0x31')][_0xc87b('0x52')][_0xc87b('0x58')]())+_0xc87b('0x59')](_0x1b0242[_0xc87b('0x31')][_0xc87b('0x5d')]);}return null;})[_0xc87b('0x23')](handleEntityNotFound(_0x3dffc5,null))[_0xc87b('0x23')](respondWithStatusCode(_0x3dffc5,null))[_0xc87b('0x45')](handleError(_0x3dffc5,null));};exports['addAgents']=function(_0x1f41d9,_0x2edb82,_0x39794c){return db['Team']['find']({'where':{'id':_0x1f41d9['params']['id']}})['then'](handleEntityNotFound(_0x2edb82,null))[_0xc87b('0x23')](function(_0x2cd691){if(_0x2cd691){var _0x5818a7=[_0xc87b('0x5e'),_0xc87b('0x5f'),'Mail',_0xc87b('0x60'),_0xc87b('0x61'),'Openchannel'];return BPromise[_0xc87b('0x62')](_0x5818a7,function(_0x1694de){return _0x2cd691['get'+_0x1694de+_0xc87b('0x59')]({'attributes':['id',_0xc87b('0x29')]})[_0xc87b('0x23')](function(_0x5ca046){return BPromise[_0xc87b('0x62')](_0x5ca046,function(_0x55f5ce){return _0x55f5ce['addAgents'](_0x1f41d9[_0xc87b('0x49')]['ids'])['then'](function(){if(_0x1694de===_0xc87b('0x5e')){return db[_0xc87b('0x63')]['findAll']({'where':{'id':_0x1f41d9['body'][_0xc87b('0x5d')]},'attributes':['id',_0xc87b('0x29'),_0xc87b('0x64'),_0xc87b('0x65'),_0xc87b('0x66')],'raw':!![]})['then'](function(_0x2d8f87){return BPromise['each'](_[_0xc87b('0x3f')](_0x2d8f87,{'online':0x1}),function(_0x111073){return db[_0xc87b('0x67')][_0xc87b('0x68')]({'membername':_0x111073[_0xc87b('0x29')],'UserId':_0x111073['id'],'queue_name':_0x55f5ce[_0xc87b('0x29')],'VoiceQueueId':_0x55f5ce['id'],'interface':_['isNil'](_0x111073[_0xc87b('0x66')])?util['format'](_0xc87b('0x69'),_0x111073[_0xc87b('0x29')]):_0x111073[_0xc87b('0x66')],'paused':_0x111073['voicePause']||![],'penalty':0x0});});});}});});})[_0xc87b('0x23')](function(){return _0x2cd691;});})[_0xc87b('0x23')](function(){return _0x2cd691;});}})['then'](function(_0x54cc92){if(_0x54cc92){return _0x54cc92[_0xc87b('0x6a')](_0x1f41d9['body'][_0xc87b('0x5d')],_[_0xc87b('0x6b')](_0x1f41d9[_0xc87b('0x49')],[_0xc87b('0x5d'),'id'])||{})['spread'](function(_0x16e820){for(var _0x27ea89=0x0;_0x27ea89<_0x1f41d9[_0xc87b('0x49')][_0xc87b('0x5d')][_0xc87b('0x37')];_0x27ea89+=0x1){socket['emit']('userTeam:save',{'UserId':_0x1f41d9['body'][_0xc87b('0x5d')][_0x27ea89],'TeamId':_0x1f41d9['params']['id']});}return _0x16e820;});}})[_0xc87b('0x23')](respondWithResult(_0x2edb82,null))[_0xc87b('0x45')](handleError(_0x2edb82,null));};exports[_0xc87b('0x6c')]=function(_0x347c16,_0x176b7f,_0x3f1de5){return db['Team'][_0xc87b('0x47')]({'where':{'id':_0x347c16[_0xc87b('0x50')]['id']}})[_0xc87b('0x23')](handleEntityNotFound(_0x176b7f,null))[_0xc87b('0x23')](function(_0x421487){if(_0x421487){return BPromise[_0xc87b('0x62')]([_0xc87b('0x6d'),_0xc87b('0x6e'),_0xc87b('0x6f'),_0xc87b('0x70'),'fax',_0xc87b('0x71')],function(_0x38455c){return _0x421487[_0xc87b('0x25')+_[_0xc87b('0x57')](_0x38455c)+'Queues']({'attributes':['id','name']})[_0xc87b('0x23')](function(_0x4d6982){return BPromise['each'](_0x4d6982,function(_0x2ff7c8){return _0x2ff7c8[_0xc87b('0x6c')](_0x347c16[_0xc87b('0x31')][_0xc87b('0x5d')])[_0xc87b('0x23')](function(){if(_0x38455c==='voice'){return db[_0xc87b('0x67')][_0xc87b('0x24')]({'where':{'VoiceQueueId':_0x2ff7c8['id'],'UserId':_0x347c16[_0xc87b('0x31')][_0xc87b('0x5d')]}});}});});})['then'](function(){return _0x421487;});})['then'](function(){return _0x421487;});}})['then'](function(_0x5df6a4){if(_0x5df6a4){return _0x5df6a4[_0xc87b('0x6c')](_0x347c16[_0xc87b('0x31')][_0xc87b('0x5d')])[_0xc87b('0x23')](function(){if(_[_0xc87b('0x72')](_0x347c16['query'][_0xc87b('0x5d')])){for(var _0x244235=0x0;_0x244235<_0x347c16[_0xc87b('0x31')][_0xc87b('0x5d')][_0xc87b('0x37')];_0x244235+=0x1){socket[_0xc87b('0x73')]('userTeam:remove',{'UserId':Number(_0x347c16['query']['ids'][_0x244235]),'TeamId':Number(_0x347c16[_0xc87b('0x50')]['id'])});}}else{socket[_0xc87b('0x73')](_0xc87b('0x74'),{'UserId':Number(_0x347c16['query'][_0xc87b('0x5d')]),'TeamId':Number(_0x347c16[_0xc87b('0x50')]['id'])});}});}})['then'](respondWithStatusCode(_0x176b7f,null))['catch'](handleError(_0x176b7f,null));};exports['getAgents']=function(_0x3fa6a2,_0x28e7e2,_0x430086){var _0x32d390={};var _0x43f857={};var _0x12ebe4;var _0x4bd067;return db[_0xc87b('0x2c')][_0xc87b('0x51')]({'where':{'id':_0x3fa6a2[_0xc87b('0x50')]['id']}})[_0xc87b('0x23')](handleEntityNotFound(_0x28e7e2,null))[_0xc87b('0x23')](function(_0x1bc858){if(_0x1bc858){_0x12ebe4=_0x1bc858;_0x43f857['model']=_[_0xc87b('0x32')](db['User'][_0xc87b('0x2d')]);_0x43f857[_0xc87b('0x31')]=_[_0xc87b('0x32')](_0x3fa6a2['query']);_0x43f857[_0xc87b('0x33')]=_[_0xc87b('0x34')](_0x43f857[_0xc87b('0x30')],_0x43f857[_0xc87b('0x31')]);_0x32d390[_0xc87b('0x35')]=_[_0xc87b('0x34')](_0x43f857['model'],qs[_0xc87b('0x36')](_0x3fa6a2['query']['fields']));_0x32d390[_0xc87b('0x35')]=_0x32d390[_0xc87b('0x35')]['length']?_0x32d390[_0xc87b('0x35')]:_0x43f857[_0xc87b('0x30')];_0x32d390[_0xc87b('0x3a')]=qs[_0xc87b('0x3b')](_0x3fa6a2[_0xc87b('0x31')][_0xc87b('0x3b')]);_0x32d390[_0xc87b('0x3c')]=qs[_0xc87b('0x33')](_[_0xc87b('0x3d')](_0x3fa6a2[_0xc87b('0x31')],_0x43f857[_0xc87b('0x33')]));if(_0x3fa6a2['query']['filter']){_0x32d390[_0xc87b('0x3c')]=_['merge'](_0x32d390[_0xc87b('0x3c')],{'$or':_['map'](_0x32d390[_0xc87b('0x35')],function(_0x55c803){var _0x349e98={};_0x349e98[_0x55c803]={'$like':'%'+_0x3fa6a2[_0xc87b('0x31')][_0xc87b('0x3f')]+'%'};return _0x349e98;})});}_0x32d390=_[_0xc87b('0x3e')]({},_0x32d390,_0x3fa6a2['options']);return _0x12ebe4[_0xc87b('0x75')](_0x32d390);}})[_0xc87b('0x23')](function(_0x6e6a9){if(_0x6e6a9){_0x4bd067=_0x6e6a9['length'];if(!_0x3fa6a2['query'][_0xc87b('0x38')](_0xc87b('0x39'))){_0x32d390[_0xc87b('0x1c')]=qs[_0xc87b('0x1c')](_0x3fa6a2[_0xc87b('0x31')]['limit']);_0x32d390[_0xc87b('0x1b')]=qs[_0xc87b('0x1b')](_0x3fa6a2['query'][_0xc87b('0x1b')]);}return _0x12ebe4['getAgents'](_0x32d390);}})['then'](function(_0x131f63){if(_0x131f63){return _0x131f63?{'count':_0x4bd067,'rows':_0x131f63}:null;}})[_0xc87b('0x23')](respondWithResult(_0x28e7e2,null))[_0xc87b('0x45')](handleError(_0x28e7e2,null));}; \ No newline at end of file +var _0x9666=['emit','userTeam:save','voice','chat','mail','sms','fax','openchannel','removeAgents','isArray','userTeam:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','localhost','socket.io-emitter','sendStatus','status','json','offset','reject','save','update','then','destroy','get','UserProfileResource','end','stack','name','index','map','Team','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','catch','params','keys','create','user','Teams','find','userProfileId','autoAssociation','body','getQueues','findOne','isValidChannel','channel','Sequelize','ValidationError','Unknown\x20channel','capitalize','Queue','addQueues','toLowerCase','Queues','removeQueues','remove','addAgents','Voice','Chat','Mail','Sms','Openchannel','each','ids','User','findAll','online','voicePause','interface','UserVoiceQueueRt','SIP/%s','omit','spread'];(function(_0x50bbc3,_0x5e6775){var _0x40451e=function(_0x29b410){while(--_0x29b410){_0x50bbc3['push'](_0x50bbc3['shift']());}};_0x40451e(++_0x5e6775);}(_0x9666,0x17a));var _0x6966=function(_0x124a7b,_0x117844){_0x124a7b=_0x124a7b-0x0;var _0x51bb1f=_0x9666[_0x124a7b];return _0x51bb1f;};'use strict';var pdf=require(_0x6966('0x0'));var emlformat=require(_0x6966('0x1'));var rimraf=require(_0x6966('0x2'));var zipdir=require(_0x6966('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6966('0x4'));var moment=require(_0x6966('0x5'));var BPromise=require(_0x6966('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x6966('0x7'));var sox=require(_0x6966('0x8'));var csv=require(_0x6966('0x9'));var ejs=require(_0x6966('0xa'));var fs=require('fs');var _=require(_0x6966('0xb'));var squel=require(_0x6966('0xc'));var crypto=require('crypto');var jsforce=require(_0x6966('0xd'));var deskjs=require(_0x6966('0xe'));var toCsv=require(_0x6966('0x9'));var querystring=require('querystring');var Papa=require(_0x6966('0xf'));var Redis=require(_0x6966('0x10'));var authService=require(_0x6966('0x11'));var qs=require(_0x6966('0x12'));var as=require(_0x6966('0x13'));var hardwareService=require(_0x6966('0x14'));var logger=require(_0x6966('0x15'))(_0x6966('0x16'));var utils=require(_0x6966('0x17'));var config=require(_0x6966('0x18'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0x6966('0x19')],{'host':_0x6966('0x1a'),'port':0x18eb});var socket=require(_0x6966('0x1b'))(new Redis(config['redis']));require('./team.socket')['register'](socket);function respondWithStatusCode(_0x235ba3,_0xbd4ea2){_0xbd4ea2=_0xbd4ea2||0xcc;return function(_0x3e9b7d){if(_0x3e9b7d){return _0x235ba3[_0x6966('0x1c')](_0xbd4ea2);}return _0x235ba3[_0x6966('0x1d')](_0xbd4ea2)['end']();};}function respondWithResult(_0x204200,_0x1bf59d){_0x1bf59d=_0x1bf59d||0xc8;return function(_0x550d77){if(_0x550d77){return _0x204200[_0x6966('0x1d')](_0x1bf59d)[_0x6966('0x1e')](_0x550d77);}};}function respondWithFilteredResult(_0x26df66,_0x529dbd){return function(_0x2fbbdd){if(_0x2fbbdd){var _0x4bf5b8=_0x2fbbdd['count'],_0x43e2e9=_0x529dbd[_0x6966('0x1f')],_0x519049=_0x529dbd['offset']+_0x529dbd['limit'],_0x5a4ea7;if(_0x519049>=_0x4bf5b8){_0x519049=_0x4bf5b8;_0x5a4ea7=0xc8;}else{_0x5a4ea7=0xce;}_0x26df66['status'](_0x5a4ea7);return _0x26df66['set']('Content-Range',_0x43e2e9+'-'+_0x519049+'/'+_0x4bf5b8)[_0x6966('0x1e')](_0x2fbbdd);}return null;};}function patchUpdates(_0x247570){return function(_0x10b9f6){try{jsonpatch['apply'](_0x10b9f6,_0x247570,!![]);}catch(_0x1bfdcd){return BPromise[_0x6966('0x20')](_0x1bfdcd);}return _0x10b9f6[_0x6966('0x21')]();};}function saveUpdates(_0x8c7833,_0x33fc7f){return function(_0x451f50){if(_0x451f50){return _0x451f50[_0x6966('0x22')](_0x8c7833)[_0x6966('0x23')](function(_0x3772d7){return _0x3772d7;});}return null;};}function removeEntity(_0x509631,_0x24af6a){return function(_0x6f8663){if(_0x6f8663){return _0x6f8663[_0x6966('0x24')]()[_0x6966('0x23')](function(){var _0x5da7dd=_0x6f8663[_0x6966('0x25')]({'plain':!![]});var _0x44a5df='Teams';return db[_0x6966('0x26')]['destroy']({'where':{'type':_0x44a5df,'resourceId':_0x5da7dd['id']}})[_0x6966('0x23')](function(){return _0x6f8663;});})['then'](function(){_0x509631[_0x6966('0x1d')](0xcc)[_0x6966('0x27')]();});}};}function handleEntityNotFound(_0xeae4fb,_0x85106d){return function(_0x3c2b41){if(!_0x3c2b41){_0xeae4fb[_0x6966('0x1c')](0x194);}return _0x3c2b41;};}function handleError(_0x8dec9,_0x1b86a7){_0x1b86a7=_0x1b86a7||0x1f4;return function(_0x2c9fbb){logger['error'](_0x2c9fbb[_0x6966('0x28')]);if(_0x2c9fbb[_0x6966('0x29')]){delete _0x2c9fbb['name'];}_0x8dec9[_0x6966('0x1d')](_0x1b86a7)['send'](_0x2c9fbb);};}exports[_0x6966('0x2a')]=function(_0x297c21,_0x171f19){var _0x452721={},_0x40a50d={},_0x472d75={'count':0x0,'rows':[]};var _0x18a6df=_[_0x6966('0x2b')](db[_0x6966('0x2c')][_0x6966('0x2d')],function(_0x34b2ff){return{'name':_0x34b2ff[_0x6966('0x2e')],'type':_0x34b2ff[_0x6966('0x2f')][_0x6966('0x30')]};});_0x40a50d[_0x6966('0x31')]=_[_0x6966('0x2b')](_0x18a6df,'name');_0x40a50d[_0x6966('0x32')]=_['keys'](_0x297c21[_0x6966('0x32')]);_0x40a50d[_0x6966('0x33')]=_[_0x6966('0x34')](_0x40a50d[_0x6966('0x31')],_0x40a50d[_0x6966('0x32')]);_0x452721[_0x6966('0x35')]=_[_0x6966('0x34')](_0x40a50d[_0x6966('0x31')],qs[_0x6966('0x36')](_0x297c21[_0x6966('0x32')]['fields']));_0x452721[_0x6966('0x35')]=_0x452721[_0x6966('0x35')][_0x6966('0x37')]?_0x452721['attributes']:_0x40a50d['model'];if(!_0x297c21[_0x6966('0x32')][_0x6966('0x38')]('nolimit')){_0x452721[_0x6966('0x39')]=qs['limit'](_0x297c21['query'][_0x6966('0x39')]);_0x452721[_0x6966('0x1f')]=qs[_0x6966('0x1f')](_0x297c21[_0x6966('0x32')]['offset']);}_0x452721[_0x6966('0x3a')]=qs[_0x6966('0x3b')](_0x297c21[_0x6966('0x32')][_0x6966('0x3b')]);_0x452721[_0x6966('0x3c')]=qs[_0x6966('0x33')](_[_0x6966('0x3d')](_0x297c21[_0x6966('0x32')],_0x40a50d[_0x6966('0x33')]));if(_0x297c21[_0x6966('0x32')][_0x6966('0x3e')]){_0x452721[_0x6966('0x3c')]=_[_0x6966('0x3f')](_0x452721['where'],{'$or':_[_0x6966('0x2b')](_0x18a6df,function(_0x5c9590){if(_0x5c9590['type']!==_0x6966('0x40')){var _0x351e9e={};_0x351e9e[_0x5c9590['name']]={'$like':'%'+_0x297c21['query'][_0x6966('0x3e')]+'%'};return _0x351e9e;}})});}_0x452721=_[_0x6966('0x3f')]({},_0x452721,_0x297c21[_0x6966('0x41')]);var _0x4ebacf={'where':_0x452721[_0x6966('0x3c')]};return db[_0x6966('0x2c')][_0x6966('0x42')](_0x4ebacf)[_0x6966('0x23')](function(_0xc6e598){_0x472d75[_0x6966('0x42')]=_0xc6e598;if(_0x297c21[_0x6966('0x32')][_0x6966('0x43')]){_0x452721[_0x6966('0x44')]=[{'all':!![]}];}return db['Team']['findAll'](_0x452721);})['then'](function(_0x27fac0){_0x472d75['rows']=_0x27fac0;return _0x472d75;})[_0x6966('0x23')](respondWithFilteredResult(_0x171f19,_0x452721))[_0x6966('0x45')](handleError(_0x171f19,null));};exports['show']=function(_0x3b701c,_0x50a7b9){var _0x2f8627={'raw':![],'where':{'id':_0x3b701c[_0x6966('0x46')]['id']}},_0xe60b0f={};_0xe60b0f[_0x6966('0x31')]=_[_0x6966('0x47')](db[_0x6966('0x2c')][_0x6966('0x2d')]);_0xe60b0f[_0x6966('0x32')]=_[_0x6966('0x47')](_0x3b701c[_0x6966('0x32')]);_0xe60b0f[_0x6966('0x33')]=_['intersection'](_0xe60b0f[_0x6966('0x31')],_0xe60b0f[_0x6966('0x32')]);_0x2f8627[_0x6966('0x35')]=_['intersection'](_0xe60b0f[_0x6966('0x31')],qs[_0x6966('0x36')](_0x3b701c['query'][_0x6966('0x36')]));_0x2f8627[_0x6966('0x35')]=_0x2f8627[_0x6966('0x35')][_0x6966('0x37')]?_0x2f8627[_0x6966('0x35')]:_0xe60b0f[_0x6966('0x31')];if(_0x3b701c[_0x6966('0x32')][_0x6966('0x43')]){_0x2f8627[_0x6966('0x44')]=[{'all':!![]}];}_0x2f8627=_[_0x6966('0x3f')]({},_0x2f8627,_0x3b701c['options']);return db[_0x6966('0x2c')]['find'](_0x2f8627)[_0x6966('0x23')](handleEntityNotFound(_0x50a7b9,null))[_0x6966('0x23')](respondWithResult(_0x50a7b9,null))['catch'](handleError(_0x50a7b9,null));};exports[_0x6966('0x48')]=function(_0x4955b8,_0x44e3f9){return db[_0x6966('0x2c')][_0x6966('0x48')](_0x4955b8['body'],{})[_0x6966('0x23')](function(_0x597cce){var _0x26f69f=_0x4955b8[_0x6966('0x49')][_0x6966('0x25')]({'plain':!![]});if(!_0x26f69f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x26f69f['role']===_0x6966('0x49')){var _0x40175c=_0x597cce[_0x6966('0x25')]({'plain':!![]});var _0x1e12ea=_0x6966('0x4a');return db['UserProfileSection'][_0x6966('0x4b')]({'where':{'name':_0x1e12ea,'userProfileId':_0x26f69f[_0x6966('0x4c')]},'raw':!![]})[_0x6966('0x23')](function(_0x227152){if(_0x227152&&_0x227152[_0x6966('0x4d')]===0x0){return db[_0x6966('0x26')][_0x6966('0x48')]({'name':_0x40175c[_0x6966('0x29')],'resourceId':_0x40175c['id'],'type':_0x227152[_0x6966('0x29')],'sectionId':_0x227152['id']},{})['then'](function(){return _0x597cce;});}else{return _0x597cce;}})['catch'](function(_0x3afd95){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3afd95);throw _0x3afd95;});}return _0x597cce;})[_0x6966('0x23')](respondWithResult(_0x44e3f9,0xc9))[_0x6966('0x45')](handleError(_0x44e3f9,null));};exports[_0x6966('0x22')]=function(_0x36e1c7,_0xf9ddc0){if(_0x36e1c7[_0x6966('0x4e')]['id']){delete _0x36e1c7[_0x6966('0x4e')]['id'];}return db[_0x6966('0x2c')][_0x6966('0x4b')]({'where':{'id':_0x36e1c7[_0x6966('0x46')]['id']}})[_0x6966('0x23')](handleEntityNotFound(_0xf9ddc0,null))[_0x6966('0x23')](saveUpdates(_0x36e1c7['body'],null))['then'](respondWithResult(_0xf9ddc0,null))[_0x6966('0x45')](handleError(_0xf9ddc0,null));};exports[_0x6966('0x24')]=function(_0xcd73dc,_0x6f5229){return db[_0x6966('0x2c')]['find']({'where':{'id':_0xcd73dc[_0x6966('0x46')]['id']}})[_0x6966('0x23')](handleEntityNotFound(_0x6f5229,null))[_0x6966('0x23')](removeEntity(_0x6f5229,null))['catch'](handleError(_0x6f5229,null));};exports[_0x6966('0x4f')]=function(_0xaa7f9e,_0x1a7762,_0x45e66a){return db[_0x6966('0x2c')][_0x6966('0x50')]({'where':{'id':_0xaa7f9e[_0x6966('0x46')]['id']}})[_0x6966('0x23')](handleEntityNotFound(_0x1a7762,null))[_0x6966('0x23')](function(_0x2bba7b){if(!_0xaa7f9e['query']['channel']||!utils[_0x6966('0x51')](_0xaa7f9e[_0x6966('0x32')][_0x6966('0x52')])){throw new db[(_0x6966('0x53'))][(_0x6966('0x54'))](_0x6966('0x55'));}var _0x535d76={};var _0x3b4a15={};_0x3b4a15[_0x6966('0x31')]=_[_0x6966('0x47')](db[_[_0x6966('0x56')](_0xaa7f9e[_0x6966('0x32')][_0x6966('0x52')]['toLowerCase']())+_0x6966('0x57')][_0x6966('0x2d')]);_0x3b4a15[_0x6966('0x32')]=_[_0x6966('0x47')](_0xaa7f9e['query']);_0x3b4a15[_0x6966('0x33')]=_['intersection'](_0x3b4a15[_0x6966('0x31')],_0x3b4a15[_0x6966('0x32')]);_0x535d76[_0x6966('0x35')]=_['intersection'](_0x3b4a15['model'],qs['fields'](_0xaa7f9e[_0x6966('0x32')][_0x6966('0x36')]));_0x535d76['attributes']=_0x535d76['attributes']['length']?_0x535d76[_0x6966('0x35')]:_0x3b4a15[_0x6966('0x31')];_0x535d76[_0x6966('0x39')]=qs[_0x6966('0x39')](_0xaa7f9e[_0x6966('0x32')][_0x6966('0x39')]);_0x535d76['offset']=qs['offset'](_0xaa7f9e[_0x6966('0x32')]['offset']);_0x535d76[_0x6966('0x3a')]=qs[_0x6966('0x3b')](_0xaa7f9e[_0x6966('0x32')][_0x6966('0x3b')]);_0x535d76[_0x6966('0x3c')]=qs[_0x6966('0x33')](_[_0x6966('0x3d')](_0xaa7f9e[_0x6966('0x32')],_0x3b4a15[_0x6966('0x33')]));_0x535d76=_[_0x6966('0x3f')]({},_0x535d76,_0xaa7f9e[_0x6966('0x41')]);return _0x2bba7b['get'+_[_0x6966('0x56')](_0xaa7f9e[_0x6966('0x32')][_0x6966('0x52')]['toLowerCase']())+'Queues'](_0x535d76);})['then'](respondWithResult(_0x1a7762,null))[_0x6966('0x45')](handleError(_0x1a7762,null));};exports[_0x6966('0x58')]=function(_0x3d6cfd,_0x4e904c,_0x316754){return db[_0x6966('0x2c')][_0x6966('0x50')]({'where':{'id':_0x3d6cfd['params']['id']}})[_0x6966('0x23')](function(_0x126ea9){if(_0x126ea9){if(!_0x3d6cfd['body'][_0x6966('0x52')]||!utils[_0x6966('0x51')](_0x3d6cfd[_0x6966('0x4e')]['channel'])){throw new db[(_0x6966('0x53'))][(_0x6966('0x54'))](_0x6966('0x55'));}return _0x126ea9['add'+_[_0x6966('0x56')](_0x3d6cfd['body']['channel'][_0x6966('0x59')]())+_0x6966('0x5a')](_0x3d6cfd[_0x6966('0x4e')]['ids']);}return null;})[_0x6966('0x23')](handleEntityNotFound(_0x4e904c,null))[_0x6966('0x23')](respondWithStatusCode(_0x4e904c,null))[_0x6966('0x45')](handleError(_0x4e904c,null));};exports[_0x6966('0x5b')]=function(_0x3e8164,_0x2b43d1,_0x5370dc){return db['Team'][_0x6966('0x50')]({'where':{'id':_0x3e8164[_0x6966('0x46')]['id']}})[_0x6966('0x23')](function(_0x3a1e8e){if(_0x3a1e8e){if(!_0x3e8164[_0x6966('0x32')][_0x6966('0x52')]||!utils[_0x6966('0x51')](_0x3e8164[_0x6966('0x32')][_0x6966('0x52')])){throw new db[(_0x6966('0x53'))][(_0x6966('0x54'))]('Unknown\x20channel');}return _0x3a1e8e[_0x6966('0x5c')+_['capitalize'](_0x3e8164['query'][_0x6966('0x52')][_0x6966('0x59')]())+_0x6966('0x5a')](_0x3e8164['query']['ids']);}return null;})[_0x6966('0x23')](handleEntityNotFound(_0x2b43d1,null))[_0x6966('0x23')](respondWithStatusCode(_0x2b43d1,null))[_0x6966('0x45')](handleError(_0x2b43d1,null));};exports[_0x6966('0x5d')]=function(_0x1f0433,_0x54ac07,_0x1664e3){return db[_0x6966('0x2c')][_0x6966('0x4b')]({'where':{'id':_0x1f0433['params']['id']}})[_0x6966('0x23')](handleEntityNotFound(_0x54ac07,null))[_0x6966('0x23')](function(_0x1c238c){if(_0x1c238c){var _0x4d728d=[_0x6966('0x5e'),_0x6966('0x5f'),_0x6966('0x60'),_0x6966('0x61'),'Fax',_0x6966('0x62')];return BPromise[_0x6966('0x63')](_0x4d728d,function(_0x2cd591){return _0x1c238c[_0x6966('0x25')+_0x2cd591+_0x6966('0x5a')]({'attributes':['id','name']})['then'](function(_0xc9fc00){return BPromise[_0x6966('0x63')](_0xc9fc00,function(_0x29d229){return _0x29d229['addAgents'](_0x1f0433['body'][_0x6966('0x64')])[_0x6966('0x23')](function(){if(_0x2cd591==='Voice'){return db[_0x6966('0x65')][_0x6966('0x66')]({'where':{'id':_0x1f0433['body'][_0x6966('0x64')]},'attributes':['id',_0x6966('0x29'),_0x6966('0x67'),_0x6966('0x68'),_0x6966('0x69')],'raw':!![]})['then'](function(_0x117d88){return BPromise['each'](_[_0x6966('0x3e')](_0x117d88,{'online':0x1}),function(_0xae229c){return db[_0x6966('0x6a')]['upsert']({'membername':_0xae229c[_0x6966('0x29')],'UserId':_0xae229c['id'],'queue_name':_0x29d229[_0x6966('0x29')],'VoiceQueueId':_0x29d229['id'],'interface':_['isNil'](_0xae229c['interface'])?util['format'](_0x6966('0x6b'),_0xae229c[_0x6966('0x29')]):_0xae229c[_0x6966('0x69')],'paused':_0xae229c['voicePause']||![],'penalty':0x0});});});}});});})[_0x6966('0x23')](function(){return _0x1c238c;});})[_0x6966('0x23')](function(){return _0x1c238c;});}})[_0x6966('0x23')](function(_0x58716b){if(_0x58716b){return _0x58716b['addAgents'](_0x1f0433[_0x6966('0x4e')][_0x6966('0x64')],_[_0x6966('0x6c')](_0x1f0433[_0x6966('0x4e')],[_0x6966('0x64'),'id'])||{})[_0x6966('0x6d')](function(_0x23d20b){for(var _0x4a4db6=0x0;_0x4a4db6<_0x1f0433['body']['ids'][_0x6966('0x37')];_0x4a4db6+=0x1){socket[_0x6966('0x6e')](_0x6966('0x6f'),{'UserId':_0x1f0433[_0x6966('0x4e')][_0x6966('0x64')][_0x4a4db6],'TeamId':_0x1f0433[_0x6966('0x46')]['id']});}return _0x23d20b;});}})['then'](respondWithResult(_0x54ac07,null))['catch'](handleError(_0x54ac07,null));};exports['removeAgents']=function(_0x13dd27,_0x44c517,_0x4dc2c1){return db[_0x6966('0x2c')][_0x6966('0x4b')]({'where':{'id':_0x13dd27[_0x6966('0x46')]['id']}})['then'](handleEntityNotFound(_0x44c517,null))['then'](function(_0x41d4d0){if(_0x41d4d0){return BPromise[_0x6966('0x63')]([_0x6966('0x70'),_0x6966('0x71'),_0x6966('0x72'),_0x6966('0x73'),_0x6966('0x74'),_0x6966('0x75')],function(_0x29b8a5){return _0x41d4d0[_0x6966('0x25')+_[_0x6966('0x56')](_0x29b8a5)+_0x6966('0x5a')]({'attributes':['id',_0x6966('0x29')]})['then'](function(_0xbc8935){return BPromise[_0x6966('0x63')](_0xbc8935,function(_0x17ff88){return _0x17ff88[_0x6966('0x76')](_0x13dd27[_0x6966('0x32')]['ids'])[_0x6966('0x23')](function(){if(_0x29b8a5===_0x6966('0x70')){return db[_0x6966('0x6a')][_0x6966('0x24')]({'where':{'VoiceQueueId':_0x17ff88['id'],'UserId':_0x13dd27[_0x6966('0x32')][_0x6966('0x64')]}});}});});})[_0x6966('0x23')](function(){return _0x41d4d0;});})[_0x6966('0x23')](function(){return _0x41d4d0;});}})[_0x6966('0x23')](function(_0x2e9b00){if(_0x2e9b00){return _0x2e9b00['removeAgents'](_0x13dd27[_0x6966('0x32')][_0x6966('0x64')])[_0x6966('0x23')](function(){if(_[_0x6966('0x77')](_0x13dd27[_0x6966('0x32')][_0x6966('0x64')])){for(var _0x475904=0x0;_0x475904<_0x13dd27[_0x6966('0x32')][_0x6966('0x64')][_0x6966('0x37')];_0x475904+=0x1){socket[_0x6966('0x6e')](_0x6966('0x78'),{'UserId':Number(_0x13dd27[_0x6966('0x32')]['ids'][_0x475904]),'TeamId':Number(_0x13dd27[_0x6966('0x46')]['id'])});}}else{socket[_0x6966('0x6e')]('userTeam:remove',{'UserId':Number(_0x13dd27[_0x6966('0x32')][_0x6966('0x64')]),'TeamId':Number(_0x13dd27[_0x6966('0x46')]['id'])});}});}})[_0x6966('0x23')](respondWithStatusCode(_0x44c517,null))[_0x6966('0x45')](handleError(_0x44c517,null));};exports['getAgents']=function(_0x5b0290,_0x5b467d,_0x423e){var _0x2a5171={};var _0x493b1d={};var _0x360904;var _0x1ba2ee;return db[_0x6966('0x2c')]['findOne']({'where':{'id':_0x5b0290[_0x6966('0x46')]['id']}})[_0x6966('0x23')](handleEntityNotFound(_0x5b467d,null))[_0x6966('0x23')](function(_0x15093b){if(_0x15093b){_0x360904=_0x15093b;_0x493b1d[_0x6966('0x31')]=_[_0x6966('0x47')](db['User'][_0x6966('0x2d')]);_0x493b1d[_0x6966('0x32')]=_[_0x6966('0x47')](_0x5b0290[_0x6966('0x32')]);_0x493b1d[_0x6966('0x33')]=_['intersection'](_0x493b1d[_0x6966('0x31')],_0x493b1d[_0x6966('0x32')]);_0x2a5171[_0x6966('0x35')]=_[_0x6966('0x34')](_0x493b1d[_0x6966('0x31')],qs['fields'](_0x5b0290[_0x6966('0x32')]['fields']));_0x2a5171[_0x6966('0x35')]=_0x2a5171[_0x6966('0x35')][_0x6966('0x37')]?_0x2a5171['attributes']:_0x493b1d[_0x6966('0x31')];_0x2a5171[_0x6966('0x3a')]=qs[_0x6966('0x3b')](_0x5b0290[_0x6966('0x32')]['sort']);_0x2a5171['where']=qs[_0x6966('0x33')](_[_0x6966('0x3d')](_0x5b0290[_0x6966('0x32')],_0x493b1d[_0x6966('0x33')]));if(_0x5b0290[_0x6966('0x32')][_0x6966('0x3e')]){_0x2a5171['where']=_['merge'](_0x2a5171[_0x6966('0x3c')],{'$or':_[_0x6966('0x2b')](_0x2a5171['attributes'],function(_0x386257){var _0x57da90={};_0x57da90[_0x386257]={'$like':'%'+_0x5b0290[_0x6966('0x32')]['filter']+'%'};return _0x57da90;})});}_0x2a5171=_[_0x6966('0x3f')]({},_0x2a5171,_0x5b0290[_0x6966('0x41')]);return _0x360904[_0x6966('0x79')](_0x2a5171);}})[_0x6966('0x23')](function(_0x4b8c1a){if(_0x4b8c1a){_0x1ba2ee=_0x4b8c1a['length'];if(!_0x5b0290[_0x6966('0x32')]['hasOwnProperty']('nolimit')){_0x2a5171[_0x6966('0x39')]=qs['limit'](_0x5b0290['query'][_0x6966('0x39')]);_0x2a5171[_0x6966('0x1f')]=qs[_0x6966('0x1f')](_0x5b0290['query'][_0x6966('0x1f')]);}return _0x360904[_0x6966('0x79')](_0x2a5171);}})[_0x6966('0x23')](function(_0x53f501){if(_0x53f501){return _0x53f501?{'count':_0x1ba2ee,'rows':_0x53f501}:null;}})[_0x6966('0x23')](respondWithResult(_0x5b467d,null))[_0x6966('0x45')](handleError(_0x5b467d,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index 75d7178..1cabffd 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 _0x7a54=['save','update','remove','hasOwnProperty','hook','exports','events','setMaxListeners'];(function(_0x1d87fc,_0x1e5321){var _0x492b56=function(_0x4c6b16){while(--_0x4c6b16){_0x1d87fc['push'](_0x1d87fc['shift']());}};_0x492b56(++_0x1e5321);}(_0x7a54,0x1ce));var _0x47a5=function(_0x95bdc0,_0x1ad848){_0x95bdc0=_0x95bdc0-0x0;var _0x24a938=_0x7a54[_0x95bdc0];return _0x24a938;};'use strict';var EventEmitter=require(_0x47a5('0x0'));var Team=require('../../mysqldb')['db']['Team'];var TeamEvents=new EventEmitter();TeamEvents[_0x47a5('0x1')](0x0);var events={'afterCreate':_0x47a5('0x2'),'afterUpdate':_0x47a5('0x3'),'afterDestroy':_0x47a5('0x4')};function emitEvent(_0x45ea43){return function(_0x105564,_0x4a75ea,_0x46b6f0){TeamEvents['emit'](_0x45ea43+':'+_0x105564['id'],_0x105564);TeamEvents['emit'](_0x45ea43,_0x105564);_0x46b6f0(null);};}for(var e in events){if(events[_0x47a5('0x5')](e)){var event=events[e];Team[_0x47a5('0x6')](e,emitEvent(event));}}module[_0x47a5('0x7')]=TeamEvents; \ No newline at end of file +var _0xf1ca=['Team','setMaxListeners','save','update','remove','emit','hook','exports','events','../../mysqldb'];(function(_0x53b594,_0x559767){var _0x1e616f=function(_0x333eda){while(--_0x333eda){_0x53b594['push'](_0x53b594['shift']());}};_0x1e616f(++_0x559767);}(_0xf1ca,0x1de));var _0xaf1c=function(_0x24aeb8,_0xe522e1){_0x24aeb8=_0x24aeb8-0x0;var _0xa78ec9=_0xf1ca[_0x24aeb8];return _0xa78ec9;};'use strict';var EventEmitter=require(_0xaf1c('0x0'));var Team=require(_0xaf1c('0x1'))['db'][_0xaf1c('0x2')];var TeamEvents=new EventEmitter();TeamEvents[_0xaf1c('0x3')](0x0);var events={'afterCreate':_0xaf1c('0x4'),'afterUpdate':_0xaf1c('0x5'),'afterDestroy':_0xaf1c('0x6')};function emitEvent(_0x4d0f1b){return function(_0x247907,_0x36afc0,_0x446c3f){TeamEvents[_0xaf1c('0x7')](_0x4d0f1b+':'+_0x247907['id'],_0x247907);TeamEvents['emit'](_0x4d0f1b,_0x247907);_0x446c3f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Team[_0xaf1c('0x8')](e,emitEvent(event));}}module[_0xaf1c('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 c3979da..43ed0df 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 _0xfe6a=['util','../../config/logger','api','bluebird','request-promise','../../config/environment','./team.attributes','exports','define','Team','teams','lodash'];(function(_0x500419,_0x549162){var _0x241c1a=function(_0x3bea1a){while(--_0x3bea1a){_0x500419['push'](_0x500419['shift']());}};_0x241c1a(++_0x549162);}(_0xfe6a,0xfb));var _0xafe6=function(_0x3410de,_0x39d416){_0x3410de=_0x3410de-0x0;var _0x40e220=_0xfe6a[_0x3410de];return _0x40e220;};'use strict';var _=require(_0xafe6('0x0'));var util=require(_0xafe6('0x1'));var logger=require(_0xafe6('0x2'))(_0xafe6('0x3'));var moment=require('moment');var BPromise=require(_0xafe6('0x4'));var rp=require(_0xafe6('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xafe6('0x6'));var attributes=require(_0xafe6('0x7'));module[_0xafe6('0x8')]=function(_0x3ed274,_0x5771cb){return _0x3ed274[_0xafe6('0x9')](_0xafe6('0xa'),attributes,{'tableName':_0xafe6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd87f=['../../config/logger','api','moment','bluebird','path','rimraf','exports','teams','lodash'];(function(_0x88cd7b,_0x4c884c){var _0x56fcc8=function(_0x513b3d){while(--_0x513b3d){_0x88cd7b['push'](_0x88cd7b['shift']());}};_0x56fcc8(++_0x4c884c);}(_0xd87f,0xe9));var _0xfd87=function(_0x2e0ffe,_0x5d9de8){_0x2e0ffe=_0x2e0ffe-0x0;var _0x58ca13=_0xd87f[_0x2e0ffe];return _0x58ca13;};'use strict';var _=require(_0xfd87('0x0'));var util=require('util');var logger=require(_0xfd87('0x1'))(_0xfd87('0x2'));var moment=require(_0xfd87('0x3'));var BPromise=require(_0xfd87('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfd87('0x5'));var rimraf=require(_0xfd87('0x6'));var config=require('../../config/environment');var attributes=require('./team.attributes');module[_0xfd87('0x7')]=function(_0x205eef,_0x2993d3){return _0x205eef['define']('Team',attributes,{'tableName':_0xfd87('0x8'),'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 e2b04f2..03dfaac 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 _0xd53c=['debug','Team,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','redis','localhost','socket.io-emitter','./team.socket','request','info','Team,\x20%s,\x20%s','request\x20sent'];(function(_0x43bc64,_0x489fe3){var _0x3ef249=function(_0x136a2c){while(--_0x136a2c){_0x43bc64['push'](_0x43bc64['shift']());}};_0x3ef249(++_0x489fe3);}(_0xd53c,0xbe));var _0xcd53=function(_0x3ef7d8,_0x5d3d85){_0x3ef7d8=_0x3ef7d8-0x0;var _0x48cf35=_0xd53c[_0x3ef7d8];return _0x48cf35;};'use strict';var _=require(_0xcd53('0x0'));var util=require('util');var moment=require(_0xcd53('0x1'));var BPromise=require('bluebird');var rs=require(_0xcd53('0x2'));var fs=require('fs');var Redis=require(_0xcd53('0x3'));var db=require(_0xcd53('0x4'))['db'];var utils=require(_0xcd53('0x5'));var logger=require('../../config/logger')(_0xcd53('0x6'));var config=require('../../config/environment');var jayson=require(_0xcd53('0x7'));var client=jayson[_0xcd53('0x8')][_0xcd53('0x9')]({'port':0x232a});config[_0xcd53('0xa')]=_['defaults'](config[_0xcd53('0xa')],{'host':_0xcd53('0xb'),'port':0x18eb});var socket=require(_0xcd53('0xc'))(new Redis(config[_0xcd53('0xa')]));require(_0xcd53('0xd'))['register'](socket);function respondWithRpcPromise(_0xa4d60a,_0x3d6360,_0x51a73e){return new BPromise(function(_0x51bfdb,_0x12fd3a){return client[_0xcd53('0xe')](_0xa4d60a,_0x51a73e)['then'](function(_0x7c5ea){logger[_0xcd53('0xf')](_0xcd53('0x10'),_0x3d6360,_0xcd53('0x11'));logger[_0xcd53('0x12')](_0xcd53('0x13'),_0x3d6360,_0xcd53('0x11'),JSON[_0xcd53('0x14')](_0x7c5ea));if(_0x7c5ea[_0xcd53('0x15')]){if(_0x7c5ea[_0xcd53('0x15')][_0xcd53('0x16')]===0x1f4){logger['error'](_0xcd53('0x10'),_0x3d6360,_0x7c5ea[_0xcd53('0x15')]['message']);return _0x12fd3a(_0x7c5ea['error'][_0xcd53('0x17')]);}logger[_0xcd53('0x15')](_0xcd53('0x10'),_0x3d6360,_0x7c5ea[_0xcd53('0x15')][_0xcd53('0x17')]);return _0x51bfdb(_0x7c5ea['error'][_0xcd53('0x17')]);}else{logger['info'](_0xcd53('0x10'),_0x3d6360,_0xcd53('0x11'));_0x51bfdb(_0x7c5ea[_0xcd53('0x18')][_0xcd53('0x17')]);}})[_0xcd53('0x19')](function(_0x1af7c2){logger['error'](_0xcd53('0x10'),_0x3d6360,_0x1af7c2);_0x12fd3a(_0x1af7c2);});});} \ No newline at end of file +var _0x2621=['client','http','redis','defaults','localhost','register','then','info','Team,\x20%s,\x20%s','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','moment','randomstring','../../config/utils','../../config/environment','jayson/promise'];(function(_0x4e7fdc,_0x381b92){var _0x16622b=function(_0x425baa){while(--_0x425baa){_0x4e7fdc['push'](_0x4e7fdc['shift']());}};_0x16622b(++_0x381b92);}(_0x2621,0x153));var _0x1262=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x2621[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x1262('0x0'));var util=require('util');var moment=require(_0x1262('0x1'));var BPromise=require('bluebird');var rs=require(_0x1262('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x1262('0x3'));var logger=require('../../config/logger')('rpc');var config=require(_0x1262('0x4'));var jayson=require(_0x1262('0x5'));var client=jayson[_0x1262('0x6')][_0x1262('0x7')]({'port':0x232a});config[_0x1262('0x8')]=_[_0x1262('0x9')](config[_0x1262('0x8')],{'host':_0x1262('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1262('0x8')]));require('./team.socket')[_0x1262('0xb')](socket);function respondWithRpcPromise(_0x3562fc,_0x408719,_0x213730){return new BPromise(function(_0x18b4ea,_0x4419bc){return client['request'](_0x3562fc,_0x213730)[_0x1262('0xc')](function(_0x3317fd){logger[_0x1262('0xd')](_0x1262('0xe'),_0x408719,_0x1262('0xf'));logger[_0x1262('0x10')](_0x1262('0x11'),_0x408719,_0x1262('0xf'),JSON['stringify'](_0x3317fd));if(_0x3317fd[_0x1262('0x12')]){if(_0x3317fd[_0x1262('0x12')][_0x1262('0x13')]===0x1f4){logger['error'](_0x1262('0xe'),_0x408719,_0x3317fd['error']['message']);return _0x4419bc(_0x3317fd[_0x1262('0x12')][_0x1262('0x14')]);}logger[_0x1262('0x12')](_0x1262('0xe'),_0x408719,_0x3317fd[_0x1262('0x12')]['message']);return _0x18b4ea(_0x3317fd['error'][_0x1262('0x14')]);}else{logger['info'](_0x1262('0xe'),_0x408719,_0x1262('0xf'));_0x18b4ea(_0x3317fd[_0x1262('0x15')]['message']);}})[_0x1262('0x16')](function(_0x3947bc){logger[_0x1262('0x12')](_0x1262('0xe'),_0x408719,_0x3947bc);_0x4419bc(_0x3947bc);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index 744590e..ade4e93 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 _0xe797=['register','length','./team.events','save','remove','update','emit','removeListener'];(function(_0x4e697a,_0x56a14b){var _0x88850c=function(_0x4e368a){while(--_0x4e368a){_0x4e697a['push'](_0x4e697a['shift']());}};_0x88850c(++_0x56a14b);}(_0xe797,0x12a));var _0x7e79=function(_0x1e8a47,_0x5e83ac){_0x1e8a47=_0x1e8a47-0x0;var _0x40e586=_0xe797[_0x1e8a47];return _0x40e586;};'use strict';var TeamEvents=require(_0x7e79('0x0'));var events=[_0x7e79('0x1'),_0x7e79('0x2'),_0x7e79('0x3')];function createListener(_0x366839,_0x34a91e){return function(_0x5317b1){_0x34a91e[_0x7e79('0x4')](_0x366839,_0x5317b1);};}function removeListener(_0x22a597,_0x5ba3bf){return function(){TeamEvents[_0x7e79('0x5')](_0x22a597,_0x5ba3bf);};}exports[_0x7e79('0x6')]=function(_0x3cd4c9){for(var _0x48a8c1=0x0,_0x4fdfa1=events[_0x7e79('0x7')];_0x48a8c1<_0x4fdfa1;_0x48a8c1++){var _0x358bd6=events[_0x48a8c1];var _0x484e66=createListener('team:'+_0x358bd6,_0x3cd4c9);TeamEvents['on'](_0x358bd6,_0x484e66);}}; \ No newline at end of file +var _0xf072=['save','remove','emit','removeListener','register','length','team:','./team.events'];(function(_0x5ef9c8,_0xd9db89){var _0x565fe1=function(_0x7d7084){while(--_0x7d7084){_0x5ef9c8['push'](_0x5ef9c8['shift']());}};_0x565fe1(++_0xd9db89);}(_0xf072,0x1cf));var _0x2f07=function(_0x39389e,_0x59d064){_0x39389e=_0x39389e-0x0;var _0x368d0a=_0xf072[_0x39389e];return _0x368d0a;};'use strict';var TeamEvents=require(_0x2f07('0x0'));var events=[_0x2f07('0x1'),_0x2f07('0x2'),'update'];function createListener(_0x3c1c25,_0x5f20e3){return function(_0x19cbb9){_0x5f20e3[_0x2f07('0x3')](_0x3c1c25,_0x19cbb9);};}function removeListener(_0x1536c3,_0x48d7b6){return function(){TeamEvents[_0x2f07('0x4')](_0x1536c3,_0x48d7b6);};}exports[_0x2f07('0x5')]=function(_0x3643bb){for(var _0x2e6422=0x0,_0x235418=events[_0x2f07('0x6')];_0x2e6422<_0x235418;_0x2e6422++){var _0x33b99c=events[_0x2e6422];var _0x379b2e=createListener(_0x2f07('0x7')+_0x33b99c,_0x3643bb);TeamEvents['on'](_0x33b99c,_0x379b2e);}}; \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index ba450b8..10a67c1 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 _0xf9da=['put','update','delete','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./template.controller','get','isAuthenticated','index','/:id','show','post'];(function(_0x23a971,_0x70b461){var _0x36c6d3=function(_0x3ccc4e){while(--_0x3ccc4e){_0x23a971['push'](_0x23a971['shift']());}};_0x36c6d3(++_0x70b461);}(_0xf9da,0x82));var _0xaf9d=function(_0x779e96,_0x12508f){_0x779e96=_0x779e96-0x0;var _0x3ce41e=_0xf9da[_0x779e96];return _0x3ce41e;};'use strict';var multer=require('multer');var util=require(_0xaf9d('0x0'));var path=require(_0xaf9d('0x1'));var timeout=require(_0xaf9d('0x2'));var express=require(_0xaf9d('0x3'));var router=express[_0xaf9d('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xaf9d('0x5'));var config=require(_0xaf9d('0x6'));var controller=require(_0xaf9d('0x7'));router[_0xaf9d('0x8')]('/',auth[_0xaf9d('0x9')](),controller[_0xaf9d('0xa')]);router['get'](_0xaf9d('0xb'),auth['isAuthenticated'](),controller[_0xaf9d('0xc')]);router[_0xaf9d('0xd')]('/',auth[_0xaf9d('0x9')](),controller['create']);router[_0xaf9d('0xe')](_0xaf9d('0xb'),auth[_0xaf9d('0x9')](),controller[_0xaf9d('0xf')]);router[_0xaf9d('0x10')](_0xaf9d('0xb'),auth[_0xaf9d('0x9')](),controller['destroy']);module[_0xaf9d('0x11')]=router; \ No newline at end of file +var _0x8f42=['../../components/interaction/service','./template.controller','get','isAuthenticated','index','/:id','show','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x2fff7b,_0x4990fc){var _0x337502=function(_0x2097d9){while(--_0x2097d9){_0x2fff7b['push'](_0x2fff7b['shift']());}};_0x337502(++_0x4990fc);}(_0x8f42,0xdd));var _0x28f4=function(_0x25f503,_0x59dd25){_0x25f503=_0x25f503-0x0;var _0xef4862=_0x8f42[_0x25f503];return _0xef4862;};'use strict';var multer=require(_0x28f4('0x0'));var util=require(_0x28f4('0x1'));var path=require(_0x28f4('0x2'));var timeout=require(_0x28f4('0x3'));var express=require(_0x28f4('0x4'));var router=express[_0x28f4('0x5')]();var auth=require(_0x28f4('0x6'));var interaction=require(_0x28f4('0x7'));var config=require('../../config/environment');var controller=require(_0x28f4('0x8'));router[_0x28f4('0x9')]('/',auth[_0x28f4('0xa')](),controller[_0x28f4('0xb')]);router[_0x28f4('0x9')](_0x28f4('0xc'),auth[_0x28f4('0xa')](),controller[_0x28f4('0xd')]);router['post']('/',auth[_0x28f4('0xa')](),controller[_0x28f4('0xe')]);router[_0x28f4('0xf')](_0x28f4('0xc'),auth[_0x28f4('0xa')](),controller[_0x28f4('0x10')]);router[_0x28f4('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x28f4('0x12')]);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 07495ef..23acc0e 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 _0xe754=['STRING','TEXT','exports'];(function(_0x4bc6b1,_0x3ea45d){var _0x26c505=function(_0x5d4925){while(--_0x5d4925){_0x4bc6b1['push'](_0x4bc6b1['shift']());}};_0x26c505(++_0x3ea45d);}(_0xe754,0xaa));var _0x4e75=function(_0x3ee02a,_0x239e72){_0x3ee02a=_0x3ee02a-0x0;var _0x4fe031=_0xe754[_0x3ee02a];return _0x4fe031;};'use strict';var Sequelize=require('sequelize');module[_0x4e75('0x0')]={'name':{'type':Sequelize[_0x4e75('0x1')]},'description':{'type':Sequelize[_0x4e75('0x1')]},'html':{'type':Sequelize[_0x4e75('0x2')]}}; \ No newline at end of file +var _0xcfe8=['sequelize','STRING'];(function(_0xdea41a,_0x552987){var _0x15d0d8=function(_0x1e0d0b){while(--_0x1e0d0b){_0xdea41a['push'](_0xdea41a['shift']());}};_0x15d0d8(++_0x552987);}(_0xcfe8,0x1b8));var _0x8cfe=function(_0x2d5f0c,_0x5e9241){_0x2d5f0c=_0x2d5f0c-0x0;var _0x3dbca6=_0xcfe8[_0x2d5f0c];return _0x3dbca6;};'use strict';var Sequelize=require(_0x8cfe('0x0'));module['exports']={'name':{'type':Sequelize[_0x8cfe('0x1')]},'description':{'type':Sequelize[_0x8cfe('0x1')]},'html':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index 9359072..6976e40 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 _0x5c70=['autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','count','offset','limit','set','Content-Range','json','reject','then','destroy','get','Templates','UserProfileResource','end','stack','name','index','map','Template','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','hasOwnProperty','order','sort','filters','pick','filter','where','VIRTUAL','merge','options','findAll','rows','catch','show','params','includeAll','include','find','create','user','role','UserProfileSection','userProfileId'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x5c70,0x1eb));var _0x05c7=function(_0x45632e,_0x1774dc){_0x45632e=_0x45632e-0x0;var _0x589218=_0x5c70[_0x45632e];return _0x589218;};'use strict';var pdf=require(_0x05c7('0x0'));var emlformat=require(_0x05c7('0x1'));var rimraf=require(_0x05c7('0x2'));var zipdir=require(_0x05c7('0x3'));var jsonpatch=require(_0x05c7('0x4'));var rp=require('request-promise');var moment=require(_0x05c7('0x5'));var BPromise=require(_0x05c7('0x6'));var Mustache=require(_0x05c7('0x7'));var util=require(_0x05c7('0x8'));var path=require(_0x05c7('0x9'));var sox=require(_0x05c7('0xa'));var csv=require(_0x05c7('0xb'));var ejs=require(_0x05c7('0xc'));var fs=require('fs');var _=require(_0x05c7('0xd'));var squel=require('squel');var crypto=require(_0x05c7('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x05c7('0xf'));var Papa=require(_0x05c7('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x05c7('0x11'));var as=require(_0x05c7('0x12'));var hardwareService=require(_0x05c7('0x13'));var logger=require(_0x05c7('0x14'))('api');var utils=require(_0x05c7('0x15'));var config=require(_0x05c7('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3bcf3f,_0x3f4e3b){_0x3f4e3b=_0x3f4e3b||0xcc;return function(_0x498cda){if(_0x498cda){return _0x3bcf3f[_0x05c7('0x17')](_0x3f4e3b);}return _0x3bcf3f[_0x05c7('0x18')](_0x3f4e3b)['end']();};}function respondWithResult(_0x3916c1,_0x3f836f){_0x3f836f=_0x3f836f||0xc8;return function(_0x363a99){if(_0x363a99){return _0x3916c1[_0x05c7('0x18')](_0x3f836f)['json'](_0x363a99);}};}function respondWithFilteredResult(_0x2ecabd,_0x2b7f3b){return function(_0x3cec10){if(_0x3cec10){var _0x31c48d=_0x3cec10[_0x05c7('0x19')],_0xa43e03=_0x2b7f3b[_0x05c7('0x1a')],_0x1df821=_0x2b7f3b['offset']+_0x2b7f3b[_0x05c7('0x1b')],_0xda7d86;if(_0x1df821>=_0x31c48d){_0x1df821=_0x31c48d;_0xda7d86=0xc8;}else{_0xda7d86=0xce;}_0x2ecabd['status'](_0xda7d86);return _0x2ecabd[_0x05c7('0x1c')](_0x05c7('0x1d'),_0xa43e03+'-'+_0x1df821+'/'+_0x31c48d)[_0x05c7('0x1e')](_0x3cec10);}return null;};}function patchUpdates(_0x4c1460){return function(_0x239bf6){try{jsonpatch['apply'](_0x239bf6,_0x4c1460,!![]);}catch(_0x481248){return BPromise[_0x05c7('0x1f')](_0x481248);}return _0x239bf6['save']();};}function saveUpdates(_0x3f9580,_0x5dedc0){return function(_0x55d2cb){if(_0x55d2cb){return _0x55d2cb['update'](_0x3f9580)[_0x05c7('0x20')](function(_0x174ea6){return _0x174ea6;});}return null;};}function removeEntity(_0x2fe9c3,_0x5616fd){return function(_0x172a9e){if(_0x172a9e){return _0x172a9e[_0x05c7('0x21')]()[_0x05c7('0x20')](function(){var _0x1bf034=_0x172a9e[_0x05c7('0x22')]({'plain':!![]});var _0x51a14f=_0x05c7('0x23');return db[_0x05c7('0x24')][_0x05c7('0x21')]({'where':{'type':_0x51a14f,'resourceId':_0x1bf034['id']}})[_0x05c7('0x20')](function(){return _0x172a9e;});})[_0x05c7('0x20')](function(){_0x2fe9c3['status'](0xcc)[_0x05c7('0x25')]();});}};}function handleEntityNotFound(_0x27c4c6,_0x4895b5){return function(_0xe0d8a3){if(!_0xe0d8a3){_0x27c4c6[_0x05c7('0x17')](0x194);}return _0xe0d8a3;};}function handleError(_0x4df7bd,_0x4fa83a){_0x4fa83a=_0x4fa83a||0x1f4;return function(_0x43a514){logger['error'](_0x43a514[_0x05c7('0x26')]);if(_0x43a514[_0x05c7('0x27')]){delete _0x43a514['name'];}_0x4df7bd[_0x05c7('0x18')](_0x4fa83a)['send'](_0x43a514);};}exports[_0x05c7('0x28')]=function(_0x103542,_0x119c98){var _0x12ee3e={},_0x53ad94={},_0x489cde={'count':0x0,'rows':[]};var _0xa709ef=_[_0x05c7('0x29')](db[_0x05c7('0x2a')][_0x05c7('0x2b')],function(_0x4f3e83){return{'name':_0x4f3e83[_0x05c7('0x2c')],'type':_0x4f3e83[_0x05c7('0x2d')][_0x05c7('0x2e')]};});_0x53ad94['model']=_[_0x05c7('0x29')](_0xa709ef,_0x05c7('0x27'));_0x53ad94[_0x05c7('0x2f')]=_[_0x05c7('0x30')](_0x103542[_0x05c7('0x2f')]);_0x53ad94['filters']=_[_0x05c7('0x31')](_0x53ad94[_0x05c7('0x32')],_0x53ad94[_0x05c7('0x2f')]);_0x12ee3e[_0x05c7('0x33')]=_[_0x05c7('0x31')](_0x53ad94[_0x05c7('0x32')],qs[_0x05c7('0x34')](_0x103542[_0x05c7('0x2f')]['fields']));_0x12ee3e['attributes']=_0x12ee3e[_0x05c7('0x33')]['length']?_0x12ee3e[_0x05c7('0x33')]:_0x53ad94['model'];if(!_0x103542[_0x05c7('0x2f')][_0x05c7('0x35')]('nolimit')){_0x12ee3e['limit']=qs[_0x05c7('0x1b')](_0x103542[_0x05c7('0x2f')][_0x05c7('0x1b')]);_0x12ee3e[_0x05c7('0x1a')]=qs['offset'](_0x103542[_0x05c7('0x2f')]['offset']);}_0x12ee3e[_0x05c7('0x36')]=qs[_0x05c7('0x37')](_0x103542[_0x05c7('0x2f')]['sort']);_0x12ee3e['where']=qs[_0x05c7('0x38')](_[_0x05c7('0x39')](_0x103542[_0x05c7('0x2f')],_0x53ad94[_0x05c7('0x38')]));if(_0x103542[_0x05c7('0x2f')][_0x05c7('0x3a')]){_0x12ee3e[_0x05c7('0x3b')]=_['merge'](_0x12ee3e[_0x05c7('0x3b')],{'$or':_[_0x05c7('0x29')](_0xa709ef,function(_0x2d4934){if(_0x2d4934[_0x05c7('0x2d')]!==_0x05c7('0x3c')){var _0xe27ad5={};_0xe27ad5[_0x2d4934[_0x05c7('0x27')]]={'$like':'%'+_0x103542[_0x05c7('0x2f')][_0x05c7('0x3a')]+'%'};return _0xe27ad5;}})});}_0x12ee3e=_[_0x05c7('0x3d')]({},_0x12ee3e,_0x103542[_0x05c7('0x3e')]);var _0x36c2bb={'where':_0x12ee3e[_0x05c7('0x3b')]};return db[_0x05c7('0x2a')][_0x05c7('0x19')](_0x36c2bb)[_0x05c7('0x20')](function(_0x2b8747){_0x489cde[_0x05c7('0x19')]=_0x2b8747;if(_0x103542[_0x05c7('0x2f')]['includeAll']){_0x12ee3e['include']=[{'all':!![]}];}return db[_0x05c7('0x2a')][_0x05c7('0x3f')](_0x12ee3e);})[_0x05c7('0x20')](function(_0x38de8d){_0x489cde[_0x05c7('0x40')]=_0x38de8d;return _0x489cde;})[_0x05c7('0x20')](respondWithFilteredResult(_0x119c98,_0x12ee3e))[_0x05c7('0x41')](handleError(_0x119c98,null));};exports[_0x05c7('0x42')]=function(_0x3fa77c,_0x49b4f7){var _0x34e821={'raw':!![],'where':{'id':_0x3fa77c[_0x05c7('0x43')]['id']}},_0x2e5f57={};_0x2e5f57[_0x05c7('0x32')]=_['keys'](db[_0x05c7('0x2a')][_0x05c7('0x2b')]);_0x2e5f57[_0x05c7('0x2f')]=_[_0x05c7('0x30')](_0x3fa77c[_0x05c7('0x2f')]);_0x2e5f57[_0x05c7('0x38')]=_['intersection'](_0x2e5f57['model'],_0x2e5f57['query']);_0x34e821['attributes']=_[_0x05c7('0x31')](_0x2e5f57['model'],qs[_0x05c7('0x34')](_0x3fa77c[_0x05c7('0x2f')]['fields']));_0x34e821[_0x05c7('0x33')]=_0x34e821[_0x05c7('0x33')]['length']?_0x34e821[_0x05c7('0x33')]:_0x2e5f57[_0x05c7('0x32')];if(_0x3fa77c['query'][_0x05c7('0x44')]){_0x34e821[_0x05c7('0x45')]=[{'all':!![]}];}_0x34e821=_[_0x05c7('0x3d')]({},_0x34e821,_0x3fa77c[_0x05c7('0x3e')]);return db['Template'][_0x05c7('0x46')](_0x34e821)[_0x05c7('0x20')](handleEntityNotFound(_0x49b4f7,null))[_0x05c7('0x20')](respondWithResult(_0x49b4f7,null))['catch'](handleError(_0x49b4f7,null));};exports[_0x05c7('0x47')]=function(_0x518059,_0x2475b1){return db[_0x05c7('0x2a')][_0x05c7('0x47')](_0x518059['body'],{})[_0x05c7('0x20')](function(_0x7438d2){var _0x3ff7a7=_0x518059[_0x05c7('0x48')][_0x05c7('0x22')]({'plain':!![]});if(!_0x3ff7a7)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3ff7a7[_0x05c7('0x49')]===_0x05c7('0x48')){var _0x1118b8=_0x7438d2[_0x05c7('0x22')]({'plain':!![]});var _0x46a57a=_0x05c7('0x23');return db[_0x05c7('0x4a')][_0x05c7('0x46')]({'where':{'name':_0x46a57a,'userProfileId':_0x3ff7a7[_0x05c7('0x4b')]},'raw':!![]})[_0x05c7('0x20')](function(_0x36798c){if(_0x36798c&&_0x36798c[_0x05c7('0x4c')]===0x0){return db['UserProfileResource'][_0x05c7('0x47')]({'name':_0x1118b8[_0x05c7('0x27')],'resourceId':_0x1118b8['id'],'type':_0x36798c[_0x05c7('0x27')],'sectionId':_0x36798c['id']},{})[_0x05c7('0x20')](function(){return _0x7438d2;});}else{return _0x7438d2;}})[_0x05c7('0x41')](function(_0x18e0b6){logger[_0x05c7('0x4d')](_0x05c7('0x4e'),_0x18e0b6);throw _0x18e0b6;});}return _0x7438d2;})['then'](respondWithResult(_0x2475b1,0xc9))['catch'](handleError(_0x2475b1,null));};exports[_0x05c7('0x4f')]=function(_0x52ccb2,_0x16087f){if(_0x52ccb2['body']['id']){delete _0x52ccb2[_0x05c7('0x50')]['id'];}return db['Template'][_0x05c7('0x46')]({'where':{'id':_0x52ccb2[_0x05c7('0x43')]['id']}})[_0x05c7('0x20')](handleEntityNotFound(_0x16087f,null))[_0x05c7('0x20')](saveUpdates(_0x52ccb2[_0x05c7('0x50')],null))['then'](respondWithResult(_0x16087f,null))['catch'](handleError(_0x16087f,null));};exports[_0x05c7('0x21')]=function(_0x1a1057,_0x5aee05){return db[_0x05c7('0x2a')][_0x05c7('0x46')]({'where':{'id':_0x1a1057[_0x05c7('0x43')]['id']}})[_0x05c7('0x20')](handleEntityNotFound(_0x5aee05,null))[_0x05c7('0x20')](removeEntity(_0x5aee05,null))['catch'](handleError(_0x5aee05,null));}; \ No newline at end of file +var _0xb7f8=['UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','get','Templates','destroy','error','stack','name','index','map','Template','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','include','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId'];(function(_0x22a90a,_0x461cdd){var _0x511604=function(_0x273219){while(--_0x273219){_0x22a90a['push'](_0x22a90a['shift']());}};_0x511604(++_0x461cdd);}(_0xb7f8,0xa6));var _0x8b7f=function(_0x2d6523,_0x257b89){_0x2d6523=_0x2d6523-0x0;var _0x565544=_0xb7f8[_0x2d6523];return _0x565544;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x8b7f('0x0'));var rimraf=require(_0x8b7f('0x1'));var zipdir=require(_0x8b7f('0x2'));var jsonpatch=require(_0x8b7f('0x3'));var rp=require(_0x8b7f('0x4'));var moment=require('moment');var BPromise=require(_0x8b7f('0x5'));var Mustache=require(_0x8b7f('0x6'));var util=require(_0x8b7f('0x7'));var path=require(_0x8b7f('0x8'));var sox=require(_0x8b7f('0x9'));var csv=require('to-csv');var ejs=require(_0x8b7f('0xa'));var fs=require('fs');var _=require(_0x8b7f('0xb'));var squel=require(_0x8b7f('0xc'));var crypto=require(_0x8b7f('0xd'));var jsforce=require(_0x8b7f('0xe'));var deskjs=require(_0x8b7f('0xf'));var toCsv=require(_0x8b7f('0x10'));var querystring=require('querystring');var Papa=require(_0x8b7f('0x11'));var Redis=require(_0x8b7f('0x12'));var authService=require(_0x8b7f('0x13'));var qs=require(_0x8b7f('0x14'));var as=require(_0x8b7f('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8b7f('0x16'))(_0x8b7f('0x17'));var utils=require(_0x8b7f('0x18'));var config=require('../../config/environment');var db=require(_0x8b7f('0x19'))['db'];function respondWithStatusCode(_0x576293,_0xda53d6){_0xda53d6=_0xda53d6||0xcc;return function(_0x11ca51){if(_0x11ca51){return _0x576293[_0x8b7f('0x1a')](_0xda53d6);}return _0x576293[_0x8b7f('0x1b')](_0xda53d6)[_0x8b7f('0x1c')]();};}function respondWithResult(_0x125940,_0x14cbb0){_0x14cbb0=_0x14cbb0||0xc8;return function(_0x792475){if(_0x792475){return _0x125940[_0x8b7f('0x1b')](_0x14cbb0)[_0x8b7f('0x1d')](_0x792475);}};}function respondWithFilteredResult(_0x3b6d16,_0x424db3){return function(_0x167dba){if(_0x167dba){var _0x40a608=_0x167dba['count'],_0x195717=_0x424db3[_0x8b7f('0x1e')],_0x99109f=_0x424db3[_0x8b7f('0x1e')]+_0x424db3[_0x8b7f('0x1f')],_0x16318c;if(_0x99109f>=_0x40a608){_0x99109f=_0x40a608;_0x16318c=0xc8;}else{_0x16318c=0xce;}_0x3b6d16[_0x8b7f('0x1b')](_0x16318c);return _0x3b6d16[_0x8b7f('0x20')](_0x8b7f('0x21'),_0x195717+'-'+_0x99109f+'/'+_0x40a608)[_0x8b7f('0x1d')](_0x167dba);}return null;};}function patchUpdates(_0x153d4b){return function(_0x33dee4){try{jsonpatch[_0x8b7f('0x22')](_0x33dee4,_0x153d4b,!![]);}catch(_0x438993){return BPromise[_0x8b7f('0x23')](_0x438993);}return _0x33dee4[_0x8b7f('0x24')]();};}function saveUpdates(_0x1db470,_0x3d16c5){return function(_0x5ec35e){if(_0x5ec35e){return _0x5ec35e[_0x8b7f('0x25')](_0x1db470)[_0x8b7f('0x26')](function(_0x1633f7){return _0x1633f7;});}return null;};}function removeEntity(_0x13fd1f,_0x3d7276){return function(_0x36daa5){if(_0x36daa5){return _0x36daa5['destroy']()['then'](function(){var _0x3bc286=_0x36daa5[_0x8b7f('0x27')]({'plain':!![]});var _0xedd3d7=_0x8b7f('0x28');return db['UserProfileResource'][_0x8b7f('0x29')]({'where':{'type':_0xedd3d7,'resourceId':_0x3bc286['id']}})[_0x8b7f('0x26')](function(){return _0x36daa5;});})['then'](function(){_0x13fd1f[_0x8b7f('0x1b')](0xcc)[_0x8b7f('0x1c')]();});}};}function handleEntityNotFound(_0x35cb9c,_0x20e54e){return function(_0x1f4e41){if(!_0x1f4e41){_0x35cb9c[_0x8b7f('0x1a')](0x194);}return _0x1f4e41;};}function handleError(_0x43e461,_0x541042){_0x541042=_0x541042||0x1f4;return function(_0x20cdf9){logger[_0x8b7f('0x2a')](_0x20cdf9[_0x8b7f('0x2b')]);if(_0x20cdf9[_0x8b7f('0x2c')]){delete _0x20cdf9['name'];}_0x43e461[_0x8b7f('0x1b')](_0x541042)['send'](_0x20cdf9);};}exports[_0x8b7f('0x2d')]=function(_0x36390a,_0x151e5f){var _0x219c9e={},_0x51dc39={},_0x42031b={'count':0x0,'rows':[]};var _0x11844e=_[_0x8b7f('0x2e')](db[_0x8b7f('0x2f')][_0x8b7f('0x30')],function(_0x1f1236){return{'name':_0x1f1236['fieldName'],'type':_0x1f1236[_0x8b7f('0x31')][_0x8b7f('0x32')]};});_0x51dc39[_0x8b7f('0x33')]=_[_0x8b7f('0x2e')](_0x11844e,_0x8b7f('0x2c'));_0x51dc39['query']=_[_0x8b7f('0x34')](_0x36390a[_0x8b7f('0x35')]);_0x51dc39[_0x8b7f('0x36')]=_[_0x8b7f('0x37')](_0x51dc39[_0x8b7f('0x33')],_0x51dc39['query']);_0x219c9e[_0x8b7f('0x38')]=_['intersection'](_0x51dc39[_0x8b7f('0x33')],qs['fields'](_0x36390a[_0x8b7f('0x35')][_0x8b7f('0x39')]));_0x219c9e[_0x8b7f('0x38')]=_0x219c9e['attributes'][_0x8b7f('0x3a')]?_0x219c9e[_0x8b7f('0x38')]:_0x51dc39[_0x8b7f('0x33')];if(!_0x36390a[_0x8b7f('0x35')][_0x8b7f('0x3b')]('nolimit')){_0x219c9e[_0x8b7f('0x1f')]=qs[_0x8b7f('0x1f')](_0x36390a[_0x8b7f('0x35')][_0x8b7f('0x1f')]);_0x219c9e[_0x8b7f('0x1e')]=qs[_0x8b7f('0x1e')](_0x36390a[_0x8b7f('0x35')][_0x8b7f('0x1e')]);}_0x219c9e[_0x8b7f('0x3c')]=qs[_0x8b7f('0x3d')](_0x36390a['query'][_0x8b7f('0x3d')]);_0x219c9e[_0x8b7f('0x3e')]=qs[_0x8b7f('0x36')](_[_0x8b7f('0x3f')](_0x36390a[_0x8b7f('0x35')],_0x51dc39[_0x8b7f('0x36')]));if(_0x36390a[_0x8b7f('0x35')][_0x8b7f('0x40')]){_0x219c9e[_0x8b7f('0x3e')]=_[_0x8b7f('0x41')](_0x219c9e[_0x8b7f('0x3e')],{'$or':_[_0x8b7f('0x2e')](_0x11844e,function(_0x5039da){if(_0x5039da[_0x8b7f('0x31')]!=='VIRTUAL'){var _0x278542={};_0x278542[_0x5039da[_0x8b7f('0x2c')]]={'$like':'%'+_0x36390a[_0x8b7f('0x35')]['filter']+'%'};return _0x278542;}})});}_0x219c9e=_[_0x8b7f('0x41')]({},_0x219c9e,_0x36390a[_0x8b7f('0x42')]);var _0x241804={'where':_0x219c9e[_0x8b7f('0x3e')]};return db['Template']['count'](_0x241804)[_0x8b7f('0x26')](function(_0x4108d7){_0x42031b['count']=_0x4108d7;if(_0x36390a['query']['includeAll']){_0x219c9e[_0x8b7f('0x43')]=[{'all':!![]}];}return db[_0x8b7f('0x2f')]['findAll'](_0x219c9e);})[_0x8b7f('0x26')](function(_0xe5a727){_0x42031b[_0x8b7f('0x44')]=_0xe5a727;return _0x42031b;})[_0x8b7f('0x26')](respondWithFilteredResult(_0x151e5f,_0x219c9e))[_0x8b7f('0x45')](handleError(_0x151e5f,null));};exports[_0x8b7f('0x46')]=function(_0x1da8a1,_0x303702){var _0x49a2a5={'raw':!![],'where':{'id':_0x1da8a1[_0x8b7f('0x47')]['id']}},_0x54af03={};_0x54af03[_0x8b7f('0x33')]=_[_0x8b7f('0x34')](db[_0x8b7f('0x2f')][_0x8b7f('0x30')]);_0x54af03[_0x8b7f('0x35')]=_[_0x8b7f('0x34')](_0x1da8a1[_0x8b7f('0x35')]);_0x54af03[_0x8b7f('0x36')]=_['intersection'](_0x54af03[_0x8b7f('0x33')],_0x54af03[_0x8b7f('0x35')]);_0x49a2a5[_0x8b7f('0x38')]=_[_0x8b7f('0x37')](_0x54af03[_0x8b7f('0x33')],qs[_0x8b7f('0x39')](_0x1da8a1['query']['fields']));_0x49a2a5[_0x8b7f('0x38')]=_0x49a2a5[_0x8b7f('0x38')][_0x8b7f('0x3a')]?_0x49a2a5[_0x8b7f('0x38')]:_0x54af03[_0x8b7f('0x33')];if(_0x1da8a1[_0x8b7f('0x35')]['includeAll']){_0x49a2a5[_0x8b7f('0x43')]=[{'all':!![]}];}_0x49a2a5=_['merge']({},_0x49a2a5,_0x1da8a1['options']);return db[_0x8b7f('0x2f')][_0x8b7f('0x48')](_0x49a2a5)['then'](handleEntityNotFound(_0x303702,null))['then'](respondWithResult(_0x303702,null))[_0x8b7f('0x45')](handleError(_0x303702,null));};exports['create']=function(_0x493d39,_0x475db3){return db['Template'][_0x8b7f('0x49')](_0x493d39[_0x8b7f('0x4a')],{})[_0x8b7f('0x26')](function(_0x54701a){var _0x26b811=_0x493d39[_0x8b7f('0x4b')]['get']({'plain':!![]});if(!_0x26b811)throw new Error(_0x8b7f('0x4c'));if(_0x26b811[_0x8b7f('0x4d')]==='user'){var _0x19890f=_0x54701a['get']({'plain':!![]});var _0x582a58=_0x8b7f('0x28');return db[_0x8b7f('0x4e')][_0x8b7f('0x48')]({'where':{'name':_0x582a58,'userProfileId':_0x26b811[_0x8b7f('0x4f')]},'raw':!![]})['then'](function(_0x5cb8c9){if(_0x5cb8c9&&_0x5cb8c9['autoAssociation']===0x0){return db[_0x8b7f('0x50')][_0x8b7f('0x49')]({'name':_0x19890f[_0x8b7f('0x2c')],'resourceId':_0x19890f['id'],'type':_0x5cb8c9[_0x8b7f('0x2c')],'sectionId':_0x5cb8c9['id']},{})[_0x8b7f('0x26')](function(){return _0x54701a;});}else{return _0x54701a;}})[_0x8b7f('0x45')](function(_0x34f661){logger[_0x8b7f('0x2a')](_0x8b7f('0x51'),_0x34f661);throw _0x34f661;});}return _0x54701a;})[_0x8b7f('0x26')](respondWithResult(_0x475db3,0xc9))[_0x8b7f('0x45')](handleError(_0x475db3,null));};exports['update']=function(_0x2b42f2,_0x1eab28){if(_0x2b42f2[_0x8b7f('0x4a')]['id']){delete _0x2b42f2['body']['id'];}return db[_0x8b7f('0x2f')][_0x8b7f('0x48')]({'where':{'id':_0x2b42f2[_0x8b7f('0x47')]['id']}})[_0x8b7f('0x26')](handleEntityNotFound(_0x1eab28,null))['then'](saveUpdates(_0x2b42f2[_0x8b7f('0x4a')],null))[_0x8b7f('0x26')](respondWithResult(_0x1eab28,null))[_0x8b7f('0x45')](handleError(_0x1eab28,null));};exports[_0x8b7f('0x29')]=function(_0x7808f4,_0x5b583d){return db['Template'][_0x8b7f('0x48')]({'where':{'id':_0x7808f4[_0x8b7f('0x47')]['id']}})[_0x8b7f('0x26')](handleEntityNotFound(_0x5b583d,null))['then'](removeEntity(_0x5b583d,null))[_0x8b7f('0x45')](handleError(_0x5b583d,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index f830ae8..4a9e9bb 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 _0xcfeb=['api','bluebird','request-promise','path','rimraf','../../config/environment','./template.attributes','define','Template','lodash','util'];(function(_0x5105bb,_0x5df8e6){var _0x260341=function(_0x2ff1ce){while(--_0x2ff1ce){_0x5105bb['push'](_0x5105bb['shift']());}};_0x260341(++_0x5df8e6);}(_0xcfeb,0x195));var _0xbcfe=function(_0x193453,_0x21318c){_0x193453=_0x193453-0x0;var _0x1bce75=_0xcfeb[_0x193453];return _0x1bce75;};'use strict';var _=require(_0xbcfe('0x0'));var util=require(_0xbcfe('0x1'));var logger=require('../../config/logger')(_0xbcfe('0x2'));var moment=require('moment');var BPromise=require(_0xbcfe('0x3'));var rp=require(_0xbcfe('0x4'));var fs=require('fs');var path=require(_0xbcfe('0x5'));var rimraf=require(_0xbcfe('0x6'));var config=require(_0xbcfe('0x7'));var attributes=require(_0xbcfe('0x8'));module['exports']=function(_0x179426,_0x32b296){return _0x179426[_0xbcfe('0x9')](_0xbcfe('0xa'),attributes,{'tableName':'tools_templates','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6a0d=['moment','bluebird','request-promise','path','../../config/environment','./template.attributes','define','Template','tools_templates','lodash','../../config/logger','api'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6a0d,0x189));var _0xd6a0=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x6a0d[_0x2b4411];return _0x8e41ef;};'use strict';var _=require(_0xd6a0('0x0'));var util=require('util');var logger=require(_0xd6a0('0x1'))(_0xd6a0('0x2'));var moment=require(_0xd6a0('0x3'));var BPromise=require(_0xd6a0('0x4'));var rp=require(_0xd6a0('0x5'));var fs=require('fs');var path=require(_0xd6a0('0x6'));var rimraf=require('rimraf');var config=require(_0xd6a0('0x7'));var attributes=require(_0xd6a0('0x8'));module['exports']=function(_0x24e901,_0x1778c4){return _0x24e901[_0xd6a0('0x9')](_0xd6a0('0xa'),attributes,{'tableName':_0xd6a0('0xb'),'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 0b88b4a..4b346e1 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 _0x304d=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','Template,\x20%s,\x20%s','debug','Template,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','GetTemplate','findAll','options','where','attributes','limit','include','map','model'];(function(_0x11d684,_0x4d4123){var _0x78a301=function(_0x1a1966){while(--_0x1a1966){_0x11d684['push'](_0x11d684['shift']());}};_0x78a301(++_0x4d4123);}(_0x304d,0x66));var _0xd304=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x304d[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xd304('0x0'));var util=require(_0xd304('0x1'));var moment=require(_0xd304('0x2'));var BPromise=require(_0xd304('0x3'));var rs=require(_0xd304('0x4'));var fs=require('fs');var Redis=require(_0xd304('0x5'));var db=require(_0xd304('0x6'))['db'];var utils=require(_0xd304('0x7'));var logger=require(_0xd304('0x8'))('rpc');var config=require(_0xd304('0x9'));var jayson=require(_0xd304('0xa'));var client=jayson[_0xd304('0xb')][_0xd304('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2eae79,_0x15f370,_0x5052cc){return new BPromise(function(_0x19fb67,_0x503493){return client[_0xd304('0xd')](_0x2eae79,_0x5052cc)[_0xd304('0xe')](function(_0x30702d){logger[_0xd304('0xf')](_0xd304('0x10'),_0x15f370,'request\x20sent');logger[_0xd304('0x11')](_0xd304('0x12'),_0x15f370,'request\x20sent',JSON[_0xd304('0x13')](_0x30702d));if(_0x30702d['error']){if(_0x30702d['error']['code']===0x1f4){logger[_0xd304('0x14')](_0xd304('0x10'),_0x15f370,_0x30702d[_0xd304('0x14')][_0xd304('0x15')]);return _0x503493(_0x30702d[_0xd304('0x14')]['message']);}logger[_0xd304('0x14')]('Template,\x20%s,\x20%s',_0x15f370,_0x30702d['error']['message']);return _0x19fb67(_0x30702d[_0xd304('0x14')][_0xd304('0x15')]);}else{logger[_0xd304('0xf')](_0xd304('0x10'),_0x15f370,_0xd304('0x16'));_0x19fb67(_0x30702d[_0xd304('0x17')][_0xd304('0x15')]);}})[_0xd304('0x18')](function(_0x2e1d19){logger[_0xd304('0x14')](_0xd304('0x10'),_0x15f370,_0x2e1d19);_0x503493(_0x2e1d19);});});}exports[_0xd304('0x19')]=function(_0x459653){var _0x10c016=this;return new Promise(function(_0x42e448,_0x171459){return db['Template'][_0xd304('0x1a')]({'raw':_0x459653[_0xd304('0x1b')]?_0x459653[_0xd304('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x459653[_0xd304('0x1b')]?_0x459653[_0xd304('0x1b')][_0xd304('0x1c')]||null:null,'attributes':_0x459653[_0xd304('0x1b')]?_0x459653[_0xd304('0x1b')][_0xd304('0x1d')]||null:null,'limit':_0x459653[_0xd304('0x1b')]?_0x459653[_0xd304('0x1b')][_0xd304('0x1e')]||null:null,'include':_0x459653[_0xd304('0x1b')]?_0x459653[_0xd304('0x1b')][_0xd304('0x1f')]?_[_0xd304('0x20')](_0x459653[_0xd304('0x1b')][_0xd304('0x1f')],function(_0x1462e4){return{'model':db[_0x1462e4[_0xd304('0x21')]],'as':_0x1462e4['as'],'attributes':_0x1462e4[_0xd304('0x1d')],'include':_0x1462e4[_0xd304('0x1f')]?_[_0xd304('0x20')](_0x1462e4[_0xd304('0x1f')],function(_0x35a01b){return{'model':db[_0x35a01b['model']],'as':_0x35a01b['as'],'attributes':_0x35a01b[_0xd304('0x1d')],'include':_0x35a01b[_0xd304('0x1f')]?_[_0xd304('0x20')](_0x35a01b[_0xd304('0x1f')],function(_0x103ae9){return{'model':db[_0x103ae9[_0xd304('0x21')]],'as':_0x103ae9['as'],'attributes':_0x103ae9['attributes']};}):[]};}):[]};}):[]:[]})[_0xd304('0xe')](function(_0x2c3495){logger[_0xd304('0xf')]('GetTemplate',_0x459653);logger[_0xd304('0x11')]('GetTemplate',_0x459653,JSON[_0xd304('0x13')](_0x2c3495));_0x42e448(_0x2c3495);})[_0xd304('0x18')](function(_0xe4a684){logger[_0xd304('0x14')](_0xd304('0x19'),_0xe4a684[_0xd304('0x15')],_0x459653);_0x171459(_0x10c016['error'](0x1f4,_0xe4a684[_0xd304('0x15')]));});});}; \ No newline at end of file +var _0xa001=['request\x20sent','stringify','error','code','Template,\x20%s,\x20%s','message','catch','GetTemplate','Template','options','raw','where','attributes','limit','include','model','map','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info'];(function(_0x3f992b,_0x366452){var _0x592572=function(_0x50a215){while(--_0x50a215){_0x3f992b['push'](_0x3f992b['shift']());}};_0x592572(++_0x366452);}(_0xa001,0x185));var _0x1a00=function(_0x528314,_0xbdb414){_0x528314=_0x528314-0x0;var _0x2fa61b=_0xa001[_0x528314];return _0x2fa61b;};'use strict';var _=require(_0x1a00('0x0'));var util=require('util');var moment=require(_0x1a00('0x1'));var BPromise=require(_0x1a00('0x2'));var rs=require(_0x1a00('0x3'));var fs=require('fs');var Redis=require(_0x1a00('0x4'));var db=require(_0x1a00('0x5'))['db'];var utils=require(_0x1a00('0x6'));var logger=require(_0x1a00('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x1a00('0x8'));var client=jayson[_0x1a00('0x9')][_0x1a00('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x8838c5,_0x4e7c44,_0x42e675){return new BPromise(function(_0x3b3265,_0x2079e2){return client[_0x1a00('0xb')](_0x8838c5,_0x42e675)[_0x1a00('0xc')](function(_0x31bdfa){logger[_0x1a00('0xd')]('Template,\x20%s,\x20%s',_0x4e7c44,_0x1a00('0xe'));logger['debug']('Template,\x20%s,\x20%s,\x20%s',_0x4e7c44,'request\x20sent',JSON[_0x1a00('0xf')](_0x31bdfa));if(_0x31bdfa[_0x1a00('0x10')]){if(_0x31bdfa[_0x1a00('0x10')][_0x1a00('0x11')]===0x1f4){logger['error'](_0x1a00('0x12'),_0x4e7c44,_0x31bdfa[_0x1a00('0x10')][_0x1a00('0x13')]);return _0x2079e2(_0x31bdfa['error']['message']);}logger['error']('Template,\x20%s,\x20%s',_0x4e7c44,_0x31bdfa[_0x1a00('0x10')][_0x1a00('0x13')]);return _0x3b3265(_0x31bdfa[_0x1a00('0x10')][_0x1a00('0x13')]);}else{logger['info'](_0x1a00('0x12'),_0x4e7c44,_0x1a00('0xe'));_0x3b3265(_0x31bdfa['result']['message']);}})[_0x1a00('0x14')](function(_0x13057b){logger[_0x1a00('0x10')](_0x1a00('0x12'),_0x4e7c44,_0x13057b);_0x2079e2(_0x13057b);});});}exports[_0x1a00('0x15')]=function(_0x542536){var _0x2cb753=this;return new Promise(function(_0x367c84,_0xf6ceb4){return db[_0x1a00('0x16')]['findAll']({'raw':_0x542536[_0x1a00('0x17')]?_0x542536[_0x1a00('0x17')][_0x1a00('0x18')]===undefined?!![]:![]:!![],'where':_0x542536[_0x1a00('0x17')]?_0x542536[_0x1a00('0x17')][_0x1a00('0x19')]||null:null,'attributes':_0x542536['options']?_0x542536['options'][_0x1a00('0x1a')]||null:null,'limit':_0x542536[_0x1a00('0x17')]?_0x542536[_0x1a00('0x17')][_0x1a00('0x1b')]||null:null,'include':_0x542536[_0x1a00('0x17')]?_0x542536[_0x1a00('0x17')][_0x1a00('0x1c')]?_['map'](_0x542536['options'][_0x1a00('0x1c')],function(_0x42a254){return{'model':db[_0x42a254[_0x1a00('0x1d')]],'as':_0x42a254['as'],'attributes':_0x42a254[_0x1a00('0x1a')],'include':_0x42a254[_0x1a00('0x1c')]?_['map'](_0x42a254[_0x1a00('0x1c')],function(_0x21ef27){return{'model':db[_0x21ef27[_0x1a00('0x1d')]],'as':_0x21ef27['as'],'attributes':_0x21ef27[_0x1a00('0x1a')],'include':_0x21ef27[_0x1a00('0x1c')]?_[_0x1a00('0x1e')](_0x21ef27['include'],function(_0xf2a145){return{'model':db[_0xf2a145['model']],'as':_0xf2a145['as'],'attributes':_0xf2a145[_0x1a00('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x1a00('0xc')](function(_0x422008){logger['info'](_0x1a00('0x15'),_0x542536);logger['debug']('GetTemplate',_0x542536,JSON['stringify'](_0x422008));_0x367c84(_0x422008);})['catch'](function(_0x247245){logger[_0x1a00('0x10')](_0x1a00('0x15'),_0x247245[_0x1a00('0x13')],_0x542536);_0xf6ceb4(_0x2cb753[_0x1a00('0x10')](0x1f4,_0x247245[_0x1a00('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 7e57bd6..f1ea062 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 _0xf27a=['multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/:id','show','getAllConditions','/:id/any_conditions','getAnyConditions','/:id/actions','post','create','/:id/all_conditions','addAllCondition','addAnyCondition','update','delete','exports'];(function(_0x5df90f,_0x5913a8){var _0x1f7bf3=function(_0x5d901e){while(--_0x5d901e){_0x5df90f['push'](_0x5df90f['shift']());}};_0x1f7bf3(++_0x5913a8);}(_0xf27a,0x1c8));var _0xaf27=function(_0x49e34d,_0x51070d){_0x49e34d=_0x49e34d-0x0;var _0x11d01e=_0xf27a[_0x49e34d];return _0x11d01e;};'use strict';var multer=require(_0xaf27('0x0'));var util=require(_0xaf27('0x1'));var path=require(_0xaf27('0x2'));var timeout=require(_0xaf27('0x3'));var express=require('express');var router=express[_0xaf27('0x4')]();var auth=require(_0xaf27('0x5'));var interaction=require(_0xaf27('0x6'));var config=require('../../config/environment');var controller=require('./trigger.controller');router['get']('/',auth[_0xaf27('0x7')](),controller[_0xaf27('0x8')]);router[_0xaf27('0x9')](_0xaf27('0xa'),auth['isAuthenticated'](),controller[_0xaf27('0xb')]);router[_0xaf27('0x9')]('/:id/all_conditions',auth[_0xaf27('0x7')](),controller[_0xaf27('0xc')]);router[_0xaf27('0x9')](_0xaf27('0xd'),auth['isAuthenticated'](),controller[_0xaf27('0xe')]);router[_0xaf27('0x9')](_0xaf27('0xf'),auth[_0xaf27('0x7')](),controller['getActions']);router[_0xaf27('0x10')]('/',auth[_0xaf27('0x7')](),controller[_0xaf27('0x11')]);router[_0xaf27('0x10')](_0xaf27('0x12'),auth[_0xaf27('0x7')](),controller[_0xaf27('0x13')]);router[_0xaf27('0x10')](_0xaf27('0xd'),auth['isAuthenticated'](),controller[_0xaf27('0x14')]);router[_0xaf27('0x10')](_0xaf27('0xf'),auth[_0xaf27('0x7')](),controller['addAction']);router['put'](_0xaf27('0xa'),auth['isAuthenticated'](),controller[_0xaf27('0x15')]);router[_0xaf27('0x16')](_0xaf27('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0xaf27('0x17')]=router; \ No newline at end of file +var _0xa3f4=['destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./trigger.controller','get','index','isAuthenticated','show','getAllConditions','/:id/any_conditions','getAnyConditions','/:id/actions','post','create','/:id/all_conditions','addAnyCondition','addAction','put','/:id','update','delete'];(function(_0x9c3c56,_0x169b56){var _0x2dd782=function(_0x386962){while(--_0x386962){_0x9c3c56['push'](_0x9c3c56['shift']());}};_0x2dd782(++_0x169b56);}(_0xa3f4,0x152));var _0x4a3f=function(_0x4907d5,_0x24de80){_0x4907d5=_0x4907d5-0x0;var _0x353358=_0xa3f4[_0x4907d5];return _0x353358;};'use strict';var multer=require(_0x4a3f('0x0'));var util=require(_0x4a3f('0x1'));var path=require(_0x4a3f('0x2'));var timeout=require(_0x4a3f('0x3'));var express=require(_0x4a3f('0x4'));var router=express[_0x4a3f('0x5')]();var auth=require(_0x4a3f('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x4a3f('0x7'));var controller=require(_0x4a3f('0x8'));router[_0x4a3f('0x9')]('/',auth['isAuthenticated'](),controller[_0x4a3f('0xa')]);router['get']('/:id',auth[_0x4a3f('0xb')](),controller[_0x4a3f('0xc')]);router[_0x4a3f('0x9')]('/:id/all_conditions',auth['isAuthenticated'](),controller[_0x4a3f('0xd')]);router['get'](_0x4a3f('0xe'),auth[_0x4a3f('0xb')](),controller[_0x4a3f('0xf')]);router['get'](_0x4a3f('0x10'),auth[_0x4a3f('0xb')](),controller['getActions']);router[_0x4a3f('0x11')]('/',auth['isAuthenticated'](),controller[_0x4a3f('0x12')]);router[_0x4a3f('0x11')](_0x4a3f('0x13'),auth[_0x4a3f('0xb')](),controller['addAllCondition']);router[_0x4a3f('0x11')](_0x4a3f('0xe'),auth['isAuthenticated'](),controller[_0x4a3f('0x14')]);router[_0x4a3f('0x11')](_0x4a3f('0x10'),auth[_0x4a3f('0xb')](),controller[_0x4a3f('0x15')]);router[_0x4a3f('0x16')](_0x4a3f('0x17'),auth[_0x4a3f('0xb')](),controller[_0x4a3f('0x18')]);router[_0x4a3f('0x19')]('/:id',auth[_0x4a3f('0xb')](),controller[_0x4a3f('0x1a')]);module[_0x4a3f('0x1b')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index 0c3d766..4399a26 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 _0xf10e=['exports','STRING','sequelize'];(function(_0x543eac,_0x3a39a1){var _0x16c036=function(_0x446e5d){while(--_0x446e5d){_0x543eac['push'](_0x543eac['shift']());}};_0x16c036(++_0x3a39a1);}(_0xf10e,0x161));var _0xef10=function(_0x3740fe,_0x6c543c){_0x3740fe=_0x3740fe-0x0;var _0x55492b=_0xf10e[_0x3740fe];return _0x55492b;};'use strict';var Sequelize=require(_0xef10('0x0'));module[_0xef10('0x1')]={'name':{'type':Sequelize[_0xef10('0x2')]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xef10('0x2')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x32d6=['BOOLEAN','exports','STRING'];(function(_0x339554,_0x1e3a19){var _0x496881=function(_0x39f85e){while(--_0x39f85e){_0x339554['push'](_0x339554['shift']());}};_0x496881(++_0x1e3a19);}(_0x32d6,0xdc));var _0x632d=function(_0x4f16b5,_0x2273bd){_0x4f16b5=_0x4f16b5-0x0;var _0x5d69f2=_0x32d6[_0x4f16b5];return _0x5d69f2;};'use strict';var Sequelize=require('sequelize');module[_0x632d('0x0')]={'name':{'type':Sequelize[_0x632d('0x1')]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x632d('0x1')]},'status':{'type':Sequelize[_0x632d('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index 4573f72..399d1d4 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 _0xc4e2=['rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','options','Trigger','count','findAll','rows','catch','show','params','includeAll','include','merge','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addAllCondition','addAnyCondition','TriggerAnyId','getAllConditions','Condition','hasOwnProperty','getAnyConditions','findOne','length','addAction','TriggerId','getActions','Action','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','sox','to-csv','ejs','squel','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','status','json','offset','limit','set','apply','reject','update','destroy','get','Triggers','UserProfileResource','then','sendStatus','error','stack','name','send','index','map'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xc4e2,0xe2));var _0x2c4e=function(_0xd1d19a,_0x1933f0){_0xd1d19a=_0xd1d19a-0x0;var _0x52a79d=_0xc4e2[_0xd1d19a];return _0x52a79d;};'use strict';var pdf=require(_0x2c4e('0x0'));var emlformat=require(_0x2c4e('0x1'));var rimraf=require(_0x2c4e('0x2'));var zipdir=require(_0x2c4e('0x3'));var jsonpatch=require(_0x2c4e('0x4'));var rp=require(_0x2c4e('0x5'));var moment=require(_0x2c4e('0x6'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x2c4e('0x7'));var path=require('path');var sox=require(_0x2c4e('0x8'));var csv=require(_0x2c4e('0x9'));var ejs=require(_0x2c4e('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x2c4e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x2c4e('0xc'));var toCsv=require(_0x2c4e('0x9'));var querystring=require(_0x2c4e('0xd'));var Papa=require(_0x2c4e('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x2c4e('0xf'));var hardwareService=require(_0x2c4e('0x10'));var logger=require(_0x2c4e('0x11'))(_0x2c4e('0x12'));var utils=require(_0x2c4e('0x13'));var config=require(_0x2c4e('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x185a4c,_0x2097ed){_0x2097ed=_0x2097ed||0xcc;return function(_0x2493d3){if(_0x2493d3){return _0x185a4c['sendStatus'](_0x2097ed);}return _0x185a4c[_0x2c4e('0x15')](_0x2097ed)['end']();};}function respondWithResult(_0x1f4f71,_0x2503ff){_0x2503ff=_0x2503ff||0xc8;return function(_0xa4d017){if(_0xa4d017){return _0x1f4f71[_0x2c4e('0x15')](_0x2503ff)[_0x2c4e('0x16')](_0xa4d017);}};}function respondWithFilteredResult(_0x5ae3b4,_0x2d7309){return function(_0x5e1970){if(_0x5e1970){var _0x2b74d7=_0x5e1970['count'],_0x59dcad=_0x2d7309[_0x2c4e('0x17')],_0x253c47=_0x2d7309[_0x2c4e('0x17')]+_0x2d7309[_0x2c4e('0x18')],_0xd07bca;if(_0x253c47>=_0x2b74d7){_0x253c47=_0x2b74d7;_0xd07bca=0xc8;}else{_0xd07bca=0xce;}_0x5ae3b4[_0x2c4e('0x15')](_0xd07bca);return _0x5ae3b4[_0x2c4e('0x19')]('Content-Range',_0x59dcad+'-'+_0x253c47+'/'+_0x2b74d7)['json'](_0x5e1970);}return null;};}function patchUpdates(_0xfb6508){return function(_0x4e94d1){try{jsonpatch[_0x2c4e('0x1a')](_0x4e94d1,_0xfb6508,!![]);}catch(_0x337bed){return BPromise[_0x2c4e('0x1b')](_0x337bed);}return _0x4e94d1['save']();};}function saveUpdates(_0x52830a,_0x4b2a2d){return function(_0x108b8a){if(_0x108b8a){return _0x108b8a[_0x2c4e('0x1c')](_0x52830a)['then'](function(_0x5bf751){return _0x5bf751;});}return null;};}function removeEntity(_0x5ba38a,_0x5c2f01){return function(_0x3eb3f5){if(_0x3eb3f5){return _0x3eb3f5[_0x2c4e('0x1d')]()['then'](function(){var _0x167b82=_0x3eb3f5[_0x2c4e('0x1e')]({'plain':!![]});var _0x4045d0=_0x2c4e('0x1f');return db[_0x2c4e('0x20')][_0x2c4e('0x1d')]({'where':{'type':_0x4045d0,'resourceId':_0x167b82['id']}})['then'](function(){return _0x3eb3f5;});})[_0x2c4e('0x21')](function(){_0x5ba38a[_0x2c4e('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x9565f5,_0xba8dac){return function(_0x315b2a){if(!_0x315b2a){_0x9565f5[_0x2c4e('0x22')](0x194);}return _0x315b2a;};}function handleError(_0x34a502,_0x40b7e0){_0x40b7e0=_0x40b7e0||0x1f4;return function(_0x47f8eb){logger[_0x2c4e('0x23')](_0x47f8eb[_0x2c4e('0x24')]);if(_0x47f8eb[_0x2c4e('0x25')]){delete _0x47f8eb[_0x2c4e('0x25')];}_0x34a502[_0x2c4e('0x15')](_0x40b7e0)[_0x2c4e('0x26')](_0x47f8eb);};}exports[_0x2c4e('0x27')]=function(_0x1db0af,_0x2e3e3d){var _0x4a8df6={},_0x314db9={},_0x4bc46e={'count':0x0,'rows':[]};var _0x1c4b41=_[_0x2c4e('0x28')](db['Trigger'][_0x2c4e('0x29')],function(_0x2f38da){return{'name':_0x2f38da[_0x2c4e('0x2a')],'type':_0x2f38da[_0x2c4e('0x2b')][_0x2c4e('0x2c')]};});_0x314db9[_0x2c4e('0x2d')]=_[_0x2c4e('0x28')](_0x1c4b41,_0x2c4e('0x25'));_0x314db9[_0x2c4e('0x2e')]=_[_0x2c4e('0x2f')](_0x1db0af[_0x2c4e('0x2e')]);_0x314db9['filters']=_[_0x2c4e('0x30')](_0x314db9[_0x2c4e('0x2d')],_0x314db9[_0x2c4e('0x2e')]);_0x4a8df6['attributes']=_['intersection'](_0x314db9[_0x2c4e('0x2d')],qs[_0x2c4e('0x31')](_0x1db0af[_0x2c4e('0x2e')][_0x2c4e('0x31')]));_0x4a8df6[_0x2c4e('0x32')]=_0x4a8df6['attributes']['length']?_0x4a8df6[_0x2c4e('0x32')]:_0x314db9[_0x2c4e('0x2d')];if(!_0x1db0af['query']['hasOwnProperty'](_0x2c4e('0x33'))){_0x4a8df6['limit']=qs[_0x2c4e('0x18')](_0x1db0af[_0x2c4e('0x2e')]['limit']);_0x4a8df6[_0x2c4e('0x17')]=qs[_0x2c4e('0x17')](_0x1db0af[_0x2c4e('0x2e')][_0x2c4e('0x17')]);}_0x4a8df6[_0x2c4e('0x34')]=qs[_0x2c4e('0x35')](_0x1db0af[_0x2c4e('0x2e')][_0x2c4e('0x35')]);_0x4a8df6[_0x2c4e('0x36')]=qs[_0x2c4e('0x37')](_[_0x2c4e('0x38')](_0x1db0af[_0x2c4e('0x2e')],_0x314db9[_0x2c4e('0x37')]));if(_0x1db0af['query'][_0x2c4e('0x39')]){_0x4a8df6[_0x2c4e('0x36')]=_['merge'](_0x4a8df6[_0x2c4e('0x36')],{'$or':_['map'](_0x1c4b41,function(_0x3a4e28){if(_0x3a4e28[_0x2c4e('0x2b')]!==_0x2c4e('0x3a')){var _0x62280={};_0x62280[_0x3a4e28[_0x2c4e('0x25')]]={'$like':'%'+_0x1db0af[_0x2c4e('0x2e')][_0x2c4e('0x39')]+'%'};return _0x62280;}})});}_0x4a8df6=_['merge']({},_0x4a8df6,_0x1db0af[_0x2c4e('0x3b')]);var _0x266650={'where':_0x4a8df6[_0x2c4e('0x36')]};return db[_0x2c4e('0x3c')][_0x2c4e('0x3d')](_0x266650)['then'](function(_0xa0e4b5){_0x4bc46e[_0x2c4e('0x3d')]=_0xa0e4b5;if(_0x1db0af[_0x2c4e('0x2e')]['includeAll']){_0x4a8df6['include']=[{'all':!![]}];}return db[_0x2c4e('0x3c')][_0x2c4e('0x3e')](_0x4a8df6);})[_0x2c4e('0x21')](function(_0xa5219f){_0x4bc46e[_0x2c4e('0x3f')]=_0xa5219f;return _0x4bc46e;})['then'](respondWithFilteredResult(_0x2e3e3d,_0x4a8df6))[_0x2c4e('0x40')](handleError(_0x2e3e3d,null));};exports[_0x2c4e('0x41')]=function(_0x42b798,_0x5627f6){var _0x274542={'raw':![],'where':{'id':_0x42b798[_0x2c4e('0x42')]['id']}},_0x11400f={};_0x11400f[_0x2c4e('0x2d')]=_[_0x2c4e('0x2f')](db['Trigger'][_0x2c4e('0x29')]);_0x11400f[_0x2c4e('0x2e')]=_['keys'](_0x42b798[_0x2c4e('0x2e')]);_0x11400f[_0x2c4e('0x37')]=_[_0x2c4e('0x30')](_0x11400f['model'],_0x11400f['query']);_0x274542[_0x2c4e('0x32')]=_['intersection'](_0x11400f[_0x2c4e('0x2d')],qs[_0x2c4e('0x31')](_0x42b798[_0x2c4e('0x2e')][_0x2c4e('0x31')]));_0x274542['attributes']=_0x274542[_0x2c4e('0x32')]['length']?_0x274542['attributes']:_0x11400f[_0x2c4e('0x2d')];if(_0x42b798[_0x2c4e('0x2e')][_0x2c4e('0x43')]){_0x274542[_0x2c4e('0x44')]=[{'all':!![]}];}_0x274542=_[_0x2c4e('0x45')]({},_0x274542,_0x42b798[_0x2c4e('0x3b')]);return db[_0x2c4e('0x3c')][_0x2c4e('0x46')](_0x274542)['then'](handleEntityNotFound(_0x5627f6,null))['then'](respondWithResult(_0x5627f6,null))[_0x2c4e('0x40')](handleError(_0x5627f6,null));};exports[_0x2c4e('0x47')]=function(_0x6ee74e,_0x43a404){return db[_0x2c4e('0x3c')]['create'](_0x6ee74e[_0x2c4e('0x48')],{})[_0x2c4e('0x21')](function(_0x2582a0){var _0x9f2367=_0x6ee74e['user'][_0x2c4e('0x1e')]({'plain':!![]});if(!_0x9f2367)throw new Error(_0x2c4e('0x49'));if(_0x9f2367['role']==='user'){var _0x5d29f6=_0x2582a0[_0x2c4e('0x1e')]({'plain':!![]});var _0x1d172d='Triggers';return db[_0x2c4e('0x4a')][_0x2c4e('0x46')]({'where':{'name':_0x1d172d,'userProfileId':_0x9f2367['userProfileId']},'raw':!![]})[_0x2c4e('0x21')](function(_0x343b10){if(_0x343b10&&_0x343b10['autoAssociation']===0x0){return db[_0x2c4e('0x20')][_0x2c4e('0x47')]({'name':_0x5d29f6[_0x2c4e('0x25')],'resourceId':_0x5d29f6['id'],'type':_0x343b10[_0x2c4e('0x25')],'sectionId':_0x343b10['id']},{})[_0x2c4e('0x21')](function(){return _0x2582a0;});}else{return _0x2582a0;}})[_0x2c4e('0x40')](function(_0x213c6b){logger['error'](_0x2c4e('0x4b'),_0x213c6b);throw _0x213c6b;});}return _0x2582a0;})['then'](respondWithResult(_0x43a404,0xc9))['catch'](handleError(_0x43a404,null));};exports[_0x2c4e('0x1c')]=function(_0x1bc468,_0x38f2ae){if(_0x1bc468[_0x2c4e('0x48')]['id']){delete _0x1bc468[_0x2c4e('0x48')]['id'];}return db['Trigger'][_0x2c4e('0x46')]({'where':{'id':_0x1bc468[_0x2c4e('0x42')]['id']}})[_0x2c4e('0x21')](handleEntityNotFound(_0x38f2ae,null))['then'](saveUpdates(_0x1bc468[_0x2c4e('0x48')],null))[_0x2c4e('0x21')](respondWithResult(_0x38f2ae,null))[_0x2c4e('0x40')](handleError(_0x38f2ae,null));};exports[_0x2c4e('0x1d')]=function(_0x5aed9a,_0x68ae60){return db[_0x2c4e('0x3c')]['find']({'where':{'id':_0x5aed9a[_0x2c4e('0x42')]['id']}})[_0x2c4e('0x21')](handleEntityNotFound(_0x68ae60,null))[_0x2c4e('0x21')](removeEntity(_0x68ae60,null))[_0x2c4e('0x40')](handleError(_0x68ae60,null));};exports[_0x2c4e('0x4c')]=function(_0x49a5db,_0x57eefd,_0x40fdbb){if(_0x49a5db[_0x2c4e('0x48')]['id']){delete _0x49a5db[_0x2c4e('0x48')]['id'];}return db[_0x2c4e('0x3c')]['find']({'where':{'id':_0x49a5db['params']['id']}})[_0x2c4e('0x21')](handleEntityNotFound(_0x57eefd,null))[_0x2c4e('0x21')](function(_0x1d3158){if(_0x1d3158){_0x49a5db[_0x2c4e('0x48')]['TriggerAllId']=_0x1d3158['id'];return db['Condition'][_0x2c4e('0x47')](_0x49a5db['body']);}})[_0x2c4e('0x21')](respondWithResult(_0x57eefd,null))['catch'](handleError(_0x57eefd,null));};exports[_0x2c4e('0x4d')]=function(_0x3424d1,_0x2f3d44,_0x157a8b){if(_0x3424d1[_0x2c4e('0x48')]['id']){delete _0x3424d1['body']['id'];}return db[_0x2c4e('0x3c')][_0x2c4e('0x46')]({'where':{'id':_0x3424d1[_0x2c4e('0x42')]['id']}})[_0x2c4e('0x21')](handleEntityNotFound(_0x2f3d44,null))['then'](function(_0x58a3fa){if(_0x58a3fa){_0x3424d1['body'][_0x2c4e('0x4e')]=_0x58a3fa['id'];return db['Condition'][_0x2c4e('0x47')](_0x3424d1[_0x2c4e('0x48')]);}})[_0x2c4e('0x21')](respondWithResult(_0x2f3d44,null))['catch'](handleError(_0x2f3d44,null));};exports[_0x2c4e('0x4f')]=function(_0x302952,_0x459973,_0xb27cb4){var _0x175180={};var _0x49e531={};var _0x4b2d2a;var _0x4c5cc3;return db[_0x2c4e('0x3c')]['findOne']({'where':{'id':_0x302952[_0x2c4e('0x42')]['id']}})['then'](handleEntityNotFound(_0x459973,null))['then'](function(_0x428479){if(_0x428479){_0x4b2d2a=_0x428479;_0x49e531['model']=_[_0x2c4e('0x2f')](db[_0x2c4e('0x50')][_0x2c4e('0x29')]);_0x49e531['query']=_['keys'](_0x302952[_0x2c4e('0x2e')]);_0x49e531[_0x2c4e('0x37')]=_['intersection'](_0x49e531[_0x2c4e('0x2d')],_0x49e531[_0x2c4e('0x2e')]);_0x175180[_0x2c4e('0x32')]=_['intersection'](_0x49e531[_0x2c4e('0x2d')],qs['fields'](_0x302952['query'][_0x2c4e('0x31')]));_0x175180[_0x2c4e('0x32')]=_0x175180['attributes']['length']?_0x175180[_0x2c4e('0x32')]:_0x49e531[_0x2c4e('0x2d')];_0x175180[_0x2c4e('0x34')]=qs[_0x2c4e('0x35')](_0x302952[_0x2c4e('0x2e')][_0x2c4e('0x35')]);_0x175180[_0x2c4e('0x36')]=qs[_0x2c4e('0x37')](_[_0x2c4e('0x38')](_0x302952[_0x2c4e('0x2e')],_0x49e531[_0x2c4e('0x37')]));if(_0x302952[_0x2c4e('0x2e')][_0x2c4e('0x39')]){_0x175180[_0x2c4e('0x36')]=_[_0x2c4e('0x45')](_0x175180['where'],{'$or':_[_0x2c4e('0x28')](_0x175180['attributes'],function(_0x17ce0b){var _0x451bcc={};_0x451bcc[_0x17ce0b]={'$like':'%'+_0x302952[_0x2c4e('0x2e')]['filter']+'%'};return _0x451bcc;})});}_0x175180=_[_0x2c4e('0x45')]({},_0x175180,_0x302952[_0x2c4e('0x3b')]);return _0x4b2d2a[_0x2c4e('0x4f')](_0x175180);}})[_0x2c4e('0x21')](function(_0x4942b7){if(_0x4942b7){_0x4c5cc3=_0x4942b7['length'];if(!_0x302952[_0x2c4e('0x2e')][_0x2c4e('0x51')](_0x2c4e('0x33'))){_0x175180['limit']=qs[_0x2c4e('0x18')](_0x302952[_0x2c4e('0x2e')][_0x2c4e('0x18')]);_0x175180['offset']=qs[_0x2c4e('0x17')](_0x302952[_0x2c4e('0x2e')]['offset']);}return _0x4b2d2a[_0x2c4e('0x4f')](_0x175180);}})[_0x2c4e('0x21')](function(_0x389c62){if(_0x389c62){return _0x389c62?{'count':_0x4c5cc3,'rows':_0x389c62}:null;}})[_0x2c4e('0x21')](respondWithResult(_0x459973,null))[_0x2c4e('0x40')](handleError(_0x459973,null));};exports[_0x2c4e('0x52')]=function(_0x46ad0d,_0x1e17b9,_0x25c9b6){var _0x52d5f7={};var _0x5efd88={};var _0x591fdf;var _0x360160;return db['Trigger'][_0x2c4e('0x53')]({'where':{'id':_0x46ad0d['params']['id']}})[_0x2c4e('0x21')](handleEntityNotFound(_0x1e17b9,null))['then'](function(_0x53f459){if(_0x53f459){_0x591fdf=_0x53f459;_0x5efd88['model']=_[_0x2c4e('0x2f')](db[_0x2c4e('0x50')][_0x2c4e('0x29')]);_0x5efd88[_0x2c4e('0x2e')]=_['keys'](_0x46ad0d[_0x2c4e('0x2e')]);_0x5efd88[_0x2c4e('0x37')]=_['intersection'](_0x5efd88[_0x2c4e('0x2d')],_0x5efd88[_0x2c4e('0x2e')]);_0x52d5f7[_0x2c4e('0x32')]=_['intersection'](_0x5efd88[_0x2c4e('0x2d')],qs['fields'](_0x46ad0d[_0x2c4e('0x2e')][_0x2c4e('0x31')]));_0x52d5f7[_0x2c4e('0x32')]=_0x52d5f7[_0x2c4e('0x32')][_0x2c4e('0x54')]?_0x52d5f7[_0x2c4e('0x32')]:_0x5efd88[_0x2c4e('0x2d')];_0x52d5f7[_0x2c4e('0x34')]=qs[_0x2c4e('0x35')](_0x46ad0d[_0x2c4e('0x2e')]['sort']);_0x52d5f7['where']=qs['filters'](_[_0x2c4e('0x38')](_0x46ad0d[_0x2c4e('0x2e')],_0x5efd88[_0x2c4e('0x37')]));if(_0x46ad0d[_0x2c4e('0x2e')][_0x2c4e('0x39')]){_0x52d5f7[_0x2c4e('0x36')]=_[_0x2c4e('0x45')](_0x52d5f7[_0x2c4e('0x36')],{'$or':_['map'](_0x52d5f7[_0x2c4e('0x32')],function(_0x4f32e2){var _0x4ac241={};_0x4ac241[_0x4f32e2]={'$like':'%'+_0x46ad0d[_0x2c4e('0x2e')][_0x2c4e('0x39')]+'%'};return _0x4ac241;})});}_0x52d5f7=_['merge']({},_0x52d5f7,_0x46ad0d[_0x2c4e('0x3b')]);return _0x591fdf[_0x2c4e('0x52')](_0x52d5f7);}})[_0x2c4e('0x21')](function(_0x1a63a1){if(_0x1a63a1){_0x360160=_0x1a63a1[_0x2c4e('0x54')];if(!_0x46ad0d[_0x2c4e('0x2e')][_0x2c4e('0x51')](_0x2c4e('0x33'))){_0x52d5f7[_0x2c4e('0x18')]=qs[_0x2c4e('0x18')](_0x46ad0d[_0x2c4e('0x2e')][_0x2c4e('0x18')]);_0x52d5f7[_0x2c4e('0x17')]=qs['offset'](_0x46ad0d[_0x2c4e('0x2e')]['offset']);}return _0x591fdf[_0x2c4e('0x52')](_0x52d5f7);}})[_0x2c4e('0x21')](function(_0x5152e4){if(_0x5152e4){return _0x5152e4?{'count':_0x360160,'rows':_0x5152e4}:null;}})['then'](respondWithResult(_0x1e17b9,null))[_0x2c4e('0x40')](handleError(_0x1e17b9,null));};exports[_0x2c4e('0x55')]=function(_0x3ce523,_0x2fcf06,_0x3c8509){if(_0x3ce523[_0x2c4e('0x48')]['id']){delete _0x3ce523[_0x2c4e('0x48')]['id'];}return db[_0x2c4e('0x3c')]['find']({'where':{'id':_0x3ce523[_0x2c4e('0x42')]['id']}})[_0x2c4e('0x21')](handleEntityNotFound(_0x2fcf06,null))[_0x2c4e('0x21')](function(_0x4961a4){if(_0x4961a4){_0x3ce523['body'][_0x2c4e('0x56')]=_0x4961a4['id'];return db['Action']['create'](_0x3ce523[_0x2c4e('0x48')]);}})[_0x2c4e('0x21')](respondWithResult(_0x2fcf06,null))['catch'](handleError(_0x2fcf06,null));};exports[_0x2c4e('0x57')]=function(_0x36a5fc,_0x5c4849,_0x11fb79){var _0x3c71ae={};var _0x517573={};var _0x44f30e;var _0x1c8d45;return db[_0x2c4e('0x3c')][_0x2c4e('0x53')]({'where':{'id':_0x36a5fc[_0x2c4e('0x42')]['id']}})[_0x2c4e('0x21')](handleEntityNotFound(_0x5c4849,null))[_0x2c4e('0x21')](function(_0x68f09d){if(_0x68f09d){_0x44f30e=_0x68f09d;_0x517573[_0x2c4e('0x2d')]=_[_0x2c4e('0x2f')](db[_0x2c4e('0x58')][_0x2c4e('0x29')]);_0x517573[_0x2c4e('0x2e')]=_[_0x2c4e('0x2f')](_0x36a5fc['query']);_0x517573['filters']=_[_0x2c4e('0x30')](_0x517573['model'],_0x517573[_0x2c4e('0x2e')]);_0x3c71ae[_0x2c4e('0x32')]=_['intersection'](_0x517573[_0x2c4e('0x2d')],qs[_0x2c4e('0x31')](_0x36a5fc[_0x2c4e('0x2e')][_0x2c4e('0x31')]));_0x3c71ae[_0x2c4e('0x32')]=_0x3c71ae['attributes'][_0x2c4e('0x54')]?_0x3c71ae[_0x2c4e('0x32')]:_0x517573[_0x2c4e('0x2d')];_0x3c71ae[_0x2c4e('0x34')]=qs[_0x2c4e('0x35')](_0x36a5fc['query'][_0x2c4e('0x35')]);_0x3c71ae[_0x2c4e('0x36')]=qs[_0x2c4e('0x37')](_[_0x2c4e('0x38')](_0x36a5fc[_0x2c4e('0x2e')],_0x517573[_0x2c4e('0x37')]));if(_0x36a5fc[_0x2c4e('0x2e')][_0x2c4e('0x39')]){_0x3c71ae[_0x2c4e('0x36')]=_[_0x2c4e('0x45')](_0x3c71ae[_0x2c4e('0x36')],{'$or':_['map'](_0x3c71ae['attributes'],function(_0x4bcc3a){var _0x4cc6a7={};_0x4cc6a7[_0x4bcc3a]={'$like':'%'+_0x36a5fc[_0x2c4e('0x2e')][_0x2c4e('0x39')]+'%'};return _0x4cc6a7;})});}_0x3c71ae=_[_0x2c4e('0x45')]({},_0x3c71ae,_0x36a5fc[_0x2c4e('0x3b')]);return _0x44f30e['getActions'](_0x3c71ae);}})[_0x2c4e('0x21')](function(_0x4ce73e){if(_0x4ce73e){_0x1c8d45=_0x4ce73e['length'];if(!_0x36a5fc['query'][_0x2c4e('0x51')](_0x2c4e('0x33'))){_0x3c71ae[_0x2c4e('0x18')]=qs[_0x2c4e('0x18')](_0x36a5fc[_0x2c4e('0x2e')]['limit']);_0x3c71ae[_0x2c4e('0x17')]=qs[_0x2c4e('0x17')](_0x36a5fc[_0x2c4e('0x2e')][_0x2c4e('0x17')]);}return _0x44f30e[_0x2c4e('0x57')](_0x3c71ae);}})['then'](function(_0x2e3c3d){if(_0x2e3c3d){return _0x2e3c3d?{'count':_0x1c8d45,'rows':_0x2e3c3d}:null;}})[_0x2c4e('0x21')](respondWithResult(_0x5c4849,null))[_0x2c4e('0x40')](handleError(_0x5c4849,null));}; \ No newline at end of file +var _0xe1e9=['Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addAllCondition','TriggerAllId','Condition','addAnyCondition','TriggerAnyId','getAllConditions','findOne','getAnyConditions','addAction','Action','getActions','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','squel','jsforce','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','then','get','Triggers','destroy','error','name','send','index','map','Trigger','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','length','find','create','body','user'];(function(_0xecfc5,_0x3eef92){var _0x474509=function(_0x6e438){while(--_0x6e438){_0xecfc5['push'](_0xecfc5['shift']());}};_0x474509(++_0x3eef92);}(_0xe1e9,0x1e2));var _0x9e1e=function(_0x1919cc,_0x1a8b1b){_0x1919cc=_0x1919cc-0x0;var _0x2191d3=_0xe1e9[_0x1919cc];return _0x2191d3;};'use strict';var pdf=require(_0x9e1e('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x9e1e('0x1'));var zipdir=require(_0x9e1e('0x2'));var jsonpatch=require(_0x9e1e('0x3'));var rp=require(_0x9e1e('0x4'));var moment=require(_0x9e1e('0x5'));var BPromise=require(_0x9e1e('0x6'));var Mustache=require(_0x9e1e('0x7'));var util=require('util');var path=require(_0x9e1e('0x8'));var sox=require('sox');var csv=require(_0x9e1e('0x9'));var ejs=require(_0x9e1e('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x9e1e('0xb'));var crypto=require('crypto');var jsforce=require(_0x9e1e('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x9e1e('0xd'));var Redis=require(_0x9e1e('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x9e1e('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9e1e('0x10'));var logger=require(_0x9e1e('0x11'))('api');var utils=require(_0x9e1e('0x12'));var config=require(_0x9e1e('0x13'));var db=require(_0x9e1e('0x14'))['db'];function respondWithStatusCode(_0x27ed76,_0x2ab6a9){_0x2ab6a9=_0x2ab6a9||0xcc;return function(_0x2500b1){if(_0x2500b1){return _0x27ed76[_0x9e1e('0x15')](_0x2ab6a9);}return _0x27ed76[_0x9e1e('0x16')](_0x2ab6a9)[_0x9e1e('0x17')]();};}function respondWithResult(_0x613ed7,_0x2ca72a){_0x2ca72a=_0x2ca72a||0xc8;return function(_0x13b465){if(_0x13b465){return _0x613ed7[_0x9e1e('0x16')](_0x2ca72a)[_0x9e1e('0x18')](_0x13b465);}};}function respondWithFilteredResult(_0x33b7e6,_0x26f610){return function(_0x5cb706){if(_0x5cb706){var _0x5d1665=_0x5cb706[_0x9e1e('0x19')],_0x2db1ed=_0x26f610[_0x9e1e('0x1a')],_0x2beb27=_0x26f610[_0x9e1e('0x1a')]+_0x26f610[_0x9e1e('0x1b')],_0x271d41;if(_0x2beb27>=_0x5d1665){_0x2beb27=_0x5d1665;_0x271d41=0xc8;}else{_0x271d41=0xce;}_0x33b7e6[_0x9e1e('0x16')](_0x271d41);return _0x33b7e6[_0x9e1e('0x1c')](_0x9e1e('0x1d'),_0x2db1ed+'-'+_0x2beb27+'/'+_0x5d1665)['json'](_0x5cb706);}return null;};}function patchUpdates(_0x429705){return function(_0x2aa73a){try{jsonpatch[_0x9e1e('0x1e')](_0x2aa73a,_0x429705,!![]);}catch(_0x5c166d){return BPromise[_0x9e1e('0x1f')](_0x5c166d);}return _0x2aa73a[_0x9e1e('0x20')]();};}function saveUpdates(_0xa4c0ed,_0x36c8f1){return function(_0x3e2a2f){if(_0x3e2a2f){return _0x3e2a2f['update'](_0xa4c0ed)['then'](function(_0x3ce65a){return _0x3ce65a;});}return null;};}function removeEntity(_0x42c1fb,_0x4c82ea){return function(_0x31f551){if(_0x31f551){return _0x31f551['destroy']()[_0x9e1e('0x21')](function(){var _0x54b264=_0x31f551[_0x9e1e('0x22')]({'plain':!![]});var _0x4813d4=_0x9e1e('0x23');return db['UserProfileResource'][_0x9e1e('0x24')]({'where':{'type':_0x4813d4,'resourceId':_0x54b264['id']}})['then'](function(){return _0x31f551;});})[_0x9e1e('0x21')](function(){_0x42c1fb['status'](0xcc)[_0x9e1e('0x17')]();});}};}function handleEntityNotFound(_0x103d60,_0x37fd40){return function(_0x14a10c){if(!_0x14a10c){_0x103d60[_0x9e1e('0x15')](0x194);}return _0x14a10c;};}function handleError(_0x459364,_0x3cd044){_0x3cd044=_0x3cd044||0x1f4;return function(_0x1f78e9){logger[_0x9e1e('0x25')](_0x1f78e9['stack']);if(_0x1f78e9[_0x9e1e('0x26')]){delete _0x1f78e9['name'];}_0x459364[_0x9e1e('0x16')](_0x3cd044)[_0x9e1e('0x27')](_0x1f78e9);};}exports[_0x9e1e('0x28')]=function(_0x543899,_0x42c4cd){var _0x5ecd86={},_0x38682c={},_0x1ab3ac={'count':0x0,'rows':[]};var _0x13333d=_[_0x9e1e('0x29')](db[_0x9e1e('0x2a')]['rawAttributes'],function(_0x287249){return{'name':_0x287249[_0x9e1e('0x2b')],'type':_0x287249[_0x9e1e('0x2c')][_0x9e1e('0x2d')]};});_0x38682c[_0x9e1e('0x2e')]=_['map'](_0x13333d,'name');_0x38682c[_0x9e1e('0x2f')]=_[_0x9e1e('0x30')](_0x543899[_0x9e1e('0x2f')]);_0x38682c[_0x9e1e('0x31')]=_[_0x9e1e('0x32')](_0x38682c[_0x9e1e('0x2e')],_0x38682c['query']);_0x5ecd86[_0x9e1e('0x33')]=_[_0x9e1e('0x32')](_0x38682c['model'],qs[_0x9e1e('0x34')](_0x543899['query'][_0x9e1e('0x34')]));_0x5ecd86['attributes']=_0x5ecd86[_0x9e1e('0x33')]['length']?_0x5ecd86[_0x9e1e('0x33')]:_0x38682c[_0x9e1e('0x2e')];if(!_0x543899[_0x9e1e('0x2f')][_0x9e1e('0x35')](_0x9e1e('0x36'))){_0x5ecd86[_0x9e1e('0x1b')]=qs['limit'](_0x543899['query']['limit']);_0x5ecd86[_0x9e1e('0x1a')]=qs[_0x9e1e('0x1a')](_0x543899[_0x9e1e('0x2f')][_0x9e1e('0x1a')]);}_0x5ecd86[_0x9e1e('0x37')]=qs[_0x9e1e('0x38')](_0x543899[_0x9e1e('0x2f')][_0x9e1e('0x38')]);_0x5ecd86['where']=qs['filters'](_[_0x9e1e('0x39')](_0x543899[_0x9e1e('0x2f')],_0x38682c['filters']));if(_0x543899[_0x9e1e('0x2f')][_0x9e1e('0x3a')]){_0x5ecd86[_0x9e1e('0x3b')]=_['merge'](_0x5ecd86[_0x9e1e('0x3b')],{'$or':_[_0x9e1e('0x29')](_0x13333d,function(_0x32a5e7){if(_0x32a5e7[_0x9e1e('0x2c')]!==_0x9e1e('0x3c')){var _0x5a192b={};_0x5a192b[_0x32a5e7[_0x9e1e('0x26')]]={'$like':'%'+_0x543899[_0x9e1e('0x2f')]['filter']+'%'};return _0x5a192b;}})});}_0x5ecd86=_[_0x9e1e('0x3d')]({},_0x5ecd86,_0x543899[_0x9e1e('0x3e')]);var _0x525823={'where':_0x5ecd86['where']};return db[_0x9e1e('0x2a')][_0x9e1e('0x19')](_0x525823)[_0x9e1e('0x21')](function(_0x3343f2){_0x1ab3ac['count']=_0x3343f2;if(_0x543899[_0x9e1e('0x2f')][_0x9e1e('0x3f')]){_0x5ecd86[_0x9e1e('0x40')]=[{'all':!![]}];}return db[_0x9e1e('0x2a')][_0x9e1e('0x41')](_0x5ecd86);})[_0x9e1e('0x21')](function(_0x8e114b){_0x1ab3ac[_0x9e1e('0x42')]=_0x8e114b;return _0x1ab3ac;})[_0x9e1e('0x21')](respondWithFilteredResult(_0x42c4cd,_0x5ecd86))[_0x9e1e('0x43')](handleError(_0x42c4cd,null));};exports[_0x9e1e('0x44')]=function(_0x5a91ba,_0x2cf8eb){var _0x44af5c={'raw':![],'where':{'id':_0x5a91ba[_0x9e1e('0x45')]['id']}},_0x5eace2={};_0x5eace2[_0x9e1e('0x2e')]=_[_0x9e1e('0x30')](db['Trigger'][_0x9e1e('0x46')]);_0x5eace2[_0x9e1e('0x2f')]=_['keys'](_0x5a91ba[_0x9e1e('0x2f')]);_0x5eace2['filters']=_[_0x9e1e('0x32')](_0x5eace2[_0x9e1e('0x2e')],_0x5eace2[_0x9e1e('0x2f')]);_0x44af5c[_0x9e1e('0x33')]=_[_0x9e1e('0x32')](_0x5eace2[_0x9e1e('0x2e')],qs[_0x9e1e('0x34')](_0x5a91ba[_0x9e1e('0x2f')]['fields']));_0x44af5c[_0x9e1e('0x33')]=_0x44af5c[_0x9e1e('0x33')][_0x9e1e('0x47')]?_0x44af5c[_0x9e1e('0x33')]:_0x5eace2[_0x9e1e('0x2e')];if(_0x5a91ba[_0x9e1e('0x2f')]['includeAll']){_0x44af5c[_0x9e1e('0x40')]=[{'all':!![]}];}_0x44af5c=_[_0x9e1e('0x3d')]({},_0x44af5c,_0x5a91ba[_0x9e1e('0x3e')]);return db[_0x9e1e('0x2a')][_0x9e1e('0x48')](_0x44af5c)['then'](handleEntityNotFound(_0x2cf8eb,null))[_0x9e1e('0x21')](respondWithResult(_0x2cf8eb,null))[_0x9e1e('0x43')](handleError(_0x2cf8eb,null));};exports[_0x9e1e('0x49')]=function(_0x3178b4,_0x55b678){return db[_0x9e1e('0x2a')][_0x9e1e('0x49')](_0x3178b4[_0x9e1e('0x4a')],{})[_0x9e1e('0x21')](function(_0x1b930c){var _0x3b547e=_0x3178b4[_0x9e1e('0x4b')][_0x9e1e('0x22')]({'plain':!![]});if(!_0x3b547e)throw new Error(_0x9e1e('0x4c'));if(_0x3b547e[_0x9e1e('0x4d')]===_0x9e1e('0x4b')){var _0x17d20d=_0x1b930c['get']({'plain':!![]});var _0x44d712=_0x9e1e('0x23');return db[_0x9e1e('0x4e')][_0x9e1e('0x48')]({'where':{'name':_0x44d712,'userProfileId':_0x3b547e[_0x9e1e('0x4f')]},'raw':!![]})[_0x9e1e('0x21')](function(_0x4b3baf){if(_0x4b3baf&&_0x4b3baf[_0x9e1e('0x50')]===0x0){return db['UserProfileResource'][_0x9e1e('0x49')]({'name':_0x17d20d['name'],'resourceId':_0x17d20d['id'],'type':_0x4b3baf[_0x9e1e('0x26')],'sectionId':_0x4b3baf['id']},{})[_0x9e1e('0x21')](function(){return _0x1b930c;});}else{return _0x1b930c;}})[_0x9e1e('0x43')](function(_0x32afe5){logger[_0x9e1e('0x25')](_0x9e1e('0x51'),_0x32afe5);throw _0x32afe5;});}return _0x1b930c;})[_0x9e1e('0x21')](respondWithResult(_0x55b678,0xc9))['catch'](handleError(_0x55b678,null));};exports['update']=function(_0x38c209,_0x56f49c){if(_0x38c209['body']['id']){delete _0x38c209['body']['id'];}return db[_0x9e1e('0x2a')][_0x9e1e('0x48')]({'where':{'id':_0x38c209[_0x9e1e('0x45')]['id']}})[_0x9e1e('0x21')](handleEntityNotFound(_0x56f49c,null))[_0x9e1e('0x21')](saveUpdates(_0x38c209[_0x9e1e('0x4a')],null))[_0x9e1e('0x21')](respondWithResult(_0x56f49c,null))[_0x9e1e('0x43')](handleError(_0x56f49c,null));};exports[_0x9e1e('0x24')]=function(_0x14ed33,_0x2660b9){return db[_0x9e1e('0x2a')][_0x9e1e('0x48')]({'where':{'id':_0x14ed33[_0x9e1e('0x45')]['id']}})['then'](handleEntityNotFound(_0x2660b9,null))[_0x9e1e('0x21')](removeEntity(_0x2660b9,null))['catch'](handleError(_0x2660b9,null));};exports[_0x9e1e('0x52')]=function(_0x5d400b,_0x5e0a3f,_0x22c20b){if(_0x5d400b[_0x9e1e('0x4a')]['id']){delete _0x5d400b[_0x9e1e('0x4a')]['id'];}return db[_0x9e1e('0x2a')]['find']({'where':{'id':_0x5d400b['params']['id']}})[_0x9e1e('0x21')](handleEntityNotFound(_0x5e0a3f,null))[_0x9e1e('0x21')](function(_0x1ce54e){if(_0x1ce54e){_0x5d400b[_0x9e1e('0x4a')][_0x9e1e('0x53')]=_0x1ce54e['id'];return db[_0x9e1e('0x54')][_0x9e1e('0x49')](_0x5d400b['body']);}})[_0x9e1e('0x21')](respondWithResult(_0x5e0a3f,null))[_0x9e1e('0x43')](handleError(_0x5e0a3f,null));};exports[_0x9e1e('0x55')]=function(_0x5994a0,_0x34118a,_0x32d283){if(_0x5994a0['body']['id']){delete _0x5994a0['body']['id'];}return db[_0x9e1e('0x2a')][_0x9e1e('0x48')]({'where':{'id':_0x5994a0[_0x9e1e('0x45')]['id']}})['then'](handleEntityNotFound(_0x34118a,null))[_0x9e1e('0x21')](function(_0x466d77){if(_0x466d77){_0x5994a0['body'][_0x9e1e('0x56')]=_0x466d77['id'];return db[_0x9e1e('0x54')][_0x9e1e('0x49')](_0x5994a0[_0x9e1e('0x4a')]);}})[_0x9e1e('0x21')](respondWithResult(_0x34118a,null))['catch'](handleError(_0x34118a,null));};exports[_0x9e1e('0x57')]=function(_0x31f02f,_0x10e88e,_0x2056eb){var _0x271886={};var _0xd2b325={};var _0x9653b6;var _0x130f82;return db['Trigger'][_0x9e1e('0x58')]({'where':{'id':_0x31f02f[_0x9e1e('0x45')]['id']}})[_0x9e1e('0x21')](handleEntityNotFound(_0x10e88e,null))[_0x9e1e('0x21')](function(_0x5ec38c){if(_0x5ec38c){_0x9653b6=_0x5ec38c;_0xd2b325[_0x9e1e('0x2e')]=_[_0x9e1e('0x30')](db['Condition']['rawAttributes']);_0xd2b325[_0x9e1e('0x2f')]=_[_0x9e1e('0x30')](_0x31f02f['query']);_0xd2b325[_0x9e1e('0x31')]=_['intersection'](_0xd2b325[_0x9e1e('0x2e')],_0xd2b325[_0x9e1e('0x2f')]);_0x271886[_0x9e1e('0x33')]=_['intersection'](_0xd2b325[_0x9e1e('0x2e')],qs[_0x9e1e('0x34')](_0x31f02f[_0x9e1e('0x2f')][_0x9e1e('0x34')]));_0x271886['attributes']=_0x271886[_0x9e1e('0x33')][_0x9e1e('0x47')]?_0x271886[_0x9e1e('0x33')]:_0xd2b325[_0x9e1e('0x2e')];_0x271886[_0x9e1e('0x37')]=qs[_0x9e1e('0x38')](_0x31f02f[_0x9e1e('0x2f')][_0x9e1e('0x38')]);_0x271886[_0x9e1e('0x3b')]=qs[_0x9e1e('0x31')](_['pick'](_0x31f02f[_0x9e1e('0x2f')],_0xd2b325[_0x9e1e('0x31')]));if(_0x31f02f[_0x9e1e('0x2f')][_0x9e1e('0x3a')]){_0x271886[_0x9e1e('0x3b')]=_['merge'](_0x271886['where'],{'$or':_[_0x9e1e('0x29')](_0x271886[_0x9e1e('0x33')],function(_0x53f31d){var _0x43c8c6={};_0x43c8c6[_0x53f31d]={'$like':'%'+_0x31f02f[_0x9e1e('0x2f')][_0x9e1e('0x3a')]+'%'};return _0x43c8c6;})});}_0x271886=_['merge']({},_0x271886,_0x31f02f[_0x9e1e('0x3e')]);return _0x9653b6['getAllConditions'](_0x271886);}})[_0x9e1e('0x21')](function(_0x43c7cb){if(_0x43c7cb){_0x130f82=_0x43c7cb['length'];if(!_0x31f02f[_0x9e1e('0x2f')][_0x9e1e('0x35')]('nolimit')){_0x271886['limit']=qs[_0x9e1e('0x1b')](_0x31f02f[_0x9e1e('0x2f')][_0x9e1e('0x1b')]);_0x271886[_0x9e1e('0x1a')]=qs[_0x9e1e('0x1a')](_0x31f02f[_0x9e1e('0x2f')][_0x9e1e('0x1a')]);}return _0x9653b6[_0x9e1e('0x57')](_0x271886);}})[_0x9e1e('0x21')](function(_0x3f0da3){if(_0x3f0da3){return _0x3f0da3?{'count':_0x130f82,'rows':_0x3f0da3}:null;}})[_0x9e1e('0x21')](respondWithResult(_0x10e88e,null))['catch'](handleError(_0x10e88e,null));};exports['getAnyConditions']=function(_0x5eb13e,_0x59fcf4,_0x2baf1a){var _0x359c25={};var _0x8d9876={};var _0x117e4c;var _0x3082b5;return db['Trigger'][_0x9e1e('0x58')]({'where':{'id':_0x5eb13e[_0x9e1e('0x45')]['id']}})[_0x9e1e('0x21')](handleEntityNotFound(_0x59fcf4,null))[_0x9e1e('0x21')](function(_0x55a28b){if(_0x55a28b){_0x117e4c=_0x55a28b;_0x8d9876[_0x9e1e('0x2e')]=_[_0x9e1e('0x30')](db[_0x9e1e('0x54')][_0x9e1e('0x46')]);_0x8d9876['query']=_[_0x9e1e('0x30')](_0x5eb13e['query']);_0x8d9876[_0x9e1e('0x31')]=_['intersection'](_0x8d9876['model'],_0x8d9876[_0x9e1e('0x2f')]);_0x359c25['attributes']=_[_0x9e1e('0x32')](_0x8d9876[_0x9e1e('0x2e')],qs[_0x9e1e('0x34')](_0x5eb13e[_0x9e1e('0x2f')][_0x9e1e('0x34')]));_0x359c25['attributes']=_0x359c25[_0x9e1e('0x33')]['length']?_0x359c25[_0x9e1e('0x33')]:_0x8d9876[_0x9e1e('0x2e')];_0x359c25[_0x9e1e('0x37')]=qs[_0x9e1e('0x38')](_0x5eb13e[_0x9e1e('0x2f')][_0x9e1e('0x38')]);_0x359c25[_0x9e1e('0x3b')]=qs['filters'](_[_0x9e1e('0x39')](_0x5eb13e[_0x9e1e('0x2f')],_0x8d9876['filters']));if(_0x5eb13e[_0x9e1e('0x2f')]['filter']){_0x359c25[_0x9e1e('0x3b')]=_['merge'](_0x359c25[_0x9e1e('0x3b')],{'$or':_[_0x9e1e('0x29')](_0x359c25[_0x9e1e('0x33')],function(_0x3cbe36){var _0x4931e0={};_0x4931e0[_0x3cbe36]={'$like':'%'+_0x5eb13e[_0x9e1e('0x2f')]['filter']+'%'};return _0x4931e0;})});}_0x359c25=_[_0x9e1e('0x3d')]({},_0x359c25,_0x5eb13e[_0x9e1e('0x3e')]);return _0x117e4c[_0x9e1e('0x59')](_0x359c25);}})['then'](function(_0x1aeeed){if(_0x1aeeed){_0x3082b5=_0x1aeeed[_0x9e1e('0x47')];if(!_0x5eb13e[_0x9e1e('0x2f')][_0x9e1e('0x35')]('nolimit')){_0x359c25[_0x9e1e('0x1b')]=qs[_0x9e1e('0x1b')](_0x5eb13e[_0x9e1e('0x2f')][_0x9e1e('0x1b')]);_0x359c25['offset']=qs[_0x9e1e('0x1a')](_0x5eb13e[_0x9e1e('0x2f')]['offset']);}return _0x117e4c['getAnyConditions'](_0x359c25);}})[_0x9e1e('0x21')](function(_0x5a8c51){if(_0x5a8c51){return _0x5a8c51?{'count':_0x3082b5,'rows':_0x5a8c51}:null;}})[_0x9e1e('0x21')](respondWithResult(_0x59fcf4,null))[_0x9e1e('0x43')](handleError(_0x59fcf4,null));};exports[_0x9e1e('0x5a')]=function(_0x49aa8e,_0x223e96,_0x5d61b7){if(_0x49aa8e[_0x9e1e('0x4a')]['id']){delete _0x49aa8e[_0x9e1e('0x4a')]['id'];}return db[_0x9e1e('0x2a')]['find']({'where':{'id':_0x49aa8e[_0x9e1e('0x45')]['id']}})[_0x9e1e('0x21')](handleEntityNotFound(_0x223e96,null))[_0x9e1e('0x21')](function(_0x1e722d){if(_0x1e722d){_0x49aa8e[_0x9e1e('0x4a')]['TriggerId']=_0x1e722d['id'];return db[_0x9e1e('0x5b')]['create'](_0x49aa8e['body']);}})[_0x9e1e('0x21')](respondWithResult(_0x223e96,null))['catch'](handleError(_0x223e96,null));};exports[_0x9e1e('0x5c')]=function(_0x593ec1,_0x1689f1,_0x4cfd4b){var _0x5dda0c={};var _0x5e6d76={};var _0x58d16a;var _0xd6bd61;return db[_0x9e1e('0x2a')]['findOne']({'where':{'id':_0x593ec1[_0x9e1e('0x45')]['id']}})[_0x9e1e('0x21')](handleEntityNotFound(_0x1689f1,null))[_0x9e1e('0x21')](function(_0x43743d){if(_0x43743d){_0x58d16a=_0x43743d;_0x5e6d76[_0x9e1e('0x2e')]=_[_0x9e1e('0x30')](db['Action'][_0x9e1e('0x46')]);_0x5e6d76[_0x9e1e('0x2f')]=_[_0x9e1e('0x30')](_0x593ec1[_0x9e1e('0x2f')]);_0x5e6d76[_0x9e1e('0x31')]=_[_0x9e1e('0x32')](_0x5e6d76[_0x9e1e('0x2e')],_0x5e6d76[_0x9e1e('0x2f')]);_0x5dda0c[_0x9e1e('0x33')]=_[_0x9e1e('0x32')](_0x5e6d76[_0x9e1e('0x2e')],qs[_0x9e1e('0x34')](_0x593ec1['query']['fields']));_0x5dda0c[_0x9e1e('0x33')]=_0x5dda0c[_0x9e1e('0x33')][_0x9e1e('0x47')]?_0x5dda0c[_0x9e1e('0x33')]:_0x5e6d76[_0x9e1e('0x2e')];_0x5dda0c[_0x9e1e('0x37')]=qs[_0x9e1e('0x38')](_0x593ec1['query']['sort']);_0x5dda0c[_0x9e1e('0x3b')]=qs[_0x9e1e('0x31')](_[_0x9e1e('0x39')](_0x593ec1['query'],_0x5e6d76['filters']));if(_0x593ec1[_0x9e1e('0x2f')]['filter']){_0x5dda0c['where']=_[_0x9e1e('0x3d')](_0x5dda0c[_0x9e1e('0x3b')],{'$or':_[_0x9e1e('0x29')](_0x5dda0c[_0x9e1e('0x33')],function(_0x400368){var _0x5753a5={};_0x5753a5[_0x400368]={'$like':'%'+_0x593ec1['query'][_0x9e1e('0x3a')]+'%'};return _0x5753a5;})});}_0x5dda0c=_['merge']({},_0x5dda0c,_0x593ec1[_0x9e1e('0x3e')]);return _0x58d16a[_0x9e1e('0x5c')](_0x5dda0c);}})[_0x9e1e('0x21')](function(_0x49b322){if(_0x49b322){_0xd6bd61=_0x49b322[_0x9e1e('0x47')];if(!_0x593ec1['query'][_0x9e1e('0x35')]('nolimit')){_0x5dda0c[_0x9e1e('0x1b')]=qs[_0x9e1e('0x1b')](_0x593ec1['query']['limit']);_0x5dda0c[_0x9e1e('0x1a')]=qs[_0x9e1e('0x1a')](_0x593ec1['query']['offset']);}return _0x58d16a[_0x9e1e('0x5c')](_0x5dda0c);}})['then'](function(_0x32c86c){if(_0x32c86c){return _0x32c86c?{'count':_0xd6bd61,'rows':_0x32c86c}:null;}})[_0x9e1e('0x21')](respondWithResult(_0x1689f1,null))[_0x9e1e('0x43')](handleError(_0x1689f1,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index 1298ad5..bcb3bb7 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 _0xc45a=['request-promise','path','rimraf','exports','define','Trigger','tools_triggers','../../config/logger','api','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc45a,0x1c9));var _0xac45=function(_0x391187,_0x4b67c3){_0x391187=_0x391187-0x0;var _0x2a01eb=_0xc45a[_0x391187];return _0x2a01eb;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xac45('0x0'))(_0xac45('0x1'));var moment=require(_0xac45('0x2'));var BPromise=require('bluebird');var rp=require(_0xac45('0x3'));var fs=require('fs');var path=require(_0xac45('0x4'));var rimraf=require(_0xac45('0x5'));var config=require('../../config/environment');var attributes=require('./trigger.attributes');module[_0xac45('0x6')]=function(_0x54cd32,_0x586c4e){return _0x54cd32[_0xac45('0x7')](_0xac45('0x8'),attributes,{'tableName':_0xac45('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa968=['lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./trigger.attributes','exports','Trigger','tools_triggers'];(function(_0x5e835d,_0x316a82){var _0x4a7c58=function(_0x15be0f){while(--_0x15be0f){_0x5e835d['push'](_0x5e835d['shift']());}};_0x4a7c58(++_0x316a82);}(_0xa968,0x120));var _0x8a96=function(_0x2fd555,_0x5eb89f){_0x2fd555=_0x2fd555-0x0;var _0x3cbce8=_0xa968[_0x2fd555];return _0x3cbce8;};'use strict';var _=require(_0x8a96('0x0'));var util=require(_0x8a96('0x1'));var logger=require(_0x8a96('0x2'))('api');var moment=require(_0x8a96('0x3'));var BPromise=require(_0x8a96('0x4'));var rp=require(_0x8a96('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8a96('0x6'));var config=require(_0x8a96('0x7'));var attributes=require(_0x8a96('0x8'));module[_0x8a96('0x9')]=function(_0x66feef,_0x37410c){return _0x66feef['define'](_0x8a96('0xa'),attributes,{'tableName':_0x8a96('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trigger/trigger.rpc.js b/server/api/trigger/trigger.rpc.js index f6fe148..1a079b3 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 _0xed3c=['catch','Trigger','findAll','options','raw','where','limit','include','map','model','attributes','GetTrigger','ShowTrigger','find','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','info','Trigger,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xed3c,0x1a6));var _0xced3=function(_0x35c514,_0x22bb8a){_0x35c514=_0x35c514-0x0;var _0x448f20=_0xed3c[_0x35c514];return _0x448f20;};'use strict';var _=require(_0xced3('0x0'));var util=require(_0xced3('0x1'));var moment=require(_0xced3('0x2'));var BPromise=require(_0xced3('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xced3('0x4'));var db=require(_0xced3('0x5'))['db'];var utils=require(_0xced3('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xced3('0x7'));var jayson=require(_0xced3('0x8'));var client=jayson[_0xced3('0x9')][_0xced3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4795cd,_0x510164,_0x5ca701){return new BPromise(function(_0x851bd3,_0x5f2f90){return client['request'](_0x4795cd,_0x5ca701)['then'](function(_0x19a727){logger[_0xced3('0xb')](_0xced3('0xc'),_0x510164,_0xced3('0xd'));logger[_0xced3('0xe')]('Trigger,\x20%s,\x20%s,\x20%s',_0x510164,_0xced3('0xd'),JSON[_0xced3('0xf')](_0x19a727));if(_0x19a727[_0xced3('0x10')]){if(_0x19a727['error'][_0xced3('0x11')]===0x1f4){logger[_0xced3('0x10')](_0xced3('0xc'),_0x510164,_0x19a727[_0xced3('0x10')][_0xced3('0x12')]);return _0x5f2f90(_0x19a727[_0xced3('0x10')][_0xced3('0x12')]);}logger['error'](_0xced3('0xc'),_0x510164,_0x19a727['error'][_0xced3('0x12')]);return _0x851bd3(_0x19a727[_0xced3('0x10')][_0xced3('0x12')]);}else{logger[_0xced3('0xb')]('Trigger,\x20%s,\x20%s',_0x510164,_0xced3('0xd'));_0x851bd3(_0x19a727[_0xced3('0x13')]['message']);}})[_0xced3('0x14')](function(_0x37e2d5){logger[_0xced3('0x10')](_0xced3('0xc'),_0x510164,_0x37e2d5);_0x5f2f90(_0x37e2d5);});});}exports['GetTrigger']=function(_0x4569af){var _0x4a3afe=this;return new Promise(function(_0x353580,_0x4480a6){return db[_0xced3('0x15')][_0xced3('0x16')]({'raw':_0x4569af[_0xced3('0x17')]?_0x4569af[_0xced3('0x17')][_0xced3('0x18')]===undefined?!![]:![]:!![],'where':_0x4569af[_0xced3('0x17')]?_0x4569af[_0xced3('0x17')][_0xced3('0x19')]||null:null,'attributes':_0x4569af[_0xced3('0x17')]?_0x4569af['options']['attributes']||null:null,'limit':_0x4569af['options']?_0x4569af[_0xced3('0x17')][_0xced3('0x1a')]||null:null,'include':_0x4569af[_0xced3('0x17')]?_0x4569af['options'][_0xced3('0x1b')]?_[_0xced3('0x1c')](_0x4569af['options']['include'],function(_0x3adf14){return{'model':db[_0x3adf14[_0xced3('0x1d')]],'as':_0x3adf14['as'],'attributes':_0x3adf14[_0xced3('0x1e')],'include':_0x3adf14[_0xced3('0x1b')]?_['map'](_0x3adf14[_0xced3('0x1b')],function(_0x23f92b){return{'model':db[_0x23f92b['model']],'as':_0x23f92b['as'],'attributes':_0x23f92b[_0xced3('0x1e')],'include':_0x23f92b['include']?_[_0xced3('0x1c')](_0x23f92b[_0xced3('0x1b')],function(_0x3b728d){return{'model':db[_0x3b728d[_0xced3('0x1d')]],'as':_0x3b728d['as'],'attributes':_0x3b728d[_0xced3('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5454c0){logger[_0xced3('0xb')]('GetTrigger',_0x4569af);logger[_0xced3('0xe')](_0xced3('0x1f'),_0x4569af,JSON['stringify'](_0x5454c0));_0x353580(_0x5454c0);})[_0xced3('0x14')](function(_0x4024fa){logger[_0xced3('0x10')](_0xced3('0x1f'),_0x4024fa[_0xced3('0x12')],_0x4569af);_0x4480a6(_0x4a3afe[_0xced3('0x10')](0x1f4,_0x4024fa[_0xced3('0x12')]));});});};exports[_0xced3('0x20')]=function(_0x116cc7){var _0x559b8e=this;return new Promise(function(_0xa78899,_0x1b8baa){return db[_0xced3('0x15')][_0xced3('0x21')]({'raw':_0x116cc7[_0xced3('0x17')]?_0x116cc7[_0xced3('0x17')][_0xced3('0x18')]===undefined?!![]:![]:!![],'where':_0x116cc7[_0xced3('0x17')]?_0x116cc7[_0xced3('0x17')][_0xced3('0x19')]||null:null,'attributes':_0x116cc7[_0xced3('0x17')]?_0x116cc7[_0xced3('0x17')][_0xced3('0x1e')]||null:null,'include':_0x116cc7[_0xced3('0x17')]?_0x116cc7[_0xced3('0x17')][_0xced3('0x1b')]?_[_0xced3('0x1c')](_0x116cc7[_0xced3('0x17')][_0xced3('0x1b')],function(_0xcd0fe3){return{'model':db[_0xcd0fe3[_0xced3('0x1d')]],'as':_0xcd0fe3['as'],'attributes':_0xcd0fe3['attributes'],'include':_0xcd0fe3[_0xced3('0x1b')]?_['map'](_0xcd0fe3[_0xced3('0x1b')],function(_0x28f674){return{'model':db[_0x28f674[_0xced3('0x1d')]],'as':_0x28f674['as'],'attributes':_0x28f674[_0xced3('0x1e')],'include':_0x28f674[_0xced3('0x1b')]?_[_0xced3('0x1c')](_0x28f674[_0xced3('0x1b')],function(_0x340be1){return{'model':db[_0x340be1[_0xced3('0x1d')]],'as':_0x340be1['as'],'attributes':_0x340be1[_0xced3('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x342c11){logger[_0xced3('0xb')]('ShowTrigger',_0x116cc7);logger[_0xced3('0xe')](_0xced3('0x20'),_0x116cc7,JSON[_0xced3('0xf')](_0x342c11));_0xa78899(_0x342c11);})['catch'](function(_0x59c3aa){logger[_0xced3('0x10')]('ShowTrigger',_0x59c3aa[_0xced3('0x12')],_0x116cc7);_0x1b8baa(_0x559b8e[_0xced3('0x10')](0x1f4,_0x59c3aa['message']));});});}; \ No newline at end of file +var _0x5eb8=['where','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','Trigger,\x20%s,\x20%s','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','error','message','catch','Trigger','findAll','options','raw','limit','include','model','attributes','map','then','GetTrigger','stringify','ShowTrigger'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x5eb8,0xb0));var _0x85eb=function(_0x4d7a70,_0x2d3bfa){_0x4d7a70=_0x4d7a70-0x0;var _0x3aafbb=_0x5eb8[_0x4d7a70];return _0x3aafbb;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x85eb('0x0'));var BPromise=require(_0x85eb('0x1'));var rs=require(_0x85eb('0x2'));var fs=require('fs');var Redis=require(_0x85eb('0x3'));var db=require(_0x85eb('0x4'))['db'];var utils=require(_0x85eb('0x5'));var logger=require(_0x85eb('0x6'))(_0x85eb('0x7'));var config=require(_0x85eb('0x8'));var jayson=require(_0x85eb('0x9'));var client=jayson[_0x85eb('0xa')][_0x85eb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4a8814,_0x16d7b9,_0x3af658){return new BPromise(function(_0x448345,_0x5cd4ec){return client[_0x85eb('0xc')](_0x4a8814,_0x3af658)['then'](function(_0x1f0036){logger[_0x85eb('0xd')](_0x85eb('0xe'),_0x16d7b9,_0x85eb('0xf'));logger[_0x85eb('0x10')](_0x85eb('0x11'),_0x16d7b9,_0x85eb('0xf'),JSON['stringify'](_0x1f0036));if(_0x1f0036[_0x85eb('0x12')]){if(_0x1f0036[_0x85eb('0x12')]['code']===0x1f4){logger[_0x85eb('0x12')](_0x85eb('0xe'),_0x16d7b9,_0x1f0036[_0x85eb('0x12')][_0x85eb('0x13')]);return _0x5cd4ec(_0x1f0036['error']['message']);}logger[_0x85eb('0x12')]('Trigger,\x20%s,\x20%s',_0x16d7b9,_0x1f0036[_0x85eb('0x12')][_0x85eb('0x13')]);return _0x448345(_0x1f0036[_0x85eb('0x12')][_0x85eb('0x13')]);}else{logger[_0x85eb('0xd')]('Trigger,\x20%s,\x20%s',_0x16d7b9,_0x85eb('0xf'));_0x448345(_0x1f0036['result'][_0x85eb('0x13')]);}})[_0x85eb('0x14')](function(_0x3e23e8){logger[_0x85eb('0x12')]('Trigger,\x20%s,\x20%s',_0x16d7b9,_0x3e23e8);_0x5cd4ec(_0x3e23e8);});});}exports['GetTrigger']=function(_0x50d2a8){var _0xe198ca=this;return new Promise(function(_0x39ca96,_0x10cf2f){return db[_0x85eb('0x15')][_0x85eb('0x16')]({'raw':_0x50d2a8[_0x85eb('0x17')]?_0x50d2a8['options'][_0x85eb('0x18')]===undefined?!![]:![]:!![],'where':_0x50d2a8[_0x85eb('0x17')]?_0x50d2a8[_0x85eb('0x17')]['where']||null:null,'attributes':_0x50d2a8['options']?_0x50d2a8['options']['attributes']||null:null,'limit':_0x50d2a8[_0x85eb('0x17')]?_0x50d2a8[_0x85eb('0x17')][_0x85eb('0x19')]||null:null,'include':_0x50d2a8[_0x85eb('0x17')]?_0x50d2a8[_0x85eb('0x17')][_0x85eb('0x1a')]?_['map'](_0x50d2a8['options']['include'],function(_0x298e84){return{'model':db[_0x298e84[_0x85eb('0x1b')]],'as':_0x298e84['as'],'attributes':_0x298e84[_0x85eb('0x1c')],'include':_0x298e84[_0x85eb('0x1a')]?_[_0x85eb('0x1d')](_0x298e84[_0x85eb('0x1a')],function(_0x5dfc96){return{'model':db[_0x5dfc96[_0x85eb('0x1b')]],'as':_0x5dfc96['as'],'attributes':_0x5dfc96[_0x85eb('0x1c')],'include':_0x5dfc96[_0x85eb('0x1a')]?_[_0x85eb('0x1d')](_0x5dfc96[_0x85eb('0x1a')],function(_0x57a03c){return{'model':db[_0x57a03c[_0x85eb('0x1b')]],'as':_0x57a03c['as'],'attributes':_0x57a03c[_0x85eb('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x85eb('0x1e')](function(_0x3e7eb9){logger[_0x85eb('0xd')](_0x85eb('0x1f'),_0x50d2a8);logger['debug']('GetTrigger',_0x50d2a8,JSON[_0x85eb('0x20')](_0x3e7eb9));_0x39ca96(_0x3e7eb9);})['catch'](function(_0xa9b14f){logger['error'](_0x85eb('0x1f'),_0xa9b14f[_0x85eb('0x13')],_0x50d2a8);_0x10cf2f(_0xe198ca[_0x85eb('0x12')](0x1f4,_0xa9b14f[_0x85eb('0x13')]));});});};exports[_0x85eb('0x21')]=function(_0xf4ac13){var _0x41ed76=this;return new Promise(function(_0x5decd5,_0x237f19){return db[_0x85eb('0x15')]['find']({'raw':_0xf4ac13[_0x85eb('0x17')]?_0xf4ac13['options']['raw']===undefined?!![]:![]:!![],'where':_0xf4ac13[_0x85eb('0x17')]?_0xf4ac13[_0x85eb('0x17')][_0x85eb('0x22')]||null:null,'attributes':_0xf4ac13[_0x85eb('0x17')]?_0xf4ac13[_0x85eb('0x17')][_0x85eb('0x1c')]||null:null,'include':_0xf4ac13[_0x85eb('0x17')]?_0xf4ac13[_0x85eb('0x17')][_0x85eb('0x1a')]?_[_0x85eb('0x1d')](_0xf4ac13['options'][_0x85eb('0x1a')],function(_0x3a5b87){return{'model':db[_0x3a5b87['model']],'as':_0x3a5b87['as'],'attributes':_0x3a5b87['attributes'],'include':_0x3a5b87[_0x85eb('0x1a')]?_[_0x85eb('0x1d')](_0x3a5b87[_0x85eb('0x1a')],function(_0x12cb4c){return{'model':db[_0x12cb4c[_0x85eb('0x1b')]],'as':_0x12cb4c['as'],'attributes':_0x12cb4c[_0x85eb('0x1c')],'include':_0x12cb4c[_0x85eb('0x1a')]?_[_0x85eb('0x1d')](_0x12cb4c[_0x85eb('0x1a')],function(_0x373e5f){return{'model':db[_0x373e5f[_0x85eb('0x1b')]],'as':_0x373e5f['as'],'attributes':_0x373e5f[_0x85eb('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x85eb('0x1e')](function(_0x33605a){logger['info'](_0x85eb('0x21'),_0xf4ac13);logger[_0x85eb('0x10')]('ShowTrigger',_0xf4ac13,JSON['stringify'](_0x33605a));_0x5decd5(_0x33605a);})[_0x85eb('0x14')](function(_0xe22d16){logger['error'](_0x85eb('0x21'),_0xe22d16['message'],_0xf4ac13);_0x237f19(_0x41ed76[_0x85eb('0x12')](0x1f4,_0xe22d16['message']));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 22b1690..f752daa 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 _0x99e9=['util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','post','/:id/clone','clone','create','put','update','delete','destroy','exports'];(function(_0x4afbee,_0x43d67a){var _0x12b129=function(_0x5da57b){while(--_0x5da57b){_0x4afbee['push'](_0x4afbee['shift']());}};_0x12b129(++_0x43d67a);}(_0x99e9,0xb4));var _0x999e=function(_0x9a3d47,_0x1953a0){_0x9a3d47=_0x9a3d47-0x0;var _0xf60b78=_0x99e9[_0x9a3d47];return _0xf60b78;};'use strict';var multer=require('multer');var util=require(_0x999e('0x0'));var path=require(_0x999e('0x1'));var timeout=require(_0x999e('0x2'));var express=require(_0x999e('0x3'));var router=express['Router']();var auth=require(_0x999e('0x4'));var interaction=require(_0x999e('0x5'));var config=require(_0x999e('0x6'));var controller=require('./trunk.controller');router[_0x999e('0x7')]('/',auth['isAuthenticated'](),controller[_0x999e('0x8')]);router[_0x999e('0x7')](_0x999e('0x9'),auth[_0x999e('0xa')](),controller['show']);router[_0x999e('0xb')](_0x999e('0xc'),auth[_0x999e('0xa')](),controller[_0x999e('0xd')]);router[_0x999e('0xb')]('/',auth[_0x999e('0xa')](),controller[_0x999e('0xe')]);router[_0x999e('0xf')](_0x999e('0x9'),auth[_0x999e('0xa')](),controller[_0x999e('0x10')]);router[_0x999e('0x11')](_0x999e('0x9'),auth[_0x999e('0xa')](),controller[_0x999e('0x12')]);module[_0x999e('0x13')]=router; \ No newline at end of file +var _0xb903=['path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./trunk.controller','get','isAuthenticated','show','post','/:id/clone','update','/:id','exports','multer','util'];(function(_0x4ba525,_0x17b993){var _0x3446cb=function(_0x7a5fcb){while(--_0x7a5fcb){_0x4ba525['push'](_0x4ba525['shift']());}};_0x3446cb(++_0x17b993);}(_0xb903,0x185));var _0x3b90=function(_0x17adcb,_0x2062a0){_0x17adcb=_0x17adcb-0x0;var _0x41a1c0=_0xb903[_0x17adcb];return _0x41a1c0;};'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('0xc')](_0x3b90('0xd'),auth[_0x3b90('0xa')](),controller['clone']);router['post']('/',auth['isAuthenticated'](),controller['create']);router['put']('/:id',auth[_0x3b90('0xa')](),controller[_0x3b90('0xe')]);router['delete'](_0x3b90('0xf'),auth[_0x3b90('0xa')](),controller['destroy']);module[_0x3b90('0x10')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index b72a6fb..59255db 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 _0x17a6=['String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','shortinfo','nonat','update','outgoing','yes','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','allow','join','ulaw;alaw;gsm','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','\x22\x22\x20<>','always','refuse','originate','uac','pai','fingerprint','certificate','active','actpass','dynamic','BOOLEAN','exports','name','friend','user','peer','from-voip-provider','ENUM','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_FAILED_SCREEN','PROHIB','STRING','setDataValue','getDataValue','transport','split'];(function(_0xa0154a,_0x4721fb){var _0x3bd19d=function(_0x321d84){while(--_0x321d84){_0xa0154a['push'](_0xa0154a['shift']());}};_0x3bd19d(++_0x4721fb);}(_0x17a6,0x10e));var _0x617a=function(_0x305ba9,_0x5f4917){_0x305ba9=_0x305ba9-0x0;var _0x2672c4=_0x17a6[_0x305ba9];return _0x2672c4;};'use strict';var Sequelize=require('sequelize');module[_0x617a('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x617a('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0x617a('0x2'),_0x617a('0x3'),_0x617a('0x4')),'allowNull':![],'defaultValue':_0x617a('0x2')},'context':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x617a('0x5')},'callingpres':{'type':Sequelize[_0x617a('0x6')]('ALLOWED_NOT_SCREENED',_0x617a('0x7'),_0x617a('0x8'),_0x617a('0x9'),_0x617a('0xa'),'PROHIB_PASSED_SCREEN',_0x617a('0xb'),_0x617a('0xc'))},'deny':{'type':Sequelize[_0x617a('0xd')]},'permit':{'type':Sequelize[_0x617a('0xd')]},'secret':{'type':Sequelize[_0x617a('0xd')]},'md5secret':{'type':Sequelize[_0x617a('0xd')]},'remotesecret':{'type':Sequelize[_0x617a('0xd')]},'transport':{'type':Sequelize['STRING'],'defaultValue':'udp','set':function(_0x3706a9){this[_0x617a('0xe')]('transport',_0x3706a9?_0x3706a9['join'](','):null);},'get':function(){return this[_0x617a('0xf')]('transport')?this[_0x617a('0xf')](_0x617a('0x10'))[_0x617a('0x11')](','):null;},'comment':_0x617a('0x12')},'dtmfmode':{'type':Sequelize['ENUM'](_0x617a('0x13'),'info',_0x617a('0x14'),'inband','auto'),'defaultValue':_0x617a('0x13')},'directmedia':{'type':Sequelize[_0x617a('0x6')]('yes','no',_0x617a('0x15'),_0x617a('0x16'),_0x617a('0x17')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x617a('0x6')](_0x617a('0x18'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x617a('0xd')]},'directmediadeny':{'type':Sequelize['STRING']},'nat':{'type':Sequelize['STRING'],'defaultValue':'force_rport,comedia','set':function(_0x57a7b2){this['setDataValue'](_0x617a('0x19'),_0x57a7b2?_0x57a7b2['join'](','):null);},'get':function(){return this[_0x617a('0xf')](_0x617a('0x19'))?this['getDataValue']('nat')['split'](','):null;},'comment':_0x617a('0x1a')},'callgroup':{'type':Sequelize[_0x617a('0xd')]},'namedcallgroup':{'type':Sequelize[_0x617a('0xd')]},'pickupgroup':{'type':Sequelize[_0x617a('0xd')]},'namedpickupgroup':{'type':Sequelize[_0x617a('0xd')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x617a('0xd')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x617a('0xd')],'defaultValue':_0x617a('0x1b')},'allow':{'type':Sequelize[_0x617a('0xd')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x8cc590){this[_0x617a('0xe')](_0x617a('0x1c'),_0x8cc590?_0x8cc590[_0x617a('0x1d')](';'):_0x617a('0x1e'));},'get':function(){return this[_0x617a('0xf')]('allow')?this[_0x617a('0xf')](_0x617a('0x1c'))[_0x617a('0x11')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]'},'autoframing':{'type':Sequelize[_0x617a('0x6')](_0x617a('0x18'),'no')},'insecure':{'type':Sequelize[_0x617a('0xd')],'defaultValue':_0x617a('0x1f'),'set':function(_0x12a113){this[_0x617a('0xe')]('insecure',_0x12a113?_0x12a113[_0x617a('0x1d')](','):null);},'get':function(){return this[_0x617a('0xf')](_0x617a('0x20'))?this[_0x617a('0xf')](_0x617a('0x20'))['split'](','):null;},'comment':_0x617a('0x21')},'trustrpid':{'type':Sequelize[_0x617a('0x6')](_0x617a('0x18'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x617a('0x6')](_0x617a('0x18'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM'](_0x617a('0x18'),'no',_0x617a('0x22'))},'promiscredir':{'type':Sequelize[_0x617a('0x6')]('yes','no')},'useclientcode':{'type':Sequelize[_0x617a('0x6')](_0x617a('0x18'),'no')},'accountcode':{'type':Sequelize[_0x617a('0x23')](0xb)},'setvar':{'type':Sequelize[_0x617a('0xd')]},'callerid':{'type':Sequelize[_0x617a('0xd')],'defaultValue':_0x617a('0x24')},'amaflags':{'type':Sequelize[_0x617a('0xd')]},'callcounter':{'type':Sequelize[_0x617a('0x6')]('yes','no'),'defaultValue':_0x617a('0x18')},'busylevel':{'type':Sequelize[_0x617a('0x23')](0xb)},'allowoverlap':{'type':Sequelize[_0x617a('0x6')]('yes','no')},'allowsubscribe':{'type':Sequelize[_0x617a('0x6')](_0x617a('0x18'),'no')},'allowtransfer':{'type':Sequelize['ENUM'](_0x617a('0x18'),'no')},'ignoresdpversion':{'type':Sequelize[_0x617a('0x6')](_0x617a('0x18'),'no')},'subscribecontext':{'type':Sequelize[_0x617a('0xd')]},'template':{'type':Sequelize[_0x617a('0xd')]},'videosupport':{'type':Sequelize[_0x617a('0x6')](_0x617a('0x18'),'no',_0x617a('0x25')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x617a('0x23')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x617a('0x6')]('yes','no')},'mailbox':{'type':Sequelize['STRING']},'session_timers':{'type':Sequelize[_0x617a('0x6')]('accept',_0x617a('0x26'),_0x617a('0x27'))},'session_expires':{'type':Sequelize['INTEGER'](0xb)},'session_minse':{'type':Sequelize[_0x617a('0x23')](0xb)},'session_refresher':{'type':Sequelize[_0x617a('0x6')](_0x617a('0x28'),'uas'),'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0x617a('0xd')]},'regexten':{'type':Sequelize[_0x617a('0xd')]},'fromdomain':{'type':Sequelize[_0x617a('0xd')]},'fromuser':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x617a('0x23')](0x5)},'qualify':{'type':Sequelize[_0x617a('0x6')](_0x617a('0x18'),'no'),'defaultValue':_0x617a('0x18')},'keepalive':{'type':Sequelize[_0x617a('0x23')](0xb)},'defaultip':{'type':Sequelize[_0x617a('0xd')]},'defaultuser':{'type':Sequelize[_0x617a('0xd')]},'rtptimeout':{'type':Sequelize[_0x617a('0x23')](0xb)},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpkeepalive':{'type':Sequelize[_0x617a('0x23')](0xb)},'sendrpid':{'type':Sequelize['ENUM'](_0x617a('0x18'),'no',_0x617a('0x29')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x617a('0xd')]},'callbackextension':{'type':Sequelize['STRING']},'timert1':{'type':Sequelize[_0x617a('0x23')](0xb)},'timerb':{'type':Sequelize['INTEGER'](0xb)},'qualifyfreq':{'type':Sequelize[_0x617a('0x23')](0xb)},'contactpermit':{'type':Sequelize[_0x617a('0xd')]},'contactdeny':{'type':Sequelize[_0x617a('0xd')]},'contactacl':{'type':Sequelize['STRING']},'unsolicited_mailbox':{'type':Sequelize['STRING']},'use_q850_reason':{'type':Sequelize[_0x617a('0xd')]},'maxforwards':{'type':Sequelize['INTEGER'](0xb)},'encryption':{'type':Sequelize[_0x617a('0x6')](_0x617a('0x18'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x617a('0x6')]('yes','no')},'force_avp':{'type':Sequelize[_0x617a('0x6')](_0x617a('0x18'),'no')},'icesupport':{'type':Sequelize[_0x617a('0x6')](_0x617a('0x18'),'no')},'dtlsenable':{'type':Sequelize[_0x617a('0x6')]('yes','no')},'dtlsverify':{'type':Sequelize[_0x617a('0x6')](_0x617a('0x18'),'no',_0x617a('0x2a'),_0x617a('0x2b'))},'dtlsrekey':{'type':Sequelize[_0x617a('0x23')](0xb)},'dtlscertfile':{'type':Sequelize[_0x617a('0xd')]},'dtlsprivatekey':{'type':Sequelize[_0x617a('0xd')]},'dtlscipher':{'type':Sequelize[_0x617a('0xd')]},'dtlscafile':{'type':Sequelize[_0x617a('0xd')]},'dtlscapath':{'type':Sequelize[_0x617a('0xd')]},'dtlssetup':{'type':Sequelize[_0x617a('0x6')](_0x617a('0x2c'),'passive',_0x617a('0x2d')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING']},'usereqphone':{'type':Sequelize[_0x617a('0x6')](_0x617a('0x18'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING']},'recordofffeature':{'type':Sequelize[_0x617a('0xd')]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize['ENUM'](_0x617a('0x18'),'no')},'subscribemwi':{'type':Sequelize['ENUM'](_0x617a('0x18'),'no')},'vmexten':{'type':Sequelize[_0x617a('0xd')]},'mohinterpret':{'type':Sequelize['STRING']},'mohsuggest':{'type':Sequelize[_0x617a('0xd')]},'parkinglot':{'type':Sequelize[_0x617a('0xd')]},'description':{'type':Sequelize[_0x617a('0xd')]},'host':{'type':Sequelize['STRING'],'defaultValue':_0x617a('0x2e')},'canreinvite':{'type':Sequelize[_0x617a('0x6')]('yes','no',_0x617a('0x15'),_0x617a('0x16'),'update,nonat'),'defaultValue':'no'},'registry':{'type':Sequelize[_0x617a('0xd')]},'otherFields':{'type':Sequelize[_0x617a('0xd')]},'active':{'type':Sequelize[_0x617a('0x2f')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize['STRING'],'defaultValue':'no'}}; \ No newline at end of file +var _0xfc6d=['yes','nonat','update','outgoing','force_rport,comedia','setDataValue','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','INTEGER','\x22\x22\x20<>','always','accept','originate','uac','uas','pai','fingerprint','certificate','active','passive','dynamic','update,nonat','BOOLEAN','sequelize','exports','STRING','ENUM','user','friend','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_FAILED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','udp','join','transport','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','shortinfo','inband'];(function(_0x1e8237,_0x25bd73){var _0x246e1c=function(_0x36afd6){while(--_0x36afd6){_0x1e8237['push'](_0x1e8237['shift']());}};_0x246e1c(++_0x25bd73);}(_0xfc6d,0x81));var _0xdfc6=function(_0x445111,_0x47e657){_0x445111=_0x445111-0x0;var _0x2ca888=_0xfc6d[_0x445111];return _0x2ca888;};'use strict';var Sequelize=require(_0xdfc6('0x0'));module[_0xdfc6('0x1')]={'name':{'type':Sequelize[_0xdfc6('0x2')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xdfc6('0x3')]('friend',_0xdfc6('0x4'),'peer'),'allowNull':![],'defaultValue':_0xdfc6('0x5')},'context':{'type':Sequelize[_0xdfc6('0x2')],'allowNull':![],'defaultValue':_0xdfc6('0x6')},'callingpres':{'type':Sequelize['ENUM'](_0xdfc6('0x7'),'ALLOWED_PASSED_SCREEN',_0xdfc6('0x8'),'ALLOWED',_0xdfc6('0x9'),_0xdfc6('0xa'),_0xdfc6('0xb'),'PROHIB')},'deny':{'type':Sequelize[_0xdfc6('0x2')]},'permit':{'type':Sequelize[_0xdfc6('0x2')]},'secret':{'type':Sequelize[_0xdfc6('0x2')]},'md5secret':{'type':Sequelize[_0xdfc6('0x2')]},'remotesecret':{'type':Sequelize['STRING']},'transport':{'type':Sequelize[_0xdfc6('0x2')],'defaultValue':_0xdfc6('0xc'),'set':function(_0x43879e){this['setDataValue']('transport',_0x43879e?_0x43879e[_0xdfc6('0xd')](','):null);},'get':function(){return this['getDataValue'](_0xdfc6('0xe'))?this[_0xdfc6('0xf')](_0xdfc6('0xe'))[_0xdfc6('0x10')](','):null;},'comment':_0xdfc6('0x11')},'dtmfmode':{'type':Sequelize[_0xdfc6('0x3')](_0xdfc6('0x12'),'info',_0xdfc6('0x13'),_0xdfc6('0x14'),'auto'),'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0xdfc6('0x3')](_0xdfc6('0x15'),'no',_0xdfc6('0x16'),_0xdfc6('0x17'),_0xdfc6('0x18')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xdfc6('0x3')](_0xdfc6('0x15'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xdfc6('0x2')]},'directmediadeny':{'type':Sequelize[_0xdfc6('0x2')]},'nat':{'type':Sequelize[_0xdfc6('0x2')],'defaultValue':_0xdfc6('0x19'),'set':function(_0x37fa1d){this[_0xdfc6('0x1a')](_0xdfc6('0x1b'),_0x37fa1d?_0x37fa1d[_0xdfc6('0xd')](','):null);},'get':function(){return this[_0xdfc6('0xf')](_0xdfc6('0x1b'))?this[_0xdfc6('0xf')]('nat')[_0xdfc6('0x10')](','):null;},'comment':_0xdfc6('0x1c')},'callgroup':{'type':Sequelize[_0xdfc6('0x2')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0xdfc6('0x2')]},'language':{'type':Sequelize[_0xdfc6('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING'],'allowNull':!![]},'disallow':{'type':Sequelize[_0xdfc6('0x2')],'defaultValue':_0xdfc6('0x1d')},'allow':{'type':Sequelize[_0xdfc6('0x2')],'allowNull':![],'defaultValue':_0xdfc6('0x1e'),'set':function(_0x344b98){this[_0xdfc6('0x1a')](_0xdfc6('0x1f'),_0x344b98?_0x344b98['join'](';'):_0xdfc6('0x1e'));},'get':function(){return this[_0xdfc6('0xf')](_0xdfc6('0x1f'))?this['getDataValue']('allow')['split'](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]'},'autoframing':{'type':Sequelize['ENUM'](_0xdfc6('0x15'),'no')},'insecure':{'type':Sequelize[_0xdfc6('0x2')],'defaultValue':_0xdfc6('0x20'),'set':function(_0x38ffde){this[_0xdfc6('0x1a')](_0xdfc6('0x21'),_0x38ffde?_0x38ffde[_0xdfc6('0xd')](','):null);},'get':function(){return this[_0xdfc6('0xf')](_0xdfc6('0x21'))?this[_0xdfc6('0xf')](_0xdfc6('0x21'))[_0xdfc6('0x10')](','):null;},'comment':_0xdfc6('0x22')},'trustrpid':{'type':Sequelize[_0xdfc6('0x3')](_0xdfc6('0x15'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xdfc6('0x3')](_0xdfc6('0x15'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xdfc6('0x3')](_0xdfc6('0x15'),'no','never')},'promiscredir':{'type':Sequelize[_0xdfc6('0x3')](_0xdfc6('0x15'),'no')},'useclientcode':{'type':Sequelize[_0xdfc6('0x3')](_0xdfc6('0x15'),'no')},'accountcode':{'type':Sequelize[_0xdfc6('0x23')](0xb)},'setvar':{'type':Sequelize[_0xdfc6('0x2')]},'callerid':{'type':Sequelize[_0xdfc6('0x2')],'defaultValue':_0xdfc6('0x24')},'amaflags':{'type':Sequelize['STRING']},'callcounter':{'type':Sequelize[_0xdfc6('0x3')]('yes','no'),'defaultValue':_0xdfc6('0x15')},'busylevel':{'type':Sequelize[_0xdfc6('0x23')](0xb)},'allowoverlap':{'type':Sequelize['ENUM'](_0xdfc6('0x15'),'no')},'allowsubscribe':{'type':Sequelize['ENUM'](_0xdfc6('0x15'),'no')},'allowtransfer':{'type':Sequelize[_0xdfc6('0x3')](_0xdfc6('0x15'),'no')},'ignoresdpversion':{'type':Sequelize[_0xdfc6('0x3')]('yes','no')},'subscribecontext':{'type':Sequelize[_0xdfc6('0x2')]},'template':{'type':Sequelize[_0xdfc6('0x2')]},'videosupport':{'type':Sequelize['ENUM']('yes','no',_0xdfc6('0x25')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xdfc6('0x23')](0xb)},'rfc2833compensate':{'type':Sequelize[_0xdfc6('0x3')](_0xdfc6('0x15'),'no')},'mailbox':{'type':Sequelize['STRING']},'session_timers':{'type':Sequelize['ENUM'](_0xdfc6('0x26'),'refuse',_0xdfc6('0x27'))},'session_expires':{'type':Sequelize['INTEGER'](0xb)},'session_minse':{'type':Sequelize[_0xdfc6('0x23')](0xb)},'session_refresher':{'type':Sequelize[_0xdfc6('0x3')](_0xdfc6('0x28'),_0xdfc6('0x29')),'defaultValue':_0xdfc6('0x29')},'t38pt_usertpsource':{'type':Sequelize[_0xdfc6('0x2')]},'regexten':{'type':Sequelize['STRING']},'fromdomain':{'type':Sequelize[_0xdfc6('0x2')]},'fromuser':{'type':Sequelize[_0xdfc6('0x2')]},'port':{'type':Sequelize[_0xdfc6('0x23')](0x5)},'qualify':{'type':Sequelize['ENUM'](_0xdfc6('0x15'),'no'),'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0xdfc6('0x23')](0xb)},'defaultip':{'type':Sequelize[_0xdfc6('0x2')]},'defaultuser':{'type':Sequelize[_0xdfc6('0x2')]},'rtptimeout':{'type':Sequelize[_0xdfc6('0x23')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0xdfc6('0x23')](0xb)},'rtpkeepalive':{'type':Sequelize[_0xdfc6('0x23')](0xb)},'sendrpid':{'type':Sequelize[_0xdfc6('0x3')](_0xdfc6('0x15'),'no',_0xdfc6('0x2a')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xdfc6('0x2')]},'callbackextension':{'type':Sequelize[_0xdfc6('0x2')]},'timert1':{'type':Sequelize[_0xdfc6('0x23')](0xb)},'timerb':{'type':Sequelize['INTEGER'](0xb)},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb)},'contactpermit':{'type':Sequelize[_0xdfc6('0x2')]},'contactdeny':{'type':Sequelize[_0xdfc6('0x2')]},'contactacl':{'type':Sequelize[_0xdfc6('0x2')]},'unsolicited_mailbox':{'type':Sequelize[_0xdfc6('0x2')]},'use_q850_reason':{'type':Sequelize[_0xdfc6('0x2')]},'maxforwards':{'type':Sequelize[_0xdfc6('0x23')](0xb)},'encryption':{'type':Sequelize[_0xdfc6('0x3')](_0xdfc6('0x15'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0xdfc6('0x3')](_0xdfc6('0x15'),'no')},'force_avp':{'type':Sequelize[_0xdfc6('0x3')](_0xdfc6('0x15'),'no')},'icesupport':{'type':Sequelize[_0xdfc6('0x3')]('yes','no')},'dtlsenable':{'type':Sequelize['ENUM'](_0xdfc6('0x15'),'no')},'dtlsverify':{'type':Sequelize['ENUM'](_0xdfc6('0x15'),'no',_0xdfc6('0x2b'),_0xdfc6('0x2c'))},'dtlsrekey':{'type':Sequelize[_0xdfc6('0x23')](0xb)},'dtlscertfile':{'type':Sequelize[_0xdfc6('0x2')]},'dtlsprivatekey':{'type':Sequelize[_0xdfc6('0x2')]},'dtlscipher':{'type':Sequelize['STRING']},'dtlscafile':{'type':Sequelize[_0xdfc6('0x2')]},'dtlscapath':{'type':Sequelize[_0xdfc6('0x2')]},'dtlssetup':{'type':Sequelize[_0xdfc6('0x3')](_0xdfc6('0x2d'),_0xdfc6('0x2e'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xdfc6('0x2')]},'usereqphone':{'type':Sequelize[_0xdfc6('0x3')](_0xdfc6('0x15'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xdfc6('0x2')]},'recordofffeature':{'type':Sequelize[_0xdfc6('0x2')]},'call_limit':{'type':Sequelize[_0xdfc6('0x23')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0xdfc6('0x3')](_0xdfc6('0x15'),'no')},'subscribemwi':{'type':Sequelize['ENUM'](_0xdfc6('0x15'),'no')},'vmexten':{'type':Sequelize['STRING']},'mohinterpret':{'type':Sequelize[_0xdfc6('0x2')]},'mohsuggest':{'type':Sequelize[_0xdfc6('0x2')]},'parkinglot':{'type':Sequelize[_0xdfc6('0x2')]},'description':{'type':Sequelize[_0xdfc6('0x2')]},'host':{'type':Sequelize['STRING'],'defaultValue':_0xdfc6('0x2f')},'canreinvite':{'type':Sequelize[_0xdfc6('0x3')](_0xdfc6('0x15'),'no','nonat',_0xdfc6('0x17'),_0xdfc6('0x30')),'defaultValue':'no'},'registry':{'type':Sequelize[_0xdfc6('0x2')]},'otherFields':{'type':Sequelize[_0xdfc6('0x2')]},'active':{'type':Sequelize[_0xdfc6('0x31')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize['STRING'],'defaultValue':'no'}}; \ No newline at end of file diff --git a/server/api/trunk/trunk.controller.js b/server/api/trunk/trunk.controller.js index 0521843..0982704 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 _0x1398=['lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','json','offset','Content-Range','apply','reject','save','update','destroy','get','UserProfileResource','stack','name','send','index','map','Trunk','rawAttributes','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','limit','order','sort','where','filter','VIRTUAL','merge','count','includeAll','include','rows','params','intersection','options','find','clone','omit','createdAt','updatedAt','body','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','findAll','readFileSync','join','root','utf8','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','UserProfileSection','Trunks','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','server/files/templates/trunk.ejs','chan_sip.so','html-pdf','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox'];(function(_0x37bfb4,_0x8893f){var _0x16a6f0=function(_0xb8542){while(--_0xb8542){_0x37bfb4['push'](_0x37bfb4['shift']());}};_0x16a6f0(++_0x8893f);}(_0x1398,0xd7));var _0x8139=function(_0x388b9c,_0x3a5398){_0x388b9c=_0x388b9c-0x0;var _0x290109=_0x1398[_0x388b9c];return _0x290109;};'use strict';var pdf=require(_0x8139('0x0'));var emlformat=require(_0x8139('0x1'));var rimraf=require(_0x8139('0x2'));var zipdir=require(_0x8139('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x8139('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x8139('0x5'));var util=require(_0x8139('0x6'));var path=require(_0x8139('0x7'));var sox=require(_0x8139('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x8139('0x9'));var squel=require('squel');var crypto=require(_0x8139('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x8139('0xb'));var toCsv=require('to-csv');var querystring=require(_0x8139('0xc'));var Papa=require(_0x8139('0xd'));var Redis=require(_0x8139('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x8139('0xf'));var as=require(_0x8139('0x10'));var hardwareService=require(_0x8139('0x11'));var logger=require(_0x8139('0x12'))(_0x8139('0x13'));var utils=require(_0x8139('0x14'));var config=require(_0x8139('0x15'));var db=require(_0x8139('0x16'))['db'];var jayson=require(_0x8139('0x17'));var client=jayson[_0x8139('0x18')][_0x8139('0x19')]({'port':0x232a});function checkPasswordPattern(_0x1525bc,_0x3017b1,_0x12c2fb){if(_0x12c2fb){var _0x40d40c=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x40d40c[_0x8139('0x1a')](_0x3017b1)){return _0x1525bc;}else{throw new db['Sequelize'][(_0x8139('0x1b'))](_0x8139('0x1c'));}}else{return _0x1525bc;}}function respondWithRpcPromise(_0x432703,_0x7a53bf,_0x5782c0,_0x4b7a2d){return new BPromise(function(_0x57f6a2,_0x54d45b){var _0xd3b4d=_0x4b7a2d||client;return _0xd3b4d[_0x8139('0x1d')](_0x432703,_0x5782c0)[_0x8139('0x1e')](function(_0x16f712){logger[_0x8139('0x1f')](_0x8139('0x20'),_0x7a53bf,_0x8139('0x21'));logger['debug']('Trunk,\x20%s,\x20%s,\x20%s',_0x7a53bf,_0x8139('0x21'),JSON[_0x8139('0x22')](_0x16f712));if(_0x16f712[_0x8139('0x23')]){if(_0x16f712[_0x8139('0x23')][_0x8139('0x24')]===0x1f4){logger[_0x8139('0x23')](_0x8139('0x20'),_0x7a53bf,_0x16f712[_0x8139('0x23')][_0x8139('0x25')]);return _0x54d45b(_0x16f712[_0x8139('0x23')][_0x8139('0x25')]);}logger[_0x8139('0x23')](_0x8139('0x20'),_0x7a53bf,_0x16f712['error']['message']);return _0x57f6a2(_0x16f712['error'][_0x8139('0x25')]);}else{logger[_0x8139('0x1f')]('Trunk,\x20%s,\x20%s',_0x7a53bf,'request\x20sent');_0x57f6a2(_0x16f712[_0x8139('0x26')][_0x8139('0x25')]);}})[_0x8139('0x27')](function(_0x3839d0){logger[_0x8139('0x23')](_0x8139('0x20'),_0x7a53bf,_0x3839d0);_0x54d45b(_0x3839d0);});});}function respondWithStatusCode(_0x51693e,_0xc220b7){_0xc220b7=_0xc220b7||0xcc;return function(_0x56f177){if(_0x56f177){return _0x51693e[_0x8139('0x28')](_0xc220b7);}return _0x51693e[_0x8139('0x29')](_0xc220b7)['end']();};}function respondWithResult(_0x34bec7,_0x1fbf4){_0x1fbf4=_0x1fbf4||0xc8;return function(_0xdcdabb){if(_0xdcdabb){return _0x34bec7[_0x8139('0x29')](_0x1fbf4)[_0x8139('0x2a')](_0xdcdabb);}};}function respondWithFilteredResult(_0x179458,_0x5a2a96){return function(_0x1564cc){if(_0x1564cc){var _0x39c8ca=_0x1564cc['count'],_0x5596f2=_0x5a2a96[_0x8139('0x2b')],_0x3cc843=_0x5a2a96['offset']+_0x5a2a96['limit'],_0x7d239c;if(_0x3cc843>=_0x39c8ca){_0x3cc843=_0x39c8ca;_0x7d239c=0xc8;}else{_0x7d239c=0xce;}_0x179458[_0x8139('0x29')](_0x7d239c);return _0x179458['set'](_0x8139('0x2c'),_0x5596f2+'-'+_0x3cc843+'/'+_0x39c8ca)[_0x8139('0x2a')](_0x1564cc);}return null;};}function patchUpdates(_0x126da0){return function(_0x5bfee1){try{jsonpatch[_0x8139('0x2d')](_0x5bfee1,_0x126da0,!![]);}catch(_0x7e73bc){return BPromise[_0x8139('0x2e')](_0x7e73bc);}return _0x5bfee1[_0x8139('0x2f')]();};}function saveUpdates(_0x5e8ef6,_0x173360){return function(_0x56619b){if(_0x56619b){return _0x56619b[_0x8139('0x30')](_0x5e8ef6)[_0x8139('0x1e')](function(_0x2f01a8){return _0x2f01a8;});}return null;};}function removeEntity(_0x874581,_0x4ecbd3){return function(_0x23d305){if(_0x23d305){return _0x23d305[_0x8139('0x31')]()[_0x8139('0x1e')](function(){var _0x58e9e9=_0x23d305[_0x8139('0x32')]({'plain':!![]});var _0x1bf8e4='Trunks';return db[_0x8139('0x33')][_0x8139('0x31')]({'where':{'type':_0x1bf8e4,'resourceId':_0x58e9e9['id']}})[_0x8139('0x1e')](function(){return _0x23d305;});})[_0x8139('0x1e')](function(){_0x874581[_0x8139('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0xc7e9ab,_0x10be26){return function(_0x3c4d8a){if(!_0x3c4d8a){_0xc7e9ab[_0x8139('0x28')](0x194);}return _0x3c4d8a;};}function handleError(_0x5ad6e3,_0xcb2fd3){_0xcb2fd3=_0xcb2fd3||0x1f4;return function(_0xc8afc6){logger[_0x8139('0x23')](_0xc8afc6[_0x8139('0x34')]);if(_0xc8afc6[_0x8139('0x35')]){delete _0xc8afc6[_0x8139('0x35')];}_0x5ad6e3['status'](_0xcb2fd3)[_0x8139('0x36')](_0xc8afc6);};}exports[_0x8139('0x37')]=function(_0x48ca07,_0x438f94){var _0x53d2a1={},_0x492a5b={},_0x1d7566={'count':0x0,'rows':[]};var _0x2ce1de=_[_0x8139('0x38')](db[_0x8139('0x39')][_0x8139('0x3a')],function(_0x514740){return{'name':_0x514740['fieldName'],'type':_0x514740[_0x8139('0x3b')][_0x8139('0x3c')]};});_0x492a5b[_0x8139('0x3d')]=_['map'](_0x2ce1de,_0x8139('0x35'));_0x492a5b[_0x8139('0x3e')]=_[_0x8139('0x3f')](_0x48ca07[_0x8139('0x3e')]);_0x492a5b[_0x8139('0x40')]=_['intersection'](_0x492a5b[_0x8139('0x3d')],_0x492a5b['query']);_0x53d2a1[_0x8139('0x41')]=_['intersection'](_0x492a5b[_0x8139('0x3d')],qs[_0x8139('0x42')](_0x48ca07[_0x8139('0x3e')][_0x8139('0x42')]));_0x53d2a1['attributes']=_0x53d2a1[_0x8139('0x41')][_0x8139('0x43')]?_0x53d2a1[_0x8139('0x41')]:_0x492a5b['model'];if(!_0x48ca07[_0x8139('0x3e')][_0x8139('0x44')]('nolimit')){_0x53d2a1[_0x8139('0x45')]=qs[_0x8139('0x45')](_0x48ca07['query']['limit']);_0x53d2a1['offset']=qs[_0x8139('0x2b')](_0x48ca07[_0x8139('0x3e')][_0x8139('0x2b')]);}_0x53d2a1[_0x8139('0x46')]=qs[_0x8139('0x47')](_0x48ca07[_0x8139('0x3e')]['sort']);_0x53d2a1[_0x8139('0x48')]=qs['filters'](_['pick'](_0x48ca07['query'],_0x492a5b[_0x8139('0x40')]));if(_0x48ca07[_0x8139('0x3e')][_0x8139('0x49')]){_0x53d2a1['where']=_['merge'](_0x53d2a1[_0x8139('0x48')],{'$or':_[_0x8139('0x38')](_0x2ce1de,function(_0x5b8c84){if(_0x5b8c84[_0x8139('0x3b')]!==_0x8139('0x4a')){var _0x27173d={};_0x27173d[_0x5b8c84[_0x8139('0x35')]]={'$like':'%'+_0x48ca07[_0x8139('0x3e')][_0x8139('0x49')]+'%'};return _0x27173d;}})});}_0x53d2a1=_[_0x8139('0x4b')]({},_0x53d2a1,_0x48ca07['options']);var _0x49449c={'where':_0x53d2a1[_0x8139('0x48')]};return db[_0x8139('0x39')][_0x8139('0x4c')](_0x49449c)[_0x8139('0x1e')](function(_0x3e34a8){_0x1d7566[_0x8139('0x4c')]=_0x3e34a8;if(_0x48ca07[_0x8139('0x3e')][_0x8139('0x4d')]){_0x53d2a1[_0x8139('0x4e')]=[{'all':!![]}];}return db[_0x8139('0x39')]['findAll'](_0x53d2a1);})[_0x8139('0x1e')](function(_0x6db125){_0x1d7566[_0x8139('0x4f')]=_0x6db125;return _0x1d7566;})[_0x8139('0x1e')](respondWithFilteredResult(_0x438f94,_0x53d2a1))[_0x8139('0x27')](handleError(_0x438f94,null));};exports['show']=function(_0x46de6a,_0x29f43a){var _0x44f8b7={'raw':![],'where':{'id':_0x46de6a[_0x8139('0x50')]['id']}},_0x12bed0={};_0x12bed0[_0x8139('0x3d')]=_[_0x8139('0x3f')](db[_0x8139('0x39')]['rawAttributes']);_0x12bed0[_0x8139('0x3e')]=_[_0x8139('0x3f')](_0x46de6a[_0x8139('0x3e')]);_0x12bed0['filters']=_[_0x8139('0x51')](_0x12bed0[_0x8139('0x3d')],_0x12bed0['query']);_0x44f8b7[_0x8139('0x41')]=_[_0x8139('0x51')](_0x12bed0[_0x8139('0x3d')],qs[_0x8139('0x42')](_0x46de6a['query'][_0x8139('0x42')]));_0x44f8b7[_0x8139('0x41')]=_0x44f8b7['attributes'][_0x8139('0x43')]?_0x44f8b7[_0x8139('0x41')]:_0x12bed0[_0x8139('0x3d')];if(_0x46de6a[_0x8139('0x3e')][_0x8139('0x4d')]){_0x44f8b7['include']=[{'all':!![]}];}_0x44f8b7=_[_0x8139('0x4b')]({},_0x44f8b7,_0x46de6a[_0x8139('0x52')]);return db[_0x8139('0x39')][_0x8139('0x53')](_0x44f8b7)[_0x8139('0x1e')](handleEntityNotFound(_0x29f43a,null))['then'](respondWithResult(_0x29f43a,null))[_0x8139('0x27')](handleError(_0x29f43a,null));};exports[_0x8139('0x54')]=function(_0x568694,_0x302751){var _0x516cd9={'where':{'id':_0x568694[_0x8139('0x50')]['id']}},_0x387bd1={};_0x387bd1[_0x8139('0x3d')]=_[_0x8139('0x3f')](db[_0x8139('0x39')][_0x8139('0x3a')]);_0x516cd9[_0x8139('0x41')]=_[_0x8139('0x51')](_0x387bd1[_0x8139('0x3d')],qs['fields'](_0x568694[_0x8139('0x3e')]['fields']));_0x516cd9[_0x8139('0x41')]=_0x516cd9[_0x8139('0x41')][_0x8139('0x43')]?_0x516cd9[_0x8139('0x41')]:_0x387bd1['model'];if(_0x568694[_0x8139('0x3e')][_0x8139('0x4d')]){_0x516cd9[_0x8139('0x4e')]=[{'all':!![]}];}_0x516cd9=_['merge']({},_0x516cd9,_0x568694[_0x8139('0x52')]);return db[_0x8139('0x39')][_0x8139('0x53')](_0x516cd9)[_0x8139('0x1e')](handleEntityNotFound(_0x302751,null))['then'](function(_0x50b666){if(_0x50b666){var _0x2e743d=_0x50b666[_0x8139('0x32')]({'plain':!![]});_0x2e743d=qs[_0x8139('0x55')](_0x2e743d,['id',_0x8139('0x56'),_0x8139('0x57')]);_0x568694[_0x8139('0x58')]=_[_0x8139('0x55')](_0x568694[_0x8139('0x58')],['id',_0x8139('0x56'),_0x8139('0x57')]);return db[_0x8139('0x39')][_0x8139('0x59')](_[_0x8139('0x4b')](_0x2e743d,_0x568694[_0x8139('0x58')]),{'include':_0x568694['query'][_0x8139('0x4d')]?[{'all':!![]}]:undefined})[_0x8139('0x1e')](function(_0x50978a){var _0x8efd65=_0x568694[_0x8139('0x5a')][_0x8139('0x32')]({'plain':!![]});if(!_0x8efd65)throw new Error(_0x8139('0x5b'));if(_0x8efd65[_0x8139('0x5c')]===_0x8139('0x5a')){var _0x8b46c3=_0x50978a[_0x8139('0x32')]({'plain':!![]});var _0x1f146a='Trunks';return db['UserProfileSection']['find']({'where':{'name':_0x1f146a,'userProfileId':_0x8efd65[_0x8139('0x5d')]},'raw':!![]})['then'](function(_0x1a073e){if(_0x1a073e&&_0x1a073e['autoAssociation']===0x0){return db['UserProfileResource'][_0x8139('0x59')]({'name':_0x8b46c3[_0x8139('0x35')],'resourceId':_0x8b46c3['id'],'type':_0x1a073e['name'],'sectionId':_0x1a073e['id']},{})[_0x8139('0x1e')](function(){return _0x50978a;});}else{return _0x50978a;}})[_0x8139('0x27')](function(_0x43564d){logger[_0x8139('0x23')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x43564d);throw _0x43564d;});}return _0x50978a;});}})[_0x8139('0x1e')](respondWithResult(_0x302751,0xc9))[_0x8139('0x27')](handleError(_0x302751,null));};exports[_0x8139('0x59')]=function(_0x3dfd1f,_0x41d86c,_0x5a534c){var _0x55b674;return db[_0x8139('0x39')][_0x8139('0x59')](_0x3dfd1f[_0x8139('0x58')],{'raw':!![]})[_0x8139('0x1e')](function(_0x4b4c75){_0x55b674=_0x4b4c75;return db['Trunk'][_0x8139('0x5e')]({'raw':!![]});})[_0x8139('0x1e')](function(_0x1208ea){var _0x543704=fs[_0x8139('0x5f')](path[_0x8139('0x60')](config[_0x8139('0x61')],'server/files/templates/trunk.ejs'),_0x8139('0x62'));var _0x3a352e=fs[_0x8139('0x5f')](path[_0x8139('0x60')](config[_0x8139('0x61')],_0x8139('0x63')),_0x8139('0x62'));var _0x531d43=ejs[_0x8139('0x64')](_0x543704,{'trunks':_0x1208ea||[]});fs[_0x8139('0x65')](_0x8139('0x66'),_0x531d43);if(_0x55b674[_0x8139('0x67')]){var _0x1600fb=ejs['render'](_0x3a352e,{'trunks':_0x1208ea||[]});fs['writeFileSync'](_0x8139('0x68'),_0x1600fb);}})[_0x8139('0x1e')](function(){return respondWithRpcPromise(_0x8139('0x69'),_0x8139('0x59'),{'module':'chan_sip.so'});})[_0x8139('0x1e')](function(){var _0x54781e=_0x3dfd1f['user'][_0x8139('0x32')]({'plain':!![]});if(!_0x54781e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x54781e[_0x8139('0x5c')]===_0x8139('0x5a')){var _0xd7372c=_0x55b674[_0x8139('0x32')]({'plain':!![]});return db[_0x8139('0x6a')][_0x8139('0x53')]({'where':{'name':_0x8139('0x6b'),'userProfileId':_0x54781e[_0x8139('0x5d')]},'raw':!![]})[_0x8139('0x1e')](function(_0x56dea4){if(_0x56dea4&&_0x56dea4[_0x8139('0x6c')]===0x0){return db[_0x8139('0x33')]['create']({'name':_0xd7372c[_0x8139('0x35')],'resourceId':_0xd7372c['id'],'type':_0x56dea4[_0x8139('0x35')],'sectionId':_0x56dea4['id']},{})['then'](function(){return _0x55b674;});}else{return _0x55b674;}})[_0x8139('0x27')](function(_0x1f05b0){logger[_0x8139('0x23')](_0x8139('0x6d'),_0x1f05b0);throw _0x1f05b0;});}return _0x55b674;})[_0x8139('0x1e')](respondWithResult(_0x41d86c,0xc9))[_0x8139('0x27')](handleError(_0x41d86c,null));};exports['update']=function(_0x4ef01e,_0x558a13,_0x15c991){var _0x49e452;return db[_0x8139('0x39')][_0x8139('0x53')]({'where':{'id':_0x4ef01e[_0x8139('0x50')]['id']}})['then'](handleEntityNotFound(_0x558a13,null))[_0x8139('0x1e')](saveUpdates(_0x4ef01e[_0x8139('0x58')],null))[_0x8139('0x1e')](function(_0x1c909a){if(_0x1c909a){_0x49e452=_0x1c909a;return db[_0x8139('0x39')][_0x8139('0x5e')]({'raw':!![]});}})[_0x8139('0x1e')](function(_0x184637){if(_0x184637){var _0xab5af7=fs[_0x8139('0x5f')](path['join'](config['root'],_0x8139('0x6e')),_0x8139('0x62'));var _0x56793c=fs[_0x8139('0x5f')](path['join'](config['root'],_0x8139('0x63')),_0x8139('0x62'));var _0x128b8a=ejs['render'](_0xab5af7,{'trunks':_0x184637||[]});fs[_0x8139('0x65')]('/etc/asterisk/sip_xcally_trunks.conf',_0x128b8a);var _0x4bc5b4=ejs[_0x8139('0x64')](_0x56793c,{'trunks':_0x184637||[]});fs['writeFileSync'](_0x8139('0x68'),_0x4bc5b4);return respondWithRpcPromise('Reload',_0x8139('0x30'),{'module':'chan_sip.so'});}return null;})[_0x8139('0x1e')](function(_0x4f3bea){if(_0x4f3bea){return _0x49e452;}})[_0x8139('0x1e')](respondWithResult(_0x558a13,null))[_0x8139('0x27')](handleError(_0x558a13,null));};exports['destroy']=function(_0xc0215f,_0x3f37d1,_0x501014){var _0x3b878f;return db[_0x8139('0x39')][_0x8139('0x53')]({'where':{'id':_0xc0215f[_0x8139('0x50')]['id']}})[_0x8139('0x1e')](handleEntityNotFound(_0x3f37d1,null))[_0x8139('0x1e')](removeEntity(_0x3f37d1,null))[_0x8139('0x1e')](function(){return db['Trunk'][_0x8139('0x5e')]({'raw':!![]});})[_0x8139('0x1e')](function(_0x3aea7c){var _0x3d304d=fs[_0x8139('0x5f')](path[_0x8139('0x60')](config[_0x8139('0x61')],_0x8139('0x6e')),_0x8139('0x62'));var _0x5d8985=fs[_0x8139('0x5f')](path[_0x8139('0x60')](config[_0x8139('0x61')],_0x8139('0x63')),'utf8');var _0x40b325=ejs[_0x8139('0x64')](_0x3d304d,{'trunks':_0x3aea7c});var _0x2a99c7=ejs['render'](_0x5d8985,{'trunks':_0x3aea7c});fs['writeFileSync']('/etc/asterisk/sip_xcally_trunks.conf',_0x40b325);fs['writeFileSync'](_0x8139('0x68'),_0x2a99c7);return respondWithRpcPromise(_0x8139('0x69'),_0x8139('0x31'),{'module':_0x8139('0x6f')});})[_0x8139('0x27')](handleError(_0x3f37d1,null));}; \ No newline at end of file +var _0x2cb7=['path','to-csv','ejs','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','http','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','end','count','offset','limit','Content-Range','json','reject','save','destroy','stack','name','send','index','map','Trunk','rawAttributes','type','key','keys','filters','intersection','model','query','attributes','fields','length','hasOwnProperty','order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','show','find','params','omit','createdAt','updatedAt','body','create','user','get','Trunks','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','root','join','server/files/templates/registry.ejs','render','writeFileSync','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','update','utf8','/etc/asterisk/sip_xcally_trunks.conf','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x2cb7,0x64));var _0x72cb=function(_0x336264,_0x32e1d9){_0x336264=_0x336264-0x0;var _0x53cf91=_0x2cb7[_0x336264];return _0x53cf91;};'use strict';var pdf=require(_0x72cb('0x0'));var emlformat=require(_0x72cb('0x1'));var rimraf=require(_0x72cb('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x72cb('0x3'));var rp=require(_0x72cb('0x4'));var moment=require(_0x72cb('0x5'));var BPromise=require(_0x72cb('0x6'));var Mustache=require(_0x72cb('0x7'));var util=require(_0x72cb('0x8'));var path=require(_0x72cb('0x9'));var sox=require('sox');var csv=require(_0x72cb('0xa'));var ejs=require(_0x72cb('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x72cb('0xc'));var crypto=require(_0x72cb('0xd'));var jsforce=require(_0x72cb('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x72cb('0xa'));var querystring=require(_0x72cb('0xf'));var Papa=require('papaparse');var Redis=require(_0x72cb('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x72cb('0x11'));var hardwareService=require(_0x72cb('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x72cb('0x13'));var config=require(_0x72cb('0x14'));var db=require(_0x72cb('0x15'))['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0x72cb('0x16')]({'port':0x232a});function checkPasswordPattern(_0x1f83d6,_0x20a717,_0x525c73){if(_0x525c73){var _0x98f1e7=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x98f1e7[_0x72cb('0x17')](_0x20a717)){return _0x1f83d6;}else{throw new db['Sequelize'][(_0x72cb('0x18'))](_0x72cb('0x19'));}}else{return _0x1f83d6;}}function respondWithRpcPromise(_0x2e99d4,_0x24d101,_0x5420ca,_0x443d46){return new BPromise(function(_0x4b97e1,_0xd36315){var _0x4e5400=_0x443d46||client;return _0x4e5400[_0x72cb('0x1a')](_0x2e99d4,_0x5420ca)[_0x72cb('0x1b')](function(_0x4417d1){logger[_0x72cb('0x1c')](_0x72cb('0x1d'),_0x24d101,_0x72cb('0x1e'));logger['debug'](_0x72cb('0x1f'),_0x24d101,_0x72cb('0x1e'),JSON[_0x72cb('0x20')](_0x4417d1));if(_0x4417d1[_0x72cb('0x21')]){if(_0x4417d1[_0x72cb('0x21')]['code']===0x1f4){logger['error']('Trunk,\x20%s,\x20%s',_0x24d101,_0x4417d1[_0x72cb('0x21')][_0x72cb('0x22')]);return _0xd36315(_0x4417d1[_0x72cb('0x21')][_0x72cb('0x22')]);}logger[_0x72cb('0x21')](_0x72cb('0x1d'),_0x24d101,_0x4417d1[_0x72cb('0x21')][_0x72cb('0x22')]);return _0x4b97e1(_0x4417d1[_0x72cb('0x21')]['message']);}else{logger[_0x72cb('0x1c')](_0x72cb('0x1d'),_0x24d101,_0x72cb('0x1e'));_0x4b97e1(_0x4417d1[_0x72cb('0x23')][_0x72cb('0x22')]);}})[_0x72cb('0x24')](function(_0x139510){logger[_0x72cb('0x21')](_0x72cb('0x1d'),_0x24d101,_0x139510);_0xd36315(_0x139510);});});}function respondWithStatusCode(_0x5ad761,_0x3b162c){_0x3b162c=_0x3b162c||0xcc;return function(_0x435620){if(_0x435620){return _0x5ad761[_0x72cb('0x25')](_0x3b162c);}return _0x5ad761[_0x72cb('0x26')](_0x3b162c)[_0x72cb('0x27')]();};}function respondWithResult(_0x136514,_0x346c9d){_0x346c9d=_0x346c9d||0xc8;return function(_0x125021){if(_0x125021){return _0x136514['status'](_0x346c9d)['json'](_0x125021);}};}function respondWithFilteredResult(_0x39c4ba,_0x9fe519){return function(_0x490629){if(_0x490629){var _0x505fa1=_0x490629[_0x72cb('0x28')],_0x12c527=_0x9fe519[_0x72cb('0x29')],_0x128aeb=_0x9fe519[_0x72cb('0x29')]+_0x9fe519[_0x72cb('0x2a')],_0x19045a;if(_0x128aeb>=_0x505fa1){_0x128aeb=_0x505fa1;_0x19045a=0xc8;}else{_0x19045a=0xce;}_0x39c4ba[_0x72cb('0x26')](_0x19045a);return _0x39c4ba['set'](_0x72cb('0x2b'),_0x12c527+'-'+_0x128aeb+'/'+_0x505fa1)[_0x72cb('0x2c')](_0x490629);}return null;};}function patchUpdates(_0x1584f6){return function(_0x3cb163){try{jsonpatch['apply'](_0x3cb163,_0x1584f6,!![]);}catch(_0x49c847){return BPromise[_0x72cb('0x2d')](_0x49c847);}return _0x3cb163[_0x72cb('0x2e')]();};}function saveUpdates(_0x19178f,_0x48ab18){return function(_0x1e65bf){if(_0x1e65bf){return _0x1e65bf['update'](_0x19178f)[_0x72cb('0x1b')](function(_0x1d283d){return _0x1d283d;});}return null;};}function removeEntity(_0x1337ec,_0x273ffa){return function(_0x11042b){if(_0x11042b){return _0x11042b[_0x72cb('0x2f')]()['then'](function(){var _0x5f26ea=_0x11042b['get']({'plain':!![]});var _0x3973e7='Trunks';return db['UserProfileResource'][_0x72cb('0x2f')]({'where':{'type':_0x3973e7,'resourceId':_0x5f26ea['id']}})['then'](function(){return _0x11042b;});})[_0x72cb('0x1b')](function(){_0x1337ec[_0x72cb('0x26')](0xcc)[_0x72cb('0x27')]();});}};}function handleEntityNotFound(_0xc3b522,_0x4b91ad){return function(_0x21d7b4){if(!_0x21d7b4){_0xc3b522[_0x72cb('0x25')](0x194);}return _0x21d7b4;};}function handleError(_0x347c41,_0x239b2a){_0x239b2a=_0x239b2a||0x1f4;return function(_0xf1fda5){logger[_0x72cb('0x21')](_0xf1fda5[_0x72cb('0x30')]);if(_0xf1fda5[_0x72cb('0x31')]){delete _0xf1fda5[_0x72cb('0x31')];}_0x347c41[_0x72cb('0x26')](_0x239b2a)[_0x72cb('0x32')](_0xf1fda5);};}exports[_0x72cb('0x33')]=function(_0x3cffea,_0x2aa1fb){var _0x2a1f90={},_0x426c22={},_0x22ac81={'count':0x0,'rows':[]};var _0x475524=_[_0x72cb('0x34')](db[_0x72cb('0x35')][_0x72cb('0x36')],function(_0x436ffa){return{'name':_0x436ffa['fieldName'],'type':_0x436ffa[_0x72cb('0x37')][_0x72cb('0x38')]};});_0x426c22['model']=_[_0x72cb('0x34')](_0x475524,_0x72cb('0x31'));_0x426c22['query']=_[_0x72cb('0x39')](_0x3cffea['query']);_0x426c22[_0x72cb('0x3a')]=_[_0x72cb('0x3b')](_0x426c22[_0x72cb('0x3c')],_0x426c22[_0x72cb('0x3d')]);_0x2a1f90[_0x72cb('0x3e')]=_['intersection'](_0x426c22[_0x72cb('0x3c')],qs['fields'](_0x3cffea['query'][_0x72cb('0x3f')]));_0x2a1f90[_0x72cb('0x3e')]=_0x2a1f90[_0x72cb('0x3e')][_0x72cb('0x40')]?_0x2a1f90[_0x72cb('0x3e')]:_0x426c22[_0x72cb('0x3c')];if(!_0x3cffea['query'][_0x72cb('0x41')]('nolimit')){_0x2a1f90[_0x72cb('0x2a')]=qs[_0x72cb('0x2a')](_0x3cffea[_0x72cb('0x3d')][_0x72cb('0x2a')]);_0x2a1f90[_0x72cb('0x29')]=qs['offset'](_0x3cffea[_0x72cb('0x3d')][_0x72cb('0x29')]);}_0x2a1f90[_0x72cb('0x42')]=qs[_0x72cb('0x43')](_0x3cffea[_0x72cb('0x3d')][_0x72cb('0x43')]);_0x2a1f90[_0x72cb('0x44')]=qs[_0x72cb('0x3a')](_[_0x72cb('0x45')](_0x3cffea[_0x72cb('0x3d')],_0x426c22[_0x72cb('0x3a')]));if(_0x3cffea[_0x72cb('0x3d')]['filter']){_0x2a1f90[_0x72cb('0x44')]=_['merge'](_0x2a1f90[_0x72cb('0x44')],{'$or':_[_0x72cb('0x34')](_0x475524,function(_0x59ba50){if(_0x59ba50[_0x72cb('0x37')]!==_0x72cb('0x46')){var _0x10d134={};_0x10d134[_0x59ba50[_0x72cb('0x31')]]={'$like':'%'+_0x3cffea['query'][_0x72cb('0x47')]+'%'};return _0x10d134;}})});}_0x2a1f90=_[_0x72cb('0x48')]({},_0x2a1f90,_0x3cffea[_0x72cb('0x49')]);var _0x11a110={'where':_0x2a1f90['where']};return db[_0x72cb('0x35')][_0x72cb('0x28')](_0x11a110)[_0x72cb('0x1b')](function(_0x158898){_0x22ac81[_0x72cb('0x28')]=_0x158898;if(_0x3cffea[_0x72cb('0x3d')][_0x72cb('0x4a')]){_0x2a1f90[_0x72cb('0x4b')]=[{'all':!![]}];}return db['Trunk'][_0x72cb('0x4c')](_0x2a1f90);})[_0x72cb('0x1b')](function(_0x2b11ac){_0x22ac81[_0x72cb('0x4d')]=_0x2b11ac;return _0x22ac81;})[_0x72cb('0x1b')](respondWithFilteredResult(_0x2aa1fb,_0x2a1f90))[_0x72cb('0x24')](handleError(_0x2aa1fb,null));};exports[_0x72cb('0x4e')]=function(_0x4c0c34,_0x4b2803){var _0x26946f={'raw':![],'where':{'id':_0x4c0c34['params']['id']}},_0x5d8532={};_0x5d8532['model']=_[_0x72cb('0x39')](db[_0x72cb('0x35')]['rawAttributes']);_0x5d8532[_0x72cb('0x3d')]=_['keys'](_0x4c0c34[_0x72cb('0x3d')]);_0x5d8532['filters']=_[_0x72cb('0x3b')](_0x5d8532[_0x72cb('0x3c')],_0x5d8532[_0x72cb('0x3d')]);_0x26946f[_0x72cb('0x3e')]=_[_0x72cb('0x3b')](_0x5d8532[_0x72cb('0x3c')],qs[_0x72cb('0x3f')](_0x4c0c34[_0x72cb('0x3d')][_0x72cb('0x3f')]));_0x26946f[_0x72cb('0x3e')]=_0x26946f['attributes']['length']?_0x26946f[_0x72cb('0x3e')]:_0x5d8532[_0x72cb('0x3c')];if(_0x4c0c34[_0x72cb('0x3d')][_0x72cb('0x4a')]){_0x26946f[_0x72cb('0x4b')]=[{'all':!![]}];}_0x26946f=_[_0x72cb('0x48')]({},_0x26946f,_0x4c0c34['options']);return db[_0x72cb('0x35')][_0x72cb('0x4f')](_0x26946f)[_0x72cb('0x1b')](handleEntityNotFound(_0x4b2803,null))[_0x72cb('0x1b')](respondWithResult(_0x4b2803,null))[_0x72cb('0x24')](handleError(_0x4b2803,null));};exports['clone']=function(_0x15f956,_0x1a8c09){var _0x2d1d97={'where':{'id':_0x15f956[_0x72cb('0x50')]['id']}},_0x27f228={};_0x27f228[_0x72cb('0x3c')]=_['keys'](db[_0x72cb('0x35')][_0x72cb('0x36')]);_0x2d1d97[_0x72cb('0x3e')]=_[_0x72cb('0x3b')](_0x27f228[_0x72cb('0x3c')],qs[_0x72cb('0x3f')](_0x15f956[_0x72cb('0x3d')][_0x72cb('0x3f')]));_0x2d1d97[_0x72cb('0x3e')]=_0x2d1d97[_0x72cb('0x3e')][_0x72cb('0x40')]?_0x2d1d97['attributes']:_0x27f228['model'];if(_0x15f956['query'][_0x72cb('0x4a')]){_0x2d1d97[_0x72cb('0x4b')]=[{'all':!![]}];}_0x2d1d97=_['merge']({},_0x2d1d97,_0x15f956[_0x72cb('0x49')]);return db[_0x72cb('0x35')][_0x72cb('0x4f')](_0x2d1d97)[_0x72cb('0x1b')](handleEntityNotFound(_0x1a8c09,null))[_0x72cb('0x1b')](function(_0x100314){if(_0x100314){var _0x2d78d7=_0x100314['get']({'plain':!![]});_0x2d78d7=qs[_0x72cb('0x51')](_0x2d78d7,['id',_0x72cb('0x52'),_0x72cb('0x53')]);_0x15f956['body']=_['omit'](_0x15f956[_0x72cb('0x54')],['id',_0x72cb('0x52'),_0x72cb('0x53')]);return db[_0x72cb('0x35')][_0x72cb('0x55')](_[_0x72cb('0x48')](_0x2d78d7,_0x15f956['body']),{'include':_0x15f956['query'][_0x72cb('0x4a')]?[{'all':!![]}]:undefined})['then'](function(_0x4e0102){var _0xd1a76f=_0x15f956['user']['get']({'plain':!![]});if(!_0xd1a76f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xd1a76f['role']===_0x72cb('0x56')){var _0x2a14ae=_0x4e0102[_0x72cb('0x57')]({'plain':!![]});var _0x53297e=_0x72cb('0x58');return db['UserProfileSection'][_0x72cb('0x4f')]({'where':{'name':_0x53297e,'userProfileId':_0xd1a76f[_0x72cb('0x59')]},'raw':!![]})[_0x72cb('0x1b')](function(_0x2aaca0){if(_0x2aaca0&&_0x2aaca0[_0x72cb('0x5a')]===0x0){return db[_0x72cb('0x5b')][_0x72cb('0x55')]({'name':_0x2a14ae[_0x72cb('0x31')],'resourceId':_0x2a14ae['id'],'type':_0x2aaca0[_0x72cb('0x31')],'sectionId':_0x2aaca0['id']},{})[_0x72cb('0x1b')](function(){return _0x4e0102;});}else{return _0x4e0102;}})['catch'](function(_0x529f71){logger[_0x72cb('0x21')](_0x72cb('0x5c'),_0x529f71);throw _0x529f71;});}return _0x4e0102;});}})[_0x72cb('0x1b')](respondWithResult(_0x1a8c09,0xc9))[_0x72cb('0x24')](handleError(_0x1a8c09,null));};exports['create']=function(_0x117a7d,_0x3cd99f,_0x4a6a38){var _0xf81c29;return db[_0x72cb('0x35')]['create'](_0x117a7d[_0x72cb('0x54')],{'raw':!![]})[_0x72cb('0x1b')](function(_0x5bd9b0){_0xf81c29=_0x5bd9b0;return db[_0x72cb('0x35')][_0x72cb('0x4c')]({'raw':!![]});})[_0x72cb('0x1b')](function(_0x42964d){var _0x2dade1=fs[_0x72cb('0x5d')](path['join'](config[_0x72cb('0x5e')],'server/files/templates/trunk.ejs'),'utf8');var _0x2c223d=fs[_0x72cb('0x5d')](path[_0x72cb('0x5f')](config['root'],_0x72cb('0x60')),'utf8');var _0x11fc6c=ejs[_0x72cb('0x61')](_0x2dade1,{'trunks':_0x42964d||[]});fs[_0x72cb('0x62')]('/etc/asterisk/sip_xcally_trunks.conf',_0x11fc6c);if(_0xf81c29[_0x72cb('0x63')]){var _0xe7ab1e=ejs['render'](_0x2c223d,{'trunks':_0x42964d||[]});fs[_0x72cb('0x62')](_0x72cb('0x64'),_0xe7ab1e);}})[_0x72cb('0x1b')](function(){return respondWithRpcPromise(_0x72cb('0x65'),_0x72cb('0x55'),{'module':_0x72cb('0x66')});})['then'](function(){var _0x5ac856=_0x117a7d['user'][_0x72cb('0x57')]({'plain':!![]});if(!_0x5ac856)throw new Error(_0x72cb('0x67'));if(_0x5ac856[_0x72cb('0x68')]==='user'){var _0x3c0bce=_0xf81c29[_0x72cb('0x57')]({'plain':!![]});return db[_0x72cb('0x69')][_0x72cb('0x4f')]({'where':{'name':_0x72cb('0x58'),'userProfileId':_0x5ac856[_0x72cb('0x59')]},'raw':!![]})[_0x72cb('0x1b')](function(_0x2645a4){if(_0x2645a4&&_0x2645a4[_0x72cb('0x5a')]===0x0){return db[_0x72cb('0x5b')][_0x72cb('0x55')]({'name':_0x3c0bce[_0x72cb('0x31')],'resourceId':_0x3c0bce['id'],'type':_0x2645a4[_0x72cb('0x31')],'sectionId':_0x2645a4['id']},{})[_0x72cb('0x1b')](function(){return _0xf81c29;});}else{return _0xf81c29;}})['catch'](function(_0x135958){logger[_0x72cb('0x21')](_0x72cb('0x5c'),_0x135958);throw _0x135958;});}return _0xf81c29;})[_0x72cb('0x1b')](respondWithResult(_0x3cd99f,0xc9))['catch'](handleError(_0x3cd99f,null));};exports[_0x72cb('0x6a')]=function(_0x5a9511,_0x5cfa86,_0x27cdda){var _0x20fa93;return db[_0x72cb('0x35')][_0x72cb('0x4f')]({'where':{'id':_0x5a9511[_0x72cb('0x50')]['id']}})['then'](handleEntityNotFound(_0x5cfa86,null))[_0x72cb('0x1b')](saveUpdates(_0x5a9511[_0x72cb('0x54')],null))[_0x72cb('0x1b')](function(_0x341adb){if(_0x341adb){_0x20fa93=_0x341adb;return db[_0x72cb('0x35')]['findAll']({'raw':!![]});}})['then'](function(_0xdcc4c5){if(_0xdcc4c5){var _0x9ead39=fs[_0x72cb('0x5d')](path[_0x72cb('0x5f')](config[_0x72cb('0x5e')],'server/files/templates/trunk.ejs'),_0x72cb('0x6b'));var _0x169a48=fs[_0x72cb('0x5d')](path[_0x72cb('0x5f')](config[_0x72cb('0x5e')],'server/files/templates/registry.ejs'),_0x72cb('0x6b'));var _0x2212dd=ejs[_0x72cb('0x61')](_0x9ead39,{'trunks':_0xdcc4c5||[]});fs[_0x72cb('0x62')](_0x72cb('0x6c'),_0x2212dd);var _0x26662b=ejs[_0x72cb('0x61')](_0x169a48,{'trunks':_0xdcc4c5||[]});fs[_0x72cb('0x62')](_0x72cb('0x64'),_0x26662b);return respondWithRpcPromise(_0x72cb('0x65'),_0x72cb('0x6a'),{'module':_0x72cb('0x66')});}return null;})['then'](function(_0x228aff){if(_0x228aff){return _0x20fa93;}})['then'](respondWithResult(_0x5cfa86,null))[_0x72cb('0x24')](handleError(_0x5cfa86,null));};exports[_0x72cb('0x2f')]=function(_0x2f1f5d,_0x1ffec5,_0x2b09e4){var _0x541a67;return db[_0x72cb('0x35')][_0x72cb('0x4f')]({'where':{'id':_0x2f1f5d[_0x72cb('0x50')]['id']}})[_0x72cb('0x1b')](handleEntityNotFound(_0x1ffec5,null))[_0x72cb('0x1b')](removeEntity(_0x1ffec5,null))[_0x72cb('0x1b')](function(){return db[_0x72cb('0x35')][_0x72cb('0x4c')]({'raw':!![]});})[_0x72cb('0x1b')](function(_0x2f2608){var _0x378948=fs['readFileSync'](path[_0x72cb('0x5f')](config[_0x72cb('0x5e')],'server/files/templates/trunk.ejs'),_0x72cb('0x6b'));var _0x2f903d=fs[_0x72cb('0x5d')](path[_0x72cb('0x5f')](config[_0x72cb('0x5e')],_0x72cb('0x60')),_0x72cb('0x6b'));var _0x5bfb8f=ejs[_0x72cb('0x61')](_0x378948,{'trunks':_0x2f2608});var _0x5440fd=ejs['render'](_0x2f903d,{'trunks':_0x2f2608});fs[_0x72cb('0x62')](_0x72cb('0x6c'),_0x5bfb8f);fs[_0x72cb('0x62')](_0x72cb('0x64'),_0x5440fd);return respondWithRpcPromise('Reload',_0x72cb('0x2f'),{'module':_0x72cb('0x66')});})[_0x72cb('0x24')](handleError(_0x1ffec5,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index a439339..a7cc9a4 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 _0xee13=['./trunk.attributes','exports','define','Trunk','tools_trunks','lodash','util','../../config/logger','moment','bluebird','path','rimraf'];(function(_0x1982cc,_0x35cba2){var _0x322da9=function(_0x52c3a4){while(--_0x52c3a4){_0x1982cc['push'](_0x1982cc['shift']());}};_0x322da9(++_0x35cba2);}(_0xee13,0x131));var _0x3ee1=function(_0x8398a9,_0x510eef){_0x8398a9=_0x8398a9-0x0;var _0x175a1e=_0xee13[_0x8398a9];return _0x175a1e;};'use strict';var _=require(_0x3ee1('0x0'));var util=require(_0x3ee1('0x1'));var logger=require(_0x3ee1('0x2'))('api');var moment=require(_0x3ee1('0x3'));var BPromise=require(_0x3ee1('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3ee1('0x5'));var rimraf=require(_0x3ee1('0x6'));var config=require('../../config/environment');var attributes=require(_0x3ee1('0x7'));module[_0x3ee1('0x8')]=function(_0x53c62d,_0xeef5af){return _0x53c62d[_0x3ee1('0x9')](_0x3ee1('0xa'),attributes,{'tableName':_0x3ee1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa440=['rimraf','../../config/environment','./trunk.attributes','exports','define','Trunk','tools_trunks','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x52616c,_0xcbf2a9){var _0x4ebfec=function(_0x87c400){while(--_0x87c400){_0x52616c['push'](_0x52616c['shift']());}};_0x4ebfec(++_0xcbf2a9);}(_0xa440,0xca));var _0x0a44=function(_0x1559a5,_0x41924e){_0x1559a5=_0x1559a5-0x0;var _0x17a783=_0xa440[_0x1559a5];return _0x17a783;};'use strict';var _=require(_0x0a44('0x0'));var util=require(_0x0a44('0x1'));var logger=require(_0x0a44('0x2'))(_0x0a44('0x3'));var moment=require(_0x0a44('0x4'));var BPromise=require(_0x0a44('0x5'));var rp=require(_0x0a44('0x6'));var fs=require('fs');var path=require(_0x0a44('0x7'));var rimraf=require(_0x0a44('0x8'));var config=require(_0x0a44('0x9'));var attributes=require(_0x0a44('0xa'));module[_0x0a44('0xb')]=function(_0x11ff02,_0x3fa0e0){return _0x11ff02[_0x0a44('0xc')](_0x0a44('0xd'),attributes,{'tableName':_0x0a44('0xe'),'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 626155f..77552bf 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 _0xb10b=['../../config/environment','jayson/promise','http','request','then','info','Trunk,\x20%s,\x20%s','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','GetTrunk','Trunk','findAll','options','raw','where','attributes','include','map','model','debug','catch','ShowTrunk','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x3160e1,_0x2bc5cd){var _0xa1268e=function(_0x3cdd35){while(--_0x3cdd35){_0x3160e1['push'](_0x3160e1['shift']());}};_0xa1268e(++_0x2bc5cd);}(_0xb10b,0x12a));var _0xbb10=function(_0x4b432a,_0x578c42){_0x4b432a=_0x4b432a-0x0;var _0x505158=_0xb10b[_0x4b432a];return _0x505158;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')]({'raw':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8[_0xbb10('0x18')]?_0x378da8['options'][_0xbb10('0x1b')]||null:null,'limit':_0x378da8[_0xbb10('0x18')]?_0x378da8['options']['limit']||null:null,'include':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1c')]?_[_0xbb10('0x1d')](_0x378da8[_0xbb10('0x18')][_0xbb10('0x1c')],function(_0x407cb4){return{'model':db[_0x407cb4[_0xbb10('0x1e')]],'as':_0x407cb4['as'],'attributes':_0x407cb4[_0xbb10('0x1b')],'include':_0x407cb4[_0xbb10('0x1c')]?_[_0xbb10('0x1d')](_0x407cb4[_0xbb10('0x1c')],function(_0x537898){return{'model':db[_0x537898['model']],'as':_0x537898['as'],'attributes':_0x537898['attributes'],'include':_0x537898[_0xbb10('0x1c')]?_[_0xbb10('0x1d')](_0x537898[_0xbb10('0x1c')],function(_0x4e25ff){return{'model':db[_0x4e25ff[_0xbb10('0x1e')]],'as':_0x4e25ff['as'],'attributes':_0x4e25ff[_0xbb10('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xbb10('0xc')](function(_0x1d5e95){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1f')]('GetTrunk',_0x378da8,JSON[_0xbb10('0x11')](_0x1d5e95));_0x575cca(_0x1d5e95);})[_0xbb10('0x20')](function(_0xfc3595){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0xfc3595[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4['error'](0x1f4,_0xfc3595[_0xbb10('0x13')]));});});};exports['ShowTrunk']=function(_0x448d5c){var _0x56f2da=this;return new Promise(function(_0x16ad2a,_0x1dcc9c){return db[_0xbb10('0x16')]['find']({'raw':_0x448d5c['options']?_0x448d5c[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x448d5c['options']?_0x448d5c[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x448d5c[_0xbb10('0x18')]?_0x448d5c[_0xbb10('0x18')][_0xbb10('0x1b')]||null:null,'include':_0x448d5c[_0xbb10('0x18')]?_0x448d5c[_0xbb10('0x18')]['include']?_[_0xbb10('0x1d')](_0x448d5c[_0xbb10('0x18')][_0xbb10('0x1c')],function(_0x8c1ce6){return{'model':db[_0x8c1ce6[_0xbb10('0x1e')]],'as':_0x8c1ce6['as'],'attributes':_0x8c1ce6[_0xbb10('0x1b')],'include':_0x8c1ce6[_0xbb10('0x1c')]?_[_0xbb10('0x1d')](_0x8c1ce6[_0xbb10('0x1c')],function(_0x56943c){return{'model':db[_0x56943c[_0xbb10('0x1e')]],'as':_0x56943c['as'],'attributes':_0x56943c[_0xbb10('0x1b')],'include':_0x56943c[_0xbb10('0x1c')]?_[_0xbb10('0x1d')](_0x56943c['include'],function(_0x111762){return{'model':db[_0x111762['model']],'as':_0x111762['as'],'attributes':_0x111762['attributes']};}):[]};}):[]};}):[]:[]})[_0xbb10('0xc')](function(_0x40c164){logger[_0xbb10('0xd')](_0xbb10('0x21'),_0x448d5c);logger[_0xbb10('0x1f')](_0xbb10('0x21'),_0x448d5c,JSON['stringify'](_0x40c164));_0x16ad2a(_0x40c164);})[_0xbb10('0x20')](function(_0x25d72f){logger['error']('ShowTrunk',_0x25d72f['message'],_0x448d5c);_0x1dcc9c(_0x56f2da[_0xbb10('0x12')](0x1f4,_0x25d72f[_0xbb10('0x13')]));});});}; \ No newline at end of file +var _0x5eb8=['where','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','error','message','catch','Trunk','findAll','options','raw','limit','include','model','attributes','map','then','GetTrunk','stringify','ShowTrunk'];(function(_0x35885a,_0x42fed7){var _0xe86249=function(_0x98edb3){while(--_0x98edb3){_0x35885a['push'](_0x35885a['shift']());}};_0xe86249(++_0x42fed7);}(_0x5eb8,0xb0));var _0x85eb=function(_0x172ed7,_0x3d08fd){_0x172ed7=_0x172ed7-0x0;var _0xfa8f61=_0x5eb8[_0x172ed7];return _0xfa8f61;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x85eb('0x0'));var BPromise=require(_0x85eb('0x1'));var rs=require(_0x85eb('0x2'));var fs=require('fs');var Redis=require(_0x85eb('0x3'));var db=require(_0x85eb('0x4'))['db'];var utils=require(_0x85eb('0x5'));var logger=require(_0x85eb('0x6'))(_0x85eb('0x7'));var config=require(_0x85eb('0x8'));var jayson=require(_0x85eb('0x9'));var client=jayson[_0x85eb('0xa')][_0x85eb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4a8814,_0x16d7b9,_0x3af658){return new BPromise(function(_0x448345,_0x5cd4ec){return client[_0x85eb('0xc')](_0x4a8814,_0x3af658)['then'](function(_0x1f0036){logger[_0x85eb('0xd')](_0x85eb('0xe'),_0x16d7b9,_0x85eb('0xf'));logger[_0x85eb('0x10')](_0x85eb('0x11'),_0x16d7b9,_0x85eb('0xf'),JSON['stringify'](_0x1f0036));if(_0x1f0036[_0x85eb('0x12')]){if(_0x1f0036[_0x85eb('0x12')]['code']===0x1f4){logger[_0x85eb('0x12')](_0x85eb('0xe'),_0x16d7b9,_0x1f0036[_0x85eb('0x12')][_0x85eb('0x13')]);return _0x5cd4ec(_0x1f0036['error']['message']);}logger[_0x85eb('0x12')]('Trunk,\x20%s,\x20%s',_0x16d7b9,_0x1f0036[_0x85eb('0x12')][_0x85eb('0x13')]);return _0x448345(_0x1f0036[_0x85eb('0x12')][_0x85eb('0x13')]);}else{logger[_0x85eb('0xd')]('Trunk,\x20%s,\x20%s',_0x16d7b9,_0x85eb('0xf'));_0x448345(_0x1f0036['result'][_0x85eb('0x13')]);}})[_0x85eb('0x14')](function(_0x3e23e8){logger[_0x85eb('0x12')]('Trunk,\x20%s,\x20%s',_0x16d7b9,_0x3e23e8);_0x5cd4ec(_0x3e23e8);});});}exports['GetTrunk']=function(_0x50d2a8){var _0xe198ca=this;return new Promise(function(_0x39ca96,_0x10cf2f){return db[_0x85eb('0x15')][_0x85eb('0x16')]({'raw':_0x50d2a8[_0x85eb('0x17')]?_0x50d2a8['options'][_0x85eb('0x18')]===undefined?!![]:![]:!![],'where':_0x50d2a8[_0x85eb('0x17')]?_0x50d2a8[_0x85eb('0x17')]['where']||null:null,'attributes':_0x50d2a8['options']?_0x50d2a8['options']['attributes']||null:null,'limit':_0x50d2a8[_0x85eb('0x17')]?_0x50d2a8[_0x85eb('0x17')][_0x85eb('0x19')]||null:null,'include':_0x50d2a8[_0x85eb('0x17')]?_0x50d2a8[_0x85eb('0x17')][_0x85eb('0x1a')]?_['map'](_0x50d2a8['options']['include'],function(_0x298e84){return{'model':db[_0x298e84[_0x85eb('0x1b')]],'as':_0x298e84['as'],'attributes':_0x298e84[_0x85eb('0x1c')],'include':_0x298e84[_0x85eb('0x1a')]?_[_0x85eb('0x1d')](_0x298e84[_0x85eb('0x1a')],function(_0x5dfc96){return{'model':db[_0x5dfc96[_0x85eb('0x1b')]],'as':_0x5dfc96['as'],'attributes':_0x5dfc96[_0x85eb('0x1c')],'include':_0x5dfc96[_0x85eb('0x1a')]?_[_0x85eb('0x1d')](_0x5dfc96[_0x85eb('0x1a')],function(_0x57a03c){return{'model':db[_0x57a03c[_0x85eb('0x1b')]],'as':_0x57a03c['as'],'attributes':_0x57a03c[_0x85eb('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x85eb('0x1e')](function(_0x3e7eb9){logger[_0x85eb('0xd')](_0x85eb('0x1f'),_0x50d2a8);logger['debug']('GetTrunk',_0x50d2a8,JSON[_0x85eb('0x20')](_0x3e7eb9));_0x39ca96(_0x3e7eb9);})['catch'](function(_0xa9b14f){logger['error'](_0x85eb('0x1f'),_0xa9b14f[_0x85eb('0x13')],_0x50d2a8);_0x10cf2f(_0xe198ca[_0x85eb('0x12')](0x1f4,_0xa9b14f[_0x85eb('0x13')]));});});};exports[_0x85eb('0x21')]=function(_0xf4ac13){var _0x41ed76=this;return new Promise(function(_0x5decd5,_0x237f19){return db[_0x85eb('0x15')]['find']({'raw':_0xf4ac13[_0x85eb('0x17')]?_0xf4ac13['options']['raw']===undefined?!![]:![]:!![],'where':_0xf4ac13[_0x85eb('0x17')]?_0xf4ac13[_0x85eb('0x17')][_0x85eb('0x22')]||null:null,'attributes':_0xf4ac13[_0x85eb('0x17')]?_0xf4ac13[_0x85eb('0x17')][_0x85eb('0x1c')]||null:null,'include':_0xf4ac13[_0x85eb('0x17')]?_0xf4ac13[_0x85eb('0x17')][_0x85eb('0x1a')]?_[_0x85eb('0x1d')](_0xf4ac13['options'][_0x85eb('0x1a')],function(_0x3a5b87){return{'model':db[_0x3a5b87['model']],'as':_0x3a5b87['as'],'attributes':_0x3a5b87['attributes'],'include':_0x3a5b87[_0x85eb('0x1a')]?_[_0x85eb('0x1d')](_0x3a5b87[_0x85eb('0x1a')],function(_0x12cb4c){return{'model':db[_0x12cb4c[_0x85eb('0x1b')]],'as':_0x12cb4c['as'],'attributes':_0x12cb4c[_0x85eb('0x1c')],'include':_0x12cb4c[_0x85eb('0x1a')]?_[_0x85eb('0x1d')](_0x12cb4c[_0x85eb('0x1a')],function(_0x373e5f){return{'model':db[_0x373e5f[_0x85eb('0x1b')]],'as':_0x373e5f['as'],'attributes':_0x373e5f[_0x85eb('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x85eb('0x1e')](function(_0x33605a){logger['info'](_0x85eb('0x21'),_0xf4ac13);logger[_0x85eb('0x10')]('ShowTrunk',_0xf4ac13,JSON['stringify'](_0x33605a));_0x5decd5(_0x33605a);})[_0x85eb('0x14')](function(_0xe22d16){logger['error'](_0x85eb('0x21'),_0xe22d16['message'],_0xf4ac13);_0x237f19(_0x41ed76[_0x85eb('0x12')](0x1f4,_0xe22d16['message']));});});}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 2aa8230..ed10829 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 _0xc4aa=['put','update','changePassword','removeQueues','removeTeams','delete','destroy','removeChatInteractions','removeMailInteractions','removeFaxInteractions','removeSmsInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeSquareProjects','removeApiKey','exports','multer','util','path','connect-timeout','express','Router','./user.controller','get','isAuthenticated','index','/describe','describe','whoami','show','getAvatar','/:id/contacts','getContacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getGroups','/:id/recordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','getOpenchannelInteractions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','getTeams','/:id/lists','getLists','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','/:id/openchannel_accounts','getOpenchannelAccounts','getSmsAccounts','/:id/chat_websites','/:id/square_projects','getSquareProjects','getApiKey','post','/create_many','bulkCreate','addContacts','create','addQueues','root','server/files/images/','format','%s-%s','originalname','/:id/avatar','file','addAvatar','login','pause','/:id/unpause','unpause','/:id/teams','addTeams','/:id/chat_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','addFaxAccounts','addOpenchannelAccounts','/:id/sms_accounts','addSmsAccounts','addChatWebsites','addSquareProjects','/:id/api_key'];(function(_0x2acd35,_0x2b21df){var _0x272693=function(_0x118994){while(--_0x118994){_0x2acd35['push'](_0x2acd35['shift']());}};_0x272693(++_0x2b21df);}(_0xc4aa,0x1b7));var _0xac4a=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0xc4aa[_0xa148b7];return _0x51efd3;};'use strict';var multer=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var path=require(_0xac4a('0x2'));var timeout=require(_0xac4a('0x3'));var express=require(_0xac4a('0x4'));var router=express[_0xac4a('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xac4a('0x6'));router[_0xac4a('0x7')]('/',auth[_0xac4a('0x8')](),controller[_0xac4a('0x9')]);router[_0xac4a('0x7')](_0xac4a('0xa'),auth[_0xac4a('0x8')](),controller[_0xac4a('0xb')]);router['get']('/whoami',auth[_0xac4a('0x8')](),controller[_0xac4a('0xc')]);router[_0xac4a('0x7')]('/:id',auth[_0xac4a('0x8')](),controller[_0xac4a('0xd')]);router[_0xac4a('0x7')]('/:id/avatar',controller[_0xac4a('0xe')]);router['get'](_0xac4a('0xf'),auth['isAuthenticated'](),controller[_0xac4a('0x10')]);router[_0xac4a('0x7')](_0xac4a('0x11'),auth['isAuthenticated'](),controller[_0xac4a('0x12')]);router[_0xac4a('0x7')](_0xac4a('0x13'),auth[_0xac4a('0x8')](),controller[_0xac4a('0x14')]);router[_0xac4a('0x7')](_0xac4a('0x15'),auth[_0xac4a('0x8')](),controller[_0xac4a('0x16')]);router[_0xac4a('0x7')](_0xac4a('0x17'),auth[_0xac4a('0x8')](),controller['getRecordings']);router[_0xac4a('0x7')](_0xac4a('0x18'),auth[_0xac4a('0x8')](),controller[_0xac4a('0x19')]);router[_0xac4a('0x7')](_0xac4a('0x1a'),auth[_0xac4a('0x8')](),controller[_0xac4a('0x1b')]);router['get']('/:id/openchannel/interactions',auth[_0xac4a('0x8')](),controller[_0xac4a('0x1c')]);router[_0xac4a('0x7')]('/:id/mail/interactions',auth[_0xac4a('0x8')](),controller[_0xac4a('0x1d')]);router[_0xac4a('0x7')](_0xac4a('0x1e'),auth[_0xac4a('0x8')](),controller[_0xac4a('0x1f')]);router[_0xac4a('0x7')](_0xac4a('0x20'),auth['isAuthenticated'](),controller[_0xac4a('0x21')]);router[_0xac4a('0x7')]('/:id/teams',auth[_0xac4a('0x8')](),controller[_0xac4a('0x22')]);router[_0xac4a('0x7')](_0xac4a('0x23'),auth['isAuthenticated'](),controller[_0xac4a('0x24')]);router[_0xac4a('0x7')](_0xac4a('0x25'),auth[_0xac4a('0x8')](),controller[_0xac4a('0x26')]);router[_0xac4a('0x7')](_0xac4a('0x27'),auth[_0xac4a('0x8')](),controller[_0xac4a('0x28')]);router[_0xac4a('0x7')](_0xac4a('0x29'),auth[_0xac4a('0x8')](),controller[_0xac4a('0x2a')]);router[_0xac4a('0x7')](_0xac4a('0x2b'),auth[_0xac4a('0x8')](),controller['getMailAccounts']);router[_0xac4a('0x7')](_0xac4a('0x2c'),auth[_0xac4a('0x8')](),controller[_0xac4a('0x2d')]);router[_0xac4a('0x7')]('/:id/sms_accounts',auth['isAuthenticated'](),controller[_0xac4a('0x2e')]);router[_0xac4a('0x7')](_0xac4a('0x2f'),auth['isAuthenticated'](),controller['getChatWebsites']);router[_0xac4a('0x7')](_0xac4a('0x30'),auth[_0xac4a('0x8')](),controller[_0xac4a('0x31')]);router[_0xac4a('0x7')]('/:id/scheduled_calls',auth[_0xac4a('0x8')](),controller['getScheduledCalls']);router[_0xac4a('0x7')]('/:id/api_key',auth[_0xac4a('0x8')](),controller[_0xac4a('0x32')]);router[_0xac4a('0x33')](_0xac4a('0x34'),auth[_0xac4a('0x8')](),controller[_0xac4a('0x35')]);router[_0xac4a('0x33')](_0xac4a('0xf'),auth[_0xac4a('0x8')](),controller[_0xac4a('0x36')]);router[_0xac4a('0x33')]('/',auth[_0xac4a('0x8')](),controller[_0xac4a('0x37')]);router[_0xac4a('0x33')]('/:id/queues',auth[_0xac4a('0x8')](),controller[_0xac4a('0x38')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x2a5419,_0x1af1c1,_0x565164){_0x565164(null,path['join'](config[_0xac4a('0x39')],_0xac4a('0x3a')));},'filename':function(_0x1b42b6,_0x3de9e2,_0x4f5986){_0x4f5986(null,util[_0xac4a('0x3b')](_0xac4a('0x3c'),Date['now'](),_0x3de9e2[_0xac4a('0x3d')]));}})});router[_0xac4a('0x33')](_0xac4a('0x3e'),upload['single'](_0xac4a('0x3f')),controller[_0xac4a('0x40')]);router[_0xac4a('0x33')]('/:id/login',auth[_0xac4a('0x8')](),controller[_0xac4a('0x41')]);router['post']('/:id/logout',auth[_0xac4a('0x8')](),controller['logout']);router['post']('/:id/pause',auth['isAuthenticated'](),controller[_0xac4a('0x42')]);router[_0xac4a('0x33')](_0xac4a('0x43'),auth[_0xac4a('0x8')](),controller[_0xac4a('0x44')]);router[_0xac4a('0x33')](_0xac4a('0x45'),auth[_0xac4a('0x8')](),controller[_0xac4a('0x46')]);router[_0xac4a('0x33')](_0xac4a('0x47'),auth[_0xac4a('0x8')](),controller['addChatInteractions']);router['post']('/:id/mail_interactions',auth[_0xac4a('0x8')](),controller[_0xac4a('0x48')]);router[_0xac4a('0x33')](_0xac4a('0x49'),auth[_0xac4a('0x8')](),controller[_0xac4a('0x4a')]);router[_0xac4a('0x33')](_0xac4a('0x4b'),auth[_0xac4a('0x8')](),controller[_0xac4a('0x4c')]);router['post'](_0xac4a('0x4d'),auth[_0xac4a('0x8')](),controller[_0xac4a('0x4e')]);router[_0xac4a('0x33')](_0xac4a('0x29'),auth['isAuthenticated'](),controller[_0xac4a('0x4f')]);router[_0xac4a('0x33')]('/:id/mail_accounts',auth[_0xac4a('0x8')](),controller['addMailAccounts']);router[_0xac4a('0x33')](_0xac4a('0x2c'),auth[_0xac4a('0x8')](),controller[_0xac4a('0x50')]);router[_0xac4a('0x33')](_0xac4a('0x51'),auth[_0xac4a('0x8')](),controller[_0xac4a('0x52')]);router[_0xac4a('0x33')](_0xac4a('0x2f'),auth[_0xac4a('0x8')](),controller[_0xac4a('0x53')]);router['post'](_0xac4a('0x30'),auth[_0xac4a('0x8')](),controller[_0xac4a('0x54')]);router['post'](_0xac4a('0x55'),auth[_0xac4a('0x8')](),controller['createApiKey']);router[_0xac4a('0x56')]('/:id',auth[_0xac4a('0x8')](),controller[_0xac4a('0x57')]);router[_0xac4a('0x56')]('/:id/password',auth['isAuthenticated'](),controller[_0xac4a('0x58')]);router['delete'](_0xac4a('0x11'),auth['isAuthenticated'](),controller[_0xac4a('0x59')]);router['delete'](_0xac4a('0x45'),auth[_0xac4a('0x8')](),controller[_0xac4a('0x5a')]);router[_0xac4a('0x5b')]('/:id',auth[_0xac4a('0x8')](),controller[_0xac4a('0x5c')]);router[_0xac4a('0x5b')](_0xac4a('0x47'),auth[_0xac4a('0x8')](),controller[_0xac4a('0x5d')]);router[_0xac4a('0x5b')]('/:id/mail_interactions',auth[_0xac4a('0x8')](),controller[_0xac4a('0x5e')]);router['delete'](_0xac4a('0x49'),auth[_0xac4a('0x8')](),controller[_0xac4a('0x5f')]);router[_0xac4a('0x5b')]('/:id/sms_interactions',auth[_0xac4a('0x8')](),controller[_0xac4a('0x60')]);router[_0xac4a('0x5b')](_0xac4a('0x4d'),auth[_0xac4a('0x8')](),controller['removeOpenchannelInteractions']);router[_0xac4a('0x5b')]('/:id/fax_accounts',auth[_0xac4a('0x8')](),controller[_0xac4a('0x61')]);router['delete']('/:id/mail_accounts',auth[_0xac4a('0x8')](),controller[_0xac4a('0x62')]);router['delete'](_0xac4a('0x2c'),auth[_0xac4a('0x8')](),controller[_0xac4a('0x63')]);router[_0xac4a('0x5b')]('/:id/sms_accounts',auth[_0xac4a('0x8')](),controller[_0xac4a('0x64')]);router[_0xac4a('0x5b')](_0xac4a('0x2f'),auth[_0xac4a('0x8')](),controller[_0xac4a('0x65')]);router[_0xac4a('0x5b')]('/:id/square_projects',auth[_0xac4a('0x8')](),controller[_0xac4a('0x66')]);router[_0xac4a('0x5b')](_0xac4a('0x55'),auth[_0xac4a('0x8')](),controller[_0xac4a('0x67')]);module[_0xac4a('0x68')]=router; \ No newline at end of file +var _0x2ef3=['getAvatar','/:id/contacts','getContacts','/:id/queues','getQueues','getVoiceQueuesRt','/:id/groups','getGroups','/:id/screen_recordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','/:id/teams','/:id/lists','getLists','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','getMailAccounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','getChatWebsites','/:id/square_projects','getSquareProjects','/:id/api_key','getApiKey','post','/create_many','bulkCreate','create','join','now','originalname','single','file','addAvatar','/:id/login','login','/:id/logout','logout','/:id/pause','pause','/:id/unpause','unpause','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','/:id/fax_interactions','addFaxInteractions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','addFaxAccounts','addMailAccounts','/:id/chat_websites','addChatWebsites','createApiKey','put','update','/:id/password','changePassword','delete','removeQueues','removeTeams','destroy','removeChatInteractions','removeMailInteractions','removeFaxInteractions','/:id/sms_interactions','removeSmsInteractions','removeOpenchannelInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeChatWebsites','removeSquareProjects','removeApiKey','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/whoami','whoami','/:id','/:id/avatar'];(function(_0x352b38,_0x254e88){var _0x29c7ed=function(_0x1d3e02){while(--_0x1d3e02){_0x352b38['push'](_0x352b38['shift']());}};_0x29c7ed(++_0x254e88);}(_0x2ef3,0xba));var _0x32ef=function(_0x3a1cb6,_0x1ab8ba){_0x3a1cb6=_0x3a1cb6-0x0;var _0x31ed6e=_0x2ef3[_0x3a1cb6];return _0x31ed6e;};'use strict';var multer=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var path=require(_0x32ef('0x2'));var timeout=require(_0x32ef('0x3'));var express=require(_0x32ef('0x4'));var router=express[_0x32ef('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x32ef('0x6'));var config=require(_0x32ef('0x7'));var controller=require('./user.controller');router[_0x32ef('0x8')]('/',auth[_0x32ef('0x9')](),controller['index']);router['get'](_0x32ef('0xa'),auth[_0x32ef('0x9')](),controller[_0x32ef('0xb')]);router[_0x32ef('0x8')](_0x32ef('0xc'),auth[_0x32ef('0x9')](),controller[_0x32ef('0xd')]);router[_0x32ef('0x8')](_0x32ef('0xe'),auth[_0x32ef('0x9')](),controller['show']);router['get'](_0x32ef('0xf'),controller[_0x32ef('0x10')]);router[_0x32ef('0x8')](_0x32ef('0x11'),auth['isAuthenticated'](),controller[_0x32ef('0x12')]);router['get'](_0x32ef('0x13'),auth['isAuthenticated'](),controller[_0x32ef('0x14')]);router[_0x32ef('0x8')]('/:id/queues_rt',auth['isAuthenticated'](),controller[_0x32ef('0x15')]);router['get'](_0x32ef('0x16'),auth[_0x32ef('0x9')](),controller[_0x32ef('0x17')]);router[_0x32ef('0x8')]('/:id/recordings',auth['isAuthenticated'](),controller['getRecordings']);router[_0x32ef('0x8')](_0x32ef('0x18'),auth[_0x32ef('0x9')](),controller['getScreenRecordings']);router['get'](_0x32ef('0x19'),auth[_0x32ef('0x9')](),controller[_0x32ef('0x1a')]);router['get'](_0x32ef('0x1b'),auth[_0x32ef('0x9')](),controller['getOpenchannelInteractions']);router[_0x32ef('0x8')](_0x32ef('0x1c'),auth[_0x32ef('0x9')](),controller[_0x32ef('0x1d')]);router[_0x32ef('0x8')](_0x32ef('0x1e'),auth['isAuthenticated'](),controller[_0x32ef('0x1f')]);router['get'](_0x32ef('0x20'),auth[_0x32ef('0x9')](),controller['getFaxInteractions']);router[_0x32ef('0x8')](_0x32ef('0x21'),auth[_0x32ef('0x9')](),controller['getTeams']);router['get'](_0x32ef('0x22'),auth[_0x32ef('0x9')](),controller[_0x32ef('0x23')]);router['get']('/:id/agents',auth[_0x32ef('0x9')](),controller['getAgents']);router['get'](_0x32ef('0x24'),auth[_0x32ef('0x9')](),controller[_0x32ef('0x25')]);router[_0x32ef('0x8')](_0x32ef('0x26'),auth[_0x32ef('0x9')](),controller[_0x32ef('0x27')]);router[_0x32ef('0x8')](_0x32ef('0x28'),auth[_0x32ef('0x9')](),controller[_0x32ef('0x29')]);router[_0x32ef('0x8')]('/:id/openchannel_accounts',auth[_0x32ef('0x9')](),controller[_0x32ef('0x2a')]);router['get'](_0x32ef('0x2b'),auth[_0x32ef('0x9')](),controller[_0x32ef('0x2c')]);router[_0x32ef('0x8')]('/:id/chat_websites',auth[_0x32ef('0x9')](),controller[_0x32ef('0x2d')]);router[_0x32ef('0x8')](_0x32ef('0x2e'),auth[_0x32ef('0x9')](),controller[_0x32ef('0x2f')]);router[_0x32ef('0x8')]('/:id/scheduled_calls',auth[_0x32ef('0x9')](),controller['getScheduledCalls']);router[_0x32ef('0x8')](_0x32ef('0x30'),auth['isAuthenticated'](),controller[_0x32ef('0x31')]);router[_0x32ef('0x32')](_0x32ef('0x33'),auth[_0x32ef('0x9')](),controller[_0x32ef('0x34')]);router['post']('/:id/contacts',auth[_0x32ef('0x9')](),controller['addContacts']);router[_0x32ef('0x32')]('/',auth[_0x32ef('0x9')](),controller[_0x32ef('0x35')]);router[_0x32ef('0x32')](_0x32ef('0x13'),auth[_0x32ef('0x9')](),controller['addQueues']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x484ad7,_0x2261a6,_0x3c4651){_0x3c4651(null,path[_0x32ef('0x36')](config['root'],'server/files/images/'));},'filename':function(_0x1c3633,_0x2bd8a9,_0x410334){_0x410334(null,util['format']('%s-%s',Date[_0x32ef('0x37')](),_0x2bd8a9[_0x32ef('0x38')]));}})});router[_0x32ef('0x32')](_0x32ef('0xf'),upload[_0x32ef('0x39')](_0x32ef('0x3a')),controller[_0x32ef('0x3b')]);router[_0x32ef('0x32')](_0x32ef('0x3c'),auth['isAuthenticated'](),controller[_0x32ef('0x3d')]);router[_0x32ef('0x32')](_0x32ef('0x3e'),auth['isAuthenticated'](),controller[_0x32ef('0x3f')]);router[_0x32ef('0x32')](_0x32ef('0x40'),auth[_0x32ef('0x9')](),controller[_0x32ef('0x41')]);router[_0x32ef('0x32')](_0x32ef('0x42'),auth[_0x32ef('0x9')](),controller[_0x32ef('0x43')]);router[_0x32ef('0x32')](_0x32ef('0x21'),auth[_0x32ef('0x9')](),controller['addTeams']);router[_0x32ef('0x32')](_0x32ef('0x44'),auth[_0x32ef('0x9')](),controller[_0x32ef('0x45')]);router[_0x32ef('0x32')](_0x32ef('0x46'),auth[_0x32ef('0x9')](),controller['addMailInteractions']);router['post'](_0x32ef('0x47'),auth[_0x32ef('0x9')](),controller[_0x32ef('0x48')]);router[_0x32ef('0x32')]('/:id/sms_interactions',auth[_0x32ef('0x9')](),controller[_0x32ef('0x49')]);router['post'](_0x32ef('0x4a'),auth['isAuthenticated'](),controller[_0x32ef('0x4b')]);router[_0x32ef('0x32')](_0x32ef('0x26'),auth[_0x32ef('0x9')](),controller[_0x32ef('0x4c')]);router[_0x32ef('0x32')](_0x32ef('0x28'),auth[_0x32ef('0x9')](),controller[_0x32ef('0x4d')]);router[_0x32ef('0x32')]('/:id/openchannel_accounts',auth[_0x32ef('0x9')](),controller['addOpenchannelAccounts']);router[_0x32ef('0x32')](_0x32ef('0x2b'),auth[_0x32ef('0x9')](),controller['addSmsAccounts']);router[_0x32ef('0x32')](_0x32ef('0x4e'),auth[_0x32ef('0x9')](),controller[_0x32ef('0x4f')]);router[_0x32ef('0x32')](_0x32ef('0x2e'),auth[_0x32ef('0x9')](),controller['addSquareProjects']);router['post'](_0x32ef('0x30'),auth[_0x32ef('0x9')](),controller[_0x32ef('0x50')]);router[_0x32ef('0x51')](_0x32ef('0xe'),auth[_0x32ef('0x9')](),controller[_0x32ef('0x52')]);router[_0x32ef('0x51')](_0x32ef('0x53'),auth[_0x32ef('0x9')](),controller[_0x32ef('0x54')]);router[_0x32ef('0x55')](_0x32ef('0x13'),auth['isAuthenticated'](),controller[_0x32ef('0x56')]);router[_0x32ef('0x55')](_0x32ef('0x21'),auth[_0x32ef('0x9')](),controller[_0x32ef('0x57')]);router[_0x32ef('0x55')](_0x32ef('0xe'),auth[_0x32ef('0x9')](),controller[_0x32ef('0x58')]);router[_0x32ef('0x55')](_0x32ef('0x44'),auth[_0x32ef('0x9')](),controller[_0x32ef('0x59')]);router[_0x32ef('0x55')](_0x32ef('0x46'),auth[_0x32ef('0x9')](),controller[_0x32ef('0x5a')]);router[_0x32ef('0x55')]('/:id/fax_interactions',auth['isAuthenticated'](),controller[_0x32ef('0x5b')]);router[_0x32ef('0x55')](_0x32ef('0x5c'),auth[_0x32ef('0x9')](),controller[_0x32ef('0x5d')]);router[_0x32ef('0x55')](_0x32ef('0x4a'),auth[_0x32ef('0x9')](),controller[_0x32ef('0x5e')]);router[_0x32ef('0x55')](_0x32ef('0x26'),auth['isAuthenticated'](),controller[_0x32ef('0x5f')]);router[_0x32ef('0x55')](_0x32ef('0x28'),auth[_0x32ef('0x9')](),controller[_0x32ef('0x60')]);router[_0x32ef('0x55')]('/:id/openchannel_accounts',auth[_0x32ef('0x9')](),controller[_0x32ef('0x61')]);router[_0x32ef('0x55')]('/:id/sms_accounts',auth[_0x32ef('0x9')](),controller['removeSmsAccounts']);router[_0x32ef('0x55')](_0x32ef('0x4e'),auth['isAuthenticated'](),controller[_0x32ef('0x62')]);router['delete'](_0x32ef('0x2e'),auth[_0x32ef('0x9')](),controller[_0x32ef('0x63')]);router[_0x32ef('0x55')](_0x32ef('0x30'),auth[_0x32ef('0x9')](),controller[_0x32ef('0x64')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index 8dfc9a6..7d17836 100644 --- a/server/api/user/user.attributes.js +++ b/server/api/user/user.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['\x22\x22\x20<>','always','accept','refuse','originate','uac','uas','fingerprint','certificate','passive','update,nonat','showWebBar','get','wss','force_avp','dtlsenable','dtlsverify','dtlssetup','dtlsprivatekey','rtcp_mux','encryption','icesupport','actpass','dtlscertfile','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','permissions','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blockedAt','sequelize','moment','util','STRING','setDataValue','name','defaultuser','callerid','getDataValue','internal','email','admin','user','agent','telephone','INTEGER','format','fullname','BOOLEAN','DATE','DEFAULT\x20PAUSE','ENUM','peer','friend','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','udp','join','transport','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','yes','update','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','allow','ulaw;alaw;gsm','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never'];(function(_0x1ca110,_0x5d21b6){var _0x30ae8e=function(_0x4ed795){while(--_0x4ed795){_0x1ca110['push'](_0x1ca110['shift']());}};_0x30ae8e(++_0x5d21b6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xa9e0[_0x1ac595];return _0x455fff;};'use strict';var Sequelize=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var _=require('lodash');module['exports']={'name':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x333808){this[_0x0a9e('0x4')](_0x0a9e('0x5'),_0x333808);this[_0x0a9e('0x4')](_0x0a9e('0x6'),_0x333808);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'set':function(_0x441e3a){this[_0x0a9e('0x4')]('fullname',_0x441e3a);this['setDataValue'](_0x0a9e('0x7'),util['format']('\x22%s\x22\x20<%s>',_0x441e3a,this[_0x0a9e('0x8')](_0x0a9e('0x9'))));}},'alias':{'type':Sequelize[_0x0a9e('0x3')]},'email':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'unique':_0x0a9e('0xa'),'validate':{'isEmail':!![]},'set':function(_0xbd1168){if(_0xbd1168){this['setDataValue']('email',_0xbd1168['toLowerCase']());}}},'role':{'type':Sequelize['ENUM'](_0x0a9e('0xb'),_0x0a9e('0xc'),_0x0a9e('0xd'),_0x0a9e('0xe')),'allowNull':![]},'password':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':'local'},'internal':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':![],'unique':_0x0a9e('0x9'),'set':function(_0x2b4227){this[_0x0a9e('0x4')](_0x0a9e('0x9'),_0x2b4227);this[_0x0a9e('0x4')]('accountcode',_0x2b4227);this[_0x0a9e('0x4')]('callerid',util[_0x0a9e('0x10')]('\x22%s\x22\x20<%s>',this[_0x0a9e('0x8')](_0x0a9e('0x11')),_0x2b4227));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x0a9e('0x3')]},'mobile':{'type':Sequelize['STRING']},'address':{'type':Sequelize[_0x0a9e('0x3')]},'zipcode':{'type':Sequelize[_0x0a9e('0x3')]},'userpic':{'type':Sequelize[_0x0a9e('0x3')]},'city':{'type':Sequelize[_0x0a9e('0x3')]},'country':{'type':Sequelize[_0x0a9e('0x3')]},'online':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x0a9e('0x13')]},'voicePause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'openchannelPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':_0x0a9e('0x14')},'lastPauseAt':{'type':Sequelize['DATE']},'chatCapacity':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x0a9e('0xf')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'description':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'dynamic'},'ipaddr':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'port':{'type':Sequelize[_0x0a9e('0xf')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'lastms':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x0a9e('0x15')]('friend',_0x0a9e('0xc'),_0x0a9e('0x16')),'allowNull':!![],'defaultValue':_0x0a9e('0x17')},'context':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'defaultValue':_0x0a9e('0x18')},'callingpres':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x19'),_0x0a9e('0x1a'),'ALLOWED_FAILED_SCREEN',_0x0a9e('0x1b'),_0x0a9e('0x1c'),_0x0a9e('0x1d'),_0x0a9e('0x1e'),'PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'permit':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'secret':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'transport':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'defaultValue':_0x0a9e('0x1f'),'set':function(_0x2e8759){this[_0x0a9e('0x4')]('transport',_0x2e8759?_0x2e8759[_0x0a9e('0x20')](','):null);},'get':function(){return this['getDataValue'](_0x0a9e('0x21'))?this[_0x0a9e('0x8')](_0x0a9e('0x21'))[_0x0a9e('0x22')](','):null;},'comment':_0x0a9e('0x23')},'dtmfmode':{'type':Sequelize['ENUM'](_0x0a9e('0x24'),_0x0a9e('0x25'),_0x0a9e('0x26'),_0x0a9e('0x27'),_0x0a9e('0x28')),'allowNull':!![],'defaultValue':_0x0a9e('0x24')},'directmedia':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no','nonat',_0x0a9e('0x2a'),'outgoing'),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'nat':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x0a9e('0x2b'),'set':function(_0xd1836d){this[_0x0a9e('0x4')](_0x0a9e('0x2c'),_0xd1836d?_0xd1836d['join'](','):null);},'get':function(){return this['getDataValue'](_0x0a9e('0x2c'))?this['getDataValue'](_0x0a9e('0x2c'))[_0x0a9e('0x22')](','):null;},'comment':_0x0a9e('0x2d')},'callgroup':{'type':Sequelize[_0x0a9e('0x3')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0x0a9e('0x3')]},'namedpickupgroup':{'type':Sequelize[_0x0a9e('0x3')]},'language':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING']},'disallow':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'defaultValue':_0x0a9e('0x2e')},'allow':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x546ef8){this[_0x0a9e('0x4')](_0x0a9e('0x2f'),_0x546ef8?_0x546ef8['join'](';'):_0x0a9e('0x30'));},'get':function(){return this[_0x0a9e('0x8')](_0x0a9e('0x2f'))?this[_0x0a9e('0x8')]('allow')['split'](';'):null;},'comment':_0x0a9e('0x31')},'autoframing':{'type':Sequelize[_0x0a9e('0x15')]('yes','no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'set':function(_0x1dec2e){this[_0x0a9e('0x4')]('insecure',_0x1dec2e?_0x1dec2e[_0x0a9e('0x20')](','):null);},'get':function(){return this[_0x0a9e('0x8')](_0x0a9e('0x32'))?this[_0x0a9e('0x8')](_0x0a9e('0x32'))[_0x0a9e('0x22')](','):null;},'comment':_0x0a9e('0x33')},'trustrpid':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no',_0x0a9e('0x34')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x0a9e('0x15')]('yes','no'),'allowNull':!![]},'useclientcode':{'type':Sequelize['ENUM'](_0x0a9e('0x29'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'defaultValue':_0x0a9e('0x35')},'amaflags':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'allowNull':!![],'defaultValue':_0x0a9e('0x29')},'busylevel':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize['ENUM'](_0x0a9e('0x29'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'template':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x0a9e('0x15')]('yes','no',_0x0a9e('0x36')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'session_timers':{'type':Sequelize['ENUM'](_0x0a9e('0x37'),_0x0a9e('0x38'),_0x0a9e('0x39')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x3a'),'uas'),'allowNull':!![],'defaultValue':_0x0a9e('0x3b')},'t38pt_usertpsource':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'allowNull':!![],'defaultValue':_0x0a9e('0x29')},'keepalive':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize['ENUM'](_0x0a9e('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'contactacl':{'type':Sequelize['STRING'],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'use_q850_reason':{'type':Sequelize['STRING'],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0x0a9e('0x29'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x0a9e('0x15')]('yes','no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM'](_0x0a9e('0x29'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize['ENUM'](_0x0a9e('0x29'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize['ENUM'](_0x0a9e('0x29'),'no',_0x0a9e('0x3c'),_0x0a9e('0x3d')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'dtlscipher':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscafile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x0a9e('0x15')]('active',_0x0a9e('0x3e'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'usereqphone':{'type':Sequelize['ENUM'](_0x0a9e('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING'],'allowNull':!![]},'recordofffeature':{'type':Sequelize['STRING'],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x0a9e('0x15')]('yes','no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no','nonat',_0x0a9e('0x2a'),_0x0a9e('0x3f')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x0a9e('0x3')]},'resetPasswordExpires':{'type':Sequelize[_0x0a9e('0x13')]},'showWebBar':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0,'set':function(_0x5d86e9){this[_0x0a9e('0x4')](_0x0a9e('0x40'),_0x5d86e9);var _0x5239ef=this[_0x0a9e('0x41')]({'plain':!![]});switch(_0x5d86e9){case 0x0:case 0x1:var _0x5cc8fb=_0x5239ef[_0x0a9e('0x21')]?_['isArray'](_0x5239ef['transport'])?_0x5239ef['transport'][_0x0a9e('0x20')]():_0x5239ef['transport']:_0x0a9e('0x1f');if(_0x5cc8fb===_0x0a9e('0x42')){_0x5cc8fb=_0x0a9e('0x1f');}this[_0x0a9e('0x4')](_0x0a9e('0x21'),_0x5cc8fb);this[_0x0a9e('0x4')]('encryption','no');this[_0x0a9e('0x4')]('avpf',null);this[_0x0a9e('0x4')](_0x0a9e('0x43'),null);this[_0x0a9e('0x4')]('icesupport',null);this[_0x0a9e('0x4')](_0x0a9e('0x44'),null);this[_0x0a9e('0x4')](_0x0a9e('0x45'),null);this['setDataValue'](_0x0a9e('0x46'),null);this[_0x0a9e('0x4')]('dtlscertfile',null);this[_0x0a9e('0x4')](_0x0a9e('0x47'),null);this[_0x0a9e('0x4')](_0x0a9e('0x48'),'no');break;case 0x2:this[_0x0a9e('0x4')]('transport',_0x0a9e('0x42'));this[_0x0a9e('0x4')](_0x0a9e('0x49'),'yes');this[_0x0a9e('0x4')]('avpf','yes');this[_0x0a9e('0x4')](_0x0a9e('0x43'),_0x0a9e('0x29'));this[_0x0a9e('0x4')](_0x0a9e('0x4a'),_0x0a9e('0x29'));this[_0x0a9e('0x4')](_0x0a9e('0x44'),_0x0a9e('0x29'));this[_0x0a9e('0x4')](_0x0a9e('0x45'),'no');this[_0x0a9e('0x4')](_0x0a9e('0x46'),_0x0a9e('0x4b'));this[_0x0a9e('0x4')](_0x0a9e('0x4c'),_0x5239ef[_0x0a9e('0x4c')]||_0x0a9e('0x4d'));this['setDataValue'](_0x0a9e('0x47'),_0x5239ef[_0x0a9e('0x47')]||_0x0a9e('0x4e'));this['setDataValue'](_0x0a9e('0x48'),_0x0a9e('0x29'));break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0x83f0b2){this[_0x0a9e('0x4')](_0x0a9e('0x4f'),_0x83f0b2?_0x83f0b2[_0x0a9e('0x20')](','):[]);},'get':function(){return this[_0x0a9e('0x8')]('permissions')?_['map'](this['getDataValue'](_0x0a9e('0x4f'))[_0x0a9e('0x22')](','),function(_0x1104ad){return parseInt(_0x1104ad,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x0a9e('0x3')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x0a9e('0x3')]},'phoneBarBusyNumber':{'type':Sequelize[_0x0a9e('0x3')]},'phoneBarUnconditional':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':''},'crudPermissions':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x0a9e('0x3')]},'passwordResetAt':{'type':Sequelize[_0x0a9e('0x13')],'defaultValue':null},'phoneBarEnableJaws':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x0a9e('0x8')](_0x0a9e('0x50'))?this[_0x0a9e('0x8')](_0x0a9e('0x50')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'interface':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize['STRING'],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![],'set':function(_0x30a4c7){if(typeof _0x30a4c7===_0x0a9e('0x51')){var _0x332367=_0x30a4c7==='1'?!![]:_0x30a4c7==='0'?![]:_0x30a4c7===_0x0a9e('0x52')?!![]:_0x30a4c7===_0x0a9e('0x53')?![]:![];this[_0x0a9e('0x4')](_0x0a9e('0x54'),_0x332367);}else{this[_0x0a9e('0x4')](_0x0a9e('0x54'),_0x30a4c7);}}},'blocked':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![],'set':function(_0x25744a){this[_0x0a9e('0x4')]('blocked',_0x25744a);if(_0x25744a===!![]){this[_0x0a9e('0x4')](_0x0a9e('0x55'),moment());this[_0x0a9e('0x4')]('loginAttempts',0x0);}else{this[_0x0a9e('0x4')](_0x0a9e('0x55'),null);}}},'blockedAt':{'type':Sequelize[_0x0a9e('0x13')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'disabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xa9e0=['\x22\x22\x20<>','always','accept','refuse','originate','uac','uas','fingerprint','certificate','passive','update,nonat','showWebBar','get','wss','force_avp','dtlsenable','dtlsverify','dtlssetup','dtlsprivatekey','rtcp_mux','encryption','icesupport','actpass','dtlscertfile','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','permissions','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blockedAt','sequelize','moment','util','STRING','setDataValue','name','defaultuser','callerid','getDataValue','internal','email','admin','user','agent','telephone','INTEGER','format','fullname','BOOLEAN','DATE','DEFAULT\x20PAUSE','ENUM','peer','friend','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','udp','join','transport','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','yes','update','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','allow','ulaw;alaw;gsm','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never'];(function(_0x6c6173,_0x155b0c){var _0x4c3e6e=function(_0x4c0d52){while(--_0x4c0d52){_0x6c6173['push'](_0x6c6173['shift']());}};_0x4c3e6e(++_0x155b0c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0xa9e0[_0x4709c0];return _0x13348b;};'use strict';var Sequelize=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var _=require('lodash');module['exports']={'name':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x333808){this[_0x0a9e('0x4')](_0x0a9e('0x5'),_0x333808);this[_0x0a9e('0x4')](_0x0a9e('0x6'),_0x333808);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'set':function(_0x441e3a){this[_0x0a9e('0x4')]('fullname',_0x441e3a);this['setDataValue'](_0x0a9e('0x7'),util['format']('\x22%s\x22\x20<%s>',_0x441e3a,this[_0x0a9e('0x8')](_0x0a9e('0x9'))));}},'alias':{'type':Sequelize[_0x0a9e('0x3')]},'email':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'unique':_0x0a9e('0xa'),'validate':{'isEmail':!![]},'set':function(_0xbd1168){if(_0xbd1168){this['setDataValue']('email',_0xbd1168['toLowerCase']());}}},'role':{'type':Sequelize['ENUM'](_0x0a9e('0xb'),_0x0a9e('0xc'),_0x0a9e('0xd'),_0x0a9e('0xe')),'allowNull':![]},'password':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':'local'},'internal':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':![],'unique':_0x0a9e('0x9'),'set':function(_0x2b4227){this[_0x0a9e('0x4')](_0x0a9e('0x9'),_0x2b4227);this[_0x0a9e('0x4')]('accountcode',_0x2b4227);this[_0x0a9e('0x4')]('callerid',util[_0x0a9e('0x10')]('\x22%s\x22\x20<%s>',this[_0x0a9e('0x8')](_0x0a9e('0x11')),_0x2b4227));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x0a9e('0x3')]},'mobile':{'type':Sequelize['STRING']},'address':{'type':Sequelize[_0x0a9e('0x3')]},'zipcode':{'type':Sequelize[_0x0a9e('0x3')]},'userpic':{'type':Sequelize[_0x0a9e('0x3')]},'city':{'type':Sequelize[_0x0a9e('0x3')]},'country':{'type':Sequelize[_0x0a9e('0x3')]},'online':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x0a9e('0x13')]},'voicePause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'openchannelPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':_0x0a9e('0x14')},'lastPauseAt':{'type':Sequelize['DATE']},'chatCapacity':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x0a9e('0xf')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'description':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'dynamic'},'ipaddr':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'port':{'type':Sequelize[_0x0a9e('0xf')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'lastms':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x0a9e('0x15')]('friend',_0x0a9e('0xc'),_0x0a9e('0x16')),'allowNull':!![],'defaultValue':_0x0a9e('0x17')},'context':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'defaultValue':_0x0a9e('0x18')},'callingpres':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x19'),_0x0a9e('0x1a'),'ALLOWED_FAILED_SCREEN',_0x0a9e('0x1b'),_0x0a9e('0x1c'),_0x0a9e('0x1d'),_0x0a9e('0x1e'),'PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'permit':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'secret':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'transport':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'defaultValue':_0x0a9e('0x1f'),'set':function(_0x2e8759){this[_0x0a9e('0x4')]('transport',_0x2e8759?_0x2e8759[_0x0a9e('0x20')](','):null);},'get':function(){return this['getDataValue'](_0x0a9e('0x21'))?this[_0x0a9e('0x8')](_0x0a9e('0x21'))[_0x0a9e('0x22')](','):null;},'comment':_0x0a9e('0x23')},'dtmfmode':{'type':Sequelize['ENUM'](_0x0a9e('0x24'),_0x0a9e('0x25'),_0x0a9e('0x26'),_0x0a9e('0x27'),_0x0a9e('0x28')),'allowNull':!![],'defaultValue':_0x0a9e('0x24')},'directmedia':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no','nonat',_0x0a9e('0x2a'),'outgoing'),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'nat':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x0a9e('0x2b'),'set':function(_0xd1836d){this[_0x0a9e('0x4')](_0x0a9e('0x2c'),_0xd1836d?_0xd1836d['join'](','):null);},'get':function(){return this['getDataValue'](_0x0a9e('0x2c'))?this['getDataValue'](_0x0a9e('0x2c'))[_0x0a9e('0x22')](','):null;},'comment':_0x0a9e('0x2d')},'callgroup':{'type':Sequelize[_0x0a9e('0x3')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0x0a9e('0x3')]},'namedpickupgroup':{'type':Sequelize[_0x0a9e('0x3')]},'language':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING']},'disallow':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'defaultValue':_0x0a9e('0x2e')},'allow':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x546ef8){this[_0x0a9e('0x4')](_0x0a9e('0x2f'),_0x546ef8?_0x546ef8['join'](';'):_0x0a9e('0x30'));},'get':function(){return this[_0x0a9e('0x8')](_0x0a9e('0x2f'))?this[_0x0a9e('0x8')]('allow')['split'](';'):null;},'comment':_0x0a9e('0x31')},'autoframing':{'type':Sequelize[_0x0a9e('0x15')]('yes','no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'set':function(_0x1dec2e){this[_0x0a9e('0x4')]('insecure',_0x1dec2e?_0x1dec2e[_0x0a9e('0x20')](','):null);},'get':function(){return this[_0x0a9e('0x8')](_0x0a9e('0x32'))?this[_0x0a9e('0x8')](_0x0a9e('0x32'))[_0x0a9e('0x22')](','):null;},'comment':_0x0a9e('0x33')},'trustrpid':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no',_0x0a9e('0x34')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x0a9e('0x15')]('yes','no'),'allowNull':!![]},'useclientcode':{'type':Sequelize['ENUM'](_0x0a9e('0x29'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'defaultValue':_0x0a9e('0x35')},'amaflags':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'allowNull':!![],'defaultValue':_0x0a9e('0x29')},'busylevel':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize['ENUM'](_0x0a9e('0x29'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'template':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x0a9e('0x15')]('yes','no',_0x0a9e('0x36')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'session_timers':{'type':Sequelize['ENUM'](_0x0a9e('0x37'),_0x0a9e('0x38'),_0x0a9e('0x39')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x3a'),'uas'),'allowNull':!![],'defaultValue':_0x0a9e('0x3b')},'t38pt_usertpsource':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'allowNull':!![],'defaultValue':_0x0a9e('0x29')},'keepalive':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize['ENUM'](_0x0a9e('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'contactacl':{'type':Sequelize['STRING'],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'use_q850_reason':{'type':Sequelize['STRING'],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0x0a9e('0x29'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x0a9e('0x15')]('yes','no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM'](_0x0a9e('0x29'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize['ENUM'](_0x0a9e('0x29'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize['ENUM'](_0x0a9e('0x29'),'no',_0x0a9e('0x3c'),_0x0a9e('0x3d')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'dtlscipher':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscafile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x0a9e('0x15')]('active',_0x0a9e('0x3e'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'usereqphone':{'type':Sequelize['ENUM'](_0x0a9e('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING'],'allowNull':!![]},'recordofffeature':{'type':Sequelize['STRING'],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x0a9e('0x15')]('yes','no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no','nonat',_0x0a9e('0x2a'),_0x0a9e('0x3f')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x0a9e('0x3')]},'resetPasswordExpires':{'type':Sequelize[_0x0a9e('0x13')]},'showWebBar':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0,'set':function(_0x5d86e9){this[_0x0a9e('0x4')](_0x0a9e('0x40'),_0x5d86e9);var _0x5239ef=this[_0x0a9e('0x41')]({'plain':!![]});switch(_0x5d86e9){case 0x0:case 0x1:var _0x5cc8fb=_0x5239ef[_0x0a9e('0x21')]?_['isArray'](_0x5239ef['transport'])?_0x5239ef['transport'][_0x0a9e('0x20')]():_0x5239ef['transport']:_0x0a9e('0x1f');if(_0x5cc8fb===_0x0a9e('0x42')){_0x5cc8fb=_0x0a9e('0x1f');}this[_0x0a9e('0x4')](_0x0a9e('0x21'),_0x5cc8fb);this[_0x0a9e('0x4')]('encryption','no');this[_0x0a9e('0x4')]('avpf',null);this[_0x0a9e('0x4')](_0x0a9e('0x43'),null);this[_0x0a9e('0x4')]('icesupport',null);this[_0x0a9e('0x4')](_0x0a9e('0x44'),null);this[_0x0a9e('0x4')](_0x0a9e('0x45'),null);this['setDataValue'](_0x0a9e('0x46'),null);this[_0x0a9e('0x4')]('dtlscertfile',null);this[_0x0a9e('0x4')](_0x0a9e('0x47'),null);this[_0x0a9e('0x4')](_0x0a9e('0x48'),'no');break;case 0x2:this[_0x0a9e('0x4')]('transport',_0x0a9e('0x42'));this[_0x0a9e('0x4')](_0x0a9e('0x49'),'yes');this[_0x0a9e('0x4')]('avpf','yes');this[_0x0a9e('0x4')](_0x0a9e('0x43'),_0x0a9e('0x29'));this[_0x0a9e('0x4')](_0x0a9e('0x4a'),_0x0a9e('0x29'));this[_0x0a9e('0x4')](_0x0a9e('0x44'),_0x0a9e('0x29'));this[_0x0a9e('0x4')](_0x0a9e('0x45'),'no');this[_0x0a9e('0x4')](_0x0a9e('0x46'),_0x0a9e('0x4b'));this[_0x0a9e('0x4')](_0x0a9e('0x4c'),_0x5239ef[_0x0a9e('0x4c')]||_0x0a9e('0x4d'));this['setDataValue'](_0x0a9e('0x47'),_0x5239ef[_0x0a9e('0x47')]||_0x0a9e('0x4e'));this['setDataValue'](_0x0a9e('0x48'),_0x0a9e('0x29'));break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0x83f0b2){this[_0x0a9e('0x4')](_0x0a9e('0x4f'),_0x83f0b2?_0x83f0b2[_0x0a9e('0x20')](','):[]);},'get':function(){return this[_0x0a9e('0x8')]('permissions')?_['map'](this['getDataValue'](_0x0a9e('0x4f'))[_0x0a9e('0x22')](','),function(_0x1104ad){return parseInt(_0x1104ad,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x0a9e('0x3')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x0a9e('0x3')]},'phoneBarBusyNumber':{'type':Sequelize[_0x0a9e('0x3')]},'phoneBarUnconditional':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':''},'crudPermissions':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x0a9e('0x3')]},'passwordResetAt':{'type':Sequelize[_0x0a9e('0x13')],'defaultValue':null},'phoneBarEnableJaws':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x0a9e('0x8')](_0x0a9e('0x50'))?this[_0x0a9e('0x8')](_0x0a9e('0x50')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'interface':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize['STRING'],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![],'set':function(_0x30a4c7){if(typeof _0x30a4c7===_0x0a9e('0x51')){var _0x332367=_0x30a4c7==='1'?!![]:_0x30a4c7==='0'?![]:_0x30a4c7===_0x0a9e('0x52')?!![]:_0x30a4c7===_0x0a9e('0x53')?![]:![];this[_0x0a9e('0x4')](_0x0a9e('0x54'),_0x332367);}else{this[_0x0a9e('0x4')](_0x0a9e('0x54'),_0x30a4c7);}}},'blocked':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![],'set':function(_0x25744a){this[_0x0a9e('0x4')]('blocked',_0x25744a);if(_0x25744a===!![]){this[_0x0a9e('0x4')](_0x0a9e('0x55'),moment());this[_0x0a9e('0x4')]('loginAttempts',0x0);}else{this[_0x0a9e('0x4')](_0x0a9e('0x55'),null);}}},'blockedAt':{'type':Sequelize[_0x0a9e('0x13')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'disabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index f390b2c..34621ed 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 _0x3d3d=['Tag','Tags','color','tag','nolimit','getQueues','Queue','getVoiceQueuesRt','ChatGroup','getGroups','getRecordings','VoiceRecording','UserId','getScreenRecordings','ScreenRecording','getChatInteractions','ChatInteraction','getOpenchannelInteractions','getMailInteractions','MailInteraction','getSmsInteractions','SmsInteraction','FaxInteraction','getFaxInteractions','login','mobile','LOCAL/%s@from-sip/n','intrf','user:%s','user:forcelogout','headers','x-forwarded-for','socket','remoteAddress','UserVoiceQueueRt','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','getVoiceQueues','push','each','MemberReport','update','all','getChannels','YYYY-MM-DD\x20HH:mm:ss','forEach','device','PAUSE','LOGININPAUSE','bulkCreate','concat','isMiddleware','logout','QueuePause','updateAttributes','type','DEFAULT\x20PAUSE','chatPause','faxPause','openchannelPause','smsPause','pauseType','lastPauseAt','unpause','mail','chat','sms','openchannel','manual','getTeams','Team','addTeams','omit','setDataValue','Voice','getChatQueues','Chat','getMailQueues','Mail','getSmsQueues','Sms','getFaxQueues','Fax','getOpenchannelQueues','Openchannel','flatten','transaction','addAgent','getDataValue','removeTeams','getLists','values','You\x20can\x27t\x20delete\x20yourself','addChatInteractions','spread','removeChatInteractions','user_has_chat_interactions:remove','addMailInteractions','user_has_mail_interactions:save','removeMailInteractions','isArray','user_has_mail_interactions:remove','addFaxInteractions','user_has_fax_interactions:save','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','user_has_sms_interactions:save','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','user_has_openchannel_interactions:save','user_has_openchannel_interactions:remove','VoicePrefix','getVoicePrefixes','getFaxAccounts','FaxAccount','addFaxAccounts','removeFaxAccounts','MailAccount','getMailAccounts','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','OpenchannelAccount','removeOpenchannelAccounts','SmsAccount','getSmsAccounts','addSmsAccounts','removeSmsAccounts','getChatWebsites','addChatWebsites','removeChatWebsites','getSquareProjects','SquareProject','addSquareProjects','removeSquareProjects','getScheduledCalls','CmHopper','$and','$or','$gte','$lt','$ne','$eq','$not','$between','$notBetween','$in','$notIn','$like','$iLike','$notILike','$contains','$contained','firstName','lastName','phone','Contact','dialActive','retrieveApiKey','No\x20API\x20access\x20key\x20found!','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','generateApiKey','iat','nonce','token','removeApiKey','apiKeyNonce','API\x20key\x20not\x20available','whoami','send','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','socket.io-emitter','register','jayson/promise','http','test','Sequelize','ValidationError','then','info','request\x20sent','debug','User,\x20%s,\x20%s,\x20%s','stringify','code','error','User,\x20%s,\x20%s','message','result','catch','sendStatus','end','status','json','count','offset','limit','apply','reject','save','destroy','get','user','Agents','agent','Telephones','telephone','filter','ignore','map','value','includes','role','find','name','UserProfileResource','stack','fieldName','key','model','differenceBy','salt','keys','filters','query','fields','attributes','length','order','sort','where','pick','merge','VIRTUAL','sequelize','lower','User','includeAll','rows','params','rawAttributes','password','intersection','include','options','body','describe','addContacts','agent\x20role','../../config/license/util','getLicense','users','License\x20limit\x20reached','format','count\x20%s:\x20%s','create','internal','min_internal','isNil','SELECT','from','mailbox','VoiceMail','fullname','email','permissions','103','110','104','105','106','107','108','109','100','111','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Setting','findOne','securePassword','newPassword','Invalid\x20body\x20format.\x20Use\x20oldPassord\x20and\x20newPassword','authenticate','oldPassword','Wrong\x20credentials','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','admin','addQueues','channel','online','loginInPause','voicePause','interface','isValidChannel','add','toLowerCase','Queues','capitalize','ids','emit','Queue:save','voice','VoiceQueue','findAll','SIP/%s','penalty','upsert','removeQueues','Unknown\x20channel','remove','QueueId','addAvatar','userpic','file','getAvatar','root','server/files/images/logos/default_profile.png','download','existsSync','join','getContacts','CmContact','hasOwnProperty','CmList','List'];(function(_0x2e18f1,_0x39de3a){var _0x1610c7=function(_0x15a7c8){while(--_0x15a7c8){_0x2e18f1['push'](_0x2e18f1['shift']());}};_0x1610c7(++_0x39de3a);}(_0x3d3d,0xab));var _0xd3d3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3d3d[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xd3d3('0x0'));var rimraf=require(_0xd3d3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd3d3('0x2'));var rp=require(_0xd3d3('0x3'));var moment=require(_0xd3d3('0x4'));var BPromise=require(_0xd3d3('0x5'));var Mustache=require(_0xd3d3('0x6'));var util=require(_0xd3d3('0x7'));var path=require(_0xd3d3('0x8'));var sox=require(_0xd3d3('0x9'));var csv=require(_0xd3d3('0xa'));var ejs=require(_0xd3d3('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xd3d3('0xc'));var crypto=require(_0xd3d3('0xd'));var jsforce=require(_0xd3d3('0xe'));var deskjs=require(_0xd3d3('0xf'));var toCsv=require('to-csv');var querystring=require(_0xd3d3('0x10'));var Papa=require(_0xd3d3('0x11'));var Redis=require(_0xd3d3('0x12'));var authService=require(_0xd3d3('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xd3d3('0x14'));var hardwareService=require(_0xd3d3('0x15'));var logger=require(_0xd3d3('0x16'))(_0xd3d3('0x17'));var utils=require(_0xd3d3('0x18'));var config=require(_0xd3d3('0x19'));var db=require('../../mysqldb')['db'];config[_0xd3d3('0x1a')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xd3d3('0x1b'))(new Redis(config['redis']));require('./user.socket')[_0xd3d3('0x1c')](socket);var jayson=require(_0xd3d3('0x1d'));var client=jayson['client'][_0xd3d3('0x1e')]({'port':0x232a});function checkPasswordPattern(_0x5419a0,_0x4c085d,_0x364bb3){if(_0x364bb3){var _0x531cb3=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x531cb3[_0xd3d3('0x1f')](_0x4c085d)){return _0x5419a0;}else{throw new db[(_0xd3d3('0x20'))][(_0xd3d3('0x21'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x5419a0;}}function respondWithRpcPromise(_0x214520,_0xa9ce6c,_0x4b663a,_0x4c18e3){return new BPromise(function(_0xd369a3,_0x39792f){var _0x14ee85=_0x4c18e3||client;return _0x14ee85['request'](_0x214520,_0x4b663a)[_0xd3d3('0x22')](function(_0x37fc96){logger[_0xd3d3('0x23')]('User,\x20%s,\x20%s',_0xa9ce6c,_0xd3d3('0x24'));logger[_0xd3d3('0x25')](_0xd3d3('0x26'),_0xa9ce6c,'request\x20sent',JSON[_0xd3d3('0x27')](_0x37fc96));if(_0x37fc96['error']){if(_0x37fc96['error'][_0xd3d3('0x28')]===0x1f4){logger[_0xd3d3('0x29')](_0xd3d3('0x2a'),_0xa9ce6c,_0x37fc96[_0xd3d3('0x29')]['message']);return _0x39792f(_0x37fc96[_0xd3d3('0x29')][_0xd3d3('0x2b')]);}logger[_0xd3d3('0x29')](_0xd3d3('0x2a'),_0xa9ce6c,_0x37fc96[_0xd3d3('0x29')][_0xd3d3('0x2b')]);return _0xd369a3(_0x37fc96[_0xd3d3('0x29')][_0xd3d3('0x2b')]);}else{logger[_0xd3d3('0x23')](_0xd3d3('0x2a'),_0xa9ce6c,_0xd3d3('0x24'));_0xd369a3(_0x37fc96[_0xd3d3('0x2c')]['message']);}})[_0xd3d3('0x2d')](function(_0x4ea56e){logger[_0xd3d3('0x29')](_0xd3d3('0x2a'),_0xa9ce6c,_0x4ea56e);_0x39792f(_0x4ea56e);});});}function respondWithStatusCode(_0x499da7,_0x106842){_0x106842=_0x106842||0xcc;return function(_0x1a1933){if(_0x1a1933){return _0x499da7[_0xd3d3('0x2e')](_0x106842);}return _0x499da7['status'](_0x106842)[_0xd3d3('0x2f')]();};}function respondWithResult(_0x3227e2,_0xcf96d3){_0xcf96d3=_0xcf96d3||0xc8;return function(_0x5b58d7){if(_0x5b58d7){return _0x3227e2[_0xd3d3('0x30')](_0xcf96d3)[_0xd3d3('0x31')](_0x5b58d7);}};}function respondWithFilteredResult(_0x1748c9,_0x349fad){return function(_0xd5ad91){if(_0xd5ad91){var _0x230be5=_0xd5ad91[_0xd3d3('0x32')],_0x325185=_0x349fad[_0xd3d3('0x33')],_0x22bcc9=_0x349fad[_0xd3d3('0x33')]+_0x349fad[_0xd3d3('0x34')],_0x9a03c5;if(_0x22bcc9>=_0x230be5){_0x22bcc9=_0x230be5;_0x9a03c5=0xc8;}else{_0x9a03c5=0xce;}_0x1748c9[_0xd3d3('0x30')](_0x9a03c5);return _0x1748c9['set']('Content-Range',_0x325185+'-'+_0x22bcc9+'/'+_0x230be5)[_0xd3d3('0x31')](_0xd5ad91);}return null;};}function patchUpdates(_0x4007de){return function(_0x50be0b){try{jsonpatch[_0xd3d3('0x35')](_0x50be0b,_0x4007de,!![]);}catch(_0x30c27e){return BPromise[_0xd3d3('0x36')](_0x30c27e);}return _0x50be0b[_0xd3d3('0x37')]();};}function saveUpdates(_0x427e32,_0x583d34){return function(_0x2c1473){if(_0x2c1473){return _0x2c1473['update'](_0x427e32)['then'](function(_0x41fd40){return _0x41fd40;});}return null;};}function removeEntity(_0x48e246,_0x308ead){return function(_0x5194f9){if(_0x5194f9){return _0x5194f9[_0xd3d3('0x38')]()[_0xd3d3('0x22')](function(){var _0x37432f=_0x5194f9[_0xd3d3('0x39')]({'plain':!![]});var _0x43ab07=[{'name':'Users','value':_0xd3d3('0x3a'),'ignore':!![]},{'name':_0xd3d3('0x3b'),'value':_0xd3d3('0x3c'),'ignore':![]},{'name':_0xd3d3('0x3d'),'value':_0xd3d3('0x3e'),'ignore':![]}];var _0x21e613=_(_0x43ab07)[_0xd3d3('0x3f')](_0xd3d3('0x40'))[_0xd3d3('0x41')]('value')[_0xd3d3('0x42')]();if(_[_0xd3d3('0x43')](_0x21e613,_0x37432f[_0xd3d3('0x44')])){return;}var _0x388505=_[_0xd3d3('0x45')](_0x43ab07,['value',_0x37432f['role']])[_0xd3d3('0x46')];return db[_0xd3d3('0x47')]['destroy']({'where':{'type':_0x388505,'resourceId':_0x37432f['id']}})[_0xd3d3('0x22')](function(){return _0x5194f9;});})[_0xd3d3('0x22')](function(){_0x48e246[_0xd3d3('0x30')](0xcc)[_0xd3d3('0x2f')]();});}};}function handleEntityNotFound(_0x149553,_0x14938c){return function(_0x1f8ba4){if(!_0x1f8ba4){_0x149553['sendStatus'](0x194);}return _0x1f8ba4;};}function handleError(_0x5f3513,_0x23c5c5){_0x23c5c5=_0x23c5c5||0x1f4;return function(_0x24f86a){logger[_0xd3d3('0x29')](_0x24f86a[_0xd3d3('0x48')]);if(_0x24f86a['name']){delete _0x24f86a['name'];}_0x5f3513['status'](_0x23c5c5)['send'](_0x24f86a);};}exports['index']=function(_0x57d151,_0x5bd282){var _0x5ef720={},_0x208af6={},_0x1344d5={'count':0x0,'rows':[]};var _0x367952=_[_0xd3d3('0x41')](db['User']['rawAttributes'],function(_0x50cb32){return{'name':_0x50cb32[_0xd3d3('0x49')],'type':_0x50cb32['type'][_0xd3d3('0x4a')]};});_0x208af6[_0xd3d3('0x4b')]=_[_0xd3d3('0x4c')](_[_0xd3d3('0x41')](_0x367952,_0xd3d3('0x46')),['password',_0xd3d3('0x4d')]);_0x208af6['query']=_[_0xd3d3('0x4e')](_0x57d151['query']);_0x208af6[_0xd3d3('0x4f')]=_['intersection'](_0x208af6[_0xd3d3('0x4b')],_0x208af6[_0xd3d3('0x50')]);_0x5ef720['attributes']=_['intersection'](_0x208af6[_0xd3d3('0x4b')],qs['fields'](_0x57d151[_0xd3d3('0x50')][_0xd3d3('0x51')]));_0x5ef720[_0xd3d3('0x52')]=_0x5ef720[_0xd3d3('0x52')][_0xd3d3('0x53')]?_0x5ef720['attributes']:_0x208af6[_0xd3d3('0x4b')];if(!_0x57d151[_0xd3d3('0x50')]['hasOwnProperty']('nolimit')){_0x5ef720[_0xd3d3('0x34')]=qs[_0xd3d3('0x34')](_0x57d151[_0xd3d3('0x50')][_0xd3d3('0x34')]);_0x5ef720[_0xd3d3('0x33')]=qs[_0xd3d3('0x33')](_0x57d151['query'][_0xd3d3('0x33')]);}_0x5ef720[_0xd3d3('0x54')]=qs[_0xd3d3('0x55')](_0x57d151[_0xd3d3('0x50')]['sort']);_0x5ef720[_0xd3d3('0x56')]=qs[_0xd3d3('0x4f')](_[_0xd3d3('0x57')](_0x57d151[_0xd3d3('0x50')],_0x208af6[_0xd3d3('0x4f')]));if(_0x57d151[_0xd3d3('0x50')][_0xd3d3('0x3f')]){_0x5ef720[_0xd3d3('0x56')]=_[_0xd3d3('0x58')](_0x5ef720[_0xd3d3('0x56')],{'$or':_[_0xd3d3('0x41')](_0x367952,function(_0x368aa6){if(_0x368aa6['type']!==_0xd3d3('0x59')){return db['sequelize'][_0xd3d3('0x56')](db[_0xd3d3('0x5a')]['fn'](_0xd3d3('0x5b'),db[_0xd3d3('0x5a')]['col'](_0x368aa6[_0xd3d3('0x46')])),{'$like':db[_0xd3d3('0x5a')]['fn'](_0xd3d3('0x5b'),'%'+_0x57d151[_0xd3d3('0x50')][_0xd3d3('0x3f')]+'%')});}})});}_0x5ef720=_[_0xd3d3('0x58')]({},_0x5ef720,_0x57d151['options']);var _0x215612={'where':_0x5ef720[_0xd3d3('0x56')]};return db[_0xd3d3('0x5c')][_0xd3d3('0x32')](_0x215612)[_0xd3d3('0x22')](function(_0x39abe8){_0x1344d5[_0xd3d3('0x32')]=_0x39abe8;if(_0x57d151[_0xd3d3('0x50')][_0xd3d3('0x5d')]){_0x5ef720['include']=[{'all':!![]}];}return db['User']['findAll'](_0x5ef720);})[_0xd3d3('0x22')](function(_0x17881c){_0x1344d5[_0xd3d3('0x5e')]=_0x17881c;return _0x1344d5;})[_0xd3d3('0x22')](respondWithFilteredResult(_0x5bd282,_0x5ef720))[_0xd3d3('0x2d')](handleError(_0x5bd282,null));};exports['show']=function(_0x1c5977,_0xd85d58){var _0x399410={'raw':![],'where':{'id':_0x1c5977[_0xd3d3('0x5f')]['id']}},_0x544224={};_0x544224['model']=_[_0xd3d3('0x4c')](_['keys'](db[_0xd3d3('0x5c')][_0xd3d3('0x60')]),[_0xd3d3('0x61'),_0xd3d3('0x4d')]);_0x544224[_0xd3d3('0x50')]=_['keys'](_0x1c5977[_0xd3d3('0x50')]);_0x544224['filters']=_[_0xd3d3('0x62')](_0x544224[_0xd3d3('0x4b')],_0x544224['query']);_0x399410[_0xd3d3('0x52')]=_[_0xd3d3('0x62')](_0x544224[_0xd3d3('0x4b')],qs[_0xd3d3('0x51')](_0x1c5977['query'][_0xd3d3('0x51')]));_0x399410[_0xd3d3('0x52')]=_0x399410[_0xd3d3('0x52')]['length']?_0x399410[_0xd3d3('0x52')]:_0x544224[_0xd3d3('0x4b')];if(_0x1c5977[_0xd3d3('0x50')][_0xd3d3('0x5d')]){_0x399410[_0xd3d3('0x63')]=[{'all':!![]}];}_0x399410=_[_0xd3d3('0x58')]({},_0x399410,_0x1c5977[_0xd3d3('0x64')]);return db['User']['find'](_0x399410)[_0xd3d3('0x22')](handleEntityNotFound(_0xd85d58,null))[_0xd3d3('0x22')](respondWithResult(_0xd85d58,null))[_0xd3d3('0x2d')](handleError(_0xd85d58,null));};exports['bulkCreate']=function(_0x1345bd,_0xce9533){return db[_0xd3d3('0x5c')]['bulkCreate'](_0x1345bd[_0xd3d3('0x65')],{'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0xce9533,0xc9))[_0xd3d3('0x2d')](handleError(_0xce9533,null));};exports['update']=function(_0x5daf01,_0x42733a){if(_0x5daf01[_0xd3d3('0x65')]['id']){delete _0x5daf01[_0xd3d3('0x65')]['id'];}delete _0x5daf01[_0xd3d3('0x65')][_0xd3d3('0x44')];return db[_0xd3d3('0x5c')][_0xd3d3('0x45')]({'where':{'id':_0x5daf01[_0xd3d3('0x5f')]['id']}})[_0xd3d3('0x22')](handleEntityNotFound(_0x42733a,null))[_0xd3d3('0x22')](saveUpdates(_0x5daf01[_0xd3d3('0x65')],null))[_0xd3d3('0x22')](respondWithResult(_0x42733a,null))[_0xd3d3('0x2d')](handleError(_0x42733a,null));};exports[_0xd3d3('0x66')]=function(_0x12c2c4,_0x37b726){return db[_0xd3d3('0x5c')][_0xd3d3('0x66')]()[_0xd3d3('0x22')](respondWithResult(_0x37b726,null))[_0xd3d3('0x2d')](handleError(_0x37b726,null));};exports[_0xd3d3('0x67')]=function(_0x1f188c,_0x44bbc5,_0x9a5d5b){return db[_0xd3d3('0x5c')]['find']({'where':{'id':_0x1f188c['params']['id']}})['then'](handleEntityNotFound(_0x44bbc5,null))['then'](function(_0x445689){if(_0x445689){return _0x445689['addContacts'](_0x1f188c[_0xd3d3('0x65')]['ids'],_['omit'](_0x1f188c[_0xd3d3('0x65')],['ids','id'])||{});}})[_0xd3d3('0x22')](respondWithResult(_0x44bbc5,null))[_0xd3d3('0x2d')](handleError(_0x44bbc5,null));};var getLicense=function(_0x4636cd){return new BPromise(function(_0x491410,_0x23419c){var _0x39ff59=0x0;_0x4636cd[_0xd3d3('0x65')][_0xd3d3('0x44')]==='agent'&&_0x491410(_0xd3d3('0x68'));return db[_0xd3d3('0x5c')][_0xd3d3('0x32')]({'where':{'$or':[{'role':_0x4636cd[_0xd3d3('0x65')][_0xd3d3('0x44')]===_0xd3d3('0x3e')?_0xd3d3('0x3e'):['admin',_0xd3d3('0x3a')]}]}})[_0xd3d3('0x22')](function(_0x427028){_0x39ff59=_0x427028;return require(_0xd3d3('0x69'))[_0xd3d3('0x6a')]();})['then'](function(_0x56eea4){var _0x365196=_0x4636cd[_0xd3d3('0x65')][_0xd3d3('0x44')]===_0xd3d3('0x3e')?'telephones':_0xd3d3('0x6b');if(!_['isNil'](_0x56eea4[_0x365196])&&_0x39ff59>=_0x56eea4[_0x365196]){return _0x23419c({'message':_0xd3d3('0x6c')});}return _0x491410(util[_0xd3d3('0x6d')](_0xd3d3('0x6e'),_0x365196,_0x39ff59));})[_0xd3d3('0x2d')](function(_0x2edcc0){return _0x23419c(_0x2edcc0);});});};exports[_0xd3d3('0x6f')]=function(_0x39cf73,_0x5183eb){return getLicense(_0x39cf73)[_0xd3d3('0x22')](function(_0x4f43e2){if(!_0x39cf73[_0xd3d3('0x65')][_0xd3d3('0x70')]){var _0x6c0f4b;return db['Setting']['findById'](0x1)[_0xd3d3('0x22')](function(_0x1b32a1){return checkPasswordPattern(_0x1b32a1,_0x39cf73[_0xd3d3('0x65')][_0xd3d3('0x61')],_0x1b32a1['securePassword']);})[_0xd3d3('0x22')](function(_0x5b0d8a){_0x6c0f4b=_0x5b0d8a[_0xd3d3('0x71')];return db[_0xd3d3('0x5c')]['max'](_0xd3d3('0x70'));})[_0xd3d3('0x22')](function(_0x1dd173){if(_[_0xd3d3('0x72')](_0x1dd173)){if(_0x6c0f4b){_0x39cf73['body'][_0xd3d3('0x70')]=_0x6c0f4b;}else{_0x39cf73['body'][_0xd3d3('0x70')]=0x1;}}else{if(_['isNil'](_0x6c0f4b)||_0x6c0f4b==_0x1dd173){_0x39cf73[_0xd3d3('0x65')][_0xd3d3('0x70')]=_0x1dd173+0x1;}else if(_0x6c0f4b>_0x1dd173){_0x39cf73['body'][_0xd3d3('0x70')]=_0x6c0f4b;}else{return db[_0xd3d3('0x5a')][_0xd3d3('0x50')]('select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)',{'type':db[_0xd3d3('0x5a')]['QueryTypes'][_0xd3d3('0x73')]})[_0xd3d3('0x22')](function(_0x5ea6ea){if(_0x5ea6ea&&_0x5ea6ea[_0xd3d3('0x53')]){for(var _0x284bf3=0x0,_0x377343=_0x5ea6ea[_0xd3d3('0x53')];_0x284bf3<_0x377343&&_[_0xd3d3('0x72')](_0x39cf73[_0xd3d3('0x65')]['internal']);_0x284bf3++){if(_0x6c0f4b<=_0x5ea6ea[_0x284bf3][_0xd3d3('0x74')]){_0x39cf73[_0xd3d3('0x65')][_0xd3d3('0x70')]=_0x5ea6ea[_0x284bf3][_0xd3d3('0x74')];}else if(_0x6c0f4b>_0x5ea6ea[_0x284bf3]['from']&&_0x6c0f4b<=_0x5ea6ea[_0x284bf3]['to']){_0x39cf73[_0xd3d3('0x65')][_0xd3d3('0x70')]=_0x6c0f4b;}}}if(_['isNil'](_0x39cf73[_0xd3d3('0x65')]['internal'])){_0x39cf73[_0xd3d3('0x65')][_0xd3d3('0x70')]=_0x1dd173+0x1;}});}}});}})[_0xd3d3('0x22')](function(){if(_0x39cf73[_0xd3d3('0x65')]['voicemail']){_0x39cf73[_0xd3d3('0x65')][_0xd3d3('0x75')]=_0x39cf73[_0xd3d3('0x65')]['internal'];_0x39cf73[_0xd3d3('0x65')][_0xd3d3('0x76')]={'mailbox':_0x39cf73[_0xd3d3('0x65')][_0xd3d3('0x70')],'password':_0x39cf73['body']['password'],'fullname':_0x39cf73[_0xd3d3('0x65')][_0xd3d3('0x77')],'email':_0x39cf73['body'][_0xd3d3('0x78')]};}if(_0x39cf73[_0xd3d3('0x65')]&&_0x39cf73[_0xd3d3('0x65')][_0xd3d3('0x44')]===_0xd3d3('0x3c')){_0x39cf73['body'][_0xd3d3('0x79')]=['101','102',_0xd3d3('0x7a'),_0xd3d3('0x7b'),_0xd3d3('0x7c'),_0xd3d3('0x7d'),_0xd3d3('0x7e'),_0xd3d3('0x7f'),_0xd3d3('0x80'),_0xd3d3('0x81'),_0xd3d3('0x82'),_0xd3d3('0x83')];}return db[_0xd3d3('0x5c')][_0xd3d3('0x6f')](_0x39cf73['body'],{'include':[{'model':db[_0xd3d3('0x76')],'as':_0xd3d3('0x76')}]});})[_0xd3d3('0x22')](function(_0x9de526){if(_0x39cf73[_0xd3d3('0x65')][_0xd3d3('0x44')]===_0xd3d3('0x3a'))return _0x9de526;var _0xa21f7a=_0x39cf73['user'][_0xd3d3('0x39')]({'plain':!![]});if(!_0xa21f7a)throw new Error(_0xd3d3('0x84'));if(_0xa21f7a[_0xd3d3('0x44')]===_0xd3d3('0x3a')){var _0x25e881=_0x9de526[_0xd3d3('0x39')]({'plain':!![]});var _0x487432=[{'name':_0xd3d3('0x3b'),'value':_0xd3d3('0x3c')},{'name':_0xd3d3('0x3d'),'value':_0xd3d3('0x3e')}];var _0x54223e=_['find'](_0x487432,[_0xd3d3('0x42'),_0x25e881[_0xd3d3('0x44')]])[_0xd3d3('0x46')];return db[_0xd3d3('0x85')][_0xd3d3('0x45')]({'where':{'name':_0x54223e,'userProfileId':_0xa21f7a['userProfileId']},'raw':!![]})[_0xd3d3('0x22')](function(_0x554812){if(_0x554812&&_0x554812[_0xd3d3('0x86')]===0x0){return db[_0xd3d3('0x47')]['create']({'name':_0x25e881[_0xd3d3('0x46')],'resourceId':_0x25e881['id'],'type':_0x554812[_0xd3d3('0x46')],'sectionId':_0x554812['id']},{})[_0xd3d3('0x22')](function(){return _0x9de526;});}else{return _0x9de526;}})[_0xd3d3('0x2d')](function(_0x2f9f29){logger['error'](_0xd3d3('0x87'),_0x2f9f29);throw _0x2f9f29;});}return _0x9de526;})['then'](respondWithResult(_0x5183eb,0xc9))[_0xd3d3('0x2d')](handleError(_0x5183eb,null));};exports['changePassword']=function(_0x547df0,_0x31ce96,_0x32d95b){var _0x12513d=![];if(_0x547df0[_0xd3d3('0x65')]['id']){delete _0x547df0[_0xd3d3('0x65')]['id'];}return db[_0xd3d3('0x88')][_0xd3d3('0x89')]({'attributes':['id',_0xd3d3('0x8a')]})[_0xd3d3('0x22')](function(_0x54569a){_0x12513d=_0x54569a['securePassword'];return db[_0xd3d3('0x5c')][_0xd3d3('0x45')]({'where':{'id':_0x547df0['params']['id']}});})[_0xd3d3('0x22')](function(_0x21ec03){if(_0x21ec03){if(_0x21ec03['id']==_0x547df0['user']['id']){if(!_0x547df0[_0xd3d3('0x65')]['oldPassword']||!_0x547df0[_0xd3d3('0x65')][_0xd3d3('0x8b')]){throw new db[(_0xd3d3('0x20'))][(_0xd3d3('0x21'))](_0xd3d3('0x8c'));}if(!_0x21ec03[_0xd3d3('0x8d')](_0x547df0['body'][_0xd3d3('0x8e')])){throw new db[(_0xd3d3('0x20'))]['ValidationError'](_0xd3d3('0x8f'));}if(_0x547df0[_0xd3d3('0x65')][_0xd3d3('0x8e')]==_0x547df0[_0xd3d3('0x65')][_0xd3d3('0x8b')]){throw new db[(_0xd3d3('0x20'))]['ValidationError'](_0xd3d3('0x90'));}return _0x21ec03;}else if(_0x547df0[_0xd3d3('0x3a')][_0xd3d3('0x44')]==_0xd3d3('0x91')){if(!_0x547df0[_0xd3d3('0x65')]['newPassword']){throw new db[(_0xd3d3('0x20'))][(_0xd3d3('0x21'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}return _0x21ec03;}else if(_0x547df0['user'][_0xd3d3('0x44')]=='user'){if(!_0x547df0[_0xd3d3('0x65')]['newPassword']){throw new db[(_0xd3d3('0x20'))][(_0xd3d3('0x21'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}if(_0x21ec03[_0xd3d3('0x44')]!=_0xd3d3('0x3c')){throw new db[(_0xd3d3('0x20'))][(_0xd3d3('0x21'))]('Unauthorized');}return _0x21ec03;}else{throw new db[(_0xd3d3('0x20'))][(_0xd3d3('0x21'))]('Unauthorized');}}return null;})[_0xd3d3('0x22')](handleEntityNotFound(_0x31ce96,null))[_0xd3d3('0x22')](function(_0x27c99b){return checkPasswordPattern(_0x27c99b,_0x547df0[_0xd3d3('0x65')][_0xd3d3('0x8b')],_0x12513d);})[_0xd3d3('0x22')](saveUpdates({'password':_0x547df0[_0xd3d3('0x65')][_0xd3d3('0x8b')],'passwordResetAt':_0x547df0[_0xd3d3('0x3a')]['id']==_0x547df0[_0xd3d3('0x5f')]['id']?moment():null},null))[_0xd3d3('0x22')](respondWithResult(_0x31ce96,null))[_0xd3d3('0x2d')](handleError(_0x31ce96,null));};exports[_0xd3d3('0x92')]=function(_0x440004,_0x167add,_0xb1bfa4){var _0x54d447=_0x440004[_0xd3d3('0x65')][_0xd3d3('0x93')];return db['User'][_0xd3d3('0x45')]({'where':{'id':_0x440004[_0xd3d3('0x5f')]['id']},'attributes':['id','name',_0xd3d3('0x44'),_0xd3d3('0x94'),_0xd3d3('0x95'),_0xd3d3('0x96'),_0xd3d3('0x97')]})['then'](handleEntityNotFound(_0x167add,null))[_0xd3d3('0x22')](function(_0x242e9c){if(_0x242e9c){if(!utils[_0xd3d3('0x98')](_0x54d447)){throw new db[(_0xd3d3('0x20'))]['ValidationError']('Unknown\x20channel');}return _0x242e9c[_0xd3d3('0x99')+_['capitalize'](_0x54d447[_0xd3d3('0x9a')]())+_0xd3d3('0x9b')](_0x440004[_0xd3d3('0x65')]['ids'],{'penalty':_0x440004['body']['penalty']||0x0})['spread'](function(_0xd69e4e){for(var _0x3507d9=0x0;_0x3507d9<_0x440004['body']['ids'][_0xd3d3('0x53')];_0x3507d9+=0x1){var _0x27cf21={'UserId':_0x440004['params']['id']};_0x27cf21[_[_0xd3d3('0x9c')](_0x54d447[_0xd3d3('0x9a')]())+'QueueId']=_0x440004[_0xd3d3('0x65')][_0xd3d3('0x9d')][_0x3507d9];socket[_0xd3d3('0x9e')](_0xd3d3('0x3a')+_[_0xd3d3('0x9c')](_0x54d447[_0xd3d3('0x9a')]())+_0xd3d3('0x9f'),_0x27cf21);}return _0xd69e4e;})['then'](function(){if(_0x54d447===_0xd3d3('0xa0')){return db[_0xd3d3('0xa1')][_0xd3d3('0xa2')]({'where':{'id':_0x440004['body'][_0xd3d3('0x9d')]||[]},'raw':!![],'attributes':['id',_0xd3d3('0x46')]});}})[_0xd3d3('0x22')](function(_0x359e34){var _0x5d779a=_0x242e9c[_0xd3d3('0x39')]({'plain':!![]});var _0x253201=[];if(_0x54d447===_0xd3d3('0xa0')&&_0x5d779a[_0xd3d3('0x44')]===_0xd3d3('0x3c')&&_0x5d779a['online']){for(var _0x5e5d82=0x0;_0x5e5d82<_0x359e34['length'];_0x5e5d82+=0x1){_0x253201['push']({'membername':_0x5d779a[_0xd3d3('0x46')],'UserId':_0x5d779a['id'],'queue_name':_0x359e34[_0x5e5d82][_0xd3d3('0x46')],'VoiceQueueId':_0x359e34[_0x5e5d82]['id'],'interface':_[_0xd3d3('0x72')](_0x5d779a[_0xd3d3('0x97')])?util[_0xd3d3('0x6d')](_0xd3d3('0xa3'),_0x5d779a[_0xd3d3('0x46')]):_0x5d779a[_0xd3d3('0x97')],'paused':_0x5d779a[_0xd3d3('0x96')]||![],'penalty':_0x440004[_0xd3d3('0x65')][_0xd3d3('0xa4')]||0x0});}return BPromise['each'](_0x253201,function(_0xb6c909){return db['UserVoiceQueueRt'][_0xd3d3('0xa5')](_0xb6c909);});}return _0x242e9c;});}})[_0xd3d3('0x22')](respondWithStatusCode(_0x167add,null))['catch'](handleError(_0x167add,null));};exports[_0xd3d3('0xa6')]=function(_0x3fbd66,_0x143988,_0x565a13){var _0x5b8444;return db['User'][_0xd3d3('0x45')]({'where':{'id':_0x3fbd66['params']['id']},'attributes':['id','name',_0xd3d3('0x44')]})['then'](handleEntityNotFound(_0x143988,null))[_0xd3d3('0x22')](function(_0x18547a){if(_0x18547a){_0x5b8444=_0x18547a;if(!_0x3fbd66[_0xd3d3('0x50')][_0xd3d3('0x93')]||!utils[_0xd3d3('0x98')](_0x3fbd66[_0xd3d3('0x50')]['channel'])){throw new db['Sequelize'][(_0xd3d3('0x21'))](_0xd3d3('0xa7'));}return _0x18547a[_0xd3d3('0xa8')+_['capitalize'](_0x3fbd66[_0xd3d3('0x50')][_0xd3d3('0x93')][_0xd3d3('0x9a')]())+_0xd3d3('0x9b')](_0x3fbd66[_0xd3d3('0x50')][_0xd3d3('0x9d')]);}})['then'](function(_0xd2f231){for(var _0x113912=0x0;_0x113912<_0x3fbd66['query'][_0xd3d3('0x9d')][_0xd3d3('0x53')];_0x113912+=0x1){var _0x3e05cd={'UserId':_0x3fbd66[_0xd3d3('0x5f')]['id']};_0x3e05cd[_[_0xd3d3('0x9c')](_0x3fbd66['query'][_0xd3d3('0x93')][_0xd3d3('0x9a')]())+_0xd3d3('0xa9')]=_0x3fbd66[_0xd3d3('0x50')][_0xd3d3('0x9d')][_0x113912];socket[_0xd3d3('0x9e')](_0xd3d3('0x3a')+_[_0xd3d3('0x9c')](_0x3fbd66[_0xd3d3('0x50')][_0xd3d3('0x93')][_0xd3d3('0x9a')]())+'Queue:remove',_0x3e05cd);}return _0xd2f231;})[_0xd3d3('0x22')](function(){if(_0x3fbd66[_0xd3d3('0x50')]['channel']===_0xd3d3('0xa0')){return db['UserVoiceQueueRt'][_0xd3d3('0x38')]({'where':{'UserId':_0x3fbd66[_0xd3d3('0x5f')]['id'],'VoiceQueueId':_0x3fbd66[_0xd3d3('0x50')][_0xd3d3('0x9d')]},'individualHooks':!![]})['then'](function(){return _0x5b8444;});}return _0x5b8444;})[_0xd3d3('0x22')](respondWithStatusCode(_0x143988,null))['catch'](handleError(_0x143988,null));};exports[_0xd3d3('0xaa')]=function(_0x35129e,_0x32d55f,_0x32333e){_0x35129e[_0xd3d3('0x65')][_0xd3d3('0xab')]=_0x35129e[_0xd3d3('0xac')]['filename'];return db[_0xd3d3('0x5c')][_0xd3d3('0x45')]({'where':{'id':_0x35129e['params']['id']}})['then'](handleEntityNotFound(_0x32d55f,null))[_0xd3d3('0x22')](saveUpdates(_0x35129e[_0xd3d3('0x65')],null))[_0xd3d3('0x22')](respondWithResult(_0x32d55f,null))[_0xd3d3('0x2d')](handleError(_0x32d55f,null));};exports[_0xd3d3('0xad')]=function(_0x415780,_0x35040d,_0x5d8697){var _0x1e2492=path['join'](config[_0xd3d3('0xae')],_0xd3d3('0xaf'));return db[_0xd3d3('0x5c')]['find']({'where':{'id':_0x415780[_0xd3d3('0x5f')]['id']},'attributes':['id','userpic'],'raw':!![]})['then'](handleEntityNotFound(_0x35040d,null))['then'](function(_0x449681){if(_0x449681){if(_[_0xd3d3('0x72')](_0x449681[_0xd3d3('0xab')])){return _0x35040d[_0xd3d3('0xb0')](_0x1e2492);}else{if(!fs[_0xd3d3('0xb1')](path['join'](config[_0xd3d3('0xae')],'server/files/images/',_0x449681[_0xd3d3('0xab')]))){return _0x35040d[_0xd3d3('0xb0')](_0x1e2492);}return _0x35040d['download'](path[_0xd3d3('0xb2')](config[_0xd3d3('0xae')],'server/files/images/',_0x449681['userpic']));}}})[_0xd3d3('0x2d')](handleError(_0x35040d,null));};exports[_0xd3d3('0xb3')]=function(_0x10a99e,_0x12df6f,_0x5bbe86){var _0x2e54e8={};var _0x1cadc6={};var _0x5db5b7;var _0x16adc5;return db['User'][_0xd3d3('0x89')]({'where':{'id':_0x10a99e[_0xd3d3('0x5f')]['id']}})['then'](handleEntityNotFound(_0x12df6f,null))[_0xd3d3('0x22')](function(_0x3dfb64){if(_0x3dfb64){_0x5db5b7=_0x3dfb64;_0x1cadc6[_0xd3d3('0x4b')]=_[_0xd3d3('0x4e')](db[_0xd3d3('0xb4')][_0xd3d3('0x60')]);_0x1cadc6['query']=_[_0xd3d3('0x4e')](_0x10a99e[_0xd3d3('0x50')]);_0x1cadc6[_0xd3d3('0x4f')]=_[_0xd3d3('0x62')](_0x1cadc6['model'],_0x1cadc6[_0xd3d3('0x50')]);_0x2e54e8[_0xd3d3('0x52')]=_[_0xd3d3('0x62')](_0x1cadc6[_0xd3d3('0x4b')],qs[_0xd3d3('0x51')](_0x10a99e[_0xd3d3('0x50')]['fields']));_0x2e54e8[_0xd3d3('0x52')]=_0x2e54e8['attributes'][_0xd3d3('0x53')]?_0x2e54e8[_0xd3d3('0x52')]:_0x1cadc6[_0xd3d3('0x4b')];_0x2e54e8['order']=qs[_0xd3d3('0x55')](_0x10a99e[_0xd3d3('0x50')][_0xd3d3('0x55')]);_0x2e54e8[_0xd3d3('0x56')]=qs['filters'](_[_0xd3d3('0x57')](_0x10a99e[_0xd3d3('0x50')],_0x1cadc6[_0xd3d3('0x4f')]));if(_0x10a99e[_0xd3d3('0x50')]['filter']){_0x2e54e8[_0xd3d3('0x56')]=_['merge'](_0x2e54e8['where'],{'$or':_[_0xd3d3('0x41')](_0x2e54e8[_0xd3d3('0x52')],function(_0x2627b3){var _0x4aa29d={};_0x4aa29d[_0x2627b3]={'$like':'%'+_0x10a99e[_0xd3d3('0x50')][_0xd3d3('0x3f')]+'%'};return _0x4aa29d;})});}_0x2e54e8=_[_0xd3d3('0x58')]({},_0x2e54e8,_0x10a99e[_0xd3d3('0x64')]);return _0x5db5b7[_0xd3d3('0xb3')](_0x2e54e8);}})[_0xd3d3('0x22')](function(_0x2fd04b){if(_0x2fd04b){_0x16adc5=_0x2fd04b[_0xd3d3('0x53')];if(_0x10a99e[_0xd3d3('0x50')][_0xd3d3('0xb5')](_0xd3d3('0x5d'))){_0x2e54e8[_0xd3d3('0x63')]=[{'model':db[_0xd3d3('0xb6')],'as':_0xd3d3('0xb7'),'required':![]},{'model':db[_0xd3d3('0xb8')],'as':_0xd3d3('0xb9'),'attributes':['id',_0xd3d3('0x46'),_0xd3d3('0xba')],'where':_0x10a99e[_0xd3d3('0x50')][_0xd3d3('0xbb')]?{'id':_0x10a99e['query'][_0xd3d3('0xbb')]}:undefined,'required':_0x10a99e['query'][_0xd3d3('0xbb')]?!![]:![]}];}if(!_0x10a99e[_0xd3d3('0x50')]['hasOwnProperty'](_0xd3d3('0xbc'))){_0x2e54e8[_0xd3d3('0x34')]=qs[_0xd3d3('0x34')](_0x10a99e[_0xd3d3('0x50')][_0xd3d3('0x34')]);_0x2e54e8['offset']=qs[_0xd3d3('0x33')](_0x10a99e[_0xd3d3('0x50')][_0xd3d3('0x33')]);}return _0x5db5b7['getContacts'](_0x2e54e8);}})[_0xd3d3('0x22')](function(_0x509325){if(_0x509325){return _0x509325?{'count':_0x16adc5,'rows':_0x509325}:null;}})['then'](respondWithResult(_0x12df6f,null))[_0xd3d3('0x2d')](handleError(_0x12df6f,null));};exports[_0xd3d3('0xbd')]=function(_0x1af9a3,_0xf250b5,_0xcd2678){var _0x2bb208;var _0x33f577;var _0x3c38d0={};var _0x375988;return db[_0xd3d3('0x5c')][_0xd3d3('0x89')]({'where':{'id':_0x1af9a3[_0xd3d3('0x5f')]['id']},'attributes':['id',_0xd3d3('0x46'),_0xd3d3('0x44')]})[_0xd3d3('0x22')](handleEntityNotFound(_0xf250b5,null))[_0xd3d3('0x22')](function(_0x3ab680){if(!utils['isValidChannel'](_0x1af9a3[_0xd3d3('0x50')][_0xd3d3('0x93')])){throw new db['Sequelize'][(_0xd3d3('0x21'))]('Unknown\x20channel');}_0x2bb208=_0x3ab680;var _0x44497d={};_0x44497d[_0xd3d3('0x4b')]=_[_0xd3d3('0x4e')](db[_['capitalize'](_0x1af9a3['query'][_0xd3d3('0x93')])+_0xd3d3('0xbe')][_0xd3d3('0x60')]);_0x44497d['query']=_[_0xd3d3('0x4e')](_0x1af9a3[_0xd3d3('0x50')]);_0x44497d[_0xd3d3('0x4f')]=_[_0xd3d3('0x62')](_0x44497d['model'],_0x44497d['query']);_0x3c38d0[_0xd3d3('0x52')]=_[_0xd3d3('0x62')](_0x44497d[_0xd3d3('0x4b')],qs['fields'](_0x1af9a3[_0xd3d3('0x50')][_0xd3d3('0x51')]));_0x3c38d0['attributes']=_0x3c38d0[_0xd3d3('0x52')][_0xd3d3('0x53')]?_0x3c38d0[_0xd3d3('0x52')]:_0x44497d[_0xd3d3('0x4b')];_0x3c38d0['order']=qs['sort'](_0x1af9a3[_0xd3d3('0x50')][_0xd3d3('0x55')]);_0x3c38d0[_0xd3d3('0x56')]=qs[_0xd3d3('0x4f')](_[_0xd3d3('0x57')](_0x1af9a3['query'],_0x44497d[_0xd3d3('0x4f')]));if(_0x1af9a3[_0xd3d3('0x50')][_0xd3d3('0x3f')]){_0x3c38d0[_0xd3d3('0x56')]=_[_0xd3d3('0x58')](_0x3c38d0[_0xd3d3('0x56')],{'$or':_[_0xd3d3('0x41')](_0x3c38d0[_0xd3d3('0x52')],function(_0x18a0ad){var _0x1f1b60={};_0x1f1b60[_0x18a0ad]={'$like':'%'+_0x1af9a3[_0xd3d3('0x50')][_0xd3d3('0x3f')]+'%'};return _0x1f1b60;})});}_0x3c38d0=_[_0xd3d3('0x58')]({},_0x3c38d0,_0x1af9a3[_0xd3d3('0x64')]);switch(_0x2bb208[_0xd3d3('0x44')]){case _0xd3d3('0x91'):return db[_['capitalize'](_0x1af9a3[_0xd3d3('0x50')][_0xd3d3('0x93')])+'Queue'][_0xd3d3('0xa2')](_0x3c38d0);case _0xd3d3('0x3a'):case _0xd3d3('0x3c'):return _0x2bb208[_0xd3d3('0x39')+_[_0xd3d3('0x9c')](_0x1af9a3[_0xd3d3('0x50')][_0xd3d3('0x93')])+_0xd3d3('0x9b')](_0x3c38d0);default:throw new db[(_0xd3d3('0x20'))]['ValidationError']('Unknown\x20role');}})[_0xd3d3('0x22')](function(_0x30c911){_0x375988=_0x30c911[_0xd3d3('0x53')];if(!_0x1af9a3[_0xd3d3('0x50')][_0xd3d3('0xb5')](_0xd3d3('0xbc'))){_0x3c38d0[_0xd3d3('0x34')]=qs[_0xd3d3('0x34')](_0x1af9a3[_0xd3d3('0x50')][_0xd3d3('0x34')]);_0x3c38d0[_0xd3d3('0x33')]=qs[_0xd3d3('0x33')](_0x1af9a3[_0xd3d3('0x50')][_0xd3d3('0x33')]);}switch(_0x2bb208[_0xd3d3('0x44')]){case _0xd3d3('0x91'):return db[_['capitalize'](_0x1af9a3['query'][_0xd3d3('0x93')])+'Queue'][_0xd3d3('0xa2')](_0x3c38d0);case _0xd3d3('0x3a'):case _0xd3d3('0x3c'):return _0x2bb208[_0xd3d3('0x39')+_[_0xd3d3('0x9c')](_0x1af9a3[_0xd3d3('0x50')][_0xd3d3('0x93')])+_0xd3d3('0x9b')](_0x3c38d0);}})[_0xd3d3('0x22')](function(_0x3e907b){return{'count':_0x375988,'rows':_0x3e907b};})[_0xd3d3('0x22')](respondWithResult(_0xf250b5,null))[_0xd3d3('0x2d')](handleError(_0xf250b5,null));};exports[_0xd3d3('0xbf')]=function(_0x28bff9,_0x312950,_0x9cc801){var _0x403568={};var _0x243ba1={};var _0x2d35ca;var _0xf6c1dc;return db[_0xd3d3('0x5c')][_0xd3d3('0x89')]({'where':{'id':_0x28bff9[_0xd3d3('0x5f')]['id']}})[_0xd3d3('0x22')](handleEntityNotFound(_0x312950,null))['then'](function(_0x59a4c7){if(_0x59a4c7){_0x2d35ca=_0x59a4c7;_0x243ba1['model']=_[_0xd3d3('0x4e')](db['UserVoiceQueueRt'][_0xd3d3('0x60')]);_0x243ba1['query']=_[_0xd3d3('0x4e')](_0x28bff9[_0xd3d3('0x50')]);_0x243ba1[_0xd3d3('0x4f')]=_[_0xd3d3('0x62')](_0x243ba1[_0xd3d3('0x4b')],_0x243ba1[_0xd3d3('0x50')]);_0x403568[_0xd3d3('0x52')]=_[_0xd3d3('0x62')](_0x243ba1['model'],qs[_0xd3d3('0x51')](_0x28bff9[_0xd3d3('0x50')]['fields']));_0x403568['attributes']=_0x403568['attributes'][_0xd3d3('0x53')]?_0x403568[_0xd3d3('0x52')]:_0x243ba1['model'];_0x403568[_0xd3d3('0x54')]=qs[_0xd3d3('0x55')](_0x28bff9['query'][_0xd3d3('0x55')]);_0x403568[_0xd3d3('0x56')]=qs[_0xd3d3('0x4f')](_[_0xd3d3('0x57')](_0x28bff9[_0xd3d3('0x50')],_0x243ba1[_0xd3d3('0x4f')]));if(_0x28bff9[_0xd3d3('0x50')]['filter']){_0x403568[_0xd3d3('0x56')]=_[_0xd3d3('0x58')](_0x403568[_0xd3d3('0x56')],{'$or':_['map'](_0x403568[_0xd3d3('0x52')],function(_0x17b574){var _0x148ddc={};_0x148ddc[_0x17b574]={'$like':'%'+_0x28bff9[_0xd3d3('0x50')]['filter']+'%'};return _0x148ddc;})});}_0x403568=_[_0xd3d3('0x58')]({},_0x403568,_0x28bff9[_0xd3d3('0x64')]);return _0x2d35ca[_0xd3d3('0xbf')](_0x403568);}})[_0xd3d3('0x22')](function(_0x189bd1){if(_0x189bd1){_0xf6c1dc=_0x189bd1[_0xd3d3('0x53')];if(!_0x28bff9['query']['hasOwnProperty'](_0xd3d3('0xbc'))){_0x403568['limit']=qs[_0xd3d3('0x34')](_0x28bff9[_0xd3d3('0x50')][_0xd3d3('0x34')]);_0x403568[_0xd3d3('0x33')]=qs['offset'](_0x28bff9[_0xd3d3('0x50')][_0xd3d3('0x33')]);}return _0x2d35ca[_0xd3d3('0xbf')](_0x403568);}})[_0xd3d3('0x22')](function(_0x55ffb1){if(_0x55ffb1){return _0x55ffb1?{'count':_0xf6c1dc,'rows':_0x55ffb1}:null;}})[_0xd3d3('0x22')](respondWithResult(_0x312950,null))[_0xd3d3('0x2d')](handleError(_0x312950,null));};exports['getGroups']=function(_0x2d05e9,_0x2a0ceb,_0x289ffb){var _0x14ae91={};var _0x1d66e4={};var _0x474ddc;var _0x28039b;return db['User'][_0xd3d3('0x89')]({'where':{'id':_0x2d05e9[_0xd3d3('0x5f')]['id']}})[_0xd3d3('0x22')](handleEntityNotFound(_0x2a0ceb,null))[_0xd3d3('0x22')](function(_0x986ad0){if(_0x986ad0){_0x474ddc=_0x986ad0;_0x1d66e4[_0xd3d3('0x4b')]=_[_0xd3d3('0x4e')](db[_0xd3d3('0xc0')][_0xd3d3('0x60')]);_0x1d66e4['query']=_[_0xd3d3('0x4e')](_0x2d05e9[_0xd3d3('0x50')]);_0x1d66e4[_0xd3d3('0x4f')]=_[_0xd3d3('0x62')](_0x1d66e4['model'],_0x1d66e4[_0xd3d3('0x50')]);_0x14ae91[_0xd3d3('0x52')]=_[_0xd3d3('0x62')](_0x1d66e4[_0xd3d3('0x4b')],qs['fields'](_0x2d05e9[_0xd3d3('0x50')][_0xd3d3('0x51')]));_0x14ae91['attributes']=_0x14ae91['attributes']['length']?_0x14ae91['attributes']:_0x1d66e4[_0xd3d3('0x4b')];_0x14ae91['order']=qs['sort'](_0x2d05e9['query'][_0xd3d3('0x55')]);_0x14ae91[_0xd3d3('0x56')]=qs[_0xd3d3('0x4f')](_['pick'](_0x2d05e9[_0xd3d3('0x50')],_0x1d66e4[_0xd3d3('0x4f')]));if(_0x2d05e9[_0xd3d3('0x50')][_0xd3d3('0x3f')]){_0x14ae91[_0xd3d3('0x56')]=_['merge'](_0x14ae91[_0xd3d3('0x56')],{'$or':_[_0xd3d3('0x41')](_0x14ae91[_0xd3d3('0x52')],function(_0x4ef42a){var _0x319852={};_0x319852[_0x4ef42a]={'$like':'%'+_0x2d05e9[_0xd3d3('0x50')]['filter']+'%'};return _0x319852;})});}_0x14ae91=_['merge']({},_0x14ae91,_0x2d05e9[_0xd3d3('0x64')]);return _0x474ddc[_0xd3d3('0xc1')](_0x14ae91);}})[_0xd3d3('0x22')](function(_0x132491){if(_0x132491){_0x28039b=_0x132491[_0xd3d3('0x53')];if(!_0x2d05e9[_0xd3d3('0x50')][_0xd3d3('0xb5')](_0xd3d3('0xbc'))){_0x14ae91[_0xd3d3('0x34')]=qs['limit'](_0x2d05e9[_0xd3d3('0x50')][_0xd3d3('0x34')]);_0x14ae91[_0xd3d3('0x33')]=qs[_0xd3d3('0x33')](_0x2d05e9[_0xd3d3('0x50')][_0xd3d3('0x33')]);}return _0x474ddc['getGroups'](_0x14ae91);}})['then'](function(_0x519b87){if(_0x519b87){return _0x519b87?{'count':_0x28039b,'rows':_0x519b87}:null;}})[_0xd3d3('0x22')](respondWithResult(_0x2a0ceb,null))[_0xd3d3('0x2d')](handleError(_0x2a0ceb,null));};exports[_0xd3d3('0xc2')]=function(_0x4d9787,_0x11609f,_0x4c8237){var _0x286df6={'raw':!![],'where':{}};var _0x51b5b3={};var _0x30c4ea={'count':0x0,'rows':[]};return db[_0xd3d3('0x5c')][_0xd3d3('0x89')]({'where':{'id':_0x4d9787[_0xd3d3('0x5f')]['id']}})['then'](handleEntityNotFound(_0x11609f,null))[_0xd3d3('0x22')](function(_0x5c7efe){if(_0x5c7efe){_0x51b5b3[_0xd3d3('0x4b')]=_['keys'](db[_0xd3d3('0xc3')][_0xd3d3('0x60')]);_0x51b5b3[_0xd3d3('0x50')]=_[_0xd3d3('0x4e')](_0x4d9787[_0xd3d3('0x50')]);_0x51b5b3[_0xd3d3('0x4f')]=_[_0xd3d3('0x62')](_0x51b5b3[_0xd3d3('0x4b')],_0x51b5b3['query']);_0x286df6['attributes']=_['intersection'](_0x51b5b3['model'],qs[_0xd3d3('0x51')](_0x4d9787[_0xd3d3('0x50')][_0xd3d3('0x51')]));_0x286df6[_0xd3d3('0x52')]=_0x286df6[_0xd3d3('0x52')][_0xd3d3('0x53')]?_0x286df6['attributes']:_0x51b5b3[_0xd3d3('0x4b')];if(!_0x4d9787[_0xd3d3('0x50')][_0xd3d3('0xb5')](_0xd3d3('0xbc'))){_0x286df6[_0xd3d3('0x34')]=qs['limit'](_0x4d9787[_0xd3d3('0x50')][_0xd3d3('0x34')]);_0x286df6[_0xd3d3('0x33')]=qs[_0xd3d3('0x33')](_0x4d9787[_0xd3d3('0x50')]['offset']);}_0x286df6[_0xd3d3('0x54')]=qs[_0xd3d3('0x55')](_0x4d9787[_0xd3d3('0x50')][_0xd3d3('0x55')]);_0x286df6[_0xd3d3('0x56')]=qs['filters'](_[_0xd3d3('0x57')](_0x4d9787[_0xd3d3('0x50')],_0x51b5b3[_0xd3d3('0x4f')]));_0x286df6['where'][_0xd3d3('0xc4')]=_0x5c7efe['id'];if(_0x4d9787[_0xd3d3('0x50')][_0xd3d3('0x3f')]){_0x286df6[_0xd3d3('0x56')]=_[_0xd3d3('0x58')](_0x286df6[_0xd3d3('0x56')],{'$or':_['map'](_0x286df6[_0xd3d3('0x52')],function(_0x2c793b){var _0x4780c9={};_0x4780c9[_0x2c793b]={'$like':'%'+_0x4d9787[_0xd3d3('0x50')]['filter']+'%'};return _0x4780c9;})});}_0x286df6=_[_0xd3d3('0x58')]({},_0x286df6,_0x4d9787[_0xd3d3('0x64')]);return db[_0xd3d3('0xc3')][_0xd3d3('0x32')]({'where':_0x286df6[_0xd3d3('0x56')]})[_0xd3d3('0x22')](function(_0x38a845){_0x30c4ea[_0xd3d3('0x32')]=_0x38a845;if(_0x4d9787[_0xd3d3('0x50')]['includeAll']){_0x286df6[_0xd3d3('0x63')]=[{'all':!![]}];}return db[_0xd3d3('0xc3')][_0xd3d3('0xa2')](_0x286df6);})[_0xd3d3('0x22')](function(_0x1c7c39){_0x30c4ea[_0xd3d3('0x5e')]=_0x1c7c39;return _0x30c4ea;});}})[_0xd3d3('0x22')](respondWithFilteredResult(_0x11609f,_0x286df6))['catch'](handleError(_0x11609f,null));};exports[_0xd3d3('0xc5')]=function(_0x45d4d3,_0x4896e2,_0x18d1bc){var _0x14c55a={'raw':!![],'where':{}};var _0x5b4754={};var _0x1db66a={'count':0x0,'rows':[]};return db[_0xd3d3('0x5c')][_0xd3d3('0x89')]({'where':{'id':_0x45d4d3[_0xd3d3('0x5f')]['id']}})['then'](handleEntityNotFound(_0x4896e2,null))[_0xd3d3('0x22')](function(_0x52cfa6){if(_0x52cfa6){_0x5b4754[_0xd3d3('0x4b')]=_['keys'](db[_0xd3d3('0xc6')][_0xd3d3('0x60')]);_0x5b4754['query']=_[_0xd3d3('0x4e')](_0x45d4d3[_0xd3d3('0x50')]);_0x5b4754[_0xd3d3('0x4f')]=_[_0xd3d3('0x62')](_0x5b4754[_0xd3d3('0x4b')],_0x5b4754[_0xd3d3('0x50')]);_0x14c55a['attributes']=_[_0xd3d3('0x62')](_0x5b4754[_0xd3d3('0x4b')],qs[_0xd3d3('0x51')](_0x45d4d3[_0xd3d3('0x50')]['fields']));_0x14c55a[_0xd3d3('0x52')]=_0x14c55a[_0xd3d3('0x52')]['length']?_0x14c55a[_0xd3d3('0x52')]:_0x5b4754[_0xd3d3('0x4b')];if(!_0x45d4d3[_0xd3d3('0x50')][_0xd3d3('0xb5')]('nolimit')){_0x14c55a[_0xd3d3('0x34')]=qs[_0xd3d3('0x34')](_0x45d4d3[_0xd3d3('0x50')][_0xd3d3('0x34')]);_0x14c55a[_0xd3d3('0x33')]=qs['offset'](_0x45d4d3[_0xd3d3('0x50')]['offset']);}_0x14c55a[_0xd3d3('0x54')]=qs[_0xd3d3('0x55')](_0x45d4d3[_0xd3d3('0x50')][_0xd3d3('0x55')]);_0x14c55a[_0xd3d3('0x56')]=qs[_0xd3d3('0x4f')](_[_0xd3d3('0x57')](_0x45d4d3[_0xd3d3('0x50')],_0x5b4754[_0xd3d3('0x4f')]));_0x14c55a[_0xd3d3('0x56')]['UserId']=_0x52cfa6['id'];if(_0x45d4d3[_0xd3d3('0x50')][_0xd3d3('0x3f')]){_0x14c55a[_0xd3d3('0x56')]=_['merge'](_0x14c55a[_0xd3d3('0x56')],{'$or':_[_0xd3d3('0x41')](_0x14c55a['attributes'],function(_0x4240dd){var _0x2c68b0={};_0x2c68b0[_0x4240dd]={'$like':'%'+_0x45d4d3[_0xd3d3('0x50')]['filter']+'%'};return _0x2c68b0;})});}_0x14c55a=_['merge']({},_0x14c55a,_0x45d4d3[_0xd3d3('0x64')]);return db['ScreenRecording'][_0xd3d3('0x32')]({'where':_0x14c55a[_0xd3d3('0x56')]})[_0xd3d3('0x22')](function(_0x2a5fe5){_0x1db66a[_0xd3d3('0x32')]=_0x2a5fe5;if(_0x45d4d3[_0xd3d3('0x50')][_0xd3d3('0x5d')]){_0x14c55a[_0xd3d3('0x63')]=[{'all':!![]}];}return db[_0xd3d3('0xc6')][_0xd3d3('0xa2')](_0x14c55a);})[_0xd3d3('0x22')](function(_0x554ef7){_0x1db66a['rows']=_0x554ef7;return _0x1db66a;});}})['then'](respondWithFilteredResult(_0x4896e2,_0x14c55a))['catch'](handleError(_0x4896e2,null));};exports[_0xd3d3('0xc7')]=function(_0x41499f,_0x1b10c3,_0x3ed252){var _0x1e80de={};var _0x155dd4={};var _0x4caa0b;var _0x15b719;return db['User']['findOne']({'where':{'id':_0x41499f[_0xd3d3('0x5f')]['id']}})[_0xd3d3('0x22')](handleEntityNotFound(_0x1b10c3,null))[_0xd3d3('0x22')](function(_0x224564){if(_0x224564){_0x4caa0b=_0x224564;_0x155dd4[_0xd3d3('0x4b')]=_[_0xd3d3('0x4e')](db[_0xd3d3('0xc8')][_0xd3d3('0x60')]);_0x155dd4['query']=_[_0xd3d3('0x4e')](_0x41499f[_0xd3d3('0x50')]);_0x155dd4['filters']=_[_0xd3d3('0x62')](_0x155dd4[_0xd3d3('0x4b')],_0x155dd4[_0xd3d3('0x50')]);_0x1e80de[_0xd3d3('0x52')]=_[_0xd3d3('0x62')](_0x155dd4[_0xd3d3('0x4b')],qs[_0xd3d3('0x51')](_0x41499f[_0xd3d3('0x50')][_0xd3d3('0x51')]));_0x1e80de[_0xd3d3('0x52')]=_0x1e80de[_0xd3d3('0x52')]['length']?_0x1e80de[_0xd3d3('0x52')]:_0x155dd4[_0xd3d3('0x4b')];_0x1e80de[_0xd3d3('0x54')]=qs['sort'](_0x41499f[_0xd3d3('0x50')][_0xd3d3('0x55')]);_0x1e80de['where']=qs['filters'](_['pick'](_0x41499f[_0xd3d3('0x50')],_0x155dd4[_0xd3d3('0x4f')]));if(_0x41499f[_0xd3d3('0x50')][_0xd3d3('0x3f')]){_0x1e80de['where']=_[_0xd3d3('0x58')](_0x1e80de[_0xd3d3('0x56')],{'$or':_[_0xd3d3('0x41')](_0x1e80de['attributes'],function(_0x422452){var _0x548179={};_0x548179[_0x422452]={'$like':'%'+_0x41499f[_0xd3d3('0x50')]['filter']+'%'};return _0x548179;})});}_0x1e80de=_[_0xd3d3('0x58')]({},_0x1e80de,_0x41499f[_0xd3d3('0x64')]);return _0x4caa0b[_0xd3d3('0xc7')](_0x1e80de);}})[_0xd3d3('0x22')](function(_0x459888){if(_0x459888){_0x15b719=_0x459888[_0xd3d3('0x53')];if(!_0x41499f[_0xd3d3('0x50')]['hasOwnProperty']('nolimit')){_0x1e80de[_0xd3d3('0x34')]=qs[_0xd3d3('0x34')](_0x41499f[_0xd3d3('0x50')]['limit']);_0x1e80de['offset']=qs[_0xd3d3('0x33')](_0x41499f[_0xd3d3('0x50')]['offset']);}return _0x4caa0b[_0xd3d3('0xc7')](_0x1e80de);}})[_0xd3d3('0x22')](function(_0x1268f0){if(_0x1268f0){return _0x1268f0?{'count':_0x15b719,'rows':_0x1268f0}:null;}})['then'](respondWithResult(_0x1b10c3,null))[_0xd3d3('0x2d')](handleError(_0x1b10c3,null));};exports[_0xd3d3('0xc9')]=function(_0x4cdcbe,_0x2b8c14,_0x4a9af1){var _0x35f9f9={};var _0x5554da={};var _0x1de157;var _0xfc5ef6;return db[_0xd3d3('0x5c')][_0xd3d3('0x89')]({'where':{'id':_0x4cdcbe[_0xd3d3('0x5f')]['id']}})[_0xd3d3('0x22')](handleEntityNotFound(_0x2b8c14,null))[_0xd3d3('0x22')](function(_0x3dbd5e){if(_0x3dbd5e){_0x1de157=_0x3dbd5e;_0x5554da['model']=_['keys'](db['OpenchannelInteraction'][_0xd3d3('0x60')]);_0x5554da[_0xd3d3('0x50')]=_[_0xd3d3('0x4e')](_0x4cdcbe[_0xd3d3('0x50')]);_0x5554da[_0xd3d3('0x4f')]=_['intersection'](_0x5554da['model'],_0x5554da[_0xd3d3('0x50')]);_0x35f9f9[_0xd3d3('0x52')]=_[_0xd3d3('0x62')](_0x5554da[_0xd3d3('0x4b')],qs[_0xd3d3('0x51')](_0x4cdcbe[_0xd3d3('0x50')][_0xd3d3('0x51')]));_0x35f9f9['attributes']=_0x35f9f9[_0xd3d3('0x52')][_0xd3d3('0x53')]?_0x35f9f9[_0xd3d3('0x52')]:_0x5554da[_0xd3d3('0x4b')];_0x35f9f9[_0xd3d3('0x54')]=qs[_0xd3d3('0x55')](_0x4cdcbe[_0xd3d3('0x50')][_0xd3d3('0x55')]);_0x35f9f9[_0xd3d3('0x56')]=qs[_0xd3d3('0x4f')](_[_0xd3d3('0x57')](_0x4cdcbe[_0xd3d3('0x50')],_0x5554da[_0xd3d3('0x4f')]));if(_0x4cdcbe[_0xd3d3('0x50')]['filter']){_0x35f9f9[_0xd3d3('0x56')]=_[_0xd3d3('0x58')](_0x35f9f9[_0xd3d3('0x56')],{'$or':_[_0xd3d3('0x41')](_0x35f9f9['attributes'],function(_0x207bfd){var _0x4c3d0a={};_0x4c3d0a[_0x207bfd]={'$like':'%'+_0x4cdcbe['query'][_0xd3d3('0x3f')]+'%'};return _0x4c3d0a;})});}_0x35f9f9=_[_0xd3d3('0x58')]({},_0x35f9f9,_0x4cdcbe[_0xd3d3('0x64')]);return _0x1de157[_0xd3d3('0xc9')](_0x35f9f9);}})[_0xd3d3('0x22')](function(_0x4a249d){if(_0x4a249d){_0xfc5ef6=_0x4a249d[_0xd3d3('0x53')];if(!_0x4cdcbe[_0xd3d3('0x50')]['hasOwnProperty'](_0xd3d3('0xbc'))){_0x35f9f9[_0xd3d3('0x34')]=qs[_0xd3d3('0x34')](_0x4cdcbe[_0xd3d3('0x50')]['limit']);_0x35f9f9[_0xd3d3('0x33')]=qs[_0xd3d3('0x33')](_0x4cdcbe[_0xd3d3('0x50')][_0xd3d3('0x33')]);}return _0x1de157[_0xd3d3('0xc9')](_0x35f9f9);}})[_0xd3d3('0x22')](function(_0x515eb6){if(_0x515eb6){return _0x515eb6?{'count':_0xfc5ef6,'rows':_0x515eb6}:null;}})[_0xd3d3('0x22')](respondWithResult(_0x2b8c14,null))[_0xd3d3('0x2d')](handleError(_0x2b8c14,null));};exports[_0xd3d3('0xca')]=function(_0x20cc7f,_0x4fa098,_0x227c18){var _0x48fbeb={'raw':!![],'where':{}};var _0x3134b8={};var _0x1f3b2a={'count':0x0,'rows':[]};return db[_0xd3d3('0x5c')]['findOne']({'where':{'id':_0x20cc7f[_0xd3d3('0x5f')]['id']}})[_0xd3d3('0x22')](handleEntityNotFound(_0x4fa098,null))[_0xd3d3('0x22')](function(_0x5c800c){if(_0x5c800c){_0x3134b8[_0xd3d3('0x4b')]=_[_0xd3d3('0x4e')](db[_0xd3d3('0xcb')][_0xd3d3('0x60')]);_0x3134b8[_0xd3d3('0x50')]=_[_0xd3d3('0x4e')](_0x20cc7f[_0xd3d3('0x50')]);_0x3134b8[_0xd3d3('0x4f')]=_[_0xd3d3('0x62')](_0x3134b8[_0xd3d3('0x4b')],_0x3134b8[_0xd3d3('0x50')]);_0x48fbeb['attributes']=_[_0xd3d3('0x62')](_0x3134b8[_0xd3d3('0x4b')],qs[_0xd3d3('0x51')](_0x20cc7f['query'][_0xd3d3('0x51')]));_0x48fbeb[_0xd3d3('0x52')]=_0x48fbeb[_0xd3d3('0x52')]['length']?_0x48fbeb[_0xd3d3('0x52')]:_0x3134b8['model'];if(!_0x20cc7f[_0xd3d3('0x50')][_0xd3d3('0xb5')](_0xd3d3('0xbc'))){_0x48fbeb['limit']=qs[_0xd3d3('0x34')](_0x20cc7f[_0xd3d3('0x50')][_0xd3d3('0x34')]);_0x48fbeb[_0xd3d3('0x33')]=qs[_0xd3d3('0x33')](_0x20cc7f['query'][_0xd3d3('0x33')]);}_0x48fbeb[_0xd3d3('0x54')]=qs['sort'](_0x20cc7f[_0xd3d3('0x50')][_0xd3d3('0x55')]);_0x48fbeb[_0xd3d3('0x56')]=qs[_0xd3d3('0x4f')](_[_0xd3d3('0x57')](_0x20cc7f[_0xd3d3('0x50')],_0x3134b8[_0xd3d3('0x4f')]));_0x48fbeb['where'][_0xd3d3('0xc4')]=_0x5c800c['id'];if(_0x20cc7f[_0xd3d3('0x50')][_0xd3d3('0x3f')]){_0x48fbeb[_0xd3d3('0x56')]=_[_0xd3d3('0x58')](_0x48fbeb[_0xd3d3('0x56')],{'$or':_['map'](_0x48fbeb[_0xd3d3('0x52')],function(_0x1ece14){var _0xb87eea={};_0xb87eea[_0x1ece14]={'$like':'%'+_0x20cc7f[_0xd3d3('0x50')][_0xd3d3('0x3f')]+'%'};return _0xb87eea;})});}_0x48fbeb=_[_0xd3d3('0x58')]({},_0x48fbeb,_0x20cc7f['options']);return db[_0xd3d3('0xcb')][_0xd3d3('0x32')]({'where':_0x48fbeb['where']})[_0xd3d3('0x22')](function(_0x2c90b4){_0x1f3b2a['count']=_0x2c90b4;if(_0x20cc7f['query'][_0xd3d3('0x5d')]){_0x48fbeb[_0xd3d3('0x63')]=[{'all':!![]}];}return db[_0xd3d3('0xcb')][_0xd3d3('0xa2')](_0x48fbeb);})['then'](function(_0x5e501a){_0x1f3b2a[_0xd3d3('0x5e')]=_0x5e501a;return _0x1f3b2a;});}})[_0xd3d3('0x22')](respondWithFilteredResult(_0x4fa098,_0x48fbeb))[_0xd3d3('0x2d')](handleError(_0x4fa098,null));};exports[_0xd3d3('0xcc')]=function(_0x1021f2,_0x4c993f,_0xadc429){var _0x54184a={};var _0xd67b8a={};var _0x3d2f63;var _0x124949;return db['User'][_0xd3d3('0x89')]({'where':{'id':_0x1021f2['params']['id']}})[_0xd3d3('0x22')](handleEntityNotFound(_0x4c993f,null))[_0xd3d3('0x22')](function(_0x273031){if(_0x273031){_0x3d2f63=_0x273031;_0xd67b8a['model']=_['keys'](db[_0xd3d3('0xcd')][_0xd3d3('0x60')]);_0xd67b8a[_0xd3d3('0x50')]=_[_0xd3d3('0x4e')](_0x1021f2[_0xd3d3('0x50')]);_0xd67b8a[_0xd3d3('0x4f')]=_[_0xd3d3('0x62')](_0xd67b8a['model'],_0xd67b8a[_0xd3d3('0x50')]);_0x54184a['attributes']=_['intersection'](_0xd67b8a[_0xd3d3('0x4b')],qs['fields'](_0x1021f2[_0xd3d3('0x50')][_0xd3d3('0x51')]));_0x54184a[_0xd3d3('0x52')]=_0x54184a[_0xd3d3('0x52')][_0xd3d3('0x53')]?_0x54184a[_0xd3d3('0x52')]:_0xd67b8a['model'];_0x54184a[_0xd3d3('0x54')]=qs[_0xd3d3('0x55')](_0x1021f2['query'][_0xd3d3('0x55')]);_0x54184a[_0xd3d3('0x56')]=qs['filters'](_[_0xd3d3('0x57')](_0x1021f2['query'],_0xd67b8a[_0xd3d3('0x4f')]));if(_0x1021f2[_0xd3d3('0x50')][_0xd3d3('0x3f')]){_0x54184a[_0xd3d3('0x56')]=_[_0xd3d3('0x58')](_0x54184a[_0xd3d3('0x56')],{'$or':_[_0xd3d3('0x41')](_0x54184a[_0xd3d3('0x52')],function(_0x39222){var _0x520fc5={};_0x520fc5[_0x39222]={'$like':'%'+_0x1021f2['query']['filter']+'%'};return _0x520fc5;})});}_0x54184a=_[_0xd3d3('0x58')]({},_0x54184a,_0x1021f2[_0xd3d3('0x64')]);return _0x3d2f63[_0xd3d3('0xcc')](_0x54184a);}})[_0xd3d3('0x22')](function(_0x5f4490){if(_0x5f4490){_0x124949=_0x5f4490[_0xd3d3('0x53')];if(!_0x1021f2[_0xd3d3('0x50')][_0xd3d3('0xb5')](_0xd3d3('0xbc'))){_0x54184a[_0xd3d3('0x34')]=qs[_0xd3d3('0x34')](_0x1021f2[_0xd3d3('0x50')][_0xd3d3('0x34')]);_0x54184a[_0xd3d3('0x33')]=qs[_0xd3d3('0x33')](_0x1021f2['query']['offset']);}return _0x3d2f63[_0xd3d3('0xcc')](_0x54184a);}})[_0xd3d3('0x22')](function(_0x29ed43){if(_0x29ed43){return _0x29ed43?{'count':_0x124949,'rows':_0x29ed43}:null;}})[_0xd3d3('0x22')](respondWithResult(_0x4c993f,null))['catch'](handleError(_0x4c993f,null));};exports['getFaxInteractions']=function(_0x2f1f94,_0x15bf85,_0x207ee7){var _0x414ca4={};var _0x1e514f={};var _0x29441a;var _0x591dcc;return db['User'][_0xd3d3('0x89')]({'where':{'id':_0x2f1f94[_0xd3d3('0x5f')]['id']}})[_0xd3d3('0x22')](handleEntityNotFound(_0x15bf85,null))['then'](function(_0x50eff6){if(_0x50eff6){_0x29441a=_0x50eff6;_0x1e514f[_0xd3d3('0x4b')]=_[_0xd3d3('0x4e')](db[_0xd3d3('0xce')][_0xd3d3('0x60')]);_0x1e514f[_0xd3d3('0x50')]=_[_0xd3d3('0x4e')](_0x2f1f94[_0xd3d3('0x50')]);_0x1e514f['filters']=_[_0xd3d3('0x62')](_0x1e514f[_0xd3d3('0x4b')],_0x1e514f['query']);_0x414ca4[_0xd3d3('0x52')]=_[_0xd3d3('0x62')](_0x1e514f['model'],qs['fields'](_0x2f1f94[_0xd3d3('0x50')]['fields']));_0x414ca4[_0xd3d3('0x52')]=_0x414ca4[_0xd3d3('0x52')]['length']?_0x414ca4[_0xd3d3('0x52')]:_0x1e514f[_0xd3d3('0x4b')];_0x414ca4[_0xd3d3('0x54')]=qs[_0xd3d3('0x55')](_0x2f1f94['query'][_0xd3d3('0x55')]);_0x414ca4[_0xd3d3('0x56')]=qs[_0xd3d3('0x4f')](_['pick'](_0x2f1f94[_0xd3d3('0x50')],_0x1e514f[_0xd3d3('0x4f')]));if(_0x2f1f94[_0xd3d3('0x50')][_0xd3d3('0x3f')]){_0x414ca4[_0xd3d3('0x56')]=_['merge'](_0x414ca4['where'],{'$or':_['map'](_0x414ca4[_0xd3d3('0x52')],function(_0x352ddb){var _0x12296e={};_0x12296e[_0x352ddb]={'$like':'%'+_0x2f1f94[_0xd3d3('0x50')][_0xd3d3('0x3f')]+'%'};return _0x12296e;})});}_0x414ca4=_['merge']({},_0x414ca4,_0x2f1f94[_0xd3d3('0x64')]);return _0x29441a['getFaxInteractions'](_0x414ca4);}})[_0xd3d3('0x22')](function(_0x58945a){if(_0x58945a){_0x591dcc=_0x58945a['length'];if(!_0x2f1f94['query'][_0xd3d3('0xb5')]('nolimit')){_0x414ca4[_0xd3d3('0x34')]=qs[_0xd3d3('0x34')](_0x2f1f94[_0xd3d3('0x50')][_0xd3d3('0x34')]);_0x414ca4[_0xd3d3('0x33')]=qs[_0xd3d3('0x33')](_0x2f1f94[_0xd3d3('0x50')][_0xd3d3('0x33')]);}return _0x29441a[_0xd3d3('0xcf')](_0x414ca4);}})[_0xd3d3('0x22')](function(_0x452aaf){if(_0x452aaf){return _0x452aaf?{'count':_0x591dcc,'rows':_0x452aaf}:null;}})[_0xd3d3('0x22')](respondWithResult(_0x15bf85,null))[_0xd3d3('0x2d')](handleError(_0x15bf85,null));};exports[_0xd3d3('0xd0')]=function(_0x56b834,_0x5ac6aa,_0x349856){var _0x6ceb08;var _0x154365;var _0x56ec4d;var _0x716f54=!_[_0xd3d3('0x72')](_0x56b834['params']['id'])?_0x56b834['params']['id']:!_['isNil'](_0x56b834[_0xd3d3('0x3a')]['id'])?_0x56b834[_0xd3d3('0x3a')]['id']:null;return db[_0xd3d3('0x5c')][_0xd3d3('0x45')]({'where':{'id':_0x716f54,'role':{'$or':[_0xd3d3('0x91'),_0xd3d3('0x3a'),_0xd3d3('0x3c')]}},'attributes':['id',_0xd3d3('0x46'),'phone',_0xd3d3('0xd1'),'role',_0xd3d3('0x70'),_0xd3d3('0x95')]})[_0xd3d3('0x22')](function(_0x2980a0){if(_0x2980a0){if(_0x2980a0['role']===_0xd3d3('0x3c')){_0x6ceb08=_0x2980a0;if(_0x56b834[_0xd3d3('0x65')][_0xd3d3('0x97')]){_0x56ec4d=util[_0xd3d3('0x6d')](_0xd3d3('0xd2'),_0x6ceb08[_0x56b834[_0xd3d3('0x65')][_0xd3d3('0x97')]]);}else if(_0x56b834[_0xd3d3('0x65')][_0xd3d3('0xd3')]){_0x56ec4d=util['format'](_0xd3d3('0xa3'),_0x56b834[_0xd3d3('0x65')]['intrf']);}else{_0x56ec4d=util[_0xd3d3('0x6d')](_0xd3d3('0xa3'),_0x6ceb08[_0xd3d3('0x46')]);}socket['to'](util[_0xd3d3('0x6d')](_0xd3d3('0xd4'),_0x6ceb08[_0xd3d3('0x46')]))[_0xd3d3('0x9e')](_0xd3d3('0xd5'),{'ip':_0x56b834[_0xd3d3('0xd6')][_0xd3d3('0xd7')]||_0x56b834['connection']['remoteAddress']||_0x56b834[_0xd3d3('0xd8')][_0xd3d3('0xd9')]||_0x56b834['connection'][_0xd3d3('0xd8')][_0xd3d3('0xd9')]});return db[_0xd3d3('0xda')]['destroy']({'where':{'membername':_0x6ceb08['name']},'individualHooks':!![]});}}else{throw new db['Sequelize'][(_0xd3d3('0x21'))](_0xd3d3('0xdb'));}})[_0xd3d3('0x22')](function(){if(_0x6ceb08){return _0x6ceb08[_0xd3d3('0xdc')]({'raw':!![]});}})['then'](function(_0x5e5a01){if(_0x6ceb08){var _0x409d39=[];if(_0x5e5a01){_0x154365=_0x5e5a01;if(_0x154365['length']){for(var _0xecec5b=0x0;_0xecec5b<_0x154365[_0xd3d3('0x53')];_0xecec5b++){_0x409d39[_0xd3d3('0xdd')]({'membername':_0x6ceb08['name'],'UserId':_0x6ceb08['id'],'queue_name':_0x154365[_0xecec5b][_0xd3d3('0x46')],'VoiceQueueId':_0x154365[_0xecec5b]['id'],'interface':_0x56ec4d,'paused':_0x6ceb08['loginInPause']||![],'penalty':_0x154365[_0xecec5b]['UserVoiceQueue.penalty']||0x0});}return BPromise[_0xd3d3('0xde')](_0x409d39,function(_0x2ee3c5){return db[_0xd3d3('0xda')][_0xd3d3('0xa5')](_0x2ee3c5);});}}}})[_0xd3d3('0x22')](function(){if(_0x6ceb08){return db[_0xd3d3('0xdf')][_0xd3d3('0xa2')]({'where':{'membername':_0x6ceb08[_0xd3d3('0x46')],'exitAt':null}});}})['then'](function(_0x2aa832){if(_0x6ceb08){var _0x149d87=[];_0x2aa832['forEach'](function(_0x2e1f6a){_0x149d87[_0xd3d3('0xdd')](_0x2e1f6a[_0xd3d3('0xe0')]({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0xd3d3('0xe1')](_0x149d87);}})[_0xd3d3('0x22')](function(){if(_0x6ceb08){var _0x2ff598=[];var _0x5cf318=[];var _0x318186=utils[_0xd3d3('0xe2')]();var _0x2fbb39={'membername':_0x6ceb08[_0xd3d3('0x46')],'interface':_0x56ec4d,'enterAt':moment()[_0xd3d3('0x6d')](_0xd3d3('0xe3')),'role':_0x6ceb08[_0xd3d3('0x44')],'internal':_0x6ceb08[_0xd3d3('0x70')]};_0x318186[_0xd3d3('0xe4')](function(_0x11fba7){_0x2ff598[_0xd3d3('0xdd')](_['merge']({'channel':_0x11fba7,'type':'LOGIN','data1':_0x56b834[_0xd3d3('0x65')][_0xd3d3('0xe5')],'data2':_0x56ec4d},_0x2fbb39));if(_0x6ceb08[_0xd3d3('0x95')]){_0x5cf318[_0xd3d3('0xdd')](_[_0xd3d3('0x58')]({'channel':_0x11fba7,'type':_0xd3d3('0xe6'),'data1':_0xd3d3('0xe7')},_0x2fbb39));}});return db[_0xd3d3('0xdf')][_0xd3d3('0xe8')](_0x2ff598[_0xd3d3('0xe9')](_0x5cf318),{'individualHooks':!![]});}})['then'](function(){if(_0x6ceb08){return _0x6ceb08[_0xd3d3('0xe0')]({'online':!![],'lastLoginAt':moment()[_0xd3d3('0x6d')](_0xd3d3('0xe3')),'voicePause':_0x6ceb08[_0xd3d3('0x95')]||![],'mailPause':_0x6ceb08[_0xd3d3('0x95')]||![],'chatPause':_0x6ceb08[_0xd3d3('0x95')]||![],'faxPause':_0x6ceb08['loginInPause']||![],'smsPause':_0x6ceb08[_0xd3d3('0x95')]||![],'openchannelPause':_0x6ceb08[_0xd3d3('0x95')]||![],'pauseType':_0x6ceb08['loginInPause']?'LOGININPAUSE':null,'interface':_0x56ec4d,'lastPauseAt':moment()['format'](_0xd3d3('0xe3'))});}})[_0xd3d3('0x22')](function(_0x1341f8){if(_0x56b834[_0xd3d3('0xea')]){return _0x349856();}else{return BPromise['resolve'](_0x1341f8)[_0xd3d3('0x22')](respondWithResult(_0x5ac6aa,null));}})['catch'](handleError(_0x5ac6aa,null));};exports[_0xd3d3('0xeb')]=function(_0x58a2a5,_0x33876f,_0x2a4166){var _0x1bc599;return db[_0xd3d3('0x5c')][_0xd3d3('0x45')]({'where':{'id':_0x58a2a5[_0xd3d3('0x5f')]['id'],'role':'agent'},'attributes':['id',_0xd3d3('0x46'),_0xd3d3('0x44')]})[_0xd3d3('0x22')](handleEntityNotFound(_0x33876f,null))[_0xd3d3('0x22')](function(_0x156125){if(_0x156125){_0x1bc599=_0x156125;return db['UserVoiceQueueRt']['destroy']({'where':{'membername':_0x1bc599[_0xd3d3('0x46')]},'individualHooks':!![]});}})[_0xd3d3('0x22')](function(){return db['MemberReport'][_0xd3d3('0xa2')]({'where':{'membername':_0x1bc599['name'],'exitAt':null}});})['then'](function(_0x94475f){var _0x1445c8=[];_0x94475f[_0xd3d3('0xe4')](function(_0x440497){_0x1445c8[_0xd3d3('0xdd')](_0x440497[_0xd3d3('0xe0')]({'exitAt':moment()[_0xd3d3('0x6d')](_0xd3d3('0xe3'))}));});return BPromise[_0xd3d3('0xe1')](_0x1445c8);})[_0xd3d3('0x22')](function(){return _0x1bc599[_0xd3d3('0xe0')]({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'interface':null});})['then'](respondWithResult(_0x33876f,null))[_0xd3d3('0x2d')](handleError(_0x33876f,null));};exports['pause']=function(_0x338913,_0x20fa04,_0x3587fe){var _0x491bf2;return db['UserVoiceQueueRt'][_0xd3d3('0xe0')]({'paused':0x1},{'where':{'UserId':_0x338913['params']['id']},'individualHooks':!![]})[_0xd3d3('0x22')](function(){return db[_0xd3d3('0x5c')]['find']({'where':{'id':_0x338913[_0xd3d3('0x5f')]['id'],'role':_0xd3d3('0x3c')},'attributes':['id',_0xd3d3('0x46'),_0xd3d3('0x44'),'internal','interface']});})['then'](handleEntityNotFound(_0x20fa04,null))[_0xd3d3('0x22')](function(_0x174671){if(_0x174671){_0x491bf2=_0x174671;return respondWithRpcPromise(_0xd3d3('0xec'),'pause',{'id':_0x491bf2['id'],'name':_0x491bf2[_0xd3d3('0x46')],'pause':!![]});}})[_0xd3d3('0x22')](function(){if(_0x491bf2){return db[_0xd3d3('0xdf')][_0xd3d3('0xa2')]({'where':{'membername':_0x491bf2[_0xd3d3('0x46')],'type':_0xd3d3('0xe6'),'exitAt':null}});}})[_0xd3d3('0x22')](function(_0x59e977){if(_0x59e977['length']){var _0x24f03c=moment()[_0xd3d3('0x6d')](_0xd3d3('0xe3'));for(var _0x119ad5=0x0,_0x47c810=_0x59e977[_0xd3d3('0x53')];_0x119ad5<_0x47c810;_0x119ad5++){_0x59e977[_0x119ad5][_0xd3d3('0xed')]({'exitAt':_0x24f03c});}}})[_0xd3d3('0x22')](function(){var _0x4a875c=[];var _0xc17792=utils[_0xd3d3('0xe2')]();_0xc17792['forEach'](function(_0x4c38ca){_0x4a875c[_0xd3d3('0xdd')]({'channel':_0x4c38ca,'membername':_0x491bf2[_0xd3d3('0x46')],'interface':_['isNil'](_0x491bf2[_0xd3d3('0x97')])?util[_0xd3d3('0x6d')](_0xd3d3('0xa3'),_0x491bf2[_0xd3d3('0x46')]):_0x491bf2[_0xd3d3('0x97')],'type':_0xd3d3('0xe6'),'enterAt':moment()[_0xd3d3('0x6d')]('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x338913[_0xd3d3('0x65')][_0xd3d3('0xee')]||_0xd3d3('0xef'),'role':_0x491bf2[_0xd3d3('0x44')],'internal':_0x491bf2['internal']});});return db[_0xd3d3('0xdf')][_0xd3d3('0xe8')](_0x4a875c,{'individualHooks':!![]});})['then'](function(){return _0x491bf2[_0xd3d3('0xe0')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'pauseType':_0x338913[_0xd3d3('0x65')][_0xd3d3('0xee')]||_0xd3d3('0xef'),'lastPauseAt':moment()['format'](_0xd3d3('0xe3'))});})['then'](respondWithResult(_0x20fa04,null))[_0xd3d3('0x2d')](handleError(_0x20fa04,null));};exports['unpause']=function(_0x5bf9c0,_0x19d9c0,_0x12ae2e){var _0x2bb5d2;return db[_0xd3d3('0x5c')][_0xd3d3('0x45')]({'where':{'id':_0x5bf9c0['params']['id']},'attributes':['id','name',_0xd3d3('0x44'),_0xd3d3('0x96'),'mailPause',_0xd3d3('0xf0'),_0xd3d3('0xf1'),_0xd3d3('0xf2'),_0xd3d3('0xf3'),_0xd3d3('0xf4'),_0xd3d3('0xf5')]})[_0xd3d3('0x22')](handleEntityNotFound(_0x19d9c0,null))['then'](function(_0xf0738d){if(_0xf0738d){_0x2bb5d2=_0xf0738d;if(_0x5bf9c0[_0xd3d3('0x65')]['channel']&&!utils[_0xd3d3('0x98')](_0x5bf9c0['body'][_0xd3d3('0x93')])){throw new db[(_0xd3d3('0x20'))][(_0xd3d3('0x21'))](_0xd3d3('0xa7'));}switch(_0x5bf9c0[_0xd3d3('0x65')]['channel']){case _0xd3d3('0xa0'):return respondWithRpcPromise(_0xd3d3('0xec'),_0xd3d3('0xf6'),{'id':_0x2bb5d2['id'],'name':_0x2bb5d2[_0xd3d3('0x46')],'pause':![]})[_0xd3d3('0x22')](function(){return db['UserVoiceQueueRt'][_0xd3d3('0xe0')]({'paused':0x0},{'where':{'UserId':_0x2bb5d2['id']},'individualHooks':!![]});})[_0xd3d3('0x22')](function(){return db[_0xd3d3('0xdf')][_0xd3d3('0x45')]({'where':{'channel':_0x5bf9c0[_0xd3d3('0x65')][_0xd3d3('0x93')],'membername':_0x2bb5d2[_0xd3d3('0x46')],'type':_0xd3d3('0xe6'),'exitAt':null}});})[_0xd3d3('0x22')](function(_0x153efb){if(_0x153efb){return _0x153efb[_0xd3d3('0xe0')]({'exitAt':moment()[_0xd3d3('0x6d')](_0xd3d3('0xe3')),'data2':'manual'},{'individualHooks':!![]});}return null;})[_0xd3d3('0x22')](function(){return _0x2bb5d2[_0xd3d3('0xe0')]({'voicePause':![]});});case _0xd3d3('0xf7'):case _0xd3d3('0xf8'):case'fax':case _0xd3d3('0xf9'):case _0xd3d3('0xfa'):return db[_0xd3d3('0xdf')]['find']({'where':{'channel':_0x5bf9c0[_0xd3d3('0x65')][_0xd3d3('0x93')],'membername':_0x2bb5d2[_0xd3d3('0x46')],'type':_0xd3d3('0xe6'),'exitAt':null}})[_0xd3d3('0x22')](function(_0x3f4d88){if(_0x3f4d88){return _0x3f4d88[_0xd3d3('0xe0')]({'exitAt':moment()[_0xd3d3('0x6d')](_0xd3d3('0xe3')),'data2':_0xd3d3('0xfb')},{'individualHooks':!![]});}return null;})[_0xd3d3('0x22')](function(){var _0x19f462={};_['set'](_0x19f462,util[_0xd3d3('0x6d')]('%s%s',_0x5bf9c0[_0xd3d3('0x65')]['channel'],'Pause'),![]);return _0x2bb5d2['update'](_0x19f462);});default:return respondWithRpcPromise(_0xd3d3('0xec'),_0xd3d3('0xf6'),{'id':_0x2bb5d2['id'],'name':_0x2bb5d2[_0xd3d3('0x46')],'pause':![]})[_0xd3d3('0x22')](function(){return db[_0xd3d3('0xda')][_0xd3d3('0xe0')]({'paused':0x0},{'where':{'UserId':_0x2bb5d2['id']}});})[_0xd3d3('0x22')](function(){return db[_0xd3d3('0xdf')][_0xd3d3('0xa2')]({'where':{'membername':_0x2bb5d2[_0xd3d3('0x46')],'type':_0xd3d3('0xe6'),'exitAt':null}});})[_0xd3d3('0x22')](function(_0x194edf){var _0x140818=[];_0x194edf[_0xd3d3('0xe4')](function(_0xded843){_0x140818[_0xd3d3('0xdd')](_0xded843['update']({'exitAt':moment()[_0xd3d3('0x6d')](_0xd3d3('0xe3')),'data2':_0xd3d3('0xfb')}));});return BPromise[_0xd3d3('0xe1')](_0x140818);})[_0xd3d3('0x22')](function(){return _0x2bb5d2['update']({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});});}}})[_0xd3d3('0x22')](respondWithResult(_0x19d9c0,null))[_0xd3d3('0x2d')](handleError(_0x19d9c0,null));};exports[_0xd3d3('0xfc')]=function(_0x1cf065,_0x4c1095,_0x5cda1e){var _0x71b4d5={};var _0x194ef5={};var _0x55bd25;var _0xeb7515;return db[_0xd3d3('0x5c')][_0xd3d3('0x89')]({'where':{'id':_0x1cf065[_0xd3d3('0x5f')]['id']}})[_0xd3d3('0x22')](handleEntityNotFound(_0x4c1095,null))[_0xd3d3('0x22')](function(_0x4cac6a){if(_0x4cac6a){_0x55bd25=_0x4cac6a;_0x194ef5['model']=_[_0xd3d3('0x4e')](db[_0xd3d3('0xfd')][_0xd3d3('0x60')]);_0x194ef5[_0xd3d3('0x50')]=_['keys'](_0x1cf065[_0xd3d3('0x50')]);_0x194ef5[_0xd3d3('0x4f')]=_[_0xd3d3('0x62')](_0x194ef5[_0xd3d3('0x4b')],_0x194ef5[_0xd3d3('0x50')]);_0x71b4d5[_0xd3d3('0x52')]=_[_0xd3d3('0x62')](_0x194ef5['model'],qs['fields'](_0x1cf065['query'][_0xd3d3('0x51')]));_0x71b4d5['attributes']=_0x71b4d5[_0xd3d3('0x52')][_0xd3d3('0x53')]?_0x71b4d5[_0xd3d3('0x52')]:_0x194ef5[_0xd3d3('0x4b')];_0x71b4d5[_0xd3d3('0x54')]=qs[_0xd3d3('0x55')](_0x1cf065[_0xd3d3('0x50')][_0xd3d3('0x55')]);_0x71b4d5[_0xd3d3('0x56')]=qs['filters'](_['pick'](_0x1cf065[_0xd3d3('0x50')],_0x194ef5['filters']));if(_0x1cf065[_0xd3d3('0x50')][_0xd3d3('0x3f')]){_0x71b4d5['where']=_[_0xd3d3('0x58')](_0x71b4d5[_0xd3d3('0x56')],{'$or':_[_0xd3d3('0x41')](_0x71b4d5['attributes'],function(_0x8dc577){var _0x38e7a6={};_0x38e7a6[_0x8dc577]={'$like':'%'+_0x1cf065[_0xd3d3('0x50')][_0xd3d3('0x3f')]+'%'};return _0x38e7a6;})});}_0x71b4d5=_[_0xd3d3('0x58')]({},_0x71b4d5,_0x1cf065[_0xd3d3('0x64')]);return _0x55bd25[_0xd3d3('0xfc')](_0x71b4d5);}})['then'](function(_0x15d970){if(_0x15d970){_0xeb7515=_0x15d970['length'];if(!_0x1cf065[_0xd3d3('0x50')][_0xd3d3('0xb5')](_0xd3d3('0xbc'))){_0x71b4d5[_0xd3d3('0x34')]=qs[_0xd3d3('0x34')](_0x1cf065[_0xd3d3('0x50')]['limit']);_0x71b4d5['offset']=qs[_0xd3d3('0x33')](_0x1cf065['query'][_0xd3d3('0x33')]);}return _0x55bd25[_0xd3d3('0xfc')](_0x71b4d5);}})[_0xd3d3('0x22')](function(_0x31afec){if(_0x31afec){return _0x31afec?{'count':_0xeb7515,'rows':_0x31afec}:null;}})[_0xd3d3('0x22')](respondWithResult(_0x4c1095,null))[_0xd3d3('0x2d')](handleError(_0x4c1095,null));};exports[_0xd3d3('0xfe')]=function(_0x386db5,_0x34f7a1){return db[_0xd3d3('0x5c')][_0xd3d3('0x45')]({'where':{'id':_0x386db5['params']['id']}})['then'](handleEntityNotFound(_0x34f7a1,null))[_0xd3d3('0x22')](function(_0x1bf6e3){if(_0x1bf6e3){var _0xda032d=_0x1bf6e3[_0xd3d3('0x39')]({'plain':!![]});return _0x1bf6e3[_0xd3d3('0xfe')](_0x386db5[_0xd3d3('0x65')][_0xd3d3('0x9d')],_[_0xd3d3('0xff')](_0x386db5['body'],[_0xd3d3('0x9d'),'id'])||{})[_0xd3d3('0x22')](function(){for(var _0x5cb3d6=0x0;_0x5cb3d6<_0x386db5[_0xd3d3('0x65')][_0xd3d3('0x9d')][_0xd3d3('0x53')];_0x5cb3d6++){var _0x2bce95=[];db[_0xd3d3('0xfd')][_0xd3d3('0x89')]({'where':{'id':_0x386db5[_0xd3d3('0x65')][_0xd3d3('0x9d')][_0x5cb3d6]}})[_0xd3d3('0x22')](function(_0x526cd7){_0x2bce95[_0xd3d3('0xdd')](_0x526cd7[_0xd3d3('0xdc')]()[_0xd3d3('0x22')](function(_0x4891cc){for(var _0x5c6c86=0x0;_0x5c6c86<_0x4891cc[_0xd3d3('0x53')];_0x5c6c86++){_0x4891cc[_0x5c6c86][_0xd3d3('0x100')](_0xd3d3('0x93'),_0xd3d3('0x101'));}return _0x4891cc;}));_0x2bce95[_0xd3d3('0xdd')](_0x526cd7[_0xd3d3('0x102')]()[_0xd3d3('0x22')](function(_0x5ea7e9){for(var _0x3f3ab4=0x0;_0x3f3ab4<_0x5ea7e9[_0xd3d3('0x53')];_0x3f3ab4++){_0x5ea7e9[_0x3f3ab4][_0xd3d3('0x100')](_0xd3d3('0x93'),_0xd3d3('0x103'));}return _0x5ea7e9;}));_0x2bce95[_0xd3d3('0xdd')](_0x526cd7[_0xd3d3('0x104')]()[_0xd3d3('0x22')](function(_0x43769d){for(var _0x476504=0x0;_0x476504<_0x43769d[_0xd3d3('0x53')];_0x476504++){_0x43769d[_0x476504][_0xd3d3('0x100')](_0xd3d3('0x93'),_0xd3d3('0x105'));}return _0x43769d;}));_0x2bce95[_0xd3d3('0xdd')](_0x526cd7[_0xd3d3('0x106')]()[_0xd3d3('0x22')](function(_0xd93e19){for(var _0x1ea8dd=0x0;_0x1ea8dd<_0xd93e19[_0xd3d3('0x53')];_0x1ea8dd++){_0xd93e19[_0x1ea8dd][_0xd3d3('0x100')](_0xd3d3('0x93'),_0xd3d3('0x107'));}return _0xd93e19;}));_0x2bce95[_0xd3d3('0xdd')](_0x526cd7[_0xd3d3('0x108')]()[_0xd3d3('0x22')](function(_0x167942){for(var _0x46eaa1=0x0;_0x46eaa1<_0x167942[_0xd3d3('0x53')];_0x46eaa1++){_0x167942[_0x46eaa1][_0xd3d3('0x100')](_0xd3d3('0x93'),_0xd3d3('0x109'));}return _0x167942;}));_0x2bce95['push'](_0x526cd7[_0xd3d3('0x10a')]()[_0xd3d3('0x22')](function(_0x54eede){for(var _0x1784a5=0x0;_0x1784a5<_0x54eede[_0xd3d3('0x53')];_0x1784a5++){_0x54eede[_0x1784a5][_0xd3d3('0x100')](_0xd3d3('0x93'),_0xd3d3('0x10b'));}return _0x54eede;}));return BPromise[_0xd3d3('0xe1')](_0x2bce95);})[_0xd3d3('0x22')](function(_0xfd1a30){var _0x655219=_[_0xd3d3('0x10c')](_0xfd1a30);_0x2bce95=[];return db[_0xd3d3('0x5a')][_0xd3d3('0x10d')](function(_0x464a20){for(var _0x5ddc05=0x0;_0x5ddc05<_0x655219[_0xd3d3('0x53')];_0x5ddc05++){_0x2bce95[_0xd3d3('0xdd')](_0x655219[_0x5ddc05][_0xd3d3('0x10e')](_0xda032d['id']),{'transaction':_0x464a20});}return BPromise['all'](_0x2bce95)[_0xd3d3('0x22')](function(){if(_0xda032d[_0xd3d3('0x94')]){return BPromise[_0xd3d3('0xde')](_['filter'](_0x655219,function(_0x4b9fd9){return _0x4b9fd9[_0xd3d3('0x10f')]('channel')===_0xd3d3('0x101');}),function(_0x5e8988){return db[_0xd3d3('0xda')][_0xd3d3('0xa5')]({'membername':_0xda032d[_0xd3d3('0x46')],'UserId':_0xda032d['id'],'queue_name':_0x5e8988[_0xd3d3('0x46')],'VoiceQueueId':_0x5e8988['id'],'interface':_['isNil'](_0xda032d[_0xd3d3('0x97')])?util['format']('SIP/%s',_0xda032d[_0xd3d3('0x46')]):_0xda032d[_0xd3d3('0x97')],'paused':_0xda032d['voicePause']||![],'penalty':_0xda032d['penalty']},{'transaction':_0x464a20});});}else{return;}})[_0xd3d3('0x22')](function(){for(var _0x2fbeb6=0x0;_0x2fbeb6<_0x655219[_0xd3d3('0x53')];_0x2fbeb6++){var _0x65b788=_0x655219[_0x2fbeb6]['getDataValue'](_0xd3d3('0x93'));var _0x13f40c=_0x65b788+_0xd3d3('0xa9');socket[_0xd3d3('0x9e')]('user'+_0x65b788+_0xd3d3('0x9f'),{'UserId':_0xda032d['id'],['queueField']:_0x655219[_0x2fbeb6]['id']});}});});});}});}})['then'](respondWithStatusCode(_0x34f7a1,null))[_0xd3d3('0x2d')](handleError(_0x34f7a1,null));};exports[_0xd3d3('0x110')]=function(_0x164df9,_0x507fb7){return db[_0xd3d3('0x5c')]['findOne']({'where':{'id':_0x164df9[_0xd3d3('0x5f')]['id']}})['then'](handleEntityNotFound(_0x507fb7,null))[_0xd3d3('0x22')](function(_0x1c7585){if(_0x1c7585){var _0x5427ae=_0x1c7585['get']({'plain':!![]});var _0x3cff5e=_0x164df9[_0xd3d3('0x50')]['ids'];return _0x1c7585[_0xd3d3('0x110')](_0x3cff5e)[_0xd3d3('0x22')](function(){for(var _0x1a6ff5=0x0;_0x1a6ff5<_0x3cff5e[_0xd3d3('0x53')];_0x1a6ff5++){var _0x20d947=[];db['Team'][_0xd3d3('0x89')]({'where':{'id':_0x3cff5e[_0x1a6ff5]}})[_0xd3d3('0x22')](function(_0x1ef71a){_0x20d947[_0xd3d3('0xdd')](_0x1ef71a['getVoiceQueues']()[_0xd3d3('0x22')](function(_0x16829f){for(var _0x2ad0ef=0x0;_0x2ad0ef<_0x16829f[_0xd3d3('0x53')];_0x2ad0ef++){_0x16829f[_0x2ad0ef][_0xd3d3('0x100')](_0xd3d3('0x93'),_0xd3d3('0x101'));}return _0x16829f;}));_0x20d947[_0xd3d3('0xdd')](_0x1ef71a[_0xd3d3('0x102')]()[_0xd3d3('0x22')](function(_0x29dc4f){for(var _0x49b36d=0x0;_0x49b36d<_0x29dc4f['length'];_0x49b36d++){_0x29dc4f[_0x49b36d]['setDataValue'](_0xd3d3('0x93'),_0xd3d3('0x103'));}return _0x29dc4f;}));_0x20d947[_0xd3d3('0xdd')](_0x1ef71a[_0xd3d3('0x104')]()[_0xd3d3('0x22')](function(_0x13455d){for(var _0x2bcdca=0x0;_0x2bcdca<_0x13455d['length'];_0x2bcdca++){_0x13455d[_0x2bcdca][_0xd3d3('0x100')](_0xd3d3('0x93'),'Mail');}return _0x13455d;}));_0x20d947[_0xd3d3('0xdd')](_0x1ef71a[_0xd3d3('0x106')]()[_0xd3d3('0x22')](function(_0x5aaec6){for(var _0x25caa6=0x0;_0x25caa6<_0x5aaec6[_0xd3d3('0x53')];_0x25caa6++){_0x5aaec6[_0x25caa6]['setDataValue']('channel',_0xd3d3('0x107'));}return _0x5aaec6;}));_0x20d947[_0xd3d3('0xdd')](_0x1ef71a[_0xd3d3('0x108')]()['then'](function(_0x1656de){for(var _0xa66efa=0x0;_0xa66efa<_0x1656de[_0xd3d3('0x53')];_0xa66efa++){_0x1656de[_0xa66efa][_0xd3d3('0x100')](_0xd3d3('0x93'),_0xd3d3('0x109'));}return _0x1656de;}));_0x20d947[_0xd3d3('0xdd')](_0x1ef71a[_0xd3d3('0x10a')]()[_0xd3d3('0x22')](function(_0x4de8aa){for(var _0x212bcc=0x0;_0x212bcc<_0x4de8aa[_0xd3d3('0x53')];_0x212bcc++){_0x4de8aa[_0x212bcc]['setDataValue'](_0xd3d3('0x93'),_0xd3d3('0x10b'));}return _0x4de8aa;}));return BPromise[_0xd3d3('0xe1')](_0x20d947);})[_0xd3d3('0x22')](function(_0x14a59a){var _0x3dd07b=_[_0xd3d3('0x10c')](_0x14a59a);_0x20d947=[];return db[_0xd3d3('0x5a')]['transaction'](function(_0x14b5a7){for(var _0x3eb535=0x0;_0x3eb535<_0x3dd07b[_0xd3d3('0x53')];_0x3eb535++){_0x20d947[_0xd3d3('0xdd')](_0x3dd07b[_0x3eb535]['removeAgent'](_0x5427ae['id']),{'transaction':_0x14b5a7});}return BPromise[_0xd3d3('0xe1')](_0x20d947)[_0xd3d3('0x22')](function(){if(_0x5427ae[_0xd3d3('0x94')]){return BPromise[_0xd3d3('0xde')](_[_0xd3d3('0x3f')](_0x3dd07b,function(_0x22ce6d){return _0x22ce6d[_0xd3d3('0x10f')]('channel')==='Voice';}),function(_0x137da7){return db[_0xd3d3('0xda')][_0xd3d3('0x38')]({'where':{'VoiceQueueId':_0x137da7['id'],'UserId':_0x5427ae['id']},'transaction':_0x14b5a7});});}else{return;}})[_0xd3d3('0x22')](function(){for(var _0x8234d7=0x0;_0x8234d7<_0x3dd07b[_0xd3d3('0x53')];_0x8234d7++){var _0x58fe8d=_0x3dd07b[_0x8234d7][_0xd3d3('0x10f')]('channel');var _0x1118a9=_0x58fe8d+_0xd3d3('0xa9');socket[_0xd3d3('0x9e')]('user'+_0x58fe8d+'Queue:remove',{'UserId':_0x5427ae['id'],['queueField']:_0x3dd07b[_0x8234d7]['id']});}});});});}});}})['then'](respondWithStatusCode(_0x507fb7,null))[_0xd3d3('0x2d')](handleError(_0x507fb7,null));};exports[_0xd3d3('0x111')]=function(_0x233424,_0x30e925,_0x5347f3){var _0x115b60={};var _0x5bb951={};var _0x50e187;var _0x2682a8;return db[_0xd3d3('0x5c')][_0xd3d3('0x89')]({'where':{'id':_0x233424[_0xd3d3('0x5f')]['id']}})[_0xd3d3('0x22')](handleEntityNotFound(_0x30e925,null))[_0xd3d3('0x22')](function(_0x1c61c9){if(_0x1c61c9){_0x50e187=_0x1c61c9;_0x5bb951[_0xd3d3('0x4b')]=_[_0xd3d3('0x4e')](db[_0xd3d3('0xb6')]['rawAttributes']);_0x5bb951[_0xd3d3('0x50')]=_[_0xd3d3('0x4e')](_0x233424[_0xd3d3('0x50')]);_0x5bb951[_0xd3d3('0x4f')]=_[_0xd3d3('0x62')](_0x5bb951['model'],_0x5bb951[_0xd3d3('0x50')]);_0x115b60[_0xd3d3('0x52')]=_[_0xd3d3('0x62')](_0x5bb951['model'],qs[_0xd3d3('0x51')](_0x233424[_0xd3d3('0x50')]['fields']));_0x115b60[_0xd3d3('0x52')]=_0x115b60[_0xd3d3('0x52')][_0xd3d3('0x53')]?_0x115b60['attributes']:_0x5bb951[_0xd3d3('0x4b')];_0x115b60[_0xd3d3('0x54')]=qs['sort'](_0x233424[_0xd3d3('0x50')][_0xd3d3('0x55')]);_0x115b60[_0xd3d3('0x56')]=qs[_0xd3d3('0x4f')](_[_0xd3d3('0x57')](_0x233424[_0xd3d3('0x50')],_0x5bb951[_0xd3d3('0x4f')]));if(_0x233424[_0xd3d3('0x50')][_0xd3d3('0x3f')]){_0x115b60['where']=_[_0xd3d3('0x58')](_0x115b60['where'],{'$or':_[_0xd3d3('0x41')](_0x115b60['attributes'],function(_0x2f449f){var _0x588a8e={};_0x588a8e[_0x2f449f]={'$like':'%'+_0x233424[_0xd3d3('0x50')]['filter']+'%'};return _0x588a8e;})});}_0x115b60=_['merge']({},_0x115b60,_0x233424[_0xd3d3('0x64')]);return _0x50e187[_0xd3d3('0x111')](_0x115b60);}})[_0xd3d3('0x22')](function(_0x4b31a5){if(_0x4b31a5){_0x2682a8=_0x4b31a5[_0xd3d3('0x53')];if(!_0x233424[_0xd3d3('0x50')][_0xd3d3('0xb5')](_0xd3d3('0xbc'))){_0x115b60['limit']=qs[_0xd3d3('0x34')](_0x233424[_0xd3d3('0x50')]['limit']);_0x115b60[_0xd3d3('0x33')]=qs[_0xd3d3('0x33')](_0x233424[_0xd3d3('0x50')][_0xd3d3('0x33')]);}return _0x50e187[_0xd3d3('0x111')](_0x115b60);}})['then'](function(_0x443e3b){if(_0x443e3b){return _0x443e3b?{'count':_0x2682a8,'rows':_0x443e3b}:null;}})['then'](respondWithResult(_0x30e925,null))['catch'](handleError(_0x30e925,null));};exports['getAgents']=function(_0x2503a6,_0x4305a7,_0x320ad8){var _0x1a0163={};var _0xe0a03a={};var _0x443090;var _0x30c13a;return db[_0xd3d3('0x5c')]['findOne']({'where':{'id':_0x2503a6[_0xd3d3('0x5f')]['id']}})[_0xd3d3('0x22')](handleEntityNotFound(_0x4305a7,null))['then'](function(_0x3f3bec){if(_0x3f3bec){_0x443090=_0x3f3bec;_0xe0a03a[_0xd3d3('0x4b')]=_[_0xd3d3('0x4e')](db[_0xd3d3('0x5c')]['rawAttributes']);_0xe0a03a['query']=_[_0xd3d3('0x4e')](_0x2503a6[_0xd3d3('0x50')]);_0xe0a03a[_0xd3d3('0x4f')]=_[_0xd3d3('0x62')](_0xe0a03a[_0xd3d3('0x4b')],_0xe0a03a[_0xd3d3('0x50')]);_0x1a0163[_0xd3d3('0x52')]=_[_0xd3d3('0x62')](_0xe0a03a[_0xd3d3('0x4b')],qs[_0xd3d3('0x51')](_0x2503a6[_0xd3d3('0x50')][_0xd3d3('0x51')]));_0x1a0163[_0xd3d3('0x52')]=_0x1a0163['attributes'][_0xd3d3('0x53')]?_0x1a0163[_0xd3d3('0x52')]:_0xe0a03a['model'];_0x1a0163[_0xd3d3('0x54')]=qs['sort'](_0x2503a6['query'][_0xd3d3('0x55')]);_0x1a0163['where']=qs[_0xd3d3('0x4f')](_[_0xd3d3('0x57')](_0x2503a6[_0xd3d3('0x50')],_0xe0a03a[_0xd3d3('0x4f')]));if(_0x2503a6['query']['filter']){_0x1a0163[_0xd3d3('0x56')]=_[_0xd3d3('0x58')](_0x1a0163['where'],{'$or':_[_0xd3d3('0x41')](_0x1a0163[_0xd3d3('0x52')],function(_0x14d1e0){var _0xd9a521={};_0xd9a521[_0x14d1e0]={'$like':'%'+_0x2503a6['query'][_0xd3d3('0x3f')]+'%'};return _0xd9a521;})});}_0x1a0163['model']=db['User'];_0x1a0163['as']='Agents';_0x1a0163=_[_0xd3d3('0x58')]({},_0x1a0163,_0x2503a6[_0xd3d3('0x64')]);return _0x443090[_0xd3d3('0xdc')]({'include':[_0x1a0163]});}})[_0xd3d3('0x22')](function(_0x588a1a){if(_0x588a1a){var _0x4f4526={},_0x333468=[],_0x5c57a7=0x0;for(var _0x447ad4=0x0;_0x447ad4<_0x588a1a[_0xd3d3('0x53')];_0x447ad4+=0x1){for(var _0x1e7f89=0x0,_0xb19b8a;_0x1e7f89<_0x588a1a[_0x447ad4][_0xd3d3('0x3b')]['length'];_0x1e7f89+=0x1){_0xb19b8a=_0x588a1a[_0x447ad4]['Agents'][_0x1e7f89]['get']({'plain':!![]});_0x4f4526[_0xb19b8a['id']]=_0xb19b8a;}}_0x4f4526=_[_0xd3d3('0x112')](_0x4f4526);for(var _0x3d9f34=qs[_0xd3d3('0x33')](_0x2503a6['query'][_0xd3d3('0x33')]);_0x3d9f34<_0x4f4526[_0xd3d3('0x53')]&&_0x333468['length']=_0x4e3fe2){_0x408c36=_0x4e3fe2;_0x19cf42=0xc8;}else{_0x19cf42=0xce;}_0x888b24[_0x8488('0x2a')](_0x19cf42);return _0x888b24[_0x8488('0x2f')](_0x8488('0x30'),_0x292fe8+'-'+_0x408c36+'/'+_0x4e3fe2)[_0x8488('0x2c')](_0x57ce3c);}return null;};}function patchUpdates(_0x18eb27){return function(_0x501981){try{jsonpatch[_0x8488('0x31')](_0x501981,_0x18eb27,!![]);}catch(_0x23f67a){return BPromise['reject'](_0x23f67a);}return _0x501981[_0x8488('0x32')]();};}function saveUpdates(_0x21dff0,_0x4d3ed2){return function(_0x446f90){if(_0x446f90){return _0x446f90[_0x8488('0x33')](_0x21dff0)['then'](function(_0x44c8f3){return _0x44c8f3;});}return null;};}function removeEntity(_0x1f3ea5,_0x3f3861){return function(_0x584965){if(_0x584965){return _0x584965[_0x8488('0x34')]()['then'](function(){var _0x205ccc=_0x584965[_0x8488('0x35')]({'plain':!![]});var _0x3ce30b=[{'name':_0x8488('0x36'),'value':'user','ignore':!![]},{'name':_0x8488('0x37'),'value':_0x8488('0x38'),'ignore':![]},{'name':_0x8488('0x39'),'value':'telephone','ignore':![]}];var _0x3920d1=_(_0x3ce30b)[_0x8488('0x3a')](_0x8488('0x3b'))[_0x8488('0x3c')](_0x8488('0x3d'))[_0x8488('0x3d')]();if(_[_0x8488('0x3e')](_0x3920d1,_0x205ccc[_0x8488('0x3f')])){return;}var _0x1a8235=_[_0x8488('0x40')](_0x3ce30b,[_0x8488('0x3d'),_0x205ccc['role']])['name'];return db[_0x8488('0x41')][_0x8488('0x34')]({'where':{'type':_0x1a8235,'resourceId':_0x205ccc['id']}})[_0x8488('0x1f')](function(){return _0x584965;});})[_0x8488('0x1f')](function(){_0x1f3ea5[_0x8488('0x2a')](0xcc)[_0x8488('0x2b')]();});}};}function handleEntityNotFound(_0x13c260,_0x4481df){return function(_0x1dab58){if(!_0x1dab58){_0x13c260['sendStatus'](0x194);}return _0x1dab58;};}function handleError(_0xf5a0a0,_0x65e88a){_0x65e88a=_0x65e88a||0x1f4;return function(_0x11a258){logger['error'](_0x11a258[_0x8488('0x42')]);if(_0x11a258[_0x8488('0x43')]){delete _0x11a258[_0x8488('0x43')];}_0xf5a0a0[_0x8488('0x2a')](_0x65e88a)[_0x8488('0x44')](_0x11a258);};}exports[_0x8488('0x45')]=function(_0x1aac4b,_0x496ea0){var _0x45db70={},_0x1c33a1={},_0x891cff={'count':0x0,'rows':[]};var _0x4fdb23=_[_0x8488('0x3c')](db['User'][_0x8488('0x46')],function(_0x34b11b){return{'name':_0x34b11b['fieldName'],'type':_0x34b11b[_0x8488('0x47')][_0x8488('0x48')]};});_0x1c33a1[_0x8488('0x49')]=_[_0x8488('0x4a')](_[_0x8488('0x3c')](_0x4fdb23,'name'),[_0x8488('0x4b'),'salt']);_0x1c33a1[_0x8488('0x4c')]=_[_0x8488('0x4d')](_0x1aac4b[_0x8488('0x4c')]);_0x1c33a1[_0x8488('0x4e')]=_[_0x8488('0x4f')](_0x1c33a1[_0x8488('0x49')],_0x1c33a1[_0x8488('0x4c')]);_0x45db70[_0x8488('0x50')]=_[_0x8488('0x4f')](_0x1c33a1[_0x8488('0x49')],qs[_0x8488('0x51')](_0x1aac4b[_0x8488('0x4c')][_0x8488('0x51')]));_0x45db70[_0x8488('0x50')]=_0x45db70[_0x8488('0x50')][_0x8488('0x52')]?_0x45db70[_0x8488('0x50')]:_0x1c33a1['model'];if(!_0x1aac4b[_0x8488('0x4c')][_0x8488('0x53')](_0x8488('0x54'))){_0x45db70[_0x8488('0x55')]=qs['limit'](_0x1aac4b[_0x8488('0x4c')][_0x8488('0x55')]);_0x45db70[_0x8488('0x2e')]=qs[_0x8488('0x2e')](_0x1aac4b['query'][_0x8488('0x2e')]);}_0x45db70[_0x8488('0x56')]=qs[_0x8488('0x57')](_0x1aac4b[_0x8488('0x4c')][_0x8488('0x57')]);_0x45db70[_0x8488('0x58')]=qs[_0x8488('0x4e')](_[_0x8488('0x59')](_0x1aac4b[_0x8488('0x4c')],_0x1c33a1[_0x8488('0x4e')]));if(_0x1aac4b[_0x8488('0x4c')][_0x8488('0x3a')]){_0x45db70[_0x8488('0x58')]=_['merge'](_0x45db70['where'],{'$or':_[_0x8488('0x3c')](_0x4fdb23,function(_0x1a66ff){if(_0x1a66ff[_0x8488('0x47')]!==_0x8488('0x5a')){return db[_0x8488('0x5b')][_0x8488('0x58')](db[_0x8488('0x5b')]['fn'](_0x8488('0x5c'),db[_0x8488('0x5b')]['col'](_0x1a66ff[_0x8488('0x43')])),{'$like':db[_0x8488('0x5b')]['fn']('lower','%'+_0x1aac4b[_0x8488('0x4c')][_0x8488('0x3a')]+'%')});}})});}_0x45db70=_[_0x8488('0x5d')]({},_0x45db70,_0x1aac4b[_0x8488('0x5e')]);var _0x4f80fb={'where':_0x45db70[_0x8488('0x58')]};return db[_0x8488('0x5f')][_0x8488('0x2d')](_0x4f80fb)['then'](function(_0x32402d){_0x891cff[_0x8488('0x2d')]=_0x32402d;if(_0x1aac4b[_0x8488('0x4c')][_0x8488('0x60')]){_0x45db70['include']=[{'all':!![]}];}return db[_0x8488('0x5f')]['findAll'](_0x45db70);})['then'](function(_0x75faa8){_0x891cff['rows']=_0x75faa8;return _0x891cff;})[_0x8488('0x1f')](respondWithFilteredResult(_0x496ea0,_0x45db70))[_0x8488('0x28')](handleError(_0x496ea0,null));};exports[_0x8488('0x61')]=function(_0x85eb4d,_0x45c8b8){var _0x362b00={'raw':![],'where':{'id':_0x85eb4d[_0x8488('0x62')]['id']}},_0x4d0902={};_0x4d0902[_0x8488('0x49')]=_[_0x8488('0x4a')](_[_0x8488('0x4d')](db[_0x8488('0x5f')]['rawAttributes']),[_0x8488('0x4b'),'salt']);_0x4d0902[_0x8488('0x4c')]=_[_0x8488('0x4d')](_0x85eb4d['query']);_0x4d0902[_0x8488('0x4e')]=_[_0x8488('0x4f')](_0x4d0902[_0x8488('0x49')],_0x4d0902[_0x8488('0x4c')]);_0x362b00[_0x8488('0x50')]=_[_0x8488('0x4f')](_0x4d0902['model'],qs[_0x8488('0x51')](_0x85eb4d['query'][_0x8488('0x51')]));_0x362b00[_0x8488('0x50')]=_0x362b00[_0x8488('0x50')][_0x8488('0x52')]?_0x362b00[_0x8488('0x50')]:_0x4d0902[_0x8488('0x49')];if(_0x85eb4d['query'][_0x8488('0x60')]){_0x362b00['include']=[{'all':!![]}];}_0x362b00=_[_0x8488('0x5d')]({},_0x362b00,_0x85eb4d[_0x8488('0x5e')]);return db[_0x8488('0x5f')][_0x8488('0x40')](_0x362b00)[_0x8488('0x1f')](handleEntityNotFound(_0x45c8b8,null))[_0x8488('0x1f')](respondWithResult(_0x45c8b8,null))['catch'](handleError(_0x45c8b8,null));};exports['bulkCreate']=function(_0x5c8310,_0x28ddb0){return db[_0x8488('0x5f')][_0x8488('0x63')](_0x5c8310[_0x8488('0x64')],{'raw':![],'individualHooks':!![]})[_0x8488('0x1f')](respondWithResult(_0x28ddb0,0xc9))[_0x8488('0x28')](handleError(_0x28ddb0,null));};exports[_0x8488('0x33')]=function(_0x47140c,_0x221f07){if(_0x47140c[_0x8488('0x64')]['id']){delete _0x47140c['body']['id'];}delete _0x47140c[_0x8488('0x64')][_0x8488('0x3f')];return db[_0x8488('0x5f')]['find']({'where':{'id':_0x47140c['params']['id']}})[_0x8488('0x1f')](handleEntityNotFound(_0x221f07,null))[_0x8488('0x1f')](saveUpdates(_0x47140c[_0x8488('0x64')],null))[_0x8488('0x1f')](respondWithResult(_0x221f07,null))['catch'](handleError(_0x221f07,null));};exports['describe']=function(_0x1577ce,_0x26e0cc){return db[_0x8488('0x5f')]['describe']()[_0x8488('0x1f')](respondWithResult(_0x26e0cc,null))[_0x8488('0x28')](handleError(_0x26e0cc,null));};exports[_0x8488('0x65')]=function(_0x10b5b7,_0x332a9c,_0x5e41e5){return db[_0x8488('0x5f')][_0x8488('0x40')]({'where':{'id':_0x10b5b7['params']['id']}})[_0x8488('0x1f')](handleEntityNotFound(_0x332a9c,null))[_0x8488('0x1f')](function(_0x51d003){if(_0x51d003){return _0x51d003[_0x8488('0x65')](_0x10b5b7[_0x8488('0x64')][_0x8488('0x66')],_[_0x8488('0x67')](_0x10b5b7[_0x8488('0x64')],[_0x8488('0x66'),'id'])||{});}})[_0x8488('0x1f')](respondWithResult(_0x332a9c,null))['catch'](handleError(_0x332a9c,null));};var getLicense=function(_0xfdb4dd){return new BPromise(function(_0x3b7aa8,_0x480666){var _0x49ef10=0x0;_0xfdb4dd[_0x8488('0x64')][_0x8488('0x3f')]===_0x8488('0x38')&&_0x3b7aa8('agent\x20role');return db[_0x8488('0x5f')][_0x8488('0x2d')]({'where':{'$or':[{'role':_0xfdb4dd['body'][_0x8488('0x3f')]==='telephone'?_0x8488('0x68'):[_0x8488('0x69'),_0x8488('0x6a')]}]}})['then'](function(_0xbee86e){_0x49ef10=_0xbee86e;return require(_0x8488('0x6b'))['getLicense']();})['then'](function(_0xe3a51d){var _0x21a42e=_0xfdb4dd[_0x8488('0x64')][_0x8488('0x3f')]===_0x8488('0x68')?_0x8488('0x6c'):_0x8488('0x6d');if(!_[_0x8488('0x6e')](_0xe3a51d[_0x21a42e])&&_0x49ef10>=_0xe3a51d[_0x21a42e]){return _0x480666({'message':_0x8488('0x6f')});}return _0x3b7aa8(util[_0x8488('0x70')]('count\x20%s:\x20%s',_0x21a42e,_0x49ef10));})[_0x8488('0x28')](function(_0x5c0599){return _0x480666(_0x5c0599);});});};exports[_0x8488('0x71')]=function(_0x250e9c,_0xa8c980){return getLicense(_0x250e9c)[_0x8488('0x1f')](function(_0x54283a){if(!_0x250e9c[_0x8488('0x64')][_0x8488('0x72')]){var _0x5a48d4;return db[_0x8488('0x73')]['findById'](0x1)[_0x8488('0x1f')](function(_0x15b919){return checkPasswordPattern(_0x15b919,_0x250e9c[_0x8488('0x64')][_0x8488('0x4b')],_0x15b919[_0x8488('0x74')]);})[_0x8488('0x1f')](function(_0x14cbe5){_0x5a48d4=_0x14cbe5[_0x8488('0x75')];return db['User'][_0x8488('0x76')]('internal');})['then'](function(_0xdd1752){if(_[_0x8488('0x6e')](_0xdd1752)){if(_0x5a48d4){_0x250e9c[_0x8488('0x64')]['internal']=_0x5a48d4;}else{_0x250e9c['body'][_0x8488('0x72')]=0x1;}}else{if(_[_0x8488('0x6e')](_0x5a48d4)||_0x5a48d4==_0xdd1752){_0x250e9c['body'][_0x8488('0x72')]=_0xdd1752+0x1;}else if(_0x5a48d4>_0xdd1752){_0x250e9c[_0x8488('0x64')][_0x8488('0x72')]=_0x5a48d4;}else{return db[_0x8488('0x5b')][_0x8488('0x4c')](_0x8488('0x77'),{'type':db['sequelize'][_0x8488('0x78')][_0x8488('0x79')]})[_0x8488('0x1f')](function(_0x4a2fd9){if(_0x4a2fd9&&_0x4a2fd9[_0x8488('0x52')]){for(var _0x2b5ea4=0x0,_0x2ce905=_0x4a2fd9['length'];_0x2b5ea4<_0x2ce905&&_[_0x8488('0x6e')](_0x250e9c[_0x8488('0x64')]['internal']);_0x2b5ea4++){if(_0x5a48d4<=_0x4a2fd9[_0x2b5ea4]['from']){_0x250e9c[_0x8488('0x64')][_0x8488('0x72')]=_0x4a2fd9[_0x2b5ea4]['from'];}else if(_0x5a48d4>_0x4a2fd9[_0x2b5ea4][_0x8488('0x7a')]&&_0x5a48d4<=_0x4a2fd9[_0x2b5ea4]['to']){_0x250e9c[_0x8488('0x64')]['internal']=_0x5a48d4;}}}if(_['isNil'](_0x250e9c[_0x8488('0x64')]['internal'])){_0x250e9c[_0x8488('0x64')][_0x8488('0x72')]=_0xdd1752+0x1;}});}}});}})[_0x8488('0x1f')](function(){if(_0x250e9c[_0x8488('0x64')]['voicemail']){_0x250e9c[_0x8488('0x64')]['mailbox']=_0x250e9c[_0x8488('0x64')]['internal'];_0x250e9c[_0x8488('0x64')][_0x8488('0x7b')]={'mailbox':_0x250e9c[_0x8488('0x64')][_0x8488('0x72')],'password':_0x250e9c[_0x8488('0x64')][_0x8488('0x4b')],'fullname':_0x250e9c[_0x8488('0x64')][_0x8488('0x7c')],'email':_0x250e9c[_0x8488('0x64')][_0x8488('0x7d')]};}if(_0x250e9c[_0x8488('0x64')]&&_0x250e9c[_0x8488('0x64')][_0x8488('0x3f')]===_0x8488('0x38')){_0x250e9c['body'][_0x8488('0x7e')]=[_0x8488('0x7f'),'102',_0x8488('0x80'),_0x8488('0x81'),_0x8488('0x82'),_0x8488('0x83'),_0x8488('0x84'),_0x8488('0x85'),_0x8488('0x86'),_0x8488('0x87'),_0x8488('0x88'),_0x8488('0x89')];}return db[_0x8488('0x5f')]['create'](_0x250e9c[_0x8488('0x64')],{'include':[{'model':db[_0x8488('0x7b')],'as':'VoiceMail'}]});})[_0x8488('0x1f')](function(_0x7426b2){if(_0x250e9c[_0x8488('0x64')][_0x8488('0x3f')]===_0x8488('0x6a'))return _0x7426b2;var _0x5b19b9=_0x250e9c['user'][_0x8488('0x35')]({'plain':!![]});if(!_0x5b19b9)throw new Error(_0x8488('0x8a'));if(_0x5b19b9[_0x8488('0x3f')]===_0x8488('0x6a')){var _0x1b3e23=_0x7426b2[_0x8488('0x35')]({'plain':!![]});var _0x7632ef=[{'name':_0x8488('0x37'),'value':_0x8488('0x38')},{'name':_0x8488('0x39'),'value':_0x8488('0x68')}];var _0xb045bc=_[_0x8488('0x40')](_0x7632ef,[_0x8488('0x3d'),_0x1b3e23[_0x8488('0x3f')]])['name'];return db[_0x8488('0x8b')]['find']({'where':{'name':_0xb045bc,'userProfileId':_0x5b19b9['userProfileId']},'raw':!![]})[_0x8488('0x1f')](function(_0x215253){if(_0x215253&&_0x215253[_0x8488('0x8c')]===0x0){return db[_0x8488('0x41')][_0x8488('0x71')]({'name':_0x1b3e23[_0x8488('0x43')],'resourceId':_0x1b3e23['id'],'type':_0x215253[_0x8488('0x43')],'sectionId':_0x215253['id']},{})[_0x8488('0x1f')](function(){return _0x7426b2;});}else{return _0x7426b2;}})[_0x8488('0x28')](function(_0x3c8469){logger['error'](_0x8488('0x8d'),_0x3c8469);throw _0x3c8469;});}return _0x7426b2;})[_0x8488('0x1f')](respondWithResult(_0xa8c980,0xc9))[_0x8488('0x28')](handleError(_0xa8c980,null));};exports[_0x8488('0x8e')]=function(_0x1a1343,_0x184cd9,_0x47f7c5){var _0x2d7a33=![];if(_0x1a1343['body']['id']){delete _0x1a1343[_0x8488('0x64')]['id'];}return db[_0x8488('0x73')]['findOne']({'attributes':['id','securePassword']})[_0x8488('0x1f')](function(_0x328b37){_0x2d7a33=_0x328b37[_0x8488('0x74')];return db[_0x8488('0x5f')][_0x8488('0x40')]({'where':{'id':_0x1a1343['params']['id']}});})[_0x8488('0x1f')](function(_0x19c5c6){if(_0x19c5c6){if(_0x19c5c6['id']==_0x1a1343['user']['id']){if(!_0x1a1343['body'][_0x8488('0x8f')]||!_0x1a1343[_0x8488('0x64')][_0x8488('0x90')]){throw new db['Sequelize']['ValidationError'](_0x8488('0x91'));}if(!_0x19c5c6[_0x8488('0x92')](_0x1a1343[_0x8488('0x64')]['oldPassword'])){throw new db[(_0x8488('0x1c'))][(_0x8488('0x93'))](_0x8488('0x94'));}if(_0x1a1343[_0x8488('0x64')][_0x8488('0x8f')]==_0x1a1343[_0x8488('0x64')][_0x8488('0x90')]){throw new db[(_0x8488('0x1c'))][(_0x8488('0x93'))](_0x8488('0x95'));}return _0x19c5c6;}else if(_0x1a1343[_0x8488('0x6a')][_0x8488('0x3f')]==_0x8488('0x69')){if(!_0x1a1343['body'][_0x8488('0x90')]){throw new db[(_0x8488('0x1c'))][(_0x8488('0x93'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}return _0x19c5c6;}else if(_0x1a1343[_0x8488('0x6a')]['role']==_0x8488('0x6a')){if(!_0x1a1343['body']['newPassword']){throw new db[(_0x8488('0x1c'))]['ValidationError'](_0x8488('0x96'));}if(_0x19c5c6[_0x8488('0x3f')]!=_0x8488('0x38')){throw new db[(_0x8488('0x1c'))]['ValidationError'](_0x8488('0x97'));}return _0x19c5c6;}else{throw new db[(_0x8488('0x1c'))][(_0x8488('0x93'))](_0x8488('0x97'));}}return null;})['then'](handleEntityNotFound(_0x184cd9,null))[_0x8488('0x1f')](function(_0x432bce){return checkPasswordPattern(_0x432bce,_0x1a1343[_0x8488('0x64')][_0x8488('0x90')],_0x2d7a33);})[_0x8488('0x1f')](saveUpdates({'password':_0x1a1343['body']['newPassword'],'passwordResetAt':_0x1a1343[_0x8488('0x6a')]['id']==_0x1a1343[_0x8488('0x62')]['id']?moment():null},null))[_0x8488('0x1f')](respondWithResult(_0x184cd9,null))[_0x8488('0x28')](handleError(_0x184cd9,null));};exports[_0x8488('0x98')]=function(_0x5969c3,_0x4806f8,_0x5aedd6){var _0x205922=_0x5969c3[_0x8488('0x64')][_0x8488('0x99')];return db['User'][_0x8488('0x40')]({'where':{'id':_0x5969c3[_0x8488('0x62')]['id']},'attributes':['id','name',_0x8488('0x3f'),_0x8488('0x9a'),_0x8488('0x9b'),_0x8488('0x9c'),_0x8488('0x9d')]})[_0x8488('0x1f')](handleEntityNotFound(_0x4806f8,null))[_0x8488('0x1f')](function(_0x2f8dd9){if(_0x2f8dd9){if(!utils[_0x8488('0x9e')](_0x205922)){throw new db[(_0x8488('0x1c'))][(_0x8488('0x93'))](_0x8488('0x9f'));}return _0x2f8dd9[_0x8488('0xa0')+_['capitalize'](_0x205922[_0x8488('0xa1')]())+_0x8488('0xa2')](_0x5969c3['body']['ids'],{'penalty':_0x5969c3['body'][_0x8488('0xa3')]||0x0})[_0x8488('0xa4')](function(_0x3c0e9b){for(var _0x4ba801=0x0;_0x4ba801<_0x5969c3[_0x8488('0x64')]['ids'][_0x8488('0x52')];_0x4ba801+=0x1){var _0x145955={'UserId':_0x5969c3[_0x8488('0x62')]['id']};_0x145955[_[_0x8488('0xa5')](_0x205922[_0x8488('0xa1')]())+'QueueId']=_0x5969c3[_0x8488('0x64')][_0x8488('0x66')][_0x4ba801];socket[_0x8488('0xa6')](_0x8488('0x6a')+_['capitalize'](_0x205922['toLowerCase']())+_0x8488('0xa7'),_0x145955);}return _0x3c0e9b;})[_0x8488('0x1f')](function(){if(_0x205922===_0x8488('0xa8')){return db[_0x8488('0xa9')][_0x8488('0xaa')]({'where':{'id':_0x5969c3[_0x8488('0x64')][_0x8488('0x66')]||[]},'raw':!![],'attributes':['id',_0x8488('0x43')]});}})[_0x8488('0x1f')](function(_0x5a1007){var _0x1f5a8b=_0x2f8dd9[_0x8488('0x35')]({'plain':!![]});var _0x315136=[];if(_0x205922===_0x8488('0xa8')&&_0x1f5a8b['role']==='agent'&&_0x1f5a8b[_0x8488('0x9a')]){for(var _0x312a32=0x0;_0x312a32<_0x5a1007[_0x8488('0x52')];_0x312a32+=0x1){_0x315136[_0x8488('0xab')]({'membername':_0x1f5a8b[_0x8488('0x43')],'UserId':_0x1f5a8b['id'],'queue_name':_0x5a1007[_0x312a32][_0x8488('0x43')],'VoiceQueueId':_0x5a1007[_0x312a32]['id'],'interface':_[_0x8488('0x6e')](_0x1f5a8b[_0x8488('0x9d')])?util[_0x8488('0x70')]('SIP/%s',_0x1f5a8b[_0x8488('0x43')]):_0x1f5a8b[_0x8488('0x9d')],'paused':_0x1f5a8b[_0x8488('0x9c')]||![],'penalty':_0x5969c3['body'][_0x8488('0xa3')]||0x0});}return BPromise[_0x8488('0xac')](_0x315136,function(_0x1afd88){return db[_0x8488('0xad')][_0x8488('0xae')](_0x1afd88);});}return _0x2f8dd9;});}})[_0x8488('0x1f')](respondWithStatusCode(_0x4806f8,null))[_0x8488('0x28')](handleError(_0x4806f8,null));};exports[_0x8488('0xaf')]=function(_0x4a7be5,_0x5601b1,_0x548a7a){var _0x215d7e;return db[_0x8488('0x5f')][_0x8488('0x40')]({'where':{'id':_0x4a7be5[_0x8488('0x62')]['id']},'attributes':['id',_0x8488('0x43'),_0x8488('0x3f')]})['then'](handleEntityNotFound(_0x5601b1,null))[_0x8488('0x1f')](function(_0x57d58c){if(_0x57d58c){_0x215d7e=_0x57d58c;if(!_0x4a7be5[_0x8488('0x4c')][_0x8488('0x99')]||!utils[_0x8488('0x9e')](_0x4a7be5[_0x8488('0x4c')][_0x8488('0x99')])){throw new db['Sequelize'][(_0x8488('0x93'))](_0x8488('0x9f'));}return _0x57d58c[_0x8488('0xb0')+_[_0x8488('0xa5')](_0x4a7be5[_0x8488('0x4c')][_0x8488('0x99')][_0x8488('0xa1')]())+'Queues'](_0x4a7be5[_0x8488('0x4c')]['ids']);}})['then'](function(_0x2f4c01){for(var _0x323343=0x0;_0x323343<_0x4a7be5['query'][_0x8488('0x66')][_0x8488('0x52')];_0x323343+=0x1){var _0x3729cb={'UserId':_0x4a7be5[_0x8488('0x62')]['id']};_0x3729cb[_[_0x8488('0xa5')](_0x4a7be5['query']['channel'][_0x8488('0xa1')]())+_0x8488('0xb1')]=_0x4a7be5[_0x8488('0x4c')][_0x8488('0x66')][_0x323343];socket[_0x8488('0xa6')]('user'+_['capitalize'](_0x4a7be5[_0x8488('0x4c')][_0x8488('0x99')][_0x8488('0xa1')]())+_0x8488('0xb2'),_0x3729cb);}return _0x2f4c01;})[_0x8488('0x1f')](function(){if(_0x4a7be5[_0x8488('0x4c')][_0x8488('0x99')]===_0x8488('0xa8')){return db[_0x8488('0xad')][_0x8488('0x34')]({'where':{'UserId':_0x4a7be5[_0x8488('0x62')]['id'],'VoiceQueueId':_0x4a7be5[_0x8488('0x4c')][_0x8488('0x66')]},'individualHooks':!![]})[_0x8488('0x1f')](function(){return _0x215d7e;});}return _0x215d7e;})['then'](respondWithStatusCode(_0x5601b1,null))[_0x8488('0x28')](handleError(_0x5601b1,null));};exports[_0x8488('0xb3')]=function(_0x14c6a6,_0x4d3edd,_0xfb02ed){_0x14c6a6[_0x8488('0x64')][_0x8488('0xb4')]=_0x14c6a6['file'][_0x8488('0xb5')];return db[_0x8488('0x5f')]['find']({'where':{'id':_0x14c6a6[_0x8488('0x62')]['id']}})[_0x8488('0x1f')](handleEntityNotFound(_0x4d3edd,null))['then'](saveUpdates(_0x14c6a6[_0x8488('0x64')],null))[_0x8488('0x1f')](respondWithResult(_0x4d3edd,null))[_0x8488('0x28')](handleError(_0x4d3edd,null));};exports[_0x8488('0xb6')]=function(_0x28a82d,_0x1f2743,_0x2ce70b){var _0x3c60d3=path[_0x8488('0xb7')](config[_0x8488('0xb8')],'server/files/images/logos/default_profile.png');return db[_0x8488('0x5f')][_0x8488('0x40')]({'where':{'id':_0x28a82d['params']['id']},'attributes':['id',_0x8488('0xb4')],'raw':!![]})['then'](handleEntityNotFound(_0x1f2743,null))[_0x8488('0x1f')](function(_0x2f19b0){if(_0x2f19b0){if(_[_0x8488('0x6e')](_0x2f19b0[_0x8488('0xb4')])){return _0x1f2743[_0x8488('0xb9')](_0x3c60d3);}else{if(!fs[_0x8488('0xba')](path['join'](config[_0x8488('0xb8')],'server/files/images/',_0x2f19b0['userpic']))){return _0x1f2743[_0x8488('0xb9')](_0x3c60d3);}return _0x1f2743[_0x8488('0xb9')](path[_0x8488('0xb7')](config[_0x8488('0xb8')],'server/files/images/',_0x2f19b0['userpic']));}}})['catch'](handleError(_0x1f2743,null));};exports['getContacts']=function(_0x1a9ab8,_0x3a4c8,_0x28ec5f){var _0x389900={};var _0x37ecf9={};var _0x484a83;var _0x1f5299;return db[_0x8488('0x5f')][_0x8488('0xbb')]({'where':{'id':_0x1a9ab8['params']['id']}})['then'](handleEntityNotFound(_0x3a4c8,null))[_0x8488('0x1f')](function(_0x2bb35c){if(_0x2bb35c){_0x484a83=_0x2bb35c;_0x37ecf9['model']=_['keys'](db[_0x8488('0xbc')][_0x8488('0x46')]);_0x37ecf9[_0x8488('0x4c')]=_[_0x8488('0x4d')](_0x1a9ab8[_0x8488('0x4c')]);_0x37ecf9[_0x8488('0x4e')]=_[_0x8488('0x4f')](_0x37ecf9[_0x8488('0x49')],_0x37ecf9[_0x8488('0x4c')]);_0x389900[_0x8488('0x50')]=_[_0x8488('0x4f')](_0x37ecf9[_0x8488('0x49')],qs[_0x8488('0x51')](_0x1a9ab8[_0x8488('0x4c')][_0x8488('0x51')]));_0x389900[_0x8488('0x50')]=_0x389900[_0x8488('0x50')]['length']?_0x389900[_0x8488('0x50')]:_0x37ecf9[_0x8488('0x49')];_0x389900[_0x8488('0x56')]=qs['sort'](_0x1a9ab8[_0x8488('0x4c')][_0x8488('0x57')]);_0x389900[_0x8488('0x58')]=qs[_0x8488('0x4e')](_['pick'](_0x1a9ab8[_0x8488('0x4c')],_0x37ecf9['filters']));if(_0x1a9ab8[_0x8488('0x4c')][_0x8488('0x3a')]){_0x389900['where']=_[_0x8488('0x5d')](_0x389900[_0x8488('0x58')],{'$or':_[_0x8488('0x3c')](_0x389900[_0x8488('0x50')],function(_0x3cd626){var _0x256612={};_0x256612[_0x3cd626]={'$like':'%'+_0x1a9ab8['query']['filter']+'%'};return _0x256612;})});}_0x389900=_[_0x8488('0x5d')]({},_0x389900,_0x1a9ab8[_0x8488('0x5e')]);return _0x484a83[_0x8488('0xbd')](_0x389900);}})[_0x8488('0x1f')](function(_0x15a8de){if(_0x15a8de){_0x1f5299=_0x15a8de['length'];if(_0x1a9ab8['query'][_0x8488('0x53')]('includeAll')){_0x389900[_0x8488('0xbe')]=[{'model':db[_0x8488('0xbf')],'as':'List','required':![]},{'model':db['Tag'],'as':_0x8488('0xc0'),'attributes':['id',_0x8488('0x43'),'color'],'where':_0x1a9ab8[_0x8488('0x4c')]['tag']?{'id':_0x1a9ab8['query'][_0x8488('0xc1')]}:undefined,'required':_0x1a9ab8[_0x8488('0x4c')][_0x8488('0xc1')]?!![]:![]}];}if(!_0x1a9ab8['query'][_0x8488('0x53')](_0x8488('0x54'))){_0x389900[_0x8488('0x55')]=qs[_0x8488('0x55')](_0x1a9ab8['query'][_0x8488('0x55')]);_0x389900[_0x8488('0x2e')]=qs[_0x8488('0x2e')](_0x1a9ab8[_0x8488('0x4c')][_0x8488('0x2e')]);}return _0x484a83[_0x8488('0xbd')](_0x389900);}})[_0x8488('0x1f')](function(_0x1a0375){if(_0x1a0375){return _0x1a0375?{'count':_0x1f5299,'rows':_0x1a0375}:null;}})[_0x8488('0x1f')](respondWithResult(_0x3a4c8,null))[_0x8488('0x28')](handleError(_0x3a4c8,null));};exports[_0x8488('0xc2')]=function(_0x545002,_0x4c94a2,_0x582571){var _0x405abc;var _0x4b7056;var _0x20863a={};var _0x5dc811;return db[_0x8488('0x5f')][_0x8488('0xbb')]({'where':{'id':_0x545002[_0x8488('0x62')]['id']},'attributes':['id',_0x8488('0x43'),'role']})['then'](handleEntityNotFound(_0x4c94a2,null))[_0x8488('0x1f')](function(_0x5092c1){if(!utils[_0x8488('0x9e')](_0x545002['query'][_0x8488('0x99')])){throw new db[(_0x8488('0x1c'))]['ValidationError'](_0x8488('0x9f'));}_0x405abc=_0x5092c1;var _0x28b613={};_0x28b613[_0x8488('0x49')]=_[_0x8488('0x4d')](db[_[_0x8488('0xa5')](_0x545002[_0x8488('0x4c')][_0x8488('0x99')])+_0x8488('0xc3')][_0x8488('0x46')]);_0x28b613[_0x8488('0x4c')]=_[_0x8488('0x4d')](_0x545002[_0x8488('0x4c')]);_0x28b613['filters']=_[_0x8488('0x4f')](_0x28b613[_0x8488('0x49')],_0x28b613[_0x8488('0x4c')]);_0x20863a['attributes']=_[_0x8488('0x4f')](_0x28b613['model'],qs[_0x8488('0x51')](_0x545002[_0x8488('0x4c')][_0x8488('0x51')]));_0x20863a['attributes']=_0x20863a['attributes'][_0x8488('0x52')]?_0x20863a[_0x8488('0x50')]:_0x28b613[_0x8488('0x49')];_0x20863a[_0x8488('0x56')]=qs[_0x8488('0x57')](_0x545002['query']['sort']);_0x20863a['where']=qs[_0x8488('0x4e')](_[_0x8488('0x59')](_0x545002[_0x8488('0x4c')],_0x28b613[_0x8488('0x4e')]));if(_0x545002['query'][_0x8488('0x3a')]){_0x20863a[_0x8488('0x58')]=_[_0x8488('0x5d')](_0x20863a['where'],{'$or':_[_0x8488('0x3c')](_0x20863a['attributes'],function(_0x4b3362){var _0x431f3e={};_0x431f3e[_0x4b3362]={'$like':'%'+_0x545002[_0x8488('0x4c')][_0x8488('0x3a')]+'%'};return _0x431f3e;})});}_0x20863a=_['merge']({},_0x20863a,_0x545002[_0x8488('0x5e')]);switch(_0x405abc['role']){case'admin':return db[_[_0x8488('0xa5')](_0x545002[_0x8488('0x4c')]['channel'])+_0x8488('0xc3')]['findAll'](_0x20863a);case _0x8488('0x6a'):case _0x8488('0x38'):return _0x405abc['get'+_['capitalize'](_0x545002[_0x8488('0x4c')][_0x8488('0x99')])+_0x8488('0xa2')](_0x20863a);default:throw new db[(_0x8488('0x1c'))]['ValidationError'](_0x8488('0xc4'));}})[_0x8488('0x1f')](function(_0x134e7d){_0x5dc811=_0x134e7d['length'];if(!_0x545002[_0x8488('0x4c')][_0x8488('0x53')]('nolimit')){_0x20863a[_0x8488('0x55')]=qs[_0x8488('0x55')](_0x545002[_0x8488('0x4c')]['limit']);_0x20863a[_0x8488('0x2e')]=qs[_0x8488('0x2e')](_0x545002[_0x8488('0x4c')][_0x8488('0x2e')]);}switch(_0x405abc[_0x8488('0x3f')]){case'admin':return db[_[_0x8488('0xa5')](_0x545002[_0x8488('0x4c')][_0x8488('0x99')])+_0x8488('0xc3')]['findAll'](_0x20863a);case'user':case _0x8488('0x38'):return _0x405abc['get'+_[_0x8488('0xa5')](_0x545002['query'][_0x8488('0x99')])+_0x8488('0xa2')](_0x20863a);}})['then'](function(_0x5747e3){return{'count':_0x5dc811,'rows':_0x5747e3};})['then'](respondWithResult(_0x4c94a2,null))[_0x8488('0x28')](handleError(_0x4c94a2,null));};exports[_0x8488('0xc5')]=function(_0xbdf6c8,_0x52448b,_0x3c9267){var _0x32a7cb={};var _0x1d0f09={};var _0x7cbe8e;var _0x2d3196;return db[_0x8488('0x5f')][_0x8488('0xbb')]({'where':{'id':_0xbdf6c8[_0x8488('0x62')]['id']}})['then'](handleEntityNotFound(_0x52448b,null))[_0x8488('0x1f')](function(_0x513cbf){if(_0x513cbf){_0x7cbe8e=_0x513cbf;_0x1d0f09[_0x8488('0x49')]=_['keys'](db[_0x8488('0xad')]['rawAttributes']);_0x1d0f09['query']=_[_0x8488('0x4d')](_0xbdf6c8['query']);_0x1d0f09[_0x8488('0x4e')]=_['intersection'](_0x1d0f09[_0x8488('0x49')],_0x1d0f09['query']);_0x32a7cb['attributes']=_['intersection'](_0x1d0f09[_0x8488('0x49')],qs['fields'](_0xbdf6c8[_0x8488('0x4c')][_0x8488('0x51')]));_0x32a7cb[_0x8488('0x50')]=_0x32a7cb[_0x8488('0x50')][_0x8488('0x52')]?_0x32a7cb[_0x8488('0x50')]:_0x1d0f09['model'];_0x32a7cb[_0x8488('0x56')]=qs['sort'](_0xbdf6c8[_0x8488('0x4c')][_0x8488('0x57')]);_0x32a7cb[_0x8488('0x58')]=qs[_0x8488('0x4e')](_[_0x8488('0x59')](_0xbdf6c8['query'],_0x1d0f09[_0x8488('0x4e')]));if(_0xbdf6c8['query']['filter']){_0x32a7cb[_0x8488('0x58')]=_['merge'](_0x32a7cb[_0x8488('0x58')],{'$or':_[_0x8488('0x3c')](_0x32a7cb[_0x8488('0x50')],function(_0x3abbe0){var _0x146bc5={};_0x146bc5[_0x3abbe0]={'$like':'%'+_0xbdf6c8[_0x8488('0x4c')][_0x8488('0x3a')]+'%'};return _0x146bc5;})});}_0x32a7cb=_[_0x8488('0x5d')]({},_0x32a7cb,_0xbdf6c8['options']);return _0x7cbe8e[_0x8488('0xc5')](_0x32a7cb);}})[_0x8488('0x1f')](function(_0x42295c){if(_0x42295c){_0x2d3196=_0x42295c['length'];if(!_0xbdf6c8['query'][_0x8488('0x53')](_0x8488('0x54'))){_0x32a7cb[_0x8488('0x55')]=qs[_0x8488('0x55')](_0xbdf6c8[_0x8488('0x4c')][_0x8488('0x55')]);_0x32a7cb[_0x8488('0x2e')]=qs[_0x8488('0x2e')](_0xbdf6c8[_0x8488('0x4c')][_0x8488('0x2e')]);}return _0x7cbe8e[_0x8488('0xc5')](_0x32a7cb);}})[_0x8488('0x1f')](function(_0x30f0f3){if(_0x30f0f3){return _0x30f0f3?{'count':_0x2d3196,'rows':_0x30f0f3}:null;}})['then'](respondWithResult(_0x52448b,null))[_0x8488('0x28')](handleError(_0x52448b,null));};exports[_0x8488('0xc6')]=function(_0x40c983,_0x2974d2,_0x250c40){var _0x55c112={};var _0x5bc53d={};var _0x308595;var _0x230161;return db[_0x8488('0x5f')]['findOne']({'where':{'id':_0x40c983[_0x8488('0x62')]['id']}})[_0x8488('0x1f')](handleEntityNotFound(_0x2974d2,null))[_0x8488('0x1f')](function(_0x2d1df3){if(_0x2d1df3){_0x308595=_0x2d1df3;_0x5bc53d[_0x8488('0x49')]=_[_0x8488('0x4d')](db[_0x8488('0xc7')][_0x8488('0x46')]);_0x5bc53d[_0x8488('0x4c')]=_[_0x8488('0x4d')](_0x40c983[_0x8488('0x4c')]);_0x5bc53d[_0x8488('0x4e')]=_[_0x8488('0x4f')](_0x5bc53d[_0x8488('0x49')],_0x5bc53d[_0x8488('0x4c')]);_0x55c112[_0x8488('0x50')]=_[_0x8488('0x4f')](_0x5bc53d[_0x8488('0x49')],qs[_0x8488('0x51')](_0x40c983[_0x8488('0x4c')][_0x8488('0x51')]));_0x55c112[_0x8488('0x50')]=_0x55c112['attributes']['length']?_0x55c112[_0x8488('0x50')]:_0x5bc53d[_0x8488('0x49')];_0x55c112[_0x8488('0x56')]=qs[_0x8488('0x57')](_0x40c983[_0x8488('0x4c')]['sort']);_0x55c112[_0x8488('0x58')]=qs[_0x8488('0x4e')](_[_0x8488('0x59')](_0x40c983[_0x8488('0x4c')],_0x5bc53d[_0x8488('0x4e')]));if(_0x40c983[_0x8488('0x4c')][_0x8488('0x3a')]){_0x55c112[_0x8488('0x58')]=_['merge'](_0x55c112[_0x8488('0x58')],{'$or':_[_0x8488('0x3c')](_0x55c112[_0x8488('0x50')],function(_0x182378){var _0x78f35={};_0x78f35[_0x182378]={'$like':'%'+_0x40c983[_0x8488('0x4c')][_0x8488('0x3a')]+'%'};return _0x78f35;})});}_0x55c112=_['merge']({},_0x55c112,_0x40c983[_0x8488('0x5e')]);return _0x308595[_0x8488('0xc6')](_0x55c112);}})[_0x8488('0x1f')](function(_0x15308d){if(_0x15308d){_0x230161=_0x15308d[_0x8488('0x52')];if(!_0x40c983[_0x8488('0x4c')][_0x8488('0x53')](_0x8488('0x54'))){_0x55c112['limit']=qs[_0x8488('0x55')](_0x40c983[_0x8488('0x4c')][_0x8488('0x55')]);_0x55c112[_0x8488('0x2e')]=qs[_0x8488('0x2e')](_0x40c983[_0x8488('0x4c')][_0x8488('0x2e')]);}return _0x308595[_0x8488('0xc6')](_0x55c112);}})[_0x8488('0x1f')](function(_0x2223ba){if(_0x2223ba){return _0x2223ba?{'count':_0x230161,'rows':_0x2223ba}:null;}})[_0x8488('0x1f')](respondWithResult(_0x2974d2,null))['catch'](handleError(_0x2974d2,null));};exports[_0x8488('0xc8')]=function(_0x5608c4,_0x5d3b8d,_0x51f315){var _0x3f0489={'raw':!![],'where':{}};var _0x4b0c25={};var _0x5b4f8e={'count':0x0,'rows':[]};return db['User'][_0x8488('0xbb')]({'where':{'id':_0x5608c4[_0x8488('0x62')]['id']}})['then'](handleEntityNotFound(_0x5d3b8d,null))[_0x8488('0x1f')](function(_0x494d10){if(_0x494d10){_0x4b0c25['model']=_['keys'](db[_0x8488('0xc9')][_0x8488('0x46')]);_0x4b0c25['query']=_['keys'](_0x5608c4[_0x8488('0x4c')]);_0x4b0c25[_0x8488('0x4e')]=_[_0x8488('0x4f')](_0x4b0c25['model'],_0x4b0c25[_0x8488('0x4c')]);_0x3f0489[_0x8488('0x50')]=_[_0x8488('0x4f')](_0x4b0c25[_0x8488('0x49')],qs[_0x8488('0x51')](_0x5608c4['query'][_0x8488('0x51')]));_0x3f0489[_0x8488('0x50')]=_0x3f0489[_0x8488('0x50')][_0x8488('0x52')]?_0x3f0489[_0x8488('0x50')]:_0x4b0c25['model'];if(!_0x5608c4['query'][_0x8488('0x53')](_0x8488('0x54'))){_0x3f0489[_0x8488('0x55')]=qs['limit'](_0x5608c4['query']['limit']);_0x3f0489[_0x8488('0x2e')]=qs[_0x8488('0x2e')](_0x5608c4[_0x8488('0x4c')]['offset']);}_0x3f0489[_0x8488('0x56')]=qs['sort'](_0x5608c4[_0x8488('0x4c')]['sort']);_0x3f0489[_0x8488('0x58')]=qs['filters'](_[_0x8488('0x59')](_0x5608c4[_0x8488('0x4c')],_0x4b0c25[_0x8488('0x4e')]));_0x3f0489[_0x8488('0x58')]['UserId']=_0x494d10['id'];if(_0x5608c4[_0x8488('0x4c')][_0x8488('0x3a')]){_0x3f0489[_0x8488('0x58')]=_[_0x8488('0x5d')](_0x3f0489[_0x8488('0x58')],{'$or':_[_0x8488('0x3c')](_0x3f0489[_0x8488('0x50')],function(_0x33e945){var _0x148a01={};_0x148a01[_0x33e945]={'$like':'%'+_0x5608c4[_0x8488('0x4c')]['filter']+'%'};return _0x148a01;})});}_0x3f0489=_[_0x8488('0x5d')]({},_0x3f0489,_0x5608c4['options']);return db[_0x8488('0xc9')]['count']({'where':_0x3f0489[_0x8488('0x58')]})[_0x8488('0x1f')](function(_0x10ad67){_0x5b4f8e['count']=_0x10ad67;if(_0x5608c4[_0x8488('0x4c')][_0x8488('0x60')]){_0x3f0489[_0x8488('0xbe')]=[{'all':!![]}];}return db[_0x8488('0xc9')][_0x8488('0xaa')](_0x3f0489);})[_0x8488('0x1f')](function(_0x12ead5){_0x5b4f8e['rows']=_0x12ead5;return _0x5b4f8e;});}})[_0x8488('0x1f')](respondWithFilteredResult(_0x5d3b8d,_0x3f0489))[_0x8488('0x28')](handleError(_0x5d3b8d,null));};exports[_0x8488('0xca')]=function(_0x1aef84,_0x607f7,_0x5ed2b2){var _0x45faf0={'raw':!![],'where':{}};var _0x3f2b1d={};var _0x40f6bf={'count':0x0,'rows':[]};return db['User'][_0x8488('0xbb')]({'where':{'id':_0x1aef84['params']['id']}})['then'](handleEntityNotFound(_0x607f7,null))[_0x8488('0x1f')](function(_0x377785){if(_0x377785){_0x3f2b1d[_0x8488('0x49')]=_[_0x8488('0x4d')](db[_0x8488('0xcb')][_0x8488('0x46')]);_0x3f2b1d['query']=_['keys'](_0x1aef84[_0x8488('0x4c')]);_0x3f2b1d[_0x8488('0x4e')]=_[_0x8488('0x4f')](_0x3f2b1d['model'],_0x3f2b1d[_0x8488('0x4c')]);_0x45faf0[_0x8488('0x50')]=_[_0x8488('0x4f')](_0x3f2b1d[_0x8488('0x49')],qs['fields'](_0x1aef84[_0x8488('0x4c')][_0x8488('0x51')]));_0x45faf0[_0x8488('0x50')]=_0x45faf0[_0x8488('0x50')][_0x8488('0x52')]?_0x45faf0['attributes']:_0x3f2b1d['model'];if(!_0x1aef84[_0x8488('0x4c')]['hasOwnProperty'](_0x8488('0x54'))){_0x45faf0[_0x8488('0x55')]=qs[_0x8488('0x55')](_0x1aef84['query'][_0x8488('0x55')]);_0x45faf0[_0x8488('0x2e')]=qs['offset'](_0x1aef84[_0x8488('0x4c')][_0x8488('0x2e')]);}_0x45faf0['order']=qs[_0x8488('0x57')](_0x1aef84[_0x8488('0x4c')]['sort']);_0x45faf0['where']=qs['filters'](_[_0x8488('0x59')](_0x1aef84[_0x8488('0x4c')],_0x3f2b1d['filters']));_0x45faf0['where'][_0x8488('0xcc')]=_0x377785['id'];if(_0x1aef84[_0x8488('0x4c')][_0x8488('0x3a')]){_0x45faf0[_0x8488('0x58')]=_[_0x8488('0x5d')](_0x45faf0['where'],{'$or':_[_0x8488('0x3c')](_0x45faf0[_0x8488('0x50')],function(_0x2548f2){var _0x52a3b8={};_0x52a3b8[_0x2548f2]={'$like':'%'+_0x1aef84['query'][_0x8488('0x3a')]+'%'};return _0x52a3b8;})});}_0x45faf0=_[_0x8488('0x5d')]({},_0x45faf0,_0x1aef84[_0x8488('0x5e')]);return db['ScreenRecording'][_0x8488('0x2d')]({'where':_0x45faf0[_0x8488('0x58')]})[_0x8488('0x1f')](function(_0x1e42d8){_0x40f6bf[_0x8488('0x2d')]=_0x1e42d8;if(_0x1aef84['query'][_0x8488('0x60')]){_0x45faf0[_0x8488('0xbe')]=[{'all':!![]}];}return db['ScreenRecording'][_0x8488('0xaa')](_0x45faf0);})['then'](function(_0x1f17a0){_0x40f6bf[_0x8488('0xcd')]=_0x1f17a0;return _0x40f6bf;});}})[_0x8488('0x1f')](respondWithFilteredResult(_0x607f7,_0x45faf0))['catch'](handleError(_0x607f7,null));};exports[_0x8488('0xce')]=function(_0x40e0e3,_0x497df1,_0x80afbe){var _0x193c11={};var _0x5f0436={};var _0x29665d;var _0x53d504;return db[_0x8488('0x5f')][_0x8488('0xbb')]({'where':{'id':_0x40e0e3[_0x8488('0x62')]['id']}})[_0x8488('0x1f')](handleEntityNotFound(_0x497df1,null))[_0x8488('0x1f')](function(_0x483aea){if(_0x483aea){_0x29665d=_0x483aea;_0x5f0436[_0x8488('0x49')]=_['keys'](db['ChatInteraction']['rawAttributes']);_0x5f0436[_0x8488('0x4c')]=_['keys'](_0x40e0e3[_0x8488('0x4c')]);_0x5f0436[_0x8488('0x4e')]=_[_0x8488('0x4f')](_0x5f0436[_0x8488('0x49')],_0x5f0436[_0x8488('0x4c')]);_0x193c11['attributes']=_[_0x8488('0x4f')](_0x5f0436[_0x8488('0x49')],qs[_0x8488('0x51')](_0x40e0e3[_0x8488('0x4c')]['fields']));_0x193c11[_0x8488('0x50')]=_0x193c11['attributes'][_0x8488('0x52')]?_0x193c11[_0x8488('0x50')]:_0x5f0436[_0x8488('0x49')];_0x193c11[_0x8488('0x56')]=qs['sort'](_0x40e0e3[_0x8488('0x4c')]['sort']);_0x193c11[_0x8488('0x58')]=qs[_0x8488('0x4e')](_['pick'](_0x40e0e3[_0x8488('0x4c')],_0x5f0436[_0x8488('0x4e')]));if(_0x40e0e3[_0x8488('0x4c')][_0x8488('0x3a')]){_0x193c11['where']=_[_0x8488('0x5d')](_0x193c11[_0x8488('0x58')],{'$or':_[_0x8488('0x3c')](_0x193c11[_0x8488('0x50')],function(_0x422c18){var _0x1fe4fb={};_0x1fe4fb[_0x422c18]={'$like':'%'+_0x40e0e3['query'][_0x8488('0x3a')]+'%'};return _0x1fe4fb;})});}_0x193c11=_[_0x8488('0x5d')]({},_0x193c11,_0x40e0e3[_0x8488('0x5e')]);return _0x29665d[_0x8488('0xce')](_0x193c11);}})[_0x8488('0x1f')](function(_0x3334db){if(_0x3334db){_0x53d504=_0x3334db[_0x8488('0x52')];if(!_0x40e0e3[_0x8488('0x4c')][_0x8488('0x53')](_0x8488('0x54'))){_0x193c11['limit']=qs['limit'](_0x40e0e3[_0x8488('0x4c')][_0x8488('0x55')]);_0x193c11['offset']=qs['offset'](_0x40e0e3[_0x8488('0x4c')][_0x8488('0x2e')]);}return _0x29665d[_0x8488('0xce')](_0x193c11);}})['then'](function(_0x297db2){if(_0x297db2){return _0x297db2?{'count':_0x53d504,'rows':_0x297db2}:null;}})[_0x8488('0x1f')](respondWithResult(_0x497df1,null))[_0x8488('0x28')](handleError(_0x497df1,null));};exports[_0x8488('0xcf')]=function(_0x14bc18,_0x26e170,_0x54f2ca){var _0x40d363={};var _0x24c6a0={};var _0x27c74c;var _0x492696;return db[_0x8488('0x5f')][_0x8488('0xbb')]({'where':{'id':_0x14bc18[_0x8488('0x62')]['id']}})[_0x8488('0x1f')](handleEntityNotFound(_0x26e170,null))[_0x8488('0x1f')](function(_0x635381){if(_0x635381){_0x27c74c=_0x635381;_0x24c6a0[_0x8488('0x49')]=_['keys'](db[_0x8488('0xd0')][_0x8488('0x46')]);_0x24c6a0['query']=_[_0x8488('0x4d')](_0x14bc18[_0x8488('0x4c')]);_0x24c6a0['filters']=_['intersection'](_0x24c6a0['model'],_0x24c6a0[_0x8488('0x4c')]);_0x40d363[_0x8488('0x50')]=_[_0x8488('0x4f')](_0x24c6a0[_0x8488('0x49')],qs['fields'](_0x14bc18[_0x8488('0x4c')][_0x8488('0x51')]));_0x40d363[_0x8488('0x50')]=_0x40d363[_0x8488('0x50')][_0x8488('0x52')]?_0x40d363[_0x8488('0x50')]:_0x24c6a0[_0x8488('0x49')];_0x40d363['order']=qs[_0x8488('0x57')](_0x14bc18[_0x8488('0x4c')]['sort']);_0x40d363[_0x8488('0x58')]=qs[_0x8488('0x4e')](_[_0x8488('0x59')](_0x14bc18['query'],_0x24c6a0[_0x8488('0x4e')]));if(_0x14bc18['query'][_0x8488('0x3a')]){_0x40d363[_0x8488('0x58')]=_[_0x8488('0x5d')](_0x40d363[_0x8488('0x58')],{'$or':_['map'](_0x40d363[_0x8488('0x50')],function(_0x4378d8){var _0x34685e={};_0x34685e[_0x4378d8]={'$like':'%'+_0x14bc18['query'][_0x8488('0x3a')]+'%'};return _0x34685e;})});}_0x40d363=_[_0x8488('0x5d')]({},_0x40d363,_0x14bc18[_0x8488('0x5e')]);return _0x27c74c['getOpenchannelInteractions'](_0x40d363);}})[_0x8488('0x1f')](function(_0x4a9ef9){if(_0x4a9ef9){_0x492696=_0x4a9ef9[_0x8488('0x52')];if(!_0x14bc18[_0x8488('0x4c')][_0x8488('0x53')](_0x8488('0x54'))){_0x40d363[_0x8488('0x55')]=qs[_0x8488('0x55')](_0x14bc18[_0x8488('0x4c')][_0x8488('0x55')]);_0x40d363[_0x8488('0x2e')]=qs[_0x8488('0x2e')](_0x14bc18[_0x8488('0x4c')][_0x8488('0x2e')]);}return _0x27c74c['getOpenchannelInteractions'](_0x40d363);}})['then'](function(_0xcafb24){if(_0xcafb24){return _0xcafb24?{'count':_0x492696,'rows':_0xcafb24}:null;}})[_0x8488('0x1f')](respondWithResult(_0x26e170,null))[_0x8488('0x28')](handleError(_0x26e170,null));};exports[_0x8488('0xd1')]=function(_0xce1bf2,_0x255439,_0x474b66){var _0x33c22b={'raw':!![],'where':{}};var _0x554a99={};var _0x5b155c={'count':0x0,'rows':[]};return db[_0x8488('0x5f')][_0x8488('0xbb')]({'where':{'id':_0xce1bf2[_0x8488('0x62')]['id']}})[_0x8488('0x1f')](handleEntityNotFound(_0x255439,null))[_0x8488('0x1f')](function(_0x30137f){if(_0x30137f){_0x554a99[_0x8488('0x49')]=_['keys'](db[_0x8488('0xd2')][_0x8488('0x46')]);_0x554a99['query']=_['keys'](_0xce1bf2['query']);_0x554a99[_0x8488('0x4e')]=_[_0x8488('0x4f')](_0x554a99[_0x8488('0x49')],_0x554a99['query']);_0x33c22b['attributes']=_[_0x8488('0x4f')](_0x554a99[_0x8488('0x49')],qs['fields'](_0xce1bf2['query'][_0x8488('0x51')]));_0x33c22b['attributes']=_0x33c22b[_0x8488('0x50')][_0x8488('0x52')]?_0x33c22b[_0x8488('0x50')]:_0x554a99['model'];if(!_0xce1bf2['query']['hasOwnProperty']('nolimit')){_0x33c22b['limit']=qs[_0x8488('0x55')](_0xce1bf2[_0x8488('0x4c')][_0x8488('0x55')]);_0x33c22b[_0x8488('0x2e')]=qs['offset'](_0xce1bf2[_0x8488('0x4c')]['offset']);}_0x33c22b['order']=qs['sort'](_0xce1bf2[_0x8488('0x4c')][_0x8488('0x57')]);_0x33c22b['where']=qs[_0x8488('0x4e')](_[_0x8488('0x59')](_0xce1bf2[_0x8488('0x4c')],_0x554a99[_0x8488('0x4e')]));_0x33c22b[_0x8488('0x58')]['UserId']=_0x30137f['id'];if(_0xce1bf2[_0x8488('0x4c')][_0x8488('0x3a')]){_0x33c22b[_0x8488('0x58')]=_[_0x8488('0x5d')](_0x33c22b[_0x8488('0x58')],{'$or':_[_0x8488('0x3c')](_0x33c22b[_0x8488('0x50')],function(_0x1eccf8){var _0x8129d0={};_0x8129d0[_0x1eccf8]={'$like':'%'+_0xce1bf2[_0x8488('0x4c')]['filter']+'%'};return _0x8129d0;})});}_0x33c22b=_[_0x8488('0x5d')]({},_0x33c22b,_0xce1bf2['options']);return db['MailInteraction']['count']({'where':_0x33c22b['where']})['then'](function(_0x13d287){_0x5b155c['count']=_0x13d287;if(_0xce1bf2[_0x8488('0x4c')][_0x8488('0x60')]){_0x33c22b['include']=[{'all':!![]}];}return db[_0x8488('0xd2')][_0x8488('0xaa')](_0x33c22b);})[_0x8488('0x1f')](function(_0x166be8){_0x5b155c['rows']=_0x166be8;return _0x5b155c;});}})[_0x8488('0x1f')](respondWithFilteredResult(_0x255439,_0x33c22b))[_0x8488('0x28')](handleError(_0x255439,null));};exports[_0x8488('0xd3')]=function(_0x15724c,_0x3533fd,_0x5ca903){var _0x32bf2c={};var _0x4a4e81={};var _0x44a23b;var _0x1dec39;return db['User']['findOne']({'where':{'id':_0x15724c[_0x8488('0x62')]['id']}})[_0x8488('0x1f')](handleEntityNotFound(_0x3533fd,null))[_0x8488('0x1f')](function(_0x29131a){if(_0x29131a){_0x44a23b=_0x29131a;_0x4a4e81[_0x8488('0x49')]=_['keys'](db[_0x8488('0xd4')][_0x8488('0x46')]);_0x4a4e81[_0x8488('0x4c')]=_[_0x8488('0x4d')](_0x15724c['query']);_0x4a4e81[_0x8488('0x4e')]=_['intersection'](_0x4a4e81[_0x8488('0x49')],_0x4a4e81[_0x8488('0x4c')]);_0x32bf2c[_0x8488('0x50')]=_[_0x8488('0x4f')](_0x4a4e81[_0x8488('0x49')],qs['fields'](_0x15724c[_0x8488('0x4c')]['fields']));_0x32bf2c[_0x8488('0x50')]=_0x32bf2c['attributes'][_0x8488('0x52')]?_0x32bf2c[_0x8488('0x50')]:_0x4a4e81[_0x8488('0x49')];_0x32bf2c['order']=qs[_0x8488('0x57')](_0x15724c[_0x8488('0x4c')][_0x8488('0x57')]);_0x32bf2c[_0x8488('0x58')]=qs[_0x8488('0x4e')](_[_0x8488('0x59')](_0x15724c[_0x8488('0x4c')],_0x4a4e81[_0x8488('0x4e')]));if(_0x15724c[_0x8488('0x4c')]['filter']){_0x32bf2c[_0x8488('0x58')]=_[_0x8488('0x5d')](_0x32bf2c['where'],{'$or':_[_0x8488('0x3c')](_0x32bf2c[_0x8488('0x50')],function(_0x5e52c0){var _0x1cfd46={};_0x1cfd46[_0x5e52c0]={'$like':'%'+_0x15724c[_0x8488('0x4c')][_0x8488('0x3a')]+'%'};return _0x1cfd46;})});}_0x32bf2c=_[_0x8488('0x5d')]({},_0x32bf2c,_0x15724c[_0x8488('0x5e')]);return _0x44a23b[_0x8488('0xd3')](_0x32bf2c);}})[_0x8488('0x1f')](function(_0x2361c7){if(_0x2361c7){_0x1dec39=_0x2361c7['length'];if(!_0x15724c[_0x8488('0x4c')][_0x8488('0x53')](_0x8488('0x54'))){_0x32bf2c[_0x8488('0x55')]=qs[_0x8488('0x55')](_0x15724c[_0x8488('0x4c')]['limit']);_0x32bf2c[_0x8488('0x2e')]=qs['offset'](_0x15724c[_0x8488('0x4c')][_0x8488('0x2e')]);}return _0x44a23b['getSmsInteractions'](_0x32bf2c);}})['then'](function(_0x4f8a23){if(_0x4f8a23){return _0x4f8a23?{'count':_0x1dec39,'rows':_0x4f8a23}:null;}})['then'](respondWithResult(_0x3533fd,null))['catch'](handleError(_0x3533fd,null));};exports[_0x8488('0xd5')]=function(_0x8e67f,_0x5f010b,_0x4caf18){var _0x36512b={};var _0x4f4439={};var _0x34f112;var _0x5be63a;return db['User'][_0x8488('0xbb')]({'where':{'id':_0x8e67f[_0x8488('0x62')]['id']}})[_0x8488('0x1f')](handleEntityNotFound(_0x5f010b,null))[_0x8488('0x1f')](function(_0xf28d68){if(_0xf28d68){_0x34f112=_0xf28d68;_0x4f4439['model']=_[_0x8488('0x4d')](db['FaxInteraction']['rawAttributes']);_0x4f4439[_0x8488('0x4c')]=_[_0x8488('0x4d')](_0x8e67f[_0x8488('0x4c')]);_0x4f4439[_0x8488('0x4e')]=_['intersection'](_0x4f4439[_0x8488('0x49')],_0x4f4439['query']);_0x36512b['attributes']=_['intersection'](_0x4f4439[_0x8488('0x49')],qs[_0x8488('0x51')](_0x8e67f['query']['fields']));_0x36512b[_0x8488('0x50')]=_0x36512b[_0x8488('0x50')][_0x8488('0x52')]?_0x36512b[_0x8488('0x50')]:_0x4f4439[_0x8488('0x49')];_0x36512b[_0x8488('0x56')]=qs[_0x8488('0x57')](_0x8e67f[_0x8488('0x4c')][_0x8488('0x57')]);_0x36512b[_0x8488('0x58')]=qs[_0x8488('0x4e')](_[_0x8488('0x59')](_0x8e67f['query'],_0x4f4439[_0x8488('0x4e')]));if(_0x8e67f[_0x8488('0x4c')][_0x8488('0x3a')]){_0x36512b['where']=_[_0x8488('0x5d')](_0x36512b[_0x8488('0x58')],{'$or':_[_0x8488('0x3c')](_0x36512b[_0x8488('0x50')],function(_0x4e2901){var _0x2d934e={};_0x2d934e[_0x4e2901]={'$like':'%'+_0x8e67f['query']['filter']+'%'};return _0x2d934e;})});}_0x36512b=_[_0x8488('0x5d')]({},_0x36512b,_0x8e67f['options']);return _0x34f112[_0x8488('0xd5')](_0x36512b);}})[_0x8488('0x1f')](function(_0x3f86e3){if(_0x3f86e3){_0x5be63a=_0x3f86e3[_0x8488('0x52')];if(!_0x8e67f[_0x8488('0x4c')]['hasOwnProperty'](_0x8488('0x54'))){_0x36512b[_0x8488('0x55')]=qs[_0x8488('0x55')](_0x8e67f['query'][_0x8488('0x55')]);_0x36512b[_0x8488('0x2e')]=qs[_0x8488('0x2e')](_0x8e67f['query']['offset']);}return _0x34f112['getFaxInteractions'](_0x36512b);}})['then'](function(_0x1f6282){if(_0x1f6282){return _0x1f6282?{'count':_0x5be63a,'rows':_0x1f6282}:null;}})[_0x8488('0x1f')](respondWithResult(_0x5f010b,null))[_0x8488('0x28')](handleError(_0x5f010b,null));};exports[_0x8488('0xd6')]=function(_0x166955,_0x20882a,_0x228510){var _0x77fb19;var _0x3f648d;var _0x1dc353;var _0x484a4a=!_['isNil'](_0x166955[_0x8488('0x62')]['id'])?_0x166955[_0x8488('0x62')]['id']:!_[_0x8488('0x6e')](_0x166955[_0x8488('0x6a')]['id'])?_0x166955['user']['id']:null;return db['User'][_0x8488('0x40')]({'where':{'id':_0x484a4a,'role':{'$or':[_0x8488('0x69'),_0x8488('0x6a'),_0x8488('0x38')]}},'attributes':['id','name',_0x8488('0xd7'),'mobile',_0x8488('0x3f'),_0x8488('0x72'),_0x8488('0x9b')]})[_0x8488('0x1f')](function(_0x407e63){if(_0x407e63){if(_0x407e63['role']==='agent'){_0x77fb19=_0x407e63;if(_0x166955['body'][_0x8488('0x9d')]){_0x1dc353=util[_0x8488('0x70')]('LOCAL/%s@from-sip/n',_0x77fb19[_0x166955[_0x8488('0x64')][_0x8488('0x9d')]]);}else if(_0x166955['body']['intrf']){_0x1dc353=util[_0x8488('0x70')](_0x8488('0xd8'),_0x166955[_0x8488('0x64')]['intrf']);}else{_0x1dc353=util['format'](_0x8488('0xd8'),_0x77fb19[_0x8488('0x43')]);}socket['to'](util[_0x8488('0x70')]('user:%s',_0x77fb19[_0x8488('0x43')]))['emit']('user:forcelogout',{'ip':_0x166955[_0x8488('0xd9')][_0x8488('0xda')]||_0x166955[_0x8488('0xdb')][_0x8488('0xdc')]||_0x166955['socket']['remoteAddress']||_0x166955['connection'][_0x8488('0xdd')]['remoteAddress']});return db['UserVoiceQueueRt'][_0x8488('0x34')]({'where':{'membername':_0x77fb19[_0x8488('0x43')]},'individualHooks':!![]});}}else{throw new db['Sequelize'][(_0x8488('0x93'))](_0x8488('0xde'));}})[_0x8488('0x1f')](function(){if(_0x77fb19){return _0x77fb19[_0x8488('0xdf')]({'raw':!![]});}})[_0x8488('0x1f')](function(_0x3b7af7){if(_0x77fb19){var _0x54fbf4=[];if(_0x3b7af7){_0x3f648d=_0x3b7af7;if(_0x3f648d['length']){for(var _0xdd74e8=0x0;_0xdd74e8<_0x3f648d[_0x8488('0x52')];_0xdd74e8++){_0x54fbf4[_0x8488('0xab')]({'membername':_0x77fb19[_0x8488('0x43')],'UserId':_0x77fb19['id'],'queue_name':_0x3f648d[_0xdd74e8]['name'],'VoiceQueueId':_0x3f648d[_0xdd74e8]['id'],'interface':_0x1dc353,'paused':_0x77fb19[_0x8488('0x9b')]||![],'penalty':_0x3f648d[_0xdd74e8][_0x8488('0xe0')]||0x0});}return BPromise[_0x8488('0xac')](_0x54fbf4,function(_0x2deb44){return db[_0x8488('0xad')][_0x8488('0xae')](_0x2deb44);});}}}})[_0x8488('0x1f')](function(){if(_0x77fb19){return db[_0x8488('0xe1')][_0x8488('0xaa')]({'where':{'membername':_0x77fb19['name'],'exitAt':null}});}})[_0x8488('0x1f')](function(_0x3ba834){if(_0x77fb19){var _0xc4fd41=[];_0x3ba834[_0x8488('0xe2')](function(_0x33ae28){_0xc4fd41[_0x8488('0xab')](_0x33ae28[_0x8488('0x33')]({'exitAt':moment()[_0x8488('0x70')](_0x8488('0xe3'))}));});return BPromise[_0x8488('0xe4')](_0xc4fd41);}})[_0x8488('0x1f')](function(){if(_0x77fb19){var _0x431fb9=[];var _0x583604=[];var _0x2cb583=utils[_0x8488('0xe5')]();var _0x410238={'membername':_0x77fb19[_0x8488('0x43')],'interface':_0x1dc353,'enterAt':moment()[_0x8488('0x70')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x77fb19[_0x8488('0x3f')],'internal':_0x77fb19[_0x8488('0x72')]};_0x2cb583[_0x8488('0xe2')](function(_0x39e2cf){_0x431fb9[_0x8488('0xab')](_[_0x8488('0x5d')]({'channel':_0x39e2cf,'type':'LOGIN','data1':_0x166955[_0x8488('0x64')][_0x8488('0xe6')],'data2':_0x1dc353},_0x410238));if(_0x77fb19[_0x8488('0x9b')]){_0x583604[_0x8488('0xab')](_[_0x8488('0x5d')]({'channel':_0x39e2cf,'type':'PAUSE','data1':_0x8488('0xe7')},_0x410238));}});return db[_0x8488('0xe1')][_0x8488('0x63')](_0x431fb9['concat'](_0x583604),{'individualHooks':!![]});}})[_0x8488('0x1f')](function(){if(_0x77fb19){return _0x77fb19[_0x8488('0x33')]({'online':!![],'lastLoginAt':moment()[_0x8488('0x70')](_0x8488('0xe3')),'voicePause':_0x77fb19[_0x8488('0x9b')]||![],'mailPause':_0x77fb19[_0x8488('0x9b')]||![],'chatPause':_0x77fb19[_0x8488('0x9b')]||![],'faxPause':_0x77fb19[_0x8488('0x9b')]||![],'smsPause':_0x77fb19['loginInPause']||![],'openchannelPause':_0x77fb19[_0x8488('0x9b')]||![],'pauseType':_0x77fb19[_0x8488('0x9b')]?_0x8488('0xe7'):null,'interface':_0x1dc353,'lastPauseAt':moment()[_0x8488('0x70')]('YYYY-MM-DD\x20HH:mm:ss')});}})[_0x8488('0x1f')](function(_0x2e663c){if(_0x166955['isMiddleware']){return _0x228510();}else{return BPromise['resolve'](_0x2e663c)[_0x8488('0x1f')](respondWithResult(_0x20882a,null));}})['catch'](handleError(_0x20882a,null));};exports[_0x8488('0xe8')]=function(_0x32926b,_0x376097,_0x505612){var _0x583698;return db['User']['find']({'where':{'id':_0x32926b[_0x8488('0x62')]['id'],'role':_0x8488('0x38')},'attributes':['id',_0x8488('0x43'),'role']})[_0x8488('0x1f')](handleEntityNotFound(_0x376097,null))[_0x8488('0x1f')](function(_0x55a2cb){if(_0x55a2cb){_0x583698=_0x55a2cb;return db[_0x8488('0xad')][_0x8488('0x34')]({'where':{'membername':_0x583698[_0x8488('0x43')]},'individualHooks':!![]});}})['then'](function(){return db[_0x8488('0xe1')]['findAll']({'where':{'membername':_0x583698[_0x8488('0x43')],'exitAt':null}});})['then'](function(_0x3c7f94){var _0x4067dc=[];_0x3c7f94['forEach'](function(_0x2b6cd5){_0x4067dc['push'](_0x2b6cd5['update']({'exitAt':moment()['format'](_0x8488('0xe3'))}));});return BPromise[_0x8488('0xe4')](_0x4067dc);})[_0x8488('0x1f')](function(){return _0x583698[_0x8488('0x33')]({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'interface':null});})[_0x8488('0x1f')](respondWithResult(_0x376097,null))[_0x8488('0x28')](handleError(_0x376097,null));};exports[_0x8488('0xe9')]=function(_0x491782,_0xc22e78,_0x34f85f){var _0x3e1abc;return db[_0x8488('0xad')][_0x8488('0x33')]({'paused':0x1},{'where':{'UserId':_0x491782['params']['id']},'individualHooks':!![]})[_0x8488('0x1f')](function(){return db['User']['find']({'where':{'id':_0x491782[_0x8488('0x62')]['id'],'role':_0x8488('0x38')},'attributes':['id','name',_0x8488('0x3f'),'internal','interface']});})[_0x8488('0x1f')](handleEntityNotFound(_0xc22e78,null))[_0x8488('0x1f')](function(_0x42a350){if(_0x42a350){_0x3e1abc=_0x42a350;return respondWithRpcPromise(_0x8488('0xea'),'pause',{'id':_0x3e1abc['id'],'name':_0x3e1abc[_0x8488('0x43')],'pause':!![]});}})[_0x8488('0x1f')](function(){if(_0x3e1abc){return db[_0x8488('0xe1')][_0x8488('0xaa')]({'where':{'membername':_0x3e1abc[_0x8488('0x43')],'type':_0x8488('0xeb'),'exitAt':null}});}})[_0x8488('0x1f')](function(_0x55a289){if(_0x55a289['length']){var _0x3e2a82=moment()[_0x8488('0x70')](_0x8488('0xe3'));for(var _0x3d5665=0x0,_0x2d7c69=_0x55a289['length'];_0x3d5665<_0x2d7c69;_0x3d5665++){_0x55a289[_0x3d5665][_0x8488('0xec')]({'exitAt':_0x3e2a82});}}})[_0x8488('0x1f')](function(){var _0x2f64bb=[];var _0x10115f=utils[_0x8488('0xe5')]();_0x10115f['forEach'](function(_0x520aa7){_0x2f64bb[_0x8488('0xab')]({'channel':_0x520aa7,'membername':_0x3e1abc[_0x8488('0x43')],'interface':_[_0x8488('0x6e')](_0x3e1abc[_0x8488('0x9d')])?util[_0x8488('0x70')]('SIP/%s',_0x3e1abc[_0x8488('0x43')]):_0x3e1abc['interface'],'type':_0x8488('0xeb'),'enterAt':moment()[_0x8488('0x70')](_0x8488('0xe3')),'data1':_0x491782[_0x8488('0x64')][_0x8488('0x47')]||_0x8488('0xed'),'role':_0x3e1abc['role'],'internal':_0x3e1abc['internal']});});return db[_0x8488('0xe1')][_0x8488('0x63')](_0x2f64bb,{'individualHooks':!![]});})['then'](function(){return _0x3e1abc[_0x8488('0x33')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'pauseType':_0x491782['body'][_0x8488('0x47')]||_0x8488('0xed'),'lastPauseAt':moment()['format'](_0x8488('0xe3'))});})['then'](respondWithResult(_0xc22e78,null))['catch'](handleError(_0xc22e78,null));};exports[_0x8488('0xee')]=function(_0x32f13f,_0x247b0c,_0x157cbc){var _0x1b83a2;return db[_0x8488('0x5f')]['find']({'where':{'id':_0x32f13f['params']['id']},'attributes':['id',_0x8488('0x43'),_0x8488('0x3f'),_0x8488('0x9c'),_0x8488('0xef'),'chatPause',_0x8488('0xf0'),_0x8488('0xf1'),_0x8488('0xf2'),_0x8488('0xf3'),'lastPauseAt']})[_0x8488('0x1f')](handleEntityNotFound(_0x247b0c,null))[_0x8488('0x1f')](function(_0x135934){if(_0x135934){_0x1b83a2=_0x135934;if(_0x32f13f['body'][_0x8488('0x99')]&&!utils[_0x8488('0x9e')](_0x32f13f[_0x8488('0x64')][_0x8488('0x99')])){throw new db[(_0x8488('0x1c'))][(_0x8488('0x93'))](_0x8488('0x9f'));}switch(_0x32f13f[_0x8488('0x64')]['channel']){case'voice':return respondWithRpcPromise(_0x8488('0xea'),_0x8488('0xee'),{'id':_0x1b83a2['id'],'name':_0x1b83a2['name'],'pause':![]})['then'](function(){return db[_0x8488('0xad')]['update']({'paused':0x0},{'where':{'UserId':_0x1b83a2['id']},'individualHooks':!![]});})[_0x8488('0x1f')](function(){return db['MemberReport'][_0x8488('0x40')]({'where':{'channel':_0x32f13f[_0x8488('0x64')][_0x8488('0x99')],'membername':_0x1b83a2[_0x8488('0x43')],'type':_0x8488('0xeb'),'exitAt':null}});})[_0x8488('0x1f')](function(_0x16d246){if(_0x16d246){return _0x16d246[_0x8488('0x33')]({'exitAt':moment()[_0x8488('0x70')](_0x8488('0xe3')),'data2':_0x8488('0xf4')},{'individualHooks':!![]});}return null;})[_0x8488('0x1f')](function(){return _0x1b83a2[_0x8488('0x33')]({'voicePause':![]});});case _0x8488('0xf5'):case'chat':case _0x8488('0xf6'):case _0x8488('0xf7'):case _0x8488('0xf8'):return db[_0x8488('0xe1')]['find']({'where':{'channel':_0x32f13f[_0x8488('0x64')][_0x8488('0x99')],'membername':_0x1b83a2[_0x8488('0x43')],'type':_0x8488('0xeb'),'exitAt':null}})[_0x8488('0x1f')](function(_0xb8cfd1){if(_0xb8cfd1){return _0xb8cfd1['update']({'exitAt':moment()[_0x8488('0x70')](_0x8488('0xe3')),'data2':_0x8488('0xf4')},{'individualHooks':!![]});}return null;})[_0x8488('0x1f')](function(){var _0x1942a5={};_[_0x8488('0x2f')](_0x1942a5,util[_0x8488('0x70')](_0x8488('0xf9'),_0x32f13f['body'][_0x8488('0x99')],'Pause'),![]);return _0x1b83a2['update'](_0x1942a5);});default:return respondWithRpcPromise(_0x8488('0xea'),_0x8488('0xee'),{'id':_0x1b83a2['id'],'name':_0x1b83a2[_0x8488('0x43')],'pause':![]})['then'](function(){return db[_0x8488('0xad')][_0x8488('0x33')]({'paused':0x0},{'where':{'UserId':_0x1b83a2['id']}});})[_0x8488('0x1f')](function(){return db['MemberReport'][_0x8488('0xaa')]({'where':{'membername':_0x1b83a2[_0x8488('0x43')],'type':'PAUSE','exitAt':null}});})['then'](function(_0x755e6c){var _0x3844f8=[];_0x755e6c['forEach'](function(_0x34bf35){_0x3844f8[_0x8488('0xab')](_0x34bf35[_0x8488('0x33')]({'exitAt':moment()[_0x8488('0x70')](_0x8488('0xe3')),'data2':_0x8488('0xf4')}));});return BPromise[_0x8488('0xe4')](_0x3844f8);})[_0x8488('0x1f')](function(){return _0x1b83a2['update']({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});});}}})[_0x8488('0x1f')](respondWithResult(_0x247b0c,null))[_0x8488('0x28')](handleError(_0x247b0c,null));};exports[_0x8488('0xfa')]=function(_0x5878b0,_0x2f7c7a,_0x4c1a60){var _0x4a300e={};var _0x13c099={};var _0x10db8c;var _0x4ecf37;return db[_0x8488('0x5f')]['findOne']({'where':{'id':_0x5878b0['params']['id']}})['then'](handleEntityNotFound(_0x2f7c7a,null))[_0x8488('0x1f')](function(_0x3a9056){if(_0x3a9056){_0x10db8c=_0x3a9056;_0x13c099[_0x8488('0x49')]=_['keys'](db[_0x8488('0xfb')][_0x8488('0x46')]);_0x13c099[_0x8488('0x4c')]=_[_0x8488('0x4d')](_0x5878b0[_0x8488('0x4c')]);_0x13c099[_0x8488('0x4e')]=_[_0x8488('0x4f')](_0x13c099[_0x8488('0x49')],_0x13c099[_0x8488('0x4c')]);_0x4a300e[_0x8488('0x50')]=_[_0x8488('0x4f')](_0x13c099[_0x8488('0x49')],qs[_0x8488('0x51')](_0x5878b0[_0x8488('0x4c')][_0x8488('0x51')]));_0x4a300e[_0x8488('0x50')]=_0x4a300e[_0x8488('0x50')][_0x8488('0x52')]?_0x4a300e[_0x8488('0x50')]:_0x13c099[_0x8488('0x49')];_0x4a300e['order']=qs['sort'](_0x5878b0[_0x8488('0x4c')][_0x8488('0x57')]);_0x4a300e[_0x8488('0x58')]=qs[_0x8488('0x4e')](_[_0x8488('0x59')](_0x5878b0[_0x8488('0x4c')],_0x13c099[_0x8488('0x4e')]));if(_0x5878b0[_0x8488('0x4c')][_0x8488('0x3a')]){_0x4a300e[_0x8488('0x58')]=_['merge'](_0x4a300e[_0x8488('0x58')],{'$or':_['map'](_0x4a300e[_0x8488('0x50')],function(_0x526b32){var _0x1c7225={};_0x1c7225[_0x526b32]={'$like':'%'+_0x5878b0[_0x8488('0x4c')]['filter']+'%'};return _0x1c7225;})});}_0x4a300e=_['merge']({},_0x4a300e,_0x5878b0[_0x8488('0x5e')]);return _0x10db8c[_0x8488('0xfa')](_0x4a300e);}})[_0x8488('0x1f')](function(_0x131e06){if(_0x131e06){_0x4ecf37=_0x131e06['length'];if(!_0x5878b0['query'][_0x8488('0x53')](_0x8488('0x54'))){_0x4a300e[_0x8488('0x55')]=qs[_0x8488('0x55')](_0x5878b0['query'][_0x8488('0x55')]);_0x4a300e[_0x8488('0x2e')]=qs[_0x8488('0x2e')](_0x5878b0[_0x8488('0x4c')][_0x8488('0x2e')]);}return _0x10db8c[_0x8488('0xfa')](_0x4a300e);}})[_0x8488('0x1f')](function(_0x22666b){if(_0x22666b){return _0x22666b?{'count':_0x4ecf37,'rows':_0x22666b}:null;}})[_0x8488('0x1f')](respondWithResult(_0x2f7c7a,null))['catch'](handleError(_0x2f7c7a,null));};exports[_0x8488('0xfc')]=function(_0x13ec8d,_0x5b5965){return db[_0x8488('0x5f')][_0x8488('0x40')]({'where':{'id':_0x13ec8d[_0x8488('0x62')]['id']}})[_0x8488('0x1f')](handleEntityNotFound(_0x5b5965,null))['then'](function(_0x21a704){if(_0x21a704){var _0x16e45a=_0x21a704[_0x8488('0x35')]({'plain':!![]});return _0x21a704['addTeams'](_0x13ec8d[_0x8488('0x64')]['ids'],_['omit'](_0x13ec8d[_0x8488('0x64')],['ids','id'])||{})[_0x8488('0x1f')](function(){for(var _0x1a2141=0x0;_0x1a2141<_0x13ec8d[_0x8488('0x64')][_0x8488('0x66')]['length'];_0x1a2141++){var _0x265322=[];db[_0x8488('0xfb')][_0x8488('0xbb')]({'where':{'id':_0x13ec8d[_0x8488('0x64')][_0x8488('0x66')][_0x1a2141]}})[_0x8488('0x1f')](function(_0x482af7){_0x265322[_0x8488('0xab')](_0x482af7[_0x8488('0xdf')]()[_0x8488('0x1f')](function(_0x110ad4){for(var _0x125b56=0x0;_0x125b56<_0x110ad4['length'];_0x125b56++){_0x110ad4[_0x125b56]['setDataValue']('channel',_0x8488('0xfd'));}return _0x110ad4;}));_0x265322[_0x8488('0xab')](_0x482af7[_0x8488('0xfe')]()[_0x8488('0x1f')](function(_0x338b92){for(var _0x1933c9=0x0;_0x1933c9<_0x338b92[_0x8488('0x52')];_0x1933c9++){_0x338b92[_0x1933c9]['setDataValue']('channel',_0x8488('0xff'));}return _0x338b92;}));_0x265322[_0x8488('0xab')](_0x482af7[_0x8488('0x100')]()[_0x8488('0x1f')](function(_0x3759b7){for(var _0x2fd246=0x0;_0x2fd246<_0x3759b7[_0x8488('0x52')];_0x2fd246++){_0x3759b7[_0x2fd246][_0x8488('0x101')](_0x8488('0x99'),'Mail');}return _0x3759b7;}));_0x265322[_0x8488('0xab')](_0x482af7['getSmsQueues']()[_0x8488('0x1f')](function(_0x1e0fe4){for(var _0x38c232=0x0;_0x38c232<_0x1e0fe4[_0x8488('0x52')];_0x38c232++){_0x1e0fe4[_0x38c232][_0x8488('0x101')]('channel',_0x8488('0x102'));}return _0x1e0fe4;}));_0x265322['push'](_0x482af7[_0x8488('0x103')]()[_0x8488('0x1f')](function(_0x4ebddf){for(var _0x54ab5b=0x0;_0x54ab5b<_0x4ebddf['length'];_0x54ab5b++){_0x4ebddf[_0x54ab5b]['setDataValue'](_0x8488('0x99'),_0x8488('0x104'));}return _0x4ebddf;}));_0x265322['push'](_0x482af7[_0x8488('0x105')]()['then'](function(_0x403591){for(var _0xbcf529=0x0;_0xbcf529<_0x403591[_0x8488('0x52')];_0xbcf529++){_0x403591[_0xbcf529][_0x8488('0x101')]('channel',_0x8488('0x106'));}return _0x403591;}));return BPromise[_0x8488('0xe4')](_0x265322);})['then'](function(_0x10e940){var _0x493826=_[_0x8488('0x107')](_0x10e940);_0x265322=[];return db[_0x8488('0x5b')][_0x8488('0x108')](function(_0x3e2ed3){for(var _0x13ebdd=0x0;_0x13ebdd<_0x493826['length'];_0x13ebdd++){_0x265322[_0x8488('0xab')](_0x493826[_0x13ebdd]['addAgent'](_0x16e45a['id']),{'transaction':_0x3e2ed3});}return BPromise['all'](_0x265322)[_0x8488('0x1f')](function(){if(_0x16e45a[_0x8488('0x9a')]){return BPromise['each'](_[_0x8488('0x3a')](_0x493826,function(_0xd194de){return _0xd194de[_0x8488('0x109')](_0x8488('0x99'))===_0x8488('0xfd');}),function(_0xb2b7bb){return db[_0x8488('0xad')][_0x8488('0xae')]({'membername':_0x16e45a['name'],'UserId':_0x16e45a['id'],'queue_name':_0xb2b7bb[_0x8488('0x43')],'VoiceQueueId':_0xb2b7bb['id'],'interface':_[_0x8488('0x6e')](_0x16e45a[_0x8488('0x9d')])?util[_0x8488('0x70')](_0x8488('0xd8'),_0x16e45a[_0x8488('0x43')]):_0x16e45a[_0x8488('0x9d')],'paused':_0x16e45a[_0x8488('0x9c')]||![],'penalty':_0x16e45a[_0x8488('0xa3')]},{'transaction':_0x3e2ed3});});}else{return;}})[_0x8488('0x1f')](function(){for(var _0x3f90c3=0x0;_0x3f90c3<_0x493826[_0x8488('0x52')];_0x3f90c3++){var _0xebc2f7=_0x493826[_0x3f90c3][_0x8488('0x109')](_0x8488('0x99'));var _0x46ab30=_0xebc2f7+'QueueId';socket[_0x8488('0xa6')]('user'+_0xebc2f7+_0x8488('0xa7'),{'UserId':_0x16e45a['id'],['queueField']:_0x493826[_0x3f90c3]['id']});}});});});}});}})[_0x8488('0x1f')](respondWithStatusCode(_0x5b5965,null))[_0x8488('0x28')](handleError(_0x5b5965,null));};exports[_0x8488('0x10a')]=function(_0x5774f8,_0x1bed88){return db[_0x8488('0x5f')][_0x8488('0xbb')]({'where':{'id':_0x5774f8[_0x8488('0x62')]['id']}})[_0x8488('0x1f')](handleEntityNotFound(_0x1bed88,null))[_0x8488('0x1f')](function(_0x3b222b){if(_0x3b222b){var _0xde6d3=_0x3b222b[_0x8488('0x35')]({'plain':!![]});var _0xed6dd0=_0x5774f8[_0x8488('0x4c')][_0x8488('0x66')];return _0x3b222b[_0x8488('0x10a')](_0xed6dd0)[_0x8488('0x1f')](function(){for(var _0x211c13=0x0;_0x211c13<_0xed6dd0[_0x8488('0x52')];_0x211c13++){var _0x3decbf=[];db[_0x8488('0xfb')][_0x8488('0xbb')]({'where':{'id':_0xed6dd0[_0x211c13]}})['then'](function(_0xa10c62){_0x3decbf[_0x8488('0xab')](_0xa10c62[_0x8488('0xdf')]()[_0x8488('0x1f')](function(_0x29086f){for(var _0x584b8b=0x0;_0x584b8b<_0x29086f[_0x8488('0x52')];_0x584b8b++){_0x29086f[_0x584b8b][_0x8488('0x101')](_0x8488('0x99'),_0x8488('0xfd'));}return _0x29086f;}));_0x3decbf[_0x8488('0xab')](_0xa10c62[_0x8488('0xfe')]()['then'](function(_0x4730fd){for(var _0x1f7a26=0x0;_0x1f7a26<_0x4730fd[_0x8488('0x52')];_0x1f7a26++){_0x4730fd[_0x1f7a26]['setDataValue'](_0x8488('0x99'),_0x8488('0xff'));}return _0x4730fd;}));_0x3decbf[_0x8488('0xab')](_0xa10c62[_0x8488('0x100')]()[_0x8488('0x1f')](function(_0x341021){for(var _0x399a00=0x0;_0x399a00<_0x341021['length'];_0x399a00++){_0x341021[_0x399a00][_0x8488('0x101')]('channel',_0x8488('0x10b'));}return _0x341021;}));_0x3decbf['push'](_0xa10c62['getSmsQueues']()[_0x8488('0x1f')](function(_0x8ac8c3){for(var _0x4d45c5=0x0;_0x4d45c5<_0x8ac8c3[_0x8488('0x52')];_0x4d45c5++){_0x8ac8c3[_0x4d45c5]['setDataValue'](_0x8488('0x99'),_0x8488('0x102'));}return _0x8ac8c3;}));_0x3decbf[_0x8488('0xab')](_0xa10c62[_0x8488('0x103')]()[_0x8488('0x1f')](function(_0x26bd79){for(var _0x1cbcda=0x0;_0x1cbcda<_0x26bd79['length'];_0x1cbcda++){_0x26bd79[_0x1cbcda][_0x8488('0x101')](_0x8488('0x99'),'Fax');}return _0x26bd79;}));_0x3decbf['push'](_0xa10c62[_0x8488('0x105')]()[_0x8488('0x1f')](function(_0x36592c){for(var _0x240f7e=0x0;_0x240f7e<_0x36592c[_0x8488('0x52')];_0x240f7e++){_0x36592c[_0x240f7e][_0x8488('0x101')](_0x8488('0x99'),'Openchannel');}return _0x36592c;}));return BPromise[_0x8488('0xe4')](_0x3decbf);})['then'](function(_0x325d42){var _0x3e4332=_[_0x8488('0x107')](_0x325d42);_0x3decbf=[];return db[_0x8488('0x5b')][_0x8488('0x108')](function(_0x32b74b){for(var _0x300bc0=0x0;_0x300bc0<_0x3e4332[_0x8488('0x52')];_0x300bc0++){_0x3decbf[_0x8488('0xab')](_0x3e4332[_0x300bc0][_0x8488('0x10c')](_0xde6d3['id']),{'transaction':_0x32b74b});}return BPromise[_0x8488('0xe4')](_0x3decbf)[_0x8488('0x1f')](function(){if(_0xde6d3[_0x8488('0x9a')]){return BPromise[_0x8488('0xac')](_[_0x8488('0x3a')](_0x3e4332,function(_0x779619){return _0x779619[_0x8488('0x109')](_0x8488('0x99'))===_0x8488('0xfd');}),function(_0x57ac81){return db[_0x8488('0xad')][_0x8488('0x34')]({'where':{'VoiceQueueId':_0x57ac81['id'],'UserId':_0xde6d3['id']},'transaction':_0x32b74b});});}else{return;}})[_0x8488('0x1f')](function(){for(var _0xf1683f=0x0;_0xf1683f<_0x3e4332[_0x8488('0x52')];_0xf1683f++){var _0x5837d7=_0x3e4332[_0xf1683f][_0x8488('0x109')](_0x8488('0x99'));var _0x18f4a1=_0x5837d7+_0x8488('0xb1');socket['emit'](_0x8488('0x6a')+_0x5837d7+_0x8488('0xb2'),{'UserId':_0xde6d3['id'],['queueField']:_0x3e4332[_0xf1683f]['id']});}});});});}});}})[_0x8488('0x1f')](respondWithStatusCode(_0x1bed88,null))[_0x8488('0x28')](handleError(_0x1bed88,null));};exports[_0x8488('0x10d')]=function(_0x3e2471,_0x9edbb7,_0xca4b35){var _0x55545f={};var _0x7a2c63={};var _0x27aa63;var _0x4aa843;return db[_0x8488('0x5f')][_0x8488('0xbb')]({'where':{'id':_0x3e2471['params']['id']}})['then'](handleEntityNotFound(_0x9edbb7,null))['then'](function(_0x46b26f){if(_0x46b26f){_0x27aa63=_0x46b26f;_0x7a2c63['model']=_[_0x8488('0x4d')](db[_0x8488('0xbf')][_0x8488('0x46')]);_0x7a2c63[_0x8488('0x4c')]=_[_0x8488('0x4d')](_0x3e2471[_0x8488('0x4c')]);_0x7a2c63[_0x8488('0x4e')]=_[_0x8488('0x4f')](_0x7a2c63[_0x8488('0x49')],_0x7a2c63[_0x8488('0x4c')]);_0x55545f[_0x8488('0x50')]=_['intersection'](_0x7a2c63[_0x8488('0x49')],qs['fields'](_0x3e2471['query'][_0x8488('0x51')]));_0x55545f[_0x8488('0x50')]=_0x55545f['attributes'][_0x8488('0x52')]?_0x55545f[_0x8488('0x50')]:_0x7a2c63[_0x8488('0x49')];_0x55545f[_0x8488('0x56')]=qs[_0x8488('0x57')](_0x3e2471[_0x8488('0x4c')][_0x8488('0x57')]);_0x55545f[_0x8488('0x58')]=qs[_0x8488('0x4e')](_[_0x8488('0x59')](_0x3e2471[_0x8488('0x4c')],_0x7a2c63[_0x8488('0x4e')]));if(_0x3e2471[_0x8488('0x4c')][_0x8488('0x3a')]){_0x55545f[_0x8488('0x58')]=_[_0x8488('0x5d')](_0x55545f[_0x8488('0x58')],{'$or':_[_0x8488('0x3c')](_0x55545f['attributes'],function(_0x475080){var _0x369901={};_0x369901[_0x475080]={'$like':'%'+_0x3e2471[_0x8488('0x4c')][_0x8488('0x3a')]+'%'};return _0x369901;})});}_0x55545f=_[_0x8488('0x5d')]({},_0x55545f,_0x3e2471[_0x8488('0x5e')]);return _0x27aa63[_0x8488('0x10d')](_0x55545f);}})[_0x8488('0x1f')](function(_0x2522c0){if(_0x2522c0){_0x4aa843=_0x2522c0[_0x8488('0x52')];if(!_0x3e2471['query'][_0x8488('0x53')](_0x8488('0x54'))){_0x55545f[_0x8488('0x55')]=qs[_0x8488('0x55')](_0x3e2471['query'][_0x8488('0x55')]);_0x55545f[_0x8488('0x2e')]=qs[_0x8488('0x2e')](_0x3e2471[_0x8488('0x4c')][_0x8488('0x2e')]);}return _0x27aa63[_0x8488('0x10d')](_0x55545f);}})[_0x8488('0x1f')](function(_0x22f613){if(_0x22f613){return _0x22f613?{'count':_0x4aa843,'rows':_0x22f613}:null;}})[_0x8488('0x1f')](respondWithResult(_0x9edbb7,null))[_0x8488('0x28')](handleError(_0x9edbb7,null));};exports[_0x8488('0x10e')]=function(_0x2ddfff,_0x37ed31,_0x1cc4f9){var _0x4e0bbb={};var _0x572f4d={};var _0x36245b;var _0xaa5f68;return db[_0x8488('0x5f')][_0x8488('0xbb')]({'where':{'id':_0x2ddfff[_0x8488('0x62')]['id']}})['then'](handleEntityNotFound(_0x37ed31,null))[_0x8488('0x1f')](function(_0x330cdb){if(_0x330cdb){_0x36245b=_0x330cdb;_0x572f4d[_0x8488('0x49')]=_['keys'](db[_0x8488('0x5f')][_0x8488('0x46')]);_0x572f4d[_0x8488('0x4c')]=_['keys'](_0x2ddfff[_0x8488('0x4c')]);_0x572f4d[_0x8488('0x4e')]=_[_0x8488('0x4f')](_0x572f4d[_0x8488('0x49')],_0x572f4d[_0x8488('0x4c')]);_0x4e0bbb[_0x8488('0x50')]=_[_0x8488('0x4f')](_0x572f4d[_0x8488('0x49')],qs[_0x8488('0x51')](_0x2ddfff[_0x8488('0x4c')][_0x8488('0x51')]));_0x4e0bbb[_0x8488('0x50')]=_0x4e0bbb[_0x8488('0x50')]['length']?_0x4e0bbb[_0x8488('0x50')]:_0x572f4d[_0x8488('0x49')];_0x4e0bbb[_0x8488('0x56')]=qs[_0x8488('0x57')](_0x2ddfff['query'][_0x8488('0x57')]);_0x4e0bbb[_0x8488('0x58')]=qs[_0x8488('0x4e')](_[_0x8488('0x59')](_0x2ddfff['query'],_0x572f4d[_0x8488('0x4e')]));if(_0x2ddfff[_0x8488('0x4c')][_0x8488('0x3a')]){_0x4e0bbb['where']=_[_0x8488('0x5d')](_0x4e0bbb[_0x8488('0x58')],{'$or':_[_0x8488('0x3c')](_0x4e0bbb['attributes'],function(_0x3908ce){var _0xb43f5d={};_0xb43f5d[_0x3908ce]={'$like':'%'+_0x2ddfff[_0x8488('0x4c')][_0x8488('0x3a')]+'%'};return _0xb43f5d;})});}_0x4e0bbb[_0x8488('0x49')]=db['User'];_0x4e0bbb['as']='Agents';_0x4e0bbb=_[_0x8488('0x5d')]({},_0x4e0bbb,_0x2ddfff[_0x8488('0x5e')]);return _0x36245b[_0x8488('0xdf')]({'include':[_0x4e0bbb]});}})[_0x8488('0x1f')](function(_0x72b19c){if(_0x72b19c){var _0x322171={},_0x13b5f8=[],_0x5761f7=0x0;for(var _0xbb415e=0x0;_0xbb415e<_0x72b19c['length'];_0xbb415e+=0x1){for(var _0x4d1bc8=0x0,_0x1772e6;_0x4d1bc8<_0x72b19c[_0xbb415e]['Agents']['length'];_0x4d1bc8+=0x1){_0x1772e6=_0x72b19c[_0xbb415e][_0x8488('0x37')][_0x4d1bc8][_0x8488('0x35')]({'plain':!![]});_0x322171[_0x1772e6['id']]=_0x1772e6;}}_0x322171=_['values'](_0x322171);for(var _0x4b6108=qs[_0x8488('0x2e')](_0x2ddfff[_0x8488('0x4c')][_0x8488('0x2e')]);_0x4b6108<_0x322171[_0x8488('0x52')]&&_0x13b5f8[_0x8488('0x52')]=_0x3dbce3['agents']){throw new Error('Maximum\x20login\x20has\x20been\x20reached');}})[_0x0629('0xc')](function(){if(_0x381b90){return db['UserVoiceQueueRt'][_0x0629('0x4d')]({'where':{'membername':_0x381b90[_0x0629('0x23')]},'individualHooks':!![]});}})[_0x0629('0xc')](function(){if(_0x381b90){return _0x381b90[_0x0629('0x4e')]({'raw':!![]});}})[_0x0629('0xc')](function(_0x3ec59d){if(_0x381b90){if(_0x3ec59d){var _0x3d2425=[];_0x3934e5=_0x3ec59d;if(_0x3934e5[_0x0629('0x2a')]){for(var _0x2c8f33=0x0;_0x2c8f33<_0x3934e5[_0x0629('0x2a')];_0x2c8f33++){_0x3d2425[_0x0629('0x2f')](db['UserVoiceQueueRt'][_0x0629('0x4f')]({'membername':_0x381b90[_0x0629('0x23')],'UserId':_0x381b90['id'],'queue_name':_0x3934e5[_0x2c8f33][_0x0629('0x23')],'VoiceQueueId':_0x3934e5[_0x2c8f33]['id'],'interface':_0x2c0ee3,'paused':_0x381b90[_0x0629('0x47')]||![],'penalty':_0x3934e5[_0x2c8f33][_0x0629('0x50')]||0x0}));}return BPromise[_0x0629('0x41')](_0x3d2425);}}}})[_0x0629('0xc')](function(){if(_0x381b90){return db[_0x0629('0x28')][_0x0629('0x18')]({'where':{'membername':_0x381b90[_0x0629('0x23')],'exitAt':null}});}})[_0x0629('0xc')](function(_0x1dc845){if(_0x381b90){if(_0x1dc845&&_0x1dc845[_0x0629('0x2a')]){var _0x500a61=[];_0x1dc845[_0x0629('0x2e')](function(_0x4c4375){_0x500a61[_0x0629('0x2f')](_0x4c4375[_0x0629('0x27')]({'exitAt':moment()[_0x0629('0x2b')](_0x0629('0x2c'))}));});return BPromise[_0x0629('0x41')](_0x500a61);}}})[_0x0629('0xc')](function(_0x5ee97f){if(_0x381b90){var _0x181414=[];var _0x35a3a4=[];var _0x1e8060=utils[_0x0629('0x2d')]();var _0xab006c={'membername':_0x381b90[_0x0629('0x23')],'interface':_0x2c0ee3,'enterAt':moment()[_0x0629('0x2b')](_0x0629('0x2c')),'role':_0x381b90[_0x0629('0x24')],'internal':_0x381b90[_0x0629('0x33')]};_0x1e8060['forEach'](function(_0x2a810b){_0x181414[_0x0629('0x2f')](_[_0x0629('0x51')]({'channel':_0x2a810b,'type':_0x0629('0x52'),'data1':_0x0629('0x53'),'data2':_0x2c0ee3},_0xab006c));if(_0x381b90[_0x0629('0x47')]){_0x35a3a4[_0x0629('0x2f')](_[_0x0629('0x51')]({'channel':_0x2a810b,'type':_0x0629('0x29'),'data1':_0x0629('0x54')},_0xab006c));}});return db['MemberReport']['bulkCreate'](_0x181414['concat'](_0x35a3a4),{'individualHooks':!![]});}})[_0x0629('0xc')](function(){if(_0x381b90){return _0x381b90[_0x0629('0x27')]({'online':!![],'lastLoginAt':moment()[_0x0629('0x2b')](_0x0629('0x2c')),'voicePause':_0x381b90[_0x0629('0x47')]||![],'mailPause':_0x381b90[_0x0629('0x47')]||![],'chatPause':_0x381b90[_0x0629('0x47')]||![],'faxPause':_0x381b90['loginInPause']||![],'smsPause':_0x381b90['loginInPause']||![],'openchannelPause':_0x381b90[_0x0629('0x47')]||![],'pauseType':_0x381b90[_0x0629('0x47')]?_0x0629('0x54'):null,'lastPauseAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'interface':_0x2c0ee3});}})[_0x0629('0xc')](function(_0x5b40bd){_0x436b58(_0x5b40bd);})[_0x0629('0x15')](function(_0x3c24ce){_0x218516(_0x464f33[_0x0629('0x12')](0x1f4,_0x3c24ce[_0x0629('0x14')]));});});}; \ No newline at end of file +var _0xd7de=['then','stringify','ShowUser','User','find','catch','PauseUser','name','interface','UserVoiceQueueRt','update','MemberReport','PAUSE','length','format','YYYY-MM-DD\x20HH:mm:ss','getChannels','forEach','push','isNil','SIP/%s','body','type','DEFAULT\x20PAUSE','internal','uniqueid','UnpauseUser','findOne','channel','system','chat','fax','sms','openchannel','%s%s','Pause','destroy','all','role','mobile','phone','loginInPause','count','../../config/license/util','getLicense','agents','upsert','UserVoiceQueue.penalty','merge','LOGIN','callysquare','LOGININPAUSE','bulkCreate','concat','util','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','client','http','redis','defaults','./user.socket','request','User,\x20%s,\x20%s','request\x20sent','debug','User,\x20%s,\x20%s,\x20%s','error','code','message','info','GetUser','findAll','options','raw','where','limit','map','include','model','attributes'];(function(_0x1c369c,_0x1ec98b){var _0x5e8e0a=function(_0x55353a){while(--_0x55353a){_0x1c369c['push'](_0x1c369c['shift']());}};_0x5e8e0a(++_0x1ec98b);}(_0xd7de,0xe0));var _0xed7d=function(_0x13c261,_0x4b634d){_0x13c261=_0x13c261-0x0;var _0x1ac50a=_0xd7de[_0x13c261];return _0x1ac50a;};'use strict';var _=require('lodash');var util=require(_0xed7d('0x0'));var moment=require(_0xed7d('0x1'));var BPromise=require(_0xed7d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xed7d('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xed7d('0x4'));var logger=require('../../config/logger')(_0xed7d('0x5'));var config=require(_0xed7d('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xed7d('0x7')][_0xed7d('0x8')]({'port':0x232a});config[_0xed7d('0x9')]=_[_0xed7d('0xa')](config[_0xed7d('0x9')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xed7d('0x9')]));require(_0xed7d('0xb'))['register'](socket);function respondWithRpcPromise(_0x200274,_0x4d7101,_0x3d8d6a){return new BPromise(function(_0x7cc944,_0x3c89f3){return client[_0xed7d('0xc')](_0x200274,_0x3d8d6a)['then'](function(_0x6d655b){logger['info'](_0xed7d('0xd'),_0x4d7101,_0xed7d('0xe'));logger[_0xed7d('0xf')](_0xed7d('0x10'),_0x4d7101,_0xed7d('0xe'),JSON['stringify'](_0x6d655b));if(_0x6d655b[_0xed7d('0x11')]){if(_0x6d655b['error'][_0xed7d('0x12')]===0x1f4){logger[_0xed7d('0x11')](_0xed7d('0xd'),_0x4d7101,_0x6d655b[_0xed7d('0x11')][_0xed7d('0x13')]);return _0x3c89f3(_0x6d655b[_0xed7d('0x11')][_0xed7d('0x13')]);}logger[_0xed7d('0x11')](_0xed7d('0xd'),_0x4d7101,_0x6d655b['error'][_0xed7d('0x13')]);return _0x7cc944(_0x6d655b[_0xed7d('0x11')][_0xed7d('0x13')]);}else{logger[_0xed7d('0x14')]('User,\x20%s,\x20%s',_0x4d7101,_0xed7d('0xe'));_0x7cc944(_0x6d655b['result']['message']);}})['catch'](function(_0x47eaa6){logger[_0xed7d('0x11')](_0xed7d('0xd'),_0x4d7101,_0x47eaa6);_0x3c89f3(_0x47eaa6);});});}exports[_0xed7d('0x15')]=function(_0x2f576d){var _0x224fd0=this;return new Promise(function(_0x56b5ee,_0x20ddf6){return db['User'][_0xed7d('0x16')]({'raw':_0x2f576d[_0xed7d('0x17')]?_0x2f576d[_0xed7d('0x17')][_0xed7d('0x18')]===undefined?!![]:![]:!![],'where':_0x2f576d[_0xed7d('0x17')]?_0x2f576d[_0xed7d('0x17')][_0xed7d('0x19')]||null:null,'attributes':_0x2f576d[_0xed7d('0x17')]?_0x2f576d['options']['attributes']||null:null,'limit':_0x2f576d[_0xed7d('0x17')]?_0x2f576d[_0xed7d('0x17')][_0xed7d('0x1a')]||null:null,'include':_0x2f576d[_0xed7d('0x17')]?_0x2f576d[_0xed7d('0x17')]['include']?_[_0xed7d('0x1b')](_0x2f576d[_0xed7d('0x17')][_0xed7d('0x1c')],function(_0x136606){return{'model':db[_0x136606[_0xed7d('0x1d')]],'as':_0x136606['as'],'attributes':_0x136606[_0xed7d('0x1e')],'include':_0x136606[_0xed7d('0x1c')]?_[_0xed7d('0x1b')](_0x136606[_0xed7d('0x1c')],function(_0x4d9359){return{'model':db[_0x4d9359['model']],'as':_0x4d9359['as'],'attributes':_0x4d9359[_0xed7d('0x1e')],'include':_0x4d9359['include']?_['map'](_0x4d9359[_0xed7d('0x1c')],function(_0x54bcc4){return{'model':db[_0x54bcc4[_0xed7d('0x1d')]],'as':_0x54bcc4['as'],'attributes':_0x54bcc4[_0xed7d('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xed7d('0x1f')](function(_0xdbaec5){logger[_0xed7d('0x14')](_0xed7d('0x15'),_0x2f576d);logger[_0xed7d('0xf')](_0xed7d('0x15'),_0x2f576d,JSON[_0xed7d('0x20')](_0xdbaec5));_0x56b5ee(_0xdbaec5);})['catch'](function(_0x514653){logger[_0xed7d('0x11')]('GetUser',_0x514653[_0xed7d('0x13')],_0x2f576d);_0x20ddf6(_0x224fd0[_0xed7d('0x11')](0x1f4,_0x514653['message']));});});};exports[_0xed7d('0x21')]=function(_0x26b0f5){var _0x531553=this;return new Promise(function(_0x32f29e,_0x222079){return db[_0xed7d('0x22')][_0xed7d('0x23')]({'raw':_0x26b0f5[_0xed7d('0x17')]?_0x26b0f5['options'][_0xed7d('0x18')]===undefined?!![]:![]:!![],'where':_0x26b0f5[_0xed7d('0x17')]?_0x26b0f5[_0xed7d('0x17')][_0xed7d('0x19')]||null:null,'attributes':_0x26b0f5['options']?_0x26b0f5[_0xed7d('0x17')]['attributes']||null:null,'include':_0x26b0f5[_0xed7d('0x17')]?_0x26b0f5['options']['include']?_[_0xed7d('0x1b')](_0x26b0f5[_0xed7d('0x17')][_0xed7d('0x1c')],function(_0x5bc445){return{'model':db[_0x5bc445[_0xed7d('0x1d')]],'as':_0x5bc445['as'],'attributes':_0x5bc445[_0xed7d('0x1e')],'include':_0x5bc445['include']?_['map'](_0x5bc445[_0xed7d('0x1c')],function(_0x52e9ea){return{'model':db[_0x52e9ea[_0xed7d('0x1d')]],'as':_0x52e9ea['as'],'attributes':_0x52e9ea[_0xed7d('0x1e')],'include':_0x52e9ea[_0xed7d('0x1c')]?_[_0xed7d('0x1b')](_0x52e9ea[_0xed7d('0x1c')],function(_0x3b5f09){return{'model':db[_0x3b5f09[_0xed7d('0x1d')]],'as':_0x3b5f09['as'],'attributes':_0x3b5f09['attributes']};}):[]};}):[]};}):[]:[]})[_0xed7d('0x1f')](function(_0x17c2fd){logger[_0xed7d('0x14')](_0xed7d('0x21'),_0x26b0f5);logger[_0xed7d('0xf')]('ShowUser',_0x26b0f5,JSON['stringify'](_0x17c2fd));_0x32f29e(_0x17c2fd);})[_0xed7d('0x24')](function(_0x1543fa){logger[_0xed7d('0x11')](_0xed7d('0x21'),_0x1543fa[_0xed7d('0x13')],_0x26b0f5);_0x222079(_0x531553['error'](0x1f4,_0x1543fa[_0xed7d('0x13')]));});});};exports[_0xed7d('0x25')]=function(_0x15f7fc){var _0xb6428f=this;return new Promise(function(_0x495978,_0x429205){var _0x4de635;return db['User']['find']({'where':_0x15f7fc['options'][_0xed7d('0x19')]||{},'attributes':['id',_0xed7d('0x26'),'role','internal',_0xed7d('0x27')]})[_0xed7d('0x1f')](function(_0x38ed30){if(_0x38ed30){_0x4de635=_0x38ed30;return db[_0xed7d('0x28')][_0xed7d('0x29')]({'paused':0x1},{'where':{'UserId':_0x4de635['id']},'individualHooks':!![]});}})[_0xed7d('0x1f')](function(){if(_0x4de635){return db[_0xed7d('0x2a')][_0xed7d('0x16')]({'where':{'membername':_0x4de635['name'],'type':_0xed7d('0x2b'),'exitAt':null}});}})['then'](function(_0x3adaea){if(_0x4de635){if(_0x3adaea&&_0x3adaea[_0xed7d('0x2c')]){var _0x3d1be4=moment()[_0xed7d('0x2d')](_0xed7d('0x2e'));for(var _0x20c754=0x0,_0x3d0e1e=_0x3adaea['length'];_0x20c754<_0x3d0e1e;_0x20c754++){_0x3adaea[_0x20c754]['updateAttributes']({'exitAt':_0x3d1be4});}}}})[_0xed7d('0x1f')](function(){if(_0x4de635){var _0x27a360=[];var _0xbf537c=utils[_0xed7d('0x2f')]();_0xbf537c[_0xed7d('0x30')](function(_0x144477){_0x27a360[_0xed7d('0x31')]({'channel':_0x144477,'membername':_0x4de635[_0xed7d('0x26')],'interface':_[_0xed7d('0x32')](_0x4de635[_0xed7d('0x27')])?util['format'](_0xed7d('0x33'),_0x4de635[_0xed7d('0x26')]):_0x4de635['interface'],'type':_0xed7d('0x2b'),'enterAt':moment()[_0xed7d('0x2d')](_0xed7d('0x2e')),'data1':_0x15f7fc[_0xed7d('0x34')][_0xed7d('0x35')]||_0xed7d('0x36'),'role':_0x4de635['role'],'internal':_0x4de635[_0xed7d('0x37')],'uniqueid':_0x15f7fc[_0xed7d('0x34')][_0xed7d('0x38')]||null});});return db['MemberReport']['bulkCreate'](_0x27a360,{'individualHooks':!![]});}})[_0xed7d('0x1f')](function(){if(_0x4de635){return _0x4de635[_0xed7d('0x29')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'pauseType':_0x15f7fc[_0xed7d('0x34')][_0xed7d('0x35')]||_0xed7d('0x36'),'lastPauseAt':moment()[_0xed7d('0x2d')](_0xed7d('0x2e'))});}})[_0xed7d('0x1f')](function(_0x3ab263){_0x495978(_0x3ab263);})[_0xed7d('0x24')](function(_0x58b6a4){_0x429205(_0xb6428f[_0xed7d('0x11')](0x1f4,_0x58b6a4[_0xed7d('0x13')]));});});};exports[_0xed7d('0x39')]=function(_0x32812b){var _0xbab305=this;return new Promise(function(_0x6531fb,_0x375745){var _0x16a3f3;return db[_0xed7d('0x22')][_0xed7d('0x3a')]({'where':_0x32812b[_0xed7d('0x17')][_0xed7d('0x19')]||{},'attributes':['id',_0xed7d('0x26')]})[_0xed7d('0x1f')](function(_0x5443b5){if(_0x5443b5){_0x16a3f3=_0x5443b5;if(_0x32812b['body'][_0xed7d('0x3b')]&&!utils['isValidChannel'](_0x32812b[_0xed7d('0x34')][_0xed7d('0x3b')])){throw new Error('Unknown\x20channel');}switch(_0x32812b[_0xed7d('0x34')][_0xed7d('0x3b')]){case'voice':return db['UserVoiceQueueRt']['update']({'paused':0x0},{'where':{'UserId':_0x16a3f3['id']}})['then'](function(){return db[_0xed7d('0x2a')][_0xed7d('0x23')]({'where':{'channel':_0x32812b[_0xed7d('0x34')][_0xed7d('0x3b')],'membername':_0x16a3f3[_0xed7d('0x26')],'type':_0xed7d('0x2b'),'exitAt':null}});})[_0xed7d('0x1f')](function(_0x1738f7){if(_0x1738f7){return _0x1738f7[_0xed7d('0x29')]({'exitAt':moment()[_0xed7d('0x2d')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0xed7d('0x3c')},{'individualHooks':!![]});}return null;})[_0xed7d('0x1f')](function(){return _0x16a3f3[_0xed7d('0x29')]({'voicePause':![]});});case'mail':case _0xed7d('0x3d'):case _0xed7d('0x3e'):case _0xed7d('0x3f'):case _0xed7d('0x40'):return db['MemberReport'][_0xed7d('0x23')]({'where':{'channel':_0x32812b[_0xed7d('0x34')]['channel'],'membername':_0x16a3f3[_0xed7d('0x26')],'type':_0xed7d('0x2b'),'exitAt':null}})[_0xed7d('0x1f')](function(_0x5622bc){return _0x5622bc[_0xed7d('0x29')]({'exitAt':moment()[_0xed7d('0x2d')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0xed7d('0x3c')},{'individualHooks':!![]});})[_0xed7d('0x1f')](function(){var _0x48e526={};_['set'](_0x48e526,util[_0xed7d('0x2d')](_0xed7d('0x41'),_0x32812b['body'][_0xed7d('0x3b')],_0xed7d('0x42')),![]);return _0x16a3f3[_0xed7d('0x29')](_0x48e526);});default:return db[_0xed7d('0x28')]['update']({'paused':0x0},{'where':{'UserId':_0x16a3f3['id']}})['then'](function(){return db[_0xed7d('0x2a')][_0xed7d('0x16')]({'where':{'membername':_0x16a3f3[_0xed7d('0x26')],'type':_0xed7d('0x2b'),'exitAt':null}});})['then'](function(_0x191c71){var _0x311521=[];_0x191c71[_0xed7d('0x30')](function(_0x394517){_0x311521[_0xed7d('0x31')](_0x394517[_0xed7d('0x29')]({'exitAt':moment()[_0xed7d('0x2d')](_0xed7d('0x2e')),'data2':_0xed7d('0x3c')}));});return BPromise['all'](_0x311521);})['then'](function(){return _0x16a3f3[_0xed7d('0x29')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});});}}})[_0xed7d('0x1f')](function(_0x175c26){_0x6531fb(_0x175c26);})[_0xed7d('0x24')](function(_0x52ffd8){_0x375745(_0xbab305['error'](0x1f4,_0x52ffd8['message']));});});};exports['LogoutUser']=function(_0x12fb9a){var _0x2082d7=this;return new Promise(function(_0x372a58,_0x1e9aef){var _0x167ed6;return db[_0xed7d('0x22')][_0xed7d('0x3a')]({'where':_0x12fb9a['options'][_0xed7d('0x19')]||{},'attributes':['id',_0xed7d('0x26')]})[_0xed7d('0x1f')](function(_0x32a952){if(_0x32a952){_0x167ed6=_0x32a952;return db['UserVoiceQueueRt'][_0xed7d('0x43')]({'where':{'membername':_0x167ed6[_0xed7d('0x26')]},'individualHooks':!![]});}})[_0xed7d('0x1f')](function(){if(_0x167ed6){return db['MemberReport'][_0xed7d('0x16')]({'where':{'membername':_0x167ed6[_0xed7d('0x26')],'exitAt':null}});}})[_0xed7d('0x1f')](function(_0x47ca16){if(_0x167ed6){if(_0x47ca16&&_0x47ca16[_0xed7d('0x2c')]){var _0x59b6ec=[];_0x47ca16[_0xed7d('0x30')](function(_0x5716c5){_0x59b6ec[_0xed7d('0x31')](_0x5716c5[_0xed7d('0x29')]({'exitAt':moment()[_0xed7d('0x2d')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0xed7d('0x44')](_0x59b6ec);}}})['then'](function(){if(_0x167ed6){return _0x167ed6['update']({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0xed7d('0x1f')](function(_0x5b0b0b){_0x372a58(_0x5b0b0b);})[_0xed7d('0x24')](function(_0x17cb60){_0x1e9aef(_0x2082d7[_0xed7d('0x11')](0x1f4,_0x17cb60[_0xed7d('0x13')]));});});};exports['LoginUser']=function(_0x31c599){var _0x12eff8=this;return new Promise(function(_0x1987e1,_0xc0db04){var _0x52f602;var _0x44ebc1;var _0x3d2b81;var _0x23930f;return db['User'][_0xed7d('0x3a')]({'where':_0x31c599['options'][_0xed7d('0x19')]||{},'attributes':['id','name',_0xed7d('0x45'),_0xed7d('0x46'),_0xed7d('0x47'),_0xed7d('0x37'),_0xed7d('0x48'),'interface']})[_0xed7d('0x1f')](function(_0x460056){if(_0x460056){_0x52f602=_0x460056;_0x23930f=_0x31c599[_0xed7d('0x34')][_0xed7d('0x27')]?_0x31c599[_0xed7d('0x34')][_0xed7d('0x27')]:util['format']('SIP/%s',_0x52f602[_0xed7d('0x26')]);return db[_0xed7d('0x22')][_0xed7d('0x49')]({'where':{'role':'agent','online':!![],'id':{'$ne':_0x52f602['id']}}});}})[_0xed7d('0x1f')](function(_0x5cc62d){if(_0x5cc62d){_0x3d2b81=_0x5cc62d;return require(_0xed7d('0x4a'))[_0xed7d('0x4b')]();}})['then'](function(_0x452e6d){if(_0x452e6d&&_0x452e6d[_0xed7d('0x4c')]&&_0x3d2b81>=_0x452e6d[_0xed7d('0x4c')]){throw new Error('Maximum\x20login\x20has\x20been\x20reached');}})['then'](function(){if(_0x52f602){return db[_0xed7d('0x28')][_0xed7d('0x43')]({'where':{'membername':_0x52f602['name']},'individualHooks':!![]});}})['then'](function(){if(_0x52f602){return _0x52f602['getVoiceQueues']({'raw':!![]});}})[_0xed7d('0x1f')](function(_0x3ab54c){if(_0x52f602){if(_0x3ab54c){var _0x1c9c68=[];_0x44ebc1=_0x3ab54c;if(_0x44ebc1[_0xed7d('0x2c')]){for(var _0x570f43=0x0;_0x570f43<_0x44ebc1['length'];_0x570f43++){_0x1c9c68[_0xed7d('0x31')](db['UserVoiceQueueRt'][_0xed7d('0x4d')]({'membername':_0x52f602[_0xed7d('0x26')],'UserId':_0x52f602['id'],'queue_name':_0x44ebc1[_0x570f43][_0xed7d('0x26')],'VoiceQueueId':_0x44ebc1[_0x570f43]['id'],'interface':_0x23930f,'paused':_0x52f602[_0xed7d('0x48')]||![],'penalty':_0x44ebc1[_0x570f43][_0xed7d('0x4e')]||0x0}));}return BPromise[_0xed7d('0x44')](_0x1c9c68);}}}})['then'](function(){if(_0x52f602){return db[_0xed7d('0x2a')][_0xed7d('0x16')]({'where':{'membername':_0x52f602['name'],'exitAt':null}});}})[_0xed7d('0x1f')](function(_0x4b5d6a){if(_0x52f602){if(_0x4b5d6a&&_0x4b5d6a['length']){var _0x58caa1=[];_0x4b5d6a[_0xed7d('0x30')](function(_0x1ab389){_0x58caa1[_0xed7d('0x31')](_0x1ab389[_0xed7d('0x29')]({'exitAt':moment()[_0xed7d('0x2d')](_0xed7d('0x2e'))}));});return BPromise[_0xed7d('0x44')](_0x58caa1);}}})[_0xed7d('0x1f')](function(_0x26aa87){if(_0x52f602){var _0x5f0d09=[];var _0x35a33a=[];var _0x57d6ee=utils[_0xed7d('0x2f')]();var _0x43a107={'membername':_0x52f602[_0xed7d('0x26')],'interface':_0x23930f,'enterAt':moment()[_0xed7d('0x2d')](_0xed7d('0x2e')),'role':_0x52f602['role'],'internal':_0x52f602[_0xed7d('0x37')]};_0x57d6ee[_0xed7d('0x30')](function(_0x22bbb9){_0x5f0d09[_0xed7d('0x31')](_[_0xed7d('0x4f')]({'channel':_0x22bbb9,'type':_0xed7d('0x50'),'data1':_0xed7d('0x51'),'data2':_0x23930f},_0x43a107));if(_0x52f602[_0xed7d('0x48')]){_0x35a33a[_0xed7d('0x31')](_['merge']({'channel':_0x22bbb9,'type':_0xed7d('0x2b'),'data1':_0xed7d('0x52')},_0x43a107));}});return db[_0xed7d('0x2a')][_0xed7d('0x53')](_0x5f0d09[_0xed7d('0x54')](_0x35a33a),{'individualHooks':!![]});}})[_0xed7d('0x1f')](function(){if(_0x52f602){return _0x52f602[_0xed7d('0x29')]({'online':!![],'lastLoginAt':moment()['format'](_0xed7d('0x2e')),'voicePause':_0x52f602['loginInPause']||![],'mailPause':_0x52f602[_0xed7d('0x48')]||![],'chatPause':_0x52f602['loginInPause']||![],'faxPause':_0x52f602[_0xed7d('0x48')]||![],'smsPause':_0x52f602[_0xed7d('0x48')]||![],'openchannelPause':_0x52f602[_0xed7d('0x48')]||![],'pauseType':_0x52f602[_0xed7d('0x48')]?_0xed7d('0x52'):null,'lastPauseAt':moment()[_0xed7d('0x2d')](_0xed7d('0x2e')),'interface':_0x23930f});}})[_0xed7d('0x1f')](function(_0x48cffd){_0x1987e1(_0x48cffd);})[_0xed7d('0x24')](function(_0x178ed2){_0xc0db04(_0x12eff8[_0xed7d('0x11')](0x1f4,_0x178ed2[_0xed7d('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index 22eee47..af4cf96 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 _0x015e=['user:','./user.events','save','remove','emit','removeListener','length'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x015e,0x127));var _0xe015=function(_0x2d34d6,_0x397ff9){_0x2d34d6=_0x2d34d6-0x0;var _0x1d3d12=_0x015e[_0x2d34d6];return _0x1d3d12;};'use strict';var UserEvents=require(_0xe015('0x0'));var events=[_0xe015('0x1'),_0xe015('0x2'),'update'];function createListener(_0xc35641,_0x5af052){return function(_0x4c96ee){_0x5af052[_0xe015('0x3')](_0xc35641,_0x4c96ee);};}function removeListener(_0x332da3,_0x2ddec6){return function(){UserEvents[_0xe015('0x4')](_0x332da3,_0x2ddec6);};}exports['register']=function(_0x364307){for(var _0x14c774=0x0,_0x4a3f99=events[_0xe015('0x5')];_0x14c774<_0x4a3f99;_0x14c774++){var _0x685191=events[_0x14c774];var _0x178b8b=createListener(_0xe015('0x6')+_0x685191,_0x364307);UserEvents['on'](_0x685191,_0x178b8b);}}; \ No newline at end of file +var _0x657f=['remove','update','emit','removeListener','register','length','user:'];(function(_0x4b7385,_0x4948b4){var _0x5dd091=function(_0x239831){while(--_0x239831){_0x4b7385['push'](_0x4b7385['shift']());}};_0x5dd091(++_0x4948b4);}(_0x657f,0x12d));var _0xf657=function(_0x44c974,_0x1bcfde){_0x44c974=_0x44c974-0x0;var _0x5214c6=_0x657f[_0x44c974];return _0x5214c6;};'use strict';var UserEvents=require('./user.events');var events=['save',_0xf657('0x0'),_0xf657('0x1')];function createListener(_0x497991,_0x389243){return function(_0x234c48){_0x389243[_0xf657('0x2')](_0x497991,_0x234c48);};}function removeListener(_0x5acad8,_0x506894){return function(){UserEvents[_0xf657('0x3')](_0x5acad8,_0x506894);};}exports[_0xf657('0x4')]=function(_0x404099){for(var _0x215f42=0x0,_0x4de706=events[_0xf657('0x5')];_0x215f42<_0x4de706;_0x215f42++){var _0x4a996b=events[_0x215f42];var _0x5b5db6=createListener(_0xf657('0x6')+_0x4a996b,_0x404099);UserEvents['on'](_0x4a996b,_0x5b5db6);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index 5efe1a5..e04ceed 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 _0x1801=['../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','connect-timeout','express'];(function(_0x3b5250,_0x7a0b2c){var _0xc844a1=function(_0x2fbc98){while(--_0x2fbc98){_0x3b5250['push'](_0x3b5250['shift']());}};_0xc844a1(++_0x7a0b2c);}(_0x1801,0x18c));var _0x1180=function(_0x429835,_0x5e7133){_0x429835=_0x429835-0x0;var _0x33cfa9=_0x1801[_0x429835];return _0x33cfa9;};'use strict';var multer=require(_0x1180('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x1180('0x1'));var express=require(_0x1180('0x2'));var router=express['Router']();var auth=require(_0x1180('0x3'));var interaction=require(_0x1180('0x4'));var config=require(_0x1180('0x5'));module[_0x1180('0x6')]=router; \ No newline at end of file +var _0x07c5=['multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports'];(function(_0x111ccf,_0x250082){var _0x461f2a=function(_0x29ea0b){while(--_0x29ea0b){_0x111ccf['push'](_0x111ccf['shift']());}};_0x461f2a(++_0x250082);}(_0x07c5,0xa2));var _0x507c=function(_0x1c81e1,_0x4e39f9){_0x1c81e1=_0x1c81e1-0x0;var _0x12222f=_0x07c5[_0x1c81e1];return _0x12222f;};'use strict';var multer=require(_0x507c('0x0'));var util=require(_0x507c('0x1'));var path=require(_0x507c('0x2'));var timeout=require(_0x507c('0x3'));var express=require('express');var router=express[_0x507c('0x4')]();var auth=require(_0x507c('0x5'));var interaction=require(_0x507c('0x6'));var config=require(_0x507c('0x7'));module[_0x507c('0x8')]=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index 5a105f1..24a2f20 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 _0xbaf0=['exports','INTEGER'];(function(_0x26df48,_0x22aa50){var _0x209047=function(_0x1d068b){while(--_0x1d068b){_0x26df48['push'](_0x26df48['shift']());}};_0x209047(++_0x22aa50);}(_0xbaf0,0x12a));var _0x0baf=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xbaf0[_0x501510];return _0x1e6ee5;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xa9e0=['sequelize','exports','INTEGER'];(function(_0x397781,_0x2436a5){var _0x4647f1=function(_0x1a4736){while(--_0x1a4736){_0x397781['push'](_0x397781['shift']());}};_0x4647f1(++_0x2436a5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0xa9e0[_0x187ee1];return _0x388160;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'penalty':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.model.js b/server/api/userChatQueue/userChatQueue.model.js index 0fa96ff..bf7f0cb 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 _0x0fcf=['UserChatQueue','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userChatQueue.attributes','exports'];(function(_0x1ebe2f,_0x523227){var _0xdeb06f=function(_0x2a6051){while(--_0x2a6051){_0x1ebe2f['push'](_0x1ebe2f['shift']());}};_0xdeb06f(++_0x523227);}(_0x0fcf,0x145));var _0xf0fc=function(_0x17fa7f,_0x2edf0b){_0x17fa7f=_0x17fa7f-0x0;var _0x5f5b88=_0x0fcf[_0x17fa7f];return _0x5f5b88;};'use strict';var _=require(_0xf0fc('0x0'));var util=require('util');var logger=require(_0xf0fc('0x1'))(_0xf0fc('0x2'));var moment=require(_0xf0fc('0x3'));var BPromise=require(_0xf0fc('0x4'));var rp=require(_0xf0fc('0x5'));var fs=require('fs');var path=require(_0xf0fc('0x6'));var rimraf=require(_0xf0fc('0x7'));var config=require(_0xf0fc('0x8'));var attributes=require(_0xf0fc('0x9'));module[_0xf0fc('0xa')]=function(_0x24ec4c,_0x4d44c9){return _0x24ec4c['define'](_0xf0fc('0xb'),attributes,{'tableName':'user_has_chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdc0e=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userChatQueue.attributes','exports','define','UserChatQueue','user_has_chat_queues'];(function(_0x2f72fd,_0x487169){var _0x41b599=function(_0x130d0f){while(--_0x130d0f){_0x2f72fd['push'](_0x2f72fd['shift']());}};_0x41b599(++_0x487169);}(_0xdc0e,0xa8));var _0xedc0=function(_0x327e17,_0x8e788e){_0x327e17=_0x327e17-0x0;var _0x143c10=_0xdc0e[_0x327e17];return _0x143c10;};'use strict';var _=require('lodash');var util=require(_0xedc0('0x0'));var logger=require(_0xedc0('0x1'))(_0xedc0('0x2'));var moment=require(_0xedc0('0x3'));var BPromise=require(_0xedc0('0x4'));var rp=require(_0xedc0('0x5'));var fs=require('fs');var path=require(_0xedc0('0x6'));var rimraf=require(_0xedc0('0x7'));var config=require(_0xedc0('0x8'));var attributes=require(_0xedc0('0x9'));module[_0xedc0('0xa')]=function(_0xf70a53,_0x27fdb2){return _0xf70a53[_0xedc0('0xb')](_0xedc0('0xc'),attributes,{'tableName':_0xedc0('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.rpc.js b/server/api/userChatQueue/userChatQueue.rpc.js index ff2c37d..91ac327 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 _0xa2fc=['code','UserChatQueue,\x20%s,\x20%s','message','catch','lodash','util','randomstring','../../config/utils','rpc','jayson/promise','client','http','request','info','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x4599b6,_0x40c254){var _0x2e014c=function(_0x3c4d90){while(--_0x3c4d90){_0x4599b6['push'](_0x4599b6['shift']());}};_0x2e014c(++_0x40c254);}(_0xa2fc,0xc2));var _0xca2f=function(_0x403fc7,_0x32931a){_0x403fc7=_0x403fc7-0x0;var _0x5d0827=_0xa2fc[_0x403fc7];return _0x5d0827;};'use strict';var _=require(_0xca2f('0x0'));var util=require(_0xca2f('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xca2f('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xca2f('0x3'));var logger=require('../../config/logger')(_0xca2f('0x4'));var config=require('../../config/environment');var jayson=require(_0xca2f('0x5'));var client=jayson[_0xca2f('0x6')][_0xca2f('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x79dc8c,_0x31665c,_0x2ef044){return new BPromise(function(_0x1faf13,_0x249891){return client[_0xca2f('0x8')](_0x79dc8c,_0x2ef044)['then'](function(_0xe03432){logger[_0xca2f('0x9')]('UserChatQueue,\x20%s,\x20%s',_0x31665c,_0xca2f('0xa'));logger[_0xca2f('0xb')](_0xca2f('0xc'),_0x31665c,'request\x20sent',JSON[_0xca2f('0xd')](_0xe03432));if(_0xe03432['error']){if(_0xe03432[_0xca2f('0xe')][_0xca2f('0xf')]===0x1f4){logger['error'](_0xca2f('0x10'),_0x31665c,_0xe03432[_0xca2f('0xe')][_0xca2f('0x11')]);return _0x249891(_0xe03432[_0xca2f('0xe')][_0xca2f('0x11')]);}logger[_0xca2f('0xe')](_0xca2f('0x10'),_0x31665c,_0xe03432[_0xca2f('0xe')][_0xca2f('0x11')]);return _0x1faf13(_0xe03432[_0xca2f('0xe')]['message']);}else{logger['info']('UserChatQueue,\x20%s,\x20%s',_0x31665c,_0xca2f('0xa'));_0x1faf13(_0xe03432['result'][_0xca2f('0x11')]);}})[_0xca2f('0x12')](function(_0x3a0195){logger[_0xca2f('0xe')]('UserChatQueue,\x20%s,\x20%s',_0x31665c,_0x3a0195);_0x249891(_0x3a0195);});});} \ No newline at end of file +var _0xd48f=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','http','request','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','moment'];(function(_0x53a2f2,_0x59aeb3){var _0x167512=function(_0x46fd45){while(--_0x46fd45){_0x53a2f2['push'](_0x53a2f2['shift']());}};_0x167512(++_0x59aeb3);}(_0xd48f,0x1b6));var _0xfd48=function(_0x4c440b,_0x3ea627){_0x4c440b=_0x4c440b-0x0;var _0x2d48cf=_0xd48f[_0x4c440b];return _0x2d48cf;};'use strict';var _=require('lodash');var util=require(_0xfd48('0x0'));var moment=require(_0xfd48('0x1'));var BPromise=require(_0xfd48('0x2'));var rs=require(_0xfd48('0x3'));var fs=require('fs');var Redis=require(_0xfd48('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xfd48('0x5'));var logger=require(_0xfd48('0x6'))(_0xfd48('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xfd48('0x8')][_0xfd48('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x28d48e,_0x11ec89,_0xee686b){return new BPromise(function(_0xf31ede,_0x327f7c){return client[_0xfd48('0xa')](_0x28d48e,_0xee686b)['then'](function(_0x26e1c4){logger[_0xfd48('0xb')](_0xfd48('0xc'),_0x11ec89,_0xfd48('0xd'));logger['debug'](_0xfd48('0xe'),_0x11ec89,_0xfd48('0xd'),JSON[_0xfd48('0xf')](_0x26e1c4));if(_0x26e1c4[_0xfd48('0x10')]){if(_0x26e1c4[_0xfd48('0x10')][_0xfd48('0x11')]===0x1f4){logger[_0xfd48('0x10')](_0xfd48('0xc'),_0x11ec89,_0x26e1c4[_0xfd48('0x10')][_0xfd48('0x12')]);return _0x327f7c(_0x26e1c4['error'][_0xfd48('0x12')]);}logger[_0xfd48('0x10')](_0xfd48('0xc'),_0x11ec89,_0x26e1c4[_0xfd48('0x10')]['message']);return _0xf31ede(_0x26e1c4[_0xfd48('0x10')][_0xfd48('0x12')]);}else{logger[_0xfd48('0xb')](_0xfd48('0xc'),_0x11ec89,'request\x20sent');_0xf31ede(_0x26e1c4[_0xfd48('0x13')][_0xfd48('0x12')]);}})['catch'](function(_0x12bc57){logger['error'](_0xfd48('0xc'),_0x11ec89,_0x12bc57);_0x327f7c(_0x12bc57);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index eb132f8..b7c6112 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 _0x9f79=['exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x1657b0,_0x31213a){var _0x27d905=function(_0x50502e){while(--_0x50502e){_0x1657b0['push'](_0x1657b0['shift']());}};_0x27d905(++_0x31213a);}(_0x9f79,0xd9));var _0x99f7=function(_0x29bbcc,_0x443f4e){_0x29bbcc=_0x29bbcc-0x0;var _0x4d2113=_0x9f79[_0x29bbcc];return _0x4d2113;};'use strict';var multer=require('multer');var util=require(_0x99f7('0x0'));var path=require(_0x99f7('0x1'));var timeout=require(_0x99f7('0x2'));var express=require('express');var router=express[_0x99f7('0x3')]();var auth=require(_0x99f7('0x4'));var interaction=require(_0x99f7('0x5'));var config=require(_0x99f7('0x6'));module[_0x99f7('0x7')]=router; \ No newline at end of file +var _0x0eb6=['util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','multer'];(function(_0x40df5f,_0x8fd59f){var _0x1573f1=function(_0x57b8b8){while(--_0x57b8b8){_0x40df5f['push'](_0x40df5f['shift']());}};_0x1573f1(++_0x8fd59f);}(_0x0eb6,0x167));var _0x60eb=function(_0x41382c,_0xc3ffd1){_0x41382c=_0x41382c-0x0;var _0x4da35b=_0x0eb6[_0x41382c];return _0x4da35b;};'use strict';var multer=require(_0x60eb('0x0'));var util=require(_0x60eb('0x1'));var path=require(_0x60eb('0x2'));var timeout=require(_0x60eb('0x3'));var express=require(_0x60eb('0x4'));var router=express['Router']();var auth=require(_0x60eb('0x5'));var interaction=require(_0x60eb('0x6'));var config=require(_0x60eb('0x7'));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 f56aae5..c7aab5c 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 _0x3423=['INTEGER','STRING'];(function(_0x3fd462,_0x1edf7c){var _0x3a0e07=function(_0x4eca3a){while(--_0x4eca3a){_0x3fd462['push'](_0x3fd462['shift']());}};_0x3a0e07(++_0x1edf7c);}(_0x3423,0x188));var _0x3342=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3423[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0x3342('0x0')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x3342('0x0')],'defaultValue':0x0},'queue':{'type':Sequelize[_0x3342('0x1')]}}; \ No newline at end of file +var _0x9c00=['exports','STRING','sequelize'];(function(_0x382e3e,_0x45774b){var _0x49cb97=function(_0x4a7950){while(--_0x4a7950){_0x382e3e['push'](_0x382e3e['shift']());}};_0x49cb97(++_0x45774b);}(_0x9c00,0x1a0));var _0x09c0=function(_0x1679cc,_0x242c53){_0x1679cc=_0x1679cc-0x0;var _0x4aaec8=_0x9c00[_0x1679cc];return _0x4aaec8;};'use strict';var Sequelize=require(_0x09c0('0x0'));module[_0x09c0('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'queue':{'type':Sequelize[_0x09c0('0x2')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index a04b8b0..3494669 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 _0xcd6f=['./userFaxQueue.attributes','exports','define','UserFaxQueue','user_has_fax_queues','lodash','util','api','bluebird','path','rimraf'];(function(_0x8aec06,_0x3d5724){var _0x4c3613=function(_0x3c85da){while(--_0x3c85da){_0x8aec06['push'](_0x8aec06['shift']());}};_0x4c3613(++_0x3d5724);}(_0xcd6f,0x73));var _0xfcd6=function(_0x5b79fe,_0x3dad90){_0x5b79fe=_0x5b79fe-0x0;var _0x17d865=_0xcd6f[_0x5b79fe];return _0x17d865;};'use strict';var _=require(_0xfcd6('0x0'));var util=require(_0xfcd6('0x1'));var logger=require('../../config/logger')(_0xfcd6('0x2'));var moment=require('moment');var BPromise=require(_0xfcd6('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfcd6('0x4'));var rimraf=require(_0xfcd6('0x5'));var config=require('../../config/environment');var attributes=require(_0xfcd6('0x6'));module[_0xfcd6('0x7')]=function(_0x52ad4c,_0x38e3b1){return _0x52ad4c[_0xfcd6('0x8')](_0xfcd6('0x9'),attributes,{'tableName':_0xfcd6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x56ff=['./userFaxQueue.attributes','exports','user_has_fax_queues','lodash','util','api','moment','path','../../config/environment'];(function(_0xb89aa4,_0x3d10fe){var _0x316dce=function(_0x530003){while(--_0x530003){_0xb89aa4['push'](_0xb89aa4['shift']());}};_0x316dce(++_0x3d10fe);}(_0x56ff,0x66));var _0xf56f=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x56ff[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xf56f('0x0'));var util=require(_0xf56f('0x1'));var logger=require('../../config/logger')(_0xf56f('0x2'));var moment=require(_0xf56f('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xf56f('0x4'));var rimraf=require('rimraf');var config=require(_0xf56f('0x5'));var attributes=require(_0xf56f('0x6'));module[_0xf56f('0x7')]=function(_0x5c7395,_0x2c65e9){return _0x5c7395['define']('UserFaxQueue',attributes,{'tableName':_0xf56f('0x8'),'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 dfe4130..a7ac3a6 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 _0x9999=['../../config/logger','rpc','../../config/environment','http','UserFaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','UserFaxQueue,\x20%s,\x20%s','message','info','result','catch','lodash','util','bluebird','ioredis','../../mysqldb'];(function(_0x169d44,_0x2ab72b){var _0x28e91a=function(_0x944404){while(--_0x944404){_0x169d44['push'](_0x169d44['shift']());}};_0x28e91a(++_0x2ab72b);}(_0x9999,0xaf));var _0x9999=function(_0x54734a,_0x461676){_0x54734a=_0x54734a-0x0;var _0x3e1e93=_0x9999[_0x54734a];return _0x3e1e93;};'use strict';var _=require(_0x9999('0x0'));var util=require(_0x9999('0x1'));var moment=require('moment');var BPromise=require(_0x9999('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9999('0x3'));var db=require(_0x9999('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x9999('0x5'))(_0x9999('0x6'));var config=require(_0x9999('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x9999('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x16d823,_0x5207ac,_0x12c713){return new BPromise(function(_0x1caca1,_0x5c4d58){return client['request'](_0x16d823,_0x12c713)['then'](function(_0x5cde71){logger['info']('UserFaxQueue,\x20%s,\x20%s',_0x5207ac,'request\x20sent');logger['debug'](_0x9999('0x9'),_0x5207ac,_0x9999('0xa'),JSON['stringify'](_0x5cde71));if(_0x5cde71['error']){if(_0x5cde71[_0x9999('0xb')][_0x9999('0xc')]===0x1f4){logger[_0x9999('0xb')](_0x9999('0xd'),_0x5207ac,_0x5cde71[_0x9999('0xb')][_0x9999('0xe')]);return _0x5c4d58(_0x5cde71[_0x9999('0xb')][_0x9999('0xe')]);}logger[_0x9999('0xb')](_0x9999('0xd'),_0x5207ac,_0x5cde71[_0x9999('0xb')][_0x9999('0xe')]);return _0x1caca1(_0x5cde71[_0x9999('0xb')][_0x9999('0xe')]);}else{logger[_0x9999('0xf')](_0x9999('0xd'),_0x5207ac,_0x9999('0xa'));_0x1caca1(_0x5cde71[_0x9999('0x10')][_0x9999('0xe')]);}})[_0x9999('0x11')](function(_0x2693a2){logger[_0x9999('0xb')](_0x9999('0xd'),_0x5207ac,_0x2693a2);_0x5c4d58(_0x2693a2);});});} \ No newline at end of file +var _0x260e=['../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','UserFaxQueue,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x54d52,_0x2473ba){var _0x968345=function(_0x3fcd06){while(--_0x3fcd06){_0x54d52['push'](_0x54d52['shift']());}};_0x968345(++_0x2473ba);}(_0x260e,0x1b9));var _0xe260=function(_0x24dfee,_0x238000){_0x24dfee=_0x24dfee-0x0;var _0x2ad610=_0x260e[_0x24dfee];return _0x2ad610;};'use strict';var _=require(_0xe260('0x0'));var util=require(_0xe260('0x1'));var moment=require(_0xe260('0x2'));var BPromise=require(_0xe260('0x3'));var rs=require(_0xe260('0x4'));var fs=require('fs');var Redis=require(_0xe260('0x5'));var db=require(_0xe260('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xe260('0x7'))(_0xe260('0x8'));var config=require(_0xe260('0x9'));var jayson=require(_0xe260('0xa'));var client=jayson[_0xe260('0xb')][_0xe260('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x415233,_0x58328a,_0x54109c){return new BPromise(function(_0x306da6,_0x222bdc){return client[_0xe260('0xd')](_0x415233,_0x54109c)[_0xe260('0xe')](function(_0x33e8b6){logger[_0xe260('0xf')]('UserFaxQueue,\x20%s,\x20%s',_0x58328a,_0xe260('0x10'));logger[_0xe260('0x11')](_0xe260('0x12'),_0x58328a,_0xe260('0x10'),JSON[_0xe260('0x13')](_0x33e8b6));if(_0x33e8b6[_0xe260('0x14')]){if(_0x33e8b6[_0xe260('0x14')]['code']===0x1f4){logger[_0xe260('0x14')](_0xe260('0x15'),_0x58328a,_0x33e8b6['error'][_0xe260('0x16')]);return _0x222bdc(_0x33e8b6[_0xe260('0x14')][_0xe260('0x16')]);}logger[_0xe260('0x14')]('UserFaxQueue,\x20%s,\x20%s',_0x58328a,_0x33e8b6['error'][_0xe260('0x16')]);return _0x306da6(_0x33e8b6[_0xe260('0x14')][_0xe260('0x16')]);}else{logger['info'](_0xe260('0x15'),_0x58328a,_0xe260('0x10'));_0x306da6(_0x33e8b6[_0xe260('0x17')]['message']);}})[_0xe260('0x18')](function(_0x13fa24){logger[_0xe260('0x14')]('UserFaxQueue,\x20%s,\x20%s',_0x58328a,_0x13fa24);_0x222bdc(_0x13fa24);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index dec34f0..260ff1d 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 _0x71d1=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','exports','multer'];(function(_0x4c4079,_0x32376e){var _0x2d8bcf=function(_0x314713){while(--_0x314713){_0x4c4079['push'](_0x4c4079['shift']());}};_0x2d8bcf(++_0x32376e);}(_0x71d1,0x98));var _0x171d=function(_0x4b2863,_0x494899){_0x4b2863=_0x4b2863-0x0;var _0x567d67=_0x71d1[_0x4b2863];return _0x567d67;};'use strict';var multer=require(_0x171d('0x0'));var util=require(_0x171d('0x1'));var path=require(_0x171d('0x2'));var timeout=require(_0x171d('0x3'));var express=require(_0x171d('0x4'));var router=express[_0x171d('0x5')]();var auth=require(_0x171d('0x6'));var interaction=require(_0x171d('0x7'));var config=require('../../config/environment');module[_0x171d('0x8')]=router; \ No newline at end of file +var _0x468f=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','multer'];(function(_0x4592d0,_0x3651b3){var _0x3df4f3=function(_0xd1055b){while(--_0xd1055b){_0x4592d0['push'](_0x4592d0['shift']());}};_0x3df4f3(++_0x3651b3);}(_0x468f,0x1af));var _0xf468=function(_0x4c4a8b,_0x402020){_0x4c4a8b=_0x4c4a8b-0x0;var _0x20fa14=_0x468f[_0x4c4a8b];return _0x20fa14;};'use strict';var multer=require(_0xf468('0x0'));var util=require(_0xf468('0x1'));var path=require(_0xf468('0x2'));var timeout=require(_0xf468('0x3'));var express=require(_0xf468('0x4'));var router=express[_0xf468('0x5')]();var auth=require(_0xf468('0x6'));var interaction=require(_0xf468('0x7'));var config=require(_0xf468('0x8'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index 72577b9..d967545 100644 --- a/server/api/userMailQueue/userMailQueue.attributes.js +++ b/server/api/userMailQueue/userMailQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['exports','INTEGER'];(function(_0xf50820,_0x56f041){var _0x2a9b10=function(_0x33f0f4){while(--_0x33f0f4){_0xf50820['push'](_0xf50820['shift']());}};_0x2a9b10(++_0x56f041);}(_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')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xbaf0=['exports','INTEGER'];(function(_0xea343d,_0x311197){var _0x2c6e9c=function(_0x454bd6){while(--_0x454bd6){_0xea343d['push'](_0xea343d['shift']());}};_0x2c6e9c(++_0x311197);}(_0xbaf0,0x12a));var _0x0baf=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xbaf0[_0x4cf98e];return _0x1623ac;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index e4411e2..445e1e8 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 _0x0713=['moment','bluebird','request-promise','rimraf','../../config/environment','./userMailQueue.attributes','exports','define','UserMailQueue','user_has_mail_queues','../../config/logger','api'];(function(_0x44ae6c,_0x3fccae){var _0x59e7c0=function(_0x332692){while(--_0x332692){_0x44ae6c['push'](_0x44ae6c['shift']());}};_0x59e7c0(++_0x3fccae);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var moment=require(_0x3071('0x2'));var BPromise=require(_0x3071('0x3'));var rp=require(_0x3071('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var attributes=require(_0x3071('0x7'));module[_0x3071('0x8')]=function(_0xabd7b6,_0x41cf76){return _0xabd7b6[_0x3071('0x9')](_0x3071('0xa'),attributes,{'tableName':_0x3071('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe706=['request-promise','path','rimraf','../../config/environment','./userMailQueue.attributes','exports','define','UserMailQueue','user_has_mail_queues','lodash','util','../../config/logger','moment','bluebird'];(function(_0x450022,_0x2aad4c){var _0x11e71d=function(_0xd07c2){while(--_0xd07c2){_0x450022['push'](_0x450022['shift']());}};_0x11e71d(++_0x2aad4c);}(_0xe706,0xa3));var _0x6e70=function(_0x136dbb,_0x2b0666){_0x136dbb=_0x136dbb-0x0;var _0x6a5309=_0xe706[_0x136dbb];return _0x6a5309;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('api');var moment=require(_0x6e70('0x3'));var BPromise=require(_0x6e70('0x4'));var rp=require(_0x6e70('0x5'));var fs=require('fs');var path=require(_0x6e70('0x6'));var rimraf=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var attributes=require(_0x6e70('0x9'));module[_0x6e70('0xa')]=function(_0x1b0389,_0x4381d1){return _0x1b0389[_0x6e70('0xb')](_0x6e70('0xc'),attributes,{'tableName':_0x6e70('0xd'),'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 1fd4243..89a3036 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 _0x07d7=['result','catch','UserMailQueue,\x20%s,\x20%s','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x11fc41,_0x5409e3){var _0x252d5a=function(_0x1a20df){while(--_0x1a20df){_0x11fc41['push'](_0x11fc41['shift']());}};_0x252d5a(++_0x5409e3);}(_0x07d7,0x85));var _0x707d=function(_0x2ca616,_0x384ec8){_0x2ca616=_0x2ca616-0x0;var _0x53155f=_0x07d7[_0x2ca616];return _0x53155f;};'use strict';var _=require(_0x707d('0x0'));var util=require(_0x707d('0x1'));var moment=require(_0x707d('0x2'));var BPromise=require(_0x707d('0x3'));var rs=require(_0x707d('0x4'));var fs=require('fs');var Redis=require(_0x707d('0x5'));var db=require(_0x707d('0x6'))['db'];var utils=require(_0x707d('0x7'));var logger=require(_0x707d('0x8'))(_0x707d('0x9'));var config=require(_0x707d('0xa'));var jayson=require(_0x707d('0xb'));var client=jayson[_0x707d('0xc')][_0x707d('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x1bdf46,_0x13df54,_0x50de20){return new BPromise(function(_0x4c9e57,_0x5fe2d4){return client[_0x707d('0xe')](_0x1bdf46,_0x50de20)[_0x707d('0xf')](function(_0x2cc0c1){logger[_0x707d('0x10')]('UserMailQueue,\x20%s,\x20%s',_0x13df54,_0x707d('0x11'));logger[_0x707d('0x12')](_0x707d('0x13'),_0x13df54,'request\x20sent',JSON[_0x707d('0x14')](_0x2cc0c1));if(_0x2cc0c1[_0x707d('0x15')]){if(_0x2cc0c1[_0x707d('0x15')]['code']===0x1f4){logger['error']('UserMailQueue,\x20%s,\x20%s',_0x13df54,_0x2cc0c1[_0x707d('0x15')][_0x707d('0x16')]);return _0x5fe2d4(_0x2cc0c1[_0x707d('0x15')]['message']);}logger[_0x707d('0x15')]('UserMailQueue,\x20%s,\x20%s',_0x13df54,_0x2cc0c1[_0x707d('0x15')][_0x707d('0x16')]);return _0x4c9e57(_0x2cc0c1['error']['message']);}else{logger[_0x707d('0x10')]('UserMailQueue,\x20%s,\x20%s',_0x13df54,_0x707d('0x11'));_0x4c9e57(_0x2cc0c1[_0x707d('0x17')][_0x707d('0x16')]);}})[_0x707d('0x18')](function(_0x148d08){logger[_0x707d('0x15')](_0x707d('0x19'),_0x13df54,_0x148d08);_0x5fe2d4(_0x148d08);});});} \ No newline at end of file +var _0x6d19=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserMailQueue,\x20%s,\x20%s','message','request\x20sent'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x6d19,0x160));var _0x96d1=function(_0x35af23,_0x9190f6){_0x35af23=_0x35af23-0x0;var _0x340506=_0x6d19[_0x35af23];return _0x340506;};'use strict';var _=require(_0x96d1('0x0'));var util=require(_0x96d1('0x1'));var moment=require(_0x96d1('0x2'));var BPromise=require(_0x96d1('0x3'));var rs=require(_0x96d1('0x4'));var fs=require('fs');var Redis=require(_0x96d1('0x5'));var db=require(_0x96d1('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x96d1('0x7'))(_0x96d1('0x8'));var config=require(_0x96d1('0x9'));var jayson=require(_0x96d1('0xa'));var client=jayson['client'][_0x96d1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x230638,_0x61e0f5,_0x58ade3){return new BPromise(function(_0xba2d03,_0x3f7a36){return client[_0x96d1('0xc')](_0x230638,_0x58ade3)[_0x96d1('0xd')](function(_0x37b251){logger[_0x96d1('0xe')]('UserMailQueue,\x20%s,\x20%s',_0x61e0f5,'request\x20sent');logger[_0x96d1('0xf')](_0x96d1('0x10'),_0x61e0f5,'request\x20sent',JSON[_0x96d1('0x11')](_0x37b251));if(_0x37b251['error']){if(_0x37b251[_0x96d1('0x12')][_0x96d1('0x13')]===0x1f4){logger[_0x96d1('0x12')](_0x96d1('0x14'),_0x61e0f5,_0x37b251[_0x96d1('0x12')][_0x96d1('0x15')]);return _0x3f7a36(_0x37b251['error'][_0x96d1('0x15')]);}logger[_0x96d1('0x12')](_0x96d1('0x14'),_0x61e0f5,_0x37b251[_0x96d1('0x12')][_0x96d1('0x15')]);return _0xba2d03(_0x37b251['error']['message']);}else{logger[_0x96d1('0xe')](_0x96d1('0x14'),_0x61e0f5,_0x96d1('0x16'));_0xba2d03(_0x37b251[_0x96d1('0x17')][_0x96d1('0x15')]);}})[_0x96d1('0x18')](function(_0x45dc6f){logger[_0x96d1('0x12')](_0x96d1('0x14'),_0x61e0f5,_0x45dc6f);_0x3f7a36(_0x45dc6f);});});} \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index abca962..7459fb4 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 _0xea6c=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','util','path','connect-timeout','express'];(function(_0x6aad74,_0x32ecf4){var _0x5b1c38=function(_0x567477){while(--_0x567477){_0x6aad74['push'](_0x6aad74['shift']());}};_0x5b1c38(++_0x32ecf4);}(_0xea6c,0x164));var _0xcea6=function(_0x16d369,_0xbbaa52){_0x16d369=_0x16d369-0x0;var _0x53c1ca=_0xea6c[_0x16d369];return _0x53c1ca;};'use strict';var multer=require('multer');var util=require(_0xcea6('0x0'));var path=require(_0xcea6('0x1'));var timeout=require(_0xcea6('0x2'));var express=require(_0xcea6('0x3'));var router=express[_0xcea6('0x4')]();var auth=require(_0xcea6('0x5'));var interaction=require(_0xcea6('0x6'));var config=require(_0xcea6('0x7'));module[_0xcea6('0x8')]=router; \ No newline at end of file +var _0x3e24=['multer','util','path','express','Router','../../config/environment','exports'];(function(_0xdc3756,_0x12752e){var _0x3047ec=function(_0x1e8ab7){while(--_0x1e8ab7){_0xdc3756['push'](_0xdc3756['shift']());}};_0x3047ec(++_0x12752e);}(_0x3e24,0x12d));var _0x43e2=function(_0xecf14c,_0x25eb68){_0xecf14c=_0xecf14c-0x0;var _0x328c11=_0x3e24[_0xecf14c];return _0x328c11;};'use strict';var multer=require(_0x43e2('0x0'));var util=require(_0x43e2('0x1'));var path=require(_0x43e2('0x2'));var timeout=require('connect-timeout');var express=require(_0x43e2('0x3'));var router=express[_0x43e2('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x43e2('0x5'));module[_0x43e2('0x6')]=router; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index 7db9a8f..cc3ad9a 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 _0xd8b0=['exports','sequelize'];(function(_0x325673,_0x13c10b){var _0x741c5b=function(_0x33eeb2){while(--_0x33eeb2){_0x325673['push'](_0x325673['shift']());}};_0x741c5b(++_0x13c10b);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xbaf0=['exports','INTEGER'];(function(_0x3be7ff,_0x12e714){var _0x186721=function(_0x2bc9e1){while(--_0x2bc9e1){_0x3be7ff['push'](_0x3be7ff['shift']());}};_0x186721(++_0x12e714);}(_0xbaf0,0x12a));var _0x0baf=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xbaf0[_0x1facfa];return _0x9ec701;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js index 046ef4d..bb3192d 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 _0xdbad=['user_has_openchannel_queues','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','./userOpenchannelQueue.attributes','exports','define','UserOpenchannelQueue'];(function(_0x2171b0,_0x5c47a2){var _0x5f4031=function(_0x87f628){while(--_0x87f628){_0x2171b0['push'](_0x2171b0['shift']());}};_0x5f4031(++_0x5c47a2);}(_0xdbad,0xf1));var _0xddba=function(_0x20f382,_0x573c9e){_0x20f382=_0x20f382-0x0;var _0x3f45d2=_0xdbad[_0x20f382];return _0x3f45d2;};'use strict';var _=require(_0xddba('0x0'));var util=require('util');var logger=require(_0xddba('0x1'))(_0xddba('0x2'));var moment=require('moment');var BPromise=require(_0xddba('0x3'));var rp=require(_0xddba('0x4'));var fs=require('fs');var path=require(_0xddba('0x5'));var rimraf=require(_0xddba('0x6'));var config=require('../../config/environment');var attributes=require(_0xddba('0x7'));module[_0xddba('0x8')]=function(_0x1ea9ef,_0x7503c3){return _0x1ea9ef[_0xddba('0x9')](_0xddba('0xa'),attributes,{'tableName':_0xddba('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9fde=['exports','define','UserOpenchannelQueue','user_has_openchannel_queues','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./userOpenchannelQueue.attributes'];(function(_0x544eea,_0x806e95){var _0x48be7a=function(_0x410916){while(--_0x410916){_0x544eea['push'](_0x544eea['shift']());}};_0x48be7a(++_0x806e95);}(_0x9fde,0x1b1));var _0xe9fd=function(_0x588011,_0x5e9d11){_0x588011=_0x588011-0x0;var _0x3b3773=_0x9fde[_0x588011];return _0x3b3773;};'use strict';var _=require(_0xe9fd('0x0'));var util=require('util');var logger=require(_0xe9fd('0x1'))(_0xe9fd('0x2'));var moment=require(_0xe9fd('0x3'));var BPromise=require(_0xe9fd('0x4'));var rp=require(_0xe9fd('0x5'));var fs=require('fs');var path=require(_0xe9fd('0x6'));var rimraf=require(_0xe9fd('0x7'));var config=require('../../config/environment');var attributes=require(_0xe9fd('0x8'));module[_0xe9fd('0x9')]=function(_0x202ec3,_0x384dec){return _0x202ec3[_0xe9fd('0xa')](_0xe9fd('0xb'),attributes,{'tableName':_0xe9fd('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js index 8095a63..05f9768 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 _0x5675=['http','request','then','info','UserOpenchannelQueue,\x20%s,\x20%s','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client'];(function(_0x59237a,_0x4a3a15){var _0x5148ae=function(_0x254407){while(--_0x254407){_0x59237a['push'](_0x59237a['shift']());}};_0x5148ae(++_0x4a3a15);}(_0x5675,0xae));var _0x5567=function(_0x58afd5,_0x534a48){_0x58afd5=_0x58afd5-0x0;var _0x3e503b=_0x5675[_0x58afd5];return _0x3e503b;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5567('0x0'));var db=require(_0x5567('0x1'))['db'];var utils=require(_0x5567('0x2'));var logger=require('../../config/logger')(_0x5567('0x3'));var config=require(_0x5567('0x4'));var jayson=require('jayson/promise');var client=jayson[_0x5567('0x5')][_0x5567('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x32fe4f,_0x5fad55,_0x184c46){return new BPromise(function(_0x47481e,_0x5bfe9c){return client[_0x5567('0x7')](_0x32fe4f,_0x184c46)[_0x5567('0x8')](function(_0x2b22bd){logger[_0x5567('0x9')](_0x5567('0xa'),_0x5fad55,'request\x20sent');logger['debug'](_0x5567('0xb'),_0x5fad55,_0x5567('0xc'),JSON['stringify'](_0x2b22bd));if(_0x2b22bd[_0x5567('0xd')]){if(_0x2b22bd[_0x5567('0xd')][_0x5567('0xe')]===0x1f4){logger[_0x5567('0xd')](_0x5567('0xa'),_0x5fad55,_0x2b22bd['error'][_0x5567('0xf')]);return _0x5bfe9c(_0x2b22bd[_0x5567('0xd')][_0x5567('0xf')]);}logger[_0x5567('0xd')](_0x5567('0xa'),_0x5fad55,_0x2b22bd['error']['message']);return _0x47481e(_0x2b22bd['error'][_0x5567('0xf')]);}else{logger[_0x5567('0x9')](_0x5567('0xa'),_0x5fad55,'request\x20sent');_0x47481e(_0x2b22bd[_0x5567('0x10')][_0x5567('0xf')]);}})[_0x5567('0x11')](function(_0x16127d){logger[_0x5567('0xd')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x5fad55,_0x16127d);_0x5bfe9c(_0x16127d);});});} \ No newline at end of file +var _0x4395=['lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4395,0x108));var _0x5439=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4395[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x5439('0x0'));var util=require(_0x5439('0x1'));var moment=require(_0x5439('0x2'));var BPromise=require(_0x5439('0x3'));var rs=require(_0x5439('0x4'));var fs=require('fs');var Redis=require(_0x5439('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x5439('0x6'));var logger=require(_0x5439('0x7'))(_0x5439('0x8'));var config=require(_0x5439('0x9'));var jayson=require(_0x5439('0xa'));var client=jayson[_0x5439('0xb')][_0x5439('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5cf9eb,_0x3d0401,_0x3c519f){return new BPromise(function(_0x3063e1,_0x36840f){return client['request'](_0x5cf9eb,_0x3c519f)[_0x5439('0xd')](function(_0x7dabac){logger[_0x5439('0xe')](_0x5439('0xf'),_0x3d0401,_0x5439('0x10'));logger[_0x5439('0x11')](_0x5439('0x12'),_0x3d0401,'request\x20sent',JSON[_0x5439('0x13')](_0x7dabac));if(_0x7dabac[_0x5439('0x14')]){if(_0x7dabac[_0x5439('0x14')][_0x5439('0x15')]===0x1f4){logger[_0x5439('0x14')](_0x5439('0xf'),_0x3d0401,_0x7dabac[_0x5439('0x14')][_0x5439('0x16')]);return _0x36840f(_0x7dabac['error']['message']);}logger['error'](_0x5439('0xf'),_0x3d0401,_0x7dabac[_0x5439('0x14')]['message']);return _0x3063e1(_0x7dabac[_0x5439('0x14')][_0x5439('0x16')]);}else{logger[_0x5439('0xe')](_0x5439('0xf'),_0x3d0401,_0x5439('0x10'));_0x3063e1(_0x7dabac['result']['message']);}})[_0x5439('0x17')](function(_0x55f6af){logger[_0x5439('0x14')](_0x5439('0xf'),_0x3d0401,_0x55f6af);_0x36840f(_0x55f6af);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 13ac6e9..2022d63 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 _0xe05d=['exports','multer','connect-timeout','express','Router','../../components/auth/service','get','isAuthenticated','/describe','describe','/:id','show','/:id/sections','/:id/resources','getResources','post','create','/:id/clone','clone','addSections','update','delete','removeSections','removeResources'];(function(_0x1e14df,_0x4a9c80){var _0x3a32ca=function(_0x2d2d71){while(--_0x2d2d71){_0x1e14df['push'](_0x1e14df['shift']());}};_0x3a32ca(++_0x4a9c80);}(_0xe05d,0xf1));var _0xde05=function(_0x3b6780,_0xa8fbe4){_0x3b6780=_0x3b6780-0x0;var _0x4fe37b=_0xe05d[_0x3b6780];return _0x4fe37b;};'use strict';var multer=require(_0xde05('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xde05('0x1'));var express=require(_0xde05('0x2'));var router=express[_0xde05('0x3')]();var auth=require(_0xde05('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./userProfile.controller');router[_0xde05('0x5')]('/',auth[_0xde05('0x6')](),controller['index']);router[_0xde05('0x5')](_0xde05('0x7'),auth[_0xde05('0x6')](),controller[_0xde05('0x8')]);router[_0xde05('0x5')](_0xde05('0x9'),auth[_0xde05('0x6')](),controller[_0xde05('0xa')]);router[_0xde05('0x5')](_0xde05('0xb'),auth[_0xde05('0x6')](),controller['getSections']);router[_0xde05('0x5')](_0xde05('0xc'),auth[_0xde05('0x6')](),controller[_0xde05('0xd')]);router[_0xde05('0xe')]('/',auth['isAuthenticated'](),controller[_0xde05('0xf')]);router[_0xde05('0xe')](_0xde05('0x10'),auth[_0xde05('0x6')](),controller[_0xde05('0x11')]);router[_0xde05('0xe')]('/:id/sections',auth[_0xde05('0x6')](),controller[_0xde05('0x12')]);router[_0xde05('0xe')](_0xde05('0xc'),auth[_0xde05('0x6')](),controller['addResources']);router['put'](_0xde05('0x9'),auth[_0xde05('0x6')](),controller[_0xde05('0x13')]);router[_0xde05('0x14')](_0xde05('0x9'),auth['isAuthenticated'](),controller['destroy']);router['delete'](_0xde05('0xb'),auth[_0xde05('0x6')](),controller[_0xde05('0x15')]);router['delete']('/:id/resources',auth[_0xde05('0x6')](),controller[_0xde05('0x16')]);module[_0xde05('0x17')]=router; \ No newline at end of file +var _0x9c5a=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','/:id/sections','getSections','/:id/resources','getResources','post','/:id/clone','addSections','addResources','put','update','delete','destroy','removeResources'];(function(_0x20a4dc,_0x2bd7c7){var _0x49000f=function(_0x2246e7){while(--_0x2246e7){_0x20a4dc['push'](_0x20a4dc['shift']());}};_0x49000f(++_0x2bd7c7);}(_0x9c5a,0x1c0));var _0xa9c5=function(_0x49d33c,_0xe56eda){_0x49d33c=_0x49d33c-0x0;var _0x5a0227=_0x9c5a[_0x49d33c];return _0x5a0227;};'use strict';var multer=require(_0xa9c5('0x0'));var util=require(_0xa9c5('0x1'));var path=require(_0xa9c5('0x2'));var timeout=require(_0xa9c5('0x3'));var express=require(_0xa9c5('0x4'));var router=express[_0xa9c5('0x5')]();var auth=require(_0xa9c5('0x6'));var interaction=require(_0xa9c5('0x7'));var config=require(_0xa9c5('0x8'));var controller=require('./userProfile.controller');router[_0xa9c5('0x9')]('/',auth[_0xa9c5('0xa')](),controller[_0xa9c5('0xb')]);router[_0xa9c5('0x9')](_0xa9c5('0xc'),auth[_0xa9c5('0xa')](),controller[_0xa9c5('0xd')]);router['get'](_0xa9c5('0xe'),auth['isAuthenticated'](),controller['show']);router[_0xa9c5('0x9')](_0xa9c5('0xf'),auth[_0xa9c5('0xa')](),controller[_0xa9c5('0x10')]);router[_0xa9c5('0x9')](_0xa9c5('0x11'),auth[_0xa9c5('0xa')](),controller[_0xa9c5('0x12')]);router[_0xa9c5('0x13')]('/',auth[_0xa9c5('0xa')](),controller['create']);router[_0xa9c5('0x13')](_0xa9c5('0x14'),auth[_0xa9c5('0xa')](),controller['clone']);router[_0xa9c5('0x13')](_0xa9c5('0xf'),auth[_0xa9c5('0xa')](),controller[_0xa9c5('0x15')]);router[_0xa9c5('0x13')](_0xa9c5('0x11'),auth['isAuthenticated'](),controller[_0xa9c5('0x16')]);router[_0xa9c5('0x17')](_0xa9c5('0xe'),auth['isAuthenticated'](),controller[_0xa9c5('0x18')]);router[_0xa9c5('0x19')](_0xa9c5('0xe'),auth[_0xa9c5('0xa')](),controller[_0xa9c5('0x1a')]);router[_0xa9c5('0x19')](_0xa9c5('0xf'),auth['isAuthenticated'](),controller['removeSections']);router['delete'](_0xa9c5('0x11'),auth[_0xa9c5('0xa')](),controller[_0xa9c5('0x1b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index 071a662..b986980 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 _0x412a=['STRING','name','setDataValue','crudPermissions','join','sequelize','exports'];(function(_0x248706,_0x5bc444){var _0x42191b=function(_0x302fd6){while(--_0x302fd6){_0x248706['push'](_0x248706['shift']());}};_0x42191b(++_0x5bc444);}(_0x412a,0x17f));var _0xa412=function(_0x28857,_0x59c671){_0x28857=_0x28857-0x0;var _0x1c98b8=_0x412a[_0x28857];return _0x1c98b8;};'use strict';var Sequelize=require(_0xa412('0x0'));module[_0xa412('0x1')]={'name':{'type':Sequelize[_0xa412('0x2')],'allowNull':![],'unique':_0xa412('0x3')},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x16593b){this[_0xa412('0x4')](_0xa412('0x5'),_0x16593b?_0x16593b[_0xa412('0x6')](''):[]);},'get':function(){return this['getDataValue'](_0xa412('0x5'))?this['getDataValue']('crudPermissions')['split'](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file +var _0x9744=['crudPermissions','join','getDataValue','split','sequelize','exports','name','STRING','setDataValue'];(function(_0x5480bb,_0xcbd373){var _0x240d4e=function(_0x55d36b){while(--_0x55d36b){_0x5480bb['push'](_0x5480bb['shift']());}};_0x240d4e(++_0xcbd373);}(_0x9744,0x1ea));var _0x4974=function(_0x455d49,_0x2498c2){_0x455d49=_0x455d49-0x0;var _0x49424d=_0x9744[_0x455d49];return _0x49424d;};'use strict';var Sequelize=require(_0x4974('0x0'));module[_0x4974('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x4974('0x2')},'crudPermissions':{'type':Sequelize[_0x4974('0x3')],'set':function(_0x1d193e){this[_0x4974('0x4')](_0x4974('0x5'),_0x1d193e?_0x1d193e[_0x4974('0x6')](''):[]);},'get':function(){return this[_0x4974('0x7')](_0x4974('0x5'))?this[_0x4974('0x7')](_0x4974('0x5'))[_0x4974('0x8')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x4974('0x3')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index 391ac86..0caec20 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 _0xae07=['QueueCampaigns','users','telephones','Users','admin','user','zendeskaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','zohoaccounts','ZohoAccount','cannedanswers','CannedAnswer','dispositions','Disposition','customdashboards','intervals','Interval','pauses','Pause','scheduler','Schedule','sounds','Sound','tags','templates','Template','triggers','trunks','Trunk','variables','plugins','extractedreports','Reports','metrics','AnalyticMetric','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','UserProfile','fieldName','type','key','query','keys','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','findAll','rows','params','rawAttributes','intersection','find','catch','body','clone','get','createdAt','updatedAt','crudPermissions','sequelize','transaction','includeAll','UserProfileSection','each','autoAssociation','UserProfileResource','omit','sectionId','userProfileId','create','Resources','describe','removeSections','ids','includes','isEmpty','subsections','enabled','findOne','Dashboard','forEach','push','resourceId','Plugin','addResources','bulkCreate','removeResources','getResources','section','undefined','Sequelize','ValidationError','Unknown\x20section','mergeResources','Invalid\x20section\x20\x27','parentSections','all','ignore','union','childModel','field','AnalyticExtractedReport','foreignKey','associatedResources','reportType','default','reportId','Tag','Tags','color','ThroughTags','tag','value','toLowerCase','squareprojects','SquareProject','odbc','SquareOdbc','squarerecordings','SquareRecording','projectName','projects','JscriptyProject','contacts','ListId','lists','CmList','companies','globalcustomfields','CmCustomField','ChatWebsite','faxqueues','FaxQueue','faxaccounts','FaxAccount','inboundroutes','internalroutes','outboundroutes','contexts','VoiceContext','VoiceMail','voicerecordings','VoiceRecording','Agents','membername','role','agent','Telephones','User','telephone','VoiceQueues','queue','VoiceQueue','inbound','outbound','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','Campaign','mailqueues','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','SmsQueue','SmsAccount','voicequeues','queuecampaigns'];(function(_0x494848,_0x5a2d8f){var _0x1a3fe6=function(_0x3365e1){while(--_0x3365e1){_0x494848['push'](_0x494848['shift']());}};_0x1a3fe6(++_0x5a2d8f);}(_0xae07,0x11b));var _0x7ae0=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0xae07[_0x13ea00];return _0x1f7347;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x7ae0('0x0'));var rimraf=require(_0x7ae0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7ae0('0x2'));var rp=require(_0x7ae0('0x3'));var moment=require(_0x7ae0('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x7ae0('0x5'));var util=require(_0x7ae0('0x6'));var path=require(_0x7ae0('0x7'));var sox=require(_0x7ae0('0x8'));var csv=require(_0x7ae0('0x9'));var ejs=require(_0x7ae0('0xa'));var fs=require('fs');var _=require(_0x7ae0('0xb'));var squel=require('squel');var crypto=require(_0x7ae0('0xc'));var jsforce=require(_0x7ae0('0xd'));var deskjs=require(_0x7ae0('0xe'));var toCsv=require(_0x7ae0('0x9'));var querystring=require(_0x7ae0('0xf'));var Papa=require('papaparse');var Redis=require(_0x7ae0('0x10'));var authService=require(_0x7ae0('0x11'));var qs=require(_0x7ae0('0x12'));var as=require(_0x7ae0('0x13'));var hardwareService=require(_0x7ae0('0x14'));var logger=require(_0x7ae0('0x15'))('api');var utils=require(_0x7ae0('0x16'));var config=require('../../config/environment');var db=require(_0x7ae0('0x17'))['db'];config[_0x7ae0('0x18')]=_[_0x7ae0('0x19')](config['redis'],{'host':_0x7ae0('0x1a'),'port':0x18eb});var socket=require(_0x7ae0('0x1b'))(new Redis(config[_0x7ae0('0x18')]));require(_0x7ae0('0x1c'))[_0x7ae0('0x1d')](socket);function respondWithStatusCode(_0x399968,_0x3f7509){_0x3f7509=_0x3f7509||0xcc;return function(_0x543ab7){if(_0x543ab7){return _0x399968[_0x7ae0('0x1e')](_0x3f7509);}return _0x399968[_0x7ae0('0x1f')](_0x3f7509)[_0x7ae0('0x20')]();};}function respondWithResult(_0x42a85e,_0xd62cc4){_0xd62cc4=_0xd62cc4||0xc8;return function(_0x1cdfbd){if(_0x1cdfbd){return _0x42a85e[_0x7ae0('0x1f')](_0xd62cc4)[_0x7ae0('0x21')](_0x1cdfbd);}};}function respondWithFilteredResult(_0x4fc4a7,_0x5b029c){return function(_0x49f1e9){if(_0x49f1e9){var _0x59f3af=_0x49f1e9[_0x7ae0('0x22')],_0x44b9cc=_0x5b029c[_0x7ae0('0x23')],_0x1ad4ba=_0x5b029c[_0x7ae0('0x23')]+_0x5b029c[_0x7ae0('0x24')],_0x47dc77;if(_0x1ad4ba>=_0x59f3af){_0x1ad4ba=_0x59f3af;_0x47dc77=0xc8;}else{_0x47dc77=0xce;}_0x4fc4a7[_0x7ae0('0x1f')](_0x47dc77);return _0x4fc4a7[_0x7ae0('0x25')](_0x7ae0('0x26'),_0x44b9cc+'-'+_0x1ad4ba+'/'+_0x59f3af)[_0x7ae0('0x21')](_0x49f1e9);}return null;};}function patchUpdates(_0x6e87ef){return function(_0x1bf49b){try{jsonpatch[_0x7ae0('0x27')](_0x1bf49b,_0x6e87ef,!![]);}catch(_0x566ca2){return BPromise[_0x7ae0('0x28')](_0x566ca2);}return _0x1bf49b[_0x7ae0('0x29')]();};}function saveUpdates(_0x54d306,_0x4b13b9){return function(_0x931cbc){if(_0x931cbc){return _0x931cbc[_0x7ae0('0x2a')](_0x54d306)[_0x7ae0('0x2b')](function(_0x240337){return _0x240337;});}return null;};}function removeEntity(_0x255ace,_0x2a39a2){return function(_0x320ddd){if(_0x320ddd){return _0x320ddd[_0x7ae0('0x2c')]()[_0x7ae0('0x2b')](function(){_0x255ace[_0x7ae0('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5797ac,_0x6e43bf){return function(_0x599e95){if(!_0x599e95){_0x5797ac[_0x7ae0('0x1e')](0x194);}return _0x599e95;};}function handleError(_0x934eac,_0x4de1e5){_0x4de1e5=_0x4de1e5||0x1f4;return function(_0x2a433f){logger[_0x7ae0('0x2d')](_0x2a433f['stack']);if(_0x2a433f[_0x7ae0('0x2e')]){delete _0x2a433f[_0x7ae0('0x2e')];}_0x934eac['status'](_0x4de1e5)[_0x7ae0('0x2f')](_0x2a433f);};}exports[_0x7ae0('0x30')]=function(_0x44f87a,_0x180c36){var _0xae1c6d={},_0x74a977={},_0x4ead9d={'count':0x0,'rows':[]};var _0x379870=_[_0x7ae0('0x31')](db[_0x7ae0('0x32')]['rawAttributes'],function(_0x723e1d){return{'name':_0x723e1d[_0x7ae0('0x33')],'type':_0x723e1d[_0x7ae0('0x34')][_0x7ae0('0x35')]};});_0x74a977['model']=_[_0x7ae0('0x31')](_0x379870,_0x7ae0('0x2e'));_0x74a977[_0x7ae0('0x36')]=_[_0x7ae0('0x37')](_0x44f87a[_0x7ae0('0x36')]);_0x74a977['filters']=_['intersection'](_0x74a977[_0x7ae0('0x38')],_0x74a977['query']);_0xae1c6d[_0x7ae0('0x39')]=_['intersection'](_0x74a977[_0x7ae0('0x38')],qs[_0x7ae0('0x3a')](_0x44f87a['query'][_0x7ae0('0x3a')]));_0xae1c6d[_0x7ae0('0x39')]=_0xae1c6d['attributes'][_0x7ae0('0x3b')]?_0xae1c6d['attributes']:_0x74a977[_0x7ae0('0x38')];if(!_0x44f87a[_0x7ae0('0x36')][_0x7ae0('0x3c')](_0x7ae0('0x3d'))){_0xae1c6d['limit']=qs[_0x7ae0('0x24')](_0x44f87a['query']['limit']);_0xae1c6d['offset']=qs[_0x7ae0('0x23')](_0x44f87a[_0x7ae0('0x36')][_0x7ae0('0x23')]);}_0xae1c6d[_0x7ae0('0x3e')]=qs[_0x7ae0('0x3f')](_0x44f87a['query']['sort']);_0xae1c6d[_0x7ae0('0x40')]=qs[_0x7ae0('0x41')](_[_0x7ae0('0x42')](_0x44f87a[_0x7ae0('0x36')],_0x74a977[_0x7ae0('0x41')]));if(_0x44f87a[_0x7ae0('0x36')][_0x7ae0('0x43')]){_0xae1c6d[_0x7ae0('0x40')]=_[_0x7ae0('0x44')](_0xae1c6d[_0x7ae0('0x40')],{'$or':_[_0x7ae0('0x31')](_0x379870,function(_0x2081a2){if(_0x2081a2[_0x7ae0('0x34')]!==_0x7ae0('0x45')){var _0x4f43b0={};_0x4f43b0[_0x2081a2[_0x7ae0('0x2e')]]={'$like':'%'+_0x44f87a['query']['filter']+'%'};return _0x4f43b0;}})});}_0xae1c6d=_['merge']({},_0xae1c6d,_0x44f87a[_0x7ae0('0x46')]);var _0x458467={'where':_0xae1c6d['where']};return db[_0x7ae0('0x32')][_0x7ae0('0x22')](_0x458467)[_0x7ae0('0x2b')](function(_0x2e51bd){_0x4ead9d[_0x7ae0('0x22')]=_0x2e51bd;if(_0x44f87a['query']['includeAll']){_0xae1c6d[_0x7ae0('0x47')]=[{'all':!![]}];}return db['UserProfile'][_0x7ae0('0x48')](_0xae1c6d);})[_0x7ae0('0x2b')](function(_0x24399f){_0x4ead9d[_0x7ae0('0x49')]=_0x24399f;return _0x4ead9d;})[_0x7ae0('0x2b')](respondWithFilteredResult(_0x180c36,_0xae1c6d))['catch'](handleError(_0x180c36,null));};exports['show']=function(_0x5bda28,_0x489499){var _0x3d67be={'raw':![],'where':{'id':_0x5bda28[_0x7ae0('0x4a')]['id']}},_0x35e29d={};_0x35e29d[_0x7ae0('0x38')]=_[_0x7ae0('0x37')](db[_0x7ae0('0x32')][_0x7ae0('0x4b')]);_0x35e29d[_0x7ae0('0x36')]=_[_0x7ae0('0x37')](_0x5bda28['query']);_0x35e29d['filters']=_[_0x7ae0('0x4c')](_0x35e29d[_0x7ae0('0x38')],_0x35e29d['query']);_0x3d67be[_0x7ae0('0x39')]=_[_0x7ae0('0x4c')](_0x35e29d['model'],qs[_0x7ae0('0x3a')](_0x5bda28[_0x7ae0('0x36')]['fields']));_0x3d67be[_0x7ae0('0x39')]=_0x3d67be[_0x7ae0('0x39')][_0x7ae0('0x3b')]?_0x3d67be[_0x7ae0('0x39')]:_0x35e29d['model'];if(_0x5bda28['query']['includeAll']){_0x3d67be[_0x7ae0('0x47')]=[{'all':!![]}];}_0x3d67be=_[_0x7ae0('0x44')]({},_0x3d67be,_0x5bda28[_0x7ae0('0x46')]);return db[_0x7ae0('0x32')][_0x7ae0('0x4d')](_0x3d67be)[_0x7ae0('0x2b')](handleEntityNotFound(_0x489499,null))[_0x7ae0('0x2b')](respondWithResult(_0x489499,null))[_0x7ae0('0x4e')](handleError(_0x489499,null));};exports['create']=function(_0x575208,_0x4e00cc){return db[_0x7ae0('0x32')]['create'](_0x575208[_0x7ae0('0x4f')],{})[_0x7ae0('0x2b')](respondWithResult(_0x4e00cc,0xc9))[_0x7ae0('0x4e')](handleError(_0x4e00cc,null));};exports[_0x7ae0('0x50')]=function(_0x4c92af,_0x7dc8cf){var _0x242deb={'where':{'id':_0x4c92af[_0x7ae0('0x4a')]['id']}},_0x3adf95={};_0x3adf95[_0x7ae0('0x38')]=_[_0x7ae0('0x37')](db[_0x7ae0('0x32')][_0x7ae0('0x4b')]);_0x242deb[_0x7ae0('0x39')]=_[_0x7ae0('0x4c')](_0x3adf95[_0x7ae0('0x38')],qs['fields'](_0x4c92af['query'][_0x7ae0('0x3a')]));_0x242deb[_0x7ae0('0x39')]=_0x242deb[_0x7ae0('0x39')][_0x7ae0('0x3b')]?_0x242deb[_0x7ae0('0x39')]:_0x3adf95[_0x7ae0('0x38')];if(_0x4c92af[_0x7ae0('0x36')]['includeAll']){_0x242deb[_0x7ae0('0x47')]=[{'all':!![]}];}_0x242deb=_[_0x7ae0('0x44')]({},_0x242deb,_0x4c92af['options']);return db[_0x7ae0('0x32')][_0x7ae0('0x4d')](_0x242deb)[_0x7ae0('0x2b')](handleEntityNotFound(_0x7dc8cf,null))['then'](function(_0x35c1){if(_0x35c1){var _0x5f5d4b=_0x35c1[_0x7ae0('0x51')]({'plain':!![]});_0x5f5d4b=qs['omit'](_0x5f5d4b,['id',_0x7ae0('0x52'),_0x7ae0('0x53'),_0x7ae0('0x54')]);_0x4c92af[_0x7ae0('0x4f')]=_['omit'](_0x4c92af[_0x7ae0('0x4f')],['id','createdAt','updatedAt']);return db[_0x7ae0('0x55')][_0x7ae0('0x56')](function(_0x4fc655){return db[_0x7ae0('0x32')]['create'](_[_0x7ae0('0x44')](_0x5f5d4b,_0x4c92af[_0x7ae0('0x4f')]),{'include':_0x4c92af[_0x7ae0('0x36')][_0x7ae0('0x57')]?[{'all':!![]}]:undefined,'transaction':_0x4fc655})[_0x7ae0('0x2b')](function(_0x14d2a2){var _0xf67049=_0x14d2a2[_0x7ae0('0x51')]({'plain':!![]});return db[_0x7ae0('0x58')][_0x7ae0('0x48')]({'where':{'userProfileId':_0x4c92af[_0x7ae0('0x4a')]['id']},'raw':!![]})[_0x7ae0('0x2b')](function(_0x472e32){if(_0x472e32){return BPromise[_0x7ae0('0x59')](_0x472e32,function(_0x101094){return new BPromise(function(_0x44d2a2,_0x17d600){if(_0x101094[_0x7ae0('0x5a')]===null||_0x101094[_0x7ae0('0x5a')]===0x1)_0x44d2a2(null);return db[_0x7ae0('0x5b')][_0x7ae0('0x48')]({'where':{'sectionId':_0x101094['id']},'raw':!![]})[_0x7ae0('0x2b')](function(_0x33bc8f){var _0x4db79d=_[_0x7ae0('0x31')](_0x33bc8f,function(_0xbb0480){return qs[_0x7ae0('0x5c')](_0xbb0480,['id',_0x7ae0('0x52'),'updatedAt',_0x7ae0('0x5d')]);});_0x44d2a2(_0x4db79d);})[_0x7ae0('0x4e')](function(_0x38c409){_0x17d600(_0x38c409);});})['then'](function(_0x46cb47){var _0x495e95=qs['omit'](_0x101094,['id',_0x7ae0('0x52'),'updatedAt']);_0x495e95[_0x7ae0('0x5e')]=_0xf67049['id'];if(_0x46cb47)_0x495e95['Resources']=_0x46cb47;return _0x495e95;})[_0x7ae0('0x2b')](function(_0x21b86d){return db[_0x7ae0('0x58')][_0x7ae0('0x5f')](_0x21b86d,{'include':[{'model':db['UserProfileResource'],'as':_0x7ae0('0x60')}],'raw':!![],'transaction':_0x4fc655});});})[_0x7ae0('0x2b')](function(){return _0xf67049;});}});});});}})[_0x7ae0('0x2b')](respondWithResult(_0x7dc8cf,0xc9))[_0x7ae0('0x4e')](handleError(_0x7dc8cf,null));};exports['update']=function(_0x5495a6,_0xfcc4f2){if(_0x5495a6[_0x7ae0('0x4f')]['id']){delete _0x5495a6[_0x7ae0('0x4f')]['id'];}return db[_0x7ae0('0x32')][_0x7ae0('0x4d')]({'where':{'id':_0x5495a6[_0x7ae0('0x4a')]['id']}})[_0x7ae0('0x2b')](handleEntityNotFound(_0xfcc4f2,null))[_0x7ae0('0x2b')](saveUpdates(_0x5495a6[_0x7ae0('0x4f')],null))[_0x7ae0('0x2b')](respondWithResult(_0xfcc4f2,null))['catch'](handleError(_0xfcc4f2,null));};exports[_0x7ae0('0x2c')]=function(_0x11db0c,_0x1144e6){return db[_0x7ae0('0x32')]['find']({'where':{'id':_0x11db0c[_0x7ae0('0x4a')]['id']}})[_0x7ae0('0x2b')](handleEntityNotFound(_0x1144e6,null))[_0x7ae0('0x2b')](removeEntity(_0x1144e6,null))[_0x7ae0('0x4e')](handleError(_0x1144e6,null));};exports[_0x7ae0('0x61')]=function(_0x51eff4,_0x41f8dd){return db[_0x7ae0('0x32')][_0x7ae0('0x61')]()[_0x7ae0('0x2b')](respondWithResult(_0x41f8dd,null))[_0x7ae0('0x4e')](handleError(_0x41f8dd,null));};exports['addSections']=function(_0x5274d0,_0x5aa0d8){var _0xbd7dd0=_0x5274d0['body'];return db[_0x7ae0('0x32')][_0x7ae0('0x4d')]({'where':{'id':_0x5274d0[_0x7ae0('0x4a')]['id']}})[_0x7ae0('0x2b')](handleEntityNotFound(_0x5aa0d8,null))['then'](function(_0x2be4bf){if(_0x2be4bf){return db[_0x7ae0('0x55')][_0x7ae0('0x56')](function(_0x45202f){return db[_0x7ae0('0x58')][_0x7ae0('0x2c')]({'where':{'userProfileId':_0x5274d0['params']['id'],'sectionId':_[_0x7ae0('0x31')](_0xbd7dd0,function(_0x2dd48b){return _0x2dd48b['sectionId'];})},'transaction':_0x45202f})['then'](function(){var _0x4d2332=_['map'](_0xbd7dd0,function(_0x59bc61){_0x59bc61[_0x7ae0('0x5e')]=_0x5274d0[_0x7ae0('0x4a')]['id'];return _0x59bc61;});var _0x1f54da=[];return BPromise[_0x7ae0('0x59')](_0x4d2332,function(_0x49ea7e){return db['UserProfileSection']['create'](_0x49ea7e,{'include':[{'model':db['UserProfileResource'],'as':'Resources'}],'raw':!![],'transaction':_0x45202f})['then'](function(_0x175241){_0x1f54da['push'](_0x175241[_0x7ae0('0x51')]({'plain':!![]}));});})[_0x7ae0('0x2b')](function(){return _0x1f54da;});});});}})[_0x7ae0('0x2b')](function(_0x54263d){return _0x54263d;})['then'](respondWithResult(_0x5aa0d8,null))['catch'](handleError(_0x5aa0d8,null));};exports[_0x7ae0('0x62')]=function(_0x15abdf,_0x190c6c){var _0x3f71ea;return db[_0x7ae0('0x32')][_0x7ae0('0x4d')]({'where':{'id':_0x15abdf['params']['id']},'attributes':['id',_0x7ae0('0x2e')]})[_0x7ae0('0x2b')](handleEntityNotFound(_0x190c6c,null))[_0x7ae0('0x2b')](function(_0x53582f){if(_0x53582f){_0x3f71ea=_0x53582f;return db['UserProfileSection'][_0x7ae0('0x2c')]({'where':{'userProfileId':_0x15abdf[_0x7ae0('0x4a')]['id'],'sectionId':_0x15abdf[_0x7ae0('0x36')][_0x7ae0('0x63')]}});}})[_0x7ae0('0x2b')](function(){return _0x3f71ea;})[_0x7ae0('0x2b')](respondWithStatusCode(_0x190c6c,null))[_0x7ae0('0x4e')](handleError(_0x190c6c,null));};exports['getSections']=function(_0x259c6a,_0x55108f){var _0x247703=[];var _0x364f92=[];return db[_0x7ae0('0x58')][_0x7ae0('0x48')]({'where':{'userProfileId':_0x259c6a[_0x7ae0('0x4a')]['id']},'raw':!![]})['then'](function(_0x9ab2f2){_0x247703=_[_0x7ae0('0x43')](_0x9ab2f2,function(_0x160418){return _0x160418['enabled']===0x1||_[_0x7ae0('0x64')]([0x3eb,0x709],_0x160418[_0x7ae0('0x5d')]);});if(!_[_0x7ae0('0x65')](_0x247703)){return _[_0x7ae0('0x31')](_0x247703,function(_0x4634cf){return _0x4634cf['sectionId'];});}else{return;}})['then'](function(_0x4b891b){if(_0x4b891b)_0x364f92=_0x4b891b;if(_['includes'](_0x364f92,0x64)){var _0x3a2621=_[_0x7ae0('0x4d')](_0x247703,{'sectionId':0x64});return hasDefaultDashboard(_0x3a2621)[_0x7ae0('0x2b')](function(_0x32d8d2){return _[_0x7ae0('0x31')](_0x247703,function(_0x58dd44){if(_0x58dd44[_0x7ae0('0x5d')]===0x64){_0x58dd44[_0x7ae0('0x66')]=_0x32d8d2;}return _0x58dd44;});});}else{return;}})[_0x7ae0('0x2b')](function(_0x321640){if(_0x321640)_0x247703=_0x321640;if(_[_0x7ae0('0x64')](_0x364f92,0x3eb)){var _0x5b99ec=_['find'](_0x247703,{'sectionId':0x3eb});return getCustomDashboards(_0x5b99ec)[_0x7ae0('0x2b')](function(_0x7c0159){return _[_0x7ae0('0x31')](_0x247703,function(_0xd11cfa){if(_0x5b99ec['enabled']){if(_0xd11cfa[_0x7ae0('0x5d')]===0x3eb){_0xd11cfa[_0x7ae0('0x66')]=_0x7c0159;}}else{if(_0xd11cfa[_0x7ae0('0x5d')]===0x64){_0xd11cfa[_0x7ae0('0x66')]=_0x7c0159;}}return _0xd11cfa;});});}else{return;}})[_0x7ae0('0x2b')](function(_0x338bcd){if(_0x338bcd)_0x247703=_0x338bcd;if(_[_0x7ae0('0x64')](_0x364f92,0x709)){var _0x437153=_['find'](_0x247703,{'sectionId':0x709});return getPlugins(_0x437153)[_0x7ae0('0x2b')](function(_0x254170){if(_0x437153['enabled']){return _[_0x7ae0('0x31')](_0x247703,function(_0x3fea38){if(_0x3fea38[_0x7ae0('0x5d')]===0x709){_0x3fea38['subsections']=_0x254170;}return _0x3fea38;});}else{var _0x597a58={'sectionId':0x76c,'enabled':0x1,'subsections':_0x254170};var _0x5418da=_['map'](_0x247703);_0x5418da['push'](_0x597a58);return _0x5418da;}});}else{return;}})[_0x7ae0('0x2b')](function(_0x552962){if(_0x552962)_0x247703=_0x552962;return _[_0x7ae0('0x43')](_0x247703,[_0x7ae0('0x67'),0x1]);})[_0x7ae0('0x2b')](respondWithResult(_0x55108f,null))[_0x7ae0('0x4e')](handleError(_0x55108f,null));};function hasDefaultDashboard(_0x61c398){var _0x3293a7=[0x65];return new BPromise(function(_0x1866e7,_0x28f77d){try{if(_0x61c398[_0x7ae0('0x5a')]){_0x1866e7(_0x3293a7);}else{return db[_0x7ae0('0x5b')][_0x7ae0('0x68')]({'where':{'sectionId':_0x61c398['id']},'raw':!![]})['then'](function(_0x5d4cca){_0x5d4cca?_0x1866e7(_0x3293a7):_0x1866e7();});}}catch(_0x3cef3e){_0x28f77d(_0x3cef3e);}});}function getCustomDashboards(_0x52dcf5){var _0x4a6f41=[];return new BPromise(function(_0x2b0039,_0x40a9fb){try{if(_0x52dcf5['autoAssociation']){return db[_0x7ae0('0x69')][_0x7ae0('0x48')]({'raw':!![]})['then'](function(_0x2c5b0f){_0x2c5b0f[_0x7ae0('0x6a')](function(_0x24c6eb){_0x4a6f41[_0x7ae0('0x6b')](_0x24c6eb['id']+0x1869f);});_0x2b0039(_0x4a6f41);});}else{return db[_0x7ae0('0x5b')][_0x7ae0('0x48')]({'where':{'sectionId':_0x52dcf5['id']},'raw':!![]})[_0x7ae0('0x2b')](function(_0x1312c0){_0x1312c0[_0x7ae0('0x6a')](function(_0xe88a5){_0x4a6f41['push'](_0xe88a5[_0x7ae0('0x6c')]+0x1869f);});_0x2b0039(_0x4a6f41);});}}catch(_0x5cb43f){_0x40a9fb(_0x5cb43f);}});}function getPlugins(_0x17e9e6){var _0x267cd1=[];return new BPromise(function(_0x1b0fda,_0x3dede4){try{if(_0x17e9e6[_0x7ae0('0x5a')]){return db[_0x7ae0('0x6d')][_0x7ae0('0x48')]({'raw':!![]})['then'](function(_0x28790f){_0x28790f['forEach'](function(_0x43dea6){_0x267cd1['push'](_0x43dea6['id']+0x15b38);});_0x1b0fda(_0x267cd1);});}else{return db[_0x7ae0('0x5b')]['findAll']({'where':{'sectionId':_0x17e9e6['id']},'raw':!![]})['then'](function(_0x27206d){_0x27206d[_0x7ae0('0x6a')](function(_0x20a965){_0x267cd1[_0x7ae0('0x6b')](_0x20a965[_0x7ae0('0x6c')]+0x15b38);});_0x1b0fda(_0x267cd1);});}}catch(_0x152242){_0x3dede4(_0x152242);}});}exports[_0x7ae0('0x6e')]=function(_0x54231e,_0x45c3a7){return db['UserProfile'][_0x7ae0('0x4d')]({'where':{'id':_0x54231e[_0x7ae0('0x4a')]['id']}})[_0x7ae0('0x2b')](handleEntityNotFound(_0x45c3a7,null))['then'](function(_0x37b64d){if(_0x37b64d){return db[_0x7ae0('0x55')][_0x7ae0('0x56')](function(_0x3b800b){return db[_0x7ae0('0x58')][_0x7ae0('0x48')]({'where':{'userProfileId':_0x54231e[_0x7ae0('0x4a')]['id']},'attributes':['id'],'raw':!![]})['then'](function(_0x43ac7d){if(_0x43ac7d){return db[_0x7ae0('0x58')]['destroy']({'where':{'userProfileId':_0x54231e[_0x7ae0('0x4a')]['id'],'id':_[_0x7ae0('0x31')](_0x43ac7d,function(_0x4e9c6e){return _0x4e9c6e['id'];})},'transaction':_0x3b800b});}})['then'](function(_0x84b9ee){var _0x18c686=_[_0x7ae0('0x31')](_0x54231e[_0x7ae0('0x4f')],function(_0xb5bbd5){_0xb5bbd5['userProfileId']=_0x54231e[_0x7ae0('0x4a')]['id'];return _0xb5bbd5;});return db[_0x7ae0('0x58')][_0x7ae0('0x6f')](_0x18c686,{'raw':!![],'transaction':_0x3b800b});})[_0x7ae0('0x2b')](function(_0x17fd52){var _0x532f9f=_[_0x7ae0('0x43')](_['map'](_0x17fd52,function(_0x55d49b){return _0x55d49b['get']({'plain':!![]});}),{'includeAll':![]});if(_0x532f9f){return db[_0x7ae0('0x58')]['findAll']({'where':{'userProfileId':_0x54231e[_0x7ae0('0x4a')]['id'],'sectionId':_[_0x7ae0('0x31')](_0x532f9f,function(_0x28b81c){return _0x28b81c[_0x7ae0('0x5d')];})},'attributes':['id',_0x7ae0('0x5d')],'raw':!![]})[_0x7ae0('0x2b')](function(_0x8b9a37){var _0x457e2e=_['map'](_0x54231e[_0x7ae0('0x4f')],function(_0x937c97){_0x937c97[_0x7ae0('0x5e')]=_0x54231e['params']['id'];return _0x937c97;});return db[_0x7ae0('0x5b')][_0x7ae0('0x6f')](_0x457e2e,{'raw':!![],'transaction':_0x3b800b});});}})[_0x7ae0('0x4e')](handleError(_0x45c3a7,null));});}})[_0x7ae0('0x2b')](function(_0x4b16f0){var _0x536e9f=_[_0x7ae0('0x31')](_0x4b16f0,function(_0x413415){return _0x413415[_0x7ae0('0x51')]({'plain':!![]});});})[_0x7ae0('0x2b')](respondWithResult(_0x45c3a7,null))[_0x7ae0('0x4e')](handleError(_0x45c3a7,null));};exports[_0x7ae0('0x70')]=function(_0x749aaa,_0x2a8015,_0x295fec){return db[_0x7ae0('0x32')]['find']({'where':{'id':_0x749aaa[_0x7ae0('0x4a')]['id']}})['then'](handleEntityNotFound(_0x2a8015,null))['then'](function(_0x4e19c1){if(_0x4e19c1){return _0x4e19c1[_0x7ae0('0x70')](_0x749aaa['query']['ids']);}})[_0x7ae0('0x2b')](respondWithStatusCode(_0x2a8015,null))[_0x7ae0('0x4e')](handleError(_0x2a8015,null));};exports[_0x7ae0('0x71')]=function(_0x1433f7,_0x582635){var _0x1877db={'raw':![],'where':{}};var _0x549238={};var _0x2b85a4={'count':0x0,'rows':[]};var _0x4cc350=_0x1433f7[_0x7ae0('0x36')][_0x7ae0('0x72')];if(typeof _0x4cc350===_0x7ae0('0x73')){throw new db[(_0x7ae0('0x74'))][(_0x7ae0('0x75'))](_0x7ae0('0x76'));}var _0x5e5df8=_0x1433f7[_0x7ae0('0x36')][_0x7ae0('0x77')]||![];var _0x1f3e5d=getQueryModels(_0x4cc350,_0x5e5df8);if(typeof _0x1f3e5d['childModel']===_0x7ae0('0x73')){throw new db['Sequelize']['ValidationError'](_0x7ae0('0x78')+_0x4cc350+'\x27');}var _0x1e05bd=[];if(!_[_0x7ae0('0x65')](_0x1f3e5d[_0x7ae0('0x79')])){_0x1e05bd=_0x1f3e5d[_0x7ae0('0x79')];}else{_0x1e05bd=[{'name':_0x4cc350}];}return db[_0x7ae0('0x32')]['findOne']({'where':{'id':_0x1433f7[_0x7ae0('0x4a')]['id']}})[_0x7ae0('0x2b')](handleEntityNotFound(_0x582635,null))['then'](function(_0x3d4eb0){if(_0x3d4eb0){var _0x1d2bc0=[];for(var _0x165075=0x0;_0x165075<_0x1e05bd['length'];_0x165075++){_0x1d2bc0[_0x7ae0('0x6b')](db[_0x7ae0('0x58')]['findOne']({'where':{'userProfileId':_0x3d4eb0['id'],'name':_0x1e05bd[_0x165075][_0x7ae0('0x2e')]},'raw':!![]}));}return BPromise[_0x7ae0('0x7a')](_0x1d2bc0);}})[_0x7ae0('0x2b')](function(_0x3f7673){var _0x40b3b1=_[_0x7ae0('0x43')](_0x3f7673,function(_0x4f70dd){return _0x4f70dd?_0x4f70dd:undefined;});var _0x4ed1be=_[_0x7ae0('0x43')](_0x1e05bd,[_0x7ae0('0x7b'),!![]]);var _0x12a5e8=_['isEmpty'](_0x40b3b1)&&_['isEmpty'](_0x4ed1be)?null:_[_0x7ae0('0x7c')](_0x4ed1be,_0x40b3b1);if(_0x12a5e8){var _0x36deef=[];for(var _0xb759fa=0x0;_0xb759fa<_0x12a5e8[_0x7ae0('0x3b')];_0xb759fa++){var _0x5b23b9=_['find'](_0x1e05bd,function(_0x3b59aa){return _0x12a5e8[_0xb759fa]?_0x3b59aa['name']===_0x12a5e8[_0xb759fa][_0x7ae0('0x2e')]:null;});if(_0x5b23b9){if(_0x12a5e8[_0xb759fa]['ignore']){_0x36deef[_0x7ae0('0x6b')](getAllResources(_0x1f3e5d[_0x7ae0('0x7d')],_0x12a5e8[_0xb759fa]));}else{if(!_0x12a5e8[_0xb759fa][_0x7ae0('0x5a')]){_0x36deef[_0x7ae0('0x6b')](getAllowedResources(_0x5b23b9,_0x12a5e8[_0xb759fa],_0x1f3e5d[_0x7ae0('0x7d')]));}else{if(_0x5b23b9[_0x7ae0('0x38')]){_0x36deef[_0x7ae0('0x6b')](getAllFilteredResources(_0x5b23b9,_0x12a5e8[_0xb759fa]));}}}}}return BPromise[_0x7ae0('0x7a')](_0x36deef);}else{return null;}})[_0x7ae0('0x2b')](function(_0x52c2b6){var _0x397c21=_0x52c2b6;var _0x134dc4=null;if(_0x397c21){_0x134dc4=_0x397c21['length']===0x1?_0x397c21[0x0]:null;}if(_0x134dc4||_0x397c21){var _0x2fceb2=db[_0x1f3e5d[_0x7ae0('0x7d')]][_0x7ae0('0x4b')];_0x549238[_0x7ae0('0x38')]=_[_0x7ae0('0x37')](_0x2fceb2);_0x549238[_0x7ae0('0x36')]=_[_0x7ae0('0x37')](_0x1433f7[_0x7ae0('0x36')]);_0x549238[_0x7ae0('0x41')]=_[_0x7ae0('0x4c')](_0x549238[_0x7ae0('0x38')],_0x549238[_0x7ae0('0x36')]);_0x1877db[_0x7ae0('0x39')]=_[_0x7ae0('0x4c')](_0x549238[_0x7ae0('0x38')],qs[_0x7ae0('0x3a')](_0x1433f7[_0x7ae0('0x36')][_0x7ae0('0x3a')]));_0x1877db['attributes']=_0x1877db[_0x7ae0('0x39')][_0x7ae0('0x3b')]?_0x1877db[_0x7ae0('0x39')]:_0x549238['model'];if(!_0x1433f7[_0x7ae0('0x36')][_0x7ae0('0x3c')]('nolimit')){_0x1877db[_0x7ae0('0x24')]=qs[_0x7ae0('0x24')](_0x1433f7['query'][_0x7ae0('0x24')]);_0x1877db[_0x7ae0('0x23')]=qs[_0x7ae0('0x23')](_0x1433f7[_0x7ae0('0x36')][_0x7ae0('0x23')]);}_0x1877db[_0x7ae0('0x3e')]=qs[_0x7ae0('0x3f')](_0x1433f7['query'][_0x7ae0('0x3f')]);_0x1877db['where']=qs[_0x7ae0('0x41')](_[_0x7ae0('0x42')](_0x1433f7[_0x7ae0('0x36')],_0x549238[_0x7ae0('0x41')]));if(_0x1433f7[_0x7ae0('0x36')][_0x7ae0('0x43')]){_0x1877db[_0x7ae0('0x40')]=_[_0x7ae0('0x44')](_0x1877db[_0x7ae0('0x40')],{'$or':_[_0x7ae0('0x31')](_0x2fceb2,function(_0x279d35){if(_0x279d35[_0x7ae0('0x34')][_0x7ae0('0x35')]!==_0x7ae0('0x45')){var _0x3f8f9c={};_0x3f8f9c[_0x279d35[_0x7ae0('0x7e')]]={'$like':'%'+_0x1433f7[_0x7ae0('0x36')]['filter']+'%'};return _0x3f8f9c;}})});}var _0x1210f4=[];if(_0x134dc4){var _0xe06397=_['find'](_0x1e05bd,[_0x7ae0('0x2e'),_0x134dc4[_0x7ae0('0x2e')]]);if(_0xe06397[_0x7ae0('0x7e')]){var _0x31223a={};if(_0x1f3e5d['childModel']===_0x7ae0('0x7f')){_0x31223a[_0xe06397[_0x7ae0('0x80')]]=_[_0x7ae0('0x31')](_0x134dc4[_0x7ae0('0x81')],'id');}else{_0x31223a[_0xe06397[_0x7ae0('0x80')]]=_0x134dc4['associatedResources'];}_0x1210f4[_0x7ae0('0x6b')](_0x31223a);}else{_0x1877db[_0x7ae0('0x40')]['id']=_0x134dc4['associatedResources'];}}else{for(var _0x32c77d=0x0;_0x32c77d<_0x397c21['length'];_0x32c77d++){var _0xe06397=_[_0x7ae0('0x4d')](_0x1e05bd,[_0x7ae0('0x2e'),_0x397c21[_0x32c77d][_0x7ae0('0x2e')]]);if(_0xe06397[_0x7ae0('0x7e')]){var _0x31223a={};_0x31223a[_0xe06397[_0x7ae0('0x80')]]=_0x397c21[_0x32c77d]['associatedResources'];_0x1210f4[_0x7ae0('0x6b')](_0x31223a);}else{if(!_0x1877db[_0x7ae0('0x40')]['id'])_0x1877db[_0x7ae0('0x40')]['id']=[];_0x397c21[_0x32c77d]['associatedResources'][_0x7ae0('0x6a')](function(_0x494f1a){_0x1877db[_0x7ae0('0x40')]['id'][_0x7ae0('0x6b')](_0x494f1a);});}}}if(!_[_0x7ae0('0x65')](_0x1210f4)){_0x1877db[_0x7ae0('0x40')]=_[_0x7ae0('0x44')](_0x1877db[_0x7ae0('0x40')],{'$and':{'$or':_0x1210f4}});}_0x1877db=_[_0x7ae0('0x44')]({},_0x1877db,_0x1433f7[_0x7ae0('0x46')]);if(_0x134dc4&&!_0x134dc4[_0x7ae0('0x5a')]&&_0x1f3e5d[_0x7ae0('0x7d')]===_0x7ae0('0x7f')){if(_0x1433f7[_0x7ae0('0x36')][_0x7ae0('0x57')]){_0x1877db[_0x7ae0('0x47')]=[{'all':!![]}];}return db[_0x1f3e5d[_0x7ae0('0x7d')]][_0x7ae0('0x48')](_0x1877db)['then'](function(_0x4928d3){var _0x40f821=[];_0x4928d3[_0x7ae0('0x6a')](function(_0x1f8324){var _0x1560b0;switch(_0x1f8324[_0x7ae0('0x82')]){case _0x7ae0('0x83'):_0x1560b0=_[_0x7ae0('0x4d')](_0x134dc4['associatedResources'],function(_0xe27fb){return _0xe27fb['id']===_0x1f8324[_0x7ae0('0x84')]&&_0xe27fb[_0x7ae0('0x34')]==='DefaultReports';});break;case'custom':_0x1560b0=_[_0x7ae0('0x4d')](_0x134dc4['associatedResources'],function(_0x4ce7bf){return _0x4ce7bf['id']===_0x1f8324[_0x7ae0('0x84')]&&_0x4ce7bf[_0x7ae0('0x34')]==='CustomReports';});break;}if(_0x1560b0)_0x40f821[_0x7ae0('0x6b')](_0x1f8324);});_0x2b85a4[_0x7ae0('0x22')]=_0x40f821[_0x7ae0('0x3b')];_0x2b85a4[_0x7ae0('0x49')]=_0x40f821;return _0x2b85a4;});}else{return db[_0x1f3e5d[_0x7ae0('0x7d')]][_0x7ae0('0x22')]({'where':_0x1877db['where']})[_0x7ae0('0x2b')](function(_0x52e5af){_0x2b85a4[_0x7ae0('0x22')]=_0x52e5af;if(_0x1433f7[_0x7ae0('0x36')][_0x7ae0('0x57')]){if(_0x1f3e5d[_0x7ae0('0x7d')]==='CmContact'){_0x1877db['include']=[{'model':db[_0x7ae0('0x85')],'as':_0x7ae0('0x86'),'attributes':['id','name',_0x7ae0('0x87')],'required':_0x1433f7['query']['tag']?!![]:![]},{'model':db[_0x7ae0('0x85')],'as':_0x7ae0('0x88'),'attributes':['id',_0x7ae0('0x2e'),_0x7ae0('0x87')],'through':_0x1433f7['query'][_0x7ae0('0x89')]?{'attributes':[],'where':{'TagId':_0x1433f7['query']['tag']||undefined}}:{},'required':_0x1433f7[_0x7ae0('0x36')][_0x7ae0('0x89')]?!![]:![]}];}else{_0x1877db['include']=[{'all':!![]}];}}return db[_0x1f3e5d[_0x7ae0('0x7d')]][_0x7ae0('0x48')](_0x1877db);})[_0x7ae0('0x2b')](function(_0x4a4071){_0x2b85a4[_0x7ae0('0x49')]=_0x4a4071;return _0x2b85a4;});}}else{return _0x2b85a4;}})[_0x7ae0('0x2b')](respondWithFilteredResult(_0x582635,_0x1877db))['catch'](handleError(_0x582635,null));};function getAllResources(_0x542b0d,_0x5bfa6a){return new BPromise(function(_0x2adc38,_0x5b4527){if(_0x5bfa6a){var _0x4392ff=_0x5bfa6a['filter']?{[_0x5bfa6a[_0x7ae0('0x43')][_0x7ae0('0x7e')]]:_0x5bfa6a[_0x7ae0('0x43')][_0x7ae0('0x8a')]}:undefined;return db[_0x542b0d]['findAll']({'where':_0x4392ff,'raw':!![]})[_0x7ae0('0x2b')](function(_0x23c30e){_0x5bfa6a['associatedResources']=_[_0x7ae0('0x31')](_0x23c30e,'id');_0x2adc38(_0x5bfa6a);})[_0x7ae0('0x4e')](function(_0x517281){_0x5b4527(_0x517281);});}else{_0x2adc38(null);}});}function getAllFilteredResources(_0x4c9903,_0x3cefca){return new BPromise(function(_0x125e04,_0x3932e4){var _0x422822=_0x4c9903[_0x7ae0('0x43')]?{[_0x4c9903[_0x7ae0('0x43')][_0x7ae0('0x7e')]]:_0x4c9903['filter'][_0x7ae0('0x8a')]}:undefined;return db[_0x4c9903[_0x7ae0('0x38')]][_0x7ae0('0x48')]({'where':_0x422822,'raw':!![]})[_0x7ae0('0x2b')](function(_0xde61f4){_0x3cefca[_0x7ae0('0x81')]=_[_0x7ae0('0x31')](_0xde61f4,function(_0x182bbe){return _0x182bbe['name'];});_0x125e04(_0x3cefca);})[_0x7ae0('0x4e')](function(_0x39f675){_0x3932e4(_0x39f675);});});}function getAllowedResources(_0x2c0fad,_0x5184e3,_0x525d62){return new BPromise(function(_0x13fca2,_0x39217c){if(_0x5184e3){return db[_0x7ae0('0x5b')][_0x7ae0('0x48')]({'where':{'sectionId':_0x5184e3['id']},'raw':!![]})[_0x7ae0('0x2b')](function(_0x5c8cca){if(_0x2c0fad[_0x7ae0('0x7e')]&&_0x2c0fad['field']!=='id'){_0x5184e3[_0x7ae0('0x81')]=_[_0x7ae0('0x31')](_0x5c8cca,function(_0x5806dc){return _0x5806dc[_0x2c0fad[_0x7ae0('0x7e')]];});}else{if(_0x525d62===_0x7ae0('0x7f')){_0x5184e3[_0x7ae0('0x81')]=_[_0x7ae0('0x31')](_0x5c8cca,function(_0x22818b){return{'id':_0x22818b[_0x7ae0('0x6c')],'type':_0x22818b[_0x7ae0('0x34')]};});}else{_0x5184e3[_0x7ae0('0x81')]=_[_0x7ae0('0x31')](_0x5c8cca,function(_0x140095){return _0x140095[_0x7ae0('0x6c')];});}}_0x13fca2(_0x5184e3);})[_0x7ae0('0x4e')](function(_0x22f8fe){_0x39217c(_0x22f8fe);});}else{_0x13fca2(null);}});}function getQueryModels(_0xc22276,_0x4646af){var _0x3159e5=_0xc22276[_0x7ae0('0x8b')]();var _0x4d2b13={'childModel':undefined,'parentSections':[]};switch(_0x3159e5){case _0x7ae0('0x8c'):_0x4d2b13[_0x7ae0('0x7d')]=_0x7ae0('0x8d');break;case _0x7ae0('0x8e'):_0x4d2b13[_0x7ae0('0x7d')]=_0x7ae0('0x8f');break;case _0x7ae0('0x90'):_0x4d2b13['childModel']=_0x7ae0('0x91');_0x4d2b13[_0x7ae0('0x79')]=[{'name':'SquareProjects','field':_0x7ae0('0x2e'),'foreignKey':_0x7ae0('0x92')}];break;case _0x7ae0('0x93'):_0x4d2b13[_0x7ae0('0x7d')]=_0x7ae0('0x94');break;case _0x7ae0('0x95'):_0x4d2b13[_0x7ae0('0x7d')]='CmContact';_0x4d2b13[_0x7ae0('0x79')]=[{'name':'Lists','field':'id','foreignKey':_0x7ae0('0x96')}];break;case _0x7ae0('0x97'):_0x4d2b13[_0x7ae0('0x7d')]=_0x7ae0('0x98');break;case _0x7ae0('0x99'):_0x4d2b13[_0x7ae0('0x7d')]='CmCompany';break;case _0x7ae0('0x9a'):_0x4d2b13[_0x7ae0('0x7d')]=_0x7ae0('0x9b');break;case'chatqueues':_0x4d2b13[_0x7ae0('0x7d')]='ChatQueue';break;case'chatwebsites':_0x4d2b13['childModel']=_0x7ae0('0x9c');break;case _0x7ae0('0x9d'):_0x4d2b13['childModel']=_0x7ae0('0x9e');break;case _0x7ae0('0x9f'):_0x4d2b13[_0x7ae0('0x7d')]=_0x7ae0('0xa0');break;case _0x7ae0('0xa1'):case _0x7ae0('0xa2'):case _0x7ae0('0xa3'):_0x4d2b13[_0x7ae0('0x7d')]='VoiceExtension';break;case _0x7ae0('0xa4'):_0x4d2b13[_0x7ae0('0x7d')]=_0x7ae0('0xa5');break;case'voicemails':_0x4d2b13[_0x7ae0('0x7d')]=_0x7ae0('0xa6');break;case _0x7ae0('0xa7'):_0x4d2b13[_0x7ae0('0x7d')]=_0x7ae0('0xa8');_0x4d2b13['parentSections']=[{'name':_0x7ae0('0xa9'),'field':_0x7ae0('0x2e'),'foreignKey':_0x7ae0('0xaa'),'model':'User','filter':{'field':_0x7ae0('0xab'),'value':[_0x7ae0('0xac')]}},{'name':_0x7ae0('0xad'),'field':'name','foreignKey':'membername','model':_0x7ae0('0xae'),'filter':{'field':'role','value':[_0x7ae0('0xaf')]}},{'name':_0x7ae0('0xb0'),'field':_0x7ae0('0x2e'),'foreignKey':_0x7ae0('0xb1'),'model':_0x7ae0('0xb2'),'filter':{'field':_0x7ae0('0x34'),'value':[_0x7ae0('0xb3')]}},{'name':'QueueCampaigns','field':'name','foreignKey':_0x7ae0('0xb1'),'model':_0x7ae0('0xb2'),'filter':{'field':_0x7ae0('0x34'),'value':[_0x7ae0('0xb4')]}}];break;case _0x7ae0('0xb5'):_0x4d2b13['childModel']=_0x7ae0('0xb6');break;case _0x7ae0('0xb7'):_0x4d2b13[_0x7ae0('0x7d')]=_0x7ae0('0xb8');break;case _0x7ae0('0xb9'):_0x4d2b13[_0x7ae0('0x7d')]=_0x7ae0('0xba');break;case'ivrcampaigns':_0x4d2b13[_0x7ae0('0x7d')]=_0x7ae0('0xbb');break;case _0x7ae0('0xbc'):_0x4d2b13[_0x7ae0('0x7d')]='MailQueue';break;case _0x7ae0('0xbd'):_0x4d2b13[_0x7ae0('0x7d')]=_0x7ae0('0xbe');break;case _0x7ae0('0xbf'):_0x4d2b13[_0x7ae0('0x7d')]=_0x7ae0('0xc0');break;case _0x7ae0('0xc1'):_0x4d2b13[_0x7ae0('0x7d')]=_0x7ae0('0xc2');break;case _0x7ae0('0xc3'):_0x4d2b13[_0x7ae0('0x7d')]=_0x7ae0('0xc4');break;case'smsqueues':_0x4d2b13[_0x7ae0('0x7d')]=_0x7ae0('0xc5');break;case'smsaccounts':_0x4d2b13['childModel']=_0x7ae0('0xc6');break;case'teams':_0x4d2b13[_0x7ae0('0x7d')]='Team';break;case _0x7ae0('0xc7'):case _0x7ae0('0xc8'):_0x4d2b13['childModel']=_0x7ae0('0xb2');if(_0x4646af){_0x4d2b13['parentSections']=[{'name':_0x7ae0('0xb0')},{'name':_0x7ae0('0xc9')}];}break;case _0x7ae0('0xca'):case'agents':case _0x7ae0('0xcb'):_0x4d2b13[_0x7ae0('0x7d')]=_0x7ae0('0xae');if(_0x4646af){_0x4d2b13['parentSections']=[{'name':_0x7ae0('0xcc'),'filter':{'field':_0x7ae0('0xab'),'value':[_0x7ae0('0xcd'),_0x7ae0('0xce')]},'ignore':!![]},{'name':_0x7ae0('0xa9')},{'name':_0x7ae0('0xad')}];}break;case _0x7ae0('0xcf'):_0x4d2b13['childModel']='ZendeskAccount';break;case'salesforceaccounts':_0x4d2b13[_0x7ae0('0x7d')]=_0x7ae0('0xd0');break;case _0x7ae0('0xd1'):_0x4d2b13[_0x7ae0('0x7d')]=_0x7ae0('0xd2');break;case _0x7ae0('0xd3'):_0x4d2b13[_0x7ae0('0x7d')]=_0x7ae0('0xd4');break;case _0x7ae0('0xd5'):_0x4d2b13[_0x7ae0('0x7d')]=_0x7ae0('0xd6');break;case _0x7ae0('0xd7'):_0x4d2b13[_0x7ae0('0x7d')]=_0x7ae0('0xd8');break;case'vtigeraccounts':_0x4d2b13[_0x7ae0('0x7d')]=_0x7ae0('0xae');break;case _0x7ae0('0xd9'):_0x4d2b13[_0x7ae0('0x7d')]=_0x7ae0('0xda');break;case _0x7ae0('0xdb'):_0x4d2b13[_0x7ae0('0x7d')]=_0x7ae0('0xdc');break;case _0x7ae0('0xdd'):_0x4d2b13['childModel']=_0x7ae0('0x69');break;case _0x7ae0('0xde'):_0x4d2b13[_0x7ae0('0x7d')]=_0x7ae0('0xdf');break;case _0x7ae0('0xe0'):_0x4d2b13[_0x7ae0('0x7d')]=_0x7ae0('0xe1');break;case _0x7ae0('0xe2'):_0x4d2b13[_0x7ae0('0x7d')]=_0x7ae0('0xe3');break;case _0x7ae0('0xe4'):_0x4d2b13['childModel']=_0x7ae0('0xe5');break;case _0x7ae0('0xe6'):_0x4d2b13[_0x7ae0('0x7d')]=_0x7ae0('0x85');break;case _0x7ae0('0xe7'):_0x4d2b13[_0x7ae0('0x7d')]=_0x7ae0('0xe8');break;case _0x7ae0('0xe9'):_0x4d2b13[_0x7ae0('0x7d')]='Trigger';break;case _0x7ae0('0xea'):_0x4d2b13[_0x7ae0('0x7d')]=_0x7ae0('0xeb');break;case _0x7ae0('0xec'):_0x4d2b13['childModel']='Variable';break;case _0x7ae0('0xed'):_0x4d2b13['childModel']=_0x7ae0('0x6d');break;case _0x7ae0('0xee'):_0x4d2b13['childModel']=_0x7ae0('0x7f');_0x4d2b13[_0x7ae0('0x79')]=[{'name':_0x7ae0('0xef'),'field':'id','foreignKey':_0x7ae0('0x84')}];break;case _0x7ae0('0xf0'):_0x4d2b13[_0x7ae0('0x7d')]=_0x7ae0('0xf1');break;default:return _0x4d2b13;}return _0x4d2b13;} \ No newline at end of file +var _0x52bd=['VoiceQueue','inbound','outbound','VoiceChanSpy','voiceprefixes','VoicePrefix','ivrcampaigns','mailqueues','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','SmsQueue','smsaccounts','SmsAccount','teams','Team','voicequeues','queuecampaigns','QueueCampaigns','agents','Users','user','ZendeskAccount','salesforceaccounts','SalesforceAccount','freshdeskaccounts','SugarcrmAccount','zohoaccounts','ZohoAccount','Disposition','customdashboards','intervals','Interval','Pause','scheduler','Schedule','sounds','Sound','templates','triggers','Trigger','trunks','Trunk','variables','Variable','plugins','extractedreports','Reports','metrics','AnalyticMetric','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','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','redis','defaults','localhost','socket.io-emitter','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','save','update','destroy','end','error','stack','name','send','index','map','UserProfile','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','then','includeAll','include','findAll','show','params','intersection','find','catch','create','body','clone','get','omit','updatedAt','createdAt','sequelize','transaction','UserProfileSection','autoAssociation','UserProfileResource','sectionId','userProfileId','Resources','describe','addSections','each','push','ids','getSections','enabled','includes','isEmpty','subsections','Dashboard','forEach','resourceId','Plugin','bulkCreate','removeResources','getResources','section','Sequelize','ValidationError','Unknown\x20section','mergeResources','childModel','undefined','Invalid\x20section\x20\x27','parentSections','findOne','ignore','union','all','pick','field','AnalyticExtractedReport','associatedResources','foreignKey','default','reportId','DefaultReports','custom','CustomReports','rows','CmContact','Tag','Tags','color','tag','ThroughTags','value','toLowerCase','squareprojects','SquareProject','odbc','SquareOdbc','squarerecordings','SquareRecording','SquareProjects','projectName','JscriptyProject','Lists','lists','companies','CmCompany','globalcustomfields','CmCustomField','chatwebsites','ChatWebsite','faxqueues','FaxQueue','faxaccounts','FaxAccount','internalroutes','outboundroutes','VoiceContext','voicemails','VoiceMail','voicerecordings','VoiceRecording','Agents','User','role','agent','Telephones','membername','VoiceQueues'];(function(_0xf50820,_0x56f041){var _0x2a9b10=function(_0x33f0f4){while(--_0x33f0f4){_0xf50820['push'](_0xf50820['shift']());}};_0x2a9b10(++_0x56f041);}(_0x52bd,0x11a));var _0xd52b=function(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0x52bd[_0x4b7b62];return _0x2280df;};'use strict';var pdf=require(_0xd52b('0x0'));var emlformat=require(_0xd52b('0x1'));var rimraf=require(_0xd52b('0x2'));var zipdir=require(_0xd52b('0x3'));var jsonpatch=require(_0xd52b('0x4'));var rp=require(_0xd52b('0x5'));var moment=require(_0xd52b('0x6'));var BPromise=require(_0xd52b('0x7'));var Mustache=require(_0xd52b('0x8'));var util=require(_0xd52b('0x9'));var path=require(_0xd52b('0xa'));var sox=require(_0xd52b('0xb'));var csv=require(_0xd52b('0xc'));var ejs=require(_0xd52b('0xd'));var fs=require('fs');var _=require(_0xd52b('0xe'));var squel=require('squel');var crypto=require(_0xd52b('0xf'));var jsforce=require(_0xd52b('0x10'));var deskjs=require(_0xd52b('0x11'));var toCsv=require('to-csv');var querystring=require(_0xd52b('0x12'));var Papa=require(_0xd52b('0x13'));var Redis=require('ioredis');var authService=require(_0xd52b('0x14'));var qs=require(_0xd52b('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd52b('0x16'));var logger=require(_0xd52b('0x17'))(_0xd52b('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0xd52b('0x19')]=_[_0xd52b('0x1a')](config[_0xd52b('0x19')],{'host':_0xd52b('0x1b'),'port':0x18eb});var socket=require(_0xd52b('0x1c'))(new Redis(config[_0xd52b('0x19')]));require('./userProfile.socket')['register'](socket);function respondWithStatusCode(_0x4c1c67,_0xbf681c){_0xbf681c=_0xbf681c||0xcc;return function(_0x31483e){if(_0x31483e){return _0x4c1c67[_0xd52b('0x1d')](_0xbf681c);}return _0x4c1c67[_0xd52b('0x1e')](_0xbf681c)['end']();};}function respondWithResult(_0x299761,_0xd4f8dc){_0xd4f8dc=_0xd4f8dc||0xc8;return function(_0x45e66d){if(_0x45e66d){return _0x299761[_0xd52b('0x1e')](_0xd4f8dc)[_0xd52b('0x1f')](_0x45e66d);}};}function respondWithFilteredResult(_0x105155,_0x26fd4b){return function(_0x2099d2){if(_0x2099d2){var _0x37bb30=_0x2099d2[_0xd52b('0x20')],_0x2b2228=_0x26fd4b[_0xd52b('0x21')],_0x12ea13=_0x26fd4b[_0xd52b('0x21')]+_0x26fd4b[_0xd52b('0x22')],_0x276e73;if(_0x12ea13>=_0x37bb30){_0x12ea13=_0x37bb30;_0x276e73=0xc8;}else{_0x276e73=0xce;}_0x105155[_0xd52b('0x1e')](_0x276e73);return _0x105155[_0xd52b('0x23')](_0xd52b('0x24'),_0x2b2228+'-'+_0x12ea13+'/'+_0x37bb30)[_0xd52b('0x1f')](_0x2099d2);}return null;};}function patchUpdates(_0x2b3d93){return function(_0x140ad3){try{jsonpatch[_0xd52b('0x25')](_0x140ad3,_0x2b3d93,!![]);}catch(_0x4e9dbd){return BPromise['reject'](_0x4e9dbd);}return _0x140ad3[_0xd52b('0x26')]();};}function saveUpdates(_0x1e5d8a,_0x3c5159){return function(_0x10fb26){if(_0x10fb26){return _0x10fb26[_0xd52b('0x27')](_0x1e5d8a)['then'](function(_0x491ccc){return _0x491ccc;});}return null;};}function removeEntity(_0x5f447b,_0x1d593e){return function(_0x5c9419){if(_0x5c9419){return _0x5c9419[_0xd52b('0x28')]()['then'](function(){_0x5f447b[_0xd52b('0x1e')](0xcc)[_0xd52b('0x29')]();});}};}function handleEntityNotFound(_0x1b63dc,_0x836d22){return function(_0x234eae){if(!_0x234eae){_0x1b63dc[_0xd52b('0x1d')](0x194);}return _0x234eae;};}function handleError(_0x17dd69,_0x34734c){_0x34734c=_0x34734c||0x1f4;return function(_0x19157e){logger[_0xd52b('0x2a')](_0x19157e[_0xd52b('0x2b')]);if(_0x19157e[_0xd52b('0x2c')]){delete _0x19157e[_0xd52b('0x2c')];}_0x17dd69['status'](_0x34734c)[_0xd52b('0x2d')](_0x19157e);};}exports[_0xd52b('0x2e')]=function(_0x16b946,_0x3881aa){var _0x4e4be6={},_0x46d860={},_0x4ca142={'count':0x0,'rows':[]};var _0x163a03=_[_0xd52b('0x2f')](db[_0xd52b('0x30')][_0xd52b('0x31')],function(_0x2b3286){return{'name':_0x2b3286[_0xd52b('0x32')],'type':_0x2b3286[_0xd52b('0x33')][_0xd52b('0x34')]};});_0x46d860['model']=_[_0xd52b('0x2f')](_0x163a03,_0xd52b('0x2c'));_0x46d860[_0xd52b('0x35')]=_[_0xd52b('0x36')](_0x16b946[_0xd52b('0x35')]);_0x46d860[_0xd52b('0x37')]=_['intersection'](_0x46d860[_0xd52b('0x38')],_0x46d860[_0xd52b('0x35')]);_0x4e4be6[_0xd52b('0x39')]=_['intersection'](_0x46d860['model'],qs[_0xd52b('0x3a')](_0x16b946['query'][_0xd52b('0x3a')]));_0x4e4be6['attributes']=_0x4e4be6['attributes'][_0xd52b('0x3b')]?_0x4e4be6[_0xd52b('0x39')]:_0x46d860['model'];if(!_0x16b946[_0xd52b('0x35')][_0xd52b('0x3c')](_0xd52b('0x3d'))){_0x4e4be6[_0xd52b('0x22')]=qs[_0xd52b('0x22')](_0x16b946[_0xd52b('0x35')][_0xd52b('0x22')]);_0x4e4be6[_0xd52b('0x21')]=qs[_0xd52b('0x21')](_0x16b946[_0xd52b('0x35')][_0xd52b('0x21')]);}_0x4e4be6['order']=qs[_0xd52b('0x3e')](_0x16b946['query'][_0xd52b('0x3e')]);_0x4e4be6[_0xd52b('0x3f')]=qs[_0xd52b('0x37')](_['pick'](_0x16b946['query'],_0x46d860['filters']));if(_0x16b946[_0xd52b('0x35')][_0xd52b('0x40')]){_0x4e4be6[_0xd52b('0x3f')]=_[_0xd52b('0x41')](_0x4e4be6['where'],{'$or':_['map'](_0x163a03,function(_0x3539f4){if(_0x3539f4[_0xd52b('0x33')]!==_0xd52b('0x42')){var _0x3e5fba={};_0x3e5fba[_0x3539f4[_0xd52b('0x2c')]]={'$like':'%'+_0x16b946[_0xd52b('0x35')][_0xd52b('0x40')]+'%'};return _0x3e5fba;}})});}_0x4e4be6=_[_0xd52b('0x41')]({},_0x4e4be6,_0x16b946[_0xd52b('0x43')]);var _0x219315={'where':_0x4e4be6[_0xd52b('0x3f')]};return db[_0xd52b('0x30')][_0xd52b('0x20')](_0x219315)[_0xd52b('0x44')](function(_0x4ffbd1){_0x4ca142[_0xd52b('0x20')]=_0x4ffbd1;if(_0x16b946[_0xd52b('0x35')][_0xd52b('0x45')]){_0x4e4be6[_0xd52b('0x46')]=[{'all':!![]}];}return db[_0xd52b('0x30')][_0xd52b('0x47')](_0x4e4be6);})[_0xd52b('0x44')](function(_0x2d3db2){_0x4ca142['rows']=_0x2d3db2;return _0x4ca142;})[_0xd52b('0x44')](respondWithFilteredResult(_0x3881aa,_0x4e4be6))['catch'](handleError(_0x3881aa,null));};exports[_0xd52b('0x48')]=function(_0x5b513d,_0x2d101d){var _0x930142={'raw':![],'where':{'id':_0x5b513d[_0xd52b('0x49')]['id']}},_0x3804b0={};_0x3804b0[_0xd52b('0x38')]=_[_0xd52b('0x36')](db[_0xd52b('0x30')][_0xd52b('0x31')]);_0x3804b0['query']=_[_0xd52b('0x36')](_0x5b513d[_0xd52b('0x35')]);_0x3804b0[_0xd52b('0x37')]=_[_0xd52b('0x4a')](_0x3804b0['model'],_0x3804b0['query']);_0x930142[_0xd52b('0x39')]=_[_0xd52b('0x4a')](_0x3804b0[_0xd52b('0x38')],qs[_0xd52b('0x3a')](_0x5b513d[_0xd52b('0x35')]['fields']));_0x930142[_0xd52b('0x39')]=_0x930142[_0xd52b('0x39')][_0xd52b('0x3b')]?_0x930142['attributes']:_0x3804b0[_0xd52b('0x38')];if(_0x5b513d[_0xd52b('0x35')][_0xd52b('0x45')]){_0x930142[_0xd52b('0x46')]=[{'all':!![]}];}_0x930142=_[_0xd52b('0x41')]({},_0x930142,_0x5b513d[_0xd52b('0x43')]);return db[_0xd52b('0x30')][_0xd52b('0x4b')](_0x930142)[_0xd52b('0x44')](handleEntityNotFound(_0x2d101d,null))[_0xd52b('0x44')](respondWithResult(_0x2d101d,null))[_0xd52b('0x4c')](handleError(_0x2d101d,null));};exports[_0xd52b('0x4d')]=function(_0x4197ce,_0x134aca){return db[_0xd52b('0x30')][_0xd52b('0x4d')](_0x4197ce[_0xd52b('0x4e')],{})[_0xd52b('0x44')](respondWithResult(_0x134aca,0xc9))['catch'](handleError(_0x134aca,null));};exports[_0xd52b('0x4f')]=function(_0x85984c,_0x48871b){var _0x1d58e4={'where':{'id':_0x85984c[_0xd52b('0x49')]['id']}},_0x4b2e9d={};_0x4b2e9d['model']=_[_0xd52b('0x36')](db[_0xd52b('0x30')]['rawAttributes']);_0x1d58e4[_0xd52b('0x39')]=_[_0xd52b('0x4a')](_0x4b2e9d[_0xd52b('0x38')],qs[_0xd52b('0x3a')](_0x85984c[_0xd52b('0x35')][_0xd52b('0x3a')]));_0x1d58e4['attributes']=_0x1d58e4['attributes'][_0xd52b('0x3b')]?_0x1d58e4[_0xd52b('0x39')]:_0x4b2e9d[_0xd52b('0x38')];if(_0x85984c[_0xd52b('0x35')][_0xd52b('0x45')]){_0x1d58e4[_0xd52b('0x46')]=[{'all':!![]}];}_0x1d58e4=_[_0xd52b('0x41')]({},_0x1d58e4,_0x85984c['options']);return db[_0xd52b('0x30')][_0xd52b('0x4b')](_0x1d58e4)[_0xd52b('0x44')](handleEntityNotFound(_0x48871b,null))['then'](function(_0x4932e2){if(_0x4932e2){var _0x2dc59c=_0x4932e2[_0xd52b('0x50')]({'plain':!![]});_0x2dc59c=qs[_0xd52b('0x51')](_0x2dc59c,['id','createdAt',_0xd52b('0x52'),'crudPermissions']);_0x85984c[_0xd52b('0x4e')]=_[_0xd52b('0x51')](_0x85984c['body'],['id',_0xd52b('0x53'),'updatedAt']);return db[_0xd52b('0x54')][_0xd52b('0x55')](function(_0x50b283){return db[_0xd52b('0x30')][_0xd52b('0x4d')](_['merge'](_0x2dc59c,_0x85984c[_0xd52b('0x4e')]),{'include':_0x85984c[_0xd52b('0x35')][_0xd52b('0x45')]?[{'all':!![]}]:undefined,'transaction':_0x50b283})['then'](function(_0x4e5c7a){var _0xf9144=_0x4e5c7a[_0xd52b('0x50')]({'plain':!![]});return db[_0xd52b('0x56')][_0xd52b('0x47')]({'where':{'userProfileId':_0x85984c[_0xd52b('0x49')]['id']},'raw':!![]})[_0xd52b('0x44')](function(_0x289738){if(_0x289738){return BPromise['each'](_0x289738,function(_0x13b970){return new BPromise(function(_0x2a2ae5,_0x33fa45){if(_0x13b970[_0xd52b('0x57')]===null||_0x13b970[_0xd52b('0x57')]===0x1)_0x2a2ae5(null);return db[_0xd52b('0x58')]['findAll']({'where':{'sectionId':_0x13b970['id']},'raw':!![]})[_0xd52b('0x44')](function(_0x1a20f7){var _0x2b5d51=_[_0xd52b('0x2f')](_0x1a20f7,function(_0x2667c4){return qs[_0xd52b('0x51')](_0x2667c4,['id',_0xd52b('0x53'),'updatedAt',_0xd52b('0x59')]);});_0x2a2ae5(_0x2b5d51);})[_0xd52b('0x4c')](function(_0x3e1e9e){_0x33fa45(_0x3e1e9e);});})[_0xd52b('0x44')](function(_0x35a3df){var _0x2cf8de=qs['omit'](_0x13b970,['id',_0xd52b('0x53'),_0xd52b('0x52')]);_0x2cf8de[_0xd52b('0x5a')]=_0xf9144['id'];if(_0x35a3df)_0x2cf8de[_0xd52b('0x5b')]=_0x35a3df;return _0x2cf8de;})[_0xd52b('0x44')](function(_0x5d7b4d){return db[_0xd52b('0x56')][_0xd52b('0x4d')](_0x5d7b4d,{'include':[{'model':db[_0xd52b('0x58')],'as':_0xd52b('0x5b')}],'raw':!![],'transaction':_0x50b283});});})[_0xd52b('0x44')](function(){return _0xf9144;});}});});});}})[_0xd52b('0x44')](respondWithResult(_0x48871b,0xc9))[_0xd52b('0x4c')](handleError(_0x48871b,null));};exports[_0xd52b('0x27')]=function(_0x282359,_0x18a442){if(_0x282359[_0xd52b('0x4e')]['id']){delete _0x282359[_0xd52b('0x4e')]['id'];}return db['UserProfile'][_0xd52b('0x4b')]({'where':{'id':_0x282359[_0xd52b('0x49')]['id']}})[_0xd52b('0x44')](handleEntityNotFound(_0x18a442,null))[_0xd52b('0x44')](saveUpdates(_0x282359[_0xd52b('0x4e')],null))[_0xd52b('0x44')](respondWithResult(_0x18a442,null))[_0xd52b('0x4c')](handleError(_0x18a442,null));};exports[_0xd52b('0x28')]=function(_0x4271cf,_0x5f53ed){return db[_0xd52b('0x30')][_0xd52b('0x4b')]({'where':{'id':_0x4271cf['params']['id']}})['then'](handleEntityNotFound(_0x5f53ed,null))['then'](removeEntity(_0x5f53ed,null))[_0xd52b('0x4c')](handleError(_0x5f53ed,null));};exports[_0xd52b('0x5c')]=function(_0x413de3,_0x236168){return db[_0xd52b('0x30')][_0xd52b('0x5c')]()[_0xd52b('0x44')](respondWithResult(_0x236168,null))['catch'](handleError(_0x236168,null));};exports[_0xd52b('0x5d')]=function(_0x4b8f1d,_0x391392){var _0x45b360=_0x4b8f1d[_0xd52b('0x4e')];return db[_0xd52b('0x30')][_0xd52b('0x4b')]({'where':{'id':_0x4b8f1d[_0xd52b('0x49')]['id']}})['then'](handleEntityNotFound(_0x391392,null))[_0xd52b('0x44')](function(_0x113ba6){if(_0x113ba6){return db[_0xd52b('0x54')]['transaction'](function(_0x1b7bff){return db[_0xd52b('0x56')][_0xd52b('0x28')]({'where':{'userProfileId':_0x4b8f1d[_0xd52b('0x49')]['id'],'sectionId':_[_0xd52b('0x2f')](_0x45b360,function(_0x2706b2){return _0x2706b2[_0xd52b('0x59')];})},'transaction':_0x1b7bff})[_0xd52b('0x44')](function(){var _0x58bfbe=_[_0xd52b('0x2f')](_0x45b360,function(_0x255d1b){_0x255d1b[_0xd52b('0x5a')]=_0x4b8f1d['params']['id'];return _0x255d1b;});var _0x50e416=[];return BPromise[_0xd52b('0x5e')](_0x58bfbe,function(_0x449aac){return db[_0xd52b('0x56')][_0xd52b('0x4d')](_0x449aac,{'include':[{'model':db['UserProfileResource'],'as':'Resources'}],'raw':!![],'transaction':_0x1b7bff})[_0xd52b('0x44')](function(_0x12788c){_0x50e416[_0xd52b('0x5f')](_0x12788c[_0xd52b('0x50')]({'plain':!![]}));});})['then'](function(){return _0x50e416;});});});}})[_0xd52b('0x44')](function(_0xfc9b5c){return _0xfc9b5c;})[_0xd52b('0x44')](respondWithResult(_0x391392,null))[_0xd52b('0x4c')](handleError(_0x391392,null));};exports['removeSections']=function(_0x182360,_0x276d39){var _0x2b0ca2;return db[_0xd52b('0x30')]['find']({'where':{'id':_0x182360[_0xd52b('0x49')]['id']},'attributes':['id',_0xd52b('0x2c')]})[_0xd52b('0x44')](handleEntityNotFound(_0x276d39,null))[_0xd52b('0x44')](function(_0x2b51d1){if(_0x2b51d1){_0x2b0ca2=_0x2b51d1;return db['UserProfileSection'][_0xd52b('0x28')]({'where':{'userProfileId':_0x182360['params']['id'],'sectionId':_0x182360[_0xd52b('0x35')][_0xd52b('0x60')]}});}})['then'](function(){return _0x2b0ca2;})['then'](respondWithStatusCode(_0x276d39,null))[_0xd52b('0x4c')](handleError(_0x276d39,null));};exports[_0xd52b('0x61')]=function(_0x34b98a,_0x257238){var _0x396c78=[];var _0x4c3651=[];return db[_0xd52b('0x56')][_0xd52b('0x47')]({'where':{'userProfileId':_0x34b98a[_0xd52b('0x49')]['id']},'raw':!![]})[_0xd52b('0x44')](function(_0x51b909){_0x396c78=_['filter'](_0x51b909,function(_0x1a74f1){return _0x1a74f1[_0xd52b('0x62')]===0x1||_[_0xd52b('0x63')]([0x3eb,0x709],_0x1a74f1[_0xd52b('0x59')]);});if(!_[_0xd52b('0x64')](_0x396c78)){return _[_0xd52b('0x2f')](_0x396c78,function(_0xa60313){return _0xa60313[_0xd52b('0x59')];});}else{return;}})[_0xd52b('0x44')](function(_0x15e096){if(_0x15e096)_0x4c3651=_0x15e096;if(_[_0xd52b('0x63')](_0x4c3651,0x64)){var _0x10a86d=_[_0xd52b('0x4b')](_0x396c78,{'sectionId':0x64});return hasDefaultDashboard(_0x10a86d)[_0xd52b('0x44')](function(_0x5daa87){return _[_0xd52b('0x2f')](_0x396c78,function(_0x504aec){if(_0x504aec[_0xd52b('0x59')]===0x64){_0x504aec[_0xd52b('0x65')]=_0x5daa87;}return _0x504aec;});});}else{return;}})['then'](function(_0x2b92a7){if(_0x2b92a7)_0x396c78=_0x2b92a7;if(_['includes'](_0x4c3651,0x3eb)){var _0x4e1e34=_[_0xd52b('0x4b')](_0x396c78,{'sectionId':0x3eb});return getCustomDashboards(_0x4e1e34)['then'](function(_0x4c4bf5){return _[_0xd52b('0x2f')](_0x396c78,function(_0x305ba6){if(_0x4e1e34['enabled']){if(_0x305ba6['sectionId']===0x3eb){_0x305ba6[_0xd52b('0x65')]=_0x4c4bf5;}}else{if(_0x305ba6[_0xd52b('0x59')]===0x64){_0x305ba6[_0xd52b('0x65')]=_0x4c4bf5;}}return _0x305ba6;});});}else{return;}})[_0xd52b('0x44')](function(_0x528f6c){if(_0x528f6c)_0x396c78=_0x528f6c;if(_[_0xd52b('0x63')](_0x4c3651,0x709)){var _0x24ebd6=_[_0xd52b('0x4b')](_0x396c78,{'sectionId':0x709});return getPlugins(_0x24ebd6)['then'](function(_0x1826ee){if(_0x24ebd6[_0xd52b('0x62')]){return _[_0xd52b('0x2f')](_0x396c78,function(_0x55e9df){if(_0x55e9df[_0xd52b('0x59')]===0x709){_0x55e9df[_0xd52b('0x65')]=_0x1826ee;}return _0x55e9df;});}else{var _0x5e6b81={'sectionId':0x76c,'enabled':0x1,'subsections':_0x1826ee};var _0x12bd7c=_[_0xd52b('0x2f')](_0x396c78);_0x12bd7c[_0xd52b('0x5f')](_0x5e6b81);return _0x12bd7c;}});}else{return;}})[_0xd52b('0x44')](function(_0x1c6c54){if(_0x1c6c54)_0x396c78=_0x1c6c54;return _[_0xd52b('0x40')](_0x396c78,['enabled',0x1]);})[_0xd52b('0x44')](respondWithResult(_0x257238,null))[_0xd52b('0x4c')](handleError(_0x257238,null));};function hasDefaultDashboard(_0x350e9f){var _0x55e8a6=[0x65];return new BPromise(function(_0x5b0ed7,_0x2cb57b){try{if(_0x350e9f['autoAssociation']){_0x5b0ed7(_0x55e8a6);}else{return db['UserProfileResource']['findOne']({'where':{'sectionId':_0x350e9f['id']},'raw':!![]})[_0xd52b('0x44')](function(_0x4894ca){_0x4894ca?_0x5b0ed7(_0x55e8a6):_0x5b0ed7();});}}catch(_0x430fa2){_0x2cb57b(_0x430fa2);}});}function getCustomDashboards(_0x465d67){var _0xd2e226=[];return new BPromise(function(_0x339542,_0x496224){try{if(_0x465d67[_0xd52b('0x57')]){return db[_0xd52b('0x66')][_0xd52b('0x47')]({'raw':!![]})[_0xd52b('0x44')](function(_0x5d0e28){_0x5d0e28['forEach'](function(_0x1ca628){_0xd2e226[_0xd52b('0x5f')](_0x1ca628['id']+0x1869f);});_0x339542(_0xd2e226);});}else{return db['UserProfileResource'][_0xd52b('0x47')]({'where':{'sectionId':_0x465d67['id']},'raw':!![]})['then'](function(_0x9a3130){_0x9a3130[_0xd52b('0x67')](function(_0x1af5ec){_0xd2e226[_0xd52b('0x5f')](_0x1af5ec[_0xd52b('0x68')]+0x1869f);});_0x339542(_0xd2e226);});}}catch(_0x2b4228){_0x496224(_0x2b4228);}});}function getPlugins(_0x48f342){var _0x4b712c=[];return new BPromise(function(_0x1551fa,_0x3d5db2){try{if(_0x48f342[_0xd52b('0x57')]){return db[_0xd52b('0x69')][_0xd52b('0x47')]({'raw':!![]})[_0xd52b('0x44')](function(_0x497cb4){_0x497cb4[_0xd52b('0x67')](function(_0x507ff1){_0x4b712c[_0xd52b('0x5f')](_0x507ff1['id']+0x15b38);});_0x1551fa(_0x4b712c);});}else{return db[_0xd52b('0x58')][_0xd52b('0x47')]({'where':{'sectionId':_0x48f342['id']},'raw':!![]})[_0xd52b('0x44')](function(_0x26163e){_0x26163e[_0xd52b('0x67')](function(_0x3aa2d2){_0x4b712c['push'](_0x3aa2d2[_0xd52b('0x68')]+0x15b38);});_0x1551fa(_0x4b712c);});}}catch(_0x2253d6){_0x3d5db2(_0x2253d6);}});}exports['addResources']=function(_0x520243,_0x24bad3){return db[_0xd52b('0x30')][_0xd52b('0x4b')]({'where':{'id':_0x520243['params']['id']}})[_0xd52b('0x44')](handleEntityNotFound(_0x24bad3,null))['then'](function(_0x5bc334){if(_0x5bc334){return db['sequelize'][_0xd52b('0x55')](function(_0x11db47){return db[_0xd52b('0x56')][_0xd52b('0x47')]({'where':{'userProfileId':_0x520243[_0xd52b('0x49')]['id']},'attributes':['id'],'raw':!![]})[_0xd52b('0x44')](function(_0x103921){if(_0x103921){return db[_0xd52b('0x56')]['destroy']({'where':{'userProfileId':_0x520243['params']['id'],'id':_['map'](_0x103921,function(_0x242626){return _0x242626['id'];})},'transaction':_0x11db47});}})[_0xd52b('0x44')](function(_0x360670){var _0x117777=_[_0xd52b('0x2f')](_0x520243[_0xd52b('0x4e')],function(_0x1f4e96){_0x1f4e96[_0xd52b('0x5a')]=_0x520243[_0xd52b('0x49')]['id'];return _0x1f4e96;});return db[_0xd52b('0x56')][_0xd52b('0x6a')](_0x117777,{'raw':!![],'transaction':_0x11db47});})['then'](function(_0x23ec47){var _0x2de16e=_[_0xd52b('0x40')](_[_0xd52b('0x2f')](_0x23ec47,function(_0x1f6a2a){return _0x1f6a2a['get']({'plain':!![]});}),{'includeAll':![]});if(_0x2de16e){return db['UserProfileSection'][_0xd52b('0x47')]({'where':{'userProfileId':_0x520243[_0xd52b('0x49')]['id'],'sectionId':_[_0xd52b('0x2f')](_0x2de16e,function(_0xf72b0a){return _0xf72b0a[_0xd52b('0x59')];})},'attributes':['id','sectionId'],'raw':!![]})[_0xd52b('0x44')](function(_0x11b40b){var _0x21b96=_[_0xd52b('0x2f')](_0x520243['body'],function(_0x19856b){_0x19856b['userProfileId']=_0x520243[_0xd52b('0x49')]['id'];return _0x19856b;});return db[_0xd52b('0x58')][_0xd52b('0x6a')](_0x21b96,{'raw':!![],'transaction':_0x11db47});});}})[_0xd52b('0x4c')](handleError(_0x24bad3,null));});}})[_0xd52b('0x44')](function(_0x4d2c0a){var _0x4cccbc=_[_0xd52b('0x2f')](_0x4d2c0a,function(_0x42ddbf){return _0x42ddbf[_0xd52b('0x50')]({'plain':!![]});});})[_0xd52b('0x44')](respondWithResult(_0x24bad3,null))[_0xd52b('0x4c')](handleError(_0x24bad3,null));};exports['removeResources']=function(_0x145393,_0x374e76,_0x35065c){return db[_0xd52b('0x30')][_0xd52b('0x4b')]({'where':{'id':_0x145393[_0xd52b('0x49')]['id']}})['then'](handleEntityNotFound(_0x374e76,null))[_0xd52b('0x44')](function(_0x9cc717){if(_0x9cc717){return _0x9cc717[_0xd52b('0x6b')](_0x145393['query']['ids']);}})[_0xd52b('0x44')](respondWithStatusCode(_0x374e76,null))[_0xd52b('0x4c')](handleError(_0x374e76,null));};exports[_0xd52b('0x6c')]=function(_0xd2e52b,_0xdbc789){var _0x544ff7={'raw':![],'where':{}};var _0x5edb63={};var _0x3bf4ff={'count':0x0,'rows':[]};var _0x95218=_0xd2e52b['query'][_0xd52b('0x6d')];if(typeof _0x95218==='undefined'){throw new db[(_0xd52b('0x6e'))][(_0xd52b('0x6f'))](_0xd52b('0x70'));}var _0x10fd6a=_0xd2e52b[_0xd52b('0x35')][_0xd52b('0x71')]||![];var _0x1fd45f=getQueryModels(_0x95218,_0x10fd6a);if(typeof _0x1fd45f[_0xd52b('0x72')]===_0xd52b('0x73')){throw new db[(_0xd52b('0x6e'))][(_0xd52b('0x6f'))](_0xd52b('0x74')+_0x95218+'\x27');}var _0x261c6f=[];if(!_['isEmpty'](_0x1fd45f[_0xd52b('0x75')])){_0x261c6f=_0x1fd45f['parentSections'];}else{_0x261c6f=[{'name':_0x95218}];}return db[_0xd52b('0x30')][_0xd52b('0x76')]({'where':{'id':_0xd2e52b[_0xd52b('0x49')]['id']}})['then'](handleEntityNotFound(_0xdbc789,null))[_0xd52b('0x44')](function(_0x5a1521){if(_0x5a1521){var _0x30fbb9=[];for(var _0x52de24=0x0;_0x52de24<_0x261c6f[_0xd52b('0x3b')];_0x52de24++){_0x30fbb9[_0xd52b('0x5f')](db[_0xd52b('0x56')]['findOne']({'where':{'userProfileId':_0x5a1521['id'],'name':_0x261c6f[_0x52de24][_0xd52b('0x2c')]},'raw':!![]}));}return BPromise['all'](_0x30fbb9);}})['then'](function(_0x4906f2){var _0x4118ed=_[_0xd52b('0x40')](_0x4906f2,function(_0x57d2e8){return _0x57d2e8?_0x57d2e8:undefined;});var _0x46629d=_[_0xd52b('0x40')](_0x261c6f,[_0xd52b('0x77'),!![]]);var _0x22e44c=_[_0xd52b('0x64')](_0x4118ed)&&_[_0xd52b('0x64')](_0x46629d)?null:_[_0xd52b('0x78')](_0x46629d,_0x4118ed);if(_0x22e44c){var _0x534dbe=[];for(var _0xd31d9c=0x0;_0xd31d9c<_0x22e44c[_0xd52b('0x3b')];_0xd31d9c++){var _0x4e5437=_[_0xd52b('0x4b')](_0x261c6f,function(_0x4c531c){return _0x22e44c[_0xd31d9c]?_0x4c531c['name']===_0x22e44c[_0xd31d9c][_0xd52b('0x2c')]:null;});if(_0x4e5437){if(_0x22e44c[_0xd31d9c]['ignore']){_0x534dbe[_0xd52b('0x5f')](getAllResources(_0x1fd45f['childModel'],_0x22e44c[_0xd31d9c]));}else{if(!_0x22e44c[_0xd31d9c][_0xd52b('0x57')]){_0x534dbe[_0xd52b('0x5f')](getAllowedResources(_0x4e5437,_0x22e44c[_0xd31d9c],_0x1fd45f[_0xd52b('0x72')]));}else{if(_0x4e5437[_0xd52b('0x38')]){_0x534dbe['push'](getAllFilteredResources(_0x4e5437,_0x22e44c[_0xd31d9c]));}}}}}return BPromise[_0xd52b('0x79')](_0x534dbe);}else{return null;}})['then'](function(_0x19d7d0){var _0x21cb24=_0x19d7d0;var _0x233c5b=null;if(_0x21cb24){_0x233c5b=_0x21cb24[_0xd52b('0x3b')]===0x1?_0x21cb24[0x0]:null;}if(_0x233c5b||_0x21cb24){var _0x41dbf1=db[_0x1fd45f[_0xd52b('0x72')]][_0xd52b('0x31')];_0x5edb63['model']=_[_0xd52b('0x36')](_0x41dbf1);_0x5edb63[_0xd52b('0x35')]=_['keys'](_0xd2e52b[_0xd52b('0x35')]);_0x5edb63[_0xd52b('0x37')]=_[_0xd52b('0x4a')](_0x5edb63['model'],_0x5edb63[_0xd52b('0x35')]);_0x544ff7['attributes']=_['intersection'](_0x5edb63['model'],qs[_0xd52b('0x3a')](_0xd2e52b[_0xd52b('0x35')][_0xd52b('0x3a')]));_0x544ff7[_0xd52b('0x39')]=_0x544ff7[_0xd52b('0x39')][_0xd52b('0x3b')]?_0x544ff7[_0xd52b('0x39')]:_0x5edb63[_0xd52b('0x38')];if(!_0xd2e52b[_0xd52b('0x35')][_0xd52b('0x3c')](_0xd52b('0x3d'))){_0x544ff7[_0xd52b('0x22')]=qs['limit'](_0xd2e52b['query'][_0xd52b('0x22')]);_0x544ff7[_0xd52b('0x21')]=qs[_0xd52b('0x21')](_0xd2e52b[_0xd52b('0x35')][_0xd52b('0x21')]);}_0x544ff7['order']=qs['sort'](_0xd2e52b[_0xd52b('0x35')][_0xd52b('0x3e')]);_0x544ff7[_0xd52b('0x3f')]=qs[_0xd52b('0x37')](_[_0xd52b('0x7a')](_0xd2e52b[_0xd52b('0x35')],_0x5edb63[_0xd52b('0x37')]));if(_0xd2e52b[_0xd52b('0x35')]['filter']){_0x544ff7[_0xd52b('0x3f')]=_[_0xd52b('0x41')](_0x544ff7['where'],{'$or':_['map'](_0x41dbf1,function(_0x3674a5){if(_0x3674a5[_0xd52b('0x33')][_0xd52b('0x34')]!==_0xd52b('0x42')){var _0x56b9ec={};_0x56b9ec[_0x3674a5[_0xd52b('0x7b')]]={'$like':'%'+_0xd2e52b[_0xd52b('0x35')][_0xd52b('0x40')]+'%'};return _0x56b9ec;}})});}var _0x31e853=[];if(_0x233c5b){var _0x335fd3=_[_0xd52b('0x4b')](_0x261c6f,[_0xd52b('0x2c'),_0x233c5b[_0xd52b('0x2c')]]);if(_0x335fd3[_0xd52b('0x7b')]){var _0x249c08={};if(_0x1fd45f[_0xd52b('0x72')]===_0xd52b('0x7c')){_0x249c08[_0x335fd3['foreignKey']]=_['map'](_0x233c5b[_0xd52b('0x7d')],'id');}else{_0x249c08[_0x335fd3['foreignKey']]=_0x233c5b['associatedResources'];}_0x31e853['push'](_0x249c08);}else{_0x544ff7[_0xd52b('0x3f')]['id']=_0x233c5b[_0xd52b('0x7d')];}}else{for(var _0x4ed94e=0x0;_0x4ed94e<_0x21cb24[_0xd52b('0x3b')];_0x4ed94e++){var _0x335fd3=_[_0xd52b('0x4b')](_0x261c6f,[_0xd52b('0x2c'),_0x21cb24[_0x4ed94e]['name']]);if(_0x335fd3[_0xd52b('0x7b')]){var _0x249c08={};_0x249c08[_0x335fd3[_0xd52b('0x7e')]]=_0x21cb24[_0x4ed94e][_0xd52b('0x7d')];_0x31e853[_0xd52b('0x5f')](_0x249c08);}else{if(!_0x544ff7[_0xd52b('0x3f')]['id'])_0x544ff7[_0xd52b('0x3f')]['id']=[];_0x21cb24[_0x4ed94e][_0xd52b('0x7d')][_0xd52b('0x67')](function(_0x32e309){_0x544ff7[_0xd52b('0x3f')]['id']['push'](_0x32e309);});}}}if(!_[_0xd52b('0x64')](_0x31e853)){_0x544ff7[_0xd52b('0x3f')]=_[_0xd52b('0x41')](_0x544ff7['where'],{'$and':{'$or':_0x31e853}});}_0x544ff7=_[_0xd52b('0x41')]({},_0x544ff7,_0xd2e52b['options']);if(_0x233c5b&&!_0x233c5b[_0xd52b('0x57')]&&_0x1fd45f[_0xd52b('0x72')]==='AnalyticExtractedReport'){if(_0xd2e52b[_0xd52b('0x35')]['includeAll']){_0x544ff7[_0xd52b('0x46')]=[{'all':!![]}];}return db[_0x1fd45f['childModel']][_0xd52b('0x47')](_0x544ff7)[_0xd52b('0x44')](function(_0x53db94){var _0x290529=[];_0x53db94['forEach'](function(_0x4db2dd){var _0xb2cb2d;switch(_0x4db2dd['reportType']){case _0xd52b('0x7f'):_0xb2cb2d=_[_0xd52b('0x4b')](_0x233c5b[_0xd52b('0x7d')],function(_0x57b5b0){return _0x57b5b0['id']===_0x4db2dd[_0xd52b('0x80')]&&_0x57b5b0['type']===_0xd52b('0x81');});break;case _0xd52b('0x82'):_0xb2cb2d=_[_0xd52b('0x4b')](_0x233c5b[_0xd52b('0x7d')],function(_0x3f56fe){return _0x3f56fe['id']===_0x4db2dd[_0xd52b('0x80')]&&_0x3f56fe['type']===_0xd52b('0x83');});break;}if(_0xb2cb2d)_0x290529[_0xd52b('0x5f')](_0x4db2dd);});_0x3bf4ff[_0xd52b('0x20')]=_0x290529[_0xd52b('0x3b')];_0x3bf4ff[_0xd52b('0x84')]=_0x290529;return _0x3bf4ff;});}else{return db[_0x1fd45f['childModel']][_0xd52b('0x20')]({'where':_0x544ff7['where']})[_0xd52b('0x44')](function(_0x5b896e){_0x3bf4ff[_0xd52b('0x20')]=_0x5b896e;if(_0xd2e52b['query'][_0xd52b('0x45')]){if(_0x1fd45f[_0xd52b('0x72')]===_0xd52b('0x85')){_0x544ff7[_0xd52b('0x46')]=[{'model':db[_0xd52b('0x86')],'as':_0xd52b('0x87'),'attributes':['id','name',_0xd52b('0x88')],'required':_0xd2e52b[_0xd52b('0x35')][_0xd52b('0x89')]?!![]:![]},{'model':db[_0xd52b('0x86')],'as':_0xd52b('0x8a'),'attributes':['id',_0xd52b('0x2c'),_0xd52b('0x88')],'through':_0xd2e52b[_0xd52b('0x35')][_0xd52b('0x89')]?{'attributes':[],'where':{'TagId':_0xd2e52b[_0xd52b('0x35')][_0xd52b('0x89')]||undefined}}:{},'required':_0xd2e52b[_0xd52b('0x35')][_0xd52b('0x89')]?!![]:![]}];}else{_0x544ff7[_0xd52b('0x46')]=[{'all':!![]}];}}return db[_0x1fd45f['childModel']][_0xd52b('0x47')](_0x544ff7);})['then'](function(_0x58ac0d){_0x3bf4ff['rows']=_0x58ac0d;return _0x3bf4ff;});}}else{return _0x3bf4ff;}})[_0xd52b('0x44')](respondWithFilteredResult(_0xdbc789,_0x544ff7))[_0xd52b('0x4c')](handleError(_0xdbc789,null));};function getAllResources(_0x1453c2,_0x171a7a){return new BPromise(function(_0x42c188,_0x4839d1){if(_0x171a7a){var _0x560c32=_0x171a7a[_0xd52b('0x40')]?{[_0x171a7a[_0xd52b('0x40')][_0xd52b('0x7b')]]:_0x171a7a['filter']['value']}:undefined;return db[_0x1453c2][_0xd52b('0x47')]({'where':_0x560c32,'raw':!![]})[_0xd52b('0x44')](function(_0x383fca){_0x171a7a[_0xd52b('0x7d')]=_['map'](_0x383fca,'id');_0x42c188(_0x171a7a);})[_0xd52b('0x4c')](function(_0x655ffd){_0x4839d1(_0x655ffd);});}else{_0x42c188(null);}});}function getAllFilteredResources(_0x51c31a,_0x22706f){return new BPromise(function(_0x5e0382,_0xb21075){var _0x30e571=_0x51c31a['filter']?{[_0x51c31a[_0xd52b('0x40')][_0xd52b('0x7b')]]:_0x51c31a[_0xd52b('0x40')][_0xd52b('0x8b')]}:undefined;return db[_0x51c31a['model']][_0xd52b('0x47')]({'where':_0x30e571,'raw':!![]})[_0xd52b('0x44')](function(_0x2b2ac1){_0x22706f['associatedResources']=_['map'](_0x2b2ac1,function(_0x444278){return _0x444278[_0xd52b('0x2c')];});_0x5e0382(_0x22706f);})[_0xd52b('0x4c')](function(_0x4a9caa){_0xb21075(_0x4a9caa);});});}function getAllowedResources(_0x3a8569,_0x1ecc0a,_0x3384d8){return new BPromise(function(_0x3f50e2,_0x533e35){if(_0x1ecc0a){return db[_0xd52b('0x58')][_0xd52b('0x47')]({'where':{'sectionId':_0x1ecc0a['id']},'raw':!![]})[_0xd52b('0x44')](function(_0x5ccb22){if(_0x3a8569[_0xd52b('0x7b')]&&_0x3a8569[_0xd52b('0x7b')]!=='id'){_0x1ecc0a[_0xd52b('0x7d')]=_[_0xd52b('0x2f')](_0x5ccb22,function(_0x2e03d7){return _0x2e03d7[_0x3a8569['field']];});}else{if(_0x3384d8===_0xd52b('0x7c')){_0x1ecc0a[_0xd52b('0x7d')]=_['map'](_0x5ccb22,function(_0x1920d3){return{'id':_0x1920d3['resourceId'],'type':_0x1920d3[_0xd52b('0x33')]};});}else{_0x1ecc0a[_0xd52b('0x7d')]=_[_0xd52b('0x2f')](_0x5ccb22,function(_0x1ab5a4){return _0x1ab5a4['resourceId'];});}}_0x3f50e2(_0x1ecc0a);})[_0xd52b('0x4c')](function(_0x19cf22){_0x533e35(_0x19cf22);});}else{_0x3f50e2(null);}});}function getQueryModels(_0x4ed75d,_0x466b64){var _0x151540=_0x4ed75d[_0xd52b('0x8c')]();var _0x4576cf={'childModel':undefined,'parentSections':[]};switch(_0x151540){case _0xd52b('0x8d'):_0x4576cf[_0xd52b('0x72')]=_0xd52b('0x8e');break;case _0xd52b('0x8f'):_0x4576cf[_0xd52b('0x72')]=_0xd52b('0x90');break;case _0xd52b('0x91'):_0x4576cf[_0xd52b('0x72')]=_0xd52b('0x92');_0x4576cf[_0xd52b('0x75')]=[{'name':_0xd52b('0x93'),'field':'name','foreignKey':_0xd52b('0x94')}];break;case'projects':_0x4576cf[_0xd52b('0x72')]=_0xd52b('0x95');break;case'contacts':_0x4576cf['childModel']=_0xd52b('0x85');_0x4576cf[_0xd52b('0x75')]=[{'name':_0xd52b('0x96'),'field':'id','foreignKey':'ListId'}];break;case _0xd52b('0x97'):_0x4576cf[_0xd52b('0x72')]='CmList';break;case _0xd52b('0x98'):_0x4576cf[_0xd52b('0x72')]=_0xd52b('0x99');break;case _0xd52b('0x9a'):_0x4576cf[_0xd52b('0x72')]=_0xd52b('0x9b');break;case'chatqueues':_0x4576cf[_0xd52b('0x72')]='ChatQueue';break;case _0xd52b('0x9c'):_0x4576cf[_0xd52b('0x72')]=_0xd52b('0x9d');break;case _0xd52b('0x9e'):_0x4576cf['childModel']=_0xd52b('0x9f');break;case _0xd52b('0xa0'):_0x4576cf['childModel']=_0xd52b('0xa1');break;case'inboundroutes':case _0xd52b('0xa2'):case _0xd52b('0xa3'):_0x4576cf[_0xd52b('0x72')]='VoiceExtension';break;case'contexts':_0x4576cf[_0xd52b('0x72')]=_0xd52b('0xa4');break;case _0xd52b('0xa5'):_0x4576cf[_0xd52b('0x72')]=_0xd52b('0xa6');break;case _0xd52b('0xa7'):_0x4576cf[_0xd52b('0x72')]=_0xd52b('0xa8');_0x4576cf['parentSections']=[{'name':_0xd52b('0xa9'),'field':_0xd52b('0x2c'),'foreignKey':'membername','model':_0xd52b('0xaa'),'filter':{'field':_0xd52b('0xab'),'value':[_0xd52b('0xac')]}},{'name':_0xd52b('0xad'),'field':_0xd52b('0x2c'),'foreignKey':_0xd52b('0xae'),'model':'User','filter':{'field':_0xd52b('0xab'),'value':['telephone']}},{'name':_0xd52b('0xaf'),'field':_0xd52b('0x2c'),'foreignKey':'queue','model':_0xd52b('0xb0'),'filter':{'field':_0xd52b('0x33'),'value':[_0xd52b('0xb1')]}},{'name':'QueueCampaigns','field':_0xd52b('0x2c'),'foreignKey':'queue','model':'VoiceQueue','filter':{'field':'type','value':[_0xd52b('0xb2')]}}];break;case'musiconholds':_0x4576cf[_0xd52b('0x72')]='VoiceMusicOnHold';break;case'chanspies':_0x4576cf[_0xd52b('0x72')]=_0xd52b('0xb3');break;case _0xd52b('0xb4'):_0x4576cf[_0xd52b('0x72')]=_0xd52b('0xb5');break;case _0xd52b('0xb6'):_0x4576cf[_0xd52b('0x72')]='Campaign';break;case _0xd52b('0xb7'):_0x4576cf[_0xd52b('0x72')]='MailQueue';break;case'mailaccounts':_0x4576cf[_0xd52b('0x72')]='MailAccount';break;case _0xd52b('0xb8'):_0x4576cf[_0xd52b('0x72')]=_0xd52b('0xb9');break;case _0xd52b('0xba'):_0x4576cf[_0xd52b('0x72')]=_0xd52b('0xbb');break;case _0xd52b('0xbc'):_0x4576cf[_0xd52b('0x72')]=_0xd52b('0xbd');break;case'smsqueues':_0x4576cf[_0xd52b('0x72')]=_0xd52b('0xbe');break;case _0xd52b('0xbf'):_0x4576cf[_0xd52b('0x72')]=_0xd52b('0xc0');break;case _0xd52b('0xc1'):_0x4576cf[_0xd52b('0x72')]=_0xd52b('0xc2');break;case _0xd52b('0xc3'):case _0xd52b('0xc4'):_0x4576cf[_0xd52b('0x72')]=_0xd52b('0xb0');if(_0x466b64){_0x4576cf[_0xd52b('0x75')]=[{'name':_0xd52b('0xaf')},{'name':_0xd52b('0xc5')}];}break;case'users':case _0xd52b('0xc6'):case'telephones':_0x4576cf[_0xd52b('0x72')]=_0xd52b('0xaa');if(_0x466b64){_0x4576cf['parentSections']=[{'name':_0xd52b('0xc7'),'filter':{'field':_0xd52b('0xab'),'value':['admin',_0xd52b('0xc8')]},'ignore':!![]},{'name':_0xd52b('0xa9')},{'name':'Telephones'}];}break;case'zendeskaccounts':_0x4576cf[_0xd52b('0x72')]=_0xd52b('0xc9');break;case _0xd52b('0xca'):_0x4576cf[_0xd52b('0x72')]=_0xd52b('0xcb');break;case _0xd52b('0xcc'):_0x4576cf[_0xd52b('0x72')]='FreshdeskAccount';break;case'sugarcrmaccounts':_0x4576cf[_0xd52b('0x72')]=_0xd52b('0xcd');break;case'deskaccounts':_0x4576cf[_0xd52b('0x72')]='DeskAccount';break;case _0xd52b('0xce'):_0x4576cf['childModel']=_0xd52b('0xcf');break;case'vtigeraccounts':_0x4576cf[_0xd52b('0x72')]=_0xd52b('0xaa');break;case'cannedanswers':_0x4576cf[_0xd52b('0x72')]='CannedAnswer';break;case'dispositions':_0x4576cf[_0xd52b('0x72')]=_0xd52b('0xd0');break;case _0xd52b('0xd1'):_0x4576cf[_0xd52b('0x72')]=_0xd52b('0x66');break;case _0xd52b('0xd2'):_0x4576cf['childModel']=_0xd52b('0xd3');break;case'pauses':_0x4576cf[_0xd52b('0x72')]=_0xd52b('0xd4');break;case _0xd52b('0xd5'):_0x4576cf[_0xd52b('0x72')]=_0xd52b('0xd6');break;case _0xd52b('0xd7'):_0x4576cf[_0xd52b('0x72')]=_0xd52b('0xd8');break;case'tags':_0x4576cf['childModel']='Tag';break;case _0xd52b('0xd9'):_0x4576cf[_0xd52b('0x72')]='Template';break;case _0xd52b('0xda'):_0x4576cf[_0xd52b('0x72')]=_0xd52b('0xdb');break;case _0xd52b('0xdc'):_0x4576cf['childModel']=_0xd52b('0xdd');break;case _0xd52b('0xde'):_0x4576cf[_0xd52b('0x72')]=_0xd52b('0xdf');break;case _0xd52b('0xe0'):_0x4576cf[_0xd52b('0x72')]=_0xd52b('0x69');break;case _0xd52b('0xe1'):_0x4576cf[_0xd52b('0x72')]=_0xd52b('0x7c');_0x4576cf['parentSections']=[{'name':_0xd52b('0xe2'),'field':'id','foreignKey':'reportId'}];break;case _0xd52b('0xe3'):_0x4576cf[_0xd52b('0x72')]=_0xd52b('0xe4');break;default:return _0x4576cf;}return _0x4576cf;} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index 058df89..ac352ab 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 _0x0f89=['hasOwnProperty','hook','exports','../../mysqldb','UserProfile','setMaxListeners','save','update','emit'];(function(_0x3d37f0,_0x213bec){var _0x3d6791=function(_0x4e59bf){while(--_0x4e59bf){_0x3d37f0['push'](_0x3d37f0['shift']());}};_0x3d6791(++_0x213bec);}(_0x0f89,0x1a1));var _0x90f8=function(_0x487826,_0x53f224){_0x487826=_0x487826-0x0;var _0x4d13b5=_0x0f89[_0x487826];return _0x4d13b5;};'use strict';var EventEmitter=require('events');var UserProfile=require(_0x90f8('0x0'))['db'][_0x90f8('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x90f8('0x2')](0x0);var events={'afterCreate':_0x90f8('0x3'),'afterUpdate':_0x90f8('0x4'),'afterDestroy':'remove'};function emitEvent(_0x53e972){return function(_0x191012,_0x241aba,_0x3b2996){UserProfileEvents[_0x90f8('0x5')](_0x53e972+':'+_0x191012['id'],_0x191012);UserProfileEvents[_0x90f8('0x5')](_0x53e972,_0x191012);_0x3b2996(null);};}for(var e in events){if(events[_0x90f8('0x6')](e)){var event=events[e];UserProfile[_0x90f8('0x7')](e,emitEvent(event));}}module[_0x90f8('0x8')]=UserProfileEvents; \ No newline at end of file +var _0xa7ce=['update','remove','emit','hook','exports','../../mysqldb','save'];(function(_0x4ad50c,_0x76f3b2){var _0x414f18=function(_0x17cefb){while(--_0x17cefb){_0x4ad50c['push'](_0x4ad50c['shift']());}};_0x414f18(++_0x76f3b2);}(_0xa7ce,0x12b));var _0xea7c=function(_0x2b76d9,_0x4a6bab){_0x2b76d9=_0x2b76d9-0x0;var _0x9bad79=_0xa7ce[_0x2b76d9];return _0x9bad79;};'use strict';var EventEmitter=require('events');var UserProfile=require(_0xea7c('0x0'))['db']['UserProfile'];var UserProfileEvents=new EventEmitter();UserProfileEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xea7c('0x1'),'afterUpdate':_0xea7c('0x2'),'afterDestroy':_0xea7c('0x3')};function emitEvent(_0x58f38d){return function(_0x10d9f8,_0x1ec492,_0x11166e){UserProfileEvents[_0xea7c('0x4')](_0x58f38d+':'+_0x10d9f8['id'],_0x10d9f8);UserProfileEvents['emit'](_0x58f38d,_0x10d9f8);_0x11166e(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserProfile[_0xea7c('0x5')](e,emitEvent(event));}}module[_0xea7c('0x6')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index ee7264a..f2099d2 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 _0x285e=['../../config/logger','moment','request-promise','path','rimraf','./userProfile.attributes','exports','define','user_profiles','util'];(function(_0x2cc0b3,_0x120bf1){var _0x1667ef=function(_0x3abcb4){while(--_0x3abcb4){_0x2cc0b3['push'](_0x2cc0b3['shift']());}};_0x1667ef(++_0x120bf1);}(_0x285e,0xc7));var _0xe285=function(_0x29db36,_0x410ae9){_0x29db36=_0x29db36-0x0;var _0x234e87=_0x285e[_0x29db36];return _0x234e87;};'use strict';var _=require('lodash');var util=require(_0xe285('0x0'));var logger=require(_0xe285('0x1'))('api');var moment=require(_0xe285('0x2'));var BPromise=require('bluebird');var rp=require(_0xe285('0x3'));var fs=require('fs');var path=require(_0xe285('0x4'));var rimraf=require(_0xe285('0x5'));var config=require('../../config/environment');var attributes=require(_0xe285('0x6'));module[_0xe285('0x7')]=function(_0x120dd3,_0x114a03){return _0x120dd3[_0xe285('0x8')]('UserProfile',attributes,{'tableName':_0xe285('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9a93=['request-promise','rimraf','../../config/environment','./userProfile.attributes','exports','define','UserProfile','lodash','util','api','moment','bluebird'];(function(_0x249d0a,_0x2da083){var _0x2182db=function(_0x1441cc){while(--_0x1441cc){_0x249d0a['push'](_0x249d0a['shift']());}};_0x2182db(++_0x2da083);}(_0x9a93,0x1f3));var _0x39a9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9a93[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x39a9('0x0'));var util=require(_0x39a9('0x1'));var logger=require('../../config/logger')(_0x39a9('0x2'));var moment=require(_0x39a9('0x3'));var BPromise=require(_0x39a9('0x4'));var rp=require(_0x39a9('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x39a9('0x6'));var config=require(_0x39a9('0x7'));var attributes=require(_0x39a9('0x8'));module[_0x39a9('0x9')]=function(_0x5292e1,_0x59c14e){return _0x5292e1[_0x39a9('0xa')](_0x39a9('0xb'),attributes,{'tableName':'user_profiles','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 1db5e23..3bc188c 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 _0x1883=['rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','register','then','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','code','message','UserProfile,\x20%s,\x20%s','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x3b5f39,_0x16870e){var _0x4df97c=function(_0x5624bf){while(--_0x5624bf){_0x3b5f39['push'](_0x3b5f39['shift']());}};_0x4df97c(++_0x16870e);}(_0x1883,0xab));var _0x3188=function(_0x2d9412,_0x47f181){_0x2d9412=_0x2d9412-0x0;var _0x437fe2=_0x1883[_0x2d9412];return _0x437fe2;};'use strict';var _=require(_0x3188('0x0'));var util=require(_0x3188('0x1'));var moment=require(_0x3188('0x2'));var BPromise=require(_0x3188('0x3'));var rs=require(_0x3188('0x4'));var fs=require('fs');var Redis=require(_0x3188('0x5'));var db=require(_0x3188('0x6'))['db'];var utils=require(_0x3188('0x7'));var logger=require(_0x3188('0x8'))(_0x3188('0x9'));var config=require(_0x3188('0xa'));var jayson=require(_0x3188('0xb'));var client=jayson[_0x3188('0xc')][_0x3188('0xd')]({'port':0x232a});config[_0x3188('0xe')]=_[_0x3188('0xf')](config[_0x3188('0xe')],{'host':'localhost','port':0x18eb});var socket=require(_0x3188('0x10'))(new Redis(config[_0x3188('0xe')]));require('./userProfile.socket')[_0x3188('0x11')](socket);function respondWithRpcPromise(_0x5b7f47,_0xc6040,_0x34fc82){return new BPromise(function(_0x209e31,_0x43b69){return client['request'](_0x5b7f47,_0x34fc82)[_0x3188('0x12')](function(_0x2cdcb2){logger['info']('UserProfile,\x20%s,\x20%s',_0xc6040,_0x3188('0x13'));logger[_0x3188('0x14')](_0x3188('0x15'),_0xc6040,_0x3188('0x13'),JSON[_0x3188('0x16')](_0x2cdcb2));if(_0x2cdcb2[_0x3188('0x17')]){if(_0x2cdcb2['error'][_0x3188('0x18')]===0x1f4){logger['error']('UserProfile,\x20%s,\x20%s',_0xc6040,_0x2cdcb2[_0x3188('0x17')]['message']);return _0x43b69(_0x2cdcb2['error'][_0x3188('0x19')]);}logger[_0x3188('0x17')](_0x3188('0x1a'),_0xc6040,_0x2cdcb2[_0x3188('0x17')][_0x3188('0x19')]);return _0x209e31(_0x2cdcb2[_0x3188('0x17')]['message']);}else{logger[_0x3188('0x1b')](_0x3188('0x1a'),_0xc6040,_0x3188('0x13'));_0x209e31(_0x2cdcb2[_0x3188('0x1c')][_0x3188('0x19')]);}})[_0x3188('0x1d')](function(_0xac7f48){logger[_0x3188('0x17')]('UserProfile,\x20%s,\x20%s',_0xc6040,_0xac7f48);_0x43b69(_0xac7f48);});});} \ No newline at end of file +var _0x3f8a=['code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','then','info','UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x1d9b72,_0x2ff0bd){var _0x1ace08=function(_0x37dcfd){while(--_0x37dcfd){_0x1d9b72['push'](_0x1d9b72['shift']());}};_0x1ace08(++_0x2ff0bd);}(_0x3f8a,0x1d5));var _0xa3f8=function(_0x41dc7f,_0x89a7ae){_0x41dc7f=_0x41dc7f-0x0;var _0x4d854a=_0x3f8a[_0x41dc7f];return _0x4d854a;};'use strict';var _=require(_0xa3f8('0x0'));var util=require(_0xa3f8('0x1'));var moment=require(_0xa3f8('0x2'));var BPromise=require(_0xa3f8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa3f8('0x4'));var db=require(_0xa3f8('0x5'))['db'];var utils=require(_0xa3f8('0x6'));var logger=require(_0xa3f8('0x7'))(_0xa3f8('0x8'));var config=require(_0xa3f8('0x9'));var jayson=require(_0xa3f8('0xa'));var client=jayson[_0xa3f8('0xb')][_0xa3f8('0xc')]({'port':0x232a});config[_0xa3f8('0xd')]=_[_0xa3f8('0xe')](config[_0xa3f8('0xd')],{'host':_0xa3f8('0xf'),'port':0x18eb});var socket=require(_0xa3f8('0x10'))(new Redis(config[_0xa3f8('0xd')]));require(_0xa3f8('0x11'))[_0xa3f8('0x12')](socket);function respondWithRpcPromise(_0x5c3288,_0x47496a,_0x13a082){return new BPromise(function(_0x3c1833,_0x22dcda){return client['request'](_0x5c3288,_0x13a082)[_0xa3f8('0x13')](function(_0x26f0a0){logger[_0xa3f8('0x14')](_0xa3f8('0x15'),_0x47496a,_0xa3f8('0x16'));logger[_0xa3f8('0x17')](_0xa3f8('0x18'),_0x47496a,_0xa3f8('0x16'),JSON[_0xa3f8('0x19')](_0x26f0a0));if(_0x26f0a0[_0xa3f8('0x1a')]){if(_0x26f0a0[_0xa3f8('0x1a')][_0xa3f8('0x1b')]===0x1f4){logger['error'](_0xa3f8('0x15'),_0x47496a,_0x26f0a0[_0xa3f8('0x1a')][_0xa3f8('0x1c')]);return _0x22dcda(_0x26f0a0[_0xa3f8('0x1a')]['message']);}logger[_0xa3f8('0x1a')](_0xa3f8('0x15'),_0x47496a,_0x26f0a0[_0xa3f8('0x1a')][_0xa3f8('0x1c')]);return _0x3c1833(_0x26f0a0[_0xa3f8('0x1a')][_0xa3f8('0x1c')]);}else{logger[_0xa3f8('0x14')](_0xa3f8('0x15'),_0x47496a,_0xa3f8('0x16'));_0x3c1833(_0x26f0a0[_0xa3f8('0x1d')]['message']);}})[_0xa3f8('0x1e')](function(_0x5a0e18){logger[_0xa3f8('0x1a')](_0xa3f8('0x15'),_0x47496a,_0x5a0e18);_0x22dcda(_0x5a0e18);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index 8252deb..45b7bda 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 _0x315f=['save','remove','update','removeListener','length','./userProfile.events'];(function(_0xb510a2,_0x3f25ab){var _0x54e721=function(_0xb2e87f){while(--_0xb2e87f){_0xb510a2['push'](_0xb510a2['shift']());}};_0x54e721(++_0x3f25ab);}(_0x315f,0xdd));var _0xf315=function(_0x671369,_0x433da5){_0x671369=_0x671369-0x0;var _0x33f2b4=_0x315f[_0x671369];return _0x33f2b4;};'use strict';var UserProfileEvents=require(_0xf315('0x0'));var events=[_0xf315('0x1'),_0xf315('0x2'),_0xf315('0x3')];function createListener(_0x3897ba,_0x2e6d33){return function(_0x23a746){_0x2e6d33['emit'](_0x3897ba,_0x23a746);};}function removeListener(_0x15cd66,_0x536edd){return function(){UserProfileEvents[_0xf315('0x4')](_0x15cd66,_0x536edd);};}exports['register']=function(_0x4951b6){for(var _0x5e793a=0x0,_0x4f9300=events[_0xf315('0x5')];_0x5e793a<_0x4f9300;_0x5e793a++){var _0x595122=events[_0x5e793a];var _0x4efd0f=createListener('userProfile:'+_0x595122,_0x4951b6);UserProfileEvents['on'](_0x595122,_0x4efd0f);}}; \ No newline at end of file +var _0x75cb=['register','length','./userProfile.events','save','emit','removeListener'];(function(_0x5df23f,_0x81e3fb){var _0x47ab2f=function(_0x7a1c51){while(--_0x7a1c51){_0x5df23f['push'](_0x5df23f['shift']());}};_0x47ab2f(++_0x81e3fb);}(_0x75cb,0x86));var _0xb75c=function(_0x2e47c1,_0x1bed12){_0x2e47c1=_0x2e47c1-0x0;var _0x1a0364=_0x75cb[_0x2e47c1];return _0x1a0364;};'use strict';var UserProfileEvents=require(_0xb75c('0x0'));var events=[_0xb75c('0x1'),'remove','update'];function createListener(_0x8dd6b5,_0x5de9ea){return function(_0x598fdc){_0x5de9ea[_0xb75c('0x2')](_0x8dd6b5,_0x598fdc);};}function removeListener(_0x558395,_0x259954){return function(){UserProfileEvents[_0xb75c('0x3')](_0x558395,_0x259954);};}exports[_0xb75c('0x4')]=function(_0xbef9e8){for(var _0x5d52ff=0x0,_0x324b61=events[_0xb75c('0x5')];_0x5d52ff<_0x324b61;_0x5d52ff++){var _0x3237af=events[_0x5d52ff];var _0x382604=createListener('userProfile:'+_0x3237af,_0xbef9e8);UserProfileEvents['on'](_0x3237af,_0x382604);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index e9d6576..1ed4913 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 _0x3d2f=['multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileResource.controller','isAuthenticated','index','get','/describe','/:id','show','create','put','update','exports'];(function(_0x3a274e,_0x25411b){var _0x526a06=function(_0x103c0f){while(--_0x103c0f){_0x3a274e['push'](_0x3a274e['shift']());}};_0x526a06(++_0x25411b);}(_0x3d2f,0x18f));var _0xf3d2=function(_0x3e0583,_0x4f0c7d){_0x3e0583=_0x3e0583-0x0;var _0x4f5045=_0x3d2f[_0x3e0583];return _0x4f5045;};'use strict';var multer=require(_0xf3d2('0x0'));var util=require(_0xf3d2('0x1'));var path=require('path');var timeout=require(_0xf3d2('0x2'));var express=require(_0xf3d2('0x3'));var router=express[_0xf3d2('0x4')]();var auth=require(_0xf3d2('0x5'));var interaction=require(_0xf3d2('0x6'));var config=require(_0xf3d2('0x7'));var controller=require(_0xf3d2('0x8'));router['get']('/',auth[_0xf3d2('0x9')](),controller[_0xf3d2('0xa')]);router[_0xf3d2('0xb')](_0xf3d2('0xc'),auth[_0xf3d2('0x9')](),controller['describe']);router[_0xf3d2('0xb')](_0xf3d2('0xd'),auth['isAuthenticated'](),controller[_0xf3d2('0xe')]);router['post']('/',auth[_0xf3d2('0x9')](),controller[_0xf3d2('0xf')]);router[_0xf3d2('0x10')](_0xf3d2('0xd'),auth[_0xf3d2('0x9')](),controller[_0xf3d2('0x11')]);router['delete'](_0xf3d2('0xd'),auth[_0xf3d2('0x9')](),controller['destroy']);module[_0xf3d2('0x12')]=router; \ No newline at end of file +var _0x6fd3=['index','/describe','describe','/:id','show','put','update','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./userProfileResource.controller','get','isAuthenticated'];(function(_0x6bd238,_0x43f7e6){var _0x4c9c63=function(_0x16c53f){while(--_0x16c53f){_0x6bd238['push'](_0x6bd238['shift']());}};_0x4c9c63(++_0x43f7e6);}(_0x6fd3,0x1ee));var _0x36fd=function(_0x4a82e6,_0x59daf7){_0x4a82e6=_0x4a82e6-0x0;var _0x412d95=_0x6fd3[_0x4a82e6];return _0x412d95;};'use strict';var multer=require(_0x36fd('0x0'));var util=require(_0x36fd('0x1'));var path=require(_0x36fd('0x2'));var timeout=require(_0x36fd('0x3'));var express=require(_0x36fd('0x4'));var router=express['Router']();var auth=require(_0x36fd('0x5'));var interaction=require(_0x36fd('0x6'));var config=require('../../config/environment');var controller=require(_0x36fd('0x7'));router[_0x36fd('0x8')]('/',auth[_0x36fd('0x9')](),controller[_0x36fd('0xa')]);router[_0x36fd('0x8')](_0x36fd('0xb'),auth[_0x36fd('0x9')](),controller[_0x36fd('0xc')]);router[_0x36fd('0x8')](_0x36fd('0xd'),auth[_0x36fd('0x9')](),controller[_0x36fd('0xe')]);router['post']('/',auth[_0x36fd('0x9')](),controller['create']);router[_0x36fd('0xf')]('/:id',auth[_0x36fd('0x9')](),controller[_0x36fd('0x10')]);router['delete'](_0x36fd('0xd'),auth[_0x36fd('0x9')](),controller['destroy']);module[_0x36fd('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 346e449..0229028 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 _0x12c9=['STRING','INTEGER','exports'];(function(_0x108a38,_0x945325){var _0x49aeef=function(_0x1dd31d){while(--_0x1dd31d){_0x108a38['push'](_0x108a38['shift']());}};_0x49aeef(++_0x945325);}(_0x12c9,0x13a));var _0x912c=function(_0x36ed67,_0x202027){_0x36ed67=_0x36ed67-0x0;var _0x1f6ce1=_0x12c9[_0x36ed67];return _0x1f6ce1;};'use strict';var Sequelize=require('sequelize');module[_0x912c('0x0')]={'name':{'type':Sequelize[_0x912c('0x1')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x912c('0x2')],'allowNull':![]},'type':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0xfbfd=['STRING','INTEGER','sequelize'];(function(_0x149b74,_0x21f7b2){var _0x22c6c9=function(_0x521413){while(--_0x521413){_0x149b74['push'](_0x149b74['shift']());}};_0x22c6c9(++_0x21f7b2);}(_0xfbfd,0x14c));var _0xdfbf=function(_0x2a7b8e,_0xd79ef3){_0x2a7b8e=_0x2a7b8e-0x0;var _0x1719c1=_0xfbfd[_0x2a7b8e];return _0x1719c1;};'use strict';var Sequelize=require(_0xdfbf('0x0'));module['exports']={'name':{'type':Sequelize[_0xdfbf('0x1')],'allowNull':![]},'resourceId':{'type':Sequelize[_0xdfbf('0x2')],'allowNull':![]},'type':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index 1f8b922..cbfd75c 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 _0xf180=['../../config/logger','../../config/environment','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','sendStatus','error','name','send','map','UserProfileResource','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','find','create','update','body','params','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xf180,0x116));var _0x0f18=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0xf180[_0x13ea00];return _0x1f7347;};'use strict';var pdf=require(_0x0f18('0x0'));var emlformat=require(_0x0f18('0x1'));var rimraf=require(_0x0f18('0x2'));var zipdir=require(_0x0f18('0x3'));var jsonpatch=require(_0x0f18('0x4'));var rp=require('request-promise');var moment=require(_0x0f18('0x5'));var BPromise=require(_0x0f18('0x6'));var Mustache=require(_0x0f18('0x7'));var util=require(_0x0f18('0x8'));var path=require('path');var sox=require(_0x0f18('0x9'));var csv=require('to-csv');var ejs=require(_0x0f18('0xa'));var fs=require('fs');var _=require(_0x0f18('0xb'));var squel=require('squel');var crypto=require(_0x0f18('0xc'));var jsforce=require(_0x0f18('0xd'));var deskjs=require(_0x0f18('0xe'));var toCsv=require(_0x0f18('0xf'));var querystring=require(_0x0f18('0x10'));var Papa=require(_0x0f18('0x11'));var Redis=require(_0x0f18('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x0f18('0x13'));var as=require(_0x0f18('0x14'));var hardwareService=require(_0x0f18('0x15'));var logger=require(_0x0f18('0x16'))('api');var utils=require('../../config/utils');var config=require(_0x0f18('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3a8e5b,_0x1189ae){_0x1189ae=_0x1189ae||0xcc;return function(_0x52f5bf){if(_0x52f5bf){return _0x3a8e5b['sendStatus'](_0x1189ae);}return _0x3a8e5b['status'](_0x1189ae)[_0x0f18('0x18')]();};}function respondWithResult(_0x160590,_0x2b804f){_0x2b804f=_0x2b804f||0xc8;return function(_0x21a86a){if(_0x21a86a){return _0x160590[_0x0f18('0x19')](_0x2b804f)[_0x0f18('0x1a')](_0x21a86a);}};}function respondWithFilteredResult(_0x3fc0a5,_0x5c212f){return function(_0x2f2e01){if(_0x2f2e01){var _0x5039dc=_0x2f2e01[_0x0f18('0x1b')],_0x25c8b1=_0x5c212f[_0x0f18('0x1c')],_0x1a3a60=_0x5c212f['offset']+_0x5c212f[_0x0f18('0x1d')],_0x5ec54e;if(_0x1a3a60>=_0x5039dc){_0x1a3a60=_0x5039dc;_0x5ec54e=0xc8;}else{_0x5ec54e=0xce;}_0x3fc0a5[_0x0f18('0x19')](_0x5ec54e);return _0x3fc0a5[_0x0f18('0x1e')](_0x0f18('0x1f'),_0x25c8b1+'-'+_0x1a3a60+'/'+_0x5039dc)[_0x0f18('0x1a')](_0x2f2e01);}return null;};}function patchUpdates(_0x3fe1e9){return function(_0x99d515){try{jsonpatch[_0x0f18('0x20')](_0x99d515,_0x3fe1e9,!![]);}catch(_0x3176d2){return BPromise[_0x0f18('0x21')](_0x3176d2);}return _0x99d515[_0x0f18('0x22')]();};}function saveUpdates(_0x5206b1,_0x2793ef){return function(_0x11bbdf){if(_0x11bbdf){return _0x11bbdf['update'](_0x5206b1)[_0x0f18('0x23')](function(_0x2393c2){return _0x2393c2;});}return null;};}function removeEntity(_0x31baae,_0xb4e513){return function(_0xfc96cb){if(_0xfc96cb){return _0xfc96cb[_0x0f18('0x24')]()[_0x0f18('0x23')](function(){_0x31baae[_0x0f18('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x188677,_0x53b56c){return function(_0x5cd021){if(!_0x5cd021){_0x188677[_0x0f18('0x25')](0x194);}return _0x5cd021;};}function handleError(_0x58bde9,_0x2ff371){_0x2ff371=_0x2ff371||0x1f4;return function(_0xfa49b4){logger[_0x0f18('0x26')](_0xfa49b4['stack']);if(_0xfa49b4[_0x0f18('0x27')]){delete _0xfa49b4[_0x0f18('0x27')];}_0x58bde9['status'](_0x2ff371)[_0x0f18('0x28')](_0xfa49b4);};}exports['index']=function(_0x4e9cc7,_0x1863f6){var _0x225abb={},_0x511766={},_0x2c095e={'count':0x0,'rows':[]};var _0x1ec9be=_[_0x0f18('0x29')](db[_0x0f18('0x2a')][_0x0f18('0x2b')],function(_0x555ceb){return{'name':_0x555ceb['fieldName'],'type':_0x555ceb[_0x0f18('0x2c')][_0x0f18('0x2d')]};});_0x511766[_0x0f18('0x2e')]=_['map'](_0x1ec9be,'name');_0x511766[_0x0f18('0x2f')]=_[_0x0f18('0x30')](_0x4e9cc7[_0x0f18('0x2f')]);_0x511766[_0x0f18('0x31')]=_['intersection'](_0x511766['model'],_0x511766[_0x0f18('0x2f')]);_0x225abb['attributes']=_[_0x0f18('0x32')](_0x511766[_0x0f18('0x2e')],qs[_0x0f18('0x33')](_0x4e9cc7['query'][_0x0f18('0x33')]));_0x225abb[_0x0f18('0x34')]=_0x225abb['attributes'][_0x0f18('0x35')]?_0x225abb[_0x0f18('0x34')]:_0x511766[_0x0f18('0x2e')];if(!_0x4e9cc7[_0x0f18('0x2f')][_0x0f18('0x36')](_0x0f18('0x37'))){_0x225abb[_0x0f18('0x1d')]=qs[_0x0f18('0x1d')](_0x4e9cc7[_0x0f18('0x2f')][_0x0f18('0x1d')]);_0x225abb[_0x0f18('0x1c')]=qs[_0x0f18('0x1c')](_0x4e9cc7['query'][_0x0f18('0x1c')]);}_0x225abb[_0x0f18('0x38')]=qs['sort'](_0x4e9cc7['query'][_0x0f18('0x39')]);_0x225abb[_0x0f18('0x3a')]=qs[_0x0f18('0x31')](_['pick'](_0x4e9cc7[_0x0f18('0x2f')],_0x511766[_0x0f18('0x31')]));if(_0x4e9cc7[_0x0f18('0x2f')][_0x0f18('0x3b')]){_0x225abb[_0x0f18('0x3a')]=_[_0x0f18('0x3c')](_0x225abb[_0x0f18('0x3a')],{'$or':_[_0x0f18('0x29')](_0x1ec9be,function(_0x4cab4f){if(_0x4cab4f[_0x0f18('0x2c')]!==_0x0f18('0x3d')){var _0xf2579d={};_0xf2579d[_0x4cab4f[_0x0f18('0x27')]]={'$like':'%'+_0x4e9cc7[_0x0f18('0x2f')][_0x0f18('0x3b')]+'%'};return _0xf2579d;}})});}_0x225abb=_[_0x0f18('0x3c')]({},_0x225abb,_0x4e9cc7[_0x0f18('0x3e')]);var _0x2412fa={'where':_0x225abb['where']};return db[_0x0f18('0x2a')]['count'](_0x2412fa)[_0x0f18('0x23')](function(_0x2409ea){_0x2c095e[_0x0f18('0x1b')]=_0x2409ea;if(_0x4e9cc7['query'][_0x0f18('0x3f')]){_0x225abb[_0x0f18('0x40')]=[{'all':!![]}];}return db['UserProfileResource'][_0x0f18('0x41')](_0x225abb);})[_0x0f18('0x23')](function(_0x2be77d){_0x2c095e[_0x0f18('0x42')]=_0x2be77d;return _0x2c095e;})['then'](respondWithFilteredResult(_0x1863f6,_0x225abb))[_0x0f18('0x43')](handleError(_0x1863f6,null));};exports[_0x0f18('0x44')]=function(_0x3015d2,_0x482a5d){var _0x5f3263={'raw':![],'where':{'id':_0x3015d2['params']['id']}},_0x5d41b4={};_0x5d41b4[_0x0f18('0x2e')]=_[_0x0f18('0x30')](db[_0x0f18('0x2a')]['rawAttributes']);_0x5d41b4[_0x0f18('0x2f')]=_['keys'](_0x3015d2[_0x0f18('0x2f')]);_0x5d41b4[_0x0f18('0x31')]=_[_0x0f18('0x32')](_0x5d41b4[_0x0f18('0x2e')],_0x5d41b4[_0x0f18('0x2f')]);_0x5f3263['attributes']=_[_0x0f18('0x32')](_0x5d41b4[_0x0f18('0x2e')],qs[_0x0f18('0x33')](_0x3015d2[_0x0f18('0x2f')][_0x0f18('0x33')]));_0x5f3263[_0x0f18('0x34')]=_0x5f3263[_0x0f18('0x34')]['length']?_0x5f3263[_0x0f18('0x34')]:_0x5d41b4[_0x0f18('0x2e')];if(_0x3015d2[_0x0f18('0x2f')][_0x0f18('0x3f')]){_0x5f3263[_0x0f18('0x40')]=[{'all':!![]}];}_0x5f3263=_['merge']({},_0x5f3263,_0x3015d2['options']);return db[_0x0f18('0x2a')][_0x0f18('0x45')](_0x5f3263)[_0x0f18('0x23')](handleEntityNotFound(_0x482a5d,null))[_0x0f18('0x23')](respondWithResult(_0x482a5d,null))[_0x0f18('0x43')](handleError(_0x482a5d,null));};exports[_0x0f18('0x46')]=function(_0x38c02d,_0x4cd9b5){return db['UserProfileResource'][_0x0f18('0x46')](_0x38c02d['body'],{})[_0x0f18('0x23')](respondWithResult(_0x4cd9b5,0xc9))[_0x0f18('0x43')](handleError(_0x4cd9b5,null));};exports[_0x0f18('0x47')]=function(_0x39acad,_0x122721){if(_0x39acad[_0x0f18('0x48')]['id']){delete _0x39acad[_0x0f18('0x48')]['id'];}return db[_0x0f18('0x2a')][_0x0f18('0x45')]({'where':{'id':_0x39acad[_0x0f18('0x49')]['id']}})[_0x0f18('0x23')](handleEntityNotFound(_0x122721,null))[_0x0f18('0x23')](saveUpdates(_0x39acad['body'],null))[_0x0f18('0x23')](respondWithResult(_0x122721,null))[_0x0f18('0x43')](handleError(_0x122721,null));};exports[_0x0f18('0x24')]=function(_0x4f4b6b,_0x2261e9){return db[_0x0f18('0x2a')][_0x0f18('0x45')]({'where':{'id':_0x4f4b6b['params']['id']}})[_0x0f18('0x23')](handleEntityNotFound(_0x2261e9,null))['then'](removeEntity(_0x2261e9,null))[_0x0f18('0x43')](handleError(_0x2261e9,null));};exports[_0x0f18('0x4a')]=function(_0x2fad5a,_0x46eba9){return db['UserProfileResource']['describe']()[_0x0f18('0x23')](respondWithResult(_0x46eba9,null))[_0x0f18('0x43')](handleError(_0x46eba9,null));}; \ No newline at end of file +var _0x2b58=['../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','Content-Range','apply','update','then','destroy','error','stack','name','send','index','type','key','model','map','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','limit','offset','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','UserProfileResource','includeAll','findAll','catch','show','params','rawAttributes','length','include','find','create','body','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x49f022,_0x5e1fb9){var _0x179c37=function(_0x3eafa1){while(--_0x3eafa1){_0x49f022['push'](_0x49f022['shift']());}};_0x179c37(++_0x5e1fb9);}(_0x2b58,0x1b3));var _0x82b5=function(_0x5a5e24,_0x57ed88){_0x5a5e24=_0x5a5e24-0x0;var _0x1f30a6=_0x2b58[_0x5a5e24];return _0x1f30a6;};'use strict';var pdf=require(_0x82b5('0x0'));var emlformat=require(_0x82b5('0x1'));var rimraf=require(_0x82b5('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x82b5('0x3'));var rp=require(_0x82b5('0x4'));var moment=require(_0x82b5('0x5'));var BPromise=require(_0x82b5('0x6'));var Mustache=require(_0x82b5('0x7'));var util=require(_0x82b5('0x8'));var path=require(_0x82b5('0x9'));var sox=require('sox');var csv=require(_0x82b5('0xa'));var ejs=require(_0x82b5('0xb'));var fs=require('fs');var _=require(_0x82b5('0xc'));var squel=require('squel');var crypto=require(_0x82b5('0xd'));var jsforce=require(_0x82b5('0xe'));var deskjs=require(_0x82b5('0xf'));var toCsv=require(_0x82b5('0xa'));var querystring=require(_0x82b5('0x10'));var Papa=require('papaparse');var Redis=require(_0x82b5('0x11'));var authService=require(_0x82b5('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x82b5('0x13'));var hardwareService=require(_0x82b5('0x14'));var logger=require(_0x82b5('0x15'))(_0x82b5('0x16'));var utils=require(_0x82b5('0x17'));var config=require(_0x82b5('0x18'));var db=require(_0x82b5('0x19'))['db'];function respondWithStatusCode(_0xd9f2eb,_0x7f4910){_0x7f4910=_0x7f4910||0xcc;return function(_0x50b49d){if(_0x50b49d){return _0xd9f2eb[_0x82b5('0x1a')](_0x7f4910);}return _0xd9f2eb[_0x82b5('0x1b')](_0x7f4910)[_0x82b5('0x1c')]();};}function respondWithResult(_0x563736,_0x2b2d3){_0x2b2d3=_0x2b2d3||0xc8;return function(_0x384341){if(_0x384341){return _0x563736[_0x82b5('0x1b')](_0x2b2d3)[_0x82b5('0x1d')](_0x384341);}};}function respondWithFilteredResult(_0x16803c,_0x1fd1c1){return function(_0x592e80){if(_0x592e80){var _0x4fb5f8=_0x592e80[_0x82b5('0x1e')],_0x32ca83=_0x1fd1c1['offset'],_0x40b7e7=_0x1fd1c1['offset']+_0x1fd1c1['limit'],_0x23d4db;if(_0x40b7e7>=_0x4fb5f8){_0x40b7e7=_0x4fb5f8;_0x23d4db=0xc8;}else{_0x23d4db=0xce;}_0x16803c[_0x82b5('0x1b')](_0x23d4db);return _0x16803c['set'](_0x82b5('0x1f'),_0x32ca83+'-'+_0x40b7e7+'/'+_0x4fb5f8)[_0x82b5('0x1d')](_0x592e80);}return null;};}function patchUpdates(_0x4204f6){return function(_0x3abafa){try{jsonpatch[_0x82b5('0x20')](_0x3abafa,_0x4204f6,!![]);}catch(_0x5417a2){return BPromise['reject'](_0x5417a2);}return _0x3abafa['save']();};}function saveUpdates(_0x1a309f,_0x54bdd0){return function(_0x3b1b1e){if(_0x3b1b1e){return _0x3b1b1e[_0x82b5('0x21')](_0x1a309f)[_0x82b5('0x22')](function(_0x18530){return _0x18530;});}return null;};}function removeEntity(_0x46f084,_0x430943){return function(_0x4dba6e){if(_0x4dba6e){return _0x4dba6e[_0x82b5('0x23')]()[_0x82b5('0x22')](function(){_0x46f084[_0x82b5('0x1b')](0xcc)[_0x82b5('0x1c')]();});}};}function handleEntityNotFound(_0x5620d7,_0x358b74){return function(_0x53800a){if(!_0x53800a){_0x5620d7[_0x82b5('0x1a')](0x194);}return _0x53800a;};}function handleError(_0x2aa51b,_0x16572){_0x16572=_0x16572||0x1f4;return function(_0x4c4e59){logger[_0x82b5('0x24')](_0x4c4e59[_0x82b5('0x25')]);if(_0x4c4e59[_0x82b5('0x26')]){delete _0x4c4e59[_0x82b5('0x26')];}_0x2aa51b[_0x82b5('0x1b')](_0x16572)[_0x82b5('0x27')](_0x4c4e59);};}exports[_0x82b5('0x28')]=function(_0x27c957,_0x512d34){var _0x24de21={},_0x348ebf={},_0x250f18={'count':0x0,'rows':[]};var _0x33a19f=_['map'](db['UserProfileResource']['rawAttributes'],function(_0x36bb18){return{'name':_0x36bb18['fieldName'],'type':_0x36bb18[_0x82b5('0x29')][_0x82b5('0x2a')]};});_0x348ebf[_0x82b5('0x2b')]=_[_0x82b5('0x2c')](_0x33a19f,_0x82b5('0x26'));_0x348ebf[_0x82b5('0x2d')]=_[_0x82b5('0x2e')](_0x27c957[_0x82b5('0x2d')]);_0x348ebf['filters']=_[_0x82b5('0x2f')](_0x348ebf['model'],_0x348ebf[_0x82b5('0x2d')]);_0x24de21[_0x82b5('0x30')]=_[_0x82b5('0x2f')](_0x348ebf[_0x82b5('0x2b')],qs['fields'](_0x27c957[_0x82b5('0x2d')][_0x82b5('0x31')]));_0x24de21['attributes']=_0x24de21['attributes']['length']?_0x24de21[_0x82b5('0x30')]:_0x348ebf[_0x82b5('0x2b')];if(!_0x27c957[_0x82b5('0x2d')][_0x82b5('0x32')](_0x82b5('0x33'))){_0x24de21['limit']=qs[_0x82b5('0x34')](_0x27c957[_0x82b5('0x2d')]['limit']);_0x24de21[_0x82b5('0x35')]=qs['offset'](_0x27c957[_0x82b5('0x2d')][_0x82b5('0x35')]);}_0x24de21[_0x82b5('0x36')]=qs[_0x82b5('0x37')](_0x27c957[_0x82b5('0x2d')][_0x82b5('0x37')]);_0x24de21[_0x82b5('0x38')]=qs[_0x82b5('0x39')](_[_0x82b5('0x3a')](_0x27c957[_0x82b5('0x2d')],_0x348ebf[_0x82b5('0x39')]));if(_0x27c957[_0x82b5('0x2d')][_0x82b5('0x3b')]){_0x24de21['where']=_[_0x82b5('0x3c')](_0x24de21[_0x82b5('0x38')],{'$or':_['map'](_0x33a19f,function(_0x22e322){if(_0x22e322[_0x82b5('0x29')]!==_0x82b5('0x3d')){var _0x336f43={};_0x336f43[_0x22e322[_0x82b5('0x26')]]={'$like':'%'+_0x27c957[_0x82b5('0x2d')][_0x82b5('0x3b')]+'%'};return _0x336f43;}})});}_0x24de21=_['merge']({},_0x24de21,_0x27c957[_0x82b5('0x3e')]);var _0x32a449={'where':_0x24de21[_0x82b5('0x38')]};return db[_0x82b5('0x3f')]['count'](_0x32a449)[_0x82b5('0x22')](function(_0x1c3a65){_0x250f18[_0x82b5('0x1e')]=_0x1c3a65;if(_0x27c957['query'][_0x82b5('0x40')]){_0x24de21['include']=[{'all':!![]}];}return db[_0x82b5('0x3f')][_0x82b5('0x41')](_0x24de21);})[_0x82b5('0x22')](function(_0x2a3237){_0x250f18['rows']=_0x2a3237;return _0x250f18;})[_0x82b5('0x22')](respondWithFilteredResult(_0x512d34,_0x24de21))[_0x82b5('0x42')](handleError(_0x512d34,null));};exports[_0x82b5('0x43')]=function(_0x7792d,_0x26540a){var _0x1e2e9e={'raw':![],'where':{'id':_0x7792d[_0x82b5('0x44')]['id']}},_0x20f89f={};_0x20f89f['model']=_['keys'](db[_0x82b5('0x3f')][_0x82b5('0x45')]);_0x20f89f[_0x82b5('0x2d')]=_['keys'](_0x7792d[_0x82b5('0x2d')]);_0x20f89f[_0x82b5('0x39')]=_[_0x82b5('0x2f')](_0x20f89f[_0x82b5('0x2b')],_0x20f89f[_0x82b5('0x2d')]);_0x1e2e9e[_0x82b5('0x30')]=_['intersection'](_0x20f89f[_0x82b5('0x2b')],qs[_0x82b5('0x31')](_0x7792d['query'][_0x82b5('0x31')]));_0x1e2e9e[_0x82b5('0x30')]=_0x1e2e9e[_0x82b5('0x30')][_0x82b5('0x46')]?_0x1e2e9e[_0x82b5('0x30')]:_0x20f89f[_0x82b5('0x2b')];if(_0x7792d[_0x82b5('0x2d')][_0x82b5('0x40')]){_0x1e2e9e[_0x82b5('0x47')]=[{'all':!![]}];}_0x1e2e9e=_[_0x82b5('0x3c')]({},_0x1e2e9e,_0x7792d[_0x82b5('0x3e')]);return db[_0x82b5('0x3f')][_0x82b5('0x48')](_0x1e2e9e)[_0x82b5('0x22')](handleEntityNotFound(_0x26540a,null))['then'](respondWithResult(_0x26540a,null))[_0x82b5('0x42')](handleError(_0x26540a,null));};exports['create']=function(_0x2a5723,_0x58f6e7){return db[_0x82b5('0x3f')][_0x82b5('0x49')](_0x2a5723[_0x82b5('0x4a')],{})[_0x82b5('0x22')](respondWithResult(_0x58f6e7,0xc9))['catch'](handleError(_0x58f6e7,null));};exports[_0x82b5('0x21')]=function(_0x531e17,_0x29b033){if(_0x531e17['body']['id']){delete _0x531e17['body']['id'];}return db[_0x82b5('0x3f')][_0x82b5('0x48')]({'where':{'id':_0x531e17[_0x82b5('0x44')]['id']}})[_0x82b5('0x22')](handleEntityNotFound(_0x29b033,null))[_0x82b5('0x22')](saveUpdates(_0x531e17['body'],null))['then'](respondWithResult(_0x29b033,null))['catch'](handleError(_0x29b033,null));};exports[_0x82b5('0x23')]=function(_0x4d4d97,_0x54c5da){return db[_0x82b5('0x3f')]['find']({'where':{'id':_0x4d4d97['params']['id']}})[_0x82b5('0x22')](handleEntityNotFound(_0x54c5da,null))['then'](removeEntity(_0x54c5da,null))[_0x82b5('0x42')](handleError(_0x54c5da,null));};exports[_0x82b5('0x4b')]=function(_0x372afe,_0x305a9a){return db[_0x82b5('0x3f')]['describe']()[_0x82b5('0x22')](respondWithResult(_0x305a9a,null))['catch'](handleError(_0x305a9a,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 954dd9c..92323a6 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 _0x570d=['sectionId','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./userProfileResource.attributes','exports','define','user_profile_has_resources','resourceId'];(function(_0x3eed3f,_0x5253b5){var _0xd68fd8=function(_0x3395c4){while(--_0x3395c4){_0x3eed3f['push'](_0x3eed3f['shift']());}};_0xd68fd8(++_0x5253b5);}(_0x570d,0x143));var _0xd570=function(_0x2e0ce0,_0x1f23eb){_0x2e0ce0=_0x2e0ce0-0x0;var _0x2f3dd7=_0x570d[_0x2e0ce0];return _0x2f3dd7;};'use strict';var _=require(_0xd570('0x0'));var util=require('util');var logger=require(_0xd570('0x1'))(_0xd570('0x2'));var moment=require(_0xd570('0x3'));var BPromise=require(_0xd570('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd570('0x5'));var rimraf=require(_0xd570('0x6'));var config=require(_0xd570('0x7'));var attributes=require(_0xd570('0x8'));module[_0xd570('0x9')]=function(_0x507c95,_0x3160a1){return _0x507c95[_0xd570('0xa')]('UserProfileResource',attributes,{'tableName':_0xd570('0xb'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0xd570('0xc'),_0xd570('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe02a=['../../config/environment','./userProfileResource.attributes','exports','define','UserProfileResource','user_profile_has_resources','compositeIndex','resourceId','lodash','../../config/logger','api','bluebird'];(function(_0x4154a6,_0x2c0b8e){var _0x3b2786=function(_0x2f5936){while(--_0x2f5936){_0x4154a6['push'](_0x4154a6['shift']());}};_0x3b2786(++_0x2c0b8e);}(_0xe02a,0x134));var _0xae02=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xe02a[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xae02('0x0'));var util=require('util');var logger=require(_0xae02('0x1'))(_0xae02('0x2'));var moment=require('moment');var BPromise=require(_0xae02('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xae02('0x4'));var attributes=require(_0xae02('0x5'));module[_0xae02('0x6')]=function(_0x15a501,_0x143834){return _0x15a501[_0xae02('0x7')](_0xae02('0x8'),attributes,{'tableName':_0xae02('0x9'),'paranoid':![],'indexes':[{'name':_0xae02('0xa'),'fields':[_0xae02('0xb'),'sectionId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index 97d334f..b49d5bc 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 _0xbf6f=['jayson/promise','client','request','UserProfileResource,\x20%s,\x20%s','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','lodash','util','moment','bluebird','randomstring','../../config/logger','rpc'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0xbf6f,0x175));var _0xfbf6=function(_0x522cba,_0x3cb8be){_0x522cba=_0x522cba-0x0;var _0x4a0876=_0xbf6f[_0x522cba];return _0x4a0876;};'use strict';var _=require(_0xfbf6('0x0'));var util=require(_0xfbf6('0x1'));var moment=require(_0xfbf6('0x2'));var BPromise=require(_0xfbf6('0x3'));var rs=require(_0xfbf6('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xfbf6('0x5'))(_0xfbf6('0x6'));var config=require('../../config/environment');var jayson=require(_0xfbf6('0x7'));var client=jayson[_0xfbf6('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x45f521,_0x4b6ce7,_0x3cebdc){return new BPromise(function(_0x5cdd71,_0x119600){return client[_0xfbf6('0x9')](_0x45f521,_0x3cebdc)['then'](function(_0x27a659){logger['info'](_0xfbf6('0xa'),_0x4b6ce7,'request\x20sent');logger[_0xfbf6('0xb')](_0xfbf6('0xc'),_0x4b6ce7,_0xfbf6('0xd'),JSON[_0xfbf6('0xe')](_0x27a659));if(_0x27a659[_0xfbf6('0xf')]){if(_0x27a659['error'][_0xfbf6('0x10')]===0x1f4){logger[_0xfbf6('0xf')](_0xfbf6('0xa'),_0x4b6ce7,_0x27a659[_0xfbf6('0xf')][_0xfbf6('0x11')]);return _0x119600(_0x27a659[_0xfbf6('0xf')][_0xfbf6('0x11')]);}logger['error']('UserProfileResource,\x20%s,\x20%s',_0x4b6ce7,_0x27a659['error'][_0xfbf6('0x11')]);return _0x5cdd71(_0x27a659[_0xfbf6('0xf')]['message']);}else{logger[_0xfbf6('0x12')]('UserProfileResource,\x20%s,\x20%s',_0x4b6ce7,_0xfbf6('0xd'));_0x5cdd71(_0x27a659['result']['message']);}})['catch'](function(_0x2d5a89){logger[_0xfbf6('0xf')]('UserProfileResource,\x20%s,\x20%s',_0x4b6ce7,_0x2d5a89);_0x119600(_0x2d5a89);});});} \ No newline at end of file +var _0xe35e=['then','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','ioredis','../../config/logger','rpc','../../config/environment','request'];(function(_0x351527,_0x11badf){var _0x2559db=function(_0x2fb56c){while(--_0x2fb56c){_0x351527['push'](_0x351527['shift']());}};_0x2559db(++_0x11badf);}(_0xe35e,0x187));var _0xee35=function(_0x1db831,_0x42b7b5){_0x1db831=_0x1db831-0x0;var _0x39ba56=_0xe35e[_0x1db831];return _0x39ba56;};'use strict';var _=require(_0xee35('0x0'));var util=require(_0xee35('0x1'));var moment=require(_0xee35('0x2'));var BPromise=require(_0xee35('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xee35('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xee35('0x5'))(_0xee35('0x6'));var config=require(_0xee35('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x43d673,_0x5da336,_0x9a5c1f){return new BPromise(function(_0xaa5c73,_0x2f9765){return client[_0xee35('0x8')](_0x43d673,_0x9a5c1f)[_0xee35('0x9')](function(_0x2b8512){logger[_0xee35('0xa')](_0xee35('0xb'),_0x5da336,_0xee35('0xc'));logger[_0xee35('0xd')](_0xee35('0xe'),_0x5da336,_0xee35('0xc'),JSON[_0xee35('0xf')](_0x2b8512));if(_0x2b8512['error']){if(_0x2b8512[_0xee35('0x10')][_0xee35('0x11')]===0x1f4){logger['error'](_0xee35('0xb'),_0x5da336,_0x2b8512['error']['message']);return _0x2f9765(_0x2b8512[_0xee35('0x10')][_0xee35('0x12')]);}logger[_0xee35('0x10')](_0xee35('0xb'),_0x5da336,_0x2b8512[_0xee35('0x10')][_0xee35('0x12')]);return _0xaa5c73(_0x2b8512[_0xee35('0x10')]['message']);}else{logger[_0xee35('0xa')]('UserProfileResource,\x20%s,\x20%s',_0x5da336,_0xee35('0xc'));_0xaa5c73(_0x2b8512[_0xee35('0x13')][_0xee35('0x12')]);}})['catch'](function(_0xc8110d){logger[_0xee35('0x10')](_0xee35('0xb'),_0x5da336,_0xc8110d);_0x2f9765(_0xc8110d);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 292ca2d..0d12ad6 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 _0x11ab=['delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./userProfileSection.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create','put','update'];(function(_0x2509f1,_0x5c9f8c){var _0x410842=function(_0x1b1eeb){while(--_0x1b1eeb){_0x2509f1['push'](_0x2509f1['shift']());}};_0x410842(++_0x5c9f8c);}(_0x11ab,0xf5));var _0xb11a=function(_0x1c7554,_0x526015){_0x1c7554=_0x1c7554-0x0;var _0xbe335c=_0x11ab[_0x1c7554];return _0xbe335c;};'use strict';var multer=require(_0xb11a('0x0'));var util=require(_0xb11a('0x1'));var path=require(_0xb11a('0x2'));var timeout=require(_0xb11a('0x3'));var express=require(_0xb11a('0x4'));var router=express[_0xb11a('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xb11a('0x6'));var config=require(_0xb11a('0x7'));var controller=require(_0xb11a('0x8'));router[_0xb11a('0x9')]('/',auth[_0xb11a('0xa')](),controller[_0xb11a('0xb')]);router[_0xb11a('0x9')](_0xb11a('0xc'),auth[_0xb11a('0xa')](),controller[_0xb11a('0xd')]);router[_0xb11a('0x9')](_0xb11a('0xe'),auth[_0xb11a('0xa')](),controller[_0xb11a('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0xb11a('0x10')]);router[_0xb11a('0x11')]('/:id',auth[_0xb11a('0xa')](),controller[_0xb11a('0x12')]);router[_0xb11a('0x13')](_0xb11a('0xe'),auth['isAuthenticated'](),controller[_0xb11a('0x14')]);module[_0xb11a('0x15')]=router; \ No newline at end of file +var _0x7fc4=['index','describe','/:id','show','put','update','delete','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileSection.controller','isAuthenticated'];(function(_0x4caaa7,_0x34575f){var _0x112aab=function(_0x3c4e03){while(--_0x3c4e03){_0x4caaa7['push'](_0x4caaa7['shift']());}};_0x112aab(++_0x34575f);}(_0x7fc4,0x14c));var _0x47fc=function(_0xdb162d,_0x50229d){_0xdb162d=_0xdb162d-0x0;var _0x2304a9=_0x7fc4[_0xdb162d];return _0x2304a9;};'use strict';var multer=require(_0x47fc('0x0'));var util=require(_0x47fc('0x1'));var path=require(_0x47fc('0x2'));var timeout=require(_0x47fc('0x3'));var express=require(_0x47fc('0x4'));var router=express['Router']();var auth=require(_0x47fc('0x5'));var interaction=require(_0x47fc('0x6'));var config=require(_0x47fc('0x7'));var controller=require(_0x47fc('0x8'));router['get']('/',auth[_0x47fc('0x9')](),controller[_0x47fc('0xa')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x47fc('0xb')]);router['get'](_0x47fc('0xc'),auth[_0x47fc('0x9')](),controller[_0x47fc('0xd')]);router['post']('/',auth[_0x47fc('0x9')](),controller['create']);router[_0x47fc('0xe')](_0x47fc('0xc'),auth[_0x47fc('0x9')](),controller[_0x47fc('0xf')]);router[_0x47fc('0x10')](_0x47fc('0xc'),auth[_0x47fc('0x9')](),controller['destroy']);module[_0x47fc('0x11')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index a21d4b5..1d8df76 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 _0xe920=['sequelize','exports','STRING','INTEGER','BOOLEAN','setDataValue','join','crudPermissions','getDataValue','split'];(function(_0x320c55,_0x43ce58){var _0x42471b=function(_0x4b1777){while(--_0x4b1777){_0x320c55['push'](_0x320c55['shift']());}};_0x42471b(++_0x43ce58);}(_0xe920,0xbe));var _0x0e92=function(_0x52b7b9,_0x43ed4b){_0x52b7b9=_0x52b7b9-0x0;var _0x5b5d30=_0xe920[_0x52b7b9];return _0x5b5d30;};'use strict';var Sequelize=require(_0x0e92('0x0'));module[_0x0e92('0x1')]={'name':{'type':Sequelize[_0x0e92('0x2')],'allowNull':![]},'category':{'type':Sequelize[_0x0e92('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x0e92('0x3')],'allowNull':![]},'enabled':{'type':Sequelize[_0x0e92('0x4')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x0e92('0x4')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x0e92('0x2')],'set':function(_0xfaa87e){this[_0x0e92('0x5')]('crudPermissions',_0xfaa87e?_0xfaa87e[_0x0e92('0x6')](''):[]);},'get':function(){return this['getDataValue'](_0x0e92('0x7'))?this[_0x0e92('0x8')](_0x0e92('0x7'))[_0x0e92('0x9')](''):[];}}}; \ No newline at end of file +var _0x61df=['setDataValue','crudPermissions','join','getDataValue','split','STRING','INTEGER','BOOLEAN'];(function(_0x5e7cfc,_0x351ef1){var _0x2708d7=function(_0x5c4e4c){while(--_0x5c4e4c){_0x5e7cfc['push'](_0x5e7cfc['shift']());}};_0x2708d7(++_0x351ef1);}(_0x61df,0xbd));var _0xf61d=function(_0x47e019,_0x4c577c){_0x47e019=_0x47e019-0x0;var _0x3ab2da=_0x61df[_0x47e019];return _0x3ab2da;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'category':{'type':Sequelize[_0xf61d('0x0')],'allowNull':![]},'sectionId':{'type':Sequelize[_0xf61d('0x1')],'allowNull':![]},'enabled':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0xf61d('0x2')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0xf61d('0x0')],'set':function(_0x485a55){this[_0xf61d('0x3')](_0xf61d('0x4'),_0x485a55?_0x485a55[_0xf61d('0x5')](''):[]);},'get':function(){return this[_0xf61d('0x6')](_0xf61d('0x4'))?this[_0xf61d('0x6')]('crudPermissions')[_0xf61d('0x7')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index c8348af..6dc0336 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 _0x05a0=['send','map','UserProfileSection','fieldName','type','key','model','query','intersection','fields','attributes','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','keys','length','include','find','create','body','destroy','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','reject','save','update','then','error','stack','name'];(function(_0x585f97,_0x19bc7f){var _0x18e83c=function(_0x4df44d){while(--_0x4df44d){_0x585f97['push'](_0x585f97['shift']());}};_0x18e83c(++_0x19bc7f);}(_0x05a0,0xb5));var _0x005a=function(_0x11e3c3,_0x12dacb){_0x11e3c3=_0x11e3c3-0x0;var _0x232d60=_0x05a0[_0x11e3c3];return _0x232d60;};'use strict';var pdf=require(_0x005a('0x0'));var emlformat=require(_0x005a('0x1'));var rimraf=require(_0x005a('0x2'));var zipdir=require(_0x005a('0x3'));var jsonpatch=require(_0x005a('0x4'));var rp=require(_0x005a('0x5'));var moment=require('moment');var BPromise=require(_0x005a('0x6'));var Mustache=require(_0x005a('0x7'));var util=require('util');var path=require('path');var sox=require(_0x005a('0x8'));var csv=require(_0x005a('0x9'));var ejs=require(_0x005a('0xa'));var fs=require('fs');var _=require(_0x005a('0xb'));var squel=require(_0x005a('0xc'));var crypto=require(_0x005a('0xd'));var jsforce=require(_0x005a('0xe'));var deskjs=require(_0x005a('0xf'));var toCsv=require(_0x005a('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x005a('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x005a('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x005a('0x12'))(_0x005a('0x13'));var utils=require(_0x005a('0x14'));var config=require(_0x005a('0x15'));var db=require(_0x005a('0x16'))['db'];function respondWithStatusCode(_0x41c755,_0x245b1d){_0x245b1d=_0x245b1d||0xcc;return function(_0x12d374){if(_0x12d374){return _0x41c755[_0x005a('0x17')](_0x245b1d);}return _0x41c755[_0x005a('0x18')](_0x245b1d)[_0x005a('0x19')]();};}function respondWithResult(_0x167ef2,_0x2cdbb9){_0x2cdbb9=_0x2cdbb9||0xc8;return function(_0x2684a5){if(_0x2684a5){return _0x167ef2[_0x005a('0x18')](_0x2cdbb9)[_0x005a('0x1a')](_0x2684a5);}};}function respondWithFilteredResult(_0x248061,_0xe23c30){return function(_0x39fbdf){if(_0x39fbdf){var _0x25dc00=_0x39fbdf['count'],_0x5e9d8a=_0xe23c30[_0x005a('0x1b')],_0x174866=_0xe23c30['offset']+_0xe23c30[_0x005a('0x1c')],_0x123b08;if(_0x174866>=_0x25dc00){_0x174866=_0x25dc00;_0x123b08=0xc8;}else{_0x123b08=0xce;}_0x248061[_0x005a('0x18')](_0x123b08);return _0x248061[_0x005a('0x1d')](_0x005a('0x1e'),_0x5e9d8a+'-'+_0x174866+'/'+_0x25dc00)['json'](_0x39fbdf);}return null;};}function patchUpdates(_0x23c439){return function(_0x376bf9){try{jsonpatch['apply'](_0x376bf9,_0x23c439,!![]);}catch(_0x487cc2){return BPromise[_0x005a('0x1f')](_0x487cc2);}return _0x376bf9[_0x005a('0x20')]();};}function saveUpdates(_0xa5a6b,_0x3b7577){return function(_0x4c09c5){if(_0x4c09c5){return _0x4c09c5[_0x005a('0x21')](_0xa5a6b)[_0x005a('0x22')](function(_0x169f7f){return _0x169f7f;});}return null;};}function removeEntity(_0x262dff,_0x204d44){return function(_0x5156d2){if(_0x5156d2){return _0x5156d2['destroy']()[_0x005a('0x22')](function(){_0x262dff[_0x005a('0x18')](0xcc)[_0x005a('0x19')]();});}};}function handleEntityNotFound(_0xf5143,_0x5d512c){return function(_0x395ff6){if(!_0x395ff6){_0xf5143[_0x005a('0x17')](0x194);}return _0x395ff6;};}function handleError(_0x31e3e0,_0x36ab20){_0x36ab20=_0x36ab20||0x1f4;return function(_0x4ca46f){logger[_0x005a('0x23')](_0x4ca46f[_0x005a('0x24')]);if(_0x4ca46f[_0x005a('0x25')]){delete _0x4ca46f[_0x005a('0x25')];}_0x31e3e0[_0x005a('0x18')](_0x36ab20)[_0x005a('0x26')](_0x4ca46f);};}exports['index']=function(_0x4a22e3,_0x54b7f4){var _0x40ef35={},_0xbc3a47={},_0xb6dcf0={'count':0x0,'rows':[]};var _0x2df0c0=_[_0x005a('0x27')](db[_0x005a('0x28')]['rawAttributes'],function(_0xc77c7c){return{'name':_0xc77c7c[_0x005a('0x29')],'type':_0xc77c7c[_0x005a('0x2a')][_0x005a('0x2b')]};});_0xbc3a47[_0x005a('0x2c')]=_[_0x005a('0x27')](_0x2df0c0,_0x005a('0x25'));_0xbc3a47[_0x005a('0x2d')]=_['keys'](_0x4a22e3[_0x005a('0x2d')]);_0xbc3a47['filters']=_[_0x005a('0x2e')](_0xbc3a47[_0x005a('0x2c')],_0xbc3a47[_0x005a('0x2d')]);_0x40ef35['attributes']=_[_0x005a('0x2e')](_0xbc3a47['model'],qs[_0x005a('0x2f')](_0x4a22e3[_0x005a('0x2d')][_0x005a('0x2f')]));_0x40ef35[_0x005a('0x30')]=_0x40ef35[_0x005a('0x30')]['length']?_0x40ef35['attributes']:_0xbc3a47['model'];if(!_0x4a22e3[_0x005a('0x2d')][_0x005a('0x31')]('nolimit')){_0x40ef35['limit']=qs[_0x005a('0x1c')](_0x4a22e3[_0x005a('0x2d')][_0x005a('0x1c')]);_0x40ef35[_0x005a('0x1b')]=qs[_0x005a('0x1b')](_0x4a22e3[_0x005a('0x2d')][_0x005a('0x1b')]);}_0x40ef35[_0x005a('0x32')]=qs[_0x005a('0x33')](_0x4a22e3[_0x005a('0x2d')][_0x005a('0x33')]);_0x40ef35[_0x005a('0x34')]=qs[_0x005a('0x35')](_[_0x005a('0x36')](_0x4a22e3[_0x005a('0x2d')],_0xbc3a47[_0x005a('0x35')]));if(_0x4a22e3[_0x005a('0x2d')][_0x005a('0x37')]){_0x40ef35[_0x005a('0x34')]=_[_0x005a('0x38')](_0x40ef35[_0x005a('0x34')],{'$or':_[_0x005a('0x27')](_0x2df0c0,function(_0x551f94){if(_0x551f94[_0x005a('0x2a')]!==_0x005a('0x39')){var _0x2c6b07={};_0x2c6b07[_0x551f94[_0x005a('0x25')]]={'$like':'%'+_0x4a22e3[_0x005a('0x2d')][_0x005a('0x37')]+'%'};return _0x2c6b07;}})});}_0x40ef35=_[_0x005a('0x38')]({},_0x40ef35,_0x4a22e3[_0x005a('0x3a')]);var _0x28c657={'where':_0x40ef35[_0x005a('0x34')]};return db['UserProfileSection']['count'](_0x28c657)['then'](function(_0x349847){_0xb6dcf0['count']=_0x349847;if(_0x4a22e3['query'][_0x005a('0x3b')]){_0x40ef35['include']=[{'all':!![]}];}return db[_0x005a('0x28')][_0x005a('0x3c')](_0x40ef35);})[_0x005a('0x22')](function(_0x74e86f){_0xb6dcf0[_0x005a('0x3d')]=_0x74e86f;return _0xb6dcf0;})[_0x005a('0x22')](respondWithFilteredResult(_0x54b7f4,_0x40ef35))[_0x005a('0x3e')](handleError(_0x54b7f4,null));};exports[_0x005a('0x3f')]=function(_0x39ad73,_0x3af6d6){var _0x2f1386={'raw':![],'where':{'id':_0x39ad73[_0x005a('0x40')]['id']}},_0x4acd8a={};_0x4acd8a[_0x005a('0x2c')]=_[_0x005a('0x41')](db[_0x005a('0x28')]['rawAttributes']);_0x4acd8a[_0x005a('0x2d')]=_['keys'](_0x39ad73['query']);_0x4acd8a[_0x005a('0x35')]=_[_0x005a('0x2e')](_0x4acd8a[_0x005a('0x2c')],_0x4acd8a[_0x005a('0x2d')]);_0x2f1386[_0x005a('0x30')]=_['intersection'](_0x4acd8a[_0x005a('0x2c')],qs[_0x005a('0x2f')](_0x39ad73[_0x005a('0x2d')][_0x005a('0x2f')]));_0x2f1386[_0x005a('0x30')]=_0x2f1386['attributes'][_0x005a('0x42')]?_0x2f1386['attributes']:_0x4acd8a[_0x005a('0x2c')];if(_0x39ad73[_0x005a('0x2d')]['includeAll']){_0x2f1386[_0x005a('0x43')]=[{'all':!![]}];}_0x2f1386=_[_0x005a('0x38')]({},_0x2f1386,_0x39ad73[_0x005a('0x3a')]);return db[_0x005a('0x28')][_0x005a('0x44')](_0x2f1386)[_0x005a('0x22')](handleEntityNotFound(_0x3af6d6,null))[_0x005a('0x22')](respondWithResult(_0x3af6d6,null))[_0x005a('0x3e')](handleError(_0x3af6d6,null));};exports[_0x005a('0x45')]=function(_0x45500d,_0x244920){return db[_0x005a('0x28')][_0x005a('0x45')](_0x45500d[_0x005a('0x46')],{})[_0x005a('0x22')](respondWithResult(_0x244920,0xc9))[_0x005a('0x3e')](handleError(_0x244920,null));};exports[_0x005a('0x21')]=function(_0x4c10e4,_0x2adcee){if(_0x4c10e4[_0x005a('0x46')]['id']){delete _0x4c10e4[_0x005a('0x46')]['id'];}return db[_0x005a('0x28')][_0x005a('0x44')]({'where':{'id':_0x4c10e4[_0x005a('0x40')]['id']}})['then'](handleEntityNotFound(_0x2adcee,null))[_0x005a('0x22')](saveUpdates(_0x4c10e4['body'],null))[_0x005a('0x22')](respondWithResult(_0x2adcee,null))[_0x005a('0x3e')](handleError(_0x2adcee,null));};exports[_0x005a('0x47')]=function(_0xf00122,_0x6d4f80){return db[_0x005a('0x28')][_0x005a('0x44')]({'where':{'id':_0xf00122['params']['id']}})[_0x005a('0x22')](handleEntityNotFound(_0x6d4f80,null))[_0x005a('0x22')](removeEntity(_0x6d4f80,null))[_0x005a('0x3e')](handleError(_0x6d4f80,null));};exports[_0x005a('0x48')]=function(_0x4de8ab,_0x2c5979){return db['UserProfileSection']['describe']()['then'](respondWithResult(_0x2c5979,null))['catch'](handleError(_0x2c5979,null));}; \ No newline at end of file +var _0xb468=['destroy','end','error','name','send','index','map','UserProfileSection','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','rows','catch','show','params','rawAttributes','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','count','offset','limit','set','Content-Range','json','apply','update','then'];(function(_0x17406a,_0x1e2320){var _0x1501ff=function(_0x4b075a){while(--_0x4b075a){_0x17406a['push'](_0x17406a['shift']());}};_0x1501ff(++_0x1e2320);}(_0xb468,0x1e8));var _0x8b46=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xb468[_0x2b4411];return _0x8e41ef;};'use strict';var pdf=require(_0x8b46('0x0'));var emlformat=require(_0x8b46('0x1'));var rimraf=require(_0x8b46('0x2'));var zipdir=require(_0x8b46('0x3'));var jsonpatch=require(_0x8b46('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x8b46('0x5'));var Mustache=require(_0x8b46('0x6'));var util=require(_0x8b46('0x7'));var path=require(_0x8b46('0x8'));var sox=require(_0x8b46('0x9'));var csv=require(_0x8b46('0xa'));var ejs=require(_0x8b46('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x8b46('0xc'));var crypto=require('crypto');var jsforce=require(_0x8b46('0xd'));var deskjs=require(_0x8b46('0xe'));var toCsv=require('to-csv');var querystring=require(_0x8b46('0xf'));var Papa=require(_0x8b46('0x10'));var Redis=require(_0x8b46('0x11'));var authService=require(_0x8b46('0x12'));var qs=require(_0x8b46('0x13'));var as=require(_0x8b46('0x14'));var hardwareService=require(_0x8b46('0x15'));var logger=require(_0x8b46('0x16'))(_0x8b46('0x17'));var utils=require(_0x8b46('0x18'));var config=require(_0x8b46('0x19'));var db=require(_0x8b46('0x1a'))['db'];function respondWithStatusCode(_0x5c3d0f,_0x5a3884){_0x5a3884=_0x5a3884||0xcc;return function(_0x45af41){if(_0x45af41){return _0x5c3d0f['sendStatus'](_0x5a3884);}return _0x5c3d0f[_0x8b46('0x1b')](_0x5a3884)['end']();};}function respondWithResult(_0x11b669,_0x18f3e6){_0x18f3e6=_0x18f3e6||0xc8;return function(_0x329818){if(_0x329818){return _0x11b669[_0x8b46('0x1b')](_0x18f3e6)['json'](_0x329818);}};}function respondWithFilteredResult(_0x26a50e,_0x38ac0d){return function(_0x5cac13){if(_0x5cac13){var _0xb8e93a=_0x5cac13[_0x8b46('0x1c')],_0x48ae8b=_0x38ac0d[_0x8b46('0x1d')],_0x85d2ba=_0x38ac0d['offset']+_0x38ac0d[_0x8b46('0x1e')],_0x50993e;if(_0x85d2ba>=_0xb8e93a){_0x85d2ba=_0xb8e93a;_0x50993e=0xc8;}else{_0x50993e=0xce;}_0x26a50e[_0x8b46('0x1b')](_0x50993e);return _0x26a50e[_0x8b46('0x1f')](_0x8b46('0x20'),_0x48ae8b+'-'+_0x85d2ba+'/'+_0xb8e93a)[_0x8b46('0x21')](_0x5cac13);}return null;};}function patchUpdates(_0x179190){return function(_0x24d19b){try{jsonpatch[_0x8b46('0x22')](_0x24d19b,_0x179190,!![]);}catch(_0x55df07){return BPromise['reject'](_0x55df07);}return _0x24d19b['save']();};}function saveUpdates(_0x20f213,_0x250a6b){return function(_0x50bc18){if(_0x50bc18){return _0x50bc18[_0x8b46('0x23')](_0x20f213)[_0x8b46('0x24')](function(_0x46a755){return _0x46a755;});}return null;};}function removeEntity(_0x4b5d23,_0x49f1f1){return function(_0x2aa72a){if(_0x2aa72a){return _0x2aa72a[_0x8b46('0x25')]()[_0x8b46('0x24')](function(){_0x4b5d23[_0x8b46('0x1b')](0xcc)[_0x8b46('0x26')]();});}};}function handleEntityNotFound(_0x39274e,_0x2d202f){return function(_0x46afd4){if(!_0x46afd4){_0x39274e['sendStatus'](0x194);}return _0x46afd4;};}function handleError(_0xa460d7,_0x4a8019){_0x4a8019=_0x4a8019||0x1f4;return function(_0x4632ad){logger[_0x8b46('0x27')](_0x4632ad['stack']);if(_0x4632ad[_0x8b46('0x28')]){delete _0x4632ad[_0x8b46('0x28')];}_0xa460d7[_0x8b46('0x1b')](_0x4a8019)[_0x8b46('0x29')](_0x4632ad);};}exports[_0x8b46('0x2a')]=function(_0x2298c0,_0x5a7276){var _0x35add3={},_0x280b59={},_0x3dccb9={'count':0x0,'rows':[]};var _0x31adfb=_[_0x8b46('0x2b')](db[_0x8b46('0x2c')]['rawAttributes'],function(_0x107bee){return{'name':_0x107bee[_0x8b46('0x2d')],'type':_0x107bee[_0x8b46('0x2e')][_0x8b46('0x2f')]};});_0x280b59['model']=_[_0x8b46('0x2b')](_0x31adfb,_0x8b46('0x28'));_0x280b59[_0x8b46('0x30')]=_[_0x8b46('0x31')](_0x2298c0[_0x8b46('0x30')]);_0x280b59[_0x8b46('0x32')]=_[_0x8b46('0x33')](_0x280b59[_0x8b46('0x34')],_0x280b59['query']);_0x35add3[_0x8b46('0x35')]=_[_0x8b46('0x33')](_0x280b59[_0x8b46('0x34')],qs['fields'](_0x2298c0[_0x8b46('0x30')][_0x8b46('0x36')]));_0x35add3[_0x8b46('0x35')]=_0x35add3['attributes'][_0x8b46('0x37')]?_0x35add3[_0x8b46('0x35')]:_0x280b59[_0x8b46('0x34')];if(!_0x2298c0[_0x8b46('0x30')][_0x8b46('0x38')](_0x8b46('0x39'))){_0x35add3[_0x8b46('0x1e')]=qs[_0x8b46('0x1e')](_0x2298c0[_0x8b46('0x30')][_0x8b46('0x1e')]);_0x35add3[_0x8b46('0x1d')]=qs[_0x8b46('0x1d')](_0x2298c0[_0x8b46('0x30')][_0x8b46('0x1d')]);}_0x35add3['order']=qs['sort'](_0x2298c0[_0x8b46('0x30')][_0x8b46('0x3a')]);_0x35add3[_0x8b46('0x3b')]=qs['filters'](_[_0x8b46('0x3c')](_0x2298c0['query'],_0x280b59[_0x8b46('0x32')]));if(_0x2298c0[_0x8b46('0x30')][_0x8b46('0x3d')]){_0x35add3[_0x8b46('0x3b')]=_['merge'](_0x35add3[_0x8b46('0x3b')],{'$or':_[_0x8b46('0x2b')](_0x31adfb,function(_0x11ba10){if(_0x11ba10[_0x8b46('0x2e')]!==_0x8b46('0x3e')){var _0x2a655e={};_0x2a655e[_0x11ba10[_0x8b46('0x28')]]={'$like':'%'+_0x2298c0['query'][_0x8b46('0x3d')]+'%'};return _0x2a655e;}})});}_0x35add3=_[_0x8b46('0x3f')]({},_0x35add3,_0x2298c0['options']);var _0x1592b6={'where':_0x35add3[_0x8b46('0x3b')]};return db[_0x8b46('0x2c')][_0x8b46('0x1c')](_0x1592b6)['then'](function(_0x1d5300){_0x3dccb9['count']=_0x1d5300;if(_0x2298c0[_0x8b46('0x30')][_0x8b46('0x40')]){_0x35add3[_0x8b46('0x41')]=[{'all':!![]}];}return db[_0x8b46('0x2c')]['findAll'](_0x35add3);})[_0x8b46('0x24')](function(_0x301b3c){_0x3dccb9[_0x8b46('0x42')]=_0x301b3c;return _0x3dccb9;})[_0x8b46('0x24')](respondWithFilteredResult(_0x5a7276,_0x35add3))[_0x8b46('0x43')](handleError(_0x5a7276,null));};exports[_0x8b46('0x44')]=function(_0x1f05c7,_0x48a672){var _0x4635b9={'raw':![],'where':{'id':_0x1f05c7[_0x8b46('0x45')]['id']}},_0x3243f0={};_0x3243f0[_0x8b46('0x34')]=_[_0x8b46('0x31')](db[_0x8b46('0x2c')][_0x8b46('0x46')]);_0x3243f0[_0x8b46('0x30')]=_['keys'](_0x1f05c7[_0x8b46('0x30')]);_0x3243f0[_0x8b46('0x32')]=_['intersection'](_0x3243f0[_0x8b46('0x34')],_0x3243f0[_0x8b46('0x30')]);_0x4635b9[_0x8b46('0x35')]=_['intersection'](_0x3243f0[_0x8b46('0x34')],qs[_0x8b46('0x36')](_0x1f05c7[_0x8b46('0x30')]['fields']));_0x4635b9[_0x8b46('0x35')]=_0x4635b9[_0x8b46('0x35')][_0x8b46('0x37')]?_0x4635b9[_0x8b46('0x35')]:_0x3243f0[_0x8b46('0x34')];if(_0x1f05c7['query'][_0x8b46('0x40')]){_0x4635b9[_0x8b46('0x41')]=[{'all':!![]}];}_0x4635b9=_[_0x8b46('0x3f')]({},_0x4635b9,_0x1f05c7['options']);return db[_0x8b46('0x2c')][_0x8b46('0x47')](_0x4635b9)[_0x8b46('0x24')](handleEntityNotFound(_0x48a672,null))[_0x8b46('0x24')](respondWithResult(_0x48a672,null))[_0x8b46('0x43')](handleError(_0x48a672,null));};exports[_0x8b46('0x48')]=function(_0x9c9b7b,_0x21ba96){return db[_0x8b46('0x2c')]['create'](_0x9c9b7b[_0x8b46('0x49')],{})[_0x8b46('0x24')](respondWithResult(_0x21ba96,0xc9))[_0x8b46('0x43')](handleError(_0x21ba96,null));};exports[_0x8b46('0x23')]=function(_0x527d0d,_0x48866f){if(_0x527d0d['body']['id']){delete _0x527d0d['body']['id'];}return db[_0x8b46('0x2c')][_0x8b46('0x47')]({'where':{'id':_0x527d0d[_0x8b46('0x45')]['id']}})[_0x8b46('0x24')](handleEntityNotFound(_0x48866f,null))[_0x8b46('0x24')](saveUpdates(_0x527d0d['body'],null))[_0x8b46('0x24')](respondWithResult(_0x48866f,null))[_0x8b46('0x43')](handleError(_0x48866f,null));};exports['destroy']=function(_0xe38d5,_0x38a7d8){return db[_0x8b46('0x2c')]['find']({'where':{'id':_0xe38d5['params']['id']}})[_0x8b46('0x24')](handleEntityNotFound(_0x38a7d8,null))[_0x8b46('0x24')](removeEntity(_0x38a7d8,null))[_0x8b46('0x43')](handleError(_0x38a7d8,null));};exports[_0x8b46('0x4a')]=function(_0x3a98ee,_0x556cfd){return db[_0x8b46('0x2c')][_0x8b46('0x4a')]()['then'](respondWithResult(_0x556cfd,null))['catch'](handleError(_0x556cfd,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index afbc4a8..5110d2e 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 _0x4e5a=['../../config/environment','./userProfileSection.attributes','exports','define','UserProfileSection','user_profile_has_sections','compositeIndex','userProfileId','lodash','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x55fd40,_0x225b77){var _0x7979f1=function(_0x1d21c1){while(--_0x1d21c1){_0x55fd40['push'](_0x55fd40['shift']());}};_0x7979f1(++_0x225b77);}(_0x4e5a,0x143));var _0xa4e5=function(_0x1c33dc,_0x177c7e){_0x1c33dc=_0x1c33dc-0x0;var _0x405580=_0x4e5a[_0x1c33dc];return _0x405580;};'use strict';var _=require(_0xa4e5('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xa4e5('0x1'));var moment=require(_0xa4e5('0x2'));var BPromise=require(_0xa4e5('0x3'));var rp=require(_0xa4e5('0x4'));var fs=require('fs');var path=require(_0xa4e5('0x5'));var rimraf=require(_0xa4e5('0x6'));var config=require(_0xa4e5('0x7'));var attributes=require(_0xa4e5('0x8'));module[_0xa4e5('0x9')]=function(_0x334291,_0x39799b){return _0x334291[_0xa4e5('0xa')](_0xa4e5('0xb'),attributes,{'tableName':_0xa4e5('0xc'),'paranoid':![],'indexes':[{'name':_0xa4e5('0xd'),'fields':['sectionId',_0xa4e5('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf0f4=['UserProfileSection','user_profile_has_sections','compositeIndex','sectionId','userProfileId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x2751a7,_0x507892){var _0x3dbd6c=function(_0x31b3d3){while(--_0x31b3d3){_0x2751a7['push'](_0x2751a7['shift']());}};_0x3dbd6c(++_0x507892);}(_0xf0f4,0x1d3));var _0x4f0f=function(_0xa9591d,_0x19eb7f){_0xa9591d=_0xa9591d-0x0;var _0x158302=_0xf0f4[_0xa9591d];return _0x158302;};'use strict';var _=require(_0x4f0f('0x0'));var util=require(_0x4f0f('0x1'));var logger=require(_0x4f0f('0x2'))(_0x4f0f('0x3'));var moment=require(_0x4f0f('0x4'));var BPromise=require(_0x4f0f('0x5'));var rp=require(_0x4f0f('0x6'));var fs=require('fs');var path=require(_0x4f0f('0x7'));var rimraf=require('rimraf');var config=require(_0x4f0f('0x8'));var attributes=require('./userProfileSection.attributes');module['exports']=function(_0x21ee5d,_0x53e4b5){return _0x21ee5d['define'](_0x4f0f('0x9'),attributes,{'tableName':_0x4f0f('0xa'),'paranoid':![],'indexes':[{'name':_0x4f0f('0xb'),'fields':[_0x4f0f('0xc'),_0x4f0f('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index bc0cc55..8bcf3df 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 _0xf338=['error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','code'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xf338,0x87));var _0x8f33=function(_0x406a7f,_0x26fafc){_0x406a7f=_0x406a7f-0x0;var _0x2d0e8f=_0xf338[_0x406a7f];return _0x2d0e8f;};'use strict';var _=require(_0x8f33('0x0'));var util=require(_0x8f33('0x1'));var moment=require(_0x8f33('0x2'));var BPromise=require(_0x8f33('0x3'));var rs=require(_0x8f33('0x4'));var fs=require('fs');var Redis=require(_0x8f33('0x5'));var db=require(_0x8f33('0x6'))['db'];var utils=require(_0x8f33('0x7'));var logger=require(_0x8f33('0x8'))(_0x8f33('0x9'));var config=require('../../config/environment');var jayson=require(_0x8f33('0xa'));var client=jayson[_0x8f33('0xb')][_0x8f33('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4f86d4,_0x1da6de,_0x5b31fc){return new BPromise(function(_0x579e37,_0x4effcf){return client['request'](_0x4f86d4,_0x5b31fc)['then'](function(_0x16b767){logger[_0x8f33('0xd')](_0x8f33('0xe'),_0x1da6de,_0x8f33('0xf'));logger[_0x8f33('0x10')](_0x8f33('0x11'),_0x1da6de,_0x8f33('0xf'),JSON['stringify'](_0x16b767));if(_0x16b767['error']){if(_0x16b767['error'][_0x8f33('0x12')]===0x1f4){logger[_0x8f33('0x13')](_0x8f33('0xe'),_0x1da6de,_0x16b767['error'][_0x8f33('0x14')]);return _0x4effcf(_0x16b767['error'][_0x8f33('0x14')]);}logger[_0x8f33('0x13')]('UserProfileSection,\x20%s,\x20%s',_0x1da6de,_0x16b767[_0x8f33('0x13')][_0x8f33('0x14')]);return _0x579e37(_0x16b767[_0x8f33('0x13')][_0x8f33('0x14')]);}else{logger['info'](_0x8f33('0xe'),_0x1da6de,_0x8f33('0xf'));_0x579e37(_0x16b767[_0x8f33('0x15')][_0x8f33('0x14')]);}})['catch'](function(_0x25a38d){logger[_0x8f33('0x13')]('UserProfileSection,\x20%s,\x20%s',_0x1da6de,_0x25a38d);_0x4effcf(_0x25a38d);});});} \ No newline at end of file +var _0xc504=['http','request','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x39979b,_0x2111f9){var _0x560b41=function(_0x859cc0){while(--_0x859cc0){_0x39979b['push'](_0x39979b['shift']());}};_0x560b41(++_0x2111f9);}(_0xc504,0x16d));var _0x4c50=function(_0x19a242,_0x322ce9){_0x19a242=_0x19a242-0x0;var _0x344cb8=_0xc504[_0x19a242];return _0x344cb8;};'use strict';var _=require(_0x4c50('0x0'));var util=require(_0x4c50('0x1'));var moment=require('moment');var BPromise=require(_0x4c50('0x2'));var rs=require(_0x4c50('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4c50('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x4c50('0x5'))(_0x4c50('0x6'));var config=require(_0x4c50('0x7'));var jayson=require(_0x4c50('0x8'));var client=jayson['client'][_0x4c50('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xfc2e89,_0x2b58e4,_0x2d644f){return new BPromise(function(_0x2ba43a,_0x8a442a){return client[_0x4c50('0xa')](_0xfc2e89,_0x2d644f)['then'](function(_0xe0ca97){logger[_0x4c50('0xb')](_0x4c50('0xc'),_0x2b58e4,_0x4c50('0xd'));logger[_0x4c50('0xe')](_0x4c50('0xf'),_0x2b58e4,'request\x20sent',JSON[_0x4c50('0x10')](_0xe0ca97));if(_0xe0ca97['error']){if(_0xe0ca97[_0x4c50('0x11')][_0x4c50('0x12')]===0x1f4){logger[_0x4c50('0x11')](_0x4c50('0xc'),_0x2b58e4,_0xe0ca97[_0x4c50('0x11')]['message']);return _0x8a442a(_0xe0ca97['error']['message']);}logger['error'](_0x4c50('0xc'),_0x2b58e4,_0xe0ca97[_0x4c50('0x11')][_0x4c50('0x13')]);return _0x2ba43a(_0xe0ca97['error']['message']);}else{logger[_0x4c50('0xb')](_0x4c50('0xc'),_0x2b58e4,_0x4c50('0xd'));_0x2ba43a(_0xe0ca97[_0x4c50('0x14')][_0x4c50('0x13')]);}})[_0x4c50('0x15')](function(_0x4978a0){logger[_0x4c50('0x11')]('UserProfileSection,\x20%s,\x20%s',_0x2b58e4,_0x4978a0);_0x8a442a(_0x4978a0);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index 36815e9..6deae5f 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 _0x98f8=['../../components/interaction/service','../../config/environment','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x38bca5,_0x5992a0){var _0x33001c=function(_0x55389f){while(--_0x55389f){_0x38bca5['push'](_0x38bca5['shift']());}};_0x33001c(++_0x5992a0);}(_0x98f8,0x111));var _0x898f=function(_0x58e420,_0x4b9bea){_0x58e420=_0x58e420-0x0;var _0x4e1432=_0x98f8[_0x58e420];return _0x4e1432;};'use strict';var multer=require(_0x898f('0x0'));var util=require(_0x898f('0x1'));var path=require(_0x898f('0x2'));var timeout=require(_0x898f('0x3'));var express=require(_0x898f('0x4'));var router=express[_0x898f('0x5')]();var auth=require(_0x898f('0x6'));var interaction=require(_0x898f('0x7'));var config=require(_0x898f('0x8'));module[_0x898f('0x9')]=router; \ No newline at end of file +var _0x22e9=['connect-timeout','express','Router','../../components/interaction/service','../../config/environment','exports'];(function(_0x37e9b1,_0x384bf7){var _0x48b19d=function(_0x351602){while(--_0x351602){_0x37e9b1['push'](_0x37e9b1['shift']());}};_0x48b19d(++_0x384bf7);}(_0x22e9,0xc6));var _0x922e=function(_0x2e0854,_0x52544a){_0x2e0854=_0x2e0854-0x0;var _0x4d0ff9=_0x22e9[_0x2e0854];return _0x4d0ff9;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x922e('0x0'));var express=require(_0x922e('0x1'));var router=express[_0x922e('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0x922e('0x3'));var config=require(_0x922e('0x4'));module[_0x922e('0x5')]=router; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index c90bf79..f690ca4 100644 --- a/server/api/userSmsQueue/userSmsQueue.attributes.js +++ b/server/api/userSmsQueue/userSmsQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['INTEGER','sequelize','exports'];(function(_0x1cd1b4,_0x367e20){var _0x170d0f=function(_0x441f21){while(--_0x441f21){_0x1cd1b4['push'](_0x1cd1b4['shift']());}};_0x170d0f(++_0x367e20);}(_0xe706,0xa3));var _0x6e70=function(_0x4c912e,_0x27299d){_0x4c912e=_0x4c912e-0x0;var _0x2fa424=_0xe706[_0x4c912e];return _0x2fa424;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'penalty':{'type':Sequelize[_0x6e70('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xe706=['INTEGER','sequelize','exports'];(function(_0x5655af,_0x4d0d1d){var _0x25ace5=function(_0x2e6ed8){while(--_0x2e6ed8){_0x5655af['push'](_0x5655af['shift']());}};_0x25ace5(++_0x4d0d1d);}(_0xe706,0xa3));var _0x6e70=function(_0x240c9a,_0x100d6d){_0x240c9a=_0x240c9a-0x0;var _0xb239e9=_0xe706[_0x240c9a];return _0xb239e9;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'penalty':{'type':Sequelize[_0x6e70('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.model.js b/server/api/userSmsQueue/userSmsQueue.model.js index c720746..297443b 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 _0x3bfe=['request-promise','path','rimraf','../../config/environment','exports','define','UserSmsQueue','user_has_sms_queues','lodash','moment','bluebird'];(function(_0x24b955,_0x2f1211){var _0x590b1a=function(_0x5181e7){while(--_0x5181e7){_0x24b955['push'](_0x24b955['shift']());}};_0x590b1a(++_0x2f1211);}(_0x3bfe,0xce));var _0xe3bf=function(_0x44c0c2,_0x29d866){_0x44c0c2=_0x44c0c2-0x0;var _0x5b2eb8=_0x3bfe[_0x44c0c2];return _0x5b2eb8;};'use strict';var _=require(_0xe3bf('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xe3bf('0x1'));var BPromise=require(_0xe3bf('0x2'));var rp=require(_0xe3bf('0x3'));var fs=require('fs');var path=require(_0xe3bf('0x4'));var rimraf=require(_0xe3bf('0x5'));var config=require(_0xe3bf('0x6'));var attributes=require('./userSmsQueue.attributes');module[_0xe3bf('0x7')]=function(_0x2dea21,_0x4de65a){return _0x2dea21[_0xe3bf('0x8')](_0xe3bf('0x9'),attributes,{'tableName':_0xe3bf('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3c9b=['UserSmsQueue','lodash','util','../../config/logger','moment','bluebird','request-promise','path','./userSmsQueue.attributes','exports'];(function(_0x420726,_0x4ef429){var _0x4a0b9f=function(_0x1c5482){while(--_0x1c5482){_0x420726['push'](_0x420726['shift']());}};_0x4a0b9f(++_0x4ef429);}(_0x3c9b,0x1e1));var _0xb3c9=function(_0x1829bd,_0x523921){_0x1829bd=_0x1829bd-0x0;var _0xa2562=_0x3c9b[_0x1829bd];return _0xa2562;};'use strict';var _=require(_0xb3c9('0x0'));var util=require(_0xb3c9('0x1'));var logger=require(_0xb3c9('0x2'))('api');var moment=require(_0xb3c9('0x3'));var BPromise=require(_0xb3c9('0x4'));var rp=require(_0xb3c9('0x5'));var fs=require('fs');var path=require(_0xb3c9('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xb3c9('0x7'));module[_0xb3c9('0x8')]=function(_0x3ad662,_0x4dc44e){return _0x3ad662['define'](_0xb3c9('0x9'),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 8c046fd..4ac0693 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 _0xd51c=['result','catch','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','info','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','UserSmsQueue,\x20%s,\x20%s'];(function(_0x31c742,_0x42d706){var _0x1570be=function(_0x1efe1b){while(--_0x1efe1b){_0x31c742['push'](_0x31c742['shift']());}};_0x1570be(++_0x42d706);}(_0xd51c,0x12e));var _0xcd51=function(_0x538052,_0x5ee581){_0x538052=_0x538052-0x0;var _0xb32d32=_0xd51c[_0x538052];return _0xb32d32;};'use strict';var _=require('lodash');var util=require(_0xcd51('0x0'));var moment=require(_0xcd51('0x1'));var BPromise=require(_0xcd51('0x2'));var rs=require(_0xcd51('0x3'));var fs=require('fs');var Redis=require(_0xcd51('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xcd51('0x5'));var config=require(_0xcd51('0x6'));var jayson=require(_0xcd51('0x7'));var client=jayson[_0xcd51('0x8')][_0xcd51('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2b10b3,_0x73626e,_0x345375){return new BPromise(function(_0x1dab0e,_0x1c049d){return client[_0xcd51('0xa')](_0x2b10b3,_0x345375)['then'](function(_0x4335f6){logger[_0xcd51('0xb')]('UserSmsQueue,\x20%s,\x20%s',_0x73626e,'request\x20sent');logger[_0xcd51('0xc')](_0xcd51('0xd'),_0x73626e,'request\x20sent',JSON[_0xcd51('0xe')](_0x4335f6));if(_0x4335f6[_0xcd51('0xf')]){if(_0x4335f6[_0xcd51('0xf')]['code']===0x1f4){logger[_0xcd51('0xf')]('UserSmsQueue,\x20%s,\x20%s',_0x73626e,_0x4335f6[_0xcd51('0xf')][_0xcd51('0x10')]);return _0x1c049d(_0x4335f6[_0xcd51('0xf')]['message']);}logger['error']('UserSmsQueue,\x20%s,\x20%s',_0x73626e,_0x4335f6[_0xcd51('0xf')]['message']);return _0x1dab0e(_0x4335f6['error']['message']);}else{logger[_0xcd51('0xb')](_0xcd51('0x11'),_0x73626e,'request\x20sent');_0x1dab0e(_0x4335f6[_0xcd51('0x12')]['message']);}})[_0xcd51('0x13')](function(_0x5c3202){logger['error'](_0xcd51('0x11'),_0x73626e,_0x5c3202);_0x1c049d(_0x5c3202);});});} \ No newline at end of file +var _0x8b6b=['request\x20sent','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','UserSmsQueue,\x20%s,\x20%s'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x8b6b,0x1b7));var _0xb8b6=function(_0xafc866,_0x17a0e9){_0xafc866=_0xafc866-0x0;var _0x395939=_0x8b6b[_0xafc866];return _0x395939;};'use strict';var _=require(_0xb8b6('0x0'));var util=require(_0xb8b6('0x1'));var moment=require(_0xb8b6('0x2'));var BPromise=require(_0xb8b6('0x3'));var rs=require(_0xb8b6('0x4'));var fs=require('fs');var Redis=require(_0xb8b6('0x5'));var db=require(_0xb8b6('0x6'))['db'];var utils=require(_0xb8b6('0x7'));var logger=require(_0xb8b6('0x8'))(_0xb8b6('0x9'));var config=require(_0xb8b6('0xa'));var jayson=require(_0xb8b6('0xb'));var client=jayson[_0xb8b6('0xc')][_0xb8b6('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x50957f,_0x41c3a1,_0xd5bec3){return new BPromise(function(_0x30eb18,_0x2bffaf){return client[_0xb8b6('0xe')](_0x50957f,_0xd5bec3)['then'](function(_0xcc6cf7){logger[_0xb8b6('0xf')](_0xb8b6('0x10'),_0x41c3a1,_0xb8b6('0x11'));logger['debug'](_0xb8b6('0x12'),_0x41c3a1,_0xb8b6('0x11'),JSON[_0xb8b6('0x13')](_0xcc6cf7));if(_0xcc6cf7[_0xb8b6('0x14')]){if(_0xcc6cf7['error'][_0xb8b6('0x15')]===0x1f4){logger[_0xb8b6('0x14')](_0xb8b6('0x10'),_0x41c3a1,_0xcc6cf7[_0xb8b6('0x14')]['message']);return _0x2bffaf(_0xcc6cf7[_0xb8b6('0x14')][_0xb8b6('0x16')]);}logger[_0xb8b6('0x14')](_0xb8b6('0x10'),_0x41c3a1,_0xcc6cf7['error'][_0xb8b6('0x16')]);return _0x30eb18(_0xcc6cf7[_0xb8b6('0x14')][_0xb8b6('0x16')]);}else{logger['info'](_0xb8b6('0x10'),_0x41c3a1,_0xb8b6('0x11'));_0x30eb18(_0xcc6cf7[_0xb8b6('0x17')][_0xb8b6('0x16')]);}})['catch'](function(_0x1c622a){logger[_0xb8b6('0x14')](_0xb8b6('0x10'),_0x41c3a1,_0x1c622a);_0x2bffaf(_0x1c622a);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueue/index.js b/server/api/userVoiceQueue/index.js index 1436b15..69b5047 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 _0x6923=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','util','path','connect-timeout'];(function(_0x55af36,_0x1b4c04){var _0x25d888=function(_0x284b9f){while(--_0x284b9f){_0x55af36['push'](_0x55af36['shift']());}};_0x25d888(++_0x1b4c04);}(_0x6923,0x165));var _0x3692=function(_0x5dea7d,_0x23364a){_0x5dea7d=_0x5dea7d-0x0;var _0xd904eb=_0x6923[_0x5dea7d];return _0xd904eb;};'use strict';var multer=require('multer');var util=require(_0x3692('0x0'));var path=require(_0x3692('0x1'));var timeout=require(_0x3692('0x2'));var express=require(_0x3692('0x3'));var router=express[_0x3692('0x4')]();var auth=require(_0x3692('0x5'));var interaction=require(_0x3692('0x6'));var config=require(_0x3692('0x7'));module['exports']=router; \ No newline at end of file +var _0xe1c5=['exports','multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment'];(function(_0x90aa7b,_0x114b05){var _0x4d455b=function(_0x1fecae){while(--_0x1fecae){_0x90aa7b['push'](_0x90aa7b['shift']());}};_0x4d455b(++_0x114b05);}(_0xe1c5,0x1d9));var _0x5e1c=function(_0x45d821,_0x1dc871){_0x45d821=_0x45d821-0x0;var _0x4a7e18=_0xe1c5[_0x45d821];return _0x4a7e18;};'use strict';var multer=require(_0x5e1c('0x0'));var util=require('util');var path=require(_0x5e1c('0x1'));var timeout=require(_0x5e1c('0x2'));var express=require(_0x5e1c('0x3'));var router=express[_0x5e1c('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x5e1c('0x5'));var config=require(_0x5e1c('0x6'));module[_0x5e1c('0x7')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index 0581a56..e2cde8e 100644 --- a/server/api/userVoiceQueue/userVoiceQueue.attributes.js +++ b/server/api/userVoiceQueue/userVoiceQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['exports','INTEGER'];(function(_0x2bc400,_0x27208f){var _0x36ab53=function(_0x257660){while(--_0x257660){_0x2bc400['push'](_0x2bc400['shift']());}};_0x36ab53(++_0x27208f);}(_0xbaf0,0x12a));var _0x0baf=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xbaf0[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xd8b0=['exports','sequelize'];(function(_0x395d59,_0x3aa7d1){var _0x45f776=function(_0x298b5d){while(--_0x298b5d){_0x395d59['push'](_0x395d59['shift']());}};_0x45f776(++_0x3aa7d1);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.model.js b/server/api/userVoiceQueue/userVoiceQueue.model.js index dacefa5..2fb3a0c 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 _0xadb8=['UserVoiceQueue','user_has_voice_queues','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userVoiceQueue.attributes','define'];(function(_0xe03bdc,_0x2cda10){var _0x27cf91=function(_0x127cf2){while(--_0x127cf2){_0xe03bdc['push'](_0xe03bdc['shift']());}};_0x27cf91(++_0x2cda10);}(_0xadb8,0x1d0));var _0x8adb=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0xadb8[_0x13e741];return _0x3f8bb3;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x8adb('0x0'))('api');var moment=require(_0x8adb('0x1'));var BPromise=require(_0x8adb('0x2'));var rp=require(_0x8adb('0x3'));var fs=require('fs');var path=require(_0x8adb('0x4'));var rimraf=require(_0x8adb('0x5'));var config=require(_0x8adb('0x6'));var attributes=require(_0x8adb('0x7'));module['exports']=function(_0x15bc63,_0x1a5f36){return _0x15bc63[_0x8adb('0x8')](_0x8adb('0x9'),attributes,{'tableName':_0x8adb('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xed1f=['user_has_voice_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userVoiceQueue.attributes','exports','define','UserVoiceQueue'];(function(_0x4b9bb2,_0x50eb1d){var _0x18c22e=function(_0x4aef36){while(--_0x4aef36){_0x4b9bb2['push'](_0x4b9bb2['shift']());}};_0x18c22e(++_0x50eb1d);}(_0xed1f,0x6a));var _0xfed1=function(_0x725b8e,_0xc22b48){_0x725b8e=_0x725b8e-0x0;var _0x43ac45=_0xed1f[_0x725b8e];return _0x43ac45;};'use strict';var _=require(_0xfed1('0x0'));var util=require(_0xfed1('0x1'));var logger=require(_0xfed1('0x2'))(_0xfed1('0x3'));var moment=require(_0xfed1('0x4'));var BPromise=require(_0xfed1('0x5'));var rp=require(_0xfed1('0x6'));var fs=require('fs');var path=require(_0xfed1('0x7'));var rimraf=require(_0xfed1('0x8'));var config=require(_0xfed1('0x9'));var attributes=require(_0xfed1('0xa'));module[_0xfed1('0xb')]=function(_0x3d6706,_0x42751d){return _0x3d6706[_0xfed1('0xc')](_0xfed1('0xd'),attributes,{'tableName':_0xfed1('0xe'),'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 510478c..1f20ad4 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 _0xea5b=['lodash','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','result','catch'];(function(_0x42696e,_0x11aa1c){var _0x4bab20=function(_0x136ec1){while(--_0x136ec1){_0x42696e['push'](_0x42696e['shift']());}};_0x4bab20(++_0x11aa1c);}(_0xea5b,0x1b9));var _0xbea5=function(_0x36884e,_0x48008f){_0x36884e=_0x36884e-0x0;var _0x1cc367=_0xea5b[_0x36884e];return _0x1cc367;};'use strict';var _=require(_0xbea5('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xbea5('0x1'));var rs=require(_0xbea5('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xbea5('0x3'));var logger=require(_0xbea5('0x4'))(_0xbea5('0x5'));var config=require(_0xbea5('0x6'));var jayson=require(_0xbea5('0x7'));var client=jayson[_0xbea5('0x8')][_0xbea5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x19f838,_0x8fd13a,_0xa849e2){return new BPromise(function(_0x55caa0,_0x3969cc){return client[_0xbea5('0xa')](_0x19f838,_0xa849e2)[_0xbea5('0xb')](function(_0x38ffab){logger['info'](_0xbea5('0xc'),_0x8fd13a,_0xbea5('0xd'));logger[_0xbea5('0xe')]('UserVoiceQueue,\x20%s,\x20%s,\x20%s',_0x8fd13a,_0xbea5('0xd'),JSON[_0xbea5('0xf')](_0x38ffab));if(_0x38ffab[_0xbea5('0x10')]){if(_0x38ffab[_0xbea5('0x10')]['code']===0x1f4){logger[_0xbea5('0x10')]('UserVoiceQueue,\x20%s,\x20%s',_0x8fd13a,_0x38ffab[_0xbea5('0x10')]['message']);return _0x3969cc(_0x38ffab[_0xbea5('0x10')][_0xbea5('0x11')]);}logger[_0xbea5('0x10')](_0xbea5('0xc'),_0x8fd13a,_0x38ffab[_0xbea5('0x10')][_0xbea5('0x11')]);return _0x55caa0(_0x38ffab[_0xbea5('0x10')]['message']);}else{logger[_0xbea5('0x12')]('UserVoiceQueue,\x20%s,\x20%s',_0x8fd13a,_0xbea5('0xd'));_0x55caa0(_0x38ffab[_0xbea5('0x13')][_0xbea5('0x11')]);}})[_0xbea5('0x14')](function(_0x23e001){logger[_0xbea5('0x10')](_0xbea5('0xc'),_0x8fd13a,_0x23e001);_0x3969cc(_0x23e001);});});} \ No newline at end of file +var _0xc6a1=['../../config/utils','../../config/environment','jayson/promise','http','request','info','request\x20sent','debug','stringify','error','code','UserVoiceQueue,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','ioredis'];(function(_0x404cde,_0x27b51c){var _0x139882=function(_0x1f31d1){while(--_0x1f31d1){_0x404cde['push'](_0x404cde['shift']());}};_0x139882(++_0x27b51c);}(_0xc6a1,0xeb));var _0x1c6a=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0xc6a1[_0x2be8c2];return _0x97f531;};'use strict';var _=require('lodash');var util=require(_0x1c6a('0x0'));var moment=require(_0x1c6a('0x1'));var BPromise=require(_0x1c6a('0x2'));var rs=require(_0x1c6a('0x3'));var fs=require('fs');var Redis=require(_0x1c6a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x1c6a('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x1c6a('0x6'));var jayson=require(_0x1c6a('0x7'));var client=jayson['client'][_0x1c6a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x165226,_0x3277a7,_0x1edaf9){return new BPromise(function(_0x502e26,_0x45e4e0){return client[_0x1c6a('0x9')](_0x165226,_0x1edaf9)['then'](function(_0x44e900){logger[_0x1c6a('0xa')]('UserVoiceQueue,\x20%s,\x20%s',_0x3277a7,_0x1c6a('0xb'));logger[_0x1c6a('0xc')]('UserVoiceQueue,\x20%s,\x20%s,\x20%s',_0x3277a7,'request\x20sent',JSON[_0x1c6a('0xd')](_0x44e900));if(_0x44e900[_0x1c6a('0xe')]){if(_0x44e900[_0x1c6a('0xe')][_0x1c6a('0xf')]===0x1f4){logger[_0x1c6a('0xe')](_0x1c6a('0x10'),_0x3277a7,_0x44e900[_0x1c6a('0xe')][_0x1c6a('0x11')]);return _0x45e4e0(_0x44e900['error']['message']);}logger['error'](_0x1c6a('0x10'),_0x3277a7,_0x44e900[_0x1c6a('0xe')][_0x1c6a('0x11')]);return _0x502e26(_0x44e900['error'][_0x1c6a('0x11')]);}else{logger['info'](_0x1c6a('0x10'),_0x3277a7,_0x1c6a('0xb'));_0x502e26(_0x44e900[_0x1c6a('0x12')][_0x1c6a('0x11')]);}})[_0x1c6a('0x13')](function(_0x1ed2a5){logger[_0x1c6a('0xe')](_0x1c6a('0x10'),_0x3277a7,_0x1ed2a5);_0x45e4e0(_0x1ed2a5);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index d9b9657..4ca46eb 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 _0x294b=['Router','../../components/auth/service','../../components/interaction/service','multer','path','connect-timeout','express'];(function(_0x4bae1a,_0x5b0916){var _0x27f6d2=function(_0x2204b2){while(--_0x2204b2){_0x4bae1a['push'](_0x4bae1a['shift']());}};_0x27f6d2(++_0x5b0916);}(_0x294b,0xea));var _0xb294=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x294b[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xb294('0x0'));var util=require('util');var path=require(_0xb294('0x1'));var timeout=require(_0xb294('0x2'));var express=require(_0xb294('0x3'));var router=express[_0xb294('0x4')]();var auth=require(_0xb294('0x5'));var interaction=require(_0xb294('0x6'));var config=require('../../config/environment');module['exports']=router; \ No newline at end of file +var _0x4389=['connect-timeout','express','Router','../../components/interaction/service','exports','multer','util','path'];(function(_0x3d1360,_0xfe55ce){var _0x3346c5=function(_0x31b543){while(--_0x31b543){_0x3d1360['push'](_0x3d1360['shift']());}};_0x3346c5(++_0xfe55ce);}(_0x4389,0xfd));var _0x9438=function(_0x5b7a66,_0x367c4f){_0x5b7a66=_0x5b7a66-0x0;var _0x7dd28f=_0x4389[_0x5b7a66];return _0x7dd28f;};'use strict';var multer=require(_0x9438('0x0'));var util=require(_0x9438('0x1'));var path=require(_0x9438('0x2'));var timeout=require(_0x9438('0x3'));var express=require(_0x9438('0x4'));var router=express[_0x9438('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x9438('0x6'));var config=require('../../config/environment');module[_0x9438('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 e6dd996..1de42c9 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 _0x3a70=['Required\x20by\x20Asterisk','STRING','queue_interface','exports','INTEGER'];(function(_0x8584c,_0x21d8d3){var _0x17fd46=function(_0x27e6d5){while(--_0x27e6d5){_0x8584c['push'](_0x8584c['shift']());}};_0x17fd46(++_0x21d8d3);}(_0x3a70,0x14d));var _0x03a7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3a70[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0x03a7('0x0')]={'uniqueid':{'type':Sequelize[_0x03a7('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x03a7('0x2')},'membername':{'type':Sequelize[_0x03a7('0x3')],'allowNull':![],'comment':_0x03a7('0x2')},'UserId':{'type':Sequelize['INTEGER'],'allowNull':![]},'queue_name':{'type':Sequelize[_0x03a7('0x3')],'allowNull':![],'unique':_0x03a7('0x4'),'comment':_0x03a7('0x2')},'VoiceQueueId':{'type':Sequelize[_0x03a7('0x1')],'allowNull':![]},'interface':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x03a7('0x4'),'comment':_0x03a7('0x2')},'penalty':{'type':Sequelize[_0x03a7('0x1')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'},'paused':{'type':Sequelize[_0x03a7('0x1')](0xb),'defaultValue':0x0,'comment':_0x03a7('0x2')}}; \ No newline at end of file +var _0x710b=['INTEGER','STRING','Required\x20by\x20Asterisk','queue_interface','sequelize','exports'];(function(_0x178631,_0xc761fa){var _0x23939a=function(_0x3b8fa7){while(--_0x3b8fa7){_0x178631['push'](_0x178631['shift']());}};_0x23939a(++_0xc761fa);}(_0x710b,0x94));var _0xb710=function(_0x2dd82f,_0xd7595f){_0x2dd82f=_0x2dd82f-0x0;var _0x311f96=_0x710b[_0x2dd82f];return _0x311f96;};'use strict';var Sequelize=require(_0xb710('0x0'));module[_0xb710('0x1')]={'uniqueid':{'type':Sequelize[_0xb710('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':'Required\x20by\x20Asterisk'},'membername':{'type':Sequelize[_0xb710('0x3')],'allowNull':![],'comment':_0xb710('0x4')},'UserId':{'type':Sequelize['INTEGER'],'allowNull':![]},'queue_name':{'type':Sequelize[_0xb710('0x3')],'allowNull':![],'unique':_0xb710('0x5'),'comment':_0xb710('0x4')},'VoiceQueueId':{'type':Sequelize[_0xb710('0x2')],'allowNull':![]},'interface':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xb710('0x5'),'comment':_0xb710('0x4')},'penalty':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0xb710('0x4')},'paused':{'type':Sequelize[_0xb710('0x2')](0xb),'defaultValue':0x0,'comment':_0xb710('0x4')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index 9edc51c..6568e54 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 _0xf147=['setMaxListeners','remove','emit','hasOwnProperty','hook','UserVoiceQueueRt'];(function(_0x19a581,_0x8ac5eb){var _0x32a50b=function(_0x15e43e){while(--_0x15e43e){_0x19a581['push'](_0x19a581['shift']());}};_0x32a50b(++_0x8ac5eb);}(_0xf147,0x197));var _0x7f14=function(_0x22c02c,_0x263758){_0x22c02c=_0x22c02c-0x0;var _0x5c86ea=_0xf147[_0x22c02c];return _0x5c86ea;};'use strict';var EventEmitter=require('events');var UserVoiceQueueRt=require('../../mysqldb')['db'][_0x7f14('0x0')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x7f14('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x7f14('0x2')};function emitEvent(_0x3ffde){return function(_0xe59d9a,_0x4c6f05,_0x307745){UserVoiceQueueRtEvents['emit'](_0x3ffde+':'+_0xe59d9a['id'],_0xe59d9a);UserVoiceQueueRtEvents[_0x7f14('0x3')](_0x3ffde,_0xe59d9a);_0x307745(null);};}for(var e in events){if(events[_0x7f14('0x4')](e)){var event=events[e];UserVoiceQueueRt[_0x7f14('0x5')](e,emitEvent(event));}}module['exports']=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x782e=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','UserVoiceQueueRt','setMaxListeners','save','remove'];(function(_0xa971ec,_0x3de3df){var _0xfb43ce=function(_0x111b49){while(--_0x111b49){_0xa971ec['push'](_0xa971ec['shift']());}};_0xfb43ce(++_0x3de3df);}(_0x782e,0xa4));var _0xe782=function(_0x4aa008,_0x4f8ef3){_0x4aa008=_0x4aa008-0x0;var _0x4fa882=_0x782e[_0x4aa008];return _0x4fa882;};'use strict';var EventEmitter=require(_0xe782('0x0'));var UserVoiceQueueRt=require(_0xe782('0x1'))['db'][_0xe782('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xe782('0x3')](0x0);var events={'afterCreate':_0xe782('0x4'),'afterUpdate':'update','afterDestroy':_0xe782('0x5')};function emitEvent(_0x5e8c60){return function(_0x45aa89,_0x149694,_0x6ed64e){UserVoiceQueueRtEvents[_0xe782('0x6')](_0x5e8c60+':'+_0x45aa89['id'],_0x45aa89);UserVoiceQueueRtEvents[_0xe782('0x6')](_0x5e8c60,_0x45aa89);_0x6ed64e(null);};}for(var e in events){if(events[_0xe782('0x7')](e)){var event=events[e];UserVoiceQueueRt[_0xe782('0x8')](e,emitEvent(event));}}module[_0xe782('0x9')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index de1d361..51f215f 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 _0x5a63=['../../config/environment','./userVoiceQueueRt.attributes','exports','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0x5a63,0x155));var _0x35a6=function(_0x3b6f89,_0x48a7b0){_0x3b6f89=_0x3b6f89-0x0;var _0x4b0dde=_0x5a63[_0x3b6f89];return _0x4b0dde;};'use strict';var _=require(_0x35a6('0x0'));var util=require(_0x35a6('0x1'));var logger=require(_0x35a6('0x2'))(_0x35a6('0x3'));var moment=require(_0x35a6('0x4'));var BPromise=require(_0x35a6('0x5'));var rp=require(_0x35a6('0x6'));var fs=require('fs');var path=require(_0x35a6('0x7'));var rimraf=require(_0x35a6('0x8'));var config=require(_0x35a6('0x9'));var attributes=require(_0x35a6('0xa'));module[_0x35a6('0xb')]=function(_0x32180f,_0x51d70e){return _0x32180f['define'](_0x35a6('0xc'),attributes,{'tableName':_0x35a6('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2b7f=['../../config/environment','./userVoiceQueueRt.attributes','exports','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','util','api','moment','path'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0x2b7f,0x1d1));var _0xf2b7=function(_0x4a588b,_0x1c222e){_0x4a588b=_0x4a588b-0x0;var _0x529b71=_0x2b7f[_0x4a588b];return _0x529b71;};'use strict';var _=require(_0xf2b7('0x0'));var util=require(_0xf2b7('0x1'));var logger=require('../../config/logger')(_0xf2b7('0x2'));var moment=require(_0xf2b7('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xf2b7('0x4'));var rimraf=require('rimraf');var config=require(_0xf2b7('0x5'));var attributes=require(_0xf2b7('0x6'));module[_0xf2b7('0x7')]=function(_0x28edb5,_0x504567){return _0x28edb5['define'](_0xf2b7('0x8'),attributes,{'tableName':_0xf2b7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js index 46dabe8..8fd4aa4 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 _0xced1=['localhost','socket.io-emitter','./userVoiceQueueRt.socket','register','then','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','code','UserVoiceQueueRt,\x20%s,\x20%s','message','info','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','raw','where','sequelize','COUNT','outboundQueuePauses','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','http','redis','defaults'];(function(_0x25700a,_0x2c5dd4){var _0x23639a=function(_0x555a9d){while(--_0x555a9d){_0x25700a['push'](_0x25700a['shift']());}};_0x23639a(++_0x2c5dd4);}(_0xced1,0x165));var _0x1ced=function(_0x4de586,_0x183427){_0x4de586=_0x4de586-0x0;var _0x46baf5=_0xced1[_0x4de586];return _0x46baf5;};'use strict';var _=require(_0x1ced('0x0'));var util=require(_0x1ced('0x1'));var moment=require(_0x1ced('0x2'));var BPromise=require(_0x1ced('0x3'));var rs=require(_0x1ced('0x4'));var fs=require('fs');var Redis=require(_0x1ced('0x5'));var db=require(_0x1ced('0x6'))['db'];var utils=require(_0x1ced('0x7'));var logger=require('../../config/logger')(_0x1ced('0x8'));var config=require(_0x1ced('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1ced('0xa')]({'port':0x232a});config[_0x1ced('0xb')]=_[_0x1ced('0xc')](config[_0x1ced('0xb')],{'host':_0x1ced('0xd'),'port':0x18eb});var socket=require(_0x1ced('0xe'))(new Redis(config[_0x1ced('0xb')]));require(_0x1ced('0xf'))[_0x1ced('0x10')](socket);function respondWithRpcPromise(_0x391e03,_0x542de9,_0x176b33){return new BPromise(function(_0x3d9a0c,_0x708c3b){return client['request'](_0x391e03,_0x176b33)[_0x1ced('0x11')](function(_0x2a1cb9){logger['info']('UserVoiceQueueRt,\x20%s,\x20%s',_0x542de9,_0x1ced('0x12'));logger[_0x1ced('0x13')](_0x1ced('0x14'),_0x542de9,_0x1ced('0x12'),JSON[_0x1ced('0x15')](_0x2a1cb9));if(_0x2a1cb9[_0x1ced('0x16')]){if(_0x2a1cb9[_0x1ced('0x16')][_0x1ced('0x17')]===0x1f4){logger[_0x1ced('0x16')](_0x1ced('0x18'),_0x542de9,_0x2a1cb9[_0x1ced('0x16')][_0x1ced('0x19')]);return _0x708c3b(_0x2a1cb9[_0x1ced('0x16')]['message']);}logger[_0x1ced('0x16')](_0x1ced('0x18'),_0x542de9,_0x2a1cb9[_0x1ced('0x16')][_0x1ced('0x19')]);return _0x3d9a0c(_0x2a1cb9[_0x1ced('0x16')]['message']);}else{logger[_0x1ced('0x1a')](_0x1ced('0x18'),_0x542de9,_0x1ced('0x12'));_0x3d9a0c(_0x2a1cb9['result']['message']);}})[_0x1ced('0x1b')](function(_0x507136){logger[_0x1ced('0x16')](_0x1ced('0x18'),_0x542de9,_0x507136);_0x708c3b(_0x507136);});});}exports[_0x1ced('0x1c')]=function(_0x4d249a){var _0x3b69ec=this;return new Promise(function(_0x54b9ff,_0x491a93){return db[_0x1ced('0x1d')][_0x1ced('0x1e')]({'raw':_0x4d249a[_0x1ced('0x1f')]?_0x4d249a[_0x1ced('0x1f')][_0x1ced('0x20')]===undefined?!![]:![]:!![],'where':_0x4d249a[_0x1ced('0x1f')]?_0x4d249a[_0x1ced('0x1f')][_0x1ced('0x21')]||null:null,'attributes':[[db[_0x1ced('0x22')]['fn'](_0x1ced('0x23'),db[_0x1ced('0x22')]['fn']('IF',db[_0x1ced('0x22')]['literal']('`paused`\x20=\x201,\x201,\x20null'))),_0x1ced('0x24')]]})[_0x1ced('0x11')](function(_0x1b9714){logger[_0x1ced('0x1a')]('GetVoiceQueueRtPauses',_0x4d249a);logger[_0x1ced('0x13')](_0x1ced('0x1c'),_0x4d249a,JSON['stringify'](_0x1b9714));_0x54b9ff(_0x1b9714);})['catch'](function(_0x42fed0){logger[_0x1ced('0x16')](_0x1ced('0x1c'),_0x42fed0[_0x1ced('0x19')],_0x4d249a);_0x491a93(_0x3b69ec['error'](0x1f4,_0x42fed0['message']));});});}; \ No newline at end of file +var _0xfedb=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./userVoiceQueueRt.socket','register','request','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','result','message','catch','GetVoiceQueueRtPauses','raw','options','where','sequelize','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','lodash','moment','bluebird'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xfedb,0x141));var _0xbfed=function(_0x5ae3ab,_0x59f0ce){_0x5ae3ab=_0x5ae3ab-0x0;var _0x345000=_0xfedb[_0x5ae3ab];return _0x345000;};'use strict';var _=require(_0xbfed('0x0'));var util=require('util');var moment=require(_0xbfed('0x1'));var BPromise=require(_0xbfed('0x2'));var rs=require(_0xbfed('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbfed('0x4'))['db'];var utils=require(_0xbfed('0x5'));var logger=require(_0xbfed('0x6'))(_0xbfed('0x7'));var config=require(_0xbfed('0x8'));var jayson=require(_0xbfed('0x9'));var client=jayson[_0xbfed('0xa')][_0xbfed('0xb')]({'port':0x232a});config[_0xbfed('0xc')]=_[_0xbfed('0xd')](config['redis'],{'host':_0xbfed('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xbfed('0xf'))[_0xbfed('0x10')](socket);function respondWithRpcPromise(_0x10e9ff,_0x51bb5b,_0x39029d){return new BPromise(function(_0x349293,_0x4ca355){return client[_0xbfed('0x11')](_0x10e9ff,_0x39029d)['then'](function(_0x3b1fba){logger[_0xbfed('0x12')](_0xbfed('0x13'),_0x51bb5b,_0xbfed('0x14'));logger[_0xbfed('0x15')](_0xbfed('0x16'),_0x51bb5b,_0xbfed('0x14'),JSON[_0xbfed('0x17')](_0x3b1fba));if(_0x3b1fba['error']){if(_0x3b1fba['error']['code']===0x1f4){logger[_0xbfed('0x18')](_0xbfed('0x13'),_0x51bb5b,_0x3b1fba[_0xbfed('0x18')]['message']);return _0x4ca355(_0x3b1fba[_0xbfed('0x18')]['message']);}logger[_0xbfed('0x18')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x51bb5b,_0x3b1fba['error']['message']);return _0x349293(_0x3b1fba[_0xbfed('0x18')]['message']);}else{logger[_0xbfed('0x12')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x51bb5b,'request\x20sent');_0x349293(_0x3b1fba[_0xbfed('0x19')][_0xbfed('0x1a')]);}})[_0xbfed('0x1b')](function(_0x7a061d){logger['error'](_0xbfed('0x13'),_0x51bb5b,_0x7a061d);_0x4ca355(_0x7a061d);});});}exports[_0xbfed('0x1c')]=function(_0x1e629f){var _0x4fd6f9=this;return new Promise(function(_0x33e1eb,_0x558a51){return db['UserVoiceQueueRt']['findAll']({'raw':_0x1e629f['options']?_0x1e629f['options'][_0xbfed('0x1d')]===undefined?!![]:![]:!![],'where':_0x1e629f[_0xbfed('0x1e')]?_0x1e629f[_0xbfed('0x1e')][_0xbfed('0x1f')]||null:null,'attributes':[[db['sequelize']['fn']('COUNT',db[_0xbfed('0x20')]['fn']('IF',db[_0xbfed('0x20')][_0xbfed('0x21')](_0xbfed('0x22')))),_0xbfed('0x23')]]})['then'](function(_0xd3ee0d){logger[_0xbfed('0x12')](_0xbfed('0x1c'),_0x1e629f);logger[_0xbfed('0x15')](_0xbfed('0x1c'),_0x1e629f,JSON[_0xbfed('0x17')](_0xd3ee0d));_0x33e1eb(_0xd3ee0d);})['catch'](function(_0x4dd74a){logger[_0xbfed('0x18')](_0xbfed('0x1c'),_0x4dd74a[_0xbfed('0x1a')],_0x1e629f);_0x558a51(_0x4fd6f9[_0xbfed('0x18')](0x1f4,_0x4dd74a[_0xbfed('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 5dddea7..0e7e222 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 _0x52b0=['emit','removeListener','userVoiceQueueRt:','./userVoiceQueueRt.events','save','update'];(function(_0x453744,_0x389564){var _0x148bb6=function(_0x43d65a){while(--_0x43d65a){_0x453744['push'](_0x453744['shift']());}};_0x148bb6(++_0x389564);}(_0x52b0,0xc9));var _0x052b=function(_0x137295,_0x26078f){_0x137295=_0x137295-0x0;var _0x59e59f=_0x52b0[_0x137295];return _0x59e59f;};'use strict';var UserVoiceQueueRtEvents=require(_0x052b('0x0'));var events=[_0x052b('0x1'),'remove',_0x052b('0x2')];function createListener(_0x46f514,_0x1435a5){return function(_0x437b99){_0x1435a5[_0x052b('0x3')](_0x46f514,_0x437b99);};}function removeListener(_0xddd1f4,_0x1122ad){return function(){UserVoiceQueueRtEvents[_0x052b('0x4')](_0xddd1f4,_0x1122ad);};}exports['register']=function(_0x2eb66e){for(var _0x4823bf=0x0,_0x8222ab=events['length'];_0x4823bf<_0x8222ab;_0x4823bf++){var _0x1f2090=events[_0x4823bf];var _0x4f96e5=createListener(_0x052b('0x5')+_0x1f2090,_0x2eb66e);UserVoiceQueueRtEvents['on'](_0x1f2090,_0x4f96e5);}}; \ No newline at end of file +var _0xfba0=['userVoiceQueueRt:','./userVoiceQueueRt.events','save','remove','update','emit','removeListener','register','length'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xfba0,0x91));var _0x0fba=function(_0x44371e,_0x2c49a4){_0x44371e=_0x44371e-0x0;var _0x477bac=_0xfba0[_0x44371e];return _0x477bac;};'use strict';var UserVoiceQueueRtEvents=require(_0x0fba('0x0'));var events=[_0x0fba('0x1'),_0x0fba('0x2'),_0x0fba('0x3')];function createListener(_0x43696a,_0x373879){return function(_0x3dc8f0){_0x373879[_0x0fba('0x4')](_0x43696a,_0x3dc8f0);};}function removeListener(_0x4e7a12,_0x4a1098){return function(){UserVoiceQueueRtEvents[_0x0fba('0x5')](_0x4e7a12,_0x4a1098);};}exports[_0x0fba('0x6')]=function(_0x5e8d96){for(var _0x3c51f1=0x0,_0x4fa2c5=events[_0x0fba('0x7')];_0x3c51f1<_0x4fa2c5;_0x3c51f1++){var _0x4403fb=events[_0x3c51f1];var _0x220691=createListener(_0x0fba('0x8')+_0x4403fb,_0x5e8d96);UserVoiceQueueRtEvents['on'](_0x4403fb,_0x220691);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index bd3f038..a4f575b 100644 --- a/server/api/userWhatsappQueue/index.js +++ b/server/api/userWhatsappQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x95fb=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','util'];(function(_0x319920,_0x1aeb65){var _0x354056=function(_0x3154b1){while(--_0x3154b1){_0x319920['push'](_0x319920['shift']());}};_0x354056(++_0x1aeb65);}(_0x95fb,0x13e));var _0xb95f=function(_0x366901,_0x368a5c){_0x366901=_0x366901-0x0;var _0x175090=_0x95fb[_0x366901];return _0x175090;};'use strict';var multer=require(_0xb95f('0x0'));var util=require(_0xb95f('0x1'));var path=require(_0xb95f('0x2'));var timeout=require(_0xb95f('0x3'));var express=require(_0xb95f('0x4'));var router=express[_0xb95f('0x5')]();var auth=require(_0xb95f('0x6'));var interaction=require(_0xb95f('0x7'));var config=require(_0xb95f('0x8'));module[_0xb95f('0x9')]=router; \ No newline at end of file +var _0x534b=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','util','path'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0x534b,0x1a4));var _0xb534=function(_0x3498ab,_0x398dc7){_0x3498ab=_0x3498ab-0x0;var _0x314a39=_0x534b[_0x3498ab];return _0x314a39;};'use strict';var multer=require(_0xb534('0x0'));var util=require(_0xb534('0x1'));var path=require(_0xb534('0x2'));var timeout=require('connect-timeout');var express=require(_0xb534('0x3'));var router=express[_0xb534('0x4')]();var auth=require(_0xb534('0x5'));var interaction=require(_0xb534('0x6'));var config=require(_0xb534('0x7'));module[_0xb534('0x8')]=router; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index 9480ce7..993fa78 100644 --- a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js +++ b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['INTEGER','sequelize','exports'];(function(_0x4fdd37,_0x6ddb6){var _0x46d6d1=function(_0x48ad38){while(--_0x48ad38){_0x4fdd37['push'](_0x4fdd37['shift']());}};_0x46d6d1(++_0x6ddb6);}(_0xe706,0xa3));var _0x6e70=function(_0x5229a1,_0x5349f8){_0x5229a1=_0x5229a1-0x0;var _0xc4cb55=_0xe706[_0x5229a1];return _0xc4cb55;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'penalty':{'type':Sequelize[_0x6e70('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xbaf0=['exports','INTEGER'];(function(_0x11bc40,_0x537bbc){var _0x2b7a99=function(_0x50135b){while(--_0x50135b){_0x11bc40['push'](_0x11bc40['shift']());}};_0x2b7a99(++_0x537bbc);}(_0xbaf0,0x12a));var _0x0baf=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xbaf0[_0x465028];return _0xb783d4;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.model.js b/server/api/userWhatsappQueue/userWhatsappQueue.model.js index cdd4e4b..8d91f94 100644 --- a/server/api/userWhatsappQueue/userWhatsappQueue.model.js +++ b/server/api/userWhatsappQueue/userWhatsappQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4024=['define','user_has_whatsapp_queues','lodash','util','api','moment','request-promise','rimraf','../../config/environment'];(function(_0x19da8c,_0x5b8a14){var _0x5b482a=function(_0x4f9ba8){while(--_0x4f9ba8){_0x19da8c['push'](_0x19da8c['shift']());}};_0x5b482a(++_0x5b8a14);}(_0x4024,0x89));var _0x4402=function(_0x51eaf3,_0x37f3f3){_0x51eaf3=_0x51eaf3-0x0;var _0x217c6c=_0x4024[_0x51eaf3];return _0x217c6c;};'use strict';var _=require(_0x4402('0x0'));var util=require(_0x4402('0x1'));var logger=require('../../config/logger')(_0x4402('0x2'));var moment=require(_0x4402('0x3'));var BPromise=require('bluebird');var rp=require(_0x4402('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4402('0x5'));var config=require(_0x4402('0x6'));var attributes=require('./userWhatsappQueue.attributes');module['exports']=function(_0x17699b,_0x346ddc){return _0x17699b[_0x4402('0x7')]('UserWhatsappQueue',attributes,{'tableName':_0x4402('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0598=['UserWhatsappQueue','user_has_whatsapp_queues','lodash','util','api','request-promise','path','exports'];(function(_0x32f6b9,_0x2d4aa9){var _0x267d52=function(_0x10f74f){while(--_0x10f74f){_0x32f6b9['push'](_0x32f6b9['shift']());}};_0x267d52(++_0x2d4aa9);}(_0x0598,0x92));var _0x8059=function(_0x2941f5,_0x7eef39){_0x2941f5=_0x2941f5-0x0;var _0x5f2d17=_0x0598[_0x2941f5];return _0x5f2d17;};'use strict';var _=require(_0x8059('0x0'));var util=require(_0x8059('0x1'));var logger=require('../../config/logger')(_0x8059('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x8059('0x3'));var fs=require('fs');var path=require(_0x8059('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./userWhatsappQueue.attributes');module[_0x8059('0x5')]=function(_0xa7d7c1,_0x512c0f){return _0xa7d7c1['define'](_0x8059('0x6'),attributes,{'tableName':_0x8059('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js b/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js index 3bcdad6..3ee3c22 100644 --- a/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js +++ b/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['http','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x6e7277,_0x1f347b){var _0x3d117c=function(_0x2d706d){while(--_0x2d706d){_0x6e7277['push'](_0x6e7277['shift']());}};_0x3d117c(++_0x1f347b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0xa9e0[_0x34bc30];return _0x5706de;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file +var _0xa9e0=['http','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x583240,_0x4f3310){var _0x3166fb=function(_0x3ac4f8){while(--_0x3ac4f8){_0x583240['push'](_0x583240['shift']());}};_0x3166fb(++_0x4f3310);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xa9e0[_0x1ac595];return _0x455fff;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index 9c5da06..ec1f18e 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 _0x5265=['Router','../../components/auth/service','../../components/interaction/service','./variable.controller','isAuthenticated','index','get','show','post','/:id','update','delete','multer','util','path','connect-timeout','express'];(function(_0x46eb54,_0x4f1eac){var _0x3902b2=function(_0x3ac68b){while(--_0x3ac68b){_0x46eb54['push'](_0x46eb54['shift']());}};_0x3902b2(++_0x4f1eac);}(_0x5265,0x182));var _0x5526=function(_0x28c0d5,_0x24e8e7){_0x28c0d5=_0x28c0d5-0x0;var _0x1ceb27=_0x5265[_0x28c0d5];return _0x1ceb27;};'use strict';var multer=require(_0x5526('0x0'));var util=require(_0x5526('0x1'));var path=require(_0x5526('0x2'));var timeout=require(_0x5526('0x3'));var express=require(_0x5526('0x4'));var router=express[_0x5526('0x5')]();var auth=require(_0x5526('0x6'));var interaction=require(_0x5526('0x7'));var config=require('../../config/environment');var controller=require(_0x5526('0x8'));router['get']('/',auth[_0x5526('0x9')](),controller[_0x5526('0xa')]);router[_0x5526('0xb')]('/:id',auth[_0x5526('0x9')](),controller[_0x5526('0xc')]);router[_0x5526('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x5526('0xe'),auth['isAuthenticated'](),controller[_0x5526('0xf')]);router[_0x5526('0x10')]('/:id',auth[_0x5526('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x4262=['delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','post','put','/:id','update'];(function(_0x29436c,_0x260a6a){var _0x3760a2=function(_0xc9ee2){while(--_0xc9ee2){_0x29436c['push'](_0x29436c['shift']());}};_0x3760a2(++_0x260a6a);}(_0x4262,0x111));var _0x2426=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x4262[_0x432682];return _0x463d05;};'use strict';var multer=require(_0x2426('0x0'));var util=require(_0x2426('0x1'));var path=require(_0x2426('0x2'));var timeout=require('connect-timeout');var express=require(_0x2426('0x3'));var router=express[_0x2426('0x4')]();var auth=require(_0x2426('0x5'));var interaction=require(_0x2426('0x6'));var config=require(_0x2426('0x7'));var controller=require('./variable.controller');router['get']('/',auth[_0x2426('0x8')](),controller[_0x2426('0x9')]);router[_0x2426('0xa')]('/:id',auth[_0x2426('0x8')](),controller['show']);router[_0x2426('0xb')]('/',auth[_0x2426('0x8')](),controller['create']);router[_0x2426('0xc')](_0x2426('0xd'),auth[_0x2426('0x8')](),controller[_0x2426('0xe')]);router[_0x2426('0xf')](_0x2426('0xd'),auth[_0x2426('0x8')](),controller[_0x2426('0x10')]);module[_0x2426('0x11')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index a9c3e00..0f0be53 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 _0x4838=['exports','name','sequelize'];(function(_0x34e7b1,_0x1cd673){var _0x26d731=function(_0x31f034){while(--_0x31f034){_0x34e7b1['push'](_0x34e7b1['shift']());}};_0x26d731(++_0x1cd673);}(_0x4838,0x1be));var _0x8483=function(_0x2d9ca9,_0x4d7d98){_0x2d9ca9=_0x2d9ca9-0x0;var _0x5626d9=_0x4838[_0x2d9ca9];return _0x5626d9;};'use strict';var Sequelize=require(_0x8483('0x0'));module[_0x8483('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x8483('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x53c5=['sequelize','exports','name'];(function(_0x5784bb,_0x395fc7){var _0x4fb3c4=function(_0x1c3594){while(--_0x1c3594){_0x5784bb['push'](_0x5784bb['shift']());}};_0x4fb3c4(++_0x395fc7);}(_0x53c5,0x6c));var _0x553c=function(_0x5000fb,_0x47fd95){_0x5000fb=_0x5000fb-0x0;var _0x46e930=_0x53c5[_0x5000fb];return _0x46e930;};'use strict';var Sequelize=require(_0x553c('0x0'));module[_0x553c('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x553c('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index 4b10d79..aceee9c 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 _0x84c9=['count','offset','limit','set','Content-Range','save','update','then','destroy','get','UserProfileResource','end','sendStatus','error','stack','name','send','index','Variable','rawAttributes','fieldName','type','model','map','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','intersection','merge','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json'];(function(_0x872b02,_0x4f4458){var _0x1a6b24=function(_0x1dfb4e){while(--_0x1dfb4e){_0x872b02['push'](_0x872b02['shift']());}};_0x1a6b24(++_0x4f4458);}(_0x84c9,0x124));var _0x984c=function(_0xe4428d,_0x203156){_0xe4428d=_0xe4428d-0x0;var _0x24ca18=_0x84c9[_0xe4428d];return _0x24ca18;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x984c('0x0'));var rp=require(_0x984c('0x1'));var moment=require(_0x984c('0x2'));var BPromise=require(_0x984c('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0x984c('0x4'));var sox=require(_0x984c('0x5'));var csv=require(_0x984c('0x6'));var ejs=require(_0x984c('0x7'));var fs=require('fs');var _=require(_0x984c('0x8'));var squel=require(_0x984c('0x9'));var crypto=require(_0x984c('0xa'));var jsforce=require(_0x984c('0xb'));var deskjs=require(_0x984c('0xc'));var toCsv=require(_0x984c('0x6'));var querystring=require(_0x984c('0xd'));var Papa=require('papaparse');var Redis=require(_0x984c('0xe'));var authService=require(_0x984c('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x984c('0x10'));var logger=require(_0x984c('0x11'))(_0x984c('0x12'));var utils=require(_0x984c('0x13'));var config=require(_0x984c('0x14'));var db=require(_0x984c('0x15'))['db'];function respondWithStatusCode(_0x1fca70,_0x3ce7a1){_0x3ce7a1=_0x3ce7a1||0xcc;return function(_0x32c845){if(_0x32c845){return _0x1fca70['sendStatus'](_0x3ce7a1);}return _0x1fca70[_0x984c('0x16')](_0x3ce7a1)['end']();};}function respondWithResult(_0x21d672,_0x4a95e6){_0x4a95e6=_0x4a95e6||0xc8;return function(_0x3e5d56){if(_0x3e5d56){return _0x21d672[_0x984c('0x16')](_0x4a95e6)[_0x984c('0x17')](_0x3e5d56);}};}function respondWithFilteredResult(_0x3dadb1,_0x47d4d1){return function(_0x1a8f17){if(_0x1a8f17){var _0x204171=_0x1a8f17[_0x984c('0x18')],_0x510b91=_0x47d4d1[_0x984c('0x19')],_0x106c1f=_0x47d4d1[_0x984c('0x19')]+_0x47d4d1[_0x984c('0x1a')],_0x241068;if(_0x106c1f>=_0x204171){_0x106c1f=_0x204171;_0x241068=0xc8;}else{_0x241068=0xce;}_0x3dadb1[_0x984c('0x16')](_0x241068);return _0x3dadb1[_0x984c('0x1b')](_0x984c('0x1c'),_0x510b91+'-'+_0x106c1f+'/'+_0x204171)[_0x984c('0x17')](_0x1a8f17);}return null;};}function patchUpdates(_0x3bed78){return function(_0x463fe3){try{jsonpatch['apply'](_0x463fe3,_0x3bed78,!![]);}catch(_0x8abd37){return BPromise['reject'](_0x8abd37);}return _0x463fe3[_0x984c('0x1d')]();};}function saveUpdates(_0x2a8a55,_0x12f464){return function(_0x2a4678){if(_0x2a4678){return _0x2a4678[_0x984c('0x1e')](_0x2a8a55)[_0x984c('0x1f')](function(_0x5c9ed3){return _0x5c9ed3;});}return null;};}function removeEntity(_0x5afdae,_0x2370fa){return function(_0x71b1d3){if(_0x71b1d3){return _0x71b1d3[_0x984c('0x20')]()[_0x984c('0x1f')](function(){var _0x2aae8e=_0x71b1d3[_0x984c('0x21')]({'plain':!![]});var _0xdf882b='Variables';return db[_0x984c('0x22')][_0x984c('0x20')]({'where':{'type':_0xdf882b,'resourceId':_0x2aae8e['id']}})['then'](function(){return _0x71b1d3;});})['then'](function(){_0x5afdae[_0x984c('0x16')](0xcc)[_0x984c('0x23')]();});}};}function handleEntityNotFound(_0x2c7696,_0x587bfd){return function(_0x1c6193){if(!_0x1c6193){_0x2c7696[_0x984c('0x24')](0x194);}return _0x1c6193;};}function handleError(_0x362d9c,_0x2014d5){_0x2014d5=_0x2014d5||0x1f4;return function(_0x3fe24f){logger[_0x984c('0x25')](_0x3fe24f[_0x984c('0x26')]);if(_0x3fe24f[_0x984c('0x27')]){delete _0x3fe24f['name'];}_0x362d9c[_0x984c('0x16')](_0x2014d5)[_0x984c('0x28')](_0x3fe24f);};}exports[_0x984c('0x29')]=function(_0x35e51c,_0x20223c){var _0xc588f6={},_0x54164a={},_0xa66130={'count':0x0,'rows':[]};var _0x421eb2=_['map'](db[_0x984c('0x2a')][_0x984c('0x2b')],function(_0x24bcf5){return{'name':_0x24bcf5[_0x984c('0x2c')],'type':_0x24bcf5[_0x984c('0x2d')]['key']};});_0x54164a[_0x984c('0x2e')]=_[_0x984c('0x2f')](_0x421eb2,_0x984c('0x27'));_0x54164a[_0x984c('0x30')]=_[_0x984c('0x31')](_0x35e51c[_0x984c('0x30')]);_0x54164a[_0x984c('0x32')]=_['intersection'](_0x54164a[_0x984c('0x2e')],_0x54164a[_0x984c('0x30')]);_0xc588f6[_0x984c('0x33')]=_['intersection'](_0x54164a['model'],qs['fields'](_0x35e51c['query'][_0x984c('0x34')]));_0xc588f6[_0x984c('0x33')]=_0xc588f6[_0x984c('0x33')][_0x984c('0x35')]?_0xc588f6['attributes']:_0x54164a[_0x984c('0x2e')];if(!_0x35e51c[_0x984c('0x30')][_0x984c('0x36')](_0x984c('0x37'))){_0xc588f6['limit']=qs[_0x984c('0x1a')](_0x35e51c[_0x984c('0x30')][_0x984c('0x1a')]);_0xc588f6[_0x984c('0x19')]=qs[_0x984c('0x19')](_0x35e51c[_0x984c('0x30')][_0x984c('0x19')]);}_0xc588f6['order']=qs['sort'](_0x35e51c[_0x984c('0x30')][_0x984c('0x38')]);_0xc588f6[_0x984c('0x39')]=qs[_0x984c('0x32')](_[_0x984c('0x3a')](_0x35e51c[_0x984c('0x30')],_0x54164a['filters']));if(_0x35e51c[_0x984c('0x30')][_0x984c('0x3b')]){_0xc588f6[_0x984c('0x39')]=_['merge'](_0xc588f6[_0x984c('0x39')],{'$or':_['map'](_0x421eb2,function(_0x345cf0){if(_0x345cf0[_0x984c('0x2d')]!==_0x984c('0x3c')){var _0x10712c={};_0x10712c[_0x345cf0[_0x984c('0x27')]]={'$like':'%'+_0x35e51c[_0x984c('0x30')]['filter']+'%'};return _0x10712c;}})});}_0xc588f6=_['merge']({},_0xc588f6,_0x35e51c['options']);var _0x51e14d={'where':_0xc588f6[_0x984c('0x39')]};return db[_0x984c('0x2a')][_0x984c('0x18')](_0x51e14d)[_0x984c('0x1f')](function(_0x76873c){_0xa66130['count']=_0x76873c;if(_0x35e51c[_0x984c('0x30')][_0x984c('0x3d')]){_0xc588f6[_0x984c('0x3e')]=[{'all':!![]}];}return db[_0x984c('0x2a')][_0x984c('0x3f')](_0xc588f6);})[_0x984c('0x1f')](function(_0x9dae2b){_0xa66130[_0x984c('0x40')]=_0x9dae2b;return _0xa66130;})[_0x984c('0x1f')](respondWithFilteredResult(_0x20223c,_0xc588f6))[_0x984c('0x41')](handleError(_0x20223c,null));};exports[_0x984c('0x42')]=function(_0x2d5ec7,_0x437f4a){var _0x34bba5={'raw':!![],'where':{'id':_0x2d5ec7[_0x984c('0x43')]['id']}},_0x318696={};_0x318696[_0x984c('0x2e')]=_[_0x984c('0x31')](db[_0x984c('0x2a')][_0x984c('0x2b')]);_0x318696[_0x984c('0x30')]=_[_0x984c('0x31')](_0x2d5ec7[_0x984c('0x30')]);_0x318696[_0x984c('0x32')]=_['intersection'](_0x318696[_0x984c('0x2e')],_0x318696[_0x984c('0x30')]);_0x34bba5[_0x984c('0x33')]=_[_0x984c('0x44')](_0x318696['model'],qs[_0x984c('0x34')](_0x2d5ec7[_0x984c('0x30')][_0x984c('0x34')]));_0x34bba5[_0x984c('0x33')]=_0x34bba5[_0x984c('0x33')][_0x984c('0x35')]?_0x34bba5[_0x984c('0x33')]:_0x318696[_0x984c('0x2e')];if(_0x2d5ec7[_0x984c('0x30')][_0x984c('0x3d')]){_0x34bba5[_0x984c('0x3e')]=[{'all':!![]}];}_0x34bba5=_[_0x984c('0x45')]({},_0x34bba5,_0x2d5ec7['options']);return db['Variable']['find'](_0x34bba5)[_0x984c('0x1f')](handleEntityNotFound(_0x437f4a,null))[_0x984c('0x1f')](respondWithResult(_0x437f4a,null))['catch'](handleError(_0x437f4a,null));};exports['create']=function(_0x31de83,_0x49923f){return db[_0x984c('0x2a')][_0x984c('0x46')](_0x31de83[_0x984c('0x47')],{})[_0x984c('0x1f')](function(_0x414525){var _0x12ad17=_0x31de83[_0x984c('0x48')][_0x984c('0x21')]({'plain':!![]});if(!_0x12ad17)throw new Error(_0x984c('0x49'));if(_0x12ad17[_0x984c('0x4a')]===_0x984c('0x48')){var _0x4bfc06=_0x414525[_0x984c('0x21')]({'plain':!![]});var _0x1482ab='Variables';return db[_0x984c('0x4b')]['find']({'where':{'name':_0x1482ab,'userProfileId':_0x12ad17[_0x984c('0x4c')]},'raw':!![]})[_0x984c('0x1f')](function(_0x573e67){if(_0x573e67&&_0x573e67[_0x984c('0x4d')]===0x0){return db[_0x984c('0x22')]['create']({'name':_0x4bfc06[_0x984c('0x27')],'resourceId':_0x4bfc06['id'],'type':_0x573e67[_0x984c('0x27')],'sectionId':_0x573e67['id']},{})[_0x984c('0x1f')](function(){return _0x414525;});}else{return _0x414525;}})['catch'](function(_0x235058){logger[_0x984c('0x25')](_0x984c('0x4e'),_0x235058);throw _0x235058;});}return _0x414525;})['then'](respondWithResult(_0x49923f,0xc9))['catch'](handleError(_0x49923f,null));};exports[_0x984c('0x1e')]=function(_0x2180ae,_0x12a3b0){if(_0x2180ae[_0x984c('0x47')]['id']){delete _0x2180ae[_0x984c('0x47')]['id'];}return db[_0x984c('0x2a')]['find']({'where':{'id':_0x2180ae[_0x984c('0x43')]['id']}})[_0x984c('0x1f')](handleEntityNotFound(_0x12a3b0,null))[_0x984c('0x1f')](saveUpdates(_0x2180ae[_0x984c('0x47')],null))[_0x984c('0x1f')](respondWithResult(_0x12a3b0,null))[_0x984c('0x41')](handleError(_0x12a3b0,null));};exports[_0x984c('0x20')]=function(_0x5d4b22,_0x21843b){return db[_0x984c('0x2a')]['find']({'where':{'id':_0x5d4b22[_0x984c('0x43')]['id']}})[_0x984c('0x1f')](handleEntityNotFound(_0x21843b,null))[_0x984c('0x1f')](removeEntity(_0x21843b,null))['catch'](handleError(_0x21843b,null));}; \ No newline at end of file +var _0xf19f=['set','Content-Range','apply','reject','save','update','then','destroy','get','Variables','UserProfileResource','stack','name','send','index','Variable','rawAttributes','fieldName','type','key','map','query','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','params','keys','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','error','body','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','sendStatus','end','status','json','count','offset','limit'];(function(_0x4ab3fb,_0x776775){var _0x34fe1e=function(_0x1c94c5){while(--_0x1c94c5){_0x4ab3fb['push'](_0x4ab3fb['shift']());}};_0x34fe1e(++_0x776775);}(_0xf19f,0xcd));var _0xff19=function(_0x5eef05,_0x1be989){_0x5eef05=_0x5eef05-0x0;var _0x56d4b8=_0xf19f[_0x5eef05];return _0x56d4b8;};'use strict';var pdf=require(_0xff19('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xff19('0x1'));var zipdir=require(_0xff19('0x2'));var jsonpatch=require(_0xff19('0x3'));var rp=require(_0xff19('0x4'));var moment=require(_0xff19('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xff19('0x6'));var path=require('path');var sox=require(_0xff19('0x7'));var csv=require(_0xff19('0x8'));var ejs=require(_0xff19('0x9'));var fs=require('fs');var _=require(_0xff19('0xa'));var squel=require(_0xff19('0xb'));var crypto=require(_0xff19('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xff19('0xd'));var Papa=require(_0xff19('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xff19('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xff19('0x10'))(_0xff19('0x11'));var utils=require(_0xff19('0x12'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x33b089,_0x57e71e){_0x57e71e=_0x57e71e||0xcc;return function(_0x50bd38){if(_0x50bd38){return _0x33b089[_0xff19('0x13')](_0x57e71e);}return _0x33b089['status'](_0x57e71e)[_0xff19('0x14')]();};}function respondWithResult(_0x3b7370,_0x4c27fa){_0x4c27fa=_0x4c27fa||0xc8;return function(_0x1340c5){if(_0x1340c5){return _0x3b7370[_0xff19('0x15')](_0x4c27fa)[_0xff19('0x16')](_0x1340c5);}};}function respondWithFilteredResult(_0x474511,_0x2e6a30){return function(_0x590b5f){if(_0x590b5f){var _0x371c15=_0x590b5f[_0xff19('0x17')],_0x52ef3e=_0x2e6a30['offset'],_0x123b11=_0x2e6a30[_0xff19('0x18')]+_0x2e6a30[_0xff19('0x19')],_0x3356e0;if(_0x123b11>=_0x371c15){_0x123b11=_0x371c15;_0x3356e0=0xc8;}else{_0x3356e0=0xce;}_0x474511[_0xff19('0x15')](_0x3356e0);return _0x474511[_0xff19('0x1a')](_0xff19('0x1b'),_0x52ef3e+'-'+_0x123b11+'/'+_0x371c15)[_0xff19('0x16')](_0x590b5f);}return null;};}function patchUpdates(_0x164b3d){return function(_0x1b4c63){try{jsonpatch[_0xff19('0x1c')](_0x1b4c63,_0x164b3d,!![]);}catch(_0x4adccc){return BPromise[_0xff19('0x1d')](_0x4adccc);}return _0x1b4c63[_0xff19('0x1e')]();};}function saveUpdates(_0x172ac9,_0x1c6ea1){return function(_0x34e090){if(_0x34e090){return _0x34e090[_0xff19('0x1f')](_0x172ac9)[_0xff19('0x20')](function(_0x487a2e){return _0x487a2e;});}return null;};}function removeEntity(_0x48c611,_0x42ce48){return function(_0x2584fc){if(_0x2584fc){return _0x2584fc[_0xff19('0x21')]()[_0xff19('0x20')](function(){var _0x2186c1=_0x2584fc[_0xff19('0x22')]({'plain':!![]});var _0x310f79=_0xff19('0x23');return db[_0xff19('0x24')][_0xff19('0x21')]({'where':{'type':_0x310f79,'resourceId':_0x2186c1['id']}})[_0xff19('0x20')](function(){return _0x2584fc;});})['then'](function(){_0x48c611[_0xff19('0x15')](0xcc)[_0xff19('0x14')]();});}};}function handleEntityNotFound(_0x4d775c,_0x49db51){return function(_0x472ed3){if(!_0x472ed3){_0x4d775c[_0xff19('0x13')](0x194);}return _0x472ed3;};}function handleError(_0x5e713a,_0x5c1fca){_0x5c1fca=_0x5c1fca||0x1f4;return function(_0x17491f){logger['error'](_0x17491f[_0xff19('0x25')]);if(_0x17491f[_0xff19('0x26')]){delete _0x17491f[_0xff19('0x26')];}_0x5e713a['status'](_0x5c1fca)[_0xff19('0x27')](_0x17491f);};}exports[_0xff19('0x28')]=function(_0x3b73f9,_0x5e88ee){var _0x157393={},_0x157838={},_0x13f432={'count':0x0,'rows':[]};var _0x2fac00=_['map'](db[_0xff19('0x29')][_0xff19('0x2a')],function(_0x4442a0){return{'name':_0x4442a0[_0xff19('0x2b')],'type':_0x4442a0[_0xff19('0x2c')][_0xff19('0x2d')]};});_0x157838['model']=_[_0xff19('0x2e')](_0x2fac00,'name');_0x157838[_0xff19('0x2f')]=_['keys'](_0x3b73f9[_0xff19('0x2f')]);_0x157838[_0xff19('0x30')]=_[_0xff19('0x31')](_0x157838[_0xff19('0x32')],_0x157838['query']);_0x157393['attributes']=_['intersection'](_0x157838[_0xff19('0x32')],qs[_0xff19('0x33')](_0x3b73f9[_0xff19('0x2f')][_0xff19('0x33')]));_0x157393[_0xff19('0x34')]=_0x157393['attributes']['length']?_0x157393[_0xff19('0x34')]:_0x157838[_0xff19('0x32')];if(!_0x3b73f9[_0xff19('0x2f')][_0xff19('0x35')](_0xff19('0x36'))){_0x157393[_0xff19('0x19')]=qs['limit'](_0x3b73f9[_0xff19('0x2f')][_0xff19('0x19')]);_0x157393['offset']=qs['offset'](_0x3b73f9[_0xff19('0x2f')][_0xff19('0x18')]);}_0x157393[_0xff19('0x37')]=qs[_0xff19('0x38')](_0x3b73f9[_0xff19('0x2f')][_0xff19('0x38')]);_0x157393[_0xff19('0x39')]=qs[_0xff19('0x30')](_[_0xff19('0x3a')](_0x3b73f9[_0xff19('0x2f')],_0x157838[_0xff19('0x30')]));if(_0x3b73f9['query'][_0xff19('0x3b')]){_0x157393['where']=_['merge'](_0x157393[_0xff19('0x39')],{'$or':_[_0xff19('0x2e')](_0x2fac00,function(_0x46c1bb){if(_0x46c1bb['type']!=='VIRTUAL'){var _0x2c5e43={};_0x2c5e43[_0x46c1bb['name']]={'$like':'%'+_0x3b73f9[_0xff19('0x2f')]['filter']+'%'};return _0x2c5e43;}})});}_0x157393=_[_0xff19('0x3c')]({},_0x157393,_0x3b73f9[_0xff19('0x3d')]);var _0x2c9703={'where':_0x157393[_0xff19('0x39')]};return db[_0xff19('0x29')]['count'](_0x2c9703)[_0xff19('0x20')](function(_0x17c4c1){_0x13f432[_0xff19('0x17')]=_0x17c4c1;if(_0x3b73f9[_0xff19('0x2f')][_0xff19('0x3e')]){_0x157393[_0xff19('0x3f')]=[{'all':!![]}];}return db['Variable'][_0xff19('0x40')](_0x157393);})[_0xff19('0x20')](function(_0x22eead){_0x13f432[_0xff19('0x41')]=_0x22eead;return _0x13f432;})[_0xff19('0x20')](respondWithFilteredResult(_0x5e88ee,_0x157393))[_0xff19('0x42')](handleError(_0x5e88ee,null));};exports['show']=function(_0x166dcf,_0x393b75){var _0x232288={'raw':!![],'where':{'id':_0x166dcf[_0xff19('0x43')]['id']}},_0x26a4f6={};_0x26a4f6[_0xff19('0x32')]=_['keys'](db[_0xff19('0x29')][_0xff19('0x2a')]);_0x26a4f6[_0xff19('0x2f')]=_[_0xff19('0x44')](_0x166dcf[_0xff19('0x2f')]);_0x26a4f6[_0xff19('0x30')]=_[_0xff19('0x31')](_0x26a4f6[_0xff19('0x32')],_0x26a4f6[_0xff19('0x2f')]);_0x232288[_0xff19('0x34')]=_[_0xff19('0x31')](_0x26a4f6[_0xff19('0x32')],qs[_0xff19('0x33')](_0x166dcf[_0xff19('0x2f')]['fields']));_0x232288[_0xff19('0x34')]=_0x232288['attributes']['length']?_0x232288[_0xff19('0x34')]:_0x26a4f6['model'];if(_0x166dcf['query']['includeAll']){_0x232288['include']=[{'all':!![]}];}_0x232288=_[_0xff19('0x3c')]({},_0x232288,_0x166dcf[_0xff19('0x3d')]);return db[_0xff19('0x29')][_0xff19('0x45')](_0x232288)[_0xff19('0x20')](handleEntityNotFound(_0x393b75,null))[_0xff19('0x20')](respondWithResult(_0x393b75,null))[_0xff19('0x42')](handleError(_0x393b75,null));};exports['create']=function(_0x3bca7c,_0x16631f){return db[_0xff19('0x29')][_0xff19('0x46')](_0x3bca7c['body'],{})['then'](function(_0x763132){var _0x377b8c=_0x3bca7c[_0xff19('0x47')][_0xff19('0x22')]({'plain':!![]});if(!_0x377b8c)throw new Error(_0xff19('0x48'));if(_0x377b8c['role']===_0xff19('0x47')){var _0xda0017=_0x763132[_0xff19('0x22')]({'plain':!![]});var _0x174626=_0xff19('0x23');return db['UserProfileSection'][_0xff19('0x45')]({'where':{'name':_0x174626,'userProfileId':_0x377b8c[_0xff19('0x49')]},'raw':!![]})['then'](function(_0x1ce802){if(_0x1ce802&&_0x1ce802[_0xff19('0x4a')]===0x0){return db[_0xff19('0x24')][_0xff19('0x46')]({'name':_0xda0017[_0xff19('0x26')],'resourceId':_0xda0017['id'],'type':_0x1ce802[_0xff19('0x26')],'sectionId':_0x1ce802['id']},{})[_0xff19('0x20')](function(){return _0x763132;});}else{return _0x763132;}})['catch'](function(_0x366fb4){logger[_0xff19('0x4b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x366fb4);throw _0x366fb4;});}return _0x763132;})[_0xff19('0x20')](respondWithResult(_0x16631f,0xc9))[_0xff19('0x42')](handleError(_0x16631f,null));};exports['update']=function(_0x5e1fcd,_0x141ddc){if(_0x5e1fcd[_0xff19('0x4c')]['id']){delete _0x5e1fcd[_0xff19('0x4c')]['id'];}return db[_0xff19('0x29')][_0xff19('0x45')]({'where':{'id':_0x5e1fcd['params']['id']}})['then'](handleEntityNotFound(_0x141ddc,null))[_0xff19('0x20')](saveUpdates(_0x5e1fcd['body'],null))['then'](respondWithResult(_0x141ddc,null))[_0xff19('0x42')](handleError(_0x141ddc,null));};exports[_0xff19('0x21')]=function(_0x115bab,_0x2f21de){return db[_0xff19('0x29')][_0xff19('0x45')]({'where':{'id':_0x115bab[_0xff19('0x43')]['id']}})['then'](handleEntityNotFound(_0x2f21de,null))['then'](removeEntity(_0x2f21de,null))['catch'](handleError(_0x2f21de,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index a5d9599..3c54354 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 _0xe563=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','Variable','tools_variables','lodash'];(function(_0x18150c,_0x107d6d){var _0x2b4160=function(_0x3a04ec){while(--_0x3a04ec){_0x18150c['push'](_0x18150c['shift']());}};_0x2b4160(++_0x107d6d);}(_0xe563,0x125));var _0x3e56=function(_0x5d244b,_0x37b8f3){_0x5d244b=_0x5d244b-0x0;var _0x26ba4b=_0xe563[_0x5d244b];return _0x26ba4b;};'use strict';var _=require(_0x3e56('0x0'));var util=require(_0x3e56('0x1'));var logger=require(_0x3e56('0x2'))(_0x3e56('0x3'));var moment=require(_0x3e56('0x4'));var BPromise=require(_0x3e56('0x5'));var rp=require(_0x3e56('0x6'));var fs=require('fs');var path=require(_0x3e56('0x7'));var rimraf=require(_0x3e56('0x8'));var config=require(_0x3e56('0x9'));var attributes=require('./variable.attributes');module[_0x3e56('0xa')]=function(_0x5cb14b,_0x1d6057){return _0x5cb14b[_0x3e56('0xb')](_0x3e56('0xc'),attributes,{'tableName':_0x3e56('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x324f=['./variable.attributes','exports','define','Variable','tools_variables','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x4478ae,_0x48f246){var _0x4d8c63=function(_0x5372bf){while(--_0x5372bf){_0x4478ae['push'](_0x4478ae['shift']());}};_0x4d8c63(++_0x48f246);}(_0x324f,0x94));var _0xf324=function(_0x14afeb,_0x1d2903){_0x14afeb=_0x14afeb-0x0;var _0x7c708a=_0x324f[_0x14afeb];return _0x7c708a;};'use strict';var _=require(_0xf324('0x0'));var util=require(_0xf324('0x1'));var logger=require(_0xf324('0x2'))('api');var moment=require('moment');var BPromise=require(_0xf324('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf324('0x4'));var rimraf=require(_0xf324('0x5'));var config=require('../../config/environment');var attributes=require(_0xf324('0x6'));module[_0xf324('0x7')]=function(_0x5657a5,_0x19ef3b){return _0x5657a5[_0xf324('0x8')](_0xf324('0x9'),attributes,{'tableName':_0xf324('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/variable/variable.rpc.js b/server/api/variable/variable.rpc.js index 6562a29..4978b32 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 _0x2ca7=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','info','Variable,\x20%s,\x20%s','request\x20sent','Variable,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','ShowVariable','find','options','raw','where','attributes','map','include','model','debug','stringify','lodash','util','moment'];(function(_0x51c082,_0x5ac6b2){var _0xb21207=function(_0x373603){while(--_0x373603){_0x51c082['push'](_0x51c082['shift']());}};_0xb21207(++_0x5ac6b2);}(_0x2ca7,0x1ed));var _0x72ca=function(_0x456e2b,_0x560dd9){_0x456e2b=_0x456e2b-0x0;var _0x3a432c=_0x2ca7[_0x456e2b];return _0x3a432c;};'use strict';var _=require(_0x72ca('0x0'));var util=require(_0x72ca('0x1'));var moment=require(_0x72ca('0x2'));var BPromise=require('bluebird');var rs=require(_0x72ca('0x3'));var fs=require('fs');var Redis=require(_0x72ca('0x4'));var db=require(_0x72ca('0x5'))['db'];var utils=require(_0x72ca('0x6'));var logger=require(_0x72ca('0x7'))('rpc');var config=require(_0x72ca('0x8'));var jayson=require(_0x72ca('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x135f09,_0x45e022,_0x9dfed8){return new BPromise(function(_0x171143,_0x38650e){return client[_0x72ca('0xa')](_0x135f09,_0x9dfed8)['then'](function(_0x506cce){logger[_0x72ca('0xb')](_0x72ca('0xc'),_0x45e022,_0x72ca('0xd'));logger['debug'](_0x72ca('0xe'),_0x45e022,'request\x20sent',JSON['stringify'](_0x506cce));if(_0x506cce[_0x72ca('0xf')]){if(_0x506cce[_0x72ca('0xf')][_0x72ca('0x10')]===0x1f4){logger['error']('Variable,\x20%s,\x20%s',_0x45e022,_0x506cce['error'][_0x72ca('0x11')]);return _0x38650e(_0x506cce[_0x72ca('0xf')][_0x72ca('0x11')]);}logger['error'](_0x72ca('0xc'),_0x45e022,_0x506cce[_0x72ca('0xf')][_0x72ca('0x11')]);return _0x171143(_0x506cce[_0x72ca('0xf')][_0x72ca('0x11')]);}else{logger[_0x72ca('0xb')](_0x72ca('0xc'),_0x45e022,_0x72ca('0xd'));_0x171143(_0x506cce[_0x72ca('0x12')]['message']);}})[_0x72ca('0x13')](function(_0x2b61f1){logger['error'](_0x72ca('0xc'),_0x45e022,_0x2b61f1);_0x38650e(_0x2b61f1);});});}exports[_0x72ca('0x14')]=function(_0x789461){var _0x5b23be=this;return new Promise(function(_0x243269,_0x445408){return db['Variable'][_0x72ca('0x15')]({'raw':_0x789461[_0x72ca('0x16')]?_0x789461['options'][_0x72ca('0x17')]===undefined?!![]:![]:!![],'where':_0x789461[_0x72ca('0x16')]?_0x789461[_0x72ca('0x16')][_0x72ca('0x18')]||null:null,'attributes':_0x789461[_0x72ca('0x16')]?_0x789461[_0x72ca('0x16')][_0x72ca('0x19')]||null:null,'include':_0x789461['options']?_0x789461[_0x72ca('0x16')]['include']?_[_0x72ca('0x1a')](_0x789461[_0x72ca('0x16')][_0x72ca('0x1b')],function(_0x2d848c){return{'model':db[_0x2d848c['model']],'as':_0x2d848c['as'],'attributes':_0x2d848c[_0x72ca('0x19')],'include':_0x2d848c[_0x72ca('0x1b')]?_[_0x72ca('0x1a')](_0x2d848c[_0x72ca('0x1b')],function(_0x3949e2){return{'model':db[_0x3949e2['model']],'as':_0x3949e2['as'],'attributes':_0x3949e2[_0x72ca('0x19')],'include':_0x3949e2['include']?_[_0x72ca('0x1a')](_0x3949e2[_0x72ca('0x1b')],function(_0x160dcb){return{'model':db[_0x160dcb[_0x72ca('0x1c')]],'as':_0x160dcb['as'],'attributes':_0x160dcb['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x42f0b3){logger['info']('ShowVariable',_0x789461);logger[_0x72ca('0x1d')](_0x72ca('0x14'),_0x789461,JSON[_0x72ca('0x1e')](_0x42f0b3));_0x243269(_0x42f0b3);})['catch'](function(_0x373e17){logger[_0x72ca('0xf')](_0x72ca('0x14'),_0x373e17[_0x72ca('0x11')],_0x789461);_0x445408(_0x5b23be[_0x72ca('0xf')](0x1f4,_0x373e17['message']));});});}; \ No newline at end of file +var _0x1efb=['debug','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','request','then','Variable,\x20%s,\x20%s','request\x20sent','Variable,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ShowVariable','Variable','options','where','attributes','include','model','map','info'];(function(_0x2faddb,_0xc18b78){var _0x273c05=function(_0x1a3785){while(--_0x1a3785){_0x2faddb['push'](_0x2faddb['shift']());}};_0x273c05(++_0xc18b78);}(_0x1efb,0x1b4));var _0xb1ef=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x1efb[_0x1d1779];return _0x2377e9;};'use strict';var _=require(_0xb1ef('0x0'));var util=require(_0xb1ef('0x1'));var moment=require(_0xb1ef('0x2'));var BPromise=require(_0xb1ef('0x3'));var rs=require(_0xb1ef('0x4'));var fs=require('fs');var Redis=require(_0xb1ef('0x5'));var db=require(_0xb1ef('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xb1ef('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xb1ef('0x8'));var client=jayson[_0xb1ef('0x9')][_0xb1ef('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2c4d93,_0x309af6,_0x26d94b){return new BPromise(function(_0x27501d,_0x43c86d){return client[_0xb1ef('0xb')](_0x2c4d93,_0x26d94b)[_0xb1ef('0xc')](function(_0x414e96){logger['info'](_0xb1ef('0xd'),_0x309af6,_0xb1ef('0xe'));logger['debug'](_0xb1ef('0xf'),_0x309af6,'request\x20sent',JSON[_0xb1ef('0x10')](_0x414e96));if(_0x414e96[_0xb1ef('0x11')]){if(_0x414e96[_0xb1ef('0x11')][_0xb1ef('0x12')]===0x1f4){logger['error'](_0xb1ef('0xd'),_0x309af6,_0x414e96[_0xb1ef('0x11')][_0xb1ef('0x13')]);return _0x43c86d(_0x414e96[_0xb1ef('0x11')]['message']);}logger[_0xb1ef('0x11')]('Variable,\x20%s,\x20%s',_0x309af6,_0x414e96[_0xb1ef('0x11')]['message']);return _0x27501d(_0x414e96['error'][_0xb1ef('0x13')]);}else{logger['info'](_0xb1ef('0xd'),_0x309af6,_0xb1ef('0xe'));_0x27501d(_0x414e96['result'][_0xb1ef('0x13')]);}})['catch'](function(_0xee0081){logger['error']('Variable,\x20%s,\x20%s',_0x309af6,_0xee0081);_0x43c86d(_0xee0081);});});}exports[_0xb1ef('0x14')]=function(_0x2f17ef){var _0x93018=this;return new Promise(function(_0x243b9c,_0xfc8a0){return db[_0xb1ef('0x15')]['find']({'raw':_0x2f17ef[_0xb1ef('0x16')]?_0x2f17ef['options']['raw']===undefined?!![]:![]:!![],'where':_0x2f17ef[_0xb1ef('0x16')]?_0x2f17ef[_0xb1ef('0x16')][_0xb1ef('0x17')]||null:null,'attributes':_0x2f17ef[_0xb1ef('0x16')]?_0x2f17ef[_0xb1ef('0x16')][_0xb1ef('0x18')]||null:null,'include':_0x2f17ef[_0xb1ef('0x16')]?_0x2f17ef[_0xb1ef('0x16')][_0xb1ef('0x19')]?_['map'](_0x2f17ef['options'][_0xb1ef('0x19')],function(_0x58544e){return{'model':db[_0x58544e[_0xb1ef('0x1a')]],'as':_0x58544e['as'],'attributes':_0x58544e['attributes'],'include':_0x58544e['include']?_['map'](_0x58544e[_0xb1ef('0x19')],function(_0x2521ad){return{'model':db[_0x2521ad[_0xb1ef('0x1a')]],'as':_0x2521ad['as'],'attributes':_0x2521ad['attributes'],'include':_0x2521ad['include']?_[_0xb1ef('0x1b')](_0x2521ad[_0xb1ef('0x19')],function(_0x16ad58){return{'model':db[_0x16ad58[_0xb1ef('0x1a')]],'as':_0x16ad58['as'],'attributes':_0x16ad58['attributes']};}):[]};}):[]};}):[]:[]})[_0xb1ef('0xc')](function(_0x4e1b62){logger[_0xb1ef('0x1c')]('ShowVariable',_0x2f17ef);logger[_0xb1ef('0x1d')](_0xb1ef('0x14'),_0x2f17ef,JSON[_0xb1ef('0x10')](_0x4e1b62));_0x243b9c(_0x4e1b62);})[_0xb1ef('0x1e')](function(_0x215255){logger[_0xb1ef('0x11')](_0xb1ef('0x14'),_0x215255['message'],_0x2f17ef);_0xfc8a0(_0x93018[_0xb1ef('0x11')](0x1f4,_0x215255[_0xb1ef('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index 73015b5..80a659a 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 _0x1c3d=['pull','/restart','/migrations','migrations','express','../../components/auth/service','get','/fetch','canUpdate','fetch','isAuthenticated','reset','/pull'];(function(_0x584497,_0x52e264){var _0x2e5d3e=function(_0x2e5fec){while(--_0x2e5fec){_0x584497['push'](_0x584497['shift']());}};_0x2e5d3e(++_0x52e264);}(_0x1c3d,0x12f));var _0xd1c3=function(_0x90e597,_0x5e2cb2){_0x90e597=_0x90e597-0x0;var _0x530763=_0x1c3d[_0x90e597];return _0x530763;};'use strict';var express=require(_0xd1c3('0x0'));var router=express['Router']();var auth=require(_0xd1c3('0x1'));var controller=require('./version.controller');router[_0xd1c3('0x2')]('/',controller['index']);router['get'](_0xd1c3('0x3'),auth['isAuthenticated'](),auth[_0xd1c3('0x4')](),controller[_0xd1c3('0x5')]);router[_0xd1c3('0x2')]('/reset',auth[_0xd1c3('0x6')](),auth[_0xd1c3('0x4')](),controller[_0xd1c3('0x7')]);router[_0xd1c3('0x2')](_0xd1c3('0x8'),auth[_0xd1c3('0x6')](),auth[_0xd1c3('0x4')](),controller[_0xd1c3('0x9')]);router[_0xd1c3('0x2')](_0xd1c3('0xa'),auth[_0xd1c3('0x6')](),controller['restart']);router[_0xd1c3('0x2')](_0xd1c3('0xb'),controller[_0xd1c3('0xc')]);module['exports']=router; \ No newline at end of file +var _0x5204=['index','/fetch','isAuthenticated','canUpdate','fetch','reset','pull','/restart','restart','/migrations','migrations','exports','express','Router','../../components/auth/service','./version.controller','get'];(function(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0x5204,0xd8));var _0x4520=function(_0x4bfe08,_0x48ae7b){_0x4bfe08=_0x4bfe08-0x0;var _0x1f9125=_0x5204[_0x4bfe08];return _0x1f9125;};'use strict';var express=require(_0x4520('0x0'));var router=express[_0x4520('0x1')]();var auth=require(_0x4520('0x2'));var controller=require(_0x4520('0x3'));router[_0x4520('0x4')]('/',controller[_0x4520('0x5')]);router[_0x4520('0x4')](_0x4520('0x6'),auth[_0x4520('0x7')](),auth[_0x4520('0x8')](),controller[_0x4520('0x9')]);router[_0x4520('0x4')]('/reset',auth['isAuthenticated'](),auth[_0x4520('0x8')](),controller[_0x4520('0xa')]);router[_0x4520('0x4')]('/pull',auth[_0x4520('0x7')](),auth[_0x4520('0x8')](),controller[_0x4520('0xb')]);router[_0x4520('0x4')](_0x4520('0xc'),auth['isAuthenticated'](),controller[_0x4520('0xd')]);router[_0x4520('0x4')](_0x4520('0xe'),controller[_0x4520('0xf')]);module[_0x4520('0x10')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index 6a1fe66..8c02d83 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 _0xb4d9=['../../mysqldb','../../config/environment','../../config/pm2','../../config/logger','update','simple-git','root','index','exports','query','latest','fetch','tags','2.0.0','status','json','origin','error','info','git\x20fetch','reset','--hard','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','npm\x20install\x20--production','motion2','then','catch','readdirSync','server','migrations','length','replace','.js','push','sort','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.','join','map','last','Database\x20already\x20up-to-date','umzug','path','pkginfo','version','compare-versions','exec'];(function(_0x5bb8c4,_0x5bf924){var _0x32150e=function(_0xb233e6){while(--_0xb233e6){_0x5bb8c4['push'](_0x5bb8c4['shift']());}};_0x32150e(++_0x5bf924);}(_0xb4d9,0xce));var _0x9b4d=function(_0x1beef3,_0x57c4b8){_0x1beef3=_0x1beef3-0x0;var _0x5af964=_0xb4d9[_0x1beef3];return _0x5af964;};'use strict';var Umzug=require(_0x9b4d('0x0'));var path=require(_0x9b4d('0x1'));var fs=require('fs');var _=require('lodash');var pkginfo=require(_0x9b4d('0x2'))(module,_0x9b4d('0x3'));var compareVersions=require(_0x9b4d('0x4'));var exec=require('child_process')[_0x9b4d('0x5')];var db=require(_0x9b4d('0x6'))['db'];var config=require(_0x9b4d('0x7'));var pm2=require(_0x9b4d('0x8'));var logger=require(_0x9b4d('0x9'))(_0x9b4d('0xa'));var git=require(_0x9b4d('0xb'))(config[_0x9b4d('0xc')]);exports[_0x9b4d('0xd')]=function(_0x14cb0b,_0x156c68){var _0x48832a={'current':module[_0x9b4d('0xe')]['version'],'phonebar':0x2};if(_0x14cb0b[_0x9b4d('0xf')]&&_0x14cb0b['query'][_0x9b4d('0x10')]){return git[_0x9b4d('0x11')]()[_0x9b4d('0x12')](function(_0x18173c,_0x176759){_0x48832a[_0x9b4d('0x10')]=(_0x18173c?module[_0x9b4d('0xe')][_0x9b4d('0x3')]:_0x176759[_0x9b4d('0x10')])||_0x9b4d('0x13');return _0x156c68[_0x9b4d('0x14')](0xc8)[_0x9b4d('0x15')](_0x48832a);});}else{return _0x156c68['status'](0xc8)[_0x9b4d('0x15')](_0x48832a);}};exports[_0x9b4d('0x11')]=function(_0x256486,_0x3c4ae0){return git['fetch']([_0x9b4d('0x16'),'master'],function(_0x5d857b){if(_0x5d857b){logger[_0x9b4d('0x17')](_0x5d857b);return _0x3c4ae0[_0x9b4d('0x14')](0x1f4)[_0x9b4d('0x15')](_0x5d857b);}logger[_0x9b4d('0x18')](_0x9b4d('0x19'));return _0x3c4ae0[_0x9b4d('0x14')](0xc8)['json']({'output':'git\x20fetch\x20origin\x20master'});});};exports[_0x9b4d('0x1a')]=function(_0x2ef351,_0x15e808){return git[_0x9b4d('0x1a')]([_0x9b4d('0x1b'),_0x9b4d('0x1c')],function(_0x1c277d){if(_0x1c277d){logger[_0x9b4d('0x17')](_0x1c277d);return _0x15e808[_0x9b4d('0x14')](0x1f4)[_0x9b4d('0x15')](_0x1c277d);}logger[_0x9b4d('0x18')](_0x9b4d('0x1d'));return _0x15e808[_0x9b4d('0x14')](0xc8)[_0x9b4d('0x15')]({'output':_0x9b4d('0x1e')});});};exports[_0x9b4d('0x1f')]=function(_0x2c5d05,_0x2a9d1a){exec(_0x9b4d('0x20'),function(_0x35a282,_0x5ea613,_0x3a698f){logger[_0x9b4d('0x18')](_0x5ea613);logger[_0x9b4d('0x18')](_0x3a698f);if(_0x35a282){logger['error'](_0x35a282);return _0x2a9d1a[_0x9b4d('0x14')](0x1f4)['json'](_0x35a282);}return _0x2a9d1a['status'](0xc8)[_0x9b4d('0x15')]({'output':_0x5ea613});});};exports['restart']=function(_0x450972,_0x39c2bb){return pm2['restart'](_0x9b4d('0x21'))[_0x9b4d('0x22')](function(_0x3a2f5f){logger['info']('pm2\x20restart\x20motion\x20%s',_0x3a2f5f);return _0x39c2bb[_0x9b4d('0x14')](0xc8)[_0x9b4d('0x15')]({'output':'Your\x20system\x20has\x20been\x20restart\x20successfully'});})[_0x9b4d('0x23')](function(_0x5d639b){logger[_0x9b4d('0x17')](_0x5d639b);return _0x39c2bb['status'](0x1f4)[_0x9b4d('0x15')](_0x5d639b);});};exports['migrations']=function(_0x2fdd31,_0xf006aa){var _0x5e9d1b=fs[_0x9b4d('0x24')](path['join'](config['root'],_0x9b4d('0x25'),_0x9b4d('0x26')));var _0x4f9382=[];for(var _0x51459b=0x0;_0x51459b<_0x5e9d1b[_0x9b4d('0x27')];_0x51459b++){var _0x3b1954=_0x5e9d1b[_0x51459b][_0x9b4d('0x28')](_0x9b4d('0x29'),'');if(compareVersions(module[_0x9b4d('0xe')][_0x9b4d('0x3')],_0x3b1954)===-0x1){_0x4f9382[_0x9b4d('0x2a')](_0x3b1954);}}if(_0x4f9382[_0x9b4d('0x27')]){var _0x37fc10=_0x4f9382[_0x9b4d('0x2b')](compareVersions);var _0x27d10c=new Umzug({'storage':_0x9b4d('0x2c'),'storageOptions':{'model':db[_0x9b4d('0x2d')],'modelName':_0x9b4d('0x2d'),'columnName':_0x9b4d('0x3')},'migrations':{'params':[db['sequelize'][_0x9b4d('0x2e')](),db['sequelize'][_0x9b4d('0x2f')],function(){throw new Error(_0x9b4d('0x30'));}],'path':path[_0x9b4d('0x31')](config[_0x9b4d('0xc')],_0x9b4d('0x25'),_0x9b4d('0x26')),'pattern':/\.js$/}});_0x27d10c['up']({'migrations':_[_0x9b4d('0x32')](_0x37fc10,function(_0x50a3fb){return _0x50a3fb+_0x9b4d('0x29');})})[_0x9b4d('0x22')](function(){return _0xf006aa[_0x9b4d('0x14')](0xc8)['json']({'output':'Database\x20migrated\x20successfully\x20from\x20version\x20'+module[_0x9b4d('0xe')]['version']+'\x20to\x20'+_[_0x9b4d('0x33')](_0x37fc10),'migrations':_[_0x9b4d('0x31')](_0x37fc10)});})[_0x9b4d('0x23')](function(_0x40310f){if(_0x40310f instanceof db[_0x9b4d('0x2c')]['UniqueConstraintError']){return _0xf006aa[_0x9b4d('0x14')](0xc8)[_0x9b4d('0x15')]({'output':'Database\x20already\x20up-to-date'});}else{return _0xf006aa[_0x9b4d('0x14')](0x1f4)[_0x9b4d('0x15')](_0x40310f);}});}else{return _0xf006aa[_0x9b4d('0x14')](0xc8)[_0x9b4d('0x15')]({'output':_0x9b4d('0x34')});}}; \ No newline at end of file +var _0x1cbc=['catch','readdirSync','join','server','migrations','replace','.js','push','length','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','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','lodash','pkginfo','version','compare-versions','child_process','exec','../../mysqldb','../../config/environment','../../config/pm2','../../config/logger','update','simple-git','index','query','latest','fetch','tags','exports','2.0.0','status','json','origin','master','error','git\x20fetch','reset','--hard','FETCH_HEAD','info','git\x20reset\x20--hard\x20FETCH_HEAD','pull','restart','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully'];(function(_0x2eca2c,_0x386a06){var _0x5f5204=function(_0x257bfb){while(--_0x257bfb){_0x2eca2c['push'](_0x2eca2c['shift']());}};_0x5f5204(++_0x386a06);}(_0x1cbc,0xf4));var _0xc1cb=function(_0x3c25d7,_0x50ebd0){_0x3c25d7=_0x3c25d7-0x0;var _0xd8d3a6=_0x1cbc[_0x3c25d7];return _0xd8d3a6;};'use strict';var Umzug=require(_0xc1cb('0x0'));var path=require('path');var fs=require('fs');var _=require(_0xc1cb('0x1'));var pkginfo=require(_0xc1cb('0x2'))(module,_0xc1cb('0x3'));var compareVersions=require(_0xc1cb('0x4'));var exec=require(_0xc1cb('0x5'))[_0xc1cb('0x6')];var db=require(_0xc1cb('0x7'))['db'];var config=require(_0xc1cb('0x8'));var pm2=require(_0xc1cb('0x9'));var logger=require(_0xc1cb('0xa'))(_0xc1cb('0xb'));var git=require(_0xc1cb('0xc'))(config['root']);exports[_0xc1cb('0xd')]=function(_0x54cd03,_0xe5da07){var _0x271f7d={'current':module['exports'][_0xc1cb('0x3')],'phonebar':0x2};if(_0x54cd03[_0xc1cb('0xe')]&&_0x54cd03[_0xc1cb('0xe')][_0xc1cb('0xf')]){return git[_0xc1cb('0x10')]()[_0xc1cb('0x11')](function(_0xf14ba7,_0x195e20){_0x271f7d['latest']=(_0xf14ba7?module[_0xc1cb('0x12')]['version']:_0x195e20[_0xc1cb('0xf')])||_0xc1cb('0x13');return _0xe5da07[_0xc1cb('0x14')](0xc8)[_0xc1cb('0x15')](_0x271f7d);});}else{return _0xe5da07[_0xc1cb('0x14')](0xc8)[_0xc1cb('0x15')](_0x271f7d);}};exports[_0xc1cb('0x10')]=function(_0x4e6c2d,_0x2b1715){return git[_0xc1cb('0x10')]([_0xc1cb('0x16'),_0xc1cb('0x17')],function(_0x5c7a99){if(_0x5c7a99){logger[_0xc1cb('0x18')](_0x5c7a99);return _0x2b1715[_0xc1cb('0x14')](0x1f4)['json'](_0x5c7a99);}logger['info'](_0xc1cb('0x19'));return _0x2b1715[_0xc1cb('0x14')](0xc8)[_0xc1cb('0x15')]({'output':'git\x20fetch\x20origin\x20master'});});};exports['reset']=function(_0x4df1b9,_0x5d32ec){return git[_0xc1cb('0x1a')]([_0xc1cb('0x1b'),_0xc1cb('0x1c')],function(_0xe3c294){if(_0xe3c294){logger[_0xc1cb('0x18')](_0xe3c294);return _0x5d32ec[_0xc1cb('0x14')](0x1f4)['json'](_0xe3c294);}logger[_0xc1cb('0x1d')](_0xc1cb('0x1e'));return _0x5d32ec[_0xc1cb('0x14')](0xc8)[_0xc1cb('0x15')]({'output':'git\x20reset\x20--hard'});});};exports[_0xc1cb('0x1f')]=function(_0x2f44e8,_0x1666ce){exec('npm\x20install\x20--production',function(_0x4ddf55,_0x3b6ca5,_0x460332){logger['info'](_0x3b6ca5);logger['info'](_0x460332);if(_0x4ddf55){logger[_0xc1cb('0x18')](_0x4ddf55);return _0x1666ce[_0xc1cb('0x14')](0x1f4)[_0xc1cb('0x15')](_0x4ddf55);}return _0x1666ce[_0xc1cb('0x14')](0xc8)[_0xc1cb('0x15')]({'output':_0x3b6ca5});});};exports[_0xc1cb('0x20')]=function(_0xac87d,_0x532632){return pm2[_0xc1cb('0x20')]('motion2')[_0xc1cb('0x21')](function(_0x3f6481){logger[_0xc1cb('0x1d')](_0xc1cb('0x22'),_0x3f6481);return _0x532632[_0xc1cb('0x14')](0xc8)[_0xc1cb('0x15')]({'output':_0xc1cb('0x23')});})[_0xc1cb('0x24')](function(_0x18e9c4){logger[_0xc1cb('0x18')](_0x18e9c4);return _0x532632[_0xc1cb('0x14')](0x1f4)[_0xc1cb('0x15')](_0x18e9c4);});};exports['migrations']=function(_0x54f42d,_0x50ff6a){var _0xf68d03=fs[_0xc1cb('0x25')](path[_0xc1cb('0x26')](config['root'],_0xc1cb('0x27'),_0xc1cb('0x28')));var _0x2e6d7d=[];for(var _0x54c5db=0x0;_0x54c5db<_0xf68d03['length'];_0x54c5db++){var _0x3b85d6=_0xf68d03[_0x54c5db][_0xc1cb('0x29')](_0xc1cb('0x2a'),'');if(compareVersions(module[_0xc1cb('0x12')][_0xc1cb('0x3')],_0x3b85d6)===-0x1){_0x2e6d7d[_0xc1cb('0x2b')](_0x3b85d6);}}if(_0x2e6d7d[_0xc1cb('0x2c')]){var _0x31e450=_0x2e6d7d['sort'](compareVersions);var _0x546fab=new Umzug({'storage':_0xc1cb('0x2d'),'storageOptions':{'model':db['Migration'],'modelName':_0xc1cb('0x2e'),'columnName':'version'},'migrations':{'params':[db[_0xc1cb('0x2d')][_0xc1cb('0x2f')](),db[_0xc1cb('0x2d')][_0xc1cb('0x30')],function(){throw new Error(_0xc1cb('0x31'));}],'path':path[_0xc1cb('0x26')](config[_0xc1cb('0x32')],'server',_0xc1cb('0x28')),'pattern':/\.js$/}});_0x546fab['up']({'migrations':_['map'](_0x31e450,function(_0x5d7623){return _0x5d7623+'.js';})})[_0xc1cb('0x21')](function(){return _0x50ff6a[_0xc1cb('0x14')](0xc8)[_0xc1cb('0x15')]({'output':_0xc1cb('0x33')+module[_0xc1cb('0x12')][_0xc1cb('0x3')]+_0xc1cb('0x34')+_[_0xc1cb('0x35')](_0x31e450),'migrations':_[_0xc1cb('0x26')](_0x31e450)});})['catch'](function(_0x155c5){if(_0x155c5 instanceof db[_0xc1cb('0x2d')][_0xc1cb('0x36')]){return _0x50ff6a['status'](0xc8)['json']({'output':_0xc1cb('0x37')});}else{return _0x50ff6a[_0xc1cb('0x14')](0x1f4)[_0xc1cb('0x15')](_0x155c5);}});}else{return _0x50ff6a[_0xc1cb('0x14')](0xc8)[_0xc1cb('0x15')]({'output':'Database\x20already\x20up-to-date'});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index dd80fdd..f395078 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 _0x94a4=['describe','post','create','put','isAuthenticated','delete','destroy','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','index','get','/describe'];(function(_0x421d61,_0x44a00f){var _0x43e814=function(_0x284ddc){while(--_0x284ddc){_0x421d61['push'](_0x421d61['shift']());}};_0x43e814(++_0x44a00f);}(_0x94a4,0x1e2));var _0x494a=function(_0x39e283,_0x247e6b){_0x39e283=_0x39e283-0x0;var _0x7de89f=_0x94a4[_0x39e283];return _0x7de89f;};'use strict';var multer=require(_0x494a('0x0'));var util=require(_0x494a('0x1'));var path=require(_0x494a('0x2'));var timeout=require('connect-timeout');var express=require(_0x494a('0x3'));var router=express[_0x494a('0x4')]();var auth=require(_0x494a('0x5'));var interaction=require(_0x494a('0x6'));var config=require(_0x494a('0x7'));var controller=require(_0x494a('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x494a('0x9')]);router[_0x494a('0xa')](_0x494a('0xb'),auth['isAuthenticated'](),controller[_0x494a('0xc')]);router[_0x494a('0xa')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x494a('0xd')]('/',auth['isAuthenticated'](),controller[_0x494a('0xe')]);router[_0x494a('0xf')]('/:id',auth[_0x494a('0x10')](),controller['update']);router[_0x494a('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x494a('0x12')]);module['exports']=router; \ No newline at end of file +var _0x902e=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','show','post','create','put','/:id','update','delete','destroy','exports','multer','path','connect-timeout','express','Router'];(function(_0x37031f,_0x16a8e8){var _0x35192b=function(_0x2e8557){while(--_0x2e8557){_0x37031f['push'](_0x37031f['shift']());}};_0x35192b(++_0x16a8e8);}(_0x902e,0x171));var _0xe902=function(_0x26002a,_0x303235){_0x26002a=_0x26002a-0x0;var _0x4ba7c3=_0x902e[_0x26002a];return _0x4ba7c3;};'use strict';var multer=require(_0xe902('0x0'));var util=require('util');var path=require(_0xe902('0x1'));var timeout=require(_0xe902('0x2'));var express=require(_0xe902('0x3'));var router=express[_0xe902('0x4')]();var auth=require(_0xe902('0x5'));var interaction=require(_0xe902('0x6'));var config=require(_0xe902('0x7'));var controller=require('./voiceAgentReport.controller');router[_0xe902('0x8')]('/',auth[_0xe902('0x9')](),controller[_0xe902('0xa')]);router[_0xe902('0x8')](_0xe902('0xb'),auth[_0xe902('0x9')](),controller[_0xe902('0xc')]);router[_0xe902('0x8')]('/:id',auth[_0xe902('0x9')](),controller[_0xe902('0xd')]);router[_0xe902('0xe')]('/',auth[_0xe902('0x9')](),controller[_0xe902('0xf')]);router[_0xe902('0x10')](_0xe902('0x11'),auth['isAuthenticated'](),controller[_0xe902('0x12')]);router[_0xe902('0x13')](_0xe902('0x11'),auth[_0xe902('0x9')](),controller[_0xe902('0x14')]);module[_0xe902('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index 7804a01..a253c6c 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 _0x5075=['INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports','STRING','DATE'];(function(_0x273c66,_0x346773){var _0x4a574e=function(_0x460d09){while(--_0x460d09){_0x273c66['push'](_0x273c66['shift']());}};_0x4a574e(++_0x346773);}(_0x5075,0x73));var _0x5507=function(_0x470f63,_0x48d80b){_0x470f63=_0x470f63-0x0;var _0x4f09e2=_0x5075[_0x470f63];return _0x4f09e2;};'use strict';var Sequelize=require(_0x5507('0x0'));module[_0x5507('0x1')]={'type':{'type':Sequelize[_0x5507('0x2')]},'uniqueid':{'type':Sequelize[_0x5507('0x2')]},'calleridnum':{'type':Sequelize[_0x5507('0x2')]},'calleridname':{'type':Sequelize[_0x5507('0x2')]},'queue':{'type':Sequelize[_0x5507('0x2')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x5507('0x2')]},'agentcalledAt':{'type':Sequelize[_0x5507('0x3')]},'agentconnectAt':{'type':Sequelize[_0x5507('0x3')]},'agentcompleteAt':{'type':Sequelize['DATE']},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdumpAt':{'type':Sequelize[_0x5507('0x3')]},'holdtime':{'type':Sequelize[_0x5507('0x4')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x5507('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x5507('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x5507('0x4')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0x5507('0x2')]},'lastevent':{'type':Sequelize[_0x5507('0x2')]},'channel':{'type':Sequelize[_0x5507('0x2')]},'channelstate':{'type':Sequelize[_0x5507('0x4')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x5507('0x2')]},'connectedlinename':{'type':Sequelize[_0x5507('0x2')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x5507('0x2')]},'context':{'type':Sequelize[_0x5507('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x5507('0x2')]},'destchannel':{'type':Sequelize[_0x5507('0x2')]},'destchannelstate':{'type':Sequelize[_0x5507('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0x5507('0x2')]},'destcalleridnum':{'type':Sequelize[_0x5507('0x2')]},'destcalleridname':{'type':Sequelize[_0x5507('0x2')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0x5507('0x2')]},'destlanguage':{'type':Sequelize[_0x5507('0x2')]},'destaccountcode':{'type':Sequelize[_0x5507('0x2')]},'destcontext':{'type':Sequelize[_0x5507('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x5507('0x2')]},'destuniqueid':{'type':Sequelize[_0x5507('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x5507('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0x5507('0x2')]},'transfer':{'type':Sequelize[_0x5507('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x5507('0x2')],'comment':_0x5507('0x6')},'transferexten':{'type':Sequelize[_0x5507('0x2')]},'transferuniqueid':{'type':Sequelize[_0x5507('0x2')]},'agententerreason':{'type':Sequelize[_0x5507('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x9957=['DATE','INTEGER','BOOLEAN','sequelize','exports','STRING'];(function(_0x59995a,_0x2d1378){var _0x48be6a=function(_0x17b979){while(--_0x17b979){_0x59995a['push'](_0x59995a['shift']());}};_0x48be6a(++_0x2d1378);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'type':{'type':Sequelize[_0x7995('0x2')]},'uniqueid':{'type':Sequelize[_0x7995('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x7995('0x2')]},'queue':{'type':Sequelize[_0x7995('0x2')]},'interface':{'type':Sequelize[_0x7995('0x2')]},'membername':{'type':Sequelize[_0x7995('0x2')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0x7995('0x3')]},'agentcompleteAt':{'type':Sequelize[_0x7995('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0x7995('0x3')]},'agentdumpAt':{'type':Sequelize[_0x7995('0x3')]},'holdtime':{'type':Sequelize[_0x7995('0x4')]},'agentcomplete':{'type':Sequelize[_0x7995('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x7995('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x7995('0x4')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x7995('0x4')]},'reason':{'type':Sequelize[_0x7995('0x2')]},'lastevent':{'type':Sequelize[_0x7995('0x2')]},'channel':{'type':Sequelize[_0x7995('0x2')]},'channelstate':{'type':Sequelize[_0x7995('0x4')]},'channelstatedesc':{'type':Sequelize[_0x7995('0x2')]},'connectedlinenum':{'type':Sequelize[_0x7995('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x7995('0x2')]},'accountcode':{'type':Sequelize[_0x7995('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x7995('0x2')]},'priority':{'type':Sequelize[_0x7995('0x2')]},'destchannel':{'type':Sequelize[_0x7995('0x2')]},'destchannelstate':{'type':Sequelize[_0x7995('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0x7995('0x2')]},'destcalleridnum':{'type':Sequelize[_0x7995('0x2')]},'destcalleridname':{'type':Sequelize[_0x7995('0x2')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x7995('0x2')]},'destaccountcode':{'type':Sequelize[_0x7995('0x2')]},'destcontext':{'type':Sequelize[_0x7995('0x2')]},'destexten':{'type':Sequelize[_0x7995('0x2')]},'destpriority':{'type':Sequelize[_0x7995('0x2')]},'destuniqueid':{'type':Sequelize[_0x7995('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x7995('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0x7995('0x2')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x7995('0x2')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0x7995('0x2')]},'transferuniqueid':{'type':Sequelize[_0x7995('0x2')]},'agententerreason':{'type':Sequelize[_0x7995('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 564ec8d..738e233 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 _0x2f8c=['update','then','destroy','end','error','stack','name','send','map','VoiceAgentReport','rawAttributes','type','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','findAll','catch','show','options','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','count','offset','limit','set','Content-Range','apply','reject'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x2f8c,0x1e3));var _0xc2f8=function(_0x41ac26,_0x172b68){_0x41ac26=_0x41ac26-0x0;var _0x18a037=_0x2f8c[_0x41ac26];return _0x18a037;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xc2f8('0x0'));var rimraf=require(_0xc2f8('0x1'));var zipdir=require(_0xc2f8('0x2'));var jsonpatch=require(_0xc2f8('0x3'));var rp=require(_0xc2f8('0x4'));var moment=require(_0xc2f8('0x5'));var BPromise=require(_0xc2f8('0x6'));var Mustache=require(_0xc2f8('0x7'));var util=require(_0xc2f8('0x8'));var path=require('path');var sox=require(_0xc2f8('0x9'));var csv=require(_0xc2f8('0xa'));var ejs=require(_0xc2f8('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xc2f8('0xc'));var crypto=require(_0xc2f8('0xd'));var jsforce=require(_0xc2f8('0xe'));var deskjs=require(_0xc2f8('0xf'));var toCsv=require(_0xc2f8('0xa'));var querystring=require(_0xc2f8('0x10'));var Papa=require('papaparse');var Redis=require(_0xc2f8('0x11'));var authService=require(_0xc2f8('0x12'));var qs=require(_0xc2f8('0x13'));var as=require(_0xc2f8('0x14'));var hardwareService=require(_0xc2f8('0x15'));var logger=require('../../config/logger')(_0xc2f8('0x16'));var utils=require(_0xc2f8('0x17'));var config=require(_0xc2f8('0x18'));var db=require(_0xc2f8('0x19'))['db'];function respondWithStatusCode(_0x5e07bd,_0x4c55e4){_0x4c55e4=_0x4c55e4||0xcc;return function(_0x4faf03){if(_0x4faf03){return _0x5e07bd[_0xc2f8('0x1a')](_0x4c55e4);}return _0x5e07bd[_0xc2f8('0x1b')](_0x4c55e4)['end']();};}function respondWithResult(_0x5a68eb,_0xa99b0c){_0xa99b0c=_0xa99b0c||0xc8;return function(_0x45255b){if(_0x45255b){return _0x5a68eb[_0xc2f8('0x1b')](_0xa99b0c)['json'](_0x45255b);}};}function respondWithFilteredResult(_0x102cbe,_0x1af66f){return function(_0x3e6ea5){if(_0x3e6ea5){var _0x336e82=_0x3e6ea5[_0xc2f8('0x1c')],_0x290395=_0x1af66f[_0xc2f8('0x1d')],_0x3eac1d=_0x1af66f[_0xc2f8('0x1d')]+_0x1af66f[_0xc2f8('0x1e')],_0x4c51fa;if(_0x3eac1d>=_0x336e82){_0x3eac1d=_0x336e82;_0x4c51fa=0xc8;}else{_0x4c51fa=0xce;}_0x102cbe[_0xc2f8('0x1b')](_0x4c51fa);return _0x102cbe[_0xc2f8('0x1f')](_0xc2f8('0x20'),_0x290395+'-'+_0x3eac1d+'/'+_0x336e82)['json'](_0x3e6ea5);}return null;};}function patchUpdates(_0x10d0dc){return function(_0x4fca7e){try{jsonpatch[_0xc2f8('0x21')](_0x4fca7e,_0x10d0dc,!![]);}catch(_0x16db24){return BPromise[_0xc2f8('0x22')](_0x16db24);}return _0x4fca7e['save']();};}function saveUpdates(_0x2c1762,_0x274bae){return function(_0x152ce1){if(_0x152ce1){return _0x152ce1[_0xc2f8('0x23')](_0x2c1762)[_0xc2f8('0x24')](function(_0xef042b){return _0xef042b;});}return null;};}function removeEntity(_0x2c4044,_0x1884db){return function(_0x3f54e0){if(_0x3f54e0){return _0x3f54e0[_0xc2f8('0x25')]()[_0xc2f8('0x24')](function(){_0x2c4044[_0xc2f8('0x1b')](0xcc)[_0xc2f8('0x26')]();});}};}function handleEntityNotFound(_0x304aa4,_0x24c941){return function(_0x3be3aa){if(!_0x3be3aa){_0x304aa4[_0xc2f8('0x1a')](0x194);}return _0x3be3aa;};}function handleError(_0x1a56ff,_0x286cbb){_0x286cbb=_0x286cbb||0x1f4;return function(_0x2687ae){logger[_0xc2f8('0x27')](_0x2687ae[_0xc2f8('0x28')]);if(_0x2687ae[_0xc2f8('0x29')]){delete _0x2687ae[_0xc2f8('0x29')];}_0x1a56ff[_0xc2f8('0x1b')](_0x286cbb)[_0xc2f8('0x2a')](_0x2687ae);};}exports['index']=function(_0x550790,_0x2377fd){var _0x5f0fa9={},_0x5212a6={},_0x581662={'count':0x0,'rows':[]};var _0x6e10f1=_[_0xc2f8('0x2b')](db[_0xc2f8('0x2c')][_0xc2f8('0x2d')],function(_0x149c99){return{'name':_0x149c99['fieldName'],'type':_0x149c99[_0xc2f8('0x2e')]['key']};});_0x5212a6['model']=_[_0xc2f8('0x2b')](_0x6e10f1,_0xc2f8('0x29'));_0x5212a6[_0xc2f8('0x2f')]=_[_0xc2f8('0x30')](_0x550790[_0xc2f8('0x2f')]);_0x5212a6[_0xc2f8('0x31')]=_[_0xc2f8('0x32')](_0x5212a6[_0xc2f8('0x33')],_0x5212a6[_0xc2f8('0x2f')]);_0x5f0fa9['attributes']=_[_0xc2f8('0x32')](_0x5212a6[_0xc2f8('0x33')],qs[_0xc2f8('0x34')](_0x550790[_0xc2f8('0x2f')][_0xc2f8('0x34')]));_0x5f0fa9[_0xc2f8('0x35')]=_0x5f0fa9[_0xc2f8('0x35')][_0xc2f8('0x36')]?_0x5f0fa9[_0xc2f8('0x35')]:_0x5212a6[_0xc2f8('0x33')];if(!_0x550790['query'][_0xc2f8('0x37')](_0xc2f8('0x38'))){_0x5f0fa9['limit']=qs['limit'](_0x550790[_0xc2f8('0x2f')]['limit']);_0x5f0fa9[_0xc2f8('0x1d')]=qs[_0xc2f8('0x1d')](_0x550790['query'][_0xc2f8('0x1d')]);}_0x5f0fa9['order']=qs[_0xc2f8('0x39')](_0x550790[_0xc2f8('0x2f')][_0xc2f8('0x39')]);_0x5f0fa9[_0xc2f8('0x3a')]=qs[_0xc2f8('0x31')](_[_0xc2f8('0x3b')](_0x550790[_0xc2f8('0x2f')],_0x5212a6[_0xc2f8('0x31')]));if(_0x550790[_0xc2f8('0x2f')]['filter']){_0x5f0fa9[_0xc2f8('0x3a')]=_[_0xc2f8('0x3c')](_0x5f0fa9[_0xc2f8('0x3a')],{'$or':_[_0xc2f8('0x2b')](_0x6e10f1,function(_0x2258d5){if(_0x2258d5[_0xc2f8('0x2e')]!==_0xc2f8('0x3d')){var _0x15ce40={};_0x15ce40[_0x2258d5[_0xc2f8('0x29')]]={'$like':'%'+_0x550790[_0xc2f8('0x2f')][_0xc2f8('0x3e')]+'%'};return _0x15ce40;}})});}_0x5f0fa9=_[_0xc2f8('0x3c')]({},_0x5f0fa9,_0x550790['options']);var _0x19e52f={'where':_0x5f0fa9['where']};return db[_0xc2f8('0x2c')][_0xc2f8('0x1c')](_0x19e52f)[_0xc2f8('0x24')](function(_0x4f6f66){_0x581662[_0xc2f8('0x1c')]=_0x4f6f66;if(_0x550790[_0xc2f8('0x2f')][_0xc2f8('0x3f')]){_0x5f0fa9[_0xc2f8('0x40')]=[{'all':!![]}];}return db[_0xc2f8('0x2c')][_0xc2f8('0x41')](_0x5f0fa9);})[_0xc2f8('0x24')](function(_0x297974){_0x581662['rows']=_0x297974;return _0x581662;})['then'](respondWithFilteredResult(_0x2377fd,_0x5f0fa9))[_0xc2f8('0x42')](handleError(_0x2377fd,null));};exports[_0xc2f8('0x43')]=function(_0x39e78c,_0x4772c4){var _0x396ed3={'raw':![],'where':{'id':_0x39e78c['params']['id']}},_0x1327cd={};_0x1327cd[_0xc2f8('0x33')]=_['keys'](db[_0xc2f8('0x2c')][_0xc2f8('0x2d')]);_0x1327cd[_0xc2f8('0x2f')]=_['keys'](_0x39e78c[_0xc2f8('0x2f')]);_0x1327cd[_0xc2f8('0x31')]=_[_0xc2f8('0x32')](_0x1327cd[_0xc2f8('0x33')],_0x1327cd[_0xc2f8('0x2f')]);_0x396ed3['attributes']=_[_0xc2f8('0x32')](_0x1327cd['model'],qs[_0xc2f8('0x34')](_0x39e78c['query']['fields']));_0x396ed3['attributes']=_0x396ed3[_0xc2f8('0x35')]['length']?_0x396ed3[_0xc2f8('0x35')]:_0x1327cd[_0xc2f8('0x33')];if(_0x39e78c[_0xc2f8('0x2f')][_0xc2f8('0x3f')]){_0x396ed3[_0xc2f8('0x40')]=[{'all':!![]}];}_0x396ed3=_[_0xc2f8('0x3c')]({},_0x396ed3,_0x39e78c[_0xc2f8('0x44')]);return db[_0xc2f8('0x2c')][_0xc2f8('0x45')](_0x396ed3)[_0xc2f8('0x24')](handleEntityNotFound(_0x4772c4,null))[_0xc2f8('0x24')](respondWithResult(_0x4772c4,null))['catch'](handleError(_0x4772c4,null));};exports['create']=function(_0xa07dd,_0x73cd61){return db['VoiceAgentReport'][_0xc2f8('0x46')](_0xa07dd[_0xc2f8('0x47')],{})[_0xc2f8('0x24')](respondWithResult(_0x73cd61,0xc9))['catch'](handleError(_0x73cd61,null));};exports[_0xc2f8('0x23')]=function(_0x1c1813,_0x5bce7f){if(_0x1c1813[_0xc2f8('0x47')]['id']){delete _0x1c1813[_0xc2f8('0x47')]['id'];}return db[_0xc2f8('0x2c')][_0xc2f8('0x45')]({'where':{'id':_0x1c1813[_0xc2f8('0x48')]['id']}})[_0xc2f8('0x24')](handleEntityNotFound(_0x5bce7f,null))[_0xc2f8('0x24')](saveUpdates(_0x1c1813[_0xc2f8('0x47')],null))['then'](respondWithResult(_0x5bce7f,null))[_0xc2f8('0x42')](handleError(_0x5bce7f,null));};exports[_0xc2f8('0x25')]=function(_0x101f40,_0x4ef639){return db[_0xc2f8('0x2c')][_0xc2f8('0x45')]({'where':{'id':_0x101f40[_0xc2f8('0x48')]['id']}})[_0xc2f8('0x24')](handleEntityNotFound(_0x4ef639,null))[_0xc2f8('0x24')](removeEntity(_0x4ef639,null))[_0xc2f8('0x42')](handleError(_0x4ef639,null));};exports[_0xc2f8('0x49')]=function(_0x115a31,_0x1d9148){return db[_0xc2f8('0x2c')]['describe']()[_0xc2f8('0x24')](respondWithResult(_0x1d9148,null))[_0xc2f8('0x42')](handleError(_0x1d9148,null));}; \ No newline at end of file +var _0x9ee6=['update','then','end','error','stack','name','index','map','VoiceAgentReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','count','include','rows','catch','show','params','find','create','body','destroy','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','offset','limit','set','apply','reject','save'];(function(_0x549711,_0x5bb5de){var _0x408d84=function(_0x5c567d){while(--_0x5c567d){_0x549711['push'](_0x549711['shift']());}};_0x408d84(++_0x5bb5de);}(_0x9ee6,0x1df));var _0x69ee=function(_0x3d4876,_0x366386){_0x3d4876=_0x3d4876-0x0;var _0x58ca9d=_0x9ee6[_0x3d4876];return _0x58ca9d;};'use strict';var pdf=require(_0x69ee('0x0'));var emlformat=require(_0x69ee('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x69ee('0x2'));var jsonpatch=require(_0x69ee('0x3'));var rp=require(_0x69ee('0x4'));var moment=require(_0x69ee('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x69ee('0x6'));var util=require('util');var path=require('path');var sox=require(_0x69ee('0x7'));var csv=require(_0x69ee('0x8'));var ejs=require(_0x69ee('0x9'));var fs=require('fs');var _=require(_0x69ee('0xa'));var squel=require(_0x69ee('0xb'));var crypto=require('crypto');var jsforce=require(_0x69ee('0xc'));var deskjs=require(_0x69ee('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x69ee('0xe'));var Redis=require(_0x69ee('0xf'));var authService=require(_0x69ee('0x10'));var qs=require(_0x69ee('0x11'));var as=require(_0x69ee('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x69ee('0x13'))(_0x69ee('0x14'));var utils=require(_0x69ee('0x15'));var config=require('../../config/environment');var db=require(_0x69ee('0x16'))['db'];function respondWithStatusCode(_0x5a3b94,_0x11584c){_0x11584c=_0x11584c||0xcc;return function(_0x4be107){if(_0x4be107){return _0x5a3b94[_0x69ee('0x17')](_0x11584c);}return _0x5a3b94[_0x69ee('0x18')](_0x11584c)['end']();};}function respondWithResult(_0x202308,_0x544dc0){_0x544dc0=_0x544dc0||0xc8;return function(_0x5889f5){if(_0x5889f5){return _0x202308[_0x69ee('0x18')](_0x544dc0)[_0x69ee('0x19')](_0x5889f5);}};}function respondWithFilteredResult(_0x447023,_0x301436){return function(_0x222ca8){if(_0x222ca8){var _0x257d1c=_0x222ca8['count'],_0x1d3fca=_0x301436[_0x69ee('0x1a')],_0x571f98=_0x301436[_0x69ee('0x1a')]+_0x301436[_0x69ee('0x1b')],_0x214933;if(_0x571f98>=_0x257d1c){_0x571f98=_0x257d1c;_0x214933=0xc8;}else{_0x214933=0xce;}_0x447023[_0x69ee('0x18')](_0x214933);return _0x447023[_0x69ee('0x1c')]('Content-Range',_0x1d3fca+'-'+_0x571f98+'/'+_0x257d1c)[_0x69ee('0x19')](_0x222ca8);}return null;};}function patchUpdates(_0x2499eb){return function(_0x2c5d63){try{jsonpatch[_0x69ee('0x1d')](_0x2c5d63,_0x2499eb,!![]);}catch(_0x478a19){return BPromise[_0x69ee('0x1e')](_0x478a19);}return _0x2c5d63[_0x69ee('0x1f')]();};}function saveUpdates(_0x5c9422,_0x22342f){return function(_0x4285f7){if(_0x4285f7){return _0x4285f7[_0x69ee('0x20')](_0x5c9422)[_0x69ee('0x21')](function(_0x43747d){return _0x43747d;});}return null;};}function removeEntity(_0x824bc3,_0x114505){return function(_0x264d51){if(_0x264d51){return _0x264d51['destroy']()[_0x69ee('0x21')](function(){_0x824bc3[_0x69ee('0x18')](0xcc)[_0x69ee('0x22')]();});}};}function handleEntityNotFound(_0x58e8b3,_0x294daa){return function(_0x26d16b){if(!_0x26d16b){_0x58e8b3['sendStatus'](0x194);}return _0x26d16b;};}function handleError(_0x286209,_0x286470){_0x286470=_0x286470||0x1f4;return function(_0x244f00){logger[_0x69ee('0x23')](_0x244f00[_0x69ee('0x24')]);if(_0x244f00[_0x69ee('0x25')]){delete _0x244f00[_0x69ee('0x25')];}_0x286209[_0x69ee('0x18')](_0x286470)['send'](_0x244f00);};}exports[_0x69ee('0x26')]=function(_0x50c564,_0x4c83a1){var _0x14f36d={},_0x307295={},_0xf45f00={'count':0x0,'rows':[]};var _0x2e6f1b=_[_0x69ee('0x27')](db[_0x69ee('0x28')][_0x69ee('0x29')],function(_0x61e67d){return{'name':_0x61e67d[_0x69ee('0x2a')],'type':_0x61e67d[_0x69ee('0x2b')][_0x69ee('0x2c')]};});_0x307295[_0x69ee('0x2d')]=_[_0x69ee('0x27')](_0x2e6f1b,_0x69ee('0x25'));_0x307295[_0x69ee('0x2e')]=_[_0x69ee('0x2f')](_0x50c564[_0x69ee('0x2e')]);_0x307295['filters']=_[_0x69ee('0x30')](_0x307295[_0x69ee('0x2d')],_0x307295['query']);_0x14f36d['attributes']=_[_0x69ee('0x30')](_0x307295['model'],qs[_0x69ee('0x31')](_0x50c564['query'][_0x69ee('0x31')]));_0x14f36d[_0x69ee('0x32')]=_0x14f36d[_0x69ee('0x32')][_0x69ee('0x33')]?_0x14f36d[_0x69ee('0x32')]:_0x307295[_0x69ee('0x2d')];if(!_0x50c564[_0x69ee('0x2e')]['hasOwnProperty'](_0x69ee('0x34'))){_0x14f36d['limit']=qs[_0x69ee('0x1b')](_0x50c564['query']['limit']);_0x14f36d[_0x69ee('0x1a')]=qs[_0x69ee('0x1a')](_0x50c564[_0x69ee('0x2e')][_0x69ee('0x1a')]);}_0x14f36d[_0x69ee('0x35')]=qs['sort'](_0x50c564[_0x69ee('0x2e')][_0x69ee('0x36')]);_0x14f36d['where']=qs[_0x69ee('0x37')](_[_0x69ee('0x38')](_0x50c564[_0x69ee('0x2e')],_0x307295[_0x69ee('0x37')]));if(_0x50c564[_0x69ee('0x2e')][_0x69ee('0x39')]){_0x14f36d[_0x69ee('0x3a')]=_[_0x69ee('0x3b')](_0x14f36d[_0x69ee('0x3a')],{'$or':_[_0x69ee('0x27')](_0x2e6f1b,function(_0x5456b3){if(_0x5456b3[_0x69ee('0x2b')]!==_0x69ee('0x3c')){var _0x9f8bcc={};_0x9f8bcc[_0x5456b3[_0x69ee('0x25')]]={'$like':'%'+_0x50c564['query'][_0x69ee('0x39')]+'%'};return _0x9f8bcc;}})});}_0x14f36d=_[_0x69ee('0x3b')]({},_0x14f36d,_0x50c564[_0x69ee('0x3d')]);var _0x39d5f0={'where':_0x14f36d['where']};return db[_0x69ee('0x28')][_0x69ee('0x3e')](_0x39d5f0)['then'](function(_0x5c67fa){_0xf45f00['count']=_0x5c67fa;if(_0x50c564[_0x69ee('0x2e')]['includeAll']){_0x14f36d[_0x69ee('0x3f')]=[{'all':!![]}];}return db[_0x69ee('0x28')]['findAll'](_0x14f36d);})[_0x69ee('0x21')](function(_0x27a3f0){_0xf45f00[_0x69ee('0x40')]=_0x27a3f0;return _0xf45f00;})['then'](respondWithFilteredResult(_0x4c83a1,_0x14f36d))[_0x69ee('0x41')](handleError(_0x4c83a1,null));};exports[_0x69ee('0x42')]=function(_0x5699d5,_0x10f268){var _0x90bc09={'raw':![],'where':{'id':_0x5699d5[_0x69ee('0x43')]['id']}},_0x292b36={};_0x292b36[_0x69ee('0x2d')]=_[_0x69ee('0x2f')](db[_0x69ee('0x28')][_0x69ee('0x29')]);_0x292b36['query']=_[_0x69ee('0x2f')](_0x5699d5[_0x69ee('0x2e')]);_0x292b36['filters']=_[_0x69ee('0x30')](_0x292b36[_0x69ee('0x2d')],_0x292b36[_0x69ee('0x2e')]);_0x90bc09[_0x69ee('0x32')]=_[_0x69ee('0x30')](_0x292b36['model'],qs[_0x69ee('0x31')](_0x5699d5['query'][_0x69ee('0x31')]));_0x90bc09[_0x69ee('0x32')]=_0x90bc09['attributes'][_0x69ee('0x33')]?_0x90bc09[_0x69ee('0x32')]:_0x292b36[_0x69ee('0x2d')];if(_0x5699d5[_0x69ee('0x2e')]['includeAll']){_0x90bc09[_0x69ee('0x3f')]=[{'all':!![]}];}_0x90bc09=_[_0x69ee('0x3b')]({},_0x90bc09,_0x5699d5[_0x69ee('0x3d')]);return db[_0x69ee('0x28')][_0x69ee('0x44')](_0x90bc09)[_0x69ee('0x21')](handleEntityNotFound(_0x10f268,null))['then'](respondWithResult(_0x10f268,null))[_0x69ee('0x41')](handleError(_0x10f268,null));};exports[_0x69ee('0x45')]=function(_0x18acf8,_0x48aab9){return db[_0x69ee('0x28')][_0x69ee('0x45')](_0x18acf8[_0x69ee('0x46')],{})[_0x69ee('0x21')](respondWithResult(_0x48aab9,0xc9))[_0x69ee('0x41')](handleError(_0x48aab9,null));};exports[_0x69ee('0x20')]=function(_0x33ffe9,_0x33158e){if(_0x33ffe9[_0x69ee('0x46')]['id']){delete _0x33ffe9['body']['id'];}return db[_0x69ee('0x28')][_0x69ee('0x44')]({'where':{'id':_0x33ffe9[_0x69ee('0x43')]['id']}})[_0x69ee('0x21')](handleEntityNotFound(_0x33158e,null))[_0x69ee('0x21')](saveUpdates(_0x33ffe9[_0x69ee('0x46')],null))[_0x69ee('0x21')](respondWithResult(_0x33158e,null))[_0x69ee('0x41')](handleError(_0x33158e,null));};exports[_0x69ee('0x47')]=function(_0x2d272d,_0x498cf3){return db[_0x69ee('0x28')]['find']({'where':{'id':_0x2d272d['params']['id']}})['then'](handleEntityNotFound(_0x498cf3,null))['then'](removeEntity(_0x498cf3,null))[_0x69ee('0x41')](handleError(_0x498cf3,null));};exports['describe']=function(_0xd59efb,_0x1dee9c){return db[_0x69ee('0x28')][_0x69ee('0x48')]()['then'](respondWithResult(_0x1dee9c,null))['catch'](handleError(_0x1dee9c,null));}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.model.js b/server/api/voiceAgentReport/voiceAgentReport.model.js index f3c31a3..325ffce 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 _0x51b2=['./voiceAgentReport.attributes','exports','define','VoiceAgentReport','report_agent','destuniqueid','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x447ab3,_0x4fbd8d){var _0x51ce19=function(_0x359516){while(--_0x359516){_0x447ab3['push'](_0x447ab3['shift']());}};_0x51ce19(++_0x4fbd8d);}(_0x51b2,0x150));var _0x251b=function(_0x4cebcc,_0x56253e){_0x4cebcc=_0x4cebcc-0x0;var _0x4d1669=_0x51b2[_0x4cebcc];return _0x4d1669;};'use strict';var _=require('lodash');var util=require(_0x251b('0x0'));var logger=require(_0x251b('0x1'))(_0x251b('0x2'));var moment=require(_0x251b('0x3'));var BPromise=require(_0x251b('0x4'));var rp=require(_0x251b('0x5'));var fs=require('fs');var path=require(_0x251b('0x6'));var rimraf=require(_0x251b('0x7'));var config=require(_0x251b('0x8'));var attributes=require(_0x251b('0x9'));module[_0x251b('0xa')]=function(_0x222cb8,_0x324845){return _0x222cb8[_0x251b('0xb')](_0x251b('0xc'),attributes,{'tableName':_0x251b('0xd'),'paranoid':![],'indexes':[{'fields':['uniqueid',_0x251b('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x79c0=['api','moment','bluebird','request-promise','rimraf','./voiceAgentReport.attributes','exports','VoiceAgentReport','report_agent','uniqueid','lodash','../../config/logger'];(function(_0x3e4e04,_0x4d9b4f){var _0x372701=function(_0x1a269c){while(--_0x1a269c){_0x3e4e04['push'](_0x3e4e04['shift']());}};_0x372701(++_0x4d9b4f);}(_0x79c0,0x82));var _0x079c=function(_0xcaf0c8,_0x3b1a58){_0xcaf0c8=_0xcaf0c8-0x0;var _0x4d0fd5=_0x79c0[_0xcaf0c8];return _0x4d0fd5;};'use strict';var _=require(_0x079c('0x0'));var util=require('util');var logger=require(_0x079c('0x1'))(_0x079c('0x2'));var moment=require(_0x079c('0x3'));var BPromise=require(_0x079c('0x4'));var rp=require(_0x079c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x079c('0x6'));var config=require('../../config/environment');var attributes=require(_0x079c('0x7'));module[_0x079c('0x8')]=function(_0x38b6e8,_0x1ac6e8){return _0x38b6e8['define'](_0x079c('0x9'),attributes,{'tableName':_0x079c('0xa'),'paranoid':![],'indexes':[{'fields':[_0x079c('0xb'),'destuniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index 211a366..1672fb2 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 _0x8044=['limit','UpdateVoiceAgentReport','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','CreateVoiceAgentReport','create','body','options','raw','VoiceAgentReport','update','where','attributes'];(function(_0x3d93df,_0xe52f8d){var _0x5d09b8=function(_0x3bf1c0){while(--_0x3bf1c0){_0x3d93df['push'](_0x3d93df['shift']());}};_0x5d09b8(++_0xe52f8d);}(_0x8044,0x12b));var _0x4804=function(_0x39e84d,_0x11931d){_0x39e84d=_0x39e84d-0x0;var _0x1991bc=_0x8044[_0x39e84d];return _0x1991bc;};'use strict';var _=require('lodash');var util=require(_0x4804('0x0'));var moment=require('moment');var BPromise=require(_0x4804('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4804('0x2'));var db=require(_0x4804('0x3'))['db'];var utils=require(_0x4804('0x4'));var logger=require('../../config/logger')(_0x4804('0x5'));var config=require(_0x4804('0x6'));var jayson=require(_0x4804('0x7'));var client=jayson[_0x4804('0x8')][_0x4804('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x125691,_0x46d0ec,_0x2c724d){return new BPromise(function(_0x2a6b25,_0xb0337b){return client[_0x4804('0xa')](_0x125691,_0x2c724d)[_0x4804('0xb')](function(_0x2f777e){logger[_0x4804('0xc')](_0x4804('0xd'),_0x46d0ec,_0x4804('0xe'));logger[_0x4804('0xf')]('VoiceAgentReport,\x20%s,\x20%s,\x20%s',_0x46d0ec,_0x4804('0xe'),JSON[_0x4804('0x10')](_0x2f777e));if(_0x2f777e['error']){if(_0x2f777e[_0x4804('0x11')][_0x4804('0x12')]===0x1f4){logger[_0x4804('0x11')](_0x4804('0xd'),_0x46d0ec,_0x2f777e['error']['message']);return _0xb0337b(_0x2f777e[_0x4804('0x11')][_0x4804('0x13')]);}logger[_0x4804('0x11')](_0x4804('0xd'),_0x46d0ec,_0x2f777e[_0x4804('0x11')][_0x4804('0x13')]);return _0x2a6b25(_0x2f777e[_0x4804('0x11')][_0x4804('0x13')]);}else{logger[_0x4804('0xc')](_0x4804('0xd'),_0x46d0ec,_0x4804('0xe'));_0x2a6b25(_0x2f777e[_0x4804('0x14')][_0x4804('0x13')]);}})[_0x4804('0x15')](function(_0x26da1d){logger[_0x4804('0x11')](_0x4804('0xd'),_0x46d0ec,_0x26da1d);_0xb0337b(_0x26da1d);});});}exports[_0x4804('0x16')]=function(_0x11a892){var _0x1b4695=this;return new Promise(function(_0x45c932,_0x68eb98){return db['VoiceAgentReport'][_0x4804('0x17')](_0x11a892[_0x4804('0x18')],{'raw':_0x11a892[_0x4804('0x19')]?_0x11a892[_0x4804('0x19')][_0x4804('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x43ffa7){logger[_0x4804('0xc')]('CreateVoiceAgentReport',_0x11a892);logger['debug'](_0x4804('0x16'),_0x11a892,JSON[_0x4804('0x10')](_0x43ffa7));_0x45c932(_0x43ffa7);})[_0x4804('0x15')](function(_0x2bf4c0){logger[_0x4804('0x11')]('CreateVoiceAgentReport',_0x2bf4c0[_0x4804('0x13')],_0x11a892);_0x68eb98(_0x1b4695[_0x4804('0x11')](0x1f4,_0x2bf4c0[_0x4804('0x13')]));});});};exports['UpdateVoiceAgentReport']=function(_0x3c8a99){var _0x5c117d=this;return new Promise(function(_0x449e61,_0xdee80e){return db[_0x4804('0x1b')][_0x4804('0x1c')](_0x3c8a99['body'],{'raw':_0x3c8a99['options']?_0x3c8a99[_0x4804('0x19')][_0x4804('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3c8a99['options']?_0x3c8a99['options'][_0x4804('0x1d')]||null:null,'attributes':_0x3c8a99[_0x4804('0x19')]?_0x3c8a99[_0x4804('0x19')][_0x4804('0x1e')]||null:null,'limit':_0x3c8a99[_0x4804('0x19')]?_0x3c8a99[_0x4804('0x19')][_0x4804('0x1f')]||null:null})['then'](function(_0x33011d){logger[_0x4804('0xc')]('UpdateVoiceAgentReport',_0x3c8a99);logger[_0x4804('0xf')]('UpdateVoiceAgentReport',_0x3c8a99,JSON['stringify'](_0x33011d));_0x449e61(_0x33011d);})[_0x4804('0x15')](function(_0x34cebe){logger['error'](_0x4804('0x20'),_0x34cebe[_0x4804('0x13')],_0x3c8a99);_0xdee80e(_0x5c117d['error'](0x1f4,_0x34cebe[_0x4804('0x13')]));});});}; \ No newline at end of file +var _0xb4bf=['info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateVoiceAgentReport','VoiceAgentReport','create','body','options','raw','update','where','attributes','limit','UpdateVoiceAgentReport','debug','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then'];(function(_0x187e5a,_0x103eb9){var _0x2d3e24=function(_0x4f7c62){while(--_0x4f7c62){_0x187e5a['push'](_0x187e5a['shift']());}};_0x2d3e24(++_0x103eb9);}(_0xb4bf,0x1c3));var _0xfb4b=function(_0xc4001c,_0x1bf8f0){_0xc4001c=_0xc4001c-0x0;var _0x49f7bc=_0xb4bf[_0xc4001c];return _0x49f7bc;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xfb4b('0x0'));var rs=require(_0xfb4b('0x1'));var fs=require('fs');var Redis=require(_0xfb4b('0x2'));var db=require(_0xfb4b('0x3'))['db'];var utils=require(_0xfb4b('0x4'));var logger=require(_0xfb4b('0x5'))(_0xfb4b('0x6'));var config=require(_0xfb4b('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xfb4b('0x8')][_0xfb4b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5aeb24,_0x686285,_0x75cd4c){return new BPromise(function(_0x3233cf,_0xd64223){return client['request'](_0x5aeb24,_0x75cd4c)[_0xfb4b('0xa')](function(_0x2cd8ae){logger[_0xfb4b('0xb')](_0xfb4b('0xc'),_0x686285,_0xfb4b('0xd'));logger['debug'](_0xfb4b('0xe'),_0x686285,_0xfb4b('0xd'),JSON[_0xfb4b('0xf')](_0x2cd8ae));if(_0x2cd8ae[_0xfb4b('0x10')]){if(_0x2cd8ae['error'][_0xfb4b('0x11')]===0x1f4){logger[_0xfb4b('0x10')](_0xfb4b('0xc'),_0x686285,_0x2cd8ae['error'][_0xfb4b('0x12')]);return _0xd64223(_0x2cd8ae['error']['message']);}logger[_0xfb4b('0x10')](_0xfb4b('0xc'),_0x686285,_0x2cd8ae[_0xfb4b('0x10')]['message']);return _0x3233cf(_0x2cd8ae[_0xfb4b('0x10')][_0xfb4b('0x12')]);}else{logger[_0xfb4b('0xb')](_0xfb4b('0xc'),_0x686285,_0xfb4b('0xd'));_0x3233cf(_0x2cd8ae[_0xfb4b('0x13')][_0xfb4b('0x12')]);}})[_0xfb4b('0x14')](function(_0x5009a5){logger[_0xfb4b('0x10')]('VoiceAgentReport,\x20%s,\x20%s',_0x686285,_0x5009a5);_0xd64223(_0x5009a5);});});}exports[_0xfb4b('0x15')]=function(_0x30bcae){var _0x214db7=this;return new Promise(function(_0x5c1424,_0x539b8e){return db[_0xfb4b('0x16')][_0xfb4b('0x17')](_0x30bcae[_0xfb4b('0x18')],{'raw':_0x30bcae[_0xfb4b('0x19')]?_0x30bcae[_0xfb4b('0x19')][_0xfb4b('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x1530d1){logger[_0xfb4b('0xb')](_0xfb4b('0x15'),_0x30bcae);logger['debug'](_0xfb4b('0x15'),_0x30bcae,JSON['stringify'](_0x1530d1));_0x5c1424(_0x1530d1);})[_0xfb4b('0x14')](function(_0x82f6e2){logger[_0xfb4b('0x10')](_0xfb4b('0x15'),_0x82f6e2['message'],_0x30bcae);_0x539b8e(_0x214db7['error'](0x1f4,_0x82f6e2[_0xfb4b('0x12')]));});});};exports['UpdateVoiceAgentReport']=function(_0x491590){var _0x46de7b=this;return new Promise(function(_0x37ce4f,_0x43c4ab){return db[_0xfb4b('0x16')][_0xfb4b('0x1b')](_0x491590[_0xfb4b('0x18')],{'raw':_0x491590[_0xfb4b('0x19')]?_0x491590[_0xfb4b('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x491590['options']?_0x491590['options'][_0xfb4b('0x1c')]||null:null,'attributes':_0x491590['options']?_0x491590['options'][_0xfb4b('0x1d')]||null:null,'limit':_0x491590['options']?_0x491590[_0xfb4b('0x19')][_0xfb4b('0x1e')]||null:null})['then'](function(_0x2d91d6){logger[_0xfb4b('0xb')](_0xfb4b('0x1f'),_0x491590);logger[_0xfb4b('0x20')](_0xfb4b('0x1f'),_0x491590,JSON['stringify'](_0x2d91d6));_0x37ce4f(_0x2d91d6);})[_0xfb4b('0x14')](function(_0x50c4df){logger[_0xfb4b('0x10')](_0xfb4b('0x1f'),_0x50c4df[_0xfb4b('0x12')],_0x491590);_0x43c4ab(_0x46de7b[_0xfb4b('0x10')](0x1f4,_0x50c4df[_0xfb4b('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index ca2df2c..62e066d 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 _0xb969=['create','put','update','delete','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','post'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xb969,0x9d));var _0x9b96=function(_0x4704a1,_0x1b6d27){_0x4704a1=_0x4704a1-0x0;var _0xe33c73=_0xb969[_0x4704a1];return _0xe33c73;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x9b96('0x0'));var timeout=require(_0x9b96('0x1'));var express=require(_0x9b96('0x2'));var router=express[_0x9b96('0x3')]();var auth=require(_0x9b96('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x9b96('0x5'));var controller=require('./voiceCallReport.controller');router[_0x9b96('0x6')]('/',auth[_0x9b96('0x7')](),controller['index']);router[_0x9b96('0x6')](_0x9b96('0x8'),auth[_0x9b96('0x7')](),controller[_0x9b96('0x9')]);router[_0x9b96('0x6')](_0x9b96('0xa'),auth[_0x9b96('0x7')](),controller[_0x9b96('0xb')]);router[_0x9b96('0xc')]('/',auth[_0x9b96('0x7')](),controller[_0x9b96('0xd')]);router[_0x9b96('0xe')](_0x9b96('0xa'),auth[_0x9b96('0x7')](),controller[_0x9b96('0xf')]);router[_0x9b96('0x10')](_0x9b96('0xa'),auth[_0x9b96('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xd818=['/:id','update','delete','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','./voiceCallReport.controller','get','isAuthenticated','index','/describe','post','create','put'];(function(_0x49e454,_0x22328f){var _0x21d045=function(_0x36c9d0){while(--_0x36c9d0){_0x49e454['push'](_0x49e454['shift']());}};_0x21d045(++_0x22328f);}(_0xd818,0xef));var _0x8d81=function(_0x580647,_0x43d2c3){_0x580647=_0x580647-0x0;var _0x5f0792=_0xd818[_0x580647];return _0x5f0792;};'use strict';var multer=require('multer');var util=require(_0x8d81('0x0'));var path=require('path');var timeout=require(_0x8d81('0x1'));var express=require(_0x8d81('0x2'));var router=express[_0x8d81('0x3')]();var auth=require(_0x8d81('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x8d81('0x5'));router[_0x8d81('0x6')]('/',auth[_0x8d81('0x7')](),controller[_0x8d81('0x8')]);router['get'](_0x8d81('0x9'),auth[_0x8d81('0x7')](),controller['describe']);router[_0x8d81('0x6')]('/:id',auth[_0x8d81('0x7')](),controller['show']);router[_0x8d81('0xa')]('/',auth['isAuthenticated'](),controller[_0x8d81('0xb')]);router[_0x8d81('0xc')](_0x8d81('0xd'),auth[_0x8d81('0x7')](),controller[_0x8d81('0xe')]);router[_0x8d81('0xf')](_0x8d81('0xd'),auth[_0x8d81('0x7')](),controller[_0x8d81('0x10')]);module[_0x8d81('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index 65ec901..3be58b1 100644 --- a/server/api/voiceCallReport/voiceCallReport.attributes.js +++ b/server/api/voiceCallReport/voiceCallReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['ENUM','internal','outbound','inbound-fax','outbound-fax','DATE','INTEGER','sequelize','exports','STRING'];(function(_0x1fc59b,_0x35cfad){var _0x1910d3=function(_0x280b1e){while(--_0x280b1e){_0x1fc59b['push'](_0x1fc59b['shift']());}};_0x1910d3(++_0x35cfad);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'uniqueid':{'type':Sequelize[_0x7995('0x2')]},'type':{'type':Sequelize[_0x7995('0x3')]('inbound',_0x7995('0x4'),_0x7995('0x5'),_0x7995('0x6'),_0x7995('0x7'),'dialer')},'tag':{'type':Sequelize[_0x7995('0x2')]},'accountcode':{'type':Sequelize[_0x7995('0x2')]},'source':{'type':Sequelize[_0x7995('0x2')]},'destination':{'type':Sequelize[_0x7995('0x2')]},'destinationcontext':{'type':Sequelize[_0x7995('0x2')]},'callerid':{'type':Sequelize[_0x7995('0x2')]},'channel':{'type':Sequelize['STRING']},'destinationchannel':{'type':Sequelize[_0x7995('0x2')]},'lastapplication':{'type':Sequelize[_0x7995('0x2')]},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize[_0x7995('0x8')]},'systemanswertime':{'type':Sequelize[_0x7995('0x8')]},'answertime':{'type':Sequelize[_0x7995('0x8')]},'endtime':{'type':Sequelize[_0x7995('0x8')]},'duration':{'type':Sequelize[_0x7995('0x9')]},'billableseconds':{'type':Sequelize[_0x7995('0x9')]},'mohtime':{'type':Sequelize[_0x7995('0x9')],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0x7995('0x2')]},'userfield':{'type':Sequelize[_0x7995('0x2')]},'userDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x7995('0x2')]},'prefix':{'type':Sequelize[_0x7995('0x2')]},'routeid':{'type':Sequelize[_0x7995('0x9')]},'sipcallid':{'type':Sequelize[_0x7995('0x2')]}}; \ No newline at end of file +var _0xa9e0=['dialer','DATE','INTEGER','sequelize','exports','STRING','internal','inbound-fax','outbound-fax'];(function(_0x1103e6,_0x3a0217){var _0x5bc0ef=function(_0x3e979b){while(--_0x3e979b){_0x1103e6['push'](_0x1103e6['shift']());}};_0x5bc0ef(++_0x3a0217);}(_0xa9e0,0x123));var _0x0a9e=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xa9e0[_0x501510];return _0x1e6ee5;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'uniqueid':{'type':Sequelize[_0x0a9e('0x2')]},'type':{'type':Sequelize['ENUM']('inbound',_0x0a9e('0x3'),'outbound',_0x0a9e('0x4'),_0x0a9e('0x5'),_0x0a9e('0x6'))},'tag':{'type':Sequelize[_0x0a9e('0x2')]},'accountcode':{'type':Sequelize[_0x0a9e('0x2')]},'source':{'type':Sequelize['STRING']},'destination':{'type':Sequelize[_0x0a9e('0x2')]},'destinationcontext':{'type':Sequelize[_0x0a9e('0x2')]},'callerid':{'type':Sequelize[_0x0a9e('0x2')]},'channel':{'type':Sequelize['STRING']},'destinationchannel':{'type':Sequelize['STRING']},'lastapplication':{'type':Sequelize[_0x0a9e('0x2')]},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize['DATE']},'systemanswertime':{'type':Sequelize[_0x0a9e('0x7')]},'answertime':{'type':Sequelize[_0x0a9e('0x7')]},'endtime':{'type':Sequelize[_0x0a9e('0x7')]},'duration':{'type':Sequelize[_0x0a9e('0x8')]},'billableseconds':{'type':Sequelize[_0x0a9e('0x8')]},'mohtime':{'type':Sequelize[_0x0a9e('0x8')],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x0a9e('0x2')]},'prefix':{'type':Sequelize[_0x0a9e('0x2')]},'routeid':{'type':Sequelize[_0x0a9e('0x8')]},'sipcallid':{'type':Sequelize[_0x0a9e('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index f886f40..2fcb681 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 _0xd39d=['map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','order','sort','pick','filter','where','merge','VIRTUAL','VoiceCallReport','includeAll','include','fullname','alias','User','findAll','rows','catch','show','params','options','find','create','describe','body','uniqueid','user','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','limit','Content-Range','apply','reject','update','then','stack','name','send','index'];(function(_0x3c487b,_0x44c5e2){var _0x1d65f6=function(_0x135e6d){while(--_0x135e6d){_0x3c487b['push'](_0x3c487b['shift']());}};_0x1d65f6(++_0x44c5e2);}(_0xd39d,0x10c));var _0xdd39=function(_0x3018eb,_0x570c63){_0x3018eb=_0x3018eb-0x0;var _0x23131f=_0xd39d[_0x3018eb];return _0x23131f;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xdd39('0x0'));var zipdir=require(_0xdd39('0x1'));var jsonpatch=require(_0xdd39('0x2'));var rp=require('request-promise');var moment=require(_0xdd39('0x3'));var BPromise=require(_0xdd39('0x4'));var Mustache=require(_0xdd39('0x5'));var util=require(_0xdd39('0x6'));var path=require(_0xdd39('0x7'));var sox=require(_0xdd39('0x8'));var csv=require(_0xdd39('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xdd39('0xa'));var squel=require(_0xdd39('0xb'));var crypto=require(_0xdd39('0xc'));var jsforce=require(_0xdd39('0xd'));var deskjs=require(_0xdd39('0xe'));var toCsv=require(_0xdd39('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xdd39('0xf'));var authService=require(_0xdd39('0x10'));var qs=require(_0xdd39('0x11'));var as=require(_0xdd39('0x12'));var hardwareService=require(_0xdd39('0x13'));var logger=require(_0xdd39('0x14'))(_0xdd39('0x15'));var utils=require('../../config/utils');var config=require(_0xdd39('0x16'));var db=require(_0xdd39('0x17'))['db'];function respondWithStatusCode(_0x57670e,_0x2167fe){_0x2167fe=_0x2167fe||0xcc;return function(_0x3a6708){if(_0x3a6708){return _0x57670e[_0xdd39('0x18')](_0x2167fe);}return _0x57670e['status'](_0x2167fe)[_0xdd39('0x19')]();};}function respondWithResult(_0xd2001f,_0x5318ba){_0x5318ba=_0x5318ba||0xc8;return function(_0xb0d59a){if(_0xb0d59a){return _0xd2001f[_0xdd39('0x1a')](_0x5318ba)[_0xdd39('0x1b')](_0xb0d59a);}};}function respondWithFilteredResult(_0x2aae33,_0x250b1c){return function(_0x70fdf0){if(_0x70fdf0){var _0x4a1e7b=_0x70fdf0[_0xdd39('0x1c')],_0x121f23=_0x250b1c['offset'],_0x4e707b=_0x250b1c[_0xdd39('0x1d')]+_0x250b1c[_0xdd39('0x1e')],_0x5868c6;if(_0x4e707b>=_0x4a1e7b){_0x4e707b=_0x4a1e7b;_0x5868c6=0xc8;}else{_0x5868c6=0xce;}_0x2aae33[_0xdd39('0x1a')](_0x5868c6);return _0x2aae33['set'](_0xdd39('0x1f'),_0x121f23+'-'+_0x4e707b+'/'+_0x4a1e7b)[_0xdd39('0x1b')](_0x70fdf0);}return null;};}function patchUpdates(_0x28bb36){return function(_0x2b77cf){try{jsonpatch[_0xdd39('0x20')](_0x2b77cf,_0x28bb36,!![]);}catch(_0x57924f){return BPromise[_0xdd39('0x21')](_0x57924f);}return _0x2b77cf['save']();};}function saveUpdates(_0x46174d,_0xe1f7b9){return function(_0x3a3479){if(_0x3a3479){return _0x3a3479[_0xdd39('0x22')](_0x46174d)['then'](function(_0x5f41ba){return _0x5f41ba;});}return null;};}function removeEntity(_0x195a3c,_0x598706){return function(_0x51570a){if(_0x51570a){return _0x51570a['destroy']()[_0xdd39('0x23')](function(){_0x195a3c[_0xdd39('0x1a')](0xcc)[_0xdd39('0x19')]();});}};}function handleEntityNotFound(_0x1d8c6c,_0x293569){return function(_0x497b4a){if(!_0x497b4a){_0x1d8c6c[_0xdd39('0x18')](0x194);}return _0x497b4a;};}function handleError(_0x453d03,_0x27fee8){_0x27fee8=_0x27fee8||0x1f4;return function(_0x38f907){logger['error'](_0x38f907[_0xdd39('0x24')]);if(_0x38f907['name']){delete _0x38f907[_0xdd39('0x25')];}_0x453d03[_0xdd39('0x1a')](_0x27fee8)[_0xdd39('0x26')](_0x38f907);};}exports[_0xdd39('0x27')]=function(_0x1c7933,_0x13ae25){var _0x3cc30d={},_0x30871a={},_0x4d200d={'count':0x0,'rows':[]};var _0x5453a5=_[_0xdd39('0x28')](db['VoiceCallReport'][_0xdd39('0x29')],function(_0x15f116){return{'name':_0x15f116[_0xdd39('0x2a')],'type':_0x15f116[_0xdd39('0x2b')]['key']};});_0x30871a[_0xdd39('0x2c')]=_[_0xdd39('0x28')](_0x5453a5,_0xdd39('0x25'));_0x30871a[_0xdd39('0x2d')]=_[_0xdd39('0x2e')](_0x1c7933['query']);_0x30871a[_0xdd39('0x2f')]=_[_0xdd39('0x30')](_0x30871a[_0xdd39('0x2c')],_0x30871a[_0xdd39('0x2d')]);_0x3cc30d[_0xdd39('0x31')]=_[_0xdd39('0x30')](_0x30871a['model'],qs['fields'](_0x1c7933[_0xdd39('0x2d')][_0xdd39('0x32')]));_0x3cc30d['attributes']=_0x3cc30d[_0xdd39('0x31')][_0xdd39('0x33')]?_0x3cc30d['attributes']:_0x30871a[_0xdd39('0x2c')];if(!_0x1c7933['query']['hasOwnProperty']('nolimit')){_0x3cc30d['limit']=qs[_0xdd39('0x1e')](_0x1c7933['query'][_0xdd39('0x1e')]);_0x3cc30d['offset']=qs[_0xdd39('0x1d')](_0x1c7933[_0xdd39('0x2d')][_0xdd39('0x1d')]);}_0x3cc30d[_0xdd39('0x34')]=qs['sort'](_0x1c7933[_0xdd39('0x2d')][_0xdd39('0x35')]);_0x3cc30d['where']=qs[_0xdd39('0x2f')](_[_0xdd39('0x36')](_0x1c7933[_0xdd39('0x2d')],_0x30871a[_0xdd39('0x2f')]));if(_0x1c7933[_0xdd39('0x2d')][_0xdd39('0x37')]){_0x3cc30d[_0xdd39('0x38')]=_[_0xdd39('0x39')](_0x3cc30d[_0xdd39('0x38')],{'$or':_['map'](_0x5453a5,function(_0x1f996e){if(_0x1f996e[_0xdd39('0x2b')]!==_0xdd39('0x3a')){var _0x3dd810={};_0x3dd810[_0x1f996e[_0xdd39('0x25')]]={'$like':'%'+_0x1c7933[_0xdd39('0x2d')][_0xdd39('0x37')]+'%'};return _0x3dd810;}})});}_0x3cc30d=_['merge']({},_0x3cc30d,_0x1c7933['options']);var _0x4b3d7d={'where':_0x3cc30d[_0xdd39('0x38')]};return db[_0xdd39('0x3b')][_0xdd39('0x1c')](_0x4b3d7d)[_0xdd39('0x23')](function(_0x11729b){_0x4d200d[_0xdd39('0x1c')]=_0x11729b;if(_0x1c7933['query'][_0xdd39('0x3c')]){_0x3cc30d[_0xdd39('0x3d')]=[{'attributes':['id',_0xdd39('0x25'),_0xdd39('0x3e'),_0xdd39('0x3f')],'model':db['User'],'as':_0xdd39('0x40')}];}return db[_0xdd39('0x3b')][_0xdd39('0x41')](_0x3cc30d);})[_0xdd39('0x23')](function(_0x498a61){_0x4d200d[_0xdd39('0x42')]=_0x498a61;return _0x4d200d;})[_0xdd39('0x23')](respondWithFilteredResult(_0x13ae25,_0x3cc30d))[_0xdd39('0x43')](handleError(_0x13ae25,null));};exports[_0xdd39('0x44')]=function(_0x439ed5,_0x3960e0){var _0x33bde4={'raw':!![],'where':{'id':_0x439ed5[_0xdd39('0x45')]['id']}},_0x4dd478={};_0x4dd478[_0xdd39('0x2c')]=_[_0xdd39('0x2e')](db[_0xdd39('0x3b')][_0xdd39('0x29')]);_0x4dd478[_0xdd39('0x2d')]=_[_0xdd39('0x2e')](_0x439ed5[_0xdd39('0x2d')]);_0x4dd478[_0xdd39('0x2f')]=_['intersection'](_0x4dd478[_0xdd39('0x2c')],_0x4dd478[_0xdd39('0x2d')]);_0x33bde4[_0xdd39('0x31')]=_[_0xdd39('0x30')](_0x4dd478[_0xdd39('0x2c')],qs[_0xdd39('0x32')](_0x439ed5[_0xdd39('0x2d')][_0xdd39('0x32')]));_0x33bde4[_0xdd39('0x31')]=_0x33bde4['attributes'][_0xdd39('0x33')]?_0x33bde4['attributes']:_0x4dd478[_0xdd39('0x2c')];if(_0x439ed5[_0xdd39('0x2d')][_0xdd39('0x3c')]){_0x33bde4['include']=[{'all':!![]}];}_0x33bde4=_[_0xdd39('0x39')]({},_0x33bde4,_0x439ed5[_0xdd39('0x46')]);return db['VoiceCallReport'][_0xdd39('0x47')](_0x33bde4)[_0xdd39('0x23')](handleEntityNotFound(_0x3960e0,null))[_0xdd39('0x23')](respondWithResult(_0x3960e0,null))['catch'](handleError(_0x3960e0,null));};exports[_0xdd39('0x48')]=function(_0xef7567,_0x10de2f){return db[_0xdd39('0x3b')][_0xdd39('0x48')](_0xef7567['body'],{})['then'](respondWithResult(_0x10de2f,0xc9))[_0xdd39('0x43')](handleError(_0x10de2f,null));};exports['destroy']=function(_0x3676d2,_0x5a6060){return db[_0xdd39('0x3b')][_0xdd39('0x47')]({'where':{'id':_0x3676d2[_0xdd39('0x45')]['id']}})[_0xdd39('0x23')](handleEntityNotFound(_0x5a6060,null))[_0xdd39('0x23')](removeEntity(_0x5a6060,null))[_0xdd39('0x43')](handleError(_0x5a6060,null));};exports[_0xdd39('0x49')]=function(_0x245ba3,_0x52dd27){return db[_0xdd39('0x3b')][_0xdd39('0x49')]()[_0xdd39('0x23')](respondWithResult(_0x52dd27,null))[_0xdd39('0x43')](handleError(_0x52dd27,null));};exports[_0xdd39('0x22')]=function(_0x403861,_0x3f0837){if(_0x403861[_0xdd39('0x4a')][_0xdd39('0x4b')]){delete _0x403861['body'][_0xdd39('0x4b')];}return db[_0xdd39('0x3b')]['find']({'where':{'uniqueid':_0x403861[_0xdd39('0x45')]['id'],'UserId':{'$or':[null,_0x403861[_0xdd39('0x4c')]['id']]}}})[_0xdd39('0x23')](handleEntityNotFound(_0x3f0837,null))['then'](saveUpdates(_0x403861[_0xdd39('0x4a')],null))['then'](respondWithResult(_0x3f0837,null))['catch'](handleError(_0x3f0837,null));}; \ No newline at end of file +var _0x01c3=['length','hasOwnProperty','sort','where','filters','filter','merge','VIRTUAL','count','includeAll','include','fullname','User','findAll','catch','params','options','find','create','body','destroy','describe','uniqueid','user','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','lodash','crypto','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','limit','apply','reject','save','update','then','error','stack','name','send','index','VoiceCallReport','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','fields','attributes'];(function(_0x250d22,_0x204c85){var _0x1f8675=function(_0x4286d9){while(--_0x4286d9){_0x250d22['push'](_0x250d22['shift']());}};_0x1f8675(++_0x204c85);}(_0x01c3,0xf3));var _0x301c=function(_0x38a913,_0x4270e6){_0x38a913=_0x38a913-0x0;var _0x120cc8=_0x01c3[_0x38a913];return _0x120cc8;};'use strict';var pdf=require(_0x301c('0x0'));var emlformat=require(_0x301c('0x1'));var rimraf=require(_0x301c('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x301c('0x3'));var rp=require(_0x301c('0x4'));var moment=require(_0x301c('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x301c('0x6'));var util=require(_0x301c('0x7'));var path=require(_0x301c('0x8'));var sox=require(_0x301c('0x9'));var csv=require(_0x301c('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x301c('0xb'));var squel=require('squel');var crypto=require(_0x301c('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x301c('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x301c('0xd'));var authService=require(_0x301c('0xe'));var qs=require(_0x301c('0xf'));var as=require(_0x301c('0x10'));var hardwareService=require(_0x301c('0x11'));var logger=require('../../config/logger')(_0x301c('0x12'));var utils=require(_0x301c('0x13'));var config=require(_0x301c('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1c9a42,_0x32eb28){_0x32eb28=_0x32eb28||0xcc;return function(_0x5cd198){if(_0x5cd198){return _0x1c9a42[_0x301c('0x15')](_0x32eb28);}return _0x1c9a42[_0x301c('0x16')](_0x32eb28)[_0x301c('0x17')]();};}function respondWithResult(_0x4fc968,_0xadb36d){_0xadb36d=_0xadb36d||0xc8;return function(_0x45dc73){if(_0x45dc73){return _0x4fc968[_0x301c('0x16')](_0xadb36d)[_0x301c('0x18')](_0x45dc73);}};}function respondWithFilteredResult(_0x28cb60,_0x3f705b){return function(_0x5d4157){if(_0x5d4157){var _0x5cacfd=_0x5d4157['count'],_0x13566f=_0x3f705b[_0x301c('0x19')],_0x3ae062=_0x3f705b[_0x301c('0x19')]+_0x3f705b[_0x301c('0x1a')],_0x229af1;if(_0x3ae062>=_0x5cacfd){_0x3ae062=_0x5cacfd;_0x229af1=0xc8;}else{_0x229af1=0xce;}_0x28cb60['status'](_0x229af1);return _0x28cb60['set']('Content-Range',_0x13566f+'-'+_0x3ae062+'/'+_0x5cacfd)[_0x301c('0x18')](_0x5d4157);}return null;};}function patchUpdates(_0x4f8944){return function(_0x3fbcce){try{jsonpatch[_0x301c('0x1b')](_0x3fbcce,_0x4f8944,!![]);}catch(_0x2e2b46){return BPromise[_0x301c('0x1c')](_0x2e2b46);}return _0x3fbcce[_0x301c('0x1d')]();};}function saveUpdates(_0x12ff1e,_0x2c1289){return function(_0x133b17){if(_0x133b17){return _0x133b17[_0x301c('0x1e')](_0x12ff1e)[_0x301c('0x1f')](function(_0x99fc9c){return _0x99fc9c;});}return null;};}function removeEntity(_0x2b135c,_0x47eb2f){return function(_0xa96f82){if(_0xa96f82){return _0xa96f82['destroy']()[_0x301c('0x1f')](function(){_0x2b135c[_0x301c('0x16')](0xcc)[_0x301c('0x17')]();});}};}function handleEntityNotFound(_0x5a856c,_0x211206){return function(_0x4e0a41){if(!_0x4e0a41){_0x5a856c[_0x301c('0x15')](0x194);}return _0x4e0a41;};}function handleError(_0x3c3239,_0x214d4f){_0x214d4f=_0x214d4f||0x1f4;return function(_0x541d23){logger[_0x301c('0x20')](_0x541d23[_0x301c('0x21')]);if(_0x541d23[_0x301c('0x22')]){delete _0x541d23[_0x301c('0x22')];}_0x3c3239[_0x301c('0x16')](_0x214d4f)[_0x301c('0x23')](_0x541d23);};}exports[_0x301c('0x24')]=function(_0x1b3766,_0x4d030e){var _0x5672fb={},_0x3b0b88={},_0x40d5aa={'count':0x0,'rows':[]};var _0x4639d0=_['map'](db[_0x301c('0x25')][_0x301c('0x26')],function(_0x5191e7){return{'name':_0x5191e7[_0x301c('0x27')],'type':_0x5191e7[_0x301c('0x28')][_0x301c('0x29')]};});_0x3b0b88[_0x301c('0x2a')]=_[_0x301c('0x2b')](_0x4639d0,_0x301c('0x22'));_0x3b0b88[_0x301c('0x2c')]=_[_0x301c('0x2d')](_0x1b3766[_0x301c('0x2c')]);_0x3b0b88['filters']=_[_0x301c('0x2e')](_0x3b0b88['model'],_0x3b0b88[_0x301c('0x2c')]);_0x5672fb['attributes']=_[_0x301c('0x2e')](_0x3b0b88['model'],qs[_0x301c('0x2f')](_0x1b3766['query'][_0x301c('0x2f')]));_0x5672fb[_0x301c('0x30')]=_0x5672fb['attributes'][_0x301c('0x31')]?_0x5672fb['attributes']:_0x3b0b88[_0x301c('0x2a')];if(!_0x1b3766[_0x301c('0x2c')][_0x301c('0x32')]('nolimit')){_0x5672fb[_0x301c('0x1a')]=qs[_0x301c('0x1a')](_0x1b3766['query'][_0x301c('0x1a')]);_0x5672fb[_0x301c('0x19')]=qs[_0x301c('0x19')](_0x1b3766[_0x301c('0x2c')][_0x301c('0x19')]);}_0x5672fb['order']=qs[_0x301c('0x33')](_0x1b3766[_0x301c('0x2c')]['sort']);_0x5672fb[_0x301c('0x34')]=qs['filters'](_['pick'](_0x1b3766[_0x301c('0x2c')],_0x3b0b88[_0x301c('0x35')]));if(_0x1b3766[_0x301c('0x2c')][_0x301c('0x36')]){_0x5672fb[_0x301c('0x34')]=_[_0x301c('0x37')](_0x5672fb['where'],{'$or':_[_0x301c('0x2b')](_0x4639d0,function(_0x1af756){if(_0x1af756[_0x301c('0x28')]!==_0x301c('0x38')){var _0x548e39={};_0x548e39[_0x1af756[_0x301c('0x22')]]={'$like':'%'+_0x1b3766['query'][_0x301c('0x36')]+'%'};return _0x548e39;}})});}_0x5672fb=_[_0x301c('0x37')]({},_0x5672fb,_0x1b3766['options']);var _0x311641={'where':_0x5672fb['where']};return db[_0x301c('0x25')]['count'](_0x311641)[_0x301c('0x1f')](function(_0x494ac4){_0x40d5aa[_0x301c('0x39')]=_0x494ac4;if(_0x1b3766['query'][_0x301c('0x3a')]){_0x5672fb[_0x301c('0x3b')]=[{'attributes':['id',_0x301c('0x22'),_0x301c('0x3c'),'alias'],'model':db[_0x301c('0x3d')],'as':'User'}];}return db[_0x301c('0x25')][_0x301c('0x3e')](_0x5672fb);})[_0x301c('0x1f')](function(_0x159a82){_0x40d5aa['rows']=_0x159a82;return _0x40d5aa;})[_0x301c('0x1f')](respondWithFilteredResult(_0x4d030e,_0x5672fb))[_0x301c('0x3f')](handleError(_0x4d030e,null));};exports['show']=function(_0x4648d2,_0x3e10c2){var _0x3da660={'raw':!![],'where':{'id':_0x4648d2[_0x301c('0x40')]['id']}},_0x3d839b={};_0x3d839b[_0x301c('0x2a')]=_[_0x301c('0x2d')](db[_0x301c('0x25')][_0x301c('0x26')]);_0x3d839b[_0x301c('0x2c')]=_['keys'](_0x4648d2['query']);_0x3d839b[_0x301c('0x35')]=_['intersection'](_0x3d839b[_0x301c('0x2a')],_0x3d839b[_0x301c('0x2c')]);_0x3da660[_0x301c('0x30')]=_['intersection'](_0x3d839b[_0x301c('0x2a')],qs['fields'](_0x4648d2['query'][_0x301c('0x2f')]));_0x3da660[_0x301c('0x30')]=_0x3da660['attributes'][_0x301c('0x31')]?_0x3da660[_0x301c('0x30')]:_0x3d839b[_0x301c('0x2a')];if(_0x4648d2[_0x301c('0x2c')][_0x301c('0x3a')]){_0x3da660[_0x301c('0x3b')]=[{'all':!![]}];}_0x3da660=_['merge']({},_0x3da660,_0x4648d2[_0x301c('0x41')]);return db[_0x301c('0x25')][_0x301c('0x42')](_0x3da660)[_0x301c('0x1f')](handleEntityNotFound(_0x3e10c2,null))['then'](respondWithResult(_0x3e10c2,null))[_0x301c('0x3f')](handleError(_0x3e10c2,null));};exports['create']=function(_0x423561,_0x5c7c16){return db[_0x301c('0x25')][_0x301c('0x43')](_0x423561[_0x301c('0x44')],{})[_0x301c('0x1f')](respondWithResult(_0x5c7c16,0xc9))[_0x301c('0x3f')](handleError(_0x5c7c16,null));};exports[_0x301c('0x45')]=function(_0x1430f7,_0x42cc5d){return db[_0x301c('0x25')]['find']({'where':{'id':_0x1430f7[_0x301c('0x40')]['id']}})[_0x301c('0x1f')](handleEntityNotFound(_0x42cc5d,null))[_0x301c('0x1f')](removeEntity(_0x42cc5d,null))[_0x301c('0x3f')](handleError(_0x42cc5d,null));};exports[_0x301c('0x46')]=function(_0x71eeb3,_0x15509c){return db[_0x301c('0x25')][_0x301c('0x46')]()['then'](respondWithResult(_0x15509c,null))['catch'](handleError(_0x15509c,null));};exports[_0x301c('0x1e')]=function(_0x3830b1,_0x5edf09){if(_0x3830b1[_0x301c('0x44')][_0x301c('0x47')]){delete _0x3830b1[_0x301c('0x44')][_0x301c('0x47')];}return db['VoiceCallReport']['find']({'where':{'uniqueid':_0x3830b1[_0x301c('0x40')]['id'],'UserId':{'$or':[null,_0x3830b1[_0x301c('0x48')]['id']]}}})[_0x301c('0x1f')](handleEntityNotFound(_0x5edf09,null))['then'](saveUpdates(_0x3830b1[_0x301c('0x44')],null))[_0x301c('0x1f')](respondWithResult(_0x5edf09,null))[_0x301c('0x3f')](handleError(_0x5edf09,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index 3b9f3c3..9d0d74e 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 _0x7aae=['exports','define','VoiceCallReport','report_call','uniqueid','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x1f0d60,_0x58a2c2){var _0x148a20=function(_0x96e0a3){while(--_0x96e0a3){_0x1f0d60['push'](_0x1f0d60['shift']());}};_0x148a20(++_0x58a2c2);}(_0x7aae,0x157));var _0xe7aa=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x7aae[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0xe7aa('0x0'));var util=require(_0xe7aa('0x1'));var logger=require('../../config/logger')(_0xe7aa('0x2'));var moment=require(_0xe7aa('0x3'));var BPromise=require(_0xe7aa('0x4'));var rp=require(_0xe7aa('0x5'));var fs=require('fs');var path=require(_0xe7aa('0x6'));var rimraf=require('rimraf');var config=require(_0xe7aa('0x7'));var attributes=require('./voiceCallReport.attributes');module[_0xe7aa('0x8')]=function(_0x447a1b,_0x328767){return _0x447a1b[_0xe7aa('0x9')](_0xe7aa('0xa'),attributes,{'tableName':_0xe7aa('0xb'),'paranoid':![],'indexes':[{'fields':[_0xe7aa('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xcd29=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceCallReport.attributes','define','VoiceCallReport','report_call','uniqueid','lodash'];(function(_0x273c39,_0x1052e6){var _0x46d6b5=function(_0x44f1fb){while(--_0x44f1fb){_0x273c39['push'](_0x273c39['shift']());}};_0x46d6b5(++_0x1052e6);}(_0xcd29,0x109));var _0x9cd2=function(_0x2b7b35,_0x42ce39){_0x2b7b35=_0x2b7b35-0x0;var _0x596539=_0xcd29[_0x2b7b35];return _0x596539;};'use strict';var _=require(_0x9cd2('0x0'));var util=require(_0x9cd2('0x1'));var logger=require(_0x9cd2('0x2'))('api');var moment=require(_0x9cd2('0x3'));var BPromise=require(_0x9cd2('0x4'));var rp=require(_0x9cd2('0x5'));var fs=require('fs');var path=require(_0x9cd2('0x6'));var rimraf=require(_0x9cd2('0x7'));var config=require(_0x9cd2('0x8'));var attributes=require(_0x9cd2('0x9'));module['exports']=function(_0x18d1d4,_0x2ed7e5){return _0x18d1d4[_0x9cd2('0xa')](_0x9cd2('0xb'),attributes,{'tableName':_0x9cd2('0xc'),'paranoid':![],'indexes':[{'fields':[_0x9cd2('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index 17d75fc..f051fed 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 _0xadfc=['VoiceCallReport,\x20%s,\x20%s','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','GetVoiceCallReport','options','raw','where','limit','include','attributes','map','model','CreateVoiceCallReport','VoiceCallReport','create','UpdateVoiceCallReport','update','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info'];(function(_0x2f1c7d,_0x48cdc1){var _0x15855e=function(_0x52e960){while(--_0x52e960){_0x2f1c7d['push'](_0x2f1c7d['shift']());}};_0x15855e(++_0x48cdc1);}(_0xadfc,0x65));var _0xcadf=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xadfc[_0x5b561d];return _0x431060;};'use strict';var _=require(_0xcadf('0x0'));var util=require(_0xcadf('0x1'));var moment=require(_0xcadf('0x2'));var BPromise=require(_0xcadf('0x3'));var rs=require(_0xcadf('0x4'));var fs=require('fs');var Redis=require(_0xcadf('0x5'));var db=require(_0xcadf('0x6'))['db'];var utils=require(_0xcadf('0x7'));var logger=require(_0xcadf('0x8'))(_0xcadf('0x9'));var config=require('../../config/environment');var jayson=require(_0xcadf('0xa'));var client=jayson[_0xcadf('0xb')][_0xcadf('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5739dd,_0x2ef36a,_0x6c63a7){return new BPromise(function(_0x226a3e,_0x17f120){return client[_0xcadf('0xd')](_0x5739dd,_0x6c63a7)[_0xcadf('0xe')](function(_0x107faa){logger[_0xcadf('0xf')](_0xcadf('0x10'),_0x2ef36a,'request\x20sent');logger[_0xcadf('0x11')](_0xcadf('0x12'),_0x2ef36a,_0xcadf('0x13'),JSON[_0xcadf('0x14')](_0x107faa));if(_0x107faa[_0xcadf('0x15')]){if(_0x107faa[_0xcadf('0x15')]['code']===0x1f4){logger[_0xcadf('0x15')](_0xcadf('0x10'),_0x2ef36a,_0x107faa[_0xcadf('0x15')][_0xcadf('0x16')]);return _0x17f120(_0x107faa['error'][_0xcadf('0x16')]);}logger[_0xcadf('0x15')](_0xcadf('0x10'),_0x2ef36a,_0x107faa[_0xcadf('0x15')][_0xcadf('0x16')]);return _0x226a3e(_0x107faa[_0xcadf('0x15')][_0xcadf('0x16')]);}else{logger[_0xcadf('0xf')](_0xcadf('0x10'),_0x2ef36a,'request\x20sent');_0x226a3e(_0x107faa[_0xcadf('0x17')][_0xcadf('0x16')]);}})[_0xcadf('0x18')](function(_0xb7c5ae){logger[_0xcadf('0x15')](_0xcadf('0x10'),_0x2ef36a,_0xb7c5ae);_0x17f120(_0xb7c5ae);});});}exports[_0xcadf('0x19')]=function(_0x151b09){var _0x8b5741=this;return new Promise(function(_0x5e0bdb,_0x24e661){return db['VoiceCallReport']['findAll']({'raw':_0x151b09[_0xcadf('0x1a')]?_0x151b09[_0xcadf('0x1a')][_0xcadf('0x1b')]===undefined?!![]:![]:!![],'where':_0x151b09[_0xcadf('0x1a')]?_0x151b09[_0xcadf('0x1a')][_0xcadf('0x1c')]||null:null,'attributes':_0x151b09[_0xcadf('0x1a')]?_0x151b09[_0xcadf('0x1a')]['attributes']||null:null,'limit':_0x151b09[_0xcadf('0x1a')]?_0x151b09['options'][_0xcadf('0x1d')]||null:null,'include':_0x151b09[_0xcadf('0x1a')]?_0x151b09[_0xcadf('0x1a')][_0xcadf('0x1e')]?_['map'](_0x151b09['options'][_0xcadf('0x1e')],function(_0x2c7961){return{'model':db[_0x2c7961['model']],'as':_0x2c7961['as'],'attributes':_0x2c7961[_0xcadf('0x1f')],'include':_0x2c7961['include']?_[_0xcadf('0x20')](_0x2c7961[_0xcadf('0x1e')],function(_0x859517){return{'model':db[_0x859517[_0xcadf('0x21')]],'as':_0x859517['as'],'attributes':_0x859517[_0xcadf('0x1f')],'include':_0x859517['include']?_[_0xcadf('0x20')](_0x859517[_0xcadf('0x1e')],function(_0x1279bc){return{'model':db[_0x1279bc['model']],'as':_0x1279bc['as'],'attributes':_0x1279bc[_0xcadf('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xae03d4){logger['info'](_0xcadf('0x19'),_0x151b09);logger['debug'](_0xcadf('0x19'),_0x151b09,JSON[_0xcadf('0x14')](_0xae03d4));_0x5e0bdb(_0xae03d4);})['catch'](function(_0xa8a01e){logger[_0xcadf('0x15')](_0xcadf('0x19'),_0xa8a01e[_0xcadf('0x16')],_0x151b09);_0x24e661(_0x8b5741[_0xcadf('0x15')](0x1f4,_0xa8a01e[_0xcadf('0x16')]));});});};exports[_0xcadf('0x22')]=function(_0x34602c){var _0x4de15d=this;return new Promise(function(_0x4cdf44,_0x408925){return db[_0xcadf('0x23')][_0xcadf('0x24')](_0x34602c['body'],{'raw':_0x34602c[_0xcadf('0x1a')]?_0x34602c[_0xcadf('0x1a')][_0xcadf('0x1b')]===undefined?!![]:![]:!![]})[_0xcadf('0xe')](function(_0x51f210){logger[_0xcadf('0xf')](_0xcadf('0x22'),_0x34602c);logger[_0xcadf('0x11')]('CreateVoiceCallReport',_0x34602c,JSON[_0xcadf('0x14')](_0x51f210));_0x4cdf44(_0x51f210);})['catch'](function(_0x2d68b8){logger[_0xcadf('0x15')](_0xcadf('0x22'),_0x2d68b8[_0xcadf('0x16')],_0x34602c);_0x408925(_0x4de15d[_0xcadf('0x15')](0x1f4,_0x2d68b8[_0xcadf('0x16')]));});});};exports[_0xcadf('0x25')]=function(_0x2a0f9a){var _0x35a0cb=this;return new Promise(function(_0x85b30a,_0x3b81b8){return db[_0xcadf('0x23')][_0xcadf('0x26')](_0x2a0f9a['body'],{'raw':_0x2a0f9a[_0xcadf('0x1a')]?_0x2a0f9a[_0xcadf('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2a0f9a[_0xcadf('0x1a')]?_0x2a0f9a[_0xcadf('0x1a')][_0xcadf('0x1c')]||null:null,'attributes':_0x2a0f9a[_0xcadf('0x1a')]?_0x2a0f9a['options'][_0xcadf('0x1f')]||null:null,'limit':_0x2a0f9a[_0xcadf('0x1a')]?_0x2a0f9a[_0xcadf('0x1a')][_0xcadf('0x1d')]||null:null})[_0xcadf('0xe')](function(_0x27513a){logger[_0xcadf('0xf')]('UpdateVoiceCallReport',_0x2a0f9a);logger[_0xcadf('0x11')]('UpdateVoiceCallReport',_0x2a0f9a,JSON['stringify'](_0x27513a));_0x85b30a(_0x27513a);})[_0xcadf('0x18')](function(_0x297ef0){logger[_0xcadf('0x15')]('UpdateVoiceCallReport',_0x297ef0[_0xcadf('0x16')],_0x2a0f9a);_0x3b81b8(_0x35a0cb[_0xcadf('0x15')](0x1f4,_0x297ef0[_0xcadf('0x16')]));});});}; \ No newline at end of file +var _0x7b1f=['attributes','limit','include','map','model','CreateVoiceCallReport','create','body','raw','UpdateVoiceCallReport','update','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetVoiceCallReport','VoiceCallReport','options','where'];(function(_0x68654,_0x55d08c){var _0x4510fb=function(_0x4c6827){while(--_0x4c6827){_0x68654['push'](_0x68654['shift']());}};_0x4510fb(++_0x55d08c);}(_0x7b1f,0xef));var _0xf7b1=function(_0x7d62cb,_0x7622c){_0x7d62cb=_0x7d62cb-0x0;var _0x3a6266=_0x7b1f[_0x7d62cb];return _0x3a6266;};'use strict';var _=require(_0xf7b1('0x0'));var util=require('util');var moment=require(_0xf7b1('0x1'));var BPromise=require('bluebird');var rs=require(_0xf7b1('0x2'));var fs=require('fs');var Redis=require(_0xf7b1('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xf7b1('0x4'));var logger=require(_0xf7b1('0x5'))('rpc');var config=require(_0xf7b1('0x6'));var jayson=require(_0xf7b1('0x7'));var client=jayson[_0xf7b1('0x8')][_0xf7b1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x54b927,_0x436f5f,_0x1a17fc){return new BPromise(function(_0x1df2af,_0x4c11cd){return client[_0xf7b1('0xa')](_0x54b927,_0x1a17fc)[_0xf7b1('0xb')](function(_0x41f3fa){logger['info'](_0xf7b1('0xc'),_0x436f5f,_0xf7b1('0xd'));logger[_0xf7b1('0xe')](_0xf7b1('0xf'),_0x436f5f,_0xf7b1('0xd'),JSON[_0xf7b1('0x10')](_0x41f3fa));if(_0x41f3fa[_0xf7b1('0x11')]){if(_0x41f3fa[_0xf7b1('0x11')][_0xf7b1('0x12')]===0x1f4){logger[_0xf7b1('0x11')]('VoiceCallReport,\x20%s,\x20%s',_0x436f5f,_0x41f3fa[_0xf7b1('0x11')]['message']);return _0x4c11cd(_0x41f3fa[_0xf7b1('0x11')]['message']);}logger[_0xf7b1('0x11')](_0xf7b1('0xc'),_0x436f5f,_0x41f3fa[_0xf7b1('0x11')]['message']);return _0x1df2af(_0x41f3fa[_0xf7b1('0x11')][_0xf7b1('0x13')]);}else{logger[_0xf7b1('0x14')](_0xf7b1('0xc'),_0x436f5f,'request\x20sent');_0x1df2af(_0x41f3fa[_0xf7b1('0x15')][_0xf7b1('0x13')]);}})[_0xf7b1('0x16')](function(_0x584fb6){logger[_0xf7b1('0x11')]('VoiceCallReport,\x20%s,\x20%s',_0x436f5f,_0x584fb6);_0x4c11cd(_0x584fb6);});});}exports[_0xf7b1('0x17')]=function(_0x2b3422){var _0xa115cd=this;return new Promise(function(_0x59b410,_0x32d38e){return db[_0xf7b1('0x18')]['findAll']({'raw':_0x2b3422[_0xf7b1('0x19')]?_0x2b3422['options']['raw']===undefined?!![]:![]:!![],'where':_0x2b3422[_0xf7b1('0x19')]?_0x2b3422['options'][_0xf7b1('0x1a')]||null:null,'attributes':_0x2b3422['options']?_0x2b3422[_0xf7b1('0x19')][_0xf7b1('0x1b')]||null:null,'limit':_0x2b3422[_0xf7b1('0x19')]?_0x2b3422[_0xf7b1('0x19')][_0xf7b1('0x1c')]||null:null,'include':_0x2b3422[_0xf7b1('0x19')]?_0x2b3422[_0xf7b1('0x19')][_0xf7b1('0x1d')]?_[_0xf7b1('0x1e')](_0x2b3422[_0xf7b1('0x19')]['include'],function(_0x2bf42f){return{'model':db[_0x2bf42f[_0xf7b1('0x1f')]],'as':_0x2bf42f['as'],'attributes':_0x2bf42f['attributes'],'include':_0x2bf42f[_0xf7b1('0x1d')]?_['map'](_0x2bf42f[_0xf7b1('0x1d')],function(_0xdcc72d){return{'model':db[_0xdcc72d[_0xf7b1('0x1f')]],'as':_0xdcc72d['as'],'attributes':_0xdcc72d[_0xf7b1('0x1b')],'include':_0xdcc72d[_0xf7b1('0x1d')]?_['map'](_0xdcc72d[_0xf7b1('0x1d')],function(_0x330173){return{'model':db[_0x330173['model']],'as':_0x330173['as'],'attributes':_0x330173[_0xf7b1('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x50b720){logger['info'](_0xf7b1('0x17'),_0x2b3422);logger['debug'](_0xf7b1('0x17'),_0x2b3422,JSON['stringify'](_0x50b720));_0x59b410(_0x50b720);})[_0xf7b1('0x16')](function(_0xc2bbda){logger[_0xf7b1('0x11')](_0xf7b1('0x17'),_0xc2bbda['message'],_0x2b3422);_0x32d38e(_0xa115cd['error'](0x1f4,_0xc2bbda[_0xf7b1('0x13')]));});});};exports[_0xf7b1('0x20')]=function(_0x1c7d86){var _0x5aa33e=this;return new Promise(function(_0x30cf61,_0x41a547){return db[_0xf7b1('0x18')][_0xf7b1('0x21')](_0x1c7d86[_0xf7b1('0x22')],{'raw':_0x1c7d86[_0xf7b1('0x19')]?_0x1c7d86[_0xf7b1('0x19')][_0xf7b1('0x23')]===undefined?!![]:![]:!![]})[_0xf7b1('0xb')](function(_0x592c34){logger[_0xf7b1('0x14')](_0xf7b1('0x20'),_0x1c7d86);logger[_0xf7b1('0xe')](_0xf7b1('0x20'),_0x1c7d86,JSON['stringify'](_0x592c34));_0x30cf61(_0x592c34);})['catch'](function(_0x39d243){logger[_0xf7b1('0x11')](_0xf7b1('0x20'),_0x39d243[_0xf7b1('0x13')],_0x1c7d86);_0x41a547(_0x5aa33e[_0xf7b1('0x11')](0x1f4,_0x39d243[_0xf7b1('0x13')]));});});};exports[_0xf7b1('0x24')]=function(_0x3f9707){var _0x2ce5c6=this;return new Promise(function(_0x4e88fa,_0xd445c8){return db[_0xf7b1('0x18')][_0xf7b1('0x25')](_0x3f9707[_0xf7b1('0x22')],{'raw':_0x3f9707['options']?_0x3f9707['options'][_0xf7b1('0x23')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3f9707[_0xf7b1('0x19')]?_0x3f9707['options'][_0xf7b1('0x1a')]||null:null,'attributes':_0x3f9707[_0xf7b1('0x19')]?_0x3f9707[_0xf7b1('0x19')][_0xf7b1('0x1b')]||null:null,'limit':_0x3f9707[_0xf7b1('0x19')]?_0x3f9707[_0xf7b1('0x19')]['limit']||null:null})['then'](function(_0x48b40d){logger[_0xf7b1('0x14')]('UpdateVoiceCallReport',_0x3f9707);logger[_0xf7b1('0xe')](_0xf7b1('0x24'),_0x3f9707,JSON['stringify'](_0x48b40d));_0x4e88fa(_0x48b40d);})['catch'](function(_0x560657){logger[_0xf7b1('0x11')]('UpdateVoiceCallReport',_0x560657[_0xf7b1('0x13')],_0x3f9707);_0xd445c8(_0x2ce5c6[_0xf7b1('0x11')](0x1f4,_0x560657[_0xf7b1('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 06bf199..caf482e 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 _0x88df=['../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','get','isAuthenticated','index','/:id','show','post','create','put','destroy','exports','multer','util','path','../../components/auth/service'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0x88df,0x10c));var _0xf88d=function(_0x457771,_0x5a7007){_0x457771=_0x457771-0x0;var _0x5f104e=_0x88df[_0x457771];return _0x5f104e;};'use strict';var multer=require(_0xf88d('0x0'));var util=require(_0xf88d('0x1'));var path=require(_0xf88d('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0xf88d('0x3'));var interaction=require(_0xf88d('0x4'));var config=require(_0xf88d('0x5'));var controller=require(_0xf88d('0x6'));router[_0xf88d('0x7')]('/',auth[_0xf88d('0x8')](),controller[_0xf88d('0x9')]);router[_0xf88d('0x7')](_0xf88d('0xa'),auth[_0xf88d('0x8')](),controller[_0xf88d('0xb')]);router[_0xf88d('0xc')]('/',auth['isAuthenticated'](),controller[_0xf88d('0xd')]);router[_0xf88d('0xe')](_0xf88d('0xa'),auth[_0xf88d('0x8')](),controller['update']);router['delete'](_0xf88d('0xa'),auth[_0xf88d('0x8')](),controller[_0xf88d('0xf')]);module[_0xf88d('0x10')]=router; \ No newline at end of file +var _0xd187=['./voiceChanSpy.controller','get','isAuthenticated','/:id','show','post','create','put','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x7976f8,_0x4409e0){var _0x3fa9a2=function(_0x3867c2){while(--_0x3867c2){_0x7976f8['push'](_0x7976f8['shift']());}};_0x3fa9a2(++_0x4409e0);}(_0xd187,0x90));var _0x7d18=function(_0x1a4748,_0x40c46e){_0x1a4748=_0x1a4748-0x0;var _0x28ca99=_0xd187[_0x1a4748];return _0x28ca99;};'use strict';var multer=require(_0x7d18('0x0'));var util=require(_0x7d18('0x1'));var path=require(_0x7d18('0x2'));var timeout=require('connect-timeout');var express=require(_0x7d18('0x3'));var router=express[_0x7d18('0x4')]();var auth=require(_0x7d18('0x5'));var interaction=require(_0x7d18('0x6'));var config=require(_0x7d18('0x7'));var controller=require(_0x7d18('0x8'));router[_0x7d18('0x9')]('/',auth[_0x7d18('0xa')](),controller['index']);router[_0x7d18('0x9')](_0x7d18('0xb'),auth['isAuthenticated'](),controller[_0x7d18('0xc')]);router[_0x7d18('0xd')]('/',auth[_0x7d18('0xa')](),controller[_0x7d18('0xe')]);router[_0x7d18('0xf')]('/:id',auth[_0x7d18('0xa')](),controller['update']);router[_0x7d18('0x10')](_0x7d18('0xb'),auth[_0x7d18('0xa')](),controller[_0x7d18('0x11')]);module[_0x7d18('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index 206e3b1..e34a7b7 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 _0x9134=['exports','STRING','name','setDataValue','options','join','getDataValue','split','BOOLEAN'];(function(_0x31d0c1,_0x58ce88){var _0x549610=function(_0x2d4240){while(--_0x2d4240){_0x31d0c1['push'](_0x31d0c1['shift']());}};_0x549610(++_0x58ce88);}(_0x9134,0x87));var _0x4913=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9134[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require('sequelize');module[_0x4913('0x0')]={'name':{'type':Sequelize[_0x4913('0x1')]},'prefix':{'type':Sequelize[_0x4913('0x1')],'unique':_0x4913('0x2'),'allowNull':![]},'options':{'type':Sequelize['STRING'],'set':function(_0x4d4f31){this[_0x4913('0x3')](_0x4913('0x4'),_0x4d4f31?_0x4d4f31[_0x4913('0x5')](''):[]);},'get':function(){return this[_0x4913('0x6')](_0x4913('0x4'))?this[_0x4913('0x6')]('options')[_0x4913('0x7')](''):[];}},'auth':{'type':Sequelize[_0x4913('0x8')],'defaultValue':![]},'password':{'type':Sequelize[_0x4913('0x1')]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x4913('0x1')]},'description':{'type':Sequelize[_0x4913('0x1')]}}; \ No newline at end of file +var _0x1e9d=['options','split','BOOLEAN','sequelize','STRING','name'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x1e9d,0x1dd));var _0xd1e9=function(_0x1a481b,_0x52c640){_0x1a481b=_0x1a481b-0x0;var _0x3d10ce=_0x1e9d[_0x1a481b];return _0x3d10ce;};'use strict';var Sequelize=require(_0xd1e9('0x0'));module['exports']={'name':{'type':Sequelize[_0xd1e9('0x1')]},'prefix':{'type':Sequelize[_0xd1e9('0x1')],'unique':_0xd1e9('0x2'),'allowNull':![]},'options':{'type':Sequelize[_0xd1e9('0x1')],'set':function(_0x42e387){this['setDataValue'](_0xd1e9('0x3'),_0x42e387?_0x42e387['join'](''):[]);},'get':function(){return this['getDataValue']('options')?this['getDataValue']('options')[_0xd1e9('0x4')](''):[];}},'auth':{'type':Sequelize[_0xd1e9('0x5')],'defaultValue':![]},'password':{'type':Sequelize[_0xd1e9('0x1')]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0xd1e9('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index 23a5fc7..db8be6e 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 _0x7dc6=['find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../mysqldb','sendStatus','status','json','count','offset','limit','set','apply','reject','save','update','then','destroy','get','ChanSpies','UserProfileResource','error','name','send','index','map','VoiceChanSpy','key','query','keys','filters','intersection','model','attributes','fields','nolimit','order','where','pick','filter','type','merge','options','includeAll','findAll','rows','params','rawAttributes'];(function(_0x285957,_0x56620b){var _0x2c9d9a=function(_0x494d1c){while(--_0x494d1c){_0x285957['push'](_0x285957['shift']());}};_0x2c9d9a(++_0x56620b);}(_0x7dc6,0xed));var _0x67dc=function(_0x291ae6,_0x416d09){_0x291ae6=_0x291ae6-0x0;var _0x1222dc=_0x7dc6[_0x291ae6];return _0x1222dc;};'use strict';var pdf=require(_0x67dc('0x0'));var emlformat=require(_0x67dc('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x67dc('0x2'));var jsonpatch=require(_0x67dc('0x3'));var rp=require('request-promise');var moment=require(_0x67dc('0x4'));var BPromise=require(_0x67dc('0x5'));var Mustache=require(_0x67dc('0x6'));var util=require(_0x67dc('0x7'));var path=require(_0x67dc('0x8'));var sox=require(_0x67dc('0x9'));var csv=require(_0x67dc('0xa'));var ejs=require(_0x67dc('0xb'));var fs=require('fs');var _=require(_0x67dc('0xc'));var squel=require(_0x67dc('0xd'));var crypto=require(_0x67dc('0xe'));var jsforce=require(_0x67dc('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x67dc('0xa'));var querystring=require(_0x67dc('0x10'));var Papa=require(_0x67dc('0x11'));var Redis=require('ioredis');var authService=require(_0x67dc('0x12'));var qs=require(_0x67dc('0x13'));var as=require(_0x67dc('0x14'));var hardwareService=require(_0x67dc('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x67dc('0x16'));var config=require('../../config/environment');var db=require(_0x67dc('0x17'))['db'];function respondWithStatusCode(_0x1e63e9,_0x4bde84){_0x4bde84=_0x4bde84||0xcc;return function(_0x5d9b87){if(_0x5d9b87){return _0x1e63e9[_0x67dc('0x18')](_0x4bde84);}return _0x1e63e9['status'](_0x4bde84)['end']();};}function respondWithResult(_0x141366,_0x2d5d1d){_0x2d5d1d=_0x2d5d1d||0xc8;return function(_0x4c1f51){if(_0x4c1f51){return _0x141366[_0x67dc('0x19')](_0x2d5d1d)[_0x67dc('0x1a')](_0x4c1f51);}};}function respondWithFilteredResult(_0x199289,_0x26e2ef){return function(_0x1ff29b){if(_0x1ff29b){var _0x25fb65=_0x1ff29b[_0x67dc('0x1b')],_0x2da064=_0x26e2ef[_0x67dc('0x1c')],_0x12a0a1=_0x26e2ef[_0x67dc('0x1c')]+_0x26e2ef[_0x67dc('0x1d')],_0x394b90;if(_0x12a0a1>=_0x25fb65){_0x12a0a1=_0x25fb65;_0x394b90=0xc8;}else{_0x394b90=0xce;}_0x199289['status'](_0x394b90);return _0x199289[_0x67dc('0x1e')]('Content-Range',_0x2da064+'-'+_0x12a0a1+'/'+_0x25fb65)[_0x67dc('0x1a')](_0x1ff29b);}return null;};}function patchUpdates(_0x549ce8){return function(_0x42ce12){try{jsonpatch[_0x67dc('0x1f')](_0x42ce12,_0x549ce8,!![]);}catch(_0x356643){return BPromise[_0x67dc('0x20')](_0x356643);}return _0x42ce12[_0x67dc('0x21')]();};}function saveUpdates(_0x520d27,_0x59983a){return function(_0x4aee97){if(_0x4aee97){return _0x4aee97[_0x67dc('0x22')](_0x520d27)[_0x67dc('0x23')](function(_0x1669ad){return _0x1669ad;});}return null;};}function removeEntity(_0x37d131,_0x3129fd){return function(_0x8c0a6f){if(_0x8c0a6f){return _0x8c0a6f[_0x67dc('0x24')]()[_0x67dc('0x23')](function(){var _0x14ea6a=_0x8c0a6f[_0x67dc('0x25')]({'plain':!![]});var _0x1d5011=_0x67dc('0x26');return db[_0x67dc('0x27')]['destroy']({'where':{'type':_0x1d5011,'resourceId':_0x14ea6a['id']}})[_0x67dc('0x23')](function(){return _0x8c0a6f;});})[_0x67dc('0x23')](function(){_0x37d131['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4fe774,_0x397019){return function(_0x3e8752){if(!_0x3e8752){_0x4fe774['sendStatus'](0x194);}return _0x3e8752;};}function handleError(_0x8652e3,_0x5d7563){_0x5d7563=_0x5d7563||0x1f4;return function(_0x23b65f){logger[_0x67dc('0x28')](_0x23b65f['stack']);if(_0x23b65f[_0x67dc('0x29')]){delete _0x23b65f[_0x67dc('0x29')];}_0x8652e3[_0x67dc('0x19')](_0x5d7563)[_0x67dc('0x2a')](_0x23b65f);};}exports[_0x67dc('0x2b')]=function(_0x5ce4b2,_0x12fe6c){var _0x1e2fcd={},_0x3f3dc0={},_0x295682={'count':0x0,'rows':[]};var _0x23ea74=_[_0x67dc('0x2c')](db[_0x67dc('0x2d')]['rawAttributes'],function(_0x542087){return{'name':_0x542087['fieldName'],'type':_0x542087['type'][_0x67dc('0x2e')]};});_0x3f3dc0['model']=_[_0x67dc('0x2c')](_0x23ea74,_0x67dc('0x29'));_0x3f3dc0[_0x67dc('0x2f')]=_[_0x67dc('0x30')](_0x5ce4b2['query']);_0x3f3dc0[_0x67dc('0x31')]=_[_0x67dc('0x32')](_0x3f3dc0[_0x67dc('0x33')],_0x3f3dc0[_0x67dc('0x2f')]);_0x1e2fcd[_0x67dc('0x34')]=_[_0x67dc('0x32')](_0x3f3dc0['model'],qs[_0x67dc('0x35')](_0x5ce4b2[_0x67dc('0x2f')][_0x67dc('0x35')]));_0x1e2fcd[_0x67dc('0x34')]=_0x1e2fcd[_0x67dc('0x34')]['length']?_0x1e2fcd[_0x67dc('0x34')]:_0x3f3dc0[_0x67dc('0x33')];if(!_0x5ce4b2[_0x67dc('0x2f')]['hasOwnProperty'](_0x67dc('0x36'))){_0x1e2fcd[_0x67dc('0x1d')]=qs['limit'](_0x5ce4b2[_0x67dc('0x2f')][_0x67dc('0x1d')]);_0x1e2fcd[_0x67dc('0x1c')]=qs[_0x67dc('0x1c')](_0x5ce4b2[_0x67dc('0x2f')][_0x67dc('0x1c')]);}_0x1e2fcd[_0x67dc('0x37')]=qs['sort'](_0x5ce4b2[_0x67dc('0x2f')]['sort']);_0x1e2fcd[_0x67dc('0x38')]=qs['filters'](_[_0x67dc('0x39')](_0x5ce4b2[_0x67dc('0x2f')],_0x3f3dc0[_0x67dc('0x31')]));if(_0x5ce4b2[_0x67dc('0x2f')][_0x67dc('0x3a')]){_0x1e2fcd[_0x67dc('0x38')]=_['merge'](_0x1e2fcd['where'],{'$or':_[_0x67dc('0x2c')](_0x23ea74,function(_0x179d64){if(_0x179d64[_0x67dc('0x3b')]!=='VIRTUAL'){var _0x1b638f={};_0x1b638f[_0x179d64['name']]={'$like':'%'+_0x5ce4b2[_0x67dc('0x2f')][_0x67dc('0x3a')]+'%'};return _0x1b638f;}})});}_0x1e2fcd=_[_0x67dc('0x3c')]({},_0x1e2fcd,_0x5ce4b2[_0x67dc('0x3d')]);var _0x39b925={'where':_0x1e2fcd['where']};return db[_0x67dc('0x2d')][_0x67dc('0x1b')](_0x39b925)[_0x67dc('0x23')](function(_0x2cbfed){_0x295682[_0x67dc('0x1b')]=_0x2cbfed;if(_0x5ce4b2['query'][_0x67dc('0x3e')]){_0x1e2fcd['include']=[{'all':!![]}];}return db['VoiceChanSpy'][_0x67dc('0x3f')](_0x1e2fcd);})['then'](function(_0x594789){_0x295682[_0x67dc('0x40')]=_0x594789;return _0x295682;})[_0x67dc('0x23')](respondWithFilteredResult(_0x12fe6c,_0x1e2fcd))['catch'](handleError(_0x12fe6c,null));};exports['show']=function(_0x1f9cd1,_0x5355eb){var _0x275106={'raw':![],'where':{'id':_0x1f9cd1[_0x67dc('0x41')]['id']}},_0x11b2ca={};_0x11b2ca[_0x67dc('0x33')]=_['keys'](db[_0x67dc('0x2d')][_0x67dc('0x42')]);_0x11b2ca['query']=_['keys'](_0x1f9cd1['query']);_0x11b2ca[_0x67dc('0x31')]=_[_0x67dc('0x32')](_0x11b2ca[_0x67dc('0x33')],_0x11b2ca[_0x67dc('0x2f')]);_0x275106[_0x67dc('0x34')]=_['intersection'](_0x11b2ca[_0x67dc('0x33')],qs[_0x67dc('0x35')](_0x1f9cd1['query']['fields']));_0x275106[_0x67dc('0x34')]=_0x275106['attributes']['length']?_0x275106['attributes']:_0x11b2ca[_0x67dc('0x33')];if(_0x1f9cd1[_0x67dc('0x2f')][_0x67dc('0x3e')]){_0x275106['include']=[{'all':!![]}];}_0x275106=_['merge']({},_0x275106,_0x1f9cd1[_0x67dc('0x3d')]);return db['VoiceChanSpy'][_0x67dc('0x43')](_0x275106)[_0x67dc('0x23')](handleEntityNotFound(_0x5355eb,null))['then'](respondWithResult(_0x5355eb,null))[_0x67dc('0x44')](handleError(_0x5355eb,null));};exports['create']=function(_0x368685,_0x14373c){return db['VoiceChanSpy'][_0x67dc('0x45')](_0x368685[_0x67dc('0x46')],{})[_0x67dc('0x23')](function(_0x321ee5){var _0x4f27a2=_0x368685[_0x67dc('0x47')][_0x67dc('0x25')]({'plain':!![]});if(!_0x4f27a2)throw new Error(_0x67dc('0x48'));if(_0x4f27a2[_0x67dc('0x49')]===_0x67dc('0x47')){var _0x1a0d5d=_0x321ee5[_0x67dc('0x25')]({'plain':!![]});var _0x1eaa4d='ChanSpies';return db[_0x67dc('0x4a')][_0x67dc('0x43')]({'where':{'name':_0x1eaa4d,'userProfileId':_0x4f27a2[_0x67dc('0x4b')]},'raw':!![]})[_0x67dc('0x23')](function(_0x4ccf4d){if(_0x4ccf4d&&_0x4ccf4d['autoAssociation']===0x0){return db[_0x67dc('0x27')][_0x67dc('0x45')]({'name':_0x1a0d5d[_0x67dc('0x29')],'resourceId':_0x1a0d5d['id'],'type':_0x4ccf4d[_0x67dc('0x29')],'sectionId':_0x4ccf4d['id']},{})[_0x67dc('0x23')](function(){return _0x321ee5;});}else{return _0x321ee5;}})[_0x67dc('0x44')](function(_0x3473cf){logger[_0x67dc('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3473cf);throw _0x3473cf;});}return _0x321ee5;})[_0x67dc('0x23')](respondWithResult(_0x14373c,0xc9))[_0x67dc('0x44')](handleError(_0x14373c,null));};exports[_0x67dc('0x22')]=function(_0x67f2ec,_0x5df8cd){if(_0x67f2ec[_0x67dc('0x46')]['id']){delete _0x67f2ec['body']['id'];}return db[_0x67dc('0x2d')][_0x67dc('0x43')]({'where':{'id':_0x67f2ec[_0x67dc('0x41')]['id']}})[_0x67dc('0x23')](handleEntityNotFound(_0x5df8cd,null))[_0x67dc('0x23')](saveUpdates(_0x67f2ec['body'],null))[_0x67dc('0x23')](respondWithResult(_0x5df8cd,null))[_0x67dc('0x44')](handleError(_0x5df8cd,null));};exports[_0x67dc('0x24')]=function(_0x2fc27b,_0x4a4d75){return db[_0x67dc('0x2d')][_0x67dc('0x43')]({'where':{'id':_0x2fc27b[_0x67dc('0x41')]['id']}})[_0x67dc('0x23')](handleEntityNotFound(_0x4a4d75,null))[_0x67dc('0x23')](removeEntity(_0x4a4d75,null))['catch'](handleError(_0x4a4d75,null));}; \ No newline at end of file +var _0xfdc3=['include','rows','catch','show','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','then','destroy','get','ChanSpies','UserProfileResource','end','error','stack','name','index','map','VoiceChanSpy','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','type','VIRTUAL','options','includeAll'];(function(_0x50fa63,_0x269a73){var _0x3f3b1c=function(_0x33a6a6){while(--_0x33a6a6){_0x50fa63['push'](_0x50fa63['shift']());}};_0x3f3b1c(++_0x269a73);}(_0xfdc3,0x168));var _0x3fdc=function(_0x395c05,_0x236b0f){_0x395c05=_0x395c05-0x0;var _0x5751fa=_0xfdc3[_0x395c05];return _0x5751fa;};'use strict';var pdf=require(_0x3fdc('0x0'));var emlformat=require(_0x3fdc('0x1'));var rimraf=require(_0x3fdc('0x2'));var zipdir=require(_0x3fdc('0x3'));var jsonpatch=require(_0x3fdc('0x4'));var rp=require(_0x3fdc('0x5'));var moment=require(_0x3fdc('0x6'));var BPromise=require(_0x3fdc('0x7'));var Mustache=require('mustache');var util=require(_0x3fdc('0x8'));var path=require(_0x3fdc('0x9'));var sox=require('sox');var csv=require(_0x3fdc('0xa'));var ejs=require(_0x3fdc('0xb'));var fs=require('fs');var _=require(_0x3fdc('0xc'));var squel=require(_0x3fdc('0xd'));var crypto=require(_0x3fdc('0xe'));var jsforce=require(_0x3fdc('0xf'));var deskjs=require(_0x3fdc('0x10'));var toCsv=require(_0x3fdc('0xa'));var querystring=require('querystring');var Papa=require(_0x3fdc('0x11'));var Redis=require(_0x3fdc('0x12'));var authService=require(_0x3fdc('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x3fdc('0x14'));var hardwareService=require(_0x3fdc('0x15'));var logger=require(_0x3fdc('0x16'))(_0x3fdc('0x17'));var utils=require(_0x3fdc('0x18'));var config=require(_0x3fdc('0x19'));var db=require(_0x3fdc('0x1a'))['db'];function respondWithStatusCode(_0x5e8e59,_0x5eba51){_0x5eba51=_0x5eba51||0xcc;return function(_0x5d9c7d){if(_0x5d9c7d){return _0x5e8e59[_0x3fdc('0x1b')](_0x5eba51);}return _0x5e8e59[_0x3fdc('0x1c')](_0x5eba51)['end']();};}function respondWithResult(_0x1da2b1,_0x207d61){_0x207d61=_0x207d61||0xc8;return function(_0x5cfcb3){if(_0x5cfcb3){return _0x1da2b1[_0x3fdc('0x1c')](_0x207d61)[_0x3fdc('0x1d')](_0x5cfcb3);}};}function respondWithFilteredResult(_0x597976,_0x59dcd7){return function(_0x58145a){if(_0x58145a){var _0xf46936=_0x58145a[_0x3fdc('0x1e')],_0x66da13=_0x59dcd7[_0x3fdc('0x1f')],_0x5ac762=_0x59dcd7[_0x3fdc('0x1f')]+_0x59dcd7[_0x3fdc('0x20')],_0x1867fd;if(_0x5ac762>=_0xf46936){_0x5ac762=_0xf46936;_0x1867fd=0xc8;}else{_0x1867fd=0xce;}_0x597976[_0x3fdc('0x1c')](_0x1867fd);return _0x597976[_0x3fdc('0x21')](_0x3fdc('0x22'),_0x66da13+'-'+_0x5ac762+'/'+_0xf46936)[_0x3fdc('0x1d')](_0x58145a);}return null;};}function patchUpdates(_0x290095){return function(_0x39bc7e){try{jsonpatch[_0x3fdc('0x23')](_0x39bc7e,_0x290095,!![]);}catch(_0x397ebd){return BPromise[_0x3fdc('0x24')](_0x397ebd);}return _0x39bc7e['save']();};}function saveUpdates(_0x200922,_0x324ef6){return function(_0x17d07e){if(_0x17d07e){return _0x17d07e['update'](_0x200922)[_0x3fdc('0x25')](function(_0x2a639f){return _0x2a639f;});}return null;};}function removeEntity(_0x2fe360,_0x2080ee){return function(_0x19faee){if(_0x19faee){return _0x19faee[_0x3fdc('0x26')]()['then'](function(){var _0x1fb469=_0x19faee[_0x3fdc('0x27')]({'plain':!![]});var _0x267310=_0x3fdc('0x28');return db[_0x3fdc('0x29')][_0x3fdc('0x26')]({'where':{'type':_0x267310,'resourceId':_0x1fb469['id']}})[_0x3fdc('0x25')](function(){return _0x19faee;});})[_0x3fdc('0x25')](function(){_0x2fe360[_0x3fdc('0x1c')](0xcc)[_0x3fdc('0x2a')]();});}};}function handleEntityNotFound(_0x4496eb,_0x1eb5b3){return function(_0x1153df){if(!_0x1153df){_0x4496eb['sendStatus'](0x194);}return _0x1153df;};}function handleError(_0x123afa,_0x39d88a){_0x39d88a=_0x39d88a||0x1f4;return function(_0x3fc3d9){logger[_0x3fdc('0x2b')](_0x3fc3d9[_0x3fdc('0x2c')]);if(_0x3fc3d9[_0x3fdc('0x2d')]){delete _0x3fc3d9['name'];}_0x123afa[_0x3fdc('0x1c')](_0x39d88a)['send'](_0x3fc3d9);};}exports[_0x3fdc('0x2e')]=function(_0x11df51,_0x30fe96){var _0x57d143={},_0x2cd816={},_0x53191b={'count':0x0,'rows':[]};var _0x3f95d4=_[_0x3fdc('0x2f')](db[_0x3fdc('0x30')][_0x3fdc('0x31')],function(_0x240ff7){return{'name':_0x240ff7[_0x3fdc('0x32')],'type':_0x240ff7['type'][_0x3fdc('0x33')]};});_0x2cd816[_0x3fdc('0x34')]=_[_0x3fdc('0x2f')](_0x3f95d4,_0x3fdc('0x2d'));_0x2cd816[_0x3fdc('0x35')]=_[_0x3fdc('0x36')](_0x11df51[_0x3fdc('0x35')]);_0x2cd816['filters']=_[_0x3fdc('0x37')](_0x2cd816[_0x3fdc('0x34')],_0x2cd816[_0x3fdc('0x35')]);_0x57d143[_0x3fdc('0x38')]=_[_0x3fdc('0x37')](_0x2cd816[_0x3fdc('0x34')],qs[_0x3fdc('0x39')](_0x11df51[_0x3fdc('0x35')][_0x3fdc('0x39')]));_0x57d143[_0x3fdc('0x38')]=_0x57d143[_0x3fdc('0x38')]['length']?_0x57d143[_0x3fdc('0x38')]:_0x2cd816['model'];if(!_0x11df51[_0x3fdc('0x35')][_0x3fdc('0x3a')](_0x3fdc('0x3b'))){_0x57d143[_0x3fdc('0x20')]=qs[_0x3fdc('0x20')](_0x11df51[_0x3fdc('0x35')][_0x3fdc('0x20')]);_0x57d143[_0x3fdc('0x1f')]=qs[_0x3fdc('0x1f')](_0x11df51[_0x3fdc('0x35')][_0x3fdc('0x1f')]);}_0x57d143[_0x3fdc('0x3c')]=qs['sort'](_0x11df51[_0x3fdc('0x35')][_0x3fdc('0x3d')]);_0x57d143[_0x3fdc('0x3e')]=qs[_0x3fdc('0x3f')](_[_0x3fdc('0x40')](_0x11df51[_0x3fdc('0x35')],_0x2cd816[_0x3fdc('0x3f')]));if(_0x11df51[_0x3fdc('0x35')]['filter']){_0x57d143[_0x3fdc('0x3e')]=_[_0x3fdc('0x41')](_0x57d143[_0x3fdc('0x3e')],{'$or':_[_0x3fdc('0x2f')](_0x3f95d4,function(_0x3e08ef){if(_0x3e08ef[_0x3fdc('0x42')]!==_0x3fdc('0x43')){var _0x3fc603={};_0x3fc603[_0x3e08ef[_0x3fdc('0x2d')]]={'$like':'%'+_0x11df51[_0x3fdc('0x35')]['filter']+'%'};return _0x3fc603;}})});}_0x57d143=_[_0x3fdc('0x41')]({},_0x57d143,_0x11df51[_0x3fdc('0x44')]);var _0x22d9df={'where':_0x57d143[_0x3fdc('0x3e')]};return db['VoiceChanSpy'][_0x3fdc('0x1e')](_0x22d9df)[_0x3fdc('0x25')](function(_0x1cb10d){_0x53191b['count']=_0x1cb10d;if(_0x11df51['query'][_0x3fdc('0x45')]){_0x57d143[_0x3fdc('0x46')]=[{'all':!![]}];}return db[_0x3fdc('0x30')]['findAll'](_0x57d143);})[_0x3fdc('0x25')](function(_0x4f06c6){_0x53191b[_0x3fdc('0x47')]=_0x4f06c6;return _0x53191b;})[_0x3fdc('0x25')](respondWithFilteredResult(_0x30fe96,_0x57d143))[_0x3fdc('0x48')](handleError(_0x30fe96,null));};exports[_0x3fdc('0x49')]=function(_0x237f90,_0x25e8ea){var _0x58d896={'raw':![],'where':{'id':_0x237f90['params']['id']}},_0x28cc65={};_0x28cc65[_0x3fdc('0x34')]=_[_0x3fdc('0x36')](db[_0x3fdc('0x30')][_0x3fdc('0x31')]);_0x28cc65['query']=_[_0x3fdc('0x36')](_0x237f90[_0x3fdc('0x35')]);_0x28cc65[_0x3fdc('0x3f')]=_[_0x3fdc('0x37')](_0x28cc65[_0x3fdc('0x34')],_0x28cc65[_0x3fdc('0x35')]);_0x58d896[_0x3fdc('0x38')]=_['intersection'](_0x28cc65[_0x3fdc('0x34')],qs[_0x3fdc('0x39')](_0x237f90[_0x3fdc('0x35')][_0x3fdc('0x39')]));_0x58d896[_0x3fdc('0x38')]=_0x58d896[_0x3fdc('0x38')]['length']?_0x58d896[_0x3fdc('0x38')]:_0x28cc65[_0x3fdc('0x34')];if(_0x237f90[_0x3fdc('0x35')][_0x3fdc('0x45')]){_0x58d896[_0x3fdc('0x46')]=[{'all':!![]}];}_0x58d896=_[_0x3fdc('0x41')]({},_0x58d896,_0x237f90[_0x3fdc('0x44')]);return db['VoiceChanSpy'][_0x3fdc('0x4a')](_0x58d896)['then'](handleEntityNotFound(_0x25e8ea,null))[_0x3fdc('0x25')](respondWithResult(_0x25e8ea,null))[_0x3fdc('0x48')](handleError(_0x25e8ea,null));};exports[_0x3fdc('0x4b')]=function(_0x94b98e,_0x362d2c){return db[_0x3fdc('0x30')][_0x3fdc('0x4b')](_0x94b98e[_0x3fdc('0x4c')],{})[_0x3fdc('0x25')](function(_0x942c7c){var _0x59b5d7=_0x94b98e[_0x3fdc('0x4d')]['get']({'plain':!![]});if(!_0x59b5d7)throw new Error(_0x3fdc('0x4e'));if(_0x59b5d7[_0x3fdc('0x4f')]==='user'){var _0x5ccafc=_0x942c7c[_0x3fdc('0x27')]({'plain':!![]});var _0x3471a9='ChanSpies';return db[_0x3fdc('0x50')]['find']({'where':{'name':_0x3471a9,'userProfileId':_0x59b5d7[_0x3fdc('0x51')]},'raw':!![]})[_0x3fdc('0x25')](function(_0x380f7d){if(_0x380f7d&&_0x380f7d[_0x3fdc('0x52')]===0x0){return db[_0x3fdc('0x29')][_0x3fdc('0x4b')]({'name':_0x5ccafc[_0x3fdc('0x2d')],'resourceId':_0x5ccafc['id'],'type':_0x380f7d['name'],'sectionId':_0x380f7d['id']},{})[_0x3fdc('0x25')](function(){return _0x942c7c;});}else{return _0x942c7c;}})['catch'](function(_0x505792){logger[_0x3fdc('0x2b')](_0x3fdc('0x53'),_0x505792);throw _0x505792;});}return _0x942c7c;})[_0x3fdc('0x25')](respondWithResult(_0x362d2c,0xc9))[_0x3fdc('0x48')](handleError(_0x362d2c,null));};exports[_0x3fdc('0x54')]=function(_0x2937dc,_0x1db7d8){if(_0x2937dc['body']['id']){delete _0x2937dc[_0x3fdc('0x4c')]['id'];}return db['VoiceChanSpy'][_0x3fdc('0x4a')]({'where':{'id':_0x2937dc[_0x3fdc('0x55')]['id']}})[_0x3fdc('0x25')](handleEntityNotFound(_0x1db7d8,null))['then'](saveUpdates(_0x2937dc[_0x3fdc('0x4c')],null))[_0x3fdc('0x25')](respondWithResult(_0x1db7d8,null))[_0x3fdc('0x48')](handleError(_0x1db7d8,null));};exports[_0x3fdc('0x26')]=function(_0x331a93,_0x34d117){return db[_0x3fdc('0x30')][_0x3fdc('0x4a')]({'where':{'id':_0x331a93['params']['id']}})['then'](handleEntityNotFound(_0x34d117,null))[_0x3fdc('0x25')](removeEntity(_0x34d117,null))[_0x3fdc('0x48')](handleError(_0x34d117,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index c945205..b957009 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 _0x5ebb=['MixMonitor','recordingFormat','auth','password','ChanSpy','SIP/%s,%s','options','join','length','concat','internal','name','findAll','catch','exports','models','define','VoiceChanSpy','voice_chanspy','then','bulkCreate','VoiceExtension','destroy','lodash','util','./voiceChanSpy.attributes','context','from-sip','format','%s%s','prefix','system','push','merge','Set','chanspy','record'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5ebb,0xf5));var _0xb5eb=function(_0x317412,_0xd00b08){_0x317412=_0x317412-0x0;var _0x904316=_0x5ebb[_0x317412];return _0x904316;};'use strict';var _=require(_0xb5eb('0x0'));var util=require(_0xb5eb('0x1'));var BPromise=require('bluebird');var attributes=require(_0xb5eb('0x2'));var getUserApplications=function(_0x2cd629,_0x325332,_0x3bdfb6){var _0x5f5342=0x1;var _0x518cc4=[];var _0x5d1dd1={'context':_0x325332[_0xb5eb('0x3')]||_0xb5eb('0x4'),'exten':util[_0xb5eb('0x5')](_0xb5eb('0x6'),_0x2cd629[_0xb5eb('0x7')],_0x3bdfb6),'type':_0xb5eb('0x8'),'isApp':![],'ChanSpyId':_0x2cd629['id'],'UserId':_0x325332['id']};_0x518cc4[_0xb5eb('0x9')](_[_0xb5eb('0xa')]({'app':_0xb5eb('0xb'),'appdata':util[_0xb5eb('0x5')]('CDR(type)=%s',_0xb5eb('0xc')),'priority':_0x5f5342++},_0x5d1dd1));if(_0x2cd629[_0xb5eb('0xd')]){_0x518cc4['push'](_[_0xb5eb('0xa')]({'app':_0xb5eb('0xe'),'appdata':util[_0xb5eb('0x5')]('${UNIQUEID}.%s,ab',_0x2cd629[_0xb5eb('0xf')]),'priority':_0x5f5342++},_0x5d1dd1));}if(_0x2cd629[_0xb5eb('0x10')]){_0x518cc4[_0xb5eb('0x9')](_[_0xb5eb('0xa')]({'app':'Authenticate','appdata':_0x2cd629[_0xb5eb('0x11')],'priority':_0x5f5342++},_0x5d1dd1));}_0x518cc4[_0xb5eb('0x9')](_['merge']({'app':_0xb5eb('0x12'),'appdata':util[_0xb5eb('0x5')](_0xb5eb('0x13'),_0x325332['name'],_0x2cd629[_0xb5eb('0x14')]?_0x2cd629['options'][_0xb5eb('0x15')](''):''),'priority':_0x5f5342++},_0x5d1dd1));if(_0x2cd629[_0xb5eb('0xd')]){_0x518cc4['push'](_[_0xb5eb('0xa')]({'app':'StopMixMonitor','priority':_0x5f5342++},_0x5d1dd1));}return _0x518cc4;};var getChanSpyApplications=function(_0x495cfb,_0x2b00d8){var _0x438e6b=[];for(var _0x4e2aee=0x0,_0x57981f=0x1;_0x4e2aee<_0x2b00d8[_0xb5eb('0x16')];_0x4e2aee++,_0x57981f=0x1){_0x438e6b=_0x438e6b[_0xb5eb('0x17')](getUserApplications(_0x495cfb,_0x2b00d8[_0x4e2aee],_0x2b00d8[_0x4e2aee][_0xb5eb('0x18')]));if(_0x2b00d8[_0x4e2aee][_0xb5eb('0x18')]!=_0x2b00d8[_0x4e2aee][_0xb5eb('0x19')]){_0x438e6b=_0x438e6b[_0xb5eb('0x17')](getUserApplications(_0x495cfb,_0x2b00d8[_0x4e2aee],_0x2b00d8[_0x4e2aee][_0xb5eb('0x19')]));}}return _0x438e6b;};var getChanSpyPromise=function(_0xc4e814,_0x1db3bd){return new BPromise(function(_0x592df9,_0x17edb0){return _0xc4e814['User'][_0xb5eb('0x1a')]({'attributes':['id',_0xb5eb('0x19'),_0xb5eb('0x18')],'where':{'role':'agent','chanspy':!![]},'raw':!![]})['then'](function(_0xa4774d){if(_0xa4774d){return _0x592df9(getChanSpyApplications(_0x1db3bd,_0xa4774d));}return _0x592df9([]);})[_0xb5eb('0x1b')](function(_0x4326f4){_0x17edb0(_0x4326f4);});});};module[_0xb5eb('0x1c')]=function(_0x13f85d,_0x306b18){var _0x43cb78=_0x13f85d[_0xb5eb('0x1d')];return _0x13f85d[_0xb5eb('0x1e')](_0xb5eb('0x1f'),attributes,{'tableName':_0xb5eb('0x20'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x3f807a,_0x742f8a,_0x1a9361){return getChanSpyPromise(_0x43cb78,_0x3f807a)[_0xb5eb('0x21')](function(_0x2782a1){if(_0x2782a1&&_0x2782a1[_0xb5eb('0x16')]){return _0x43cb78['VoiceExtension'][_0xb5eb('0x22')](_0x2782a1);}})[_0xb5eb('0x21')](function(){_0x1a9361();})[_0xb5eb('0x1b')](function(_0x457846){_0x1a9361(_0x457846);});},'afterUpdate':function(_0x5138d3,_0x58614f,_0x388a14){return _0x43cb78['VoiceExtension']['destroy']({'where':{'ChanSpyId':_0x5138d3['id']}})[_0xb5eb('0x21')](function(){return getChanSpyPromise(_0x43cb78,_0x5138d3);})[_0xb5eb('0x21')](function(_0x464cec){if(_0x464cec&&_0x464cec[_0xb5eb('0x16')]){return _0x43cb78['VoiceExtension'][_0xb5eb('0x22')](_0x464cec);}})[_0xb5eb('0x21')](function(){_0x388a14();})[_0xb5eb('0x1b')](function(_0x2e7c23){_0x388a14(_0x2e7c23);});},'afterDestroy':function(_0x5ec359,_0x59b376,_0x30b1fe){return _0x43cb78[_0xb5eb('0x23')][_0xb5eb('0x24')]({'where':{'ChanSpyId':_0x5ec359['id']}})[_0xb5eb('0x21')](function(){_0x30b1fe();})['catch'](function(_0x1280be){_0x30b1fe(_0x1280be);});}}});}; \ No newline at end of file +var _0x0b2e=['findAll','internal','agent','catch','models','define','VoiceChanSpy','voice_chanspy','then','VoiceExtension','bulkCreate','destroy','lodash','util','bluebird','./voiceChanSpy.attributes','context','from-sip','format','prefix','push','chanspy','merge','MixMonitor','${UNIQUEID}.%s,ab','recordingFormat','auth','Authenticate','ChanSpy','SIP/%s,%s','options','StopMixMonitor','length','concat','name','User'];(function(_0x5a63a4,_0x6407ab){var _0x47d76f=function(_0x100a08){while(--_0x100a08){_0x5a63a4['push'](_0x5a63a4['shift']());}};_0x47d76f(++_0x6407ab);}(_0x0b2e,0x150));var _0xe0b2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0b2e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xe0b2('0x0'));var util=require(_0xe0b2('0x1'));var BPromise=require(_0xe0b2('0x2'));var attributes=require(_0xe0b2('0x3'));var getUserApplications=function(_0x237e3f,_0x1492b6,_0x456716){var _0x4a7820=0x1;var _0x14f2c8=[];var _0x47e3d9={'context':_0x1492b6[_0xe0b2('0x4')]||_0xe0b2('0x5'),'exten':util[_0xe0b2('0x6')]('%s%s',_0x237e3f[_0xe0b2('0x7')],_0x456716),'type':'system','isApp':![],'ChanSpyId':_0x237e3f['id'],'UserId':_0x1492b6['id']};_0x14f2c8[_0xe0b2('0x8')](_['merge']({'app':'Set','appdata':util[_0xe0b2('0x6')]('CDR(type)=%s',_0xe0b2('0x9')),'priority':_0x4a7820++},_0x47e3d9));if(_0x237e3f['record']){_0x14f2c8[_0xe0b2('0x8')](_[_0xe0b2('0xa')]({'app':_0xe0b2('0xb'),'appdata':util[_0xe0b2('0x6')](_0xe0b2('0xc'),_0x237e3f[_0xe0b2('0xd')]),'priority':_0x4a7820++},_0x47e3d9));}if(_0x237e3f[_0xe0b2('0xe')]){_0x14f2c8[_0xe0b2('0x8')](_[_0xe0b2('0xa')]({'app':_0xe0b2('0xf'),'appdata':_0x237e3f['password'],'priority':_0x4a7820++},_0x47e3d9));}_0x14f2c8[_0xe0b2('0x8')](_[_0xe0b2('0xa')]({'app':_0xe0b2('0x10'),'appdata':util[_0xe0b2('0x6')](_0xe0b2('0x11'),_0x1492b6['name'],_0x237e3f['options']?_0x237e3f[_0xe0b2('0x12')]['join'](''):''),'priority':_0x4a7820++},_0x47e3d9));if(_0x237e3f['record']){_0x14f2c8[_0xe0b2('0x8')](_[_0xe0b2('0xa')]({'app':_0xe0b2('0x13'),'priority':_0x4a7820++},_0x47e3d9));}return _0x14f2c8;};var getChanSpyApplications=function(_0x2059e3,_0xe3d81b){var _0x269d30=[];for(var _0x34299c=0x0,_0x3f1078=0x1;_0x34299c<_0xe3d81b[_0xe0b2('0x14')];_0x34299c++,_0x3f1078=0x1){_0x269d30=_0x269d30[_0xe0b2('0x15')](getUserApplications(_0x2059e3,_0xe3d81b[_0x34299c],_0xe3d81b[_0x34299c]['internal']));if(_0xe3d81b[_0x34299c]['internal']!=_0xe3d81b[_0x34299c]['name']){_0x269d30=_0x269d30['concat'](getUserApplications(_0x2059e3,_0xe3d81b[_0x34299c],_0xe3d81b[_0x34299c][_0xe0b2('0x16')]));}}return _0x269d30;};var getChanSpyPromise=function(_0x4b8d68,_0x3965d7){return new BPromise(function(_0x1dd6a4,_0x5f3d16){return _0x4b8d68[_0xe0b2('0x17')][_0xe0b2('0x18')]({'attributes':['id','name',_0xe0b2('0x19')],'where':{'role':_0xe0b2('0x1a'),'chanspy':!![]},'raw':!![]})['then'](function(_0x136f11){if(_0x136f11){return _0x1dd6a4(getChanSpyApplications(_0x3965d7,_0x136f11));}return _0x1dd6a4([]);})[_0xe0b2('0x1b')](function(_0x3bd394){_0x5f3d16(_0x3bd394);});});};module['exports']=function(_0x2f351b,_0x425916){var _0x540ee2=_0x2f351b[_0xe0b2('0x1c')];return _0x2f351b[_0xe0b2('0x1d')](_0xe0b2('0x1e'),attributes,{'tableName':_0xe0b2('0x1f'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x141556,_0x2898da,_0x35169a){return getChanSpyPromise(_0x540ee2,_0x141556)[_0xe0b2('0x20')](function(_0x1eba41){if(_0x1eba41&&_0x1eba41[_0xe0b2('0x14')]){return _0x540ee2[_0xe0b2('0x21')]['bulkCreate'](_0x1eba41);}})[_0xe0b2('0x20')](function(){_0x35169a();})[_0xe0b2('0x1b')](function(_0x3d3971){_0x35169a(_0x3d3971);});},'afterUpdate':function(_0x22bc69,_0x1b984f,_0x3748b8){return _0x540ee2[_0xe0b2('0x21')]['destroy']({'where':{'ChanSpyId':_0x22bc69['id']}})[_0xe0b2('0x20')](function(){return getChanSpyPromise(_0x540ee2,_0x22bc69);})[_0xe0b2('0x20')](function(_0x3b2a54){if(_0x3b2a54&&_0x3b2a54[_0xe0b2('0x14')]){return _0x540ee2[_0xe0b2('0x21')][_0xe0b2('0x22')](_0x3b2a54);}})[_0xe0b2('0x20')](function(){_0x3748b8();})[_0xe0b2('0x1b')](function(_0xe2d551){_0x3748b8(_0xe2d551);});},'afterDestroy':function(_0x3b31b1,_0x298d59,_0x2eec4c){return _0x540ee2['VoiceExtension'][_0xe0b2('0x23')]({'where':{'ChanSpyId':_0x3b31b1['id']}})[_0xe0b2('0x20')](function(){_0x2eec4c();})['catch'](function(_0x1ab918){_0x2eec4c(_0x1ab918);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 10d7f6b..983414b 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 _0x17ff=['VoiceChanSpy,\x20%s,\x20%s,\x20%s','VoiceChanSpy,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','request\x20sent','debug'];(function(_0x3879f5,_0x5b4fe8){var _0x27ee90=function(_0x46484a){while(--_0x46484a){_0x3879f5['push'](_0x3879f5['shift']());}};_0x27ee90(++_0x5b4fe8);}(_0x17ff,0x1e9));var _0xf17f=function(_0x16aa09,_0xbadd28){_0x16aa09=_0x16aa09-0x0;var _0x55f174=_0x17ff[_0x16aa09];return _0x55f174;};'use strict';var _=require(_0xf17f('0x0'));var util=require(_0xf17f('0x1'));var moment=require(_0xf17f('0x2'));var BPromise=require(_0xf17f('0x3'));var rs=require(_0xf17f('0x4'));var fs=require('fs');var Redis=require(_0xf17f('0x5'));var db=require(_0xf17f('0x6'))['db'];var utils=require(_0xf17f('0x7'));var logger=require(_0xf17f('0x8'))('rpc');var config=require(_0xf17f('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xf17f('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2e750c,_0x459c53,_0x47d438){return new BPromise(function(_0x103784,_0x15fa00){return client[_0xf17f('0xb')](_0x2e750c,_0x47d438)[_0xf17f('0xc')](function(_0x563f4a){logger['info']('VoiceChanSpy,\x20%s,\x20%s',_0x459c53,_0xf17f('0xd'));logger[_0xf17f('0xe')](_0xf17f('0xf'),_0x459c53,_0xf17f('0xd'),JSON['stringify'](_0x563f4a));if(_0x563f4a['error']){if(_0x563f4a['error']['code']===0x1f4){logger['error'](_0xf17f('0x10'),_0x459c53,_0x563f4a[_0xf17f('0x11')][_0xf17f('0x12')]);return _0x15fa00(_0x563f4a['error'][_0xf17f('0x12')]);}logger[_0xf17f('0x11')](_0xf17f('0x10'),_0x459c53,_0x563f4a[_0xf17f('0x11')][_0xf17f('0x12')]);return _0x103784(_0x563f4a[_0xf17f('0x11')]['message']);}else{logger['info'](_0xf17f('0x10'),_0x459c53,_0xf17f('0xd'));_0x103784(_0x563f4a[_0xf17f('0x13')][_0xf17f('0x12')]);}})[_0xf17f('0x14')](function(_0x2987ec){logger[_0xf17f('0x11')](_0xf17f('0x10'),_0x459c53,_0x2987ec);_0x15fa00(_0x2987ec);});});} \ No newline at end of file +var _0x445f=['../../config/environment','jayson/promise','client','http','request','then','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x3ea18a,_0x8c2e10){var _0x44bf36=function(_0x935478){while(--_0x935478){_0x3ea18a['push'](_0x3ea18a['shift']());}};_0x44bf36(++_0x8c2e10);}(_0x445f,0x97));var _0xf445=function(_0x1fa0a0,_0x356533){_0x1fa0a0=_0x1fa0a0-0x0;var _0x2b4d26=_0x445f[_0x1fa0a0];return _0x2b4d26;};'use strict';var _=require(_0xf445('0x0'));var util=require(_0xf445('0x1'));var moment=require(_0xf445('0x2'));var BPromise=require(_0xf445('0x3'));var rs=require(_0xf445('0x4'));var fs=require('fs');var Redis=require(_0xf445('0x5'));var db=require(_0xf445('0x6'))['db'];var utils=require(_0xf445('0x7'));var logger=require(_0xf445('0x8'))(_0xf445('0x9'));var config=require(_0xf445('0xa'));var jayson=require(_0xf445('0xb'));var client=jayson[_0xf445('0xc')][_0xf445('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x3c40f9,_0x11d6aa,_0x3effd1){return new BPromise(function(_0x2b81bf,_0x1e467d){return client[_0xf445('0xe')](_0x3c40f9,_0x3effd1)[_0xf445('0xf')](function(_0xd416c2){logger['info'](_0xf445('0x10'),_0x11d6aa,_0xf445('0x11'));logger[_0xf445('0x12')]('VoiceChanSpy,\x20%s,\x20%s,\x20%s',_0x11d6aa,_0xf445('0x11'),JSON[_0xf445('0x13')](_0xd416c2));if(_0xd416c2[_0xf445('0x14')]){if(_0xd416c2[_0xf445('0x14')]['code']===0x1f4){logger['error']('VoiceChanSpy,\x20%s,\x20%s',_0x11d6aa,_0xd416c2['error'][_0xf445('0x15')]);return _0x1e467d(_0xd416c2[_0xf445('0x14')][_0xf445('0x15')]);}logger['error'](_0xf445('0x10'),_0x11d6aa,_0xd416c2[_0xf445('0x14')][_0xf445('0x15')]);return _0x2b81bf(_0xd416c2[_0xf445('0x14')]['message']);}else{logger[_0xf445('0x16')](_0xf445('0x10'),_0x11d6aa,_0xf445('0x11'));_0x2b81bf(_0xd416c2['result'][_0xf445('0x15')]);}})['catch'](function(_0x5b557c){logger[_0xf445('0x14')](_0xf445('0x10'),_0x11d6aa,_0x5b557c);_0x1e467d(_0x5b557c);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index b0d5eef..9ed1883 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 _0xb6b1=['isAuthenticated','create','put','update','delete','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceContext.controller','index','get','/:id','post'];(function(_0x19da73,_0x29136c){var _0xfeef3e=function(_0x3f6fd){while(--_0x3f6fd){_0x19da73['push'](_0x19da73['shift']());}};_0xfeef3e(++_0x29136c);}(_0xb6b1,0x195));var _0x1b6b=function(_0x4bacb6,_0x2b299d){_0x4bacb6=_0x4bacb6-0x0;var _0x58c029=_0xb6b1[_0x4bacb6];return _0x58c029;};'use strict';var multer=require('multer');var util=require(_0x1b6b('0x0'));var path=require(_0x1b6b('0x1'));var timeout=require(_0x1b6b('0x2'));var express=require(_0x1b6b('0x3'));var router=express[_0x1b6b('0x4')]();var auth=require(_0x1b6b('0x5'));var interaction=require(_0x1b6b('0x6'));var config=require(_0x1b6b('0x7'));var controller=require(_0x1b6b('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x1b6b('0x9')]);router[_0x1b6b('0xa')](_0x1b6b('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x1b6b('0xc')]('/',auth[_0x1b6b('0xd')](),controller[_0x1b6b('0xe')]);router[_0x1b6b('0xf')](_0x1b6b('0xb'),auth[_0x1b6b('0xd')](),controller[_0x1b6b('0x10')]);router[_0x1b6b('0x11')](_0x1b6b('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x1b6b('0x12')]=router; \ No newline at end of file +var _0x2561=['Router','../../components/interaction/service','../../config/environment','./voiceContext.controller','isAuthenticated','index','/:id','show','create','update','delete','exports','util','connect-timeout','express'];(function(_0x47e549,_0x2e53d6){var _0x251374=function(_0x400458){while(--_0x400458){_0x47e549['push'](_0x47e549['shift']());}};_0x251374(++_0x2e53d6);}(_0x2561,0x1b0));var _0x1256=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0x2561[_0x2be8c2];return _0x97f531;};'use strict';var multer=require('multer');var util=require(_0x1256('0x0'));var path=require('path');var timeout=require(_0x1256('0x1'));var express=require(_0x1256('0x2'));var router=express[_0x1256('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x1256('0x4'));var config=require(_0x1256('0x5'));var controller=require(_0x1256('0x6'));router['get']('/',auth[_0x1256('0x7')](),controller[_0x1256('0x8')]);router['get'](_0x1256('0x9'),auth[_0x1256('0x7')](),controller[_0x1256('0xa')]);router['post']('/',auth[_0x1256('0x7')](),controller[_0x1256('0xb')]);router['put'](_0x1256('0x9'),auth['isAuthenticated'](),controller[_0x1256('0xc')]);router[_0x1256('0xd')](_0x1256('0x9'),auth[_0x1256('0x7')](),controller['destroy']);module[_0x1256('0xe')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index 2f3c428..04bbb93 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 _0x3e74=['name','sequelize','STRING'];(function(_0x2532fc,_0xf8cd6){var _0x2a7bff=function(_0x4cfd80){while(--_0x4cfd80){_0x2532fc['push'](_0x2532fc['shift']());}};_0x2a7bff(++_0xf8cd6);}(_0x3e74,0x175));var _0x43e7=function(_0x40aa1b,_0x2c4e52){_0x40aa1b=_0x40aa1b-0x0;var _0x3515d2=_0x3e74[_0x40aa1b];return _0x3515d2;};'use strict';var Sequelize=require(_0x43e7('0x0'));module['exports']={'name':{'type':Sequelize[_0x43e7('0x1')],'unique':_0x43e7('0x2')},'description':{'type':Sequelize[_0x43e7('0x1')],'allowNull':!![]},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file +var _0x34e8=['sequelize','exports','STRING','name','BOOLEAN'];(function(_0x494300,_0x15e326){var _0x700d29=function(_0x21fe9e){while(--_0x21fe9e){_0x494300['push'](_0x494300['shift']());}};_0x700d29(++_0x15e326);}(_0x34e8,0x12c));var _0x834e=function(_0x1ae1eb,_0x40647c){_0x1ae1eb=_0x1ae1eb-0x0;var _0x2abd28=_0x34e8[_0x1ae1eb];return _0x2abd28;};'use strict';var Sequelize=require(_0x834e('0x0'));module[_0x834e('0x1')]={'name':{'type':Sequelize[_0x834e('0x2')],'unique':_0x834e('0x3')},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x834e('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.controller.js b/server/api/voiceContext/voiceContext.controller.js index 1ad6d14..2bb7cde 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 _0xe176=['../../mysqldb','jayson/promise','client','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','Contexts','UserProfileResource','name','send','index','VoiceContext','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','includeAll','include','findAll','params','options','find','create','body','join','server/files/templates/context.ejs','utf8','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','chan_sip.so','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','Reload','root','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x3a13aa,_0x99bc22){var _0x226ec6=function(_0x1eaadd){while(--_0x1eaadd){_0x3a13aa['push'](_0x3a13aa['shift']());}};_0x226ec6(++_0x99bc22);}(_0xe176,0x194));var _0x6e17=function(_0x334651,_0x6e99f6){_0x334651=_0x334651-0x0;var _0x29657c=_0xe176[_0x334651];return _0x29657c;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x6e17('0x0'));var rimraf=require(_0x6e17('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6e17('0x2'));var rp=require(_0x6e17('0x3'));var moment=require(_0x6e17('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x6e17('0x5'));var util=require(_0x6e17('0x6'));var path=require('path');var sox=require(_0x6e17('0x7'));var csv=require(_0x6e17('0x8'));var ejs=require(_0x6e17('0x9'));var fs=require('fs');var _=require(_0x6e17('0xa'));var squel=require(_0x6e17('0xb'));var crypto=require(_0x6e17('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x6e17('0xd'));var toCsv=require(_0x6e17('0x8'));var querystring=require(_0x6e17('0xe'));var Papa=require(_0x6e17('0xf'));var Redis=require(_0x6e17('0x10'));var authService=require(_0x6e17('0x11'));var qs=require(_0x6e17('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6e17('0x13'));var logger=require(_0x6e17('0x14'))(_0x6e17('0x15'));var utils=require(_0x6e17('0x16'));var config=require(_0x6e17('0x17'));var db=require(_0x6e17('0x18'))['db'];var jayson=require(_0x6e17('0x19'));var client=jayson[_0x6e17('0x1a')]['http']({'port':0x232a});function checkPasswordPattern(_0x406ec2,_0x63bcec,_0x438604){if(_0x438604){var _0x1b461c=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1b461c[_0x6e17('0x1b')](_0x63bcec)){return _0x406ec2;}else{throw new db[(_0x6e17('0x1c'))][(_0x6e17('0x1d'))](_0x6e17('0x1e'));}}else{return _0x406ec2;}}function respondWithRpcPromise(_0x198022,_0x3d992,_0x4f9c18,_0xb3feae){return new BPromise(function(_0x45587e,_0x304950){var _0x4ff3e3=_0xb3feae||client;return _0x4ff3e3[_0x6e17('0x1f')](_0x198022,_0x4f9c18)[_0x6e17('0x20')](function(_0x2f97a5){logger[_0x6e17('0x21')](_0x6e17('0x22'),_0x3d992,_0x6e17('0x23'));logger[_0x6e17('0x24')](_0x6e17('0x25'),_0x3d992,_0x6e17('0x23'),JSON[_0x6e17('0x26')](_0x2f97a5));if(_0x2f97a5['error']){if(_0x2f97a5[_0x6e17('0x27')][_0x6e17('0x28')]===0x1f4){logger[_0x6e17('0x27')](_0x6e17('0x22'),_0x3d992,_0x2f97a5[_0x6e17('0x27')][_0x6e17('0x29')]);return _0x304950(_0x2f97a5[_0x6e17('0x27')][_0x6e17('0x29')]);}logger[_0x6e17('0x27')](_0x6e17('0x22'),_0x3d992,_0x2f97a5[_0x6e17('0x27')]['message']);return _0x45587e(_0x2f97a5[_0x6e17('0x27')]['message']);}else{logger[_0x6e17('0x21')](_0x6e17('0x22'),_0x3d992,_0x6e17('0x23'));_0x45587e(_0x2f97a5[_0x6e17('0x2a')][_0x6e17('0x29')]);}})[_0x6e17('0x2b')](function(_0x1a41ce){logger[_0x6e17('0x27')](_0x6e17('0x22'),_0x3d992,_0x1a41ce);_0x304950(_0x1a41ce);});});}function respondWithStatusCode(_0x40ca98,_0x1782ca){_0x1782ca=_0x1782ca||0xcc;return function(_0x4b3389){if(_0x4b3389){return _0x40ca98[_0x6e17('0x2c')](_0x1782ca);}return _0x40ca98[_0x6e17('0x2d')](_0x1782ca)[_0x6e17('0x2e')]();};}function respondWithResult(_0x17394f,_0x55aeb4){_0x55aeb4=_0x55aeb4||0xc8;return function(_0x73e546){if(_0x73e546){return _0x17394f['status'](_0x55aeb4)[_0x6e17('0x2f')](_0x73e546);}};}function respondWithFilteredResult(_0x16b8a0,_0x41b53e){return function(_0x22a52e){if(_0x22a52e){var _0x347fef=_0x22a52e[_0x6e17('0x30')],_0x316527=_0x41b53e[_0x6e17('0x31')],_0x28dd77=_0x41b53e[_0x6e17('0x31')]+_0x41b53e[_0x6e17('0x32')],_0x4f0aaa;if(_0x28dd77>=_0x347fef){_0x28dd77=_0x347fef;_0x4f0aaa=0xc8;}else{_0x4f0aaa=0xce;}_0x16b8a0[_0x6e17('0x2d')](_0x4f0aaa);return _0x16b8a0[_0x6e17('0x33')](_0x6e17('0x34'),_0x316527+'-'+_0x28dd77+'/'+_0x347fef)[_0x6e17('0x2f')](_0x22a52e);}return null;};}function patchUpdates(_0x5d50d8){return function(_0x50c141){try{jsonpatch[_0x6e17('0x35')](_0x50c141,_0x5d50d8,!![]);}catch(_0x59914a){return BPromise[_0x6e17('0x36')](_0x59914a);}return _0x50c141[_0x6e17('0x37')]();};}function saveUpdates(_0x34dbfa,_0x3a6b4f){return function(_0x271f8e){if(_0x271f8e){return _0x271f8e[_0x6e17('0x38')](_0x34dbfa)[_0x6e17('0x20')](function(_0x36ad32){return _0x36ad32;});}return null;};}function removeEntity(_0xfdb518,_0x4d7929){return function(_0x22ba3c){if(_0x22ba3c){return _0x22ba3c[_0x6e17('0x39')]()['then'](function(){var _0x2fc07a=_0x22ba3c['get']({'plain':!![]});var _0x37b01a=_0x6e17('0x3a');return db[_0x6e17('0x3b')][_0x6e17('0x39')]({'where':{'type':_0x37b01a,'resourceId':_0x2fc07a['id']}})[_0x6e17('0x20')](function(){return _0x22ba3c;});})[_0x6e17('0x20')](function(){_0xfdb518['status'](0xcc)[_0x6e17('0x2e')]();});}};}function handleEntityNotFound(_0x1392c2,_0x55c42f){return function(_0x1a0fd2){if(!_0x1a0fd2){_0x1392c2[_0x6e17('0x2c')](0x194);}return _0x1a0fd2;};}function handleError(_0x24db22,_0x1a11b3){_0x1a11b3=_0x1a11b3||0x1f4;return function(_0x295aca){logger[_0x6e17('0x27')](_0x295aca['stack']);if(_0x295aca[_0x6e17('0x3c')]){delete _0x295aca[_0x6e17('0x3c')];}_0x24db22['status'](_0x1a11b3)[_0x6e17('0x3d')](_0x295aca);};}exports[_0x6e17('0x3e')]=function(_0x4fd38d,_0x1bee42){var _0x504272={},_0x30a7fd={},_0x552a84={'count':0x0,'rows':[]};var _0xafd7d0=_['map'](db[_0x6e17('0x3f')][_0x6e17('0x40')],function(_0x51c4b0){return{'name':_0x51c4b0['fieldName'],'type':_0x51c4b0[_0x6e17('0x41')][_0x6e17('0x42')]};});_0x30a7fd[_0x6e17('0x43')]=_[_0x6e17('0x44')](_0xafd7d0,_0x6e17('0x3c'));_0x30a7fd[_0x6e17('0x45')]=_[_0x6e17('0x46')](_0x4fd38d[_0x6e17('0x45')]);_0x30a7fd[_0x6e17('0x47')]=_[_0x6e17('0x48')](_0x30a7fd[_0x6e17('0x43')],_0x30a7fd['query']);_0x504272[_0x6e17('0x49')]=_[_0x6e17('0x48')](_0x30a7fd['model'],qs['fields'](_0x4fd38d[_0x6e17('0x45')][_0x6e17('0x4a')]));_0x504272[_0x6e17('0x49')]=_0x504272[_0x6e17('0x49')]['length']?_0x504272['attributes']:_0x30a7fd['model'];if(!_0x4fd38d['query'][_0x6e17('0x4b')](_0x6e17('0x4c'))){_0x504272[_0x6e17('0x32')]=qs[_0x6e17('0x32')](_0x4fd38d['query'][_0x6e17('0x32')]);_0x504272[_0x6e17('0x31')]=qs[_0x6e17('0x31')](_0x4fd38d['query'][_0x6e17('0x31')]);}_0x504272[_0x6e17('0x4d')]=qs[_0x6e17('0x4e')](_0x4fd38d[_0x6e17('0x45')]['sort']);_0x504272[_0x6e17('0x4f')]=qs['filters'](_['pick'](_0x4fd38d[_0x6e17('0x45')],_0x30a7fd[_0x6e17('0x47')]));if(_0x4fd38d[_0x6e17('0x45')][_0x6e17('0x50')]){_0x504272[_0x6e17('0x4f')]=_[_0x6e17('0x51')](_0x504272[_0x6e17('0x4f')],{'$or':_['map'](_0xafd7d0,function(_0x42e01e){if(_0x42e01e['type']!=='VIRTUAL'){var _0x4e206b={};_0x4e206b[_0x42e01e[_0x6e17('0x3c')]]={'$like':'%'+_0x4fd38d['query'][_0x6e17('0x50')]+'%'};return _0x4e206b;}})});}_0x504272=_[_0x6e17('0x51')]({},_0x504272,_0x4fd38d['options']);var _0x367153={'where':_0x504272[_0x6e17('0x4f')]};return db['VoiceContext'][_0x6e17('0x30')](_0x367153)[_0x6e17('0x20')](function(_0x103560){_0x552a84[_0x6e17('0x30')]=_0x103560;if(_0x4fd38d['query'][_0x6e17('0x52')]){_0x504272[_0x6e17('0x53')]=[{'all':!![]}];}return db[_0x6e17('0x3f')][_0x6e17('0x54')](_0x504272);})[_0x6e17('0x20')](function(_0x280bdd){_0x552a84['rows']=_0x280bdd;return _0x552a84;})[_0x6e17('0x20')](respondWithFilteredResult(_0x1bee42,_0x504272))[_0x6e17('0x2b')](handleError(_0x1bee42,null));};exports['show']=function(_0x356834,_0x159e26){var _0x1807d8={'raw':![],'where':{'id':_0x356834[_0x6e17('0x55')]['id']}},_0x165066={};_0x165066[_0x6e17('0x43')]=_['keys'](db[_0x6e17('0x3f')]['rawAttributes']);_0x165066[_0x6e17('0x45')]=_[_0x6e17('0x46')](_0x356834[_0x6e17('0x45')]);_0x165066[_0x6e17('0x47')]=_[_0x6e17('0x48')](_0x165066['model'],_0x165066['query']);_0x1807d8[_0x6e17('0x49')]=_[_0x6e17('0x48')](_0x165066['model'],qs[_0x6e17('0x4a')](_0x356834[_0x6e17('0x45')][_0x6e17('0x4a')]));_0x1807d8[_0x6e17('0x49')]=_0x1807d8[_0x6e17('0x49')]['length']?_0x1807d8[_0x6e17('0x49')]:_0x165066['model'];if(_0x356834[_0x6e17('0x45')][_0x6e17('0x52')]){_0x1807d8[_0x6e17('0x53')]=[{'all':!![]}];}_0x1807d8=_['merge']({},_0x1807d8,_0x356834[_0x6e17('0x56')]);return db['VoiceContext'][_0x6e17('0x57')](_0x1807d8)[_0x6e17('0x20')](handleEntityNotFound(_0x159e26,null))[_0x6e17('0x20')](respondWithResult(_0x159e26,null))[_0x6e17('0x2b')](handleError(_0x159e26,null));};exports[_0x6e17('0x58')]=function(_0x51aee8,_0xfb2e25,_0x2a935e){var _0x10778;return db[_0x6e17('0x3f')]['create'](_0x51aee8[_0x6e17('0x59')],{'raw':!![]})[_0x6e17('0x20')](function(_0x4f9d8e){_0x10778=_0x4f9d8e;return db[_0x6e17('0x3f')][_0x6e17('0x54')]({'raw':!![]});})[_0x6e17('0x20')](function(_0x639b5f){var _0x12ce3d=fs['readFileSync'](path[_0x6e17('0x5a')](config['root'],_0x6e17('0x5b')),_0x6e17('0x5c'));var _0x524822=ejs[_0x6e17('0x5d')](_0x12ce3d,{'contexts':_0x639b5f||[]});fs[_0x6e17('0x5e')](_0x6e17('0x5f'),_0x524822);})['then'](function(){return respondWithRpcPromise('Reload',_0x6e17('0x58'),{'module':_0x6e17('0x60')});})[_0x6e17('0x20')](function(){var _0x17a777=_0x51aee8[_0x6e17('0x61')][_0x6e17('0x62')]({'plain':!![]});if(!_0x17a777)throw new Error(_0x6e17('0x63'));if(_0x17a777[_0x6e17('0x64')]==='user'){var _0x5dfb97=_0x10778['get']({'plain':!![]});return db['UserProfileSection']['find']({'where':{'name':'Contexts','userProfileId':_0x17a777[_0x6e17('0x65')]},'raw':!![]})[_0x6e17('0x20')](function(_0xde155a){if(_0xde155a&&_0xde155a[_0x6e17('0x66')]===0x0){return db[_0x6e17('0x3b')][_0x6e17('0x58')]({'name':_0x5dfb97[_0x6e17('0x3c')],'resourceId':_0x5dfb97['id'],'type':_0xde155a['name'],'sectionId':_0xde155a['id']},{})[_0x6e17('0x20')](function(){return _0x10778;});}else{return _0x10778;}})[_0x6e17('0x2b')](function(_0x4750a5){logger[_0x6e17('0x27')](_0x6e17('0x67'),_0x4750a5);throw _0x4750a5;});}return _0x10778;})['then'](respondWithResult(_0xfb2e25,0xc9))[_0x6e17('0x2b')](handleError(_0xfb2e25,null));};exports['update']=function(_0x1ee022,_0x51d9d6,_0x5159b6){var _0x113f2a;return db['VoiceContext']['find']({'where':{'id':_0x1ee022[_0x6e17('0x55')]['id']}})['then'](handleEntityNotFound(_0x51d9d6,null))[_0x6e17('0x20')](saveUpdates(_0x1ee022[_0x6e17('0x59')],null))[_0x6e17('0x20')](function(_0x5a20d8){if(_0x5a20d8){_0x113f2a=_0x5a20d8;return db[_0x6e17('0x3f')][_0x6e17('0x54')]({'raw':!![]});}})[_0x6e17('0x20')](function(_0x2e9903){var _0x543c3c=fs[_0x6e17('0x68')](path[_0x6e17('0x5a')](config['root'],_0x6e17('0x5b')),_0x6e17('0x5c'));var _0x331db2=ejs[_0x6e17('0x5d')](_0x543c3c,{'contexts':_0x2e9903||[]});fs[_0x6e17('0x5e')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x331db2);})[_0x6e17('0x20')](function(){return respondWithRpcPromise(_0x6e17('0x69'),_0x6e17('0x38'),{'module':_0x6e17('0x60')});})['then'](function(){return _0x113f2a;})[_0x6e17('0x20')](respondWithResult(_0x51d9d6,null))['catch'](handleError(_0x51d9d6,null));};exports[_0x6e17('0x39')]=function(_0x27f1cd,_0x46c112,_0x4e1d00){var _0x101bf1;return db[_0x6e17('0x3f')][_0x6e17('0x57')]({'where':{'id':_0x27f1cd[_0x6e17('0x55')]['id']}})[_0x6e17('0x20')](handleEntityNotFound(_0x46c112,null))[_0x6e17('0x20')](removeEntity(_0x46c112,null))['then'](function(){return db[_0x6e17('0x3f')][_0x6e17('0x54')]({'raw':!![]});})['then'](function(_0x343098){var _0x2b52b7=fs[_0x6e17('0x68')](path['join'](config[_0x6e17('0x6a')],_0x6e17('0x5b')),_0x6e17('0x5c'));var _0x3b4eeb=ejs[_0x6e17('0x5d')](_0x2b52b7,{'contexts':_0x343098});fs[_0x6e17('0x5e')](_0x6e17('0x5f'),_0x3b4eeb);return respondWithRpcPromise(_0x6e17('0x69'),'destroy',{'module':_0x6e17('0x60')});})[_0x6e17('0x2b')](handleError(_0x46c112,null));}; \ No newline at end of file +var _0x90ef=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../mysqldb','jayson/promise','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','VoiceContext,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','end','status','json','count','limit','set','Content-Range','apply','reject','save','update','destroy','get','Contexts','UserProfileResource','sendStatus','stack','name','send','VoiceContext','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','rows','show','include','options','find','create','findAll','readFileSync','server/files/templates/context.ejs','utf8','render','/etc/asterisk/extensions_xcally_contexts.conf','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','body','join','writeFileSync','params','root','html-pdf'];(function(_0x598802,_0x5ba26d){var _0x48effa=function(_0xd712bf){while(--_0xd712bf){_0x598802['push'](_0x598802['shift']());}};_0x48effa(++_0x5ba26d);}(_0x90ef,0x6b));var _0xf90e=function(_0x29cd3d,_0x575338){_0x29cd3d=_0x29cd3d-0x0;var _0x5ac833=_0x90ef[_0x29cd3d];return _0x5ac833;};'use strict';var pdf=require(_0xf90e('0x0'));var emlformat=require(_0xf90e('0x1'));var rimraf=require(_0xf90e('0x2'));var zipdir=require(_0xf90e('0x3'));var jsonpatch=require(_0xf90e('0x4'));var rp=require(_0xf90e('0x5'));var moment=require(_0xf90e('0x6'));var BPromise=require(_0xf90e('0x7'));var Mustache=require(_0xf90e('0x8'));var util=require(_0xf90e('0x9'));var path=require(_0xf90e('0xa'));var sox=require('sox');var csv=require(_0xf90e('0xb'));var ejs=require(_0xf90e('0xc'));var fs=require('fs');var _=require(_0xf90e('0xd'));var squel=require(_0xf90e('0xe'));var crypto=require(_0xf90e('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xf90e('0x10'));var toCsv=require(_0xf90e('0xb'));var querystring=require(_0xf90e('0x11'));var Papa=require('papaparse');var Redis=require(_0xf90e('0x12'));var authService=require(_0xf90e('0x13'));var qs=require(_0xf90e('0x14'));var as=require(_0xf90e('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf90e('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xf90e('0x17'))['db'];var jayson=require(_0xf90e('0x18'));var client=jayson['client'][_0xf90e('0x19')]({'port':0x232a});function checkPasswordPattern(_0x4d1fca,_0x896e6a,_0x44d2b0){if(_0x44d2b0){var _0x554d09=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x554d09[_0xf90e('0x1a')](_0x896e6a)){return _0x4d1fca;}else{throw new db[(_0xf90e('0x1b'))][(_0xf90e('0x1c'))](_0xf90e('0x1d'));}}else{return _0x4d1fca;}}function respondWithRpcPromise(_0x4bfcdd,_0x483ff4,_0x467419,_0x543103){return new BPromise(function(_0x5b85ab,_0x192fde){var _0x189561=_0x543103||client;return _0x189561['request'](_0x4bfcdd,_0x467419)[_0xf90e('0x1e')](function(_0x31566d){logger['info'](_0xf90e('0x1f'),_0x483ff4,_0xf90e('0x20'));logger['debug']('VoiceContext,\x20%s,\x20%s,\x20%s',_0x483ff4,_0xf90e('0x20'),JSON[_0xf90e('0x21')](_0x31566d));if(_0x31566d[_0xf90e('0x22')]){if(_0x31566d['error'][_0xf90e('0x23')]===0x1f4){logger[_0xf90e('0x22')](_0xf90e('0x1f'),_0x483ff4,_0x31566d[_0xf90e('0x22')][_0xf90e('0x24')]);return _0x192fde(_0x31566d[_0xf90e('0x22')]['message']);}logger['error'](_0xf90e('0x1f'),_0x483ff4,_0x31566d['error']['message']);return _0x5b85ab(_0x31566d['error']['message']);}else{logger[_0xf90e('0x25')]('VoiceContext,\x20%s,\x20%s',_0x483ff4,_0xf90e('0x20'));_0x5b85ab(_0x31566d[_0xf90e('0x26')][_0xf90e('0x24')]);}})[_0xf90e('0x27')](function(_0x23fdff){logger[_0xf90e('0x22')](_0xf90e('0x1f'),_0x483ff4,_0x23fdff);_0x192fde(_0x23fdff);});});}function respondWithStatusCode(_0x5ebc0b,_0x28eaff){_0x28eaff=_0x28eaff||0xcc;return function(_0x1f06e9){if(_0x1f06e9){return _0x5ebc0b['sendStatus'](_0x28eaff);}return _0x5ebc0b['status'](_0x28eaff)[_0xf90e('0x28')]();};}function respondWithResult(_0x56f7dc,_0x36573b){_0x36573b=_0x36573b||0xc8;return function(_0x547661){if(_0x547661){return _0x56f7dc[_0xf90e('0x29')](_0x36573b)[_0xf90e('0x2a')](_0x547661);}};}function respondWithFilteredResult(_0x407917,_0x3b7bde){return function(_0x432ffe){if(_0x432ffe){var _0x152702=_0x432ffe[_0xf90e('0x2b')],_0xd8fbe3=_0x3b7bde['offset'],_0x1b04e0=_0x3b7bde['offset']+_0x3b7bde[_0xf90e('0x2c')],_0x2d0957;if(_0x1b04e0>=_0x152702){_0x1b04e0=_0x152702;_0x2d0957=0xc8;}else{_0x2d0957=0xce;}_0x407917[_0xf90e('0x29')](_0x2d0957);return _0x407917[_0xf90e('0x2d')](_0xf90e('0x2e'),_0xd8fbe3+'-'+_0x1b04e0+'/'+_0x152702)['json'](_0x432ffe);}return null;};}function patchUpdates(_0x46a39c){return function(_0x3ee60e){try{jsonpatch[_0xf90e('0x2f')](_0x3ee60e,_0x46a39c,!![]);}catch(_0x4f04c7){return BPromise[_0xf90e('0x30')](_0x4f04c7);}return _0x3ee60e[_0xf90e('0x31')]();};}function saveUpdates(_0x305d49,_0x55e00e){return function(_0x45b70f){if(_0x45b70f){return _0x45b70f[_0xf90e('0x32')](_0x305d49)[_0xf90e('0x1e')](function(_0xbcf1ca){return _0xbcf1ca;});}return null;};}function removeEntity(_0x369e4a,_0x4c1f82){return function(_0x19e641){if(_0x19e641){return _0x19e641[_0xf90e('0x33')]()[_0xf90e('0x1e')](function(){var _0x3c3db7=_0x19e641[_0xf90e('0x34')]({'plain':!![]});var _0x390a4a=_0xf90e('0x35');return db[_0xf90e('0x36')][_0xf90e('0x33')]({'where':{'type':_0x390a4a,'resourceId':_0x3c3db7['id']}})[_0xf90e('0x1e')](function(){return _0x19e641;});})[_0xf90e('0x1e')](function(){_0x369e4a[_0xf90e('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x373859,_0x1964e9){return function(_0x300035){if(!_0x300035){_0x373859[_0xf90e('0x37')](0x194);}return _0x300035;};}function handleError(_0x3ffff1,_0xafc534){_0xafc534=_0xafc534||0x1f4;return function(_0x149dfb){logger[_0xf90e('0x22')](_0x149dfb[_0xf90e('0x38')]);if(_0x149dfb[_0xf90e('0x39')]){delete _0x149dfb[_0xf90e('0x39')];}_0x3ffff1[_0xf90e('0x29')](_0xafc534)[_0xf90e('0x3a')](_0x149dfb);};}exports['index']=function(_0x350b81,_0x32b0b6){var _0xbf5e23={},_0x389194={},_0x5d249e={'count':0x0,'rows':[]};var _0x304e3c=_['map'](db[_0xf90e('0x3b')][_0xf90e('0x3c')],function(_0x1c291c){return{'name':_0x1c291c[_0xf90e('0x3d')],'type':_0x1c291c[_0xf90e('0x3e')][_0xf90e('0x3f')]};});_0x389194[_0xf90e('0x40')]=_[_0xf90e('0x41')](_0x304e3c,_0xf90e('0x39'));_0x389194[_0xf90e('0x42')]=_[_0xf90e('0x43')](_0x350b81['query']);_0x389194[_0xf90e('0x44')]=_[_0xf90e('0x45')](_0x389194[_0xf90e('0x40')],_0x389194[_0xf90e('0x42')]);_0xbf5e23[_0xf90e('0x46')]=_['intersection'](_0x389194[_0xf90e('0x40')],qs[_0xf90e('0x47')](_0x350b81[_0xf90e('0x42')][_0xf90e('0x47')]));_0xbf5e23[_0xf90e('0x46')]=_0xbf5e23[_0xf90e('0x46')][_0xf90e('0x48')]?_0xbf5e23[_0xf90e('0x46')]:_0x389194[_0xf90e('0x40')];if(!_0x350b81[_0xf90e('0x42')][_0xf90e('0x49')](_0xf90e('0x4a'))){_0xbf5e23['limit']=qs[_0xf90e('0x2c')](_0x350b81[_0xf90e('0x42')]['limit']);_0xbf5e23[_0xf90e('0x4b')]=qs[_0xf90e('0x4b')](_0x350b81[_0xf90e('0x42')][_0xf90e('0x4b')]);}_0xbf5e23[_0xf90e('0x4c')]=qs[_0xf90e('0x4d')](_0x350b81['query']['sort']);_0xbf5e23[_0xf90e('0x4e')]=qs[_0xf90e('0x44')](_[_0xf90e('0x4f')](_0x350b81[_0xf90e('0x42')],_0x389194['filters']));if(_0x350b81['query']['filter']){_0xbf5e23[_0xf90e('0x4e')]=_[_0xf90e('0x50')](_0xbf5e23['where'],{'$or':_[_0xf90e('0x41')](_0x304e3c,function(_0x5ef17e){if(_0x5ef17e[_0xf90e('0x3e')]!==_0xf90e('0x51')){var _0x4acf31={};_0x4acf31[_0x5ef17e[_0xf90e('0x39')]]={'$like':'%'+_0x350b81['query'][_0xf90e('0x52')]+'%'};return _0x4acf31;}})});}_0xbf5e23=_[_0xf90e('0x50')]({},_0xbf5e23,_0x350b81['options']);var _0x51d519={'where':_0xbf5e23['where']};return db[_0xf90e('0x3b')]['count'](_0x51d519)['then'](function(_0x1613a5){_0x5d249e['count']=_0x1613a5;if(_0x350b81[_0xf90e('0x42')][_0xf90e('0x53')]){_0xbf5e23['include']=[{'all':!![]}];}return db['VoiceContext']['findAll'](_0xbf5e23);})[_0xf90e('0x1e')](function(_0x23f620){_0x5d249e[_0xf90e('0x54')]=_0x23f620;return _0x5d249e;})[_0xf90e('0x1e')](respondWithFilteredResult(_0x32b0b6,_0xbf5e23))[_0xf90e('0x27')](handleError(_0x32b0b6,null));};exports[_0xf90e('0x55')]=function(_0x3578e7,_0x9ffa7e){var _0x5831ec={'raw':![],'where':{'id':_0x3578e7['params']['id']}},_0x313d75={};_0x313d75['model']=_[_0xf90e('0x43')](db[_0xf90e('0x3b')][_0xf90e('0x3c')]);_0x313d75['query']=_['keys'](_0x3578e7[_0xf90e('0x42')]);_0x313d75['filters']=_[_0xf90e('0x45')](_0x313d75['model'],_0x313d75[_0xf90e('0x42')]);_0x5831ec[_0xf90e('0x46')]=_[_0xf90e('0x45')](_0x313d75[_0xf90e('0x40')],qs[_0xf90e('0x47')](_0x3578e7[_0xf90e('0x42')][_0xf90e('0x47')]));_0x5831ec[_0xf90e('0x46')]=_0x5831ec[_0xf90e('0x46')][_0xf90e('0x48')]?_0x5831ec[_0xf90e('0x46')]:_0x313d75[_0xf90e('0x40')];if(_0x3578e7[_0xf90e('0x42')]['includeAll']){_0x5831ec[_0xf90e('0x56')]=[{'all':!![]}];}_0x5831ec=_[_0xf90e('0x50')]({},_0x5831ec,_0x3578e7[_0xf90e('0x57')]);return db['VoiceContext'][_0xf90e('0x58')](_0x5831ec)['then'](handleEntityNotFound(_0x9ffa7e,null))[_0xf90e('0x1e')](respondWithResult(_0x9ffa7e,null))['catch'](handleError(_0x9ffa7e,null));};exports[_0xf90e('0x59')]=function(_0x2b457d,_0x2970b7,_0x555925){var _0xe4e362;return db['VoiceContext']['create'](_0x2b457d['body'],{'raw':!![]})[_0xf90e('0x1e')](function(_0x4a6139){_0xe4e362=_0x4a6139;return db[_0xf90e('0x3b')][_0xf90e('0x5a')]({'raw':!![]});})[_0xf90e('0x1e')](function(_0x5d5dae){var _0x2a06ec=fs[_0xf90e('0x5b')](path['join'](config['root'],_0xf90e('0x5c')),_0xf90e('0x5d'));var _0x1b62e9=ejs[_0xf90e('0x5e')](_0x2a06ec,{'contexts':_0x5d5dae||[]});fs['writeFileSync'](_0xf90e('0x5f'),_0x1b62e9);})[_0xf90e('0x1e')](function(){return respondWithRpcPromise('Reload',_0xf90e('0x59'),{'module':_0xf90e('0x60')});})['then'](function(){var _0x3e38c9=_0x2b457d['user'][_0xf90e('0x34')]({'plain':!![]});if(!_0x3e38c9)throw new Error(_0xf90e('0x61'));if(_0x3e38c9[_0xf90e('0x62')]===_0xf90e('0x63')){var _0x4b0215=_0xe4e362[_0xf90e('0x34')]({'plain':!![]});return db[_0xf90e('0x64')][_0xf90e('0x58')]({'where':{'name':_0xf90e('0x35'),'userProfileId':_0x3e38c9[_0xf90e('0x65')]},'raw':!![]})[_0xf90e('0x1e')](function(_0x325eab){if(_0x325eab&&_0x325eab[_0xf90e('0x66')]===0x0){return db['UserProfileResource'][_0xf90e('0x59')]({'name':_0x4b0215['name'],'resourceId':_0x4b0215['id'],'type':_0x325eab['name'],'sectionId':_0x325eab['id']},{})[_0xf90e('0x1e')](function(){return _0xe4e362;});}else{return _0xe4e362;}})[_0xf90e('0x27')](function(_0x35e033){logger[_0xf90e('0x22')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x35e033);throw _0x35e033;});}return _0xe4e362;})[_0xf90e('0x1e')](respondWithResult(_0x2970b7,0xc9))[_0xf90e('0x27')](handleError(_0x2970b7,null));};exports[_0xf90e('0x32')]=function(_0x5cce55,_0x3f0b55,_0x2e1317){var _0x3336c1;return db[_0xf90e('0x3b')]['find']({'where':{'id':_0x5cce55['params']['id']}})['then'](handleEntityNotFound(_0x3f0b55,null))[_0xf90e('0x1e')](saveUpdates(_0x5cce55[_0xf90e('0x67')],null))[_0xf90e('0x1e')](function(_0x57c186){if(_0x57c186){_0x3336c1=_0x57c186;return db['VoiceContext'][_0xf90e('0x5a')]({'raw':!![]});}})[_0xf90e('0x1e')](function(_0x157b05){var _0x5ca2cc=fs[_0xf90e('0x5b')](path[_0xf90e('0x68')](config['root'],'server/files/templates/context.ejs'),_0xf90e('0x5d'));var _0x4f7d3c=ejs[_0xf90e('0x5e')](_0x5ca2cc,{'contexts':_0x157b05||[]});fs[_0xf90e('0x69')](_0xf90e('0x5f'),_0x4f7d3c);})[_0xf90e('0x1e')](function(){return respondWithRpcPromise('Reload',_0xf90e('0x32'),{'module':_0xf90e('0x60')});})['then'](function(){return _0x3336c1;})[_0xf90e('0x1e')](respondWithResult(_0x3f0b55,null))[_0xf90e('0x27')](handleError(_0x3f0b55,null));};exports[_0xf90e('0x33')]=function(_0x28b411,_0x5c477f,_0x4fd151){var _0x2f734f;return db[_0xf90e('0x3b')][_0xf90e('0x58')]({'where':{'id':_0x28b411[_0xf90e('0x6a')]['id']}})[_0xf90e('0x1e')](handleEntityNotFound(_0x5c477f,null))['then'](removeEntity(_0x5c477f,null))['then'](function(){return db[_0xf90e('0x3b')]['findAll']({'raw':!![]});})[_0xf90e('0x1e')](function(_0x2fc615){var _0x13ba27=fs['readFileSync'](path[_0xf90e('0x68')](config[_0xf90e('0x6b')],_0xf90e('0x5c')),_0xf90e('0x5d'));var _0x1e855d=ejs['render'](_0x13ba27,{'contexts':_0x2fc615});fs['writeFileSync'](_0xf90e('0x5f'),_0x1e855d);return respondWithRpcPromise('Reload','destroy',{'module':'chan_sip.so'});})[_0xf90e('0x27')](handleError(_0x5c477f,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index 95856f5..f78ffa7 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 _0xa260=['define','VoiceContext','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./voiceContext.attributes'];(function(_0x68ee8b,_0x3cc6c5){var _0x5148f7=function(_0x5dcbd5){while(--_0x5dcbd5){_0x68ee8b['push'](_0x68ee8b['shift']());}};_0x5148f7(++_0x3cc6c5);}(_0xa260,0x1ba));var _0x0a26=function(_0xcb5a06,_0x1f3428){_0xcb5a06=_0xcb5a06-0x0;var _0x4aac6e=_0xa260[_0xcb5a06];return _0x4aac6e;};'use strict';var _=require('lodash');var util=require(_0x0a26('0x0'));var logger=require(_0x0a26('0x1'))(_0x0a26('0x2'));var moment=require('moment');var BPromise=require(_0x0a26('0x3'));var rp=require(_0x0a26('0x4'));var fs=require('fs');var path=require(_0x0a26('0x5'));var rimraf=require(_0x0a26('0x6'));var config=require(_0x0a26('0x7'));var attributes=require(_0x0a26('0x8'));module['exports']=function(_0x2d4bb2,_0x5d4e00){return _0x2d4bb2[_0x0a26('0x9')](_0x0a26('0xa'),attributes,{'tableName':'voice_contexts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xea54=['voice_contexts','lodash','util','../../config/logger','bluebird','rimraf','./voiceContext.attributes','define','VoiceContext'];(function(_0x3b7a0c,_0xf1a4c2){var _0x3bb70f=function(_0x248b52){while(--_0x248b52){_0x3b7a0c['push'](_0x3b7a0c['shift']());}};_0x3bb70f(++_0xf1a4c2);}(_0xea54,0xac));var _0x4ea5=function(_0xb917cc,_0x2abad2){_0xb917cc=_0xb917cc-0x0;var _0x26b3f9=_0xea54[_0xb917cc];return _0x26b3f9;};'use strict';var _=require(_0x4ea5('0x0'));var util=require(_0x4ea5('0x1'));var logger=require(_0x4ea5('0x2'))('api');var moment=require('moment');var BPromise=require(_0x4ea5('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4ea5('0x4'));var config=require('../../config/environment');var attributes=require(_0x4ea5('0x5'));module['exports']=function(_0x2c5f92,_0x7afef0){return _0x2c5f92[_0x4ea5('0x6')](_0x4ea5('0x7'),attributes,{'tableName':_0x4ea5('0x8'),'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 0a034c5..25e17a5 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 _0xa3a3=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis'];(function(_0x4264bf,_0x39db0f){var _0x515e5f=function(_0x130168){while(--_0x130168){_0x4264bf['push'](_0x4264bf['shift']());}};_0x515e5f(++_0x39db0f);}(_0xa3a3,0x95));var _0x3a3a=function(_0x2fc3ea,_0xc459b3){_0x2fc3ea=_0x2fc3ea-0x0;var _0x2603bb=_0xa3a3[_0x2fc3ea];return _0x2603bb;};'use strict';var _=require('lodash');var util=require(_0x3a3a('0x0'));var moment=require(_0x3a3a('0x1'));var BPromise=require(_0x3a3a('0x2'));var rs=require(_0x3a3a('0x3'));var fs=require('fs');var Redis=require(_0x3a3a('0x4'));var db=require(_0x3a3a('0x5'))['db'];var utils=require(_0x3a3a('0x6'));var logger=require(_0x3a3a('0x7'))(_0x3a3a('0x8'));var config=require(_0x3a3a('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x3a3a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4cd860,_0x5d330b,_0x50843e){return new BPromise(function(_0x4d167c,_0x139e08){return client['request'](_0x4cd860,_0x50843e)['then'](function(_0x32d37f){logger[_0x3a3a('0xb')](_0x3a3a('0xc'),_0x5d330b,_0x3a3a('0xd'));logger[_0x3a3a('0xe')](_0x3a3a('0xf'),_0x5d330b,'request\x20sent',JSON[_0x3a3a('0x10')](_0x32d37f));if(_0x32d37f[_0x3a3a('0x11')]){if(_0x32d37f['error'][_0x3a3a('0x12')]===0x1f4){logger[_0x3a3a('0x11')]('VoiceContext,\x20%s,\x20%s',_0x5d330b,_0x32d37f[_0x3a3a('0x11')][_0x3a3a('0x13')]);return _0x139e08(_0x32d37f[_0x3a3a('0x11')]['message']);}logger[_0x3a3a('0x11')](_0x3a3a('0xc'),_0x5d330b,_0x32d37f[_0x3a3a('0x11')]['message']);return _0x4d167c(_0x32d37f['error'][_0x3a3a('0x13')]);}else{logger[_0x3a3a('0xb')]('VoiceContext,\x20%s,\x20%s',_0x5d330b,_0x3a3a('0xd'));_0x4d167c(_0x32d37f[_0x3a3a('0x14')]['message']);}})[_0x3a3a('0x15')](function(_0x5ce010){logger['error'](_0x3a3a('0xc'),_0x5d330b,_0x5ce010);_0x139e08(_0x5ce010);});});} \ No newline at end of file +var _0x7114=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceContext,\x20%s,\x20%s','message','catch','lodash','util','moment','randomstring','ioredis','../../config/utils'];(function(_0x56139e,_0x714ec2){var _0x113526=function(_0x529c28){while(--_0x529c28){_0x56139e['push'](_0x56139e['shift']());}};_0x113526(++_0x714ec2);}(_0x7114,0xd2));var _0x4711=function(_0x2b1345,_0xed44d1){_0x2b1345=_0x2b1345-0x0;var _0x515b52=_0x7114[_0x2b1345];return _0x515b52;};'use strict';var _=require(_0x4711('0x0'));var util=require(_0x4711('0x1'));var moment=require(_0x4711('0x2'));var BPromise=require('bluebird');var rs=require(_0x4711('0x3'));var fs=require('fs');var Redis=require(_0x4711('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x4711('0x5'));var logger=require(_0x4711('0x6'))(_0x4711('0x7'));var config=require(_0x4711('0x8'));var jayson=require(_0x4711('0x9'));var client=jayson[_0x4711('0xa')][_0x4711('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2b7084,_0x5f59b0,_0xaf001f){return new BPromise(function(_0x482f47,_0x4e19ed){return client[_0x4711('0xc')](_0x2b7084,_0xaf001f)[_0x4711('0xd')](function(_0x45246a){logger[_0x4711('0xe')]('VoiceContext,\x20%s,\x20%s',_0x5f59b0,_0x4711('0xf'));logger[_0x4711('0x10')](_0x4711('0x11'),_0x5f59b0,_0x4711('0xf'),JSON[_0x4711('0x12')](_0x45246a));if(_0x45246a[_0x4711('0x13')]){if(_0x45246a[_0x4711('0x13')][_0x4711('0x14')]===0x1f4){logger[_0x4711('0x13')](_0x4711('0x15'),_0x5f59b0,_0x45246a[_0x4711('0x13')][_0x4711('0x16')]);return _0x4e19ed(_0x45246a[_0x4711('0x13')]['message']);}logger[_0x4711('0x13')](_0x4711('0x15'),_0x5f59b0,_0x45246a[_0x4711('0x13')][_0x4711('0x16')]);return _0x482f47(_0x45246a[_0x4711('0x13')]['message']);}else{logger[_0x4711('0xe')](_0x4711('0x15'),_0x5f59b0,'request\x20sent');_0x482f47(_0x45246a['result'][_0x4711('0x16')]);}})[_0x4711('0x17')](function(_0xfd1727){logger[_0x4711('0x13')](_0x4711('0x15'),_0x5f59b0,_0xfd1727);_0x4e19ed(_0xfd1727);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index a3a574b..e007c83 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 _0xf4f2=['exports','util','path','Router','../../components/auth/service','../../config/environment','index','/describe','isAuthenticated','describe','get','/:id','show','post','create','put','update','delete','destroy'];(function(_0x3bc01c,_0x1fac30){var _0x8ef9bd=function(_0x540251){while(--_0x540251){_0x3bc01c['push'](_0x3bc01c['shift']());}};_0x8ef9bd(++_0x1fac30);}(_0xf4f2,0x10b));var _0x2f4f=function(_0x30a638,_0x3d1696){_0x30a638=_0x30a638-0x0;var _0x5d9a95=_0xf4f2[_0x30a638];return _0x5d9a95;};'use strict';var multer=require('multer');var util=require(_0x2f4f('0x0'));var path=require(_0x2f4f('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x2f4f('0x2')]();var auth=require(_0x2f4f('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x2f4f('0x4'));var controller=require('./voiceDialReport.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x2f4f('0x5')]);router['get'](_0x2f4f('0x6'),auth[_0x2f4f('0x7')](),controller[_0x2f4f('0x8')]);router[_0x2f4f('0x9')](_0x2f4f('0xa'),auth['isAuthenticated'](),controller[_0x2f4f('0xb')]);router[_0x2f4f('0xc')]('/',auth['isAuthenticated'](),controller[_0x2f4f('0xd')]);router[_0x2f4f('0xe')]('/:id',auth[_0x2f4f('0x7')](),controller[_0x2f4f('0xf')]);router[_0x2f4f('0x10')]('/:id',auth[_0x2f4f('0x7')](),controller[_0x2f4f('0x11')]);module[_0x2f4f('0x12')]=router; \ No newline at end of file +var _0x92d9=['../../components/interaction/service','../../config/environment','./voiceDialReport.controller','get','isAuthenticated','/describe','describe','create','put','update','delete','/:id','destroy','connect-timeout','Router','../../components/auth/service'];(function(_0xa4842a,_0x316b8c){var _0x2bfa1c=function(_0xe1101){while(--_0xe1101){_0xa4842a['push'](_0xa4842a['shift']());}};_0x2bfa1c(++_0x316b8c);}(_0x92d9,0x6d));var _0x992d=function(_0x3f2c34,_0x22827d){_0x3f2c34=_0x3f2c34-0x0;var _0x1c2bdb=_0x92d9[_0x3f2c34];return _0x1c2bdb;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x992d('0x0'));var express=require('express');var router=express[_0x992d('0x1')]();var auth=require(_0x992d('0x2'));var interaction=require(_0x992d('0x3'));var config=require(_0x992d('0x4'));var controller=require(_0x992d('0x5'));router[_0x992d('0x6')]('/',auth[_0x992d('0x7')](),controller['index']);router['get'](_0x992d('0x8'),auth[_0x992d('0x7')](),controller[_0x992d('0x9')]);router['get']('/:id',auth[_0x992d('0x7')](),controller['show']);router['post']('/',auth[_0x992d('0x7')](),controller[_0x992d('0xa')]);router[_0x992d('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x992d('0xc')]);router[_0x992d('0xd')](_0x992d('0xe'),auth[_0x992d('0x7')](),controller[_0x992d('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index f51e84f..0e8cac8 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 _0x08fa=['sequelize','STRING','INTEGER','DATE','called,connect,complete'];(function(_0x452968,_0x31e391){var _0xb6f9ae=function(_0x263987){while(--_0x263987){_0x452968['push'](_0x452968['shift']());}};_0xb6f9ae(++_0x31e391);}(_0x08fa,0x122));var _0xa08f=function(_0x2a5dd8,_0x24ef13){_0x2a5dd8=_0x2a5dd8-0x0;var _0x4f06d5=_0x08fa[_0x2a5dd8];return _0x4f06d5;};'use strict';var Sequelize=require(_0xa08f('0x0'));module['exports']={'privilege':{'type':Sequelize[_0xa08f('0x1')]},'channel':{'type':Sequelize[_0xa08f('0x1')]},'channelstate':{'type':Sequelize[_0xa08f('0x2')]},'channelstatedesc':{'type':Sequelize[_0xa08f('0x1')]},'calleridnum':{'type':Sequelize[_0xa08f('0x1')]},'calleridname':{'type':Sequelize[_0xa08f('0x1')]},'connectedlinenum':{'type':Sequelize[_0xa08f('0x1')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xa08f('0x1')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xa08f('0x1')]},'exten':{'type':Sequelize[_0xa08f('0x1')]},'priority':{'type':Sequelize[_0xa08f('0x2')]},'uniqueid':{'type':Sequelize[_0xa08f('0x1')]},'linkedid':{'type':Sequelize[_0xa08f('0x1')]},'destchannel':{'type':Sequelize[_0xa08f('0x1')]},'destchannelstate':{'type':Sequelize[_0xa08f('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0xa08f('0x1')]},'destcalleridnum':{'type':Sequelize[_0xa08f('0x1')]},'destcalleridname':{'type':Sequelize[_0xa08f('0x1')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0xa08f('0x1')]},'destaccountcode':{'type':Sequelize[_0xa08f('0x1')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0xa08f('0x2')]},'destuniqueid':{'type':Sequelize[_0xa08f('0x1')]},'destlinkedid':{'type':Sequelize[_0xa08f('0x1')]},'dialstring':{'type':Sequelize[_0xa08f('0x1')]},'dialstatus':{'type':Sequelize[_0xa08f('0x1')]},'starttime':{'type':Sequelize[_0xa08f('0x3')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xa08f('0x3')]},'lastevent':{'type':Sequelize[_0xa08f('0x1')],'comment':_0xa08f('0x4')},'routeId':{'type':Sequelize['INTEGER']},'duration':{'type':Sequelize[_0xa08f('0x2')]},'holdtime':{'type':Sequelize[_0xa08f('0x2')]},'billableseconds':{'type':Sequelize[_0xa08f('0x2')]}}; \ No newline at end of file +var _0x70f7=['exports','STRING','INTEGER','DATE','called,connect,complete','sequelize'];(function(_0x5dafac,_0x39b6e5){var _0x1113a2=function(_0x159e1b){while(--_0x159e1b){_0x5dafac['push'](_0x5dafac['shift']());}};_0x1113a2(++_0x39b6e5);}(_0x70f7,0xbf));var _0x770f=function(_0x34c4e1,_0x310387){_0x34c4e1=_0x34c4e1-0x0;var _0x5a11ef=_0x70f7[_0x34c4e1];return _0x5a11ef;};'use strict';var Sequelize=require(_0x770f('0x0'));module[_0x770f('0x1')]={'privilege':{'type':Sequelize[_0x770f('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0x770f('0x3')]},'channelstatedesc':{'type':Sequelize[_0x770f('0x2')]},'calleridnum':{'type':Sequelize[_0x770f('0x2')]},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x770f('0x2')]},'connectedlinename':{'type':Sequelize[_0x770f('0x2')]},'language':{'type':Sequelize[_0x770f('0x2')]},'accountcode':{'type':Sequelize[_0x770f('0x2')]},'context':{'type':Sequelize[_0x770f('0x2')]},'exten':{'type':Sequelize[_0x770f('0x2')]},'priority':{'type':Sequelize[_0x770f('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0x770f('0x2')]},'destchannelstate':{'type':Sequelize[_0x770f('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x770f('0x2')]},'destcalleridnum':{'type':Sequelize[_0x770f('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x770f('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x770f('0x2')]},'destlanguage':{'type':Sequelize[_0x770f('0x2')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0x770f('0x2')]},'destexten':{'type':Sequelize[_0x770f('0x2')]},'destpriority':{'type':Sequelize[_0x770f('0x3')]},'destuniqueid':{'type':Sequelize['STRING']},'destlinkedid':{'type':Sequelize[_0x770f('0x2')]},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x770f('0x4')]},'answertime':{'type':Sequelize[_0x770f('0x4')]},'endtime':{'type':Sequelize[_0x770f('0x4')]},'lastevent':{'type':Sequelize[_0x770f('0x2')],'comment':_0x770f('0x5')},'routeId':{'type':Sequelize[_0x770f('0x3')]},'duration':{'type':Sequelize[_0x770f('0x3')]},'holdtime':{'type':Sequelize[_0x770f('0x3')]},'billableseconds':{'type':Sequelize[_0x770f('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index 1f26bbd..8deb9a5 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 _0xbf7d=['fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','end','status','offset','limit','set','Content-Range','json','apply','reject','save','then','destroy','error','stack','name','send','index','map','VoiceDialReport','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','find','create','body','update','params','html-pdf','eml-format','zip-dir'];(function(_0x2d982d,_0x121028){var _0x4f36b0=function(_0x11f3a9){while(--_0x11f3a9){_0x2d982d['push'](_0x2d982d['shift']());}};_0x4f36b0(++_0x121028);}(_0xbf7d,0x97));var _0xdbf7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbf7d[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0xdbf7('0x0'));var emlformat=require(_0xdbf7('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xdbf7('0x2'));var jsonpatch=require(_0xdbf7('0x3'));var rp=require(_0xdbf7('0x4'));var moment=require(_0xdbf7('0x5'));var BPromise=require(_0xdbf7('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xdbf7('0x7'));var sox=require(_0xdbf7('0x8'));var csv=require(_0xdbf7('0x9'));var ejs=require(_0xdbf7('0xa'));var fs=require('fs');var _=require(_0xdbf7('0xb'));var squel=require(_0xdbf7('0xc'));var crypto=require(_0xdbf7('0xd'));var jsforce=require(_0xdbf7('0xe'));var deskjs=require(_0xdbf7('0xf'));var toCsv=require('to-csv');var querystring=require(_0xdbf7('0x10'));var Papa=require(_0xdbf7('0x11'));var Redis=require(_0xdbf7('0x12'));var authService=require(_0xdbf7('0x13'));var qs=require(_0xdbf7('0x14'));var as=require(_0xdbf7('0x15'));var hardwareService=require(_0xdbf7('0x16'));var logger=require(_0xdbf7('0x17'))('api');var utils=require('../../config/utils');var config=require(_0xdbf7('0x18'));var db=require(_0xdbf7('0x19'))['db'];function respondWithStatusCode(_0x26accc,_0x2d26a8){_0x2d26a8=_0x2d26a8||0xcc;return function(_0x4a5aa9){if(_0x4a5aa9){return _0x26accc[_0xdbf7('0x1a')](_0x2d26a8);}return _0x26accc['status'](_0x2d26a8)[_0xdbf7('0x1b')]();};}function respondWithResult(_0x54a431,_0x300bbf){_0x300bbf=_0x300bbf||0xc8;return function(_0x45ac47){if(_0x45ac47){return _0x54a431[_0xdbf7('0x1c')](_0x300bbf)['json'](_0x45ac47);}};}function respondWithFilteredResult(_0x4bd010,_0x500487){return function(_0x5e41d6){if(_0x5e41d6){var _0x3d249f=_0x5e41d6['count'],_0x39bb91=_0x500487[_0xdbf7('0x1d')],_0x1a6c1f=_0x500487[_0xdbf7('0x1d')]+_0x500487[_0xdbf7('0x1e')],_0x929ad4;if(_0x1a6c1f>=_0x3d249f){_0x1a6c1f=_0x3d249f;_0x929ad4=0xc8;}else{_0x929ad4=0xce;}_0x4bd010['status'](_0x929ad4);return _0x4bd010[_0xdbf7('0x1f')](_0xdbf7('0x20'),_0x39bb91+'-'+_0x1a6c1f+'/'+_0x3d249f)[_0xdbf7('0x21')](_0x5e41d6);}return null;};}function patchUpdates(_0x959bd2){return function(_0x50af15){try{jsonpatch[_0xdbf7('0x22')](_0x50af15,_0x959bd2,!![]);}catch(_0x34a1f3){return BPromise[_0xdbf7('0x23')](_0x34a1f3);}return _0x50af15[_0xdbf7('0x24')]();};}function saveUpdates(_0x3618f2,_0x3328e3){return function(_0x1776b8){if(_0x1776b8){return _0x1776b8['update'](_0x3618f2)[_0xdbf7('0x25')](function(_0x52e941){return _0x52e941;});}return null;};}function removeEntity(_0x40d22d,_0x112340){return function(_0x2f4404){if(_0x2f4404){return _0x2f4404[_0xdbf7('0x26')]()[_0xdbf7('0x25')](function(){_0x40d22d['status'](0xcc)[_0xdbf7('0x1b')]();});}};}function handleEntityNotFound(_0xde94fc,_0x1358c3){return function(_0x3015c2){if(!_0x3015c2){_0xde94fc[_0xdbf7('0x1a')](0x194);}return _0x3015c2;};}function handleError(_0xe354fd,_0x4f967a){_0x4f967a=_0x4f967a||0x1f4;return function(_0x299d8e){logger[_0xdbf7('0x27')](_0x299d8e[_0xdbf7('0x28')]);if(_0x299d8e[_0xdbf7('0x29')]){delete _0x299d8e[_0xdbf7('0x29')];}_0xe354fd[_0xdbf7('0x1c')](_0x4f967a)[_0xdbf7('0x2a')](_0x299d8e);};}exports[_0xdbf7('0x2b')]=function(_0x1d8d3a,_0x31797b){var _0x2ee52b={},_0x20e03a={},_0x496db7={'count':0x0,'rows':[]};var _0x58d67e=_[_0xdbf7('0x2c')](db[_0xdbf7('0x2d')][_0xdbf7('0x2e')],function(_0x392bc3){return{'name':_0x392bc3['fieldName'],'type':_0x392bc3[_0xdbf7('0x2f')]['key']};});_0x20e03a[_0xdbf7('0x30')]=_[_0xdbf7('0x2c')](_0x58d67e,'name');_0x20e03a[_0xdbf7('0x31')]=_[_0xdbf7('0x32')](_0x1d8d3a[_0xdbf7('0x31')]);_0x20e03a[_0xdbf7('0x33')]=_[_0xdbf7('0x34')](_0x20e03a[_0xdbf7('0x30')],_0x20e03a[_0xdbf7('0x31')]);_0x2ee52b[_0xdbf7('0x35')]=_[_0xdbf7('0x34')](_0x20e03a[_0xdbf7('0x30')],qs[_0xdbf7('0x36')](_0x1d8d3a[_0xdbf7('0x31')][_0xdbf7('0x36')]));_0x2ee52b[_0xdbf7('0x35')]=_0x2ee52b[_0xdbf7('0x35')][_0xdbf7('0x37')]?_0x2ee52b[_0xdbf7('0x35')]:_0x20e03a['model'];if(!_0x1d8d3a[_0xdbf7('0x31')][_0xdbf7('0x38')](_0xdbf7('0x39'))){_0x2ee52b[_0xdbf7('0x1e')]=qs[_0xdbf7('0x1e')](_0x1d8d3a[_0xdbf7('0x31')]['limit']);_0x2ee52b[_0xdbf7('0x1d')]=qs[_0xdbf7('0x1d')](_0x1d8d3a[_0xdbf7('0x31')][_0xdbf7('0x1d')]);}_0x2ee52b['order']=qs[_0xdbf7('0x3a')](_0x1d8d3a[_0xdbf7('0x31')][_0xdbf7('0x3a')]);_0x2ee52b['where']=qs[_0xdbf7('0x33')](_[_0xdbf7('0x3b')](_0x1d8d3a[_0xdbf7('0x31')],_0x20e03a['filters']));if(_0x1d8d3a[_0xdbf7('0x31')][_0xdbf7('0x3c')]){_0x2ee52b[_0xdbf7('0x3d')]=_[_0xdbf7('0x3e')](_0x2ee52b[_0xdbf7('0x3d')],{'$or':_[_0xdbf7('0x2c')](_0x58d67e,function(_0x44b03a){if(_0x44b03a[_0xdbf7('0x2f')]!==_0xdbf7('0x3f')){var _0x5692f9={};_0x5692f9[_0x44b03a[_0xdbf7('0x29')]]={'$like':'%'+_0x1d8d3a[_0xdbf7('0x31')]['filter']+'%'};return _0x5692f9;}})});}_0x2ee52b=_[_0xdbf7('0x3e')]({},_0x2ee52b,_0x1d8d3a[_0xdbf7('0x40')]);var _0x279aaf={'where':_0x2ee52b['where']};return db[_0xdbf7('0x2d')]['count'](_0x279aaf)[_0xdbf7('0x25')](function(_0x2c6d29){_0x496db7[_0xdbf7('0x41')]=_0x2c6d29;if(_0x1d8d3a['query'][_0xdbf7('0x42')]){_0x2ee52b[_0xdbf7('0x43')]=[{'all':!![]}];}return db[_0xdbf7('0x2d')][_0xdbf7('0x44')](_0x2ee52b);})[_0xdbf7('0x25')](function(_0x49b256){_0x496db7[_0xdbf7('0x45')]=_0x49b256;return _0x496db7;})[_0xdbf7('0x25')](respondWithFilteredResult(_0x31797b,_0x2ee52b))[_0xdbf7('0x46')](handleError(_0x31797b,null));};exports[_0xdbf7('0x47')]=function(_0x5a137b,_0xdd7c79){var _0x39f08b={'raw':!![],'where':{'id':_0x5a137b['params']['id']}},_0x2064aa={};_0x2064aa[_0xdbf7('0x30')]=_[_0xdbf7('0x32')](db[_0xdbf7('0x2d')]['rawAttributes']);_0x2064aa['query']=_['keys'](_0x5a137b[_0xdbf7('0x31')]);_0x2064aa[_0xdbf7('0x33')]=_['intersection'](_0x2064aa[_0xdbf7('0x30')],_0x2064aa[_0xdbf7('0x31')]);_0x39f08b['attributes']=_['intersection'](_0x2064aa['model'],qs[_0xdbf7('0x36')](_0x5a137b[_0xdbf7('0x31')][_0xdbf7('0x36')]));_0x39f08b[_0xdbf7('0x35')]=_0x39f08b[_0xdbf7('0x35')]['length']?_0x39f08b[_0xdbf7('0x35')]:_0x2064aa[_0xdbf7('0x30')];if(_0x5a137b['query']['includeAll']){_0x39f08b[_0xdbf7('0x43')]=[{'all':!![]}];}_0x39f08b=_[_0xdbf7('0x3e')]({},_0x39f08b,_0x5a137b['options']);return db['VoiceDialReport'][_0xdbf7('0x48')](_0x39f08b)['then'](handleEntityNotFound(_0xdd7c79,null))[_0xdbf7('0x25')](respondWithResult(_0xdd7c79,null))[_0xdbf7('0x46')](handleError(_0xdd7c79,null));};exports[_0xdbf7('0x49')]=function(_0x306380,_0x39a237){return db[_0xdbf7('0x2d')][_0xdbf7('0x49')](_0x306380[_0xdbf7('0x4a')],{})[_0xdbf7('0x25')](respondWithResult(_0x39a237,0xc9))['catch'](handleError(_0x39a237,null));};exports[_0xdbf7('0x4b')]=function(_0x413221,_0x4e0a62){if(_0x413221['body']['id']){delete _0x413221[_0xdbf7('0x4a')]['id'];}return db[_0xdbf7('0x2d')][_0xdbf7('0x48')]({'where':{'id':_0x413221[_0xdbf7('0x4c')]['id']}})[_0xdbf7('0x25')](handleEntityNotFound(_0x4e0a62,null))[_0xdbf7('0x25')](saveUpdates(_0x413221['body'],null))[_0xdbf7('0x25')](respondWithResult(_0x4e0a62,null))['catch'](handleError(_0x4e0a62,null));};exports[_0xdbf7('0x26')]=function(_0x13e28d,_0x5ce09f){return db[_0xdbf7('0x2d')][_0xdbf7('0x48')]({'where':{'id':_0x13e28d[_0xdbf7('0x4c')]['id']}})[_0xdbf7('0x25')](handleEntityNotFound(_0x5ce09f,null))[_0xdbf7('0x25')](removeEntity(_0x5ce09f,null))[_0xdbf7('0x46')](handleError(_0x5ce09f,null));};exports['describe']=function(_0x52d18d,_0x11bdef){return db[_0xdbf7('0x2d')]['describe']()['then'](respondWithResult(_0x11bdef,null))[_0xdbf7('0x46')](handleError(_0x11bdef,null));}; \ No newline at end of file +var _0x13b6=['filter','options','includeAll','include','findAll','rows','catch','params','intersection','length','create','body','update','find','describe','html-pdf','eml-format','rimraf','zip-dir','request-promise','mustache','util','path','to-csv','ejs','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','stack','send','index','map','VoiceDialReport','rawAttributes','fieldName','type','name','query','keys','filters','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL'];(function(_0x46d4f8,_0x30b1d2){var _0x3582e8=function(_0xc2fc68){while(--_0xc2fc68){_0x46d4f8['push'](_0x46d4f8['shift']());}};_0x3582e8(++_0x30b1d2);}(_0x13b6,0xe7));var _0x613b=function(_0x14df38,_0x4c3dc2){_0x14df38=_0x14df38-0x0;var _0x14c571=_0x13b6[_0x14df38];return _0x14c571;};'use strict';var pdf=require(_0x613b('0x0'));var emlformat=require(_0x613b('0x1'));var rimraf=require(_0x613b('0x2'));var zipdir=require(_0x613b('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x613b('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x613b('0x5'));var util=require(_0x613b('0x6'));var path=require(_0x613b('0x7'));var sox=require('sox');var csv=require(_0x613b('0x8'));var ejs=require(_0x613b('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x613b('0xa'));var jsforce=require(_0x613b('0xb'));var deskjs=require(_0x613b('0xc'));var toCsv=require(_0x613b('0x8'));var querystring=require(_0x613b('0xd'));var Papa=require('papaparse');var Redis=require(_0x613b('0xe'));var authService=require(_0x613b('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x613b('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x613b('0x11'))('api');var utils=require(_0x613b('0x12'));var config=require('../../config/environment');var db=require(_0x613b('0x13'))['db'];function respondWithStatusCode(_0x2220c7,_0x1973a4){_0x1973a4=_0x1973a4||0xcc;return function(_0x122544){if(_0x122544){return _0x2220c7[_0x613b('0x14')](_0x1973a4);}return _0x2220c7[_0x613b('0x15')](_0x1973a4)[_0x613b('0x16')]();};}function respondWithResult(_0x529f52,_0x2766b6){_0x2766b6=_0x2766b6||0xc8;return function(_0x574ca0){if(_0x574ca0){return _0x529f52[_0x613b('0x15')](_0x2766b6)[_0x613b('0x17')](_0x574ca0);}};}function respondWithFilteredResult(_0x4b6ae6,_0x4f79a8){return function(_0x4d0149){if(_0x4d0149){var _0x2cd19e=_0x4d0149[_0x613b('0x18')],_0x3e39b0=_0x4f79a8[_0x613b('0x19')],_0x532346=_0x4f79a8[_0x613b('0x19')]+_0x4f79a8[_0x613b('0x1a')],_0x38addf;if(_0x532346>=_0x2cd19e){_0x532346=_0x2cd19e;_0x38addf=0xc8;}else{_0x38addf=0xce;}_0x4b6ae6['status'](_0x38addf);return _0x4b6ae6[_0x613b('0x1b')](_0x613b('0x1c'),_0x3e39b0+'-'+_0x532346+'/'+_0x2cd19e)[_0x613b('0x17')](_0x4d0149);}return null;};}function patchUpdates(_0x454553){return function(_0x25d8b7){try{jsonpatch['apply'](_0x25d8b7,_0x454553,!![]);}catch(_0x3fd615){return BPromise[_0x613b('0x1d')](_0x3fd615);}return _0x25d8b7[_0x613b('0x1e')]();};}function saveUpdates(_0x5b20b6,_0x271df3){return function(_0x5b71ec){if(_0x5b71ec){return _0x5b71ec['update'](_0x5b20b6)[_0x613b('0x1f')](function(_0x5c51c0){return _0x5c51c0;});}return null;};}function removeEntity(_0x4c315a,_0xa1a1f6){return function(_0x5cb9a){if(_0x5cb9a){return _0x5cb9a[_0x613b('0x20')]()['then'](function(){_0x4c315a['status'](0xcc)[_0x613b('0x16')]();});}};}function handleEntityNotFound(_0x31dae9,_0x406990){return function(_0x4b316f){if(!_0x4b316f){_0x31dae9['sendStatus'](0x194);}return _0x4b316f;};}function handleError(_0x17bac6,_0x4de6c6){_0x4de6c6=_0x4de6c6||0x1f4;return function(_0x593e4){logger[_0x613b('0x21')](_0x593e4[_0x613b('0x22')]);if(_0x593e4['name']){delete _0x593e4['name'];}_0x17bac6[_0x613b('0x15')](_0x4de6c6)[_0x613b('0x23')](_0x593e4);};}exports[_0x613b('0x24')]=function(_0x4b8f7c,_0x574fae){var _0x4ac534={},_0x110ee1={},_0x2169b8={'count':0x0,'rows':[]};var _0x3c1419=_[_0x613b('0x25')](db[_0x613b('0x26')][_0x613b('0x27')],function(_0x30f3da){return{'name':_0x30f3da[_0x613b('0x28')],'type':_0x30f3da[_0x613b('0x29')]['key']};});_0x110ee1['model']=_[_0x613b('0x25')](_0x3c1419,_0x613b('0x2a'));_0x110ee1[_0x613b('0x2b')]=_[_0x613b('0x2c')](_0x4b8f7c[_0x613b('0x2b')]);_0x110ee1[_0x613b('0x2d')]=_['intersection'](_0x110ee1['model'],_0x110ee1[_0x613b('0x2b')]);_0x4ac534['attributes']=_['intersection'](_0x110ee1[_0x613b('0x2e')],qs[_0x613b('0x2f')](_0x4b8f7c[_0x613b('0x2b')][_0x613b('0x2f')]));_0x4ac534[_0x613b('0x30')]=_0x4ac534[_0x613b('0x30')]['length']?_0x4ac534[_0x613b('0x30')]:_0x110ee1[_0x613b('0x2e')];if(!_0x4b8f7c[_0x613b('0x2b')][_0x613b('0x31')](_0x613b('0x32'))){_0x4ac534[_0x613b('0x1a')]=qs[_0x613b('0x1a')](_0x4b8f7c[_0x613b('0x2b')][_0x613b('0x1a')]);_0x4ac534[_0x613b('0x19')]=qs[_0x613b('0x19')](_0x4b8f7c[_0x613b('0x2b')][_0x613b('0x19')]);}_0x4ac534[_0x613b('0x33')]=qs[_0x613b('0x34')](_0x4b8f7c[_0x613b('0x2b')][_0x613b('0x34')]);_0x4ac534[_0x613b('0x35')]=qs[_0x613b('0x2d')](_[_0x613b('0x36')](_0x4b8f7c[_0x613b('0x2b')],_0x110ee1[_0x613b('0x2d')]));if(_0x4b8f7c[_0x613b('0x2b')]['filter']){_0x4ac534[_0x613b('0x35')]=_[_0x613b('0x37')](_0x4ac534[_0x613b('0x35')],{'$or':_['map'](_0x3c1419,function(_0xc6aeec){if(_0xc6aeec['type']!==_0x613b('0x38')){var _0x4629e0={};_0x4629e0[_0xc6aeec[_0x613b('0x2a')]]={'$like':'%'+_0x4b8f7c[_0x613b('0x2b')][_0x613b('0x39')]+'%'};return _0x4629e0;}})});}_0x4ac534=_['merge']({},_0x4ac534,_0x4b8f7c[_0x613b('0x3a')]);var _0x5e18d3={'where':_0x4ac534[_0x613b('0x35')]};return db['VoiceDialReport'][_0x613b('0x18')](_0x5e18d3)[_0x613b('0x1f')](function(_0x54aee2){_0x2169b8[_0x613b('0x18')]=_0x54aee2;if(_0x4b8f7c['query'][_0x613b('0x3b')]){_0x4ac534[_0x613b('0x3c')]=[{'all':!![]}];}return db[_0x613b('0x26')][_0x613b('0x3d')](_0x4ac534);})[_0x613b('0x1f')](function(_0x219ef8){_0x2169b8[_0x613b('0x3e')]=_0x219ef8;return _0x2169b8;})[_0x613b('0x1f')](respondWithFilteredResult(_0x574fae,_0x4ac534))[_0x613b('0x3f')](handleError(_0x574fae,null));};exports['show']=function(_0x57969a,_0x2c05de){var _0x5c493d={'raw':!![],'where':{'id':_0x57969a[_0x613b('0x40')]['id']}},_0x5ccdd3={};_0x5ccdd3['model']=_[_0x613b('0x2c')](db[_0x613b('0x26')][_0x613b('0x27')]);_0x5ccdd3[_0x613b('0x2b')]=_[_0x613b('0x2c')](_0x57969a[_0x613b('0x2b')]);_0x5ccdd3[_0x613b('0x2d')]=_[_0x613b('0x41')](_0x5ccdd3[_0x613b('0x2e')],_0x5ccdd3[_0x613b('0x2b')]);_0x5c493d[_0x613b('0x30')]=_['intersection'](_0x5ccdd3[_0x613b('0x2e')],qs[_0x613b('0x2f')](_0x57969a[_0x613b('0x2b')]['fields']));_0x5c493d['attributes']=_0x5c493d[_0x613b('0x30')][_0x613b('0x42')]?_0x5c493d[_0x613b('0x30')]:_0x5ccdd3['model'];if(_0x57969a[_0x613b('0x2b')][_0x613b('0x3b')]){_0x5c493d[_0x613b('0x3c')]=[{'all':!![]}];}_0x5c493d=_['merge']({},_0x5c493d,_0x57969a[_0x613b('0x3a')]);return db[_0x613b('0x26')]['find'](_0x5c493d)[_0x613b('0x1f')](handleEntityNotFound(_0x2c05de,null))[_0x613b('0x1f')](respondWithResult(_0x2c05de,null))['catch'](handleError(_0x2c05de,null));};exports[_0x613b('0x43')]=function(_0x443df4,_0x17e2ef){return db[_0x613b('0x26')][_0x613b('0x43')](_0x443df4[_0x613b('0x44')],{})[_0x613b('0x1f')](respondWithResult(_0x17e2ef,0xc9))[_0x613b('0x3f')](handleError(_0x17e2ef,null));};exports[_0x613b('0x45')]=function(_0x477f0e,_0x5ada47){if(_0x477f0e['body']['id']){delete _0x477f0e[_0x613b('0x44')]['id'];}return db[_0x613b('0x26')][_0x613b('0x46')]({'where':{'id':_0x477f0e['params']['id']}})['then'](handleEntityNotFound(_0x5ada47,null))['then'](saveUpdates(_0x477f0e['body'],null))[_0x613b('0x1f')](respondWithResult(_0x5ada47,null))[_0x613b('0x3f')](handleError(_0x5ada47,null));};exports[_0x613b('0x20')]=function(_0x475a6d,_0x2a201d){return db['VoiceDialReport'][_0x613b('0x46')]({'where':{'id':_0x475a6d[_0x613b('0x40')]['id']}})[_0x613b('0x1f')](handleEntityNotFound(_0x2a201d,null))['then'](removeEntity(_0x2a201d,null))['catch'](handleError(_0x2a201d,null));};exports[_0x613b('0x47')]=function(_0x12443d,_0x20c172){return db['VoiceDialReport'][_0x613b('0x47')]()['then'](respondWithResult(_0x20c172,null))[_0x613b('0x3f')](handleError(_0x20c172,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 82fa55c..eaffdad 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 _0x1e61=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceDialReport.attributes','uniqueid','util','../../config/logger','api'];(function(_0x2c944e,_0x26f659){var _0x2cc529=function(_0x3fbc4b){while(--_0x3fbc4b){_0x2c944e['push'](_0x2c944e['shift']());}};_0x2cc529(++_0x26f659);}(_0x1e61,0x105));var _0x11e6=function(_0x50c913,_0x59ee71){_0x50c913=_0x50c913-0x0;var _0x2635db=_0x1e61[_0x50c913];return _0x2635db;};'use strict';var _=require('lodash');var util=require(_0x11e6('0x0'));var logger=require(_0x11e6('0x1'))(_0x11e6('0x2'));var moment=require(_0x11e6('0x3'));var BPromise=require(_0x11e6('0x4'));var rp=require(_0x11e6('0x5'));var fs=require('fs');var path=require(_0x11e6('0x6'));var rimraf=require(_0x11e6('0x7'));var config=require(_0x11e6('0x8'));var attributes=require(_0x11e6('0x9'));module['exports']=function(_0x4f2bb7,_0x299e5c){return _0x4f2bb7['define']('VoiceDialReport',attributes,{'tableName':'report_dial','paranoid':![],'indexes':[{'fields':[_0x11e6('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x14ba=['lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','VoiceDialReport','report_dial'];(function(_0x19859b,_0x37f8d9){var _0x1a2741=function(_0x2e6196){while(--_0x2e6196){_0x19859b['push'](_0x19859b['shift']());}};_0x1a2741(++_0x37f8d9);}(_0x14ba,0x10e));var _0xa14b=function(_0x169034,_0x39f0d0){_0x169034=_0x169034-0x0;var _0x4cfbe6=_0x14ba[_0x169034];return _0x4cfbe6;};'use strict';var _=require(_0xa14b('0x0'));var util=require(_0xa14b('0x1'));var logger=require(_0xa14b('0x2'))(_0xa14b('0x3'));var moment=require('moment');var BPromise=require(_0xa14b('0x4'));var rp=require(_0xa14b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa14b('0x6'));var config=require(_0xa14b('0x7'));var attributes=require('./voiceDialReport.attributes');module['exports']=function(_0x5b0e1b,_0x213294){return _0x5b0e1b['define'](_0xa14b('0x8'),attributes,{'tableName':_0xa14b('0x9'),'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 d46465a..a888d95 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 _0x9ade=['options','raw','update','where','attributes','limit','UpdateVoiceDialReport','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateVoiceDialReport','VoiceDialReport','create','body'];(function(_0x55c97d,_0x228ffc){var _0x1d5112=function(_0x2ab908){while(--_0x2ab908){_0x55c97d['push'](_0x55c97d['shift']());}};_0x1d5112(++_0x228ffc);}(_0x9ade,0x107));var _0xe9ad=function(_0x35197d,_0x33eda7){_0x35197d=_0x35197d-0x0;var _0x157a26=_0x9ade[_0x35197d];return _0x157a26;};'use strict';var _=require(_0xe9ad('0x0'));var util=require(_0xe9ad('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xe9ad('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe9ad('0x3'))['db'];var utils=require(_0xe9ad('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xe9ad('0x5'));var jayson=require(_0xe9ad('0x6'));var client=jayson[_0xe9ad('0x7')][_0xe9ad('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x308564,_0x6ede7f,_0xb4b663){return new BPromise(function(_0x1a297b,_0x4b16b5){return client[_0xe9ad('0x9')](_0x308564,_0xb4b663)[_0xe9ad('0xa')](function(_0x32d7d0){logger[_0xe9ad('0xb')](_0xe9ad('0xc'),_0x6ede7f,_0xe9ad('0xd'));logger[_0xe9ad('0xe')](_0xe9ad('0xf'),_0x6ede7f,_0xe9ad('0xd'),JSON[_0xe9ad('0x10')](_0x32d7d0));if(_0x32d7d0[_0xe9ad('0x11')]){if(_0x32d7d0[_0xe9ad('0x11')]['code']===0x1f4){logger[_0xe9ad('0x11')](_0xe9ad('0xc'),_0x6ede7f,_0x32d7d0[_0xe9ad('0x11')][_0xe9ad('0x12')]);return _0x4b16b5(_0x32d7d0['error'][_0xe9ad('0x12')]);}logger[_0xe9ad('0x11')](_0xe9ad('0xc'),_0x6ede7f,_0x32d7d0[_0xe9ad('0x11')]['message']);return _0x1a297b(_0x32d7d0[_0xe9ad('0x11')]['message']);}else{logger[_0xe9ad('0xb')]('VoiceDialReport,\x20%s,\x20%s',_0x6ede7f,_0xe9ad('0xd'));_0x1a297b(_0x32d7d0[_0xe9ad('0x13')][_0xe9ad('0x12')]);}})[_0xe9ad('0x14')](function(_0x58151c){logger[_0xe9ad('0x11')](_0xe9ad('0xc'),_0x6ede7f,_0x58151c);_0x4b16b5(_0x58151c);});});}exports[_0xe9ad('0x15')]=function(_0x2b9437){var _0x2f11c9=this;return new Promise(function(_0x1a55f9,_0x59e349){return db[_0xe9ad('0x16')][_0xe9ad('0x17')](_0x2b9437[_0xe9ad('0x18')],{'raw':_0x2b9437[_0xe9ad('0x19')]?_0x2b9437[_0xe9ad('0x19')][_0xe9ad('0x1a')]===undefined?!![]:![]:!![]})[_0xe9ad('0xa')](function(_0x2ecac0){logger[_0xe9ad('0xb')]('CreateVoiceDialReport',_0x2b9437);logger[_0xe9ad('0xe')]('CreateVoiceDialReport',_0x2b9437,JSON[_0xe9ad('0x10')](_0x2ecac0));_0x1a55f9(_0x2ecac0);})['catch'](function(_0xe4ddc1){logger[_0xe9ad('0x11')](_0xe9ad('0x15'),_0xe4ddc1[_0xe9ad('0x12')],_0x2b9437);_0x59e349(_0x2f11c9[_0xe9ad('0x11')](0x1f4,_0xe4ddc1['message']));});});};exports['UpdateVoiceDialReport']=function(_0x40a6ce){var _0x2d2ef4=this;return new Promise(function(_0x281b6a,_0x465d10){return db[_0xe9ad('0x16')][_0xe9ad('0x1b')](_0x40a6ce[_0xe9ad('0x18')],{'raw':_0x40a6ce[_0xe9ad('0x19')]?_0x40a6ce['options'][_0xe9ad('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x40a6ce[_0xe9ad('0x19')]?_0x40a6ce[_0xe9ad('0x19')][_0xe9ad('0x1c')]||null:null,'attributes':_0x40a6ce['options']?_0x40a6ce[_0xe9ad('0x19')][_0xe9ad('0x1d')]||null:null,'limit':_0x40a6ce[_0xe9ad('0x19')]?_0x40a6ce[_0xe9ad('0x19')][_0xe9ad('0x1e')]||null:null})[_0xe9ad('0xa')](function(_0x564be7){logger[_0xe9ad('0xb')](_0xe9ad('0x1f'),_0x40a6ce);logger[_0xe9ad('0xe')](_0xe9ad('0x1f'),_0x40a6ce,JSON['stringify'](_0x564be7));_0x281b6a(_0x564be7);})[_0xe9ad('0x14')](function(_0x319da5){logger[_0xe9ad('0x11')](_0xe9ad('0x1f'),_0x319da5[_0xe9ad('0x12')],_0x40a6ce);_0x465d10(_0x2d2ef4[_0xe9ad('0x11')](0x1f4,_0x319da5['message']));});});}; \ No newline at end of file +var _0xb31a=['create','body','options','raw','debug','update','limit','UpdateVoiceDialReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','CreateVoiceDialReport','VoiceDialReport'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb31a,0xd4));var _0xab31=function(_0x3efb62,_0x521e4b){_0x3efb62=_0x3efb62-0x0;var _0x852069=_0xb31a[_0x3efb62];return _0x852069;};'use strict';var _=require(_0xab31('0x0'));var util=require(_0xab31('0x1'));var moment=require(_0xab31('0x2'));var BPromise=require(_0xab31('0x3'));var rs=require(_0xab31('0x4'));var fs=require('fs');var Redis=require(_0xab31('0x5'));var db=require(_0xab31('0x6'))['db'];var utils=require(_0xab31('0x7'));var logger=require(_0xab31('0x8'))(_0xab31('0x9'));var config=require(_0xab31('0xa'));var jayson=require(_0xab31('0xb'));var client=jayson[_0xab31('0xc')][_0xab31('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x2b8f95,_0x53ee8e,_0x45b0ef){return new BPromise(function(_0x1eaa9c,_0x48be26){return client[_0xab31('0xe')](_0x2b8f95,_0x45b0ef)[_0xab31('0xf')](function(_0xfcbafd){logger[_0xab31('0x10')](_0xab31('0x11'),_0x53ee8e,_0xab31('0x12'));logger['debug']('VoiceDialReport,\x20%s,\x20%s,\x20%s',_0x53ee8e,_0xab31('0x12'),JSON[_0xab31('0x13')](_0xfcbafd));if(_0xfcbafd['error']){if(_0xfcbafd[_0xab31('0x14')][_0xab31('0x15')]===0x1f4){logger[_0xab31('0x14')]('VoiceDialReport,\x20%s,\x20%s',_0x53ee8e,_0xfcbafd['error'][_0xab31('0x16')]);return _0x48be26(_0xfcbafd[_0xab31('0x14')][_0xab31('0x16')]);}logger[_0xab31('0x14')](_0xab31('0x11'),_0x53ee8e,_0xfcbafd[_0xab31('0x14')][_0xab31('0x16')]);return _0x1eaa9c(_0xfcbafd[_0xab31('0x14')][_0xab31('0x16')]);}else{logger['info']('VoiceDialReport,\x20%s,\x20%s',_0x53ee8e,_0xab31('0x12'));_0x1eaa9c(_0xfcbafd['result'][_0xab31('0x16')]);}})[_0xab31('0x17')](function(_0x3b803d){logger[_0xab31('0x14')](_0xab31('0x11'),_0x53ee8e,_0x3b803d);_0x48be26(_0x3b803d);});});}exports[_0xab31('0x18')]=function(_0x1b3f47){var _0x4c7d92=this;return new Promise(function(_0x2015cd,_0x3c56a6){return db[_0xab31('0x19')][_0xab31('0x1a')](_0x1b3f47[_0xab31('0x1b')],{'raw':_0x1b3f47['options']?_0x1b3f47[_0xab31('0x1c')][_0xab31('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x483e73){logger[_0xab31('0x10')](_0xab31('0x18'),_0x1b3f47);logger[_0xab31('0x1e')]('CreateVoiceDialReport',_0x1b3f47,JSON[_0xab31('0x13')](_0x483e73));_0x2015cd(_0x483e73);})[_0xab31('0x17')](function(_0x4a723c){logger['error'](_0xab31('0x18'),_0x4a723c[_0xab31('0x16')],_0x1b3f47);_0x3c56a6(_0x4c7d92[_0xab31('0x14')](0x1f4,_0x4a723c[_0xab31('0x16')]));});});};exports['UpdateVoiceDialReport']=function(_0x3a9997){var _0x5db7fd=this;return new Promise(function(_0x192f44,_0x1ceba6){return db['VoiceDialReport'][_0xab31('0x1f')](_0x3a9997['body'],{'raw':_0x3a9997[_0xab31('0x1c')]?_0x3a9997[_0xab31('0x1c')][_0xab31('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3a9997['options']?_0x3a9997[_0xab31('0x1c')]['where']||null:null,'attributes':_0x3a9997['options']?_0x3a9997[_0xab31('0x1c')]['attributes']||null:null,'limit':_0x3a9997[_0xab31('0x1c')]?_0x3a9997['options'][_0xab31('0x20')]||null:null})[_0xab31('0xf')](function(_0x30473c){logger[_0xab31('0x10')](_0xab31('0x21'),_0x3a9997);logger[_0xab31('0x1e')](_0xab31('0x21'),_0x3a9997,JSON[_0xab31('0x13')](_0x30473c));_0x192f44(_0x30473c);})[_0xab31('0x17')](function(_0x95a4b9){logger[_0xab31('0x14')](_0xab31('0x21'),_0x95a4b9[_0xab31('0x16')],_0x3a9997);_0x1ceba6(_0x5db7fd['error'](0x1f4,_0x95a4b9[_0xab31('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index bd5d0e4..7013745 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 _0xf0ab=['show','create','isAuthenticated','addApplications','update','delete','destroy','exports','multer','path','express','Router','../../components/interaction/service','./voiceExtension.controller','get','/:id'];(function(_0x531d15,_0x599af5){var _0x271a18=function(_0x31284d){while(--_0x31284d){_0x531d15['push'](_0x531d15['shift']());}};_0x271a18(++_0x599af5);}(_0xf0ab,0xd8));var _0xbf0a=function(_0x33defc,_0x4197a6){_0x33defc=_0x33defc-0x0;var _0x52cd4b=_0xf0ab[_0x33defc];return _0x52cd4b;};'use strict';var multer=require(_0xbf0a('0x0'));var util=require('util');var path=require(_0xbf0a('0x1'));var timeout=require('connect-timeout');var express=require(_0xbf0a('0x2'));var router=express[_0xbf0a('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xbf0a('0x4'));var config=require('../../config/environment');var controller=require(_0xbf0a('0x5'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xbf0a('0x6')](_0xbf0a('0x7'),auth['isAuthenticated'](),controller[_0xbf0a('0x8')]);router['post']('/',auth['isAuthenticated'](),controller[_0xbf0a('0x9')]);router['post']('/:id/applications',auth[_0xbf0a('0xa')](),controller[_0xbf0a('0xb')]);router['put'](_0xbf0a('0x7'),auth[_0xbf0a('0xa')](),controller[_0xbf0a('0xc')]);router[_0xbf0a('0xd')](_0xbf0a('0x7'),auth['isAuthenticated'](),controller[_0xbf0a('0xe')]);module[_0xbf0a('0xf')]=router; \ No newline at end of file +var _0x5799=['index','get','/:id','isAuthenticated','show','post','/:id/applications','addApplications','put','update','destroy','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./voiceExtension.controller'];(function(_0x32eee9,_0x26e24e){var _0x315059=function(_0x59c2c3){while(--_0x59c2c3){_0x32eee9['push'](_0x32eee9['shift']());}};_0x315059(++_0x26e24e);}(_0x5799,0x91));var _0x9579=function(_0x2c778e,_0x43a4d3){_0x2c778e=_0x2c778e-0x0;var _0x58055b=_0x5799[_0x2c778e];return _0x58055b;};'use strict';var multer=require('multer');var util=require(_0x9579('0x0'));var path=require(_0x9579('0x1'));var timeout=require(_0x9579('0x2'));var express=require('express');var router=express[_0x9579('0x3')]();var auth=require(_0x9579('0x4'));var interaction=require(_0x9579('0x5'));var config=require('../../config/environment');var controller=require(_0x9579('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x9579('0x7')]);router[_0x9579('0x8')](_0x9579('0x9'),auth[_0x9579('0xa')](),controller[_0x9579('0xb')]);router[_0x9579('0xc')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x9579('0xd'),auth['isAuthenticated'](),controller[_0x9579('0xe')]);router[_0x9579('0xf')]('/:id',auth[_0x9579('0xa')](),controller[_0x9579('0x10')]);router['delete'](_0x9579('0x9'),auth[_0x9579('0xa')](),controller[_0x9579('0x11')]);module[_0x9579('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index 2072986..a81f39d 100644 --- a/server/api/voiceExtension/voiceExtension.attributes.js +++ b/server/api/voiceExtension/voiceExtension.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['*,*,*,*','INTEGER','BOOLEAN','VIRTUAL','getDataValue','exten','sequelize','exports','STRING','compositeIndex','NoOp','inbound','outbound','internal','system'];(function(_0x5baa35,_0x6c437e){var _0x1cdbc6=function(_0x3a6fac){while(--_0x3a6fac){_0x5baa35['push'](_0x5baa35['shift']());}};_0x1cdbc6(++_0x6c437e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xa9e0[_0x19e35c];return _0x3e1fe8;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'context':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x0a9e('0x3')},'priority':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'1','unique':_0x0a9e('0x3')},'tag':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'defaultValue':_0x0a9e('0x4')},'appdata':{'type':Sequelize[_0x0a9e('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x5'),_0x0a9e('0x6'),_0x0a9e('0x7'),'inbound-fax','outbound-fax',_0x0a9e('0x8'),'any'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'defaultValue':_0x0a9e('0x9')},'IntervalId':{'type':Sequelize[_0x0a9e('0xa')]},'isApp':{'type':Sequelize[_0x0a9e('0xb')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':!![]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'cutdigits':{'type':Sequelize['INTEGER']},'recordingFormat':{'type':Sequelize['STRING'],'defaultValue':'wav'},'answer':{'type':Sequelize[_0x0a9e('0xb')],'defaultValue':!![]},'name':{'type':Sequelize[_0x0a9e('0xc')],'get':function(_0xd5b662){return this[_0x0a9e('0xd')](_0x0a9e('0xe'));}}}; \ No newline at end of file +var _0xa9e0=['*,*,*,*','INTEGER','BOOLEAN','VIRTUAL','getDataValue','exten','sequelize','exports','STRING','compositeIndex','NoOp','inbound','outbound','internal','system'];(function(_0xe23cd0,_0xf3b4a1){var _0x2f5cc2=function(_0x4db5b5){while(--_0x4db5b5){_0xe23cd0['push'](_0xe23cd0['shift']());}};_0x2f5cc2(++_0xf3b4a1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0xa9e0[_0x9aada2];return _0x196dff;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'context':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x0a9e('0x3')},'priority':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'1','unique':_0x0a9e('0x3')},'tag':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'defaultValue':_0x0a9e('0x4')},'appdata':{'type':Sequelize[_0x0a9e('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x5'),_0x0a9e('0x6'),_0x0a9e('0x7'),'inbound-fax','outbound-fax',_0x0a9e('0x8'),'any'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'defaultValue':_0x0a9e('0x9')},'IntervalId':{'type':Sequelize[_0x0a9e('0xa')]},'isApp':{'type':Sequelize[_0x0a9e('0xb')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':!![]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'cutdigits':{'type':Sequelize['INTEGER']},'recordingFormat':{'type':Sequelize['STRING'],'defaultValue':'wav'},'answer':{'type':Sequelize[_0x0a9e('0xb')],'defaultValue':!![]},'name':{'type':Sequelize[_0x0a9e('0xc')],'get':function(_0xd5b662){return this[_0x0a9e('0xd')](_0x0a9e('0xe'));}}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index 184389c..3406ecf 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 _0x8742=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','description','recordingFormat','cutdigits','mandatoryDisposition','addApplications','findOne','sequelize','transaction','VoiceExtensionId','bulkCreate','findAndCountAll','html-pdf','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','sendStatus','status','end','json','count','offset','set','apply','reject','save','update','destroy','then','get','InboundRoutes','inbound','OutboundRoutes','outbound','InternalRoutes','internal','filter','ignore','map','value','includes','find','type','name','UserProfileResource','error','stack','rawAttributes','fieldName','key','query','intersection','attributes','model','fields','length','hasOwnProperty','limit','sort','where','filters','pick','merge','VIRTUAL','VoiceExtension','includeAll','include','findAll','rows','catch','params','keys','body','startsWith','exten','concat','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation'];(function(_0x7f8b61,_0x4fa837){var _0x16e761=function(_0x1872ee){while(--_0x1872ee){_0x7f8b61['push'](_0x7f8b61['shift']());}};_0x16e761(++_0x4fa837);}(_0x8742,0xe9));var _0x2874=function(_0x3ef63a,_0x20b5d7){_0x3ef63a=_0x3ef63a-0x0;var _0x168f26=_0x8742[_0x3ef63a];return _0x168f26;};'use strict';var pdf=require(_0x2874('0x0'));var emlformat=require(_0x2874('0x1'));var rimraf=require(_0x2874('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2874('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x2874('0x4'));var Mustache=require(_0x2874('0x5'));var util=require(_0x2874('0x6'));var path=require(_0x2874('0x7'));var sox=require(_0x2874('0x8'));var csv=require(_0x2874('0x9'));var ejs=require(_0x2874('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x2874('0xb'));var crypto=require(_0x2874('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x2874('0xd'));var toCsv=require(_0x2874('0x9'));var querystring=require(_0x2874('0xe'));var Papa=require(_0x2874('0xf'));var Redis=require(_0x2874('0x10'));var authService=require(_0x2874('0x11'));var qs=require(_0x2874('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2874('0x13'));var logger=require(_0x2874('0x14'))(_0x2874('0x15'));var utils=require(_0x2874('0x16'));var config=require(_0x2874('0x17'));var db=require(_0x2874('0x18'))['db'];config[_0x2874('0x19')]=_[_0x2874('0x1a')](config[_0x2874('0x19')],{'host':_0x2874('0x1b'),'port':0x18eb});var socket=require(_0x2874('0x1c'))(new Redis(config[_0x2874('0x19')]));require(_0x2874('0x1d'))[_0x2874('0x1e')](socket);function respondWithStatusCode(_0x172ce5,_0x294249){_0x294249=_0x294249||0xcc;return function(_0x23ba93){if(_0x23ba93){return _0x172ce5[_0x2874('0x1f')](_0x294249);}return _0x172ce5[_0x2874('0x20')](_0x294249)[_0x2874('0x21')]();};}function respondWithResult(_0x59f353,_0x3ae330){_0x3ae330=_0x3ae330||0xc8;return function(_0x4b963c){if(_0x4b963c){return _0x59f353[_0x2874('0x20')](_0x3ae330)[_0x2874('0x22')](_0x4b963c);}};}function respondWithFilteredResult(_0x2723a6,_0x49712f){return function(_0x38a313){if(_0x38a313){var _0x4bdb0e=_0x38a313[_0x2874('0x23')],_0x37f415=_0x49712f['offset'],_0x531265=_0x49712f[_0x2874('0x24')]+_0x49712f['limit'],_0x2c37e9;if(_0x531265>=_0x4bdb0e){_0x531265=_0x4bdb0e;_0x2c37e9=0xc8;}else{_0x2c37e9=0xce;}_0x2723a6[_0x2874('0x20')](_0x2c37e9);return _0x2723a6[_0x2874('0x25')]('Content-Range',_0x37f415+'-'+_0x531265+'/'+_0x4bdb0e)[_0x2874('0x22')](_0x38a313);}return null;};}function patchUpdates(_0x2ddb25){return function(_0x56dd70){try{jsonpatch[_0x2874('0x26')](_0x56dd70,_0x2ddb25,!![]);}catch(_0x1b7efb){return BPromise[_0x2874('0x27')](_0x1b7efb);}return _0x56dd70[_0x2874('0x28')]();};}function saveUpdates(_0x15adbb,_0x4f0c9f){return function(_0x171fe1){if(_0x171fe1){return _0x171fe1[_0x2874('0x29')](_0x15adbb)['then'](function(_0x2a0e55){return _0x2a0e55;});}return null;};}function removeEntity(_0x44acb4,_0x801d5b){return function(_0x5dcd40){if(_0x5dcd40){return _0x5dcd40[_0x2874('0x2a')]()[_0x2874('0x2b')](function(){var _0x19cac2=_0x5dcd40[_0x2874('0x2c')]({'plain':!![]});var _0x480795=[{'name':_0x2874('0x2d'),'value':_0x2874('0x2e'),'ignore':![]},{'name':_0x2874('0x2f'),'value':_0x2874('0x30'),'ignore':![]},{'name':_0x2874('0x31'),'value':_0x2874('0x32'),'ignore':![]}];var _0x59019d=_(_0x480795)[_0x2874('0x33')](_0x2874('0x34'))[_0x2874('0x35')](_0x2874('0x36'))[_0x2874('0x36')]();if(_[_0x2874('0x37')](_0x59019d,_0x19cac2['type'])){return;}var _0x2c3a10=_[_0x2874('0x38')](_0x480795,['value',_0x19cac2[_0x2874('0x39')]])[_0x2874('0x3a')];return db[_0x2874('0x3b')][_0x2874('0x2a')]({'where':{'type':_0x2c3a10,'resourceId':_0x19cac2['id']}})[_0x2874('0x2b')](function(){return _0x5dcd40;});})[_0x2874('0x2b')](function(){_0x44acb4[_0x2874('0x20')](0xcc)[_0x2874('0x21')]();});}};}function handleEntityNotFound(_0x3c1f94,_0x4c33d6){return function(_0x34e0bf){if(!_0x34e0bf){_0x3c1f94[_0x2874('0x1f')](0x194);}return _0x34e0bf;};}function handleError(_0x143bfe,_0x8b08ce){_0x8b08ce=_0x8b08ce||0x1f4;return function(_0x2c6ec0){logger[_0x2874('0x3c')](_0x2c6ec0[_0x2874('0x3d')]);if(_0x2c6ec0[_0x2874('0x3a')]){delete _0x2c6ec0['name'];}_0x143bfe['status'](_0x8b08ce)['send'](_0x2c6ec0);};}exports['index']=function(_0x4b705f,_0x53f574){var _0x2a01e7={},_0x296dac={},_0x7996fc={'count':0x0,'rows':[]};var _0x2dcae4=_[_0x2874('0x35')](db['VoiceExtension'][_0x2874('0x3e')],function(_0x1a9722){return{'name':_0x1a9722[_0x2874('0x3f')],'type':_0x1a9722[_0x2874('0x39')][_0x2874('0x40')]};});_0x296dac['model']=_[_0x2874('0x35')](_0x2dcae4,_0x2874('0x3a'));_0x296dac[_0x2874('0x41')]=_['keys'](_0x4b705f[_0x2874('0x41')]);_0x296dac['filters']=_[_0x2874('0x42')](_0x296dac['model'],_0x296dac['query']);_0x2a01e7[_0x2874('0x43')]=_['intersection'](_0x296dac[_0x2874('0x44')],qs[_0x2874('0x45')](_0x4b705f[_0x2874('0x41')][_0x2874('0x45')]));_0x2a01e7[_0x2874('0x43')]=_0x2a01e7[_0x2874('0x43')][_0x2874('0x46')]?_0x2a01e7[_0x2874('0x43')]:_0x296dac['model'];if(!_0x4b705f['query'][_0x2874('0x47')]('nolimit')){_0x2a01e7[_0x2874('0x48')]=qs[_0x2874('0x48')](_0x4b705f[_0x2874('0x41')][_0x2874('0x48')]);_0x2a01e7[_0x2874('0x24')]=qs[_0x2874('0x24')](_0x4b705f[_0x2874('0x41')][_0x2874('0x24')]);}_0x2a01e7['order']=qs[_0x2874('0x49')](_0x4b705f[_0x2874('0x41')]['sort']);_0x2a01e7[_0x2874('0x4a')]=qs[_0x2874('0x4b')](_[_0x2874('0x4c')](_0x4b705f['query'],_0x296dac[_0x2874('0x4b')]));if(_0x4b705f[_0x2874('0x41')]['filter']){_0x2a01e7[_0x2874('0x4a')]=_[_0x2874('0x4d')](_0x2a01e7['where'],{'$or':_['map'](_0x2dcae4,function(_0x4d18f3){if(_0x4d18f3[_0x2874('0x39')]!==_0x2874('0x4e')){var _0x30721a={};_0x30721a[_0x4d18f3['name']]={'$like':'%'+_0x4b705f[_0x2874('0x41')][_0x2874('0x33')]+'%'};return _0x30721a;}})});}_0x2a01e7=_['merge']({},_0x2a01e7,_0x4b705f['options']);var _0x50d4b9={'where':_0x2a01e7[_0x2874('0x4a')]};return db[_0x2874('0x4f')][_0x2874('0x23')](_0x50d4b9)[_0x2874('0x2b')](function(_0x4e894f){_0x7996fc[_0x2874('0x23')]=_0x4e894f;if(_0x4b705f[_0x2874('0x41')][_0x2874('0x50')]){_0x2a01e7[_0x2874('0x51')]=[{'all':!![]}];}return db['VoiceExtension'][_0x2874('0x52')](_0x2a01e7);})[_0x2874('0x2b')](function(_0x803ccd){_0x7996fc[_0x2874('0x53')]=_0x803ccd;return _0x7996fc;})[_0x2874('0x2b')](respondWithFilteredResult(_0x53f574,_0x2a01e7))[_0x2874('0x54')](handleError(_0x53f574,null));};exports['show']=function(_0x59e18b,_0x5e528c){var _0x24fcdf={'raw':![],'where':{'id':_0x59e18b[_0x2874('0x55')]['id']}},_0x992b95={};_0x992b95[_0x2874('0x44')]=_['keys'](db[_0x2874('0x4f')][_0x2874('0x3e')]);_0x992b95[_0x2874('0x41')]=_[_0x2874('0x56')](_0x59e18b[_0x2874('0x41')]);_0x992b95[_0x2874('0x4b')]=_['intersection'](_0x992b95[_0x2874('0x44')],_0x992b95[_0x2874('0x41')]);_0x24fcdf[_0x2874('0x43')]=_[_0x2874('0x42')](_0x992b95[_0x2874('0x44')],qs[_0x2874('0x45')](_0x59e18b[_0x2874('0x41')]['fields']));_0x24fcdf[_0x2874('0x43')]=_0x24fcdf[_0x2874('0x43')]['length']?_0x24fcdf[_0x2874('0x43')]:_0x992b95[_0x2874('0x44')];if(_0x59e18b[_0x2874('0x41')][_0x2874('0x50')]){_0x24fcdf[_0x2874('0x51')]=[{'all':!![]}];}_0x24fcdf=_[_0x2874('0x4d')]({},_0x24fcdf,_0x59e18b['options']);return db['VoiceExtension'][_0x2874('0x38')](_0x24fcdf)[_0x2874('0x2b')](handleEntityNotFound(_0x5e528c,null))[_0x2874('0x2b')](respondWithResult(_0x5e528c,null))[_0x2874('0x54')](handleError(_0x5e528c,null));};exports[_0x2874('0x2a')]=function(_0x2d1ee6,_0x114832){return db[_0x2874('0x4f')]['find']({'where':{'id':_0x2d1ee6[_0x2874('0x55')]['id']}})['then'](handleEntityNotFound(_0x114832,null))[_0x2874('0x2b')](removeEntity(_0x114832,null))[_0x2874('0x54')](handleError(_0x114832,null));};exports['create']=function(_0x29b1c9,_0x14f855){if(_0x29b1c9[_0x2874('0x57')][_0x2874('0x39')]===_0x2874('0x30')&&!_[_0x2874('0x58')](_0x29b1c9[_0x2874('0x57')][_0x2874('0x59')],'_')){_0x29b1c9[_0x2874('0x57')][_0x2874('0x59')]='_'[_0x2874('0x5a')](_0x29b1c9['body'][_0x2874('0x59')]);}return db['VoiceExtension'][_0x2874('0x5b')](_0x29b1c9[_0x2874('0x57')],{'raw':![]})[_0x2874('0x2b')](function(_0x2cf945){var _0xd7a69c=_0x29b1c9['user'][_0x2874('0x2c')]({'plain':!![]});if(!_0xd7a69c)throw new Error(_0x2874('0x5c'));if(_0xd7a69c[_0x2874('0x5d')]===_0x2874('0x5e')){var _0x5adeab=_0x2cf945['get']({'plain':!![]});var _0x569f49=[{'name':_0x2874('0x2d'),'value':_0x2874('0x2e')},{'name':'OutboundRoutes','value':'outbound'},{'name':_0x2874('0x31'),'value':_0x2874('0x32')}];var _0x494fdd=_[_0x2874('0x38')](_0x569f49,[_0x2874('0x36'),_0x5adeab[_0x2874('0x39')]])[_0x2874('0x3a')];return db[_0x2874('0x5f')]['find']({'where':{'name':_0x494fdd,'userProfileId':_0xd7a69c['userProfileId']},'raw':!![]})[_0x2874('0x2b')](function(_0x4e3cbb){if(_0x4e3cbb&&_0x4e3cbb[_0x2874('0x60')]===0x0){return db['UserProfileResource'][_0x2874('0x5b')]({'name':_0x5adeab[_0x2874('0x3a')],'resourceId':_0x5adeab['id'],'type':_0x4e3cbb['name'],'sectionId':_0x4e3cbb['id']},{})['then'](function(){return _0x2cf945;});}else{return _0x2cf945;}})[_0x2874('0x54')](function(_0x1d2f5a){logger[_0x2874('0x3c')](_0x2874('0x61'),_0x1d2f5a);throw _0x1d2f5a;});}return _0x2cf945;})[_0x2874('0x2b')](respondWithResult(_0x14f855,0xc9))[_0x2874('0x54')](handleError(_0x14f855,null));};exports['update']=function(_0x3a96d1,_0x3d1a13){if(_0x3a96d1[_0x2874('0x57')]['id']){delete _0x3a96d1[_0x2874('0x57')]['id'];}return db[_0x2874('0x4f')]['find']({'where':{'id':_0x3a96d1[_0x2874('0x55')]['id']}})[_0x2874('0x2b')](handleEntityNotFound(_0x3d1a13,null))[_0x2874('0x2b')](function(_0x137e9f){if(_0x137e9f){return db[_0x2874('0x4f')]['update'](_['pick'](_0x3a96d1[_0x2874('0x57')],[_0x2874('0x59'),_0x2874('0x62'),_0x2874('0x63'),_0x2874('0x64'),_0x2874('0x65'),_0x2874('0x66')]),{'where':{'context':_0x137e9f['context'],'exten':_0x137e9f[_0x2874('0x59')]},'individualHooks':!![]})['then'](function(_0x2039d9){return _0x2039d9;});}return null;})[_0x2874('0x2b')](respondWithStatusCode(_0x3d1a13,null))[_0x2874('0x54')](handleError(_0x3d1a13,null));};exports[_0x2874('0x67')]=function(_0xe5978e,_0x4f5f02,_0xfede56){return db[_0x2874('0x4f')][_0x2874('0x68')]({'where':{'id':_0xe5978e[_0x2874('0x55')]['id']}})[_0x2874('0x2b')](handleEntityNotFound(_0x4f5f02,null))[_0x2874('0x2b')](function(_0x4cc191){if(_0x4cc191){return db[_0x2874('0x69')][_0x2874('0x6a')](function(_0x47a07b){return db[_0x2874('0x4f')]['destroy']({'where':{'VoiceExtensionId':_0xe5978e[_0x2874('0x55')]['id']},'transaction':_0x47a07b})[_0x2874('0x2b')](function(_0x115e40){var _0x1e50a4=_[_0x2874('0x35')](_0xe5978e[_0x2874('0x57')],function(_0x521efd){_0x521efd[_0x2874('0x6b')]=_0xe5978e['params']['id'];return _0x521efd;});return db['VoiceExtension'][_0x2874('0x6c')](_0x1e50a4,{'transaction':_0x47a07b});});})[_0x2874('0x2b')](function(){return db[_0x2874('0x4f')][_0x2874('0x6d')]({'where':{'isApp':!![],'VoiceExtensionId':_0xe5978e[_0x2874('0x55')]['id']},'order':'cast(priority\x20as\x20unsigned)'});});}})[_0x2874('0x2b')](respondWithResult(_0x4f5f02,null))[_0x2874('0x54')](handleError(_0x4f5f02,null));}; \ No newline at end of file +var _0xdc59=['json','offset','limit','set','Content-Range','apply','save','update','then','get','InboundRoutes','inbound','OutboundRoutes','outbound','filter','ignore','map','value','includes','find','name','destroy','error','stack','index','VoiceExtension','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','count','findAll','rows','catch','show','params','fields','includeAll','include','options','create','body','startsWith','exten','user','role','internal','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','description','recordingFormat','cutdigits','mandatoryDisposition','findOne','sequelize','transaction','VoiceExtensionId','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../mysqldb','redis','localhost','socket.io-emitter','./voiceExtension.socket','sendStatus','status'];(function(_0x4accce,_0x1136a5){var _0x16d06a=function(_0x408190){while(--_0x408190){_0x4accce['push'](_0x4accce['shift']());}};_0x16d06a(++_0x1136a5);}(_0xdc59,0x19c));var _0x9dc5=function(_0x79b649,_0x2115b3){_0x79b649=_0x79b649-0x0;var _0x1af9b1=_0xdc59[_0x79b649];return _0x1af9b1;};'use strict';var pdf=require(_0x9dc5('0x0'));var emlformat=require(_0x9dc5('0x1'));var rimraf=require(_0x9dc5('0x2'));var zipdir=require(_0x9dc5('0x3'));var jsonpatch=require(_0x9dc5('0x4'));var rp=require(_0x9dc5('0x5'));var moment=require(_0x9dc5('0x6'));var BPromise=require(_0x9dc5('0x7'));var Mustache=require(_0x9dc5('0x8'));var util=require(_0x9dc5('0x9'));var path=require(_0x9dc5('0xa'));var sox=require('sox');var csv=require(_0x9dc5('0xb'));var ejs=require(_0x9dc5('0xc'));var fs=require('fs');var _=require(_0x9dc5('0xd'));var squel=require(_0x9dc5('0xe'));var crypto=require(_0x9dc5('0xf'));var jsforce=require(_0x9dc5('0x10'));var deskjs=require(_0x9dc5('0x11'));var toCsv=require('to-csv');var querystring=require(_0x9dc5('0x12'));var Papa=require(_0x9dc5('0x13'));var Redis=require(_0x9dc5('0x14'));var authService=require(_0x9dc5('0x15'));var qs=require(_0x9dc5('0x16'));var as=require(_0x9dc5('0x17'));var hardwareService=require(_0x9dc5('0x18'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x9dc5('0x19'))['db'];config[_0x9dc5('0x1a')]=_['defaults'](config[_0x9dc5('0x1a')],{'host':_0x9dc5('0x1b'),'port':0x18eb});var socket=require(_0x9dc5('0x1c'))(new Redis(config[_0x9dc5('0x1a')]));require(_0x9dc5('0x1d'))['register'](socket);function respondWithStatusCode(_0x26acbe,_0x253aaa){_0x253aaa=_0x253aaa||0xcc;return function(_0x5f11a9){if(_0x5f11a9){return _0x26acbe[_0x9dc5('0x1e')](_0x253aaa);}return _0x26acbe[_0x9dc5('0x1f')](_0x253aaa)['end']();};}function respondWithResult(_0x1f6892,_0x52d328){_0x52d328=_0x52d328||0xc8;return function(_0x597094){if(_0x597094){return _0x1f6892[_0x9dc5('0x1f')](_0x52d328)[_0x9dc5('0x20')](_0x597094);}};}function respondWithFilteredResult(_0x4d3c01,_0x218391){return function(_0x979cb7){if(_0x979cb7){var _0x5c149e=_0x979cb7['count'],_0x16dd10=_0x218391['offset'],_0x4e7eac=_0x218391[_0x9dc5('0x21')]+_0x218391[_0x9dc5('0x22')],_0x37e13d;if(_0x4e7eac>=_0x5c149e){_0x4e7eac=_0x5c149e;_0x37e13d=0xc8;}else{_0x37e13d=0xce;}_0x4d3c01['status'](_0x37e13d);return _0x4d3c01[_0x9dc5('0x23')](_0x9dc5('0x24'),_0x16dd10+'-'+_0x4e7eac+'/'+_0x5c149e)[_0x9dc5('0x20')](_0x979cb7);}return null;};}function patchUpdates(_0x1dd5f4){return function(_0x6499e8){try{jsonpatch[_0x9dc5('0x25')](_0x6499e8,_0x1dd5f4,!![]);}catch(_0x11bb41){return BPromise['reject'](_0x11bb41);}return _0x6499e8[_0x9dc5('0x26')]();};}function saveUpdates(_0x3ae6b5,_0x5dfd11){return function(_0x57e4bb){if(_0x57e4bb){return _0x57e4bb[_0x9dc5('0x27')](_0x3ae6b5)[_0x9dc5('0x28')](function(_0x40c264){return _0x40c264;});}return null;};}function removeEntity(_0xad553f,_0x59d6fa){return function(_0x3cd18f){if(_0x3cd18f){return _0x3cd18f['destroy']()[_0x9dc5('0x28')](function(){var _0x30f354=_0x3cd18f[_0x9dc5('0x29')]({'plain':!![]});var _0x413b8f=[{'name':_0x9dc5('0x2a'),'value':_0x9dc5('0x2b'),'ignore':![]},{'name':_0x9dc5('0x2c'),'value':_0x9dc5('0x2d'),'ignore':![]},{'name':'InternalRoutes','value':'internal','ignore':![]}];var _0x403e66=_(_0x413b8f)[_0x9dc5('0x2e')](_0x9dc5('0x2f'))[_0x9dc5('0x30')](_0x9dc5('0x31'))[_0x9dc5('0x31')]();if(_[_0x9dc5('0x32')](_0x403e66,_0x30f354['type'])){return;}var _0x2b2bc7=_[_0x9dc5('0x33')](_0x413b8f,[_0x9dc5('0x31'),_0x30f354['type']])[_0x9dc5('0x34')];return db['UserProfileResource'][_0x9dc5('0x35')]({'where':{'type':_0x2b2bc7,'resourceId':_0x30f354['id']}})[_0x9dc5('0x28')](function(){return _0x3cd18f;});})[_0x9dc5('0x28')](function(){_0xad553f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x273f9b,_0x545e9){return function(_0x40c4d4){if(!_0x40c4d4){_0x273f9b[_0x9dc5('0x1e')](0x194);}return _0x40c4d4;};}function handleError(_0x377e24,_0x58613c){_0x58613c=_0x58613c||0x1f4;return function(_0x4850b8){logger[_0x9dc5('0x36')](_0x4850b8[_0x9dc5('0x37')]);if(_0x4850b8['name']){delete _0x4850b8[_0x9dc5('0x34')];}_0x377e24['status'](_0x58613c)['send'](_0x4850b8);};}exports[_0x9dc5('0x38')]=function(_0x1bdca0,_0xd86997){var _0x1aeb4c={},_0xb81845={},_0x1c0a9f={'count':0x0,'rows':[]};var _0xc446b1=_[_0x9dc5('0x30')](db[_0x9dc5('0x39')][_0x9dc5('0x3a')],function(_0x174180){return{'name':_0x174180[_0x9dc5('0x3b')],'type':_0x174180[_0x9dc5('0x3c')][_0x9dc5('0x3d')]};});_0xb81845[_0x9dc5('0x3e')]=_[_0x9dc5('0x30')](_0xc446b1,_0x9dc5('0x34'));_0xb81845[_0x9dc5('0x3f')]=_[_0x9dc5('0x40')](_0x1bdca0[_0x9dc5('0x3f')]);_0xb81845[_0x9dc5('0x41')]=_[_0x9dc5('0x42')](_0xb81845['model'],_0xb81845['query']);_0x1aeb4c['attributes']=_['intersection'](_0xb81845['model'],qs['fields'](_0x1bdca0['query']['fields']));_0x1aeb4c[_0x9dc5('0x43')]=_0x1aeb4c['attributes'][_0x9dc5('0x44')]?_0x1aeb4c[_0x9dc5('0x43')]:_0xb81845[_0x9dc5('0x3e')];if(!_0x1bdca0[_0x9dc5('0x3f')][_0x9dc5('0x45')](_0x9dc5('0x46'))){_0x1aeb4c[_0x9dc5('0x22')]=qs[_0x9dc5('0x22')](_0x1bdca0['query'][_0x9dc5('0x22')]);_0x1aeb4c[_0x9dc5('0x21')]=qs['offset'](_0x1bdca0[_0x9dc5('0x3f')][_0x9dc5('0x21')]);}_0x1aeb4c[_0x9dc5('0x47')]=qs[_0x9dc5('0x48')](_0x1bdca0['query'][_0x9dc5('0x48')]);_0x1aeb4c[_0x9dc5('0x49')]=qs[_0x9dc5('0x41')](_[_0x9dc5('0x4a')](_0x1bdca0['query'],_0xb81845[_0x9dc5('0x41')]));if(_0x1bdca0[_0x9dc5('0x3f')]['filter']){_0x1aeb4c[_0x9dc5('0x49')]=_[_0x9dc5('0x4b')](_0x1aeb4c[_0x9dc5('0x49')],{'$or':_[_0x9dc5('0x30')](_0xc446b1,function(_0xf76f56){if(_0xf76f56[_0x9dc5('0x3c')]!==_0x9dc5('0x4c')){var _0x1ce3fd={};_0x1ce3fd[_0xf76f56[_0x9dc5('0x34')]]={'$like':'%'+_0x1bdca0[_0x9dc5('0x3f')][_0x9dc5('0x2e')]+'%'};return _0x1ce3fd;}})});}_0x1aeb4c=_[_0x9dc5('0x4b')]({},_0x1aeb4c,_0x1bdca0['options']);var _0x3e5048={'where':_0x1aeb4c['where']};return db[_0x9dc5('0x39')][_0x9dc5('0x4d')](_0x3e5048)['then'](function(_0x2807dc){_0x1c0a9f[_0x9dc5('0x4d')]=_0x2807dc;if(_0x1bdca0[_0x9dc5('0x3f')]['includeAll']){_0x1aeb4c['include']=[{'all':!![]}];}return db[_0x9dc5('0x39')][_0x9dc5('0x4e')](_0x1aeb4c);})[_0x9dc5('0x28')](function(_0xfb42e){_0x1c0a9f[_0x9dc5('0x4f')]=_0xfb42e;return _0x1c0a9f;})[_0x9dc5('0x28')](respondWithFilteredResult(_0xd86997,_0x1aeb4c))[_0x9dc5('0x50')](handleError(_0xd86997,null));};exports[_0x9dc5('0x51')]=function(_0x54c465,_0x228e6a){var _0xbe711c={'raw':![],'where':{'id':_0x54c465[_0x9dc5('0x52')]['id']}},_0x1834d1={};_0x1834d1['model']=_[_0x9dc5('0x40')](db[_0x9dc5('0x39')]['rawAttributes']);_0x1834d1['query']=_[_0x9dc5('0x40')](_0x54c465['query']);_0x1834d1[_0x9dc5('0x41')]=_[_0x9dc5('0x42')](_0x1834d1[_0x9dc5('0x3e')],_0x1834d1[_0x9dc5('0x3f')]);_0xbe711c['attributes']=_['intersection'](_0x1834d1[_0x9dc5('0x3e')],qs[_0x9dc5('0x53')](_0x54c465[_0x9dc5('0x3f')]['fields']));_0xbe711c[_0x9dc5('0x43')]=_0xbe711c[_0x9dc5('0x43')][_0x9dc5('0x44')]?_0xbe711c[_0x9dc5('0x43')]:_0x1834d1[_0x9dc5('0x3e')];if(_0x54c465[_0x9dc5('0x3f')][_0x9dc5('0x54')]){_0xbe711c[_0x9dc5('0x55')]=[{'all':!![]}];}_0xbe711c=_['merge']({},_0xbe711c,_0x54c465[_0x9dc5('0x56')]);return db[_0x9dc5('0x39')][_0x9dc5('0x33')](_0xbe711c)[_0x9dc5('0x28')](handleEntityNotFound(_0x228e6a,null))[_0x9dc5('0x28')](respondWithResult(_0x228e6a,null))[_0x9dc5('0x50')](handleError(_0x228e6a,null));};exports[_0x9dc5('0x35')]=function(_0x2c7ab8,_0xceed26){return db['VoiceExtension'][_0x9dc5('0x33')]({'where':{'id':_0x2c7ab8['params']['id']}})['then'](handleEntityNotFound(_0xceed26,null))[_0x9dc5('0x28')](removeEntity(_0xceed26,null))[_0x9dc5('0x50')](handleError(_0xceed26,null));};exports[_0x9dc5('0x57')]=function(_0x216d13,_0x1c24d8){if(_0x216d13[_0x9dc5('0x58')][_0x9dc5('0x3c')]==='outbound'&&!_[_0x9dc5('0x59')](_0x216d13[_0x9dc5('0x58')][_0x9dc5('0x5a')],'_')){_0x216d13[_0x9dc5('0x58')][_0x9dc5('0x5a')]='_'['concat'](_0x216d13[_0x9dc5('0x58')][_0x9dc5('0x5a')]);}return db[_0x9dc5('0x39')][_0x9dc5('0x57')](_0x216d13[_0x9dc5('0x58')],{'raw':![]})[_0x9dc5('0x28')](function(_0x467d3c){var _0x29ec6e=_0x216d13[_0x9dc5('0x5b')][_0x9dc5('0x29')]({'plain':!![]});if(!_0x29ec6e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x29ec6e[_0x9dc5('0x5c')]===_0x9dc5('0x5b')){var _0x4862bd=_0x467d3c[_0x9dc5('0x29')]({'plain':!![]});var _0xd64a93=[{'name':_0x9dc5('0x2a'),'value':'inbound'},{'name':'OutboundRoutes','value':'outbound'},{'name':'InternalRoutes','value':_0x9dc5('0x5d')}];var _0x3f8ab3=_[_0x9dc5('0x33')](_0xd64a93,[_0x9dc5('0x31'),_0x4862bd[_0x9dc5('0x3c')]])[_0x9dc5('0x34')];return db[_0x9dc5('0x5e')][_0x9dc5('0x33')]({'where':{'name':_0x3f8ab3,'userProfileId':_0x29ec6e[_0x9dc5('0x5f')]},'raw':!![]})[_0x9dc5('0x28')](function(_0x12a8ef){if(_0x12a8ef&&_0x12a8ef[_0x9dc5('0x60')]===0x0){return db[_0x9dc5('0x61')][_0x9dc5('0x57')]({'name':_0x4862bd['name'],'resourceId':_0x4862bd['id'],'type':_0x12a8ef['name'],'sectionId':_0x12a8ef['id']},{})[_0x9dc5('0x28')](function(){return _0x467d3c;});}else{return _0x467d3c;}})[_0x9dc5('0x50')](function(_0x16355d){logger[_0x9dc5('0x36')](_0x9dc5('0x62'),_0x16355d);throw _0x16355d;});}return _0x467d3c;})['then'](respondWithResult(_0x1c24d8,0xc9))['catch'](handleError(_0x1c24d8,null));};exports['update']=function(_0x37f217,_0x121358){if(_0x37f217[_0x9dc5('0x58')]['id']){delete _0x37f217['body']['id'];}return db[_0x9dc5('0x39')]['find']({'where':{'id':_0x37f217[_0x9dc5('0x52')]['id']}})[_0x9dc5('0x28')](handleEntityNotFound(_0x121358,null))['then'](function(_0x271b24){if(_0x271b24){return db['VoiceExtension'][_0x9dc5('0x27')](_['pick'](_0x37f217['body'],['exten',_0x9dc5('0x63'),_0x9dc5('0x64'),_0x9dc5('0x65'),_0x9dc5('0x66'),_0x9dc5('0x67')]),{'where':{'context':_0x271b24['context'],'exten':_0x271b24[_0x9dc5('0x5a')]},'individualHooks':!![]})[_0x9dc5('0x28')](function(_0x3b3bf8){return _0x3b3bf8;});}return null;})[_0x9dc5('0x28')](respondWithStatusCode(_0x121358,null))[_0x9dc5('0x50')](handleError(_0x121358,null));};exports['addApplications']=function(_0x440105,_0x57eca8,_0x384c17){return db[_0x9dc5('0x39')][_0x9dc5('0x68')]({'where':{'id':_0x440105['params']['id']}})[_0x9dc5('0x28')](handleEntityNotFound(_0x57eca8,null))[_0x9dc5('0x28')](function(_0x570dbc){if(_0x570dbc){return db[_0x9dc5('0x69')][_0x9dc5('0x6a')](function(_0x116e55){return db[_0x9dc5('0x39')][_0x9dc5('0x35')]({'where':{'VoiceExtensionId':_0x440105[_0x9dc5('0x52')]['id']},'transaction':_0x116e55})[_0x9dc5('0x28')](function(_0x22da35){var _0x47e2b4=_['map'](_0x440105[_0x9dc5('0x58')],function(_0x34dc58){_0x34dc58[_0x9dc5('0x6b')]=_0x440105['params']['id'];return _0x34dc58;});return db[_0x9dc5('0x39')][_0x9dc5('0x6c')](_0x47e2b4,{'transaction':_0x116e55});});})[_0x9dc5('0x28')](function(){return db['VoiceExtension'][_0x9dc5('0x6d')]({'where':{'isApp':!![],'VoiceExtensionId':_0x440105[_0x9dc5('0x52')]['id']},'order':_0x9dc5('0x6e')});});}})[_0x9dc5('0x28')](respondWithResult(_0x57eca8,null))[_0x9dc5('0x50')](handleError(_0x57eca8,null));}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index 345cc30..60dd62d 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 _0x66a5=['save','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','VoiceExtension','setMaxListeners'];(function(_0x3f3ed7,_0x24ddf8){var _0x5cd280=function(_0x4e9232){while(--_0x4e9232){_0x3f3ed7['push'](_0x3f3ed7['shift']());}};_0x5cd280(++_0x24ddf8);}(_0x66a5,0x1e6));var _0x566a=function(_0x301148,_0x25b884){_0x301148=_0x301148-0x0;var _0x42ce24=_0x66a5[_0x301148];return _0x42ce24;};'use strict';var EventEmitter=require(_0x566a('0x0'));var VoiceExtension=require(_0x566a('0x1'))['db'][_0x566a('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x566a('0x3')](0x0);var events={'afterCreate':_0x566a('0x4'),'afterUpdate':'update','afterDestroy':_0x566a('0x5')};function emitEvent(_0x39569a){return function(_0x36c74e,_0x4fbd6f,_0x5e2fce){VoiceExtensionEvents[_0x566a('0x6')](_0x39569a+':'+_0x36c74e['id'],_0x36c74e);VoiceExtensionEvents[_0x566a('0x6')](_0x39569a,_0x36c74e);_0x5e2fce(null);};}for(var e in events){if(events[_0x566a('0x7')](e)){var event=events[e];VoiceExtension[_0x566a('0x8')](e,emitEvent(event));}}module[_0x566a('0x9')]=VoiceExtensionEvents; \ No newline at end of file +var _0x5708=['remove','hasOwnProperty','exports','events','../../mysqldb','VoiceExtension','save','update'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x5708,0x73));var _0x8570=function(_0x243843,_0x54e29c){_0x243843=_0x243843-0x0;var _0x328c63=_0x5708[_0x243843];return _0x328c63;};'use strict';var EventEmitter=require(_0x8570('0x0'));var VoiceExtension=require(_0x8570('0x1'))['db'][_0x8570('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x8570('0x3'),'afterUpdate':_0x8570('0x4'),'afterDestroy':_0x8570('0x5')};function emitEvent(_0x33751f){return function(_0x88d0b3,_0x1acb6b,_0x3257f1){VoiceExtensionEvents['emit'](_0x33751f+':'+_0x88d0b3['id'],_0x88d0b3);VoiceExtensionEvents['emit'](_0x33751f,_0x88d0b3);_0x3257f1(null);};}for(var e in events){if(events[_0x8570('0x6')](e)){var event=events[e];VoiceExtension['hook'](e,emitEvent(event));}}module[_0x8570('0x7')]=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index 366ce1a..22d22de 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 _0x3f5a=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./voiceExtension.attributes','voice_extensions','lodash','util'];(function(_0x3b6d21,_0x11d4c5){var _0x2b46f0=function(_0x467e64){while(--_0x467e64){_0x3b6d21['push'](_0x3b6d21['shift']());}};_0x2b46f0(++_0x11d4c5);}(_0x3f5a,0xcf));var _0xa3f5=function(_0x53b6ae,_0x3cb9f4){_0x53b6ae=_0x53b6ae-0x0;var _0x34f4b2=_0x3f5a[_0x53b6ae];return _0x34f4b2;};'use strict';var _=require(_0xa3f5('0x0'));var util=require(_0xa3f5('0x1'));var logger=require(_0xa3f5('0x2'))(_0xa3f5('0x3'));var moment=require('moment');var BPromise=require(_0xa3f5('0x4'));var rp=require(_0xa3f5('0x5'));var fs=require('fs');var path=require(_0xa3f5('0x6'));var rimraf=require(_0xa3f5('0x7'));var config=require(_0xa3f5('0x8'));var attributes=require(_0xa3f5('0x9'));module['exports']=function(_0x1313aa,_0x5374ba){return _0x1313aa['define']('VoiceExtension',attributes,{'tableName':_0xa3f5('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xacbf=['VoiceExtension','lodash','util','api','moment','bluebird','path','../../config/environment','./voiceExtension.attributes','exports','define'];(function(_0x1377e0,_0x193c40){var _0x210168=function(_0x3398c8){while(--_0x3398c8){_0x1377e0['push'](_0x1377e0['shift']());}};_0x210168(++_0x193c40);}(_0xacbf,0x90));var _0xfacb=function(_0x31da2c,_0x276d4d){_0x31da2c=_0x31da2c-0x0;var _0x191df1=_0xacbf[_0x31da2c];return _0x191df1;};'use strict';var _=require(_0xfacb('0x0'));var util=require(_0xfacb('0x1'));var logger=require('../../config/logger')(_0xfacb('0x2'));var moment=require(_0xfacb('0x3'));var BPromise=require(_0xfacb('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfacb('0x5'));var rimraf=require('rimraf');var config=require(_0xfacb('0x6'));var attributes=require(_0xfacb('0x7'));module[_0xfacb('0x8')]=function(_0x36e7bd,_0x1ccc4c){return _0x36e7bd[_0xfacb('0x9')](_0xfacb('0xa'),attributes,{'tableName':'voice_extensions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index f10f34e..55e2c28 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 _0xcb9d=['VoiceExtension,\x20%s,\x20%s','message','result','VoiceExtension','options','where','attributes','limit','include','map','model','GetVoiceExtension','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','localhost','socket.io-emitter','redis','./voiceExtension.socket','register','then','info','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xcb9d,0xa5));var _0xdcb9=function(_0x2ec073,_0x7f954a){_0x2ec073=_0x2ec073-0x0;var _0x257215=_0xcb9d[_0x2ec073];return _0x257215;};'use strict';var _=require(_0xdcb9('0x0'));var util=require('util');var moment=require(_0xdcb9('0x1'));var BPromise=require(_0xdcb9('0x2'));var rs=require(_0xdcb9('0x3'));var fs=require('fs');var Redis=require(_0xdcb9('0x4'));var db=require(_0xdcb9('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xdcb9('0x6'))(_0xdcb9('0x7'));var config=require(_0xdcb9('0x8'));var jayson=require(_0xdcb9('0x9'));var client=jayson[_0xdcb9('0xa')][_0xdcb9('0xb')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0xdcb9('0xc'),'port':0x18eb});var socket=require(_0xdcb9('0xd'))(new Redis(config[_0xdcb9('0xe')]));require(_0xdcb9('0xf'))[_0xdcb9('0x10')](socket);function respondWithRpcPromise(_0x2371c7,_0x22cba2,_0x22a858){return new BPromise(function(_0x22dec7,_0x527415){return client['request'](_0x2371c7,_0x22a858)[_0xdcb9('0x11')](function(_0x2c4cab){logger[_0xdcb9('0x12')]('VoiceExtension,\x20%s,\x20%s',_0x22cba2,'request\x20sent');logger[_0xdcb9('0x13')](_0xdcb9('0x14'),_0x22cba2,_0xdcb9('0x15'),JSON[_0xdcb9('0x16')](_0x2c4cab));if(_0x2c4cab[_0xdcb9('0x17')]){if(_0x2c4cab[_0xdcb9('0x17')][_0xdcb9('0x18')]===0x1f4){logger[_0xdcb9('0x17')](_0xdcb9('0x19'),_0x22cba2,_0x2c4cab['error'][_0xdcb9('0x1a')]);return _0x527415(_0x2c4cab[_0xdcb9('0x17')][_0xdcb9('0x1a')]);}logger[_0xdcb9('0x17')](_0xdcb9('0x19'),_0x22cba2,_0x2c4cab['error']['message']);return _0x22dec7(_0x2c4cab[_0xdcb9('0x17')][_0xdcb9('0x1a')]);}else{logger[_0xdcb9('0x12')](_0xdcb9('0x19'),_0x22cba2,'request\x20sent');_0x22dec7(_0x2c4cab[_0xdcb9('0x1b')][_0xdcb9('0x1a')]);}})['catch'](function(_0x258eac){logger[_0xdcb9('0x17')]('VoiceExtension,\x20%s,\x20%s',_0x22cba2,_0x258eac);_0x527415(_0x258eac);});});}exports['GetVoiceExtension']=function(_0x1f2cd0){var _0x345f94=this;return new Promise(function(_0x34199f,_0x3b4ebb){return db[_0xdcb9('0x1c')]['findAll']({'raw':_0x1f2cd0[_0xdcb9('0x1d')]?_0x1f2cd0['options']['raw']===undefined?!![]:![]:!![],'where':_0x1f2cd0[_0xdcb9('0x1d')]?_0x1f2cd0[_0xdcb9('0x1d')][_0xdcb9('0x1e')]||null:null,'attributes':_0x1f2cd0[_0xdcb9('0x1d')]?_0x1f2cd0[_0xdcb9('0x1d')][_0xdcb9('0x1f')]||null:null,'limit':_0x1f2cd0[_0xdcb9('0x1d')]?_0x1f2cd0[_0xdcb9('0x1d')][_0xdcb9('0x20')]||null:null,'include':_0x1f2cd0[_0xdcb9('0x1d')]?_0x1f2cd0[_0xdcb9('0x1d')][_0xdcb9('0x21')]?_[_0xdcb9('0x22')](_0x1f2cd0[_0xdcb9('0x1d')][_0xdcb9('0x21')],function(_0x2156f4){return{'model':db[_0x2156f4[_0xdcb9('0x23')]],'as':_0x2156f4['as'],'attributes':_0x2156f4[_0xdcb9('0x1f')],'include':_0x2156f4[_0xdcb9('0x21')]?_[_0xdcb9('0x22')](_0x2156f4[_0xdcb9('0x21')],function(_0x539b42){return{'model':db[_0x539b42['model']],'as':_0x539b42['as'],'attributes':_0x539b42['attributes'],'include':_0x539b42[_0xdcb9('0x21')]?_[_0xdcb9('0x22')](_0x539b42[_0xdcb9('0x21')],function(_0x4caeab){return{'model':db[_0x4caeab['model']],'as':_0x4caeab['as'],'attributes':_0x4caeab[_0xdcb9('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xdcb9('0x11')](function(_0x49b463){logger[_0xdcb9('0x12')](_0xdcb9('0x24'),_0x1f2cd0);logger[_0xdcb9('0x13')](_0xdcb9('0x24'),_0x1f2cd0,JSON['stringify'](_0x49b463));_0x34199f(_0x49b463);})[_0xdcb9('0x25')](function(_0x50f17d){logger[_0xdcb9('0x17')]('GetVoiceExtension',_0x50f17d[_0xdcb9('0x1a')],_0x1f2cd0);_0x3b4ebb(_0x345f94[_0xdcb9('0x17')](0x1f4,_0x50f17d[_0xdcb9('0x1a')]));});});}; \ No newline at end of file +var _0xf81a=['where','attributes','limit','include','model','map','debug','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./voiceExtension.socket','register','request','then','VoiceExtension,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','GetVoiceExtension','VoiceExtension','findAll','options','raw'];(function(_0x22b68a,_0x2bffc3){var _0x1ac67a=function(_0x25f9d5){while(--_0x25f9d5){_0x22b68a['push'](_0x22b68a['shift']());}};_0x1ac67a(++_0x2bffc3);}(_0xf81a,0xcf));var _0xaf81=function(_0x190797,_0x1d2410){_0x190797=_0x190797-0x0;var _0x8393b5=_0xf81a[_0x190797];return _0x8393b5;};'use strict';var _=require(_0xaf81('0x0'));var util=require(_0xaf81('0x1'));var moment=require(_0xaf81('0x2'));var BPromise=require('bluebird');var rs=require(_0xaf81('0x3'));var fs=require('fs');var Redis=require(_0xaf81('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xaf81('0x5'));var logger=require(_0xaf81('0x6'))(_0xaf81('0x7'));var config=require(_0xaf81('0x8'));var jayson=require(_0xaf81('0x9'));var client=jayson[_0xaf81('0xa')][_0xaf81('0xb')]({'port':0x232a});config[_0xaf81('0xc')]=_['defaults'](config[_0xaf81('0xc')],{'host':_0xaf81('0xd'),'port':0x18eb});var socket=require(_0xaf81('0xe'))(new Redis(config[_0xaf81('0xc')]));require(_0xaf81('0xf'))[_0xaf81('0x10')](socket);function respondWithRpcPromise(_0x148f0d,_0x25a120,_0x4e1e14){return new BPromise(function(_0x4df1ec,_0x50fd24){return client[_0xaf81('0x11')](_0x148f0d,_0x4e1e14)[_0xaf81('0x12')](function(_0x59d1f8){logger['info'](_0xaf81('0x13'),_0x25a120,'request\x20sent');logger['debug']('VoiceExtension,\x20%s,\x20%s,\x20%s',_0x25a120,_0xaf81('0x14'),JSON[_0xaf81('0x15')](_0x59d1f8));if(_0x59d1f8[_0xaf81('0x16')]){if(_0x59d1f8[_0xaf81('0x16')][_0xaf81('0x17')]===0x1f4){logger[_0xaf81('0x16')](_0xaf81('0x13'),_0x25a120,_0x59d1f8[_0xaf81('0x16')][_0xaf81('0x18')]);return _0x50fd24(_0x59d1f8['error'][_0xaf81('0x18')]);}logger[_0xaf81('0x16')]('VoiceExtension,\x20%s,\x20%s',_0x25a120,_0x59d1f8[_0xaf81('0x16')][_0xaf81('0x18')]);return _0x4df1ec(_0x59d1f8[_0xaf81('0x16')][_0xaf81('0x18')]);}else{logger[_0xaf81('0x19')](_0xaf81('0x13'),_0x25a120,_0xaf81('0x14'));_0x4df1ec(_0x59d1f8[_0xaf81('0x1a')][_0xaf81('0x18')]);}})[_0xaf81('0x1b')](function(_0x8cb0c7){logger[_0xaf81('0x16')]('VoiceExtension,\x20%s,\x20%s',_0x25a120,_0x8cb0c7);_0x50fd24(_0x8cb0c7);});});}exports[_0xaf81('0x1c')]=function(_0x49fdb2){var _0x53ce44=this;return new Promise(function(_0x386592,_0x20e1a5){return db[_0xaf81('0x1d')][_0xaf81('0x1e')]({'raw':_0x49fdb2[_0xaf81('0x1f')]?_0x49fdb2[_0xaf81('0x1f')][_0xaf81('0x20')]===undefined?!![]:![]:!![],'where':_0x49fdb2[_0xaf81('0x1f')]?_0x49fdb2[_0xaf81('0x1f')][_0xaf81('0x21')]||null:null,'attributes':_0x49fdb2[_0xaf81('0x1f')]?_0x49fdb2['options'][_0xaf81('0x22')]||null:null,'limit':_0x49fdb2[_0xaf81('0x1f')]?_0x49fdb2[_0xaf81('0x1f')][_0xaf81('0x23')]||null:null,'include':_0x49fdb2[_0xaf81('0x1f')]?_0x49fdb2[_0xaf81('0x1f')][_0xaf81('0x24')]?_['map'](_0x49fdb2[_0xaf81('0x1f')][_0xaf81('0x24')],function(_0x221240){return{'model':db[_0x221240[_0xaf81('0x25')]],'as':_0x221240['as'],'attributes':_0x221240['attributes'],'include':_0x221240[_0xaf81('0x24')]?_['map'](_0x221240[_0xaf81('0x24')],function(_0x18ea52){return{'model':db[_0x18ea52[_0xaf81('0x25')]],'as':_0x18ea52['as'],'attributes':_0x18ea52[_0xaf81('0x22')],'include':_0x18ea52[_0xaf81('0x24')]?_[_0xaf81('0x26')](_0x18ea52[_0xaf81('0x24')],function(_0x35446b){return{'model':db[_0x35446b['model']],'as':_0x35446b['as'],'attributes':_0x35446b[_0xaf81('0x22')]};}):[]};}):[]};}):[]:[]})[_0xaf81('0x12')](function(_0x150e17){logger[_0xaf81('0x19')](_0xaf81('0x1c'),_0x49fdb2);logger[_0xaf81('0x27')](_0xaf81('0x1c'),_0x49fdb2,JSON[_0xaf81('0x15')](_0x150e17));_0x386592(_0x150e17);})[_0xaf81('0x1b')](function(_0x4c8bb3){logger['error'](_0xaf81('0x1c'),_0x4c8bb3['message'],_0x49fdb2);_0x20e1a5(_0x53ce44['error'](0x1f4,_0x4c8bb3['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index 527583b..eb950d1 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 _0xf7d7=['removeListener','register','length','voiceExtension:','./voiceExtension.events','save','remove','update'];(function(_0x1a0e6a,_0x1b43de){var _0x4b3934=function(_0x81dc97){while(--_0x81dc97){_0x1a0e6a['push'](_0x1a0e6a['shift']());}};_0x4b3934(++_0x1b43de);}(_0xf7d7,0x1b4));var _0x7f7d=function(_0x599e60,_0x5b6519){_0x599e60=_0x599e60-0x0;var _0x468e19=_0xf7d7[_0x599e60];return _0x468e19;};'use strict';var VoiceExtensionEvents=require(_0x7f7d('0x0'));var events=[_0x7f7d('0x1'),_0x7f7d('0x2'),_0x7f7d('0x3')];function createListener(_0x3a6e3a,_0x1ea541){return function(_0x3bc611){_0x1ea541['emit'](_0x3a6e3a,_0x3bc611);};}function removeListener(_0x3fdfa2,_0x92393c){return function(){VoiceExtensionEvents[_0x7f7d('0x4')](_0x3fdfa2,_0x92393c);};}exports[_0x7f7d('0x5')]=function(_0x990bd0){for(var _0x7ea1b5=0x0,_0x5aba25=events[_0x7f7d('0x6')];_0x7ea1b5<_0x5aba25;_0x7ea1b5++){var _0x55b227=events[_0x7ea1b5];var _0x48420d=createListener(_0x7f7d('0x7')+_0x55b227,_0x990bd0);VoiceExtensionEvents['on'](_0x55b227,_0x48420d);}}; \ No newline at end of file +var _0x1da1=['emit','removeListener','register','voiceExtension:','./voiceExtension.events','remove'];(function(_0x408ae3,_0x41cb9c){var _0x17acea=function(_0x29fc2f){while(--_0x29fc2f){_0x408ae3['push'](_0x408ae3['shift']());}};_0x17acea(++_0x41cb9c);}(_0x1da1,0xd0));var _0x11da=function(_0x5cb0ab,_0x3d1562){_0x5cb0ab=_0x5cb0ab-0x0;var _0x2ea492=_0x1da1[_0x5cb0ab];return _0x2ea492;};'use strict';var VoiceExtensionEvents=require(_0x11da('0x0'));var events=['save',_0x11da('0x1'),'update'];function createListener(_0x3be8bd,_0x2e2b23){return function(_0x39276d){_0x2e2b23[_0x11da('0x2')](_0x3be8bd,_0x39276d);};}function removeListener(_0x3e6e1e,_0x6381b4){return function(){VoiceExtensionEvents[_0x11da('0x3')](_0x3e6e1e,_0x6381b4);};}exports[_0x11da('0x4')]=function(_0x2607a0){for(var _0x505771=0x0,_0x4fb468=events['length'];_0x505771<_0x4fb468;_0x505771++){var _0x111813=events[_0x505771];var _0x25b900=createListener(_0x11da('0x5')+_0x111813,_0x2607a0);VoiceExtensionEvents['on'](_0x111813,_0x25b900);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index 636fb4a..2967024 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 _0xdee7=['get','/:id','show','getMessages','post','create','put','delete','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','isAuthenticated'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xdee7,0x17f));var _0x7dee=function(_0x28352f,_0x44201f){_0x28352f=_0x28352f-0x0;var _0x4c1df5=_0xdee7[_0x28352f];return _0x4c1df5;};'use strict';var multer=require(_0x7dee('0x0'));var util=require(_0x7dee('0x1'));var path=require(_0x7dee('0x2'));var timeout=require(_0x7dee('0x3'));var express=require('express');var router=express[_0x7dee('0x4')]();var auth=require(_0x7dee('0x5'));var interaction=require(_0x7dee('0x6'));var config=require('../../config/environment');var controller=require('./voiceMail.controller');router['get']('/',auth[_0x7dee('0x7')](),controller['index']);router[_0x7dee('0x8')](_0x7dee('0x9'),auth[_0x7dee('0x7')](),controller[_0x7dee('0xa')]);router[_0x7dee('0x8')]('/:id/messages',auth[_0x7dee('0x7')](),controller[_0x7dee('0xb')]);router[_0x7dee('0xc')]('/',auth[_0x7dee('0x7')](),controller[_0x7dee('0xd')]);router[_0x7dee('0xe')](_0x7dee('0x9'),auth[_0x7dee('0x7')](),controller['update']);router[_0x7dee('0xf')]('/:id',auth[_0x7dee('0x7')](),controller['destroy']);module[_0x7dee('0x10')]=router; \ No newline at end of file +var _0x8fbc=['./voiceMail.controller','get','isAuthenticated','/:id','show','/:id/messages','getMessages','put','update','delete','destroy','multer','util','path','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8fbc,0xb5));var _0xc8fb=function(_0x3a90c7,_0x58ed23){_0x3a90c7=_0x3a90c7-0x0;var _0x209470=_0x8fbc[_0x3a90c7];return _0x209470;};'use strict';var multer=require(_0xc8fb('0x0'));var util=require(_0xc8fb('0x1'));var path=require(_0xc8fb('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0xc8fb('0x3'));var interaction=require(_0xc8fb('0x4'));var config=require(_0xc8fb('0x5'));var controller=require(_0xc8fb('0x6'));router[_0xc8fb('0x7')]('/',auth[_0xc8fb('0x8')](),controller['index']);router[_0xc8fb('0x7')](_0xc8fb('0x9'),auth[_0xc8fb('0x8')](),controller[_0xc8fb('0xa')]);router[_0xc8fb('0x7')](_0xc8fb('0xb'),auth['isAuthenticated'](),controller[_0xc8fb('0xc')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xc8fb('0xd')](_0xc8fb('0x9'),auth[_0xc8fb('0x8')](),controller[_0xc8fb('0xe')]);router[_0xc8fb('0xf')](_0xc8fb('0x9'),auth['isAuthenticated'](),controller[_0xc8fb('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index 47905e2..f5496f1 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 _0x0713=['trim','central','ENUM','yes','TIMESTAMP','INTEGER','VIRTUAL','getDataValue','fullname','\x20-\x20','STRING','from-voicemail','contest_mailbox','setDataValue','email','string'];(function(_0x1cfc39,_0x15adef){var _0x1ae59b=function(_0x153274){while(--_0x153274){_0x1cfc39['push'](_0x1cfc39['shift']());}};_0x1ae59b(++_0x15adef);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'customer_id':{'type':Sequelize[_0x3071('0x0')]},'context':{'type':Sequelize[_0x3071('0x0')],'defaultValue':_0x3071('0x1'),'unique':_0x3071('0x2')},'mailbox':{'type':Sequelize[_0x3071('0x0')],'defaultValue':'','allowNull':![],'unique':'contest_mailbox'},'password':{'type':Sequelize[_0x3071('0x0')]},'fullname':{'type':Sequelize[_0x3071('0x0')]},'email':{'type':Sequelize[_0x3071('0x0')],'validate':{'isEmail':!![]},'set':function(_0x3137c8){this[_0x3071('0x3')](_0x3071('0x4'),typeof _0x3137c8===_0x3071('0x5')&&_0x3137c8[_0x3071('0x6')]()?_0x3137c8[_0x3071('0x6')]():null);}},'pager':{'type':Sequelize[_0x3071('0x0')]},'tz':{'type':Sequelize[_0x3071('0x0')],'defaultValue':_0x3071('0x7')},'attach':{'type':Sequelize[_0x3071('0x8')]('yes','no'),'defaultValue':_0x3071('0x9'),'allowNull':![]},'saycid':{'type':Sequelize[_0x3071('0x8')](_0x3071('0x9'),'no'),'defaultValue':_0x3071('0x9'),'allowNull':![]},'dialout':{'type':Sequelize[_0x3071('0x0')]},'callback':{'type':Sequelize['STRING']},'review':{'type':Sequelize[_0x3071('0x8')](_0x3071('0x9'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x3071('0x8')](_0x3071('0x9'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x3071('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize['ENUM'](_0x3071('0x9'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':'TINYINT(4)','defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x3071('0x8')](_0x3071('0x9'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize['ENUM'](_0x3071('0x9'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize['ENUM'](_0x3071('0x9'),'no'),'defaultValue':_0x3071('0x9'),'allowNull':![]},'forcename':{'type':Sequelize[_0x3071('0x8')](_0x3071('0x9'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x3071('0x8')](_0x3071('0x9'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x3071('0x8')](_0x3071('0x9'),'no'),'defaultValue':_0x3071('0x9'),'allowNull':![]},'stamp':{'type':_0x3071('0xa')},'emailsubject':{'type':Sequelize['STRING']},'emailbody':{'type':Sequelize[_0x3071('0x0')]},'maxsecs':{'type':Sequelize[_0x3071('0xb')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x3071('0xb')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x3071('0xc')],'get':function(){return this[_0x3071('0xd')](_0x3071('0xe'))+_0x3071('0xf')+this[_0x3071('0xd')]('mailbox');}}}; \ No newline at end of file +var _0xd7d1=['\x20-\x20','getDataValue','mailbox','sequelize','exports','STRING','from-voicemail','contest_mailbox','setDataValue','string','trim','central','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER','VIRTUAL'];(function(_0xd0b415,_0x149675){var _0x2bdf2c=function(_0x59fbfa){while(--_0x59fbfa){_0xd0b415['push'](_0xd0b415['shift']());}};_0x2bdf2c(++_0x149675);}(_0xd7d1,0x1b3));var _0x1d7d=function(_0x3d1e64,_0x455c57){_0x3d1e64=_0x3d1e64-0x0;var _0x33875f=_0xd7d1[_0x3d1e64];return _0x33875f;};'use strict';var Sequelize=require(_0x1d7d('0x0'));module[_0x1d7d('0x1')]={'customer_id':{'type':Sequelize[_0x1d7d('0x2')]},'context':{'type':Sequelize[_0x1d7d('0x2')],'defaultValue':_0x1d7d('0x3'),'unique':_0x1d7d('0x4')},'mailbox':{'type':Sequelize[_0x1d7d('0x2')],'defaultValue':'','allowNull':![],'unique':_0x1d7d('0x4')},'password':{'type':Sequelize[_0x1d7d('0x2')]},'fullname':{'type':Sequelize[_0x1d7d('0x2')]},'email':{'type':Sequelize[_0x1d7d('0x2')],'validate':{'isEmail':!![]},'set':function(_0x1a2564){this[_0x1d7d('0x5')]('email',typeof _0x1a2564===_0x1d7d('0x6')&&_0x1a2564[_0x1d7d('0x7')]()?_0x1a2564[_0x1d7d('0x7')]():null);}},'pager':{'type':Sequelize[_0x1d7d('0x2')]},'tz':{'type':Sequelize[_0x1d7d('0x2')],'defaultValue':_0x1d7d('0x8')},'attach':{'type':Sequelize[_0x1d7d('0x9')](_0x1d7d('0xa'),'no'),'defaultValue':_0x1d7d('0xa'),'allowNull':![]},'saycid':{'type':Sequelize[_0x1d7d('0x9')](_0x1d7d('0xa'),'no'),'defaultValue':'yes','allowNull':![]},'dialout':{'type':Sequelize[_0x1d7d('0x2')]},'callback':{'type':Sequelize['STRING']},'review':{'type':Sequelize[_0x1d7d('0x9')](_0x1d7d('0xa'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x1d7d('0x9')](_0x1d7d('0xa'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize['ENUM'](_0x1d7d('0xa'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x1d7d('0xb'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x1d7d('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize['ENUM'](_0x1d7d('0xa'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x1d7d('0x9')](_0x1d7d('0xa'),'no'),'defaultValue':_0x1d7d('0xa'),'allowNull':![]},'forcename':{'type':Sequelize[_0x1d7d('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x1d7d('0x9')](_0x1d7d('0xa'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize['ENUM'](_0x1d7d('0xa'),'no'),'defaultValue':_0x1d7d('0xa'),'allowNull':![]},'stamp':{'type':_0x1d7d('0xc')},'emailsubject':{'type':Sequelize[_0x1d7d('0x2')]},'emailbody':{'type':Sequelize[_0x1d7d('0x2')]},'maxsecs':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x1d7d('0xd')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x1d7d('0xe')],'get':function(){return this['getDataValue']('fullname')+_0x1d7d('0xf')+this[_0x1d7d('0x10')](_0x1d7d('0x11'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index f7513ae..8fc9340 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 _0x1058=['../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','UserProfileResource','error','stack','name','send','index','map','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','VoiceMail','include','findAll','rows','catch','show','params','length','find','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','getMessages','VoiceMailMessage','rawAttributes','hasOwnProperty','mailbox','findAndCountAll','html-pdf','eml-format','fast-json-patch','request-promise','util','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x1058,0x148));var _0x8105=function(_0x19ceff,_0x1ced4d){_0x19ceff=_0x19ceff-0x0;var _0x276715=_0x1058[_0x19ceff];return _0x276715;};'use strict';var pdf=require(_0x8105('0x0'));var emlformat=require(_0x8105('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x8105('0x2'));var rp=require(_0x8105('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x8105('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0x8105('0x5'));var ejs=require(_0x8105('0x6'));var fs=require('fs');var _=require(_0x8105('0x7'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x8105('0x8'));var deskjs=require(_0x8105('0x9'));var toCsv=require(_0x8105('0x5'));var querystring=require(_0x8105('0xa'));var Papa=require(_0x8105('0xb'));var Redis=require(_0x8105('0xc'));var authService=require(_0x8105('0xd'));var qs=require(_0x8105('0xe'));var as=require(_0x8105('0xf'));var hardwareService=require(_0x8105('0x10'));var logger=require('../../config/logger')(_0x8105('0x11'));var utils=require(_0x8105('0x12'));var config=require(_0x8105('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xc0420,_0x3868c0){_0x3868c0=_0x3868c0||0xcc;return function(_0x14534f){if(_0x14534f){return _0xc0420[_0x8105('0x14')](_0x3868c0);}return _0xc0420[_0x8105('0x15')](_0x3868c0)[_0x8105('0x16')]();};}function respondWithResult(_0x208b0e,_0x1dba3d){_0x1dba3d=_0x1dba3d||0xc8;return function(_0x5536b7){if(_0x5536b7){return _0x208b0e[_0x8105('0x15')](_0x1dba3d)[_0x8105('0x17')](_0x5536b7);}};}function respondWithFilteredResult(_0x384153,_0x36fb50){return function(_0x1e5889){if(_0x1e5889){var _0x403bdc=_0x1e5889[_0x8105('0x18')],_0x122882=_0x36fb50[_0x8105('0x19')],_0x156c54=_0x36fb50[_0x8105('0x19')]+_0x36fb50[_0x8105('0x1a')],_0x55edf5;if(_0x156c54>=_0x403bdc){_0x156c54=_0x403bdc;_0x55edf5=0xc8;}else{_0x55edf5=0xce;}_0x384153[_0x8105('0x15')](_0x55edf5);return _0x384153[_0x8105('0x1b')](_0x8105('0x1c'),_0x122882+'-'+_0x156c54+'/'+_0x403bdc)[_0x8105('0x17')](_0x1e5889);}return null;};}function patchUpdates(_0x116561){return function(_0x55e202){try{jsonpatch[_0x8105('0x1d')](_0x55e202,_0x116561,!![]);}catch(_0x3e1a16){return BPromise[_0x8105('0x1e')](_0x3e1a16);}return _0x55e202[_0x8105('0x1f')]();};}function saveUpdates(_0x205350,_0x3639e2){return function(_0x1b8bf9){if(_0x1b8bf9){return _0x1b8bf9[_0x8105('0x20')](_0x205350)[_0x8105('0x21')](function(_0x227746){return _0x227746;});}return null;};}function removeEntity(_0x4b10d1,_0x1424d1){return function(_0x2219fa){if(_0x2219fa){return _0x2219fa[_0x8105('0x22')]()[_0x8105('0x21')](function(){var _0x4a8715=_0x2219fa['get']({'plain':!![]});var _0x4b9e0e='Voicemails';return db[_0x8105('0x23')][_0x8105('0x22')]({'where':{'type':_0x4b9e0e,'resourceId':_0x4a8715['id']}})[_0x8105('0x21')](function(){return _0x2219fa;});})[_0x8105('0x21')](function(){_0x4b10d1[_0x8105('0x15')](0xcc)[_0x8105('0x16')]();});}};}function handleEntityNotFound(_0x534bf0,_0x1ffbe0){return function(_0x18c733){if(!_0x18c733){_0x534bf0['sendStatus'](0x194);}return _0x18c733;};}function handleError(_0x4b0732,_0x40be64){_0x40be64=_0x40be64||0x1f4;return function(_0x10ce0f){logger[_0x8105('0x24')](_0x10ce0f[_0x8105('0x25')]);if(_0x10ce0f['name']){delete _0x10ce0f[_0x8105('0x26')];}_0x4b0732[_0x8105('0x15')](_0x40be64)[_0x8105('0x27')](_0x10ce0f);};}exports[_0x8105('0x28')]=function(_0x9b92b1,_0x487e96){var _0x177120={},_0x25235a={},_0x453669={'count':0x0,'rows':[]};var _0x18cbb2=_[_0x8105('0x29')](db['VoiceMail']['rawAttributes'],function(_0xab364b){return{'name':_0xab364b[_0x8105('0x2a')],'type':_0xab364b[_0x8105('0x2b')][_0x8105('0x2c')]};});_0x25235a['model']=_[_0x8105('0x29')](_0x18cbb2,'name');_0x25235a['query']=_[_0x8105('0x2d')](_0x9b92b1[_0x8105('0x2e')]);_0x25235a[_0x8105('0x2f')]=_[_0x8105('0x30')](_0x25235a[_0x8105('0x31')],_0x25235a[_0x8105('0x2e')]);_0x177120[_0x8105('0x32')]=_['intersection'](_0x25235a[_0x8105('0x31')],qs[_0x8105('0x33')](_0x9b92b1['query'][_0x8105('0x33')]));_0x177120[_0x8105('0x32')]=_0x177120[_0x8105('0x32')]['length']?_0x177120[_0x8105('0x32')]:_0x25235a['model'];if(!_0x9b92b1[_0x8105('0x2e')]['hasOwnProperty'](_0x8105('0x34'))){_0x177120[_0x8105('0x1a')]=qs['limit'](_0x9b92b1[_0x8105('0x2e')][_0x8105('0x1a')]);_0x177120['offset']=qs[_0x8105('0x19')](_0x9b92b1['query'][_0x8105('0x19')]);}_0x177120[_0x8105('0x35')]=qs[_0x8105('0x36')](_0x9b92b1[_0x8105('0x2e')][_0x8105('0x36')]);_0x177120[_0x8105('0x37')]=qs[_0x8105('0x2f')](_[_0x8105('0x38')](_0x9b92b1['query'],_0x25235a[_0x8105('0x2f')]));if(_0x9b92b1[_0x8105('0x2e')][_0x8105('0x39')]){_0x177120[_0x8105('0x37')]=_[_0x8105('0x3a')](_0x177120[_0x8105('0x37')],{'$or':_[_0x8105('0x29')](_0x18cbb2,function(_0x58486d){if(_0x58486d[_0x8105('0x2b')]!==_0x8105('0x3b')){var _0x1dee65={};_0x1dee65[_0x58486d['name']]={'$like':'%'+_0x9b92b1['query'][_0x8105('0x39')]+'%'};return _0x1dee65;}})});}_0x177120=_[_0x8105('0x3a')]({},_0x177120,_0x9b92b1[_0x8105('0x3c')]);var _0x2d69c9={'where':_0x177120[_0x8105('0x37')]};return db[_0x8105('0x3d')][_0x8105('0x18')](_0x2d69c9)[_0x8105('0x21')](function(_0x4e541f){_0x453669[_0x8105('0x18')]=_0x4e541f;if(_0x9b92b1[_0x8105('0x2e')]['includeAll']){_0x177120[_0x8105('0x3e')]=[{'all':!![]}];}return db[_0x8105('0x3d')][_0x8105('0x3f')](_0x177120);})[_0x8105('0x21')](function(_0x3ba070){_0x453669[_0x8105('0x40')]=_0x3ba070;return _0x453669;})[_0x8105('0x21')](respondWithFilteredResult(_0x487e96,_0x177120))[_0x8105('0x41')](handleError(_0x487e96,null));};exports[_0x8105('0x42')]=function(_0x2cd28d,_0x3edd63){var _0x340b6d={'raw':!![],'where':{'id':_0x2cd28d[_0x8105('0x43')]['id']}},_0x67471c={};_0x67471c['model']=_[_0x8105('0x2d')](db[_0x8105('0x3d')]['rawAttributes']);_0x67471c['query']=_[_0x8105('0x2d')](_0x2cd28d[_0x8105('0x2e')]);_0x67471c['filters']=_['intersection'](_0x67471c[_0x8105('0x31')],_0x67471c['query']);_0x340b6d['attributes']=_[_0x8105('0x30')](_0x67471c[_0x8105('0x31')],qs['fields'](_0x2cd28d[_0x8105('0x2e')][_0x8105('0x33')]));_0x340b6d[_0x8105('0x32')]=_0x340b6d['attributes'][_0x8105('0x44')]?_0x340b6d['attributes']:_0x67471c[_0x8105('0x31')];if(_0x2cd28d[_0x8105('0x2e')]['includeAll']){_0x340b6d[_0x8105('0x3e')]=[{'all':!![]}];}_0x340b6d=_[_0x8105('0x3a')]({},_0x340b6d,_0x2cd28d[_0x8105('0x3c')]);return db[_0x8105('0x3d')][_0x8105('0x45')](_0x340b6d)['then'](handleEntityNotFound(_0x3edd63,null))[_0x8105('0x21')](respondWithResult(_0x3edd63,null))[_0x8105('0x41')](handleError(_0x3edd63,null));};exports[_0x8105('0x46')]=function(_0x19ef3c,_0x3cc656){return db[_0x8105('0x3d')][_0x8105('0x46')](_0x19ef3c['body'],{})[_0x8105('0x21')](function(_0x5ded63){var _0x2d0ee2=_0x19ef3c['user'][_0x8105('0x47')]({'plain':!![]});if(!_0x2d0ee2)throw new Error(_0x8105('0x48'));if(_0x2d0ee2[_0x8105('0x49')]===_0x8105('0x4a')){var _0x33754b=_0x5ded63['get']({'plain':!![]});var _0x1e9040='Voicemails';return db[_0x8105('0x4b')][_0x8105('0x45')]({'where':{'name':_0x1e9040,'userProfileId':_0x2d0ee2[_0x8105('0x4c')]},'raw':!![]})[_0x8105('0x21')](function(_0x5ccd99){if(_0x5ccd99&&_0x5ccd99[_0x8105('0x4d')]===0x0){return db['UserProfileResource'][_0x8105('0x46')]({'name':_0x33754b[_0x8105('0x26')],'resourceId':_0x33754b['id'],'type':_0x5ccd99['name'],'sectionId':_0x5ccd99['id']},{})[_0x8105('0x21')](function(){return _0x5ded63;});}else{return _0x5ded63;}})[_0x8105('0x41')](function(_0x2573a4){logger[_0x8105('0x24')](_0x8105('0x4e'),_0x2573a4);throw _0x2573a4;});}return _0x5ded63;})[_0x8105('0x21')](respondWithResult(_0x3cc656,0xc9))[_0x8105('0x41')](handleError(_0x3cc656,null));};exports[_0x8105('0x20')]=function(_0x34cf66,_0x4e65cf){if(_0x34cf66[_0x8105('0x4f')]['id']){delete _0x34cf66[_0x8105('0x4f')]['id'];}return db[_0x8105('0x3d')][_0x8105('0x45')]({'where':{'id':_0x34cf66['params']['id']}})[_0x8105('0x21')](handleEntityNotFound(_0x4e65cf,null))[_0x8105('0x21')](saveUpdates(_0x34cf66[_0x8105('0x4f')],null))[_0x8105('0x21')](respondWithResult(_0x4e65cf,null))[_0x8105('0x41')](handleError(_0x4e65cf,null));};exports[_0x8105('0x22')]=function(_0x29b784,_0x3be397){return db[_0x8105('0x3d')][_0x8105('0x45')]({'where':{'id':_0x29b784['params']['id']}})['then'](handleEntityNotFound(_0x3be397,null))[_0x8105('0x21')](removeEntity(_0x3be397,null))['catch'](handleError(_0x3be397,null));};exports[_0x8105('0x50')]=function(_0xacdba0,_0x1bbfa4,_0x36bf7a){return db[_0x8105('0x3d')]['findOne']({'where':{'id':_0xacdba0[_0x8105('0x43')]['id']}})[_0x8105('0x21')](handleEntityNotFound(_0x1bbfa4,null))[_0x8105('0x21')](function(_0x208aa2){var _0x44b2a0;var _0x1c4008={},_0x5eacd9={};_0x5eacd9['model']=_[_0x8105('0x2d')](db[_0x8105('0x51')][_0x8105('0x52')]);_0x5eacd9[_0x8105('0x2e')]=_[_0x8105('0x2d')](_0xacdba0[_0x8105('0x2e')]);_0x5eacd9[_0x8105('0x2f')]=_[_0x8105('0x30')](_0x5eacd9['model'],_0x5eacd9[_0x8105('0x2e')]);_0x1c4008[_0x8105('0x32')]=_[_0x8105('0x30')](_0x5eacd9[_0x8105('0x31')],qs[_0x8105('0x33')](_0xacdba0[_0x8105('0x2e')]['fields']));_0x1c4008['attributes']=_0x1c4008[_0x8105('0x32')][_0x8105('0x44')]?_0x1c4008[_0x8105('0x32')]:_0x5eacd9[_0x8105('0x31')];if(!_0xacdba0[_0x8105('0x2e')][_0x8105('0x53')]('nolimit')){_0x1c4008[_0x8105('0x1a')]=qs[_0x8105('0x1a')](_0xacdba0['query']['limit']);_0x1c4008[_0x8105('0x19')]=qs[_0x8105('0x19')](_0xacdba0[_0x8105('0x2e')][_0x8105('0x19')]);}_0x1c4008['order']=qs[_0x8105('0x36')](_0xacdba0[_0x8105('0x2e')][_0x8105('0x36')]);_0x1c4008[_0x8105('0x37')]=qs['filters'](_[_0x8105('0x38')](_0xacdba0['query'],_0x5eacd9[_0x8105('0x2f')]));if(_0xacdba0[_0x8105('0x2e')][_0x8105('0x39')]){_0x1c4008[_0x8105('0x37')]=_['merge'](_0x1c4008[_0x8105('0x37')],{'$or':_[_0x8105('0x29')](_0x1c4008[_0x8105('0x32')],function(_0x41e608){var _0x3e0665={};_0x3e0665[_0x41e608]={'$like':'%'+_0xacdba0[_0x8105('0x2e')][_0x8105('0x39')]+'%'};return _0x3e0665;})});}_0x1c4008[_0x8105('0x37')]=_['merge'](_0x1c4008[_0x8105('0x37')],{'mailboxuser':_0x208aa2[_0x8105('0x54')]});_0x1c4008=_[_0x8105('0x3a')]({},_0x1c4008,_0xacdba0[_0x8105('0x3c')]);return db[_0x8105('0x51')][_0x8105('0x55')](_0x1c4008)[_0x8105('0x21')](respondWithFilteredResult(_0x1bbfa4,_0x1c4008));})[_0x8105('0x41')](handleError(_0x1bbfa4,null));}; \ No newline at end of file +var _0xe0e7=['nolimit','VoiceMailMessage','findAndCountAll','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','lodash','squel','jsforce','to-csv','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','end','json','count','limit','status','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','VoiceMail','rawAttributes','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','offset','order','sort','filters','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','catch','keys','find','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','getMessages','findOne'];(function(_0x25e4e3,_0x4684fd){var _0x1d44e3=function(_0x2a7426){while(--_0x2a7426){_0x25e4e3['push'](_0x25e4e3['shift']());}};_0x1d44e3(++_0x4684fd);}(_0xe0e7,0x1a2));var _0x7e0e=function(_0x49b59f,_0x1f3a28){_0x49b59f=_0x49b59f-0x0;var _0x46f0de=_0xe0e7[_0x49b59f];return _0x46f0de;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x7e0e('0x0'));var rimraf=require(_0x7e0e('0x1'));var zipdir=require(_0x7e0e('0x2'));var jsonpatch=require(_0x7e0e('0x3'));var rp=require(_0x7e0e('0x4'));var moment=require(_0x7e0e('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x7e0e('0x6'));var util=require(_0x7e0e('0x7'));var path=require(_0x7e0e('0x8'));var sox=require(_0x7e0e('0x9'));var csv=require('to-csv');var ejs=require(_0x7e0e('0xa'));var fs=require('fs');var _=require(_0x7e0e('0xb'));var squel=require(_0x7e0e('0xc'));var crypto=require('crypto');var jsforce=require(_0x7e0e('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x7e0e('0xe'));var querystring=require('querystring');var Papa=require(_0x7e0e('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x7e0e('0x10'));var as=require(_0x7e0e('0x11'));var hardwareService=require(_0x7e0e('0x12'));var logger=require(_0x7e0e('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x7e0e('0x14'));var db=require(_0x7e0e('0x15'))['db'];function respondWithStatusCode(_0x264747,_0x49ef0a){_0x49ef0a=_0x49ef0a||0xcc;return function(_0x3b3f80){if(_0x3b3f80){return _0x264747[_0x7e0e('0x16')](_0x49ef0a);}return _0x264747['status'](_0x49ef0a)[_0x7e0e('0x17')]();};}function respondWithResult(_0xe1a93a,_0x353702){_0x353702=_0x353702||0xc8;return function(_0x1b67df){if(_0x1b67df){return _0xe1a93a['status'](_0x353702)[_0x7e0e('0x18')](_0x1b67df);}};}function respondWithFilteredResult(_0xeb5ae3,_0x473b64){return function(_0x2e2717){if(_0x2e2717){var _0x47900e=_0x2e2717[_0x7e0e('0x19')],_0x59c988=_0x473b64['offset'],_0x9a6ac8=_0x473b64['offset']+_0x473b64[_0x7e0e('0x1a')],_0x18366;if(_0x9a6ac8>=_0x47900e){_0x9a6ac8=_0x47900e;_0x18366=0xc8;}else{_0x18366=0xce;}_0xeb5ae3[_0x7e0e('0x1b')](_0x18366);return _0xeb5ae3[_0x7e0e('0x1c')](_0x7e0e('0x1d'),_0x59c988+'-'+_0x9a6ac8+'/'+_0x47900e)[_0x7e0e('0x18')](_0x2e2717);}return null;};}function patchUpdates(_0x4dfb40){return function(_0x145a63){try{jsonpatch[_0x7e0e('0x1e')](_0x145a63,_0x4dfb40,!![]);}catch(_0x16f06a){return BPromise[_0x7e0e('0x1f')](_0x16f06a);}return _0x145a63[_0x7e0e('0x20')]();};}function saveUpdates(_0x13b76c,_0x8ae7ae){return function(_0x29f4c2){if(_0x29f4c2){return _0x29f4c2[_0x7e0e('0x21')](_0x13b76c)[_0x7e0e('0x22')](function(_0x25d93c){return _0x25d93c;});}return null;};}function removeEntity(_0x44e93b,_0x2867b5){return function(_0x145002){if(_0x145002){return _0x145002[_0x7e0e('0x23')]()['then'](function(){var _0x522db8=_0x145002[_0x7e0e('0x24')]({'plain':!![]});var _0x375061='Voicemails';return db[_0x7e0e('0x25')][_0x7e0e('0x23')]({'where':{'type':_0x375061,'resourceId':_0x522db8['id']}})[_0x7e0e('0x22')](function(){return _0x145002;});})['then'](function(){_0x44e93b[_0x7e0e('0x1b')](0xcc)[_0x7e0e('0x17')]();});}};}function handleEntityNotFound(_0x5beb92,_0xa56cd3){return function(_0x43e0ca){if(!_0x43e0ca){_0x5beb92[_0x7e0e('0x16')](0x194);}return _0x43e0ca;};}function handleError(_0x4382b3,_0x26c71c){_0x26c71c=_0x26c71c||0x1f4;return function(_0x36b473){logger[_0x7e0e('0x26')](_0x36b473[_0x7e0e('0x27')]);if(_0x36b473[_0x7e0e('0x28')]){delete _0x36b473[_0x7e0e('0x28')];}_0x4382b3[_0x7e0e('0x1b')](_0x26c71c)[_0x7e0e('0x29')](_0x36b473);};}exports[_0x7e0e('0x2a')]=function(_0x76ad63,_0x8c4b36){var _0x3c7505={},_0x2f2c9f={},_0x8d5338={'count':0x0,'rows':[]};var _0x243414=_[_0x7e0e('0x2b')](db[_0x7e0e('0x2c')][_0x7e0e('0x2d')],function(_0x518df3){return{'name':_0x518df3['fieldName'],'type':_0x518df3[_0x7e0e('0x2e')][_0x7e0e('0x2f')]};});_0x2f2c9f[_0x7e0e('0x30')]=_[_0x7e0e('0x2b')](_0x243414,_0x7e0e('0x28'));_0x2f2c9f[_0x7e0e('0x31')]=_['keys'](_0x76ad63[_0x7e0e('0x31')]);_0x2f2c9f['filters']=_[_0x7e0e('0x32')](_0x2f2c9f[_0x7e0e('0x30')],_0x2f2c9f[_0x7e0e('0x31')]);_0x3c7505[_0x7e0e('0x33')]=_[_0x7e0e('0x32')](_0x2f2c9f[_0x7e0e('0x30')],qs[_0x7e0e('0x34')](_0x76ad63[_0x7e0e('0x31')]['fields']));_0x3c7505[_0x7e0e('0x33')]=_0x3c7505['attributes'][_0x7e0e('0x35')]?_0x3c7505[_0x7e0e('0x33')]:_0x2f2c9f['model'];if(!_0x76ad63[_0x7e0e('0x31')][_0x7e0e('0x36')]('nolimit')){_0x3c7505[_0x7e0e('0x1a')]=qs['limit'](_0x76ad63[_0x7e0e('0x31')][_0x7e0e('0x1a')]);_0x3c7505[_0x7e0e('0x37')]=qs[_0x7e0e('0x37')](_0x76ad63[_0x7e0e('0x31')]['offset']);}_0x3c7505[_0x7e0e('0x38')]=qs[_0x7e0e('0x39')](_0x76ad63[_0x7e0e('0x31')][_0x7e0e('0x39')]);_0x3c7505['where']=qs[_0x7e0e('0x3a')](_['pick'](_0x76ad63['query'],_0x2f2c9f['filters']));if(_0x76ad63[_0x7e0e('0x31')][_0x7e0e('0x3b')]){_0x3c7505[_0x7e0e('0x3c')]=_[_0x7e0e('0x3d')](_0x3c7505[_0x7e0e('0x3c')],{'$or':_[_0x7e0e('0x2b')](_0x243414,function(_0x3917ea){if(_0x3917ea['type']!==_0x7e0e('0x3e')){var _0x3fe92f={};_0x3fe92f[_0x3917ea[_0x7e0e('0x28')]]={'$like':'%'+_0x76ad63['query'][_0x7e0e('0x3b')]+'%'};return _0x3fe92f;}})});}_0x3c7505=_[_0x7e0e('0x3d')]({},_0x3c7505,_0x76ad63[_0x7e0e('0x3f')]);var _0x90ab54={'where':_0x3c7505[_0x7e0e('0x3c')]};return db['VoiceMail'][_0x7e0e('0x19')](_0x90ab54)[_0x7e0e('0x22')](function(_0x4ddf43){_0x8d5338[_0x7e0e('0x19')]=_0x4ddf43;if(_0x76ad63[_0x7e0e('0x31')][_0x7e0e('0x40')]){_0x3c7505[_0x7e0e('0x41')]=[{'all':!![]}];}return db[_0x7e0e('0x2c')][_0x7e0e('0x42')](_0x3c7505);})['then'](function(_0x15378e){_0x8d5338['rows']=_0x15378e;return _0x8d5338;})[_0x7e0e('0x22')](respondWithFilteredResult(_0x8c4b36,_0x3c7505))[_0x7e0e('0x43')](handleError(_0x8c4b36,null));};exports['show']=function(_0x356d12,_0x5f25bb){var _0xe25171={'raw':!![],'where':{'id':_0x356d12['params']['id']}},_0x5c768d={};_0x5c768d['model']=_[_0x7e0e('0x44')](db[_0x7e0e('0x2c')]['rawAttributes']);_0x5c768d['query']=_[_0x7e0e('0x44')](_0x356d12['query']);_0x5c768d['filters']=_[_0x7e0e('0x32')](_0x5c768d[_0x7e0e('0x30')],_0x5c768d[_0x7e0e('0x31')]);_0xe25171[_0x7e0e('0x33')]=_[_0x7e0e('0x32')](_0x5c768d[_0x7e0e('0x30')],qs['fields'](_0x356d12[_0x7e0e('0x31')][_0x7e0e('0x34')]));_0xe25171[_0x7e0e('0x33')]=_0xe25171['attributes']['length']?_0xe25171['attributes']:_0x5c768d[_0x7e0e('0x30')];if(_0x356d12['query'][_0x7e0e('0x40')]){_0xe25171[_0x7e0e('0x41')]=[{'all':!![]}];}_0xe25171=_[_0x7e0e('0x3d')]({},_0xe25171,_0x356d12[_0x7e0e('0x3f')]);return db[_0x7e0e('0x2c')][_0x7e0e('0x45')](_0xe25171)[_0x7e0e('0x22')](handleEntityNotFound(_0x5f25bb,null))[_0x7e0e('0x22')](respondWithResult(_0x5f25bb,null))[_0x7e0e('0x43')](handleError(_0x5f25bb,null));};exports['create']=function(_0x2163c8,_0x39fc78){return db['VoiceMail']['create'](_0x2163c8['body'],{})[_0x7e0e('0x22')](function(_0xa23d2f){var _0x14cbce=_0x2163c8[_0x7e0e('0x46')][_0x7e0e('0x24')]({'plain':!![]});if(!_0x14cbce)throw new Error(_0x7e0e('0x47'));if(_0x14cbce['role']===_0x7e0e('0x46')){var _0x237c1d=_0xa23d2f[_0x7e0e('0x24')]({'plain':!![]});var _0x5c7301='Voicemails';return db[_0x7e0e('0x48')][_0x7e0e('0x45')]({'where':{'name':_0x5c7301,'userProfileId':_0x14cbce[_0x7e0e('0x49')]},'raw':!![]})[_0x7e0e('0x22')](function(_0x2f1c7d){if(_0x2f1c7d&&_0x2f1c7d['autoAssociation']===0x0){return db[_0x7e0e('0x25')][_0x7e0e('0x4a')]({'name':_0x237c1d[_0x7e0e('0x28')],'resourceId':_0x237c1d['id'],'type':_0x2f1c7d[_0x7e0e('0x28')],'sectionId':_0x2f1c7d['id']},{})[_0x7e0e('0x22')](function(){return _0xa23d2f;});}else{return _0xa23d2f;}})[_0x7e0e('0x43')](function(_0x5e6cdd){logger[_0x7e0e('0x26')](_0x7e0e('0x4b'),_0x5e6cdd);throw _0x5e6cdd;});}return _0xa23d2f;})['then'](respondWithResult(_0x39fc78,0xc9))[_0x7e0e('0x43')](handleError(_0x39fc78,null));};exports['update']=function(_0x355242,_0xef4f65){if(_0x355242['body']['id']){delete _0x355242[_0x7e0e('0x4c')]['id'];}return db[_0x7e0e('0x2c')][_0x7e0e('0x45')]({'where':{'id':_0x355242[_0x7e0e('0x4d')]['id']}})[_0x7e0e('0x22')](handleEntityNotFound(_0xef4f65,null))['then'](saveUpdates(_0x355242[_0x7e0e('0x4c')],null))['then'](respondWithResult(_0xef4f65,null))[_0x7e0e('0x43')](handleError(_0xef4f65,null));};exports[_0x7e0e('0x23')]=function(_0x419bde,_0x2d9daf){return db[_0x7e0e('0x2c')][_0x7e0e('0x45')]({'where':{'id':_0x419bde[_0x7e0e('0x4d')]['id']}})[_0x7e0e('0x22')](handleEntityNotFound(_0x2d9daf,null))[_0x7e0e('0x22')](removeEntity(_0x2d9daf,null))[_0x7e0e('0x43')](handleError(_0x2d9daf,null));};exports[_0x7e0e('0x4e')]=function(_0x29bd0f,_0x2d15a5,_0x3ec81f){return db[_0x7e0e('0x2c')][_0x7e0e('0x4f')]({'where':{'id':_0x29bd0f[_0x7e0e('0x4d')]['id']}})[_0x7e0e('0x22')](handleEntityNotFound(_0x2d15a5,null))[_0x7e0e('0x22')](function(_0x5f0eb2){var _0x50cf42;var _0x171b10={},_0x196e42={};_0x196e42['model']=_['keys'](db['VoiceMailMessage'][_0x7e0e('0x2d')]);_0x196e42[_0x7e0e('0x31')]=_[_0x7e0e('0x44')](_0x29bd0f[_0x7e0e('0x31')]);_0x196e42['filters']=_[_0x7e0e('0x32')](_0x196e42[_0x7e0e('0x30')],_0x196e42['query']);_0x171b10[_0x7e0e('0x33')]=_[_0x7e0e('0x32')](_0x196e42[_0x7e0e('0x30')],qs[_0x7e0e('0x34')](_0x29bd0f[_0x7e0e('0x31')][_0x7e0e('0x34')]));_0x171b10[_0x7e0e('0x33')]=_0x171b10['attributes'][_0x7e0e('0x35')]?_0x171b10[_0x7e0e('0x33')]:_0x196e42['model'];if(!_0x29bd0f[_0x7e0e('0x31')]['hasOwnProperty'](_0x7e0e('0x50'))){_0x171b10[_0x7e0e('0x1a')]=qs['limit'](_0x29bd0f['query']['limit']);_0x171b10['offset']=qs[_0x7e0e('0x37')](_0x29bd0f[_0x7e0e('0x31')][_0x7e0e('0x37')]);}_0x171b10[_0x7e0e('0x38')]=qs[_0x7e0e('0x39')](_0x29bd0f['query'][_0x7e0e('0x39')]);_0x171b10[_0x7e0e('0x3c')]=qs[_0x7e0e('0x3a')](_['pick'](_0x29bd0f[_0x7e0e('0x31')],_0x196e42[_0x7e0e('0x3a')]));if(_0x29bd0f[_0x7e0e('0x31')][_0x7e0e('0x3b')]){_0x171b10[_0x7e0e('0x3c')]=_[_0x7e0e('0x3d')](_0x171b10[_0x7e0e('0x3c')],{'$or':_[_0x7e0e('0x2b')](_0x171b10[_0x7e0e('0x33')],function(_0x3f9571){var _0x5c38e4={};_0x5c38e4[_0x3f9571]={'$like':'%'+_0x29bd0f[_0x7e0e('0x31')][_0x7e0e('0x3b')]+'%'};return _0x5c38e4;})});}_0x171b10['where']=_[_0x7e0e('0x3d')](_0x171b10[_0x7e0e('0x3c')],{'mailboxuser':_0x5f0eb2['mailbox']});_0x171b10=_[_0x7e0e('0x3d')]({},_0x171b10,_0x29bd0f[_0x7e0e('0x3f')]);return db[_0x7e0e('0x51')][_0x7e0e('0x52')](_0x171b10)[_0x7e0e('0x22')](respondWithFilteredResult(_0x2d15a5,_0x171b10));})[_0x7e0e('0x43')](handleError(_0x2d15a5,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 5661f6d..26d675a 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 _0x6083=['exports','VoiceMail','voice_voicemail','mailbox_context','mailbox','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./voiceMail.attributes'];(function(_0x143798,_0x164f73){var _0x44f48b=function(_0x54de6f){while(--_0x54de6f){_0x143798['push'](_0x143798['shift']());}};_0x44f48b(++_0x164f73);}(_0x6083,0x9f));var _0x3608=function(_0x5d0a6d,_0x252fd6){_0x5d0a6d=_0x5d0a6d-0x0;var _0x28e812=_0x6083[_0x5d0a6d];return _0x28e812;};'use strict';var _=require(_0x3608('0x0'));var util=require(_0x3608('0x1'));var logger=require('../../config/logger')(_0x3608('0x2'));var moment=require(_0x3608('0x3'));var BPromise=require(_0x3608('0x4'));var rp=require(_0x3608('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3608('0x6'));var config=require(_0x3608('0x7'));var attributes=require(_0x3608('0x8'));module[_0x3608('0x9')]=function(_0x28d950,_0x1fe616){return _0x28d950['define'](_0x3608('0xa'),attributes,{'tableName':_0x3608('0xb'),'paranoid':![],'indexes':[{'name':_0x3608('0xc'),'fields':[_0x3608('0xd'),'context']}],'timestamps':!![]});}; \ No newline at end of file +var _0x2d8e=['voice_voicemail','mailbox_context','context','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./voiceMail.attributes','define','VoiceMail'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x2d8e,0x17a));var _0xe2d8=function(_0x117581,_0x307e77){_0x117581=_0x117581-0x0;var _0x25cfa7=_0x2d8e[_0x117581];return _0x25cfa7;};'use strict';var _=require(_0xe2d8('0x0'));var util=require(_0xe2d8('0x1'));var logger=require(_0xe2d8('0x2'))(_0xe2d8('0x3'));var moment=require(_0xe2d8('0x4'));var BPromise=require(_0xe2d8('0x5'));var rp=require(_0xe2d8('0x6'));var fs=require('fs');var path=require(_0xe2d8('0x7'));var rimraf=require(_0xe2d8('0x8'));var config=require('../../config/environment');var attributes=require(_0xe2d8('0x9'));module['exports']=function(_0x4799d1,_0x1be861){return _0x4799d1[_0xe2d8('0xa')](_0xe2d8('0xb'),attributes,{'tableName':_0xe2d8('0xc'),'paranoid':![],'indexes':[{'name':_0xe2d8('0xd'),'fields':['mailbox',_0xe2d8('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index 90da3f3..ffa2387 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 _0xfeba=['error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','http','request','then','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x5439f0,_0x3ee3d9){var _0x31320d=function(_0x3c1748){while(--_0x3c1748){_0x5439f0['push'](_0x5439f0['shift']());}};_0x31320d(++_0x3ee3d9);}(_0xfeba,0xbe));var _0xafeb=function(_0x5cb703,_0x1f3119){_0x5cb703=_0x5cb703-0x0;var _0x476722=_0xfeba[_0x5cb703];return _0x476722;};'use strict';var _=require(_0xafeb('0x0'));var util=require(_0xafeb('0x1'));var moment=require(_0xafeb('0x2'));var BPromise=require(_0xafeb('0x3'));var rs=require(_0xafeb('0x4'));var fs=require('fs');var Redis=require(_0xafeb('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xafeb('0x6'));var logger=require(_0xafeb('0x7'))('rpc');var config=require(_0xafeb('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xafeb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1a33ee,_0x1286cd,_0x3fdec7){return new BPromise(function(_0x256a83,_0x53fae5){return client[_0xafeb('0xa')](_0x1a33ee,_0x3fdec7)[_0xafeb('0xb')](function(_0x27fd5b){logger['info'](_0xafeb('0xc'),_0x1286cd,_0xafeb('0xd'));logger[_0xafeb('0xe')](_0xafeb('0xf'),_0x1286cd,_0xafeb('0xd'),JSON[_0xafeb('0x10')](_0x27fd5b));if(_0x27fd5b[_0xafeb('0x11')]){if(_0x27fd5b[_0xafeb('0x11')][_0xafeb('0x12')]===0x1f4){logger['error'](_0xafeb('0xc'),_0x1286cd,_0x27fd5b[_0xafeb('0x11')][_0xafeb('0x13')]);return _0x53fae5(_0x27fd5b['error'][_0xafeb('0x13')]);}logger[_0xafeb('0x11')](_0xafeb('0xc'),_0x1286cd,_0x27fd5b[_0xafeb('0x11')][_0xafeb('0x13')]);return _0x256a83(_0x27fd5b['error'][_0xafeb('0x13')]);}else{logger[_0xafeb('0x14')]('VoiceMail,\x20%s,\x20%s',_0x1286cd,_0xafeb('0xd'));_0x256a83(_0x27fd5b[_0xafeb('0x15')]['message']);}})[_0xafeb('0x16')](function(_0x226785){logger[_0xafeb('0x11')]('VoiceMail,\x20%s,\x20%s',_0x1286cd,_0x226785);_0x53fae5(_0x226785);});});} \ No newline at end of file +var _0x2918=['request','then','info','VoiceMail,\x20%s,\x20%s','debug','VoiceMail,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x36aa72,_0x426747){var _0x2ef8ae=function(_0x1d1b64){while(--_0x1d1b64){_0x36aa72['push'](_0x36aa72['shift']());}};_0x2ef8ae(++_0x426747);}(_0x2918,0x194));var _0x8291=function(_0x178188,_0x39af31){_0x178188=_0x178188-0x0;var _0x1222e8=_0x2918[_0x178188];return _0x1222e8;};'use strict';var _=require(_0x8291('0x0'));var util=require('util');var moment=require(_0x8291('0x1'));var BPromise=require(_0x8291('0x2'));var rs=require(_0x8291('0x3'));var fs=require('fs');var Redis=require(_0x8291('0x4'));var db=require(_0x8291('0x5'))['db'];var utils=require(_0x8291('0x6'));var logger=require(_0x8291('0x7'))(_0x8291('0x8'));var config=require(_0x8291('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4730c2,_0x497a11,_0x430895){return new BPromise(function(_0x174522,_0x4b3e21){return client[_0x8291('0xa')](_0x4730c2,_0x430895)[_0x8291('0xb')](function(_0x1f59c1){logger[_0x8291('0xc')](_0x8291('0xd'),_0x497a11,'request\x20sent');logger[_0x8291('0xe')](_0x8291('0xf'),_0x497a11,_0x8291('0x10'),JSON[_0x8291('0x11')](_0x1f59c1));if(_0x1f59c1[_0x8291('0x12')]){if(_0x1f59c1['error'][_0x8291('0x13')]===0x1f4){logger['error'](_0x8291('0xd'),_0x497a11,_0x1f59c1[_0x8291('0x12')][_0x8291('0x14')]);return _0x4b3e21(_0x1f59c1['error'][_0x8291('0x14')]);}logger[_0x8291('0x12')](_0x8291('0xd'),_0x497a11,_0x1f59c1[_0x8291('0x12')][_0x8291('0x14')]);return _0x174522(_0x1f59c1[_0x8291('0x12')]['message']);}else{logger[_0x8291('0xc')](_0x8291('0xd'),_0x497a11,_0x8291('0x10'));_0x174522(_0x1f59c1[_0x8291('0x15')][_0x8291('0x14')]);}})[_0x8291('0x16')](function(_0x2fc754){logger[_0x8291('0x12')](_0x8291('0xd'),_0x497a11,_0x2fc754);_0x4b3e21(_0x2fc754);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 732a8c8..f9870e7 100644 --- a/server/api/voiceMailMessage/index.js +++ b/server/api/voiceMailMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3f8a=['download','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','get','isAuthenticated','index','/:id','show','/:id/download'];(function(_0x33da58,_0x20befb){var _0x46a0ef=function(_0x2eb4fe){while(--_0x2eb4fe){_0x33da58['push'](_0x33da58['shift']());}};_0x46a0ef(++_0x20befb);}(_0x3f8a,0x1d5));var _0xa3f8=function(_0xa756e8,_0x49b65f){_0xa756e8=_0xa756e8-0x0;var _0x3c57ca=_0x3f8a[_0xa756e8];return _0x3c57ca;};'use strict';var multer=require(_0xa3f8('0x0'));var util=require(_0xa3f8('0x1'));var path=require(_0xa3f8('0x2'));var timeout=require(_0xa3f8('0x3'));var express=require('express');var router=express[_0xa3f8('0x4')]();var auth=require(_0xa3f8('0x5'));var interaction=require(_0xa3f8('0x6'));var config=require(_0xa3f8('0x7'));var controller=require(_0xa3f8('0x8'));router[_0xa3f8('0x9')]('/',auth[_0xa3f8('0xa')](),controller[_0xa3f8('0xb')]);router[_0xa3f8('0x9')](_0xa3f8('0xc'),auth[_0xa3f8('0xa')](),controller[_0xa3f8('0xd')]);router[_0xa3f8('0x9')](_0xa3f8('0xe'),auth[_0xa3f8('0xa')](),controller[_0xa3f8('0xf')]);router[_0xa3f8('0x10')]('/',auth['isAuthenticated'](),controller[_0xa3f8('0x11')]);router[_0xa3f8('0x12')](_0xa3f8('0xc'),auth[_0xa3f8('0xa')](),controller['update']);router[_0xa3f8('0x13')](_0xa3f8('0xc'),auth[_0xa3f8('0xa')](),controller[_0xa3f8('0x14')]);module[_0xa3f8('0x15')]=router; \ No newline at end of file +var _0x814b=['path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','get','isAuthenticated','index','/:id','/:id/download','download','post','create','put','update','destroy','exports','multer','util'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x814b,0x1a2));var _0xb814=function(_0x509083,_0xa6676b){_0x509083=_0x509083-0x0;var _0x4b2495=_0x814b[_0x509083];return _0x4b2495;};'use strict';var multer=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var path=require(_0xb814('0x2'));var timeout=require(_0xb814('0x3'));var express=require(_0xb814('0x4'));var router=express[_0xb814('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xb814('0x6'));var config=require(_0xb814('0x7'));var controller=require(_0xb814('0x8'));router[_0xb814('0x9')]('/',auth[_0xb814('0xa')](),controller[_0xb814('0xb')]);router['get'](_0xb814('0xc'),auth[_0xb814('0xa')](),controller['show']);router[_0xb814('0x9')](_0xb814('0xd'),auth[_0xb814('0xa')](),controller[_0xb814('0xe')]);router[_0xb814('0xf')]('/',auth[_0xb814('0xa')](),controller[_0xb814('0x10')]);router[_0xb814('0x11')](_0xb814('0xc'),auth[_0xb814('0xa')](),controller[_0xb814('0x12')]);router['delete'](_0xb814('0xc'),auth['isAuthenticated'](),controller[_0xb814('0x13')]);module[_0xb814('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index a6ea3ae..4c9543a 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 _0x37be=['STRING','BLOB','TIMESTAMP','sequelize','exports','VIRTUAL','getDataValue','INTEGER'];(function(_0x5ea078,_0x105d19){var _0x4a0bff=function(_0x1c4be1){while(--_0x1c4be1){_0x5ea078['push'](_0x5ea078['shift']());}};_0x4a0bff(++_0x105d19);}(_0x37be,0x11b));var _0xe37b=function(_0x84f7ee,_0x49ffb6){_0x84f7ee=_0x84f7ee-0x0;var _0x1bece1=_0x37be[_0x84f7ee];return _0x1bece1;};'use strict';var Sequelize=require(_0xe37b('0x0'));module[_0xe37b('0x1')]={'name':{'type':Sequelize[_0xe37b('0x2')],'get':function(_0x457b46){return this[_0xe37b('0x3')]('id');}},'msgnum':{'type':Sequelize[_0xe37b('0x4')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xe37b('0x5')],'defaultValue':''},'context':{'type':Sequelize[_0xe37b('0x5')],'defaultValue':''},'macrocontext':{'type':Sequelize['STRING'],'defaultValue':''},'callerid':{'type':Sequelize[_0xe37b('0x5')],'defaultValue':''},'origtime':{'type':Sequelize[_0xe37b('0x5')],'defaultValue':''},'duration':{'type':Sequelize[_0xe37b('0x5')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0xe37b('0x5')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0xe37b('0x5')],'defaultValue':''},'recording':{'type':Sequelize[_0xe37b('0x6')]('long'),'defaultValue':null},'flag':{'type':Sequelize[_0xe37b('0x5')],'defaultValue':''},'msg_id':{'type':Sequelize[_0xe37b('0x5')],'defaultValue':''},'stamp':{'type':_0xe37b('0x7'),'allowNull':![]}}; \ No newline at end of file +var _0x7264=['getDataValue','INTEGER','STRING','long','TIMESTAMP','sequelize','exports'];(function(_0x408eeb,_0x497269){var _0x591136=function(_0x423ee9){while(--_0x423ee9){_0x408eeb['push'](_0x408eeb['shift']());}};_0x591136(++_0x497269);}(_0x7264,0x1da));var _0x4726=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x7264[_0x3947c9];return _0x2e7871;};'use strict';var Sequelize=require(_0x4726('0x0'));module[_0x4726('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x258d81){return this[_0x4726('0x2')]('id');}},'msgnum':{'type':Sequelize[_0x4726('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize['STRING'],'defaultValue':''},'context':{'type':Sequelize['STRING'],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x4726('0x4')],'defaultValue':''},'callerid':{'type':Sequelize[_0x4726('0x4')],'defaultValue':''},'origtime':{'type':Sequelize['STRING'],'defaultValue':''},'duration':{'type':Sequelize[_0x4726('0x4')],'defaultValue':''},'mailboxuser':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxcontext':{'type':Sequelize['STRING'],'defaultValue':''},'recording':{'type':Sequelize['BLOB'](_0x4726('0x5')),'defaultValue':null},'flag':{'type':Sequelize['STRING'],'defaultValue':''},'msg_id':{'type':Sequelize[_0x4726('0x4')],'defaultValue':''},'stamp':{'type':_0x4726('0x6'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index 5fd87da..8cb0f93 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 _0xed1f=['hasOwnProperty','sort','where','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','params','rawAttributes','create','body','find','download','msg_id','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment','Content-Disposition','attachment;\x20filename=\x22','recording','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../mysqldb','end','count','offset','limit','status','apply','save','update','then','destroy','sendStatus','error','name','send','index','VoiceMailMessage','fieldName','type','key','differenceBy','map','query','keys','filters','intersection','attributes','model','fields','length'];(function(_0x54980c,_0x455c7f){var _0x4c409c=function(_0x5072b8){while(--_0x5072b8){_0x54980c['push'](_0x54980c['shift']());}};_0x4c409c(++_0x455c7f);}(_0xed1f,0x6a));var _0xfed1=function(_0x616290,_0x280b7f){_0x616290=_0x616290-0x0;var _0x453879=_0xed1f[_0x616290];return _0x453879;};'use strict';var pdf=require(_0xfed1('0x0'));var emlformat=require(_0xfed1('0x1'));var rimraf=require(_0xfed1('0x2'));var zipdir=require(_0xfed1('0x3'));var jsonpatch=require(_0xfed1('0x4'));var rp=require(_0xfed1('0x5'));var moment=require(_0xfed1('0x6'));var BPromise=require(_0xfed1('0x7'));var Mustache=require(_0xfed1('0x8'));var util=require(_0xfed1('0x9'));var path=require(_0xfed1('0xa'));var sox=require(_0xfed1('0xb'));var csv=require(_0xfed1('0xc'));var ejs=require(_0xfed1('0xd'));var fs=require('fs');var _=require(_0xfed1('0xe'));var squel=require(_0xfed1('0xf'));var crypto=require(_0xfed1('0x10'));var jsforce=require(_0xfed1('0x11'));var deskjs=require('desk.js');var toCsv=require(_0xfed1('0xc'));var querystring=require(_0xfed1('0x12'));var Papa=require('papaparse');var Redis=require(_0xfed1('0x13'));var authService=require(_0xfed1('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xfed1('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfed1('0x16'))(_0xfed1('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xfed1('0x18'))['db'];function respondWithStatusCode(_0xe84ba6,_0x569a6e){_0x569a6e=_0x569a6e||0xcc;return function(_0x17f4fe){if(_0x17f4fe){return _0xe84ba6['sendStatus'](_0x569a6e);}return _0xe84ba6['status'](_0x569a6e)[_0xfed1('0x19')]();};}function respondWithResult(_0x397af9,_0x532537){_0x532537=_0x532537||0xc8;return function(_0x2dde3a){if(_0x2dde3a){return _0x397af9['status'](_0x532537)['json'](_0x2dde3a);}};}function respondWithFilteredResult(_0xde25db,_0x39aa0c){return function(_0x1fbb7a){if(_0x1fbb7a){var _0x123c46=_0x1fbb7a[_0xfed1('0x1a')],_0x582e67=_0x39aa0c[_0xfed1('0x1b')],_0x1a00f6=_0x39aa0c['offset']+_0x39aa0c[_0xfed1('0x1c')],_0x4af928;if(_0x1a00f6>=_0x123c46){_0x1a00f6=_0x123c46;_0x4af928=0xc8;}else{_0x4af928=0xce;}_0xde25db[_0xfed1('0x1d')](_0x4af928);return _0xde25db['set']('Content-Range',_0x582e67+'-'+_0x1a00f6+'/'+_0x123c46)['json'](_0x1fbb7a);}return null;};}function patchUpdates(_0x1e5afb){return function(_0x51f12a){try{jsonpatch[_0xfed1('0x1e')](_0x51f12a,_0x1e5afb,!![]);}catch(_0x34fa04){return BPromise['reject'](_0x34fa04);}return _0x51f12a[_0xfed1('0x1f')]();};}function saveUpdates(_0x65f14b,_0x59ee9d){return function(_0x3ce944){if(_0x3ce944){return _0x3ce944[_0xfed1('0x20')](_0x65f14b)[_0xfed1('0x21')](function(_0x92b92d){return _0x92b92d;});}return null;};}function removeEntity(_0x4bac79,_0x203cec){return function(_0x59333e){if(_0x59333e){return _0x59333e[_0xfed1('0x22')]()[_0xfed1('0x21')](function(){_0x4bac79[_0xfed1('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x41d22c,_0x594917){return function(_0x460555){if(!_0x460555){_0x41d22c[_0xfed1('0x23')](0x194);}return _0x460555;};}function handleError(_0x1b7b22,_0x365bae){_0x365bae=_0x365bae||0x1f4;return function(_0x186ecc){logger[_0xfed1('0x24')](_0x186ecc['stack']);if(_0x186ecc[_0xfed1('0x25')]){delete _0x186ecc[_0xfed1('0x25')];}_0x1b7b22['status'](_0x365bae)[_0xfed1('0x26')](_0x186ecc);};}exports[_0xfed1('0x27')]=function(_0x1b871a,_0x1d62c5){var _0x3b9122={},_0x1761d1={},_0x583953={'count':0x0,'rows':[]};var _0x4607e9=_['map'](db[_0xfed1('0x28')]['rawAttributes'],function(_0x53b0c9){return{'name':_0x53b0c9[_0xfed1('0x29')],'type':_0x53b0c9[_0xfed1('0x2a')][_0xfed1('0x2b')]};});_0x1761d1['model']=_[_0xfed1('0x2c')](_[_0xfed1('0x2d')](_0x4607e9,_0xfed1('0x25')),[_0xfed1('0x25')]);_0x1761d1[_0xfed1('0x2e')]=_[_0xfed1('0x2f')](_0x1b871a['query']);_0x1761d1[_0xfed1('0x30')]=_[_0xfed1('0x31')](_0x1761d1['model'],_0x1761d1['query']);_0x3b9122[_0xfed1('0x32')]=_[_0xfed1('0x31')](_0x1761d1[_0xfed1('0x33')],qs[_0xfed1('0x34')](_0x1b871a[_0xfed1('0x2e')]['fields']));_0x3b9122[_0xfed1('0x32')]=_0x3b9122[_0xfed1('0x32')][_0xfed1('0x35')]?_0x3b9122[_0xfed1('0x32')]:_0x1761d1[_0xfed1('0x33')];if(!_0x1b871a['query'][_0xfed1('0x36')]('nolimit')){_0x3b9122[_0xfed1('0x1c')]=qs[_0xfed1('0x1c')](_0x1b871a[_0xfed1('0x2e')][_0xfed1('0x1c')]);_0x3b9122[_0xfed1('0x1b')]=qs[_0xfed1('0x1b')](_0x1b871a[_0xfed1('0x2e')][_0xfed1('0x1b')]);}_0x3b9122['order']=qs[_0xfed1('0x37')](_0x1b871a[_0xfed1('0x2e')][_0xfed1('0x37')]);_0x3b9122[_0xfed1('0x38')]=qs['filters'](_['pick'](_0x1b871a[_0xfed1('0x2e')],_0x1761d1[_0xfed1('0x30')]));if(_0x1b871a[_0xfed1('0x2e')][_0xfed1('0x39')]){_0x3b9122[_0xfed1('0x38')]=_[_0xfed1('0x3a')](_0x3b9122[_0xfed1('0x38')],{'$or':_[_0xfed1('0x2d')](_0x4607e9,function(_0x5793a4){if(_0x5793a4['type']!==_0xfed1('0x3b')){var _0x2f6250={};_0x2f6250[_0x5793a4['name']]={'$like':'%'+_0x1b871a[_0xfed1('0x2e')][_0xfed1('0x39')]+'%'};return _0x2f6250;}})});}_0x3b9122=_[_0xfed1('0x3a')]({},_0x3b9122,_0x1b871a[_0xfed1('0x3c')]);var _0x2807c={'where':_0x3b9122[_0xfed1('0x38')]};return db[_0xfed1('0x28')][_0xfed1('0x1a')](_0x2807c)[_0xfed1('0x21')](function(_0x5f3e1f){_0x583953['count']=_0x5f3e1f;if(_0x1b871a['query'][_0xfed1('0x3d')]){_0x3b9122[_0xfed1('0x3e')]=[{'all':!![]}];}return db[_0xfed1('0x28')]['findAll'](_0x3b9122);})[_0xfed1('0x21')](function(_0x4a0b04){_0x583953[_0xfed1('0x3f')]=_0x4a0b04;return _0x583953;})[_0xfed1('0x21')](respondWithFilteredResult(_0x1d62c5,_0x3b9122))[_0xfed1('0x40')](handleError(_0x1d62c5,null));};exports['show']=function(_0x20bdae,_0x6f1647){var _0x422433={'raw':!![],'where':{'id':_0x20bdae[_0xfed1('0x41')]['id']}},_0x4b4115={};_0x4b4115['model']=_[_0xfed1('0x2f')](db[_0xfed1('0x28')][_0xfed1('0x42')]);_0x4b4115[_0xfed1('0x2e')]=_[_0xfed1('0x2f')](_0x20bdae[_0xfed1('0x2e')]);_0x4b4115[_0xfed1('0x30')]=_[_0xfed1('0x31')](_0x4b4115[_0xfed1('0x33')],_0x4b4115['query']);_0x422433[_0xfed1('0x32')]=_[_0xfed1('0x31')](_0x4b4115[_0xfed1('0x33')],qs['fields'](_0x20bdae['query'][_0xfed1('0x34')]));_0x422433[_0xfed1('0x32')]=_0x422433[_0xfed1('0x32')][_0xfed1('0x35')]?_0x422433[_0xfed1('0x32')]:_0x4b4115[_0xfed1('0x33')];if(_0x20bdae[_0xfed1('0x2e')][_0xfed1('0x3d')]){_0x422433[_0xfed1('0x3e')]=[{'all':!![]}];}_0x422433=_[_0xfed1('0x3a')]({},_0x422433,_0x20bdae[_0xfed1('0x3c')]);return db[_0xfed1('0x28')]['find'](_0x422433)[_0xfed1('0x21')](handleEntityNotFound(_0x6f1647,null))[_0xfed1('0x21')](respondWithResult(_0x6f1647,null))[_0xfed1('0x40')](handleError(_0x6f1647,null));};exports[_0xfed1('0x43')]=function(_0x2b6267,_0x1e4781){return db['VoiceMailMessage'][_0xfed1('0x43')](_0x2b6267[_0xfed1('0x44')],{})[_0xfed1('0x21')](respondWithResult(_0x1e4781,0xc9))['catch'](handleError(_0x1e4781,null));};exports[_0xfed1('0x20')]=function(_0x10f98d,_0x156876){if(_0x10f98d[_0xfed1('0x44')]['id']){delete _0x10f98d['body']['id'];}return db[_0xfed1('0x28')][_0xfed1('0x45')]({'where':{'id':_0x10f98d[_0xfed1('0x41')]['id']}})[_0xfed1('0x21')](handleEntityNotFound(_0x156876,null))[_0xfed1('0x21')](saveUpdates(_0x10f98d[_0xfed1('0x44')],null))[_0xfed1('0x21')](respondWithResult(_0x156876,null))[_0xfed1('0x40')](handleError(_0x156876,null));};exports[_0xfed1('0x22')]=function(_0x326f68,_0xa0515c){return db[_0xfed1('0x28')][_0xfed1('0x45')]({'where':{'id':_0x326f68[_0xfed1('0x41')]['id']}})[_0xfed1('0x21')](handleEntityNotFound(_0xa0515c,null))[_0xfed1('0x21')](removeEntity(_0xa0515c,null))[_0xfed1('0x40')](handleError(_0xa0515c,null));};exports[_0xfed1('0x46')]=function(_0x5397c9,_0x589feb,_0x1e1a8e){return db[_0xfed1('0x28')][_0xfed1('0x45')]({'where':{'id':_0x5397c9[_0xfed1('0x41')]['id']},'attributes':['id','recording',_0xfed1('0x47')]})[_0xfed1('0x21')](handleEntityNotFound(_0x589feb,null))['then'](function(_0x4f393c){if(_0x4f393c){if(!_0x4f393c['recording']){throw new db[(_0xfed1('0x48'))][(_0xfed1('0x49'))](_0xfed1('0x4a'));}var _0x1d8ef2={'Content-Type':_0xfed1('0x4b'),'Content-Disposition':_0xfed1('0x4c')};if(_0x4f393c[_0xfed1('0x47')]){_0x1d8ef2[_0xfed1('0x4d')]=_0xfed1('0x4e')+_0x4f393c[_0xfed1('0x47')]+'.wav\x22';}_0x589feb['set'](_0x1d8ef2);return _0x589feb[_0xfed1('0x26')](new Buffer(_0x4f393c[_0xfed1('0x4f')]));}})[_0xfed1('0x40')](handleError(_0x589feb,null));}; \ No newline at end of file +var _0x2d17=['save','update','destroy','error','stack','name','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','merge','VIRTUAL','filter','options','count','then','includeAll','include','VoiceMailMessage','rows','catch','show','params','find','create','body','download','recording','msg_id','ValidationError','audio/wav','attachment','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','send','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','util','sox','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','set','Content-Range','apply','reject'];(function(_0x4450b1,_0x214ace){var _0x399b0b=function(_0x2197df){while(--_0x2197df){_0x4450b1['push'](_0x4450b1['shift']());}};_0x399b0b(++_0x214ace);}(_0x2d17,0x17e));var _0x72d1=function(_0x485e4d,_0x5275ef){_0x485e4d=_0x485e4d-0x0;var _0x52f32a=_0x2d17[_0x485e4d];return _0x52f32a;};'use strict';var pdf=require(_0x72d1('0x0'));var emlformat=require(_0x72d1('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x72d1('0x2'));var jsonpatch=require(_0x72d1('0x3'));var rp=require('request-promise');var moment=require(_0x72d1('0x4'));var BPromise=require(_0x72d1('0x5'));var Mustache=require('mustache');var util=require(_0x72d1('0x6'));var path=require('path');var sox=require(_0x72d1('0x7'));var csv=require('to-csv');var ejs=require(_0x72d1('0x8'));var fs=require('fs');var _=require(_0x72d1('0x9'));var squel=require('squel');var crypto=require(_0x72d1('0xa'));var jsforce=require(_0x72d1('0xb'));var deskjs=require(_0x72d1('0xc'));var toCsv=require('to-csv');var querystring=require(_0x72d1('0xd'));var Papa=require(_0x72d1('0xe'));var Redis=require(_0x72d1('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x72d1('0x10'));var as=require(_0x72d1('0x11'));var hardwareService=require(_0x72d1('0x12'));var logger=require(_0x72d1('0x13'))(_0x72d1('0x14'));var utils=require(_0x72d1('0x15'));var config=require(_0x72d1('0x16'));var db=require(_0x72d1('0x17'))['db'];function respondWithStatusCode(_0x273ccf,_0x2f5a78){_0x2f5a78=_0x2f5a78||0xcc;return function(_0x5ad4df){if(_0x5ad4df){return _0x273ccf[_0x72d1('0x18')](_0x2f5a78);}return _0x273ccf[_0x72d1('0x19')](_0x2f5a78)[_0x72d1('0x1a')]();};}function respondWithResult(_0x115cd7,_0x22ac6f){_0x22ac6f=_0x22ac6f||0xc8;return function(_0x685a27){if(_0x685a27){return _0x115cd7[_0x72d1('0x19')](_0x22ac6f)[_0x72d1('0x1b')](_0x685a27);}};}function respondWithFilteredResult(_0x172fae,_0x3f190f){return function(_0x21c85e){if(_0x21c85e){var _0x23a238=_0x21c85e['count'],_0x8d458=_0x3f190f[_0x72d1('0x1c')],_0x491af4=_0x3f190f[_0x72d1('0x1c')]+_0x3f190f['limit'],_0x46fa3d;if(_0x491af4>=_0x23a238){_0x491af4=_0x23a238;_0x46fa3d=0xc8;}else{_0x46fa3d=0xce;}_0x172fae[_0x72d1('0x19')](_0x46fa3d);return _0x172fae[_0x72d1('0x1d')](_0x72d1('0x1e'),_0x8d458+'-'+_0x491af4+'/'+_0x23a238)['json'](_0x21c85e);}return null;};}function patchUpdates(_0x4925f6){return function(_0x313d7b){try{jsonpatch[_0x72d1('0x1f')](_0x313d7b,_0x4925f6,!![]);}catch(_0x2233cb){return BPromise[_0x72d1('0x20')](_0x2233cb);}return _0x313d7b[_0x72d1('0x21')]();};}function saveUpdates(_0x2253fd,_0x1e2411){return function(_0x5c7982){if(_0x5c7982){return _0x5c7982[_0x72d1('0x22')](_0x2253fd)['then'](function(_0x506062){return _0x506062;});}return null;};}function removeEntity(_0x5b85cc,_0x585243){return function(_0x445985){if(_0x445985){return _0x445985[_0x72d1('0x23')]()['then'](function(){_0x5b85cc[_0x72d1('0x19')](0xcc)[_0x72d1('0x1a')]();});}};}function handleEntityNotFound(_0x492086,_0x1431ee){return function(_0x26fa35){if(!_0x26fa35){_0x492086['sendStatus'](0x194);}return _0x26fa35;};}function handleError(_0x5e0f73,_0x188eca){_0x188eca=_0x188eca||0x1f4;return function(_0x36bc65){logger[_0x72d1('0x24')](_0x36bc65[_0x72d1('0x25')]);if(_0x36bc65[_0x72d1('0x26')]){delete _0x36bc65[_0x72d1('0x26')];}_0x5e0f73[_0x72d1('0x19')](_0x188eca)['send'](_0x36bc65);};}exports['index']=function(_0x1ba258,_0x482cb8){var _0x18ca85={},_0x3454fc={},_0x2c113d={'count':0x0,'rows':[]};var _0x4da489=_[_0x72d1('0x27')](db['VoiceMailMessage'][_0x72d1('0x28')],function(_0x20055f){return{'name':_0x20055f[_0x72d1('0x29')],'type':_0x20055f[_0x72d1('0x2a')]['key']};});_0x3454fc[_0x72d1('0x2b')]=_['differenceBy'](_[_0x72d1('0x27')](_0x4da489,_0x72d1('0x26')),['name']);_0x3454fc[_0x72d1('0x2c')]=_[_0x72d1('0x2d')](_0x1ba258[_0x72d1('0x2c')]);_0x3454fc[_0x72d1('0x2e')]=_[_0x72d1('0x2f')](_0x3454fc['model'],_0x3454fc[_0x72d1('0x2c')]);_0x18ca85[_0x72d1('0x30')]=_[_0x72d1('0x2f')](_0x3454fc['model'],qs[_0x72d1('0x31')](_0x1ba258[_0x72d1('0x2c')]['fields']));_0x18ca85[_0x72d1('0x30')]=_0x18ca85[_0x72d1('0x30')][_0x72d1('0x32')]?_0x18ca85['attributes']:_0x3454fc[_0x72d1('0x2b')];if(!_0x1ba258['query'][_0x72d1('0x33')](_0x72d1('0x34'))){_0x18ca85[_0x72d1('0x35')]=qs[_0x72d1('0x35')](_0x1ba258[_0x72d1('0x2c')][_0x72d1('0x35')]);_0x18ca85[_0x72d1('0x1c')]=qs[_0x72d1('0x1c')](_0x1ba258[_0x72d1('0x2c')][_0x72d1('0x1c')]);}_0x18ca85[_0x72d1('0x36')]=qs['sort'](_0x1ba258[_0x72d1('0x2c')][_0x72d1('0x37')]);_0x18ca85[_0x72d1('0x38')]=qs[_0x72d1('0x2e')](_['pick'](_0x1ba258[_0x72d1('0x2c')],_0x3454fc[_0x72d1('0x2e')]));if(_0x1ba258[_0x72d1('0x2c')]['filter']){_0x18ca85[_0x72d1('0x38')]=_[_0x72d1('0x39')](_0x18ca85[_0x72d1('0x38')],{'$or':_['map'](_0x4da489,function(_0x339db9){if(_0x339db9[_0x72d1('0x2a')]!==_0x72d1('0x3a')){var _0x53e5a1={};_0x53e5a1[_0x339db9[_0x72d1('0x26')]]={'$like':'%'+_0x1ba258[_0x72d1('0x2c')][_0x72d1('0x3b')]+'%'};return _0x53e5a1;}})});}_0x18ca85=_[_0x72d1('0x39')]({},_0x18ca85,_0x1ba258[_0x72d1('0x3c')]);var _0x785820={'where':_0x18ca85[_0x72d1('0x38')]};return db['VoiceMailMessage'][_0x72d1('0x3d')](_0x785820)[_0x72d1('0x3e')](function(_0x440ac5){_0x2c113d[_0x72d1('0x3d')]=_0x440ac5;if(_0x1ba258[_0x72d1('0x2c')][_0x72d1('0x3f')]){_0x18ca85[_0x72d1('0x40')]=[{'all':!![]}];}return db[_0x72d1('0x41')]['findAll'](_0x18ca85);})[_0x72d1('0x3e')](function(_0x1a6dd4){_0x2c113d[_0x72d1('0x42')]=_0x1a6dd4;return _0x2c113d;})[_0x72d1('0x3e')](respondWithFilteredResult(_0x482cb8,_0x18ca85))[_0x72d1('0x43')](handleError(_0x482cb8,null));};exports[_0x72d1('0x44')]=function(_0xb911fa,_0x3620df){var _0x5620f0={'raw':!![],'where':{'id':_0xb911fa[_0x72d1('0x45')]['id']}},_0x563c5a={};_0x563c5a[_0x72d1('0x2b')]=_[_0x72d1('0x2d')](db[_0x72d1('0x41')]['rawAttributes']);_0x563c5a[_0x72d1('0x2c')]=_[_0x72d1('0x2d')](_0xb911fa['query']);_0x563c5a[_0x72d1('0x2e')]=_['intersection'](_0x563c5a[_0x72d1('0x2b')],_0x563c5a[_0x72d1('0x2c')]);_0x5620f0['attributes']=_[_0x72d1('0x2f')](_0x563c5a['model'],qs['fields'](_0xb911fa['query'][_0x72d1('0x31')]));_0x5620f0['attributes']=_0x5620f0[_0x72d1('0x30')][_0x72d1('0x32')]?_0x5620f0[_0x72d1('0x30')]:_0x563c5a['model'];if(_0xb911fa['query'][_0x72d1('0x3f')]){_0x5620f0['include']=[{'all':!![]}];}_0x5620f0=_['merge']({},_0x5620f0,_0xb911fa[_0x72d1('0x3c')]);return db[_0x72d1('0x41')][_0x72d1('0x46')](_0x5620f0)['then'](handleEntityNotFound(_0x3620df,null))['then'](respondWithResult(_0x3620df,null))['catch'](handleError(_0x3620df,null));};exports['create']=function(_0x9b7951,_0x1ca29d){return db[_0x72d1('0x41')][_0x72d1('0x47')](_0x9b7951[_0x72d1('0x48')],{})[_0x72d1('0x3e')](respondWithResult(_0x1ca29d,0xc9))[_0x72d1('0x43')](handleError(_0x1ca29d,null));};exports[_0x72d1('0x22')]=function(_0x1e2c11,_0x5f121f){if(_0x1e2c11[_0x72d1('0x48')]['id']){delete _0x1e2c11[_0x72d1('0x48')]['id'];}return db[_0x72d1('0x41')]['find']({'where':{'id':_0x1e2c11[_0x72d1('0x45')]['id']}})[_0x72d1('0x3e')](handleEntityNotFound(_0x5f121f,null))[_0x72d1('0x3e')](saveUpdates(_0x1e2c11['body'],null))[_0x72d1('0x3e')](respondWithResult(_0x5f121f,null))[_0x72d1('0x43')](handleError(_0x5f121f,null));};exports[_0x72d1('0x23')]=function(_0x1bf626,_0x48c20d){return db['VoiceMailMessage'][_0x72d1('0x46')]({'where':{'id':_0x1bf626[_0x72d1('0x45')]['id']}})[_0x72d1('0x3e')](handleEntityNotFound(_0x48c20d,null))['then'](removeEntity(_0x48c20d,null))[_0x72d1('0x43')](handleError(_0x48c20d,null));};exports[_0x72d1('0x49')]=function(_0x32673e,_0x463670,_0x12d20f){return db[_0x72d1('0x41')][_0x72d1('0x46')]({'where':{'id':_0x32673e[_0x72d1('0x45')]['id']},'attributes':['id',_0x72d1('0x4a'),_0x72d1('0x4b')]})[_0x72d1('0x3e')](handleEntityNotFound(_0x463670,null))['then'](function(_0x46b2f5){if(_0x46b2f5){if(!_0x46b2f5['recording']){throw new db['Sequelize'][(_0x72d1('0x4c'))]('VoiceMailMessage\x20not\x20found');}var _0x3c880e={'Content-Type':_0x72d1('0x4d'),'Content-Disposition':_0x72d1('0x4e')};if(_0x46b2f5[_0x72d1('0x4b')]){_0x3c880e[_0x72d1('0x4f')]=_0x72d1('0x50')+_0x46b2f5[_0x72d1('0x4b')]+_0x72d1('0x51');}_0x463670[_0x72d1('0x1d')](_0x3c880e);return _0x463670[_0x72d1('0x52')](new Buffer(_0x46b2f5[_0x72d1('0x4a')]));}})['catch'](handleError(_0x463670,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 0300ce9..e90c451 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 _0x6a00=['rimraf','../../config/environment','./voiceMailMessage.attributes','exports','define','dir','lodash','util','api','moment','request-promise','path'];(function(_0x326f4c,_0x2d77b9){var _0x1b6260=function(_0x3af4d3){while(--_0x3af4d3){_0x326f4c['push'](_0x326f4c['shift']());}};_0x1b6260(++_0x2d77b9);}(_0x6a00,0x156));var _0x06a0=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0x6a00[_0x4c12ec];return _0x3ae42c;};'use strict';var _=require(_0x06a0('0x0'));var util=require(_0x06a0('0x1'));var logger=require('../../config/logger')(_0x06a0('0x2'));var moment=require(_0x06a0('0x3'));var BPromise=require('bluebird');var rp=require(_0x06a0('0x4'));var fs=require('fs');var path=require(_0x06a0('0x5'));var rimraf=require(_0x06a0('0x6'));var config=require(_0x06a0('0x7'));var attributes=require(_0x06a0('0x8'));module[_0x06a0('0x9')]=function(_0x6cba5b,_0x3b8340){return _0x6cba5b[_0x06a0('0xa')]('VoiceMailMessage',attributes,{'tableName':'voice_voicemail_messages','paranoid':![],'indexes':[{'name':_0x06a0('0xb'),'fields':['dir']}],'timestamps':![]});}; \ No newline at end of file +var _0x17e5=['./voiceMailMessage.attributes','exports','VoiceMailMessage','voice_voicemail_messages','dir','lodash','util','api','moment','rimraf','../../config/environment'];(function(_0xe02b51,_0x3e493f){var _0xe27c25=function(_0x115ebb){while(--_0x115ebb){_0xe02b51['push'](_0xe02b51['shift']());}};_0xe27c25(++_0x3e493f);}(_0x17e5,0x139));var _0x517e=function(_0x1296a4,_0x18988b){_0x1296a4=_0x1296a4-0x0;var _0x2fa4f8=_0x17e5[_0x1296a4];return _0x2fa4f8;};'use strict';var _=require(_0x517e('0x0'));var util=require(_0x517e('0x1'));var logger=require('../../config/logger')(_0x517e('0x2'));var moment=require(_0x517e('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x517e('0x4'));var config=require(_0x517e('0x5'));var attributes=require(_0x517e('0x6'));module[_0x517e('0x7')]=function(_0x184045,_0x1071da){return _0x184045['define'](_0x517e('0x8'),attributes,{'tableName':_0x517e('0x9'),'paranoid':![],'indexes':[{'name':_0x517e('0xa'),'fields':[_0x517e('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 5d4ca39..bba50ba 100644 --- a/server/api/voiceMailMessage/voiceMailMessage.rpc.js +++ b/server/api/voiceMailMessage/voiceMailMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x57ca=['client','http','request','info','request\x20sent','VoiceMailMessage,\x20%s,\x20%s,\x20%s','error','code','VoiceMailMessage,\x20%s,\x20%s','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x451f85,_0xc4403c){var _0x216acb=function(_0x9f69e){while(--_0x9f69e){_0x451f85['push'](_0x451f85['shift']());}};_0x216acb(++_0xc4403c);}(_0x57ca,0x108));var _0xa57c=function(_0x2e5b0b,_0x58da89){_0x2e5b0b=_0x2e5b0b-0x0;var _0x2fcdd9=_0x57ca[_0x2e5b0b];return _0x2fcdd9;};'use strict';var _=require('lodash');var util=require(_0xa57c('0x0'));var moment=require(_0xa57c('0x1'));var BPromise=require('bluebird');var rs=require(_0xa57c('0x2'));var fs=require('fs');var Redis=require(_0xa57c('0x3'));var db=require(_0xa57c('0x4'))['db'];var utils=require(_0xa57c('0x5'));var logger=require(_0xa57c('0x6'))('rpc');var config=require(_0xa57c('0x7'));var jayson=require(_0xa57c('0x8'));var client=jayson[_0xa57c('0x9')][_0xa57c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xbdfffb,_0x314574,_0x19e28e){return new BPromise(function(_0x271ccc,_0x5e3962){return client[_0xa57c('0xb')](_0xbdfffb,_0x19e28e)['then'](function(_0x46ba92){logger[_0xa57c('0xc')]('VoiceMailMessage,\x20%s,\x20%s',_0x314574,_0xa57c('0xd'));logger['debug'](_0xa57c('0xe'),_0x314574,_0xa57c('0xd'),JSON['stringify'](_0x46ba92));if(_0x46ba92[_0xa57c('0xf')]){if(_0x46ba92['error'][_0xa57c('0x10')]===0x1f4){logger[_0xa57c('0xf')](_0xa57c('0x11'),_0x314574,_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);return _0x5e3962(_0x46ba92['error'][_0xa57c('0x12')]);}logger['error'](_0xa57c('0x11'),_0x314574,_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);return _0x271ccc(_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);}else{logger[_0xa57c('0xc')](_0xa57c('0x11'),_0x314574,'request\x20sent');_0x271ccc(_0x46ba92[_0xa57c('0x13')][_0xa57c('0x12')]);}})[_0xa57c('0x14')](function(_0x5a6024){logger[_0xa57c('0xf')]('VoiceMailMessage,\x20%s,\x20%s',_0x314574,_0x5a6024);_0x5e3962(_0x5a6024);});});} \ No newline at end of file +var _0xadb5=['error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x2ecea0,_0x36a83d){var _0x17ab22=function(_0x768e97){while(--_0x768e97){_0x2ecea0['push'](_0x2ecea0['shift']());}};_0x17ab22(++_0x36a83d);}(_0xadb5,0xad));var _0x5adb=function(_0x2e23df,_0x5691a0){_0x2e23df=_0x2e23df-0x0;var _0x424d14=_0xadb5[_0x2e23df];return _0x424d14;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3213e8,_0xdf3776,_0x353885){return new BPromise(function(_0x47228a,_0x6d1b45){return client[_0x5adb('0xa')](_0x3213e8,_0x353885)[_0x5adb('0xb')](function(_0x34f59d){logger[_0x5adb('0xc')](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));logger['debug']('VoiceMailMessage,\x20%s,\x20%s,\x20%s',_0xdf3776,_0x5adb('0xe'),JSON[_0x5adb('0xf')](_0x34f59d));if(_0x34f59d[_0x5adb('0x10')]){if(_0x34f59d['error'][_0x5adb('0x11')]===0x1f4){logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d['error'][_0x5adb('0x12')]);return _0x6d1b45(_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);}logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);return _0x47228a(_0x34f59d['error'][_0x5adb('0x12')]);}else{logger['info'](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));_0x47228a(_0x34f59d[_0x5adb('0x13')][_0x5adb('0x12')]);}})[_0x5adb('0x14')](function(_0x39d24d){logger[_0x5adb('0x10')](_0x5adb('0xd'),_0xdf3776,_0x39d24d);_0x6d1b45(_0x39d24d);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index 51e22ee..2df0c6e 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 _0xb263=['get','getSounds','post','create','addSound','put','update','delete','destroy','/:id/sounds/:id2','exports','util','path','express','Router','../../config/environment','./voiceMusicOnHold.controller','isAuthenticated','index','show'];(function(_0x2b9fee,_0x4baa8b){var _0x581d2f=function(_0x1ddce4){while(--_0x1ddce4){_0x2b9fee['push'](_0x2b9fee['shift']());}};_0x581d2f(++_0x4baa8b);}(_0xb263,0x1eb));var _0x3b26=function(_0x487d39,_0x44c583){_0x487d39=_0x487d39-0x0;var _0x541829=_0xb263[_0x487d39];return _0x541829;};'use strict';var multer=require('multer');var util=require(_0x3b26('0x0'));var path=require(_0x3b26('0x1'));var timeout=require('connect-timeout');var express=require(_0x3b26('0x2'));var router=express[_0x3b26('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x3b26('0x4'));var controller=require(_0x3b26('0x5'));router['get']('/',auth[_0x3b26('0x6')](),controller[_0x3b26('0x7')]);router['get']('/:id',auth[_0x3b26('0x6')](),controller[_0x3b26('0x8')]);router[_0x3b26('0x9')]('/:id/sounds',auth[_0x3b26('0x6')](),controller[_0x3b26('0xa')]);router[_0x3b26('0xb')]('/',auth['isAuthenticated'](),controller[_0x3b26('0xc')]);router['post']('/:id/sounds',auth[_0x3b26('0x6')](),controller[_0x3b26('0xd')]);router[_0x3b26('0xe')]('/:id',auth[_0x3b26('0x6')](),controller[_0x3b26('0xf')]);router[_0x3b26('0x10')]('/:id',auth[_0x3b26('0x6')](),controller[_0x3b26('0x11')]);router[_0x3b26('0x10')](_0x3b26('0x12'),auth['isAuthenticated'](),controller['removeSound']);module[_0x3b26('0x13')]=router; \ No newline at end of file +var _0x58f2=['../../config/environment','./voiceMusicOnHold.controller','get','index','/:id','isAuthenticated','show','/:id/sounds','getSounds','post','create','put','update','destroy','/:id/sounds/:id2','removeSound','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service'];(function(_0x38e47a,_0xc032eb){var _0x1b0649=function(_0x392ba2){while(--_0x392ba2){_0x38e47a['push'](_0x38e47a['shift']());}};_0x1b0649(++_0xc032eb);}(_0x58f2,0x144));var _0x258f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x58f2[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x258f('0x0'));var path=require(_0x258f('0x1'));var timeout=require(_0x258f('0x2'));var express=require(_0x258f('0x3'));var router=express['Router']();var auth=require(_0x258f('0x4'));var interaction=require(_0x258f('0x5'));var config=require(_0x258f('0x6'));var controller=require(_0x258f('0x7'));router[_0x258f('0x8')]('/',auth['isAuthenticated'](),controller[_0x258f('0x9')]);router[_0x258f('0x8')](_0x258f('0xa'),auth[_0x258f('0xb')](),controller[_0x258f('0xc')]);router[_0x258f('0x8')](_0x258f('0xd'),auth['isAuthenticated'](),controller[_0x258f('0xe')]);router[_0x258f('0xf')]('/',auth['isAuthenticated'](),controller[_0x258f('0x10')]);router['post']('/:id/sounds',auth[_0x258f('0xb')](),controller['addSound']);router[_0x258f('0x11')](_0x258f('0xa'),auth['isAuthenticated'](),controller[_0x258f('0x12')]);router['delete'](_0x258f('0xa'),auth[_0x258f('0xb')](),controller[_0x258f('0x13')]);router['delete'](_0x258f('0x14'),auth[_0x258f('0xb')](),controller[_0x258f('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index 7659bbc..7be34e1 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 _0x62c9=['mp3','alpha','TIMESTAMP','BOOLEAN','sequelize','exports','STRING','name','ENUM','custom','files','mp3nb','quietmp3nb','quietmp3'];(function(_0x252d1e,_0x4d28b1){var _0xee5b10=function(_0x39eac7){while(--_0x39eac7){_0x252d1e['push'](_0x252d1e['shift']());}};_0xee5b10(++_0x4d28b1);}(_0x62c9,0x11c));var _0x962c=function(_0x281136,_0x5c5eda){_0x281136=_0x281136-0x0;var _0x567310=_0x62c9[_0x281136];return _0x567310;};'use strict';var Sequelize=require(_0x962c('0x0'));module[_0x962c('0x1')]={'name':{'type':Sequelize[_0x962c('0x2')],'allowNull':![],'unique':_0x962c('0x3')},'mode':{'type':Sequelize[_0x962c('0x4')](_0x962c('0x5'),_0x962c('0x6'),_0x962c('0x7'),_0x962c('0x8'),_0x962c('0x9'),_0x962c('0xa')),'allowNull':!![],'defaultValue':'files'},'directory':{'type':Sequelize[_0x962c('0x2')],'allowNull':!![]},'application':{'type':Sequelize[_0x962c('0x2')],'allowNull':!![]},'digit':{'type':Sequelize[_0x962c('0x2')],'allowNull':!![]},'sort':{'type':Sequelize[_0x962c('0x2')],'allowNull':!![],'defaultValue':_0x962c('0xb')},'format':{'type':Sequelize[_0x962c('0x2')],'allowNull':!![]},'stamp':{'type':_0x962c('0xc')},'defaultEntry':{'type':Sequelize[_0x962c('0xd')],'defaultValue':0x0}}; \ No newline at end of file +var _0xfbc8=['sequelize','exports','STRING','name','ENUM','custom','mp3nb','quietmp3nb','quietmp3','mp3','TIMESTAMP'];(function(_0x195d46,_0x27832e){var _0x2435d4=function(_0x3d868d){while(--_0x3d868d){_0x195d46['push'](_0x195d46['shift']());}};_0x2435d4(++_0x27832e);}(_0xfbc8,0x8f));var _0x8fbc=function(_0x14bfbf,_0x552595){_0x14bfbf=_0x14bfbf-0x0;var _0x3a29d4=_0xfbc8[_0x14bfbf];return _0x3a29d4;};'use strict';var Sequelize=require(_0x8fbc('0x0'));module[_0x8fbc('0x1')]={'name':{'type':Sequelize[_0x8fbc('0x2')],'allowNull':![],'unique':_0x8fbc('0x3')},'mode':{'type':Sequelize[_0x8fbc('0x4')](_0x8fbc('0x5'),'files',_0x8fbc('0x6'),_0x8fbc('0x7'),_0x8fbc('0x8'),_0x8fbc('0x9')),'allowNull':!![],'defaultValue':'files'},'directory':{'type':Sequelize[_0x8fbc('0x2')],'allowNull':!![]},'application':{'type':Sequelize['STRING'],'allowNull':!![]},'digit':{'type':Sequelize['STRING'],'allowNull':!![]},'sort':{'type':Sequelize[_0x8fbc('0x2')],'allowNull':!![],'defaultValue':'alpha'},'format':{'type':Sequelize['STRING'],'allowNull':!![]},'stamp':{'type':_0x8fbc('0xa')},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js index ed20526..ddb3a9f 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 _0xa5d0=['user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','rmdirSync','ValidationError','addSound','Sound','findOne','save_name','server/files/sounds/converted','format','%s.%s','basename','extname','symlinkSync','Sequelize','message','id2','converted_format','createdAt','unlinkSync','getSounds','nolimit','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','ejs','squel','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','destroy','then','get','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','limit','sort','pick','where','VIRTUAL','filter','merge','options','VoiceMusicOnHold','includeAll','include','findAll','rows','catch','params','find','body','create','sequelize','transaction','mode','files','join','root','server/files/moh','mkdirSync','directory'];(function(_0x569caa,_0x5174ce){var _0x44cb5a=function(_0x456df4){while(--_0x456df4){_0x569caa['push'](_0x569caa['shift']());}};_0x44cb5a(++_0x5174ce);}(_0xa5d0,0x1dc));var _0x0a5d=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0xa5d0[_0x37bd26];return _0xe83dc4;};'use strict';var pdf=require(_0x0a5d('0x0'));var emlformat=require(_0x0a5d('0x1'));var rimraf=require(_0x0a5d('0x2'));var zipdir=require(_0x0a5d('0x3'));var jsonpatch=require(_0x0a5d('0x4'));var rp=require(_0x0a5d('0x5'));var moment=require(_0x0a5d('0x6'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x0a5d('0x7'));var path=require(_0x0a5d('0x8'));var sox=require(_0x0a5d('0x9'));var csv=require('to-csv');var ejs=require(_0x0a5d('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x0a5d('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a5d('0xc'));var toCsv=require(_0x0a5d('0xd'));var querystring=require(_0x0a5d('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x0a5d('0xf'));var qs=require(_0x0a5d('0x10'));var as=require(_0x0a5d('0x11'));var hardwareService=require(_0x0a5d('0x12'));var logger=require(_0x0a5d('0x13'))(_0x0a5d('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x0a5d('0x15'))['db'];function respondWithStatusCode(_0x2f08ca,_0x1c21d6){_0x1c21d6=_0x1c21d6||0xcc;return function(_0xe1bc37){if(_0xe1bc37){return _0x2f08ca[_0x0a5d('0x16')](_0x1c21d6);}return _0x2f08ca[_0x0a5d('0x17')](_0x1c21d6)[_0x0a5d('0x18')]();};}function respondWithResult(_0x40cd83,_0x193888){_0x193888=_0x193888||0xc8;return function(_0x2c7c5b){if(_0x2c7c5b){return _0x40cd83[_0x0a5d('0x17')](_0x193888)[_0x0a5d('0x19')](_0x2c7c5b);}};}function respondWithFilteredResult(_0x2788d5,_0x4ce8f4){return function(_0xdc6ef9){if(_0xdc6ef9){var _0x531de0=_0xdc6ef9[_0x0a5d('0x1a')],_0x427a41=_0x4ce8f4['offset'],_0x4b4c7b=_0x4ce8f4[_0x0a5d('0x1b')]+_0x4ce8f4['limit'],_0x45b5fc;if(_0x4b4c7b>=_0x531de0){_0x4b4c7b=_0x531de0;_0x45b5fc=0xc8;}else{_0x45b5fc=0xce;}_0x2788d5[_0x0a5d('0x17')](_0x45b5fc);return _0x2788d5[_0x0a5d('0x1c')](_0x0a5d('0x1d'),_0x427a41+'-'+_0x4b4c7b+'/'+_0x531de0)[_0x0a5d('0x19')](_0xdc6ef9);}return null;};}function patchUpdates(_0xb91f33){return function(_0x3eeef1){try{jsonpatch[_0x0a5d('0x1e')](_0x3eeef1,_0xb91f33,!![]);}catch(_0x5733a5){return BPromise[_0x0a5d('0x1f')](_0x5733a5);}return _0x3eeef1[_0x0a5d('0x20')]();};}function saveUpdates(_0x262e55,_0x6301a8){return function(_0xcca3f0){if(_0xcca3f0){return _0xcca3f0[_0x0a5d('0x21')](_0x262e55)['then'](function(_0x2e07df){return _0x2e07df;});}return null;};}function removeEntity(_0x1dd1e4,_0x272147){return function(_0x112204){if(_0x112204){return _0x112204[_0x0a5d('0x22')]()[_0x0a5d('0x23')](function(){var _0x4fcd2b=_0x112204[_0x0a5d('0x24')]({'plain':!![]});var _0xb779b8='MusicOnHolds';return db[_0x0a5d('0x25')][_0x0a5d('0x22')]({'where':{'type':_0xb779b8,'resourceId':_0x4fcd2b['id']}})[_0x0a5d('0x23')](function(){return _0x112204;});})[_0x0a5d('0x23')](function(){_0x1dd1e4['status'](0xcc)[_0x0a5d('0x18')]();});}};}function handleEntityNotFound(_0x3a3d4b,_0x2d1749){return function(_0x5724e7){if(!_0x5724e7){_0x3a3d4b[_0x0a5d('0x16')](0x194);}return _0x5724e7;};}function handleError(_0x409556,_0x538249){_0x538249=_0x538249||0x1f4;return function(_0x3f4823){logger[_0x0a5d('0x26')](_0x3f4823[_0x0a5d('0x27')]);if(_0x3f4823[_0x0a5d('0x28')]){delete _0x3f4823[_0x0a5d('0x28')];}_0x409556['status'](_0x538249)[_0x0a5d('0x29')](_0x3f4823);};}exports[_0x0a5d('0x2a')]=function(_0x331891,_0x4dd239){var _0x46e626={},_0x4bce2d={},_0x44f067={'count':0x0,'rows':[]};var _0x445d0c=_[_0x0a5d('0x2b')](db['VoiceMusicOnHold'][_0x0a5d('0x2c')],function(_0x4b5360){return{'name':_0x4b5360[_0x0a5d('0x2d')],'type':_0x4b5360[_0x0a5d('0x2e')][_0x0a5d('0x2f')]};});_0x4bce2d[_0x0a5d('0x30')]=_[_0x0a5d('0x2b')](_0x445d0c,_0x0a5d('0x28'));_0x4bce2d[_0x0a5d('0x31')]=_[_0x0a5d('0x32')](_0x331891['query']);_0x4bce2d[_0x0a5d('0x33')]=_[_0x0a5d('0x34')](_0x4bce2d[_0x0a5d('0x30')],_0x4bce2d[_0x0a5d('0x31')]);_0x46e626['attributes']=_[_0x0a5d('0x34')](_0x4bce2d[_0x0a5d('0x30')],qs[_0x0a5d('0x35')](_0x331891[_0x0a5d('0x31')][_0x0a5d('0x35')]));_0x46e626[_0x0a5d('0x36')]=_0x46e626[_0x0a5d('0x36')][_0x0a5d('0x37')]?_0x46e626[_0x0a5d('0x36')]:_0x4bce2d['model'];if(!_0x331891[_0x0a5d('0x31')][_0x0a5d('0x38')]('nolimit')){_0x46e626[_0x0a5d('0x39')]=qs[_0x0a5d('0x39')](_0x331891[_0x0a5d('0x31')][_0x0a5d('0x39')]);_0x46e626[_0x0a5d('0x1b')]=qs['offset'](_0x331891[_0x0a5d('0x31')][_0x0a5d('0x1b')]);}_0x46e626['order']=qs[_0x0a5d('0x3a')](_0x331891[_0x0a5d('0x31')][_0x0a5d('0x3a')]);_0x46e626['where']=qs['filters'](_[_0x0a5d('0x3b')](_0x331891['query'],_0x4bce2d['filters']));if(_0x331891[_0x0a5d('0x31')]['filter']){_0x46e626[_0x0a5d('0x3c')]=_['merge'](_0x46e626['where'],{'$or':_[_0x0a5d('0x2b')](_0x445d0c,function(_0x823af9){if(_0x823af9['type']!==_0x0a5d('0x3d')){var _0x328849={};_0x328849[_0x823af9[_0x0a5d('0x28')]]={'$like':'%'+_0x331891[_0x0a5d('0x31')][_0x0a5d('0x3e')]+'%'};return _0x328849;}})});}_0x46e626=_[_0x0a5d('0x3f')]({},_0x46e626,_0x331891[_0x0a5d('0x40')]);var _0x317321={'where':_0x46e626['where']};return db[_0x0a5d('0x41')]['count'](_0x317321)['then'](function(_0x55c8df){_0x44f067[_0x0a5d('0x1a')]=_0x55c8df;if(_0x331891['query'][_0x0a5d('0x42')]){_0x46e626[_0x0a5d('0x43')]=[{'all':!![]}];}return db[_0x0a5d('0x41')][_0x0a5d('0x44')](_0x46e626);})[_0x0a5d('0x23')](function(_0x2e1f3b){_0x44f067[_0x0a5d('0x45')]=_0x2e1f3b;return _0x44f067;})[_0x0a5d('0x23')](respondWithFilteredResult(_0x4dd239,_0x46e626))[_0x0a5d('0x46')](handleError(_0x4dd239,null));};exports['show']=function(_0x5ee342,_0x19e3d7){var _0xed7ac={'raw':![],'where':{'id':_0x5ee342[_0x0a5d('0x47')]['id']}},_0x3face9={};_0x3face9[_0x0a5d('0x30')]=_[_0x0a5d('0x32')](db[_0x0a5d('0x41')][_0x0a5d('0x2c')]);_0x3face9[_0x0a5d('0x31')]=_[_0x0a5d('0x32')](_0x5ee342[_0x0a5d('0x31')]);_0x3face9[_0x0a5d('0x33')]=_['intersection'](_0x3face9[_0x0a5d('0x30')],_0x3face9['query']);_0xed7ac[_0x0a5d('0x36')]=_[_0x0a5d('0x34')](_0x3face9[_0x0a5d('0x30')],qs[_0x0a5d('0x35')](_0x5ee342['query'][_0x0a5d('0x35')]));_0xed7ac[_0x0a5d('0x36')]=_0xed7ac[_0x0a5d('0x36')]['length']?_0xed7ac[_0x0a5d('0x36')]:_0x3face9['model'];if(_0x5ee342[_0x0a5d('0x31')][_0x0a5d('0x42')]){_0xed7ac[_0x0a5d('0x43')]=[{'all':!![]}];}_0xed7ac=_[_0x0a5d('0x3f')]({},_0xed7ac,_0x5ee342[_0x0a5d('0x40')]);return db[_0x0a5d('0x41')][_0x0a5d('0x48')](_0xed7ac)[_0x0a5d('0x23')](handleEntityNotFound(_0x19e3d7,null))[_0x0a5d('0x23')](respondWithResult(_0x19e3d7,null))['catch'](handleError(_0x19e3d7,null));};exports[_0x0a5d('0x21')]=function(_0x20a8a8,_0x34c6c8){if(_0x20a8a8[_0x0a5d('0x49')]['id']){delete _0x20a8a8[_0x0a5d('0x49')]['id'];}return db[_0x0a5d('0x41')][_0x0a5d('0x48')]({'where':{'id':_0x20a8a8[_0x0a5d('0x47')]['id']}})['then'](handleEntityNotFound(_0x34c6c8,null))[_0x0a5d('0x23')](saveUpdates(_0x20a8a8[_0x0a5d('0x49')],null))[_0x0a5d('0x23')](respondWithResult(_0x34c6c8,null))[_0x0a5d('0x46')](handleError(_0x34c6c8,null));};exports[_0x0a5d('0x4a')]=function(_0x4f92db,_0x59b4b4,_0xd8bbf4){return db[_0x0a5d('0x4b')][_0x0a5d('0x4c')](function(_0x25f9f9){if(_0x4f92db[_0x0a5d('0x49')][_0x0a5d('0x4d')]===_0x0a5d('0x4e')){_0x4f92db['body']['directory']=path[_0x0a5d('0x4f')](config[_0x0a5d('0x50')],_0x0a5d('0x51'),_0x4f92db['body']['name']);}return db[_0x0a5d('0x41')]['create'](_0x4f92db['body'],{'transaction':_0x25f9f9})[_0x0a5d('0x23')](function(_0x433148){if(_0x4f92db[_0x0a5d('0x49')][_0x0a5d('0x4d')]===_0x0a5d('0x4e')){fs[_0x0a5d('0x52')](_0x433148[_0x0a5d('0x53')],parseInt('0777',0x8));}var _0x46bf35=_0x4f92db[_0x0a5d('0x54')][_0x0a5d('0x24')]({'plain':!![]});if(!_0x46bf35)throw new Error(_0x0a5d('0x55'));if(_0x46bf35[_0x0a5d('0x56')]===_0x0a5d('0x54')){var _0x179420=_0x433148['get']({'plain':!![]});return db[_0x0a5d('0x57')][_0x0a5d('0x48')]({'where':{'name':'MusicOnHolds','userProfileId':_0x46bf35[_0x0a5d('0x58')]},'raw':!![]})['then'](function(_0x398320){if(_0x398320&&_0x398320[_0x0a5d('0x59')]===0x0){return db[_0x0a5d('0x25')]['create']({'name':_0x179420['name'],'resourceId':_0x179420['id'],'type':_0x398320['name'],'sectionId':_0x398320['id']},{})[_0x0a5d('0x23')](function(){return _0x433148;});}else{return _0x433148;}})['catch'](function(_0x4071c8){logger[_0x0a5d('0x26')](_0x0a5d('0x5a'),_0x4071c8);});}return _0x433148;});})['then'](respondWithResult(_0x59b4b4,0xc9))[_0x0a5d('0x46')](handleError(_0x59b4b4,null));};exports['destroy']=function(_0x21416c,_0x4002e8,_0x1cabd5){var _0x35faab;return db[_0x0a5d('0x41')][_0x0a5d('0x48')]({'where':{'id':_0x21416c[_0x0a5d('0x47')]['id']}})[_0x0a5d('0x23')](function(_0x41d32f){if(_0x41d32f){return db['sequelize'][_0x0a5d('0x4c')](function(_0x2cd386){return _0x41d32f[_0x0a5d('0x22')]({'transaction':_0x2cd386,'raw':!![]})['then'](function(_0x4df244){if(_0x4df244['directory']){fs[_0x0a5d('0x5b')](_0x4df244['directory'])['forEach'](function(_0x457c37){fs['unlinkSync'](path[_0x0a5d('0x4f')](_0x4df244[_0x0a5d('0x53')],_0x457c37));});fs[_0x0a5d('0x5c')](_0x4df244['directory']);}return _0x4df244;});})['catch'](function(_0x4bd69d){throw new db['Sequelize'][(_0x0a5d('0x5d'))](_0x4bd69d['message']);});}})['then'](handleEntityNotFound(_0x4002e8,null))[_0x0a5d('0x23')](removeEntity(_0x4002e8,null))['catch'](handleError(_0x4002e8,null));};exports[_0x0a5d('0x5e')]=function(_0xe65440,_0x2f63f5,_0x31febf){return db[_0x0a5d('0x4b')][_0x0a5d('0x4c')](function(_0x163219){var _0x16f1b7;return db[_0x0a5d('0x41')][_0x0a5d('0x48')]({'where':{'id':_0xe65440[_0x0a5d('0x47')]['id']}})[_0x0a5d('0x23')](function(_0x57cfbe){if(_0x57cfbe){_0x16f1b7=_0x57cfbe;return _0x57cfbe['addSound'](_0xe65440[_0x0a5d('0x49')]['id'],{'transaction':_0x163219});}})[_0x0a5d('0x23')](function(_0x4e5db9){if(_0x4e5db9){return db[_0x0a5d('0x5f')][_0x0a5d('0x60')]({'where':{'id':_0xe65440['body']['id']},'attributes':['id','name',_0x0a5d('0x61'),'converted_format','createdAt'],'raw':!![]});}})[_0x0a5d('0x23')](function(_0x237738){if(_0x237738){var _0x5c4c27=path[_0x0a5d('0x4f')](config['root'],_0x0a5d('0x62'),util[_0x0a5d('0x63')](_0x0a5d('0x64'),path[_0x0a5d('0x65')](_0x237738[_0x0a5d('0x61')],path[_0x0a5d('0x66')](_0x237738[_0x0a5d('0x61')])),_0x237738['converted_format']));var _0x575ddf=path[_0x0a5d('0x4f')](config[_0x0a5d('0x50')],_0x0a5d('0x51'),_0x16f1b7[_0x0a5d('0x28')],util[_0x0a5d('0x63')](_0x0a5d('0x64'),_0x237738[_0x0a5d('0x28')],_0x237738['converted_format']));fs[_0x0a5d('0x67')](_0x5c4c27,_0x575ddf);return _0x237738;}})[_0x0a5d('0x46')](function(_0x11efd4){throw new db[(_0x0a5d('0x68'))]['ValidationError'](_0x11efd4[_0x0a5d('0x69')]);});})[_0x0a5d('0x23')](handleEntityNotFound(_0x2f63f5,null))[_0x0a5d('0x23')](respondWithResult(_0x2f63f5,0xc9))[_0x0a5d('0x46')](handleError(_0x2f63f5,null));};exports['removeSound']=function(_0x5a5aec,_0x2c14f5,_0x261bea){return db[_0x0a5d('0x4b')]['transaction'](function(_0x37d444){var _0x2b632b;return db[_0x0a5d('0x41')]['findOne']({'where':{'id':_0x5a5aec[_0x0a5d('0x47')]['id']}})['then'](handleEntityNotFound(_0x2c14f5,null))[_0x0a5d('0x23')](function(_0x1d8384){if(_0x1d8384){_0x2b632b=_0x1d8384;return _0x1d8384['removeSound'](_0x5a5aec[_0x0a5d('0x47')][_0x0a5d('0x6a')]);}})[_0x0a5d('0x23')](function(_0x91fc91){if(_0x91fc91){return db[_0x0a5d('0x5f')][_0x0a5d('0x60')]({'where':{'id':_0x5a5aec[_0x0a5d('0x47')][_0x0a5d('0x6a')]},'attributes':['id',_0x0a5d('0x28'),_0x0a5d('0x61'),_0x0a5d('0x6b'),_0x0a5d('0x6c')],'raw':!![]});}})[_0x0a5d('0x23')](function(_0x30a33d){if(_0x30a33d){fs[_0x0a5d('0x6d')](path[_0x0a5d('0x4f')](_0x2b632b[_0x0a5d('0x53')],util[_0x0a5d('0x63')](_0x0a5d('0x64'),_0x30a33d[_0x0a5d('0x28')],_0x30a33d[_0x0a5d('0x6b')])));return _0x30a33d;}})[_0x0a5d('0x46')](function(_0x186952){throw new db[(_0x0a5d('0x68'))][(_0x0a5d('0x5d'))](_0x186952[_0x0a5d('0x69')]);});})['then'](handleEntityNotFound(_0x2c14f5,null))[_0x0a5d('0x23')](respondWithStatusCode(_0x2c14f5,0xcc))[_0x0a5d('0x46')](handleError(_0x2c14f5,null));};exports[_0x0a5d('0x6e')]=function(_0x5e825c,_0x85319e,_0x30445d){var _0x437ed0={};var _0x1ea18c={};var _0x3a3883;var _0x216c42;return db[_0x0a5d('0x41')][_0x0a5d('0x60')]({'where':{'id':_0x5e825c['params']['id']}})[_0x0a5d('0x23')](handleEntityNotFound(_0x85319e,null))['then'](function(_0x2f9f6a){if(_0x2f9f6a){_0x3a3883=_0x2f9f6a;_0x1ea18c[_0x0a5d('0x30')]=_[_0x0a5d('0x32')](db[_0x0a5d('0x5f')][_0x0a5d('0x2c')]);_0x1ea18c[_0x0a5d('0x31')]=_[_0x0a5d('0x32')](_0x5e825c[_0x0a5d('0x31')]);_0x1ea18c[_0x0a5d('0x33')]=_[_0x0a5d('0x34')](_0x1ea18c[_0x0a5d('0x30')],_0x1ea18c[_0x0a5d('0x31')]);_0x437ed0[_0x0a5d('0x36')]=_['intersection'](_0x1ea18c[_0x0a5d('0x30')],qs[_0x0a5d('0x35')](_0x5e825c[_0x0a5d('0x31')]['fields']));_0x437ed0['attributes']=_0x437ed0[_0x0a5d('0x36')][_0x0a5d('0x37')]?_0x437ed0[_0x0a5d('0x36')]:_0x1ea18c[_0x0a5d('0x30')];_0x437ed0['order']=qs[_0x0a5d('0x3a')](_0x5e825c[_0x0a5d('0x31')][_0x0a5d('0x3a')]);_0x437ed0['where']=qs['filters'](_[_0x0a5d('0x3b')](_0x5e825c[_0x0a5d('0x31')],_0x1ea18c[_0x0a5d('0x33')]));if(_0x5e825c[_0x0a5d('0x31')][_0x0a5d('0x3e')]){_0x437ed0['where']=_[_0x0a5d('0x3f')](_0x437ed0[_0x0a5d('0x3c')],{'$or':_[_0x0a5d('0x2b')](_0x437ed0[_0x0a5d('0x36')],function(_0x34e736){var _0x106377={};_0x106377[_0x34e736]={'$like':'%'+_0x5e825c[_0x0a5d('0x31')][_0x0a5d('0x3e')]+'%'};return _0x106377;})});}_0x437ed0=_['merge']({},_0x437ed0,_0x5e825c['options']);return _0x3a3883[_0x0a5d('0x6e')](_0x437ed0);}})[_0x0a5d('0x23')](function(_0x1c182e){if(_0x1c182e){_0x216c42=_0x1c182e[_0x0a5d('0x37')];if(!_0x5e825c[_0x0a5d('0x31')][_0x0a5d('0x38')](_0x0a5d('0x6f'))){_0x437ed0[_0x0a5d('0x39')]=qs[_0x0a5d('0x39')](_0x5e825c[_0x0a5d('0x31')][_0x0a5d('0x39')]);_0x437ed0[_0x0a5d('0x1b')]=qs['offset'](_0x5e825c[_0x0a5d('0x31')][_0x0a5d('0x1b')]);}return _0x3a3883[_0x0a5d('0x6e')](_0x437ed0);}})[_0x0a5d('0x23')](function(_0x276051){if(_0x276051){return _0x276051?{'count':_0x216c42,'rows':_0x276051}:null;}})[_0x0a5d('0x23')](respondWithResult(_0x85319e,null))[_0x0a5d('0x46')](handleError(_0x85319e,null));}; \ No newline at end of file +var _0xf615=['filters','pick','filter','where','merge','options','VoiceMusicOnHold','include','findAll','rows','catch','params','includeAll','find','body','create','sequelize','files','directory','join','root','server/files/moh','mode','mkdirSync','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','MusicOnHolds','autoAssociation','transaction','readdirSync','forEach','rmdirSync','Sequelize','ValidationError','message','addSound','Sound','createdAt','server/files/sounds/converted','%s.%s','basename','extname','save_name','converted_format','removeSound','id2','findOne','unlinkSync','format','getSounds','html-pdf','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','json','count','offset','limit','apply','reject','save','update','then','destroy','get','UserProfileResource','error','name','send','index','rawAttributes','fieldName','type','key','map','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xf615,0xa1));var _0x5f61=function(_0x4f11cb,_0x14e174){_0x4f11cb=_0x4f11cb-0x0;var _0x491488=_0xf615[_0x4f11cb];return _0x491488;};'use strict';var pdf=require(_0x5f61('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x5f61('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5f61('0x2'));var rp=require(_0x5f61('0x3'));var moment=require(_0x5f61('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x5f61('0x5'));var util=require(_0x5f61('0x6'));var path=require(_0x5f61('0x7'));var sox=require('sox');var csv=require(_0x5f61('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x5f61('0x9'));var squel=require(_0x5f61('0xa'));var crypto=require(_0x5f61('0xb'));var jsforce=require(_0x5f61('0xc'));var deskjs=require(_0x5f61('0xd'));var toCsv=require(_0x5f61('0x8'));var querystring=require(_0x5f61('0xe'));var Papa=require('papaparse');var Redis=require(_0x5f61('0xf'));var authService=require(_0x5f61('0x10'));var qs=require(_0x5f61('0x11'));var as=require(_0x5f61('0x12'));var hardwareService=require(_0x5f61('0x13'));var logger=require(_0x5f61('0x14'))(_0x5f61('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x5f61('0x16'))['db'];function respondWithStatusCode(_0x23a291,_0x33f0c7){_0x33f0c7=_0x33f0c7||0xcc;return function(_0x34bd1b){if(_0x34bd1b){return _0x23a291[_0x5f61('0x17')](_0x33f0c7);}return _0x23a291[_0x5f61('0x18')](_0x33f0c7)[_0x5f61('0x19')]();};}function respondWithResult(_0x5e4c4d,_0x194730){_0x194730=_0x194730||0xc8;return function(_0x456c0c){if(_0x456c0c){return _0x5e4c4d['status'](_0x194730)[_0x5f61('0x1a')](_0x456c0c);}};}function respondWithFilteredResult(_0xa071cb,_0x2d51cf){return function(_0x5a4c71){if(_0x5a4c71){var _0x9445e=_0x5a4c71[_0x5f61('0x1b')],_0x3b4f9c=_0x2d51cf[_0x5f61('0x1c')],_0x3e1bfe=_0x2d51cf[_0x5f61('0x1c')]+_0x2d51cf[_0x5f61('0x1d')],_0xe0739f;if(_0x3e1bfe>=_0x9445e){_0x3e1bfe=_0x9445e;_0xe0739f=0xc8;}else{_0xe0739f=0xce;}_0xa071cb[_0x5f61('0x18')](_0xe0739f);return _0xa071cb['set']('Content-Range',_0x3b4f9c+'-'+_0x3e1bfe+'/'+_0x9445e)[_0x5f61('0x1a')](_0x5a4c71);}return null;};}function patchUpdates(_0x8181ba){return function(_0x5f6c97){try{jsonpatch[_0x5f61('0x1e')](_0x5f6c97,_0x8181ba,!![]);}catch(_0x519d9c){return BPromise[_0x5f61('0x1f')](_0x519d9c);}return _0x5f6c97[_0x5f61('0x20')]();};}function saveUpdates(_0x12511b,_0x8ea470){return function(_0x3e9a04){if(_0x3e9a04){return _0x3e9a04[_0x5f61('0x21')](_0x12511b)[_0x5f61('0x22')](function(_0x4bd375){return _0x4bd375;});}return null;};}function removeEntity(_0x4c840b,_0x7bd90f){return function(_0x4dc3d3){if(_0x4dc3d3){return _0x4dc3d3[_0x5f61('0x23')]()[_0x5f61('0x22')](function(){var _0x1558f3=_0x4dc3d3[_0x5f61('0x24')]({'plain':!![]});var _0x5c4a54='MusicOnHolds';return db[_0x5f61('0x25')][_0x5f61('0x23')]({'where':{'type':_0x5c4a54,'resourceId':_0x1558f3['id']}})[_0x5f61('0x22')](function(){return _0x4dc3d3;});})['then'](function(){_0x4c840b['status'](0xcc)[_0x5f61('0x19')]();});}};}function handleEntityNotFound(_0x1dc117,_0x3ec4ff){return function(_0x49a958){if(!_0x49a958){_0x1dc117[_0x5f61('0x17')](0x194);}return _0x49a958;};}function handleError(_0x2f647d,_0x4ef5ec){_0x4ef5ec=_0x4ef5ec||0x1f4;return function(_0x31fff3){logger[_0x5f61('0x26')](_0x31fff3['stack']);if(_0x31fff3[_0x5f61('0x27')]){delete _0x31fff3['name'];}_0x2f647d[_0x5f61('0x18')](_0x4ef5ec)[_0x5f61('0x28')](_0x31fff3);};}exports[_0x5f61('0x29')]=function(_0x25c579,_0x560f3f){var _0x4a47f8={},_0x32c74f={},_0x34eb6f={'count':0x0,'rows':[]};var _0x1d0a78=_['map'](db['VoiceMusicOnHold'][_0x5f61('0x2a')],function(_0x553023){return{'name':_0x553023[_0x5f61('0x2b')],'type':_0x553023[_0x5f61('0x2c')][_0x5f61('0x2d')]};});_0x32c74f['model']=_[_0x5f61('0x2e')](_0x1d0a78,'name');_0x32c74f[_0x5f61('0x2f')]=_[_0x5f61('0x30')](_0x25c579[_0x5f61('0x2f')]);_0x32c74f['filters']=_[_0x5f61('0x31')](_0x32c74f[_0x5f61('0x32')],_0x32c74f[_0x5f61('0x2f')]);_0x4a47f8[_0x5f61('0x33')]=_[_0x5f61('0x31')](_0x32c74f[_0x5f61('0x32')],qs[_0x5f61('0x34')](_0x25c579[_0x5f61('0x2f')]['fields']));_0x4a47f8[_0x5f61('0x33')]=_0x4a47f8[_0x5f61('0x33')][_0x5f61('0x35')]?_0x4a47f8['attributes']:_0x32c74f[_0x5f61('0x32')];if(!_0x25c579[_0x5f61('0x2f')][_0x5f61('0x36')](_0x5f61('0x37'))){_0x4a47f8['limit']=qs[_0x5f61('0x1d')](_0x25c579['query']['limit']);_0x4a47f8[_0x5f61('0x1c')]=qs[_0x5f61('0x1c')](_0x25c579[_0x5f61('0x2f')][_0x5f61('0x1c')]);}_0x4a47f8['order']=qs[_0x5f61('0x38')](_0x25c579[_0x5f61('0x2f')][_0x5f61('0x38')]);_0x4a47f8['where']=qs[_0x5f61('0x39')](_[_0x5f61('0x3a')](_0x25c579[_0x5f61('0x2f')],_0x32c74f[_0x5f61('0x39')]));if(_0x25c579[_0x5f61('0x2f')][_0x5f61('0x3b')]){_0x4a47f8[_0x5f61('0x3c')]=_['merge'](_0x4a47f8['where'],{'$or':_['map'](_0x1d0a78,function(_0x2bb4df){if(_0x2bb4df[_0x5f61('0x2c')]!=='VIRTUAL'){var _0x4c627a={};_0x4c627a[_0x2bb4df['name']]={'$like':'%'+_0x25c579[_0x5f61('0x2f')][_0x5f61('0x3b')]+'%'};return _0x4c627a;}})});}_0x4a47f8=_[_0x5f61('0x3d')]({},_0x4a47f8,_0x25c579[_0x5f61('0x3e')]);var _0x306dbc={'where':_0x4a47f8[_0x5f61('0x3c')]};return db[_0x5f61('0x3f')][_0x5f61('0x1b')](_0x306dbc)['then'](function(_0x3fc265){_0x34eb6f[_0x5f61('0x1b')]=_0x3fc265;if(_0x25c579['query']['includeAll']){_0x4a47f8[_0x5f61('0x40')]=[{'all':!![]}];}return db[_0x5f61('0x3f')][_0x5f61('0x41')](_0x4a47f8);})[_0x5f61('0x22')](function(_0x48d2ae){_0x34eb6f[_0x5f61('0x42')]=_0x48d2ae;return _0x34eb6f;})[_0x5f61('0x22')](respondWithFilteredResult(_0x560f3f,_0x4a47f8))[_0x5f61('0x43')](handleError(_0x560f3f,null));};exports['show']=function(_0x2414bd,_0x469946){var _0x2a6624={'raw':![],'where':{'id':_0x2414bd[_0x5f61('0x44')]['id']}},_0x423b89={};_0x423b89[_0x5f61('0x32')]=_[_0x5f61('0x30')](db[_0x5f61('0x3f')][_0x5f61('0x2a')]);_0x423b89[_0x5f61('0x2f')]=_['keys'](_0x2414bd[_0x5f61('0x2f')]);_0x423b89[_0x5f61('0x39')]=_[_0x5f61('0x31')](_0x423b89[_0x5f61('0x32')],_0x423b89[_0x5f61('0x2f')]);_0x2a6624[_0x5f61('0x33')]=_[_0x5f61('0x31')](_0x423b89['model'],qs[_0x5f61('0x34')](_0x2414bd[_0x5f61('0x2f')]['fields']));_0x2a6624['attributes']=_0x2a6624['attributes']['length']?_0x2a6624[_0x5f61('0x33')]:_0x423b89['model'];if(_0x2414bd[_0x5f61('0x2f')][_0x5f61('0x45')]){_0x2a6624['include']=[{'all':!![]}];}_0x2a6624=_[_0x5f61('0x3d')]({},_0x2a6624,_0x2414bd[_0x5f61('0x3e')]);return db[_0x5f61('0x3f')][_0x5f61('0x46')](_0x2a6624)['then'](handleEntityNotFound(_0x469946,null))[_0x5f61('0x22')](respondWithResult(_0x469946,null))[_0x5f61('0x43')](handleError(_0x469946,null));};exports[_0x5f61('0x21')]=function(_0x4c71c2,_0x6ca67){if(_0x4c71c2[_0x5f61('0x47')]['id']){delete _0x4c71c2['body']['id'];}return db['VoiceMusicOnHold'][_0x5f61('0x46')]({'where':{'id':_0x4c71c2[_0x5f61('0x44')]['id']}})[_0x5f61('0x22')](handleEntityNotFound(_0x6ca67,null))['then'](saveUpdates(_0x4c71c2[_0x5f61('0x47')],null))['then'](respondWithResult(_0x6ca67,null))[_0x5f61('0x43')](handleError(_0x6ca67,null));};exports[_0x5f61('0x48')]=function(_0x5b0bbf,_0x13a204,_0x1921eb){return db[_0x5f61('0x49')]['transaction'](function(_0x2489d9){if(_0x5b0bbf[_0x5f61('0x47')]['mode']===_0x5f61('0x4a')){_0x5b0bbf[_0x5f61('0x47')][_0x5f61('0x4b')]=path[_0x5f61('0x4c')](config[_0x5f61('0x4d')],_0x5f61('0x4e'),_0x5b0bbf[_0x5f61('0x47')]['name']);}return db[_0x5f61('0x3f')][_0x5f61('0x48')](_0x5b0bbf[_0x5f61('0x47')],{'transaction':_0x2489d9})[_0x5f61('0x22')](function(_0x509f40){if(_0x5b0bbf[_0x5f61('0x47')][_0x5f61('0x4f')]===_0x5f61('0x4a')){fs[_0x5f61('0x50')](_0x509f40[_0x5f61('0x4b')],parseInt(_0x5f61('0x51'),0x8));}var _0x1bcb36=_0x5b0bbf[_0x5f61('0x52')][_0x5f61('0x24')]({'plain':!![]});if(!_0x1bcb36)throw new Error(_0x5f61('0x53'));if(_0x1bcb36[_0x5f61('0x54')]===_0x5f61('0x52')){var _0x39175c=_0x509f40[_0x5f61('0x24')]({'plain':!![]});return db['UserProfileSection'][_0x5f61('0x46')]({'where':{'name':_0x5f61('0x55'),'userProfileId':_0x1bcb36['userProfileId']},'raw':!![]})[_0x5f61('0x22')](function(_0x15a481){if(_0x15a481&&_0x15a481[_0x5f61('0x56')]===0x0){return db[_0x5f61('0x25')][_0x5f61('0x48')]({'name':_0x39175c[_0x5f61('0x27')],'resourceId':_0x39175c['id'],'type':_0x15a481['name'],'sectionId':_0x15a481['id']},{})[_0x5f61('0x22')](function(){return _0x509f40;});}else{return _0x509f40;}})[_0x5f61('0x43')](function(_0x27830b){logger[_0x5f61('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x27830b);});}return _0x509f40;});})[_0x5f61('0x22')](respondWithResult(_0x13a204,0xc9))['catch'](handleError(_0x13a204,null));};exports[_0x5f61('0x23')]=function(_0x49e390,_0x28c754,_0xb55953){var _0x5b8fd4;return db[_0x5f61('0x3f')][_0x5f61('0x46')]({'where':{'id':_0x49e390[_0x5f61('0x44')]['id']}})[_0x5f61('0x22')](function(_0xfa4f18){if(_0xfa4f18){return db[_0x5f61('0x49')][_0x5f61('0x57')](function(_0x3afe77){return _0xfa4f18[_0x5f61('0x23')]({'transaction':_0x3afe77,'raw':!![]})[_0x5f61('0x22')](function(_0x236bee){if(_0x236bee[_0x5f61('0x4b')]){fs[_0x5f61('0x58')](_0x236bee[_0x5f61('0x4b')])[_0x5f61('0x59')](function(_0x49275e){fs['unlinkSync'](path[_0x5f61('0x4c')](_0x236bee[_0x5f61('0x4b')],_0x49275e));});fs[_0x5f61('0x5a')](_0x236bee[_0x5f61('0x4b')]);}return _0x236bee;});})[_0x5f61('0x43')](function(_0x3d5aa4){throw new db[(_0x5f61('0x5b'))][(_0x5f61('0x5c'))](_0x3d5aa4[_0x5f61('0x5d')]);});}})[_0x5f61('0x22')](handleEntityNotFound(_0x28c754,null))[_0x5f61('0x22')](removeEntity(_0x28c754,null))[_0x5f61('0x43')](handleError(_0x28c754,null));};exports[_0x5f61('0x5e')]=function(_0x203fed,_0xae0159,_0x2a76b7){return db[_0x5f61('0x49')][_0x5f61('0x57')](function(_0x471398){var _0x3c1f50;return db['VoiceMusicOnHold']['find']({'where':{'id':_0x203fed[_0x5f61('0x44')]['id']}})[_0x5f61('0x22')](function(_0x4f80ac){if(_0x4f80ac){_0x3c1f50=_0x4f80ac;return _0x4f80ac[_0x5f61('0x5e')](_0x203fed[_0x5f61('0x47')]['id'],{'transaction':_0x471398});}})[_0x5f61('0x22')](function(_0x4654fa){if(_0x4654fa){return db[_0x5f61('0x5f')]['findOne']({'where':{'id':_0x203fed[_0x5f61('0x47')]['id']},'attributes':['id',_0x5f61('0x27'),'save_name','converted_format',_0x5f61('0x60')],'raw':!![]});}})[_0x5f61('0x22')](function(_0x43cc82){if(_0x43cc82){var _0x28dae3=path[_0x5f61('0x4c')](config['root'],_0x5f61('0x61'),util['format'](_0x5f61('0x62'),path[_0x5f61('0x63')](_0x43cc82['save_name'],path[_0x5f61('0x64')](_0x43cc82[_0x5f61('0x65')])),_0x43cc82[_0x5f61('0x66')]));var _0x324705=path[_0x5f61('0x4c')](config['root'],_0x5f61('0x4e'),_0x3c1f50[_0x5f61('0x27')],util['format']('%s.%s',_0x43cc82['name'],_0x43cc82[_0x5f61('0x66')]));fs['symlinkSync'](_0x28dae3,_0x324705);return _0x43cc82;}})[_0x5f61('0x43')](function(_0x35aee7){throw new db[(_0x5f61('0x5b'))][(_0x5f61('0x5c'))](_0x35aee7[_0x5f61('0x5d')]);});})[_0x5f61('0x22')](handleEntityNotFound(_0xae0159,null))['then'](respondWithResult(_0xae0159,0xc9))['catch'](handleError(_0xae0159,null));};exports['removeSound']=function(_0xe10499,_0x5e6ba7,_0x59ac35){return db[_0x5f61('0x49')][_0x5f61('0x57')](function(_0x281bb1){var _0x57ffbf;return db[_0x5f61('0x3f')]['findOne']({'where':{'id':_0xe10499['params']['id']}})[_0x5f61('0x22')](handleEntityNotFound(_0x5e6ba7,null))[_0x5f61('0x22')](function(_0x4dbc8e){if(_0x4dbc8e){_0x57ffbf=_0x4dbc8e;return _0x4dbc8e[_0x5f61('0x67')](_0xe10499[_0x5f61('0x44')][_0x5f61('0x68')]);}})[_0x5f61('0x22')](function(_0x5ed760){if(_0x5ed760){return db[_0x5f61('0x5f')][_0x5f61('0x69')]({'where':{'id':_0xe10499[_0x5f61('0x44')][_0x5f61('0x68')]},'attributes':['id','name',_0x5f61('0x65'),_0x5f61('0x66'),_0x5f61('0x60')],'raw':!![]});}})[_0x5f61('0x22')](function(_0x32e7d8){if(_0x32e7d8){fs[_0x5f61('0x6a')](path[_0x5f61('0x4c')](_0x57ffbf[_0x5f61('0x4b')],util[_0x5f61('0x6b')](_0x5f61('0x62'),_0x32e7d8[_0x5f61('0x27')],_0x32e7d8['converted_format'])));return _0x32e7d8;}})['catch'](function(_0x5ca88f){throw new db[(_0x5f61('0x5b'))][(_0x5f61('0x5c'))](_0x5ca88f[_0x5f61('0x5d')]);});})[_0x5f61('0x22')](handleEntityNotFound(_0x5e6ba7,null))[_0x5f61('0x22')](respondWithStatusCode(_0x5e6ba7,0xcc))[_0x5f61('0x43')](handleError(_0x5e6ba7,null));};exports[_0x5f61('0x6c')]=function(_0x3ca3c3,_0x18987d,_0x3571c2){var _0x8acc6c={};var _0x448c96={};var _0x395041;var _0x544c6f;return db[_0x5f61('0x3f')][_0x5f61('0x69')]({'where':{'id':_0x3ca3c3['params']['id']}})[_0x5f61('0x22')](handleEntityNotFound(_0x18987d,null))[_0x5f61('0x22')](function(_0x428aa3){if(_0x428aa3){_0x395041=_0x428aa3;_0x448c96[_0x5f61('0x32')]=_[_0x5f61('0x30')](db[_0x5f61('0x5f')][_0x5f61('0x2a')]);_0x448c96['query']=_[_0x5f61('0x30')](_0x3ca3c3[_0x5f61('0x2f')]);_0x448c96['filters']=_[_0x5f61('0x31')](_0x448c96[_0x5f61('0x32')],_0x448c96['query']);_0x8acc6c[_0x5f61('0x33')]=_['intersection'](_0x448c96[_0x5f61('0x32')],qs[_0x5f61('0x34')](_0x3ca3c3[_0x5f61('0x2f')][_0x5f61('0x34')]));_0x8acc6c[_0x5f61('0x33')]=_0x8acc6c[_0x5f61('0x33')][_0x5f61('0x35')]?_0x8acc6c[_0x5f61('0x33')]:_0x448c96['model'];_0x8acc6c['order']=qs['sort'](_0x3ca3c3[_0x5f61('0x2f')]['sort']);_0x8acc6c['where']=qs['filters'](_[_0x5f61('0x3a')](_0x3ca3c3['query'],_0x448c96[_0x5f61('0x39')]));if(_0x3ca3c3[_0x5f61('0x2f')][_0x5f61('0x3b')]){_0x8acc6c[_0x5f61('0x3c')]=_[_0x5f61('0x3d')](_0x8acc6c[_0x5f61('0x3c')],{'$or':_[_0x5f61('0x2e')](_0x8acc6c[_0x5f61('0x33')],function(_0x4c891a){var _0x44af7a={};_0x44af7a[_0x4c891a]={'$like':'%'+_0x3ca3c3[_0x5f61('0x2f')][_0x5f61('0x3b')]+'%'};return _0x44af7a;})});}_0x8acc6c=_[_0x5f61('0x3d')]({},_0x8acc6c,_0x3ca3c3['options']);return _0x395041[_0x5f61('0x6c')](_0x8acc6c);}})[_0x5f61('0x22')](function(_0x2e94bf){if(_0x2e94bf){_0x544c6f=_0x2e94bf[_0x5f61('0x35')];if(!_0x3ca3c3[_0x5f61('0x2f')]['hasOwnProperty'](_0x5f61('0x37'))){_0x8acc6c[_0x5f61('0x1d')]=qs['limit'](_0x3ca3c3[_0x5f61('0x2f')][_0x5f61('0x1d')]);_0x8acc6c[_0x5f61('0x1c')]=qs['offset'](_0x3ca3c3[_0x5f61('0x2f')][_0x5f61('0x1c')]);}return _0x395041[_0x5f61('0x6c')](_0x8acc6c);}})[_0x5f61('0x22')](function(_0x54df20){if(_0x54df20){return _0x54df20?{'count':_0x544c6f,'rows':_0x54df20}:null;}})['then'](respondWithResult(_0x18987d,null))[_0x5f61('0x43')](handleError(_0x18987d,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index b9cc3f7..4e826a0 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 _0x64fb=['rimraf','./voiceMusicOnHold.attributes','exports','define','VoiceMusicOnHold','lodash','util','../../config/logger','moment','bluebird','path'];(function(_0x1aefde,_0x3ff306){var _0x4f48ef=function(_0x364603){while(--_0x364603){_0x1aefde['push'](_0x1aefde['shift']());}};_0x4f48ef(++_0x3ff306);}(_0x64fb,0x118));var _0xb64f=function(_0x382cbd,_0xa09c25){_0x382cbd=_0x382cbd-0x0;var _0x175a1e=_0x64fb[_0x382cbd];return _0x175a1e;};'use strict';var _=require(_0xb64f('0x0'));var util=require(_0xb64f('0x1'));var logger=require(_0xb64f('0x2'))('api');var moment=require(_0xb64f('0x3'));var BPromise=require(_0xb64f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb64f('0x5'));var rimraf=require(_0xb64f('0x6'));var config=require('../../config/environment');var attributes=require(_0xb64f('0x7'));module[_0xb64f('0x8')]=function(_0x4efef3,_0x4de713){return _0x4efef3[_0xb64f('0x9')](_0xb64f('0xa'),attributes,{'tableName':'voice_musiconhold','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf07b=['../../config/environment','exports','define','VoiceMusicOnHold','util','../../config/logger','api','moment','bluebird','rimraf'];(function(_0x55469d,_0x32cfd5){var _0x32c8d0=function(_0x2ceae0){while(--_0x2ceae0){_0x55469d['push'](_0x55469d['shift']());}};_0x32c8d0(++_0x32cfd5);}(_0xf07b,0x14e));var _0xbf07=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xf07b[_0x4b369d];return _0x571a98;};'use strict';var _=require('lodash');var util=require(_0xbf07('0x0'));var logger=require(_0xbf07('0x1'))(_0xbf07('0x2'));var moment=require(_0xbf07('0x3'));var BPromise=require(_0xbf07('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xbf07('0x5'));var config=require(_0xbf07('0x6'));var attributes=require('./voiceMusicOnHold.attributes');module[_0xbf07('0x7')]=function(_0x4c9215,_0x9b28c9){return _0x4c9215[_0xbf07('0x8')](_0xbf07('0x9'),attributes,{'tableName':'voice_musiconhold','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js index 8f535ec..f6db3f4 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 _0x243f=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','http','info','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','stringify','error','VoiceMusicOnHold,\x20%s,\x20%s','message','result'];(function(_0x364144,_0x5e32ac){var _0x4352e8=function(_0x420709){while(--_0x420709){_0x364144['push'](_0x364144['shift']());}};_0x4352e8(++_0x5e32ac);}(_0x243f,0x1ba));var _0xf243=function(_0x1646fa,_0x4e5bd7){_0x1646fa=_0x1646fa-0x0;var _0x5a47a5=_0x243f[_0x1646fa];return _0x5a47a5;};'use strict';var _=require(_0xf243('0x0'));var util=require(_0xf243('0x1'));var moment=require(_0xf243('0x2'));var BPromise=require(_0xf243('0x3'));var rs=require(_0xf243('0x4'));var fs=require('fs');var Redis=require(_0xf243('0x5'));var db=require(_0xf243('0x6'))['db'];var utils=require(_0xf243('0x7'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xf243('0x8'));var client=jayson[_0xf243('0x9')][_0xf243('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4d927a,_0x4df7ea,_0xc571b9){return new BPromise(function(_0x2c2444,_0x4cdcfc){return client['request'](_0x4d927a,_0xc571b9)['then'](function(_0x13d044){logger[_0xf243('0xb')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x4df7ea,_0xf243('0xc'));logger[_0xf243('0xd')](_0xf243('0xe'),_0x4df7ea,'request\x20sent',JSON[_0xf243('0xf')](_0x13d044));if(_0x13d044[_0xf243('0x10')]){if(_0x13d044['error']['code']===0x1f4){logger[_0xf243('0x10')](_0xf243('0x11'),_0x4df7ea,_0x13d044[_0xf243('0x10')]['message']);return _0x4cdcfc(_0x13d044[_0xf243('0x10')]['message']);}logger[_0xf243('0x10')](_0xf243('0x11'),_0x4df7ea,_0x13d044[_0xf243('0x10')][_0xf243('0x12')]);return _0x2c2444(_0x13d044[_0xf243('0x10')]['message']);}else{logger[_0xf243('0xb')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x4df7ea,'request\x20sent');_0x2c2444(_0x13d044[_0xf243('0x13')]['message']);}})[_0xf243('0x14')](function(_0x47e53c){logger[_0xf243('0x10')](_0xf243('0x11'),_0x4df7ea,_0x47e53c);_0x4cdcfc(_0x47e53c);});});} \ No newline at end of file +var _0x9c15=['../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','bluebird','randomstring','ioredis'];(function(_0x11d69c,_0x3536f0){var _0x4ff692=function(_0x3ac315){while(--_0x3ac315){_0x11d69c['push'](_0x11d69c['shift']());}};_0x4ff692(++_0x3536f0);}(_0x9c15,0x175));var _0x59c1=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x9c15[_0x432682];return _0x463d05;};'use strict';var _=require(_0x59c1('0x0'));var util=require(_0x59c1('0x1'));var moment=require('moment');var BPromise=require(_0x59c1('0x2'));var rs=require(_0x59c1('0x3'));var fs=require('fs');var Redis=require(_0x59c1('0x4'));var db=require(_0x59c1('0x5'))['db'];var utils=require(_0x59c1('0x6'));var logger=require(_0x59c1('0x7'))(_0x59c1('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x59c1('0x9')][_0x59c1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x12a96b,_0x51afd1,_0x3c44d6){return new BPromise(function(_0x135a04,_0x44eeef){return client['request'](_0x12a96b,_0x3c44d6)[_0x59c1('0xb')](function(_0x3bdba3){logger[_0x59c1('0xc')](_0x59c1('0xd'),_0x51afd1,_0x59c1('0xe'));logger[_0x59c1('0xf')](_0x59c1('0x10'),_0x51afd1,'request\x20sent',JSON['stringify'](_0x3bdba3));if(_0x3bdba3['error']){if(_0x3bdba3[_0x59c1('0x11')]['code']===0x1f4){logger[_0x59c1('0x11')](_0x59c1('0xd'),_0x51afd1,_0x3bdba3[_0x59c1('0x11')]['message']);return _0x44eeef(_0x3bdba3[_0x59c1('0x11')][_0x59c1('0x12')]);}logger['error'](_0x59c1('0xd'),_0x51afd1,_0x3bdba3[_0x59c1('0x11')][_0x59c1('0x12')]);return _0x135a04(_0x3bdba3[_0x59c1('0x11')][_0x59c1('0x12')]);}else{logger['info']('VoiceMusicOnHold,\x20%s,\x20%s',_0x51afd1,_0x59c1('0xe'));_0x135a04(_0x3bdba3[_0x59c1('0x13')][_0x59c1('0x12')]);}})[_0x59c1('0x14')](function(_0x1c0ae6){logger[_0x59c1('0x11')](_0x59c1('0xd'),_0x51afd1,_0x1c0ae6);_0x44eeef(_0x1c0ae6);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index 7d7c114..278b77d 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 _0x2aa9=['../../components/interaction/service','../../config/environment','./voicePrefix.controller','get','isAuthenticated','/describe','describe','show','getAgents','post','create','/:id/users','update','destroy','delete','removeAgents','exports','multer','util','connect-timeout','Router','../../components/auth/service'];(function(_0x52e0ee,_0x52f7c1){var _0x32534c=function(_0x535d65){while(--_0x535d65){_0x52e0ee['push'](_0x52e0ee['shift']());}};_0x32534c(++_0x52f7c1);}(_0x2aa9,0xed));var _0x92aa=function(_0x579354,_0x3fd65b){_0x579354=_0x579354-0x0;var _0x2d1264=_0x2aa9[_0x579354];return _0x2d1264;};'use strict';var multer=require(_0x92aa('0x0'));var util=require(_0x92aa('0x1'));var path=require('path');var timeout=require(_0x92aa('0x2'));var express=require('express');var router=express[_0x92aa('0x3')]();var auth=require(_0x92aa('0x4'));var interaction=require(_0x92aa('0x5'));var config=require(_0x92aa('0x6'));var controller=require(_0x92aa('0x7'));router[_0x92aa('0x8')]('/',auth[_0x92aa('0x9')](),controller['index']);router[_0x92aa('0x8')](_0x92aa('0xa'),auth[_0x92aa('0x9')](),controller[_0x92aa('0xb')]);router[_0x92aa('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x92aa('0xc')]);router['get']('/:id/users',auth[_0x92aa('0x9')](),controller[_0x92aa('0xd')]);router[_0x92aa('0xe')]('/',auth[_0x92aa('0x9')](),controller[_0x92aa('0xf')]);router[_0x92aa('0xe')](_0x92aa('0x10'),auth[_0x92aa('0x9')](),controller['addAgents']);router['put']('/:id',auth[_0x92aa('0x9')](),controller[_0x92aa('0x11')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x92aa('0x12')]);router[_0x92aa('0x13')](_0x92aa('0x10'),auth[_0x92aa('0x9')](),controller[_0x92aa('0x14')]);module[_0x92aa('0x15')]=router; \ No newline at end of file +var _0x555b=['post','addAgents','put','/:id','update','delete','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voicePrefix.controller','isAuthenticated','index','get','/describe','describe','/:id/users','getAgents','create'];(function(_0x2b7764,_0x2606f1){var _0x848dcb=function(_0x1ae85b){while(--_0x1ae85b){_0x2b7764['push'](_0x2b7764['shift']());}};_0x848dcb(++_0x2606f1);}(_0x555b,0x16f));var _0xb555=function(_0x3df6a0,_0x5b6a0e){_0x3df6a0=_0x3df6a0-0x0;var _0x3fe3d9=_0x555b[_0x3df6a0];return _0x3fe3d9;};'use strict';var multer=require(_0xb555('0x0'));var util=require(_0xb555('0x1'));var path=require('path');var timeout=require(_0xb555('0x2'));var express=require(_0xb555('0x3'));var router=express[_0xb555('0x4')]();var auth=require(_0xb555('0x5'));var interaction=require(_0xb555('0x6'));var config=require(_0xb555('0x7'));var controller=require(_0xb555('0x8'));router['get']('/',auth[_0xb555('0x9')](),controller[_0xb555('0xa')]);router[_0xb555('0xb')](_0xb555('0xc'),auth[_0xb555('0x9')](),controller[_0xb555('0xd')]);router[_0xb555('0xb')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xb555('0xb')](_0xb555('0xe'),auth[_0xb555('0x9')](),controller[_0xb555('0xf')]);router['post']('/',auth[_0xb555('0x9')](),controller[_0xb555('0x10')]);router[_0xb555('0x11')]('/:id/users',auth[_0xb555('0x9')](),controller[_0xb555('0x12')]);router[_0xb555('0x13')](_0xb555('0x14'),auth['isAuthenticated'](),controller[_0xb555('0x15')]);router[_0xb555('0x16')](_0xb555('0x14'),auth[_0xb555('0x9')](),controller['destroy']);router[_0xb555('0x16')](_0xb555('0xe'),auth[_0xb555('0x9')](),controller['removeAgents']);module[_0xb555('0x17')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index 4dc3c2a..ec079a3 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 _0xbbec=['sequelize','STRING','VIRTUAL','system-','getDataValue','name'];(function(_0x21f72a,_0x2356cc){var _0x38a8c6=function(_0x111fd6){while(--_0x111fd6){_0x21f72a['push'](_0x21f72a['shift']());}};_0x38a8c6(++_0x2356cc);}(_0xbbec,0xd2));var _0xcbbe=function(_0x18e44a,_0x3f0d55){_0x18e44a=_0x18e44a-0x0;var _0x14db95=_0xbbec[_0x18e44a];return _0x14db95;};'use strict';var Sequelize=require(_0xcbbe('0x0'));module['exports']={'name':{'type':Sequelize[_0xcbbe('0x1')],'allowNull':![],'unique':'name'},'prefix':{'type':Sequelize[_0xcbbe('0x2')],'get':function(_0x17dd00){return _0xcbbe('0x3')+this[_0xcbbe('0x4')](_0xcbbe('0x5'))+'-';}},'description':{'type':Sequelize['STRING']},'callerIdAll':{'type':Sequelize['STRING']},'VoiceExtensionId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x2a8a=['exports','STRING','VIRTUAL','system-','getDataValue','name','INTEGER','sequelize'];(function(_0x22ff74,_0xf31e52){var _0x516635=function(_0x3de617){while(--_0x3de617){_0x22ff74['push'](_0x22ff74['shift']());}};_0x516635(++_0xf31e52);}(_0x2a8a,0xaf));var _0xa2a8=function(_0x4188cf,_0x306e38){_0x4188cf=_0x4188cf-0x0;var _0x1dabda=_0x2a8a[_0x4188cf];return _0x1dabda;};'use strict';var Sequelize=require(_0xa2a8('0x0'));module[_0xa2a8('0x1')]={'name':{'type':Sequelize[_0xa2a8('0x2')],'allowNull':![],'unique':'name'},'prefix':{'type':Sequelize[_0xa2a8('0x3')],'get':function(_0x14927d){return _0xa2a8('0x4')+this[_0xa2a8('0x5')](_0xa2a8('0x6'))+'-';}},'description':{'type':Sequelize[_0xa2a8('0x2')]},'callerIdAll':{'type':Sequelize[_0xa2a8('0x2')]},'VoiceExtensionId':{'type':Sequelize[_0xa2a8('0x7')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 7a19c6b..5abfd93 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 _0x9c81=['ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','redis','socket.io-emitter','status','end','json','count','offset','limit','set','Content-Range','apply','reject','then','destroy','get','VoicePrefixes','UserProfileResource','error','stack','name','send','index','VoicePrefix','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','rawAttributes','find','catch','describe','create','sequelize','transaction','VoiceExtension','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','from-sip','exten','app','priority','prefix','NoOp','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','callerIdAll','PREFIX-CALLERIDALL=','No\x20callerid\x20available','goto','${EXTEN:','charAt','findById','addAgents','body','ids','omit','spread','emit','removeAgents','userVoicePrefix:remove','getAgents','findOne','User','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','to-csv','ejs','lodash','squel','crypto','querystring'];(function(_0x4de1b1,_0x18c64c){var _0x639f27=function(_0x635e03){while(--_0x635e03){_0x4de1b1['push'](_0x4de1b1['shift']());}};_0x639f27(++_0x18c64c);}(_0x9c81,0x14d));var _0x19c8=function(_0x5748ea,_0x1157a7){_0x5748ea=_0x5748ea-0x0;var _0x5c5ff1=_0x9c81[_0x5748ea];return _0x5c5ff1;};'use strict';var pdf=require(_0x19c8('0x0'));var emlformat=require(_0x19c8('0x1'));var rimraf=require(_0x19c8('0x2'));var zipdir=require(_0x19c8('0x3'));var jsonpatch=require(_0x19c8('0x4'));var rp=require(_0x19c8('0x5'));var moment=require(_0x19c8('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x19c8('0x7'));var util=require('util');var path=require('path');var sox=require(_0x19c8('0x8'));var csv=require(_0x19c8('0x9'));var ejs=require(_0x19c8('0xa'));var fs=require('fs');var _=require(_0x19c8('0xb'));var squel=require(_0x19c8('0xc'));var crypto=require(_0x19c8('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x19c8('0x9'));var querystring=require(_0x19c8('0xe'));var Papa=require('papaparse');var Redis=require(_0x19c8('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x19c8('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x19c8('0x11'));var logger=require(_0x19c8('0x12'))(_0x19c8('0x13'));var utils=require(_0x19c8('0x14'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x19c8('0x15')]=_['defaults'](config[_0x19c8('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0x19c8('0x16'))(new Redis(config[_0x19c8('0x15')]));require('./voicePrefix.socket')['register'](socket);function respondWithStatusCode(_0x552d63,_0x48bbd4){_0x48bbd4=_0x48bbd4||0xcc;return function(_0x5fb9d4){if(_0x5fb9d4){return _0x552d63['sendStatus'](_0x48bbd4);}return _0x552d63[_0x19c8('0x17')](_0x48bbd4)[_0x19c8('0x18')]();};}function respondWithResult(_0x2d4c46,_0x4cd03c){_0x4cd03c=_0x4cd03c||0xc8;return function(_0x40dc95){if(_0x40dc95){return _0x2d4c46[_0x19c8('0x17')](_0x4cd03c)[_0x19c8('0x19')](_0x40dc95);}};}function respondWithFilteredResult(_0x7c3062,_0x4cb311){return function(_0x16fa45){if(_0x16fa45){var _0x3b7194=_0x16fa45[_0x19c8('0x1a')],_0x2845de=_0x4cb311['offset'],_0x4ff69a=_0x4cb311[_0x19c8('0x1b')]+_0x4cb311[_0x19c8('0x1c')],_0x538ab8;if(_0x4ff69a>=_0x3b7194){_0x4ff69a=_0x3b7194;_0x538ab8=0xc8;}else{_0x538ab8=0xce;}_0x7c3062[_0x19c8('0x17')](_0x538ab8);return _0x7c3062[_0x19c8('0x1d')](_0x19c8('0x1e'),_0x2845de+'-'+_0x4ff69a+'/'+_0x3b7194)[_0x19c8('0x19')](_0x16fa45);}return null;};}function patchUpdates(_0x8e9d1c){return function(_0x2bce29){try{jsonpatch[_0x19c8('0x1f')](_0x2bce29,_0x8e9d1c,!![]);}catch(_0x3d6c44){return BPromise[_0x19c8('0x20')](_0x3d6c44);}return _0x2bce29['save']();};}function saveUpdates(_0x16fdb5,_0x413244){return function(_0x37592b){if(_0x37592b){return _0x37592b['update'](_0x16fdb5)[_0x19c8('0x21')](function(_0x2b7d43){return _0x2b7d43;});}return null;};}function removeEntity(_0x2fad48,_0x45db29){return function(_0x37c8f3){if(_0x37c8f3){return _0x37c8f3[_0x19c8('0x22')]()['then'](function(){var _0x2b804e=_0x37c8f3[_0x19c8('0x23')]({'plain':!![]});var _0xcd777a=_0x19c8('0x24');return db[_0x19c8('0x25')]['destroy']({'where':{'type':_0xcd777a,'resourceId':_0x2b804e['id']}})[_0x19c8('0x21')](function(){return _0x37c8f3;});})['then'](function(){_0x2fad48[_0x19c8('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x318e01,_0x519ddf){return function(_0x5a1a2e){if(!_0x5a1a2e){_0x318e01['sendStatus'](0x194);}return _0x5a1a2e;};}function handleError(_0x122163,_0x3c1b32){_0x3c1b32=_0x3c1b32||0x1f4;return function(_0xa8d970){logger[_0x19c8('0x26')](_0xa8d970[_0x19c8('0x27')]);if(_0xa8d970[_0x19c8('0x28')]){delete _0xa8d970['name'];}_0x122163[_0x19c8('0x17')](_0x3c1b32)[_0x19c8('0x29')](_0xa8d970);};}exports[_0x19c8('0x2a')]=function(_0x38b2f8,_0x55009e){var _0x5ec6e5={},_0x37d8c5={},_0x47de91={'count':0x0,'rows':[]};var _0x10b025=_['map'](db[_0x19c8('0x2b')]['rawAttributes'],function(_0x4fa1bd){return{'name':_0x4fa1bd['fieldName'],'type':_0x4fa1bd[_0x19c8('0x2c')][_0x19c8('0x2d')]};});_0x37d8c5[_0x19c8('0x2e')]=_['map'](_0x10b025,'name');_0x37d8c5[_0x19c8('0x2f')]=_['keys'](_0x38b2f8[_0x19c8('0x2f')]);_0x37d8c5[_0x19c8('0x30')]=_['intersection'](_0x37d8c5[_0x19c8('0x2e')],_0x37d8c5[_0x19c8('0x2f')]);_0x5ec6e5['attributes']=_[_0x19c8('0x31')](_0x37d8c5[_0x19c8('0x2e')],qs[_0x19c8('0x32')](_0x38b2f8[_0x19c8('0x2f')][_0x19c8('0x32')]));_0x5ec6e5[_0x19c8('0x33')]=_0x5ec6e5[_0x19c8('0x33')][_0x19c8('0x34')]?_0x5ec6e5[_0x19c8('0x33')]:_0x37d8c5[_0x19c8('0x2e')];if(!_0x38b2f8['query'][_0x19c8('0x35')](_0x19c8('0x36'))){_0x5ec6e5[_0x19c8('0x1c')]=qs['limit'](_0x38b2f8[_0x19c8('0x2f')][_0x19c8('0x1c')]);_0x5ec6e5['offset']=qs['offset'](_0x38b2f8[_0x19c8('0x2f')][_0x19c8('0x1b')]);}_0x5ec6e5[_0x19c8('0x37')]=qs[_0x19c8('0x38')](_0x38b2f8[_0x19c8('0x2f')]['sort']);_0x5ec6e5[_0x19c8('0x39')]=qs['filters'](_[_0x19c8('0x3a')](_0x38b2f8[_0x19c8('0x2f')],_0x37d8c5['filters']));if(_0x38b2f8[_0x19c8('0x2f')][_0x19c8('0x3b')]){_0x5ec6e5[_0x19c8('0x39')]=_[_0x19c8('0x3c')](_0x5ec6e5['where'],{'$or':_[_0x19c8('0x3d')](_0x10b025,function(_0xd3bea){if(_0xd3bea[_0x19c8('0x2c')]!==_0x19c8('0x3e')){var _0x108715={};_0x108715[_0xd3bea[_0x19c8('0x28')]]={'$like':'%'+_0x38b2f8[_0x19c8('0x2f')][_0x19c8('0x3b')]+'%'};return _0x108715;}})});}_0x5ec6e5=_[_0x19c8('0x3c')]({},_0x5ec6e5,_0x38b2f8[_0x19c8('0x3f')]);var _0x331bea={'where':_0x5ec6e5[_0x19c8('0x39')]};return db[_0x19c8('0x2b')][_0x19c8('0x1a')](_0x331bea)[_0x19c8('0x21')](function(_0x2b82ce){_0x47de91[_0x19c8('0x1a')]=_0x2b82ce;if(_0x38b2f8[_0x19c8('0x2f')][_0x19c8('0x40')]){_0x5ec6e5[_0x19c8('0x41')]=[{'all':!![]}];}return db[_0x19c8('0x2b')][_0x19c8('0x42')](_0x5ec6e5);})[_0x19c8('0x21')](function(_0x40655c){_0x47de91[_0x19c8('0x43')]=_0x40655c;return _0x47de91;})[_0x19c8('0x21')](respondWithFilteredResult(_0x55009e,_0x5ec6e5))['catch'](handleError(_0x55009e,null));};exports[_0x19c8('0x44')]=function(_0x429470,_0x585b66){var _0x46f77e={'raw':![],'where':{'id':_0x429470[_0x19c8('0x45')]['id']}},_0x211251={};_0x211251[_0x19c8('0x2e')]=_[_0x19c8('0x46')](db[_0x19c8('0x2b')][_0x19c8('0x47')]);_0x211251[_0x19c8('0x2f')]=_[_0x19c8('0x46')](_0x429470[_0x19c8('0x2f')]);_0x211251['filters']=_[_0x19c8('0x31')](_0x211251[_0x19c8('0x2e')],_0x211251[_0x19c8('0x2f')]);_0x46f77e[_0x19c8('0x33')]=_['intersection'](_0x211251['model'],qs['fields'](_0x429470[_0x19c8('0x2f')][_0x19c8('0x32')]));_0x46f77e[_0x19c8('0x33')]=_0x46f77e[_0x19c8('0x33')][_0x19c8('0x34')]?_0x46f77e[_0x19c8('0x33')]:_0x211251[_0x19c8('0x2e')];if(_0x429470['query'][_0x19c8('0x40')]){_0x46f77e[_0x19c8('0x41')]=[{'all':!![]}];}_0x46f77e=_[_0x19c8('0x3c')]({},_0x46f77e,_0x429470[_0x19c8('0x3f')]);return db[_0x19c8('0x2b')][_0x19c8('0x48')](_0x46f77e)[_0x19c8('0x21')](handleEntityNotFound(_0x585b66,null))[_0x19c8('0x21')](respondWithResult(_0x585b66,null))[_0x19c8('0x49')](handleError(_0x585b66,null));};exports[_0x19c8('0x22')]=function(_0x3590e4,_0x13e992){return db[_0x19c8('0x2b')][_0x19c8('0x48')]({'where':{'id':_0x3590e4[_0x19c8('0x45')]['id']}})[_0x19c8('0x21')](handleEntityNotFound(_0x13e992,null))[_0x19c8('0x21')](removeEntity(_0x13e992,null))[_0x19c8('0x49')](handleError(_0x13e992,null));};exports[_0x19c8('0x4a')]=function(_0x5e098b,_0x54e0f4){return db[_0x19c8('0x2b')][_0x19c8('0x4a')]()[_0x19c8('0x21')](respondWithResult(_0x54e0f4,null))[_0x19c8('0x49')](handleError(_0x54e0f4,null));};exports[_0x19c8('0x4b')]=function(_0x413c38,_0x57eb24){var _0x2e650d;return db[_0x19c8('0x4c')][_0x19c8('0x4d')](function(_0x53c171){return db[_0x19c8('0x2b')][_0x19c8('0x4b')](_0x413c38['body'],{'transaction':_0x53c171})['then'](function(_0x54eafc){_0x2e650d=_0x54eafc['get']({'plain':!![]});return db[_0x19c8('0x4e')][_0x19c8('0x48')]({'where':{'id':_0x2e650d[_0x19c8('0x4f')]},'raw':!![]})[_0x19c8('0x21')](function(_0x8da7c2){return createVoicePrefixExtensions(_0x2e650d,_0x8da7c2,_0x53c171);});});})['then'](function(){var _0x32f7fb=_0x413c38[_0x19c8('0x50')][_0x19c8('0x23')]({'plain':!![]});if(!_0x32f7fb)throw new Error(_0x19c8('0x51'));if(_0x32f7fb[_0x19c8('0x52')]===_0x19c8('0x50')){var _0x4a7ca=_0x2e650d;return db[_0x19c8('0x53')][_0x19c8('0x48')]({'where':{'name':_0x19c8('0x24'),'userProfileId':_0x32f7fb[_0x19c8('0x54')]},'raw':!![]})[_0x19c8('0x21')](function(_0x23118a){if(_0x23118a&&_0x23118a['autoAssociation']===0x0){return db[_0x19c8('0x25')][_0x19c8('0x4b')]({'name':_0x4a7ca[_0x19c8('0x28')],'resourceId':_0x4a7ca['id'],'type':_0x23118a[_0x19c8('0x28')],'sectionId':_0x23118a['id']},{})[_0x19c8('0x21')](function(){return _0x2e650d;});}else{return _0x2e650d;}})[_0x19c8('0x49')](function(_0x5d73d1){logger['error'](_0x19c8('0x55'),_0x5d73d1);throw _0x5d73d1;});}return _0x2e650d;})['then'](respondWithResult(_0x57eb24,null))[_0x19c8('0x49')](handleError(_0x57eb24,null));};function Extension(_0x2e0849,_0x5da945,_0x5f1b23,_0x1fc6cd){this['context']=_0x19c8('0x56');this[_0x19c8('0x57')]=_0x2e0849;this[_0x19c8('0x58')]=_0x5f1b23;this['type']='system';this['description']='Voice\x20Prefix\x20Extension';this[_0x19c8('0x59')]=_0x5da945;this['appdata']=_0x1fc6cd;}function createVoicePrefixExtensions(_0x4c563c,_0x116974,_0x4f1294){return new BPromise(function(_0x255cbc,_0x50d083){var _0x54be48=new Extension(formatPrefixName(_0x4c563c[_0x19c8('0x5a')]),0x1,_0x19c8('0x5b'),'Voice\x20Prefix');_0x54be48[_0x19c8('0x5c')]=_0x4c563c['id'];return db[_0x19c8('0x4e')][_0x19c8('0x4b')](_0x54be48,{'transaction':_0x4f1294})[_0x19c8('0x21')](function(_0xfdc78){var _0x3da334=_0xfdc78[_0x19c8('0x23')]({'plain':!![]});var _0xa7b0c1=_['map'](addVoicePrefixExtensions(_0x4c563c,_0x116974),function(_0x43510e){_0x43510e['VoiceExtensionId']=_0x3da334['id'];_0x43510e['VoicePrefixId']=_0x4c563c['id'];return _0x43510e;});return db['VoiceExtension'][_0x19c8('0x5d')](_0xa7b0c1,{'transaction':_0x4f1294})[_0x19c8('0x21')](function(_0x59d4dc){if(!_0x59d4dc){return _0x50d083(_0x19c8('0x5e'));}else{return _0x255cbc(_0x59d4dc);}})['catch'](function(_0x3e2e80){return _0x50d083(_0x3e2e80);});});;});};function addVoicePrefixExtensions(_0x4907cb,_0x5300a4){var _0x47bc35=[];var _0x5b4e2f=formatPrefixName(_0x4907cb[_0x19c8('0x5a')]);_0x47bc35[_0x19c8('0x5f')](new Extension(_0x5b4e2f,0x2,_0x19c8('0x60'),_0x19c8('0x61')+_0x4907cb[_0x19c8('0x28')]));if(_0x4907cb[_0x19c8('0x62')]){_0x47bc35[_0x19c8('0x5f')](new Extension(_0x5b4e2f,0x3,_0x19c8('0x60'),_0x19c8('0x63')+_0x4907cb['callerIdAll']));}else{_0x47bc35[_0x19c8('0x5f')](new Extension(_0x5b4e2f,0x3,_0x19c8('0x5b'),_0x19c8('0x64')));}_0x47bc35[_0x19c8('0x5f')](new Extension(_0x5b4e2f,0x4,_0x19c8('0x65'),_0x5300a4['context']+','+_0x19c8('0x66')+(0x8+_0x4907cb[_0x19c8('0x28')][_0x19c8('0x34')])+'}'+','+0x1));return _0x47bc35;}function formatPrefixName(_0x533e2d){var _0x14a4f1='_';for(var _0x517ab3=0x0;_0x517ab3<_0x533e2d['length'];_0x517ab3++){if(_0x533e2d[_0x19c8('0x67')](_0x517ab3)=='-'){_0x14a4f1+=_0x533e2d[_0x19c8('0x67')](_0x517ab3);}else{_0x14a4f1+='['+_0x533e2d[_0x19c8('0x67')](_0x517ab3)+']';}}_0x14a4f1+='.';return _0x14a4f1;}exports['update']=function(_0x50974b,_0x5626d8,_0x1ceddc){var _0x476406=_0x50974b['body'];_0x476406[_0x19c8('0x5a')]='system-'+_0x476406[_0x19c8('0x28')]+'-';return db[_0x19c8('0x4c')][_0x19c8('0x4d')](function(_0x43f6df){return db[_0x19c8('0x2b')]['update'](_0x476406,{'where':{'id':_0x476406['id']},'transaction':_0x43f6df})['then'](function(){return db['VoiceExtension']['destroy']({'where':{'VoicePrefixId':_0x476406['id']},'transaction':_0x43f6df})['then'](function(){return db[_0x19c8('0x4e')][_0x19c8('0x48')]({'where':{'id':_0x476406[_0x19c8('0x4f')]},'raw':!![]})[_0x19c8('0x21')](function(_0xe27b8){return createVoicePrefixExtensions(_0x476406,_0xe27b8,_0x43f6df);});});});})[_0x19c8('0x21')](function(){return db[_0x19c8('0x2b')][_0x19c8('0x68')](_0x476406['id']);})[_0x19c8('0x21')](respondWithResult(_0x5626d8,null))['catch'](handleError(_0x5626d8,null));};exports[_0x19c8('0x69')]=function(_0xcd9bc0,_0x58ecf1,_0x4d64e5){return db[_0x19c8('0x2b')][_0x19c8('0x48')]({'where':{'id':_0xcd9bc0[_0x19c8('0x45')]['id']}})['then'](handleEntityNotFound(_0x58ecf1,null))[_0x19c8('0x21')](function(_0x2f004b){if(_0x2f004b){return _0x2f004b['addAgents'](_0xcd9bc0[_0x19c8('0x6a')][_0x19c8('0x6b')],_[_0x19c8('0x6c')](_0xcd9bc0[_0x19c8('0x6a')],[_0x19c8('0x6b'),'id'])||{})[_0x19c8('0x6d')](function(_0x124ea0){for(var _0x78d0b2=0x0;_0x78d0b2<_0xcd9bc0['body'][_0x19c8('0x6b')][_0x19c8('0x34')];_0x78d0b2+=0x1){socket[_0x19c8('0x6e')]('userVoicePrefix:save',{'UserId':_0xcd9bc0[_0x19c8('0x6a')][_0x19c8('0x6b')][_0x78d0b2],'VoicePrefixId':_0xcd9bc0[_0x19c8('0x45')]['id']});}return _0x124ea0;});}})[_0x19c8('0x21')](respondWithResult(_0x58ecf1,null))[_0x19c8('0x49')](handleError(_0x58ecf1,null));};exports['removeAgents']=function(_0x5c339c,_0x1d5b94,_0x3aafb3){return db[_0x19c8('0x2b')]['find']({'where':{'id':_0x5c339c[_0x19c8('0x45')]['id']}})[_0x19c8('0x21')](handleEntityNotFound(_0x1d5b94,null))[_0x19c8('0x21')](function(_0x36c561){if(_0x36c561){return _0x36c561[_0x19c8('0x6f')](_0x5c339c[_0x19c8('0x2f')][_0x19c8('0x6b')])[_0x19c8('0x21')](function(){if(_['isArray'](_0x5c339c[_0x19c8('0x2f')]['ids'])){for(var _0xa25289=0x0;_0xa25289<_0x5c339c['query']['ids'][_0x19c8('0x34')];_0xa25289+=0x1){socket['emit'](_0x19c8('0x70'),{'UserId':Number(_0x5c339c['query'][_0x19c8('0x6b')][_0xa25289]),'VoicePrefixId':Number(_0x5c339c[_0x19c8('0x45')]['id'])});}}else{socket[_0x19c8('0x6e')](_0x19c8('0x70'),{'UserId':Number(_0x5c339c[_0x19c8('0x2f')][_0x19c8('0x6b')]),'VoicePrefixId':Number(_0x5c339c[_0x19c8('0x45')]['id'])});}});}})[_0x19c8('0x21')](respondWithStatusCode(_0x1d5b94,null))[_0x19c8('0x49')](handleError(_0x1d5b94,null));};exports[_0x19c8('0x71')]=function(_0x3e45e6,_0x4f2e3a,_0x3452ba){var _0x299beb={};var _0x575088={};var _0x2014ce;var _0x13183a;return db['VoicePrefix'][_0x19c8('0x72')]({'where':{'id':_0x3e45e6[_0x19c8('0x45')]['id']}})[_0x19c8('0x21')](handleEntityNotFound(_0x4f2e3a,null))[_0x19c8('0x21')](function(_0x15dcdf){if(_0x15dcdf){_0x2014ce=_0x15dcdf;_0x575088[_0x19c8('0x2e')]=_[_0x19c8('0x46')](db[_0x19c8('0x73')]['rawAttributes']);_0x575088[_0x19c8('0x2f')]=_[_0x19c8('0x46')](_0x3e45e6[_0x19c8('0x2f')]);_0x575088['filters']=_[_0x19c8('0x31')](_0x575088[_0x19c8('0x2e')],_0x575088['query']);_0x299beb['attributes']=_[_0x19c8('0x31')](_0x575088[_0x19c8('0x2e')],qs[_0x19c8('0x32')](_0x3e45e6[_0x19c8('0x2f')]['fields']));_0x299beb[_0x19c8('0x33')]=_0x299beb[_0x19c8('0x33')][_0x19c8('0x34')]?_0x299beb[_0x19c8('0x33')]:_0x575088[_0x19c8('0x2e')];_0x299beb[_0x19c8('0x37')]=qs[_0x19c8('0x38')](_0x3e45e6[_0x19c8('0x2f')][_0x19c8('0x38')]);_0x299beb['where']=qs[_0x19c8('0x30')](_['pick'](_0x3e45e6[_0x19c8('0x2f')],_0x575088['filters']));if(_0x3e45e6[_0x19c8('0x2f')][_0x19c8('0x3b')]){_0x299beb['where']=_[_0x19c8('0x3c')](_0x299beb[_0x19c8('0x39')],{'$or':_[_0x19c8('0x3d')](_0x299beb[_0x19c8('0x33')],function(_0x36420b){var _0x504adc={};_0x504adc[_0x36420b]={'$like':'%'+_0x3e45e6[_0x19c8('0x2f')][_0x19c8('0x3b')]+'%'};return _0x504adc;})});}_0x299beb=_[_0x19c8('0x3c')]({},_0x299beb,_0x3e45e6[_0x19c8('0x3f')]);return _0x2014ce['getAgents'](_0x299beb);}})[_0x19c8('0x21')](function(_0x1754f4){if(_0x1754f4){_0x13183a=_0x1754f4[_0x19c8('0x34')];if(!_0x3e45e6[_0x19c8('0x2f')]['hasOwnProperty'](_0x19c8('0x36'))){_0x299beb[_0x19c8('0x1c')]=qs[_0x19c8('0x1c')](_0x3e45e6[_0x19c8('0x2f')]['limit']);_0x299beb[_0x19c8('0x1b')]=qs[_0x19c8('0x1b')](_0x3e45e6[_0x19c8('0x2f')]['offset']);}return _0x2014ce[_0x19c8('0x71')](_0x299beb);}})[_0x19c8('0x21')](function(_0x1ae744){if(_0x1ae744){return _0x1ae744?{'count':_0x13183a,'rows':_0x1ae744}:null;}})[_0x19c8('0x21')](respondWithResult(_0x4f2e3a,null))['catch'](handleError(_0x4f2e3a,null));}; \ No newline at end of file +var _0x7e32=['system','description','priority','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','bulkCreate','push','Set','CDR(prefix)=','callerIdAll','PREFIX-CALLERIDALL=','No\x20callerid\x20available','goto','${EXTEN:','charAt','system-','findById','omit','ids','spread','emit','userVoicePrefix:save','removeAgents','userVoicePrefix:remove','User','hasOwnProperty','nolimit','getAgents','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','sendStatus','end','status','json','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','get','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','order','sort','pick','filter','where','map','VIRTUAL','merge','options','VoicePrefix','includeAll','findAll','rows','show','params','length','include','find','catch','describe','create','sequelize','transaction','body','VoiceExtension','VoiceExtensionId','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','exten'];(function(_0x4449d5,_0x29bdca){var _0xceea54=function(_0x23259b){while(--_0x23259b){_0x4449d5['push'](_0x4449d5['shift']());}};_0xceea54(++_0x29bdca);}(_0x7e32,0x9d));var _0x27e3=function(_0xfbadca,_0x15b6fd){_0xfbadca=_0xfbadca-0x0;var _0x4d27f6=_0x7e32[_0xfbadca];return _0x4d27f6;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x27e3('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x27e3('0x1'));var rp=require(_0x27e3('0x2'));var moment=require(_0x27e3('0x3'));var BPromise=require(_0x27e3('0x4'));var Mustache=require(_0x27e3('0x5'));var util=require(_0x27e3('0x6'));var path=require(_0x27e3('0x7'));var sox=require(_0x27e3('0x8'));var csv=require(_0x27e3('0x9'));var ejs=require(_0x27e3('0xa'));var fs=require('fs');var _=require(_0x27e3('0xb'));var squel=require(_0x27e3('0xc'));var crypto=require('crypto');var jsforce=require(_0x27e3('0xd'));var deskjs=require(_0x27e3('0xe'));var toCsv=require('to-csv');var querystring=require(_0x27e3('0xf'));var Papa=require(_0x27e3('0x10'));var Redis=require(_0x27e3('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x27e3('0x12'));var as=require(_0x27e3('0x13'));var hardwareService=require(_0x27e3('0x14'));var logger=require(_0x27e3('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x27e3('0x16'));var db=require(_0x27e3('0x17'))['db'];config[_0x27e3('0x18')]=_[_0x27e3('0x19')](config[_0x27e3('0x18')],{'host':_0x27e3('0x1a'),'port':0x18eb});var socket=require(_0x27e3('0x1b'))(new Redis(config[_0x27e3('0x18')]));require(_0x27e3('0x1c'))[_0x27e3('0x1d')](socket);function respondWithStatusCode(_0x531105,_0x42dcd1){_0x42dcd1=_0x42dcd1||0xcc;return function(_0x4a31ba){if(_0x4a31ba){return _0x531105[_0x27e3('0x1e')](_0x42dcd1);}return _0x531105['status'](_0x42dcd1)[_0x27e3('0x1f')]();};}function respondWithResult(_0x1d6601,_0x528ddc){_0x528ddc=_0x528ddc||0xc8;return function(_0x5b3b52){if(_0x5b3b52){return _0x1d6601[_0x27e3('0x20')](_0x528ddc)[_0x27e3('0x21')](_0x5b3b52);}};}function respondWithFilteredResult(_0x5560b1,_0x4570c0){return function(_0x5e48b6){if(_0x5e48b6){var _0x2a5cc1=_0x5e48b6[_0x27e3('0x22')],_0x3543d8=_0x4570c0[_0x27e3('0x23')],_0x4f8771=_0x4570c0['offset']+_0x4570c0[_0x27e3('0x24')],_0x2fc61d;if(_0x4f8771>=_0x2a5cc1){_0x4f8771=_0x2a5cc1;_0x2fc61d=0xc8;}else{_0x2fc61d=0xce;}_0x5560b1[_0x27e3('0x20')](_0x2fc61d);return _0x5560b1[_0x27e3('0x25')](_0x27e3('0x26'),_0x3543d8+'-'+_0x4f8771+'/'+_0x2a5cc1)['json'](_0x5e48b6);}return null;};}function patchUpdates(_0x2ecb03){return function(_0x336892){try{jsonpatch['apply'](_0x336892,_0x2ecb03,!![]);}catch(_0x34252d){return BPromise[_0x27e3('0x27')](_0x34252d);}return _0x336892[_0x27e3('0x28')]();};}function saveUpdates(_0x5422c4,_0x40eb9a){return function(_0xed70b0){if(_0xed70b0){return _0xed70b0[_0x27e3('0x29')](_0x5422c4)[_0x27e3('0x2a')](function(_0x55f3d2){return _0x55f3d2;});}return null;};}function removeEntity(_0x37ec56,_0xd1f547){return function(_0x17dcc7){if(_0x17dcc7){return _0x17dcc7[_0x27e3('0x2b')]()['then'](function(){var _0x55e788=_0x17dcc7[_0x27e3('0x2c')]({'plain':!![]});var _0x1eb2f0='VoicePrefixes';return db['UserProfileResource'][_0x27e3('0x2b')]({'where':{'type':_0x1eb2f0,'resourceId':_0x55e788['id']}})[_0x27e3('0x2a')](function(){return _0x17dcc7;});})[_0x27e3('0x2a')](function(){_0x37ec56[_0x27e3('0x20')](0xcc)[_0x27e3('0x1f')]();});}};}function handleEntityNotFound(_0x13eb69,_0x5f1645){return function(_0x1b3f9c){if(!_0x1b3f9c){_0x13eb69[_0x27e3('0x1e')](0x194);}return _0x1b3f9c;};}function handleError(_0x3d3325,_0xe3afe){_0xe3afe=_0xe3afe||0x1f4;return function(_0x549ccc){logger[_0x27e3('0x2d')](_0x549ccc[_0x27e3('0x2e')]);if(_0x549ccc['name']){delete _0x549ccc[_0x27e3('0x2f')];}_0x3d3325['status'](_0xe3afe)[_0x27e3('0x30')](_0x549ccc);};}exports[_0x27e3('0x31')]=function(_0x3b36ad,_0xb150c8){var _0x1375dd={},_0x51d66f={},_0x755200={'count':0x0,'rows':[]};var _0x24ff62=_['map'](db['VoicePrefix'][_0x27e3('0x32')],function(_0x588fb0){return{'name':_0x588fb0[_0x27e3('0x33')],'type':_0x588fb0[_0x27e3('0x34')][_0x27e3('0x35')]};});_0x51d66f[_0x27e3('0x36')]=_['map'](_0x24ff62,'name');_0x51d66f['query']=_[_0x27e3('0x37')](_0x3b36ad[_0x27e3('0x38')]);_0x51d66f[_0x27e3('0x39')]=_[_0x27e3('0x3a')](_0x51d66f[_0x27e3('0x36')],_0x51d66f[_0x27e3('0x38')]);_0x1375dd[_0x27e3('0x3b')]=_[_0x27e3('0x3a')](_0x51d66f['model'],qs['fields'](_0x3b36ad[_0x27e3('0x38')][_0x27e3('0x3c')]));_0x1375dd[_0x27e3('0x3b')]=_0x1375dd[_0x27e3('0x3b')]['length']?_0x1375dd[_0x27e3('0x3b')]:_0x51d66f[_0x27e3('0x36')];if(!_0x3b36ad[_0x27e3('0x38')]['hasOwnProperty']('nolimit')){_0x1375dd['limit']=qs['limit'](_0x3b36ad[_0x27e3('0x38')][_0x27e3('0x24')]);_0x1375dd['offset']=qs[_0x27e3('0x23')](_0x3b36ad[_0x27e3('0x38')][_0x27e3('0x23')]);}_0x1375dd[_0x27e3('0x3d')]=qs[_0x27e3('0x3e')](_0x3b36ad[_0x27e3('0x38')]['sort']);_0x1375dd['where']=qs[_0x27e3('0x39')](_[_0x27e3('0x3f')](_0x3b36ad[_0x27e3('0x38')],_0x51d66f[_0x27e3('0x39')]));if(_0x3b36ad[_0x27e3('0x38')][_0x27e3('0x40')]){_0x1375dd[_0x27e3('0x41')]=_['merge'](_0x1375dd[_0x27e3('0x41')],{'$or':_[_0x27e3('0x42')](_0x24ff62,function(_0x4860f5){if(_0x4860f5[_0x27e3('0x34')]!==_0x27e3('0x43')){var _0x251a5b={};_0x251a5b[_0x4860f5[_0x27e3('0x2f')]]={'$like':'%'+_0x3b36ad[_0x27e3('0x38')][_0x27e3('0x40')]+'%'};return _0x251a5b;}})});}_0x1375dd=_[_0x27e3('0x44')]({},_0x1375dd,_0x3b36ad[_0x27e3('0x45')]);var _0x3976e1={'where':_0x1375dd[_0x27e3('0x41')]};return db[_0x27e3('0x46')][_0x27e3('0x22')](_0x3976e1)[_0x27e3('0x2a')](function(_0x54e87d){_0x755200[_0x27e3('0x22')]=_0x54e87d;if(_0x3b36ad[_0x27e3('0x38')][_0x27e3('0x47')]){_0x1375dd['include']=[{'all':!![]}];}return db[_0x27e3('0x46')][_0x27e3('0x48')](_0x1375dd);})[_0x27e3('0x2a')](function(_0x598f4c){_0x755200[_0x27e3('0x49')]=_0x598f4c;return _0x755200;})[_0x27e3('0x2a')](respondWithFilteredResult(_0xb150c8,_0x1375dd))['catch'](handleError(_0xb150c8,null));};exports[_0x27e3('0x4a')]=function(_0x1c91e7,_0x3a3420){var _0x39da21={'raw':![],'where':{'id':_0x1c91e7[_0x27e3('0x4b')]['id']}},_0x2bfb96={};_0x2bfb96[_0x27e3('0x36')]=_['keys'](db[_0x27e3('0x46')][_0x27e3('0x32')]);_0x2bfb96[_0x27e3('0x38')]=_[_0x27e3('0x37')](_0x1c91e7['query']);_0x2bfb96[_0x27e3('0x39')]=_[_0x27e3('0x3a')](_0x2bfb96[_0x27e3('0x36')],_0x2bfb96[_0x27e3('0x38')]);_0x39da21[_0x27e3('0x3b')]=_[_0x27e3('0x3a')](_0x2bfb96[_0x27e3('0x36')],qs[_0x27e3('0x3c')](_0x1c91e7[_0x27e3('0x38')]['fields']));_0x39da21['attributes']=_0x39da21[_0x27e3('0x3b')][_0x27e3('0x4c')]?_0x39da21[_0x27e3('0x3b')]:_0x2bfb96[_0x27e3('0x36')];if(_0x1c91e7[_0x27e3('0x38')][_0x27e3('0x47')]){_0x39da21[_0x27e3('0x4d')]=[{'all':!![]}];}_0x39da21=_[_0x27e3('0x44')]({},_0x39da21,_0x1c91e7['options']);return db[_0x27e3('0x46')][_0x27e3('0x4e')](_0x39da21)[_0x27e3('0x2a')](handleEntityNotFound(_0x3a3420,null))[_0x27e3('0x2a')](respondWithResult(_0x3a3420,null))[_0x27e3('0x4f')](handleError(_0x3a3420,null));};exports[_0x27e3('0x2b')]=function(_0x4ebec0,_0x464b5b){return db[_0x27e3('0x46')][_0x27e3('0x4e')]({'where':{'id':_0x4ebec0[_0x27e3('0x4b')]['id']}})[_0x27e3('0x2a')](handleEntityNotFound(_0x464b5b,null))[_0x27e3('0x2a')](removeEntity(_0x464b5b,null))[_0x27e3('0x4f')](handleError(_0x464b5b,null));};exports[_0x27e3('0x50')]=function(_0x5f0a93,_0x57ac95){return db['VoicePrefix'][_0x27e3('0x50')]()[_0x27e3('0x2a')](respondWithResult(_0x57ac95,null))[_0x27e3('0x4f')](handleError(_0x57ac95,null));};exports[_0x27e3('0x51')]=function(_0x279cba,_0x3087da){var _0x5c4891;return db[_0x27e3('0x52')][_0x27e3('0x53')](function(_0x11aef9){return db[_0x27e3('0x46')][_0x27e3('0x51')](_0x279cba[_0x27e3('0x54')],{'transaction':_0x11aef9})[_0x27e3('0x2a')](function(_0x2492aa){_0x5c4891=_0x2492aa[_0x27e3('0x2c')]({'plain':!![]});return db[_0x27e3('0x55')]['find']({'where':{'id':_0x5c4891[_0x27e3('0x56')]},'raw':!![]})['then'](function(_0x469a7e){return createVoicePrefixExtensions(_0x5c4891,_0x469a7e,_0x11aef9);});});})[_0x27e3('0x2a')](function(){var _0x45ff9f=_0x279cba['user'][_0x27e3('0x2c')]({'plain':!![]});if(!_0x45ff9f)throw new Error(_0x27e3('0x57'));if(_0x45ff9f[_0x27e3('0x58')]===_0x27e3('0x59')){var _0x3de4d7=_0x5c4891;return db['UserProfileSection'][_0x27e3('0x4e')]({'where':{'name':'VoicePrefixes','userProfileId':_0x45ff9f[_0x27e3('0x5a')]},'raw':!![]})[_0x27e3('0x2a')](function(_0x2d56d6){if(_0x2d56d6&&_0x2d56d6[_0x27e3('0x5b')]===0x0){return db['UserProfileResource'][_0x27e3('0x51')]({'name':_0x3de4d7[_0x27e3('0x2f')],'resourceId':_0x3de4d7['id'],'type':_0x2d56d6[_0x27e3('0x2f')],'sectionId':_0x2d56d6['id']},{})[_0x27e3('0x2a')](function(){return _0x5c4891;});}else{return _0x5c4891;}})[_0x27e3('0x4f')](function(_0xa284bc){logger['error'](_0x27e3('0x5c'),_0xa284bc);throw _0xa284bc;});}return _0x5c4891;})[_0x27e3('0x2a')](respondWithResult(_0x3087da,null))[_0x27e3('0x4f')](handleError(_0x3087da,null));};function Extension(_0x187af1,_0xf3d7ad,_0x2eb316,_0x4fb185){this[_0x27e3('0x5d')]='from-sip';this[_0x27e3('0x5e')]=_0x187af1;this['app']=_0x2eb316;this[_0x27e3('0x34')]=_0x27e3('0x5f');this[_0x27e3('0x60')]='Voice\x20Prefix\x20Extension';this[_0x27e3('0x61')]=_0xf3d7ad;this[_0x27e3('0x62')]=_0x4fb185;}function createVoicePrefixExtensions(_0x3cd7d7,_0x47db92,_0x2e399e){return new BPromise(function(_0x11529a,_0x29315e){var _0x157ec8=new Extension(formatPrefixName(_0x3cd7d7[_0x27e3('0x63')]),0x1,_0x27e3('0x64'),_0x27e3('0x65'));_0x157ec8[_0x27e3('0x66')]=_0x3cd7d7['id'];return db[_0x27e3('0x55')][_0x27e3('0x51')](_0x157ec8,{'transaction':_0x2e399e})[_0x27e3('0x2a')](function(_0xf6e1d2){var _0x41b583=_0xf6e1d2[_0x27e3('0x2c')]({'plain':!![]});var _0x4be88d=_['map'](addVoicePrefixExtensions(_0x3cd7d7,_0x47db92),function(_0x934140){_0x934140[_0x27e3('0x56')]=_0x41b583['id'];_0x934140[_0x27e3('0x66')]=_0x3cd7d7['id'];return _0x934140;});return db['VoiceExtension'][_0x27e3('0x67')](_0x4be88d,{'transaction':_0x2e399e})[_0x27e3('0x2a')](function(_0x463ea6){if(!_0x463ea6){return _0x29315e('Extensions\x20creation\x20failed');}else{return _0x11529a(_0x463ea6);}})[_0x27e3('0x4f')](function(_0x392d7b){return _0x29315e(_0x392d7b);});});;});};function addVoicePrefixExtensions(_0x330e58,_0x43357d){var _0x34b6bb=[];var _0x153115=formatPrefixName(_0x330e58['prefix']);_0x34b6bb[_0x27e3('0x68')](new Extension(_0x153115,0x2,_0x27e3('0x69'),_0x27e3('0x6a')+_0x330e58[_0x27e3('0x2f')]));if(_0x330e58[_0x27e3('0x6b')]){_0x34b6bb[_0x27e3('0x68')](new Extension(_0x153115,0x3,_0x27e3('0x69'),_0x27e3('0x6c')+_0x330e58[_0x27e3('0x6b')]));}else{_0x34b6bb[_0x27e3('0x68')](new Extension(_0x153115,0x3,_0x27e3('0x64'),_0x27e3('0x6d')));}_0x34b6bb['push'](new Extension(_0x153115,0x4,_0x27e3('0x6e'),_0x43357d[_0x27e3('0x5d')]+','+_0x27e3('0x6f')+(0x8+_0x330e58['name'][_0x27e3('0x4c')])+'}'+','+0x1));return _0x34b6bb;}function formatPrefixName(_0x2c5ba7){var _0x3bffb0='_';for(var _0x115ed8=0x0;_0x115ed8<_0x2c5ba7[_0x27e3('0x4c')];_0x115ed8++){if(_0x2c5ba7[_0x27e3('0x70')](_0x115ed8)=='-'){_0x3bffb0+=_0x2c5ba7[_0x27e3('0x70')](_0x115ed8);}else{_0x3bffb0+='['+_0x2c5ba7[_0x27e3('0x70')](_0x115ed8)+']';}}_0x3bffb0+='.';return _0x3bffb0;}exports[_0x27e3('0x29')]=function(_0x3ec35f,_0x1af8fd,_0x151666){var _0x236d2d=_0x3ec35f[_0x27e3('0x54')];_0x236d2d[_0x27e3('0x63')]=_0x27e3('0x71')+_0x236d2d[_0x27e3('0x2f')]+'-';return db[_0x27e3('0x52')][_0x27e3('0x53')](function(_0x246bd7){return db['VoicePrefix'][_0x27e3('0x29')](_0x236d2d,{'where':{'id':_0x236d2d['id']},'transaction':_0x246bd7})[_0x27e3('0x2a')](function(){return db[_0x27e3('0x55')][_0x27e3('0x2b')]({'where':{'VoicePrefixId':_0x236d2d['id']},'transaction':_0x246bd7})[_0x27e3('0x2a')](function(){return db[_0x27e3('0x55')][_0x27e3('0x4e')]({'where':{'id':_0x236d2d[_0x27e3('0x56')]},'raw':!![]})[_0x27e3('0x2a')](function(_0x49d056){return createVoicePrefixExtensions(_0x236d2d,_0x49d056,_0x246bd7);});});});})[_0x27e3('0x2a')](function(){return db[_0x27e3('0x46')][_0x27e3('0x72')](_0x236d2d['id']);})['then'](respondWithResult(_0x1af8fd,null))[_0x27e3('0x4f')](handleError(_0x1af8fd,null));};exports['addAgents']=function(_0x32d1c9,_0x1ab6b3,_0x406a2a){return db['VoicePrefix'][_0x27e3('0x4e')]({'where':{'id':_0x32d1c9[_0x27e3('0x4b')]['id']}})['then'](handleEntityNotFound(_0x1ab6b3,null))[_0x27e3('0x2a')](function(_0x3eb9d9){if(_0x3eb9d9){return _0x3eb9d9['addAgents'](_0x32d1c9[_0x27e3('0x54')]['ids'],_[_0x27e3('0x73')](_0x32d1c9[_0x27e3('0x54')],[_0x27e3('0x74'),'id'])||{})[_0x27e3('0x75')](function(_0x538592){for(var _0x233d55=0x0;_0x233d55<_0x32d1c9[_0x27e3('0x54')][_0x27e3('0x74')][_0x27e3('0x4c')];_0x233d55+=0x1){socket[_0x27e3('0x76')](_0x27e3('0x77'),{'UserId':_0x32d1c9['body']['ids'][_0x233d55],'VoicePrefixId':_0x32d1c9['params']['id']});}return _0x538592;});}})[_0x27e3('0x2a')](respondWithResult(_0x1ab6b3,null))[_0x27e3('0x4f')](handleError(_0x1ab6b3,null));};exports[_0x27e3('0x78')]=function(_0x294b4b,_0x59b16d,_0x3969d6){return db[_0x27e3('0x46')]['find']({'where':{'id':_0x294b4b[_0x27e3('0x4b')]['id']}})[_0x27e3('0x2a')](handleEntityNotFound(_0x59b16d,null))['then'](function(_0x33d89d){if(_0x33d89d){return _0x33d89d[_0x27e3('0x78')](_0x294b4b[_0x27e3('0x38')][_0x27e3('0x74')])['then'](function(){if(_['isArray'](_0x294b4b[_0x27e3('0x38')]['ids'])){for(var _0x1a4daf=0x0;_0x1a4daf<_0x294b4b['query'][_0x27e3('0x74')][_0x27e3('0x4c')];_0x1a4daf+=0x1){socket['emit']('userVoicePrefix:remove',{'UserId':Number(_0x294b4b[_0x27e3('0x38')][_0x27e3('0x74')][_0x1a4daf]),'VoicePrefixId':Number(_0x294b4b['params']['id'])});}}else{socket[_0x27e3('0x76')](_0x27e3('0x79'),{'UserId':Number(_0x294b4b[_0x27e3('0x38')][_0x27e3('0x74')]),'VoicePrefixId':Number(_0x294b4b[_0x27e3('0x4b')]['id'])});}});}})['then'](respondWithStatusCode(_0x59b16d,null))[_0x27e3('0x4f')](handleError(_0x59b16d,null));};exports['getAgents']=function(_0x1ba62e,_0x2bf4cc,_0x293304){var _0x47243f={};var _0x3bd6d3={};var _0x1e22ba;var _0x1ddbb2;return db['VoicePrefix']['findOne']({'where':{'id':_0x1ba62e[_0x27e3('0x4b')]['id']}})[_0x27e3('0x2a')](handleEntityNotFound(_0x2bf4cc,null))[_0x27e3('0x2a')](function(_0x23bd51){if(_0x23bd51){_0x1e22ba=_0x23bd51;_0x3bd6d3[_0x27e3('0x36')]=_[_0x27e3('0x37')](db[_0x27e3('0x7a')][_0x27e3('0x32')]);_0x3bd6d3[_0x27e3('0x38')]=_['keys'](_0x1ba62e[_0x27e3('0x38')]);_0x3bd6d3[_0x27e3('0x39')]=_['intersection'](_0x3bd6d3['model'],_0x3bd6d3['query']);_0x47243f[_0x27e3('0x3b')]=_[_0x27e3('0x3a')](_0x3bd6d3[_0x27e3('0x36')],qs[_0x27e3('0x3c')](_0x1ba62e[_0x27e3('0x38')][_0x27e3('0x3c')]));_0x47243f[_0x27e3('0x3b')]=_0x47243f['attributes']['length']?_0x47243f[_0x27e3('0x3b')]:_0x3bd6d3['model'];_0x47243f[_0x27e3('0x3d')]=qs[_0x27e3('0x3e')](_0x1ba62e[_0x27e3('0x38')]['sort']);_0x47243f['where']=qs[_0x27e3('0x39')](_[_0x27e3('0x3f')](_0x1ba62e[_0x27e3('0x38')],_0x3bd6d3[_0x27e3('0x39')]));if(_0x1ba62e[_0x27e3('0x38')]['filter']){_0x47243f[_0x27e3('0x41')]=_[_0x27e3('0x44')](_0x47243f[_0x27e3('0x41')],{'$or':_[_0x27e3('0x42')](_0x47243f['attributes'],function(_0x577067){var _0x337d05={};_0x337d05[_0x577067]={'$like':'%'+_0x1ba62e[_0x27e3('0x38')]['filter']+'%'};return _0x337d05;})});}_0x47243f=_[_0x27e3('0x44')]({},_0x47243f,_0x1ba62e[_0x27e3('0x45')]);return _0x1e22ba['getAgents'](_0x47243f);}})[_0x27e3('0x2a')](function(_0x4eb7ad){if(_0x4eb7ad){_0x1ddbb2=_0x4eb7ad[_0x27e3('0x4c')];if(!_0x1ba62e[_0x27e3('0x38')][_0x27e3('0x7b')](_0x27e3('0x7c'))){_0x47243f[_0x27e3('0x24')]=qs[_0x27e3('0x24')](_0x1ba62e['query'][_0x27e3('0x24')]);_0x47243f['offset']=qs['offset'](_0x1ba62e[_0x27e3('0x38')][_0x27e3('0x23')]);}return _0x1e22ba[_0x27e3('0x7d')](_0x47243f);}})[_0x27e3('0x2a')](function(_0x249119){if(_0x249119){return _0x249119?{'count':_0x1ddbb2,'rows':_0x249119}:null;}})[_0x27e3('0x2a')](respondWithResult(_0x2bf4cc,null))[_0x27e3('0x4f')](handleError(_0x2bf4cc,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index ad86e7f..bdc39d9 100644 --- a/server/api/voicePrefix/voicePrefix.events.js +++ b/server/api/voicePrefix/voicePrefix.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['hasOwnProperty','hook','exports','events','../../mysqldb','VoicePrefix','update','emit'];(function(_0x725a4c,_0x102507){var _0x37b2cc=function(_0x505fc9){while(--_0x505fc9){_0x725a4c['push'](_0x725a4c['shift']());}};_0x37b2cc(++_0x102507);}(_0xa9e0,0x123));var _0x0a9e=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0xa9e0[_0x38a7ac];return _0x53061a;};'use strict';var EventEmitter=require(_0x0a9e('0x0'));var VoicePrefix=require(_0x0a9e('0x1'))['db'][_0x0a9e('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x0a9e('0x3'),'afterDestroy':'remove'};function emitEvent(_0x333808){return function(_0x432180,_0x2ab90b,_0x991246){VoicePrefixEvents[_0x0a9e('0x4')](_0x333808+':'+_0x432180['id'],_0x432180);VoicePrefixEvents['emit'](_0x333808,_0x432180);_0x991246(null);};}for(var e in events){if(events[_0x0a9e('0x5')](e)){var event=events[e];VoicePrefix[_0x0a9e('0x6')](e,emitEvent(event));}}module[_0x0a9e('0x7')]=VoicePrefixEvents; \ No newline at end of file +var _0x70e0=['emit','events','../../mysqldb','VoicePrefix','update','remove'];(function(_0x5cb971,_0x3160b9){var _0x2cdfcf=function(_0x13917f){while(--_0x13917f){_0x5cb971['push'](_0x5cb971['shift']());}};_0x2cdfcf(++_0x3160b9);}(_0x70e0,0x17b));var _0x070e=function(_0x51cd57,_0x364599){_0x51cd57=_0x51cd57-0x0;var _0x3564ea=_0x70e0[_0x51cd57];return _0x3564ea;};'use strict';var EventEmitter=require(_0x070e('0x0'));var VoicePrefix=require(_0x070e('0x1'))['db'][_0x070e('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x070e('0x3'),'afterDestroy':_0x070e('0x4')};function emitEvent(_0x277d32){return function(_0x2593e5,_0x5c90fc,_0x7bce9b){VoicePrefixEvents['emit'](_0x277d32+':'+_0x2593e5['id'],_0x2593e5);VoicePrefixEvents[_0x070e('0x5')](_0x277d32,_0x2593e5);_0x7bce9b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoicePrefix['hook'](e,emitEvent(event));}}module['exports']=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index 1f30b46..6757b65 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 _0xe08a=['define','VoicePrefix','voice_prefixes','util','api','moment','bluebird','request-promise','path','../../config/environment','./voicePrefix.attributes','exports'];(function(_0x2eade5,_0x5593b8){var _0x1e9966=function(_0x4c6612){while(--_0x4c6612){_0x2eade5['push'](_0x2eade5['shift']());}};_0x1e9966(++_0x5593b8);}(_0xe08a,0x18f));var _0xae08=function(_0x464bfb,_0x53f19a){_0x464bfb=_0x464bfb-0x0;var _0x57f96f=_0xe08a[_0x464bfb];return _0x57f96f;};'use strict';var _=require('lodash');var util=require(_0xae08('0x0'));var logger=require('../../config/logger')(_0xae08('0x1'));var moment=require(_0xae08('0x2'));var BPromise=require(_0xae08('0x3'));var rp=require(_0xae08('0x4'));var fs=require('fs');var path=require(_0xae08('0x5'));var rimraf=require('rimraf');var config=require(_0xae08('0x6'));var attributes=require(_0xae08('0x7'));module[_0xae08('0x8')]=function(_0x4f20dd,_0x4f480d){return _0x4f20dd[_0xae08('0x9')](_0xae08('0xa'),attributes,{'tableName':_0xae08('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x42d4=['./voicePrefix.attributes','exports','define','VoicePrefix','lodash','util','../../config/logger','api','moment','request-promise','../../config/environment'];(function(_0x4905a2,_0x53c4f9){var _0x4432b6=function(_0x5c11ce){while(--_0x5c11ce){_0x4905a2['push'](_0x4905a2['shift']());}};_0x4432b6(++_0x53c4f9);}(_0x42d4,0x143));var _0x442d=function(_0x3743ec,_0x1a5b0e){_0x3743ec=_0x3743ec-0x0;var _0x29ab78=_0x42d4[_0x3743ec];return _0x29ab78;};'use strict';var _=require(_0x442d('0x0'));var util=require(_0x442d('0x1'));var logger=require(_0x442d('0x2'))(_0x442d('0x3'));var moment=require(_0x442d('0x4'));var BPromise=require('bluebird');var rp=require(_0x442d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x442d('0x6'));var attributes=require(_0x442d('0x7'));module[_0x442d('0x8')]=function(_0x16406e,_0x5bf537){return _0x16406e[_0x442d('0x9')](_0x442d('0xa'),attributes,{'tableName':'voice_prefixes','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 da5d364..df5956b 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 _0xa14a=['jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./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','result','catch','lodash','moment','bluebird','randomstring','ioredis','rpc','../../config/environment'];(function(_0x567be4,_0x528383){var _0x13067b=function(_0x3afb62){while(--_0x3afb62){_0x567be4['push'](_0x567be4['shift']());}};_0x13067b(++_0x528383);}(_0xa14a,0x1b9));var _0xaa14=function(_0x50007c,_0x1cbf11){_0x50007c=_0x50007c-0x0;var _0x5c1ec7=_0xa14a[_0x50007c];return _0x5c1ec7;};'use strict';var _=require(_0xaa14('0x0'));var util=require('util');var moment=require(_0xaa14('0x1'));var BPromise=require(_0xaa14('0x2'));var rs=require(_0xaa14('0x3'));var fs=require('fs');var Redis=require(_0xaa14('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xaa14('0x5'));var config=require(_0xaa14('0x6'));var jayson=require(_0xaa14('0x7'));var client=jayson['client'][_0xaa14('0x8')]({'port':0x232a});config[_0xaa14('0x9')]=_[_0xaa14('0xa')](config['redis'],{'host':_0xaa14('0xb'),'port':0x18eb});var socket=require(_0xaa14('0xc'))(new Redis(config[_0xaa14('0x9')]));require(_0xaa14('0xd'))[_0xaa14('0xe')](socket);function respondWithRpcPromise(_0x3ddaef,_0x1c6689,_0x454b9c){return new BPromise(function(_0x1fdd61,_0x1ca205){return client[_0xaa14('0xf')](_0x3ddaef,_0x454b9c)[_0xaa14('0x10')](function(_0x116cc4){logger[_0xaa14('0x11')]('VoicePrefix,\x20%s,\x20%s',_0x1c6689,_0xaa14('0x12'));logger[_0xaa14('0x13')](_0xaa14('0x14'),_0x1c6689,_0xaa14('0x12'),JSON[_0xaa14('0x15')](_0x116cc4));if(_0x116cc4[_0xaa14('0x16')]){if(_0x116cc4['error'][_0xaa14('0x17')]===0x1f4){logger[_0xaa14('0x16')](_0xaa14('0x18'),_0x1c6689,_0x116cc4['error']['message']);return _0x1ca205(_0x116cc4[_0xaa14('0x16')][_0xaa14('0x19')]);}logger['error'](_0xaa14('0x18'),_0x1c6689,_0x116cc4[_0xaa14('0x16')][_0xaa14('0x19')]);return _0x1fdd61(_0x116cc4['error'][_0xaa14('0x19')]);}else{logger[_0xaa14('0x11')]('VoicePrefix,\x20%s,\x20%s',_0x1c6689,'request\x20sent');_0x1fdd61(_0x116cc4[_0xaa14('0x1a')]['message']);}})[_0xaa14('0x1b')](function(_0x4579bc){logger['error']('VoicePrefix,\x20%s,\x20%s',_0x1c6689,_0x4579bc);_0x1ca205(_0x4579bc);});});} \ No newline at end of file +var _0x9cd6=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','request','then','info','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','VoicePrefix,\x20%s,\x20%s','message','catch','util','bluebird'];(function(_0x4c9f65,_0x548207){var _0x1d1959=function(_0x2bba5f){while(--_0x2bba5f){_0x4c9f65['push'](_0x4c9f65['shift']());}};_0x1d1959(++_0x548207);}(_0x9cd6,0x16a));var _0x69cd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9cd6[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x69cd('0x0'));var moment=require('moment');var BPromise=require(_0x69cd('0x1'));var rs=require(_0x69cd('0x2'));var fs=require('fs');var Redis=require(_0x69cd('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x69cd('0x4'));var logger=require(_0x69cd('0x5'))(_0x69cd('0x6'));var config=require(_0x69cd('0x7'));var jayson=require(_0x69cd('0x8'));var client=jayson[_0x69cd('0x9')][_0x69cd('0xa')]({'port':0x232a});config[_0x69cd('0xb')]=_[_0x69cd('0xc')](config['redis'],{'host':_0x69cd('0xd'),'port':0x18eb});var socket=require(_0x69cd('0xe'))(new Redis(config[_0x69cd('0xb')]));require(_0x69cd('0xf'))['register'](socket);function respondWithRpcPromise(_0x4419b2,_0x448148,_0x1914dd){return new BPromise(function(_0x470e5c,_0x18879e){return client[_0x69cd('0x10')](_0x4419b2,_0x1914dd)[_0x69cd('0x11')](function(_0x7d626f){logger[_0x69cd('0x12')]('VoicePrefix,\x20%s,\x20%s',_0x448148,_0x69cd('0x13'));logger[_0x69cd('0x14')](_0x69cd('0x15'),_0x448148,_0x69cd('0x13'),JSON[_0x69cd('0x16')](_0x7d626f));if(_0x7d626f[_0x69cd('0x17')]){if(_0x7d626f['error'][_0x69cd('0x18')]===0x1f4){logger[_0x69cd('0x17')](_0x69cd('0x19'),_0x448148,_0x7d626f['error']['message']);return _0x18879e(_0x7d626f['error'][_0x69cd('0x1a')]);}logger['error'](_0x69cd('0x19'),_0x448148,_0x7d626f['error'][_0x69cd('0x1a')]);return _0x470e5c(_0x7d626f[_0x69cd('0x17')][_0x69cd('0x1a')]);}else{logger[_0x69cd('0x12')](_0x69cd('0x19'),_0x448148,_0x69cd('0x13'));_0x470e5c(_0x7d626f['result'][_0x69cd('0x1a')]);}})[_0x69cd('0x1b')](function(_0x7f31fa){logger['error'](_0x69cd('0x19'),_0x448148,_0x7f31fa);_0x18879e(_0x7f31fa);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 2317c95..9bfc1fd 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 _0xd6ee=['removeListener','register','length','voicePrefix:','./voicePrefix.events','save','emit'];(function(_0x1d29bd,_0x29eaef){var _0x57703c=function(_0x293847){while(--_0x293847){_0x1d29bd['push'](_0x1d29bd['shift']());}};_0x57703c(++_0x29eaef);}(_0xd6ee,0x1c4));var _0xed6e=function(_0x3109f1,_0x31e90d){_0x3109f1=_0x3109f1-0x0;var _0x1b041b=_0xd6ee[_0x3109f1];return _0x1b041b;};'use strict';var VoicePrefixEvents=require(_0xed6e('0x0'));var events=[_0xed6e('0x1'),'remove','update'];function createListener(_0x12b56a,_0x2c8c78){return function(_0x52b672){_0x2c8c78[_0xed6e('0x2')](_0x12b56a,_0x52b672);};}function removeListener(_0x9b3201,_0x3cb086){return function(){VoicePrefixEvents[_0xed6e('0x3')](_0x9b3201,_0x3cb086);};}exports[_0xed6e('0x4')]=function(_0x1b33d3){for(var _0x2da644=0x0,_0x57266a=events[_0xed6e('0x5')];_0x2da644<_0x57266a;_0x2da644++){var _0x913660=events[_0x2da644];var _0x50b16e=createListener(_0xed6e('0x6')+_0x913660,_0x1b33d3);VoicePrefixEvents['on'](_0x913660,_0x50b16e);}}; \ No newline at end of file +var _0x7797=['voicePrefix:','save','remove','removeListener','register'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7797,0x15f));var _0x7779=function(_0x492535,_0x46524a){_0x492535=_0x492535-0x0;var _0x256620=_0x7797[_0x492535];return _0x256620;};'use strict';var VoicePrefixEvents=require('./voicePrefix.events');var events=[_0x7779('0x0'),_0x7779('0x1'),'update'];function createListener(_0x7b8e21,_0x515ac3){return function(_0x29d06f){_0x515ac3['emit'](_0x7b8e21,_0x29d06f);};}function removeListener(_0x4bf222,_0x56c731){return function(){VoicePrefixEvents[_0x7779('0x2')](_0x4bf222,_0x56c731);};}exports[_0x7779('0x3')]=function(_0x1e8dfa){for(var _0x2edac6=0x0,_0x2563d7=events['length'];_0x2edac6<_0x2563d7;_0x2edac6++){var _0x3c3c9d=events[_0x2edac6];var _0x43d1d8=createListener(_0x7779('0x4')+_0x3c3c9d,_0x1e8dfa);VoicePrefixEvents['on'](_0x3c3c9d,_0x43d1d8);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index a8f7233..7b24af2 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 _0xae79=['getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/teams','/:id/members','getMembers','/:id/lists','getLists','/:id/blacklists','getBlackLists','post','create','clone','addTeams','/:id/users','addAgents','put','delete','destroy','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','util','connect-timeout','express','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','isAuthenticated','index','/:id','show','getHoppers','getHopperHistories','/:id/hopper_finals'];(function(_0x110827,_0x87e18f){var _0x1c5411=function(_0x45d3ab){while(--_0x45d3ab){_0x110827['push'](_0x110827['shift']());}};_0x1c5411(++_0x87e18f);}(_0xae79,0x1c5));var _0x9ae7=function(_0x41b368,_0x4b3c2c){_0x41b368=_0x41b368-0x0;var _0x136076=_0xae79[_0x41b368];return _0x136076;};'use strict';var multer=require(_0x9ae7('0x0'));var util=require(_0x9ae7('0x1'));var path=require('path');var timeout=require(_0x9ae7('0x2'));var express=require(_0x9ae7('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x9ae7('0x4'));var config=require(_0x9ae7('0x5'));var controller=require(_0x9ae7('0x6'));router[_0x9ae7('0x7')]('/',auth[_0x9ae7('0x8')](),controller[_0x9ae7('0x9')]);router[_0x9ae7('0x7')](_0x9ae7('0xa'),auth['isAuthenticated'](),controller[_0x9ae7('0xb')]);router[_0x9ae7('0x7')]('/:id/hoppers',auth[_0x9ae7('0x8')](),controller[_0x9ae7('0xc')]);router[_0x9ae7('0x7')]('/:id/hopper_histories',auth[_0x9ae7('0x8')](),controller[_0x9ae7('0xd')]);router[_0x9ae7('0x7')](_0x9ae7('0xe'),auth['isAuthenticated'](),controller[_0x9ae7('0xf')]);router[_0x9ae7('0x7')](_0x9ae7('0x10'),auth[_0x9ae7('0x8')](),controller[_0x9ae7('0x11')]);router[_0x9ae7('0x7')](_0x9ae7('0x12'),auth['isAuthenticated'](),controller['getTeams']);router[_0x9ae7('0x7')]('/:id/users',auth[_0x9ae7('0x8')](),controller['getAgents']);router[_0x9ae7('0x7')](_0x9ae7('0x13'),auth['isAuthenticated'](),controller[_0x9ae7('0x14')]);router[_0x9ae7('0x7')](_0x9ae7('0x15'),auth[_0x9ae7('0x8')](),controller[_0x9ae7('0x16')]);router['get'](_0x9ae7('0x17'),auth[_0x9ae7('0x8')](),controller[_0x9ae7('0x18')]);router[_0x9ae7('0x19')]('/',auth[_0x9ae7('0x8')](),controller[_0x9ae7('0x1a')]);router[_0x9ae7('0x19')]('/:id/clone',auth[_0x9ae7('0x8')](),controller[_0x9ae7('0x1b')]);router[_0x9ae7('0x19')](_0x9ae7('0x12'),auth[_0x9ae7('0x8')](),controller[_0x9ae7('0x1c')]);router[_0x9ae7('0x19')](_0x9ae7('0x1d'),auth[_0x9ae7('0x8')](),controller[_0x9ae7('0x1e')]);router[_0x9ae7('0x19')](_0x9ae7('0x15'),auth['isAuthenticated'](),controller['addLists']);router['post']('/:id/blacklists',auth[_0x9ae7('0x8')](),controller['addBlackLists']);router[_0x9ae7('0x1f')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x9ae7('0x20')](_0x9ae7('0xa'),auth[_0x9ae7('0x8')](),controller[_0x9ae7('0x21')]);router[_0x9ae7('0x20')](_0x9ae7('0x12'),auth[_0x9ae7('0x8')](),controller[_0x9ae7('0x22')]);router[_0x9ae7('0x20')](_0x9ae7('0x1d'),auth[_0x9ae7('0x8')](),controller[_0x9ae7('0x23')]);router[_0x9ae7('0x20')](_0x9ae7('0x15'),auth[_0x9ae7('0x8')](),controller[_0x9ae7('0x24')]);router[_0x9ae7('0x20')](_0x9ae7('0x17'),auth['isAuthenticated'](),controller[_0x9ae7('0x25')]);module[_0x9ae7('0x26')]=router; \ No newline at end of file +var _0x4fa3=['removeLists','exports','util','path','express','Router','../../components/interaction/service','./voiceQueue.controller','get','isAuthenticated','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/teams','getTeams','/:id/users','getAgents','getMembers','/:id/lists','getLists','/:id/blacklists','getBlackLists','create','post','/:id/clone','clone','addTeams','addAgents','addLists','addBlackLists','/:id','destroy','delete','removeTeams','removeAgents'];(function(_0x557f5f,_0x31d8e7){var _0x196eba=function(_0x433d89){while(--_0x433d89){_0x557f5f['push'](_0x557f5f['shift']());}};_0x196eba(++_0x31d8e7);}(_0x4fa3,0x9e));var _0x34fa=function(_0x6427d5,_0x508e04){_0x6427d5=_0x6427d5-0x0;var _0x4c7beb=_0x4fa3[_0x6427d5];return _0x4c7beb;};'use strict';var multer=require('multer');var util=require(_0x34fa('0x0'));var path=require(_0x34fa('0x1'));var timeout=require('connect-timeout');var express=require(_0x34fa('0x2'));var router=express[_0x34fa('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x34fa('0x4'));var config=require('../../config/environment');var controller=require(_0x34fa('0x5'));router[_0x34fa('0x6')]('/',auth[_0x34fa('0x7')](),controller['index']);router[_0x34fa('0x6')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x34fa('0x6')](_0x34fa('0x8'),auth['isAuthenticated'](),controller[_0x34fa('0x9')]);router[_0x34fa('0x6')](_0x34fa('0xa'),auth[_0x34fa('0x7')](),controller[_0x34fa('0xb')]);router[_0x34fa('0x6')]('/:id/hopper_finals',auth[_0x34fa('0x7')](),controller[_0x34fa('0xc')]);router[_0x34fa('0x6')](_0x34fa('0xd'),auth['isAuthenticated'](),controller[_0x34fa('0xe')]);router[_0x34fa('0x6')](_0x34fa('0xf'),auth[_0x34fa('0x7')](),controller[_0x34fa('0x10')]);router[_0x34fa('0x6')](_0x34fa('0x11'),auth[_0x34fa('0x7')](),controller[_0x34fa('0x12')]);router[_0x34fa('0x6')]('/:id/members',auth[_0x34fa('0x7')](),controller[_0x34fa('0x13')]);router[_0x34fa('0x6')](_0x34fa('0x14'),auth[_0x34fa('0x7')](),controller[_0x34fa('0x15')]);router[_0x34fa('0x6')](_0x34fa('0x16'),auth[_0x34fa('0x7')](),controller[_0x34fa('0x17')]);router['post']('/',auth[_0x34fa('0x7')](),controller[_0x34fa('0x18')]);router[_0x34fa('0x19')](_0x34fa('0x1a'),auth['isAuthenticated'](),controller[_0x34fa('0x1b')]);router[_0x34fa('0x19')](_0x34fa('0xf'),auth[_0x34fa('0x7')](),controller[_0x34fa('0x1c')]);router[_0x34fa('0x19')](_0x34fa('0x11'),auth[_0x34fa('0x7')](),controller[_0x34fa('0x1d')]);router[_0x34fa('0x19')](_0x34fa('0x14'),auth['isAuthenticated'](),controller[_0x34fa('0x1e')]);router[_0x34fa('0x19')]('/:id/blacklists',auth['isAuthenticated'](),controller[_0x34fa('0x1f')]);router['put']('/:id',auth[_0x34fa('0x7')](),controller['update']);router['delete'](_0x34fa('0x20'),auth[_0x34fa('0x7')](),controller[_0x34fa('0x21')]);router[_0x34fa('0x22')]('/:id/teams',auth['isAuthenticated'](),controller[_0x34fa('0x23')]);router[_0x34fa('0x22')](_0x34fa('0x11'),auth['isAuthenticated'](),controller[_0x34fa('0x24')]);router['delete'](_0x34fa('0x14'),auth[_0x34fa('0x7')](),controller[_0x34fa('0x25')]);router['delete'](_0x34fa('0x16'),auth[_0x34fa('0x7')](),controller['removeBlackLists']);module[_0x34fa('0x26')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index ec6fd6d..ba5fbaa 100644 --- a/server/api/voiceQueue/voiceQueue.attributes.js +++ b/server/api/voiceQueue/voiceQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['getDataValue','booked','roundrobin','progressive','predictive','power','INTEGER','yes','all','once','TEXT','periodic_announce','join','split','joinempty','leavewhenempty','acw','wrapuptime','BOOLEAN','Active/Disactive\x20Campaign','preview','Dial\x20Method.','UNSIGNED','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','Only\x20for\x20predictive\x20method.','FLOAT','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','onlyIfOpen','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','ASC','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDisposition','sequelize','exports','STRING','inbound','default','ENUM','leastrecent','fewestcalls','random','wrandom','setDataValue','strategy','rrmemory'];(function(_0x1ffaf9,_0x3180b1){var _0x25e3a5=function(_0x3ecdb0){while(--_0x3ecdb0){_0x1ffaf9['push'](_0x1ffaf9['shift']());}};_0x25e3a5(++_0x3180b1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xa9e0[_0x376b45];return _0x2341b3;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x3'),'outbound'),'allowNull':![],'defaultValue':_0x0a9e('0x3')},'musiconhold':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':_0x0a9e('0x4')},'announce':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':''},'strategy':{'type':Sequelize[_0x0a9e('0x5')]('rr','ringall',_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8'),'rrmemory','linear',_0x0a9e('0x9'),'rrordered'),'allowNull':![],'defaultValue':'ringall','set':function(_0x39753a){this[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x39753a?_0x39753a:_0x0a9e('0xc'));},'get':function(){var _0xfeb75b=this[_0x0a9e('0xd')]('type');var _0x50dfb2=this['getDataValue']('dialMethod');var _0x273d4d=this[_0x0a9e('0xd')](_0x0a9e('0xb'));if(_0xfeb75b===_0x0a9e('0x3')){return _0x273d4d;}if(_0x50dfb2===_0x0a9e('0xe')&&_0x273d4d===_0x0a9e('0xc')||_0x50dfb2==='booked'&&_0x273d4d===_0x0a9e('0xf')){return _0x273d4d;}if(_0x50dfb2===_0x0a9e('0x10')||_0x50dfb2===_0x0a9e('0x11')||_0x50dfb2===_0x0a9e('0x12')){return _0x273d4d;}return null;}},'servicelevel':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize['INTEGER'](0xb)},'timeout':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x0a9e('0x2')]},'weight':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x0a9e('0x5')]('yes','no'),'defaultValue':_0x0a9e('0x14')},'autopause':{'type':Sequelize['ENUM'](_0x0a9e('0x14'),'no',_0x0a9e('0x15')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x0a9e('0x13')](0xb)},'autopausebusy':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize['ENUM'](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x0a9e('0x5')]('yes','no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize['STRING'],'allowNull':!![]},'announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize['ENUM'](_0x0a9e('0x14'),'no'),'defaultValue':_0x0a9e('0x14')},'announce_holdtime':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no',_0x0a9e('0x16')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x0a9e('0x5')]('yes','no')},'announce_position_limit':{'type':Sequelize['INTEGER'](0xb)},'announce_round_seconds':{'type':Sequelize[_0x0a9e('0x5')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x0a9e('0x2')]},'queue_youarenext':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize['STRING'],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize['STRING'],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize['STRING'],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x0a9e('0x2')]},'queue_quantity1':{'type':Sequelize[_0x0a9e('0x2')]},'queue_quantity2':{'type':Sequelize[_0x0a9e('0x2')]},'queue_periodic_announce':{'type':Sequelize[_0x0a9e('0x2')]},'queue_less_than':{'type':Sequelize[_0x0a9e('0x2')]},'periodic_announce':{'type':Sequelize[_0x0a9e('0x17')],'set':function(_0x5a101a){this[_0x0a9e('0xa')](_0x0a9e('0x18'),_0x5a101a?_0x5a101a[_0x0a9e('0x19')](','):[]);},'get':function(){return this[_0x0a9e('0xd')]('periodic_announce')?this[_0x0a9e('0xd')](_0x0a9e('0x18'))[_0x0a9e('0x1a')](','):[];}},'joinempty':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':_0x0a9e('0x14'),'set':function(_0x563b45){this[_0x0a9e('0xa')](_0x0a9e('0x1b'),_0x563b45?_0x563b45[_0x0a9e('0x19')](','):undefined);},'get':function(){return this['getDataValue'](_0x0a9e('0x1b'))?this['getDataValue'](_0x0a9e('0x1b'))[_0x0a9e('0x1a')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':'no','set':function(_0x33bdb7){this[_0x0a9e('0xa')]('leavewhenempty',_0x33bdb7?_0x33bdb7[_0x0a9e('0x19')](','):undefined);},'get':function(){return this[_0x0a9e('0xd')](_0x0a9e('0x1c'))?this[_0x0a9e('0xd')](_0x0a9e('0x1c'))[_0x0a9e('0x1a')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize['ENUM'](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x0a9e('0x2')]},'description':{'type':Sequelize[_0x0a9e('0x2')]},'acw':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'set':function(_0x191e91){this[_0x0a9e('0xa')](_0x0a9e('0x1d'),_0x191e91);if(_0x191e91){if(this[_0x0a9e('0xd')]('wrapuptime')<0x2){this['setDataValue'](_0x0a9e('0x1e'),0x2);}}}},'acwTimeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':0x0,'comment':_0x0a9e('0x20')},'dialMethod':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x21'),'progressive',_0x0a9e('0x12'),_0x0a9e('0x11'),_0x0a9e('0xe')),'defaultValue':'progressive','comment':_0x0a9e('0x22')},'dialLimitChannel':{'type':Sequelize[_0x0a9e('0x13')](0x4)[_0x0a9e('0x23')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20channels,\x200\x20means\x20unlimited.'},'dialLimitQueue':{'type':Sequelize['INTEGER'](0x4)[_0x0a9e('0x23')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x0a9e('0x24')},'dialPowerLevel':{'type':Sequelize['FLOAT'](0x2)[_0x0a9e('0x23')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x0a9e('0x25')},'dialPredictiveOptimization':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x26'),'dropRate'),'defaultValue':'dropRate','comment':_0x0a9e('0x27')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x0a9e('0x28')](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x0a9e('0x29')},'dialPredictiveInterval':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':'Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)'},'dialOriginateCallerIdName':{'type':Sequelize[_0x0a9e('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x0a9e('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x2a')},'dialQueueOptions':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':_0x0a9e('0x2b'),'comment':_0x0a9e('0x2c')},'dialQueueTimeout':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x2d')},'dialQueueProject':{'type':Sequelize[_0x0a9e('0x2')],'comment':_0x0a9e('0x2e')},'dialCongestionMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x2f')},'dialBusyMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x30')},'dialBusyRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x31')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'comment':_0x0a9e('0x32')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x33')},'dialGlobalMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x0a9e('0x34')},'dialTimezone':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':_0x0a9e('0x35')},'dialPrefix':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0x0a9e('0x36'),'never',_0x0a9e('0x37')),'defaultValue':_0x0a9e('0x36')},'dialAMDActive':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x0a9e('0x38')},'dialAMDGreeting':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x0a9e('0x39')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x0a9e('0x13')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x0a9e('0x3a')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x0a9e('0x3b')},'dialAMDMinWordLength':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x0a9e('0x3c')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x0a9e('0x3d')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x0a9e('0x3e')},'dialRecallMeTimeout':{'type':Sequelize[_0x0a9e('0x13')](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x0a9e('0x3f')},'dialRecallInQueue':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':0x0,'comment':'Active/Disactive\x20Recall\x20In\x20Queue'},'dialOrderByScheduledAt':{'type':Sequelize['ENUM']('DESC',_0x0a9e('0x40')),'defaultValue':_0x0a9e('0x41')},'dialQueueProject2':{'type':Sequelize[_0x0a9e('0x2')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialAgiAfterHangupClient':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x0a9e('0x42')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x43')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x44')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x45')},'dialDropRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x46')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x47')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x48')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'mandatoryDispositionPauseId':{'type':Sequelize[_0x0a9e('0x13')],'allowNull':!![],'comment':_0x0a9e('0x49')},'mandatoryDisposition':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':![],'comment':_0x0a9e('0x4a'),'set':function(_0xb83dfd){if(!_0xb83dfd)this[_0x0a9e('0xa')]('mandatoryDispositionPauseId',null);this[_0x0a9e('0xa')](_0x0a9e('0x4b'),_0xb83dfd);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}}}; \ No newline at end of file +var _0xa9e0=['getDataValue','booked','roundrobin','progressive','predictive','power','INTEGER','yes','all','once','TEXT','periodic_announce','join','split','joinempty','leavewhenempty','acw','wrapuptime','BOOLEAN','Active/Disactive\x20Campaign','preview','Dial\x20Method.','UNSIGNED','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','Only\x20for\x20predictive\x20method.','FLOAT','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','onlyIfOpen','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','ASC','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDisposition','sequelize','exports','STRING','inbound','default','ENUM','leastrecent','fewestcalls','random','wrandom','setDataValue','strategy','rrmemory'];(function(_0xd4ec0c,_0x2afcd2){var _0x580218=function(_0x3b1cd4){while(--_0x3b1cd4){_0xd4ec0c['push'](_0xd4ec0c['shift']());}};_0x580218(++_0x2afcd2);}(_0xa9e0,0x123));var _0x0a9e=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0xa9e0[_0xa1e3e3];return _0xc980e9;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x3'),'outbound'),'allowNull':![],'defaultValue':_0x0a9e('0x3')},'musiconhold':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':_0x0a9e('0x4')},'announce':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':''},'strategy':{'type':Sequelize[_0x0a9e('0x5')]('rr','ringall',_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8'),'rrmemory','linear',_0x0a9e('0x9'),'rrordered'),'allowNull':![],'defaultValue':'ringall','set':function(_0x39753a){this[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x39753a?_0x39753a:_0x0a9e('0xc'));},'get':function(){var _0xfeb75b=this[_0x0a9e('0xd')]('type');var _0x50dfb2=this['getDataValue']('dialMethod');var _0x273d4d=this[_0x0a9e('0xd')](_0x0a9e('0xb'));if(_0xfeb75b===_0x0a9e('0x3')){return _0x273d4d;}if(_0x50dfb2===_0x0a9e('0xe')&&_0x273d4d===_0x0a9e('0xc')||_0x50dfb2==='booked'&&_0x273d4d===_0x0a9e('0xf')){return _0x273d4d;}if(_0x50dfb2===_0x0a9e('0x10')||_0x50dfb2===_0x0a9e('0x11')||_0x50dfb2===_0x0a9e('0x12')){return _0x273d4d;}return null;}},'servicelevel':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize['INTEGER'](0xb)},'timeout':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x0a9e('0x2')]},'weight':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x0a9e('0x5')]('yes','no'),'defaultValue':_0x0a9e('0x14')},'autopause':{'type':Sequelize['ENUM'](_0x0a9e('0x14'),'no',_0x0a9e('0x15')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x0a9e('0x13')](0xb)},'autopausebusy':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize['ENUM'](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x0a9e('0x5')]('yes','no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize['STRING'],'allowNull':!![]},'announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize['ENUM'](_0x0a9e('0x14'),'no'),'defaultValue':_0x0a9e('0x14')},'announce_holdtime':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no',_0x0a9e('0x16')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x0a9e('0x5')]('yes','no')},'announce_position_limit':{'type':Sequelize['INTEGER'](0xb)},'announce_round_seconds':{'type':Sequelize[_0x0a9e('0x5')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x0a9e('0x2')]},'queue_youarenext':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize['STRING'],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize['STRING'],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize['STRING'],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x0a9e('0x2')]},'queue_quantity1':{'type':Sequelize[_0x0a9e('0x2')]},'queue_quantity2':{'type':Sequelize[_0x0a9e('0x2')]},'queue_periodic_announce':{'type':Sequelize[_0x0a9e('0x2')]},'queue_less_than':{'type':Sequelize[_0x0a9e('0x2')]},'periodic_announce':{'type':Sequelize[_0x0a9e('0x17')],'set':function(_0x5a101a){this[_0x0a9e('0xa')](_0x0a9e('0x18'),_0x5a101a?_0x5a101a[_0x0a9e('0x19')](','):[]);},'get':function(){return this[_0x0a9e('0xd')]('periodic_announce')?this[_0x0a9e('0xd')](_0x0a9e('0x18'))[_0x0a9e('0x1a')](','):[];}},'joinempty':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':_0x0a9e('0x14'),'set':function(_0x563b45){this[_0x0a9e('0xa')](_0x0a9e('0x1b'),_0x563b45?_0x563b45[_0x0a9e('0x19')](','):undefined);},'get':function(){return this['getDataValue'](_0x0a9e('0x1b'))?this['getDataValue'](_0x0a9e('0x1b'))[_0x0a9e('0x1a')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':'no','set':function(_0x33bdb7){this[_0x0a9e('0xa')]('leavewhenempty',_0x33bdb7?_0x33bdb7[_0x0a9e('0x19')](','):undefined);},'get':function(){return this[_0x0a9e('0xd')](_0x0a9e('0x1c'))?this[_0x0a9e('0xd')](_0x0a9e('0x1c'))[_0x0a9e('0x1a')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize['ENUM'](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x0a9e('0x2')]},'description':{'type':Sequelize[_0x0a9e('0x2')]},'acw':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'set':function(_0x191e91){this[_0x0a9e('0xa')](_0x0a9e('0x1d'),_0x191e91);if(_0x191e91){if(this[_0x0a9e('0xd')]('wrapuptime')<0x2){this['setDataValue'](_0x0a9e('0x1e'),0x2);}}}},'acwTimeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':0x0,'comment':_0x0a9e('0x20')},'dialMethod':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x21'),'progressive',_0x0a9e('0x12'),_0x0a9e('0x11'),_0x0a9e('0xe')),'defaultValue':'progressive','comment':_0x0a9e('0x22')},'dialLimitChannel':{'type':Sequelize[_0x0a9e('0x13')](0x4)[_0x0a9e('0x23')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20channels,\x200\x20means\x20unlimited.'},'dialLimitQueue':{'type':Sequelize['INTEGER'](0x4)[_0x0a9e('0x23')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x0a9e('0x24')},'dialPowerLevel':{'type':Sequelize['FLOAT'](0x2)[_0x0a9e('0x23')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x0a9e('0x25')},'dialPredictiveOptimization':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x26'),'dropRate'),'defaultValue':'dropRate','comment':_0x0a9e('0x27')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x0a9e('0x28')](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x0a9e('0x29')},'dialPredictiveInterval':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':'Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)'},'dialOriginateCallerIdName':{'type':Sequelize[_0x0a9e('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x0a9e('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x2a')},'dialQueueOptions':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':_0x0a9e('0x2b'),'comment':_0x0a9e('0x2c')},'dialQueueTimeout':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x2d')},'dialQueueProject':{'type':Sequelize[_0x0a9e('0x2')],'comment':_0x0a9e('0x2e')},'dialCongestionMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x2f')},'dialBusyMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x30')},'dialBusyRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x31')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'comment':_0x0a9e('0x32')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x33')},'dialGlobalMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x0a9e('0x34')},'dialTimezone':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':_0x0a9e('0x35')},'dialPrefix':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0x0a9e('0x36'),'never',_0x0a9e('0x37')),'defaultValue':_0x0a9e('0x36')},'dialAMDActive':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x0a9e('0x38')},'dialAMDGreeting':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x0a9e('0x39')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x0a9e('0x13')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x0a9e('0x3a')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x0a9e('0x3b')},'dialAMDMinWordLength':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x0a9e('0x3c')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x0a9e('0x3d')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x0a9e('0x3e')},'dialRecallMeTimeout':{'type':Sequelize[_0x0a9e('0x13')](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x0a9e('0x3f')},'dialRecallInQueue':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':0x0,'comment':'Active/Disactive\x20Recall\x20In\x20Queue'},'dialOrderByScheduledAt':{'type':Sequelize['ENUM']('DESC',_0x0a9e('0x40')),'defaultValue':_0x0a9e('0x41')},'dialQueueProject2':{'type':Sequelize[_0x0a9e('0x2')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialAgiAfterHangupClient':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x0a9e('0x42')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x43')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x44')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x45')},'dialDropRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x46')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x47')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x48')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'mandatoryDispositionPauseId':{'type':Sequelize[_0x0a9e('0x13')],'allowNull':!![],'comment':_0x0a9e('0x49')},'mandatoryDisposition':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':![],'comment':_0x0a9e('0x4a'),'set':function(_0xb83dfd){if(!_0xb83dfd)this[_0x0a9e('0xa')]('mandatoryDispositionPauseId',null);this[_0x0a9e('0xa')](_0x0a9e('0x4b'),_0xb83dfd);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index 5ae8087..c534847 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 _0x693f=['redis','localhost','./voiceQueue.socket','sendStatus','status','end','json','count','offset','set','Content-Range','apply','save','update','then','destroy','get','VoiceQueues','inbound','QueueCampaigns','outbound','filter','ignore','map','value','includes','type','find','name','error','send','index','VoiceQueue','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','merge','include','catch','includeAll','options','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','clone','params','omit','createdAt','updatedAt','user','getHoppers','CmHopper','VoiceQueueId','findAll','findOne','CmHopperHistory','rows','getHopperFinals','order','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','teams','User','Agents','online','voicePause','interface','flatMap','forEach','sequelize','transaction','each','UserVoiceQueue','findOrCreate','UserVoiceQueueRt','upsert','format','removeTeams','ids','from','team_has_voice_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','all','union','compact','isEmpty','removeAgents','emit','addAgents','spread','userVoiceQueue:save','isNil','SIP/%s','penalty','isArray','userVoiceQueue:remove','getAgents','getMembers','getLists','CmList','dialCheckDuplicateType','always','insert','into','fromQuery','phone','ContactId','ListId','select','field','NOW()','scheduledAt','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','CmListId','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','cm_hopper_final','VoiceQueueId\x20=\x20?','cm_hopper','onlyIfOpen','COALESCE(phone,\x27\x27)','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb'];(function(_0x1c25c7,_0x335fab){var _0x5e0173=function(_0x38f969){while(--_0x38f969){_0x1c25c7['push'](_0x1c25c7['shift']());}};_0x5e0173(++_0x335fab);}(_0x693f,0x9d));var _0xf693=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x693f[_0x14add3];return _0x4a174f;};'use strict';var pdf=require(_0xf693('0x0'));var emlformat=require(_0xf693('0x1'));var rimraf=require(_0xf693('0x2'));var zipdir=require(_0xf693('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf693('0x4'));var moment=require(_0xf693('0x5'));var BPromise=require(_0xf693('0x6'));var Mustache=require(_0xf693('0x7'));var util=require(_0xf693('0x8'));var path=require(_0xf693('0x9'));var sox=require(_0xf693('0xa'));var csv=require('to-csv');var ejs=require(_0xf693('0xb'));var fs=require('fs');var _=require(_0xf693('0xc'));var squel=require('squel');var crypto=require(_0xf693('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xf693('0xe'));var toCsv=require('to-csv');var querystring=require(_0xf693('0xf'));var Papa=require(_0xf693('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xf693('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf693('0x12'))(_0xf693('0x13'));var utils=require(_0xf693('0x14'));var config=require(_0xf693('0x15'));var db=require(_0xf693('0x16'))['db'];config['redis']=_['defaults'](config[_0xf693('0x17')],{'host':_0xf693('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf693('0x17')]));require(_0xf693('0x19'))['register'](socket);function respondWithStatusCode(_0x5c42f0,_0x957c3f){_0x957c3f=_0x957c3f||0xcc;return function(_0x33f03f){if(_0x33f03f){return _0x5c42f0[_0xf693('0x1a')](_0x957c3f);}return _0x5c42f0[_0xf693('0x1b')](_0x957c3f)[_0xf693('0x1c')]();};}function respondWithResult(_0x5541a7,_0x1d9278){_0x1d9278=_0x1d9278||0xc8;return function(_0x1c0dfc){if(_0x1c0dfc){return _0x5541a7[_0xf693('0x1b')](_0x1d9278)[_0xf693('0x1d')](_0x1c0dfc);}};}function respondWithFilteredResult(_0x345539,_0x19ea07){return function(_0x49fbbb){if(_0x49fbbb){var _0x5e02e0=_0x49fbbb[_0xf693('0x1e')],_0x4a5964=_0x19ea07[_0xf693('0x1f')],_0x2474d4=_0x19ea07[_0xf693('0x1f')]+_0x19ea07['limit'],_0xf4d20e;if(_0x2474d4>=_0x5e02e0){_0x2474d4=_0x5e02e0;_0xf4d20e=0xc8;}else{_0xf4d20e=0xce;}_0x345539[_0xf693('0x1b')](_0xf4d20e);return _0x345539[_0xf693('0x20')](_0xf693('0x21'),_0x4a5964+'-'+_0x2474d4+'/'+_0x5e02e0)[_0xf693('0x1d')](_0x49fbbb);}return null;};}function patchUpdates(_0x1d20fc){return function(_0x179af6){try{jsonpatch[_0xf693('0x22')](_0x179af6,_0x1d20fc,!![]);}catch(_0x38f209){return BPromise['reject'](_0x38f209);}return _0x179af6[_0xf693('0x23')]();};}function saveUpdates(_0x1188c6,_0x2e022b){return function(_0x260181){if(_0x260181){return _0x260181[_0xf693('0x24')](_0x1188c6)[_0xf693('0x25')](function(_0x200c95){return _0x200c95;});}return null;};}function removeEntity(_0x5407f5,_0x179e25){return function(_0x11ff68){if(_0x11ff68){return _0x11ff68[_0xf693('0x26')]()[_0xf693('0x25')](function(){var _0x4840e2=_0x11ff68[_0xf693('0x27')]({'plain':!![]});var _0x302e08=[{'name':_0xf693('0x28'),'value':_0xf693('0x29'),'ignore':![]},{'name':_0xf693('0x2a'),'value':_0xf693('0x2b'),'ignore':![]}];var _0x1c6ff2=_(_0x302e08)[_0xf693('0x2c')](_0xf693('0x2d'))[_0xf693('0x2e')]('value')[_0xf693('0x2f')]();if(_[_0xf693('0x30')](_0x1c6ff2,_0x4840e2[_0xf693('0x31')])){return;}var _0x405f94=_[_0xf693('0x32')](_0x302e08,[_0xf693('0x2f'),_0x4840e2[_0xf693('0x31')]])[_0xf693('0x33')];return db['UserProfileResource'][_0xf693('0x26')]({'where':{'type':_0x405f94,'resourceId':_0x4840e2['id']}})[_0xf693('0x25')](function(){return _0x11ff68;});})[_0xf693('0x25')](function(){_0x5407f5[_0xf693('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5109a7,_0x12ac0a){return function(_0x29db3d){if(!_0x29db3d){_0x5109a7['sendStatus'](0x194);}return _0x29db3d;};}function handleError(_0x46c214,_0x3f6bb5){_0x3f6bb5=_0x3f6bb5||0x1f4;return function(_0x3ab712){logger[_0xf693('0x34')](_0x3ab712['stack']);if(_0x3ab712[_0xf693('0x33')]){delete _0x3ab712[_0xf693('0x33')];}_0x46c214[_0xf693('0x1b')](_0x3f6bb5)[_0xf693('0x35')](_0x3ab712);};}exports[_0xf693('0x36')]=function(_0x34b086,_0x6c2ba4){var _0x2bf84d={},_0x57e0d6={},_0x158079={'count':0x0,'rows':[]};var _0x3c1026=_[_0xf693('0x2e')](db[_0xf693('0x37')][_0xf693('0x38')],function(_0x192f20){return{'name':_0x192f20['fieldName'],'type':_0x192f20['type'][_0xf693('0x39')]};});_0x57e0d6[_0xf693('0x3a')]=_[_0xf693('0x2e')](_0x3c1026,'name');_0x57e0d6[_0xf693('0x3b')]=_[_0xf693('0x3c')](_0x34b086[_0xf693('0x3b')]);_0x57e0d6[_0xf693('0x3d')]=_[_0xf693('0x3e')](_0x57e0d6['model'],_0x57e0d6[_0xf693('0x3b')]);_0x2bf84d[_0xf693('0x3f')]=_[_0xf693('0x3e')](_0x57e0d6['model'],qs[_0xf693('0x40')](_0x34b086['query'][_0xf693('0x40')]));_0x2bf84d[_0xf693('0x3f')]=_0x2bf84d[_0xf693('0x3f')][_0xf693('0x41')]?_0x2bf84d[_0xf693('0x3f')]:_0x57e0d6['model'];if(!_0x34b086[_0xf693('0x3b')][_0xf693('0x42')](_0xf693('0x43'))){_0x2bf84d[_0xf693('0x44')]=qs[_0xf693('0x44')](_0x34b086[_0xf693('0x3b')][_0xf693('0x44')]);_0x2bf84d[_0xf693('0x1f')]=qs[_0xf693('0x1f')](_0x34b086['query'][_0xf693('0x1f')]);}_0x2bf84d['order']=qs['sort'](_0x34b086[_0xf693('0x3b')][_0xf693('0x45')]);_0x2bf84d[_0xf693('0x46')]=qs['filters'](_[_0xf693('0x47')](_0x34b086['query'],_0x57e0d6[_0xf693('0x3d')]));if(_0x34b086['query'][_0xf693('0x2c')]){_0x2bf84d[_0xf693('0x46')]=_[_0xf693('0x48')](_0x2bf84d[_0xf693('0x46')],{'$or':_[_0xf693('0x2e')](_0x3c1026,function(_0x47bc1b){if(_0x47bc1b['type']!=='VIRTUAL'){var _0x5ba1c7={};_0x5ba1c7[_0x47bc1b[_0xf693('0x33')]]={'$like':'%'+_0x34b086[_0xf693('0x3b')]['filter']+'%'};return _0x5ba1c7;}})});}_0x2bf84d=_['merge']({},_0x2bf84d,_0x34b086['options']);var _0x29f0ac={'where':_0x2bf84d[_0xf693('0x46')]};return db[_0xf693('0x37')][_0xf693('0x1e')](_0x29f0ac)['then'](function(_0x37a106){_0x158079[_0xf693('0x1e')]=_0x37a106;if(_0x34b086[_0xf693('0x3b')]['includeAll']){_0x2bf84d[_0xf693('0x49')]=[{'all':!![]}];}return db[_0xf693('0x37')]['findAll'](_0x2bf84d);})[_0xf693('0x25')](function(_0x1c80f8){_0x158079['rows']=_0x1c80f8;return _0x158079;})[_0xf693('0x25')](respondWithFilteredResult(_0x6c2ba4,_0x2bf84d))[_0xf693('0x4a')](handleError(_0x6c2ba4,null));};exports['show']=function(_0x35de87,_0x58c15e){var _0x81ad8d={'raw':![],'where':{'id':_0x35de87['params']['id']}},_0x3dbdb1={};_0x3dbdb1[_0xf693('0x3a')]=_[_0xf693('0x3c')](db[_0xf693('0x37')][_0xf693('0x38')]);_0x3dbdb1[_0xf693('0x3b')]=_[_0xf693('0x3c')](_0x35de87['query']);_0x3dbdb1[_0xf693('0x3d')]=_[_0xf693('0x3e')](_0x3dbdb1[_0xf693('0x3a')],_0x3dbdb1[_0xf693('0x3b')]);_0x81ad8d[_0xf693('0x3f')]=_['intersection'](_0x3dbdb1[_0xf693('0x3a')],qs[_0xf693('0x40')](_0x35de87['query'][_0xf693('0x40')]));_0x81ad8d['attributes']=_0x81ad8d['attributes']['length']?_0x81ad8d[_0xf693('0x3f')]:_0x3dbdb1[_0xf693('0x3a')];if(_0x35de87[_0xf693('0x3b')][_0xf693('0x4b')]){_0x81ad8d['include']=[{'all':!![]}];}_0x81ad8d=_['merge']({},_0x81ad8d,_0x35de87[_0xf693('0x4c')]);return db['VoiceQueue'][_0xf693('0x32')](_0x81ad8d)[_0xf693('0x25')](handleEntityNotFound(_0x58c15e,null))[_0xf693('0x25')](respondWithResult(_0x58c15e,null))['catch'](handleError(_0x58c15e,null));};exports[_0xf693('0x4d')]=function(_0x3e9bf4,_0x43cf4f){return db[_0xf693('0x37')][_0xf693('0x4d')](_0x3e9bf4[_0xf693('0x4e')],{})['then'](function(_0x558657){var _0x256552=_0x3e9bf4['user']['get']({'plain':!![]});if(!_0x256552)throw new Error(_0xf693('0x4f'));if(_0x256552[_0xf693('0x50')]==='user'){var _0x272919=_0x558657[_0xf693('0x27')]({'plain':!![]});var _0x2e08d2=[{'name':_0xf693('0x28'),'value':'inbound'},{'name':'QueueCampaigns','value':_0xf693('0x2b')}];var _0x39f2c0=_[_0xf693('0x32')](_0x2e08d2,[_0xf693('0x2f'),_0x272919['type']])[_0xf693('0x33')];return db[_0xf693('0x51')]['find']({'where':{'name':_0x39f2c0,'userProfileId':_0x256552[_0xf693('0x52')]},'raw':!![]})[_0xf693('0x25')](function(_0x387635){if(_0x387635&&_0x387635[_0xf693('0x53')]===0x0){return db[_0xf693('0x54')][_0xf693('0x4d')]({'name':_0x272919[_0xf693('0x33')],'resourceId':_0x272919['id'],'type':_0x387635[_0xf693('0x33')],'sectionId':_0x387635['id']},{})[_0xf693('0x25')](function(){return _0x558657;});}else{return _0x558657;}})[_0xf693('0x4a')](function(_0xd579a0){logger[_0xf693('0x34')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xd579a0);throw _0xd579a0;});}return _0x558657;})[_0xf693('0x25')](respondWithResult(_0x43cf4f,0xc9))[_0xf693('0x4a')](handleError(_0x43cf4f,null));};exports[_0xf693('0x55')]=function(_0x3bcf6a,_0x2dc2ae){var _0x266161={'where':{'id':_0x3bcf6a[_0xf693('0x56')]['id']}},_0x2ea128={};_0x2ea128[_0xf693('0x3a')]=_[_0xf693('0x3c')](db[_0xf693('0x37')][_0xf693('0x38')]);_0x266161['attributes']=_[_0xf693('0x3e')](_0x2ea128[_0xf693('0x3a')],qs[_0xf693('0x40')](_0x3bcf6a[_0xf693('0x3b')][_0xf693('0x40')]));_0x266161[_0xf693('0x3f')]=_0x266161[_0xf693('0x3f')][_0xf693('0x41')]?_0x266161[_0xf693('0x3f')]:_0x2ea128[_0xf693('0x3a')];if(_0x3bcf6a[_0xf693('0x3b')][_0xf693('0x4b')]){_0x266161['include']=[{'all':!![]}];}_0x266161=_[_0xf693('0x48')]({},_0x266161,_0x3bcf6a[_0xf693('0x4c')]);return db[_0xf693('0x37')][_0xf693('0x32')](_0x266161)[_0xf693('0x25')](handleEntityNotFound(_0x2dc2ae,null))[_0xf693('0x25')](function(_0x581ae5){if(_0x581ae5){var _0x294469=_0x581ae5[_0xf693('0x27')]({'plain':!![]});_0x294469=qs[_0xf693('0x57')](_0x294469,['id',_0xf693('0x58'),_0xf693('0x59')]);_0x3bcf6a[_0xf693('0x4e')]=_[_0xf693('0x57')](_0x3bcf6a['body'],['id','createdAt',_0xf693('0x59')]);return db[_0xf693('0x37')][_0xf693('0x4d')](_[_0xf693('0x48')](_0x294469,_0x3bcf6a[_0xf693('0x4e')]),{'include':_0x3bcf6a[_0xf693('0x3b')][_0xf693('0x4b')]?[{'all':!![]}]:undefined})['then'](function(_0x506ac3){var _0x1261ba=_0x3bcf6a['user']['get']({'plain':!![]});if(!_0x1261ba)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1261ba[_0xf693('0x50')]===_0xf693('0x5a')){var _0x31eacb=_0x506ac3[_0xf693('0x27')]({'plain':!![]});var _0x5229fe=[{'name':_0xf693('0x28'),'value':_0xf693('0x29')},{'name':_0xf693('0x2a'),'value':_0xf693('0x2b')}];var _0x4ef82a=_[_0xf693('0x32')](_0x5229fe,[_0xf693('0x2f'),_0x31eacb[_0xf693('0x31')]])['name'];return db['UserProfileSection'][_0xf693('0x32')]({'where':{'name':_0x4ef82a,'userProfileId':_0x1261ba[_0xf693('0x52')]},'raw':!![]})[_0xf693('0x25')](function(_0x4d5ddd){if(_0x4d5ddd&&_0x4d5ddd[_0xf693('0x53')]===0x0){return db[_0xf693('0x54')]['create']({'name':_0x31eacb[_0xf693('0x33')],'resourceId':_0x31eacb['id'],'type':_0x4d5ddd[_0xf693('0x33')],'sectionId':_0x4d5ddd['id']},{})['then'](function(){return _0x506ac3;});}else{return _0x506ac3;}})[_0xf693('0x4a')](function(_0xd9923e){logger[_0xf693('0x34')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xd9923e);throw _0xd9923e;});}return _0x506ac3;});}})['then'](respondWithResult(_0x2dc2ae,0xc9))['catch'](handleError(_0x2dc2ae,null));};exports[_0xf693('0x24')]=function(_0x556ec1,_0xb40d85){if(_0x556ec1[_0xf693('0x4e')]['id']){delete _0x556ec1[_0xf693('0x4e')]['id'];}return db[_0xf693('0x37')][_0xf693('0x32')]({'where':{'id':_0x556ec1[_0xf693('0x56')]['id']}})[_0xf693('0x25')](handleEntityNotFound(_0xb40d85,null))[_0xf693('0x25')](saveUpdates(_0x556ec1[_0xf693('0x4e')],null))[_0xf693('0x25')](respondWithResult(_0xb40d85,null))[_0xf693('0x4a')](handleError(_0xb40d85,null));};exports[_0xf693('0x26')]=function(_0xd53dfa,_0x155cb9){return db[_0xf693('0x37')][_0xf693('0x32')]({'where':{'id':_0xd53dfa[_0xf693('0x56')]['id']}})[_0xf693('0x25')](handleEntityNotFound(_0x155cb9,null))[_0xf693('0x25')](removeEntity(_0x155cb9,null))[_0xf693('0x4a')](handleError(_0x155cb9,null));};exports[_0xf693('0x5b')]=function(_0x1aaea6,_0xd80579,_0x19bd51){var _0x1271b0={'raw':![],'where':{}};var _0x42c05c={};var _0xe987fe={'count':0x0,'rows':[]};return db[_0xf693('0x37')]['findOne']({'where':{'id':_0x1aaea6[_0xf693('0x56')]['id']}})['then'](handleEntityNotFound(_0xd80579,null))[_0xf693('0x25')](function(_0x4622e6){if(_0x4622e6){_0x42c05c['model']=_['keys'](db[_0xf693('0x5c')][_0xf693('0x38')]);_0x42c05c[_0xf693('0x3b')]=_[_0xf693('0x3c')](_0x1aaea6[_0xf693('0x3b')]);_0x42c05c[_0xf693('0x3d')]=_[_0xf693('0x3e')](_0x42c05c['model'],_0x42c05c['query']);_0x1271b0[_0xf693('0x3f')]=_[_0xf693('0x3e')](_0x42c05c[_0xf693('0x3a')],qs[_0xf693('0x40')](_0x1aaea6[_0xf693('0x3b')][_0xf693('0x40')]));_0x1271b0[_0xf693('0x3f')]=_0x1271b0[_0xf693('0x3f')][_0xf693('0x41')]?_0x1271b0[_0xf693('0x3f')]:_0x42c05c[_0xf693('0x3a')];if(!_0x1aaea6['query'][_0xf693('0x42')](_0xf693('0x43'))){_0x1271b0['limit']=qs[_0xf693('0x44')](_0x1aaea6[_0xf693('0x3b')][_0xf693('0x44')]);_0x1271b0[_0xf693('0x1f')]=qs['offset'](_0x1aaea6[_0xf693('0x3b')][_0xf693('0x1f')]);}_0x1271b0['order']=qs['sort'](_0x1aaea6[_0xf693('0x3b')][_0xf693('0x45')]);_0x1271b0[_0xf693('0x46')]=qs[_0xf693('0x3d')](_[_0xf693('0x47')](_0x1aaea6[_0xf693('0x3b')],_0x42c05c[_0xf693('0x3d')]));_0x1271b0[_0xf693('0x46')][_0xf693('0x5d')]=_0x4622e6['id'];if(_0x1aaea6[_0xf693('0x3b')][_0xf693('0x2c')]){_0x1271b0[_0xf693('0x46')]=_[_0xf693('0x48')](_0x1271b0[_0xf693('0x46')],{'$or':_[_0xf693('0x2e')](_0x1271b0[_0xf693('0x3f')],function(_0x213639){var _0x3324ad={};_0x3324ad[_0x213639]={'$like':'%'+_0x1aaea6['query']['filter']+'%'};return _0x3324ad;})});}_0x1271b0=_['merge']({},_0x1271b0,_0x1aaea6[_0xf693('0x4c')]);return db[_0xf693('0x5c')]['count']({'where':_0x1271b0[_0xf693('0x46')]})['then'](function(_0x1a0b92){_0xe987fe[_0xf693('0x1e')]=_0x1a0b92;if(_0x1aaea6[_0xf693('0x3b')][_0xf693('0x4b')]){_0x1271b0[_0xf693('0x49')]=[{'all':!![]}];}return db[_0xf693('0x5c')][_0xf693('0x5e')](_0x1271b0);})[_0xf693('0x25')](function(_0x298f1b){_0xe987fe['rows']=_0x298f1b;return _0xe987fe;});}})['then'](respondWithFilteredResult(_0xd80579,_0x1271b0))['catch'](handleError(_0xd80579,null));};exports['getHopperHistories']=function(_0x5db577,_0x2c6abf,_0x6d28bc){var _0x5220d1={'raw':!![],'where':{}};var _0x368d25={};var _0x135e2f={'count':0x0,'rows':[]};return db[_0xf693('0x37')][_0xf693('0x5f')]({'where':{'id':_0x5db577[_0xf693('0x56')]['id']}})[_0xf693('0x25')](handleEntityNotFound(_0x2c6abf,null))[_0xf693('0x25')](function(_0x4e0255){if(_0x4e0255){_0x368d25[_0xf693('0x3a')]=_[_0xf693('0x3c')](db[_0xf693('0x60')][_0xf693('0x38')]);_0x368d25[_0xf693('0x3b')]=_[_0xf693('0x3c')](_0x5db577[_0xf693('0x3b')]);_0x368d25[_0xf693('0x3d')]=_['intersection'](_0x368d25[_0xf693('0x3a')],_0x368d25['query']);_0x5220d1['attributes']=_[_0xf693('0x3e')](_0x368d25['model'],qs[_0xf693('0x40')](_0x5db577[_0xf693('0x3b')]['fields']));_0x5220d1[_0xf693('0x3f')]=_0x5220d1[_0xf693('0x3f')]['length']?_0x5220d1['attributes']:_0x368d25[_0xf693('0x3a')];if(!_0x5db577[_0xf693('0x3b')]['hasOwnProperty'](_0xf693('0x43'))){_0x5220d1['limit']=qs[_0xf693('0x44')](_0x5db577[_0xf693('0x3b')][_0xf693('0x44')]);_0x5220d1[_0xf693('0x1f')]=qs[_0xf693('0x1f')](_0x5db577['query']['offset']);}_0x5220d1['order']=qs[_0xf693('0x45')](_0x5db577[_0xf693('0x3b')][_0xf693('0x45')]);_0x5220d1[_0xf693('0x46')]=qs[_0xf693('0x3d')](_[_0xf693('0x47')](_0x5db577[_0xf693('0x3b')],_0x368d25[_0xf693('0x3d')]));_0x5220d1['where']['VoiceQueueId']=_0x4e0255['id'];if(_0x5db577['query'][_0xf693('0x2c')]){_0x5220d1[_0xf693('0x46')]=_[_0xf693('0x48')](_0x5220d1['where'],{'$or':_['map'](_0x5220d1['attributes'],function(_0x5a4644){var _0x4c6c13={};_0x4c6c13[_0x5a4644]={'$like':'%'+_0x5db577[_0xf693('0x3b')][_0xf693('0x2c')]+'%'};return _0x4c6c13;})});}_0x5220d1=_['merge']({},_0x5220d1,_0x5db577[_0xf693('0x4c')]);return db[_0xf693('0x60')][_0xf693('0x1e')]({'where':_0x5220d1[_0xf693('0x46')]})[_0xf693('0x25')](function(_0x1519f2){_0x135e2f[_0xf693('0x1e')]=_0x1519f2;if(_0x5db577[_0xf693('0x3b')][_0xf693('0x4b')]){_0x5220d1[_0xf693('0x49')]=[{'all':!![]}];}return db[_0xf693('0x60')][_0xf693('0x5e')](_0x5220d1);})[_0xf693('0x25')](function(_0x243584){_0x135e2f[_0xf693('0x61')]=_0x243584;return _0x135e2f;});}})[_0xf693('0x25')](respondWithFilteredResult(_0x2c6abf,_0x5220d1))[_0xf693('0x4a')](handleError(_0x2c6abf,null));};exports[_0xf693('0x62')]=function(_0x484eb1,_0x211b85,_0x33477c){var _0x3f38b8={'raw':!![],'where':{}};var _0x99918={};var _0x558ab0={'count':0x0,'rows':[]};return db[_0xf693('0x37')]['findOne']({'where':{'id':_0x484eb1[_0xf693('0x56')]['id']}})['then'](handleEntityNotFound(_0x211b85,null))[_0xf693('0x25')](function(_0xc7cb24){if(_0xc7cb24){_0x99918[_0xf693('0x3a')]=_[_0xf693('0x3c')](db['CmHopperFinal'][_0xf693('0x38')]);_0x99918[_0xf693('0x3b')]=_[_0xf693('0x3c')](_0x484eb1[_0xf693('0x3b')]);_0x99918[_0xf693('0x3d')]=_['intersection'](_0x99918[_0xf693('0x3a')],_0x99918['query']);_0x3f38b8['attributes']=_['intersection'](_0x99918['model'],qs['fields'](_0x484eb1[_0xf693('0x3b')][_0xf693('0x40')]));_0x3f38b8[_0xf693('0x3f')]=_0x3f38b8[_0xf693('0x3f')]['length']?_0x3f38b8['attributes']:_0x99918['model'];if(!_0x484eb1[_0xf693('0x3b')][_0xf693('0x42')](_0xf693('0x43'))){_0x3f38b8[_0xf693('0x44')]=qs[_0xf693('0x44')](_0x484eb1[_0xf693('0x3b')]['limit']);_0x3f38b8[_0xf693('0x1f')]=qs[_0xf693('0x1f')](_0x484eb1[_0xf693('0x3b')][_0xf693('0x1f')]);}_0x3f38b8[_0xf693('0x63')]=qs['sort'](_0x484eb1[_0xf693('0x3b')][_0xf693('0x45')]);_0x3f38b8[_0xf693('0x46')]=qs[_0xf693('0x3d')](_[_0xf693('0x47')](_0x484eb1[_0xf693('0x3b')],_0x99918[_0xf693('0x3d')]));_0x3f38b8[_0xf693('0x46')][_0xf693('0x5d')]=_0xc7cb24['id'];if(_0x484eb1['query'][_0xf693('0x2c')]){_0x3f38b8['where']=_[_0xf693('0x48')](_0x3f38b8[_0xf693('0x46')],{'$or':_[_0xf693('0x2e')](_0x3f38b8['attributes'],function(_0x573b25){var _0x274cdb={};_0x274cdb[_0x573b25]={'$like':'%'+_0x484eb1[_0xf693('0x3b')]['filter']+'%'};return _0x274cdb;})});}_0x3f38b8=_[_0xf693('0x48')]({},_0x3f38b8,_0x484eb1[_0xf693('0x4c')]);return db[_0xf693('0x64')]['count']({'where':_0x3f38b8[_0xf693('0x46')]})[_0xf693('0x25')](function(_0x1d2ce5){_0x558ab0['count']=_0x1d2ce5;if(_0x484eb1[_0xf693('0x3b')][_0xf693('0x4b')]){_0x3f38b8[_0xf693('0x49')]=[{'all':!![]}];}return db['CmHopperFinal']['findAll'](_0x3f38b8);})[_0xf693('0x25')](function(_0x5e16ab){_0x558ab0[_0xf693('0x61')]=_0x5e16ab;return _0x558ab0;});}})[_0xf693('0x25')](respondWithFilteredResult(_0x211b85,_0x3f38b8))['catch'](handleError(_0x211b85,null));};exports[_0xf693('0x65')]=function(_0x41d077,_0x1e3e6b,_0x16028d){var _0xb1f168={'raw':!![],'where':{}};var _0x5c1db6={};var _0x47d0d5={'count':0x0,'rows':[]};return db[_0xf693('0x37')]['findOne']({'where':{'id':_0x41d077[_0xf693('0x56')]['id']}})[_0xf693('0x25')](handleEntityNotFound(_0x1e3e6b,null))['then'](function(_0xd61448){if(_0xd61448){_0x5c1db6[_0xf693('0x3a')]=_[_0xf693('0x3c')](db[_0xf693('0x66')][_0xf693('0x38')]);_0x5c1db6[_0xf693('0x3b')]=_['keys'](_0x41d077['query']);_0x5c1db6['filters']=_[_0xf693('0x3e')](_0x5c1db6[_0xf693('0x3a')],_0x5c1db6[_0xf693('0x3b')]);_0xb1f168[_0xf693('0x3f')]=_[_0xf693('0x3e')](_0x5c1db6[_0xf693('0x3a')],qs[_0xf693('0x40')](_0x41d077[_0xf693('0x3b')][_0xf693('0x40')]));_0xb1f168[_0xf693('0x3f')]=_0xb1f168['attributes']['length']?_0xb1f168['attributes']:_0x5c1db6['model'];if(!_0x41d077[_0xf693('0x3b')][_0xf693('0x42')](_0xf693('0x43'))){_0xb1f168[_0xf693('0x44')]=qs[_0xf693('0x44')](_0x41d077['query'][_0xf693('0x44')]);_0xb1f168[_0xf693('0x1f')]=qs[_0xf693('0x1f')](_0x41d077['query'][_0xf693('0x1f')]);}_0xb1f168['order']=qs['sort'](_0x41d077['query'][_0xf693('0x45')]);_0xb1f168[_0xf693('0x46')]=qs[_0xf693('0x3d')](_[_0xf693('0x47')](_0x41d077[_0xf693('0x3b')],_0x5c1db6[_0xf693('0x3d')]));_0xb1f168[_0xf693('0x46')][_0xf693('0x5d')]=_0xd61448['id'];if(_0x41d077[_0xf693('0x3b')]['filter']){_0xb1f168['where']=_[_0xf693('0x48')](_0xb1f168[_0xf693('0x46')],{'$or':_[_0xf693('0x2e')](_0xb1f168[_0xf693('0x3f')],function(_0x18784b){var _0x20077c={};_0x20077c[_0x18784b]={'$like':'%'+_0x41d077[_0xf693('0x3b')][_0xf693('0x2c')]+'%'};return _0x20077c;})});}_0xb1f168=_[_0xf693('0x48')]({},_0xb1f168,_0x41d077[_0xf693('0x4c')]);return db[_0xf693('0x66')][_0xf693('0x1e')]({'where':_0xb1f168[_0xf693('0x46')]})[_0xf693('0x25')](function(_0x4d46da){_0x47d0d5[_0xf693('0x1e')]=_0x4d46da;if(_0x41d077[_0xf693('0x3b')]['includeAll']){_0xb1f168[_0xf693('0x49')]=[{'all':!![]}];}return db[_0xf693('0x66')][_0xf693('0x5e')](_0xb1f168);})['then'](function(_0x1eed63){_0x47d0d5[_0xf693('0x61')]=_0x1eed63;return _0x47d0d5;});}})[_0xf693('0x25')](respondWithFilteredResult(_0x1e3e6b,_0xb1f168))[_0xf693('0x4a')](handleError(_0x1e3e6b,null));};exports[_0xf693('0x67')]=function(_0x3173d4,_0x38cd9b,_0x2f1310){var _0x433467={};var _0x1b98f1={};var _0xf09d5;var _0x54eb28;return db[_0xf693('0x37')][_0xf693('0x5f')]({'where':{'id':_0x3173d4['params']['id']}})[_0xf693('0x25')](handleEntityNotFound(_0x38cd9b,null))['then'](function(_0x294c43){if(_0x294c43){_0xf09d5=_0x294c43;_0x1b98f1[_0xf693('0x3a')]=_[_0xf693('0x3c')](db[_0xf693('0x68')]['rawAttributes']);_0x1b98f1[_0xf693('0x3b')]=_['keys'](_0x3173d4[_0xf693('0x3b')]);_0x1b98f1['filters']=_[_0xf693('0x3e')](_0x1b98f1[_0xf693('0x3a')],_0x1b98f1[_0xf693('0x3b')]);_0x433467[_0xf693('0x3f')]=_[_0xf693('0x3e')](_0x1b98f1[_0xf693('0x3a')],qs['fields'](_0x3173d4['query'][_0xf693('0x40')]));_0x433467[_0xf693('0x3f')]=_0x433467[_0xf693('0x3f')][_0xf693('0x41')]?_0x433467[_0xf693('0x3f')]:_0x1b98f1[_0xf693('0x3a')];_0x433467['order']=qs[_0xf693('0x45')](_0x3173d4[_0xf693('0x3b')][_0xf693('0x45')]);_0x433467[_0xf693('0x46')]=qs[_0xf693('0x3d')](_[_0xf693('0x47')](_0x3173d4[_0xf693('0x3b')],_0x1b98f1[_0xf693('0x3d')]));if(_0x3173d4[_0xf693('0x3b')][_0xf693('0x2c')]){_0x433467[_0xf693('0x46')]=_['merge'](_0x433467[_0xf693('0x46')],{'$or':_[_0xf693('0x2e')](_0x433467[_0xf693('0x3f')],function(_0x37acba){var _0x2ef268={};_0x2ef268[_0x37acba]={'$like':'%'+_0x3173d4[_0xf693('0x3b')]['filter']+'%'};return _0x2ef268;})});}_0x433467=_[_0xf693('0x48')]({},_0x433467,_0x3173d4['options']);return _0xf09d5['getTeams'](_0x433467);}})[_0xf693('0x25')](function(_0x58a4e7){if(_0x58a4e7){_0x54eb28=_0x58a4e7['length'];if(!_0x3173d4[_0xf693('0x3b')][_0xf693('0x42')](_0xf693('0x43'))){_0x433467['limit']=qs[_0xf693('0x44')](_0x3173d4[_0xf693('0x3b')]['limit']);_0x433467['offset']=qs[_0xf693('0x1f')](_0x3173d4[_0xf693('0x3b')][_0xf693('0x1f')]);}return _0xf09d5['getTeams'](_0x433467);}})[_0xf693('0x25')](function(_0x5e8967){if(_0x5e8967){return _0x5e8967?{'count':_0x54eb28,'rows':_0x5e8967}:null;}})[_0xf693('0x25')](respondWithResult(_0x38cd9b,null))[_0xf693('0x4a')](handleError(_0x38cd9b,null));};exports['addTeams']=function(_0x45ab72,_0x311893,_0x141924){var _0x1702ab=_0x45ab72['body'][_0xf693('0x69')];var _0x50a4dc=_[_0xf693('0x2e')](_0x1702ab,'id');return db[_0xf693('0x68')][_0xf693('0x5e')]({'where':{'id':_0x50a4dc},'attributes':['id'],'include':[{'model':db[_0xf693('0x6a')],'as':_0xf693('0x6b'),'attributes':['id',_0xf693('0x33'),_0xf693('0x6c'),_0xf693('0x6d'),_0xf693('0x6e')],'raw':!![]}]})[_0xf693('0x25')](function(_0x317b3b){if(_0x317b3b){var _0x34dba1=_[_0xf693('0x6f')](_0x317b3b,function(_0x2dc741){var _0x185a22=_0x2dc741['get']({'plain':!![]});_0x185a22['Agents'][_0xf693('0x70')](function(_0x362cb1){_0x362cb1['penalty']=_[_0xf693('0x32')](_0x1702ab,{'id':_0x185a22['id']})['penalty'];});return _0x185a22['Agents'];});return db[_0xf693('0x37')][_0xf693('0x32')]({'where':{'id':_0x45ab72[_0xf693('0x56')]['id']}})[_0xf693('0x25')](function(_0x3273f5){return db[_0xf693('0x71')][_0xf693('0x72')](function(_0x3dcd2d){return _0x3273f5['addTeams'](_0x50a4dc,{'transaction':_0x3dcd2d})[_0xf693('0x25')](function(){return BPromise[_0xf693('0x73')](_0x34dba1,function(_0x588bc4){return db[_0xf693('0x74')][_0xf693('0x75')]({'where':{'UserId':_0x588bc4['id'],'VoiceQueueId':_0x45ab72['params']['id']},'defaults':{'penalty':_0x588bc4['penalty']},'transaction':_0x3dcd2d});});})['then'](function(){return BPromise[_0xf693('0x73')](_[_0xf693('0x2c')](_0x34dba1,{'online':!![]}),function(_0x4772e9){return db[_0xf693('0x76')][_0xf693('0x77')]({'membername':_0x4772e9[_0xf693('0x33')],'UserId':_0x4772e9['id'],'queue_name':_0x3273f5[_0xf693('0x33')],'VoiceQueueId':_0x3273f5['id'],'interface':_['isNil'](_0x4772e9[_0xf693('0x6e')])?util[_0xf693('0x78')]('SIP/%s',_0x4772e9[_0xf693('0x33')]):_0x4772e9['interface'],'paused':_0x4772e9[_0xf693('0x6d')]||![],'penalty':_0x4772e9['penalty']},{'transaction':_0x3dcd2d});});})[_0xf693('0x25')](function(){_0x34dba1[_0xf693('0x70')](function(_0x5428f9){socket['emit']('userVoiceQueue:save',{'UserId':_0x5428f9['id'],'VoiceQueueId':_0x3273f5['id']});});});});});}})[_0xf693('0x25')](respondWithStatusCode(_0x311893,null))[_0xf693('0x4a')](handleError(_0x311893,null));};exports[_0xf693('0x79')]=function(_0x50dd8b,_0x57569e,_0xae5965){return db[_0xf693('0x68')]['findAll']({'where':{'id':_0x50dd8b[_0xf693('0x3b')][_0xf693('0x7a')]},'attributes':['id'],'include':[{'model':db[_0xf693('0x6a')],'as':_0xf693('0x6b'),'attributes':['id'],'raw':!![]}]})[_0xf693('0x25')](handleEntityNotFound(_0x57569e,null))['then'](function(_0x264cbf){var _0x1b3e3e=_[_0xf693('0x2e')](_0x264cbf,'id');var _0x1894e3=[];var _0x256074=[];var _0x2352f4=squel['select']();_0x2352f4['field']('tq.TeamId')[_0xf693('0x7b')](_0xf693('0x7c'),'tq')[_0xf693('0x7d')](_0xf693('0x7e'),'ut',_0xf693('0x7f'))['where']('VoiceQueueId\x20=\x20?',_0x50dd8b[_0xf693('0x56')]['id']);for(var _0x2b7fe3=0x0;_0x2b7fe3<_0x264cbf[_0xf693('0x41')];_0x2b7fe3+=0x1){let _0x2ab2f3=_0x264cbf[_0x2b7fe3];for(var _0x248afd=0x0;_0x248afd<_0x2ab2f3[_0xf693('0x6b')][_0xf693('0x41')];_0x248afd+=0x1){let _0x8e7840=_0x2ab2f3[_0xf693('0x6b')][_0x248afd];var _0x4e091a=_0x2352f4[_0xf693('0x55')]();_0x4e091a[_0xf693('0x46')](_0xf693('0x80'),_0x8e7840['id']);_0x256074[_0xf693('0x81')](db[_0xf693('0x71')]['query'](_0x4e091a[_0xf693('0x82')](),{'type':db[_0xf693('0x71')][_0xf693('0x83')][_0xf693('0x84')]})['then'](function(_0x272ba5){if(_0x272ba5['length']===0x1){return _0x8e7840['id'];}else{var _0x1ccd1f=_[_0xf693('0x85')](_[_0xf693('0x2e')](_0x272ba5,'TeamId'),function(_0x4ac514){return _[_0xf693('0x30')](_0x1b3e3e,_0x4ac514);});if(_0x1ccd1f){return _0x8e7840['id'];}}}));}}return BPromise[_0xf693('0x86')](_0x256074)['then'](function(_0x4e25d4){_0x1894e3=_(_0x1894e3)[_0xf693('0x87')](_0x4e25d4)[_0xf693('0x88')]()[_0xf693('0x2f')]();return db['VoiceQueue'][_0xf693('0x32')]({'where':{'id':_0x50dd8b[_0xf693('0x56')]['id']}})[_0xf693('0x25')](function(_0x12d2af){return db[_0xf693('0x71')][_0xf693('0x72')](function(_0x3b1f64){return _0x12d2af[_0xf693('0x79')](_0x50dd8b[_0xf693('0x3b')]['ids'],{'transaction':_0x3b1f64})[_0xf693('0x25')](function(){if(!_[_0xf693('0x89')](_0x1894e3)){return _0x12d2af[_0xf693('0x8a')](_0x1894e3,{'transaction':_0x3b1f64})[_0xf693('0x25')](function(){return db['UserVoiceQueueRt'][_0xf693('0x26')]({'where':{'VoiceQueueId':_0x50dd8b[_0xf693('0x56')]['id'],'UserId':_0x1894e3},'transaction':_0x3b1f64});});}})[_0xf693('0x25')](function(){_0x1894e3['forEach'](function(_0x2d0376){socket[_0xf693('0x8b')]('userVoiceQueue:remove',{'UserId':_0x2d0376,'VoiceQueueId':_0x12d2af['id']});});});});});});})[_0xf693('0x25')](respondWithStatusCode(_0x57569e,null))['catch'](handleError(_0x57569e,null));};exports['addAgents']=function(_0x119a6f,_0x385a3b,_0x50dc9d){var _0xf57155,_0x24e1df;return db[_0xf693('0x37')]['find']({'where':{'id':_0x119a6f[_0xf693('0x56')]['id']}})[_0xf693('0x25')](handleEntityNotFound(_0x385a3b,null))[_0xf693('0x25')](function(_0x32fc45){if(_0x32fc45){_0x24e1df=_0x32fc45;return _0x32fc45[_0xf693('0x8c')](_0x119a6f[_0xf693('0x4e')][_0xf693('0x7a')],_[_0xf693('0x57')](_0x119a6f['body'],[_0xf693('0x7a'),'id'])||{})[_0xf693('0x8d')](function(_0x28a859){for(var _0x2528bd=0x0;_0x2528bd<_0x119a6f['body'][_0xf693('0x7a')]['length'];_0x2528bd+=0x1){socket[_0xf693('0x8b')](_0xf693('0x8e'),{'UserId':_0x119a6f['body'][_0xf693('0x7a')][_0x2528bd],'VoiceQueueId':_0x119a6f[_0xf693('0x56')]['id']});}return _0x28a859;});}})['then'](function(_0xf5eeb0){_0xf57155=_0xf5eeb0||[];if(_0x24e1df){return db['User'][_0xf693('0x5e')]({'where':{'id':_0x119a6f[_0xf693('0x4e')][_0xf693('0x7a')]},'attributes':['id','name','online',_0xf693('0x6d'),_0xf693('0x6e')],'raw':!![]});}})[_0xf693('0x25')](function(_0x366801){if(!_[_0xf693('0x89')](_0x366801)){var _0xa7b5b4=[];for(var _0x52bdb3=0x0;_0x52bdb3<_0x366801[_0xf693('0x41')];_0x52bdb3++){if(_0x366801[_0x52bdb3][_0xf693('0x6c')]){_0xa7b5b4[_0xf693('0x81')](db[_0xf693('0x76')][_0xf693('0x77')]({'membername':_0x366801[_0x52bdb3]['name'],'UserId':_0x366801[_0x52bdb3]['id'],'queue_name':_0x24e1df['name'],'VoiceQueueId':_0x24e1df['id'],'interface':_[_0xf693('0x8f')](_0x366801[_0x52bdb3][_0xf693('0x6e')])?util[_0xf693('0x78')](_0xf693('0x90'),_0x366801[_0x52bdb3]['name']):_0x366801[_0x52bdb3][_0xf693('0x6e')],'paused':_0x366801[_0x52bdb3][_0xf693('0x6d')]||![],'penalty':_0x119a6f[_0xf693('0x4e')][_0xf693('0x91')]||0x0}));}}return BPromise[_0xf693('0x86')](_0xa7b5b4);}})[_0xf693('0x25')](function(){return _0xf57155;})[_0xf693('0x25')](respondWithResult(_0x385a3b,null))[_0xf693('0x4a')](handleError(_0x385a3b,null));};exports['removeAgents']=function(_0x55c3f1,_0x1bdcff,_0x36270f){return db[_0xf693('0x37')][_0xf693('0x32')]({'where':{'id':_0x55c3f1['params']['id']}})['then'](handleEntityNotFound(_0x1bdcff,null))['then'](function(_0x2ba90a){if(_0x2ba90a){return _0x2ba90a['removeAgents'](_0x55c3f1[_0xf693('0x3b')]['ids'])['then'](function(){if(_[_0xf693('0x92')](_0x55c3f1[_0xf693('0x3b')][_0xf693('0x7a')])){for(var _0x44fe80=0x0;_0x44fe80<_0x55c3f1[_0xf693('0x3b')][_0xf693('0x7a')][_0xf693('0x41')];_0x44fe80+=0x1){socket[_0xf693('0x8b')]('userVoiceQueue:remove',{'UserId':Number(_0x55c3f1[_0xf693('0x3b')]['ids'][_0x44fe80]),'VoiceQueueId':Number(_0x55c3f1[_0xf693('0x56')]['id'])});}}else{socket[_0xf693('0x8b')](_0xf693('0x93'),{'UserId':Number(_0x55c3f1[_0xf693('0x3b')]['ids']),'VoiceQueueId':Number(_0x55c3f1[_0xf693('0x56')]['id'])});}});}})[_0xf693('0x25')](function(_0x41deb7){return db[_0xf693('0x76')][_0xf693('0x26')]({'where':{'VoiceQueueId':_0x55c3f1[_0xf693('0x56')]['id'],'UserId':_0x55c3f1['query'][_0xf693('0x7a')]}})[_0xf693('0x25')](function(){return _0x41deb7;});})[_0xf693('0x25')](respondWithStatusCode(_0x1bdcff,null))[_0xf693('0x4a')](handleError(_0x1bdcff,null));};exports[_0xf693('0x94')]=function(_0x4fff09,_0x4f5956,_0x542c12){var _0x524a76={};var _0x3affa5={};var _0x326682;var _0xc0b995;return db[_0xf693('0x37')]['findOne']({'where':{'id':_0x4fff09[_0xf693('0x56')]['id']}})['then'](handleEntityNotFound(_0x4f5956,null))[_0xf693('0x25')](function(_0x20021d){if(_0x20021d){_0x326682=_0x20021d;_0x3affa5[_0xf693('0x3a')]=_[_0xf693('0x3c')](db[_0xf693('0x6a')][_0xf693('0x38')]);_0x3affa5[_0xf693('0x3b')]=_[_0xf693('0x3c')](_0x4fff09[_0xf693('0x3b')]);_0x3affa5[_0xf693('0x3d')]=_[_0xf693('0x3e')](_0x3affa5[_0xf693('0x3a')],_0x3affa5['query']);_0x524a76[_0xf693('0x3f')]=_[_0xf693('0x3e')](_0x3affa5[_0xf693('0x3a')],qs[_0xf693('0x40')](_0x4fff09[_0xf693('0x3b')][_0xf693('0x40')]));_0x524a76['attributes']=_0x524a76[_0xf693('0x3f')][_0xf693('0x41')]?_0x524a76[_0xf693('0x3f')]:_0x3affa5['model'];_0x524a76['order']=qs['sort'](_0x4fff09[_0xf693('0x3b')][_0xf693('0x45')]);_0x524a76['where']=qs['filters'](_[_0xf693('0x47')](_0x4fff09['query'],_0x3affa5[_0xf693('0x3d')]));if(_0x4fff09[_0xf693('0x3b')][_0xf693('0x2c')]){_0x524a76[_0xf693('0x46')]=_[_0xf693('0x48')](_0x524a76[_0xf693('0x46')],{'$or':_[_0xf693('0x2e')](_0x524a76['attributes'],function(_0x14aea3){var _0x3d26e2={};_0x3d26e2[_0x14aea3]={'$like':'%'+_0x4fff09[_0xf693('0x3b')][_0xf693('0x2c')]+'%'};return _0x3d26e2;})});}_0x524a76=_[_0xf693('0x48')]({},_0x524a76,_0x4fff09[_0xf693('0x4c')]);return _0x326682[_0xf693('0x94')](_0x524a76);}})['then'](function(_0x2f1aeb){if(_0x2f1aeb){_0xc0b995=_0x2f1aeb[_0xf693('0x41')];if(!_0x4fff09[_0xf693('0x3b')][_0xf693('0x42')](_0xf693('0x43'))){_0x524a76['limit']=qs[_0xf693('0x44')](_0x4fff09['query'][_0xf693('0x44')]);_0x524a76['offset']=qs[_0xf693('0x1f')](_0x4fff09[_0xf693('0x3b')][_0xf693('0x1f')]);}return _0x326682['getAgents'](_0x524a76);}})[_0xf693('0x25')](function(_0x8e9531){if(_0x8e9531){return _0x8e9531?{'count':_0xc0b995,'rows':_0x8e9531}:null;}})[_0xf693('0x25')](respondWithResult(_0x4f5956,null))[_0xf693('0x4a')](handleError(_0x4f5956,null));};exports[_0xf693('0x95')]=function(_0x1a2a7a,_0x3e566f,_0xddc620){var _0x49040f={};var _0x1b5e40={};var _0xae7c43;var _0x265499;return db[_0xf693('0x37')][_0xf693('0x5f')]({'where':{'id':_0x1a2a7a[_0xf693('0x56')]['id']}})[_0xf693('0x25')](handleEntityNotFound(_0x3e566f,null))[_0xf693('0x25')](function(_0x3db0d3){if(_0x3db0d3){_0xae7c43=_0x3db0d3;_0x1b5e40[_0xf693('0x3a')]=_[_0xf693('0x3c')](db['UserVoiceQueueRt']['rawAttributes']);_0x1b5e40[_0xf693('0x3b')]=_[_0xf693('0x3c')](_0x1a2a7a[_0xf693('0x3b')]);_0x1b5e40[_0xf693('0x3d')]=_['intersection'](_0x1b5e40[_0xf693('0x3a')],_0x1b5e40['query']);_0x49040f[_0xf693('0x3f')]=_[_0xf693('0x3e')](_0x1b5e40[_0xf693('0x3a')],qs[_0xf693('0x40')](_0x1a2a7a[_0xf693('0x3b')][_0xf693('0x40')]));_0x49040f['attributes']=_0x49040f[_0xf693('0x3f')][_0xf693('0x41')]?_0x49040f[_0xf693('0x3f')]:_0x1b5e40['model'];_0x49040f[_0xf693('0x63')]=qs[_0xf693('0x45')](_0x1a2a7a['query'][_0xf693('0x45')]);_0x49040f[_0xf693('0x46')]=qs[_0xf693('0x3d')](_['pick'](_0x1a2a7a[_0xf693('0x3b')],_0x1b5e40[_0xf693('0x3d')]));if(_0x1a2a7a[_0xf693('0x3b')][_0xf693('0x2c')]){_0x49040f['where']=_[_0xf693('0x48')](_0x49040f['where'],{'$or':_[_0xf693('0x2e')](_0x49040f[_0xf693('0x3f')],function(_0x179d91){var _0x3b531a={};_0x3b531a[_0x179d91]={'$like':'%'+_0x1a2a7a[_0xf693('0x3b')][_0xf693('0x2c')]+'%'};return _0x3b531a;})});}_0x49040f=_['merge']({},_0x49040f,_0x1a2a7a[_0xf693('0x4c')]);return _0xae7c43[_0xf693('0x95')](_0x49040f);}})[_0xf693('0x25')](function(_0x5d6df4){if(_0x5d6df4){_0x265499=_0x5d6df4['length'];if(!_0x1a2a7a[_0xf693('0x3b')][_0xf693('0x42')]('nolimit')){_0x49040f[_0xf693('0x44')]=qs[_0xf693('0x44')](_0x1a2a7a['query']['limit']);_0x49040f[_0xf693('0x1f')]=qs[_0xf693('0x1f')](_0x1a2a7a[_0xf693('0x3b')]['offset']);}return _0xae7c43[_0xf693('0x95')](_0x49040f);}})[_0xf693('0x25')](function(_0x2dc347){return _0x2dc347?{'count':_0x265499,'rows':_0x2dc347}:null;})[_0xf693('0x25')](respondWithResult(_0x3e566f,null))[_0xf693('0x4a')](handleError(_0x3e566f,null));};exports[_0xf693('0x96')]=function(_0x1deda4,_0x2517d1,_0x59a7a4){var _0x49dcae={};var _0x33c6f7={};var _0x9db3dc;var _0x3276d4;return db[_0xf693('0x37')]['findOne']({'where':{'id':_0x1deda4['params']['id']}})[_0xf693('0x25')](handleEntityNotFound(_0x2517d1,null))[_0xf693('0x25')](function(_0x138b95){if(_0x138b95){_0x9db3dc=_0x138b95;_0x33c6f7[_0xf693('0x3a')]=_[_0xf693('0x3c')](db[_0xf693('0x97')]['rawAttributes']);_0x33c6f7[_0xf693('0x3b')]=_['keys'](_0x1deda4[_0xf693('0x3b')]);_0x33c6f7['filters']=_['intersection'](_0x33c6f7[_0xf693('0x3a')],_0x33c6f7[_0xf693('0x3b')]);_0x49dcae[_0xf693('0x3f')]=_[_0xf693('0x3e')](_0x33c6f7[_0xf693('0x3a')],qs[_0xf693('0x40')](_0x1deda4[_0xf693('0x3b')][_0xf693('0x40')]));_0x49dcae['attributes']=_0x49dcae['attributes']['length']?_0x49dcae[_0xf693('0x3f')]:_0x33c6f7[_0xf693('0x3a')];_0x49dcae[_0xf693('0x63')]=qs[_0xf693('0x45')](_0x1deda4[_0xf693('0x3b')]['sort']);_0x49dcae[_0xf693('0x46')]=qs[_0xf693('0x3d')](_[_0xf693('0x47')](_0x1deda4[_0xf693('0x3b')],_0x33c6f7[_0xf693('0x3d')]));if(_0x1deda4['query'][_0xf693('0x2c')]){_0x49dcae[_0xf693('0x46')]=_[_0xf693('0x48')](_0x49dcae[_0xf693('0x46')],{'$or':_[_0xf693('0x2e')](_0x49dcae['attributes'],function(_0x2c214e){var _0x124c4e={};_0x124c4e[_0x2c214e]={'$like':'%'+_0x1deda4[_0xf693('0x3b')][_0xf693('0x2c')]+'%'};return _0x124c4e;})});}_0x49dcae=_['merge']({},_0x49dcae,_0x1deda4[_0xf693('0x4c')]);return _0x9db3dc['getLists'](_0x49dcae);}})[_0xf693('0x25')](function(_0x2f485b){if(_0x2f485b){_0x3276d4=_0x2f485b[_0xf693('0x41')];if(!_0x1deda4[_0xf693('0x3b')][_0xf693('0x42')](_0xf693('0x43'))){_0x49dcae[_0xf693('0x44')]=qs[_0xf693('0x44')](_0x1deda4['query']['limit']);_0x49dcae[_0xf693('0x1f')]=qs['offset'](_0x1deda4['query'][_0xf693('0x1f')]);}return _0x9db3dc[_0xf693('0x96')](_0x49dcae);}})[_0xf693('0x25')](function(_0x2e7c20){if(_0x2e7c20){return _0x2e7c20?{'count':_0x3276d4,'rows':_0x2e7c20}:null;}})[_0xf693('0x25')](respondWithResult(_0x2517d1,null))['catch'](handleError(_0x2517d1,null));};exports['addLists']=function(_0x38e23c,_0x139a20,_0x303470){var _0x560c9b,_0x28f0a7;return db[_0xf693('0x37')][_0xf693('0x32')]({'where':{'id':_0x38e23c[_0xf693('0x56')]['id']}})[_0xf693('0x25')](handleEntityNotFound(_0x139a20,null))['then'](function(_0x14fb07){if(_0x14fb07){_0x28f0a7=_0x14fb07;return _0x14fb07['addLists'](_0x38e23c[_0xf693('0x4e')][_0xf693('0x7a')],_[_0xf693('0x57')](_0x38e23c['body'],[_0xf693('0x7a'),'id'])||{});}return null;})[_0xf693('0x8d')](function(_0x11c009){var _0x4e1160;_0x560c9b=_0x11c009||[];var _0x3298cb=[];if(_0x11c009){for(var _0x8b1cd1=0x0;_0x8b1cd1<_0x11c009[_0xf693('0x41')];_0x8b1cd1+=0x1){var _0x4ffb55=_0x11c009[_0x8b1cd1]['get']({'plain':!![]});_0x28f0a7['dialCheckDuplicateType']=_0x38e23c['body'][_0xf693('0x98')]?_0x38e23c['body'][_0xf693('0x98')]:_0x28f0a7['dialCheckDuplicateType'];switch(_0x28f0a7[_0xf693('0x98')]){case _0xf693('0x99'):_0x4e1160=squel[_0xf693('0x9a')]()[_0xf693('0x9b')]('cm_hopper')[_0xf693('0x9c')]([_0xf693('0x9d'),'scheduledAt',_0xf693('0x9e'),_0xf693('0x9f'),_0xf693('0x5d'),_0xf693('0x58'),'updatedAt'],squel[_0xf693('0xa0')]()[_0xf693('0xa1')](_0xf693('0x9d'),_0xf693('0x9d'))['field'](_0xf693('0xa2'),_0xf693('0xa3'))['field']('id',_0xf693('0x9e'))[_0xf693('0xa1')](_0x4ffb55['CmListId'][_0xf693('0x82')](),_0xf693('0x9f'))['field'](_0x38e23c[_0xf693('0x56')]['id'][_0xf693('0x82')](),'VoiceQueueId')[_0xf693('0xa1')](_0xf693('0xa2'),_0xf693('0x58'))['field'](_0xf693('0xa2'),'updatedAt')['from'](_0xf693('0xa4'))[_0xf693('0x46')](_0xf693('0xa5'))[_0xf693('0x46')](_0xf693('0xa6'),_0x4ffb55[_0xf693('0xa7')][_0xf693('0x82')]())[_0xf693('0x46')](_0xf693('0xa8'))[_0xf693('0x46')](_0xf693('0xa9'),squel[_0xf693('0xa0')]()['field']('COALESCE(calleridnum,\x27\x27)')[_0xf693('0x7b')](_0xf693('0xaa'))[_0xf693('0x46')](_0xf693('0xab'),_0x38e23c['params']['id'][_0xf693('0x82')]()))[_0xf693('0x46')]('phone\x20NOT\x20IN\x20(?)',squel[_0xf693('0xa0')]()[_0xf693('0xa1')]('COALESCE(phone,\x27\x27)')[_0xf693('0x7b')](_0xf693('0xac'))[_0xf693('0x46')](_0xf693('0xab'),_0x38e23c[_0xf693('0x56')]['id'][_0xf693('0x82')]())))['toString']();break;case _0xf693('0xad'):_0x4e1160=squel[_0xf693('0x9a')]()[_0xf693('0x9b')](_0xf693('0xac'))[_0xf693('0x9c')]([_0xf693('0x9d'),'scheduledAt',_0xf693('0x9e'),_0xf693('0x9f'),'VoiceQueueId','createdAt','updatedAt'],squel[_0xf693('0xa0')]()[_0xf693('0xa1')](_0xf693('0x9d'),'phone')[_0xf693('0xa1')](_0xf693('0xa2'),'scheduledAt')[_0xf693('0xa1')]('id',_0xf693('0x9e'))[_0xf693('0xa1')](_0x4ffb55[_0xf693('0xa7')][_0xf693('0x82')](),'ListId')[_0xf693('0xa1')](_0x38e23c[_0xf693('0x56')]['id'][_0xf693('0x82')](),_0xf693('0x5d'))['field'](_0xf693('0xa2'),'createdAt')[_0xf693('0xa1')]('NOW()','updatedAt')['from']('cm_contacts')[_0xf693('0x46')](_0xf693('0xa5'))[_0xf693('0x46')](_0xf693('0xa6'),_0x4ffb55['CmListId'][_0xf693('0x82')]())[_0xf693('0x46')](_0xf693('0xa8'))[_0xf693('0x46')](_0xf693('0xa9'),squel['select']()[_0xf693('0xa1')](_0xf693('0xae'))[_0xf693('0x7b')](_0xf693('0xac'))[_0xf693('0x46')](_0xf693('0xab'),_0x38e23c['params']['id'][_0xf693('0x82')]())))[_0xf693('0x82')]();break;default:_0x4e1160=squel[_0xf693('0x9a')]()['into'](_0xf693('0xac'))['fromQuery']([_0xf693('0x9d'),_0xf693('0xa3'),_0xf693('0x9e'),_0xf693('0x9f'),_0xf693('0x5d'),'createdAt',_0xf693('0x59')],squel[_0xf693('0xa0')]()[_0xf693('0xa1')]('phone',_0xf693('0x9d'))[_0xf693('0xa1')](_0xf693('0xa2'),_0xf693('0xa3'))['field']('id',_0xf693('0x9e'))[_0xf693('0xa1')](_0x4ffb55[_0xf693('0xa7')]['toString'](),_0xf693('0x9f'))['field'](_0x38e23c['params']['id'][_0xf693('0x82')](),_0xf693('0x5d'))[_0xf693('0xa1')](_0xf693('0xa2'),_0xf693('0x58'))[_0xf693('0xa1')]('NOW()',_0xf693('0x59'))['from']('cm_contacts')[_0xf693('0x46')](_0xf693('0xa5'))[_0xf693('0x46')]('ListId\x20=\x20?',_0x4ffb55[_0xf693('0xa7')][_0xf693('0x82')]())[_0xf693('0x46')]('phone\x20IS\x20NOT\x20NULL'))[_0xf693('0x82')]();}_0x3298cb['push'](db[_0xf693('0x71')][_0xf693('0x3b')](_0x4e1160));}return BPromise[_0xf693('0x86')](_0x3298cb);}})[_0xf693('0x25')](function(){return _0x560c9b;})[_0xf693('0x25')](respondWithResult(_0x139a20,null))[_0xf693('0x4a')](handleError(_0x139a20,null));};exports[_0xf693('0xaf')]=function(_0x120887,_0x170f31,_0x277aab){return db[_0xf693('0x37')][_0xf693('0x32')]({'where':{'id':_0x120887[_0xf693('0x56')]['id']}})[_0xf693('0x25')](handleEntityNotFound(_0x170f31,null))[_0xf693('0x25')](function(_0x298bf6){if(_0x298bf6){return _0x298bf6[_0xf693('0xaf')](_0x120887['query'][_0xf693('0x7a')]);}})['then'](function(_0x5374ab){if(_0x5374ab){return db[_0xf693('0x5c')][_0xf693('0x26')]({'where':{'ListId':_0x120887[_0xf693('0x3b')][_0xf693('0x7a')],'VoiceQueueId':_0x120887['params']['id']}})[_0xf693('0x25')](function(){return _0x5374ab;});}})[_0xf693('0x25')](respondWithStatusCode(_0x170f31,null))[_0xf693('0x4a')](handleError(_0x170f31,null));};exports[_0xf693('0xb0')]=function(_0x5a60af,_0xe0d9b,_0x3fc36d){var _0x3717da={};var _0x9f4d35={};var _0x404909;var _0x3e78b0;return db[_0xf693('0x37')]['findOne']({'where':{'id':_0x5a60af[_0xf693('0x56')]['id']}})['then'](handleEntityNotFound(_0xe0d9b,null))[_0xf693('0x25')](function(_0x2fda49){if(_0x2fda49){_0x404909=_0x2fda49;_0x9f4d35[_0xf693('0x3a')]=_['keys'](db[_0xf693('0x97')][_0xf693('0x38')]);_0x9f4d35[_0xf693('0x3b')]=_['keys'](_0x5a60af['query']);_0x9f4d35[_0xf693('0x3d')]=_['intersection'](_0x9f4d35[_0xf693('0x3a')],_0x9f4d35[_0xf693('0x3b')]);_0x3717da[_0xf693('0x3f')]=_[_0xf693('0x3e')](_0x9f4d35[_0xf693('0x3a')],qs[_0xf693('0x40')](_0x5a60af[_0xf693('0x3b')][_0xf693('0x40')]));_0x3717da['attributes']=_0x3717da[_0xf693('0x3f')]['length']?_0x3717da[_0xf693('0x3f')]:_0x9f4d35[_0xf693('0x3a')];_0x3717da['order']=qs[_0xf693('0x45')](_0x5a60af[_0xf693('0x3b')][_0xf693('0x45')]);_0x3717da['where']=qs[_0xf693('0x3d')](_[_0xf693('0x47')](_0x5a60af[_0xf693('0x3b')],_0x9f4d35[_0xf693('0x3d')]));if(_0x5a60af[_0xf693('0x3b')]['filter']){_0x3717da[_0xf693('0x46')]=_['merge'](_0x3717da['where'],{'$or':_[_0xf693('0x2e')](_0x3717da[_0xf693('0x3f')],function(_0x5235c0){var _0x55d4b4={};_0x55d4b4[_0x5235c0]={'$like':'%'+_0x5a60af[_0xf693('0x3b')]['filter']+'%'};return _0x55d4b4;})});}_0x3717da=_[_0xf693('0x48')]({},_0x3717da,_0x5a60af[_0xf693('0x4c')]);return _0x404909[_0xf693('0xb0')](_0x3717da);}})['then'](function(_0x55a511){if(_0x55a511){_0x3e78b0=_0x55a511[_0xf693('0x41')];if(!_0x5a60af[_0xf693('0x3b')][_0xf693('0x42')](_0xf693('0x43'))){_0x3717da[_0xf693('0x44')]=qs[_0xf693('0x44')](_0x5a60af[_0xf693('0x3b')]['limit']);_0x3717da['offset']=qs[_0xf693('0x1f')](_0x5a60af[_0xf693('0x3b')][_0xf693('0x1f')]);}return _0x404909[_0xf693('0xb0')](_0x3717da);}})[_0xf693('0x25')](function(_0x33d193){if(_0x33d193){return _0x33d193?{'count':_0x3e78b0,'rows':_0x33d193}:null;}})[_0xf693('0x25')](respondWithResult(_0xe0d9b,null))[_0xf693('0x4a')](handleError(_0xe0d9b,null));};exports['addBlackLists']=function(_0x3d4e42,_0x10ae59,_0x1134c7){var _0x31075b,_0x3a9661;return db[_0xf693('0x37')]['find']({'where':{'id':_0x3d4e42[_0xf693('0x56')]['id']}})[_0xf693('0x25')](handleEntityNotFound(_0x10ae59,null))[_0xf693('0x25')](function(_0x4bd28e){if(_0x4bd28e){_0x3a9661=_0x4bd28e;return _0x4bd28e[_0xf693('0xb1')](_0x3d4e42[_0xf693('0x4e')][_0xf693('0x7a')],_[_0xf693('0x57')](_0x3d4e42[_0xf693('0x4e')],[_0xf693('0x7a'),'id'])||{});}return null;})[_0xf693('0x8d')](function(_0x158e65){var _0x5eff9e;_0x31075b=_0x158e65||[];var _0x5be5e0=[];if(_0x158e65){for(var _0x5ad3a0=0x0;_0x5ad3a0<_0x158e65[_0xf693('0x41')];_0x5ad3a0+=0x1){var _0x2f887d=_0x158e65[_0x5ad3a0][_0xf693('0x27')]({'plain':!![]});_0x5eff9e=squel['insert']()['into'](_0xf693('0xb2'))[_0xf693('0x9c')]([_0xf693('0x9d'),_0xf693('0x9e'),_0xf693('0x9f'),_0xf693('0x5d'),'createdAt',_0xf693('0x59')],squel['select']()[_0xf693('0xa1')](_0xf693('0x9d'),'phone')[_0xf693('0xa1')]('id','ContactId')[_0xf693('0xa1')](_0x2f887d[_0xf693('0xa7')][_0xf693('0x82')](),'ListId')[_0xf693('0xa1')](_0x3d4e42[_0xf693('0x56')]['id'][_0xf693('0x82')](),'VoiceQueueId')[_0xf693('0xa1')](_0xf693('0xa2'),'createdAt')[_0xf693('0xa1')](_0xf693('0xa2'),'updatedAt')[_0xf693('0x7b')]('cm_contacts')[_0xf693('0x46')](_0xf693('0xa5'))['where']('ListId\x20=\x20?',_0x2f887d['CmListId'][_0xf693('0x82')]())['where'](_0xf693('0xa8')))[_0xf693('0x82')]();_0x5be5e0[_0xf693('0x81')](db[_0xf693('0x71')][_0xf693('0x3b')](_0x5eff9e));}return BPromise['all'](_0x5be5e0);}})[_0xf693('0x25')](function(){return _0x31075b;})[_0xf693('0x25')](respondWithResult(_0x10ae59,null))[_0xf693('0x4a')](handleError(_0x10ae59,null));};exports[_0xf693('0xb3')]=function(_0x449fdb,_0x4c7633,_0x31883e){return db[_0xf693('0x37')][_0xf693('0x32')]({'where':{'id':_0x449fdb[_0xf693('0x56')]['id']}})['then'](handleEntityNotFound(_0x4c7633,null))[_0xf693('0x25')](function(_0x1e4fa0){if(_0x1e4fa0){return _0x1e4fa0[_0xf693('0xb3')](_0x449fdb[_0xf693('0x3b')]['ids']);}})['then'](function(_0x4137d5){if(_0x4137d5){return db[_0xf693('0x66')]['destroy']({'where':{'ListId':_0x449fdb['query']['ids'],'VoiceQueueId':_0x449fdb['params']['id']}})[_0xf693('0x25')](function(){return _0x4137d5;});}})[_0xf693('0x25')](respondWithStatusCode(_0x4c7633,null))['catch'](handleError(_0x4c7633,null));}; \ No newline at end of file +var _0xb4e2=['team_has_voice_queues','join','user_has_teams','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','ids','isEmpty','removeAgents','userVoiceQueue:remove','addAgents','omit','spread','userVoiceQueue:save','isArray','getAgents','getMembers','getLists','CmList','dialCheckDuplicateType','always','into','cm_hopper','fromQuery','phone','ContactId','ListId','scheduledAt','CmListId','toString','NOW()','from','cm_contacts','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','onlyIfOpen','insert','deletedAt\x20IS\x20NULL','removeLists','getBlackLists','addBlackLists','removeBlackLists','html-pdf','zip-dir','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./voiceQueue.socket','register','status','end','count','offset','limit','set','json','apply','reject','save','update','get','inbound','QueueCampaigns','outbound','filter','ignore','map','value','type','find','destroy','then','sendStatus','error','stack','name','send','index','VoiceQueue','rawAttributes','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','merge','includeAll','include','findAll','rows','catch','show','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','VoiceQueues','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','createdAt','updatedAt','autoAssociation','getHoppers','CmHopper','where','VoiceQueueId','getHopperHistories','findOne','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','addTeams','teams','Agents','online','voicePause','interface','flatMap','forEach','penalty','sequelize','transaction','each','UserVoiceQueue','UserVoiceQueueRt','upsert','isNil','format','SIP/%s','User','select','field','tq.TeamId'];(function(_0x245a7d,_0x253c2f){var _0x24789d=function(_0x189e60){while(--_0x189e60){_0x245a7d['push'](_0x245a7d['shift']());}};_0x24789d(++_0x253c2f);}(_0xb4e2,0x1aa));var _0x2b4e=function(_0x510de5,_0x28d768){_0x510de5=_0x510de5-0x0;var _0x5b9c00=_0xb4e2[_0x510de5];return _0x5b9c00;};'use strict';var pdf=require(_0x2b4e('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x2b4e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x2b4e('0x2'));var Mustache=require(_0x2b4e('0x3'));var util=require(_0x2b4e('0x4'));var path=require(_0x2b4e('0x5'));var sox=require(_0x2b4e('0x6'));var csv=require(_0x2b4e('0x7'));var ejs=require(_0x2b4e('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x2b4e('0x9'));var crypto=require(_0x2b4e('0xa'));var jsforce=require(_0x2b4e('0xb'));var deskjs=require(_0x2b4e('0xc'));var toCsv=require(_0x2b4e('0x7'));var querystring=require(_0x2b4e('0xd'));var Papa=require(_0x2b4e('0xe'));var Redis=require(_0x2b4e('0xf'));var authService=require(_0x2b4e('0x10'));var qs=require(_0x2b4e('0x11'));var as=require(_0x2b4e('0x12'));var hardwareService=require(_0x2b4e('0x13'));var logger=require(_0x2b4e('0x14'))(_0x2b4e('0x15'));var utils=require('../../config/utils');var config=require(_0x2b4e('0x16'));var db=require(_0x2b4e('0x17'))['db'];config[_0x2b4e('0x18')]=_[_0x2b4e('0x19')](config['redis'],{'host':_0x2b4e('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2b4e('0x18')]));require(_0x2b4e('0x1b'))[_0x2b4e('0x1c')](socket);function respondWithStatusCode(_0x17d4cd,_0x161666){_0x161666=_0x161666||0xcc;return function(_0x94c6c8){if(_0x94c6c8){return _0x17d4cd['sendStatus'](_0x161666);}return _0x17d4cd[_0x2b4e('0x1d')](_0x161666)[_0x2b4e('0x1e')]();};}function respondWithResult(_0x38f5ae,_0x4d329f){_0x4d329f=_0x4d329f||0xc8;return function(_0x1d39af){if(_0x1d39af){return _0x38f5ae[_0x2b4e('0x1d')](_0x4d329f)['json'](_0x1d39af);}};}function respondWithFilteredResult(_0x343076,_0x58dd44){return function(_0x3d9c2d){if(_0x3d9c2d){var _0x30b754=_0x3d9c2d[_0x2b4e('0x1f')],_0xb8b550=_0x58dd44[_0x2b4e('0x20')],_0x2b9480=_0x58dd44[_0x2b4e('0x20')]+_0x58dd44[_0x2b4e('0x21')],_0x275a55;if(_0x2b9480>=_0x30b754){_0x2b9480=_0x30b754;_0x275a55=0xc8;}else{_0x275a55=0xce;}_0x343076['status'](_0x275a55);return _0x343076[_0x2b4e('0x22')]('Content-Range',_0xb8b550+'-'+_0x2b9480+'/'+_0x30b754)[_0x2b4e('0x23')](_0x3d9c2d);}return null;};}function patchUpdates(_0x1bb11c){return function(_0x32c837){try{jsonpatch[_0x2b4e('0x24')](_0x32c837,_0x1bb11c,!![]);}catch(_0x4a4d1d){return BPromise[_0x2b4e('0x25')](_0x4a4d1d);}return _0x32c837[_0x2b4e('0x26')]();};}function saveUpdates(_0x63c129,_0x4ce70f){return function(_0x1b0b8f){if(_0x1b0b8f){return _0x1b0b8f[_0x2b4e('0x27')](_0x63c129)['then'](function(_0x12c511){return _0x12c511;});}return null;};}function removeEntity(_0x5491df,_0x26c36a){return function(_0x3462cd){if(_0x3462cd){return _0x3462cd['destroy']()['then'](function(){var _0xccf867=_0x3462cd[_0x2b4e('0x28')]({'plain':!![]});var _0x2eb2e2=[{'name':'VoiceQueues','value':_0x2b4e('0x29'),'ignore':![]},{'name':_0x2b4e('0x2a'),'value':_0x2b4e('0x2b'),'ignore':![]}];var _0x2db26f=_(_0x2eb2e2)[_0x2b4e('0x2c')](_0x2b4e('0x2d'))[_0x2b4e('0x2e')](_0x2b4e('0x2f'))[_0x2b4e('0x2f')]();if(_['includes'](_0x2db26f,_0xccf867[_0x2b4e('0x30')])){return;}var _0x2776fb=_[_0x2b4e('0x31')](_0x2eb2e2,[_0x2b4e('0x2f'),_0xccf867['type']])['name'];return db['UserProfileResource'][_0x2b4e('0x32')]({'where':{'type':_0x2776fb,'resourceId':_0xccf867['id']}})[_0x2b4e('0x33')](function(){return _0x3462cd;});})[_0x2b4e('0x33')](function(){_0x5491df['status'](0xcc)[_0x2b4e('0x1e')]();});}};}function handleEntityNotFound(_0x5771d7,_0x596fb6){return function(_0x31fc89){if(!_0x31fc89){_0x5771d7[_0x2b4e('0x34')](0x194);}return _0x31fc89;};}function handleError(_0x225a5a,_0x19618a){_0x19618a=_0x19618a||0x1f4;return function(_0x3ba601){logger[_0x2b4e('0x35')](_0x3ba601[_0x2b4e('0x36')]);if(_0x3ba601['name']){delete _0x3ba601[_0x2b4e('0x37')];}_0x225a5a[_0x2b4e('0x1d')](_0x19618a)[_0x2b4e('0x38')](_0x3ba601);};}exports[_0x2b4e('0x39')]=function(_0x28f109,_0x5102ce){var _0x1c10f3={},_0x2f5111={},_0x17d7b4={'count':0x0,'rows':[]};var _0x3bf19c=_['map'](db[_0x2b4e('0x3a')][_0x2b4e('0x3b')],function(_0x58b099){return{'name':_0x58b099['fieldName'],'type':_0x58b099[_0x2b4e('0x30')][_0x2b4e('0x3c')]};});_0x2f5111[_0x2b4e('0x3d')]=_['map'](_0x3bf19c,_0x2b4e('0x37'));_0x2f5111[_0x2b4e('0x3e')]=_[_0x2b4e('0x3f')](_0x28f109[_0x2b4e('0x3e')]);_0x2f5111['filters']=_['intersection'](_0x2f5111[_0x2b4e('0x3d')],_0x2f5111[_0x2b4e('0x3e')]);_0x1c10f3[_0x2b4e('0x40')]=_[_0x2b4e('0x41')](_0x2f5111[_0x2b4e('0x3d')],qs[_0x2b4e('0x42')](_0x28f109[_0x2b4e('0x3e')]['fields']));_0x1c10f3['attributes']=_0x1c10f3['attributes'][_0x2b4e('0x43')]?_0x1c10f3[_0x2b4e('0x40')]:_0x2f5111[_0x2b4e('0x3d')];if(!_0x28f109[_0x2b4e('0x3e')][_0x2b4e('0x44')](_0x2b4e('0x45'))){_0x1c10f3['limit']=qs['limit'](_0x28f109[_0x2b4e('0x3e')]['limit']);_0x1c10f3[_0x2b4e('0x20')]=qs[_0x2b4e('0x20')](_0x28f109[_0x2b4e('0x3e')][_0x2b4e('0x20')]);}_0x1c10f3[_0x2b4e('0x46')]=qs['sort'](_0x28f109[_0x2b4e('0x3e')][_0x2b4e('0x47')]);_0x1c10f3['where']=qs[_0x2b4e('0x48')](_[_0x2b4e('0x49')](_0x28f109[_0x2b4e('0x3e')],_0x2f5111[_0x2b4e('0x48')]));if(_0x28f109[_0x2b4e('0x3e')][_0x2b4e('0x2c')]){_0x1c10f3['where']=_[_0x2b4e('0x4a')](_0x1c10f3['where'],{'$or':_[_0x2b4e('0x2e')](_0x3bf19c,function(_0x5706f2){if(_0x5706f2[_0x2b4e('0x30')]!=='VIRTUAL'){var _0x420f88={};_0x420f88[_0x5706f2[_0x2b4e('0x37')]]={'$like':'%'+_0x28f109[_0x2b4e('0x3e')]['filter']+'%'};return _0x420f88;}})});}_0x1c10f3=_[_0x2b4e('0x4a')]({},_0x1c10f3,_0x28f109['options']);var _0xa1390d={'where':_0x1c10f3['where']};return db['VoiceQueue'][_0x2b4e('0x1f')](_0xa1390d)[_0x2b4e('0x33')](function(_0x4fd81a){_0x17d7b4['count']=_0x4fd81a;if(_0x28f109[_0x2b4e('0x3e')][_0x2b4e('0x4b')]){_0x1c10f3[_0x2b4e('0x4c')]=[{'all':!![]}];}return db[_0x2b4e('0x3a')][_0x2b4e('0x4d')](_0x1c10f3);})[_0x2b4e('0x33')](function(_0x364081){_0x17d7b4[_0x2b4e('0x4e')]=_0x364081;return _0x17d7b4;})[_0x2b4e('0x33')](respondWithFilteredResult(_0x5102ce,_0x1c10f3))[_0x2b4e('0x4f')](handleError(_0x5102ce,null));};exports[_0x2b4e('0x50')]=function(_0x2d6087,_0x12c740){var _0x38cea6={'raw':![],'where':{'id':_0x2d6087['params']['id']}},_0x4c5977={};_0x4c5977[_0x2b4e('0x3d')]=_[_0x2b4e('0x3f')](db[_0x2b4e('0x3a')][_0x2b4e('0x3b')]);_0x4c5977[_0x2b4e('0x3e')]=_[_0x2b4e('0x3f')](_0x2d6087['query']);_0x4c5977[_0x2b4e('0x48')]=_[_0x2b4e('0x41')](_0x4c5977['model'],_0x4c5977['query']);_0x38cea6[_0x2b4e('0x40')]=_[_0x2b4e('0x41')](_0x4c5977[_0x2b4e('0x3d')],qs['fields'](_0x2d6087[_0x2b4e('0x3e')][_0x2b4e('0x42')]));_0x38cea6['attributes']=_0x38cea6[_0x2b4e('0x40')]['length']?_0x38cea6['attributes']:_0x4c5977[_0x2b4e('0x3d')];if(_0x2d6087[_0x2b4e('0x3e')]['includeAll']){_0x38cea6[_0x2b4e('0x4c')]=[{'all':!![]}];}_0x38cea6=_[_0x2b4e('0x4a')]({},_0x38cea6,_0x2d6087[_0x2b4e('0x51')]);return db[_0x2b4e('0x3a')][_0x2b4e('0x31')](_0x38cea6)['then'](handleEntityNotFound(_0x12c740,null))[_0x2b4e('0x33')](respondWithResult(_0x12c740,null))[_0x2b4e('0x4f')](handleError(_0x12c740,null));};exports['create']=function(_0x1c6a2c,_0x47b776){return db[_0x2b4e('0x3a')][_0x2b4e('0x52')](_0x1c6a2c[_0x2b4e('0x53')],{})[_0x2b4e('0x33')](function(_0x52ba96){var _0x48dc56=_0x1c6a2c[_0x2b4e('0x54')][_0x2b4e('0x28')]({'plain':!![]});if(!_0x48dc56)throw new Error(_0x2b4e('0x55'));if(_0x48dc56[_0x2b4e('0x56')]==='user'){var _0x39d76f=_0x52ba96[_0x2b4e('0x28')]({'plain':!![]});var _0x40d8d0=[{'name':_0x2b4e('0x57'),'value':_0x2b4e('0x29')},{'name':_0x2b4e('0x2a'),'value':_0x2b4e('0x2b')}];var _0x19c058=_['find'](_0x40d8d0,[_0x2b4e('0x2f'),_0x39d76f[_0x2b4e('0x30')]])[_0x2b4e('0x37')];return db[_0x2b4e('0x58')]['find']({'where':{'name':_0x19c058,'userProfileId':_0x48dc56[_0x2b4e('0x59')]},'raw':!![]})['then'](function(_0x764ba3){if(_0x764ba3&&_0x764ba3['autoAssociation']===0x0){return db[_0x2b4e('0x5a')][_0x2b4e('0x52')]({'name':_0x39d76f[_0x2b4e('0x37')],'resourceId':_0x39d76f['id'],'type':_0x764ba3['name'],'sectionId':_0x764ba3['id']},{})[_0x2b4e('0x33')](function(){return _0x52ba96;});}else{return _0x52ba96;}})[_0x2b4e('0x4f')](function(_0x1c7f39){logger['error'](_0x2b4e('0x5b'),_0x1c7f39);throw _0x1c7f39;});}return _0x52ba96;})[_0x2b4e('0x33')](respondWithResult(_0x47b776,0xc9))[_0x2b4e('0x4f')](handleError(_0x47b776,null));};exports[_0x2b4e('0x5c')]=function(_0xb3784f,_0x3dcfa9){var _0x289b84={'where':{'id':_0xb3784f[_0x2b4e('0x5d')]['id']}},_0x45a4a1={};_0x45a4a1['model']=_[_0x2b4e('0x3f')](db[_0x2b4e('0x3a')][_0x2b4e('0x3b')]);_0x289b84[_0x2b4e('0x40')]=_[_0x2b4e('0x41')](_0x45a4a1[_0x2b4e('0x3d')],qs[_0x2b4e('0x42')](_0xb3784f[_0x2b4e('0x3e')][_0x2b4e('0x42')]));_0x289b84['attributes']=_0x289b84[_0x2b4e('0x40')]['length']?_0x289b84[_0x2b4e('0x40')]:_0x45a4a1[_0x2b4e('0x3d')];if(_0xb3784f[_0x2b4e('0x3e')][_0x2b4e('0x4b')]){_0x289b84[_0x2b4e('0x4c')]=[{'all':!![]}];}_0x289b84=_[_0x2b4e('0x4a')]({},_0x289b84,_0xb3784f[_0x2b4e('0x51')]);return db['VoiceQueue']['find'](_0x289b84)[_0x2b4e('0x33')](handleEntityNotFound(_0x3dcfa9,null))['then'](function(_0x3dbef0){if(_0x3dbef0){var _0x23a08e=_0x3dbef0[_0x2b4e('0x28')]({'plain':!![]});_0x23a08e=qs['omit'](_0x23a08e,['id',_0x2b4e('0x5e'),'updatedAt']);_0xb3784f[_0x2b4e('0x53')]=_['omit'](_0xb3784f[_0x2b4e('0x53')],['id',_0x2b4e('0x5e'),_0x2b4e('0x5f')]);return db[_0x2b4e('0x3a')][_0x2b4e('0x52')](_['merge'](_0x23a08e,_0xb3784f['body']),{'include':_0xb3784f['query']['includeAll']?[{'all':!![]}]:undefined})[_0x2b4e('0x33')](function(_0x192d43){var _0x46b1ac=_0xb3784f[_0x2b4e('0x54')][_0x2b4e('0x28')]({'plain':!![]});if(!_0x46b1ac)throw new Error(_0x2b4e('0x55'));if(_0x46b1ac[_0x2b4e('0x56')]===_0x2b4e('0x54')){var _0x566ecd=_0x192d43[_0x2b4e('0x28')]({'plain':!![]});var _0x4e7445=[{'name':_0x2b4e('0x57'),'value':_0x2b4e('0x29')},{'name':_0x2b4e('0x2a'),'value':'outbound'}];var _0x5b378d=_[_0x2b4e('0x31')](_0x4e7445,[_0x2b4e('0x2f'),_0x566ecd['type']])[_0x2b4e('0x37')];return db[_0x2b4e('0x58')]['find']({'where':{'name':_0x5b378d,'userProfileId':_0x46b1ac[_0x2b4e('0x59')]},'raw':!![]})['then'](function(_0x4db31e){if(_0x4db31e&&_0x4db31e[_0x2b4e('0x60')]===0x0){return db[_0x2b4e('0x5a')][_0x2b4e('0x52')]({'name':_0x566ecd[_0x2b4e('0x37')],'resourceId':_0x566ecd['id'],'type':_0x4db31e[_0x2b4e('0x37')],'sectionId':_0x4db31e['id']},{})[_0x2b4e('0x33')](function(){return _0x192d43;});}else{return _0x192d43;}})[_0x2b4e('0x4f')](function(_0x1f001d){logger[_0x2b4e('0x35')](_0x2b4e('0x5b'),_0x1f001d);throw _0x1f001d;});}return _0x192d43;});}})['then'](respondWithResult(_0x3dcfa9,0xc9))[_0x2b4e('0x4f')](handleError(_0x3dcfa9,null));};exports[_0x2b4e('0x27')]=function(_0x4bc96c,_0x4192f7){if(_0x4bc96c[_0x2b4e('0x53')]['id']){delete _0x4bc96c[_0x2b4e('0x53')]['id'];}return db[_0x2b4e('0x3a')][_0x2b4e('0x31')]({'where':{'id':_0x4bc96c[_0x2b4e('0x5d')]['id']}})[_0x2b4e('0x33')](handleEntityNotFound(_0x4192f7,null))['then'](saveUpdates(_0x4bc96c[_0x2b4e('0x53')],null))[_0x2b4e('0x33')](respondWithResult(_0x4192f7,null))[_0x2b4e('0x4f')](handleError(_0x4192f7,null));};exports[_0x2b4e('0x32')]=function(_0x334caf,_0x567c56){return db[_0x2b4e('0x3a')][_0x2b4e('0x31')]({'where':{'id':_0x334caf[_0x2b4e('0x5d')]['id']}})[_0x2b4e('0x33')](handleEntityNotFound(_0x567c56,null))[_0x2b4e('0x33')](removeEntity(_0x567c56,null))[_0x2b4e('0x4f')](handleError(_0x567c56,null));};exports[_0x2b4e('0x61')]=function(_0x403549,_0x4771aa,_0x543a9e){var _0x44769d={'raw':![],'where':{}};var _0x24c703={};var _0x6c6663={'count':0x0,'rows':[]};return db[_0x2b4e('0x3a')]['findOne']({'where':{'id':_0x403549[_0x2b4e('0x5d')]['id']}})[_0x2b4e('0x33')](handleEntityNotFound(_0x4771aa,null))['then'](function(_0x28f27b){if(_0x28f27b){_0x24c703['model']=_[_0x2b4e('0x3f')](db[_0x2b4e('0x62')]['rawAttributes']);_0x24c703['query']=_['keys'](_0x403549[_0x2b4e('0x3e')]);_0x24c703[_0x2b4e('0x48')]=_[_0x2b4e('0x41')](_0x24c703['model'],_0x24c703[_0x2b4e('0x3e')]);_0x44769d['attributes']=_[_0x2b4e('0x41')](_0x24c703[_0x2b4e('0x3d')],qs[_0x2b4e('0x42')](_0x403549[_0x2b4e('0x3e')][_0x2b4e('0x42')]));_0x44769d[_0x2b4e('0x40')]=_0x44769d[_0x2b4e('0x40')]['length']?_0x44769d[_0x2b4e('0x40')]:_0x24c703[_0x2b4e('0x3d')];if(!_0x403549[_0x2b4e('0x3e')][_0x2b4e('0x44')](_0x2b4e('0x45'))){_0x44769d[_0x2b4e('0x21')]=qs[_0x2b4e('0x21')](_0x403549[_0x2b4e('0x3e')]['limit']);_0x44769d[_0x2b4e('0x20')]=qs[_0x2b4e('0x20')](_0x403549[_0x2b4e('0x3e')][_0x2b4e('0x20')]);}_0x44769d[_0x2b4e('0x46')]=qs[_0x2b4e('0x47')](_0x403549[_0x2b4e('0x3e')]['sort']);_0x44769d[_0x2b4e('0x63')]=qs[_0x2b4e('0x48')](_[_0x2b4e('0x49')](_0x403549[_0x2b4e('0x3e')],_0x24c703[_0x2b4e('0x48')]));_0x44769d['where'][_0x2b4e('0x64')]=_0x28f27b['id'];if(_0x403549[_0x2b4e('0x3e')]['filter']){_0x44769d['where']=_[_0x2b4e('0x4a')](_0x44769d[_0x2b4e('0x63')],{'$or':_['map'](_0x44769d['attributes'],function(_0xd65ff5){var _0x31b168={};_0x31b168[_0xd65ff5]={'$like':'%'+_0x403549['query']['filter']+'%'};return _0x31b168;})});}_0x44769d=_['merge']({},_0x44769d,_0x403549[_0x2b4e('0x51')]);return db[_0x2b4e('0x62')][_0x2b4e('0x1f')]({'where':_0x44769d[_0x2b4e('0x63')]})[_0x2b4e('0x33')](function(_0x2c3624){_0x6c6663[_0x2b4e('0x1f')]=_0x2c3624;if(_0x403549['query'][_0x2b4e('0x4b')]){_0x44769d['include']=[{'all':!![]}];}return db['CmHopper'][_0x2b4e('0x4d')](_0x44769d);})[_0x2b4e('0x33')](function(_0x348d31){_0x6c6663['rows']=_0x348d31;return _0x6c6663;});}})[_0x2b4e('0x33')](respondWithFilteredResult(_0x4771aa,_0x44769d))[_0x2b4e('0x4f')](handleError(_0x4771aa,null));};exports[_0x2b4e('0x65')]=function(_0x315d9e,_0xf61325,_0x57df69){var _0x58031e={'raw':!![],'where':{}};var _0x522523={};var _0x412e8f={'count':0x0,'rows':[]};return db[_0x2b4e('0x3a')][_0x2b4e('0x66')]({'where':{'id':_0x315d9e['params']['id']}})['then'](handleEntityNotFound(_0xf61325,null))[_0x2b4e('0x33')](function(_0x5eaa39){if(_0x5eaa39){_0x522523['model']=_[_0x2b4e('0x3f')](db[_0x2b4e('0x67')][_0x2b4e('0x3b')]);_0x522523[_0x2b4e('0x3e')]=_[_0x2b4e('0x3f')](_0x315d9e[_0x2b4e('0x3e')]);_0x522523[_0x2b4e('0x48')]=_[_0x2b4e('0x41')](_0x522523[_0x2b4e('0x3d')],_0x522523[_0x2b4e('0x3e')]);_0x58031e[_0x2b4e('0x40')]=_[_0x2b4e('0x41')](_0x522523[_0x2b4e('0x3d')],qs[_0x2b4e('0x42')](_0x315d9e[_0x2b4e('0x3e')][_0x2b4e('0x42')]));_0x58031e['attributes']=_0x58031e[_0x2b4e('0x40')][_0x2b4e('0x43')]?_0x58031e['attributes']:_0x522523[_0x2b4e('0x3d')];if(!_0x315d9e[_0x2b4e('0x3e')]['hasOwnProperty'](_0x2b4e('0x45'))){_0x58031e[_0x2b4e('0x21')]=qs[_0x2b4e('0x21')](_0x315d9e[_0x2b4e('0x3e')][_0x2b4e('0x21')]);_0x58031e[_0x2b4e('0x20')]=qs[_0x2b4e('0x20')](_0x315d9e[_0x2b4e('0x3e')][_0x2b4e('0x20')]);}_0x58031e['order']=qs['sort'](_0x315d9e['query'][_0x2b4e('0x47')]);_0x58031e[_0x2b4e('0x63')]=qs[_0x2b4e('0x48')](_[_0x2b4e('0x49')](_0x315d9e[_0x2b4e('0x3e')],_0x522523[_0x2b4e('0x48')]));_0x58031e['where'][_0x2b4e('0x64')]=_0x5eaa39['id'];if(_0x315d9e[_0x2b4e('0x3e')][_0x2b4e('0x2c')]){_0x58031e[_0x2b4e('0x63')]=_['merge'](_0x58031e[_0x2b4e('0x63')],{'$or':_[_0x2b4e('0x2e')](_0x58031e['attributes'],function(_0x5eaa5d){var _0x5e08f2={};_0x5e08f2[_0x5eaa5d]={'$like':'%'+_0x315d9e[_0x2b4e('0x3e')][_0x2b4e('0x2c')]+'%'};return _0x5e08f2;})});}_0x58031e=_[_0x2b4e('0x4a')]({},_0x58031e,_0x315d9e[_0x2b4e('0x51')]);return db['CmHopperHistory']['count']({'where':_0x58031e['where']})[_0x2b4e('0x33')](function(_0x56e049){_0x412e8f[_0x2b4e('0x1f')]=_0x56e049;if(_0x315d9e['query'][_0x2b4e('0x4b')]){_0x58031e['include']=[{'all':!![]}];}return db[_0x2b4e('0x67')][_0x2b4e('0x4d')](_0x58031e);})[_0x2b4e('0x33')](function(_0x501beb){_0x412e8f[_0x2b4e('0x4e')]=_0x501beb;return _0x412e8f;});}})[_0x2b4e('0x33')](respondWithFilteredResult(_0xf61325,_0x58031e))[_0x2b4e('0x4f')](handleError(_0xf61325,null));};exports[_0x2b4e('0x68')]=function(_0x5f3381,_0x494861,_0x3de1d7){var _0x52599d={'raw':!![],'where':{}};var _0x241df4={};var _0x34ef2f={'count':0x0,'rows':[]};return db[_0x2b4e('0x3a')][_0x2b4e('0x66')]({'where':{'id':_0x5f3381[_0x2b4e('0x5d')]['id']}})['then'](handleEntityNotFound(_0x494861,null))[_0x2b4e('0x33')](function(_0x5112ba){if(_0x5112ba){_0x241df4[_0x2b4e('0x3d')]=_[_0x2b4e('0x3f')](db['CmHopperFinal'][_0x2b4e('0x3b')]);_0x241df4[_0x2b4e('0x3e')]=_['keys'](_0x5f3381[_0x2b4e('0x3e')]);_0x241df4[_0x2b4e('0x48')]=_['intersection'](_0x241df4[_0x2b4e('0x3d')],_0x241df4[_0x2b4e('0x3e')]);_0x52599d[_0x2b4e('0x40')]=_[_0x2b4e('0x41')](_0x241df4[_0x2b4e('0x3d')],qs['fields'](_0x5f3381[_0x2b4e('0x3e')][_0x2b4e('0x42')]));_0x52599d[_0x2b4e('0x40')]=_0x52599d[_0x2b4e('0x40')][_0x2b4e('0x43')]?_0x52599d['attributes']:_0x241df4['model'];if(!_0x5f3381[_0x2b4e('0x3e')][_0x2b4e('0x44')]('nolimit')){_0x52599d[_0x2b4e('0x21')]=qs[_0x2b4e('0x21')](_0x5f3381[_0x2b4e('0x3e')][_0x2b4e('0x21')]);_0x52599d[_0x2b4e('0x20')]=qs['offset'](_0x5f3381[_0x2b4e('0x3e')][_0x2b4e('0x20')]);}_0x52599d[_0x2b4e('0x46')]=qs[_0x2b4e('0x47')](_0x5f3381['query'][_0x2b4e('0x47')]);_0x52599d[_0x2b4e('0x63')]=qs[_0x2b4e('0x48')](_[_0x2b4e('0x49')](_0x5f3381['query'],_0x241df4[_0x2b4e('0x48')]));_0x52599d['where'][_0x2b4e('0x64')]=_0x5112ba['id'];if(_0x5f3381[_0x2b4e('0x3e')][_0x2b4e('0x2c')]){_0x52599d['where']=_[_0x2b4e('0x4a')](_0x52599d[_0x2b4e('0x63')],{'$or':_[_0x2b4e('0x2e')](_0x52599d[_0x2b4e('0x40')],function(_0xeb0ccf){var _0x468291={};_0x468291[_0xeb0ccf]={'$like':'%'+_0x5f3381[_0x2b4e('0x3e')][_0x2b4e('0x2c')]+'%'};return _0x468291;})});}_0x52599d=_[_0x2b4e('0x4a')]({},_0x52599d,_0x5f3381[_0x2b4e('0x51')]);return db['CmHopperFinal'][_0x2b4e('0x1f')]({'where':_0x52599d['where']})[_0x2b4e('0x33')](function(_0x15a149){_0x34ef2f[_0x2b4e('0x1f')]=_0x15a149;if(_0x5f3381['query']['includeAll']){_0x52599d[_0x2b4e('0x4c')]=[{'all':!![]}];}return db[_0x2b4e('0x69')][_0x2b4e('0x4d')](_0x52599d);})[_0x2b4e('0x33')](function(_0x519087){_0x34ef2f[_0x2b4e('0x4e')]=_0x519087;return _0x34ef2f;});}})[_0x2b4e('0x33')](respondWithFilteredResult(_0x494861,_0x52599d))['catch'](handleError(_0x494861,null));};exports[_0x2b4e('0x6a')]=function(_0x4d5866,_0x36466a,_0x3bc9ce){var _0x61c7f9={'raw':!![],'where':{}};var _0x4d15b7={};var _0x338297={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x2b4e('0x66')]({'where':{'id':_0x4d5866[_0x2b4e('0x5d')]['id']}})[_0x2b4e('0x33')](handleEntityNotFound(_0x36466a,null))[_0x2b4e('0x33')](function(_0x152143){if(_0x152143){_0x4d15b7[_0x2b4e('0x3d')]=_['keys'](db['CmHopperBlack'][_0x2b4e('0x3b')]);_0x4d15b7[_0x2b4e('0x3e')]=_['keys'](_0x4d5866[_0x2b4e('0x3e')]);_0x4d15b7[_0x2b4e('0x48')]=_['intersection'](_0x4d15b7[_0x2b4e('0x3d')],_0x4d15b7[_0x2b4e('0x3e')]);_0x61c7f9[_0x2b4e('0x40')]=_['intersection'](_0x4d15b7[_0x2b4e('0x3d')],qs['fields'](_0x4d5866[_0x2b4e('0x3e')][_0x2b4e('0x42')]));_0x61c7f9[_0x2b4e('0x40')]=_0x61c7f9['attributes'][_0x2b4e('0x43')]?_0x61c7f9[_0x2b4e('0x40')]:_0x4d15b7[_0x2b4e('0x3d')];if(!_0x4d5866[_0x2b4e('0x3e')][_0x2b4e('0x44')]('nolimit')){_0x61c7f9[_0x2b4e('0x21')]=qs[_0x2b4e('0x21')](_0x4d5866[_0x2b4e('0x3e')][_0x2b4e('0x21')]);_0x61c7f9[_0x2b4e('0x20')]=qs['offset'](_0x4d5866[_0x2b4e('0x3e')][_0x2b4e('0x20')]);}_0x61c7f9['order']=qs['sort'](_0x4d5866['query'][_0x2b4e('0x47')]);_0x61c7f9['where']=qs[_0x2b4e('0x48')](_[_0x2b4e('0x49')](_0x4d5866['query'],_0x4d15b7[_0x2b4e('0x48')]));_0x61c7f9[_0x2b4e('0x63')][_0x2b4e('0x64')]=_0x152143['id'];if(_0x4d5866[_0x2b4e('0x3e')][_0x2b4e('0x2c')]){_0x61c7f9['where']=_[_0x2b4e('0x4a')](_0x61c7f9[_0x2b4e('0x63')],{'$or':_[_0x2b4e('0x2e')](_0x61c7f9[_0x2b4e('0x40')],function(_0x203df6){var _0x1a7283={};_0x1a7283[_0x203df6]={'$like':'%'+_0x4d5866[_0x2b4e('0x3e')][_0x2b4e('0x2c')]+'%'};return _0x1a7283;})});}_0x61c7f9=_['merge']({},_0x61c7f9,_0x4d5866[_0x2b4e('0x51')]);return db[_0x2b4e('0x6b')][_0x2b4e('0x1f')]({'where':_0x61c7f9['where']})['then'](function(_0x5b1173){_0x338297['count']=_0x5b1173;if(_0x4d5866[_0x2b4e('0x3e')][_0x2b4e('0x4b')]){_0x61c7f9[_0x2b4e('0x4c')]=[{'all':!![]}];}return db['CmHopperBlack'][_0x2b4e('0x4d')](_0x61c7f9);})[_0x2b4e('0x33')](function(_0x46439c){_0x338297[_0x2b4e('0x4e')]=_0x46439c;return _0x338297;});}})[_0x2b4e('0x33')](respondWithFilteredResult(_0x36466a,_0x61c7f9))[_0x2b4e('0x4f')](handleError(_0x36466a,null));};exports[_0x2b4e('0x6c')]=function(_0x2673a7,_0x4aafef,_0x84a4d6){var _0x218f64={};var _0x2a3680={};var _0x3e78b4;var _0x1093e3;return db[_0x2b4e('0x3a')][_0x2b4e('0x66')]({'where':{'id':_0x2673a7[_0x2b4e('0x5d')]['id']}})['then'](handleEntityNotFound(_0x4aafef,null))[_0x2b4e('0x33')](function(_0x139e75){if(_0x139e75){_0x3e78b4=_0x139e75;_0x2a3680[_0x2b4e('0x3d')]=_[_0x2b4e('0x3f')](db[_0x2b4e('0x6d')][_0x2b4e('0x3b')]);_0x2a3680['query']=_[_0x2b4e('0x3f')](_0x2673a7['query']);_0x2a3680['filters']=_['intersection'](_0x2a3680[_0x2b4e('0x3d')],_0x2a3680[_0x2b4e('0x3e')]);_0x218f64[_0x2b4e('0x40')]=_[_0x2b4e('0x41')](_0x2a3680[_0x2b4e('0x3d')],qs['fields'](_0x2673a7[_0x2b4e('0x3e')][_0x2b4e('0x42')]));_0x218f64[_0x2b4e('0x40')]=_0x218f64[_0x2b4e('0x40')][_0x2b4e('0x43')]?_0x218f64[_0x2b4e('0x40')]:_0x2a3680[_0x2b4e('0x3d')];_0x218f64[_0x2b4e('0x46')]=qs[_0x2b4e('0x47')](_0x2673a7['query']['sort']);_0x218f64['where']=qs[_0x2b4e('0x48')](_['pick'](_0x2673a7[_0x2b4e('0x3e')],_0x2a3680[_0x2b4e('0x48')]));if(_0x2673a7[_0x2b4e('0x3e')][_0x2b4e('0x2c')]){_0x218f64[_0x2b4e('0x63')]=_[_0x2b4e('0x4a')](_0x218f64[_0x2b4e('0x63')],{'$or':_[_0x2b4e('0x2e')](_0x218f64['attributes'],function(_0x9dfc34){var _0x2f8dea={};_0x2f8dea[_0x9dfc34]={'$like':'%'+_0x2673a7['query'][_0x2b4e('0x2c')]+'%'};return _0x2f8dea;})});}_0x218f64=_['merge']({},_0x218f64,_0x2673a7[_0x2b4e('0x51')]);return _0x3e78b4[_0x2b4e('0x6c')](_0x218f64);}})[_0x2b4e('0x33')](function(_0x4538c7){if(_0x4538c7){_0x1093e3=_0x4538c7['length'];if(!_0x2673a7[_0x2b4e('0x3e')][_0x2b4e('0x44')](_0x2b4e('0x45'))){_0x218f64[_0x2b4e('0x21')]=qs[_0x2b4e('0x21')](_0x2673a7[_0x2b4e('0x3e')]['limit']);_0x218f64[_0x2b4e('0x20')]=qs[_0x2b4e('0x20')](_0x2673a7['query'][_0x2b4e('0x20')]);}return _0x3e78b4['getTeams'](_0x218f64);}})[_0x2b4e('0x33')](function(_0x5d73da){if(_0x5d73da){return _0x5d73da?{'count':_0x1093e3,'rows':_0x5d73da}:null;}})[_0x2b4e('0x33')](respondWithResult(_0x4aafef,null))['catch'](handleError(_0x4aafef,null));};exports[_0x2b4e('0x6e')]=function(_0x4f3bf2,_0x45237e,_0x107ecb){var _0x16dae9=_0x4f3bf2[_0x2b4e('0x53')][_0x2b4e('0x6f')];var _0xbf7294=_[_0x2b4e('0x2e')](_0x16dae9,'id');return db['Team'][_0x2b4e('0x4d')]({'where':{'id':_0xbf7294},'attributes':['id'],'include':[{'model':db['User'],'as':_0x2b4e('0x70'),'attributes':['id',_0x2b4e('0x37'),_0x2b4e('0x71'),_0x2b4e('0x72'),_0x2b4e('0x73')],'raw':!![]}]})['then'](function(_0x4bd307){if(_0x4bd307){var _0x40869c=_[_0x2b4e('0x74')](_0x4bd307,function(_0x5ec394){var _0x14acd3=_0x5ec394[_0x2b4e('0x28')]({'plain':!![]});_0x14acd3[_0x2b4e('0x70')][_0x2b4e('0x75')](function(_0x582cc5){_0x582cc5[_0x2b4e('0x76')]=_[_0x2b4e('0x31')](_0x16dae9,{'id':_0x14acd3['id']})[_0x2b4e('0x76')];});return _0x14acd3[_0x2b4e('0x70')];});return db[_0x2b4e('0x3a')][_0x2b4e('0x31')]({'where':{'id':_0x4f3bf2['params']['id']}})[_0x2b4e('0x33')](function(_0xabcfd7){return db[_0x2b4e('0x77')][_0x2b4e('0x78')](function(_0x52a86b){return _0xabcfd7[_0x2b4e('0x6e')](_0xbf7294,{'transaction':_0x52a86b})[_0x2b4e('0x33')](function(){return BPromise[_0x2b4e('0x79')](_0x40869c,function(_0x47b2f6){return db[_0x2b4e('0x7a')]['findOrCreate']({'where':{'UserId':_0x47b2f6['id'],'VoiceQueueId':_0x4f3bf2[_0x2b4e('0x5d')]['id']},'defaults':{'penalty':_0x47b2f6[_0x2b4e('0x76')]},'transaction':_0x52a86b});});})[_0x2b4e('0x33')](function(){return BPromise['each'](_[_0x2b4e('0x2c')](_0x40869c,{'online':!![]}),function(_0x5d1820){return db[_0x2b4e('0x7b')][_0x2b4e('0x7c')]({'membername':_0x5d1820['name'],'UserId':_0x5d1820['id'],'queue_name':_0xabcfd7[_0x2b4e('0x37')],'VoiceQueueId':_0xabcfd7['id'],'interface':_[_0x2b4e('0x7d')](_0x5d1820[_0x2b4e('0x73')])?util[_0x2b4e('0x7e')](_0x2b4e('0x7f'),_0x5d1820['name']):_0x5d1820[_0x2b4e('0x73')],'paused':_0x5d1820[_0x2b4e('0x72')]||![],'penalty':_0x5d1820['penalty']},{'transaction':_0x52a86b});});})[_0x2b4e('0x33')](function(){_0x40869c['forEach'](function(_0x4c9ef5){socket['emit']('userVoiceQueue:save',{'UserId':_0x4c9ef5['id'],'VoiceQueueId':_0xabcfd7['id']});});});});});}})['then'](respondWithStatusCode(_0x45237e,null))['catch'](handleError(_0x45237e,null));};exports['removeTeams']=function(_0x595b5e,_0x364eda,_0x2d3443){return db[_0x2b4e('0x6d')][_0x2b4e('0x4d')]({'where':{'id':_0x595b5e[_0x2b4e('0x3e')]['ids']},'attributes':['id'],'include':[{'model':db[_0x2b4e('0x80')],'as':_0x2b4e('0x70'),'attributes':['id'],'raw':!![]}]})[_0x2b4e('0x33')](handleEntityNotFound(_0x364eda,null))['then'](function(_0x31b028){var _0x27eddc=_['map'](_0x31b028,'id');var _0x1fa297=[];var _0x55cb87=[];var _0x30320e=squel[_0x2b4e('0x81')]();_0x30320e[_0x2b4e('0x82')](_0x2b4e('0x83'))['from'](_0x2b4e('0x84'),'tq')[_0x2b4e('0x85')](_0x2b4e('0x86'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x2b4e('0x63')](_0x2b4e('0x87'),_0x595b5e[_0x2b4e('0x5d')]['id']);for(var _0x3d1e01=0x0;_0x3d1e01<_0x31b028['length'];_0x3d1e01+=0x1){let _0x35b021=_0x31b028[_0x3d1e01];for(var _0x290ccd=0x0;_0x290ccd<_0x35b021[_0x2b4e('0x70')][_0x2b4e('0x43')];_0x290ccd+=0x1){let _0x4a7f69=_0x35b021[_0x2b4e('0x70')][_0x290ccd];var _0x45a0fb=_0x30320e[_0x2b4e('0x5c')]();_0x45a0fb['where'](_0x2b4e('0x88'),_0x4a7f69['id']);_0x55cb87[_0x2b4e('0x89')](db[_0x2b4e('0x77')][_0x2b4e('0x3e')](_0x45a0fb['toString'](),{'type':db[_0x2b4e('0x77')][_0x2b4e('0x8a')][_0x2b4e('0x8b')]})[_0x2b4e('0x33')](function(_0x86f35a){if(_0x86f35a['length']===0x1){return _0x4a7f69['id'];}else{var _0x149b09=_[_0x2b4e('0x8c')](_[_0x2b4e('0x2e')](_0x86f35a,_0x2b4e('0x8d')),function(_0x4978ac){return _[_0x2b4e('0x8e')](_0x27eddc,_0x4978ac);});if(_0x149b09){return _0x4a7f69['id'];}}}));}}return BPromise[_0x2b4e('0x8f')](_0x55cb87)[_0x2b4e('0x33')](function(_0x4c6d01){_0x1fa297=_(_0x1fa297)[_0x2b4e('0x90')](_0x4c6d01)[_0x2b4e('0x91')]()[_0x2b4e('0x2f')]();return db[_0x2b4e('0x3a')][_0x2b4e('0x31')]({'where':{'id':_0x595b5e[_0x2b4e('0x5d')]['id']}})['then'](function(_0x10bd5f){return db[_0x2b4e('0x77')][_0x2b4e('0x78')](function(_0x92782e){return _0x10bd5f['removeTeams'](_0x595b5e['query'][_0x2b4e('0x92')],{'transaction':_0x92782e})['then'](function(){if(!_[_0x2b4e('0x93')](_0x1fa297)){return _0x10bd5f[_0x2b4e('0x94')](_0x1fa297,{'transaction':_0x92782e})[_0x2b4e('0x33')](function(){return db[_0x2b4e('0x7b')][_0x2b4e('0x32')]({'where':{'VoiceQueueId':_0x595b5e[_0x2b4e('0x5d')]['id'],'UserId':_0x1fa297},'transaction':_0x92782e});});}})[_0x2b4e('0x33')](function(){_0x1fa297[_0x2b4e('0x75')](function(_0x15a155){socket['emit'](_0x2b4e('0x95'),{'UserId':_0x15a155,'VoiceQueueId':_0x10bd5f['id']});});});});});});})[_0x2b4e('0x33')](respondWithStatusCode(_0x364eda,null))[_0x2b4e('0x4f')](handleError(_0x364eda,null));};exports[_0x2b4e('0x96')]=function(_0x4fed7c,_0x22ac15,_0x41d39f){var _0x2e001e,_0x7d888c;return db[_0x2b4e('0x3a')]['find']({'where':{'id':_0x4fed7c[_0x2b4e('0x5d')]['id']}})[_0x2b4e('0x33')](handleEntityNotFound(_0x22ac15,null))[_0x2b4e('0x33')](function(_0x2b7797){if(_0x2b7797){_0x7d888c=_0x2b7797;return _0x2b7797[_0x2b4e('0x96')](_0x4fed7c[_0x2b4e('0x53')][_0x2b4e('0x92')],_[_0x2b4e('0x97')](_0x4fed7c[_0x2b4e('0x53')],['ids','id'])||{})[_0x2b4e('0x98')](function(_0x47a9cc){for(var _0x457b65=0x0;_0x457b65<_0x4fed7c[_0x2b4e('0x53')][_0x2b4e('0x92')]['length'];_0x457b65+=0x1){socket['emit'](_0x2b4e('0x99'),{'UserId':_0x4fed7c[_0x2b4e('0x53')]['ids'][_0x457b65],'VoiceQueueId':_0x4fed7c['params']['id']});}return _0x47a9cc;});}})[_0x2b4e('0x33')](function(_0x361a08){_0x2e001e=_0x361a08||[];if(_0x7d888c){return db['User'][_0x2b4e('0x4d')]({'where':{'id':_0x4fed7c[_0x2b4e('0x53')][_0x2b4e('0x92')]},'attributes':['id','name',_0x2b4e('0x71'),'voicePause',_0x2b4e('0x73')],'raw':!![]});}})[_0x2b4e('0x33')](function(_0x9081ae){if(!_[_0x2b4e('0x93')](_0x9081ae)){var _0x474cba=[];for(var _0x3d5b01=0x0;_0x3d5b01<_0x9081ae[_0x2b4e('0x43')];_0x3d5b01++){if(_0x9081ae[_0x3d5b01][_0x2b4e('0x71')]){_0x474cba['push'](db[_0x2b4e('0x7b')][_0x2b4e('0x7c')]({'membername':_0x9081ae[_0x3d5b01][_0x2b4e('0x37')],'UserId':_0x9081ae[_0x3d5b01]['id'],'queue_name':_0x7d888c[_0x2b4e('0x37')],'VoiceQueueId':_0x7d888c['id'],'interface':_[_0x2b4e('0x7d')](_0x9081ae[_0x3d5b01][_0x2b4e('0x73')])?util[_0x2b4e('0x7e')](_0x2b4e('0x7f'),_0x9081ae[_0x3d5b01][_0x2b4e('0x37')]):_0x9081ae[_0x3d5b01][_0x2b4e('0x73')],'paused':_0x9081ae[_0x3d5b01][_0x2b4e('0x72')]||![],'penalty':_0x4fed7c[_0x2b4e('0x53')][_0x2b4e('0x76')]||0x0}));}}return BPromise[_0x2b4e('0x8f')](_0x474cba);}})[_0x2b4e('0x33')](function(){return _0x2e001e;})[_0x2b4e('0x33')](respondWithResult(_0x22ac15,null))['catch'](handleError(_0x22ac15,null));};exports[_0x2b4e('0x94')]=function(_0x3e82cc,_0x5cf022,_0x246b7d){return db['VoiceQueue'][_0x2b4e('0x31')]({'where':{'id':_0x3e82cc['params']['id']}})[_0x2b4e('0x33')](handleEntityNotFound(_0x5cf022,null))['then'](function(_0x3999ab){if(_0x3999ab){return _0x3999ab[_0x2b4e('0x94')](_0x3e82cc[_0x2b4e('0x3e')]['ids'])[_0x2b4e('0x33')](function(){if(_[_0x2b4e('0x9a')](_0x3e82cc[_0x2b4e('0x3e')][_0x2b4e('0x92')])){for(var _0x1fc9e6=0x0;_0x1fc9e6<_0x3e82cc['query'][_0x2b4e('0x92')][_0x2b4e('0x43')];_0x1fc9e6+=0x1){socket['emit'](_0x2b4e('0x95'),{'UserId':Number(_0x3e82cc[_0x2b4e('0x3e')][_0x2b4e('0x92')][_0x1fc9e6]),'VoiceQueueId':Number(_0x3e82cc[_0x2b4e('0x5d')]['id'])});}}else{socket['emit'](_0x2b4e('0x95'),{'UserId':Number(_0x3e82cc['query'][_0x2b4e('0x92')]),'VoiceQueueId':Number(_0x3e82cc[_0x2b4e('0x5d')]['id'])});}});}})[_0x2b4e('0x33')](function(_0x2a003c){return db[_0x2b4e('0x7b')]['destroy']({'where':{'VoiceQueueId':_0x3e82cc[_0x2b4e('0x5d')]['id'],'UserId':_0x3e82cc[_0x2b4e('0x3e')][_0x2b4e('0x92')]}})['then'](function(){return _0x2a003c;});})[_0x2b4e('0x33')](respondWithStatusCode(_0x5cf022,null))['catch'](handleError(_0x5cf022,null));};exports['getAgents']=function(_0x356024,_0x1458d6,_0xc9bd14){var _0x49756a={};var _0x30fb3a={};var _0x27ca34;var _0x167f46;return db[_0x2b4e('0x3a')][_0x2b4e('0x66')]({'where':{'id':_0x356024[_0x2b4e('0x5d')]['id']}})[_0x2b4e('0x33')](handleEntityNotFound(_0x1458d6,null))[_0x2b4e('0x33')](function(_0x3147b4){if(_0x3147b4){_0x27ca34=_0x3147b4;_0x30fb3a[_0x2b4e('0x3d')]=_['keys'](db['User'][_0x2b4e('0x3b')]);_0x30fb3a[_0x2b4e('0x3e')]=_[_0x2b4e('0x3f')](_0x356024[_0x2b4e('0x3e')]);_0x30fb3a[_0x2b4e('0x48')]=_[_0x2b4e('0x41')](_0x30fb3a['model'],_0x30fb3a[_0x2b4e('0x3e')]);_0x49756a[_0x2b4e('0x40')]=_['intersection'](_0x30fb3a[_0x2b4e('0x3d')],qs['fields'](_0x356024[_0x2b4e('0x3e')][_0x2b4e('0x42')]));_0x49756a[_0x2b4e('0x40')]=_0x49756a[_0x2b4e('0x40')][_0x2b4e('0x43')]?_0x49756a[_0x2b4e('0x40')]:_0x30fb3a['model'];_0x49756a[_0x2b4e('0x46')]=qs[_0x2b4e('0x47')](_0x356024['query'][_0x2b4e('0x47')]);_0x49756a[_0x2b4e('0x63')]=qs[_0x2b4e('0x48')](_[_0x2b4e('0x49')](_0x356024[_0x2b4e('0x3e')],_0x30fb3a['filters']));if(_0x356024[_0x2b4e('0x3e')][_0x2b4e('0x2c')]){_0x49756a['where']=_[_0x2b4e('0x4a')](_0x49756a[_0x2b4e('0x63')],{'$or':_[_0x2b4e('0x2e')](_0x49756a[_0x2b4e('0x40')],function(_0x54ada2){var _0x53f70f={};_0x53f70f[_0x54ada2]={'$like':'%'+_0x356024[_0x2b4e('0x3e')]['filter']+'%'};return _0x53f70f;})});}_0x49756a=_[_0x2b4e('0x4a')]({},_0x49756a,_0x356024[_0x2b4e('0x51')]);return _0x27ca34[_0x2b4e('0x9b')](_0x49756a);}})[_0x2b4e('0x33')](function(_0x45dd58){if(_0x45dd58){_0x167f46=_0x45dd58[_0x2b4e('0x43')];if(!_0x356024['query'][_0x2b4e('0x44')](_0x2b4e('0x45'))){_0x49756a['limit']=qs[_0x2b4e('0x21')](_0x356024[_0x2b4e('0x3e')]['limit']);_0x49756a[_0x2b4e('0x20')]=qs[_0x2b4e('0x20')](_0x356024[_0x2b4e('0x3e')][_0x2b4e('0x20')]);}return _0x27ca34['getAgents'](_0x49756a);}})[_0x2b4e('0x33')](function(_0x3752e2){if(_0x3752e2){return _0x3752e2?{'count':_0x167f46,'rows':_0x3752e2}:null;}})[_0x2b4e('0x33')](respondWithResult(_0x1458d6,null))[_0x2b4e('0x4f')](handleError(_0x1458d6,null));};exports[_0x2b4e('0x9c')]=function(_0x45690f,_0x3f2a47,_0x3d26c4){var _0x327a8a={};var _0x559582={};var _0x33b1fb;var _0x3a4dab;return db[_0x2b4e('0x3a')][_0x2b4e('0x66')]({'where':{'id':_0x45690f[_0x2b4e('0x5d')]['id']}})['then'](handleEntityNotFound(_0x3f2a47,null))[_0x2b4e('0x33')](function(_0x5baf3a){if(_0x5baf3a){_0x33b1fb=_0x5baf3a;_0x559582['model']=_[_0x2b4e('0x3f')](db['UserVoiceQueueRt'][_0x2b4e('0x3b')]);_0x559582['query']=_[_0x2b4e('0x3f')](_0x45690f[_0x2b4e('0x3e')]);_0x559582['filters']=_[_0x2b4e('0x41')](_0x559582[_0x2b4e('0x3d')],_0x559582[_0x2b4e('0x3e')]);_0x327a8a[_0x2b4e('0x40')]=_[_0x2b4e('0x41')](_0x559582[_0x2b4e('0x3d')],qs['fields'](_0x45690f['query'][_0x2b4e('0x42')]));_0x327a8a[_0x2b4e('0x40')]=_0x327a8a[_0x2b4e('0x40')]['length']?_0x327a8a[_0x2b4e('0x40')]:_0x559582['model'];_0x327a8a[_0x2b4e('0x46')]=qs['sort'](_0x45690f[_0x2b4e('0x3e')][_0x2b4e('0x47')]);_0x327a8a[_0x2b4e('0x63')]=qs[_0x2b4e('0x48')](_[_0x2b4e('0x49')](_0x45690f[_0x2b4e('0x3e')],_0x559582[_0x2b4e('0x48')]));if(_0x45690f['query'][_0x2b4e('0x2c')]){_0x327a8a[_0x2b4e('0x63')]=_[_0x2b4e('0x4a')](_0x327a8a[_0x2b4e('0x63')],{'$or':_[_0x2b4e('0x2e')](_0x327a8a[_0x2b4e('0x40')],function(_0x5e5468){var _0x1fd63e={};_0x1fd63e[_0x5e5468]={'$like':'%'+_0x45690f['query'][_0x2b4e('0x2c')]+'%'};return _0x1fd63e;})});}_0x327a8a=_[_0x2b4e('0x4a')]({},_0x327a8a,_0x45690f[_0x2b4e('0x51')]);return _0x33b1fb[_0x2b4e('0x9c')](_0x327a8a);}})[_0x2b4e('0x33')](function(_0xcc5935){if(_0xcc5935){_0x3a4dab=_0xcc5935[_0x2b4e('0x43')];if(!_0x45690f[_0x2b4e('0x3e')][_0x2b4e('0x44')](_0x2b4e('0x45'))){_0x327a8a[_0x2b4e('0x21')]=qs[_0x2b4e('0x21')](_0x45690f[_0x2b4e('0x3e')][_0x2b4e('0x21')]);_0x327a8a[_0x2b4e('0x20')]=qs['offset'](_0x45690f['query'][_0x2b4e('0x20')]);}return _0x33b1fb[_0x2b4e('0x9c')](_0x327a8a);}})['then'](function(_0x25a4f5){return _0x25a4f5?{'count':_0x3a4dab,'rows':_0x25a4f5}:null;})['then'](respondWithResult(_0x3f2a47,null))[_0x2b4e('0x4f')](handleError(_0x3f2a47,null));};exports[_0x2b4e('0x9d')]=function(_0x4a458d,_0x5bda25,_0x1cac65){var _0x2cf7b5={};var _0x1c47b2={};var _0x3395e5;var _0x307462;return db[_0x2b4e('0x3a')][_0x2b4e('0x66')]({'where':{'id':_0x4a458d[_0x2b4e('0x5d')]['id']}})[_0x2b4e('0x33')](handleEntityNotFound(_0x5bda25,null))['then'](function(_0x21e44d){if(_0x21e44d){_0x3395e5=_0x21e44d;_0x1c47b2[_0x2b4e('0x3d')]=_[_0x2b4e('0x3f')](db[_0x2b4e('0x9e')][_0x2b4e('0x3b')]);_0x1c47b2['query']=_[_0x2b4e('0x3f')](_0x4a458d[_0x2b4e('0x3e')]);_0x1c47b2[_0x2b4e('0x48')]=_[_0x2b4e('0x41')](_0x1c47b2['model'],_0x1c47b2['query']);_0x2cf7b5[_0x2b4e('0x40')]=_[_0x2b4e('0x41')](_0x1c47b2[_0x2b4e('0x3d')],qs[_0x2b4e('0x42')](_0x4a458d[_0x2b4e('0x3e')]['fields']));_0x2cf7b5['attributes']=_0x2cf7b5['attributes'][_0x2b4e('0x43')]?_0x2cf7b5[_0x2b4e('0x40')]:_0x1c47b2[_0x2b4e('0x3d')];_0x2cf7b5['order']=qs['sort'](_0x4a458d['query'][_0x2b4e('0x47')]);_0x2cf7b5[_0x2b4e('0x63')]=qs[_0x2b4e('0x48')](_['pick'](_0x4a458d[_0x2b4e('0x3e')],_0x1c47b2[_0x2b4e('0x48')]));if(_0x4a458d[_0x2b4e('0x3e')][_0x2b4e('0x2c')]){_0x2cf7b5['where']=_[_0x2b4e('0x4a')](_0x2cf7b5[_0x2b4e('0x63')],{'$or':_[_0x2b4e('0x2e')](_0x2cf7b5['attributes'],function(_0x59a350){var _0x298dce={};_0x298dce[_0x59a350]={'$like':'%'+_0x4a458d[_0x2b4e('0x3e')][_0x2b4e('0x2c')]+'%'};return _0x298dce;})});}_0x2cf7b5=_[_0x2b4e('0x4a')]({},_0x2cf7b5,_0x4a458d[_0x2b4e('0x51')]);return _0x3395e5[_0x2b4e('0x9d')](_0x2cf7b5);}})[_0x2b4e('0x33')](function(_0x569865){if(_0x569865){_0x307462=_0x569865[_0x2b4e('0x43')];if(!_0x4a458d['query'][_0x2b4e('0x44')](_0x2b4e('0x45'))){_0x2cf7b5[_0x2b4e('0x21')]=qs['limit'](_0x4a458d[_0x2b4e('0x3e')][_0x2b4e('0x21')]);_0x2cf7b5[_0x2b4e('0x20')]=qs[_0x2b4e('0x20')](_0x4a458d['query']['offset']);}return _0x3395e5[_0x2b4e('0x9d')](_0x2cf7b5);}})[_0x2b4e('0x33')](function(_0xac3554){if(_0xac3554){return _0xac3554?{'count':_0x307462,'rows':_0xac3554}:null;}})[_0x2b4e('0x33')](respondWithResult(_0x5bda25,null))[_0x2b4e('0x4f')](handleError(_0x5bda25,null));};exports['addLists']=function(_0x157465,_0x39c2a0,_0x22a119){var _0x3fb683,_0x12b18e;return db[_0x2b4e('0x3a')][_0x2b4e('0x31')]({'where':{'id':_0x157465[_0x2b4e('0x5d')]['id']}})[_0x2b4e('0x33')](handleEntityNotFound(_0x39c2a0,null))[_0x2b4e('0x33')](function(_0x9154d6){if(_0x9154d6){_0x12b18e=_0x9154d6;return _0x9154d6['addLists'](_0x157465[_0x2b4e('0x53')][_0x2b4e('0x92')],_['omit'](_0x157465[_0x2b4e('0x53')],[_0x2b4e('0x92'),'id'])||{});}return null;})[_0x2b4e('0x98')](function(_0x4d4f90){var _0x1a1780;_0x3fb683=_0x4d4f90||[];var _0x563ede=[];if(_0x4d4f90){for(var _0x17d975=0x0;_0x17d975<_0x4d4f90[_0x2b4e('0x43')];_0x17d975+=0x1){var _0x48ba03=_0x4d4f90[_0x17d975]['get']({'plain':!![]});_0x12b18e[_0x2b4e('0x9f')]=_0x157465[_0x2b4e('0x53')][_0x2b4e('0x9f')]?_0x157465[_0x2b4e('0x53')][_0x2b4e('0x9f')]:_0x12b18e[_0x2b4e('0x9f')];switch(_0x12b18e['dialCheckDuplicateType']){case _0x2b4e('0xa0'):_0x1a1780=squel['insert']()[_0x2b4e('0xa1')](_0x2b4e('0xa2'))[_0x2b4e('0xa3')]([_0x2b4e('0xa4'),'scheduledAt',_0x2b4e('0xa5'),_0x2b4e('0xa6'),_0x2b4e('0x64'),_0x2b4e('0x5e'),_0x2b4e('0x5f')],squel[_0x2b4e('0x81')]()['field'](_0x2b4e('0xa4'),_0x2b4e('0xa4'))[_0x2b4e('0x82')]('NOW()',_0x2b4e('0xa7'))[_0x2b4e('0x82')]('id',_0x2b4e('0xa5'))[_0x2b4e('0x82')](_0x48ba03[_0x2b4e('0xa8')][_0x2b4e('0xa9')](),_0x2b4e('0xa6'))[_0x2b4e('0x82')](_0x157465[_0x2b4e('0x5d')]['id']['toString'](),_0x2b4e('0x64'))[_0x2b4e('0x82')](_0x2b4e('0xaa'),_0x2b4e('0x5e'))['field']('NOW()',_0x2b4e('0x5f'))[_0x2b4e('0xab')](_0x2b4e('0xac'))[_0x2b4e('0x63')]('deletedAt\x20IS\x20NULL')['where'](_0x2b4e('0xad'),_0x48ba03['CmListId'][_0x2b4e('0xa9')]())[_0x2b4e('0x63')](_0x2b4e('0xae'))[_0x2b4e('0x63')]('phone\x20NOT\x20IN\x20(?)',squel[_0x2b4e('0x81')]()[_0x2b4e('0x82')](_0x2b4e('0xaf'))[_0x2b4e('0xab')](_0x2b4e('0xb0'))[_0x2b4e('0x63')](_0x2b4e('0x87'),_0x157465[_0x2b4e('0x5d')]['id'][_0x2b4e('0xa9')]()))[_0x2b4e('0x63')](_0x2b4e('0xb1'),squel[_0x2b4e('0x81')]()[_0x2b4e('0x82')](_0x2b4e('0xb2'))[_0x2b4e('0xab')](_0x2b4e('0xa2'))[_0x2b4e('0x63')](_0x2b4e('0x87'),_0x157465[_0x2b4e('0x5d')]['id'][_0x2b4e('0xa9')]())))[_0x2b4e('0xa9')]();break;case _0x2b4e('0xb3'):_0x1a1780=squel[_0x2b4e('0xb4')]()[_0x2b4e('0xa1')](_0x2b4e('0xa2'))[_0x2b4e('0xa3')]([_0x2b4e('0xa4'),_0x2b4e('0xa7'),_0x2b4e('0xa5'),_0x2b4e('0xa6'),_0x2b4e('0x64'),'createdAt',_0x2b4e('0x5f')],squel[_0x2b4e('0x81')]()[_0x2b4e('0x82')]('phone',_0x2b4e('0xa4'))[_0x2b4e('0x82')]('NOW()','scheduledAt')[_0x2b4e('0x82')]('id',_0x2b4e('0xa5'))['field'](_0x48ba03[_0x2b4e('0xa8')][_0x2b4e('0xa9')](),'ListId')[_0x2b4e('0x82')](_0x157465[_0x2b4e('0x5d')]['id'][_0x2b4e('0xa9')](),_0x2b4e('0x64'))[_0x2b4e('0x82')](_0x2b4e('0xaa'),'createdAt')[_0x2b4e('0x82')](_0x2b4e('0xaa'),_0x2b4e('0x5f'))[_0x2b4e('0xab')](_0x2b4e('0xac'))[_0x2b4e('0x63')](_0x2b4e('0xb5'))[_0x2b4e('0x63')](_0x2b4e('0xad'),_0x48ba03['CmListId']['toString']())[_0x2b4e('0x63')](_0x2b4e('0xae'))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0x2b4e('0x81')]()['field'](_0x2b4e('0xb2'))[_0x2b4e('0xab')](_0x2b4e('0xa2'))[_0x2b4e('0x63')](_0x2b4e('0x87'),_0x157465[_0x2b4e('0x5d')]['id'][_0x2b4e('0xa9')]())))['toString']();break;default:_0x1a1780=squel['insert']()['into'](_0x2b4e('0xa2'))[_0x2b4e('0xa3')]([_0x2b4e('0xa4'),_0x2b4e('0xa7'),_0x2b4e('0xa5'),_0x2b4e('0xa6'),_0x2b4e('0x64'),_0x2b4e('0x5e'),_0x2b4e('0x5f')],squel['select']()[_0x2b4e('0x82')](_0x2b4e('0xa4'),_0x2b4e('0xa4'))['field'](_0x2b4e('0xaa'),_0x2b4e('0xa7'))[_0x2b4e('0x82')]('id',_0x2b4e('0xa5'))[_0x2b4e('0x82')](_0x48ba03[_0x2b4e('0xa8')][_0x2b4e('0xa9')](),_0x2b4e('0xa6'))[_0x2b4e('0x82')](_0x157465[_0x2b4e('0x5d')]['id'][_0x2b4e('0xa9')](),'VoiceQueueId')[_0x2b4e('0x82')](_0x2b4e('0xaa'),_0x2b4e('0x5e'))[_0x2b4e('0x82')](_0x2b4e('0xaa'),_0x2b4e('0x5f'))[_0x2b4e('0xab')](_0x2b4e('0xac'))['where']('deletedAt\x20IS\x20NULL')[_0x2b4e('0x63')](_0x2b4e('0xad'),_0x48ba03[_0x2b4e('0xa8')][_0x2b4e('0xa9')]())['where'](_0x2b4e('0xae')))[_0x2b4e('0xa9')]();}_0x563ede['push'](db[_0x2b4e('0x77')][_0x2b4e('0x3e')](_0x1a1780));}return BPromise['all'](_0x563ede);}})['then'](function(){return _0x3fb683;})[_0x2b4e('0x33')](respondWithResult(_0x39c2a0,null))[_0x2b4e('0x4f')](handleError(_0x39c2a0,null));};exports[_0x2b4e('0xb6')]=function(_0x1625af,_0x87028d,_0x413b89){return db[_0x2b4e('0x3a')][_0x2b4e('0x31')]({'where':{'id':_0x1625af[_0x2b4e('0x5d')]['id']}})[_0x2b4e('0x33')](handleEntityNotFound(_0x87028d,null))['then'](function(_0x1b29fc){if(_0x1b29fc){return _0x1b29fc[_0x2b4e('0xb6')](_0x1625af[_0x2b4e('0x3e')][_0x2b4e('0x92')]);}})[_0x2b4e('0x33')](function(_0x4567f1){if(_0x4567f1){return db['CmHopper'][_0x2b4e('0x32')]({'where':{'ListId':_0x1625af[_0x2b4e('0x3e')]['ids'],'VoiceQueueId':_0x1625af['params']['id']}})[_0x2b4e('0x33')](function(){return _0x4567f1;});}})[_0x2b4e('0x33')](respondWithStatusCode(_0x87028d,null))[_0x2b4e('0x4f')](handleError(_0x87028d,null));};exports[_0x2b4e('0xb7')]=function(_0x3beea7,_0x1afe3a,_0x585cb8){var _0xf48aaa={};var _0x710951={};var _0x5d81e5;var _0x309915;return db[_0x2b4e('0x3a')][_0x2b4e('0x66')]({'where':{'id':_0x3beea7['params']['id']}})['then'](handleEntityNotFound(_0x1afe3a,null))[_0x2b4e('0x33')](function(_0x230e85){if(_0x230e85){_0x5d81e5=_0x230e85;_0x710951['model']=_[_0x2b4e('0x3f')](db[_0x2b4e('0x9e')]['rawAttributes']);_0x710951[_0x2b4e('0x3e')]=_[_0x2b4e('0x3f')](_0x3beea7[_0x2b4e('0x3e')]);_0x710951['filters']=_[_0x2b4e('0x41')](_0x710951[_0x2b4e('0x3d')],_0x710951[_0x2b4e('0x3e')]);_0xf48aaa[_0x2b4e('0x40')]=_['intersection'](_0x710951[_0x2b4e('0x3d')],qs[_0x2b4e('0x42')](_0x3beea7[_0x2b4e('0x3e')][_0x2b4e('0x42')]));_0xf48aaa[_0x2b4e('0x40')]=_0xf48aaa[_0x2b4e('0x40')][_0x2b4e('0x43')]?_0xf48aaa[_0x2b4e('0x40')]:_0x710951[_0x2b4e('0x3d')];_0xf48aaa[_0x2b4e('0x46')]=qs['sort'](_0x3beea7[_0x2b4e('0x3e')][_0x2b4e('0x47')]);_0xf48aaa[_0x2b4e('0x63')]=qs['filters'](_['pick'](_0x3beea7['query'],_0x710951['filters']));if(_0x3beea7[_0x2b4e('0x3e')][_0x2b4e('0x2c')]){_0xf48aaa['where']=_[_0x2b4e('0x4a')](_0xf48aaa['where'],{'$or':_[_0x2b4e('0x2e')](_0xf48aaa[_0x2b4e('0x40')],function(_0x3fa5ac){var _0xadb57a={};_0xadb57a[_0x3fa5ac]={'$like':'%'+_0x3beea7[_0x2b4e('0x3e')]['filter']+'%'};return _0xadb57a;})});}_0xf48aaa=_[_0x2b4e('0x4a')]({},_0xf48aaa,_0x3beea7['options']);return _0x5d81e5[_0x2b4e('0xb7')](_0xf48aaa);}})['then'](function(_0x3c4eea){if(_0x3c4eea){_0x309915=_0x3c4eea[_0x2b4e('0x43')];if(!_0x3beea7[_0x2b4e('0x3e')][_0x2b4e('0x44')](_0x2b4e('0x45'))){_0xf48aaa['limit']=qs['limit'](_0x3beea7[_0x2b4e('0x3e')]['limit']);_0xf48aaa[_0x2b4e('0x20')]=qs[_0x2b4e('0x20')](_0x3beea7['query']['offset']);}return _0x5d81e5['getBlackLists'](_0xf48aaa);}})[_0x2b4e('0x33')](function(_0x172179){if(_0x172179){return _0x172179?{'count':_0x309915,'rows':_0x172179}:null;}})[_0x2b4e('0x33')](respondWithResult(_0x1afe3a,null))[_0x2b4e('0x4f')](handleError(_0x1afe3a,null));};exports[_0x2b4e('0xb8')]=function(_0x46059c,_0x1d44a1,_0x4bc74d){var _0x46aed6,_0x428c6f;return db[_0x2b4e('0x3a')][_0x2b4e('0x31')]({'where':{'id':_0x46059c[_0x2b4e('0x5d')]['id']}})[_0x2b4e('0x33')](handleEntityNotFound(_0x1d44a1,null))[_0x2b4e('0x33')](function(_0xdfe598){if(_0xdfe598){_0x428c6f=_0xdfe598;return _0xdfe598[_0x2b4e('0xb8')](_0x46059c['body'][_0x2b4e('0x92')],_[_0x2b4e('0x97')](_0x46059c['body'],[_0x2b4e('0x92'),'id'])||{});}return null;})['spread'](function(_0x21bffb){var _0x5549ac;_0x46aed6=_0x21bffb||[];var _0x558d42=[];if(_0x21bffb){for(var _0x1dcc6d=0x0;_0x1dcc6d<_0x21bffb[_0x2b4e('0x43')];_0x1dcc6d+=0x1){var _0x7f0693=_0x21bffb[_0x1dcc6d][_0x2b4e('0x28')]({'plain':!![]});_0x5549ac=squel['insert']()['into']('cm_hopper_black')['fromQuery']([_0x2b4e('0xa4'),_0x2b4e('0xa5'),_0x2b4e('0xa6'),'VoiceQueueId','createdAt',_0x2b4e('0x5f')],squel[_0x2b4e('0x81')]()[_0x2b4e('0x82')](_0x2b4e('0xa4'),'phone')['field']('id','ContactId')['field'](_0x7f0693[_0x2b4e('0xa8')][_0x2b4e('0xa9')](),_0x2b4e('0xa6'))[_0x2b4e('0x82')](_0x46059c[_0x2b4e('0x5d')]['id'][_0x2b4e('0xa9')](),'VoiceQueueId')[_0x2b4e('0x82')](_0x2b4e('0xaa'),'createdAt')['field'](_0x2b4e('0xaa'),_0x2b4e('0x5f'))[_0x2b4e('0xab')](_0x2b4e('0xac'))[_0x2b4e('0x63')](_0x2b4e('0xb5'))[_0x2b4e('0x63')]('ListId\x20=\x20?',_0x7f0693['CmListId'][_0x2b4e('0xa9')]())[_0x2b4e('0x63')](_0x2b4e('0xae')))[_0x2b4e('0xa9')]();_0x558d42[_0x2b4e('0x89')](db[_0x2b4e('0x77')][_0x2b4e('0x3e')](_0x5549ac));}return BPromise[_0x2b4e('0x8f')](_0x558d42);}})[_0x2b4e('0x33')](function(){return _0x46aed6;})[_0x2b4e('0x33')](respondWithResult(_0x1d44a1,null))[_0x2b4e('0x4f')](handleError(_0x1d44a1,null));};exports[_0x2b4e('0xb9')]=function(_0x1bd067,_0x11914b,_0x57617e){return db['VoiceQueue'][_0x2b4e('0x31')]({'where':{'id':_0x1bd067[_0x2b4e('0x5d')]['id']}})[_0x2b4e('0x33')](handleEntityNotFound(_0x11914b,null))['then'](function(_0x21b27d){if(_0x21b27d){return _0x21b27d[_0x2b4e('0xb9')](_0x1bd067[_0x2b4e('0x3e')][_0x2b4e('0x92')]);}})[_0x2b4e('0x33')](function(_0x218f91){if(_0x218f91){return db[_0x2b4e('0x6b')]['destroy']({'where':{'ListId':_0x1bd067[_0x2b4e('0x3e')][_0x2b4e('0x92')],'VoiceQueueId':_0x1bd067[_0x2b4e('0x5d')]['id']}})[_0x2b4e('0x33')](function(){return _0x218f91;});}})[_0x2b4e('0x33')](respondWithStatusCode(_0x11914b,null))[_0x2b4e('0x4f')](handleError(_0x11914b,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 1e27136..956af68 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 _0x6bc4=['remove','emit','hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners','save','update'];(function(_0x1f64b6,_0x47e7e0){var _0x5f441e=function(_0x20ee44){while(--_0x20ee44){_0x1f64b6['push'](_0x1f64b6['shift']());}};_0x5f441e(++_0x47e7e0);}(_0x6bc4,0x164));var _0x46bc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6bc4[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require('events');var VoiceQueue=require(_0x46bc('0x0'))['db']['VoiceQueue'];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x46bc('0x1')](0x0);var events={'afterCreate':_0x46bc('0x2'),'afterUpdate':_0x46bc('0x3'),'afterDestroy':_0x46bc('0x4')};function emitEvent(_0x1a5ab9){return function(_0x1f386d,_0x52d660,_0x3c3e4e){VoiceQueueEvents[_0x46bc('0x5')](_0x1a5ab9+':'+_0x1f386d['id'],_0x1f386d);VoiceQueueEvents['emit'](_0x1a5ab9,_0x1f386d);_0x3c3e4e(null);};}for(var e in events){if(events[_0x46bc('0x6')](e)){var event=events[e];VoiceQueue[_0x46bc('0x7')](e,emitEvent(event));}}module[_0x46bc('0x8')]=VoiceQueueEvents; \ No newline at end of file +var _0xefc6=['events','VoiceQueue','update','remove','emit','hook','exports'];(function(_0x315196,_0x191e28){var _0x32916b=function(_0x15a98d){while(--_0x15a98d){_0x315196['push'](_0x315196['shift']());}};_0x32916b(++_0x191e28);}(_0xefc6,0x188));var _0x6efc=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xefc6[_0x432682];return _0x463d05;};'use strict';var EventEmitter=require(_0x6efc('0x0'));var VoiceQueue=require('../../mysqldb')['db'][_0x6efc('0x1')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x6efc('0x2'),'afterDestroy':_0x6efc('0x3')};function emitEvent(_0x5825a8){return function(_0x5c421d,_0x59435e,_0x2b9154){VoiceQueueEvents[_0x6efc('0x4')](_0x5825a8+':'+_0x5c421d['id'],_0x5c421d);VoiceQueueEvents[_0x6efc('0x4')](_0x5825a8,_0x5c421d);_0x2b9154(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueue[_0x6efc('0x5')](e,emitEvent(event));}}module[_0x6efc('0x6')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index 28b6a53..a4ef59b 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 _0x6c57=['define','VoiceQueue','voice_queues','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x6c57,0x1b3));var _0x76c5=function(_0x51fe5f,_0x1d8632){_0x51fe5f=_0x51fe5f-0x0;var _0x4abce9=_0x6c57[_0x51fe5f];return _0x4abce9;};'use strict';var _=require('lodash');var util=require(_0x76c5('0x0'));var logger=require(_0x76c5('0x1'))('api');var moment=require(_0x76c5('0x2'));var BPromise=require(_0x76c5('0x3'));var rp=require(_0x76c5('0x4'));var fs=require('fs');var path=require(_0x76c5('0x5'));var rimraf=require(_0x76c5('0x6'));var config=require(_0x76c5('0x7'));var attributes=require('./voiceQueue.attributes');module[_0x76c5('0x8')]=function(_0x2b58e2,_0xdddebf){return _0x2b58e2[_0x76c5('0x9')](_0x76c5('0xa'),attributes,{'tableName':_0x76c5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8189=['moment','request-promise','rimraf','../../config/environment','./voiceQueue.attributes','exports','VoiceQueue','voice_queues','lodash','util','../../config/logger','api'];(function(_0xd4313c,_0x453988){var _0x14477a=function(_0x58e7ac){while(--_0x58e7ac){_0xd4313c['push'](_0xd4313c['shift']());}};_0x14477a(++_0x453988);}(_0x8189,0xbc));var _0x9818=function(_0x5276f3,_0x5d41ac){_0x5276f3=_0x5276f3-0x0;var _0x5ae4c3=_0x8189[_0x5276f3];return _0x5ae4c3;};'use strict';var _=require(_0x9818('0x0'));var util=require(_0x9818('0x1'));var logger=require(_0x9818('0x2'))(_0x9818('0x3'));var moment=require(_0x9818('0x4'));var BPromise=require('bluebird');var rp=require(_0x9818('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9818('0x6'));var config=require(_0x9818('0x7'));var attributes=require(_0x9818('0x8'));module[_0x9818('0x9')]=function(_0x11a3db,_0x43c0c6){return _0x11a3db['define'](_0x9818('0xa'),attributes,{'tableName':_0x9818('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index fc25724..1a27ed7 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 _0x73e6=['map','model','debug','ShowVoiceQueue','VoiceQueue','stringify','lodash','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./voiceQueue.socket','register','request','then','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','GetVoiceQueue','findAll','options','raw','where','attributes','limit','include'];(function(_0x47a242,_0x4be1e0){var _0x27d00c=function(_0x38e7de){while(--_0x38e7de){_0x47a242['push'](_0x47a242['shift']());}};_0x27d00c(++_0x4be1e0);}(_0x73e6,0xce));var _0x673e=function(_0x1d2c65,_0x236bb9){_0x1d2c65=_0x1d2c65-0x0;var _0x1270a1=_0x73e6[_0x1d2c65];return _0x1270a1;};'use strict';var _=require(_0x673e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x673e('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x673e('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x673e('0x3'));var logger=require(_0x673e('0x4'))(_0x673e('0x5'));var config=require(_0x673e('0x6'));var jayson=require(_0x673e('0x7'));var client=jayson[_0x673e('0x8')][_0x673e('0x9')]({'port':0x232a});config['redis']=_[_0x673e('0xa')](config[_0x673e('0xb')],{'host':_0x673e('0xc'),'port':0x18eb});var socket=require(_0x673e('0xd'))(new Redis(config[_0x673e('0xb')]));require(_0x673e('0xe'))[_0x673e('0xf')](socket);function respondWithRpcPromise(_0x274985,_0x4c0e48,_0x1399cb){return new BPromise(function(_0x59852f,_0x4227ac){return client[_0x673e('0x10')](_0x274985,_0x1399cb)[_0x673e('0x11')](function(_0x2f9bfe){logger[_0x673e('0x12')](_0x673e('0x13'),_0x4c0e48,_0x673e('0x14'));logger['debug']('VoiceQueue,\x20%s,\x20%s,\x20%s',_0x4c0e48,_0x673e('0x14'),JSON['stringify'](_0x2f9bfe));if(_0x2f9bfe[_0x673e('0x15')]){if(_0x2f9bfe[_0x673e('0x15')][_0x673e('0x16')]===0x1f4){logger['error'](_0x673e('0x13'),_0x4c0e48,_0x2f9bfe[_0x673e('0x15')]['message']);return _0x4227ac(_0x2f9bfe[_0x673e('0x15')][_0x673e('0x17')]);}logger[_0x673e('0x15')](_0x673e('0x13'),_0x4c0e48,_0x2f9bfe[_0x673e('0x15')][_0x673e('0x17')]);return _0x59852f(_0x2f9bfe['error'][_0x673e('0x17')]);}else{logger[_0x673e('0x12')](_0x673e('0x13'),_0x4c0e48,_0x673e('0x14'));_0x59852f(_0x2f9bfe[_0x673e('0x18')][_0x673e('0x17')]);}})[_0x673e('0x19')](function(_0x2d088f){logger[_0x673e('0x15')](_0x673e('0x13'),_0x4c0e48,_0x2d088f);_0x4227ac(_0x2d088f);});});}exports[_0x673e('0x1a')]=function(_0x2eb41a){var _0x4a94d2=this;return new Promise(function(_0x5951aa,_0x4ccbe4){return db['VoiceQueue'][_0x673e('0x1b')]({'raw':_0x2eb41a[_0x673e('0x1c')]?_0x2eb41a['options'][_0x673e('0x1d')]===undefined?!![]:![]:!![],'where':_0x2eb41a['options']?_0x2eb41a[_0x673e('0x1c')][_0x673e('0x1e')]||null:null,'attributes':_0x2eb41a['options']?_0x2eb41a[_0x673e('0x1c')][_0x673e('0x1f')]||null:null,'limit':_0x2eb41a['options']?_0x2eb41a['options'][_0x673e('0x20')]||null:null,'include':_0x2eb41a['options']?_0x2eb41a[_0x673e('0x1c')][_0x673e('0x21')]?_[_0x673e('0x22')](_0x2eb41a[_0x673e('0x1c')][_0x673e('0x21')],function(_0x3c69fb){return{'model':db[_0x3c69fb[_0x673e('0x23')]],'as':_0x3c69fb['as'],'attributes':_0x3c69fb['attributes'],'include':_0x3c69fb[_0x673e('0x21')]?_[_0x673e('0x22')](_0x3c69fb['include'],function(_0x1e0acb){return{'model':db[_0x1e0acb[_0x673e('0x23')]],'as':_0x1e0acb['as'],'attributes':_0x1e0acb['attributes'],'include':_0x1e0acb[_0x673e('0x21')]?_[_0x673e('0x22')](_0x1e0acb[_0x673e('0x21')],function(_0x29f42d){return{'model':db[_0x29f42d[_0x673e('0x23')]],'as':_0x29f42d['as'],'attributes':_0x29f42d[_0x673e('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x673e('0x11')](function(_0x5d1b79){logger[_0x673e('0x12')](_0x673e('0x1a'),_0x2eb41a);logger[_0x673e('0x24')](_0x673e('0x1a'),_0x2eb41a,JSON['stringify'](_0x5d1b79));_0x5951aa(_0x5d1b79);})[_0x673e('0x19')](function(_0x444dee){logger[_0x673e('0x15')](_0x673e('0x1a'),_0x444dee[_0x673e('0x17')],_0x2eb41a);_0x4ccbe4(_0x4a94d2['error'](0x1f4,_0x444dee[_0x673e('0x17')]));});});};exports[_0x673e('0x25')]=function(_0x2ae873){var _0x49e3f8=this;return new Promise(function(_0x49200c,_0x19b3ac){return db[_0x673e('0x26')]['find']({'raw':_0x2ae873['options']?_0x2ae873[_0x673e('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x2ae873[_0x673e('0x1c')]?_0x2ae873[_0x673e('0x1c')][_0x673e('0x1e')]||null:null,'attributes':_0x2ae873[_0x673e('0x1c')]?_0x2ae873[_0x673e('0x1c')][_0x673e('0x1f')]||null:null,'include':_0x2ae873['options']?_0x2ae873[_0x673e('0x1c')][_0x673e('0x21')]?_['map'](_0x2ae873[_0x673e('0x1c')][_0x673e('0x21')],function(_0x58a888){return{'model':db[_0x58a888[_0x673e('0x23')]],'as':_0x58a888['as'],'attributes':_0x58a888['attributes'],'include':_0x58a888['include']?_['map'](_0x58a888[_0x673e('0x21')],function(_0x44e30a){return{'model':db[_0x44e30a['model']],'as':_0x44e30a['as'],'attributes':_0x44e30a['attributes'],'include':_0x44e30a[_0x673e('0x21')]?_[_0x673e('0x22')](_0x44e30a[_0x673e('0x21')],function(_0x115056){return{'model':db[_0x115056[_0x673e('0x23')]],'as':_0x115056['as'],'attributes':_0x115056['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x46c379){logger[_0x673e('0x12')](_0x673e('0x25'),_0x2ae873);logger[_0x673e('0x24')](_0x673e('0x25'),_0x2ae873,JSON[_0x673e('0x27')](_0x46c379));_0x49200c(_0x46c379);})[_0x673e('0x19')](function(_0x566cdc){logger[_0x673e('0x15')](_0x673e('0x25'),_0x566cdc[_0x673e('0x17')],_0x2ae873);_0x19b3ac(_0x49e3f8[_0x673e('0x15')](0x1f4,_0x566cdc[_0x673e('0x17')]));});});}; \ No newline at end of file +var _0xecf8=['lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','socket.io-emitter','./voiceQueue.socket','register','request','then','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','GetVoiceQueue','findAll','options','where','limit','include','map','model','attributes','catch','ShowVoiceQueue','VoiceQueue','find','raw'];(function(_0x13b948,_0x2a5a86){var _0x2f0044=function(_0xc63313){while(--_0xc63313){_0x13b948['push'](_0x13b948['shift']());}};_0x2f0044(++_0x2a5a86);}(_0xecf8,0x1ce));var _0x8ecf=function(_0x3635b3,_0x25d25c){_0x3635b3=_0x3635b3-0x0;var _0x23ce05=_0xecf8[_0x3635b3];return _0x23ce05;};'use strict';var _=require(_0x8ecf('0x0'));var util=require(_0x8ecf('0x1'));var moment=require('moment');var BPromise=require(_0x8ecf('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8ecf('0x3'));var db=require(_0x8ecf('0x4'))['db'];var utils=require(_0x8ecf('0x5'));var logger=require(_0x8ecf('0x6'))(_0x8ecf('0x7'));var config=require('../../config/environment');var jayson=require(_0x8ecf('0x8'));var client=jayson[_0x8ecf('0x9')][_0x8ecf('0xa')]({'port':0x232a});config[_0x8ecf('0xb')]=_[_0x8ecf('0xc')](config[_0x8ecf('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x8ecf('0xd'))(new Redis(config[_0x8ecf('0xb')]));require(_0x8ecf('0xe'))[_0x8ecf('0xf')](socket);function respondWithRpcPromise(_0x407206,_0x232bf7,_0x51b7a5){return new BPromise(function(_0x502cea,_0x435faa){return client[_0x8ecf('0x10')](_0x407206,_0x51b7a5)[_0x8ecf('0x11')](function(_0x23a878){logger['info'](_0x8ecf('0x12'),_0x232bf7,_0x8ecf('0x13'));logger[_0x8ecf('0x14')](_0x8ecf('0x15'),_0x232bf7,_0x8ecf('0x13'),JSON[_0x8ecf('0x16')](_0x23a878));if(_0x23a878[_0x8ecf('0x17')]){if(_0x23a878[_0x8ecf('0x17')][_0x8ecf('0x18')]===0x1f4){logger[_0x8ecf('0x17')]('VoiceQueue,\x20%s,\x20%s',_0x232bf7,_0x23a878['error'][_0x8ecf('0x19')]);return _0x435faa(_0x23a878[_0x8ecf('0x17')][_0x8ecf('0x19')]);}logger[_0x8ecf('0x17')](_0x8ecf('0x12'),_0x232bf7,_0x23a878[_0x8ecf('0x17')][_0x8ecf('0x19')]);return _0x502cea(_0x23a878[_0x8ecf('0x17')][_0x8ecf('0x19')]);}else{logger[_0x8ecf('0x1a')](_0x8ecf('0x12'),_0x232bf7,_0x8ecf('0x13'));_0x502cea(_0x23a878[_0x8ecf('0x1b')][_0x8ecf('0x19')]);}})['catch'](function(_0x8f65a7){logger[_0x8ecf('0x17')](_0x8ecf('0x12'),_0x232bf7,_0x8f65a7);_0x435faa(_0x8f65a7);});});}exports[_0x8ecf('0x1c')]=function(_0x35f48b){var _0xb71af2=this;return new Promise(function(_0x57ca57,_0x5068d0){return db['VoiceQueue'][_0x8ecf('0x1d')]({'raw':_0x35f48b[_0x8ecf('0x1e')]?_0x35f48b[_0x8ecf('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x35f48b['options']?_0x35f48b[_0x8ecf('0x1e')][_0x8ecf('0x1f')]||null:null,'attributes':_0x35f48b[_0x8ecf('0x1e')]?_0x35f48b['options']['attributes']||null:null,'limit':_0x35f48b[_0x8ecf('0x1e')]?_0x35f48b[_0x8ecf('0x1e')][_0x8ecf('0x20')]||null:null,'include':_0x35f48b[_0x8ecf('0x1e')]?_0x35f48b[_0x8ecf('0x1e')][_0x8ecf('0x21')]?_[_0x8ecf('0x22')](_0x35f48b[_0x8ecf('0x1e')][_0x8ecf('0x21')],function(_0x1d3496){return{'model':db[_0x1d3496[_0x8ecf('0x23')]],'as':_0x1d3496['as'],'attributes':_0x1d3496['attributes'],'include':_0x1d3496[_0x8ecf('0x21')]?_[_0x8ecf('0x22')](_0x1d3496['include'],function(_0xc9685c){return{'model':db[_0xc9685c[_0x8ecf('0x23')]],'as':_0xc9685c['as'],'attributes':_0xc9685c[_0x8ecf('0x24')],'include':_0xc9685c[_0x8ecf('0x21')]?_['map'](_0xc9685c[_0x8ecf('0x21')],function(_0x384991){return{'model':db[_0x384991['model']],'as':_0x384991['as'],'attributes':_0x384991[_0x8ecf('0x24')]};}):[]};}):[]};}):[]:[]})[_0x8ecf('0x11')](function(_0x2ea3ac){logger['info'](_0x8ecf('0x1c'),_0x35f48b);logger[_0x8ecf('0x14')](_0x8ecf('0x1c'),_0x35f48b,JSON['stringify'](_0x2ea3ac));_0x57ca57(_0x2ea3ac);})[_0x8ecf('0x25')](function(_0x34b95d){logger[_0x8ecf('0x17')](_0x8ecf('0x1c'),_0x34b95d['message'],_0x35f48b);_0x5068d0(_0xb71af2['error'](0x1f4,_0x34b95d[_0x8ecf('0x19')]));});});};exports[_0x8ecf('0x26')]=function(_0x5849f0){var _0x498f2f=this;return new Promise(function(_0x51f433,_0x56f042){return db[_0x8ecf('0x27')][_0x8ecf('0x28')]({'raw':_0x5849f0[_0x8ecf('0x1e')]?_0x5849f0[_0x8ecf('0x1e')][_0x8ecf('0x29')]===undefined?!![]:![]:!![],'where':_0x5849f0['options']?_0x5849f0[_0x8ecf('0x1e')][_0x8ecf('0x1f')]||null:null,'attributes':_0x5849f0[_0x8ecf('0x1e')]?_0x5849f0[_0x8ecf('0x1e')][_0x8ecf('0x24')]||null:null,'include':_0x5849f0[_0x8ecf('0x1e')]?_0x5849f0[_0x8ecf('0x1e')][_0x8ecf('0x21')]?_[_0x8ecf('0x22')](_0x5849f0[_0x8ecf('0x1e')][_0x8ecf('0x21')],function(_0x107845){return{'model':db[_0x107845[_0x8ecf('0x23')]],'as':_0x107845['as'],'attributes':_0x107845[_0x8ecf('0x24')],'include':_0x107845[_0x8ecf('0x21')]?_[_0x8ecf('0x22')](_0x107845['include'],function(_0x4a3e9a){return{'model':db[_0x4a3e9a['model']],'as':_0x4a3e9a['as'],'attributes':_0x4a3e9a[_0x8ecf('0x24')],'include':_0x4a3e9a['include']?_['map'](_0x4a3e9a[_0x8ecf('0x21')],function(_0x7d21e0){return{'model':db[_0x7d21e0[_0x8ecf('0x23')]],'as':_0x7d21e0['as'],'attributes':_0x7d21e0[_0x8ecf('0x24')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x593b01){logger[_0x8ecf('0x1a')]('ShowVoiceQueue',_0x5849f0);logger[_0x8ecf('0x14')](_0x8ecf('0x26'),_0x5849f0,JSON[_0x8ecf('0x16')](_0x593b01));_0x51f433(_0x593b01);})['catch'](function(_0x3179aa){logger[_0x8ecf('0x17')](_0x8ecf('0x26'),_0x3179aa[_0x8ecf('0x19')],_0x5849f0);_0x56f042(_0x498f2f['error'](0x1f4,_0x3179aa[_0x8ecf('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 906927c..03ca3f8 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 _0x24e4=['remove','update','removeListener','register','length','voiceQueue:','./voiceQueue.events','save'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x24e4,0x10e));var _0x424e=function(_0x4dc7b9,_0x319d5a){_0x4dc7b9=_0x4dc7b9-0x0;var _0x3ab114=_0x24e4[_0x4dc7b9];return _0x3ab114;};'use strict';var VoiceQueueEvents=require(_0x424e('0x0'));var events=[_0x424e('0x1'),_0x424e('0x2'),_0x424e('0x3')];function createListener(_0x264a8b,_0x2d17a9){return function(_0x2fe1db){_0x2d17a9['emit'](_0x264a8b,_0x2fe1db);};}function removeListener(_0x3e2598,_0x26a982){return function(){VoiceQueueEvents[_0x424e('0x4')](_0x3e2598,_0x26a982);};}exports[_0x424e('0x5')]=function(_0x267f56){for(var _0x2ae6d0=0x0,_0x1ce650=events[_0x424e('0x6')];_0x2ae6d0<_0x1ce650;_0x2ae6d0++){var _0x261964=events[_0x2ae6d0];var _0x53d6a4=createListener(_0x424e('0x7')+_0x261964,_0x267f56);VoiceQueueEvents['on'](_0x261964,_0x53d6a4);}}; \ No newline at end of file +var _0xe6fa=['./voiceQueue.events','save','update','voiceQueue:'];(function(_0x4b03bb,_0x1d804f){var _0x2b8eb8=function(_0x2ba2f6){while(--_0x2ba2f6){_0x4b03bb['push'](_0x4b03bb['shift']());}};_0x2b8eb8(++_0x1d804f);}(_0xe6fa,0x154));var _0xae6f=function(_0x23db19,_0x4ac567){_0x23db19=_0x23db19-0x0;var _0x3becef=_0xe6fa[_0x23db19];return _0x3becef;};'use strict';var VoiceQueueEvents=require(_0xae6f('0x0'));var events=[_0xae6f('0x1'),'remove',_0xae6f('0x2')];function createListener(_0x1d1712,_0xce843b){return function(_0x42740f){_0xce843b['emit'](_0x1d1712,_0x42740f);};}function removeListener(_0x2cafed,_0x1dda2e){return function(){VoiceQueueEvents['removeListener'](_0x2cafed,_0x1dda2e);};}exports['register']=function(_0x3c9b76){for(var _0x410f34=0x0,_0x16d124=events['length'];_0x410f34<_0x16d124;_0x410f34++){var _0x23c5cb=events[_0x410f34];var _0x324df9=createListener(_0xae6f('0x3')+_0x23c5cb,_0x3c9b76);VoiceQueueEvents['on'](_0x23c5cb,_0x324df9);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 74bd8b3..9134fae 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 _0x7278=['../../config/environment','./voiceQueueReport.controller','get','isAuthenticated','index','/describe','describe','/index','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7278,0x161));var _0x8727=function(_0x33fa8b,_0x29d414){_0x33fa8b=_0x33fa8b-0x0;var _0x54937d=_0x7278[_0x33fa8b];return _0x54937d;};'use strict';var multer=require(_0x8727('0x0'));var util=require(_0x8727('0x1'));var path=require(_0x8727('0x2'));var timeout=require(_0x8727('0x3'));var express=require(_0x8727('0x4'));var router=express['Router']();var auth=require(_0x8727('0x5'));var interaction=require(_0x8727('0x6'));var config=require(_0x8727('0x7'));var controller=require(_0x8727('0x8'));router[_0x8727('0x9')]('/',auth[_0x8727('0xa')](),controller[_0x8727('0xb')]);router['get'](_0x8727('0xc'),auth[_0x8727('0xa')](),controller[_0x8727('0xd')]);router[_0x8727('0x9')](_0x8727('0xe'),auth['isAuthenticated'](),controller['getVoiceQueuesReport']);router['get'](_0x8727('0xf'),auth[_0x8727('0xa')](),controller[_0x8727('0x10')]);router[_0x8727('0x11')]('/',auth[_0x8727('0xa')](),controller[_0x8727('0x12')]);router[_0x8727('0x13')](_0x8727('0xf'),auth['isAuthenticated'](),controller[_0x8727('0x14')]);router[_0x8727('0x15')](_0x8727('0xf'),auth['isAuthenticated'](),controller[_0x8727('0x16')]);module[_0x8727('0x17')]=router; \ No newline at end of file +var _0x2c8f=['delete','destroy','exports','util','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/index','getVoiceQueuesReport','show','post','create','put','/:id'];(function(_0x1d4449,_0x495153){var _0x4dcde3=function(_0x36d549){while(--_0x36d549){_0x1d4449['push'](_0x1d4449['shift']());}};_0x4dcde3(++_0x495153);}(_0x2c8f,0x192));var _0xf2c8=function(_0xc7d879,_0x3e1e75){_0xc7d879=_0xc7d879-0x0;var _0x4749cb=_0x2c8f[_0xc7d879];return _0x4749cb;};'use strict';var multer=require('multer');var util=require(_0xf2c8('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xf2c8('0x1')]();var auth=require(_0xf2c8('0x2'));var interaction=require(_0xf2c8('0x3'));var config=require('../../config/environment');var controller=require('./voiceQueueReport.controller');router[_0xf2c8('0x4')]('/',auth[_0xf2c8('0x5')](),controller[_0xf2c8('0x6')]);router[_0xf2c8('0x4')](_0xf2c8('0x7'),auth['isAuthenticated'](),controller[_0xf2c8('0x8')]);router[_0xf2c8('0x4')](_0xf2c8('0x9'),auth[_0xf2c8('0x5')](),controller[_0xf2c8('0xa')]);router[_0xf2c8('0x4')]('/:id',auth[_0xf2c8('0x5')](),controller[_0xf2c8('0xb')]);router[_0xf2c8('0xc')]('/',auth[_0xf2c8('0x5')](),controller[_0xf2c8('0xd')]);router[_0xf2c8('0xe')](_0xf2c8('0xf'),auth[_0xf2c8('0x5')](),controller['update']);router[_0xf2c8('0x10')]('/:id',auth[_0xf2c8('0x5')](),controller[_0xf2c8('0x11')]);module[_0xf2c8('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index d9d72aa..c6b4fca 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 _0x707c=['format','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue','queuecallerleaveAt','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','moment','exports','STRING','DATE','getDataValue'];(function(_0x256ffc,_0x479116){var _0x3a8fee=function(_0x2c1fcc){while(--_0x2c1fcc){_0x256ffc['push'](_0x256ffc['shift']());}};_0x3a8fee(++_0x479116);}(_0x707c,0x6b));var _0xc707=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0x707c[_0x46aff0];return _0x9d78cf;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xc707('0x0'));module[_0xc707('0x1')]={'type':{'type':Sequelize[_0xc707('0x2')]},'uniqueid':{'type':Sequelize[_0xc707('0x2')]},'calleridnum':{'type':Sequelize[_0xc707('0x2')]},'calleridname':{'type':Sequelize[_0xc707('0x2')]},'queue':{'type':Sequelize[_0xc707('0x2')]},'queuecallerjoinAt':{'type':Sequelize[_0xc707('0x3')]},'queuecallerleaveAt':{'type':Sequelize[_0xc707('0x3')],'set':function(_0x9db1ee){var _0x58fa05=moment(_0x9db1ee);var _0x4f8a1e=moment(this[_0xc707('0x4')]('queuecallerjoinAt'))[_0xc707('0x5')](_0xc707('0x6'));var _0x45b824=_0x58fa05[_0xc707('0x7')](_0x4f8a1e,_0xc707('0x8'));this[_0xc707('0x9')](_0xc707('0xa'),_0x9db1ee);this[_0xc707('0x9')]('holdtime',_0x45b824||null);}},'position':{'type':Sequelize['INTEGER']},'count':{'type':Sequelize[_0xc707('0xb')]},'queuecallerabandon':{'type':Sequelize[_0xc707('0xc')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0xc707('0x3')]},'queuecallercomplete':{'type':Sequelize[_0xc707('0xc')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0xc707('0x3')]},'queuecallerexit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0xc707('0x3')]},'queuecallerexitreason':{'type':Sequelize[_0xc707('0x2')],'comment':'COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'},'originalposition':{'type':Sequelize['INTEGER']},'channel':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0xc707('0x2')]},'connectedlinename':{'type':Sequelize[_0xc707('0x2')]},'accountcode':{'type':Sequelize[_0xc707('0x2')]},'context':{'type':Sequelize[_0xc707('0x2')]},'exten':{'type':Sequelize[_0xc707('0x2')]},'priority':{'type':Sequelize['STRING']},'holdtime':{'type':Sequelize[_0xc707('0xb')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0xc707('0x2')]},'transfer':{'type':Sequelize[_0xc707('0xc')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xc707('0x2')],'comment':_0xc707('0xd')},'transferexten':{'type':Sequelize[_0xc707('0x2')]},'transferuniqueid':{'type':Sequelize[_0xc707('0x2')]},'disposition':{'type':Sequelize[_0xc707('0x2')]},'queuecallerenterreason':{'type':Sequelize[_0xc707('0xb')],'defaultValue':0x0}}; \ No newline at end of file +var _0x3630=['COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','exports','STRING','DATE','getDataValue','queuecallerjoinAt','format','holdtime','INTEGER','BOOLEAN'];(function(_0x28ac38,_0x4cd366){var _0x252979=function(_0x6db242){while(--_0x6db242){_0x28ac38['push'](_0x28ac38['shift']());}};_0x252979(++_0x4cd366);}(_0x3630,0x199));var _0x0363=function(_0x29a74e,_0x50c869){_0x29a74e=_0x29a74e-0x0;var _0x286a70=_0x3630[_0x29a74e];return _0x286a70;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0x0363('0x0')]={'type':{'type':Sequelize[_0x0363('0x1')]},'uniqueid':{'type':Sequelize[_0x0363('0x1')]},'calleridnum':{'type':Sequelize[_0x0363('0x1')]},'calleridname':{'type':Sequelize[_0x0363('0x1')]},'queue':{'type':Sequelize[_0x0363('0x1')]},'queuecallerjoinAt':{'type':Sequelize[_0x0363('0x2')]},'queuecallerleaveAt':{'type':Sequelize[_0x0363('0x2')],'set':function(_0x3c8e93){var _0xee3d91=moment(_0x3c8e93);var _0x5eb5ff=moment(this[_0x0363('0x3')](_0x0363('0x4')))[_0x0363('0x5')]('YYYY-MM-DD\x20HH:mm:ss');var _0x3b1a05=_0xee3d91['diff'](_0x5eb5ff,'seconds');this['setDataValue']('queuecallerleaveAt',_0x3c8e93);this['setDataValue'](_0x0363('0x6'),_0x3b1a05||null);}},'position':{'type':Sequelize[_0x0363('0x7')]},'count':{'type':Sequelize[_0x0363('0x7')]},'queuecallerabandon':{'type':Sequelize[_0x0363('0x8')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize['DATE']},'queuecallercomplete':{'type':Sequelize[_0x0363('0x8')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize['DATE']},'queuecallerexit':{'type':Sequelize[_0x0363('0x8')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x0363('0x2')]},'queuecallerexitreason':{'type':Sequelize['STRING'],'comment':_0x0363('0x9')},'originalposition':{'type':Sequelize[_0x0363('0x7')]},'channel':{'type':Sequelize[_0x0363('0x1')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x0363('0x1')]},'accountcode':{'type':Sequelize[_0x0363('0x1')]},'context':{'type':Sequelize[_0x0363('0x1')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x0363('0x1')]},'holdtime':{'type':Sequelize[_0x0363('0x7')]},'mohtime':{'type':Sequelize[_0x0363('0x7')],'defaultValue':0x0},'assigned':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x0363('0x1')]},'transfer':{'type':Sequelize[_0x0363('0x8')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x0363('0x1')],'comment':_0x0363('0xa')},'transferexten':{'type':Sequelize[_0x0363('0x1')]},'transferuniqueid':{'type':Sequelize[_0x0363('0x1')]},'disposition':{'type':Sequelize[_0x0363('0x1')]},'queuecallerenterreason':{'type':Sequelize[_0x0363('0x7')],'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 0deddcf..c94a161 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 _0x1261=['includeAll','find','catch','create','body','describe','getVoiceQueuesReport','hasOwnProperty','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','sendStatus','status','json','offset','set','Content-Range','reject','save','update','destroy','then','end','error','name','index','map','rawAttributes','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','limit','order','sort','pick','filter','merge','where','type','options','VoiceQueueReport','count','include','findAll','rows','params'];(function(_0x5eed8c,_0x4cc31a){var _0x2fec4e=function(_0x523aed){while(--_0x523aed){_0x5eed8c['push'](_0x5eed8c['shift']());}};_0x2fec4e(++_0x4cc31a);}(_0x1261,0x144));var _0x1126=function(_0x49f913,_0x12ccd8){_0x49f913=_0x49f913-0x0;var _0xf48ea5=_0x1261[_0x49f913];return _0xf48ea5;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x1126('0x0'));var rimraf=require(_0x1126('0x1'));var zipdir=require(_0x1126('0x2'));var jsonpatch=require(_0x1126('0x3'));var rp=require(_0x1126('0x4'));var moment=require(_0x1126('0x5'));var BPromise=require(_0x1126('0x6'));var Mustache=require(_0x1126('0x7'));var util=require(_0x1126('0x8'));var path=require(_0x1126('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x1126('0xa'));var fs=require('fs');var _=require(_0x1126('0xb'));var squel=require('squel');var crypto=require(_0x1126('0xc'));var jsforce=require(_0x1126('0xd'));var deskjs=require(_0x1126('0xe'));var toCsv=require(_0x1126('0xf'));var querystring=require(_0x1126('0x10'));var Papa=require('papaparse');var Redis=require(_0x1126('0x11'));var authService=require(_0x1126('0x12'));var qs=require(_0x1126('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1126('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x1126('0x15'));var config=require('../../config/environment');var db=require(_0x1126('0x16'))['db'];config[_0x1126('0x17')]=_[_0x1126('0x18')](config[_0x1126('0x17')],{'host':_0x1126('0x19'),'port':0x18eb});var socket=require(_0x1126('0x1a'))(new Redis(config[_0x1126('0x17')]));require(_0x1126('0x1b'))[_0x1126('0x1c')](socket);function respondWithStatusCode(_0x53a8f0,_0x5de9a7){_0x5de9a7=_0x5de9a7||0xcc;return function(_0x1af673){if(_0x1af673){return _0x53a8f0[_0x1126('0x1d')](_0x5de9a7);}return _0x53a8f0[_0x1126('0x1e')](_0x5de9a7)['end']();};}function respondWithResult(_0x45149c,_0x4794a7){_0x4794a7=_0x4794a7||0xc8;return function(_0x35fe9f){if(_0x35fe9f){return _0x45149c[_0x1126('0x1e')](_0x4794a7)[_0x1126('0x1f')](_0x35fe9f);}};}function respondWithFilteredResult(_0x4e1c97,_0x245cd7){return function(_0x1695f6){if(_0x1695f6){var _0x4a7b49=_0x1695f6['count'],_0x4d2b38=_0x245cd7['offset'],_0x22ae0b=_0x245cd7[_0x1126('0x20')]+_0x245cd7['limit'],_0x2b2487;if(_0x22ae0b>=_0x4a7b49){_0x22ae0b=_0x4a7b49;_0x2b2487=0xc8;}else{_0x2b2487=0xce;}_0x4e1c97[_0x1126('0x1e')](_0x2b2487);return _0x4e1c97[_0x1126('0x21')](_0x1126('0x22'),_0x4d2b38+'-'+_0x22ae0b+'/'+_0x4a7b49)['json'](_0x1695f6);}return null;};}function patchUpdates(_0x2a08ba){return function(_0x49d209){try{jsonpatch['apply'](_0x49d209,_0x2a08ba,!![]);}catch(_0x30f6b3){return BPromise[_0x1126('0x23')](_0x30f6b3);}return _0x49d209[_0x1126('0x24')]();};}function saveUpdates(_0x36d254,_0x526ca1){return function(_0x29ab60){if(_0x29ab60){return _0x29ab60[_0x1126('0x25')](_0x36d254)['then'](function(_0x2175fa){return _0x2175fa;});}return null;};}function removeEntity(_0x59cd8e,_0x529dd9){return function(_0x4b57ab){if(_0x4b57ab){return _0x4b57ab[_0x1126('0x26')]()[_0x1126('0x27')](function(){_0x59cd8e[_0x1126('0x1e')](0xcc)[_0x1126('0x28')]();});}};}function handleEntityNotFound(_0x566c09,_0x1b07a7){return function(_0xea0971){if(!_0xea0971){_0x566c09[_0x1126('0x1d')](0x194);}return _0xea0971;};}function handleError(_0x589725,_0x35eec3){_0x35eec3=_0x35eec3||0x1f4;return function(_0x375e59){logger[_0x1126('0x29')](_0x375e59['stack']);if(_0x375e59['name']){delete _0x375e59[_0x1126('0x2a')];}_0x589725[_0x1126('0x1e')](_0x35eec3)['send'](_0x375e59);};}exports[_0x1126('0x2b')]=function(_0x23d2bc,_0x4a334a){var _0x3fa694={},_0x4bf807={},_0xc62460={'count':0x0,'rows':[]};var _0x4bd50b=_[_0x1126('0x2c')](db['VoiceQueueReport'][_0x1126('0x2d')],function(_0x5f2611){return{'name':_0x5f2611['fieldName'],'type':_0x5f2611['type'][_0x1126('0x2e')]};});_0x4bf807[_0x1126('0x2f')]=_[_0x1126('0x2c')](_0x4bd50b,'name');_0x4bf807[_0x1126('0x30')]=_[_0x1126('0x31')](_0x23d2bc['query']);_0x4bf807[_0x1126('0x32')]=_[_0x1126('0x33')](_0x4bf807[_0x1126('0x2f')],_0x4bf807[_0x1126('0x30')]);_0x3fa694['attributes']=_['intersection'](_0x4bf807[_0x1126('0x2f')],qs[_0x1126('0x34')](_0x23d2bc[_0x1126('0x30')][_0x1126('0x34')]));_0x3fa694['attributes']=_0x3fa694[_0x1126('0x35')][_0x1126('0x36')]?_0x3fa694[_0x1126('0x35')]:_0x4bf807[_0x1126('0x2f')];if(!_0x23d2bc[_0x1126('0x30')]['hasOwnProperty'](_0x1126('0x37'))){_0x3fa694[_0x1126('0x38')]=qs[_0x1126('0x38')](_0x23d2bc[_0x1126('0x30')]['limit']);_0x3fa694['offset']=qs[_0x1126('0x20')](_0x23d2bc[_0x1126('0x30')]['offset']);}_0x3fa694[_0x1126('0x39')]=qs[_0x1126('0x3a')](_0x23d2bc[_0x1126('0x30')]['sort']);_0x3fa694['where']=qs[_0x1126('0x32')](_[_0x1126('0x3b')](_0x23d2bc[_0x1126('0x30')],_0x4bf807[_0x1126('0x32')]));if(_0x23d2bc['query'][_0x1126('0x3c')]){_0x3fa694['where']=_[_0x1126('0x3d')](_0x3fa694[_0x1126('0x3e')],{'$or':_[_0x1126('0x2c')](_0x4bd50b,function(_0x1ea702){if(_0x1ea702[_0x1126('0x3f')]!=='VIRTUAL'){var _0x1da59f={};_0x1da59f[_0x1ea702[_0x1126('0x2a')]]={'$like':'%'+_0x23d2bc[_0x1126('0x30')][_0x1126('0x3c')]+'%'};return _0x1da59f;}})});}_0x3fa694=_[_0x1126('0x3d')]({},_0x3fa694,_0x23d2bc[_0x1126('0x40')]);var _0x3052f9={'where':_0x3fa694['where']};return db[_0x1126('0x41')][_0x1126('0x42')](_0x3052f9)[_0x1126('0x27')](function(_0xf3a0bd){_0xc62460[_0x1126('0x42')]=_0xf3a0bd;if(_0x23d2bc['query']['includeAll']){_0x3fa694[_0x1126('0x43')]=[{'all':!![]}];}return db[_0x1126('0x41')][_0x1126('0x44')](_0x3fa694);})[_0x1126('0x27')](function(_0x18b496){_0xc62460[_0x1126('0x45')]=_0x18b496;return _0xc62460;})['then'](respondWithFilteredResult(_0x4a334a,_0x3fa694))['catch'](handleError(_0x4a334a,null));};exports['show']=function(_0xb8054e,_0x5d4194){var _0xf84005={'raw':![],'where':{'id':_0xb8054e[_0x1126('0x46')]['id']}},_0x462da8={};_0x462da8[_0x1126('0x2f')]=_['keys'](db['VoiceQueueReport'][_0x1126('0x2d')]);_0x462da8[_0x1126('0x30')]=_[_0x1126('0x31')](_0xb8054e['query']);_0x462da8[_0x1126('0x32')]=_['intersection'](_0x462da8[_0x1126('0x2f')],_0x462da8['query']);_0xf84005[_0x1126('0x35')]=_[_0x1126('0x33')](_0x462da8[_0x1126('0x2f')],qs['fields'](_0xb8054e[_0x1126('0x30')][_0x1126('0x34')]));_0xf84005[_0x1126('0x35')]=_0xf84005['attributes']['length']?_0xf84005['attributes']:_0x462da8[_0x1126('0x2f')];if(_0xb8054e['query'][_0x1126('0x47')]){_0xf84005['include']=[{'all':!![]}];}_0xf84005=_[_0x1126('0x3d')]({},_0xf84005,_0xb8054e[_0x1126('0x40')]);return db[_0x1126('0x41')][_0x1126('0x48')](_0xf84005)[_0x1126('0x27')](handleEntityNotFound(_0x5d4194,null))['then'](respondWithResult(_0x5d4194,null))[_0x1126('0x49')](handleError(_0x5d4194,null));};exports[_0x1126('0x4a')]=function(_0x5111d3,_0x1a15f8){return db[_0x1126('0x41')]['create'](_0x5111d3[_0x1126('0x4b')],{})[_0x1126('0x27')](respondWithResult(_0x1a15f8,0xc9))['catch'](handleError(_0x1a15f8,null));};exports[_0x1126('0x25')]=function(_0xbdde58,_0x213a76){if(_0xbdde58['body']['id']){delete _0xbdde58[_0x1126('0x4b')]['id'];}return db[_0x1126('0x41')][_0x1126('0x48')]({'where':{'id':_0xbdde58[_0x1126('0x46')]['id']}})[_0x1126('0x27')](handleEntityNotFound(_0x213a76,null))[_0x1126('0x27')](saveUpdates(_0xbdde58[_0x1126('0x4b')],null))[_0x1126('0x27')](respondWithResult(_0x213a76,null))['catch'](handleError(_0x213a76,null));};exports[_0x1126('0x26')]=function(_0x5a2287,_0x40168e){return db[_0x1126('0x41')]['find']({'where':{'id':_0x5a2287['params']['id']}})[_0x1126('0x27')](handleEntityNotFound(_0x40168e,null))[_0x1126('0x27')](removeEntity(_0x40168e,null))[_0x1126('0x49')](handleError(_0x40168e,null));};exports['describe']=function(_0x3cb44c,_0x3506d7){return db[_0x1126('0x41')][_0x1126('0x4c')]()['then'](respondWithResult(_0x3506d7,null))[_0x1126('0x49')](handleError(_0x3506d7,null));};exports[_0x1126('0x4d')]=function(_0x5c36b9,_0x4bcc08){var _0x4abb4d={},_0x526b07={},_0x386c10={'count':0x0,'rows':[]};_0x526b07[_0x1126('0x2f')]=_['keys'](db[_0x1126('0x41')][_0x1126('0x2d')]);_0x526b07[_0x1126('0x30')]=_[_0x1126('0x31')](_0x5c36b9[_0x1126('0x30')]);_0x526b07['filters']=_[_0x1126('0x33')](_0x526b07[_0x1126('0x2f')],_0x526b07['query']);_0x4abb4d[_0x1126('0x35')]=_[_0x1126('0x33')](_0x526b07[_0x1126('0x2f')],qs[_0x1126('0x34')](_0x5c36b9[_0x1126('0x30')]['fields']));_0x4abb4d[_0x1126('0x35')]=_0x4abb4d['attributes'][_0x1126('0x36')]?_0x4abb4d[_0x1126('0x35')]:_0x526b07[_0x1126('0x2f')];if(!_0x5c36b9['query'][_0x1126('0x4e')](_0x1126('0x37'))){_0x4abb4d['limit']=qs[_0x1126('0x38')](_0x5c36b9[_0x1126('0x30')][_0x1126('0x38')]);_0x4abb4d['offset']=qs[_0x1126('0x20')](_0x5c36b9[_0x1126('0x30')][_0x1126('0x20')]);}_0x4abb4d[_0x1126('0x39')]=qs[_0x1126('0x3a')](_0x5c36b9[_0x1126('0x30')][_0x1126('0x3a')]);_0x4abb4d[_0x1126('0x3e')]=qs['filters'](_[_0x1126('0x3b')](_0x5c36b9[_0x1126('0x30')],_0x526b07[_0x1126('0x32')]));if(_0x5c36b9[_0x1126('0x30')][_0x1126('0x3c')]){_0x4abb4d['where']=_[_0x1126('0x3d')](_0x4abb4d[_0x1126('0x3e')],{'$or':_['map'](_0x4abb4d[_0x1126('0x35')],function(_0x5246aa){var _0x272274={};_0x272274[_0x5246aa]={'$like':'%'+_0x5c36b9[_0x1126('0x30')]['filter']+'%'};return _0x272274;})});}_0x4abb4d=_[_0x1126('0x3d')]({},_0x4abb4d,_0x5c36b9[_0x1126('0x40')]);var _0x375b76={'where':_0x4abb4d['where']};return db[_0x1126('0x41')]['count'](_0x375b76)['then'](function(_0xbdc58){_0x386c10[_0x1126('0x42')]=_0xbdc58;if(_0x5c36b9[_0x1126('0x30')][_0x1126('0x47')]){_0x4abb4d[_0x1126('0x43')]=[{'all':!![]}];}return db[_0x1126('0x41')][_0x1126('0x44')](_0x4abb4d);})['then'](function(_0x191307){_0x386c10[_0x1126('0x45')]=_0x191307;return _0x386c10;})[_0x1126('0x27')](respondWithFilteredResult(_0x4bcc08,_0x4abb4d,_0x1126('0x4d')))[_0x1126('0x49')](handleError(_0x4bcc08,null,_0x1126('0x4d')));}; \ No newline at end of file +var _0x66fa=['Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','VoiceQueueReport','rawAttributes','fieldName','type','model','map','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','merge','where','includeAll','include','findAll','rows','show','params','intersection','options','find','catch','create','body','getVoiceQueuesReport','pick','filter','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','defaults','redis','localhost','./voiceQueueReport.socket','sendStatus','status','end','json','count','offset','limit','set'];(function(_0x376b45,_0x5964fb){var _0x2341b3=function(_0x5a7f01){while(--_0x5a7f01){_0x376b45['push'](_0x376b45['shift']());}};_0x2341b3(++_0x5964fb);}(_0x66fa,0x117));var _0xa66f=function(_0x34bab7,_0xedfc66){_0x34bab7=_0x34bab7-0x0;var _0x8319f7=_0x66fa[_0x34bab7];return _0x8319f7;};'use strict';var pdf=require(_0xa66f('0x0'));var emlformat=require(_0xa66f('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xa66f('0x2'));var jsonpatch=require(_0xa66f('0x3'));var rp=require(_0xa66f('0x4'));var moment=require(_0xa66f('0x5'));var BPromise=require(_0xa66f('0x6'));var Mustache=require(_0xa66f('0x7'));var util=require(_0xa66f('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0xa66f('0x9'));var ejs=require(_0xa66f('0xa'));var fs=require('fs');var _=require(_0xa66f('0xb'));var squel=require(_0xa66f('0xc'));var crypto=require(_0xa66f('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xa66f('0xe'));var toCsv=require('to-csv');var querystring=require(_0xa66f('0xf'));var Papa=require('papaparse');var Redis=require(_0xa66f('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa66f('0x11'));var logger=require(_0xa66f('0x12'))('api');var utils=require(_0xa66f('0x13'));var config=require('../../config/environment');var db=require(_0xa66f('0x14'))['db'];config['redis']=_[_0xa66f('0x15')](config[_0xa66f('0x16')],{'host':_0xa66f('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xa66f('0x18'))['register'](socket);function respondWithStatusCode(_0x528427,_0x5a7b16){_0x5a7b16=_0x5a7b16||0xcc;return function(_0x3ac0ac){if(_0x3ac0ac){return _0x528427[_0xa66f('0x19')](_0x5a7b16);}return _0x528427[_0xa66f('0x1a')](_0x5a7b16)[_0xa66f('0x1b')]();};}function respondWithResult(_0xd348f9,_0x567d4f){_0x567d4f=_0x567d4f||0xc8;return function(_0x5510dc){if(_0x5510dc){return _0xd348f9[_0xa66f('0x1a')](_0x567d4f)[_0xa66f('0x1c')](_0x5510dc);}};}function respondWithFilteredResult(_0x295acf,_0x403f4d){return function(_0x5c67f5){if(_0x5c67f5){var _0x1cbe64=_0x5c67f5[_0xa66f('0x1d')],_0x55b59d=_0x403f4d[_0xa66f('0x1e')],_0x4a28d4=_0x403f4d[_0xa66f('0x1e')]+_0x403f4d[_0xa66f('0x1f')],_0x2f9da2;if(_0x4a28d4>=_0x1cbe64){_0x4a28d4=_0x1cbe64;_0x2f9da2=0xc8;}else{_0x2f9da2=0xce;}_0x295acf[_0xa66f('0x1a')](_0x2f9da2);return _0x295acf[_0xa66f('0x20')](_0xa66f('0x21'),_0x55b59d+'-'+_0x4a28d4+'/'+_0x1cbe64)[_0xa66f('0x1c')](_0x5c67f5);}return null;};}function patchUpdates(_0x2d9602){return function(_0x235b61){try{jsonpatch[_0xa66f('0x22')](_0x235b61,_0x2d9602,!![]);}catch(_0x3c4eb1){return BPromise[_0xa66f('0x23')](_0x3c4eb1);}return _0x235b61[_0xa66f('0x24')]();};}function saveUpdates(_0x5cd613,_0x27f570){return function(_0xc5c82e){if(_0xc5c82e){return _0xc5c82e[_0xa66f('0x25')](_0x5cd613)[_0xa66f('0x26')](function(_0x5cbd82){return _0x5cbd82;});}return null;};}function removeEntity(_0x337602,_0x473822){return function(_0x209f4d){if(_0x209f4d){return _0x209f4d[_0xa66f('0x27')]()['then'](function(){_0x337602['status'](0xcc)[_0xa66f('0x1b')]();});}};}function handleEntityNotFound(_0x598942,_0x3a3e4f){return function(_0xc661f2){if(!_0xc661f2){_0x598942[_0xa66f('0x19')](0x194);}return _0xc661f2;};}function handleError(_0x57da7f,_0x4683c7){_0x4683c7=_0x4683c7||0x1f4;return function(_0x1c2903){logger[_0xa66f('0x28')](_0x1c2903[_0xa66f('0x29')]);if(_0x1c2903[_0xa66f('0x2a')]){delete _0x1c2903[_0xa66f('0x2a')];}_0x57da7f[_0xa66f('0x1a')](_0x4683c7)[_0xa66f('0x2b')](_0x1c2903);};}exports[_0xa66f('0x2c')]=function(_0x117d03,_0x45f71c){var _0x63650b={},_0x42b966={},_0xeeb22e={'count':0x0,'rows':[]};var _0x49f615=_['map'](db[_0xa66f('0x2d')][_0xa66f('0x2e')],function(_0x55f309){return{'name':_0x55f309[_0xa66f('0x2f')],'type':_0x55f309[_0xa66f('0x30')]['key']};});_0x42b966[_0xa66f('0x31')]=_[_0xa66f('0x32')](_0x49f615,_0xa66f('0x2a'));_0x42b966[_0xa66f('0x33')]=_[_0xa66f('0x34')](_0x117d03['query']);_0x42b966[_0xa66f('0x35')]=_['intersection'](_0x42b966[_0xa66f('0x31')],_0x42b966[_0xa66f('0x33')]);_0x63650b[_0xa66f('0x36')]=_['intersection'](_0x42b966[_0xa66f('0x31')],qs[_0xa66f('0x37')](_0x117d03['query'][_0xa66f('0x37')]));_0x63650b[_0xa66f('0x36')]=_0x63650b[_0xa66f('0x36')][_0xa66f('0x38')]?_0x63650b[_0xa66f('0x36')]:_0x42b966[_0xa66f('0x31')];if(!_0x117d03[_0xa66f('0x33')][_0xa66f('0x39')](_0xa66f('0x3a'))){_0x63650b[_0xa66f('0x1f')]=qs['limit'](_0x117d03[_0xa66f('0x33')]['limit']);_0x63650b[_0xa66f('0x1e')]=qs[_0xa66f('0x1e')](_0x117d03[_0xa66f('0x33')][_0xa66f('0x1e')]);}_0x63650b[_0xa66f('0x3b')]=qs[_0xa66f('0x3c')](_0x117d03[_0xa66f('0x33')][_0xa66f('0x3c')]);_0x63650b['where']=qs[_0xa66f('0x35')](_['pick'](_0x117d03[_0xa66f('0x33')],_0x42b966[_0xa66f('0x35')]));if(_0x117d03[_0xa66f('0x33')]['filter']){_0x63650b['where']=_[_0xa66f('0x3d')](_0x63650b[_0xa66f('0x3e')],{'$or':_[_0xa66f('0x32')](_0x49f615,function(_0x1f5a5f){if(_0x1f5a5f[_0xa66f('0x30')]!=='VIRTUAL'){var _0x5cb0a9={};_0x5cb0a9[_0x1f5a5f['name']]={'$like':'%'+_0x117d03[_0xa66f('0x33')]['filter']+'%'};return _0x5cb0a9;}})});}_0x63650b=_['merge']({},_0x63650b,_0x117d03['options']);var _0x5fdc3e={'where':_0x63650b['where']};return db[_0xa66f('0x2d')][_0xa66f('0x1d')](_0x5fdc3e)[_0xa66f('0x26')](function(_0x1647a0){_0xeeb22e[_0xa66f('0x1d')]=_0x1647a0;if(_0x117d03[_0xa66f('0x33')][_0xa66f('0x3f')]){_0x63650b[_0xa66f('0x40')]=[{'all':!![]}];}return db[_0xa66f('0x2d')][_0xa66f('0x41')](_0x63650b);})[_0xa66f('0x26')](function(_0x93f6ff){_0xeeb22e[_0xa66f('0x42')]=_0x93f6ff;return _0xeeb22e;})[_0xa66f('0x26')](respondWithFilteredResult(_0x45f71c,_0x63650b))['catch'](handleError(_0x45f71c,null));};exports[_0xa66f('0x43')]=function(_0x25c2cb,_0x58c1f2){var _0x248587={'raw':![],'where':{'id':_0x25c2cb[_0xa66f('0x44')]['id']}},_0x4b6e6b={};_0x4b6e6b[_0xa66f('0x31')]=_['keys'](db[_0xa66f('0x2d')][_0xa66f('0x2e')]);_0x4b6e6b[_0xa66f('0x33')]=_['keys'](_0x25c2cb[_0xa66f('0x33')]);_0x4b6e6b['filters']=_[_0xa66f('0x45')](_0x4b6e6b[_0xa66f('0x31')],_0x4b6e6b[_0xa66f('0x33')]);_0x248587[_0xa66f('0x36')]=_[_0xa66f('0x45')](_0x4b6e6b[_0xa66f('0x31')],qs[_0xa66f('0x37')](_0x25c2cb['query'][_0xa66f('0x37')]));_0x248587[_0xa66f('0x36')]=_0x248587[_0xa66f('0x36')][_0xa66f('0x38')]?_0x248587[_0xa66f('0x36')]:_0x4b6e6b['model'];if(_0x25c2cb['query'][_0xa66f('0x3f')]){_0x248587[_0xa66f('0x40')]=[{'all':!![]}];}_0x248587=_[_0xa66f('0x3d')]({},_0x248587,_0x25c2cb[_0xa66f('0x46')]);return db[_0xa66f('0x2d')][_0xa66f('0x47')](_0x248587)['then'](handleEntityNotFound(_0x58c1f2,null))[_0xa66f('0x26')](respondWithResult(_0x58c1f2,null))[_0xa66f('0x48')](handleError(_0x58c1f2,null));};exports[_0xa66f('0x49')]=function(_0x5651e9,_0x57c8a0){return db[_0xa66f('0x2d')][_0xa66f('0x49')](_0x5651e9[_0xa66f('0x4a')],{})['then'](respondWithResult(_0x57c8a0,0xc9))['catch'](handleError(_0x57c8a0,null));};exports['update']=function(_0x19e7ce,_0x35e477){if(_0x19e7ce[_0xa66f('0x4a')]['id']){delete _0x19e7ce[_0xa66f('0x4a')]['id'];}return db[_0xa66f('0x2d')][_0xa66f('0x47')]({'where':{'id':_0x19e7ce[_0xa66f('0x44')]['id']}})[_0xa66f('0x26')](handleEntityNotFound(_0x35e477,null))['then'](saveUpdates(_0x19e7ce[_0xa66f('0x4a')],null))[_0xa66f('0x26')](respondWithResult(_0x35e477,null))[_0xa66f('0x48')](handleError(_0x35e477,null));};exports[_0xa66f('0x27')]=function(_0x11597b,_0x33cdc7){return db['VoiceQueueReport'][_0xa66f('0x47')]({'where':{'id':_0x11597b[_0xa66f('0x44')]['id']}})[_0xa66f('0x26')](handleEntityNotFound(_0x33cdc7,null))[_0xa66f('0x26')](removeEntity(_0x33cdc7,null))[_0xa66f('0x48')](handleError(_0x33cdc7,null));};exports['describe']=function(_0x389b9a,_0x50e0cd){return db[_0xa66f('0x2d')]['describe']()['then'](respondWithResult(_0x50e0cd,null))[_0xa66f('0x48')](handleError(_0x50e0cd,null));};exports[_0xa66f('0x4b')]=function(_0x12271d,_0x2c79df){var _0x35ed5b={},_0xe97cf4={},_0x53a62f={'count':0x0,'rows':[]};_0xe97cf4[_0xa66f('0x31')]=_[_0xa66f('0x34')](db[_0xa66f('0x2d')][_0xa66f('0x2e')]);_0xe97cf4['query']=_[_0xa66f('0x34')](_0x12271d['query']);_0xe97cf4[_0xa66f('0x35')]=_[_0xa66f('0x45')](_0xe97cf4[_0xa66f('0x31')],_0xe97cf4[_0xa66f('0x33')]);_0x35ed5b[_0xa66f('0x36')]=_[_0xa66f('0x45')](_0xe97cf4[_0xa66f('0x31')],qs['fields'](_0x12271d[_0xa66f('0x33')][_0xa66f('0x37')]));_0x35ed5b[_0xa66f('0x36')]=_0x35ed5b[_0xa66f('0x36')][_0xa66f('0x38')]?_0x35ed5b[_0xa66f('0x36')]:_0xe97cf4[_0xa66f('0x31')];if(!_0x12271d[_0xa66f('0x33')][_0xa66f('0x39')]('nolimit')){_0x35ed5b['limit']=qs[_0xa66f('0x1f')](_0x12271d[_0xa66f('0x33')][_0xa66f('0x1f')]);_0x35ed5b[_0xa66f('0x1e')]=qs[_0xa66f('0x1e')](_0x12271d[_0xa66f('0x33')][_0xa66f('0x1e')]);}_0x35ed5b['order']=qs[_0xa66f('0x3c')](_0x12271d[_0xa66f('0x33')][_0xa66f('0x3c')]);_0x35ed5b[_0xa66f('0x3e')]=qs['filters'](_[_0xa66f('0x4c')](_0x12271d[_0xa66f('0x33')],_0xe97cf4[_0xa66f('0x35')]));if(_0x12271d[_0xa66f('0x33')][_0xa66f('0x4d')]){_0x35ed5b[_0xa66f('0x3e')]=_['merge'](_0x35ed5b['where'],{'$or':_[_0xa66f('0x32')](_0x35ed5b[_0xa66f('0x36')],function(_0x174aad){var _0x52edb3={};_0x52edb3[_0x174aad]={'$like':'%'+_0x12271d[_0xa66f('0x33')][_0xa66f('0x4d')]+'%'};return _0x52edb3;})});}_0x35ed5b=_[_0xa66f('0x3d')]({},_0x35ed5b,_0x12271d[_0xa66f('0x46')]);var _0x17b2cf={'where':_0x35ed5b[_0xa66f('0x3e')]};return db[_0xa66f('0x2d')][_0xa66f('0x1d')](_0x17b2cf)[_0xa66f('0x26')](function(_0x5d4299){_0x53a62f[_0xa66f('0x1d')]=_0x5d4299;if(_0x12271d[_0xa66f('0x33')][_0xa66f('0x3f')]){_0x35ed5b[_0xa66f('0x40')]=[{'all':!![]}];}return db[_0xa66f('0x2d')][_0xa66f('0x41')](_0x35ed5b);})[_0xa66f('0x26')](function(_0x3b38ad){_0x53a62f['rows']=_0x3b38ad;return _0x53a62f;})['then'](respondWithFilteredResult(_0x2c79df,_0x35ed5b,_0xa66f('0x4b')))[_0xa66f('0x48')](handleError(_0x2c79df,null,_0xa66f('0x4b')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index 6939862..6af6d38 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 _0xac7a=['events','../../mysqldb','VoiceQueueReport','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports'];(function(_0x953ede,_0x4f84b5){var _0x18c400=function(_0x5b57f4){while(--_0x5b57f4){_0x953ede['push'](_0x953ede['shift']());}};_0x18c400(++_0x4f84b5);}(_0xac7a,0x1f4));var _0xaac7=function(_0x4e7115,_0x273e25){_0x4e7115=_0x4e7115-0x0;var _0x4c6d76=_0xac7a[_0x4e7115];return _0x4c6d76;};'use strict';var EventEmitter=require(_0xaac7('0x0'));var VoiceQueueReport=require(_0xaac7('0x1'))['db'][_0xaac7('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0xaac7('0x3')](0x0);var events={'afterCreate':_0xaac7('0x4'),'afterUpdate':_0xaac7('0x5'),'afterDestroy':_0xaac7('0x6')};function emitEvent(_0x4be515){return function(_0x379ec8,_0x5dedb7,_0x215dea){VoiceQueueReportEvents[_0xaac7('0x7')](_0x4be515+':'+_0x379ec8['id'],_0x379ec8);VoiceQueueReportEvents['emit'](_0x4be515,_0x379ec8);_0x215dea(null);};}for(var e in events){if(events[_0xaac7('0x8')](e)){var event=events[e];VoiceQueueReport['hook'](e,emitEvent(event));}}module[_0xaac7('0x9')]=VoiceQueueReportEvents; \ No newline at end of file +var _0x1904=['save','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners'];(function(_0x4ea69d,_0x290f53){var _0x5318e0=function(_0x18e081){while(--_0x18e081){_0x4ea69d['push'](_0x4ea69d['shift']());}};_0x5318e0(++_0x290f53);}(_0x1904,0x18a));var _0x4190=function(_0x3d1fff,_0x555485){_0x3d1fff=_0x3d1fff-0x0;var _0x2dbcbe=_0x1904[_0x3d1fff];return _0x2dbcbe;};'use strict';var EventEmitter=require('events');var VoiceQueueReport=require(_0x4190('0x0'))['db']['VoiceQueueReport'];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x4190('0x1')](0x0);var events={'afterCreate':_0x4190('0x2'),'afterUpdate':_0x4190('0x3'),'afterDestroy':_0x4190('0x4')};function emitEvent(_0x53ec1b){return function(_0x54cf56,_0x1e7d0d,_0x7b79){VoiceQueueReportEvents[_0x4190('0x5')](_0x53ec1b+':'+_0x54cf56['id'],_0x54cf56);VoiceQueueReportEvents[_0x4190('0x5')](_0x53ec1b,_0x54cf56);_0x7b79(null);};}for(var e in events){if(events[_0x4190('0x6')](e)){var event=events[e];VoiceQueueReport[_0x4190('0x7')](e,emitEvent(event));}}module[_0x4190('0x8')]=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index 8c82366..e0412cc 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 _0x2032=['./voiceQueueReport.attributes','exports','define','VoiceQueueReport','report_queue','uniqueid','calleridnum','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x4178af,_0x388652){var _0x20f4b1=function(_0x504188){while(--_0x504188){_0x4178af['push'](_0x4178af['shift']());}};_0x20f4b1(++_0x388652);}(_0x2032,0xd9));var _0x2203=function(_0x5f2308,_0x3e611c){_0x5f2308=_0x5f2308-0x0;var _0x388ea5=_0x2032[_0x5f2308];return _0x388ea5;};'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 fs=require('fs');var path=require('path');var rimraf=require(_0x2203('0x5'));var config=require(_0x2203('0x6'));var attributes=require(_0x2203('0x7'));module[_0x2203('0x8')]=function(_0x3f7ba1,_0x13367a){return _0x3f7ba1[_0x2203('0x9')](_0x2203('0xa'),attributes,{'tableName':_0x2203('0xb'),'paranoid':![],'indexes':[{'fields':[_0x2203('0xc')]},{'fields':[_0x2203('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xdb28=['bluebird','request-promise','path','rimraf','../../config/environment','exports','VoiceQueueReport','report_queue','uniqueid','calleridnum','lodash','util','../../config/logger','api'];(function(_0x3ecf3f,_0x1709c9){var _0x1c6c85=function(_0x576ff8){while(--_0x576ff8){_0x3ecf3f['push'](_0x3ecf3f['shift']());}};_0x1c6c85(++_0x1709c9);}(_0xdb28,0x106));var _0x8db2=function(_0x7c4937,_0x5ef276){_0x7c4937=_0x7c4937-0x0;var _0xf92406=_0xdb28[_0x7c4937];return _0xf92406;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var logger=require(_0x8db2('0x2'))(_0x8db2('0x3'));var moment=require('moment');var BPromise=require(_0x8db2('0x4'));var rp=require(_0x8db2('0x5'));var fs=require('fs');var path=require(_0x8db2('0x6'));var rimraf=require(_0x8db2('0x7'));var config=require(_0x8db2('0x8'));var attributes=require('./voiceQueueReport.attributes');module[_0x8db2('0x9')]=function(_0x1d2dd3,_0x5f42ee){return _0x1d2dd3['define'](_0x8db2('0xa'),attributes,{'tableName':_0x8db2('0xb'),'paranoid':![],'indexes':[{'fields':[_0x8db2('0xc')]},{'fields':[_0x8db2('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index a2ef2c9..ed76226 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 _0xecd6=['map','model','create','body','CreateVoiceQueueReport','update','info','UpdateVoiceQueueReport','catch','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./voiceQueueReport.socket','then','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','code','error','VoiceQueueReport,\x20%s,\x20%s','message','result','GetVoiceQueueReport','VoiceQueueReport','findAll','options','raw','attributes','limit','include'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xecd6,0x1a3));var _0x6ecd=function(_0x2d9f9b,_0x478b09){_0x2d9f9b=_0x2d9f9b-0x0;var _0x581343=_0xecd6[_0x2d9f9b];return _0x581343;};'use strict';var _=require('lodash');var util=require(_0x6ecd('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x6ecd('0x1'));var fs=require('fs');var Redis=require(_0x6ecd('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x6ecd('0x3'));var logger=require(_0x6ecd('0x4'))(_0x6ecd('0x5'));var config=require(_0x6ecd('0x6'));var jayson=require(_0x6ecd('0x7'));var client=jayson[_0x6ecd('0x8')][_0x6ecd('0x9')]({'port':0x232a});config[_0x6ecd('0xa')]=_[_0x6ecd('0xb')](config[_0x6ecd('0xa')],{'host':_0x6ecd('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6ecd('0xa')]));require(_0x6ecd('0xd'))['register'](socket);function respondWithRpcPromise(_0x516db9,_0x53e8ec,_0x5dfc98){return new BPromise(function(_0x506382,_0x1b4dd1){return client['request'](_0x516db9,_0x5dfc98)[_0x6ecd('0xe')](function(_0x968709){logger['info']('VoiceQueueReport,\x20%s,\x20%s',_0x53e8ec,_0x6ecd('0xf'));logger[_0x6ecd('0x10')](_0x6ecd('0x11'),_0x53e8ec,_0x6ecd('0xf'),JSON[_0x6ecd('0x12')](_0x968709));if(_0x968709['error']){if(_0x968709['error'][_0x6ecd('0x13')]===0x1f4){logger[_0x6ecd('0x14')](_0x6ecd('0x15'),_0x53e8ec,_0x968709[_0x6ecd('0x14')]['message']);return _0x1b4dd1(_0x968709[_0x6ecd('0x14')]['message']);}logger['error'](_0x6ecd('0x15'),_0x53e8ec,_0x968709['error'][_0x6ecd('0x16')]);return _0x506382(_0x968709['error']['message']);}else{logger['info'](_0x6ecd('0x15'),_0x53e8ec,_0x6ecd('0xf'));_0x506382(_0x968709[_0x6ecd('0x17')][_0x6ecd('0x16')]);}})['catch'](function(_0x5c88c2){logger[_0x6ecd('0x14')]('VoiceQueueReport,\x20%s,\x20%s',_0x53e8ec,_0x5c88c2);_0x1b4dd1(_0x5c88c2);});});}exports[_0x6ecd('0x18')]=function(_0x27840a){var _0x312ed9=this;return new Promise(function(_0x2f5cd3,_0x390c5e){return db[_0x6ecd('0x19')][_0x6ecd('0x1a')]({'raw':_0x27840a[_0x6ecd('0x1b')]?_0x27840a['options'][_0x6ecd('0x1c')]===undefined?!![]:![]:!![],'where':_0x27840a['options']?_0x27840a[_0x6ecd('0x1b')]['where']||null:null,'attributes':_0x27840a['options']?_0x27840a[_0x6ecd('0x1b')][_0x6ecd('0x1d')]||null:null,'limit':_0x27840a[_0x6ecd('0x1b')]?_0x27840a[_0x6ecd('0x1b')][_0x6ecd('0x1e')]||null:null,'include':_0x27840a[_0x6ecd('0x1b')]?_0x27840a[_0x6ecd('0x1b')][_0x6ecd('0x1f')]?_[_0x6ecd('0x20')](_0x27840a['options'][_0x6ecd('0x1f')],function(_0x5cb760){return{'model':db[_0x5cb760[_0x6ecd('0x21')]],'as':_0x5cb760['as'],'attributes':_0x5cb760[_0x6ecd('0x1d')],'include':_0x5cb760[_0x6ecd('0x1f')]?_[_0x6ecd('0x20')](_0x5cb760['include'],function(_0x5b6872){return{'model':db[_0x5b6872[_0x6ecd('0x21')]],'as':_0x5b6872['as'],'attributes':_0x5b6872[_0x6ecd('0x1d')],'include':_0x5b6872['include']?_['map'](_0x5b6872[_0x6ecd('0x1f')],function(_0x337f9a){return{'model':db[_0x337f9a[_0x6ecd('0x21')]],'as':_0x337f9a['as'],'attributes':_0x337f9a['attributes']};}):[]};}):[]};}):[]:[]})[_0x6ecd('0xe')](function(_0x3d810a){logger['info'](_0x6ecd('0x18'),_0x27840a);logger[_0x6ecd('0x10')](_0x6ecd('0x18'),_0x27840a,JSON[_0x6ecd('0x12')](_0x3d810a));_0x2f5cd3(_0x3d810a);})['catch'](function(_0x58e2a8){logger[_0x6ecd('0x14')](_0x6ecd('0x18'),_0x58e2a8[_0x6ecd('0x16')],_0x27840a);_0x390c5e(_0x312ed9[_0x6ecd('0x14')](0x1f4,_0x58e2a8[_0x6ecd('0x16')]));});});};exports['CreateVoiceQueueReport']=function(_0x15998d){var _0x2e976b=this;return new Promise(function(_0x49c6e5,_0x27eef9){return db[_0x6ecd('0x19')][_0x6ecd('0x22')](_0x15998d[_0x6ecd('0x23')],{'raw':_0x15998d[_0x6ecd('0x1b')]?_0x15998d[_0x6ecd('0x1b')][_0x6ecd('0x1c')]===undefined?!![]:![]:!![]})[_0x6ecd('0xe')](function(_0x3db865){logger['info'](_0x6ecd('0x24'),_0x15998d);logger[_0x6ecd('0x10')](_0x6ecd('0x24'),_0x15998d,JSON[_0x6ecd('0x12')](_0x3db865));_0x49c6e5(_0x3db865);})['catch'](function(_0x1f7283){logger[_0x6ecd('0x14')](_0x6ecd('0x24'),_0x1f7283['message'],_0x15998d);_0x27eef9(_0x2e976b[_0x6ecd('0x14')](0x1f4,_0x1f7283[_0x6ecd('0x16')]));});});};exports['UpdateVoiceQueueReport']=function(_0x5c5db6){var _0xe2a0d6=this;return new Promise(function(_0x353bb2,_0x420e18){return db[_0x6ecd('0x19')][_0x6ecd('0x25')](_0x5c5db6[_0x6ecd('0x23')],{'raw':_0x5c5db6['options']?_0x5c5db6[_0x6ecd('0x1b')][_0x6ecd('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5c5db6[_0x6ecd('0x1b')]?_0x5c5db6[_0x6ecd('0x1b')]['where']||null:null,'attributes':_0x5c5db6['options']?_0x5c5db6[_0x6ecd('0x1b')][_0x6ecd('0x1d')]||null:null,'limit':_0x5c5db6[_0x6ecd('0x1b')]?_0x5c5db6[_0x6ecd('0x1b')][_0x6ecd('0x1e')]||null:null})['then'](function(_0x149054){logger[_0x6ecd('0x26')](_0x6ecd('0x27'),_0x5c5db6);logger[_0x6ecd('0x10')](_0x6ecd('0x27'),_0x5c5db6,JSON[_0x6ecd('0x12')](_0x149054));_0x353bb2(_0x149054);})[_0x6ecd('0x28')](function(_0x3d4940){logger[_0x6ecd('0x14')](_0x6ecd('0x27'),_0x3d4940['message'],_0x5c5db6);_0x420e18(_0xe2a0d6[_0x6ecd('0x14')](0x1f4,_0x3d4940[_0x6ecd('0x16')]));});});}; \ No newline at end of file +var _0x37e3=['where','attributes','map','model','include','GetVoiceQueueReport','CreateVoiceQueueReport','create','body','update','limit','UpdateVoiceQueueReport','util','moment','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./voiceQueueReport.socket','register','request','then','info','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceQueueReport,\x20%s,\x20%s','message','result','catch','VoiceQueueReport','options','raw'];(function(_0x1f75d4,_0x183581){var _0x72f2ca=function(_0x5aafee){while(--_0x5aafee){_0x1f75d4['push'](_0x1f75d4['shift']());}};_0x72f2ca(++_0x183581);}(_0x37e3,0x8d));var _0x337e=function(_0x1da64,_0xbe1904){_0x1da64=_0x1da64-0x0;var _0x53a1ec=_0x37e3[_0x1da64];return _0x53a1ec;};'use strict';var _=require('lodash');var util=require(_0x337e('0x0'));var moment=require(_0x337e('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x337e('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x337e('0x3'));var logger=require(_0x337e('0x4'))('rpc');var config=require(_0x337e('0x5'));var jayson=require(_0x337e('0x6'));var client=jayson[_0x337e('0x7')][_0x337e('0x8')]({'port':0x232a});config['redis']=_[_0x337e('0x9')](config[_0x337e('0xa')],{'host':_0x337e('0xb'),'port':0x18eb});var socket=require(_0x337e('0xc'))(new Redis(config['redis']));require(_0x337e('0xd'))[_0x337e('0xe')](socket);function respondWithRpcPromise(_0x244173,_0x25fa5e,_0x3ba070){return new BPromise(function(_0x733953,_0xd25f38){return client[_0x337e('0xf')](_0x244173,_0x3ba070)[_0x337e('0x10')](function(_0x33ab54){logger[_0x337e('0x11')]('VoiceQueueReport,\x20%s,\x20%s',_0x25fa5e,_0x337e('0x12'));logger[_0x337e('0x13')](_0x337e('0x14'),_0x25fa5e,'request\x20sent',JSON[_0x337e('0x15')](_0x33ab54));if(_0x33ab54[_0x337e('0x16')]){if(_0x33ab54[_0x337e('0x16')][_0x337e('0x17')]===0x1f4){logger[_0x337e('0x16')](_0x337e('0x18'),_0x25fa5e,_0x33ab54[_0x337e('0x16')][_0x337e('0x19')]);return _0xd25f38(_0x33ab54['error'][_0x337e('0x19')]);}logger['error'](_0x337e('0x18'),_0x25fa5e,_0x33ab54[_0x337e('0x16')][_0x337e('0x19')]);return _0x733953(_0x33ab54[_0x337e('0x16')][_0x337e('0x19')]);}else{logger[_0x337e('0x11')](_0x337e('0x18'),_0x25fa5e,_0x337e('0x12'));_0x733953(_0x33ab54[_0x337e('0x1a')]['message']);}})[_0x337e('0x1b')](function(_0x329179){logger[_0x337e('0x16')](_0x337e('0x18'),_0x25fa5e,_0x329179);_0xd25f38(_0x329179);});});}exports['GetVoiceQueueReport']=function(_0x3989f2){var _0x47f4a2=this;return new Promise(function(_0x3dee51,_0x490e72){return db[_0x337e('0x1c')]['findAll']({'raw':_0x3989f2[_0x337e('0x1d')]?_0x3989f2[_0x337e('0x1d')][_0x337e('0x1e')]===undefined?!![]:![]:!![],'where':_0x3989f2[_0x337e('0x1d')]?_0x3989f2['options'][_0x337e('0x1f')]||null:null,'attributes':_0x3989f2[_0x337e('0x1d')]?_0x3989f2['options'][_0x337e('0x20')]||null:null,'limit':_0x3989f2[_0x337e('0x1d')]?_0x3989f2[_0x337e('0x1d')]['limit']||null:null,'include':_0x3989f2['options']?_0x3989f2[_0x337e('0x1d')]['include']?_[_0x337e('0x21')](_0x3989f2[_0x337e('0x1d')]['include'],function(_0x505d69){return{'model':db[_0x505d69[_0x337e('0x22')]],'as':_0x505d69['as'],'attributes':_0x505d69[_0x337e('0x20')],'include':_0x505d69[_0x337e('0x23')]?_[_0x337e('0x21')](_0x505d69[_0x337e('0x23')],function(_0x18612c){return{'model':db[_0x18612c[_0x337e('0x22')]],'as':_0x18612c['as'],'attributes':_0x18612c[_0x337e('0x20')],'include':_0x18612c[_0x337e('0x23')]?_['map'](_0x18612c[_0x337e('0x23')],function(_0x541aac){return{'model':db[_0x541aac[_0x337e('0x22')]],'as':_0x541aac['as'],'attributes':_0x541aac[_0x337e('0x20')]};}):[]};}):[]};}):[]:[]})[_0x337e('0x10')](function(_0x1c639c){logger[_0x337e('0x11')](_0x337e('0x24'),_0x3989f2);logger['debug'](_0x337e('0x24'),_0x3989f2,JSON[_0x337e('0x15')](_0x1c639c));_0x3dee51(_0x1c639c);})[_0x337e('0x1b')](function(_0x3fcf06){logger[_0x337e('0x16')](_0x337e('0x24'),_0x3fcf06[_0x337e('0x19')],_0x3989f2);_0x490e72(_0x47f4a2['error'](0x1f4,_0x3fcf06['message']));});});};exports[_0x337e('0x25')]=function(_0x4331dc){var _0xb15fd6=this;return new Promise(function(_0x974794,_0x3b1013){return db['VoiceQueueReport'][_0x337e('0x26')](_0x4331dc[_0x337e('0x27')],{'raw':_0x4331dc[_0x337e('0x1d')]?_0x4331dc[_0x337e('0x1d')][_0x337e('0x1e')]===undefined?!![]:![]:!![]})['then'](function(_0x5376a6){logger[_0x337e('0x11')](_0x337e('0x25'),_0x4331dc);logger[_0x337e('0x13')]('CreateVoiceQueueReport',_0x4331dc,JSON[_0x337e('0x15')](_0x5376a6));_0x974794(_0x5376a6);})[_0x337e('0x1b')](function(_0x378160){logger[_0x337e('0x16')]('CreateVoiceQueueReport',_0x378160[_0x337e('0x19')],_0x4331dc);_0x3b1013(_0xb15fd6[_0x337e('0x16')](0x1f4,_0x378160[_0x337e('0x19')]));});});};exports['UpdateVoiceQueueReport']=function(_0x169e78){var _0x1bfa43=this;return new Promise(function(_0x5b81ac,_0x575a33){return db[_0x337e('0x1c')][_0x337e('0x28')](_0x169e78[_0x337e('0x27')],{'raw':_0x169e78[_0x337e('0x1d')]?_0x169e78[_0x337e('0x1d')][_0x337e('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x169e78[_0x337e('0x1d')]?_0x169e78['options'][_0x337e('0x1f')]||null:null,'attributes':_0x169e78['options']?_0x169e78['options'][_0x337e('0x20')]||null:null,'limit':_0x169e78[_0x337e('0x1d')]?_0x169e78[_0x337e('0x1d')][_0x337e('0x29')]||null:null})['then'](function(_0x5bd495){logger[_0x337e('0x11')]('UpdateVoiceQueueReport',_0x169e78);logger[_0x337e('0x13')](_0x337e('0x2a'),_0x169e78,JSON[_0x337e('0x15')](_0x5bd495));_0x5b81ac(_0x5bd495);})[_0x337e('0x1b')](function(_0x5e4747){logger[_0x337e('0x16')](_0x337e('0x2a'),_0x5e4747['message'],_0x169e78);_0x575a33(_0x1bfa43[_0x337e('0x16')](0x1f4,_0x5e4747[_0x337e('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 46e0af5..129a8a2 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 _0x9611=['register','length','voiceQueueReport:','save','remove','update','emit'];(function(_0x1ee9a1,_0x5f1434){var _0x21270f=function(_0x303251){while(--_0x303251){_0x1ee9a1['push'](_0x1ee9a1['shift']());}};_0x21270f(++_0x5f1434);}(_0x9611,0xce));var _0x1961=function(_0x4494fb,_0xb58a9d){_0x4494fb=_0x4494fb-0x0;var _0x292513=_0x9611[_0x4494fb];return _0x292513;};'use strict';var VoiceQueueReportEvents=require('./voiceQueueReport.events');var events=[_0x1961('0x0'),_0x1961('0x1'),_0x1961('0x2')];function createListener(_0x55d464,_0x1fd64a){return function(_0x1f9cc2){_0x1fd64a[_0x1961('0x3')](_0x55d464,_0x1f9cc2);};}function removeListener(_0x205653,_0x403707){return function(){VoiceQueueReportEvents['removeListener'](_0x205653,_0x403707);};}exports[_0x1961('0x4')]=function(_0x3c9ead){for(var _0xcd3860=0x0,_0x309ca4=events[_0x1961('0x5')];_0xcd3860<_0x309ca4;_0xcd3860++){var _0x5d8d63=events[_0xcd3860];var _0x4bacd5=createListener(_0x1961('0x6')+_0x5d8d63,_0x3c9ead);VoiceQueueReportEvents['on'](_0x5d8d63,_0x4bacd5);}}; \ No newline at end of file +var _0x63c0=['removeListener','register','length','voiceQueueReport:','save','update','emit'];(function(_0xbb02ba,_0x1d52ea){var _0xfdec89=function(_0xf33f6f){while(--_0xf33f6f){_0xbb02ba['push'](_0xbb02ba['shift']());}};_0xfdec89(++_0x1d52ea);}(_0x63c0,0x193));var _0x063c=function(_0x2b9af6,_0x475a9b){_0x2b9af6=_0x2b9af6-0x0;var _0x20ed39=_0x63c0[_0x2b9af6];return _0x20ed39;};'use strict';var VoiceQueueReportEvents=require('./voiceQueueReport.events');var events=[_0x063c('0x0'),'remove',_0x063c('0x1')];function createListener(_0x31f00e,_0x55f259){return function(_0x342aea){_0x55f259[_0x063c('0x2')](_0x31f00e,_0x342aea);};}function removeListener(_0x1404df,_0x393352){return function(){VoiceQueueReportEvents[_0x063c('0x3')](_0x1404df,_0x393352);};}exports[_0x063c('0x4')]=function(_0x5f1f51){for(var _0x452350=0x0,_0x263e06=events[_0x063c('0x5')];_0x452350<_0x263e06;_0x452350++){var _0x1dfbde=events[_0x452350];var _0x169cc4=createListener(_0x063c('0x6')+_0x1dfbde,_0x5f1f51);VoiceQueueReportEvents['on'](_0x1dfbde,_0x169cc4);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index 0edbb9e..400c4d4 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 _0xfe54=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated','index','/:id','show','update','exports','multer'];(function(_0x42314c,_0x56f7d6){var _0x4edfd9=function(_0x25037d){while(--_0x25037d){_0x42314c['push'](_0x42314c['shift']());}};_0x4edfd9(++_0x56f7d6);}(_0xfe54,0xa9));var _0x4fe5=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xfe54[_0x432682];return _0x463d05;};'use strict';var multer=require(_0x4fe5('0x0'));var util=require(_0x4fe5('0x1'));var path=require(_0x4fe5('0x2'));var timeout=require(_0x4fe5('0x3'));var express=require(_0x4fe5('0x4'));var router=express[_0x4fe5('0x5')]();var auth=require(_0x4fe5('0x6'));var interaction=require(_0x4fe5('0x7'));var config=require(_0x4fe5('0x8'));var controller=require(_0x4fe5('0x9'));router[_0x4fe5('0xa')]('/',auth[_0x4fe5('0xb')](),controller[_0x4fe5('0xc')]);router['get'](_0x4fe5('0xd'),auth['isAuthenticated'](),controller[_0x4fe5('0xe')]);router['post']('/',auth[_0x4fe5('0xb')](),controller['create']);router['put']('/:id',auth[_0x4fe5('0xb')](),controller[_0x4fe5('0xf')]);router['delete']('/:id',auth[_0x4fe5('0xb')](),controller['destroy']);module[_0x4fe5('0x10')]=router; \ No newline at end of file +var _0xb153=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x15659b,_0x5b2c9f){var _0x5cfe79=function(_0x2160af){while(--_0x2160af){_0x15659b['push'](_0x15659b['shift']());}};_0x5cfe79(++_0x5b2c9f);}(_0xb153,0x17c));var _0x3b15=function(_0x14888f,_0x135517){_0x14888f=_0x14888f-0x0;var _0x27ff64=_0xb153[_0x14888f];return _0x27ff64;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x3b15('0x0'));var express=require(_0x3b15('0x1'));var router=express[_0x3b15('0x2')]();var auth=require(_0x3b15('0x3'));var interaction=require(_0x3b15('0x4'));var config=require(_0x3b15('0x5'));var controller=require(_0x3b15('0x6'));router[_0x3b15('0x7')]('/',auth[_0x3b15('0x8')](),controller[_0x3b15('0x9')]);router[_0x3b15('0x7')](_0x3b15('0xa'),auth[_0x3b15('0x8')](),controller[_0x3b15('0xb')]);router[_0x3b15('0xc')]('/',auth[_0x3b15('0x8')](),controller[_0x3b15('0xd')]);router[_0x3b15('0xe')](_0x3b15('0xa'),auth[_0x3b15('0x8')](),controller[_0x3b15('0xf')]);router[_0x3b15('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x3b15('0x11')]);module[_0x3b15('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index 471320b..d1a61b4 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 _0x82e8=['moment','exports','STRING','DATE','format'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x82e8,0xbe));var _0x882e=function(_0x3a4061,_0x57aa2a){_0x3a4061=_0x3a4061-0x0;var _0x51814c=_0x82e8[_0x3a4061];return _0x51814c;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x882e('0x0'));module[_0x882e('0x1')]={'time':{'type':Sequelize[_0x882e('0x2')]},'callid':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x882e('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x882e('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x882e('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x882e('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x882e('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x882e('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x882e('0x3')],'allowNull':![],'defaultValue':moment()[_0x882e('0x4')]('YYYY-MM-DD\x20HH:mm:ss')}}; \ No newline at end of file +var _0x764c=['exports','STRING','DATE','format','YYYY-MM-DD\x20HH:mm:ss','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x764c,0xe9));var _0xc764=function(_0x545e99,_0x5c528c){_0x545e99=_0x545e99-0x0;var _0x449395=_0x764c[_0x545e99];return _0x449395;};'use strict';var Sequelize=require(_0xc764('0x0'));var moment=require('moment');module[_0xc764('0x1')]={'time':{'type':Sequelize[_0xc764('0x2')]},'callid':{'type':Sequelize[_0xc764('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0xc764('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0xc764('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0xc764('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0xc764('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0xc764('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0xc764('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0xc764('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0xc764('0x3')],'allowNull':![],'defaultValue':moment()[_0xc764('0x4')](_0xc764('0x5'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index 82277c2..89b320c 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 _0xf408=['length','nolimit','limit','order','sort','where','pick','VIRTUAL','filter','merge','options','count','includeAll','findAll','catch','show','params','fields','include','find','create','body','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','offset','set','Content-Range','json','apply','reject','save','update','then','end','error','send','index','map','VoiceQueuesLog','rawAttributes','fieldName','type','key','name','keys','query','filters','intersection','attributes','model'];(function(_0x219ce3,_0x535de0){var _0x13da3c=function(_0x8417f5){while(--_0x8417f5){_0x219ce3['push'](_0x219ce3['shift']());}};_0x13da3c(++_0x535de0);}(_0xf408,0xac));var _0x8f40=function(_0x46bb73,_0x44f394){_0x46bb73=_0x46bb73-0x0;var _0x44f271=_0xf408[_0x46bb73];return _0x44f271;};'use strict';var pdf=require(_0x8f40('0x0'));var emlformat=require(_0x8f40('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x8f40('0x2'));var jsonpatch=require(_0x8f40('0x3'));var rp=require('request-promise');var moment=require(_0x8f40('0x4'));var BPromise=require(_0x8f40('0x5'));var Mustache=require('mustache');var util=require(_0x8f40('0x6'));var path=require(_0x8f40('0x7'));var sox=require(_0x8f40('0x8'));var csv=require(_0x8f40('0x9'));var ejs=require(_0x8f40('0xa'));var fs=require('fs');var _=require(_0x8f40('0xb'));var squel=require(_0x8f40('0xc'));var crypto=require(_0x8f40('0xd'));var jsforce=require(_0x8f40('0xe'));var deskjs=require(_0x8f40('0xf'));var toCsv=require(_0x8f40('0x9'));var querystring=require(_0x8f40('0x10'));var Papa=require(_0x8f40('0x11'));var Redis=require(_0x8f40('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x8f40('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8f40('0x14'));var logger=require(_0x8f40('0x15'))(_0x8f40('0x16'));var utils=require(_0x8f40('0x17'));var config=require('../../config/environment');var db=require(_0x8f40('0x18'))['db'];function respondWithStatusCode(_0x5a5119,_0x424b71){_0x424b71=_0x424b71||0xcc;return function(_0x3e148a){if(_0x3e148a){return _0x5a5119[_0x8f40('0x19')](_0x424b71);}return _0x5a5119[_0x8f40('0x1a')](_0x424b71)['end']();};}function respondWithResult(_0x13b55e,_0x1b2af3){_0x1b2af3=_0x1b2af3||0xc8;return function(_0x3ea79b){if(_0x3ea79b){return _0x13b55e[_0x8f40('0x1a')](_0x1b2af3)['json'](_0x3ea79b);}};}function respondWithFilteredResult(_0x454753,_0x448e79){return function(_0x536af2){if(_0x536af2){var _0x1cdfcb=_0x536af2['count'],_0x5364aa=_0x448e79[_0x8f40('0x1b')],_0x42f700=_0x448e79['offset']+_0x448e79['limit'],_0x5c2aa9;if(_0x42f700>=_0x1cdfcb){_0x42f700=_0x1cdfcb;_0x5c2aa9=0xc8;}else{_0x5c2aa9=0xce;}_0x454753['status'](_0x5c2aa9);return _0x454753[_0x8f40('0x1c')](_0x8f40('0x1d'),_0x5364aa+'-'+_0x42f700+'/'+_0x1cdfcb)[_0x8f40('0x1e')](_0x536af2);}return null;};}function patchUpdates(_0x419690){return function(_0x49b5a4){try{jsonpatch[_0x8f40('0x1f')](_0x49b5a4,_0x419690,!![]);}catch(_0x515225){return BPromise[_0x8f40('0x20')](_0x515225);}return _0x49b5a4[_0x8f40('0x21')]();};}function saveUpdates(_0x1c6dd7,_0x4d437e){return function(_0x3df6cc){if(_0x3df6cc){return _0x3df6cc[_0x8f40('0x22')](_0x1c6dd7)[_0x8f40('0x23')](function(_0x446e38){return _0x446e38;});}return null;};}function removeEntity(_0xe468fe,_0x3de23e){return function(_0x1d1f56){if(_0x1d1f56){return _0x1d1f56['destroy']()[_0x8f40('0x23')](function(){_0xe468fe[_0x8f40('0x1a')](0xcc)[_0x8f40('0x24')]();});}};}function handleEntityNotFound(_0x448fa7,_0x44499d){return function(_0xeecf3a){if(!_0xeecf3a){_0x448fa7['sendStatus'](0x194);}return _0xeecf3a;};}function handleError(_0x345742,_0x257227){_0x257227=_0x257227||0x1f4;return function(_0x5afca1){logger[_0x8f40('0x25')](_0x5afca1['stack']);if(_0x5afca1['name']){delete _0x5afca1['name'];}_0x345742[_0x8f40('0x1a')](_0x257227)[_0x8f40('0x26')](_0x5afca1);};}exports[_0x8f40('0x27')]=function(_0x5ccdb7,_0x2d9ed5){var _0x992fd4={},_0x324004={},_0x5f2f99={'count':0x0,'rows':[]};var _0x126419=_[_0x8f40('0x28')](db[_0x8f40('0x29')][_0x8f40('0x2a')],function(_0x13a1bc){return{'name':_0x13a1bc[_0x8f40('0x2b')],'type':_0x13a1bc[_0x8f40('0x2c')][_0x8f40('0x2d')]};});_0x324004['model']=_[_0x8f40('0x28')](_0x126419,_0x8f40('0x2e'));_0x324004['query']=_[_0x8f40('0x2f')](_0x5ccdb7[_0x8f40('0x30')]);_0x324004[_0x8f40('0x31')]=_[_0x8f40('0x32')](_0x324004['model'],_0x324004[_0x8f40('0x30')]);_0x992fd4[_0x8f40('0x33')]=_[_0x8f40('0x32')](_0x324004[_0x8f40('0x34')],qs['fields'](_0x5ccdb7['query']['fields']));_0x992fd4[_0x8f40('0x33')]=_0x992fd4[_0x8f40('0x33')][_0x8f40('0x35')]?_0x992fd4[_0x8f40('0x33')]:_0x324004[_0x8f40('0x34')];if(!_0x5ccdb7[_0x8f40('0x30')]['hasOwnProperty'](_0x8f40('0x36'))){_0x992fd4[_0x8f40('0x37')]=qs[_0x8f40('0x37')](_0x5ccdb7[_0x8f40('0x30')][_0x8f40('0x37')]);_0x992fd4[_0x8f40('0x1b')]=qs[_0x8f40('0x1b')](_0x5ccdb7[_0x8f40('0x30')]['offset']);}_0x992fd4[_0x8f40('0x38')]=qs['sort'](_0x5ccdb7[_0x8f40('0x30')][_0x8f40('0x39')]);_0x992fd4[_0x8f40('0x3a')]=qs['filters'](_[_0x8f40('0x3b')](_0x5ccdb7[_0x8f40('0x30')],_0x324004[_0x8f40('0x31')]));if(_0x5ccdb7[_0x8f40('0x30')]['filter']){_0x992fd4[_0x8f40('0x3a')]=_['merge'](_0x992fd4[_0x8f40('0x3a')],{'$or':_[_0x8f40('0x28')](_0x126419,function(_0x1ae4c0){if(_0x1ae4c0[_0x8f40('0x2c')]!==_0x8f40('0x3c')){var _0x4d5447={};_0x4d5447[_0x1ae4c0[_0x8f40('0x2e')]]={'$like':'%'+_0x5ccdb7[_0x8f40('0x30')][_0x8f40('0x3d')]+'%'};return _0x4d5447;}})});}_0x992fd4=_[_0x8f40('0x3e')]({},_0x992fd4,_0x5ccdb7[_0x8f40('0x3f')]);var _0x3bed63={'where':_0x992fd4[_0x8f40('0x3a')]};return db[_0x8f40('0x29')][_0x8f40('0x40')](_0x3bed63)[_0x8f40('0x23')](function(_0x45ebcc){_0x5f2f99[_0x8f40('0x40')]=_0x45ebcc;if(_0x5ccdb7['query'][_0x8f40('0x41')]){_0x992fd4['include']=[{'all':!![]}];}return db[_0x8f40('0x29')][_0x8f40('0x42')](_0x992fd4);})[_0x8f40('0x23')](function(_0x1588a6){_0x5f2f99['rows']=_0x1588a6;return _0x5f2f99;})[_0x8f40('0x23')](respondWithFilteredResult(_0x2d9ed5,_0x992fd4))[_0x8f40('0x43')](handleError(_0x2d9ed5,null));};exports[_0x8f40('0x44')]=function(_0x3460ae,_0x14cdad){var _0x5066fc={'raw':!![],'where':{'id':_0x3460ae[_0x8f40('0x45')]['id']}},_0x37ac6f={};_0x37ac6f[_0x8f40('0x34')]=_['keys'](db[_0x8f40('0x29')]['rawAttributes']);_0x37ac6f[_0x8f40('0x30')]=_['keys'](_0x3460ae[_0x8f40('0x30')]);_0x37ac6f[_0x8f40('0x31')]=_[_0x8f40('0x32')](_0x37ac6f[_0x8f40('0x34')],_0x37ac6f[_0x8f40('0x30')]);_0x5066fc['attributes']=_[_0x8f40('0x32')](_0x37ac6f['model'],qs[_0x8f40('0x46')](_0x3460ae[_0x8f40('0x30')][_0x8f40('0x46')]));_0x5066fc[_0x8f40('0x33')]=_0x5066fc['attributes'][_0x8f40('0x35')]?_0x5066fc['attributes']:_0x37ac6f[_0x8f40('0x34')];if(_0x3460ae[_0x8f40('0x30')][_0x8f40('0x41')]){_0x5066fc[_0x8f40('0x47')]=[{'all':!![]}];}_0x5066fc=_[_0x8f40('0x3e')]({},_0x5066fc,_0x3460ae[_0x8f40('0x3f')]);return db[_0x8f40('0x29')][_0x8f40('0x48')](_0x5066fc)[_0x8f40('0x23')](handleEntityNotFound(_0x14cdad,null))[_0x8f40('0x23')](respondWithResult(_0x14cdad,null))[_0x8f40('0x43')](handleError(_0x14cdad,null));};exports['create']=function(_0x15b00f,_0x352eae){return db['VoiceQueuesLog'][_0x8f40('0x49')](_0x15b00f[_0x8f40('0x4a')],{})[_0x8f40('0x23')](respondWithResult(_0x352eae,0xc9))[_0x8f40('0x43')](handleError(_0x352eae,null));};exports[_0x8f40('0x22')]=function(_0x5c50f7,_0x98e4db){if(_0x5c50f7[_0x8f40('0x4a')]['id']){delete _0x5c50f7[_0x8f40('0x4a')]['id'];}return db['VoiceQueuesLog']['find']({'where':{'id':_0x5c50f7['params']['id']}})[_0x8f40('0x23')](handleEntityNotFound(_0x98e4db,null))[_0x8f40('0x23')](saveUpdates(_0x5c50f7['body'],null))['then'](respondWithResult(_0x98e4db,null))[_0x8f40('0x43')](handleError(_0x98e4db,null));};exports['destroy']=function(_0x332752,_0x5f1fd3){return db[_0x8f40('0x29')][_0x8f40('0x48')]({'where':{'id':_0x332752['params']['id']}})[_0x8f40('0x23')](handleEntityNotFound(_0x5f1fd3,null))['then'](removeEntity(_0x5f1fd3,null))[_0x8f40('0x43')](handleError(_0x5f1fd3,null));}; \ No newline at end of file +var _0x03dd=['util','path','sox','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','end','error','stack','name','send','index','VoiceQueuesLog','rawAttributes','fieldName','type','model','map','keys','query','filters','intersection','attributes','fields','length','order','sort','filter','where','merge','options','includeAll','include','findAll','rows','catch','show','params','create','body','find','eml-format','rimraf','zip-dir','moment','bluebird','mustache'];(function(_0x2ef82e,_0x4a0938){var _0x5c990a=function(_0x176048){while(--_0x176048){_0x2ef82e['push'](_0x2ef82e['shift']());}};_0x5c990a(++_0x4a0938);}(_0x03dd,0x1e4));var _0xd03d=function(_0x2c6805,_0x46f0c5){_0x2c6805=_0x2c6805-0x0;var _0x523793=_0x03dd[_0x2c6805];return _0x523793;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xd03d('0x0'));var rimraf=require(_0xd03d('0x1'));var zipdir=require(_0xd03d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xd03d('0x3'));var BPromise=require(_0xd03d('0x4'));var Mustache=require(_0xd03d('0x5'));var util=require(_0xd03d('0x6'));var path=require(_0xd03d('0x7'));var sox=require(_0xd03d('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xd03d('0x9'));var jsforce=require(_0xd03d('0xa'));var deskjs=require(_0xd03d('0xb'));var toCsv=require(_0xd03d('0xc'));var querystring=require(_0xd03d('0xd'));var Papa=require(_0xd03d('0xe'));var Redis=require('ioredis');var authService=require(_0xd03d('0xf'));var qs=require(_0xd03d('0x10'));var as=require(_0xd03d('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd03d('0x12'))('api');var utils=require(_0xd03d('0x13'));var config=require('../../config/environment');var db=require(_0xd03d('0x14'))['db'];function respondWithStatusCode(_0x58dcae,_0x5ee909){_0x5ee909=_0x5ee909||0xcc;return function(_0x27be55){if(_0x27be55){return _0x58dcae[_0xd03d('0x15')](_0x5ee909);}return _0x58dcae['status'](_0x5ee909)['end']();};}function respondWithResult(_0x4cb332,_0x2138aa){_0x2138aa=_0x2138aa||0xc8;return function(_0x3ec4e5){if(_0x3ec4e5){return _0x4cb332[_0xd03d('0x16')](_0x2138aa)[_0xd03d('0x17')](_0x3ec4e5);}};}function respondWithFilteredResult(_0x203613,_0x47c8b0){return function(_0x99e7d9){if(_0x99e7d9){var _0xf1865e=_0x99e7d9[_0xd03d('0x18')],_0x4fc863=_0x47c8b0[_0xd03d('0x19')],_0xa30cde=_0x47c8b0[_0xd03d('0x19')]+_0x47c8b0[_0xd03d('0x1a')],_0x386f77;if(_0xa30cde>=_0xf1865e){_0xa30cde=_0xf1865e;_0x386f77=0xc8;}else{_0x386f77=0xce;}_0x203613[_0xd03d('0x16')](_0x386f77);return _0x203613[_0xd03d('0x1b')](_0xd03d('0x1c'),_0x4fc863+'-'+_0xa30cde+'/'+_0xf1865e)[_0xd03d('0x17')](_0x99e7d9);}return null;};}function patchUpdates(_0xb78ac5){return function(_0x5be7c3){try{jsonpatch[_0xd03d('0x1d')](_0x5be7c3,_0xb78ac5,!![]);}catch(_0x2df95a){return BPromise[_0xd03d('0x1e')](_0x2df95a);}return _0x5be7c3[_0xd03d('0x1f')]();};}function saveUpdates(_0x52a34d,_0x4200d2){return function(_0x3b47ad){if(_0x3b47ad){return _0x3b47ad[_0xd03d('0x20')](_0x52a34d)['then'](function(_0x18049b){return _0x18049b;});}return null;};}function removeEntity(_0xca0d0f,_0x575d2a){return function(_0x39befe){if(_0x39befe){return _0x39befe[_0xd03d('0x21')]()[_0xd03d('0x22')](function(){_0xca0d0f[_0xd03d('0x16')](0xcc)[_0xd03d('0x23')]();});}};}function handleEntityNotFound(_0x2b78ac,_0x69d3eb){return function(_0x419df9){if(!_0x419df9){_0x2b78ac['sendStatus'](0x194);}return _0x419df9;};}function handleError(_0x100f5f,_0x534832){_0x534832=_0x534832||0x1f4;return function(_0x3c6beb){logger[_0xd03d('0x24')](_0x3c6beb[_0xd03d('0x25')]);if(_0x3c6beb[_0xd03d('0x26')]){delete _0x3c6beb[_0xd03d('0x26')];}_0x100f5f[_0xd03d('0x16')](_0x534832)[_0xd03d('0x27')](_0x3c6beb);};}exports[_0xd03d('0x28')]=function(_0x6223e,_0x48c5fa){var _0x4b48f9={},_0x115271={},_0x26658b={'count':0x0,'rows':[]};var _0x3daba6=_['map'](db[_0xd03d('0x29')][_0xd03d('0x2a')],function(_0x5c11ae){return{'name':_0x5c11ae[_0xd03d('0x2b')],'type':_0x5c11ae[_0xd03d('0x2c')]['key']};});_0x115271[_0xd03d('0x2d')]=_[_0xd03d('0x2e')](_0x3daba6,'name');_0x115271['query']=_[_0xd03d('0x2f')](_0x6223e[_0xd03d('0x30')]);_0x115271[_0xd03d('0x31')]=_[_0xd03d('0x32')](_0x115271[_0xd03d('0x2d')],_0x115271[_0xd03d('0x30')]);_0x4b48f9[_0xd03d('0x33')]=_[_0xd03d('0x32')](_0x115271[_0xd03d('0x2d')],qs[_0xd03d('0x34')](_0x6223e[_0xd03d('0x30')][_0xd03d('0x34')]));_0x4b48f9[_0xd03d('0x33')]=_0x4b48f9[_0xd03d('0x33')][_0xd03d('0x35')]?_0x4b48f9[_0xd03d('0x33')]:_0x115271[_0xd03d('0x2d')];if(!_0x6223e[_0xd03d('0x30')]['hasOwnProperty']('nolimit')){_0x4b48f9[_0xd03d('0x1a')]=qs[_0xd03d('0x1a')](_0x6223e[_0xd03d('0x30')][_0xd03d('0x1a')]);_0x4b48f9[_0xd03d('0x19')]=qs['offset'](_0x6223e[_0xd03d('0x30')][_0xd03d('0x19')]);}_0x4b48f9[_0xd03d('0x36')]=qs[_0xd03d('0x37')](_0x6223e[_0xd03d('0x30')][_0xd03d('0x37')]);_0x4b48f9['where']=qs[_0xd03d('0x31')](_['pick'](_0x6223e['query'],_0x115271[_0xd03d('0x31')]));if(_0x6223e[_0xd03d('0x30')][_0xd03d('0x38')]){_0x4b48f9[_0xd03d('0x39')]=_[_0xd03d('0x3a')](_0x4b48f9[_0xd03d('0x39')],{'$or':_['map'](_0x3daba6,function(_0x54e504){if(_0x54e504[_0xd03d('0x2c')]!=='VIRTUAL'){var _0x216bf8={};_0x216bf8[_0x54e504[_0xd03d('0x26')]]={'$like':'%'+_0x6223e['query'][_0xd03d('0x38')]+'%'};return _0x216bf8;}})});}_0x4b48f9=_[_0xd03d('0x3a')]({},_0x4b48f9,_0x6223e[_0xd03d('0x3b')]);var _0x441648={'where':_0x4b48f9[_0xd03d('0x39')]};return db['VoiceQueuesLog'][_0xd03d('0x18')](_0x441648)[_0xd03d('0x22')](function(_0x5626f9){_0x26658b[_0xd03d('0x18')]=_0x5626f9;if(_0x6223e[_0xd03d('0x30')][_0xd03d('0x3c')]){_0x4b48f9[_0xd03d('0x3d')]=[{'all':!![]}];}return db['VoiceQueuesLog'][_0xd03d('0x3e')](_0x4b48f9);})['then'](function(_0x32b7d2){_0x26658b[_0xd03d('0x3f')]=_0x32b7d2;return _0x26658b;})['then'](respondWithFilteredResult(_0x48c5fa,_0x4b48f9))[_0xd03d('0x40')](handleError(_0x48c5fa,null));};exports[_0xd03d('0x41')]=function(_0x105218,_0xcb9748){var _0x204b80={'raw':!![],'where':{'id':_0x105218[_0xd03d('0x42')]['id']}},_0x47567b={};_0x47567b[_0xd03d('0x2d')]=_[_0xd03d('0x2f')](db[_0xd03d('0x29')]['rawAttributes']);_0x47567b[_0xd03d('0x30')]=_[_0xd03d('0x2f')](_0x105218['query']);_0x47567b['filters']=_[_0xd03d('0x32')](_0x47567b[_0xd03d('0x2d')],_0x47567b[_0xd03d('0x30')]);_0x204b80[_0xd03d('0x33')]=_[_0xd03d('0x32')](_0x47567b[_0xd03d('0x2d')],qs[_0xd03d('0x34')](_0x105218['query'][_0xd03d('0x34')]));_0x204b80[_0xd03d('0x33')]=_0x204b80[_0xd03d('0x33')][_0xd03d('0x35')]?_0x204b80[_0xd03d('0x33')]:_0x47567b[_0xd03d('0x2d')];if(_0x105218['query']['includeAll']){_0x204b80[_0xd03d('0x3d')]=[{'all':!![]}];}_0x204b80=_[_0xd03d('0x3a')]({},_0x204b80,_0x105218[_0xd03d('0x3b')]);return db[_0xd03d('0x29')]['find'](_0x204b80)[_0xd03d('0x22')](handleEntityNotFound(_0xcb9748,null))[_0xd03d('0x22')](respondWithResult(_0xcb9748,null))[_0xd03d('0x40')](handleError(_0xcb9748,null));};exports['create']=function(_0x3e93fa,_0xfe62b0){return db[_0xd03d('0x29')][_0xd03d('0x43')](_0x3e93fa[_0xd03d('0x44')],{})[_0xd03d('0x22')](respondWithResult(_0xfe62b0,0xc9))[_0xd03d('0x40')](handleError(_0xfe62b0,null));};exports[_0xd03d('0x20')]=function(_0x1a689e,_0x3314ca){if(_0x1a689e[_0xd03d('0x44')]['id']){delete _0x1a689e[_0xd03d('0x44')]['id'];}return db['VoiceQueuesLog'][_0xd03d('0x45')]({'where':{'id':_0x1a689e[_0xd03d('0x42')]['id']}})[_0xd03d('0x22')](handleEntityNotFound(_0x3314ca,null))['then'](saveUpdates(_0x1a689e[_0xd03d('0x44')],null))['then'](respondWithResult(_0x3314ca,null))[_0xd03d('0x40')](handleError(_0x3314ca,null));};exports[_0xd03d('0x21')]=function(_0x5373c3,_0x11ee2b){return db[_0xd03d('0x29')]['find']({'where':{'id':_0x5373c3[_0xd03d('0x42')]['id']}})['then'](handleEntityNotFound(_0x11ee2b,null))[_0xd03d('0x22')](removeEntity(_0x11ee2b,null))['catch'](handleError(_0x11ee2b,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index 0d8d6e8..609e589 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 _0xb7aa=['./voiceQueuesLog.attributes','exports','VoiceQueuesLog','voice_queues_log','event_dtm','event','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment'];(function(_0x1842be,_0x34c11d){var _0x5ccfa5=function(_0x4c0f2f){while(--_0x4c0f2f){_0x1842be['push'](_0x1842be['shift']());}};_0x5ccfa5(++_0x34c11d);}(_0xb7aa,0xd6));var _0xab7a=function(_0x50424b,_0x38b71b){_0x50424b=_0x50424b-0x0;var _0x2b67e7=_0xb7aa[_0x50424b];return _0x2b67e7;};'use strict';var _=require('lodash');var util=require(_0xab7a('0x0'));var logger=require(_0xab7a('0x1'))(_0xab7a('0x2'));var moment=require(_0xab7a('0x3'));var BPromise=require(_0xab7a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xab7a('0x5'));var config=require(_0xab7a('0x6'));var attributes=require(_0xab7a('0x7'));module[_0xab7a('0x8')]=function(_0x4e1746,_0x4d7c21){return _0x4e1746['define'](_0xab7a('0x9'),attributes,{'tableName':_0xab7a('0xa'),'paranoid':![],'indexes':[{'name':_0xab7a('0xb'),'fields':[_0xab7a('0xc'),'dtm']}],'timestamps':![]});}; \ No newline at end of file +var _0xf16c=['../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./voiceQueuesLog.attributes','exports','VoiceQueuesLog','voice_queues_log','event_dtm','event','dtm','util'];(function(_0x3464fc,_0x4719d0){var _0x5c013c=function(_0x446f43){while(--_0x446f43){_0x3464fc['push'](_0x3464fc['shift']());}};_0x5c013c(++_0x4719d0);}(_0xf16c,0xdf));var _0xcf16=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf16c[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0xcf16('0x0'));var logger=require(_0xcf16('0x1'))('api');var moment=require(_0xcf16('0x2'));var BPromise=require(_0xcf16('0x3'));var rp=require(_0xcf16('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcf16('0x5'));var config=require(_0xcf16('0x6'));var attributes=require(_0xcf16('0x7'));module[_0xcf16('0x8')]=function(_0x4375d9,_0x274918){return _0x4375d9['define'](_0xcf16('0x9'),attributes,{'tableName':_0xcf16('0xa'),'paranoid':![],'indexes':[{'name':_0xcf16('0xb'),'fields':[_0xcf16('0xc'),_0xcf16('0xd')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index 371386c..527e141 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 _0xac4a=['VoiceQueuesLog,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','then','info','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0xac4a,0x13f));var _0xaac4=function(_0x3f7b70,_0x517e53){_0x3f7b70=_0x3f7b70-0x0;var _0xfa9843=_0xac4a[_0x3f7b70];return _0xfa9843;};'use strict';var _=require(_0xaac4('0x0'));var util=require(_0xaac4('0x1'));var moment=require(_0xaac4('0x2'));var BPromise=require(_0xaac4('0x3'));var rs=require(_0xaac4('0x4'));var fs=require('fs');var Redis=require(_0xaac4('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xaac4('0x6'))(_0xaac4('0x7'));var config=require(_0xaac4('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xaac4('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1cdfc5,_0x5870e8,_0x1e4283){return new BPromise(function(_0x27354c,_0x567295){return client['request'](_0x1cdfc5,_0x1e4283)[_0xaac4('0xa')](function(_0x50d114){logger[_0xaac4('0xb')]('VoiceQueuesLog,\x20%s,\x20%s',_0x5870e8,'request\x20sent');logger[_0xaac4('0xc')](_0xaac4('0xd'),_0x5870e8,_0xaac4('0xe'),JSON[_0xaac4('0xf')](_0x50d114));if(_0x50d114[_0xaac4('0x10')]){if(_0x50d114['error']['code']===0x1f4){logger[_0xaac4('0x10')](_0xaac4('0x11'),_0x5870e8,_0x50d114[_0xaac4('0x10')]['message']);return _0x567295(_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);}logger['error'](_0xaac4('0x11'),_0x5870e8,_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);return _0x27354c(_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);}else{logger[_0xaac4('0xb')](_0xaac4('0x11'),_0x5870e8,_0xaac4('0xe'));_0x27354c(_0x50d114[_0xaac4('0x13')][_0xaac4('0x12')]);}})[_0xaac4('0x14')](function(_0x1766c2){logger[_0xaac4('0x10')]('VoiceQueuesLog,\x20%s,\x20%s',_0x5870e8,_0x1766c2);_0x567295(_0x1766c2);});});} \ No newline at end of file +var _0x7d98=['then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','request'];(function(_0x1f80ca,_0x355839){var _0x55e88c=function(_0x5a902a){while(--_0x5a902a){_0x1f80ca['push'](_0x1f80ca['shift']());}};_0x55e88c(++_0x355839);}(_0x7d98,0xe7));var _0x87d9=function(_0x4b1032,_0x36952e){_0x4b1032=_0x4b1032-0x0;var _0x5a1d55=_0x7d98[_0x4b1032];return _0x5a1d55;};'use strict';var _=require(_0x87d9('0x0'));var util=require('util');var moment=require(_0x87d9('0x1'));var BPromise=require(_0x87d9('0x2'));var rs=require(_0x87d9('0x3'));var fs=require('fs');var Redis=require(_0x87d9('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x87d9('0x5'));var logger=require(_0x87d9('0x6'))('rpc');var config=require(_0x87d9('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3fe56d,_0x24c05f,_0x2dc542){return new BPromise(function(_0x5f2693,_0x2aa885){return client[_0x87d9('0x8')](_0x3fe56d,_0x2dc542)[_0x87d9('0x9')](function(_0x545f4f){logger[_0x87d9('0xa')](_0x87d9('0xb'),_0x24c05f,_0x87d9('0xc'));logger[_0x87d9('0xd')](_0x87d9('0xe'),_0x24c05f,_0x87d9('0xc'),JSON[_0x87d9('0xf')](_0x545f4f));if(_0x545f4f[_0x87d9('0x10')]){if(_0x545f4f[_0x87d9('0x10')][_0x87d9('0x11')]===0x1f4){logger[_0x87d9('0x10')](_0x87d9('0xb'),_0x24c05f,_0x545f4f[_0x87d9('0x10')][_0x87d9('0x12')]);return _0x2aa885(_0x545f4f[_0x87d9('0x10')][_0x87d9('0x12')]);}logger[_0x87d9('0x10')](_0x87d9('0xb'),_0x24c05f,_0x545f4f[_0x87d9('0x10')][_0x87d9('0x12')]);return _0x5f2693(_0x545f4f['error']['message']);}else{logger[_0x87d9('0xa')](_0x87d9('0xb'),_0x24c05f,_0x87d9('0xc'));_0x5f2693(_0x545f4f['result']['message']);}})[_0x87d9('0x13')](function(_0x109d61){logger[_0x87d9('0x10')](_0x87d9('0xb'),_0x24c05f,_0x109d61);_0x2aa885(_0x109d61);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 00d51f7..37d64cb 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 _0x6981=['get','isAuthenticated','index','/describe','/:id','show','/:id/download','download','/:id/downloads','downloads','post','create','put','update','delete','destroy','exports','multer','util','Router','../../components/interaction/service','../../config/environment','./voiceRecording.controller'];(function(_0x2a08bd,_0x5c9342){var _0x516ae9=function(_0x29a87b){while(--_0x29a87b){_0x2a08bd['push'](_0x2a08bd['shift']());}};_0x516ae9(++_0x5c9342);}(_0x6981,0x6d));var _0x1698=function(_0xf2c3a0,_0x1f2309){_0xf2c3a0=_0xf2c3a0-0x0;var _0x39d68b=_0x6981[_0xf2c3a0];return _0x39d68b;};'use strict';var multer=require(_0x1698('0x0'));var util=require(_0x1698('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x1698('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0x1698('0x3'));var config=require(_0x1698('0x4'));var controller=require(_0x1698('0x5'));router[_0x1698('0x6')]('/',auth[_0x1698('0x7')](),controller[_0x1698('0x8')]);router['get'](_0x1698('0x9'),auth[_0x1698('0x7')](),controller['describe']);router[_0x1698('0x6')](_0x1698('0xa'),auth['isAuthenticated'](),controller[_0x1698('0xb')]);router[_0x1698('0x6')](_0x1698('0xc'),auth[_0x1698('0x7')](),controller[_0x1698('0xd')]);router[_0x1698('0x6')](_0x1698('0xe'),controller[_0x1698('0xf')]);router[_0x1698('0x10')]('/',auth[_0x1698('0x7')](),controller[_0x1698('0x11')]);router[_0x1698('0x12')](_0x1698('0xa'),auth[_0x1698('0x7')](),controller[_0x1698('0x13')]);router[_0x1698('0x14')](_0x1698('0xa'),auth['isAuthenticated'](),controller[_0x1698('0x15')]);module[_0x1698('0x16')]=router; \ No newline at end of file +var _0x135e=['isAuthenticated','show','/:id/download','download','/:id/downloads','downloads','post','create','put','update','delete','destroy','exports','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/describe','describe','/:id'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x135e,0x145));var _0xe135=function(_0x1a7c3a,_0x48a496){_0x1a7c3a=_0x1a7c3a-0x0;var _0x1afd06=_0x135e[_0x1a7c3a];return _0x1afd06;};'use strict';var multer=require('multer');var util=require(_0xe135('0x0'));var path=require(_0xe135('0x1'));var timeout=require('connect-timeout');var express=require(_0xe135('0x2'));var router=express[_0xe135('0x3')]();var auth=require(_0xe135('0x4'));var interaction=require(_0xe135('0x5'));var config=require(_0xe135('0x6'));var controller=require('./voiceRecording.controller');router[_0xe135('0x7')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xe135('0x8'),auth['isAuthenticated'](),controller[_0xe135('0x9')]);router[_0xe135('0x7')](_0xe135('0xa'),auth[_0xe135('0xb')](),controller[_0xe135('0xc')]);router[_0xe135('0x7')](_0xe135('0xd'),auth[_0xe135('0xb')](),controller[_0xe135('0xe')]);router[_0xe135('0x7')](_0xe135('0xf'),controller[_0xe135('0x10')]);router[_0xe135('0x11')]('/',auth['isAuthenticated'](),controller[_0xe135('0x12')]);router[_0xe135('0x13')](_0xe135('0xa'),auth[_0xe135('0xb')](),controller[_0xe135('0x14')]);router[_0xe135('0x15')](_0xe135('0xa'),auth[_0xe135('0xb')](),controller[_0xe135('0x16')]);module[_0xe135('0x17')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index 5e22407..d84056e 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 _0x6025=['MM-DD-YYYY\x20HH:mm','toString','updatedAt','sequelize','path','exports','VIRTUAL','getDataValue','value','extname','STRING','setDataValue','channel','membername','split','INTEGER','createdAt','format'];(function(_0x2b94d5,_0x3b8853){var _0x3217c0=function(_0x4720c2){while(--_0x4720c2){_0x2b94d5['push'](_0x2b94d5['shift']());}};_0x3217c0(++_0x3b8853);}(_0x6025,0x135));var _0x5602=function(_0x8daf39,_0x2eae0c){_0x8daf39=_0x8daf39-0x0;var _0x49400f=_0x6025[_0x8daf39];return _0x49400f;};'use strict';var Sequelize=require(_0x5602('0x0'));var moment=require('moment');var path=require(_0x5602('0x1'));module[_0x5602('0x2')]={'format':{'type':Sequelize[_0x5602('0x3')],'get':function(){return this[_0x5602('0x4')](_0x5602('0x5'))?path[_0x5602('0x6')](this[_0x5602('0x4')](_0x5602('0x5'))):undefined;}},'uniqueid':{'type':Sequelize[_0x5602('0x7')]},'channel':{'type':Sequelize['STRING'],'set':function(_0x27fd06){if(_0x27fd06){this[_0x5602('0x8')](_0x5602('0x9'),_0x27fd06);this[_0x5602('0x8')](_0x5602('0xa'),_0x27fd06[_0x5602('0xb')](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x5602('0x7')]},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x5602('0x7')]},'connectedlinename':{'type':Sequelize[_0x5602('0x7')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x5602('0x7')]},'exten':{'type':Sequelize['STRING']},'value':{'type':Sequelize[_0x5602('0x7')]},'type':{'type':Sequelize['STRING']},'rating':{'type':Sequelize[_0x5602('0xc')],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize[_0x5602('0x7')]},'userDisposition':{'type':Sequelize[_0x5602('0x7')]},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x5602('0x4')](_0x5602('0xd')))[_0x5602('0xe')](_0x5602('0xf'))[_0x5602('0x10')]();}},'updatedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x5602('0x4')](_0x5602('0x11')))[_0x5602('0xe')](_0x5602('0xf'))[_0x5602('0x10')]();}}}; \ No newline at end of file +var _0x285f=['path','exports','VIRTUAL','value','extname','getDataValue','STRING','setDataValue','channel','membername','split','INTEGER','DATE','createdAt','MM-DD-YYYY\x20HH:mm','updatedAt','format','toString','sequelize','moment'];(function(_0x4fbfd9,_0x3ab91a){var _0x31dc94=function(_0x11e53b){while(--_0x11e53b){_0x4fbfd9['push'](_0x4fbfd9['shift']());}};_0x31dc94(++_0x3ab91a);}(_0x285f,0x76));var _0xf285=function(_0xba6c94,_0xa4556d){_0xba6c94=_0xba6c94-0x0;var _0x1b6230=_0x285f[_0xba6c94];return _0x1b6230;};'use strict';var Sequelize=require(_0xf285('0x0'));var moment=require(_0xf285('0x1'));var path=require(_0xf285('0x2'));module[_0xf285('0x3')]={'format':{'type':Sequelize[_0xf285('0x4')],'get':function(){return this['getDataValue'](_0xf285('0x5'))?path[_0xf285('0x6')](this[_0xf285('0x7')]('value')):undefined;}},'uniqueid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xf285('0x8')],'set':function(_0x1d437a){if(_0x1d437a){this[_0xf285('0x9')](_0xf285('0xa'),_0x1d437a);this['setDataValue'](_0xf285('0xb'),_0x1d437a[_0xf285('0xc')](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xf285('0x8')]},'connectedlinenum':{'type':Sequelize[_0xf285('0x8')]},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xf285('0x8')]},'context':{'type':Sequelize[_0xf285('0x8')]},'exten':{'type':Sequelize[_0xf285('0x8')]},'value':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xf285('0x8')]},'rating':{'type':Sequelize[_0xf285('0xd')],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize[_0xf285('0x8')]},'userDisposition':{'type':Sequelize['STRING']},'createdAt':{'type':Sequelize[_0xf285('0xe')],'get':function(){return moment(this['getDataValue'](_0xf285('0xf')))['format'](_0xf285('0x10'))['toString']();}},'updatedAt':{'type':Sequelize[_0xf285('0xe')],'get':function(){return moment(this[_0xf285('0x7')](_0xf285('0x11')))[_0xf285('0x12')](_0xf285('0x10'))[_0xf285('0x13')]();}}}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.controller.js b/server/api/voiceRecording/voiceRecording.controller.js index 31cb8fe..8614145 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 _0x63c6=['options','find','create','body','describe','download','../../components/encryptor','uniqueid','params','value','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','VoiceRecording\x20not\x20found','filename','unlink','message','Not\x20found','sequelize','MD5','col','token','push','$and','extname','info','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','offset','set','Content-Range','json','apply','reject','save','then','destroy','error','name','send','map','VoiceRecording','rawAttributes','fieldName','type','differenceBy','format','query','keys','filters','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','limit','order','sort','filter','where','merge','count','includeAll','include','findAll','catch','show'];(function(_0x3330d2,_0xcb3851){var _0x386202=function(_0x448f96){while(--_0x448f96){_0x3330d2['push'](_0x3330d2['shift']());}};_0x386202(++_0xcb3851);}(_0x63c6,0xee));var _0x663c=function(_0x30b926,_0x26954a){_0x30b926=_0x30b926-0x0;var _0x244712=_0x63c6[_0x30b926];return _0x244712;};'use strict';var pdf=require(_0x663c('0x0'));var emlformat=require(_0x663c('0x1'));var rimraf=require(_0x663c('0x2'));var zipdir=require(_0x663c('0x3'));var jsonpatch=require(_0x663c('0x4'));var rp=require('request-promise');var moment=require(_0x663c('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x663c('0x6'));var util=require('util');var path=require(_0x663c('0x7'));var sox=require('sox');var csv=require(_0x663c('0x8'));var ejs=require(_0x663c('0x9'));var fs=require('fs');var _=require(_0x663c('0xa'));var squel=require(_0x663c('0xb'));var crypto=require(_0x663c('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x663c('0xd'));var toCsv=require('to-csv');var querystring=require(_0x663c('0xe'));var Papa=require(_0x663c('0xf'));var Redis=require(_0x663c('0x10'));var authService=require(_0x663c('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x663c('0x12'));var hardwareService=require(_0x663c('0x13'));var logger=require(_0x663c('0x14'))(_0x663c('0x15'));var utils=require(_0x663c('0x16'));var config=require('../../config/environment');var db=require(_0x663c('0x17'))['db'];function respondWithStatusCode(_0x1c6cd2,_0x1efab0){_0x1efab0=_0x1efab0||0xcc;return function(_0x379fd1){if(_0x379fd1){return _0x1c6cd2[_0x663c('0x18')](_0x1efab0);}return _0x1c6cd2[_0x663c('0x19')](_0x1efab0)[_0x663c('0x1a')]();};}function respondWithResult(_0x5ae8e7,_0x2a53b2){_0x2a53b2=_0x2a53b2||0xc8;return function(_0x28dbae){if(_0x28dbae){return _0x5ae8e7['status'](_0x2a53b2)['json'](_0x28dbae);}};}function respondWithFilteredResult(_0x15e2fa,_0x591684){return function(_0x3067c3){if(_0x3067c3){var _0x357309=_0x3067c3['count'],_0x4568b9=_0x591684[_0x663c('0x1b')],_0x339d22=_0x591684[_0x663c('0x1b')]+_0x591684['limit'],_0x4bc8bc;if(_0x339d22>=_0x357309){_0x339d22=_0x357309;_0x4bc8bc=0xc8;}else{_0x4bc8bc=0xce;}_0x15e2fa[_0x663c('0x19')](_0x4bc8bc);return _0x15e2fa[_0x663c('0x1c')](_0x663c('0x1d'),_0x4568b9+'-'+_0x339d22+'/'+_0x357309)[_0x663c('0x1e')](_0x3067c3);}return null;};}function patchUpdates(_0x4f8007){return function(_0x269133){try{jsonpatch[_0x663c('0x1f')](_0x269133,_0x4f8007,!![]);}catch(_0x29ee65){return BPromise[_0x663c('0x20')](_0x29ee65);}return _0x269133[_0x663c('0x21')]();};}function saveUpdates(_0x3bf90b,_0xd52137){return function(_0x40dd9b){if(_0x40dd9b){return _0x40dd9b['update'](_0x3bf90b)[_0x663c('0x22')](function(_0xe7f561){return _0xe7f561;});}return null;};}function removeEntity(_0x4ffa60,_0x2f00b5){return function(_0x31eaf4){if(_0x31eaf4){return _0x31eaf4[_0x663c('0x23')]()['then'](function(){_0x4ffa60['status'](0xcc)[_0x663c('0x1a')]();});}};}function handleEntityNotFound(_0x227e27,_0x1b8991){return function(_0x8e4708){if(!_0x8e4708){_0x227e27[_0x663c('0x18')](0x194);}return _0x8e4708;};}function handleError(_0x1d2d9b,_0x235b59){_0x235b59=_0x235b59||0x1f4;return function(_0x117161){logger[_0x663c('0x24')](_0x117161['stack']);if(_0x117161[_0x663c('0x25')]){delete _0x117161[_0x663c('0x25')];}_0x1d2d9b[_0x663c('0x19')](_0x235b59)[_0x663c('0x26')](_0x117161);};}exports['index']=function(_0x15383a,_0x50d5c8){var _0x3548c6={},_0x198c8c={},_0x9d4082={'count':0x0,'rows':[]};var _0x3a25ee=_[_0x663c('0x27')](db[_0x663c('0x28')][_0x663c('0x29')],function(_0x218b98){return{'name':_0x218b98[_0x663c('0x2a')],'type':_0x218b98[_0x663c('0x2b')]['key']};});_0x198c8c['model']=_[_0x663c('0x2c')](_[_0x663c('0x27')](_0x3a25ee,_0x663c('0x25')),[_0x663c('0x2d')]);_0x198c8c[_0x663c('0x2e')]=_[_0x663c('0x2f')](_0x15383a[_0x663c('0x2e')]);_0x198c8c[_0x663c('0x30')]=_[_0x663c('0x31')](_0x198c8c['model'],_0x198c8c['query']);_0x3548c6[_0x663c('0x32')]=_['intersection'](_0x198c8c['model'],qs['fields'](_0x15383a[_0x663c('0x2e')][_0x663c('0x33')]));_0x3548c6[_0x663c('0x32')]=_0x3548c6[_0x663c('0x32')][_0x663c('0x34')]?_0x3548c6['attributes']:_0x198c8c[_0x663c('0x35')];if(!_0x15383a[_0x663c('0x2e')][_0x663c('0x36')](_0x663c('0x37'))){_0x3548c6[_0x663c('0x38')]=qs[_0x663c('0x38')](_0x15383a[_0x663c('0x2e')]['limit']);_0x3548c6[_0x663c('0x1b')]=qs[_0x663c('0x1b')](_0x15383a[_0x663c('0x2e')][_0x663c('0x1b')]);}_0x3548c6[_0x663c('0x39')]=qs[_0x663c('0x3a')](_0x15383a[_0x663c('0x2e')][_0x663c('0x3a')]);_0x3548c6['where']=qs[_0x663c('0x30')](_['pick'](_0x15383a['query'],_0x198c8c[_0x663c('0x30')]));if(_0x15383a['query'][_0x663c('0x3b')]){_0x3548c6[_0x663c('0x3c')]=_[_0x663c('0x3d')](_0x3548c6[_0x663c('0x3c')],{'$or':_[_0x663c('0x27')](_0x3a25ee,function(_0x1619b8){if(_0x1619b8[_0x663c('0x2b')]!=='VIRTUAL'){var _0x23e3e7={};_0x23e3e7[_0x1619b8[_0x663c('0x25')]]={'$like':'%'+_0x15383a[_0x663c('0x2e')]['filter']+'%'};return _0x23e3e7;}})});}_0x3548c6=_[_0x663c('0x3d')]({},_0x3548c6,_0x15383a['options']);var _0x26b091={'where':_0x3548c6[_0x663c('0x3c')]};return db['VoiceRecording'][_0x663c('0x3e')](_0x26b091)['then'](function(_0x3642b5){_0x9d4082[_0x663c('0x3e')]=_0x3642b5;if(_0x15383a[_0x663c('0x2e')][_0x663c('0x3f')]){_0x3548c6[_0x663c('0x40')]=[{'all':!![]}];}return db[_0x663c('0x28')][_0x663c('0x41')](_0x3548c6);})[_0x663c('0x22')](function(_0x443bcf){_0x9d4082['rows']=_0x443bcf;return _0x9d4082;})['then'](respondWithFilteredResult(_0x50d5c8,_0x3548c6))[_0x663c('0x42')](handleError(_0x50d5c8,null));};exports[_0x663c('0x43')]=function(_0x13802e,_0x5b2fc3){var _0x1526c4={'raw':![],'where':{'id':_0x13802e['params']['id']}},_0x2b2277={};_0x2b2277[_0x663c('0x35')]=_[_0x663c('0x2f')](db['VoiceRecording'][_0x663c('0x29')]);_0x2b2277[_0x663c('0x2e')]=_['keys'](_0x13802e['query']);_0x2b2277[_0x663c('0x30')]=_[_0x663c('0x31')](_0x2b2277[_0x663c('0x35')],_0x2b2277['query']);_0x1526c4[_0x663c('0x32')]=_[_0x663c('0x31')](_0x2b2277[_0x663c('0x35')],qs[_0x663c('0x33')](_0x13802e['query'][_0x663c('0x33')]));_0x1526c4['attributes']=_0x1526c4[_0x663c('0x32')][_0x663c('0x34')]?_0x1526c4[_0x663c('0x32')]:_0x2b2277['model'];if(_0x13802e[_0x663c('0x2e')][_0x663c('0x3f')]){_0x1526c4['include']=[{'all':!![]}];}_0x1526c4=_[_0x663c('0x3d')]({},_0x1526c4,_0x13802e[_0x663c('0x44')]);return db[_0x663c('0x28')][_0x663c('0x45')](_0x1526c4)['then'](handleEntityNotFound(_0x5b2fc3,null))[_0x663c('0x22')](respondWithResult(_0x5b2fc3,null))['catch'](handleError(_0x5b2fc3,null));};exports[_0x663c('0x46')]=function(_0x3e011d,_0x3cf80e){return db['VoiceRecording'][_0x663c('0x46')](_0x3e011d[_0x663c('0x47')],{})[_0x663c('0x22')](respondWithResult(_0x3cf80e,0xc9))[_0x663c('0x42')](handleError(_0x3cf80e,null));};exports['update']=function(_0x13f490,_0x1ccb9f){if(_0x13f490[_0x663c('0x47')]['id']){delete _0x13f490[_0x663c('0x47')]['id'];}return db[_0x663c('0x28')][_0x663c('0x45')]({'where':{'id':_0x13f490['params']['id']}})[_0x663c('0x22')](handleEntityNotFound(_0x1ccb9f,null))[_0x663c('0x22')](saveUpdates(_0x13f490[_0x663c('0x47')],null))['then'](respondWithResult(_0x1ccb9f,null))[_0x663c('0x42')](handleError(_0x1ccb9f,null));};exports[_0x663c('0x48')]=function(_0x33e41a,_0x2caa9d){return db[_0x663c('0x28')][_0x663c('0x48')]()[_0x663c('0x22')](respondWithResult(_0x2caa9d,null))['catch'](handleError(_0x2caa9d,null));};exports[_0x663c('0x49')]=function(_0x4dc67d,_0x1d13d5,_0xa791ae){var _0x3340b8=require(_0x663c('0x4a'));var _0x326aa5=![];var _0x10d6fe={};if(_0x4dc67d[_0x663c('0x2e')][_0x663c('0x2b')]&&_0x4dc67d['query']['type']===_0x663c('0x4b')){_0x10d6fe[_0x663c('0x4b')]=_0x4dc67d['params']['id'];}else{_0x10d6fe['id']=_0x4dc67d[_0x663c('0x4c')]['id'];}return db[_0x663c('0x28')][_0x663c('0x45')]({'where':_0x10d6fe,'attributes':['id',_0x663c('0x4d')],'raw':!![]})['then'](handleEntityNotFound(_0x1d13d5,null))[_0x663c('0x22')](function(_0x5d198f){if(_0x5d198f){var _0x5f060b=_0x5d198f[_0x663c('0x4d')];var _0x1663de=util[_0x663c('0x2d')](_0x663c('0x4e'),_0x5f060b);if(fs[_0x663c('0x4f')](_0x1663de)){_0x326aa5=!![];return _0x3340b8[_0x663c('0x50')](_0x1663de,_0x5f060b,config[_0x663c('0x51')][_0x663c('0x52')])[_0x663c('0x22')](function(){return _0x5d198f;});}return _0x5d198f;}})[_0x663c('0x22')](function(_0x1e5793){if(_0x1e5793){var _0x2a93e4=_0x1e5793[_0x663c('0x4d')];if(!fs[_0x663c('0x4f')](_0x2a93e4)){throw new db[(_0x663c('0x53'))]['ValidationError'](_0x663c('0x54'));}if(_0x1e5793[_0x663c('0x55')]){return _0x1d13d5[_0x663c('0x49')](_0x2a93e4,_0x1e5793[_0x663c('0x55')]+path['extname'](_0x2a93e4),function(){if(_0x326aa5){fs['unlink'](_0x2a93e4);}});}else{return _0x1d13d5['download'](_0x2a93e4,function(_0xfb63ed){if(_0x326aa5){fs[_0x663c('0x56')](_0x2a93e4);}});}}})['catch'](function(_0x55b4ae){if(_0x55b4ae[_0x663c('0x57')]==='VoiceRecording\x20not\x20found'){_0x1d13d5[_0x663c('0x19')](0x194)[_0x663c('0x26')](_0x663c('0x58'));}else{return handleError(_0x1d13d5,null);}});};exports['downloads']=function(_0x6c35c5,_0x5c6c3d,_0x409235){var _0xf429fe=require(_0x663c('0x4a'));var _0x360db2=![];var _0xd5bb68={'$and':[db[_0x663c('0x59')][_0x663c('0x3c')](db['sequelize']['fn'](_0x663c('0x5a'),db[_0x663c('0x59')][_0x663c('0x5b')](_0x663c('0x4b'))),_0x6c35c5['query'][_0x663c('0x5c')])]};if(_0x6c35c5[_0x663c('0x2e')][_0x663c('0x2b')]&&_0x6c35c5[_0x663c('0x2e')][_0x663c('0x2b')]===_0x663c('0x4b')){_0xd5bb68['$and'][_0x663c('0x5d')]({'uniqueid':_0x6c35c5[_0x663c('0x4c')]['id']});}else{_0xd5bb68[_0x663c('0x5e')][_0x663c('0x5d')]({'id':_0x6c35c5[_0x663c('0x4c')]['id']});}return db['VoiceRecording'][_0x663c('0x45')]({'where':_0xd5bb68,'attributes':['id','value'],'raw':!![]})[_0x663c('0x22')](handleEntityNotFound(_0x5c6c3d,null))[_0x663c('0x22')](function(_0x13fb87){if(_0x13fb87){var _0x12e9df=util[_0x663c('0x2d')](_0x663c('0x4e'),_0x13fb87[_0x663c('0x4d')]);if(fs[_0x663c('0x4f')](_0x12e9df)){_0x360db2=!![];return _0xf429fe[_0x663c('0x50')](_0x12e9df,_0x13fb87[_0x663c('0x4d')],config[_0x663c('0x51')]['recording'])[_0x663c('0x22')](function(){return _0x13fb87;});}return _0x13fb87;}})[_0x663c('0x22')](function(_0x2307ed){if(_0x2307ed){if(!fs['existsSync'](_0x2307ed['value'])){throw new db[(_0x663c('0x53'))]['ValidationError'](_0x663c('0x54'));}if(_0x2307ed['filename']){return _0x5c6c3d[_0x663c('0x49')](_0x2307ed[_0x663c('0x4d')],_0x2307ed[_0x663c('0x55')]+path[_0x663c('0x5f')](_0x2307ed[_0x663c('0x4d')]),function(){if(_0x360db2){fs[_0x663c('0x56')](_0x2307ed[_0x663c('0x4d')]);}});}else{return _0x5c6c3d['download'](_0x2307ed[_0x663c('0x4d')],function(_0x5a1665){if(_0x360db2){fs[_0x663c('0x56')](_0x2307ed['value']);}});}}})[_0x663c('0x42')](handleError(_0x5c6c3d,null));};exports['destroy']=function(_0x470a49,_0x395a00){return db[_0x663c('0x28')]['find']({'where':{'id':_0x470a49[_0x663c('0x4c')]['id']}})[_0x663c('0x22')](function(_0x445343){if(!_0x445343)throw new ReferenceError('Entity\x20not\x20found');return _0x445343;})[_0x663c('0x22')](function(_0x591890){var _0x2e8e56=_0x591890[_0x663c('0x4d')];logger[_0x663c('0x60')]('cancellazione\x20fisica\x20documento\x20%s',_0x2e8e56);if(!_[_0x663c('0x61')](_0x591890['value'])&&fs[_0x663c('0x4f')](_0x2e8e56)){logger['info'](_0x663c('0x62')+_0x2e8e56+_0x663c('0x63'));fs[_0x663c('0x64')](_0x2e8e56);}_0x2e8e56=_0x2e8e56+_0x663c('0x65');if(!_[_0x663c('0x61')](_0x591890[_0x663c('0x4d')])&&fs[_0x663c('0x4f')](_0x2e8e56)){logger[_0x663c('0x60')](_0x663c('0x62')+_0x2e8e56+_0x663c('0x63'));fs['unlinkSync'](_0x2e8e56);}return _0x591890;})[_0x663c('0x22')](function(_0x11cf15){if(!_0x11cf15)throw new InternalError();return _0x11cf15[_0x663c('0x23')]();})['then'](function(){_0x395a00[_0x663c('0x19')](0xcc)[_0x663c('0x1a')]();})[_0x663c('0x42')](handleError(_0x395a00,null));}; \ No newline at end of file +var _0x60b1=['format','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','where','merge','type','VIRTUAL','options','VoiceRecording','count','includeAll','include','rows','catch','show','params','find','create','update','body','describe','../../components/encryptor','uniqueid','value','%s.cypher','existsSync','decryptFile','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','download','extname','unlink','message','Not\x20found','downloads','sequelize','MD5','col','token','push','$and','Entity\x20not\x20found','info','isNil','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','File:\x20\x22','html-pdf','eml-format','rimraf','fast-json-patch','bluebird','mustache','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','then','destroy','error','name','send','index','map','rawAttributes','key'];(function(_0x6d6a66,_0x2924af){var _0x11eb6e=function(_0x52e55a){while(--_0x52e55a){_0x6d6a66['push'](_0x6d6a66['shift']());}};_0x11eb6e(++_0x2924af);}(_0x60b1,0xa6));var _0x160b=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x60b1[_0x5b644e];return _0x49c6bf;};'use strict';var pdf=require(_0x160b('0x0'));var emlformat=require(_0x160b('0x1'));var rimraf=require(_0x160b('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x160b('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x160b('0x4'));var Mustache=require(_0x160b('0x5'));var util=require('util');var path=require(_0x160b('0x6'));var sox=require(_0x160b('0x7'));var csv=require('to-csv');var ejs=require(_0x160b('0x8'));var fs=require('fs');var _=require(_0x160b('0x9'));var squel=require(_0x160b('0xa'));var crypto=require(_0x160b('0xb'));var jsforce=require(_0x160b('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x160b('0xd'));var querystring=require(_0x160b('0xe'));var Papa=require(_0x160b('0xf'));var Redis=require(_0x160b('0x10'));var authService=require(_0x160b('0x11'));var qs=require(_0x160b('0x12'));var as=require(_0x160b('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x160b('0x14'))(_0x160b('0x15'));var utils=require(_0x160b('0x16'));var config=require(_0x160b('0x17'));var db=require(_0x160b('0x18'))['db'];function respondWithStatusCode(_0x248697,_0xf8b489){_0xf8b489=_0xf8b489||0xcc;return function(_0x465142){if(_0x465142){return _0x248697[_0x160b('0x19')](_0xf8b489);}return _0x248697[_0x160b('0x1a')](_0xf8b489)[_0x160b('0x1b')]();};}function respondWithResult(_0x5513bc,_0x253a39){_0x253a39=_0x253a39||0xc8;return function(_0x5b44b6){if(_0x5b44b6){return _0x5513bc[_0x160b('0x1a')](_0x253a39)[_0x160b('0x1c')](_0x5b44b6);}};}function respondWithFilteredResult(_0x30931c,_0x35eb33){return function(_0x358dc9){if(_0x358dc9){var _0x25c2bd=_0x358dc9['count'],_0xf7d683=_0x35eb33[_0x160b('0x1d')],_0x45f6a1=_0x35eb33[_0x160b('0x1d')]+_0x35eb33[_0x160b('0x1e')],_0x1cc0ba;if(_0x45f6a1>=_0x25c2bd){_0x45f6a1=_0x25c2bd;_0x1cc0ba=0xc8;}else{_0x1cc0ba=0xce;}_0x30931c[_0x160b('0x1a')](_0x1cc0ba);return _0x30931c[_0x160b('0x1f')](_0x160b('0x20'),_0xf7d683+'-'+_0x45f6a1+'/'+_0x25c2bd)[_0x160b('0x1c')](_0x358dc9);}return null;};}function patchUpdates(_0x3edd47){return function(_0x163002){try{jsonpatch[_0x160b('0x21')](_0x163002,_0x3edd47,!![]);}catch(_0x327d32){return BPromise[_0x160b('0x22')](_0x327d32);}return _0x163002['save']();};}function saveUpdates(_0x446cd5,_0x2cbb8c){return function(_0x175517){if(_0x175517){return _0x175517['update'](_0x446cd5)[_0x160b('0x23')](function(_0x2f2c85){return _0x2f2c85;});}return null;};}function removeEntity(_0x3224fa,_0x5ba162){return function(_0x325f03){if(_0x325f03){return _0x325f03[_0x160b('0x24')]()['then'](function(){_0x3224fa[_0x160b('0x1a')](0xcc)[_0x160b('0x1b')]();});}};}function handleEntityNotFound(_0x2763db,_0x478604){return function(_0x3a65cd){if(!_0x3a65cd){_0x2763db[_0x160b('0x19')](0x194);}return _0x3a65cd;};}function handleError(_0x1a50c4,_0x44b3e1){_0x44b3e1=_0x44b3e1||0x1f4;return function(_0x24e6e1){logger[_0x160b('0x25')](_0x24e6e1['stack']);if(_0x24e6e1[_0x160b('0x26')]){delete _0x24e6e1[_0x160b('0x26')];}_0x1a50c4[_0x160b('0x1a')](_0x44b3e1)[_0x160b('0x27')](_0x24e6e1);};}exports[_0x160b('0x28')]=function(_0x28951b,_0x956fe0){var _0x4d5b76={},_0x1a618d={},_0x381f2d={'count':0x0,'rows':[]};var _0x84de06=_[_0x160b('0x29')](db['VoiceRecording'][_0x160b('0x2a')],function(_0x18206d){return{'name':_0x18206d['fieldName'],'type':_0x18206d['type'][_0x160b('0x2b')]};});_0x1a618d['model']=_['differenceBy'](_['map'](_0x84de06,'name'),[_0x160b('0x2c')]);_0x1a618d[_0x160b('0x2d')]=_[_0x160b('0x2e')](_0x28951b[_0x160b('0x2d')]);_0x1a618d['filters']=_[_0x160b('0x2f')](_0x1a618d[_0x160b('0x30')],_0x1a618d['query']);_0x4d5b76[_0x160b('0x31')]=_[_0x160b('0x2f')](_0x1a618d[_0x160b('0x30')],qs[_0x160b('0x32')](_0x28951b[_0x160b('0x2d')][_0x160b('0x32')]));_0x4d5b76[_0x160b('0x31')]=_0x4d5b76[_0x160b('0x31')][_0x160b('0x33')]?_0x4d5b76[_0x160b('0x31')]:_0x1a618d[_0x160b('0x30')];if(!_0x28951b[_0x160b('0x2d')][_0x160b('0x34')](_0x160b('0x35'))){_0x4d5b76[_0x160b('0x1e')]=qs[_0x160b('0x1e')](_0x28951b[_0x160b('0x2d')]['limit']);_0x4d5b76['offset']=qs[_0x160b('0x1d')](_0x28951b[_0x160b('0x2d')][_0x160b('0x1d')]);}_0x4d5b76[_0x160b('0x36')]=qs[_0x160b('0x37')](_0x28951b[_0x160b('0x2d')][_0x160b('0x37')]);_0x4d5b76['where']=qs[_0x160b('0x38')](_['pick'](_0x28951b[_0x160b('0x2d')],_0x1a618d[_0x160b('0x38')]));if(_0x28951b[_0x160b('0x2d')][_0x160b('0x39')]){_0x4d5b76[_0x160b('0x3a')]=_[_0x160b('0x3b')](_0x4d5b76['where'],{'$or':_[_0x160b('0x29')](_0x84de06,function(_0x24294b){if(_0x24294b[_0x160b('0x3c')]!==_0x160b('0x3d')){var _0x49cc4f={};_0x49cc4f[_0x24294b[_0x160b('0x26')]]={'$like':'%'+_0x28951b[_0x160b('0x2d')][_0x160b('0x39')]+'%'};return _0x49cc4f;}})});}_0x4d5b76=_['merge']({},_0x4d5b76,_0x28951b[_0x160b('0x3e')]);var _0x108063={'where':_0x4d5b76['where']};return db[_0x160b('0x3f')][_0x160b('0x40')](_0x108063)[_0x160b('0x23')](function(_0x49ae30){_0x381f2d[_0x160b('0x40')]=_0x49ae30;if(_0x28951b[_0x160b('0x2d')][_0x160b('0x41')]){_0x4d5b76[_0x160b('0x42')]=[{'all':!![]}];}return db[_0x160b('0x3f')]['findAll'](_0x4d5b76);})[_0x160b('0x23')](function(_0x463dbf){_0x381f2d[_0x160b('0x43')]=_0x463dbf;return _0x381f2d;})['then'](respondWithFilteredResult(_0x956fe0,_0x4d5b76))[_0x160b('0x44')](handleError(_0x956fe0,null));};exports[_0x160b('0x45')]=function(_0x1c28a9,_0x7ddf52){var _0x193e56={'raw':![],'where':{'id':_0x1c28a9[_0x160b('0x46')]['id']}},_0x2d5090={};_0x2d5090[_0x160b('0x30')]=_[_0x160b('0x2e')](db[_0x160b('0x3f')]['rawAttributes']);_0x2d5090[_0x160b('0x2d')]=_[_0x160b('0x2e')](_0x1c28a9[_0x160b('0x2d')]);_0x2d5090[_0x160b('0x38')]=_[_0x160b('0x2f')](_0x2d5090[_0x160b('0x30')],_0x2d5090[_0x160b('0x2d')]);_0x193e56[_0x160b('0x31')]=_[_0x160b('0x2f')](_0x2d5090['model'],qs['fields'](_0x1c28a9[_0x160b('0x2d')][_0x160b('0x32')]));_0x193e56[_0x160b('0x31')]=_0x193e56[_0x160b('0x31')]['length']?_0x193e56[_0x160b('0x31')]:_0x2d5090[_0x160b('0x30')];if(_0x1c28a9[_0x160b('0x2d')][_0x160b('0x41')]){_0x193e56[_0x160b('0x42')]=[{'all':!![]}];}_0x193e56=_['merge']({},_0x193e56,_0x1c28a9[_0x160b('0x3e')]);return db[_0x160b('0x3f')][_0x160b('0x47')](_0x193e56)[_0x160b('0x23')](handleEntityNotFound(_0x7ddf52,null))['then'](respondWithResult(_0x7ddf52,null))[_0x160b('0x44')](handleError(_0x7ddf52,null));};exports[_0x160b('0x48')]=function(_0x15e30b,_0x230fa6){return db['VoiceRecording'][_0x160b('0x48')](_0x15e30b['body'],{})[_0x160b('0x23')](respondWithResult(_0x230fa6,0xc9))[_0x160b('0x44')](handleError(_0x230fa6,null));};exports[_0x160b('0x49')]=function(_0x576ba9,_0x23ce66){if(_0x576ba9['body']['id']){delete _0x576ba9[_0x160b('0x4a')]['id'];}return db[_0x160b('0x3f')][_0x160b('0x47')]({'where':{'id':_0x576ba9[_0x160b('0x46')]['id']}})[_0x160b('0x23')](handleEntityNotFound(_0x23ce66,null))[_0x160b('0x23')](saveUpdates(_0x576ba9['body'],null))[_0x160b('0x23')](respondWithResult(_0x23ce66,null))['catch'](handleError(_0x23ce66,null));};exports[_0x160b('0x4b')]=function(_0x4c97d6,_0x3f6a56){return db['VoiceRecording']['describe']()[_0x160b('0x23')](respondWithResult(_0x3f6a56,null))['catch'](handleError(_0x3f6a56,null));};exports['download']=function(_0x2f9f59,_0x202e45,_0x267de0){var _0x20a608=require(_0x160b('0x4c'));var _0x4148cf=![];var _0x3923d0={};if(_0x2f9f59[_0x160b('0x2d')][_0x160b('0x3c')]&&_0x2f9f59['query']['type']===_0x160b('0x4d')){_0x3923d0[_0x160b('0x4d')]=_0x2f9f59['params']['id'];}else{_0x3923d0['id']=_0x2f9f59[_0x160b('0x46')]['id'];}return db[_0x160b('0x3f')]['find']({'where':_0x3923d0,'attributes':['id',_0x160b('0x4e')],'raw':!![]})[_0x160b('0x23')](handleEntityNotFound(_0x202e45,null))[_0x160b('0x23')](function(_0x487a68){if(_0x487a68){var _0x28a15b=_0x487a68[_0x160b('0x4e')];var _0x540163=util[_0x160b('0x2c')](_0x160b('0x4f'),_0x28a15b);if(fs[_0x160b('0x50')](_0x540163)){_0x4148cf=!![];return _0x20a608[_0x160b('0x51')](_0x540163,_0x28a15b,config['secrets']['recording'])[_0x160b('0x23')](function(){return _0x487a68;});}return _0x487a68;}})[_0x160b('0x23')](function(_0x2b0b5f){if(_0x2b0b5f){var _0x383f5f=_0x2b0b5f['value'];if(!fs[_0x160b('0x50')](_0x383f5f)){throw new db[(_0x160b('0x52'))][(_0x160b('0x53'))](_0x160b('0x54'));}if(_0x2b0b5f[_0x160b('0x55')]){return _0x202e45[_0x160b('0x56')](_0x383f5f,_0x2b0b5f[_0x160b('0x55')]+path[_0x160b('0x57')](_0x383f5f),function(){if(_0x4148cf){fs[_0x160b('0x58')](_0x383f5f);}});}else{return _0x202e45[_0x160b('0x56')](_0x383f5f,function(_0x24e676){if(_0x4148cf){fs[_0x160b('0x58')](_0x383f5f);}});}}})[_0x160b('0x44')](function(_0xc9edf){if(_0xc9edf[_0x160b('0x59')]===_0x160b('0x54')){_0x202e45[_0x160b('0x1a')](0x194)[_0x160b('0x27')](_0x160b('0x5a'));}else{return handleError(_0x202e45,null);}});};exports[_0x160b('0x5b')]=function(_0x1f6e32,_0x1ad650,_0x350614){var _0x1ce3d4=require(_0x160b('0x4c'));var _0x31c548=![];var _0x3217ef={'$and':[db[_0x160b('0x5c')][_0x160b('0x3a')](db[_0x160b('0x5c')]['fn'](_0x160b('0x5d'),db[_0x160b('0x5c')][_0x160b('0x5e')](_0x160b('0x4d'))),_0x1f6e32[_0x160b('0x2d')][_0x160b('0x5f')])]};if(_0x1f6e32[_0x160b('0x2d')][_0x160b('0x3c')]&&_0x1f6e32['query']['type']===_0x160b('0x4d')){_0x3217ef['$and'][_0x160b('0x60')]({'uniqueid':_0x1f6e32[_0x160b('0x46')]['id']});}else{_0x3217ef[_0x160b('0x61')][_0x160b('0x60')]({'id':_0x1f6e32[_0x160b('0x46')]['id']});}return db['VoiceRecording'][_0x160b('0x47')]({'where':_0x3217ef,'attributes':['id',_0x160b('0x4e')],'raw':!![]})['then'](handleEntityNotFound(_0x1ad650,null))[_0x160b('0x23')](function(_0x24bf6f){if(_0x24bf6f){var _0x3a7c9d=util[_0x160b('0x2c')](_0x160b('0x4f'),_0x24bf6f['value']);if(fs[_0x160b('0x50')](_0x3a7c9d)){_0x31c548=!![];return _0x1ce3d4[_0x160b('0x51')](_0x3a7c9d,_0x24bf6f[_0x160b('0x4e')],config['secrets']['recording'])[_0x160b('0x23')](function(){return _0x24bf6f;});}return _0x24bf6f;}})[_0x160b('0x23')](function(_0x430cf6){if(_0x430cf6){if(!fs[_0x160b('0x50')](_0x430cf6[_0x160b('0x4e')])){throw new db['Sequelize']['ValidationError'](_0x160b('0x54'));}if(_0x430cf6[_0x160b('0x55')]){return _0x1ad650[_0x160b('0x56')](_0x430cf6[_0x160b('0x4e')],_0x430cf6[_0x160b('0x55')]+path[_0x160b('0x57')](_0x430cf6[_0x160b('0x4e')]),function(){if(_0x31c548){fs['unlink'](_0x430cf6['value']);}});}else{return _0x1ad650[_0x160b('0x56')](_0x430cf6[_0x160b('0x4e')],function(_0x19362c){if(_0x31c548){fs[_0x160b('0x58')](_0x430cf6[_0x160b('0x4e')]);}});}}})['catch'](handleError(_0x1ad650,null));};exports[_0x160b('0x24')]=function(_0x566b7d,_0x24c6a4){return db[_0x160b('0x3f')][_0x160b('0x47')]({'where':{'id':_0x566b7d[_0x160b('0x46')]['id']}})[_0x160b('0x23')](function(_0xa06034){if(!_0xa06034)throw new ReferenceError(_0x160b('0x62'));return _0xa06034;})[_0x160b('0x23')](function(_0x300c3a){var _0x302380=_0x300c3a[_0x160b('0x4e')];logger[_0x160b('0x63')]('cancellazione\x20fisica\x20documento\x20%s',_0x302380);if(!_[_0x160b('0x64')](_0x300c3a[_0x160b('0x4e')])&&fs[_0x160b('0x50')](_0x302380)){logger[_0x160b('0x63')]('File:\x20\x22'+_0x302380+_0x160b('0x65'));fs[_0x160b('0x66')](_0x302380);}_0x302380=_0x302380+_0x160b('0x67');if(!_['isNil'](_0x300c3a[_0x160b('0x4e')])&&fs[_0x160b('0x50')](_0x302380)){logger[_0x160b('0x63')](_0x160b('0x68')+_0x302380+_0x160b('0x65'));fs['unlinkSync'](_0x302380);}return _0x300c3a;})[_0x160b('0x23')](function(_0x2fa60e){if(!_0x2fa60e)throw new InternalError();return _0x2fa60e[_0x160b('0x24')]();})['then'](function(){_0x24c6a4[_0x160b('0x1a')](0xcc)['end']();})['catch'](handleError(_0x24c6a4,null));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 00bc50d..94eee04 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 _0x941a=['moment','bluebird','request-promise','./voiceRecording.attributes','voice_recordings','uniqueid','../../config/logger','api'];(function(_0x2ec461,_0x5f588a){var _0x28603d=function(_0x21114b){while(--_0x21114b){_0x2ec461['push'](_0x2ec461['shift']());}};_0x28603d(++_0x5f588a);}(_0x941a,0x186));var _0xa941=function(_0x5c6abe,_0x269ea6){_0x5c6abe=_0x5c6abe-0x0;var _0x480473=_0x941a[_0x5c6abe];return _0x480473;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xa941('0x0'))(_0xa941('0x1'));var moment=require(_0xa941('0x2'));var BPromise=require(_0xa941('0x3'));var rp=require(_0xa941('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xa941('0x5'));module['exports']=function(_0x15ea83,_0x1e5b1a){return _0x15ea83['define']('VoiceRecording',attributes,{'tableName':_0xa941('0x6'),'paranoid':![],'indexes':[{'name':_0xa941('0x7'),'fields':[_0xa941('0x7')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3d27=['define','VoiceRecording','voice_recordings','uniqueid','util','../../config/logger','api','moment','../../config/environment','./voiceRecording.attributes'];(function(_0x381ac0,_0x543d42){var _0x4473c6=function(_0x5bfcd2){while(--_0x5bfcd2){_0x381ac0['push'](_0x381ac0['shift']());}};_0x4473c6(++_0x543d42);}(_0x3d27,0xf4));var _0x73d2=function(_0x22dac7,_0x45d32a){_0x22dac7=_0x22dac7-0x0;var _0x3e6cfa=_0x3d27[_0x22dac7];return _0x3e6cfa;};'use strict';var _=require('lodash');var util=require(_0x73d2('0x0'));var logger=require(_0x73d2('0x1'))(_0x73d2('0x2'));var moment=require(_0x73d2('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x73d2('0x4'));var attributes=require(_0x73d2('0x5'));module['exports']=function(_0x8cbfbc,_0x2f5ac7){return _0x8cbfbc[_0x73d2('0x6')](_0x73d2('0x7'),attributes,{'tableName':_0x73d2('0x8'),'paranoid':![],'indexes':[{'name':_0x73d2('0x9'),'fields':[_0x73d2('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index f882087..7c44e6f 100644 --- a/server/api/voiceRecording/voiceRecording.rpc.js +++ b/server/api/voiceRecording/voiceRecording.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['findOne','callRecordingEncryption','create','existsSync','value','%s.cypher','encryptFile','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','VoiceRecording','update','body','options','raw','then','UpdateVoiceRecording','stringify','CreateVoiceRecording'];(function(_0x4eec9b,_0x4aea09){var _0x2e3849=function(_0x24c06d){while(--_0x24c06d){_0x4eec9b['push'](_0x4eec9b['shift']());}};_0x2e3849(++_0x4aea09);}(_0xa9e0,0x123));var _0x0a9e=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0xa9e0[_0x102e37];return _0x35a07c;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['UpdateVoiceRecording']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')](_0x459eb1[_0x0a9e('0x16')],{'raw':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1[_0x0a9e('0x17')][_0x0a9e('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1[_0x0a9e('0x17')]['where']||null:null,'attributes':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1[_0x0a9e('0x17')]['attributes']||null:null,'limit':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1['options']['limit']||null:null})[_0x0a9e('0x19')](function(_0x432e56){logger[_0x0a9e('0xa')](_0x0a9e('0x1a'),_0x459eb1);logger['debug'](_0x0a9e('0x1a'),_0x459eb1,JSON[_0x0a9e('0x1b')](_0x432e56));_0x106033(_0x432e56);})[_0x0a9e('0x13')](function(_0x4d00e6){logger[_0x0a9e('0x10')](_0x0a9e('0x1a'),_0x4d00e6[_0x0a9e('0x11')],_0x459eb1);_0x205fd6(_0x478723['error'](0x1f4,_0x4d00e6['message']));});});};exports[_0x0a9e('0x1c')]=function(_0x3a8e58){var _0x40c424=this;return new Promise(function(_0x33161b,_0x526cf3){var _0x384319=require('../../components/encryptor');var _0x45a1e7;return db['Setting'][_0x0a9e('0x1d')]({'attributes':['id',_0x0a9e('0x1e')],'where':{'id':0x1},'raw':!![]})[_0x0a9e('0x19')](function(_0x14433c){_0x45a1e7=_0x14433c;return db[_0x0a9e('0x14')][_0x0a9e('0x1f')](_0x3a8e58[_0x0a9e('0x16')]);})[_0x0a9e('0x19')](function(_0x5a101a){if(_0x45a1e7[_0x0a9e('0x1e')]&&fs[_0x0a9e('0x20')](_0x5a101a[_0x0a9e('0x21')])){var _0x2ec755=util['format'](_0x0a9e('0x22'),_0x5a101a[_0x0a9e('0x21')]);return _0x384319[_0x0a9e('0x23')](_0x5a101a[_0x0a9e('0x21')],_0x2ec755,config[_0x0a9e('0x24')][_0x0a9e('0x25')])[_0x0a9e('0x19')](function(){fs[_0x0a9e('0x26')](_0x5a101a[_0x0a9e('0x21')]);logger['info'](_0x0a9e('0x27'));return _0x5a101a;});}return _0x5a101a;})['then'](function(_0x2407f9){logger[_0x0a9e('0xa')](_0x0a9e('0x1c'),_0x3a8e58);logger[_0x0a9e('0xd')](_0x0a9e('0x1c'),_0x3a8e58,JSON['stringify'](_0x2407f9));_0x33161b(_0x2407f9);})[_0x0a9e('0x13')](function(_0x46f0a5){logger[_0x0a9e('0x10')](_0x0a9e('0x1c'),_0x46f0a5[_0x0a9e('0x11')],_0x3a8e58);_0x526cf3(_0x40c424[_0x0a9e('0x10')](0x1f4,_0x46f0a5[_0x0a9e('0x11')]));});});}; \ No newline at end of file +var _0xa9e0=['findOne','callRecordingEncryption','create','existsSync','value','%s.cypher','encryptFile','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','VoiceRecording','update','body','options','raw','then','UpdateVoiceRecording','stringify','CreateVoiceRecording'];(function(_0x29f6f8,_0x3bd3e4){var _0x6c4589=function(_0x4cc8dc){while(--_0x4cc8dc){_0x29f6f8['push'](_0x29f6f8['shift']());}};_0x6c4589(++_0x3bd3e4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0xa9e0[_0x138f59];return _0x3d114d;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['UpdateVoiceRecording']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')](_0x459eb1[_0x0a9e('0x16')],{'raw':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1[_0x0a9e('0x17')][_0x0a9e('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1[_0x0a9e('0x17')]['where']||null:null,'attributes':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1[_0x0a9e('0x17')]['attributes']||null:null,'limit':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1['options']['limit']||null:null})[_0x0a9e('0x19')](function(_0x432e56){logger[_0x0a9e('0xa')](_0x0a9e('0x1a'),_0x459eb1);logger['debug'](_0x0a9e('0x1a'),_0x459eb1,JSON[_0x0a9e('0x1b')](_0x432e56));_0x106033(_0x432e56);})[_0x0a9e('0x13')](function(_0x4d00e6){logger[_0x0a9e('0x10')](_0x0a9e('0x1a'),_0x4d00e6[_0x0a9e('0x11')],_0x459eb1);_0x205fd6(_0x478723['error'](0x1f4,_0x4d00e6['message']));});});};exports[_0x0a9e('0x1c')]=function(_0x3a8e58){var _0x40c424=this;return new Promise(function(_0x33161b,_0x526cf3){var _0x384319=require('../../components/encryptor');var _0x45a1e7;return db['Setting'][_0x0a9e('0x1d')]({'attributes':['id',_0x0a9e('0x1e')],'where':{'id':0x1},'raw':!![]})[_0x0a9e('0x19')](function(_0x14433c){_0x45a1e7=_0x14433c;return db[_0x0a9e('0x14')][_0x0a9e('0x1f')](_0x3a8e58[_0x0a9e('0x16')]);})[_0x0a9e('0x19')](function(_0x5a101a){if(_0x45a1e7[_0x0a9e('0x1e')]&&fs[_0x0a9e('0x20')](_0x5a101a[_0x0a9e('0x21')])){var _0x2ec755=util['format'](_0x0a9e('0x22'),_0x5a101a[_0x0a9e('0x21')]);return _0x384319[_0x0a9e('0x23')](_0x5a101a[_0x0a9e('0x21')],_0x2ec755,config[_0x0a9e('0x24')][_0x0a9e('0x25')])[_0x0a9e('0x19')](function(){fs[_0x0a9e('0x26')](_0x5a101a[_0x0a9e('0x21')]);logger['info'](_0x0a9e('0x27'));return _0x5a101a;});}return _0x5a101a;})['then'](function(_0x2407f9){logger[_0x0a9e('0xa')](_0x0a9e('0x1c'),_0x3a8e58);logger[_0x0a9e('0xd')](_0x0a9e('0x1c'),_0x3a8e58,JSON['stringify'](_0x2407f9));_0x33161b(_0x2407f9);})[_0x0a9e('0x13')](function(_0x46f0a5){logger[_0x0a9e('0x10')](_0x0a9e('0x1c'),_0x46f0a5[_0x0a9e('0x11')],_0x3a8e58);_0x526cf3(_0x40c424[_0x0a9e('0x10')](0x1f4,_0x46f0a5[_0x0a9e('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index 901efb5..0ac33a7 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 _0x326f=['show','post','update','delete','destroy','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated','index','/:id'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x326f,0xd1));var _0xf326=function(_0x50fb0a,_0x1ffe68){_0x50fb0a=_0x50fb0a-0x0;var _0x1b5ed9=_0x326f[_0x50fb0a];return _0x1b5ed9;};'use strict';var multer=require(_0xf326('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xf326('0x1'));var express=require(_0xf326('0x2'));var router=express[_0xf326('0x3')]();var auth=require(_0xf326('0x4'));var interaction=require(_0xf326('0x5'));var config=require(_0xf326('0x6'));var controller=require(_0xf326('0x7'));router[_0xf326('0x8')]('/',auth[_0xf326('0x9')](),controller[_0xf326('0xa')]);router['get'](_0xf326('0xb'),auth[_0xf326('0x9')](),controller[_0xf326('0xc')]);router[_0xf326('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xf326('0xb'),auth[_0xf326('0x9')](),controller[_0xf326('0xe')]);router[_0xf326('0xf')](_0xf326('0xb'),auth['isAuthenticated'](),controller[_0xf326('0x10')]);module['exports']=router; \ No newline at end of file +var _0x2eb2=['/:id','show','post','create','put','delete','destroy','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','isAuthenticated','index','get'];(function(_0x269bf3,_0x163c50){var _0xd58793=function(_0x208ba1){while(--_0x208ba1){_0x269bf3['push'](_0x269bf3['shift']());}};_0xd58793(++_0x163c50);}(_0x2eb2,0x19f));var _0x22eb=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0x2eb2[_0xae7c2f];return _0x5d7001;};'use strict';var multer=require('multer');var util=require(_0x22eb('0x0'));var path=require(_0x22eb('0x1'));var timeout=require(_0x22eb('0x2'));var express=require(_0x22eb('0x3'));var router=express[_0x22eb('0x4')]();var auth=require(_0x22eb('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x22eb('0x6'));var controller=require('./voiceTransferReport.controller');router['get']('/',auth[_0x22eb('0x7')](),controller[_0x22eb('0x8')]);router[_0x22eb('0x9')](_0x22eb('0xa'),auth[_0x22eb('0x7')](),controller[_0x22eb('0xb')]);router[_0x22eb('0xc')]('/',auth[_0x22eb('0x7')](),controller[_0x22eb('0xd')]);router[_0x22eb('0xe')](_0x22eb('0xa'),auth[_0x22eb('0x7')](),controller['update']);router[_0x22eb('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x22eb('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index 96f2c79..e3f1b0a 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 _0x32b8=['STRING','sequelize','moment','exports','ENUM','blind','attended'];(function(_0x5e28c2,_0x1e48ab){var _0x1a8cc6=function(_0x1218bf){while(--_0x1218bf){_0x5e28c2['push'](_0x5e28c2['shift']());}};_0x1a8cc6(++_0x1e48ab);}(_0x32b8,0xcc));var _0x832b=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x32b8[_0x57b54c];return _0x59cc19;};'use strict';var Sequelize=require(_0x832b('0x0'));var moment=require(_0x832b('0x1'));module[_0x832b('0x2')]={'type':{'type':Sequelize[_0x832b('0x3')](_0x832b('0x4'),_0x832b('0x5'))},'result':{'type':Sequelize[_0x832b('0x6')]},'transfererchannel':{'type':Sequelize[_0x832b('0x6')]},'transferercalleridnum':{'type':Sequelize[_0x832b('0x6')]},'transferercalleridname':{'type':Sequelize[_0x832b('0x6')]},'transfererconnectedlinenum':{'type':Sequelize[_0x832b('0x6')]},'transfererconnectedlinename':{'type':Sequelize[_0x832b('0x6')]},'transfereraccountcode':{'type':Sequelize[_0x832b('0x6')]},'transferercontext':{'type':Sequelize['STRING']},'transfererexten':{'type':Sequelize[_0x832b('0x6')]},'transfererlinkedid':{'type':Sequelize['STRING']},'transfereechannel':{'type':Sequelize['STRING']},'transfereecalleridnum':{'type':Sequelize['STRING']},'transfereecalleridname':{'type':Sequelize[_0x832b('0x6')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x832b('0x6')]},'transfereeconnectedlinename':{'type':Sequelize['STRING']},'transfereeaccountcode':{'type':Sequelize[_0x832b('0x6')]},'transfereecontext':{'type':Sequelize['STRING']},'transfereeexten':{'type':Sequelize[_0x832b('0x6')]},'transfereelinkedid':{'type':Sequelize['STRING']},'isexternal':{'type':Sequelize[_0x832b('0x3')]('Yes','No')},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xfd2d=['blind','attended','STRING','Yes','exports','ENUM'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xfd2d,0xa0));var _0xdfd2=function(_0xaf8497,_0x563db8){_0xaf8497=_0xaf8497-0x0;var _0x920926=_0xfd2d[_0xaf8497];return _0x920926;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0xdfd2('0x0')]={'type':{'type':Sequelize[_0xdfd2('0x1')](_0xdfd2('0x2'),_0xdfd2('0x3'))},'result':{'type':Sequelize[_0xdfd2('0x4')]},'transfererchannel':{'type':Sequelize['STRING']},'transferercalleridnum':{'type':Sequelize[_0xdfd2('0x4')]},'transferercalleridname':{'type':Sequelize[_0xdfd2('0x4')]},'transfererconnectedlinenum':{'type':Sequelize[_0xdfd2('0x4')]},'transfererconnectedlinename':{'type':Sequelize[_0xdfd2('0x4')]},'transfereraccountcode':{'type':Sequelize[_0xdfd2('0x4')]},'transferercontext':{'type':Sequelize['STRING']},'transfererexten':{'type':Sequelize['STRING']},'transfererlinkedid':{'type':Sequelize[_0xdfd2('0x4')]},'transfereechannel':{'type':Sequelize[_0xdfd2('0x4')]},'transfereecalleridnum':{'type':Sequelize[_0xdfd2('0x4')]},'transfereecalleridname':{'type':Sequelize[_0xdfd2('0x4')]},'transfereeconnectedlinenum':{'type':Sequelize[_0xdfd2('0x4')]},'transfereeconnectedlinename':{'type':Sequelize[_0xdfd2('0x4')]},'transfereeaccountcode':{'type':Sequelize[_0xdfd2('0x4')]},'transfereecontext':{'type':Sequelize[_0xdfd2('0x4')]},'transfereeexten':{'type':Sequelize[_0xdfd2('0x4')]},'transfereelinkedid':{'type':Sequelize[_0xdfd2('0x4')]},'isexternal':{'type':Sequelize['ENUM'](_0xdfd2('0x5'),'No')},'context':{'type':Sequelize[_0xdfd2('0x4')]},'extension':{'type':Sequelize[_0xdfd2('0x4')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index fe908e1..3b6ebde 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 _0xb7e7=['ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','end','name','send','index','VoiceTransferReport','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','include','findAll','rows','catch','show','params','length','find','create','body','html-pdf','rimraf','fast-json-patch','moment','mustache','util','path'];(function(_0x2a1bbe,_0x29347c){var _0x563923=function(_0x10fa66){while(--_0x10fa66){_0x2a1bbe['push'](_0x2a1bbe['shift']());}};_0x563923(++_0x29347c);}(_0xb7e7,0x121));var _0x7b7e=function(_0x34843e,_0x4c4224){_0x34843e=_0x34843e-0x0;var _0x598f7f=_0xb7e7[_0x34843e];return _0x598f7f;};'use strict';var pdf=require(_0x7b7e('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x7b7e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7b7e('0x2'));var rp=require('request-promise');var moment=require(_0x7b7e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x7b7e('0x4'));var util=require(_0x7b7e('0x5'));var path=require(_0x7b7e('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x7b7e('0x7'));var fs=require('fs');var _=require(_0x7b7e('0x8'));var squel=require(_0x7b7e('0x9'));var crypto=require('crypto');var jsforce=require(_0x7b7e('0xa'));var deskjs=require(_0x7b7e('0xb'));var toCsv=require(_0x7b7e('0xc'));var querystring=require(_0x7b7e('0xd'));var Papa=require(_0x7b7e('0xe'));var Redis=require(_0x7b7e('0xf'));var authService=require(_0x7b7e('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x7b7e('0x11'));var hardwareService=require(_0x7b7e('0x12'));var logger=require(_0x7b7e('0x13'))(_0x7b7e('0x14'));var utils=require(_0x7b7e('0x15'));var config=require(_0x7b7e('0x16'));var db=require(_0x7b7e('0x17'))['db'];function respondWithStatusCode(_0x55620b,_0xaadda){_0xaadda=_0xaadda||0xcc;return function(_0x54d8ce){if(_0x54d8ce){return _0x55620b[_0x7b7e('0x18')](_0xaadda);}return _0x55620b[_0x7b7e('0x19')](_0xaadda)['end']();};}function respondWithResult(_0x422d3a,_0x5976ac){_0x5976ac=_0x5976ac||0xc8;return function(_0x4c6011){if(_0x4c6011){return _0x422d3a[_0x7b7e('0x19')](_0x5976ac)[_0x7b7e('0x1a')](_0x4c6011);}};}function respondWithFilteredResult(_0xf067da,_0x457ec5){return function(_0x3d2fb2){if(_0x3d2fb2){var _0x5703fd=_0x3d2fb2[_0x7b7e('0x1b')],_0x51baf6=_0x457ec5[_0x7b7e('0x1c')],_0xc7f087=_0x457ec5[_0x7b7e('0x1c')]+_0x457ec5[_0x7b7e('0x1d')],_0x36444d;if(_0xc7f087>=_0x5703fd){_0xc7f087=_0x5703fd;_0x36444d=0xc8;}else{_0x36444d=0xce;}_0xf067da[_0x7b7e('0x19')](_0x36444d);return _0xf067da[_0x7b7e('0x1e')](_0x7b7e('0x1f'),_0x51baf6+'-'+_0xc7f087+'/'+_0x5703fd)[_0x7b7e('0x1a')](_0x3d2fb2);}return null;};}function patchUpdates(_0x12e8e9){return function(_0x14f4fe){try{jsonpatch[_0x7b7e('0x20')](_0x14f4fe,_0x12e8e9,!![]);}catch(_0x3bec7d){return BPromise[_0x7b7e('0x21')](_0x3bec7d);}return _0x14f4fe[_0x7b7e('0x22')]();};}function saveUpdates(_0x3a7b8b,_0x49eddb){return function(_0x69262b){if(_0x69262b){return _0x69262b[_0x7b7e('0x23')](_0x3a7b8b)[_0x7b7e('0x24')](function(_0x4c0647){return _0x4c0647;});}return null;};}function removeEntity(_0x313122,_0xbf0cb3){return function(_0x14243b){if(_0x14243b){return _0x14243b[_0x7b7e('0x25')]()[_0x7b7e('0x24')](function(){_0x313122[_0x7b7e('0x19')](0xcc)[_0x7b7e('0x26')]();});}};}function handleEntityNotFound(_0x10a66a,_0x53bbb3){return function(_0x5d6215){if(!_0x5d6215){_0x10a66a['sendStatus'](0x194);}return _0x5d6215;};}function handleError(_0x26ee14,_0x22598e){_0x22598e=_0x22598e||0x1f4;return function(_0x23bfa3){logger['error'](_0x23bfa3['stack']);if(_0x23bfa3['name']){delete _0x23bfa3[_0x7b7e('0x27')];}_0x26ee14[_0x7b7e('0x19')](_0x22598e)[_0x7b7e('0x28')](_0x23bfa3);};}exports[_0x7b7e('0x29')]=function(_0x3ceaf5,_0x48fad1){var _0x6a1e71={},_0x21a15={},_0x4c46b8={'count':0x0,'rows':[]};var _0x57b9da=_['map'](db[_0x7b7e('0x2a')][_0x7b7e('0x2b')],function(_0x503625){return{'name':_0x503625[_0x7b7e('0x2c')],'type':_0x503625['type'][_0x7b7e('0x2d')]};});_0x21a15[_0x7b7e('0x2e')]=_[_0x7b7e('0x2f')](_0x57b9da,'name');_0x21a15[_0x7b7e('0x30')]=_[_0x7b7e('0x31')](_0x3ceaf5[_0x7b7e('0x30')]);_0x21a15[_0x7b7e('0x32')]=_[_0x7b7e('0x33')](_0x21a15['model'],_0x21a15[_0x7b7e('0x30')]);_0x6a1e71['attributes']=_[_0x7b7e('0x33')](_0x21a15[_0x7b7e('0x2e')],qs[_0x7b7e('0x34')](_0x3ceaf5[_0x7b7e('0x30')][_0x7b7e('0x34')]));_0x6a1e71[_0x7b7e('0x35')]=_0x6a1e71[_0x7b7e('0x35')]['length']?_0x6a1e71['attributes']:_0x21a15[_0x7b7e('0x2e')];if(!_0x3ceaf5[_0x7b7e('0x30')]['hasOwnProperty'](_0x7b7e('0x36'))){_0x6a1e71[_0x7b7e('0x1d')]=qs[_0x7b7e('0x1d')](_0x3ceaf5['query'][_0x7b7e('0x1d')]);_0x6a1e71[_0x7b7e('0x1c')]=qs[_0x7b7e('0x1c')](_0x3ceaf5[_0x7b7e('0x30')][_0x7b7e('0x1c')]);}_0x6a1e71[_0x7b7e('0x37')]=qs[_0x7b7e('0x38')](_0x3ceaf5[_0x7b7e('0x30')][_0x7b7e('0x38')]);_0x6a1e71[_0x7b7e('0x39')]=qs[_0x7b7e('0x32')](_[_0x7b7e('0x3a')](_0x3ceaf5[_0x7b7e('0x30')],_0x21a15[_0x7b7e('0x32')]));if(_0x3ceaf5[_0x7b7e('0x30')][_0x7b7e('0x3b')]){_0x6a1e71['where']=_[_0x7b7e('0x3c')](_0x6a1e71[_0x7b7e('0x39')],{'$or':_[_0x7b7e('0x2f')](_0x57b9da,function(_0x242609){if(_0x242609[_0x7b7e('0x3d')]!==_0x7b7e('0x3e')){var _0x7f15={};_0x7f15[_0x242609[_0x7b7e('0x27')]]={'$like':'%'+_0x3ceaf5[_0x7b7e('0x30')][_0x7b7e('0x3b')]+'%'};return _0x7f15;}})});}_0x6a1e71=_['merge']({},_0x6a1e71,_0x3ceaf5[_0x7b7e('0x3f')]);var _0x1fa75b={'where':_0x6a1e71[_0x7b7e('0x39')]};return db[_0x7b7e('0x2a')]['count'](_0x1fa75b)[_0x7b7e('0x24')](function(_0x35b31a){_0x4c46b8[_0x7b7e('0x1b')]=_0x35b31a;if(_0x3ceaf5['query']['includeAll']){_0x6a1e71[_0x7b7e('0x40')]=[{'all':!![]}];}return db['VoiceTransferReport'][_0x7b7e('0x41')](_0x6a1e71);})[_0x7b7e('0x24')](function(_0x4de331){_0x4c46b8[_0x7b7e('0x42')]=_0x4de331;return _0x4c46b8;})[_0x7b7e('0x24')](respondWithFilteredResult(_0x48fad1,_0x6a1e71))[_0x7b7e('0x43')](handleError(_0x48fad1,null));};exports[_0x7b7e('0x44')]=function(_0x38d32f,_0x435de5){var _0xc888e4={'raw':!![],'where':{'id':_0x38d32f[_0x7b7e('0x45')]['id']}},_0x1d9bb9={};_0x1d9bb9['model']=_['keys'](db[_0x7b7e('0x2a')]['rawAttributes']);_0x1d9bb9[_0x7b7e('0x30')]=_['keys'](_0x38d32f['query']);_0x1d9bb9[_0x7b7e('0x32')]=_['intersection'](_0x1d9bb9[_0x7b7e('0x2e')],_0x1d9bb9['query']);_0xc888e4[_0x7b7e('0x35')]=_[_0x7b7e('0x33')](_0x1d9bb9[_0x7b7e('0x2e')],qs[_0x7b7e('0x34')](_0x38d32f['query'][_0x7b7e('0x34')]));_0xc888e4[_0x7b7e('0x35')]=_0xc888e4[_0x7b7e('0x35')][_0x7b7e('0x46')]?_0xc888e4[_0x7b7e('0x35')]:_0x1d9bb9[_0x7b7e('0x2e')];if(_0x38d32f['query']['includeAll']){_0xc888e4['include']=[{'all':!![]}];}_0xc888e4=_[_0x7b7e('0x3c')]({},_0xc888e4,_0x38d32f[_0x7b7e('0x3f')]);return db[_0x7b7e('0x2a')][_0x7b7e('0x47')](_0xc888e4)[_0x7b7e('0x24')](handleEntityNotFound(_0x435de5,null))[_0x7b7e('0x24')](respondWithResult(_0x435de5,null))['catch'](handleError(_0x435de5,null));};exports[_0x7b7e('0x48')]=function(_0x42e560,_0x5a0832){return db['VoiceTransferReport'][_0x7b7e('0x48')](_0x42e560[_0x7b7e('0x49')],{})[_0x7b7e('0x24')](respondWithResult(_0x5a0832,0xc9))[_0x7b7e('0x43')](handleError(_0x5a0832,null));};exports[_0x7b7e('0x23')]=function(_0xb46776,_0x590154){if(_0xb46776[_0x7b7e('0x49')]['id']){delete _0xb46776['body']['id'];}return db[_0x7b7e('0x2a')][_0x7b7e('0x47')]({'where':{'id':_0xb46776[_0x7b7e('0x45')]['id']}})[_0x7b7e('0x24')](handleEntityNotFound(_0x590154,null))['then'](saveUpdates(_0xb46776[_0x7b7e('0x49')],null))[_0x7b7e('0x24')](respondWithResult(_0x590154,null))[_0x7b7e('0x43')](handleError(_0x590154,null));};exports[_0x7b7e('0x25')]=function(_0x1f9d0f,_0x5cce7c){return db[_0x7b7e('0x2a')][_0x7b7e('0x47')]({'where':{'id':_0x1f9d0f[_0x7b7e('0x45')]['id']}})[_0x7b7e('0x24')](handleEntityNotFound(_0x5cce7c,null))[_0x7b7e('0x24')](removeEntity(_0x5cce7c,null))['catch'](handleError(_0x5cce7c,null));}; \ No newline at end of file +var _0x0bb5=['keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','count','includeAll','include','findAll','then','rows','show','params','options','find','catch','create','body','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','Content-Range','json','apply','reject','save','update','destroy','error','stack','name','index','map','VoiceTransferReport','rawAttributes','type','key','model','query'];(function(_0x1b4b23,_0x5dd6d6){var _0x2a325b=function(_0x175462){while(--_0x175462){_0x1b4b23['push'](_0x1b4b23['shift']());}};_0x2a325b(++_0x5dd6d6);}(_0x0bb5,0x148));var _0x50bb=function(_0x4ae188,_0x55cb8a){_0x4ae188=_0x4ae188-0x0;var _0x3b1704=_0x0bb5[_0x4ae188];return _0x3b1704;};'use strict';var pdf=require(_0x50bb('0x0'));var emlformat=require(_0x50bb('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x50bb('0x2'));var rp=require(_0x50bb('0x3'));var moment=require(_0x50bb('0x4'));var BPromise=require(_0x50bb('0x5'));var Mustache=require(_0x50bb('0x6'));var util=require(_0x50bb('0x7'));var path=require(_0x50bb('0x8'));var sox=require(_0x50bb('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x50bb('0xa'));var squel=require(_0x50bb('0xb'));var crypto=require(_0x50bb('0xc'));var jsforce=require(_0x50bb('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x50bb('0xe'));var Papa=require(_0x50bb('0xf'));var Redis=require(_0x50bb('0x10'));var authService=require(_0x50bb('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x50bb('0x12'));var hardwareService=require(_0x50bb('0x13'));var logger=require(_0x50bb('0x14'))(_0x50bb('0x15'));var utils=require(_0x50bb('0x16'));var config=require(_0x50bb('0x17'));var db=require(_0x50bb('0x18'))['db'];function respondWithStatusCode(_0x4d7e3d,_0x226370){_0x226370=_0x226370||0xcc;return function(_0x58837d){if(_0x58837d){return _0x4d7e3d[_0x50bb('0x19')](_0x226370);}return _0x4d7e3d[_0x50bb('0x1a')](_0x226370)[_0x50bb('0x1b')]();};}function respondWithResult(_0x502250,_0x17007f){_0x17007f=_0x17007f||0xc8;return function(_0x309986){if(_0x309986){return _0x502250[_0x50bb('0x1a')](_0x17007f)['json'](_0x309986);}};}function respondWithFilteredResult(_0xbbc6a0,_0x5e8478){return function(_0x21befa){if(_0x21befa){var _0x3e1a51=_0x21befa['count'],_0x253073=_0x5e8478[_0x50bb('0x1c')],_0x42ffab=_0x5e8478[_0x50bb('0x1c')]+_0x5e8478['limit'],_0x908950;if(_0x42ffab>=_0x3e1a51){_0x42ffab=_0x3e1a51;_0x908950=0xc8;}else{_0x908950=0xce;}_0xbbc6a0[_0x50bb('0x1a')](_0x908950);return _0xbbc6a0['set'](_0x50bb('0x1d'),_0x253073+'-'+_0x42ffab+'/'+_0x3e1a51)[_0x50bb('0x1e')](_0x21befa);}return null;};}function patchUpdates(_0x4b06f5){return function(_0x4f1c0a){try{jsonpatch[_0x50bb('0x1f')](_0x4f1c0a,_0x4b06f5,!![]);}catch(_0x1499dc){return BPromise[_0x50bb('0x20')](_0x1499dc);}return _0x4f1c0a[_0x50bb('0x21')]();};}function saveUpdates(_0x56b25a,_0x19dc5d){return function(_0x32bfc3){if(_0x32bfc3){return _0x32bfc3[_0x50bb('0x22')](_0x56b25a)['then'](function(_0x3104c8){return _0x3104c8;});}return null;};}function removeEntity(_0x879fea,_0x1344ec){return function(_0x4825f8){if(_0x4825f8){return _0x4825f8[_0x50bb('0x23')]()['then'](function(){_0x879fea[_0x50bb('0x1a')](0xcc)[_0x50bb('0x1b')]();});}};}function handleEntityNotFound(_0x1a2a0b,_0x2ee87a){return function(_0x846311){if(!_0x846311){_0x1a2a0b[_0x50bb('0x19')](0x194);}return _0x846311;};}function handleError(_0x4f7f73,_0xad17ac){_0xad17ac=_0xad17ac||0x1f4;return function(_0xee0af0){logger[_0x50bb('0x24')](_0xee0af0[_0x50bb('0x25')]);if(_0xee0af0['name']){delete _0xee0af0[_0x50bb('0x26')];}_0x4f7f73['status'](_0xad17ac)['send'](_0xee0af0);};}exports[_0x50bb('0x27')]=function(_0x491632,_0x5cfe4b){var _0x41fd89={},_0x12ee2c={},_0x3004a3={'count':0x0,'rows':[]};var _0x1b74f9=_[_0x50bb('0x28')](db[_0x50bb('0x29')][_0x50bb('0x2a')],function(_0x41d479){return{'name':_0x41d479['fieldName'],'type':_0x41d479[_0x50bb('0x2b')][_0x50bb('0x2c')]};});_0x12ee2c[_0x50bb('0x2d')]=_[_0x50bb('0x28')](_0x1b74f9,'name');_0x12ee2c[_0x50bb('0x2e')]=_[_0x50bb('0x2f')](_0x491632[_0x50bb('0x2e')]);_0x12ee2c[_0x50bb('0x30')]=_[_0x50bb('0x31')](_0x12ee2c[_0x50bb('0x2d')],_0x12ee2c[_0x50bb('0x2e')]);_0x41fd89[_0x50bb('0x32')]=_[_0x50bb('0x31')](_0x12ee2c[_0x50bb('0x2d')],qs[_0x50bb('0x33')](_0x491632[_0x50bb('0x2e')]['fields']));_0x41fd89[_0x50bb('0x32')]=_0x41fd89[_0x50bb('0x32')][_0x50bb('0x34')]?_0x41fd89[_0x50bb('0x32')]:_0x12ee2c[_0x50bb('0x2d')];if(!_0x491632[_0x50bb('0x2e')][_0x50bb('0x35')](_0x50bb('0x36'))){_0x41fd89[_0x50bb('0x37')]=qs[_0x50bb('0x37')](_0x491632[_0x50bb('0x2e')]['limit']);_0x41fd89[_0x50bb('0x1c')]=qs[_0x50bb('0x1c')](_0x491632[_0x50bb('0x2e')][_0x50bb('0x1c')]);}_0x41fd89[_0x50bb('0x38')]=qs[_0x50bb('0x39')](_0x491632['query']['sort']);_0x41fd89[_0x50bb('0x3a')]=qs['filters'](_[_0x50bb('0x3b')](_0x491632[_0x50bb('0x2e')],_0x12ee2c[_0x50bb('0x30')]));if(_0x491632[_0x50bb('0x2e')][_0x50bb('0x3c')]){_0x41fd89['where']=_[_0x50bb('0x3d')](_0x41fd89['where'],{'$or':_[_0x50bb('0x28')](_0x1b74f9,function(_0xc78d23){if(_0xc78d23[_0x50bb('0x2b')]!=='VIRTUAL'){var _0x55d29c={};_0x55d29c[_0xc78d23[_0x50bb('0x26')]]={'$like':'%'+_0x491632[_0x50bb('0x2e')][_0x50bb('0x3c')]+'%'};return _0x55d29c;}})});}_0x41fd89=_[_0x50bb('0x3d')]({},_0x41fd89,_0x491632['options']);var _0x3c273b={'where':_0x41fd89['where']};return db['VoiceTransferReport'][_0x50bb('0x3e')](_0x3c273b)['then'](function(_0x33ad32){_0x3004a3[_0x50bb('0x3e')]=_0x33ad32;if(_0x491632[_0x50bb('0x2e')][_0x50bb('0x3f')]){_0x41fd89[_0x50bb('0x40')]=[{'all':!![]}];}return db[_0x50bb('0x29')][_0x50bb('0x41')](_0x41fd89);})[_0x50bb('0x42')](function(_0x46039a){_0x3004a3[_0x50bb('0x43')]=_0x46039a;return _0x3004a3;})['then'](respondWithFilteredResult(_0x5cfe4b,_0x41fd89))['catch'](handleError(_0x5cfe4b,null));};exports[_0x50bb('0x44')]=function(_0x13076f,_0x1cf062){var _0x1d929d={'raw':!![],'where':{'id':_0x13076f[_0x50bb('0x45')]['id']}},_0x5e8085={};_0x5e8085['model']=_[_0x50bb('0x2f')](db[_0x50bb('0x29')][_0x50bb('0x2a')]);_0x5e8085[_0x50bb('0x2e')]=_[_0x50bb('0x2f')](_0x13076f[_0x50bb('0x2e')]);_0x5e8085[_0x50bb('0x30')]=_[_0x50bb('0x31')](_0x5e8085[_0x50bb('0x2d')],_0x5e8085[_0x50bb('0x2e')]);_0x1d929d[_0x50bb('0x32')]=_[_0x50bb('0x31')](_0x5e8085[_0x50bb('0x2d')],qs[_0x50bb('0x33')](_0x13076f[_0x50bb('0x2e')][_0x50bb('0x33')]));_0x1d929d['attributes']=_0x1d929d[_0x50bb('0x32')]['length']?_0x1d929d[_0x50bb('0x32')]:_0x5e8085[_0x50bb('0x2d')];if(_0x13076f[_0x50bb('0x2e')][_0x50bb('0x3f')]){_0x1d929d[_0x50bb('0x40')]=[{'all':!![]}];}_0x1d929d=_[_0x50bb('0x3d')]({},_0x1d929d,_0x13076f[_0x50bb('0x46')]);return db[_0x50bb('0x29')][_0x50bb('0x47')](_0x1d929d)[_0x50bb('0x42')](handleEntityNotFound(_0x1cf062,null))[_0x50bb('0x42')](respondWithResult(_0x1cf062,null))[_0x50bb('0x48')](handleError(_0x1cf062,null));};exports[_0x50bb('0x49')]=function(_0x457bb4,_0x5880df){return db[_0x50bb('0x29')]['create'](_0x457bb4[_0x50bb('0x4a')],{})[_0x50bb('0x42')](respondWithResult(_0x5880df,0xc9))[_0x50bb('0x48')](handleError(_0x5880df,null));};exports[_0x50bb('0x22')]=function(_0x650e91,_0x39ac1a){if(_0x650e91[_0x50bb('0x4a')]['id']){delete _0x650e91[_0x50bb('0x4a')]['id'];}return db['VoiceTransferReport'][_0x50bb('0x47')]({'where':{'id':_0x650e91[_0x50bb('0x45')]['id']}})[_0x50bb('0x42')](handleEntityNotFound(_0x39ac1a,null))[_0x50bb('0x42')](saveUpdates(_0x650e91[_0x50bb('0x4a')],null))['then'](respondWithResult(_0x39ac1a,null))[_0x50bb('0x48')](handleError(_0x39ac1a,null));};exports[_0x50bb('0x23')]=function(_0x2a411d,_0x154ff8){return db[_0x50bb('0x29')]['find']({'where':{'id':_0x2a411d['params']['id']}})[_0x50bb('0x42')](handleEntityNotFound(_0x154ff8,null))['then'](removeEntity(_0x154ff8,null))[_0x50bb('0x48')](handleError(_0x154ff8,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index d35cb46..a0538aa 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 _0xf4bb=['lodash','util','api','bluebird','path','rimraf','../../config/environment','exports','define','report_call_transfer'];(function(_0xa5f0c4,_0x1b042d){var _0x16b08a=function(_0x428263){while(--_0x428263){_0xa5f0c4['push'](_0xa5f0c4['shift']());}};_0x16b08a(++_0x1b042d);}(_0xf4bb,0x118));var _0xbf4b=function(_0x58afd5,_0x534a48){_0x58afd5=_0x58afd5-0x0;var _0x3e503b=_0xf4bb[_0x58afd5];return _0x3e503b;};'use strict';var _=require(_0xbf4b('0x0'));var util=require(_0xbf4b('0x1'));var logger=require('../../config/logger')(_0xbf4b('0x2'));var moment=require('moment');var BPromise=require(_0xbf4b('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbf4b('0x4'));var rimraf=require(_0xbf4b('0x5'));var config=require(_0xbf4b('0x6'));var attributes=require('./voiceTransferReport.attributes');module[_0xbf4b('0x7')]=function(_0x5927c0,_0x495075){return _0x5927c0[_0xbf4b('0x8')]('VoiceTransferReport',attributes,{'tableName':_0xbf4b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe140=['bluebird','rimraf','../../config/environment','./voiceTransferReport.attributes','define','VoiceTransferReport','report_call_transfer','lodash','util','../../config/logger','api','moment'];(function(_0x110194,_0x47d937){var _0x22d6ec=function(_0x5dd516){while(--_0x5dd516){_0x110194['push'](_0x110194['shift']());}};_0x22d6ec(++_0x47d937);}(_0xe140,0xf7));var _0x0e14=function(_0x7ffb19,_0x5a0fcd){_0x7ffb19=_0x7ffb19-0x0;var _0x3c5ffe=_0xe140[_0x7ffb19];return _0x3c5ffe;};'use strict';var _=require(_0x0e14('0x0'));var util=require(_0x0e14('0x1'));var logger=require(_0x0e14('0x2'))(_0x0e14('0x3'));var moment=require(_0x0e14('0x4'));var BPromise=require(_0x0e14('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x0e14('0x6'));var config=require(_0x0e14('0x7'));var attributes=require(_0x0e14('0x8'));module['exports']=function(_0x1f5d75,_0x3eb76d){return _0x1f5d75[_0x0e14('0x9')](_0x0e14('0xa'),attributes,{'tableName':_0x0e14('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.rpc.js b/server/api/voiceTransferReport/voiceTransferReport.rpc.js index 494834f..74d91c2 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 _0xee3a=['../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateVoiceTransferReport','VoiceTransferReport','create','body','options','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x22c2db,_0x3534e6){var _0x254a57=function(_0x16f415){while(--_0x16f415){_0x22c2db['push'](_0x22c2db['shift']());}};_0x254a57(++_0x3534e6);}(_0xee3a,0x6e));var _0xaee3=function(_0xf0be81,_0xc0293b){_0xf0be81=_0xf0be81-0x0;var _0x596b4d=_0xee3a[_0xf0be81];return _0x596b4d;};'use strict';var _=require(_0xaee3('0x0'));var util=require(_0xaee3('0x1'));var moment=require(_0xaee3('0x2'));var BPromise=require(_0xaee3('0x3'));var rs=require(_0xaee3('0x4'));var fs=require('fs');var Redis=require(_0xaee3('0x5'));var db=require(_0xaee3('0x6'))['db'];var utils=require(_0xaee3('0x7'));var logger=require('../../config/logger')(_0xaee3('0x8'));var config=require('../../config/environment');var jayson=require(_0xaee3('0x9'));var client=jayson[_0xaee3('0xa')][_0xaee3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5ae899,_0x17f118,_0x353ba6){return new BPromise(function(_0xa5ead1,_0x4d0f31){return client[_0xaee3('0xc')](_0x5ae899,_0x353ba6)[_0xaee3('0xd')](function(_0x4fc095){logger[_0xaee3('0xe')](_0xaee3('0xf'),_0x17f118,_0xaee3('0x10'));logger[_0xaee3('0x11')](_0xaee3('0x12'),_0x17f118,_0xaee3('0x10'),JSON[_0xaee3('0x13')](_0x4fc095));if(_0x4fc095['error']){if(_0x4fc095[_0xaee3('0x14')][_0xaee3('0x15')]===0x1f4){logger[_0xaee3('0x14')]('VoiceTransferReport,\x20%s,\x20%s',_0x17f118,_0x4fc095['error']['message']);return _0x4d0f31(_0x4fc095['error'][_0xaee3('0x16')]);}logger['error'](_0xaee3('0xf'),_0x17f118,_0x4fc095[_0xaee3('0x14')][_0xaee3('0x16')]);return _0xa5ead1(_0x4fc095[_0xaee3('0x14')][_0xaee3('0x16')]);}else{logger[_0xaee3('0xe')]('VoiceTransferReport,\x20%s,\x20%s',_0x17f118,_0xaee3('0x10'));_0xa5ead1(_0x4fc095[_0xaee3('0x17')][_0xaee3('0x16')]);}})['catch'](function(_0x3073b4){logger[_0xaee3('0x14')](_0xaee3('0xf'),_0x17f118,_0x3073b4);_0x4d0f31(_0x3073b4);});});}exports[_0xaee3('0x18')]=function(_0x20532e){var _0xdcf404=this;return new Promise(function(_0xdc2b91,_0xdcc897){return db[_0xaee3('0x19')][_0xaee3('0x1a')](_0x20532e[_0xaee3('0x1b')],{'raw':_0x20532e[_0xaee3('0x1c')]?_0x20532e[_0xaee3('0x1c')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0xc60c2){logger[_0xaee3('0xe')](_0xaee3('0x18'),_0x20532e);logger[_0xaee3('0x11')](_0xaee3('0x18'),_0x20532e,JSON[_0xaee3('0x13')](_0xc60c2));_0xdc2b91(_0xc60c2);})['catch'](function(_0x7eb7cd){logger[_0xaee3('0x14')]('CreateVoiceTransferReport',_0x7eb7cd[_0xaee3('0x16')],_0x20532e);_0xdcc897(_0xdcf404['error'](0x1f4,_0x7eb7cd[_0xaee3('0x16')]));});});}; \ No newline at end of file +var _0x93d8=['result','create','options','raw','then','CreateVoiceTransferReport','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x357eb,_0x13b504){var _0x4c5d4a=function(_0x2bd8e5){while(--_0x2bd8e5){_0x357eb['push'](_0x357eb['shift']());}};_0x4c5d4a(++_0x13b504);}(_0x93d8,0xde));var _0x893d=function(_0x31761d,_0x36b248){_0x31761d=_0x31761d-0x0;var _0x31d8f3=_0x93d8[_0x31761d];return _0x31d8f3;};'use strict';var _=require(_0x893d('0x0'));var util=require('util');var moment=require(_0x893d('0x1'));var BPromise=require(_0x893d('0x2'));var rs=require(_0x893d('0x3'));var fs=require('fs');var Redis=require(_0x893d('0x4'));var db=require(_0x893d('0x5'))['db'];var utils=require(_0x893d('0x6'));var logger=require(_0x893d('0x7'))(_0x893d('0x8'));var config=require(_0x893d('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x893d('0xa')][_0x893d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1a3d9b,_0x312d1d,_0x34b521){return new BPromise(function(_0x11df14,_0x58c804){return client['request'](_0x1a3d9b,_0x34b521)['then'](function(_0x3d5ed4){logger[_0x893d('0xc')](_0x893d('0xd'),_0x312d1d,_0x893d('0xe'));logger[_0x893d('0xf')](_0x893d('0x10'),_0x312d1d,_0x893d('0xe'),JSON[_0x893d('0x11')](_0x3d5ed4));if(_0x3d5ed4[_0x893d('0x12')]){if(_0x3d5ed4[_0x893d('0x12')][_0x893d('0x13')]===0x1f4){logger[_0x893d('0x12')](_0x893d('0xd'),_0x312d1d,_0x3d5ed4[_0x893d('0x12')][_0x893d('0x14')]);return _0x58c804(_0x3d5ed4[_0x893d('0x12')][_0x893d('0x14')]);}logger['error'](_0x893d('0xd'),_0x312d1d,_0x3d5ed4[_0x893d('0x12')][_0x893d('0x14')]);return _0x11df14(_0x3d5ed4['error']['message']);}else{logger['info'](_0x893d('0xd'),_0x312d1d,'request\x20sent');_0x11df14(_0x3d5ed4[_0x893d('0x15')][_0x893d('0x14')]);}})['catch'](function(_0x501877){logger['error']('VoiceTransferReport,\x20%s,\x20%s',_0x312d1d,_0x501877);_0x58c804(_0x501877);});});}exports['CreateVoiceTransferReport']=function(_0x582c58){var _0x348c1e=this;return new Promise(function(_0x45914b,_0x148219){return db['VoiceTransferReport'][_0x893d('0x16')](_0x582c58['body'],{'raw':_0x582c58['options']?_0x582c58[_0x893d('0x17')][_0x893d('0x18')]===undefined?!![]:![]:!![]})[_0x893d('0x19')](function(_0x108b2e){logger[_0x893d('0xc')](_0x893d('0x1a'),_0x582c58);logger[_0x893d('0xf')](_0x893d('0x1a'),_0x582c58,JSON['stringify'](_0x108b2e));_0x45914b(_0x108b2e);})['catch'](function(_0x30d068){logger[_0x893d('0x12')](_0x893d('0x1a'),_0x30d068[_0x893d('0x14')],_0x582c58);_0x148219(_0x348c1e['error'](0x1f4,_0x30d068['message']));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index 48a3461..e767e19 100644 --- a/server/api/webbar/index.js +++ b/server/api/webbar/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x630e=['../../components/auth/service','/originate','isAuthenticated','canUpdate','post','/hangup','hangup','/answer','answer','/hold','/unhold','unhold','/calls','calls','/transfer','transfer','exports','express'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x630e,0x1af));var _0xe630=function(_0x2952d6,_0x514d66){_0x2952d6=_0x2952d6-0x0;var _0x5245ef=_0x630e[_0x2952d6];return _0x5245ef;};'use strict';var express=require(_0xe630('0x0'));var router=express['Router']();var auth=require(_0xe630('0x1'));var controller=require('./webbar.controller');router['post'](_0xe630('0x2'),auth[_0xe630('0x3')](),auth[_0xe630('0x4')](),controller['originate']);router[_0xe630('0x5')](_0xe630('0x6'),auth[_0xe630('0x3')](),auth[_0xe630('0x4')](),controller[_0xe630('0x7')]);router['post'](_0xe630('0x8'),auth[_0xe630('0x3')](),auth['canUpdate'](),controller[_0xe630('0x9')]);router['post'](_0xe630('0xa'),auth[_0xe630('0x3')](),auth[_0xe630('0x4')](),controller['hold']);router['post'](_0xe630('0xb'),auth[_0xe630('0x3')](),auth[_0xe630('0x4')](),controller[_0xe630('0xc')]);router['post'](_0xe630('0xd'),auth[_0xe630('0x3')](),auth[_0xe630('0x4')](),controller[_0xe630('0xe')]);router[_0xe630('0x5')](_0xe630('0xf'),auth[_0xe630('0x3')](),auth[_0xe630('0x4')](),controller[_0xe630('0x10')]);module[_0xe630('0x11')]=router; \ No newline at end of file +var _0xb3ea=['/calls','/transfer','transfer','express','Router','../../components/auth/service','post','isAuthenticated','originate','/hangup','canUpdate','/hold','hold','unhold'];(function(_0x3babd6,_0xc4f067){var _0x5b374c=function(_0x40864f){while(--_0x40864f){_0x3babd6['push'](_0x3babd6['shift']());}};_0x5b374c(++_0xc4f067);}(_0xb3ea,0x10d));var _0xab3e=function(_0x2e7d4f,_0x30a460){_0x2e7d4f=_0x2e7d4f-0x0;var _0x26ac42=_0xb3ea[_0x2e7d4f];return _0x26ac42;};'use strict';var express=require(_0xab3e('0x0'));var router=express[_0xab3e('0x1')]();var auth=require(_0xab3e('0x2'));var controller=require('./webbar.controller');router[_0xab3e('0x3')]('/originate',auth[_0xab3e('0x4')](),auth['canUpdate'](),controller[_0xab3e('0x5')]);router[_0xab3e('0x3')](_0xab3e('0x6'),auth[_0xab3e('0x4')](),auth[_0xab3e('0x7')](),controller['hangup']);router[_0xab3e('0x3')]('/answer',auth[_0xab3e('0x4')](),auth[_0xab3e('0x7')](),controller['answer']);router[_0xab3e('0x3')](_0xab3e('0x8'),auth['isAuthenticated'](),auth[_0xab3e('0x7')](),controller[_0xab3e('0x9')]);router['post']('/unhold',auth[_0xab3e('0x4')](),auth[_0xab3e('0x7')](),controller[_0xab3e('0xa')]);router[_0xab3e('0x3')](_0xab3e('0xb'),auth[_0xab3e('0x4')](),auth['canUpdate'](),controller['calls']);router['post'](_0xab3e('0xc'),auth[_0xab3e('0x4')](),auth[_0xab3e('0x7')](),controller[_0xab3e('0xd')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index 8eff076..9e5f083 100644 --- a/server/api/webbar/webbar.controller.js +++ b/server/api/webbar/webbar.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb26=['hangup\x20fired:','webbar:hangup','answer','answer\x20fired:','webbar:answer','answer\x20executed!','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls','calls\x20fired:','conference\x20fired:','transfer','transfer\x20fired:','transferNumber','webbar:transfer','transfer\x20executed!','lodash','../../mysqldb','../../config/environment','util','bluebird','client','../../config/logger','webbarapi','ioredis','redis','defaults','validate','number','userId\x20is\x20required','callNumber\x20is\x20required','string','transferNumber\x20is\x20required','stringify','emit','log','handleError:','error','name','status','send','NotFound','request','then','code','message','result','User','findOne','agent','VoiceChannels','all','filter','rows','UserId','sessionId','length','sessionId\x20','originate','info','originate\x20fired:','body','json','userId','callNumber','callerId','callbackUrl','entityFound:','format','user:%s','webbar:originate','originate\x20executed!','catch','hangup'];(function(_0x389136,_0x5d2bc4){var _0x12e31e=function(_0x2c531f){while(--_0x2c531f){_0x389136['push'](_0x389136['shift']());}};_0x12e31e(++_0x5d2bc4);}(_0xcb26,0x14c));var _0x6cb2=function(_0x28aea5,_0x3bb12e){_0x28aea5=_0x28aea5-0x0;var _0x6a55f9=_0xcb26[_0x28aea5];return _0x6a55f9;};'use strict';var path=require('path');var fs=require('fs');var _=require(_0x6cb2('0x0'));var db=require(_0x6cb2('0x1'))['db'];var config=require(_0x6cb2('0x2'));var util=require(_0x6cb2('0x3'));var BPromise=require(_0x6cb2('0x4'));var jayson=require('jayson/promise');var amiClient=jayson[_0x6cb2('0x5')]['http']({'port':0x232a});var logger=require(_0x6cb2('0x6'))(_0x6cb2('0x7'));var Redis=require(_0x6cb2('0x8'));config[_0x6cb2('0x9')]=_[_0x6cb2('0xa')](config[_0x6cb2('0x9')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x6cb2('0x9')]));var Schema=require(_0x6cb2('0xb'));var originateValidation=new Schema({'userId':{'type':_0x6cb2('0xc'),'required':[!![],_0x6cb2('0xd')]},'callNumber':{'type':'string','required':[!![],_0x6cb2('0xe')]},'callerId':{'type':_0x6cb2('0xf')},'callbackUrl':{'type':_0x6cb2('0xf')}});var hangupValidation=new Schema({'userId':{'type':_0x6cb2('0xc'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x6cb2('0xf'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x6cb2('0xc'),'required':[!![],_0x6cb2('0xd')]},'sessionId':{'type':'string','required':![]}});var transferValidation=new Schema({'userId':{'type':'number','required':[!![],_0x6cb2('0xd')]},'sessionId':{'type':_0x6cb2('0xf'),'required':[!![],'sessionId\x20is\x20required']},'transferNumber':{'type':'string','required':[!![],_0x6cb2('0x10')]}});var holdValidation=new Schema({'userId':{'type':_0x6cb2('0xc'),'required':[!![],_0x6cb2('0xd')]},'sessionId':{'type':_0x6cb2('0xf'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':'number','required':[!![],_0x6cb2('0xd')]},'sessionId':{'type':'string','required':![]}});var callsValidation=new Schema({'userId':{'type':'number','required':[!![],_0x6cb2('0xd')]}});var conferenceValidation=new Schema({'userId':{'type':'number','required':[!![],_0x6cb2('0xd')]}});function emit(_0x57e27a,_0x21cb1a,_0x46c802){logger['info'](_0x57e27a,_0x21cb1a,JSON[_0x6cb2('0x11')](_0x46c802));io['to'](_0x57e27a)[_0x6cb2('0x12')](_0x21cb1a,_0x46c802);}function handleError(_0x42ab4d){return function(_0x39b1b7){console[_0x6cb2('0x13')](_0x6cb2('0x14'),_0x39b1b7,_0x39b1b7 instanceof RangeError);logger[_0x6cb2('0x15')](_0x39b1b7['stack']);if(_0x39b1b7 instanceof RangeError){if(_0x39b1b7[_0x6cb2('0x16')]){delete _0x39b1b7[_0x6cb2('0x16')];}_0x42ab4d[_0x6cb2('0x17')](0x194)[_0x6cb2('0x18')](_0x39b1b7);}else{if(_0x39b1b7[_0x6cb2('0x16')]){delete _0x39b1b7[_0x6cb2('0x16')];}_0x42ab4d[_0x6cb2('0x17')](0x1f4)[_0x6cb2('0x18')](_0x39b1b7);}};}function checkError(){return function(_0x4a2e67){if(!_0x4a2e67){throw new RangeError(_0x6cb2('0x19'));}return _0x4a2e67;};}function respondWithRpcPromise(_0x4d1dd6,_0x6c3eff){return new BPromise(function(_0x4c3bba,_0x413f1d){var _0x3be26d=amiClient;return _0x3be26d[_0x6cb2('0x1a')](_0x4d1dd6,_0x6c3eff)[_0x6cb2('0x1b')](function(_0x43f972){if(_0x43f972[_0x6cb2('0x15')]){if(_0x43f972[_0x6cb2('0x15')][_0x6cb2('0x1c')]===0x1f4){return _0x413f1d(_0x43f972[_0x6cb2('0x15')][_0x6cb2('0x1d')]);}return _0x4c3bba(_0x43f972['error'][_0x6cb2('0x1d')]);}else{_0x4c3bba(_0x43f972[_0x6cb2('0x1e')]);}})['catch'](function(_0x375833){_0x413f1d(_0x375833);});});}function getAgent(_0x4b3bf7){return db[_0x6cb2('0x1f')][_0x6cb2('0x20')]({'where':{'id':_0x4b3bf7,'role':_0x6cb2('0x21')}})[_0x6cb2('0x1b')](checkError());}function getAgentCheckSession(_0x5b21a4,_0x29860f){return new BPromise(function(_0x5253da,_0x50c5c6){var _0x2319a6=respondWithRpcPromise(_0x6cb2('0x22'));var _0x499b33=getAgent(_0x5b21a4);Promise[_0x6cb2('0x23')]([_0x2319a6,_0x499b33])['then'](function(_0x3abbe5){var _0x1b5111=_0x3abbe5[0x0];var _0x5cc052=_0x3abbe5[0x1];var _0xb69f97=_[_0x6cb2('0x24')](_0x1b5111[_0x6cb2('0x25')],function(_0x5ce14e){return _0x5ce14e[_0x6cb2('0x26')]==_0x5cc052['id']&&_0x5ce14e[_0x6cb2('0x27')]==_0x29860f;});if(_0xb69f97[_0x6cb2('0x28')]==0x1){_0x5253da(_0x5cc052);}else{_0x50c5c6(new RangeError(_0x6cb2('0x29')+_0x29860f+'\x20not\x20found!'));}});});}exports[_0x6cb2('0x2a')]=function(_0x4f4092,_0x298331){logger[_0x6cb2('0x2b')](_0x6cb2('0x2c'),_0x4f4092[_0x6cb2('0x2d')]);var _0x4068df=originateValidation[_0x6cb2('0xb')](_0x4f4092[_0x6cb2('0x2d')]);if(_0x4068df[_0x6cb2('0x28')]>0x0){return _0x298331[_0x6cb2('0x17')](0x190)[_0x6cb2('0x2e')](_0x4068df);}var _0x525c6a=_0x4f4092[_0x6cb2('0x2d')][_0x6cb2('0x2f')];var _0x14764a=_0x4f4092[_0x6cb2('0x2d')][_0x6cb2('0x30')];var _0x2e2844=_0x4f4092[_0x6cb2('0x2d')][_0x6cb2('0x31')];var _0x46aa45=_0x4f4092[_0x6cb2('0x2d')][_0x6cb2('0x32')];return getAgent(_0x525c6a)[_0x6cb2('0x1b')](function(_0x11f848){logger['info'](_0x6cb2('0x33'),_0x11f848[_0x6cb2('0x16')]);emit(util[_0x6cb2('0x34')](_0x6cb2('0x35'),_0x11f848[_0x6cb2('0x16')]),_0x6cb2('0x36'),{'callNumber':_0x14764a,'callerId':_0x2e2844,'callbackUrl':_0x46aa45});return _0x298331[_0x6cb2('0x17')](0xc8)[_0x6cb2('0x2e')]({'error':![],'message':_0x6cb2('0x37')});})[_0x6cb2('0x38')](handleError(_0x298331));};exports[_0x6cb2('0x39')]=function(_0xca6a9e,_0x5a2ca1){logger[_0x6cb2('0x2b')](_0x6cb2('0x3a'),_0xca6a9e[_0x6cb2('0x2d')]);var _0x5e20f7=hangupValidation[_0x6cb2('0xb')](_0xca6a9e[_0x6cb2('0x2d')]);if(_0x5e20f7['length']>0x0){return _0x5a2ca1[_0x6cb2('0x17')](0x190)[_0x6cb2('0x2e')](_0x5e20f7);}var _0x37eaa1=_0xca6a9e[_0x6cb2('0x2d')]['userId'];var _0x418403=_0xca6a9e['body'][_0x6cb2('0x27')];return getAgent(_0x37eaa1)['then'](function(_0xc2bf30){logger[_0x6cb2('0x2b')]('entityFound:',_0xc2bf30[_0x6cb2('0x16')]);emit(util['format'](_0x6cb2('0x35'),_0xc2bf30['name']),_0x6cb2('0x3b'),{'sessionId':_0x418403});return _0x5a2ca1[_0x6cb2('0x17')](0xc8)[_0x6cb2('0x2e')]({'error':![],'message':'hangup\x20executed!'});})[_0x6cb2('0x38')](handleError(_0x5a2ca1));};exports[_0x6cb2('0x3c')]=function(_0x120419,_0x716bdd){logger[_0x6cb2('0x2b')](_0x6cb2('0x3d'),_0x120419[_0x6cb2('0x2d')]);var _0x518e80=answerValidation[_0x6cb2('0xb')](_0x120419[_0x6cb2('0x2d')]);if(_0x518e80[_0x6cb2('0x28')]>0x0){return _0x716bdd['status'](0x190)[_0x6cb2('0x2e')](_0x518e80);}var _0x2a4d84=_0x120419[_0x6cb2('0x2d')][_0x6cb2('0x2f')];var _0x2fbf5b=_0x120419[_0x6cb2('0x2d')][_0x6cb2('0x27')];return getAgent(_0x2a4d84)[_0x6cb2('0x1b')](function(_0x3eb34f){logger['info'](_0x6cb2('0x33'),_0x3eb34f[_0x6cb2('0x16')]);emit(util[_0x6cb2('0x34')](_0x6cb2('0x35'),_0x3eb34f[_0x6cb2('0x16')]),_0x6cb2('0x3e'),{'sessionId':_0x2fbf5b});return _0x716bdd[_0x6cb2('0x17')](0xc8)['json']({'error':![],'message':_0x6cb2('0x3f')});})[_0x6cb2('0x38')](handleError(_0x716bdd));};exports['hold']=function(_0x3e960d,_0x15948c){logger[_0x6cb2('0x2b')]('hold\x20fired:',_0x3e960d['body']);var _0x45a8d5=holdValidation[_0x6cb2('0xb')](_0x3e960d[_0x6cb2('0x2d')]);if(_0x45a8d5[_0x6cb2('0x28')]>0x0){return _0x15948c['status'](0x190)[_0x6cb2('0x2e')](_0x45a8d5);}var _0x2d57c8=_0x3e960d[_0x6cb2('0x2d')][_0x6cb2('0x2f')];var _0x303036=_0x3e960d[_0x6cb2('0x2d')][_0x6cb2('0x27')];return getAgent(_0x2d57c8)[_0x6cb2('0x1b')](function(_0x588140){logger[_0x6cb2('0x2b')](_0x6cb2('0x33'),_0x588140[_0x6cb2('0x16')]);emit(util['format'](_0x6cb2('0x35'),_0x588140[_0x6cb2('0x16')]),_0x6cb2('0x40'),{'sessionId':_0x303036});return _0x15948c[_0x6cb2('0x17')](0xc8)[_0x6cb2('0x2e')]({'error':![],'message':_0x6cb2('0x41')});})[_0x6cb2('0x38')](handleError(_0x15948c));};exports[_0x6cb2('0x42')]=function(_0x21aab3,_0x2b7c32){logger[_0x6cb2('0x2b')](_0x6cb2('0x43'),_0x21aab3[_0x6cb2('0x2d')]);var _0xe58b3b=unholdValidation[_0x6cb2('0xb')](_0x21aab3[_0x6cb2('0x2d')]);if(_0xe58b3b['length']>0x0){return _0x2b7c32[_0x6cb2('0x17')](0x190)[_0x6cb2('0x2e')](_0xe58b3b);}var _0x27d166=_0x21aab3[_0x6cb2('0x2d')][_0x6cb2('0x2f')];var _0x18a346=_0x21aab3[_0x6cb2('0x2d')][_0x6cb2('0x27')];return getAgent(_0x27d166)['then'](function(_0x24b82b){logger[_0x6cb2('0x2b')](_0x6cb2('0x33'),_0x24b82b['name']);emit(util['format'](_0x6cb2('0x35'),_0x24b82b['name']),_0x6cb2('0x44'),{'sessionId':_0x18a346});return _0x2b7c32[_0x6cb2('0x17')](0xc8)[_0x6cb2('0x2e')]({'error':![],'message':_0x6cb2('0x45')});})['catch'](handleError(_0x2b7c32));};exports[_0x6cb2('0x46')]=function(_0x5def58,_0x4b9d09){logger[_0x6cb2('0x2b')](_0x6cb2('0x47'),_0x4b9d09[_0x6cb2('0x2d')]);var _0x25292e=callsValidation['validate'](_0x5def58[_0x6cb2('0x2d')]);if(_0x25292e[_0x6cb2('0x28')]>0x0){return _0x4b9d09[_0x6cb2('0x17')](0x190)[_0x6cb2('0x2e')](_0x25292e);}var _0x2e9649=_0x5def58[_0x6cb2('0x2d')][_0x6cb2('0x2f')];var _0x510626=respondWithRpcPromise(_0x6cb2('0x22'));var _0x2f8cf0=getAgent(_0x2e9649);return Promise[_0x6cb2('0x23')]([_0x510626,_0x2f8cf0])['then'](function(_0x40ab96){var _0x455416=_0x40ab96[0x0];var _0x136552=_0x40ab96[0x1];var _0x116c29=_[_0x6cb2('0x24')](_0x455416[_0x6cb2('0x25')],function(_0x50351f){return _0x50351f['UserId']==_0x136552['id'];});return _0x4b9d09[_0x6cb2('0x17')](0xc8)[_0x6cb2('0x2e')]({'count':_0x116c29[_0x6cb2('0x28')],'rows':_0x116c29});})[_0x6cb2('0x38')](handleError(_0x4b9d09));};exports['conference']=function(_0x54c4d4,_0x11847d){logger['info'](_0x6cb2('0x48'),_0x54c4d4[_0x6cb2('0x2d')]);var _0x98d3d4=conferenceValidation[_0x6cb2('0xb')](_0x54c4d4['body']);if(_0x98d3d4[_0x6cb2('0x28')]>0x0){return _0x11847d[_0x6cb2('0x17')](0x190)['json'](_0x98d3d4);}var _0x4ab620=_0x54c4d4['body']['userId'];return getAgent(_0x4ab620)[_0x6cb2('0x1b')](function(_0x3f79e9){logger[_0x6cb2('0x2b')](_0x6cb2('0x33'),_0x3f79e9[_0x6cb2('0x16')]);emit(util[_0x6cb2('0x34')](_0x6cb2('0x35'),_0x3f79e9[_0x6cb2('0x16')]),'webbar:conference');return _0x11847d[_0x6cb2('0x17')](0xc8)[_0x6cb2('0x2e')]({'error':![],'message':'conference\x20executed!'});})[_0x6cb2('0x38')](handleError(_0x11847d));};exports[_0x6cb2('0x49')]=function(_0x1804c1,_0x2d7de2){logger[_0x6cb2('0x2b')](_0x6cb2('0x4a'),_0x1804c1[_0x6cb2('0x2d')]);var _0x3b39d7=transferValidation['validate'](_0x1804c1[_0x6cb2('0x2d')]);if(_0x3b39d7[_0x6cb2('0x28')]>0x0){return _0x2d7de2[_0x6cb2('0x17')](0x190)[_0x6cb2('0x2e')](_0x3b39d7);}var _0x26e142=_0x1804c1[_0x6cb2('0x2d')][_0x6cb2('0x2f')];var _0x21cc87=_0x1804c1[_0x6cb2('0x2d')]['sessionId'];var _0x3a496b=_0x1804c1['body'][_0x6cb2('0x4b')];return getAgent(_0x26e142)[_0x6cb2('0x1b')](function(_0x392535){logger['info'](_0x6cb2('0x33'),_0x392535['name']);emit(util[_0x6cb2('0x34')](_0x6cb2('0x35'),_0x392535['name']),_0x6cb2('0x4c'),{'sessionId':_0x21cc87,'transferNumber':_0x3a496b});return _0x2d7de2[_0x6cb2('0x17')](0xc8)[_0x6cb2('0x2e')]({'error':![],'message':_0x6cb2('0x4d')});})[_0x6cb2('0x38')](handleError(_0x2d7de2));}; \ No newline at end of file +var _0x0531=['hold\x20executed!','unhold\x20fired:','unhold\x20executed!','conference\x20fired:','webbar:conference','transfer\x20fired:','transferNumber','webbar:transfer','transfer\x20executed!','path','lodash','util','client','http','../../config/logger','webbarapi','ioredis','redis','defaults','localhost','socket.io-emitter','validate','number','userId\x20is\x20required','callNumber\x20is\x20required','string','sessionId\x20is\x20required','transferNumber\x20is\x20required','stringify','emit','handleError:','error','stack','name','send','status','then','code','result','User','findOne','agent','VoiceChannels','all','filter','rows','UserId','sessionId','sessionId\x20','\x20not\x20found!','info','originate\x20fired:','body','length','json','userId','callerId','callbackUrl','entityFound:','user:%s','originate\x20executed!','catch','hangup','hangup\x20fired:','format','hangup\x20executed!','answer','answer\x20fired:','hold','hold\x20fired:','webbar:hold'];(function(_0x4e78da,_0x5da586){var _0x2c9085=function(_0x5d41e9){while(--_0x5d41e9){_0x4e78da['push'](_0x4e78da['shift']());}};_0x2c9085(++_0x5da586);}(_0x0531,0xde));var _0x1053=function(_0x3eb4a9,_0x359d73){_0x3eb4a9=_0x3eb4a9-0x0;var _0x48dbad=_0x0531[_0x3eb4a9];return _0x48dbad;};'use strict';var path=require(_0x1053('0x0'));var fs=require('fs');var _=require(_0x1053('0x1'));var db=require('../../mysqldb')['db'];var config=require('../../config/environment');var util=require(_0x1053('0x2'));var BPromise=require('bluebird');var jayson=require('jayson/promise');var amiClient=jayson[_0x1053('0x3')][_0x1053('0x4')]({'port':0x232a});var logger=require(_0x1053('0x5'))(_0x1053('0x6'));var Redis=require(_0x1053('0x7'));config[_0x1053('0x8')]=_[_0x1053('0x9')](config[_0x1053('0x8')],{'host':_0x1053('0xa'),'port':0x18eb});var io=require(_0x1053('0xb'))(new Redis(config['redis']));var Schema=require(_0x1053('0xc'));var originateValidation=new Schema({'userId':{'type':_0x1053('0xd'),'required':[!![],_0x1053('0xe')]},'callNumber':{'type':'string','required':[!![],_0x1053('0xf')]},'callerId':{'type':_0x1053('0x10')},'callbackUrl':{'type':_0x1053('0x10')}});var hangupValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x1053('0x10'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x1053('0xd'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x1053('0x10'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x1053('0xd'),'required':[!![],_0x1053('0xe')]},'sessionId':{'type':_0x1053('0x10'),'required':[!![],_0x1053('0x11')]},'transferNumber':{'type':_0x1053('0x10'),'required':[!![],_0x1053('0x12')]}});var holdValidation=new Schema({'userId':{'type':_0x1053('0xd'),'required':[!![],_0x1053('0xe')]},'sessionId':{'type':_0x1053('0x10'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x1053('0x10'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x1053('0xd'),'required':[!![],_0x1053('0xe')]}});var conferenceValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']}});function emit(_0x1f9067,_0x6d6379,_0x55be6b){logger['info'](_0x1f9067,_0x6d6379,JSON[_0x1053('0x13')](_0x55be6b));io['to'](_0x1f9067)[_0x1053('0x14')](_0x6d6379,_0x55be6b);}function handleError(_0x3df560){return function(_0x26c285){console['log'](_0x1053('0x15'),_0x26c285,_0x26c285 instanceof RangeError);logger[_0x1053('0x16')](_0x26c285[_0x1053('0x17')]);if(_0x26c285 instanceof RangeError){if(_0x26c285['name']){delete _0x26c285[_0x1053('0x18')];}_0x3df560['status'](0x194)[_0x1053('0x19')](_0x26c285);}else{if(_0x26c285['name']){delete _0x26c285['name'];}_0x3df560[_0x1053('0x1a')](0x1f4)[_0x1053('0x19')](_0x26c285);}};}function checkError(){return function(_0x98ea93){if(!_0x98ea93){throw new RangeError('NotFound');}return _0x98ea93;};}function respondWithRpcPromise(_0x4dfa99,_0x125820){return new BPromise(function(_0x15204b,_0x203930){var _0x27371a=amiClient;return _0x27371a['request'](_0x4dfa99,_0x125820)[_0x1053('0x1b')](function(_0x5c2710){if(_0x5c2710[_0x1053('0x16')]){if(_0x5c2710['error'][_0x1053('0x1c')]===0x1f4){return _0x203930(_0x5c2710['error']['message']);}return _0x15204b(_0x5c2710['error']['message']);}else{_0x15204b(_0x5c2710[_0x1053('0x1d')]);}})['catch'](function(_0x423d1c){_0x203930(_0x423d1c);});});}function getAgent(_0x219582){return db[_0x1053('0x1e')][_0x1053('0x1f')]({'where':{'id':_0x219582,'role':_0x1053('0x20')}})[_0x1053('0x1b')](checkError());}function getAgentCheckSession(_0x2c7c39,_0x57c6e7){return new BPromise(function(_0x391194,_0x4f896d){var _0x32c909=respondWithRpcPromise(_0x1053('0x21'));var _0x430601=getAgent(_0x2c7c39);Promise[_0x1053('0x22')]([_0x32c909,_0x430601])[_0x1053('0x1b')](function(_0x22cf83){var _0x30e8d1=_0x22cf83[0x0];var _0x349c1c=_0x22cf83[0x1];var _0x342853=_[_0x1053('0x23')](_0x30e8d1[_0x1053('0x24')],function(_0x27c11e){return _0x27c11e[_0x1053('0x25')]==_0x349c1c['id']&&_0x27c11e[_0x1053('0x26')]==_0x57c6e7;});if(_0x342853['length']==0x1){_0x391194(_0x349c1c);}else{_0x4f896d(new RangeError(_0x1053('0x27')+_0x57c6e7+_0x1053('0x28')));}});});}exports['originate']=function(_0x22603d,_0x3d75ca){logger[_0x1053('0x29')](_0x1053('0x2a'),_0x22603d[_0x1053('0x2b')]);var _0x239bc0=originateValidation[_0x1053('0xc')](_0x22603d[_0x1053('0x2b')]);if(_0x239bc0[_0x1053('0x2c')]>0x0){return _0x3d75ca[_0x1053('0x1a')](0x190)[_0x1053('0x2d')](_0x239bc0);}var _0x4832fd=_0x22603d[_0x1053('0x2b')][_0x1053('0x2e')];var _0x197096=_0x22603d[_0x1053('0x2b')]['callNumber'];var _0x4148c5=_0x22603d[_0x1053('0x2b')][_0x1053('0x2f')];var _0x769471=_0x22603d[_0x1053('0x2b')][_0x1053('0x30')];return getAgent(_0x4832fd)[_0x1053('0x1b')](function(_0x2c1e97){logger['info'](_0x1053('0x31'),_0x2c1e97[_0x1053('0x18')]);emit(util['format'](_0x1053('0x32'),_0x2c1e97['name']),'webbar:originate',{'callNumber':_0x197096,'callerId':_0x4148c5,'callbackUrl':_0x769471});return _0x3d75ca['status'](0xc8)[_0x1053('0x2d')]({'error':![],'message':_0x1053('0x33')});})[_0x1053('0x34')](handleError(_0x3d75ca));};exports[_0x1053('0x35')]=function(_0x292be7,_0x99d622){logger['info'](_0x1053('0x36'),_0x292be7[_0x1053('0x2b')]);var _0x20bf3e=hangupValidation[_0x1053('0xc')](_0x292be7[_0x1053('0x2b')]);if(_0x20bf3e[_0x1053('0x2c')]>0x0){return _0x99d622[_0x1053('0x1a')](0x190)[_0x1053('0x2d')](_0x20bf3e);}var _0x1cef75=_0x292be7[_0x1053('0x2b')][_0x1053('0x2e')];var _0x2b8ad0=_0x292be7['body'][_0x1053('0x26')];return getAgent(_0x1cef75)[_0x1053('0x1b')](function(_0x145394){logger[_0x1053('0x29')](_0x1053('0x31'),_0x145394['name']);emit(util[_0x1053('0x37')](_0x1053('0x32'),_0x145394[_0x1053('0x18')]),'webbar:hangup',{'sessionId':_0x2b8ad0});return _0x99d622[_0x1053('0x1a')](0xc8)[_0x1053('0x2d')]({'error':![],'message':_0x1053('0x38')});})[_0x1053('0x34')](handleError(_0x99d622));};exports[_0x1053('0x39')]=function(_0x466feb,_0x46f000){logger[_0x1053('0x29')](_0x1053('0x3a'),_0x466feb[_0x1053('0x2b')]);var _0x1153d7=answerValidation[_0x1053('0xc')](_0x466feb[_0x1053('0x2b')]);if(_0x1153d7[_0x1053('0x2c')]>0x0){return _0x46f000[_0x1053('0x1a')](0x190)[_0x1053('0x2d')](_0x1153d7);}var _0xed934f=_0x466feb['body'][_0x1053('0x2e')];var _0x5d6db9=_0x466feb[_0x1053('0x2b')][_0x1053('0x26')];return getAgent(_0xed934f)[_0x1053('0x1b')](function(_0x3c12f3){logger[_0x1053('0x29')](_0x1053('0x31'),_0x3c12f3[_0x1053('0x18')]);emit(util[_0x1053('0x37')](_0x1053('0x32'),_0x3c12f3[_0x1053('0x18')]),'webbar:answer',{'sessionId':_0x5d6db9});return _0x46f000[_0x1053('0x1a')](0xc8)[_0x1053('0x2d')]({'error':![],'message':'answer\x20executed!'});})[_0x1053('0x34')](handleError(_0x46f000));};exports[_0x1053('0x3b')]=function(_0x3b8d34,_0x597066){logger[_0x1053('0x29')](_0x1053('0x3c'),_0x3b8d34['body']);var _0x220dcb=holdValidation[_0x1053('0xc')](_0x3b8d34[_0x1053('0x2b')]);if(_0x220dcb[_0x1053('0x2c')]>0x0){return _0x597066['status'](0x190)[_0x1053('0x2d')](_0x220dcb);}var _0x267847=_0x3b8d34[_0x1053('0x2b')][_0x1053('0x2e')];var _0x45c0e0=_0x3b8d34[_0x1053('0x2b')][_0x1053('0x26')];return getAgent(_0x267847)['then'](function(_0x3b16c4){logger[_0x1053('0x29')](_0x1053('0x31'),_0x3b16c4[_0x1053('0x18')]);emit(util[_0x1053('0x37')](_0x1053('0x32'),_0x3b16c4[_0x1053('0x18')]),_0x1053('0x3d'),{'sessionId':_0x45c0e0});return _0x597066['status'](0xc8)['json']({'error':![],'message':_0x1053('0x3e')});})[_0x1053('0x34')](handleError(_0x597066));};exports['unhold']=function(_0x204ac8,_0x828bc3){logger[_0x1053('0x29')](_0x1053('0x3f'),_0x204ac8[_0x1053('0x2b')]);var _0x54c00f=unholdValidation[_0x1053('0xc')](_0x204ac8[_0x1053('0x2b')]);if(_0x54c00f[_0x1053('0x2c')]>0x0){return _0x828bc3[_0x1053('0x1a')](0x190)[_0x1053('0x2d')](_0x54c00f);}var _0x4a6f2d=_0x204ac8[_0x1053('0x2b')][_0x1053('0x2e')];var _0x4f48fe=_0x204ac8[_0x1053('0x2b')][_0x1053('0x26')];return getAgent(_0x4a6f2d)[_0x1053('0x1b')](function(_0x58a314){logger[_0x1053('0x29')]('entityFound:',_0x58a314['name']);emit(util[_0x1053('0x37')](_0x1053('0x32'),_0x58a314[_0x1053('0x18')]),'webbar:unhold',{'sessionId':_0x4f48fe});return _0x828bc3[_0x1053('0x1a')](0xc8)['json']({'error':![],'message':_0x1053('0x40')});})['catch'](handleError(_0x828bc3));};exports['calls']=function(_0x310830,_0x1c8791){logger[_0x1053('0x29')]('calls\x20fired:',_0x1c8791[_0x1053('0x2b')]);var _0x3cc7cb=callsValidation['validate'](_0x310830[_0x1053('0x2b')]);if(_0x3cc7cb[_0x1053('0x2c')]>0x0){return _0x1c8791[_0x1053('0x1a')](0x190)[_0x1053('0x2d')](_0x3cc7cb);}var _0x4983ae=_0x310830[_0x1053('0x2b')][_0x1053('0x2e')];var _0x242b4c=respondWithRpcPromise('VoiceChannels');var _0x5cadaf=getAgent(_0x4983ae);return Promise[_0x1053('0x22')]([_0x242b4c,_0x5cadaf])['then'](function(_0x2a9aa6){var _0x3b7c35=_0x2a9aa6[0x0];var _0x18cbc1=_0x2a9aa6[0x1];var _0x17c99d=_[_0x1053('0x23')](_0x3b7c35[_0x1053('0x24')],function(_0x1e1cf2){return _0x1e1cf2[_0x1053('0x25')]==_0x18cbc1['id'];});return _0x1c8791['status'](0xc8)[_0x1053('0x2d')]({'count':_0x17c99d[_0x1053('0x2c')],'rows':_0x17c99d});})[_0x1053('0x34')](handleError(_0x1c8791));};exports['conference']=function(_0x284d7a,_0xe4cbc3){logger['info'](_0x1053('0x41'),_0x284d7a['body']);var _0x512aab=conferenceValidation[_0x1053('0xc')](_0x284d7a[_0x1053('0x2b')]);if(_0x512aab['length']>0x0){return _0xe4cbc3[_0x1053('0x1a')](0x190)[_0x1053('0x2d')](_0x512aab);}var _0x281fc7=_0x284d7a['body']['userId'];return getAgent(_0x281fc7)['then'](function(_0x271d33){logger[_0x1053('0x29')](_0x1053('0x31'),_0x271d33[_0x1053('0x18')]);emit(util[_0x1053('0x37')](_0x1053('0x32'),_0x271d33[_0x1053('0x18')]),_0x1053('0x42'));return _0xe4cbc3[_0x1053('0x1a')](0xc8)[_0x1053('0x2d')]({'error':![],'message':'conference\x20executed!'});})[_0x1053('0x34')](handleError(_0xe4cbc3));};exports['transfer']=function(_0x2c27bd,_0xb3c8cb){logger['info'](_0x1053('0x43'),_0x2c27bd['body']);var _0x459ea7=transferValidation[_0x1053('0xc')](_0x2c27bd[_0x1053('0x2b')]);if(_0x459ea7['length']>0x0){return _0xb3c8cb[_0x1053('0x1a')](0x190)['json'](_0x459ea7);}var _0x21d038=_0x2c27bd[_0x1053('0x2b')][_0x1053('0x2e')];var _0x124e3f=_0x2c27bd[_0x1053('0x2b')][_0x1053('0x26')];var _0x2d7b31=_0x2c27bd[_0x1053('0x2b')][_0x1053('0x44')];return getAgent(_0x21d038)[_0x1053('0x1b')](function(_0x2767df){logger[_0x1053('0x29')](_0x1053('0x31'),_0x2767df[_0x1053('0x18')]);emit(util[_0x1053('0x37')](_0x1053('0x32'),_0x2767df['name']),_0x1053('0x45'),{'sessionId':_0x124e3f,'transferNumber':_0x2d7b31});return _0xb3c8cb[_0x1053('0x1a')](0xc8)['json']({'error':![],'message':_0x1053('0x46')});})[_0x1053('0x34')](handleError(_0xb3c8cb));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index 672ea17..07c0ead 100644 --- a/server/api/whatsappAccount/index.js +++ b/server/api/whatsappAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfc72=['destroy','removeAnswers','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','isAuthenticated','index','/describe','describe','get','show','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/users','getAgents','getApplications','create','addAnswer','addAgents','post','/:id/applications','/:id/notify','/:id/send','send','put','/:id','update','delete'];(function(_0x8d9399,_0x490955){var _0x5a0645=function(_0x404d19){while(--_0x404d19){_0x8d9399['push'](_0x8d9399['shift']());}};_0x5a0645(++_0x490955);}(_0xfc72,0xff));var _0x2fc7=function(_0x16fe01,_0x5039e1){_0x16fe01=_0x16fe01-0x0;var _0x56c48a=_0xfc72[_0x16fe01];return _0x56c48a;};'use strict';var multer=require('multer');var util=require(_0x2fc7('0x0'));var path=require(_0x2fc7('0x1'));var timeout=require(_0x2fc7('0x2'));var express=require(_0x2fc7('0x3'));var router=express[_0x2fc7('0x4')]();var auth=require(_0x2fc7('0x5'));var interaction=require(_0x2fc7('0x6'));var config=require(_0x2fc7('0x7'));var controller=require(_0x2fc7('0x8'));router['get']('/',auth[_0x2fc7('0x9')](),controller[_0x2fc7('0xa')]);router['get'](_0x2fc7('0xb'),auth[_0x2fc7('0x9')](),controller[_0x2fc7('0xc')]);router[_0x2fc7('0xd')]('/:id',auth[_0x2fc7('0x9')](),controller[_0x2fc7('0xe')]);router[_0x2fc7('0xd')](_0x2fc7('0xf'),auth[_0x2fc7('0x9')](),controller[_0x2fc7('0x10')]);router[_0x2fc7('0xd')](_0x2fc7('0x11'),auth[_0x2fc7('0x9')](),controller['getAnswers']);router[_0x2fc7('0xd')](_0x2fc7('0x12'),auth[_0x2fc7('0x9')](),controller[_0x2fc7('0x13')]);router[_0x2fc7('0xd')]('/:id/applications',auth[_0x2fc7('0x9')](),controller[_0x2fc7('0x14')]);router['post']('/',auth['isAuthenticated'](),controller[_0x2fc7('0x15')]);router['post']('/:id/dispositions',auth[_0x2fc7('0x9')](),controller['addDisposition']);router['post']('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x2fc7('0x16')]);router['post'](_0x2fc7('0x12'),auth[_0x2fc7('0x9')](),controller[_0x2fc7('0x17')]);router[_0x2fc7('0x18')](_0x2fc7('0x19'),auth['isAuthenticated'](),controller['addApplications']);router['post'](_0x2fc7('0x1a'),controller['notify']);router[_0x2fc7('0x18')](_0x2fc7('0x1b'),auth['isAuthenticated'](),controller[_0x2fc7('0x1c')]);router[_0x2fc7('0x1d')](_0x2fc7('0x1e'),auth[_0x2fc7('0x9')](),controller[_0x2fc7('0x1f')]);router[_0x2fc7('0x20')](_0x2fc7('0x1e'),auth[_0x2fc7('0x9')](),controller[_0x2fc7('0x21')]);router[_0x2fc7('0x20')](_0x2fc7('0xf'),auth[_0x2fc7('0x9')](),controller['removeDispositions']);router[_0x2fc7('0x20')](_0x2fc7('0x11'),auth[_0x2fc7('0x9')](),controller[_0x2fc7('0x22')]);router['delete'](_0x2fc7('0x12'),auth[_0x2fc7('0x9')](),controller['removeAgents']);module[_0x2fc7('0x23')]=router; \ No newline at end of file +var _0xda96=['index','/describe','isAuthenticated','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/users','/:id/applications','getApplications','post','create','addDisposition','addAnswer','addApplications','/:id/notify','notify','/:id/send','send','put','update','delete','destroy','removeAnswers','removeAgents','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./whatsappAccount.controller','get'];(function(_0x4e21b9,_0x11ece2){var _0x2987b6=function(_0x3f2e62){while(--_0x3f2e62){_0x4e21b9['push'](_0x4e21b9['shift']());}};_0x2987b6(++_0x11ece2);}(_0xda96,0xb0));var _0x6da9=function(_0x5e29df,_0x4da5a4){_0x5e29df=_0x5e29df-0x0;var _0x196b4f=_0xda96[_0x5e29df];return _0x196b4f;};'use strict';var multer=require(_0x6da9('0x0'));var util=require(_0x6da9('0x1'));var path=require('path');var timeout=require(_0x6da9('0x2'));var express=require(_0x6da9('0x3'));var router=express[_0x6da9('0x4')]();var auth=require(_0x6da9('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x6da9('0x6'));var controller=require(_0x6da9('0x7'));router[_0x6da9('0x8')]('/',auth['isAuthenticated'](),controller[_0x6da9('0x9')]);router[_0x6da9('0x8')](_0x6da9('0xa'),auth[_0x6da9('0xb')](),controller[_0x6da9('0xc')]);router[_0x6da9('0x8')](_0x6da9('0xd'),auth[_0x6da9('0xb')](),controller[_0x6da9('0xe')]);router[_0x6da9('0x8')](_0x6da9('0xf'),auth[_0x6da9('0xb')](),controller[_0x6da9('0x10')]);router[_0x6da9('0x8')](_0x6da9('0x11'),auth[_0x6da9('0xb')](),controller['getAnswers']);router['get'](_0x6da9('0x12'),auth[_0x6da9('0xb')](),controller['getAgents']);router[_0x6da9('0x8')](_0x6da9('0x13'),auth[_0x6da9('0xb')](),controller[_0x6da9('0x14')]);router[_0x6da9('0x15')]('/',auth[_0x6da9('0xb')](),controller[_0x6da9('0x16')]);router[_0x6da9('0x15')](_0x6da9('0xf'),auth[_0x6da9('0xb')](),controller[_0x6da9('0x17')]);router[_0x6da9('0x15')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x6da9('0x18')]);router[_0x6da9('0x15')]('/:id/users',auth[_0x6da9('0xb')](),controller['addAgents']);router['post'](_0x6da9('0x13'),auth['isAuthenticated'](),controller[_0x6da9('0x19')]);router[_0x6da9('0x15')](_0x6da9('0x1a'),controller[_0x6da9('0x1b')]);router[_0x6da9('0x15')](_0x6da9('0x1c'),auth[_0x6da9('0xb')](),controller[_0x6da9('0x1d')]);router[_0x6da9('0x1e')](_0x6da9('0xd'),auth[_0x6da9('0xb')](),controller[_0x6da9('0x1f')]);router[_0x6da9('0x20')]('/:id',auth[_0x6da9('0xb')](),controller[_0x6da9('0x21')]);router[_0x6da9('0x20')]('/:id/dispositions',auth[_0x6da9('0xb')](),controller['removeDispositions']);router[_0x6da9('0x20')](_0x6da9('0x11'),auth[_0x6da9('0xb')](),controller[_0x6da9('0x22')]);router[_0x6da9('0x20')](_0x6da9('0x12'),auth[_0x6da9('0xb')](),controller[_0x6da9('0x23')]);module[_0x6da9('0x24')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index eff2087..86ab167 100644 --- a/server/api/whatsappAccount/whatsappAccount.attributes.js +++ b/server/api/whatsappAccount/whatsappAccount.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x988e=['TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','name'];(function(_0x2bda27,_0x35e70d){var _0xd16c7a=function(_0x2be861){while(--_0x2be861){_0x2bda27['push'](_0x2bda27['shift']());}};_0xd16c7a(++_0x35e70d);}(_0x988e,0x19b));var _0xe988=function(_0xa50bc0,_0xe82b89){_0xa50bc0=_0xa50bc0-0x0;var _0x1adb25=_0x988e[_0xa50bc0];return _0x1adb25;};'use strict';var Sequelize=require(_0xe988('0x0'));var rs=require(_0xe988('0x1'));module[_0xe988('0x2')]={'name':{'type':Sequelize[_0xe988('0x3')],'unique':_0xe988('0x4'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0xe988('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0xe988('0x3')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0xe988('0x3')]},'type':{'type':Sequelize['ENUM']('twilio')},'accountSid':{'type':Sequelize[_0xe988('0x3')]},'authToken':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0xe988('0x5')],'defaultValue':function(){return _0xe988('0x6');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0xe988('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xe988('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xe988('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xe988('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xe988('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xe988('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0xe988('0x9')},'mandatoryDisposition':{'type':Sequelize[_0xe988('0x7')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x72a270){if(!_0x72a270){this[_0xe988('0xa')](_0xe988('0xb'),null);}this['setDataValue'](_0xe988('0xc'),_0x72a270);}},'description':{'type':Sequelize[_0xe988('0x3')]}}; \ No newline at end of file +var _0x75d8=['Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','sequelize','randomstring','exports','name','STRING','generate','ENUM','twilio','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'];(function(_0x2d4d0f,_0xfec43c){var _0x34adaa=function(_0x1e9e96){while(--_0x1e9e96){_0x2d4d0f['push'](_0x2d4d0f['shift']());}};_0x34adaa(++_0xfec43c);}(_0x75d8,0x136));var _0x875d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x75d8[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x875d('0x0'));var rs=require(_0x875d('0x1'));module[_0x875d('0x2')]={'name':{'type':Sequelize['STRING'],'unique':_0x875d('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x875d('0x4')],'allowNull':![]},'remote':{'type':Sequelize[_0x875d('0x4')],'allowNull':![]},'token':{'type':Sequelize[_0x875d('0x4')],'defaultValue':function(){return rs[_0x875d('0x5')]();}},'phone':{'type':Sequelize[_0x875d('0x4')]},'type':{'type':Sequelize[_0x875d('0x6')](_0x875d('0x7'))},'accountSid':{'type':Sequelize[_0x875d('0x4')]},'authToken':{'type':Sequelize[_0x875d('0x4')]},'notificationTemplate':{'type':Sequelize[_0x875d('0x8')],'defaultValue':function(){return _0x875d('0x9');}},'notificationSound':{'type':Sequelize[_0x875d('0xa')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x875d('0xa')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x875d('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x875d('0xa')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x875d('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x875d('0xa')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x875d('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x875d('0xc')},'mandatoryDisposition':{'type':Sequelize[_0x875d('0xa')],'defaultValue':![],'comment':_0x875d('0xd'),'set':function(_0x54c88a){if(!_0x54c88a){this['setDataValue'](_0x875d('0xe'),null);}this[_0x875d('0xf')](_0x875d('0x10'),_0x54c88a);}},'description':{'type':Sequelize[_0x875d('0x4')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index c3d6cca..a341d2c 100644 --- a/server/api/whatsappAccount/whatsappAccount.controller.js +++ b/server/api/whatsappAccount/whatsappAccount.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb9a7=['includeAll','include','rows','params','keys','length','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','WhatsappAccounts','UserProfileSection','userProfileId','describe','WhatsappAccountId','Disposition','getDispositions','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','removeAnswers','addAgents','omit','spread','emit','userWhatsappAccount:save','removeAgents','userWhatsappAccount:remove','User','getAgents','transaction','bulkCreate','WhatsappApplication','priority','getApplications','notify','whatsapp','Applications','account','applications','orderBy','asc','CmContact','ValidationError','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','from','From','replace','whatsapp:','Body','messageId','MessageSid','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','list','defaults','WhatsappInteraction','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','WhatsappMessage','ContactId','UserId','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','stringify','Content-Type','DESC','List','user','out','dataValues','Messages','eml-format','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../mysqldb','redis','localhost','./whatsappAccount.socket','jayson/promise','client','http','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','sendStatus','status','count','offset','set','Content-Range','json','apply','save','update','destroy','get','end','stack','name','send','index','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','type','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','filters','pick','where','VIRTUAL','filter','merge','options','WhatsappAccount'];(function(_0x2b3e04,_0x5c1d3b){var _0x231a4c=function(_0x4d3a5f){while(--_0x4d3a5f){_0x2b3e04['push'](_0x2b3e04['shift']());}};_0x231a4c(++_0x5c1d3b);}(_0xb9a7,0x112));var _0x7b9a=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xb9a7[_0x3ab51d];return _0x29a04e;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x7b9a('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x7b9a('0x1'));var moment=require('moment');var BPromise=require(_0x7b9a('0x2'));var Mustache=require(_0x7b9a('0x3'));var util=require(_0x7b9a('0x4'));var path=require(_0x7b9a('0x5'));var sox=require(_0x7b9a('0x6'));var csv=require(_0x7b9a('0x7'));var ejs=require(_0x7b9a('0x8'));var fs=require('fs');var _=require(_0x7b9a('0x9'));var squel=require(_0x7b9a('0xa'));var crypto=require(_0x7b9a('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x7b9a('0xc'));var toCsv=require(_0x7b9a('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x7b9a('0xd'));var qs=require(_0x7b9a('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7b9a('0xf'));var logger=require('../../config/logger')(_0x7b9a('0x10'));var utils=require('../../config/utils');var config=require(_0x7b9a('0x11'));var db=require(_0x7b9a('0x12'))['db'];config[_0x7b9a('0x13')]=_['defaults'](config[_0x7b9a('0x13')],{'host':_0x7b9a('0x14'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7b9a('0x13')]));require(_0x7b9a('0x15'))['register'](socket);var jayson=require(_0x7b9a('0x16'));var client=jayson[_0x7b9a('0x17')][_0x7b9a('0x18')]({'port':0x232c});function checkPasswordPattern(_0x2853f2,_0x344fa7,_0x346daa){if(_0x346daa){var _0x22a7e4=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x22a7e4[_0x7b9a('0x19')](_0x344fa7)){return _0x2853f2;}else{throw new db[(_0x7b9a('0x1a'))]['ValidationError'](_0x7b9a('0x1b'));}}else{return _0x2853f2;}}function respondWithRpcPromise(_0x4e8524,_0x123921,_0xa217cb,_0x271263){return new BPromise(function(_0x169d16,_0x44a232){var _0x180a67=_0x271263||client;return _0x180a67[_0x7b9a('0x1c')](_0x4e8524,_0xa217cb)[_0x7b9a('0x1d')](function(_0x2064a0){logger[_0x7b9a('0x1e')](_0x7b9a('0x1f'),_0x123921,_0x7b9a('0x20'));logger[_0x7b9a('0x21')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x123921,_0x7b9a('0x20'),JSON['stringify'](_0x2064a0));if(_0x2064a0[_0x7b9a('0x22')]){if(_0x2064a0['error'][_0x7b9a('0x23')]===0x1f4){logger[_0x7b9a('0x22')](_0x7b9a('0x1f'),_0x123921,_0x2064a0['error'][_0x7b9a('0x24')]);return _0x44a232(_0x2064a0[_0x7b9a('0x22')]['message']);}logger[_0x7b9a('0x22')](_0x7b9a('0x1f'),_0x123921,_0x2064a0[_0x7b9a('0x22')][_0x7b9a('0x24')]);return _0x169d16(_0x2064a0[_0x7b9a('0x22')]['message']);}else{logger[_0x7b9a('0x1e')](_0x7b9a('0x1f'),_0x123921,'request\x20sent');_0x169d16(_0x2064a0[_0x7b9a('0x25')]['message']);}})[_0x7b9a('0x26')](function(_0x3091ab){logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x123921,_0x3091ab);_0x44a232(_0x3091ab);});});}function respondWithStatusCode(_0x24d886,_0x55301c){_0x55301c=_0x55301c||0xcc;return function(_0x54df8a){if(_0x54df8a){return _0x24d886[_0x7b9a('0x27')](_0x55301c);}return _0x24d886['status'](_0x55301c)['end']();};}function respondWithResult(_0x3847b4,_0x4d5880){_0x4d5880=_0x4d5880||0xc8;return function(_0x5c89b6){if(_0x5c89b6){return _0x3847b4[_0x7b9a('0x28')](_0x4d5880)['json'](_0x5c89b6);}};}function respondWithFilteredResult(_0x1553ae,_0x2e6144){return function(_0xd35ce7){if(_0xd35ce7){var _0x5b64d7=_0xd35ce7[_0x7b9a('0x29')],_0x45ccf5=_0x2e6144[_0x7b9a('0x2a')],_0x2ce78b=_0x2e6144[_0x7b9a('0x2a')]+_0x2e6144['limit'],_0x181e9c;if(_0x2ce78b>=_0x5b64d7){_0x2ce78b=_0x5b64d7;_0x181e9c=0xc8;}else{_0x181e9c=0xce;}_0x1553ae['status'](_0x181e9c);return _0x1553ae[_0x7b9a('0x2b')](_0x7b9a('0x2c'),_0x45ccf5+'-'+_0x2ce78b+'/'+_0x5b64d7)[_0x7b9a('0x2d')](_0xd35ce7);}return null;};}function patchUpdates(_0x4c639d){return function(_0x2b199b){try{jsonpatch[_0x7b9a('0x2e')](_0x2b199b,_0x4c639d,!![]);}catch(_0x4d5223){return BPromise['reject'](_0x4d5223);}return _0x2b199b[_0x7b9a('0x2f')]();};}function saveUpdates(_0x306a02,_0x5cc24e){return function(_0x255ee2){if(_0x255ee2){return _0x255ee2[_0x7b9a('0x30')](_0x306a02)[_0x7b9a('0x1d')](function(_0x18db2f){return _0x18db2f;});}return null;};}function removeEntity(_0x277236,_0x4e8da6){return function(_0x46bcd0){if(_0x46bcd0){return _0x46bcd0[_0x7b9a('0x31')]()[_0x7b9a('0x1d')](function(){var _0x7070dd=_0x46bcd0[_0x7b9a('0x32')]({'plain':!![]});var _0x225d1f='WhatsappAccounts';return db['UserProfileResource'][_0x7b9a('0x31')]({'where':{'type':_0x225d1f,'resourceId':_0x7070dd['id']}})[_0x7b9a('0x1d')](function(){return _0x46bcd0;});})['then'](function(){_0x277236[_0x7b9a('0x28')](0xcc)[_0x7b9a('0x33')]();});}};}function handleEntityNotFound(_0xf58dca,_0x5841e4){return function(_0x2c3949){if(!_0x2c3949){_0xf58dca[_0x7b9a('0x27')](0x194);}return _0x2c3949;};}function handleError(_0x58cf08,_0x47cc15){_0x47cc15=_0x47cc15||0x1f4;return function(_0x326f06){logger[_0x7b9a('0x22')](_0x326f06[_0x7b9a('0x34')]);if(_0x326f06[_0x7b9a('0x35')]){delete _0x326f06[_0x7b9a('0x35')];}_0x58cf08[_0x7b9a('0x28')](_0x47cc15)[_0x7b9a('0x36')](_0x326f06);};}exports[_0x7b9a('0x37')]=function(_0x4af212,_0x366b62){var _0x5ac175={'include':[{'model':db[_0x7b9a('0x38')],'as':_0x7b9a('0x39')}]},_0x213370={},_0x157ca8={'count':0x0,'rows':[]};var _0x3fa4cd=_[_0x7b9a('0x3a')](db['WhatsappAccount'][_0x7b9a('0x3b')],function(_0x2a6ed6){return{'name':_0x2a6ed6[_0x7b9a('0x3c')],'type':_0x2a6ed6[_0x7b9a('0x3d')]['key']};});_0x213370[_0x7b9a('0x3e')]=_[_0x7b9a('0x3a')](_0x3fa4cd,_0x7b9a('0x35'));_0x213370[_0x7b9a('0x3f')]=_['keys'](_0x4af212[_0x7b9a('0x3f')]);_0x213370['filters']=_[_0x7b9a('0x40')](_0x213370[_0x7b9a('0x3e')],_0x213370[_0x7b9a('0x3f')]);_0x5ac175[_0x7b9a('0x41')]=_[_0x7b9a('0x40')](_0x213370[_0x7b9a('0x3e')],qs['fields'](_0x4af212[_0x7b9a('0x3f')][_0x7b9a('0x42')]));_0x5ac175[_0x7b9a('0x41')]=_0x5ac175['attributes']['length']?_0x5ac175[_0x7b9a('0x41')]:_0x213370[_0x7b9a('0x3e')];if(!_0x4af212[_0x7b9a('0x3f')][_0x7b9a('0x43')](_0x7b9a('0x44'))){_0x5ac175[_0x7b9a('0x45')]=qs['limit'](_0x4af212['query']['limit']);_0x5ac175[_0x7b9a('0x2a')]=qs[_0x7b9a('0x2a')](_0x4af212['query'][_0x7b9a('0x2a')]);}_0x5ac175[_0x7b9a('0x46')]=qs[_0x7b9a('0x47')](_0x4af212['query'][_0x7b9a('0x47')]);_0x5ac175['where']=qs[_0x7b9a('0x48')](_[_0x7b9a('0x49')](_0x4af212[_0x7b9a('0x3f')],_0x213370[_0x7b9a('0x48')]),_0x3fa4cd);if(_0x4af212[_0x7b9a('0x3f')]['filter']){_0x5ac175[_0x7b9a('0x4a')]=_['merge'](_0x5ac175[_0x7b9a('0x4a')],{'$or':_['map'](_0x3fa4cd,function(_0x4f1b2e){if(_0x4f1b2e[_0x7b9a('0x3d')]!==_0x7b9a('0x4b')){var _0x717d08={};_0x717d08[_0x4f1b2e[_0x7b9a('0x35')]]={'$like':'%'+_0x4af212[_0x7b9a('0x3f')][_0x7b9a('0x4c')]+'%'};return _0x717d08;}})});}_0x5ac175=_[_0x7b9a('0x4d')]({},_0x5ac175,_0x4af212[_0x7b9a('0x4e')]);var _0x1d034b={'where':_0x5ac175['where']};return db[_0x7b9a('0x4f')][_0x7b9a('0x29')](_0x1d034b)['then'](function(_0x576421){_0x157ca8['count']=_0x576421;if(_0x4af212[_0x7b9a('0x3f')][_0x7b9a('0x50')]){_0x5ac175[_0x7b9a('0x51')]=[{'all':!![]}];}return db[_0x7b9a('0x4f')]['findAll'](_0x5ac175);})[_0x7b9a('0x1d')](function(_0x2fe247){_0x157ca8[_0x7b9a('0x52')]=_0x2fe247;return _0x157ca8;})[_0x7b9a('0x1d')](respondWithFilteredResult(_0x366b62,_0x5ac175))[_0x7b9a('0x26')](handleError(_0x366b62,null));};exports['show']=function(_0x22aea9,_0x54eb5f){var _0x99b054={'raw':![],'where':{'id':_0x22aea9[_0x7b9a('0x53')]['id']},'include':[{'model':db[_0x7b9a('0x38')],'as':'mandatoryDispositionPause'}]},_0x23c173={};_0x23c173[_0x7b9a('0x3e')]=_[_0x7b9a('0x54')](db[_0x7b9a('0x4f')][_0x7b9a('0x3b')]);_0x23c173[_0x7b9a('0x3f')]=_[_0x7b9a('0x54')](_0x22aea9[_0x7b9a('0x3f')]);_0x23c173['filters']=_['intersection'](_0x23c173['model'],_0x23c173[_0x7b9a('0x3f')]);_0x99b054[_0x7b9a('0x41')]=_['intersection'](_0x23c173['model'],qs['fields'](_0x22aea9['query'][_0x7b9a('0x42')]));_0x99b054[_0x7b9a('0x41')]=_0x99b054[_0x7b9a('0x41')][_0x7b9a('0x55')]?_0x99b054[_0x7b9a('0x41')]:_0x23c173[_0x7b9a('0x3e')];if(_0x22aea9[_0x7b9a('0x3f')][_0x7b9a('0x50')]){_0x99b054['include']=[{'all':!![]}];}_0x99b054=_[_0x7b9a('0x4d')]({},_0x99b054,_0x22aea9['options']);return db[_0x7b9a('0x4f')][_0x7b9a('0x56')](_0x99b054)[_0x7b9a('0x1d')](handleEntityNotFound(_0x54eb5f,null))[_0x7b9a('0x1d')](respondWithResult(_0x54eb5f,null))[_0x7b9a('0x26')](handleError(_0x54eb5f,null));};exports['create']=function(_0x25ec82,_0x491804){return db[_0x7b9a('0x4f')][_0x7b9a('0x57')](_0x25ec82[_0x7b9a('0x58')],{})['then'](function(_0x50c289){var _0x5f5302=_0x25ec82['user'][_0x7b9a('0x32')]({'plain':!![]});if(!_0x5f5302)throw new Error(_0x7b9a('0x59'));if(_0x5f5302[_0x7b9a('0x5a')]==='user'){var _0x2f9b44=_0x50c289[_0x7b9a('0x32')]({'plain':!![]});var _0x466a9d=_0x7b9a('0x5b');return db[_0x7b9a('0x5c')]['find']({'where':{'name':_0x466a9d,'userProfileId':_0x5f5302[_0x7b9a('0x5d')]},'raw':!![]})[_0x7b9a('0x1d')](function(_0x19770f){if(_0x19770f&&_0x19770f['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x2f9b44[_0x7b9a('0x35')],'resourceId':_0x2f9b44['id'],'type':_0x19770f[_0x7b9a('0x35')],'sectionId':_0x19770f['id']},{})[_0x7b9a('0x1d')](function(){return _0x50c289;});}else{return _0x50c289;}})['catch'](function(_0x39c048){logger[_0x7b9a('0x22')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x39c048);throw _0x39c048;});}return _0x50c289;})[_0x7b9a('0x1d')](respondWithResult(_0x491804,0xc9))['catch'](handleError(_0x491804,null));};exports[_0x7b9a('0x30')]=function(_0x565b10,_0x11660c){if(_0x565b10[_0x7b9a('0x58')]['id']){delete _0x565b10[_0x7b9a('0x58')]['id'];}return db[_0x7b9a('0x4f')]['find']({'where':{'id':_0x565b10[_0x7b9a('0x53')]['id']},'include':[{'model':db[_0x7b9a('0x38')],'as':_0x7b9a('0x39')}]})[_0x7b9a('0x1d')](handleEntityNotFound(_0x11660c,null))['then'](saveUpdates(_0x565b10[_0x7b9a('0x58')],null))['then'](respondWithResult(_0x11660c,null))[_0x7b9a('0x26')](handleError(_0x11660c,null));};exports['destroy']=function(_0x1df025,_0x5f223a){return db['WhatsappAccount']['find']({'where':{'id':_0x1df025['params']['id']}})[_0x7b9a('0x1d')](handleEntityNotFound(_0x5f223a,null))[_0x7b9a('0x1d')](removeEntity(_0x5f223a,null))[_0x7b9a('0x26')](handleError(_0x5f223a,null));};exports[_0x7b9a('0x5e')]=function(_0x4ac9f9,_0x6dfa77){return db['WhatsappAccount']['describe']()[_0x7b9a('0x1d')](respondWithResult(_0x6dfa77,null))['catch'](handleError(_0x6dfa77,null));};exports['addDisposition']=function(_0x7ad607,_0x262fd2,_0x5524c0){if(_0x7ad607[_0x7b9a('0x58')]['id']){delete _0x7ad607['body']['id'];}return db[_0x7b9a('0x4f')][_0x7b9a('0x56')]({'where':{'id':_0x7ad607[_0x7b9a('0x53')]['id']}})['then'](handleEntityNotFound(_0x262fd2,null))['then'](function(_0x5049f8){if(_0x5049f8){_0x7ad607['body'][_0x7b9a('0x5f')]=_0x5049f8['id'];return db[_0x7b9a('0x60')][_0x7b9a('0x57')](_0x7ad607[_0x7b9a('0x58')]);}})[_0x7b9a('0x1d')](respondWithResult(_0x262fd2,null))[_0x7b9a('0x26')](handleError(_0x262fd2,null));};exports[_0x7b9a('0x61')]=function(_0x4b736e,_0xdd42ba,_0x37951e){var _0x4f312a={'raw':![],'where':{}};var _0x959992={};var _0x3f01dc={'count':0x0,'rows':[]};return db[_0x7b9a('0x4f')]['findOne']({'where':{'id':_0x4b736e['params']['id']}})[_0x7b9a('0x1d')](handleEntityNotFound(_0xdd42ba,null))[_0x7b9a('0x1d')](function(_0x5299e3){if(_0x5299e3){_0x959992[_0x7b9a('0x3e')]=_['keys'](db[_0x7b9a('0x60')][_0x7b9a('0x3b')]);_0x959992[_0x7b9a('0x3f')]=_['keys'](_0x4b736e[_0x7b9a('0x3f')]);_0x959992[_0x7b9a('0x48')]=_[_0x7b9a('0x40')](_0x959992[_0x7b9a('0x3e')],_0x959992[_0x7b9a('0x3f')]);_0x4f312a['attributes']=_['intersection'](_0x959992[_0x7b9a('0x3e')],qs[_0x7b9a('0x42')](_0x4b736e['query'][_0x7b9a('0x42')]));_0x4f312a[_0x7b9a('0x41')]=_0x4f312a[_0x7b9a('0x41')]['length']?_0x4f312a['attributes']:_0x959992[_0x7b9a('0x3e')];if(!_0x4b736e[_0x7b9a('0x3f')][_0x7b9a('0x43')](_0x7b9a('0x44'))){_0x4f312a['limit']=qs[_0x7b9a('0x45')](_0x4b736e[_0x7b9a('0x3f')][_0x7b9a('0x45')]);_0x4f312a['offset']=qs['offset'](_0x4b736e[_0x7b9a('0x3f')][_0x7b9a('0x2a')]);}_0x4f312a[_0x7b9a('0x46')]=qs[_0x7b9a('0x47')](_0x4b736e['query'][_0x7b9a('0x47')]);_0x4f312a[_0x7b9a('0x4a')]=qs['filters'](_[_0x7b9a('0x49')](_0x4b736e[_0x7b9a('0x3f')],_0x959992[_0x7b9a('0x48')]));_0x4f312a[_0x7b9a('0x4a')][_0x7b9a('0x5f')]=_0x5299e3['id'];if(_0x4b736e[_0x7b9a('0x3f')][_0x7b9a('0x4c')]){_0x4f312a[_0x7b9a('0x4a')]=_[_0x7b9a('0x4d')](_0x4f312a[_0x7b9a('0x4a')],{'$or':_[_0x7b9a('0x3a')](_0x4f312a['attributes'],function(_0x5df9f4){var _0x7dd008={};_0x7dd008[_0x5df9f4]={'$like':'%'+_0x4b736e[_0x7b9a('0x3f')]['filter']+'%'};return _0x7dd008;})});}_0x4f312a=_[_0x7b9a('0x4d')]({},_0x4f312a,_0x4b736e[_0x7b9a('0x4e')]);return db['Disposition'][_0x7b9a('0x29')]({'where':_0x4f312a[_0x7b9a('0x4a')]})[_0x7b9a('0x1d')](function(_0x20c427){_0x3f01dc[_0x7b9a('0x29')]=_0x20c427;if(_0x4b736e[_0x7b9a('0x3f')][_0x7b9a('0x50')]){_0x4f312a[_0x7b9a('0x51')]=[{'all':!![]}];}return db[_0x7b9a('0x60')]['findAll'](_0x4f312a);})[_0x7b9a('0x1d')](function(_0x141340){_0x3f01dc[_0x7b9a('0x52')]=_0x141340;return _0x3f01dc;});}})[_0x7b9a('0x1d')](respondWithFilteredResult(_0xdd42ba,_0x4f312a))[_0x7b9a('0x26')](handleError(_0xdd42ba,null));};exports[_0x7b9a('0x62')]=function(_0x398d96,_0x477f41,_0x5d522b){return db[_0x7b9a('0x4f')][_0x7b9a('0x56')]({'where':{'id':_0x398d96[_0x7b9a('0x53')]['id']}})['then'](handleEntityNotFound(_0x477f41,null))[_0x7b9a('0x1d')](function(_0x37ab0e){if(_0x37ab0e){return _0x37ab0e[_0x7b9a('0x62')](_0x398d96[_0x7b9a('0x3f')][_0x7b9a('0x63')]);}})[_0x7b9a('0x1d')](respondWithStatusCode(_0x477f41,null))[_0x7b9a('0x26')](handleError(_0x477f41,null));};exports[_0x7b9a('0x64')]=function(_0x4b7f79,_0x5260ca,_0x178ebc){if(_0x4b7f79[_0x7b9a('0x58')]['id']){delete _0x4b7f79[_0x7b9a('0x58')]['id'];}return db[_0x7b9a('0x4f')][_0x7b9a('0x56')]({'where':{'id':_0x4b7f79[_0x7b9a('0x53')]['id']}})[_0x7b9a('0x1d')](handleEntityNotFound(_0x5260ca,null))[_0x7b9a('0x1d')](function(_0x368d16){if(_0x368d16){_0x4b7f79[_0x7b9a('0x58')]['WhatsappAccountId']=_0x368d16['id'];return db[_0x7b9a('0x65')][_0x7b9a('0x57')](_0x4b7f79[_0x7b9a('0x58')]);}})['then'](respondWithResult(_0x5260ca,null))[_0x7b9a('0x26')](handleError(_0x5260ca,null));};exports[_0x7b9a('0x66')]=function(_0xf50854,_0x10b702,_0x4ab6eb){var _0x2671b4={'raw':![],'where':{}};var _0x4a7292={};var _0x54bf4b={'count':0x0,'rows':[]};return db[_0x7b9a('0x4f')][_0x7b9a('0x67')]({'where':{'id':_0xf50854[_0x7b9a('0x53')]['id']}})[_0x7b9a('0x1d')](handleEntityNotFound(_0x10b702,null))[_0x7b9a('0x1d')](function(_0x449dd6){if(_0x449dd6){_0x4a7292['model']=_['keys'](db[_0x7b9a('0x65')][_0x7b9a('0x3b')]);_0x4a7292[_0x7b9a('0x3f')]=_[_0x7b9a('0x54')](_0xf50854['query']);_0x4a7292[_0x7b9a('0x48')]=_[_0x7b9a('0x40')](_0x4a7292[_0x7b9a('0x3e')],_0x4a7292['query']);_0x2671b4[_0x7b9a('0x41')]=_[_0x7b9a('0x40')](_0x4a7292[_0x7b9a('0x3e')],qs[_0x7b9a('0x42')](_0xf50854[_0x7b9a('0x3f')]['fields']));_0x2671b4[_0x7b9a('0x41')]=_0x2671b4[_0x7b9a('0x41')][_0x7b9a('0x55')]?_0x2671b4[_0x7b9a('0x41')]:_0x4a7292[_0x7b9a('0x3e')];if(!_0xf50854[_0x7b9a('0x3f')][_0x7b9a('0x43')]('nolimit')){_0x2671b4[_0x7b9a('0x45')]=qs[_0x7b9a('0x45')](_0xf50854[_0x7b9a('0x3f')][_0x7b9a('0x45')]);_0x2671b4[_0x7b9a('0x2a')]=qs[_0x7b9a('0x2a')](_0xf50854[_0x7b9a('0x3f')][_0x7b9a('0x2a')]);}_0x2671b4['order']=qs[_0x7b9a('0x47')](_0xf50854['query'][_0x7b9a('0x47')]);_0x2671b4[_0x7b9a('0x4a')]=qs[_0x7b9a('0x48')](_[_0x7b9a('0x49')](_0xf50854[_0x7b9a('0x3f')],_0x4a7292[_0x7b9a('0x48')]));_0x2671b4[_0x7b9a('0x4a')][_0x7b9a('0x5f')]=_0x449dd6['id'];if(_0xf50854[_0x7b9a('0x3f')]['filter']){_0x2671b4[_0x7b9a('0x4a')]=_['merge'](_0x2671b4[_0x7b9a('0x4a')],{'$or':_['map'](_0x2671b4[_0x7b9a('0x41')],function(_0xb83db4){var _0x2cc937={};_0x2cc937[_0xb83db4]={'$like':'%'+_0xf50854['query']['filter']+'%'};return _0x2cc937;})});}_0x2671b4=_[_0x7b9a('0x4d')]({},_0x2671b4,_0xf50854[_0x7b9a('0x4e')]);return db['CannedAnswer'][_0x7b9a('0x29')]({'where':_0x2671b4[_0x7b9a('0x4a')]})[_0x7b9a('0x1d')](function(_0x203f39){_0x54bf4b[_0x7b9a('0x29')]=_0x203f39;if(_0xf50854[_0x7b9a('0x3f')][_0x7b9a('0x50')]){_0x2671b4[_0x7b9a('0x51')]=[{'all':!![]}];}return db[_0x7b9a('0x65')]['findAll'](_0x2671b4);})[_0x7b9a('0x1d')](function(_0x4b78db){_0x54bf4b[_0x7b9a('0x52')]=_0x4b78db;return _0x54bf4b;});}})[_0x7b9a('0x1d')](respondWithFilteredResult(_0x10b702,_0x2671b4))[_0x7b9a('0x26')](handleError(_0x10b702,null));};exports[_0x7b9a('0x68')]=function(_0x2a6e60,_0x5c63f7,_0x35ddc6){return db['WhatsappAccount'][_0x7b9a('0x56')]({'where':{'id':_0x2a6e60[_0x7b9a('0x53')]['id']}})[_0x7b9a('0x1d')](handleEntityNotFound(_0x5c63f7,null))['then'](function(_0xf527ec){if(_0xf527ec){return _0xf527ec[_0x7b9a('0x68')](_0x2a6e60[_0x7b9a('0x3f')][_0x7b9a('0x63')]);}})[_0x7b9a('0x1d')](respondWithStatusCode(_0x5c63f7,null))[_0x7b9a('0x26')](handleError(_0x5c63f7,null));};exports[_0x7b9a('0x69')]=function(_0x400e80,_0x3ecfa6,_0x317116){return db[_0x7b9a('0x4f')][_0x7b9a('0x56')]({'where':{'id':_0x400e80[_0x7b9a('0x53')]['id']}})[_0x7b9a('0x1d')](handleEntityNotFound(_0x3ecfa6,null))[_0x7b9a('0x1d')](function(_0x1ecad3){if(_0x1ecad3){return _0x1ecad3['addAgents'](_0x400e80[_0x7b9a('0x58')][_0x7b9a('0x63')],_[_0x7b9a('0x6a')](_0x400e80[_0x7b9a('0x58')],[_0x7b9a('0x63'),'id'])||{})[_0x7b9a('0x6b')](function(_0x19ae53){for(var _0x2c3a1d=0x0;_0x2c3a1d<_0x400e80[_0x7b9a('0x58')]['ids'][_0x7b9a('0x55')];_0x2c3a1d+=0x1){socket[_0x7b9a('0x6c')](_0x7b9a('0x6d'),{'UserId':_0x400e80['body']['ids'][_0x2c3a1d],'WhatsappAccountId':_0x400e80[_0x7b9a('0x53')]['id']});}return _0x19ae53;});}})[_0x7b9a('0x1d')](respondWithResult(_0x3ecfa6,null))[_0x7b9a('0x26')](handleError(_0x3ecfa6,null));};exports[_0x7b9a('0x6e')]=function(_0x168485,_0xf8274f,_0x3f48c5){return db[_0x7b9a('0x4f')]['find']({'where':{'id':_0x168485[_0x7b9a('0x53')]['id']}})[_0x7b9a('0x1d')](handleEntityNotFound(_0xf8274f,null))[_0x7b9a('0x1d')](function(_0x343c13){if(_0x343c13){return _0x343c13[_0x7b9a('0x6e')](_0x168485[_0x7b9a('0x3f')][_0x7b9a('0x63')])[_0x7b9a('0x1d')](function(){if(_['isArray'](_0x168485[_0x7b9a('0x3f')][_0x7b9a('0x63')])){for(var _0x40d63f=0x0;_0x40d63f<_0x168485[_0x7b9a('0x3f')][_0x7b9a('0x63')][_0x7b9a('0x55')];_0x40d63f+=0x1){socket[_0x7b9a('0x6c')]('userWhatsappAccount:remove',{'UserId':Number(_0x168485[_0x7b9a('0x3f')]['ids'][_0x40d63f]),'WhatsappAccountId':Number(_0x168485[_0x7b9a('0x53')]['id'])});}}else{socket[_0x7b9a('0x6c')](_0x7b9a('0x6f'),{'UserId':Number(_0x168485[_0x7b9a('0x3f')]['ids']),'WhatsappAccountId':Number(_0x168485[_0x7b9a('0x53')]['id'])});}});}})['then'](respondWithStatusCode(_0xf8274f,null))['catch'](handleError(_0xf8274f,null));};exports['getAgents']=function(_0x4ea20d,_0x3a0e4a,_0x27c411){var _0xf4e5a8={};var _0x56ed34={};var _0x19ac27;var _0x57bcc7;return db[_0x7b9a('0x4f')][_0x7b9a('0x67')]({'where':{'id':_0x4ea20d[_0x7b9a('0x53')]['id']}})[_0x7b9a('0x1d')](handleEntityNotFound(_0x3a0e4a,null))['then'](function(_0x4b3e54){if(_0x4b3e54){_0x19ac27=_0x4b3e54;_0x56ed34['model']=_[_0x7b9a('0x54')](db[_0x7b9a('0x70')][_0x7b9a('0x3b')]);_0x56ed34[_0x7b9a('0x3f')]=_[_0x7b9a('0x54')](_0x4ea20d[_0x7b9a('0x3f')]);_0x56ed34[_0x7b9a('0x48')]=_['intersection'](_0x56ed34[_0x7b9a('0x3e')],_0x56ed34[_0x7b9a('0x3f')]);_0xf4e5a8['attributes']=_[_0x7b9a('0x40')](_0x56ed34[_0x7b9a('0x3e')],qs[_0x7b9a('0x42')](_0x4ea20d[_0x7b9a('0x3f')]['fields']));_0xf4e5a8[_0x7b9a('0x41')]=_0xf4e5a8[_0x7b9a('0x41')][_0x7b9a('0x55')]?_0xf4e5a8[_0x7b9a('0x41')]:_0x56ed34[_0x7b9a('0x3e')];_0xf4e5a8[_0x7b9a('0x46')]=qs['sort'](_0x4ea20d['query'][_0x7b9a('0x47')]);_0xf4e5a8[_0x7b9a('0x4a')]=qs[_0x7b9a('0x48')](_[_0x7b9a('0x49')](_0x4ea20d[_0x7b9a('0x3f')],_0x56ed34[_0x7b9a('0x48')]));if(_0x4ea20d[_0x7b9a('0x3f')][_0x7b9a('0x4c')]){_0xf4e5a8[_0x7b9a('0x4a')]=_[_0x7b9a('0x4d')](_0xf4e5a8['where'],{'$or':_['map'](_0xf4e5a8[_0x7b9a('0x41')],function(_0x459391){var _0xcab1e7={};_0xcab1e7[_0x459391]={'$like':'%'+_0x4ea20d[_0x7b9a('0x3f')][_0x7b9a('0x4c')]+'%'};return _0xcab1e7;})});}_0xf4e5a8=_[_0x7b9a('0x4d')]({},_0xf4e5a8,_0x4ea20d['options']);return _0x19ac27[_0x7b9a('0x71')](_0xf4e5a8);}})[_0x7b9a('0x1d')](function(_0x4557c4){if(_0x4557c4){_0x57bcc7=_0x4557c4[_0x7b9a('0x55')];if(!_0x4ea20d['query'][_0x7b9a('0x43')](_0x7b9a('0x44'))){_0xf4e5a8['limit']=qs['limit'](_0x4ea20d[_0x7b9a('0x3f')][_0x7b9a('0x45')]);_0xf4e5a8['offset']=qs['offset'](_0x4ea20d[_0x7b9a('0x3f')][_0x7b9a('0x2a')]);}return _0x19ac27[_0x7b9a('0x71')](_0xf4e5a8);}})['then'](function(_0x1d85f5){if(_0x1d85f5){return _0x1d85f5?{'count':_0x57bcc7,'rows':_0x1d85f5}:null;}})[_0x7b9a('0x1d')](respondWithResult(_0x3a0e4a,null))[_0x7b9a('0x26')](handleError(_0x3a0e4a,null));};exports['addApplications']=function(_0x4885d6,_0x1d51af,_0x9c655b){return db[_0x7b9a('0x4f')][_0x7b9a('0x67')]({'where':{'id':_0x4885d6[_0x7b9a('0x53')]['id']}})[_0x7b9a('0x1d')](handleEntityNotFound(_0x1d51af,null))[_0x7b9a('0x1d')](function(_0x1e30aa){if(_0x1e30aa){return db['sequelize'][_0x7b9a('0x72')](function(_0x468db6){return db['WhatsappApplication'][_0x7b9a('0x31')]({'where':{'WhatsappAccountId':_0x4885d6[_0x7b9a('0x53')]['id']},'transaction':_0x468db6})[_0x7b9a('0x1d')](function(_0x4ba112){var _0x5f0dc1=_['map'](_0x4885d6[_0x7b9a('0x58')],function(_0x4599f8){_0x4599f8[_0x7b9a('0x5f')]=_0x4885d6[_0x7b9a('0x53')]['id'];return _0x4599f8;});return db['WhatsappApplication'][_0x7b9a('0x73')](_0x5f0dc1,{'transaction':_0x468db6});});})[_0x7b9a('0x1d')](function(){return db[_0x7b9a('0x74')]['findAndCountAll']({'where':{'WhatsappAccountId':_0x4885d6[_0x7b9a('0x53')]['id']},'order':_0x7b9a('0x75')});});}})[_0x7b9a('0x1d')](respondWithResult(_0x1d51af,null))[_0x7b9a('0x26')](handleError(_0x1d51af,null));};exports[_0x7b9a('0x76')]=function(_0x2d7478,_0x36f94b,_0x53bf3d){var _0x13e5e7={};var _0x209a42={};var _0xb138bd;var _0x562d9b;return db[_0x7b9a('0x4f')]['findOne']({'where':{'id':_0x2d7478['params']['id']}})[_0x7b9a('0x1d')](handleEntityNotFound(_0x36f94b,null))[_0x7b9a('0x1d')](function(_0x14c6da){if(_0x14c6da){_0xb138bd=_0x14c6da;_0x209a42[_0x7b9a('0x3e')]=_['keys'](db[_0x7b9a('0x74')]['rawAttributes']);_0x209a42[_0x7b9a('0x3f')]=_['keys'](_0x2d7478['query']);_0x209a42[_0x7b9a('0x48')]=_[_0x7b9a('0x40')](_0x209a42['model'],_0x209a42['query']);_0x13e5e7[_0x7b9a('0x41')]=_[_0x7b9a('0x40')](_0x209a42[_0x7b9a('0x3e')],qs['fields'](_0x2d7478[_0x7b9a('0x3f')]['fields']));_0x13e5e7['attributes']=_0x13e5e7[_0x7b9a('0x41')][_0x7b9a('0x55')]?_0x13e5e7[_0x7b9a('0x41')]:_0x209a42['model'];_0x13e5e7[_0x7b9a('0x46')]=qs['sort'](_0x2d7478[_0x7b9a('0x3f')][_0x7b9a('0x47')]);_0x13e5e7[_0x7b9a('0x4a')]=qs[_0x7b9a('0x48')](_['pick'](_0x2d7478['query'],_0x209a42[_0x7b9a('0x48')]));if(_0x2d7478[_0x7b9a('0x3f')][_0x7b9a('0x4c')]){_0x13e5e7[_0x7b9a('0x4a')]=_[_0x7b9a('0x4d')](_0x13e5e7[_0x7b9a('0x4a')],{'$or':_['map'](_0x13e5e7[_0x7b9a('0x41')],function(_0x59d8d7){var _0x4f2507={};_0x4f2507[_0x59d8d7]={'$like':'%'+_0x2d7478[_0x7b9a('0x3f')][_0x7b9a('0x4c')]+'%'};return _0x4f2507;})});}_0x13e5e7=_[_0x7b9a('0x4d')]({},_0x13e5e7,_0x2d7478[_0x7b9a('0x4e')]);return _0xb138bd[_0x7b9a('0x76')](_0x13e5e7);}})[_0x7b9a('0x1d')](function(_0x525a95){if(_0x525a95){_0x562d9b=_0x525a95[_0x7b9a('0x55')];if(!_0x2d7478['query'][_0x7b9a('0x43')](_0x7b9a('0x44'))){_0x13e5e7[_0x7b9a('0x45')]=qs[_0x7b9a('0x45')](_0x2d7478[_0x7b9a('0x3f')]['limit']);_0x13e5e7['offset']=qs['offset'](_0x2d7478[_0x7b9a('0x3f')]['offset']);}return _0xb138bd[_0x7b9a('0x76')](_0x13e5e7);}})[_0x7b9a('0x1d')](function(_0x7b8cb3){if(_0x7b8cb3){return _0x7b8cb3?{'count':_0x562d9b,'rows':_0x7b8cb3}:null;}})[_0x7b9a('0x1d')](respondWithResult(_0x36f94b,null))['catch'](handleError(_0x36f94b,null));};exports[_0x7b9a('0x77')]=function(_0x1b155c,_0x18b836,_0x158bf9){var _0x4fd45a={'channel':_0x7b9a('0x78')};var _0x56fe61=[];var _0x5bb68e=[];var _0x270306={};return db[_0x7b9a('0x4f')]['find']({'where':{'id':_0x1b155c[_0x7b9a('0x53')]['id']},'include':[{'model':db[_0x7b9a('0x74')],'as':_0x7b9a('0x79')}]})[_0x7b9a('0x1d')](handleEntityNotFound(_0x18b836,null))[_0x7b9a('0x1d')](function(_0x1e4b63){_0x4fd45a[_0x7b9a('0x7a')]=_0x1e4b63;_0x4fd45a[_0x7b9a('0x7b')]=_[_0x7b9a('0x7c')](_0x1e4b63[_0x7b9a('0x79')],[_0x7b9a('0x75')],[_0x7b9a('0x7d')]);if(_0x4fd45a[_0x7b9a('0x7a')]['Applications']){delete _0x4fd45a[_0x7b9a('0x7a')][_0x7b9a('0x79')];}return db[_0x7b9a('0x7e')][_0x7b9a('0x5e')]();})[_0x7b9a('0x1d')](function(_0x1a0c9f){if(!_0x1a0c9f){throw new db[(_0x7b9a('0x1a'))][(_0x7b9a('0x7f'))]('no\x20available\x20attributes');}_0x56fe61=_[_0x7b9a('0x80')](_[_0x7b9a('0x54')](_0x1a0c9f),[_0x7b9a('0x81'),'updatedAt']);_0x5bb68e=_[_0x7b9a('0x80')](_['keys'](_0x1a0c9f),[_0x7b9a('0x81'),_0x7b9a('0x82'),_0x7b9a('0x83'),_0x7b9a('0x84')]);_0x4fd45a[_0x7b9a('0x58')]={'mapKey':_0x7b9a('0x85')};if(_0x4fd45a[_0x7b9a('0x7a')][_0x7b9a('0x3d')]&&_0x4fd45a[_0x7b9a('0x7a')][_0x7b9a('0x3d')]===_0x7b9a('0x86')){_0x4fd45a[_0x7b9a('0x58')][_0x7b9a('0x87')]=_0x1b155c[_0x7b9a('0x58')][_0x7b9a('0x88')][_0x7b9a('0x89')](_0x7b9a('0x8a'),'');_0x4fd45a['body']['body']=_0x1b155c[_0x7b9a('0x58')][_0x7b9a('0x8b')];_0x4fd45a[_0x7b9a('0x58')][_0x7b9a('0x8c')]=_0x1b155c[_0x7b9a('0x58')][_0x7b9a('0x8d')];}if(_0x4fd45a[_0x7b9a('0x58')]['id']){delete _0x4fd45a[_0x7b9a('0x58')]['id'];}if(_[_0x7b9a('0x8e')](_0x4fd45a[_0x7b9a('0x58')]['from'])){throw new db[(_0x7b9a('0x1a'))][(_0x7b9a('0x7f'))](_0x7b9a('0x8f'));}if(_['isNil'](_0x4fd45a[_0x7b9a('0x58')][_0x7b9a('0x58')])||_0x4fd45a['body'][_0x7b9a('0x58')]===''){throw new db['Sequelize'][(_0x7b9a('0x7f'))](_0x7b9a('0x90'));}if(_[_0x7b9a('0x8e')](_0x4fd45a[_0x7b9a('0x58')][_0x7b9a('0x91')])){throw new db[(_0x7b9a('0x1a'))]['ValidationError']('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x5bb68e);}if(!_['includes'](_0x5bb68e,_0x4fd45a[_0x7b9a('0x58')]['mapKey'])){throw new db[(_0x7b9a('0x1a'))][(_0x7b9a('0x7f'))](_0x7b9a('0x92')+_0x5bb68e);}_0x270306[_0x4fd45a[_0x7b9a('0x58')][_0x7b9a('0x91')]]=_0x4fd45a[_0x7b9a('0x58')]['from'];return db[_0x7b9a('0x93')][_0x7b9a('0x56')]({'where':{'id':_0x4fd45a[_0x7b9a('0x7a')][_0x7b9a('0x84')]},'include':[{'model':db[_0x7b9a('0x7e')],'as':_0x7b9a('0x94'),'where':_0x270306,'limit':0x1,'order':[[_0x7b9a('0x82'),'DESC']]}]});})['then'](handleEntityNotFound(_0x18b836,null))['then'](function(_0x2d4926){if(_0x2d4926){_0x4fd45a[_0x7b9a('0x95')]=_[_0x7b9a('0x6a')](_0x2d4926,[_0x7b9a('0x94')]);if(_0x2d4926[_0x7b9a('0x94')][_0x7b9a('0x55')]){return _0x2d4926['Contacts'][0x0];}var _0x769ff4=_[_0x7b9a('0x96')](_0x4fd45a[_0x7b9a('0x58')],{'firstName':_0x4fd45a[_0x7b9a('0x58')][_0x7b9a('0x87')],'ListId':_0x2d4926['id']});_0x769ff4[_0x4fd45a[_0x7b9a('0x58')][_0x7b9a('0x91')]]=_0x4fd45a['body'][_0x7b9a('0x87')];return db[_0x7b9a('0x7e')]['create'](_0x769ff4,{'fields':_0x56fe61,'raw':!![]});}})[_0x7b9a('0x1d')](handleEntityNotFound(_0x18b836,null))[_0x7b9a('0x1d')](function(_0x48f02e){if(_0x48f02e){_0x4fd45a['contact']=_0x48f02e;var _0x1354eb={'ContactId':_0x48f02e['id'],'phone':_0x4fd45a[_0x7b9a('0x58')][_0x7b9a('0x87')],'WhatsappAccountId':_0x1b155c[_0x7b9a('0x53')]['id']};var _0x360f2e={'ContactId':_0x48f02e['id'],'WhatsappAccountId':_0x1b155c['params']['id'],'closed':![]};return db['WhatsappInteraction'][_0x7b9a('0x56')]({'where':_0x360f2e})[_0x7b9a('0x1d')](function(_0x19dac6){if(_0x19dac6){return[_0x19dac6,![]];}return db[_0x7b9a('0x97')]['create'](_0x1354eb)[_0x7b9a('0x1d')](function(_0x2e8975){return[_0x2e8975,!![]];});});}})[_0x7b9a('0x6b')](function(_0xeb037b,_0x2370ab){_0x4fd45a[_0x7b9a('0x98')]=_0xeb037b[_0x7b9a('0x32')]({'plain':!![]});_0x4fd45a['interaction'][_0x7b9a('0x99')]=![];if(_0x2370ab){if(_0x4fd45a[_0x7b9a('0x7a')][_0x7b9a('0x9a')]){_0x4fd45a[_0x7b9a('0x7b')][_0x7b9a('0x9b')]({'id':0x0,'priority':_0x4fd45a['applications'][_0x7b9a('0x55')]+0x1,'app':_0x7b9a('0x9c'),'appdata':_0x7b9a('0x9d'),'interval':_0x7b9a('0x9e')});}_0x4fd45a[_0x7b9a('0x98')][_0x7b9a('0x99')]=!![];}return db[_0x7b9a('0x9f')]['create']({'phone':_0x4fd45a[_0x7b9a('0x58')][_0x7b9a('0x87')],'messageId':_0x4fd45a[_0x7b9a('0x58')]['messageId'],'body':_0x4fd45a[_0x7b9a('0x58')][_0x7b9a('0x58')],'WhatsappAccountId':_0x1b155c[_0x7b9a('0x53')]['id'],'WhatsappInteractionId':_0xeb037b['id'],'direction':'in','ContactId':_0xeb037b[_0x7b9a('0xa0')],'AttachmentId':_0x4fd45a[_0x7b9a('0x58')]['AttachmentId']});})['then'](function(_0x4236f7){_0x4fd45a[_0x7b9a('0x24')]=_0x4236f7;if(_0x4fd45a[_0x7b9a('0x98')][_0x7b9a('0xa1')]){return db['User'][_0x7b9a('0x56')]({'attributes':['id','name'],'where':{'id':_0x4fd45a['interaction']['UserId']}})['then'](function(_0x273429){if(_0x273429){_0x4fd45a[_0x7b9a('0x7b')]['unshift']({'id':0x0,'priority':0x0,'app':_0x7b9a('0xa2'),'appdata':_0x273429['name']+','+(_0x4fd45a['account'][_0x7b9a('0xa3')]||0xa),'interval':_0x7b9a('0x9e')});}return respondWithRpcPromise(_0x7b9a('0xa4'),_0x7b9a('0xa5'),_0x4fd45a);});}return respondWithRpcPromise(_0x7b9a('0xa4'),_0x7b9a('0xa5'),_0x4fd45a);})[_0x7b9a('0x1d')](function(_0x2ac8f4){if(_0x2ac8f4){var _0x474aea=0xc8;var _0xb950d3=_0x7b9a('0xa6');logger[_0x7b9a('0x1e')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0xb950d3,_0x474aea,_0x7b9a('0xa7'));logger[_0x7b9a('0x21')](_0x7b9a('0xa8'),_0xb950d3,_0x474aea,_0x7b9a('0xa7'),JSON[_0x7b9a('0xa9')](_0x2ac8f4));if(_0x4fd45a[_0x7b9a('0x7a')][_0x7b9a('0x3d')]===_0x7b9a('0x86')){return _0x18b836[_0x7b9a('0x28')](_0x474aea)[_0x7b9a('0x2b')](_0x7b9a('0xaa'),'text/xml')[_0x7b9a('0x36')]('\x0a');}else{return _0x18b836['status'](_0x474aea)[_0x7b9a('0x2d')](_0x2ac8f4);}}})['catch'](handleError(_0x18b836,null));};exports['send']=function(_0x5b3db3,_0xe923ef,_0x3bf262){var _0x231f70,_0x12f650,_0x672901;if(_[_0x7b9a('0x8e')](_0x5b3db3[_0x7b9a('0x58')][_0x7b9a('0x58')])||_0x5b3db3[_0x7b9a('0x58')][_0x7b9a('0x58')]===''){throw new db['Sequelize'][(_0x7b9a('0x7f'))](_0x7b9a('0x90'));}if(_[_0x7b9a('0x8e')](_0x5b3db3[_0x7b9a('0x58')]['to'])){throw new db[(_0x7b9a('0x1a'))][(_0x7b9a('0x7f'))]('to\x20is\x20mandatory');}_0x231f70=_0x5b3db3[_0x7b9a('0x58')]['to'];return db[_0x7b9a('0x4f')][_0x7b9a('0x56')]({'where':{'id':_0x5b3db3[_0x7b9a('0x53')]['id']},'include':[{'model':db[_0x7b9a('0x93')],'as':'List','include':[{'model':db[_0x7b9a('0x7e')],'as':'Contacts','where':{'mobile':_0x231f70},'limit':0x1,'order':[[_0x7b9a('0x82'),_0x7b9a('0xab')]]}]}]})['then'](handleEntityNotFound(_0xe923ef,null))[_0x7b9a('0x1d')](function(_0x456290){if(_0x456290&&_0x456290['List']){_0x12f650=_0x456290[_0x7b9a('0x32')]({'plain':!![]});if(_0x12f650[_0x7b9a('0xac')]&&_0x12f650[_0x7b9a('0xac')][_0x7b9a('0x94')]['length']){return _0x12f650[_0x7b9a('0xac')]['Contacts'][0x0];}return db[_0x7b9a('0x7e')][_0x7b9a('0x57')](_[_0x7b9a('0x96')](_0x5b3db3[_0x7b9a('0x58')],{'firstName':_0x231f70,'mobile':_0x231f70,'phone':_0x231f70,'ListId':_0x12f650[_0x7b9a('0x84')]}));}})[_0x7b9a('0x1d')](handleEntityNotFound(_0xe923ef,null))[_0x7b9a('0x1d')](function(_0x30e950){if(_0x30e950){_0x672901=_0x30e950;return db[_0x7b9a('0x97')][_0x7b9a('0x56')]({'where':{'ContactId':_0x672901['id'],'closed':![],'WhatsappAccountId':_0x12f650['id']}})[_0x7b9a('0x1d')](function(_0x1e1f1c){if(_0x1e1f1c){return[_0x1e1f1c,![]];}return db[_0x7b9a('0x97')][_0x7b9a('0x57')]({'UserId':_0x5b3db3[_0x7b9a('0xad')]['id'],'ContactId':_0x672901['id'],'WhatsappAccountId':_0x12f650['id'],'phone':_0x231f70,'firstMsgDirection':_0x7b9a('0xae'),'Messages':[_[_0x7b9a('0x4d')](_0x5b3db3[_0x7b9a('0x58')],{'read':![],'body':_0x5b3db3[_0x7b9a('0x58')][_0x7b9a('0x58')],'phone':_0x231f70,'WhatsappAccountId':_0x12f650['id'],'UserId':_0x5b3db3['user']['id'],'ContactId':_0x672901['id']})]},{'include':[{'model':db[_0x7b9a('0x9f')],'as':'Messages'}]})[_0x7b9a('0x1d')](function(_0x5de5bf){return[_0x5de5bf,!![]];});});}})['spread'](function(_0x1cab0c,_0x15bed2){if(_0x15bed2){return _0x1cab0c;}return db[_0x7b9a('0x9f')]['create'](_['merge'](_0x5b3db3[_0x7b9a('0x58')],{'read':![],'body':_0x5b3db3['body'][_0x7b9a('0x58')],'phone':_0x231f70,'WhatsappAccountId':_0x12f650['id'],'WhatsappInteractionId':_0x1cab0c['id'],'UserId':_0x5b3db3[_0x7b9a('0xad')]['id'],'ContactId':_0x672901['id']}))[_0x7b9a('0x1d')](function(_0x13df9a){_0x1cab0c[_0x7b9a('0xaf')][_0x7b9a('0xb0')]=[];_0x1cab0c[_0x7b9a('0xaf')][_0x7b9a('0xb0')]['push'](_0x13df9a[_0x7b9a('0xaf')]);return _0x1cab0c;});})[_0x7b9a('0x1d')](respondWithResult(_0xe923ef,null))[_0x7b9a('0x26')](handleError(_0xe923ef,null));}; \ No newline at end of file +var _0x750a=['set','Content-Range','json','apply','save','update','then','destroy','get','WhatsappAccounts','stack','name','send','index','Pause','map','WhatsappAccount','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','show','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','mandatoryDispositionPause','describe','addDisposition','WhatsappAccountId','Disposition','getDispositions','findOne','removeDispositions','ids','CannedAnswer','getAnswers','removeAnswers','addAgents','omit','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','getAgents','User','addApplications','sequelize','WhatsappApplication','bulkCreate','findAndCountAll','priority','getApplications','whatsapp','Applications','account','CmContact','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','from','From','replace','whatsapp:','Body','messageId','MessageSid','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','list','contact','WhatsappInteraction','spread','interaction','created','autoclose','applications','*,*,*,*','ContactId','UserId','unshift','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','WhatsappAccount,\x20%s,\x20%s,\x20%s','entity\x20found','stringify','Content-Type','to\x20is\x20mandatory','List','DESC','out','WhatsappMessage','Messages','dataValues','push','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../mysqldb','defaults','redis','localhost','./whatsappAccount.socket','register','jayson/promise','client','http','Sequelize','ValidationError','WhatsappAccount,\x20%s,\x20%s','debug','request\x20sent','error','message','info','result','catch','sendStatus','status','offset'];(function(_0x43024a,_0x1a944a){var _0x2fdd41=function(_0x1d24ef){while(--_0x1d24ef){_0x43024a['push'](_0x43024a['shift']());}};_0x2fdd41(++_0x1a944a);}(_0x750a,0x140));var _0xa750=function(_0x2076e6,_0x27898a){_0x2076e6=_0x2076e6-0x0;var _0x3068a1=_0x750a[_0x2076e6];return _0x3068a1;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xa750('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xa750('0x1'));var rp=require(_0xa750('0x2'));var moment=require(_0xa750('0x3'));var BPromise=require(_0xa750('0x4'));var Mustache=require(_0xa750('0x5'));var util=require(_0xa750('0x6'));var path=require(_0xa750('0x7'));var sox=require(_0xa750('0x8'));var csv=require(_0xa750('0x9'));var ejs=require(_0xa750('0xa'));var fs=require('fs');var _=require(_0xa750('0xb'));var squel=require(_0xa750('0xc'));var crypto=require(_0xa750('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xa750('0x9'));var querystring=require('querystring');var Papa=require(_0xa750('0xe'));var Redis=require(_0xa750('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xa750('0x10'));var as=require(_0xa750('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xa750('0x12'));var utils=require('../../config/utils');var config=require(_0xa750('0x13'));var db=require(_0xa750('0x14'))['db'];config['redis']=_[_0xa750('0x15')](config[_0xa750('0x16')],{'host':_0xa750('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa750('0x16')]));require(_0xa750('0x18'))[_0xa750('0x19')](socket);var jayson=require(_0xa750('0x1a'));var client=jayson[_0xa750('0x1b')][_0xa750('0x1c')]({'port':0x232c});function checkPasswordPattern(_0x5806ed,_0x3ae2a1,_0x8488ea){if(_0x8488ea){var _0x290d46=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x290d46['test'](_0x3ae2a1)){return _0x5806ed;}else{throw new db[(_0xa750('0x1d'))][(_0xa750('0x1e'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x5806ed;}}function respondWithRpcPromise(_0x4afb05,_0x321eb2,_0x5b1e6b,_0x433dbd){return new BPromise(function(_0x1bde87,_0x4f1faa){var _0x36dcca=_0x433dbd||client;return _0x36dcca['request'](_0x4afb05,_0x5b1e6b)['then'](function(_0x25e335){logger['info'](_0xa750('0x1f'),_0x321eb2,'request\x20sent');logger[_0xa750('0x20')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x321eb2,_0xa750('0x21'),JSON['stringify'](_0x25e335));if(_0x25e335[_0xa750('0x22')]){if(_0x25e335['error']['code']===0x1f4){logger[_0xa750('0x22')]('WhatsappAccount,\x20%s,\x20%s',_0x321eb2,_0x25e335[_0xa750('0x22')]['message']);return _0x4f1faa(_0x25e335['error']['message']);}logger['error'](_0xa750('0x1f'),_0x321eb2,_0x25e335[_0xa750('0x22')][_0xa750('0x23')]);return _0x1bde87(_0x25e335[_0xa750('0x22')][_0xa750('0x23')]);}else{logger[_0xa750('0x24')](_0xa750('0x1f'),_0x321eb2,_0xa750('0x21'));_0x1bde87(_0x25e335[_0xa750('0x25')][_0xa750('0x23')]);}})[_0xa750('0x26')](function(_0x27a5eb){logger[_0xa750('0x22')](_0xa750('0x1f'),_0x321eb2,_0x27a5eb);_0x4f1faa(_0x27a5eb);});});}function respondWithStatusCode(_0x310e2d,_0x4ffff4){_0x4ffff4=_0x4ffff4||0xcc;return function(_0x3d3923){if(_0x3d3923){return _0x310e2d[_0xa750('0x27')](_0x4ffff4);}return _0x310e2d[_0xa750('0x28')](_0x4ffff4)['end']();};}function respondWithResult(_0x35ab53,_0x6ade2b){_0x6ade2b=_0x6ade2b||0xc8;return function(_0x3270e3){if(_0x3270e3){return _0x35ab53[_0xa750('0x28')](_0x6ade2b)['json'](_0x3270e3);}};}function respondWithFilteredResult(_0x297eef,_0x34d5e9){return function(_0x449bb7){if(_0x449bb7){var _0x2aef3a=_0x449bb7['count'],_0x2c5253=_0x34d5e9[_0xa750('0x29')],_0x59ab33=_0x34d5e9[_0xa750('0x29')]+_0x34d5e9['limit'],_0x46cc11;if(_0x59ab33>=_0x2aef3a){_0x59ab33=_0x2aef3a;_0x46cc11=0xc8;}else{_0x46cc11=0xce;}_0x297eef[_0xa750('0x28')](_0x46cc11);return _0x297eef[_0xa750('0x2a')](_0xa750('0x2b'),_0x2c5253+'-'+_0x59ab33+'/'+_0x2aef3a)[_0xa750('0x2c')](_0x449bb7);}return null;};}function patchUpdates(_0xbf5164){return function(_0xe59fe7){try{jsonpatch[_0xa750('0x2d')](_0xe59fe7,_0xbf5164,!![]);}catch(_0x6ec750){return BPromise['reject'](_0x6ec750);}return _0xe59fe7[_0xa750('0x2e')]();};}function saveUpdates(_0x52f202,_0x18d040){return function(_0x1c7d5e){if(_0x1c7d5e){return _0x1c7d5e[_0xa750('0x2f')](_0x52f202)[_0xa750('0x30')](function(_0x556fde){return _0x556fde;});}return null;};}function removeEntity(_0x44b6e9,_0xa700fd){return function(_0x5c2e02){if(_0x5c2e02){return _0x5c2e02[_0xa750('0x31')]()[_0xa750('0x30')](function(){var _0x280b87=_0x5c2e02[_0xa750('0x32')]({'plain':!![]});var _0x4b13fc=_0xa750('0x33');return db['UserProfileResource']['destroy']({'where':{'type':_0x4b13fc,'resourceId':_0x280b87['id']}})[_0xa750('0x30')](function(){return _0x5c2e02;});})[_0xa750('0x30')](function(){_0x44b6e9[_0xa750('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x470089,_0x28603e){return function(_0x181d77){if(!_0x181d77){_0x470089['sendStatus'](0x194);}return _0x181d77;};}function handleError(_0x37abd2,_0xca7f52){_0xca7f52=_0xca7f52||0x1f4;return function(_0x3f3c41){logger['error'](_0x3f3c41[_0xa750('0x34')]);if(_0x3f3c41[_0xa750('0x35')]){delete _0x3f3c41[_0xa750('0x35')];}_0x37abd2['status'](_0xca7f52)[_0xa750('0x36')](_0x3f3c41);};}exports[_0xa750('0x37')]=function(_0x1e579b,_0x10589b){var _0x4dd8d5={'include':[{'model':db[_0xa750('0x38')],'as':'mandatoryDispositionPause'}]},_0x4dc0b8={},_0x3f77fe={'count':0x0,'rows':[]};var _0x43dc3a=_[_0xa750('0x39')](db[_0xa750('0x3a')][_0xa750('0x3b')],function(_0x302a79){return{'name':_0x302a79['fieldName'],'type':_0x302a79[_0xa750('0x3c')][_0xa750('0x3d')]};});_0x4dc0b8[_0xa750('0x3e')]=_[_0xa750('0x39')](_0x43dc3a,_0xa750('0x35'));_0x4dc0b8[_0xa750('0x3f')]=_[_0xa750('0x40')](_0x1e579b['query']);_0x4dc0b8[_0xa750('0x41')]=_['intersection'](_0x4dc0b8[_0xa750('0x3e')],_0x4dc0b8['query']);_0x4dd8d5[_0xa750('0x42')]=_[_0xa750('0x43')](_0x4dc0b8[_0xa750('0x3e')],qs[_0xa750('0x44')](_0x1e579b[_0xa750('0x3f')][_0xa750('0x44')]));_0x4dd8d5[_0xa750('0x42')]=_0x4dd8d5[_0xa750('0x42')][_0xa750('0x45')]?_0x4dd8d5[_0xa750('0x42')]:_0x4dc0b8[_0xa750('0x3e')];if(!_0x1e579b[_0xa750('0x3f')][_0xa750('0x46')](_0xa750('0x47'))){_0x4dd8d5[_0xa750('0x48')]=qs[_0xa750('0x48')](_0x1e579b[_0xa750('0x3f')][_0xa750('0x48')]);_0x4dd8d5[_0xa750('0x29')]=qs[_0xa750('0x29')](_0x1e579b['query'][_0xa750('0x29')]);}_0x4dd8d5[_0xa750('0x49')]=qs[_0xa750('0x4a')](_0x1e579b[_0xa750('0x3f')][_0xa750('0x4a')]);_0x4dd8d5[_0xa750('0x4b')]=qs[_0xa750('0x41')](_[_0xa750('0x4c')](_0x1e579b[_0xa750('0x3f')],_0x4dc0b8['filters']),_0x43dc3a);if(_0x1e579b[_0xa750('0x3f')][_0xa750('0x4d')]){_0x4dd8d5['where']=_[_0xa750('0x4e')](_0x4dd8d5[_0xa750('0x4b')],{'$or':_[_0xa750('0x39')](_0x43dc3a,function(_0x6991c1){if(_0x6991c1[_0xa750('0x3c')]!==_0xa750('0x4f')){var _0x5e7a95={};_0x5e7a95[_0x6991c1[_0xa750('0x35')]]={'$like':'%'+_0x1e579b[_0xa750('0x3f')][_0xa750('0x4d')]+'%'};return _0x5e7a95;}})});}_0x4dd8d5=_['merge']({},_0x4dd8d5,_0x1e579b[_0xa750('0x50')]);var _0x1ac946={'where':_0x4dd8d5['where']};return db[_0xa750('0x3a')][_0xa750('0x51')](_0x1ac946)[_0xa750('0x30')](function(_0x4a21d6){_0x3f77fe[_0xa750('0x51')]=_0x4a21d6;if(_0x1e579b[_0xa750('0x3f')][_0xa750('0x52')]){_0x4dd8d5[_0xa750('0x53')]=[{'all':!![]}];}return db['WhatsappAccount'][_0xa750('0x54')](_0x4dd8d5);})[_0xa750('0x30')](function(_0x36af53){_0x3f77fe[_0xa750('0x55')]=_0x36af53;return _0x3f77fe;})['then'](respondWithFilteredResult(_0x10589b,_0x4dd8d5))[_0xa750('0x26')](handleError(_0x10589b,null));};exports[_0xa750('0x56')]=function(_0x495b28,_0x38aa35){var _0x556283={'raw':![],'where':{'id':_0x495b28[_0xa750('0x57')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x419634={};_0x419634['model']=_[_0xa750('0x40')](db[_0xa750('0x3a')]['rawAttributes']);_0x419634[_0xa750('0x3f')]=_[_0xa750('0x40')](_0x495b28[_0xa750('0x3f')]);_0x419634['filters']=_['intersection'](_0x419634['model'],_0x419634['query']);_0x556283[_0xa750('0x42')]=_['intersection'](_0x419634[_0xa750('0x3e')],qs[_0xa750('0x44')](_0x495b28['query'][_0xa750('0x44')]));_0x556283['attributes']=_0x556283[_0xa750('0x42')]['length']?_0x556283['attributes']:_0x419634['model'];if(_0x495b28['query'][_0xa750('0x52')]){_0x556283[_0xa750('0x53')]=[{'all':!![]}];}_0x556283=_['merge']({},_0x556283,_0x495b28['options']);return db['WhatsappAccount'][_0xa750('0x58')](_0x556283)[_0xa750('0x30')](handleEntityNotFound(_0x38aa35,null))[_0xa750('0x30')](respondWithResult(_0x38aa35,null))[_0xa750('0x26')](handleError(_0x38aa35,null));};exports[_0xa750('0x59')]=function(_0x13528a,_0x599e7e){return db['WhatsappAccount'][_0xa750('0x59')](_0x13528a[_0xa750('0x5a')],{})[_0xa750('0x30')](function(_0x11163d){var _0xa8fe=_0x13528a['user'][_0xa750('0x32')]({'plain':!![]});if(!_0xa8fe)throw new Error(_0xa750('0x5b'));if(_0xa8fe[_0xa750('0x5c')]===_0xa750('0x5d')){var _0x2506eb=_0x11163d[_0xa750('0x32')]({'plain':!![]});var _0xfba5a9=_0xa750('0x33');return db['UserProfileSection'][_0xa750('0x58')]({'where':{'name':_0xfba5a9,'userProfileId':_0xa8fe[_0xa750('0x5e')]},'raw':!![]})[_0xa750('0x30')](function(_0x1f03e2){if(_0x1f03e2&&_0x1f03e2[_0xa750('0x5f')]===0x0){return db['UserProfileResource'][_0xa750('0x59')]({'name':_0x2506eb[_0xa750('0x35')],'resourceId':_0x2506eb['id'],'type':_0x1f03e2[_0xa750('0x35')],'sectionId':_0x1f03e2['id']},{})[_0xa750('0x30')](function(){return _0x11163d;});}else{return _0x11163d;}})[_0xa750('0x26')](function(_0x134c79){logger[_0xa750('0x22')](_0xa750('0x60'),_0x134c79);throw _0x134c79;});}return _0x11163d;})[_0xa750('0x30')](respondWithResult(_0x599e7e,0xc9))[_0xa750('0x26')](handleError(_0x599e7e,null));};exports[_0xa750('0x2f')]=function(_0x3e0ec8,_0x3974b0){if(_0x3e0ec8[_0xa750('0x5a')]['id']){delete _0x3e0ec8[_0xa750('0x5a')]['id'];}return db[_0xa750('0x3a')]['find']({'where':{'id':_0x3e0ec8[_0xa750('0x57')]['id']},'include':[{'model':db['Pause'],'as':_0xa750('0x61')}]})[_0xa750('0x30')](handleEntityNotFound(_0x3974b0,null))[_0xa750('0x30')](saveUpdates(_0x3e0ec8['body'],null))[_0xa750('0x30')](respondWithResult(_0x3974b0,null))[_0xa750('0x26')](handleError(_0x3974b0,null));};exports[_0xa750('0x31')]=function(_0x2922b5,_0x314787){return db[_0xa750('0x3a')]['find']({'where':{'id':_0x2922b5[_0xa750('0x57')]['id']}})[_0xa750('0x30')](handleEntityNotFound(_0x314787,null))['then'](removeEntity(_0x314787,null))[_0xa750('0x26')](handleError(_0x314787,null));};exports[_0xa750('0x62')]=function(_0xeaa46c,_0xe4d85b){return db[_0xa750('0x3a')][_0xa750('0x62')]()[_0xa750('0x30')](respondWithResult(_0xe4d85b,null))[_0xa750('0x26')](handleError(_0xe4d85b,null));};exports[_0xa750('0x63')]=function(_0x8c5a88,_0x45225a,_0x5d3ae2){if(_0x8c5a88['body']['id']){delete _0x8c5a88[_0xa750('0x5a')]['id'];}return db[_0xa750('0x3a')][_0xa750('0x58')]({'where':{'id':_0x8c5a88[_0xa750('0x57')]['id']}})['then'](handleEntityNotFound(_0x45225a,null))[_0xa750('0x30')](function(_0x67c70b){if(_0x67c70b){_0x8c5a88[_0xa750('0x5a')][_0xa750('0x64')]=_0x67c70b['id'];return db[_0xa750('0x65')][_0xa750('0x59')](_0x8c5a88[_0xa750('0x5a')]);}})[_0xa750('0x30')](respondWithResult(_0x45225a,null))[_0xa750('0x26')](handleError(_0x45225a,null));};exports[_0xa750('0x66')]=function(_0x25ded0,_0x4c90f4,_0x5a27cb){var _0x477d65={'raw':![],'where':{}};var _0x4c730d={};var _0x5ba3f5={'count':0x0,'rows':[]};return db[_0xa750('0x3a')][_0xa750('0x67')]({'where':{'id':_0x25ded0[_0xa750('0x57')]['id']}})[_0xa750('0x30')](handleEntityNotFound(_0x4c90f4,null))[_0xa750('0x30')](function(_0x4d6aea){if(_0x4d6aea){_0x4c730d[_0xa750('0x3e')]=_[_0xa750('0x40')](db[_0xa750('0x65')][_0xa750('0x3b')]);_0x4c730d[_0xa750('0x3f')]=_[_0xa750('0x40')](_0x25ded0['query']);_0x4c730d['filters']=_[_0xa750('0x43')](_0x4c730d[_0xa750('0x3e')],_0x4c730d[_0xa750('0x3f')]);_0x477d65[_0xa750('0x42')]=_[_0xa750('0x43')](_0x4c730d[_0xa750('0x3e')],qs[_0xa750('0x44')](_0x25ded0[_0xa750('0x3f')]['fields']));_0x477d65[_0xa750('0x42')]=_0x477d65['attributes']['length']?_0x477d65[_0xa750('0x42')]:_0x4c730d[_0xa750('0x3e')];if(!_0x25ded0[_0xa750('0x3f')][_0xa750('0x46')]('nolimit')){_0x477d65[_0xa750('0x48')]=qs[_0xa750('0x48')](_0x25ded0[_0xa750('0x3f')][_0xa750('0x48')]);_0x477d65['offset']=qs[_0xa750('0x29')](_0x25ded0[_0xa750('0x3f')][_0xa750('0x29')]);}_0x477d65[_0xa750('0x49')]=qs[_0xa750('0x4a')](_0x25ded0[_0xa750('0x3f')][_0xa750('0x4a')]);_0x477d65[_0xa750('0x4b')]=qs['filters'](_['pick'](_0x25ded0[_0xa750('0x3f')],_0x4c730d['filters']));_0x477d65[_0xa750('0x4b')][_0xa750('0x64')]=_0x4d6aea['id'];if(_0x25ded0['query'][_0xa750('0x4d')]){_0x477d65['where']=_[_0xa750('0x4e')](_0x477d65[_0xa750('0x4b')],{'$or':_[_0xa750('0x39')](_0x477d65['attributes'],function(_0x4dc654){var _0xffe18d={};_0xffe18d[_0x4dc654]={'$like':'%'+_0x25ded0[_0xa750('0x3f')][_0xa750('0x4d')]+'%'};return _0xffe18d;})});}_0x477d65=_['merge']({},_0x477d65,_0x25ded0['options']);return db['Disposition'][_0xa750('0x51')]({'where':_0x477d65[_0xa750('0x4b')]})['then'](function(_0x12cae9){_0x5ba3f5[_0xa750('0x51')]=_0x12cae9;if(_0x25ded0[_0xa750('0x3f')][_0xa750('0x52')]){_0x477d65[_0xa750('0x53')]=[{'all':!![]}];}return db[_0xa750('0x65')]['findAll'](_0x477d65);})[_0xa750('0x30')](function(_0x709154){_0x5ba3f5[_0xa750('0x55')]=_0x709154;return _0x5ba3f5;});}})['then'](respondWithFilteredResult(_0x4c90f4,_0x477d65))[_0xa750('0x26')](handleError(_0x4c90f4,null));};exports[_0xa750('0x68')]=function(_0x21feb4,_0x17e869,_0x584fdf){return db[_0xa750('0x3a')][_0xa750('0x58')]({'where':{'id':_0x21feb4[_0xa750('0x57')]['id']}})['then'](handleEntityNotFound(_0x17e869,null))[_0xa750('0x30')](function(_0x54045e){if(_0x54045e){return _0x54045e[_0xa750('0x68')](_0x21feb4[_0xa750('0x3f')][_0xa750('0x69')]);}})[_0xa750('0x30')](respondWithStatusCode(_0x17e869,null))[_0xa750('0x26')](handleError(_0x17e869,null));};exports['addAnswer']=function(_0x1c2115,_0x3aa634,_0xec315a){if(_0x1c2115[_0xa750('0x5a')]['id']){delete _0x1c2115[_0xa750('0x5a')]['id'];}return db['WhatsappAccount'][_0xa750('0x58')]({'where':{'id':_0x1c2115[_0xa750('0x57')]['id']}})[_0xa750('0x30')](handleEntityNotFound(_0x3aa634,null))[_0xa750('0x30')](function(_0x30f47f){if(_0x30f47f){_0x1c2115[_0xa750('0x5a')][_0xa750('0x64')]=_0x30f47f['id'];return db[_0xa750('0x6a')]['create'](_0x1c2115['body']);}})['then'](respondWithResult(_0x3aa634,null))['catch'](handleError(_0x3aa634,null));};exports[_0xa750('0x6b')]=function(_0x5b7e1f,_0x2aaaed,_0x2372b1){var _0x632b91={'raw':![],'where':{}};var _0x21f138={};var _0x1de865={'count':0x0,'rows':[]};return db['WhatsappAccount']['findOne']({'where':{'id':_0x5b7e1f[_0xa750('0x57')]['id']}})[_0xa750('0x30')](handleEntityNotFound(_0x2aaaed,null))['then'](function(_0x23aada){if(_0x23aada){_0x21f138[_0xa750('0x3e')]=_[_0xa750('0x40')](db[_0xa750('0x6a')][_0xa750('0x3b')]);_0x21f138[_0xa750('0x3f')]=_[_0xa750('0x40')](_0x5b7e1f[_0xa750('0x3f')]);_0x21f138[_0xa750('0x41')]=_[_0xa750('0x43')](_0x21f138[_0xa750('0x3e')],_0x21f138[_0xa750('0x3f')]);_0x632b91[_0xa750('0x42')]=_[_0xa750('0x43')](_0x21f138[_0xa750('0x3e')],qs[_0xa750('0x44')](_0x5b7e1f['query']['fields']));_0x632b91[_0xa750('0x42')]=_0x632b91[_0xa750('0x42')][_0xa750('0x45')]?_0x632b91[_0xa750('0x42')]:_0x21f138['model'];if(!_0x5b7e1f[_0xa750('0x3f')][_0xa750('0x46')](_0xa750('0x47'))){_0x632b91[_0xa750('0x48')]=qs[_0xa750('0x48')](_0x5b7e1f[_0xa750('0x3f')][_0xa750('0x48')]);_0x632b91[_0xa750('0x29')]=qs['offset'](_0x5b7e1f[_0xa750('0x3f')]['offset']);}_0x632b91[_0xa750('0x49')]=qs[_0xa750('0x4a')](_0x5b7e1f[_0xa750('0x3f')][_0xa750('0x4a')]);_0x632b91[_0xa750('0x4b')]=qs[_0xa750('0x41')](_[_0xa750('0x4c')](_0x5b7e1f[_0xa750('0x3f')],_0x21f138[_0xa750('0x41')]));_0x632b91[_0xa750('0x4b')][_0xa750('0x64')]=_0x23aada['id'];if(_0x5b7e1f[_0xa750('0x3f')][_0xa750('0x4d')]){_0x632b91[_0xa750('0x4b')]=_[_0xa750('0x4e')](_0x632b91[_0xa750('0x4b')],{'$or':_[_0xa750('0x39')](_0x632b91['attributes'],function(_0x5a6dd4){var _0x4dd4a4={};_0x4dd4a4[_0x5a6dd4]={'$like':'%'+_0x5b7e1f[_0xa750('0x3f')][_0xa750('0x4d')]+'%'};return _0x4dd4a4;})});}_0x632b91=_[_0xa750('0x4e')]({},_0x632b91,_0x5b7e1f[_0xa750('0x50')]);return db[_0xa750('0x6a')]['count']({'where':_0x632b91[_0xa750('0x4b')]})[_0xa750('0x30')](function(_0x1c5917){_0x1de865['count']=_0x1c5917;if(_0x5b7e1f[_0xa750('0x3f')][_0xa750('0x52')]){_0x632b91[_0xa750('0x53')]=[{'all':!![]}];}return db['CannedAnswer'][_0xa750('0x54')](_0x632b91);})[_0xa750('0x30')](function(_0x1fb2b4){_0x1de865[_0xa750('0x55')]=_0x1fb2b4;return _0x1de865;});}})['then'](respondWithFilteredResult(_0x2aaaed,_0x632b91))[_0xa750('0x26')](handleError(_0x2aaaed,null));};exports['removeAnswers']=function(_0x55bf69,_0x2f7ae4,_0x2b5ea9){return db[_0xa750('0x3a')][_0xa750('0x58')]({'where':{'id':_0x55bf69[_0xa750('0x57')]['id']}})[_0xa750('0x30')](handleEntityNotFound(_0x2f7ae4,null))['then'](function(_0x29379f){if(_0x29379f){return _0x29379f[_0xa750('0x6c')](_0x55bf69[_0xa750('0x3f')]['ids']);}})[_0xa750('0x30')](respondWithStatusCode(_0x2f7ae4,null))[_0xa750('0x26')](handleError(_0x2f7ae4,null));};exports[_0xa750('0x6d')]=function(_0x37e190,_0x3815d9,_0x5d544f){return db[_0xa750('0x3a')][_0xa750('0x58')]({'where':{'id':_0x37e190[_0xa750('0x57')]['id']}})['then'](handleEntityNotFound(_0x3815d9,null))['then'](function(_0x2c90f){if(_0x2c90f){return _0x2c90f[_0xa750('0x6d')](_0x37e190[_0xa750('0x5a')]['ids'],_[_0xa750('0x6e')](_0x37e190['body'],[_0xa750('0x69'),'id'])||{})['spread'](function(_0x19930a){for(var _0x2bd42e=0x0;_0x2bd42e<_0x37e190[_0xa750('0x5a')]['ids'][_0xa750('0x45')];_0x2bd42e+=0x1){socket[_0xa750('0x6f')](_0xa750('0x70'),{'UserId':_0x37e190[_0xa750('0x5a')][_0xa750('0x69')][_0x2bd42e],'WhatsappAccountId':_0x37e190['params']['id']});}return _0x19930a;});}})['then'](respondWithResult(_0x3815d9,null))[_0xa750('0x26')](handleError(_0x3815d9,null));};exports[_0xa750('0x71')]=function(_0xf13313,_0x5475ea,_0x4597fc){return db[_0xa750('0x3a')][_0xa750('0x58')]({'where':{'id':_0xf13313['params']['id']}})[_0xa750('0x30')](handleEntityNotFound(_0x5475ea,null))[_0xa750('0x30')](function(_0x2bf8fa){if(_0x2bf8fa){return _0x2bf8fa[_0xa750('0x71')](_0xf13313[_0xa750('0x3f')][_0xa750('0x69')])[_0xa750('0x30')](function(){if(_[_0xa750('0x72')](_0xf13313[_0xa750('0x3f')][_0xa750('0x69')])){for(var _0x226b38=0x0;_0x226b38<_0xf13313[_0xa750('0x3f')]['ids'][_0xa750('0x45')];_0x226b38+=0x1){socket[_0xa750('0x6f')]('userWhatsappAccount:remove',{'UserId':Number(_0xf13313['query'][_0xa750('0x69')][_0x226b38]),'WhatsappAccountId':Number(_0xf13313[_0xa750('0x57')]['id'])});}}else{socket[_0xa750('0x6f')](_0xa750('0x73'),{'UserId':Number(_0xf13313['query'][_0xa750('0x69')]),'WhatsappAccountId':Number(_0xf13313['params']['id'])});}});}})['then'](respondWithStatusCode(_0x5475ea,null))['catch'](handleError(_0x5475ea,null));};exports[_0xa750('0x74')]=function(_0x4b86c0,_0x45158c,_0x4985c4){var _0x905995={};var _0x4df48f={};var _0x319b08;var _0x17af3b;return db['WhatsappAccount'][_0xa750('0x67')]({'where':{'id':_0x4b86c0[_0xa750('0x57')]['id']}})[_0xa750('0x30')](handleEntityNotFound(_0x45158c,null))[_0xa750('0x30')](function(_0x5cd3c0){if(_0x5cd3c0){_0x319b08=_0x5cd3c0;_0x4df48f[_0xa750('0x3e')]=_[_0xa750('0x40')](db[_0xa750('0x75')][_0xa750('0x3b')]);_0x4df48f['query']=_[_0xa750('0x40')](_0x4b86c0['query']);_0x4df48f[_0xa750('0x41')]=_[_0xa750('0x43')](_0x4df48f[_0xa750('0x3e')],_0x4df48f['query']);_0x905995[_0xa750('0x42')]=_[_0xa750('0x43')](_0x4df48f[_0xa750('0x3e')],qs[_0xa750('0x44')](_0x4b86c0[_0xa750('0x3f')][_0xa750('0x44')]));_0x905995[_0xa750('0x42')]=_0x905995[_0xa750('0x42')][_0xa750('0x45')]?_0x905995[_0xa750('0x42')]:_0x4df48f[_0xa750('0x3e')];_0x905995[_0xa750('0x49')]=qs['sort'](_0x4b86c0['query'][_0xa750('0x4a')]);_0x905995[_0xa750('0x4b')]=qs[_0xa750('0x41')](_['pick'](_0x4b86c0[_0xa750('0x3f')],_0x4df48f['filters']));if(_0x4b86c0[_0xa750('0x3f')][_0xa750('0x4d')]){_0x905995[_0xa750('0x4b')]=_[_0xa750('0x4e')](_0x905995[_0xa750('0x4b')],{'$or':_['map'](_0x905995[_0xa750('0x42')],function(_0xf63fb){var _0x1b918d={};_0x1b918d[_0xf63fb]={'$like':'%'+_0x4b86c0[_0xa750('0x3f')]['filter']+'%'};return _0x1b918d;})});}_0x905995=_[_0xa750('0x4e')]({},_0x905995,_0x4b86c0[_0xa750('0x50')]);return _0x319b08['getAgents'](_0x905995);}})[_0xa750('0x30')](function(_0x2a2181){if(_0x2a2181){_0x17af3b=_0x2a2181[_0xa750('0x45')];if(!_0x4b86c0[_0xa750('0x3f')][_0xa750('0x46')](_0xa750('0x47'))){_0x905995['limit']=qs[_0xa750('0x48')](_0x4b86c0[_0xa750('0x3f')][_0xa750('0x48')]);_0x905995[_0xa750('0x29')]=qs[_0xa750('0x29')](_0x4b86c0['query'][_0xa750('0x29')]);}return _0x319b08['getAgents'](_0x905995);}})[_0xa750('0x30')](function(_0x32f1ab){if(_0x32f1ab){return _0x32f1ab?{'count':_0x17af3b,'rows':_0x32f1ab}:null;}})['then'](respondWithResult(_0x45158c,null))[_0xa750('0x26')](handleError(_0x45158c,null));};exports[_0xa750('0x76')]=function(_0x26954c,_0x298df1,_0x509319){return db[_0xa750('0x3a')][_0xa750('0x67')]({'where':{'id':_0x26954c['params']['id']}})[_0xa750('0x30')](handleEntityNotFound(_0x298df1,null))[_0xa750('0x30')](function(_0x3b5e2a){if(_0x3b5e2a){return db[_0xa750('0x77')]['transaction'](function(_0x4420da){return db[_0xa750('0x78')][_0xa750('0x31')]({'where':{'WhatsappAccountId':_0x26954c[_0xa750('0x57')]['id']},'transaction':_0x4420da})[_0xa750('0x30')](function(_0x2e1d38){var _0x52af7f=_['map'](_0x26954c[_0xa750('0x5a')],function(_0x510837){_0x510837[_0xa750('0x64')]=_0x26954c[_0xa750('0x57')]['id'];return _0x510837;});return db['WhatsappApplication'][_0xa750('0x79')](_0x52af7f,{'transaction':_0x4420da});});})[_0xa750('0x30')](function(){return db['WhatsappApplication'][_0xa750('0x7a')]({'where':{'WhatsappAccountId':_0x26954c[_0xa750('0x57')]['id']},'order':_0xa750('0x7b')});});}})[_0xa750('0x30')](respondWithResult(_0x298df1,null))[_0xa750('0x26')](handleError(_0x298df1,null));};exports[_0xa750('0x7c')]=function(_0x527dc0,_0x19835e,_0x3f3c07){var _0x50ff33={};var _0x39a4d9={};var _0x4b1794;var _0x230b0c;return db['WhatsappAccount'][_0xa750('0x67')]({'where':{'id':_0x527dc0[_0xa750('0x57')]['id']}})[_0xa750('0x30')](handleEntityNotFound(_0x19835e,null))['then'](function(_0x221948){if(_0x221948){_0x4b1794=_0x221948;_0x39a4d9[_0xa750('0x3e')]=_[_0xa750('0x40')](db[_0xa750('0x78')][_0xa750('0x3b')]);_0x39a4d9['query']=_[_0xa750('0x40')](_0x527dc0[_0xa750('0x3f')]);_0x39a4d9[_0xa750('0x41')]=_['intersection'](_0x39a4d9[_0xa750('0x3e')],_0x39a4d9[_0xa750('0x3f')]);_0x50ff33[_0xa750('0x42')]=_[_0xa750('0x43')](_0x39a4d9[_0xa750('0x3e')],qs[_0xa750('0x44')](_0x527dc0['query'][_0xa750('0x44')]));_0x50ff33[_0xa750('0x42')]=_0x50ff33[_0xa750('0x42')][_0xa750('0x45')]?_0x50ff33[_0xa750('0x42')]:_0x39a4d9[_0xa750('0x3e')];_0x50ff33[_0xa750('0x49')]=qs[_0xa750('0x4a')](_0x527dc0[_0xa750('0x3f')][_0xa750('0x4a')]);_0x50ff33['where']=qs[_0xa750('0x41')](_['pick'](_0x527dc0[_0xa750('0x3f')],_0x39a4d9[_0xa750('0x41')]));if(_0x527dc0[_0xa750('0x3f')]['filter']){_0x50ff33['where']=_[_0xa750('0x4e')](_0x50ff33[_0xa750('0x4b')],{'$or':_['map'](_0x50ff33[_0xa750('0x42')],function(_0x5b1011){var _0x5c09d7={};_0x5c09d7[_0x5b1011]={'$like':'%'+_0x527dc0[_0xa750('0x3f')][_0xa750('0x4d')]+'%'};return _0x5c09d7;})});}_0x50ff33=_[_0xa750('0x4e')]({},_0x50ff33,_0x527dc0['options']);return _0x4b1794['getApplications'](_0x50ff33);}})[_0xa750('0x30')](function(_0xc5419d){if(_0xc5419d){_0x230b0c=_0xc5419d[_0xa750('0x45')];if(!_0x527dc0[_0xa750('0x3f')][_0xa750('0x46')](_0xa750('0x47'))){_0x50ff33[_0xa750('0x48')]=qs[_0xa750('0x48')](_0x527dc0[_0xa750('0x3f')][_0xa750('0x48')]);_0x50ff33['offset']=qs[_0xa750('0x29')](_0x527dc0[_0xa750('0x3f')][_0xa750('0x29')]);}return _0x4b1794[_0xa750('0x7c')](_0x50ff33);}})['then'](function(_0x566357){if(_0x566357){return _0x566357?{'count':_0x230b0c,'rows':_0x566357}:null;}})[_0xa750('0x30')](respondWithResult(_0x19835e,null))[_0xa750('0x26')](handleError(_0x19835e,null));};exports['notify']=function(_0x44ecfd,_0x513bec,_0x383fc3){var _0x4180ec={'channel':_0xa750('0x7d')};var _0x10155a=[];var _0x4f0938=[];var _0x28591b={};return db[_0xa750('0x3a')][_0xa750('0x58')]({'where':{'id':_0x44ecfd['params']['id']},'include':[{'model':db[_0xa750('0x78')],'as':_0xa750('0x7e')}]})['then'](handleEntityNotFound(_0x513bec,null))[_0xa750('0x30')](function(_0x26509f){_0x4180ec['account']=_0x26509f;_0x4180ec['applications']=_['orderBy'](_0x26509f[_0xa750('0x7e')],[_0xa750('0x7b')],['asc']);if(_0x4180ec['account'][_0xa750('0x7e')]){delete _0x4180ec[_0xa750('0x7f')][_0xa750('0x7e')];}return db[_0xa750('0x80')][_0xa750('0x62')]();})[_0xa750('0x30')](function(_0x446e69){if(!_0x446e69){throw new db[(_0xa750('0x1d'))]['ValidationError']('no\x20available\x20attributes');}_0x10155a=_[_0xa750('0x81')](_[_0xa750('0x40')](_0x446e69),[_0xa750('0x82'),_0xa750('0x83')]);_0x4f0938=_[_0xa750('0x81')](_[_0xa750('0x40')](_0x446e69),[_0xa750('0x82'),_0xa750('0x83'),_0xa750('0x84'),_0xa750('0x85')]);_0x4180ec[_0xa750('0x5a')]={'mapKey':_0xa750('0x86')};if(_0x4180ec[_0xa750('0x7f')]['type']&&_0x4180ec[_0xa750('0x7f')][_0xa750('0x3c')]===_0xa750('0x87')){_0x4180ec[_0xa750('0x5a')][_0xa750('0x88')]=_0x44ecfd[_0xa750('0x5a')][_0xa750('0x89')][_0xa750('0x8a')](_0xa750('0x8b'),'');_0x4180ec[_0xa750('0x5a')][_0xa750('0x5a')]=_0x44ecfd[_0xa750('0x5a')][_0xa750('0x8c')];_0x4180ec[_0xa750('0x5a')][_0xa750('0x8d')]=_0x44ecfd[_0xa750('0x5a')][_0xa750('0x8e')];}if(_0x4180ec[_0xa750('0x5a')]['id']){delete _0x4180ec[_0xa750('0x5a')]['id'];}if(_['isNil'](_0x4180ec[_0xa750('0x5a')][_0xa750('0x88')])){throw new db[(_0xa750('0x1d'))][(_0xa750('0x1e'))](_0xa750('0x8f'));}if(_[_0xa750('0x90')](_0x4180ec['body'][_0xa750('0x5a')])||_0x4180ec[_0xa750('0x5a')][_0xa750('0x5a')]===''){throw new db[(_0xa750('0x1d'))][(_0xa750('0x1e'))](_0xa750('0x91'));}if(_[_0xa750('0x90')](_0x4180ec['body'][_0xa750('0x92')])){throw new db[(_0xa750('0x1d'))][(_0xa750('0x1e'))](_0xa750('0x93')+_0x4f0938);}if(!_[_0xa750('0x94')](_0x4f0938,_0x4180ec[_0xa750('0x5a')][_0xa750('0x92')])){throw new db[(_0xa750('0x1d'))][(_0xa750('0x1e'))](_0xa750('0x95')+_0x4f0938);}_0x28591b[_0x4180ec[_0xa750('0x5a')][_0xa750('0x92')]]=_0x4180ec[_0xa750('0x5a')][_0xa750('0x88')];return db[_0xa750('0x96')]['find']({'where':{'id':_0x4180ec['account'][_0xa750('0x85')]},'include':[{'model':db[_0xa750('0x80')],'as':_0xa750('0x97'),'where':_0x28591b,'limit':0x1,'order':[['updatedAt','DESC']]}]});})[_0xa750('0x30')](handleEntityNotFound(_0x513bec,null))[_0xa750('0x30')](function(_0x4f84e1){if(_0x4f84e1){_0x4180ec[_0xa750('0x98')]=_[_0xa750('0x6e')](_0x4f84e1,[_0xa750('0x97')]);if(_0x4f84e1[_0xa750('0x97')]['length']){return _0x4f84e1['Contacts'][0x0];}var _0x205006=_[_0xa750('0x15')](_0x4180ec[_0xa750('0x5a')],{'firstName':_0x4180ec[_0xa750('0x5a')][_0xa750('0x88')],'ListId':_0x4f84e1['id']});_0x205006[_0x4180ec[_0xa750('0x5a')][_0xa750('0x92')]]=_0x4180ec['body']['from'];return db['CmContact'][_0xa750('0x59')](_0x205006,{'fields':_0x10155a,'raw':!![]});}})[_0xa750('0x30')](handleEntityNotFound(_0x513bec,null))[_0xa750('0x30')](function(_0xef415c){if(_0xef415c){_0x4180ec[_0xa750('0x99')]=_0xef415c;var _0x4728cf={'ContactId':_0xef415c['id'],'phone':_0x4180ec['body'][_0xa750('0x88')],'WhatsappAccountId':_0x44ecfd[_0xa750('0x57')]['id']};var _0x520581={'ContactId':_0xef415c['id'],'WhatsappAccountId':_0x44ecfd['params']['id'],'closed':![]};return db[_0xa750('0x9a')]['find']({'where':_0x520581})[_0xa750('0x30')](function(_0x1f7b53){if(_0x1f7b53){return[_0x1f7b53,![]];}return db[_0xa750('0x9a')][_0xa750('0x59')](_0x4728cf)[_0xa750('0x30')](function(_0xb78c0a){return[_0xb78c0a,!![]];});});}})[_0xa750('0x9b')](function(_0x243950,_0x54daff){_0x4180ec[_0xa750('0x9c')]=_0x243950['get']({'plain':!![]});_0x4180ec[_0xa750('0x9c')][_0xa750('0x9d')]=![];if(_0x54daff){if(_0x4180ec[_0xa750('0x7f')][_0xa750('0x9e')]){_0x4180ec[_0xa750('0x9f')]['push']({'id':0x0,'priority':_0x4180ec[_0xa750('0x9f')][_0xa750('0x45')]+0x1,'app':'close','appdata':'unmanaged','interval':_0xa750('0xa0')});}_0x4180ec[_0xa750('0x9c')][_0xa750('0x9d')]=!![];}return db['WhatsappMessage'][_0xa750('0x59')]({'phone':_0x4180ec[_0xa750('0x5a')][_0xa750('0x88')],'messageId':_0x4180ec[_0xa750('0x5a')][_0xa750('0x8d')],'body':_0x4180ec[_0xa750('0x5a')][_0xa750('0x5a')],'WhatsappAccountId':_0x44ecfd[_0xa750('0x57')]['id'],'WhatsappInteractionId':_0x243950['id'],'direction':'in','ContactId':_0x243950[_0xa750('0xa1')],'AttachmentId':_0x4180ec[_0xa750('0x5a')]['AttachmentId']});})[_0xa750('0x30')](function(_0x4c3aaf){_0x4180ec[_0xa750('0x23')]=_0x4c3aaf;if(_0x4180ec[_0xa750('0x9c')][_0xa750('0xa2')]){return db[_0xa750('0x75')]['find']({'attributes':['id',_0xa750('0x35')],'where':{'id':_0x4180ec[_0xa750('0x9c')]['UserId']}})['then'](function(_0x5e4136){if(_0x5e4136){_0x4180ec[_0xa750('0x9f')][_0xa750('0xa3')]({'id':0x0,'priority':0x0,'app':_0xa750('0xa4'),'appdata':_0x5e4136['name']+','+(_0x4180ec[_0xa750('0x7f')][_0xa750('0xa5')]||0xa),'interval':_0xa750('0xa0')});}return respondWithRpcPromise('Start','startRouting',_0x4180ec);});}return respondWithRpcPromise(_0xa750('0xa6'),_0xa750('0xa7'),_0x4180ec);})[_0xa750('0x30')](function(_0x1b26f4){if(_0x1b26f4){var _0x35f7fc=0xc8;var _0x320946=_0xa750('0xa8');logger['info'](_0xa750('0xa9'),_0x320946,_0x35f7fc,_0xa750('0xaa'));logger[_0xa750('0x20')]('WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x320946,_0x35f7fc,_0xa750('0xaa'),JSON[_0xa750('0xab')](_0x1b26f4));if(_0x4180ec['account'][_0xa750('0x3c')]===_0xa750('0x87')){return _0x513bec[_0xa750('0x28')](_0x35f7fc)[_0xa750('0x2a')](_0xa750('0xac'),'text/xml')[_0xa750('0x36')]('\x0a');}else{return _0x513bec[_0xa750('0x28')](_0x35f7fc)[_0xa750('0x2c')](_0x1b26f4);}}})[_0xa750('0x26')](handleError(_0x513bec,null));};exports[_0xa750('0x36')]=function(_0x44f661,_0x59beef,_0xc4bd7a){var _0x123d1a,_0x24855e,_0x345f83;if(_[_0xa750('0x90')](_0x44f661[_0xa750('0x5a')][_0xa750('0x5a')])||_0x44f661[_0xa750('0x5a')]['body']===''){throw new db[(_0xa750('0x1d'))][(_0xa750('0x1e'))](_0xa750('0x91'));}if(_[_0xa750('0x90')](_0x44f661[_0xa750('0x5a')]['to'])){throw new db['Sequelize'][(_0xa750('0x1e'))](_0xa750('0xad'));}_0x123d1a=_0x44f661[_0xa750('0x5a')]['to'];return db[_0xa750('0x3a')]['find']({'where':{'id':_0x44f661[_0xa750('0x57')]['id']},'include':[{'model':db[_0xa750('0x96')],'as':_0xa750('0xae'),'include':[{'model':db['CmContact'],'as':'Contacts','where':{'mobile':_0x123d1a},'limit':0x1,'order':[[_0xa750('0x83'),_0xa750('0xaf')]]}]}]})[_0xa750('0x30')](handleEntityNotFound(_0x59beef,null))['then'](function(_0x147a47){if(_0x147a47&&_0x147a47[_0xa750('0xae')]){_0x24855e=_0x147a47[_0xa750('0x32')]({'plain':!![]});if(_0x24855e[_0xa750('0xae')]&&_0x24855e[_0xa750('0xae')][_0xa750('0x97')][_0xa750('0x45')]){return _0x24855e[_0xa750('0xae')][_0xa750('0x97')][0x0];}return db[_0xa750('0x80')][_0xa750('0x59')](_[_0xa750('0x15')](_0x44f661[_0xa750('0x5a')],{'firstName':_0x123d1a,'mobile':_0x123d1a,'phone':_0x123d1a,'ListId':_0x24855e[_0xa750('0x85')]}));}})[_0xa750('0x30')](handleEntityNotFound(_0x59beef,null))[_0xa750('0x30')](function(_0x3f4b5e){if(_0x3f4b5e){_0x345f83=_0x3f4b5e;return db[_0xa750('0x9a')][_0xa750('0x58')]({'where':{'ContactId':_0x345f83['id'],'closed':![],'WhatsappAccountId':_0x24855e['id']}})[_0xa750('0x30')](function(_0x3f9fd5){if(_0x3f9fd5){return[_0x3f9fd5,![]];}return db[_0xa750('0x9a')][_0xa750('0x59')]({'UserId':_0x44f661[_0xa750('0x5d')]['id'],'ContactId':_0x345f83['id'],'WhatsappAccountId':_0x24855e['id'],'phone':_0x123d1a,'firstMsgDirection':_0xa750('0xb0'),'Messages':[_[_0xa750('0x4e')](_0x44f661[_0xa750('0x5a')],{'read':![],'body':_0x44f661[_0xa750('0x5a')][_0xa750('0x5a')],'phone':_0x123d1a,'WhatsappAccountId':_0x24855e['id'],'UserId':_0x44f661[_0xa750('0x5d')]['id'],'ContactId':_0x345f83['id']})]},{'include':[{'model':db[_0xa750('0xb1')],'as':_0xa750('0xb2')}]})[_0xa750('0x30')](function(_0x9e941a){return[_0x9e941a,!![]];});});}})[_0xa750('0x9b')](function(_0x2a77b5,_0x3d31be){if(_0x3d31be){return _0x2a77b5;}return db[_0xa750('0xb1')][_0xa750('0x59')](_[_0xa750('0x4e')](_0x44f661[_0xa750('0x5a')],{'read':![],'body':_0x44f661[_0xa750('0x5a')]['body'],'phone':_0x123d1a,'WhatsappAccountId':_0x24855e['id'],'WhatsappInteractionId':_0x2a77b5['id'],'UserId':_0x44f661['user']['id'],'ContactId':_0x345f83['id']}))[_0xa750('0x30')](function(_0x4b4ed4){_0x2a77b5[_0xa750('0xb3')]['Messages']=[];_0x2a77b5[_0xa750('0xb3')]['Messages'][_0xa750('0xb4')](_0x4b4ed4[_0xa750('0xb3')]);return _0x2a77b5;});})[_0xa750('0x30')](respondWithResult(_0x59beef,null))['catch'](handleError(_0x59beef,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index b20e206..0aaac97 100644 --- a/server/api/whatsappAccount/whatsappAccount.events.js +++ b/server/api/whatsappAccount/whatsappAccount.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xafc4=['update','remove','emit','hasOwnProperty','hook','exports','events','WhatsappAccount','save'];(function(_0x188a93,_0xaf57db){var _0x23b40d=function(_0x599f63){while(--_0x599f63){_0x188a93['push'](_0x188a93['shift']());}};_0x23b40d(++_0xaf57db);}(_0xafc4,0x69));var _0x4afc=function(_0x2c68a3,_0x3d11e3){_0x2c68a3=_0x2c68a3-0x0;var _0x5385fb=_0xafc4[_0x2c68a3];return _0x5385fb;};'use strict';var EventEmitter=require(_0x4afc('0x0'));var WhatsappAccount=require('../../mysqldb')['db'][_0x4afc('0x1')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x4afc('0x2'),'afterUpdate':_0x4afc('0x3'),'afterDestroy':_0x4afc('0x4')};function emitEvent(_0x237ea0){return function(_0x4d9dbd,_0x49f417,_0x5378e5){WhatsappAccountEvents[_0x4afc('0x5')](_0x237ea0+':'+_0x4d9dbd['id'],_0x4d9dbd);WhatsappAccountEvents[_0x4afc('0x5')](_0x237ea0,_0x4d9dbd);_0x5378e5(null);};}for(var e in events){if(events[_0x4afc('0x6')](e)){var event=events[e];WhatsappAccount[_0x4afc('0x7')](e,emitEvent(event));}}module[_0x4afc('0x8')]=WhatsappAccountEvents; \ No newline at end of file +var _0xa899=['exports','events','../../mysqldb','WhatsappAccount','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x482381,_0x5416ef){var _0x386ad9=function(_0x196721){while(--_0x196721){_0x482381['push'](_0x482381['shift']());}};_0x386ad9(++_0x5416ef);}(_0xa899,0x155));var _0x9a89=function(_0xf6e75d,_0xc70967){_0xf6e75d=_0xf6e75d-0x0;var _0x27514d=_0xa899[_0xf6e75d];return _0x27514d;};'use strict';var EventEmitter=require(_0x9a89('0x0'));var WhatsappAccount=require(_0x9a89('0x1'))['db'][_0x9a89('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x9a89('0x3'),'afterUpdate':_0x9a89('0x4'),'afterDestroy':_0x9a89('0x5')};function emitEvent(_0x45233c){return function(_0x405c47,_0x15c431,_0x105758){WhatsappAccountEvents[_0x9a89('0x6')](_0x45233c+':'+_0x405c47['id'],_0x405c47);WhatsappAccountEvents[_0x9a89('0x6')](_0x45233c,_0x405c47);_0x105758(null);};}for(var e in events){if(events[_0x9a89('0x7')](e)){var event=events[e];WhatsappAccount[_0x9a89('0x8')](e,emitEvent(event));}}module[_0x9a89('0x9')]=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index 9e4d299..163708a 100644 --- a/server/api/whatsappAccount/whatsappAccount.model.js +++ b/server/api/whatsappAccount/whatsappAccount.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1a9b=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./whatsappAccount.attributes','define','WhatsappAccount','whatsapp_accounts','lodash','util'];(function(_0x3d4b52,_0x54acd2){var _0x100db5=function(_0x5f1c2a){while(--_0x5f1c2a){_0x3d4b52['push'](_0x3d4b52['shift']());}};_0x100db5(++_0x54acd2);}(_0x1a9b,0x73));var _0xb1a9=function(_0x26acc5,_0x42e1e0){_0x26acc5=_0x26acc5-0x0;var _0x4267f7=_0x1a9b[_0x26acc5];return _0x4267f7;};'use strict';var _=require(_0xb1a9('0x0'));var util=require(_0xb1a9('0x1'));var logger=require(_0xb1a9('0x2'))(_0xb1a9('0x3'));var moment=require(_0xb1a9('0x4'));var BPromise=require(_0xb1a9('0x5'));var rp=require(_0xb1a9('0x6'));var fs=require('fs');var path=require(_0xb1a9('0x7'));var rimraf=require(_0xb1a9('0x8'));var config=require('../../config/environment');var attributes=require(_0xb1a9('0x9'));module['exports']=function(_0x2f8fe0,_0x2e2a99){return _0x2f8fe0[_0xb1a9('0xa')](_0xb1a9('0xb'),attributes,{'tableName':_0xb1a9('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6642=['rimraf','../../config/environment','./whatsappAccount.attributes','exports','define','WhatsappAccount','util','../../config/logger','api','bluebird','request-promise'];(function(_0x59736a,_0x2815f){var _0x493e19=function(_0x793e8e){while(--_0x793e8e){_0x59736a['push'](_0x59736a['shift']());}};_0x493e19(++_0x2815f);}(_0x6642,0x145));var _0x2664=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6642[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x2664('0x0'));var logger=require(_0x2664('0x1'))(_0x2664('0x2'));var moment=require('moment');var BPromise=require(_0x2664('0x3'));var rp=require(_0x2664('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2664('0x5'));var config=require(_0x2664('0x6'));var attributes=require(_0x2664('0x7'));module[_0x2664('0x8')]=function(_0x24bd84,_0x1e85c1){return _0x24bd84[_0x2664('0x9')](_0x2664('0xa'),attributes,{'tableName':'whatsapp_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.rpc.js b/server/api/whatsappAccount/whatsappAccount.rpc.js index 969820d..164d839 100644 --- a/server/api/whatsappAccount/whatsappAccount.rpc.js +++ b/server/api/whatsappAccount/whatsappAccount.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb0db=['rpc','../../config/environment','jayson/promise','client','http','socket.io-emitter','redis','./whatsappAccount.socket','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','ShowWhatsappAccount','WhatsappAccount','find','options','raw','where','attributes','model','include','map','debug','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x500419,_0x549162){var _0x241c1a=function(_0x3bea1a){while(--_0x3bea1a){_0x500419['push'](_0x500419['shift']());}};_0x241c1a(++_0x549162);}(_0xb0db,0xa3));var _0xbb0d=function(_0x221680,_0xa42e09){_0x221680=_0x221680-0x0;var _0xa5fe1c=_0xb0db[_0x221680];return _0xa5fe1c;};'use strict';var _=require('lodash');var util=require(_0xbb0d('0x0'));var moment=require(_0xbb0d('0x1'));var BPromise=require(_0xbb0d('0x2'));var rs=require(_0xbb0d('0x3'));var fs=require('fs');var Redis=require(_0xbb0d('0x4'));var db=require(_0xbb0d('0x5'))['db'];var utils=require(_0xbb0d('0x6'));var logger=require('../../config/logger')(_0xbb0d('0x7'));var config=require(_0xbb0d('0x8'));var jayson=require(_0xbb0d('0x9'));var client=jayson[_0xbb0d('0xa')][_0xbb0d('0xb')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xbb0d('0xc'))(new Redis(config[_0xbb0d('0xd')]));require(_0xbb0d('0xe'))['register'](socket);function respondWithRpcPromise(_0x214dfd,_0x54ad65,_0x513c95){return new BPromise(function(_0x17d5ae,_0xcaebec){return client['request'](_0x214dfd,_0x513c95)[_0xbb0d('0xf')](function(_0x1d4603){logger[_0xbb0d('0x10')](_0xbb0d('0x11'),_0x54ad65,_0xbb0d('0x12'));logger['debug']('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x54ad65,'request\x20sent',JSON[_0xbb0d('0x13')](_0x1d4603));if(_0x1d4603['error']){if(_0x1d4603[_0xbb0d('0x14')]['code']===0x1f4){logger[_0xbb0d('0x14')]('WhatsappAccount,\x20%s,\x20%s',_0x54ad65,_0x1d4603['error'][_0xbb0d('0x15')]);return _0xcaebec(_0x1d4603[_0xbb0d('0x14')][_0xbb0d('0x15')]);}logger[_0xbb0d('0x14')](_0xbb0d('0x11'),_0x54ad65,_0x1d4603[_0xbb0d('0x14')][_0xbb0d('0x15')]);return _0x17d5ae(_0x1d4603[_0xbb0d('0x14')]['message']);}else{logger['info'](_0xbb0d('0x11'),_0x54ad65,_0xbb0d('0x12'));_0x17d5ae(_0x1d4603['result'][_0xbb0d('0x15')]);}})[_0xbb0d('0x16')](function(_0x9b463f){logger[_0xbb0d('0x14')]('WhatsappAccount,\x20%s,\x20%s',_0x54ad65,_0x9b463f);_0xcaebec(_0x9b463f);});});}exports[_0xbb0d('0x17')]=function(_0x389a74){var _0x9c13a=this;return new Promise(function(_0x337dd3,_0x270169){return db[_0xbb0d('0x18')][_0xbb0d('0x19')]({'raw':_0x389a74['options']?_0x389a74[_0xbb0d('0x1a')][_0xbb0d('0x1b')]===undefined?!![]:![]:!![],'where':_0x389a74['options']?_0x389a74[_0xbb0d('0x1a')][_0xbb0d('0x1c')]||null:null,'attributes':_0x389a74[_0xbb0d('0x1a')]?_0x389a74[_0xbb0d('0x1a')][_0xbb0d('0x1d')]||null:null,'include':_0x389a74[_0xbb0d('0x1a')]?_0x389a74['options']['include']?_['map'](_0x389a74[_0xbb0d('0x1a')]['include'],function(_0x593481){return{'model':db[_0x593481[_0xbb0d('0x1e')]],'as':_0x593481['as'],'attributes':_0x593481[_0xbb0d('0x1d')],'include':_0x593481[_0xbb0d('0x1f')]?_['map'](_0x593481[_0xbb0d('0x1f')],function(_0x5d9961){return{'model':db[_0x5d9961[_0xbb0d('0x1e')]],'as':_0x5d9961['as'],'attributes':_0x5d9961[_0xbb0d('0x1d')],'include':_0x5d9961[_0xbb0d('0x1f')]?_[_0xbb0d('0x20')](_0x5d9961[_0xbb0d('0x1f')],function(_0x2a2c65){return{'model':db[_0x2a2c65[_0xbb0d('0x1e')]],'as':_0x2a2c65['as'],'attributes':_0x2a2c65[_0xbb0d('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xbb0d('0xf')](function(_0x2e3705){logger[_0xbb0d('0x10')](_0xbb0d('0x17'),_0x389a74);logger[_0xbb0d('0x21')](_0xbb0d('0x17'),_0x389a74,JSON['stringify'](_0x2e3705));_0x337dd3(_0x2e3705);})['catch'](function(_0x26593b){logger[_0xbb0d('0x14')](_0xbb0d('0x17'),_0x26593b['message'],_0x389a74);_0x270169(_0x9c13a['error'](0x1f4,_0x26593b[_0xbb0d('0x15')]));});});}; \ No newline at end of file +var _0xe82b=['find','options','raw','where','attributes','map','include','model','debug','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','localhost','./whatsappAccount.socket','register','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowWhatsappAccount','WhatsappAccount'];(function(_0x1168a1,_0xa0d8c9){var _0xcc5ad8=function(_0x217dc3){while(--_0x217dc3){_0x1168a1['push'](_0x1168a1['shift']());}};_0xcc5ad8(++_0xa0d8c9);}(_0xe82b,0x11a));var _0xbe82=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0xe82b[_0x3054be];return _0x3df150;};'use strict';var _=require(_0xbe82('0x0'));var util=require(_0xbe82('0x1'));var moment=require('moment');var BPromise=require(_0xbe82('0x2'));var rs=require(_0xbe82('0x3'));var fs=require('fs');var Redis=require(_0xbe82('0x4'));var db=require(_0xbe82('0x5'))['db'];var utils=require(_0xbe82('0x6'));var logger=require(_0xbe82('0x7'))('rpc');var config=require(_0xbe82('0x8'));var jayson=require(_0xbe82('0x9'));var client=jayson['client'][_0xbe82('0xa')]({'port':0x232a});config[_0xbe82('0xb')]=_[_0xbe82('0xc')](config[_0xbe82('0xb')],{'host':_0xbe82('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xbe82('0xb')]));require(_0xbe82('0xe'))[_0xbe82('0xf')](socket);function respondWithRpcPromise(_0x15991e,_0xc7e0e5,_0xf62428){return new BPromise(function(_0x27acb6,_0x5d484a){return client[_0xbe82('0x10')](_0x15991e,_0xf62428)[_0xbe82('0x11')](function(_0x23c289){logger[_0xbe82('0x12')](_0xbe82('0x13'),_0xc7e0e5,_0xbe82('0x14'));logger['debug'](_0xbe82('0x15'),_0xc7e0e5,'request\x20sent',JSON[_0xbe82('0x16')](_0x23c289));if(_0x23c289['error']){if(_0x23c289[_0xbe82('0x17')][_0xbe82('0x18')]===0x1f4){logger[_0xbe82('0x17')]('WhatsappAccount,\x20%s,\x20%s',_0xc7e0e5,_0x23c289[_0xbe82('0x17')][_0xbe82('0x19')]);return _0x5d484a(_0x23c289[_0xbe82('0x17')]['message']);}logger[_0xbe82('0x17')](_0xbe82('0x13'),_0xc7e0e5,_0x23c289['error'][_0xbe82('0x19')]);return _0x27acb6(_0x23c289[_0xbe82('0x17')][_0xbe82('0x19')]);}else{logger['info']('WhatsappAccount,\x20%s,\x20%s',_0xc7e0e5,_0xbe82('0x14'));_0x27acb6(_0x23c289[_0xbe82('0x1a')][_0xbe82('0x19')]);}})[_0xbe82('0x1b')](function(_0x12c528){logger[_0xbe82('0x17')](_0xbe82('0x13'),_0xc7e0e5,_0x12c528);_0x5d484a(_0x12c528);});});}exports[_0xbe82('0x1c')]=function(_0x4f5241){var _0x3c3e26=this;return new Promise(function(_0xc10cb5,_0x6c9758){return db[_0xbe82('0x1d')][_0xbe82('0x1e')]({'raw':_0x4f5241[_0xbe82('0x1f')]?_0x4f5241['options'][_0xbe82('0x20')]===undefined?!![]:![]:!![],'where':_0x4f5241[_0xbe82('0x1f')]?_0x4f5241[_0xbe82('0x1f')][_0xbe82('0x21')]||null:null,'attributes':_0x4f5241[_0xbe82('0x1f')]?_0x4f5241[_0xbe82('0x1f')][_0xbe82('0x22')]||null:null,'include':_0x4f5241[_0xbe82('0x1f')]?_0x4f5241['options']['include']?_[_0xbe82('0x23')](_0x4f5241['options'][_0xbe82('0x24')],function(_0x1041a6){return{'model':db[_0x1041a6[_0xbe82('0x25')]],'as':_0x1041a6['as'],'attributes':_0x1041a6[_0xbe82('0x22')],'include':_0x1041a6[_0xbe82('0x24')]?_[_0xbe82('0x23')](_0x1041a6['include'],function(_0x5b02b5){return{'model':db[_0x5b02b5[_0xbe82('0x25')]],'as':_0x5b02b5['as'],'attributes':_0x5b02b5[_0xbe82('0x22')],'include':_0x5b02b5['include']?_['map'](_0x5b02b5[_0xbe82('0x24')],function(_0xce75aa){return{'model':db[_0xce75aa['model']],'as':_0xce75aa['as'],'attributes':_0xce75aa[_0xbe82('0x22')]};}):[]};}):[]};}):[]:[]})[_0xbe82('0x11')](function(_0x43a0c2){logger[_0xbe82('0x12')](_0xbe82('0x1c'),_0x4f5241);logger[_0xbe82('0x26')](_0xbe82('0x1c'),_0x4f5241,JSON[_0xbe82('0x16')](_0x43a0c2));_0xc10cb5(_0x43a0c2);})[_0xbe82('0x1b')](function(_0x36266f){logger[_0xbe82('0x17')](_0xbe82('0x1c'),_0x36266f[_0xbe82('0x19')],_0x4f5241);_0x6c9758(_0x3c3e26['error'](0x1f4,_0x36266f[_0xbe82('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 86cf762..9c39d88 100644 --- a/server/api/whatsappAccount/whatsappAccount.socket.js +++ b/server/api/whatsappAccount/whatsappAccount.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd83c=['update','emit','removeListener','register','whatsappAccount:','./whatsappAccount.events','save','remove'];(function(_0x325654,_0x4e6fe1){var _0x994fc7=function(_0x3a0d47){while(--_0x3a0d47){_0x325654['push'](_0x325654['shift']());}};_0x994fc7(++_0x4e6fe1);}(_0xd83c,0xed));var _0xcd83=function(_0x211087,_0x354fdd){_0x211087=_0x211087-0x0;var _0x2a581f=_0xd83c[_0x211087];return _0x2a581f;};'use strict';var WhatsappAccountEvents=require(_0xcd83('0x0'));var events=[_0xcd83('0x1'),_0xcd83('0x2'),_0xcd83('0x3')];function createListener(_0x574a51,_0x20e296){return function(_0x30349c){_0x20e296[_0xcd83('0x4')](_0x574a51,_0x30349c);};}function removeListener(_0x2539c9,_0x67f083){return function(){WhatsappAccountEvents[_0xcd83('0x5')](_0x2539c9,_0x67f083);};}exports[_0xcd83('0x6')]=function(_0x284880){for(var _0x51c94e=0x0,_0x5570f0=events['length'];_0x51c94e<_0x5570f0;_0x51c94e++){var _0x4bed08=events[_0x51c94e];var _0x2dd8f4=createListener(_0xcd83('0x7')+_0x4bed08,_0x284880);WhatsappAccountEvents['on'](_0x4bed08,_0x2dd8f4);}}; \ No newline at end of file +var _0x49ca=['removeListener','register','length','whatsappAccount:','./whatsappAccount.events','remove','update','emit'];(function(_0x38ced4,_0x24263f){var _0x547c07=function(_0x279fc4){while(--_0x279fc4){_0x38ced4['push'](_0x38ced4['shift']());}};_0x547c07(++_0x24263f);}(_0x49ca,0xfc));var _0xa49c=function(_0x2b563e,_0x517972){_0x2b563e=_0x2b563e-0x0;var _0x238108=_0x49ca[_0x2b563e];return _0x238108;};'use strict';var WhatsappAccountEvents=require(_0xa49c('0x0'));var events=['save',_0xa49c('0x1'),_0xa49c('0x2')];function createListener(_0x5318d9,_0x2961aa){return function(_0x1abb5e){_0x2961aa[_0xa49c('0x3')](_0x5318d9,_0x1abb5e);};}function removeListener(_0x1c5871,_0x5226ce){return function(){WhatsappAccountEvents[_0xa49c('0x4')](_0x1c5871,_0x5226ce);};}exports[_0xa49c('0x5')]=function(_0x108878){for(var _0x3be6f4=0x0,_0x4cf666=events[_0xa49c('0x6')];_0x3be6f4<_0x4cf666;_0x3be6f4++){var _0x2836ca=events[_0x3be6f4];var _0x2a940e=createListener(_0xa49c('0x7')+_0x2836ca,_0x108878);WhatsappAccountEvents['on'](_0x2836ca,_0x2a940e);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index 5904725..ed16da5 100644 --- a/server/api/whatsappApplication/index.js +++ b/server/api/whatsappApplication/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd9f8=['destroy','exports','multer','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get','isAuthenticated','index','/:id','post','create','delete'];(function(_0x401c21,_0x2e16d5){var _0x1a320e=function(_0x48065e){while(--_0x48065e){_0x401c21['push'](_0x401c21['shift']());}};_0x1a320e(++_0x2e16d5);}(_0xd9f8,0x92));var _0x8d9f=function(_0x42d193,_0x3607d7){_0x42d193=_0x42d193-0x0;var _0x25dc4e=_0xd9f8[_0x42d193];return _0x25dc4e;};'use strict';var multer=require(_0x8d9f('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x8d9f('0x1'));var express=require(_0x8d9f('0x2'));var router=express[_0x8d9f('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x8d9f('0x4'));var config=require(_0x8d9f('0x5'));var controller=require(_0x8d9f('0x6'));router[_0x8d9f('0x7')]('/',auth[_0x8d9f('0x8')](),controller[_0x8d9f('0x9')]);router[_0x8d9f('0x7')](_0x8d9f('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x8d9f('0xb')]('/',auth[_0x8d9f('0x8')](),controller[_0x8d9f('0xc')]);router['put'](_0x8d9f('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x8d9f('0xd')](_0x8d9f('0xa'),auth['isAuthenticated'](),controller[_0x8d9f('0xe')]);module[_0x8d9f('0xf')]=router; \ No newline at end of file +var _0x4f32=['./whatsappApplication.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x4f32,0x11c));var _0x24f3=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x4f32[_0x167cc1];return _0x10bc4b;};'use strict';var multer=require(_0x24f3('0x0'));var util=require(_0x24f3('0x1'));var path=require(_0x24f3('0x2'));var timeout=require(_0x24f3('0x3'));var express=require(_0x24f3('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x24f3('0x5'));router[_0x24f3('0x6')]('/',auth[_0x24f3('0x7')](),controller[_0x24f3('0x8')]);router['get'](_0x24f3('0x9'),auth['isAuthenticated'](),controller[_0x24f3('0xa')]);router[_0x24f3('0xb')]('/',auth['isAuthenticated'](),controller[_0x24f3('0xc')]);router[_0x24f3('0xd')](_0x24f3('0x9'),auth['isAuthenticated'](),controller[_0x24f3('0xe')]);router['delete'](_0x24f3('0x9'),auth[_0x24f3('0x7')](),controller[_0x24f3('0xf')]);module[_0x24f3('0x10')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index 854bd4f..0c3ffce 100644 --- a/server/api/whatsappApplication/whatsappApplication.attributes.js +++ b/server/api/whatsappApplication/whatsappApplication.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xadd1=['*,*,*,*','sequelize','INTEGER','STRING','noop'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xadd1,0x105));var _0x1add=function(_0x1ed912,_0x59cbf8){_0x1ed912=_0x1ed912-0x0;var _0x1c60ce=_0xadd1[_0x1ed912];return _0x1c60ce;};'use strict';var Sequelize=require(_0x1add('0x0'));module['exports']={'priority':{'type':Sequelize[_0x1add('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x1add('0x2')],'allowNull':![],'defaultValue':_0x1add('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x1add('0x2')]},'interval':{'type':Sequelize[_0x1add('0x2')],'defaultValue':_0x1add('0x4')}}; \ No newline at end of file +var _0x12af=['STRING','noop','exports'];(function(_0x2db12b,_0x30ab1d){var _0x20990b=function(_0x589477){while(--_0x589477){_0x2db12b['push'](_0x2db12b['shift']());}};_0x20990b(++_0x30ab1d);}(_0x12af,0x15e));var _0xf12a=function(_0xfb42e6,_0x5f5d4b){_0xfb42e6=_0xfb42e6-0x0;var _0x27265b=_0x12af[_0xfb42e6];return _0x27265b;};'use strict';var Sequelize=require('sequelize');module[_0xf12a('0x0')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xf12a('0x1')],'allowNull':![],'defaultValue':_0xf12a('0x2')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xf12a('0x1')]},'interval':{'type':Sequelize[_0xf12a('0x1')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 7806f99..66aa1eb 100644 --- a/server/api/whatsappApplication/whatsappApplication.controller.js +++ b/server/api/whatsappApplication/whatsappApplication.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc031=['end','json','count','offset','limit','set','Content-Range','apply','reject','then','destroy','error','name','send','index','map','WhatsappApplication','rawAttributes','fieldName','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','order','where','filters','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','create','body','update','find','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status'];(function(_0x1222a0,_0x243516){var _0x55b3c9=function(_0x3f84d6){while(--_0x3f84d6){_0x1222a0['push'](_0x1222a0['shift']());}};_0x55b3c9(++_0x243516);}(_0xc031,0x114));var _0x1c03=function(_0x4f74a5,_0x1fd979){_0x4f74a5=_0x4f74a5-0x0;var _0x5be8b2=_0xc031[_0x4f74a5];return _0x5be8b2;};'use strict';var pdf=require(_0x1c03('0x0'));var emlformat=require(_0x1c03('0x1'));var rimraf=require(_0x1c03('0x2'));var zipdir=require(_0x1c03('0x3'));var jsonpatch=require(_0x1c03('0x4'));var rp=require(_0x1c03('0x5'));var moment=require(_0x1c03('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x1c03('0x7'));var util=require(_0x1c03('0x8'));var path=require(_0x1c03('0x9'));var sox=require(_0x1c03('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x1c03('0xb'));var squel=require('squel');var crypto=require(_0x1c03('0xc'));var jsforce=require(_0x1c03('0xd'));var deskjs=require(_0x1c03('0xe'));var toCsv=require(_0x1c03('0xf'));var querystring=require(_0x1c03('0x10'));var Papa=require(_0x1c03('0x11'));var Redis=require(_0x1c03('0x12'));var authService=require(_0x1c03('0x13'));var qs=require(_0x1c03('0x14'));var as=require(_0x1c03('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1c03('0x16'))(_0x1c03('0x17'));var utils=require(_0x1c03('0x18'));var config=require(_0x1c03('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x15da89,_0x443ec6){_0x443ec6=_0x443ec6||0xcc;return function(_0x4e6246){if(_0x4e6246){return _0x15da89[_0x1c03('0x1a')](_0x443ec6);}return _0x15da89[_0x1c03('0x1b')](_0x443ec6)[_0x1c03('0x1c')]();};}function respondWithResult(_0x1a1c74,_0x16a8e8){_0x16a8e8=_0x16a8e8||0xc8;return function(_0x431673){if(_0x431673){return _0x1a1c74[_0x1c03('0x1b')](_0x16a8e8)[_0x1c03('0x1d')](_0x431673);}};}function respondWithFilteredResult(_0x19001b,_0x4414d8){return function(_0x5bed30){if(_0x5bed30){var _0xa9e9d7=_0x5bed30[_0x1c03('0x1e')],_0x346ff1=_0x4414d8[_0x1c03('0x1f')],_0x530504=_0x4414d8[_0x1c03('0x1f')]+_0x4414d8[_0x1c03('0x20')],_0x56beb9;if(_0x530504>=_0xa9e9d7){_0x530504=_0xa9e9d7;_0x56beb9=0xc8;}else{_0x56beb9=0xce;}_0x19001b[_0x1c03('0x1b')](_0x56beb9);return _0x19001b[_0x1c03('0x21')](_0x1c03('0x22'),_0x346ff1+'-'+_0x530504+'/'+_0xa9e9d7)[_0x1c03('0x1d')](_0x5bed30);}return null;};}function patchUpdates(_0x29e5c5){return function(_0x485e67){try{jsonpatch[_0x1c03('0x23')](_0x485e67,_0x29e5c5,!![]);}catch(_0x3fc22f){return BPromise[_0x1c03('0x24')](_0x3fc22f);}return _0x485e67['save']();};}function saveUpdates(_0xa17878,_0x40da69){return function(_0xa336fa){if(_0xa336fa){return _0xa336fa['update'](_0xa17878)[_0x1c03('0x25')](function(_0x31a3e1){return _0x31a3e1;});}return null;};}function removeEntity(_0x5caa63,_0x4c4282){return function(_0x22b6ad){if(_0x22b6ad){return _0x22b6ad[_0x1c03('0x26')]()[_0x1c03('0x25')](function(){_0x5caa63['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1a8477,_0x466d86){return function(_0x55ebf){if(!_0x55ebf){_0x1a8477['sendStatus'](0x194);}return _0x55ebf;};}function handleError(_0x400eea,_0x351ea1){_0x351ea1=_0x351ea1||0x1f4;return function(_0x417410){logger[_0x1c03('0x27')](_0x417410['stack']);if(_0x417410['name']){delete _0x417410[_0x1c03('0x28')];}_0x400eea[_0x1c03('0x1b')](_0x351ea1)[_0x1c03('0x29')](_0x417410);};}exports[_0x1c03('0x2a')]=function(_0x15b276,_0x3628bd){var _0x20deee={},_0x3a75fb={},_0x3c3a44={'count':0x0,'rows':[]};var _0x450ce1=_[_0x1c03('0x2b')](db[_0x1c03('0x2c')][_0x1c03('0x2d')],function(_0x3ba6cf){return{'name':_0x3ba6cf[_0x1c03('0x2e')],'type':_0x3ba6cf['type'][_0x1c03('0x2f')]};});_0x3a75fb[_0x1c03('0x30')]=_['map'](_0x450ce1,_0x1c03('0x28'));_0x3a75fb[_0x1c03('0x31')]=_[_0x1c03('0x32')](_0x15b276[_0x1c03('0x31')]);_0x3a75fb['filters']=_[_0x1c03('0x33')](_0x3a75fb[_0x1c03('0x30')],_0x3a75fb[_0x1c03('0x31')]);_0x20deee['attributes']=_['intersection'](_0x3a75fb['model'],qs[_0x1c03('0x34')](_0x15b276['query'][_0x1c03('0x34')]));_0x20deee['attributes']=_0x20deee['attributes']['length']?_0x20deee[_0x1c03('0x35')]:_0x3a75fb['model'];if(!_0x15b276[_0x1c03('0x31')][_0x1c03('0x36')](_0x1c03('0x37'))){_0x20deee[_0x1c03('0x20')]=qs['limit'](_0x15b276[_0x1c03('0x31')][_0x1c03('0x20')]);_0x20deee[_0x1c03('0x1f')]=qs['offset'](_0x15b276['query'][_0x1c03('0x1f')]);}_0x20deee[_0x1c03('0x38')]=qs['sort'](_0x15b276['query']['sort']);_0x20deee[_0x1c03('0x39')]=qs[_0x1c03('0x3a')](_['pick'](_0x15b276['query'],_0x3a75fb[_0x1c03('0x3a')]),_0x450ce1);if(_0x15b276['query'][_0x1c03('0x3b')]){_0x20deee['where']=_[_0x1c03('0x3c')](_0x20deee[_0x1c03('0x39')],{'$or':_[_0x1c03('0x2b')](_0x450ce1,function(_0x416a0b){if(_0x416a0b[_0x1c03('0x3d')]!==_0x1c03('0x3e')){var _0x50c7a9={};_0x50c7a9[_0x416a0b[_0x1c03('0x28')]]={'$like':'%'+_0x15b276[_0x1c03('0x31')][_0x1c03('0x3b')]+'%'};return _0x50c7a9;}})});}_0x20deee=_['merge']({},_0x20deee,_0x15b276[_0x1c03('0x3f')]);var _0x107869={'where':_0x20deee[_0x1c03('0x39')]};return db[_0x1c03('0x2c')][_0x1c03('0x1e')](_0x107869)['then'](function(_0x4d7b19){_0x3c3a44[_0x1c03('0x1e')]=_0x4d7b19;if(_0x15b276[_0x1c03('0x31')][_0x1c03('0x40')]){_0x20deee[_0x1c03('0x41')]=[{'all':!![]}];}return db[_0x1c03('0x2c')][_0x1c03('0x42')](_0x20deee);})[_0x1c03('0x25')](function(_0xc412c4){_0x3c3a44[_0x1c03('0x43')]=_0xc412c4;return _0x3c3a44;})[_0x1c03('0x25')](respondWithFilteredResult(_0x3628bd,_0x20deee))[_0x1c03('0x44')](handleError(_0x3628bd,null));};exports[_0x1c03('0x45')]=function(_0x143346,_0x407e01){var _0x96d9d1={'raw':!![],'where':{'id':_0x143346[_0x1c03('0x46')]['id']}},_0x45ee35={};_0x45ee35[_0x1c03('0x30')]=_[_0x1c03('0x32')](db['WhatsappApplication']['rawAttributes']);_0x45ee35[_0x1c03('0x31')]=_[_0x1c03('0x32')](_0x143346[_0x1c03('0x31')]);_0x45ee35[_0x1c03('0x3a')]=_[_0x1c03('0x33')](_0x45ee35[_0x1c03('0x30')],_0x45ee35[_0x1c03('0x31')]);_0x96d9d1[_0x1c03('0x35')]=_[_0x1c03('0x33')](_0x45ee35[_0x1c03('0x30')],qs['fields'](_0x143346[_0x1c03('0x31')][_0x1c03('0x34')]));_0x96d9d1[_0x1c03('0x35')]=_0x96d9d1[_0x1c03('0x35')][_0x1c03('0x47')]?_0x96d9d1[_0x1c03('0x35')]:_0x45ee35[_0x1c03('0x30')];if(_0x143346[_0x1c03('0x31')][_0x1c03('0x40')]){_0x96d9d1[_0x1c03('0x41')]=[{'all':!![]}];}_0x96d9d1=_[_0x1c03('0x3c')]({},_0x96d9d1,_0x143346['options']);return db[_0x1c03('0x2c')]['find'](_0x96d9d1)['then'](handleEntityNotFound(_0x407e01,null))[_0x1c03('0x25')](respondWithResult(_0x407e01,null))['catch'](handleError(_0x407e01,null));};exports['create']=function(_0x33d278,_0x5759cc){return db['WhatsappApplication'][_0x1c03('0x48')](_0x33d278[_0x1c03('0x49')],{})[_0x1c03('0x25')](respondWithResult(_0x5759cc,0xc9))[_0x1c03('0x44')](handleError(_0x5759cc,null));};exports[_0x1c03('0x4a')]=function(_0x1d4e49,_0x2a3d0a){if(_0x1d4e49[_0x1c03('0x49')]['id']){delete _0x1d4e49[_0x1c03('0x49')]['id'];}return db[_0x1c03('0x2c')][_0x1c03('0x4b')]({'where':{'id':_0x1d4e49[_0x1c03('0x46')]['id']}})[_0x1c03('0x25')](handleEntityNotFound(_0x2a3d0a,null))[_0x1c03('0x25')](saveUpdates(_0x1d4e49['body'],null))[_0x1c03('0x25')](respondWithResult(_0x2a3d0a,null))[_0x1c03('0x44')](handleError(_0x2a3d0a,null));};exports[_0x1c03('0x26')]=function(_0x1bcb18,_0x540d2f){return db[_0x1c03('0x2c')]['find']({'where':{'id':_0x1bcb18['params']['id']}})[_0x1c03('0x25')](handleEntityNotFound(_0x540d2f,null))[_0x1c03('0x25')](removeEntity(_0x540d2f,null))[_0x1c03('0x44')](handleError(_0x540d2f,null));}; \ No newline at end of file +var _0x98e7=['offset','set','Content-Range','json','reject','save','update','then','destroy','error','stack','name','index','map','WhatsappApplication','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','html-pdf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','count'];(function(_0x22ec4b,_0x1cea69){var _0x5603a7=function(_0x5d4e91){while(--_0x5d4e91){_0x22ec4b['push'](_0x22ec4b['shift']());}};_0x5603a7(++_0x1cea69);}(_0x98e7,0x1e5));var _0x798e=function(_0x179805,_0x17d188){_0x179805=_0x179805-0x0;var _0x5654fa=_0x98e7[_0x179805];return _0x5654fa;};'use strict';var pdf=require(_0x798e('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x798e('0x1'));var rp=require(_0x798e('0x2'));var moment=require(_0x798e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x798e('0x4'));var util=require(_0x798e('0x5'));var path=require(_0x798e('0x6'));var sox=require(_0x798e('0x7'));var csv=require(_0x798e('0x8'));var ejs=require(_0x798e('0x9'));var fs=require('fs');var _=require(_0x798e('0xa'));var squel=require(_0x798e('0xb'));var crypto=require('crypto');var jsforce=require(_0x798e('0xc'));var deskjs=require(_0x798e('0xd'));var toCsv=require('to-csv');var querystring=require(_0x798e('0xe'));var Papa=require(_0x798e('0xf'));var Redis=require('ioredis');var authService=require(_0x798e('0x10'));var qs=require(_0x798e('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x798e('0x12'));var logger=require(_0x798e('0x13'))('api');var utils=require(_0x798e('0x14'));var config=require(_0x798e('0x15'));var db=require(_0x798e('0x16'))['db'];function respondWithStatusCode(_0x5239de,_0x376926){_0x376926=_0x376926||0xcc;return function(_0x115a9a){if(_0x115a9a){return _0x5239de[_0x798e('0x17')](_0x376926);}return _0x5239de[_0x798e('0x18')](_0x376926)['end']();};}function respondWithResult(_0x129c86,_0x12efc7){_0x12efc7=_0x12efc7||0xc8;return function(_0x487b17){if(_0x487b17){return _0x129c86[_0x798e('0x18')](_0x12efc7)['json'](_0x487b17);}};}function respondWithFilteredResult(_0x256f97,_0x13b088){return function(_0x91edd3){if(_0x91edd3){var _0x344a67=_0x91edd3[_0x798e('0x19')],_0x47ed09=_0x13b088[_0x798e('0x1a')],_0x58b471=_0x13b088[_0x798e('0x1a')]+_0x13b088['limit'],_0x554371;if(_0x58b471>=_0x344a67){_0x58b471=_0x344a67;_0x554371=0xc8;}else{_0x554371=0xce;}_0x256f97[_0x798e('0x18')](_0x554371);return _0x256f97[_0x798e('0x1b')](_0x798e('0x1c'),_0x47ed09+'-'+_0x58b471+'/'+_0x344a67)[_0x798e('0x1d')](_0x91edd3);}return null;};}function patchUpdates(_0x9f0982){return function(_0x53b1e3){try{jsonpatch['apply'](_0x53b1e3,_0x9f0982,!![]);}catch(_0x220a54){return BPromise[_0x798e('0x1e')](_0x220a54);}return _0x53b1e3[_0x798e('0x1f')]();};}function saveUpdates(_0x4ed711,_0x48aa5b){return function(_0x53a4b9){if(_0x53a4b9){return _0x53a4b9[_0x798e('0x20')](_0x4ed711)[_0x798e('0x21')](function(_0x194f2d){return _0x194f2d;});}return null;};}function removeEntity(_0x33b0f7,_0x4504ea){return function(_0x40f04c){if(_0x40f04c){return _0x40f04c[_0x798e('0x22')]()[_0x798e('0x21')](function(){_0x33b0f7['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5ca9f9,_0x484291){return function(_0x2ea56c){if(!_0x2ea56c){_0x5ca9f9[_0x798e('0x17')](0x194);}return _0x2ea56c;};}function handleError(_0x5ccfc4,_0x2a78e1){_0x2a78e1=_0x2a78e1||0x1f4;return function(_0x394364){logger[_0x798e('0x23')](_0x394364[_0x798e('0x24')]);if(_0x394364['name']){delete _0x394364[_0x798e('0x25')];}_0x5ccfc4[_0x798e('0x18')](_0x2a78e1)['send'](_0x394364);};}exports[_0x798e('0x26')]=function(_0x2c491c,_0x1b5b99){var _0x325892={},_0x5cbaef={},_0x511791={'count':0x0,'rows':[]};var _0x1d3a8f=_[_0x798e('0x27')](db[_0x798e('0x28')][_0x798e('0x29')],function(_0x5b7df9){return{'name':_0x5b7df9['fieldName'],'type':_0x5b7df9[_0x798e('0x2a')][_0x798e('0x2b')]};});_0x5cbaef[_0x798e('0x2c')]=_[_0x798e('0x27')](_0x1d3a8f,_0x798e('0x25'));_0x5cbaef[_0x798e('0x2d')]=_[_0x798e('0x2e')](_0x2c491c[_0x798e('0x2d')]);_0x5cbaef[_0x798e('0x2f')]=_[_0x798e('0x30')](_0x5cbaef['model'],_0x5cbaef[_0x798e('0x2d')]);_0x325892[_0x798e('0x31')]=_[_0x798e('0x30')](_0x5cbaef[_0x798e('0x2c')],qs[_0x798e('0x32')](_0x2c491c[_0x798e('0x2d')][_0x798e('0x32')]));_0x325892[_0x798e('0x31')]=_0x325892[_0x798e('0x31')][_0x798e('0x33')]?_0x325892[_0x798e('0x31')]:_0x5cbaef['model'];if(!_0x2c491c[_0x798e('0x2d')][_0x798e('0x34')](_0x798e('0x35'))){_0x325892['limit']=qs[_0x798e('0x36')](_0x2c491c[_0x798e('0x2d')][_0x798e('0x36')]);_0x325892[_0x798e('0x1a')]=qs[_0x798e('0x1a')](_0x2c491c[_0x798e('0x2d')]['offset']);}_0x325892[_0x798e('0x37')]=qs[_0x798e('0x38')](_0x2c491c['query'][_0x798e('0x38')]);_0x325892[_0x798e('0x39')]=qs[_0x798e('0x2f')](_[_0x798e('0x3a')](_0x2c491c[_0x798e('0x2d')],_0x5cbaef[_0x798e('0x2f')]),_0x1d3a8f);if(_0x2c491c[_0x798e('0x2d')][_0x798e('0x3b')]){_0x325892[_0x798e('0x39')]=_[_0x798e('0x3c')](_0x325892[_0x798e('0x39')],{'$or':_[_0x798e('0x27')](_0x1d3a8f,function(_0x3c4fe3){if(_0x3c4fe3[_0x798e('0x2a')]!==_0x798e('0x3d')){var _0x4f4586={};_0x4f4586[_0x3c4fe3['name']]={'$like':'%'+_0x2c491c[_0x798e('0x2d')]['filter']+'%'};return _0x4f4586;}})});}_0x325892=_['merge']({},_0x325892,_0x2c491c[_0x798e('0x3e')]);var _0x25d586={'where':_0x325892['where']};return db[_0x798e('0x28')][_0x798e('0x19')](_0x25d586)[_0x798e('0x21')](function(_0x3b17fb){_0x511791[_0x798e('0x19')]=_0x3b17fb;if(_0x2c491c['query'][_0x798e('0x3f')]){_0x325892[_0x798e('0x40')]=[{'all':!![]}];}return db['WhatsappApplication'][_0x798e('0x41')](_0x325892);})['then'](function(_0x476ee1){_0x511791[_0x798e('0x42')]=_0x476ee1;return _0x511791;})[_0x798e('0x21')](respondWithFilteredResult(_0x1b5b99,_0x325892))['catch'](handleError(_0x1b5b99,null));};exports[_0x798e('0x43')]=function(_0x4af8d4,_0x5f2a50){var _0x10da69={'raw':!![],'where':{'id':_0x4af8d4[_0x798e('0x44')]['id']}},_0x824f80={};_0x824f80[_0x798e('0x2c')]=_['keys'](db[_0x798e('0x28')][_0x798e('0x29')]);_0x824f80[_0x798e('0x2d')]=_[_0x798e('0x2e')](_0x4af8d4['query']);_0x824f80[_0x798e('0x2f')]=_['intersection'](_0x824f80[_0x798e('0x2c')],_0x824f80['query']);_0x10da69[_0x798e('0x31')]=_['intersection'](_0x824f80[_0x798e('0x2c')],qs[_0x798e('0x32')](_0x4af8d4['query'][_0x798e('0x32')]));_0x10da69[_0x798e('0x31')]=_0x10da69[_0x798e('0x31')][_0x798e('0x33')]?_0x10da69['attributes']:_0x824f80['model'];if(_0x4af8d4[_0x798e('0x2d')]['includeAll']){_0x10da69[_0x798e('0x40')]=[{'all':!![]}];}_0x10da69=_['merge']({},_0x10da69,_0x4af8d4['options']);return db['WhatsappApplication'][_0x798e('0x45')](_0x10da69)['then'](handleEntityNotFound(_0x5f2a50,null))[_0x798e('0x21')](respondWithResult(_0x5f2a50,null))[_0x798e('0x46')](handleError(_0x5f2a50,null));};exports[_0x798e('0x47')]=function(_0x355a6c,_0xa86947){return db[_0x798e('0x28')][_0x798e('0x47')](_0x355a6c[_0x798e('0x48')],{})[_0x798e('0x21')](respondWithResult(_0xa86947,0xc9))[_0x798e('0x46')](handleError(_0xa86947,null));};exports[_0x798e('0x20')]=function(_0xa9cda0,_0x5d552c){if(_0xa9cda0['body']['id']){delete _0xa9cda0[_0x798e('0x48')]['id'];}return db['WhatsappApplication'][_0x798e('0x45')]({'where':{'id':_0xa9cda0[_0x798e('0x44')]['id']}})['then'](handleEntityNotFound(_0x5d552c,null))[_0x798e('0x21')](saveUpdates(_0xa9cda0[_0x798e('0x48')],null))['then'](respondWithResult(_0x5d552c,null))[_0x798e('0x46')](handleError(_0x5d552c,null));};exports[_0x798e('0x22')]=function(_0x2e6917,_0x4d0080){return db[_0x798e('0x28')]['find']({'where':{'id':_0x2e6917[_0x798e('0x44')]['id']}})[_0x798e('0x21')](handleEntityNotFound(_0x4d0080,null))[_0x798e('0x21')](removeEntity(_0x4d0080,null))['catch'](handleError(_0x4d0080,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index fb09880..ec51528 100644 --- a/server/api/whatsappApplication/whatsappApplication.model.js +++ b/server/api/whatsappApplication/whatsappApplication.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4184=['WhatsappApplication','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','rimraf','../../config/environment','./whatsappApplication.attributes','define'];(function(_0xef8146,_0x459c34){var _0x5a6cb0=function(_0x2f84ec){while(--_0x2f84ec){_0xef8146['push'](_0xef8146['shift']());}};_0x5a6cb0(++_0x459c34);}(_0x4184,0x1e7));var _0x4418=function(_0x1ec022,_0x2cf53e){_0x1ec022=_0x1ec022-0x0;var _0x12bd2a=_0x4184[_0x1ec022];return _0x12bd2a;};'use strict';var _=require(_0x4418('0x0'));var util=require('util');var logger=require(_0x4418('0x1'))(_0x4418('0x2'));var moment=require(_0x4418('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4418('0x4'));var config=require(_0x4418('0x5'));var attributes=require(_0x4418('0x6'));module['exports']=function(_0x458304,_0x41526e){return _0x458304[_0x4418('0x7')](_0x4418('0x8'),attributes,{'tableName':'whatsapp_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x4418('0x9'),'collate':_0x4418('0xa')});}; \ No newline at end of file +var _0x93ff=['request-promise','path','rimraf','../../config/environment','./whatsappApplication.attributes','exports','WhatsappApplication','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird'];(function(_0x4fd690,_0x3e977f){var _0x166d05=function(_0x1a5abe){while(--_0x1a5abe){_0x4fd690['push'](_0x4fd690['shift']());}};_0x166d05(++_0x3e977f);}(_0x93ff,0xb1));var _0xf93f=function(_0x1b701a,_0x126512){_0x1b701a=_0x1b701a-0x0;var _0xb92894=_0x93ff[_0x1b701a];return _0xb92894;};'use strict';var _=require(_0xf93f('0x0'));var util=require(_0xf93f('0x1'));var logger=require('../../config/logger')(_0xf93f('0x2'));var moment=require(_0xf93f('0x3'));var BPromise=require(_0xf93f('0x4'));var rp=require(_0xf93f('0x5'));var fs=require('fs');var path=require(_0xf93f('0x6'));var rimraf=require(_0xf93f('0x7'));var config=require(_0xf93f('0x8'));var attributes=require(_0xf93f('0x9'));module[_0xf93f('0xa')]=function(_0x2ed793,_0x7f0e42){return _0x2ed793['define'](_0xf93f('0xb'),attributes,{'tableName':'whatsapp_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xf93f('0xc')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index b60a7f5..6b3839d 100644 --- a/server/api/whatsappApplication/whatsappApplication.rpc.js +++ b/server/api/whatsappApplication/whatsappApplication.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5ff9=['debug','stringify','error','code','message','info','result','catch','lodash','util','bluebird','randomstring','../../config/utils','../../config/environment','jayson/promise','http','then','WhatsappApplication,\x20%s,\x20%s','request\x20sent'];(function(_0x1c7f0d,_0x27ce58){var _0x2b1781=function(_0x321a5a){while(--_0x321a5a){_0x1c7f0d['push'](_0x1c7f0d['shift']());}};_0x2b1781(++_0x27ce58);}(_0x5ff9,0xa0));var _0x95ff=function(_0x3ed22c,_0x222ecb){_0x3ed22c=_0x3ed22c-0x0;var _0x456c3f=_0x5ff9[_0x3ed22c];return _0x456c3f;};'use strict';var _=require(_0x95ff('0x0'));var util=require(_0x95ff('0x1'));var moment=require('moment');var BPromise=require(_0x95ff('0x2'));var rs=require(_0x95ff('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x95ff('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x95ff('0x5'));var jayson=require(_0x95ff('0x6'));var client=jayson['client'][_0x95ff('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4fd45b,_0x34ace2,_0x384657){return new BPromise(function(_0x491610,_0x2fb3f5){return client['request'](_0x4fd45b,_0x384657)[_0x95ff('0x8')](function(_0x300166){logger['info'](_0x95ff('0x9'),_0x34ace2,_0x95ff('0xa'));logger[_0x95ff('0xb')]('WhatsappApplication,\x20%s,\x20%s,\x20%s',_0x34ace2,_0x95ff('0xa'),JSON[_0x95ff('0xc')](_0x300166));if(_0x300166[_0x95ff('0xd')]){if(_0x300166[_0x95ff('0xd')][_0x95ff('0xe')]===0x1f4){logger[_0x95ff('0xd')]('WhatsappApplication,\x20%s,\x20%s',_0x34ace2,_0x300166['error'][_0x95ff('0xf')]);return _0x2fb3f5(_0x300166[_0x95ff('0xd')][_0x95ff('0xf')]);}logger[_0x95ff('0xd')]('WhatsappApplication,\x20%s,\x20%s',_0x34ace2,_0x300166[_0x95ff('0xd')][_0x95ff('0xf')]);return _0x491610(_0x300166['error'][_0x95ff('0xf')]);}else{logger[_0x95ff('0x10')]('WhatsappApplication,\x20%s,\x20%s',_0x34ace2,'request\x20sent');_0x491610(_0x300166[_0x95ff('0x11')][_0x95ff('0xf')]);}})[_0x95ff('0x12')](function(_0x5d5350){logger[_0x95ff('0xd')]('WhatsappApplication,\x20%s,\x20%s',_0x34ace2,_0x5d5350);_0x2fb3f5(_0x5d5350);});});} \ No newline at end of file +var _0xd6d2=['../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappApplication,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xd6d2,0xcb));var _0x2d6d=function(_0x41f2a6,_0x79a9b6){_0x41f2a6=_0x41f2a6-0x0;var _0x498aaa=_0xd6d2[_0x41f2a6];return _0x498aaa;};'use strict';var _=require(_0x2d6d('0x0'));var util=require(_0x2d6d('0x1'));var moment=require('moment');var BPromise=require(_0x2d6d('0x2'));var rs=require(_0x2d6d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2d6d('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2d6d('0x5'))(_0x2d6d('0x6'));var config=require(_0x2d6d('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x2d6d('0x8')][_0x2d6d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xf59b20,_0x45b7b9,_0x4002b7){return new BPromise(function(_0x42d802,_0x1cab9b){return client[_0x2d6d('0xa')](_0xf59b20,_0x4002b7)[_0x2d6d('0xb')](function(_0x261959){logger[_0x2d6d('0xc')]('WhatsappApplication,\x20%s,\x20%s',_0x45b7b9,_0x2d6d('0xd'));logger[_0x2d6d('0xe')](_0x2d6d('0xf'),_0x45b7b9,_0x2d6d('0xd'),JSON[_0x2d6d('0x10')](_0x261959));if(_0x261959['error']){if(_0x261959[_0x2d6d('0x11')][_0x2d6d('0x12')]===0x1f4){logger[_0x2d6d('0x11')](_0x2d6d('0x13'),_0x45b7b9,_0x261959[_0x2d6d('0x11')]['message']);return _0x1cab9b(_0x261959[_0x2d6d('0x11')][_0x2d6d('0x14')]);}logger[_0x2d6d('0x11')](_0x2d6d('0x13'),_0x45b7b9,_0x261959['error'][_0x2d6d('0x14')]);return _0x42d802(_0x261959[_0x2d6d('0x11')]['message']);}else{logger['info'](_0x2d6d('0x13'),_0x45b7b9,_0x2d6d('0xd'));_0x42d802(_0x261959[_0x2d6d('0x15')]['message']);}})[_0x2d6d('0x16')](function(_0x5b8d81){logger['error']('WhatsappApplication,\x20%s,\x20%s',_0x45b7b9,_0x5b8d81);_0x1cab9b(_0x5b8d81);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index e2c0a24..2b9c336 100644 --- a/server/api/whatsappInteraction/index.js +++ b/server/api/whatsappInteraction/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcc56=['./whatsappInteraction.controller','get','index','isAuthenticated','describe','show','/:id/messages','/:id/download','post','create','addMessage','/:id/tags','tracked','whatsapp','whatsappinteraction:addtags','addTags','put','/:id','whatsappinteraction:update','update','delete','whatsappinteraction:destroy','destroy','removeTags','exports','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x4e5752,_0x6ca923){var _0x82582b=function(_0x4cf7c3){while(--_0x4cf7c3){_0x4e5752['push'](_0x4e5752['shift']());}};_0x82582b(++_0x6ca923);}(_0xcc56,0x76));var _0x6cc5=function(_0x175401,_0x281048){_0x175401=_0x175401-0x0;var _0x4d7689=_0xcc56[_0x175401];return _0x4d7689;};'use strict';var multer=require('multer');var util=require(_0x6cc5('0x0'));var path=require('path');var timeout=require(_0x6cc5('0x1'));var express=require(_0x6cc5('0x2'));var router=express['Router']();var auth=require(_0x6cc5('0x3'));var interaction=require(_0x6cc5('0x4'));var config=require(_0x6cc5('0x5'));var controller=require(_0x6cc5('0x6'));router[_0x6cc5('0x7')]('/',auth['isAuthenticated'](),controller[_0x6cc5('0x8')]);router[_0x6cc5('0x7')]('/describe',auth[_0x6cc5('0x9')](),controller[_0x6cc5('0xa')]);router[_0x6cc5('0x7')]('/:id',auth[_0x6cc5('0x9')](),controller[_0x6cc5('0xb')]);router[_0x6cc5('0x7')](_0x6cc5('0xc'),auth[_0x6cc5('0x9')](),controller['getMessages']);router[_0x6cc5('0x7')](_0x6cc5('0xd'),auth[_0x6cc5('0x9')](),controller['download']);router[_0x6cc5('0xe')]('/',auth[_0x6cc5('0x9')](),controller[_0x6cc5('0xf')]);router[_0x6cc5('0xe')]('/:id/messages',auth[_0x6cc5('0x9')](),controller[_0x6cc5('0x10')]);router['post'](_0x6cc5('0x11'),auth[_0x6cc5('0x9')](),interaction[_0x6cc5('0x12')](_0x6cc5('0x13'),_0x6cc5('0x14')),controller[_0x6cc5('0x15')]);router[_0x6cc5('0x16')](_0x6cc5('0x17'),auth[_0x6cc5('0x9')](),interaction[_0x6cc5('0x12')](_0x6cc5('0x13'),_0x6cc5('0x18')),controller[_0x6cc5('0x19')]);router[_0x6cc5('0x1a')](_0x6cc5('0x17'),auth[_0x6cc5('0x9')](),interaction['tracked'](_0x6cc5('0x13'),_0x6cc5('0x1b')),controller[_0x6cc5('0x1c')]);router[_0x6cc5('0x1a')]('/:id/tags',auth[_0x6cc5('0x9')](),controller[_0x6cc5('0x1d')]);module[_0x6cc5('0x1e')]=router; \ No newline at end of file +var _0x9b61=['show','/:id/messages','/:id/download','download','post','addMessage','/:id/tags','tracked','whatsapp','whatsappinteraction:addtags','addTags','put','update','delete','whatsappinteraction:destroy','destroy','removeTags','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get','index','isAuthenticated','describe','/:id'];(function(_0x45d55e,_0x2fede3){var _0x29812a=function(_0x3c6830){while(--_0x3c6830){_0x45d55e['push'](_0x45d55e['shift']());}};_0x29812a(++_0x2fede3);}(_0x9b61,0x6b));var _0x19b6=function(_0x56b51e,_0x5ea83e){_0x56b51e=_0x56b51e-0x0;var _0x1785d6=_0x9b61[_0x56b51e];return _0x1785d6;};'use strict';var multer=require(_0x19b6('0x0'));var util=require(_0x19b6('0x1'));var path=require(_0x19b6('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x19b6('0x3')]();var auth=require(_0x19b6('0x4'));var interaction=require(_0x19b6('0x5'));var config=require(_0x19b6('0x6'));var controller=require(_0x19b6('0x7'));router[_0x19b6('0x8')]('/',auth['isAuthenticated'](),controller[_0x19b6('0x9')]);router[_0x19b6('0x8')]('/describe',auth[_0x19b6('0xa')](),controller[_0x19b6('0xb')]);router[_0x19b6('0x8')](_0x19b6('0xc'),auth[_0x19b6('0xa')](),controller[_0x19b6('0xd')]);router['get'](_0x19b6('0xe'),auth[_0x19b6('0xa')](),controller['getMessages']);router['get'](_0x19b6('0xf'),auth[_0x19b6('0xa')](),controller[_0x19b6('0x10')]);router['post']('/',auth[_0x19b6('0xa')](),controller['create']);router[_0x19b6('0x11')](_0x19b6('0xe'),auth['isAuthenticated'](),controller[_0x19b6('0x12')]);router['post'](_0x19b6('0x13'),auth['isAuthenticated'](),interaction[_0x19b6('0x14')](_0x19b6('0x15'),_0x19b6('0x16')),controller[_0x19b6('0x17')]);router[_0x19b6('0x18')](_0x19b6('0xc'),auth['isAuthenticated'](),interaction[_0x19b6('0x14')](_0x19b6('0x15'),'whatsappinteraction:update'),controller[_0x19b6('0x19')]);router[_0x19b6('0x1a')](_0x19b6('0xc'),auth[_0x19b6('0xa')](),interaction[_0x19b6('0x14')](_0x19b6('0x15'),_0x19b6('0x1b')),controller[_0x19b6('0x1c')]);router[_0x19b6('0x1a')](_0x19b6('0x13'),auth[_0x19b6('0xa')](),controller[_0x19b6('0x1d')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index 6293644..e3ac84d 100644 --- a/server/api/whatsappInteraction/whatsappInteraction.attributes.js +++ b/server/api/whatsappInteraction/whatsappInteraction.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x85a2=['ENUM','sequelize','moment','exports','BOOLEAN','DATE','STRING','out'];(function(_0x5da479,_0x26d96e){var _0x2e6b71=function(_0x175676){while(--_0x175676){_0x5da479['push'](_0x5da479['shift']());}};_0x2e6b71(++_0x26d96e);}(_0x85a2,0x139));var _0x285a=function(_0x129caf,_0x59ac07){_0x129caf=_0x129caf-0x0;var _0x3a5106=_0x85a2[_0x129caf];return _0x3a5106;};'use strict';var Sequelize=require(_0x285a('0x0'));var moment=require(_0x285a('0x1'));module[_0x285a('0x2')]={'closed':{'type':Sequelize[_0x285a('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x285a('0x4')]},'disposition':{'type':Sequelize[_0x285a('0x5')]},'note':{'type':Sequelize[_0x285a('0x5')]},'phone':{'type':Sequelize[_0x285a('0x5')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x285a('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x285a('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x285a('0x7')]('in','out'),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x237a=['sequelize','BOOLEAN','DATE','STRING','ENUM','out'];(function(_0x29f7f8,_0x38641a){var _0x53fc04=function(_0x2c43c6){while(--_0x2c43c6){_0x29f7f8['push'](_0x29f7f8['shift']());}};_0x53fc04(++_0x38641a);}(_0x237a,0xae));var _0xa237=function(_0x524de3,_0x135c69){_0x524de3=_0x524de3-0x0;var _0x529b32=_0x237a[_0x524de3];return _0x529b32;};'use strict';var Sequelize=require(_0xa237('0x0'));var moment=require('moment');module['exports']={'closed':{'type':Sequelize[_0xa237('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xa237('0x2')]},'disposition':{'type':Sequelize[_0xa237('0x3')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0xa237('0x3')]},'read1stAt':{'type':Sequelize[_0xa237('0x2')]},'firstMsgDirection':{'type':Sequelize[_0xa237('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xa237('0x2')]},'lastMsgDirection':{'type':Sequelize[_0xa237('0x4')]('in',_0xa237('0x5')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index 9b878bb..7144c35 100644 --- a/server/api/whatsappInteraction/whatsappInteraction.controller.js +++ b/server/api/whatsappInteraction/whatsappInteraction.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc4aa=['status','end','json','count','offset','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','map','fullname','TagIds','Tags','split','push','catch','WhatsappInteraction','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','limit','sort','where','pick','select','field','color','from','u.id','u.fullname','ui.WhatsappInteractionId','user_has_whatsapp_interactions','left_join','users','u.id\x20=\x20ui.UserId','whatsapp_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','a.id\x20=\x20i.WhatsappAccountId','whatsapp_messages','me.WhatsappInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','parseSearch','search','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','Contact','operator','length','getFullTextValue','ContactId','buildExpression','type','start','Tag','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','text','body','some','compact','isEmpty','WhatsappAccountId','i.WhatsappAccountId\x20IN\x20?','concat','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','filter','replace','\x27\x27\x27\x27','i.phone\x20LIKE\x20?','group','QueryTypes','SELECT','clone','order','journey','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','sequelize','toString','keyBy','fields','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.WhatsappInteractionId\x20IN\x20?','groupBy','WhatsappInteractionId','all','rows','show','params','include','merge','create','describe','addMessage','WhatsappMessage','ids','getMessages','findOne','YYYY-MM-DD\x20HH:mm:ss','options','findAll','setTags','omit','emit','whatsappInteractionTags:save','removeTags','unix','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','CmContact','firstName','lastName','Attachment','createdAt','secret','WhatsappAccount','Account','get','mkdirSync','40px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','30px','format','%s\x20#%d','Whatsapp','YYYY-MM-DD','Owner','N.A.','closed','closedAt','disposition','basename','existsSync','createReadStream','pipe','createWriteStream','direction','out','System','downloadInteraction.html','transcript-','download','log','err','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','sendStatus'];(function(_0x446648,_0x3d0a08){var _0x4da5d6=function(_0x5db0fe){while(--_0x5db0fe){_0x446648['push'](_0x446648['shift']());}};_0x4da5d6(++_0x3d0a08);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0xc4aa[_0x5d6456];return _0x4d66c1;};'use strict';var pdf=require(_0xac4a('0x0'));var emlformat=require(_0xac4a('0x1'));var rimraf=require(_0xac4a('0x2'));var zipdir=require(_0xac4a('0x3'));var jsonpatch=require(_0xac4a('0x4'));var rp=require(_0xac4a('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xac4a('0x6'));var path=require(_0xac4a('0x7'));var sox=require(_0xac4a('0x8'));var csv=require(_0xac4a('0x9'));var ejs=require(_0xac4a('0xa'));var fs=require('fs');var _=require(_0xac4a('0xb'));var squel=require(_0xac4a('0xc'));var crypto=require(_0xac4a('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xac4a('0x9'));var querystring=require(_0xac4a('0xe'));var Papa=require(_0xac4a('0xf'));var Redis=require('ioredis');var authService=require(_0xac4a('0x10'));var qs=require(_0xac4a('0x11'));var as=require(_0xac4a('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xac4a('0x13'))('api');var utils=require(_0xac4a('0x14'));var config=require('../../config/environment');var db=require(_0xac4a('0x15'))['db'];config[_0xac4a('0x16')]=_[_0xac4a('0x17')](config['redis'],{'host':_0xac4a('0x18'),'port':0x18eb});var socket=require(_0xac4a('0x19'))(new Redis(config[_0xac4a('0x16')]));require(_0xac4a('0x1a'))[_0xac4a('0x1b')](socket);function respondWithStatusCode(_0x3b71c0,_0x34bc01){_0x34bc01=_0x34bc01||0xcc;return function(_0x33c287){if(_0x33c287){return _0x3b71c0[_0xac4a('0x1c')](_0x34bc01);}return _0x3b71c0[_0xac4a('0x1d')](_0x34bc01)[_0xac4a('0x1e')]();};}function respondWithResult(_0x26dbb8,_0x4a2119){_0x4a2119=_0x4a2119||0xc8;return function(_0x402fff){if(_0x402fff){return _0x26dbb8[_0xac4a('0x1d')](_0x4a2119)[_0xac4a('0x1f')](_0x402fff);}};}function respondWithFilteredResult(_0x144553,_0x3e88e3){return function(_0x387a54){if(_0x387a54){var _0x28e304=_0x387a54[_0xac4a('0x20')],_0x44ec59=_0x3e88e3[_0xac4a('0x21')],_0x546c5d=_0x3e88e3[_0xac4a('0x21')]+_0x3e88e3['limit'],_0x5ac21e;if(_0x546c5d>=_0x28e304){_0x546c5d=_0x28e304;_0x5ac21e=0xc8;}else{_0x5ac21e=0xce;}_0x144553[_0xac4a('0x1d')](_0x5ac21e);return _0x144553[_0xac4a('0x22')](_0xac4a('0x23'),_0x44ec59+'-'+_0x546c5d+'/'+_0x28e304)[_0xac4a('0x1f')](_0x387a54);}return null;};}function patchUpdates(_0x123694){return function(_0x3e829c){try{jsonpatch[_0xac4a('0x24')](_0x3e829c,_0x123694,!![]);}catch(_0x3ca790){return BPromise['reject'](_0x3ca790);}return _0x3e829c[_0xac4a('0x25')]();};}function saveUpdates(_0x3204ad,_0x599787){return function(_0x3d7ce0){if(_0x3d7ce0){return _0x3d7ce0[_0xac4a('0x26')](_0x3204ad)[_0xac4a('0x27')](function(_0x947d8e){return _0x947d8e;});}return null;};}function removeEntity(_0x4d2d6c,_0x1b7998){return function(_0x2503d8){if(_0x2503d8){return _0x2503d8[_0xac4a('0x28')]()[_0xac4a('0x27')](function(){_0x4d2d6c[_0xac4a('0x1d')](0xcc)[_0xac4a('0x1e')]();});}};}function handleEntityNotFound(_0x222507,_0x36054a){return function(_0x3e2c69){if(!_0x3e2c69){_0x222507[_0xac4a('0x1c')](0x194);}return _0x3e2c69;};}function handleError(_0x1d0539,_0x215a31){_0x215a31=_0x215a31||0x1f4;return function(_0x14832b){logger[_0xac4a('0x29')](_0x14832b[_0xac4a('0x2a')]);if(_0x14832b[_0xac4a('0x2b')]){delete _0x14832b['name'];}_0x1d0539[_0xac4a('0x1d')](_0x215a31)[_0xac4a('0x2c')](_0x14832b);};}function getInteractionUsers(_0x42a33c,_0x2772fe){return new BPromise(function(_0x116700,_0x4a5a9e){try{if(_0x2772fe[_0x42a33c['id']]){_0x42a33c['Users']=_[_0xac4a('0x2d')](_0x2772fe[_0x42a33c['id']],function(_0x7a948b){return{'id':_0x7a948b['id'],'fullname':_0x7a948b[_0xac4a('0x2e')]};});}}catch(_0x546b65){_0x4a5a9e(_0x546b65);}_0x116700(_0x42a33c);});}function getInteractionTags(_0x4bda1f,_0x355755){return new BPromise(function(_0x2896bc,_0x228629){try{if(_0x4bda1f[_0xac4a('0x2f')]){_0x4bda1f[_0xac4a('0x30')]=[];_0x4bda1f['TagIds'][_0xac4a('0x31')](',')['forEach'](function(_0x30364b){_0x4bda1f['Tags'][_0xac4a('0x32')](_0x355755[_0x30364b]);});}delete _0x4bda1f[_0xac4a('0x2f')];}catch(_0x31501b){_0x228629(_0x31501b);}_0x2896bc(_0x4bda1f);});}function updateWhatsappInteraction(_0x228aa7,_0x34577f,_0x61e552){return new BPromise(function(_0xbd4591,_0x1f13f3){return getInteractionUsers(_0x228aa7,_0x61e552)[_0xac4a('0x27')](function(_0xfd7c16){return getInteractionTags(_0xfd7c16,_0x34577f);})[_0xac4a('0x27')](function(_0x1634df){_0xbd4591(_0x1634df);})[_0xac4a('0x33')](function(_0x1a9d4e){_0x1f13f3(_0x1a9d4e);});});}exports['index']=function(_0x30442d,_0x1c41fb){var _0x5a4e2b={},_0x2a5419={},_0x1af1c1={'count':0x0,'rows':[]};var _0x565164=_['map'](db[_0xac4a('0x34')][_0xac4a('0x35')],function(_0x1b42b6){return{'name':_0x1b42b6[_0xac4a('0x36')],'type':_0x1b42b6['type'][_0xac4a('0x37')]};});_0x2a5419[_0xac4a('0x38')]=_['map'](_0x565164,_0xac4a('0x2b'));_0x2a5419[_0xac4a('0x39')]=_[_0xac4a('0x3a')](_0x30442d['query']);_0x2a5419[_0xac4a('0x3b')]=_[_0xac4a('0x3c')](_0x2a5419[_0xac4a('0x38')],_0x2a5419['query']);_0x5a4e2b[_0xac4a('0x3d')]=_[_0xac4a('0x3c')](_0x2a5419['model'],qs['fields'](_0x30442d[_0xac4a('0x39')]['fields']));_0x5a4e2b['attributes']=_0x5a4e2b['attributes']['length']?_0x5a4e2b[_0xac4a('0x3d')]:_0x2a5419[_0xac4a('0x38')];if(!_0x30442d[_0xac4a('0x39')][_0xac4a('0x3e')](_0xac4a('0x3f'))){_0x5a4e2b[_0xac4a('0x40')]=qs[_0xac4a('0x40')](_0x30442d[_0xac4a('0x39')][_0xac4a('0x40')]);_0x5a4e2b[_0xac4a('0x21')]=qs[_0xac4a('0x21')](_0x30442d[_0xac4a('0x39')]['offset']);}_0x5a4e2b['order']=qs['sort'](_0x30442d[_0xac4a('0x39')][_0xac4a('0x41')]);_0x5a4e2b[_0xac4a('0x42')]=qs[_0xac4a('0x3b')](_[_0xac4a('0x43')](_0x30442d[_0xac4a('0x39')],_0x2a5419[_0xac4a('0x3b')]),_0x565164);var _0x3441f2=[];var _0x3e9973=squel[_0xac4a('0x44')]()['field']('id')[_0xac4a('0x45')](_0xac4a('0x2b'))[_0xac4a('0x45')](_0xac4a('0x46'))[_0xac4a('0x47')]('tools_tags');var _0x8700b4=squel[_0xac4a('0x44')]()['field'](_0xac4a('0x48'))['field'](_0xac4a('0x49'))[_0xac4a('0x45')](_0xac4a('0x4a'))[_0xac4a('0x47')](_0xac4a('0x4b'),'ui')[_0xac4a('0x4c')](_0xac4a('0x4d'),'u',_0xac4a('0x4e'));var _0x98e0c4=squel[_0xac4a('0x44')]()[_0xac4a('0x47')](_0xac4a('0x4f'),'i')['left_join'](_0xac4a('0x50'),'c',_0xac4a('0x51'))[_0xac4a('0x4c')]('users','o',_0xac4a('0x52'))[_0xac4a('0x4c')]('whatsapp_accounts','a',_0xac4a('0x53'))['left_join'](_0xac4a('0x54'),'me',_0xac4a('0x55'))[_0xac4a('0x4c')]('whatsapp_interaction_has_tags','it','it.WhatsappInteractionId\x20=\x20i.id')[_0xac4a('0x4c')]('tools_tags','t',_0xac4a('0x56'));var _0x566258=squel[_0xac4a('0x57')]();var _0x530bbb=[];var _0x3be103=squel[_0xac4a('0x57')]();var _0x424f9b;if(_0x30442d[_0xac4a('0x39')]['search']){_0x424f9b=as[_0xac4a('0x58')](_0x30442d[_0xac4a('0x39')][_0xac4a('0x59')]);var _0x1ee454=_0x424f9b[_0xac4a('0x5a')];for(var _0x138876=0x0;_0x138876<_0x424f9b[_0xac4a('0x5b')]['length'];_0x138876++){var _0x35dee5=_0x424f9b[_0xac4a('0x5b')][_0x138876];var _0x4828e3='i';var _0x16afbe=_[_0xac4a('0x5c')](_0x565164,[_0xac4a('0x2b'),_0x35dee5[_0xac4a('0x45')]]);if(!_0x16afbe){switch(_0x35dee5['field']){case _0xac4a('0x5d'):if(_0x35dee5[_0xac4a('0x5e')]==0x1){_0x98e0c4[_0xac4a('0x5f')]('`'+_0x35dee5[_0xac4a('0x45')]+_0xac4a('0x60'));}else{_0x98e0c4['having']('`'+_0x35dee5[_0xac4a('0x45')]+'`\x20>\x200');}break;case _0xac4a('0x61'):if(_0x35dee5[_0xac4a('0x62')]==='$substring'){if(_0x35dee5['value'][_0xac4a('0x31')]('\x20')[_0xac4a('0x63')]>0x1){_0x566258[_0x1ee454]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xac4a('0x64')](_0x35dee5[_0xac4a('0x5e')]),null);}else{var _0x26b582='%'+_0x35dee5[_0xac4a('0x5e')]+'%';_0x566258[_0x1ee454]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x26b582,_0x26b582,_0x26b582);}}else{_0x16afbe=_[_0xac4a('0x5c')](_0x565164,[_0xac4a('0x2b'),_0xac4a('0x65')]);_0x35dee5[_0xac4a('0x45')]=_0xac4a('0x65');_0x19ce2c=as[_0xac4a('0x66')](_0x4828e3,_0x16afbe[_0xac4a('0x67')],_0x35dee5);_0x566258[_0x1ee454](_0x19ce2c['text'],_0x19ce2c[_0xac4a('0x5e')][_0xac4a('0x68')],_0x19ce2c[_0xac4a('0x5e')][_0xac4a('0x1e')]);}break;case _0xac4a('0x69'):var _0x2ac1e9=_0x35dee5[_0xac4a('0x5e')][_0xac4a('0x31')](',')[_0xac4a('0x2d')](function(_0x786d9){return Number(_0x786d9);});_0x2ac1e9[_0xac4a('0x6a')](function(_0x38dd4f){_0x3be103['or'](_0xac4a('0x6b'),'%,'+_0x38dd4f+',%');});_0x530bbb=_[_0xac4a('0x6c')](_0x530bbb,_0x2ac1e9);break;case _0xac4a('0x6d'):if(_0x35dee5[_0xac4a('0x62')]==='$substring'){_0x566258[_0x1ee454](_0xac4a('0x6e'),'%'+_0x35dee5['value']+'%',null);}else{_0x16afbe=_[_0xac4a('0x5c')](_0x565164,['name',_0xac4a('0x6f')]);_0x35dee5['field']=_0xac4a('0x6f');_0x19ce2c=as['buildExpression'](_0x4828e3,_0x16afbe['type'],_0x35dee5);_0x566258[_0x1ee454](_0x19ce2c[_0xac4a('0x70')],_0x19ce2c[_0xac4a('0x5e')][_0xac4a('0x68')],_0x19ce2c[_0xac4a('0x5e')][_0xac4a('0x1e')]);}break;case _0xac4a('0x71'):_0x19ce2c=as['buildExpression']('me',null,_0x35dee5);_0x566258[_0x1ee454](_0x19ce2c[_0xac4a('0x70')],_0x19ce2c['value'][_0xac4a('0x68')],_0x19ce2c['value'][_0xac4a('0x1e')]);break;}}else{var _0x19ce2c=as[_0xac4a('0x66')](_0x4828e3,_0x16afbe[_0xac4a('0x67')],_0x35dee5);_0x566258[_0x1ee454](_0x19ce2c[_0xac4a('0x70')],_0x19ce2c[_0xac4a('0x5e')][_0xac4a('0x68')],_0x19ce2c[_0xac4a('0x5e')][_0xac4a('0x1e')]);}}}else{var _0x430dd0=_(_0x30442d[_0xac4a('0x39')])[_0xac4a('0x3a')]()[_0xac4a('0x2d')](function(_0x2cc410){return _[_0xac4a('0x72')](_0x565164,[_0xac4a('0x2b'),_0x2cc410])?_0x2cc410:undefined;})[_0xac4a('0x73')]()['value']();if(!_[_0xac4a('0x74')](_0x430dd0)){_0x430dd0[_0xac4a('0x6a')](function(_0x4fb812){if(_0x4fb812===_0xac4a('0x75')){_0x98e0c4[_0xac4a('0x42')](_0xac4a('0x76'),[][_0xac4a('0x77')](_0x30442d[_0xac4a('0x39')][_0x4fb812]));}else if(_0x4fb812==='createdAt'){var _0x47c6d8=JSON[_0xac4a('0x78')](_0x30442d[_0xac4a('0x39')][_0x4fb812])[_0xac4a('0x79')];var _0x148288=JSON[_0xac4a('0x78')](_0x30442d[_0xac4a('0x39')][_0x4fb812])[_0xac4a('0x7a')];_0x98e0c4[_0xac4a('0x42')](_0xac4a('0x7b'),_0x47c6d8,_0x148288);}else{if(_0x30442d[_0xac4a('0x39')][_0x4fb812]===_0xac4a('0x7c')){_0x98e0c4['where']('i.'+_0x4fb812+'\x20IS\x20NULL');}else{_0x98e0c4[_0xac4a('0x42')]('i.'+_0x4fb812+_0xac4a('0x7d'),_0x30442d[_0xac4a('0x39')][_0x4fb812]);}}});}if(_0x30442d[_0xac4a('0x39')][_0xac4a('0x7e')]){if(_0x30442d[_0xac4a('0x39')][_0xac4a('0x7e')]==0x1){_0x98e0c4[_0xac4a('0x5f')](_0xac4a('0x7f'));}else{_0x98e0c4[_0xac4a('0x5f')](_0xac4a('0x80'));}}if(_0x30442d[_0xac4a('0x39')]['tag']){_0x530bbb=_[_0xac4a('0x81')](_0x30442d[_0xac4a('0x39')][_0xac4a('0x82')])?_0x30442d[_0xac4a('0x39')]['tag']:new Array(_0x30442d[_0xac4a('0x39')]['tag']);_0x530bbb[_0xac4a('0x6a')](function(_0x3af39a){_0x3be103['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x3af39a+',%');});}if(_0x30442d['query'][_0xac4a('0x83')]){var _0x3b8974=_0x30442d[_0xac4a('0x39')]['filter'][_0xac4a('0x84')]('\x5c','\x5c\x5c')['replace']('\x27\x27',_0xac4a('0x85'));if(qs['isNumeric'](_0x3b8974)){_0x566258['or']('i.id\x20LIKE\x20?',_0x3b8974+'%')['or'](_0xac4a('0x86'),_0x3b8974+'%');}else{_0x566258['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xac4a('0x64')](_0x3b8974))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x3b8974+'%');}}}_0x98e0c4[_0xac4a('0x42')](_0x566258);_0x98e0c4[_0xac4a('0x87')]('i.id');var _0x3980ae={'type':db['Sequelize'][_0xac4a('0x88')][_0xac4a('0x89')],'raw':!![]};var _0x522949=_0x98e0c4[_0xac4a('0x8a')]();_0x522949['field']('i.id');_0x522949[_0xac4a('0x45')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xac4a('0x5d'));if(_0x5a4e2b['order']){_0x5a4e2b['order'][_0xac4a('0x6a')](function(_0x4065c0){_0x98e0c4[_0xac4a('0x8b')]('i.'+_0x4065c0[0x0],_0x4065c0[0x1]==='DESC'?![]:!![]);});}if(!_['isEmpty'](_0x530bbb)){_0x98e0c4[_0xac4a('0x5f')](_0x3be103);_0x522949[_0xac4a('0x42')]('t.id\x20IN\x20?',_0x530bbb);}BPromise['resolve']()[_0xac4a('0x27')](function(){if(!_0x424f9b){if(_0x30442d[_0xac4a('0x39')][_0xac4a('0x75')]||_0x30442d[_0xac4a('0x39')][_0xac4a('0x8c')])return;_0x522949[_0xac4a('0x42')](_0xac4a('0x8d'));_0x98e0c4[_0xac4a('0x42')](_0xac4a('0x8d'));return;}return _0x30442d['user'][_0xac4a('0x8e')]({'attributes':['id'],'raw':!![]})[_0xac4a('0x27')](function(_0x3ba61e){if(_['isEmpty'](_0x3ba61e)){_0x522949[_0xac4a('0x42')](_0xac4a('0x8f'));_0x98e0c4[_0xac4a('0x42')](_0xac4a('0x8f'));}else{_0x522949[_0xac4a('0x42')]('i.WhatsappAccountId\x20IN\x20?',_[_0xac4a('0x2d')](_0x3ba61e,'id'));_0x98e0c4[_0xac4a('0x42')](_0xac4a('0x76'),_[_0xac4a('0x2d')](_0x3ba61e,'id'));}});})[_0xac4a('0x27')](function(){db[_0xac4a('0x90')][_0xac4a('0x39')](_0x522949['toString'](),_0x3980ae)[_0xac4a('0x27')](function(_0x2be178){_0x1af1c1[_0xac4a('0x20')]=_0x2be178[_0xac4a('0x63')];if(_0x1af1c1[_0xac4a('0x20')]===0x0)return[];return db[_0xac4a('0x90')]['query'](_0x3e9973[_0xac4a('0x91')](),_0x3980ae)[_0xac4a('0x27')](function(_0x1b9a33){_0x3441f2=_[_0xac4a('0x92')](_0x1b9a33,'id');_0x3980ae=_['merge'](_0x3980ae,{'model':db[_0xac4a('0x34')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x30442d['query'][_0xac4a('0x93')]){_0x5a4e2b[_0xac4a('0x3d')]['forEach'](function(_0x5b95ab){_0x98e0c4[_0xac4a('0x45')]('i.'+_0x5b95ab);});}else{_0x98e0c4[_0xac4a('0x45')](_0xac4a('0x94'),'unreadMessages');_0x98e0c4[_0xac4a('0x45')]('a.key',_0xac4a('0x95'));_0x98e0c4[_0xac4a('0x45')](_0xac4a('0x96'),_0xac4a('0x97'));_0x98e0c4[_0xac4a('0x45')]('i.*');_0x98e0c4['field'](_0xac4a('0x98'),_0xac4a('0x99'));_0x98e0c4[_0xac4a('0x45')](_0xac4a('0x9a'),_0xac4a('0x9b'));_0x98e0c4[_0xac4a('0x45')](_0xac4a('0x9c'),_0xac4a('0x9d'));_0x98e0c4['field']('c.phone',_0xac4a('0x9e'));_0x98e0c4[_0xac4a('0x45')](_0xac4a('0x9f'),_0xac4a('0xa0'));_0x98e0c4[_0xac4a('0x45')](_0xac4a('0xa1'),_0xac4a('0xa2'));_0x98e0c4[_0xac4a('0x45')]('o.fullname','Owner.fullname');_0x98e0c4[_0xac4a('0x45')](_0xac4a('0xa3'),_0xac4a('0xa4'));_0x98e0c4[_0xac4a('0x45')](_0xac4a('0xa5'),_0xac4a('0x2f'));}if(_0x5a4e2b[_0xac4a('0x40')])_0x98e0c4['limit'](_0x5a4e2b[_0xac4a('0x40')]);if(_0x5a4e2b[_0xac4a('0x21')])_0x98e0c4[_0xac4a('0x21')](_0x5a4e2b['offset']);return db[_0xac4a('0x90')][_0xac4a('0x39')](_0x98e0c4[_0xac4a('0x91')](),_0x3980ae);})[_0xac4a('0x27')](function(_0x1a7448){_0x8700b4[_0xac4a('0x42')](_0xac4a('0xa6'),_[_0xac4a('0x2d')](_0x1a7448,'id'));return db[_0xac4a('0x90')]['query'](_0x8700b4[_0xac4a('0x91')](),_0x3980ae)['then'](function(_0x203321){var _0x1199f6=_[_0xac4a('0xa7')](_0x203321,_0xac4a('0xa8'));var _0x840fec=[];_0x1a7448[_0xac4a('0x6a')](function(_0x19766a){_0x840fec['push'](updateWhatsappInteraction(_0x19766a,_0x3441f2,_0x1199f6));});return BPromise[_0xac4a('0xa9')](_0x840fec);});});})[_0xac4a('0x27')](function(_0x279f9b){_0x1af1c1[_0xac4a('0xaa')]=_0x279f9b;return _0x1af1c1;})[_0xac4a('0x27')](respondWithFilteredResult(_0x1c41fb,_0x5a4e2b));})['catch'](handleError(_0x1c41fb,null));};exports[_0xac4a('0xab')]=function(_0x360d4f,_0x4f2b19){var _0x55af32={'raw':![],'where':{'id':_0x360d4f[_0xac4a('0xac')]['id']}},_0x386d6d={};_0x386d6d['model']=_[_0xac4a('0x3a')](db[_0xac4a('0x34')][_0xac4a('0x35')]);_0x386d6d[_0xac4a('0x39')]=_[_0xac4a('0x3a')](_0x360d4f[_0xac4a('0x39')]);_0x386d6d['filters']=_[_0xac4a('0x3c')](_0x386d6d[_0xac4a('0x38')],_0x386d6d[_0xac4a('0x39')]);_0x55af32['attributes']=_[_0xac4a('0x3c')](_0x386d6d[_0xac4a('0x38')],qs[_0xac4a('0x93')](_0x360d4f[_0xac4a('0x39')][_0xac4a('0x93')]));_0x55af32[_0xac4a('0x3d')]=_0x55af32['attributes'][_0xac4a('0x63')]?_0x55af32[_0xac4a('0x3d')]:_0x386d6d['model'];if(_0x360d4f[_0xac4a('0x39')]['includeAll']){_0x55af32[_0xac4a('0xad')]=[{'all':!![]}];}_0x55af32=_[_0xac4a('0xae')]({},_0x55af32,_0x360d4f['options']);return db[_0xac4a('0x34')]['find'](_0x55af32)[_0xac4a('0x27')](handleEntityNotFound(_0x4f2b19,null))['then'](respondWithResult(_0x4f2b19,null))[_0xac4a('0x33')](handleError(_0x4f2b19,null));};exports[_0xac4a('0xaf')]=function(_0x24f464,_0xfe8977){return db[_0xac4a('0x34')][_0xac4a('0xaf')](_0x24f464[_0xac4a('0x71')],{})[_0xac4a('0x27')](respondWithResult(_0xfe8977,0xc9))[_0xac4a('0x33')](handleError(_0xfe8977,null));};exports[_0xac4a('0x26')]=function(_0x3a0163,_0x455eb7){if(_0x3a0163[_0xac4a('0x71')]['id']){delete _0x3a0163[_0xac4a('0x71')]['id'];}return db['WhatsappInteraction'][_0xac4a('0x5c')]({'where':{'id':_0x3a0163[_0xac4a('0xac')]['id']}})['then'](handleEntityNotFound(_0x455eb7,null))[_0xac4a('0x27')](saveUpdates(_0x3a0163[_0xac4a('0x71')],null))[_0xac4a('0x27')](respondWithResult(_0x455eb7,null))[_0xac4a('0x33')](handleError(_0x455eb7,null));};exports[_0xac4a('0x28')]=function(_0x5d5bb3,_0x101137){return db['WhatsappInteraction'][_0xac4a('0x5c')]({'where':{'id':_0x5d5bb3[_0xac4a('0xac')]['id']}})[_0xac4a('0x27')](handleEntityNotFound(_0x101137,null))[_0xac4a('0x27')](removeEntity(_0x101137,null))['catch'](handleError(_0x101137,null));};exports[_0xac4a('0xb0')]=function(_0x55866d,_0x277fd1){return db[_0xac4a('0x34')][_0xac4a('0xb0')]()['then'](respondWithResult(_0x277fd1,null))[_0xac4a('0x33')](handleError(_0x277fd1,null));};exports[_0xac4a('0xb1')]=function(_0x127ede,_0x52f3f2,_0x2da95f){return db[_0xac4a('0xb2')][_0xac4a('0x5c')]({'where':{'id':_0x127ede[_0xac4a('0xac')]['id']}})[_0xac4a('0x27')](handleEntityNotFound(_0x52f3f2,null))[_0xac4a('0x27')](function(_0x3b4183){if(_0x3b4183){return _0x3b4183[_0xac4a('0xb1')](_0x127ede['body'][_0xac4a('0xb3')],_['omit'](_0x127ede['body'],['ids','id'])||{});}})['then'](respondWithResult(_0x52f3f2,null))['catch'](handleError(_0x52f3f2,null));};exports[_0xac4a('0xb4')]=function(_0x58fcb0,_0xc014a6,_0x377444){var _0x2132b2={'raw':![],'where':{}};var _0x525d50={};var _0x9ea4d1={'count':0x0,'rows':[]};return db[_0xac4a('0x34')][_0xac4a('0xb5')]({'where':{'id':_0x58fcb0[_0xac4a('0xac')]['id']}})[_0xac4a('0x27')](handleEntityNotFound(_0xc014a6,null))[_0xac4a('0x27')](function(_0x7a1b25){if(_0x7a1b25){_0x525d50[_0xac4a('0x38')]=_['keys'](db[_0xac4a('0xb2')][_0xac4a('0x35')]);_0x525d50[_0xac4a('0x39')]=_[_0xac4a('0x3a')](_0x58fcb0[_0xac4a('0x39')]);_0x525d50[_0xac4a('0x3b')]=_[_0xac4a('0x3c')](_0x525d50['model'],_0x525d50['query']);_0x2132b2[_0xac4a('0x3d')]=_[_0xac4a('0x3c')](_0x525d50['model'],qs[_0xac4a('0x93')](_0x58fcb0[_0xac4a('0x39')]['fields']));_0x2132b2['attributes']=_0x2132b2[_0xac4a('0x3d')][_0xac4a('0x63')]?_0x2132b2[_0xac4a('0x3d')]:_0x525d50[_0xac4a('0x38')];if(!_0x58fcb0[_0xac4a('0x39')]['hasOwnProperty'](_0xac4a('0x3f'))){_0x2132b2['limit']=qs['limit'](_0x58fcb0['query'][_0xac4a('0x40')]);_0x2132b2[_0xac4a('0x21')]=qs[_0xac4a('0x21')](_0x58fcb0[_0xac4a('0x39')][_0xac4a('0x21')]);}_0x2132b2[_0xac4a('0x8b')]=qs[_0xac4a('0x41')](_0x58fcb0[_0xac4a('0x39')]['sort']);_0x2132b2['where']=qs['filters'](_[_0xac4a('0x43')](_0x58fcb0[_0xac4a('0x39')],_0x525d50[_0xac4a('0x3b')]));_0x2132b2[_0xac4a('0x42')][_0xac4a('0xa8')]=_0x7a1b25['id'];if(_0x58fcb0[_0xac4a('0x39')][_0xac4a('0x83')]){_0x2132b2[_0xac4a('0x42')]=_[_0xac4a('0xae')](_0x2132b2[_0xac4a('0x42')],{'$or':_[_0xac4a('0x2d')](_0x2132b2[_0xac4a('0x3d')],function(_0xe0fd57){var _0x32b013={};_0x32b013[_0xe0fd57]={'$like':'%'+_0x58fcb0[_0xac4a('0x39')][_0xac4a('0x83')]+'%'};return _0x32b013;})});}if(_0x58fcb0[_0xac4a('0x39')][_0xac4a('0x79')]){var _0x41cdb5=_0x58fcb0[_0xac4a('0x39')][_0xac4a('0x79')][_0xac4a('0x31')](',');var _0x3e2575={};_0x3e2575[_0x41cdb5[0x0]]={'$gte':moment(_0x41cdb5[0x1])['format'](_0xac4a('0xb6'))};_0x2132b2[_0xac4a('0x42')]=_[_0xac4a('0xae')](_0x2132b2[_0xac4a('0x42')],_0x3e2575);}_0x2132b2=_[_0xac4a('0xae')]({},_0x2132b2,_0x58fcb0[_0xac4a('0xb7')]);return db[_0xac4a('0xb2')][_0xac4a('0x20')]({'where':_0x2132b2['where']})['then'](function(_0x113f80){_0x9ea4d1[_0xac4a('0x20')]=_0x113f80;if(_0x58fcb0[_0xac4a('0x39')]['includeAll']){_0x2132b2['include']=[{'all':!![]}];}return db['WhatsappMessage'][_0xac4a('0xb8')](_0x2132b2);})['then'](function(_0x59e82c){_0x9ea4d1[_0xac4a('0xaa')]=_0x59e82c;return _0x9ea4d1;});}})['then'](respondWithFilteredResult(_0xc014a6,_0x2132b2))[_0xac4a('0x33')](handleError(_0xc014a6,null));};exports['addTags']=function(_0x3f95a4,_0x2b4f28,_0x413f5f){return db[_0xac4a('0x34')][_0xac4a('0x5c')]({'where':{'id':_0x3f95a4[_0xac4a('0xac')]['id']}})['then'](handleEntityNotFound(_0x2b4f28,null))[_0xac4a('0x27')](function(_0x34b6d7){if(_0x34b6d7){return _0x34b6d7[_0xac4a('0xb9')](_0x3f95a4['body'][_0xac4a('0xb3')],_[_0xac4a('0xba')](_0x3f95a4[_0xac4a('0x71')],[_0xac4a('0xb3'),'id'])||{})['spread'](function(){return db[_0xac4a('0x69')][_0xac4a('0xb8')]({'attributes':['id',_0xac4a('0x2b'),_0xac4a('0x46')],'where':{'id':_0x3f95a4[_0xac4a('0x71')][_0xac4a('0xb3')]}});})['then'](function(_0x57d3cd){socket[_0xac4a('0xbb')](_0xac4a('0xbc'),{'id':Number(_0x3f95a4[_0xac4a('0xac')]['id']),'tags':_0x57d3cd||[]});return{'id':Number(_0x3f95a4[_0xac4a('0xac')]['id']),'tags':_0x57d3cd||[]};});}})[_0xac4a('0x27')](respondWithResult(_0x2b4f28,null))[_0xac4a('0x33')](handleError(_0x2b4f28,null));};exports['removeTags']=function(_0x21a6f6,_0x580c9b,_0xe4165d){return db['WhatsappInteraction'][_0xac4a('0x5c')]({'where':{'id':_0x21a6f6[_0xac4a('0xac')]['id']}})[_0xac4a('0x27')](handleEntityNotFound(_0x580c9b,null))[_0xac4a('0x27')](function(_0x5650ce){if(_0x5650ce){return _0x5650ce[_0xac4a('0xbd')](_0x21a6f6[_0xac4a('0x39')][_0xac4a('0xb3')]);}})[_0xac4a('0x27')](respondWithStatusCode(_0x580c9b,null))[_0xac4a('0x33')](handleError(_0x580c9b,null));};exports['download']=function(_0x3dd60a,_0xbe1958){var _0x462964=moment()[_0xac4a('0xbe')]()[_0xac4a('0x91')]();var _0x5e5eb1=path[_0xac4a('0xbf')](config[_0xac4a('0xc0')],_0xac4a('0xc1'),_0xac4a('0xc2'),_0xac4a('0xc3'));var _0x55ccc3=path['join'](config['root'],'server',_0xac4a('0xc2'),_0xac4a('0xc4'));var _0x17f815=path[_0xac4a('0xbf')](_0x5e5eb1,_0x462964);var _0xa8b5bb=util['format'](_0xac4a('0xc5'),_0x3dd60a[_0xac4a('0xac')]['id'],_0x462964);var _0x5aad90=path[_0xac4a('0xbf')](_0x5e5eb1,_0xa8b5bb);var _0x14b425=[];_0x14b425[_0xac4a('0x32')]({'model':db['User'],'as':_0xac4a('0x6d'),'attributes':['id',_0xac4a('0x2e')],'raw':!![]});_0x14b425[_0xac4a('0x32')]({'model':db[_0xac4a('0xc6')],'as':_0xac4a('0x61'),'attributes':['id',_0xac4a('0xc7'),_0xac4a('0xc8')],'raw':!![]});if(_0x3dd60a[_0xac4a('0x39')][_0xac4a('0xc4')]){_0x14b425['push']({'model':db[_0xac4a('0xc9')],'as':_0xac4a('0xc9'),'raw':!![]});}var _0x579181=[{'model':db[_0xac4a('0xb2')],'as':'Messages','attributes':['id',_0xac4a('0x71'),_0xac4a('0xca'),'direction',_0xac4a('0xcb'),_0xac4a('0x7e')],'include':_0x14b425}];_0x579181[_0xac4a('0x32')]({'model':db[_0xac4a('0xcc')],'as':_0xac4a('0xcd'),'attributes':['id',_0xac4a('0x2b')]});_0x579181[_0xac4a('0x32')]({'model':db[_0xac4a('0x6d')],'as':'Owner','attributes':['id','fullname']});return db[_0xac4a('0x34')]['find']({'where':{'id':_0x3dd60a['params']['id']},'include':_0x579181})[_0xac4a('0x27')](handleEntityNotFound(_0xbe1958,null))[_0xac4a('0x27')](function(_0x3254c3){if(_0x3254c3){var _0x516225=_0x3254c3[_0xac4a('0xce')]({'plain':!![]});fs[_0xac4a('0xcf')](_0x17f815);var _0x5a2abf={'format':'A4','border':'10px','header':{'height':_0xac4a('0xd0'),'contents':{'first':_0xac4a('0xd1')}},'footer':{'height':_0xac4a('0xd2'),'contents':{'default':util[_0xac4a('0xd3')]('\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',util[_0xac4a('0xd3')](_0xac4a('0xd4'),_0xac4a('0xd5'),_0x516225['id']),moment()['format'](_0xac4a('0xd6'))[_0xac4a('0x91')]())}}};var _0x15b97a={'channel':_0xac4a('0xd5'),'account':_0x516225[_0xac4a('0xcd')]['name'],'agent':_0x516225['Owner']?_0x516225[_0xac4a('0xd7')][_0xac4a('0x2e')]:_0xac4a('0xd8'),'createdAt':moment(_0x516225[_0xac4a('0xca')])[_0xac4a('0xd3')](_0xac4a('0xb6'))[_0xac4a('0x91')](),'closedAt':_0x516225[_0xac4a('0xd9')]?moment(_0x516225[_0xac4a('0xda')])[_0xac4a('0xd3')](_0xac4a('0xb6'))[_0xac4a('0x91')]():'','disposition':_0x516225[_0xac4a('0xdb')],'messages':_(_0x516225['Messages'])[_0xac4a('0x83')]({'secret':![]})['map'](function(_0x4ec2c3){if(_0x4ec2c3[_0xac4a('0xc9')]){var _0x27833a=path[_0xac4a('0xbf')](_0x55ccc3,_0x4ec2c3[_0xac4a('0xc9')][_0xac4a('0xdc')]);if(fs[_0xac4a('0xdd')](_0x27833a)){fs[_0xac4a('0xde')](_0x27833a)[_0xac4a('0xdf')](fs[_0xac4a('0xe0')](path['join'](_0x17f815,_0x4ec2c3[_0xac4a('0xc9')][_0xac4a('0xdc')])));}}return{'date':moment(_0x4ec2c3[_0xac4a('0xca')])[_0xac4a('0xd3')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'sender':_0x4ec2c3[_0xac4a('0xe1')]===_0xac4a('0xe2')?_0x4ec2c3[_0xac4a('0x6d')]?_0x4ec2c3[_0xac4a('0x6d')][_0xac4a('0x2e')]:_0xac4a('0xe3'):_0x4ec2c3[_0xac4a('0x61')][_0xac4a('0xc7')]+(_0x4ec2c3[_0xac4a('0x61')]['lastName']?'\x20'+_0x4ec2c3[_0xac4a('0x61')][_0xac4a('0xc8')]:''),'body':_0x4ec2c3[_0xac4a('0xc9')]?_0x4ec2c3[_0xac4a('0xc9')][_0xac4a('0xdc')]:_0x4ec2c3[_0xac4a('0x71')],'direction':_0x4ec2c3['direction']==='out'?'A':'C','secret':_0x4ec2c3['secret'],'read':_0x4ec2c3[_0xac4a('0x7e')],'attachment':_0x4ec2c3[_0xac4a('0xc9')]};})['value']()};return ejs['renderFile'](path[_0xac4a('0xbf')](config['root'],_0xac4a('0xc1'),'views',_0xac4a('0xe4')),{'interaction':_0x15b97a})[_0xac4a('0x27')](function(_0x1888c3){return new BPromise(function(_0x4a04c3,_0x14435d){pdf[_0xac4a('0xaf')](_0x1888c3,_0x5a2abf)['toFile'](path[_0xac4a('0xbf')](_0x17f815,_0xac4a('0xe5')+_0x516225['id']+'-'+_0x462964+'.pdf'),function(_0x48a75c,_0x4514a5){if(_0x48a75c)return _0x14435d(_0x48a75c);_0x4a04c3(_0x4514a5);});});})[_0xac4a('0x27')](function(){return new BPromise(function(_0x43df37,_0x45e45b){zipdir(_0x17f815,{'saveTo':_0x5aad90},function(_0x367254,_0x22cc71){if(_0x367254)return _0x45e45b(_0x367254);return _0x43df37(_0x22cc71);});})[_0xac4a('0x27')](function(){return new BPromise(function(_0x1ea4ef,_0x156b67){rimraf(_0x17f815,function(_0x330070){if(_0x330070)_0x156b67(_0x330070);return _0x1ea4ef();});});})[_0xac4a('0x27')](function(){return _0xbe1958[_0xac4a('0xe6')](_0x5aad90,_0xa8b5bb,function(_0x2d755c){if(_0x2d755c){console[_0xac4a('0xe7')](_0xac4a('0xe8'),_0x2d755c);}else{fs[_0xac4a('0xe9')](_0x5aad90);}});});});}else{return _0xbe1958[_0xac4a('0x1c')](0xc8);}})['catch'](handleError(_0xbe1958,null));}; \ No newline at end of file +var _0x814b=['index','rawAttributes','type','key','model','query','intersection','attributes','length','nolimit','limit','order','sort','filters','select','field','color','from','tools_tags','u.id','u.fullname','ui.WhatsappInteractionId','users','u.id\x20=\x20ui.UserId','whatsapp_interactions','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','whatsapp_accounts','me.WhatsappInteractionId\x20=\x20i.id','whatsapp_interaction_has_tags','it.WhatsappInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','conditions','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','operator','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','Tag','union','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','find','UserId','body','keys','some','compact','WhatsappAccountId','where','i.WhatsappAccountId\x20IN\x20?','concat','createdAt','parse','$lte','\x20IS\x20NULL','\x20=\x20?','`unreadMessages`\x20>\x200','isArray','tag','filter','replace','\x27\x27\x27\x27','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','Sequelize','QueryTypes','SELECT','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','isEmpty','t.id\x20IN\x20?','journey','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','getWhatsappAccounts','toString','count','sequelize','fields','a.key','Account.key','Account.mandatoryDisposition','i.*','Contact.firstName','c.lastName','Contact.lastName','Contact.phone','Contact.mobile','c.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','ui.WhatsappInteractionId\x20IN\x20?','groupBy','all','rows','show','params','WhatsappInteraction','includeAll','merge','options','create','describe','addMessage','WhatsappMessage','ids','getMessages','findOne','hasOwnProperty','WhatsappInteractionId','$gte','format','YYYY-MM-DD\x20HH:mm:ss','include','findAll','addTags','setTags','spread','emit','whatsappInteractionTags:save','removeTags','download','unix','root','server','files','tmp','join','attachments','transcript-%d-%s.zip','User','fullname','Contact','firstName','lastName','Attachment','Messages','direction','secret','read','WhatsappAccount','Account','Owner','get','mkdirSync','10px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','%s\x20#%d','Whatsapp','YYYY-MM-DD','closedAt','disposition','existsSync','basename','out','System','renderFile','downloadInteraction.html','toFile','transcript-','.pdf','log','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','sendStatus','status','end','json','offset','set','Content-Range','reject','save','update','destroy','then','error','stack','name','send','map','TagIds','split','forEach','push','catch'];(function(_0x15f2cb,_0x5c2f25){var _0x3b10b4=function(_0x3cdf96){while(--_0x3cdf96){_0x15f2cb['push'](_0x15f2cb['shift']());}};_0x3b10b4(++_0x5c2f25);}(_0x814b,0x1a2));var _0xb814=function(_0x507597,_0x412525){_0x507597=_0x507597-0x0;var _0x110a0f=_0x814b[_0x507597];return _0x110a0f;};'use strict';var pdf=require(_0xb814('0x0'));var emlformat=require(_0xb814('0x1'));var rimraf=require(_0xb814('0x2'));var zipdir=require(_0xb814('0x3'));var jsonpatch=require(_0xb814('0x4'));var rp=require(_0xb814('0x5'));var moment=require('moment');var BPromise=require(_0xb814('0x6'));var Mustache=require(_0xb814('0x7'));var util=require(_0xb814('0x8'));var path=require(_0xb814('0x9'));var sox=require(_0xb814('0xa'));var csv=require(_0xb814('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xb814('0xc'));var squel=require(_0xb814('0xd'));var crypto=require('crypto');var jsforce=require(_0xb814('0xe'));var deskjs=require(_0xb814('0xf'));var toCsv=require(_0xb814('0xb'));var querystring=require(_0xb814('0x10'));var Papa=require(_0xb814('0x11'));var Redis=require(_0xb814('0x12'));var authService=require(_0xb814('0x13'));var qs=require(_0xb814('0x14'));var as=require(_0xb814('0x15'));var hardwareService=require(_0xb814('0x16'));var logger=require(_0xb814('0x17'))('api');var utils=require(_0xb814('0x18'));var config=require('../../config/environment');var db=require(_0xb814('0x19'))['db'];config[_0xb814('0x1a')]=_[_0xb814('0x1b')](config[_0xb814('0x1a')],{'host':_0xb814('0x1c'),'port':0x18eb});var socket=require(_0xb814('0x1d'))(new Redis(config[_0xb814('0x1a')]));require(_0xb814('0x1e'))[_0xb814('0x1f')](socket);function respondWithStatusCode(_0x2ab627,_0x3f4881){_0x3f4881=_0x3f4881||0xcc;return function(_0x44fb96){if(_0x44fb96){return _0x2ab627[_0xb814('0x20')](_0x3f4881);}return _0x2ab627[_0xb814('0x21')](_0x3f4881)[_0xb814('0x22')]();};}function respondWithResult(_0x3a71d6,_0x45e0d0){_0x45e0d0=_0x45e0d0||0xc8;return function(_0x265a83){if(_0x265a83){return _0x3a71d6[_0xb814('0x21')](_0x45e0d0)[_0xb814('0x23')](_0x265a83);}};}function respondWithFilteredResult(_0x7a21ef,_0x48c9df){return function(_0x168a48){if(_0x168a48){var _0x55ba16=_0x168a48['count'],_0x270598=_0x48c9df['offset'],_0xfac75b=_0x48c9df[_0xb814('0x24')]+_0x48c9df['limit'],_0x4c3007;if(_0xfac75b>=_0x55ba16){_0xfac75b=_0x55ba16;_0x4c3007=0xc8;}else{_0x4c3007=0xce;}_0x7a21ef['status'](_0x4c3007);return _0x7a21ef[_0xb814('0x25')](_0xb814('0x26'),_0x270598+'-'+_0xfac75b+'/'+_0x55ba16)[_0xb814('0x23')](_0x168a48);}return null;};}function patchUpdates(_0x4e139e){return function(_0xf5b8aa){try{jsonpatch['apply'](_0xf5b8aa,_0x4e139e,!![]);}catch(_0x1e6393){return BPromise[_0xb814('0x27')](_0x1e6393);}return _0xf5b8aa[_0xb814('0x28')]();};}function saveUpdates(_0x470e81,_0x27352e){return function(_0x2bd039){if(_0x2bd039){return _0x2bd039[_0xb814('0x29')](_0x470e81)['then'](function(_0x2ead86){return _0x2ead86;});}return null;};}function removeEntity(_0x52b7a3,_0x3f81d0){return function(_0x457dac){if(_0x457dac){return _0x457dac[_0xb814('0x2a')]()[_0xb814('0x2b')](function(){_0x52b7a3[_0xb814('0x21')](0xcc)[_0xb814('0x22')]();});}};}function handleEntityNotFound(_0x3d836c,_0x5755ea){return function(_0x392222){if(!_0x392222){_0x3d836c[_0xb814('0x20')](0x194);}return _0x392222;};}function handleError(_0x1c2625,_0x349394){_0x349394=_0x349394||0x1f4;return function(_0x32ed56){logger[_0xb814('0x2c')](_0x32ed56[_0xb814('0x2d')]);if(_0x32ed56[_0xb814('0x2e')]){delete _0x32ed56['name'];}_0x1c2625[_0xb814('0x21')](_0x349394)[_0xb814('0x2f')](_0x32ed56);};}function getInteractionUsers(_0x52ed64,_0x9008b2){return new BPromise(function(_0x37d24d,_0x530744){try{if(_0x9008b2[_0x52ed64['id']]){_0x52ed64['Users']=_[_0xb814('0x30')](_0x9008b2[_0x52ed64['id']],function(_0x2051d0){return{'id':_0x2051d0['id'],'fullname':_0x2051d0['fullname']};});}}catch(_0x338a28){_0x530744(_0x338a28);}_0x37d24d(_0x52ed64);});}function getInteractionTags(_0x526610,_0x6efe9a){return new BPromise(function(_0x5f3e9b,_0x4cfc58){try{if(_0x526610[_0xb814('0x31')]){_0x526610['Tags']=[];_0x526610[_0xb814('0x31')][_0xb814('0x32')](',')[_0xb814('0x33')](function(_0x599f9f){_0x526610['Tags'][_0xb814('0x34')](_0x6efe9a[_0x599f9f]);});}delete _0x526610[_0xb814('0x31')];}catch(_0x523566){_0x4cfc58(_0x523566);}_0x5f3e9b(_0x526610);});}function updateWhatsappInteraction(_0x2c8943,_0xe558d5,_0x692c72){return new BPromise(function(_0x217b7e,_0x1b78de){return getInteractionUsers(_0x2c8943,_0x692c72)[_0xb814('0x2b')](function(_0x3672f3){return getInteractionTags(_0x3672f3,_0xe558d5);})['then'](function(_0x3207ec){_0x217b7e(_0x3207ec);})[_0xb814('0x35')](function(_0x30de5a){_0x1b78de(_0x30de5a);});});}exports[_0xb814('0x36')]=function(_0x14100d,_0x4ff31a){var _0x16ef82={},_0x57e6e6={},_0x43db67={'count':0x0,'rows':[]};var _0x16e21c=_[_0xb814('0x30')](db['WhatsappInteraction'][_0xb814('0x37')],function(_0xbdb3e9){return{'name':_0xbdb3e9['fieldName'],'type':_0xbdb3e9[_0xb814('0x38')][_0xb814('0x39')]};});_0x57e6e6[_0xb814('0x3a')]=_[_0xb814('0x30')](_0x16e21c,_0xb814('0x2e'));_0x57e6e6[_0xb814('0x3b')]=_['keys'](_0x14100d[_0xb814('0x3b')]);_0x57e6e6['filters']=_[_0xb814('0x3c')](_0x57e6e6['model'],_0x57e6e6[_0xb814('0x3b')]);_0x16ef82['attributes']=_[_0xb814('0x3c')](_0x57e6e6[_0xb814('0x3a')],qs['fields'](_0x14100d['query']['fields']));_0x16ef82['attributes']=_0x16ef82[_0xb814('0x3d')][_0xb814('0x3e')]?_0x16ef82[_0xb814('0x3d')]:_0x57e6e6[_0xb814('0x3a')];if(!_0x14100d['query']['hasOwnProperty'](_0xb814('0x3f'))){_0x16ef82['limit']=qs[_0xb814('0x40')](_0x14100d[_0xb814('0x3b')][_0xb814('0x40')]);_0x16ef82[_0xb814('0x24')]=qs[_0xb814('0x24')](_0x14100d[_0xb814('0x3b')][_0xb814('0x24')]);}_0x16ef82[_0xb814('0x41')]=qs[_0xb814('0x42')](_0x14100d['query']['sort']);_0x16ef82['where']=qs[_0xb814('0x43')](_['pick'](_0x14100d[_0xb814('0x3b')],_0x57e6e6['filters']),_0x16e21c);var _0x411723=[];var _0x44ff56=squel[_0xb814('0x44')]()[_0xb814('0x45')]('id')['field'](_0xb814('0x2e'))[_0xb814('0x45')](_0xb814('0x46'))[_0xb814('0x47')](_0xb814('0x48'));var _0x450a08=squel['select']()[_0xb814('0x45')](_0xb814('0x49'))[_0xb814('0x45')](_0xb814('0x4a'))[_0xb814('0x45')](_0xb814('0x4b'))[_0xb814('0x47')]('user_has_whatsapp_interactions','ui')['left_join'](_0xb814('0x4c'),'u',_0xb814('0x4d'));var _0x4c08d6=squel[_0xb814('0x44')]()[_0xb814('0x47')](_0xb814('0x4e'),'i')[_0xb814('0x4f')](_0xb814('0x50'),'c',_0xb814('0x51'))[_0xb814('0x4f')](_0xb814('0x4c'),'o','o.id\x20=\x20i.UserId')[_0xb814('0x4f')](_0xb814('0x52'),'a','a.id\x20=\x20i.WhatsappAccountId')[_0xb814('0x4f')]('whatsapp_messages','me',_0xb814('0x53'))[_0xb814('0x4f')](_0xb814('0x54'),'it',_0xb814('0x55'))[_0xb814('0x4f')](_0xb814('0x48'),'t',_0xb814('0x56'));var _0x45480e=squel[_0xb814('0x57')]();var _0x2a422a=[];var _0x5e6df7=squel['expr']();var _0x32eca6;if(_0x14100d[_0xb814('0x3b')][_0xb814('0x58')]){_0x32eca6=as[_0xb814('0x59')](_0x14100d[_0xb814('0x3b')][_0xb814('0x58')]);var _0x135208=_0x32eca6['sqlOperator'];for(var _0x26fd0b=0x0;_0x26fd0b<_0x32eca6[_0xb814('0x5a')][_0xb814('0x3e')];_0x26fd0b++){var _0x5a916d=_0x32eca6[_0xb814('0x5a')][_0x26fd0b];var _0x4e6f3c='i';var _0x252293=_['find'](_0x16e21c,[_0xb814('0x2e'),_0x5a916d[_0xb814('0x45')]]);if(!_0x252293){switch(_0x5a916d['field']){case _0xb814('0x5b'):if(_0x5a916d[_0xb814('0x5c')]==0x1){_0x4c08d6[_0xb814('0x5d')]('`'+_0x5a916d['field']+_0xb814('0x5e'));}else{_0x4c08d6['having']('`'+_0x5a916d[_0xb814('0x45')]+_0xb814('0x5f'));}break;case'Contact':if(_0x5a916d[_0xb814('0x60')]==='$substring'){if(_0x5a916d['value'][_0xb814('0x32')]('\x20')[_0xb814('0x3e')]>0x1){_0x45480e[_0x135208](_0xb814('0x61'),qs['getFullTextValue'](_0x5a916d[_0xb814('0x5c')]),null);}else{var _0x538b0f='%'+_0x5a916d[_0xb814('0x5c')]+'%';_0x45480e[_0x135208](_0xb814('0x62'),_0x538b0f,_0x538b0f,_0x538b0f);}}else{_0x252293=_['find'](_0x16e21c,[_0xb814('0x2e'),'ContactId']);_0x5a916d[_0xb814('0x45')]=_0xb814('0x63');_0x135e13=as[_0xb814('0x64')](_0x4e6f3c,_0x252293[_0xb814('0x38')],_0x5a916d);_0x45480e[_0x135208](_0x135e13[_0xb814('0x65')],_0x135e13[_0xb814('0x5c')][_0xb814('0x66')],_0x135e13[_0xb814('0x5c')]['end']);}break;case _0xb814('0x67'):var _0x5441c5=_0x5a916d['value'][_0xb814('0x32')](',')[_0xb814('0x30')](function(_0x4d13db){return Number(_0x4d13db);});_0x5441c5[_0xb814('0x33')](function(_0x58b9a6){_0x5e6df7['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x58b9a6+',%');});_0x2a422a=_[_0xb814('0x68')](_0x2a422a,_0x5441c5);break;case'User':if(_0x5a916d[_0xb814('0x60')]===_0xb814('0x69')){_0x45480e[_0x135208](_0xb814('0x6a'),'%'+_0x5a916d['value']+'%',null);}else{_0x252293=_[_0xb814('0x6b')](_0x16e21c,['name',_0xb814('0x6c')]);_0x5a916d[_0xb814('0x45')]=_0xb814('0x6c');_0x135e13=as[_0xb814('0x64')](_0x4e6f3c,_0x252293[_0xb814('0x38')],_0x5a916d);_0x45480e[_0x135208](_0x135e13[_0xb814('0x65')],_0x135e13[_0xb814('0x5c')][_0xb814('0x66')],_0x135e13[_0xb814('0x5c')]['end']);}break;case _0xb814('0x6d'):_0x135e13=as[_0xb814('0x64')]('me',null,_0x5a916d);_0x45480e[_0x135208](_0x135e13[_0xb814('0x65')],_0x135e13[_0xb814('0x5c')][_0xb814('0x66')],_0x135e13[_0xb814('0x5c')]['end']);break;}}else{var _0x135e13=as['buildExpression'](_0x4e6f3c,_0x252293[_0xb814('0x38')],_0x5a916d);_0x45480e[_0x135208](_0x135e13[_0xb814('0x65')],_0x135e13[_0xb814('0x5c')]['start'],_0x135e13[_0xb814('0x5c')]['end']);}}}else{var _0x37e9c5=_(_0x14100d['query'])[_0xb814('0x6e')]()[_0xb814('0x30')](function(_0xa03cd2){return _[_0xb814('0x6f')](_0x16e21c,[_0xb814('0x2e'),_0xa03cd2])?_0xa03cd2:undefined;})[_0xb814('0x70')]()[_0xb814('0x5c')]();if(!_['isEmpty'](_0x37e9c5)){_0x37e9c5[_0xb814('0x33')](function(_0x51ca51){if(_0x51ca51===_0xb814('0x71')){_0x4c08d6[_0xb814('0x72')](_0xb814('0x73'),[][_0xb814('0x74')](_0x14100d[_0xb814('0x3b')][_0x51ca51]));}else if(_0x51ca51===_0xb814('0x75')){var _0x514dab=JSON[_0xb814('0x76')](_0x14100d[_0xb814('0x3b')][_0x51ca51])['$gte'];var _0x3bb2b4=JSON[_0xb814('0x76')](_0x14100d[_0xb814('0x3b')][_0x51ca51])[_0xb814('0x77')];_0x4c08d6[_0xb814('0x72')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x514dab,_0x3bb2b4);}else{if(_0x14100d[_0xb814('0x3b')][_0x51ca51]==='null'){_0x4c08d6[_0xb814('0x72')]('i.'+_0x51ca51+_0xb814('0x78'));}else{_0x4c08d6[_0xb814('0x72')]('i.'+_0x51ca51+_0xb814('0x79'),_0x14100d[_0xb814('0x3b')][_0x51ca51]);}}});}if(_0x14100d[_0xb814('0x3b')]['read']){if(_0x14100d['query']['read']==0x1){_0x4c08d6[_0xb814('0x5d')]('`unreadMessages`\x20=\x200');}else{_0x4c08d6[_0xb814('0x5d')](_0xb814('0x7a'));}}if(_0x14100d[_0xb814('0x3b')]['tag']){_0x2a422a=_[_0xb814('0x7b')](_0x14100d[_0xb814('0x3b')][_0xb814('0x7c')])?_0x14100d['query'][_0xb814('0x7c')]:new Array(_0x14100d[_0xb814('0x3b')][_0xb814('0x7c')]);_0x2a422a[_0xb814('0x33')](function(_0x555be0){_0x5e6df7['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x555be0+',%');});}if(_0x14100d[_0xb814('0x3b')][_0xb814('0x7d')]){var _0x39863d=_0x14100d[_0xb814('0x3b')][_0xb814('0x7d')][_0xb814('0x7e')]('\x5c','\x5c\x5c')[_0xb814('0x7e')]('\x27\x27',_0xb814('0x7f'));if(qs[_0xb814('0x80')](_0x39863d)){_0x45480e['or'](_0xb814('0x81'),_0x39863d+'%')['or'](_0xb814('0x82'),_0x39863d+'%');}else{_0x45480e['or'](_0xb814('0x83'),qs[_0xb814('0x84')](_0x39863d))['or'](_0xb814('0x85'),_0x39863d+'%');}}}_0x4c08d6[_0xb814('0x72')](_0x45480e);_0x4c08d6['group'](_0xb814('0x86'));var _0x33cfc4={'type':db[_0xb814('0x87')][_0xb814('0x88')][_0xb814('0x89')],'raw':!![]};var _0x283b0f=_0x4c08d6['clone']();_0x283b0f[_0xb814('0x45')]('i.id');_0x283b0f[_0xb814('0x45')](_0xb814('0x8a'),_0xb814('0x5b'));if(_0x16ef82[_0xb814('0x41')]){_0x16ef82[_0xb814('0x41')]['forEach'](function(_0x4c44ee){_0x4c08d6[_0xb814('0x41')]('i.'+_0x4c44ee[0x0],_0x4c44ee[0x1]===_0xb814('0x8b')?![]:!![]);});}if(!_[_0xb814('0x8c')](_0x2a422a)){_0x4c08d6[_0xb814('0x5d')](_0x5e6df7);_0x283b0f['where'](_0xb814('0x8d'),_0x2a422a);}BPromise['resolve']()[_0xb814('0x2b')](function(){if(!_0x32eca6){if(_0x14100d[_0xb814('0x3b')]['WhatsappAccountId']||_0x14100d['query'][_0xb814('0x8e')])return;_0x283b0f['where'](_0xb814('0x8f'));_0x4c08d6[_0xb814('0x72')](_0xb814('0x8f'));return;}return _0x14100d[_0xb814('0x90')][_0xb814('0x91')]({'attributes':['id'],'raw':!![]})[_0xb814('0x2b')](function(_0x40fe4a){if(_['isEmpty'](_0x40fe4a)){_0x283b0f[_0xb814('0x72')]('i.WhatsappAccountId\x20IS\x20NULL');_0x4c08d6[_0xb814('0x72')]('i.WhatsappAccountId\x20IS\x20NULL');}else{_0x283b0f[_0xb814('0x72')](_0xb814('0x73'),_['map'](_0x40fe4a,'id'));_0x4c08d6[_0xb814('0x72')]('i.WhatsappAccountId\x20IN\x20?',_[_0xb814('0x30')](_0x40fe4a,'id'));}});})[_0xb814('0x2b')](function(){db['sequelize']['query'](_0x283b0f[_0xb814('0x92')](),_0x33cfc4)[_0xb814('0x2b')](function(_0x3309c5){_0x43db67[_0xb814('0x93')]=_0x3309c5[_0xb814('0x3e')];if(_0x43db67[_0xb814('0x93')]===0x0)return[];return db[_0xb814('0x94')][_0xb814('0x3b')](_0x44ff56[_0xb814('0x92')](),_0x33cfc4)[_0xb814('0x2b')](function(_0x53e705){_0x411723=_['keyBy'](_0x53e705,'id');_0x33cfc4=_['merge'](_0x33cfc4,{'model':db['WhatsappInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x14100d['query'][_0xb814('0x95')]){_0x16ef82[_0xb814('0x3d')][_0xb814('0x33')](function(_0x59f3ff){_0x4c08d6[_0xb814('0x45')]('i.'+_0x59f3ff);});}else{_0x4c08d6[_0xb814('0x45')](_0xb814('0x8a'),_0xb814('0x5b'));_0x4c08d6[_0xb814('0x45')](_0xb814('0x96'),_0xb814('0x97'));_0x4c08d6[_0xb814('0x45')]('a.mandatoryDisposition',_0xb814('0x98'));_0x4c08d6[_0xb814('0x45')](_0xb814('0x99'));_0x4c08d6[_0xb814('0x45')]('c.firstName',_0xb814('0x9a'));_0x4c08d6[_0xb814('0x45')](_0xb814('0x9b'),_0xb814('0x9c'));_0x4c08d6[_0xb814('0x45')]('c.email','Contact.email');_0x4c08d6[_0xb814('0x45')]('c.phone',_0xb814('0x9d'));_0x4c08d6[_0xb814('0x45')]('c.mobile',_0xb814('0x9e'));_0x4c08d6['field'](_0xb814('0x9f'),'Contact.fax');_0x4c08d6[_0xb814('0x45')](_0xb814('0xa0'),_0xb814('0xa1'));_0x4c08d6[_0xb814('0x45')](_0xb814('0xa2'),_0xb814('0xa3'));_0x4c08d6[_0xb814('0x45')]('GROUP_CONCAT(DISTINCT\x20t.id)','TagIds');}if(_0x16ef82[_0xb814('0x40')])_0x4c08d6['limit'](_0x16ef82['limit']);if(_0x16ef82[_0xb814('0x24')])_0x4c08d6[_0xb814('0x24')](_0x16ef82[_0xb814('0x24')]);return db['sequelize'][_0xb814('0x3b')](_0x4c08d6['toString'](),_0x33cfc4);})[_0xb814('0x2b')](function(_0x19d508){_0x450a08[_0xb814('0x72')](_0xb814('0xa4'),_['map'](_0x19d508,'id'));return db[_0xb814('0x94')][_0xb814('0x3b')](_0x450a08[_0xb814('0x92')](),_0x33cfc4)['then'](function(_0x1ebbf6){var _0x3fc77d=_[_0xb814('0xa5')](_0x1ebbf6,'WhatsappInteractionId');var _0x5d8626=[];_0x19d508[_0xb814('0x33')](function(_0x9dc06b){_0x5d8626[_0xb814('0x34')](updateWhatsappInteraction(_0x9dc06b,_0x411723,_0x3fc77d));});return BPromise[_0xb814('0xa6')](_0x5d8626);});});})[_0xb814('0x2b')](function(_0x37a7ab){_0x43db67[_0xb814('0xa7')]=_0x37a7ab;return _0x43db67;})[_0xb814('0x2b')](respondWithFilteredResult(_0x4ff31a,_0x16ef82));})[_0xb814('0x35')](handleError(_0x4ff31a,null));};exports[_0xb814('0xa8')]=function(_0x2569a5,_0x2a13fb){var _0x5b8d2e={'raw':![],'where':{'id':_0x2569a5[_0xb814('0xa9')]['id']}},_0x5416dc={};_0x5416dc['model']=_[_0xb814('0x6e')](db[_0xb814('0xaa')][_0xb814('0x37')]);_0x5416dc[_0xb814('0x3b')]=_[_0xb814('0x6e')](_0x2569a5[_0xb814('0x3b')]);_0x5416dc[_0xb814('0x43')]=_['intersection'](_0x5416dc['model'],_0x5416dc[_0xb814('0x3b')]);_0x5b8d2e['attributes']=_[_0xb814('0x3c')](_0x5416dc[_0xb814('0x3a')],qs[_0xb814('0x95')](_0x2569a5['query'][_0xb814('0x95')]));_0x5b8d2e[_0xb814('0x3d')]=_0x5b8d2e[_0xb814('0x3d')][_0xb814('0x3e')]?_0x5b8d2e[_0xb814('0x3d')]:_0x5416dc['model'];if(_0x2569a5[_0xb814('0x3b')][_0xb814('0xab')]){_0x5b8d2e['include']=[{'all':!![]}];}_0x5b8d2e=_[_0xb814('0xac')]({},_0x5b8d2e,_0x2569a5[_0xb814('0xad')]);return db[_0xb814('0xaa')]['find'](_0x5b8d2e)[_0xb814('0x2b')](handleEntityNotFound(_0x2a13fb,null))[_0xb814('0x2b')](respondWithResult(_0x2a13fb,null))['catch'](handleError(_0x2a13fb,null));};exports[_0xb814('0xae')]=function(_0x171f83,_0x5b5634){return db[_0xb814('0xaa')][_0xb814('0xae')](_0x171f83[_0xb814('0x6d')],{})[_0xb814('0x2b')](respondWithResult(_0x5b5634,0xc9))[_0xb814('0x35')](handleError(_0x5b5634,null));};exports[_0xb814('0x29')]=function(_0x40ae0b,_0x336a8f){if(_0x40ae0b[_0xb814('0x6d')]['id']){delete _0x40ae0b[_0xb814('0x6d')]['id'];}return db[_0xb814('0xaa')][_0xb814('0x6b')]({'where':{'id':_0x40ae0b['params']['id']}})['then'](handleEntityNotFound(_0x336a8f,null))[_0xb814('0x2b')](saveUpdates(_0x40ae0b['body'],null))['then'](respondWithResult(_0x336a8f,null))[_0xb814('0x35')](handleError(_0x336a8f,null));};exports['destroy']=function(_0x4f0427,_0x50cb34){return db[_0xb814('0xaa')][_0xb814('0x6b')]({'where':{'id':_0x4f0427[_0xb814('0xa9')]['id']}})['then'](handleEntityNotFound(_0x50cb34,null))[_0xb814('0x2b')](removeEntity(_0x50cb34,null))['catch'](handleError(_0x50cb34,null));};exports[_0xb814('0xaf')]=function(_0x2e6660,_0x49a8de){return db[_0xb814('0xaa')]['describe']()[_0xb814('0x2b')](respondWithResult(_0x49a8de,null))[_0xb814('0x35')](handleError(_0x49a8de,null));};exports[_0xb814('0xb0')]=function(_0x39ce17,_0x11efb8,_0xaf705d){return db[_0xb814('0xb1')][_0xb814('0x6b')]({'where':{'id':_0x39ce17[_0xb814('0xa9')]['id']}})[_0xb814('0x2b')](handleEntityNotFound(_0x11efb8,null))[_0xb814('0x2b')](function(_0x3e7a9a){if(_0x3e7a9a){return _0x3e7a9a[_0xb814('0xb0')](_0x39ce17[_0xb814('0x6d')][_0xb814('0xb2')],_['omit'](_0x39ce17[_0xb814('0x6d')],[_0xb814('0xb2'),'id'])||{});}})['then'](respondWithResult(_0x11efb8,null))[_0xb814('0x35')](handleError(_0x11efb8,null));};exports[_0xb814('0xb3')]=function(_0x1868d9,_0x570191,_0x56b2aa){var _0x473b30={'raw':![],'where':{}};var _0x4af71e={};var _0x2d40e6={'count':0x0,'rows':[]};return db['WhatsappInteraction'][_0xb814('0xb4')]({'where':{'id':_0x1868d9['params']['id']}})['then'](handleEntityNotFound(_0x570191,null))[_0xb814('0x2b')](function(_0x32c956){if(_0x32c956){_0x4af71e[_0xb814('0x3a')]=_[_0xb814('0x6e')](db[_0xb814('0xb1')][_0xb814('0x37')]);_0x4af71e[_0xb814('0x3b')]=_[_0xb814('0x6e')](_0x1868d9[_0xb814('0x3b')]);_0x4af71e[_0xb814('0x43')]=_[_0xb814('0x3c')](_0x4af71e['model'],_0x4af71e[_0xb814('0x3b')]);_0x473b30['attributes']=_[_0xb814('0x3c')](_0x4af71e[_0xb814('0x3a')],qs[_0xb814('0x95')](_0x1868d9['query'][_0xb814('0x95')]));_0x473b30[_0xb814('0x3d')]=_0x473b30[_0xb814('0x3d')][_0xb814('0x3e')]?_0x473b30[_0xb814('0x3d')]:_0x4af71e[_0xb814('0x3a')];if(!_0x1868d9[_0xb814('0x3b')][_0xb814('0xb5')](_0xb814('0x3f'))){_0x473b30[_0xb814('0x40')]=qs[_0xb814('0x40')](_0x1868d9[_0xb814('0x3b')][_0xb814('0x40')]);_0x473b30[_0xb814('0x24')]=qs[_0xb814('0x24')](_0x1868d9['query'][_0xb814('0x24')]);}_0x473b30[_0xb814('0x41')]=qs[_0xb814('0x42')](_0x1868d9['query']['sort']);_0x473b30[_0xb814('0x72')]=qs['filters'](_['pick'](_0x1868d9['query'],_0x4af71e['filters']));_0x473b30[_0xb814('0x72')][_0xb814('0xb6')]=_0x32c956['id'];if(_0x1868d9['query'][_0xb814('0x7d')]){_0x473b30[_0xb814('0x72')]=_[_0xb814('0xac')](_0x473b30[_0xb814('0x72')],{'$or':_[_0xb814('0x30')](_0x473b30[_0xb814('0x3d')],function(_0x20e608){var _0x7b9948={};_0x7b9948[_0x20e608]={'$like':'%'+_0x1868d9[_0xb814('0x3b')][_0xb814('0x7d')]+'%'};return _0x7b9948;})});}if(_0x1868d9[_0xb814('0x3b')]['$gte']){var _0x2a5dff=_0x1868d9['query'][_0xb814('0xb7')][_0xb814('0x32')](',');var _0x35e8f7={};_0x35e8f7[_0x2a5dff[0x0]]={'$gte':moment(_0x2a5dff[0x1])[_0xb814('0xb8')](_0xb814('0xb9'))};_0x473b30[_0xb814('0x72')]=_[_0xb814('0xac')](_0x473b30[_0xb814('0x72')],_0x35e8f7);}_0x473b30=_['merge']({},_0x473b30,_0x1868d9['options']);return db['WhatsappMessage'][_0xb814('0x93')]({'where':_0x473b30[_0xb814('0x72')]})[_0xb814('0x2b')](function(_0x3b7bee){_0x2d40e6[_0xb814('0x93')]=_0x3b7bee;if(_0x1868d9[_0xb814('0x3b')][_0xb814('0xab')]){_0x473b30[_0xb814('0xba')]=[{'all':!![]}];}return db[_0xb814('0xb1')][_0xb814('0xbb')](_0x473b30);})['then'](function(_0x5c989a){_0x2d40e6[_0xb814('0xa7')]=_0x5c989a;return _0x2d40e6;});}})[_0xb814('0x2b')](respondWithFilteredResult(_0x570191,_0x473b30))[_0xb814('0x35')](handleError(_0x570191,null));};exports[_0xb814('0xbc')]=function(_0x3f0c9c,_0x2642ab,_0x48358c){return db[_0xb814('0xaa')]['find']({'where':{'id':_0x3f0c9c[_0xb814('0xa9')]['id']}})[_0xb814('0x2b')](handleEntityNotFound(_0x2642ab,null))[_0xb814('0x2b')](function(_0x94aa05){if(_0x94aa05){return _0x94aa05[_0xb814('0xbd')](_0x3f0c9c[_0xb814('0x6d')][_0xb814('0xb2')],_['omit'](_0x3f0c9c[_0xb814('0x6d')],[_0xb814('0xb2'),'id'])||{})[_0xb814('0xbe')](function(){return db[_0xb814('0x67')]['findAll']({'attributes':['id',_0xb814('0x2e'),_0xb814('0x46')],'where':{'id':_0x3f0c9c[_0xb814('0x6d')][_0xb814('0xb2')]}});})[_0xb814('0x2b')](function(_0x4a2aa5){socket[_0xb814('0xbf')](_0xb814('0xc0'),{'id':Number(_0x3f0c9c[_0xb814('0xa9')]['id']),'tags':_0x4a2aa5||[]});return{'id':Number(_0x3f0c9c['params']['id']),'tags':_0x4a2aa5||[]};});}})[_0xb814('0x2b')](respondWithResult(_0x2642ab,null))['catch'](handleError(_0x2642ab,null));};exports[_0xb814('0xc1')]=function(_0x5b4315,_0x22f6f1,_0x3467bd){return db[_0xb814('0xaa')][_0xb814('0x6b')]({'where':{'id':_0x5b4315['params']['id']}})[_0xb814('0x2b')](handleEntityNotFound(_0x22f6f1,null))[_0xb814('0x2b')](function(_0x3fda0d){if(_0x3fda0d){return _0x3fda0d[_0xb814('0xc1')](_0x5b4315[_0xb814('0x3b')][_0xb814('0xb2')]);}})[_0xb814('0x2b')](respondWithStatusCode(_0x22f6f1,null))[_0xb814('0x35')](handleError(_0x22f6f1,null));};exports[_0xb814('0xc2')]=function(_0x152260,_0x3bc03a){var _0x368696=moment()[_0xb814('0xc3')]()[_0xb814('0x92')]();var _0x8e882a=path['join'](config[_0xb814('0xc4')],_0xb814('0xc5'),_0xb814('0xc6'),_0xb814('0xc7'));var _0x4017b6=path[_0xb814('0xc8')](config['root'],_0xb814('0xc5'),_0xb814('0xc6'),_0xb814('0xc9'));var _0x31b4f5=path['join'](_0x8e882a,_0x368696);var _0x5b5a26=util[_0xb814('0xb8')](_0xb814('0xca'),_0x152260[_0xb814('0xa9')]['id'],_0x368696);var _0x667ca1=path[_0xb814('0xc8')](_0x8e882a,_0x5b5a26);var _0x2c510a=[];_0x2c510a['push']({'model':db[_0xb814('0xcb')],'as':_0xb814('0xcb'),'attributes':['id',_0xb814('0xcc')],'raw':!![]});_0x2c510a[_0xb814('0x34')]({'model':db['CmContact'],'as':_0xb814('0xcd'),'attributes':['id',_0xb814('0xce'),_0xb814('0xcf')],'raw':!![]});if(_0x152260[_0xb814('0x3b')][_0xb814('0xc9')]){_0x2c510a['push']({'model':db[_0xb814('0xd0')],'as':_0xb814('0xd0'),'raw':!![]});}var _0x371dd7=[{'model':db[_0xb814('0xb1')],'as':_0xb814('0xd1'),'attributes':['id',_0xb814('0x6d'),_0xb814('0x75'),_0xb814('0xd2'),_0xb814('0xd3'),_0xb814('0xd4')],'include':_0x2c510a}];_0x371dd7[_0xb814('0x34')]({'model':db[_0xb814('0xd5')],'as':_0xb814('0xd6'),'attributes':['id','name']});_0x371dd7['push']({'model':db[_0xb814('0xcb')],'as':_0xb814('0xd7'),'attributes':['id',_0xb814('0xcc')]});return db['WhatsappInteraction'][_0xb814('0x6b')]({'where':{'id':_0x152260[_0xb814('0xa9')]['id']},'include':_0x371dd7})[_0xb814('0x2b')](handleEntityNotFound(_0x3bc03a,null))['then'](function(_0x10537d){if(_0x10537d){var _0xa651a=_0x10537d[_0xb814('0xd8')]({'plain':!![]});fs[_0xb814('0xd9')](_0x31b4f5);var _0x6ec0f5={'format':'A4','border':_0xb814('0xda'),'header':{'height':'40px','contents':{'first':_0xb814('0xdb')}},'footer':{'height':'30px','contents':{'default':util[_0xb814('0xb8')]('\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',util[_0xb814('0xb8')](_0xb814('0xdc'),_0xb814('0xdd'),_0xa651a['id']),moment()['format'](_0xb814('0xde'))[_0xb814('0x92')]())}}};var _0x164304={'channel':'Whatsapp','account':_0xa651a[_0xb814('0xd6')]['name'],'agent':_0xa651a[_0xb814('0xd7')]?_0xa651a[_0xb814('0xd7')][_0xb814('0xcc')]:'N.A.','createdAt':moment(_0xa651a[_0xb814('0x75')])[_0xb814('0xb8')](_0xb814('0xb9'))[_0xb814('0x92')](),'closedAt':_0xa651a['closed']?moment(_0xa651a[_0xb814('0xdf')])[_0xb814('0xb8')](_0xb814('0xb9'))[_0xb814('0x92')]():'','disposition':_0xa651a[_0xb814('0xe0')],'messages':_(_0xa651a[_0xb814('0xd1')])[_0xb814('0x7d')]({'secret':![]})[_0xb814('0x30')](function(_0x9a33d0){if(_0x9a33d0['Attachment']){var _0x2fe47b=path[_0xb814('0xc8')](_0x4017b6,_0x9a33d0[_0xb814('0xd0')]['basename']);if(fs[_0xb814('0xe1')](_0x2fe47b)){fs['createReadStream'](_0x2fe47b)['pipe'](fs['createWriteStream'](path[_0xb814('0xc8')](_0x31b4f5,_0x9a33d0['Attachment'][_0xb814('0xe2')])));}}return{'date':moment(_0x9a33d0[_0xb814('0x75')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0xb814('0x92')](),'sender':_0x9a33d0['direction']===_0xb814('0xe3')?_0x9a33d0['User']?_0x9a33d0[_0xb814('0xcb')][_0xb814('0xcc')]:_0xb814('0xe4'):_0x9a33d0['Contact']['firstName']+(_0x9a33d0['Contact'][_0xb814('0xcf')]?'\x20'+_0x9a33d0['Contact']['lastName']:''),'body':_0x9a33d0[_0xb814('0xd0')]?_0x9a33d0['Attachment']['basename']:_0x9a33d0['body'],'direction':_0x9a33d0[_0xb814('0xd2')]===_0xb814('0xe3')?'A':'C','secret':_0x9a33d0[_0xb814('0xd3')],'read':_0x9a33d0['read'],'attachment':_0x9a33d0[_0xb814('0xd0')]};})[_0xb814('0x5c')]()};return ejs[_0xb814('0xe5')](path[_0xb814('0xc8')](config[_0xb814('0xc4')],_0xb814('0xc5'),'views',_0xb814('0xe6')),{'interaction':_0x164304})[_0xb814('0x2b')](function(_0x28b818){return new BPromise(function(_0x171845,_0x4f2db2){pdf[_0xb814('0xae')](_0x28b818,_0x6ec0f5)[_0xb814('0xe7')](path[_0xb814('0xc8')](_0x31b4f5,_0xb814('0xe8')+_0xa651a['id']+'-'+_0x368696+_0xb814('0xe9')),function(_0x2cb01d,_0x1f4540){if(_0x2cb01d)return _0x4f2db2(_0x2cb01d);_0x171845(_0x1f4540);});});})[_0xb814('0x2b')](function(){return new BPromise(function(_0x81ebc0,_0x2e7959){zipdir(_0x31b4f5,{'saveTo':_0x667ca1},function(_0x47f054,_0x1aa70b){if(_0x47f054)return _0x2e7959(_0x47f054);return _0x81ebc0(_0x1aa70b);});})[_0xb814('0x2b')](function(){return new BPromise(function(_0x5706ad,_0x3b8438){rimraf(_0x31b4f5,function(_0x56e231){if(_0x56e231)_0x3b8438(_0x56e231);return _0x5706ad();});});})[_0xb814('0x2b')](function(){return _0x3bc03a[_0xb814('0xc2')](_0x667ca1,_0x5b5a26,function(_0x5e2273){if(_0x5e2273){console[_0xb814('0xea')]('err',_0x5e2273);}else{fs[_0xb814('0xeb')](_0x667ca1);}});});});}else{return _0x3bc03a[_0xb814('0x20')](0xc8);}})[_0xb814('0x35')](handleError(_0x3bc03a,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index 7d12b03..822226a 100644 --- a/server/api/whatsappInteraction/whatsappInteraction.events.js +++ b/server/api/whatsappInteraction/whatsappInteraction.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x686c=['hasOwnProperty','exports','events','WhatsappInteraction','../../mysqldb','save','getUsers','then','setDataValue','Users','map','unreadMessages','emit','catch'];(function(_0x4c321c,_0x3e9da0){var _0x25accb=function(_0x21bf7a){while(--_0x21bf7a){_0x4c321c['push'](_0x4c321c['shift']());}};_0x25accb(++_0x3e9da0);}(_0x686c,0x1de));var _0xc686=function(_0x128006,_0x3068c8){_0x128006=_0x128006-0x0;var _0x2279df=_0x686c[_0x128006];return _0x2279df;};'use strict';var EventEmitter=require(_0xc686('0x0'));var WhatsappInteraction=require('../../mysqldb')['db'][_0xc686('0x1')];var WhatsappMessage=require(_0xc686('0x2'))['db']['WhatsappMessage'];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xc686('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x58d145){return function(_0x85f306,_0x440e98,_0x4caa2){_0x85f306[_0xc686('0x4')]({'attributes':['id'],'raw':!![]})[_0xc686('0x5')](function(_0x3ec3fc){_0x85f306[_0xc686('0x6')](_0xc686('0x7'),_0x3ec3fc[_0xc686('0x8')](function(_0x1b9f2a){return{'id':_0x1b9f2a['id']};}));return WhatsappMessage['findAll']({'where':{'WhatsappInteractionId':_0x85f306['id'],'direction':'in','read':![]},'raw':!![]});})[_0xc686('0x5')](function(_0x27281a){_0x85f306[_0xc686('0x6')](_0xc686('0x9'),_0x27281a['length']);WhatsappInteractionEvents[_0xc686('0xa')](_0x58d145+':'+_0x85f306['id'],_0x85f306);WhatsappInteractionEvents[_0xc686('0xa')](_0x58d145,_0x85f306);_0x4caa2(null);})[_0xc686('0xb')](_0x4caa2(null));};}for(var e in events){if(events[_0xc686('0xc')](e)){var event=events[e];WhatsappInteraction['hook'](e,emitEvent(event));}}module[_0xc686('0xd')]=WhatsappInteractionEvents; \ No newline at end of file +var _0xfa3f=['WhatsappMessage','update','remove','getUsers','Users','map','findAll','then','length','emit','catch','hasOwnProperty','exports','events','../../mysqldb','WhatsappInteraction'];(function(_0x32a2bd,_0x318c64){var _0x419a59=function(_0x59d26a){while(--_0x59d26a){_0x32a2bd['push'](_0x32a2bd['shift']());}};_0x419a59(++_0x318c64);}(_0xfa3f,0x1dd));var _0xffa3=function(_0x456c98,_0xf2c4cf){_0x456c98=_0x456c98-0x0;var _0x4d0e60=_0xfa3f[_0x456c98];return _0x4d0e60;};'use strict';var EventEmitter=require(_0xffa3('0x0'));var WhatsappInteraction=require(_0xffa3('0x1'))['db'][_0xffa3('0x2')];var WhatsappMessage=require('../../mysqldb')['db'][_0xffa3('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xffa3('0x4'),'afterDestroy':_0xffa3('0x5')};function emitEvent(_0x27764b){return function(_0x704672,_0x2a8955,_0x5c679c){_0x704672[_0xffa3('0x6')]({'attributes':['id'],'raw':!![]})['then'](function(_0x21ac9c){_0x704672['setDataValue'](_0xffa3('0x7'),_0x21ac9c[_0xffa3('0x8')](function(_0x38f4c4){return{'id':_0x38f4c4['id']};}));return WhatsappMessage[_0xffa3('0x9')]({'where':{'WhatsappInteractionId':_0x704672['id'],'direction':'in','read':![]},'raw':!![]});})[_0xffa3('0xa')](function(_0x4c6759){_0x704672['setDataValue']('unreadMessages',_0x4c6759[_0xffa3('0xb')]);WhatsappInteractionEvents[_0xffa3('0xc')](_0x27764b+':'+_0x704672['id'],_0x704672);WhatsappInteractionEvents[_0xffa3('0xc')](_0x27764b,_0x704672);_0x5c679c(null);})[_0xffa3('0xd')](_0x5c679c(null));};}for(var e in events){if(events[_0xffa3('0xe')](e)){var event=events[e];WhatsappInteraction['hook'](e,emitEvent(event));}}module[_0xffa3('0xf')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index eacaac1..0079676 100644 --- a/server/api/whatsappInteraction/whatsappInteraction.model.js +++ b/server/api/whatsappInteraction/whatsappInteraction.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x99dc=['changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./whatsappInteraction.attributes','exports','define','WhatsappInteraction'];(function(_0x230b43,_0x144f5e){var _0x57ee16=function(_0x543c00){while(--_0x543c00){_0x230b43['push'](_0x230b43['shift']());}};_0x57ee16(++_0x144f5e);}(_0x99dc,0x114));var _0xc99d=function(_0x4e9628,_0x250573){_0x4e9628=_0x4e9628-0x0;var _0x27bc8c=_0x99dc[_0x4e9628];return _0x27bc8c;};'use strict';var _=require(_0xc99d('0x0'));var util=require(_0xc99d('0x1'));var logger=require('../../config/logger')(_0xc99d('0x2'));var moment=require(_0xc99d('0x3'));var BPromise=require(_0xc99d('0x4'));var rp=require(_0xc99d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc99d('0x6'));var config=require(_0xc99d('0x7'));var attributes=require(_0xc99d('0x8'));module[_0xc99d('0x9')]=function(_0x415bd6,_0x1fe93b){return _0x415bd6[_0xc99d('0xa')](_0xc99d('0xb'),attributes,{'tableName':'whatsapp_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1c9edf,_0x5d6150,_0x383348){if(_0x1c9edf[_0xc99d('0xc')]('closed')){_0x1c9edf[_0xc99d('0xd')]=moment()[_0xc99d('0xe')](_0xc99d('0xf'));}_0x383348(null,_0x1c9edf);}}});}; \ No newline at end of file +var _0xc1f2=['define','changed','closed','closedAt','format','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./whatsappInteraction.attributes','exports'];(function(_0x315e10,_0x1ee1c5){var _0x4377ff=function(_0x18f3a1){while(--_0x18f3a1){_0x315e10['push'](_0x315e10['shift']());}};_0x4377ff(++_0x1ee1c5);}(_0xc1f2,0x7d));var _0x2c1f=function(_0x5e9716,_0x5ac708){_0x5e9716=_0x5e9716-0x0;var _0x2f8259=_0xc1f2[_0x5e9716];return _0x2f8259;};'use strict';var _=require(_0x2c1f('0x0'));var util=require(_0x2c1f('0x1'));var logger=require(_0x2c1f('0x2'))(_0x2c1f('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x2c1f('0x4'));var fs=require('fs');var path=require(_0x2c1f('0x5'));var rimraf=require(_0x2c1f('0x6'));var config=require(_0x2c1f('0x7'));var attributes=require(_0x2c1f('0x8'));module[_0x2c1f('0x9')]=function(_0x301bdd,_0x3c357d){return _0x301bdd[_0x2c1f('0xa')]('WhatsappInteraction',attributes,{'tableName':'whatsapp_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x24a6a9,_0x24995,_0x3e6791){if(_0x24a6a9[_0x2c1f('0xb')](_0x2c1f('0xc'))){_0x24a6a9[_0x2c1f('0xd')]=moment()[_0x2c1f('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}_0x3e6791(null,_0x24a6a9);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index d80b7f2..6671d7c 100644 --- a/server/api/whatsappInteraction/whatsappInteraction.rpc.js +++ b/server/api/whatsappInteraction/whatsappInteraction.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8069=['message','catch','UpdateWhatsappInteraction','WhatsappInteraction','options','attributes','limit','AddTagsToWhatsappInteraction','find','where','addTags','body','omit','ids','spread','info','AddTags','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','jayson/promise','client','http','redis','localhost','then','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','code','error'];(function(_0x4651d2,_0x144909){var _0x48aa49=function(_0x178185){while(--_0x178185){_0x4651d2['push'](_0x4651d2['shift']());}};_0x48aa49(++_0x144909);}(_0x8069,0x114));var _0x9806=function(_0x24c918,_0x4a8aa8){_0x24c918=_0x24c918-0x0;var _0x5678e6=_0x8069[_0x24c918];return _0x5678e6;};'use strict';var _=require(_0x9806('0x0'));var util=require(_0x9806('0x1'));var moment=require(_0x9806('0x2'));var BPromise=require(_0x9806('0x3'));var rs=require(_0x9806('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x9806('0x5'));var logger=require(_0x9806('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x9806('0x7'));var client=jayson[_0x9806('0x8')][_0x9806('0x9')]({'port':0x232a});config['redis']=_['defaults'](config[_0x9806('0xa')],{'host':_0x9806('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./whatsappInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x5a93b4,_0x363af0,_0x281ef7){return new BPromise(function(_0x657e27,_0xab1e6f){return client['request'](_0x5a93b4,_0x281ef7)[_0x9806('0xc')](function(_0x4821b8){logger['info'](_0x9806('0xd'),_0x363af0,_0x9806('0xe'));logger[_0x9806('0xf')](_0x9806('0x10'),_0x363af0,'request\x20sent',JSON[_0x9806('0x11')](_0x4821b8));if(_0x4821b8['error']){if(_0x4821b8['error'][_0x9806('0x12')]===0x1f4){logger['error']('WhatsappInteraction,\x20%s,\x20%s',_0x363af0,_0x4821b8[_0x9806('0x13')]['message']);return _0xab1e6f(_0x4821b8[_0x9806('0x13')][_0x9806('0x14')]);}logger[_0x9806('0x13')](_0x9806('0xd'),_0x363af0,_0x4821b8[_0x9806('0x13')]['message']);return _0x657e27(_0x4821b8[_0x9806('0x13')][_0x9806('0x14')]);}else{logger['info'](_0x9806('0xd'),_0x363af0,_0x9806('0xe'));_0x657e27(_0x4821b8['result'][_0x9806('0x14')]);}})[_0x9806('0x15')](function(_0x5e324b){logger['error']('WhatsappInteraction,\x20%s,\x20%s',_0x363af0,_0x5e324b);_0xab1e6f(_0x5e324b);});});}exports[_0x9806('0x16')]=function(_0x126831){var _0x30e049=this;return new Promise(function(_0x1b2e47,_0x462355){return db[_0x9806('0x17')]['update'](_0x126831['body'],{'raw':_0x126831[_0x9806('0x18')]?_0x126831[_0x9806('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x126831[_0x9806('0x18')]?_0x126831[_0x9806('0x18')]['where']||null:null,'attributes':_0x126831[_0x9806('0x18')]?_0x126831[_0x9806('0x18')][_0x9806('0x19')]||null:null,'limit':_0x126831[_0x9806('0x18')]?_0x126831['options'][_0x9806('0x1a')]||null:null})[_0x9806('0xc')](function(_0x478126){logger['info']('UpdateWhatsappInteraction',_0x126831);logger['debug'](_0x9806('0x16'),_0x126831,JSON[_0x9806('0x11')](_0x478126));_0x1b2e47(_0x478126);})[_0x9806('0x15')](function(_0x4d1d1c){logger[_0x9806('0x13')](_0x9806('0x16'),_0x4d1d1c[_0x9806('0x14')],_0x126831);_0x462355(_0x30e049[_0x9806('0x13')](0x1f4,_0x4d1d1c[_0x9806('0x14')]));});});};exports[_0x9806('0x1b')]=function(_0x34b147){return new Promise(function(_0x1d232b,_0x47b54c){return db['WhatsappInteraction'][_0x9806('0x1c')]({'where':_0x34b147[_0x9806('0x18')]?_0x34b147[_0x9806('0x18')][_0x9806('0x1d')]||null:null})[_0x9806('0xc')](function(_0x14e43b){if(_0x14e43b){return _0x14e43b[_0x9806('0x1e')](_0x34b147[_0x9806('0x1f')]['ids'],_[_0x9806('0x20')](_0x34b147[_0x9806('0x1f')],[_0x9806('0x21'),'id'])||{});}})[_0x9806('0x22')](function(_0x598fb7){logger[_0x9806('0x23')](_0x9806('0x24'),_0x34b147);logger['debug'](_0x9806('0x24'),_0x34b147,JSON[_0x9806('0x11')](_0x598fb7));_0x1d232b(_0x598fb7);})[_0x9806('0x15')](function(_0x51d73f){logger[_0x9806('0x13')](_0x9806('0x24'),_0x51d73f[_0x9806('0x14')],_0x34b147);_0x47b54c(_this[_0x9806('0x13')](0x1f4,_0x51d73f[_0x9806('0x14')]));});});}; \ No newline at end of file +var _0xdd43=['info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','UpdateWhatsappInteraction','WhatsappInteraction','update','body','options','raw','where','attributes','limit','catch','AddTagsToWhatsappInteraction','find','addTags','omit','spread','AddTags','lodash','util','moment','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','http','redis','defaults','socket.io-emitter','./whatsappInteraction.socket','register','request','then'];(function(_0x409cd5,_0x460355){var _0x282ab9=function(_0x2b5b37){while(--_0x2b5b37){_0x409cd5['push'](_0x409cd5['shift']());}};_0x282ab9(++_0x460355);}(_0xdd43,0x161));var _0x3dd4=function(_0x39491c,_0x3d363d){_0x39491c=_0x39491c-0x0;var _0x2e41b7=_0xdd43[_0x39491c];return _0x2e41b7;};'use strict';var _=require(_0x3dd4('0x0'));var util=require(_0x3dd4('0x1'));var moment=require(_0x3dd4('0x2'));var BPromise=require('bluebird');var rs=require(_0x3dd4('0x3'));var fs=require('fs');var Redis=require(_0x3dd4('0x4'));var db=require(_0x3dd4('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x3dd4('0x6'));var config=require('../../config/environment');var jayson=require(_0x3dd4('0x7'));var client=jayson['client'][_0x3dd4('0x8')]({'port':0x232a});config[_0x3dd4('0x9')]=_[_0x3dd4('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x3dd4('0xb'))(new Redis(config['redis']));require(_0x3dd4('0xc'))[_0x3dd4('0xd')](socket);function respondWithRpcPromise(_0x276731,_0x4a0ddf,_0x138e2a){return new BPromise(function(_0x31aa1c,_0x4c7ccf){return client[_0x3dd4('0xe')](_0x276731,_0x138e2a)[_0x3dd4('0xf')](function(_0x527b0a){logger[_0x3dd4('0x10')](_0x3dd4('0x11'),_0x4a0ddf,_0x3dd4('0x12'));logger[_0x3dd4('0x13')]('WhatsappInteraction,\x20%s,\x20%s,\x20%s',_0x4a0ddf,_0x3dd4('0x12'),JSON[_0x3dd4('0x14')](_0x527b0a));if(_0x527b0a['error']){if(_0x527b0a[_0x3dd4('0x15')][_0x3dd4('0x16')]===0x1f4){logger['error'](_0x3dd4('0x11'),_0x4a0ddf,_0x527b0a[_0x3dd4('0x15')][_0x3dd4('0x17')]);return _0x4c7ccf(_0x527b0a[_0x3dd4('0x15')][_0x3dd4('0x17')]);}logger[_0x3dd4('0x15')](_0x3dd4('0x11'),_0x4a0ddf,_0x527b0a['error'][_0x3dd4('0x17')]);return _0x31aa1c(_0x527b0a[_0x3dd4('0x15')][_0x3dd4('0x17')]);}else{logger[_0x3dd4('0x10')](_0x3dd4('0x11'),_0x4a0ddf,_0x3dd4('0x12'));_0x31aa1c(_0x527b0a[_0x3dd4('0x18')][_0x3dd4('0x17')]);}})['catch'](function(_0x32f969){logger[_0x3dd4('0x15')]('WhatsappInteraction,\x20%s,\x20%s',_0x4a0ddf,_0x32f969);_0x4c7ccf(_0x32f969);});});}exports[_0x3dd4('0x19')]=function(_0x15b15c){var _0x5891f=this;return new Promise(function(_0x36e64d,_0x3b254c){return db[_0x3dd4('0x1a')][_0x3dd4('0x1b')](_0x15b15c[_0x3dd4('0x1c')],{'raw':_0x15b15c[_0x3dd4('0x1d')]?_0x15b15c[_0x3dd4('0x1d')][_0x3dd4('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x15b15c[_0x3dd4('0x1d')]?_0x15b15c[_0x3dd4('0x1d')][_0x3dd4('0x1f')]||null:null,'attributes':_0x15b15c['options']?_0x15b15c[_0x3dd4('0x1d')][_0x3dd4('0x20')]||null:null,'limit':_0x15b15c['options']?_0x15b15c['options'][_0x3dd4('0x21')]||null:null})[_0x3dd4('0xf')](function(_0x38889d){logger[_0x3dd4('0x10')](_0x3dd4('0x19'),_0x15b15c);logger[_0x3dd4('0x13')](_0x3dd4('0x19'),_0x15b15c,JSON[_0x3dd4('0x14')](_0x38889d));_0x36e64d(_0x38889d);})[_0x3dd4('0x22')](function(_0x42f96e){logger[_0x3dd4('0x15')]('UpdateWhatsappInteraction',_0x42f96e[_0x3dd4('0x17')],_0x15b15c);_0x3b254c(_0x5891f[_0x3dd4('0x15')](0x1f4,_0x42f96e[_0x3dd4('0x17')]));});});};exports[_0x3dd4('0x23')]=function(_0xf37480){return new Promise(function(_0x17533c,_0x162658){return db[_0x3dd4('0x1a')][_0x3dd4('0x24')]({'where':_0xf37480[_0x3dd4('0x1d')]?_0xf37480['options']['where']||null:null})[_0x3dd4('0xf')](function(_0x4b8ea2){if(_0x4b8ea2){return _0x4b8ea2[_0x3dd4('0x25')](_0xf37480[_0x3dd4('0x1c')]['ids'],_[_0x3dd4('0x26')](_0xf37480[_0x3dd4('0x1c')],['ids','id'])||{});}})[_0x3dd4('0x27')](function(_0x115278){logger['info'](_0x3dd4('0x28'),_0xf37480);logger['debug'](_0x3dd4('0x28'),_0xf37480,JSON[_0x3dd4('0x14')](_0x115278));_0x17533c(_0x115278);})[_0x3dd4('0x22')](function(_0x434500){logger['error'](_0x3dd4('0x28'),_0x434500[_0x3dd4('0x17')],_0xf37480);_0x162658(_this[_0x3dd4('0x15')](0x1f4,_0x434500[_0x3dd4('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index ead3985..ce472ca 100644 --- a/server/api/whatsappInteraction/whatsappInteraction.socket.js +++ b/server/api/whatsappInteraction/whatsappInteraction.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb57c=['update','emit','removeListener','register','length','remove'];(function(_0x116482,_0x2438c5){var _0x23c467=function(_0x18c6c8){while(--_0x18c6c8){_0x116482['push'](_0x116482['shift']());}};_0x23c467(++_0x2438c5);}(_0xb57c,0x1c7));var _0xcb57=function(_0x5f40c2,_0xdecacf){_0x5f40c2=_0x5f40c2-0x0;var _0x70a2ea=_0xb57c[_0x5f40c2];return _0x70a2ea;};'use strict';var WhatsappInteractionEvents=require('./whatsappInteraction.events');var events=['save',_0xcb57('0x0'),_0xcb57('0x1')];function createListener(_0x16298b,_0x53fd27){return function(_0x5d0f53){_0x53fd27[_0xcb57('0x2')](_0x16298b,_0x5d0f53);};}function removeListener(_0x2570b5,_0x4d341b){return function(){WhatsappInteractionEvents[_0xcb57('0x3')](_0x2570b5,_0x4d341b);};}exports[_0xcb57('0x4')]=function(_0x5765a9){for(var _0x27d69d=0x0,_0x13812a=events[_0xcb57('0x5')];_0x27d69d<_0x13812a;_0x27d69d++){var _0x146d90=events[_0x27d69d];var _0x5186af=createListener('whatsappInteraction:'+_0x146d90,_0x5765a9);WhatsappInteractionEvents['on'](_0x146d90,_0x5186af);}}; \ No newline at end of file +var _0xf89a=['removeListener','register','length','./whatsappInteraction.events','save','update','emit'];(function(_0x564d53,_0x31ac8a){var _0x1ba891=function(_0x51cad3){while(--_0x51cad3){_0x564d53['push'](_0x564d53['shift']());}};_0x1ba891(++_0x31ac8a);}(_0xf89a,0x96));var _0xaf89=function(_0x3696bc,_0x4f7f04){_0x3696bc=_0x3696bc-0x0;var _0x7f1327=_0xf89a[_0x3696bc];return _0x7f1327;};'use strict';var WhatsappInteractionEvents=require(_0xaf89('0x0'));var events=[_0xaf89('0x1'),'remove',_0xaf89('0x2')];function createListener(_0x17d65f,_0x519f5b){return function(_0x1ca8b7){_0x519f5b[_0xaf89('0x3')](_0x17d65f,_0x1ca8b7);};}function removeListener(_0x1356bb,_0x49d573){return function(){WhatsappInteractionEvents[_0xaf89('0x4')](_0x1356bb,_0x49d573);};}exports[_0xaf89('0x5')]=function(_0x284ea7){for(var _0x19f87e=0x0,_0x54e85b=events[_0xaf89('0x6')];_0x19f87e<_0x54e85b;_0x19f87e++){var _0x4a40c0=events[_0x19f87e];var _0x4e156d=createListener('whatsappInteraction:'+_0x4a40c0,_0x284ea7);WhatsappInteractionEvents['on'](_0x4a40c0,_0x4e156d);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index 9ab8508..d52f11f 100644 --- a/server/api/whatsappMessage/index.js +++ b/server/api/whatsappMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1d99=['./whatsappMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','post','tracked','whatsapp','status','update','put','reject','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x4fd68d,_0x33a726){var _0x4643c4=function(_0x59520d){while(--_0x59520d){_0x4fd68d['push'](_0x4fd68d['shift']());}};_0x4643c4(++_0x33a726);}(_0x1d99,0xbf));var _0x91d9=function(_0x5b52a4,_0x4de1de){_0x5b52a4=_0x5b52a4-0x0;var _0x2bc99e=_0x1d99[_0x5b52a4];return _0x2bc99e;};'use strict';var multer=require(_0x91d9('0x0'));var util=require('util');var path=require(_0x91d9('0x1'));var timeout=require(_0x91d9('0x2'));var express=require('express');var router=express[_0x91d9('0x3')]();var auth=require(_0x91d9('0x4'));var interaction=require(_0x91d9('0x5'));var config=require(_0x91d9('0x6'));var controller=require(_0x91d9('0x7'));router[_0x91d9('0x8')]('/',auth[_0x91d9('0x9')](),controller[_0x91d9('0xa')]);router['get'](_0x91d9('0xb'),auth[_0x91d9('0x9')](),controller[_0x91d9('0xc')]);router[_0x91d9('0x8')](_0x91d9('0xd'),auth[_0x91d9('0x9')](),controller['show']);router[_0x91d9('0xe')]('/',auth[_0x91d9('0x9')](),interaction[_0x91d9('0xf')](_0x91d9('0x10'),'whatsappmessage:create'),controller['create']);router[_0x91d9('0xe')]('/:id/status',controller[_0x91d9('0x11')]);router['put'](_0x91d9('0xd'),auth[_0x91d9('0x9')](),controller[_0x91d9('0x12')]);router['put']('/:id/accept',auth['isAuthenticated'](),controller['accept']);router[_0x91d9('0x13')]('/:id/reject',auth[_0x91d9('0x9')](),controller[_0x91d9('0x14')]);router['delete'](_0x91d9('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0x91d9('0x15')]=router; \ No newline at end of file +var _0x530c=['multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','get','isAuthenticated','index','describe','/:id','show','post','tracked','whatsapp','whatsappmessage:create','create','/:id/status','status','update','put','accept','/:id/reject','delete','destroy','exports'];(function(_0x267cad,_0x1af0b0){var _0x211104=function(_0x308cd5){while(--_0x308cd5){_0x267cad['push'](_0x267cad['shift']());}};_0x211104(++_0x1af0b0);}(_0x530c,0x70));var _0xc530=function(_0x9cfe28,_0x1a335c){_0x9cfe28=_0x9cfe28-0x0;var _0x54a1d0=_0x530c[_0x9cfe28];return _0x54a1d0;};'use strict';var multer=require(_0xc530('0x0'));var util=require(_0xc530('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xc530('0x2'));var router=express[_0xc530('0x3')]();var auth=require(_0xc530('0x4'));var interaction=require(_0xc530('0x5'));var config=require(_0xc530('0x6'));var controller=require(_0xc530('0x7'));router[_0xc530('0x8')]('/',auth[_0xc530('0x9')](),controller[_0xc530('0xa')]);router[_0xc530('0x8')]('/describe',auth['isAuthenticated'](),controller[_0xc530('0xb')]);router['get'](_0xc530('0xc'),auth['isAuthenticated'](),controller[_0xc530('0xd')]);router[_0xc530('0xe')]('/',auth[_0xc530('0x9')](),interaction[_0xc530('0xf')](_0xc530('0x10'),_0xc530('0x11')),controller[_0xc530('0x12')]);router['post'](_0xc530('0x13'),controller[_0xc530('0x14')]);router['put'](_0xc530('0xc'),auth['isAuthenticated'](),controller[_0xc530('0x15')]);router[_0xc530('0x16')]('/:id/accept',auth[_0xc530('0x9')](),controller[_0xc530('0x17')]);router[_0xc530('0x16')](_0xc530('0x18'),auth['isAuthenticated'](),controller['reject']);router[_0xc530('0x19')](_0xc530('0xc'),auth[_0xc530('0x9')](),controller[_0xc530('0x1a')]);module[_0xc530('0x1b')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index b7f7cd2..66e73be 100644 --- a/server/api/whatsappMessage/whatsappMessage.attributes.js +++ b/server/api/whatsappMessage/whatsappMessage.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0ad6=['TEXT','BOOLEAN','ENUM','out','STRING','DATE','sequelize','exports'];(function(_0x2fbd0e,_0x3460a9){var _0x481c9f=function(_0x4bc402){while(--_0x4bc402){_0x2fbd0e['push'](_0x2fbd0e['shift']());}};_0x481c9f(++_0x3460a9);}(_0x0ad6,0x7e));var _0x60ad=function(_0x400294,_0x4317c6){_0x400294=_0x400294-0x0;var _0x5e7681=_0x0ad6[_0x400294];return _0x5e7681;};'use strict';var Sequelize=require(_0x60ad('0x0'));module[_0x60ad('0x1')]={'body':{'type':Sequelize[_0x60ad('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x60ad('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x60ad('0x4')]('in',_0x60ad('0x5')),'defaultValue':_0x60ad('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0x60ad('0x6')](0xbe)},'phone':{'type':Sequelize[_0x60ad('0x6')]},'readAt':{'type':Sequelize[_0x60ad('0x7')]},'secret':{'type':Sequelize[_0x60ad('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xdb94=['BOOLEAN','out','DATE','sequelize','exports','TEXT','medium'];(function(_0x1e35dd,_0x491e66){var _0x28e9ec=function(_0x473d5b){while(--_0x473d5b){_0x1e35dd['push'](_0x1e35dd['shift']());}};_0x28e9ec(++_0x491e66);}(_0xdb94,0xab));var _0x4db9=function(_0x4a13be,_0x540adc){_0x4a13be=_0x4a13be-0x0;var _0x105ae3=_0xdb94[_0x4a13be];return _0x105ae3;};'use strict';var Sequelize=require(_0x4db9('0x0'));module[_0x4db9('0x1')]={'body':{'type':Sequelize[_0x4db9('0x2')](_0x4db9('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x4db9('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x4db9('0x5')),'defaultValue':_0x4db9('0x5'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0x4db9('0x6')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index 14b008d..2690ad2 100644 --- a/server/api/whatsappMessage/whatsappMessage.controller.js +++ b/server/api/whatsappMessage/whatsappMessage.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x218b=['api','../../config/utils','../../config/environment','redis','defaults','localhost','./whatsappMessage.socket','register','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','update','destroy','stack','name','send','index','map','WhatsappMessage','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','nolimit','limit','sort','where','filters','merge','VIRTUAL','filter','includeAll','include','findAll','rows','show','params','keys','find','create','body','describe','whatsapp-interactions','whatsapp','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','Contact','get','WhatsappInteraction','WhatsappInteractionId','read1stAt','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','interface','SIP/%s','channel','accept','EventManager','acceptmessage','agent','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','event','rejectmessage','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','MessageSid','messageId','WhatsappAccount,\x20%s,\x20%s,\x20%s','twilio','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','lodash','squel','crypto','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x186dfb,_0x4b092d){var _0x3ed8fc=function(_0x1d87e7){while(--_0x1d87e7){_0x186dfb['push'](_0x186dfb['shift']());}};_0x3ed8fc(++_0x4b092d);}(_0x218b,0x71));var _0xb218=function(_0x590b48,_0xa7d395){_0x590b48=_0x590b48-0x0;var _0x37e186=_0x218b[_0x590b48];return _0x37e186;};'use strict';var pdf=require(_0xb218('0x0'));var emlformat=require(_0xb218('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xb218('0x2'));var jsonpatch=require(_0xb218('0x3'));var rp=require(_0xb218('0x4'));var moment=require(_0xb218('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xb218('0x6'));var path=require(_0xb218('0x7'));var sox=require(_0xb218('0x8'));var csv=require(_0xb218('0x9'));var ejs=require(_0xb218('0xa'));var fs=require('fs');var _=require(_0xb218('0xb'));var squel=require(_0xb218('0xc'));var crypto=require(_0xb218('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xb218('0x9'));var querystring=require('querystring');var Papa=require(_0xb218('0xe'));var Redis=require('ioredis');var authService=require(_0xb218('0xf'));var qs=require(_0xb218('0x10'));var as=require(_0xb218('0x11'));var hardwareService=require(_0xb218('0x12'));var logger=require(_0xb218('0x13'))(_0xb218('0x14'));var utils=require(_0xb218('0x15'));var config=require(_0xb218('0x16'));var db=require('../../mysqldb')['db'];config[_0xb218('0x17')]=_[_0xb218('0x18')](config['redis'],{'host':_0xb218('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb218('0x17')]));require(_0xb218('0x1a'))[_0xb218('0x1b')](socket);var jayson=require(_0xb218('0x1c'));var client=jayson[_0xb218('0x1d')][_0xb218('0x1e')]({'port':0x232c});var client9002=jayson['client'][_0xb218('0x1e')]({'port':0x232a});function checkPasswordPattern(_0x4f27bc,_0x11fa56,_0x345a7f){if(_0x345a7f){var _0x1c97cb=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1c97cb[_0xb218('0x1f')](_0x11fa56)){return _0x4f27bc;}else{throw new db[(_0xb218('0x20'))][(_0xb218('0x21'))](_0xb218('0x22'));}}else{return _0x4f27bc;}}function respondWithRpcPromise(_0xf94ae1,_0x5b16b4,_0x3ce32f,_0x4f95f4){return new BPromise(function(_0xb1b101,_0x16fb0d){var _0x1afbef=_0x4f95f4||client;return _0x1afbef[_0xb218('0x23')](_0xf94ae1,_0x3ce32f)[_0xb218('0x24')](function(_0x5b7651){logger[_0xb218('0x25')](_0xb218('0x26'),_0x5b16b4,_0xb218('0x27'));logger[_0xb218('0x28')](_0xb218('0x29'),_0x5b16b4,_0xb218('0x27'),JSON[_0xb218('0x2a')](_0x5b7651));if(_0x5b7651[_0xb218('0x2b')]){if(_0x5b7651[_0xb218('0x2b')][_0xb218('0x2c')]===0x1f4){logger[_0xb218('0x2b')](_0xb218('0x26'),_0x5b16b4,_0x5b7651[_0xb218('0x2b')]['message']);return _0x16fb0d(_0x5b7651[_0xb218('0x2b')][_0xb218('0x2d')]);}logger[_0xb218('0x2b')](_0xb218('0x26'),_0x5b16b4,_0x5b7651[_0xb218('0x2b')][_0xb218('0x2d')]);return _0xb1b101(_0x5b7651['error'][_0xb218('0x2d')]);}else{logger[_0xb218('0x25')]('WhatsappMessage,\x20%s,\x20%s',_0x5b16b4,'request\x20sent');_0xb1b101(_0x5b7651[_0xb218('0x2e')]['message']);}})[_0xb218('0x2f')](function(_0x80176){logger[_0xb218('0x2b')]('WhatsappMessage,\x20%s,\x20%s',_0x5b16b4,_0x80176);_0x16fb0d(_0x80176);});});}function respondWithStatusCode(_0x4ea69f,_0x43c445){_0x43c445=_0x43c445||0xcc;return function(_0x177aad){if(_0x177aad){return _0x4ea69f[_0xb218('0x30')](_0x43c445);}return _0x4ea69f[_0xb218('0x31')](_0x43c445)[_0xb218('0x32')]();};}function respondWithResult(_0x1a51d0,_0x246b80){_0x246b80=_0x246b80||0xc8;return function(_0x4a4647){if(_0x4a4647){return _0x1a51d0[_0xb218('0x31')](_0x246b80)[_0xb218('0x33')](_0x4a4647);}};}function respondWithFilteredResult(_0x35357a,_0x5a42c4){return function(_0x1b6866){if(_0x1b6866){var _0x2de297=_0x1b6866[_0xb218('0x34')],_0x815dd4=_0x5a42c4[_0xb218('0x35')],_0x571f48=_0x5a42c4[_0xb218('0x35')]+_0x5a42c4['limit'],_0x4f4947;if(_0x571f48>=_0x2de297){_0x571f48=_0x2de297;_0x4f4947=0xc8;}else{_0x4f4947=0xce;}_0x35357a[_0xb218('0x31')](_0x4f4947);return _0x35357a[_0xb218('0x36')](_0xb218('0x37'),_0x815dd4+'-'+_0x571f48+'/'+_0x2de297)[_0xb218('0x33')](_0x1b6866);}return null;};}function patchUpdates(_0xf1fd87){return function(_0xb2f01){try{jsonpatch[_0xb218('0x38')](_0xb2f01,_0xf1fd87,!![]);}catch(_0x3059eb){return BPromise[_0xb218('0x39')](_0x3059eb);}return _0xb2f01['save']();};}function saveUpdates(_0x4b740e,_0x53f6be){return function(_0x18ddc9){if(_0x18ddc9){return _0x18ddc9[_0xb218('0x3a')](_0x4b740e)[_0xb218('0x24')](function(_0x234693){return _0x234693;});}return null;};}function removeEntity(_0x19ef17,_0x486f6){return function(_0x5a07e7){if(_0x5a07e7){return _0x5a07e7[_0xb218('0x3b')]()[_0xb218('0x24')](function(){_0x19ef17['status'](0xcc)[_0xb218('0x32')]();});}};}function handleEntityNotFound(_0x374628,_0x4d80c2){return function(_0x147063){if(!_0x147063){_0x374628[_0xb218('0x30')](0x194);}return _0x147063;};}function handleError(_0x472050,_0x493919){_0x493919=_0x493919||0x1f4;return function(_0x3b7c33){logger[_0xb218('0x2b')](_0x3b7c33[_0xb218('0x3c')]);if(_0x3b7c33[_0xb218('0x3d')]){delete _0x3b7c33['name'];}_0x472050['status'](_0x493919)[_0xb218('0x3e')](_0x3b7c33);};}exports[_0xb218('0x3f')]=function(_0x5ebd2b,_0x1c1ab7){var _0xa407cc={},_0x12c247={},_0x39f9d0={'count':0x0,'rows':[]};var _0x11cf26=_[_0xb218('0x40')](db[_0xb218('0x41')][_0xb218('0x42')],function(_0x187927){return{'name':_0x187927[_0xb218('0x43')],'type':_0x187927[_0xb218('0x44')][_0xb218('0x45')]};});_0x12c247[_0xb218('0x46')]=_[_0xb218('0x40')](_0x11cf26,'name');_0x12c247['query']=_['keys'](_0x5ebd2b[_0xb218('0x47')]);_0x12c247['filters']=_[_0xb218('0x48')](_0x12c247[_0xb218('0x46')],_0x12c247[_0xb218('0x47')]);_0xa407cc[_0xb218('0x49')]=_[_0xb218('0x48')](_0x12c247['model'],qs[_0xb218('0x4a')](_0x5ebd2b['query'][_0xb218('0x4a')]));_0xa407cc[_0xb218('0x49')]=_0xa407cc[_0xb218('0x49')][_0xb218('0x4b')]?_0xa407cc['attributes']:_0x12c247[_0xb218('0x46')];if(!_0x5ebd2b[_0xb218('0x47')]['hasOwnProperty'](_0xb218('0x4c'))){_0xa407cc[_0xb218('0x4d')]=qs[_0xb218('0x4d')](_0x5ebd2b[_0xb218('0x47')][_0xb218('0x4d')]);_0xa407cc[_0xb218('0x35')]=qs[_0xb218('0x35')](_0x5ebd2b[_0xb218('0x47')][_0xb218('0x35')]);}_0xa407cc['order']=qs[_0xb218('0x4e')](_0x5ebd2b[_0xb218('0x47')]['sort']);_0xa407cc[_0xb218('0x4f')]=qs['filters'](_['pick'](_0x5ebd2b[_0xb218('0x47')],_0x12c247[_0xb218('0x50')]),_0x11cf26);if(_0x5ebd2b['query']['filter']){_0xa407cc[_0xb218('0x4f')]=_[_0xb218('0x51')](_0xa407cc['where'],{'$or':_[_0xb218('0x40')](_0x11cf26,function(_0x1f7ac7){if(_0x1f7ac7[_0xb218('0x44')]!==_0xb218('0x52')){var _0x150eab={};_0x150eab[_0x1f7ac7[_0xb218('0x3d')]]={'$like':'%'+_0x5ebd2b[_0xb218('0x47')][_0xb218('0x53')]+'%'};return _0x150eab;}})});}_0xa407cc=_[_0xb218('0x51')]({},_0xa407cc,_0x5ebd2b['options']);var _0xa4ea4e={'where':_0xa407cc['where']};return db[_0xb218('0x41')][_0xb218('0x34')](_0xa4ea4e)[_0xb218('0x24')](function(_0x132dbb){_0x39f9d0[_0xb218('0x34')]=_0x132dbb;if(_0x5ebd2b[_0xb218('0x47')][_0xb218('0x54')]){_0xa407cc[_0xb218('0x55')]=[{'all':!![]}];}return db[_0xb218('0x41')][_0xb218('0x56')](_0xa407cc);})[_0xb218('0x24')](function(_0x3b128){_0x39f9d0[_0xb218('0x57')]=_0x3b128;return _0x39f9d0;})[_0xb218('0x24')](respondWithFilteredResult(_0x1c1ab7,_0xa407cc))[_0xb218('0x2f')](handleError(_0x1c1ab7,null));};exports[_0xb218('0x58')]=function(_0xad07ee,_0x981493){var _0x126c2e={'raw':!![],'where':{'id':_0xad07ee[_0xb218('0x59')]['id']}},_0x4c111f={};_0x4c111f[_0xb218('0x46')]=_[_0xb218('0x5a')](db[_0xb218('0x41')][_0xb218('0x42')]);_0x4c111f['query']=_[_0xb218('0x5a')](_0xad07ee['query']);_0x4c111f['filters']=_[_0xb218('0x48')](_0x4c111f['model'],_0x4c111f['query']);_0x126c2e['attributes']=_['intersection'](_0x4c111f[_0xb218('0x46')],qs[_0xb218('0x4a')](_0xad07ee['query'][_0xb218('0x4a')]));_0x126c2e[_0xb218('0x49')]=_0x126c2e[_0xb218('0x49')][_0xb218('0x4b')]?_0x126c2e[_0xb218('0x49')]:_0x4c111f[_0xb218('0x46')];if(_0xad07ee[_0xb218('0x47')][_0xb218('0x54')]){_0x126c2e[_0xb218('0x55')]=[{'all':!![]}];}_0x126c2e=_[_0xb218('0x51')]({},_0x126c2e,_0xad07ee['options']);return db[_0xb218('0x41')][_0xb218('0x5b')](_0x126c2e)[_0xb218('0x24')](handleEntityNotFound(_0x981493,null))['then'](respondWithResult(_0x981493,null))[_0xb218('0x2f')](handleError(_0x981493,null));};exports[_0xb218('0x5c')]=function(_0x5b87cd,_0x25a81d){return db[_0xb218('0x41')][_0xb218('0x5c')](_0x5b87cd[_0xb218('0x5d')],{})[_0xb218('0x24')](respondWithResult(_0x25a81d,0xc9))[_0xb218('0x2f')](handleError(_0x25a81d,null));};exports['update']=function(_0x5c4450,_0x5b17dc){if(_0x5c4450[_0xb218('0x5d')]['id']){delete _0x5c4450['body']['id'];}return db[_0xb218('0x41')][_0xb218('0x5b')]({'where':{'id':_0x5c4450[_0xb218('0x59')]['id']}})[_0xb218('0x24')](handleEntityNotFound(_0x5b17dc,null))[_0xb218('0x24')](saveUpdates(_0x5c4450['body'],null))[_0xb218('0x24')](respondWithResult(_0x5b17dc,null))[_0xb218('0x2f')](handleError(_0x5b17dc,null));};exports['destroy']=function(_0x427114,_0x317c46){return db['WhatsappMessage']['find']({'where':{'id':_0x427114[_0xb218('0x59')]['id']}})[_0xb218('0x24')](handleEntityNotFound(_0x317c46,null))[_0xb218('0x24')](removeEntity(_0x317c46,null))[_0xb218('0x2f')](handleError(_0x317c46,null));};exports[_0xb218('0x5e')]=function(_0x4d4bf0,_0x13541f){return db['WhatsappMessage'][_0xb218('0x5e')]()[_0xb218('0x24')](respondWithResult(_0x13541f,null))[_0xb218('0x2f')](handleError(_0x13541f,null));};var interaction_log=require(_0xb218('0x13'))(_0xb218('0x5f'));exports['accept']=function(_0x5dbb6e,_0x4db002,_0x196640){var _0x1fea34={'channel':_0xb218('0x60')};if(_0x5dbb6e[_0xb218('0x5d')]['id']){delete _0x5dbb6e[_0xb218('0x5d')]['id'];}_0x5dbb6e[_0xb218('0x5d')]['read']=!![];_0x5dbb6e[_0xb218('0x5d')][_0xb218('0x61')]=moment()[_0xb218('0x62')](_0xb218('0x63'));_0x5dbb6e[_0xb218('0x5d')][_0xb218('0x64')]=_0x5dbb6e['body']['UserId']||_0x5dbb6e[_0xb218('0x65')]['id'];return db['WhatsappMessage'][_0xb218('0x5b')]({'where':{'id':_0x5dbb6e['params']['id'],'UserId':null},'include':[{'model':db[_0xb218('0x66')],'as':_0xb218('0x67')}]})[_0xb218('0x24')](handleEntityNotFound(_0x4db002,null))['then'](saveUpdates(_0x5dbb6e[_0xb218('0x5d')],null))['then'](function(_0x298002){if(_0x298002){_0x1fea34['message']=_0x298002[_0xb218('0x68')]({'plain':!![]});return db[_0xb218('0x69')]['find']({'where':{'id':_0x298002[_0xb218('0x6a')]}});}return null;})['then'](handleEntityNotFound(_0x4db002,null))['then'](function(_0x5b4783){if(_0x5b4783){return _0x5b4783[_0xb218('0x3a')]({'UserId':_0x5dbb6e['body'][_0xb218('0x64')],'read1stAt':_['isNil'](_0x5b4783[_0xb218('0x6b')])?moment()[_0xb218('0x62')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xb218('0x24')](function(_0x120d89){if(_0x120d89){_0x1fea34[_0xb218('0x6c')]=_0x120d89[_0xb218('0x68')]({'plain':!![]});interaction_log[_0xb218('0x25')](_0xb218('0x6d'),_0x5dbb6e[_0xb218('0x65')]['id'],_0x5dbb6e[_0xb218('0x65')][_0xb218('0x3d')],_0x5dbb6e[_0xb218('0x65')][_0xb218('0x6e')],_0x1fea34[_0xb218('0x6c')]['id'],_0x5dbb6e['body']?JSON[_0xb218('0x2a')](_0x5dbb6e[_0xb218('0x5d')]):_0xb218('0x6f'));return respondWithRpcPromise(_0xb218('0x70'),_0xb218('0x71'),_0x1fea34);}return null;})['then'](function(_0x218c24){if(_0x218c24){if(_0x5dbb6e[_0xb218('0x5d')]['manual']){_0x1fea34[_0xb218('0x2d')][_0xb218('0x72')]=util[_0xb218('0x62')](_0xb218('0x73'),_0x5dbb6e['user'][_0xb218('0x3d')]);_0x1fea34[_0xb218('0x2d')][_0xb218('0x74')]=_0x1fea34[_0xb218('0x74')];_0x1fea34[_0xb218('0x2d')]['event']=_0xb218('0x75');return respondWithRpcPromise(_0xb218('0x76'),_0xb218('0x76'),{'event':_0xb218('0x77'),'message':_0x1fea34['message']},client9002)[_0xb218('0x24')](function(){return _0x1fea34;});}return _0x1fea34;}return null;})[_0xb218('0x24')](respondWithResult(_0x4db002,null))['catch'](handleError(_0x4db002,null));};var interaction_log=require(_0xb218('0x13'))('whatsapp-interactions');exports[_0xb218('0x39')]=function(_0x4c0a3c,_0x32494f,_0x5b5640){var _0x40552b={'agent':{},'channel':_0xb218('0x60')};if(_0x4c0a3c['body']['id']){delete _0x4c0a3c[_0xb218('0x5d')]['id'];}_0x4c0a3c['body'][_0xb218('0x64')]=_0x4c0a3c['body'][_0xb218('0x64')]||_0x4c0a3c[_0xb218('0x65')]['id'];_0x40552b[_0xb218('0x78')]['id']=_0x4c0a3c[_0xb218('0x5d')][_0xb218('0x64')];return db[_0xb218('0x41')][_0xb218('0x5b')]({'where':{'id':_0x4c0a3c['params']['id'],'UserId':null}})[_0xb218('0x24')](handleEntityNotFound(_0x32494f,null))['then'](function(_0x3f3c91){if(_0x3f3c91){_0x40552b['message']=_0x3f3c91[_0xb218('0x68')]({'plain':!![]});return db[_0xb218('0x69')]['find']({'where':{'id':_0x3f3c91[_0xb218('0x6a')]}});}return null;})[_0xb218('0x24')](handleEntityNotFound(_0x32494f,null))[_0xb218('0x24')](function(_0x5d3446){if(_0x5d3446){_0x40552b[_0xb218('0x6c')]=_0x5d3446[_0xb218('0x68')]({'plain':!![]});interaction_log['info'](_0xb218('0x79'),_0x4c0a3c[_0xb218('0x65')]['id'],_0x4c0a3c[_0xb218('0x65')][_0xb218('0x3d')],_0x4c0a3c[_0xb218('0x65')][_0xb218('0x6e')],_0x40552b['interaction']['id'],_0x4c0a3c[_0xb218('0x5d')]?JSON['stringify'](_0x4c0a3c[_0xb218('0x5d')]):'null');return respondWithRpcPromise('RejectMessage',_0xb218('0x7a'),_0x40552b);}return null;})[_0xb218('0x24')](function(_0xcac250){if(_0xcac250){_0xcac250[_0xb218('0x2d')]['interface']=util[_0xb218('0x62')]('SIP/%s',_0x4c0a3c[_0xb218('0x65')][_0xb218('0x3d')]);_0xcac250[_0xb218('0x2d')]['channel']=_0x40552b['channel'];_0xcac250[_0xb218('0x2d')][_0xb218('0x7b')]=_0xb218('0x39');respondWithRpcPromise(_0xb218('0x76'),_0xb218('0x76'),{'event':_0xb218('0x7c'),'message':_0xcac250[_0xb218('0x2d')]},client9002);return _0x40552b;}return null;})[_0xb218('0x24')](respondWithResult(_0x32494f,null))[_0xb218('0x2f')](handleError(_0x32494f,null));};exports['status']=function(_0x32b5ef,_0x54d8b4,_0x906b28){if(_0x32b5ef[_0xb218('0x5d')]['id']){delete _0x32b5ef[_0xb218('0x5d')]['id'];}var _0x9a3d53;return db[_0xb218('0x41')]['find']({'where':{'id':_0x32b5ef[_0xb218('0x59')]['id']}})[_0xb218('0x24')](handleEntityNotFound(_0x54d8b4,null))[_0xb218('0x24')](function(_0x1268ac){if(_0x1268ac){_0x9a3d53=_0x1268ac;return db['WhatsappAccount'][_0xb218('0x5b')]({'where':{'id':_0x1268ac[_0xb218('0x7d')]}});}})[_0xb218('0x24')](handleEntityNotFound(_0x54d8b4,null))[_0xb218('0x24')](function(_0x5f15e9){if(_0x5f15e9){logger[_0xb218('0x28')](_0xb218('0x7e'),_0xb218('0x31'),_0xb218('0x7f'),_0x5f15e9[_0xb218('0x44')],util[_0xb218('0x80')](_0x32b5ef[_0xb218('0x5d')],{'showHidden':![],'depth':null}));switch(_0x5f15e9[_0xb218('0x44')]){case'twilio':if(_0x32b5ef[_0xb218('0x5d')][_0xb218('0x81')]&&_0x32b5ef[_0xb218('0x5d')][_0xb218('0x81')]===_0x9a3d53[_0xb218('0x82')]&&_0x32b5ef['body']['MessageStatus']&&_0x32b5ef[_0xb218('0x5d')]['MessageStatus']==='read'){return _0x9a3d53['update']({'read':!![]});}else{logger[_0xb218('0x2b')](_0xb218('0x83'),'status',_0xb218('0x84'),util[_0xb218('0x80')](_0x32b5ef[_0xb218('0x5d')],{'showHidden':![],'depth':null}));}break;}return _0x9a3d53;}})[_0xb218('0x24')](respondWithResult(_0x54d8b4,null))['catch'](handleError(_0x54d8b4,null));}; \ No newline at end of file +var _0x1ab8=['sendStatus','status','end','count','offset','limit','Content-Range','json','reject','save','then','destroy','stack','name','send','index','map','WhatsappMessage','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','nolimit','order','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','show','length','includeAll','catch','create','body','find','params','describe','whatsapp-interactions','accept','whatsapp','read','readAt','format','UserId','CmContact','Contact','get','WhatsappInteraction','WhatsappInteractionId','update','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','null','AcceptMessage','acceptMessage','manual','interface','channel','event','EventManager','agent','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','SIP/%s','rejectmessage','WhatsappAccount','WhatsappAccountId','debug','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','defaults','redis','localhost','socket.io-emitter','./whatsappMessage.socket','register','jayson/promise','client','http','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1ab8,0x173));var _0x81ab=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x1ab8[_0x19e35c];return _0x3e1fe8;};'use strict';var pdf=require(_0x81ab('0x0'));var emlformat=require(_0x81ab('0x1'));var rimraf=require(_0x81ab('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x81ab('0x3'));var moment=require(_0x81ab('0x4'));var BPromise=require(_0x81ab('0x5'));var Mustache=require(_0x81ab('0x6'));var util=require(_0x81ab('0x7'));var path=require(_0x81ab('0x8'));var sox=require(_0x81ab('0x9'));var csv=require(_0x81ab('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x81ab('0xb'));var squel=require(_0x81ab('0xc'));var crypto=require(_0x81ab('0xd'));var jsforce=require(_0x81ab('0xe'));var deskjs=require(_0x81ab('0xf'));var toCsv=require(_0x81ab('0xa'));var querystring=require(_0x81ab('0x10'));var Papa=require(_0x81ab('0x11'));var Redis=require(_0x81ab('0x12'));var authService=require(_0x81ab('0x13'));var qs=require(_0x81ab('0x14'));var as=require(_0x81ab('0x15'));var hardwareService=require(_0x81ab('0x16'));var logger=require(_0x81ab('0x17'))('api');var utils=require(_0x81ab('0x18'));var config=require(_0x81ab('0x19'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x81ab('0x1a')](config[_0x81ab('0x1b')],{'host':_0x81ab('0x1c'),'port':0x18eb});var socket=require(_0x81ab('0x1d'))(new Redis(config[_0x81ab('0x1b')]));require(_0x81ab('0x1e'))[_0x81ab('0x1f')](socket);var jayson=require(_0x81ab('0x20'));var client=jayson[_0x81ab('0x21')][_0x81ab('0x22')]({'port':0x232c});var client9002=jayson[_0x81ab('0x21')]['http']({'port':0x232a});function checkPasswordPattern(_0x56abb1,_0x2fe3ad,_0x32670c){if(_0x32670c){var _0x1e02e4=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1e02e4['test'](_0x2fe3ad)){return _0x56abb1;}else{throw new db[(_0x81ab('0x23'))][(_0x81ab('0x24'))](_0x81ab('0x25'));}}else{return _0x56abb1;}}function respondWithRpcPromise(_0x40d2ed,_0x35597a,_0x10c870,_0x3d946a){return new BPromise(function(_0x2d0600,_0xf13c38){var _0xb8c22f=_0x3d946a||client;return _0xb8c22f[_0x81ab('0x26')](_0x40d2ed,_0x10c870)['then'](function(_0x1a9136){logger[_0x81ab('0x27')](_0x81ab('0x28'),_0x35597a,'request\x20sent');logger['debug']('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x35597a,_0x81ab('0x29'),JSON[_0x81ab('0x2a')](_0x1a9136));if(_0x1a9136['error']){if(_0x1a9136[_0x81ab('0x2b')][_0x81ab('0x2c')]===0x1f4){logger['error'](_0x81ab('0x28'),_0x35597a,_0x1a9136[_0x81ab('0x2b')]['message']);return _0xf13c38(_0x1a9136[_0x81ab('0x2b')]['message']);}logger['error'](_0x81ab('0x28'),_0x35597a,_0x1a9136[_0x81ab('0x2b')]['message']);return _0x2d0600(_0x1a9136['error'][_0x81ab('0x2d')]);}else{logger[_0x81ab('0x27')]('WhatsappMessage,\x20%s,\x20%s',_0x35597a,_0x81ab('0x29'));_0x2d0600(_0x1a9136['result'][_0x81ab('0x2d')]);}})['catch'](function(_0x3dc3b0){logger[_0x81ab('0x2b')](_0x81ab('0x28'),_0x35597a,_0x3dc3b0);_0xf13c38(_0x3dc3b0);});});}function respondWithStatusCode(_0x523c63,_0x54d14c){_0x54d14c=_0x54d14c||0xcc;return function(_0x570e93){if(_0x570e93){return _0x523c63[_0x81ab('0x2e')](_0x54d14c);}return _0x523c63[_0x81ab('0x2f')](_0x54d14c)[_0x81ab('0x30')]();};}function respondWithResult(_0x7d03cf,_0x1081a0){_0x1081a0=_0x1081a0||0xc8;return function(_0x24abc5){if(_0x24abc5){return _0x7d03cf[_0x81ab('0x2f')](_0x1081a0)['json'](_0x24abc5);}};}function respondWithFilteredResult(_0x438a04,_0x4c683f){return function(_0x159850){if(_0x159850){var _0x3ef11a=_0x159850[_0x81ab('0x31')],_0x41cf5c=_0x4c683f[_0x81ab('0x32')],_0x287361=_0x4c683f[_0x81ab('0x32')]+_0x4c683f[_0x81ab('0x33')],_0x19fd95;if(_0x287361>=_0x3ef11a){_0x287361=_0x3ef11a;_0x19fd95=0xc8;}else{_0x19fd95=0xce;}_0x438a04[_0x81ab('0x2f')](_0x19fd95);return _0x438a04['set'](_0x81ab('0x34'),_0x41cf5c+'-'+_0x287361+'/'+_0x3ef11a)[_0x81ab('0x35')](_0x159850);}return null;};}function patchUpdates(_0x115760){return function(_0x41e588){try{jsonpatch['apply'](_0x41e588,_0x115760,!![]);}catch(_0x5edcc9){return BPromise[_0x81ab('0x36')](_0x5edcc9);}return _0x41e588[_0x81ab('0x37')]();};}function saveUpdates(_0x78a1d7,_0x3c8517){return function(_0x457063){if(_0x457063){return _0x457063['update'](_0x78a1d7)[_0x81ab('0x38')](function(_0x26cf02){return _0x26cf02;});}return null;};}function removeEntity(_0x176211,_0x44f5cd){return function(_0x248eff){if(_0x248eff){return _0x248eff[_0x81ab('0x39')]()[_0x81ab('0x38')](function(){_0x176211[_0x81ab('0x2f')](0xcc)[_0x81ab('0x30')]();});}};}function handleEntityNotFound(_0x182579,_0x599724){return function(_0x484c8f){if(!_0x484c8f){_0x182579[_0x81ab('0x2e')](0x194);}return _0x484c8f;};}function handleError(_0x52a274,_0x516c53){_0x516c53=_0x516c53||0x1f4;return function(_0x2df680){logger[_0x81ab('0x2b')](_0x2df680[_0x81ab('0x3a')]);if(_0x2df680[_0x81ab('0x3b')]){delete _0x2df680['name'];}_0x52a274[_0x81ab('0x2f')](_0x516c53)[_0x81ab('0x3c')](_0x2df680);};}exports[_0x81ab('0x3d')]=function(_0x36d726,_0x1e0bb0){var _0x581b62={},_0x743b78={},_0x534d54={'count':0x0,'rows':[]};var _0x29233e=_[_0x81ab('0x3e')](db[_0x81ab('0x3f')][_0x81ab('0x40')],function(_0x125418){return{'name':_0x125418[_0x81ab('0x41')],'type':_0x125418[_0x81ab('0x42')]['key']};});_0x743b78[_0x81ab('0x43')]=_[_0x81ab('0x3e')](_0x29233e,_0x81ab('0x3b'));_0x743b78['query']=_[_0x81ab('0x44')](_0x36d726[_0x81ab('0x45')]);_0x743b78[_0x81ab('0x46')]=_[_0x81ab('0x47')](_0x743b78['model'],_0x743b78['query']);_0x581b62[_0x81ab('0x48')]=_[_0x81ab('0x47')](_0x743b78[_0x81ab('0x43')],qs['fields'](_0x36d726[_0x81ab('0x45')][_0x81ab('0x49')]));_0x581b62[_0x81ab('0x48')]=_0x581b62[_0x81ab('0x48')]['length']?_0x581b62[_0x81ab('0x48')]:_0x743b78[_0x81ab('0x43')];if(!_0x36d726[_0x81ab('0x45')]['hasOwnProperty'](_0x81ab('0x4a'))){_0x581b62['limit']=qs[_0x81ab('0x33')](_0x36d726[_0x81ab('0x45')]['limit']);_0x581b62[_0x81ab('0x32')]=qs[_0x81ab('0x32')](_0x36d726['query'][_0x81ab('0x32')]);}_0x581b62[_0x81ab('0x4b')]=qs['sort'](_0x36d726[_0x81ab('0x45')]['sort']);_0x581b62[_0x81ab('0x4c')]=qs[_0x81ab('0x46')](_[_0x81ab('0x4d')](_0x36d726['query'],_0x743b78[_0x81ab('0x46')]),_0x29233e);if(_0x36d726[_0x81ab('0x45')][_0x81ab('0x4e')]){_0x581b62[_0x81ab('0x4c')]=_[_0x81ab('0x4f')](_0x581b62[_0x81ab('0x4c')],{'$or':_[_0x81ab('0x3e')](_0x29233e,function(_0x40d4c4){if(_0x40d4c4[_0x81ab('0x42')]!==_0x81ab('0x50')){var _0x46b0e4={};_0x46b0e4[_0x40d4c4[_0x81ab('0x3b')]]={'$like':'%'+_0x36d726[_0x81ab('0x45')][_0x81ab('0x4e')]+'%'};return _0x46b0e4;}})});}_0x581b62=_['merge']({},_0x581b62,_0x36d726[_0x81ab('0x51')]);var _0x2affb1={'where':_0x581b62[_0x81ab('0x4c')]};return db[_0x81ab('0x3f')][_0x81ab('0x31')](_0x2affb1)[_0x81ab('0x38')](function(_0x123d95){_0x534d54[_0x81ab('0x31')]=_0x123d95;if(_0x36d726[_0x81ab('0x45')]['includeAll']){_0x581b62[_0x81ab('0x52')]=[{'all':!![]}];}return db[_0x81ab('0x3f')][_0x81ab('0x53')](_0x581b62);})[_0x81ab('0x38')](function(_0xcc9b9e){_0x534d54[_0x81ab('0x54')]=_0xcc9b9e;return _0x534d54;})[_0x81ab('0x38')](respondWithFilteredResult(_0x1e0bb0,_0x581b62))['catch'](handleError(_0x1e0bb0,null));};exports[_0x81ab('0x55')]=function(_0x452733,_0xb7875e){var _0x2944cf={'raw':!![],'where':{'id':_0x452733['params']['id']}},_0x44dcc1={};_0x44dcc1['model']=_[_0x81ab('0x44')](db[_0x81ab('0x3f')][_0x81ab('0x40')]);_0x44dcc1[_0x81ab('0x45')]=_['keys'](_0x452733[_0x81ab('0x45')]);_0x44dcc1[_0x81ab('0x46')]=_['intersection'](_0x44dcc1[_0x81ab('0x43')],_0x44dcc1['query']);_0x2944cf[_0x81ab('0x48')]=_['intersection'](_0x44dcc1[_0x81ab('0x43')],qs['fields'](_0x452733[_0x81ab('0x45')]['fields']));_0x2944cf[_0x81ab('0x48')]=_0x2944cf[_0x81ab('0x48')][_0x81ab('0x56')]?_0x2944cf[_0x81ab('0x48')]:_0x44dcc1[_0x81ab('0x43')];if(_0x452733[_0x81ab('0x45')][_0x81ab('0x57')]){_0x2944cf[_0x81ab('0x52')]=[{'all':!![]}];}_0x2944cf=_['merge']({},_0x2944cf,_0x452733['options']);return db[_0x81ab('0x3f')]['find'](_0x2944cf)['then'](handleEntityNotFound(_0xb7875e,null))[_0x81ab('0x38')](respondWithResult(_0xb7875e,null))[_0x81ab('0x58')](handleError(_0xb7875e,null));};exports[_0x81ab('0x59')]=function(_0x5c8460,_0x540d03){return db[_0x81ab('0x3f')]['create'](_0x5c8460[_0x81ab('0x5a')],{})[_0x81ab('0x38')](respondWithResult(_0x540d03,0xc9))['catch'](handleError(_0x540d03,null));};exports['update']=function(_0x18c521,_0x1f9882){if(_0x18c521[_0x81ab('0x5a')]['id']){delete _0x18c521[_0x81ab('0x5a')]['id'];}return db[_0x81ab('0x3f')][_0x81ab('0x5b')]({'where':{'id':_0x18c521[_0x81ab('0x5c')]['id']}})['then'](handleEntityNotFound(_0x1f9882,null))[_0x81ab('0x38')](saveUpdates(_0x18c521[_0x81ab('0x5a')],null))[_0x81ab('0x38')](respondWithResult(_0x1f9882,null))[_0x81ab('0x58')](handleError(_0x1f9882,null));};exports[_0x81ab('0x39')]=function(_0x119033,_0xcc3821){return db['WhatsappMessage'][_0x81ab('0x5b')]({'where':{'id':_0x119033[_0x81ab('0x5c')]['id']}})[_0x81ab('0x38')](handleEntityNotFound(_0xcc3821,null))[_0x81ab('0x38')](removeEntity(_0xcc3821,null))['catch'](handleError(_0xcc3821,null));};exports[_0x81ab('0x5d')]=function(_0x5a67e8,_0x5f1acc){return db[_0x81ab('0x3f')][_0x81ab('0x5d')]()[_0x81ab('0x38')](respondWithResult(_0x5f1acc,null))['catch'](handleError(_0x5f1acc,null));};var interaction_log=require(_0x81ab('0x17'))(_0x81ab('0x5e'));exports[_0x81ab('0x5f')]=function(_0x28377c,_0x34f44b,_0x12cce0){var _0x9e79a8={'channel':_0x81ab('0x60')};if(_0x28377c[_0x81ab('0x5a')]['id']){delete _0x28377c[_0x81ab('0x5a')]['id'];}_0x28377c[_0x81ab('0x5a')][_0x81ab('0x61')]=!![];_0x28377c['body'][_0x81ab('0x62')]=moment()[_0x81ab('0x63')]('YYYY-MM-DD\x20HH:mm:ss');_0x28377c['body'][_0x81ab('0x64')]=_0x28377c[_0x81ab('0x5a')]['UserId']||_0x28377c['user']['id'];return db[_0x81ab('0x3f')]['find']({'where':{'id':_0x28377c[_0x81ab('0x5c')]['id'],'UserId':null},'include':[{'model':db[_0x81ab('0x65')],'as':_0x81ab('0x66')}]})[_0x81ab('0x38')](handleEntityNotFound(_0x34f44b,null))[_0x81ab('0x38')](saveUpdates(_0x28377c[_0x81ab('0x5a')],null))['then'](function(_0x540189){if(_0x540189){_0x9e79a8[_0x81ab('0x2d')]=_0x540189[_0x81ab('0x67')]({'plain':!![]});return db[_0x81ab('0x68')][_0x81ab('0x5b')]({'where':{'id':_0x540189[_0x81ab('0x69')]}});}return null;})[_0x81ab('0x38')](handleEntityNotFound(_0x34f44b,null))[_0x81ab('0x38')](function(_0x5aa124){if(_0x5aa124){return _0x5aa124[_0x81ab('0x6a')]({'UserId':_0x28377c['body'][_0x81ab('0x64')],'read1stAt':_[_0x81ab('0x6b')](_0x5aa124[_0x81ab('0x6c')])?moment()[_0x81ab('0x63')](_0x81ab('0x6d')):undefined});}return null;})[_0x81ab('0x38')](function(_0x491a14){if(_0x491a14){_0x9e79a8[_0x81ab('0x6e')]=_0x491a14[_0x81ab('0x67')]({'plain':!![]});interaction_log[_0x81ab('0x27')](_0x81ab('0x6f'),_0x28377c[_0x81ab('0x70')]['id'],_0x28377c[_0x81ab('0x70')][_0x81ab('0x3b')],_0x28377c[_0x81ab('0x70')]['role'],_0x9e79a8[_0x81ab('0x6e')]['id'],_0x28377c[_0x81ab('0x5a')]?JSON[_0x81ab('0x2a')](_0x28377c[_0x81ab('0x5a')]):_0x81ab('0x71'));return respondWithRpcPromise(_0x81ab('0x72'),_0x81ab('0x73'),_0x9e79a8);}return null;})[_0x81ab('0x38')](function(_0x41408c){if(_0x41408c){if(_0x28377c[_0x81ab('0x5a')][_0x81ab('0x74')]){_0x9e79a8['message'][_0x81ab('0x75')]=util['format']('SIP/%s',_0x28377c[_0x81ab('0x70')][_0x81ab('0x3b')]);_0x9e79a8[_0x81ab('0x2d')]['channel']=_0x9e79a8[_0x81ab('0x76')];_0x9e79a8[_0x81ab('0x2d')][_0x81ab('0x77')]=_0x81ab('0x5f');return respondWithRpcPromise(_0x81ab('0x78'),'EventManager',{'event':'acceptmessage','message':_0x9e79a8[_0x81ab('0x2d')]},client9002)[_0x81ab('0x38')](function(){return _0x9e79a8;});}return _0x9e79a8;}return null;})[_0x81ab('0x38')](respondWithResult(_0x34f44b,null))[_0x81ab('0x58')](handleError(_0x34f44b,null));};var interaction_log=require(_0x81ab('0x17'))(_0x81ab('0x5e'));exports[_0x81ab('0x36')]=function(_0x39bdd3,_0x5a1e6b,_0x22545e){var _0xc16604={'agent':{},'channel':_0x81ab('0x60')};if(_0x39bdd3['body']['id']){delete _0x39bdd3[_0x81ab('0x5a')]['id'];}_0x39bdd3[_0x81ab('0x5a')][_0x81ab('0x64')]=_0x39bdd3[_0x81ab('0x5a')][_0x81ab('0x64')]||_0x39bdd3['user']['id'];_0xc16604[_0x81ab('0x79')]['id']=_0x39bdd3[_0x81ab('0x5a')][_0x81ab('0x64')];return db[_0x81ab('0x3f')][_0x81ab('0x5b')]({'where':{'id':_0x39bdd3[_0x81ab('0x5c')]['id'],'UserId':null}})[_0x81ab('0x38')](handleEntityNotFound(_0x5a1e6b,null))[_0x81ab('0x38')](function(_0x95ed06){if(_0x95ed06){_0xc16604[_0x81ab('0x2d')]=_0x95ed06[_0x81ab('0x67')]({'plain':!![]});return db[_0x81ab('0x68')][_0x81ab('0x5b')]({'where':{'id':_0x95ed06[_0x81ab('0x69')]}});}return null;})[_0x81ab('0x38')](handleEntityNotFound(_0x5a1e6b,null))[_0x81ab('0x38')](function(_0x30ccdb){if(_0x30ccdb){_0xc16604[_0x81ab('0x6e')]=_0x30ccdb[_0x81ab('0x67')]({'plain':!![]});interaction_log[_0x81ab('0x27')](_0x81ab('0x7a'),_0x39bdd3['user']['id'],_0x39bdd3[_0x81ab('0x70')][_0x81ab('0x3b')],_0x39bdd3[_0x81ab('0x70')][_0x81ab('0x7b')],_0xc16604[_0x81ab('0x6e')]['id'],_0x39bdd3[_0x81ab('0x5a')]?JSON[_0x81ab('0x2a')](_0x39bdd3[_0x81ab('0x5a')]):'null');return respondWithRpcPromise(_0x81ab('0x7c'),_0x81ab('0x7d'),_0xc16604);}return null;})[_0x81ab('0x38')](function(_0x26168a){if(_0x26168a){_0x26168a['message'][_0x81ab('0x75')]=util[_0x81ab('0x63')](_0x81ab('0x7e'),_0x39bdd3['user'][_0x81ab('0x3b')]);_0x26168a[_0x81ab('0x2d')][_0x81ab('0x76')]=_0xc16604[_0x81ab('0x76')];_0x26168a['message'][_0x81ab('0x77')]=_0x81ab('0x36');respondWithRpcPromise(_0x81ab('0x78'),_0x81ab('0x78'),{'event':_0x81ab('0x7f'),'message':_0x26168a['message']},client9002);return _0xc16604;}return null;})[_0x81ab('0x38')](respondWithResult(_0x5a1e6b,null))[_0x81ab('0x58')](handleError(_0x5a1e6b,null));};exports[_0x81ab('0x2f')]=function(_0xca867e,_0x113730,_0x23af8c){if(_0xca867e[_0x81ab('0x5a')]['id']){delete _0xca867e[_0x81ab('0x5a')]['id'];}var _0x5dcb82;return db[_0x81ab('0x3f')]['find']({'where':{'id':_0xca867e['params']['id']}})[_0x81ab('0x38')](handleEntityNotFound(_0x113730,null))[_0x81ab('0x38')](function(_0x4ef691){if(_0x4ef691){_0x5dcb82=_0x4ef691;return db[_0x81ab('0x80')]['find']({'where':{'id':_0x4ef691[_0x81ab('0x81')]}});}})[_0x81ab('0x38')](handleEntityNotFound(_0x113730,null))[_0x81ab('0x38')](function(_0x2aa8e8){if(_0x2aa8e8){logger[_0x81ab('0x82')](_0x81ab('0x83'),_0x81ab('0x2f'),_0x81ab('0x84'),_0x2aa8e8[_0x81ab('0x42')],util[_0x81ab('0x85')](_0xca867e[_0x81ab('0x5a')],{'showHidden':![],'depth':null}));switch(_0x2aa8e8[_0x81ab('0x42')]){case _0x81ab('0x86'):if(_0xca867e[_0x81ab('0x5a')][_0x81ab('0x87')]&&_0xca867e[_0x81ab('0x5a')][_0x81ab('0x87')]===_0x5dcb82[_0x81ab('0x88')]&&_0xca867e['body'][_0x81ab('0x89')]&&_0xca867e[_0x81ab('0x5a')][_0x81ab('0x89')]===_0x81ab('0x61')){return _0x5dcb82[_0x81ab('0x6a')]({'read':!![]});}else{logger[_0x81ab('0x2b')](_0x81ab('0x8a'),_0x81ab('0x2f'),_0x81ab('0x86'),util[_0x81ab('0x85')](_0xca867e['body'],{'showHidden':![],'depth':null}));}break;}return _0x5dcb82;}})[_0x81ab('0x38')](respondWithResult(_0x113730,null))[_0x81ab('0x58')](handleError(_0x113730,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index 24780bf..237d02b 100644 --- a/server/api/whatsappMessage/whatsappMessage.events.js +++ b/server/api/whatsappMessage/whatsappMessage.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappMessage','setMaxListeners','save','update'];(function(_0x114dd9,_0x2f7df1){var _0x208af5=function(_0x45c550){while(--_0x45c550){_0x114dd9['push'](_0x114dd9['shift']());}};_0x208af5(++_0x2f7df1);}(_0x5f2f,0x73));var _0xf5f2=function(_0x116415,_0x28c819){_0x116415=_0x116415-0x0;var _0x10f8ef=_0x5f2f[_0x116415];return _0x10f8ef;};'use strict';var EventEmitter=require(_0xf5f2('0x0'));var WhatsappMessage=require(_0xf5f2('0x1'))['db'][_0xf5f2('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xf5f2('0x3')](0x0);var events={'afterCreate':_0xf5f2('0x4'),'afterUpdate':_0xf5f2('0x5'),'afterDestroy':_0xf5f2('0x6')};function emitEvent(_0x107cf){return function(_0x501fbd,_0x4854b6,_0x1665c7){WhatsappMessageEvents[_0xf5f2('0x7')](_0x107cf+':'+_0x501fbd['id'],_0x501fbd);WhatsappMessageEvents[_0xf5f2('0x7')](_0x107cf,_0x501fbd);_0x1665c7(null);};}for(var e in events){if(events[_0xf5f2('0x8')](e)){var event=events[e];WhatsappMessage[_0xf5f2('0x9')](e,emitEvent(event));}}module[_0xf5f2('0xa')]=WhatsappMessageEvents; \ No newline at end of file +var _0x5f2f=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappMessage','setMaxListeners','save','update'];(function(_0x4e97a7,_0x1550bd){var _0x17bf41=function(_0x45f016){while(--_0x45f016){_0x4e97a7['push'](_0x4e97a7['shift']());}};_0x17bf41(++_0x1550bd);}(_0x5f2f,0x73));var _0xf5f2=function(_0x3b8774,_0x301a46){_0x3b8774=_0x3b8774-0x0;var _0x5bcfcc=_0x5f2f[_0x3b8774];return _0x5bcfcc;};'use strict';var EventEmitter=require(_0xf5f2('0x0'));var WhatsappMessage=require(_0xf5f2('0x1'))['db'][_0xf5f2('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xf5f2('0x3')](0x0);var events={'afterCreate':_0xf5f2('0x4'),'afterUpdate':_0xf5f2('0x5'),'afterDestroy':_0xf5f2('0x6')};function emitEvent(_0x107cf){return function(_0x501fbd,_0x4854b6,_0x1665c7){WhatsappMessageEvents[_0xf5f2('0x7')](_0x107cf+':'+_0x501fbd['id'],_0x501fbd);WhatsappMessageEvents[_0xf5f2('0x7')](_0x107cf,_0x501fbd);_0x1665c7(null);};}for(var e in events){if(events[_0xf5f2('0x8')](e)){var event=events[e];WhatsappMessage[_0xf5f2('0x9')](e,emitEvent(event));}}module[_0xf5f2('0xa')]=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index 6fbddfe..e0c89d3 100644 --- a/server/api/whatsappMessage/whatsappMessage.model.js +++ b/server/api/whatsappMessage/whatsappMessage.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2485=['find','WhatsappAccountId','type','accountSid','authToken','phone','messages','create','whatsapp:','remote','/api/whatsapp/messages/','/status?token=','sid','catch','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','twilio','inspect','finally','utf8mb4','utf8mb4_unicode_ci','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappMessage.attributes','exports','define','WhatsappMessage','messageId','body','FULLTEXT','get','direction','toLowerCase','secret','isNil','findOne','WhatsappInteractionId','then','update','error','WhatsappAccount'];(function(_0x235544,_0x4d7f6b){var _0x409f7c=function(_0x3ffc8c){while(--_0x3ffc8c){_0x235544['push'](_0x235544['shift']());}};_0x409f7c(++_0x4d7f6b);}(_0x2485,0x150));var _0x5248=function(_0x15acfe,_0x6ccd90){_0x15acfe=_0x15acfe-0x0;var _0x292bb3=_0x2485[_0x15acfe];return _0x292bb3;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x5248('0x0'))('api');var moment=require('moment');var BPromise=require(_0x5248('0x1'));var rp=require(_0x5248('0x2'));var fs=require('fs');var path=require(_0x5248('0x3'));var rimraf=require(_0x5248('0x4'));var config=require(_0x5248('0x5'));var attributes=require(_0x5248('0x6'));module[_0x5248('0x7')]=function(_0x4fbc36,_0x418c33){return _0x4fbc36[_0x5248('0x8')](_0x5248('0x9'),attributes,{'tableName':'whatsapp_messages','paranoid':![],'indexes':[{'name':_0x5248('0xa'),'fields':[_0x5248('0xa')]},{'name':'fti_whatsapp_messages','fields':[_0x5248('0xb')],'type':_0x5248('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x338329,_0xa3298,_0x3848fd){var _0x47601c=_0x4fbc36['models'];var _0x28ce93=_0x338329[_0x5248('0xd')]({'plain':!![]});if(_0x28ce93[_0x5248('0xe')][_0x5248('0xf')]()==='in'||_0x28ce93[_0x5248('0xe')]['toLowerCase']()==='out'&&!_0x28ce93[_0x5248('0x10')]&&!_[_0x5248('0x11')](_0x28ce93['UserId'])){_0x47601c['WhatsappInteraction'][_0x5248('0x12')]({'where':{'id':_0x28ce93[_0x5248('0x13')]}})[_0x5248('0x14')](function(_0x29e15e){if(_0x29e15e){_0x29e15e[_0x5248('0x15')]({'lastMsgAt':_0x28ce93['createdAt'],'lastMsgDirection':_0x28ce93[_0x5248('0xe')][_0x5248('0xf')]()});}})['catch'](function(_0x75fcb7){console[_0x5248('0x16')](_0x75fcb7);});}if(_0x28ce93[_0x5248('0xe')]==='out'&&!_0x28ce93[_0x5248('0x10')]){var _0x3aee5c;_0x47601c[_0x5248('0x17')][_0x5248('0x18')]({'where':{'id':_0x28ce93[_0x5248('0x19')]},'raw':!![]})[_0x5248('0x14')](function(_0x4dc4bc){_0x3aee5c=_0x4dc4bc;if(_0x3aee5c&&_0x3aee5c[_0x5248('0x1a')]){switch(_0x3aee5c[_0x5248('0x1a')]){case'twilio':var _0x1c6826=require('twilio');if(_0x3aee5c[_0x5248('0x1b')]&&_0x3aee5c[_0x5248('0x1c')]&&_0x3aee5c[_0x5248('0x1d')]){var _0x35536a=new _0x1c6826(_0x3aee5c[_0x5248('0x1b')],_0x3aee5c[_0x5248('0x1c')]);_0x35536a[_0x5248('0x1e')][_0x5248('0x1f')]({'body':_0x28ce93[_0x5248('0xb')],'to':'whatsapp:'+_0x28ce93['phone'],'from':_0x5248('0x20')+_0x3aee5c[_0x5248('0x1d')],'statusCallback':_0x3aee5c[_0x5248('0x21')]+_0x5248('0x22')+_0x28ce93['id']+_0x5248('0x23')+_0x3aee5c['token']})['then'](function(_0x88c44f){if(_0x88c44f[_0x5248('0x24')]){return _0x338329[_0x5248('0x15')]({'messageId':_0x88c44f['sid']});}})[_0x5248('0x25')](function(_0x55c9ce){logger[_0x5248('0x16')](_0x5248('0x26'),_0x5248('0x27'),_0x5248('0x28'),util[_0x5248('0x29')](_0x55c9ce,{'showHidden':![],'depth':null}));});}else{logger[_0x5248('0x16')]('WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x5248('0x28'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;}}})[_0x5248('0x2a')](function(){_0x3848fd();});}else{_0x3848fd();}}},'charset':_0x5248('0x2b'),'collate':_0x5248('0x2c')});}; \ No newline at end of file +var _0x8b43=['out','secret','isNil','UserId','WhatsappInteraction','then','update','createdAt','catch','error','find','WhatsappAccountId','twilio','accountSid','authToken','phone','create','whatsapp:','remote','/status?token=','token','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappMessage.attributes','exports','define','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','body','FULLTEXT','models','direction','toLowerCase'];(function(_0x2bc9f3,_0x53011e){var _0xca6656=function(_0x3f4864){while(--_0x3f4864){_0x2bc9f3['push'](_0x2bc9f3['shift']());}};_0xca6656(++_0x53011e);}(_0x8b43,0x182));var _0x38b4=function(_0x3e7d49,_0x29bca4){_0x3e7d49=_0x3e7d49-0x0;var _0xab52e3=_0x8b43[_0x3e7d49];return _0xab52e3;};'use strict';var _=require(_0x38b4('0x0'));var util=require(_0x38b4('0x1'));var logger=require(_0x38b4('0x2'))(_0x38b4('0x3'));var moment=require(_0x38b4('0x4'));var BPromise=require(_0x38b4('0x5'));var rp=require(_0x38b4('0x6'));var fs=require('fs');var path=require(_0x38b4('0x7'));var rimraf=require(_0x38b4('0x8'));var config=require(_0x38b4('0x9'));var attributes=require(_0x38b4('0xa'));module[_0x38b4('0xb')]=function(_0x15e787,_0x363b7b){return _0x15e787[_0x38b4('0xc')](_0x38b4('0xd'),attributes,{'tableName':_0x38b4('0xe'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0x38b4('0xf')]},{'name':_0x38b4('0x10'),'fields':[_0x38b4('0x11')],'type':_0x38b4('0x12')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x360bcf,_0x317386,_0x3d8948){var _0xf01b16=_0x15e787[_0x38b4('0x13')];var _0x390047=_0x360bcf['get']({'plain':!![]});if(_0x390047[_0x38b4('0x14')][_0x38b4('0x15')]()==='in'||_0x390047['direction'][_0x38b4('0x15')]()===_0x38b4('0x16')&&!_0x390047[_0x38b4('0x17')]&&!_[_0x38b4('0x18')](_0x390047[_0x38b4('0x19')])){_0xf01b16[_0x38b4('0x1a')]['findOne']({'where':{'id':_0x390047['WhatsappInteractionId']}})[_0x38b4('0x1b')](function(_0x4da29a){if(_0x4da29a){_0x4da29a[_0x38b4('0x1c')]({'lastMsgAt':_0x390047[_0x38b4('0x1d')],'lastMsgDirection':_0x390047[_0x38b4('0x14')][_0x38b4('0x15')]()});}})[_0x38b4('0x1e')](function(_0x39c123){console[_0x38b4('0x1f')](_0x39c123);});}if(_0x390047['direction']===_0x38b4('0x16')&&!_0x390047['secret']){var _0x7f74a9;_0xf01b16['WhatsappAccount'][_0x38b4('0x20')]({'where':{'id':_0x390047[_0x38b4('0x21')]},'raw':!![]})[_0x38b4('0x1b')](function(_0x4d4400){_0x7f74a9=_0x4d4400;if(_0x7f74a9&&_0x7f74a9['type']){switch(_0x7f74a9['type']){case _0x38b4('0x22'):var _0x5ca152=require(_0x38b4('0x22'));if(_0x7f74a9[_0x38b4('0x23')]&&_0x7f74a9[_0x38b4('0x24')]&&_0x7f74a9[_0x38b4('0x25')]){var _0xe05273=new _0x5ca152(_0x7f74a9['accountSid'],_0x7f74a9['authToken']);_0xe05273['messages'][_0x38b4('0x26')]({'body':_0x390047['body'],'to':_0x38b4('0x27')+_0x390047['phone'],'from':_0x38b4('0x27')+_0x7f74a9['phone'],'statusCallback':_0x7f74a9[_0x38b4('0x28')]+'/api/whatsapp/messages/'+_0x390047['id']+_0x38b4('0x29')+_0x7f74a9[_0x38b4('0x2a')]})[_0x38b4('0x1b')](function(_0x1f9f7f){if(_0x1f9f7f[_0x38b4('0x2b')]){return _0x360bcf[_0x38b4('0x1c')]({'messageId':_0x1f9f7f['sid']});}})[_0x38b4('0x1e')](function(_0x2f2cef){logger[_0x38b4('0x1f')](_0x38b4('0x2c'),_0x38b4('0x2d'),_0x38b4('0x22'),util[_0x38b4('0x2e')](_0x2f2cef,{'showHidden':![],'depth':null}));});}else{logger[_0x38b4('0x1f')](_0x38b4('0x2c'),_0x38b4('0x2d'),_0x38b4('0x22'),_0x38b4('0x2f'));}break;}}})[_0x38b4('0x30')](function(){_0x3d8948();});}else{_0x3d8948();}}},'charset':_0x38b4('0x31'),'collate':_0x38b4('0x32')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index e0c069d..1a724a9 100644 --- a/server/api/whatsappMessage/whatsappMessage.rpc.js +++ b/server/api/whatsappMessage/whatsappMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1a13=['body','options','raw','then','info','stringify','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','request','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','error','WhatsappMessage,\x20%s,\x20%s','message','result','catch','CreateWhatsappMessage','WhatsappMessage'];(function(_0xbf3d8c,_0x50805e){var _0x248096=function(_0x1e3b68){while(--_0x1e3b68){_0xbf3d8c['push'](_0xbf3d8c['shift']());}};_0x248096(++_0x50805e);}(_0x1a13,0x7a));var _0x31a1=function(_0x407132,_0x349b53){_0x407132=_0x407132-0x0;var _0x1dd167=_0x1a13[_0x407132];return _0x1dd167;};'use strict';var _=require(_0x31a1('0x0'));var util=require(_0x31a1('0x1'));var moment=require('moment');var BPromise=require(_0x31a1('0x2'));var rs=require(_0x31a1('0x3'));var fs=require('fs');var Redis=require(_0x31a1('0x4'));var db=require(_0x31a1('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x31a1('0x6'));var config=require(_0x31a1('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x31a1('0x8')]['http']({'port':0x232a});config[_0x31a1('0x9')]=_[_0x31a1('0xa')](config[_0x31a1('0x9')],{'host':_0x31a1('0xb'),'port':0x18eb});var socket=require(_0x31a1('0xc'))(new Redis(config[_0x31a1('0x9')]));require('./whatsappMessage.socket')['register'](socket);function respondWithRpcPromise(_0x5bd593,_0x4bc621,_0x54b458){return new BPromise(function(_0x26e52a,_0x391762){return client[_0x31a1('0xd')](_0x5bd593,_0x54b458)['then'](function(_0x299465){logger['info']('WhatsappMessage,\x20%s,\x20%s',_0x4bc621,'request\x20sent');logger[_0x31a1('0xe')](_0x31a1('0xf'),_0x4bc621,'request\x20sent',JSON['stringify'](_0x299465));if(_0x299465[_0x31a1('0x10')]){if(_0x299465[_0x31a1('0x10')]['code']===0x1f4){logger[_0x31a1('0x10')](_0x31a1('0x11'),_0x4bc621,_0x299465['error'][_0x31a1('0x12')]);return _0x391762(_0x299465[_0x31a1('0x10')][_0x31a1('0x12')]);}logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x4bc621,_0x299465[_0x31a1('0x10')][_0x31a1('0x12')]);return _0x26e52a(_0x299465[_0x31a1('0x10')][_0x31a1('0x12')]);}else{logger['info'](_0x31a1('0x11'),_0x4bc621,'request\x20sent');_0x26e52a(_0x299465[_0x31a1('0x13')]['message']);}})[_0x31a1('0x14')](function(_0x9d3916){logger[_0x31a1('0x10')]('WhatsappMessage,\x20%s,\x20%s',_0x4bc621,_0x9d3916);_0x391762(_0x9d3916);});});}exports[_0x31a1('0x15')]=function(_0x3ba07d){var _0x3423d9=this;return new Promise(function(_0x443a40,_0x361dd0){return db[_0x31a1('0x16')]['create'](_0x3ba07d[_0x31a1('0x17')],{'raw':_0x3ba07d[_0x31a1('0x18')]?_0x3ba07d[_0x31a1('0x18')][_0x31a1('0x19')]===undefined?!![]:![]:!![]})[_0x31a1('0x1a')](function(_0x272546){logger[_0x31a1('0x1b')](_0x31a1('0x15'),_0x3ba07d);logger['debug']('CreateWhatsappMessage',_0x3ba07d,JSON[_0x31a1('0x1c')](_0x272546));_0x443a40(_0x272546);})[_0x31a1('0x14')](function(_0x2d556b){logger[_0x31a1('0x10')](_0x31a1('0x15'),_0x2d556b[_0x31a1('0x12')],_0x3ba07d);_0x361dd0(_0x3423d9['error'](0x1f4,_0x2d556b[_0x31a1('0x12')]));});});}; \ No newline at end of file +var _0x467a=['error','code','message','result','catch','body','options','raw','CreateWhatsappMessage','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','register','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x2064e5,_0x4f6fa2){var _0x21a233=function(_0x1b2491){while(--_0x1b2491){_0x2064e5['push'](_0x2064e5['shift']());}};_0x21a233(++_0x4f6fa2);}(_0x467a,0xa4));var _0xa467=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x467a[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xa467('0x0'));var util=require(_0xa467('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa467('0x2'));var fs=require('fs');var Redis=require(_0xa467('0x3'));var db=require(_0xa467('0x4'))['db'];var utils=require(_0xa467('0x5'));var logger=require('../../config/logger')(_0xa467('0x6'));var config=require(_0xa467('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xa467('0x8')][_0xa467('0x9')]({'port':0x232a});config['redis']=_['defaults'](config[_0xa467('0xa')],{'host':_0xa467('0xb'),'port':0x18eb});var socket=require(_0xa467('0xc'))(new Redis(config[_0xa467('0xa')]));require('./whatsappMessage.socket')[_0xa467('0xd')](socket);function respondWithRpcPromise(_0x69bbbd,_0x199145,_0x29c65b){return new BPromise(function(_0x10855e,_0x388610){return client[_0xa467('0xe')](_0x69bbbd,_0x29c65b)[_0xa467('0xf')](function(_0x4818e2){logger[_0xa467('0x10')](_0xa467('0x11'),_0x199145,_0xa467('0x12'));logger[_0xa467('0x13')](_0xa467('0x14'),_0x199145,'request\x20sent',JSON[_0xa467('0x15')](_0x4818e2));if(_0x4818e2[_0xa467('0x16')]){if(_0x4818e2[_0xa467('0x16')][_0xa467('0x17')]===0x1f4){logger[_0xa467('0x16')](_0xa467('0x11'),_0x199145,_0x4818e2[_0xa467('0x16')][_0xa467('0x18')]);return _0x388610(_0x4818e2['error'][_0xa467('0x18')]);}logger[_0xa467('0x16')](_0xa467('0x11'),_0x199145,_0x4818e2[_0xa467('0x16')]['message']);return _0x10855e(_0x4818e2[_0xa467('0x16')]['message']);}else{logger[_0xa467('0x10')]('WhatsappMessage,\x20%s,\x20%s',_0x199145,_0xa467('0x12'));_0x10855e(_0x4818e2[_0xa467('0x19')][_0xa467('0x18')]);}})[_0xa467('0x1a')](function(_0x16b27c){logger[_0xa467('0x16')](_0xa467('0x11'),_0x199145,_0x16b27c);_0x388610(_0x16b27c);});});}exports['CreateWhatsappMessage']=function(_0x500d6a){var _0x14befb=this;return new Promise(function(_0x545b63,_0x4d3d68){return db['WhatsappMessage']['create'](_0x500d6a[_0xa467('0x1b')],{'raw':_0x500d6a['options']?_0x500d6a[_0xa467('0x1c')][_0xa467('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x217add){logger[_0xa467('0x10')](_0xa467('0x1e'),_0x500d6a);logger[_0xa467('0x13')](_0xa467('0x1e'),_0x500d6a,JSON[_0xa467('0x15')](_0x217add));_0x545b63(_0x217add);})[_0xa467('0x1a')](function(_0x11c871){logger['error'](_0xa467('0x1e'),_0x11c871[_0xa467('0x18')],_0x500d6a);_0x4d3d68(_0x14befb[_0xa467('0x16')](0x1f4,_0x11c871[_0xa467('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 185c5f7..8dbd287 100644 --- a/server/api/whatsappMessage/whatsappMessage.socket.js +++ b/server/api/whatsappMessage/whatsappMessage.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5bec=['remove','update','emit','removeListener','register','length','whatsappMessage:','./whatsappMessage.events','save'];(function(_0x4419e0,_0x34f758){var _0x32dfd5=function(_0x2c16a7){while(--_0x2c16a7){_0x4419e0['push'](_0x4419e0['shift']());}};_0x32dfd5(++_0x34f758);}(_0x5bec,0x85));var _0xc5be=function(_0x29d915,_0x54a040){_0x29d915=_0x29d915-0x0;var _0x160f86=_0x5bec[_0x29d915];return _0x160f86;};'use strict';var WhatsappMessageEvents=require(_0xc5be('0x0'));var events=[_0xc5be('0x1'),_0xc5be('0x2'),_0xc5be('0x3')];function createListener(_0x364a57,_0x53298c){return function(_0x54e503){_0x53298c[_0xc5be('0x4')](_0x364a57,_0x54e503);};}function removeListener(_0x8b48e5,_0x4d039a){return function(){WhatsappMessageEvents[_0xc5be('0x5')](_0x8b48e5,_0x4d039a);};}exports[_0xc5be('0x6')]=function(_0x5f4128){for(var _0x999618=0x0,_0x1de100=events[_0xc5be('0x7')];_0x999618<_0x1de100;_0x999618++){var _0x171be4=events[_0x999618];var _0x4204d7=createListener(_0xc5be('0x8')+_0x171be4,_0x5f4128);WhatsappMessageEvents['on'](_0x171be4,_0x4204d7);}}; \ No newline at end of file +var _0x3913=['whatsappMessage:','save','remove','update','emit','removeListener','register','length'];(function(_0x5141f1,_0x53baab){var _0xafd8e8=function(_0x1f6b17){while(--_0x1f6b17){_0x5141f1['push'](_0x5141f1['shift']());}};_0xafd8e8(++_0x53baab);}(_0x3913,0xf1));var _0x3391=function(_0x2fef6a,_0x336015){_0x2fef6a=_0x2fef6a-0x0;var _0x147971=_0x3913[_0x2fef6a];return _0x147971;};'use strict';var WhatsappMessageEvents=require('./whatsappMessage.events');var events=[_0x3391('0x0'),_0x3391('0x1'),_0x3391('0x2')];function createListener(_0x144cd2,_0x41eb28){return function(_0x5a6bbb){_0x41eb28[_0x3391('0x3')](_0x144cd2,_0x5a6bbb);};}function removeListener(_0x3d4d68,_0x2a1af7){return function(){WhatsappMessageEvents[_0x3391('0x4')](_0x3d4d68,_0x2a1af7);};}exports[_0x3391('0x5')]=function(_0x23152c){for(var _0x2c2d18=0x0,_0x6680fe=events[_0x3391('0x6')];_0x2c2d18<_0x6680fe;_0x2c2d18++){var _0x5cd402=events[_0x2c2d18];var _0x2b21a4=createListener(_0x3391('0x7')+_0x5cd402,_0x23152c);WhatsappMessageEvents['on'](_0x5cd402,_0x2b21a4);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index 9e47565..3801137 100644 --- a/server/api/whatsappQueue/index.js +++ b/server/api/whatsappQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb739=['getAgents','post','create','addTeams','addAgents','put','delete','destroy','removeAgents','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users'];(function(_0x4b8887,_0x39338d){var _0x320153=function(_0xf3496d){while(--_0xf3496d){_0x4b8887['push'](_0x4b8887['shift']());}};_0x320153(++_0x39338d);}(_0xb739,0x82));var _0x9b73=function(_0x521c76,_0x2d48f9){_0x521c76=_0x521c76-0x0;var _0x7fcf5f=_0xb739[_0x521c76];return _0x7fcf5f;};'use strict';var multer=require(_0x9b73('0x0'));var util=require('util');var path=require(_0x9b73('0x1'));var timeout=require(_0x9b73('0x2'));var express=require(_0x9b73('0x3'));var router=express[_0x9b73('0x4')]();var auth=require(_0x9b73('0x5'));var interaction=require(_0x9b73('0x6'));var config=require(_0x9b73('0x7'));var controller=require(_0x9b73('0x8'));router[_0x9b73('0x9')]('/',auth[_0x9b73('0xa')](),controller['index']);router[_0x9b73('0x9')](_0x9b73('0xb'),auth[_0x9b73('0xa')](),controller[_0x9b73('0xc')]);router[_0x9b73('0x9')](_0x9b73('0xd'),auth[_0x9b73('0xa')](),controller[_0x9b73('0xe')]);router[_0x9b73('0x9')](_0x9b73('0xf'),auth['isAuthenticated'](),controller[_0x9b73('0x10')]);router[_0x9b73('0x9')](_0x9b73('0x11'),auth[_0x9b73('0xa')](),controller[_0x9b73('0x12')]);router[_0x9b73('0x9')](_0x9b73('0x13'),auth[_0x9b73('0xa')](),controller[_0x9b73('0x14')]);router[_0x9b73('0x15')]('/',auth[_0x9b73('0xa')](),controller[_0x9b73('0x16')]);router[_0x9b73('0x15')](_0x9b73('0x11'),auth[_0x9b73('0xa')](),controller[_0x9b73('0x17')]);router['post'](_0x9b73('0x13'),auth[_0x9b73('0xa')](),controller[_0x9b73('0x18')]);router[_0x9b73('0x19')](_0x9b73('0xd'),auth[_0x9b73('0xa')](),controller['update']);router[_0x9b73('0x1a')]('/:id',auth[_0x9b73('0xa')](),controller[_0x9b73('0x1b')]);router[_0x9b73('0x1a')](_0x9b73('0x11'),auth[_0x9b73('0xa')](),controller['removeTeams']);router[_0x9b73('0x1a')](_0x9b73('0x13'),auth[_0x9b73('0xa')](),controller[_0x9b73('0x1c')]);module[_0x9b73('0x1d')]=router; \ No newline at end of file +var _0xe028=['/:id','/:id/members','getTeams','/:id/users','getAgents','post','create','/:id/teams','addTeams','addAgents','put','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','connect-timeout','../../config/environment','./whatsappQueue.controller','get','isAuthenticated','index','describe'];(function(_0x378946,_0x4af149){var _0x588a38=function(_0x54b795){while(--_0x54b795){_0x378946['push'](_0x378946['shift']());}};_0x588a38(++_0x4af149);}(_0xe028,0x149));var _0x8e02=function(_0x540af1,_0x4225d6){_0x540af1=_0x540af1-0x0;var _0x33ae8b=_0xe028[_0x540af1];return _0x33ae8b;};'use strict';var multer=require(_0x8e02('0x0'));var util=require(_0x8e02('0x1'));var path=require('path');var timeout=require(_0x8e02('0x2'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x8e02('0x3'));var controller=require(_0x8e02('0x4'));router[_0x8e02('0x5')]('/',auth[_0x8e02('0x6')](),controller[_0x8e02('0x7')]);router[_0x8e02('0x5')]('/describe',auth[_0x8e02('0x6')](),controller[_0x8e02('0x8')]);router['get'](_0x8e02('0x9'),auth[_0x8e02('0x6')](),controller['show']);router[_0x8e02('0x5')](_0x8e02('0xa'),auth[_0x8e02('0x6')](),controller['getMembers']);router[_0x8e02('0x5')]('/:id/teams',auth['isAuthenticated'](),controller[_0x8e02('0xb')]);router[_0x8e02('0x5')](_0x8e02('0xc'),auth[_0x8e02('0x6')](),controller[_0x8e02('0xd')]);router[_0x8e02('0xe')]('/',auth['isAuthenticated'](),controller[_0x8e02('0xf')]);router[_0x8e02('0xe')](_0x8e02('0x10'),auth[_0x8e02('0x6')](),controller[_0x8e02('0x11')]);router[_0x8e02('0xe')](_0x8e02('0xc'),auth[_0x8e02('0x6')](),controller[_0x8e02('0x12')]);router[_0x8e02('0x13')](_0x8e02('0x9'),auth[_0x8e02('0x6')](),controller[_0x8e02('0x14')]);router[_0x8e02('0x15')](_0x8e02('0x9'),auth[_0x8e02('0x6')](),controller[_0x8e02('0x16')]);router[_0x8e02('0x15')](_0x8e02('0x10'),auth[_0x8e02('0x6')](),controller[_0x8e02('0x17')]);router[_0x8e02('0x15')](_0x8e02('0xc'),auth[_0x8e02('0x6')](),controller[_0x8e02('0x18')]);module[_0x8e02('0x19')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index f312840..59a7069 100644 --- a/server/api/whatsappQueue/whatsappQueue.attributes.js +++ b/server/api/whatsappQueue/whatsappQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xebda=['ENUM','roundrobin','exports','STRING','name'];(function(_0x4d9d1e,_0x3c2d20){var _0x1b9d54=function(_0x373c21){while(--_0x373c21){_0x4d9d1e['push'](_0x4d9d1e['shift']());}};_0x1b9d54(++_0x3c2d20);}(_0xebda,0x84));var _0xaebd=function(_0x3aaf0a,_0x450970){_0x3aaf0a=_0x3aaf0a-0x0;var _0x33e6bc=_0xebda[_0x3aaf0a];return _0x33e6bc;};'use strict';var Sequelize=require('sequelize');module[_0xaebd('0x0')]={'name':{'type':Sequelize[_0xaebd('0x1')],'unique':_0xaebd('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xaebd('0x3')]('rrmemory','beepall',_0xaebd('0x4'))},'description':{'type':Sequelize[_0xaebd('0x1')]}}; \ No newline at end of file +var _0x92e1=['sequelize','exports','STRING','name','ENUM','beepall','roundrobin'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x92e1,0xa8));var _0x192e=function(_0x187399,_0x40c56d){_0x187399=_0x187399-0x0;var _0x40fa92=_0x92e1[_0x187399];return _0x40fa92;};'use strict';var Sequelize=require(_0x192e('0x0'));module[_0x192e('0x1')]={'name':{'type':Sequelize[_0x192e('0x2')],'unique':_0x192e('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x192e('0x4')]('rrmemory',_0x192e('0x5'),_0x192e('0x6'))},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index dcd0ef5..d1cdf21 100644 --- a/server/api/whatsappQueue/whatsappQueue.controller.js +++ b/server/api/whatsappQueue/whatsappQueue.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfee3=['zip-dir','bluebird','path','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./whatsappQueue.socket','sendStatus','status','end','count','offset','limit','Content-Range','json','apply','update','then','destroy','get','UserProfileResource','error','name','send','index','map','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','WhatsappQueue','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','WhatsappQueues','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserWhatsappQueue','WhatsappQueueId','User','findAndCountAll','agent','whatsappPause','updatedAt','format','%s/%s','SIP','createdAt','getTeams','Team','length','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','userWhatsappQueue:save','select','field','tq.TeamId','from','team_has_whatsapp_queues','user_has_teams','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','TeamId','includes','all','union','compact','value','removeTeams','isEmpty','removeAgents','emit','addAgents','omit','spread','isArray','userWhatsappQueue:remove','getAgents','html-pdf','eml-format','rimraf'];(function(_0x4bc182,_0x4b96fd){var _0x426132=function(_0xf433e1){while(--_0xf433e1){_0x4bc182['push'](_0x4bc182['shift']());}};_0x426132(++_0x4b96fd);}(_0xfee3,0x111));var _0x3fee=function(_0x31a576,_0x424419){_0x31a576=_0x31a576-0x0;var _0x30b1d3=_0xfee3[_0x31a576];return _0x30b1d3;};'use strict';var pdf=require(_0x3fee('0x0'));var emlformat=require(_0x3fee('0x1'));var rimraf=require(_0x3fee('0x2'));var zipdir=require(_0x3fee('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x3fee('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x3fee('0x5'));var sox=require('sox');var csv=require(_0x3fee('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x3fee('0x7'));var squel=require(_0x3fee('0x8'));var crypto=require(_0x3fee('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x3fee('0xa'));var toCsv=require(_0x3fee('0x6'));var querystring=require(_0x3fee('0xb'));var Papa=require(_0x3fee('0xc'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x3fee('0xd'));var as=require(_0x3fee('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x3fee('0xf'));var utils=require('../../config/utils');var config=require(_0x3fee('0x10'));var db=require(_0x3fee('0x11'))['db'];config['redis']=_[_0x3fee('0x12')](config[_0x3fee('0x13')],{'host':_0x3fee('0x14'),'port':0x18eb});var socket=require(_0x3fee('0x15'))(new Redis(config[_0x3fee('0x13')]));require(_0x3fee('0x16'))['register'](socket);function respondWithStatusCode(_0x27c578,_0x57f359){_0x57f359=_0x57f359||0xcc;return function(_0x37b57d){if(_0x37b57d){return _0x27c578[_0x3fee('0x17')](_0x57f359);}return _0x27c578[_0x3fee('0x18')](_0x57f359)[_0x3fee('0x19')]();};}function respondWithResult(_0x4f6edb,_0x2376d7){_0x2376d7=_0x2376d7||0xc8;return function(_0x54decf){if(_0x54decf){return _0x4f6edb[_0x3fee('0x18')](_0x2376d7)['json'](_0x54decf);}};}function respondWithFilteredResult(_0x3b56e7,_0x51a48b){return function(_0x24eebd){if(_0x24eebd){var _0x3d5269=_0x24eebd[_0x3fee('0x1a')],_0x1b34f9=_0x51a48b[_0x3fee('0x1b')],_0x10caa6=_0x51a48b[_0x3fee('0x1b')]+_0x51a48b[_0x3fee('0x1c')],_0x19fb42;if(_0x10caa6>=_0x3d5269){_0x10caa6=_0x3d5269;_0x19fb42=0xc8;}else{_0x19fb42=0xce;}_0x3b56e7[_0x3fee('0x18')](_0x19fb42);return _0x3b56e7['set'](_0x3fee('0x1d'),_0x1b34f9+'-'+_0x10caa6+'/'+_0x3d5269)[_0x3fee('0x1e')](_0x24eebd);}return null;};}function patchUpdates(_0xf5e32b){return function(_0x5880cb){try{jsonpatch[_0x3fee('0x1f')](_0x5880cb,_0xf5e32b,!![]);}catch(_0x3b7d0b){return BPromise['reject'](_0x3b7d0b);}return _0x5880cb['save']();};}function saveUpdates(_0x4c3208,_0xc35e71){return function(_0x6035dc){if(_0x6035dc){return _0x6035dc[_0x3fee('0x20')](_0x4c3208)[_0x3fee('0x21')](function(_0x4209a9){return _0x4209a9;});}return null;};}function removeEntity(_0x50eefc,_0x5ae041){return function(_0x388d09){if(_0x388d09){return _0x388d09[_0x3fee('0x22')]()[_0x3fee('0x21')](function(){var _0x2a7ced=_0x388d09[_0x3fee('0x23')]({'plain':!![]});var _0x1f359c='WhatsappQueues';return db[_0x3fee('0x24')]['destroy']({'where':{'type':_0x1f359c,'resourceId':_0x2a7ced['id']}})[_0x3fee('0x21')](function(){return _0x388d09;});})[_0x3fee('0x21')](function(){_0x50eefc[_0x3fee('0x18')](0xcc)[_0x3fee('0x19')]();});}};}function handleEntityNotFound(_0x5a60be,_0x21d98e){return function(_0x56220a){if(!_0x56220a){_0x5a60be['sendStatus'](0x194);}return _0x56220a;};}function handleError(_0x349d79,_0x3cbf32){_0x3cbf32=_0x3cbf32||0x1f4;return function(_0x429938){logger[_0x3fee('0x25')](_0x429938['stack']);if(_0x429938[_0x3fee('0x26')]){delete _0x429938[_0x3fee('0x26')];}_0x349d79[_0x3fee('0x18')](_0x3cbf32)[_0x3fee('0x27')](_0x429938);};}exports[_0x3fee('0x28')]=function(_0x312995,_0x50ac95){var _0x1b0690={},_0x52f1a2={},_0x22ec7e={'count':0x0,'rows':[]};var _0x2bf803=_[_0x3fee('0x29')](db['WhatsappQueue']['rawAttributes'],function(_0x2f43c8){return{'name':_0x2f43c8['fieldName'],'type':_0x2f43c8[_0x3fee('0x2a')][_0x3fee('0x2b')]};});_0x52f1a2[_0x3fee('0x2c')]=_['map'](_0x2bf803,_0x3fee('0x26'));_0x52f1a2[_0x3fee('0x2d')]=_[_0x3fee('0x2e')](_0x312995[_0x3fee('0x2d')]);_0x52f1a2[_0x3fee('0x2f')]=_['intersection'](_0x52f1a2[_0x3fee('0x2c')],_0x52f1a2[_0x3fee('0x2d')]);_0x1b0690['attributes']=_[_0x3fee('0x30')](_0x52f1a2[_0x3fee('0x2c')],qs[_0x3fee('0x31')](_0x312995[_0x3fee('0x2d')][_0x3fee('0x31')]));_0x1b0690[_0x3fee('0x32')]=_0x1b0690[_0x3fee('0x32')]['length']?_0x1b0690[_0x3fee('0x32')]:_0x52f1a2[_0x3fee('0x2c')];if(!_0x312995[_0x3fee('0x2d')][_0x3fee('0x33')](_0x3fee('0x34'))){_0x1b0690[_0x3fee('0x1c')]=qs[_0x3fee('0x1c')](_0x312995[_0x3fee('0x2d')][_0x3fee('0x1c')]);_0x1b0690[_0x3fee('0x1b')]=qs[_0x3fee('0x1b')](_0x312995['query']['offset']);}_0x1b0690[_0x3fee('0x35')]=qs[_0x3fee('0x36')](_0x312995['query'][_0x3fee('0x36')]);_0x1b0690['where']=qs[_0x3fee('0x2f')](_[_0x3fee('0x37')](_0x312995[_0x3fee('0x2d')],_0x52f1a2[_0x3fee('0x2f')]),_0x2bf803);if(_0x312995[_0x3fee('0x2d')]['filter']){_0x1b0690[_0x3fee('0x38')]=_[_0x3fee('0x39')](_0x1b0690[_0x3fee('0x38')],{'$or':_[_0x3fee('0x29')](_0x2bf803,function(_0x3ac4e2){if(_0x3ac4e2[_0x3fee('0x2a')]!==_0x3fee('0x3a')){var _0x4c7045={};_0x4c7045[_0x3ac4e2[_0x3fee('0x26')]]={'$like':'%'+_0x312995[_0x3fee('0x2d')][_0x3fee('0x3b')]+'%'};return _0x4c7045;}})});}_0x1b0690=_[_0x3fee('0x39')]({},_0x1b0690,_0x312995[_0x3fee('0x3c')]);var _0xdbdfcf={'where':_0x1b0690[_0x3fee('0x38')]};return db[_0x3fee('0x3d')][_0x3fee('0x1a')](_0xdbdfcf)[_0x3fee('0x21')](function(_0x5325dc){_0x22ec7e[_0x3fee('0x1a')]=_0x5325dc;if(_0x312995[_0x3fee('0x2d')][_0x3fee('0x3e')]){_0x1b0690[_0x3fee('0x3f')]=[{'all':!![]}];}return db['WhatsappQueue'][_0x3fee('0x40')](_0x1b0690);})['then'](function(_0x4a0fb4){_0x22ec7e[_0x3fee('0x41')]=_0x4a0fb4;return _0x22ec7e;})[_0x3fee('0x21')](respondWithFilteredResult(_0x50ac95,_0x1b0690))[_0x3fee('0x42')](handleError(_0x50ac95,null));};exports[_0x3fee('0x43')]=function(_0xe83dc8,_0x5efe19){var _0xb00b6f={'raw':!![],'where':{'id':_0xe83dc8[_0x3fee('0x44')]['id']}},_0x1019b9={};_0x1019b9[_0x3fee('0x2c')]=_[_0x3fee('0x2e')](db[_0x3fee('0x3d')][_0x3fee('0x45')]);_0x1019b9['query']=_[_0x3fee('0x2e')](_0xe83dc8[_0x3fee('0x2d')]);_0x1019b9[_0x3fee('0x2f')]=_[_0x3fee('0x30')](_0x1019b9[_0x3fee('0x2c')],_0x1019b9[_0x3fee('0x2d')]);_0xb00b6f['attributes']=_[_0x3fee('0x30')](_0x1019b9[_0x3fee('0x2c')],qs[_0x3fee('0x31')](_0xe83dc8[_0x3fee('0x2d')][_0x3fee('0x31')]));_0xb00b6f[_0x3fee('0x32')]=_0xb00b6f[_0x3fee('0x32')]['length']?_0xb00b6f[_0x3fee('0x32')]:_0x1019b9[_0x3fee('0x2c')];if(_0xe83dc8[_0x3fee('0x2d')][_0x3fee('0x3e')]){_0xb00b6f[_0x3fee('0x3f')]=[{'all':!![]}];}_0xb00b6f=_[_0x3fee('0x39')]({},_0xb00b6f,_0xe83dc8[_0x3fee('0x3c')]);return db[_0x3fee('0x3d')][_0x3fee('0x46')](_0xb00b6f)[_0x3fee('0x21')](handleEntityNotFound(_0x5efe19,null))[_0x3fee('0x21')](respondWithResult(_0x5efe19,null))['catch'](handleError(_0x5efe19,null));};exports[_0x3fee('0x47')]=function(_0x1d2d54,_0x264805){return db[_0x3fee('0x3d')][_0x3fee('0x47')](_0x1d2d54[_0x3fee('0x48')],{})['then'](function(_0x57b709){var _0x2ece71=_0x1d2d54[_0x3fee('0x49')][_0x3fee('0x23')]({'plain':!![]});if(!_0x2ece71)throw new Error(_0x3fee('0x4a'));if(_0x2ece71[_0x3fee('0x4b')]===_0x3fee('0x49')){var _0x41c841=_0x57b709['get']({'plain':!![]});var _0x5bcaea=_0x3fee('0x4c');return db[_0x3fee('0x4d')][_0x3fee('0x46')]({'where':{'name':_0x5bcaea,'userProfileId':_0x2ece71['userProfileId']},'raw':!![]})[_0x3fee('0x21')](function(_0x591858){if(_0x591858&&_0x591858['autoAssociation']===0x0){return db['UserProfileResource'][_0x3fee('0x47')]({'name':_0x41c841['name'],'resourceId':_0x41c841['id'],'type':_0x591858['name'],'sectionId':_0x591858['id']},{})['then'](function(){return _0x57b709;});}else{return _0x57b709;}})[_0x3fee('0x42')](function(_0x343668){logger['error'](_0x3fee('0x4e'),_0x343668);throw _0x343668;});}return _0x57b709;})[_0x3fee('0x21')](respondWithResult(_0x264805,0xc9))['catch'](handleError(_0x264805,null));};exports[_0x3fee('0x20')]=function(_0x8d978e,_0x516380){if(_0x8d978e[_0x3fee('0x48')]['id']){delete _0x8d978e[_0x3fee('0x48')]['id'];}return db['WhatsappQueue'][_0x3fee('0x46')]({'where':{'id':_0x8d978e[_0x3fee('0x44')]['id']}})[_0x3fee('0x21')](handleEntityNotFound(_0x516380,null))[_0x3fee('0x21')](saveUpdates(_0x8d978e[_0x3fee('0x48')],null))['then'](respondWithResult(_0x516380,null))[_0x3fee('0x42')](handleError(_0x516380,null));};exports[_0x3fee('0x22')]=function(_0x59e11b,_0x20a726){return db['WhatsappQueue'][_0x3fee('0x46')]({'where':{'id':_0x59e11b[_0x3fee('0x44')]['id']}})[_0x3fee('0x21')](handleEntityNotFound(_0x20a726,null))[_0x3fee('0x21')](removeEntity(_0x20a726,null))[_0x3fee('0x42')](handleError(_0x20a726,null));};exports[_0x3fee('0x4f')]=function(_0x1ae93e,_0x4631b8){return db[_0x3fee('0x3d')]['describe']()[_0x3fee('0x21')](respondWithResult(_0x4631b8,null))[_0x3fee('0x42')](handleError(_0x4631b8,null));};exports[_0x3fee('0x50')]=function(_0x3791c8,_0x1b1634,_0x1b25db){var _0x22a9fa={'raw':!![],'where':{}},_0x33dfab={},_0xac8bc2;return db[_0x3fee('0x3d')][_0x3fee('0x51')]({'where':{'id':_0x3791c8[_0x3fee('0x44')]['id']}})[_0x3fee('0x21')](handleEntityNotFound(_0x1b1634,null))[_0x3fee('0x21')](function(_0x3347cd){if(_0x3347cd){_0xac8bc2=_0x3347cd[_0x3fee('0x23')]({'plain':!![]});_0x33dfab[_0x3fee('0x2c')]=_['keys'](db[_0x3fee('0x52')][_0x3fee('0x45')]);_0x33dfab['query']=_['keys'](_0x3791c8['query']);_0x33dfab[_0x3fee('0x2f')]=_[_0x3fee('0x30')](_0x33dfab[_0x3fee('0x2c')],_0x33dfab[_0x3fee('0x2d')]);_0x22a9fa[_0x3fee('0x32')]=_['intersection'](_0x33dfab['model'],qs[_0x3fee('0x31')](_0x3791c8['query'][_0x3fee('0x31')]));_0x22a9fa['attributes']=_0x22a9fa[_0x3fee('0x32')]['length']?_0x22a9fa['attributes']:_0x33dfab['model'];if(!_0x3791c8['query'][_0x3fee('0x33')]('nolimit')){_0x22a9fa[_0x3fee('0x1c')]=qs[_0x3fee('0x1c')](_0x3791c8[_0x3fee('0x2d')]['limit']);_0x22a9fa[_0x3fee('0x1b')]=qs[_0x3fee('0x1b')](_0x3791c8[_0x3fee('0x2d')]['offset']);}_0x22a9fa['order']=qs['sort'](_0x3791c8['query'][_0x3fee('0x36')]);_0x22a9fa[_0x3fee('0x38')]=qs[_0x3fee('0x2f')](_[_0x3fee('0x37')](_0x3791c8[_0x3fee('0x2d')],_0x33dfab[_0x3fee('0x2f')]));_0x22a9fa[_0x3fee('0x38')][_0x3fee('0x53')]=_0x3347cd['id'];if(_0x3791c8[_0x3fee('0x2d')][_0x3fee('0x3b')]){_0x22a9fa[_0x3fee('0x38')]=_[_0x3fee('0x39')](_0x22a9fa[_0x3fee('0x38')],{'$or':_[_0x3fee('0x29')](_0x22a9fa[_0x3fee('0x32')],function(_0x48b079){var _0x1bb0cb={};_0x1bb0cb[_0x48b079]={'$like':'%'+_0x3791c8[_0x3fee('0x2d')][_0x3fee('0x3b')]+'%'};return _0x1bb0cb;})});}_0x22a9fa=_[_0x3fee('0x39')]({},_0x22a9fa,_0x3791c8['options']);return db[_0x3fee('0x52')]['findAll'](_0x22a9fa);}})['then'](function(_0x37b5bb){if(_0x37b5bb){return db[_0x3fee('0x54')][_0x3fee('0x55')]({'where':{'id':_['map'](_0x37b5bb,'UserId'),'role':_0x3fee('0x56')},'attributes':['id',_0x3fee('0x26'),_0x3fee('0x57'),_0x3fee('0x58'),'createdAt']});}})[_0x3fee('0x21')](function(_0x55b198){if(_0x55b198){return{'count':_0x55b198[_0x3fee('0x1a')],'rows':_[_0x3fee('0x29')](_0x55b198[_0x3fee('0x41')],function(_0x36bc42){return{'membername':_0x36bc42['name'],'UserId':_0x36bc42['id'],'queue_name':_0xac8bc2[_0x3fee('0x26')],'WhatsappQueueId':_0xac8bc2['id'],'interface':util[_0x3fee('0x59')](_0x3fee('0x5a'),_0x3fee('0x5b'),_0x36bc42[_0x3fee('0x26')]),'penalty':0x0,'paused':_0x36bc42[_0x3fee('0x57')],'createdAt':_0x36bc42[_0x3fee('0x5c')],'updatedAt':_0x36bc42['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x3fee('0x21')](respondWithFilteredResult(_0x1b1634,_0x22a9fa))[_0x3fee('0x42')](handleError(_0x1b1634,null));};exports[_0x3fee('0x5d')]=function(_0x3cc204,_0x37bc31,_0x1a3609){var _0x49ac76={};var _0x23f834={};var _0x3dbb0d;var _0x35da5d;return db[_0x3fee('0x3d')][_0x3fee('0x51')]({'where':{'id':_0x3cc204[_0x3fee('0x44')]['id']}})[_0x3fee('0x21')](handleEntityNotFound(_0x37bc31,null))['then'](function(_0x55d0e3){if(_0x55d0e3){_0x3dbb0d=_0x55d0e3;_0x23f834[_0x3fee('0x2c')]=_[_0x3fee('0x2e')](db[_0x3fee('0x5e')][_0x3fee('0x45')]);_0x23f834[_0x3fee('0x2d')]=_['keys'](_0x3cc204[_0x3fee('0x2d')]);_0x23f834[_0x3fee('0x2f')]=_[_0x3fee('0x30')](_0x23f834[_0x3fee('0x2c')],_0x23f834[_0x3fee('0x2d')]);_0x49ac76[_0x3fee('0x32')]=_[_0x3fee('0x30')](_0x23f834[_0x3fee('0x2c')],qs[_0x3fee('0x31')](_0x3cc204[_0x3fee('0x2d')]['fields']));_0x49ac76[_0x3fee('0x32')]=_0x49ac76[_0x3fee('0x32')][_0x3fee('0x5f')]?_0x49ac76['attributes']:_0x23f834['model'];_0x49ac76[_0x3fee('0x35')]=qs[_0x3fee('0x36')](_0x3cc204[_0x3fee('0x2d')][_0x3fee('0x36')]);_0x49ac76['where']=qs[_0x3fee('0x2f')](_[_0x3fee('0x37')](_0x3cc204[_0x3fee('0x2d')],_0x23f834[_0x3fee('0x2f')]));if(_0x3cc204['query'][_0x3fee('0x3b')]){_0x49ac76[_0x3fee('0x38')]=_[_0x3fee('0x39')](_0x49ac76['where'],{'$or':_[_0x3fee('0x29')](_0x49ac76[_0x3fee('0x32')],function(_0x348dd1){var _0x1388bc={};_0x1388bc[_0x348dd1]={'$like':'%'+_0x3cc204[_0x3fee('0x2d')][_0x3fee('0x3b')]+'%'};return _0x1388bc;})});}_0x49ac76=_[_0x3fee('0x39')]({},_0x49ac76,_0x3cc204['options']);return _0x3dbb0d[_0x3fee('0x5d')](_0x49ac76);}})[_0x3fee('0x21')](function(_0x38f5db){if(_0x38f5db){_0x35da5d=_0x38f5db['length'];if(!_0x3cc204[_0x3fee('0x2d')]['hasOwnProperty'](_0x3fee('0x34'))){_0x49ac76[_0x3fee('0x1c')]=qs['limit'](_0x3cc204[_0x3fee('0x2d')][_0x3fee('0x1c')]);_0x49ac76[_0x3fee('0x1b')]=qs[_0x3fee('0x1b')](_0x3cc204['query'][_0x3fee('0x1b')]);}return _0x3dbb0d[_0x3fee('0x5d')](_0x49ac76);}})[_0x3fee('0x21')](function(_0x4448ae){if(_0x4448ae){return _0x4448ae?{'count':_0x35da5d,'rows':_0x4448ae}:null;}})['then'](respondWithResult(_0x37bc31,null))[_0x3fee('0x42')](handleError(_0x37bc31,null));};exports[_0x3fee('0x60')]=function(_0x827b3f,_0x510d19,_0x1e5fc0){var _0x330fbe=_0x827b3f['body'][_0x3fee('0x61')];return db['Team'][_0x3fee('0x40')]({'where':{'id':_0x330fbe},'attributes':['id'],'include':[{'model':db[_0x3fee('0x54')],'as':_0x3fee('0x62'),'attributes':['id',_0x3fee('0x26'),_0x3fee('0x63'),_0x3fee('0x64'),_0x3fee('0x65')],'raw':!![]}]})[_0x3fee('0x21')](function(_0x443b33){if(_0x443b33){var _0x3d156b=_[_0x3fee('0x66')](_0x443b33,function(_0x385d0f){var _0x563735=_0x385d0f[_0x3fee('0x23')]({'plain':!![]});return _0x563735[_0x3fee('0x62')];});return db[_0x3fee('0x3d')][_0x3fee('0x46')]({'where':{'id':_0x827b3f['params']['id']}})[_0x3fee('0x21')](function(_0x298188){return db[_0x3fee('0x67')][_0x3fee('0x68')](function(_0x3e8dfe){return _0x298188[_0x3fee('0x60')](_0x330fbe,{'transaction':_0x3e8dfe})[_0x3fee('0x21')](function(){return BPromise[_0x3fee('0x69')](_0x3d156b,function(_0x47d3ad){return db[_0x3fee('0x52')][_0x3fee('0x6a')]({'where':{'UserId':_0x47d3ad['id'],'WhatsappQueueId':_0x827b3f[_0x3fee('0x44')]['id']},'transaction':_0x3e8dfe});});})[_0x3fee('0x21')](function(){_0x3d156b[_0x3fee('0x6b')](function(_0x10827d){socket['emit'](_0x3fee('0x6c'),{'UserId':_0x10827d['id'],'WhatsappQueueId':_0x298188['id']});});});});});}})[_0x3fee('0x21')](respondWithStatusCode(_0x510d19,null))[_0x3fee('0x42')](handleError(_0x510d19,null));};exports['removeTeams']=function(_0x5ac8cc,_0x5b19d3,_0x3bde43){return db[_0x3fee('0x5e')][_0x3fee('0x40')]({'where':{'id':_0x5ac8cc[_0x3fee('0x2d')]['ids']},'attributes':['id'],'include':[{'model':db[_0x3fee('0x54')],'as':_0x3fee('0x62'),'attributes':['id'],'raw':!![]}]})[_0x3fee('0x21')](handleEntityNotFound(_0x5b19d3,null))[_0x3fee('0x21')](function(_0x44065c){var _0x22f465=_[_0x3fee('0x29')](_0x44065c,'id');var _0x35da36=[];var _0x2e44f3=[];var _0xc2981=squel[_0x3fee('0x6d')]();_0xc2981[_0x3fee('0x6e')](_0x3fee('0x6f'))[_0x3fee('0x70')](_0x3fee('0x71'),'tq')['join'](_0x3fee('0x72'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0x3fee('0x73'),_0x5ac8cc['params']['id']);for(var _0x465f4e=0x0;_0x465f4e<_0x44065c[_0x3fee('0x5f')];_0x465f4e+=0x1){let _0x3105ec=_0x44065c[_0x465f4e];for(var _0x14bcb4=0x0;_0x14bcb4<_0x3105ec[_0x3fee('0x62')][_0x3fee('0x5f')];_0x14bcb4+=0x1){let _0x5a02f6=_0x3105ec[_0x3fee('0x62')][_0x14bcb4];var _0x16eb75=_0xc2981[_0x3fee('0x74')]();_0x16eb75['where'](_0x3fee('0x75'),_0x5a02f6['id']);_0x2e44f3[_0x3fee('0x76')](db[_0x3fee('0x67')][_0x3fee('0x2d')](_0x16eb75[_0x3fee('0x77')](),{'type':db[_0x3fee('0x67')][_0x3fee('0x78')][_0x3fee('0x79')]})[_0x3fee('0x21')](function(_0x44859f){if(_0x44859f['length']===0x1){return _0x5a02f6['id'];}else{var _0x229019=_['every'](_[_0x3fee('0x29')](_0x44859f,_0x3fee('0x7a')),function(_0x56b222){return _[_0x3fee('0x7b')](_0x22f465,_0x56b222);});if(_0x229019){return _0x5a02f6['id'];}}}));}}return BPromise[_0x3fee('0x7c')](_0x2e44f3)[_0x3fee('0x21')](function(_0x448788){_0x35da36=_(_0x35da36)[_0x3fee('0x7d')](_0x448788)[_0x3fee('0x7e')]()[_0x3fee('0x7f')]();return db[_0x3fee('0x3d')][_0x3fee('0x46')]({'where':{'id':_0x5ac8cc[_0x3fee('0x44')]['id']}})[_0x3fee('0x21')](function(_0xec448){return db[_0x3fee('0x67')][_0x3fee('0x68')](function(_0x32d926){return _0xec448[_0x3fee('0x80')](_0x5ac8cc['query'][_0x3fee('0x61')],{'transaction':_0x32d926})['then'](function(){if(!_[_0x3fee('0x81')](_0x35da36)){return _0xec448[_0x3fee('0x82')](_0x35da36,{'transaction':_0x32d926});}})['then'](function(){_0x35da36[_0x3fee('0x6b')](function(_0x5ba76e){socket[_0x3fee('0x83')]('userWhatsappQueue:remove',{'UserId':_0x5ba76e,'WhatsappQueueId':_0xec448['id']});});});});});});})[_0x3fee('0x21')](respondWithStatusCode(_0x5b19d3,null))['catch'](handleError(_0x5b19d3,null));};exports[_0x3fee('0x84')]=function(_0x4d352b,_0x592cc6,_0x3251b6){return db[_0x3fee('0x3d')][_0x3fee('0x46')]({'where':{'id':_0x4d352b[_0x3fee('0x44')]['id']}})[_0x3fee('0x21')](handleEntityNotFound(_0x592cc6,null))[_0x3fee('0x21')](function(_0x4de7f5){if(_0x4de7f5){return _0x4de7f5['addAgents'](_0x4d352b[_0x3fee('0x48')][_0x3fee('0x61')],_[_0x3fee('0x85')](_0x4d352b['body'],[_0x3fee('0x61'),'id'])||{})[_0x3fee('0x86')](function(_0x571cf1){for(var _0x487e6b=0x0;_0x487e6b<_0x4d352b[_0x3fee('0x48')][_0x3fee('0x61')][_0x3fee('0x5f')];_0x487e6b+=0x1){socket[_0x3fee('0x83')](_0x3fee('0x6c'),{'UserId':_0x4d352b['body']['ids'][_0x487e6b],'WhatsappQueueId':_0x4d352b[_0x3fee('0x44')]['id']});}return _0x571cf1;});}})[_0x3fee('0x21')](respondWithResult(_0x592cc6,null))[_0x3fee('0x42')](handleError(_0x592cc6,null));};exports['removeAgents']=function(_0x5201a5,_0x32edaa,_0x1aef09){return db[_0x3fee('0x3d')][_0x3fee('0x46')]({'where':{'id':_0x5201a5[_0x3fee('0x44')]['id']}})[_0x3fee('0x21')](handleEntityNotFound(_0x32edaa,null))[_0x3fee('0x21')](function(_0x1edfb6){if(_0x1edfb6){return _0x1edfb6[_0x3fee('0x82')](_0x5201a5[_0x3fee('0x2d')]['ids'])[_0x3fee('0x21')](function(){if(_[_0x3fee('0x87')](_0x5201a5[_0x3fee('0x2d')]['ids'])){for(var _0x260fa0=0x0;_0x260fa0<_0x5201a5[_0x3fee('0x2d')][_0x3fee('0x61')]['length'];_0x260fa0+=0x1){socket[_0x3fee('0x83')](_0x3fee('0x88'),{'UserId':Number(_0x5201a5['query'][_0x3fee('0x61')][_0x260fa0]),'WhatsappQueueId':Number(_0x5201a5['params']['id'])});}}else{socket[_0x3fee('0x83')](_0x3fee('0x88'),{'UserId':Number(_0x5201a5[_0x3fee('0x2d')][_0x3fee('0x61')]),'WhatsappQueueId':Number(_0x5201a5[_0x3fee('0x44')]['id'])});}});}})['then'](respondWithStatusCode(_0x32edaa,null))['catch'](handleError(_0x32edaa,null));};exports[_0x3fee('0x89')]=function(_0x3707f8,_0xd29903,_0x143dac){var _0x1c6ded={};var _0x410ed3={};var _0x40b1e8;var _0x51ccda;return db[_0x3fee('0x3d')]['findOne']({'where':{'id':_0x3707f8[_0x3fee('0x44')]['id']}})[_0x3fee('0x21')](handleEntityNotFound(_0xd29903,null))['then'](function(_0x4ac78e){if(_0x4ac78e){_0x40b1e8=_0x4ac78e;_0x410ed3[_0x3fee('0x2c')]=_['keys'](db[_0x3fee('0x54')][_0x3fee('0x45')]);_0x410ed3['query']=_[_0x3fee('0x2e')](_0x3707f8[_0x3fee('0x2d')]);_0x410ed3[_0x3fee('0x2f')]=_[_0x3fee('0x30')](_0x410ed3[_0x3fee('0x2c')],_0x410ed3[_0x3fee('0x2d')]);_0x1c6ded[_0x3fee('0x32')]=_[_0x3fee('0x30')](_0x410ed3[_0x3fee('0x2c')],qs[_0x3fee('0x31')](_0x3707f8[_0x3fee('0x2d')][_0x3fee('0x31')]));_0x1c6ded[_0x3fee('0x32')]=_0x1c6ded[_0x3fee('0x32')][_0x3fee('0x5f')]?_0x1c6ded[_0x3fee('0x32')]:_0x410ed3[_0x3fee('0x2c')];_0x1c6ded[_0x3fee('0x35')]=qs[_0x3fee('0x36')](_0x3707f8[_0x3fee('0x2d')]['sort']);_0x1c6ded[_0x3fee('0x38')]=qs[_0x3fee('0x2f')](_['pick'](_0x3707f8[_0x3fee('0x2d')],_0x410ed3[_0x3fee('0x2f')]));if(_0x3707f8[_0x3fee('0x2d')][_0x3fee('0x3b')]){_0x1c6ded[_0x3fee('0x38')]=_[_0x3fee('0x39')](_0x1c6ded[_0x3fee('0x38')],{'$or':_[_0x3fee('0x29')](_0x1c6ded[_0x3fee('0x32')],function(_0xf8d184){var _0x332118={};_0x332118[_0xf8d184]={'$like':'%'+_0x3707f8[_0x3fee('0x2d')][_0x3fee('0x3b')]+'%'};return _0x332118;})});}_0x1c6ded=_[_0x3fee('0x39')]({},_0x1c6ded,_0x3707f8[_0x3fee('0x3c')]);return _0x40b1e8[_0x3fee('0x89')](_0x1c6ded);}})[_0x3fee('0x21')](function(_0x372875){if(_0x372875){_0x51ccda=_0x372875[_0x3fee('0x5f')];if(!_0x3707f8[_0x3fee('0x2d')]['hasOwnProperty']('nolimit')){_0x1c6ded[_0x3fee('0x1c')]=qs[_0x3fee('0x1c')](_0x3707f8['query'][_0x3fee('0x1c')]);_0x1c6ded[_0x3fee('0x1b')]=qs[_0x3fee('0x1b')](_0x3707f8[_0x3fee('0x2d')][_0x3fee('0x1b')]);}return _0x40b1e8['getAgents'](_0x1c6ded);}})[_0x3fee('0x21')](function(_0x5398da){if(_0x5398da){return _0x5398da?{'count':_0x51ccda,'rows':_0x5398da}:null;}})[_0x3fee('0x21')](respondWithResult(_0xd29903,null))[_0x3fee('0x42')](handleError(_0xd29903,null));}; \ No newline at end of file +var _0x6056=['register','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','update','then','destroy','WhatsappQueues','stack','name','send','index','map','WhatsappQueue','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','count','includeAll','include','rows','catch','show','length','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','describe','getMembers','UserWhatsappQueue','WhatsappQueueId','findAll','User','findAndCountAll','UserId','agent','whatsappPause','updatedAt','createdAt','format','SIP','getTeams','Team','order','addTeams','ids','Agents','online','voicePause','interface','sequelize','each','findOrCreate','userWhatsappQueue:save','removeTeams','select','from','join','user_has_teams','clone','push','toString','QueryTypes','SELECT','TeamId','includes','all','compact','value','transaction','forEach','addAgents','omit','spread','emit','removeAgents','isArray','userWhatsappQueue:remove','getAgents','findOne','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','redis','./whatsappQueue.socket'];(function(_0x11748e,_0x339b95){var _0x453b9a=function(_0x5958bb){while(--_0x5958bb){_0x11748e['push'](_0x11748e['shift']());}};_0x453b9a(++_0x339b95);}(_0x6056,0x71));var _0x6605=function(_0x19d53f,_0x1f58d5){_0x19d53f=_0x19d53f-0x0;var _0x4d43ad=_0x6056[_0x19d53f];return _0x4d43ad;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x6605('0x0'));var rimraf=require(_0x6605('0x1'));var zipdir=require(_0x6605('0x2'));var jsonpatch=require(_0x6605('0x3'));var rp=require(_0x6605('0x4'));var moment=require(_0x6605('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x6605('0x6'));var util=require(_0x6605('0x7'));var path=require(_0x6605('0x8'));var sox=require('sox');var csv=require(_0x6605('0x9'));var ejs=require(_0x6605('0xa'));var fs=require('fs');var _=require(_0x6605('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x6605('0xc'));var deskjs=require(_0x6605('0xd'));var toCsv=require(_0x6605('0x9'));var querystring=require(_0x6605('0xe'));var Papa=require('papaparse');var Redis=require(_0x6605('0xf'));var authService=require(_0x6605('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x6605('0x11'));var hardwareService=require(_0x6605('0x12'));var logger=require('../../config/logger')(_0x6605('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x6605('0x14'))['db'];config[_0x6605('0x15')]=_['defaults'](config[_0x6605('0x15')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6605('0x15')]));require(_0x6605('0x16'))[_0x6605('0x17')](socket);function respondWithStatusCode(_0xc20ec,_0x2650fb){_0x2650fb=_0x2650fb||0xcc;return function(_0x37462b){if(_0x37462b){return _0xc20ec[_0x6605('0x18')](_0x2650fb);}return _0xc20ec[_0x6605('0x19')](_0x2650fb)[_0x6605('0x1a')]();};}function respondWithResult(_0x2e524b,_0x562d4d){_0x562d4d=_0x562d4d||0xc8;return function(_0x3df37d){if(_0x3df37d){return _0x2e524b[_0x6605('0x19')](_0x562d4d)[_0x6605('0x1b')](_0x3df37d);}};}function respondWithFilteredResult(_0x56fe1c,_0x5cc22b){return function(_0x377527){if(_0x377527){var _0x5c74aa=_0x377527['count'],_0x560ce6=_0x5cc22b[_0x6605('0x1c')],_0x2d1b44=_0x5cc22b[_0x6605('0x1c')]+_0x5cc22b[_0x6605('0x1d')],_0x1ffef6;if(_0x2d1b44>=_0x5c74aa){_0x2d1b44=_0x5c74aa;_0x1ffef6=0xc8;}else{_0x1ffef6=0xce;}_0x56fe1c[_0x6605('0x19')](_0x1ffef6);return _0x56fe1c[_0x6605('0x1e')](_0x6605('0x1f'),_0x560ce6+'-'+_0x2d1b44+'/'+_0x5c74aa)[_0x6605('0x1b')](_0x377527);}return null;};}function patchUpdates(_0x11412e){return function(_0x4fa54c){try{jsonpatch[_0x6605('0x20')](_0x4fa54c,_0x11412e,!![]);}catch(_0x181fc8){return BPromise[_0x6605('0x21')](_0x181fc8);}return _0x4fa54c['save']();};}function saveUpdates(_0x1f7a46,_0x5af834){return function(_0xf588a8){if(_0xf588a8){return _0xf588a8[_0x6605('0x22')](_0x1f7a46)[_0x6605('0x23')](function(_0x232f3d){return _0x232f3d;});}return null;};}function removeEntity(_0x11bf7d,_0x4586e3){return function(_0xc69374){if(_0xc69374){return _0xc69374[_0x6605('0x24')]()[_0x6605('0x23')](function(){var _0x36df23=_0xc69374['get']({'plain':!![]});var _0x248dfe=_0x6605('0x25');return db['UserProfileResource'][_0x6605('0x24')]({'where':{'type':_0x248dfe,'resourceId':_0x36df23['id']}})['then'](function(){return _0xc69374;});})['then'](function(){_0x11bf7d[_0x6605('0x19')](0xcc)[_0x6605('0x1a')]();});}};}function handleEntityNotFound(_0x41c2d3,_0x86f0ee){return function(_0x207aa1){if(!_0x207aa1){_0x41c2d3[_0x6605('0x18')](0x194);}return _0x207aa1;};}function handleError(_0x536a36,_0x55bafa){_0x55bafa=_0x55bafa||0x1f4;return function(_0x4ecaa6){logger['error'](_0x4ecaa6[_0x6605('0x26')]);if(_0x4ecaa6[_0x6605('0x27')]){delete _0x4ecaa6[_0x6605('0x27')];}_0x536a36['status'](_0x55bafa)[_0x6605('0x28')](_0x4ecaa6);};}exports[_0x6605('0x29')]=function(_0x353b22,_0x40d741){var _0xa72cad={},_0x373e1e={},_0x41db88={'count':0x0,'rows':[]};var _0x6ff3d3=_[_0x6605('0x2a')](db[_0x6605('0x2b')][_0x6605('0x2c')],function(_0xfa1b05){return{'name':_0xfa1b05[_0x6605('0x2d')],'type':_0xfa1b05[_0x6605('0x2e')]['key']};});_0x373e1e['model']=_[_0x6605('0x2a')](_0x6ff3d3,_0x6605('0x27'));_0x373e1e[_0x6605('0x2f')]=_[_0x6605('0x30')](_0x353b22['query']);_0x373e1e[_0x6605('0x31')]=_[_0x6605('0x32')](_0x373e1e[_0x6605('0x33')],_0x373e1e[_0x6605('0x2f')]);_0xa72cad[_0x6605('0x34')]=_[_0x6605('0x32')](_0x373e1e[_0x6605('0x33')],qs[_0x6605('0x35')](_0x353b22[_0x6605('0x2f')]['fields']));_0xa72cad['attributes']=_0xa72cad[_0x6605('0x34')]['length']?_0xa72cad[_0x6605('0x34')]:_0x373e1e[_0x6605('0x33')];if(!_0x353b22[_0x6605('0x2f')][_0x6605('0x36')](_0x6605('0x37'))){_0xa72cad[_0x6605('0x1d')]=qs[_0x6605('0x1d')](_0x353b22[_0x6605('0x2f')][_0x6605('0x1d')]);_0xa72cad['offset']=qs[_0x6605('0x1c')](_0x353b22[_0x6605('0x2f')][_0x6605('0x1c')]);}_0xa72cad['order']=qs[_0x6605('0x38')](_0x353b22[_0x6605('0x2f')][_0x6605('0x38')]);_0xa72cad[_0x6605('0x39')]=qs[_0x6605('0x31')](_[_0x6605('0x3a')](_0x353b22[_0x6605('0x2f')],_0x373e1e[_0x6605('0x31')]),_0x6ff3d3);if(_0x353b22[_0x6605('0x2f')][_0x6605('0x3b')]){_0xa72cad[_0x6605('0x39')]=_['merge'](_0xa72cad[_0x6605('0x39')],{'$or':_[_0x6605('0x2a')](_0x6ff3d3,function(_0x3df735){if(_0x3df735[_0x6605('0x2e')]!==_0x6605('0x3c')){var _0x3ce737={};_0x3ce737[_0x3df735[_0x6605('0x27')]]={'$like':'%'+_0x353b22[_0x6605('0x2f')]['filter']+'%'};return _0x3ce737;}})});}_0xa72cad=_[_0x6605('0x3d')]({},_0xa72cad,_0x353b22[_0x6605('0x3e')]);var _0x1cce51={'where':_0xa72cad[_0x6605('0x39')]};return db[_0x6605('0x2b')][_0x6605('0x3f')](_0x1cce51)['then'](function(_0x47552d){_0x41db88[_0x6605('0x3f')]=_0x47552d;if(_0x353b22[_0x6605('0x2f')][_0x6605('0x40')]){_0xa72cad[_0x6605('0x41')]=[{'all':!![]}];}return db['WhatsappQueue']['findAll'](_0xa72cad);})[_0x6605('0x23')](function(_0x299d8f){_0x41db88[_0x6605('0x42')]=_0x299d8f;return _0x41db88;})[_0x6605('0x23')](respondWithFilteredResult(_0x40d741,_0xa72cad))[_0x6605('0x43')](handleError(_0x40d741,null));};exports[_0x6605('0x44')]=function(_0x1e185f,_0xe126c){var _0x271130={'raw':!![],'where':{'id':_0x1e185f['params']['id']}},_0x523b09={};_0x523b09[_0x6605('0x33')]=_['keys'](db[_0x6605('0x2b')]['rawAttributes']);_0x523b09[_0x6605('0x2f')]=_['keys'](_0x1e185f['query']);_0x523b09[_0x6605('0x31')]=_[_0x6605('0x32')](_0x523b09[_0x6605('0x33')],_0x523b09['query']);_0x271130[_0x6605('0x34')]=_[_0x6605('0x32')](_0x523b09[_0x6605('0x33')],qs[_0x6605('0x35')](_0x1e185f[_0x6605('0x2f')][_0x6605('0x35')]));_0x271130[_0x6605('0x34')]=_0x271130['attributes'][_0x6605('0x45')]?_0x271130[_0x6605('0x34')]:_0x523b09[_0x6605('0x33')];if(_0x1e185f[_0x6605('0x2f')][_0x6605('0x40')]){_0x271130['include']=[{'all':!![]}];}_0x271130=_[_0x6605('0x3d')]({},_0x271130,_0x1e185f['options']);return db[_0x6605('0x2b')][_0x6605('0x46')](_0x271130)[_0x6605('0x23')](handleEntityNotFound(_0xe126c,null))[_0x6605('0x23')](respondWithResult(_0xe126c,null))[_0x6605('0x43')](handleError(_0xe126c,null));};exports[_0x6605('0x47')]=function(_0x522c1d,_0x33e275){return db['WhatsappQueue'][_0x6605('0x47')](_0x522c1d['body'],{})[_0x6605('0x23')](function(_0x52cb58){var _0x964f30=_0x522c1d[_0x6605('0x48')][_0x6605('0x49')]({'plain':!![]});if(!_0x964f30)throw new Error(_0x6605('0x4a'));if(_0x964f30[_0x6605('0x4b')]===_0x6605('0x48')){var _0x5e45ee=_0x52cb58[_0x6605('0x49')]({'plain':!![]});var _0x32a82c='WhatsappQueues';return db[_0x6605('0x4c')][_0x6605('0x46')]({'where':{'name':_0x32a82c,'userProfileId':_0x964f30[_0x6605('0x4d')]},'raw':!![]})[_0x6605('0x23')](function(_0x118bc8){if(_0x118bc8&&_0x118bc8['autoAssociation']===0x0){return db[_0x6605('0x4e')]['create']({'name':_0x5e45ee['name'],'resourceId':_0x5e45ee['id'],'type':_0x118bc8[_0x6605('0x27')],'sectionId':_0x118bc8['id']},{})[_0x6605('0x23')](function(){return _0x52cb58;});}else{return _0x52cb58;}})['catch'](function(_0x30392e){logger[_0x6605('0x4f')](_0x6605('0x50'),_0x30392e);throw _0x30392e;});}return _0x52cb58;})['then'](respondWithResult(_0x33e275,0xc9))[_0x6605('0x43')](handleError(_0x33e275,null));};exports[_0x6605('0x22')]=function(_0x1550f8,_0x296990){if(_0x1550f8[_0x6605('0x51')]['id']){delete _0x1550f8[_0x6605('0x51')]['id'];}return db[_0x6605('0x2b')][_0x6605('0x46')]({'where':{'id':_0x1550f8[_0x6605('0x52')]['id']}})[_0x6605('0x23')](handleEntityNotFound(_0x296990,null))[_0x6605('0x23')](saveUpdates(_0x1550f8['body'],null))[_0x6605('0x23')](respondWithResult(_0x296990,null))[_0x6605('0x43')](handleError(_0x296990,null));};exports['destroy']=function(_0x43d397,_0x1c8193){return db['WhatsappQueue'][_0x6605('0x46')]({'where':{'id':_0x43d397[_0x6605('0x52')]['id']}})[_0x6605('0x23')](handleEntityNotFound(_0x1c8193,null))[_0x6605('0x23')](removeEntity(_0x1c8193,null))['catch'](handleError(_0x1c8193,null));};exports[_0x6605('0x53')]=function(_0x452e73,_0x3d55b8){return db[_0x6605('0x2b')]['describe']()[_0x6605('0x23')](respondWithResult(_0x3d55b8,null))['catch'](handleError(_0x3d55b8,null));};exports[_0x6605('0x54')]=function(_0x3c8e4d,_0x25efda,_0xfb642a){var _0x4b929b={'raw':!![],'where':{}},_0x437174={},_0x1da2ec;return db[_0x6605('0x2b')]['findOne']({'where':{'id':_0x3c8e4d[_0x6605('0x52')]['id']}})[_0x6605('0x23')](handleEntityNotFound(_0x25efda,null))[_0x6605('0x23')](function(_0x42cef2){if(_0x42cef2){_0x1da2ec=_0x42cef2[_0x6605('0x49')]({'plain':!![]});_0x437174[_0x6605('0x33')]=_[_0x6605('0x30')](db[_0x6605('0x55')][_0x6605('0x2c')]);_0x437174[_0x6605('0x2f')]=_['keys'](_0x3c8e4d[_0x6605('0x2f')]);_0x437174[_0x6605('0x31')]=_[_0x6605('0x32')](_0x437174['model'],_0x437174[_0x6605('0x2f')]);_0x4b929b[_0x6605('0x34')]=_['intersection'](_0x437174['model'],qs[_0x6605('0x35')](_0x3c8e4d[_0x6605('0x2f')][_0x6605('0x35')]));_0x4b929b['attributes']=_0x4b929b[_0x6605('0x34')]['length']?_0x4b929b['attributes']:_0x437174[_0x6605('0x33')];if(!_0x3c8e4d[_0x6605('0x2f')][_0x6605('0x36')](_0x6605('0x37'))){_0x4b929b[_0x6605('0x1d')]=qs[_0x6605('0x1d')](_0x3c8e4d['query']['limit']);_0x4b929b['offset']=qs[_0x6605('0x1c')](_0x3c8e4d['query'][_0x6605('0x1c')]);}_0x4b929b['order']=qs[_0x6605('0x38')](_0x3c8e4d['query'][_0x6605('0x38')]);_0x4b929b[_0x6605('0x39')]=qs['filters'](_[_0x6605('0x3a')](_0x3c8e4d[_0x6605('0x2f')],_0x437174[_0x6605('0x31')]));_0x4b929b[_0x6605('0x39')][_0x6605('0x56')]=_0x42cef2['id'];if(_0x3c8e4d[_0x6605('0x2f')][_0x6605('0x3b')]){_0x4b929b[_0x6605('0x39')]=_[_0x6605('0x3d')](_0x4b929b[_0x6605('0x39')],{'$or':_[_0x6605('0x2a')](_0x4b929b['attributes'],function(_0x492aa7){var _0x8c3aa5={};_0x8c3aa5[_0x492aa7]={'$like':'%'+_0x3c8e4d[_0x6605('0x2f')][_0x6605('0x3b')]+'%'};return _0x8c3aa5;})});}_0x4b929b=_[_0x6605('0x3d')]({},_0x4b929b,_0x3c8e4d[_0x6605('0x3e')]);return db[_0x6605('0x55')][_0x6605('0x57')](_0x4b929b);}})[_0x6605('0x23')](function(_0x24aef3){if(_0x24aef3){return db[_0x6605('0x58')][_0x6605('0x59')]({'where':{'id':_[_0x6605('0x2a')](_0x24aef3,_0x6605('0x5a')),'role':_0x6605('0x5b')},'attributes':['id',_0x6605('0x27'),_0x6605('0x5c'),_0x6605('0x5d'),_0x6605('0x5e')]});}})[_0x6605('0x23')](function(_0x51908a){if(_0x51908a){return{'count':_0x51908a[_0x6605('0x3f')],'rows':_[_0x6605('0x2a')](_0x51908a['rows'],function(_0x5edaae){return{'membername':_0x5edaae['name'],'UserId':_0x5edaae['id'],'queue_name':_0x1da2ec[_0x6605('0x27')],'WhatsappQueueId':_0x1da2ec['id'],'interface':util[_0x6605('0x5f')]('%s/%s',_0x6605('0x60'),_0x5edaae[_0x6605('0x27')]),'penalty':0x0,'paused':_0x5edaae[_0x6605('0x5c')],'createdAt':_0x5edaae[_0x6605('0x5e')],'updatedAt':_0x5edaae['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x6605('0x23')](respondWithFilteredResult(_0x25efda,_0x4b929b))[_0x6605('0x43')](handleError(_0x25efda,null));};exports[_0x6605('0x61')]=function(_0x395bc0,_0x29aea3,_0x4afcc3){var _0x55d909={};var _0x961d9b={};var _0x39c6f1;var _0x58474d;return db['WhatsappQueue']['findOne']({'where':{'id':_0x395bc0[_0x6605('0x52')]['id']}})['then'](handleEntityNotFound(_0x29aea3,null))[_0x6605('0x23')](function(_0x5e5129){if(_0x5e5129){_0x39c6f1=_0x5e5129;_0x961d9b[_0x6605('0x33')]=_[_0x6605('0x30')](db[_0x6605('0x62')][_0x6605('0x2c')]);_0x961d9b[_0x6605('0x2f')]=_[_0x6605('0x30')](_0x395bc0[_0x6605('0x2f')]);_0x961d9b[_0x6605('0x31')]=_[_0x6605('0x32')](_0x961d9b[_0x6605('0x33')],_0x961d9b[_0x6605('0x2f')]);_0x55d909[_0x6605('0x34')]=_[_0x6605('0x32')](_0x961d9b[_0x6605('0x33')],qs[_0x6605('0x35')](_0x395bc0[_0x6605('0x2f')]['fields']));_0x55d909['attributes']=_0x55d909[_0x6605('0x34')][_0x6605('0x45')]?_0x55d909[_0x6605('0x34')]:_0x961d9b['model'];_0x55d909[_0x6605('0x63')]=qs[_0x6605('0x38')](_0x395bc0[_0x6605('0x2f')][_0x6605('0x38')]);_0x55d909[_0x6605('0x39')]=qs[_0x6605('0x31')](_['pick'](_0x395bc0[_0x6605('0x2f')],_0x961d9b['filters']));if(_0x395bc0[_0x6605('0x2f')]['filter']){_0x55d909[_0x6605('0x39')]=_[_0x6605('0x3d')](_0x55d909[_0x6605('0x39')],{'$or':_[_0x6605('0x2a')](_0x55d909[_0x6605('0x34')],function(_0x4397e9){var _0x12a6c7={};_0x12a6c7[_0x4397e9]={'$like':'%'+_0x395bc0[_0x6605('0x2f')][_0x6605('0x3b')]+'%'};return _0x12a6c7;})});}_0x55d909=_[_0x6605('0x3d')]({},_0x55d909,_0x395bc0[_0x6605('0x3e')]);return _0x39c6f1[_0x6605('0x61')](_0x55d909);}})[_0x6605('0x23')](function(_0x4eeb24){if(_0x4eeb24){_0x58474d=_0x4eeb24['length'];if(!_0x395bc0[_0x6605('0x2f')]['hasOwnProperty'](_0x6605('0x37'))){_0x55d909[_0x6605('0x1d')]=qs['limit'](_0x395bc0[_0x6605('0x2f')][_0x6605('0x1d')]);_0x55d909[_0x6605('0x1c')]=qs['offset'](_0x395bc0[_0x6605('0x2f')]['offset']);}return _0x39c6f1['getTeams'](_0x55d909);}})[_0x6605('0x23')](function(_0x54d6db){if(_0x54d6db){return _0x54d6db?{'count':_0x58474d,'rows':_0x54d6db}:null;}})[_0x6605('0x23')](respondWithResult(_0x29aea3,null))[_0x6605('0x43')](handleError(_0x29aea3,null));};exports[_0x6605('0x64')]=function(_0xa064fc,_0x27f79a,_0x5cfc43){var _0x5b1d51=_0xa064fc[_0x6605('0x51')][_0x6605('0x65')];return db[_0x6605('0x62')]['findAll']({'where':{'id':_0x5b1d51},'attributes':['id'],'include':[{'model':db['User'],'as':_0x6605('0x66'),'attributes':['id',_0x6605('0x27'),_0x6605('0x67'),_0x6605('0x68'),_0x6605('0x69')],'raw':!![]}]})[_0x6605('0x23')](function(_0x39a554){if(_0x39a554){var _0x3a692c=_['flatMap'](_0x39a554,function(_0x532014){var _0x1ec6c3=_0x532014['get']({'plain':!![]});return _0x1ec6c3['Agents'];});return db[_0x6605('0x2b')][_0x6605('0x46')]({'where':{'id':_0xa064fc[_0x6605('0x52')]['id']}})[_0x6605('0x23')](function(_0x3449f4){return db[_0x6605('0x6a')]['transaction'](function(_0x268439){return _0x3449f4[_0x6605('0x64')](_0x5b1d51,{'transaction':_0x268439})['then'](function(){return BPromise[_0x6605('0x6b')](_0x3a692c,function(_0x9bbf33){return db[_0x6605('0x55')][_0x6605('0x6c')]({'where':{'UserId':_0x9bbf33['id'],'WhatsappQueueId':_0xa064fc[_0x6605('0x52')]['id']},'transaction':_0x268439});});})[_0x6605('0x23')](function(){_0x3a692c['forEach'](function(_0x2bd433){socket['emit'](_0x6605('0x6d'),{'UserId':_0x2bd433['id'],'WhatsappQueueId':_0x3449f4['id']});});});});});}})[_0x6605('0x23')](respondWithStatusCode(_0x27f79a,null))[_0x6605('0x43')](handleError(_0x27f79a,null));};exports[_0x6605('0x6e')]=function(_0x9fbcd7,_0x414593,_0x3da7ae){return db[_0x6605('0x62')][_0x6605('0x57')]({'where':{'id':_0x9fbcd7[_0x6605('0x2f')]['ids']},'attributes':['id'],'include':[{'model':db[_0x6605('0x58')],'as':_0x6605('0x66'),'attributes':['id'],'raw':!![]}]})[_0x6605('0x23')](handleEntityNotFound(_0x414593,null))[_0x6605('0x23')](function(_0x36afe9){var _0x7370c8=_[_0x6605('0x2a')](_0x36afe9,'id');var _0x5e955a=[];var _0x174f15=[];var _0x5e0d88=squel[_0x6605('0x6f')]();_0x5e0d88['field']('tq.TeamId')[_0x6605('0x70')]('team_has_whatsapp_queues','tq')[_0x6605('0x71')](_0x6605('0x72'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where']('WhatsappQueueId\x20=\x20?',_0x9fbcd7['params']['id']);for(var _0x49a229=0x0;_0x49a229<_0x36afe9[_0x6605('0x45')];_0x49a229+=0x1){let _0x43b520=_0x36afe9[_0x49a229];for(var _0x14549f=0x0;_0x14549f<_0x43b520[_0x6605('0x66')][_0x6605('0x45')];_0x14549f+=0x1){let _0x1a01e8=_0x43b520[_0x6605('0x66')][_0x14549f];var _0x530329=_0x5e0d88[_0x6605('0x73')]();_0x530329[_0x6605('0x39')]('ut.UserId\x20=\x20?',_0x1a01e8['id']);_0x174f15[_0x6605('0x74')](db['sequelize']['query'](_0x530329[_0x6605('0x75')](),{'type':db[_0x6605('0x6a')][_0x6605('0x76')][_0x6605('0x77')]})[_0x6605('0x23')](function(_0x561358){if(_0x561358[_0x6605('0x45')]===0x1){return _0x1a01e8['id'];}else{var _0x203190=_['every'](_[_0x6605('0x2a')](_0x561358,_0x6605('0x78')),function(_0xd3b16c){return _[_0x6605('0x79')](_0x7370c8,_0xd3b16c);});if(_0x203190){return _0x1a01e8['id'];}}}));}}return BPromise[_0x6605('0x7a')](_0x174f15)[_0x6605('0x23')](function(_0xe075ea){_0x5e955a=_(_0x5e955a)['union'](_0xe075ea)[_0x6605('0x7b')]()[_0x6605('0x7c')]();return db[_0x6605('0x2b')]['find']({'where':{'id':_0x9fbcd7[_0x6605('0x52')]['id']}})[_0x6605('0x23')](function(_0x58c6fa){return db[_0x6605('0x6a')][_0x6605('0x7d')](function(_0x3ea083){return _0x58c6fa[_0x6605('0x6e')](_0x9fbcd7[_0x6605('0x2f')][_0x6605('0x65')],{'transaction':_0x3ea083})[_0x6605('0x23')](function(){if(!_['isEmpty'](_0x5e955a)){return _0x58c6fa['removeAgents'](_0x5e955a,{'transaction':_0x3ea083});}})[_0x6605('0x23')](function(){_0x5e955a[_0x6605('0x7e')](function(_0x2e2996){socket['emit']('userWhatsappQueue:remove',{'UserId':_0x2e2996,'WhatsappQueueId':_0x58c6fa['id']});});});});});});})[_0x6605('0x23')](respondWithStatusCode(_0x414593,null))['catch'](handleError(_0x414593,null));};exports[_0x6605('0x7f')]=function(_0x16a427,_0x5d8ed5,_0x3ea394){return db[_0x6605('0x2b')][_0x6605('0x46')]({'where':{'id':_0x16a427[_0x6605('0x52')]['id']}})[_0x6605('0x23')](handleEntityNotFound(_0x5d8ed5,null))[_0x6605('0x23')](function(_0x3379ac){if(_0x3379ac){return _0x3379ac[_0x6605('0x7f')](_0x16a427[_0x6605('0x51')][_0x6605('0x65')],_[_0x6605('0x80')](_0x16a427[_0x6605('0x51')],[_0x6605('0x65'),'id'])||{})[_0x6605('0x81')](function(_0x24c104){for(var _0x14164f=0x0;_0x14164f<_0x16a427['body'][_0x6605('0x65')][_0x6605('0x45')];_0x14164f+=0x1){socket[_0x6605('0x82')](_0x6605('0x6d'),{'UserId':_0x16a427[_0x6605('0x51')][_0x6605('0x65')][_0x14164f],'WhatsappQueueId':_0x16a427[_0x6605('0x52')]['id']});}return _0x24c104;});}})['then'](respondWithResult(_0x5d8ed5,null))[_0x6605('0x43')](handleError(_0x5d8ed5,null));};exports[_0x6605('0x83')]=function(_0x488f83,_0x5ee408,_0x29d0a2){return db['WhatsappQueue'][_0x6605('0x46')]({'where':{'id':_0x488f83['params']['id']}})[_0x6605('0x23')](handleEntityNotFound(_0x5ee408,null))[_0x6605('0x23')](function(_0x50f6de){if(_0x50f6de){return _0x50f6de[_0x6605('0x83')](_0x488f83[_0x6605('0x2f')][_0x6605('0x65')])[_0x6605('0x23')](function(){if(_[_0x6605('0x84')](_0x488f83[_0x6605('0x2f')][_0x6605('0x65')])){for(var _0x1384ff=0x0;_0x1384ff<_0x488f83['query'][_0x6605('0x65')][_0x6605('0x45')];_0x1384ff+=0x1){socket[_0x6605('0x82')](_0x6605('0x85'),{'UserId':Number(_0x488f83['query'][_0x6605('0x65')][_0x1384ff]),'WhatsappQueueId':Number(_0x488f83[_0x6605('0x52')]['id'])});}}else{socket[_0x6605('0x82')](_0x6605('0x85'),{'UserId':Number(_0x488f83[_0x6605('0x2f')]['ids']),'WhatsappQueueId':Number(_0x488f83['params']['id'])});}});}})[_0x6605('0x23')](respondWithStatusCode(_0x5ee408,null))['catch'](handleError(_0x5ee408,null));};exports[_0x6605('0x86')]=function(_0x1e68f3,_0x436fed,_0x47463e){var _0x2663d8={};var _0x3d90ba={};var _0x25ee93;var _0x5c8292;return db['WhatsappQueue'][_0x6605('0x87')]({'where':{'id':_0x1e68f3[_0x6605('0x52')]['id']}})[_0x6605('0x23')](handleEntityNotFound(_0x436fed,null))[_0x6605('0x23')](function(_0x294784){if(_0x294784){_0x25ee93=_0x294784;_0x3d90ba[_0x6605('0x33')]=_[_0x6605('0x30')](db[_0x6605('0x58')][_0x6605('0x2c')]);_0x3d90ba[_0x6605('0x2f')]=_[_0x6605('0x30')](_0x1e68f3[_0x6605('0x2f')]);_0x3d90ba[_0x6605('0x31')]=_['intersection'](_0x3d90ba[_0x6605('0x33')],_0x3d90ba[_0x6605('0x2f')]);_0x2663d8[_0x6605('0x34')]=_[_0x6605('0x32')](_0x3d90ba[_0x6605('0x33')],qs[_0x6605('0x35')](_0x1e68f3[_0x6605('0x2f')][_0x6605('0x35')]));_0x2663d8['attributes']=_0x2663d8[_0x6605('0x34')][_0x6605('0x45')]?_0x2663d8[_0x6605('0x34')]:_0x3d90ba[_0x6605('0x33')];_0x2663d8[_0x6605('0x63')]=qs[_0x6605('0x38')](_0x1e68f3[_0x6605('0x2f')][_0x6605('0x38')]);_0x2663d8[_0x6605('0x39')]=qs['filters'](_[_0x6605('0x3a')](_0x1e68f3['query'],_0x3d90ba[_0x6605('0x31')]));if(_0x1e68f3['query'][_0x6605('0x3b')]){_0x2663d8[_0x6605('0x39')]=_['merge'](_0x2663d8[_0x6605('0x39')],{'$or':_['map'](_0x2663d8[_0x6605('0x34')],function(_0x20a079){var _0x1047d7={};_0x1047d7[_0x20a079]={'$like':'%'+_0x1e68f3['query'][_0x6605('0x3b')]+'%'};return _0x1047d7;})});}_0x2663d8=_[_0x6605('0x3d')]({},_0x2663d8,_0x1e68f3[_0x6605('0x3e')]);return _0x25ee93[_0x6605('0x86')](_0x2663d8);}})[_0x6605('0x23')](function(_0x5e6dd3){if(_0x5e6dd3){_0x5c8292=_0x5e6dd3['length'];if(!_0x1e68f3[_0x6605('0x2f')]['hasOwnProperty']('nolimit')){_0x2663d8[_0x6605('0x1d')]=qs[_0x6605('0x1d')](_0x1e68f3[_0x6605('0x2f')][_0x6605('0x1d')]);_0x2663d8[_0x6605('0x1c')]=qs[_0x6605('0x1c')](_0x1e68f3['query'][_0x6605('0x1c')]);}return _0x25ee93[_0x6605('0x86')](_0x2663d8);}})['then'](function(_0x5c0932){if(_0x5c0932){return _0x5c0932?{'count':_0x5c8292,'rows':_0x5c0932}:null;}})[_0x6605('0x23')](respondWithResult(_0x436fed,null))[_0x6605('0x43')](handleError(_0x436fed,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index efd73c6..db2ab79 100644 --- a/server/api/whatsappQueue/whatsappQueue.events.js +++ b/server/api/whatsappQueue/whatsappQueue.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2d5b=['WhatsappQueue','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x838813,_0x448f0f){var _0x2bd32d=function(_0x57b589){while(--_0x57b589){_0x838813['push'](_0x838813['shift']());}};_0x2bd32d(++_0x448f0f);}(_0x2d5b,0xc6));var _0xb2d5=function(_0x136628,_0xdd3206){_0x136628=_0x136628-0x0;var _0x35aad7=_0x2d5b[_0x136628];return _0x35aad7;};'use strict';var EventEmitter=require(_0xb2d5('0x0'));var WhatsappQueue=require(_0xb2d5('0x1'))['db'][_0xb2d5('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0xb2d5('0x3')](0x0);var events={'afterCreate':_0xb2d5('0x4'),'afterUpdate':_0xb2d5('0x5'),'afterDestroy':'remove'};function emitEvent(_0x3b18e3){return function(_0x46d513,_0x186af8,_0x5530f9){WhatsappQueueEvents['emit'](_0x3b18e3+':'+_0x46d513['id'],_0x46d513);WhatsappQueueEvents[_0xb2d5('0x6')](_0x3b18e3,_0x46d513);_0x5530f9(null);};}for(var e in events){if(events[_0xb2d5('0x7')](e)){var event=events[e];WhatsappQueue[_0xb2d5('0x8')](e,emitEvent(event));}}module[_0xb2d5('0x9')]=WhatsappQueueEvents; \ No newline at end of file +var _0x82a9=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappQueue','save','update'];(function(_0x21c589,_0x4ccb0d){var _0x394114=function(_0x7afb63){while(--_0x7afb63){_0x21c589['push'](_0x21c589['shift']());}};_0x394114(++_0x4ccb0d);}(_0x82a9,0x145));var _0x982a=function(_0x235b51,_0x4fdd34){_0x235b51=_0x235b51-0x0;var _0x1fbf19=_0x82a9[_0x235b51];return _0x1fbf19;};'use strict';var EventEmitter=require(_0x982a('0x0'));var WhatsappQueue=require(_0x982a('0x1'))['db'][_0x982a('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x982a('0x3'),'afterUpdate':_0x982a('0x4'),'afterDestroy':_0x982a('0x5')};function emitEvent(_0x2042c2){return function(_0x2eba06,_0x302c5c,_0x3ca488){WhatsappQueueEvents[_0x982a('0x6')](_0x2042c2+':'+_0x2eba06['id'],_0x2eba06);WhatsappQueueEvents[_0x982a('0x6')](_0x2042c2,_0x2eba06);_0x3ca488(null);};}for(var e in events){if(events[_0x982a('0x7')](e)){var event=events[e];WhatsappQueue[_0x982a('0x8')](e,emitEvent(event));}}module[_0x982a('0x9')]=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index 0163226..6029b33 100644 --- a/server/api/whatsappQueue/whatsappQueue.model.js +++ b/server/api/whatsappQueue/whatsappQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfab0=['../../config/logger','bluebird','request-promise','path','../../config/environment','./whatsappQueue.attributes','exports','define','WhatsappQueue','whatsapp_queues','lodash','util'];(function(_0x4da2b2,_0x58b589){var _0x3f2ecb=function(_0x12f06a){while(--_0x12f06a){_0x4da2b2['push'](_0x4da2b2['shift']());}};_0x3f2ecb(++_0x58b589);}(_0xfab0,0x18a));var _0x0fab=function(_0xf4d05,_0x5e601f){_0xf4d05=_0xf4d05-0x0;var _0x47c971=_0xfab0[_0xf4d05];return _0x47c971;};'use strict';var _=require(_0x0fab('0x0'));var util=require(_0x0fab('0x1'));var logger=require(_0x0fab('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0fab('0x3'));var rp=require(_0x0fab('0x4'));var fs=require('fs');var path=require(_0x0fab('0x5'));var rimraf=require('rimraf');var config=require(_0x0fab('0x6'));var attributes=require(_0x0fab('0x7'));module[_0x0fab('0x8')]=function(_0x464448,_0x42cf74){return _0x464448[_0x0fab('0x9')](_0x0fab('0xa'),attributes,{'tableName':_0x0fab('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa4aa=['moment','bluebird','path','rimraf','../../config/environment','./whatsappQueue.attributes','define','whatsapp_queues','lodash','util','../../config/logger'];(function(_0x4b9978,_0x58eb71){var _0x42f0e5=function(_0x4ff5dc){while(--_0x4ff5dc){_0x4b9978['push'](_0x4b9978['shift']());}};_0x42f0e5(++_0x58eb71);}(_0xa4aa,0x6b));var _0xaa4a=function(_0x2bce4c,_0x434ba4){_0x2bce4c=_0x2bce4c-0x0;var _0x55a4f7=_0xa4aa[_0x2bce4c];return _0x55a4f7;};'use strict';var _=require(_0xaa4a('0x0'));var util=require(_0xaa4a('0x1'));var logger=require(_0xaa4a('0x2'))('api');var moment=require(_0xaa4a('0x3'));var BPromise=require(_0xaa4a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xaa4a('0x5'));var rimraf=require(_0xaa4a('0x6'));var config=require(_0xaa4a('0x7'));var attributes=require(_0xaa4a('0x8'));module['exports']=function(_0x3cd31f,_0x38b513){return _0x3cd31f[_0xaa4a('0x9')]('WhatsappQueue',attributes,{'tableName':_0xaa4a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.rpc.js b/server/api/whatsappQueue/whatsappQueue.rpc.js index 53a065f..611b3b6 100644 --- a/server/api/whatsappQueue/whatsappQueue.rpc.js +++ b/server/api/whatsappQueue/whatsappQueue.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdd12=['WhatsappQueue,\x20%s,\x20%s','WhatsappQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','GetWhatsappQueue','WhatsappQueue','findAll','options','raw','where','attributes','map','model','include','then','debug','stringify','ShowWhatsappQueue','find','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./whatsappQueue.socket','register','request'];(function(_0x13ea5f,_0x5c9bc8){var _0x1ee36a=function(_0x4fc656){while(--_0x4fc656){_0x13ea5f['push'](_0x13ea5f['shift']());}};_0x1ee36a(++_0x5c9bc8);}(_0xdd12,0x10e));var _0x2dd1=function(_0x4755ee,_0x251c5b){_0x4755ee=_0x4755ee-0x0;var _0x19a5af=_0xdd12[_0x4755ee];return _0x19a5af;};'use strict';var _=require(_0x2dd1('0x0'));var util=require(_0x2dd1('0x1'));var moment=require(_0x2dd1('0x2'));var BPromise=require(_0x2dd1('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2dd1('0x4'));var db=require(_0x2dd1('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x2dd1('0x6'))(_0x2dd1('0x7'));var config=require(_0x2dd1('0x8'));var jayson=require(_0x2dd1('0x9'));var client=jayson['client'][_0x2dd1('0xa')]({'port':0x232a});config[_0x2dd1('0xb')]=_['defaults'](config[_0x2dd1('0xb')],{'host':_0x2dd1('0xc'),'port':0x18eb});var socket=require(_0x2dd1('0xd'))(new Redis(config[_0x2dd1('0xb')]));require(_0x2dd1('0xe'))[_0x2dd1('0xf')](socket);function respondWithRpcPromise(_0x32d5e4,_0x164f3d,_0x23c9de){return new BPromise(function(_0xf028f5,_0xe5c709){return client[_0x2dd1('0x10')](_0x32d5e4,_0x23c9de)['then'](function(_0xdeb114){logger['info'](_0x2dd1('0x11'),_0x164f3d,'request\x20sent');logger['debug'](_0x2dd1('0x12'),_0x164f3d,_0x2dd1('0x13'),JSON['stringify'](_0xdeb114));if(_0xdeb114[_0x2dd1('0x14')]){if(_0xdeb114[_0x2dd1('0x14')][_0x2dd1('0x15')]===0x1f4){logger['error'](_0x2dd1('0x11'),_0x164f3d,_0xdeb114[_0x2dd1('0x14')][_0x2dd1('0x16')]);return _0xe5c709(_0xdeb114[_0x2dd1('0x14')][_0x2dd1('0x16')]);}logger[_0x2dd1('0x14')](_0x2dd1('0x11'),_0x164f3d,_0xdeb114['error'][_0x2dd1('0x16')]);return _0xf028f5(_0xdeb114[_0x2dd1('0x14')]['message']);}else{logger[_0x2dd1('0x17')](_0x2dd1('0x11'),_0x164f3d,'request\x20sent');_0xf028f5(_0xdeb114[_0x2dd1('0x18')][_0x2dd1('0x16')]);}})[_0x2dd1('0x19')](function(_0x303581){logger[_0x2dd1('0x14')](_0x2dd1('0x11'),_0x164f3d,_0x303581);_0xe5c709(_0x303581);});});}exports[_0x2dd1('0x1a')]=function(_0xb092b2){var _0x35be56=this;return new Promise(function(_0x1b0bf3,_0x2daa0b){return db[_0x2dd1('0x1b')][_0x2dd1('0x1c')]({'raw':_0xb092b2[_0x2dd1('0x1d')]?_0xb092b2[_0x2dd1('0x1d')][_0x2dd1('0x1e')]===undefined?!![]:![]:!![],'where':_0xb092b2[_0x2dd1('0x1d')]?_0xb092b2[_0x2dd1('0x1d')][_0x2dd1('0x1f')]||null:null,'attributes':_0xb092b2[_0x2dd1('0x1d')]?_0xb092b2['options'][_0x2dd1('0x20')]||null:null,'limit':_0xb092b2[_0x2dd1('0x1d')]?_0xb092b2[_0x2dd1('0x1d')]['limit']||null:null,'include':_0xb092b2[_0x2dd1('0x1d')]?_0xb092b2[_0x2dd1('0x1d')]['include']?_[_0x2dd1('0x21')](_0xb092b2[_0x2dd1('0x1d')]['include'],function(_0x1a7e8d){return{'model':db[_0x1a7e8d[_0x2dd1('0x22')]],'as':_0x1a7e8d['as'],'attributes':_0x1a7e8d[_0x2dd1('0x20')],'include':_0x1a7e8d[_0x2dd1('0x23')]?_['map'](_0x1a7e8d['include'],function(_0x2af364){return{'model':db[_0x2af364[_0x2dd1('0x22')]],'as':_0x2af364['as'],'attributes':_0x2af364['attributes'],'include':_0x2af364[_0x2dd1('0x23')]?_[_0x2dd1('0x21')](_0x2af364[_0x2dd1('0x23')],function(_0x21d0ac){return{'model':db[_0x21d0ac['model']],'as':_0x21d0ac['as'],'attributes':_0x21d0ac[_0x2dd1('0x20')]};}):[]};}):[]};}):[]:[]})[_0x2dd1('0x24')](function(_0xcf4753){logger['info']('GetWhatsappQueue',_0xb092b2);logger[_0x2dd1('0x25')](_0x2dd1('0x1a'),_0xb092b2,JSON[_0x2dd1('0x26')](_0xcf4753));_0x1b0bf3(_0xcf4753);})[_0x2dd1('0x19')](function(_0x11de77){logger['error'](_0x2dd1('0x1a'),_0x11de77['message'],_0xb092b2);_0x2daa0b(_0x35be56[_0x2dd1('0x14')](0x1f4,_0x11de77[_0x2dd1('0x16')]));});});};exports[_0x2dd1('0x27')]=function(_0x4e5ea1){var _0x5a992=this;return new Promise(function(_0x1bb5df,_0x26fce2){return db[_0x2dd1('0x1b')][_0x2dd1('0x28')]({'raw':_0x4e5ea1[_0x2dd1('0x1d')]?_0x4e5ea1[_0x2dd1('0x1d')][_0x2dd1('0x1e')]===undefined?!![]:![]:!![],'where':_0x4e5ea1['options']?_0x4e5ea1[_0x2dd1('0x1d')][_0x2dd1('0x1f')]||null:null,'attributes':_0x4e5ea1[_0x2dd1('0x1d')]?_0x4e5ea1['options'][_0x2dd1('0x20')]||null:null,'include':_0x4e5ea1[_0x2dd1('0x1d')]?_0x4e5ea1[_0x2dd1('0x1d')][_0x2dd1('0x23')]?_['map'](_0x4e5ea1[_0x2dd1('0x1d')][_0x2dd1('0x23')],function(_0x1718f7){return{'model':db[_0x1718f7['model']],'as':_0x1718f7['as'],'attributes':_0x1718f7[_0x2dd1('0x20')],'include':_0x1718f7['include']?_[_0x2dd1('0x21')](_0x1718f7[_0x2dd1('0x23')],function(_0x7065d1){return{'model':db[_0x7065d1['model']],'as':_0x7065d1['as'],'attributes':_0x7065d1[_0x2dd1('0x20')],'include':_0x7065d1[_0x2dd1('0x23')]?_[_0x2dd1('0x21')](_0x7065d1[_0x2dd1('0x23')],function(_0x3eb83b){return{'model':db[_0x3eb83b[_0x2dd1('0x22')]],'as':_0x3eb83b['as'],'attributes':_0x3eb83b[_0x2dd1('0x20')]};}):[]};}):[]};}):[]:[]})[_0x2dd1('0x24')](function(_0x2e8f83){logger[_0x2dd1('0x17')](_0x2dd1('0x27'),_0x4e5ea1);logger[_0x2dd1('0x25')](_0x2dd1('0x27'),_0x4e5ea1,JSON[_0x2dd1('0x26')](_0x2e8f83));_0x1bb5df(_0x2e8f83);})[_0x2dd1('0x19')](function(_0x83d4ba){logger[_0x2dd1('0x14')]('ShowWhatsappQueue',_0x83d4ba[_0x2dd1('0x16')],_0x4e5ea1);_0x26fce2(_0x5a992['error'](0x1f4,_0x83d4ba[_0x2dd1('0x16')]));});});}; \ No newline at end of file +var _0xd045=['request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetWhatsappQueue','WhatsappQueue','findAll','options','raw','where','attributes','include','map','model','ShowWhatsappQueue','find','lodash','moment','bluebird','randomstring','../../config/utils','jayson/promise','client','redis','defaults','localhost','./whatsappQueue.socket','register','request','then','info','WhatsappQueue,\x20%s,\x20%s'];(function(_0x576170,_0x1712ae){var _0x397c70=function(_0x2eb9de){while(--_0x2eb9de){_0x576170['push'](_0x576170['shift']());}};_0x397c70(++_0x1712ae);}(_0xd045,0xce));var _0x5d04=function(_0x2abba8,_0x12b859){_0x2abba8=_0x2abba8-0x0;var _0x4e2b6e=_0xd045[_0x2abba8];return _0x4e2b6e;};'use strict';var _=require(_0x5d04('0x0'));var util=require('util');var moment=require(_0x5d04('0x1'));var BPromise=require(_0x5d04('0x2'));var rs=require(_0x5d04('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x5d04('0x4'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x5d04('0x5'));var client=jayson[_0x5d04('0x6')]['http']({'port':0x232a});config[_0x5d04('0x7')]=_[_0x5d04('0x8')](config[_0x5d04('0x7')],{'host':_0x5d04('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5d04('0x7')]));require(_0x5d04('0xa'))[_0x5d04('0xb')](socket);function respondWithRpcPromise(_0xb917b3,_0xe52f54,_0x195609){return new BPromise(function(_0x1e25b3,_0x1d6e7e){return client[_0x5d04('0xc')](_0xb917b3,_0x195609)[_0x5d04('0xd')](function(_0x3e0610){logger[_0x5d04('0xe')](_0x5d04('0xf'),_0xe52f54,_0x5d04('0x10'));logger[_0x5d04('0x11')](_0x5d04('0x12'),_0xe52f54,_0x5d04('0x10'),JSON[_0x5d04('0x13')](_0x3e0610));if(_0x3e0610[_0x5d04('0x14')]){if(_0x3e0610['error'][_0x5d04('0x15')]===0x1f4){logger['error'](_0x5d04('0xf'),_0xe52f54,_0x3e0610[_0x5d04('0x14')][_0x5d04('0x16')]);return _0x1d6e7e(_0x3e0610[_0x5d04('0x14')][_0x5d04('0x16')]);}logger[_0x5d04('0x14')](_0x5d04('0xf'),_0xe52f54,_0x3e0610[_0x5d04('0x14')][_0x5d04('0x16')]);return _0x1e25b3(_0x3e0610[_0x5d04('0x14')]['message']);}else{logger[_0x5d04('0xe')](_0x5d04('0xf'),_0xe52f54,_0x5d04('0x10'));_0x1e25b3(_0x3e0610[_0x5d04('0x17')][_0x5d04('0x16')]);}})[_0x5d04('0x18')](function(_0xfc67e9){logger[_0x5d04('0x14')](_0x5d04('0xf'),_0xe52f54,_0xfc67e9);_0x1d6e7e(_0xfc67e9);});});}exports[_0x5d04('0x19')]=function(_0x2e91c9){var _0x32e055=this;return new Promise(function(_0x3fc293,_0x248277){return db[_0x5d04('0x1a')][_0x5d04('0x1b')]({'raw':_0x2e91c9[_0x5d04('0x1c')]?_0x2e91c9['options'][_0x5d04('0x1d')]===undefined?!![]:![]:!![],'where':_0x2e91c9['options']?_0x2e91c9[_0x5d04('0x1c')][_0x5d04('0x1e')]||null:null,'attributes':_0x2e91c9[_0x5d04('0x1c')]?_0x2e91c9[_0x5d04('0x1c')][_0x5d04('0x1f')]||null:null,'limit':_0x2e91c9[_0x5d04('0x1c')]?_0x2e91c9['options']['limit']||null:null,'include':_0x2e91c9[_0x5d04('0x1c')]?_0x2e91c9[_0x5d04('0x1c')][_0x5d04('0x20')]?_[_0x5d04('0x21')](_0x2e91c9[_0x5d04('0x1c')]['include'],function(_0x1f4898){return{'model':db[_0x1f4898[_0x5d04('0x22')]],'as':_0x1f4898['as'],'attributes':_0x1f4898[_0x5d04('0x1f')],'include':_0x1f4898[_0x5d04('0x20')]?_[_0x5d04('0x21')](_0x1f4898[_0x5d04('0x20')],function(_0x32e9f3){return{'model':db[_0x32e9f3[_0x5d04('0x22')]],'as':_0x32e9f3['as'],'attributes':_0x32e9f3['attributes'],'include':_0x32e9f3[_0x5d04('0x20')]?_['map'](_0x32e9f3[_0x5d04('0x20')],function(_0x4ae28c){return{'model':db[_0x4ae28c[_0x5d04('0x22')]],'as':_0x4ae28c['as'],'attributes':_0x4ae28c[_0x5d04('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x190a9f){logger[_0x5d04('0xe')](_0x5d04('0x19'),_0x2e91c9);logger[_0x5d04('0x11')]('GetWhatsappQueue',_0x2e91c9,JSON[_0x5d04('0x13')](_0x190a9f));_0x3fc293(_0x190a9f);})[_0x5d04('0x18')](function(_0x4bf1a3){logger[_0x5d04('0x14')](_0x5d04('0x19'),_0x4bf1a3['message'],_0x2e91c9);_0x248277(_0x32e055[_0x5d04('0x14')](0x1f4,_0x4bf1a3[_0x5d04('0x16')]));});});};exports[_0x5d04('0x23')]=function(_0x159e7c){var _0x278ecb=this;return new Promise(function(_0x2f26a2,_0x165b5a){return db[_0x5d04('0x1a')][_0x5d04('0x24')]({'raw':_0x159e7c[_0x5d04('0x1c')]?_0x159e7c[_0x5d04('0x1c')][_0x5d04('0x1d')]===undefined?!![]:![]:!![],'where':_0x159e7c[_0x5d04('0x1c')]?_0x159e7c[_0x5d04('0x1c')][_0x5d04('0x1e')]||null:null,'attributes':_0x159e7c['options']?_0x159e7c[_0x5d04('0x1c')][_0x5d04('0x1f')]||null:null,'include':_0x159e7c[_0x5d04('0x1c')]?_0x159e7c[_0x5d04('0x1c')]['include']?_['map'](_0x159e7c[_0x5d04('0x1c')][_0x5d04('0x20')],function(_0x32a772){return{'model':db[_0x32a772[_0x5d04('0x22')]],'as':_0x32a772['as'],'attributes':_0x32a772[_0x5d04('0x1f')],'include':_0x32a772['include']?_['map'](_0x32a772[_0x5d04('0x20')],function(_0x21dd62){return{'model':db[_0x21dd62[_0x5d04('0x22')]],'as':_0x21dd62['as'],'attributes':_0x21dd62[_0x5d04('0x1f')],'include':_0x21dd62[_0x5d04('0x20')]?_['map'](_0x21dd62[_0x5d04('0x20')],function(_0x1779a9){return{'model':db[_0x1779a9['model']],'as':_0x1779a9['as'],'attributes':_0x1779a9['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x33efa1){logger[_0x5d04('0xe')]('ShowWhatsappQueue',_0x159e7c);logger['debug'](_0x5d04('0x23'),_0x159e7c,JSON[_0x5d04('0x13')](_0x33efa1));_0x2f26a2(_0x33efa1);})['catch'](function(_0x308cc6){logger['error'](_0x5d04('0x23'),_0x308cc6[_0x5d04('0x16')],_0x159e7c);_0x165b5a(_0x278ecb[_0x5d04('0x14')](0x1f4,_0x308cc6[_0x5d04('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index 18a49df..b4c4ef6 100644 --- a/server/api/whatsappQueue/whatsappQueue.socket.js +++ b/server/api/whatsappQueue/whatsappQueue.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7edc=['./whatsappQueue.events','update','removeListener','register','length','whatsappQueue:'];(function(_0x3c8517,_0x3f3f13){var _0xc1268f=function(_0x18895e){while(--_0x18895e){_0x3c8517['push'](_0x3c8517['shift']());}};_0xc1268f(++_0x3f3f13);}(_0x7edc,0x7e));var _0xc7ed=function(_0x2e913b,_0x4b7071){_0x2e913b=_0x2e913b-0x0;var _0x173899=_0x7edc[_0x2e913b];return _0x173899;};'use strict';var WhatsappQueueEvents=require(_0xc7ed('0x0'));var events=['save','remove',_0xc7ed('0x1')];function createListener(_0x2ec458,_0x3ac993){return function(_0x54dc8e){_0x3ac993['emit'](_0x2ec458,_0x54dc8e);};}function removeListener(_0x45872e,_0x2c540d){return function(){WhatsappQueueEvents[_0xc7ed('0x2')](_0x45872e,_0x2c540d);};}exports[_0xc7ed('0x3')]=function(_0x1ffefd){for(var _0x2f0144=0x0,_0x413c79=events[_0xc7ed('0x4')];_0x2f0144<_0x413c79;_0x2f0144++){var _0x4006ed=events[_0x2f0144];var _0x5f0ce0=createListener(_0xc7ed('0x5')+_0x4006ed,_0x1ffefd);WhatsappQueueEvents['on'](_0x4006ed,_0x5f0ce0);}}; \ No newline at end of file +var _0x28e6=['save','remove','emit','length','whatsappQueue:'];(function(_0xa6941e,_0x21ce55){var _0x1d7acd=function(_0x2fab8a){while(--_0x2fab8a){_0xa6941e['push'](_0xa6941e['shift']());}};_0x1d7acd(++_0x21ce55);}(_0x28e6,0x181));var _0x628e=function(_0x4fbfea,_0x33df62){_0x4fbfea=_0x4fbfea-0x0;var _0x4a4f0=_0x28e6[_0x4fbfea];return _0x4a4f0;};'use strict';var WhatsappQueueEvents=require('./whatsappQueue.events');var events=[_0x628e('0x0'),_0x628e('0x1'),'update'];function createListener(_0x5e6d61,_0x3cca81){return function(_0x14285d){_0x3cca81[_0x628e('0x2')](_0x5e6d61,_0x14285d);};}function removeListener(_0x3ac15e,_0x95b0c3){return function(){WhatsappQueueEvents['removeListener'](_0x3ac15e,_0x95b0c3);};}exports['register']=function(_0x20c439){for(var _0x3d0064=0x0,_0x43b159=events[_0x628e('0x3')];_0x3d0064<_0x43b159;_0x3d0064++){var _0x3537b9=events[_0x3d0064];var _0x3359e4=createListener(_0x628e('0x4')+_0x3537b9,_0x20c439);WhatsappQueueEvents['on'](_0x3537b9,_0x3359e4);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index 3edbb15..3697fbe 100644 --- a/server/api/whatsappQueueReport/index.js +++ b/server/api/whatsappQueueReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xced6=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','/describe','/:id','isAuthenticated','post','create','put','delete','exports','multer','path','connect-timeout','express','Router'];(function(_0x5d0bd2,_0x3bb5b7){var _0x175ae9=function(_0x33020a){while(--_0x33020a){_0x5d0bd2['push'](_0x5d0bd2['shift']());}};_0x175ae9(++_0x3bb5b7);}(_0xced6,0x1b5));var _0x6ced=function(_0x29cd50,_0x516360){_0x29cd50=_0x29cd50-0x0;var _0x2ab171=_0xced6[_0x29cd50];return _0x2ab171;};'use strict';var multer=require(_0x6ced('0x0'));var util=require('util');var path=require(_0x6ced('0x1'));var timeout=require(_0x6ced('0x2'));var express=require(_0x6ced('0x3'));var router=express[_0x6ced('0x4')]();var auth=require(_0x6ced('0x5'));var interaction=require(_0x6ced('0x6'));var config=require(_0x6ced('0x7'));var controller=require('./whatsappQueueReport.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x6ced('0x8')](_0x6ced('0x9'),auth['isAuthenticated'](),controller['describe']);router['get'](_0x6ced('0xa'),auth[_0x6ced('0xb')](),controller['show']);router[_0x6ced('0xc')]('/',auth[_0x6ced('0xb')](),controller[_0x6ced('0xd')]);router[_0x6ced('0xe')](_0x6ced('0xa'),auth[_0x6ced('0xb')](),controller['update']);router[_0x6ced('0xf')]('/:id',auth[_0x6ced('0xb')](),controller['destroy']);module[_0x6ced('0x10')]=router; \ No newline at end of file +var _0x0221=['util','path','connect-timeout','Router','../../components/auth/service','get','index','/describe','isAuthenticated','describe','/:id','show','post','create','update','delete','destroy','multer'];(function(_0x436630,_0x208157){var _0x338fe2=function(_0x57deec){while(--_0x57deec){_0x436630['push'](_0x436630['shift']());}};_0x338fe2(++_0x208157);}(_0x0221,0xc5));var _0x1022=function(_0x52cbc3,_0x42f5a3){_0x52cbc3=_0x52cbc3-0x0;var _0x3b7b36=_0x0221[_0x52cbc3];return _0x3b7b36;};'use strict';var multer=require(_0x1022('0x0'));var util=require(_0x1022('0x1'));var path=require(_0x1022('0x2'));var timeout=require(_0x1022('0x3'));var express=require('express');var router=express[_0x1022('0x4')]();var auth=require(_0x1022('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./whatsappQueueReport.controller');router[_0x1022('0x6')]('/',auth['isAuthenticated'](),controller[_0x1022('0x7')]);router[_0x1022('0x6')](_0x1022('0x8'),auth[_0x1022('0x9')](),controller[_0x1022('0xa')]);router['get'](_0x1022('0xb'),auth[_0x1022('0x9')](),controller[_0x1022('0xc')]);router[_0x1022('0xd')]('/',auth[_0x1022('0x9')](),controller[_0x1022('0xe')]);router['put'](_0x1022('0xb'),auth[_0x1022('0x9')](),controller[_0x1022('0xf')]);router[_0x1022('0x10')](_0x1022('0xb'),auth[_0x1022('0x9')](),controller[_0x1022('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index 9b93721..fedbe3f 100644 --- a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js +++ b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x00bb=['sequelize','exports','STRING','DATE'];(function(_0x1561d2,_0x1529fa){var _0x3e5cbc=function(_0x23b265){while(--_0x23b265){_0x1561d2['push'](_0x1561d2['shift']());}};_0x3e5cbc(++_0x1529fa);}(_0x00bb,0x1d8));var _0xb00b=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x00bb[_0x397e5f];return _0x5302b8;};'use strict';var Sequelize=require(_0xb00b('0x0'));module[_0xb00b('0x1')]={'uniqueid':{'type':Sequelize[_0xb00b('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xb00b('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xb00b('0x3')]},'exitAt':{'type':Sequelize[_0xb00b('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x55ca=['DATE','STRING','sequelize','exports'];(function(_0xed7ab0,_0x3739ca){var _0x415fe2=function(_0x1f01b1){while(--_0x1f01b1){_0xed7ab0['push'](_0xed7ab0['shift']());}};_0x415fe2(++_0x3739ca);}(_0x55ca,0x126));var _0xa55c=function(_0x143a91,_0x235332){_0x143a91=_0x143a91-0x0;var _0x1906f5=_0x55ca[_0x143a91];return _0x1906f5;};'use strict';var Sequelize=require(_0xa55c('0x0'));module[_0xa55c('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xa55c('0x2')]},'acceptAt':{'type':Sequelize[_0xa55c('0x2')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xa55c('0x3')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index 18803b0..0097cab 100644 --- a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js +++ b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf7=['nolimit','sort','filters','pick','filter','where','VIRTUAL','merge','options','includeAll','include','rows','catch','show','find','create','body','params','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','error','name','map','WhatsappQueueReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty'];(function(_0x459211,_0x176acb){var _0x4c5c22=function(_0x1c72f1){while(--_0x1c72f1){_0x459211['push'](_0x459211['shift']());}};_0x4c5c22(++_0x176acb);}(_0xbaf7,0x137));var _0x7baf=function(_0x357654,_0x2d8331){_0x357654=_0x357654-0x0;var _0x4cd7dd=_0xbaf7[_0x357654];return _0x4cd7dd;};'use strict';var pdf=require(_0x7baf('0x0'));var emlformat=require(_0x7baf('0x1'));var rimraf=require(_0x7baf('0x2'));var zipdir=require(_0x7baf('0x3'));var jsonpatch=require(_0x7baf('0x4'));var rp=require('request-promise');var moment=require(_0x7baf('0x5'));var BPromise=require(_0x7baf('0x6'));var Mustache=require(_0x7baf('0x7'));var util=require(_0x7baf('0x8'));var path=require(_0x7baf('0x9'));var sox=require(_0x7baf('0xa'));var csv=require(_0x7baf('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x7baf('0xc'));var squel=require(_0x7baf('0xd'));var crypto=require(_0x7baf('0xe'));var jsforce=require(_0x7baf('0xf'));var deskjs=require(_0x7baf('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7baf('0x11'));var Redis=require('ioredis');var authService=require(_0x7baf('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7baf('0x13'));var logger=require(_0x7baf('0x14'))(_0x7baf('0x15'));var utils=require('../../config/utils');var config=require(_0x7baf('0x16'));var db=require(_0x7baf('0x17'))['db'];function respondWithStatusCode(_0x12ab62,_0x20ad01){_0x20ad01=_0x20ad01||0xcc;return function(_0x1f8322){if(_0x1f8322){return _0x12ab62[_0x7baf('0x18')](_0x20ad01);}return _0x12ab62[_0x7baf('0x19')](_0x20ad01)[_0x7baf('0x1a')]();};}function respondWithResult(_0x47f9a3,_0xb61350){_0xb61350=_0xb61350||0xc8;return function(_0x4b9af0){if(_0x4b9af0){return _0x47f9a3[_0x7baf('0x19')](_0xb61350)[_0x7baf('0x1b')](_0x4b9af0);}};}function respondWithFilteredResult(_0x218c48,_0x5f03f4){return function(_0x2ed6ac){if(_0x2ed6ac){var _0x264265=_0x2ed6ac[_0x7baf('0x1c')],_0x2bacad=_0x5f03f4[_0x7baf('0x1d')],_0x3b70fd=_0x5f03f4[_0x7baf('0x1d')]+_0x5f03f4[_0x7baf('0x1e')],_0x4748ca;if(_0x3b70fd>=_0x264265){_0x3b70fd=_0x264265;_0x4748ca=0xc8;}else{_0x4748ca=0xce;}_0x218c48[_0x7baf('0x19')](_0x4748ca);return _0x218c48[_0x7baf('0x1f')](_0x7baf('0x20'),_0x2bacad+'-'+_0x3b70fd+'/'+_0x264265)[_0x7baf('0x1b')](_0x2ed6ac);}return null;};}function patchUpdates(_0x3a9350){return function(_0x9932f4){try{jsonpatch[_0x7baf('0x21')](_0x9932f4,_0x3a9350,!![]);}catch(_0x33c58e){return BPromise[_0x7baf('0x22')](_0x33c58e);}return _0x9932f4['save']();};}function saveUpdates(_0x9a8f82,_0x4cb942){return function(_0x4800c4){if(_0x4800c4){return _0x4800c4[_0x7baf('0x23')](_0x9a8f82)[_0x7baf('0x24')](function(_0x1e8a3b){return _0x1e8a3b;});}return null;};}function removeEntity(_0xaca134,_0xe0295e){return function(_0xd324a){if(_0xd324a){return _0xd324a[_0x7baf('0x25')]()[_0x7baf('0x24')](function(){_0xaca134[_0x7baf('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x549a1c,_0xabf63e){return function(_0x485171){if(!_0x485171){_0x549a1c[_0x7baf('0x18')](0x194);}return _0x485171;};}function handleError(_0x116224,_0xa4bfad){_0xa4bfad=_0xa4bfad||0x1f4;return function(_0x594094){logger[_0x7baf('0x26')](_0x594094['stack']);if(_0x594094[_0x7baf('0x27')]){delete _0x594094['name'];}_0x116224[_0x7baf('0x19')](_0xa4bfad)['send'](_0x594094);};}exports['index']=function(_0x3ccb36,_0x5b9c9c){var _0x357d1f={},_0x1971b9={},_0x107736={'count':0x0,'rows':[]};var _0x1cf5be=_[_0x7baf('0x28')](db[_0x7baf('0x29')][_0x7baf('0x2a')],function(_0x4b0b3b){return{'name':_0x4b0b3b[_0x7baf('0x2b')],'type':_0x4b0b3b[_0x7baf('0x2c')][_0x7baf('0x2d')]};});_0x1971b9[_0x7baf('0x2e')]=_[_0x7baf('0x28')](_0x1cf5be,_0x7baf('0x27'));_0x1971b9[_0x7baf('0x2f')]=_[_0x7baf('0x30')](_0x3ccb36[_0x7baf('0x2f')]);_0x1971b9['filters']=_[_0x7baf('0x31')](_0x1971b9[_0x7baf('0x2e')],_0x1971b9[_0x7baf('0x2f')]);_0x357d1f[_0x7baf('0x32')]=_[_0x7baf('0x31')](_0x1971b9[_0x7baf('0x2e')],qs['fields'](_0x3ccb36[_0x7baf('0x2f')][_0x7baf('0x33')]));_0x357d1f['attributes']=_0x357d1f[_0x7baf('0x32')][_0x7baf('0x34')]?_0x357d1f[_0x7baf('0x32')]:_0x1971b9[_0x7baf('0x2e')];if(!_0x3ccb36['query'][_0x7baf('0x35')](_0x7baf('0x36'))){_0x357d1f[_0x7baf('0x1e')]=qs[_0x7baf('0x1e')](_0x3ccb36['query'][_0x7baf('0x1e')]);_0x357d1f['offset']=qs[_0x7baf('0x1d')](_0x3ccb36[_0x7baf('0x2f')][_0x7baf('0x1d')]);}_0x357d1f['order']=qs[_0x7baf('0x37')](_0x3ccb36['query'][_0x7baf('0x37')]);_0x357d1f['where']=qs[_0x7baf('0x38')](_[_0x7baf('0x39')](_0x3ccb36[_0x7baf('0x2f')],_0x1971b9[_0x7baf('0x38')]),_0x1cf5be);if(_0x3ccb36[_0x7baf('0x2f')][_0x7baf('0x3a')]){_0x357d1f[_0x7baf('0x3b')]=_['merge'](_0x357d1f[_0x7baf('0x3b')],{'$or':_['map'](_0x1cf5be,function(_0x172094){if(_0x172094['type']!==_0x7baf('0x3c')){var _0x13b3a9={};_0x13b3a9[_0x172094[_0x7baf('0x27')]]={'$like':'%'+_0x3ccb36[_0x7baf('0x2f')]['filter']+'%'};return _0x13b3a9;}})});}_0x357d1f=_[_0x7baf('0x3d')]({},_0x357d1f,_0x3ccb36[_0x7baf('0x3e')]);var _0x254ec5={'where':_0x357d1f[_0x7baf('0x3b')]};return db[_0x7baf('0x29')]['count'](_0x254ec5)[_0x7baf('0x24')](function(_0x8719c3){_0x107736[_0x7baf('0x1c')]=_0x8719c3;if(_0x3ccb36[_0x7baf('0x2f')][_0x7baf('0x3f')]){_0x357d1f[_0x7baf('0x40')]=[{'all':!![]}];}return db['WhatsappQueueReport']['findAll'](_0x357d1f);})['then'](function(_0x43bbab){_0x107736[_0x7baf('0x41')]=_0x43bbab;return _0x107736;})[_0x7baf('0x24')](respondWithFilteredResult(_0x5b9c9c,_0x357d1f))[_0x7baf('0x42')](handleError(_0x5b9c9c,null));};exports[_0x7baf('0x43')]=function(_0x431fe7,_0xe7711){var _0x52bcee={'raw':!![],'where':{'id':_0x431fe7['params']['id']}},_0x3e7236={};_0x3e7236[_0x7baf('0x2e')]=_[_0x7baf('0x30')](db[_0x7baf('0x29')]['rawAttributes']);_0x3e7236['query']=_[_0x7baf('0x30')](_0x431fe7[_0x7baf('0x2f')]);_0x3e7236['filters']=_['intersection'](_0x3e7236['model'],_0x3e7236['query']);_0x52bcee[_0x7baf('0x32')]=_[_0x7baf('0x31')](_0x3e7236['model'],qs[_0x7baf('0x33')](_0x431fe7[_0x7baf('0x2f')]['fields']));_0x52bcee['attributes']=_0x52bcee['attributes'][_0x7baf('0x34')]?_0x52bcee[_0x7baf('0x32')]:_0x3e7236[_0x7baf('0x2e')];if(_0x431fe7['query'][_0x7baf('0x3f')]){_0x52bcee['include']=[{'all':!![]}];}_0x52bcee=_[_0x7baf('0x3d')]({},_0x52bcee,_0x431fe7['options']);return db[_0x7baf('0x29')][_0x7baf('0x44')](_0x52bcee)['then'](handleEntityNotFound(_0xe7711,null))[_0x7baf('0x24')](respondWithResult(_0xe7711,null))[_0x7baf('0x42')](handleError(_0xe7711,null));};exports[_0x7baf('0x45')]=function(_0x518a05,_0x1013ca){return db['WhatsappQueueReport']['create'](_0x518a05[_0x7baf('0x46')],{})['then'](respondWithResult(_0x1013ca,0xc9))[_0x7baf('0x42')](handleError(_0x1013ca,null));};exports[_0x7baf('0x23')]=function(_0x3e72fa,_0x2ee243){if(_0x3e72fa[_0x7baf('0x46')]['id']){delete _0x3e72fa['body']['id'];}return db[_0x7baf('0x29')]['find']({'where':{'id':_0x3e72fa[_0x7baf('0x47')]['id']}})[_0x7baf('0x24')](handleEntityNotFound(_0x2ee243,null))[_0x7baf('0x24')](saveUpdates(_0x3e72fa[_0x7baf('0x46')],null))[_0x7baf('0x24')](respondWithResult(_0x2ee243,null))['catch'](handleError(_0x2ee243,null));};exports[_0x7baf('0x25')]=function(_0xd69a15,_0x14d749){return db['WhatsappQueueReport'][_0x7baf('0x44')]({'where':{'id':_0xd69a15[_0x7baf('0x47')]['id']}})['then'](handleEntityNotFound(_0x14d749,null))[_0x7baf('0x24')](removeEntity(_0x14d749,null))[_0x7baf('0x42')](handleError(_0x14d749,null));};exports['describe']=function(_0x529420,_0x323abe){return db[_0x7baf('0x29')][_0x7baf('0x48')]()[_0x7baf('0x24')](respondWithResult(_0x323abe,null))['catch'](handleError(_0x323abe,null));}; \ No newline at end of file +var _0x6ab9=['name','send','map','WhatsappQueueReport','fieldName','type','model','query','keys','filters','intersection','attributes','length','nolimit','order','sort','pick','filter','where','VIRTUAL','options','includeAll','include','findAll','rows','params','rawAttributes','merge','find','create','body','catch','update','destroy','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','then','error','stack'];(function(_0x123ce8,_0x4437c6){var _0x4faa58=function(_0x5da333){while(--_0x5da333){_0x123ce8['push'](_0x123ce8['shift']());}};_0x4faa58(++_0x4437c6);}(_0x6ab9,0x19a));var _0x96ab=function(_0xc8a931,_0x260690){_0xc8a931=_0xc8a931-0x0;var _0x28bd27=_0x6ab9[_0xc8a931];return _0x28bd27;};'use strict';var pdf=require(_0x96ab('0x0'));var emlformat=require(_0x96ab('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x96ab('0x2'));var jsonpatch=require(_0x96ab('0x3'));var rp=require(_0x96ab('0x4'));var moment=require(_0x96ab('0x5'));var BPromise=require(_0x96ab('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x96ab('0x7'));var sox=require(_0x96ab('0x8'));var csv=require(_0x96ab('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x96ab('0xa'));var squel=require(_0x96ab('0xb'));var crypto=require('crypto');var jsforce=require(_0x96ab('0xc'));var deskjs=require(_0x96ab('0xd'));var toCsv=require(_0x96ab('0x9'));var querystring=require(_0x96ab('0xe'));var Papa=require(_0x96ab('0xf'));var Redis=require(_0x96ab('0x10'));var authService=require(_0x96ab('0x11'));var qs=require(_0x96ab('0x12'));var as=require(_0x96ab('0x13'));var hardwareService=require(_0x96ab('0x14'));var logger=require(_0x96ab('0x15'))(_0x96ab('0x16'));var utils=require(_0x96ab('0x17'));var config=require('../../config/environment');var db=require(_0x96ab('0x18'))['db'];function respondWithStatusCode(_0x5558e2,_0x2c9204){_0x2c9204=_0x2c9204||0xcc;return function(_0x1131b5){if(_0x1131b5){return _0x5558e2[_0x96ab('0x19')](_0x2c9204);}return _0x5558e2[_0x96ab('0x1a')](_0x2c9204)[_0x96ab('0x1b')]();};}function respondWithResult(_0x3c79b7,_0x3ff9a9){_0x3ff9a9=_0x3ff9a9||0xc8;return function(_0x24e2c4){if(_0x24e2c4){return _0x3c79b7[_0x96ab('0x1a')](_0x3ff9a9)[_0x96ab('0x1c')](_0x24e2c4);}};}function respondWithFilteredResult(_0xba0d5e,_0x4df67b){return function(_0x4ec844){if(_0x4ec844){var _0x3b54cc=_0x4ec844[_0x96ab('0x1d')],_0x8d5c87=_0x4df67b[_0x96ab('0x1e')],_0x3843bc=_0x4df67b['offset']+_0x4df67b[_0x96ab('0x1f')],_0x57237a;if(_0x3843bc>=_0x3b54cc){_0x3843bc=_0x3b54cc;_0x57237a=0xc8;}else{_0x57237a=0xce;}_0xba0d5e['status'](_0x57237a);return _0xba0d5e[_0x96ab('0x20')](_0x96ab('0x21'),_0x8d5c87+'-'+_0x3843bc+'/'+_0x3b54cc)[_0x96ab('0x1c')](_0x4ec844);}return null;};}function patchUpdates(_0x23f826){return function(_0xcf5900){try{jsonpatch[_0x96ab('0x22')](_0xcf5900,_0x23f826,!![]);}catch(_0x154fec){return BPromise[_0x96ab('0x23')](_0x154fec);}return _0xcf5900[_0x96ab('0x24')]();};}function saveUpdates(_0xb0ab91,_0x2aa3c4){return function(_0x4f3bb4){if(_0x4f3bb4){return _0x4f3bb4['update'](_0xb0ab91)[_0x96ab('0x25')](function(_0x166a78){return _0x166a78;});}return null;};}function removeEntity(_0x7ce121,_0x583be2){return function(_0x41936c){if(_0x41936c){return _0x41936c['destroy']()[_0x96ab('0x25')](function(){_0x7ce121['status'](0xcc)[_0x96ab('0x1b')]();});}};}function handleEntityNotFound(_0x90fa22,_0x5a02d0){return function(_0x1deef7){if(!_0x1deef7){_0x90fa22[_0x96ab('0x19')](0x194);}return _0x1deef7;};}function handleError(_0x4475b6,_0x42d20c){_0x42d20c=_0x42d20c||0x1f4;return function(_0x3de35e){logger[_0x96ab('0x26')](_0x3de35e[_0x96ab('0x27')]);if(_0x3de35e[_0x96ab('0x28')]){delete _0x3de35e[_0x96ab('0x28')];}_0x4475b6['status'](_0x42d20c)[_0x96ab('0x29')](_0x3de35e);};}exports['index']=function(_0x14ff59,_0x44e219){var _0x284156={},_0x240553={},_0x1dd9f4={'count':0x0,'rows':[]};var _0x11db77=_[_0x96ab('0x2a')](db[_0x96ab('0x2b')]['rawAttributes'],function(_0xefb070){return{'name':_0xefb070[_0x96ab('0x2c')],'type':_0xefb070[_0x96ab('0x2d')]['key']};});_0x240553[_0x96ab('0x2e')]=_[_0x96ab('0x2a')](_0x11db77,_0x96ab('0x28'));_0x240553[_0x96ab('0x2f')]=_[_0x96ab('0x30')](_0x14ff59['query']);_0x240553[_0x96ab('0x31')]=_[_0x96ab('0x32')](_0x240553['model'],_0x240553[_0x96ab('0x2f')]);_0x284156['attributes']=_['intersection'](_0x240553['model'],qs['fields'](_0x14ff59[_0x96ab('0x2f')]['fields']));_0x284156[_0x96ab('0x33')]=_0x284156[_0x96ab('0x33')][_0x96ab('0x34')]?_0x284156[_0x96ab('0x33')]:_0x240553[_0x96ab('0x2e')];if(!_0x14ff59['query']['hasOwnProperty'](_0x96ab('0x35'))){_0x284156[_0x96ab('0x1f')]=qs['limit'](_0x14ff59[_0x96ab('0x2f')][_0x96ab('0x1f')]);_0x284156['offset']=qs['offset'](_0x14ff59[_0x96ab('0x2f')][_0x96ab('0x1e')]);}_0x284156[_0x96ab('0x36')]=qs[_0x96ab('0x37')](_0x14ff59['query'][_0x96ab('0x37')]);_0x284156['where']=qs['filters'](_[_0x96ab('0x38')](_0x14ff59['query'],_0x240553[_0x96ab('0x31')]),_0x11db77);if(_0x14ff59[_0x96ab('0x2f')][_0x96ab('0x39')]){_0x284156[_0x96ab('0x3a')]=_['merge'](_0x284156[_0x96ab('0x3a')],{'$or':_[_0x96ab('0x2a')](_0x11db77,function(_0x3e4137){if(_0x3e4137[_0x96ab('0x2d')]!==_0x96ab('0x3b')){var _0x58c8e6={};_0x58c8e6[_0x3e4137[_0x96ab('0x28')]]={'$like':'%'+_0x14ff59['query'][_0x96ab('0x39')]+'%'};return _0x58c8e6;}})});}_0x284156=_['merge']({},_0x284156,_0x14ff59[_0x96ab('0x3c')]);var _0xfc0e7a={'where':_0x284156[_0x96ab('0x3a')]};return db[_0x96ab('0x2b')]['count'](_0xfc0e7a)[_0x96ab('0x25')](function(_0x4fcd20){_0x1dd9f4[_0x96ab('0x1d')]=_0x4fcd20;if(_0x14ff59[_0x96ab('0x2f')][_0x96ab('0x3d')]){_0x284156[_0x96ab('0x3e')]=[{'all':!![]}];}return db[_0x96ab('0x2b')][_0x96ab('0x3f')](_0x284156);})[_0x96ab('0x25')](function(_0x1df03b){_0x1dd9f4[_0x96ab('0x40')]=_0x1df03b;return _0x1dd9f4;})[_0x96ab('0x25')](respondWithFilteredResult(_0x44e219,_0x284156))['catch'](handleError(_0x44e219,null));};exports['show']=function(_0x29ac73,_0x1f7fcc){var _0xb541d8={'raw':!![],'where':{'id':_0x29ac73[_0x96ab('0x41')]['id']}},_0x3aabc0={};_0x3aabc0[_0x96ab('0x2e')]=_[_0x96ab('0x30')](db['WhatsappQueueReport'][_0x96ab('0x42')]);_0x3aabc0['query']=_['keys'](_0x29ac73[_0x96ab('0x2f')]);_0x3aabc0[_0x96ab('0x31')]=_['intersection'](_0x3aabc0[_0x96ab('0x2e')],_0x3aabc0[_0x96ab('0x2f')]);_0xb541d8[_0x96ab('0x33')]=_[_0x96ab('0x32')](_0x3aabc0[_0x96ab('0x2e')],qs['fields'](_0x29ac73[_0x96ab('0x2f')]['fields']));_0xb541d8['attributes']=_0xb541d8[_0x96ab('0x33')]['length']?_0xb541d8[_0x96ab('0x33')]:_0x3aabc0[_0x96ab('0x2e')];if(_0x29ac73[_0x96ab('0x2f')]['includeAll']){_0xb541d8[_0x96ab('0x3e')]=[{'all':!![]}];}_0xb541d8=_[_0x96ab('0x43')]({},_0xb541d8,_0x29ac73[_0x96ab('0x3c')]);return db[_0x96ab('0x2b')][_0x96ab('0x44')](_0xb541d8)['then'](handleEntityNotFound(_0x1f7fcc,null))[_0x96ab('0x25')](respondWithResult(_0x1f7fcc,null))['catch'](handleError(_0x1f7fcc,null));};exports[_0x96ab('0x45')]=function(_0x5343f9,_0x1decdf){return db['WhatsappQueueReport'][_0x96ab('0x45')](_0x5343f9[_0x96ab('0x46')],{})[_0x96ab('0x25')](respondWithResult(_0x1decdf,0xc9))[_0x96ab('0x47')](handleError(_0x1decdf,null));};exports[_0x96ab('0x48')]=function(_0x42dbd7,_0x4d15ef){if(_0x42dbd7[_0x96ab('0x46')]['id']){delete _0x42dbd7[_0x96ab('0x46')]['id'];}return db['WhatsappQueueReport'][_0x96ab('0x44')]({'where':{'id':_0x42dbd7['params']['id']}})[_0x96ab('0x25')](handleEntityNotFound(_0x4d15ef,null))[_0x96ab('0x25')](saveUpdates(_0x42dbd7[_0x96ab('0x46')],null))['then'](respondWithResult(_0x4d15ef,null))[_0x96ab('0x47')](handleError(_0x4d15ef,null));};exports[_0x96ab('0x49')]=function(_0x492e4a,_0x8f8001){return db[_0x96ab('0x2b')][_0x96ab('0x44')]({'where':{'id':_0x492e4a[_0x96ab('0x41')]['id']}})[_0x96ab('0x25')](handleEntityNotFound(_0x8f8001,null))[_0x96ab('0x25')](removeEntity(_0x8f8001,null))[_0x96ab('0x47')](handleError(_0x8f8001,null));};exports['describe']=function(_0x3fe014,_0x3eb5ed){return db['WhatsappQueueReport'][_0x96ab('0x4a')]()[_0x96ab('0x25')](respondWithResult(_0x3eb5ed,null))['catch'](handleError(_0x3eb5ed,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index 9b738ea..2c04002 100644 --- a/server/api/whatsappQueueReport/whatsappQueueReport.model.js +++ b/server/api/whatsappQueueReport/whatsappQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x75ef=['uniqueid','util','api','bluebird','request-promise','path','rimraf','./whatsappQueueReport.attributes','define','report_whatsapp_queue'];(function(_0x4994c8,_0x32fa56){var _0x382859=function(_0x4887b9){while(--_0x4887b9){_0x4994c8['push'](_0x4994c8['shift']());}};_0x382859(++_0x32fa56);}(_0x75ef,0xbf));var _0xf75e=function(_0x5eacb7,_0x1e4558){_0x5eacb7=_0x5eacb7-0x0;var _0x1576c6=_0x75ef[_0x5eacb7];return _0x1576c6;};'use strict';var _=require('lodash');var util=require(_0xf75e('0x0'));var logger=require('../../config/logger')(_0xf75e('0x1'));var moment=require('moment');var BPromise=require(_0xf75e('0x2'));var rp=require(_0xf75e('0x3'));var fs=require('fs');var path=require(_0xf75e('0x4'));var rimraf=require(_0xf75e('0x5'));var config=require('../../config/environment');var attributes=require(_0xf75e('0x6'));module['exports']=function(_0x5da844,_0x17277e){return _0x5da844[_0xf75e('0x7')]('WhatsappQueueReport',attributes,{'tableName':_0xf75e('0x8'),'paranoid':![],'indexes':[{'name':_0xf75e('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x1c39=['api','moment','bluebird','request-promise','rimraf','../../config/environment','define','WhatsappQueueReport','report_whatsapp_queue','uniqueid','lodash','util','../../config/logger'];(function(_0x15a2c0,_0xe9319c){var _0x3c07ae=function(_0x333afb){while(--_0x333afb){_0x15a2c0['push'](_0x15a2c0['shift']());}};_0x3c07ae(++_0xe9319c);}(_0x1c39,0xf4));var _0x91c3=function(_0x5ef8f7,_0xcefb41){_0x5ef8f7=_0x5ef8f7-0x0;var _0x8616ef=_0x1c39[_0x5ef8f7];return _0x8616ef;};'use strict';var _=require(_0x91c3('0x0'));var util=require(_0x91c3('0x1'));var logger=require(_0x91c3('0x2'))(_0x91c3('0x3'));var moment=require(_0x91c3('0x4'));var BPromise=require(_0x91c3('0x5'));var rp=require(_0x91c3('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x91c3('0x7'));var config=require(_0x91c3('0x8'));var attributes=require('./whatsappQueueReport.attributes');module['exports']=function(_0x5e4ae2,_0x398e1a){return _0x5e4ae2[_0x91c3('0x9')](_0x91c3('0xa'),attributes,{'tableName':_0x91c3('0xb'),'paranoid':![],'indexes':[{'name':_0x91c3('0xc'),'fields':[_0x91c3('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index 2c8fa6b..60ab3bc 100644 --- a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js +++ b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x208c=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','WhatsappQueueReport,\x20%s,\x20%s','message','result','catch','WhatsappQueueReport','create','body','options','raw','CreateWhatsappQueueReport','UpdateWhatsappQueueReport','update','limit','lodash'];(function(_0x24a5c8,_0x5a2f2f){var _0x475e86=function(_0x180311){while(--_0x180311){_0x24a5c8['push'](_0x24a5c8['shift']());}};_0x475e86(++_0x5a2f2f);}(_0x208c,0x16a));var _0xc208=function(_0x40d4ca,_0x19d421){_0x40d4ca=_0x40d4ca-0x0;var _0x5ea824=_0x208c[_0x40d4ca];return _0x5ea824;};'use strict';var _=require(_0xc208('0x0'));var util=require('util');var moment=require(_0xc208('0x1'));var BPromise=require(_0xc208('0x2'));var rs=require(_0xc208('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc208('0x4'))['db'];var utils=require(_0xc208('0x5'));var logger=require('../../config/logger')(_0xc208('0x6'));var config=require(_0xc208('0x7'));var jayson=require(_0xc208('0x8'));var client=jayson[_0xc208('0x9')][_0xc208('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4cefe6,_0x33383e,_0x473701){return new BPromise(function(_0x4be98a,_0x949b54){return client[_0xc208('0xb')](_0x4cefe6,_0x473701)[_0xc208('0xc')](function(_0x34002a){logger[_0xc208('0xd')]('WhatsappQueueReport,\x20%s,\x20%s',_0x33383e,'request\x20sent');logger[_0xc208('0xe')](_0xc208('0xf'),_0x33383e,_0xc208('0x10'),JSON[_0xc208('0x11')](_0x34002a));if(_0x34002a['error']){if(_0x34002a[_0xc208('0x12')][_0xc208('0x13')]===0x1f4){logger['error'](_0xc208('0x14'),_0x33383e,_0x34002a[_0xc208('0x12')][_0xc208('0x15')]);return _0x949b54(_0x34002a[_0xc208('0x12')][_0xc208('0x15')]);}logger[_0xc208('0x12')](_0xc208('0x14'),_0x33383e,_0x34002a[_0xc208('0x12')][_0xc208('0x15')]);return _0x4be98a(_0x34002a[_0xc208('0x12')]['message']);}else{logger[_0xc208('0xd')](_0xc208('0x14'),_0x33383e,_0xc208('0x10'));_0x4be98a(_0x34002a[_0xc208('0x16')]['message']);}})[_0xc208('0x17')](function(_0x44b67b){logger['error'](_0xc208('0x14'),_0x33383e,_0x44b67b);_0x949b54(_0x44b67b);});});}exports['CreateWhatsappQueueReport']=function(_0x284f4c){var _0x447b6e=this;return new Promise(function(_0x8a224f,_0x23a3b9){return db[_0xc208('0x18')][_0xc208('0x19')](_0x284f4c[_0xc208('0x1a')],{'raw':_0x284f4c['options']?_0x284f4c[_0xc208('0x1b')][_0xc208('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x460634){logger[_0xc208('0xd')]('CreateWhatsappQueueReport',_0x284f4c);logger['debug'](_0xc208('0x1d'),_0x284f4c,JSON[_0xc208('0x11')](_0x460634));_0x8a224f(_0x460634);})[_0xc208('0x17')](function(_0x47cd89){logger['error'](_0xc208('0x1d'),_0x47cd89['message'],_0x284f4c);_0x23a3b9(_0x447b6e['error'](0x1f4,_0x47cd89[_0xc208('0x15')]));});});};exports[_0xc208('0x1e')]=function(_0x48ec12){var _0x52fe01=this;return new Promise(function(_0x39fb93,_0x33d55d){return db['WhatsappQueueReport'][_0xc208('0x1f')](_0x48ec12[_0xc208('0x1a')],{'raw':_0x48ec12[_0xc208('0x1b')]?_0x48ec12[_0xc208('0x1b')][_0xc208('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x48ec12[_0xc208('0x1b')]?_0x48ec12[_0xc208('0x1b')]['where']||null:null,'attributes':_0x48ec12['options']?_0x48ec12['options']['attributes']||null:null,'limit':_0x48ec12[_0xc208('0x1b')]?_0x48ec12[_0xc208('0x1b')][_0xc208('0x20')]||null:null})[_0xc208('0xc')](function(_0x4b3666){logger[_0xc208('0xd')]('UpdateWhatsappQueueReport',_0x48ec12);logger['debug'](_0xc208('0x1e'),_0x48ec12,JSON['stringify'](_0x4b3666));_0x39fb93(_0x4b3666);})[_0xc208('0x17')](function(_0x299c4b){logger['error'](_0xc208('0x1e'),_0x299c4b[_0xc208('0x15')],_0x48ec12);_0x33d55d(_0x52fe01[_0xc208('0x12')](0x1f4,_0x299c4b[_0xc208('0x15')]));});});}; \ No newline at end of file +var _0xd025=['body','raw','where','attributes','limit','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','then','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','CreateWhatsappQueueReport','WhatsappQueueReport','create','options','UpdateWhatsappQueueReport','update'];(function(_0x2642cb,_0x4b917f){var _0xe6e41=function(_0x281676){while(--_0x281676){_0x2642cb['push'](_0x2642cb['shift']());}};_0xe6e41(++_0x4b917f);}(_0xd025,0xfd));var _0x5d02=function(_0x52b0ca,_0x52d716){_0x52b0ca=_0x52b0ca-0x0;var _0x23bbe4=_0xd025[_0x52b0ca];return _0x23bbe4;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x5d02('0x0'));var BPromise=require('bluebird');var rs=require(_0x5d02('0x1'));var fs=require('fs');var Redis=require(_0x5d02('0x2'));var db=require(_0x5d02('0x3'))['db'];var utils=require(_0x5d02('0x4'));var logger=require(_0x5d02('0x5'))(_0x5d02('0x6'));var config=require('../../config/environment');var jayson=require(_0x5d02('0x7'));var client=jayson['client'][_0x5d02('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4550dc,_0xd3df95,_0x1316d1){return new BPromise(function(_0x3a23e5,_0x3f6834){return client['request'](_0x4550dc,_0x1316d1)[_0x5d02('0x9')](function(_0x280470){logger['info'](_0x5d02('0xa'),_0xd3df95,_0x5d02('0xb'));logger[_0x5d02('0xc')]('WhatsappQueueReport,\x20%s,\x20%s,\x20%s',_0xd3df95,'request\x20sent',JSON[_0x5d02('0xd')](_0x280470));if(_0x280470['error']){if(_0x280470[_0x5d02('0xe')][_0x5d02('0xf')]===0x1f4){logger['error'](_0x5d02('0xa'),_0xd3df95,_0x280470[_0x5d02('0xe')]['message']);return _0x3f6834(_0x280470[_0x5d02('0xe')][_0x5d02('0x10')]);}logger[_0x5d02('0xe')](_0x5d02('0xa'),_0xd3df95,_0x280470['error'][_0x5d02('0x10')]);return _0x3a23e5(_0x280470[_0x5d02('0xe')][_0x5d02('0x10')]);}else{logger[_0x5d02('0x11')](_0x5d02('0xa'),_0xd3df95,_0x5d02('0xb'));_0x3a23e5(_0x280470[_0x5d02('0x12')]['message']);}})[_0x5d02('0x13')](function(_0x145a33){logger['error']('WhatsappQueueReport,\x20%s,\x20%s',_0xd3df95,_0x145a33);_0x3f6834(_0x145a33);});});}exports[_0x5d02('0x14')]=function(_0x5aa45c){var _0x29c185=this;return new Promise(function(_0x47c39d,_0x36f2fe){return db[_0x5d02('0x15')][_0x5d02('0x16')](_0x5aa45c['body'],{'raw':_0x5aa45c[_0x5d02('0x17')]?_0x5aa45c[_0x5d02('0x17')]['raw']===undefined?!![]:![]:!![]})[_0x5d02('0x9')](function(_0x1ed554){logger[_0x5d02('0x11')]('CreateWhatsappQueueReport',_0x5aa45c);logger[_0x5d02('0xc')](_0x5d02('0x14'),_0x5aa45c,JSON['stringify'](_0x1ed554));_0x47c39d(_0x1ed554);})['catch'](function(_0x245a3f){logger[_0x5d02('0xe')](_0x5d02('0x14'),_0x245a3f[_0x5d02('0x10')],_0x5aa45c);_0x36f2fe(_0x29c185['error'](0x1f4,_0x245a3f[_0x5d02('0x10')]));});});};exports[_0x5d02('0x18')]=function(_0x3ecb3b){var _0x514e49=this;return new Promise(function(_0x5878cc,_0xff61ad){return db[_0x5d02('0x15')][_0x5d02('0x19')](_0x3ecb3b[_0x5d02('0x1a')],{'raw':_0x3ecb3b['options']?_0x3ecb3b[_0x5d02('0x17')][_0x5d02('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3ecb3b[_0x5d02('0x17')]?_0x3ecb3b[_0x5d02('0x17')][_0x5d02('0x1c')]||null:null,'attributes':_0x3ecb3b[_0x5d02('0x17')]?_0x3ecb3b[_0x5d02('0x17')][_0x5d02('0x1d')]||null:null,'limit':_0x3ecb3b[_0x5d02('0x17')]?_0x3ecb3b[_0x5d02('0x17')][_0x5d02('0x1e')]||null:null})[_0x5d02('0x9')](function(_0x3822f7){logger['info'](_0x5d02('0x18'),_0x3ecb3b);logger[_0x5d02('0xc')](_0x5d02('0x18'),_0x3ecb3b,JSON['stringify'](_0x3822f7));_0x5878cc(_0x3822f7);})[_0x5d02('0x13')](function(_0x5a9d3c){logger[_0x5d02('0xe')](_0x5d02('0x18'),_0x5a9d3c[_0x5d02('0x10')],_0x3ecb3b);_0xff61ad(_0x514e49[_0x5d02('0xe')](0x1f4,_0x5a9d3c[_0x5d02('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 30a5caa..359fad0 100644 --- a/server/api/whatsappTransferReport/index.js +++ b/server/api/whatsappTransferReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x16c8=['post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','get','isAuthenticated','index','describe','/:id','show'];(function(_0x104da6,_0x395486){var _0x218923=function(_0x5984af){while(--_0x5984af){_0x104da6['push'](_0x104da6['shift']());}};_0x218923(++_0x395486);}(_0x16c8,0x1eb));var _0x816c=function(_0x2a5a60,_0x4c5793){_0x2a5a60=_0x2a5a60-0x0;var _0x12b247=_0x16c8[_0x2a5a60];return _0x12b247;};'use strict';var multer=require('multer');var util=require(_0x816c('0x0'));var path=require(_0x816c('0x1'));var timeout=require(_0x816c('0x2'));var express=require(_0x816c('0x3'));var router=express[_0x816c('0x4')]();var auth=require(_0x816c('0x5'));var interaction=require(_0x816c('0x6'));var config=require(_0x816c('0x7'));var controller=require(_0x816c('0x8'));router[_0x816c('0x9')]('/',auth[_0x816c('0xa')](),controller[_0x816c('0xb')]);router[_0x816c('0x9')]('/describe',auth[_0x816c('0xa')](),controller[_0x816c('0xc')]);router[_0x816c('0x9')](_0x816c('0xd'),auth[_0x816c('0xa')](),controller[_0x816c('0xe')]);router[_0x816c('0xf')]('/',auth[_0x816c('0xa')](),controller[_0x816c('0x10')]);router[_0x816c('0x11')]('/:id',auth[_0x816c('0xa')](),controller[_0x816c('0x12')]);router[_0x816c('0x13')](_0x816c('0xd'),auth['isAuthenticated'](),controller[_0x816c('0x14')]);module[_0x816c('0x15')]=router; \ No newline at end of file +var _0x9aae=['multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','get','isAuthenticated','/describe','show','post','put','/:id','update','delete','destroy','exports'];(function(_0x4f443c,_0x2ef17e){var _0x19fb96=function(_0x405326){while(--_0x405326){_0x4f443c['push'](_0x4f443c['shift']());}};_0x19fb96(++_0x2ef17e);}(_0x9aae,0xc8));var _0xe9aa=function(_0x20fc1a,_0x5c42b8){_0x20fc1a=_0x20fc1a-0x0;var _0x547c7f=_0x9aae[_0x20fc1a];return _0x547c7f;};'use strict';var multer=require(_0xe9aa('0x0'));var util=require(_0xe9aa('0x1'));var path=require(_0xe9aa('0x2'));var timeout=require('connect-timeout');var express=require(_0xe9aa('0x3'));var router=express[_0xe9aa('0x4')]();var auth=require(_0xe9aa('0x5'));var interaction=require(_0xe9aa('0x6'));var config=require(_0xe9aa('0x7'));var controller=require(_0xe9aa('0x8'));router[_0xe9aa('0x9')]('/',auth[_0xe9aa('0xa')](),controller['index']);router[_0xe9aa('0x9')](_0xe9aa('0xb'),auth[_0xe9aa('0xa')](),controller['describe']);router['get']('/:id',auth[_0xe9aa('0xa')](),controller[_0xe9aa('0xc')]);router[_0xe9aa('0xd')]('/',auth[_0xe9aa('0xa')](),controller['create']);router[_0xe9aa('0xe')](_0xe9aa('0xf'),auth[_0xe9aa('0xa')](),controller[_0xe9aa('0x10')]);router[_0xe9aa('0x11')](_0xe9aa('0xf'),auth[_0xe9aa('0xa')](),controller[_0xe9aa('0x12')]);module[_0xe9aa('0x13')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index 2b40fc5..1954ba0 100644 --- a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js +++ b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb7e7=['queue','sequelize','STRING','account'];(function(_0x559d27,_0x342015){var _0x215210=function(_0x536223){while(--_0x536223){_0x559d27['push'](_0x559d27['shift']());}};_0x215210(++_0x342015);}(_0xb7e7,0x121));var _0x7b7e=function(_0x174ef5,_0x256e8e){_0x174ef5=_0x174ef5-0x0;var _0x1cc379=_0xb7e7[_0x174ef5];return _0x1cc379;};'use strict';var Sequelize=require(_0x7b7e('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x7b7e('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x7b7e('0x2'),'agent',_0x7b7e('0x3')),'allowNull':![]},'transferredAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0x5f66=['queue','DATE','exports','ENUM','account','agent'];(function(_0x34bf97,_0xc60f9d){var _0x292719=function(_0x31354e){while(--_0x31354e){_0x34bf97['push'](_0x34bf97['shift']());}};_0x292719(++_0xc60f9d);}(_0x5f66,0x1a0));var _0x65f6=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0x5f66[_0x4243a3];return _0x1b2a33;};'use strict';var Sequelize=require('sequelize');module[_0x65f6('0x0')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x65f6('0x1')](_0x65f6('0x2'),_0x65f6('0x3'),_0x65f6('0x4')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x65f6('0x5')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index 4c6ca00..330e2d9 100644 --- a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js +++ b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3f26=['index','WhatsappTransferReport','rawAttributes','map','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','limit','order','sort','where','pick','filters','filter','VIRTUAL','options','includeAll','include','rows','catch','show','params','merge','find','create','body','describe','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','ejs','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send'];(function(_0x5d61b4,_0x4f7b91){var _0x183fc5=function(_0x5ecf92){while(--_0x5ecf92){_0x5d61b4['push'](_0x5d61b4['shift']());}};_0x183fc5(++_0x4f7b91);}(_0x3f26,0xb0));var _0x63f2=function(_0x3884f7,_0x46d3a3){_0x3884f7=_0x3884f7-0x0;var _0x53c5fc=_0x3f26[_0x3884f7];return _0x53c5fc;};'use strict';var pdf=require(_0x63f2('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x63f2('0x1'));var zipdir=require(_0x63f2('0x2'));var jsonpatch=require(_0x63f2('0x3'));var rp=require(_0x63f2('0x4'));var moment=require(_0x63f2('0x5'));var BPromise=require(_0x63f2('0x6'));var Mustache=require('mustache');var util=require(_0x63f2('0x7'));var path=require('path');var sox=require(_0x63f2('0x8'));var csv=require('to-csv');var ejs=require(_0x63f2('0x9'));var fs=require('fs');var _=require(_0x63f2('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x63f2('0xb'));var deskjs=require(_0x63f2('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x63f2('0xd'));var Redis=require(_0x63f2('0xe'));var authService=require(_0x63f2('0xf'));var qs=require(_0x63f2('0x10'));var as=require(_0x63f2('0x11'));var hardwareService=require(_0x63f2('0x12'));var logger=require('../../config/logger')(_0x63f2('0x13'));var utils=require(_0x63f2('0x14'));var config=require(_0x63f2('0x15'));var db=require(_0x63f2('0x16'))['db'];function respondWithStatusCode(_0x27781,_0x191e7e){_0x191e7e=_0x191e7e||0xcc;return function(_0xb997b8){if(_0xb997b8){return _0x27781[_0x63f2('0x17')](_0x191e7e);}return _0x27781[_0x63f2('0x18')](_0x191e7e)[_0x63f2('0x19')]();};}function respondWithResult(_0x28f76e,_0x2ff76f){_0x2ff76f=_0x2ff76f||0xc8;return function(_0x1f5deb){if(_0x1f5deb){return _0x28f76e[_0x63f2('0x18')](_0x2ff76f)[_0x63f2('0x1a')](_0x1f5deb);}};}function respondWithFilteredResult(_0x557e94,_0x14e3a3){return function(_0x5c4c21){if(_0x5c4c21){var _0xd6812b=_0x5c4c21[_0x63f2('0x1b')],_0x122c49=_0x14e3a3[_0x63f2('0x1c')],_0x5b258c=_0x14e3a3['offset']+_0x14e3a3['limit'],_0x32779b;if(_0x5b258c>=_0xd6812b){_0x5b258c=_0xd6812b;_0x32779b=0xc8;}else{_0x32779b=0xce;}_0x557e94[_0x63f2('0x18')](_0x32779b);return _0x557e94[_0x63f2('0x1d')](_0x63f2('0x1e'),_0x122c49+'-'+_0x5b258c+'/'+_0xd6812b)['json'](_0x5c4c21);}return null;};}function patchUpdates(_0x5edf0f){return function(_0x54c065){try{jsonpatch[_0x63f2('0x1f')](_0x54c065,_0x5edf0f,!![]);}catch(_0x1db048){return BPromise[_0x63f2('0x20')](_0x1db048);}return _0x54c065[_0x63f2('0x21')]();};}function saveUpdates(_0x14e701,_0x36e293){return function(_0xe3628e){if(_0xe3628e){return _0xe3628e[_0x63f2('0x22')](_0x14e701)[_0x63f2('0x23')](function(_0x32ab84){return _0x32ab84;});}return null;};}function removeEntity(_0x57b450,_0x46235b){return function(_0x89c83){if(_0x89c83){return _0x89c83[_0x63f2('0x24')]()['then'](function(){_0x57b450[_0x63f2('0x18')](0xcc)[_0x63f2('0x19')]();});}};}function handleEntityNotFound(_0x28790f,_0x25ad69){return function(_0x2f4740){if(!_0x2f4740){_0x28790f[_0x63f2('0x17')](0x194);}return _0x2f4740;};}function handleError(_0x5115c4,_0x5704de){_0x5704de=_0x5704de||0x1f4;return function(_0x4138ec){logger[_0x63f2('0x25')](_0x4138ec['stack']);if(_0x4138ec[_0x63f2('0x26')]){delete _0x4138ec[_0x63f2('0x26')];}_0x5115c4[_0x63f2('0x18')](_0x5704de)[_0x63f2('0x27')](_0x4138ec);};}exports[_0x63f2('0x28')]=function(_0x10d92d,_0x28c479){var _0x3afc2a={},_0x5a8b5a={},_0x19d684={'count':0x0,'rows':[]};var _0x5a209e=_['map'](db[_0x63f2('0x29')][_0x63f2('0x2a')],function(_0x613266){return{'name':_0x613266['fieldName'],'type':_0x613266['type']['key']};});_0x5a8b5a['model']=_[_0x63f2('0x2b')](_0x5a209e,_0x63f2('0x26'));_0x5a8b5a[_0x63f2('0x2c')]=_[_0x63f2('0x2d')](_0x10d92d[_0x63f2('0x2c')]);_0x5a8b5a['filters']=_[_0x63f2('0x2e')](_0x5a8b5a[_0x63f2('0x2f')],_0x5a8b5a[_0x63f2('0x2c')]);_0x3afc2a['attributes']=_[_0x63f2('0x2e')](_0x5a8b5a[_0x63f2('0x2f')],qs['fields'](_0x10d92d[_0x63f2('0x2c')][_0x63f2('0x30')]));_0x3afc2a['attributes']=_0x3afc2a[_0x63f2('0x31')][_0x63f2('0x32')]?_0x3afc2a[_0x63f2('0x31')]:_0x5a8b5a[_0x63f2('0x2f')];if(!_0x10d92d['query'][_0x63f2('0x33')]('nolimit')){_0x3afc2a[_0x63f2('0x34')]=qs[_0x63f2('0x34')](_0x10d92d['query']['limit']);_0x3afc2a[_0x63f2('0x1c')]=qs['offset'](_0x10d92d['query'][_0x63f2('0x1c')]);}_0x3afc2a[_0x63f2('0x35')]=qs['sort'](_0x10d92d[_0x63f2('0x2c')][_0x63f2('0x36')]);_0x3afc2a[_0x63f2('0x37')]=qs['filters'](_[_0x63f2('0x38')](_0x10d92d[_0x63f2('0x2c')],_0x5a8b5a[_0x63f2('0x39')]),_0x5a209e);if(_0x10d92d['query'][_0x63f2('0x3a')]){_0x3afc2a[_0x63f2('0x37')]=_['merge'](_0x3afc2a[_0x63f2('0x37')],{'$or':_[_0x63f2('0x2b')](_0x5a209e,function(_0x1c762e){if(_0x1c762e['type']!==_0x63f2('0x3b')){var _0x30b7fa={};_0x30b7fa[_0x1c762e['name']]={'$like':'%'+_0x10d92d[_0x63f2('0x2c')]['filter']+'%'};return _0x30b7fa;}})});}_0x3afc2a=_['merge']({},_0x3afc2a,_0x10d92d[_0x63f2('0x3c')]);var _0x35794e={'where':_0x3afc2a[_0x63f2('0x37')]};return db[_0x63f2('0x29')][_0x63f2('0x1b')](_0x35794e)['then'](function(_0x1378ec){_0x19d684[_0x63f2('0x1b')]=_0x1378ec;if(_0x10d92d[_0x63f2('0x2c')][_0x63f2('0x3d')]){_0x3afc2a[_0x63f2('0x3e')]=[{'all':!![]}];}return db[_0x63f2('0x29')]['findAll'](_0x3afc2a);})[_0x63f2('0x23')](function(_0x3f9fc){_0x19d684[_0x63f2('0x3f')]=_0x3f9fc;return _0x19d684;})[_0x63f2('0x23')](respondWithFilteredResult(_0x28c479,_0x3afc2a))[_0x63f2('0x40')](handleError(_0x28c479,null));};exports[_0x63f2('0x41')]=function(_0x320ccb,_0x20432f){var _0xc1c6cc={'raw':!![],'where':{'id':_0x320ccb[_0x63f2('0x42')]['id']}},_0x49e6b0={};_0x49e6b0[_0x63f2('0x2f')]=_['keys'](db[_0x63f2('0x29')][_0x63f2('0x2a')]);_0x49e6b0[_0x63f2('0x2c')]=_[_0x63f2('0x2d')](_0x320ccb[_0x63f2('0x2c')]);_0x49e6b0[_0x63f2('0x39')]=_[_0x63f2('0x2e')](_0x49e6b0[_0x63f2('0x2f')],_0x49e6b0[_0x63f2('0x2c')]);_0xc1c6cc[_0x63f2('0x31')]=_[_0x63f2('0x2e')](_0x49e6b0[_0x63f2('0x2f')],qs[_0x63f2('0x30')](_0x320ccb[_0x63f2('0x2c')][_0x63f2('0x30')]));_0xc1c6cc[_0x63f2('0x31')]=_0xc1c6cc['attributes'][_0x63f2('0x32')]?_0xc1c6cc[_0x63f2('0x31')]:_0x49e6b0[_0x63f2('0x2f')];if(_0x320ccb[_0x63f2('0x2c')]['includeAll']){_0xc1c6cc[_0x63f2('0x3e')]=[{'all':!![]}];}_0xc1c6cc=_[_0x63f2('0x43')]({},_0xc1c6cc,_0x320ccb[_0x63f2('0x3c')]);return db[_0x63f2('0x29')][_0x63f2('0x44')](_0xc1c6cc)[_0x63f2('0x23')](handleEntityNotFound(_0x20432f,null))[_0x63f2('0x23')](respondWithResult(_0x20432f,null))[_0x63f2('0x40')](handleError(_0x20432f,null));};exports['create']=function(_0xe4263,_0x3b7cbd){return db[_0x63f2('0x29')][_0x63f2('0x45')](_0xe4263[_0x63f2('0x46')],{})[_0x63f2('0x23')](respondWithResult(_0x3b7cbd,0xc9))[_0x63f2('0x40')](handleError(_0x3b7cbd,null));};exports[_0x63f2('0x22')]=function(_0xf4839e,_0x56857c){if(_0xf4839e['body']['id']){delete _0xf4839e['body']['id'];}return db['WhatsappTransferReport']['find']({'where':{'id':_0xf4839e[_0x63f2('0x42')]['id']}})[_0x63f2('0x23')](handleEntityNotFound(_0x56857c,null))[_0x63f2('0x23')](saveUpdates(_0xf4839e[_0x63f2('0x46')],null))[_0x63f2('0x23')](respondWithResult(_0x56857c,null))[_0x63f2('0x40')](handleError(_0x56857c,null));};exports['destroy']=function(_0x344eb6,_0x516278){return db[_0x63f2('0x29')][_0x63f2('0x44')]({'where':{'id':_0x344eb6[_0x63f2('0x42')]['id']}})['then'](handleEntityNotFound(_0x516278,null))[_0x63f2('0x23')](removeEntity(_0x516278,null))[_0x63f2('0x40')](handleError(_0x516278,null));};exports[_0x63f2('0x47')]=function(_0x1e4775,_0x214439){return db[_0x63f2('0x29')][_0x63f2('0x47')]()['then'](respondWithResult(_0x214439,null))['catch'](handleError(_0x214439,null));}; \ No newline at end of file +var _0xdea0=['ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','then','destroy','stack','name','map','WhatsappTransferReport','rawAttributes','type','key','model','query','keys','filters','attributes','fields','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','intersection','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv'];(function(_0x290839,_0x26eef9){var _0x1f94d9=function(_0xa3ec8c){while(--_0xa3ec8c){_0x290839['push'](_0x290839['shift']());}};_0x1f94d9(++_0x26eef9);}(_0xdea0,0x1f3));var _0x0dea=function(_0x661d60,_0x177ccd){_0x661d60=_0x661d60-0x0;var _0x4ab8c8=_0xdea0[_0x661d60];return _0x4ab8c8;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x0dea('0x0'));var rimraf=require(_0x0dea('0x1'));var zipdir=require(_0x0dea('0x2'));var jsonpatch=require(_0x0dea('0x3'));var rp=require(_0x0dea('0x4'));var moment=require(_0x0dea('0x5'));var BPromise=require(_0x0dea('0x6'));var Mustache=require(_0x0dea('0x7'));var util=require(_0x0dea('0x8'));var path=require(_0x0dea('0x9'));var sox=require(_0x0dea('0xa'));var csv=require(_0x0dea('0xb'));var ejs=require(_0x0dea('0xc'));var fs=require('fs');var _=require(_0x0dea('0xd'));var squel=require(_0x0dea('0xe'));var crypto=require(_0x0dea('0xf'));var jsforce=require(_0x0dea('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x0dea('0xb'));var querystring=require(_0x0dea('0x11'));var Papa=require(_0x0dea('0x12'));var Redis=require(_0x0dea('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x0dea('0x14'));var hardwareService=require(_0x0dea('0x15'));var logger=require('../../config/logger')(_0x0dea('0x16'));var utils=require('../../config/utils');var config=require(_0x0dea('0x17'));var db=require(_0x0dea('0x18'))['db'];function respondWithStatusCode(_0x536216,_0xc00112){_0xc00112=_0xc00112||0xcc;return function(_0x4b4df0){if(_0x4b4df0){return _0x536216[_0x0dea('0x19')](_0xc00112);}return _0x536216[_0x0dea('0x1a')](_0xc00112)[_0x0dea('0x1b')]();};}function respondWithResult(_0x4077a4,_0x1a9735){_0x1a9735=_0x1a9735||0xc8;return function(_0x21753b){if(_0x21753b){return _0x4077a4[_0x0dea('0x1a')](_0x1a9735)[_0x0dea('0x1c')](_0x21753b);}};}function respondWithFilteredResult(_0x4472fb,_0x458c1c){return function(_0xbfd50c){if(_0xbfd50c){var _0xa82dba=_0xbfd50c[_0x0dea('0x1d')],_0x278e03=_0x458c1c['offset'],_0xffb7e4=_0x458c1c[_0x0dea('0x1e')]+_0x458c1c[_0x0dea('0x1f')],_0xbf508d;if(_0xffb7e4>=_0xa82dba){_0xffb7e4=_0xa82dba;_0xbf508d=0xc8;}else{_0xbf508d=0xce;}_0x4472fb[_0x0dea('0x1a')](_0xbf508d);return _0x4472fb[_0x0dea('0x20')]('Content-Range',_0x278e03+'-'+_0xffb7e4+'/'+_0xa82dba)[_0x0dea('0x1c')](_0xbfd50c);}return null;};}function patchUpdates(_0x98ad5){return function(_0x23bb1a){try{jsonpatch[_0x0dea('0x21')](_0x23bb1a,_0x98ad5,!![]);}catch(_0x44a4a2){return BPromise[_0x0dea('0x22')](_0x44a4a2);}return _0x23bb1a[_0x0dea('0x23')]();};}function saveUpdates(_0xeb2dca,_0x15c0ff){return function(_0x1f54e){if(_0x1f54e){return _0x1f54e[_0x0dea('0x24')](_0xeb2dca)[_0x0dea('0x25')](function(_0x3f8b5f){return _0x3f8b5f;});}return null;};}function removeEntity(_0x252b5c,_0x423f8d){return function(_0x9740ca){if(_0x9740ca){return _0x9740ca[_0x0dea('0x26')]()[_0x0dea('0x25')](function(){_0x252b5c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e025f,_0x3af02e){return function(_0xae8dd9){if(!_0xae8dd9){_0x5e025f[_0x0dea('0x19')](0x194);}return _0xae8dd9;};}function handleError(_0x299dc4,_0x5e7d7c){_0x5e7d7c=_0x5e7d7c||0x1f4;return function(_0x4d0824){logger['error'](_0x4d0824[_0x0dea('0x27')]);if(_0x4d0824[_0x0dea('0x28')]){delete _0x4d0824[_0x0dea('0x28')];}_0x299dc4[_0x0dea('0x1a')](_0x5e7d7c)['send'](_0x4d0824);};}exports['index']=function(_0x40dde3,_0x5f3e85){var _0x14a48d={},_0x437b8f={},_0x185e28={'count':0x0,'rows':[]};var _0x5b4f71=_[_0x0dea('0x29')](db[_0x0dea('0x2a')][_0x0dea('0x2b')],function(_0x51b056){return{'name':_0x51b056['fieldName'],'type':_0x51b056[_0x0dea('0x2c')][_0x0dea('0x2d')]};});_0x437b8f[_0x0dea('0x2e')]=_[_0x0dea('0x29')](_0x5b4f71,'name');_0x437b8f[_0x0dea('0x2f')]=_[_0x0dea('0x30')](_0x40dde3[_0x0dea('0x2f')]);_0x437b8f[_0x0dea('0x31')]=_['intersection'](_0x437b8f[_0x0dea('0x2e')],_0x437b8f[_0x0dea('0x2f')]);_0x14a48d[_0x0dea('0x32')]=_['intersection'](_0x437b8f[_0x0dea('0x2e')],qs[_0x0dea('0x33')](_0x40dde3[_0x0dea('0x2f')][_0x0dea('0x33')]));_0x14a48d[_0x0dea('0x32')]=_0x14a48d[_0x0dea('0x32')]['length']?_0x14a48d[_0x0dea('0x32')]:_0x437b8f[_0x0dea('0x2e')];if(!_0x40dde3[_0x0dea('0x2f')][_0x0dea('0x34')](_0x0dea('0x35'))){_0x14a48d['limit']=qs[_0x0dea('0x1f')](_0x40dde3[_0x0dea('0x2f')][_0x0dea('0x1f')]);_0x14a48d['offset']=qs[_0x0dea('0x1e')](_0x40dde3[_0x0dea('0x2f')]['offset']);}_0x14a48d[_0x0dea('0x36')]=qs[_0x0dea('0x37')](_0x40dde3[_0x0dea('0x2f')]['sort']);_0x14a48d['where']=qs[_0x0dea('0x31')](_['pick'](_0x40dde3[_0x0dea('0x2f')],_0x437b8f[_0x0dea('0x31')]),_0x5b4f71);if(_0x40dde3['query'][_0x0dea('0x38')]){_0x14a48d[_0x0dea('0x39')]=_[_0x0dea('0x3a')](_0x14a48d['where'],{'$or':_[_0x0dea('0x29')](_0x5b4f71,function(_0x191101){if(_0x191101[_0x0dea('0x2c')]!==_0x0dea('0x3b')){var _0x304cd6={};_0x304cd6[_0x191101['name']]={'$like':'%'+_0x40dde3[_0x0dea('0x2f')]['filter']+'%'};return _0x304cd6;}})});}_0x14a48d=_[_0x0dea('0x3a')]({},_0x14a48d,_0x40dde3[_0x0dea('0x3c')]);var _0x34c257={'where':_0x14a48d[_0x0dea('0x39')]};return db[_0x0dea('0x2a')][_0x0dea('0x1d')](_0x34c257)[_0x0dea('0x25')](function(_0x2dada0){_0x185e28[_0x0dea('0x1d')]=_0x2dada0;if(_0x40dde3[_0x0dea('0x2f')][_0x0dea('0x3d')]){_0x14a48d[_0x0dea('0x3e')]=[{'all':!![]}];}return db[_0x0dea('0x2a')][_0x0dea('0x3f')](_0x14a48d);})[_0x0dea('0x25')](function(_0x380dae){_0x185e28[_0x0dea('0x40')]=_0x380dae;return _0x185e28;})['then'](respondWithFilteredResult(_0x5f3e85,_0x14a48d))[_0x0dea('0x41')](handleError(_0x5f3e85,null));};exports[_0x0dea('0x42')]=function(_0x44e111,_0xbdf8c7){var _0x22e550={'raw':!![],'where':{'id':_0x44e111[_0x0dea('0x43')]['id']}},_0x71577b={};_0x71577b['model']=_[_0x0dea('0x30')](db[_0x0dea('0x2a')][_0x0dea('0x2b')]);_0x71577b[_0x0dea('0x2f')]=_[_0x0dea('0x30')](_0x44e111['query']);_0x71577b[_0x0dea('0x31')]=_[_0x0dea('0x44')](_0x71577b['model'],_0x71577b[_0x0dea('0x2f')]);_0x22e550[_0x0dea('0x32')]=_[_0x0dea('0x44')](_0x71577b[_0x0dea('0x2e')],qs[_0x0dea('0x33')](_0x44e111[_0x0dea('0x2f')][_0x0dea('0x33')]));_0x22e550['attributes']=_0x22e550[_0x0dea('0x32')]['length']?_0x22e550['attributes']:_0x71577b['model'];if(_0x44e111[_0x0dea('0x2f')][_0x0dea('0x3d')]){_0x22e550['include']=[{'all':!![]}];}_0x22e550=_[_0x0dea('0x3a')]({},_0x22e550,_0x44e111[_0x0dea('0x3c')]);return db[_0x0dea('0x2a')][_0x0dea('0x45')](_0x22e550)['then'](handleEntityNotFound(_0xbdf8c7,null))['then'](respondWithResult(_0xbdf8c7,null))[_0x0dea('0x41')](handleError(_0xbdf8c7,null));};exports[_0x0dea('0x46')]=function(_0x5641f5,_0x2eca12){return db[_0x0dea('0x2a')]['create'](_0x5641f5[_0x0dea('0x47')],{})['then'](respondWithResult(_0x2eca12,0xc9))['catch'](handleError(_0x2eca12,null));};exports['update']=function(_0x3713af,_0x16d1ee){if(_0x3713af['body']['id']){delete _0x3713af[_0x0dea('0x47')]['id'];}return db['WhatsappTransferReport']['find']({'where':{'id':_0x3713af[_0x0dea('0x43')]['id']}})[_0x0dea('0x25')](handleEntityNotFound(_0x16d1ee,null))['then'](saveUpdates(_0x3713af[_0x0dea('0x47')],null))['then'](respondWithResult(_0x16d1ee,null))[_0x0dea('0x41')](handleError(_0x16d1ee,null));};exports[_0x0dea('0x26')]=function(_0x27c2a2,_0x598206){return db[_0x0dea('0x2a')][_0x0dea('0x45')]({'where':{'id':_0x27c2a2['params']['id']}})[_0x0dea('0x25')](handleEntityNotFound(_0x598206,null))[_0x0dea('0x25')](removeEntity(_0x598206,null))[_0x0dea('0x41')](handleError(_0x598206,null));};exports[_0x0dea('0x48')]=function(_0x4620cd,_0x3d2142){return db[_0x0dea('0x2a')][_0x0dea('0x48')]()['then'](respondWithResult(_0x3d2142,null))[_0x0dea('0x41')](handleError(_0x3d2142,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index 00e6deb..df13120 100644 --- a/server/api/whatsappTransferReport/whatsappTransferReport.model.js +++ b/server/api/whatsappTransferReport/whatsappTransferReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc33e=['rimraf','../../config/environment','./whatsappTransferReport.attributes','define','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','lodash','util','api','bluebird','request-promise','path'];(function(_0x4c0a9a,_0x945975){var _0x230777=function(_0xe3be5b){while(--_0xe3be5b){_0x4c0a9a['push'](_0x4c0a9a['shift']());}};_0x230777(++_0x945975);}(_0xc33e,0x18d));var _0xec33=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xc33e[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xec33('0x0'));var util=require(_0xec33('0x1'));var logger=require('../../config/logger')(_0xec33('0x2'));var moment=require('moment');var BPromise=require(_0xec33('0x3'));var rp=require(_0xec33('0x4'));var fs=require('fs');var path=require(_0xec33('0x5'));var rimraf=require(_0xec33('0x6'));var config=require(_0xec33('0x7'));var attributes=require(_0xec33('0x8'));module['exports']=function(_0x2ee5ce,_0x31c902){return _0x2ee5ce[_0xec33('0x9')](_0xec33('0xa'),attributes,{'tableName':_0xec33('0xb'),'paranoid':![],'indexes':[{'name':_0xec33('0xc'),'fields':[_0xec33('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9014=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappTransferReport.attributes','exports','define','WhatsappTransferReport','uniqueid','lodash','util'];(function(_0x5311a1,_0x304912){var _0x2acb9f=function(_0x4803e7){while(--_0x4803e7){_0x5311a1['push'](_0x5311a1['shift']());}};_0x2acb9f(++_0x304912);}(_0x9014,0xee));var _0x4901=function(_0x341a02,_0x316552){_0x341a02=_0x341a02-0x0;var _0x45b918=_0x9014[_0x341a02];return _0x45b918;};'use strict';var _=require(_0x4901('0x0'));var util=require(_0x4901('0x1'));var logger=require(_0x4901('0x2'))(_0x4901('0x3'));var moment=require(_0x4901('0x4'));var BPromise=require(_0x4901('0x5'));var rp=require(_0x4901('0x6'));var fs=require('fs');var path=require(_0x4901('0x7'));var rimraf=require(_0x4901('0x8'));var config=require(_0x4901('0x9'));var attributes=require(_0x4901('0xa'));module[_0x4901('0xb')]=function(_0x44fa67,_0x15a5b8){return _0x44fa67[_0x4901('0xc')](_0x4901('0xd'),attributes,{'tableName':'report_whatsapp_transfer','paranoid':![],'indexes':[{'name':_0x4901('0xe'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index ee715da..efe8587 100644 --- a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js +++ b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['http','info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x165a20,_0x5570c5){var _0x188b15=function(_0x1e4a54){while(--_0x1e4a54){_0x165a20['push'](_0x165a20['shift']());}};_0x188b15(++_0x5570c5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0xa9e0[_0x138f59];return _0x3d114d;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file +var _0xa9e0=['http','info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x505f3e,_0xd2e2e){var _0x427de7=function(_0x2266cf){while(--_0x2266cf){_0x505f3e['push'](_0x505f3e['shift']());}};_0x427de7(++_0xd2e2e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b828b,_0x344400){_0x1b828b=_0x1b828b-0x0;var _0x98da1a=_0xa9e0[_0x1b828b];return _0x98da1a;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index 5c38080..d727243 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x12e8=['./config/pm2/config','./config/schedule/chat','sequelize','then','listen','info','start','Online\x20apps:','map','online','name','join','Offline\x20apps:','status','seedDB','./config/seedDB','default','./config/license','catch','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./rpc','./config/environment','./config/pm2'];(function(_0x1c510a,_0x1413a9){var _0x23cedd=function(_0x3f3e43){while(--_0x3f3e43){_0x1c510a['push'](_0x1c510a['shift']());}};_0x23cedd(++_0x1413a9);}(_0x12e8,0x168));var _0x812e=function(_0x149fd5,_0xdb2b83){_0x149fd5=_0x149fd5-0x0;var _0x17bd0c=_0x12e8[_0x149fd5];return _0x17bd0c;};'use strict';var _=require(_0x812e('0x0'));var mysqldb=require('./mysqldb');var rpc=require(_0x812e('0x1'));var config=require(_0x812e('0x2'));var logger=require('./config/logger')('app');var pm2=require(_0x812e('0x3'));var pm2Config=require(_0x812e('0x4'));var schedule=require('./config/schedule');var chat=require(_0x812e('0x5'));function main(){return mysqldb['db'][_0x812e('0x6')]['sync']()[_0x812e('0x7')](function(){return rpc[_0x812e('0x8')]();})[_0x812e('0x7')](function(_0x23dbf3){logger[_0x812e('0x9')](_0x23dbf3);return chat['start']();})[_0x812e('0x7')](function(){return schedule[_0x812e('0xa')]();})[_0x812e('0x7')](function(_0x4a8506){logger[_0x812e('0x9')](_0x4a8506);return pm2[_0x812e('0xa')](pm2Config);})[_0x812e('0x7')](function(_0x2fa125){logger[_0x812e('0x9')](_0x812e('0xb'),_[_0x812e('0xc')](_['filter'](_0x2fa125,{'status':_0x812e('0xd')}),_0x812e('0xe'))[_0x812e('0xf')]());logger[_0x812e('0x9')](_0x812e('0x10'),_[_0x812e('0xc')](_['filter'](_0x2fa125,function(_0x463b2a){return _0x463b2a[_0x812e('0x11')]!==_0x812e('0xd');}),_0x812e('0xe'))[_0x812e('0xf')]()||'None');config[_0x812e('0x12')]&&require(_0x812e('0x13'))[_0x812e('0x14')]();require(_0x812e('0x15'))['default']();})[_0x812e('0x16')](function(_0x544b0){logger[_0x812e('0x17')](_0x812e('0x18'),_0x544b0);process[_0x812e('0x19')](0x1);});}main(); \ No newline at end of file +var _0x30d2=['./config/license','catch','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','./rpc','./config/environment','./config/logger','./config/pm2/config','./config/schedule','./config/schedule/chat','sequelize','sync','listen','start','then','info','Online\x20apps:','map','filter','online','name','join','Offline\x20apps:','status','seedDB','default'];(function(_0x48a8e3,_0x1caa0e){var _0x446013=function(_0x390758){while(--_0x390758){_0x48a8e3['push'](_0x48a8e3['shift']());}};_0x446013(++_0x1caa0e);}(_0x30d2,0x1eb));var _0x230d=function(_0x57fca6,_0x497213){_0x57fca6=_0x57fca6-0x0;var _0x1f2800=_0x30d2[_0x57fca6];return _0x1f2800;};'use strict';var _=require('lodash');var mysqldb=require('./mysqldb');var rpc=require(_0x230d('0x0'));var config=require(_0x230d('0x1'));var logger=require(_0x230d('0x2'))('app');var pm2=require('./config/pm2');var pm2Config=require(_0x230d('0x3'));var schedule=require(_0x230d('0x4'));var chat=require(_0x230d('0x5'));function main(){return mysqldb['db'][_0x230d('0x6')][_0x230d('0x7')]()['then'](function(){return rpc[_0x230d('0x8')]();})['then'](function(_0x338f80){logger['info'](_0x338f80);return chat[_0x230d('0x9')]();})[_0x230d('0xa')](function(){return schedule[_0x230d('0x9')]();})[_0x230d('0xa')](function(_0xf58d9d){logger[_0x230d('0xb')](_0xf58d9d);return pm2[_0x230d('0x9')](pm2Config);})[_0x230d('0xa')](function(_0x81f261){logger['info'](_0x230d('0xc'),_[_0x230d('0xd')](_[_0x230d('0xe')](_0x81f261,{'status':_0x230d('0xf')}),_0x230d('0x10'))[_0x230d('0x11')]());logger[_0x230d('0xb')](_0x230d('0x12'),_[_0x230d('0xd')](_[_0x230d('0xe')](_0x81f261,function(_0x3d5243){return _0x3d5243[_0x230d('0x13')]!=='online';}),_0x230d('0x10'))['join']()||'None');config[_0x230d('0x14')]&&require('./config/seedDB')[_0x230d('0x15')]();require(_0x230d('0x16'))['default']();})[_0x230d('0x17')](function(_0x114888){logger[_0x230d('0x18')](_0x230d('0x19'),_0x114888);process[_0x230d('0x1a')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index 806a66b..0a38878 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 _0xc2c7=['retrieveApiKey','isNil','apiKeyIat','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','promisify','secret','secrets','payload','options','verify','hex','now','toString','HS512','../../config/environment','../../config/license/hardware','lodash','jsonwebtoken','express-jwt','composable-middleware','basic-auth','crypto','session','role','fullname','userpic','permissions','md5secret','voicePause','chatPause','faxPause','smsPause','openchannelPause','pauseType','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','userProfileId','isChatInteractionAuthorized','use','user','ChatInteraction','findOne','params','closed','disposition','then','status','unmanaged','Forbidden.','catch','isAuthenticated','authorization','headers','Basic','find','name','authenticate','pass','Wrong\x20credentials.','startsWith','Bearer','Unknown\x20authorization\x20format','query','apikey','getUuid','User','isEqual','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','json','Invalid\x20API\x20access\x20key','User\x20object\x20not\x20found.','canUpdate','../../config/license/util','getLicense','Forbidden','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','/dashboards/general','send'];(function(_0x44f9f0,_0x565827){var _0x28e1ff=function(_0x528f54){while(--_0x528f54){_0x44f9f0['push'](_0x44f9f0['shift']());}};_0x28e1ff(++_0x565827);}(_0xc2c7,0x134));var _0x7c2c=function(_0x2f6f4d,_0x36f77d){_0x2f6f4d=_0x2f6f4d-0x0;var _0x585f1b=_0xc2c7[_0x2f6f4d];return _0x585f1b;};'use strict';var db=require('../../mysqldb')['db'];var config=require(_0x7c2c('0x0'));var hardwareConf=require(_0x7c2c('0x1'));var _=require(_0x7c2c('0x2'));var jwt=require(_0x7c2c('0x3'));var expressJwt=require(_0x7c2c('0x4'));var compose=require(_0x7c2c('0x5'));var basicAuth=require(_0x7c2c('0x6'));var crypto=require(_0x7c2c('0x7'));var BPromise=require('bluebird');var validateJwt=expressJwt({'secret':config['secrets'][_0x7c2c('0x8')]});var userAttributes=['id',_0x7c2c('0x9'),_0x7c2c('0xa'),'name','internal','email',_0x7c2c('0xb'),_0x7c2c('0xc'),_0x7c2c('0xd'),_0x7c2c('0xe'),_0x7c2c('0xf'),'mailPause',_0x7c2c('0x10'),_0x7c2c('0x11'),_0x7c2c('0x12'),_0x7c2c('0x13'),_0x7c2c('0x14'),_0x7c2c('0x15'),_0x7c2c('0x16'),_0x7c2c('0x17'),_0x7c2c('0x18'),_0x7c2c('0x19'),_0x7c2c('0x1a'),_0x7c2c('0x1b'),_0x7c2c('0x1c'),_0x7c2c('0x1d'),_0x7c2c('0x1e'),_0x7c2c('0x1f'),'phoneBarExpires','phoneBarPrefixRequired',_0x7c2c('0x20'),_0x7c2c('0x21'),_0x7c2c('0x22'),'interface',_0x7c2c('0x23')];exports[_0x7c2c('0x24')]=function(){return this['isAuthenticated'](!![])[_0x7c2c('0x25')](function(_0x5a5fe2,_0x1aa355,_0x51b73c){if(_0x5a5fe2[_0x7c2c('0x26')]){_0x51b73c();}else{return db[_0x7c2c('0x27')][_0x7c2c('0x28')]({'where':{'id':_0x5a5fe2[_0x7c2c('0x29')]['id']},'attributes':['id',_0x7c2c('0x2a'),_0x7c2c('0x2b')],'raw':!![]})[_0x7c2c('0x2c')](function(_0x1ce7e1){if(_0x1ce7e1&&_0x1ce7e1[_0x7c2c('0x2a')]){return _0x1aa355[_0x7c2c('0x2d')](_0x1ce7e1[_0x7c2c('0x2b')]===_0x7c2c('0x2e')?0x195:0x193)['json']({'message':_0x1ce7e1[_0x7c2c('0x2b')]==='unmanaged'?'Unmanaged.':_0x7c2c('0x2f')});}else{_0x51b73c();}})[_0x7c2c('0x30')](function(_0x2a9ae2){_0x51b73c(_0x2a9ae2);});}});};exports[_0x7c2c('0x31')]=function isAuthenticated(_0x41552f){return compose()[_0x7c2c('0x25')](function(_0xa84620,_0x541368,_0x10c356){if(_0xa84620['headers'][_0x7c2c('0x32')]){if(_['startsWith'](_0xa84620[_0x7c2c('0x33')][_0x7c2c('0x32')],_0x7c2c('0x34'))){var _0x481867=basicAuth(_0xa84620);db['User'][_0x7c2c('0x35')]({'where':{'name':_0x481867[_0x7c2c('0x36')]}})[_0x7c2c('0x2c')](function(_0x150690){if(!_0x150690||!_0x150690[_0x7c2c('0x37')](_0x481867[_0x7c2c('0x38')])){return _0x541368[_0x7c2c('0x2d')](0x191)['json']({'message':_0x7c2c('0x39')});}_0xa84620[_0x7c2c('0x26')]={'id':_0x150690['id']};_0x10c356();})[_0x7c2c('0x30')](function(_0x22d03f){_0x10c356(_0x22d03f);});}else if(_[_0x7c2c('0x3a')](_0xa84620[_0x7c2c('0x33')][_0x7c2c('0x32')],_0x7c2c('0x3b'))){validateJwt(_0xa84620,_0x541368,_0x10c356);}else{if(_0x41552f){_0x10c356();}else{return _0x541368[_0x7c2c('0x2d')](0x193)['json']({'message':_0x7c2c('0x3c')});}}}else if(_0xa84620[_0x7c2c('0x3d')][_0x7c2c('0x3e')]){try{var _0x720667={'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0x7c2c('0x3f')]()};verifyJwt(_0xa84620[_0x7c2c('0x3d')][_0x7c2c('0x3e')],_0x720667)[_0x7c2c('0x2c')](function(_0x1859c2){return db[_0x7c2c('0x40')][_0x7c2c('0x35')]({'where':{'id':_0x1859c2['sub']}})[_0x7c2c('0x2c')](function(_0x1acf75){if(!_0x1acf75||!_[_0x7c2c('0x41')](_0x1acf75[_0x7c2c('0x42')],_0x1859c2[_0x7c2c('0x43')])){return _0x541368['status'](0x191)['json']({'message':_0x7c2c('0x44')});}_0xa84620['user']={'id':_0x1acf75['id']};_0x10c356();});})['catch'](function(){return _0x541368[_0x7c2c('0x2d')](0x191)[_0x7c2c('0x45')]({'message':_0x7c2c('0x46')});});}catch(_0x156c03){_0x10c356(_0x156c03);}}else if(_0x41552f){_0x10c356();}else{return _0x541368['status'](0x193)[_0x7c2c('0x45')]({'message':_0x7c2c('0x3c')});}})[_0x7c2c('0x25')](function(_0x19783d,_0x204968,_0x6ef8c4){if(_0x19783d[_0x7c2c('0x26')]){db[_0x7c2c('0x40')][_0x7c2c('0x35')]({'where':{'id':_0x19783d[_0x7c2c('0x26')]['id']},'attributes':userAttributes})[_0x7c2c('0x2c')](function(_0x442510){if(!_0x442510){return _0x204968[_0x7c2c('0x2d')](0x194)['json']({'message':'User\x20not\x20found.'});}_0x19783d[_0x7c2c('0x26')]=_0x442510;_0x6ef8c4();})['catch'](function(_0x4c421c){_0x6ef8c4(_0x4c421c);});}else if(_0x41552f){_0x6ef8c4();}else{return _0x204968['status'](0x194)[_0x7c2c('0x45')]({'message':_0x7c2c('0x47')});}});};exports[_0x7c2c('0x48')]=function canUpdate(){return compose()[_0x7c2c('0x25')](function(_0x1cf51e,_0x151eb2,_0x1f8d75){return require(_0x7c2c('0x49'))[_0x7c2c('0x4a')]()[_0x7c2c('0x2c')](function(_0x6a9b35){if(_0x6a9b35['update']){_0x1f8d75();}else{return _0x151eb2['status'](0x193)[_0x7c2c('0x45')]({'message':_0x7c2c('0x4b')});}})[_0x7c2c('0x30')](function(_0x57bead){_0x1f8d75(_0x57bead);});});};exports['isMiddleware']=function(_0x10512a,_0x19c3fb,_0x93e2a8){_0x10512a[_0x7c2c('0x4c')]=!![];return _0x93e2a8();};exports[_0x7c2c('0x4d')]=function signToken(_0x8b0dc9){return signJwt(_0x8b0dc9);};exports[_0x7c2c('0x4e')]=function(_0x2e4093,_0xe55c39){if(!_0x2e4093['user']){return _0xe55c39[_0x7c2c('0x2d')](0x194)['json']({'message':_0x7c2c('0x4f')});}var _0x322704={'payload':{'id':_0x2e4093['user']['id'],'role':_0x2e4093[_0x7c2c('0x26')]['role']},'options':{'expiresIn':0x15180}};return signJwt(_0x322704)[_0x7c2c('0x2c')](function(_0x33b2be){_0xe55c39[_0x7c2c('0x50')](_0x7c2c('0x51'),_0x33b2be);_0xe55c39['redirect'](_0x7c2c('0x52'));})['catch'](function(_0x5235c0){return _0xe55c39[_0x7c2c('0x2d')](0x1f4)[_0x7c2c('0x53')](_0x5235c0);});};exports[_0x7c2c('0x54')]=function(_0x4c239b){if(_[_0x7c2c('0x55')](_0x4c239b[_0x7c2c('0x42')])||_['isNil'](_0x4c239b[_0x7c2c('0x56')])){return null;}else{return createJwt(_0x4c239b);}};exports['generateApiKey']=function(_0xf739a8){_0xf739a8[_0x7c2c('0x42')]=generateNonce();_0xf739a8['apiKeyIat']=generateIssuedAt();return createJwt(_0xf739a8);};exports['regenerateApiKey']=function(_0x41413a,_0x1c7c2b){var _0x578b7b=_0x41413a[_0x7c2c('0x3d')]['apikey'];if(_0x578b7b){var _0x51e3b7={'nonce':_0x1c7c2b[_0x7c2c('0x42')],'iat':_0x1c7c2b[_0x7c2c('0x56')],'audience':hardwareConf[_0x7c2c('0x3f')](),'issuer':hardwareConf[_0x7c2c('0x3f')]()};return verifyJwt(_0x578b7b,_0x51e3b7)[_0x7c2c('0x2c')](function(){return generateApiKey(_0x1c7c2b);});}else{throw{'message':_0x7c2c('0x57')};}};function signJwt(_0x2b0781){var _0x20f7d9=BPromise[_0x7c2c('0x58')](jwt['sign'],{'context':jwt});var _0x57eaf8=_0x2b0781[_0x7c2c('0x59')]||config[_0x7c2c('0x5a')][_0x7c2c('0x8')];return new BPromise(function(_0x4f95a1,_0x59bdc7){_0x20f7d9(_0x2b0781[_0x7c2c('0x5b')],_0x57eaf8,_0x2b0781[_0x7c2c('0x5c')])[_0x7c2c('0x2c')](function(_0x2b79d5){_0x4f95a1(_0x2b79d5);})['catch'](function(_0x4f958d){_0x59bdc7(_0x4f958d);});});}function verifyJwt(_0x587667,_0xd71ef8,_0x36184a){var _0x1d0140=BPromise[_0x7c2c('0x58')](jwt[_0x7c2c('0x5d')],{'context':jwt});var _0x563913=_0x36184a||config[_0x7c2c('0x5a')][_0x7c2c('0x8')];return new BPromise(function(_0x50663c,_0x19621a){_0x1d0140(_0x587667,_0x563913,_0xd71ef8)['then'](function(_0xfba6a7){_0x50663c(_0xfba6a7);})[_0x7c2c('0x30')](function(_0x3427fc){_0x19621a(_0x3427fc);});});}function generateNonce(){return crypto['randomBytes'](0x10)['toString'](_0x7c2c('0x5e'));}function generateIssuedAt(){return Math['floor'](Date[_0x7c2c('0x5f')]()/0x3e8)[_0x7c2c('0x60')]();}function createJwt(_0x5a8d98){var _0x101205={'payload':{'iat':_0x5a8d98[_0x7c2c('0x56')],'nonce':_0x5a8d98['apiKeyNonce']},'options':{'algorithm':_0x7c2c('0x61'),'subject':_0x5a8d98['id'][_0x7c2c('0x60')](),'issuer':hardwareConf['getUuid'](),'audience':hardwareConf[_0x7c2c('0x3f')]()}};return signJwt(_0x101205)[_0x7c2c('0x2c')](function(_0x2901a5){return{'iat':_0x5a8d98['apiKeyIat'],'nonce':_0x5a8d98[_0x7c2c('0x42')],'token':_0x2901a5};});} \ No newline at end of file +var _0x9f0e=['toString','HS512','../../mysqldb','../../config/environment','../../config/license/hardware','lodash','jsonwebtoken','basic-auth','crypto','bluebird','secrets','session','name','internal','email','permissions','md5secret','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','pauseType','lastLoginAt','lastPauseAt','crudPermissions','passwordResetAt','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarExpires','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','userProfileId','isChatInteractionAuthorized','isAuthenticated','user','ChatInteraction','findOne','params','disposition','then','status','unmanaged','json','Unmanaged.','use','headers','authorization','startsWith','Basic','User','find','authenticate','pass','Wrong\x20credentials.','catch','Bearer','Unknown\x20authorization\x20format','query','apikey','getUuid','sub','isEqual','apiKeyNonce','nonce','Invalid\x20API\x20access\x20key','User\x20not\x20found.','User\x20object\x20not\x20found.','../../config/license/util','getLicense','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','/dashboards/general','send','isNil','apiKeyIat','regenerateApiKey','promisify','secret','payload','options','randomBytes','hex','floor'];(function(_0x29990f,_0x587aff){var _0x1fe22e=function(_0x58331b){while(--_0x58331b){_0x29990f['push'](_0x29990f['shift']());}};_0x1fe22e(++_0x587aff);}(_0x9f0e,0x116));var _0xe9f0=function(_0x55da5e,_0x55ba7d){_0x55da5e=_0x55da5e-0x0;var _0x2e0d28=_0x9f0e[_0x55da5e];return _0x2e0d28;};'use strict';var db=require(_0xe9f0('0x0'))['db'];var config=require(_0xe9f0('0x1'));var hardwareConf=require(_0xe9f0('0x2'));var _=require(_0xe9f0('0x3'));var jwt=require(_0xe9f0('0x4'));var expressJwt=require('express-jwt');var compose=require('composable-middleware');var basicAuth=require(_0xe9f0('0x5'));var crypto=require(_0xe9f0('0x6'));var BPromise=require(_0xe9f0('0x7'));var validateJwt=expressJwt({'secret':config[_0xe9f0('0x8')][_0xe9f0('0x9')]});var userAttributes=['id','role','fullname',_0xe9f0('0xa'),_0xe9f0('0xb'),_0xe9f0('0xc'),'userpic',_0xe9f0('0xd'),_0xe9f0('0xe'),_0xe9f0('0xf'),_0xe9f0('0x10'),_0xe9f0('0x11'),_0xe9f0('0x12'),_0xe9f0('0x13'),_0xe9f0('0x14'),_0xe9f0('0x15'),'showWebBar',_0xe9f0('0x16'),_0xe9f0('0x17'),_0xe9f0('0x18'),'allowmessenger',_0xe9f0('0x19'),'alias',_0xe9f0('0x1a'),_0xe9f0('0x1b'),_0xe9f0('0x1c'),_0xe9f0('0x1d'),'phoneBarEnableSettings',_0xe9f0('0x1e'),'phoneBarPrefixRequired',_0xe9f0('0x1f'),_0xe9f0('0x20'),_0xe9f0('0x21'),'interface',_0xe9f0('0x22')];exports[_0xe9f0('0x23')]=function(){return this[_0xe9f0('0x24')](!![])['use'](function(_0xaa7aa6,_0x1e16e0,_0xcd2042){if(_0xaa7aa6[_0xe9f0('0x25')]){_0xcd2042();}else{return db[_0xe9f0('0x26')][_0xe9f0('0x27')]({'where':{'id':_0xaa7aa6[_0xe9f0('0x28')]['id']},'attributes':['id','closed',_0xe9f0('0x29')],'raw':!![]})[_0xe9f0('0x2a')](function(_0x232f2c){if(_0x232f2c&&_0x232f2c['closed']){return _0x1e16e0[_0xe9f0('0x2b')](_0x232f2c[_0xe9f0('0x29')]===_0xe9f0('0x2c')?0x195:0x193)[_0xe9f0('0x2d')]({'message':_0x232f2c['disposition']===_0xe9f0('0x2c')?_0xe9f0('0x2e'):'Forbidden.'});}else{_0xcd2042();}})['catch'](function(_0x4cc403){_0xcd2042(_0x4cc403);});}});};exports[_0xe9f0('0x24')]=function isAuthenticated(_0xa1ddc){return compose()[_0xe9f0('0x2f')](function(_0x316cdf,_0x3ce106,_0x4a5c27){if(_0x316cdf[_0xe9f0('0x30')][_0xe9f0('0x31')]){if(_[_0xe9f0('0x32')](_0x316cdf[_0xe9f0('0x30')][_0xe9f0('0x31')],_0xe9f0('0x33'))){var _0x37c0fc=basicAuth(_0x316cdf);db[_0xe9f0('0x34')][_0xe9f0('0x35')]({'where':{'name':_0x37c0fc[_0xe9f0('0xa')]}})['then'](function(_0x371095){if(!_0x371095||!_0x371095[_0xe9f0('0x36')](_0x37c0fc[_0xe9f0('0x37')])){return _0x3ce106[_0xe9f0('0x2b')](0x191)['json']({'message':_0xe9f0('0x38')});}_0x316cdf[_0xe9f0('0x25')]={'id':_0x371095['id']};_0x4a5c27();})[_0xe9f0('0x39')](function(_0x1f98a7){_0x4a5c27(_0x1f98a7);});}else if(_[_0xe9f0('0x32')](_0x316cdf['headers'][_0xe9f0('0x31')],_0xe9f0('0x3a'))){validateJwt(_0x316cdf,_0x3ce106,_0x4a5c27);}else{if(_0xa1ddc){_0x4a5c27();}else{return _0x3ce106[_0xe9f0('0x2b')](0x193)[_0xe9f0('0x2d')]({'message':_0xe9f0('0x3b')});}}}else if(_0x316cdf[_0xe9f0('0x3c')][_0xe9f0('0x3d')]){try{var _0x2efd33={'audience':hardwareConf[_0xe9f0('0x3e')](),'issuer':hardwareConf[_0xe9f0('0x3e')]()};verifyJwt(_0x316cdf[_0xe9f0('0x3c')][_0xe9f0('0x3d')],_0x2efd33)[_0xe9f0('0x2a')](function(_0x2ab77d){return db[_0xe9f0('0x34')][_0xe9f0('0x35')]({'where':{'id':_0x2ab77d[_0xe9f0('0x3f')]}})[_0xe9f0('0x2a')](function(_0x2e7535){if(!_0x2e7535||!_[_0xe9f0('0x40')](_0x2e7535[_0xe9f0('0x41')],_0x2ab77d[_0xe9f0('0x42')])){return _0x3ce106[_0xe9f0('0x2b')](0x191)[_0xe9f0('0x2d')]({'message':'API\x20access\x20key\x20is\x20not\x20valid\x20anymore'});}_0x316cdf['user']={'id':_0x2e7535['id']};_0x4a5c27();});})['catch'](function(){return _0x3ce106[_0xe9f0('0x2b')](0x191)['json']({'message':_0xe9f0('0x43')});});}catch(_0xc5fa13){_0x4a5c27(_0xc5fa13);}}else if(_0xa1ddc){_0x4a5c27();}else{return _0x3ce106['status'](0x193)[_0xe9f0('0x2d')]({'message':'Unknown\x20authorization\x20format'});}})['use'](function(_0x59024e,_0x165440,_0x39722b){if(_0x59024e['user']){db[_0xe9f0('0x34')][_0xe9f0('0x35')]({'where':{'id':_0x59024e[_0xe9f0('0x25')]['id']},'attributes':userAttributes})['then'](function(_0x523fbc){if(!_0x523fbc){return _0x165440[_0xe9f0('0x2b')](0x194)[_0xe9f0('0x2d')]({'message':_0xe9f0('0x44')});}_0x59024e['user']=_0x523fbc;_0x39722b();})[_0xe9f0('0x39')](function(_0x2e7997){_0x39722b(_0x2e7997);});}else if(_0xa1ddc){_0x39722b();}else{return _0x165440[_0xe9f0('0x2b')](0x194)[_0xe9f0('0x2d')]({'message':_0xe9f0('0x45')});}});};exports['canUpdate']=function canUpdate(){return compose()[_0xe9f0('0x2f')](function(_0x3a2b23,_0x2ede2,_0x5a8c5a){return require(_0xe9f0('0x46'))[_0xe9f0('0x47')]()['then'](function(_0x317278){if(_0x317278['update']){_0x5a8c5a();}else{return _0x2ede2[_0xe9f0('0x2b')](0x193)['json']({'message':'Forbidden'});}})['catch'](function(_0x5bddcc){_0x5a8c5a(_0x5bddcc);});});};exports['isMiddleware']=function(_0x35062f,_0x2d4115,_0x2d8f93){_0x35062f[_0xe9f0('0x48')]=!![];return _0x2d8f93();};exports[_0xe9f0('0x49')]=function signToken(_0xd9b61b){return signJwt(_0xd9b61b);};exports[_0xe9f0('0x4a')]=function(_0x3e79c1,_0xb06e04){if(!_0x3e79c1['user']){return _0xb06e04[_0xe9f0('0x2b')](0x194)[_0xe9f0('0x2d')]({'message':_0xe9f0('0x4b')});}var _0x571366={'payload':{'id':_0x3e79c1['user']['id'],'role':_0x3e79c1[_0xe9f0('0x25')]['role']},'options':{'expiresIn':0x15180}};return signJwt(_0x571366)[_0xe9f0('0x2a')](function(_0x52613a){_0xb06e04[_0xe9f0('0x4c')](_0xe9f0('0x4d'),_0x52613a);_0xb06e04['redirect'](_0xe9f0('0x4e'));})[_0xe9f0('0x39')](function(_0x43e971){return _0xb06e04[_0xe9f0('0x2b')](0x1f4)[_0xe9f0('0x4f')](_0x43e971);});};exports['retrieveApiKey']=function(_0x60a40d){if(_[_0xe9f0('0x50')](_0x60a40d[_0xe9f0('0x41')])||_[_0xe9f0('0x50')](_0x60a40d[_0xe9f0('0x51')])){return null;}else{return createJwt(_0x60a40d);}};exports['generateApiKey']=function(_0x3a8d1d){_0x3a8d1d['apiKeyNonce']=generateNonce();_0x3a8d1d['apiKeyIat']=generateIssuedAt();return createJwt(_0x3a8d1d);};exports[_0xe9f0('0x52')]=function(_0x17b832,_0x536734){var _0x10a360=_0x17b832[_0xe9f0('0x3c')][_0xe9f0('0x3d')];if(_0x10a360){var _0x7b167b={'nonce':_0x536734[_0xe9f0('0x41')],'iat':_0x536734[_0xe9f0('0x51')],'audience':hardwareConf[_0xe9f0('0x3e')](),'issuer':hardwareConf['getUuid']()};return verifyJwt(_0x10a360,_0x7b167b)[_0xe9f0('0x2a')](function(){return generateApiKey(_0x536734);});}else{throw{'message':'Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one'};}};function signJwt(_0x3b8712){var _0x5a3488=BPromise[_0xe9f0('0x53')](jwt['sign'],{'context':jwt});var _0xe6497a=_0x3b8712[_0xe9f0('0x54')]||config[_0xe9f0('0x8')]['session'];return new BPromise(function(_0x26c091,_0xcf426d){_0x5a3488(_0x3b8712[_0xe9f0('0x55')],_0xe6497a,_0x3b8712[_0xe9f0('0x56')])[_0xe9f0('0x2a')](function(_0x135175){_0x26c091(_0x135175);})[_0xe9f0('0x39')](function(_0x42ff7){_0xcf426d(_0x42ff7);});});}function verifyJwt(_0x18fc2b,_0x13c4ad,_0x108467){var _0x1325a2=BPromise['promisify'](jwt['verify'],{'context':jwt});var _0x31aa19=_0x108467||config[_0xe9f0('0x8')][_0xe9f0('0x9')];return new BPromise(function(_0x5d2a78,_0x1ac381){_0x1325a2(_0x18fc2b,_0x31aa19,_0x13c4ad)['then'](function(_0x323e1e){_0x5d2a78(_0x323e1e);})[_0xe9f0('0x39')](function(_0x31770f){_0x1ac381(_0x31770f);});});}function generateNonce(){return crypto[_0xe9f0('0x57')](0x10)['toString'](_0xe9f0('0x58'));}function generateIssuedAt(){return Math[_0xe9f0('0x59')](Date['now']()/0x3e8)[_0xe9f0('0x5a')]();}function createJwt(_0xafb4d7){var _0x33f26c={'payload':{'iat':_0xafb4d7[_0xe9f0('0x51')],'nonce':_0xafb4d7['apiKeyNonce']},'options':{'algorithm':_0xe9f0('0x5b'),'subject':_0xafb4d7['id'][_0xe9f0('0x5a')](),'issuer':hardwareConf[_0xe9f0('0x3e')](),'audience':hardwareConf[_0xe9f0('0x3e')]()}};return signJwt(_0x33f26c)[_0xe9f0('0x2a')](function(_0x27ae5a){return{'iat':_0xafb4d7[_0xe9f0('0x51')],'nonce':_0xafb4d7[_0xe9f0('0x41')],'token':_0x27ae5a};});} \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index 618183b..cd93fdd 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 _0xd8b0=['data','binary','end','final','write','close','unlink','decryptFile','createReadStream','createDecipher','update','crypto','bluebird','hasOwnProperty','encryptFile','createWriteStream','createCipher','algorithm'];(function(_0x184b18,_0x36391d){var _0x13f527=function(_0x46d205){while(--_0x46d205){_0x184b18['push'](_0x184b18['shift']());}};_0x13f527(++_0x36391d);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var crypto=require(_0x0d8b('0x0'));var fs=require('fs');var BPromise=require(_0x0d8b('0x1'));var defaultOptions={'algorithm':'aes192'};function combineOptions(_0x585166){var _0x4b72b0={};for(var _0x3ff8df in defaultOptions){if(defaultOptions[_0x0d8b('0x2')](_0x3ff8df)){_0x4b72b0[_0x3ff8df]=defaultOptions[_0x3ff8df];}}if(_0x585166){for(var _0x43bca1 in _0x585166){if(_0x585166[_0x0d8b('0x2')](_0x43bca1)){_0x4b72b0[_0x43bca1]=_0x585166[_0x43bca1];}}}return _0x4b72b0;}exports[_0x0d8b('0x3')]=function(_0x577834,_0x5e15e6,_0x3f8b6f,_0x227c63){return new BPromise(function(_0x39f43a,_0x4a4470){_0x227c63=combineOptions(_0x227c63);var _0x413284=new Buffer(_0x3f8b6f);var _0x284169=fs['createReadStream'](_0x577834);var _0x129310=fs[_0x0d8b('0x4')](_0x5e15e6);var _0x3b027f=crypto[_0x0d8b('0x5')](_0x227c63[_0x0d8b('0x6')],_0x413284);_0x284169['on'](_0x0d8b('0x7'),function(_0x2c5e9e){var _0x28f87c=new Buffer(_0x3b027f['update'](_0x2c5e9e),_0x0d8b('0x8'));_0x129310['write'](_0x28f87c);});_0x284169['on'](_0x0d8b('0x9'),function(){try{var _0xc574a3=new Buffer(_0x3b027f[_0x0d8b('0xa')](_0x0d8b('0x8')),_0x0d8b('0x8'));_0x129310[_0x0d8b('0xb')](_0xc574a3);_0x129310[_0x0d8b('0x9')]();_0x129310['on'](_0x0d8b('0xc'),function(){return _0x39f43a(_0x5e15e6);});}catch(_0x1d4bbc){fs[_0x0d8b('0xd')](_0x5e15e6);return _0x4a4470(_0x1d4bbc);}});});};exports[_0x0d8b('0xe')]=function(_0xe65334,_0x1567ce,_0x2d4e1c,_0x4f6f21){return new BPromise(function(_0x23eb7b,_0xa86349){_0x4f6f21=combineOptions(_0x4f6f21);var _0x17f7df=new Buffer(_0x2d4e1c);var _0xe2e167=fs[_0x0d8b('0xf')](_0xe65334);var _0x5cd485=fs[_0x0d8b('0x4')](_0x1567ce);var _0x4586c2=crypto[_0x0d8b('0x10')](_0x4f6f21[_0x0d8b('0x6')],_0x17f7df);_0xe2e167['on'](_0x0d8b('0x7'),function(_0x18dd2d){var _0x264b39=new Buffer(_0x4586c2[_0x0d8b('0x11')](_0x18dd2d),'binary');_0x5cd485[_0x0d8b('0xb')](_0x264b39);});_0xe2e167['on'](_0x0d8b('0x9'),function(){try{var _0x196c0a=new Buffer(_0x4586c2[_0x0d8b('0xa')](_0x0d8b('0x8')),_0x0d8b('0x8'));_0x5cd485[_0x0d8b('0xb')](_0x196c0a);_0x5cd485[_0x0d8b('0x9')]();_0x5cd485['on']('close',function(){return _0x23eb7b(_0x1567ce);});}catch(_0x4f0a1a){fs[_0x0d8b('0xd')](_0x1567ce);return _0xa86349(_0x4f0a1a);}});});}; \ No newline at end of file +var _0xe706=['unlink','crypto','bluebird','aes192','hasOwnProperty','encryptFile','createReadStream','createWriteStream','createCipher','algorithm','data','update','end','final','binary','write','close','createDecipher'];(function(_0x5dff0c,_0x2bdeb4){var _0x15615f=function(_0x22956e){while(--_0x22956e){_0x5dff0c['push'](_0x5dff0c['shift']());}};_0x15615f(++_0x2bdeb4);}(_0xe706,0xa3));var _0x6e70=function(_0x4a4d8e,_0x22a7a9){_0x4a4d8e=_0x4a4d8e-0x0;var _0x1a5cb4=_0xe706[_0x4a4d8e];return _0x1a5cb4;};'use strict';var crypto=require(_0x6e70('0x0'));var fs=require('fs');var BPromise=require(_0x6e70('0x1'));var defaultOptions={'algorithm':_0x6e70('0x2')};function combineOptions(_0x5e8446){var _0x2cae77={};for(var _0x315629 in defaultOptions){if(defaultOptions[_0x6e70('0x3')](_0x315629)){_0x2cae77[_0x315629]=defaultOptions[_0x315629];}}if(_0x5e8446){for(var _0x7dfbc3 in _0x5e8446){if(_0x5e8446[_0x6e70('0x3')](_0x7dfbc3)){_0x2cae77[_0x7dfbc3]=_0x5e8446[_0x7dfbc3];}}}return _0x2cae77;}exports[_0x6e70('0x4')]=function(_0x376a8d,_0x506db9,_0x1b0389,_0x4381d1){return new BPromise(function(_0x36357b,_0x293ce7){_0x4381d1=combineOptions(_0x4381d1);var _0x45a2d4=new Buffer(_0x1b0389);var _0x188ed3=fs[_0x6e70('0x5')](_0x376a8d);var _0x449b48=fs[_0x6e70('0x6')](_0x506db9);var _0x25e61c=crypto[_0x6e70('0x7')](_0x4381d1[_0x6e70('0x8')],_0x45a2d4);_0x188ed3['on'](_0x6e70('0x9'),function(_0x3f474a){var _0x37b3e0=new Buffer(_0x25e61c[_0x6e70('0xa')](_0x3f474a),'binary');_0x449b48['write'](_0x37b3e0);});_0x188ed3['on'](_0x6e70('0xb'),function(){try{var _0x15a1a5=new Buffer(_0x25e61c[_0x6e70('0xc')](_0x6e70('0xd')),_0x6e70('0xd'));_0x449b48[_0x6e70('0xe')](_0x15a1a5);_0x449b48[_0x6e70('0xb')]();_0x449b48['on'](_0x6e70('0xf'),function(){return _0x36357b(_0x506db9);});}catch(_0x5dfbaa){fs['unlink'](_0x506db9);return _0x293ce7(_0x5dfbaa);}});});};exports['decryptFile']=function(_0x257e81,_0x5a37a6,_0x53aed0,_0x304716){return new BPromise(function(_0x22c50c,_0x5d9263){_0x304716=combineOptions(_0x304716);var _0x24f3ac=new Buffer(_0x53aed0);var _0x5c3fe7=fs[_0x6e70('0x5')](_0x257e81);var _0x161f23=fs['createWriteStream'](_0x5a37a6);var _0x49029f=crypto[_0x6e70('0x10')](_0x304716['algorithm'],_0x24f3ac);_0x5c3fe7['on'](_0x6e70('0x9'),function(_0x173afe){var _0x53acdc=new Buffer(_0x49029f['update'](_0x173afe),_0x6e70('0xd'));_0x161f23[_0x6e70('0xe')](_0x53acdc);});_0x5c3fe7['on'](_0x6e70('0xb'),function(){try{var _0x3a9978=new Buffer(_0x49029f[_0x6e70('0xc')](_0x6e70('0xd')),_0x6e70('0xd'));_0x161f23[_0x6e70('0xe')](_0x3a9978);_0x161f23[_0x6e70('0xb')]();_0x161f23['on'](_0x6e70('0xf'),function(){return _0x22c50c(_0x5a37a6);});}catch(_0x4a0cfe){fs[_0x6e70('0x11')](_0x5a37a6);return _0x5d9263(_0x4a0cfe);}});});}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 4e6bf5a..5e22fc3 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 _0xee5b=['rimraf','../../mysqldb','analytics','argv','AnalyticExtractedReport','update','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','find','split','splitSizeCsv','then','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','SELECT','Empty','length','num','push','sequelize','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','basename','.csv','existsSync','join','csv','%s.%s','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','Failed','util','lodash','to-csv','zip-dir'];(function(_0x45b1ad,_0x215b03){var _0x3d5696=function(_0x4d9e73){while(--_0x4d9e73){_0x45b1ad['push'](_0x45b1ad['shift']());}};_0x3d5696(++_0x215b03);}(_0xee5b,0x1f4));var _0xbee5=function(_0x3165be,_0x5f11ca){_0x3165be=_0x3165be-0x0;var _0x3b8150=_0xee5b[_0x3165be];return _0x3b8150;};'use strict';var util=require(_0xbee5('0x0'));var path=require('path');var _=require(_0xbee5('0x1'));var csv=require(_0xbee5('0x2'));var fs=require('fs');var BPromise=require('bluebird');var zipdir=require(_0xbee5('0x3'));var rimraf=require(_0xbee5('0x4'));var db=require(_0xbee5('0x5'))['db'];var dbH=require(_0xbee5('0x5'))['dbH'];var logger=require('../../config/logger')(_0xbee5('0x6'));var EXTRACTED_REPORT_ID=Number(process[_0xbee5('0x7')][0x2]);var QUERY=process[_0xbee5('0x7')][0x3];var PATH=process[_0xbee5('0x7')][0x4];function analyticExtractedReport(_0x4f5065,_0x5505e3){var _0x53d5b9={'status':_0x4f5065};var _0x5baf5c={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x5505e3){_0x53d5b9['savename']=_0x5505e3;}return db[_0xbee5('0x8')][_0xbee5('0x9')](_0x53d5b9,_0x5baf5c);}function main(){var _0x45c2c7=0x1388;var _0x20f717;logger['info'](util[_0xbee5('0xa')](_0xbee5('0xb'),EXTRACTED_REPORT_ID,_0xbee5('0xc')));return db[_0xbee5('0xd')][_0xbee5('0xe')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xbee5('0xf'),_0xbee5('0x10')]})[_0xbee5('0x11')](function(_0xcef158){if(_0xcef158){_0x20f717=_0xcef158;_0x45c2c7=_0x20f717['splitSizeCsv']||0x1388;}})[_0xbee5('0x11')](function(){return dbH['sequelize'][_0xbee5('0x12')](util[_0xbee5('0xa')](_0xbee5('0x13'),QUERY),{'type':dbH['sequelize']['QueryTypes'][_0xbee5('0x14')]});})['then'](function(_0x40afcb){if(!_0x40afcb[0x0]['num']){return analyticExtractedReport(_0xbee5('0x15'));}var _0x141878=[];var _0xf676b1=0x0;var _0x53b269=!![];if(_0x40afcb&&_0x40afcb[_0xbee5('0x16')]){var _0x662d2c=_0x40afcb[0x0]['num']%(_0xf676b1+_0x45c2c7);if(_0x20f717[_0xbee5('0xf')]){for(;_0x53b269;_0xf676b1+=_0x45c2c7,_0x662d2c=_0x40afcb[0x0][_0xbee5('0x17')]%(_0xf676b1+_0x45c2c7)){if(_0x662d2c==0x0||_0x662d2c==_0x40afcb[0x0][_0xbee5('0x17')]){_0x53b269=![];}_0x141878[_0xbee5('0x18')](dbH[_0xbee5('0x19')][_0xbee5('0x12')](util[_0xbee5('0xa')](_0xbee5('0x1a'),QUERY,_0x45c2c7,_0xf676b1),{'type':dbH[_0xbee5('0x19')][_0xbee5('0x1b')][_0xbee5('0x14')]}));}}else{_0x141878[_0xbee5('0x18')](dbH[_0xbee5('0x19')][_0xbee5('0x12')](QUERY,{'type':dbH[_0xbee5('0x19')]['QueryTypes']['SELECT']}));}}var _0x469a7a=path['dirname'](PATH);var _0x205491=path[_0xbee5('0x1c')](PATH,_0xbee5('0x1d'));var _0x2bfb0f=_0x20f717[_0xbee5('0xf')]&&_0x141878[_0xbee5('0x16')]>0x1;var _0x359ccf=[];if(!fs[_0xbee5('0x1e')](path[_0xbee5('0x1f')](_0x469a7a,_0x205491))&&_0x2bfb0f){fs['mkdirSync'](path['join'](_0x469a7a,_0x205491));}return BPromise['each'](_0x141878,function(_0x519473){_0x359ccf['push'](_0x519473);})[_0xbee5('0x11')](function(){for(var _0x18d7f4=0x0;_0x18d7f4<_0x359ccf[_0xbee5('0x16')];_0x18d7f4+=0x1){var _0x28c74d;var _0x169042=_0x359ccf[_0x18d7f4];if(_0x2bfb0f){_0x28c74d=path[_0xbee5('0x1f')](_0x469a7a,_0x205491,util[_0xbee5('0xa')]('%s%d.%s',_0x205491,_0x18d7f4,_0xbee5('0x20')));}else{_0x28c74d=path[_0xbee5('0x1f')](_0x469a7a,util[_0xbee5('0xa')](_0xbee5('0x21'),_0x205491,_0xbee5('0x20')));}fs['writeFileSync'](_0x28c74d,csv(_0x169042));}})[_0xbee5('0x11')](function(){if(_0x2bfb0f){zipdir(path[_0xbee5('0x1f')](_0x469a7a,_0x205491),{'saveTo':path[_0xbee5('0x1f')](_0x469a7a,util[_0xbee5('0xa')](_0xbee5('0x21'),_0x205491,_0xbee5('0x22')))},function(_0x34b7df,_0x36e8bb){});rimraf(path[_0xbee5('0x1f')](_0x469a7a,_0x205491),function(){});}})['then'](function(){logger[_0xbee5('0x23')](util['format'](_0xbee5('0x24'),EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport(_0xbee5('0x25'),_0x2bfb0f?util['format'](_0xbee5('0x21'),_0x205491,_0x2bfb0f?'zip':_0xbee5('0x20')):null);});})[_0xbee5('0x26')](function(_0x36eb70){logger[_0xbee5('0x23')](util['format'](_0xbee5('0x27'),EXTRACTED_REPORT_ID,_0xbee5('0xc')),util[_0xbee5('0x28')](_0x36eb70,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0xbee5('0x29'));});}main(); \ No newline at end of file +var _0x54ef=['%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.csv','existsSync','join','mkdirSync','each','%s%d.%s','%s.%s','csv','writeFileSync','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','util','path','lodash','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','argv','savename','AnalyticExtractedReport','info','format','CSV','Setting','find','split','then','sequelize','query','QueryTypes','SELECT','num','Empty','length','push'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x54ef,0x112));var _0xf54e=function(_0x19ccbb,_0x253f3f){_0x19ccbb=_0x19ccbb-0x0;var _0x155851=_0x54ef[_0x19ccbb];return _0x155851;};'use strict';var util=require(_0xf54e('0x0'));var path=require(_0xf54e('0x1'));var _=require(_0xf54e('0x2'));var csv=require('to-csv');var fs=require('fs');var BPromise=require(_0xf54e('0x3'));var zipdir=require(_0xf54e('0x4'));var rimraf=require(_0xf54e('0x5'));var db=require(_0xf54e('0x6'))['db'];var dbH=require(_0xf54e('0x6'))[_0xf54e('0x7')];var logger=require(_0xf54e('0x8'))('analytics');var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0xf54e('0x9')][0x3];var PATH=process[_0xf54e('0x9')][0x4];function analyticExtractedReport(_0x2464ae,_0x561870){var _0x27e69b={'status':_0x2464ae};var _0x57a1ce={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x561870){_0x27e69b[_0xf54e('0xa')]=_0x561870;}return db[_0xf54e('0xb')]['update'](_0x27e69b,_0x57a1ce);}function main(){var _0x26fc3e=0x1388;var _0xefa1c0;logger[_0xf54e('0xc')](util[_0xf54e('0xd')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xf54e('0xe')));return db[_0xf54e('0xf')][_0xf54e('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xf54e('0x11'),'splitSizeCsv']})[_0xf54e('0x12')](function(_0x4b0ee1){if(_0x4b0ee1){_0xefa1c0=_0x4b0ee1;_0x26fc3e=_0xefa1c0['splitSizeCsv']||0x1388;}})[_0xf54e('0x12')](function(){return dbH[_0xf54e('0x13')][_0xf54e('0x14')](util[_0xf54e('0xd')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0xf54e('0x13')][_0xf54e('0x15')][_0xf54e('0x16')]});})[_0xf54e('0x12')](function(_0x56828e){if(!_0x56828e[0x0][_0xf54e('0x17')]){return analyticExtractedReport(_0xf54e('0x18'));}var _0x3eb415=[];var _0x5c5d00=0x0;var _0x4af633=!![];if(_0x56828e&&_0x56828e[_0xf54e('0x19')]){var _0x41fb35=_0x56828e[0x0][_0xf54e('0x17')]%(_0x5c5d00+_0x26fc3e);if(_0xefa1c0[_0xf54e('0x11')]){for(;_0x4af633;_0x5c5d00+=_0x26fc3e,_0x41fb35=_0x56828e[0x0][_0xf54e('0x17')]%(_0x5c5d00+_0x26fc3e)){if(_0x41fb35==0x0||_0x41fb35==_0x56828e[0x0][_0xf54e('0x17')]){_0x4af633=![];}_0x3eb415[_0xf54e('0x1a')](dbH[_0xf54e('0x13')][_0xf54e('0x14')](util[_0xf54e('0xd')](_0xf54e('0x1b'),QUERY,_0x26fc3e,_0x5c5d00),{'type':dbH['sequelize']['QueryTypes'][_0xf54e('0x16')]}));}}else{_0x3eb415['push'](dbH[_0xf54e('0x13')][_0xf54e('0x14')](QUERY,{'type':dbH[_0xf54e('0x13')][_0xf54e('0x15')][_0xf54e('0x16')]}));}}var _0x3887b0=path[_0xf54e('0x1c')](PATH);var _0x11985e=path[_0xf54e('0x1d')](PATH,_0xf54e('0x1e'));var _0x1c58bd=_0xefa1c0['split']&&_0x3eb415[_0xf54e('0x19')]>0x1;var _0x54f914=[];if(!fs[_0xf54e('0x1f')](path[_0xf54e('0x20')](_0x3887b0,_0x11985e))&&_0x1c58bd){fs[_0xf54e('0x21')](path[_0xf54e('0x20')](_0x3887b0,_0x11985e));}return BPromise[_0xf54e('0x22')](_0x3eb415,function(_0x160160){_0x54f914[_0xf54e('0x1a')](_0x160160);})[_0xf54e('0x12')](function(){for(var _0x2342a9=0x0;_0x2342a9<_0x54f914[_0xf54e('0x19')];_0x2342a9+=0x1){var _0xf6cdd7;var _0x39c0ae=_0x54f914[_0x2342a9];if(_0x1c58bd){_0xf6cdd7=path[_0xf54e('0x20')](_0x3887b0,_0x11985e,util['format'](_0xf54e('0x23'),_0x11985e,_0x2342a9,'csv'));}else{_0xf6cdd7=path[_0xf54e('0x20')](_0x3887b0,util['format'](_0xf54e('0x24'),_0x11985e,_0xf54e('0x25')));}fs[_0xf54e('0x26')](_0xf6cdd7,csv(_0x39c0ae));}})[_0xf54e('0x12')](function(){if(_0x1c58bd){zipdir(path[_0xf54e('0x20')](_0x3887b0,_0x11985e),{'saveTo':path[_0xf54e('0x20')](_0x3887b0,util[_0xf54e('0xd')]('%s.%s',_0x11985e,'zip'))},function(_0x2f96b1,_0x258d29){});rimraf(path[_0xf54e('0x20')](_0x3887b0,_0x11985e),function(){});}})[_0xf54e('0x12')](function(){logger[_0xf54e('0xc')](util[_0xf54e('0xd')](_0xf54e('0x27'),EXTRACTED_REPORT_ID,_0xf54e('0xe')));return analyticExtractedReport(_0xf54e('0x28'),_0x1c58bd?util[_0xf54e('0xd')]('%s.%s',_0x11985e,_0x1c58bd?'zip':_0xf54e('0x25')):null);});})[_0xf54e('0x29')](function(_0x4d8fdd){logger[_0xf54e('0xc')](util[_0xf54e('0xd')](_0xf54e('0x2a'),EXTRACTED_REPORT_ID,_0xf54e('0xe')),util['inspect'](_0x4d8fdd,{'showHidden':![],'depth':null}));return analyticExtractedReport('Failed');});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index 0c6d5b9..c57de62 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 _0xd8b0=['format','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','existsSync','join','mkdirSync','each','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','endDate','landscape','black','body','toString','/fonts/Roboto-Medium.ttf','/fonts/Roboto-Italic.ttf','/fonts/Roboto-MediumItalic.ttf','createPdfKitDocument','%s%d.%s','pdf','pipe','finish','error','log','err','%s.%s','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','CSV','Completed','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','PDF','findOne','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','lodash','bluebird','pdfmake/src/printer','zip-dir','rimraf','../../mysqldb','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','update','hasOwnProperty','tableHeader','num','Empty','dirname','basename','.pdf','Setting','find','split','splitSizePdf','then','length','push','sequelize','query'];(function(_0x55c3d7,_0x869445){var _0x6a357b=function(_0x2d4961){while(--_0x2d4961){_0x55c3d7['push'](_0x55c3d7['shift']());}};_0x6a357b(++_0x869445);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var fs=require('fs');var BPromise=require(_0x0d8b('0x1'));var util=require('util');var path=require('path');var moment=require('moment');var PdfPrinter=require(_0x0d8b('0x2'));var zipdir=require(_0x0d8b('0x3'));var rimraf=require(_0x0d8b('0x4'));var db=require(_0x0d8b('0x5'))['db'];var dbH=require(_0x0d8b('0x5'))['dbH'];var logger=require('../../config/logger')(_0x0d8b('0x6'));var EXTRACTED_REPORT_ID=Number(process[_0x0d8b('0x7')][0x2]);var QUERY=process[_0x0d8b('0x7')][0x3];var PATH=process['argv'][0x4];var NAME=process[_0x0d8b('0x7')][0x5];var FORMAT=_0x0d8b('0x8');var _extractedReport;function analyticExtractedReport(_0x58e4e2,_0x129310){var _0x348e65={'status':_0x58e4e2};var _0x3b027f={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x129310){_0x348e65[_0x0d8b('0x9')]=_0x129310;}return db[_0x0d8b('0xa')][_0x0d8b('0xb')](_0x348e65,_0x3b027f);}function getHeader(_0x2c5e9e){var _0x28f87c=[];for(var _0x48fa16 in _0x2c5e9e){if(_0x2c5e9e[_0x0d8b('0xc')](_0x48fa16)){_0x28f87c['push']({'text':_0x48fa16,'style':_0x0d8b('0xd')});}}return _0x28f87c;}function extractReport(_0xc574a3){var _0x340cc4=0x1388;var _0x92cdd8;if(!_0xc574a3[0x0][_0x0d8b('0xe')]){return analyticExtractedReport(_0x0d8b('0xf'));}var _0x15dd0f=[];var _0x31a8cc=0x0;var _0x1d4bbc=!![];var _0x2ce75e=path[_0x0d8b('0x10')](PATH);var _0xe65334=path[_0x0d8b('0x11')](PATH,_0x0d8b('0x12'));var _0x4f6f21=![];var _0x23eb7b=[];return db[_0x0d8b('0x13')][_0x0d8b('0x14')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x0d8b('0x15'),_0x0d8b('0x16')]})['then'](function(_0x106a01){if(_0x106a01){_0x92cdd8=_0x106a01;_0x340cc4=_0x92cdd8[_0x0d8b('0x16')]||0x3e8;}})[_0x0d8b('0x17')](function(){if(_0xc574a3&&_0xc574a3[_0x0d8b('0x18')]){var _0x333674=_0xc574a3[0x0][_0x0d8b('0xe')]%(_0x31a8cc+_0x340cc4);if(_0x92cdd8[_0x0d8b('0x15')]){for(;_0x1d4bbc;_0x31a8cc+=_0x340cc4,_0x333674=_0xc574a3[0x0][_0x0d8b('0xe')]%(_0x31a8cc+_0x340cc4)){if(_0x333674==0x0||_0x333674==_0xc574a3[0x0]['num']){_0x1d4bbc=![];}_0x15dd0f[_0x0d8b('0x19')](dbH[_0x0d8b('0x1a')][_0x0d8b('0x1b')](util[_0x0d8b('0x1c')](_0x0d8b('0x1d'),QUERY,_0x340cc4,_0x31a8cc),{'type':dbH[_0x0d8b('0x1a')][_0x0d8b('0x1e')][_0x0d8b('0x1f')]}));}}else{_0x15dd0f['push'](dbH['sequelize'][_0x0d8b('0x1b')](QUERY,{'type':dbH['sequelize']['QueryTypes']['SELECT']}));}}_0x4f6f21=_0x92cdd8[_0x0d8b('0x15')]&&_0x15dd0f[_0x0d8b('0x18')]>0x1;if(!fs[_0x0d8b('0x20')](path[_0x0d8b('0x21')](_0x2ce75e,_0xe65334))&&_0x4f6f21){fs[_0x0d8b('0x22')](path[_0x0d8b('0x21')](_0x2ce75e,_0xe65334));}return BPromise[_0x0d8b('0x23')](_0x15dd0f,function(_0x4562cb){_0x23eb7b[_0x0d8b('0x19')](_0x4562cb);});})['then'](function(){return BPromise[_0x0d8b('0x23')](_0x15dd0f,function(_0x4463ee,_0x5363e3){var _0xe1ef20;var _0x4a0ae4=util[_0x0d8b('0x1c')](_0x0d8b('0x24'),NAME,_extractedReport[_0x0d8b('0x25')],moment(_extractedReport['startDate'])['format'](FORMAT),moment(_extractedReport[_0x0d8b('0x26')])[_0x0d8b('0x1c')](FORMAT));var _0x4c05ee={'pageSize':'A4','pageOrientation':_0x0d8b('0x27'),'content':[{'text':_0x4a0ae4,'style':'header'}],'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x0d8b('0x28')}}};var _0x4b59e5={'headerRows':0x1,'body':[]};_0x4b59e5[_0x0d8b('0x29')]['push'](getHeader(_0x4463ee[0x0]));var _0x2ab00d;for(var _0x546bf6=0x0;_0x546bf6<_0x4463ee[_0x0d8b('0x18')];_0x546bf6+=0x1){_0x2ab00d=[];for(var _0x544735 in _0x4463ee[_0x546bf6]){if(_0x4463ee[_0x546bf6][_0x0d8b('0xc')](_0x544735)){_0x2ab00d[_0x0d8b('0x19')](_0x4463ee[_0x546bf6][_0x544735]?_[_0x0d8b('0x2a')](_0x4463ee[_0x546bf6][_0x544735]):'');}}_0x4b59e5['body']['push'](_0x2ab00d);}_0x4c05ee['content'][_0x0d8b('0x19')]({'table':_0x4b59e5});return new BPromise(function(_0x5515d2,_0x3cdf3c){var _0x54f6f3=new PdfPrinter({'Roboto':{'normal':__dirname+'/fonts/Roboto-Regular.ttf','bold':__dirname+_0x0d8b('0x2b'),'italics':__dirname+_0x0d8b('0x2c'),'bolditalics':__dirname+_0x0d8b('0x2d')}});var _0xdeee5d=_0x54f6f3[_0x0d8b('0x2e')](_0x4c05ee);if(_0x4f6f21){_0xe1ef20=path[_0x0d8b('0x21')](_0x2ce75e,_0xe65334,util[_0x0d8b('0x1c')](_0x0d8b('0x2f'),_0xe65334,_0x5363e3,'pdf'));}else{_0xe1ef20=path[_0x0d8b('0x21')](_0x2ce75e,util[_0x0d8b('0x1c')]('%s.%s',_0xe65334,_0x0d8b('0x30')));}var _0x23f7f6=_0xdeee5d[_0x0d8b('0x31')](fs['createWriteStream'](_0xe1ef20));_0x23f7f6['on'](_0x0d8b('0x32'),function(){_0x5515d2();});_0x23f7f6['on'](_0x0d8b('0x33'),function(_0x206157){console[_0x0d8b('0x34')](_0x0d8b('0x35'),_0x206157);_0x3cdf3c(_0x206157);});_0xdeee5d['end']();});});})[_0x0d8b('0x17')](function(){if(_0x4f6f21){return new BPromise(function(_0x1649fc,_0x5ad0fe){zipdir(path[_0x0d8b('0x21')](_0x2ce75e,_0xe65334),{'saveTo':path[_0x0d8b('0x21')](_0x2ce75e,util[_0x0d8b('0x1c')](_0x0d8b('0x36'),_0xe65334,_0x0d8b('0x37')))},function(_0x519088){if(_0x519088){_0x5ad0fe(_0x519088);}else{_0x1649fc();}});});}})['then'](function(){if(_0x4f6f21){rimraf(path[_0x0d8b('0x21')](_0x2ce75e,_0xe65334),function(){});}})['then'](function(){logger['info'](util[_0x0d8b('0x1c')](_0x0d8b('0x38'),EXTRACTED_REPORT_ID,_0x0d8b('0x39')));return analyticExtractedReport(_0x0d8b('0x3a'),_0x4f6f21?util[_0x0d8b('0x1c')](_0x0d8b('0x36'),_0xe65334,_0x4f6f21?'zip':_0x0d8b('0x30')):null);});}function main(){logger[_0x0d8b('0x3b')](util[_0x0d8b('0x1c')](_0x0d8b('0x3c'),EXTRACTED_REPORT_ID,_0x0d8b('0x3d')));return db[_0x0d8b('0xa')][_0x0d8b('0x3e')]({'where':{'id':EXTRACTED_REPORT_ID}})['then'](function(_0x1d06b6){_extractedReport=_0x1d06b6;return dbH[_0x0d8b('0x1a')][_0x0d8b('0x1b')](util[_0x0d8b('0x1c')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x0d8b('0x1a')]['QueryTypes'][_0x0d8b('0x1f')]});})[_0x0d8b('0x17')](extractReport)[_0x0d8b('0x3f')](function(_0x26ac10){logger[_0x0d8b('0x3b')](util[_0x0d8b('0x1c')](_0x0d8b('0x40'),EXTRACTED_REPORT_ID,_0x0d8b('0x3d')),util[_0x0d8b('0x41')](_0x26ac10,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0x0d8b('0x42'));});}main(); \ No newline at end of file +var _0xd8b0=['format','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','existsSync','join','mkdirSync','each','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','endDate','landscape','black','body','toString','/fonts/Roboto-Medium.ttf','/fonts/Roboto-Italic.ttf','/fonts/Roboto-MediumItalic.ttf','createPdfKitDocument','%s%d.%s','pdf','pipe','finish','error','log','err','%s.%s','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','CSV','Completed','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','PDF','findOne','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','lodash','bluebird','pdfmake/src/printer','zip-dir','rimraf','../../mysqldb','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','update','hasOwnProperty','tableHeader','num','Empty','dirname','basename','.pdf','Setting','find','split','splitSizePdf','then','length','push','sequelize','query'];(function(_0x73e343,_0x27e1dd){var _0x107391=function(_0x3efd4b){while(--_0x3efd4b){_0x73e343['push'](_0x73e343['shift']());}};_0x107391(++_0x27e1dd);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var fs=require('fs');var BPromise=require(_0x0d8b('0x1'));var util=require('util');var path=require('path');var moment=require('moment');var PdfPrinter=require(_0x0d8b('0x2'));var zipdir=require(_0x0d8b('0x3'));var rimraf=require(_0x0d8b('0x4'));var db=require(_0x0d8b('0x5'))['db'];var dbH=require(_0x0d8b('0x5'))['dbH'];var logger=require('../../config/logger')(_0x0d8b('0x6'));var EXTRACTED_REPORT_ID=Number(process[_0x0d8b('0x7')][0x2]);var QUERY=process[_0x0d8b('0x7')][0x3];var PATH=process['argv'][0x4];var NAME=process[_0x0d8b('0x7')][0x5];var FORMAT=_0x0d8b('0x8');var _extractedReport;function analyticExtractedReport(_0x58e4e2,_0x129310){var _0x348e65={'status':_0x58e4e2};var _0x3b027f={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x129310){_0x348e65[_0x0d8b('0x9')]=_0x129310;}return db[_0x0d8b('0xa')][_0x0d8b('0xb')](_0x348e65,_0x3b027f);}function getHeader(_0x2c5e9e){var _0x28f87c=[];for(var _0x48fa16 in _0x2c5e9e){if(_0x2c5e9e[_0x0d8b('0xc')](_0x48fa16)){_0x28f87c['push']({'text':_0x48fa16,'style':_0x0d8b('0xd')});}}return _0x28f87c;}function extractReport(_0xc574a3){var _0x340cc4=0x1388;var _0x92cdd8;if(!_0xc574a3[0x0][_0x0d8b('0xe')]){return analyticExtractedReport(_0x0d8b('0xf'));}var _0x15dd0f=[];var _0x31a8cc=0x0;var _0x1d4bbc=!![];var _0x2ce75e=path[_0x0d8b('0x10')](PATH);var _0xe65334=path[_0x0d8b('0x11')](PATH,_0x0d8b('0x12'));var _0x4f6f21=![];var _0x23eb7b=[];return db[_0x0d8b('0x13')][_0x0d8b('0x14')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x0d8b('0x15'),_0x0d8b('0x16')]})['then'](function(_0x106a01){if(_0x106a01){_0x92cdd8=_0x106a01;_0x340cc4=_0x92cdd8[_0x0d8b('0x16')]||0x3e8;}})[_0x0d8b('0x17')](function(){if(_0xc574a3&&_0xc574a3[_0x0d8b('0x18')]){var _0x333674=_0xc574a3[0x0][_0x0d8b('0xe')]%(_0x31a8cc+_0x340cc4);if(_0x92cdd8[_0x0d8b('0x15')]){for(;_0x1d4bbc;_0x31a8cc+=_0x340cc4,_0x333674=_0xc574a3[0x0][_0x0d8b('0xe')]%(_0x31a8cc+_0x340cc4)){if(_0x333674==0x0||_0x333674==_0xc574a3[0x0]['num']){_0x1d4bbc=![];}_0x15dd0f[_0x0d8b('0x19')](dbH[_0x0d8b('0x1a')][_0x0d8b('0x1b')](util[_0x0d8b('0x1c')](_0x0d8b('0x1d'),QUERY,_0x340cc4,_0x31a8cc),{'type':dbH[_0x0d8b('0x1a')][_0x0d8b('0x1e')][_0x0d8b('0x1f')]}));}}else{_0x15dd0f['push'](dbH['sequelize'][_0x0d8b('0x1b')](QUERY,{'type':dbH['sequelize']['QueryTypes']['SELECT']}));}}_0x4f6f21=_0x92cdd8[_0x0d8b('0x15')]&&_0x15dd0f[_0x0d8b('0x18')]>0x1;if(!fs[_0x0d8b('0x20')](path[_0x0d8b('0x21')](_0x2ce75e,_0xe65334))&&_0x4f6f21){fs[_0x0d8b('0x22')](path[_0x0d8b('0x21')](_0x2ce75e,_0xe65334));}return BPromise[_0x0d8b('0x23')](_0x15dd0f,function(_0x4562cb){_0x23eb7b[_0x0d8b('0x19')](_0x4562cb);});})['then'](function(){return BPromise[_0x0d8b('0x23')](_0x15dd0f,function(_0x4463ee,_0x5363e3){var _0xe1ef20;var _0x4a0ae4=util[_0x0d8b('0x1c')](_0x0d8b('0x24'),NAME,_extractedReport[_0x0d8b('0x25')],moment(_extractedReport['startDate'])['format'](FORMAT),moment(_extractedReport[_0x0d8b('0x26')])[_0x0d8b('0x1c')](FORMAT));var _0x4c05ee={'pageSize':'A4','pageOrientation':_0x0d8b('0x27'),'content':[{'text':_0x4a0ae4,'style':'header'}],'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x0d8b('0x28')}}};var _0x4b59e5={'headerRows':0x1,'body':[]};_0x4b59e5[_0x0d8b('0x29')]['push'](getHeader(_0x4463ee[0x0]));var _0x2ab00d;for(var _0x546bf6=0x0;_0x546bf6<_0x4463ee[_0x0d8b('0x18')];_0x546bf6+=0x1){_0x2ab00d=[];for(var _0x544735 in _0x4463ee[_0x546bf6]){if(_0x4463ee[_0x546bf6][_0x0d8b('0xc')](_0x544735)){_0x2ab00d[_0x0d8b('0x19')](_0x4463ee[_0x546bf6][_0x544735]?_[_0x0d8b('0x2a')](_0x4463ee[_0x546bf6][_0x544735]):'');}}_0x4b59e5['body']['push'](_0x2ab00d);}_0x4c05ee['content'][_0x0d8b('0x19')]({'table':_0x4b59e5});return new BPromise(function(_0x5515d2,_0x3cdf3c){var _0x54f6f3=new PdfPrinter({'Roboto':{'normal':__dirname+'/fonts/Roboto-Regular.ttf','bold':__dirname+_0x0d8b('0x2b'),'italics':__dirname+_0x0d8b('0x2c'),'bolditalics':__dirname+_0x0d8b('0x2d')}});var _0xdeee5d=_0x54f6f3[_0x0d8b('0x2e')](_0x4c05ee);if(_0x4f6f21){_0xe1ef20=path[_0x0d8b('0x21')](_0x2ce75e,_0xe65334,util[_0x0d8b('0x1c')](_0x0d8b('0x2f'),_0xe65334,_0x5363e3,'pdf'));}else{_0xe1ef20=path[_0x0d8b('0x21')](_0x2ce75e,util[_0x0d8b('0x1c')]('%s.%s',_0xe65334,_0x0d8b('0x30')));}var _0x23f7f6=_0xdeee5d[_0x0d8b('0x31')](fs['createWriteStream'](_0xe1ef20));_0x23f7f6['on'](_0x0d8b('0x32'),function(){_0x5515d2();});_0x23f7f6['on'](_0x0d8b('0x33'),function(_0x206157){console[_0x0d8b('0x34')](_0x0d8b('0x35'),_0x206157);_0x3cdf3c(_0x206157);});_0xdeee5d['end']();});});})[_0x0d8b('0x17')](function(){if(_0x4f6f21){return new BPromise(function(_0x1649fc,_0x5ad0fe){zipdir(path[_0x0d8b('0x21')](_0x2ce75e,_0xe65334),{'saveTo':path[_0x0d8b('0x21')](_0x2ce75e,util[_0x0d8b('0x1c')](_0x0d8b('0x36'),_0xe65334,_0x0d8b('0x37')))},function(_0x519088){if(_0x519088){_0x5ad0fe(_0x519088);}else{_0x1649fc();}});});}})['then'](function(){if(_0x4f6f21){rimraf(path[_0x0d8b('0x21')](_0x2ce75e,_0xe65334),function(){});}})['then'](function(){logger['info'](util[_0x0d8b('0x1c')](_0x0d8b('0x38'),EXTRACTED_REPORT_ID,_0x0d8b('0x39')));return analyticExtractedReport(_0x0d8b('0x3a'),_0x4f6f21?util[_0x0d8b('0x1c')](_0x0d8b('0x36'),_0xe65334,_0x4f6f21?'zip':_0x0d8b('0x30')):null);});}function main(){logger[_0x0d8b('0x3b')](util[_0x0d8b('0x1c')](_0x0d8b('0x3c'),EXTRACTED_REPORT_ID,_0x0d8b('0x3d')));return db[_0x0d8b('0xa')][_0x0d8b('0x3e')]({'where':{'id':EXTRACTED_REPORT_ID}})['then'](function(_0x1d06b6){_extractedReport=_0x1d06b6;return dbH[_0x0d8b('0x1a')][_0x0d8b('0x1b')](util[_0x0d8b('0x1c')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x0d8b('0x1a')]['QueryTypes'][_0x0d8b('0x1f')]});})[_0x0d8b('0x17')](extractReport)[_0x0d8b('0x3f')](function(_0x26ac10){logger[_0x0d8b('0x3b')](util[_0x0d8b('0x1c')](_0x0d8b('0x40'),EXTRACTED_REPORT_ID,_0x0d8b('0x3d')),util[_0x0d8b('0x41')](_0x26ac10,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0x0d8b('0x42'));});}main(); \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index 457dfba..eadac6d 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 _0xbdde=['savename','AnalyticExtractedReport','update','info','format','XLSX','Setting','find','split','splitSizeXlsx','then','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','sequelize','num','Empty','length','%s\x20limit\x20%d\x20OFFSET\x20%d','push','QueryTypes','SELECT','dirname','basename','.xlsx','existsSync','join','mkdirSync','each','%s%d.%s','%s.%s','binary','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','xlsx','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','bluebird','rimraf','../../mysqldb','../../config/logger','analytics','argv'];(function(_0x4a660a,_0x29426a){var _0x7c11ae=function(_0xe68e47){while(--_0xe68e47){_0x4a660a['push'](_0x4a660a['shift']());}};_0x7c11ae(++_0x29426a);}(_0xbdde,0x12e));var _0xebdd=function(_0x1ebb10,_0x156b3e){_0x1ebb10=_0x1ebb10-0x0;var _0x20d709=_0xbdde[_0x1ebb10];return _0x20d709;};'use strict';var util=require('util');var path=require('path');var _=require('lodash');var fs=require('fs');var json2xls=require('json2xls');var BPromise=require(_0xebdd('0x0'));var zipdir=require('zip-dir');var rimraf=require(_0xebdd('0x1'));var db=require(_0xebdd('0x2'))['db'];var dbH=require(_0xebdd('0x2'))['dbH'];var logger=require(_0xebdd('0x3'))(_0xebdd('0x4'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0xebdd('0x5')][0x3];var PATH=process[_0xebdd('0x5')][0x4];function analyticExtractedReport(_0x23ae90,_0x4f7f1a){var _0x654a82={'status':_0x23ae90};var _0x534021={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x4f7f1a){_0x654a82[_0xebdd('0x6')]=_0x4f7f1a;}return db[_0xebdd('0x7')][_0xebdd('0x8')](_0x654a82,_0x534021);}function main(){var _0x341ca5=0x1388;var _0x5e1cbf;logger[_0xebdd('0x9')](util[_0xebdd('0xa')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xebdd('0xb')));return db[_0xebdd('0xc')][_0xebdd('0xd')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xebdd('0xe'),_0xebdd('0xf')]})['then'](function(_0x7e35ac){if(_0x7e35ac){_0x5e1cbf=_0x7e35ac;_0x341ca5=_0x5e1cbf[_0xebdd('0xf')]||0x1388;}})[_0xebdd('0x10')](function(){return dbH['sequelize'][_0xebdd('0x11')](util['format'](_0xebdd('0x12'),QUERY),{'type':dbH[_0xebdd('0x13')]['QueryTypes']['SELECT']});})['then'](function(_0x1bc740){if(!_0x1bc740[0x0][_0xebdd('0x14')]){return analyticExtractedReport(_0xebdd('0x15'));}var _0x747cb5=[];var _0x40bd6e=0x0;var _0x53ce12=!![];if(_0x5e1cbf['split']){if(_0x1bc740&&_0x1bc740[_0xebdd('0x16')]){var _0x37b220=_0x1bc740[0x0]['num']%(_0x40bd6e+_0x341ca5);for(;_0x53ce12;_0x40bd6e+=_0x341ca5,_0x37b220=_0x1bc740[0x0][_0xebdd('0x14')]%(_0x40bd6e+_0x341ca5)){if(_0x37b220==0x0||_0x37b220==_0x1bc740[0x0][_0xebdd('0x14')]){_0x53ce12=![];}_0x747cb5['push'](dbH[_0xebdd('0x13')][_0xebdd('0x11')](util[_0xebdd('0xa')](_0xebdd('0x17'),QUERY,_0x341ca5,_0x40bd6e),{'type':dbH[_0xebdd('0x13')]['QueryTypes']['SELECT']}));}}}else{_0x747cb5[_0xebdd('0x18')](dbH[_0xebdd('0x13')]['query'](QUERY,{'type':dbH[_0xebdd('0x13')][_0xebdd('0x19')][_0xebdd('0x1a')]}));}var _0xc6edab=path[_0xebdd('0x1b')](PATH);var _0x295d51=path[_0xebdd('0x1c')](PATH,_0xebdd('0x1d'));var _0x35b898=_0x5e1cbf[_0xebdd('0xe')]&&_0x747cb5[_0xebdd('0x16')]>0x1;var _0x4ac289=[];if(!fs[_0xebdd('0x1e')](path[_0xebdd('0x1f')](_0xc6edab,_0x295d51))&&_0x35b898){fs[_0xebdd('0x20')](path['join'](_0xc6edab,_0x295d51));}return BPromise[_0xebdd('0x21')](_0x747cb5,function(_0x33d18c){_0x4ac289[_0xebdd('0x18')](_0x33d18c);})['then'](function(){for(var _0x3b3fcd=0x0;_0x3b3fcd<_0x4ac289[_0xebdd('0x16')];_0x3b3fcd+=0x1){var _0x26045f;var _0x32c075=_0x4ac289[_0x3b3fcd];if(_0x35b898){_0x26045f=path[_0xebdd('0x1f')](_0xc6edab,_0x295d51,util['format'](_0xebdd('0x22'),_0x295d51,_0x3b3fcd,'xlsx'));}else{_0x26045f=path[_0xebdd('0x1f')](_0xc6edab,util[_0xebdd('0xa')](_0xebdd('0x23'),_0x295d51,'xlsx'));}fs['writeFileSync'](_0x26045f,json2xls(_0x32c075),_0xebdd('0x24'));}})['then'](function(){if(_0x35b898){zipdir(path['join'](_0xc6edab,_0x295d51),{'saveTo':path['join'](_0xc6edab,util[_0xebdd('0xa')](_0xebdd('0x23'),_0x295d51,_0xebdd('0x25')))},function(_0x785744,_0x246a4c){});rimraf(path[_0xebdd('0x1f')](_0xc6edab,_0x295d51),function(){});}})['then'](function(){logger['info'](util['format'](_0xebdd('0x26'),EXTRACTED_REPORT_ID,_0xebdd('0xb')));return analyticExtractedReport('Completed',_0x35b898?util[_0xebdd('0xa')](_0xebdd('0x23'),_0x295d51,_0x35b898?'zip':_0xebdd('0x27')):null);});})[_0xebdd('0x28')](function(_0x290cf2){logger[_0xebdd('0x9')](util[_0xebdd('0xa')](_0xebdd('0x29'),EXTRACTED_REPORT_ID,_0xebdd('0xb')),util[_0xebdd('0x2a')](_0x290cf2,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0xebdd('0x2b'));});}main(); \ No newline at end of file +var _0x0d68=['zip-dir','../../mysqldb','dbH','../../config/logger','argv','AnalyticExtractedReport','update','info','format','XLSX','Setting','find','split','splitSizeXlsx','then','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','sequelize','QueryTypes','num','length','push','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','dirname','join','each','%s%d.%s','xlsx','%s.%s','writeFileSync','binary','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','catch','inspect','Failed','util','path','lodash','json2xls'];(function(_0x18e570,_0x257e84){var _0x2a421e=function(_0x5cb790){while(--_0x5cb790){_0x18e570['push'](_0x18e570['shift']());}};_0x2a421e(++_0x257e84);}(_0x0d68,0x144));var _0x80d6=function(_0x53f2d7,_0x2f4ce8){_0x53f2d7=_0x53f2d7-0x0;var _0x4e252a=_0x0d68[_0x53f2d7];return _0x4e252a;};'use strict';var util=require(_0x80d6('0x0'));var path=require(_0x80d6('0x1'));var _=require(_0x80d6('0x2'));var fs=require('fs');var json2xls=require(_0x80d6('0x3'));var BPromise=require('bluebird');var zipdir=require(_0x80d6('0x4'));var rimraf=require('rimraf');var db=require(_0x80d6('0x5'))['db'];var dbH=require(_0x80d6('0x5'))[_0x80d6('0x6')];var logger=require(_0x80d6('0x7'))('analytics');var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x80d6('0x8')][0x3];var PATH=process[_0x80d6('0x8')][0x4];function analyticExtractedReport(_0x1558a4,_0x900605){var _0x4e9afa={'status':_0x1558a4};var _0x115749={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x900605){_0x4e9afa['savename']=_0x900605;}return db[_0x80d6('0x9')][_0x80d6('0xa')](_0x4e9afa,_0x115749);}function main(){var _0x40e1dd=0x1388;var _0x4c30a6;logger[_0x80d6('0xb')](util[_0x80d6('0xc')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x80d6('0xd')));return db[_0x80d6('0xe')][_0x80d6('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x80d6('0x10'),_0x80d6('0x11')]})[_0x80d6('0x12')](function(_0x1a00ab){if(_0x1a00ab){_0x4c30a6=_0x1a00ab;_0x40e1dd=_0x4c30a6[_0x80d6('0x11')]||0x1388;}})[_0x80d6('0x12')](function(){return dbH['sequelize'][_0x80d6('0x13')](util[_0x80d6('0xc')](_0x80d6('0x14'),QUERY),{'type':dbH[_0x80d6('0x15')][_0x80d6('0x16')]['SELECT']});})[_0x80d6('0x12')](function(_0x238312){if(!_0x238312[0x0][_0x80d6('0x17')]){return analyticExtractedReport('Empty');}var _0x4fe61f=[];var _0x1aa72f=0x0;var _0x2565f4=!![];if(_0x4c30a6['split']){if(_0x238312&&_0x238312[_0x80d6('0x18')]){var _0x129d61=_0x238312[0x0]['num']%(_0x1aa72f+_0x40e1dd);for(;_0x2565f4;_0x1aa72f+=_0x40e1dd,_0x129d61=_0x238312[0x0][_0x80d6('0x17')]%(_0x1aa72f+_0x40e1dd)){if(_0x129d61==0x0||_0x129d61==_0x238312[0x0][_0x80d6('0x17')]){_0x2565f4=![];}_0x4fe61f[_0x80d6('0x19')](dbH[_0x80d6('0x15')][_0x80d6('0x13')](util[_0x80d6('0xc')](_0x80d6('0x1a'),QUERY,_0x40e1dd,_0x1aa72f),{'type':dbH[_0x80d6('0x15')][_0x80d6('0x16')][_0x80d6('0x1b')]}));}}}else{_0x4fe61f['push'](dbH[_0x80d6('0x15')][_0x80d6('0x13')](QUERY,{'type':dbH[_0x80d6('0x15')]['QueryTypes'][_0x80d6('0x1b')]}));}var _0x3f811f=path[_0x80d6('0x1c')](PATH);var _0x5290b7=path['basename'](PATH,'.xlsx');var _0x2a90fa=_0x4c30a6[_0x80d6('0x10')]&&_0x4fe61f[_0x80d6('0x18')]>0x1;var _0x5c88bf=[];if(!fs['existsSync'](path[_0x80d6('0x1d')](_0x3f811f,_0x5290b7))&&_0x2a90fa){fs['mkdirSync'](path[_0x80d6('0x1d')](_0x3f811f,_0x5290b7));}return BPromise[_0x80d6('0x1e')](_0x4fe61f,function(_0x2634de){_0x5c88bf[_0x80d6('0x19')](_0x2634de);})[_0x80d6('0x12')](function(){for(var _0x3ed1fc=0x0;_0x3ed1fc<_0x5c88bf[_0x80d6('0x18')];_0x3ed1fc+=0x1){var _0xcc204c;var _0x4632bf=_0x5c88bf[_0x3ed1fc];if(_0x2a90fa){_0xcc204c=path[_0x80d6('0x1d')](_0x3f811f,_0x5290b7,util['format'](_0x80d6('0x1f'),_0x5290b7,_0x3ed1fc,_0x80d6('0x20')));}else{_0xcc204c=path['join'](_0x3f811f,util[_0x80d6('0xc')](_0x80d6('0x21'),_0x5290b7,'xlsx'));}fs[_0x80d6('0x22')](_0xcc204c,json2xls(_0x4632bf),_0x80d6('0x23'));}})[_0x80d6('0x12')](function(){if(_0x2a90fa){zipdir(path['join'](_0x3f811f,_0x5290b7),{'saveTo':path[_0x80d6('0x1d')](_0x3f811f,util[_0x80d6('0xc')](_0x80d6('0x21'),_0x5290b7,_0x80d6('0x24')))},function(_0x54d8ce,_0x3d1330){});rimraf(path['join'](_0x3f811f,_0x5290b7),function(){});}})[_0x80d6('0x12')](function(){logger[_0x80d6('0xb')](util[_0x80d6('0xc')](_0x80d6('0x25'),EXTRACTED_REPORT_ID,_0x80d6('0xd')));return analyticExtractedReport('Completed',_0x2a90fa?util[_0x80d6('0xc')]('%s.%s',_0x5290b7,_0x2a90fa?'zip':'xlsx'):null);});})[_0x80d6('0x26')](function(_0x306dd9){logger['info'](util[_0x80d6('0xc')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'XLSX'),util[_0x80d6('0x27')](_0x306dd9,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0x80d6('0x28'));});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index 7d0f6fe..2cc6497 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 _0x0e6b=['updatedAt','interval','*,*,*,*','intervals','tag','CDR(tag)=','callerID','ExecIf','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','appType','custom','XCALLY-MOTION-ANSWER=1','XCALLY-MOTION-PROGRESS=1','splice',',${EXTEN},','last','concat','Hangup','transaction','bulkCreate','sortBy','catch','rewrite','lodash','models','Interval','findAll','then','VoiceExtension','IntervalId','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','queue','hasOwnProperty','priority','extensions','extension','find','push','Set','format','CDR(type)=%s','type','context','VoiceExtensionId','outbound','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','CDR(routeid)=','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','createdAt'];(function(_0x5017c0,_0x1a6afd){var _0x58962d=function(_0x328195){while(--_0x328195){_0x5017c0['push'](_0x5017c0['shift']());}};_0x58962d(++_0x1a6afd);}(_0x0e6b,0x17d));var _0xb0e6=function(_0x1139d0,_0x41e5f8){_0x1139d0=_0x1139d0-0x0;var _0xcc01a6=_0x0e6b[_0x1139d0];return _0xcc01a6;};'use strict';var _=require(_0xb0e6('0x0'));var util=require('util');function rewrite(_0x2288f7,_0x5077db){var _0xa90122=this;return _0x2288f7[_0xb0e6('0x1')][_0xb0e6('0x2')][_0xb0e6('0x3')]({'raw':!![]})[_0xb0e6('0x4')](function(_0x34bbe0){_0xa90122['intervals']=_0x34bbe0;return _0x2288f7[_0xb0e6('0x1')][_0xb0e6('0x5')][_0xb0e6('0x3')]({'where':{'IntervalId':_0x5077db[_0xb0e6('0x6')]},'raw':!![]});})['then'](function(_0x1844be){return _0x2288f7['models'][_0xb0e6('0x5')][_0xb0e6('0x3')]({'where':{'exten':{'$in':_[_0xb0e6('0x7')](_[_0xb0e6('0x8')](_0x1844be,_0xb0e6('0x9')))}},'order':[{'raw':_0xb0e6('0xa')}],'raw':!![]});})['then'](function(_0x457081){var _0x4c66a3=_[_0xb0e6('0xb')](_0x457081,{'priority':'1'});var _0x1f83cf=_[_0xb0e6('0xb')](_0x457081,{'isApp':0x1});var _0x34f365=_[_0xb0e6('0xc')](_0x1f83cf,_0xb0e6('0x9'));var _0x48f67b=[_0xb0e6('0xd'),'playback'];var _0x1e69ab=[];var _0x2bf322=[];for(var _0x4e5577 in _0x34f365){if(_0x34f365[_0xb0e6('0xe')](_0x4e5577)){_0xa90122[_0xb0e6('0xf')]=0x2;_0xa90122[_0xb0e6('0x10')]=[];_0xa90122[_0xb0e6('0x11')]=_[_0xb0e6('0x12')](_0x4c66a3,{'exten':_0x34f365[_0x4e5577][0x0][_0xb0e6('0x9')]});_0xa90122[_0xb0e6('0x10')][_0xb0e6('0x13')]({'type':_0x34f365[_0x4e5577][0x0]['type'],'app':_0xb0e6('0x14'),'appdata':util[_0xb0e6('0x15')](_0xb0e6('0x16'),_0x34f365[_0x4e5577][0x0][_0xb0e6('0x17')]),'context':_0x34f365[_0x4e5577][0x0][_0xb0e6('0x18')],'exten':_0x34f365[_0x4e5577][0x0][_0xb0e6('0x9')],'priority':_0xa90122['priority']++,'VoiceExtensionId':_0x34f365[_0x4e5577][0x0][_0xb0e6('0x19')]});if(_0x34f365[_0x4e5577][0x0][_0xb0e6('0x17')]===_0xb0e6('0x1a')){if(_0xa90122['extension']){_0xa90122[_0xb0e6('0x10')][_0xb0e6('0x13')]({'type':_0x34f365[_0x4e5577][0x0][_0xb0e6('0x17')],'app':_0xb0e6('0x14'),'appdata':_0xb0e6('0x1b')+(_0xa90122[_0xb0e6('0x11')][_0xb0e6('0x1c')]?_0xb0e6('0x1d')+_0xa90122[_0xb0e6('0x11')]['cutdigits']+'}':_0xb0e6('0x1e')),'context':_0x34f365[_0x4e5577][0x0][_0xb0e6('0x18')],'exten':_0x34f365[_0x4e5577][0x0][_0xb0e6('0x9')],'priority':_0xa90122[_0xb0e6('0xf')]++,'VoiceExtensionId':_0x34f365[_0x4e5577][0x0]['VoiceExtensionId']});}_0xa90122[_0xb0e6('0x10')][_0xb0e6('0x13')]({'type':_0x34f365[_0x4e5577][0x0][_0xb0e6('0x17')],'app':_0xb0e6('0x14'),'appdata':_0xb0e6('0x1f')+_0x34f365[_0x4e5577][0x0][_0xb0e6('0x19')],'context':_0x34f365[_0x4e5577][0x0][_0xb0e6('0x18')],'exten':_0x34f365[_0x4e5577][0x0][_0xb0e6('0x9')],'priority':_0xa90122['priority']++,'VoiceExtensionId':_0x34f365[_0x4e5577][0x0][_0xb0e6('0x19')]});var _0x5d1f05=_0xa90122[_0xb0e6('0xf')]++;_0xa90122['extensions'][_0xb0e6('0x13')]({'type':_0x34f365[_0x4e5577][0x0][_0xb0e6('0x17')],'app':'ExecIf','appdata':_0xb0e6('0x20')+(_0x5d1f05+0x2)+'):Goto('+(_0x5d1f05+0x1)+')','context':_0x34f365[_0x4e5577][0x0][_0xb0e6('0x18')],'exten':_0x34f365[_0x4e5577][0x0][_0xb0e6('0x9')],'priority':_0x5d1f05,'VoiceExtensionId':_0x34f365[_0x4e5577][0x0][_0xb0e6('0x19')]});if(_0xa90122[_0xb0e6('0x11')]){_0xa90122[_0xb0e6('0x10')][_0xb0e6('0x13')]({'type':_0x34f365[_0x4e5577][0x0][_0xb0e6('0x17')],'app':_0xb0e6('0x14'),'appdata':_0xa90122[_0xb0e6('0x11')][_0xb0e6('0x1c')]?_0xb0e6('0x21')+_0xa90122[_0xb0e6('0x11')][_0xb0e6('0x1c')]+'}':_0xb0e6('0x22'),'context':_0x34f365[_0x4e5577][0x0][_0xb0e6('0x18')],'exten':_0x34f365[_0x4e5577][0x0][_0xb0e6('0x9')],'priority':_0xa90122[_0xb0e6('0xf')]++,'VoiceExtensionId':_0x34f365[_0x4e5577][0x0]['VoiceExtensionId']});}_0xa90122[_0xb0e6('0x10')][_0xb0e6('0x13')]({'type':_0x34f365[_0x4e5577][0x0]['type'],'app':_0xb0e6('0x14'),'appdata':'outboundrouteid='+_0x34f365[_0x4e5577][0x0]['VoiceExtensionId'],'context':_0x34f365[_0x4e5577][0x0][_0xb0e6('0x18')],'exten':_0x34f365[_0x4e5577][0x0][_0xb0e6('0x9')],'priority':_0xa90122[_0xb0e6('0xf')]++,'VoiceExtensionId':_0x34f365[_0x4e5577][0x0][_0xb0e6('0x19')]});if(_0xa90122['extension']&&_0xa90122['extension'][_0xb0e6('0xe')](_0xb0e6('0x23'))&&_0xa90122[_0xb0e6('0x11')][_0xb0e6('0x23')]!=='none'){_0xa90122[_0xb0e6('0x10')][_0xb0e6('0x13')]({'type':_0x34f365[_0x4e5577][0x0][_0xb0e6('0x17')],'app':_0xb0e6('0x14'),'appdata':_0xb0e6('0x24'),'context':_0x34f365[_0x4e5577][0x0][_0xb0e6('0x18')],'exten':_0x34f365[_0x4e5577][0x0][_0xb0e6('0x9')],'priority':_0xa90122[_0xb0e6('0xf')]++,'VoiceExtensionId':_0x34f365[_0x4e5577][0x0][_0xb0e6('0x19')]});_0xa90122[_0xb0e6('0x10')]['push']({'type':_0x34f365[_0x4e5577][0x0][_0xb0e6('0x17')],'app':_0xb0e6('0x14'),'appdata':_0xb0e6('0x25')+_0xa90122[_0xb0e6('0x11')]['recordingFormat']||_0xb0e6('0x26'),'context':_0x34f365[_0x4e5577][0x0][_0xb0e6('0x18')],'exten':_0x34f365[_0x4e5577][0x0][_0xb0e6('0x9')],'priority':_0xa90122[_0xb0e6('0xf')]++,'VoiceExtensionId':_0x34f365[_0x4e5577][0x0]['VoiceExtensionId']});}}_0xa90122['extensions']['push']({'type':_0x34f365[_0x4e5577][0x0][_0xb0e6('0x17')],'app':_0xb0e6('0x14'),'appdata':_0xb0e6('0x27'),'context':_0x34f365[_0x4e5577][0x0]['context'],'exten':_0x34f365[_0x4e5577][0x0]['exten'],'priority':_0xa90122[_0xb0e6('0xf')]++,'VoiceExtensionId':_0x34f365[_0x4e5577][0x0][_0xb0e6('0x19')]});_0xa90122[_0xb0e6('0x10')][_0xb0e6('0x13')]({'type':_0x34f365[_0x4e5577][0x0][_0xb0e6('0x17')],'app':_0xb0e6('0x14'),'appdata':_0xb0e6('0x28'),'context':_0x34f365[_0x4e5577][0x0]['context'],'exten':_0x34f365[_0x4e5577][0x0][_0xb0e6('0x9')],'priority':_0xa90122['priority']++,'VoiceExtensionId':_0x34f365[_0x4e5577][0x0][_0xb0e6('0x19')]});_0xa90122[_0xb0e6('0x10')]['push']({'type':_0x34f365[_0x4e5577][0x0][_0xb0e6('0x17')],'app':'Set','appdata':_0xb0e6('0x29'),'context':_0x34f365[_0x4e5577][0x0][_0xb0e6('0x18')],'exten':_0x34f365[_0x4e5577][0x0][_0xb0e6('0x9')],'priority':_0xa90122[_0xb0e6('0xf')]++,'VoiceExtensionId':_0x34f365[_0x4e5577][0x0][_0xb0e6('0x19')]});for(var _0x3e5e9d=0x0,_0x4c165d=0x0;_0x3e5e9d<_0x34f365[_0x4e5577][_0xb0e6('0x2a')];_0x3e5e9d+=0x1,_0x4c165d=0x0){var _0x4e597a=_0x34f365[_0x4e5577][_0x3e5e9d];if(_0x4e597a[_0xb0e6('0x17')]){_0x4e597a[_0xb0e6('0x17')]=_0x4e597a[_0xb0e6('0x17')][_0xb0e6('0x2b')]();}var _0x5bfca1=[];var _0x3a4113=[];delete _0x4e597a['id'];delete _0x4e597a[_0xb0e6('0x2c')];delete _0x4e597a[_0xb0e6('0x2d')];var _0x5630c9=_0x4e597a[_0xb0e6('0x2e')]!==_0xb0e6('0x2f')?[_0x4e597a[_0xb0e6('0x2e')]]:_0x4e597a[_0xb0e6('0x6')]?_[_0xb0e6('0x8')](_[_0xb0e6('0xb')](_0xa90122[_0xb0e6('0x30')],{'IntervalId':_0x4e597a[_0xb0e6('0x6')]}),_0xb0e6('0x2e')):[];if(_0x4e597a[_0xb0e6('0xe')](_0xb0e6('0x31'))){if(_0x4e597a['tag']&&_0x4e597a[_0xb0e6('0x31')]!=='--'){_0x5bfca1[_0xb0e6('0x13')]({'type':_0x4e597a['type'],'app':_0xb0e6('0x14'),'appdata':_0xb0e6('0x32')+_0x4e597a['tag'],'context':_0x4e597a[_0xb0e6('0x18')],'exten':_0x4e597a[_0xb0e6('0x9')],'priority':_0x5630c9[_0xb0e6('0x2a')]+_0xa90122[_0xb0e6('0xf')]+_0x4c165d++,'VoiceExtensionId':_0x4e597a[_0xb0e6('0x19')]});}}if(_0x4e597a[_0xb0e6('0x17')]===_0xb0e6('0x1a')&&_0x4e597a[_0xb0e6('0xe')](_0xb0e6('0x33'))){if(_0x4e597a[_0xb0e6('0x33')]){_0x5bfca1[_0xb0e6('0x13')]({'type':_0x4e597a['type'],'app':_0xb0e6('0x34'),'appdata':_0xb0e6('0x35')+_0x4e597a[_0xb0e6('0x33')]+')','context':_0x4e597a[_0xb0e6('0x18')],'exten':_0x4e597a['exten'],'priority':_0x5630c9[_0xb0e6('0x2a')]+_0xa90122[_0xb0e6('0xf')]+_0x4c165d++,'VoiceExtensionId':_0x4e597a[_0xb0e6('0x19')]});}else{_0x5bfca1[_0xb0e6('0x13')]({'type':_0x4e597a['type'],'app':_0xb0e6('0x34'),'appdata':_0xb0e6('0x36'),'context':_0x4e597a['context'],'exten':_0x4e597a[_0xb0e6('0x9')],'priority':_0x5630c9[_0xb0e6('0x2a')]+_0xa90122['priority']+_0x4c165d++,'VoiceExtensionId':_0x4e597a[_0xb0e6('0x19')]});}}if(_0x4e597a[_0xb0e6('0xe')](_0xb0e6('0x37'))){if(_0x48f67b[_0xb0e6('0x38')](_0x4e597a['app'][_0xb0e6('0x2b')]())>=0x0&&_0x4e597a[_0xb0e6('0x39')]!==_0xb0e6('0x3a')){if(_0x4e597a[_0xb0e6('0x37')]){_0x5bfca1[_0xb0e6('0x13')]({'type':_0x4e597a[_0xb0e6('0x17')],'app':_0xb0e6('0x34'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x4e597a['context'],'exten':_0x4e597a[_0xb0e6('0x9')],'priority':_0x5630c9[_0xb0e6('0x2a')]+_0xa90122[_0xb0e6('0xf')]+_0x4c165d++,'VoiceExtensionId':_0x4e597a[_0xb0e6('0x19')]});_0x5bfca1[_0xb0e6('0x13')]({'type':_0x4e597a[_0xb0e6('0x17')],'app':_0xb0e6('0x14'),'appdata':_0xb0e6('0x3b'),'context':_0x4e597a[_0xb0e6('0x18')],'exten':_0x4e597a[_0xb0e6('0x9')],'priority':_0x5630c9['length']+_0xa90122[_0xb0e6('0xf')]+_0x4c165d++,'VoiceExtensionId':_0x4e597a[_0xb0e6('0x19')]});}else{_0x5bfca1['push']({'type':_0x4e597a[_0xb0e6('0x17')],'app':_0xb0e6('0x34'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x4e597a[_0xb0e6('0x18')],'exten':_0x4e597a[_0xb0e6('0x9')],'priority':_0x5630c9['length']+_0xa90122['priority']+_0x4c165d++,'VoiceExtensionId':_0x4e597a[_0xb0e6('0x19')]});_0x5bfca1['push']({'type':_0x4e597a[_0xb0e6('0x17')],'app':_0xb0e6('0x14'),'appdata':_0xb0e6('0x3c'),'context':_0x4e597a[_0xb0e6('0x18')],'exten':_0x4e597a[_0xb0e6('0x9')],'priority':_0x5630c9['length']+_0xa90122[_0xb0e6('0xf')]+_0x4c165d++,'VoiceExtensionId':_0x4e597a[_0xb0e6('0x19')]});}}}for(var _0x2cd377=0x0;_0x2cd377<_0x5630c9[_0xb0e6('0x2a')];_0x2cd377+=0x1){var _0x33d182=_0xa90122['priority']+_0x5630c9[_0xb0e6('0x2a')];var _0x441ed9=_0x2cd377===_0x5630c9[_0xb0e6('0x2a')]-0x1?_0xa90122['priority']+_0x5bfca1['length']+_0x3a4113['length']+0x2:_0xa90122['priority']+_0x2cd377+0x1;_0x5bfca1[_0xb0e6('0x3d')](_0x2cd377,0x0,{'type':_0x4e597a[_0xb0e6('0x17')],'app':'GotoIfTime','appdata':_0x5630c9[_0x2cd377]+'?'+_0x4e597a['context']+_0xb0e6('0x3e')+_0x33d182+':'+_0x4e597a['context']+',${EXTEN},'+_0x441ed9,'exten':_0x4e597a[_0xb0e6('0x9')],'context':_0x4e597a[_0xb0e6('0x18')],'priority':_0xa90122[_0xb0e6('0xf')]+_0x2cd377,'VoiceExtensionId':_0x34f365[_0x4e5577][0x0][_0xb0e6('0x19')]});}_0x4e597a[_0xb0e6('0xf')]=_0x5bfca1[_0xb0e6('0x2a')]?_['last'](_0x5bfca1)[_0xb0e6('0xf')]+0x1:_0xa90122[_0xb0e6('0xf')];_0xa90122[_0xb0e6('0xf')]=(_0x3a4113[_0xb0e6('0x2a')]?_[_0xb0e6('0x3f')](_0x3a4113)[_0xb0e6('0xf')]:_0x4e597a[_0xb0e6('0xf')])+0x1;_0xa90122['extensions']=_[_0xb0e6('0x40')](_0xa90122['extensions'],_0x5bfca1,[_0x4e597a],_0x3a4113);}_0xa90122[_0xb0e6('0x10')]['push']({'type':_0x34f365[_0x4e5577][0x0][_0xb0e6('0x17')],'app':_0xb0e6('0x41'),'exten':_0x34f365[_0x4e5577][0x0]['exten'],'context':_0x34f365[_0x4e5577][0x0][_0xb0e6('0x18')],'priority':_0xa90122[_0xb0e6('0xf')],'VoiceExtensionId':_0x34f365[_0x4e5577][0x0][_0xb0e6('0x19')]});_0x1e69ab['push'](_0x34f365[_0x4e5577][0x0][_0xb0e6('0x19')]);_0x2bf322=_['concat'](_0x2bf322,_0xa90122['extensions']);}}return _0x2288f7[_0xb0e6('0x42')](function(_0x286fd9){return _0x2288f7[_0xb0e6('0x1')][_0xb0e6('0x5')]['destroy']({'where':{'VoiceExtensionId':{'$in':_0x1e69ab}},'transaction':_0x286fd9})[_0xb0e6('0x4')](function(_0x320633){return _0x2288f7[_0xb0e6('0x1')][_0xb0e6('0x5')][_0xb0e6('0x43')](_[_0xb0e6('0x44')](_0x2bf322,_0xb0e6('0xf')),{'transaction':_0x286fd9});});});})[_0xb0e6('0x45')](function(_0x5dde52){console['error'](_0x5dde52);});}exports[_0xb0e6('0x46')]=rewrite; \ No newline at end of file +var _0xb09d=['models','Interval','then','IntervalId','VoiceExtension','findAll','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','playback','hasOwnProperty','extensions','extension','find','push','type','Set','CDR(type)=%s','priority','VoiceExtensionId','outbound','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','context','CDR(routeid)=','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','toLowerCase','updatedAt','interval','intervals','tag','CDR(tag)=','length','callerID','ExecIf','$[${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-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','concat','Hangup','transaction','destroy','bulkCreate','catch','error','rewrite','util'];(function(_0x2d5a48,_0x2f6c7c){var _0x49bae2=function(_0xd38c43){while(--_0xd38c43){_0x2d5a48['push'](_0x2d5a48['shift']());}};_0x49bae2(++_0x2f6c7c);}(_0xb09d,0x171));var _0xdb09=function(_0x2b3af4,_0x51a862){_0x2b3af4=_0x2b3af4-0x0;var _0x4a6ae1=_0xb09d[_0x2b3af4];return _0x4a6ae1;};'use strict';var _=require('lodash');var util=require(_0xdb09('0x0'));function rewrite(_0x30b67b,_0x2367d7){var _0x28a5c7=this;return _0x30b67b[_0xdb09('0x1')][_0xdb09('0x2')]['findAll']({'raw':!![]})[_0xdb09('0x3')](function(_0x71b1d6){_0x28a5c7['intervals']=_0x71b1d6;return _0x30b67b['models']['VoiceExtension']['findAll']({'where':{'IntervalId':_0x2367d7[_0xdb09('0x4')]},'raw':!![]});})['then'](function(_0x44cbef){return _0x30b67b[_0xdb09('0x1')][_0xdb09('0x5')][_0xdb09('0x6')]({'where':{'exten':{'$in':_[_0xdb09('0x7')](_[_0xdb09('0x8')](_0x44cbef,_0xdb09('0x9')))}},'order':[{'raw':_0xdb09('0xa')}],'raw':!![]});})[_0xdb09('0x3')](function(_0x40114f){var _0x5d9ff1=_[_0xdb09('0xb')](_0x40114f,{'priority':'1'});var _0x537525=_['filter'](_0x40114f,{'isApp':0x1});var _0x361aac=_[_0xdb09('0xc')](_0x537525,_0xdb09('0x9'));var _0x21f63c=['queue',_0xdb09('0xd')];var _0x1a31be=[];var _0x8027a2=[];for(var _0x5e120a in _0x361aac){if(_0x361aac[_0xdb09('0xe')](_0x5e120a)){_0x28a5c7['priority']=0x2;_0x28a5c7[_0xdb09('0xf')]=[];_0x28a5c7[_0xdb09('0x10')]=_[_0xdb09('0x11')](_0x5d9ff1,{'exten':_0x361aac[_0x5e120a][0x0]['exten']});_0x28a5c7[_0xdb09('0xf')][_0xdb09('0x12')]({'type':_0x361aac[_0x5e120a][0x0][_0xdb09('0x13')],'app':_0xdb09('0x14'),'appdata':util['format'](_0xdb09('0x15'),_0x361aac[_0x5e120a][0x0][_0xdb09('0x13')]),'context':_0x361aac[_0x5e120a][0x0]['context'],'exten':_0x361aac[_0x5e120a][0x0][_0xdb09('0x9')],'priority':_0x28a5c7[_0xdb09('0x16')]++,'VoiceExtensionId':_0x361aac[_0x5e120a][0x0][_0xdb09('0x17')]});if(_0x361aac[_0x5e120a][0x0][_0xdb09('0x13')]===_0xdb09('0x18')){if(_0x28a5c7[_0xdb09('0x10')]){_0x28a5c7['extensions'][_0xdb09('0x12')]({'type':_0x361aac[_0x5e120a][0x0][_0xdb09('0x13')],'app':_0xdb09('0x14'),'appdata':_0xdb09('0x19')+(_0x28a5c7['extension'][_0xdb09('0x1a')]?_0xdb09('0x1b')+_0x28a5c7[_0xdb09('0x10')][_0xdb09('0x1a')]+'}':_0xdb09('0x1c')),'context':_0x361aac[_0x5e120a][0x0][_0xdb09('0x1d')],'exten':_0x361aac[_0x5e120a][0x0][_0xdb09('0x9')],'priority':_0x28a5c7[_0xdb09('0x16')]++,'VoiceExtensionId':_0x361aac[_0x5e120a][0x0]['VoiceExtensionId']});}_0x28a5c7['extensions'][_0xdb09('0x12')]({'type':_0x361aac[_0x5e120a][0x0][_0xdb09('0x13')],'app':_0xdb09('0x14'),'appdata':_0xdb09('0x1e')+_0x361aac[_0x5e120a][0x0]['VoiceExtensionId'],'context':_0x361aac[_0x5e120a][0x0][_0xdb09('0x1d')],'exten':_0x361aac[_0x5e120a][0x0][_0xdb09('0x9')],'priority':_0x28a5c7[_0xdb09('0x16')]++,'VoiceExtensionId':_0x361aac[_0x5e120a][0x0][_0xdb09('0x17')]});var _0x1f743d=_0x28a5c7[_0xdb09('0x16')]++;_0x28a5c7[_0xdb09('0xf')][_0xdb09('0x12')]({'type':_0x361aac[_0x5e120a][0x0][_0xdb09('0x13')],'app':'ExecIf','appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x1f743d+0x2)+_0xdb09('0x1f')+(_0x1f743d+0x1)+')','context':_0x361aac[_0x5e120a][0x0][_0xdb09('0x1d')],'exten':_0x361aac[_0x5e120a][0x0][_0xdb09('0x9')],'priority':_0x1f743d,'VoiceExtensionId':_0x361aac[_0x5e120a][0x0]['VoiceExtensionId']});if(_0x28a5c7[_0xdb09('0x10')]){_0x28a5c7['extensions'][_0xdb09('0x12')]({'type':_0x361aac[_0x5e120a][0x0][_0xdb09('0x13')],'app':_0xdb09('0x14'),'appdata':_0x28a5c7['extension']['cutdigits']?_0xdb09('0x20')+_0x28a5c7[_0xdb09('0x10')][_0xdb09('0x1a')]+'}':_0xdb09('0x21'),'context':_0x361aac[_0x5e120a][0x0][_0xdb09('0x1d')],'exten':_0x361aac[_0x5e120a][0x0]['exten'],'priority':_0x28a5c7[_0xdb09('0x16')]++,'VoiceExtensionId':_0x361aac[_0x5e120a][0x0][_0xdb09('0x17')]});}_0x28a5c7[_0xdb09('0xf')]['push']({'type':_0x361aac[_0x5e120a][0x0]['type'],'app':_0xdb09('0x14'),'appdata':_0xdb09('0x22')+_0x361aac[_0x5e120a][0x0][_0xdb09('0x17')],'context':_0x361aac[_0x5e120a][0x0]['context'],'exten':_0x361aac[_0x5e120a][0x0][_0xdb09('0x9')],'priority':_0x28a5c7[_0xdb09('0x16')]++,'VoiceExtensionId':_0x361aac[_0x5e120a][0x0]['VoiceExtensionId']});if(_0x28a5c7['extension']&&_0x28a5c7[_0xdb09('0x10')]['hasOwnProperty'](_0xdb09('0x23'))&&_0x28a5c7[_0xdb09('0x10')][_0xdb09('0x23')]!==_0xdb09('0x24')){_0x28a5c7['extensions'][_0xdb09('0x12')]({'type':_0x361aac[_0x5e120a][0x0][_0xdb09('0x13')],'app':'Set','appdata':_0xdb09('0x25'),'context':_0x361aac[_0x5e120a][0x0][_0xdb09('0x1d')],'exten':_0x361aac[_0x5e120a][0x0][_0xdb09('0x9')],'priority':_0x28a5c7[_0xdb09('0x16')]++,'VoiceExtensionId':_0x361aac[_0x5e120a][0x0][_0xdb09('0x17')]});_0x28a5c7['extensions'][_0xdb09('0x12')]({'type':_0x361aac[_0x5e120a][0x0][_0xdb09('0x13')],'app':_0xdb09('0x14'),'appdata':_0xdb09('0x26')+_0x28a5c7[_0xdb09('0x10')][_0xdb09('0x23')]||_0xdb09('0x27'),'context':_0x361aac[_0x5e120a][0x0][_0xdb09('0x1d')],'exten':_0x361aac[_0x5e120a][0x0]['exten'],'priority':_0x28a5c7[_0xdb09('0x16')]++,'VoiceExtensionId':_0x361aac[_0x5e120a][0x0]['VoiceExtensionId']});}}_0x28a5c7[_0xdb09('0xf')][_0xdb09('0x12')]({'type':_0x361aac[_0x5e120a][0x0]['type'],'app':'Set','appdata':_0xdb09('0x28'),'context':_0x361aac[_0x5e120a][0x0]['context'],'exten':_0x361aac[_0x5e120a][0x0]['exten'],'priority':_0x28a5c7['priority']++,'VoiceExtensionId':_0x361aac[_0x5e120a][0x0][_0xdb09('0x17')]});_0x28a5c7[_0xdb09('0xf')]['push']({'type':_0x361aac[_0x5e120a][0x0][_0xdb09('0x13')],'app':_0xdb09('0x14'),'appdata':_0xdb09('0x29'),'context':_0x361aac[_0x5e120a][0x0][_0xdb09('0x1d')],'exten':_0x361aac[_0x5e120a][0x0][_0xdb09('0x9')],'priority':_0x28a5c7[_0xdb09('0x16')]++,'VoiceExtensionId':_0x361aac[_0x5e120a][0x0][_0xdb09('0x17')]});_0x28a5c7[_0xdb09('0xf')]['push']({'type':_0x361aac[_0x5e120a][0x0]['type'],'app':_0xdb09('0x14'),'appdata':_0xdb09('0x2a'),'context':_0x361aac[_0x5e120a][0x0][_0xdb09('0x1d')],'exten':_0x361aac[_0x5e120a][0x0]['exten'],'priority':_0x28a5c7[_0xdb09('0x16')]++,'VoiceExtensionId':_0x361aac[_0x5e120a][0x0][_0xdb09('0x17')]});for(var _0x3f5f7=0x0,_0x9341e=0x0;_0x3f5f7<_0x361aac[_0x5e120a]['length'];_0x3f5f7+=0x1,_0x9341e=0x0){var _0x58a47d=_0x361aac[_0x5e120a][_0x3f5f7];if(_0x58a47d[_0xdb09('0x13')]){_0x58a47d[_0xdb09('0x13')]=_0x58a47d[_0xdb09('0x13')][_0xdb09('0x2b')]();}var _0x1cc748=[];var _0x37f2f1=[];delete _0x58a47d['id'];delete _0x58a47d['createdAt'];delete _0x58a47d[_0xdb09('0x2c')];var _0x49dc93=_0x58a47d['interval']!=='*,*,*,*'?[_0x58a47d[_0xdb09('0x2d')]]:_0x58a47d[_0xdb09('0x4')]?_['map'](_[_0xdb09('0xb')](_0x28a5c7[_0xdb09('0x2e')],{'IntervalId':_0x58a47d['IntervalId']}),_0xdb09('0x2d')):[];if(_0x58a47d[_0xdb09('0xe')](_0xdb09('0x2f'))){if(_0x58a47d[_0xdb09('0x2f')]&&_0x58a47d[_0xdb09('0x2f')]!=='--'){_0x1cc748['push']({'type':_0x58a47d[_0xdb09('0x13')],'app':_0xdb09('0x14'),'appdata':_0xdb09('0x30')+_0x58a47d['tag'],'context':_0x58a47d['context'],'exten':_0x58a47d[_0xdb09('0x9')],'priority':_0x49dc93[_0xdb09('0x31')]+_0x28a5c7[_0xdb09('0x16')]+_0x9341e++,'VoiceExtensionId':_0x58a47d[_0xdb09('0x17')]});}}if(_0x58a47d[_0xdb09('0x13')]==='outbound'&&_0x58a47d[_0xdb09('0xe')](_0xdb09('0x32'))){if(_0x58a47d['callerID']){_0x1cc748['push']({'type':_0x58a47d[_0xdb09('0x13')],'app':_0xdb09('0x33'),'appdata':_0xdb09('0x34')+_0x58a47d['callerID']+')','context':_0x58a47d[_0xdb09('0x1d')],'exten':_0x58a47d[_0xdb09('0x9')],'priority':_0x49dc93[_0xdb09('0x31')]+_0x28a5c7[_0xdb09('0x16')]+_0x9341e++,'VoiceExtensionId':_0x58a47d[_0xdb09('0x17')]});}else{_0x1cc748['push']({'type':_0x58a47d[_0xdb09('0x13')],'app':_0xdb09('0x33'),'appdata':_0xdb09('0x35'),'context':_0x58a47d[_0xdb09('0x1d')],'exten':_0x58a47d[_0xdb09('0x9')],'priority':_0x49dc93[_0xdb09('0x31')]+_0x28a5c7[_0xdb09('0x16')]+_0x9341e++,'VoiceExtensionId':_0x58a47d[_0xdb09('0x17')]});}}if(_0x58a47d['hasOwnProperty'](_0xdb09('0x36'))){if(_0x21f63c['indexOf'](_0x58a47d[_0xdb09('0x37')][_0xdb09('0x2b')]())>=0x0&&_0x58a47d[_0xdb09('0x38')]!==_0xdb09('0x39')){if(_0x58a47d['answer']){_0x1cc748[_0xdb09('0x12')]({'type':_0x58a47d['type'],'app':_0xdb09('0x33'),'appdata':_0xdb09('0x3a'),'context':_0x58a47d[_0xdb09('0x1d')],'exten':_0x58a47d[_0xdb09('0x9')],'priority':_0x49dc93[_0xdb09('0x31')]+_0x28a5c7['priority']+_0x9341e++,'VoiceExtensionId':_0x58a47d[_0xdb09('0x17')]});_0x1cc748[_0xdb09('0x12')]({'type':_0x58a47d['type'],'app':'Set','appdata':_0xdb09('0x3b'),'context':_0x58a47d['context'],'exten':_0x58a47d[_0xdb09('0x9')],'priority':_0x49dc93['length']+_0x28a5c7[_0xdb09('0x16')]+_0x9341e++,'VoiceExtensionId':_0x58a47d[_0xdb09('0x17')]});}else{_0x1cc748['push']({'type':_0x58a47d[_0xdb09('0x13')],'app':'ExecIf','appdata':_0xdb09('0x3c'),'context':_0x58a47d[_0xdb09('0x1d')],'exten':_0x58a47d['exten'],'priority':_0x49dc93[_0xdb09('0x31')]+_0x28a5c7[_0xdb09('0x16')]+_0x9341e++,'VoiceExtensionId':_0x58a47d[_0xdb09('0x17')]});_0x1cc748[_0xdb09('0x12')]({'type':_0x58a47d[_0xdb09('0x13')],'app':'Set','appdata':_0xdb09('0x3d'),'context':_0x58a47d['context'],'exten':_0x58a47d[_0xdb09('0x9')],'priority':_0x49dc93[_0xdb09('0x31')]+_0x28a5c7[_0xdb09('0x16')]+_0x9341e++,'VoiceExtensionId':_0x58a47d['VoiceExtensionId']});}}}for(var _0x3069b5=0x0;_0x3069b5<_0x49dc93[_0xdb09('0x31')];_0x3069b5+=0x1){var _0x39f3ec=_0x28a5c7[_0xdb09('0x16')]+_0x49dc93['length'];var _0x489f11=_0x3069b5===_0x49dc93['length']-0x1?_0x28a5c7['priority']+_0x1cc748[_0xdb09('0x31')]+_0x37f2f1[_0xdb09('0x31')]+0x2:_0x28a5c7[_0xdb09('0x16')]+_0x3069b5+0x1;_0x1cc748[_0xdb09('0x3e')](_0x3069b5,0x0,{'type':_0x58a47d['type'],'app':_0xdb09('0x3f'),'appdata':_0x49dc93[_0x3069b5]+'?'+_0x58a47d['context']+',${EXTEN},'+_0x39f3ec+':'+_0x58a47d['context']+_0xdb09('0x40')+_0x489f11,'exten':_0x58a47d[_0xdb09('0x9')],'context':_0x58a47d[_0xdb09('0x1d')],'priority':_0x28a5c7[_0xdb09('0x16')]+_0x3069b5,'VoiceExtensionId':_0x361aac[_0x5e120a][0x0]['VoiceExtensionId']});}_0x58a47d[_0xdb09('0x16')]=_0x1cc748[_0xdb09('0x31')]?_[_0xdb09('0x41')](_0x1cc748)['priority']+0x1:_0x28a5c7['priority'];_0x28a5c7[_0xdb09('0x16')]=(_0x37f2f1[_0xdb09('0x31')]?_[_0xdb09('0x41')](_0x37f2f1)[_0xdb09('0x16')]:_0x58a47d[_0xdb09('0x16')])+0x1;_0x28a5c7[_0xdb09('0xf')]=_[_0xdb09('0x42')](_0x28a5c7[_0xdb09('0xf')],_0x1cc748,[_0x58a47d],_0x37f2f1);}_0x28a5c7[_0xdb09('0xf')][_0xdb09('0x12')]({'type':_0x361aac[_0x5e120a][0x0]['type'],'app':_0xdb09('0x43'),'exten':_0x361aac[_0x5e120a][0x0][_0xdb09('0x9')],'context':_0x361aac[_0x5e120a][0x0]['context'],'priority':_0x28a5c7[_0xdb09('0x16')],'VoiceExtensionId':_0x361aac[_0x5e120a][0x0][_0xdb09('0x17')]});_0x1a31be[_0xdb09('0x12')](_0x361aac[_0x5e120a][0x0][_0xdb09('0x17')]);_0x8027a2=_[_0xdb09('0x42')](_0x8027a2,_0x28a5c7[_0xdb09('0xf')]);}}return _0x30b67b[_0xdb09('0x44')](function(_0x5ce916){return _0x30b67b[_0xdb09('0x1')][_0xdb09('0x5')][_0xdb09('0x45')]({'where':{'VoiceExtensionId':{'$in':_0x1a31be}},'transaction':_0x5ce916})[_0xdb09('0x3')](function(_0x58bf89){return _0x30b67b[_0xdb09('0x1')][_0xdb09('0x5')][_0xdb09('0x46')](_['sortBy'](_0x8027a2,'priority'),{'transaction':_0x5ce916});});});})[_0xdb09('0x47')](function(_0x4ee80b){console[_0xdb09('0x48')](_0x4ee80b);});}exports[_0xdb09('0x49')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index 0e09fae..80ec72f 100644 --- a/server/components/import/cm/csv.js +++ b/server/components/import/cm/csv.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['find','Duplicate\x20Contact','CmContact','keys','then','push','pick','catch','message','stringify','cmContact','checkHopper','inspect','into','cm_hopper','fromQuery','scheduledAt','ContactId','createdAt','updatedAt','select','field','ListId','toString','NOW()','from','cm_contacts','where','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','ListId\x20=\x20?','id\x20IN\x20?','insert','deletedAt\x20IS\x20NULL','str','cm_hopper_black','VoiceQueue','outbound','Lists','get','dialCheckDuplicateType','always','sequelize','VoiceQueueId','onlyIfOpen','query','all','CmList','Campaign','findAll','CampaignId','cmContact,\x20%s,\x20%s','Error\x20processing\x20rows\x20block:','finally','emit','contact:csv_','resume','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','info','createReadStream','parse','duplicate','pause','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','api','redis','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','contact','index','test','error','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','map','hasOwnProperty','data','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','email','CompanyId','length'];(function(_0x4c0569,_0x4b230d){var _0x4d5516=function(_0x3f025d){while(--_0x3f025d){_0x4c0569['push'](_0x4c0569['shift']());}};_0x4d5516(++_0x4b230d);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var BPromise=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var _=require('lodash');var fs=require('fs');var squel=require('squel');var Papa=require('papaparse');var Redis=require(_0x0d8b('0x2'));var db=require(_0x0d8b('0x3'))['db'];var config=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));config['redis']=_['defaults'](config[_0x0d8b('0x7')],{'host':_0x0d8b('0x8'),'port':0x18eb});var socket=require(_0x0d8b('0x9'))(new Redis(config['redis']));require(_0x0d8b('0xa'))[_0x0d8b('0xb')](socket);try{if(!process['argv'][0x2]||process[_0x0d8b('0xc')][0x2]===_0x0d8b('0xd')||process[_0x0d8b('0xc')][0x2]===_0x0d8b('0xe')){throw new Error(_0x0d8b('0xf'));}var FILEPATH=process[_0x0d8b('0xc')][0x2];if(!process[_0x0d8b('0xc')][0x3]||process[_0x0d8b('0xc')][0x3]==='undefined'||process[_0x0d8b('0xc')][0x3]==='null'||!process[_0x0d8b('0xc')][0x4]||process[_0x0d8b('0xc')][0x4]===_0x0d8b('0xd')||process[_0x0d8b('0xc')][0x4]===_0x0d8b('0xe')){throw new Error(_0x0d8b('0x10'));}var FIELDS=_[_0x0d8b('0x11')](process[_0x0d8b('0xc')][0x3][_0x0d8b('0x12')](','),process[_0x0d8b('0xc')][0x4][_0x0d8b('0x12')](','));if(!process[_0x0d8b('0xc')][0x5]||process[_0x0d8b('0xc')][0x5]===_0x0d8b('0xd')||process['argv'][0x5]===_0x0d8b('0xe')){throw new Error(_0x0d8b('0x13'));}var LISTID=process[_0x0d8b('0xc')][0x5];var COMPANYID=process[_0x0d8b('0xc')][0x6]&&process[_0x0d8b('0xc')][0x6]!=='undefined'&&process[_0x0d8b('0xc')][0x6]!==_0x0d8b('0xe')?process[_0x0d8b('0xc')][0x6]:null;var DUPLICATES=process[_0x0d8b('0xc')][0x7]&&process[_0x0d8b('0xc')][0x7]!==_0x0d8b('0xd')&&process[_0x0d8b('0xc')][0x7]!==_0x0d8b('0xe')?process['argv'][0x7]:null;if(!process[_0x0d8b('0xc')][0x8]||process[_0x0d8b('0xc')][0x8]===_0x0d8b('0xd')||process[_0x0d8b('0xc')][0x8]===_0x0d8b('0xe')){throw new Error(_0x0d8b('0x14'));}var SOCKET_TIMESTAMP=process[_0x0d8b('0xc')][0x8];}catch(_0x352c17){logger['error'](_0x352c17);endCsv();}var total=0x0;var pTotal=0x0;var success=0x0;var errors=0x0;var duplicates=0x0;var rows=[];var hopperContacts='';var promises=[];var index=0x0;var alreadyInvalid=![];function handleCheckRowError(_0x4f0a1a,_0x33fb87,_0x54a9a7,_0x56c729){var _0x5527d8={'message':_0x33fb87};_0x5527d8[_0x4f0a1a]=!![];if(_0x54a9a7){_0x5527d8[_0x0d8b('0x15')]=_0x54a9a7;}if(_0x56c729){_0x5527d8[_0x0d8b('0x16')]=_0x56c729;}return _0x5527d8;}function isEmail(_0x214778){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/[_0x0d8b('0x17')](_0x214778);}function checkRow(_0x221071,_0x2c64e2,_0x30980c){return new BPromise(function(_0x4562cb,_0x27b695){if(_['isNil'](_0x221071)){return _0x27b695(handleCheckRowError(_0x0d8b('0x18'),_0x0d8b('0x19'),null,_0x30980c));}if(_0x221071['errors']&&_0x221071[_0x0d8b('0x1a')]['length']){var _0x3dd149=_[_0x0d8b('0x1b')](_0x221071[_0x0d8b('0x1a')],'message')['join'](';');return _0x27b695(handleCheckRowError(_0x0d8b('0x18'),_0x3dd149,null,_0x30980c));}var _0x3ef745={};for(var _0x4c05ee in FIELDS){if(FIELDS[_0x0d8b('0x1c')](_0x4c05ee)&&FIELDS[_0x4c05ee]){_0x3ef745[_0x4c05ee]=_0x221071['data'][0x0][FIELDS[_0x4c05ee]]||_0x221071[_0x0d8b('0x1d')][0x0]['\ufeff'+FIELDS[_0x4c05ee]];}}if(!_0x3ef745['firstName']){return _0x27b695(handleCheckRowError(_0x0d8b('0x18'),'firstName\x20not\x20specified!',null,_0x30980c));}if(!_0x3ef745[_0x0d8b('0x1e')]){return _0x27b695(handleCheckRowError('error',_0x0d8b('0x1f'),null,_0x30980c));}if(_0x3ef745['birthDate']){var _0x3c8887=moment(_0x3ef745[_0x0d8b('0x20')],_0x0d8b('0x21'));if(!_0x3c8887['isValid']()){return _0x27b695(handleCheckRowError('error','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0x30980c));}}if(_0x3ef745[_0x0d8b('0x22')]){if(!isEmail(_0x3ef745['email'])){return _0x27b695(handleCheckRowError(_0x0d8b('0x18'),'email\x20format\x20is\x20not\x20valid!',null,_0x30980c));}}_0x3ef745['ListId']=LISTID;_0x3ef745[_0x0d8b('0x23')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x0d8b('0x24')]&&_0x2c64e2){var _0x109c14={};for(var _0xdeee5d=0x0,_0x183220=DUPLICATES[_0x0d8b('0x24')];_0xdeee5d<_0x183220;_0xdeee5d+=0x1){_0x109c14[DUPLICATES[_0xdeee5d]]=_0x3ef745[DUPLICATES[_0xdeee5d]];}var _0x4a99d3=_[_0x0d8b('0x25')](_0x2c64e2,_0x109c14);if(_0x4a99d3){return _0x27b695(handleCheckRowError('duplicate',_0x0d8b('0x26'),_0x4a99d3,_0x30980c));}}return db[_0x0d8b('0x27')]['create'](_0x3ef745,{'raw':!![],'hooks':![],'fields':_[_0x0d8b('0x28')](_0x3ef745)})[_0x0d8b('0x29')](function(_0x18a905){if(DUPLICATES&&DUPLICATES['length']&&_0x2c64e2){_0x2c64e2[_0x0d8b('0x2a')](_[_0x0d8b('0x2b')](_0x3ef745,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x18a905['id'];return _0x4562cb();})[_0x0d8b('0x2c')](function(_0x31ceba){return _0x27b695(handleCheckRowError(_0x0d8b('0x18'),'Error\x20while\x20creating\x20contact:\x20'+(_0x31ceba[_0x0d8b('0x2d')]||JSON[_0x0d8b('0x2e')](_0x31ceba)),null,_0x30980c));});});}function checkHopper(){function _0x5ad0fe(){return function(_0x1180ac){logger[_0x0d8b('0x18')](_0x0d8b('0x2f'),_0x0d8b('0x30'),util[_0x0d8b('0x31')](_0x1180ac,{'showHidden':![],'depth':null}));};}var _0x519088=function(_0x497a71,_0x41b4f9){var _0x5c2c04=squel['insert']()[_0x0d8b('0x32')](_0x0d8b('0x33'))[_0x0d8b('0x34')]([_0x0d8b('0x1e'),_0x0d8b('0x35'),_0x0d8b('0x36'),'ListId',_0x41b4f9,_0x0d8b('0x37'),_0x0d8b('0x38')],squel[_0x0d8b('0x39')]()[_0x0d8b('0x3a')](_0x0d8b('0x1e'),_0x0d8b('0x1e'))[_0x0d8b('0x3a')]('NOW()',_0x0d8b('0x35'))[_0x0d8b('0x3a')]('id',_0x0d8b('0x36'))[_0x0d8b('0x3a')](LISTID['toString'](),_0x0d8b('0x3b'))['field'](_0x497a71['id'][_0x0d8b('0x3c')](),_0x41b4f9)[_0x0d8b('0x3a')](_0x0d8b('0x3d'),_0x0d8b('0x37'))[_0x0d8b('0x3a')](_0x0d8b('0x3d'),_0x0d8b('0x38'))[_0x0d8b('0x3e')](_0x0d8b('0x3f'))[_0x0d8b('0x40')]('deletedAt\x20IS\x20NULL')['where']('ListId\x20=\x20?',LISTID['toString']())['where'](_0x0d8b('0x41'))[_0x0d8b('0x40')](_0x0d8b('0x42'),squel['select']()['field'](_0x0d8b('0x1e'))[_0x0d8b('0x3e')](_0x0d8b('0x33'))['where'](_0x41b4f9+_0x0d8b('0x43'),_0x497a71['id'][_0x0d8b('0x3c')]())))['toString']();return _0x5c2c04;};var _0x4d7bb0=function(_0x372740,_0x495870){var _0x1e22e5=squel['insert']()['into'](_0x0d8b('0x33'))[_0x0d8b('0x34')](['phone','scheduledAt','ContactId','ListId',_0x495870,_0x0d8b('0x37'),_0x0d8b('0x38')],squel[_0x0d8b('0x39')]()['field'](_0x0d8b('0x1e'),_0x0d8b('0x1e'))[_0x0d8b('0x3a')](_0x0d8b('0x3d'),_0x0d8b('0x35'))[_0x0d8b('0x3a')]('id',_0x0d8b('0x36'))[_0x0d8b('0x3a')](LISTID[_0x0d8b('0x3c')](),_0x0d8b('0x3b'))[_0x0d8b('0x3a')](_0x372740['id'][_0x0d8b('0x3c')](),_0x495870)[_0x0d8b('0x3a')](_0x0d8b('0x3d'),_0x0d8b('0x37'))[_0x0d8b('0x3a')](_0x0d8b('0x3d'),_0x0d8b('0x38'))[_0x0d8b('0x3e')]('cm_contacts')[_0x0d8b('0x40')]('deletedAt\x20IS\x20NULL')['where'](_0x0d8b('0x44'),LISTID[_0x0d8b('0x3c')]())[_0x0d8b('0x40')](_0x0d8b('0x45'),squel['str'](hopperContacts))[_0x0d8b('0x40')](_0x0d8b('0x41'))[_0x0d8b('0x40')](_0x0d8b('0x42'),squel[_0x0d8b('0x39')]()['field']('calleridnum')['from']('cm_hopper_final')[_0x0d8b('0x40')](_0x495870+_0x0d8b('0x43'),_0x372740['id']['toString']()))['where'](_0x0d8b('0x42'),squel[_0x0d8b('0x39')]()['field']('phone')[_0x0d8b('0x3e')](_0x0d8b('0x33'))[_0x0d8b('0x40')](_0x495870+_0x0d8b('0x43'),_0x372740['id'][_0x0d8b('0x3c')]())))['toString']();return _0x1e22e5;};function _0x2de903(_0x2afe34,_0x5481fc){var _0x580580=squel[_0x0d8b('0x46')]()[_0x0d8b('0x32')]('cm_hopper')['fromQuery']([_0x0d8b('0x1e'),_0x0d8b('0x35'),_0x0d8b('0x36'),_0x0d8b('0x3b'),_0x5481fc,'createdAt',_0x0d8b('0x38')],squel['select']()['field'](_0x0d8b('0x1e'),_0x0d8b('0x1e'))['field']('NOW()',_0x0d8b('0x35'))[_0x0d8b('0x3a')]('id',_0x0d8b('0x36'))[_0x0d8b('0x3a')](LISTID[_0x0d8b('0x3c')](),_0x0d8b('0x3b'))[_0x0d8b('0x3a')](_0x2afe34['id'][_0x0d8b('0x3c')](),_0x5481fc)['field'](_0x0d8b('0x3d'),_0x0d8b('0x37'))[_0x0d8b('0x3a')](_0x0d8b('0x3d'),_0x0d8b('0x38'))[_0x0d8b('0x3e')](_0x0d8b('0x3f'))[_0x0d8b('0x40')](_0x0d8b('0x47'))['where'](_0x0d8b('0x44'),LISTID[_0x0d8b('0x3c')]())[_0x0d8b('0x40')](_0x0d8b('0x45'),squel[_0x0d8b('0x48')](hopperContacts))['where'](_0x0d8b('0x41')))[_0x0d8b('0x3c')]();return _0x580580;}function _0x181d49(_0x17a87f,_0x1d6cd4){var _0x59ada2=squel['insert']()[_0x0d8b('0x32')](_0x0d8b('0x49'))[_0x0d8b('0x34')]([_0x0d8b('0x1e'),'ContactId',_0x0d8b('0x3b'),_0x1d6cd4,_0x0d8b('0x37'),_0x0d8b('0x38')],squel['select']()[_0x0d8b('0x3a')]('phone',_0x0d8b('0x1e'))[_0x0d8b('0x3a')]('id',_0x0d8b('0x36'))[_0x0d8b('0x3a')](LISTID[_0x0d8b('0x3c')](),_0x0d8b('0x3b'))['field'](_0x17a87f['id'][_0x0d8b('0x3c')](),_0x1d6cd4)['field'](_0x0d8b('0x3d'),_0x0d8b('0x37'))[_0x0d8b('0x3a')](_0x0d8b('0x3d'),'updatedAt')[_0x0d8b('0x3e')](_0x0d8b('0x3f'))[_0x0d8b('0x40')](_0x0d8b('0x47'))[_0x0d8b('0x40')](_0x0d8b('0x44'),LISTID[_0x0d8b('0x3c')]())[_0x0d8b('0x40')](_0x0d8b('0x45'),squel[_0x0d8b('0x48')](hopperContacts))['where']('phone\x20IS\x20NOT\x20NULL'))[_0x0d8b('0x3c')]();return _0x59ada2;}return db[_0x0d8b('0x4a')]['findAll']({'where':{'type':_0x0d8b('0x4b')},'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db['CmList'],'as':_0x0d8b('0x4c'),'where':{'id':LISTID}}]})[_0x0d8b('0x29')](function(_0x4f4b4d){var _0x587128=[];if(_0x4f4b4d){var _0x1900e3;for(var _0x1c007b=0x0,_0x70e4b2;_0x1c007b<_0x4f4b4d[_0x0d8b('0x24')];_0x1c007b+=0x1){_0x70e4b2=_0x4f4b4d[_0x1c007b][_0x0d8b('0x4d')]({'plain':!![]});switch(_0x70e4b2[_0x0d8b('0x4e')]){case _0x0d8b('0x4f'):_0x587128['push'](db[_0x0d8b('0x50')]['query'](_0x4d7bb0(_0x70e4b2,_0x0d8b('0x51')))[_0x0d8b('0x29')](function(){})[_0x0d8b('0x2c')](_0x5ad0fe()));break;case _0x0d8b('0x52'):_0x587128['push'](db[_0x0d8b('0x50')]['query'](_0x519088(_0x70e4b2,_0x0d8b('0x51')))[_0x0d8b('0x29')](function(){})[_0x0d8b('0x2c')](_0x5ad0fe()));break;default:_0x587128[_0x0d8b('0x2a')](db[_0x0d8b('0x50')][_0x0d8b('0x53')](_0x2de903(_0x70e4b2,_0x0d8b('0x51')))[_0x0d8b('0x29')](function(){})[_0x0d8b('0x2c')](_0x5ad0fe()));}}}return _0x587128;})[_0x0d8b('0x54')]()['then'](function(){return db[_0x0d8b('0x4a')]['findAll']({'where':{'type':_0x0d8b('0x4b')},'attributes':['id'],'include':[{'model':db[_0x0d8b('0x55')],'as':'BlackLists','where':{'id':LISTID}}]})[_0x0d8b('0x29')](function(_0x56e03c){var _0x10c318=[];if(_0x56e03c){var _0x445a00;for(var _0x24f75=0x0,_0x259ac9;_0x24f75<_0x56e03c[_0x0d8b('0x24')];_0x24f75+=0x1){_0x259ac9=_0x56e03c[_0x24f75][_0x0d8b('0x4d')]({'plain':!![]});_0x10c318[_0x0d8b('0x2a')](db[_0x0d8b('0x50')]['query'](_0x181d49(_0x259ac9,_0x0d8b('0x51')))[_0x0d8b('0x29')](function(){})['catch'](_0x5ad0fe()));}}return _0x10c318;})[_0x0d8b('0x54')]();})[_0x0d8b('0x29')](function(){return db[_0x0d8b('0x56')][_0x0d8b('0x57')]({'attributes':['id',_0x0d8b('0x4e')],'include':[{'model':db[_0x0d8b('0x55')],'as':_0x0d8b('0x4c'),'where':{'id':LISTID}}]})[_0x0d8b('0x29')](function(_0x466082){var _0x5007c0=[];if(_0x466082){for(var _0xe35028=0x0,_0x16df83;_0xe35028<_0x466082['length'];_0xe35028+=0x1){_0x16df83=_0x466082[_0xe35028][_0x0d8b('0x4d')]({'plain':!![]});switch(_0x16df83[_0x0d8b('0x4e')]){case _0x0d8b('0x4f'):_0x5007c0['push'](db['sequelize'][_0x0d8b('0x53')](_0x4d7bb0(_0x16df83,_0x0d8b('0x58')))[_0x0d8b('0x29')](function(){})['catch'](_0x5ad0fe()));break;case'onlyIfOpen':_0x5007c0[_0x0d8b('0x2a')](db[_0x0d8b('0x50')][_0x0d8b('0x53')](_0x519088(_0x16df83,_0x0d8b('0x58')))[_0x0d8b('0x29')](function(){})[_0x0d8b('0x2c')](_0x5ad0fe()));break;default:_0x5007c0[_0x0d8b('0x2a')](db[_0x0d8b('0x50')][_0x0d8b('0x53')](_0x2de903(_0x16df83,_0x0d8b('0x58')))[_0x0d8b('0x29')](function(){})[_0x0d8b('0x2c')](_0x5ad0fe()));}}}return _0x5007c0;})[_0x0d8b('0x54')]();})['then'](function(){return db[_0x0d8b('0x56')][_0x0d8b('0x57')]({'attributes':['id'],'include':[{'model':db['CmList'],'as':'BlackLists','where':{'id':LISTID}}]})[_0x0d8b('0x29')](function(_0x1dad9f){var _0x3573b4=[];if(_0x1dad9f){for(var _0x14b1b8=0x0,_0x23e2e0;_0x14b1b8<_0x1dad9f[_0x0d8b('0x24')];_0x14b1b8+=0x1){_0x23e2e0=_0x1dad9f[_0x14b1b8]['get']({'plain':!![]});_0x3573b4['push'](db['sequelize'][_0x0d8b('0x53')](_0x181d49(_0x23e2e0,_0x0d8b('0x58')))[_0x0d8b('0x29')](function(){})[_0x0d8b('0x2c')](_0x5ad0fe()));}}return _0x3573b4;})[_0x0d8b('0x54')]();})[_0x0d8b('0x2c')](function(_0x5ef461){logger[_0x0d8b('0x18')](_0x0d8b('0x59'),'generalCheckHopper',_0x5ef461[_0x0d8b('0x2d')]);});}var processPromises=function(_0x57e3c2){return BPromise[_0x0d8b('0x54')](promises)[_0x0d8b('0x29')](function(_0x9dfa5a){})[_0x0d8b('0x2c')](function(_0x10c7ab){logger[_0x0d8b('0x18')](_0x0d8b('0x5a'),JSON[_0x0d8b('0x2e')](_0x10c7ab));})[_0x0d8b('0x5b')](function(){socket[_0x0d8b('0x5c')](_0x0d8b('0x5d')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x57e3c2){return _0x57e3c2[_0x0d8b('0x5e')]();}});};var endCsv=function(){return BPromise['resolve']()['then'](function(){if(hopperContacts){return checkHopper();}})[_0x0d8b('0x29')](function(){socket[_0x0d8b('0x5c')](_0x0d8b('0x5d')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x0d8b('0x5f')](FILEPATH);}catch(_0xf91ecd){logger[_0x0d8b('0x18')](_0x0d8b('0x60'),JSON['stringify'](_0xf91ecd));}finally{process[_0x0d8b('0x61')](0x0);}});};process['on']('SIGINT',function(){logger[_0x0d8b('0x62')]('CSV\x20import\x20process\x20stopped!');endCsv();});function main(){return BPromise['resolve']()[_0x0d8b('0x29')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x0d8b('0x12')](',');return db[_0x0d8b('0x27')][_0x0d8b('0x57')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x0d8b('0x29')](function(_0x2eece2){var _0x3c7b9b=fs[_0x0d8b('0x63')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x0d8b('0x64')](_0x3c7b9b,{'header':!![],'skipEmptyLines':!![],'step':function(_0x20a8b6,_0x3a6014){total+=0x1;var _0x180539=total;promises['push'](checkRow(_0x20a8b6,_0x2eece2,_0x180539)[_0x0d8b('0x29')](function(){success+=0x1;})[_0x0d8b('0x2c')](function(_0x8be77c){if(_0x8be77c['error']){errors+=0x1;delete _0x8be77c['error'];}else if(_0x8be77c[_0x0d8b('0x65')]){duplicates+=0x1;delete _0x8be77c[_0x0d8b('0x65')];}rows[_0x0d8b('0x2a')](_0x8be77c);}));if(total%0xc8===0x0){_0x3a6014[_0x0d8b('0x66')]();return processPromises(_0x3a6014);}},'complete':function(){return processPromises()[_0x0d8b('0x29')](function(){logger[_0x0d8b('0x62')]('CSV\x20parsed\x20correctly!');endCsv();});},'error':function(_0x1a96ce,_0x3d6267){logger[_0x0d8b('0x62')](_0x0d8b('0x67'),JSON[_0x0d8b('0x2e')](_0x1a96ce));endCsv();}});})['catch'](function(_0x4dbcfc){logger[_0x0d8b('0x18')](_0x0d8b('0x68'),JSON[_0x0d8b('0x2e')](_0x4dbcfc));});}main(); \ No newline at end of file +var _0xbaf0=['YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','find','Duplicate\x20Contact','create','keys','then','push','pick','Error\x20while\x20creating\x20contact:\x20','stringify','checkHopper','inspect','insert','into','phone','scheduledAt','ContactId','createdAt','updatedAt','select','field','NOW()','toString','from','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','cm_hopper','fromQuery','cm_contacts','str','cm_hopper_final','\x20=\x20?','id\x20IN\x20?','cm_hopper_black','VoiceQueue','findAll','outbound','CmList','Lists','dialCheckDuplicateType','always','sequelize','query','VoiceQueueId','onlyIfOpen','catch','all','BlackLists','get','CampaignId','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','finally','resolve','contact:csv_','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','info','CSV\x20import\x20process\x20stopped!','CmContact','createReadStream','parse','duplicate','pause','util','lodash','squel','papaparse','ioredis','../../../mysqldb','../../../config/logger','api','redis','defaults','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20socket_timestamp\x20parameter!','error','contact','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\x20not\x20specified!','birthDate'];(function(_0x348f02,_0x3c0edc){var _0x502d16=function(_0x6dabff){while(--_0x6dabff){_0x348f02['push'](_0x348f02['shift']());}};_0x502d16(++_0x3c0edc);}(_0xbaf0,0x12a));var _0x0baf=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xbaf0[_0x6c993a];return _0x27f547;};'use strict';var BPromise=require('bluebird');var util=require(_0x0baf('0x0'));var _=require(_0x0baf('0x1'));var fs=require('fs');var squel=require(_0x0baf('0x2'));var Papa=require(_0x0baf('0x3'));var Redis=require(_0x0baf('0x4'));var db=require(_0x0baf('0x5'))['db'];var config=require('../../../config/environment');var logger=require(_0x0baf('0x6'))(_0x0baf('0x7'));config[_0x0baf('0x8')]=_[_0x0baf('0x9')](config[_0x0baf('0x8')],{'host':_0x0baf('0xa'),'port':0x18eb});var socket=require(_0x0baf('0xb'))(new Redis(config[_0x0baf('0x8')]));require(_0x0baf('0xc'))['register'](socket);try{if(!process[_0x0baf('0xd')][0x2]||process['argv'][0x2]===_0x0baf('0xe')||process[_0x0baf('0xd')][0x2]===_0x0baf('0xf')){throw new Error(_0x0baf('0x10'));}var FILEPATH=process[_0x0baf('0xd')][0x2];if(!process[_0x0baf('0xd')][0x3]||process[_0x0baf('0xd')][0x3]===_0x0baf('0xe')||process[_0x0baf('0xd')][0x3]===_0x0baf('0xf')||!process[_0x0baf('0xd')][0x4]||process['argv'][0x4]==='undefined'||process[_0x0baf('0xd')][0x4]===_0x0baf('0xf')){throw new Error(_0x0baf('0x11'));}var FIELDS=_[_0x0baf('0x12')](process['argv'][0x3][_0x0baf('0x13')](','),process['argv'][0x4][_0x0baf('0x13')](','));if(!process[_0x0baf('0xd')][0x5]||process[_0x0baf('0xd')][0x5]===_0x0baf('0xe')||process[_0x0baf('0xd')][0x5]===_0x0baf('0xf')){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process['argv'][0x5];var COMPANYID=process[_0x0baf('0xd')][0x6]&&process[_0x0baf('0xd')][0x6]!==_0x0baf('0xe')&&process[_0x0baf('0xd')][0x6]!==_0x0baf('0xf')?process[_0x0baf('0xd')][0x6]:null;var DUPLICATES=process['argv'][0x7]&&process[_0x0baf('0xd')][0x7]!==_0x0baf('0xe')&&process[_0x0baf('0xd')][0x7]!==_0x0baf('0xf')?process[_0x0baf('0xd')][0x7]:null;if(!process[_0x0baf('0xd')][0x8]||process['argv'][0x8]==='undefined'||process[_0x0baf('0xd')][0x8]===_0x0baf('0xf')){throw new Error(_0x0baf('0x14'));}var SOCKET_TIMESTAMP=process[_0x0baf('0xd')][0x8];}catch(_0x1fa92b){logger[_0x0baf('0x15')](_0x1fa92b);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(_0x210cd8,_0x636a13,_0x2c42e2,_0x15a2c3){var _0x54f2fa={'message':_0x636a13};_0x54f2fa[_0x210cd8]=!![];if(_0x2c42e2){_0x54f2fa[_0x0baf('0x16')]=_0x2c42e2;}if(_0x15a2c3){_0x54f2fa['index']=_0x15a2c3;}return _0x54f2fa;}function isEmail(_0xf6c158){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'](_0xf6c158);}function checkRow(_0x4de74c,_0x2ef0aa,_0x48a0e9){return new BPromise(function(_0x4be1b9,_0x47c4b){if(_[_0x0baf('0x17')](_0x4de74c)){return _0x47c4b(handleCheckRowError(_0x0baf('0x15'),_0x0baf('0x18'),null,_0x48a0e9));}if(_0x4de74c[_0x0baf('0x19')]&&_0x4de74c['errors'][_0x0baf('0x1a')]){var _0x4681c5=_[_0x0baf('0x1b')](_0x4de74c[_0x0baf('0x19')],_0x0baf('0x1c'))[_0x0baf('0x1d')](';');return _0x47c4b(handleCheckRowError(_0x0baf('0x15'),_0x4681c5,null,_0x48a0e9));}var _0x549fd0={};for(var _0x1590b4 in FIELDS){if(FIELDS[_0x0baf('0x1e')](_0x1590b4)&&FIELDS[_0x1590b4]){_0x549fd0[_0x1590b4]=_0x4de74c[_0x0baf('0x1f')][0x0][FIELDS[_0x1590b4]]||_0x4de74c[_0x0baf('0x1f')][0x0]['\ufeff'+FIELDS[_0x1590b4]];}}if(!_0x549fd0['firstName']){return _0x47c4b(handleCheckRowError(_0x0baf('0x15'),_0x0baf('0x20'),null,_0x48a0e9));}if(!_0x549fd0['phone']){return _0x47c4b(handleCheckRowError(_0x0baf('0x15'),_0x0baf('0x21'),null,_0x48a0e9));}if(_0x549fd0[_0x0baf('0x22')]){var _0xb4dbb1=moment(_0x549fd0[_0x0baf('0x22')],_0x0baf('0x23'));if(!_0xb4dbb1[_0x0baf('0x24')]()){return _0x47c4b(handleCheckRowError('error',_0x0baf('0x25'),null,_0x48a0e9));}}if(_0x549fd0[_0x0baf('0x26')]){if(!isEmail(_0x549fd0[_0x0baf('0x26')])){return _0x47c4b(handleCheckRowError(_0x0baf('0x15'),_0x0baf('0x27'),null,_0x48a0e9));}}_0x549fd0[_0x0baf('0x28')]=LISTID;_0x549fd0[_0x0baf('0x29')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x0baf('0x1a')]&&_0x2ef0aa){var _0x59431b={};for(var _0x3ded64=0x0,_0x2adfd7=DUPLICATES[_0x0baf('0x1a')];_0x3ded64<_0x2adfd7;_0x3ded64+=0x1){_0x59431b[DUPLICATES[_0x3ded64]]=_0x549fd0[DUPLICATES[_0x3ded64]];}var _0x45294a=_[_0x0baf('0x2a')](_0x2ef0aa,_0x59431b);if(_0x45294a){return _0x47c4b(handleCheckRowError('duplicate',_0x0baf('0x2b'),_0x45294a,_0x48a0e9));}}return db['CmContact'][_0x0baf('0x2c')](_0x549fd0,{'raw':!![],'hooks':![],'fields':_[_0x0baf('0x2d')](_0x549fd0)})[_0x0baf('0x2e')](function(_0x3d65f2){if(DUPLICATES&&DUPLICATES['length']&&_0x2ef0aa){_0x2ef0aa[_0x0baf('0x2f')](_[_0x0baf('0x30')](_0x549fd0,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x3d65f2['id'];return _0x4be1b9();})['catch'](function(_0x23d890){return _0x47c4b(handleCheckRowError(_0x0baf('0x15'),_0x0baf('0x31')+(_0x23d890[_0x0baf('0x1c')]||JSON[_0x0baf('0x32')](_0x23d890)),null,_0x48a0e9));});});}function checkHopper(){function _0x1b0991(){return function(_0xe03d82){logger[_0x0baf('0x15')]('cmContact',_0x0baf('0x33'),util[_0x0baf('0x34')](_0xe03d82,{'showHidden':![],'depth':null}));};}var _0x5b991f=function(_0x32c022,_0x57783c){var _0x5c545f=squel[_0x0baf('0x35')]()[_0x0baf('0x36')]('cm_hopper')['fromQuery']([_0x0baf('0x37'),_0x0baf('0x38'),_0x0baf('0x39'),_0x0baf('0x28'),_0x57783c,_0x0baf('0x3a'),_0x0baf('0x3b')],squel[_0x0baf('0x3c')]()[_0x0baf('0x3d')](_0x0baf('0x37'),_0x0baf('0x37'))[_0x0baf('0x3d')](_0x0baf('0x3e'),_0x0baf('0x38'))[_0x0baf('0x3d')]('id','ContactId')[_0x0baf('0x3d')](LISTID[_0x0baf('0x3f')](),'ListId')[_0x0baf('0x3d')](_0x32c022['id'][_0x0baf('0x3f')](),_0x57783c)[_0x0baf('0x3d')](_0x0baf('0x3e'),_0x0baf('0x3a'))[_0x0baf('0x3d')]('NOW()',_0x0baf('0x3b'))[_0x0baf('0x40')]('cm_contacts')[_0x0baf('0x41')](_0x0baf('0x42'))[_0x0baf('0x41')](_0x0baf('0x43'),LISTID['toString']())[_0x0baf('0x41')](_0x0baf('0x44'))[_0x0baf('0x41')](_0x0baf('0x45'),squel[_0x0baf('0x3c')]()[_0x0baf('0x3d')](_0x0baf('0x37'))[_0x0baf('0x40')](_0x0baf('0x46'))[_0x0baf('0x41')](_0x57783c+'\x20=\x20?',_0x32c022['id'][_0x0baf('0x3f')]())))[_0x0baf('0x3f')]();return _0x5c545f;};var _0x1daf1d=function(_0x339aff,_0x22207a){var _0x55f4f8=squel[_0x0baf('0x35')]()[_0x0baf('0x36')](_0x0baf('0x46'))[_0x0baf('0x47')]([_0x0baf('0x37'),'scheduledAt',_0x0baf('0x39'),_0x0baf('0x28'),_0x22207a,_0x0baf('0x3a'),_0x0baf('0x3b')],squel[_0x0baf('0x3c')]()[_0x0baf('0x3d')](_0x0baf('0x37'),'phone')[_0x0baf('0x3d')](_0x0baf('0x3e'),_0x0baf('0x38'))['field']('id',_0x0baf('0x39'))[_0x0baf('0x3d')](LISTID[_0x0baf('0x3f')](),_0x0baf('0x28'))[_0x0baf('0x3d')](_0x339aff['id'][_0x0baf('0x3f')](),_0x22207a)[_0x0baf('0x3d')]('NOW()',_0x0baf('0x3a'))[_0x0baf('0x3d')](_0x0baf('0x3e'),_0x0baf('0x3b'))[_0x0baf('0x40')](_0x0baf('0x48'))[_0x0baf('0x41')](_0x0baf('0x42'))[_0x0baf('0x41')](_0x0baf('0x43'),LISTID[_0x0baf('0x3f')]())['where']('id\x20IN\x20?',squel[_0x0baf('0x49')](hopperContacts))[_0x0baf('0x41')](_0x0baf('0x44'))[_0x0baf('0x41')](_0x0baf('0x45'),squel[_0x0baf('0x3c')]()[_0x0baf('0x3d')]('calleridnum')[_0x0baf('0x40')](_0x0baf('0x4a'))[_0x0baf('0x41')](_0x22207a+_0x0baf('0x4b'),_0x339aff['id'][_0x0baf('0x3f')]()))[_0x0baf('0x41')]('phone\x20NOT\x20IN\x20(?)',squel[_0x0baf('0x3c')]()['field'](_0x0baf('0x37'))['from'](_0x0baf('0x46'))['where'](_0x22207a+_0x0baf('0x4b'),_0x339aff['id']['toString']())))[_0x0baf('0x3f')]();return _0x55f4f8;};function _0xcf7b8d(_0x411c1f,_0x4520d1){var _0x42a68b=squel['insert']()[_0x0baf('0x36')](_0x0baf('0x46'))[_0x0baf('0x47')]([_0x0baf('0x37'),_0x0baf('0x38'),_0x0baf('0x39'),'ListId',_0x4520d1,_0x0baf('0x3a'),_0x0baf('0x3b')],squel[_0x0baf('0x3c')]()[_0x0baf('0x3d')](_0x0baf('0x37'),_0x0baf('0x37'))[_0x0baf('0x3d')]('NOW()','scheduledAt')[_0x0baf('0x3d')]('id',_0x0baf('0x39'))[_0x0baf('0x3d')](LISTID[_0x0baf('0x3f')](),_0x0baf('0x28'))[_0x0baf('0x3d')](_0x411c1f['id'][_0x0baf('0x3f')](),_0x4520d1)[_0x0baf('0x3d')](_0x0baf('0x3e'),'createdAt')[_0x0baf('0x3d')](_0x0baf('0x3e'),_0x0baf('0x3b'))[_0x0baf('0x40')](_0x0baf('0x48'))[_0x0baf('0x41')](_0x0baf('0x42'))['where'](_0x0baf('0x43'),LISTID[_0x0baf('0x3f')]())[_0x0baf('0x41')](_0x0baf('0x4c'),squel[_0x0baf('0x49')](hopperContacts))[_0x0baf('0x41')](_0x0baf('0x44')))[_0x0baf('0x3f')]();return _0x42a68b;}function _0x498405(_0x178495,_0x5dc434){var _0x3c00e7=squel['insert']()['into'](_0x0baf('0x4d'))['fromQuery']([_0x0baf('0x37'),_0x0baf('0x39'),'ListId',_0x5dc434,_0x0baf('0x3a'),_0x0baf('0x3b')],squel[_0x0baf('0x3c')]()['field']('phone',_0x0baf('0x37'))[_0x0baf('0x3d')]('id',_0x0baf('0x39'))[_0x0baf('0x3d')](LISTID[_0x0baf('0x3f')](),'ListId')[_0x0baf('0x3d')](_0x178495['id']['toString'](),_0x5dc434)['field']('NOW()',_0x0baf('0x3a'))['field']('NOW()',_0x0baf('0x3b'))[_0x0baf('0x40')](_0x0baf('0x48'))[_0x0baf('0x41')](_0x0baf('0x42'))[_0x0baf('0x41')]('ListId\x20=\x20?',LISTID[_0x0baf('0x3f')]())[_0x0baf('0x41')](_0x0baf('0x4c'),squel[_0x0baf('0x49')](hopperContacts))[_0x0baf('0x41')](_0x0baf('0x44')))['toString']();return _0x3c00e7;}return db[_0x0baf('0x4e')][_0x0baf('0x4f')]({'where':{'type':_0x0baf('0x50')},'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0x0baf('0x51')],'as':_0x0baf('0x52'),'where':{'id':LISTID}}]})[_0x0baf('0x2e')](function(_0x2c20fe){var _0x125906=[];if(_0x2c20fe){var _0x27a959;for(var _0x4cc046=0x0,_0x5874cc;_0x4cc046<_0x2c20fe['length'];_0x4cc046+=0x1){_0x5874cc=_0x2c20fe[_0x4cc046]['get']({'plain':!![]});switch(_0x5874cc[_0x0baf('0x53')]){case _0x0baf('0x54'):_0x125906[_0x0baf('0x2f')](db[_0x0baf('0x55')][_0x0baf('0x56')](_0x1daf1d(_0x5874cc,_0x0baf('0x57')))['then'](function(){})['catch'](_0x1b0991()));break;case _0x0baf('0x58'):_0x125906['push'](db[_0x0baf('0x55')][_0x0baf('0x56')](_0x5b991f(_0x5874cc,'VoiceQueueId'))[_0x0baf('0x2e')](function(){})[_0x0baf('0x59')](_0x1b0991()));break;default:_0x125906[_0x0baf('0x2f')](db[_0x0baf('0x55')][_0x0baf('0x56')](_0xcf7b8d(_0x5874cc,_0x0baf('0x57')))[_0x0baf('0x2e')](function(){})[_0x0baf('0x59')](_0x1b0991()));}}}return _0x125906;})[_0x0baf('0x5a')]()['then'](function(){return db['VoiceQueue']['findAll']({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':db['CmList'],'as':_0x0baf('0x5b'),'where':{'id':LISTID}}]})[_0x0baf('0x2e')](function(_0x333b07){var _0x20a514=[];if(_0x333b07){var _0x5093f5;for(var _0x1be7f2=0x0,_0x410f6c;_0x1be7f2<_0x333b07['length'];_0x1be7f2+=0x1){_0x410f6c=_0x333b07[_0x1be7f2]['get']({'plain':!![]});_0x20a514[_0x0baf('0x2f')](db[_0x0baf('0x55')][_0x0baf('0x56')](_0x498405(_0x410f6c,_0x0baf('0x57')))[_0x0baf('0x2e')](function(){})[_0x0baf('0x59')](_0x1b0991()));}}return _0x20a514;})[_0x0baf('0x5a')]();})[_0x0baf('0x2e')](function(){return db['Campaign'][_0x0baf('0x4f')]({'attributes':['id',_0x0baf('0x53')],'include':[{'model':db['CmList'],'as':_0x0baf('0x52'),'where':{'id':LISTID}}]})[_0x0baf('0x2e')](function(_0x538f24){var _0x97d385=[];if(_0x538f24){for(var _0x4043d5=0x0,_0x421ca0;_0x4043d5<_0x538f24[_0x0baf('0x1a')];_0x4043d5+=0x1){_0x421ca0=_0x538f24[_0x4043d5][_0x0baf('0x5c')]({'plain':!![]});switch(_0x421ca0['dialCheckDuplicateType']){case'always':_0x97d385[_0x0baf('0x2f')](db[_0x0baf('0x55')]['query'](_0x1daf1d(_0x421ca0,_0x0baf('0x5d')))[_0x0baf('0x2e')](function(){})[_0x0baf('0x59')](_0x1b0991()));break;case'onlyIfOpen':_0x97d385[_0x0baf('0x2f')](db[_0x0baf('0x55')][_0x0baf('0x56')](_0x5b991f(_0x421ca0,'CampaignId'))[_0x0baf('0x2e')](function(){})['catch'](_0x1b0991()));break;default:_0x97d385[_0x0baf('0x2f')](db[_0x0baf('0x55')][_0x0baf('0x56')](_0xcf7b8d(_0x421ca0,_0x0baf('0x5d')))[_0x0baf('0x2e')](function(){})['catch'](_0x1b0991()));}}}return _0x97d385;})[_0x0baf('0x5a')]();})[_0x0baf('0x2e')](function(){return db['Campaign'][_0x0baf('0x4f')]({'attributes':['id'],'include':[{'model':db[_0x0baf('0x51')],'as':_0x0baf('0x5b'),'where':{'id':LISTID}}]})[_0x0baf('0x2e')](function(_0x1cbbcc){var _0x250df2=[];if(_0x1cbbcc){for(var _0xa4fd1b=0x0,_0x1cda78;_0xa4fd1b<_0x1cbbcc[_0x0baf('0x1a')];_0xa4fd1b+=0x1){_0x1cda78=_0x1cbbcc[_0xa4fd1b][_0x0baf('0x5c')]({'plain':!![]});_0x250df2[_0x0baf('0x2f')](db[_0x0baf('0x55')]['query'](_0x498405(_0x1cda78,'CampaignId'))[_0x0baf('0x2e')](function(){})[_0x0baf('0x59')](_0x1b0991()));}}return _0x250df2;})[_0x0baf('0x5a')]();})['catch'](function(_0x507783){logger[_0x0baf('0x15')](_0x0baf('0x5e'),_0x0baf('0x5f'),_0x507783[_0x0baf('0x1c')]);});}var processPromises=function(_0x2dcdfe){return BPromise[_0x0baf('0x5a')](promises)[_0x0baf('0x2e')](function(_0xa2d315){})[_0x0baf('0x59')](function(_0x4e8e85){logger[_0x0baf('0x15')](_0x0baf('0x60'),JSON[_0x0baf('0x32')](_0x4e8e85));})[_0x0baf('0x61')](function(){socket['emit']('contact:csv_'+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x2dcdfe){return _0x2dcdfe['resume']();}});};var endCsv=function(){return BPromise[_0x0baf('0x62')]()[_0x0baf('0x2e')](function(){if(hopperContacts){return checkHopper();}})['then'](function(){socket['emit'](_0x0baf('0x63')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x0baf('0x64')](FILEPATH);}catch(_0x52e0c4){logger[_0x0baf('0x15')](_0x0baf('0x65'),JSON[_0x0baf('0x32')](_0x52e0c4));}finally{process[_0x0baf('0x66')](0x0);}});};process['on'](_0x0baf('0x67'),function(){logger[_0x0baf('0x68')](_0x0baf('0x69'));endCsv();});function main(){return BPromise[_0x0baf('0x62')]()[_0x0baf('0x2e')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x0baf('0x13')](',');return db[_0x0baf('0x6a')][_0x0baf('0x4f')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})['then'](function(_0x1ed607){var _0xd0f63b=fs[_0x0baf('0x6b')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x0baf('0x6c')](_0xd0f63b,{'header':!![],'skipEmptyLines':!![],'step':function(_0x3c37b4,_0x195303){total+=0x1;var _0x49d411=total;promises[_0x0baf('0x2f')](checkRow(_0x3c37b4,_0x1ed607,_0x49d411)[_0x0baf('0x2e')](function(){success+=0x1;})[_0x0baf('0x59')](function(_0x457ae8){if(_0x457ae8[_0x0baf('0x15')]){errors+=0x1;delete _0x457ae8['error'];}else if(_0x457ae8[_0x0baf('0x6d')]){duplicates+=0x1;delete _0x457ae8[_0x0baf('0x6d')];}rows[_0x0baf('0x2f')](_0x457ae8);}));if(total%0xc8===0x0){_0x195303[_0x0baf('0x6e')]();return processPromises(_0x195303);}},'complete':function(){return processPromises()[_0x0baf('0x2e')](function(){logger['info']('CSV\x20parsed\x20correctly!');endCsv();});},'error':function(_0xb5f4e5,_0x5a2454){logger[_0x0baf('0x68')]('CSV\x20parse\x20error',JSON[_0x0baf('0x32')](_0xb5f4e5));endCsv();}});})[_0x0baf('0x59')](function(_0x1ce7bb){logger[_0x0baf('0x15')]('Error\x20executing\x20contact\x20csv\x20import:',JSON[_0x0baf('0x32')](_0x1ce7bb));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 6c18e6e..ee451a1 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 _0x662e=['from','join','.id\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','scheduledat','createdAt','updatedAt','recallme','fields','cm_contacts.ListId\x20=\x20','.CmListId','where','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','\x22always\x22','\x22onlyIfOpen\x22','cm_contacts.phone\x20NOT\x20IN\x20(?)','toString','cm_hopper_black','ContactId','ListId','cm_contacts','ListId\x20=\x20?','\x20=\x20?','concat','keys','CompanyId',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','MIN(id)','min_id','message','errors','push','query','spread','error','main','start','binding','root','server/files/tmp','.csv','info','header','writeFileSync','parse','createReadStream','data','length','rows','hasOwnProperty','trim','replace','YYYY-MM-DD\x20HH:mm:ss','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','priority','isNaN','UserId','isNumber','agent\x20not\x20exists','email','email\x20wrong\x20format','YYYY-MM-DD','firstName','contact:import:','Abort\x20parser','abort','SystemError','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',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','voice_queues_has_cm_lists','VoiceQueueId','voice_queues_has_cm_blacklists','voice_queues','campaigns_has_cm_lists','CampaignId','campaigns','each','then','finish','affectedRows','unlink','catch','exit','complete','argv','arguments\x20\x20\x20','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','SIGINT','uncaughtException','path','lodash','papaparse','bluebird','moment','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','redis','defaults','localhost','socket.io-emitter','format','select','field','phone'];(function(_0x3f17fe,_0x1777c8){var _0x5eb221=function(_0x42550e){while(--_0x42550e){_0x3f17fe['push'](_0x3f17fe['shift']());}};_0x5eb221(++_0x1777c8);}(_0x662e,0x17a));var _0xe662=function(_0x231e02,_0x15ebb6){_0x231e02=_0x231e02-0x0;var _0x562398=_0x662e[_0x231e02];return _0x562398;};'use strict';var fs=require('fs');var path=require(_0xe662('0x0'));var _=require(_0xe662('0x1'));var Papa=require(_0xe662('0x2'));var util=require('util');var BPromise=require(_0xe662('0x3'));var moment=require(_0xe662('0x4'));var squel=require(_0xe662('0x5'));var Redis=require(_0xe662('0x6'));var db=require(_0xe662('0x7'))['db'];var config=require(_0xe662('0x8'));var logger=require(_0xe662('0x9'))('import');config[_0xe662('0xa')]=_[_0xe662('0xb')](config[_0xe662('0xa')],{'host':_0xe662('0xc'),'port':0x18eb});var socket=require(_0xe662('0xd'))(new Redis(config[_0xe662('0xa')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()[_0xe662('0xe')]('YYYY-MM-DD\x20HH:mm:ss');function isEmail(_0xfef7dd){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'](_0xfef7dd);}function selectNotIn(_0x3114c3,_0x55901f,_0x58d8de,_0x1d7536,_0x4c5f2c){return squel[_0xe662('0xf')]()[_0xe662('0x10')](_0xe662('0x11'))[_0xe662('0x12')](_0x1d7536)[_0xe662('0x13')](_0x55901f,null,_0x55901f+_0xe662('0x14')+_0x1d7536+'.'+_0x58d8de)['where'](_0x1d7536+'.'+_0x58d8de+'\x20=\x20'+_0x3114c3+'.'+_0x58d8de)['where'](_0x55901f+_0xe662('0x15')+_0x4c5f2c['join']()+')');}function insertCmHopper(_0x528678,_0x264451,_0x2b4f68,_0x37f43c,_0x1eb66b){var _0x1b0207=[_0xe662('0x16'),_0xe662('0x17'),_0xe662('0x18'),_0xe662('0x19'),_0x264451+'.'+_0x37f43c,_0xe662('0x1a'),_0xe662('0x1b'),_0xe662('0x1c'),_0xe662('0x1d'),'\x22'+_0x1eb66b+'\x22'];return squel[_0xe662('0x1e')]()[_0xe662('0x1f')](_0xe662('0x20'))[_0xe662('0x21')]([_0xe662('0x11'),_0xe662('0x22'),'ContactId','ListId',_0x37f43c,_0xe662('0x23'),_0xe662('0x24'),'priority','UserId',_0xe662('0x25')],squel[_0xe662('0xf')]()[_0xe662('0x26')](_0x1b0207)[_0xe662('0x12')](_0x264451)['join']('cm_contacts',null,_0xe662('0x27')+_0x264451+_0xe662('0x28'))[_0xe662('0x13')](_0x2b4f68,null,_0x2b4f68+_0xe662('0x14')+_0x264451+'.'+_0x37f43c)[_0xe662('0x29')](_0x264451+_0xe662('0x2a'),_0x528678)[_0xe662('0x29')](_0xe662('0x2b'),NOW)[_0xe662('0x29')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x264451,_0x2b4f68,_0x37f43c,_0xe662('0x20'),[_0xe662('0x2c'),_0xe662('0x2d')]))[_0xe662('0x29')](_0xe662('0x2e'),selectNotIn(_0x264451,_0x2b4f68,_0x37f43c,'cm_hopper',[_0xe662('0x2c')])))[_0xe662('0x2f')]();}function insertCmHopperBlack(_0x45132f,_0x4047fe,_0x457488,_0x43cdf2){var _0x95ad1c=[_0xe662('0x16'),_0xe662('0x18'),'cm_contacts.ListId',_0x4047fe+'.'+_0x43cdf2,_0xe662('0x1a'),'cm_contacts.updatedAt'];return squel[_0xe662('0x1e')]()[_0xe662('0x1f')](_0xe662('0x30'))[_0xe662('0x21')]([_0xe662('0x11'),_0xe662('0x31'),_0xe662('0x32'),_0x43cdf2,'createdAt','updatedAt'],squel['select']()['fields'](_0x95ad1c)[_0xe662('0x12')](_0x4047fe)['join'](_0xe662('0x33'),null,_0xe662('0x27')+_0x4047fe+'.CmListId')[_0xe662('0x13')](_0x457488,null,_0x457488+'.id\x20=\x20'+_0x4047fe+'.'+_0x43cdf2)[_0xe662('0x29')](_0x4047fe+'.CmListId\x20=\x20?',_0x45132f)['where'](_0xe662('0x2b'),NOW)[_0xe662('0x29')](_0xe662('0x2e'),squel['select']()['field'](_0xe662('0x11'))['from'](_0xe662('0x30'))[_0xe662('0x29')](_0xe662('0x34'),_0x45132f)['where'](_0x43cdf2+_0xe662('0x35'),_0x4047fe+'.'+_0x43cdf2)))[_0xe662('0x2f')]();}function insertCmContact(_0x2ddfe6,_0x36795f,_0x415f5d,_0x2dd247){var _0x4efc1c=_[_0xe662('0x36')](_[_0xe662('0x37')](_0x2dd247),[_0xe662('0x32'),_0xe662('0x38'),_0xe662('0x23'),_0xe662('0x24')]);return squel['insert']()[_0xe662('0x1f')](_0xe662('0x33'))[_0xe662('0x21')](_0x4efc1c,squel[_0xe662('0xf')]()['fields'](_0x4efc1c)['from'](_0x36795f)[_0xe662('0x29')]('('+_0x415f5d[_0xe662('0x13')](',')+_0xe662('0x39'),squel[_0xe662('0xf')]()[_0xe662('0x26')](_0x415f5d)[_0xe662('0x12')](_0xe662('0x33'))[_0xe662('0x29')](_0xe662('0x34'),_0x2ddfe6)[_0xe662('0x29')](_0xe662('0x3a')))[_0xe662('0x29')]('id\x20IN\x20?',squel['select']()[_0xe662('0x10')](_0xe662('0x3b'),_0xe662('0x3c'))['from'](_0x36795f)['group'](_0x415f5d['join'](','))))[_0xe662('0x2f')]();}function handleStop(){logger['info']('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x3efb60){logger['error'](_0x3efb60[_0xe662('0x3d')]);process['exit'](0x1);}function handleError(_0xd59dd9,_0x2e13a5){stats[_0xe662('0x3e')][_0xe662('0x3f')]({'name':_0x2e13a5['code'],'message':_0x2e13a5[_0xe662('0x3d')],'row':_0xd59dd9});}function handleQuery(_0xbba176){logger['info'](_0xbba176);return db['sequelize'][_0xe662('0x40')](_0xbba176)[_0xe662('0x41')](function(_0x34af25){results[_0xe662('0x3f')](_0x34af25);})['catch'](function(_0x582263){logger[_0xe662('0x42')](_0x582263['message']);});}function main(_0x26b4dc,_0x41eb64,_0x5ada4a,_0x265218){logger['info'](_0xe662('0x43'),_0x26b4dc,JSON['stringify'](_0x41eb64));process['send'](_0xe662('0x44'));var _0x58d411=_0x41eb64[_0xe662('0x45')];var _0x393fd1=_0x41eb64['socket_timestamp'];var _0x309ac8=path[_0xe662('0x13')](config[_0xe662('0x46')],_0xe662('0x47'),_0x393fd1+_0xe662('0x48'));var _0x324d93=_['keys'](_0x58d411)[_0xe662('0x13')]();logger[_0xe662('0x49')](_0xe662('0x4a'),_0x324d93);fs[_0xe662('0x4b')](_0x309ac8,_0x324d93+'\x0a');Papa[_0xe662('0x4c')](fs[_0xe662('0x4d')](_0x26b4dc),{'header':!![],'skipEmptyLines':!![],'step':function(_0xba105d,_0x2a5610){try{for(var _0x1e9ea0=0x0,_0x2f0e40=[];_0x1e9ea0<_0xba105d[_0xe662('0x4e')][_0xe662('0x4f')];_0x1e9ea0++){stats[_0xe662('0x50')]+=0x1;if(_0xba105d[_0xe662('0x3e')][_0x1e9ea0]){handleError(_0xba105d['data'][_0x1e9ea0],_0xba105d[_0xe662('0x3e')][_0x1e9ea0]);}else{var _0x114b8a=[];for(var _0x1ef451 in _0x58d411){if(_0x58d411[_0xe662('0x51')](_0x1ef451)){if(_0xba105d[_0xe662('0x4e')][_0x1e9ea0][_0x58d411[_0x1ef451]]){var _0x422a11=_[_0xe662('0x52')](_0xba105d[_0xe662('0x4e')][_0x1e9ea0][_0x58d411[_0x1ef451]][_0xe662('0x53')](/"/g,'\x27'));switch(_0x1ef451){case _0xe662('0x22'):var _0x1ada6d=moment(_0x422a11,_0xe662('0x54'),!![]);if(_0x1ada6d[_0xe662('0x55')]()){_0x2f0e40[_0xe662('0x3f')]('\x22'+_0x422a11+'\x22');}else{_0x114b8a['push'](_0xe662('0x56'));}break;case _0xe662('0x57'):var _0x1385be=parseInt(_0x422a11);_0x422a11=_[_0xe662('0x58')](_0x1385be)||_0x1385be<0x0||_0x1385be>0x4?_0x265218?0x3:0x2:_0x1385be;_0x2f0e40['push']('\x22'+_0x422a11+'\x22');break;case _0xe662('0x59'):var _0x3e8180=parseInt(_0x422a11);if(_[_0xe662('0x5a')](_0x3e8180)&&_['includes'](_0x5ada4a,_0x3e8180)){_0x2f0e40['push']('\x22'+_0x3e8180+'\x22');}else{_0x114b8a[_0xe662('0x3f')](_0xe662('0x5b'));}break;case _0xe662('0x5c'):if(isEmail(_0x422a11)){_0x2f0e40[_0xe662('0x3f')]('\x22'+_0x422a11+'\x22');}else{_0x114b8a[_0xe662('0x3f')](_0xe662('0x5d'));}break;case'dateOfBirth':var _0x3693d7=moment(_0x422a11,_0xe662('0x5e'),!![]);if(_0x3693d7[_0xe662('0x55')]()){_0x2f0e40['push']('\x22'+_0x422a11+'\x22');}else{_0x114b8a[_0xe662('0x3f')]('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;default:_0x2f0e40[_0xe662('0x3f')]('\x22'+_0x422a11+'\x22');}}else{switch(_0x1ef451){case _0xe662('0x5f'):case _0xe662('0x11'):_0x114b8a[_0xe662('0x3f')](_0x1ef451+'\x20not\x20specified');break;default:_0x2f0e40['push']('\x22\x22');}}}}if(_0x114b8a[_0xe662('0x4f')]){handleError(_0xba105d['data'][_0x1e9ea0],{'code':'SystemRow','message':_0x114b8a[_0xe662('0x13')]()});}else{fs['appendFileSync'](_0x309ac8,_0x2f0e40[_0xe662('0x13')]()+'\x0a');}_0x2f0e40=[];}if(!(stats[_0xe662('0x50')]%0xc8)){socket['emit'](_0xe662('0x60')+_0x393fd1,stats);stats[_0xe662('0x3e')]=[];}}if(stopped){logger[_0xe662('0x49')](_0xe662('0x61'));_0x2a5610[_0xe662('0x62')]();}}catch(_0x5f4ad4){handleError(_0xba105d[_0xe662('0x4e')][_0x1e9ea0],{'code':_0xe662('0x63'),'message':_0x5f4ad4[_0xe662('0x3d')]});logger[_0xe662('0x42')]('step',_0x5f4ad4[_0xe662('0x3d')]);}},'complete':function(){try{var _0x5e00e4=[];var _0x632f38='cm_contacts';if(_0x41eb64[_0xe662('0x64')]&&_0x41eb64[_0xe662('0x64')][_0xe662('0x4f')]){_0x632f38=_0xe662('0x65')+_0x393fd1;_0x5e00e4[_0xe662('0x3f')](_0xe662('0x66')+_0x632f38+_0xe662('0x67'));}var _0x53c681=util[_0xe662('0xe')](_0xe662('0x68'),_0x309ac8,_0x632f38,_0x324d93,_0x41eb64[_0xe662('0x32')],_0x41eb64[_0xe662('0x38')]||null,NOW,NOW);if(_['isNil'](_0x58d411[_0xe662('0x22')])){_0x53c681+=_0xe662('0x69');}_0x5e00e4['push'](_0x53c681);if(_0x41eb64['duplicates']&&_0x41eb64[_0xe662('0x64')][_0xe662('0x4f')]){_0x5e00e4[_0xe662('0x3f')](insertCmContact(_0x41eb64[_0xe662('0x32')],_0x632f38,_0x41eb64[_0xe662('0x64')],_0x58d411));_0x5e00e4[_0xe662('0x3f')](_0xe662('0x6a')+_0x632f38+';');}_0x5e00e4['push'](insertCmHopper(_0x41eb64[_0xe662('0x32')],_0xe662('0x6b'),'voice_queues',_0xe662('0x6c'),_0x265218));_0x5e00e4['push'](insertCmHopperBlack(_0x41eb64['ListId'],_0xe662('0x6d'),_0xe662('0x6e'),_0xe662('0x6c')));_0x5e00e4[_0xe662('0x3f')](insertCmHopper(_0x41eb64[_0xe662('0x32')],_0xe662('0x6f'),'campaigns',_0xe662('0x70'),_0x265218));_0x5e00e4[_0xe662('0x3f')](insertCmHopperBlack(_0x41eb64[_0xe662('0x32')],'campaigns_has_cm_blacklists',_0xe662('0x71'),_0xe662('0x70')));BPromise[_0xe662('0x72')](_0x5e00e4,handleQuery)[_0xe662('0x73')](function(_0x4edd4f){stats[_0xe662('0x74')]=!![];stats[_0xe662('0x75')]=_0x41eb64[_0xe662('0x64')]&&_0x41eb64['duplicates']['length']?results[0x2][_0xe662('0x75')]:results[0x0][_0xe662('0x75')];socket['emit'](_0xe662('0x60')+_0x393fd1,stats);fs[_0xe662('0x76')](_0x26b4dc);fs['unlink'](_0x309ac8);process['exit'](0x0);})[_0xe662('0x77')](function(_0x31cce5){logger['error'](_0x31cce5[_0xe662('0x3d')]);process[_0xe662('0x78')](0x1);});}catch(_0x42052c){logger[_0xe662('0x42')](_0xe662('0x79'),_0x42052c['message']);process['exit'](0x1);}},'error':function(_0x4d4f42,_0x5565a8,_0x214353,_0xfa4d67){throw new Error(_0xfa4d67);}});}function validate(){if(process[_0xe662('0x7a')]&&process[_0xe662('0x7a')][_0xe662('0x4f')]<0x4){throw new Error(_0xe662('0x7b'));}var _0x28d59e=path[_0xe662('0x13')](config[_0xe662('0x46')],'server/files/tmp',process[_0xe662('0x7a')][0x2]);if(!fs['existsSync'](_0x28d59e)){throw new Error(_0xe662('0x7c'));}var _0x5d546a={};try{_0x5d546a=JSON['parse'](process[_0xe662('0x7a')][0x3]);if(!_0x5d546a[_0xe662('0x45')]){throw new Error(_0xe662('0x7d'));}if(!_0x5d546a[_0xe662('0x45')][_0xe662('0x11')]){throw new Error('phone\x20is\x20mandatory');}if(!_0x5d546a[_0xe662('0x45')][_0xe662('0x5f')]){throw new Error(_0xe662('0x7e'));}var _0x3ed929=0x0;if(_0x5d546a['binding'][_0xe662('0x59')]){_0x3ed929=0x1;}if(!_0x5d546a[_0xe662('0x32')]){throw new Error(_0xe662('0x7f'));}}catch(_0x1b1355){throw new Error(_0xe662('0x80'));}var _0x25b1f1=[];try{_0x25b1f1=_[_0xe662('0x81')](JSON[_0xe662('0x4c')](process['argv'][0x4]),'id');}catch(_0x2cf36e){logger[_0xe662('0x49')]('No\x20agent\x20available');}main(_0x28d59e,_0x5d546a,_0x25b1f1,_0x3ed929);}validate();process['on'](_0xe662('0x82'),handleStop);process['on'](_0xe662('0x83'),handleUncaughtException); \ No newline at end of file +var _0xc616=['cm_contacts.ListId\x20=\x20','.CmListId\x20=\x20?','ListId\x20=\x20?','\x20=\x20?','concat','CompanyId','createdAt','deletedAt\x20IS\x20NULL','MIN(id)','min_id','group','info','Received\x20SIGINT','error','message','exit','push','code','sequelize','query','spread','catch','main','send','start','binding','socket_timestamp','root','.csv','keys','header','writeFileSync','createReadStream','length','rows','errors','data','hasOwnProperty','trim','replace','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','email','email\x20wrong\x20format','isValid','firstName','\x20not\x20specified','SystemRow','contact:import:','Abort\x20parser','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()','voice_queues_has_cm_lists','VoiceQueueId','voice_queues_has_cm_blacklists','voice_queues','campaigns_has_cm_lists','campaigns','CampaignId','each','finish','affectedRows','emit','complete','argv','arguments\x20\x20\x20','file\x20doesn\x27t\x20exists','parse','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','No\x20agent\x20available','SIGINT','uncaughtException','papaparse','squel','../../../config/logger','import','redis','defaults','localhost','format','YYYY-MM-DD\x20HH:mm:ss','test','select','field','phone','from','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','into','cm_hopper','scheduledat','ListId','updatedAt','UserId','recallme','fields','cm_contacts','.CmListId','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','toString','insert'];(function(_0x46c1d5,_0x5ca335){var _0x40fe7b=function(_0x34cb99){while(--_0x34cb99){_0x46c1d5['push'](_0x46c1d5['shift']());}};_0x40fe7b(++_0x5ca335);}(_0xc616,0xce));var _0x6c61=function(_0x25f531,_0x1209ae){_0x25f531=_0x25f531-0x0;var _0x6ac282=_0xc616[_0x25f531];return _0x6ac282;};'use strict';var fs=require('fs');var path=require('path');var _=require('lodash');var Papa=require(_0x6c61('0x0'));var util=require('util');var BPromise=require('bluebird');var moment=require('moment');var squel=require(_0x6c61('0x1'));var Redis=require('ioredis');var db=require('../../../mysqldb')['db'];var config=require('../../../config/environment');var logger=require(_0x6c61('0x2'))(_0x6c61('0x3'));config[_0x6c61('0x4')]=_[_0x6c61('0x5')](config[_0x6c61('0x4')],{'host':_0x6c61('0x6'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6c61('0x4')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()[_0x6c61('0x7')](_0x6c61('0x8'));function isEmail(_0x402bc0){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))*$/[_0x6c61('0x9')](_0x402bc0);}function selectNotIn(_0x5cb203,_0x2e70f3,_0x3b89e5,_0x1e8cd3,_0x1d44ab){return squel[_0x6c61('0xa')]()[_0x6c61('0xb')](_0x6c61('0xc'))[_0x6c61('0xd')](_0x1e8cd3)[_0x6c61('0xe')](_0x2e70f3,null,_0x2e70f3+_0x6c61('0xf')+_0x1e8cd3+'.'+_0x3b89e5)[_0x6c61('0x10')](_0x1e8cd3+'.'+_0x3b89e5+_0x6c61('0x11')+_0x5cb203+'.'+_0x3b89e5)[_0x6c61('0x10')](_0x2e70f3+_0x6c61('0x12')+_0x1d44ab[_0x6c61('0xe')]()+')');}function insertCmHopper(_0x1e241f,_0x212037,_0x354cef,_0x3b3a3a,_0x373545){var _0x330481=[_0x6c61('0x13'),_0x6c61('0x14'),_0x6c61('0x15'),_0x6c61('0x16'),_0x212037+'.'+_0x3b3a3a,_0x6c61('0x17'),_0x6c61('0x18'),_0x6c61('0x19'),_0x6c61('0x1a'),'\x22'+_0x373545+'\x22'];return squel['insert']()[_0x6c61('0x1b')](_0x6c61('0x1c'))['fromQuery']([_0x6c61('0xc'),_0x6c61('0x1d'),'ContactId',_0x6c61('0x1e'),_0x3b3a3a,'createdAt',_0x6c61('0x1f'),'priority',_0x6c61('0x20'),_0x6c61('0x21')],squel[_0x6c61('0xa')]()[_0x6c61('0x22')](_0x330481)['from'](_0x212037)[_0x6c61('0xe')](_0x6c61('0x23'),null,'cm_contacts.ListId\x20=\x20'+_0x212037+_0x6c61('0x24'))[_0x6c61('0xe')](_0x354cef,null,_0x354cef+_0x6c61('0xf')+_0x212037+'.'+_0x3b3a3a)[_0x6c61('0x10')](_0x212037+'.CmListId\x20=\x20?',_0x1e241f)[_0x6c61('0x10')](_0x6c61('0x25'),NOW)[_0x6c61('0x10')](_0x6c61('0x26'),selectNotIn(_0x212037,_0x354cef,_0x3b3a3a,'cm_hopper',[_0x6c61('0x27'),'\x22onlyIfOpen\x22']))[_0x6c61('0x10')](_0x6c61('0x26'),selectNotIn(_0x212037,_0x354cef,_0x3b3a3a,_0x6c61('0x1c'),[_0x6c61('0x27')])))[_0x6c61('0x28')]();}function insertCmHopperBlack(_0x544c8f,_0x414cf6,_0x1cd528,_0x567b25){var _0x4fcf5a=[_0x6c61('0x13'),_0x6c61('0x15'),_0x6c61('0x16'),_0x414cf6+'.'+_0x567b25,_0x6c61('0x17'),_0x6c61('0x18')];return squel[_0x6c61('0x29')]()[_0x6c61('0x1b')]('cm_hopper_black')['fromQuery']([_0x6c61('0xc'),'ContactId',_0x6c61('0x1e'),_0x567b25,'createdAt',_0x6c61('0x1f')],squel[_0x6c61('0xa')]()['fields'](_0x4fcf5a)[_0x6c61('0xd')](_0x414cf6)[_0x6c61('0xe')](_0x6c61('0x23'),null,_0x6c61('0x2a')+_0x414cf6+_0x6c61('0x24'))['join'](_0x1cd528,null,_0x1cd528+_0x6c61('0xf')+_0x414cf6+'.'+_0x567b25)[_0x6c61('0x10')](_0x414cf6+_0x6c61('0x2b'),_0x544c8f)[_0x6c61('0x10')](_0x6c61('0x25'),NOW)['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0x6c61('0xa')]()[_0x6c61('0xb')]('phone')[_0x6c61('0xd')]('cm_hopper_black')[_0x6c61('0x10')](_0x6c61('0x2c'),_0x544c8f)[_0x6c61('0x10')](_0x567b25+_0x6c61('0x2d'),_0x414cf6+'.'+_0x567b25)))['toString']();}function insertCmContact(_0x2bba39,_0x9cfcba,_0x5b968c,_0x2a0fb0){var _0x1949b2=_[_0x6c61('0x2e')](_['keys'](_0x2a0fb0),[_0x6c61('0x1e'),_0x6c61('0x2f'),_0x6c61('0x30'),'updatedAt']);return squel[_0x6c61('0x29')]()['into']('cm_contacts')['fromQuery'](_0x1949b2,squel[_0x6c61('0xa')]()[_0x6c61('0x22')](_0x1949b2)['from'](_0x9cfcba)[_0x6c61('0x10')]('('+_0x5b968c['join'](',')+')\x20NOT\x20IN\x20?',squel[_0x6c61('0xa')]()[_0x6c61('0x22')](_0x5b968c)['from'](_0x6c61('0x23'))[_0x6c61('0x10')]('ListId\x20=\x20?',_0x2bba39)[_0x6c61('0x10')](_0x6c61('0x31')))[_0x6c61('0x10')]('id\x20IN\x20?',squel[_0x6c61('0xa')]()[_0x6c61('0xb')](_0x6c61('0x32'),_0x6c61('0x33'))[_0x6c61('0xd')](_0x9cfcba)[_0x6c61('0x34')](_0x5b968c[_0x6c61('0xe')](','))))['toString']();}function handleStop(){logger[_0x6c61('0x35')](_0x6c61('0x36'));stopped=!![];}function handleUncaughtException(_0x180c3a){logger[_0x6c61('0x37')](_0x180c3a[_0x6c61('0x38')]);process[_0x6c61('0x39')](0x1);}function handleError(_0x16dc53,_0x44c9ca){stats['errors'][_0x6c61('0x3a')]({'name':_0x44c9ca[_0x6c61('0x3b')],'message':_0x44c9ca['message'],'row':_0x16dc53});}function handleQuery(_0x440c2b){logger[_0x6c61('0x35')](_0x440c2b);return db[_0x6c61('0x3c')][_0x6c61('0x3d')](_0x440c2b)[_0x6c61('0x3e')](function(_0x13427f){results[_0x6c61('0x3a')](_0x13427f);})[_0x6c61('0x3f')](function(_0xebd9ee){logger[_0x6c61('0x37')](_0xebd9ee['message']);});}function main(_0x2eb760,_0x34fd55,_0x1fce27,_0x9aa1dd){logger[_0x6c61('0x35')](_0x6c61('0x40'),_0x2eb760,JSON['stringify'](_0x34fd55));process[_0x6c61('0x41')](_0x6c61('0x42'));var _0x25b5c3=_0x34fd55[_0x6c61('0x43')];var _0x1d7206=_0x34fd55[_0x6c61('0x44')];var _0x113f65=path[_0x6c61('0xe')](config[_0x6c61('0x45')],'server/files/tmp',_0x1d7206+_0x6c61('0x46'));var _0x11a925=_[_0x6c61('0x47')](_0x25b5c3)['join']();logger['info'](_0x6c61('0x48'),_0x11a925);fs[_0x6c61('0x49')](_0x113f65,_0x11a925+'\x0a');Papa['parse'](fs[_0x6c61('0x4a')](_0x2eb760),{'header':!![],'skipEmptyLines':!![],'step':function(_0xaa159e,_0x4ed013){try{for(var _0x1a5651=0x0,_0x49cbcd=[];_0x1a5651<_0xaa159e['data'][_0x6c61('0x4b')];_0x1a5651++){stats[_0x6c61('0x4c')]+=0x1;if(_0xaa159e[_0x6c61('0x4d')][_0x1a5651]){handleError(_0xaa159e[_0x6c61('0x4e')][_0x1a5651],_0xaa159e[_0x6c61('0x4d')][_0x1a5651]);}else{var _0x3aa73c=[];for(var _0x501f28 in _0x25b5c3){if(_0x25b5c3[_0x6c61('0x4f')](_0x501f28)){if(_0xaa159e['data'][_0x1a5651][_0x25b5c3[_0x501f28]]){var _0x217936=_[_0x6c61('0x50')](_0xaa159e[_0x6c61('0x4e')][_0x1a5651][_0x25b5c3[_0x501f28]][_0x6c61('0x51')](/"/g,'\x27'));switch(_0x501f28){case _0x6c61('0x1d'):var _0x24c3c8=moment(_0x217936,_0x6c61('0x8'),!![]);if(_0x24c3c8['isValid']()){_0x49cbcd[_0x6c61('0x3a')]('\x22'+_0x217936+'\x22');}else{_0x3aa73c[_0x6c61('0x3a')](_0x6c61('0x52'));}break;case'priority':var _0xfbd571=parseInt(_0x217936);_0x217936=_[_0x6c61('0x53')](_0xfbd571)||_0xfbd571<0x0||_0xfbd571>0x4?_0x9aa1dd?0x3:0x2:_0xfbd571;_0x49cbcd[_0x6c61('0x3a')]('\x22'+_0x217936+'\x22');break;case _0x6c61('0x20'):var _0x4e3b06=parseInt(_0x217936);if(_['isNumber'](_0x4e3b06)&&_['includes'](_0x1fce27,_0x4e3b06)){_0x49cbcd[_0x6c61('0x3a')]('\x22'+_0x4e3b06+'\x22');}else{_0x3aa73c[_0x6c61('0x3a')]('agent\x20not\x20exists');}break;case _0x6c61('0x54'):if(isEmail(_0x217936)){_0x49cbcd[_0x6c61('0x3a')]('\x22'+_0x217936+'\x22');}else{_0x3aa73c[_0x6c61('0x3a')](_0x6c61('0x55'));}break;case'dateOfBirth':var _0x245773=moment(_0x217936,'YYYY-MM-DD',!![]);if(_0x245773[_0x6c61('0x56')]()){_0x49cbcd['push']('\x22'+_0x217936+'\x22');}else{_0x3aa73c[_0x6c61('0x3a')]('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;default:_0x49cbcd[_0x6c61('0x3a')]('\x22'+_0x217936+'\x22');}}else{switch(_0x501f28){case _0x6c61('0x57'):case'phone':_0x3aa73c[_0x6c61('0x3a')](_0x501f28+_0x6c61('0x58'));break;default:_0x49cbcd[_0x6c61('0x3a')]('\x22\x22');}}}}if(_0x3aa73c[_0x6c61('0x4b')]){handleError(_0xaa159e['data'][_0x1a5651],{'code':_0x6c61('0x59'),'message':_0x3aa73c[_0x6c61('0xe')]()});}else{fs['appendFileSync'](_0x113f65,_0x49cbcd[_0x6c61('0xe')]()+'\x0a');}_0x49cbcd=[];}if(!(stats[_0x6c61('0x4c')]%0xc8)){socket['emit'](_0x6c61('0x5a')+_0x1d7206,stats);stats[_0x6c61('0x4d')]=[];}}if(stopped){logger[_0x6c61('0x35')](_0x6c61('0x5b'));_0x4ed013['abort']();}}catch(_0x37e78e){handleError(_0xaa159e[_0x6c61('0x4e')][_0x1a5651],{'code':_0x6c61('0x5c'),'message':_0x37e78e[_0x6c61('0x38')]});logger[_0x6c61('0x37')](_0x6c61('0x5d'),_0x37e78e['message']);}},'complete':function(){try{var _0xc051ff=[];var _0x2778f2=_0x6c61('0x23');if(_0x34fd55['duplicates']&&_0x34fd55[_0x6c61('0x5e')]['length']){_0x2778f2=_0x6c61('0x5f')+_0x1d7206;_0xc051ff['push'](_0x6c61('0x60')+_0x2778f2+_0x6c61('0x61'));}var _0x5d24d5=util[_0x6c61('0x7')](_0x6c61('0x62'),_0x113f65,_0x2778f2,_0x11a925,_0x34fd55[_0x6c61('0x1e')],_0x34fd55[_0x6c61('0x2f')]||null,NOW,NOW);if(_[_0x6c61('0x63')](_0x25b5c3[_0x6c61('0x1d')])){_0x5d24d5+=_0x6c61('0x64');}_0xc051ff[_0x6c61('0x3a')](_0x5d24d5);if(_0x34fd55[_0x6c61('0x5e')]&&_0x34fd55[_0x6c61('0x5e')][_0x6c61('0x4b')]){_0xc051ff['push'](insertCmContact(_0x34fd55[_0x6c61('0x1e')],_0x2778f2,_0x34fd55['duplicates'],_0x25b5c3));_0xc051ff[_0x6c61('0x3a')]('DROP\x20TABLE\x20'+_0x2778f2+';');}_0xc051ff[_0x6c61('0x3a')](insertCmHopper(_0x34fd55[_0x6c61('0x1e')],_0x6c61('0x65'),'voice_queues',_0x6c61('0x66'),_0x9aa1dd));_0xc051ff[_0x6c61('0x3a')](insertCmHopperBlack(_0x34fd55[_0x6c61('0x1e')],_0x6c61('0x67'),_0x6c61('0x68'),_0x6c61('0x66')));_0xc051ff['push'](insertCmHopper(_0x34fd55[_0x6c61('0x1e')],_0x6c61('0x69'),_0x6c61('0x6a'),_0x6c61('0x6b'),_0x9aa1dd));_0xc051ff[_0x6c61('0x3a')](insertCmHopperBlack(_0x34fd55[_0x6c61('0x1e')],'campaigns_has_cm_blacklists',_0x6c61('0x6a'),_0x6c61('0x6b')));BPromise[_0x6c61('0x6c')](_0xc051ff,handleQuery)['then'](function(_0x551648){stats[_0x6c61('0x6d')]=!![];stats[_0x6c61('0x6e')]=_0x34fd55[_0x6c61('0x5e')]&&_0x34fd55['duplicates'][_0x6c61('0x4b')]?results[0x2]['affectedRows']:results[0x0][_0x6c61('0x6e')];socket[_0x6c61('0x6f')]('contact:import:'+_0x1d7206,stats);fs['unlink'](_0x2eb760);fs['unlink'](_0x113f65);process[_0x6c61('0x39')](0x0);})['catch'](function(_0x307e73){logger[_0x6c61('0x37')](_0x307e73[_0x6c61('0x38')]);process[_0x6c61('0x39')](0x1);});}catch(_0x5eba03){logger[_0x6c61('0x37')](_0x6c61('0x70'),_0x5eba03[_0x6c61('0x38')]);process[_0x6c61('0x39')](0x1);}},'error':function(_0x230e0f,_0x31e08c,_0x51688e,_0x5a1342){throw new Error(_0x5a1342);}});}function validate(){if(process[_0x6c61('0x71')]&&process[_0x6c61('0x71')]['length']<0x4){throw new Error(_0x6c61('0x72'));}var _0x30aa6f=path[_0x6c61('0xe')](config[_0x6c61('0x45')],'server/files/tmp',process[_0x6c61('0x71')][0x2]);if(!fs['existsSync'](_0x30aa6f)){throw new Error(_0x6c61('0x73'));}var _0x1296e5={};try{_0x1296e5=JSON[_0x6c61('0x74')](process[_0x6c61('0x71')][0x3]);if(!_0x1296e5[_0x6c61('0x43')]){throw new Error(_0x6c61('0x75'));}if(!_0x1296e5['binding']['phone']){throw new Error(_0x6c61('0x76'));}if(!_0x1296e5['binding'][_0x6c61('0x57')]){throw new Error(_0x6c61('0x77'));}var _0x1b7721=0x0;if(_0x1296e5[_0x6c61('0x43')][_0x6c61('0x20')]){_0x1b7721=0x1;}if(!_0x1296e5[_0x6c61('0x1e')]){throw new Error(_0x6c61('0x78'));}}catch(_0x5bb4ff){throw new Error('body\x20id\x20mandatory');}var _0x152573=[];try{_0x152573=_['map'](JSON[_0x6c61('0x74')](process[_0x6c61('0x71')][0x4]),'id');}catch(_0x444733){logger[_0x6c61('0x35')](_0x6c61('0x79'));}main(_0x30aa6f,_0x1296e5,_0x152573,_0x1b7721);}validate();process['on'](_0x6c61('0x7a'),handleStop);process['on'](_0x6c61('0x7b'),handleUncaughtException); \ No newline at end of file diff --git a/server/components/integrations/configuration.js b/server/components/integrations/configuration.js index c6acc74..1efb40d 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 _0x8cc8=['Answer\x20Time','answertime','Complete\x20Time','endtime','duration','Billable\x20Time','billableseconds','getSubjects','string','[xCALLY\x20Ticket]','toLowerCase','voice','inbound','push','variable','queue','calleridnum','outbound','getDescriptions','***\x20Call\x20Info\x20***','keyValue','Caller\x20Number','calleridname','Call\x20To','destexten','Queue','UniqueId','uniqueid','Date','agentcalledAt','***\x20Agent\x20Info\x20***','Agent\x20Number','destcalleridnum','***\x20Time\x20Info\x20***','Agent\x20Ring','Agent\x20Connect','agentconnectAt','Agent\x20Complete','agentcompleteAt','Hold\x20Time','holdtime','talktime','Called\x20Number','Member\x20Name','membername','starttime'];(function(_0x53ea66,_0x295960){var _0x1ffe67=function(_0x19800e){while(--_0x19800e){_0x53ea66['push'](_0x53ea66['shift']());}};_0x1ffe67(++_0x295960);}(_0x8cc8,0x177));var _0x88cc=function(_0x38b5f1,_0x3e9caa){_0x38b5f1=_0x38b5f1-0x0;var _0x72d7d9=_0x8cc8[_0x38b5f1];return _0x72d7d9;};'use strict';exports[_0x88cc('0x0')]=function(_0x807f3,_0x20f9f0){var _0x3a0ab6=[{'type':_0x88cc('0x1'),'content':_0x88cc('0x2'),'variableName':null}];switch(_0x807f3[_0x88cc('0x3')]()){case _0x88cc('0x4'):switch(_0x20f9f0[_0x88cc('0x3')]()){case _0x88cc('0x5'):_0x3a0ab6[_0x88cc('0x6')]({'type':_0x88cc('0x7'),'content':'','variableName':_0x88cc('0x8')});_0x3a0ab6['push']({'type':'variable','content':'','variableName':_0x88cc('0x9')});break;case _0x88cc('0xa'):_0x3a0ab6[_0x88cc('0x6')]({'type':_0x88cc('0x1'),'content':'Outbound\x20Call','variableName':null});_0x3a0ab6[_0x88cc('0x6')]({'type':_0x88cc('0x7'),'content':'','variableName':'destcalleridnum'});break;}}return _0x3a0ab6;};exports[_0x88cc('0xb')]=function(_0x5586aa,_0x379c2a){var _0x23aee8=[];switch(_0x5586aa[_0x88cc('0x3')]()){case _0x88cc('0x4'):switch(_0x379c2a['toLowerCase']()){case _0x88cc('0x5'):_0x23aee8=[{'type':_0x88cc('0x1'),'content':_0x88cc('0xc'),'key':null,'keyType':null,'variableName':null},{'type':_0x88cc('0xd'),'content':'','key':_0x88cc('0xe'),'keyType':_0x88cc('0x7'),'variableName':_0x88cc('0x9')},{'type':_0x88cc('0xd'),'content':'','key':'Caller\x20Name','keyType':_0x88cc('0x7'),'variableName':_0x88cc('0xf')},{'type':_0x88cc('0xd'),'content':'','key':_0x88cc('0x10'),'keyType':_0x88cc('0x7'),'variableName':_0x88cc('0x11')},{'type':'keyValue','content':'','key':_0x88cc('0x12'),'keyType':_0x88cc('0x7'),'variableName':_0x88cc('0x8')},{'type':_0x88cc('0xd'),'content':'','key':_0x88cc('0x13'),'keyType':'variable','variableName':_0x88cc('0x14')},{'type':_0x88cc('0xd'),'content':'','key':_0x88cc('0x15'),'keyType':_0x88cc('0x7'),'variableName':_0x88cc('0x16')},{'type':'string','content':_0x88cc('0x17'),'key':null,'keyType':null,'variableName':null},{'type':_0x88cc('0xd'),'content':'','key':'Agent\x20Name','keyType':_0x88cc('0x7'),'variableName':'destcalleridname'},{'type':_0x88cc('0xd'),'content':'','key':_0x88cc('0x18'),'keyType':'variable','variableName':_0x88cc('0x19')},{'type':_0x88cc('0x1'),'content':_0x88cc('0x1a'),'key':null,'keyType':null,'variableName':null},{'type':_0x88cc('0xd'),'content':'','key':_0x88cc('0x1b'),'keyType':_0x88cc('0x7'),'variableName':'agentcalledAt'},{'type':_0x88cc('0xd'),'content':'','key':_0x88cc('0x1c'),'keyType':_0x88cc('0x7'),'variableName':_0x88cc('0x1d')},{'type':_0x88cc('0xd'),'content':'','key':_0x88cc('0x1e'),'keyType':_0x88cc('0x7'),'variableName':_0x88cc('0x1f')},{'type':_0x88cc('0xd'),'content':'','key':_0x88cc('0x20'),'keyType':_0x88cc('0x7'),'variableName':_0x88cc('0x21')},{'type':_0x88cc('0xd'),'content':'','key':'Talk\x20Time','keyType':_0x88cc('0x7'),'variableName':_0x88cc('0x22')}];break;case _0x88cc('0xa'):_0x23aee8=[{'type':_0x88cc('0x1'),'content':_0x88cc('0xc'),'variableName':null},{'type':_0x88cc('0xd'),'content':'','key':_0x88cc('0x23'),'keyType':_0x88cc('0x7'),'keyContent':'','variableName':'destcalleridnum'},{'type':'keyValue','content':'','key':_0x88cc('0x24'),'keyType':_0x88cc('0x7'),'keyContent':'','variableName':_0x88cc('0x25')},{'type':'keyValue','content':'','key':'UniqueId','keyType':_0x88cc('0x7'),'keyContent':'','variableName':_0x88cc('0x14')},{'type':'keyValue','content':'','key':_0x88cc('0x15'),'keyType':_0x88cc('0x7'),'keyContent':'','variableName':_0x88cc('0x26')},{'type':'string','content':_0x88cc('0x1a')},{'type':_0x88cc('0xd'),'content':'','key':_0x88cc('0x27'),'keyType':'variable','keyContent':'','variableName':_0x88cc('0x28')},{'type':_0x88cc('0xd'),'content':'','key':_0x88cc('0x29'),'keyType':_0x88cc('0x7'),'keyContent':'','variableName':_0x88cc('0x2a')},{'type':_0x88cc('0xd'),'content':'','key':'Duration','keyType':_0x88cc('0x7'),'keyContent':'','variableName':_0x88cc('0x2b')},{'type':_0x88cc('0xd'),'content':'','key':_0x88cc('0x2c'),'keyType':_0x88cc('0x7'),'keyContent':'','variableName':_0x88cc('0x2d')}];break;}}return _0x23aee8;}; \ No newline at end of file +var _0xb78e=['Caller\x20Name','Call\x20To','Queue','Date','agentcalledAt','***\x20Agent\x20Info\x20***','Agent\x20Name','Agent\x20Number','***\x20Time\x20Info\x20***','Agent\x20Ring','agentcompleteAt','Hold\x20Time','holdtime','Talk\x20Time','Called\x20Number','Member\x20Name','membername','UniqueId','uniqueid','Answer\x20Time','answertime','Complete\x20Time','endtime','Duration','duration','Billable\x20Time','billableseconds','getSubjects','string','[xCALLY\x20Ticket]','toLowerCase','voice','inbound','push','queue','variable','calleridnum','outbound','destcalleridnum','getDescriptions','***\x20Call\x20Info\x20***','keyValue','Caller\x20Number'];(function(_0x725b8e,_0xc22b48){var _0x43ac45=function(_0x46bb4a){while(--_0x46bb4a){_0x725b8e['push'](_0x725b8e['shift']());}};_0x43ac45(++_0xc22b48);}(_0xb78e,0x1c9));var _0xeb78=function(_0x37b960,_0x18c0d2){_0x37b960=_0x37b960-0x0;var _0x2317f2=_0xb78e[_0x37b960];return _0x2317f2;};'use strict';exports[_0xeb78('0x0')]=function(_0x261300,_0x4b8534){var _0x1570f5=[{'type':_0xeb78('0x1'),'content':_0xeb78('0x2'),'variableName':null}];switch(_0x261300[_0xeb78('0x3')]()){case _0xeb78('0x4'):switch(_0x4b8534[_0xeb78('0x3')]()){case _0xeb78('0x5'):_0x1570f5[_0xeb78('0x6')]({'type':'variable','content':'','variableName':_0xeb78('0x7')});_0x1570f5[_0xeb78('0x6')]({'type':_0xeb78('0x8'),'content':'','variableName':_0xeb78('0x9')});break;case _0xeb78('0xa'):_0x1570f5[_0xeb78('0x6')]({'type':_0xeb78('0x1'),'content':'Outbound\x20Call','variableName':null});_0x1570f5[_0xeb78('0x6')]({'type':_0xeb78('0x8'),'content':'','variableName':_0xeb78('0xb')});break;}}return _0x1570f5;};exports[_0xeb78('0xc')]=function(_0x125e97,_0x402680){var _0x15137b=[];switch(_0x125e97[_0xeb78('0x3')]()){case _0xeb78('0x4'):switch(_0x402680['toLowerCase']()){case _0xeb78('0x5'):_0x15137b=[{'type':_0xeb78('0x1'),'content':_0xeb78('0xd'),'key':null,'keyType':null,'variableName':null},{'type':_0xeb78('0xe'),'content':'','key':_0xeb78('0xf'),'keyType':_0xeb78('0x8'),'variableName':_0xeb78('0x9')},{'type':_0xeb78('0xe'),'content':'','key':_0xeb78('0x10'),'keyType':_0xeb78('0x8'),'variableName':'calleridname'},{'type':_0xeb78('0xe'),'content':'','key':_0xeb78('0x11'),'keyType':'variable','variableName':'destexten'},{'type':'keyValue','content':'','key':_0xeb78('0x12'),'keyType':'variable','variableName':_0xeb78('0x7')},{'type':_0xeb78('0xe'),'content':'','key':'UniqueId','keyType':_0xeb78('0x8'),'variableName':'uniqueid'},{'type':_0xeb78('0xe'),'content':'','key':_0xeb78('0x13'),'keyType':'variable','variableName':_0xeb78('0x14')},{'type':_0xeb78('0x1'),'content':_0xeb78('0x15'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0xeb78('0x16'),'keyType':_0xeb78('0x8'),'variableName':'destcalleridname'},{'type':'keyValue','content':'','key':_0xeb78('0x17'),'keyType':_0xeb78('0x8'),'variableName':_0xeb78('0xb')},{'type':_0xeb78('0x1'),'content':_0xeb78('0x18'),'key':null,'keyType':null,'variableName':null},{'type':_0xeb78('0xe'),'content':'','key':_0xeb78('0x19'),'keyType':_0xeb78('0x8'),'variableName':_0xeb78('0x14')},{'type':'keyValue','content':'','key':'Agent\x20Connect','keyType':'variable','variableName':'agentconnectAt'},{'type':_0xeb78('0xe'),'content':'','key':'Agent\x20Complete','keyType':_0xeb78('0x8'),'variableName':_0xeb78('0x1a')},{'type':'keyValue','content':'','key':_0xeb78('0x1b'),'keyType':'variable','variableName':_0xeb78('0x1c')},{'type':_0xeb78('0xe'),'content':'','key':_0xeb78('0x1d'),'keyType':_0xeb78('0x8'),'variableName':'talktime'}];break;case _0xeb78('0xa'):_0x15137b=[{'type':'string','content':_0xeb78('0xd'),'variableName':null},{'type':_0xeb78('0xe'),'content':'','key':_0xeb78('0x1e'),'keyType':'variable','keyContent':'','variableName':_0xeb78('0xb')},{'type':_0xeb78('0xe'),'content':'','key':_0xeb78('0x1f'),'keyType':_0xeb78('0x8'),'keyContent':'','variableName':_0xeb78('0x20')},{'type':_0xeb78('0xe'),'content':'','key':_0xeb78('0x21'),'keyType':_0xeb78('0x8'),'keyContent':'','variableName':_0xeb78('0x22')},{'type':_0xeb78('0xe'),'content':'','key':_0xeb78('0x13'),'keyType':'variable','keyContent':'','variableName':'starttime'},{'type':'string','content':_0xeb78('0x18')},{'type':_0xeb78('0xe'),'content':'','key':_0xeb78('0x23'),'keyType':'variable','keyContent':'','variableName':_0xeb78('0x24')},{'type':_0xeb78('0xe'),'content':'','key':_0xeb78('0x25'),'keyType':_0xeb78('0x8'),'keyContent':'','variableName':_0xeb78('0x26')},{'type':_0xeb78('0xe'),'content':'','key':_0xeb78('0x27'),'keyType':_0xeb78('0x8'),'keyContent':'','variableName':_0xeb78('0x28')},{'type':'keyValue','content':'','key':_0xeb78('0x29'),'keyType':'variable','keyContent':'','variableName':_0xeb78('0x2a')}];break;}}return _0x15137b;}; \ No newline at end of file diff --git a/server/components/interaction/service.js b/server/components/interaction/service.js index b676e43..847efdc 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 _0xc08f=['info','tracked','user','query','clone','html','phone','fax','mobile','lodash','openchannel-interactions','../../config/logger','mail-interactions','sms-interactions','chat-interactions','upperFirst','InteractionId','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','role','stringify','Interaction','findOne','then','update'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0xc08f,0x132));var _0xfc08=function(_0x4a57d0,_0x115c9b){_0x4a57d0=_0x4a57d0-0x0;var _0x560da1=_0xc08f[_0x4a57d0];return _0x560da1;};'use strict';var _=require(_0xfc08('0x0'));var db=require('../../mysqldb')['db'];var loggers={'openchannel':require('../../config/logger')(_0xfc08('0x1')),'mail':require(_0xfc08('0x2'))(_0xfc08('0x3')),'fax':require(_0xfc08('0x2'))('fax-interactions'),'sms':require(_0xfc08('0x2'))(_0xfc08('0x4')),'chat':require(_0xfc08('0x2'))(_0xfc08('0x5'))};function getInteractionId(_0x11b96f,_0x1f31fb,_0x282534){if(_0x11b96f&&_0x11b96f[_[_0xfc08('0x6')](_0x282534)+_0xfc08('0x7')]){return _0x11b96f[_[_0xfc08('0x6')](_0x282534)+'InteractionId'];}else if(_0x11b96f&&_0x11b96f['id']){return _0x11b96f['id'];}else if(_0x1f31fb&&_0x1f31fb['id']){return _0x1f31fb['id'];}else{return'unknown';}}function log(_0x2c85a8,_0x5f0a56,_0x9c9516,_0x531fc4,_0x5c255c,_0x2ba498){loggers[_0x5c255c[_0xfc08('0x8')]()][_0x2c85a8](_0xfc08('0x9'),_0x2ba498[_0xfc08('0xa')](),_0x5f0a56?_0x5f0a56['id']:null,_0x5f0a56?_0x5f0a56[_0xfc08('0xb')]:null,_0x5f0a56?_0x5f0a56[_0xfc08('0xc')]:null,getInteractionId(_0x9c9516,_0x531fc4,_0x5c255c),_0x9c9516?JSON[_0xfc08('0xd')](_0x9c9516):'null');}function updateUser(_0x4afa17,_0x32596a,_0x1272b6,_0x44cb26,_0x3b0283){db[_[_0xfc08('0x6')](_0x44cb26)+_0xfc08('0xe')][_0xfc08('0xf')]({'where':{'id':getInteractionId(_0x32596a,_0x1272b6,_0x44cb26)}})[_0xfc08('0x10')](function(_0x393cfc){if(_0x393cfc){return _0x393cfc[_0xfc08('0x11')]({'UserId':_0x4afa17?_0x4afa17['id']:null});}})[_0xfc08('0x10')](function(_0x4cf809){if(_0x4cf809){log(_0xfc08('0x12'),_0x4afa17,_0x32596a,_0x1272b6,_0x44cb26,_0x3b0283);}})['catch'](function(){log('error',_0x4afa17,_0x32596a,_0x1272b6,_0x44cb26,_0x3b0283);});}exports[_0xfc08('0x13')]=function(_0x3c00da,_0x527e59){return function(_0x5cf5fa,_0x12eb09,_0x39ac59){var _0x131fbe=_0x5cf5fa[_0xfc08('0x14')];var _0x24fba9={};var _0x5e290b=_0x5cf5fa[_0xfc08('0x15')];if(_0x24fba9){_0x24fba9=_[_0xfc08('0x16')](_0x5cf5fa['body']);_0x24fba9=_['omit'](_0x24fba9,['body',_0xfc08('0x17'),_0xfc08('0x18'),_0xfc08('0x19'),_0xfc08('0x1a')]);}updateUser(_0x131fbe,_0x24fba9,_0x5e290b,_0x3c00da,_0x527e59);_0x39ac59(null);};}; \ No newline at end of file +var _0xa2f3=['mobile','lodash','../../config/logger','openchannel-interactions','fax-interactions','sms-interactions','chat-interactions','upperFirst','InteractionId','unknown','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','role','null','Interaction','findOne','then','update','error','tracked','user','body','omit','phone','fax'];(function(_0x4d3ced,_0xeeaa5d){var _0x597d70=function(_0x23d71f){while(--_0x23d71f){_0x4d3ced['push'](_0x4d3ced['shift']());}};_0x597d70(++_0xeeaa5d);}(_0xa2f3,0x1b1));var _0x3a2f=function(_0x1f4307,_0x102944){_0x1f4307=_0x1f4307-0x0;var _0x526eb7=_0xa2f3[_0x1f4307];return _0x526eb7;};'use strict';var _=require(_0x3a2f('0x0'));var db=require('../../mysqldb')['db'];var loggers={'openchannel':require(_0x3a2f('0x1'))(_0x3a2f('0x2')),'mail':require(_0x3a2f('0x1'))('mail-interactions'),'fax':require(_0x3a2f('0x1'))(_0x3a2f('0x3')),'sms':require(_0x3a2f('0x1'))(_0x3a2f('0x4')),'chat':require(_0x3a2f('0x1'))(_0x3a2f('0x5'))};function getInteractionId(_0x5304f0,_0xc49868,_0x53dca8){if(_0x5304f0&&_0x5304f0[_[_0x3a2f('0x6')](_0x53dca8)+_0x3a2f('0x7')]){return _0x5304f0[_['upperFirst'](_0x53dca8)+_0x3a2f('0x7')];}else if(_0x5304f0&&_0x5304f0['id']){return _0x5304f0['id'];}else if(_0xc49868&&_0xc49868['id']){return _0xc49868['id'];}else{return _0x3a2f('0x8');}}function log(_0x2e9c08,_0x1b8527,_0x166372,_0xe84e2d,_0x9a4124,_0x38d7d3){loggers[_0x9a4124[_0x3a2f('0x9')]()][_0x2e9c08](_0x3a2f('0xa'),_0x38d7d3[_0x3a2f('0xb')](),_0x1b8527?_0x1b8527['id']:null,_0x1b8527?_0x1b8527[_0x3a2f('0xc')]:null,_0x1b8527?_0x1b8527[_0x3a2f('0xd')]:null,getInteractionId(_0x166372,_0xe84e2d,_0x9a4124),_0x166372?JSON['stringify'](_0x166372):_0x3a2f('0xe'));}function updateUser(_0x5c9b6f,_0x5c2855,_0x38b8f1,_0x1c4d36,_0x5772af){db[_[_0x3a2f('0x6')](_0x1c4d36)+_0x3a2f('0xf')][_0x3a2f('0x10')]({'where':{'id':getInteractionId(_0x5c2855,_0x38b8f1,_0x1c4d36)}})[_0x3a2f('0x11')](function(_0xb6e6a){if(_0xb6e6a){return _0xb6e6a[_0x3a2f('0x12')]({'UserId':_0x5c9b6f?_0x5c9b6f['id']:null});}})[_0x3a2f('0x11')](function(_0x31baec){if(_0x31baec){log('info',_0x5c9b6f,_0x5c2855,_0x38b8f1,_0x1c4d36,_0x5772af);}})['catch'](function(){log(_0x3a2f('0x13'),_0x5c9b6f,_0x5c2855,_0x38b8f1,_0x1c4d36,_0x5772af);});}exports[_0x3a2f('0x14')]=function(_0x326d10,_0x448b85){return function(_0x11a36b,_0x539263,_0x358711){var _0x1a7a03=_0x11a36b[_0x3a2f('0x15')];var _0x575846={};var _0x56cb47=_0x11a36b['query'];if(_0x575846){_0x575846=_['clone'](_0x11a36b[_0x3a2f('0x16')]);_0x575846=_[_0x3a2f('0x17')](_0x575846,[_0x3a2f('0x16'),'html',_0x3a2f('0x18'),_0x3a2f('0x19'),_0x3a2f('0x1a')]);}updateUser(_0x1a7a03,_0x575846,_0x56cb47,_0x326d10,_0x448b85);_0x358711(null);};}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index 583f7f2..f42ceb1 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 _0xf48d=['final','parse','use','then','count','format','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','User','user','isUserLimit','crypto','util','composable-middleware','../../mysqldb','../../config/environment','data1','license','split','createDecipher','aes-256-ctr','%s:%s:%s','update','base64','utf8'];(function(_0x2976de,_0x4c546d){var _0xecbf51=function(_0x234025){while(--_0x234025){_0x2976de['push'](_0x2976de['shift']());}};_0xecbf51(++_0x4c546d);}(_0xf48d,0x150));var _0xdf48=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0xf48d[_0x110c3d];return _0x226d67;};'use strict';var crypto=require(_0xdf48('0x0'));var util=require(_0xdf48('0x1'));var compose=require(_0xdf48('0x2'));var db=require(_0xdf48('0x3'))['db'];var config=require(_0xdf48('0x4'));function getValueFromLicense(_0x495017,_0x53c2a1){if(_0x495017&&_0x53c2a1){if(_0x53c2a1[_0xdf48('0x5')]&&_0x53c2a1[_0xdf48('0x6')]){var _0x59444f=_0x53c2a1[_0xdf48('0x5')];var _0x4d0662=_0x53c2a1['license'];var _0x37cd42=_0x59444f[_0xdf48('0x7')]('-')[0x4];var _0x4f7181=_0x59444f['split']('-')[0x0];var _0x2c05dd=crypto[_0xdf48('0x8')](_0xdf48('0x9'),util['format'](_0xdf48('0xa'),_0x37cd42,_0x59444f,_0x4f7181));var _0x5ff187=_0x2c05dd[_0xdf48('0xb')](_0x4d0662,_0xdf48('0xc'),_0xdf48('0xd'));_0x5ff187+=_0x2c05dd[_0xdf48('0xe')](_0xdf48('0xd'));var _0x43a78e=JSON[_0xdf48('0xf')](_0x5ff187);return _0x43a78e['hasOwnProperty'](_0x495017)?_0x43a78e[_0x495017]:null;}}return null;}function isLimit(_0x1db915,_0x1ec04c,_0x379994,_0x1514c1){var _0x58cfc4=_0x1ec04c;return compose()[_0xdf48('0x10')](function(_0x373e4a,_0x1cf921,_0x4cc180){return db['License']['findOne']({'where':{'id':0x1},'raw':!![]})[_0xdf48('0x11')](function(_0x6bf103){var _0x23519d=getValueFromLicense(_0x1db915,_0x6bf103);return _0x23519d?_0x23519d:_0x58cfc4;})[_0xdf48('0x11')](function(_0x291134){_0x58cfc4=_0x291134;return _0x379994[_0xdf48('0x12')](_0x1514c1);})[_0xdf48('0x11')](function(_0x16f73d){if(_0x16f73d>=_0x58cfc4){return _0x1cf921['status'](0x193)['json']({'message':util[_0xdf48('0x13')](_0xdf48('0x14'),_0x1db915)});}_0x4cc180();})[_0xdf48('0x15')](function(_0x448672){_0x4cc180(_0x448672);});});}function isUserLimit(){return isLimit('users',0x1,db[_0xdf48('0x16')],{'where':{'$or':[{'role':'admin'},{'role':_0xdf48('0x17')}]}});}exports[_0xdf48('0x18')]=isUserLimit; \ No newline at end of file +var _0xdaf3=['then','status','catch','users','User','admin','user','crypto','composable-middleware','../../mysqldb','data1','license','split','createDecipher','aes-256-ctr','format','%s:%s:%s','update','base64','utf8','final','parse','License','findOne'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xdaf3,0x10f));var _0x3daf=function(_0x40e141,_0x4385ee){_0x40e141=_0x40e141-0x0;var _0x3ce15c=_0xdaf3[_0x40e141];return _0x3ce15c;};'use strict';var crypto=require(_0x3daf('0x0'));var util=require('util');var compose=require(_0x3daf('0x1'));var db=require(_0x3daf('0x2'))['db'];var config=require('../../config/environment');function getValueFromLicense(_0x130fdc,_0x234a0a){if(_0x130fdc&&_0x234a0a){if(_0x234a0a[_0x3daf('0x3')]&&_0x234a0a[_0x3daf('0x4')]){var _0x304eec=_0x234a0a['data1'];var _0x32ab98=_0x234a0a['license'];var _0xc3024a=_0x304eec[_0x3daf('0x5')]('-')[0x4];var _0xced2b9=_0x304eec[_0x3daf('0x5')]('-')[0x0];var _0x463b36=crypto[_0x3daf('0x6')](_0x3daf('0x7'),util[_0x3daf('0x8')](_0x3daf('0x9'),_0xc3024a,_0x304eec,_0xced2b9));var _0x2c8649=_0x463b36[_0x3daf('0xa')](_0x32ab98,_0x3daf('0xb'),_0x3daf('0xc'));_0x2c8649+=_0x463b36[_0x3daf('0xd')]('utf8');var _0x51192c=JSON[_0x3daf('0xe')](_0x2c8649);return _0x51192c['hasOwnProperty'](_0x130fdc)?_0x51192c[_0x130fdc]:null;}}return null;}function isLimit(_0x222407,_0x23a5f7,_0xb3753d,_0x40c8a0){var _0x522b30=_0x23a5f7;return compose()['use'](function(_0x18d0a2,_0x123f7d,_0x51b47f){return db[_0x3daf('0xf')][_0x3daf('0x10')]({'where':{'id':0x1},'raw':!![]})[_0x3daf('0x11')](function(_0x8235cb){var _0x25a0c4=getValueFromLicense(_0x222407,_0x8235cb);return _0x25a0c4?_0x25a0c4:_0x522b30;})[_0x3daf('0x11')](function(_0x1e5434){_0x522b30=_0x1e5434;return _0xb3753d['count'](_0x40c8a0);})[_0x3daf('0x11')](function(_0x3dce6c){if(_0x3dce6c>=_0x522b30){return _0x123f7d[_0x3daf('0x12')](0x193)['json']({'message':util['format']('Maximum\x20%s\x20limit\x20have\x20been\x20reached',_0x222407)});}_0x51b47f();})[_0x3daf('0x13')](function(_0x40d547){_0x51b47f(_0x40d547);});});}function isUserLimit(){return isLimit(_0x3daf('0x14'),0x1,db[_0x3daf('0x15')],{'where':{'$or':[{'role':_0x3daf('0x16')},{'role':_0x3daf('0x17')}]}});}exports['isUserLimit']=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index d96c01d..6c0d6ab 100644 --- a/server/components/parsers/advancedSearch.js +++ b/server/components/parsers/advancedSearch.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2730=['match','filter','indexOf','conditions','push','$eq','$between','value','includes','add','format','YYYY-MM-DD','castTo','text','CAST(','operator','$ne','$notIn','field','\x20IS\x20NULL)','$in','NOT\x20IN\x20?','=\x20?','<>\x20?','$endsWith','LIKE\x20?','$lt','<\x20?','$gt','>\x20?','$lte','<=\x20?','BETWEEN\x20?\x20AND\x20?','$substring','start','pop','DATE','utcOffset','minutes','seconds','moment','parseSearch','sqlOperator','startsWith','[$or]','and','replace','[$and]','length','split','slice','forEach','shift'];(function(_0x7f9c95,_0x33d07c){var _0x2b8f6f=function(_0x4a26f4){while(--_0x4a26f4){_0x7f9c95['push'](_0x7f9c95['shift']());}};_0x2b8f6f(++_0x33d07c);}(_0x2730,0xfc));var _0x0273=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x2730[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require('lodash');var moment=require(_0x0273('0x0'));exports[_0x0273('0x1')]=function(_0x1f0337){var _0x1401e6={'conditions':[]};_0x1401e6[_0x0273('0x2')]=_[_0x0273('0x3')](_0x1f0337,_0x0273('0x4'))?'or':_0x0273('0x5');var _0x48ac8e=_0x1f0337[_0x0273('0x6')](_0x0273('0x7'),'')['replace'](_0x0273('0x4'),'')['split']('||');for(var _0x1aa50a=0x0;_0x1aa50a<_0x48ac8e[_0x0273('0x8')];_0x1aa50a++){var _0x4904b5=_0x48ac8e[_0x1aa50a][_0x0273('0x9')](':=');var _0x30e6f4=_0x4904b5[0x0];var _0x40d569=_0x4904b5[_0x0273('0xa')](0x1);_0x40d569[_0x0273('0xb')](function(_0x4ecd91){var _0x401237=_0x4ecd91[_0x0273('0x9')]('[')[_0x0273('0xc')]();var _0x3dd6c1=_0x4ecd91[_0x0273('0xd')](/\[(.*?)\]/g);_0x3dd6c1[_0x0273('0xb')](function(_0x2193de){var _0x30a9b2=_0x2193de['split']('[')[_0x0273('0xe')](function(_0x2fd62c){return _0x2fd62c[_0x0273('0xf')](']')>-0x1;})['map'](function(_0x4db255){return _0x4db255[_0x0273('0x9')](']')[0x0];})[0x0];_0x1401e6[_0x0273('0x10')][_0x0273('0x11')]({'field':_0x30e6f4,'operator':_0x401237,'value':_0x30a9b2});});});}return _0x1401e6;};exports['buildExpression']=function(_0x4b3a6a,_0x21a317,_0x5ac793){var _0xa3a26={};if(_0x21a317==='DATE'){if(_0x5ac793['operator']===_0x0273('0x12')){_0x5ac793['operator']=_0x0273('0x13');_0x5ac793[_0x0273('0x14')]+=','+_0x5ac793[_0x0273('0x14')];}else if(_[_0x0273('0x15')](['$gt','$lte'],_0x5ac793['operator'])){_0x5ac793[_0x0273('0x14')]=moment(_0x5ac793[_0x0273('0x14')])[_0x0273('0x16')](0x1,'days')[_0x0273('0x17')](_0x0273('0x18'));}}if(_0x5ac793[_0x0273('0x19')]){_0x21a317=_0x5ac793[_0x0273('0x19')];_0xa3a26[_0x0273('0x1a')]=_0x0273('0x1b')+_0x4b3a6a+'.'+_0x5ac793['field']+'\x20AS\x20'+_0x5ac793[_0x0273('0x19')]+')\x20'+parseOperator(_0x5ac793[_0x0273('0x1c')]);}else{_0xa3a26[_0x0273('0x1a')]=_0x4b3a6a+'.'+_0x5ac793['field']+'\x20'+parseOperator(_0x5ac793[_0x0273('0x1c')]);}if(_[_0x0273('0x15')]([_0x0273('0x1d'),_0x0273('0x1e')],_0x5ac793['operator']))_0xa3a26[_0x0273('0x1a')]='('+_0xa3a26[_0x0273('0x1a')]+'\x20OR\x20'+_0x4b3a6a+'.'+_0x5ac793[_0x0273('0x1f')]+_0x0273('0x20');_0xa3a26[_0x0273('0x14')]=parseValue(_0x21a317,_0x5ac793[_0x0273('0x1c')],_0x5ac793['value']);return _0xa3a26;};function parseOperator(_0x4dd48f){var _0x474399;switch(_0x4dd48f){case _0x0273('0x21'):_0x474399='IN\x20?';break;case _0x0273('0x1e'):_0x474399=_0x0273('0x22');break;case'$eq':_0x474399=_0x0273('0x23');break;case _0x0273('0x1d'):_0x474399=_0x0273('0x24');break;case'$substring':case'$startsWith':case _0x0273('0x25'):_0x474399=_0x0273('0x26');break;case _0x0273('0x27'):_0x474399=_0x0273('0x28');break;case _0x0273('0x29'):_0x474399=_0x0273('0x2a');break;case _0x0273('0x2b'):_0x474399=_0x0273('0x2c');break;case'$gte':_0x474399='>=\x20?';break;case'$between':_0x474399=_0x0273('0x2d');break;}return _0x474399;}function parseValue(_0x4153fb,_0x4fde8f,_0x24ac6f){var _0x100732={'start':undefined,'end':undefined};switch(_0x4fde8f){case _0x0273('0x21'):case _0x0273('0x1e'):_0x100732['start']=_0x24ac6f[_0x0273('0x9')](',');break;case _0x0273('0x2e'):_0x100732['start']='%'+_0x24ac6f+'%';break;case'$startsWith':_0x100732[_0x0273('0x2f')]=_0x24ac6f+'%';break;case _0x0273('0x25'):_0x100732[_0x0273('0x2f')]='%'+_0x24ac6f;break;case _0x0273('0x13'):var _0x403108=_0x24ac6f[_0x0273('0x9')](',');var _0x24ac6f=_0x403108['shift']();var _0x21064b=_0x403108[_0x0273('0x30')]();if(_0x4153fb===_0x0273('0x31')){_0x24ac6f=moment(_0x24ac6f)[_0x0273('0x32')](0x0,!![])[_0x0273('0x17')]();_0x21064b=moment(_0x21064b)['utcOffset'](0x0,!![])[_0x0273('0x16')](0x17,'hours')[_0x0273('0x16')](0x3b,_0x0273('0x33'))[_0x0273('0x16')](0x3b,_0x0273('0x34'))['format']();}_0x100732={'start':_0x24ac6f,'end':_0x21064b};break;default:_0x100732[_0x0273('0x2f')]=_0x24ac6f;break;}return _0x100732;} \ No newline at end of file +var _0xd8ca=['$endsWith','LIKE\x20?','$lt','<\x20?','<=\x20?','>=\x20?','BETWEEN\x20?\x20AND\x20?','$in','start','$startsWith','shift','utcOffset','hours','minutes','lodash','startsWith','and','[$and]','split','forEach','match','filter','map','conditions','push','buildExpression','DATE','$eq','operator','$between','value','includes','$gt','$lte','add','format','YYYY-MM-DD','castTo','text','CAST(','field','$ne','$notIn','\x20IS\x20NULL)','IN\x20?','NOT\x20IN\x20?','<>\x20?','$substring'];(function(_0x423dc8,_0x16584a){var _0x2202bb=function(_0x258d37){while(--_0x258d37){_0x423dc8['push'](_0x423dc8['shift']());}};_0x2202bb(++_0x16584a);}(_0xd8ca,0x9e));var _0xad8c=function(_0x506e4e,_0x1e893b){_0x506e4e=_0x506e4e-0x0;var _0x23719c=_0xd8ca[_0x506e4e];return _0x23719c;};'use strict';var _=require(_0xad8c('0x0'));var moment=require('moment');exports['parseSearch']=function(_0xd560b7){var _0x18c381={'conditions':[]};_0x18c381['sqlOperator']=_[_0xad8c('0x1')](_0xd560b7,'[$or]')?'or':_0xad8c('0x2');var _0xe539d6=_0xd560b7['replace'](_0xad8c('0x3'),'')['replace']('[$or]','')[_0xad8c('0x4')]('||');for(var _0x4741a9=0x0;_0x4741a9<_0xe539d6['length'];_0x4741a9++){var _0x25475b=_0xe539d6[_0x4741a9][_0xad8c('0x4')](':=');var _0x34e1f9=_0x25475b[0x0];var _0x3a92a5=_0x25475b['slice'](0x1);_0x3a92a5[_0xad8c('0x5')](function(_0x444a2f){var _0x4166ac=_0x444a2f[_0xad8c('0x4')]('[')['shift']();var _0x32776b=_0x444a2f[_0xad8c('0x6')](/\[(.*?)\]/g);_0x32776b[_0xad8c('0x5')](function(_0x3e1b63){var _0x58766d=_0x3e1b63[_0xad8c('0x4')]('[')[_0xad8c('0x7')](function(_0x57a920){return _0x57a920['indexOf'](']')>-0x1;})[_0xad8c('0x8')](function(_0x52f021){return _0x52f021['split'](']')[0x0];})[0x0];_0x18c381[_0xad8c('0x9')][_0xad8c('0xa')]({'field':_0x34e1f9,'operator':_0x4166ac,'value':_0x58766d});});});}return _0x18c381;};exports[_0xad8c('0xb')]=function(_0x4391fe,_0x28f016,_0x52cba8){var _0xc9b1c0={};if(_0x28f016===_0xad8c('0xc')){if(_0x52cba8['operator']===_0xad8c('0xd')){_0x52cba8[_0xad8c('0xe')]=_0xad8c('0xf');_0x52cba8[_0xad8c('0x10')]+=','+_0x52cba8[_0xad8c('0x10')];}else if(_[_0xad8c('0x11')]([_0xad8c('0x12'),_0xad8c('0x13')],_0x52cba8[_0xad8c('0xe')])){_0x52cba8[_0xad8c('0x10')]=moment(_0x52cba8[_0xad8c('0x10')])[_0xad8c('0x14')](0x1,'days')[_0xad8c('0x15')](_0xad8c('0x16'));}}if(_0x52cba8['castTo']){_0x28f016=_0x52cba8[_0xad8c('0x17')];_0xc9b1c0[_0xad8c('0x18')]=_0xad8c('0x19')+_0x4391fe+'.'+_0x52cba8[_0xad8c('0x1a')]+'\x20AS\x20'+_0x52cba8[_0xad8c('0x17')]+')\x20'+parseOperator(_0x52cba8[_0xad8c('0xe')]);}else{_0xc9b1c0[_0xad8c('0x18')]=_0x4391fe+'.'+_0x52cba8[_0xad8c('0x1a')]+'\x20'+parseOperator(_0x52cba8['operator']);}if(_[_0xad8c('0x11')]([_0xad8c('0x1b'),_0xad8c('0x1c')],_0x52cba8[_0xad8c('0xe')]))_0xc9b1c0[_0xad8c('0x18')]='('+_0xc9b1c0['text']+'\x20OR\x20'+_0x4391fe+'.'+_0x52cba8[_0xad8c('0x1a')]+_0xad8c('0x1d');_0xc9b1c0[_0xad8c('0x10')]=parseValue(_0x28f016,_0x52cba8[_0xad8c('0xe')],_0x52cba8['value']);return _0xc9b1c0;};function parseOperator(_0x2edbd5){var _0x4afe81;switch(_0x2edbd5){case'$in':_0x4afe81=_0xad8c('0x1e');break;case'$notIn':_0x4afe81=_0xad8c('0x1f');break;case _0xad8c('0xd'):_0x4afe81='=\x20?';break;case'$ne':_0x4afe81=_0xad8c('0x20');break;case _0xad8c('0x21'):case'$startsWith':case _0xad8c('0x22'):_0x4afe81=_0xad8c('0x23');break;case _0xad8c('0x24'):_0x4afe81=_0xad8c('0x25');break;case'$gt':_0x4afe81='>\x20?';break;case _0xad8c('0x13'):_0x4afe81=_0xad8c('0x26');break;case'$gte':_0x4afe81=_0xad8c('0x27');break;case'$between':_0x4afe81=_0xad8c('0x28');break;}return _0x4afe81;}function parseValue(_0x172f47,_0x1c32d7,_0xfb16e4){var _0x5588c7={'start':undefined,'end':undefined};switch(_0x1c32d7){case _0xad8c('0x29'):case _0xad8c('0x1c'):_0x5588c7[_0xad8c('0x2a')]=_0xfb16e4[_0xad8c('0x4')](',');break;case'$substring':_0x5588c7[_0xad8c('0x2a')]='%'+_0xfb16e4+'%';break;case _0xad8c('0x2b'):_0x5588c7[_0xad8c('0x2a')]=_0xfb16e4+'%';break;case'$endsWith':_0x5588c7['start']='%'+_0xfb16e4;break;case _0xad8c('0xf'):var _0x2a1cc4=_0xfb16e4[_0xad8c('0x4')](',');var _0xfb16e4=_0x2a1cc4[_0xad8c('0x2c')]();var _0x54bdbd=_0x2a1cc4['pop']();if(_0x172f47===_0xad8c('0xc')){_0xfb16e4=moment(_0xfb16e4)['utcOffset'](0x0,!![])['format']();_0x54bdbd=moment(_0x54bdbd)[_0xad8c('0x2d')](0x0,!![])[_0xad8c('0x14')](0x17,_0xad8c('0x2e'))['add'](0x3b,_0xad8c('0x2f'))['add'](0x3b,'seconds')[_0xad8c('0x15')]();}_0x5588c7={'start':_0xfb16e4,'end':_0x54bdbd};break;default:_0x5588c7[_0xad8c('0x2a')]=_0xfb16e4;break;}return _0x5588c7;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 51e96aa..47cc5ae 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 _0x7218=['col','unsigned','length','omit','isObject','isString','unset','hasOwnProperty','match','^[0-9]*$','isEmail','getFullTextValue','forEach','push','toString','lodash','sequelize','fields','split','filters','isEmpty','isArray','parse','offset','sort','indexOf','cast','priority','substr','DESC'];(function(_0x3bdac4,_0x573d29){var _0x2d439a=function(_0x54180f){while(--_0x54180f){_0x3bdac4['push'](_0x3bdac4['shift']());}};_0x2d439a(++_0x573d29);}(_0x7218,0x195));var _0x8721=function(_0x5d1f0e,_0x27d69c){_0x5d1f0e=_0x5d1f0e-0x0;var _0x2cd979=_0x7218[_0x5d1f0e];return _0x2cd979;};'use strict';var _=require(_0x8721('0x0'));var sequelize=require(_0x8721('0x1'));var LIMIT_VALUE=0xfa;exports[_0x8721('0x2')]=function(_0x403737){var _0x3ce9dd=null;if(_0x403737){_0x3ce9dd=_0x403737[_0x8721('0x3')](',');}return _0x3ce9dd;};exports[_0x8721('0x4')]=function(_0x25865e){var _0x4dd26c={};if(!_[_0x8721('0x5')](_0x25865e)){_0x4dd26c={};_['forOwn'](_0x25865e,function(_0x1d9ae9,_0x397633){try{_0x4dd26c[_0x397633]=_[_0x8721('0x6')](_0x1d9ae9)?_0x1d9ae9:JSON[_0x8721('0x7')](_0x1d9ae9);}catch(_0xecb68f){_0x4dd26c[_0x397633]=_0x1d9ae9[_0x8721('0x3')](',');}});}return _0x4dd26c;};exports['limit']=function(_0x4818c5){_0x4818c5=parseInt(_0x4818c5,0xa);if(!_0x4818c5||_0x4818c5<0x0){_0x4818c5=LIMIT_VALUE;}return _0x4818c5;};exports[_0x8721('0x8')]=function(_0x5d9c97){_0x5d9c97=parseInt(_0x5d9c97,0xa);if(!_0x5d9c97||_0x5d9c97<0x0){_0x5d9c97=0x0;}return _0x5d9c97;};exports[_0x8721('0x9')]=function(_0x31287e){var _0x55780f,_0x307990=null;if(_0x31287e){_0x55780f=_0x31287e[_0x8721('0x3')](',');_0x307990=_['map'](_0x55780f,function(_0x2b1534){if(_0x2b1534[_0x8721('0xa')]('-')===0x0){return[_0x2b1534==='priority'?sequelize[_0x8721('0xb')](sequelize['col'](_0x8721('0xc')),'unsigned'):_0x2b1534[_0x8721('0xd')](0x1),_0x8721('0xe')];}else{return[_0x2b1534===_0x8721('0xc')?sequelize['cast'](sequelize[_0x8721('0xf')](_0x8721('0xc')),_0x8721('0x10')):_0x2b1534,'ASC'];}});}return _0x307990;};exports['omit']=function(_0x5d66e3,_0x2e691c){if(_['isEmpty'](_0x5d66e3)){return _0x5d66e3;}if(_['isArray'](_0x5d66e3)){for(var _0x44a153=0x0;_0x44a153<_0x5d66e3[_0x8721('0x11')];_0x44a153+=0x1){_0x5d66e3[_0x44a153]=this[_0x8721('0x12')](_0x5d66e3[_0x44a153],_0x2e691c);}return _0x5d66e3;}if(!_[_0x8721('0x13')](_0x5d66e3)){return _0x5d66e3;}if(_[_0x8721('0x14')](_0x2e691c)){_0x2e691c=[_0x2e691c];}if(!_[_0x8721('0x6')](_0x2e691c)){return _0x5d66e3;}for(var _0x3fbabd=0x0;_0x3fbabd<_0x2e691c[_0x8721('0x11')];_0x3fbabd+=0x1){_[_0x8721('0x15')](_0x5d66e3,_0x2e691c[_0x3fbabd]);}for(var _0x4ae020 in _0x5d66e3){if(_0x5d66e3[_0x8721('0x16')](_0x4ae020)){_0x5d66e3[_0x4ae020]=this['omit'](_0x5d66e3[_0x4ae020],_0x2e691c);}}return _0x5d66e3;};exports['isNumeric']=function(_0x3fe95f){return _0x3fe95f[_0x8721('0x17')](RegExp(_0x8721('0x18')))?!![]:![];};exports[_0x8721('0x19')]=function(_0x16ca9a){return _0x16ca9a[_0x8721('0x17')](/^\S+@\S+$/)?!![]:![];};exports[_0x8721('0x1a')]=function(_0x445ef4){var _0x13aa28=[];_0x445ef4['split']('\x20')[_0x8721('0x1b')](function(_0x448d39){_0x13aa28[_0x8721('0x1c')]('+'+_0x448d39[_0x8721('0x1d')]()+'*');});return _0x13aa28['join']('\x20');}; \ No newline at end of file +var _0x03b0=['limit','offset','sort','indexOf','priority','cast','col','substr','DESC','unsigned','ASC','omit','isArray','length','isObject','isString','unset','hasOwnProperty','isNumeric','match','^[0-9]*$','isEmail','getFullTextValue','forEach','toString','join','sequelize','split','filters','isEmpty','forOwn','parse'];(function(_0x3b75c6,_0x5b4379){var _0x1ed3ef=function(_0x18e64b){while(--_0x18e64b){_0x3b75c6['push'](_0x3b75c6['shift']());}};_0x1ed3ef(++_0x5b4379);}(_0x03b0,0xba));var _0x003b=function(_0xb24a3e,_0x4a3594){_0xb24a3e=_0xb24a3e-0x0;var _0x4038d7=_0x03b0[_0xb24a3e];return _0x4038d7;};'use strict';var _=require('lodash');var sequelize=require(_0x003b('0x0'));var LIMIT_VALUE=0xfa;exports['fields']=function(_0xd5a89c){var _0xd57352=null;if(_0xd5a89c){_0xd57352=_0xd5a89c[_0x003b('0x1')](',');}return _0xd57352;};exports[_0x003b('0x2')]=function(_0x4c4f82){var _0x47f609={};if(!_[_0x003b('0x3')](_0x4c4f82)){_0x47f609={};_[_0x003b('0x4')](_0x4c4f82,function(_0x257824,_0x214d7d){try{_0x47f609[_0x214d7d]=_['isArray'](_0x257824)?_0x257824:JSON[_0x003b('0x5')](_0x257824);}catch(_0x262c65){_0x47f609[_0x214d7d]=_0x257824[_0x003b('0x1')](',');}});}return _0x47f609;};exports[_0x003b('0x6')]=function(_0x2854a1){_0x2854a1=parseInt(_0x2854a1,0xa);if(!_0x2854a1||_0x2854a1<0x0){_0x2854a1=LIMIT_VALUE;}return _0x2854a1;};exports[_0x003b('0x7')]=function(_0x9d84b0){_0x9d84b0=parseInt(_0x9d84b0,0xa);if(!_0x9d84b0||_0x9d84b0<0x0){_0x9d84b0=0x0;}return _0x9d84b0;};exports[_0x003b('0x8')]=function(_0x4503fc){var _0x186925,_0x51afd8=null;if(_0x4503fc){_0x186925=_0x4503fc[_0x003b('0x1')](',');_0x51afd8=_['map'](_0x186925,function(_0x5dddab){if(_0x5dddab[_0x003b('0x9')]('-')===0x0){return[_0x5dddab===_0x003b('0xa')?sequelize[_0x003b('0xb')](sequelize[_0x003b('0xc')](_0x003b('0xa')),'unsigned'):_0x5dddab[_0x003b('0xd')](0x1),_0x003b('0xe')];}else{return[_0x5dddab===_0x003b('0xa')?sequelize[_0x003b('0xb')](sequelize[_0x003b('0xc')](_0x003b('0xa')),_0x003b('0xf')):_0x5dddab,_0x003b('0x10')];}});}return _0x51afd8;};exports[_0x003b('0x11')]=function(_0x1fd703,_0x5682b1){if(_[_0x003b('0x3')](_0x1fd703)){return _0x1fd703;}if(_[_0x003b('0x12')](_0x1fd703)){for(var _0x3676af=0x0;_0x3676af<_0x1fd703[_0x003b('0x13')];_0x3676af+=0x1){_0x1fd703[_0x3676af]=this[_0x003b('0x11')](_0x1fd703[_0x3676af],_0x5682b1);}return _0x1fd703;}if(!_[_0x003b('0x14')](_0x1fd703)){return _0x1fd703;}if(_[_0x003b('0x15')](_0x5682b1)){_0x5682b1=[_0x5682b1];}if(!_['isArray'](_0x5682b1)){return _0x1fd703;}for(var _0x20314e=0x0;_0x20314e<_0x5682b1['length'];_0x20314e+=0x1){_[_0x003b('0x16')](_0x1fd703,_0x5682b1[_0x20314e]);}for(var _0xfc0ccb in _0x1fd703){if(_0x1fd703[_0x003b('0x17')](_0xfc0ccb)){_0x1fd703[_0xfc0ccb]=this[_0x003b('0x11')](_0x1fd703[_0xfc0ccb],_0x5682b1);}}return _0x1fd703;};exports[_0x003b('0x18')]=function(_0x14e2ea){return _0x14e2ea[_0x003b('0x19')](RegExp(_0x003b('0x1a')))?!![]:![];};exports[_0x003b('0x1b')]=function(_0x2f4c69){return _0x2f4c69[_0x003b('0x19')](/^\S+@\S+$/)?!![]:![];};exports[_0x003b('0x1c')]=function(_0x29f4ea){var _0x55edeb=[];_0x29f4ea[_0x003b('0x1')]('\x20')[_0x003b('0x1d')](function(_0x53b0fb){_0x55edeb['push']('+'+_0x53b0fb[_0x003b('0x1e')]()+'*');});return _0x55edeb[_0x003b('0x1f')]('\x20');}; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index 1e73289..4161d53 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x77a2=['../mysqldb','default','get','env','production','set','appPath','join','root','public','test','client','use','toISOString','static','views','/server/views','engine','ejs','renderFile','html','50mb','initialize','express','serve-favicon','body-parser','method-override','cookie-parser','errorhandler','moment'];(function(_0x2c4a82,_0x12ece1){var _0x6434da=function(_0x530467){while(--_0x530467){_0x2c4a82['push'](_0x2c4a82['shift']());}};_0x6434da(++_0x12ece1);}(_0x77a2,0x1bb));var _0x277a=function(_0x2f88dc,_0x1fdeae){_0x2f88dc=_0x2f88dc-0x0;var _0xe6e447=_0x77a2[_0x2f88dc];return _0xe6e447;};'use strict';var express=require(_0x277a('0x0'));var favicon=require(_0x277a('0x1'));var bodyParser=require(_0x277a('0x2'));var methodOverride=require(_0x277a('0x3'));var cookieParser=require(_0x277a('0x4'));var errorHandler=require(_0x277a('0x5'));var path=require('path');var passport=require('passport');var cors=require('cors');var moment=require(_0x277a('0x6'));var config=require('./environment');var db=require(_0x277a('0x7'))['db'];exports[_0x277a('0x8')]=function(_0x37b206){var _0x2d258e=_0x37b206[_0x277a('0x9')](_0x277a('0xa'));if(_0x2d258e===_0x277a('0xb')){_0x37b206[_0x277a('0xc')](_0x277a('0xd'),path[_0x277a('0xe')](config[_0x277a('0xf')],_0x277a('0x10')));}if(_0x2d258e==='development'||_0x2d258e===_0x277a('0x11')){_0x37b206[_0x277a('0xc')](_0x277a('0xd'),path['join'](config[_0x277a('0xf')],_0x277a('0x12')));_0x37b206[_0x277a('0x13')](errorHandler());}_0x37b206[_0x277a('0xc')]('json\x20replacer',function(_0x46a040,_0x3ea859){if(this[_0x46a040]instanceof Date){_0x3ea859=this[_0x46a040][_0x277a('0x14')]()['split']('.')[0x0]+'Z';}return _0x3ea859;});_0x37b206[_0x277a('0x13')](express[_0x277a('0x15')](_0x37b206['get']('appPath')));_0x37b206[_0x277a('0xc')](_0x277a('0x16'),config['root']+_0x277a('0x17'));_0x37b206[_0x277a('0x18')]('html',require(_0x277a('0x19'))[_0x277a('0x1a')]);_0x37b206['set']('view\x20engine',_0x277a('0x1b'));_0x37b206[_0x277a('0x13')](bodyParser['urlencoded']({'limit':_0x277a('0x1c'),'extended':!![]}));_0x37b206[_0x277a('0x13')](bodyParser['json']({'limit':_0x277a('0x1c')}));_0x37b206['use'](cors());_0x37b206[_0x277a('0x13')](methodOverride());_0x37b206[_0x277a('0x13')](cookieParser());_0x37b206[_0x277a('0x13')](passport[_0x277a('0x1d')]());}; \ No newline at end of file +var _0xd12e=['moment','./environment','../mysqldb','default','get','env','production','appPath','join','root','public','development','test','set','client','json\x20replacer','toISOString','split','use','static','/server/views','engine','html','view\x20engine','urlencoded','50mb','body-parser','method-override','cookie-parser','errorhandler','passport'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xd12e,0x1eb));var _0xed12=function(_0xf8d80e,_0x442160){_0xf8d80e=_0xf8d80e-0x0;var _0x510240=_0xd12e[_0xf8d80e];return _0x510240;};'use strict';var express=require('express');var favicon=require('serve-favicon');var bodyParser=require(_0xed12('0x0'));var methodOverride=require(_0xed12('0x1'));var cookieParser=require(_0xed12('0x2'));var errorHandler=require(_0xed12('0x3'));var path=require('path');var passport=require(_0xed12('0x4'));var cors=require('cors');var moment=require(_0xed12('0x5'));var config=require(_0xed12('0x6'));var db=require(_0xed12('0x7'))['db'];exports[_0xed12('0x8')]=function(_0x22a4af){var _0x324eed=_0x22a4af[_0xed12('0x9')](_0xed12('0xa'));if(_0x324eed===_0xed12('0xb')){_0x22a4af['set'](_0xed12('0xc'),path[_0xed12('0xd')](config[_0xed12('0xe')],_0xed12('0xf')));}if(_0x324eed===_0xed12('0x10')||_0x324eed===_0xed12('0x11')){_0x22a4af[_0xed12('0x12')](_0xed12('0xc'),path[_0xed12('0xd')](config[_0xed12('0xe')],_0xed12('0x13')));_0x22a4af['use'](errorHandler());}_0x22a4af[_0xed12('0x12')](_0xed12('0x14'),function(_0x3fa654,_0x1842c7){if(this[_0x3fa654]instanceof Date){_0x1842c7=this[_0x3fa654][_0xed12('0x15')]()[_0xed12('0x16')]('.')[0x0]+'Z';}return _0x1842c7;});_0x22a4af[_0xed12('0x17')](express[_0xed12('0x18')](_0x22a4af[_0xed12('0x9')](_0xed12('0xc'))));_0x22a4af['set']('views',config['root']+_0xed12('0x19'));_0x22a4af[_0xed12('0x1a')](_0xed12('0x1b'),require('ejs')['renderFile']);_0x22a4af[_0xed12('0x12')](_0xed12('0x1c'),_0xed12('0x1b'));_0x22a4af[_0xed12('0x17')](bodyParser[_0xed12('0x1d')]({'limit':'50mb','extended':!![]}));_0x22a4af[_0xed12('0x17')](bodyParser['json']({'limit':_0xed12('0x1e')}));_0x22a4af[_0xed12('0x17')](cors());_0x22a4af[_0xed12('0x17')](methodOverride());_0x22a4af[_0xed12('0x17')](cookieParser());_0x22a4af['use'](passport['initialize']());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index 2180fb2..acc4321 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 _0x26d1=['getUuid','platform','win32','dmidecode\x20--string\x20system-uuid','utf8','replace','hostname','ipAddress','digest','substring','lodash','bimedia-machine-uuid','child_process','execSync','keys','length','filter','family','IPv4','internal','concat','head','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','orderBy','map','model','createHash','md5','update'];(function(_0x5a3cf0,_0x160a68){var _0x5a64ee=function(_0x34cd1d){while(--_0x34cd1d){_0x5a3cf0['push'](_0x5a3cf0['shift']());}};_0x5a64ee(++_0x160a68);}(_0x26d1,0x8e));var _0x126d=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0x26d1[_0x2be8c2];return _0x97f531;};'use strict';var _=require(_0x126d('0x0'));var os=require('os');var crypto=require('crypto');var machine=require(_0x126d('0x1'));var exec=require(_0x126d('0x2'))[_0x126d('0x3')];function getInterfaces(){var _0x2a20fc=[];var _0x59d0a0=os['networkInterfaces']();var _0x3a3fb4=_['orderBy'](_[_0x126d('0x4')](_0x59d0a0));for(var _0x7f89d4=0x0;_0x7f89d4<_0x3a3fb4[_0x126d('0x5')];_0x7f89d4++){var _0x449ed0=_0x59d0a0[_0x3a3fb4[_0x7f89d4]][_0x126d('0x6')](function(_0x4e5e87){return _0x4e5e87[_0x126d('0x7')]===_0x126d('0x8')&&_0x4e5e87[_0x126d('0x9')]===![];});_0x2a20fc=_0x2a20fc[_0x126d('0xa')](_0x449ed0);}return _0x2a20fc;}function getFirstInterface(){var _0x2cbbdc=_[_0x126d('0xb')](getInterfaces());return{'macAddress':_0x2cbbdc&&_0x2cbbdc[_0x126d('0xc')]?_0x2cbbdc['mac']:_0x126d('0xd'),'ipAddress':_0x2cbbdc&&_0x2cbbdc[_0x126d('0xe')]?_0x2cbbdc[_0x126d('0xe')]:_0x126d('0xf')};}exports[_0x126d('0x10')]=getFirstInterface;function getCPUhash(){var _0x521ab7=_[_0x126d('0x11')](os['cpus']()[_0x126d('0x12')](function(_0x2b755f){return _0x2b755f[_0x126d('0x13')];}))['join'](':');return crypto[_0x126d('0x14')](_0x126d('0x15'))[_0x126d('0x16')](_0x521ab7)['digest']('hex');}exports[_0x126d('0x17')]=function(){switch(os[_0x126d('0x18')]()){case _0x126d('0x19'):return exec(_0x126d('0x1a'),{'encoding':_0x126d('0x1b')})[_0x126d('0x1c')]('\x0d\x0a','');default:var _0x517b88=getFirstInterface();var _0x1f1fce=getCPUhash();var _0x58b39c=_0x1f1fce+'|'+os[_0x126d('0x1d')]()+'|'+_0x517b88['macAddress']+'|'+_0x517b88[_0x126d('0x1e')];var _0x1be025=crypto['createHash'](_0x126d('0x15'))['update'](_0x58b39c)[_0x126d('0x1f')]('hex');return _0x1be025['substring'](0x0,0x8)+'-'+_0x1be025['substring'](0x8,0xc)+'-'+_0x1be025[_0x126d('0x20')](0xc,0x10)+'-'+_0x1be025[_0x126d('0x20')](0x10,0x14)+'-'+_0x1be025[_0x126d('0x20')](0x14);}}; \ No newline at end of file +var _0x6c84=['map','createHash','update','digest','hex','getUuid','platform','dmidecode\x20--string\x20system-uuid','utf8','macAddress','ipAddress','md5','substring','lodash','crypto','bimedia-machine-uuid','child_process','execSync','length','filter','family','IPv4','internal','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','orderBy','cpus'];(function(_0x58c33f,_0x45dba1){var _0x12d140=function(_0xc20336){while(--_0xc20336){_0x58c33f['push'](_0x58c33f['shift']());}};_0x12d140(++_0x45dba1);}(_0x6c84,0x112));var _0x46c8=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x6c84[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0x46c8('0x0'));var os=require('os');var crypto=require(_0x46c8('0x1'));var machine=require(_0x46c8('0x2'));var exec=require(_0x46c8('0x3'))[_0x46c8('0x4')];function getInterfaces(){var _0x51d202=[];var _0x187ef9=os['networkInterfaces']();var _0x2f4e36=_['orderBy'](_['keys'](_0x187ef9));for(var _0x2b0d13=0x0;_0x2b0d13<_0x2f4e36[_0x46c8('0x5')];_0x2b0d13++){var _0x322cba=_0x187ef9[_0x2f4e36[_0x2b0d13]][_0x46c8('0x6')](function(_0x13bf93){return _0x13bf93[_0x46c8('0x7')]===_0x46c8('0x8')&&_0x13bf93[_0x46c8('0x9')]===![];});_0x51d202=_0x51d202['concat'](_0x322cba);}return _0x51d202;}function getFirstInterface(){var _0x27c1a5=_['head'](getInterfaces());return{'macAddress':_0x27c1a5&&_0x27c1a5['mac']?_0x27c1a5['mac']:_0x46c8('0xa'),'ipAddress':_0x27c1a5&&_0x27c1a5['address']?_0x27c1a5[_0x46c8('0xb')]:_0x46c8('0xc')};}exports[_0x46c8('0xd')]=getFirstInterface;function getCPUhash(){var _0x2d5c6e=_[_0x46c8('0xe')](os[_0x46c8('0xf')]()[_0x46c8('0x10')](function(_0x48f96b){return _0x48f96b['model'];}))['join'](':');return crypto[_0x46c8('0x11')]('md5')[_0x46c8('0x12')](_0x2d5c6e)[_0x46c8('0x13')](_0x46c8('0x14'));}exports[_0x46c8('0x15')]=function(){switch(os[_0x46c8('0x16')]()){case'win32':return exec(_0x46c8('0x17'),{'encoding':_0x46c8('0x18')})['replace']('\x0d\x0a','');default:var _0x23d82d=getFirstInterface();var _0x279b28=getCPUhash();var _0x5b7b2e=_0x279b28+'|'+os['hostname']()+'|'+_0x23d82d[_0x46c8('0x19')]+'|'+_0x23d82d[_0x46c8('0x1a')];var _0x29b28f=crypto[_0x46c8('0x11')](_0x46c8('0x1b'))[_0x46c8('0x12')](_0x5b7b2e)[_0x46c8('0x13')](_0x46c8('0x14'));return _0x29b28f[_0x46c8('0x1c')](0x0,0x8)+'-'+_0x29b28f['substring'](0x8,0xc)+'-'+_0x29b28f[_0x46c8('0x1c')](0xc,0x10)+'-'+_0x29b28f[_0x46c8('0x1c')](0x10,0x14)+'-'+_0x29b28f[_0x46c8('0x1c')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index a15246e..4244ebb 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 _0xdb28=['data2','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','data1','Disabled','Changed','uuid','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','diff','DEMO\x20START\x20AT\x20%s','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','error','message','finally','getUuid','License','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','default','util','crypto','moment','request-promise','pkginfo','version','../../mysqldb','../environment','./hardware','license','../../api/jira/jira.controller','format','%s/api/servers/%s/check?version=%s','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','catch','createCipher','session','update','utf8','base64','final','createDecipher','secrets','||FIELD||VALUE||\x0a','User','findOne','fullname','email','|reason|','|machineUuid|','|name|','|email|','getFirstInterface','Alert','active'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xdb28,0x106));var _0x8db2=function(_0x2a53a4,_0x2d66fd){_0x2a53a4=_0x2a53a4-0x0;var _0x3d44bc=_0xdb28[_0x2a53a4];return _0x3d44bc;};'use strict';var util=require(_0x8db2('0x0'));var crypto=require(_0x8db2('0x1'));var moment=require(_0x8db2('0x2'));var rp=require(_0x8db2('0x3'));var BPromise=require('bluebird');var pkginfo=require(_0x8db2('0x4'))(module,_0x8db2('0x5'));var db=require(_0x8db2('0x6'))['db'];var config=require(_0x8db2('0x7'));var hardware=require(_0x8db2('0x8'));var logger=require('../logger')(_0x8db2('0x9'));var jira=require(_0x8db2('0xa'));var HOST='https://www.xcallymotion.com';var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var ADMIN;var oldToken;function httpRequest(_0x494b40){return new BPromise(function(_0x477f50,_0x46932f){var _0x131537=util[_0x8db2('0xb')](_0x8db2('0xc'),HOST,_0x494b40,module[_0x8db2('0xd')][_0x8db2('0x5')]);if(oldToken){_0x131537=util['format'](_0x8db2('0xe'),HOST,_0x494b40,module[_0x8db2('0xd')][_0x8db2('0x5')],oldToken);}var _0x57015f={'uri':_0x131537,'method':_0x8db2('0xf'),'timeout':0xea60,'json':!![]};return rp(_0x57015f)[_0x8db2('0x10')](function(_0x576475){_0x477f50(_0x576475);})[_0x8db2('0x11')](function(_0x3b2faa){_0x46932f(_0x3b2faa);});});}function encryptDate(_0x1349f6){var _0x204f49=crypto[_0x8db2('0x12')]('aes-256-ctr',config['secrets'][_0x8db2('0x13')]);var _0x15e87c=_0x204f49[_0x8db2('0x14')](_0x1349f6,_0x8db2('0x15'),_0x8db2('0x16'));_0x15e87c+=_0x204f49[_0x8db2('0x17')](_0x8db2('0x16'));return _0x15e87c;}function decryptDate(_0x3c96a7){var _0x131252=crypto[_0x8db2('0x18')]('aes-256-ctr',config[_0x8db2('0x19')][_0x8db2('0x13')]);var _0x48101e=_0x131252[_0x8db2('0x14')](_0x3c96a7,_0x8db2('0x16'),_0x8db2('0x15'));_0x48101e+=_0x131252[_0x8db2('0x17')](_0x8db2('0x15'));return _0x48101e;}function sendJiraAlert(_0x46ce14,_0x51d60d,_0x5df464){var _0x77789=_0x8db2('0x1a');return db[_0x8db2('0x1b')][_0x8db2('0x1c')]({'where':{'role':'admin'},'attributes':[_0x8db2('0x1d'),_0x8db2('0x1e')],'raw':!![]})[_0x8db2('0x10')](function(_0x297ba3){ADMIN=_0x297ba3;_0x77789+=_0x8db2('0x1f')+_0x5df464+'|\x0a';_0x77789+='|uuid|'+_0x46ce14+'|\x0a';_0x77789+=_0x8db2('0x20')+_0x51d60d+'|\x0a';_0x77789+=_0x8db2('0x21')+ADMIN[_0x8db2('0x1d')]+'|\x0a';_0x77789+=_0x8db2('0x22')+ADMIN[_0x8db2('0x1e')]+'|\x0a';return _0x77789;})[_0x8db2('0x10')](function(_0x796ec1){var _0x5c6614=hardware[_0x8db2('0x23')]()['ipAddress'];return jira['openIssue']({'key':'MOTLICENSE','summary':'Motion\x20License\x20Alert','description':_0x796ec1,'issuetype':_0x8db2('0x24'),'oldToken':_0x46ce14,'newToken':_0x51d60d,'email':ADMIN[_0x8db2('0x1e')],'name':ADMIN[_0x8db2('0x1d')],'reason':GRAY_PERIOD_REASON,'ip':_0x5c6614});});}function manageLicense(_0x2baed0,_0x145328){var _0x8d4f54=_0x145328['get']({'plain':!![]});httpRequest(_0x2baed0)[_0x8db2('0x10')](function(_0x372311){if(oldToken){oldToken=undefined;}if(_0x372311[_0x8db2('0x25')]){if(!_0x8d4f54[_0x8db2('0x9')]&&_0x8d4f54['license']!=_0x372311[_0x8db2('0x9')]||_0x8d4f54[_0x8db2('0x9')]&&_0x8d4f54[_0x8db2('0x26')]){logger[_0x8db2('0x27')](_0x8db2('0x28'));}if(_0x8d4f54[_0x8db2('0x9')]&&!_0x8d4f54[_0x8db2('0x26')]&&_0x8d4f54[_0x8db2('0x9')]!=_0x372311[_0x8db2('0x9')]){logger['info'](_0x8db2('0x29'));}if(_0x8d4f54['license']&&!_0x8d4f54['data2']&&_0x8d4f54[_0x8db2('0x9')]==_0x372311[_0x8db2('0x9')]){return _0x145328;}return _0x145328[_0x8db2('0x14')]({'data1':_0x2baed0,'data2':null,'license':_0x372311['license']});}else{if(_0x372311[_0x8db2('0x9')]||_0x8d4f54['license']){if(!_0x8d4f54[_0x8db2('0x26')]){if(_0x8d4f54[_0x8db2('0x2a')]==_0x2baed0){GRAY_PERIOD_REASON=_0x8db2('0x2b');logger['info']('THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED');}else{GRAY_PERIOD_REASON=_0x8db2('0x2c');oldToken=_0x8d4f54[_0x8db2('0x2a')];logger['info']('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x8d4f54[_0x8db2('0x2a')],_0x2baed0);}sendJiraAlert(_0x8d4f54[_0x8db2('0x2a')],_0x372311[_0x8db2('0x2d')],GRAY_PERIOD_REASON);logger[_0x8db2('0x27')](_0x8db2('0x2e'),GRAY_PERIOD_REASON[_0x8db2('0x2f')](),moment()[_0x8db2('0xb')](_0x8db2('0x30')));return _0x145328[_0x8db2('0x14')]({'data2':encryptDate(moment()[_0x8db2('0xb')]('YYYY-MM-DD\x20HH:mm'))});}else{if(moment()[_0x8db2('0x31')](decryptDate(_0x8d4f54[_0x8db2('0x26')]),'days')>DAYS){logger[_0x8db2('0x27')](_0x8db2('0x32'),moment()['format']('YYYY-MM-DD\x20HH:mm'));return _0x145328[_0x8db2('0x14')]({'data1':_0x2baed0,'data2':null,'license':null});}}}else{if(_0x8d4f54['data1']!=_0x2baed0){logger[_0x8db2('0x27')](_0x8db2('0x33'),_0x8d4f54[_0x8db2('0x2a')],_0x2baed0);return _0x145328[_0x8db2('0x14')]({'data1':_0x2baed0,'data2':null,'license':null});}}}return _0x145328;})['then'](function(_0x2d3e98){_0x145328=_0x2d3e98;})['catch'](function(_0x227a08){logger[_0x8db2('0x34')](_0x227a08[_0x8db2('0x35')]);})[_0x8db2('0x36')](function(){setTimeout(function(){manageLicense(hardware['getUuid'](),_0x145328);},TIME);});}function defaultLicense(){var _0x50ee17=hardware[_0x8db2('0x37')]();if(_0x50ee17){return db[_0x8db2('0x38')]['findOrCreate']({'where':{'id':0x1},'defaults':{'data1':_0x50ee17}})[_0x8db2('0x39')](function(_0x24bcfe,_0x656dd2){logger['info'](_0x8db2('0x3a'),_0x50ee17);manageLicense(_0x50ee17,_0x24bcfe);})[_0x8db2('0x11')](function(_0x953349){logger[_0x8db2('0x34')](_0x953349[_0x8db2('0x35')]);});}}exports[_0x8db2('0x3b')]=defaultLicense; \ No newline at end of file +var _0xef0f=['error','message','getUuid','License','findOrCreate','default','util','moment','request-promise','bluebird','version','../../mysqldb','../environment','../logger','license','../../api/jira/jira.controller','https://www.xcallymotion.com','%s/api/servers/%s/check?version=%s','exports','format','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','catch','createCipher','aes-256-ctr','secrets','session','update','utf8','final','createDecipher','base64','User','admin','fullname','email','|uuid|','|machineUuid|','getFirstInterface','ipAddress','openIssue','MOTLICENSE','get','active','data2','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','data1','uuid','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','YYYY-MM-DD\x20HH:mm','diff','days','DEMO\x20START\x20AT\x20%s','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s'];(function(_0xf7634a,_0x2db8ef){var _0x3a9699=function(_0x2563eb){while(--_0x2563eb){_0xf7634a['push'](_0xf7634a['shift']());}};_0x3a9699(++_0x2db8ef);}(_0xef0f,0x168));var _0xfef0=function(_0x11e0f2,_0x45f7fe){_0x11e0f2=_0x11e0f2-0x0;var _0xb707d=_0xef0f[_0x11e0f2];return _0xb707d;};'use strict';var util=require(_0xfef0('0x0'));var crypto=require('crypto');var moment=require(_0xfef0('0x1'));var rp=require(_0xfef0('0x2'));var BPromise=require(_0xfef0('0x3'));var pkginfo=require('pkginfo')(module,_0xfef0('0x4'));var db=require(_0xfef0('0x5'))['db'];var config=require(_0xfef0('0x6'));var hardware=require('./hardware');var logger=require(_0xfef0('0x7'))(_0xfef0('0x8'));var jira=require(_0xfef0('0x9'));var HOST=_0xfef0('0xa');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var ADMIN;var oldToken;function httpRequest(_0xad43e){return new BPromise(function(_0x11dfd7,_0x5130bd){var _0x41ec94=util['format'](_0xfef0('0xb'),HOST,_0xad43e,module[_0xfef0('0xc')][_0xfef0('0x4')]);if(oldToken){_0x41ec94=util[_0xfef0('0xd')](_0xfef0('0xe'),HOST,_0xad43e,module[_0xfef0('0xc')][_0xfef0('0x4')],oldToken);}var _0x4bd6f2={'uri':_0x41ec94,'method':_0xfef0('0xf'),'timeout':0xea60,'json':!![]};return rp(_0x4bd6f2)[_0xfef0('0x10')](function(_0x410234){_0x11dfd7(_0x410234);})[_0xfef0('0x11')](function(_0x87f32a){_0x5130bd(_0x87f32a);});});}function encryptDate(_0x1bdb7b){var _0x546c7a=crypto[_0xfef0('0x12')](_0xfef0('0x13'),config[_0xfef0('0x14')][_0xfef0('0x15')]);var _0xe9f78d=_0x546c7a[_0xfef0('0x16')](_0x1bdb7b,_0xfef0('0x17'),'base64');_0xe9f78d+=_0x546c7a[_0xfef0('0x18')]('base64');return _0xe9f78d;}function decryptDate(_0x4b5bcf){var _0x5acdd0=crypto[_0xfef0('0x19')](_0xfef0('0x13'),config[_0xfef0('0x14')][_0xfef0('0x15')]);var _0x2a96d9=_0x5acdd0[_0xfef0('0x16')](_0x4b5bcf,_0xfef0('0x1a'),_0xfef0('0x17'));_0x2a96d9+=_0x5acdd0['final'](_0xfef0('0x17'));return _0x2a96d9;}function sendJiraAlert(_0x1642cd,_0x1577fa,_0x39f9d3){var _0x1ad020='||FIELD||VALUE||\x0a';return db[_0xfef0('0x1b')]['findOne']({'where':{'role':_0xfef0('0x1c')},'attributes':[_0xfef0('0x1d'),_0xfef0('0x1e')],'raw':!![]})['then'](function(_0x2be956){ADMIN=_0x2be956;_0x1ad020+='|reason|'+_0x39f9d3+'|\x0a';_0x1ad020+=_0xfef0('0x1f')+_0x1642cd+'|\x0a';_0x1ad020+=_0xfef0('0x20')+_0x1577fa+'|\x0a';_0x1ad020+='|name|'+ADMIN['fullname']+'|\x0a';_0x1ad020+='|email|'+ADMIN[_0xfef0('0x1e')]+'|\x0a';return _0x1ad020;})['then'](function(_0x1f9970){var _0x46b34a=hardware[_0xfef0('0x21')]()[_0xfef0('0x22')];return jira[_0xfef0('0x23')]({'key':_0xfef0('0x24'),'summary':'Motion\x20License\x20Alert','description':_0x1f9970,'issuetype':'Alert','oldToken':_0x1642cd,'newToken':_0x1577fa,'email':ADMIN[_0xfef0('0x1e')],'name':ADMIN[_0xfef0('0x1d')],'reason':GRAY_PERIOD_REASON,'ip':_0x46b34a});});}function manageLicense(_0x924f6e,_0x34ca65){var _0xab231c=_0x34ca65[_0xfef0('0x25')]({'plain':!![]});httpRequest(_0x924f6e)[_0xfef0('0x10')](function(_0x168b98){if(oldToken){oldToken=undefined;}if(_0x168b98[_0xfef0('0x26')]){if(!_0xab231c['license']&&_0xab231c[_0xfef0('0x8')]!=_0x168b98[_0xfef0('0x8')]||_0xab231c[_0xfef0('0x8')]&&_0xab231c[_0xfef0('0x27')]){logger[_0xfef0('0x28')](_0xfef0('0x29'));}if(_0xab231c[_0xfef0('0x8')]&&!_0xab231c[_0xfef0('0x27')]&&_0xab231c[_0xfef0('0x8')]!=_0x168b98[_0xfef0('0x8')]){logger[_0xfef0('0x28')](_0xfef0('0x2a'));}if(_0xab231c['license']&&!_0xab231c[_0xfef0('0x27')]&&_0xab231c['license']==_0x168b98['license']){return _0x34ca65;}return _0x34ca65[_0xfef0('0x16')]({'data1':_0x924f6e,'data2':null,'license':_0x168b98[_0xfef0('0x8')]});}else{if(_0x168b98['license']||_0xab231c['license']){if(!_0xab231c['data2']){if(_0xab231c['data1']==_0x924f6e){GRAY_PERIOD_REASON='Disabled';logger[_0xfef0('0x28')](_0xfef0('0x2b'));}else{GRAY_PERIOD_REASON=_0xfef0('0x2c');oldToken=_0xab231c['data1'];logger['info']('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0xab231c[_0xfef0('0x2d')],_0x924f6e);}sendJiraAlert(_0xab231c['data1'],_0x168b98[_0xfef0('0x2e')],GRAY_PERIOD_REASON);logger[_0xfef0('0x28')](_0xfef0('0x2f'),GRAY_PERIOD_REASON['toUpperCase'](),moment()[_0xfef0('0xd')]('YYYY-MM-DD\x20HH:mm'));return _0x34ca65[_0xfef0('0x16')]({'data2':encryptDate(moment()[_0xfef0('0xd')](_0xfef0('0x30')))});}else{if(moment()[_0xfef0('0x31')](decryptDate(_0xab231c[_0xfef0('0x27')]),_0xfef0('0x32'))>DAYS){logger[_0xfef0('0x28')](_0xfef0('0x33'),moment()['format'](_0xfef0('0x30')));return _0x34ca65[_0xfef0('0x16')]({'data1':_0x924f6e,'data2':null,'license':null});}}}else{if(_0xab231c[_0xfef0('0x2d')]!=_0x924f6e){logger[_0xfef0('0x28')](_0xfef0('0x34'),_0xab231c[_0xfef0('0x2d')],_0x924f6e);return _0x34ca65[_0xfef0('0x16')]({'data1':_0x924f6e,'data2':null,'license':null});}}}return _0x34ca65;})[_0xfef0('0x10')](function(_0x459d4a){_0x34ca65=_0x459d4a;})[_0xfef0('0x11')](function(_0x3b668b){logger[_0xfef0('0x35')](_0x3b668b[_0xfef0('0x36')]);})['finally'](function(){setTimeout(function(){manageLicense(hardware[_0xfef0('0x37')](),_0x34ca65);},TIME);});}function defaultLicense(){var _0x4a42a3=hardware[_0xfef0('0x37')]();if(_0x4a42a3){return db[_0xfef0('0x38')][_0xfef0('0x39')]({'where':{'id':0x1},'defaults':{'data1':_0x4a42a3}})['spread'](function(_0x3f1597,_0x29469e){logger[_0xfef0('0x28')]('SERVICE\x20LICENSE\x20STARTED\x20%s',_0x4a42a3);manageLicense(_0x4a42a3,_0x3f1597);})[_0xfef0('0x11')](function(_0x3abcc5){logger[_0xfef0('0x35')](_0x3abcc5['message']);});}}exports[_0xfef0('0x3a')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index 878e425..a7e7bb7 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 _0x453b=['disabled','2027-01-01T00:00:00.000Z','message','getLicense','License','find','defaults','then','checkLicense','crypto','util','moment','./hardware','../environment','../../mysqldb','license','isEmpty','data1','data2','split','aes-256-ctr','format','%s:%s:%s','update','base64','utf8','final','parse','demo','getUuid','secrets','session','gray','deadline','add','days','grayReason'];(function(_0x7b341f,_0x11e481){var _0x46d0a1=function(_0x6f779d){while(--_0x6f779d){_0x7b341f['push'](_0x7b341f['shift']());}};_0x46d0a1(++_0x11e481);}(_0x453b,0x156));var _0xb453=function(_0x7633c,_0x1e45bf){_0x7633c=_0x7633c-0x0;var _0x1b77e2=_0x453b[_0x7633c];return _0x1b77e2;};'use strict';var crypto=require(_0xb453('0x0'));var util=require(_0xb453('0x1'));var _=require('lodash');var moment=require(_0xb453('0x2'));var hardware=require(_0xb453('0x3'));var config=require(_0xb453('0x4'));var db=require(_0xb453('0x5'))['db'];function checkLicense(_0x5b3a4c,_0x517c36){if(_0x5b3a4c){try{var _0x53813f=_0x517c36||_0x5b3a4c[_0xb453('0x6')];if(_[_0xb453('0x7')](_0x53813f)){throw new Error('License\x20key\x20value\x20not\x20found');}var _0x543218=_0x5b3a4c[_0xb453('0x8')];var _0x5e7c2a=_0x5b3a4c[_0xb453('0x9')];var _0x52e80a=_0x543218[_0xb453('0xa')]('-')[0x4];var _0x5e4fe6=_0x543218[_0xb453('0xa')]('-')[0x0];var _0x4b0524=crypto['createDecipher'](_0xb453('0xb'),util[_0xb453('0xc')](_0xb453('0xd'),_0x52e80a,_0x543218,_0x5e4fe6));var _0x516d85=_0x4b0524[_0xb453('0xe')](_0x53813f,_0xb453('0xf'),_0xb453('0x10'));_0x516d85+=_0x4b0524[_0xb453('0x11')](_0xb453('0x10'));var _0x111efe=JSON[_0xb453('0x12')](_0x516d85);_0x111efe[_0xb453('0x13')]=![];_0x111efe['uuid']=_0x543218;_0x111efe['machineUuid']=hardware[_0xb453('0x14')]();if(_0x5e7c2a){var _0x3d5ead=crypto['createDecipher']('aes-256-ctr',config[_0xb453('0x15')][_0xb453('0x16')]);var _0x17d96a=_0x3d5ead[_0xb453('0xe')](_0x5e7c2a,_0xb453('0xf'),'utf8');_0x17d96a+=_0x3d5ead[_0xb453('0x11')](_0xb453('0x10'));_0x111efe[_0xb453('0x17')]=_0x17d96a;_0x111efe[_0xb453('0x18')]=moment(_0x17d96a)[_0xb453('0x19')](0x7,_0xb453('0x1a'))[_0xb453('0xc')]();_0x111efe[_0xb453('0x1b')]=_0x111efe['uuid']!=_0x111efe['machineUuid']?'changed':_0xb453('0x1c');}return _0x111efe;}catch(_0x55053c){return{'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xb453('0x1d'),'chat':![],'mail':![],'fax':![],'messaging':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':'Breaking\x20license','uuid':_0x5b3a4c['data1'],'machineUuid':hardware[_0xb453('0x14')](),'message':_0x55053c[_0xb453('0x1e')],'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![]};}}return{'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xb453('0x1d'),'chat':![],'mail':![],'fax':![],'messaging':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':'Demo\x20license','uuid':_0x5b3a4c[_0xb453('0x8')],'machineUuid':hardware[_0xb453('0x14')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![]};}exports[_0xb453('0x1f')]=function(_0x15edea){return db[_0xb453('0x20')][_0xb453('0x21')](_[_0xb453('0x22')](_0x15edea,{'raw':!![],'where':{'id':0x1}}))[_0xb453('0x23')](function(_0x396a2e){return checkLicense(_0x396a2e,null);});};exports[_0xb453('0x24')]=checkLicense; \ No newline at end of file +var _0x1357=['grayReason','changed','disabled','Breaking\x20license','2027-01-01T00:00:00.000Z','Demo\x20license','getLicense','crypto','util','lodash','./hardware','../environment','../../mysqldb','license','isEmpty','License\x20key\x20value\x20not\x20found','data1','data2','split','createDecipher','aes-256-ctr','format','%s:%s:%s','base64','utf8','final','demo','uuid','machineUuid','getUuid','secrets','session','update','gray','deadline','days'];(function(_0x51d685,_0x29604e){var _0x23519e=function(_0x2fe1cc){while(--_0x2fe1cc){_0x51d685['push'](_0x51d685['shift']());}};_0x23519e(++_0x29604e);}(_0x1357,0x1db));var _0x7135=function(_0x4d52ee,_0x54ea45){_0x4d52ee=_0x4d52ee-0x0;var _0x57d335=_0x1357[_0x4d52ee];return _0x57d335;};'use strict';var crypto=require(_0x7135('0x0'));var util=require(_0x7135('0x1'));var _=require(_0x7135('0x2'));var moment=require('moment');var hardware=require(_0x7135('0x3'));var config=require(_0x7135('0x4'));var db=require(_0x7135('0x5'))['db'];function checkLicense(_0x2fb64b,_0x40a0a3){if(_0x2fb64b){try{var _0x16d0d8=_0x40a0a3||_0x2fb64b[_0x7135('0x6')];if(_[_0x7135('0x7')](_0x16d0d8)){throw new Error(_0x7135('0x8'));}var _0xe636be=_0x2fb64b[_0x7135('0x9')];var _0x997e7f=_0x2fb64b[_0x7135('0xa')];var _0xe671a5=_0xe636be[_0x7135('0xb')]('-')[0x4];var _0x22866b=_0xe636be[_0x7135('0xb')]('-')[0x0];var _0x4cd940=crypto[_0x7135('0xc')](_0x7135('0xd'),util[_0x7135('0xe')](_0x7135('0xf'),_0xe671a5,_0xe636be,_0x22866b));var _0x4b75e0=_0x4cd940['update'](_0x16d0d8,_0x7135('0x10'),_0x7135('0x11'));_0x4b75e0+=_0x4cd940[_0x7135('0x12')](_0x7135('0x11'));var _0x13d6e9=JSON['parse'](_0x4b75e0);_0x13d6e9[_0x7135('0x13')]=![];_0x13d6e9[_0x7135('0x14')]=_0xe636be;_0x13d6e9[_0x7135('0x15')]=hardware[_0x7135('0x16')]();if(_0x997e7f){var _0x229de2=crypto['createDecipher'](_0x7135('0xd'),config[_0x7135('0x17')][_0x7135('0x18')]);var _0x44aa17=_0x229de2[_0x7135('0x19')](_0x997e7f,_0x7135('0x10'),_0x7135('0x11'));_0x44aa17+=_0x229de2[_0x7135('0x12')](_0x7135('0x11'));_0x13d6e9[_0x7135('0x1a')]=_0x44aa17;_0x13d6e9[_0x7135('0x1b')]=moment(_0x44aa17)['add'](0x7,_0x7135('0x1c'))[_0x7135('0xe')]();_0x13d6e9[_0x7135('0x1d')]=_0x13d6e9[_0x7135('0x14')]!=_0x13d6e9['machineUuid']?_0x7135('0x1e'):_0x7135('0x1f');}return _0x13d6e9;}catch(_0x3730a5){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':_0x7135('0x20'),'uuid':_0x2fb64b[_0x7135('0x9')],'machineUuid':hardware[_0x7135('0x16')](),'message':_0x3730a5['message'],'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![]};}}return{'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x7135('0x21'),'chat':![],'mail':![],'fax':![],'messaging':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x7135('0x22'),'uuid':_0x2fb64b[_0x7135('0x9')],'machineUuid':hardware[_0x7135('0x16')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![]};}exports[_0x7135('0x23')]=function(_0x57ae31){return db['License']['find'](_['defaults'](_0x57ae31,{'raw':!![],'where':{'id':0x1}}))['then'](function(_0x20efd4){return checkLicense(_0x20efd4,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 2f0163b..4b6146c 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 _0xb058=['exports','http://localhost:9000','myappanuglar-secret','app-id','secret'];(function(_0x4c184d,_0x4278ab){var _0x23d997=function(_0x22d068){while(--_0x22d068){_0x4c184d['push'](_0x4c184d['shift']());}};_0x23d997(++_0x4278ab);}(_0xb058,0x69));var _0x8b05=function(_0x37756b,_0x24db76){_0x37756b=_0x37756b-0x0;var _0x46efec=_0xb058[_0x37756b];return _0x46efec;};'use strict';module[_0x8b05('0x0')]={'DOMAIN':_0x8b05('0x1'),'SESSION_SECRET':_0x8b05('0x2'),'GOOGLE_ID':_0x8b05('0x3'),'GOOGLE_SECRET':_0x8b05('0x4'),'DEBUG':''}; \ No newline at end of file +var _0x2ab3=['secret','exports'];(function(_0x91d019,_0x5223c4){var _0x19de1f=function(_0x3e1311){while(--_0x3e1311){_0x91d019['push'](_0x91d019['shift']());}};_0x19de1f(++_0x5223c4);}(_0x2ab3,0x1d3));var _0x32ab=function(_0x43776a,_0x4eb74c){_0x43776a=_0x43776a-0x0;var _0x18eb8f=_0x2ab3[_0x43776a];return _0x18eb8f;};'use strict';module[_0x32ab('0x0')]={'DOMAIN':'http://localhost:9000','SESSION_SECRET':'myappanuglar-secret','GOOGLE_ID':'app-id','GOOGLE_SECRET':_0x32ab('0x1'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 3662bc2..77bd6e1 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0877=['[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','Logger','transports','File','%s-%s','info','Console','env','debugLevel','moment','winston','util','path','INFO','join','/var','log','xcally','%s-%s.log','format'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x0877,0xbb));var _0x7087=function(_0x4dfecb,_0x8d2259){_0x4dfecb=_0x4dfecb-0x0;var _0x4fc85c=_0x0877[_0x4dfecb];return _0x4fc85c;};'use strict';var moment=require(_0x7087('0x0'));var winston=require(_0x7087('0x1'));var util=require(_0x7087('0x2'));var path=require(_0x7087('0x3'));var debugLevel=_0x7087('0x4');function filename(_0x25d125,_0x1853af){return path[_0x7087('0x5')](_0x7087('0x6'),_0x7087('0x7'),_0x7087('0x8'),util['format'](_0x7087('0x9'),_0x25d125,_0x1853af));}function formatter(_0x32eaa2,_0x3cb1ab){return util[_0x7087('0xa')](_0x7087('0xb'),moment()[_0x7087('0xa')](_0x7087('0xc')),_0x3cb1ab[_0x7087('0xd')]['toUpperCase'](),_0x32eaa2,_0x3cb1ab['message']);}module['exports']=function(_0x58ebf9){return new winston[(_0x7087('0xe'))]({'transports':[new winston[(_0x7087('0xf'))][(_0x7087('0x10'))]({'name':util[_0x7087('0xa')](_0x7087('0x11'),_0x58ebf9,'error'),'filename':filename(_0x58ebf9,'error'),'level':'error','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x3542b0){return formatter(_0x58ebf9,_0x3542b0);}}),new winston[(_0x7087('0xf'))][(_0x7087('0x10'))]({'name':util[_0x7087('0xa')](_0x7087('0x11'),_0x58ebf9,_0x7087('0x12')),'filename':filename(_0x58ebf9,_0x7087('0x12')),'level':_0x7087('0x12'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x116ce1){return formatter(_0x58ebf9,_0x116ce1);}}),new winston[(_0x7087('0xf'))][(_0x7087('0x13'))]({'level':process[_0x7087('0x14')][_0x7087('0x15')]||debugLevel,'json':![],'formatter':function(_0x2ab23d){return formatter(_0x58ebf9,_0x2ab23d);}})]});}; \ No newline at end of file +var _0x89f9=['message','exports','transports','%s-%s','error','info','Console','env','debugLevel','moment','winston','INFO','join','/var','log','xcally','format','%s-%s.log','[%s]\x20[%s]\x20%s\x20-\x20%s'];(function(_0x232ec0,_0x45fdd0){var _0x356705=function(_0x4099ea){while(--_0x4099ea){_0x232ec0['push'](_0x232ec0['shift']());}};_0x356705(++_0x45fdd0);}(_0x89f9,0x7b));var _0x989f=function(_0x49f0ac,_0x1ff207){_0x49f0ac=_0x49f0ac-0x0;var _0x19bd9c=_0x89f9[_0x49f0ac];return _0x19bd9c;};'use strict';var moment=require(_0x989f('0x0'));var winston=require(_0x989f('0x1'));var util=require('util');var path=require('path');var debugLevel=_0x989f('0x2');function filename(_0x5a83e8,_0x1efee2){return path[_0x989f('0x3')](_0x989f('0x4'),_0x989f('0x5'),_0x989f('0x6'),util[_0x989f('0x7')](_0x989f('0x8'),_0x5a83e8,_0x1efee2));}function formatter(_0x4f50bb,_0x311842){return util['format'](_0x989f('0x9'),moment()[_0x989f('0x7')]('YYYY-MM-DD\x20HH:mm:ss'),_0x311842['level']['toUpperCase'](),_0x4f50bb,_0x311842[_0x989f('0xa')]);}module[_0x989f('0xb')]=function(_0x331cea){return new winston['Logger']({'transports':[new winston[(_0x989f('0xc'))]['File']({'name':util[_0x989f('0x7')](_0x989f('0xd'),_0x331cea,_0x989f('0xe')),'filename':filename(_0x331cea,_0x989f('0xe')),'level':_0x989f('0xe'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0xc30da9){return formatter(_0x331cea,_0xc30da9);}}),new winston[(_0x989f('0xc'))]['File']({'name':util[_0x989f('0x7')](_0x989f('0xd'),_0x331cea,'info'),'filename':filename(_0x331cea,_0x989f('0xf')),'level':'info','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x2b49e4){return formatter(_0x331cea,_0x2b49e4);}}),new winston['transports'][(_0x989f('0x10'))]({'level':process[_0x989f('0x11')][_0x989f('0x12')]||debugLevel,'json':![],'formatter':function(_0x417e05){return formatter(_0x331cea,_0x417e05);}})]});}; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index a3e36fc..c95fa35 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 _0xb088=['../../services/routing/index.js','../../services/xdr/index.js','exports','path','express','join','../../services/express/index.js','ami','../../services/ami/index.js','../../services/agi/index.js','email','routing'];(function(_0x936ddb,_0x2ba1c9){var _0xda4e39=function(_0x54492c){while(--_0x54492c){_0x936ddb['push'](_0x936ddb['shift']());}};_0xda4e39(++_0x2ba1c9);}(_0xb088,0x7b));var _0x8b08=function(_0x476089,_0x2f2e30){_0x476089=_0x476089-0x0;var _0xd96f6b=_0xb088[_0x476089];return _0xd96f6b;};'use strict';var path=require(_0x8b08('0x0'));var os=require('os');var config={'apps':[{'name':_0x8b08('0x1'),'script':path[_0x8b08('0x2')](__dirname,_0x8b08('0x3'))},{'name':_0x8b08('0x4'),'script':path['join'](__dirname,_0x8b08('0x5'))},{'name':'agi','script':path[_0x8b08('0x2')](__dirname,_0x8b08('0x6'))},{'name':_0x8b08('0x7'),'script':path[_0x8b08('0x2')](__dirname,'../../services/email/index.js')},{'name':_0x8b08('0x8'),'script':path[_0x8b08('0x2')](__dirname,_0x8b08('0x9'))},{'name':'xdr','script':path[_0x8b08('0x2')](__dirname,_0x8b08('0xa'))}]};module[_0x8b08('0xb')]=config; \ No newline at end of file +var _0x4a52=['xdr','exports','path','express','join','../../services/express/index.js','ami','../../services/ami/index.js','agi','../../services/agi/index.js','email','../../services/routing/index.js'];(function(_0x5a220b,_0x46cd58){var _0x44cddf=function(_0x5cc4a4){while(--_0x5cc4a4){_0x5a220b['push'](_0x5a220b['shift']());}};_0x44cddf(++_0x46cd58);}(_0x4a52,0x15e));var _0x24a5=function(_0x3c7896,_0x4bd9f5){_0x3c7896=_0x3c7896-0x0;var _0x381ef2=_0x4a52[_0x3c7896];return _0x381ef2;};'use strict';var path=require(_0x24a5('0x0'));var os=require('os');var config={'apps':[{'name':_0x24a5('0x1'),'script':path[_0x24a5('0x2')](__dirname,_0x24a5('0x3'))},{'name':_0x24a5('0x4'),'script':path['join'](__dirname,_0x24a5('0x5'))},{'name':_0x24a5('0x6'),'script':path[_0x24a5('0x2')](__dirname,_0x24a5('0x7'))},{'name':_0x24a5('0x8'),'script':path[_0x24a5('0x2')](__dirname,'../../services/email/index.js')},{'name':'routing','script':path[_0x24a5('0x2')](__dirname,_0x24a5('0x9'))},{'name':_0x24a5('0xa'),'script':path[_0x24a5('0x2')](__dirname,'../../services/xdr/index.js')}]};module[_0x24a5('0xb')]=config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 7e91557..28027bd 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 _0x8c79=['start','disconnect','stop','restart','then','list','delete','dump','pm2','connected'];(function(_0x7c3908,_0x597974){var _0x51e4e7=function(_0x5e2e3f){while(--_0x5e2e3f){_0x7c3908['push'](_0x7c3908['shift']());}};_0x51e4e7(++_0x597974);}(_0x8c79,0xa8));var _0x98c7=function(_0x2d1f3d,_0x4f80d7){_0x2d1f3d=_0x2d1f3d-0x0;var _0x5bf52c=_0x8c79[_0x2d1f3d];return _0x5bf52c;};'use strict';var pm2=require(_0x98c7('0x0'));var BPromise=require('bluebird');var config=require('./config');function connect(){return new BPromise(function(_0x4f62a1,_0x14ca25){return pm2['connect'](function(_0x255cd6){if(_0x255cd6){return _0x14ca25(_0x255cd6);}return _0x4f62a1(_0x98c7('0x1'));});});};exports['start']=function(_0x456fb6){return connect()['then'](function(){return new BPromise(function(_0x521447,_0x553d51){return pm2[_0x98c7('0x2')](_0x456fb6,function(_0x57b072,_0x2cba7b){if(_0x57b072){return _0x553d51(_0x57b072);}pm2[_0x98c7('0x3')]();return _0x521447(_0x2cba7b);});});});};exports['stop']=function(_0x538a81){return connect()['then'](function(){return new BPromise(function(_0x886fd5,_0x18ccbe){return pm2[_0x98c7('0x4')](_0x538a81,function(_0x592777,_0xfbb848){if(_0x592777){return _0x18ccbe(_0x592777);}pm2['disconnect']();return _0x886fd5(_0xfbb848);});});});};exports[_0x98c7('0x5')]=function(_0x37b79d){return connect()[_0x98c7('0x6')](function(){return new BPromise(function(_0x3dd9da,_0x1bc5e3){return pm2[_0x98c7('0x5')](_0x37b79d,function(_0x2a09cf,_0x414446){if(_0x2a09cf){return _0x1bc5e3(_0x2a09cf);}pm2[_0x98c7('0x3')]();return _0x3dd9da(_0x414446);});});});};exports[_0x98c7('0x7')]=function(){return connect()[_0x98c7('0x6')](function(){return new BPromise(function(_0x30055b,_0x9a9542){return pm2[_0x98c7('0x7')](function(_0x386fd3,_0x238e98){if(_0x386fd3){return _0x9a9542(_0x386fd3);}pm2['disconnect']();return _0x30055b(_0x238e98);});});});};exports['describe']=function(_0x3b9ced){return connect()[_0x98c7('0x6')](function(){return new BPromise(function(_0xb4696a,_0x23d344){return pm2['describe'](_0x3b9ced,function(_0x4aefd0,_0x228a73){if(_0x4aefd0){return _0x23d344(_0x4aefd0);}pm2['disconnect']();return _0xb4696a(_0x228a73);});});});};exports[_0x98c7('0x8')]=function(_0x126361){return connect()[_0x98c7('0x6')](function(){return new BPromise(function(_0x3fb47e,_0x5df15b){return pm2[_0x98c7('0x8')](_0x126361,function(_0x24a557,_0x313ed4){if(_0x24a557){return _0x5df15b(_0x24a557);}pm2[_0x98c7('0x3')]();return _0x3fb47e(_0x313ed4);});});});};exports[_0x98c7('0x9')]=function(){return connect()[_0x98c7('0x6')](function(){return new BPromise(function(_0xd7e9db,_0x58093f){return pm2[_0x98c7('0x9')](function(_0xec028){if(_0xec028){return _0x58093f(_0xec028);}return _0xd7e9db('saved');});});});}; \ No newline at end of file +var _0xa6c6=['dump','saved','pm2','bluebird','./config','connect','connected','start','then','stop','restart','disconnect','list','describe','delete'];(function(_0x1a9204,_0x1c9e00){var _0x17ca68=function(_0x1f4399){while(--_0x1f4399){_0x1a9204['push'](_0x1a9204['shift']());}};_0x17ca68(++_0x1c9e00);}(_0xa6c6,0x12e));var _0x6a6c=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xa6c6[_0x4b369d];return _0x571a98;};'use strict';var pm2=require(_0x6a6c('0x0'));var BPromise=require(_0x6a6c('0x1'));var config=require(_0x6a6c('0x2'));function connect(){return new BPromise(function(_0x207b61,_0x1c21e0){return pm2[_0x6a6c('0x3')](function(_0x36cf8a){if(_0x36cf8a){return _0x1c21e0(_0x36cf8a);}return _0x207b61(_0x6a6c('0x4'));});});};exports[_0x6a6c('0x5')]=function(_0x3067ad){return connect()[_0x6a6c('0x6')](function(){return new BPromise(function(_0x20baba,_0x4ca1c8){return pm2[_0x6a6c('0x5')](_0x3067ad,function(_0x2b347a,_0x3cb758){if(_0x2b347a){return _0x4ca1c8(_0x2b347a);}pm2['disconnect']();return _0x20baba(_0x3cb758);});});});};exports[_0x6a6c('0x7')]=function(_0x1e7f00){return connect()[_0x6a6c('0x6')](function(){return new BPromise(function(_0x51acdc,_0x891302){return pm2[_0x6a6c('0x7')](_0x1e7f00,function(_0xb92990,_0x1069a1){if(_0xb92990){return _0x891302(_0xb92990);}pm2['disconnect']();return _0x51acdc(_0x1069a1);});});});};exports['restart']=function(_0x235a8f){return connect()[_0x6a6c('0x6')](function(){return new BPromise(function(_0x5e1637,_0x5a27de){return pm2[_0x6a6c('0x8')](_0x235a8f,function(_0x37b464,_0xa7b681){if(_0x37b464){return _0x5a27de(_0x37b464);}pm2[_0x6a6c('0x9')]();return _0x5e1637(_0xa7b681);});});});};exports[_0x6a6c('0xa')]=function(){return connect()[_0x6a6c('0x6')](function(){return new BPromise(function(_0x376a44,_0x2bb16c){return pm2[_0x6a6c('0xa')](function(_0x1535cd,_0x286ef2){if(_0x1535cd){return _0x2bb16c(_0x1535cd);}pm2[_0x6a6c('0x9')]();return _0x376a44(_0x286ef2);});});});};exports[_0x6a6c('0xb')]=function(_0x110c4d){return connect()['then'](function(){return new BPromise(function(_0x36a719,_0x387521){return pm2[_0x6a6c('0xb')](_0x110c4d,function(_0x55d2c2,_0x1aba56){if(_0x55d2c2){return _0x387521(_0x55d2c2);}pm2[_0x6a6c('0x9')]();return _0x36a719(_0x1aba56);});});});};exports[_0x6a6c('0xc')]=function(_0x1720e2){return connect()[_0x6a6c('0x6')](function(){return new BPromise(function(_0x3becc1,_0x2d412e){return pm2[_0x6a6c('0xc')](_0x1720e2,function(_0x89c0b9,_0x882168){if(_0x89c0b9){return _0x2d412e(_0x89c0b9);}pm2['disconnect']();return _0x3becc1(_0x882168);});});});};exports[_0x6a6c('0xd')]=function(){return connect()[_0x6a6c('0x6')](function(){return new BPromise(function(_0x1f2394,_0x3a29b5){return pm2['dump'](function(_0x192f72){if(_0x192f72){return _0x3a29b5(_0x192f72);}return _0x1f2394(_0x6a6c('0xe'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index d3e775f..e013e20 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 _0x259c=['Setting','find','chatTimeout','findAll','lastMsgAt','subtract','minutes','then','ChatInteraction','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','emit','chatInteraction:update','error','start','moment','../../mysqldb','../../config/environment','redis','defaults','localhost'];(function(_0x291276,_0x5a4690){var _0x303ab3=function(_0xb0fe70){while(--_0xb0fe70){_0x291276['push'](_0x291276['shift']());}};_0x303ab3(++_0x5a4690);}(_0x259c,0x17a));var _0xc259=function(_0x5af5e6,_0x39f247){_0x5af5e6=_0x5af5e6-0x0;var _0x278e5d=_0x259c[_0x5af5e6];return _0x278e5d;};'use strict';var _=require('lodash');var moment=require(_0xc259('0x0'));var Redis=require('ioredis');var db=require(_0xc259('0x1'))['db'];var config=require(_0xc259('0x2'));config[_0xc259('0x3')]=_[_0xc259('0x4')](config[_0xc259('0x3')],{'host':_0xc259('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xc259('0x3')]));function closeInteractions(){var _0x370243=0x0;var _0x5a6f8f=[];return db[_0xc259('0x6')][_0xc259('0x7')]({'raw':!![],'attributes':['id',_0xc259('0x8')],'where':{'id':0x1}})['then'](function(_0x28625d){_0x370243=_0x28625d['chatTimeout'];if(_0x370243){return db['ChatInteraction'][_0xc259('0x9')]({'raw':!![],'attributes':['id',_0xc259('0xa')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0xc259('0xb')](_0x28625d['chatTimeout'],_0xc259('0xc'))}}});}else{return[];}})[_0xc259('0xd')](function(_0x29afa0){_0x5a6f8f=_0x29afa0;if(_0x370243){return db[_0xc259('0xe')][_0xc259('0xf')]({'closeReason':_0xc259('0x10'),'disposition':_0xc259('0x11'),'closed':!![],'closedAt':moment()[_0xc259('0x12')](_0xc259('0x13'))},{'where':{'id':_['map'](_0x5a6f8f||[],'id')}});}})[_0xc259('0xd')](function(_0x423521){for(var _0x170b77=0x0;_0x170b77<_0x5a6f8f['length'];_0x170b77++){io[_0xc259('0x14')](_0xc259('0x15'),{'id':_0x5a6f8f[_0x170b77]['id'],'closed':!![]});}})['catch'](function(_0x297a3c){console[_0xc259('0x16')](_0x297a3c);});}exports[_0xc259('0x17')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xa3b2=['moment','ioredis','../../mysqldb','../../config/environment','redis','defaults','localhost','socket.io-emitter','Setting','find','chatTimeout','then','ChatInteraction','findAll','lastMsgAt','subtract','minutes','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','map','catch','error'];(function(_0x156216,_0x2ca942){var _0x19b5a6=function(_0x55f4f1){while(--_0x55f4f1){_0x156216['push'](_0x156216['shift']());}};_0x19b5a6(++_0x2ca942);}(_0xa3b2,0x7d));var _0x2a3b=function(_0x3dfbc3,_0x41a601){_0x3dfbc3=_0x3dfbc3-0x0;var _0x53fc9e=_0xa3b2[_0x3dfbc3];return _0x53fc9e;};'use strict';var _=require('lodash');var moment=require(_0x2a3b('0x0'));var Redis=require(_0x2a3b('0x1'));var db=require(_0x2a3b('0x2'))['db'];var config=require(_0x2a3b('0x3'));config[_0x2a3b('0x4')]=_[_0x2a3b('0x5')](config[_0x2a3b('0x4')],{'host':_0x2a3b('0x6'),'port':0x18eb});var io=require(_0x2a3b('0x7'))(new Redis(config[_0x2a3b('0x4')]));function closeInteractions(){var _0x2df842=0x0;var _0x442d70=[];return db[_0x2a3b('0x8')][_0x2a3b('0x9')]({'raw':!![],'attributes':['id',_0x2a3b('0xa')],'where':{'id':0x1}})[_0x2a3b('0xb')](function(_0x7cceb0){_0x2df842=_0x7cceb0[_0x2a3b('0xa')];if(_0x2df842){return db[_0x2a3b('0xc')][_0x2a3b('0xd')]({'raw':!![],'attributes':['id',_0x2a3b('0xe')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x2a3b('0xf')](_0x7cceb0[_0x2a3b('0xa')],_0x2a3b('0x10'))}}});}else{return[];}})[_0x2a3b('0xb')](function(_0x2dc498){_0x442d70=_0x2dc498;if(_0x2df842){return db['ChatInteraction'][_0x2a3b('0x11')]({'closeReason':_0x2a3b('0x12'),'disposition':_0x2a3b('0x13'),'closed':!![],'closedAt':moment()[_0x2a3b('0x14')](_0x2a3b('0x15'))},{'where':{'id':_[_0x2a3b('0x16')](_0x442d70||[],'id')}});}})[_0x2a3b('0xb')](function(_0x3e10af){for(var _0x2f40a5=0x0;_0x2f40a5<_0x442d70['length'];_0x2f40a5++){io['emit']('chatInteraction:update',{'id':_0x442d70[_0x2f40a5]['id'],'closed':!![]});}})[_0x2a3b('0x17')](function(_0x1cea79){console[_0x2a3b('0x18')](_0x1cea79);});}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 0088486..05c6a4e 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 _0xabad=['error\x20mail','stringify','email\x20sent','catch','data','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','YYYY-MM-DD\x20HH:mm:ss','scheduled','exec\x20defaul\x20report\x20id:%s','runReport','DefaultReportId','exec\x20custom\x20report\x20id:%s','Schedule','MailServerOut','keys','jobs','map','toString','difference','intersection','stop','deleteJob','delete\x20cron','toRun','length','index','resolve','cron','active','isBetween','startAt','endAt','add','add\x20cron','exists','stop\x20cron','update','update\x20cron','run','lodash','moment','cron-job-manager','bluebird','../logger','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','http','info','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','Smtp','service','host','port','secure','authentication','user','pass','format','name','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','subtractUnit','../../files/reports','savename','basename','extname','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','empty\x20file,\x20email\x20not\x20sent','request','SendMail','then','error'];(function(_0x22efd1,_0x1f404d){var _0xf11137=function(_0x18c537){while(--_0x18c537){_0x22efd1['push'](_0x22efd1['shift']());}};_0xf11137(++_0x1f404d);}(_0xabad,0xd1));var _0xdaba=function(_0x5782a3,_0x2d54f3){_0x5782a3=_0x5782a3-0x0;var _0x5dcae1=_0xabad[_0x5782a3];return _0x5dcae1;};'use strict';var fs=require('fs');var util=require('util');var path=require('path');var _=require(_0xdaba('0x0'));var moment=require(_0xdaba('0x1'));var CronJobManager=require(_0xdaba('0x2'));var jayson=require('jayson/promise');var BPromise=require(_0xdaba('0x3'));var logger=require(_0xdaba('0x4'))('schedule');var db=require(_0xdaba('0x5'))['db'];var analyticCustomReportController=require(_0xdaba('0x6'));var analyticDefaultReportController=require('../../api/analyticDefaultReport/analyticDefaultReport.controller');var client=jayson['client'][_0xdaba('0x7')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x3f6f68,_0x3cb516){return function(){logger[_0xdaba('0x8')](_0xdaba('0x9'),_0x3f6f68[_0xdaba('0xa')]);var _0x161764=!![];var _0x9c634c={'tls':{'rejectUnauthorized':![]}};if(_0x3f6f68[_0xdaba('0xb')][_0xdaba('0xc')][_0xdaba('0xd')]){_0x9c634c[_0xdaba('0xd')]=_0x3f6f68['MailAccount'][_0xdaba('0xc')][_0xdaba('0xd')];}else{_0x9c634c[_0xdaba('0xe')]=_0x3f6f68[_0xdaba('0xb')][_0xdaba('0xc')]['host'];_0x9c634c['port']=_0x3f6f68['MailAccount'][_0xdaba('0xc')][_0xdaba('0xf')];_0x9c634c['secure']=_0x3f6f68[_0xdaba('0xb')][_0xdaba('0xc')][_0xdaba('0x10')];}if(_0x3f6f68[_0xdaba('0xb')][_0xdaba('0xc')][_0xdaba('0x11')]){_0x9c634c['auth']={'user':_0x3f6f68['MailAccount'][_0xdaba('0xc')][_0xdaba('0x12')],'pass':_0x3f6f68[_0xdaba('0xb')][_0xdaba('0xc')][_0xdaba('0x13')]};}var _0x2cad2c={'account':_0x9c634c,'message':{'from':util[_0xdaba('0x14')]('\x22%s\x22\x20<%s>',_0x3f6f68[_0xdaba('0xb')][_0xdaba('0x15')],_0x3f6f68[_0xdaba('0xb')][_0xdaba('0xa')]||_0x3f6f68[_0xdaba('0xb')][_0xdaba('0xc')][_0xdaba('0x12')]),'to':_0x3f6f68['email'],'cc':_0x3f6f68['cc'],'bcc':_0x3f6f68['bcc'],'subject':util[_0xdaba('0x14')](_0xdaba('0x16'),_0x3cb516[_0xdaba('0x15')],_0x3f6f68[_0xdaba('0x17')],_0x3f6f68[_0xdaba('0x18')])}};var _0x406b0c=path['join'](__dirname,_0xdaba('0x19'));var _0x278648=_0x3cb516[_0xdaba('0x1a')];var _0x356500=util[_0xdaba('0x14')]('%s.%s',path[_0xdaba('0x1b')](_0x3cb516[_0xdaba('0x1a')],path[_0xdaba('0x1c')](_0x3cb516[_0xdaba('0x1a')])),_0xdaba('0x1d'));var _0x401e1a=path['join'](_0x406b0c,_0x278648);var _0x39bef8=path[_0xdaba('0x1e')](_0x406b0c,_0x356500);if(fs[_0xdaba('0x1f')](_0x401e1a)){_0x3cb516[_0xdaba('0x20')]=_0xdaba('0x21');_0x2cad2c[_0xdaba('0x22')][_0xdaba('0x23')]=[{'filename':_0x278648,'path':_0x401e1a}];_0x2cad2c['message'][_0xdaba('0x24')]=util[_0xdaba('0x14')](_0xdaba('0x25'),JSON['stringify'](_0x3cb516,null,0x2));}else if(fs[_0xdaba('0x1f')](_0x39bef8)){_0x3cb516['status']=_0xdaba('0x21');_0x2cad2c[_0xdaba('0x22')]['attachments']=[{'filename':_0x356500,'path':_0x39bef8}];}else{_0x2cad2c[_0xdaba('0x22')][_0xdaba('0x24')]='Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';if(!_0x3f6f68['sendIfEmpty']){_0x161764=![];logger[_0xdaba('0x8')](_0xdaba('0x26'));}}if(_0x161764){return client[_0xdaba('0x27')](_0xdaba('0x28'),_0x2cad2c)[_0xdaba('0x29')](function(_0x46861d){if(_0x46861d[_0xdaba('0x2a')]){return logger['error'](_0xdaba('0x2b'),JSON[_0xdaba('0x2c')](_0x46861d));}return logger[_0xdaba('0x8')](_0xdaba('0x2d'));})[_0xdaba('0x2e')](function(_0x34b2a4){return logger[_0xdaba('0x2a')](_0xdaba('0x2b'),JSON[_0xdaba('0x2c')](_0x34b2a4));});}};}function handleError(){return function(_0x24af4e){return logger[_0xdaba('0x2a')](JSON[_0xdaba('0x2c')](_0x24af4e));};}function handleResult(_0x2ced23){return function(_0x31e382){logger[_0xdaba('0x8')](_0xdaba('0x2f'),JSON[_0xdaba('0x2c')](_0x31e382));if(_0x2ced23['MailAccount']&&_0x2ced23[_0xdaba('0xb')][_0xdaba('0xc')]&&!_[_0xdaba('0x30')](_0x2ced23['email'])){setTimeout(handleSendEmail(_0x2ced23,_0x31e382),0x3c*0x3e8);}};}function handleJob(_0x415fae){return function(){try{if(_[_0xdaba('0x30')](_0x415fae[_0xdaba('0x17')])){return logger[_0xdaba('0x8')](_0xdaba('0x31'));}if(_[_0xdaba('0x30')](_0x415fae[_0xdaba('0x18')])){return logger['info'](_0xdaba('0x32'));}var _0x21a61b={'startDate':moment()['subtract'](_0x415fae['subtractNumber'],_0x415fae[_0xdaba('0x18')])[_0xdaba('0x14')](_0xdaba('0x33')),'endDate':moment()[_0xdaba('0x14')]('YYYY-MM-DD\x20HH:mm:ss'),'type':_0xdaba('0x34'),'output':_0x415fae['output'],'name':_0x415fae[_0xdaba('0x15')]};if(!_['isNil'](_0x415fae['DefaultReportId'])){logger[_0xdaba('0x8')](_0xdaba('0x35'),_0x415fae['DefaultReportId']);return analyticDefaultReportController[_0xdaba('0x36')]({'id':_0x415fae[_0xdaba('0x37')]},_0x21a61b)[_0xdaba('0x29')](handleResult(_0x415fae))[_0xdaba('0x2e')](handleError());}if(!_[_0xdaba('0x30')](_0x415fae['CustomReportId'])){logger[_0xdaba('0x8')](_0xdaba('0x38'),_0x415fae['CustomReportId']);return analyticCustomReportController['runReport']({'id':_0x415fae['CustomReportId']},_0x21a61b)[_0xdaba('0x29')](handleResult(_0x415fae))[_0xdaba('0x2e')](handleError());}}catch(_0x40c4a2){logger[_0xdaba('0x2a')](JSON[_0xdaba('0x2c')](_0x40c4a2));}return logger[_0xdaba('0x8')]('no\x20report\x20id');};}function getJobs(_0x229404){var _0x4e5d75={};if(_0x229404){_0x4e5d75['id']=_0x229404;}return db[_0xdaba('0x39')]['findAll']({'where':_0x4e5d75,'include':[{'model':db['MailAccount'],'attributes':['id','name',_0xdaba('0xa')],'include':[{'model':db[_0xdaba('0x3a')],'as':'Smtp'}]}]})['then'](function(_0x21252d){var _0x195157=_[_0xdaba('0x3b')](manager[_0xdaba('0x3c')]);var _0x347565=_[_0xdaba('0x3d')](_0x21252d,function(_0x4686f9){return _0x4686f9['id'][_0xdaba('0x3e')]();});var _0x48d150=_['keyBy'](_0x21252d,function(_0x5ec8b5){return _0x5ec8b5['id']['toString']();});var _0xe3968a=_0x229404?_0x347565:_[_0xdaba('0x3f')](_0x347565,_0x195157);var _0xf6251d=_[_0xdaba('0x40')](_0x347565,_0x195157);var _0x924591=_[_0xdaba('0x3f')](_0x195157,_0x347565);var _0x2f8d55;var _0x59254f;for(_0x2f8d55=0x0;_0x2f8d55<_0x924591['length']&&!_0x229404;_0x2f8d55+=0x1){_0x59254f=_0x924591[_0x2f8d55][_0xdaba('0x3e')]();if(manager['exists'](_0x59254f)){manager[_0xdaba('0x41')](_0x59254f);manager[_0xdaba('0x42')](_0x59254f);logger[_0xdaba('0x8')](_0xdaba('0x43'),_0x59254f);}}logger[_0xdaba('0x8')](_0xdaba('0x44'),JSON[_0xdaba('0x2c')](_0xe3968a));for(_0x2f8d55=0x0;_0x2f8d55<_0xe3968a[_0xdaba('0x45')];_0x2f8d55+=0x1){_0x59254f=_0xe3968a[_0x2f8d55]['toString']();logger['info'](_0xdaba('0x46'),_0x59254f);if(_0x229404){logger[_0xdaba('0x8')]('my\x20id',_0x229404);logger[_0xdaba('0x8')](JSON[_0xdaba('0x2c')](_0x48d150[_0x59254f]));BPromise[_0xdaba('0x47')]()[_0xdaba('0x29')](handleJob(_0x48d150[_0x59254f]));logger[_0xdaba('0x8')]('run\x20job',_0x48d150[_0x59254f][_0xdaba('0x15')],_0x48d150[_0x59254f]['cron']);}else if(_0x48d150[_0x59254f][_0xdaba('0x48')]&&_0x48d150[_0x59254f][_0xdaba('0x49')]&&moment()[_0xdaba('0x4a')](_0x48d150[_0x59254f][_0xdaba('0x4b')],_0x48d150[_0x59254f][_0xdaba('0x4c')])){manager[_0xdaba('0x4d')](_0x59254f,_0x48d150[_0x59254f][_0xdaba('0x48')],handleJob(_0x48d150[_0x59254f]));manager['start'](_0x59254f);logger['info'](_0xdaba('0x4e'),_0x48d150[_0x59254f][_0xdaba('0x15')],_0x48d150[_0x59254f][_0xdaba('0x48')]);}else if(manager[_0xdaba('0x4f')](_0x59254f)){manager[_0xdaba('0x41')](_0x59254f);manager[_0xdaba('0x42')](_0x59254f);logger['info'](_0xdaba('0x50'),_0x48d150[_0x59254f]['name'],_0x48d150[_0x59254f][_0xdaba('0x48')]);}}for(_0x2f8d55=0x0,_0x59254f;_0x2f8d55<_0xf6251d[_0xdaba('0x45')]&&!_0x229404;_0x2f8d55+=0x1){_0x59254f=_0xf6251d[_0x2f8d55]['toString']();if(manager[_0xdaba('0x4f')](_0x59254f)){if(_0x48d150[_0x59254f][_0xdaba('0x48')]&&_0x48d150[_0x59254f]['active']&&moment()[_0xdaba('0x4a')](_0x48d150[_0x59254f]['startAt'],_0x48d150[_0x59254f][_0xdaba('0x4c')])){manager[_0xdaba('0x51')](_0x59254f,_0x48d150[_0x59254f]['cron'],handleJob(_0x48d150[_0x59254f]));logger[_0xdaba('0x8')](_0xdaba('0x52'),_0x48d150[_0x59254f][_0xdaba('0x15')],_0x48d150[_0x59254f]['cron']);}else{manager[_0xdaba('0x41')](_0x59254f);manager[_0xdaba('0x42')](_0x59254f);logger[_0xdaba('0x8')](_0xdaba('0x50'),_0x48d150[_0x59254f][_0xdaba('0x15')],_0x48d150[_0x59254f][_0xdaba('0x48')]);}}}})[_0xdaba('0x2e')](function(_0x16116b){logger[_0xdaba('0x2a')](JSON[_0xdaba('0x2c')](_0x16116b));});}exports[_0xdaba('0x53')]=function(_0x5a2781){return getJobs(_0x5a2781);};exports['start']=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0xe193=['jobs','map','keyBy','toString','difference','intersection','length','exists','stop','deleteJob','delete\x20cron','toRun','index','run\x20job','active','isBetween','startAt','endAt','add','cron','start','update','update\x20cron','lodash','moment','cron-job-manager','../logger','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','info','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','service','Smtp','host','port','secure','authentication','user','pass','format','name','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','subtractUnit','join','savename','%s.%s','extname','existsSync','message','attachments','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','request','SendMail','error','error\x20mail','email\x20sent','data','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','scheduled','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','then','catch','CustomReportId','no\x20report\x20id','Schedule','findAll','MailServerOut','keys'];(function(_0x56f40e,_0x1d1b32){var _0x1b04a9=function(_0x2837b0){while(--_0x2837b0){_0x56f40e['push'](_0x56f40e['shift']());}};_0x1b04a9(++_0x1d1b32);}(_0xe193,0xbf));var _0x3e19=function(_0xfcc736,_0x5d1ea8){_0xfcc736=_0xfcc736-0x0;var _0x1108d9=_0xe193[_0xfcc736];return _0x1108d9;};'use strict';var fs=require('fs');var util=require('util');var path=require('path');var _=require(_0x3e19('0x0'));var moment=require(_0x3e19('0x1'));var CronJobManager=require(_0x3e19('0x2'));var jayson=require('jayson/promise');var BPromise=require('bluebird');var logger=require(_0x3e19('0x3'))(_0x3e19('0x4'));var db=require(_0x3e19('0x5'))['db'];var analyticCustomReportController=require(_0x3e19('0x6'));var analyticDefaultReportController=require(_0x3e19('0x7'));var client=jayson[_0x3e19('0x8')]['http']({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x4704b6,_0x6b8e84){return function(){logger[_0x3e19('0x9')](_0x3e19('0xa'),_0x4704b6[_0x3e19('0xb')]);var _0x32bdb1=!![];var _0x56757c={'tls':{'rejectUnauthorized':![]}};if(_0x4704b6[_0x3e19('0xc')]['Smtp']['service']){_0x56757c[_0x3e19('0xd')]=_0x4704b6[_0x3e19('0xc')][_0x3e19('0xe')][_0x3e19('0xd')];}else{_0x56757c[_0x3e19('0xf')]=_0x4704b6[_0x3e19('0xc')][_0x3e19('0xe')][_0x3e19('0xf')];_0x56757c[_0x3e19('0x10')]=_0x4704b6[_0x3e19('0xc')][_0x3e19('0xe')][_0x3e19('0x10')];_0x56757c['secure']=_0x4704b6[_0x3e19('0xc')]['Smtp'][_0x3e19('0x11')];}if(_0x4704b6['MailAccount'][_0x3e19('0xe')][_0x3e19('0x12')]){_0x56757c['auth']={'user':_0x4704b6[_0x3e19('0xc')]['Smtp'][_0x3e19('0x13')],'pass':_0x4704b6[_0x3e19('0xc')][_0x3e19('0xe')][_0x3e19('0x14')]};}var _0x1bd440={'account':_0x56757c,'message':{'from':util[_0x3e19('0x15')]('\x22%s\x22\x20<%s>',_0x4704b6['MailAccount'][_0x3e19('0x16')],_0x4704b6[_0x3e19('0xc')][_0x3e19('0xb')]||_0x4704b6[_0x3e19('0xc')]['Smtp'][_0x3e19('0x13')]),'to':_0x4704b6[_0x3e19('0xb')],'cc':_0x4704b6['cc'],'bcc':_0x4704b6['bcc'],'subject':util['format'](_0x3e19('0x17'),_0x6b8e84[_0x3e19('0x16')],_0x4704b6[_0x3e19('0x18')],_0x4704b6[_0x3e19('0x19')])}};var _0x237240=path[_0x3e19('0x1a')](__dirname,'../../files/reports');var _0x35db10=_0x6b8e84[_0x3e19('0x1b')];var _0x179bf1=util['format'](_0x3e19('0x1c'),path['basename'](_0x6b8e84[_0x3e19('0x1b')],path[_0x3e19('0x1d')](_0x6b8e84[_0x3e19('0x1b')])),'zip');var _0x5d6bc8=path[_0x3e19('0x1a')](_0x237240,_0x35db10);var _0x589543=path['join'](_0x237240,_0x179bf1);if(fs[_0x3e19('0x1e')](_0x5d6bc8)){_0x6b8e84['status']='Sent';_0x1bd440[_0x3e19('0x1f')][_0x3e19('0x20')]=[{'filename':_0x35db10,'path':_0x5d6bc8}];_0x1bd440['message'][_0x3e19('0x21')]=util[_0x3e19('0x15')](_0x3e19('0x22'),JSON[_0x3e19('0x23')](_0x6b8e84,null,0x2));}else if(fs[_0x3e19('0x1e')](_0x589543)){_0x6b8e84['status']='Sent';_0x1bd440[_0x3e19('0x1f')][_0x3e19('0x20')]=[{'filename':_0x179bf1,'path':_0x589543}];}else{_0x1bd440[_0x3e19('0x1f')][_0x3e19('0x21')]=_0x3e19('0x24');if(!_0x4704b6[_0x3e19('0x25')]){_0x32bdb1=![];logger[_0x3e19('0x9')](_0x3e19('0x26'));}}if(_0x32bdb1){return client[_0x3e19('0x27')](_0x3e19('0x28'),_0x1bd440)['then'](function(_0x4dc77d){if(_0x4dc77d[_0x3e19('0x29')]){return logger[_0x3e19('0x29')](_0x3e19('0x2a'),JSON[_0x3e19('0x23')](_0x4dc77d));}return logger[_0x3e19('0x9')](_0x3e19('0x2b'));})['catch'](function(_0x4cb50c){return logger[_0x3e19('0x29')](_0x3e19('0x2a'),JSON[_0x3e19('0x23')](_0x4cb50c));});}};}function handleError(){return function(_0x3e8044){return logger[_0x3e19('0x29')](JSON[_0x3e19('0x23')](_0x3e8044));};}function handleResult(_0x5ee233){return function(_0x50d8a5){logger[_0x3e19('0x9')](_0x3e19('0x2c'),JSON['stringify'](_0x50d8a5));if(_0x5ee233[_0x3e19('0xc')]&&_0x5ee233['MailAccount'][_0x3e19('0xe')]&&!_[_0x3e19('0x2d')](_0x5ee233[_0x3e19('0xb')])){setTimeout(handleSendEmail(_0x5ee233,_0x50d8a5),0x3c*0x3e8);}};}function handleJob(_0x173e42){return function(){try{if(_[_0x3e19('0x2d')](_0x173e42[_0x3e19('0x18')])){return logger[_0x3e19('0x9')](_0x3e19('0x2e'));}if(_[_0x3e19('0x2d')](_0x173e42[_0x3e19('0x19')])){return logger['info'](_0x3e19('0x2f'));}var _0x23a7a7={'startDate':moment()[_0x3e19('0x30')](_0x173e42[_0x3e19('0x18')],_0x173e42[_0x3e19('0x19')])[_0x3e19('0x15')]('YYYY-MM-DD\x20HH:mm:ss'),'endDate':moment()[_0x3e19('0x15')]('YYYY-MM-DD\x20HH:mm:ss'),'type':_0x3e19('0x31'),'output':_0x173e42['output'],'name':_0x173e42['name']};if(!_['isNil'](_0x173e42[_0x3e19('0x32')])){logger['info'](_0x3e19('0x33'),_0x173e42[_0x3e19('0x32')]);return analyticDefaultReportController[_0x3e19('0x34')]({'id':_0x173e42[_0x3e19('0x32')]},_0x23a7a7)[_0x3e19('0x35')](handleResult(_0x173e42))[_0x3e19('0x36')](handleError());}if(!_[_0x3e19('0x2d')](_0x173e42[_0x3e19('0x37')])){logger[_0x3e19('0x9')]('exec\x20custom\x20report\x20id:%s',_0x173e42[_0x3e19('0x37')]);return analyticCustomReportController[_0x3e19('0x34')]({'id':_0x173e42['CustomReportId']},_0x23a7a7)[_0x3e19('0x35')](handleResult(_0x173e42))[_0x3e19('0x36')](handleError());}}catch(_0x2bb741){logger[_0x3e19('0x29')](JSON[_0x3e19('0x23')](_0x2bb741));}return logger[_0x3e19('0x9')](_0x3e19('0x38'));};}function getJobs(_0x1622f8){var _0x4057e3={};if(_0x1622f8){_0x4057e3['id']=_0x1622f8;}return db[_0x3e19('0x39')][_0x3e19('0x3a')]({'where':_0x4057e3,'include':[{'model':db[_0x3e19('0xc')],'attributes':['id','name',_0x3e19('0xb')],'include':[{'model':db[_0x3e19('0x3b')],'as':_0x3e19('0xe')}]}]})[_0x3e19('0x35')](function(_0x28e713){var _0x2c83c4=_[_0x3e19('0x3c')](manager[_0x3e19('0x3d')]);var _0x1dfafa=_[_0x3e19('0x3e')](_0x28e713,function(_0x17fab0){return _0x17fab0['id']['toString']();});var _0x9284ec=_[_0x3e19('0x3f')](_0x28e713,function(_0x546868){return _0x546868['id'][_0x3e19('0x40')]();});var _0x21722b=_0x1622f8?_0x1dfafa:_[_0x3e19('0x41')](_0x1dfafa,_0x2c83c4);var _0x3c32b7=_[_0x3e19('0x42')](_0x1dfafa,_0x2c83c4);var _0x3c8cf4=_['difference'](_0x2c83c4,_0x1dfafa);var _0x9cef83;var _0x1187f7;for(_0x9cef83=0x0;_0x9cef83<_0x3c8cf4[_0x3e19('0x43')]&&!_0x1622f8;_0x9cef83+=0x1){_0x1187f7=_0x3c8cf4[_0x9cef83]['toString']();if(manager[_0x3e19('0x44')](_0x1187f7)){manager[_0x3e19('0x45')](_0x1187f7);manager[_0x3e19('0x46')](_0x1187f7);logger[_0x3e19('0x9')](_0x3e19('0x47'),_0x1187f7);}}logger[_0x3e19('0x9')](_0x3e19('0x48'),JSON[_0x3e19('0x23')](_0x21722b));for(_0x9cef83=0x0;_0x9cef83<_0x21722b[_0x3e19('0x43')];_0x9cef83+=0x1){_0x1187f7=_0x21722b[_0x9cef83]['toString']();logger[_0x3e19('0x9')](_0x3e19('0x49'),_0x1187f7);if(_0x1622f8){logger[_0x3e19('0x9')]('my\x20id',_0x1622f8);logger[_0x3e19('0x9')](JSON['stringify'](_0x9284ec[_0x1187f7]));BPromise['resolve']()['then'](handleJob(_0x9284ec[_0x1187f7]));logger['info'](_0x3e19('0x4a'),_0x9284ec[_0x1187f7][_0x3e19('0x16')],_0x9284ec[_0x1187f7]['cron']);}else if(_0x9284ec[_0x1187f7]['cron']&&_0x9284ec[_0x1187f7][_0x3e19('0x4b')]&&moment()[_0x3e19('0x4c')](_0x9284ec[_0x1187f7][_0x3e19('0x4d')],_0x9284ec[_0x1187f7][_0x3e19('0x4e')])){manager[_0x3e19('0x4f')](_0x1187f7,_0x9284ec[_0x1187f7][_0x3e19('0x50')],handleJob(_0x9284ec[_0x1187f7]));manager[_0x3e19('0x51')](_0x1187f7);logger['info']('add\x20cron',_0x9284ec[_0x1187f7][_0x3e19('0x16')],_0x9284ec[_0x1187f7]['cron']);}else if(manager[_0x3e19('0x44')](_0x1187f7)){manager[_0x3e19('0x45')](_0x1187f7);manager[_0x3e19('0x46')](_0x1187f7);logger[_0x3e19('0x9')]('stop\x20cron',_0x9284ec[_0x1187f7][_0x3e19('0x16')],_0x9284ec[_0x1187f7][_0x3e19('0x50')]);}}for(_0x9cef83=0x0,_0x1187f7;_0x9cef83<_0x3c32b7[_0x3e19('0x43')]&&!_0x1622f8;_0x9cef83+=0x1){_0x1187f7=_0x3c32b7[_0x9cef83][_0x3e19('0x40')]();if(manager['exists'](_0x1187f7)){if(_0x9284ec[_0x1187f7][_0x3e19('0x50')]&&_0x9284ec[_0x1187f7]['active']&&moment()['isBetween'](_0x9284ec[_0x1187f7][_0x3e19('0x4d')],_0x9284ec[_0x1187f7]['endAt'])){manager[_0x3e19('0x52')](_0x1187f7,_0x9284ec[_0x1187f7][_0x3e19('0x50')],handleJob(_0x9284ec[_0x1187f7]));logger[_0x3e19('0x9')](_0x3e19('0x53'),_0x9284ec[_0x1187f7]['name'],_0x9284ec[_0x1187f7][_0x3e19('0x50')]);}else{manager[_0x3e19('0x45')](_0x1187f7);manager[_0x3e19('0x46')](_0x1187f7);logger['info']('stop\x20cron',_0x9284ec[_0x1187f7][_0x3e19('0x16')],_0x9284ec[_0x1187f7][_0x3e19('0x50')]);}}}})['catch'](function(_0x3689ee){logger[_0x3e19('0x29')](JSON[_0x3e19('0x23')](_0x3689ee));});}exports['run']=function(_0x4e97b4){return getJobs(_0x4e97b4);};exports[_0x3e19('0x51')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file diff --git a/server/config/schedule/transcribe.js b/server/config/schedule/transcribe.js index c04dd3c..23696de 100644 --- a/server/config/schedule/transcribe.js +++ b/server/config/schedule/transcribe.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbc14=['Positive','Neutral','catch','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','findAll','Setting','Settings\x20not\x20available','bucket','Transcribe\x20not\x20configured','transcribeAccountId','forEach','push','start','lodash','aws-sdk','request-promise','util','bluebird','../../mysqldb','../../config/logger','transcribe','getTranscriptionJob','Comprehend','detectSentiment','substring','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','transcribeRegion','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','COMPLETED','Transcript','TranscriptFileUri','info','format','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','fileText','length','update','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentimentAccountId','sentimentRegion','language','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','findOne','data2','Cloud\x20Provider\x20not\x20configured','Sentiment','SentimentScore','Negative','Mixed','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','FAILED','FailureReason','resolve','sentiment','Cloud\x20Provider\x20not\x20available','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available'];(function(_0x5ed54b,_0x3a2827){var _0x4b58c7=function(_0x19d3b6){while(--_0x19d3b6){_0x5ed54b['push'](_0x5ed54b['shift']());}};_0x4b58c7(++_0x3a2827);}(_0xbc14,0xa1));var _0x4bc1=function(_0x46361e,_0x243aaf){_0x46361e=_0x46361e-0x0;var _0x14e302=_0xbc14[_0x46361e];return _0x14e302;};var _=require(_0x4bc1('0x0'));var AWS=require(_0x4bc1('0x1'));var rp=require(_0x4bc1('0x2'));var util=require(_0x4bc1('0x3'));var BPromise=require(_0x4bc1('0x4'));var db=require(_0x4bc1('0x5'))['db'];var logger=require(_0x4bc1('0x6'))(_0x4bc1('0x7'));function getTranscriptionJob(_0x35f9e4,_0x3b1df2,_0x1df87f,_0x5e42a1){return new Promise(function(_0x540e3a,_0x13870c){var _0x101c22=new AWS['TranscribeService']({'accessKeyId':_0x3b1df2,'secretAccessKey':_0x35f9e4,'region':_0x1df87f});_0x101c22[_0x4bc1('0x8')]({'TranscriptionJobName':_0x5e42a1},function(_0x48e717,_0x16d0bb){if(_0x48e717){return _0x13870c(_0x48e717);}else{return _0x540e3a(_0x16d0bb);}});});}function sentiment(_0x43b974,_0x2f2287,_0x56115e,_0x3b7924,_0x61e932){return new Promise(function(_0x422819,_0x1ec38b){var _0x36396e=new AWS[(_0x4bc1('0x9'))]({'accessKeyId':_0x2f2287,'secretAccessKey':_0x43b974,'region':_0x56115e});_0x36396e[_0x4bc1('0xa')]({'Text':_0x3b7924,'LanguageCode':_0x61e932[_0x4bc1('0xb')](0x0,0x2)},function(_0xb48431,_0xef78ca){if(_0xb48431){return _0x1ec38b(_0xb48431);}else{return _0x422819(_0xef78ca);}});});}function checkTranscribeJob(_0x2c37d5,_0x3ea557,_0x2ddd20){var _0x385f25;return new BPromise(function(_0x1d8c5e,_0x1ebc84){logger['info'](util['format'](_0x4bc1('0xc'),_0x2c37d5['id'],_0x2c37d5[_0x4bc1('0xd')]));return getTranscriptionJob(_0x2ddd20[_0x4bc1('0xe')],_0x2ddd20['data2'],_0x3ea557[_0x4bc1('0xf')],_0x2c37d5[_0x4bc1('0xd')])[_0x4bc1('0x10')](function(_0x12fc09){logger['info'](util['format'](_0x4bc1('0x11'),_0x2c37d5['id'],_0x2c37d5[_0x4bc1('0xd')],_0x12fc09[_0x4bc1('0x12')][_0x4bc1('0x13')]));if(!_0x2c37d5['fileText']){switch(_0x12fc09[_0x4bc1('0x12')][_0x4bc1('0x13')]){case _0x4bc1('0x14'):var _0x1a743a={'transcribeStatus':_0x12fc09[_0x4bc1('0x12')]['TranscriptionJobStatus'],'fileUri':_0x12fc09[_0x4bc1('0x12')][_0x4bc1('0x15')][_0x4bc1('0x16')]};logger[_0x4bc1('0x17')](util['format']('[RECORDING:%d]\x20Get\x20transcript',_0x2c37d5['id']));return rp({'uri':_0x12fc09[_0x4bc1('0x12')][_0x4bc1('0x15')][_0x4bc1('0x16')],'json':!![]})['then'](function(_0x58809f){logger['info'](util[_0x4bc1('0x18')](_0x4bc1('0x19'),_0x2c37d5['id']));if(_0x58809f&&_0x58809f['results']&&_0x58809f[_0x4bc1('0x1a')][_0x4bc1('0x1b')]&&_0x58809f[_0x4bc1('0x1a')][_0x4bc1('0x1b')]['length']){_0x1a743a[_0x4bc1('0x1c')]='';for(var _0x448695=0x0;_0x448695<_0x58809f[_0x4bc1('0x1a')][_0x4bc1('0x1b')][_0x4bc1('0x1d')];_0x448695++){_0x1a743a[_0x4bc1('0x1c')]+=_0x58809f[_0x4bc1('0x1a')][_0x4bc1('0x1b')][_0x448695]['transcript']+'';}}return _0x2c37d5[_0x4bc1('0x1e')](_0x1a743a);})['then'](function(){logger[_0x4bc1('0x17')](util[_0x4bc1('0x18')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x2c37d5['id']));if(!_0x2c37d5['tempSentiment']){throw new db[(_0x4bc1('0x1f'))][(_0x4bc1('0x20'))](_0x4bc1('0x21'));}if(!_0x3ea557['sentiment']||!_0x3ea557[_0x4bc1('0x22')]||!_0x3ea557[_0x4bc1('0x23')]||!_0x3ea557[_0x4bc1('0x24')]||!_0x3ea557['bucket']){throw new db[(_0x4bc1('0x1f'))][(_0x4bc1('0x20'))](_0x4bc1('0x25'));}if(!_0x1a743a[_0x4bc1('0x1c')]){throw new Error(_0x4bc1('0x26'));}if(_0x3ea557[_0x4bc1('0x22')]===_0x2ddd20['id']){return _0x2ddd20;}else{return db[_0x4bc1('0x27')][_0x4bc1('0x28')]({'where':{'id':_settings[_0x4bc1('0x22')]}});}})['then'](function(_0x2a56dc){if(!_0x2a56dc){throw new db[(_0x4bc1('0x1f'))][(_0x4bc1('0x20'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x2a56dc[_0x4bc1('0xe')]||!_0x2a56dc[_0x4bc1('0x29')]){throw new db['Sequelize']['ValidationError'](_0x4bc1('0x2a'));}_0x385f25=_0x2a56dc;logger['info'](util['format']('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x2c37d5['id']));return sentiment(_0x385f25[_0x4bc1('0xe')],_0x385f25['data2'],_0x3ea557[_0x4bc1('0x23')],_0x1a743a[_0x4bc1('0x1c')],_0x3ea557['language']);})[_0x4bc1('0x10')](function(_0x376e49){logger[_0x4bc1('0x17')](util[_0x4bc1('0x18')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x2c37d5['id']));return _0x2c37d5[_0x4bc1('0x1e')]({'sentiment':_0x376e49[_0x4bc1('0x2b')],'sPositive':_0x376e49[_0x4bc1('0x2c')]['Positive'],'sNegative':_0x376e49[_0x4bc1('0x2c')][_0x4bc1('0x2d')],'sMixed':_0x376e49[_0x4bc1('0x2c')][_0x4bc1('0x2e')],'sNeutral':_0x376e49[_0x4bc1('0x2c')]['Neutral']});})[_0x4bc1('0x10')](function(){logger['info'](util[_0x4bc1('0x18')](_0x4bc1('0x2f'),_0x2c37d5['id']));_0x1d8c5e();});case _0x4bc1('0x30'):return _0x2c37d5[_0x4bc1('0x1e')]({'transcribeStatus':_0x4bc1('0x30'),'failureReason':_0x12fc09[_0x4bc1('0x12')][_0x4bc1('0x31')]})[_0x4bc1('0x10')](function(){logger[_0x4bc1('0x17')](util[_0x4bc1('0x18')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x2c37d5['id']));_0x1d8c5e();});default:logger[_0x4bc1('0x17')](util['format']('[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed',_0x2c37d5['id']));break;}}else{return BPromise[_0x4bc1('0x32')]()[_0x4bc1('0x10')](function(){if(!_0x2c37d5['tempSentiment']){throw new db[(_0x4bc1('0x1f'))][(_0x4bc1('0x20'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x3ea557[_0x4bc1('0x33')]||!_0x3ea557['sentimentAccountId']||!_0x3ea557[_0x4bc1('0x23')]||!_0x3ea557[_0x4bc1('0x24')]||!_0x3ea557['bucket']){throw new db[(_0x4bc1('0x1f'))][(_0x4bc1('0x20'))](_0x4bc1('0x25'));}if(!_0x2c37d5[_0x4bc1('0x1c')]){throw new Error(_0x4bc1('0x26'));}if(_0x3ea557['sentimentAccountId']===_0x2ddd20['id']){return _0x2ddd20;}else{return db[_0x4bc1('0x27')]['findOne']({'where':{'id':_settings[_0x4bc1('0x22')]}});}})[_0x4bc1('0x10')](function(_0x534f62){if(!_0x534f62){throw new db[(_0x4bc1('0x1f'))][(_0x4bc1('0x20'))](_0x4bc1('0x34'));}if(!_0x534f62[_0x4bc1('0xe')]||!_0x534f62[_0x4bc1('0x29')]){throw new db[(_0x4bc1('0x1f'))]['ValidationError'](_0x4bc1('0x2a'));}_0x385f25=_0x534f62;logger[_0x4bc1('0x17')](util[_0x4bc1('0x18')](_0x4bc1('0x35'),_0x2c37d5['id']));return sentiment(_0x385f25['data1'],_0x385f25[_0x4bc1('0x29')],_0x3ea557[_0x4bc1('0x23')],_0x2c37d5['fileText'],_0x3ea557[_0x4bc1('0x24')]);})[_0x4bc1('0x10')](function(_0xc0f66a){logger['info'](util[_0x4bc1('0x18')](_0x4bc1('0x36'),_0x2c37d5['id']));return _0x2c37d5[_0x4bc1('0x1e')]({'sentiment':_0xc0f66a[_0x4bc1('0x2b')],'sPositive':_0xc0f66a[_0x4bc1('0x2c')][_0x4bc1('0x37')],'sNegative':_0xc0f66a['SentimentScore'][_0x4bc1('0x2d')],'sMixed':_0xc0f66a['SentimentScore']['Mixed'],'sNeutral':_0xc0f66a[_0x4bc1('0x2c')][_0x4bc1('0x38')],'transcribeStatus':'COMPLETED'});})['then'](function(){logger[_0x4bc1('0x17')](util[_0x4bc1('0x18')](_0x4bc1('0x2f'),_0x2c37d5['id']));_0x1d8c5e();});}})[_0x4bc1('0x39')](function(_0x1afc09){if(_0x1afc09){if(!_0x1afc09[_0x4bc1('0x3a')]||_0x1afc09['name']!==_0x4bc1('0x3b')){logger[_0x4bc1('0x3c')](util[_0x4bc1('0x18')](_0x4bc1('0x3d'),_0x2c37d5['id']),util[_0x4bc1('0x3e')](_0x1afc09,{'showHidden':![],'depth':null}));}}_0x1d8c5e();});});}function checkTranscribe(){var _0x495879;var _0x20d179;var _0x46c2ba;return db['VoiceRecording'][_0x4bc1('0x3f')]({'where':{'transcribeStatus':'IN_PROGRESS'}})[_0x4bc1('0x10')](function(_0x193f40){if(!_0x193f40||!_0x193f40[_0x4bc1('0x1d')]){throw new db['Sequelize'][(_0x4bc1('0x20'))]('No\x20transcribe\x20job\x20to\x20check');}_0x495879=_0x193f40;return db[_0x4bc1('0x40')]['findOne']({'where':{'id':0x1}});})[_0x4bc1('0x10')](function(_0x27b07d){if(!_0x27b07d){throw new db[(_0x4bc1('0x1f'))][(_0x4bc1('0x20'))](_0x4bc1('0x41'));}_0x20d179=_0x27b07d;if(!_0x20d179[_0x4bc1('0x7')]||!_0x20d179['transcribeAccountId']||!_0x20d179['transcribeRegion']||!_0x20d179['language']||!_0x20d179[_0x4bc1('0x42')]){throw new db['Sequelize']['ValidationError'](_0x4bc1('0x43'));}return db[_0x4bc1('0x27')][_0x4bc1('0x28')]({'where':{'id':_0x20d179[_0x4bc1('0x44')]}});})[_0x4bc1('0x10')](function(_0x204d1e){if(!_0x204d1e){throw new db[(_0x4bc1('0x1f'))][(_0x4bc1('0x20'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x204d1e['data1']||!_0x204d1e['data2']){throw new db[(_0x4bc1('0x1f'))][(_0x4bc1('0x20'))]('Cloud\x20Provider\x20not\x20configured');}_0x46c2ba=_0x204d1e;var _0x5b8d50=[];_0x495879[_0x4bc1('0x45')](function(_0x487670){_0x5b8d50[_0x4bc1('0x46')](checkTranscribeJob(_0x487670,_0x20d179,_0x46c2ba));});return BPromise['all'](_0x5b8d50);})[_0x4bc1('0x39')](function(_0x2ab4a7){if(_0x2ab4a7){if(!_0x2ab4a7['name']||_0x2ab4a7[_0x4bc1('0x3a')]!==_0x4bc1('0x3b')){logger[_0x4bc1('0x3c')](util['inspect'](_0x2ab4a7,{'showHidden':![],'depth':null}));}}});}exports[_0x4bc1('0x47')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0x2bd2=['update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentRegion','bucket','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','sentimentAccountId','CloudProvider','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','language','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Positive','Negative','Mixed','Neutral','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','findOne','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','Transcribe\x20not\x20configured','transcribeAccountId','push','catch','aws-sdk','request-promise','util','bluebird','../../config/logger','transcribe','Comprehend','detectSentiment','substring','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','data2','transcribeRegion','then','TranscriptionJobStatus','fileText','TranscriptionJob','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','length','transcripts','transcript'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x2bd2,0xb8));var _0x22bd=function(_0x3e1542,_0x58ecf8){_0x3e1542=_0x3e1542-0x0;var _0x4fb917=_0x2bd2[_0x3e1542];return _0x4fb917;};var _=require('lodash');var AWS=require(_0x22bd('0x0'));var rp=require(_0x22bd('0x1'));var util=require(_0x22bd('0x2'));var BPromise=require(_0x22bd('0x3'));var db=require('../../mysqldb')['db'];var logger=require(_0x22bd('0x4'))(_0x22bd('0x5'));function getTranscriptionJob(_0x3bcf54,_0x4b4b40,_0x3a6a39,_0x37cf06){return new Promise(function(_0x1b8cc9,_0x40a370){var _0x50b74d=new AWS['TranscribeService']({'accessKeyId':_0x4b4b40,'secretAccessKey':_0x3bcf54,'region':_0x3a6a39});_0x50b74d['getTranscriptionJob']({'TranscriptionJobName':_0x37cf06},function(_0x483ea5,_0xa33338){if(_0x483ea5){return _0x40a370(_0x483ea5);}else{return _0x1b8cc9(_0xa33338);}});});}function sentiment(_0x476f28,_0x5ce5b3,_0x25ee42,_0x7e498a,_0x14977d){return new Promise(function(_0x1541f7,_0x10d294){var _0x507bbe=new AWS[(_0x22bd('0x6'))]({'accessKeyId':_0x5ce5b3,'secretAccessKey':_0x476f28,'region':_0x25ee42});_0x507bbe[_0x22bd('0x7')]({'Text':_0x7e498a,'LanguageCode':_0x14977d[_0x22bd('0x8')](0x0,0x2)},function(_0x2d7163,_0xdc26ca){if(_0x2d7163){return _0x10d294(_0x2d7163);}else{return _0x1541f7(_0xdc26ca);}});});}function checkTranscribeJob(_0x51b853,_0x944209,_0x1442d0){var _0x23bac2;return new BPromise(function(_0x15d0a1,_0x39ada0){logger[_0x22bd('0x9')](util[_0x22bd('0xa')](_0x22bd('0xb'),_0x51b853['id'],_0x51b853[_0x22bd('0xc')]));return getTranscriptionJob(_0x1442d0[_0x22bd('0xd')],_0x1442d0[_0x22bd('0xe')],_0x944209[_0x22bd('0xf')],_0x51b853['transcribeName'])[_0x22bd('0x10')](function(_0x33c221){logger['info'](util[_0x22bd('0xa')]('[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s',_0x51b853['id'],_0x51b853['transcribeName'],_0x33c221['TranscriptionJob'][_0x22bd('0x11')]));if(!_0x51b853[_0x22bd('0x12')]){switch(_0x33c221[_0x22bd('0x13')]['TranscriptionJobStatus']){case _0x22bd('0x14'):var _0x16811c={'transcribeStatus':_0x33c221[_0x22bd('0x13')][_0x22bd('0x11')],'fileUri':_0x33c221[_0x22bd('0x13')][_0x22bd('0x15')][_0x22bd('0x16')]};logger[_0x22bd('0x9')](util[_0x22bd('0xa')](_0x22bd('0x17'),_0x51b853['id']));return rp({'uri':_0x33c221[_0x22bd('0x13')][_0x22bd('0x15')][_0x22bd('0x16')],'json':!![]})[_0x22bd('0x10')](function(_0x40383a){logger[_0x22bd('0x9')](util['format'](_0x22bd('0x18'),_0x51b853['id']));if(_0x40383a&&_0x40383a[_0x22bd('0x19')]&&_0x40383a[_0x22bd('0x19')]['transcripts']&&_0x40383a[_0x22bd('0x19')]['transcripts'][_0x22bd('0x1a')]){_0x16811c[_0x22bd('0x12')]='';for(var _0x545793=0x0;_0x545793<_0x40383a[_0x22bd('0x19')][_0x22bd('0x1b')]['length'];_0x545793++){_0x16811c[_0x22bd('0x12')]+=_0x40383a[_0x22bd('0x19')]['transcripts'][_0x545793][_0x22bd('0x1c')]+'';}}return _0x51b853[_0x22bd('0x1d')](_0x16811c);})['then'](function(){logger[_0x22bd('0x9')](util[_0x22bd('0xa')](_0x22bd('0x1e'),_0x51b853['id']));if(!_0x51b853[_0x22bd('0x1f')]){throw new db[(_0x22bd('0x20'))][(_0x22bd('0x21'))](_0x22bd('0x22'));}if(!_0x944209[_0x22bd('0x23')]||!_0x944209['sentimentAccountId']||!_0x944209[_0x22bd('0x24')]||!_0x944209['language']||!_0x944209[_0x22bd('0x25')]){throw new db['Sequelize'][(_0x22bd('0x21'))](_0x22bd('0x26'));}if(!_0x16811c[_0x22bd('0x12')]){throw new Error(_0x22bd('0x27'));}if(_0x944209[_0x22bd('0x28')]===_0x1442d0['id']){return _0x1442d0;}else{return db[_0x22bd('0x29')]['findOne']({'where':{'id':_settings['sentimentAccountId']}});}})[_0x22bd('0x10')](function(_0x2f1b29){if(!_0x2f1b29){throw new db['Sequelize'][(_0x22bd('0x21'))](_0x22bd('0x2a'));}if(!_0x2f1b29[_0x22bd('0xd')]||!_0x2f1b29[_0x22bd('0xe')]){throw new db[(_0x22bd('0x20'))][(_0x22bd('0x21'))](_0x22bd('0x2b'));}_0x23bac2=_0x2f1b29;logger[_0x22bd('0x9')](util['format']('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x51b853['id']));return sentiment(_0x23bac2[_0x22bd('0xd')],_0x23bac2[_0x22bd('0xe')],_0x944209[_0x22bd('0x24')],_0x16811c[_0x22bd('0x12')],_0x944209[_0x22bd('0x2c')]);})[_0x22bd('0x10')](function(_0x415a3e){logger[_0x22bd('0x9')](util[_0x22bd('0xa')](_0x22bd('0x2d'),_0x51b853['id']));return _0x51b853[_0x22bd('0x1d')]({'sentiment':_0x415a3e[_0x22bd('0x2e')],'sPositive':_0x415a3e[_0x22bd('0x2f')][_0x22bd('0x30')],'sNegative':_0x415a3e['SentimentScore'][_0x22bd('0x31')],'sMixed':_0x415a3e[_0x22bd('0x2f')][_0x22bd('0x32')],'sNeutral':_0x415a3e['SentimentScore'][_0x22bd('0x33')]});})[_0x22bd('0x10')](function(){logger['info'](util[_0x22bd('0xa')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x51b853['id']));_0x15d0a1();});case _0x22bd('0x34'):return _0x51b853['update']({'transcribeStatus':'FAILED','failureReason':_0x33c221[_0x22bd('0x13')][_0x22bd('0x35')]})[_0x22bd('0x10')](function(){logger['info'](util[_0x22bd('0xa')](_0x22bd('0x1e'),_0x51b853['id']));_0x15d0a1();});default:logger[_0x22bd('0x9')](util[_0x22bd('0xa')](_0x22bd('0x36'),_0x51b853['id']));break;}}else{return BPromise[_0x22bd('0x37')]()[_0x22bd('0x10')](function(){if(!_0x51b853[_0x22bd('0x1f')]){throw new db['Sequelize']['ValidationError'](_0x22bd('0x22'));}if(!_0x944209[_0x22bd('0x23')]||!_0x944209[_0x22bd('0x28')]||!_0x944209[_0x22bd('0x24')]||!_0x944209[_0x22bd('0x2c')]||!_0x944209[_0x22bd('0x25')]){throw new db[(_0x22bd('0x20'))]['ValidationError'](_0x22bd('0x26'));}if(!_0x51b853[_0x22bd('0x12')]){throw new Error(_0x22bd('0x27'));}if(_0x944209['sentimentAccountId']===_0x1442d0['id']){return _0x1442d0;}else{return db[_0x22bd('0x29')][_0x22bd('0x38')]({'where':{'id':_settings['sentimentAccountId']}});}})[_0x22bd('0x10')](function(_0x5cd26a){if(!_0x5cd26a){throw new db[(_0x22bd('0x20'))][(_0x22bd('0x21'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x5cd26a['data1']||!_0x5cd26a[_0x22bd('0xe')]){throw new db[(_0x22bd('0x20'))][(_0x22bd('0x21'))]('Cloud\x20Provider\x20not\x20configured');}_0x23bac2=_0x5cd26a;logger['info'](util[_0x22bd('0xa')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x51b853['id']));return sentiment(_0x23bac2[_0x22bd('0xd')],_0x23bac2[_0x22bd('0xe')],_0x944209[_0x22bd('0x24')],_0x51b853[_0x22bd('0x12')],_0x944209[_0x22bd('0x2c')]);})[_0x22bd('0x10')](function(_0x27e3e5){logger['info'](util['format']('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x51b853['id']));return _0x51b853['update']({'sentiment':_0x27e3e5['Sentiment'],'sPositive':_0x27e3e5[_0x22bd('0x2f')]['Positive'],'sNegative':_0x27e3e5['SentimentScore'][_0x22bd('0x31')],'sMixed':_0x27e3e5['SentimentScore'][_0x22bd('0x32')],'sNeutral':_0x27e3e5[_0x22bd('0x2f')][_0x22bd('0x33')],'transcribeStatus':_0x22bd('0x14')});})['then'](function(){logger[_0x22bd('0x9')](util[_0x22bd('0xa')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x51b853['id']));_0x15d0a1();});}})['catch'](function(_0x697dd3){if(_0x697dd3){if(!_0x697dd3[_0x22bd('0x39')]||_0x697dd3[_0x22bd('0x39')]!==_0x22bd('0x3a')){logger[_0x22bd('0x3b')](util[_0x22bd('0xa')](_0x22bd('0x3c'),_0x51b853['id']),util[_0x22bd('0x3d')](_0x697dd3,{'showHidden':![],'depth':null}));}}_0x15d0a1();});});}function checkTranscribe(){var _0xec36c9;var _0x508f28;var _0x27f4a4;return db[_0x22bd('0x3e')][_0x22bd('0x3f')]({'where':{'transcribeStatus':'IN_PROGRESS'}})['then'](function(_0x4894ee){if(!_0x4894ee||!_0x4894ee['length']){throw new db[(_0x22bd('0x20'))][(_0x22bd('0x21'))](_0x22bd('0x40'));}_0xec36c9=_0x4894ee;return db[_0x22bd('0x41')][_0x22bd('0x38')]({'where':{'id':0x1}});})[_0x22bd('0x10')](function(_0x540cc6){if(!_0x540cc6){throw new db[(_0x22bd('0x20'))]['ValidationError'](_0x22bd('0x42'));}_0x508f28=_0x540cc6;if(!_0x508f28[_0x22bd('0x5')]||!_0x508f28['transcribeAccountId']||!_0x508f28[_0x22bd('0xf')]||!_0x508f28['language']||!_0x508f28[_0x22bd('0x25')]){throw new db[(_0x22bd('0x20'))][(_0x22bd('0x21'))](_0x22bd('0x43'));}return db['CloudProvider'][_0x22bd('0x38')]({'where':{'id':_0x508f28[_0x22bd('0x44')]}});})[_0x22bd('0x10')](function(_0x42acca){if(!_0x42acca){throw new db['Sequelize'][(_0x22bd('0x21'))](_0x22bd('0x2a'));}if(!_0x42acca[_0x22bd('0xd')]||!_0x42acca[_0x22bd('0xe')]){throw new db[(_0x22bd('0x20'))][(_0x22bd('0x21'))](_0x22bd('0x2b'));}_0x27f4a4=_0x42acca;var _0xcad986=[];_0xec36c9['forEach'](function(_0x686ba6){_0xcad986[_0x22bd('0x45')](checkTranscribeJob(_0x686ba6,_0x508f28,_0x27f4a4));});return BPromise['all'](_0xcad986);})[_0x22bd('0x46')](function(_0x5d0e0f){if(_0x5d0e0f){if(!_0x5d0e0f['name']||_0x5d0e0f['name']!==_0x22bd('0x3a')){logger[_0x22bd('0x3b')](util[_0x22bd('0x3d')](_0x5d0e0f,{'showHidden':![],'depth':null}));}}});}exports['start']=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file diff --git a/server/config/seedContact.js b/server/config/seedContact.js index 8556295..b702f00 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xada7=['../mysqldb','push','Innocenzo','Biondo','innocenzo.biondo','@xcally.com','now','CmContact','destroy','bulkCreate','then','log','finished\x20populating','CmHopper','contacts2','hopper2','catch','util'];(function(_0x577762,_0x1b0aeb){var _0x1b279a=function(_0x1a266f){while(--_0x1a266f){_0x577762['push'](_0x577762['shift']());}};_0x1b279a(++_0x1b0aeb);}(_0xada7,0x7d));var _0x7ada=function(_0x12acb8,_0x47eed8){_0x12acb8=_0x12acb8-0x0;var _0x563261=_0xada7[_0x12acb8];return _0x563261;};'use strict';var util=require(_0x7ada('0x0'));var db=require(_0x7ada('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x7ada('0x2')]({'id':i,'firstName':_0x7ada('0x3')+i,'lastName':_0x7ada('0x4')+i,'phone':0xf879fb460+i,'email':_0x7ada('0x5')+i+_0x7ada('0x6')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x7ada('0x2')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0x7ada('0x7')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x7ada('0x2')]({'id':i,'firstName':_0x7ada('0x3')+i,'lastName':_0x7ada('0x4')+i,'phone':0xf879fb460+i,'email':_0x7ada('0x5')+i+_0x7ada('0x6')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2['push']({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0x7ada('0x7')]()});}db[_0x7ada('0x8')][_0x7ada('0x9')]({'where':{}})['then'](function(){return db['CmContact'][_0x7ada('0xa')](contacts);})[_0x7ada('0xb')](function(){console[_0x7ada('0xc')](_0x7ada('0xd'),'contacts1');return db[_0x7ada('0xe')][_0x7ada('0x9')]({'where':{}});})['then'](function(){return db[_0x7ada('0xe')][_0x7ada('0xa')](hopper);})[_0x7ada('0xb')](function(){console[_0x7ada('0xc')](_0x7ada('0xd'),'hopper1');return db[_0x7ada('0x8')][_0x7ada('0xa')](contacts2);})[_0x7ada('0xb')](function(){console['log'](_0x7ada('0xd'),_0x7ada('0xf'));return db['CmHopper']['bulkCreate'](hopper2);})[_0x7ada('0xb')](function(){console[_0x7ada('0xc')](_0x7ada('0xd'),_0x7ada('0x10'));})[_0x7ada('0x11')](function(_0x1ff74d){console['log'](_0x1ff74d);}); \ No newline at end of file +var _0xb639=['then','CmContact','bulkCreate','log','finished\x20populating','contacts1','CmHopper','hopper1','contacts2','catch','util','../mysqldb','push','Biondo','@xcally.com','now','Innocenzo','innocenzo.biondo','destroy'];(function(_0x1440ce,_0x136aee){var _0x389c35=function(_0x73dfaf){while(--_0x73dfaf){_0x1440ce['push'](_0x1440ce['shift']());}};_0x389c35(++_0x136aee);}(_0xb639,0x186));var _0x9b63=function(_0x402950,_0x52d699){_0x402950=_0x402950-0x0;var _0x643b00=_0xb639[_0x402950];return _0x643b00;};'use strict';var util=require(_0x9b63('0x0'));var db=require(_0x9b63('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x9b63('0x2')]({'id':i,'firstName':'Innocenzo'+i,'lastName':_0x9b63('0x3')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0x9b63('0x4')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x9b63('0x2')]({'id':i,'active':![],'scheduledat':Date[_0x9b63('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x9b63('0x5')](),'updatedAt':Date[_0x9b63('0x5')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x9b63('0x2')]({'id':i,'firstName':_0x9b63('0x6')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0x9b63('0x7')+i+_0x9b63('0x4')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x9b63('0x2')]({'id':i,'active':![],'scheduledat':Date[_0x9b63('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x9b63('0x5')](),'updatedAt':Date[_0x9b63('0x5')]()});}db['CmContact'][_0x9b63('0x8')]({'where':{}})[_0x9b63('0x9')](function(){return db[_0x9b63('0xa')][_0x9b63('0xb')](contacts);})['then'](function(){console[_0x9b63('0xc')](_0x9b63('0xd'),_0x9b63('0xe'));return db['CmHopper'][_0x9b63('0x8')]({'where':{}});})[_0x9b63('0x9')](function(){return db[_0x9b63('0xf')][_0x9b63('0xb')](hopper);})[_0x9b63('0x9')](function(){console[_0x9b63('0xc')](_0x9b63('0xd'),_0x9b63('0x10'));return db[_0x9b63('0xa')]['bulkCreate'](contacts2);})['then'](function(){console[_0x9b63('0xc')](_0x9b63('0xd'),_0x9b63('0x11'));return db['CmHopper'][_0x9b63('0xb')](hopper2);})[_0x9b63('0x9')](function(){console[_0x9b63('0xc')](_0x9b63('0xd'),'hopper2');})[_0x9b63('0x12')](function(_0x4058d8){console[_0x9b63('0xc')](_0x4058d8);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index 3d87002..04f0b45 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x89c6=['%s%s','agent','%s%s@xcally.com','password','friend','udp','wss','ulaw','yes','/etc/pki/tls/certs/motion.crt','actpass','\x22%s\x22\x20<%s>','bulkCreate','then','log','add\x20user','catch','util','../mysqldb','push','format'];(function(_0x572cd7,_0x5bdded){var _0x388f9e=function(_0x52951d){while(--_0x52951d){_0x572cd7['push'](_0x572cd7['shift']());}};_0x388f9e(++_0x5bdded);}(_0x89c6,0x14c));var _0x689c=function(_0x44f601,_0x3a1d45){_0x44f601=_0x44f601-0x0;var _0x5570bd=_0x89c6[_0x44f601];return _0x5570bd;};'use strict';var util=require(_0x689c('0x0'));var db=require(_0x689c('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x689c('0x2')]({'name':util[_0x689c('0x3')](_0x689c('0x4'),_0x689c('0x5'),i),'fullname':util['format'](_0x689c('0x4'),_0x689c('0x5'),i),'email':util[_0x689c('0x3')](_0x689c('0x6'),_0x689c('0x5'),i),'role':_0x689c('0x5'),'password':_0x689c('0x7'),'internal':0xfa0+i,'type':_0x689c('0x8'),'transport':[_0x689c('0x9'),'ws',_0x689c('0xa')],'disallow':['all'],'allow':[_0x689c('0xb')],'defaultuser':util[_0x689c('0x3')](_0x689c('0x4'),_0x689c('0x5'),i),'encryption':'yes','avpf':'yes','force_avp':_0x689c('0xc'),'icesupport':_0x689c('0xc'),'dtlsenable':'yes','dtlsverify':'no','dtlscertfile':_0x689c('0xd'),'dtlsprivatekey':'/etc/pki/tls/private/motion.key','dtlssetup':_0x689c('0xe'),'callerid':util[_0x689c('0x3')](_0x689c('0xf'),util['format'](_0x689c('0x4'),_0x689c('0x5'),i),0xfa0+i)});}db['User'][_0x689c('0x10')](users)[_0x689c('0x11')](function(){console[_0x689c('0x12')](_0x689c('0x13'));})[_0x689c('0x14')](function(_0x108799){console[_0x689c('0x12')](_0x108799);}); \ No newline at end of file +var _0x6e7d=['/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','User','then','log','add\x20user','catch','agent','format','%s%s','%s%s@xcally.com','password','udp','wss','all','ulaw','yes'];(function(_0x2da913,_0x2a3952){var _0x105909=function(_0x4ac39d){while(--_0x4ac39d){_0x2da913['push'](_0x2da913['shift']());}};_0x105909(++_0x2a3952);}(_0x6e7d,0x1e4));var _0xd6e7=function(_0x2a8a27,_0x471143){_0x2a8a27=_0x2a8a27-0x0;var _0xb36d90=_0x6e7d[_0x2a8a27];return _0xb36d90;};'use strict';var util=require('util');var db=require('../mysqldb')['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users['push']({'name':util['format']('%s%s',_0xd6e7('0x0'),i),'fullname':util[_0xd6e7('0x1')](_0xd6e7('0x2'),'agent',i),'email':util[_0xd6e7('0x1')](_0xd6e7('0x3'),'agent',i),'role':_0xd6e7('0x0'),'password':_0xd6e7('0x4'),'internal':0xfa0+i,'type':'friend','transport':[_0xd6e7('0x5'),'ws',_0xd6e7('0x6')],'disallow':[_0xd6e7('0x7')],'allow':[_0xd6e7('0x8')],'defaultuser':util[_0xd6e7('0x1')](_0xd6e7('0x2'),_0xd6e7('0x0'),i),'encryption':_0xd6e7('0x9'),'avpf':_0xd6e7('0x9'),'force_avp':_0xd6e7('0x9'),'icesupport':_0xd6e7('0x9'),'dtlsenable':_0xd6e7('0x9'),'dtlsverify':'no','dtlscertfile':_0xd6e7('0xa'),'dtlsprivatekey':_0xd6e7('0xb'),'dtlssetup':_0xd6e7('0xc'),'callerid':util[_0xd6e7('0x1')](_0xd6e7('0xd'),util['format'](_0xd6e7('0x2'),'agent',i),0xfa0+i)});}db[_0xd6e7('0xe')]['bulkCreate'](users)[_0xd6e7('0xf')](function(){console[_0xd6e7('0x10')](_0xd6e7('0x11'));})[_0xd6e7('0x12')](function(_0x50c265){console[_0xd6e7('0x10')](_0x50c265);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index bdfd1b9..0c12ea5 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4fd7=['Telephones','findAll','Trunks','IvrCampaigns','UserProfileResource','resourceId','map','where','Campaign','type','format','%s:queue:%s','user:%s','handshake','query','ChatInteraction','ChatInteractions','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','admin','voice:inbound','voice:outbound','push','VoiceQueue','ChatQueue','FaxQueue','SmsQueue','MailQueue','OpenchannelQueue','Trunk','user','userProfileId','MailQueues','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getOpenchannelQueues','all','length','voice','chat','fax','sms','mail','telephone:%s','trunk:%s','campaign:%s:%s','leave','removeChatInteractions','emit','MailInteractions','removeMailInteractions','user_has_mail_interactions:remove','removeFaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','OpenchannelInteractions','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','catch','log','join','default','connection','setMaxListeners','request','remoteAddress','nsp','address','disconnect','DISCONNECTED','CONNECTED','lodash','util','bluebird','../mysqldb','./environment','name','Agents','User','role','agent','telephone','ivr','UserProfileSection','then','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','OpenchannelQueues'];(function(_0x455589,_0x1cd997){var _0x3d6ebd=function(_0x5d2caf){while(--_0x5d2caf){_0x455589['push'](_0x455589['shift']());}};_0x3d6ebd(++_0x1cd997);}(_0x4fd7,0x170));var _0x74fd=function(_0x5d98f0,_0x2667b2){_0x5d98f0=_0x5d98f0-0x0;var _0x2cfc7c=_0x4fd7[_0x5d98f0];return _0x2cfc7c;};'use strict';var _=require(_0x74fd('0x0'));var util=require(_0x74fd('0x1'));var BPromise=require(_0x74fd('0x2'));var db=require(_0x74fd('0x3'))['db'];var config=require(_0x74fd('0x4'));var queryQueues={'attributes':['id',_0x74fd('0x5')],'include':[{'as':_0x74fd('0x6'),'model':db[_0x74fd('0x7')],'attributes':['id',_0x74fd('0x5'),_0x74fd('0x8')],'raw':!![],'where':{'role':_0x74fd('0x9')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x74fd('0x5')],'where':{'role':_0x74fd('0xa')}};var queryTrunks={'raw':!![],'attributes':['id',_0x74fd('0x5')]};var queryAgents={'raw':!![],'attributes':['id','name'],'where':{'role':_0x74fd('0x9')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x74fd('0x5'),'type'],'where':{'type':_0x74fd('0xb')}};function getAssociatedResources(_0x164c35,_0x3e7e38,_0x5d3001){return db[_0x74fd('0xc')]['findOne']({'where':{'name':_0x164c35,'userProfileId':_0x3e7e38},'raw':!![]})[_0x74fd('0xd')](function(_0x169df2){if(_0x169df2){if(_0x169df2[_0x74fd('0xe')]){switch(_0x164c35){case _0x74fd('0xf'):case _0x74fd('0x10'):case _0x74fd('0x11'):case _0x74fd('0x12'):case'MailQueues':case _0x74fd('0x13'):return db[_0x5d3001]['findAll'](queryQueues);case _0x74fd('0x14'):return db[_0x5d3001][_0x74fd('0x15')](queryTelephones);case _0x74fd('0x16'):return db[_0x5d3001][_0x74fd('0x15')](queryTrunks);case _0x74fd('0x17'):return db[_0x5d3001][_0x74fd('0x15')](queryCampaigns);}}else{return db[_0x74fd('0x18')][_0x74fd('0x15')]({'attributes':[_0x74fd('0x19')],'where':{'sectionId':_0x169df2['id']},'raw':!![]})['then'](function(_0x51b604){if(_0x51b604){var _0x4be09c={'where':{'id':_[_0x74fd('0x1a')](_0x51b604,'resourceId')},'raw':!![]};switch(_0x5d3001){case'User':_0x4be09c[_0x74fd('0x1b')][_0x74fd('0x8')]=_0x74fd('0xa');break;case _0x74fd('0x1c'):_0x4be09c[_0x74fd('0x1b')][_0x74fd('0x1d')]=_0x74fd('0xb');break;}return db[_0x5d3001][_0x74fd('0x15')](_0x4be09c);}else{return[];}});}}else{return[];}})[_0x74fd('0xd')](function(_0x2624aa){return _0x2624aa;});}function joinOrLeaveQueues(_0x185066,_0x290aa1,_0x521a28,_0x1efa36){_0x185066[_0x290aa1](util[_0x74fd('0x1e')](_0x74fd('0x1f'),_0x521a28,_0x1efa36['name']));if(_0x1efa36[_0x74fd('0x6')]){for(var _0x2509ad=0x0;_0x2509ad<_0x1efa36[_0x74fd('0x6')]['length'];_0x2509ad+=0x1){_0x185066[_0x290aa1](util['format'](_0x74fd('0x20'),_0x1efa36[_0x74fd('0x6')][_0x2509ad][_0x74fd('0x5')]));}}}function joinOrLeave(_0x4272d1,_0x1106aa,_0x14a73d){var _0x329bd1;if(_0x4272d1[_0x74fd('0x21')][_0x74fd('0x22')]['id']){db[_0x74fd('0x7')]['find']({'attributes':['id','name',_0x74fd('0x8'),'userProfileId'],'where':{'id':_0x4272d1['handshake'][_0x74fd('0x22')]['id']},'include':[{'model':db[_0x74fd('0x23')],'as':_0x74fd('0x24'),'attributes':['id'],'raw':!![]},{'model':db['MailInteraction'],'as':'MailInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x74fd('0x25')],'as':_0x74fd('0x26'),'attributes':['id'],'raw':!![]},{'model':db[_0x74fd('0x27')],'as':_0x74fd('0x28'),'attributes':['id'],'raw':!![]},{'model':db[_0x74fd('0x29')],'as':'OpenchannelInteractions','attributes':['id'],'raw':!![]}]})[_0x74fd('0xd')](function(_0x10e7a4){if(_0x10e7a4){_0x329bd1=_0x10e7a4;_0x4272d1[_0x1106aa](util[_0x74fd('0x1e')](_0x74fd('0x20'),_0x10e7a4[_0x74fd('0x5')]));var _0x426b77=[];switch(_0x10e7a4['role']){case _0x74fd('0x2a'):_0x4272d1[_0x1106aa](_0x74fd('0x2b'));_0x4272d1[_0x1106aa](_0x74fd('0x2c'));if(queryQueues['hasOwnProperty']('include')){delete queryQueues['include'];}_0x426b77[_0x74fd('0x2d')](db[_0x74fd('0x2e')]['findAll'](queryQueues));_0x426b77[_0x74fd('0x2d')](db[_0x74fd('0x2f')]['findAll'](queryQueues));_0x426b77['push'](db[_0x74fd('0x30')][_0x74fd('0x15')](queryQueues));_0x426b77[_0x74fd('0x2d')](db[_0x74fd('0x31')]['findAll'](queryQueues));_0x426b77['push'](db[_0x74fd('0x32')][_0x74fd('0x15')](queryQueues));_0x426b77[_0x74fd('0x2d')](db[_0x74fd('0x33')]['findAll'](queryQueues));_0x426b77[_0x74fd('0x2d')](db[_0x74fd('0x7')]['findAll'](queryTelephones));_0x426b77[_0x74fd('0x2d')](db[_0x74fd('0x34')][_0x74fd('0x15')](queryTrunks));_0x426b77['push'](db['Campaign']['findAll'](queryCampaigns));_0x426b77[_0x74fd('0x2d')](db[_0x74fd('0x7')][_0x74fd('0x15')](queryAgents));break;case _0x74fd('0x35'):_0x4272d1[_0x1106aa](_0x74fd('0x2b'));_0x4272d1[_0x1106aa](_0x74fd('0x2c'));_0x426b77[_0x74fd('0x2d')](getAssociatedResources(_0x74fd('0xf'),_0x10e7a4[_0x74fd('0x36')],'VoiceQueue'));_0x426b77[_0x74fd('0x2d')](getAssociatedResources(_0x74fd('0x10'),_0x10e7a4[_0x74fd('0x36')],_0x74fd('0x2f')));_0x426b77[_0x74fd('0x2d')](getAssociatedResources(_0x74fd('0x11'),_0x10e7a4['userProfileId'],'FaxQueue'));_0x426b77[_0x74fd('0x2d')](getAssociatedResources(_0x74fd('0x12'),_0x10e7a4[_0x74fd('0x36')],'SmsQueue'));_0x426b77[_0x74fd('0x2d')](getAssociatedResources(_0x74fd('0x37'),_0x10e7a4[_0x74fd('0x36')],'MailQueue'));_0x426b77[_0x74fd('0x2d')](getAssociatedResources('OpenchannelQueues',_0x10e7a4[_0x74fd('0x36')],_0x74fd('0x33')));_0x426b77[_0x74fd('0x2d')](getAssociatedResources('Telephones',_0x10e7a4[_0x74fd('0x36')],_0x74fd('0x7')));_0x426b77[_0x74fd('0x2d')](getAssociatedResources('Trunks',_0x10e7a4[_0x74fd('0x36')],_0x74fd('0x34')));_0x426b77[_0x74fd('0x2d')](getAssociatedResources(_0x74fd('0x17'),_0x10e7a4['userProfileId'],_0x74fd('0x1c')));_0x426b77[_0x74fd('0x2d')](db[_0x74fd('0x7')][_0x74fd('0x15')](queryAgents));break;case _0x74fd('0x9'):_0x4272d1[_0x1106aa](_0x74fd('0x2b'));_0x4272d1[_0x1106aa](_0x74fd('0x2c'));_0x426b77[_0x74fd('0x2d')](_0x10e7a4[_0x74fd('0x38')]({'attributes':['id',_0x74fd('0x5')]}));_0x426b77['push'](_0x10e7a4[_0x74fd('0x39')]({'attributes':['id',_0x74fd('0x5')]}));_0x426b77['push'](_0x10e7a4[_0x74fd('0x3a')]({'attributes':['id',_0x74fd('0x5')]}));_0x426b77['push'](_0x10e7a4[_0x74fd('0x3b')]({'attributes':['id',_0x74fd('0x5')]}));_0x426b77[_0x74fd('0x2d')](_0x10e7a4['getMailQueues']({'attributes':['id','name']}));_0x426b77['push'](_0x10e7a4[_0x74fd('0x3c')]({'attributes':['id','name']}));break;}return BPromise[_0x74fd('0x3d')](_0x426b77);}})[_0x74fd('0xd')](function(_0x3955a3){if(_0x3955a3&&_0x3955a3[_0x74fd('0x3e')]){for(var _0x330a9d=0x0;_0x330a9d<_0x3955a3['length'];_0x330a9d+=0x1){for(var _0x17b17b=0x0;_0x17b17b<_0x3955a3[_0x330a9d][_0x74fd('0x3e')];_0x17b17b+=0x1){switch(_0x330a9d){case 0x0:joinOrLeaveQueues(_0x4272d1,_0x1106aa,_0x74fd('0x3f'),_0x3955a3[_0x330a9d][_0x17b17b]);break;case 0x1:joinOrLeaveQueues(_0x4272d1,_0x1106aa,_0x74fd('0x40'),_0x3955a3[_0x330a9d][_0x17b17b]);break;case 0x2:joinOrLeaveQueues(_0x4272d1,_0x1106aa,_0x74fd('0x41'),_0x3955a3[_0x330a9d][_0x17b17b]);break;case 0x3:joinOrLeaveQueues(_0x4272d1,_0x1106aa,_0x74fd('0x42'),_0x3955a3[_0x330a9d][_0x17b17b]);break;case 0x4:joinOrLeaveQueues(_0x4272d1,_0x1106aa,_0x74fd('0x43'),_0x3955a3[_0x330a9d][_0x17b17b]);break;case 0x5:joinOrLeaveQueues(_0x4272d1,_0x1106aa,'openchannel',_0x3955a3[_0x330a9d][_0x17b17b]);break;case 0x6:_0x4272d1[_0x1106aa](util[_0x74fd('0x1e')](_0x74fd('0x44'),_0x3955a3[_0x330a9d][_0x17b17b][_0x74fd('0x5')]));break;case 0x7:_0x4272d1[_0x1106aa](util['format'](_0x74fd('0x45'),_0x3955a3[_0x330a9d][_0x17b17b][_0x74fd('0x5')]));break;case 0x8:_0x4272d1[_0x1106aa](util['format'](_0x74fd('0x46'),_0x3955a3[_0x330a9d][_0x17b17b][_0x74fd('0x1d')],_0x3955a3[_0x330a9d][_0x17b17b][_0x74fd('0x5')]));break;case 0x9:_0x4272d1[_0x1106aa](util['format']('user:%s',_0x3955a3[_0x330a9d][_0x17b17b][_0x74fd('0x5')]));break;}}}}})[_0x74fd('0xd')](function(){if(_0x1106aa===_0x74fd('0x47')){var _0x6cb346=_['map'](_0x329bd1[_0x74fd('0x24')],'id');return _0x329bd1[_0x74fd('0x48')](_0x6cb346)['then'](function(){for(var _0x119893=0x0;_0x119893<_0x6cb346[_0x74fd('0x3e')];_0x119893+=0x1){_0x14a73d[_0x74fd('0x49')]('user_has_chat_interactions:remove',{'ChatInteractionId':Number(_0x6cb346[_0x119893]),'UserId':Number(_0x329bd1['id'])});}});}})[_0x74fd('0xd')](function(){if(_0x1106aa===_0x74fd('0x47')){var _0x123e90=_['map'](_0x329bd1[_0x74fd('0x4a')],'id');return _0x329bd1[_0x74fd('0x4b')](_0x123e90)['then'](function(){for(var _0x387d82=0x0;_0x387d82<_0x123e90[_0x74fd('0x3e')];_0x387d82+=0x1){_0x14a73d[_0x74fd('0x49')](_0x74fd('0x4c'),{'MailInteractionId':Number(_0x123e90[_0x387d82]),'UserId':Number(_0x329bd1['id'])});}});}})[_0x74fd('0xd')](function(){if(_0x1106aa===_0x74fd('0x47')){var _0xafa13f=_[_0x74fd('0x1a')](_0x329bd1[_0x74fd('0x26')],'id');return _0x329bd1[_0x74fd('0x4d')](_0xafa13f)[_0x74fd('0xd')](function(){for(var _0x183135=0x0;_0x183135<_0xafa13f[_0x74fd('0x3e')];_0x183135+=0x1){_0x14a73d[_0x74fd('0x49')](_0x74fd('0x4e'),{'FaxInteractionId':Number(_0xafa13f[_0x183135]),'UserId':Number(_0x329bd1['id'])});}});}})[_0x74fd('0xd')](function(){if(_0x1106aa===_0x74fd('0x47')){var _0x32c889=_['map'](_0x329bd1[_0x74fd('0x28')],'id');return _0x329bd1[_0x74fd('0x4f')](_0x32c889)[_0x74fd('0xd')](function(){for(var _0x2d63f3=0x0;_0x2d63f3<_0x32c889[_0x74fd('0x3e')];_0x2d63f3+=0x1){_0x14a73d[_0x74fd('0x49')](_0x74fd('0x50'),{'SmsInteractionId':Number(_0x32c889[_0x2d63f3]),'UserId':Number(_0x329bd1['id'])});}});}})['then'](function(){if(_0x1106aa==='leave'){var _0x13da9e=_['map'](_0x329bd1[_0x74fd('0x51')],'id');return _0x329bd1[_0x74fd('0x52')](_0x13da9e)[_0x74fd('0xd')](function(){for(var _0x379a5b=0x0;_0x379a5b<_0x13da9e['length'];_0x379a5b+=0x1){_0x14a73d[_0x74fd('0x49')](_0x74fd('0x53'),{'OpenchannelInteractionId':Number(_0x13da9e[_0x379a5b]),'UserId':Number(_0x329bd1['id'])});}});}})[_0x74fd('0x54')](function(_0xc3592d){_0x4272d1[_0x74fd('0x55')](_0xc3592d);});}}function onDisconnect(_0x39f0d5,_0x4ef72c){joinOrLeave(_0x39f0d5,'leave',_0x4ef72c);}function onConnect(_0x10534f){joinOrLeave(_0x10534f,_0x74fd('0x56'));}exports[_0x74fd('0x57')]=function(_0x307d93){_0x307d93['on'](_0x74fd('0x58'),function(_0x4f2f3f){_0x4f2f3f[_0x74fd('0x59')](0x0);_0x4f2f3f['address']=_0x4f2f3f[_0x74fd('0x5a')][_0x74fd('0x58')][_0x74fd('0x5b')]+':'+_0x4f2f3f[_0x74fd('0x5a')][_0x74fd('0x58')]['remotePort'];_0x4f2f3f['connectedAt']=new Date();_0x4f2f3f[_0x74fd('0x55')]=function(_0x54c3f5){console[_0x74fd('0x55')]('SocketIO\x20'+_0x4f2f3f[_0x74fd('0x5c')][_0x74fd('0x5')]+'['+_0x4f2f3f[_0x74fd('0x5d')]+']',_0x54c3f5);};_0x4f2f3f['on'](_0x74fd('0x5e'),function(){onDisconnect(_0x4f2f3f,_0x307d93);_0x4f2f3f[_0x74fd('0x55')](_0x74fd('0x5f'));});onConnect(_0x4f2f3f);_0x4f2f3f[_0x74fd('0x55')](_0x74fd('0x60'));});}; \ No newline at end of file +var _0x3ebb=['then','format','%s:queue:%s','user:%s','handshake','query','userProfileId','ChatInteractions','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','voice:inbound','voice:outbound','include','push','VoiceQueue','ChatQueue','FaxQueue','SmsQueue','MailQueue','Trunk','OpenchannelQueue','Telephones','getVoiceQueues','getChatQueues','getMailQueues','all','length','voice','chat','trunk:%s','campaign:%s:%s','leave','removeChatInteractions','emit','user_has_chat_interactions:remove','removeMailInteractions','user_has_mail_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','catch','join','connection','setMaxListeners','address','request','remoteAddress','remotePort','connectedAt','log','SocketIO\x20','nsp','disconnect','DISCONNECTED','lodash','bluebird','../mysqldb','./environment','name','Agents','role','agent','type','findOne','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','MailQueues','OpenchannelQueues','findAll','Trunks','IvrCampaigns','UserProfileResource','resourceId','map','User','where','Campaign','ivr'];(function(_0x4e80db,_0x3c8d4b){var _0x3fab59=function(_0x17415f){while(--_0x17415f){_0x4e80db['push'](_0x4e80db['shift']());}};_0x3fab59(++_0x3c8d4b);}(_0x3ebb,0x145));var _0xb3eb=function(_0x2f1e38,_0x3a2702){_0x2f1e38=_0x2f1e38-0x0;var _0x4372f5=_0x3ebb[_0x2f1e38];return _0x4372f5;};'use strict';var _=require(_0xb3eb('0x0'));var util=require('util');var BPromise=require(_0xb3eb('0x1'));var db=require(_0xb3eb('0x2'))['db'];var config=require(_0xb3eb('0x3'));var queryQueues={'attributes':['id',_0xb3eb('0x4')],'include':[{'as':_0xb3eb('0x5'),'model':db['User'],'attributes':['id',_0xb3eb('0x4'),_0xb3eb('0x6')],'raw':!![],'where':{'role':_0xb3eb('0x7')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0xb3eb('0x4')],'where':{'role':'telephone'}};var queryTrunks={'raw':!![],'attributes':['id','name']};var queryAgents={'raw':!![],'attributes':['id',_0xb3eb('0x4')],'where':{'role':'agent'}};var queryCampaigns={'raw':!![],'attributes':['id',_0xb3eb('0x4'),_0xb3eb('0x8')],'where':{'type':'ivr'}};function getAssociatedResources(_0x3b4504,_0x580715,_0x46e083){return db['UserProfileSection'][_0xb3eb('0x9')]({'where':{'name':_0x3b4504,'userProfileId':_0x580715},'raw':!![]})['then'](function(_0xff8916){if(_0xff8916){if(_0xff8916[_0xb3eb('0xa')]){switch(_0x3b4504){case _0xb3eb('0xb'):case _0xb3eb('0xc'):case _0xb3eb('0xd'):case _0xb3eb('0xe'):case _0xb3eb('0xf'):case _0xb3eb('0x10'):return db[_0x46e083][_0xb3eb('0x11')](queryQueues);case'Telephones':return db[_0x46e083][_0xb3eb('0x11')](queryTelephones);case _0xb3eb('0x12'):return db[_0x46e083][_0xb3eb('0x11')](queryTrunks);case _0xb3eb('0x13'):return db[_0x46e083]['findAll'](queryCampaigns);}}else{return db[_0xb3eb('0x14')][_0xb3eb('0x11')]({'attributes':[_0xb3eb('0x15')],'where':{'sectionId':_0xff8916['id']},'raw':!![]})['then'](function(_0x797c5a){if(_0x797c5a){var _0x2e2081={'where':{'id':_[_0xb3eb('0x16')](_0x797c5a,_0xb3eb('0x15'))},'raw':!![]};switch(_0x46e083){case _0xb3eb('0x17'):_0x2e2081[_0xb3eb('0x18')][_0xb3eb('0x6')]='telephone';break;case _0xb3eb('0x19'):_0x2e2081[_0xb3eb('0x18')][_0xb3eb('0x8')]=_0xb3eb('0x1a');break;}return db[_0x46e083][_0xb3eb('0x11')](_0x2e2081);}else{return[];}});}}else{return[];}})[_0xb3eb('0x1b')](function(_0x4b6a86){return _0x4b6a86;});}function joinOrLeaveQueues(_0x312f77,_0x543a77,_0x53d4e8,_0x112cfe){_0x312f77[_0x543a77](util[_0xb3eb('0x1c')](_0xb3eb('0x1d'),_0x53d4e8,_0x112cfe[_0xb3eb('0x4')]));if(_0x112cfe[_0xb3eb('0x5')]){for(var _0x2bef0d=0x0;_0x2bef0d<_0x112cfe[_0xb3eb('0x5')]['length'];_0x2bef0d+=0x1){_0x312f77[_0x543a77](util[_0xb3eb('0x1c')](_0xb3eb('0x1e'),_0x112cfe[_0xb3eb('0x5')][_0x2bef0d][_0xb3eb('0x4')]));}}}function joinOrLeave(_0x4b818f,_0x171915,_0xcbc907){var _0x547654;if(_0x4b818f[_0xb3eb('0x1f')][_0xb3eb('0x20')]['id']){db[_0xb3eb('0x17')]['find']({'attributes':['id','name',_0xb3eb('0x6'),_0xb3eb('0x21')],'where':{'id':_0x4b818f[_0xb3eb('0x1f')][_0xb3eb('0x20')]['id']},'include':[{'model':db['ChatInteraction'],'as':_0xb3eb('0x22'),'attributes':['id'],'raw':!![]},{'model':db[_0xb3eb('0x23')],'as':_0xb3eb('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0xb3eb('0x25')],'as':_0xb3eb('0x26'),'attributes':['id'],'raw':!![]},{'model':db[_0xb3eb('0x27')],'as':_0xb3eb('0x28'),'attributes':['id'],'raw':!![]},{'model':db[_0xb3eb('0x29')],'as':_0xb3eb('0x2a'),'attributes':['id'],'raw':!![]}]})[_0xb3eb('0x1b')](function(_0x536f5f){if(_0x536f5f){_0x547654=_0x536f5f;_0x4b818f[_0x171915](util[_0xb3eb('0x1c')](_0xb3eb('0x1e'),_0x536f5f['name']));var _0x36be42=[];switch(_0x536f5f[_0xb3eb('0x6')]){case'admin':_0x4b818f[_0x171915](_0xb3eb('0x2b'));_0x4b818f[_0x171915](_0xb3eb('0x2c'));if(queryQueues['hasOwnProperty']('include')){delete queryQueues[_0xb3eb('0x2d')];}_0x36be42[_0xb3eb('0x2e')](db[_0xb3eb('0x2f')]['findAll'](queryQueues));_0x36be42[_0xb3eb('0x2e')](db[_0xb3eb('0x30')][_0xb3eb('0x11')](queryQueues));_0x36be42[_0xb3eb('0x2e')](db[_0xb3eb('0x31')][_0xb3eb('0x11')](queryQueues));_0x36be42[_0xb3eb('0x2e')](db[_0xb3eb('0x32')][_0xb3eb('0x11')](queryQueues));_0x36be42[_0xb3eb('0x2e')](db[_0xb3eb('0x33')][_0xb3eb('0x11')](queryQueues));_0x36be42[_0xb3eb('0x2e')](db['OpenchannelQueue'][_0xb3eb('0x11')](queryQueues));_0x36be42[_0xb3eb('0x2e')](db[_0xb3eb('0x17')]['findAll'](queryTelephones));_0x36be42[_0xb3eb('0x2e')](db[_0xb3eb('0x34')][_0xb3eb('0x11')](queryTrunks));_0x36be42[_0xb3eb('0x2e')](db[_0xb3eb('0x19')][_0xb3eb('0x11')](queryCampaigns));_0x36be42[_0xb3eb('0x2e')](db[_0xb3eb('0x17')][_0xb3eb('0x11')](queryAgents));break;case'user':_0x4b818f[_0x171915](_0xb3eb('0x2b'));_0x4b818f[_0x171915](_0xb3eb('0x2c'));_0x36be42[_0xb3eb('0x2e')](getAssociatedResources(_0xb3eb('0xb'),_0x536f5f[_0xb3eb('0x21')],_0xb3eb('0x2f')));_0x36be42[_0xb3eb('0x2e')](getAssociatedResources(_0xb3eb('0xc'),_0x536f5f[_0xb3eb('0x21')],_0xb3eb('0x30')));_0x36be42[_0xb3eb('0x2e')](getAssociatedResources(_0xb3eb('0xd'),_0x536f5f['userProfileId'],_0xb3eb('0x31')));_0x36be42[_0xb3eb('0x2e')](getAssociatedResources(_0xb3eb('0xe'),_0x536f5f['userProfileId'],'SmsQueue'));_0x36be42[_0xb3eb('0x2e')](getAssociatedResources(_0xb3eb('0xf'),_0x536f5f[_0xb3eb('0x21')],_0xb3eb('0x33')));_0x36be42[_0xb3eb('0x2e')](getAssociatedResources(_0xb3eb('0x10'),_0x536f5f[_0xb3eb('0x21')],_0xb3eb('0x35')));_0x36be42[_0xb3eb('0x2e')](getAssociatedResources(_0xb3eb('0x36'),_0x536f5f[_0xb3eb('0x21')],_0xb3eb('0x17')));_0x36be42[_0xb3eb('0x2e')](getAssociatedResources(_0xb3eb('0x12'),_0x536f5f[_0xb3eb('0x21')],_0xb3eb('0x34')));_0x36be42[_0xb3eb('0x2e')](getAssociatedResources('IvrCampaigns',_0x536f5f[_0xb3eb('0x21')],_0xb3eb('0x19')));_0x36be42[_0xb3eb('0x2e')](db[_0xb3eb('0x17')][_0xb3eb('0x11')](queryAgents));break;case _0xb3eb('0x7'):_0x4b818f[_0x171915](_0xb3eb('0x2b'));_0x4b818f[_0x171915]('voice:outbound');_0x36be42[_0xb3eb('0x2e')](_0x536f5f[_0xb3eb('0x37')]({'attributes':['id','name']}));_0x36be42[_0xb3eb('0x2e')](_0x536f5f[_0xb3eb('0x38')]({'attributes':['id',_0xb3eb('0x4')]}));_0x36be42[_0xb3eb('0x2e')](_0x536f5f['getFaxQueues']({'attributes':['id',_0xb3eb('0x4')]}));_0x36be42['push'](_0x536f5f['getSmsQueues']({'attributes':['id',_0xb3eb('0x4')]}));_0x36be42['push'](_0x536f5f[_0xb3eb('0x39')]({'attributes':['id','name']}));_0x36be42[_0xb3eb('0x2e')](_0x536f5f['getOpenchannelQueues']({'attributes':['id',_0xb3eb('0x4')]}));break;}return BPromise[_0xb3eb('0x3a')](_0x36be42);}})[_0xb3eb('0x1b')](function(_0x2ca100){if(_0x2ca100&&_0x2ca100[_0xb3eb('0x3b')]){for(var _0x2c4686=0x0;_0x2c4686<_0x2ca100['length'];_0x2c4686+=0x1){for(var _0x14c252=0x0;_0x14c252<_0x2ca100[_0x2c4686]['length'];_0x14c252+=0x1){switch(_0x2c4686){case 0x0:joinOrLeaveQueues(_0x4b818f,_0x171915,_0xb3eb('0x3c'),_0x2ca100[_0x2c4686][_0x14c252]);break;case 0x1:joinOrLeaveQueues(_0x4b818f,_0x171915,_0xb3eb('0x3d'),_0x2ca100[_0x2c4686][_0x14c252]);break;case 0x2:joinOrLeaveQueues(_0x4b818f,_0x171915,'fax',_0x2ca100[_0x2c4686][_0x14c252]);break;case 0x3:joinOrLeaveQueues(_0x4b818f,_0x171915,'sms',_0x2ca100[_0x2c4686][_0x14c252]);break;case 0x4:joinOrLeaveQueues(_0x4b818f,_0x171915,'mail',_0x2ca100[_0x2c4686][_0x14c252]);break;case 0x5:joinOrLeaveQueues(_0x4b818f,_0x171915,'openchannel',_0x2ca100[_0x2c4686][_0x14c252]);break;case 0x6:_0x4b818f[_0x171915](util[_0xb3eb('0x1c')]('telephone:%s',_0x2ca100[_0x2c4686][_0x14c252][_0xb3eb('0x4')]));break;case 0x7:_0x4b818f[_0x171915](util['format'](_0xb3eb('0x3e'),_0x2ca100[_0x2c4686][_0x14c252][_0xb3eb('0x4')]));break;case 0x8:_0x4b818f[_0x171915](util[_0xb3eb('0x1c')](_0xb3eb('0x3f'),_0x2ca100[_0x2c4686][_0x14c252]['type'],_0x2ca100[_0x2c4686][_0x14c252][_0xb3eb('0x4')]));break;case 0x9:_0x4b818f[_0x171915](util['format']('user:%s',_0x2ca100[_0x2c4686][_0x14c252]['name']));break;}}}}})[_0xb3eb('0x1b')](function(){if(_0x171915===_0xb3eb('0x40')){var _0x475e1f=_[_0xb3eb('0x16')](_0x547654[_0xb3eb('0x22')],'id');return _0x547654[_0xb3eb('0x41')](_0x475e1f)[_0xb3eb('0x1b')](function(){for(var _0x3c35e4=0x0;_0x3c35e4<_0x475e1f[_0xb3eb('0x3b')];_0x3c35e4+=0x1){_0xcbc907[_0xb3eb('0x42')](_0xb3eb('0x43'),{'ChatInteractionId':Number(_0x475e1f[_0x3c35e4]),'UserId':Number(_0x547654['id'])});}});}})['then'](function(){if(_0x171915===_0xb3eb('0x40')){var _0x36f324=_[_0xb3eb('0x16')](_0x547654[_0xb3eb('0x24')],'id');return _0x547654[_0xb3eb('0x44')](_0x36f324)['then'](function(){for(var _0x29795e=0x0;_0x29795e<_0x36f324[_0xb3eb('0x3b')];_0x29795e+=0x1){_0xcbc907[_0xb3eb('0x42')](_0xb3eb('0x45'),{'MailInteractionId':Number(_0x36f324[_0x29795e]),'UserId':Number(_0x547654['id'])});}});}})[_0xb3eb('0x1b')](function(){if(_0x171915===_0xb3eb('0x40')){var _0x98168d=_[_0xb3eb('0x16')](_0x547654['FaxInteractions'],'id');return _0x547654['removeFaxInteractions'](_0x98168d)[_0xb3eb('0x1b')](function(){for(var _0x260529=0x0;_0x260529<_0x98168d[_0xb3eb('0x3b')];_0x260529+=0x1){_0xcbc907[_0xb3eb('0x42')]('user_has_fax_interactions:remove',{'FaxInteractionId':Number(_0x98168d[_0x260529]),'UserId':Number(_0x547654['id'])});}});}})[_0xb3eb('0x1b')](function(){if(_0x171915===_0xb3eb('0x40')){var _0x49e385=_['map'](_0x547654[_0xb3eb('0x28')],'id');return _0x547654[_0xb3eb('0x46')](_0x49e385)[_0xb3eb('0x1b')](function(){for(var _0x557584=0x0;_0x557584<_0x49e385[_0xb3eb('0x3b')];_0x557584+=0x1){_0xcbc907[_0xb3eb('0x42')](_0xb3eb('0x47'),{'SmsInteractionId':Number(_0x49e385[_0x557584]),'UserId':Number(_0x547654['id'])});}});}})[_0xb3eb('0x1b')](function(){if(_0x171915==='leave'){var _0x4b62a4=_['map'](_0x547654[_0xb3eb('0x2a')],'id');return _0x547654[_0xb3eb('0x48')](_0x4b62a4)['then'](function(){for(var _0x24dd73=0x0;_0x24dd73<_0x4b62a4[_0xb3eb('0x3b')];_0x24dd73+=0x1){_0xcbc907[_0xb3eb('0x42')](_0xb3eb('0x49'),{'OpenchannelInteractionId':Number(_0x4b62a4[_0x24dd73]),'UserId':Number(_0x547654['id'])});}});}})[_0xb3eb('0x4a')](function(_0x38ea2f){_0x4b818f['log'](_0x38ea2f);});}}function onDisconnect(_0x1dff1c,_0xcea548){joinOrLeave(_0x1dff1c,_0xb3eb('0x40'),_0xcea548);}function onConnect(_0x11b498){joinOrLeave(_0x11b498,_0xb3eb('0x4b'));}exports['default']=function(_0xa526b){_0xa526b['on'](_0xb3eb('0x4c'),function(_0x29987e){_0x29987e[_0xb3eb('0x4d')](0x0);_0x29987e[_0xb3eb('0x4e')]=_0x29987e[_0xb3eb('0x4f')][_0xb3eb('0x4c')][_0xb3eb('0x50')]+':'+_0x29987e[_0xb3eb('0x4f')][_0xb3eb('0x4c')][_0xb3eb('0x51')];_0x29987e[_0xb3eb('0x52')]=new Date();_0x29987e[_0xb3eb('0x53')]=function(_0x52fadf){console[_0xb3eb('0x53')](_0xb3eb('0x54')+_0x29987e[_0xb3eb('0x55')][_0xb3eb('0x4')]+'['+_0x29987e[_0xb3eb('0x4e')]+']',_0x52fadf);};_0x29987e['on'](_0xb3eb('0x56'),function(){onDisconnect(_0x29987e,_0xa526b);_0x29987e[_0xb3eb('0x53')](_0xb3eb('0x57'));});onConnect(_0x29987e);_0x29987e[_0xb3eb('0x53')]('CONNECTED');});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index 6aaa58f..149e470 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 _0x9e46=['SmsMessage','newmessage','Fax','FaxInteraction','Mail','Openchannel','OpenchannelInteraction','EventManager','then','info','Trigger,\x20%s','error','code','catch','get','channel','UserId','find','name','format','incomingmessage','outgoingmessage','event','opened','changed','closed','User','interface','SIP/%s','default','model','hook','callback','toLowerCase','jayson/promise','../logger','triggers','client','newinteraction','Chat','ChatInteraction','afterUpdate','closedinteraction','ChatMessage','afterCreate','Sms','SmsInteraction'];(function(_0x3661ed,_0x456359){var _0x4bbde=function(_0x145f6f){while(--_0x145f6f){_0x3661ed['push'](_0x3661ed['shift']());}};_0x4bbde(++_0x456359);}(_0x9e46,0x16b));var _0x69e4=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9e46[_0x5b644e];return _0x49c6bf;};'use strict';var util=require('util');var db=require('../../mysqldb')['db'];var jayson=require(_0x69e4('0x0'));var logger=require(_0x69e4('0x1'))(_0x69e4('0x2'));var client=jayson[_0x69e4('0x3')]['http']({'port':0x232a});var triggers=[{'channel':'Chat','model':'ChatInteraction','event':'afterCreate','condition':_0x69e4('0x4'),'callback':afterCreate},{'channel':_0x69e4('0x5'),'model':_0x69e4('0x6'),'event':_0x69e4('0x7'),'condition':_0x69e4('0x8'),'callback':afterUpdate},{'channel':_0x69e4('0x5'),'model':_0x69e4('0x9'),'event':_0x69e4('0xa'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0x69e4('0xb'),'model':_0x69e4('0xc'),'event':_0x69e4('0xa'),'condition':_0x69e4('0x4'),'callback':afterCreate},{'channel':_0x69e4('0xb'),'model':_0x69e4('0xc'),'event':'afterUpdate','condition':_0x69e4('0x8'),'callback':afterUpdate},{'channel':_0x69e4('0xb'),'model':_0x69e4('0xd'),'event':_0x69e4('0xa'),'condition':_0x69e4('0xe'),'callback':afterCreateMessage},{'channel':_0x69e4('0xf'),'model':_0x69e4('0x10'),'event':_0x69e4('0xa'),'condition':_0x69e4('0x4'),'callback':afterCreate},{'channel':'Fax','model':_0x69e4('0x10'),'event':_0x69e4('0x7'),'condition':_0x69e4('0x8'),'callback':afterUpdate},{'channel':_0x69e4('0xf'),'model':'FaxMessage','event':'afterCreate','condition':'newmessage','callback':afterCreateMessage},{'channel':_0x69e4('0x11'),'model':'MailInteraction','event':_0x69e4('0xa'),'condition':_0x69e4('0x4'),'callback':afterCreate},{'channel':_0x69e4('0x11'),'model':'MailInteraction','event':'afterUpdate','condition':_0x69e4('0x8'),'callback':afterUpdate},{'channel':_0x69e4('0x11'),'model':'MailMessage','event':_0x69e4('0xa'),'condition':_0x69e4('0xe'),'callback':afterCreateMessage},{'channel':_0x69e4('0x12'),'model':_0x69e4('0x13'),'event':_0x69e4('0xa'),'condition':_0x69e4('0x4'),'callback':afterCreate},{'channel':'Openchannel','model':_0x69e4('0x13'),'event':_0x69e4('0x7'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0x69e4('0x12'),'model':'OpenchannelMessage','event':_0x69e4('0xa'),'condition':_0x69e4('0xe'),'callback':afterCreateMessage}];function request(_0x484fc6){return client['request'](_0x69e4('0x14'),_0x484fc6)[_0x69e4('0x15')](function(_0x190998){logger[_0x69e4('0x16')](_0x69e4('0x17'),_0x69e4('0x14'),_0x190998);if(_0x190998['error']){if(_0x190998[_0x69e4('0x18')][_0x69e4('0x19')]===0x1f4){logger[_0x69e4('0x18')]('Trigger,\x20%s',_0x69e4('0x14'),_0x190998[_0x69e4('0x18')]);}}})[_0x69e4('0x1a')](function(_0x466520){logger[_0x69e4('0x18')](_0x69e4('0x17'),_0x69e4('0x14'),_0x466520);});}function afterCreateMessage(_0x970a77,_0x3d8a08){return function(_0x337468,_0x25ed0d){_0x337468=_0x337468[_0x69e4('0x1b')]({'plain':!![]});_0x337468[_0x69e4('0x1c')]=_0x970a77;_0x337468['event']=_0x337468['direction'];if(_0x337468[_0x69e4('0x1d')]){return db['User'][_0x69e4('0x1e')]({'where':{'id':_0x337468[_0x69e4('0x1d')]},'attributes':['id',_0x69e4('0x1f')],'raw':!![]})[_0x69e4('0x15')](function(_0x50315a){_0x337468['interface']=util[_0x69e4('0x20')]('SIP/%s',_0x50315a[_0x69e4('0x1f')]);_0x337468['channel']=_0x970a77;return request({'event':_0x69e4('0x21'),'message':_0x337468});})[_0x69e4('0x1a')](function(_0x15e54d){console[_0x69e4('0x18')](_0x15e54d);});}else{return request({'event':_0x69e4('0x22'),'message':_0x337468});}};}function afterCreate(_0xd5d0c8,_0x254482){return function(_0x357f5e,_0x1332ab){_0x357f5e=_0x357f5e[_0x69e4('0x1b')]({'plain':!![]});_0x357f5e[_0x69e4('0x1c')]=_0xd5d0c8;_0x357f5e[_0x69e4('0x23')]=_0x69e4('0x24');return request({'event':_0x254482,'message':_0x357f5e});};}function afterUpdate(_0x4a7dfd,_0x27c6e4){return function(_0x74fd3e,_0x1066f8){if(_0x74fd3e[_0x69e4('0x25')](_0x69e4('0x26'))&&_0x74fd3e[_0x69e4('0x26')]){_0x74fd3e=_0x74fd3e[_0x69e4('0x1b')]({'plain':!![]});_0x74fd3e[_0x69e4('0x1c')]=_0x4a7dfd;_0x74fd3e['event']=_0x69e4('0x26');if(_0x74fd3e['UserId']){return db[_0x69e4('0x27')][_0x69e4('0x1e')]({'where':{'id':_0x74fd3e['UserId']},'attributes':['id','name'],'raw':!![]})[_0x69e4('0x15')](function(_0x26148e){_0x74fd3e[_0x69e4('0x28')]=util[_0x69e4('0x20')](_0x69e4('0x29'),_0x26148e[_0x69e4('0x1f')]);return request({'event':_0x27c6e4,'message':_0x74fd3e});})[_0x69e4('0x1a')](function(_0x3e01eb){console['error'](_0x3e01eb);});}else{return request({'event':_0x27c6e4,'message':_0x74fd3e});}}};}exports[_0x69e4('0x2a')]=function(){for(var _0x1885d3=0x0;_0x1885d3=_0x1cf1dc['agents']){throw Error(_0x21c9('0x14'));}_0x5e2c0b(_0xb5c3dc);})[_0x21c9('0x15')](function(_0x1846cd){_0x11e89e(_0x1846cd);});});}; \ No newline at end of file +var _0xa054=['includes','clearBlockUser','isUndefined','blockedAt','updateAttributes','agent','User','count','then','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','catch','./license/util','voice','mail','getChannels','toLowerCase'];(function(_0x4c12ec,_0x2e9103){var _0x3ae42c=function(_0x5a728f){while(--_0x5a728f){_0x4c12ec['push'](_0x4c12ec['shift']());}};_0x3ae42c(++_0x2e9103);}(_0xa054,0xaf));var _0x4a05=function(_0x421725,_0x318a04){_0x421725=_0x421725-0x0;var _0x51b322=_0xa054[_0x421725];return _0x51b322;};'use strict';var _=require('lodash');var BPromise=require('bluebird');var db=require('../mysqldb')['db'];var util=require(_0x4a05('0x0'));var channels=[_0x4a05('0x1'),_0x4a05('0x2'),'chat','fax','sms','openchannel'];exports[_0x4a05('0x3')]=function(){return channels;};exports['isValidChannel']=function(_0x590085){_0x590085=_0x590085[_0x4a05('0x4')]();return _[_0x4a05('0x5')](channels,_0x590085);};exports[_0x4a05('0x6')]=function(_0x4305b4,_0x14bc5a,_0x4d586e,_0x149886){var _0x16f0ae={'loginAttempts':_0x14bc5a,'blocked':_0x4d586e};if(!_[_0x4a05('0x7')](_0x149886)){_0x16f0ae[_0x4a05('0x8')]=_0x149886;}return _0x4305b4[_0x4a05('0x9')](_0x16f0ae);};exports['getLicense']=function(_0x16d5b6){return new BPromise(function(_0xc49d57,_0x7fa17c){var _0x179b3d=0x0;if(_0x16d5b6['role']!==_0x4a05('0xa')){_0xc49d57(_0x16d5b6);}db[_0x4a05('0xb')][_0x4a05('0xc')]({'where':{'role':_0x4a05('0xa'),'online':!![],'id':{'$ne':_0x16d5b6['id']}}})[_0x4a05('0xd')](function(_0x15c695){_0x179b3d=_0x15c695;return util[_0x4a05('0xe')]();})[_0x4a05('0xd')](function(_0x524818){if(_0x524818&&_0x524818[_0x4a05('0xf')]&&_0x179b3d>=_0x524818[_0x4a05('0xf')]){throw Error(_0x4a05('0x10'));}_0xc49d57(_0x16d5b6);})[_0x4a05('0x11')](function(_0x43140b){_0x7fa17c(_0x43140b);});});}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index 6fb49a0..af9a15a 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6730=['send','404','status','render'];(function(_0x3ea81c,_0xa2f4ca){var _0x40c111=function(_0x152538){while(--_0x152538){_0x3ea81c['push'](_0x3ea81c['shift']());}};_0x40c111(++_0xa2f4ca);}(_0x6730,0x1d9));var _0x0673=function(_0x1b95a1,_0x529852){_0x1b95a1=_0x1b95a1-0x0;var _0x57aef1=_0x6730[_0x1b95a1];return _0x57aef1;};'use strict';module['exports'][0x194]=function pageNotFound(_0x311620,_0x2e9112){var _0x548314=_0x0673('0x0');var _0x32c6d0=0x194;var _0x19eea7={'status':_0x32c6d0};_0x2e9112[_0x0673('0x1')](_0x19eea7[_0x0673('0x1')]);_0x2e9112[_0x0673('0x2')](_0x548314,{},function(_0x152dda,_0x458ccf){if(_0x152dda){return _0x2e9112[_0x0673('0x1')](_0x19eea7['status'])['json'](_0x19eea7);}_0x2e9112[_0x0673('0x3')](_0x458ccf);});}; \ No newline at end of file +var _0x56ad=['exports','status','render','send'];(function(_0x5b890b,_0x49d74d){var _0x55e30b=function(_0x378107){while(--_0x378107){_0x5b890b['push'](_0x5b890b['shift']());}};_0x55e30b(++_0x49d74d);}(_0x56ad,0x170));var _0xd56a=function(_0x4370bb,_0x458517){_0x4370bb=_0x4370bb-0x0;var _0x1d7e74=_0x56ad[_0x4370bb];return _0x1d7e74;};'use strict';module[_0xd56a('0x0')][0x194]=function pageNotFound(_0x464e5b,_0x5e02c7){var _0x547e91='404';var _0x2f2464=0x194;var _0x4f0f8b={'status':_0x2f2464};_0x5e02c7[_0xd56a('0x1')](_0x4f0f8b[_0xd56a('0x1')]);_0x5e02c7[_0xd56a('0x2')](_0x547e91,{},function(_0x32da28,_0x53796d){if(_0x32da28){return _0x5e02c7['status'](_0x4f0f8b[_0xd56a('0x1')])['json'](_0x4f0f8b);}_0x5e02c7[_0xd56a('0x3')](_0x53796d);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index 4202302..6aa91a7 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0a6d=['VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserProfileResource','hasOne','cascade','UserId','VoiceRecording','Recordings','VoiceQueuesRt','hasMany','Extensions','HopperHistory','OpenchannelInteractions','ChatInteractions','SmsInteractions','FaxInteraction','FaxInteractions','belongsTo','userProfileId','belongsToMany','chat_group_has_users','Contacts','Lists','Team','user_has_teams','MailInteractions','user_has_mail_interactions','user_has_chat_interactions','user_has_fax_interactions','user_has_sms_interactions','user_has_openchannel_interactions','VoiceQueues','MailQueue','MailQueues','ChatQueues','FaxQueues','SmsQueues','UserSmsQueue','CmList','VoicePrefixes','user_has_voice_prefixes','ChatWebsites','user_has_chat_websites','FaxAccounts','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','user_has_openchannel_accounts','user_has_square_projects','ChanSpyId','Sound','Sounds','moh_has_sounds','Members','VoiceQueueId','HopperHistories','HopperBlacks','JscriptySessions','TrunkId','TrunkBackup','TrunkBackupId','IntervalId','Pause','mandatoryDispositionPause','voice_queues_has_cm_lists','Teams','team_has_voice_queues','BlackLists','voice_queues_has_cm_blacklists','Messages','mailboxuser','mailbox','QueueCalls','AgentReports','uniqueid','Contact','ContactId','MailAccount','MailAccountId','Imap','Smtp','Disposition','Dispositions','Answers','Interactions','Applications','ListId','TemplateId','Agents','team_has_mail_queues','MailInteractionId','Account','Owner','mail_interaction_has_tags','Tags','ThroughTags','Users','Attachments','Interaction','restrict','TagId','List','Dashboard','Items','FaxAccountId','Exntensions','mandatoryDispositionPauseId','fax_interaction_has_tags','FaxInteractionId','team_has_fax_queues','SmsAccountId','user_has_sms_accounts','sms_interaction_has_tags','SmsInteractionId','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','team_has_openchannel_queues','ChatWebsiteId','OpenchannelQueueReport','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','AttachmentId','team_has_chat_queues','ChatGroupId','HopperFinals','Company','CompanyId','cm_user_has_contacts','cm_contact_has_tags','Agent','CampaignId','OwnerId','OneAll','OneAny','AutomationId','Intervals','MailApplications','ChatApplications','FaxApplications','SmsApplications','AnalyticDefaultReport','DefaultReportId','Schedule','CustomReportId','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','Actions','TriggerId','Fields','MetricId','AccountId','Subjects','SubjectId','Descriptions','DescriptionId','FieldId','Subject','Description','Field','Variable','Configurations','SugarcrmConfiguration','VariableId','DeskConfiguration','int_desk_configuration_has_tags','ZendeskField','int_zendesk_configuration_has_tags','ServicenowConfiguration','FreshsalesAccount','FromId','ToId','SessionId','ProjectId','OpenchannelQueues','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','MailTransferReport','FromMailAccountId','FromAccount','FromAgent','ToUserId','ToAgent','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','FromChatWebsiteId','FromUserId','ToChatQueueId','ToChatWebsiteId','ToFaxQueueId','ToFaxAccountId','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','FromSmsAccountId','ToSmsAccountId','CustomFields','Queues','cm_user_has_lists','UserProfileSections','Resources','sectionId','path','../config/environment','jstz','sequelize','defaultsDeep','motion2','xcall','mysql','utf8mb4','utf8_general_ci','sequelizeHistory','xC@LL1234','127.0.0.1','name','utf8','database','username','password','options','User','import','../api/user/user.model','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','VoiceExtension','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','VoiceDialReport','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailServerOut/mailServerOut.model','../api/mailAccount/mailAccount.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','FaxApplication','../api/faxApplication/faxApplication.model','FaxMessage','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','OpenchannelMessage','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','CmCustomField','../api/cmCustomField/cmCustomField.model','Action','../api/action/action.model','Automation','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','../api/disposition/disposition.model','Condition','../api/condition/condition.model','Interval','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','../api/sound/sound.model','Tag','../api/tag/tag.model','Template','../api/template/template.model','Trigger','../api/trigger/trigger.model','../api/variable/variable.model','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','VtigerAccount','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','Integration','../api/integration/integration.model','Network','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','SmsQueueReport','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','License','../api/license/license.model','Campaign','../api/campaign/campaign.model','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','../api/cmList/cmList.model'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x0a6d,0xdb));var _0xd0a6=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x0a6d[_0x4b055c];return _0x4b62bb;};'use strict';var path=require(_0xd0a6('0x0'));var config=require(_0xd0a6('0x1'));var Sequelize=require('sequelize');var _=require('lodash');var jstz=require(_0xd0a6('0x2'));var timezone=jstz['determine']();config[_0xd0a6('0x3')]=_[_0xd0a6('0x4')](config['sequelize'],{'database':_0xd0a6('0x5'),'username':_0xd0a6('0x6'),'password':'xC@LL1234','options':{'host':'127.0.0.1','port':0xcea,'dialect':_0xd0a6('0x7'),'dialectOptions':{'charset':_0xd0a6('0x8')},'logging':![],'timezone':timezone['name'](),'define':{'charset':'utf8','collate':_0xd0a6('0x9')}}});config[_0xd0a6('0xa')]=_[_0xd0a6('0x4')](config['sequelizeHistory'],{'database':'motion2','username':'xcall','password':_0xd0a6('0xb'),'options':{'host':_0xd0a6('0xc'),'port':0xcea,'dialect':_0xd0a6('0x7'),'dialectOptions':{'charset':_0xd0a6('0x8')},'logging':![],'timezone':timezone[_0xd0a6('0xd')](),'define':{'charset':_0xd0a6('0xe'),'collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xd0a6('0x3')][_0xd0a6('0xf')],config['sequelize'][_0xd0a6('0x10')],config[_0xd0a6('0x3')][_0xd0a6('0x11')],config['sequelize'][_0xd0a6('0x12')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xd0a6('0xa')][_0xd0a6('0xf')],config['sequelizeHistory'][_0xd0a6('0x10')],config[_0xd0a6('0xa')][_0xd0a6('0x11')],config[_0xd0a6('0xa')][_0xd0a6('0x12')])};db[_0xd0a6('0x13')]=db[_0xd0a6('0x3')][_0xd0a6('0x14')](_0xd0a6('0x15'));db[_0xd0a6('0x16')]=db[_0xd0a6('0x3')][_0xd0a6('0x14')](_0xd0a6('0x17'));db[_0xd0a6('0x18')]=db[_0xd0a6('0x3')]['import'](_0xd0a6('0x19'));db[_0xd0a6('0x1a')]=db[_0xd0a6('0x3')][_0xd0a6('0x14')]('../api/voiceExtension/voiceExtension.model');db[_0xd0a6('0x1b')]=db[_0xd0a6('0x3')][_0xd0a6('0x14')](_0xd0a6('0x1c'));db[_0xd0a6('0x1d')]=db['sequelize'][_0xd0a6('0x14')](_0xd0a6('0x1e'));db['VoiceRecording']=db[_0xd0a6('0x3')][_0xd0a6('0x14')](_0xd0a6('0x1f'));db[_0xd0a6('0x20')]=db['sequelize'][_0xd0a6('0x14')](_0xd0a6('0x21'));db[_0xd0a6('0x22')]=db['sequelize']['import'](_0xd0a6('0x23'));db[_0xd0a6('0x24')]=db['sequelize'][_0xd0a6('0x14')](_0xd0a6('0x25'));db[_0xd0a6('0x26')]=db[_0xd0a6('0x3')]['import']('../api/voiceCallReport/voiceCallReport.model');db[_0xd0a6('0x27')]=db[_0xd0a6('0x3')][_0xd0a6('0x14')]('../api/voiceDialReport/voiceDialReport.model');db[_0xd0a6('0x28')]=db[_0xd0a6('0x3')][_0xd0a6('0x14')](_0xd0a6('0x29'));db[_0xd0a6('0x2a')]=db['sequelize'][_0xd0a6('0x14')](_0xd0a6('0x2b'));db['MemberReport']=db[_0xd0a6('0x3')][_0xd0a6('0x14')](_0xd0a6('0x2c'));db[_0xd0a6('0x2d')]=db['sequelize'][_0xd0a6('0x14')](_0xd0a6('0x2e'));db['VoiceTransferReport']=db[_0xd0a6('0x3')][_0xd0a6('0x14')](_0xd0a6('0x2f'));db[_0xd0a6('0x30')]=db[_0xd0a6('0x3')][_0xd0a6('0x14')]('../api/userVoiceQueueRt/userVoiceQueueRt.model');db[_0xd0a6('0x31')]=db[_0xd0a6('0x3')]['import'](_0xd0a6('0x32'));db[_0xd0a6('0x33')]=db[_0xd0a6('0x3')][_0xd0a6('0x14')](_0xd0a6('0x34'));db[_0xd0a6('0x35')]=db[_0xd0a6('0x3')]['import'](_0xd0a6('0x36'));db[_0xd0a6('0x37')]=db['sequelize']['import'](_0xd0a6('0x38'));db['UserSmsQueue']=db[_0xd0a6('0x3')][_0xd0a6('0x14')](_0xd0a6('0x39'));db[_0xd0a6('0x3a')]=db['sequelize']['import'](_0xd0a6('0x3b'));db[_0xd0a6('0x3c')]=db[_0xd0a6('0x3')][_0xd0a6('0x14')](_0xd0a6('0x3d'));db[_0xd0a6('0x3e')]=db[_0xd0a6('0x3')][_0xd0a6('0x14')](_0xd0a6('0x3f'));db['MailAccount']=db[_0xd0a6('0x3')][_0xd0a6('0x14')](_0xd0a6('0x40'));db['MailQueue']=db[_0xd0a6('0x3')][_0xd0a6('0x14')]('../api/mailQueue/mailQueue.model');db[_0xd0a6('0x41')]=db[_0xd0a6('0x3')][_0xd0a6('0x14')](_0xd0a6('0x42'));db[_0xd0a6('0x43')]=db[_0xd0a6('0x3')]['import'](_0xd0a6('0x44'));db[_0xd0a6('0x45')]=db[_0xd0a6('0x3')][_0xd0a6('0x14')](_0xd0a6('0x46'));db[_0xd0a6('0x47')]=db[_0xd0a6('0x3')][_0xd0a6('0x14')](_0xd0a6('0x48'));db[_0xd0a6('0x49')]=db['sequelize'][_0xd0a6('0x14')](_0xd0a6('0x4a'));db['Dashboard']=db[_0xd0a6('0x3')]['import'](_0xd0a6('0x4b'));db[_0xd0a6('0x4c')]=db['sequelize'][_0xd0a6('0x14')](_0xd0a6('0x4d'));db[_0xd0a6('0x4e')]=db[_0xd0a6('0x3')][_0xd0a6('0x14')]('../api/faxAccount/faxAccount.model');db[_0xd0a6('0x4f')]=db[_0xd0a6('0x3')][_0xd0a6('0x14')](_0xd0a6('0x50'));db['FaxInteraction']=db[_0xd0a6('0x3')]['import']('../api/faxInteraction/faxInteraction.model');db[_0xd0a6('0x51')]=db['sequelize']['import']('../api/faxMessage/faxMessage.model');db[_0xd0a6('0x52')]=db[_0xd0a6('0x3')][_0xd0a6('0x14')](_0xd0a6('0x53'));db[_0xd0a6('0x54')]=db[_0xd0a6('0x3')][_0xd0a6('0x14')](_0xd0a6('0x55'));db[_0xd0a6('0x56')]=db[_0xd0a6('0x3')][_0xd0a6('0x14')](_0xd0a6('0x57'));db[_0xd0a6('0x58')]=db[_0xd0a6('0x3')][_0xd0a6('0x14')](_0xd0a6('0x59'));db[_0xd0a6('0x5a')]=db['sequelize']['import'](_0xd0a6('0x5b'));db[_0xd0a6('0x5c')]=db[_0xd0a6('0x3')][_0xd0a6('0x14')](_0xd0a6('0x5d'));db[_0xd0a6('0x5e')]=db[_0xd0a6('0x3')][_0xd0a6('0x14')](_0xd0a6('0x5f'));db[_0xd0a6('0x60')]=db['sequelize']['import'](_0xd0a6('0x61'));db[_0xd0a6('0x62')]=db[_0xd0a6('0x3')][_0xd0a6('0x14')](_0xd0a6('0x63'));db[_0xd0a6('0x64')]=db[_0xd0a6('0x3')][_0xd0a6('0x14')]('../api/openchannelInteraction/openchannelInteraction.model');db[_0xd0a6('0x65')]=db[_0xd0a6('0x3')][_0xd0a6('0x14')]('../api/openchannelMessage/openchannelMessage.model');db[_0xd0a6('0x66')]=db[_0xd0a6('0x3')][_0xd0a6('0x14')](_0xd0a6('0x67'));db[_0xd0a6('0x68')]=db[_0xd0a6('0x3')][_0xd0a6('0x14')](_0xd0a6('0x69'));db['OpenchannelQueueReport']=db[_0xd0a6('0x3')][_0xd0a6('0x14')](_0xd0a6('0x6a'));db[_0xd0a6('0x6b')]=db[_0xd0a6('0x3')]['import']('../api/chatApplication/chatApplication.model');db[_0xd0a6('0x6c')]=db[_0xd0a6('0x3')][_0xd0a6('0x14')](_0xd0a6('0x6d'));db[_0xd0a6('0x6e')]=db[_0xd0a6('0x3')][_0xd0a6('0x14')](_0xd0a6('0x6f'));db[_0xd0a6('0x70')]=db[_0xd0a6('0x3')][_0xd0a6('0x14')]('../api/chatOfflineMessage/chatOfflineMessage.model');db[_0xd0a6('0x71')]=db['sequelize'][_0xd0a6('0x14')](_0xd0a6('0x72'));db[_0xd0a6('0x73')]=db[_0xd0a6('0x3')][_0xd0a6('0x14')](_0xd0a6('0x74'));db[_0xd0a6('0x75')]=db['sequelize']['import'](_0xd0a6('0x76'));db[_0xd0a6('0x77')]=db[_0xd0a6('0x3')]['import'](_0xd0a6('0x78'));db[_0xd0a6('0x79')]=db[_0xd0a6('0x3')][_0xd0a6('0x14')](_0xd0a6('0x7a'));db[_0xd0a6('0x7b')]=db[_0xd0a6('0x3')][_0xd0a6('0x14')](_0xd0a6('0x7c'));db[_0xd0a6('0x7d')]=db[_0xd0a6('0x3')][_0xd0a6('0x14')](_0xd0a6('0x7e'));db[_0xd0a6('0x7f')]=db[_0xd0a6('0x3')][_0xd0a6('0x14')](_0xd0a6('0x80'));db[_0xd0a6('0x81')]=db[_0xd0a6('0x3')][_0xd0a6('0x14')](_0xd0a6('0x82'));db[_0xd0a6('0x83')]=db[_0xd0a6('0x3')][_0xd0a6('0x14')]('../api/reportAgentPreview/reportAgentPreview.model');db[_0xd0a6('0x84')]=db[_0xd0a6('0x3')][_0xd0a6('0x14')](_0xd0a6('0x85'));db[_0xd0a6('0x86')]=db['sequelize'][_0xd0a6('0x14')](_0xd0a6('0x87'));db[_0xd0a6('0x88')]=db['sequelize'][_0xd0a6('0x14')](_0xd0a6('0x89'));db[_0xd0a6('0x8a')]=db[_0xd0a6('0x3')][_0xd0a6('0x14')](_0xd0a6('0x8b'));db['Disposition']=db['sequelize'][_0xd0a6('0x14')](_0xd0a6('0x8c'));db[_0xd0a6('0x8d')]=db[_0xd0a6('0x3')][_0xd0a6('0x14')](_0xd0a6('0x8e'));db[_0xd0a6('0x8f')]=db[_0xd0a6('0x3')][_0xd0a6('0x14')]('../api/interval/interval.model');db['Pause']=db['sequelize'][_0xd0a6('0x14')](_0xd0a6('0x90'));db[_0xd0a6('0x91')]=db[_0xd0a6('0x3')]['import'](_0xd0a6('0x92'));db[_0xd0a6('0x93')]=db[_0xd0a6('0x3')][_0xd0a6('0x14')](_0xd0a6('0x94'));db['Schedule']=db['sequelize'][_0xd0a6('0x14')]('../api/schedule/schedule.model');db['Sound']=db[_0xd0a6('0x3')][_0xd0a6('0x14')](_0xd0a6('0x95'));db[_0xd0a6('0x96')]=db['sequelize'][_0xd0a6('0x14')](_0xd0a6('0x97'));db[_0xd0a6('0x98')]=db[_0xd0a6('0x3')][_0xd0a6('0x14')](_0xd0a6('0x99'));db[_0xd0a6('0x9a')]=db['sequelize'][_0xd0a6('0x14')](_0xd0a6('0x9b'));db['Variable']=db[_0xd0a6('0x3')][_0xd0a6('0x14')](_0xd0a6('0x9c'));db['Integration']=db[_0xd0a6('0x3')][_0xd0a6('0x14')]('../api/integration/integration.model');db[_0xd0a6('0x9d')]=db[_0xd0a6('0x3')][_0xd0a6('0x14')](_0xd0a6('0x9e'));db[_0xd0a6('0x9f')]=db[_0xd0a6('0x3')][_0xd0a6('0x14')]('../api/analyticCustomReport/analyticCustomReport.model');db['AnalyticDefaultReport']=db['sequelize']['import'](_0xd0a6('0xa0'));db[_0xd0a6('0xa1')]=db['sequelize'][_0xd0a6('0x14')]('../api/analyticExtractedReport/analyticExtractedReport.model');db[_0xd0a6('0xa2')]=db[_0xd0a6('0x3')]['import'](_0xd0a6('0xa3'));db[_0xd0a6('0xa4')]=db[_0xd0a6('0x3')][_0xd0a6('0x14')](_0xd0a6('0xa5'));db[_0xd0a6('0xa6')]=db[_0xd0a6('0x3')][_0xd0a6('0x14')]('../api/analyticTreeReport/analyticTreeReport.model');db[_0xd0a6('0xa7')]=db['sequelize']['import'](_0xd0a6('0xa8'));db[_0xd0a6('0xa9')]=db['sequelize'][_0xd0a6('0x14')](_0xd0a6('0xaa'));db[_0xd0a6('0xab')]=db[_0xd0a6('0x3')][_0xd0a6('0x14')](_0xd0a6('0xac'));db[_0xd0a6('0xad')]=db[_0xd0a6('0x3')][_0xd0a6('0x14')](_0xd0a6('0xae'));db['SugarcrmConfiguration']=db[_0xd0a6('0x3')][_0xd0a6('0x14')](_0xd0a6('0xaf'));db[_0xd0a6('0xb0')]=db[_0xd0a6('0x3')][_0xd0a6('0x14')](_0xd0a6('0xb1'));db[_0xd0a6('0xb2')]=db[_0xd0a6('0x3')][_0xd0a6('0x14')](_0xd0a6('0xb3'));db['DeskConfiguration']=db[_0xd0a6('0x3')][_0xd0a6('0x14')](_0xd0a6('0xb4'));db[_0xd0a6('0xb5')]=db[_0xd0a6('0x3')][_0xd0a6('0x14')](_0xd0a6('0xb6'));db[_0xd0a6('0xb7')]=db[_0xd0a6('0x3')][_0xd0a6('0x14')](_0xd0a6('0xb8'));db[_0xd0a6('0xb9')]=db[_0xd0a6('0x3')]['import']('../api/intZohoConfiguration/intZohoConfiguration.model');db[_0xd0a6('0xba')]=db[_0xd0a6('0x3')][_0xd0a6('0x14')](_0xd0a6('0xbb'));db[_0xd0a6('0xbc')]=db[_0xd0a6('0x3')][_0xd0a6('0x14')](_0xd0a6('0xbd'));db[_0xd0a6('0xbe')]=db[_0xd0a6('0x3')]['import']('../api/intZendeskConfiguration/intZendeskConfiguration.model');db['ZendeskField']=db[_0xd0a6('0x3')][_0xd0a6('0x14')]('../api/intZendeskField/intZendeskField.model');db[_0xd0a6('0xbf')]=db['sequelize'][_0xd0a6('0x14')](_0xd0a6('0xc0'));db[_0xd0a6('0xc1')]=db[_0xd0a6('0x3')]['import'](_0xd0a6('0xc2'));db[_0xd0a6('0xc3')]=db[_0xd0a6('0x3')][_0xd0a6('0x14')]('../api/intFreshdeskField/intFreshdeskField.model');db[_0xd0a6('0xc4')]=db[_0xd0a6('0x3')][_0xd0a6('0x14')]('../api/intVtigerAccount/intVtigerAccount.model');db[_0xd0a6('0xc5')]=db[_0xd0a6('0x3')][_0xd0a6('0x14')](_0xd0a6('0xc6'));db[_0xd0a6('0xc7')]=db['sequelize'][_0xd0a6('0x14')](_0xd0a6('0xc8'));db[_0xd0a6('0xc9')]=db[_0xd0a6('0x3')][_0xd0a6('0x14')](_0xd0a6('0xca'));db['ServicenowConfiguration']=db[_0xd0a6('0x3')][_0xd0a6('0x14')](_0xd0a6('0xcb'));db[_0xd0a6('0xcc')]=db[_0xd0a6('0x3')][_0xd0a6('0x14')](_0xd0a6('0xcd'));db[_0xd0a6('0xce')]=db[_0xd0a6('0x3')][_0xd0a6('0x14')]('../api/intDynamics365Account/intDynamics365Account.model');db[_0xd0a6('0xcf')]=db['sequelize'][_0xd0a6('0x14')](_0xd0a6('0xd0'));db[_0xd0a6('0xd1')]=db[_0xd0a6('0x3')]['import']('../api/intDynamics365Field/intDynamics365Field.model');db['FreshsalesAccount']=db[_0xd0a6('0x3')][_0xd0a6('0x14')](_0xd0a6('0xd2'));db[_0xd0a6('0xd3')]=db[_0xd0a6('0x3')][_0xd0a6('0x14')](_0xd0a6('0xd4'));db[_0xd0a6('0xd5')]=db[_0xd0a6('0x3')][_0xd0a6('0x14')]('../api/intFreshsalesField/intFreshsalesField.model');db[_0xd0a6('0xd6')]=db[_0xd0a6('0x3')][_0xd0a6('0x14')](_0xd0a6('0xd7'));db[_0xd0a6('0xd8')]=db['sequelize'][_0xd0a6('0x14')]('../api/network/network.model');db[_0xd0a6('0xd9')]=db[_0xd0a6('0x3')]['import'](_0xd0a6('0xda'));db[_0xd0a6('0xdb')]=db[_0xd0a6('0x3')][_0xd0a6('0x14')]('../api/chatInternalMessage/chatInternalMessage.model');db[_0xd0a6('0xdc')]=db[_0xd0a6('0x3')][_0xd0a6('0x14')](_0xd0a6('0xdd'));db[_0xd0a6('0xde')]=db['sequelize'][_0xd0a6('0x14')](_0xd0a6('0xdf'));db[_0xd0a6('0xe0')]=db[_0xd0a6('0x3')][_0xd0a6('0x14')]('../api/jscriptySessionReport/jscriptySessionReport.model');db[_0xd0a6('0xe1')]=db[_0xd0a6('0x3')][_0xd0a6('0x14')]('../api/smsQueueReport/smsQueueReport.model');db[_0xd0a6('0xe2')]=db[_0xd0a6('0x3')][_0xd0a6('0x14')](_0xd0a6('0xe3'));db[_0xd0a6('0xe4')]=db[_0xd0a6('0x3')][_0xd0a6('0x14')](_0xd0a6('0xe5'));db[_0xd0a6('0xe6')]=db['sequelize']['import'](_0xd0a6('0xe7'));db['Setting']=db['sequelize'][_0xd0a6('0x14')](_0xd0a6('0xe8'));db[_0xd0a6('0xe9')]=db[_0xd0a6('0x3')][_0xd0a6('0x14')](_0xd0a6('0xea'));db[_0xd0a6('0xeb')]=db[_0xd0a6('0x3')][_0xd0a6('0x14')](_0xd0a6('0xec'));db[_0xd0a6('0xed')]=db[_0xd0a6('0x3')][_0xd0a6('0x14')](_0xd0a6('0xee'));db[_0xd0a6('0xef')]=db[_0xd0a6('0x3')][_0xd0a6('0x14')]('../api/squareMessage/squareMessage.model');db['Team']=db[_0xd0a6('0x3')][_0xd0a6('0x14')]('../api/team/team.model');db[_0xd0a6('0xf0')]=db['sequelize'][_0xd0a6('0x14')](_0xd0a6('0xf1'));db[_0xd0a6('0xf2')]=db['sequelize'][_0xd0a6('0x14')](_0xd0a6('0xf3'));db['Migration']=db[_0xd0a6('0x3')][_0xd0a6('0x14')](_0xd0a6('0xf4'));db[_0xd0a6('0xf5')]=db['sequelize'][_0xd0a6('0x14')](_0xd0a6('0xf6'));db['Plugin']=db[_0xd0a6('0x3')][_0xd0a6('0x14')]('../api/plugin/plugin.model');db['MailTransferReport']=db[_0xd0a6('0x3')][_0xd0a6('0x14')](_0xd0a6('0xf7'));db[_0xd0a6('0xf8')]=db[_0xd0a6('0x3')]['import']('../api/chatTransferReport/chatTransferReport.model');db[_0xd0a6('0xf9')]=db['sequelize']['import'](_0xd0a6('0xfa'));db[_0xd0a6('0xfb')]=db[_0xd0a6('0x3')][_0xd0a6('0x14')](_0xd0a6('0xfc'));db[_0xd0a6('0xfd')]=db['sequelize'][_0xd0a6('0x14')](_0xd0a6('0xfe'));db['CmList']=db['sequelize'][_0xd0a6('0x14')](_0xd0a6('0xff'));db[_0xd0a6('0x100')]=db[_0xd0a6('0x3')][_0xd0a6('0x14')](_0xd0a6('0x101'));db[_0xd0a6('0x102')]=db['sequelize'][_0xd0a6('0x14')](_0xd0a6('0x103'));db[_0xd0a6('0x104')]=db[_0xd0a6('0x3')]['import'](_0xd0a6('0x105'));db[_0xd0a6('0x106')]=db['sequelize'][_0xd0a6('0x14')]('../api/userProfileResource/userProfileResource.model');db[_0xd0a6('0x13')][_0xd0a6('0x107')](db[_0xd0a6('0x22')],{'as':'VoiceMail','onDelete':_0xd0a6('0x108'),'foreignKey':_0xd0a6('0x109')});db[_0xd0a6('0x13')]['hasMany'](db[_0xd0a6('0x10a')],{'as':_0xd0a6('0x10b'),'foreignKey':'UserId'});db[_0xd0a6('0x13')]['hasMany'](db[_0xd0a6('0x30')],{'as':_0xd0a6('0x10c'),'foreignKey':_0xd0a6('0x109')});db['User'][_0xd0a6('0x10d')](db[_0xd0a6('0x1a')],{'as':_0xd0a6('0x10e'),'onDelete':'cascade','hooks':!![]});db[_0xd0a6('0x13')][_0xd0a6('0x10d')](db['CmHopperFinal'],{'as':'HopperFinals','foreignKey':'UserId'});db[_0xd0a6('0x13')][_0xd0a6('0x10d')](db[_0xd0a6('0x81')],{'as':_0xd0a6('0x10f'),'foreignKey':'UserId'});db[_0xd0a6('0x13')][_0xd0a6('0x10d')](db[_0xd0a6('0x83')],{'as':_0xd0a6('0x83'),'foreignKey':_0xd0a6('0x109')});db[_0xd0a6('0x13')]['hasMany'](db['OpenchannelInteraction'],{'as':_0xd0a6('0x110'),'foreignKey':'UserId'});db['User'][_0xd0a6('0x10d')](db['ChatInteraction'],{'as':_0xd0a6('0x111'),'foreignKey':_0xd0a6('0x109')});db[_0xd0a6('0x13')]['hasMany'](db['SmsInteraction'],{'as':_0xd0a6('0x112'),'foreignKey':_0xd0a6('0x109')});db[_0xd0a6('0x13')]['hasMany'](db[_0xd0a6('0x113')],{'as':_0xd0a6('0x114'),'foreignKey':'UserId'});db['User'][_0xd0a6('0x10d')](db['MailInteraction'],{'as':'MailInteractions','foreignKey':_0xd0a6('0x109')});db['User'][_0xd0a6('0x115')](db[_0xd0a6('0x102')],{'as':_0xd0a6('0x102'),'foreignKey':_0xd0a6('0x116')});db[_0xd0a6('0x13')][_0xd0a6('0x117')](db[_0xd0a6('0x73')],{'as':'Groups','through':_0xd0a6('0x118')});db['User'][_0xd0a6('0x117')](db['CmContact'],{'as':_0xd0a6('0x119'),'through':'cm_user_has_contacts'});db['User']['belongsToMany'](db['CmList'],{'as':_0xd0a6('0x11a'),'through':'cm_user_has_lists'});db['User'][_0xd0a6('0x117')](db[_0xd0a6('0x11b')],{'through':_0xd0a6('0x11c')});db[_0xd0a6('0x13')][_0xd0a6('0x117')](db[_0xd0a6('0x43')],{'as':_0xd0a6('0x11d'),'through':_0xd0a6('0x11e')});db['User']['belongsToMany'](db[_0xd0a6('0x6c')],{'as':_0xd0a6('0x111'),'through':_0xd0a6('0x11f')});db['User']['belongsToMany'](db['FaxInteraction'],{'as':_0xd0a6('0x114'),'through':_0xd0a6('0x120')});db[_0xd0a6('0x13')][_0xd0a6('0x117')](db['SmsInteraction'],{'as':_0xd0a6('0x112'),'through':_0xd0a6('0x121')});db[_0xd0a6('0x13')][_0xd0a6('0x117')](db['OpenchannelInteraction'],{'as':_0xd0a6('0x110'),'through':_0xd0a6('0x122')});db[_0xd0a6('0x13')][_0xd0a6('0x117')](db[_0xd0a6('0x1d')],{'as':_0xd0a6('0x123'),'through':_0xd0a6('0x31'),'required':![]});db[_0xd0a6('0x13')][_0xd0a6('0x117')](db[_0xd0a6('0x124')],{'as':_0xd0a6('0x125'),'through':_0xd0a6('0x35'),'required':![]});db[_0xd0a6('0x13')][_0xd0a6('0x117')](db[_0xd0a6('0x71')],{'as':_0xd0a6('0x126'),'through':_0xd0a6('0x33'),'required':![],'hooks':!![]});db[_0xd0a6('0x13')]['belongsToMany'](db[_0xd0a6('0x52')],{'as':_0xd0a6('0x127'),'through':_0xd0a6('0x37'),'required':![]});db[_0xd0a6('0x13')]['belongsToMany'](db['SmsQueue'],{'as':_0xd0a6('0x128'),'through':_0xd0a6('0x129'),'required':![]});db['User'][_0xd0a6('0x117')](db[_0xd0a6('0x66')],{'as':'OpenchannelQueues','through':_0xd0a6('0x3a'),'required':![]});db['User']['belongsToMany'](db[_0xd0a6('0x12a')],{'through':'cm_user_has_lists'});db['User'][_0xd0a6('0x117')](db[_0xd0a6('0x100')],{'as':_0xd0a6('0x12b'),'through':_0xd0a6('0x12c'),'required':![]});db[_0xd0a6('0x13')][_0xd0a6('0x117')](db[_0xd0a6('0x68')],{'as':_0xd0a6('0x12d'),'through':_0xd0a6('0x12e')});db['User'][_0xd0a6('0x117')](db[_0xd0a6('0x4e')],{'as':_0xd0a6('0x12f'),'through':_0xd0a6('0x130')});db[_0xd0a6('0x13')][_0xd0a6('0x117')](db['MailAccount'],{'as':_0xd0a6('0x131'),'through':_0xd0a6('0x132')});db['User'][_0xd0a6('0x117')](db[_0xd0a6('0x60')],{'as':'OpenchannelAccounts','through':_0xd0a6('0x133')});db[_0xd0a6('0x13')]['belongsToMany'](db[_0xd0a6('0x56')],{'as':'SmsAccounts','through':'user_has_sms_accounts'});db[_0xd0a6('0x13')]['belongsToMany'](db['SquareProject'],{'as':'SquareProjects','through':_0xd0a6('0x134')});db['VoiceChanSpy']['hasMany'](db['VoiceExtension'],{'as':'SpiedAgents','onDelete':_0xd0a6('0x108'),'foreignKey':_0xd0a6('0x135')});db[_0xd0a6('0x18')]['hasMany'](db[_0xd0a6('0x1a')],{'onDelete':_0xd0a6('0x108')});db[_0xd0a6('0x1a')][_0xd0a6('0x10d')](db[_0xd0a6('0x1a')],{'as':'Applications','onDelete':_0xd0a6('0x108')});db[_0xd0a6('0x1b')][_0xd0a6('0x117')](db[_0xd0a6('0x136')],{'as':_0xd0a6('0x137'),'through':_0xd0a6('0x138')});db[_0xd0a6('0x1d')][_0xd0a6('0x10d')](db[_0xd0a6('0x30')],{'as':_0xd0a6('0x139'),'foreignKey':_0xd0a6('0x13a')});db['VoiceQueue']['hasMany'](db[_0xd0a6('0x7b')],{'as':'Hoppers','foreignKey':_0xd0a6('0x13a')});db[_0xd0a6('0x1d')][_0xd0a6('0x10d')](db[_0xd0a6('0x7f')],{'as':'HopperFinals','foreignKey':_0xd0a6('0x13a')});db['VoiceQueue'][_0xd0a6('0x10d')](db[_0xd0a6('0x81')],{'as':_0xd0a6('0x13b'),'foreignKey':_0xd0a6('0x13a')});db['VoiceQueue'][_0xd0a6('0x10d')](db[_0xd0a6('0x83')],{'as':_0xd0a6('0x83'),'foreignKey':_0xd0a6('0x13a')});db[_0xd0a6('0x1d')][_0xd0a6('0x10d')](db[_0xd0a6('0x7d')],{'as':_0xd0a6('0x13c'),'foreignKey':_0xd0a6('0x13a')});db[_0xd0a6('0x1d')][_0xd0a6('0x10d')](db[_0xd0a6('0xe0')],{'as':_0xd0a6('0x13d'),'foreignKey':_0xd0a6('0x13a')});db[_0xd0a6('0x1d')]['belongsTo'](db[_0xd0a6('0x2d')],{'as':_0xd0a6('0x2d'),'foreignKey':_0xd0a6('0x13e')});db['VoiceQueue'][_0xd0a6('0x115')](db[_0xd0a6('0x2d')],{'as':_0xd0a6('0x13f'),'foreignKey':_0xd0a6('0x140')});db[_0xd0a6('0x1d')][_0xd0a6('0x115')](db['Interval'],{'as':_0xd0a6('0x8f'),'foreignKey':_0xd0a6('0x141')});db[_0xd0a6('0x1d')][_0xd0a6('0x115')](db[_0xd0a6('0x142')],{'as':_0xd0a6('0x143'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xd0a6('0x1d')][_0xd0a6('0x117')](db[_0xd0a6('0x12a')],{'as':'Lists','through':_0xd0a6('0x144')});db['VoiceQueue']['belongsToMany'](db[_0xd0a6('0x13')],{'as':'Agents','through':'UserVoiceQueue'});db['VoiceQueue'][_0xd0a6('0x117')](db[_0xd0a6('0x11b')],{'as':_0xd0a6('0x145'),'through':_0xd0a6('0x146')});db[_0xd0a6('0x1d')][_0xd0a6('0x117')](db['CmList'],{'as':_0xd0a6('0x147'),'through':_0xd0a6('0x148')});db['VoiceRecording']['belongsTo'](db[_0xd0a6('0x13')],{'as':_0xd0a6('0x13'),'foreignKey':_0xd0a6('0x109')});db[_0xd0a6('0x20')]['belongsTo'](db[_0xd0a6('0x13')],{'as':'User','foreignKey':_0xd0a6('0x109')});db[_0xd0a6('0x22')]['hasMany'](db['VoiceMailMessage'],{'as':_0xd0a6('0x149'),'onDelete':_0xd0a6('0x108'),'foreignKey':_0xd0a6('0x14a'),'sourceKey':_0xd0a6('0x14b')});db[_0xd0a6('0x24')][_0xd0a6('0x115')](db['VoiceMail'],{'foreignKey':_0xd0a6('0x14a'),'targetKey':_0xd0a6('0x14b')});db[_0xd0a6('0x26')][_0xd0a6('0x10d')](db['VoiceQueueReport'],{'as':_0xd0a6('0x14c'),'foreignKey':'uniqueid','constraints':![]});db['VoiceCallReport'][_0xd0a6('0x10d')](db['VoiceAgentReport'],{'as':_0xd0a6('0x14d'),'foreignKey':_0xd0a6('0x14e'),'constraints':![]});db[_0xd0a6('0x26')][_0xd0a6('0x115')](db[_0xd0a6('0x13')],{'as':_0xd0a6('0x13'),'foreignKey':'UserId'});db['VoiceCallReport'][_0xd0a6('0x115')](db[_0xd0a6('0x79')],{'as':_0xd0a6('0x14f'),'foreignKey':_0xd0a6('0x150')});db[_0xd0a6('0x3c')][_0xd0a6('0x115')](db[_0xd0a6('0x151')],{'as':_0xd0a6('0x151'),'foreignKey':_0xd0a6('0x152')});db['MailServerOut'][_0xd0a6('0x115')](db[_0xd0a6('0x151')],{'as':_0xd0a6('0x151'),'foreignKey':_0xd0a6('0x152')});db['MailAccount'][_0xd0a6('0x107')](db[_0xd0a6('0x3c')],{'as':_0xd0a6('0x153'),'onDelete':_0xd0a6('0x108')});db[_0xd0a6('0x151')][_0xd0a6('0x107')](db[_0xd0a6('0x3e')],{'as':_0xd0a6('0x154'),'onDelete':_0xd0a6('0x108')});db['MailAccount']['hasMany'](db[_0xd0a6('0x155')],{'as':_0xd0a6('0x156'),'foreignKey':_0xd0a6('0x152')});db['MailAccount'][_0xd0a6('0x10d')](db[_0xd0a6('0x8a')],{'as':_0xd0a6('0x157'),'foreignKey':_0xd0a6('0x152')});db[_0xd0a6('0x151')][_0xd0a6('0x10d')](db['MailMessage'],{'as':'Messages','foreignKey':_0xd0a6('0x152')});db[_0xd0a6('0x151')][_0xd0a6('0x10d')](db[_0xd0a6('0x43')],{'as':_0xd0a6('0x158')});db[_0xd0a6('0x151')]['hasMany'](db[_0xd0a6('0x47')],{'as':_0xd0a6('0x159')});db[_0xd0a6('0x151')]['belongsTo'](db[_0xd0a6('0x12a')],{'as':'List','foreignKey':_0xd0a6('0x15a')});db[_0xd0a6('0x151')][_0xd0a6('0x115')](db[_0xd0a6('0x98')],{'as':_0xd0a6('0x98'),'foreignKey':_0xd0a6('0x15b')});db[_0xd0a6('0x151')][_0xd0a6('0x115')](db['Pause'],{'as':_0xd0a6('0x143'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xd0a6('0x151')][_0xd0a6('0x117')](db[_0xd0a6('0x13')],{'as':'Agents','through':'user_has_mail_accounts'});db['MailQueue'][_0xd0a6('0x117')](db[_0xd0a6('0x13')],{'as':_0xd0a6('0x15c'),'through':_0xd0a6('0x35')});db[_0xd0a6('0x124')]['belongsToMany'](db[_0xd0a6('0x11b')],{'through':_0xd0a6('0x15d'),'as':'Teams'});db['MailInteraction'][_0xd0a6('0x10d')](db[_0xd0a6('0x45')],{'as':_0xd0a6('0x149'),'onDelete':_0xd0a6('0x108'),'foreignKey':_0xd0a6('0x15e')});db[_0xd0a6('0x43')]['belongsTo'](db[_0xd0a6('0x151')],{'as':_0xd0a6('0x15f'),'foreignKey':_0xd0a6('0x152')});db[_0xd0a6('0x43')][_0xd0a6('0x115')](db['CmContact'],{'as':_0xd0a6('0x14f'),'foreignKey':'ContactId'});db[_0xd0a6('0x43')][_0xd0a6('0x115')](db[_0xd0a6('0x13')],{'as':_0xd0a6('0x160'),'foreignKey':'UserId'});db[_0xd0a6('0x43')][_0xd0a6('0x117')](db['Tag'],{'through':_0xd0a6('0x161'),'as':_0xd0a6('0x162')});db[_0xd0a6('0x43')][_0xd0a6('0x117')](db['Tag'],{'through':'mail_interaction_has_tags','as':_0xd0a6('0x163')});db[_0xd0a6('0x43')][_0xd0a6('0x117')](db[_0xd0a6('0x13')],{'as':_0xd0a6('0x164'),'through':_0xd0a6('0x11e'),'foreignKey':_0xd0a6('0x15e')});db[_0xd0a6('0x45')]['hasMany'](db['Attachment'],{'as':_0xd0a6('0x165'),'onDelete':_0xd0a6('0x108')});db[_0xd0a6('0x45')]['belongsTo'](db[_0xd0a6('0x13')],{'as':'User'});db[_0xd0a6('0x45')][_0xd0a6('0x115')](db[_0xd0a6('0x79')],{'onDelete':_0xd0a6('0x108'),'as':_0xd0a6('0x14f')});db['MailMessage'][_0xd0a6('0x115')](db[_0xd0a6('0x43')],{'as':_0xd0a6('0x166'),'foreignKey':_0xd0a6('0x15e')});db[_0xd0a6('0x45')][_0xd0a6('0x115')](db[_0xd0a6('0x151')],{'as':_0xd0a6('0x15f'),'foreignKey':_0xd0a6('0x152')});db['MailApplication']['belongsTo'](db[_0xd0a6('0x13')],{'onDelete':'restrict'});db['MailApplication']['belongsTo'](db[_0xd0a6('0x124')],{'onDelete':_0xd0a6('0x167')});db[_0xd0a6('0x47')][_0xd0a6('0x115')](db['MailAccount'],{'onDelete':'restrict'});db['MailApplication'][_0xd0a6('0x115')](db['Interval'],{'onDelete':_0xd0a6('0x167'),'foreignKey':'IntervalId'});db['MailApplication'][_0xd0a6('0x115')](db[_0xd0a6('0x96')],{'onDelete':_0xd0a6('0x167'),'foreignKey':_0xd0a6('0x168')});db[_0xd0a6('0x49')]['belongsTo'](db['MailAccount'],{});db[_0xd0a6('0x49')][_0xd0a6('0x115')](db[_0xd0a6('0x12a')],{'as':_0xd0a6('0x169'),'foreignKey':_0xd0a6('0x15a')});db[_0xd0a6('0x49')]['belongsTo'](db[_0xd0a6('0x79')],{'as':_0xd0a6('0x14f'),'foreignKey':_0xd0a6('0x150')});db[_0xd0a6('0x49')]['belongsTo'](db[_0xd0a6('0x43')],{});db[_0xd0a6('0x49')]['belongsTo'](db[_0xd0a6('0x45')],{});db['MailQueueReport']['belongsTo'](db[_0xd0a6('0x13')],{});db[_0xd0a6('0x49')][_0xd0a6('0x115')](db['MailQueue'],{});db[_0xd0a6('0x16a')][_0xd0a6('0x10d')](db[_0xd0a6('0x4c')],{'as':_0xd0a6('0x16b'),'onDelete':_0xd0a6('0x108')});db[_0xd0a6('0x4e')][_0xd0a6('0x10d')](db[_0xd0a6('0x155')],{'as':_0xd0a6('0x156'),'foreignKey':_0xd0a6('0x16c')});db[_0xd0a6('0x4e')][_0xd0a6('0x10d')](db['CannedAnswer'],{'as':_0xd0a6('0x157'),'foreignKey':_0xd0a6('0x16c')});db[_0xd0a6('0x4e')]['hasMany'](db[_0xd0a6('0x113')],{'as':_0xd0a6('0x158')});db[_0xd0a6('0x4e')][_0xd0a6('0x10d')](db[_0xd0a6('0x4f')],{'as':_0xd0a6('0x159')});db[_0xd0a6('0x4e')]['hasMany'](db[_0xd0a6('0x1a')],{'as':_0xd0a6('0x16d'),'onDelete':_0xd0a6('0x108')});db[_0xd0a6('0x4e')][_0xd0a6('0x10d')](db[_0xd0a6('0x51')],{'as':_0xd0a6('0x149')});db[_0xd0a6('0x4e')][_0xd0a6('0x115')](db[_0xd0a6('0x2d')],{'as':'Trunk'});db[_0xd0a6('0x4e')][_0xd0a6('0x115')](db[_0xd0a6('0x12a')],{'as':'List','foreignKey':'ListId'});db[_0xd0a6('0x4e')]['belongsTo'](db[_0xd0a6('0x142')],{'as':_0xd0a6('0x143'),'foreignKey':_0xd0a6('0x16e')});db[_0xd0a6('0x4e')][_0xd0a6('0x117')](db[_0xd0a6('0x13')],{'as':'Agents','through':_0xd0a6('0x130')});db[_0xd0a6('0x4f')][_0xd0a6('0x115')](db[_0xd0a6('0x13')],{'onDelete':'restrict'});db[_0xd0a6('0x4f')]['belongsTo'](db[_0xd0a6('0x52')],{'onDelete':_0xd0a6('0x167')});db[_0xd0a6('0x4f')][_0xd0a6('0x115')](db[_0xd0a6('0x4e')],{'onDelete':_0xd0a6('0x167')});db[_0xd0a6('0x4f')][_0xd0a6('0x115')](db[_0xd0a6('0x96')],{'onDelete':_0xd0a6('0x167'),'foreignKey':'TagId'});db[_0xd0a6('0x113')]['hasMany'](db[_0xd0a6('0x51')],{'as':'Messages','onDelete':_0xd0a6('0x108'),'foreignKey':'FaxInteractionId'});db[_0xd0a6('0x113')][_0xd0a6('0x115')](db['FaxAccount'],{'as':_0xd0a6('0x15f'),'foreignKey':_0xd0a6('0x16c')});db[_0xd0a6('0x113')][_0xd0a6('0x115')](db[_0xd0a6('0x79')],{'as':_0xd0a6('0x14f'),'foreignKey':_0xd0a6('0x150')});db[_0xd0a6('0x113')][_0xd0a6('0x115')](db[_0xd0a6('0x13')],{'as':'Owner','foreignKey':_0xd0a6('0x109')});db[_0xd0a6('0x113')][_0xd0a6('0x117')](db[_0xd0a6('0x96')],{'through':'fax_interaction_has_tags','as':_0xd0a6('0x162')});db['FaxInteraction'][_0xd0a6('0x117')](db[_0xd0a6('0x96')],{'through':_0xd0a6('0x16f'),'as':_0xd0a6('0x163')});db['FaxInteraction']['belongsToMany'](db['User'],{'as':_0xd0a6('0x164'),'through':_0xd0a6('0x120'),'foreignKey':_0xd0a6('0x170')});db[_0xd0a6('0x51')][_0xd0a6('0x115')](db[_0xd0a6('0x13')],{'onDelete':_0xd0a6('0x108'),'as':_0xd0a6('0x13')});db[_0xd0a6('0x51')][_0xd0a6('0x115')](db[_0xd0a6('0x113')],{'as':_0xd0a6('0x166'),'foreignKey':'FaxInteractionId'});db[_0xd0a6('0x51')][_0xd0a6('0x115')](db['CmContact'],{'onDelete':_0xd0a6('0x108'),'as':'Contact'});db[_0xd0a6('0x51')][_0xd0a6('0x115')](db[_0xd0a6('0xf5')],{'as':'Attachment','foreignKey':'AttachmentId'});db[_0xd0a6('0x51')][_0xd0a6('0x115')](db[_0xd0a6('0x4e')],{'as':_0xd0a6('0x15f'),'foreignKey':_0xd0a6('0x16c')});db['FaxQueue'][_0xd0a6('0x117')](db[_0xd0a6('0x13')],{'as':_0xd0a6('0x15c'),'through':_0xd0a6('0x37')});db[_0xd0a6('0x52')]['belongsToMany'](db['Team'],{'through':_0xd0a6('0x171'),'as':_0xd0a6('0x145')});db[_0xd0a6('0x54')][_0xd0a6('0x115')](db[_0xd0a6('0x4e')],{});db[_0xd0a6('0x54')][_0xd0a6('0x115')](db[_0xd0a6('0x12a')],{'as':_0xd0a6('0x169'),'foreignKey':'ListId'});db['FaxQueueReport']['belongsTo'](db[_0xd0a6('0x79')],{'as':_0xd0a6('0x14f'),'foreignKey':_0xd0a6('0x150')});db[_0xd0a6('0x54')][_0xd0a6('0x115')](db['FaxInteraction'],{});db['FaxQueueReport'][_0xd0a6('0x115')](db[_0xd0a6('0x51')],{});db[_0xd0a6('0x54')][_0xd0a6('0x115')](db[_0xd0a6('0x13')],{});db[_0xd0a6('0x54')]['belongsTo'](db[_0xd0a6('0x52')],{});db[_0xd0a6('0x56')][_0xd0a6('0x10d')](db[_0xd0a6('0x155')],{'as':_0xd0a6('0x156'),'foreignKey':_0xd0a6('0x172')});db[_0xd0a6('0x56')][_0xd0a6('0x10d')](db[_0xd0a6('0x8a')],{'as':_0xd0a6('0x157'),'foreignKey':_0xd0a6('0x172')});db[_0xd0a6('0x56')][_0xd0a6('0x10d')](db[_0xd0a6('0x5c')],{'as':_0xd0a6('0x149'),'foreignKey':_0xd0a6('0x172')});db[_0xd0a6('0x56')][_0xd0a6('0x10d')](db[_0xd0a6('0x5a')],{'as':_0xd0a6('0x158')});db[_0xd0a6('0x56')][_0xd0a6('0x10d')](db[_0xd0a6('0x58')],{'as':_0xd0a6('0x159')});db[_0xd0a6('0x56')][_0xd0a6('0x115')](db[_0xd0a6('0x12a')],{'as':_0xd0a6('0x169'),'foreignKey':_0xd0a6('0x15a')});db[_0xd0a6('0x56')][_0xd0a6('0x115')](db[_0xd0a6('0x142')],{'as':_0xd0a6('0x143'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xd0a6('0x56')][_0xd0a6('0x117')](db['User'],{'as':'Agents','through':_0xd0a6('0x173')});db[_0xd0a6('0x58')][_0xd0a6('0x115')](db[_0xd0a6('0x13')],{'onDelete':_0xd0a6('0x167')});db[_0xd0a6('0x58')][_0xd0a6('0x115')](db[_0xd0a6('0x5e')],{'onDelete':_0xd0a6('0x167')});db[_0xd0a6('0x58')]['belongsTo'](db[_0xd0a6('0x56')],{'onDelete':_0xd0a6('0x167')});db[_0xd0a6('0x58')][_0xd0a6('0x115')](db[_0xd0a6('0x8f')],{'onDelete':_0xd0a6('0x167'),'foreignKey':_0xd0a6('0x141')});db[_0xd0a6('0x58')][_0xd0a6('0x115')](db['Tag'],{'onDelete':_0xd0a6('0x167'),'foreignKey':_0xd0a6('0x168')});db[_0xd0a6('0x5a')][_0xd0a6('0x10d')](db[_0xd0a6('0x5c')],{'as':_0xd0a6('0x149'),'onDelete':'cascade','foreignKey':'SmsInteractionId'});db[_0xd0a6('0x5a')][_0xd0a6('0x115')](db[_0xd0a6('0x56')],{'as':'Account','foreignKey':_0xd0a6('0x172')});db['SmsInteraction'][_0xd0a6('0x115')](db[_0xd0a6('0x79')],{'as':_0xd0a6('0x14f'),'foreignKey':_0xd0a6('0x150')});db[_0xd0a6('0x5a')]['belongsTo'](db['User'],{'as':_0xd0a6('0x160'),'foreignKey':_0xd0a6('0x109')});db[_0xd0a6('0x5a')][_0xd0a6('0x117')](db[_0xd0a6('0x96')],{'through':_0xd0a6('0x174'),'as':_0xd0a6('0x162')});db[_0xd0a6('0x5a')][_0xd0a6('0x117')](db[_0xd0a6('0x96')],{'through':'sms_interaction_has_tags','as':_0xd0a6('0x163')});db[_0xd0a6('0x5a')]['belongsToMany'](db[_0xd0a6('0x13')],{'as':'Users','through':_0xd0a6('0x121'),'foreignKey':_0xd0a6('0x175')});db[_0xd0a6('0x5c')][_0xd0a6('0x115')](db['User'],{'as':_0xd0a6('0x13')});db[_0xd0a6('0x5c')][_0xd0a6('0x115')](db[_0xd0a6('0x79')],{'onDelete':_0xd0a6('0x108'),'as':_0xd0a6('0x14f')});db[_0xd0a6('0x5c')][_0xd0a6('0x115')](db['SmsInteraction'],{'onDelete':_0xd0a6('0x108'),'as':_0xd0a6('0x166'),'foreignKey':_0xd0a6('0x175')});db[_0xd0a6('0x5c')][_0xd0a6('0x115')](db[_0xd0a6('0x56')],{'as':'Account','foreignKey':_0xd0a6('0x172')});db[_0xd0a6('0x5e')][_0xd0a6('0x117')](db[_0xd0a6('0x13')],{'as':_0xd0a6('0x15c'),'through':'UserSmsQueue','foreignKey':_0xd0a6('0x176')});db[_0xd0a6('0x5e')][_0xd0a6('0x117')](db[_0xd0a6('0x11b')],{'through':_0xd0a6('0x177'),'as':_0xd0a6('0x145')});db[_0xd0a6('0x60')][_0xd0a6('0x10d')](db[_0xd0a6('0x155')],{'as':_0xd0a6('0x156'),'foreignKey':_0xd0a6('0x178')});db[_0xd0a6('0x60')][_0xd0a6('0x10d')](db[_0xd0a6('0x8a')],{'as':'Answers','foreignKey':'OpenchannelAccountId'});db[_0xd0a6('0x60')][_0xd0a6('0x10d')](db[_0xd0a6('0x64')],{'as':'Interactions','foreignKey':_0xd0a6('0x178')});db[_0xd0a6('0x60')][_0xd0a6('0x10d')](db[_0xd0a6('0x65')],{'as':_0xd0a6('0x149'),'foreignKey':_0xd0a6('0x178')});db[_0xd0a6('0x60')][_0xd0a6('0x10d')](db[_0xd0a6('0x62')],{'as':_0xd0a6('0x159'),'foreignKey':_0xd0a6('0x178')});db['OpenchannelAccount'][_0xd0a6('0x115')](db[_0xd0a6('0x12a')],{'as':_0xd0a6('0x169'),'foreignKey':_0xd0a6('0x15a')});db[_0xd0a6('0x60')]['belongsTo'](db['Pause'],{'as':_0xd0a6('0x143'),'foreignKey':_0xd0a6('0x16e')});db[_0xd0a6('0x60')][_0xd0a6('0x117')](db['User'],{'as':_0xd0a6('0x15c'),'through':_0xd0a6('0x133')});db[_0xd0a6('0x62')][_0xd0a6('0x115')](db[_0xd0a6('0x13')],{'onDelete':_0xd0a6('0x167')});db[_0xd0a6('0x62')]['belongsTo'](db[_0xd0a6('0x66')],{'onDelete':_0xd0a6('0x167'),'foreignKey':_0xd0a6('0x179')});db[_0xd0a6('0x62')][_0xd0a6('0x115')](db[_0xd0a6('0x60')],{'onDelete':_0xd0a6('0x167'),'foreignKey':_0xd0a6('0x178')});db[_0xd0a6('0x62')][_0xd0a6('0x115')](db['Interval'],{'onDelete':_0xd0a6('0x167'),'foreignKey':_0xd0a6('0x141')});db[_0xd0a6('0x62')]['belongsTo'](db['Tag'],{'onDelete':_0xd0a6('0x167'),'foreignKey':'TagId'});db[_0xd0a6('0x64')][_0xd0a6('0x10d')](db[_0xd0a6('0x65')],{'as':_0xd0a6('0x149'),'onDelete':_0xd0a6('0x108'),'foreignKey':_0xd0a6('0x17a')});db[_0xd0a6('0x64')][_0xd0a6('0x115')](db[_0xd0a6('0x60')],{'as':_0xd0a6('0x15f'),'foreignKey':_0xd0a6('0x178')});db[_0xd0a6('0x64')][_0xd0a6('0x115')](db[_0xd0a6('0x79')],{'as':_0xd0a6('0x14f'),'foreignKey':_0xd0a6('0x150')});db[_0xd0a6('0x64')][_0xd0a6('0x115')](db['User'],{'as':'Owner','foreignKey':_0xd0a6('0x109')});db[_0xd0a6('0x64')][_0xd0a6('0x117')](db[_0xd0a6('0x96')],{'through':_0xd0a6('0x17b'),'as':_0xd0a6('0x162')});db[_0xd0a6('0x64')][_0xd0a6('0x117')](db[_0xd0a6('0x96')],{'through':_0xd0a6('0x17b'),'as':_0xd0a6('0x163')});db[_0xd0a6('0x64')]['belongsToMany'](db[_0xd0a6('0x13')],{'as':_0xd0a6('0x164'),'through':'user_has_openchannel_interactions','foreignKey':_0xd0a6('0x17a')});db['OpenchannelMessage']['belongsTo'](db[_0xd0a6('0x13')],{'onDelete':_0xd0a6('0x108'),'as':_0xd0a6('0x13')});db[_0xd0a6('0x65')]['belongsTo'](db[_0xd0a6('0x79')],{'onDelete':'cascade','as':_0xd0a6('0x14f')});db[_0xd0a6('0x65')]['belongsTo'](db['OpenchannelInteraction'],{'onDelete':_0xd0a6('0x108'),'as':_0xd0a6('0x166'),'foreignKey':_0xd0a6('0x17a')});db[_0xd0a6('0x65')][_0xd0a6('0x115')](db[_0xd0a6('0xf5')],{'as':_0xd0a6('0xf5'),'foreignKey':'AttachmentId'});db['OpenchannelMessage'][_0xd0a6('0x115')](db[_0xd0a6('0x60')],{'as':_0xd0a6('0x15f'),'foreignKey':_0xd0a6('0x178')});db[_0xd0a6('0x66')][_0xd0a6('0x117')](db['User'],{'as':_0xd0a6('0x15c'),'through':_0xd0a6('0x3a'),'foreignKey':'OpenchannelQueueId'});db[_0xd0a6('0x66')]['belongsToMany'](db[_0xd0a6('0x11b')],{'through':_0xd0a6('0x17c'),'as':'Teams'});db[_0xd0a6('0x68')][_0xd0a6('0x10d')](db['Disposition'],{'as':_0xd0a6('0x156'),'foreignKey':'ChatWebsiteId'});db['ChatWebsite'][_0xd0a6('0x10d')](db[_0xd0a6('0x8a')],{'as':_0xd0a6('0x157'),'foreignKey':_0xd0a6('0x17d')});db[_0xd0a6('0x68')][_0xd0a6('0x10d')](db[_0xd0a6('0x75')],{'as':'ProactiveActions'});db[_0xd0a6('0x68')][_0xd0a6('0x10d')](db[_0xd0a6('0x6c')],{'as':'Interactions'});db[_0xd0a6('0x68')]['hasMany'](db['ChatApplication'],{'as':_0xd0a6('0x159')});db[_0xd0a6('0x68')][_0xd0a6('0x10d')](db['ChatMessage'],{'as':_0xd0a6('0x149')});db[_0xd0a6('0x68')][_0xd0a6('0x115')](db[_0xd0a6('0x12a')],{'as':_0xd0a6('0x169'),'foreignKey':'ListId'});db[_0xd0a6('0x68')][_0xd0a6('0x115')](db[_0xd0a6('0x8f')],{'as':_0xd0a6('0x8f'),'foreignKey':_0xd0a6('0x141')});db[_0xd0a6('0x68')]['belongsTo'](db[_0xd0a6('0x142')],{'as':'mandatoryDispositionPause','foreignKey':_0xd0a6('0x16e')});db[_0xd0a6('0x68')]['belongsToMany'](db[_0xd0a6('0x13')],{'as':'Agents','through':_0xd0a6('0x12e')});db[_0xd0a6('0x17e')][_0xd0a6('0x115')](db[_0xd0a6('0x60')],{});db[_0xd0a6('0x17e')][_0xd0a6('0x115')](db[_0xd0a6('0x12a')],{'as':_0xd0a6('0x169'),'foreignKey':'ListId'});db[_0xd0a6('0x17e')][_0xd0a6('0x115')](db[_0xd0a6('0x79')],{'as':_0xd0a6('0x14f'),'foreignKey':_0xd0a6('0x150')});db['OpenchannelQueueReport'][_0xd0a6('0x115')](db[_0xd0a6('0x64')],{});db[_0xd0a6('0x17e')]['belongsTo'](db[_0xd0a6('0x65')],{});db[_0xd0a6('0x17e')][_0xd0a6('0x115')](db[_0xd0a6('0x13')],{});db[_0xd0a6('0x17e')][_0xd0a6('0x115')](db[_0xd0a6('0x66')],{});db[_0xd0a6('0x6b')][_0xd0a6('0x115')](db[_0xd0a6('0x13')],{'as':'Agent','foreignKey':_0xd0a6('0x109'),'onDelete':_0xd0a6('0x167')});db[_0xd0a6('0x6b')][_0xd0a6('0x115')](db[_0xd0a6('0x71')],{'as':_0xd0a6('0x17f'),'foreignKey':_0xd0a6('0x180'),'onDelete':_0xd0a6('0x167')});db[_0xd0a6('0x6b')][_0xd0a6('0x115')](db[_0xd0a6('0x68')],{'as':_0xd0a6('0x181'),'foreignKey':_0xd0a6('0x17d'),'onDelete':_0xd0a6('0x167')});db['ChatApplication'][_0xd0a6('0x115')](db[_0xd0a6('0x96')],{'onDelete':'restrict','foreignKey':'TagId'});db[_0xd0a6('0x6c')][_0xd0a6('0x10d')](db[_0xd0a6('0x6e')],{'as':_0xd0a6('0x149'),'onDelete':_0xd0a6('0x108'),'foreignKey':_0xd0a6('0x182')});db[_0xd0a6('0x6c')][_0xd0a6('0x115')](db[_0xd0a6('0x68')],{'as':'Account','foreignKey':_0xd0a6('0x17d')});db['ChatInteraction'][_0xd0a6('0x115')](db[_0xd0a6('0x79')],{'as':_0xd0a6('0x14f'),'foreignKey':_0xd0a6('0x150')});db[_0xd0a6('0x6c')][_0xd0a6('0x115')](db[_0xd0a6('0x13')],{'as':_0xd0a6('0x160'),'foreignKey':_0xd0a6('0x109')});db[_0xd0a6('0x6c')][_0xd0a6('0x117')](db[_0xd0a6('0x96')],{'through':_0xd0a6('0x183'),'as':'Tags'});db[_0xd0a6('0x6c')][_0xd0a6('0x117')](db['Tag'],{'through':_0xd0a6('0x183'),'as':_0xd0a6('0x163')});db[_0xd0a6('0x6c')]['belongsToMany'](db['User'],{'as':_0xd0a6('0x164'),'through':_0xd0a6('0x11f'),'foreignKey':_0xd0a6('0x182')});db[_0xd0a6('0x6e')]['belongsTo'](db[_0xd0a6('0x13')],{'onDelete':_0xd0a6('0x108'),'as':'User'});db[_0xd0a6('0x6e')][_0xd0a6('0x115')](db['CmContact'],{'onDelete':'cascade','as':_0xd0a6('0x14f'),'foreignKey':'ContactId'});db[_0xd0a6('0x6e')][_0xd0a6('0x115')](db[_0xd0a6('0x6c')],{'onDelete':_0xd0a6('0x108'),'as':_0xd0a6('0x166'),'foreignKey':_0xd0a6('0x182')});db[_0xd0a6('0x6e')][_0xd0a6('0x115')](db['Attachment'],{'as':'Attachment','foreignKey':_0xd0a6('0x184')});db[_0xd0a6('0x6e')][_0xd0a6('0x115')](db[_0xd0a6('0x68')],{'as':_0xd0a6('0x15f'),'foreignKey':_0xd0a6('0x17d')});db[_0xd0a6('0x70')][_0xd0a6('0x115')](db[_0xd0a6('0x79')],{'onDelete':_0xd0a6('0x108'),'as':_0xd0a6('0x14f'),'foreignKey':_0xd0a6('0x150')});db['ChatOfflineMessage'][_0xd0a6('0x115')](db[_0xd0a6('0x68')],{'as':_0xd0a6('0x15f'),'foreignKey':_0xd0a6('0x17d')});db['ChatQueue'][_0xd0a6('0x117')](db[_0xd0a6('0x13')],{'as':_0xd0a6('0x15c'),'through':_0xd0a6('0x33'),'hooks':!![]});db['ChatQueue'][_0xd0a6('0x117')](db[_0xd0a6('0x11b')],{'through':_0xd0a6('0x185'),'as':_0xd0a6('0x145')});db['ChatGroup'][_0xd0a6('0x10d')](db[_0xd0a6('0xdb')],{'as':'Messages','foreignKey':_0xd0a6('0x186'),'onDelete':_0xd0a6('0x108')});db['ChatGroup'][_0xd0a6('0x117')](db[_0xd0a6('0x13')],{'as':_0xd0a6('0x139'),'through':_0xd0a6('0x118')});db[_0xd0a6('0x75')][_0xd0a6('0x115')](db['ChatWebsite'],{'as':_0xd0a6('0x181'),'foreignKey':_0xd0a6('0x17d')});db['CmCompany'][_0xd0a6('0x10d')](db[_0xd0a6('0x79')],{'as':_0xd0a6('0x119'),'foreignKey':'CompanyId'});db[_0xd0a6('0x79')][_0xd0a6('0x10d')](db['CmHopper'],{'as':'Hoppers','foreignKey':_0xd0a6('0x150')});db[_0xd0a6('0x79')][_0xd0a6('0x10d')](db['CmHopperFinal'],{'as':_0xd0a6('0x187'),'foreignKey':_0xd0a6('0x150')});db[_0xd0a6('0x79')][_0xd0a6('0x10d')](db[_0xd0a6('0x81')],{'as':_0xd0a6('0x13b'),'foreignKey':'ContactId'});db['CmContact'][_0xd0a6('0x10d')](db[_0xd0a6('0x83')],{'as':_0xd0a6('0x83'),'foreignKey':_0xd0a6('0x150')});db[_0xd0a6('0x79')]['hasMany'](db[_0xd0a6('0xe0')],{'as':_0xd0a6('0x13d'),'foreignKey':_0xd0a6('0x150')});db[_0xd0a6('0x79')][_0xd0a6('0x10d')](db[_0xd0a6('0x64')],{'as':_0xd0a6('0x110'),'foreignKey':_0xd0a6('0x150'),'onDelete':_0xd0a6('0x167')});db[_0xd0a6('0x79')]['hasMany'](db['ChatInteraction'],{'as':_0xd0a6('0x111'),'foreignKey':'ContactId','onDelete':_0xd0a6('0x167')});db['CmContact']['hasMany'](db[_0xd0a6('0x5a')],{'as':_0xd0a6('0x112'),'foreignKey':_0xd0a6('0x150'),'onDelete':_0xd0a6('0x167')});db[_0xd0a6('0x79')][_0xd0a6('0x10d')](db[_0xd0a6('0x113')],{'as':_0xd0a6('0x114'),'foreignKey':_0xd0a6('0x150'),'onDelete':_0xd0a6('0x167')});db[_0xd0a6('0x79')][_0xd0a6('0x10d')](db['MailInteraction'],{'as':_0xd0a6('0x11d'),'foreignKey':'ContactId','onDelete':_0xd0a6('0x167')});db[_0xd0a6('0x79')][_0xd0a6('0x115')](db[_0xd0a6('0x77')],{'as':_0xd0a6('0x188'),'foreignKey':_0xd0a6('0x189')});db['CmContact']['belongsTo'](db[_0xd0a6('0x12a')],{'as':_0xd0a6('0x169'),'foreignKey':_0xd0a6('0x15a'),'onDelete':_0xd0a6('0x108')});db[_0xd0a6('0x79')][_0xd0a6('0x117')](db[_0xd0a6('0x13')],{'as':_0xd0a6('0x164'),'through':_0xd0a6('0x18a')});db[_0xd0a6('0x79')][_0xd0a6('0x117')](db[_0xd0a6('0x96')],{'as':_0xd0a6('0x162'),'through':_0xd0a6('0x18b')});db[_0xd0a6('0x79')][_0xd0a6('0x117')](db[_0xd0a6('0x96')],{'through':'cm_contact_has_tags','as':_0xd0a6('0x163')});db[_0xd0a6('0x7b')][_0xd0a6('0x115')](db[_0xd0a6('0x79')],{'as':_0xd0a6('0x14f'),'foreignKey':_0xd0a6('0x150'),'onDelete':'cascade'});db['CmHopper'][_0xd0a6('0x115')](db[_0xd0a6('0x12a')],{'as':_0xd0a6('0x169'),'foreignKey':'ListId','onDelete':_0xd0a6('0x108')});db[_0xd0a6('0x7b')][_0xd0a6('0x115')](db[_0xd0a6('0x13')],{'as':_0xd0a6('0x18c'),'foreignKey':'UserId'});db[_0xd0a6('0x7b')][_0xd0a6('0x115')](db[_0xd0a6('0x1d')],{'as':_0xd0a6('0x17f'),'foreignKey':'VoiceQueueId','onDelete':_0xd0a6('0x108')});db[_0xd0a6('0x7b')][_0xd0a6('0x115')](db[_0xd0a6('0xf2')],{'as':_0xd0a6('0xf2'),'foreignKey':_0xd0a6('0x18d'),'onDelete':_0xd0a6('0x108')});db['CmHopper']['belongsTo'](db[_0xd0a6('0x13')],{'as':_0xd0a6('0x160'),'foreignKey':_0xd0a6('0x18e')});db[_0xd0a6('0x7d')]['belongsTo'](db[_0xd0a6('0x79')],{'as':'Contact','foreignKey':'ContactId','onDelete':'cascade'});db[_0xd0a6('0x7d')]['belongsTo'](db[_0xd0a6('0x12a')],{'as':_0xd0a6('0x169'),'foreignKey':'ListId','onDelete':_0xd0a6('0x108')});db[_0xd0a6('0x7d')][_0xd0a6('0x115')](db[_0xd0a6('0x1d')],{'as':_0xd0a6('0x17f'),'foreignKey':'VoiceQueueId','onDelete':_0xd0a6('0x108')});db[_0xd0a6('0x7d')]['belongsTo'](db[_0xd0a6('0xf2')],{'as':_0xd0a6('0xf2'),'foreignKey':_0xd0a6('0x18d'),'onDelete':_0xd0a6('0x108')});db[_0xd0a6('0x88')]['hasMany'](db[_0xd0a6('0x8d')],{'as':{'plural':'All','singular':_0xd0a6('0x18f')},'foreignKey':'AutomationAllId','onDelete':_0xd0a6('0x108'),'hooks':!![]});db[_0xd0a6('0x88')][_0xd0a6('0x10d')](db[_0xd0a6('0x8d')],{'as':{'plural':'Any','singular':_0xd0a6('0x190')},'foreignKey':'AutomationAnyId','onDelete':_0xd0a6('0x108'),'hooks':!![]});db[_0xd0a6('0x88')][_0xd0a6('0x10d')](db[_0xd0a6('0x86')],{'as':'Actions','foreignKey':_0xd0a6('0x191'),'onDelete':_0xd0a6('0x108'),'hooks':!![]});db[_0xd0a6('0x8f')][_0xd0a6('0x10d')](db[_0xd0a6('0x8f')],{'as':_0xd0a6('0x192'),'foreignKey':_0xd0a6('0x141'),'onDelete':'cascade','hooks':!![],'required':![]});db[_0xd0a6('0x8f')][_0xd0a6('0x10d')](db['VoiceExtension'],{'as':_0xd0a6('0x10e'),'foreignKey':_0xd0a6('0x141'),'onDelete':_0xd0a6('0x167')});db[_0xd0a6('0x8f')][_0xd0a6('0x10d')](db[_0xd0a6('0x47')],{'as':_0xd0a6('0x193'),'foreignKey':_0xd0a6('0x141')});db[_0xd0a6('0x8f')][_0xd0a6('0x10d')](db[_0xd0a6('0x6b')],{'as':_0xd0a6('0x194'),'foreignKey':'IntervalId'});db['Interval']['hasMany'](db[_0xd0a6('0x4f')],{'as':_0xd0a6('0x195'),'foreignKey':_0xd0a6('0x141')});db[_0xd0a6('0x8f')][_0xd0a6('0x10d')](db[_0xd0a6('0x58')],{'as':_0xd0a6('0x196'),'foreignKey':'IntervalId'});db['Schedule'][_0xd0a6('0x115')](db[_0xd0a6('0x151')],{});db['Schedule'][_0xd0a6('0x115')](db[_0xd0a6('0x197')],{'foreignKey':_0xd0a6('0x198')});db[_0xd0a6('0x199')]['belongsTo'](db[_0xd0a6('0x9f')],{'foreignKey':_0xd0a6('0x19a')});db[_0xd0a6('0x136')][_0xd0a6('0x117')](db[_0xd0a6('0x1b')],{'as':'Mohs','through':_0xd0a6('0x138'),'onDelete':'restrict'});db['Tag'][_0xd0a6('0x117')](db[_0xd0a6('0x79')],{'through':_0xd0a6('0x18b')});db[_0xd0a6('0x96')][_0xd0a6('0x117')](db['ChatInteraction'],{'through':_0xd0a6('0x183')});db[_0xd0a6('0x96')][_0xd0a6('0x117')](db[_0xd0a6('0x43')],{'through':_0xd0a6('0x161')});db[_0xd0a6('0x96')][_0xd0a6('0x117')](db[_0xd0a6('0x5a')],{'through':_0xd0a6('0x174')});db[_0xd0a6('0x96')][_0xd0a6('0x117')](db[_0xd0a6('0x113')],{'through':_0xd0a6('0x16f')});db[_0xd0a6('0x96')][_0xd0a6('0x117')](db[_0xd0a6('0x64')],{'through':_0xd0a6('0x17b')});db[_0xd0a6('0x9a')]['hasMany'](db[_0xd0a6('0x8d')],{'as':{'plural':_0xd0a6('0x19b'),'singular':_0xd0a6('0x19c')},'foreignKey':_0xd0a6('0x19d'),'onDelete':_0xd0a6('0x108'),'hooks':!![]});db[_0xd0a6('0x9a')][_0xd0a6('0x10d')](db['Condition'],{'as':{'plural':_0xd0a6('0x19e'),'singular':_0xd0a6('0x19f')},'foreignKey':_0xd0a6('0x1a0'),'onDelete':_0xd0a6('0x108'),'hooks':!![]});db['Trigger']['hasMany'](db[_0xd0a6('0x86')],{'as':_0xd0a6('0x1a1'),'foreignKey':_0xd0a6('0x1a2'),'onDelete':_0xd0a6('0x108'),'hooks':!![]});db[_0xd0a6('0x9f')][_0xd0a6('0x10d')](db[_0xd0a6('0xa4')],{'as':'Fields','onDelete':'cascade','foreignKey':'CustomReportId','hooks':!![]});db[_0xd0a6('0x197')]['hasMany'](db[_0xd0a6('0xa4')],{'as':_0xd0a6('0x1a3'),'onDelete':_0xd0a6('0x108'),'foreignKey':'DefaultReportId'});db[_0xd0a6('0xa2')][_0xd0a6('0x10d')](db[_0xd0a6('0xa4')],{'as':_0xd0a6('0x1a3'),'onDelete':'cascade','foreignKey':_0xd0a6('0x1a4')});db['AnalyticFieldReport'][_0xd0a6('0x115')](db['AnalyticMetric'],{'foreignKey':_0xd0a6('0x1a4')});db[_0xd0a6('0xa7')][_0xd0a6('0x10d')](db[_0xd0a6('0xa9')],{'as':'Configurations','onDelete':'cascade','foreignKey':_0xd0a6('0x1a5')});db[_0xd0a6('0xa9')]['hasMany'](db[_0xd0a6('0xab')],{'as':_0xd0a6('0x1a6'),'onDelete':'cascade','foreignKey':_0xd0a6('0x1a7')});db[_0xd0a6('0xa9')]['hasMany'](db[_0xd0a6('0xab')],{'as':_0xd0a6('0x1a8'),'onDelete':_0xd0a6('0x108'),'foreignKey':_0xd0a6('0x1a9')});db[_0xd0a6('0xa9')][_0xd0a6('0x10d')](db[_0xd0a6('0xab')],{'as':_0xd0a6('0x1a3'),'onDelete':_0xd0a6('0x108'),'foreignKey':_0xd0a6('0x1aa')});db[_0xd0a6('0xa9')]['belongsTo'](db[_0xd0a6('0xa7')],{'as':_0xd0a6('0x15f'),'foreignKey':_0xd0a6('0x1a5')});db[_0xd0a6('0xab')][_0xd0a6('0x10d')](db[_0xd0a6('0xab')],{'as':_0xd0a6('0x1ab'),'foreignKey':_0xd0a6('0x1a7')});db[_0xd0a6('0xab')][_0xd0a6('0x10d')](db[_0xd0a6('0xab')],{'as':_0xd0a6('0x1ac'),'foreignKey':'DescriptionId'});db[_0xd0a6('0xab')][_0xd0a6('0x10d')](db[_0xd0a6('0xab')],{'as':_0xd0a6('0x1ad'),'foreignKey':'FieldId'});db[_0xd0a6('0xab')][_0xd0a6('0x115')](db['Variable'],{'as':_0xd0a6('0x1ae'),'foreignKey':'VariableId'});db[_0xd0a6('0xad')][_0xd0a6('0x10d')](db['SugarcrmConfiguration'],{'as':_0xd0a6('0x1af'),'onDelete':_0xd0a6('0x108'),'foreignKey':_0xd0a6('0x1a5')});db[_0xd0a6('0x1b0')]['hasMany'](db[_0xd0a6('0xb0')],{'as':_0xd0a6('0x1a6'),'onDelete':_0xd0a6('0x108'),'foreignKey':'SubjectId'});db[_0xd0a6('0x1b0')][_0xd0a6('0x10d')](db[_0xd0a6('0xb0')],{'as':_0xd0a6('0x1a8'),'onDelete':_0xd0a6('0x108'),'foreignKey':_0xd0a6('0x1a9')});db[_0xd0a6('0x1b0')][_0xd0a6('0x10d')](db[_0xd0a6('0xb0')],{'as':_0xd0a6('0x1a3'),'onDelete':'cascade','foreignKey':_0xd0a6('0x1aa')});db['SugarcrmConfiguration']['belongsTo'](db[_0xd0a6('0xad')],{'as':_0xd0a6('0x15f'),'foreignKey':_0xd0a6('0x1a5')});db['SugarcrmField'][_0xd0a6('0x10d')](db[_0xd0a6('0xb0')],{'as':'Subject','foreignKey':_0xd0a6('0x1a7')});db[_0xd0a6('0xb0')]['hasMany'](db[_0xd0a6('0xb0')],{'as':'Description','foreignKey':_0xd0a6('0x1a9')});db['SugarcrmField']['hasMany'](db['SugarcrmField'],{'as':_0xd0a6('0x1ad'),'foreignKey':_0xd0a6('0x1aa')});db[_0xd0a6('0xb0')][_0xd0a6('0x115')](db[_0xd0a6('0x1ae')],{'as':_0xd0a6('0x1ae'),'foreignKey':_0xd0a6('0x1b1')});db[_0xd0a6('0xb2')]['hasMany'](db['DeskConfiguration'],{'as':_0xd0a6('0x1af'),'onDelete':_0xd0a6('0x108'),'foreignKey':_0xd0a6('0x1a5')});db[_0xd0a6('0x1b2')][_0xd0a6('0x10d')](db[_0xd0a6('0xb5')],{'as':_0xd0a6('0x1a6'),'onDelete':'cascade','foreignKey':'SubjectId'});db['DeskConfiguration'][_0xd0a6('0x10d')](db['DeskField'],{'as':_0xd0a6('0x1a8'),'onDelete':_0xd0a6('0x108'),'foreignKey':_0xd0a6('0x1a9')});db[_0xd0a6('0x1b2')]['hasMany'](db['DeskField'],{'as':'Fields','onDelete':'cascade','foreignKey':_0xd0a6('0x1aa')});db[_0xd0a6('0x1b2')][_0xd0a6('0x115')](db['DeskAccount'],{'as':_0xd0a6('0x15f'),'foreignKey':_0xd0a6('0x1a5')});db['DeskConfiguration'][_0xd0a6('0x117')](db[_0xd0a6('0x96')],{'through':_0xd0a6('0x1b3')});db[_0xd0a6('0xb5')][_0xd0a6('0x10d')](db[_0xd0a6('0xb5')],{'as':'Subject','foreignKey':'SubjectId'});db['DeskField'][_0xd0a6('0x10d')](db[_0xd0a6('0xb5')],{'as':_0xd0a6('0x1ac'),'foreignKey':_0xd0a6('0x1a9')});db['DeskField'][_0xd0a6('0x10d')](db[_0xd0a6('0xb5')],{'as':_0xd0a6('0x1ad'),'foreignKey':_0xd0a6('0x1aa')});db['DeskField'][_0xd0a6('0x115')](db['Variable'],{'as':_0xd0a6('0x1ae'),'foreignKey':_0xd0a6('0x1b1')});db[_0xd0a6('0xb7')]['hasMany'](db['ZohoConfiguration'],{'as':'Configurations','onDelete':'cascade','foreignKey':_0xd0a6('0x1a5')});db[_0xd0a6('0xb9')][_0xd0a6('0x10d')](db['ZohoField'],{'as':'Subjects','onDelete':_0xd0a6('0x108'),'foreignKey':_0xd0a6('0x1a7')});db['ZohoConfiguration'][_0xd0a6('0x10d')](db[_0xd0a6('0xba')],{'as':'Descriptions','onDelete':'cascade','foreignKey':_0xd0a6('0x1a9')});db[_0xd0a6('0xb9')][_0xd0a6('0x10d')](db[_0xd0a6('0xba')],{'as':'Fields','onDelete':_0xd0a6('0x108'),'foreignKey':_0xd0a6('0x1aa')});db[_0xd0a6('0xb9')][_0xd0a6('0x115')](db[_0xd0a6('0xb7')],{'as':'Account','foreignKey':_0xd0a6('0x1a5')});db[_0xd0a6('0xba')]['hasMany'](db[_0xd0a6('0xba')],{'as':_0xd0a6('0x1ab'),'foreignKey':_0xd0a6('0x1a7')});db[_0xd0a6('0xba')][_0xd0a6('0x10d')](db['ZohoField'],{'as':'Description','foreignKey':_0xd0a6('0x1a9')});db[_0xd0a6('0xba')][_0xd0a6('0x10d')](db[_0xd0a6('0xba')],{'as':_0xd0a6('0x1ad'),'foreignKey':_0xd0a6('0x1aa')});db['ZohoField']['belongsTo'](db['Variable'],{'as':'Variable','foreignKey':_0xd0a6('0x1b1')});db[_0xd0a6('0xbc')]['hasMany'](db['ZendeskConfiguration'],{'as':_0xd0a6('0x1af'),'onDelete':_0xd0a6('0x108'),'foreignKey':_0xd0a6('0x1a5')});db[_0xd0a6('0xbe')][_0xd0a6('0x10d')](db[_0xd0a6('0x1b4')],{'as':_0xd0a6('0x1a6'),'foreignKey':_0xd0a6('0x1a7')});db[_0xd0a6('0xbe')]['hasMany'](db[_0xd0a6('0x1b4')],{'as':'Descriptions','foreignKey':_0xd0a6('0x1a9')});db['ZendeskConfiguration']['hasMany'](db['ZendeskField'],{'as':_0xd0a6('0x1a3'),'foreignKey':_0xd0a6('0x1aa')});db['ZendeskConfiguration'][_0xd0a6('0x115')](db['ZendeskAccount'],{'as':_0xd0a6('0x15f'),'foreignKey':_0xd0a6('0x1a5')});db['ZendeskConfiguration'][_0xd0a6('0x117')](db[_0xd0a6('0x96')],{'through':_0xd0a6('0x1b5')});db[_0xd0a6('0x1b4')]['hasMany'](db[_0xd0a6('0x1b4')],{'as':_0xd0a6('0x1ab'),'foreignKey':_0xd0a6('0x1a7')});db[_0xd0a6('0x1b4')][_0xd0a6('0x10d')](db[_0xd0a6('0x1b4')],{'as':_0xd0a6('0x1ac'),'foreignKey':'DescriptionId'});db['ZendeskField']['hasMany'](db['ZendeskField'],{'as':_0xd0a6('0x1ad'),'foreignKey':_0xd0a6('0x1aa')});db[_0xd0a6('0x1b4')]['belongsTo'](db[_0xd0a6('0x1ae')],{'as':'Variable','foreignKey':_0xd0a6('0x1b1')});db[_0xd0a6('0xbf')][_0xd0a6('0x10d')](db[_0xd0a6('0xc1')],{'as':_0xd0a6('0x1af'),'onDelete':_0xd0a6('0x108'),'foreignKey':'AccountId'});db[_0xd0a6('0xc1')]['hasMany'](db[_0xd0a6('0xc3')],{'as':_0xd0a6('0x1a6'),'onDelete':_0xd0a6('0x108'),'foreignKey':_0xd0a6('0x1a7')});db[_0xd0a6('0xc1')][_0xd0a6('0x10d')](db[_0xd0a6('0xc3')],{'as':_0xd0a6('0x1a8'),'onDelete':_0xd0a6('0x108'),'foreignKey':_0xd0a6('0x1a9')});db['FreshdeskConfiguration'][_0xd0a6('0x10d')](db['FreshdeskField'],{'as':_0xd0a6('0x1a3'),'onDelete':'cascade','foreignKey':_0xd0a6('0x1aa')});db[_0xd0a6('0xc1')][_0xd0a6('0x115')](db[_0xd0a6('0xbf')],{'as':_0xd0a6('0x15f'),'foreignKey':_0xd0a6('0x1a5')});db[_0xd0a6('0xc1')][_0xd0a6('0x117')](db[_0xd0a6('0x96')],{'through':'int_freshdesk_configuration_has_tags'});db[_0xd0a6('0xc3')][_0xd0a6('0x10d')](db[_0xd0a6('0xc3')],{'as':_0xd0a6('0x1ab'),'foreignKey':_0xd0a6('0x1a7')});db[_0xd0a6('0xc3')][_0xd0a6('0x10d')](db[_0xd0a6('0xc3')],{'as':_0xd0a6('0x1ac'),'foreignKey':_0xd0a6('0x1a9')});db[_0xd0a6('0xc3')][_0xd0a6('0x10d')](db['FreshdeskField'],{'as':'Field','foreignKey':'FieldId'});db[_0xd0a6('0xc3')][_0xd0a6('0x115')](db['Variable'],{'as':'Variable','foreignKey':_0xd0a6('0x1b1')});db[_0xd0a6('0xc4')]['hasMany'](db[_0xd0a6('0xc5')],{'as':_0xd0a6('0x1af'),'onDelete':_0xd0a6('0x108'),'foreignKey':_0xd0a6('0x1a5')});db[_0xd0a6('0xc5')][_0xd0a6('0x10d')](db[_0xd0a6('0xc7')],{'as':_0xd0a6('0x1a6'),'foreignKey':_0xd0a6('0x1a7')});db['VtigerConfiguration'][_0xd0a6('0x10d')](db[_0xd0a6('0xc7')],{'as':_0xd0a6('0x1a8'),'foreignKey':_0xd0a6('0x1a9')});db[_0xd0a6('0xc5')]['hasMany'](db[_0xd0a6('0xc7')],{'as':_0xd0a6('0x1a3'),'foreignKey':_0xd0a6('0x1aa')});db['VtigerConfiguration'][_0xd0a6('0x115')](db['VtigerAccount'],{'as':_0xd0a6('0x15f'),'foreignKey':_0xd0a6('0x1a5')});db['VtigerField'][_0xd0a6('0x10d')](db[_0xd0a6('0xc7')],{'as':_0xd0a6('0x1ab'),'foreignKey':_0xd0a6('0x1a7')});db[_0xd0a6('0xc7')]['hasMany'](db[_0xd0a6('0xc7')],{'as':_0xd0a6('0x1ac'),'foreignKey':_0xd0a6('0x1a9')});db[_0xd0a6('0xc7')][_0xd0a6('0x10d')](db[_0xd0a6('0xc7')],{'as':_0xd0a6('0x1ad'),'foreignKey':'FieldId'});db[_0xd0a6('0xc7')][_0xd0a6('0x115')](db[_0xd0a6('0x1ae')],{'as':'Variable','foreignKey':_0xd0a6('0x1b1')});db['ServicenowAccount']['hasMany'](db[_0xd0a6('0x1b6')],{'as':_0xd0a6('0x1af'),'onDelete':'cascade','foreignKey':_0xd0a6('0x1a5')});db[_0xd0a6('0x1b6')][_0xd0a6('0x10d')](db[_0xd0a6('0xcc')],{'as':_0xd0a6('0x1a6'),'foreignKey':_0xd0a6('0x1a7')});db['ServicenowConfiguration'][_0xd0a6('0x10d')](db[_0xd0a6('0xcc')],{'as':_0xd0a6('0x1a8'),'foreignKey':'DescriptionId'});db[_0xd0a6('0x1b6')][_0xd0a6('0x10d')](db['ServicenowField'],{'as':_0xd0a6('0x1a3'),'foreignKey':'FieldId'});db[_0xd0a6('0x1b6')][_0xd0a6('0x115')](db[_0xd0a6('0xc9')],{'as':_0xd0a6('0x15f'),'foreignKey':_0xd0a6('0x1a5')});db['ServicenowField'][_0xd0a6('0x10d')](db['ServicenowField'],{'as':_0xd0a6('0x1ab'),'foreignKey':'SubjectId'});db['ServicenowField'][_0xd0a6('0x10d')](db[_0xd0a6('0xcc')],{'as':_0xd0a6('0x1ac'),'foreignKey':'DescriptionId'});db['ServicenowField'][_0xd0a6('0x10d')](db[_0xd0a6('0xcc')],{'as':_0xd0a6('0x1ad'),'foreignKey':_0xd0a6('0x1aa')});db[_0xd0a6('0xcc')][_0xd0a6('0x115')](db[_0xd0a6('0x1ae')],{'as':_0xd0a6('0x1ae'),'foreignKey':_0xd0a6('0x1b1')});db[_0xd0a6('0xce')][_0xd0a6('0x10d')](db['Dynamics365Configuration'],{'as':_0xd0a6('0x1af'),'onDelete':_0xd0a6('0x108'),'foreignKey':_0xd0a6('0x1a5')});db[_0xd0a6('0xcf')][_0xd0a6('0x10d')](db['Dynamics365Field'],{'as':_0xd0a6('0x1a6'),'onDelete':_0xd0a6('0x108'),'foreignKey':_0xd0a6('0x1a7')});db['Dynamics365Configuration'][_0xd0a6('0x10d')](db[_0xd0a6('0xd1')],{'as':_0xd0a6('0x1a8'),'onDelete':_0xd0a6('0x108'),'foreignKey':_0xd0a6('0x1a9')});db[_0xd0a6('0xcf')][_0xd0a6('0x10d')](db[_0xd0a6('0xd1')],{'as':_0xd0a6('0x1a3'),'onDelete':_0xd0a6('0x108'),'foreignKey':'FieldId'});db[_0xd0a6('0xcf')][_0xd0a6('0x115')](db[_0xd0a6('0xce')],{'as':_0xd0a6('0x15f'),'foreignKey':_0xd0a6('0x1a5')});db['Dynamics365Field']['hasMany'](db[_0xd0a6('0xd1')],{'as':'Subject','foreignKey':'SubjectId'});db[_0xd0a6('0xd1')][_0xd0a6('0x10d')](db[_0xd0a6('0xd1')],{'as':_0xd0a6('0x1ac'),'foreignKey':'DescriptionId'});db[_0xd0a6('0xd1')]['hasMany'](db['Dynamics365Field'],{'as':_0xd0a6('0x1ad'),'foreignKey':_0xd0a6('0x1aa')});db[_0xd0a6('0xd1')][_0xd0a6('0x115')](db[_0xd0a6('0x1ae')],{'as':_0xd0a6('0x1ae'),'foreignKey':_0xd0a6('0x1b1')});db[_0xd0a6('0x1b7')]['hasMany'](db[_0xd0a6('0xd3')],{'as':_0xd0a6('0x1af'),'onDelete':_0xd0a6('0x108'),'foreignKey':_0xd0a6('0x1a5')});db[_0xd0a6('0xd3')][_0xd0a6('0x10d')](db[_0xd0a6('0xd5')],{'as':_0xd0a6('0x1a6'),'foreignKey':_0xd0a6('0x1a7')});db[_0xd0a6('0xd3')][_0xd0a6('0x10d')](db[_0xd0a6('0xd5')],{'as':_0xd0a6('0x1a8'),'foreignKey':_0xd0a6('0x1a9')});db[_0xd0a6('0xd3')]['hasMany'](db[_0xd0a6('0xd5')],{'as':_0xd0a6('0x1a3'),'foreignKey':_0xd0a6('0x1aa')});db[_0xd0a6('0xd3')][_0xd0a6('0x115')](db[_0xd0a6('0x1b7')],{'as':_0xd0a6('0x15f'),'foreignKey':_0xd0a6('0x1a5')});db[_0xd0a6('0xd5')][_0xd0a6('0x10d')](db[_0xd0a6('0xd5')],{'as':_0xd0a6('0x1ab'),'foreignKey':_0xd0a6('0x1a7')});db[_0xd0a6('0xd5')][_0xd0a6('0x10d')](db[_0xd0a6('0xd5')],{'as':_0xd0a6('0x1ac'),'foreignKey':_0xd0a6('0x1a9')});db[_0xd0a6('0xd5')][_0xd0a6('0x10d')](db[_0xd0a6('0xd5')],{'as':_0xd0a6('0x1ad'),'foreignKey':_0xd0a6('0x1aa')});db[_0xd0a6('0xd5')]['belongsTo'](db[_0xd0a6('0x1ae')],{'as':_0xd0a6('0x1ae'),'foreignKey':_0xd0a6('0x1b1')});db['ChatQueueReport'][_0xd0a6('0x115')](db[_0xd0a6('0x68')],{});db['ChatQueueReport'][_0xd0a6('0x115')](db['CmList'],{'as':'List','foreignKey':_0xd0a6('0x15a')});db['ChatQueueReport'][_0xd0a6('0x115')](db['CmContact'],{'as':_0xd0a6('0x14f'),'foreignKey':'ContactId'});db[_0xd0a6('0xd9')][_0xd0a6('0x115')](db[_0xd0a6('0x6c')],{});db[_0xd0a6('0xd9')][_0xd0a6('0x115')](db[_0xd0a6('0x6e')],{});db[_0xd0a6('0xd9')][_0xd0a6('0x115')](db[_0xd0a6('0x13')],{});db['ChatQueueReport'][_0xd0a6('0x115')](db['ChatQueue'],{});db[_0xd0a6('0xdb')][_0xd0a6('0x115')](db[_0xd0a6('0x13')],{'onDelete':'cascade','foreignKey':_0xd0a6('0x1b8')});db[_0xd0a6('0xdb')]['belongsTo'](db['User'],{'onDelete':'cascade','foreignKey':_0xd0a6('0x1b9')});db[_0xd0a6('0xe0')][_0xd0a6('0x10d')](db['JscriptyQuestionReport'],{'foreignKey':_0xd0a6('0x1ba'),'onDelete':_0xd0a6('0x108')});db['JscriptySessionReport'][_0xd0a6('0x10d')](db[_0xd0a6('0xdc')],{'foreignKey':_0xd0a6('0x1ba'),'onDelete':_0xd0a6('0x108')});db['SmsQueueReport'][_0xd0a6('0x115')](db[_0xd0a6('0x56')],{});db[_0xd0a6('0xe1')][_0xd0a6('0x115')](db['CmList'],{'as':'List','foreignKey':_0xd0a6('0x15a')});db[_0xd0a6('0xe1')][_0xd0a6('0x115')](db['CmContact'],{'as':'Contact','foreignKey':_0xd0a6('0x150')});db[_0xd0a6('0xe1')][_0xd0a6('0x115')](db[_0xd0a6('0x5a')],{});db[_0xd0a6('0xe1')][_0xd0a6('0x115')](db[_0xd0a6('0x5c')],{});db[_0xd0a6('0xe1')][_0xd0a6('0x115')](db[_0xd0a6('0x13')],{});db['SmsQueueReport']['belongsTo'](db[_0xd0a6('0x5e')],{});db['JscriptyProject']['hasMany'](db[_0xd0a6('0xe0')],{'foreignKey':_0xd0a6('0x1bb')});db['JscriptyProject']['hasMany'](db[_0xd0a6('0xde')],{'foreignKey':_0xd0a6('0x1bb')});db['JscriptyProject'][_0xd0a6('0x10d')](db['JscriptyAnswerReport'],{'foreignKey':'ProjectId'});db[_0xd0a6('0xeb')]['belongsToMany'](db[_0xd0a6('0x13')],{'as':'Users','through':_0xd0a6('0x134')});db[_0xd0a6('0x11b')][_0xd0a6('0x117')](db[_0xd0a6('0x13')],{'as':_0xd0a6('0x15c'),'through':_0xd0a6('0x11c')});db['Team'][_0xd0a6('0x117')](db[_0xd0a6('0x1d')],{'through':_0xd0a6('0x146'),'as':'VoiceQueues'});db[_0xd0a6('0x11b')][_0xd0a6('0x117')](db['MailQueue'],{'through':_0xd0a6('0x15d'),'as':_0xd0a6('0x125')});db[_0xd0a6('0x11b')][_0xd0a6('0x117')](db[_0xd0a6('0x71')],{'through':_0xd0a6('0x185'),'as':_0xd0a6('0x126')});db['Team'][_0xd0a6('0x117')](db[_0xd0a6('0x52')],{'through':_0xd0a6('0x171'),'as':_0xd0a6('0x127')});db['Team']['belongsToMany'](db[_0xd0a6('0x5e')],{'through':_0xd0a6('0x177'),'as':_0xd0a6('0x128')});db[_0xd0a6('0x11b')][_0xd0a6('0x117')](db[_0xd0a6('0x66')],{'through':_0xd0a6('0x17c'),'as':_0xd0a6('0x1bc')});db[_0xd0a6('0xf2')]['hasMany'](db['CmHopper'],{'as':'Hoppers','foreignKey':_0xd0a6('0x18d')});db['Campaign'][_0xd0a6('0x10d')](db['CmHopperFinal'],{'as':'HopperFinals','foreignKey':_0xd0a6('0x18d')});db[_0xd0a6('0xf2')][_0xd0a6('0x10d')](db[_0xd0a6('0x81')],{'as':_0xd0a6('0x13b'),'foreignKey':_0xd0a6('0x18d')});db[_0xd0a6('0xf2')][_0xd0a6('0x10d')](db[_0xd0a6('0x7d')],{'as':_0xd0a6('0x13c'),'foreignKey':_0xd0a6('0x18d')});db[_0xd0a6('0xf2')][_0xd0a6('0x115')](db[_0xd0a6('0x2d')],{'as':'Trunk','foreignKey':_0xd0a6('0x13e')});db[_0xd0a6('0xf2')][_0xd0a6('0x115')](db['Trunk'],{'as':_0xd0a6('0x13f'),'foreignKey':_0xd0a6('0x140')});db[_0xd0a6('0xf2')]['belongsTo'](db[_0xd0a6('0x8f')],{'as':'Interval','foreignKey':_0xd0a6('0x141')});db[_0xd0a6('0xf2')][_0xd0a6('0x115')](db[_0xd0a6('0xeb')],{'as':_0xd0a6('0xeb'),'foreignKey':_0xd0a6('0x1bd')});db['Campaign'][_0xd0a6('0x117')](db[_0xd0a6('0x12a')],{'as':_0xd0a6('0x11a'),'through':_0xd0a6('0x1be')});db[_0xd0a6('0xf2')][_0xd0a6('0x117')](db[_0xd0a6('0x12a')],{'as':_0xd0a6('0x147'),'through':_0xd0a6('0x1bf')});db[_0xd0a6('0x1c0')][_0xd0a6('0x115')](db[_0xd0a6('0x45')],{});db[_0xd0a6('0x1c0')][_0xd0a6('0x115')](db[_0xd0a6('0x43')],{});db['MailTransferReport']['belongsTo'](db[_0xd0a6('0x151')],{'foreignKey':_0xd0a6('0x1c1'),'as':_0xd0a6('0x1c2')});db[_0xd0a6('0x1c0')][_0xd0a6('0x115')](db[_0xd0a6('0x13')],{'foreignKey':'FromUserId','as':_0xd0a6('0x1c3')});db['MailTransferReport'][_0xd0a6('0x115')](db[_0xd0a6('0x13')],{'foreignKey':_0xd0a6('0x1c4'),'as':_0xd0a6('0x1c5')});db[_0xd0a6('0x1c0')][_0xd0a6('0x115')](db[_0xd0a6('0x124')],{'foreignKey':_0xd0a6('0x1c6'),'as':_0xd0a6('0x1c7')});db[_0xd0a6('0x1c0')]['belongsTo'](db[_0xd0a6('0x151')],{'foreignKey':_0xd0a6('0x1c8'),'as':_0xd0a6('0x1c9')});db[_0xd0a6('0xf8')]['belongsTo'](db[_0xd0a6('0x6e')],{});db['ChatTransferReport'][_0xd0a6('0x115')](db['ChatInteraction'],{});db['ChatTransferReport']['belongsTo'](db[_0xd0a6('0x68')],{'foreignKey':_0xd0a6('0x1ca'),'as':_0xd0a6('0x1c2')});db[_0xd0a6('0xf8')][_0xd0a6('0x115')](db['User'],{'foreignKey':_0xd0a6('0x1cb'),'as':_0xd0a6('0x1c3')});db['ChatTransferReport'][_0xd0a6('0x115')](db[_0xd0a6('0x13')],{'foreignKey':_0xd0a6('0x1c4'),'as':_0xd0a6('0x1c5')});db[_0xd0a6('0xf8')][_0xd0a6('0x115')](db[_0xd0a6('0x71')],{'foreignKey':_0xd0a6('0x1cc'),'as':_0xd0a6('0x1c7')});db[_0xd0a6('0xf8')][_0xd0a6('0x115')](db['ChatWebsite'],{'foreignKey':_0xd0a6('0x1cd'),'as':_0xd0a6('0x1c9')});db[_0xd0a6('0xf9')][_0xd0a6('0x115')](db[_0xd0a6('0x51')],{});db[_0xd0a6('0xf9')][_0xd0a6('0x115')](db[_0xd0a6('0x113')],{});db[_0xd0a6('0xf9')][_0xd0a6('0x115')](db['FaxAccount'],{'foreignKey':'FromFaxAccountId','as':_0xd0a6('0x1c2')});db[_0xd0a6('0xf9')]['belongsTo'](db['User'],{'foreignKey':_0xd0a6('0x1cb'),'as':'FromAgent'});db[_0xd0a6('0xf9')]['belongsTo'](db[_0xd0a6('0x13')],{'foreignKey':_0xd0a6('0x1c4'),'as':_0xd0a6('0x1c5')});db[_0xd0a6('0xf9')][_0xd0a6('0x115')](db[_0xd0a6('0x52')],{'foreignKey':_0xd0a6('0x1ce'),'as':_0xd0a6('0x1c7')});db[_0xd0a6('0xf9')]['belongsTo'](db[_0xd0a6('0x4e')],{'foreignKey':_0xd0a6('0x1cf'),'as':_0xd0a6('0x1c9')});db[_0xd0a6('0xfb')][_0xd0a6('0x115')](db[_0xd0a6('0x65')],{});db[_0xd0a6('0xfb')][_0xd0a6('0x115')](db[_0xd0a6('0x64')],{});db[_0xd0a6('0xfb')][_0xd0a6('0x115')](db[_0xd0a6('0x60')],{'foreignKey':_0xd0a6('0x1d0'),'as':_0xd0a6('0x1c2')});db[_0xd0a6('0xfb')]['belongsTo'](db[_0xd0a6('0x13')],{'foreignKey':_0xd0a6('0x1cb'),'as':_0xd0a6('0x1c3')});db['OpenchannelTransferReport'][_0xd0a6('0x115')](db[_0xd0a6('0x13')],{'foreignKey':'ToUserId','as':'ToAgent'});db['OpenchannelTransferReport'][_0xd0a6('0x115')](db['OpenchannelQueue'],{'foreignKey':_0xd0a6('0x1d1'),'as':'ToQueue'});db['OpenchannelTransferReport'][_0xd0a6('0x115')](db[_0xd0a6('0x60')],{'foreignKey':_0xd0a6('0x1d2'),'as':_0xd0a6('0x1c9')});db[_0xd0a6('0xfd')]['belongsTo'](db[_0xd0a6('0x5c')],{});db['SmsTransferReport']['belongsTo'](db[_0xd0a6('0x5a')],{});db[_0xd0a6('0xfd')][_0xd0a6('0x115')](db[_0xd0a6('0x56')],{'foreignKey':_0xd0a6('0x1d3'),'as':_0xd0a6('0x1c2')});db[_0xd0a6('0xfd')]['belongsTo'](db['User'],{'foreignKey':'FromUserId','as':'FromAgent'});db[_0xd0a6('0xfd')][_0xd0a6('0x115')](db[_0xd0a6('0x13')],{'foreignKey':_0xd0a6('0x1c4'),'as':_0xd0a6('0x1c5')});db[_0xd0a6('0xfd')][_0xd0a6('0x115')](db[_0xd0a6('0x5e')],{'foreignKey':'ToSmsQueueId','as':'ToQueue'});db['SmsTransferReport'][_0xd0a6('0x115')](db[_0xd0a6('0x56')],{'foreignKey':_0xd0a6('0x1d4'),'as':'ToAccount'});db[_0xd0a6('0x12a')][_0xd0a6('0x10d')](db['Disposition'],{'as':_0xd0a6('0x156'),'foreignKey':'ListId'});db[_0xd0a6('0x12a')]['hasMany'](db[_0xd0a6('0x84')],{'as':_0xd0a6('0x1d5'),'foreignKey':'ListId'});db[_0xd0a6('0x12a')][_0xd0a6('0x10d')](db[_0xd0a6('0x79')],{'as':_0xd0a6('0x119'),'onDelete':'cascade','foreignKey':_0xd0a6('0x15a')});db[_0xd0a6('0x12a')][_0xd0a6('0x10d')](db['CmHopperFinal'],{'as':_0xd0a6('0x187'),'foreignKey':_0xd0a6('0x15a')});db[_0xd0a6('0x12a')][_0xd0a6('0x10d')](db[_0xd0a6('0x81')],{'as':_0xd0a6('0x10f'),'foreignKey':'ListId'});db[_0xd0a6('0x12a')]['hasMany'](db['ReportAgentPreview'],{'as':_0xd0a6('0x83'),'foreignKey':_0xd0a6('0x15a')});db['CmList']['belongsToMany'](db[_0xd0a6('0x1d')],{'as':_0xd0a6('0x1d6'),'through':_0xd0a6('0x144')});db[_0xd0a6('0x12a')][_0xd0a6('0x117')](db['User'],{'as':_0xd0a6('0x15c'),'through':_0xd0a6('0x1d7')});db[_0xd0a6('0x100')][_0xd0a6('0x10d')](db[_0xd0a6('0x1a')],{'as':_0xd0a6('0x10e'),'onDelete':_0xd0a6('0x167')});db[_0xd0a6('0x100')]['belongsToMany'](db['User'],{'as':_0xd0a6('0x15c'),'through':_0xd0a6('0x12c')});db[_0xd0a6('0x102')][_0xd0a6('0x10d')](db[_0xd0a6('0x13')],{'as':_0xd0a6('0x164'),'foreignKey':_0xd0a6('0x116')});db[_0xd0a6('0x102')][_0xd0a6('0x10d')](db[_0xd0a6('0x104')],{'as':_0xd0a6('0x1d8'),'foreignKey':_0xd0a6('0x116'),'onDelete':_0xd0a6('0x108')});db['UserProfileSection'][_0xd0a6('0x10d')](db[_0xd0a6('0x106')],{'as':_0xd0a6('0x1d9'),'foreignKey':_0xd0a6('0x1da'),'onDelete':_0xd0a6('0x108')});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file +var _0x626d=['TemplateId','mandatoryDispositionPauseId','team_has_mail_queues','Teams','MailInteractionId','Account','mail_interaction_has_tags','ThroughTags','Attachment','Attachments','Contact','Interaction','restrict','IntervalId','TagId','Items','FaxAccountId','Exntensions','user_has_fax_accounts','FaxInteractionId','Owner','fax_interaction_has_tags','Tags','Users','AttachmentId','SmsAccountId','SmsApplication','user_has_sms_accounts','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','user_has_openchannel_interactions','team_has_openchannel_queues','ChatWebsite','ChatWebsiteId','ChatProactiveAction','ProactiveActions','ChatMessage','Agent','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','ChatGroupId','Company','CompanyId','cm_contact_has_tags','Campaign','CampaignId','Condition','All','AutomationAllId','Any','OneAny','AutomationAnyId','Actions','MailApplications','ChatApplications','SmsApplications','DefaultReportId','CustomReportId','Mohs','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','TriggerId','Fields','MetricId','SalesforceConfiguration','Configurations','AccountId','SalesforceField','SubjectId','Descriptions','DescriptionId','Subject','Description','Field','FieldId','VariableId','SugarcrmAccount','Subjects','SugarcrmConfiguration','DeskAccount','int_desk_configuration_has_tags','ZohoConfiguration','ZohoField','ZendeskField','int_zendesk_configuration_has_tags','int_freshdesk_configuration_has_tags','ServicenowAccount','ServicenowConfiguration','Dynamics365Field','FreshsalesConfiguration','FreshsalesField','ChatQueueReport','FromId','SessionId','JscriptyProject','ProjectId','team_has_fax_queues','TrunkBackup','TrunkBackupId','SquareProjectId','campaigns_has_cm_lists','FromMailAccountId','FromAgent','ToUserId','ToAgent','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','ToChatWebsiteId','FromFaxAccountId','FromAccount','FromUserId','ToFaxQueueId','FromOpenchannelAccountId','ToOpenchannelAccountId','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','Queues','userProfileId','UserProfileSections','Resources','exports','path','jstz','sequelize','defaultsDeep','motion2','xcall','127.0.0.1','mysql','utf8mb4','name','utf8','sequelizeHistory','utf8_general_ci','database','username','password','options','User','../api/user/user.model','import','VoiceContext','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','../api/screenRecording/screenRecording.model','VoiceMail','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','../api/trunk/trunk.model','VoiceTransferReport','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','MailServerIn','MailServerOut','../api/mailServerOut/mailServerOut.model','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','MailQueueReport','Dashboard','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','../api/smsApplication/smsApplication.model','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','../api/chatInteraction/chatInteraction.model','../api/chatMessage/chatMessage.model','ChatOfflineMessage','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','CmCompany','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/cmCustomField/cmCustomField.model','Action','../api/action/action.model','Automation','../api/automation/automation.model','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/condition/condition.model','Interval','../api/interval/interval.model','Pause','../api/pause/pause.model','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','Sound','Tag','Template','../api/template/template.model','Trigger','Variable','Integration','../api/integration/integration.model','IntegrationReport','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticMetric','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','../api/intSalesforceField/intSalesforceField.model','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','../api/intZohoConfiguration/intZohoConfiguration.model','../api/intZohoField/intZohoField.model','ZendeskAccount','ZendeskConfiguration','FreshdeskAccount','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','VtigerAccount','VtigerConfiguration','VtigerField','../api/intVtigerField/intVtigerField.model','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','FreshsalesAccount','../api/intFreshsalesField/intFreshsalesField.model','Network','../api/network/network.model','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','../api/jscriptyProject/jscriptyProject.model','Setting','SquareOdbc','SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','../api/license/license.model','../api/campaign/campaign.model','Migration','../api/migration/migration.model','../api/attachment/attachment.model','Plugin','MailTransferReport','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','CmList','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','UserProfileSection','UserProfileResource','../api/userProfileResource/userProfileResource.model','hasOne','cascade','hasMany','UserId','Extensions','HopperFinals','HopperHistory','OpenchannelInteractions','ChatInteraction','ChatInteractions','SmsInteraction','SmsInteractions','FaxInteraction','FaxInteractions','belongsTo','belongsToMany','chat_group_has_users','Contacts','cm_user_has_contacts','user_has_teams','MailInteractions','user_has_mail_interactions','user_has_chat_interactions','user_has_fax_interactions','user_has_sms_interactions','VoiceQueues','MailQueues','ChatQueues','UserChatQueue','FaxQueues','SmsQueues','OpenchannelQueues','cm_user_has_lists','VoicePrefixes','user_has_voice_prefixes','user_has_chat_websites','FaxAccounts','MailAccount','user_has_mail_accounts','user_has_openchannel_accounts','SmsAccounts','SquareProject','user_has_square_projects','Applications','Sounds','moh_has_sounds','Members','VoiceQueueId','Hoppers','HopperHistories','HopperBlacks','JscriptySessions','Trunk','TrunkId','mandatoryDispositionPause','Lists','voice_queues_has_cm_lists','Agents','team_has_voice_queues','BlackLists','voice_queues_has_cm_blacklists','ScreenRecording','Messages','mailbox','mailboxuser','QueueCalls','AgentReports','uniqueid','ContactId','MailAccountId','Imap','Dispositions','CannedAnswer','Answers','Interactions','List','ListId'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x626d,0x89));var _0xd626=function(_0x3a5a7f,_0x194952){_0x3a5a7f=_0x3a5a7f-0x0;var _0x5625c1=_0x626d[_0x3a5a7f];return _0x5625c1;};'use strict';var path=require(_0xd626('0x0'));var config=require('../config/environment');var Sequelize=require('sequelize');var _=require('lodash');var jstz=require(_0xd626('0x1'));var timezone=jstz['determine']();config[_0xd626('0x2')]=_[_0xd626('0x3')](config[_0xd626('0x2')],{'database':_0xd626('0x4'),'username':_0xd626('0x5'),'password':'xC@LL1234','options':{'host':_0xd626('0x6'),'port':0xcea,'dialect':_0xd626('0x7'),'dialectOptions':{'charset':_0xd626('0x8')},'logging':![],'timezone':timezone[_0xd626('0x9')](),'define':{'charset':_0xd626('0xa'),'collate':'utf8_general_ci'}}});config[_0xd626('0xb')]=_[_0xd626('0x3')](config[_0xd626('0xb')],{'database':'motion2','username':_0xd626('0x5'),'password':'xC@LL1234','options':{'host':_0xd626('0x6'),'port':0xcea,'dialect':_0xd626('0x7'),'dialectOptions':{'charset':_0xd626('0x8')},'logging':![],'timezone':timezone[_0xd626('0x9')](),'define':{'charset':_0xd626('0xa'),'collate':_0xd626('0xc')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xd626('0x2')][_0xd626('0xd')],config['sequelize'][_0xd626('0xe')],config[_0xd626('0x2')][_0xd626('0xf')],config['sequelize'][_0xd626('0x10')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xd626('0xb')]['database'],config['sequelizeHistory'][_0xd626('0xe')],config[_0xd626('0xb')]['password'],config[_0xd626('0xb')]['options'])};db[_0xd626('0x11')]=db[_0xd626('0x2')]['import'](_0xd626('0x12'));db['VoiceChanSpy']=db[_0xd626('0x2')][_0xd626('0x13')]('../api/voiceChanSpy/voiceChanSpy.model');db[_0xd626('0x14')]=db['sequelize']['import'](_0xd626('0x15'));db[_0xd626('0x16')]=db[_0xd626('0x2')][_0xd626('0x13')](_0xd626('0x17'));db[_0xd626('0x18')]=db[_0xd626('0x2')][_0xd626('0x13')]('../api/voiceMusicOnHold/voiceMusicOnHold.model');db[_0xd626('0x19')]=db[_0xd626('0x2')][_0xd626('0x13')](_0xd626('0x1a'));db[_0xd626('0x1b')]=db['sequelize'][_0xd626('0x13')](_0xd626('0x1c'));db['ScreenRecording']=db['sequelize']['import'](_0xd626('0x1d'));db[_0xd626('0x1e')]=db[_0xd626('0x2')][_0xd626('0x13')]('../api/voiceMail/voiceMail.model');db[_0xd626('0x1f')]=db[_0xd626('0x2')][_0xd626('0x13')](_0xd626('0x20'));db[_0xd626('0x21')]=db[_0xd626('0x2')][_0xd626('0x13')]('../api/voiceCallReport/voiceCallReport.model');db['VoiceDialReport']=db['sequelize'][_0xd626('0x13')](_0xd626('0x22'));db[_0xd626('0x23')]=db[_0xd626('0x2')][_0xd626('0x13')](_0xd626('0x24'));db[_0xd626('0x25')]=db['sequelize'][_0xd626('0x13')](_0xd626('0x26'));db[_0xd626('0x27')]=db[_0xd626('0x2')]['import'](_0xd626('0x28'));db['Trunk']=db[_0xd626('0x2')][_0xd626('0x13')](_0xd626('0x29'));db[_0xd626('0x2a')]=db['sequelize'][_0xd626('0x13')]('../api/voiceTransferReport/voiceTransferReport.model');db[_0xd626('0x2b')]=db[_0xd626('0x2')][_0xd626('0x13')](_0xd626('0x2c'));db[_0xd626('0x2d')]=db['sequelize'][_0xd626('0x13')](_0xd626('0x2e'));db['UserChatQueue']=db[_0xd626('0x2')]['import'](_0xd626('0x2f'));db[_0xd626('0x30')]=db['sequelize']['import'](_0xd626('0x31'));db[_0xd626('0x32')]=db[_0xd626('0x2')]['import'](_0xd626('0x33'));db[_0xd626('0x34')]=db[_0xd626('0x2')]['import'](_0xd626('0x35'));db[_0xd626('0x36')]=db['sequelize']['import'](_0xd626('0x37'));db[_0xd626('0x38')]=db[_0xd626('0x2')][_0xd626('0x13')]('../api/mailServerIn/mailServerIn.model');db[_0xd626('0x39')]=db['sequelize'][_0xd626('0x13')](_0xd626('0x3a'));db['MailAccount']=db[_0xd626('0x2')][_0xd626('0x13')]('../api/mailAccount/mailAccount.model');db[_0xd626('0x3b')]=db[_0xd626('0x2')][_0xd626('0x13')](_0xd626('0x3c'));db[_0xd626('0x3d')]=db['sequelize'][_0xd626('0x13')](_0xd626('0x3e'));db[_0xd626('0x3f')]=db['sequelize'][_0xd626('0x13')](_0xd626('0x40'));db[_0xd626('0x41')]=db[_0xd626('0x2')]['import'](_0xd626('0x42'));db[_0xd626('0x43')]=db[_0xd626('0x2')][_0xd626('0x13')]('../api/mailApplication/mailApplication.model');db[_0xd626('0x44')]=db[_0xd626('0x2')][_0xd626('0x13')]('../api/mailQueueReport/mailQueueReport.model');db[_0xd626('0x45')]=db[_0xd626('0x2')]['import']('../api/dashboard/dashboard.model');db[_0xd626('0x46')]=db['sequelize']['import'](_0xd626('0x47'));db[_0xd626('0x48')]=db[_0xd626('0x2')]['import'](_0xd626('0x49'));db[_0xd626('0x4a')]=db['sequelize']['import'](_0xd626('0x4b'));db['FaxInteraction']=db[_0xd626('0x2')]['import'](_0xd626('0x4c'));db[_0xd626('0x4d')]=db[_0xd626('0x2')][_0xd626('0x13')](_0xd626('0x4e'));db[_0xd626('0x4f')]=db[_0xd626('0x2')][_0xd626('0x13')](_0xd626('0x50'));db[_0xd626('0x51')]=db['sequelize'][_0xd626('0x13')](_0xd626('0x52'));db[_0xd626('0x53')]=db['sequelize'][_0xd626('0x13')](_0xd626('0x54'));db['SmsApplication']=db['sequelize'][_0xd626('0x13')](_0xd626('0x55'));db['SmsInteraction']=db['sequelize'][_0xd626('0x13')](_0xd626('0x56'));db[_0xd626('0x57')]=db['sequelize'][_0xd626('0x13')](_0xd626('0x58'));db[_0xd626('0x59')]=db[_0xd626('0x2')][_0xd626('0x13')]('../api/smsQueue/smsQueue.model');db[_0xd626('0x5a')]=db['sequelize']['import'](_0xd626('0x5b'));db[_0xd626('0x5c')]=db[_0xd626('0x2')]['import'](_0xd626('0x5d'));db[_0xd626('0x5e')]=db[_0xd626('0x2')][_0xd626('0x13')](_0xd626('0x5f'));db[_0xd626('0x60')]=db[_0xd626('0x2')][_0xd626('0x13')](_0xd626('0x61'));db[_0xd626('0x62')]=db[_0xd626('0x2')][_0xd626('0x13')]('../api/openchannelQueue/openchannelQueue.model');db['ChatWebsite']=db[_0xd626('0x2')][_0xd626('0x13')]('../api/chatWebsite/chatWebsite.model');db[_0xd626('0x63')]=db[_0xd626('0x2')]['import'](_0xd626('0x64'));db[_0xd626('0x65')]=db[_0xd626('0x2')][_0xd626('0x13')](_0xd626('0x66'));db['ChatInteraction']=db[_0xd626('0x2')]['import'](_0xd626('0x67'));db['ChatMessage']=db[_0xd626('0x2')][_0xd626('0x13')](_0xd626('0x68'));db[_0xd626('0x69')]=db[_0xd626('0x2')]['import']('../api/chatOfflineMessage/chatOfflineMessage.model');db[_0xd626('0x6a')]=db[_0xd626('0x2')][_0xd626('0x13')](_0xd626('0x6b'));db[_0xd626('0x6c')]=db[_0xd626('0x2')][_0xd626('0x13')](_0xd626('0x6d'));db['ChatProactiveAction']=db[_0xd626('0x2')]['import']('../api/chatProactiveAction/chatProactiveAction.model');db[_0xd626('0x6e')]=db['sequelize'][_0xd626('0x13')](_0xd626('0x6f'));db[_0xd626('0x70')]=db[_0xd626('0x2')][_0xd626('0x13')](_0xd626('0x71'));db[_0xd626('0x72')]=db[_0xd626('0x2')][_0xd626('0x13')](_0xd626('0x73'));db[_0xd626('0x74')]=db['sequelize'][_0xd626('0x13')](_0xd626('0x75'));db[_0xd626('0x76')]=db[_0xd626('0x2')][_0xd626('0x13')](_0xd626('0x77'));db[_0xd626('0x78')]=db[_0xd626('0x2')][_0xd626('0x13')](_0xd626('0x79'));db[_0xd626('0x7a')]=db['sequelize']['import'](_0xd626('0x7b'));db[_0xd626('0x7c')]=db[_0xd626('0x2')]['import'](_0xd626('0x7d'));db[_0xd626('0x7e')]=db['sequelize'][_0xd626('0x13')](_0xd626('0x7f'));db[_0xd626('0x80')]=db[_0xd626('0x2')]['import'](_0xd626('0x81'));db['CannedAnswer']=db['sequelize'][_0xd626('0x13')](_0xd626('0x82'));db[_0xd626('0x83')]=db[_0xd626('0x2')][_0xd626('0x13')]('../api/disposition/disposition.model');db['Condition']=db[_0xd626('0x2')][_0xd626('0x13')](_0xd626('0x84'));db[_0xd626('0x85')]=db[_0xd626('0x2')]['import'](_0xd626('0x86'));db[_0xd626('0x87')]=db[_0xd626('0x2')]['import'](_0xd626('0x88'));db['Cdr']=db['sequelize'][_0xd626('0x13')](_0xd626('0x89'));db[_0xd626('0x8a')]=db[_0xd626('0x2')]['import'](_0xd626('0x8b'));db[_0xd626('0x8c')]=db[_0xd626('0x2')]['import']('../api/schedule/schedule.model');db[_0xd626('0x8d')]=db['sequelize'][_0xd626('0x13')]('../api/sound/sound.model');db[_0xd626('0x8e')]=db[_0xd626('0x2')][_0xd626('0x13')]('../api/tag/tag.model');db[_0xd626('0x8f')]=db['sequelize'][_0xd626('0x13')](_0xd626('0x90'));db[_0xd626('0x91')]=db[_0xd626('0x2')][_0xd626('0x13')]('../api/trigger/trigger.model');db[_0xd626('0x92')]=db[_0xd626('0x2')]['import']('../api/variable/variable.model');db[_0xd626('0x93')]=db[_0xd626('0x2')]['import'](_0xd626('0x94'));db[_0xd626('0x95')]=db[_0xd626('0x2')][_0xd626('0x13')]('../api/integrationReport/integrationReport.model');db[_0xd626('0x96')]=db['sequelize'][_0xd626('0x13')](_0xd626('0x97'));db['AnalyticDefaultReport']=db[_0xd626('0x2')][_0xd626('0x13')]('../api/analyticDefaultReport/analyticDefaultReport.model');db['AnalyticExtractedReport']=db['sequelize']['import']('../api/analyticExtractedReport/analyticExtractedReport.model');db[_0xd626('0x98')]=db[_0xd626('0x2')][_0xd626('0x13')]('../api/analyticMetric/analyticMetric.model');db[_0xd626('0x99')]=db[_0xd626('0x2')]['import'](_0xd626('0x9a'));db[_0xd626('0x9b')]=db['sequelize'][_0xd626('0x13')]('../api/analyticTreeReport/analyticTreeReport.model');db[_0xd626('0x9c')]=db[_0xd626('0x2')][_0xd626('0x13')](_0xd626('0x9d'));db['SalesforceConfiguration']=db['sequelize'][_0xd626('0x13')](_0xd626('0x9e'));db['SalesforceField']=db[_0xd626('0x2')][_0xd626('0x13')](_0xd626('0x9f'));db['SugarcrmAccount']=db[_0xd626('0x2')][_0xd626('0x13')]('../api/intSugarcrmAccount/intSugarcrmAccount.model');db['SugarcrmConfiguration']=db[_0xd626('0x2')][_0xd626('0x13')](_0xd626('0xa0'));db[_0xd626('0xa1')]=db[_0xd626('0x2')]['import'](_0xd626('0xa2'));db['DeskAccount']=db[_0xd626('0x2')][_0xd626('0x13')](_0xd626('0xa3'));db[_0xd626('0xa4')]=db['sequelize']['import'](_0xd626('0xa5'));db[_0xd626('0xa6')]=db[_0xd626('0x2')]['import'](_0xd626('0xa7'));db[_0xd626('0xa8')]=db['sequelize'][_0xd626('0x13')](_0xd626('0xa9'));db['ZohoConfiguration']=db['sequelize']['import'](_0xd626('0xaa'));db['ZohoField']=db[_0xd626('0x2')][_0xd626('0x13')](_0xd626('0xab'));db[_0xd626('0xac')]=db[_0xd626('0x2')][_0xd626('0x13')]('../api/intZendeskAccount/intZendeskAccount.model');db[_0xd626('0xad')]=db['sequelize'][_0xd626('0x13')]('../api/intZendeskConfiguration/intZendeskConfiguration.model');db['ZendeskField']=db[_0xd626('0x2')]['import']('../api/intZendeskField/intZendeskField.model');db[_0xd626('0xae')]=db[_0xd626('0x2')][_0xd626('0x13')]('../api/intFreshdeskAccount/intFreshdeskAccount.model');db[_0xd626('0xaf')]=db[_0xd626('0x2')][_0xd626('0x13')](_0xd626('0xb0'));db[_0xd626('0xb1')]=db[_0xd626('0x2')][_0xd626('0x13')]('../api/intFreshdeskField/intFreshdeskField.model');db[_0xd626('0xb2')]=db['sequelize'][_0xd626('0x13')]('../api/intVtigerAccount/intVtigerAccount.model');db[_0xd626('0xb3')]=db['sequelize']['import']('../api/intVtigerConfiguration/intVtigerConfiguration.model');db[_0xd626('0xb4')]=db['sequelize']['import'](_0xd626('0xb5'));db['ServicenowAccount']=db['sequelize']['import']('../api/intServicenowAccount/intServicenowAccount.model');db['ServicenowConfiguration']=db[_0xd626('0x2')][_0xd626('0x13')](_0xd626('0xb6'));db[_0xd626('0xb7')]=db['sequelize'][_0xd626('0x13')](_0xd626('0xb8'));db[_0xd626('0xb9')]=db[_0xd626('0x2')][_0xd626('0x13')](_0xd626('0xba'));db[_0xd626('0xbb')]=db['sequelize'][_0xd626('0x13')](_0xd626('0xbc'));db['Dynamics365Field']=db[_0xd626('0x2')][_0xd626('0x13')]('../api/intDynamics365Field/intDynamics365Field.model');db[_0xd626('0xbd')]=db[_0xd626('0x2')][_0xd626('0x13')]('../api/intFreshsalesAccount/intFreshsalesAccount.model');db['FreshsalesConfiguration']=db[_0xd626('0x2')][_0xd626('0x13')]('../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model');db['FreshsalesField']=db['sequelize'][_0xd626('0x13')](_0xd626('0xbe'));db[_0xd626('0x93')]=db['sequelize'][_0xd626('0x13')](_0xd626('0x94'));db[_0xd626('0xbf')]=db['sequelize'][_0xd626('0x13')](_0xd626('0xc0'));db['ChatQueueReport']=db[_0xd626('0x2')][_0xd626('0x13')](_0xd626('0xc1'));db[_0xd626('0xc2')]=db[_0xd626('0x2')][_0xd626('0x13')](_0xd626('0xc3'));db[_0xd626('0xc4')]=db[_0xd626('0x2')]['import'](_0xd626('0xc5'));db[_0xd626('0xc6')]=db[_0xd626('0x2')][_0xd626('0x13')](_0xd626('0xc7'));db[_0xd626('0xc8')]=db[_0xd626('0x2')][_0xd626('0x13')]('../api/jscriptySessionReport/jscriptySessionReport.model');db[_0xd626('0xc9')]=db[_0xd626('0x2')][_0xd626('0x13')](_0xd626('0xca'));db['SquareReport']=db['sequelize'][_0xd626('0x13')]('../api/squareReport/squareReport.model');db[_0xd626('0xcb')]=db[_0xd626('0x2')]['import'](_0xd626('0xcc'));db['JscriptyProject']=db[_0xd626('0x2')][_0xd626('0x13')](_0xd626('0xcd'));db[_0xd626('0xce')]=db[_0xd626('0x2')][_0xd626('0x13')]('../api/setting/setting.model');db[_0xd626('0xcf')]=db['sequelize']['import']('../api/squareOdbc/squareOdbc.model');db['SquareProject']=db[_0xd626('0x2')][_0xd626('0x13')]('../api/squareProject/squareProject.model');db[_0xd626('0xd0')]=db[_0xd626('0x2')][_0xd626('0x13')](_0xd626('0xd1'));db[_0xd626('0xd2')]=db[_0xd626('0x2')][_0xd626('0x13')](_0xd626('0xd3'));db[_0xd626('0xd4')]=db[_0xd626('0x2')][_0xd626('0x13')](_0xd626('0xd5'));db['License']=db[_0xd626('0x2')][_0xd626('0x13')](_0xd626('0xd6'));db['Campaign']=db[_0xd626('0x2')][_0xd626('0x13')](_0xd626('0xd7'));db[_0xd626('0xd8')]=db['sequelize']['import'](_0xd626('0xd9'));db['Attachment']=db[_0xd626('0x2')][_0xd626('0x13')](_0xd626('0xda'));db[_0xd626('0xdb')]=db['sequelize'][_0xd626('0x13')]('../api/plugin/plugin.model');db[_0xd626('0xdc')]=db[_0xd626('0x2')]['import']('../api/mailTransferReport/mailTransferReport.model');db[_0xd626('0xdd')]=db['sequelize'][_0xd626('0x13')](_0xd626('0xde'));db[_0xd626('0xdf')]=db[_0xd626('0x2')]['import'](_0xd626('0xe0'));db[_0xd626('0xe1')]=db['sequelize']['import'](_0xd626('0xe2'));db[_0xd626('0xe3')]=db[_0xd626('0x2')][_0xd626('0x13')]('../api/smsTransferReport/smsTransferReport.model');db[_0xd626('0xe4')]=db[_0xd626('0x2')][_0xd626('0x13')](_0xd626('0xe5'));db[_0xd626('0xe6')]=db[_0xd626('0x2')][_0xd626('0x13')](_0xd626('0xe7'));db[_0xd626('0xe8')]=db[_0xd626('0x2')][_0xd626('0x13')]('../api/userProfile/userProfile.model');db[_0xd626('0xe9')]=db['sequelize'][_0xd626('0x13')]('../api/userProfileSection/userProfileSection.model');db[_0xd626('0xea')]=db[_0xd626('0x2')][_0xd626('0x13')](_0xd626('0xeb'));db['User'][_0xd626('0xec')](db[_0xd626('0x1e')],{'as':_0xd626('0x1e'),'onDelete':_0xd626('0xed'),'foreignKey':'UserId'});db[_0xd626('0x11')][_0xd626('0xee')](db[_0xd626('0x1b')],{'as':'Recordings','foreignKey':_0xd626('0xef')});db[_0xd626('0x11')][_0xd626('0xee')](db[_0xd626('0x2b')],{'as':'VoiceQueuesRt','foreignKey':'UserId'});db[_0xd626('0x11')][_0xd626('0xee')](db[_0xd626('0x16')],{'as':_0xd626('0xf0'),'onDelete':_0xd626('0xed'),'hooks':!![]});db[_0xd626('0x11')][_0xd626('0xee')](db['CmHopperFinal'],{'as':_0xd626('0xf1'),'foreignKey':_0xd626('0xef')});db['User'][_0xd626('0xee')](db[_0xd626('0x78')],{'as':_0xd626('0xf2'),'foreignKey':_0xd626('0xef')});db[_0xd626('0x11')][_0xd626('0xee')](db[_0xd626('0x7a')],{'as':_0xd626('0x7a'),'foreignKey':'UserId'});db['User'][_0xd626('0xee')](db[_0xd626('0x5e')],{'as':_0xd626('0xf3'),'foreignKey':_0xd626('0xef')});db[_0xd626('0x11')][_0xd626('0xee')](db[_0xd626('0xf4')],{'as':_0xd626('0xf5'),'foreignKey':'UserId'});db[_0xd626('0x11')][_0xd626('0xee')](db[_0xd626('0xf6')],{'as':_0xd626('0xf7'),'foreignKey':_0xd626('0xef')});db[_0xd626('0x11')]['hasMany'](db[_0xd626('0xf8')],{'as':_0xd626('0xf9'),'foreignKey':_0xd626('0xef')});db[_0xd626('0x11')]['hasMany'](db[_0xd626('0x3f')],{'as':'MailInteractions','foreignKey':'UserId'});db[_0xd626('0x11')][_0xd626('0xfa')](db['UserProfile'],{'as':_0xd626('0xe8'),'foreignKey':'userProfileId'});db['User'][_0xd626('0xfb')](db[_0xd626('0x6c')],{'as':'Groups','through':_0xd626('0xfc')});db['User'][_0xd626('0xfb')](db[_0xd626('0x70')],{'as':_0xd626('0xfd'),'through':_0xd626('0xfe')});db[_0xd626('0x11')][_0xd626('0xfb')](db[_0xd626('0xe4')],{'as':'Lists','through':'cm_user_has_lists'});db['User'][_0xd626('0xfb')](db[_0xd626('0xd4')],{'through':_0xd626('0xff')});db['User'][_0xd626('0xfb')](db['MailInteraction'],{'as':_0xd626('0x100'),'through':_0xd626('0x101')});db[_0xd626('0x11')][_0xd626('0xfb')](db[_0xd626('0xf4')],{'as':_0xd626('0xf5'),'through':_0xd626('0x102')});db['User'][_0xd626('0xfb')](db[_0xd626('0xf8')],{'as':'FaxInteractions','through':_0xd626('0x103')});db[_0xd626('0x11')][_0xd626('0xfb')](db[_0xd626('0xf6')],{'as':'SmsInteractions','through':_0xd626('0x104')});db['User'][_0xd626('0xfb')](db['OpenchannelInteraction'],{'as':_0xd626('0xf3'),'through':'user_has_openchannel_interactions'});db[_0xd626('0x11')]['belongsToMany'](db[_0xd626('0x19')],{'as':_0xd626('0x105'),'through':'UserVoiceQueue','required':![]});db[_0xd626('0x11')][_0xd626('0xfb')](db[_0xd626('0x3b')],{'as':_0xd626('0x106'),'through':_0xd626('0x30'),'required':![]});db[_0xd626('0x11')]['belongsToMany'](db['ChatQueue'],{'as':_0xd626('0x107'),'through':_0xd626('0x108'),'required':![],'hooks':!![]});db[_0xd626('0x11')][_0xd626('0xfb')](db['FaxQueue'],{'as':_0xd626('0x109'),'through':_0xd626('0x32'),'required':![]});db[_0xd626('0x11')][_0xd626('0xfb')](db[_0xd626('0x59')],{'as':_0xd626('0x10a'),'through':_0xd626('0x34'),'required':![]});db[_0xd626('0x11')]['belongsToMany'](db[_0xd626('0x62')],{'as':_0xd626('0x10b'),'through':_0xd626('0x36'),'required':![]});db[_0xd626('0x11')][_0xd626('0xfb')](db['CmList'],{'through':_0xd626('0x10c')});db[_0xd626('0x11')][_0xd626('0xfb')](db[_0xd626('0xe6')],{'as':_0xd626('0x10d'),'through':_0xd626('0x10e'),'required':![]});db[_0xd626('0x11')][_0xd626('0xfb')](db['ChatWebsite'],{'as':'ChatWebsites','through':_0xd626('0x10f')});db[_0xd626('0x11')][_0xd626('0xfb')](db[_0xd626('0x48')],{'as':_0xd626('0x110'),'through':'user_has_fax_accounts'});db[_0xd626('0x11')][_0xd626('0xfb')](db[_0xd626('0x111')],{'as':'MailAccounts','through':_0xd626('0x112')});db[_0xd626('0x11')][_0xd626('0xfb')](db[_0xd626('0x5a')],{'as':'OpenchannelAccounts','through':_0xd626('0x113')});db[_0xd626('0x11')][_0xd626('0xfb')](db[_0xd626('0x53')],{'as':_0xd626('0x114'),'through':'user_has_sms_accounts'});db['User'][_0xd626('0xfb')](db[_0xd626('0x115')],{'as':'SquareProjects','through':_0xd626('0x116')});db['VoiceChanSpy'][_0xd626('0xee')](db[_0xd626('0x16')],{'as':'SpiedAgents','onDelete':'cascade','foreignKey':'ChanSpyId'});db[_0xd626('0x14')]['hasMany'](db['VoiceExtension'],{'onDelete':_0xd626('0xed')});db[_0xd626('0x16')][_0xd626('0xee')](db[_0xd626('0x16')],{'as':_0xd626('0x117'),'onDelete':'cascade'});db[_0xd626('0x18')]['belongsToMany'](db['Sound'],{'as':_0xd626('0x118'),'through':_0xd626('0x119')});db[_0xd626('0x19')][_0xd626('0xee')](db[_0xd626('0x2b')],{'as':_0xd626('0x11a'),'foreignKey':_0xd626('0x11b')});db[_0xd626('0x19')][_0xd626('0xee')](db[_0xd626('0x72')],{'as':_0xd626('0x11c'),'foreignKey':_0xd626('0x11b')});db[_0xd626('0x19')]['hasMany'](db[_0xd626('0x76')],{'as':_0xd626('0xf1'),'foreignKey':_0xd626('0x11b')});db['VoiceQueue']['hasMany'](db[_0xd626('0x78')],{'as':_0xd626('0x11d'),'foreignKey':'VoiceQueueId'});db[_0xd626('0x19')][_0xd626('0xee')](db[_0xd626('0x7a')],{'as':'ReportAgentPreview','foreignKey':_0xd626('0x11b')});db['VoiceQueue'][_0xd626('0xee')](db[_0xd626('0x74')],{'as':_0xd626('0x11e'),'foreignKey':_0xd626('0x11b')});db[_0xd626('0x19')]['hasMany'](db[_0xd626('0xc8')],{'as':_0xd626('0x11f'),'foreignKey':_0xd626('0x11b')});db[_0xd626('0x19')][_0xd626('0xfa')](db[_0xd626('0x120')],{'as':_0xd626('0x120'),'foreignKey':_0xd626('0x121')});db[_0xd626('0x19')][_0xd626('0xfa')](db[_0xd626('0x120')],{'as':'TrunkBackup','foreignKey':'TrunkBackupId'});db[_0xd626('0x19')][_0xd626('0xfa')](db[_0xd626('0x85')],{'as':'Interval','foreignKey':'IntervalId'});db[_0xd626('0x19')][_0xd626('0xfa')](db[_0xd626('0x87')],{'as':_0xd626('0x122'),'foreignKey':'mandatoryDispositionPauseId'});db['VoiceQueue']['belongsToMany'](db[_0xd626('0xe4')],{'as':_0xd626('0x123'),'through':_0xd626('0x124')});db[_0xd626('0x19')]['belongsToMany'](db[_0xd626('0x11')],{'as':_0xd626('0x125'),'through':_0xd626('0x2d')});db[_0xd626('0x19')][_0xd626('0xfb')](db[_0xd626('0xd4')],{'as':'Teams','through':_0xd626('0x126')});db['VoiceQueue'][_0xd626('0xfb')](db[_0xd626('0xe4')],{'as':_0xd626('0x127'),'through':_0xd626('0x128')});db[_0xd626('0x1b')][_0xd626('0xfa')](db[_0xd626('0x11')],{'as':_0xd626('0x11'),'foreignKey':'UserId'});db[_0xd626('0x129')]['belongsTo'](db[_0xd626('0x11')],{'as':_0xd626('0x11'),'foreignKey':_0xd626('0xef')});db['VoiceMail'][_0xd626('0xee')](db[_0xd626('0x1f')],{'as':_0xd626('0x12a'),'onDelete':_0xd626('0xed'),'foreignKey':'mailboxuser','sourceKey':_0xd626('0x12b')});db[_0xd626('0x1f')][_0xd626('0xfa')](db['VoiceMail'],{'foreignKey':_0xd626('0x12c'),'targetKey':_0xd626('0x12b')});db[_0xd626('0x21')][_0xd626('0xee')](db[_0xd626('0x25')],{'as':_0xd626('0x12d'),'foreignKey':'uniqueid','constraints':![]});db['VoiceCallReport'][_0xd626('0xee')](db['VoiceAgentReport'],{'as':_0xd626('0x12e'),'foreignKey':_0xd626('0x12f'),'constraints':![]});db['VoiceCallReport'][_0xd626('0xfa')](db[_0xd626('0x11')],{'as':_0xd626('0x11'),'foreignKey':_0xd626('0xef')});db[_0xd626('0x21')]['belongsTo'](db[_0xd626('0x70')],{'as':'Contact','foreignKey':_0xd626('0x130')});db['MailServerIn'][_0xd626('0xfa')](db[_0xd626('0x111')],{'as':_0xd626('0x111'),'foreignKey':_0xd626('0x131')});db['MailServerOut'][_0xd626('0xfa')](db[_0xd626('0x111')],{'as':'MailAccount','foreignKey':_0xd626('0x131')});db[_0xd626('0x111')][_0xd626('0xec')](db[_0xd626('0x38')],{'as':_0xd626('0x132'),'onDelete':'cascade'});db[_0xd626('0x111')][_0xd626('0xec')](db[_0xd626('0x39')],{'as':'Smtp','onDelete':_0xd626('0xed')});db[_0xd626('0x111')]['hasMany'](db[_0xd626('0x83')],{'as':_0xd626('0x133'),'foreignKey':'MailAccountId'});db[_0xd626('0x111')][_0xd626('0xee')](db[_0xd626('0x134')],{'as':_0xd626('0x135'),'foreignKey':_0xd626('0x131')});db['MailAccount']['hasMany'](db[_0xd626('0x41')],{'as':'Messages','foreignKey':'MailAccountId'});db[_0xd626('0x111')][_0xd626('0xee')](db[_0xd626('0x3f')],{'as':_0xd626('0x136')});db[_0xd626('0x111')][_0xd626('0xee')](db[_0xd626('0x43')],{'as':_0xd626('0x117')});db[_0xd626('0x111')][_0xd626('0xfa')](db[_0xd626('0xe4')],{'as':_0xd626('0x137'),'foreignKey':_0xd626('0x138')});db[_0xd626('0x111')]['belongsTo'](db[_0xd626('0x8f')],{'as':_0xd626('0x8f'),'foreignKey':_0xd626('0x139')});db[_0xd626('0x111')]['belongsTo'](db['Pause'],{'as':_0xd626('0x122'),'foreignKey':_0xd626('0x13a')});db[_0xd626('0x111')][_0xd626('0xfb')](db[_0xd626('0x11')],{'as':_0xd626('0x125'),'through':_0xd626('0x112')});db[_0xd626('0x3b')]['belongsToMany'](db[_0xd626('0x11')],{'as':'Agents','through':_0xd626('0x30')});db['MailQueue'][_0xd626('0xfb')](db[_0xd626('0xd4')],{'through':_0xd626('0x13b'),'as':_0xd626('0x13c')});db[_0xd626('0x3f')][_0xd626('0xee')](db[_0xd626('0x41')],{'as':_0xd626('0x12a'),'onDelete':_0xd626('0xed'),'foreignKey':_0xd626('0x13d')});db[_0xd626('0x3f')][_0xd626('0xfa')](db['MailAccount'],{'as':_0xd626('0x13e'),'foreignKey':_0xd626('0x131')});db['MailInteraction'][_0xd626('0xfa')](db[_0xd626('0x70')],{'as':'Contact','foreignKey':_0xd626('0x130')});db[_0xd626('0x3f')][_0xd626('0xfa')](db[_0xd626('0x11')],{'as':'Owner','foreignKey':_0xd626('0xef')});db['MailInteraction'][_0xd626('0xfb')](db['Tag'],{'through':_0xd626('0x13f'),'as':'Tags'});db[_0xd626('0x3f')][_0xd626('0xfb')](db[_0xd626('0x8e')],{'through':_0xd626('0x13f'),'as':_0xd626('0x140')});db['MailInteraction'][_0xd626('0xfb')](db[_0xd626('0x11')],{'as':'Users','through':_0xd626('0x101'),'foreignKey':_0xd626('0x13d')});db[_0xd626('0x41')][_0xd626('0xee')](db[_0xd626('0x141')],{'as':_0xd626('0x142'),'onDelete':_0xd626('0xed')});db['MailMessage'][_0xd626('0xfa')](db[_0xd626('0x11')],{'as':_0xd626('0x11')});db['MailMessage'][_0xd626('0xfa')](db[_0xd626('0x70')],{'onDelete':_0xd626('0xed'),'as':_0xd626('0x143')});db[_0xd626('0x41')][_0xd626('0xfa')](db[_0xd626('0x3f')],{'as':_0xd626('0x144'),'foreignKey':'MailInteractionId'});db[_0xd626('0x41')]['belongsTo'](db[_0xd626('0x111')],{'as':_0xd626('0x13e'),'foreignKey':'MailAccountId'});db[_0xd626('0x43')][_0xd626('0xfa')](db[_0xd626('0x11')],{'onDelete':_0xd626('0x145')});db[_0xd626('0x43')][_0xd626('0xfa')](db['MailQueue'],{'onDelete':_0xd626('0x145')});db['MailApplication'][_0xd626('0xfa')](db[_0xd626('0x111')],{'onDelete':_0xd626('0x145')});db[_0xd626('0x43')][_0xd626('0xfa')](db[_0xd626('0x85')],{'onDelete':_0xd626('0x145'),'foreignKey':_0xd626('0x146')});db[_0xd626('0x43')][_0xd626('0xfa')](db[_0xd626('0x8e')],{'onDelete':_0xd626('0x145'),'foreignKey':_0xd626('0x147')});db[_0xd626('0x44')][_0xd626('0xfa')](db[_0xd626('0x111')],{});db[_0xd626('0x44')]['belongsTo'](db['CmList'],{'as':_0xd626('0x137'),'foreignKey':_0xd626('0x138')});db['MailQueueReport'][_0xd626('0xfa')](db[_0xd626('0x70')],{'as':'Contact','foreignKey':_0xd626('0x130')});db[_0xd626('0x44')][_0xd626('0xfa')](db['MailInteraction'],{});db[_0xd626('0x44')][_0xd626('0xfa')](db[_0xd626('0x41')],{});db[_0xd626('0x44')][_0xd626('0xfa')](db[_0xd626('0x11')],{});db[_0xd626('0x44')][_0xd626('0xfa')](db[_0xd626('0x3b')],{});db[_0xd626('0x45')][_0xd626('0xee')](db[_0xd626('0x46')],{'as':_0xd626('0x148'),'onDelete':_0xd626('0xed')});db[_0xd626('0x48')][_0xd626('0xee')](db['Disposition'],{'as':_0xd626('0x133'),'foreignKey':_0xd626('0x149')});db['FaxAccount'][_0xd626('0xee')](db['CannedAnswer'],{'as':_0xd626('0x135'),'foreignKey':'FaxAccountId'});db[_0xd626('0x48')][_0xd626('0xee')](db[_0xd626('0xf8')],{'as':_0xd626('0x136')});db[_0xd626('0x48')]['hasMany'](db[_0xd626('0x4a')],{'as':'Applications'});db[_0xd626('0x48')][_0xd626('0xee')](db['VoiceExtension'],{'as':_0xd626('0x14a'),'onDelete':'cascade'});db[_0xd626('0x48')]['hasMany'](db['FaxMessage'],{'as':_0xd626('0x12a')});db[_0xd626('0x48')][_0xd626('0xfa')](db[_0xd626('0x120')],{'as':_0xd626('0x120')});db[_0xd626('0x48')]['belongsTo'](db[_0xd626('0xe4')],{'as':_0xd626('0x137'),'foreignKey':_0xd626('0x138')});db[_0xd626('0x48')][_0xd626('0xfa')](db[_0xd626('0x87')],{'as':_0xd626('0x122'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xd626('0x48')][_0xd626('0xfb')](db[_0xd626('0x11')],{'as':_0xd626('0x125'),'through':_0xd626('0x14b')});db[_0xd626('0x4a')]['belongsTo'](db[_0xd626('0x11')],{'onDelete':_0xd626('0x145')});db[_0xd626('0x4a')]['belongsTo'](db[_0xd626('0x4f')],{'onDelete':_0xd626('0x145')});db[_0xd626('0x4a')][_0xd626('0xfa')](db[_0xd626('0x48')],{'onDelete':_0xd626('0x145')});db['FaxApplication'][_0xd626('0xfa')](db['Tag'],{'onDelete':_0xd626('0x145'),'foreignKey':'TagId'});db[_0xd626('0xf8')]['hasMany'](db[_0xd626('0x4d')],{'as':_0xd626('0x12a'),'onDelete':_0xd626('0xed'),'foreignKey':_0xd626('0x14c')});db[_0xd626('0xf8')]['belongsTo'](db[_0xd626('0x48')],{'as':_0xd626('0x13e'),'foreignKey':_0xd626('0x149')});db[_0xd626('0xf8')][_0xd626('0xfa')](db['CmContact'],{'as':_0xd626('0x143'),'foreignKey':_0xd626('0x130')});db['FaxInteraction'][_0xd626('0xfa')](db[_0xd626('0x11')],{'as':_0xd626('0x14d'),'foreignKey':'UserId'});db[_0xd626('0xf8')]['belongsToMany'](db[_0xd626('0x8e')],{'through':_0xd626('0x14e'),'as':_0xd626('0x14f')});db['FaxInteraction'][_0xd626('0xfb')](db[_0xd626('0x8e')],{'through':_0xd626('0x14e'),'as':'ThroughTags'});db['FaxInteraction'][_0xd626('0xfb')](db[_0xd626('0x11')],{'as':_0xd626('0x150'),'through':_0xd626('0x103'),'foreignKey':'FaxInteractionId'});db[_0xd626('0x4d')]['belongsTo'](db[_0xd626('0x11')],{'onDelete':_0xd626('0xed'),'as':'User'});db[_0xd626('0x4d')][_0xd626('0xfa')](db[_0xd626('0xf8')],{'as':_0xd626('0x144'),'foreignKey':_0xd626('0x14c')});db[_0xd626('0x4d')][_0xd626('0xfa')](db[_0xd626('0x70')],{'onDelete':_0xd626('0xed'),'as':'Contact'});db[_0xd626('0x4d')]['belongsTo'](db[_0xd626('0x141')],{'as':_0xd626('0x141'),'foreignKey':_0xd626('0x151')});db['FaxMessage'][_0xd626('0xfa')](db['FaxAccount'],{'as':'Account','foreignKey':'FaxAccountId'});db[_0xd626('0x4f')][_0xd626('0xfb')](db[_0xd626('0x11')],{'as':'Agents','through':_0xd626('0x32')});db['FaxQueue'][_0xd626('0xfb')](db['Team'],{'through':'team_has_fax_queues','as':_0xd626('0x13c')});db[_0xd626('0x51')][_0xd626('0xfa')](db[_0xd626('0x48')],{});db[_0xd626('0x51')]['belongsTo'](db[_0xd626('0xe4')],{'as':_0xd626('0x137'),'foreignKey':_0xd626('0x138')});db['FaxQueueReport'][_0xd626('0xfa')](db[_0xd626('0x70')],{'as':_0xd626('0x143'),'foreignKey':_0xd626('0x130')});db[_0xd626('0x51')][_0xd626('0xfa')](db[_0xd626('0xf8')],{});db[_0xd626('0x51')]['belongsTo'](db[_0xd626('0x4d')],{});db[_0xd626('0x51')][_0xd626('0xfa')](db['User'],{});db['FaxQueueReport'][_0xd626('0xfa')](db[_0xd626('0x4f')],{});db[_0xd626('0x53')][_0xd626('0xee')](db[_0xd626('0x83')],{'as':'Dispositions','foreignKey':_0xd626('0x152')});db[_0xd626('0x53')][_0xd626('0xee')](db[_0xd626('0x134')],{'as':_0xd626('0x135'),'foreignKey':_0xd626('0x152')});db[_0xd626('0x53')][_0xd626('0xee')](db[_0xd626('0x57')],{'as':_0xd626('0x12a'),'foreignKey':_0xd626('0x152')});db['SmsAccount']['hasMany'](db['SmsInteraction'],{'as':_0xd626('0x136')});db['SmsAccount'][_0xd626('0xee')](db[_0xd626('0x153')],{'as':_0xd626('0x117')});db[_0xd626('0x53')][_0xd626('0xfa')](db[_0xd626('0xe4')],{'as':_0xd626('0x137'),'foreignKey':_0xd626('0x138')});db['SmsAccount'][_0xd626('0xfa')](db[_0xd626('0x87')],{'as':_0xd626('0x122'),'foreignKey':_0xd626('0x13a')});db[_0xd626('0x53')][_0xd626('0xfb')](db[_0xd626('0x11')],{'as':_0xd626('0x125'),'through':_0xd626('0x154')});db[_0xd626('0x153')][_0xd626('0xfa')](db[_0xd626('0x11')],{'onDelete':'restrict'});db['SmsApplication'][_0xd626('0xfa')](db[_0xd626('0x59')],{'onDelete':_0xd626('0x145')});db['SmsApplication'][_0xd626('0xfa')](db[_0xd626('0x53')],{'onDelete':_0xd626('0x145')});db[_0xd626('0x153')][_0xd626('0xfa')](db[_0xd626('0x85')],{'onDelete':_0xd626('0x145'),'foreignKey':_0xd626('0x146')});db[_0xd626('0x153')][_0xd626('0xfa')](db['Tag'],{'onDelete':_0xd626('0x145'),'foreignKey':_0xd626('0x147')});db[_0xd626('0xf6')]['hasMany'](db[_0xd626('0x57')],{'as':_0xd626('0x12a'),'onDelete':_0xd626('0xed'),'foreignKey':_0xd626('0x155')});db[_0xd626('0xf6')]['belongsTo'](db[_0xd626('0x53')],{'as':_0xd626('0x13e'),'foreignKey':_0xd626('0x152')});db[_0xd626('0xf6')][_0xd626('0xfa')](db[_0xd626('0x70')],{'as':_0xd626('0x143'),'foreignKey':_0xd626('0x130')});db['SmsInteraction'][_0xd626('0xfa')](db[_0xd626('0x11')],{'as':'Owner','foreignKey':_0xd626('0xef')});db[_0xd626('0xf6')]['belongsToMany'](db['Tag'],{'through':'sms_interaction_has_tags','as':_0xd626('0x14f')});db[_0xd626('0xf6')][_0xd626('0xfb')](db[_0xd626('0x8e')],{'through':_0xd626('0x156'),'as':_0xd626('0x140')});db[_0xd626('0xf6')][_0xd626('0xfb')](db[_0xd626('0x11')],{'as':_0xd626('0x150'),'through':_0xd626('0x104'),'foreignKey':_0xd626('0x155')});db[_0xd626('0x57')][_0xd626('0xfa')](db[_0xd626('0x11')],{'as':_0xd626('0x11')});db['SmsMessage'][_0xd626('0xfa')](db[_0xd626('0x70')],{'onDelete':_0xd626('0xed'),'as':_0xd626('0x143')});db['SmsMessage'][_0xd626('0xfa')](db[_0xd626('0xf6')],{'onDelete':'cascade','as':_0xd626('0x144'),'foreignKey':'SmsInteractionId'});db[_0xd626('0x57')][_0xd626('0xfa')](db[_0xd626('0x53')],{'as':_0xd626('0x13e'),'foreignKey':'SmsAccountId'});db[_0xd626('0x59')][_0xd626('0xfb')](db['User'],{'as':_0xd626('0x125'),'through':'UserSmsQueue','foreignKey':_0xd626('0x157')});db['SmsQueue'][_0xd626('0xfb')](db[_0xd626('0xd4')],{'through':_0xd626('0x158'),'as':_0xd626('0x13c')});db[_0xd626('0x5a')][_0xd626('0xee')](db['Disposition'],{'as':_0xd626('0x133'),'foreignKey':_0xd626('0x159')});db['OpenchannelAccount'][_0xd626('0xee')](db[_0xd626('0x134')],{'as':_0xd626('0x135'),'foreignKey':_0xd626('0x159')});db[_0xd626('0x5a')][_0xd626('0xee')](db[_0xd626('0x5e')],{'as':_0xd626('0x136'),'foreignKey':_0xd626('0x159')});db['OpenchannelAccount']['hasMany'](db[_0xd626('0x60')],{'as':'Messages','foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount']['hasMany'](db[_0xd626('0x5c')],{'as':_0xd626('0x117'),'foreignKey':_0xd626('0x159')});db[_0xd626('0x5a')][_0xd626('0xfa')](db[_0xd626('0xe4')],{'as':'List','foreignKey':_0xd626('0x138')});db[_0xd626('0x5a')][_0xd626('0xfa')](db[_0xd626('0x87')],{'as':_0xd626('0x122'),'foreignKey':_0xd626('0x13a')});db[_0xd626('0x5a')][_0xd626('0xfb')](db[_0xd626('0x11')],{'as':_0xd626('0x125'),'through':_0xd626('0x113')});db[_0xd626('0x5c')][_0xd626('0xfa')](db[_0xd626('0x11')],{'onDelete':_0xd626('0x145')});db[_0xd626('0x5c')][_0xd626('0xfa')](db['OpenchannelQueue'],{'onDelete':_0xd626('0x145'),'foreignKey':_0xd626('0x15a')});db[_0xd626('0x5c')][_0xd626('0xfa')](db[_0xd626('0x5a')],{'onDelete':_0xd626('0x145'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelApplication'][_0xd626('0xfa')](db[_0xd626('0x85')],{'onDelete':_0xd626('0x145'),'foreignKey':_0xd626('0x146')});db[_0xd626('0x5c')]['belongsTo'](db['Tag'],{'onDelete':'restrict','foreignKey':'TagId'});db['OpenchannelInteraction'][_0xd626('0xee')](db[_0xd626('0x60')],{'as':_0xd626('0x12a'),'onDelete':_0xd626('0xed'),'foreignKey':_0xd626('0x15b')});db[_0xd626('0x5e')][_0xd626('0xfa')](db[_0xd626('0x5a')],{'as':_0xd626('0x13e'),'foreignKey':_0xd626('0x159')});db[_0xd626('0x5e')][_0xd626('0xfa')](db[_0xd626('0x70')],{'as':_0xd626('0x143'),'foreignKey':'ContactId'});db[_0xd626('0x5e')][_0xd626('0xfa')](db[_0xd626('0x11')],{'as':_0xd626('0x14d'),'foreignKey':_0xd626('0xef')});db['OpenchannelInteraction'][_0xd626('0xfb')](db['Tag'],{'through':_0xd626('0x15c'),'as':'Tags'});db[_0xd626('0x5e')][_0xd626('0xfb')](db[_0xd626('0x8e')],{'through':'openchannel_interaction_has_tags','as':'ThroughTags'});db['OpenchannelInteraction'][_0xd626('0xfb')](db['User'],{'as':'Users','through':_0xd626('0x15d'),'foreignKey':_0xd626('0x15b')});db[_0xd626('0x60')][_0xd626('0xfa')](db[_0xd626('0x11')],{'onDelete':_0xd626('0xed'),'as':_0xd626('0x11')});db[_0xd626('0x60')][_0xd626('0xfa')](db['CmContact'],{'onDelete':'cascade','as':_0xd626('0x143')});db['OpenchannelMessage'][_0xd626('0xfa')](db[_0xd626('0x5e')],{'onDelete':'cascade','as':'Interaction','foreignKey':_0xd626('0x15b')});db['OpenchannelMessage'][_0xd626('0xfa')](db[_0xd626('0x141')],{'as':'Attachment','foreignKey':_0xd626('0x151')});db[_0xd626('0x60')][_0xd626('0xfa')](db[_0xd626('0x5a')],{'as':_0xd626('0x13e'),'foreignKey':'OpenchannelAccountId'});db[_0xd626('0x62')][_0xd626('0xfb')](db['User'],{'as':_0xd626('0x125'),'through':'UserOpenchannelQueue','foreignKey':_0xd626('0x15a')});db[_0xd626('0x62')][_0xd626('0xfb')](db[_0xd626('0xd4')],{'through':_0xd626('0x15e'),'as':_0xd626('0x13c')});db[_0xd626('0x15f')][_0xd626('0xee')](db['Disposition'],{'as':_0xd626('0x133'),'foreignKey':_0xd626('0x160')});db[_0xd626('0x15f')][_0xd626('0xee')](db[_0xd626('0x134')],{'as':'Answers','foreignKey':'ChatWebsiteId'});db['ChatWebsite'][_0xd626('0xee')](db[_0xd626('0x161')],{'as':_0xd626('0x162')});db[_0xd626('0x15f')][_0xd626('0xee')](db[_0xd626('0xf4')],{'as':_0xd626('0x136')});db[_0xd626('0x15f')][_0xd626('0xee')](db['ChatApplication'],{'as':_0xd626('0x117')});db['ChatWebsite'][_0xd626('0xee')](db[_0xd626('0x163')],{'as':_0xd626('0x12a')});db[_0xd626('0x15f')][_0xd626('0xfa')](db[_0xd626('0xe4')],{'as':_0xd626('0x137'),'foreignKey':_0xd626('0x138')});db[_0xd626('0x15f')][_0xd626('0xfa')](db['Interval'],{'as':'Interval','foreignKey':_0xd626('0x146')});db[_0xd626('0x15f')][_0xd626('0xfa')](db['Pause'],{'as':_0xd626('0x122'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xd626('0x15f')][_0xd626('0xfb')](db['User'],{'as':_0xd626('0x125'),'through':'user_has_chat_websites'});db['OpenchannelQueueReport']['belongsTo'](db[_0xd626('0x5a')],{});db[_0xd626('0x63')][_0xd626('0xfa')](db['CmList'],{'as':_0xd626('0x137'),'foreignKey':_0xd626('0x138')});db[_0xd626('0x63')][_0xd626('0xfa')](db['CmContact'],{'as':_0xd626('0x143'),'foreignKey':_0xd626('0x130')});db[_0xd626('0x63')][_0xd626('0xfa')](db[_0xd626('0x5e')],{});db['OpenchannelQueueReport']['belongsTo'](db[_0xd626('0x60')],{});db[_0xd626('0x63')][_0xd626('0xfa')](db[_0xd626('0x11')],{});db[_0xd626('0x63')][_0xd626('0xfa')](db[_0xd626('0x62')],{});db[_0xd626('0x65')]['belongsTo'](db[_0xd626('0x11')],{'as':_0xd626('0x164'),'foreignKey':_0xd626('0xef'),'onDelete':_0xd626('0x145')});db[_0xd626('0x65')][_0xd626('0xfa')](db[_0xd626('0x6a')],{'as':_0xd626('0x165'),'foreignKey':_0xd626('0x166'),'onDelete':_0xd626('0x145')});db[_0xd626('0x65')][_0xd626('0xfa')](db[_0xd626('0x15f')],{'as':_0xd626('0x167'),'foreignKey':_0xd626('0x160'),'onDelete':_0xd626('0x145')});db[_0xd626('0x65')][_0xd626('0xfa')](db['Tag'],{'onDelete':_0xd626('0x145'),'foreignKey':_0xd626('0x147')});db[_0xd626('0xf4')]['hasMany'](db[_0xd626('0x163')],{'as':_0xd626('0x12a'),'onDelete':'cascade','foreignKey':_0xd626('0x168')});db[_0xd626('0xf4')]['belongsTo'](db[_0xd626('0x15f')],{'as':'Account','foreignKey':_0xd626('0x160')});db['ChatInteraction']['belongsTo'](db['CmContact'],{'as':_0xd626('0x143'),'foreignKey':_0xd626('0x130')});db[_0xd626('0xf4')]['belongsTo'](db[_0xd626('0x11')],{'as':_0xd626('0x14d'),'foreignKey':_0xd626('0xef')});db[_0xd626('0xf4')][_0xd626('0xfb')](db[_0xd626('0x8e')],{'through':_0xd626('0x169'),'as':_0xd626('0x14f')});db[_0xd626('0xf4')][_0xd626('0xfb')](db[_0xd626('0x8e')],{'through':_0xd626('0x169'),'as':'ThroughTags'});db[_0xd626('0xf4')][_0xd626('0xfb')](db[_0xd626('0x11')],{'as':_0xd626('0x150'),'through':'user_has_chat_interactions','foreignKey':_0xd626('0x168')});db[_0xd626('0x163')][_0xd626('0xfa')](db[_0xd626('0x11')],{'onDelete':_0xd626('0xed'),'as':_0xd626('0x11')});db['ChatMessage'][_0xd626('0xfa')](db[_0xd626('0x70')],{'onDelete':_0xd626('0xed'),'as':_0xd626('0x143'),'foreignKey':_0xd626('0x130')});db[_0xd626('0x163')][_0xd626('0xfa')](db[_0xd626('0xf4')],{'onDelete':_0xd626('0xed'),'as':_0xd626('0x144'),'foreignKey':_0xd626('0x168')});db[_0xd626('0x163')][_0xd626('0xfa')](db[_0xd626('0x141')],{'as':_0xd626('0x141'),'foreignKey':_0xd626('0x151')});db['ChatMessage'][_0xd626('0xfa')](db[_0xd626('0x15f')],{'as':_0xd626('0x13e'),'foreignKey':'ChatWebsiteId'});db[_0xd626('0x69')]['belongsTo'](db['CmContact'],{'onDelete':_0xd626('0xed'),'as':_0xd626('0x143'),'foreignKey':_0xd626('0x130')});db[_0xd626('0x69')]['belongsTo'](db['ChatWebsite'],{'as':'Account','foreignKey':_0xd626('0x160')});db[_0xd626('0x6a')][_0xd626('0xfb')](db[_0xd626('0x11')],{'as':_0xd626('0x125'),'through':_0xd626('0x108'),'hooks':!![]});db['ChatQueue'][_0xd626('0xfb')](db['Team'],{'through':'team_has_chat_queues','as':_0xd626('0x13c')});db[_0xd626('0x6c')][_0xd626('0xee')](db[_0xd626('0xc2')],{'as':_0xd626('0x12a'),'foreignKey':_0xd626('0x16a'),'onDelete':_0xd626('0xed')});db[_0xd626('0x6c')][_0xd626('0xfb')](db[_0xd626('0x11')],{'as':_0xd626('0x11a'),'through':_0xd626('0xfc')});db[_0xd626('0x161')][_0xd626('0xfa')](db['ChatWebsite'],{'as':_0xd626('0x167'),'foreignKey':_0xd626('0x160')});db[_0xd626('0x6e')]['hasMany'](db[_0xd626('0x70')],{'as':_0xd626('0xfd'),'foreignKey':'CompanyId'});db[_0xd626('0x70')][_0xd626('0xee')](db[_0xd626('0x72')],{'as':_0xd626('0x11c'),'foreignKey':_0xd626('0x130')});db[_0xd626('0x70')][_0xd626('0xee')](db[_0xd626('0x76')],{'as':_0xd626('0xf1'),'foreignKey':'ContactId'});db[_0xd626('0x70')]['hasMany'](db[_0xd626('0x78')],{'as':_0xd626('0x11d'),'foreignKey':'ContactId'});db[_0xd626('0x70')]['hasMany'](db[_0xd626('0x7a')],{'as':'ReportAgentPreview','foreignKey':_0xd626('0x130')});db['CmContact']['hasMany'](db['JscriptySessionReport'],{'as':'JscriptySessions','foreignKey':_0xd626('0x130')});db['CmContact']['hasMany'](db['OpenchannelInteraction'],{'as':'OpenchannelInteractions','foreignKey':'ContactId','onDelete':_0xd626('0x145')});db[_0xd626('0x70')][_0xd626('0xee')](db['ChatInteraction'],{'as':_0xd626('0xf5'),'foreignKey':_0xd626('0x130'),'onDelete':_0xd626('0x145')});db[_0xd626('0x70')]['hasMany'](db['SmsInteraction'],{'as':_0xd626('0xf7'),'foreignKey':_0xd626('0x130'),'onDelete':_0xd626('0x145')});db[_0xd626('0x70')][_0xd626('0xee')](db[_0xd626('0xf8')],{'as':_0xd626('0xf9'),'foreignKey':_0xd626('0x130'),'onDelete':'restrict'});db[_0xd626('0x70')][_0xd626('0xee')](db[_0xd626('0x3f')],{'as':_0xd626('0x100'),'foreignKey':'ContactId','onDelete':_0xd626('0x145')});db[_0xd626('0x70')][_0xd626('0xfa')](db[_0xd626('0x6e')],{'as':_0xd626('0x16b'),'foreignKey':_0xd626('0x16c')});db[_0xd626('0x70')][_0xd626('0xfa')](db[_0xd626('0xe4')],{'as':_0xd626('0x137'),'foreignKey':_0xd626('0x138'),'onDelete':'cascade'});db[_0xd626('0x70')]['belongsToMany'](db[_0xd626('0x11')],{'as':_0xd626('0x150'),'through':_0xd626('0xfe')});db[_0xd626('0x70')][_0xd626('0xfb')](db[_0xd626('0x8e')],{'as':_0xd626('0x14f'),'through':_0xd626('0x16d')});db[_0xd626('0x70')][_0xd626('0xfb')](db[_0xd626('0x8e')],{'through':_0xd626('0x16d'),'as':_0xd626('0x140')});db[_0xd626('0x72')][_0xd626('0xfa')](db['CmContact'],{'as':'Contact','foreignKey':_0xd626('0x130'),'onDelete':_0xd626('0xed')});db[_0xd626('0x72')]['belongsTo'](db[_0xd626('0xe4')],{'as':_0xd626('0x137'),'foreignKey':'ListId','onDelete':_0xd626('0xed')});db['CmHopper'][_0xd626('0xfa')](db[_0xd626('0x11')],{'as':'Agent','foreignKey':_0xd626('0xef')});db[_0xd626('0x72')][_0xd626('0xfa')](db[_0xd626('0x19')],{'as':_0xd626('0x165'),'foreignKey':_0xd626('0x11b'),'onDelete':_0xd626('0xed')});db[_0xd626('0x72')]['belongsTo'](db['Campaign'],{'as':_0xd626('0x16e'),'foreignKey':_0xd626('0x16f'),'onDelete':'cascade'});db['CmHopper'][_0xd626('0xfa')](db[_0xd626('0x11')],{'as':_0xd626('0x14d'),'foreignKey':'OwnerId'});db[_0xd626('0x74')]['belongsTo'](db[_0xd626('0x70')],{'as':_0xd626('0x143'),'foreignKey':_0xd626('0x130'),'onDelete':'cascade'});db[_0xd626('0x74')][_0xd626('0xfa')](db[_0xd626('0xe4')],{'as':_0xd626('0x137'),'foreignKey':'ListId','onDelete':_0xd626('0xed')});db[_0xd626('0x74')]['belongsTo'](db[_0xd626('0x19')],{'as':_0xd626('0x165'),'foreignKey':_0xd626('0x11b'),'onDelete':_0xd626('0xed')});db[_0xd626('0x74')]['belongsTo'](db[_0xd626('0x16e')],{'as':_0xd626('0x16e'),'foreignKey':_0xd626('0x16f'),'onDelete':_0xd626('0xed')});db[_0xd626('0x80')]['hasMany'](db[_0xd626('0x170')],{'as':{'plural':_0xd626('0x171'),'singular':'OneAll'},'foreignKey':_0xd626('0x172'),'onDelete':_0xd626('0xed'),'hooks':!![]});db[_0xd626('0x80')][_0xd626('0xee')](db[_0xd626('0x170')],{'as':{'plural':_0xd626('0x173'),'singular':_0xd626('0x174')},'foreignKey':_0xd626('0x175'),'onDelete':_0xd626('0xed'),'hooks':!![]});db[_0xd626('0x80')][_0xd626('0xee')](db['Action'],{'as':_0xd626('0x176'),'foreignKey':'AutomationId','onDelete':_0xd626('0xed'),'hooks':!![]});db[_0xd626('0x85')][_0xd626('0xee')](db[_0xd626('0x85')],{'as':'Intervals','foreignKey':_0xd626('0x146'),'onDelete':_0xd626('0xed'),'hooks':!![],'required':![]});db['Interval']['hasMany'](db[_0xd626('0x16')],{'as':_0xd626('0xf0'),'foreignKey':_0xd626('0x146'),'onDelete':'restrict'});db[_0xd626('0x85')]['hasMany'](db[_0xd626('0x43')],{'as':_0xd626('0x177'),'foreignKey':_0xd626('0x146')});db[_0xd626('0x85')][_0xd626('0xee')](db[_0xd626('0x65')],{'as':_0xd626('0x178'),'foreignKey':_0xd626('0x146')});db['Interval']['hasMany'](db[_0xd626('0x4a')],{'as':'FaxApplications','foreignKey':_0xd626('0x146')});db['Interval'][_0xd626('0xee')](db[_0xd626('0x153')],{'as':_0xd626('0x179'),'foreignKey':_0xd626('0x146')});db[_0xd626('0x8c')][_0xd626('0xfa')](db['MailAccount'],{});db[_0xd626('0x8c')][_0xd626('0xfa')](db['AnalyticDefaultReport'],{'foreignKey':_0xd626('0x17a')});db['Schedule'][_0xd626('0xfa')](db[_0xd626('0x96')],{'foreignKey':_0xd626('0x17b')});db[_0xd626('0x8d')][_0xd626('0xfb')](db[_0xd626('0x18')],{'as':_0xd626('0x17c'),'through':_0xd626('0x119'),'onDelete':'restrict'});db[_0xd626('0x8e')][_0xd626('0xfb')](db[_0xd626('0x70')],{'through':_0xd626('0x16d')});db['Tag'][_0xd626('0xfb')](db['ChatInteraction'],{'through':_0xd626('0x169')});db[_0xd626('0x8e')][_0xd626('0xfb')](db[_0xd626('0x3f')],{'through':_0xd626('0x13f')});db[_0xd626('0x8e')][_0xd626('0xfb')](db[_0xd626('0xf6')],{'through':_0xd626('0x156')});db[_0xd626('0x8e')]['belongsToMany'](db[_0xd626('0xf8')],{'through':_0xd626('0x14e')});db['Tag'][_0xd626('0xfb')](db['OpenchannelInteraction'],{'through':_0xd626('0x15c')});db[_0xd626('0x91')][_0xd626('0xee')](db[_0xd626('0x170')],{'as':{'plural':_0xd626('0x17d'),'singular':_0xd626('0x17e')},'foreignKey':_0xd626('0x17f'),'onDelete':_0xd626('0xed'),'hooks':!![]});db[_0xd626('0x91')]['hasMany'](db[_0xd626('0x170')],{'as':{'plural':_0xd626('0x180'),'singular':_0xd626('0x181')},'foreignKey':_0xd626('0x182'),'onDelete':_0xd626('0xed'),'hooks':!![]});db[_0xd626('0x91')]['hasMany'](db[_0xd626('0x7e')],{'as':_0xd626('0x176'),'foreignKey':_0xd626('0x183'),'onDelete':_0xd626('0xed'),'hooks':!![]});db[_0xd626('0x96')][_0xd626('0xee')](db[_0xd626('0x99')],{'as':_0xd626('0x184'),'onDelete':'cascade','foreignKey':_0xd626('0x17b'),'hooks':!![]});db['AnalyticDefaultReport'][_0xd626('0xee')](db[_0xd626('0x99')],{'as':_0xd626('0x184'),'onDelete':_0xd626('0xed'),'foreignKey':'DefaultReportId'});db[_0xd626('0x98')][_0xd626('0xee')](db[_0xd626('0x99')],{'as':_0xd626('0x184'),'onDelete':_0xd626('0xed'),'foreignKey':'MetricId'});db[_0xd626('0x99')][_0xd626('0xfa')](db['AnalyticMetric'],{'foreignKey':_0xd626('0x185')});db[_0xd626('0x9c')][_0xd626('0xee')](db[_0xd626('0x186')],{'as':_0xd626('0x187'),'onDelete':_0xd626('0xed'),'foreignKey':_0xd626('0x188')});db[_0xd626('0x186')][_0xd626('0xee')](db[_0xd626('0x189')],{'as':'Subjects','onDelete':_0xd626('0xed'),'foreignKey':_0xd626('0x18a')});db['SalesforceConfiguration'][_0xd626('0xee')](db[_0xd626('0x189')],{'as':_0xd626('0x18b'),'onDelete':_0xd626('0xed'),'foreignKey':_0xd626('0x18c')});db[_0xd626('0x186')]['hasMany'](db[_0xd626('0x189')],{'as':'Fields','onDelete':_0xd626('0xed'),'foreignKey':'FieldId'});db['SalesforceConfiguration']['belongsTo'](db['SalesforceAccount'],{'as':_0xd626('0x13e'),'foreignKey':_0xd626('0x188')});db[_0xd626('0x189')][_0xd626('0xee')](db['SalesforceField'],{'as':_0xd626('0x18d'),'foreignKey':_0xd626('0x18a')});db[_0xd626('0x189')][_0xd626('0xee')](db[_0xd626('0x189')],{'as':_0xd626('0x18e'),'foreignKey':'DescriptionId'});db[_0xd626('0x189')]['hasMany'](db[_0xd626('0x189')],{'as':_0xd626('0x18f'),'foreignKey':_0xd626('0x190')});db[_0xd626('0x189')][_0xd626('0xfa')](db[_0xd626('0x92')],{'as':_0xd626('0x92'),'foreignKey':_0xd626('0x191')});db[_0xd626('0x192')][_0xd626('0xee')](db['SugarcrmConfiguration'],{'as':_0xd626('0x187'),'onDelete':_0xd626('0xed'),'foreignKey':_0xd626('0x188')});db['SugarcrmConfiguration']['hasMany'](db[_0xd626('0xa1')],{'as':_0xd626('0x193'),'onDelete':_0xd626('0xed'),'foreignKey':_0xd626('0x18a')});db[_0xd626('0x194')]['hasMany'](db[_0xd626('0xa1')],{'as':_0xd626('0x18b'),'onDelete':_0xd626('0xed'),'foreignKey':_0xd626('0x18c')});db[_0xd626('0x194')]['hasMany'](db[_0xd626('0xa1')],{'as':_0xd626('0x184'),'onDelete':_0xd626('0xed'),'foreignKey':_0xd626('0x190')});db['SugarcrmConfiguration'][_0xd626('0xfa')](db['SugarcrmAccount'],{'as':'Account','foreignKey':'AccountId'});db[_0xd626('0xa1')]['hasMany'](db['SugarcrmField'],{'as':_0xd626('0x18d'),'foreignKey':_0xd626('0x18a')});db[_0xd626('0xa1')]['hasMany'](db['SugarcrmField'],{'as':_0xd626('0x18e'),'foreignKey':_0xd626('0x18c')});db[_0xd626('0xa1')][_0xd626('0xee')](db[_0xd626('0xa1')],{'as':'Field','foreignKey':_0xd626('0x190')});db['SugarcrmField']['belongsTo'](db['Variable'],{'as':'Variable','foreignKey':'VariableId'});db[_0xd626('0x195')][_0xd626('0xee')](db[_0xd626('0xa4')],{'as':'Configurations','onDelete':_0xd626('0xed'),'foreignKey':_0xd626('0x188')});db[_0xd626('0xa4')]['hasMany'](db[_0xd626('0xa6')],{'as':_0xd626('0x193'),'onDelete':'cascade','foreignKey':_0xd626('0x18a')});db['DeskConfiguration'][_0xd626('0xee')](db['DeskField'],{'as':_0xd626('0x18b'),'onDelete':_0xd626('0xed'),'foreignKey':_0xd626('0x18c')});db['DeskConfiguration'][_0xd626('0xee')](db[_0xd626('0xa6')],{'as':_0xd626('0x184'),'onDelete':'cascade','foreignKey':_0xd626('0x190')});db[_0xd626('0xa4')]['belongsTo'](db['DeskAccount'],{'as':'Account','foreignKey':_0xd626('0x188')});db['DeskConfiguration'][_0xd626('0xfb')](db[_0xd626('0x8e')],{'through':_0xd626('0x196')});db[_0xd626('0xa6')][_0xd626('0xee')](db[_0xd626('0xa6')],{'as':'Subject','foreignKey':_0xd626('0x18a')});db['DeskField'][_0xd626('0xee')](db[_0xd626('0xa6')],{'as':_0xd626('0x18e'),'foreignKey':_0xd626('0x18c')});db['DeskField'][_0xd626('0xee')](db['DeskField'],{'as':_0xd626('0x18f'),'foreignKey':_0xd626('0x190')});db[_0xd626('0xa6')][_0xd626('0xfa')](db[_0xd626('0x92')],{'as':_0xd626('0x92'),'foreignKey':_0xd626('0x191')});db[_0xd626('0xa8')]['hasMany'](db[_0xd626('0x197')],{'as':_0xd626('0x187'),'onDelete':_0xd626('0xed'),'foreignKey':_0xd626('0x188')});db['ZohoConfiguration'][_0xd626('0xee')](db['ZohoField'],{'as':_0xd626('0x193'),'onDelete':'cascade','foreignKey':_0xd626('0x18a')});db['ZohoConfiguration'][_0xd626('0xee')](db[_0xd626('0x198')],{'as':_0xd626('0x18b'),'onDelete':_0xd626('0xed'),'foreignKey':_0xd626('0x18c')});db[_0xd626('0x197')][_0xd626('0xee')](db[_0xd626('0x198')],{'as':_0xd626('0x184'),'onDelete':_0xd626('0xed'),'foreignKey':_0xd626('0x190')});db['ZohoConfiguration'][_0xd626('0xfa')](db['ZohoAccount'],{'as':_0xd626('0x13e'),'foreignKey':_0xd626('0x188')});db[_0xd626('0x198')][_0xd626('0xee')](db['ZohoField'],{'as':'Subject','foreignKey':_0xd626('0x18a')});db[_0xd626('0x198')]['hasMany'](db[_0xd626('0x198')],{'as':_0xd626('0x18e'),'foreignKey':'DescriptionId'});db[_0xd626('0x198')][_0xd626('0xee')](db[_0xd626('0x198')],{'as':_0xd626('0x18f'),'foreignKey':_0xd626('0x190')});db[_0xd626('0x198')]['belongsTo'](db[_0xd626('0x92')],{'as':'Variable','foreignKey':_0xd626('0x191')});db[_0xd626('0xac')][_0xd626('0xee')](db[_0xd626('0xad')],{'as':_0xd626('0x187'),'onDelete':_0xd626('0xed'),'foreignKey':'AccountId'});db[_0xd626('0xad')]['hasMany'](db[_0xd626('0x199')],{'as':_0xd626('0x193'),'foreignKey':'SubjectId'});db['ZendeskConfiguration']['hasMany'](db[_0xd626('0x199')],{'as':_0xd626('0x18b'),'foreignKey':'DescriptionId'});db[_0xd626('0xad')][_0xd626('0xee')](db[_0xd626('0x199')],{'as':_0xd626('0x184'),'foreignKey':_0xd626('0x190')});db[_0xd626('0xad')]['belongsTo'](db[_0xd626('0xac')],{'as':_0xd626('0x13e'),'foreignKey':_0xd626('0x188')});db['ZendeskConfiguration']['belongsToMany'](db[_0xd626('0x8e')],{'through':_0xd626('0x19a')});db[_0xd626('0x199')][_0xd626('0xee')](db[_0xd626('0x199')],{'as':'Subject','foreignKey':_0xd626('0x18a')});db[_0xd626('0x199')][_0xd626('0xee')](db[_0xd626('0x199')],{'as':_0xd626('0x18e'),'foreignKey':_0xd626('0x18c')});db[_0xd626('0x199')][_0xd626('0xee')](db[_0xd626('0x199')],{'as':_0xd626('0x18f'),'foreignKey':_0xd626('0x190')});db[_0xd626('0x199')][_0xd626('0xfa')](db[_0xd626('0x92')],{'as':'Variable','foreignKey':_0xd626('0x191')});db['FreshdeskAccount'][_0xd626('0xee')](db['FreshdeskConfiguration'],{'as':_0xd626('0x187'),'onDelete':_0xd626('0xed'),'foreignKey':_0xd626('0x188')});db[_0xd626('0xaf')][_0xd626('0xee')](db[_0xd626('0xb1')],{'as':'Subjects','onDelete':_0xd626('0xed'),'foreignKey':_0xd626('0x18a')});db[_0xd626('0xaf')][_0xd626('0xee')](db['FreshdeskField'],{'as':'Descriptions','onDelete':_0xd626('0xed'),'foreignKey':_0xd626('0x18c')});db['FreshdeskConfiguration'][_0xd626('0xee')](db[_0xd626('0xb1')],{'as':_0xd626('0x184'),'onDelete':'cascade','foreignKey':'FieldId'});db[_0xd626('0xaf')][_0xd626('0xfa')](db[_0xd626('0xae')],{'as':_0xd626('0x13e'),'foreignKey':'AccountId'});db[_0xd626('0xaf')][_0xd626('0xfb')](db[_0xd626('0x8e')],{'through':_0xd626('0x19b')});db['FreshdeskField'][_0xd626('0xee')](db[_0xd626('0xb1')],{'as':'Subject','foreignKey':_0xd626('0x18a')});db[_0xd626('0xb1')][_0xd626('0xee')](db[_0xd626('0xb1')],{'as':_0xd626('0x18e'),'foreignKey':_0xd626('0x18c')});db['FreshdeskField'][_0xd626('0xee')](db[_0xd626('0xb1')],{'as':_0xd626('0x18f'),'foreignKey':_0xd626('0x190')});db[_0xd626('0xb1')][_0xd626('0xfa')](db['Variable'],{'as':'Variable','foreignKey':_0xd626('0x191')});db[_0xd626('0xb2')]['hasMany'](db[_0xd626('0xb3')],{'as':_0xd626('0x187'),'onDelete':_0xd626('0xed'),'foreignKey':_0xd626('0x188')});db[_0xd626('0xb3')]['hasMany'](db[_0xd626('0xb4')],{'as':_0xd626('0x193'),'foreignKey':_0xd626('0x18a')});db['VtigerConfiguration'][_0xd626('0xee')](db[_0xd626('0xb4')],{'as':'Descriptions','foreignKey':_0xd626('0x18c')});db[_0xd626('0xb3')][_0xd626('0xee')](db[_0xd626('0xb4')],{'as':_0xd626('0x184'),'foreignKey':_0xd626('0x190')});db['VtigerConfiguration'][_0xd626('0xfa')](db[_0xd626('0xb2')],{'as':_0xd626('0x13e'),'foreignKey':_0xd626('0x188')});db[_0xd626('0xb4')][_0xd626('0xee')](db[_0xd626('0xb4')],{'as':_0xd626('0x18d'),'foreignKey':_0xd626('0x18a')});db[_0xd626('0xb4')]['hasMany'](db[_0xd626('0xb4')],{'as':_0xd626('0x18e'),'foreignKey':_0xd626('0x18c')});db[_0xd626('0xb4')][_0xd626('0xee')](db[_0xd626('0xb4')],{'as':'Field','foreignKey':_0xd626('0x190')});db[_0xd626('0xb4')][_0xd626('0xfa')](db[_0xd626('0x92')],{'as':_0xd626('0x92'),'foreignKey':_0xd626('0x191')});db[_0xd626('0x19c')][_0xd626('0xee')](db['ServicenowConfiguration'],{'as':_0xd626('0x187'),'onDelete':_0xd626('0xed'),'foreignKey':'AccountId'});db['ServicenowConfiguration'][_0xd626('0xee')](db[_0xd626('0xb7')],{'as':_0xd626('0x193'),'foreignKey':_0xd626('0x18a')});db['ServicenowConfiguration'][_0xd626('0xee')](db['ServicenowField'],{'as':_0xd626('0x18b'),'foreignKey':_0xd626('0x18c')});db[_0xd626('0x19d')][_0xd626('0xee')](db[_0xd626('0xb7')],{'as':_0xd626('0x184'),'foreignKey':_0xd626('0x190')});db[_0xd626('0x19d')][_0xd626('0xfa')](db['ServicenowAccount'],{'as':'Account','foreignKey':_0xd626('0x188')});db[_0xd626('0xb7')]['hasMany'](db[_0xd626('0xb7')],{'as':_0xd626('0x18d'),'foreignKey':_0xd626('0x18a')});db[_0xd626('0xb7')][_0xd626('0xee')](db[_0xd626('0xb7')],{'as':'Description','foreignKey':_0xd626('0x18c')});db['ServicenowField'][_0xd626('0xee')](db[_0xd626('0xb7')],{'as':_0xd626('0x18f'),'foreignKey':_0xd626('0x190')});db[_0xd626('0xb7')]['belongsTo'](db['Variable'],{'as':_0xd626('0x92'),'foreignKey':_0xd626('0x191')});db[_0xd626('0xb9')][_0xd626('0xee')](db[_0xd626('0xbb')],{'as':'Configurations','onDelete':_0xd626('0xed'),'foreignKey':_0xd626('0x188')});db['Dynamics365Configuration'][_0xd626('0xee')](db[_0xd626('0x19e')],{'as':_0xd626('0x193'),'onDelete':'cascade','foreignKey':_0xd626('0x18a')});db['Dynamics365Configuration'][_0xd626('0xee')](db[_0xd626('0x19e')],{'as':_0xd626('0x18b'),'onDelete':_0xd626('0xed'),'foreignKey':_0xd626('0x18c')});db[_0xd626('0xbb')][_0xd626('0xee')](db['Dynamics365Field'],{'as':_0xd626('0x184'),'onDelete':_0xd626('0xed'),'foreignKey':_0xd626('0x190')});db[_0xd626('0xbb')]['belongsTo'](db['Dynamics365Account'],{'as':'Account','foreignKey':_0xd626('0x188')});db[_0xd626('0x19e')][_0xd626('0xee')](db[_0xd626('0x19e')],{'as':_0xd626('0x18d'),'foreignKey':_0xd626('0x18a')});db[_0xd626('0x19e')]['hasMany'](db['Dynamics365Field'],{'as':_0xd626('0x18e'),'foreignKey':_0xd626('0x18c')});db['Dynamics365Field'][_0xd626('0xee')](db[_0xd626('0x19e')],{'as':'Field','foreignKey':_0xd626('0x190')});db[_0xd626('0x19e')]['belongsTo'](db[_0xd626('0x92')],{'as':'Variable','foreignKey':'VariableId'});db[_0xd626('0xbd')][_0xd626('0xee')](db[_0xd626('0x19f')],{'as':_0xd626('0x187'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0xd626('0x19f')][_0xd626('0xee')](db[_0xd626('0x1a0')],{'as':_0xd626('0x193'),'foreignKey':'SubjectId'});db['FreshsalesConfiguration'][_0xd626('0xee')](db['FreshsalesField'],{'as':_0xd626('0x18b'),'foreignKey':'DescriptionId'});db[_0xd626('0x19f')][_0xd626('0xee')](db[_0xd626('0x1a0')],{'as':_0xd626('0x184'),'foreignKey':_0xd626('0x190')});db[_0xd626('0x19f')][_0xd626('0xfa')](db[_0xd626('0xbd')],{'as':'Account','foreignKey':_0xd626('0x188')});db[_0xd626('0x1a0')][_0xd626('0xee')](db['FreshsalesField'],{'as':'Subject','foreignKey':_0xd626('0x18a')});db[_0xd626('0x1a0')][_0xd626('0xee')](db[_0xd626('0x1a0')],{'as':_0xd626('0x18e'),'foreignKey':_0xd626('0x18c')});db[_0xd626('0x1a0')][_0xd626('0xee')](db[_0xd626('0x1a0')],{'as':_0xd626('0x18f'),'foreignKey':_0xd626('0x190')});db['FreshsalesField']['belongsTo'](db[_0xd626('0x92')],{'as':_0xd626('0x92'),'foreignKey':_0xd626('0x191')});db[_0xd626('0x1a1')][_0xd626('0xfa')](db[_0xd626('0x15f')],{});db['ChatQueueReport'][_0xd626('0xfa')](db['CmList'],{'as':_0xd626('0x137'),'foreignKey':_0xd626('0x138')});db[_0xd626('0x1a1')][_0xd626('0xfa')](db[_0xd626('0x70')],{'as':_0xd626('0x143'),'foreignKey':_0xd626('0x130')});db[_0xd626('0x1a1')]['belongsTo'](db[_0xd626('0xf4')],{});db[_0xd626('0x1a1')][_0xd626('0xfa')](db[_0xd626('0x163')],{});db['ChatQueueReport']['belongsTo'](db[_0xd626('0x11')],{});db['ChatQueueReport']['belongsTo'](db[_0xd626('0x6a')],{});db['ChatInternalMessage'][_0xd626('0xfa')](db[_0xd626('0x11')],{'onDelete':'cascade','foreignKey':_0xd626('0x1a2')});db[_0xd626('0xc2')][_0xd626('0xfa')](db[_0xd626('0x11')],{'onDelete':_0xd626('0xed'),'foreignKey':'ToId'});db[_0xd626('0xc8')]['hasMany'](db[_0xd626('0xc6')],{'foreignKey':_0xd626('0x1a3'),'onDelete':_0xd626('0xed')});db[_0xd626('0xc8')]['hasMany'](db[_0xd626('0xc4')],{'foreignKey':_0xd626('0x1a3'),'onDelete':'cascade'});db['SmsQueueReport'][_0xd626('0xfa')](db[_0xd626('0x53')],{});db[_0xd626('0xc9')][_0xd626('0xfa')](db[_0xd626('0xe4')],{'as':_0xd626('0x137'),'foreignKey':_0xd626('0x138')});db[_0xd626('0xc9')][_0xd626('0xfa')](db[_0xd626('0x70')],{'as':_0xd626('0x143'),'foreignKey':_0xd626('0x130')});db[_0xd626('0xc9')][_0xd626('0xfa')](db[_0xd626('0xf6')],{});db[_0xd626('0xc9')][_0xd626('0xfa')](db[_0xd626('0x57')],{});db['SmsQueueReport'][_0xd626('0xfa')](db[_0xd626('0x11')],{});db[_0xd626('0xc9')][_0xd626('0xfa')](db[_0xd626('0x59')],{});db[_0xd626('0x1a4')][_0xd626('0xee')](db[_0xd626('0xc8')],{'foreignKey':_0xd626('0x1a5')});db[_0xd626('0x1a4')][_0xd626('0xee')](db[_0xd626('0xc6')],{'foreignKey':'ProjectId'});db[_0xd626('0x1a4')][_0xd626('0xee')](db[_0xd626('0xc4')],{'foreignKey':_0xd626('0x1a5')});db[_0xd626('0x115')][_0xd626('0xfb')](db['User'],{'as':_0xd626('0x150'),'through':_0xd626('0x116')});db['Team'][_0xd626('0xfb')](db[_0xd626('0x11')],{'as':'Agents','through':_0xd626('0xff')});db[_0xd626('0xd4')]['belongsToMany'](db['VoiceQueue'],{'through':_0xd626('0x126'),'as':_0xd626('0x105')});db[_0xd626('0xd4')]['belongsToMany'](db[_0xd626('0x3b')],{'through':_0xd626('0x13b'),'as':_0xd626('0x106')});db['Team'][_0xd626('0xfb')](db[_0xd626('0x6a')],{'through':'team_has_chat_queues','as':_0xd626('0x107')});db[_0xd626('0xd4')]['belongsToMany'](db[_0xd626('0x4f')],{'through':_0xd626('0x1a6'),'as':_0xd626('0x109')});db[_0xd626('0xd4')]['belongsToMany'](db['SmsQueue'],{'through':_0xd626('0x158'),'as':_0xd626('0x10a')});db[_0xd626('0xd4')]['belongsToMany'](db[_0xd626('0x62')],{'through':_0xd626('0x15e'),'as':_0xd626('0x10b')});db[_0xd626('0x16e')][_0xd626('0xee')](db[_0xd626('0x72')],{'as':'Hoppers','foreignKey':'CampaignId'});db[_0xd626('0x16e')][_0xd626('0xee')](db[_0xd626('0x76')],{'as':_0xd626('0xf1'),'foreignKey':_0xd626('0x16f')});db[_0xd626('0x16e')]['hasMany'](db[_0xd626('0x78')],{'as':_0xd626('0x11d'),'foreignKey':_0xd626('0x16f')});db['Campaign'][_0xd626('0xee')](db['CmHopperBlack'],{'as':'HopperBlacks','foreignKey':_0xd626('0x16f')});db[_0xd626('0x16e')]['belongsTo'](db[_0xd626('0x120')],{'as':_0xd626('0x120'),'foreignKey':_0xd626('0x121')});db['Campaign']['belongsTo'](db[_0xd626('0x120')],{'as':_0xd626('0x1a7'),'foreignKey':_0xd626('0x1a8')});db['Campaign']['belongsTo'](db['Interval'],{'as':_0xd626('0x85'),'foreignKey':_0xd626('0x146')});db[_0xd626('0x16e')][_0xd626('0xfa')](db[_0xd626('0x115')],{'as':_0xd626('0x115'),'foreignKey':_0xd626('0x1a9')});db[_0xd626('0x16e')]['belongsToMany'](db[_0xd626('0xe4')],{'as':_0xd626('0x123'),'through':_0xd626('0x1aa')});db[_0xd626('0x16e')][_0xd626('0xfb')](db[_0xd626('0xe4')],{'as':'BlackLists','through':'campaigns_has_cm_blacklists'});db['MailTransferReport'][_0xd626('0xfa')](db['MailMessage'],{});db[_0xd626('0xdc')][_0xd626('0xfa')](db[_0xd626('0x3f')],{});db[_0xd626('0xdc')][_0xd626('0xfa')](db['MailAccount'],{'foreignKey':_0xd626('0x1ab'),'as':'FromAccount'});db[_0xd626('0xdc')]['belongsTo'](db[_0xd626('0x11')],{'foreignKey':'FromUserId','as':_0xd626('0x1ac')});db[_0xd626('0xdc')]['belongsTo'](db['User'],{'foreignKey':_0xd626('0x1ad'),'as':_0xd626('0x1ae')});db[_0xd626('0xdc')][_0xd626('0xfa')](db[_0xd626('0x3b')],{'foreignKey':_0xd626('0x1af'),'as':_0xd626('0x1b0')});db[_0xd626('0xdc')][_0xd626('0xfa')](db[_0xd626('0x111')],{'foreignKey':_0xd626('0x1b1'),'as':_0xd626('0x1b2')});db[_0xd626('0xdd')]['belongsTo'](db[_0xd626('0x163')],{});db[_0xd626('0xdd')]['belongsTo'](db[_0xd626('0xf4')],{});db['ChatTransferReport'][_0xd626('0xfa')](db['ChatWebsite'],{'foreignKey':'FromChatWebsiteId','as':'FromAccount'});db['ChatTransferReport']['belongsTo'](db['User'],{'foreignKey':'FromUserId','as':'FromAgent'});db[_0xd626('0xdd')][_0xd626('0xfa')](db[_0xd626('0x11')],{'foreignKey':_0xd626('0x1ad'),'as':_0xd626('0x1ae')});db[_0xd626('0xdd')][_0xd626('0xfa')](db[_0xd626('0x6a')],{'foreignKey':'ToChatQueueId','as':_0xd626('0x1b0')});db[_0xd626('0xdd')][_0xd626('0xfa')](db[_0xd626('0x15f')],{'foreignKey':_0xd626('0x1b3'),'as':'ToAccount'});db[_0xd626('0xdf')][_0xd626('0xfa')](db[_0xd626('0x4d')],{});db[_0xd626('0xdf')][_0xd626('0xfa')](db['FaxInteraction'],{});db[_0xd626('0xdf')]['belongsTo'](db['FaxAccount'],{'foreignKey':_0xd626('0x1b4'),'as':_0xd626('0x1b5')});db[_0xd626('0xdf')][_0xd626('0xfa')](db[_0xd626('0x11')],{'foreignKey':_0xd626('0x1b6'),'as':'FromAgent'});db['FaxTransferReport'][_0xd626('0xfa')](db[_0xd626('0x11')],{'foreignKey':_0xd626('0x1ad'),'as':'ToAgent'});db[_0xd626('0xdf')][_0xd626('0xfa')](db[_0xd626('0x4f')],{'foreignKey':_0xd626('0x1b7'),'as':'ToQueue'});db[_0xd626('0xdf')][_0xd626('0xfa')](db[_0xd626('0x48')],{'foreignKey':'ToFaxAccountId','as':_0xd626('0x1b2')});db[_0xd626('0xe1')][_0xd626('0xfa')](db[_0xd626('0x60')],{});db[_0xd626('0xe1')][_0xd626('0xfa')](db[_0xd626('0x5e')],{});db[_0xd626('0xe1')][_0xd626('0xfa')](db[_0xd626('0x5a')],{'foreignKey':_0xd626('0x1b8'),'as':_0xd626('0x1b5')});db[_0xd626('0xe1')][_0xd626('0xfa')](db[_0xd626('0x11')],{'foreignKey':'FromUserId','as':'FromAgent'});db[_0xd626('0xe1')]['belongsTo'](db[_0xd626('0x11')],{'foreignKey':_0xd626('0x1ad'),'as':'ToAgent'});db[_0xd626('0xe1')]['belongsTo'](db[_0xd626('0x62')],{'foreignKey':'ToOpenchannelQueueId','as':'ToQueue'});db[_0xd626('0xe1')]['belongsTo'](db[_0xd626('0x5a')],{'foreignKey':_0xd626('0x1b9'),'as':_0xd626('0x1b2')});db['SmsTransferReport'][_0xd626('0xfa')](db['SmsMessage'],{});db[_0xd626('0xe3')]['belongsTo'](db[_0xd626('0xf6')],{});db[_0xd626('0xe3')][_0xd626('0xfa')](db[_0xd626('0x53')],{'foreignKey':_0xd626('0x1ba'),'as':_0xd626('0x1b5')});db[_0xd626('0xe3')][_0xd626('0xfa')](db['User'],{'foreignKey':_0xd626('0x1b6'),'as':'FromAgent'});db[_0xd626('0xe3')][_0xd626('0xfa')](db[_0xd626('0x11')],{'foreignKey':'ToUserId','as':_0xd626('0x1ae')});db['SmsTransferReport']['belongsTo'](db[_0xd626('0x59')],{'foreignKey':_0xd626('0x1bb'),'as':'ToQueue'});db[_0xd626('0xe3')][_0xd626('0xfa')](db[_0xd626('0x53')],{'foreignKey':_0xd626('0x1bc'),'as':_0xd626('0x1b2')});db['CmList'][_0xd626('0xee')](db[_0xd626('0x83')],{'as':_0xd626('0x133'),'foreignKey':_0xd626('0x138')});db[_0xd626('0xe4')][_0xd626('0xee')](db[_0xd626('0x7c')],{'as':'CustomFields','foreignKey':_0xd626('0x138')});db[_0xd626('0xe4')][_0xd626('0xee')](db[_0xd626('0x70')],{'as':_0xd626('0xfd'),'onDelete':'cascade','foreignKey':_0xd626('0x138')});db[_0xd626('0xe4')][_0xd626('0xee')](db[_0xd626('0x76')],{'as':_0xd626('0xf1'),'foreignKey':'ListId'});db[_0xd626('0xe4')][_0xd626('0xee')](db[_0xd626('0x78')],{'as':_0xd626('0xf2'),'foreignKey':_0xd626('0x138')});db[_0xd626('0xe4')][_0xd626('0xee')](db[_0xd626('0x7a')],{'as':_0xd626('0x7a'),'foreignKey':_0xd626('0x138')});db['CmList'][_0xd626('0xfb')](db['VoiceQueue'],{'as':_0xd626('0x1bd'),'through':_0xd626('0x124')});db[_0xd626('0xe4')][_0xd626('0xfb')](db[_0xd626('0x11')],{'as':'Agents','through':'cm_user_has_lists'});db[_0xd626('0xe6')][_0xd626('0xee')](db[_0xd626('0x16')],{'as':_0xd626('0xf0'),'onDelete':'restrict'});db[_0xd626('0xe6')][_0xd626('0xfb')](db['User'],{'as':'Agents','through':_0xd626('0x10e')});db['UserProfile'][_0xd626('0xee')](db[_0xd626('0x11')],{'as':_0xd626('0x150'),'foreignKey':_0xd626('0x1be')});db[_0xd626('0xe8')][_0xd626('0xee')](db['UserProfileSection'],{'as':_0xd626('0x1bf'),'foreignKey':_0xd626('0x1be'),'onDelete':_0xd626('0xed')});db[_0xd626('0xe9')][_0xd626('0xee')](db[_0xd626('0xea')],{'as':_0xd626('0x1c0'),'foreignKey':'sectionId','onDelete':_0xd626('0xed')});module[_0xd626('0x1c1')]={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index 0afc944..3d94781 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9003=['/api/fax/applications','./api/faxApplication','./api/faxInteraction','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','./api/openchannelInteraction','./api/openchannelMessage','./api/openchannelQueue','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','./api/chatInteraction','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','/api/chat/queues','/api/chat/groups','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmContact','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','./api/cmHopperHistory','./api/cmCustomField','./api/action','/api/automations','./api/automation','/api/canned_answers','./api/cannedAnswer','/api/dispositions','/api/conditions','./api/condition','/api/intervals','./api/interval','/api/pauses','./api/pause','./api/cdr','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','./api/sound','./api/tag','/api/templates','./api/template','/api/triggers','/api/variables','/api/integrations','./api/integration','/api/integrations/reports','./api/integrationReport','/api/analytics/default_reports','./api/analyticDefaultReport','./api/analyticExtractedReport','/api/analytics/metrics','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','/api/integrations/salesforce/fields','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','./api/intSugarcrmConfiguration','./api/intSugarcrmField','/api/integrations/desk/accounts','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','./api/intServicenowField','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','/api/integrations/dynamics365/fields','/api/integrations/freshsales/accounts','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','./api/network','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','/api/settings','./api/setting','/api/square/odbc','./api/squareOdbc','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/teams','./api/team','/api/license','./api/license','/api/campaigns','./api/migration','/api/attachments','./api/attachment','/api/plugins','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/auth/local','./api/authLocal','/api/auth/google','./api/authGoogle','/api/jira','./api/jira','./api/rpc','/api/version','./api/version','/api/system','/api/pm2','./api/pm2','/apidoc','static','join','root','/www','/demo','/snippet','1.0.16','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','resolve','appPath','/index.html','path','express-winston','util','./errors','./config/environment','./config/logger','api','auth','default','use','logger','format','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','method','x-forwarded-for','connection','remoteAddress','statusCode','responseTime','user','role','body','device','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','headers','url','name','other','agent_name','/api/users','./api/user','/api/voice/chanspy','/api/voice/contexts','./api/voiceContext','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','/api/voice/calls/reports','./api/voiceCallReport','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','./api/memberReport','/api/trunks','./api/trunk','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','/api/mail/interactions','./api/mailInteraction','/api/mail/applications','./api/mailApplication','./api/mailQueueReport','/api/dashboards','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','./api/faxAccount'];(function(_0x502edf,_0x2cd838){var _0x19c60b=function(_0x11723c){while(--_0x11723c){_0x502edf['push'](_0x502edf['shift']());}};_0x19c60b(++_0x2cd838);}(_0x9003,0xcd));var _0x3900=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x9003[_0xa464c9];return _0x3d73c4;};'use strict';var path=require(_0x3900('0x0'));var express=require('express');var ewinston=require(_0x3900('0x1'));var util=require(_0x3900('0x2'));var errors=require(_0x3900('0x3'));var config=require(_0x3900('0x4'));var logger=require(_0x3900('0x5'))(_0x3900('0x6'));var authLogger=require(_0x3900('0x5'))(_0x3900('0x7'));exports[_0x3900('0x8')]=function(_0x486c30){_0x486c30[_0x3900('0x9')](ewinston[_0x3900('0xa')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x50281e,_0x2b550c){return util[_0x3900('0xb')](_0x3900('0xc'),_0x50281e[_0x3900('0xd')],_0x50281e['headers']['x-forwarded-for']?_0x50281e['headers'][_0x3900('0xe')]:_0x50281e[_0x3900('0xf')][_0x3900('0x10')]||_0x50281e['ip'],_0x50281e['url'],_0x2b550c[_0x3900('0x11')],_0x2b550c[_0x3900('0x12')],_0x50281e[_0x3900('0x13')]?_0x50281e[_0x3900('0x13')]['id']:null,_0x50281e[_0x3900('0x13')]?_0x50281e[_0x3900('0x13')]['name']:null,_0x50281e[_0x3900('0x13')]?_0x50281e['user'][_0x3900('0x14')]:null);}}));_0x486c30['use'](ewinston['logger']({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x23a4d0,_0x1f2296){var _0x2bcb5e='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s';if(_0x23a4d0['body']&&_0x23a4d0[_0x3900('0x15')][_0x3900('0x16')]&&_0x23a4d0[_0x3900('0x15')][_0x3900('0x17')]){_0x2bcb5e=_0x3900('0x18');}return util[_0x3900('0xb')](_0x2bcb5e,_0x23a4d0[_0x3900('0xd')],_0x23a4d0[_0x3900('0x19')][_0x3900('0xe')]?_0x23a4d0['headers'][_0x3900('0xe')]:_0x23a4d0['connection']['remoteAddress']||_0x23a4d0['ip'],_0x23a4d0[_0x3900('0x1a')],_0x1f2296[_0x3900('0x11')],_0x1f2296[_0x3900('0x12')],_0x23a4d0[_0x3900('0x13')]?_0x23a4d0[_0x3900('0x13')]['id']:null,_0x23a4d0['user']?_0x23a4d0[_0x3900('0x13')][_0x3900('0x1b')]:null,_0x23a4d0[_0x3900('0x13')]?_0x23a4d0['user'][_0x3900('0x14')]:null,_0x23a4d0[_0x3900('0x15')]&&_0x23a4d0[_0x3900('0x15')][_0x3900('0x16')]?_0x23a4d0[_0x3900('0x15')][_0x3900('0x16')]:_0x3900('0x1c'),_0x23a4d0['body']&&_0x23a4d0['body'][_0x3900('0x17')]?_0x23a4d0['body']['agent_id']:'',_0x23a4d0['body']&&_0x23a4d0[_0x3900('0x15')][_0x3900('0x1d')]?_0x23a4d0[_0x3900('0x15')]['agent_name']:'');},'ignoreRoute':function(_0x149f91){var _0x328b3b=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x328b3b['test'](_0x149f91[_0x3900('0x1a')]);}}));_0x486c30['use'](_0x3900('0x1e'),require(_0x3900('0x1f')));_0x486c30[_0x3900('0x9')](_0x3900('0x20'),require('./api/voiceChanSpy'));_0x486c30[_0x3900('0x9')](_0x3900('0x21'),require(_0x3900('0x22')));_0x486c30[_0x3900('0x9')]('/api/voice/extensions',require(_0x3900('0x23')));_0x486c30[_0x3900('0x9')](_0x3900('0x24'),require(_0x3900('0x25')));_0x486c30[_0x3900('0x9')](_0x3900('0x26'),require(_0x3900('0x27')));_0x486c30[_0x3900('0x9')]('/api/voice/recordings',require(_0x3900('0x28')));_0x486c30[_0x3900('0x9')](_0x3900('0x29'),require(_0x3900('0x2a')));_0x486c30[_0x3900('0x9')](_0x3900('0x2b'),require(_0x3900('0x2c')));_0x486c30['use'](_0x3900('0x2d'),require('./api/voiceMailMessage'));_0x486c30[_0x3900('0x9')](_0x3900('0x2e'),require(_0x3900('0x2f')));_0x486c30['use']('/api/voice/dials/reports',require(_0x3900('0x30')));_0x486c30['use'](_0x3900('0x31'),require(_0x3900('0x32')));_0x486c30[_0x3900('0x9')](_0x3900('0x33'),require(_0x3900('0x34')));_0x486c30[_0x3900('0x9')](_0x3900('0x35'),require(_0x3900('0x36')));_0x486c30[_0x3900('0x9')](_0x3900('0x37'),require(_0x3900('0x38')));_0x486c30['use']('/api/voice/transfers/reports',require(_0x3900('0x39')));_0x486c30['use'](_0x3900('0x3a'),require(_0x3900('0x3b')));_0x486c30['use'](_0x3900('0x3c'),require(_0x3900('0x3d')));_0x486c30[_0x3900('0x9')]('/api/mail/queues',require('./api/mailQueue'));_0x486c30['use']('/api/mail/substatuses',require('./api/mailSubstatus'));_0x486c30[_0x3900('0x9')](_0x3900('0x3e'),require(_0x3900('0x3f')));_0x486c30[_0x3900('0x9')]('/api/mail/messages',require('./api/mailMessage'));_0x486c30[_0x3900('0x9')](_0x3900('0x40'),require(_0x3900('0x41')));_0x486c30[_0x3900('0x9')]('/api/mail/reports/queue',require(_0x3900('0x42')));_0x486c30[_0x3900('0x9')](_0x3900('0x43'),require('./api/dashboard'));_0x486c30[_0x3900('0x9')](_0x3900('0x44'),require(_0x3900('0x45')));_0x486c30['use'](_0x3900('0x46'),require(_0x3900('0x47')));_0x486c30[_0x3900('0x9')](_0x3900('0x48'),require(_0x3900('0x49')));_0x486c30[_0x3900('0x9')]('/api/fax/interactions',require(_0x3900('0x4a')));_0x486c30[_0x3900('0x9')]('/api/fax/messages',require('./api/faxMessage'));_0x486c30['use'](_0x3900('0x4b'),require(_0x3900('0x4c')));_0x486c30[_0x3900('0x9')](_0x3900('0x4d'),require(_0x3900('0x4e')));_0x486c30[_0x3900('0x9')](_0x3900('0x4f'),require('./api/smsAccount'));_0x486c30[_0x3900('0x9')]('/api/sms/applications',require(_0x3900('0x50')));_0x486c30[_0x3900('0x9')](_0x3900('0x51'),require(_0x3900('0x52')));_0x486c30[_0x3900('0x9')](_0x3900('0x53'),require(_0x3900('0x54')));_0x486c30[_0x3900('0x9')](_0x3900('0x55'),require(_0x3900('0x56')));_0x486c30[_0x3900('0x9')](_0x3900('0x57'),require(_0x3900('0x58')));_0x486c30[_0x3900('0x9')](_0x3900('0x59'),require(_0x3900('0x5a')));_0x486c30['use']('/api/openchannel/interactions',require(_0x3900('0x5b')));_0x486c30[_0x3900('0x9')]('/api/openchannel/messages',require(_0x3900('0x5c')));_0x486c30['use']('/api/openchannel/queues',require(_0x3900('0x5d')));_0x486c30['use']('/api/chat/websites',require('./api/chatWebsite'));_0x486c30[_0x3900('0x9')](_0x3900('0x5e'),require(_0x3900('0x5f')));_0x486c30[_0x3900('0x9')](_0x3900('0x60'),require('./api/chatApplication'));_0x486c30[_0x3900('0x9')]('/api/chat/interactions',require(_0x3900('0x61')));_0x486c30[_0x3900('0x9')](_0x3900('0x62'),require(_0x3900('0x63')));_0x486c30[_0x3900('0x9')](_0x3900('0x64'),require('./api/chatOfflineMessage'));_0x486c30[_0x3900('0x9')](_0x3900('0x65'),require('./api/chatQueue'));_0x486c30[_0x3900('0x9')](_0x3900('0x66'),require('./api/chatGroup'));_0x486c30['use'](_0x3900('0x67'),require(_0x3900('0x68')));_0x486c30[_0x3900('0x9')](_0x3900('0x69'),require(_0x3900('0x6a')));_0x486c30['use'](_0x3900('0x6b'),require(_0x3900('0x6c')));_0x486c30['use']('/api/cm/hopper',require(_0x3900('0x6d')));_0x486c30[_0x3900('0x9')](_0x3900('0x6e'),require(_0x3900('0x6f')));_0x486c30[_0x3900('0x9')](_0x3900('0x70'),require(_0x3900('0x71')));_0x486c30[_0x3900('0x9')]('/api/cm/hopper_history',require(_0x3900('0x72')));_0x486c30['use']('/api/cm/custom_fields',require(_0x3900('0x73')));_0x486c30[_0x3900('0x9')]('/api/actions',require(_0x3900('0x74')));_0x486c30['use'](_0x3900('0x75'),require(_0x3900('0x76')));_0x486c30['use'](_0x3900('0x77'),require(_0x3900('0x78')));_0x486c30[_0x3900('0x9')](_0x3900('0x79'),require('./api/disposition'));_0x486c30[_0x3900('0x9')](_0x3900('0x7a'),require(_0x3900('0x7b')));_0x486c30[_0x3900('0x9')](_0x3900('0x7c'),require(_0x3900('0x7d')));_0x486c30['use'](_0x3900('0x7e'),require(_0x3900('0x7f')));_0x486c30[_0x3900('0x9')]('/api/cdr',require(_0x3900('0x80')));_0x486c30[_0x3900('0x9')]('/api/voiceQueuesLog',require(_0x3900('0x81')));_0x486c30[_0x3900('0x9')](_0x3900('0x82'),require(_0x3900('0x83')));_0x486c30[_0x3900('0x9')](_0x3900('0x84'),require(_0x3900('0x85')));_0x486c30['use']('/api/tags',require(_0x3900('0x86')));_0x486c30['use'](_0x3900('0x87'),require(_0x3900('0x88')));_0x486c30[_0x3900('0x9')](_0x3900('0x89'),require('./api/trigger'));_0x486c30[_0x3900('0x9')](_0x3900('0x8a'),require('./api/variable'));_0x486c30[_0x3900('0x9')](_0x3900('0x8b'),require(_0x3900('0x8c')));_0x486c30[_0x3900('0x9')](_0x3900('0x8d'),require(_0x3900('0x8e')));_0x486c30[_0x3900('0x9')]('/api/analytics/custom_reports',require('./api/analyticCustomReport'));_0x486c30[_0x3900('0x9')](_0x3900('0x8f'),require(_0x3900('0x90')));_0x486c30[_0x3900('0x9')]('/api/analytics/extracted_reports',require(_0x3900('0x91')));_0x486c30['use'](_0x3900('0x92'),require('./api/analyticMetric'));_0x486c30['use'](_0x3900('0x93'),require(_0x3900('0x94')));_0x486c30[_0x3900('0x9')](_0x3900('0x95'),require(_0x3900('0x96')));_0x486c30[_0x3900('0x9')](_0x3900('0x97'),require(_0x3900('0x98')));_0x486c30[_0x3900('0x9')](_0x3900('0x99'),require('./api/intSalesforceConfiguration'));_0x486c30['use'](_0x3900('0x9a'),require('./api/intSalesforceField'));_0x486c30[_0x3900('0x9')](_0x3900('0x9b'),require(_0x3900('0x9c')));_0x486c30[_0x3900('0x9')]('/api/integrations/sugarcrm/configurations',require(_0x3900('0x9d')));_0x486c30[_0x3900('0x9')]('/api/integrations/sugarcrm/fields',require(_0x3900('0x9e')));_0x486c30[_0x3900('0x9')](_0x3900('0x9f'),require('./api/intDeskAccount'));_0x486c30[_0x3900('0x9')](_0x3900('0xa0'),require(_0x3900('0xa1')));_0x486c30[_0x3900('0x9')](_0x3900('0xa2'),require(_0x3900('0xa3')));_0x486c30[_0x3900('0x9')]('/api/integrations/zoho/accounts',require(_0x3900('0xa4')));_0x486c30['use'](_0x3900('0xa5'),require(_0x3900('0xa6')));_0x486c30['use']('/api/integrations/zoho/fields',require('./api/intZohoField'));_0x486c30[_0x3900('0x9')](_0x3900('0xa7'),require(_0x3900('0xa8')));_0x486c30[_0x3900('0x9')](_0x3900('0xa9'),require(_0x3900('0xaa')));_0x486c30['use'](_0x3900('0xab'),require(_0x3900('0xac')));_0x486c30[_0x3900('0x9')](_0x3900('0xad'),require(_0x3900('0xae')));_0x486c30[_0x3900('0x9')]('/api/integrations/freshdesk/configurations',require(_0x3900('0xaf')));_0x486c30[_0x3900('0x9')](_0x3900('0xb0'),require('./api/intFreshdeskField'));_0x486c30[_0x3900('0x9')](_0x3900('0xb1'),require(_0x3900('0xb2')));_0x486c30['use'](_0x3900('0xb3'),require(_0x3900('0xb4')));_0x486c30['use'](_0x3900('0xb5'),require(_0x3900('0xb6')));_0x486c30[_0x3900('0x9')](_0x3900('0xb7'),require(_0x3900('0xb8')));_0x486c30[_0x3900('0x9')](_0x3900('0xb9'),require(_0x3900('0xba')));_0x486c30[_0x3900('0x9')]('/api/integrations/servicenow/fields',require(_0x3900('0xbb')));_0x486c30[_0x3900('0x9')]('/api/integrations/dynamics365/accounts',require(_0x3900('0xbc')));_0x486c30[_0x3900('0x9')](_0x3900('0xbd'),require('./api/intDynamics365Configuration'));_0x486c30[_0x3900('0x9')](_0x3900('0xbe'),require('./api/intDynamics365Field'));_0x486c30[_0x3900('0x9')](_0x3900('0xbf'),require('./api/intFreshsalesAccount'));_0x486c30['use'](_0x3900('0xc0'),require(_0x3900('0xc1')));_0x486c30['use'](_0x3900('0xc2'),require(_0x3900('0xc3')));_0x486c30[_0x3900('0x9')]('/api/networks',require(_0x3900('0xc4')));_0x486c30['use'](_0x3900('0xc5'),require(_0x3900('0xc6')));_0x486c30['use'](_0x3900('0xc7'),require('./api/chatInternalMessage'));_0x486c30['use'](_0x3900('0xc8'),require(_0x3900('0xc9')));_0x486c30['use'](_0x3900('0xca'),require(_0x3900('0xcb')));_0x486c30[_0x3900('0x9')]('/api/jscripty/sessions/reports',require('./api/jscriptySessionReport'));_0x486c30[_0x3900('0x9')](_0x3900('0xcc'),require(_0x3900('0xcd')));_0x486c30[_0x3900('0x9')](_0x3900('0xce'),require(_0x3900('0xcf')));_0x486c30['use'](_0x3900('0xd0'),require(_0x3900('0xd1')));_0x486c30['use'](_0x3900('0xd2'),require(_0x3900('0xd3')));_0x486c30['use'](_0x3900('0xd4'),require(_0x3900('0xd5')));_0x486c30['use'](_0x3900('0xd6'),require(_0x3900('0xd7')));_0x486c30[_0x3900('0x9')]('/api/square/projects',require(_0x3900('0xd8')));_0x486c30[_0x3900('0x9')](_0x3900('0xd9'),require(_0x3900('0xda')));_0x486c30['use'](_0x3900('0xdb'),require(_0x3900('0xdc')));_0x486c30['use'](_0x3900('0xdd'),require(_0x3900('0xde')));_0x486c30[_0x3900('0x9')](_0x3900('0xdf'),require(_0x3900('0xe0')));_0x486c30[_0x3900('0x9')](_0x3900('0xe1'),require('./api/campaign'));_0x486c30['use']('/api/migrations',require(_0x3900('0xe2')));_0x486c30[_0x3900('0x9')](_0x3900('0xe3'),require(_0x3900('0xe4')));_0x486c30[_0x3900('0x9')](_0x3900('0xe5'),require(_0x3900('0xe6')));_0x486c30[_0x3900('0x9')](_0x3900('0xe7'),require(_0x3900('0xe8')));_0x486c30[_0x3900('0x9')]('/api/chat/reports/transfer',require('./api/chatTransferReport'));_0x486c30[_0x3900('0x9')](_0x3900('0xe9'),require(_0x3900('0xea')));_0x486c30[_0x3900('0x9')](_0x3900('0xeb'),require(_0x3900('0xec')));_0x486c30[_0x3900('0x9')](_0x3900('0xed'),require(_0x3900('0xee')));_0x486c30['use'](_0x3900('0xef'),require(_0x3900('0xf0')));_0x486c30['use'](_0x3900('0xf1'),require(_0x3900('0xf2')));_0x486c30[_0x3900('0x9')](_0x3900('0xf3'),require(_0x3900('0xf4')));_0x486c30[_0x3900('0x9')](_0x3900('0xf5'),require(_0x3900('0xf6')));_0x486c30[_0x3900('0x9')](_0x3900('0xf7'),require(_0x3900('0xf8')));_0x486c30[_0x3900('0x9')](_0x3900('0xf9'),require(_0x3900('0xfa')));_0x486c30[_0x3900('0x9')](_0x3900('0xfb'),require(_0x3900('0xfc')));_0x486c30[_0x3900('0x9')](_0x3900('0xfd'),require(_0x3900('0xfe')));_0x486c30[_0x3900('0x9')]('/api/rpc',require(_0x3900('0xff')));_0x486c30[_0x3900('0x9')](_0x3900('0x100'),require(_0x3900('0x101')));_0x486c30['use'](_0x3900('0x102'),require('./api/system'));_0x486c30['use'](_0x3900('0x103'),require(_0x3900('0x104')));_0x486c30[_0x3900('0x9')](_0x3900('0x105'),express[_0x3900('0x106')](path[_0x3900('0x107')](config[_0x3900('0x108')],_0x3900('0x105'))));_0x486c30[_0x3900('0x9')](_0x3900('0x109'),express[_0x3900('0x106')](path['join'](config['root'],_0x3900('0x109'))));_0x486c30[_0x3900('0x9')](_0x3900('0x10a'),express['static'](path['join'](config[_0x3900('0x108')],_0x3900('0x10a'))));_0x486c30['use'](_0x3900('0x10b'),express[_0x3900('0x106')](path[_0x3900('0x107')](config[_0x3900('0x108')],'snippet',_0x3900('0x10c'))));_0x486c30['use']('/plugins',express[_0x3900('0x106')](path['join'](config[_0x3900('0x108')],_0x3900('0x10d'))));_0x486c30[_0x3900('0x10e')](_0x3900('0x10f'))[_0x3900('0x110')](errors[0x194]);_0x486c30[_0x3900('0x10e')]('/*')[_0x3900('0x110')](function(_0x62a008,_0xb4e372){_0xb4e372[_0x3900('0x111')](path[_0x3900('0x112')](_0x486c30[_0x3900('0x110')](_0x3900('0x113'))+_0x3900('0x114')));});}; \ No newline at end of file +var _0x0a2c=['./api/faxMessage','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','/api/sms/applications','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','/api/sms/queues','./api/smsQueue','./api/openchannelAccount','/api/openchannel/applications','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','./api/chatWebsite','/api/chat/applications','/api/chat/interactions','./api/chatInteraction','./api/chatOfflineMessage','./api/chatQueue','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','/api/cm/companies','/api/cm/contacts','./api/cmContact','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','./api/cmCustomField','/api/actions','./api/action','./api/automation','/api/canned_answers','./api/cannedAnswer','/api/dispositions','./api/disposition','/api/conditions','/api/intervals','./api/interval','/api/pauses','./api/pause','/api/cdr','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','/api/sounds','./api/sound','/api/tags','./api/tag','/api/templates','./api/template','/api/triggers','./api/trigger','/api/variables','./api/variable','/api/integrations','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerField','/api/integrations/servicenow/accounts','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','./api/network','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','./api/jscriptySessionReport','/api/sms/reports/queue','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','/api/settings','/api/square/odbc','./api/squareOdbc','./api/squareProject','/api/square/recordings','./api/squareRecording','./api/squareMessage','/api/teams','/api/license','./api/license','/api/campaigns','./api/campaign','/api/migrations','./api/migration','./api/attachment','/api/plugins','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','./api/faxTransferReport','/api/openchannel/reports/transfer','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','/api/voice/prefixes','/api/userProfiles','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/auth/local','./api/authGoogle','./api/jira','/api/rpc','./api/rpc','./api/version','/api/system','./api/system','/api/pm2','./api/pm2','/apidoc','static','join','root','/www','/demo','/snippet','snippet','1.0.16','/plugins','route','get','sendFile','resolve','appPath','/index.html','path','util','./errors','./config/environment','api','./config/logger','auth','logger','format','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','method','x-forwarded-for','headers','connection','remoteAddress','url','statusCode','user','name','use','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','body','device','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','responseTime','role','other','agent_name','/api/users','./api/user','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','./api/memberReport','/api/trunks','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','./api/mailMessage','./api/mailApplication','./api/mailQueueReport','/api/dashboards','./api/dashboard','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','/api/fax/applications','./api/faxApplication','/api/fax/interactions'];(function(_0x1d2bbb,_0x202267){var _0x38082b=function(_0x27d153){while(--_0x27d153){_0x1d2bbb['push'](_0x1d2bbb['shift']());}};_0x38082b(++_0x202267);}(_0x0a2c,0x1df));var _0xc0a2=function(_0x299052,_0x153acc){_0x299052=_0x299052-0x0;var _0x5da0a4=_0x0a2c[_0x299052];return _0x5da0a4;};'use strict';var path=require(_0xc0a2('0x0'));var express=require('express');var ewinston=require('express-winston');var util=require(_0xc0a2('0x1'));var errors=require(_0xc0a2('0x2'));var config=require(_0xc0a2('0x3'));var logger=require('./config/logger')(_0xc0a2('0x4'));var authLogger=require(_0xc0a2('0x5'))(_0xc0a2('0x6'));exports['default']=function(_0x4b3895){_0x4b3895['use'](ewinston[_0xc0a2('0x7')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x1609a3,_0x4d23f7){return util[_0xc0a2('0x8')](_0xc0a2('0x9'),_0x1609a3[_0xc0a2('0xa')],_0x1609a3['headers'][_0xc0a2('0xb')]?_0x1609a3[_0xc0a2('0xc')][_0xc0a2('0xb')]:_0x1609a3[_0xc0a2('0xd')][_0xc0a2('0xe')]||_0x1609a3['ip'],_0x1609a3[_0xc0a2('0xf')],_0x4d23f7[_0xc0a2('0x10')],_0x4d23f7['responseTime'],_0x1609a3['user']?_0x1609a3[_0xc0a2('0x11')]['id']:null,_0x1609a3[_0xc0a2('0x11')]?_0x1609a3[_0xc0a2('0x11')][_0xc0a2('0x12')]:null,_0x1609a3[_0xc0a2('0x11')]?_0x1609a3[_0xc0a2('0x11')]['role']:null);}}));_0x4b3895[_0xc0a2('0x13')](ewinston[_0xc0a2('0x7')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x490670,_0x52d3bf){var _0x2c9cf7=_0xc0a2('0x14');if(_0x490670[_0xc0a2('0x15')]&&_0x490670['body'][_0xc0a2('0x16')]&&_0x490670['body'][_0xc0a2('0x17')]){_0x2c9cf7=_0xc0a2('0x18');}return util[_0xc0a2('0x8')](_0x2c9cf7,_0x490670[_0xc0a2('0xa')],_0x490670[_0xc0a2('0xc')]['x-forwarded-for']?_0x490670['headers'][_0xc0a2('0xb')]:_0x490670['connection'][_0xc0a2('0xe')]||_0x490670['ip'],_0x490670[_0xc0a2('0xf')],_0x52d3bf[_0xc0a2('0x10')],_0x52d3bf[_0xc0a2('0x19')],_0x490670[_0xc0a2('0x11')]?_0x490670['user']['id']:null,_0x490670['user']?_0x490670[_0xc0a2('0x11')][_0xc0a2('0x12')]:null,_0x490670[_0xc0a2('0x11')]?_0x490670[_0xc0a2('0x11')][_0xc0a2('0x1a')]:null,_0x490670['body']&&_0x490670[_0xc0a2('0x15')][_0xc0a2('0x16')]?_0x490670[_0xc0a2('0x15')]['device']:_0xc0a2('0x1b'),_0x490670[_0xc0a2('0x15')]&&_0x490670[_0xc0a2('0x15')][_0xc0a2('0x17')]?_0x490670[_0xc0a2('0x15')][_0xc0a2('0x17')]:'',_0x490670[_0xc0a2('0x15')]&&_0x490670['body'][_0xc0a2('0x1c')]?_0x490670[_0xc0a2('0x15')][_0xc0a2('0x1c')]:'');},'ignoreRoute':function(_0x47cca6){var _0x5f2789=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x5f2789['test'](_0x47cca6[_0xc0a2('0xf')]);}}));_0x4b3895['use'](_0xc0a2('0x1d'),require(_0xc0a2('0x1e')));_0x4b3895[_0xc0a2('0x13')](_0xc0a2('0x1f'),require(_0xc0a2('0x20')));_0x4b3895[_0xc0a2('0x13')](_0xc0a2('0x21'),require(_0xc0a2('0x22')));_0x4b3895['use']('/api/voice/extensions',require('./api/voiceExtension'));_0x4b3895[_0xc0a2('0x13')]('/api/voice/mohs',require(_0xc0a2('0x23')));_0x4b3895['use'](_0xc0a2('0x24'),require(_0xc0a2('0x25')));_0x4b3895['use'](_0xc0a2('0x26'),require(_0xc0a2('0x27')));_0x4b3895['use'](_0xc0a2('0x28'),require(_0xc0a2('0x29')));_0x4b3895['use']('/api/voice/mails',require('./api/voiceMail'));_0x4b3895['use'](_0xc0a2('0x2a'),require(_0xc0a2('0x2b')));_0x4b3895['use'](_0xc0a2('0x2c'),require(_0xc0a2('0x2d')));_0x4b3895[_0xc0a2('0x13')](_0xc0a2('0x2e'),require(_0xc0a2('0x2f')));_0x4b3895[_0xc0a2('0x13')](_0xc0a2('0x30'),require('./api/voiceAgentReport'));_0x4b3895[_0xc0a2('0x13')](_0xc0a2('0x31'),require(_0xc0a2('0x32')));_0x4b3895[_0xc0a2('0x13')](_0xc0a2('0x33'),require(_0xc0a2('0x34')));_0x4b3895[_0xc0a2('0x13')](_0xc0a2('0x35'),require('./api/trunk'));_0x4b3895[_0xc0a2('0x13')](_0xc0a2('0x36'),require(_0xc0a2('0x37')));_0x4b3895['use'](_0xc0a2('0x38'),require(_0xc0a2('0x39')));_0x4b3895[_0xc0a2('0x13')](_0xc0a2('0x3a'),require('./api/mailAccount'));_0x4b3895[_0xc0a2('0x13')](_0xc0a2('0x3b'),require(_0xc0a2('0x3c')));_0x4b3895[_0xc0a2('0x13')](_0xc0a2('0x3d'),require('./api/mailSubstatus'));_0x4b3895['use'](_0xc0a2('0x3e'),require(_0xc0a2('0x3f')));_0x4b3895[_0xc0a2('0x13')](_0xc0a2('0x40'),require(_0xc0a2('0x41')));_0x4b3895[_0xc0a2('0x13')]('/api/mail/applications',require(_0xc0a2('0x42')));_0x4b3895[_0xc0a2('0x13')]('/api/mail/reports/queue',require(_0xc0a2('0x43')));_0x4b3895['use'](_0xc0a2('0x44'),require(_0xc0a2('0x45')));_0x4b3895[_0xc0a2('0x13')](_0xc0a2('0x46'),require(_0xc0a2('0x47')));_0x4b3895['use'](_0xc0a2('0x48'),require(_0xc0a2('0x49')));_0x4b3895[_0xc0a2('0x13')](_0xc0a2('0x4a'),require(_0xc0a2('0x4b')));_0x4b3895[_0xc0a2('0x13')](_0xc0a2('0x4c'),require('./api/faxInteraction'));_0x4b3895[_0xc0a2('0x13')]('/api/fax/messages',require(_0xc0a2('0x4d')));_0x4b3895['use']('/api/fax/queues',require('./api/faxQueue'));_0x4b3895[_0xc0a2('0x13')](_0xc0a2('0x4e'),require(_0xc0a2('0x4f')));_0x4b3895[_0xc0a2('0x13')](_0xc0a2('0x50'),require('./api/smsAccount'));_0x4b3895[_0xc0a2('0x13')](_0xc0a2('0x51'),require('./api/smsApplication'));_0x4b3895[_0xc0a2('0x13')](_0xc0a2('0x52'),require(_0xc0a2('0x53')));_0x4b3895[_0xc0a2('0x13')](_0xc0a2('0x54'),require('./api/smsMessage'));_0x4b3895[_0xc0a2('0x13')](_0xc0a2('0x55'),require(_0xc0a2('0x56')));_0x4b3895[_0xc0a2('0x13')]('/api/openchannel/accounts',require(_0xc0a2('0x57')));_0x4b3895['use'](_0xc0a2('0x58'),require('./api/openchannelApplication'));_0x4b3895[_0xc0a2('0x13')](_0xc0a2('0x59'),require(_0xc0a2('0x5a')));_0x4b3895[_0xc0a2('0x13')](_0xc0a2('0x5b'),require(_0xc0a2('0x5c')));_0x4b3895[_0xc0a2('0x13')](_0xc0a2('0x5d'),require('./api/openchannelQueue'));_0x4b3895[_0xc0a2('0x13')]('/api/chat/websites',require(_0xc0a2('0x5e')));_0x4b3895[_0xc0a2('0x13')]('/api/openchannel/reports/queue',require('./api/openchannelQueueReport'));_0x4b3895['use'](_0xc0a2('0x5f'),require('./api/chatApplication'));_0x4b3895[_0xc0a2('0x13')](_0xc0a2('0x60'),require(_0xc0a2('0x61')));_0x4b3895['use']('/api/chat/messages',require('./api/chatMessage'));_0x4b3895[_0xc0a2('0x13')]('/api/chat/offline_messages',require(_0xc0a2('0x62')));_0x4b3895['use']('/api/chat/queues',require(_0xc0a2('0x63')));_0x4b3895[_0xc0a2('0x13')](_0xc0a2('0x64'),require(_0xc0a2('0x65')));_0x4b3895['use'](_0xc0a2('0x66'),require('./api/chatProactiveAction'));_0x4b3895[_0xc0a2('0x13')](_0xc0a2('0x67'),require('./api/cmCompany'));_0x4b3895[_0xc0a2('0x13')](_0xc0a2('0x68'),require(_0xc0a2('0x69')));_0x4b3895['use'](_0xc0a2('0x6a'),require(_0xc0a2('0x6b')));_0x4b3895[_0xc0a2('0x13')](_0xc0a2('0x6c'),require('./api/cmHopperBlack'));_0x4b3895['use'](_0xc0a2('0x6d'),require(_0xc0a2('0x6e')));_0x4b3895[_0xc0a2('0x13')](_0xc0a2('0x6f'),require(_0xc0a2('0x70')));_0x4b3895[_0xc0a2('0x13')]('/api/cm/custom_fields',require(_0xc0a2('0x71')));_0x4b3895[_0xc0a2('0x13')](_0xc0a2('0x72'),require(_0xc0a2('0x73')));_0x4b3895[_0xc0a2('0x13')]('/api/automations',require(_0xc0a2('0x74')));_0x4b3895[_0xc0a2('0x13')](_0xc0a2('0x75'),require(_0xc0a2('0x76')));_0x4b3895[_0xc0a2('0x13')](_0xc0a2('0x77'),require(_0xc0a2('0x78')));_0x4b3895[_0xc0a2('0x13')](_0xc0a2('0x79'),require('./api/condition'));_0x4b3895[_0xc0a2('0x13')](_0xc0a2('0x7a'),require(_0xc0a2('0x7b')));_0x4b3895[_0xc0a2('0x13')](_0xc0a2('0x7c'),require(_0xc0a2('0x7d')));_0x4b3895[_0xc0a2('0x13')](_0xc0a2('0x7e'),require(_0xc0a2('0x7f')));_0x4b3895[_0xc0a2('0x13')](_0xc0a2('0x80'),require(_0xc0a2('0x81')));_0x4b3895[_0xc0a2('0x13')](_0xc0a2('0x82'),require('./api/schedule'));_0x4b3895[_0xc0a2('0x13')](_0xc0a2('0x83'),require(_0xc0a2('0x84')));_0x4b3895['use'](_0xc0a2('0x85'),require(_0xc0a2('0x86')));_0x4b3895[_0xc0a2('0x13')](_0xc0a2('0x87'),require(_0xc0a2('0x88')));_0x4b3895['use'](_0xc0a2('0x89'),require(_0xc0a2('0x8a')));_0x4b3895[_0xc0a2('0x13')](_0xc0a2('0x8b'),require(_0xc0a2('0x8c')));_0x4b3895[_0xc0a2('0x13')](_0xc0a2('0x8d'),require('./api/integration'));_0x4b3895[_0xc0a2('0x13')]('/api/integrations/reports',require(_0xc0a2('0x8e')));_0x4b3895[_0xc0a2('0x13')](_0xc0a2('0x8f'),require(_0xc0a2('0x90')));_0x4b3895[_0xc0a2('0x13')]('/api/analytics/default_reports',require('./api/analyticDefaultReport'));_0x4b3895[_0xc0a2('0x13')](_0xc0a2('0x91'),require(_0xc0a2('0x92')));_0x4b3895[_0xc0a2('0x13')](_0xc0a2('0x93'),require(_0xc0a2('0x94')));_0x4b3895['use'](_0xc0a2('0x95'),require(_0xc0a2('0x96')));_0x4b3895[_0xc0a2('0x13')](_0xc0a2('0x97'),require(_0xc0a2('0x98')));_0x4b3895[_0xc0a2('0x13')](_0xc0a2('0x99'),require(_0xc0a2('0x9a')));_0x4b3895['use'](_0xc0a2('0x9b'),require(_0xc0a2('0x9c')));_0x4b3895[_0xc0a2('0x13')](_0xc0a2('0x9d'),require(_0xc0a2('0x9e')));_0x4b3895[_0xc0a2('0x13')](_0xc0a2('0x9f'),require(_0xc0a2('0xa0')));_0x4b3895[_0xc0a2('0x13')](_0xc0a2('0xa1'),require(_0xc0a2('0xa2')));_0x4b3895[_0xc0a2('0x13')](_0xc0a2('0xa3'),require(_0xc0a2('0xa4')));_0x4b3895[_0xc0a2('0x13')](_0xc0a2('0xa5'),require(_0xc0a2('0xa6')));_0x4b3895['use']('/api/integrations/desk/configurations',require(_0xc0a2('0xa7')));_0x4b3895[_0xc0a2('0x13')](_0xc0a2('0xa8'),require(_0xc0a2('0xa9')));_0x4b3895[_0xc0a2('0x13')](_0xc0a2('0xaa'),require(_0xc0a2('0xab')));_0x4b3895['use'](_0xc0a2('0xac'),require(_0xc0a2('0xad')));_0x4b3895[_0xc0a2('0x13')](_0xc0a2('0xae'),require(_0xc0a2('0xaf')));_0x4b3895[_0xc0a2('0x13')]('/api/integrations/zendesk/accounts',require('./api/intZendeskAccount'));_0x4b3895[_0xc0a2('0x13')](_0xc0a2('0xb0'),require(_0xc0a2('0xb1')));_0x4b3895[_0xc0a2('0x13')](_0xc0a2('0xb2'),require('./api/intZendeskField'));_0x4b3895['use'](_0xc0a2('0xb3'),require(_0xc0a2('0xb4')));_0x4b3895[_0xc0a2('0x13')](_0xc0a2('0xb5'),require(_0xc0a2('0xb6')));_0x4b3895[_0xc0a2('0x13')]('/api/integrations/freshdesk/fields',require(_0xc0a2('0xb7')));_0x4b3895[_0xc0a2('0x13')](_0xc0a2('0xb8'),require(_0xc0a2('0xb9')));_0x4b3895[_0xc0a2('0x13')](_0xc0a2('0xba'),require('./api/intVtigerConfiguration'));_0x4b3895[_0xc0a2('0x13')]('/api/integrations/vtiger/fields',require(_0xc0a2('0xbb')));_0x4b3895[_0xc0a2('0x13')](_0xc0a2('0xbc'),require('./api/intServicenowAccount'));_0x4b3895[_0xc0a2('0x13')](_0xc0a2('0xbd'),require(_0xc0a2('0xbe')));_0x4b3895['use'](_0xc0a2('0xbf'),require('./api/intServicenowField'));_0x4b3895[_0xc0a2('0x13')](_0xc0a2('0xc0'),require(_0xc0a2('0xc1')));_0x4b3895['use'](_0xc0a2('0xc2'),require(_0xc0a2('0xc3')));_0x4b3895['use'](_0xc0a2('0xc4'),require(_0xc0a2('0xc5')));_0x4b3895[_0xc0a2('0x13')](_0xc0a2('0xc6'),require(_0xc0a2('0xc7')));_0x4b3895[_0xc0a2('0x13')](_0xc0a2('0xc8'),require(_0xc0a2('0xc9')));_0x4b3895['use'](_0xc0a2('0xca'),require(_0xc0a2('0xcb')));_0x4b3895[_0xc0a2('0x13')](_0xc0a2('0xcc'),require(_0xc0a2('0xcd')));_0x4b3895[_0xc0a2('0x13')](_0xc0a2('0xce'),require(_0xc0a2('0xcf')));_0x4b3895[_0xc0a2('0x13')](_0xc0a2('0xd0'),require(_0xc0a2('0xd1')));_0x4b3895['use'](_0xc0a2('0xd2'),require('./api/jscriptyAnswerReport'));_0x4b3895[_0xc0a2('0x13')](_0xc0a2('0xd3'),require(_0xc0a2('0xd4')));_0x4b3895['use']('/api/jscripty/sessions/reports',require(_0xc0a2('0xd5')));_0x4b3895[_0xc0a2('0x13')](_0xc0a2('0xd6'),require('./api/smsQueueReport'));_0x4b3895[_0xc0a2('0x13')](_0xc0a2('0xd7'),require(_0xc0a2('0xd8')));_0x4b3895[_0xc0a2('0x13')](_0xc0a2('0xd9'),require(_0xc0a2('0xda')));_0x4b3895[_0xc0a2('0x13')](_0xc0a2('0xdb'),require(_0xc0a2('0xdc')));_0x4b3895[_0xc0a2('0x13')](_0xc0a2('0xdd'),require('./api/setting'));_0x4b3895[_0xc0a2('0x13')](_0xc0a2('0xde'),require(_0xc0a2('0xdf')));_0x4b3895[_0xc0a2('0x13')]('/api/square/projects',require(_0xc0a2('0xe0')));_0x4b3895[_0xc0a2('0x13')](_0xc0a2('0xe1'),require(_0xc0a2('0xe2')));_0x4b3895['use']('/api/square/messages',require(_0xc0a2('0xe3')));_0x4b3895[_0xc0a2('0x13')](_0xc0a2('0xe4'),require('./api/team'));_0x4b3895['use'](_0xc0a2('0xe5'),require(_0xc0a2('0xe6')));_0x4b3895['use'](_0xc0a2('0xe7'),require(_0xc0a2('0xe8')));_0x4b3895['use'](_0xc0a2('0xe9'),require(_0xc0a2('0xea')));_0x4b3895['use']('/api/attachments',require(_0xc0a2('0xeb')));_0x4b3895['use'](_0xc0a2('0xec'),require('./api/plugin'));_0x4b3895[_0xc0a2('0x13')](_0xc0a2('0xed'),require(_0xc0a2('0xee')));_0x4b3895[_0xc0a2('0x13')](_0xc0a2('0xef'),require(_0xc0a2('0xf0')));_0x4b3895[_0xc0a2('0x13')]('/api/fax/reports/transfer',require(_0xc0a2('0xf1')));_0x4b3895[_0xc0a2('0x13')](_0xc0a2('0xf2'),require('./api/openchannelTransferReport'));_0x4b3895[_0xc0a2('0x13')](_0xc0a2('0xf3'),require(_0xc0a2('0xf4')));_0x4b3895[_0xc0a2('0x13')](_0xc0a2('0xf5'),require('./api/cmList'));_0x4b3895['use'](_0xc0a2('0xf6'),require('./api/voicePrefix'));_0x4b3895[_0xc0a2('0x13')](_0xc0a2('0xf7'),require('./api/userProfile'));_0x4b3895['use'](_0xc0a2('0xf8'),require(_0xc0a2('0xf9')));_0x4b3895[_0xc0a2('0x13')](_0xc0a2('0xfa'),require(_0xc0a2('0xfb')));_0x4b3895[_0xc0a2('0x13')](_0xc0a2('0xfc'),require('./api/authLocal'));_0x4b3895[_0xc0a2('0x13')]('/api/auth/google',require(_0xc0a2('0xfd')));_0x4b3895[_0xc0a2('0x13')]('/api/jira',require(_0xc0a2('0xfe')));_0x4b3895[_0xc0a2('0x13')](_0xc0a2('0xff'),require(_0xc0a2('0x100')));_0x4b3895[_0xc0a2('0x13')]('/api/version',require(_0xc0a2('0x101')));_0x4b3895[_0xc0a2('0x13')](_0xc0a2('0x102'),require(_0xc0a2('0x103')));_0x4b3895[_0xc0a2('0x13')](_0xc0a2('0x104'),require(_0xc0a2('0x105')));_0x4b3895[_0xc0a2('0x13')](_0xc0a2('0x106'),express[_0xc0a2('0x107')](path[_0xc0a2('0x108')](config[_0xc0a2('0x109')],'/apidoc')));_0x4b3895['use'](_0xc0a2('0x10a'),express[_0xc0a2('0x107')](path[_0xc0a2('0x108')](config[_0xc0a2('0x109')],_0xc0a2('0x10a'))));_0x4b3895[_0xc0a2('0x13')](_0xc0a2('0x10b'),express['static'](path[_0xc0a2('0x108')](config[_0xc0a2('0x109')],'/demo')));_0x4b3895['use'](_0xc0a2('0x10c'),express[_0xc0a2('0x107')](path[_0xc0a2('0x108')](config[_0xc0a2('0x109')],_0xc0a2('0x10d'),_0xc0a2('0x10e'))));_0x4b3895[_0xc0a2('0x13')](_0xc0a2('0x10f'),express[_0xc0a2('0x107')](path['join'](config[_0xc0a2('0x109')],'/server/files/plugins')));_0x4b3895[_0xc0a2('0x110')]('/:url(api|auth|components|app|bower_components|assets)/*')[_0xc0a2('0x111')](errors[0x194]);_0x4b3895[_0xc0a2('0x110')]('/*')['get'](function(_0x147534,_0x212e37){_0x212e37[_0xc0a2('0x112')](path[_0xc0a2('0x113')](_0x4b3895[_0xc0a2('0x111')](_0xc0a2('0x114'))+_0xc0a2('0x115')));});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 49c31d3..ee19d2e 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3ea0=['../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/plugin/plugin.rpc','http','rpc','port','error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','RPC\x20listening\x20on\x20','jayson/promise','bluebird','lodash','listen','merge','../api/user/user.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc'];(function(_0x4e00d4,_0xdb24a3){var _0x335d2c=function(_0x19d6eb){while(--_0x19d6eb){_0x4e00d4['push'](_0x4e00d4['shift']());}};_0x335d2c(++_0xdb24a3);}(_0x3ea0,0x1bd));var _0x03ea=function(_0x1daebd,_0x79a89){_0x1daebd=_0x1daebd-0x0;var _0x462a89=_0x3ea0[_0x1daebd];return _0x462a89;};'use strict';var jayson=require(_0x03ea('0x0'));var BPromise=require(_0x03ea('0x1'));var _=require(_0x03ea('0x2'));var config=require('../config/environment');exports[_0x03ea('0x3')]=function(){return new BPromise(function(_0x16a92c,_0xc43faa){var _0x11e061={};_0x11e061=_[_0x03ea('0x4')](_0x11e061,require(_0x03ea('0x5')));_0x11e061=_['merge'](_0x11e061,require('../api/voiceExtension/voiceExtension.rpc'));_0x11e061=_[_0x03ea('0x4')](_0x11e061,require(_0x03ea('0x6')));_0x11e061=_[_0x03ea('0x4')](_0x11e061,require(_0x03ea('0x7')));_0x11e061=_[_0x03ea('0x4')](_0x11e061,require('../api/voiceCallReport/voiceCallReport.rpc'));_0x11e061=_[_0x03ea('0x4')](_0x11e061,require(_0x03ea('0x8')));_0x11e061=_[_0x03ea('0x4')](_0x11e061,require(_0x03ea('0x9')));_0x11e061=_[_0x03ea('0x4')](_0x11e061,require(_0x03ea('0xa')));_0x11e061=_[_0x03ea('0x4')](_0x11e061,require(_0x03ea('0xb')));_0x11e061=_['merge'](_0x11e061,require(_0x03ea('0xc')));_0x11e061=_[_0x03ea('0x4')](_0x11e061,require(_0x03ea('0xd')));_0x11e061=_[_0x03ea('0x4')](_0x11e061,require(_0x03ea('0xe')));_0x11e061=_[_0x03ea('0x4')](_0x11e061,require(_0x03ea('0xf')));_0x11e061=_[_0x03ea('0x4')](_0x11e061,require('../api/mailAccount/mailAccount.rpc'));_0x11e061=_[_0x03ea('0x4')](_0x11e061,require(_0x03ea('0x10')));_0x11e061=_[_0x03ea('0x4')](_0x11e061,require(_0x03ea('0x11')));_0x11e061=_[_0x03ea('0x4')](_0x11e061,require('../api/mailMessage/mailMessage.rpc'));_0x11e061=_[_0x03ea('0x4')](_0x11e061,require('../api/mailApplication/mailApplication.rpc'));_0x11e061=_[_0x03ea('0x4')](_0x11e061,require('../api/mailQueueReport/mailQueueReport.rpc'));_0x11e061=_[_0x03ea('0x4')](_0x11e061,require('../api/faxAccount/faxAccount.rpc'));_0x11e061=_['merge'](_0x11e061,require(_0x03ea('0x12')));_0x11e061=_[_0x03ea('0x4')](_0x11e061,require(_0x03ea('0x13')));_0x11e061=_[_0x03ea('0x4')](_0x11e061,require(_0x03ea('0x14')));_0x11e061=_[_0x03ea('0x4')](_0x11e061,require(_0x03ea('0x15')));_0x11e061=_[_0x03ea('0x4')](_0x11e061,require(_0x03ea('0x16')));_0x11e061=_[_0x03ea('0x4')](_0x11e061,require(_0x03ea('0x17')));_0x11e061=_[_0x03ea('0x4')](_0x11e061,require(_0x03ea('0x18')));_0x11e061=_[_0x03ea('0x4')](_0x11e061,require(_0x03ea('0x19')));_0x11e061=_[_0x03ea('0x4')](_0x11e061,require(_0x03ea('0x1a')));_0x11e061=_[_0x03ea('0x4')](_0x11e061,require('../api/openchannelApplication/openchannelApplication.rpc'));_0x11e061=_['merge'](_0x11e061,require(_0x03ea('0x1b')));_0x11e061=_[_0x03ea('0x4')](_0x11e061,require(_0x03ea('0x1c')));_0x11e061=_['merge'](_0x11e061,require('../api/openchannelQueue/openchannelQueue.rpc'));_0x11e061=_['merge'](_0x11e061,require(_0x03ea('0x1d')));_0x11e061=_[_0x03ea('0x4')](_0x11e061,require(_0x03ea('0x1e')));_0x11e061=_['merge'](_0x11e061,require(_0x03ea('0x1f')));_0x11e061=_[_0x03ea('0x4')](_0x11e061,require(_0x03ea('0x20')));_0x11e061=_[_0x03ea('0x4')](_0x11e061,require(_0x03ea('0x21')));_0x11e061=_[_0x03ea('0x4')](_0x11e061,require(_0x03ea('0x22')));_0x11e061=_[_0x03ea('0x4')](_0x11e061,require(_0x03ea('0x23')));_0x11e061=_[_0x03ea('0x4')](_0x11e061,require('../api/cmHopperFinal/cmHopperFinal.rpc'));_0x11e061=_[_0x03ea('0x4')](_0x11e061,require(_0x03ea('0x24')));_0x11e061=_[_0x03ea('0x4')](_0x11e061,require(_0x03ea('0x25')));_0x11e061=_[_0x03ea('0x4')](_0x11e061,require(_0x03ea('0x26')));_0x11e061=_[_0x03ea('0x4')](_0x11e061,require(_0x03ea('0x27')));_0x11e061=_[_0x03ea('0x4')](_0x11e061,require(_0x03ea('0x28')));_0x11e061=_[_0x03ea('0x4')](_0x11e061,require('../api/template/template.rpc'));_0x11e061=_[_0x03ea('0x4')](_0x11e061,require(_0x03ea('0x29')));_0x11e061=_[_0x03ea('0x4')](_0x11e061,require(_0x03ea('0x2a')));_0x11e061=_['merge'](_0x11e061,require('../api/intSalesforceAccount/intSalesforceAccount.rpc'));_0x11e061=_[_0x03ea('0x4')](_0x11e061,require(_0x03ea('0x2b')));_0x11e061=_[_0x03ea('0x4')](_0x11e061,require('../api/intDeskAccount/intDeskAccount.rpc'));_0x11e061=_[_0x03ea('0x4')](_0x11e061,require(_0x03ea('0x2c')));_0x11e061=_[_0x03ea('0x4')](_0x11e061,require(_0x03ea('0x2d')));_0x11e061=_['merge'](_0x11e061,require(_0x03ea('0x2e')));_0x11e061=_[_0x03ea('0x4')](_0x11e061,require(_0x03ea('0x2f')));_0x11e061=_[_0x03ea('0x4')](_0x11e061,require(_0x03ea('0x30')));_0x11e061=_[_0x03ea('0x4')](_0x11e061,require(_0x03ea('0x31')));_0x11e061=_[_0x03ea('0x4')](_0x11e061,require(_0x03ea('0x32')));_0x11e061=_['merge'](_0x11e061,require(_0x03ea('0x33')));_0x11e061=_[_0x03ea('0x4')](_0x11e061,require(_0x03ea('0x34')));_0x11e061=_[_0x03ea('0x4')](_0x11e061,require(_0x03ea('0x35')));_0x11e061=_[_0x03ea('0x4')](_0x11e061,require('../api/squareReportDetail/squareReportDetail.rpc'));_0x11e061=_[_0x03ea('0x4')](_0x11e061,require(_0x03ea('0x36')));_0x11e061=_[_0x03ea('0x4')](_0x11e061,require(_0x03ea('0x37')));_0x11e061=_[_0x03ea('0x4')](_0x11e061,require(_0x03ea('0x38')));_0x11e061=_[_0x03ea('0x4')](_0x11e061,require(_0x03ea('0x39')));_0x11e061=_[_0x03ea('0x4')](_0x11e061,require(_0x03ea('0x3a')));_0x11e061=_[_0x03ea('0x4')](_0x11e061,require('../api/attachment/attachment.rpc'));_0x11e061=_[_0x03ea('0x4')](_0x11e061,require(_0x03ea('0x3b')));var _0x52d4e5=jayson['server'](_0x11e061)[_0x03ea('0x3c')]();var _0x4dd888=config[_0x03ea('0x3d')][_0x03ea('0x3e')]||config[_0x03ea('0x3e')]+0x1;var _0xc7a124=config[_0x03ea('0x3d')]['ip']||'localhost';_0x52d4e5['on'](_0x03ea('0x3f'),function(_0x57f1dd){return _0xc43faa(_0x57f1dd);});_0x52d4e5['listen'](_0x4dd888,_0xc7a124,function(){console[_0x03ea('0x40')](_0x03ea('0x41'),_0xc7a124,_0x4dd888);require(_0x03ea('0x42'))[_0x03ea('0x43')]();return _0x16a92c(_0x03ea('0x44')+_0xc7a124+':'+_0x4dd888);});});}; \ No newline at end of file +var _0xc4af=['merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','server','http','port','rpc','error','listen','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','default','jayson/promise','bluebird','lodash'];(function(_0x17a4e6,_0x420ee1){var _0x5a6e48=function(_0xc4f21a){while(--_0xc4f21a){_0x17a4e6['push'](_0x17a4e6['shift']());}};_0x5a6e48(++_0x420ee1);}(_0xc4af,0x8d));var _0xfc4a=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0xc4af[_0x40ac5e];return _0x2839d6;};'use strict';var jayson=require(_0xfc4a('0x0'));var BPromise=require(_0xfc4a('0x1'));var _=require(_0xfc4a('0x2'));var config=require('../config/environment');exports['listen']=function(){return new BPromise(function(_0x5b2f38,_0x4bfa35){var _0x404898={};_0x404898=_[_0xfc4a('0x3')](_0x404898,require(_0xfc4a('0x4')));_0x404898=_['merge'](_0x404898,require(_0xfc4a('0x5')));_0x404898=_[_0xfc4a('0x3')](_0x404898,require(_0xfc4a('0x6')));_0x404898=_['merge'](_0x404898,require(_0xfc4a('0x7')));_0x404898=_[_0xfc4a('0x3')](_0x404898,require(_0xfc4a('0x8')));_0x404898=_[_0xfc4a('0x3')](_0x404898,require(_0xfc4a('0x9')));_0x404898=_[_0xfc4a('0x3')](_0x404898,require(_0xfc4a('0xa')));_0x404898=_[_0xfc4a('0x3')](_0x404898,require(_0xfc4a('0xb')));_0x404898=_[_0xfc4a('0x3')](_0x404898,require(_0xfc4a('0xc')));_0x404898=_[_0xfc4a('0x3')](_0x404898,require(_0xfc4a('0xd')));_0x404898=_[_0xfc4a('0x3')](_0x404898,require(_0xfc4a('0xe')));_0x404898=_[_0xfc4a('0x3')](_0x404898,require(_0xfc4a('0xf')));_0x404898=_['merge'](_0x404898,require(_0xfc4a('0x10')));_0x404898=_['merge'](_0x404898,require(_0xfc4a('0x11')));_0x404898=_[_0xfc4a('0x3')](_0x404898,require(_0xfc4a('0x12')));_0x404898=_['merge'](_0x404898,require(_0xfc4a('0x13')));_0x404898=_[_0xfc4a('0x3')](_0x404898,require(_0xfc4a('0x14')));_0x404898=_['merge'](_0x404898,require(_0xfc4a('0x15')));_0x404898=_[_0xfc4a('0x3')](_0x404898,require('../api/mailQueueReport/mailQueueReport.rpc'));_0x404898=_[_0xfc4a('0x3')](_0x404898,require(_0xfc4a('0x16')));_0x404898=_['merge'](_0x404898,require(_0xfc4a('0x17')));_0x404898=_[_0xfc4a('0x3')](_0x404898,require(_0xfc4a('0x18')));_0x404898=_[_0xfc4a('0x3')](_0x404898,require(_0xfc4a('0x19')));_0x404898=_[_0xfc4a('0x3')](_0x404898,require(_0xfc4a('0x1a')));_0x404898=_[_0xfc4a('0x3')](_0x404898,require('../api/faxQueueReport/faxQueueReport.rpc'));_0x404898=_['merge'](_0x404898,require(_0xfc4a('0x1b')));_0x404898=_[_0xfc4a('0x3')](_0x404898,require(_0xfc4a('0x1c')));_0x404898=_[_0xfc4a('0x3')](_0x404898,require(_0xfc4a('0x1d')));_0x404898=_[_0xfc4a('0x3')](_0x404898,require('../api/smsQueue/smsQueue.rpc'));_0x404898=_[_0xfc4a('0x3')](_0x404898,require(_0xfc4a('0x1e')));_0x404898=_['merge'](_0x404898,require(_0xfc4a('0x1f')));_0x404898=_[_0xfc4a('0x3')](_0x404898,require(_0xfc4a('0x20')));_0x404898=_[_0xfc4a('0x3')](_0x404898,require(_0xfc4a('0x21')));_0x404898=_['merge'](_0x404898,require('../api/openchannelQueueReport/openchannelQueueReport.rpc'));_0x404898=_[_0xfc4a('0x3')](_0x404898,require(_0xfc4a('0x22')));_0x404898=_[_0xfc4a('0x3')](_0x404898,require(_0xfc4a('0x23')));_0x404898=_['merge'](_0x404898,require(_0xfc4a('0x24')));_0x404898=_[_0xfc4a('0x3')](_0x404898,require(_0xfc4a('0x25')));_0x404898=_['merge'](_0x404898,require(_0xfc4a('0x26')));_0x404898=_['merge'](_0x404898,require(_0xfc4a('0x27')));_0x404898=_[_0xfc4a('0x3')](_0x404898,require('../api/cmHopperFinal/cmHopperFinal.rpc'));_0x404898=_[_0xfc4a('0x3')](_0x404898,require(_0xfc4a('0x28')));_0x404898=_[_0xfc4a('0x3')](_0x404898,require(_0xfc4a('0x29')));_0x404898=_[_0xfc4a('0x3')](_0x404898,require(_0xfc4a('0x2a')));_0x404898=_[_0xfc4a('0x3')](_0x404898,require(_0xfc4a('0x2b')));_0x404898=_[_0xfc4a('0x3')](_0x404898,require(_0xfc4a('0x2c')));_0x404898=_['merge'](_0x404898,require(_0xfc4a('0x2d')));_0x404898=_[_0xfc4a('0x3')](_0x404898,require(_0xfc4a('0x2e')));_0x404898=_[_0xfc4a('0x3')](_0x404898,require(_0xfc4a('0x2f')));_0x404898=_['merge'](_0x404898,require(_0xfc4a('0x30')));_0x404898=_[_0xfc4a('0x3')](_0x404898,require('../api/intSugarcrmAccount/intSugarcrmAccount.rpc'));_0x404898=_[_0xfc4a('0x3')](_0x404898,require(_0xfc4a('0x31')));_0x404898=_[_0xfc4a('0x3')](_0x404898,require('../api/intZohoAccount/intZohoAccount.rpc'));_0x404898=_[_0xfc4a('0x3')](_0x404898,require(_0xfc4a('0x32')));_0x404898=_[_0xfc4a('0x3')](_0x404898,require(_0xfc4a('0x33')));_0x404898=_['merge'](_0x404898,require('../api/intVtigerAccount/intVtigerAccount.rpc'));_0x404898=_[_0xfc4a('0x3')](_0x404898,require(_0xfc4a('0x34')));_0x404898=_[_0xfc4a('0x3')](_0x404898,require(_0xfc4a('0x35')));_0x404898=_['merge'](_0x404898,require('../api/intFreshsalesAccount/intFreshsalesAccount.rpc'));_0x404898=_[_0xfc4a('0x3')](_0x404898,require(_0xfc4a('0x36')));_0x404898=_['merge'](_0x404898,require(_0xfc4a('0x37')));_0x404898=_[_0xfc4a('0x3')](_0x404898,require(_0xfc4a('0x38')));_0x404898=_[_0xfc4a('0x3')](_0x404898,require('../api/squareReportDetail/squareReportDetail.rpc'));_0x404898=_[_0xfc4a('0x3')](_0x404898,require('../api/squareOdbc/squareOdbc.rpc'));_0x404898=_[_0xfc4a('0x3')](_0x404898,require(_0xfc4a('0x39')));_0x404898=_['merge'](_0x404898,require(_0xfc4a('0x3a')));_0x404898=_[_0xfc4a('0x3')](_0x404898,require(_0xfc4a('0x3b')));_0x404898=_[_0xfc4a('0x3')](_0x404898,require(_0xfc4a('0x3c')));_0x404898=_[_0xfc4a('0x3')](_0x404898,require(_0xfc4a('0x3d')));_0x404898=_[_0xfc4a('0x3')](_0x404898,require(_0xfc4a('0x3e')));var _0x537954=jayson[_0xfc4a('0x3f')](_0x404898)[_0xfc4a('0x40')]();var _0x391678=config['rpc'][_0xfc4a('0x41')]||config[_0xfc4a('0x41')]+0x1;var _0x4ad5c9=config[_0xfc4a('0x42')]['ip']||'localhost';_0x537954['on'](_0xfc4a('0x43'),function(_0x45e4f8){return _0x4bfa35(_0x45e4f8);});_0x537954[_0xfc4a('0x44')](_0x391678,_0x4ad5c9,function(){console[_0xfc4a('0x45')](_0xfc4a('0x46'),_0x4ad5c9,_0x391678);require('../config/triggers')[_0xfc4a('0x47')]();return _0x5b2f38('RPC\x20listening\x20on\x20'+_0x4ad5c9+':'+_0x391678);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index acd28ab..141ff87 100644 --- a/server/services/agi/channel.js +++ b/server/services/agi/channel.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['wav','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','AGI','wait','WAIT','label','exports','util','lodash','events','./reply','./error','call','setEncoding','utf8','setTimeout','headers','emit','ready','line','toLowerCase','hangup','search','520\x20End\x20of\x20proper','function','substring','no\x20code','indexOf','startsWith','split','length','error','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','write','inherits','command','sync','answer','sendRequest','prototype','getData','beep','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','isArray','join','EXEC\x20%s\x20%s','SET\x20CONTEXT\x20%s','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','SAY\x20NUMBER\x20%s\x20%s','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','setExtension','noop','GOTO\x20%s\x20%s\x20%s','getVariable','recordFile'];(function(_0x20a394,_0x5c4e0c){var _0x8a454f=function(_0x26d21c){while(--_0x26d21c){_0x20a394['push'](_0x20a394['shift']());}};_0x8a454f(++_0x5c4e0c);}(_0xe706,0xa3));var _0x6e70=function(_0x40174f,_0x3a6751){_0x40174f=_0x40174f-0x0;var _0x40717c=_0xe706[_0x40174f];return _0x40717c;};'use strict';var util=require(_0x6e70('0x0'));var _=require(_0x6e70('0x1'));var EventEmitter=require(_0x6e70('0x2'))['EventEmitter'];var AGIReply=require(_0x6e70('0x3'));var AGIError=require(_0x6e70('0x4'));function AGIChannel(_0x2ca810){var _0x7dfbc3=this,_0x142c27=new AGIReply(),_0x2164a4=![],_0x376a8d={};EventEmitter[_0x6e70('0x5')](_0x7dfbc3);_0x2ca810[_0x6e70('0x6')](_0x6e70('0x7'));_0x2ca810[_0x6e70('0x8')](0x8*0x3c*0x3c*0x3e8);_0x142c27[_0x6e70('0x6')](_0x6e70('0x7'));_0x142c27['on'](_0x6e70('0x9'),function(_0x3c4843){for(var _0x449b48 in _0x3c4843){_0x7dfbc3[_0x449b48]=_0x3c4843[_0x449b48];}_0x7dfbc3[_0x6e70('0xa')](_0x6e70('0xb'));});_0x142c27['on'](_0x6e70('0xc'),function(_0x463853){if(_0x463853[_0x6e70('0xd')]()==_0x6e70('0xe')){_0x7dfbc3[_0x6e70('0xa')](_0x6e70('0xe'));return;}if(_0x463853['substring'](0x0,0xb)=='520-Invalid'){_0x2164a4=!![];}if(_0x2164a4){_0x376a8d['rx']+=_0x463853+'\x0a';if(_0x463853[_0x6e70('0xf')](_0x6e70('0x10'))!=-0x1){_0x2164a4=![];}}else{_0x376a8d['rx']=_0x463853;}if(_0x2164a4){return;}if(typeof _0x376a8d['cb']==_0x6e70('0x11')){var _0x27dd9b=_0x376a8d['rx'][_0x6e70('0x12')](0x0,0x3),_0x3b38f3=null,_0x310eb7=null;_0x27dd9b=parseInt(_0x27dd9b);if(isNaN(_0x27dd9b)){_0x376a8d['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x6e70('0x13')});return;}if(_0x27dd9b!=0xc8){_0x376a8d['cb'](null,{'code':_0x27dd9b,'result':-0x1,'extra':'KO'});return;}_0x3b38f3=_0x376a8d['rx']['substring'](0x4)['replace']('result=','');if(_0x3b38f3[_0x6e70('0x14')]('\x20')!=-0x1){_0x3b38f3=_0x3b38f3['substr'](0x0,_0x3b38f3['indexOf']('\x20'));}if(_[_0x6e70('0x15')](_0x3b38f3,'-1')){_0x3b38f3=parseInt(_0x3b38f3);}_0x310eb7=_0x376a8d['rx'][_0x6e70('0x16')]('\x20');if(_0x310eb7['length']==0x3){_0x310eb7=_0x310eb7[0x2][_0x6e70('0x12')](0x1,_0x310eb7[0x2]['length']-0x1);}else if(_0x310eb7[_0x6e70('0x17')]>0x3){var _0x161f23=/\((.+)\)/;var _0x4ca554=_0x376a8d['rx']['match'](_0x161f23);if(_0x4ca554){_0x310eb7=_0x4ca554[0x1];}else{_0x310eb7=null;}}else{_0x310eb7=null;}_0x376a8d['cb'](null,{'code':_0x27dd9b,'result':_0x3b38f3,'extra':_0x310eb7});}});_0x2ca810['on'](_0x6e70('0x18'),function(_0x5ea7a5){_0x7dfbc3[_0x6e70('0xa')](_0x6e70('0x18'),new AGIError('E_AGI_SOCKET_ERROR',_0x5ea7a5['code']));});_0x2ca810['on'](_0x6e70('0x19'),function(){_0x7dfbc3[_0x6e70('0xa')](_0x6e70('0x19'),new AGIError(_0x6e70('0x1a')));});_0x2ca810['on'](_0x6e70('0x1b'),function(){_0x7dfbc3[_0x6e70('0xa')](_0x6e70('0x1b'),new AGIError(_0x6e70('0x1c')));_0x2ca810[_0x6e70('0x1d')]();});_0x2ca810[_0x6e70('0x1e')](_0x142c27);this['command']=function(_0x228350,_0x344b65){var _0x228350=_0x228350||'',_0x344b65=typeof _0x344b65==_0x6e70('0x11')?_0x344b65:new Function();_0x376a8d={'tx':_0x228350,'rx':'','cb':_0x344b65};_0x2ca810[_0x6e70('0x1f')](_0x228350+'\x0a');},this[_0x6e70('0x19')]=function(){_0x2ca810['destroy']();};}util[_0x6e70('0x20')](AGIChannel,EventEmitter);AGIChannel['prototype']['sendRequest']=function(_0x4e97c7){return this[_0x6e70('0x21')][_0x6e70('0x22')](this,_0x4e97c7);};AGIChannel['prototype'][_0x6e70('0x23')]=function(){return this[_0x6e70('0x24')]('ANSWER');};AGIChannel[_0x6e70('0x25')][_0x6e70('0x26')]=function(_0x2bb231,_0x4a67ac,_0x54a5fe){_0x2bb231=_0x2bb231===undefined?_0x6e70('0x27'):_0x2bb231;_0x4a67ac=_0x4a67ac===undefined?'5':_0x4a67ac;_0x54a5fe=_0x54a5fe===undefined?'1':_0x54a5fe;return this[_0x6e70('0x24')](util[_0x6e70('0x28')](_0x6e70('0x29'),_0x2bb231,_0x4a67ac*0x3e8,_0x54a5fe));};AGIChannel[_0x6e70('0x25')]['noop']=function(_0x1952ea){_0x1952ea=_0x1952ea||_0x6e70('0x2a');return this[_0x6e70('0x24')](util[_0x6e70('0x28')](_0x6e70('0x2b'),_0x1952ea));};AGIChannel[_0x6e70('0x25')][_0x6e70('0x2c')]=function(_0x24114a,_0x3a0821){if(_[_0x6e70('0x2d')](_0x3a0821)){return this['sendRequest'](util[_0x6e70('0x28')]('EXEC\x20%s\x20%s',_0x24114a,_0x3a0821[_0x6e70('0x2e')](',')));}return this['sendRequest'](util[_0x6e70('0x28')](_0x6e70('0x2f'),_0x24114a,_0x3a0821));};AGIChannel[_0x6e70('0x25')]['setContext']=function(_0x38c40d){return this[_0x6e70('0x24')](util['format'](_0x6e70('0x30'),_0x38c40d));};AGIChannel[_0x6e70('0x25')]['setExtension']=function(_0x10d8f6){return this[_0x6e70('0x24')](util[_0x6e70('0x28')](_0x6e70('0x31'),_0x10d8f6));};AGIChannel[_0x6e70('0x25')][_0x6e70('0x32')]=function(_0x44b19d){return this[_0x6e70('0x24')](util[_0x6e70('0x28')](_0x6e70('0x33'),_0x44b19d));};AGIChannel['prototype'][_0x6e70('0xe')]=function(){return this['sendRequest'](_0x6e70('0x34'));};AGIChannel[_0x6e70('0x25')][_0x6e70('0x35')]=function(_0x32d12d,_0x233a83){var _0x989b80=_[_0x6e70('0x36')](_0x233a83)||_[_0x6e70('0x37')](_0x233a83)?_0x233a83[_0x6e70('0x38')]():_0x233a83;return this[_0x6e70('0x24')](util[_0x6e70('0x28')](_0x6e70('0x39'),_0x32d12d,_0x989b80?_0x989b80[_0x6e70('0x38')]()['replace'](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel['prototype']['sayNumber']=function(_0x155a46,_0x3841a0){return this[_0x6e70('0x24')](util[_0x6e70('0x28')](_0x6e70('0x3a'),_0x155a46,_0x3841a0));};AGIChannel[_0x6e70('0x25')]['sayDigits']=function(_0x3b508c,_0x9e7ad2){return this[_0x6e70('0x24')](util[_0x6e70('0x28')](_0x6e70('0x3b'),_0x3b508c,_0x9e7ad2));};AGIChannel[_0x6e70('0x25')][_0x6e70('0x3c')]=function(_0x16fc7d,_0x5be100){return this[_0x6e70('0x24')](util[_0x6e70('0x28')](_0x6e70('0x3d'),_0x16fc7d,_0x5be100));};AGIChannel[_0x6e70('0x25')][_0x6e70('0x3e')]=function(_0x1de947,_0x21b0e7,_0x4a8adc){_0x21b0e7=_0x21b0e7||this['extension'];_0x4a8adc=_0x4a8adc||0x1;this['setContext'](_0x1de947);this[_0x6e70('0x3f')](_0x21b0e7);this[_0x6e70('0x32')](_0x4a8adc);return this[_0x6e70('0x40')](util[_0x6e70('0x28')](_0x6e70('0x41'),_0x1de947,_0x21b0e7,_0x4a8adc));};AGIChannel['prototype'][_0x6e70('0x42')]=function(_0x2a58d7){return this[_0x6e70('0x24')](util['format']('GET\x20VARIABLE\x20\x22%s\x22',_0x2a58d7));};AGIChannel['prototype'][_0x6e70('0x43')]=function(_0x5cca5b,_0x42f49a,_0x39913a,_0x3fed21,_0x75a90d,_0x59c87d){_0x42f49a=_0x42f49a||_0x6e70('0x44');_0x39913a=_0x39913a||'';_0x3fed21=_0x3fed21===undefined?-0x1:_0x3fed21==='-1'?-0x1:_0x3fed21*0x3e8;_0x75a90d=_0x75a90d===undefined?'':'s='+_0x75a90d;_0x59c87d=_0x59c87d?'BEEP':'';return this[_0x6e70('0x24')](util[_0x6e70('0x28')](_0x6e70('0x45'),_0x5cca5b,_0x42f49a,_0x39913a,_0x3fed21,_0x59c87d,_0x75a90d));};AGIChannel[_0x6e70('0x25')]['streamFile']=function(_0x291de6,_0x44b637){_0x44b637=_0x44b637||'';return this[_0x6e70('0x24')](util[_0x6e70('0x28')](_0x6e70('0x46'),_0x291de6,_0x44b637));};AGIChannel[_0x6e70('0x25')][_0x6e70('0x47')]=function(_0x552e7e){return this[_0x6e70('0x2c')](_0x6e70('0x48'),_0x552e7e);};AGIChannel[_0x6e70('0x25')][_0x6e70('0x49')]=function(_0x3f86cf){return this[_0x6e70('0x2c')](_0x6e70('0x4a'),_0x3f86cf);};AGIChannel['prototype'][_0x6e70('0x18')]=function(_0x50cdf1,_0x11794e){this[_0x6e70('0x40')](util['format']('ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s',_0x50cdf1['id'],_0x50cdf1[_0x6e70('0x4b')],_0x11794e));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x6e70('0x4c')]=AGIChannel; \ No newline at end of file +var _0x9c44=['no\x20code','replace','result=','indexOf','substr','startsWith','length','match','error','E_AGI_SOCKET_ERROR','code','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','command','inherits','prototype','sendRequest','sync','ANSWER','getData','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','setContext','SET\x20CONTEXT\x20%s','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','isNumber','SET\x20VARIABLE\x20%s\x20\x22%s\x22','toString','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','setExtension','noop','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','wav','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','agi','AGI','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','events','EventEmitter','./reply','./error','setEncoding','utf8','setTimeout','emit','ready','toLowerCase','hangup','substring','520\x20End\x20of\x20proper','function'];(function(_0x342baa,_0x4a110f){var _0x1208f3=function(_0x56a645){while(--_0x56a645){_0x342baa['push'](_0x342baa['shift']());}};_0x1208f3(++_0x4a110f);}(_0x9c44,0x178));var _0x49c4=function(_0x4f9b18,_0x2cb5ca){_0x4f9b18=_0x4f9b18-0x0;var _0x29f20c=_0x9c44[_0x4f9b18];return _0x29f20c;};'use strict';var util=require('util');var _=require('lodash');var EventEmitter=require(_0x49c4('0x0'))[_0x49c4('0x1')];var AGIReply=require(_0x49c4('0x2'));var AGIError=require(_0x49c4('0x3'));function AGIChannel(_0x455700){var _0x2ad237=this,_0x4e0313=new AGIReply(),_0x4941f1=![],_0x41a183={};EventEmitter['call'](_0x2ad237);_0x455700[_0x49c4('0x4')](_0x49c4('0x5'));_0x455700[_0x49c4('0x6')](0x8*0x3c*0x3c*0x3e8);_0x4e0313[_0x49c4('0x4')](_0x49c4('0x5'));_0x4e0313['on']('headers',function(_0x11c586){for(var _0x42e4f8 in _0x11c586){_0x2ad237[_0x42e4f8]=_0x11c586[_0x42e4f8];}_0x2ad237[_0x49c4('0x7')](_0x49c4('0x8'));});_0x4e0313['on']('line',function(_0x5ab4a3){if(_0x5ab4a3[_0x49c4('0x9')]()==_0x49c4('0xa')){_0x2ad237['emit'](_0x49c4('0xa'));return;}if(_0x5ab4a3[_0x49c4('0xb')](0x0,0xb)=='520-Invalid'){_0x4941f1=!![];}if(_0x4941f1){_0x41a183['rx']+=_0x5ab4a3+'\x0a';if(_0x5ab4a3['search'](_0x49c4('0xc'))!=-0x1){_0x4941f1=![];}}else{_0x41a183['rx']=_0x5ab4a3;}if(_0x4941f1){return;}if(typeof _0x41a183['cb']==_0x49c4('0xd')){var _0x5487cd=_0x41a183['rx']['substring'](0x0,0x3),_0x7df3a9=null,_0x403bfb=null;_0x5487cd=parseInt(_0x5487cd);if(isNaN(_0x5487cd)){_0x41a183['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x49c4('0xe')});return;}if(_0x5487cd!=0xc8){_0x41a183['cb'](null,{'code':_0x5487cd,'result':-0x1,'extra':'KO'});return;}_0x7df3a9=_0x41a183['rx'][_0x49c4('0xb')](0x4)[_0x49c4('0xf')](_0x49c4('0x10'),'');if(_0x7df3a9[_0x49c4('0x11')]('\x20')!=-0x1){_0x7df3a9=_0x7df3a9[_0x49c4('0x12')](0x0,_0x7df3a9[_0x49c4('0x11')]('\x20'));}if(_[_0x49c4('0x13')](_0x7df3a9,'-1')){_0x7df3a9=parseInt(_0x7df3a9);}_0x403bfb=_0x41a183['rx']['split']('\x20');if(_0x403bfb[_0x49c4('0x14')]==0x3){_0x403bfb=_0x403bfb[0x2][_0x49c4('0xb')](0x1,_0x403bfb[0x2][_0x49c4('0x14')]-0x1);}else if(_0x403bfb[_0x49c4('0x14')]>0x3){var _0x2abc78=/\((.+)\)/;var _0x53e3a2=_0x41a183['rx'][_0x49c4('0x15')](_0x2abc78);if(_0x53e3a2){_0x403bfb=_0x53e3a2[0x1];}else{_0x403bfb=null;}}else{_0x403bfb=null;}_0x41a183['cb'](null,{'code':_0x5487cd,'result':_0x7df3a9,'extra':_0x403bfb});}});_0x455700['on'](_0x49c4('0x16'),function(_0x4c3253){_0x2ad237['emit'](_0x49c4('0x16'),new AGIError(_0x49c4('0x17'),_0x4c3253[_0x49c4('0x18')]));});_0x455700['on']('close',function(){_0x2ad237[_0x49c4('0x7')]('close',new AGIError(_0x49c4('0x19')));});_0x455700['on'](_0x49c4('0x1a'),function(){_0x2ad237[_0x49c4('0x7')](_0x49c4('0x1a'),new AGIError(_0x49c4('0x1b')));_0x455700[_0x49c4('0x1c')]();});_0x455700[_0x49c4('0x1d')](_0x4e0313);this[_0x49c4('0x1e')]=function(_0x2197d2,_0x578447){var _0x2197d2=_0x2197d2||'',_0x578447=typeof _0x578447==_0x49c4('0xd')?_0x578447:new Function();_0x41a183={'tx':_0x2197d2,'rx':'','cb':_0x578447};_0x455700['write'](_0x2197d2+'\x0a');},this['close']=function(){_0x455700[_0x49c4('0x1c')]();};}util[_0x49c4('0x1f')](AGIChannel,EventEmitter);AGIChannel[_0x49c4('0x20')][_0x49c4('0x21')]=function(_0x4811c4){return this['command'][_0x49c4('0x22')](this,_0x4811c4);};AGIChannel[_0x49c4('0x20')]['answer']=function(){return this[_0x49c4('0x21')](_0x49c4('0x23'));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x24')]=function(_0x531d92,_0x543ea2,_0x449960){_0x531d92=_0x531d92===undefined?'beep':_0x531d92;_0x543ea2=_0x543ea2===undefined?'5':_0x543ea2;_0x449960=_0x449960===undefined?'1':_0x449960;return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x26'),_0x531d92,_0x543ea2*0x3e8,_0x449960));};AGIChannel[_0x49c4('0x20')]['noop']=function(_0x889909){_0x889909=_0x889909||_0x49c4('0x27');return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x28'),_0x889909));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x29')]=function(_0x427b26,_0x17b50f){if(_[_0x49c4('0x2a')](_0x17b50f)){return this[_0x49c4('0x21')](util['format']('EXEC\x20%s\x20%s',_0x427b26,_0x17b50f['join'](',')));}return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x2b'),_0x427b26,_0x17b50f));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x2c')]=function(_0x574fd3){return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x2d'),_0x574fd3));};AGIChannel[_0x49c4('0x20')]['setExtension']=function(_0x57a29c){return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x2e'),_0x57a29c));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x2f')]=function(_0x4a0c7a){return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x30'),_0x4a0c7a));};AGIChannel['prototype']['hangup']=function(){return this[_0x49c4('0x21')](_0x49c4('0x31'));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x32')]=function(_0x2b45a1,_0x2cf897){var _0x1d1557=_[_0x49c4('0x33')](_0x2cf897)||_[_0x49c4('0x34')](_0x2cf897)?_0x2cf897['toString']():_0x2cf897;return this[_0x49c4('0x21')](util['format'](_0x49c4('0x35'),_0x2b45a1,_0x1d1557?_0x1d1557[_0x49c4('0x36')]()[_0x49c4('0xf')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x49c4('0x20')]['sayNumber']=function(_0x335f0c,_0x31f3ff){return this[_0x49c4('0x21')](util['format'](_0x49c4('0x37'),_0x335f0c,_0x31f3ff));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x38')]=function(_0x5e5366,_0x1ba7a0){return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x39'),_0x5e5366,_0x1ba7a0));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x3a')]=function(_0x1e506a,_0x4e0663){return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x3b'),_0x1e506a,_0x4e0663));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x3c')]=function(_0x29dd5d,_0x1be62d,_0xc9722b){_0x1be62d=_0x1be62d||this[_0x49c4('0x3d')];_0xc9722b=_0xc9722b||0x1;this[_0x49c4('0x2c')](_0x29dd5d);this[_0x49c4('0x3e')](_0x1be62d);this[_0x49c4('0x2f')](_0xc9722b);return this[_0x49c4('0x3f')](util['format'](_0x49c4('0x40'),_0x29dd5d,_0x1be62d,_0xc9722b));};AGIChannel['prototype'][_0x49c4('0x41')]=function(_0x4915bc){return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x42'),_0x4915bc));};AGIChannel[_0x49c4('0x20')]['recordFile']=function(_0x4d628a,_0x20490b,_0x1e7bdc,_0x38349b,_0x117151,_0x490823){_0x20490b=_0x20490b||_0x49c4('0x43');_0x1e7bdc=_0x1e7bdc||'';_0x38349b=_0x38349b===undefined?-0x1:_0x38349b==='-1'?-0x1:_0x38349b*0x3e8;_0x117151=_0x117151===undefined?'':'s='+_0x117151;_0x490823=_0x490823?_0x49c4('0x44'):'';return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x45'),_0x4d628a,_0x20490b,_0x1e7bdc,_0x38349b,_0x490823,_0x117151));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x46')]=function(_0x3351c1,_0x3c4a1d){_0x3c4a1d=_0x3c4a1d||'';return this['sendRequest'](util[_0x49c4('0x25')]('STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22',_0x3351c1,_0x3c4a1d));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x47')]=function(_0x301def){return this[_0x49c4('0x29')](_0x49c4('0x48'),_0x301def);};AGIChannel['prototype'][_0x49c4('0x49')]=function(_0x15b674){return this[_0x49c4('0x29')](_0x49c4('0x4a'),_0x15b674);};AGIChannel[_0x49c4('0x20')][_0x49c4('0x16')]=function(_0x9779ef,_0x4d89e0){this[_0x49c4('0x3f')](util['format'](_0x49c4('0x4b'),_0x9779ef['id'],_0x9779ef[_0x49c4('0x4c')],_0x4d89e0));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x49c4('0x4d')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 05b6637..669ef30 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 _0x0a52=['Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','format','message','name','exports','util','Undefined\x20error.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.'];(function(_0xb4bed2,_0x1ba3db){var _0x17a2a5=function(_0x3957c1){while(--_0x3957c1){_0xb4bed2['push'](_0xb4bed2['shift']());}};_0x17a2a5(++_0x1ba3db);}(_0x0a52,0xe4));var _0x20a5=function(_0x37c8f0,_0x11b8f3){_0x37c8f0=_0x37c8f0-0x0;var _0x57ead9=_0x0a52[_0x37c8f0];return _0x57ead9;};'use strict';var util=require(_0x20a5('0x0'));var error={'E_AGI_UNDEFINED':_0x20a5('0x1'),'E_AGI_ARGUMENT_PORT':'Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','E_AGI_SERVER_ERROR':_0x20a5('0x2'),'E_AGI_SERVER_CLOSE':_0x20a5('0x3'),'E_AGI_SERVER_MAXCONNECTION':_0x20a5('0x4'),'E_AGI_SERVER_VOICE_DISABLED':'[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','E_AGI_SOCKET_ERROR':_0x20a5('0x5'),'E_AGI_SOCKET_CLOSE':_0x20a5('0x6'),'E_AGI_SOCKET_TIMEOUT':_0x20a5('0x7'),'E_AGI_COMMAND_EMPTY':_0x20a5('0x8'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x20a5('0x9'),'E_AGI_IVR_ENTRY':_0x20a5('0xa')};function AGIError(_0x4acc66){var _0x4acc66=_0x4acc66||null,_0x39920b=_0x39920b||[],_0x1f44fd=0x1,_0x478779='';if(!error[_0x4acc66]){_0x4acc66=_0x20a5('0xb');}_0x39920b[_0x20a5('0xc')](error[_0x4acc66]);while(arguments[_0x1f44fd]){_0x39920b[_0x20a5('0xc')](arguments[_0x1f44fd]);_0x1f44fd++;}_0x478779=util[_0x20a5('0xd')]['apply'](util,_0x39920b);this[_0x20a5('0xe')]=_0x478779;this[_0x20a5('0xf')]=_0x4acc66;}module[_0x20a5('0x10')]=AGIError; \ No newline at end of file +var _0x8a9c=['exports','util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_UNDEFINED','push','format','name'];(function(_0x31172e,_0xa59e5){var _0x414ada=function(_0x37ede4){while(--_0x37ede4){_0x31172e['push'](_0x31172e['shift']());}};_0x414ada(++_0xa59e5);}(_0x8a9c,0x12d));var _0xc8a9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8a9c[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0xc8a9('0x0'));var error={'E_AGI_UNDEFINED':_0xc8a9('0x1'),'E_AGI_ARGUMENT_PORT':_0xc8a9('0x2'),'E_AGI_SERVER_ERROR':_0xc8a9('0x3'),'E_AGI_SERVER_CLOSE':_0xc8a9('0x4'),'E_AGI_SERVER_MAXCONNECTION':'[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','E_AGI_SERVER_VOICE_DISABLED':_0xc8a9('0x5'),'E_AGI_SOCKET_ERROR':_0xc8a9('0x6'),'E_AGI_SOCKET_CLOSE':'Socket\x20closed.','E_AGI_SOCKET_TIMEOUT':_0xc8a9('0x7'),'E_AGI_COMMAND_EMPTY':_0xc8a9('0x8'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0xc8a9('0x9'),'E_AGI_IVR_ENTRY':'Missing\x20\x27ivr.entry\x27\x20menu.'};function AGIError(_0xb4340b){var _0xb4340b=_0xb4340b||null,_0x1d49c8=_0x1d49c8||[],_0x4520a2=0x1,_0x2928f3='';if(!error[_0xb4340b]){_0xb4340b=_0xc8a9('0xa');}_0x1d49c8[_0xc8a9('0xb')](error[_0xb4340b]);while(arguments[_0x4520a2]){_0x1d49c8[_0xc8a9('0xb')](arguments[_0x4520a2]);_0x4520a2++;}_0x2928f3=util[_0xc8a9('0xc')]['apply'](util,_0x1d49c8);this['message']=_0x2928f3;this[_0xc8a9('0xd')]=_0xb4340b;}module[_0xc8a9('0xe')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index db4eae5..85172ab 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 _0xfef3=['lodash','agi','getdigits','getsecretdigits','edges','numberOfEdges','addVertex','prototype','addEdge','push','size','vertices','getVertex','traverseBFS','info','stop\x20traverse','length','no\x20edge/s\x20available','condition','split','agicommand','vswitch','target','default','menu','max\x20retry\x20reach','condition\x20not\x20found','exports'];(function(_0x2f82e7,_0x50f448){var _0x483927=function(_0x1f9d9c){while(--_0x1f9d9c){_0x2f82e7['push'](_0x2f82e7['shift']());}};_0x483927(++_0x50f448);}(_0xfef3,0x118));var _0x3fef=function(_0x2024fb,_0xd74065){_0x2024fb=_0x2024fb-0x0;var _0x545486=_0xfef3[_0x2024fb];return _0x545486;};'use strict';var _=require(_0x3fef('0x0'));var logger=require('../../../config/logger')(_0x3fef('0x1'));var verticesWithRetry=['menu',_0x3fef('0x2'),_0x3fef('0x3')];var Graph=function(){this['vertices']={};this[_0x3fef('0x4')]={};this[_0x3fef('0x5')]=0x0;};Graph['prototype'][_0x3fef('0x6')]=function(_0x1351b1){this['vertices'][_0x1351b1['id']]=_0x1351b1;this[_0x3fef('0x4')][_0x1351b1['id']]=[];};Graph[_0x3fef('0x7')][_0x3fef('0x8')]=function(_0x33e00a,_0x1fffc5,_0x41960c){this[_0x3fef('0x4')][_0x33e00a][_0x3fef('0x9')]({'target':_0x1fffc5,'condition':_0x41960c});this[_0x3fef('0x5')]+=0x1;};Graph[_0x3fef('0x7')][_0x3fef('0xa')]=function(){return _[_0x3fef('0xa')](this[_0x3fef('0xb')]);};Graph[_0x3fef('0x7')]['relations']=function(){return this[_0x3fef('0x5')];};Graph[_0x3fef('0x7')][_0x3fef('0xc')]=function(_0x49d216){return this[_0x3fef('0xb')][_0x49d216];};Graph['prototype'][_0x3fef('0xd')]=function(_0x3d2c2d,_0x2da64b){if(!this['vertices'][_0x3d2c2d]){return logger[_0x3fef('0xe')]('no\x20vertex\x20found');}var _0x15b757=_0x2da64b(this[_0x3fef('0xb')][_0x3d2c2d]);if(!_0x15b757){return logger['info'](_0x3fef('0xf'));}if(this[_0x3fef('0x4')][_0x3d2c2d][_0x3fef('0x10')]===0x0){return logger[_0x3fef('0xe')](_0x3fef('0x11'));}for(var _0x2af1ba=0x0,_0x5c899f=[],_0x1cbdbb=![];_0x2af1ba\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','hangup','sync','start','debug','joinAt','YYYY-MM-DD\x20HH:mm:ss','traverseBFS','vertex','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','result','response','agicommand\x20not\x20found','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','isUndefined','toString','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','Project\x20%s\x20not\x20published','Project\x20%s\x20not\x20found','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','[LICENSE]','./server','listening','connection','xml2json','util','moment','../../config/environment','../../config/logger','../../config/license/util','./rpc','./mailRpc','./graph','./vertices','agi','defaults','nextTick','error','stack','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','port','message','[%s]\x20%s','name','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','callerid'];(function(_0x3f316e,_0x2cdb0e){var _0x4c9718=function(_0x534e9b){while(--_0x534e9b){_0x3f316e['push'](_0x3f316e['shift']());}};_0x4c9718(++_0x2cdb0e);}(_0x495e,0xfb));var _0xe495=function(_0x3df517,_0x373364){_0x3df517=_0x3df517-0x0;var _0x25ddd5=_0x495e[_0x3df517];return _0x25ddd5;};'use strict';var parser=require(_0xe495('0x0'));var _=require('lodash');var syncho=require('syncho');var util=require(_0xe495('0x1'));var moment=require(_0xe495('0x2'));var config=require(_0xe495('0x3'));var logger=require(_0xe495('0x4'))('agi');var utilLicense=require(_0xe495('0x5'));var rpc=require(_0xe495('0x6'));var mailRpc=require(_0xe495('0x7'));var Graph=require(_0xe495('0x8'));var Vertices=require(_0xe495('0x9'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0xe495('0xa')]=_[_0xe495('0xb')](config['agi'],{'ip':'127.0.0.1','port':0x11dd});function connectionHandler(_0x5c17d0){process[_0xe495('0xc')](function(){syncho(function(){try{setChannelVariables(_0x5c17d0);agiHandler(_0x5c17d0);}catch(_0x586a6f){logger[_0xe495('0xd')](_0x586a6f[_0xe495('0xe')]);}});});}function listeningHandler(){console[_0xe495('0xf')](_0xe495('0x10'),config[_0xe495('0xa')]['port']);logger[_0xe495('0x11')](util[_0xe495('0x12')](_0xe495('0x13'),config['agi']['ip'],config[_0xe495('0xa')][_0xe495('0x14')]));}function errorHandler(_0x5cf888){if(_0x5cf888&&_0x5cf888['name']&&_0x5cf888[_0xe495('0x15')]){logger[_0xe495('0xd')](util['format'](_0xe495('0x16'),_0x5cf888[_0xe495('0x17')],_0x5cf888[_0xe495('0x15')]));}else{logger[_0xe495('0xd')](util[_0xe495('0x12')]('[ERROR]\x20%s',_0x5cf888[_0xe495('0xe')]));}}function closeHandler(){logger[_0xe495('0x11')](util[_0xe495('0x12')](_0xe495('0x18'),this[_0xe495('0x19')],this['calleridname'],this['callerid'],this['dnid'],this[_0xe495('0x1a')]));try{createSquareReport(this);}catch(_0x142978){logger[_0xe495('0xd')](_0x142978['stack']);}}function timeoutHandler(){logger[_0xe495('0x11')](util[_0xe495('0x12')](_0xe495('0x1b'),this[_0xe495('0x19')],this[_0xe495('0x1c')],this['callerid'],this['dnid'],this[_0xe495('0x1a')]));}function hangupHandler(){logger[_0xe495('0x11')](util[_0xe495('0x12')](_0xe495('0x1d'),this['arg_1'],this[_0xe495('0x1c')],this[_0xe495('0x1e')],this[_0xe495('0x1f')],this['uniqueid']));this[_0xe495('0x20')]=!![];}function getRoot(_0x17d13f){return parser[_0xe495('0x21')](_0x17d13f,{'object':!![]})[_0xe495('0x22')][_0xe495('0x23')];}function addVertex(_0x4840fa,_0x33f19,_0x4d836b){_0x33f19[_0xe495('0x24')]=_0x4d836b;if(_0x33f19[_0xe495('0x25')](_0xe495('0x26'))){_0x33f19['maxRetry']=parseInt(_0x33f19[_0xe495('0x26')],0xa);}_0x4840fa[_0xe495('0x27')](_[_0xe495('0x28')](_0x33f19,_0xe495('0x29')));}function initGraph(_0x21513b,_0x3bd472){var _0x1ffd8b=new Graph();for(var _0x48b2eb in _0x21513b){if(_0x21513b['hasOwnProperty'](_0x48b2eb)){if(_[_0xe495('0x2a')](_0x21513b[_0x48b2eb])){for(var _0x5db642=0x0;_0x5db642<_0x21513b[_0x48b2eb][_0xe495('0x2b')];_0x5db642+=0x1){addVertex(_0x1ffd8b,_0x21513b[_0x48b2eb][_0x5db642],_0x48b2eb);}}else{addVertex(_0x1ffd8b,_0x21513b[_0x48b2eb],_0x48b2eb);}}}for(var _0x3dd5df=0x0;_0x3dd5df<_0x3bd472['length'];_0x3dd5df+=0x1){if(_0x3bd472[_0x3dd5df]['source']&&_0x3bd472[_0x3dd5df][_0xe495('0x2c')]){_0x1ffd8b[_0xe495('0x2d')](_0x3bd472[_0x3dd5df][_0xe495('0x2e')],_0x3bd472[_0x3dd5df][_0xe495('0x2c')],_0x3bd472[_0x3dd5df][_0xe495('0x2f')]);}}return _0x1ffd8b;}function getSquareProject(_0x258d9c,_0x181d26){rpc[_0xe495('0x30')](_0x258d9c)['then'](function(_0x4bae72){_0x181d26(null,_0x4bae72);})[_0xe495('0x31')](function(_0x3a82ff){_0x181d26(null,_0x3a82ff);});}function createSquareReport(_0x389177,_0x40d3a3){rpc['createSquareReport'](_0x389177)[_0xe495('0x32')](function(_0x1d0c2f){if(_0x40d3a3){_0x40d3a3(null,_0x1d0c2f);}})[_0xe495('0x31')](function(_0xba78e9){if(_0x40d3a3){_0x40d3a3(null,_0xba78e9);}});}function setChannelVariables(_0xc238a){for(var _0x15fbcd in _0xc238a){if(_0xc238a[_0xe495('0x25')](_0x15fbcd)){if(_0x15fbcd[_0xe495('0x33')](_0xe495('0x34'))===0x0){_0xc238a[_0x15fbcd[_0xe495('0x35')](0x4)]=_0xc238a[_0x15fbcd];delete _0xc238a[_0x15fbcd];}}}}function getLogFromObject(_0x198b98){return util[_0xe495('0x36')](_0x198b98,{'showHidden':![],'depth':null});}function agiHandler(_0x31b515){var _0xe92feb,_0x374ed8,_0x5ee00d,_0x3fc33a,_0xcd9c3;logger['debug'](_0xe495('0x37'),JSON[_0xe495('0x38')](_0x31b515,null,0x2));logger['info'](util['format'](_0xe495('0x39'),_0x31b515[_0xe495('0x19')],_0x31b515[_0xe495('0x1c')],_0x31b515[_0xe495('0x1e')],_0x31b515['dnid'],_0x31b515[_0xe495('0x1a')]));_0x31b515['on'](_0xe495('0xd'),errorHandler);_0x31b515['on'](_0xe495('0x3a'),closeHandler);_0x31b515['on']('timeout',timeoutHandler);_0x31b515['evtHangup']=![];_0x31b515['on'](_0xe495('0x3b'),hangupHandler);var _0x5b6d05=getSquareProject[_0xe495('0x3c')](null,_0x31b515[_0xe495('0x19')]);if(_0x5b6d05){if(_0x5b6d05['production']){_0xe92feb=getRoot(_0x5b6d05['production']);if(_0xe92feb&&_0xe92feb[_0xe495('0x3d')]){logger[_0xe495('0x3e')](_0xe495('0x23'),JSON[_0xe495('0x38')](_0xe92feb,null,0x2));_0x31b515[_0xe495('0x3f')]=moment()[_0xe495('0x12')](_0xe495('0x40'));_0x374ed8=initGraph(_[_0xe495('0x28')](_0xe92feb,_0xe495('0x29')),_0xe92feb[_0xe495('0x29')]);_0x5ee00d=new Vertices(_0x31b515,rpc,mailRpc);logger[_0xe495('0x11')](util[_0xe495('0x12')]('[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x31b515[_0xe495('0x19')],_0x31b515[_0xe495('0x1c')],_0x31b515[_0xe495('0x1e')],_0x31b515[_0xe495('0x1f')],_0x31b515['uniqueid']));_0x374ed8[_0xe495('0x41')](_0xe92feb[_0xe495('0x3d')]['id'],function(_0x553361){try{_0x553361=_0x5ee00d['clear'](_0x553361);logger['debug'](_0xe495('0x42'),JSON[_0xe495('0x38')](_0x553361,null,0x2));if(_0x553361[_0xe495('0x24')]===_0xe495('0x43')){logger[_0xe495('0x11')](_0xe495('0x44'));_0x31b515['context']=_0x553361[_0xe495('0x45')]||_0x31b515[_0xe495('0x45')];_0x31b515[_0xe495('0x46')]=_0x553361[_0xe495('0x46')];_0x31b515[_0xe495('0x47')]=_0x553361[_0xe495('0x47')]?_0x553361[_0xe495('0x47')]-0x1:0x1;return null;}else if(_0x553361&&_0x5ee00d[_0x553361[_0xe495('0x24')]]){_0xcd9c3=_0x5ee00d[_0x553361[_0xe495('0x24')]](_0x553361);logger['info']('response',JSON[_0xe495('0x38')](_0xcd9c3,null,0x2));if(_0xcd9c3&&_0xcd9c3['code']===AGI_CODE_SUCCESS&&_0xcd9c3[_0xe495('0x48')]!==AGI_RESULT_ERROR&&!_0x31b515[_0xe495('0x20')]){logger['debug'](_0xe495('0x49'),getLogFromObject(_0xcd9c3));return _['isUndefined'](_0xcd9c3['result'])?null:_0xcd9c3[_0xe495('0x48')]['toString']();}else{logger[_0xe495('0xd')]('response',getLogFromObject(_0xcd9c3));return null;}}else{logger[_0xe495('0xd')](_0xe495('0x4a'));return null;}}catch(_0x11eb47){logger[_0xe495('0xd')](_0x11eb47[_0xe495('0xe')]);return null;}});if(_0xe92feb[_0xe495('0x4b')]){logger[_0xe495('0x11')](util[_0xe495('0x12')](_0xe495('0x4c'),_0x31b515[_0xe495('0x19')],_0x31b515['calleridname'],_0x31b515[_0xe495('0x1e')],_0x31b515['dnid'],_0x31b515[_0xe495('0x1a')]));_0x374ed8[_0xe495('0x41')](_0xe92feb[_0xe495('0x4b')]['id'],function(_0x1f30f5){try{_0x1f30f5=_0x5ee00d['clear'](_0x1f30f5);logger['debug']('vertex',JSON[_0xe495('0x38')](_0x1f30f5,null,0x2));if(_0x1f30f5&&_0x5ee00d[_0x1f30f5[_0xe495('0x24')]]){_0xcd9c3=_0x5ee00d[_0x1f30f5['agicommand']](_0x1f30f5);if(_0xcd9c3){logger[_0xe495('0x3e')](_0xe495('0x49'),getLogFromObject(_0xcd9c3));return _[_0xe495('0x4d')](_0xcd9c3[_0xe495('0x48')])?null:_0xcd9c3[_0xe495('0x48')][_0xe495('0x4e')]();}else{logger[_0xe495('0xd')]('response',getLogFromObject(_0xcd9c3));return null;}}else{logger[_0xe495('0xd')](_0xe495('0x4a'));return null;}}catch(_0x455d94){logger[_0xe495('0xd')](_0x455d94[_0xe495('0xe')]);return null;}});}logger['info'](util['format'](_0xe495('0x4f'),_0x31b515[_0xe495('0x19')],_0x31b515[_0xe495('0x1c')],_0x31b515['callerid'],_0x31b515['dnid'],_0x31b515[_0xe495('0x1a')]));logger['info'](util[_0xe495('0x12')](_0xe495('0x50'),_0x31b515['context'],_0x31b515[_0xe495('0x46')],parseInt(_0x31b515[_0xe495('0x47')],0xa)+0x1));_0x31b515[_0xe495('0x51')](_0x31b515[_0xe495('0x45')],_0x31b515[_0xe495('0x46')],parseInt(_0x31b515[_0xe495('0x47')],0xa)+0x1);_0x31b515[_0xe495('0x3a')]();}}else{logger[_0xe495('0xd')](util[_0xe495('0x12')](_0xe495('0x52'),_0x31b515[_0xe495('0x19')]));_0x31b515[_0xe495('0x51')](_0x31b515['context'],_0x31b515[_0xe495('0x46')],parseInt(_0x31b515[_0xe495('0x47')],0xa)+0x1);_0x31b515[_0xe495('0x3a')]();}}else{logger[_0xe495('0xd')](util[_0xe495('0x12')](_0xe495('0x53'),_0x31b515[_0xe495('0x19')]));_0x31b515[_0xe495('0x51')](_0x31b515[_0xe495('0x45')],_0x31b515[_0xe495('0x46')],parseInt(_0x31b515['priority'],0xa)+0x1);_0x31b515['close']();}}function main(){var _0x3e3471;return utilLicense[_0xe495('0x54')]()['then'](function(_0x2cae70){if(_0x2cae70){if(_0x2cae70[_0xe495('0x55')]){if(_0x2cae70[_0xe495('0x56')]&&_0x2cae70[_0xe495('0x56')]>0x0){logger['info'](util[_0xe495('0x12')](_0xe495('0x57'),_0x2cae70[_0xe495('0x56')]));_0x3e3471=_0x2cae70[_0xe495('0x56')];}else{logger[_0xe495('0x11')](_0xe495('0x58'));}}else{logger['info'](_0xe495('0x59'));_0x3e3471=-0x1;}}})['catch'](function(_0x1a4ab2){logger['error'](_0xe495('0x5a'),_0x1a4ab2['stack']);})[_0xe495('0x4b')](function(){var _0x57c584=require(_0xe495('0x5b'))(config[_0xe495('0xa')]['port'],config[_0xe495('0xa')]['ip'],_0x3e3471);_0x57c584['on'](_0xe495('0xd'),errorHandler);_0x57c584['on'](_0xe495('0x5c'),listeningHandler);_0x57c584['on'](_0xe495('0x5d'),connectionHandler);_0x57c584['on'](_0xe495('0x3a'),closeHandler);});}main(); \ No newline at end of file +var _0xfd0f=['target','addEdge','getSquareProject','then','catch','inspect','variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','hangup','sync','production','debug','root','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','start','clear','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code','result','isUndefined','toString','agicommand\x20not\x20found','finally','continueAt','Project\x20%s\x20not\x20published','Project\x20%s\x20not\x20found','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','xml2json','lodash','util','moment','../../config/environment','agi','./rpc','./mailRpc','./graph','./vertices','defaults','127.0.0.1','error','stack','log','port','info','format','name','message','[%s]\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','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','dnid','uniqueid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','mxGraphModel','agicommand','hasOwnProperty','retry','maxRetry','addVertex','omit','mxCell','length','source'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfd0f,0x1b8));var _0xffd0=function(_0x25cd40,_0x248f43){_0x25cd40=_0x25cd40-0x0;var _0x50cce8=_0xfd0f[_0x25cd40];return _0x50cce8;};'use strict';var parser=require(_0xffd0('0x0'));var _=require(_0xffd0('0x1'));var syncho=require('syncho');var util=require(_0xffd0('0x2'));var moment=require(_0xffd0('0x3'));var config=require(_0xffd0('0x4'));var logger=require('../../config/logger')(_0xffd0('0x5'));var utilLicense=require('../../config/license/util');var rpc=require(_0xffd0('0x6'));var mailRpc=require(_0xffd0('0x7'));var Graph=require(_0xffd0('0x8'));var Vertices=require(_0xffd0('0x9'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0xffd0('0x5')]=_[_0xffd0('0xa')](config[_0xffd0('0x5')],{'ip':_0xffd0('0xb'),'port':0x11dd});function connectionHandler(_0x55488d){process['nextTick'](function(){syncho(function(){try{setChannelVariables(_0x55488d);agiHandler(_0x55488d);}catch(_0x46129b){logger[_0xffd0('0xc')](_0x46129b[_0xffd0('0xd')]);}});});}function listeningHandler(){console[_0xffd0('0xe')]('Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!',config['agi'][_0xffd0('0xf')]);logger[_0xffd0('0x10')](util[_0xffd0('0x11')]('[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d',config['agi']['ip'],config[_0xffd0('0x5')][_0xffd0('0xf')]));}function errorHandler(_0x59b236){if(_0x59b236&&_0x59b236[_0xffd0('0x12')]&&_0x59b236[_0xffd0('0x13')]){logger[_0xffd0('0xc')](util['format'](_0xffd0('0x14'),_0x59b236[_0xffd0('0x12')],_0x59b236['message']));}else{logger[_0xffd0('0xc')](util['format']('[ERROR]\x20%s',_0x59b236[_0xffd0('0xd')]));}}function closeHandler(){logger['info'](util[_0xffd0('0x11')](_0xffd0('0x15'),this[_0xffd0('0x16')],this[_0xffd0('0x17')],this[_0xffd0('0x18')],this['dnid'],this['uniqueid']));try{createSquareReport(this);}catch(_0x285c52){logger[_0xffd0('0xc')](_0x285c52[_0xffd0('0xd')]);}}function timeoutHandler(){logger[_0xffd0('0x10')](util[_0xffd0('0x11')](_0xffd0('0x19'),this[_0xffd0('0x16')],this[_0xffd0('0x17')],this[_0xffd0('0x18')],this[_0xffd0('0x1a')],this[_0xffd0('0x1b')]));}function hangupHandler(){logger[_0xffd0('0x10')](util[_0xffd0('0x11')](_0xffd0('0x1c'),this[_0xffd0('0x16')],this[_0xffd0('0x17')],this['callerid'],this['dnid'],this[_0xffd0('0x1b')]));this[_0xffd0('0x1d')]=!![];}function getRoot(_0x4fbb72){return parser['toJson'](_0x4fbb72,{'object':!![]})[_0xffd0('0x1e')]['root'];}function addVertex(_0x10467e,_0x329864,_0x2c8d64){_0x329864[_0xffd0('0x1f')]=_0x2c8d64;if(_0x329864[_0xffd0('0x20')](_0xffd0('0x21'))){_0x329864[_0xffd0('0x22')]=parseInt(_0x329864[_0xffd0('0x21')],0xa);}_0x10467e[_0xffd0('0x23')](_[_0xffd0('0x24')](_0x329864,_0xffd0('0x25')));}function initGraph(_0x463af3,_0x24f135){var _0x481c52=new Graph();for(var _0x480322 in _0x463af3){if(_0x463af3[_0xffd0('0x20')](_0x480322)){if(_['isArray'](_0x463af3[_0x480322])){for(var _0x5a7c44=0x0;_0x5a7c44<_0x463af3[_0x480322][_0xffd0('0x26')];_0x5a7c44+=0x1){addVertex(_0x481c52,_0x463af3[_0x480322][_0x5a7c44],_0x480322);}}else{addVertex(_0x481c52,_0x463af3[_0x480322],_0x480322);}}}for(var _0x3b09f9=0x0;_0x3b09f9<_0x24f135[_0xffd0('0x26')];_0x3b09f9+=0x1){if(_0x24f135[_0x3b09f9][_0xffd0('0x27')]&&_0x24f135[_0x3b09f9][_0xffd0('0x28')]){_0x481c52[_0xffd0('0x29')](_0x24f135[_0x3b09f9]['source'],_0x24f135[_0x3b09f9][_0xffd0('0x28')],_0x24f135[_0x3b09f9]['value']);}}return _0x481c52;}function getSquareProject(_0x5c4adb,_0x56f39a){rpc[_0xffd0('0x2a')](_0x5c4adb)[_0xffd0('0x2b')](function(_0x3b71ac){_0x56f39a(null,_0x3b71ac);})[_0xffd0('0x2c')](function(_0x3bb309){_0x56f39a(null,_0x3bb309);});}function createSquareReport(_0x326e8f,_0x5c3be5){rpc['createSquareReport'](_0x326e8f)['then'](function(_0x116211){if(_0x5c3be5){_0x5c3be5(null,_0x116211);}})['catch'](function(_0x1f7dff){if(_0x5c3be5){_0x5c3be5(null,_0x1f7dff);}});}function setChannelVariables(_0x31a339){for(var _0x48ffc4 in _0x31a339){if(_0x31a339[_0xffd0('0x20')](_0x48ffc4)){if(_0x48ffc4['indexOf']('agi_')===0x0){_0x31a339[_0x48ffc4['substring'](0x4)]=_0x31a339[_0x48ffc4];delete _0x31a339[_0x48ffc4];}}}}function getLogFromObject(_0x1c1dbc){return util[_0xffd0('0x2d')](_0x1c1dbc,{'showHidden':![],'depth':null});}function agiHandler(_0x25f6ad){var _0x866da,_0x3f7af9,_0x4a9cab,_0x309363,_0x24d18c;logger['debug'](_0xffd0('0x2e'),JSON[_0xffd0('0x2f')](_0x25f6ad,null,0x2));logger[_0xffd0('0x10')](util[_0xffd0('0x11')](_0xffd0('0x30'),_0x25f6ad[_0xffd0('0x16')],_0x25f6ad['calleridname'],_0x25f6ad[_0xffd0('0x18')],_0x25f6ad[_0xffd0('0x1a')],_0x25f6ad['uniqueid']));_0x25f6ad['on'](_0xffd0('0xc'),errorHandler);_0x25f6ad['on'](_0xffd0('0x31'),closeHandler);_0x25f6ad['on']('timeout',timeoutHandler);_0x25f6ad[_0xffd0('0x1d')]=![];_0x25f6ad['on'](_0xffd0('0x32'),hangupHandler);var _0x55b5ec=getSquareProject[_0xffd0('0x33')](null,_0x25f6ad['arg_1']);if(_0x55b5ec){if(_0x55b5ec[_0xffd0('0x34')]){_0x866da=getRoot(_0x55b5ec[_0xffd0('0x34')]);if(_0x866da&&_0x866da['start']){logger[_0xffd0('0x35')](_0xffd0('0x36'),JSON[_0xffd0('0x2f')](_0x866da,null,0x2));_0x25f6ad[_0xffd0('0x37')]=moment()[_0xffd0('0x11')](_0xffd0('0x38'));_0x3f7af9=initGraph(_[_0xffd0('0x24')](_0x866da,_0xffd0('0x25')),_0x866da[_0xffd0('0x25')]);_0x4a9cab=new Vertices(_0x25f6ad,rpc,mailRpc);logger[_0xffd0('0x10')](util[_0xffd0('0x11')](_0xffd0('0x39'),_0x25f6ad[_0xffd0('0x16')],_0x25f6ad[_0xffd0('0x17')],_0x25f6ad[_0xffd0('0x18')],_0x25f6ad[_0xffd0('0x1a')],_0x25f6ad[_0xffd0('0x1b')]));_0x3f7af9['traverseBFS'](_0x866da[_0xffd0('0x3a')]['id'],function(_0xea6cbd){try{_0xea6cbd=_0x4a9cab[_0xffd0('0x3b')](_0xea6cbd);logger[_0xffd0('0x35')]('vertex',JSON['stringify'](_0xea6cbd,null,0x2));if(_0xea6cbd[_0xffd0('0x1f')]===_0xffd0('0x3c')){logger[_0xffd0('0x10')](_0xffd0('0x3d'));_0x25f6ad['context']=_0xea6cbd[_0xffd0('0x3e')]||_0x25f6ad[_0xffd0('0x3e')];_0x25f6ad[_0xffd0('0x3f')]=_0xea6cbd[_0xffd0('0x3f')];_0x25f6ad[_0xffd0('0x40')]=_0xea6cbd[_0xffd0('0x40')]?_0xea6cbd[_0xffd0('0x40')]-0x1:0x1;return null;}else if(_0xea6cbd&&_0x4a9cab[_0xea6cbd[_0xffd0('0x1f')]]){_0x24d18c=_0x4a9cab[_0xea6cbd[_0xffd0('0x1f')]](_0xea6cbd);logger[_0xffd0('0x10')](_0xffd0('0x41'),JSON[_0xffd0('0x2f')](_0x24d18c,null,0x2));if(_0x24d18c&&_0x24d18c[_0xffd0('0x42')]===AGI_CODE_SUCCESS&&_0x24d18c[_0xffd0('0x43')]!==AGI_RESULT_ERROR&&!_0x25f6ad[_0xffd0('0x1d')]){logger[_0xffd0('0x35')](_0xffd0('0x41'),getLogFromObject(_0x24d18c));return _[_0xffd0('0x44')](_0x24d18c[_0xffd0('0x43')])?null:_0x24d18c[_0xffd0('0x43')][_0xffd0('0x45')]();}else{logger['error'](_0xffd0('0x41'),getLogFromObject(_0x24d18c));return null;}}else{logger[_0xffd0('0xc')](_0xffd0('0x46'));return null;}}catch(_0x35ce9b){logger[_0xffd0('0xc')](_0x35ce9b[_0xffd0('0xd')]);return null;}});if(_0x866da[_0xffd0('0x47')]){logger[_0xffd0('0x10')](util[_0xffd0('0x11')]('[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x25f6ad[_0xffd0('0x16')],_0x25f6ad[_0xffd0('0x17')],_0x25f6ad[_0xffd0('0x18')],_0x25f6ad[_0xffd0('0x1a')],_0x25f6ad[_0xffd0('0x1b')]));_0x3f7af9['traverseBFS'](_0x866da['finally']['id'],function(_0x4aac28){try{_0x4aac28=_0x4a9cab[_0xffd0('0x3b')](_0x4aac28);logger[_0xffd0('0x35')]('vertex',JSON[_0xffd0('0x2f')](_0x4aac28,null,0x2));if(_0x4aac28&&_0x4a9cab[_0x4aac28[_0xffd0('0x1f')]]){_0x24d18c=_0x4a9cab[_0x4aac28[_0xffd0('0x1f')]](_0x4aac28);if(_0x24d18c){logger[_0xffd0('0x35')](_0xffd0('0x41'),getLogFromObject(_0x24d18c));return _[_0xffd0('0x44')](_0x24d18c[_0xffd0('0x43')])?null:_0x24d18c[_0xffd0('0x43')][_0xffd0('0x45')]();}else{logger[_0xffd0('0xc')](_0xffd0('0x41'),getLogFromObject(_0x24d18c));return null;}}else{logger[_0xffd0('0xc')](_0xffd0('0x46'));return null;}}catch(_0x57b453){logger['error'](_0x57b453[_0xffd0('0xd')]);return null;}});}logger[_0xffd0('0x10')](util[_0xffd0('0x11')]('[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x25f6ad[_0xffd0('0x16')],_0x25f6ad['calleridname'],_0x25f6ad[_0xffd0('0x18')],_0x25f6ad[_0xffd0('0x1a')],_0x25f6ad[_0xffd0('0x1b')]));logger[_0xffd0('0x10')](util['format']('[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s',_0x25f6ad['context'],_0x25f6ad[_0xffd0('0x3f')],parseInt(_0x25f6ad[_0xffd0('0x40')],0xa)+0x1));_0x25f6ad[_0xffd0('0x48')](_0x25f6ad[_0xffd0('0x3e')],_0x25f6ad[_0xffd0('0x3f')],parseInt(_0x25f6ad[_0xffd0('0x40')],0xa)+0x1);_0x25f6ad[_0xffd0('0x31')]();}}else{logger[_0xffd0('0xc')](util[_0xffd0('0x11')](_0xffd0('0x49'),_0x25f6ad[_0xffd0('0x16')]));_0x25f6ad[_0xffd0('0x48')](_0x25f6ad['context'],_0x25f6ad[_0xffd0('0x3f')],parseInt(_0x25f6ad[_0xffd0('0x40')],0xa)+0x1);_0x25f6ad[_0xffd0('0x31')]();}}else{logger[_0xffd0('0xc')](util[_0xffd0('0x11')](_0xffd0('0x4a'),_0x25f6ad[_0xffd0('0x16')]));_0x25f6ad['continueAt'](_0x25f6ad[_0xffd0('0x3e')],_0x25f6ad[_0xffd0('0x3f')],parseInt(_0x25f6ad[_0xffd0('0x40')],0xa)+0x1);_0x25f6ad[_0xffd0('0x31')]();}}function main(){var _0x5cf3b1;return utilLicense['getLicense']()['then'](function(_0x1d4d8b){if(_0x1d4d8b){if(_0x1d4d8b[_0xffd0('0x4b')]){if(_0x1d4d8b[_0xffd0('0x4c')]&&_0x1d4d8b[_0xffd0('0x4c')]>0x0){logger[_0xffd0('0x10')](util[_0xffd0('0x11')](_0xffd0('0x4d'),_0x1d4d8b['callysquare']));_0x5cf3b1=_0x1d4d8b[_0xffd0('0x4c')];}else{logger[_0xffd0('0x10')](_0xffd0('0x4e'));}}else{logger[_0xffd0('0x10')](_0xffd0('0x4f'));_0x5cf3b1=-0x1;}}})[_0xffd0('0x2c')](function(_0xb86024){logger['error']('[LICENSE]',_0xb86024[_0xffd0('0xd')]);})[_0xffd0('0x47')](function(){var _0x7231e6=require('./server')(config[_0xffd0('0x5')][_0xffd0('0xf')],config[_0xffd0('0x5')]['ip'],_0x5cf3b1);_0x7231e6['on'](_0xffd0('0xc'),errorHandler);_0x7231e6['on']('listening',listeningHandler);_0x7231e6['on']('connection',connectionHandler);_0x7231e6['on'](_0xffd0('0x31'),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 bda7110..e2faaae 100644 --- a/server/services/agi/mailRpc/index.js +++ b/server/services/agi/mailRpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['result','catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','http','request','error','message'];(function(_0x1a7005,_0x172e22){var _0x287a35=function(_0x28c47b){while(--_0x28c47b){_0x1a7005['push'](_0x1a7005['shift']());}};_0x287a35(++_0x172e22);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var BPromise=require(_0x7995('0x0'));var jayson=require(_0x7995('0x1'));var client=jayson[_0x7995('0x2')][_0x7995('0x3')]({'port':0x232b});function request(_0x5b96eb,_0x86c128){return new BPromise(function(_0x3c58eb,_0x1902b4){return client[_0x7995('0x4')](_0x5b96eb,_0x86c128)['then'](function(_0x744bea){if(_0x744bea[_0x7995('0x5')]){return _0x1902b4(_0x744bea[_0x7995('0x5')][_0x7995('0x6')]);}else{return _0x3c58eb(_0x744bea[_0x7995('0x7')]);}})[_0x7995('0x8')](function(_0x4996ca){return _0x1902b4(_0x4996ca);});});}exports[_0x7995('0x9')]=function(_0x1cad37,_0x4a64f7){return request(_0x7995('0xa'),{'account':_0x1cad37,'message':_0x4a64f7});}; \ No newline at end of file +var _0x814b=['bluebird','jayson/promise','client','http','request','then','error','result','catch','sendMailMessage','SendMail'];(function(_0x39e971,_0x187d9d){var _0xebc428=function(_0x4d80f8){while(--_0x4d80f8){_0x39e971['push'](_0x39e971['shift']());}};_0xebc428(++_0x187d9d);}(_0x814b,0x1a2));var _0xb814=function(_0x102881,_0x58d723){_0x102881=_0x102881-0x0;var _0x5c63d0=_0x814b[_0x102881];return _0x5c63d0;};'use strict';var BPromise=require(_0xb814('0x0'));var jayson=require(_0xb814('0x1'));var client=jayson[_0xb814('0x2')][_0xb814('0x3')]({'port':0x232b});function request(_0xfbb64b,_0x477725){return new BPromise(function(_0x4a98af,_0x38c21a){return client[_0xb814('0x4')](_0xfbb64b,_0x477725)[_0xb814('0x5')](function(_0x4237bc){if(_0x4237bc[_0xb814('0x6')]){return _0x38c21a(_0x4237bc[_0xb814('0x6')]['message']);}else{return _0x4a98af(_0x4237bc[_0xb814('0x7')]);}})[_0xb814('0x8')](function(_0x5c8539){return _0x38c21a(_0x5c8539);});});}exports[_0xb814('0x9')]=function(_0x2913a6,_0x186d5a){return request(_0xb814('0xa'),{'account':_0x2913a6,'message':_0x186d5a});}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index 294ce1b..e4f9398 100644 --- a/server/services/agi/reply.js +++ b/server/services/agi/reply.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['exports','util','stream','Transform','call','_localBuffer','_inBody','inherits','\x0d\x0a\x0d\x0a','toString','substring','length','split','slice','trim','headers','indexOf','emit','line'];(function(_0x32084f,_0x28fc38){var _0x187302=function(_0x481c2b){while(--_0x481c2b){_0x32084f['push'](_0x32084f['shift']());}};_0x187302(++_0x28fc38);}(_0x5f2f,0x73));var _0xf5f2=function(_0x1abcd2,_0x5d0ca7){_0x1abcd2=_0x1abcd2-0x0;var _0x50b3b5=_0x5f2f[_0x1abcd2];return _0x50b3b5;};'use strict';var util=require(_0xf5f2('0x0'));var Transform=require(_0xf5f2('0x1'))[_0xf5f2('0x2')];function AGIReply(_0x1a7be1){Transform[_0xf5f2('0x3')](this,_0x1a7be1);this[_0xf5f2('0x4')]='';this[_0xf5f2('0x5')]=![];}util[_0xf5f2('0x6')](AGIReply,Transform);AGIReply['prototype']['_transform']=function(_0x1665c7,_0x192215,_0xad7f65){var _0x3eebf6='\x0a',_0x3133bc=['\x0a\x0a',_0xf5f2('0x7')],_0x473100=-0x1,_0x5907aa=-0x1,_0x466882='',_0x46cd9c=0x0,_0x2ec345='',_0x56a69f='';this[_0xf5f2('0x4')]+=_0x1665c7[_0xf5f2('0x8')]();_0x2ec345=this['_localBuffer'];if(!this[_0xf5f2('0x5')]){_0x46cd9c=0x0;while(_0x3133bc[_0x46cd9c]){while((_0x5907aa=_0x2ec345['indexOf'](_0x3133bc[_0x46cd9c]))!=-0x1){_0x466882=_0x3133bc[_0x46cd9c];_0x56a69f=_0x2ec345['substring'](0x0,_0x5907aa);_0x2ec345=_0x2ec345[_0xf5f2('0x9')](_0x5907aa+_0x466882[_0xf5f2('0xa')]);var _0x4b78cd=_0x56a69f[_0xf5f2('0xb')](_0x3eebf6),_0x336f6b=0x0,_0x14b51f={},_0x331482='',_0x3f2997='',_0x59bb6c=-0x1;while(_0x4b78cd[_0x336f6b]){_0x59bb6c=_0x4b78cd[_0x336f6b]['indexOf'](':');if(_0x59bb6c!=-0x1){_0x331482=_0x4b78cd[_0x336f6b][_0xf5f2('0xc')](0x0,_0x59bb6c)[_0xf5f2('0xd')]();_0x3f2997=_0x4b78cd[_0x336f6b][_0xf5f2('0xc')](_0x59bb6c+0x1)[_0xf5f2('0xd')]();if(_0x331482[_0xf5f2('0xa')]>0x0){_0x14b51f[_0x331482]=_0x3f2997;}}else{}_0x336f6b++;}this['emit'](_0xf5f2('0xe'),_0x14b51f);this[_0xf5f2('0x5')]=!![];}_0x46cd9c++;}this[_0xf5f2('0x4')]=_0x2ec345;}else{while((_0x473100=_0x2ec345[_0xf5f2('0xf')](_0x3eebf6))!=-0x1){_0x56a69f=_0x2ec345[_0xf5f2('0x9')](0x0,_0x473100);this[_0xf5f2('0x10')](_0xf5f2('0x11'),_0x56a69f);_0x2ec345=_0x2ec345[_0xf5f2('0x9')](_0x473100+_0x3eebf6[_0xf5f2('0xa')]);}this[_0xf5f2('0x4')]=_0x2ec345;}_0xad7f65();};module[_0xf5f2('0x12')]=AGIReply; \ No newline at end of file +var _0x5f2f=['exports','util','stream','Transform','call','_localBuffer','_inBody','inherits','\x0d\x0a\x0d\x0a','toString','substring','length','split','slice','trim','headers','indexOf','emit','line'];(function(_0x4bbb10,_0x417407){var _0x513ac6=function(_0x234b31){while(--_0x234b31){_0x4bbb10['push'](_0x4bbb10['shift']());}};_0x513ac6(++_0x417407);}(_0x5f2f,0x73));var _0xf5f2=function(_0x33a8c1,_0x4d75b9){_0x33a8c1=_0x33a8c1-0x0;var _0x291e29=_0x5f2f[_0x33a8c1];return _0x291e29;};'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 8b4e9ba..14d88df 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 _0xd8a0=['message','result','catch','getSquareProject','ShowSquareProject','production','getMailAccountById','ShowMailAccount','Smtp','name','email','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','getVariableById','getSquareOdbcById','dsn','getUserById','ShowUser','getTrunkById','ShowTrunk','getSoundById','ShowSound','ShowInterval','Interval','Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','ShowCmHopper','phone','ListId','CreateCmContact','getPauseById','ShowPause','agentLogin','LoginUser','agentPause','agentUnpause','UnpauseUser','LogoutUser','bluebird','moment','lodash','client','http','request','then','error'];(function(_0x12a824,_0x11873a){var _0x4f02f2=function(_0x1ee90b){while(--_0x1ee90b){_0x12a824['push'](_0x12a824['shift']());}};_0x4f02f2(++_0x11873a);}(_0xd8a0,0x74));var _0x0d8a=function(_0x14560e,_0x55aae6){_0x14560e=_0x14560e-0x0;var _0x1f0a77=_0xd8a0[_0x14560e];return _0x1f0a77;};'use strict';var BPromise=require(_0x0d8a('0x0'));var moment=require(_0x0d8a('0x1'));var _=require(_0x0d8a('0x2'));var util=require('util');var jayson=require('jayson/promise');var client=jayson[_0x0d8a('0x3')][_0x0d8a('0x4')]({'port':0x2329});function request(_0xca194d,_0x3bb5cd){return new BPromise(function(_0x39b7c2,_0x3a919a){return client[_0x0d8a('0x5')](_0xca194d,_0x3bb5cd)[_0x0d8a('0x6')](function(_0x5d668a){if(_0x5d668a[_0x0d8a('0x7')]){return _0x3a919a(_0x5d668a[_0x0d8a('0x7')][_0x0d8a('0x8')]);}else{return _0x39b7c2(_0x5d668a[_0x0d8a('0x9')]);}})[_0x0d8a('0xa')](function(_0x863b2a){return _0x3a919a(_0x863b2a);});});}exports[_0x0d8a('0xb')]=function(_0x57a715){return request(_0x0d8a('0xc'),{'options':{'raw':![],'where':{'name':_0x57a715},'attributes':[_0x0d8a('0xd')]}});};exports[_0x0d8a('0xe')]=function(_0x40e42d){return request(_0x0d8a('0xf'),{'options':{'raw':![],'where':{'id':_0x40e42d},'include':[{'model':'MailServerOut','as':_0x0d8a('0x10')}],'attributes':['id',_0x0d8a('0x11'),_0x0d8a('0x12')]}});};exports[_0x0d8a('0x13')]=function(_0x172e54){return request(_0x0d8a('0xc'),{'options':{'where':{'id':_0x172e54},'attributes':[_0x0d8a('0x11')]}});};exports[_0x0d8a('0x14')]=function(_0x5e17c3){return request(_0x0d8a('0x15'),{'options':{'where':{'id':_0x5e17c3},'attributes':[_0x0d8a('0x11')]}});};exports[_0x0d8a('0x16')]=function(_0x5950fc){return request('ShowVariable',{'options':{'where':{'id':_0x5950fc},'attributes':[_0x0d8a('0x11')]}});};exports[_0x0d8a('0x17')]=function(_0xd49da0){return request('ShowSquareOdbc',{'options':{'where':{'id':_0xd49da0},'attributes':[_0x0d8a('0x18')]}});};exports[_0x0d8a('0x19')]=function(_0x56a167){return request(_0x0d8a('0x1a'),{'options':{'where':{'id':_0x56a167},'attributes':['name']}});};exports[_0x0d8a('0x1b')]=function(_0x45eed1){return request(_0x0d8a('0x1c'),{'options':{'where':{'id':_0x45eed1},'attributes':['name']}});};exports[_0x0d8a('0x1d')]=function(_0x589926){return request(_0x0d8a('0x1e'),{'options':{'where':{'id':_0x589926},'attributes':['save_name']}});};exports['getIntervalById']=function(_0x35bc16){return request(_0x0d8a('0x1f'),{'options':{'raw':![],'where':{'id':_0x35bc16},'include':[{'model':_0x0d8a('0x20'),'as':_0x0d8a('0x21')}]}});};exports[_0x0d8a('0x22')]=function(_0x431efe){return request(_0x0d8a('0x23'),{'options':{'where':{'id':_0x431efe},'attributes':['id',_0x0d8a('0x11')]}});};exports[_0x0d8a('0x24')]=function(_0x45d145){return request('CreateSmsMessage',{'body':_0x45d145});};exports[_0x0d8a('0x25')]=function(_0x2c9e88){return request(_0x0d8a('0x26'),{'body':_0x2c9e88});};exports[_0x0d8a('0x27')]=function(_0x2a7691){return request(_0x0d8a('0x28'),{'body':_[_0x0d8a('0x29')](_0x2a7691,{'project_name':_0x2a7691[_0x0d8a('0x2a')],'prev_project_name':_0x2a7691[_0x0d8a('0x2b')]||'','is_subproject':_0x2a7691[_0x0d8a('0x2b')]?!![]:![],'leaveAt':moment()[_0x0d8a('0x2c')](_0x0d8a('0x2d'))})});};exports[_0x0d8a('0x2e')]=function(_0x16b588){return request(_0x0d8a('0x2f'),{'body':_0x16b588});};exports[_0x0d8a('0x30')]=function(_0x45b69e){return request(_0x0d8a('0x31'),{'body':_0x45b69e});};exports['createCmContact']=function(_0x31c5cf){return request(_0x0d8a('0x32'),{'options':{'raw':![],'where':{'phone':_0x31c5cf[_0x0d8a('0x33')],'ListId':_0x31c5cf[_0x0d8a('0x34')]}}})[_0x0d8a('0x6')](function(_0xaf101b){if(_0xaf101b){return _0xaf101b;}return request(_0x0d8a('0x35'),{'body':_0x31c5cf});});};exports[_0x0d8a('0x36')]=function(_0x5d2041){return request(_0x0d8a('0x37'),{'options':{'where':{'id':_0x5d2041},'attributes':[_0x0d8a('0x11')]}});};exports[_0x0d8a('0x38')]=function(_0x351eb0,_0x441794){return request(_0x0d8a('0x39'),{'body':{'interface':_0x441794},'options':{'where':_0x351eb0}});};exports[_0x0d8a('0x3a')]=function(_0x31f02b,_0x56f5f7,_0x50b8b9){return request('PauseUser',{'body':{'type':_0x56f5f7,'uniqueid':_0x50b8b9},'options':{'where':_0x31f02b}});};exports[_0x0d8a('0x3b')]=function(_0x7db7c2){return request(_0x0d8a('0x3c'),{'body':{},'options':{'where':_0x7db7c2}});};exports['agentLogout']=function(_0x430715){return request(_0x0d8a('0x3d'),{'body':{},'options':{'where':_0x430715}});}; \ No newline at end of file +var _0x8dd1=['getSoundById','getIntervalById','ShowInterval','Interval','Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','merge','arg_2','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','phone','ListId','CreateCmContact','agentLogin','LoginUser','agentPause','agentUnpause','UnpauseUser','agentLogout','bluebird','moment','lodash','jayson/promise','http','request','then','error','message','result','ShowSquareProject','production','getMailAccountById','ShowMailAccount','MailServerOut','name','email','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','dsn','getUserById','ShowUser','ShowTrunk'];(function(_0x29d915,_0x54a040){var _0x160f86=function(_0x237dfa){while(--_0x237dfa){_0x29d915['push'](_0x29d915['shift']());}};_0x160f86(++_0x54a040);}(_0x8dd1,0x1e5));var _0x18dd=function(_0x50bf36,_0x1edc8c){_0x50bf36=_0x50bf36-0x0;var _0x15bac6=_0x8dd1[_0x50bf36];return _0x15bac6;};'use strict';var BPromise=require(_0x18dd('0x0'));var moment=require(_0x18dd('0x1'));var _=require(_0x18dd('0x2'));var util=require('util');var jayson=require(_0x18dd('0x3'));var client=jayson['client'][_0x18dd('0x4')]({'port':0x2329});function request(_0x277eb9,_0x1bccbf){return new BPromise(function(_0x1726fa,_0x4c99bf){return client[_0x18dd('0x5')](_0x277eb9,_0x1bccbf)[_0x18dd('0x6')](function(_0x43c5b5){if(_0x43c5b5[_0x18dd('0x7')]){return _0x4c99bf(_0x43c5b5[_0x18dd('0x7')][_0x18dd('0x8')]);}else{return _0x1726fa(_0x43c5b5[_0x18dd('0x9')]);}})['catch'](function(_0x348663){return _0x4c99bf(_0x348663);});});}exports['getSquareProject']=function(_0x426a4a){return request(_0x18dd('0xa'),{'options':{'raw':![],'where':{'name':_0x426a4a},'attributes':[_0x18dd('0xb')]}});};exports[_0x18dd('0xc')]=function(_0x36568b){return request(_0x18dd('0xd'),{'options':{'raw':![],'where':{'id':_0x36568b},'include':[{'model':_0x18dd('0xe'),'as':'Smtp'}],'attributes':['id',_0x18dd('0xf'),_0x18dd('0x10')]}});};exports[_0x18dd('0x11')]=function(_0x390c69){return request(_0x18dd('0xa'),{'options':{'where':{'id':_0x390c69},'attributes':['name']}});};exports[_0x18dd('0x12')]=function(_0x3449af){return request(_0x18dd('0x13'),{'options':{'where':{'id':_0x3449af},'attributes':[_0x18dd('0xf')]}});};exports[_0x18dd('0x14')]=function(_0x38fd98){return request(_0x18dd('0x15'),{'options':{'where':{'id':_0x38fd98},'attributes':[_0x18dd('0xf')]}});};exports[_0x18dd('0x16')]=function(_0x492b90){return request(_0x18dd('0x17'),{'options':{'where':{'id':_0x492b90},'attributes':[_0x18dd('0x18')]}});};exports[_0x18dd('0x19')]=function(_0x52ace0){return request(_0x18dd('0x1a'),{'options':{'where':{'id':_0x52ace0},'attributes':[_0x18dd('0xf')]}});};exports['getTrunkById']=function(_0x200772){return request(_0x18dd('0x1b'),{'options':{'where':{'id':_0x200772},'attributes':[_0x18dd('0xf')]}});};exports[_0x18dd('0x1c')]=function(_0x131ba7){return request('ShowSound',{'options':{'where':{'id':_0x131ba7},'attributes':['save_name']}});};exports[_0x18dd('0x1d')]=function(_0x1134dd){return request(_0x18dd('0x1e'),{'options':{'raw':![],'where':{'id':_0x1134dd},'include':[{'model':_0x18dd('0x1f'),'as':_0x18dd('0x20')}]}});};exports[_0x18dd('0x21')]=function(_0x382fef){return request(_0x18dd('0x22'),{'options':{'where':{'id':_0x382fef},'attributes':['id','name']}});};exports[_0x18dd('0x23')]=function(_0x1bfdc5){return request('CreateSmsMessage',{'body':_0x1bfdc5});};exports[_0x18dd('0x24')]=function(_0x5cae41){return request(_0x18dd('0x25'),{'body':_0x5cae41});};exports[_0x18dd('0x26')]=function(_0x36a7d0){return request('CreateSquareReport',{'body':_[_0x18dd('0x27')](_0x36a7d0,{'project_name':_0x36a7d0['arg_1'],'prev_project_name':_0x36a7d0[_0x18dd('0x28')]||'','is_subproject':_0x36a7d0[_0x18dd('0x28')]?!![]:![],'leaveAt':moment()['format'](_0x18dd('0x29'))})});};exports[_0x18dd('0x2a')]=function(_0x20675b){return request(_0x18dd('0x2b'),{'body':_0x20675b});};exports[_0x18dd('0x2c')]=function(_0x130f32){return request(_0x18dd('0x2d'),{'body':_0x130f32});};exports[_0x18dd('0x2e')]=function(_0x3c8b9b){return request(_0x18dd('0x2f'),{'options':{'raw':![],'where':{'phone':_0x3c8b9b[_0x18dd('0x30')],'ListId':_0x3c8b9b[_0x18dd('0x31')]}}})[_0x18dd('0x6')](function(_0x95207c){if(_0x95207c){return _0x95207c;}return request(_0x18dd('0x32'),{'body':_0x3c8b9b});});};exports['getPauseById']=function(_0x553145){return request('ShowPause',{'options':{'where':{'id':_0x553145},'attributes':['name']}});};exports[_0x18dd('0x33')]=function(_0x487d01,_0x5658fe){return request(_0x18dd('0x34'),{'body':{'interface':_0x5658fe},'options':{'where':_0x487d01}});};exports[_0x18dd('0x35')]=function(_0x3998e8,_0x31632e,_0x43d9b6){return request('PauseUser',{'body':{'type':_0x31632e,'uniqueid':_0x43d9b6},'options':{'where':_0x3998e8}});};exports[_0x18dd('0x36')]=function(_0x3bae34){return request(_0x18dd('0x37'),{'body':{},'options':{'where':_0x3bae34}});};exports[_0x18dd('0x38')]=function(_0x2435a2){return request('LogoutUser',{'body':{},'options':{'where':_0x2435a2}});}; \ 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 cb6105c..4422ff6 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 _0x207c=['./lex','exports'];(function(_0x4990d5,_0xe2c486){var _0x275e25=function(_0x4de73e){while(--_0x4de73e){_0x4990d5['push'](_0x4990d5['shift']());}};_0x275e25(++_0xe2c486);}(_0x207c,0x1e8));var _0xc207=function(_0x50c50b,_0x3a6fb3){_0x50c50b=_0x50c50b-0x0;var _0x423c29=_0x207c[_0x50c50b];return _0x423c29;};var polly=require('./polly');var lex=require(_0xc207('0x0'));module[_0xc207('0x1')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0x579c=['./lex','exports','./polly'];(function(_0x10b317,_0x2adf32){var _0x1e3054=function(_0x38ed3e){while(--_0x38ed3e){_0x10b317['push'](_0x10b317['shift']());}};_0x1e3054(++_0x2adf32);}(_0x579c,0xda));var _0xc579=function(_0x53e51e,_0x416eaa){_0x53e51e=_0x53e51e-0x0;var _0x48c2fb=_0x579c[_0x53e51e];return _0x48c2fb;};var polly=require(_0xc579('0x0'));var lex=require(_0xc579('0x1'));module[_0xc579('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 c380047..56bc28d 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 _0xe57e=['./lib/api'];(function(_0x599eed,_0x2f0607){var _0x50a279=function(_0x3eab28){while(--_0x3eab28){_0x599eed['push'](_0x599eed['shift']());}};_0x50a279(++_0x2f0607);}(_0xe57e,0xf2));var _0xee57=function(_0x234472,_0x1c9717){_0x234472=_0x234472-0x0;var _0x3e1ad8=_0xe57e[_0x234472];return _0x3e1ad8;};'use strict';var lex=require(_0xee57('0x0'));module['exports']=function(_0xe45cd,_0xb8b97f,_0x336aaa,_0x59bb30,_0x5e53cc,_0x2dbc91){return lex(_0xe45cd,_0xb8b97f,_0x336aaa,_0x59bb30,_0x5e53cc,_0x2dbc91);}; \ No newline at end of file +var _0x19ea=['./lib/api'];(function(_0x381589,_0x27a707){var _0x2a075d=function(_0x4ea19d){while(--_0x4ea19d){_0x381589['push'](_0x381589['shift']());}};_0x2a075d(++_0x27a707);}(_0x19ea,0xfe));var _0xa19e=function(_0x515afd,_0x1a1e91){_0x515afd=_0x515afd-0x0;var _0x536d53=_0x19ea[_0x515afd];return _0x536d53;};'use strict';var lex=require(_0xa19e('0x0'));module['exports']=function(_0x49bcb5,_0x321054,_0x481228,_0x208e73,_0x12aefc,_0x3593a5){return lex(_0x49bcb5,_0x321054,_0x481228,_0x208e73,_0x12aefc,_0x3593a5);}; \ 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 7563c69..9f45291 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 _0x1aaf=['aws-sdk','postText','slots','slot_','$LATEST'];(function(_0x18f31b,_0x5f3a69){var _0x2e1c5b=function(_0x5e5733){while(--_0x5e5733){_0x18f31b['push'](_0x18f31b['shift']());}};_0x2e1c5b(++_0x5f3a69);}(_0x1aaf,0x1bd));var _0xf1aa=function(_0x237cb1,_0x2d6441){_0x237cb1=_0x237cb1-0x0;var _0x31481e=_0x1aaf[_0x237cb1];return _0x31481e;};'use strict';var BPromise=require('bluebird');var AWS=require(_0xf1aa('0x0'));function lexResult(_0x3f030d,_0x24ee90){return new BPromise(function(_0x1c79b4,_0xbdb2fc){_0x3f030d[_0xf1aa('0x1')](_0x24ee90,function(_0x5948ce,_0x15753f){if(_0x5948ce){_0xbdb2fc(_0x5948ce);}if(_0x15753f[_0xf1aa('0x2')]){for(const _0x5ccfec in _0x15753f[_0xf1aa('0x2')]){if(_0x15753f[_0xf1aa('0x2')]['hasOwnProperty'](_0x5ccfec)){var _0xcfa59c=_0x15753f['slots'][_0x5ccfec];_0x15753f[_0xf1aa('0x3')+_0x5ccfec]=_0xcfa59c;}}}_0x1c79b4(_0x15753f);});});}module['exports']=function(_0x48e076,_0x57cce8,_0x2f3fbb,_0x5baaa3,_0x43e280,_0x50f23a){var _0x179767=new AWS['LexRuntime']({'accessKeyId':_0x57cce8,'secretAccessKey':_0x2f3fbb,'region':_0x5baaa3});var _0xe3fd84={'botAlias':_0xf1aa('0x4'),'botName':_0x50f23a,'inputText':_0x43e280,'userId':_0x48e076};return lexResult(_0x179767,_0xe3fd84);}; \ No newline at end of file +var _0x3cd9=['aws-sdk','postText','slots','hasOwnProperty','slot_','$LATEST','bluebird'];(function(_0x1c03dc,_0x4d2b42){var _0x44bf5d=function(_0x49c43b){while(--_0x49c43b){_0x1c03dc['push'](_0x1c03dc['shift']());}};_0x44bf5d(++_0x4d2b42);}(_0x3cd9,0xc3));var _0x93cd=function(_0x5447aa,_0x3afc00){_0x5447aa=_0x5447aa-0x0;var _0xb21e53=_0x3cd9[_0x5447aa];return _0xb21e53;};'use strict';var BPromise=require(_0x93cd('0x0'));var AWS=require(_0x93cd('0x1'));function lexResult(_0x34edd4,_0x3ee251){return new BPromise(function(_0x2365a2,_0x5d6037){_0x34edd4[_0x93cd('0x2')](_0x3ee251,function(_0x1550bf,_0x59e8ba){if(_0x1550bf){_0x5d6037(_0x1550bf);}if(_0x59e8ba[_0x93cd('0x3')]){for(const _0x5f45e2 in _0x59e8ba[_0x93cd('0x3')]){if(_0x59e8ba[_0x93cd('0x3')][_0x93cd('0x4')](_0x5f45e2)){var _0x5460db=_0x59e8ba['slots'][_0x5f45e2];_0x59e8ba[_0x93cd('0x5')+_0x5f45e2]=_0x5460db;}}}_0x2365a2(_0x59e8ba);});});}module['exports']=function(_0x3568a3,_0x42b8b6,_0x3f1dc0,_0x538528,_0x2883a6,_0xd3e18e){var _0x22f83e=new AWS['LexRuntime']({'accessKeyId':_0x42b8b6,'secretAccessKey':_0x3f1dc0,'region':_0x538528});var _0x2b5a34={'botAlias':_0x93cd('0x6'),'botName':_0xd3e18e,'inputText':_0x2883a6,'userId':_0x3568a3};return lexResult(_0x22f83e,_0x2b5a34);}; \ 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 20a678a..6653aa4 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 _0xb7a9=['exports'];(function(_0x1113aa,_0x7ad99f){var _0x395973=function(_0x40dc50){while(--_0x40dc50){_0x1113aa['push'](_0x1113aa['shift']());}};_0x395973(++_0x7ad99f);}(_0xb7a9,0x16b));var _0x9b7a=function(_0x2a10fc,_0x13c886){_0x2a10fc=_0x2a10fc-0x0;var _0x3a3d72=_0xb7a9[_0x2a10fc];return _0x3a3d72;};'use strict';var polly=require('./lib/api');module[_0x9b7a('0x0')]=function(_0x324275,_0x41d7d9,_0x46e2a1,_0x1194ae,_0x1925d9,_0x3eed9e,_0x151a57){return polly(_0x324275,_0x41d7d9,_0x46e2a1,_0x1194ae,_0x1925d9,_0x3eed9e,_0x151a57);}; \ No newline at end of file +var _0xd79f=['./lib/api','exports'];(function(_0xd250ec,_0x446153){var _0x108b01=function(_0x3ce68f){while(--_0x3ce68f){_0xd250ec['push'](_0xd250ec['shift']());}};_0x108b01(++_0x446153);}(_0xd79f,0x1be));var _0xfd79=function(_0x2b62d3,_0x224adc){_0x2b62d3=_0x2b62d3-0x0;var _0xb03015=_0xd79f[_0x2b62d3];return _0xb03015;};'use strict';var polly=require(_0xfd79('0x0'));module[_0xfd79('0x1')]=function(_0x303124,_0x466a27,_0x38c047,_0x2e43bc,_0x350e6f,_0x39c101,_0x514748){return polly(_0x303124,_0x466a27,_0x38c047,_0x2e43bc,_0x350e6f,_0x39c101,_0x514748);}; \ 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 9334c39..09e2299 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 _0xa484=['writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','text','path','bluebird','randomstring','aws-sdk','synthesizeSpeech','AudioStream'];(function(_0xac3328,_0x23745a){var _0x33aec4=function(_0x476d1a){while(--_0x476d1a){_0xac3328['push'](_0xac3328['shift']());}};_0x33aec4(++_0x23745a);}(_0xa484,0x1e6));var _0x4a48=function(_0x4d9c81,_0x63c739){_0x4d9c81=_0x4d9c81-0x0;var _0x16539d=_0xa484[_0x4d9c81];return _0x16539d;};'use strict';var fs=require('fs');var path=require(_0x4a48('0x0'));var BPromise=require(_0x4a48('0x1'));var rs=require(_0x4a48('0x2'));var AWS=require(_0x4a48('0x3'));function pollyResult(_0x1044e3,_0x35bb50,_0x14f8cc){return new BPromise(function(_0x27a236,_0x4418f4){_0x1044e3[_0x4a48('0x4')](_0x35bb50,function(_0x30520a,_0x521dd8){if(_0x30520a){_0x4418f4(_0x30520a);}else if(_0x521dd8){if(_0x521dd8[_0x4a48('0x5')]instanceof Buffer){fs[_0x4a48('0x6')](_0x14f8cc,_0x521dd8[_0x4a48('0x5')],function(_0x4031e4){if(_0x4031e4){_0x4418f4(_0x4031e4);}else{_0x27a236();}});}else{_0x4418f4(new Error(_0x4a48('0x7')));}}else{_0x4418f4(new Error(_0x4a48('0x8')));}});});}module[_0x4a48('0x9')]=function(_0x38ede3,_0x39bfbb,_0x255978,_0x45772e,_0x148a1b,_0x5aaa09,_0xfcdf9a){var _0x118957=new AWS[(_0x4a48('0xa'))]({'accessKeyId':_0x38ede3,'secretAccessKey':_0x39bfbb,'region':_0x255978});var _0x337fea={'Text':_0x148a1b,'TextType':_0x5aaa09||_0x4a48('0xb'),'OutputFormat':'mp3','VoiceId':_0x45772e};return pollyResult(_0x118957,_0x337fea,_0xfcdf9a);}; \ No newline at end of file +var _0xb97d=['Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','Polly','text','mp3','path','bluebird','randomstring','aws-sdk','synthesizeSpeech','AudioStream'];(function(_0x138f59,_0x1b53fb){var _0x3d114d=function(_0x1f9461){while(--_0x1f9461){_0x138f59['push'](_0x138f59['shift']());}};_0x3d114d(++_0x1b53fb);}(_0xb97d,0x191));var _0xdb97=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0xb97d[_0x1ddedd];return _0xa3e1ac;};'use strict';var fs=require('fs');var path=require(_0xdb97('0x0'));var BPromise=require(_0xdb97('0x1'));var rs=require(_0xdb97('0x2'));var AWS=require(_0xdb97('0x3'));function pollyResult(_0x36da4f,_0x1f40ee,_0x1f061c){return new BPromise(function(_0x551a70,_0x4f8bc2){_0x36da4f[_0xdb97('0x4')](_0x1f40ee,function(_0x49b784,_0x53daad){if(_0x49b784){_0x4f8bc2(_0x49b784);}else if(_0x53daad){if(_0x53daad['AudioStream']instanceof Buffer){fs['writeFile'](_0x1f061c,_0x53daad[_0xdb97('0x5')],function(_0x1de09d){if(_0x1de09d){_0x4f8bc2(_0x1de09d);}else{_0x551a70();}});}else{_0x4f8bc2(new Error(_0xdb97('0x6')));}}else{_0x4f8bc2(new Error(_0xdb97('0x7')));}});});}module['exports']=function(_0x5cb9bf,_0x3177ef,_0x2e1b92,_0x14b290,_0x5ade30,_0x49cb66,_0x1837b2){var _0x403f87=new AWS[(_0xdb97('0x8'))]({'accessKeyId':_0x5cb9bf,'secretAccessKey':_0x3177ef,'region':_0x2e1b92});var _0x30b12f={'Text':_0x5ade30,'TextType':_0x49cb66||_0xdb97('0x9'),'OutputFormat':_0xdb97('0xa'),'VoiceId':_0x14b290};return pollyResult(_0x403f87,_0x30b12f,_0x1837b2);}; \ 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 987a9f0..a18bf7d 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 _0xdcec=['./lib/api'];(function(_0x4c7e43,_0x44419e){var _0x5c55a9=function(_0x565e9e){while(--_0x565e9e){_0x4c7e43['push'](_0x4c7e43['shift']());}};_0x5c55a9(++_0x44419e);}(_0xdcec,0x95));var _0xcdce=function(_0x23e7c1,_0x35110c){_0x23e7c1=_0x23e7c1-0x0;var _0x1add43=_0xdcec[_0x23e7c1];return _0x1add43;};'use strict';var asr=require(_0xcdce('0x0'));module['exports']=function(_0x1d2252,_0x185fd0,_0x3cc9d2,_0xa8467b){return asr(_0x1d2252,_0x185fd0,_0x3cc9d2);}; \ No newline at end of file +var _0x52e7=['exports','./lib/api'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x52e7,0xc7));var _0x752e=function(_0x480fc2,_0x482fba){_0x480fc2=_0x480fc2-0x0;var _0x540a95=_0x52e7[_0x480fc2];return _0x540a95;};'use strict';var asr=require(_0x752e('0x0'));module[_0x752e('0x1')]=function(_0xe6c91a,_0x49ce28,_0x478e8c,_0xbcc952){return asr(_0xe6c91a,_0x49ce28,_0x478e8c);}; \ 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 6f08846..0936dcd 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 _0x17aa=['https://speech.googleapis.com','exports','string','length','filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','readFileSync','toString','base64','/v1/speech:recognize?key=','LINEAR16','8000','url','bluebird'];(function(_0x5d933e,_0x33dfa0){var _0x2eab6c=function(_0x5b3b4a){while(--_0x5b3b4a){_0x5d933e['push'](_0x5d933e['shift']());}};_0x2eab6c(++_0x33dfa0);}(_0x17aa,0x7e));var _0xa17a=function(_0x2d0fcc,_0x402049){_0x2d0fcc=_0x2d0fcc-0x0;var _0x53ce44=_0x17aa[_0x2d0fcc];return _0x53ce44;};'use strict';var url=require(_0xa17a('0x0'));var BPromise=require(_0xa17a('0x1'));var fs=require('fs');var host=_0xa17a('0x2');module[_0xa17a('0x3')]=function(_0x1cca30,_0xadf198,_0x337965){return new BPromise(function(_0x2d7b13,_0x4f4b77){var _0x2ea3a7;if(typeof _0x1cca30!==_0xa17a('0x4')||_0x1cca30[_0xa17a('0x5')]===0x0){return _0x4f4b77(_0xa17a('0x6'));}if(typeof _0xadf198!=='string'||_0xadf198[_0xa17a('0x5')]===0x0){return _0x4f4b77(_0xa17a('0x7'));}if(typeof _0x337965!==_0xa17a('0x8')&&(typeof _0x337965!==_0xa17a('0x4')||_0x337965[_0xa17a('0x5')]===0x0)){return _0x4f4b77(_0xa17a('0x9'));}try{_0x2ea3a7=fs[_0xa17a('0xa')](_0x1cca30)[_0xa17a('0xb')](_0xa17a('0xc'));}catch(_0x3715e4){return _0x4f4b77(_0x3715e4);}return _0x2d7b13({'method':'POST','uri':host+_0xa17a('0xd')+_0xadf198,'body':{'config':{'encoding':_0xa17a('0xe'),'sampleRateHertz':_0xa17a('0xf'),'languageCode':_0x337965},'audio':{'content':_0x2ea3a7}},'json':!![]});});}; \ No newline at end of file +var _0xb5d7=['exports','string','length','filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','toString','POST','/v1/speech:recognize?key=','LINEAR16','8000','url','https://speech.googleapis.com'];(function(_0x1c69a7,_0x539bb0){var _0x281dcd=function(_0x55ba96){while(--_0x55ba96){_0x1c69a7['push'](_0x1c69a7['shift']());}};_0x281dcd(++_0x539bb0);}(_0xb5d7,0xb4));var _0x7b5d=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0xb5d7[_0x2d7f0e];return _0x110b07;};'use strict';var url=require(_0x7b5d('0x0'));var BPromise=require('bluebird');var fs=require('fs');var host=_0x7b5d('0x1');module[_0x7b5d('0x2')]=function(_0x530ca0,_0x469809,_0x4d55bb){return new BPromise(function(_0x490f73,_0x27e368){var _0x1b061f;if(typeof _0x530ca0!==_0x7b5d('0x3')||_0x530ca0[_0x7b5d('0x4')]===0x0){return _0x27e368(_0x7b5d('0x5'));}if(typeof _0x469809!==_0x7b5d('0x3')||_0x469809['length']===0x0){return _0x27e368(_0x7b5d('0x6'));}if(typeof _0x4d55bb!==_0x7b5d('0x7')&&(typeof _0x4d55bb!==_0x7b5d('0x3')||_0x4d55bb[_0x7b5d('0x4')]===0x0)){return _0x27e368(_0x7b5d('0x8'));}try{_0x1b061f=fs['readFileSync'](_0x530ca0)[_0x7b5d('0x9')]('base64');}catch(_0x16c3b1){return _0x27e368(_0x16c3b1);}return _0x490f73({'method':_0x7b5d('0xa'),'uri':host+_0x7b5d('0xb')+_0x469809,'body':{'config':{'encoding':_0x7b5d('0xc'),'sampleRateHertz':_0x7b5d('0xd'),'languageCode':_0x4d55bb},'audio':{'content':_0x1b061f}},'json':!![]});});}; \ No newline at end of file diff --git a/server/services/agi/scripts/google/index.js b/server/services/agi/scripts/google/index.js index f2e953c..e942d12 100644 --- a/server/services/agi/scripts/google/index.js +++ b/server/services/agi/scripts/google/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8917=['./asr','exports'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x8917,0xc8));var _0x7891=function(_0x29d861,_0xbc39a2){_0x29d861=_0x29d861-0x0;var _0x223f53=_0x8917[_0x29d861];return _0x223f53;};var asr=require(_0x7891('0x0'));module[_0x7891('0x1')]={'asr':asr}; \ No newline at end of file +var _0x5f60=['exports'];(function(_0x546af9,_0x5b49cf){var _0xfdcffa=function(_0x40d3f8){while(--_0x40d3f8){_0x546af9['push'](_0x546af9['shift']());}};_0xfdcffa(++_0x5b49cf);}(_0x5f60,0x134));var _0x05f6=function(_0x41a073,_0x3ea9e2){_0x41a073=_0x41a073-0x0;var _0x4b2c53=_0x5f60[_0x41a073];return _0x4b2c53;};var asr=require('./asr');module[_0x05f6('0x0')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/scripts/index.js b/server/services/agi/scripts/index.js index 01b9e5c..e2257e1 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 _0x5401=['readFileSync','toString','base64','googleCloudTTS','https://texttospeech.googleapis.com/v1/','ssml','input','voice','audioConfig','MP3','POST','.mp3','from','writeFile','resolve','chmodSync','googleCloudTTS\x20path','goggleTTS\x20path','uri','results','alternatives','transcript','map','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s','message','googleDialogflow','textRequest','result','source','resolvedQuery','actionIncomplete','fulfillment','score','status','code','metadata','endConversation','isFallbackIntent','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','polly','awsLex','lex','stringify','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','freeform=3','parse','sestekNDA','nda','channelData','CustomAction','AudioFromTts','Data','dirName','path','http','https','url','bluebird','randomstring','request-promise','querystring','google-tts-api','apiai-promise','md5','./google','./tilde','./sestek','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','https:','host','get','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','info','finish\x20download\x20file','close','error','download\x20error','end','WHAT_EVER','statusCode','data','wav','error\x20convert','finish\x20to\x20convert','tmp','generate','.wav','writeFileSync','then','unlink','777','split'];(function(_0x3c4f40,_0x302e0b){var _0x12032f=function(_0x159d92){while(--_0x159d92){_0x3c4f40['push'](_0x3c4f40['shift']());}};_0x12032f(++_0x302e0b);}(_0x5401,0x1f0));var _0x1540=function(_0x4a4e87,_0x485791){_0x4a4e87=_0x4a4e87-0x0;var _0x83444f=_0x5401[_0x4a4e87];return _0x83444f;};'use strict';var fs=require('fs');var path=require(_0x1540('0x0'));var http=require(_0x1540('0x1'));var https=require(_0x1540('0x2'));var urlParse=require(_0x1540('0x3'))['parse'];var BPromise=require(_0x1540('0x4'));var rs=require(_0x1540('0x5'));var sox=require('sox');var rp=require(_0x1540('0x6'));var util=require('util');var querystring=require(_0x1540('0x7'));var tts=require(_0x1540('0x8'));var apiai=require(_0x1540('0x9'));var md5=require(_0x1540('0xa'));var google=require(_0x1540('0xb'));var aws=require('./aws');var tilde=require(_0x1540('0xc'));var sestek=require(_0x1540('0xd'));var logger=require(_0x1540('0xe'))(_0x1540('0xf'));var ISPEECH_API=_0x1540('0x10');function downloadFile(_0x17f1ca,_0x473dc0){return new BPromise(function(_0x5ded9e,_0x115804){var _0x1f680e=urlParse(_0x17f1ca);var _0x5d2ba3=_0x1f680e[_0x1540('0x11')]===_0x1540('0x12')?https:http;var _0x1b201f={'host':_0x1f680e[_0x1540('0x13')],'path':_0x1f680e[_0x1540('0x0')],'headers':{'user-agent':'WHAT_EVER'}};_0x5d2ba3[_0x1540('0x14')](_0x1b201f,function(_0x2abecf){if(_0x2abecf['statusCode']!==0xc8){logger['error'](_0x1540('0x15')+_0x17f1ca+_0x1540('0x16')+_0x2abecf['statusCode']+'\x20('+_0x2abecf[_0x1540('0x17')]+')');_0x115804(new Error(_0x1540('0x15')+_0x17f1ca+_0x1540('0x16')+_0x2abecf['statusCode']+'\x20('+_0x2abecf[_0x1540('0x17')]+')'));return;}var _0x2b55de=fs['createWriteStream'](_0x473dc0);_0x2b55de['on']('finish',function(){logger[_0x1540('0x18')](_0x1540('0x19'));_0x2b55de[_0x1540('0x1a')](_0x5ded9e);});_0x2b55de['on']('error',function(_0x2d4994){fs['unlink'](_0x473dc0);logger[_0x1540('0x1b')](_0x1540('0x1c'),_0x2d4994);_0x115804(_0x2d4994);});_0x2abecf['pipe'](_0x2b55de);})['on'](_0x1540('0x1b'),function(_0x44fa47){logger[_0x1540('0x1b')](_0x44fa47);_0x115804(_0x44fa47);})[_0x1540('0x1d')]();});}function uploadFile(_0x4f7a61){return new BPromise(function(_0x573a4c,_0x225d65){var _0x59cf8e=urlParse(_0x4f7a61);var _0x49489b=_0x59cf8e[_0x1540('0x11')]===_0x1540('0x12')?https:http;var _0x5760cb={'host':_0x59cf8e[_0x1540('0x13')],'path':_0x59cf8e[_0x1540('0x0')],'headers':{'user-agent':_0x1540('0x1e')}};_0x49489b['get'](_0x5760cb,function(_0x4fcfcf){if(_0x4fcfcf[_0x1540('0x1f')]!==0xc8){_0x225d65(new Error(_0x1540('0x15')+_0x4f7a61+_0x1540('0x16')+_0x4fcfcf['statusCode']+'\x20('+_0x4fcfcf[_0x1540('0x17')]+')'));return;}var _0x505dd3='';_0x4fcfcf['on'](_0x1540('0x20'),function(_0x2b4261){_0x505dd3+=_0x2b4261;});_0x4fcfcf['on'](_0x1540('0x1d'),function(){_0x573a4c(_0x505dd3);});})['on'](_0x1540('0x1b'),function(_0x281ce5){_0x225d65(_0x281ce5);})[_0x1540('0x1d')]();});}function convertFile(_0x16ff15,_0x477179){return new BPromise(function(_0x544e2d,_0x2caf01){var _0xbe7085=sox['transcode'](_0x16ff15,_0x477179,{'sampleRate':0x1f40,'format':_0x1540('0x21'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0xbe7085['on'](_0x1540('0x1b'),function(_0x240479){logger[_0x1540('0x1b')](_0x1540('0x22'),_0x240479);_0x2caf01(_0x240479);});_0xbe7085['on'](_0x1540('0x1d'),function(){logger['info'](_0x1540('0x23'));_0x544e2d();});_0xbe7085['start']();});}function base64Decode(_0x2b5b51,_0x416dac){var _0x1106b0=path['resolve'](__dirname,_0x1540('0x24'),rs[_0x1540('0x25')](0x4)+_0x1540('0x26'));fs[_0x1540('0x27')](_0x1106b0,_0x2b5b51,'base64');return convertFile(_0x1106b0,_0x416dac)[_0x1540('0x28')](function(){try{fs[_0x1540('0x29')](_0x1106b0);fs['chmodSync'](_0x416dac,_0x1540('0x2a'));}catch(_0x5c9118){logger[_0x1540('0x1b')](_0x5c9118);}return _0x416dac[_0x1540('0x2b')]('.')[0x0];});}function base64Encode(_0x429a32){var _0xb9ce7b=fs[_0x1540('0x2c')](_0x429a32);return new Buffer(_0xb9ce7b)[_0x1540('0x2d')](_0x1540('0x2e'));}exports[_0x1540('0x2f')]=function(_0x2d79de,_0x48ea85,_0x5629de,_0x42b320,_0x16e9fc,_0x1c4dcf){var _0x21c2a1,_0x52ab2e;var _0x5a7761=_0x1540('0x30');var _0x3f525b='?key='+_0x2d79de;var _0xbe6704={};if(_0x48ea85===_0x1540('0x31')){_0xbe6704[_0x1540('0x32')]={'ssml':_0x5629de};}else{_0xbe6704[_0x1540('0x32')]={'text':_0x5629de};};_0xbe6704[_0x1540('0x33')]={'languageCode':_0x42b320,'ssmlGender':_0x16e9fc};_0xbe6704[_0x1540('0x34')]={'audioEncoding':_0x1540('0x35'),'sampleRateHertz':0x1f40};var _0x4c1d3e={'url':_0x5a7761+'text:synthesize'+_0x3f525b,'method':_0x1540('0x36'),'json':!![],'body':_0xbe6704};return rp(_0x4c1d3e)[_0x1540('0x28')](function(_0x4b503b){return new BPromise(function(_0x497b20,_0x388c6f){_0x21c2a1=path['resolve'](__dirname,_0x1540('0x24'),rs[_0x1540('0x25')](0x4)+_0x1540('0x37'));var _0x58c54a=Buffer[_0x1540('0x38')](_0x4b503b['audioContent'],'base64');return fs[_0x1540('0x39')](_0x21c2a1,_0x58c54a,function(_0xcd3817){_0x388c6f(_0xcd3817);},function(_0x41c143){fs['chmodSync'](_0x21c2a1,_0x1540('0x2a'));_0x497b20(_0x41c143);});});})['then'](function(_0x529eff){_0x52ab2e=path[_0x1540('0x3a')](__dirname,_0x1540('0x24'),rs[_0x1540('0x25')](0x4)+_0x1540('0x26'));return convertFile(_0x21c2a1,_0x52ab2e);})[_0x1540('0x28')](function(){try{fs[_0x1540('0x29')](_0x21c2a1);fs[_0x1540('0x3b')](_0x52ab2e,'777');}catch(_0x53e7c2){logger[_0x1540('0x1b')](_0x53e7c2);}logger[_0x1540('0x18')](_0x1540('0x3c'),_0x52ab2e[_0x1540('0x2b')]('.')[0x0]);return _0x52ab2e['split']('.')[0x0];});};exports['googleTTS']=function(_0x304777,_0x1316d3){var _0x414865,_0x348681;return tts(_0x304777,_0x1316d3||'en',0x1)[_0x1540('0x28')](function(_0x26aec4){logger[_0x1540('0x18')](_0x26aec4);_0x414865=path['resolve'](__dirname,_0x1540('0x24'),rs['generate'](0x4)+_0x1540('0x37'));return downloadFile(_0x26aec4,_0x414865);})['then'](function(){_0x348681=path[_0x1540('0x3a')](__dirname,_0x1540('0x24'),rs[_0x1540('0x25')](0x4)+_0x1540('0x26'));return convertFile(_0x414865,_0x348681);})['then'](function(){try{fs[_0x1540('0x29')](_0x414865);fs[_0x1540('0x3b')](_0x348681,_0x1540('0x2a'));}catch(_0x5223e2){logger[_0x1540('0x1b')](_0x5223e2);}logger['info'](_0x1540('0x3d'),_0x348681['split']('.')[0x0]);return _0x348681[_0x1540('0x2b')]('.')[0x0];});};exports['googleASR']=function(_0x58a54d,_0x2388cb,_0xc5d4e3){return google['asr'](_0x58a54d,_0x2388cb,_0xc5d4e3)[_0x1540('0x28')](function(_0x5205e9){logger[_0x1540('0x18')](_0x5205e9[_0x1540('0x3e')]);return rp(_0x5205e9);})['then'](function(_0x222bfb){var _0x343ff6='';var _0x42a251=0x0;try{fs[_0x1540('0x29')](_0x58a54d);}catch(_0x3f1e50){logger[_0x1540('0x1b')](_0x3f1e50);}if(_0x222bfb&&_0x222bfb[_0x1540('0x3f')]){_0x343ff6=_0x222bfb[_0x1540('0x3f')]['map'](function(_0x4ecaa4){return _0x4ecaa4&&_0x4ecaa4[_0x1540('0x40')][0x0]&&_0x4ecaa4[_0x1540('0x40')][0x0][_0x1540('0x41')]?_0x4ecaa4[_0x1540('0x40')][0x0][_0x1540('0x41')]:'';})['join']('\x0a');_0x42a251=_0x222bfb['results'][_0x1540('0x42')](function(_0x3954e2){return _0x3954e2&&_0x3954e2['alternatives'][0x0]&&_0x3954e2[_0x1540('0x40')][0x0]['confidence']?_0x3954e2[_0x1540('0x40')][0x0][_0x1540('0x43')]:0x0;})['join']('\x0a');}logger['info'](_0x1540('0x44'),_0x343ff6);logger[_0x1540('0x18')](_0x1540('0x45'),_0x42a251);return{'transcript':_0x343ff6,'confidence':_0x42a251};})[_0x1540('0x46')](function(_0x201bf0){logger[_0x1540('0x1b')](_0x1540('0x47'),_0x201bf0[_0x1540('0x1f')],_0x201bf0['name'],_0x201bf0[_0x1540('0x48')]);});};exports[_0x1540('0x49')]=function(_0x5188f2,_0x57529c,_0x44a8e8,_0xf50fff){var _0x3ad6f6=apiai(_0x57529c,{'language':_0xf50fff||'en'});return _0x3ad6f6[_0x1540('0x4a')](_0x44a8e8,{'sessionId':md5(_0x5188f2)})[_0x1540('0x28')](function(_0x2e737d){logger[_0x1540('0x18')](JSON['stringify'](_0x2e737d));return{'source':_0x2e737d[_0x1540('0x4b')][_0x1540('0x4c')],'resolvedQuery':_0x2e737d[_0x1540('0x4b')][_0x1540('0x4d')],'action':_0x2e737d[_0x1540('0x4b')]['action'],'actionIncomplete':_0x2e737d[_0x1540('0x4b')][_0x1540('0x4e')],'speech':_0x2e737d[_0x1540('0x4b')][_0x1540('0x4f')]['speech'],'score':_0x2e737d['result'][_0x1540('0x50')],'statusCode':_0x2e737d[_0x1540('0x51')][_0x1540('0x52')],'endConversation':_0x2e737d[_0x1540('0x4b')][_0x1540('0x53')][_0x1540('0x54')]||![],'isFallbackIntent':_0x2e737d[_0x1540('0x4b')][_0x1540('0x53')][_0x1540('0x55')]};});};exports[_0x1540('0x56')]=function(_0x956acb,_0x4a9d8a,_0x403def,_0x396590){return tilde['asr'](_0x956acb,_0x4a9d8a,_0x403def,_0x396590)[_0x1540('0x28')](function(_0x53e77b){try{fs[_0x1540('0x29')](_0x956acb);}catch(_0x258193){logger[_0x1540('0x1b')](_0x258193);}logger[_0x1540('0x18')](_0x1540('0x57'),_0x53e77b[_0x1540('0x41')]);logger[_0x1540('0x18')](_0x1540('0x58'),_0x53e77b['confidence']);return _0x53e77b;});};exports[_0x1540('0x59')]=function(_0x22393c,_0x492b0d,_0xdd2e89,_0x41b480,_0x9a1551,_0x4b477d){var _0x359082=path[_0x1540('0x3a')](__dirname,'tmp',rs[_0x1540('0x25')](0x4)+_0x1540('0x37'));var _0x441763;return aws[_0x1540('0x5a')](_0x22393c,_0x492b0d,_0xdd2e89,_0x41b480,_0x9a1551,_0x4b477d,_0x359082)[_0x1540('0x28')](function(){_0x441763=path[_0x1540('0x3a')](__dirname,'tmp',rs[_0x1540('0x25')](0x4)+_0x1540('0x26'));return convertFile(_0x359082,_0x441763);})[_0x1540('0x28')](function(){try{fs[_0x1540('0x29')](_0x359082);fs[_0x1540('0x3b')](_0x441763,_0x1540('0x2a'));}catch(_0x119f30){logger[_0x1540('0x1b')](_0x119f30);}return _0x441763[_0x1540('0x2b')]('.')[0x0];});};exports[_0x1540('0x5b')]=function(_0x312e74,_0x394137,_0x4b5211,_0x5c838f,_0x28011b,_0xcd45b7){return aws[_0x1540('0x5c')](_0x312e74,_0x394137,_0x4b5211,_0x5c838f,_0x28011b,_0xcd45b7)[_0x1540('0x28')](function(_0x4b0f63){logger[_0x1540('0x18')](JSON[_0x1540('0x5d')](_0x4b0f63));return _0x4b0f63;});};exports[_0x1540('0x5e')]=function(_0x13ca53,_0x315af7,_0x53a2da,_0x1a8dbf){var _0x3c1e80=util[_0x1540('0x5f')](_0x1540('0x60'),ISPEECH_API,_0x13ca53,encodeURIComponent(_0x315af7),_0x53a2da,_0x1a8dbf);var _0x5b2df6=path['resolve'](__dirname,_0x1540('0x24'),rs['generate'](0x4)+_0x1540('0x37'));var _0x16c6f7;return downloadFile(_0x3c1e80,_0x5b2df6)['then'](function(){_0x16c6f7=path[_0x1540('0x3a')](__dirname,'tmp',rs['generate'](0x4)+'.wav');return convertFile(_0x5b2df6,_0x16c6f7);})[_0x1540('0x28')](function(){try{fs[_0x1540('0x29')](_0x5b2df6);fs[_0x1540('0x3b')](_0x16c6f7,'777');}catch(_0x670cf9){logger['error'](_0x670cf9);}return _0x16c6f7[_0x1540('0x2b')]('.')[0x0];});};exports[_0x1540('0x61')]=function(_0x196f9c,_0x4a7898,_0xb1e0ce,_0x37d3e1){var _0x195898=util[_0x1540('0x5f')](_0x1540('0x62'),ISPEECH_API,_0x4a7898,_0xb1e0ce,base64Encode(_0x196f9c),_0x37d3e1?util[_0x1540('0x5f')]('model=%s',encodeURIComponent(_0x37d3e1)):_0x1540('0x63'));return uploadFile(_0x195898)[_0x1540('0x28')](function(_0x4a1c4a){return querystring[_0x1540('0x64')](_0x4a1c4a);});};exports[_0x1540('0x65')]=function(_0x57844e,_0x4902f3){return sestek[_0x1540('0x66')](_0x57844e,_0x4902f3)['then'](function(_0x23eb00){logger[_0x1540('0x18')](JSON['stringify'](_0x23eb00));var _0x6439f={'speech':_0x23eb00['text'],'action':_0x23eb00['channelData']?_0x23eb00[_0x1540('0x67')][_0x1540('0x68')]:undefined,'actiondata':_0x23eb00[_0x1540('0x67')]?_0x23eb00[_0x1540('0x67')]['CustomActionData']:undefined};if(_0x23eb00[_0x1540('0x67')]&&_0x23eb00[_0x1540('0x67')][_0x1540('0x69')]){return base64Decode(_0x23eb00[_0x1540('0x67')][_0x1540('0x69')][_0x1540('0x6a')],path[_0x1540('0x3a')](__dirname,_0x1540('0x24'),rs['generate'](0x4)+_0x1540('0x26')))[_0x1540('0x28')](function(_0x175c95){_0x6439f['audiofile']=_0x175c95;return _0x6439f;});}return _0x6439f;});};exports[_0x1540('0x6b')]=function(){return __dirname;}; \ No newline at end of file +var _0x8af6=['https://api.ispeech.org/api/rest','protocol','https:','host','path','WHAT_EVER','get','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusCode','createWriteStream','finish\x20download\x20file','close','unlink','download\x20error','pipe','end','statusMessage','data','transcode','error\x20convert','info','start','.wav','writeFileSync','base64','then','chmodSync','split','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','voice','audioConfig','MP3','text:synthesize','POST','generate','.mp3','from','writeFile','777','resolve','tmp','googleCloudTTS\x20path','googleTTS','goggleTTS\x20path','googleASR','asr','uri','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription','googleASR\x20confidence','[%s]\x20%s:%s','name','message','googleDialogflow','stringify','result','resolvedQuery','fulfillment','speech','status','code','metadata','endConversation','isFallbackIntent','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','awsLex','ispeechTTS','format','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','sestekNDA','nda','text','channelData','CustomAction','CustomActionData','AudioFromTts','audiofile','dirName','http','https','parse','randomstring','sox','request-promise','google-tts-api','apiai-promise','md5','./google','./sestek','../../../config/logger','agi'];(function(_0xc10025,_0x4430d9){var _0xb1e20d=function(_0x1a70d6){while(--_0x1a70d6){_0xc10025['push'](_0xc10025['shift']());}};_0xb1e20d(++_0x4430d9);}(_0x8af6,0x19f));var _0x68af=function(_0x24c00a,_0x274bce){_0x24c00a=_0x24c00a-0x0;var _0x59c5fd=_0x8af6[_0x24c00a];return _0x59c5fd;};'use strict';var fs=require('fs');var path=require('path');var http=require(_0x68af('0x0'));var https=require(_0x68af('0x1'));var urlParse=require('url')[_0x68af('0x2')];var BPromise=require('bluebird');var rs=require(_0x68af('0x3'));var sox=require(_0x68af('0x4'));var rp=require(_0x68af('0x5'));var util=require('util');var querystring=require('querystring');var tts=require(_0x68af('0x6'));var apiai=require(_0x68af('0x7'));var md5=require(_0x68af('0x8'));var google=require(_0x68af('0x9'));var aws=require('./aws');var tilde=require('./tilde');var sestek=require(_0x68af('0xa'));var logger=require(_0x68af('0xb'))(_0x68af('0xc'));var ISPEECH_API=_0x68af('0xd');function downloadFile(_0x4b19cd,_0x528cc1){return new BPromise(function(_0x3e492c,_0x35b512){var _0x5dc92c=urlParse(_0x4b19cd);var _0x23c01e=_0x5dc92c[_0x68af('0xe')]===_0x68af('0xf')?https:http;var _0x39b614={'host':_0x5dc92c[_0x68af('0x10')],'path':_0x5dc92c[_0x68af('0x11')],'headers':{'user-agent':_0x68af('0x12')}};_0x23c01e[_0x68af('0x13')](_0x39b614,function(_0x179613){if(_0x179613['statusCode']!==0xc8){logger[_0x68af('0x14')](_0x68af('0x15')+_0x4b19cd+_0x68af('0x16')+_0x179613[_0x68af('0x17')]+'\x20('+_0x179613['statusMessage']+')');_0x35b512(new Error(_0x68af('0x15')+_0x4b19cd+_0x68af('0x16')+_0x179613[_0x68af('0x17')]+'\x20('+_0x179613['statusMessage']+')'));return;}var _0xf6c445=fs[_0x68af('0x18')](_0x528cc1);_0xf6c445['on']('finish',function(){logger['info'](_0x68af('0x19'));_0xf6c445[_0x68af('0x1a')](_0x3e492c);});_0xf6c445['on']('error',function(_0x19571c){fs[_0x68af('0x1b')](_0x528cc1);logger['error'](_0x68af('0x1c'),_0x19571c);_0x35b512(_0x19571c);});_0x179613[_0x68af('0x1d')](_0xf6c445);})['on'](_0x68af('0x14'),function(_0x17c644){logger[_0x68af('0x14')](_0x17c644);_0x35b512(_0x17c644);})[_0x68af('0x1e')]();});}function uploadFile(_0x4addcf){return new BPromise(function(_0x1ef062,_0x36b915){var _0x47fbe4=urlParse(_0x4addcf);var _0x36b42e=_0x47fbe4['protocol']===_0x68af('0xf')?https:http;var _0x5bf332={'host':_0x47fbe4[_0x68af('0x10')],'path':_0x47fbe4['path'],'headers':{'user-agent':_0x68af('0x12')}};_0x36b42e['get'](_0x5bf332,function(_0x5e8a46){if(_0x5e8a46[_0x68af('0x17')]!==0xc8){_0x36b915(new Error(_0x68af('0x15')+_0x4addcf+_0x68af('0x16')+_0x5e8a46[_0x68af('0x17')]+'\x20('+_0x5e8a46[_0x68af('0x1f')]+')'));return;}var _0x29f04e='';_0x5e8a46['on'](_0x68af('0x20'),function(_0x14cc5f){_0x29f04e+=_0x14cc5f;});_0x5e8a46['on'](_0x68af('0x1e'),function(){_0x1ef062(_0x29f04e);});})['on'](_0x68af('0x14'),function(_0x43629d){_0x36b915(_0x43629d);})[_0x68af('0x1e')]();});}function convertFile(_0x4ef4ee,_0x53d0bf){return new BPromise(function(_0x24c1ed,_0x2707a2){var _0x1994b2=sox[_0x68af('0x21')](_0x4ef4ee,_0x53d0bf,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x1994b2['on'](_0x68af('0x14'),function(_0x22e77a){logger[_0x68af('0x14')](_0x68af('0x22'),_0x22e77a);_0x2707a2(_0x22e77a);});_0x1994b2['on'](_0x68af('0x1e'),function(){logger[_0x68af('0x23')]('finish\x20to\x20convert');_0x24c1ed();});_0x1994b2[_0x68af('0x24')]();});}function base64Decode(_0x3a224a,_0x415770){var _0x30f410=path['resolve'](__dirname,'tmp',rs['generate'](0x4)+_0x68af('0x25'));fs[_0x68af('0x26')](_0x30f410,_0x3a224a,_0x68af('0x27'));return convertFile(_0x30f410,_0x415770)[_0x68af('0x28')](function(){try{fs[_0x68af('0x1b')](_0x30f410);fs[_0x68af('0x29')](_0x415770,'777');}catch(_0x325eb7){logger['error'](_0x325eb7);}return _0x415770[_0x68af('0x2a')]('.')[0x0];});}function base64Encode(_0x3c5b61){var _0x3896e5=fs['readFileSync'](_0x3c5b61);return new Buffer(_0x3896e5)[_0x68af('0x2b')](_0x68af('0x27'));}exports[_0x68af('0x2c')]=function(_0x5ac88e,_0x1eb4eb,_0x49c9a7,_0x80932e,_0x5020f5,_0x51a67c){var _0x9ae67e,_0x458149;var _0x2f6221=_0x68af('0x2d');var _0x26c968=_0x68af('0x2e')+_0x5ac88e;var _0x23a2d9={};if(_0x1eb4eb===_0x68af('0x2f')){_0x23a2d9[_0x68af('0x30')]={'ssml':_0x49c9a7};}else{_0x23a2d9[_0x68af('0x30')]={'text':_0x49c9a7};};_0x23a2d9[_0x68af('0x31')]={'languageCode':_0x80932e,'ssmlGender':_0x5020f5};_0x23a2d9[_0x68af('0x32')]={'audioEncoding':_0x68af('0x33'),'sampleRateHertz':0x1f40};var _0x9035ed={'url':_0x2f6221+_0x68af('0x34')+_0x26c968,'method':_0x68af('0x35'),'json':!![],'body':_0x23a2d9};return rp(_0x9035ed)[_0x68af('0x28')](function(_0x2e61a3){return new BPromise(function(_0x140e09,_0x35d5fd){_0x9ae67e=path['resolve'](__dirname,'tmp',rs[_0x68af('0x36')](0x4)+_0x68af('0x37'));var _0x6e50d6=Buffer[_0x68af('0x38')](_0x2e61a3['audioContent'],_0x68af('0x27'));return fs[_0x68af('0x39')](_0x9ae67e,_0x6e50d6,function(_0x5b9f76){_0x35d5fd(_0x5b9f76);},function(_0x1b17a1){fs[_0x68af('0x29')](_0x9ae67e,_0x68af('0x3a'));_0x140e09(_0x1b17a1);});});})[_0x68af('0x28')](function(_0x1ea620){_0x458149=path[_0x68af('0x3b')](__dirname,_0x68af('0x3c'),rs[_0x68af('0x36')](0x4)+_0x68af('0x25'));return convertFile(_0x9ae67e,_0x458149);})[_0x68af('0x28')](function(){try{fs[_0x68af('0x1b')](_0x9ae67e);fs[_0x68af('0x29')](_0x458149,_0x68af('0x3a'));}catch(_0x2035ed){logger[_0x68af('0x14')](_0x2035ed);}logger[_0x68af('0x23')](_0x68af('0x3d'),_0x458149['split']('.')[0x0]);return _0x458149[_0x68af('0x2a')]('.')[0x0];});};exports[_0x68af('0x3e')]=function(_0x2c46f6,_0x2bdd3d){var _0xadf477,_0x4bcd21;return tts(_0x2c46f6,_0x2bdd3d||'en',0x1)[_0x68af('0x28')](function(_0xfe53f4){logger[_0x68af('0x23')](_0xfe53f4);_0xadf477=path['resolve'](__dirname,_0x68af('0x3c'),rs[_0x68af('0x36')](0x4)+'.mp3');return downloadFile(_0xfe53f4,_0xadf477);})['then'](function(){_0x4bcd21=path[_0x68af('0x3b')](__dirname,'tmp',rs['generate'](0x4)+'.wav');return convertFile(_0xadf477,_0x4bcd21);})[_0x68af('0x28')](function(){try{fs[_0x68af('0x1b')](_0xadf477);fs[_0x68af('0x29')](_0x4bcd21,_0x68af('0x3a'));}catch(_0x39273b){logger[_0x68af('0x14')](_0x39273b);}logger['info'](_0x68af('0x3f'),_0x4bcd21[_0x68af('0x2a')]('.')[0x0]);return _0x4bcd21['split']('.')[0x0];});};exports[_0x68af('0x40')]=function(_0x1fb2da,_0x8b5c00,_0x1f0111){return google[_0x68af('0x41')](_0x1fb2da,_0x8b5c00,_0x1f0111)[_0x68af('0x28')](function(_0x12a792){logger[_0x68af('0x23')](_0x12a792[_0x68af('0x42')]);return rp(_0x12a792);})[_0x68af('0x28')](function(_0x13b708){var _0x4e9250='';var _0x932a50=0x0;try{fs[_0x68af('0x1b')](_0x1fb2da);}catch(_0x575aba){logger[_0x68af('0x14')](_0x575aba);}if(_0x13b708&&_0x13b708[_0x68af('0x43')]){_0x4e9250=_0x13b708[_0x68af('0x43')][_0x68af('0x44')](function(_0x2f7b7f){return _0x2f7b7f&&_0x2f7b7f[_0x68af('0x45')][0x0]&&_0x2f7b7f[_0x68af('0x45')][0x0][_0x68af('0x46')]?_0x2f7b7f[_0x68af('0x45')][0x0][_0x68af('0x46')]:'';})[_0x68af('0x47')]('\x0a');_0x932a50=_0x13b708[_0x68af('0x43')][_0x68af('0x44')](function(_0x733e1a){return _0x733e1a&&_0x733e1a[_0x68af('0x45')][0x0]&&_0x733e1a[_0x68af('0x45')][0x0][_0x68af('0x48')]?_0x733e1a[_0x68af('0x45')][0x0]['confidence']:0x0;})[_0x68af('0x47')]('\x0a');}logger[_0x68af('0x23')](_0x68af('0x49'),_0x4e9250);logger['info'](_0x68af('0x4a'),_0x932a50);return{'transcript':_0x4e9250,'confidence':_0x932a50};})['catch'](function(_0x44c78d){logger[_0x68af('0x14')](_0x68af('0x4b'),_0x44c78d[_0x68af('0x17')],_0x44c78d[_0x68af('0x4c')],_0x44c78d[_0x68af('0x4d')]);});};exports[_0x68af('0x4e')]=function(_0x19a66a,_0x24d654,_0x35e59f,_0x244e68){var _0x597301=apiai(_0x24d654,{'language':_0x244e68||'en'});return _0x597301['textRequest'](_0x35e59f,{'sessionId':md5(_0x19a66a)})['then'](function(_0x1e206b){logger[_0x68af('0x23')](JSON[_0x68af('0x4f')](_0x1e206b));return{'source':_0x1e206b['result']['source'],'resolvedQuery':_0x1e206b[_0x68af('0x50')][_0x68af('0x51')],'action':_0x1e206b[_0x68af('0x50')]['action'],'actionIncomplete':_0x1e206b[_0x68af('0x50')]['actionIncomplete'],'speech':_0x1e206b['result'][_0x68af('0x52')][_0x68af('0x53')],'score':_0x1e206b[_0x68af('0x50')]['score'],'statusCode':_0x1e206b[_0x68af('0x54')][_0x68af('0x55')],'endConversation':_0x1e206b[_0x68af('0x50')][_0x68af('0x56')][_0x68af('0x57')]||![],'isFallbackIntent':_0x1e206b[_0x68af('0x50')][_0x68af('0x56')][_0x68af('0x58')]};});};exports['tildeASR']=function(_0x55ad59,_0x35200d,_0x5231c6,_0x144766){return tilde[_0x68af('0x41')](_0x55ad59,_0x35200d,_0x5231c6,_0x144766)[_0x68af('0x28')](function(_0x37416d){try{fs[_0x68af('0x1b')](_0x55ad59);}catch(_0xc15687){logger[_0x68af('0x14')](_0xc15687);}logger[_0x68af('0x23')](_0x68af('0x59'),_0x37416d['transcript']);logger[_0x68af('0x23')](_0x68af('0x5a'),_0x37416d[_0x68af('0x48')]);return _0x37416d;});};exports[_0x68af('0x5b')]=function(_0x3b8e9b,_0x425ce6,_0x3d6919,_0x5ba395,_0x3880d1,_0x46e967){var _0x1408ba=path[_0x68af('0x3b')](__dirname,'tmp',rs[_0x68af('0x36')](0x4)+_0x68af('0x37'));var _0x477f60;return aws['polly'](_0x3b8e9b,_0x425ce6,_0x3d6919,_0x5ba395,_0x3880d1,_0x46e967,_0x1408ba)[_0x68af('0x28')](function(){_0x477f60=path[_0x68af('0x3b')](__dirname,_0x68af('0x3c'),rs[_0x68af('0x36')](0x4)+_0x68af('0x25'));return convertFile(_0x1408ba,_0x477f60);})[_0x68af('0x28')](function(){try{fs[_0x68af('0x1b')](_0x1408ba);fs[_0x68af('0x29')](_0x477f60,_0x68af('0x3a'));}catch(_0x37972f){logger[_0x68af('0x14')](_0x37972f);}return _0x477f60['split']('.')[0x0];});};exports[_0x68af('0x5c')]=function(_0x92ea4b,_0x5d6243,_0x3a9880,_0x4d79ef,_0x4c36b7,_0x4b82fb){return aws['lex'](_0x92ea4b,_0x5d6243,_0x3a9880,_0x4d79ef,_0x4c36b7,_0x4b82fb)[_0x68af('0x28')](function(_0x3d0b0b){logger[_0x68af('0x23')](JSON['stringify'](_0x3d0b0b));return _0x3d0b0b;});};exports[_0x68af('0x5d')]=function(_0x3018e6,_0x60ee15,_0x3fb897,_0x27729f){var _0x2d8f76=util[_0x68af('0x5e')]('%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3',ISPEECH_API,_0x3018e6,encodeURIComponent(_0x60ee15),_0x3fb897,_0x27729f);var _0x3be7c1=path['resolve'](__dirname,'tmp',rs[_0x68af('0x36')](0x4)+_0x68af('0x37'));var _0x2f20f8;return downloadFile(_0x2d8f76,_0x3be7c1)[_0x68af('0x28')](function(){_0x2f20f8=path['resolve'](__dirname,_0x68af('0x3c'),rs[_0x68af('0x36')](0x4)+_0x68af('0x25'));return convertFile(_0x3be7c1,_0x2f20f8);})[_0x68af('0x28')](function(){try{fs[_0x68af('0x1b')](_0x3be7c1);fs[_0x68af('0x29')](_0x2f20f8,'777');}catch(_0x466840){logger['error'](_0x466840);}return _0x2f20f8['split']('.')[0x0];});};exports[_0x68af('0x5f')]=function(_0x3070df,_0x2500bb,_0x352d92,_0x44c52d){var _0x52236b=util[_0x68af('0x5e')](_0x68af('0x60'),ISPEECH_API,_0x2500bb,_0x352d92,base64Encode(_0x3070df),_0x44c52d?util[_0x68af('0x5e')](_0x68af('0x61'),encodeURIComponent(_0x44c52d)):'freeform=3');return uploadFile(_0x52236b)[_0x68af('0x28')](function(_0x5c8edb){return querystring[_0x68af('0x2')](_0x5c8edb);});};exports[_0x68af('0x62')]=function(_0x367e6f,_0x1bedfc){return sestek[_0x68af('0x63')](_0x367e6f,_0x1bedfc)[_0x68af('0x28')](function(_0xf4c7a7){logger['info'](JSON['stringify'](_0xf4c7a7));var _0x470cfa={'speech':_0xf4c7a7[_0x68af('0x64')],'action':_0xf4c7a7['channelData']?_0xf4c7a7[_0x68af('0x65')][_0x68af('0x66')]:undefined,'actiondata':_0xf4c7a7[_0x68af('0x65')]?_0xf4c7a7[_0x68af('0x65')][_0x68af('0x67')]:undefined};if(_0xf4c7a7[_0x68af('0x65')]&&_0xf4c7a7[_0x68af('0x65')]['AudioFromTts']){return base64Decode(_0xf4c7a7['channelData'][_0x68af('0x68')]['Data'],path[_0x68af('0x3b')](__dirname,_0x68af('0x3c'),rs[_0x68af('0x36')](0x4)+_0x68af('0x25')))[_0x68af('0x28')](function(_0x3a204e){_0x470cfa[_0x68af('0x69')]=_0x3a204e;return _0x470cfa;});}return _0x470cfa;});};exports[_0x68af('0x6a')]=function(){return __dirname;}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/index.js b/server/services/agi/scripts/sestek/index.js index efa2c8e..e721094 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 _0xfd22=['./nda','exports'];(function(_0x31c27f,_0x40294c){var _0x28f9c6=function(_0x4f7f35){while(--_0x4f7f35){_0x31c27f['push'](_0x31c27f['shift']());}};_0x28f9c6(++_0x40294c);}(_0xfd22,0x196));var _0x2fd2=function(_0x2b0f42,_0x1fd64e){_0x2b0f42=_0x2b0f42-0x0;var _0x5e2b8d=_0xfd22[_0x2b0f42];return _0x5e2b8d;};var nda=require(_0x2fd2('0x0'));module[_0x2fd2('0x1')]={'nda':nda}; \ No newline at end of file +var _0x5913=['./nda'];(function(_0x1a9e30,_0x4c390f){var _0x47344f=function(_0x5224dd){while(--_0x5224dd){_0x1a9e30['push'](_0x1a9e30['shift']());}};_0x47344f(++_0x4c390f);}(_0x5913,0xea));var _0x3591=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5913[_0x3dd15e];return _0x231fd0;};var nda=require(_0x3591('0x0'));module['exports']={'nda':nda}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/nda/index.js b/server/services/agi/scripts/sestek/nda/index.js index ae824c8..70c67a1 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 _0x348f=['custom_action','CustomAction','custom_action_data','CustomActionData','info','stringify','request-promise','url','../../../../../config/logger','agi','exports','POST','resolve','ndauth_url','/token','password','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','uniqueid','calleridname','dnid','text','access_token','project','channelData','ProjectName','ndagenerate_audio','body','AudioOutputSettings'];(function(_0x17e743,_0x568254){var _0x263c25=function(_0xd4c238){while(--_0xd4c238){_0x17e743['push'](_0x17e743['shift']());}};_0x263c25(++_0x568254);}(_0x348f,0xa6));var _0xf348=function(_0xf33fb5,_0x208265){_0xf33fb5=_0xf33fb5-0x0;var _0x53c84e=_0x348f[_0xf33fb5];return _0x53c84e;};'use strict';var rp=require(_0xf348('0x0'));var url=require(_0xf348('0x1'));var logger=require(_0xf348('0x2'))(_0xf348('0x3'));module[_0xf348('0x4')]=function(_0xf491c7,_0x3fe60b){var _0x3e0ea={'method':_0xf348('0x5'),'uri':url[_0xf348('0x6')](_0x3fe60b[_0xf348('0x7')],_0xf348('0x8')),'form':{'grant_type':_0xf348('0x9'),'username':_0x3fe60b['username'],'password':_0x3fe60b['password']},'json':!![]};return rp(_0x3e0ea)['then'](function(_0x59c289){var _0x178ec3={'method':_0xf348('0x5'),'uri':url[_0xf348('0x6')](_0x3fe60b[_0xf348('0xa')],_0xf348('0xb')),'body':{'type':_0x3fe60b[_0xf348('0xc')]||_0xf348('0xd'),'channelId':_0xf348('0xe'),'conversation':{'id':_0xf491c7[_0xf348('0xf')]},'from':{'id':_0xf491c7['callerid'],'name':_0xf491c7[_0xf348('0x10')]},'recipient':{'id':_0xf491c7[_0xf348('0x11')],'name':_0xf491c7['extension']},'text':_0x3fe60b[_0xf348('0x12')],'channelData':{}},'headers':{'Authorization':'Bearer\x20'+_0x59c289[_0xf348('0x13')]},'json':!![]};if(_0x3fe60b[_0xf348('0x14')]){_0x178ec3['body'][_0xf348('0x15')][_0xf348('0x16')]=_0x3fe60b[_0xf348('0x14')];}if(_0x3fe60b[_0xf348('0x17')]=='1'){_0x178ec3[_0xf348('0x18')]['channelData'][_0xf348('0x19')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':'audio/wav'};}if(_0x3fe60b[_0xf348('0x1a')]){_0x178ec3[_0xf348('0x18')][_0xf348('0x15')][_0xf348('0x1b')]=_0x3fe60b[_0xf348('0x1a')];if(_0x3fe60b[_0xf348('0x1c')]){_0x178ec3['body'][_0xf348('0x15')][_0xf348('0x1d')]=_0x3fe60b[_0xf348('0x1c')];}}logger[_0xf348('0x1e')](JSON[_0xf348('0x1f')](_0x178ec3));return rp(_0x178ec3);});}; \ No newline at end of file +var _0x3b7c=['AudioOutputSettings','audio/wav','custom_action','channelData','CustomAction','custom_action_data','info','stringify','url','../../../../../config/logger','agi','exports','POST','ndauth_url','/token','password','username','then','resolve','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','uniqueid','calleridname','dnid','extension','text','Bearer\x20','access_token','project','ProjectName','ndagenerate_audio','body'];(function(_0x53108a,_0x2eaf39){var _0x3ad2fd=function(_0x4b341d){while(--_0x4b341d){_0x53108a['push'](_0x53108a['shift']());}};_0x3ad2fd(++_0x2eaf39);}(_0x3b7c,0x90));var _0xc3b7=function(_0x35db17,_0x8d64da){_0x35db17=_0x35db17-0x0;var _0x73f088=_0x3b7c[_0x35db17];return _0x73f088;};'use strict';var rp=require('request-promise');var url=require(_0xc3b7('0x0'));var logger=require(_0xc3b7('0x1'))(_0xc3b7('0x2'));module[_0xc3b7('0x3')]=function(_0x49baea,_0x439a6f){var _0xf8ee57={'method':_0xc3b7('0x4'),'uri':url['resolve'](_0x439a6f[_0xc3b7('0x5')],_0xc3b7('0x6')),'form':{'grant_type':_0xc3b7('0x7'),'username':_0x439a6f[_0xc3b7('0x8')],'password':_0x439a6f[_0xc3b7('0x7')]},'json':!![]};return rp(_0xf8ee57)[_0xc3b7('0x9')](function(_0x69e72f){var _0x43e405={'method':_0xc3b7('0x4'),'uri':url[_0xc3b7('0xa')](_0x439a6f['ndassistant_url'],_0xc3b7('0xb')),'body':{'type':_0x439a6f[_0xc3b7('0xc')]||_0xc3b7('0xd'),'channelId':_0xc3b7('0xe'),'conversation':{'id':_0x49baea[_0xc3b7('0xf')]},'from':{'id':_0x49baea['callerid'],'name':_0x49baea[_0xc3b7('0x10')]},'recipient':{'id':_0x49baea[_0xc3b7('0x11')],'name':_0x49baea[_0xc3b7('0x12')]},'text':_0x439a6f[_0xc3b7('0x13')],'channelData':{}},'headers':{'Authorization':_0xc3b7('0x14')+_0x69e72f[_0xc3b7('0x15')]},'json':!![]};if(_0x439a6f[_0xc3b7('0x16')]){_0x43e405['body']['channelData'][_0xc3b7('0x17')]=_0x439a6f[_0xc3b7('0x16')];}if(_0x439a6f[_0xc3b7('0x18')]=='1'){_0x43e405[_0xc3b7('0x19')]['channelData'][_0xc3b7('0x1a')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0xc3b7('0x1b')};}if(_0x439a6f[_0xc3b7('0x1c')]){_0x43e405['body'][_0xc3b7('0x1d')][_0xc3b7('0x1e')]=_0x439a6f[_0xc3b7('0x1c')];if(_0x439a6f[_0xc3b7('0x1f')]){_0x43e405['body'][_0xc3b7('0x1d')]['CustomActionData']=_0x439a6f[_0xc3b7('0x1f')];}}logger[_0xc3b7('0x20')](JSON[_0xc3b7('0x21')](_0x43e405));return rp(_0x43e405);});}; \ 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 8b1004d..620a406 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 _0xde7e=['./lib/api'];(function(_0x325991,_0x5ce781){var _0x595a50=function(_0x4c305d){while(--_0x4c305d){_0x325991['push'](_0x325991['shift']());}};_0x595a50(++_0x5ce781);}(_0xde7e,0xce));var _0xede7=function(_0x351d76,_0x1e50e9){_0x351d76=_0x351d76-0x0;var _0x3aa5d4=_0xde7e[_0x351d76];return _0x3aa5d4;};'use strict';var asr=require(_0xede7('0x0'));module['exports']=function(_0x248c14,_0x2818fe,_0x30620,_0x1ca129){return asr(_0x248c14,_0x2818fe,_0x30620,_0x1ca129);}; \ No newline at end of file +var _0x6a42=['exports','./lib/api'];(function(_0x263965,_0x5e0cb8){var _0x41f0fe=function(_0x33acad){while(--_0x33acad){_0x263965['push'](_0x263965['shift']());}};_0x41f0fe(++_0x5e0cb8);}(_0x6a42,0x175));var _0x26a4=function(_0x93a74a,_0x27916c){_0x93a74a=_0x93a74a-0x0;var _0x1b557b=_0x6a42[_0x93a74a];return _0x1b557b;};'use strict';var asr=require(_0x26a4('0x0'));module[_0x26a4('0x1')]=function(_0x5cfead,_0x44edf9,_0x55569e,_0x22a9e0){return asr(_0x5cfead,_0x44edf9,_0x55569e,_0x22a9e0);}; \ 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 53a20ea..e999951 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 _0xbb32=['close','EOS','error','Tilde\x20ASR\x20send\x20error','result','final','hypotheses','transcript','likelihood','terminate','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isNil','open','message','bluebird','lodash','crypto','../../../../../../config/logger','agi','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','sha1','update','digest','hex','unix','send','stringify','createReadStream','data'];(function(_0x610144,_0x1be4c5){var _0x43b6e4=function(_0x9a8044){while(--_0x9a8044){_0x610144['push'](_0x610144['shift']());}};_0x43b6e4(++_0x1be4c5);}(_0xbb32,0x18f));var _0x2bb3=function(_0x425540,_0x97a491){_0x425540=_0x425540-0x0;var _0x117693=_0xbb32[_0x425540];return _0x117693;};'use strict';var BPromise=require(_0x2bb3('0x0'));var _=require(_0x2bb3('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require('moment');var crypto=require(_0x2bb3('0x2'));var logger=require(_0x2bb3('0x3'))(_0x2bb3('0x4'));module['exports']=function(_0x546e5b,_0x41785f,_0x422ce1,_0x39c3e9){return new BPromise(function(_0x7c0eeb,_0x11dd57){logger[_0x2bb3('0x5')](_0x2bb3('0x6'),_0x39c3e9||_0x2bb3('0x7'));var _0x4e60d1=new WebSocket(_0x39c3e9||_0x2bb3('0x7'),{'perMessageDeflate':![]});var _0x261993='';var _0x8dacdc='0';var _0xa35bea='1';var _0x5c8d07=_0x2bb3('0x8');function _0x1018a9(_0x3311c2){var _0x45ebc2=crypto[_0x2bb3('0x9')](_0x2bb3('0xa'));_0x45ebc2[_0x2bb3('0xb')](_0x3311c2);return _0x45ebc2[_0x2bb3('0xc')](_0x2bb3('0xd'));}function _0x4c1dff(){try{logger[_0x2bb3('0x5')]('Open\x20Tilde\x20ASR\x20socket');var _0xa9df7b=moment()[_0x2bb3('0xe')]();var _0x445487=_0x1018a9(_0xa9df7b+_0x41785f+_0x422ce1);_0x4e60d1[_0x2bb3('0xf')](JSON[_0x2bb3('0x10')]({'appID':_0x41785f,'timestamp':_0xa9df7b,'appKey':_0x445487}));var _0x2b81ab=fs[_0x2bb3('0x11')](_0x546e5b);_0x2b81ab['on'](_0x2bb3('0x12'),function(_0x484075){_0x4e60d1['send'](_0x484075);});_0x2b81ab['on'](_0x2bb3('0x13'),function(){_0x4e60d1[_0x2bb3('0xf')](_0x2bb3('0x14'));});}catch(_0x4e6d7f){logger[_0x2bb3('0x15')](_0x2bb3('0x16'),JSON[_0x2bb3('0x10')](_0x4e6d7f));_0x4e60d1['terminate']();}}function _0x31187e(_0x4b44f5){try{if(_0x4b44f5){var _0x451977=JSON['parse'](_0x4b44f5);switch(_0x451977['status']){case 0x0:if(_0x451977[_0x2bb3('0x17')]){if(_0x451977[_0x2bb3('0x17')][_0x2bb3('0x18')]){logger[_0x2bb3('0x5')]('Tilde\x20ASR\x20hypoteses',JSON[_0x2bb3('0x10')](_0x451977[_0x2bb3('0x17')][_0x2bb3('0x19')]));_0x261993=_0x451977[_0x2bb3('0x17')][_0x2bb3('0x19')][0x0][_0x2bb3('0x1a')];_0x8dacdc=_0x451977[_0x2bb3('0x17')][_0x2bb3('0x19')][0x0][_0x2bb3('0x1b')];_0xa35bea='0';_0x5c8d07='Success.';_0x4e60d1[_0x2bb3('0x1c')]();}}break;case 0x1:logger['info'](_0x2bb3('0x8'));_0xa35bea='1';_0x5c8d07=_0x2bb3('0x8');break;case 0x2:logger['info'](_0x2bb3('0x1d'));_0xa35bea='2';_0x5c8d07='Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.';break;case 0x9:logger[_0x2bb3('0x5')](_0x2bb3('0x1e'));_0xa35bea='9';_0x5c8d07=_0x2bb3('0x1e');break;case 0xa:logger[_0x2bb3('0x5')](_0x2bb3('0x1f'));_0xa35bea='10';_0x5c8d07=_0x2bb3('0x1f');break;case 0xb:logger[_0x2bb3('0x5')](_0x2bb3('0x20'));_0xa35bea='11';_0x5c8d07=_0x2bb3('0x20');}}}catch(_0x557e99){logger['error']('Tilde\x20ASR\x20parse\x20error',JSON[_0x2bb3('0x10')](_0x557e99));_0x4e60d1[_0x2bb3('0x1c')]();}}function _0x16d860(){logger[_0x2bb3('0x5')](_0x2bb3('0x21'));_0x7c0eeb({'transcript':_0x261993,'confidence':_0x8dacdc,'status':_0xa35bea,'status_message':_0x5c8d07});}function _0x2b46b7(_0x19547a){logger[_0x2bb3('0x15')](_0x2bb3('0x22'));if(!_[_0x2bb3('0x23')](_0x19547a)){logger[_0x2bb3('0x15')](_['isObject'](_0x19547a)?JSON[_0x2bb3('0x10')](_0x19547a):_0x19547a);}}_0x4e60d1['on'](_0x2bb3('0x24'),_0x4c1dff);_0x4e60d1['on'](_0x2bb3('0x25'),_0x31187e);_0x4e60d1['on']('close',_0x16d860);_0x4e60d1['on']('error',_0x2b46b7);});}; \ No newline at end of file +var _0xb7a8=['sha1','digest','hex','Open\x20Tilde\x20ASR\x20socket','unix','send','stringify','createReadStream','data','close','EOS','error','Tilde\x20ASR\x20send\x20error','parse','status','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','likelihood','Success.','terminate','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','isNil','isObject','open','message','bluebird','moment','crypto','../../../../../../config/logger','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'];(function(_0x103704,_0x32bc49){var _0x51c6d1=function(_0x33e40c){while(--_0x33e40c){_0x103704['push'](_0x103704['shift']());}};_0x51c6d1(++_0x32bc49);}(_0xb7a8,0x115));var _0x8b7a=function(_0x3643f1,_0x95a851){_0x3643f1=_0x3643f1-0x0;var _0x10361f=_0xb7a8[_0x3643f1];return _0x10361f;};'use strict';var BPromise=require(_0x8b7a('0x0'));var _=require('lodash');var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x8b7a('0x1'));var crypto=require(_0x8b7a('0x2'));var logger=require(_0x8b7a('0x3'))('agi');module[_0x8b7a('0x4')]=function(_0x3238e0,_0x59103a,_0x40817c,_0x187985){return new BPromise(function(_0x5ce4f,_0x4ad26a){logger[_0x8b7a('0x5')](_0x8b7a('0x6'),_0x187985||_0x8b7a('0x7'));var _0x1ff0bd=new WebSocket(_0x187985||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE',{'perMessageDeflate':![]});var _0x1af589='';var _0x200cbf='0';var _0x1c9ddd='1';var _0x1e101f=_0x8b7a('0x8');function _0xf65f97(_0x53263c){var _0x56e00c=crypto[_0x8b7a('0x9')](_0x8b7a('0xa'));_0x56e00c['update'](_0x53263c);return _0x56e00c[_0x8b7a('0xb')](_0x8b7a('0xc'));}function _0x460a32(){try{logger['info'](_0x8b7a('0xd'));var _0x90ee60=moment()[_0x8b7a('0xe')]();var _0x3bc22d=_0xf65f97(_0x90ee60+_0x59103a+_0x40817c);_0x1ff0bd[_0x8b7a('0xf')](JSON[_0x8b7a('0x10')]({'appID':_0x59103a,'timestamp':_0x90ee60,'appKey':_0x3bc22d}));var _0x364930=fs[_0x8b7a('0x11')](_0x3238e0);_0x364930['on'](_0x8b7a('0x12'),function(_0x11e298){_0x1ff0bd[_0x8b7a('0xf')](_0x11e298);});_0x364930['on'](_0x8b7a('0x13'),function(){_0x1ff0bd[_0x8b7a('0xf')](_0x8b7a('0x14'));});}catch(_0x335216){logger[_0x8b7a('0x15')](_0x8b7a('0x16'),JSON[_0x8b7a('0x10')](_0x335216));_0x1ff0bd['terminate']();}}function _0x224e39(_0x27f647){try{if(_0x27f647){var _0xb10ee3=JSON[_0x8b7a('0x17')](_0x27f647);switch(_0xb10ee3[_0x8b7a('0x18')]){case 0x0:if(_0xb10ee3[_0x8b7a('0x19')]){if(_0xb10ee3[_0x8b7a('0x19')][_0x8b7a('0x1a')]){logger['info'](_0x8b7a('0x1b'),JSON[_0x8b7a('0x10')](_0xb10ee3[_0x8b7a('0x19')][_0x8b7a('0x1c')]));_0x1af589=_0xb10ee3[_0x8b7a('0x19')][_0x8b7a('0x1c')][0x0]['transcript'];_0x200cbf=_0xb10ee3[_0x8b7a('0x19')][_0x8b7a('0x1c')][0x0][_0x8b7a('0x1d')];_0x1c9ddd='0';_0x1e101f=_0x8b7a('0x1e');_0x1ff0bd[_0x8b7a('0x1f')]();}}break;case 0x1:logger['info'](_0x8b7a('0x8'));_0x1c9ddd='1';_0x1e101f='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';break;case 0x2:logger[_0x8b7a('0x5')]('Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.');_0x1c9ddd='2';_0x1e101f=_0x8b7a('0x20');break;case 0x9:logger['info']('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0x1c9ddd='9';_0x1e101f=_0x8b7a('0x21');break;case 0xa:logger[_0x8b7a('0x5')](_0x8b7a('0x22'));_0x1c9ddd='10';_0x1e101f=_0x8b7a('0x22');break;case 0xb:logger['info'](_0x8b7a('0x23'));_0x1c9ddd='11';_0x1e101f='All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.';}}}catch(_0x15e383){logger[_0x8b7a('0x15')](_0x8b7a('0x24'),JSON['stringify'](_0x15e383));_0x1ff0bd['terminate']();}}function _0x3a684d(){logger[_0x8b7a('0x5')]('Close\x20Tilde\x20ASR\x20socket');_0x5ce4f({'transcript':_0x1af589,'confidence':_0x200cbf,'status':_0x1c9ddd,'status_message':_0x1e101f});}function _0x6b251b(_0x4c169a){logger[_0x8b7a('0x15')]('Error\x20Tilde\x20ASR\x20socket');if(!_[_0x8b7a('0x25')](_0x4c169a)){logger[_0x8b7a('0x15')](_[_0x8b7a('0x26')](_0x4c169a)?JSON[_0x8b7a('0x10')](_0x4c169a):_0x4c169a);}}_0x1ff0bd['on'](_0x8b7a('0x27'),_0x460a32);_0x1ff0bd['on'](_0x8b7a('0x28'),_0x224e39);_0x1ff0bd['on'](_0x8b7a('0x13'),_0x3a684d);_0x1ff0bd['on'](_0x8b7a('0x15'),_0x6b251b);});}; \ 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 ecce199..0c771f9 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 _0x95c8=['exports'];(function(_0x521449,_0x4f77a1){var _0x2a84af=function(_0x1a95a2){while(--_0x1a95a2){_0x521449['push'](_0x521449['shift']());}};_0x2a84af(++_0x4f77a1);}(_0x95c8,0x16a));var _0x895c=function(_0x5a457e,_0x1083a9){_0x5a457e=_0x5a457e-0x0;var _0x1cb352=_0x95c8[_0x5a457e];return _0x1cb352;};var asr=require('./asr');module[_0x895c('0x0')]={'asr':asr}; \ No newline at end of file +var _0x2752=['exports','./asr'];(function(_0x9c6e38,_0x1fc24e){var _0x148e08=function(_0x415b66){while(--_0x415b66){_0x9c6e38['push'](_0x9c6e38['shift']());}};_0x148e08(++_0x1fc24e);}(_0x2752,0x199));var _0x2275=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2752[_0x3dd15e];return _0x231fd0;};var asr=require(_0x2275('0x0'));module[_0x2275('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index e2147cd..905f040 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 _0x330c=['net','events','EventEmitter','./channel','127.0.0.1','call','emit','error','E_AGI_ARGUMENT_PORT','createServer','listening','getConnections','E_AGI_SERVER_ERROR','destroy','ready','connection','code','close','E_AGI_SERVER_CLOSE','nextTick','inherits','exports','util'];(function(_0x5dc45d,_0x55f90f){var _0x4ce697=function(_0x4e6e21){while(--_0x4e6e21){_0x5dc45d['push'](_0x5dc45d['shift']());}};_0x4ce697(++_0x55f90f);}(_0x330c,0x186));var _0xc330=function(_0x3c8018,_0x4f3203){_0x3c8018=_0x3c8018-0x0;var _0x1ad526=_0x330c[_0x3c8018];return _0x1ad526;};'use strict';var util=require(_0xc330('0x0'));var net=require(_0xc330('0x1'));var EventEmitter=require(_0xc330('0x2'))[_0xc330('0x3')];var AGIError=require('./error');var AGIChannel=require(_0xc330('0x4'));var AGIServer=function(_0x197a49,_0x4552ee,_0x207daa){var _0x3852b2=this,_0x197a49=_0x197a49||0x11dd,_0x4552ee=_0x4552ee||_0xc330('0x5'),_0x4f49fb=null,_0x53d0ca=0x0;EventEmitter[_0xc330('0x6')](_0x3852b2);function _0x253c40(){if(!_0x197a49){_0x3852b2[_0xc330('0x7')](_0xc330('0x8'),new AGIError(_0xc330('0x9')));return![];}_0x4f49fb=net[_0xc330('0xa')]();_0x4f49fb['listen'](_0x197a49,_0x4552ee);_0x4f49fb['on'](_0xc330('0xb'),function(){_0x3852b2[_0xc330('0x7')](_0xc330('0xb'));});_0x4f49fb['on']('connection',function(_0x381660){_0x4f49fb[_0xc330('0xc')](function(_0x172de9,_0x9a5658){if(_0x172de9){_0x3852b2[_0xc330('0x7')](_0xc330('0x8'),new AGIError(_0xc330('0xd'),_0x172de9));}else if(_0x207daa&&_0x207daa<0x0){_0x3852b2[_0xc330('0x7')](_0xc330('0x8'),new AGIError('E_AGI_SERVER_VOICE_DISABLED'));_0x381660['destroy']();}else if(_0x207daa&&_0x207daa>0x0&&_0x207daa<_0x9a5658){_0x53d0ca+=0x1;_0x3852b2[_0xc330('0x7')](_0xc330('0x8'),new AGIError('E_AGI_SERVER_MAXCONNECTION',_0x53d0ca));_0x381660[_0xc330('0xe')]();}else{var _0x27fa30=new AGIChannel(_0x381660);_0x27fa30['on'](_0xc330('0xf'),function(){_0x3852b2[_0xc330('0x7')](_0xc330('0x10'),_0x27fa30);});}});});_0x4f49fb['on'](_0xc330('0x8'),function(_0xdc5b8e){_0x3852b2[_0xc330('0x7')](_0xc330('0x8'),new AGIError('E_AGI_SERVER_ERROR',_0xdc5b8e[_0xc330('0x11')]));});_0x4f49fb['on'](_0xc330('0x12'),function(){_0x3852b2['emit'](_0xc330('0x12'),new AGIError(_0xc330('0x13')));});}process[_0xc330('0x14')](function(){_0x253c40();});};util[_0xc330('0x15')](AGIServer,EventEmitter);module[_0xc330('0x16')]=function(_0x4d2e39,_0x3b6e46,_0x4a4b30){return new AGIServer(_0x4d2e39,_0x3b6e46,_0x4a4b30);}; \ No newline at end of file +var _0x1ae3=['exports','util','net','EventEmitter','./error','./channel','127.0.0.1','call','emit','error','E_AGI_ARGUMENT_PORT','createServer','listen','listening','connection','E_AGI_SERVER_VOICE_DISABLED','E_AGI_SERVER_MAXCONNECTION','destroy','ready','E_AGI_SERVER_ERROR','code','close','nextTick','inherits'];(function(_0x5e8460,_0x2003b5){var _0x3d50fd=function(_0x4c499f){while(--_0x4c499f){_0x5e8460['push'](_0x5e8460['shift']());}};_0x3d50fd(++_0x2003b5);}(_0x1ae3,0x139));var _0x31ae=function(_0x188d37,_0x1f137a){_0x188d37=_0x188d37-0x0;var _0x31e650=_0x1ae3[_0x188d37];return _0x31e650;};'use strict';var util=require(_0x31ae('0x0'));var net=require(_0x31ae('0x1'));var EventEmitter=require('events')[_0x31ae('0x2')];var AGIError=require(_0x31ae('0x3'));var AGIChannel=require(_0x31ae('0x4'));var AGIServer=function(_0x293580,_0x4f03c3,_0x16eaa4){var _0xf41e21=this,_0x293580=_0x293580||0x11dd,_0x4f03c3=_0x4f03c3||_0x31ae('0x5'),_0xe1202b=null,_0x3f2e91=0x0;EventEmitter[_0x31ae('0x6')](_0xf41e21);function _0x43773f(){if(!_0x293580){_0xf41e21[_0x31ae('0x7')](_0x31ae('0x8'),new AGIError(_0x31ae('0x9')));return![];}_0xe1202b=net[_0x31ae('0xa')]();_0xe1202b[_0x31ae('0xb')](_0x293580,_0x4f03c3);_0xe1202b['on'](_0x31ae('0xc'),function(){_0xf41e21['emit'](_0x31ae('0xc'));});_0xe1202b['on'](_0x31ae('0xd'),function(_0x20506d){_0xe1202b['getConnections'](function(_0x336af5,_0x129526){if(_0x336af5){_0xf41e21['emit'](_0x31ae('0x8'),new AGIError('E_AGI_SERVER_ERROR',_0x336af5));}else if(_0x16eaa4&&_0x16eaa4<0x0){_0xf41e21[_0x31ae('0x7')](_0x31ae('0x8'),new AGIError(_0x31ae('0xe')));_0x20506d['destroy']();}else if(_0x16eaa4&&_0x16eaa4>0x0&&_0x16eaa4<_0x129526){_0x3f2e91+=0x1;_0xf41e21[_0x31ae('0x7')](_0x31ae('0x8'),new AGIError(_0x31ae('0xf'),_0x3f2e91));_0x20506d[_0x31ae('0x10')]();}else{var _0x2b1fc2=new AGIChannel(_0x20506d);_0x2b1fc2['on'](_0x31ae('0x11'),function(){_0xf41e21['emit'](_0x31ae('0xd'),_0x2b1fc2);});}});});_0xe1202b['on'](_0x31ae('0x8'),function(_0x1ec358){_0xf41e21[_0x31ae('0x7')](_0x31ae('0x8'),new AGIError(_0x31ae('0x12'),_0x1ec358[_0x31ae('0x13')]));});_0xe1202b['on'](_0x31ae('0x14'),function(){_0xf41e21['emit'](_0x31ae('0x14'),new AGIError('E_AGI_SERVER_CLOSE'));});}process[_0x31ae('0x15')](function(){_0x43773f();});};util[_0x31ae('0x16')](AGIServer,EventEmitter);module[_0x31ae('0x17')]=function(_0x2ae603,_0x3e4d98,_0x26699c){return new AGIServer(_0x2ae603,_0x3e4d98,_0x26699c);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index 79e53b4..c73d603 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 _0x9466=['Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','mailbox','VOICEMAIL','Enter\x20in\x20SWITCH\x20(%s)\x20block','replaceAll','join','exports','util','lodash','shelljs','odbc','randomstring','moment','mustache','request-promise','../../config/logger','agi','../../config/environment','/var/opt/motion2/server/files','rawBody','getdigits','mailRpc','getVariable','name','catch','prototype','getVoiceQueue','getVoiceQueueById','then','getSquareProject','rpc','getSquareProjectById','getSquareOdbc','getSquareOdbcById','getUser','getUserById','getTrunk','getTrunkById','getSound','getSoundById','getSoundPath','getMailAccountById','sendMailMessage','getIntervals','getIntervalById','IntervalId','interval','format','%s/sounds/converted/%s','getQueryOdbc','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','query','Query\x20executed\x20correctly\x20%s','close','getSmsAccountById','createSmsMessage','createSquareDetailsReport','channel','uniqueid','label','arg_1','createSquareRecording','callerid','calleridname','context','extension','dnid','file','createSquareMessage','createCmContact','isEmpty','isNil','callback_','random','lastName','phone','list_id','scheduledAt','callback','toString','callback_priority','getPause','getPauseById','agent','agentUnpause','agentLogout','internal','%s/%s@from-sip/n','LOCAL','agentLogin','shellCommand','exec','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','en-US','ssmlGender','MALE','audioEncoding','MP3','googleTTS','number','timeout','includes','PUT','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','rawHeaders','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','render','url','headers','stringify','body','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','googleDialogflow','key','dialogflow_language','sestekNDA','ispeechTTS','ispeech_tts_language','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_region','aws_polly_voice','awsLex','googleASR','google_asr_language','appsecret','clear','agicommand','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','hasOwnProperty','isPlainObject','length','saveRestApiResult','%s.%s','isArray','setVariable','split','extra','maxRetry','retry','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','wait','result','answer','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','add','minutes','noop','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','application','options','lumenvoxtts','no\x20text\x20configured','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','MRCPSynth','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','grammar','getAndSetVariable','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','RECOG_INSTANCE()','LUMENVOX_ASR_INSTANCE','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','no\x20grammar\x20configured','MRCPRecog','RECOG_CONFIDENCE()','SESTEK_ASR_CONFIDENCE','RECOG_INPUT()','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','no\x20odbc\x20database\x20found','no\x20query\x20configured','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','keys','%s[%s][%s]','variable\x20%s\x20set','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20found','DIAL','Executed\x20command\x20%s','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','toUpperCase','speech','out','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','no\x20username\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','unlink','SestekNDA\x20Result\x20%s','Enter\x20in\x20END\x20(%s)\x20block','end','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20found','trunk_name','no\x20trunk\x20selected','SIP/%s/%s','opts','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','getData','maxdigit','test','mindigit','hiddendigitsnum','generate','first','substr','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','.wav','awslex','aws_bot_name','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','beep','NOBEEP','intKey','google\x20%s\x20file\x20created','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','no\x20appsecret\x20configured','%s/recordings/%s','recordFile','tildeASR','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','continueAt','priority','gotoif','condition','no\x20condition\x20configured','false','EVAL\x20CONDITION\x20%s\x20%s','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20intervals\x20found','IFTIME(%s?true:false)','true','IFTIME\x20%s\x20%s','hangup','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','login','findBy','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','AGENT\x20%s\x20NOT\x20FOUND\x20BY','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','failure','math','operation','no\x20operation\x20configured','variable\x20%s[key]\x20set','menu','Enter\x20in\x20MENU\x20(%s)\x20block','response','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','no\x20find\x20by\x20configured','agentPause','success','playback','PLAYBACK','Executed\x20command\x20%s\x20%s','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','macro','gosub','position','QUEUE','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayphonetic','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','getMailAccount','Smtp','no\x20mail\x20account\x20found','email','bcc','service','host','port','secure','authentication','auth','pass','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','getSmsAccount','sendSMS\x20message','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','yes','Answer','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','agi://%s/square,\x22%s\x22,\x22%s\x22','system'];(function(_0x10bbc6,_0x2e6d34){var _0x481e8a=function(_0x532084){while(--_0x532084){_0x10bbc6['push'](_0x10bbc6['shift']());}};_0x481e8a(++_0x2e6d34);}(_0x9466,0x1cb));var _0x6946=function(_0x35885a,_0x42fed7){_0x35885a=_0x35885a-0x0;var _0xe86249=_0x9466[_0x35885a];return _0xe86249;};'use strict';var fs=require('fs');var path=require('path');var util=require(_0x6946('0x0'));var _=require(_0x6946('0x1'));var sh=require(_0x6946('0x2'));var odbc=require(_0x6946('0x3'))();var rs=require(_0x6946('0x4'));var moment=require(_0x6946('0x5'));var Mustache=require(_0x6946('0x6'));var rp=require(_0x6946('0x7'));var logger=require(_0x6946('0x8'))(_0x6946('0x9'));var config=require(_0x6946('0xa'));var scripts=require('./scripts');var FILES_PATH=_0x6946('0xb');var recursiveMapAttributes=['rawHeaders',_0x6946('0xc')];var verticesWithRetry=['menu',_0x6946('0xd'),'getsecretdigits'];var AGIVertices=function(_0x301b38,_0x2b4eb3,_0x33dc99){this['channel']=_0x301b38;this['rpc']=_0x2b4eb3;this[_0x6946('0xe')]=_0x33dc99;};AGIVertices['prototype'][_0x6946('0xf')]=function(_0x249920,_0x440b7a){this['rpc']['getVariableById'](_0x249920)['then'](function(_0xf6fc3d){_0x440b7a(null,_0xf6fc3d?_0xf6fc3d[_0x6946('0x10')]:![]);})[_0x6946('0x11')](function(_0x164c74){_0x440b7a(_0x164c74);});};AGIVertices[_0x6946('0x12')][_0x6946('0x13')]=function(_0x3a395a,_0x6677f8){this['rpc'][_0x6946('0x14')](_0x3a395a)[_0x6946('0x15')](function(_0x197218){_0x6677f8(null,_0x197218?_0x197218[_0x6946('0x10')]:![]);})[_0x6946('0x11')](function(_0x2fb002){_0x6677f8(_0x2fb002);});};AGIVertices[_0x6946('0x12')][_0x6946('0x16')]=function(_0x124fda,_0x2ce8a7){this[_0x6946('0x17')][_0x6946('0x18')](_0x124fda)[_0x6946('0x15')](function(_0x23eefa){_0x2ce8a7(null,_0x23eefa?_0x23eefa['name']:![]);})['catch'](function(_0x289f57){_0x2ce8a7(_0x289f57);});};AGIVertices['prototype'][_0x6946('0x19')]=function(_0x4a1a0,_0x52a34f){this[_0x6946('0x17')][_0x6946('0x1a')](_0x4a1a0)['then'](function(_0x1c9d7c){_0x52a34f(null,_0x1c9d7c?_0x1c9d7c['dsn']:![]);})[_0x6946('0x11')](function(_0x14daa0){_0x52a34f(_0x14daa0);});};AGIVertices['prototype'][_0x6946('0x1b')]=function(_0x47528c,_0x3c8789){this['rpc'][_0x6946('0x1c')](_0x47528c)['then'](function(_0x3f2ca9){_0x3c8789(null,_0x3f2ca9?_0x3f2ca9[_0x6946('0x10')]:![]);})[_0x6946('0x11')](function(_0x345f37){_0x3c8789(_0x345f37);});};AGIVertices['prototype'][_0x6946('0x1d')]=function(_0x12d61a,_0x1ca606){this['rpc'][_0x6946('0x1e')](_0x12d61a)['then'](function(_0x1dfe91){_0x1ca606(null,_0x1dfe91?_0x1dfe91[_0x6946('0x10')]:![]);})[_0x6946('0x11')](function(_0x2db511){_0x1ca606(_0x2db511);});};AGIVertices[_0x6946('0x12')][_0x6946('0x1f')]=function(_0x2a6692,_0x36e7ff){var _0x1db3ce=this;this['rpc'][_0x6946('0x20')](_0x2a6692)[_0x6946('0x15')](function(_0x5d4619){_0x36e7ff(null,_0x5d4619?_0x1db3ce[_0x6946('0x21')](_0x5d4619['save_name']):![]);})[_0x6946('0x11')](function(_0x35bdf0){_0x36e7ff(_0x35bdf0);});};AGIVertices[_0x6946('0x12')]['getMailAccount']=function(_0x324581,_0x38b3ae){this[_0x6946('0x17')][_0x6946('0x22')](_0x324581)[_0x6946('0x15')](function(_0x36a25d){_0x38b3ae(null,_0x36a25d?_0x36a25d:![]);})[_0x6946('0x11')](function(_0x2b7b0e){_0x38b3ae(_0x2b7b0e);});};AGIVertices[_0x6946('0x12')][_0x6946('0x23')]=function(_0xfdc099,_0x51ca42,_0x681ae3){this[_0x6946('0xe')]['sendMailMessage'](_0xfdc099,_0x51ca42)[_0x6946('0x15')](function(){_0x681ae3(null);})[_0x6946('0x11')](function(_0xace751){_0x681ae3(_0xace751);});};AGIVertices[_0x6946('0x12')][_0x6946('0x24')]=function(_0x2a5245,_0x2b67ea){this[_0x6946('0x17')][_0x6946('0x25')](_0x2a5245)[_0x6946('0x15')](function(_0x4655fe){if(_0x4655fe){if(_0x4655fe[_0x6946('0x26')]){_0x2b67ea(null,[_0x4655fe[_0x6946('0x27')]]);}else{_0x2b67ea(null,_['map'](_0x4655fe['Intervals'],_0x6946('0x27')));}}else{_0x2b67ea(null,![]);}})[_0x6946('0x11')](function(_0x5051d6){_0x2b67ea(_0x5051d6);});};AGIVertices[_0x6946('0x12')][_0x6946('0x21')]=function(_0xff281c){return util[_0x6946('0x28')](_0x6946('0x29'),FILES_PATH,_0xff281c);};AGIVertices[_0x6946('0x12')][_0x6946('0x2a')]=function(_0x3aeedf,_0x263bca,_0x5e7e87){odbc[_0x6946('0x2b')](_0x3aeedf,function(_0x59b100){if(_0x59b100){logger[_0x6946('0x2c')](_0x6946('0x2d'),_0x59b100);_0x5e7e87(_0x59b100);}else{logger[_0x6946('0x2e')](_0x6946('0x2f'));odbc[_0x6946('0x30')](_0x263bca,function(_0x34860a,_0x4d393b){if(_0x34860a){logger[_0x6946('0x2e')]('Error\x20executing\x20query\x20%s',_0x263bca);_0x5e7e87(_0x34860a);}else{logger[_0x6946('0x2e')](_0x6946('0x31'),_0x263bca);odbc[_0x6946('0x32')](function(_0x35913d){if(_0x35913d){logger[_0x6946('0x2c')]('Error\x20closing\x20connection\x20to\x20odbc\x20%s',_0x35913d);}_0x5e7e87(null,_0x4d393b);});}});}});};AGIVertices[_0x6946('0x12')]['getSmsAccount']=function(_0x2cc67e,_0x3b9e47){this[_0x6946('0x17')][_0x6946('0x33')](_0x2cc67e)['then'](function(_0x155152){_0x3b9e47(null,_0x155152?_0x155152:![]);})[_0x6946('0x11')](function(_0x293808){_0x3b9e47(_0x293808);});};AGIVertices[_0x6946('0x12')][_0x6946('0x34')]=function(_0x37430,_0xac212){this[_0x6946('0x17')][_0x6946('0x34')](_0x37430)[_0x6946('0x15')](function(_0x40c2c6){_0xac212(null,_0x40c2c6);})[_0x6946('0x11')](function(_0x45c67d){_0xac212(_0x45c67d);});};AGIVertices['prototype'][_0x6946('0x35')]=function(_0x442285,_0x5ada1e,_0x45f2d7){this['rpc']['createSquareDetailsReport']({'uniqueid':this[_0x6946('0x36')][_0x6946('0x37')],'node':_0x442285[_0x6946('0x38')],'application':_0x442285['agicommand'],'data':_0x5ada1e||null,'project_name':this[_0x6946('0x36')][_0x6946('0x39')],'callerid':this[_0x6946('0x36')]['callerid']})[_0x6946('0x15')](function(_0x3bcd8a){if(_0x45f2d7){_0x45f2d7(null,_0x3bcd8a);}})[_0x6946('0x11')](function(_0x2a724c){if(_0x45f2d7){_0x45f2d7(_0x2a724c);}});};AGIVertices[_0x6946('0x12')][_0x6946('0x3a')]=function(_0x22e2a3,_0x159c3d,_0x1efa27,_0x5bb9f1){this[_0x6946('0x17')][_0x6946('0x3a')]({'uniqueid':this['channel'][_0x6946('0x37')],'callerid':this[_0x6946('0x36')][_0x6946('0x3b')],'calleridname':this[_0x6946('0x36')][_0x6946('0x3c')],'context':this[_0x6946('0x36')][_0x6946('0x3d')],'extension':this[_0x6946('0x36')][_0x6946('0x3e')],'priority':this[_0x6946('0x36')]['priority'],'accountcode':this[_0x6946('0x36')]['accountcode'],'dnid':this['channel'][_0x6946('0x3f')],'projectName':this[_0x6946('0x36')]['arg_1'],'saveName':_0x159c3d,'filename':_0x22e2a3[_0x6946('0x40')]||_0x159c3d,'savePath':_0x1efa27})[_0x6946('0x15')](function(_0x57da4e){_0x5bb9f1(null,_0x57da4e);})[_0x6946('0x11')](function(_0x343230){_0x5bb9f1(_0x343230);});};AGIVertices[_0x6946('0x12')]['createSquareMessage']=function(_0x52008e,_0x5cc5a2,_0x14057d){this[_0x6946('0x17')][_0x6946('0x41')]({'uniqueid':this[_0x6946('0x36')]['uniqueid'],'body':_0x52008e,'direction':_0x5cc5a2})[_0x6946('0x15')](function(_0x24168a){if(_0x14057d){_0x14057d(null,_0x24168a);}})[_0x6946('0x11')](function(_0x39f995){if(_0x14057d){_0x14057d(_0x39f995);}});};AGIVertices[_0x6946('0x12')][_0x6946('0x42')]=function(_0x509d87,_0x4f05e9){this[_0x6946('0x17')][_0x6946('0x42')]({'firstName':_[_0x6946('0x43')](_0x509d87['name'])||_[_0x6946('0x44')](_0x509d87[_0x6946('0x10')])?_0x6946('0x45')+Math[_0x6946('0x46')]():_0x509d87['name'],'lastName':_[_0x6946('0x43')](_0x509d87['lastName'])||_[_0x6946('0x44')](_0x509d87['lastName'])?null:_0x509d87[_0x6946('0x47')],'phone':_0x509d87[_0x6946('0x48')],'ListId':_0x509d87[_0x6946('0x49')],'scheduledat':_0x509d87[_0x6946('0x4a')],'callbackUniqueid':this[_0x6946('0x36')][_0x6946('0x37')],'tags':_0x6946('0x4b'),'description':'Callback\x20scheduled\x20at\x20'+_0x509d87[_0x6946('0x4a')][_0x6946('0x4c')](),'priority':_0x509d87[_0x6946('0x4d')]})['then'](function(_0x3dcc39){_0x4f05e9(null,_0x3dcc39);})[_0x6946('0x11')](function(_0x23d60f){_0x4f05e9(_0x23d60f);});};AGIVertices[_0x6946('0x12')][_0x6946('0x4e')]=function(_0x3e41db,_0x571cd7){this[_0x6946('0x17')][_0x6946('0x4f')](_0x3e41db)[_0x6946('0x15')](function(_0xca711d){_0x571cd7(null,_0xca711d?_0xca711d[_0x6946('0x10')]:![]);})[_0x6946('0x11')](function(_0x2aa80e){_0x571cd7(_0x2aa80e);});};AGIVertices[_0x6946('0x12')]['agentPause']=function(_0x265cd7,_0x152079,_0x3aa8e8){var _0x21bc8c={'role':_0x6946('0x50')};_0x21bc8c[_0x265cd7]=this[_0x6946('0x36')][_0x6946('0x3b')];this[_0x6946('0x17')]['agentPause'](_0x21bc8c,_0x152079,this['channel'][_0x6946('0x37')])[_0x6946('0x15')](function(_0x1e0399){_0x3aa8e8(null,_['isNil'](_0x1e0399)?![]:!![]);})[_0x6946('0x11')](function(_0x47b76d){logger[_0x6946('0x2c')](_0x47b76d);_0x3aa8e8(null,![]);});};AGIVertices['prototype'][_0x6946('0x51')]=function(_0x4dd938,_0x15e3c2){var _0x52517a={'role':_0x6946('0x50')};_0x52517a[_0x4dd938]=this[_0x6946('0x36')][_0x6946('0x3b')];this[_0x6946('0x17')][_0x6946('0x51')](_0x52517a)[_0x6946('0x15')](function(_0x185e6e){_0x15e3c2(null,_['isNil'](_0x185e6e)?![]:!![]);})[_0x6946('0x11')](function(_0x20821f){logger['error'](_0x20821f);_0x15e3c2(null,![]);});};AGIVertices[_0x6946('0x12')][_0x6946('0x52')]=function(_0x24fee6,_0x378f81){var _0x3b67a8={'role':_0x6946('0x50')};_0x3b67a8[_0x24fee6]=this['channel']['callerid'];this['rpc'][_0x6946('0x52')](_0x3b67a8)['then'](function(_0x154f54){_0x378f81(null,_['isNil'](_0x154f54)?![]:!![]);})[_0x6946('0x11')](function(_0x1eda8a){logger[_0x6946('0x2c')](_0x1eda8a);_0x378f81(null,![]);});};AGIVertices[_0x6946('0x12')]['agentLogin']=function(_0x4a6c39,_0x2c335a){var _0x3f29dd={'role':_0x6946('0x50')};_0x3f29dd[_0x4a6c39]=this[_0x6946('0x36')][_0x6946('0x3b')];var _0x31f9a1=_0x4a6c39!=_0x6946('0x53')?util[_0x6946('0x28')](_0x6946('0x54'),_0x6946('0x55'),this[_0x6946('0x36')][_0x6946('0x3b')]):undefined;this[_0x6946('0x17')][_0x6946('0x56')](_0x3f29dd,_0x31f9a1)[_0x6946('0x15')](function(_0x282ee6){_0x2c335a(null,_[_0x6946('0x44')](_0x282ee6)?![]:!![]);})[_0x6946('0x11')](function(_0x3c125b){logger[_0x6946('0x2c')](_0x3c125b);_0x2c335a(null,![]);});};AGIVertices[_0x6946('0x12')][_0x6946('0x57')]=function(_0x4da526,_0x54c7f9){sh[_0x6946('0x58')](_['trim'](_0x4da526),function(_0x3a76cc,_0x1d9e3a){var _0x1c7b7c=_0x1d9e3a[_0x6946('0x59')](/(\r\n|\n|\r)/gm,'');_0x54c7f9(null,_0x1c7b7c);});};AGIVertices['prototype'][_0x6946('0x5a')]=function(_0x1e17fc,_0x4f6adf){scripts[_0x6946('0x5a')](_0x1e17fc[_0x6946('0x5b')],_0x1e17fc[_0x6946('0x5c')]||_0x6946('0x5d'),_0x1e17fc[_0x6946('0x5d')],_0x1e17fc[_0x6946('0x5e')]||_0x6946('0x5f'),_0x1e17fc[_0x6946('0x60')]||_0x6946('0x61'),_0x1e17fc[_0x6946('0x62')]||_0x6946('0x63'))[_0x6946('0x15')](function(_0x3aed10){_0x4f6adf(null,_0x3aed10);})[_0x6946('0x11')](function(_0x4360b7){_0x4f6adf(_0x4360b7);});};AGIVertices[_0x6946('0x12')][_0x6946('0x64')]=function(_0x54f691,_0x49e71f){scripts[_0x6946('0x64')](_0x54f691['text'],_0x54f691['google_tts_language']||'en',0x1)['then'](function(_0x2888a8){_0x49e71f(null,_0x2888a8);})[_0x6946('0x11')](function(_0x17e3f5){_0x49e71f(_0x17e3f5);});};AGIVertices[_0x6946('0x12')]['restAPI']=function(_0x343bec,_0x3ac48e){var _0x6ab0ba={'uri':_0x343bec['url'],'method':_0x343bec['method'],'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x343bec['timeout'])===_0x6946('0x65')&&parseInt(_0x343bec['timeout'])>=0x1?parseInt(_0x343bec[_0x6946('0x66')])*0x3e8:0x5*0x3e8};if(_[_0x6946('0x67')](['POST',_0x6946('0x68')],_0x6ab0ba['method']['toUpperCase']())){try{_0x6ab0ba['body']=_0x343bec[_0x6946('0xc')]?JSON[_0x6946('0x69')](_0x343bec['rawBody']):{};}catch(_0x3ad8ec){logger[_0x6946('0x2c')](_0x6946('0x6a'),_0x3ad8ec);}}try{_0x6ab0ba['headers']=_0x343bec[_0x6946('0x6b')]?JSON[_0x6946('0x69')](_0x343bec[_0x6946('0x6b')]):{};}catch(_0x978fef){logger['error'](_0x6946('0x6c'),_0x978fef);}if(_0x343bec[_0x6946('0x6d')]){try{var _0x23ef19=require(_0x343bec['computedVariables'])[_0x6946('0x6e')](this,_0x6ab0ba);_0x6ab0ba[_0x6946('0x6f')]=Mustache[_0x6946('0x70')](_0x343bec[_0x6946('0x71')],_0x23ef19,{},['$$','$$']);if(_0x6ab0ba['headers']){_0x6ab0ba[_0x6946('0x72')]=JSON['parse'](Mustache[_0x6946('0x70')](JSON[_0x6946('0x73')](_0x6ab0ba['headers']),_0x23ef19,{},['$$','$$']));}if(_0x6ab0ba[_0x6946('0x74')]){_0x6ab0ba[_0x6946('0x74')]=JSON[_0x6946('0x69')](Mustache[_0x6946('0x70')](JSON[_0x6946('0x73')](_0x6ab0ba[_0x6946('0x74')]),_0x23ef19,{},['$$','$$']));}}catch(_0x5941a2){logger[_0x6946('0x2c')]('An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function',_0x5941a2);}}rp(_0x6ab0ba)['then'](function(_0x11113f){var _0x3b14c8={'statusCode':_0x11113f[_0x6946('0x75')]||0xc8,'statusMessage':_0x11113f[_0x6946('0x76')]||'OK','headers':_0x11113f[_0x6946('0x72')]||{},'body':_0x11113f[_0x6946('0x74')]||{}};_0x3ac48e(null,_0x3b14c8);})[_0x6946('0x11')](function(_0xe10b11){var _0xec075f={'statusCode':_0xe10b11[_0x6946('0x75')]||0x1f4,'statusMessage':_0xe10b11[_0x6946('0x77')]||_0x6946('0x78'),'headers':_0xe10b11['options'][_0x6946('0x72')]||{},'body':_0xe10b11['options'][_0x6946('0x74')]||{}};_0x3ac48e(null,_0xec075f);});};AGIVertices['prototype']['googleDialogflow']=function(_0x4a842d,_0x3e7202){scripts[_0x6946('0x79')](this[_0x6946('0x36')][_0x6946('0x37')],_0x4a842d[_0x6946('0x7a')],_0x4a842d[_0x6946('0x5d')],_0x4a842d[_0x6946('0x7b')]||'en')[_0x6946('0x15')](function(_0x4c7743){_0x3e7202(null,_0x4c7743);})[_0x6946('0x11')](function(_0x58720d){_0x3e7202(_0x58720d);});};AGIVertices[_0x6946('0x12')][_0x6946('0x7c')]=function(_0x2e512a,_0x3dd6c8){scripts[_0x6946('0x7c')](this[_0x6946('0x36')],_0x2e512a)[_0x6946('0x15')](function(_0x2fd218){_0x3dd6c8(null,_0x2fd218);})[_0x6946('0x11')](function(_0x401268){_0x3dd6c8(_0x401268);});};AGIVertices[_0x6946('0x12')][_0x6946('0x7d')]=function(_0x350b44,_0x54c9dd){scripts['ispeechTTS'](_0x350b44[_0x6946('0x7a')],_0x350b44['text'],_0x350b44[_0x6946('0x7e')]||_0x6946('0x5f'),_0x350b44[_0x6946('0x7f')])[_0x6946('0x15')](function(_0xc6e5b3){_0x54c9dd(null,_0xc6e5b3);})[_0x6946('0x11')](function(_0xf01fe6){_0x54c9dd(_0xf01fe6);});};AGIVertices[_0x6946('0x12')][_0x6946('0x80')]=function(_0x1244ad,_0x3cc6d8,_0x15c792){scripts[_0x6946('0x80')](_0x3cc6d8,_0x1244ad['key'],_0x1244ad[_0x6946('0x81')]||_0x6946('0x5f'),this[_0x6946('0x82')](_0x1244ad['model'])?_0x1244ad[_0x6946('0x83')]:undefined)[_0x6946('0x15')](function(_0x4a6f6b){_0x15c792(null,_0x4a6f6b);})[_0x6946('0x11')](function(_0x2b2637){_0x15c792(_0x2b2637);});};AGIVertices[_0x6946('0x12')][_0x6946('0x84')]=function(_0x25aa12,_0x17a08f){scripts[_0x6946('0x84')](_0x25aa12[_0x6946('0x85')],_0x25aa12[_0x6946('0x86')],_0x25aa12[_0x6946('0x87')],_0x25aa12[_0x6946('0x88')]||'Amy',_0x25aa12[_0x6946('0x5d')],_0x25aa12['aws_text_type']||_0x6946('0x5d'))[_0x6946('0x15')](function(_0xff8aae){_0x17a08f(null,_0xff8aae);})['catch'](function(_0x8ff25d){_0x17a08f(_0x8ff25d);});};AGIVertices['prototype']['awsLex']=function(_0x20d0e9,_0x3ce5e4){scripts[_0x6946('0x89')](this[_0x6946('0x36')][_0x6946('0x37')],_0x20d0e9[_0x6946('0x85')],_0x20d0e9[_0x6946('0x86')],_0x20d0e9['aws_lex_region'],_0x20d0e9[_0x6946('0x5d')],_0x20d0e9['aws_bot_name'])[_0x6946('0x15')](function(_0xd753e8){_0x3ce5e4(null,_0xd753e8);})[_0x6946('0x11')](function(_0x594dd7){_0x3ce5e4(_0x594dd7);});};AGIVertices['prototype'][_0x6946('0x8a')]=function(_0x398c95,_0x41f62,_0x369195){scripts[_0x6946('0x8a')](_0x41f62,_0x398c95['key'],_0x398c95[_0x6946('0x8b')]||_0x6946('0x5f'))[_0x6946('0x15')](function(_0x354ebc){_0x369195(null,_0x354ebc);})[_0x6946('0x11')](function(_0xfd6875){_0x369195(_0xfd6875);});};AGIVertices['prototype']['tildeASR']=function(_0x20703f,_0x28d21c,_0x399ea){scripts['tildeASR'](_0x28d21c,_0x20703f['appid'],_0x20703f[_0x6946('0x8c')],_0x20703f['uri'])[_0x6946('0x15')](function(_0x530575){_0x399ea(null,_0x530575);})[_0x6946('0x11')](function(_0x45ec73){_0x399ea(_0x45ec73);});};AGIVertices[_0x6946('0x12')][_0x6946('0x8d')]=function(_0x37828a){var _0x52ef5c=_[_0x6946('0x67')](verticesWithRetry,_0x37828a[_0x6946('0x8e')])?_0x37828a:_['clone'](_0x37828a);for(var _0x553fed in _0x52ef5c){if(_0x52ef5c['hasOwnProperty'](_0x553fed)){if(_0x52ef5c[_0x553fed]&&_[_0x6946('0x8f')](_0x52ef5c[_0x553fed])){if(_[_0x6946('0x67')](recursiveMapAttributes,_0x553fed)){_0x52ef5c[_0x553fed]=this[_0x6946('0x90')](_0x52ef5c[_0x553fed]);}else{_0x52ef5c[_0x553fed]=this[_0x6946('0x91')](_0x52ef5c[_0x553fed]);}}}}return _0x52ef5c;};AGIVertices['prototype'][_0x6946('0x92')]=function(_0x503e9b){for(var _0x5c3f59 in _0x503e9b){if(_0x503e9b[_0x6946('0x93')](_0x5c3f59)){if(_[_0x6946('0x94')](_0x503e9b[_0x5c3f59])){this['recursiveNodeIndex'](_0x503e9b[_0x5c3f59]);}else if(_['isArray'](_0x503e9b[_0x5c3f59])){for(var _0x42cc48=0x0;_0x42cc48<_0x503e9b[_0x5c3f59][_0x6946('0x95')];_0x42cc48++){this[_0x6946('0x92')](_0x503e9b[_0x5c3f59][_0x42cc48]);}}else if(_[_0x6946('0x8f')](_0x503e9b[_0x5c3f59])){_0x503e9b[_0x5c3f59]=this['replaceAllVariables'](_0x503e9b[_0x5c3f59]);}}}};AGIVertices[_0x6946('0x12')][_0x6946('0x96')]=function(_0x518241,_0x452301){for(var _0x474869 in _0x518241){if(_0x518241[_0x6946('0x93')](_0x474869)){if(_[_0x6946('0x94')](_0x518241[_0x474869])){if(!_[_0x6946('0x43')](_0x518241[_0x474869])){this[_0x6946('0x96')](_0x518241[_0x474869],util['format'](_0x6946('0x97'),_0x452301,_0x474869));}}else if(_[_0x6946('0x98')](_0x518241[_0x474869])){for(var _0xd4970a=0x0;_0xd4970a<_0x518241[_0x474869][_0x6946('0x95')];_0xd4970a++){this[_0x6946('0x96')](_0x518241[_0x474869][_0xd4970a],util['format']('%s.%s',_0x452301,_0x474869+'['+_0xd4970a+']'));}}else{if(!_[_0x6946('0x44')](_0x518241[_0x474869])){this['channel'][_0x6946('0x99')](util[_0x6946('0x28')](_0x6946('0x97'),_0x452301,_0x474869),_0x518241[_0x474869]);}}}}};AGIVertices[_0x6946('0x12')][_0x6946('0x90')]=function(_0x48b46e){try{var _0x4ad412=JSON['parse'](_0x48b46e);this['recursiveNodeIndex'](_0x4ad412);return JSON[_0x6946('0x73')](_0x4ad412);}catch(_0x264b80){return this[_0x6946('0x91')](_0x48b46e);}};AGIVertices['prototype'][_0x6946('0x91')]=function(_0x3e7aff){var _0x398406=_0x3e7aff['split']('{');for(var _0x44f248=0x1;_0x44f248<_0x398406[_0x6946('0x95')];_0x44f248+=0x1){var _0x1d1af=_0x398406[_0x44f248][_0x6946('0x9a')]('}');if(_0x1d1af[_0x6946('0x95')]>0x1){_0x3e7aff=_0x3e7aff['replaceAll']('{'+_0x1d1af[0x0]+'}',this[_0x6946('0x36')][_0x6946('0xf')](_0x1d1af[0x0])['extra']||_0x1d1af[0x0]);}}if(_0x398406[_0x6946('0x95')]===0x1){return _0x3e7aff[_0x6946('0x4c')]();}return this['replaceAllVariables'](_0x3e7aff);};AGIVertices[_0x6946('0x12')]['getAndSetVariable']=function(_0x210f0d,_0x27046a){var _0x13966d=this[_0x6946('0x36')][_0x6946('0xf')](_0x210f0d);if(_0x13966d['result']===-0x1){return _0x13966d;}logger[_0x6946('0x2e')](util['format']('The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s',_0x27046a,_0x13966d['extra']));return this['channel']['setVariable'](_0x27046a,_0x13966d[_0x6946('0x9b')]);};AGIVertices['prototype'][_0x6946('0x82')]=function(_0x5f331b){return _0x5f331b&&_0x5f331b!=='0'&&_0x5f331b!=='-1'&&_0x5f331b!=='';};AGIVertices[_0x6946('0x12')][_0x6946('0x9c')]=function(_0x54cfac){this['createSquareDetailsReport'][_0x6946('0x6e')](this,_0x54cfac,'-');_0x54cfac[_0x6946('0x9d')]=_0x54cfac[_0x6946('0x9c')];return{'code':0xc8,'result':'-'};};AGIVertices['prototype']['agi']=function(_0x1b232f){logger[_0x6946('0x2e')](util[_0x6946('0x28')](_0x6946('0x9e'),_0x1b232f[_0x6946('0x38')]));return this[_0x6946('0x36')][_0x6946('0x9')]([_0x1b232f[_0x6946('0x9f')],_0x1b232f[_0x6946('0xa0')]]);};AGIVertices[_0x6946('0x12')]['answer']=function(_0x286d93){logger['info'](util[_0x6946('0x28')]('Enter\x20in\x20ANSWER\x20(%s)\x20block',_0x286d93['label']));if(this[_0x6946('0x82')](_0x286d93[_0x6946('0x66')])){logger['info'](util[_0x6946('0x28')]('Wait\x20%s\x20seconds\x20before\x20answer',_0x286d93[_0x6946('0x66')]));var _0x50bb73=this[_0x6946('0x36')][_0x6946('0xa1')](_0x286d93['timeout']);if(_0x50bb73[_0x6946('0xa2')]===-0x1){return _0x50bb73;}}return this[_0x6946('0x36')][_0x6946('0xa3')]();};AGIVertices[_0x6946('0x12')][_0x6946('0x4b')]=function(_0x454815){logger['info'](util[_0x6946('0x28')](_0x6946('0xa4'),_0x454815[_0x6946('0x38')]));if(!this[_0x6946('0x82')](_0x454815['list_id'])){return this[_0x6946('0x36')]['error'](_0x454815,_0x6946('0xa5'));}_0x454815[_0x6946('0x4a')]=moment();if(this[_0x6946('0x82')](_0x454815['delay'])){_0x454815[_0x6946('0x4a')]=moment()[_0x6946('0xa6')](_0x454815['delay'],_0x6946('0xa7'));}if(!this['isConfigured'](_0x454815[_0x6946('0x4d')])){_0x454815[_0x6946('0x4d')]=0x2;}this[_0x6946('0x42')][_0x6946('0x6e')](this,_0x454815);return this['channel'][_0x6946('0xa8')](util[_0x6946('0x28')](_0x6946('0xa9'),_0x454815['phone'],_0x454815['list_id'],_0x454815[_0x6946('0x4a')]));};AGIVertices[_0x6946('0x12')][_0x6946('0xaa')]=function(_0xd18277){logger['info'](util[_0x6946('0x28')]('Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block',_0xd18277[_0x6946('0x38')]));var _0x5174d3=this[_0x6946('0x36')]['exec'](_0xd18277[_0x6946('0xab')],_0xd18277[_0x6946('0xac')]);if(_0x5174d3[_0x6946('0xa2')]===-0x1){return _0x5174d3;}return this[_0x6946('0x36')]['noop'](util['format']('Executed\x20command\x20%s\x20%s',_0xd18277[_0x6946('0xab')],_0xd18277[_0x6946('0xac')]));};AGIVertices[_0x6946('0x12')][_0x6946('0xad')]=function(_0x4b1fa5){logger[_0x6946('0x2e')](util[_0x6946('0x28')]('Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block',_0x4b1fa5[_0x6946('0x38')]));if(!this[_0x6946('0x82')](_0x4b1fa5[_0x6946('0x5d')])){return this[_0x6946('0x36')][_0x6946('0xa8')](_0x6946('0xae'));}var _0x15e49b='\x22'+_0x4b1fa5[_0x6946('0x5d')]+'\x22';if(this['isConfigured'](_0x4b1fa5[_0x6946('0xac')])){_0x15e49b+=','+_0x4b1fa5['options'];}var _0x46f977=this[_0x6946('0x36')][_0x6946('0x58')]('MRCPSynth',_0x15e49b);if(_0x46f977[_0x6946('0xa2')]===-0x1){return _0x46f977;}return this['channel'][_0x6946('0xa8')](util[_0x6946('0x28')]('Executed\x20command\x20MRCPSynth\x20%s',_0x15e49b));};AGIVertices[_0x6946('0x12')][_0x6946('0xaf')]=function(_0x201ec1){logger[_0x6946('0x2e')](util[_0x6946('0x28')](_0x6946('0xb0'),_0x201ec1[_0x6946('0x38')]));if(!this[_0x6946('0x82')](_0x201ec1['text'])){return this[_0x6946('0x36')][_0x6946('0xa8')](_0x6946('0xae'));}var _0x24f9f6='\x22'+_0x201ec1[_0x6946('0x5d')]+'\x22';if(this[_0x6946('0x82')](_0x201ec1[_0x6946('0xac')])){_0x24f9f6+=','+_0x201ec1[_0x6946('0xac')];}var _0x388b1b=this[_0x6946('0x36')][_0x6946('0x58')](_0x6946('0xb1'),_0x24f9f6);if(_0x388b1b[_0x6946('0xa2')]===-0x1){return _0x388b1b;}return this['channel'][_0x6946('0xa8')](util[_0x6946('0x28')]('Executed\x20command\x20MRCPSynth\x20%s',_0x24f9f6));};AGIVertices[_0x6946('0x12')][_0x6946('0xb2')]=function(_0x4f0f6f){logger[_0x6946('0x2e')](util[_0x6946('0x28')](_0x6946('0xb3'),_0x4f0f6f[_0x6946('0x38')]));if(!this[_0x6946('0x82')](_0x4f0f6f['grammar'])){return this['channel'][_0x6946('0xa8')]('no\x20grammar\x20configured');}var _0x964870=_0x4f0f6f[_0x6946('0xb4')];if(this['isConfigured'](_0x4f0f6f[_0x6946('0xac')])){_0x964870+=','+_0x4f0f6f[_0x6946('0xac')];}var _0xb42771=this['channel'][_0x6946('0x58')]('MRCPRecog',_0x964870);if(_0xb42771[_0x6946('0xa2')]===-0x1){return _0xb42771;}var _0x169bf1=this[_0x6946('0xb5')]('RECOG_CONFIDENCE()',_0x6946('0xb6'));if(_0x169bf1[_0x6946('0xa2')]===-0x1){return _0x169bf1;}var _0x3fc29c=this['getAndSetVariable']('RECOG_INPUT()',_0x6946('0xb7'));if(_0x3fc29c['result']===-0x1){return _0x3fc29c;}var _0x4ca1b4=this[_0x6946('0xb5')](_0x6946('0xb8'),_0x6946('0xb9'));if(_0x4ca1b4[_0x6946('0xa2')]===-0x1){return _0x4ca1b4;}return this[_0x6946('0x36')][_0x6946('0xa8')](util[_0x6946('0x28')]('Executed\x20command\x20MRCPRecog\x20%s',_0x964870));};AGIVertices[_0x6946('0x12')][_0x6946('0xba')]=function(_0x1464ff){logger[_0x6946('0x2e')](util[_0x6946('0x28')](_0x6946('0xbb'),_0x1464ff[_0x6946('0x38')]));if(!this['isConfigured'](_0x1464ff[_0x6946('0xb4')])){return this[_0x6946('0x36')][_0x6946('0xa8')](_0x6946('0xbc'));}var _0x1b8e5c=_0x1464ff[_0x6946('0xb4')];if(this[_0x6946('0x82')](_0x1464ff[_0x6946('0xac')])){_0x1b8e5c+=','+_0x1464ff[_0x6946('0xac')];}var _0x1afb62=this[_0x6946('0x36')]['exec'](_0x6946('0xbd'),_0x1b8e5c);if(_0x1afb62['result']===-0x1){return _0x1afb62;}var _0x28b657=this[_0x6946('0xb5')](_0x6946('0xbe'),_0x6946('0xbf'));if(_0x28b657['result']===-0x1){return _0x28b657;}var _0x8878a4=this[_0x6946('0xb5')](_0x6946('0xc0'),_0x6946('0xc1'));if(_0x8878a4[_0x6946('0xa2')]===-0x1){return _0x8878a4;}var _0x2344b7=this[_0x6946('0xb5')](_0x6946('0xb8'),_0x6946('0xc2'));if(_0x2344b7[_0x6946('0xa2')]===-0x1){return _0x2344b7;}return this[_0x6946('0x36')][_0x6946('0xa8')](util[_0x6946('0x28')]('Executed\x20command\x20MRCPRecog\x20%s',_0x1b8e5c));};AGIVertices[_0x6946('0x12')][_0x6946('0xc3')]=function(_0x21c2e0){logger[_0x6946('0x2e')](util[_0x6946('0x28')](_0x6946('0xc4'),_0x21c2e0[_0x6946('0x38')]));if(!this[_0x6946('0x82')](_0x21c2e0[_0x6946('0xc5')])){return this['channel']['error'](_0x21c2e0,_0x6946('0xc6'));}var _0x413c73=this[_0x6946('0x19')]['sync'](this,_0x21c2e0[_0x6946('0xc5')]);if(!_0x413c73){return this[_0x6946('0x36')][_0x6946('0x2c')](_0x21c2e0,_0x6946('0xc7'));}if(!this['isConfigured'](_0x21c2e0[_0x6946('0x30')])){return this[_0x6946('0x36')][_0x6946('0x2c')](_0x21c2e0,_0x6946('0xc8'));}var _0x456c71=_0x21c2e0[_0x6946('0x30')][_0x6946('0x59')](/(\r\n|\n|\r)/gm,'\x20');this[_0x6946('0x36')][_0x6946('0xa8')](util[_0x6946('0x28')](_0x6946('0xc9'),_0x456c71));var _0x2cc4bf=this['getQueryOdbc'][_0x6946('0x6e')](this,_0x413c73,_0x456c71);this[_0x6946('0x35')]['sync'](this,_0x21c2e0,_0x456c71);if(!this[_0x6946('0x82')](_0x21c2e0[_0x6946('0xca')])){return this[_0x6946('0x36')][_0x6946('0xa8')](_0x6946('0xcb'));}var _0x2da2aa=this[_0x6946('0xf')][_0x6946('0x6e')](this,_0x21c2e0[_0x6946('0xca')]);if(!_0x2da2aa){return this['channel'][_0x6946('0x2c')](_0x21c2e0,_0x6946('0xcc'));}var _0x4a7fc2=this;_0x2cc4bf[_0x6946('0xcd')](function(_0x106750,_0x21a48c){Object[_0x6946('0xce')](_0x106750)[_0x6946('0xcd')](function(_0x5dd422){_0x4a7fc2[_0x6946('0x36')][_0x6946('0x99')](util['format'](_0x6946('0xcf'),_0x2da2aa,_0x21a48c,_0x5dd422),_0x106750[_0x5dd422]);});});this[_0x6946('0x36')][_0x6946('0x99')](util[_0x6946('0x28')]('%s_ROWS_COUNT',_0x2da2aa),_0x2cc4bf['length']);return this[_0x6946('0x36')]['noop'](util['format'](_0x6946('0xd0'),_0x2da2aa));};AGIVertices[_0x6946('0x12')][_0x6946('0xd1')]=function(_0x92203f){logger[_0x6946('0xd2')](util[_0x6946('0x28')](_0x6946('0xd3'),_0x92203f[_0x6946('0x38')]));if(!this[_0x6946('0x82')](_0x92203f['sip_id'])){return this[_0x6946('0x36')][_0x6946('0x2c')](_0x92203f,'no\x20user\x20selected');}var _0x2e3418=this['getUser'][_0x6946('0x6e')](this,_0x92203f[_0x6946('0xd4')]);if(!_0x2e3418){return this['channel'][_0x6946('0x2c')](_0x92203f,_0x6946('0xd5'));}var _0x3a43b7=this[_0x6946('0x36')][_0x6946('0x58')](_0x6946('0xd6'),[util[_0x6946('0x28')]('SIP/%s',_0x2e3418),_0x92203f[_0x6946('0x66')],_0x92203f['opts'],_0x92203f[_0x6946('0x71')]]);if(_0x3a43b7[_0x6946('0xa2')]===-0x1){return _0x3a43b7;}return this['channel'][_0x6946('0xa8')](util['format'](_0x6946('0xd7'),'DIAL'));};AGIVertices['prototype']['dialogflow']=function(_0x38695d){logger[_0x6946('0x2e')](util[_0x6946('0x28')]('Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block',_0x38695d[_0x6946('0x38')]));if(!this[_0x6946('0x82')](_0x38695d['key'])){return this['channel']['noop'](_0x6946('0xd8'));}if(!this['isConfigured'](_0x38695d[_0x6946('0x5d')])){return this[_0x6946('0x36')][_0x6946('0xa8')](_0x6946('0xae'));}this[_0x6946('0x36')][_0x6946('0xd9')]=!![];this[_0x6946('0x35')](_0x38695d);this[_0x6946('0x41')](_0x38695d[_0x6946('0x5d')],'in');this[_0x6946('0x36')][_0x6946('0xa8')](util['format'](_0x6946('0xda'),_0x38695d['text']));var _0x36b35b=this[_0x6946('0x79')][_0x6946('0x6e')](this,_0x38695d);if(_0x36b35b){for(var _0x13c17c in _0x36b35b){if(_0x36b35b[_0x6946('0x93')](_0x13c17c)){this['channel'][_0x6946('0x99')](util['format'](_0x6946('0xdb'),_0x13c17c[_0x6946('0xdc')]()),_0x36b35b[_0x13c17c]);}}this[_0x6946('0x41')](_0x36b35b[_0x6946('0xdd')],_0x6946('0xde'));return this['channel'][_0x6946('0xa8')](util[_0x6946('0x28')](_0x6946('0xdf'),_0x36b35b['speech']));}return this['channel']['error'](_0x38695d,_0x6946('0xe0'));};AGIVertices[_0x6946('0x12')][_0x6946('0xe1')]=function(_0x4e4d70){logger[_0x6946('0x2e')](util['format'](_0x6946('0xe2'),_0x4e4d70[_0x6946('0x38')]));if(!this[_0x6946('0x82')](_0x4e4d70[_0x6946('0xe3')])){return this[_0x6946('0x36')][_0x6946('0xa8')](_0x6946('0xe4'));}if(!this[_0x6946('0x82')](_0x4e4d70['username'])){return this[_0x6946('0x36')][_0x6946('0xa8')](_0x6946('0xe5'));}if(!this[_0x6946('0x82')](_0x4e4d70['password'])){return this[_0x6946('0x36')][_0x6946('0xa8')]('no\x20password\x20configured');}if(!this[_0x6946('0x82')](_0x4e4d70[_0x6946('0xe6')])){return this[_0x6946('0x36')][_0x6946('0xa8')]('no\x20text\x20configured');}this[_0x6946('0x36')][_0x6946('0xd9')]=!![];this[_0x6946('0x35')](_0x4e4d70);this['createSquareMessage'](_0x4e4d70[_0x6946('0x5d')],'in');this[_0x6946('0x36')][_0x6946('0xa8')](util[_0x6946('0x28')](_0x6946('0xe7'),_0x4e4d70[_0x6946('0x5d')]));var _0x42ef73=this[_0x6946('0x7c')]['sync'](this,_0x4e4d70);if(_0x42ef73){for(var _0xfab6a4 in _0x42ef73){if(_0x42ef73['hasOwnProperty'](_0xfab6a4)){this[_0x6946('0x36')][_0x6946('0x99')](util[_0x6946('0x28')](_0x6946('0xe8'),_0xfab6a4['toUpperCase']()),_0x42ef73[_0xfab6a4]);}}this[_0x6946('0x41')](_0x42ef73['speech'],'out');if(_0x42ef73[_0x6946('0xe9')]){this[_0x6946('0x36')][_0x6946('0xa8')](util[_0x6946('0x28')](_0x6946('0xea'),_0x42ef73['audiofile']));var _0x2840e7=this['channel'][_0x6946('0xeb')](_0x42ef73[_0x6946('0xe9')]);try{fs[_0x6946('0xec')](_0x42ef73[_0x6946('0xe9')]+'.wav');}catch(_0xcc74d5){logger[_0x6946('0x2c')](_0xcc74d5);}return _0x2840e7;}else{return this[_0x6946('0x36')][_0x6946('0xa8')](util[_0x6946('0x28')](_0x6946('0xed'),_0x42ef73[_0x6946('0xdd')]));}}return this[_0x6946('0x36')][_0x6946('0x2c')](_0x4e4d70,'SestekNDA\x20is\x20unreachable');};AGIVertices[_0x6946('0x12')]['end']=function(_0x11d75b){logger[_0x6946('0x2e')](util[_0x6946('0x28')](_0x6946('0xee'),_0x11d75b[_0x6946('0x38')]));return this[_0x6946('0x36')][_0x6946('0xa8')](_0x6946('0xef'));};AGIVertices[_0x6946('0x12')][_0x6946('0xf0')]=function(_0x4a9be6){logger[_0x6946('0x2e')](util[_0x6946('0x28')](_0x6946('0xf1'),_0x4a9be6[_0x6946('0x38')]));var _0x2208ca='';if(_0x4a9be6[_0x6946('0xf2')]){if(!this[_0x6946('0x82')](_0x4a9be6[_0x6946('0xf2')])){return this[_0x6946('0x36')][_0x6946('0x2c')](_0x4a9be6,'no\x20trunk\x20selected');}else{var _0x5c7468=parseInt(_0x4a9be6[_0x6946('0xf2')],0xa);if(isNaN(_0x5c7468)){_0x2208ca=_0x4a9be6[_0x6946('0xf2')];}else{_0x2208ca=this[_0x6946('0x1d')][_0x6946('0x6e')](this,_0x4a9be6[_0x6946('0xf2')]);if(!_0x2208ca){return this[_0x6946('0x36')][_0x6946('0x2c')](_0x4a9be6,_0x6946('0xf3'));}}}}else if(_0x4a9be6[_0x6946('0xf4')]){_0x2208ca=_0x4a9be6[_0x6946('0xf4')];}else{return this['channel'][_0x6946('0x2c')](_0x4a9be6,_0x6946('0xf5'));}var _0x5a3758=this['channel']['exec'](_0x6946('0xd6'),[util['format'](_0x6946('0xf6'),_0x2208ca,_0x4a9be6[_0x6946('0x48')]),_0x4a9be6[_0x6946('0x66')],_0x4a9be6[_0x6946('0xf7')],_0x4a9be6[_0x6946('0x71')]]);if(_0x5a3758[_0x6946('0xa2')]===-0x1){return _0x5a3758;}return this[_0x6946('0x36')][_0x6946('0xa8')](util[_0x6946('0x28')](_0x6946('0xd7'),_0x6946('0xd6')));};AGIVertices[_0x6946('0x12')][_0x6946('0xf8')]=function(_0x55a8f4){logger['info'](util[_0x6946('0x28')](_0x6946('0xf9'),_0x55a8f4['label']));return this[_0x6946('0x36')][_0x6946('0xa8')](_0x6946('0xf8'));};AGIVertices['prototype'][_0x6946('0xd')]=function(_0x2e3085){logger['info'](util['format'](_0x6946('0xfa'),_0x2e3085[_0x6946('0x38')]));if(_0x2e3085[_0x6946('0x9d')]===0x0){return this[_0x6946('0x9c')](_0x2e3085);}_0x2e3085[_0x6946('0x9d')]-=0x1;if(!this[_0x6946('0x82')](_0x2e3085[_0x6946('0xfb')])){return this[_0x6946('0x36')][_0x6946('0x2c')](_0x2e3085,_0x6946('0xfc'));}var _0x5474b4=this[_0x6946('0x1f')][_0x6946('0x6e')](this,_0x2e3085[_0x6946('0xfb')]);if(!_0x5474b4){return this[_0x6946('0x36')][_0x6946('0x2c')](_0x2e3085,'no\x20file\x20audio\x20found');}if(!this[_0x6946('0x82')](_0x2e3085[_0x6946('0xca')])){return this[_0x6946('0x36')][_0x6946('0x2c')](_0x6946('0xcb'));}var _0xc693e=this[_0x6946('0x36')][_0x6946('0xfd')](_0x5474b4,_0x2e3085['response'],_0x2e3085[_0x6946('0xfe')]);var _0x2d8dbc=_0xc693e[_0x6946('0xa2')]?_0xc693e[_0x6946('0xa2')]['toString']():'';logger[_0x6946('0x2e')](_0x6946('0xff'),JSON[_0x6946('0x73')](_0xc693e));if(_0xc693e['result']===-0x1){this[_0x6946('0x35')][_0x6946('0x6e')](this,_0x2e3085,_0x2d8dbc);return _0xc693e;}else if(_0xc693e['extra']===_0x6946('0x66')){_0xc693e['result']=_0x2d8dbc[_0x6946('0x95')]>=parseInt(_0x2e3085[_0x6946('0x100')])?'x':'i';}else{_0xc693e['result']=_0x2d8dbc[_0x6946('0x95')]>=parseInt(_0x2e3085[_0x6946('0x100')])&&_0x2d8dbc['length']<=parseInt(_0x2e3085[_0x6946('0xfe')])?'x':'i';}var _0x23c0f2=this[_0x6946('0xf')][_0x6946('0x6e')](this,_0x2e3085['variable_id']);if(!_0x23c0f2){return this[_0x6946('0x36')][_0x6946('0x2c')](_0x2e3085,'no\x20variable\x20found');}this[_0x6946('0x36')][_0x6946('0x99')](_0x23c0f2,_0x2d8dbc);if(this['isConfigured'](_0x2e3085[_0x6946('0x101')])){var _0x9e6ac1=parseInt(_0x2e3085[_0x6946('0x101')],0xa);var _0x3dbc92=rs[_0x6946('0x102')]({'charset':'*','length':_0x9e6ac1});var _0x330947=_0x2d8dbc[_0x6946('0x95')];if(_0x330947>0x0){if(_0x330947>_0x9e6ac1){this['createSquareDetailsReport']['sync'](this,_0x2e3085,_0x2e3085['hiddendigitspos']===_0x6946('0x103')?_0x3dbc92+_0x2d8dbc['substr'](_0x9e6ac1):_0x2d8dbc[_0x6946('0x104')](0x0,_0x330947-_0x9e6ac1)+_0x3dbc92);}else{this[_0x6946('0x35')][_0x6946('0x6e')](this,_0x2e3085,rs[_0x6946('0x102')]({'charset':'*','length':_0x330947}));}}else{this[_0x6946('0x35')][_0x6946('0x6e')](this,_0x2e3085,'');}}else{this[_0x6946('0x35')][_0x6946('0x6e')](this,_0x2e3085,_0x2d8dbc);}return _0xc693e;};AGIVertices[_0x6946('0x12')]['getsecretdigits']=function(_0x4a7cf8){logger[_0x6946('0x2e')](util[_0x6946('0x28')]('Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block',_0x4a7cf8[_0x6946('0x38')]));return this['getdigits'](_0x4a7cf8);};AGIVertices[_0x6946('0x12')]['goal']=function(_0x31610f){logger['info'](util[_0x6946('0x28')](_0x6946('0x105'),_0x31610f[_0x6946('0x38')]));this['createSquareDetailsReport'][_0x6946('0x6e')](this,_0x31610f,_0x31610f[_0x6946('0x106')]);return this[_0x6946('0x36')]['noop'](util[_0x6946('0x28')](_0x6946('0x107'),_0x31610f[_0x6946('0x106')]));};AGIVertices[_0x6946('0x12')][_0x6946('0x108')]=function(_0x38ffb6){logger[_0x6946('0x2e')](util[_0x6946('0x28')](_0x6946('0x109'),_0x38ffb6['label']));if(!this[_0x6946('0x82')](_0x38ffb6[_0x6946('0x85')])||!this['isConfigured'](_0x38ffb6[_0x6946('0x86')])){return this['channel']['noop'](_0x6946('0x10a'));}if(!this[_0x6946('0x82')](_0x38ffb6[_0x6946('0x5d')])){return this[_0x6946('0x36')][_0x6946('0xa8')](_0x6946('0xae'));}this[_0x6946('0x36')][_0x6946('0xa8')](util[_0x6946('0x28')](_0x6946('0x10b'),_0x38ffb6[_0x6946('0x5d')]));var _0x131d57=this[_0x6946('0x84')][_0x6946('0x6e')](this,_0x38ffb6);if(_0x131d57){this[_0x6946('0x36')]['noop'](util[_0x6946('0x28')]('aws\x20Polly\x20%s\x20file\x20created',_0x131d57));var _0x39d4a8=this[_0x6946('0x36')]['streamFile'](_0x131d57);try{fs['unlink'](_0x131d57+_0x6946('0x10c'));}catch(_0x456f22){logger[_0x6946('0x2c')](_0x456f22);}return _0x39d4a8;}return this[_0x6946('0x36')][_0x6946('0x2c')](_0x38ffb6,'aws\x20Polly\x20is\x20unreachable');};AGIVertices['prototype'][_0x6946('0x10d')]=function(_0x5f0c84){logger[_0x6946('0x2e')](util[_0x6946('0x28')]('Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block',_0x5f0c84['label']));if(!this[_0x6946('0x82')](_0x5f0c84[_0x6946('0x85')])||!this[_0x6946('0x82')](_0x5f0c84[_0x6946('0x86')])){return this[_0x6946('0x36')][_0x6946('0xa8')](_0x6946('0x10a'));}if(!this[_0x6946('0x82')](_0x5f0c84[_0x6946('0x10e')])){return this[_0x6946('0x36')][_0x6946('0xa8')](_0x6946('0x10f'));}if(!this[_0x6946('0x82')](_0x5f0c84[_0x6946('0x5d')])){return this[_0x6946('0x36')][_0x6946('0xa8')]('no\x20text\x20configured');}this['channel']['bot']=!![];this[_0x6946('0x35')](_0x5f0c84);this[_0x6946('0x41')](_0x5f0c84[_0x6946('0x5d')],'in');this[_0x6946('0x36')]['noop'](util[_0x6946('0x28')](_0x6946('0x110'),_0x5f0c84[_0x6946('0x5d')]));var _0x2e8da9=this[_0x6946('0x89')][_0x6946('0x6e')](this,_0x5f0c84);if(_0x2e8da9){for(var _0x30cd03 in _0x2e8da9){if(_0x2e8da9[_0x6946('0x93')](_0x30cd03)&&_[_0x6946('0x8f')](_0x2e8da9[_0x30cd03])){this[_0x6946('0x36')][_0x6946('0x99')](util[_0x6946('0x28')](_0x6946('0x111'),_0x30cd03['toUpperCase']()),_0x2e8da9[_0x30cd03]);}}if(_[_0x6946('0x44')](_0x2e8da9[_0x6946('0x77')])){return this[_0x6946('0x36')]['noop'](_0x6946('0x112'));}else{this[_0x6946('0x41')](_0x2e8da9[_0x6946('0x77')],_0x6946('0xde'));return this[_0x6946('0x36')][_0x6946('0xa8')](util[_0x6946('0x28')](_0x6946('0x113'),_0x2e8da9[_0x6946('0x77')]));}}return this[_0x6946('0x36')][_0x6946('0x2c')](_0x5f0c84,_0x6946('0x114'));};AGIVertices[_0x6946('0x12')][_0x6946('0x115')]=function(_0x252ec1){logger['info'](util['format'](_0x6946('0x116'),_0x252ec1['label'],_0x252ec1[_0x6946('0x66')]));if(!this[_0x6946('0x82')](_0x252ec1[_0x6946('0x7a')])){return this['channel']['noop'](_0x6946('0xd8'));}var _0x1f5dc9=_0x6946('0x117');var _0x3ddcf7=util['format']('%s/recordings/%s',FILES_PATH,rs[_0x6946('0x102')](0x4));var _0x24a23f=util[_0x6946('0x28')]('%s.%s',_0x3ddcf7,_0x1f5dc9);var _0x45ffca=!![];if(_0x252ec1[_0x6946('0x118')]===_0x6946('0x119')){_0x45ffca=![];}var _0x49f8c8=this['channel']['recordFile'](_0x3ddcf7,_0x1f5dc9,_0x252ec1[_0x6946('0x11a')],_0x252ec1[_0x6946('0x66')],undefined,_0x45ffca);if(_0x49f8c8[_0x6946('0xa2')]!==-0x1){this[_0x6946('0x36')]['noop'](util[_0x6946('0x28')](_0x6946('0x11b'),_0x24a23f));var _0x18032a=this[_0x6946('0x8a')][_0x6946('0x6e')](this,_0x252ec1,_0x24a23f);if(_0x18032a){for(var _0xd2076 in _0x18032a){if(_0x18032a[_0x6946('0x93')](_0xd2076)){this['channel'][_0x6946('0x99')](util[_0x6946('0x28')]('GOOGLE_ASR_%s',_0xd2076[_0x6946('0xdc')]()),_0x18032a[_0xd2076]);}}return this[_0x6946('0x36')]['noop'](util['format'](_0x6946('0x11c'),JSON['stringify'](_0x18032a)));}}return _0x49f8c8;};AGIVertices[_0x6946('0x12')][_0x6946('0x11d')]=function(_0x1bc6b8){logger[_0x6946('0x2e')](util[_0x6946('0x28')](_0x6946('0x11e'),_0x1bc6b8['label']));if(!this[_0x6946('0x82')](_0x1bc6b8['appid'])){return this[_0x6946('0x36')][_0x6946('0xa8')](_0x6946('0x11f'));}if(!this[_0x6946('0x82')](_0x1bc6b8[_0x6946('0x8c')])){return this[_0x6946('0x36')][_0x6946('0xa8')](_0x6946('0x120'));}var _0x3ef4a6=_0x6946('0x117');var _0x505315=util['format'](_0x6946('0x121'),FILES_PATH,rs[_0x6946('0x102')](0x4));var _0x57018f=util[_0x6946('0x28')](_0x6946('0x97'),_0x505315,_0x3ef4a6);var _0x36ee4c=!![];if(_0x1bc6b8[_0x6946('0x118')]===_0x6946('0x119')){_0x36ee4c=![];}var _0x14085c=this['channel'][_0x6946('0x122')](_0x505315,_0x3ef4a6,_0x1bc6b8[_0x6946('0x11a')],_0x1bc6b8['timeout'],undefined,_0x36ee4c);if(_0x14085c['result']!==-0x1){this[_0x6946('0x36')]['noop'](util[_0x6946('0x28')]('tilde\x20%s\x20file\x20created',_0x57018f));var _0x2586be=this[_0x6946('0x123')]['sync'](this,_0x1bc6b8,_0x57018f);if(_0x2586be){for(var _0x5e3825 in _0x2586be){if(_0x2586be[_0x6946('0x93')](_0x5e3825)){this[_0x6946('0x36')][_0x6946('0x99')](util['format'](_0x6946('0x124'),_0x5e3825[_0x6946('0xdc')]()),_0x2586be[_0x5e3825]);}}return this[_0x6946('0x36')][_0x6946('0xa8')](util[_0x6946('0x28')](_0x6946('0x125'),JSON[_0x6946('0x73')](_0x2586be)));}}return _0x14085c;};AGIVertices[_0x6946('0x12')][_0x6946('0x126')]=function(_0x3a9983){logger[_0x6946('0x2e')](util['format']('Enter\x20in\x20GOTO\x20(%s)\x20block',_0x3a9983[_0x6946('0x38')]));return this[_0x6946('0x36')][_0x6946('0x127')](_0x3a9983[_0x6946('0x3d')],_0x3a9983['extension'],_0x3a9983[_0x6946('0x128')]);};AGIVertices[_0x6946('0x12')][_0x6946('0x129')]=function(_0x1025b6){logger[_0x6946('0x2e')](util[_0x6946('0x28')]('Enter\x20in\x20GOTOIF\x20(%s)\x20block',_0x1025b6[_0x6946('0x38')]));if(!this[_0x6946('0x82')](_0x1025b6[_0x6946('0x12a')])){return this[_0x6946('0x36')][_0x6946('0x2c')](_0x1025b6,_0x6946('0x12b'));}try{var _0x1e4ad1=eval(_0x1025b6[_0x6946('0x12a')])?'true':_0x6946('0x12c');this[_0x6946('0x36')][_0x6946('0xa8')](util[_0x6946('0x28')](_0x6946('0x12d'),_0x1025b6[_0x6946('0x12a')],_0x1e4ad1));return{'code':0xc8,'result':_0x1e4ad1};}catch(_0x26a7dd){return{'code':0xc8,'result':_0x6946('0x12c')};}};AGIVertices[_0x6946('0x12')]['gotoiftime']=function(_0x3a2780){logger[_0x6946('0x2e')](util['format'](_0x6946('0x12e'),_0x3a2780[_0x6946('0x38')]));if(!this[_0x6946('0x82')](_0x3a2780[_0x6946('0x12f')])){return this['channel'][_0x6946('0x2c')](_0x3a2780,'no\x20interval\x20configured');}var _0x319251=this[_0x6946('0x24')][_0x6946('0x6e')](this,_0x3a2780['interval_id']);if(!_0x319251){return this[_0x6946('0x36')][_0x6946('0x2c')](_0x3a2780,_0x6946('0x130'));}for(var _0x57a6b3=0x0;_0x57a6b3<_0x319251[_0x6946('0x95')];_0x57a6b3+=0x1){var _0x56e0bd=this['channel'][_0x6946('0xf')](util[_0x6946('0x28')](_0x6946('0x131'),_0x319251[_0x57a6b3]));if(_0x56e0bd[_0x6946('0xa2')]===-0x1){return _0x56e0bd;}logger[_0x6946('0x2e')](util[_0x6946('0x28')]('IFTIME\x20%s\x20%s',_0x319251[_0x57a6b3],_0x56e0bd['extra']));if(_0x56e0bd[_0x6946('0x9b')]==='true'){logger[_0x6946('0x2e')](util[_0x6946('0x28')]('IFTIME\x20%s\x20%s',_0x319251[_0x57a6b3],_0x6946('0x132')));this[_0x6946('0x36')][_0x6946('0xa8')](util[_0x6946('0x28')](_0x6946('0x133'),_0x319251[_0x57a6b3],_0x6946('0x132')));return{'code':0xc8,'result':'true'};}else{logger[_0x6946('0x2e')](util[_0x6946('0x28')](_0x6946('0x133'),_0x319251[_0x57a6b3],_0x6946('0x12c')));this[_0x6946('0x36')]['noop'](util[_0x6946('0x28')](_0x6946('0x133'),_0x319251[_0x57a6b3],'false'));}}return{'code':0xc8,'result':_0x6946('0x12c')};};AGIVertices[_0x6946('0x12')][_0x6946('0x134')]=function(_0x139902){logger['info'](util[_0x6946('0x28')]('Enter\x20in\x20HANGUP\x20(%s)\x20block',_0x139902[_0x6946('0x38')]));return this[_0x6946('0x36')][_0x6946('0x134')]();};AGIVertices[_0x6946('0x12')][_0x6946('0x135')]=function(_0x4fe6d4){logger[_0x6946('0x2e')](util[_0x6946('0x28')](_0x6946('0x136'),_0x4fe6d4['label']));if(!this[_0x6946('0x82')](_0x4fe6d4[_0x6946('0x7a')])){return this[_0x6946('0x36')][_0x6946('0xa8')](_0x6946('0xd8'));}var _0x774564=_0x6946('0x117');var _0x5736e9=util[_0x6946('0x28')](_0x6946('0x121'),FILES_PATH,rs[_0x6946('0x102')](0x4));var _0x439e85=util[_0x6946('0x28')](_0x6946('0x97'),_0x5736e9,_0x774564);var _0x154ab7=!![];if(_0x4fe6d4[_0x6946('0x118')]==='NOBEEP'){_0x154ab7=![];}var _0xc85843=this['channel'][_0x6946('0x122')](_0x5736e9,_0x774564,_0x4fe6d4[_0x6946('0x11a')],_0x4fe6d4[_0x6946('0x66')],undefined,_0x154ab7);if(_0xc85843[_0x6946('0xa2')]!==-0x1){this[_0x6946('0x36')][_0x6946('0xa8')](util['format'](_0x6946('0x137'),_0x439e85));var _0x4f438a=this[_0x6946('0x80')][_0x6946('0x6e')](this,_0x4fe6d4,_0x439e85);if(_0x4f438a){for(var _0x5e0a66 in _0x4f438a){if(_0x4f438a[_0x6946('0x93')](_0x5e0a66)){this[_0x6946('0x36')][_0x6946('0x99')](util[_0x6946('0x28')](_0x6946('0x138'),_0x5e0a66['toUpperCase']()),_0x4f438a[_0x5e0a66]);}}return this[_0x6946('0x36')]['noop'](util[_0x6946('0x28')](_0x6946('0x139'),JSON[_0x6946('0x73')](_0x4f438a)));}}return _0xc85843;};AGIVertices[_0x6946('0x12')][_0x6946('0x13a')]=function(_0x43118f){logger['info'](util['format'](_0x6946('0x13b'),_0x43118f[_0x6946('0x38')]));if(!this[_0x6946('0x82')](_0x43118f['key'])){return this['channel'][_0x6946('0xa8')](_0x6946('0xd8'));}if(!this[_0x6946('0x82')](_0x43118f['text'])){return this['channel']['noop']('no\x20text\x20configured');}this['channel'][_0x6946('0xa8')](util[_0x6946('0x28')](_0x6946('0x13c'),_0x43118f['text']));var _0x416e5f=this[_0x6946('0x7d')]['sync'](this,_0x43118f);if(_0x416e5f){this[_0x6946('0x36')][_0x6946('0xa8')](util[_0x6946('0x28')](_0x6946('0x137'),_0x416e5f));var _0x4af08f=this[_0x6946('0x36')][_0x6946('0xeb')](_0x416e5f,_0x43118f[_0x6946('0x11a')]);try{fs[_0x6946('0xec')](_0x416e5f+_0x6946('0x10c'));}catch(_0x113d7e){logger[_0x6946('0x2c')](_0x113d7e);}return _0x4af08f;}return this[_0x6946('0x36')]['error'](_0x43118f,_0x6946('0x13d'));};AGIVertices['prototype'][_0x6946('0x13e')]=function(_0x14e2c4){logger['info'](util['format']('Enter\x20in\x20LOGIN\x20(%s)\x20block',_0x14e2c4['label']));if(!this['isConfigured'](_0x14e2c4[_0x6946('0x13f')])){return this['channel'][_0x6946('0x2c')](_0x14e2c4,'no\x20find\x20by\x20configured');}logger[_0x6946('0x2e')](util[_0x6946('0x28')](_0x6946('0x140'),this['channel']['callerid'],_0x14e2c4[_0x6946('0x13f')]));var _0x405e93=this['agentLogin'][_0x6946('0x6e')](this,_0x14e2c4['findBy']);if(_0x405e93){logger[_0x6946('0x2e')](util[_0x6946('0x28')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x6946('0x36')][_0x6946('0x3b')],_0x14e2c4[_0x6946('0x13f')]));this[_0x6946('0x36')][_0x6946('0xa8')](util[_0x6946('0x28')](_0x6946('0x141'),this[_0x6946('0x36')][_0x6946('0x3b')],_0x14e2c4['findBy']));return{'code':0xc8,'result':'success'};}else{logger[_0x6946('0x2e')](util[_0x6946('0x28')](_0x6946('0x142'),this[_0x6946('0x36')]['callerid'],_0x14e2c4['findBy']));this[_0x6946('0x36')][_0x6946('0xa8')](util['format'](_0x6946('0x142'),this['channel']['callerid'],_0x14e2c4[_0x6946('0x13f')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x6946('0x12')][_0x6946('0x143')]=function(_0x1a0e73){logger[_0x6946('0x2e')](util['format'](_0x6946('0x144'),_0x1a0e73[_0x6946('0x38')]));if(!this[_0x6946('0x82')](_0x1a0e73['findBy'])){return this['channel'][_0x6946('0x2c')](_0x1a0e73,'no\x20find\x20by\x20configured');}logger[_0x6946('0x2e')](util[_0x6946('0x28')](_0x6946('0x140'),this[_0x6946('0x36')][_0x6946('0x3b')],_0x1a0e73['findBy']));var _0x1f128c=this[_0x6946('0x52')]['sync'](this,_0x1a0e73[_0x6946('0x13f')]);if(_0x1f128c){logger['info'](util[_0x6946('0x28')](_0x6946('0x141'),this[_0x6946('0x36')]['callerid'],_0x1a0e73[_0x6946('0x13f')]));this[_0x6946('0x36')]['noop'](util[_0x6946('0x28')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x6946('0x36')]['callerid'],_0x1a0e73[_0x6946('0x13f')]));return{'code':0xc8,'result':'success'};}else{logger['info'](util[_0x6946('0x28')](_0x6946('0x142'),this[_0x6946('0x36')]['callerid'],_0x1a0e73['findBy']));this[_0x6946('0x36')][_0x6946('0xa8')](util[_0x6946('0x28')](_0x6946('0x142'),this['channel'][_0x6946('0x3b')],_0x1a0e73[_0x6946('0x13f')]));return{'code':0xc8,'result':_0x6946('0x145')};}};AGIVertices[_0x6946('0x12')][_0x6946('0x146')]=function(_0x483eb1){logger[_0x6946('0x2e')](util[_0x6946('0x28')]('Enter\x20in\x20MATH\x20(%s)\x20block',_0x483eb1['label']));if(!this[_0x6946('0x82')](_0x483eb1[_0x6946('0x147')])){return this['channel'][_0x6946('0x2c')](_0x483eb1,_0x6946('0x148'));}this[_0x6946('0x36')][_0x6946('0xa8')](util[_0x6946('0x28')]('math\x20%s',_0x483eb1[_0x6946('0x147')]));var _0x1bd03f=eval(_0x483eb1[_0x6946('0x147')]);if(!this[_0x6946('0x82')](_0x483eb1[_0x6946('0xca')])){return this['channel'][_0x6946('0xa8')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0xf72904=this['getVariable'][_0x6946('0x6e')](this,_0x483eb1[_0x6946('0xca')]);if(!_0xf72904){return this[_0x6946('0x36')][_0x6946('0x2c')](_0x483eb1,'no\x20variable\x20found');}if(_[_0x6946('0x98')](_0x1bd03f)){var _0x441a73=this;_0x1bd03f[_0x6946('0xcd')](function(_0x369c64,_0x4a9461){_0x441a73['channel'][_0x6946('0x99')](util[_0x6946('0x28')]('%s[%s]',_0xf72904,_0x4a9461),_0x369c64);});return this[_0x6946('0x36')][_0x6946('0xa8')](util['format'](_0x6946('0x149'),_0xf72904));}else{return this[_0x6946('0x36')][_0x6946('0x99')](_0xf72904,_0x1bd03f);}};AGIVertices[_0x6946('0x12')][_0x6946('0x14a')]=function(_0x56f811){logger['info'](util['format'](_0x6946('0x14b'),_0x56f811[_0x6946('0x38')]));if(_0x56f811[_0x6946('0x9d')]===0x0){return this[_0x6946('0x9c')](_0x56f811);}_0x56f811['retry']-=0x1;if(!this[_0x6946('0x82')](_0x56f811['file_id'])){return this[_0x6946('0x36')][_0x6946('0x2c')](_0x56f811,_0x6946('0xfc'));}var _0x258af4=this[_0x6946('0x1f')][_0x6946('0x6e')](this,_0x56f811[_0x6946('0xfb')]);if(!_0x258af4){return this[_0x6946('0x36')][_0x6946('0x2c')](_0x56f811,'no\x20file\x20audio\x20found');}var _0x3e54d3=this['channel'][_0x6946('0xfd')](_0x258af4,_0x56f811[_0x6946('0x14c')],_0x56f811['digit']);var _0x3235a1=_0x3e54d3['result'];if(_0x3e54d3[_0x6946('0xa2')]===-0x1){this['createSquareDetailsReport'][_0x6946('0x6e')](this,_0x56f811,'-1');return _0x3e54d3;}else if(_0x3e54d3[_0x6946('0x9b')]===_0x6946('0x66')){_0x3e54d3[_0x6946('0xa2')]=_0x3e54d3[_0x6946('0xa2')][_0x6946('0x95')]>0x0?_0x3e54d3[_0x6946('0xa2')]:'t';}else if(_['isEmpty'](_0x3e54d3[_0x6946('0xa2')])){_0x3e54d3['result']='#';_0x3235a1='#';}if(!this['isConfigured'](_0x56f811[_0x6946('0xca')])){this[_0x6946('0x36')]['noop']('no\x20variable\x20selected\x20for\x20the\x20result');}else{var _0x5db068=this['getVariable'][_0x6946('0x6e')](this,_0x56f811[_0x6946('0xca')]);if(!_0x5db068){return this['channel'][_0x6946('0x2c')](_0x56f811,_0x6946('0xcc'));}this[_0x6946('0x36')][_0x6946('0x99')](_0x5db068,_0x3235a1);}this[_0x6946('0x35')][_0x6946('0x6e')](this,_0x56f811,_0x3235a1);return _0x3e54d3;};AGIVertices['prototype']['noop']=function(_0x250af1){logger['info'](util[_0x6946('0x28')](_0x6946('0x14d'),_0x250af1[_0x6946('0x38')]));return this['channel'][_0x6946('0xa8')](_0x250af1[_0x6946('0x14e')]||_0x250af1['label']);};AGIVertices[_0x6946('0x12')][_0x6946('0x14f')]=function(_0x3e55f8){logger['info'](util[_0x6946('0x28')](_0x6946('0x150'),_0x3e55f8[_0x6946('0x38')]));if(!this['isConfigured'](_0x3e55f8[_0x6946('0x13f')])){return this[_0x6946('0x36')][_0x6946('0x2c')](_0x3e55f8,_0x6946('0x151'));}logger['info'](util['format'](_0x6946('0x140'),this[_0x6946('0x36')][_0x6946('0x3b')],_0x3e55f8[_0x6946('0x13f')]));var _0x4de960=this['getPause'][_0x6946('0x6e')](this,_0x3e55f8['pause_id']);var _0x1aa725=this[_0x6946('0x152')][_0x6946('0x6e')](this,_0x3e55f8[_0x6946('0x13f')],_0x4de960);if(_0x1aa725){logger[_0x6946('0x2e')](util[_0x6946('0x28')](_0x6946('0x141'),this[_0x6946('0x36')][_0x6946('0x3b')],_0x3e55f8['findBy']));this[_0x6946('0x36')][_0x6946('0xa8')](util['format'](_0x6946('0x141'),this[_0x6946('0x36')]['callerid'],_0x3e55f8[_0x6946('0x13f')]));return{'code':0xc8,'result':_0x6946('0x153')};}else{logger[_0x6946('0x2e')](util[_0x6946('0x28')](_0x6946('0x142'),this['channel'][_0x6946('0x3b')],_0x3e55f8[_0x6946('0x13f')]));this[_0x6946('0x36')][_0x6946('0xa8')](util[_0x6946('0x28')](_0x6946('0x141'),this[_0x6946('0x36')]['callerid'],_0x3e55f8[_0x6946('0x13f')]));return{'code':0xc8,'result':_0x6946('0x145')};}};AGIVertices[_0x6946('0x12')][_0x6946('0x154')]=function(_0x591006){logger[_0x6946('0x2e')](util[_0x6946('0x28')]('Enter\x20in\x20PLAYBACK\x20(%s)\x20block',_0x591006[_0x6946('0x38')]));if(!this[_0x6946('0x82')](_0x591006['file_id'])){return this[_0x6946('0x36')][_0x6946('0x2c')](_0x591006,_0x6946('0xfc'));}var _0x357027=this[_0x6946('0x1f')][_0x6946('0x6e')](this,_0x591006[_0x6946('0xfb')]);if(!_0x357027){return this[_0x6946('0x36')][_0x6946('0x2c')](_0x591006,'no\x20file\x20audio\x20found');}var _0x2b943c=this[_0x6946('0x36')]['exec'](_0x6946('0x155'),[_0x357027,_0x591006[_0x6946('0xf7')]]);if(_0x2b943c['result']===-0x1){return _0x2b943c;}return this[_0x6946('0x36')]['noop'](util[_0x6946('0x28')](_0x6946('0x156'),_0x6946('0x155'),_0x357027));};AGIVertices['prototype']['queue']=function(_0x29b425){logger['info'](util[_0x6946('0x28')](_0x6946('0x157'),_0x29b425['label']));if(!this[_0x6946('0x82')](_0x29b425['queue_id'])){return this[_0x6946('0x36')][_0x6946('0x2c')](_0x29b425,'no\x20queue\x20selected');}var _0x271cd5='';var _0x166cd5=parseInt(_0x29b425['queue_id'],0xa);if(isNaN(_0x166cd5)){_0x271cd5=_0x29b425[_0x6946('0x158')];}else{_0x271cd5=this[_0x6946('0x13')]['sync'](this,_0x29b425[_0x6946('0x158')]);if(!_0x271cd5){return this[_0x6946('0x36')][_0x6946('0x2c')](_0x29b425,_0x6946('0x159'));}}var _0xe9835a='';if(this[_0x6946('0x82')](_0x29b425[_0x6946('0xfb')])){var _0x450e2f=this[_0x6946('0x1f')][_0x6946('0x6e')](this,_0x29b425[_0x6946('0xfb')]);if(_0x450e2f){_0xe9835a=_0x450e2f;}}this[_0x6946('0x35')][_0x6946('0x6e')](this,_0x29b425,_0x271cd5);if(_0x29b425['opts']['indexOf']('x')<0x0){_0x29b425[_0x6946('0xf7')]+='x';}if(_0x29b425[_0x6946('0xf7')][_0x6946('0x15a')]('X')<0x0){_0x29b425[_0x6946('0xf7')]+='X';}this[_0x6946('0x36')][_0x6946('0x99')](_0x6946('0x15b'),_0x271cd5?_0x271cd5[_0x6946('0x15c')]():'');var _0x178a1f=this[_0x6946('0x36')][_0x6946('0x58')]('QUEUE',[_0x271cd5,_0x29b425[_0x6946('0xf7')],_0x29b425[_0x6946('0x71')],_0xe9835a,_0x29b425[_0x6946('0x66')],_0x29b425[_0x6946('0x9')],_0x29b425[_0x6946('0x15d')],_0x29b425[_0x6946('0x15e')],'',_0x29b425[_0x6946('0x15f')]]);if(_0x178a1f['result']===-0x1){return _0x178a1f;}return this[_0x6946('0x36')][_0x6946('0xa8')](util[_0x6946('0x28')](_0x6946('0x156'),_0x6946('0x160'),_0x271cd5));};AGIVertices[_0x6946('0x12')][_0x6946('0x161')]=function(_0x3b9202){logger[_0x6946('0x2e')](util[_0x6946('0x28')](_0x6946('0x162'),_0x3b9202[_0x6946('0x38')]));var _0x1310a4=_0x3b9202[_0x6946('0x163')]||_0x6946('0x117');var _0x20892e=util[_0x6946('0x28')](_0x6946('0x164'),this['channel'][_0x6946('0x37')],rs[_0x6946('0x102')](0x5));var _0x498a83=util['format'](_0x6946('0x165'),FILES_PATH,_0x20892e,_0x1310a4);var _0x482c0a=util['format']('%s/recordings/%s',FILES_PATH,_0x20892e);this['createSquareRecording']['sync'](this,_0x3b9202,_0x20892e,_0x498a83);this[_0x6946('0x36')][_0x6946('0x99')](_0x6946('0x166'),_0x20892e);logger[_0x6946('0x2e')]('Recording\x20%s\x20%s\x20%s\x20%s',_0x482c0a,_0x1310a4,_0x3b9202[_0x6946('0x167')],_0x3b9202[_0x6946('0x66')]);return this[_0x6946('0x36')][_0x6946('0x122')](_0x482c0a,_0x1310a4,_0x3b9202[_0x6946('0x167')],_0x3b9202['timeout'],undefined,!![]);};AGIVertices[_0x6946('0x12')][_0x6946('0x168')]=function(_0x47b9ef){logger['info'](util[_0x6946('0x28')](_0x6946('0x169'),_0x47b9ef[_0x6946('0x38')]));if(!this[_0x6946('0x82')](_0x47b9ef[_0x6946('0x71')])){return this[_0x6946('0x36')][_0x6946('0xa8')]('no\x20url\x20configured');}var _0x5379f2=this['restAPI'][_0x6946('0x6e')](this,_0x47b9ef);logger[_0x6946('0x2e')](util[_0x6946('0x28')]('Response:',util[_0x6946('0x16a')](_0x5379f2,{'showHidden':![],'depth':null})));if(!this[_0x6946('0x82')](_0x47b9ef['variable_id'])){return this[_0x6946('0x36')][_0x6946('0xa8')](_0x6946('0x16b'));}var _0x5a3dec=this[_0x6946('0xf')][_0x6946('0x6e')](this,_0x47b9ef[_0x6946('0xca')]);if(!_0x5a3dec){return this[_0x6946('0x36')][_0x6946('0x2c')](_0x47b9ef,'no\x20variable\x20found');}this['channel']['setVariable'](util[_0x6946('0x28')](_0x6946('0x16c'),_0x5a3dec),_0x5379f2['statusCode']?_0x5379f2[_0x6946('0x75')]:_0x6946('0x16d'));this[_0x6946('0x36')]['setVariable'](util[_0x6946('0x28')](_0x6946('0x16e'),_0x5a3dec),_0x5379f2[_0x6946('0x76')]?_0x5379f2[_0x6946('0x76')]:'OK');if(_0x5379f2['body']){try{this[_0x6946('0x96')](_0x5379f2[_0x6946('0x74')],_0x5a3dec);}catch(_0x2e6d7e){logger[_0x6946('0x2c')](util[_0x6946('0x28')](_0x6946('0x16f'),_0x5a3dec));}}return this[_0x6946('0x36')]['noop'](util['format']('variable\x20%s\x20set',_0x5a3dec));};AGIVertices['prototype'][_0x6946('0x170')]=function(_0x55ab46){logger['info'](util[_0x6946('0x28')](_0x6946('0x171'),_0x55ab46[_0x6946('0x38')]));return this[_0x6946('0x36')]['sayDigits'](_0x55ab46[_0x6946('0x172')][_0x6946('0x59')](/\s+/g,''),_0x55ab46[_0x6946('0x167')]);};AGIVertices['prototype'][_0x6946('0x173')]=function(_0x1def66){logger[_0x6946('0x2e')](util['format'](_0x6946('0x174'),_0x1def66[_0x6946('0x38')]));return this['channel'][_0x6946('0x175')](_0x1def66[_0x6946('0x65')][_0x6946('0x59')](/\s+/g,''),_0x1def66['escape_digits']);};AGIVertices[_0x6946('0x12')][_0x6946('0x176')]=function(_0x2524c4){logger[_0x6946('0x2e')](util[_0x6946('0x28')]('Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block',_0x2524c4[_0x6946('0x38')]));return this[_0x6946('0x36')][_0x6946('0x177')](_0x2524c4['text'],_0x2524c4[_0x6946('0x167')]);};AGIVertices['prototype'][_0x6946('0x178')]=function(_0x5984a5){logger[_0x6946('0x2e')](util[_0x6946('0x28')](_0x6946('0x179'),_0x5984a5['label']));if(!this['isConfigured'](_0x5984a5[_0x6946('0x17a')])){return this[_0x6946('0x36')]['noop']('no\x20mail\x20account\x20configured');}var _0x278690=this[_0x6946('0x17b')][_0x6946('0x6e')](this,_0x5984a5[_0x6946('0x17a')]);if(!_0x278690||!_0x278690[_0x6946('0x17c')]){return this[_0x6946('0x36')][_0x6946('0x2c')](_0x5984a5,_0x6946('0x17d'));}var _0x4bbecd={'from':util[_0x6946('0x28')]('\x22%s\x22\x20<%s>',_0x278690[_0x6946('0x10')],_0x278690[_0x6946('0x17e')]||_0x278690[_0x6946('0x17c')]['user']),'to':_0x5984a5['to']||'','cc':_0x5984a5['cc']||'','bcc':_0x5984a5[_0x6946('0x17f')]||'','subject':_0x5984a5['subject'],'html':_0x5984a5[_0x6946('0x5d')],'text':_0x5984a5[_0x6946('0x5d')]};var _0x1df519={'tls':{'rejectUnauthorized':![]}};if(_0x278690['Smtp'][_0x6946('0x180')]){_0x1df519[_0x6946('0x180')]=_0x278690[_0x6946('0x17c')][_0x6946('0x180')];}else{_0x1df519['host']=_0x278690['Smtp'][_0x6946('0x181')];_0x1df519[_0x6946('0x182')]=_0x278690[_0x6946('0x17c')]['port'];_0x1df519[_0x6946('0x183')]=_0x278690[_0x6946('0x17c')][_0x6946('0x183')];}if(_0x278690[_0x6946('0x17c')][_0x6946('0x184')]){_0x1df519[_0x6946('0x185')]={'user':_0x278690[_0x6946('0x17c')]['user'],'pass':_0x278690[_0x6946('0x17c')][_0x6946('0x186')]};}if(this[_0x6946('0x82')](_0x5984a5['template_id'])){}logger[_0x6946('0xd2')](_0x6946('0x187'),JSON[_0x6946('0x73')](_0x4bbecd));this[_0x6946('0x35')][_0x6946('0x6e')](this,_0x5984a5,_0x5984a5[_0x6946('0x17a')]);this[_0x6946('0x36')][_0x6946('0xa8')](util[_0x6946('0x28')](_0x6946('0x188'),_0x278690[_0x6946('0x10')]));this[_0x6946('0x23')][_0x6946('0x6e')](this,_0x1df519,_0x4bbecd);return this[_0x6946('0x36')]['noop'](_0x6946('0x189'));};AGIVertices[_0x6946('0x12')][_0x6946('0x18a')]=function(_0x3c5186){logger[_0x6946('0x2e')](util['format'](_0x6946('0x18b'),_0x3c5186[_0x6946('0x38')]));return this[_0x6946('0x36')]['noop'](_0x6946('0x18c'));};AGIVertices['prototype'][_0x6946('0x18d')]=function(_0x35a531){logger[_0x6946('0x2e')](util['format'](_0x6946('0x18e'),_0x35a531[_0x6946('0x38')]));if(!this[_0x6946('0x82')](_0x35a531[_0x6946('0x18f')])){return this[_0x6946('0x36')][_0x6946('0xa8')](_0x6946('0x190'));}var _0xe7fb92=this[_0x6946('0x191')][_0x6946('0x6e')](this,_0x35a531[_0x6946('0x18f')]);if(!_0xe7fb92){return this['channel'][_0x6946('0x2c')](_0x35a531,'no\x20sms\x20account\x20found');}var _0x44ab2b={'body':_0x35a531['sms_text'],'phone':_0x35a531['to']||'','SmsAccountId':_0xe7fb92['id']};logger[_0x6946('0xd2')](_0x6946('0x192'),JSON[_0x6946('0x73')](_0x44ab2b));this['createSquareDetailsReport']['sync'](this,_0x35a531,_0x35a531[_0x6946('0x18f')]);this[_0x6946('0x36')][_0x6946('0xa8')](util['format']('Trying\x20SendSMS\x20with\x20account\x20%s',_0xe7fb92[_0x6946('0x10')]));this['createSmsMessage']['sync'](this,_0x44ab2b);return this[_0x6946('0x36')][_0x6946('0xa8')](_0x6946('0x193'));};AGIVertices['prototype'][_0x6946('0x194')]=function(_0x5d46e1){logger[_0x6946('0x2e')](util[_0x6946('0x28')](_0x6946('0x195'),_0x5d46e1['label']));if(!this['isConfigured'](_0x5d46e1[_0x6946('0xca')])){return this[_0x6946('0x36')][_0x6946('0x2c')](_0x5d46e1,_0x6946('0x196'));}var _0x175708=this[_0x6946('0xf')][_0x6946('0x6e')](this,_0x5d46e1[_0x6946('0xca')]);if(!_0x175708){return this[_0x6946('0x36')]['error'](_0x5d46e1,_0x6946('0xcc'));}return this[_0x6946('0x36')][_0x6946('0x99')](_0x175708,_0x5d46e1[_0x6946('0x197')]);};AGIVertices[_0x6946('0x12')][_0x6946('0x198')]=function(_0x1c84ff){logger['info'](util[_0x6946('0x28')](_0x6946('0x199'),_0x1c84ff['label']));this[_0x6946('0x36')][_0x6946('0xa8')](_0x6946('0x19a'));if(_0x1c84ff['answer']===_0x6946('0x19b')){this['channel'][_0x6946('0xa8')](_0x6946('0x19c'));return this[_0x6946('0x36')]['answer']();}return this[_0x6946('0x36')][_0x6946('0xa8')]('Skipped\x20Answer');};AGIVertices[_0x6946('0x12')]['subproject']=function(_0x157180){logger['info'](util['format'](_0x6946('0x19d'),_0x157180[_0x6946('0x38')]));if(!this['isConfigured'](_0x157180[_0x6946('0x19e')])){return this[_0x6946('0x36')][_0x6946('0x2c')](_0x157180,_0x6946('0x19f'));}var _0x2f09e3=this[_0x6946('0x16')][_0x6946('0x6e')](this,_0x157180[_0x6946('0x19e')]);if(!this[_0x6946('0x82')](_0x2f09e3)){return this[_0x6946('0x36')][_0x6946('0x2c')](_0x157180,util['format']('no\x20subproject\x20found\x20with\x20id\x20%d',_0x157180[_0x6946('0x19e')]));}if(_0x2f09e3===this[_0x6946('0x36')]['arg_1']){return this['channel']['error'](_0x157180,_0x6946('0x1a0'));}this[_0x6946('0x35')][_0x6946('0x6e')](this,_0x157180,_0x2f09e3);var _0x15c359=this['channel'][_0x6946('0x58')]('AGI',util['format'](_0x6946('0x1a1'),config[_0x6946('0x9')][_0x6946('0x181')]||'127.0.0.1',_0x2f09e3,this[_0x6946('0x36')][_0x6946('0x39')]));if(_0x15c359[_0x6946('0xa2')]===-0x1){return _0x15c359;}return this[_0x6946('0x36')][_0x6946('0xa8')](util[_0x6946('0x28')](_0x6946('0x156'),'AGI',_0x2f09e3));};AGIVertices[_0x6946('0x12')][_0x6946('0x1a2')]=function(_0x2ed01c){logger[_0x6946('0x2e')](util[_0x6946('0x28')](_0x6946('0x1a3'),_0x2ed01c[_0x6946('0x38')]));var _0x52f7a8=this[_0x6946('0x57')][_0x6946('0x6e')](this,_0x2ed01c[_0x6946('0x9f')]);this[_0x6946('0x35')]['sync'](this,_0x2ed01c,_0x2ed01c[_0x6946('0x9f')]);if(this[_0x6946('0x82')](_0x2ed01c[_0x6946('0xca')])){var _0x33fd52=this[_0x6946('0xf')][_0x6946('0x6e')](this,_0x2ed01c[_0x6946('0xca')]);if(_0x33fd52){this[_0x6946('0x36')][_0x6946('0x99')](_0x33fd52,_0x52f7a8);return this[_0x6946('0x36')][_0x6946('0xa8')](util[_0x6946('0x28')]('sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s',_0x2ed01c[_0x6946('0x9f')],_0x33fd52));}}return this['channel'][_0x6946('0xa8')](util['format'](_0x6946('0x1a4'),_0x2ed01c['command']));};AGIVertices[_0x6946('0x12')][_0x6946('0x1a5')]=function(_0x1c2f74){logger[_0x6946('0x2e')](util[_0x6946('0x28')](_0x6946('0x1a6'),_0x1c2f74[_0x6946('0x38')]));if(!this['isConfigured'](_0x1c2f74[_0x6946('0x5b')])){return this[_0x6946('0x36')][_0x6946('0xa8')]('no\x20apiKey\x20configured');}if(!this['isConfigured'](_0x1c2f74[_0x6946('0x5d')])){return this[_0x6946('0x36')][_0x6946('0xa8')](_0x6946('0xae'));}this['channel'][_0x6946('0xa8')](util[_0x6946('0x28')]('Trying\x20Google\x20Cloud\x20TTS\x20%s',_0x1c2f74[_0x6946('0x5d')]));var _0x50fa69=this[_0x6946('0x5a')][_0x6946('0x6e')](this,_0x1c2f74);if(_0x50fa69){this[_0x6946('0x36')][_0x6946('0xa8')](util[_0x6946('0x28')](_0x6946('0x1a7'),_0x50fa69));var _0x33d9e=this[_0x6946('0x36')][_0x6946('0xeb')](_0x50fa69);try{fs[_0x6946('0xec')](_0x50fa69+_0x6946('0x10c'));}catch(_0x481b9a){logger[_0x6946('0x2c')](_0x481b9a);}return _0x33d9e;}return this[_0x6946('0x36')]['error'](_0x1c2f74,_0x6946('0x1a8'));};AGIVertices[_0x6946('0x12')][_0x6946('0x1a9')]=function(_0x55150c){logger[_0x6946('0x2e')](util[_0x6946('0x28')](_0x6946('0x1aa'),_0x55150c[_0x6946('0x38')]));if(!this[_0x6946('0x82')](_0x55150c[_0x6946('0x5d')])){return this['channel']['noop'](_0x6946('0xae'));}this[_0x6946('0x36')][_0x6946('0xa8')](util[_0x6946('0x28')](_0x6946('0x1ab'),_0x55150c['text']));var _0xad7407=this[_0x6946('0x64')]['sync'](this,_0x55150c);if(_0xad7407){this['channel'][_0x6946('0xa8')](util['format'](_0x6946('0x1ac'),_0xad7407));var _0x66acfd=this['channel'][_0x6946('0xeb')](_0xad7407);try{fs['unlink'](_0xad7407+_0x6946('0x10c'));}catch(_0x4b938d){logger['error'](_0x4b938d);}return _0x66acfd;}return this[_0x6946('0x36')][_0x6946('0x2c')](_0x55150c,'Google\x20TTS\x20is\x20unreachable');};AGIVertices[_0x6946('0x12')][_0x6946('0x1ad')]=function(_0x34989e){logger['info'](util[_0x6946('0x28')](_0x6946('0x1ae'),_0x34989e[_0x6946('0x38')]));if(!this[_0x6946('0x82')](_0x34989e[_0x6946('0x13f')])){return this[_0x6946('0x36')][_0x6946('0x2c')](_0x34989e,_0x6946('0x151'));}logger['info'](util[_0x6946('0x28')](_0x6946('0x140'),this[_0x6946('0x36')][_0x6946('0x3b')],_0x34989e[_0x6946('0x13f')]));var _0x466753=this['agentUnpause']['sync'](this,_0x34989e[_0x6946('0x13f')]);if(_0x466753){logger[_0x6946('0x2e')](util[_0x6946('0x28')](_0x6946('0x141'),this[_0x6946('0x36')][_0x6946('0x3b')],_0x34989e['findBy']));this[_0x6946('0x36')][_0x6946('0xa8')](util[_0x6946('0x28')](_0x6946('0x141'),this[_0x6946('0x36')]['callerid'],_0x34989e['findBy']));return{'code':0xc8,'result':_0x6946('0x153')};}else{logger[_0x6946('0x2e')](util[_0x6946('0x28')](_0x6946('0x142'),this['channel'][_0x6946('0x3b')],_0x34989e['findBy']));this[_0x6946('0x36')][_0x6946('0xa8')](util['format'](_0x6946('0x142'),this[_0x6946('0x36')][_0x6946('0x3b')],_0x34989e[_0x6946('0x13f')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x6946('0x12')][_0x6946('0x1af')]=function(_0x5262e8){logger['info'](util[_0x6946('0x28')](_0x6946('0x1b0'),_0x5262e8['label']));var _0xc207e3=this['channel'][_0x6946('0x58')]('VOICEMAIL',[_0x5262e8[_0x6946('0x1b1')],_0x5262e8['options']]);if(_0xc207e3['result']===-0x1){return _0xc207e3;}return this[_0x6946('0x36')][_0x6946('0xa8')](util[_0x6946('0x28')]('Executed\x20command\x20%s\x20%s',_0x6946('0x1b2'),_0x5262e8['mailbox']));};AGIVertices[_0x6946('0x12')]['vswitch']=function(_0x1f830b){logger[_0x6946('0x2e')](util['format'](_0x6946('0x1b3'),_0x1f830b[_0x6946('0x38')]));if(!this[_0x6946('0x82')](_0x1f830b['variable_id'])){return this[_0x6946('0x36')][_0x6946('0x2c')](_0x1f830b,'no\x20variable\x20selected');}var _0x3a5ede=this['getVariable'][_0x6946('0x6e')](this,_0x1f830b[_0x6946('0xca')]);if(!_0x3a5ede){return this[_0x6946('0x36')]['error'](_0x1f830b,_0x6946('0xcc'));}var _0x493d2f=this['channel'][_0x6946('0xf')](_0x3a5ede);return{'code':0xc8,'result':_0x493d2f[_0x6946('0x9b')]?_0x493d2f[_0x6946('0x9b')]:'-'};};String[_0x6946('0x12')][_0x6946('0x1b4')]=function(_0x253a54,_0x243e12){return this[_0x6946('0x9a')](_0x253a54)[_0x6946('0x1b5')](_0x243e12);};module[_0x6946('0x1b6')]=AGIVertices; \ No newline at end of file +var _0x9c5a=['voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','join','path','util','lodash','shelljs','odbc','moment','mustache','../../config/logger','agi','rawBody','menu','getdigits','getsecretdigits','rpc','mailRpc','prototype','getVariable','getVariableById','then','name','catch','getVoiceQueue','getVoiceQueueById','getSquareProject','getSquareProjectById','getSquareOdbc','dsn','getUser','getTrunk','getTrunkById','getSound','getSoundById','getSoundPath','save_name','getMailAccount','getMailAccountById','sendMailMessage','getIntervals','IntervalId','interval','map','Intervals','getQueryOdbc','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','ODBC\x20connection\x20successfully','query','info','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','createSmsMessage','createSquareDetailsReport','channel','uniqueid','label','agicommand','callerid','createSquareRecording','calleridname','context','extension','priority','accountcode','dnid','file','createSquareMessage','createCmContact','isEmpty','isNil','callback_','random','lastName','scheduledAt','Callback\x20scheduled\x20at\x20','toString','callback_priority','getPause','getPauseById','agentPause','agent','agentUnpause','agentLogout','internal','format','%s/%s@from-sip/n','agentLogin','shellCommand','trim','replace','googleCloudTTS','apiKey','text','languageCode','en-US','MALE','audioEncoding','MP3','googleTTS','google_tts_language','restAPI','url','number','timeout','includes','POST','PUT','method','toUpperCase','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','rawHeaders','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','uri','render','stringify','body','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','sestekNDA','ispeechTTS','ispeech_tts_language','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_voice','aws_lex_region','aws_bot_name','googleASR','tildeASR','appid','clear','clone','hasOwnProperty','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isPlainObject','isArray','isString','saveRestApiResult','length','setVariable','%s.%s','split','replaceAll','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','extra','retry','maxRetry','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','answer','Wait\x20%s\x20seconds\x20before\x20answer','callback','Enter\x20in\x20CALLBACK\x20(%s)\x20block','list_id','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','application','Executed\x20command\x20%s\x20%s','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','exec','Executed\x20command\x20MRCPSynth\x20%s','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','no\x20grammar\x20configured','MRCPRecog','RECOG_INPUT()','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','sestekasr','grammar','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','keys','%s_ROWS_COUNT','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','no\x20user\x20found','SIP/%s','opts','DIAL','no\x20text\x20configured','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','out','Dialogflow\x20Result\x20%s','speech','sesteknda','username','no\x20username\x20configured','password','no\x20password\x20configured','ndassistant_url','bot','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','.wav','Enter\x20in\x20END\x20(%s)\x20block','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','Executed\x20command\x20%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','getData','response','test','mindigit','maxdigit','hiddendigitsnum','generate','hiddendigitspos','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','goalname','GOAL\x20%s','awspolly','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','awsLex','Amazon\x20Lex\x20Result\x20%s','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','no\x20key\x20configured','wav','%s/recordings/%s','beep','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','appsecret','no\x20appsecret\x20configured','NOBEEP','recordFile','intKey','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','true','EVAL\x20CONDITION\x20%s\x20%s','false','gotoiftime','interval_id','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','findBy','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','gosub','position','record','Enter\x20in\x20RECORD\x20(%s)\x20block','%s_%s','%s/recordings/%s.%s','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','variable\x20%s\x20set','sayDigits','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayphonetic','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','Smtp','\x22%s\x22\x20<%s>','email','user','bcc','subject','host','port','secure','authentication','auth','pass','template_id','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','sendSMS','sms_account_id','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','debug','Trying\x20SendSMS\x20with\x20account\x20%s','no\x20variable\x20selected','START\x20CALLY\x20SQUARE','yes','Answer','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','no\x20subproject\x20found\x20with\x20id\x20%d','arg_1','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','127.0.0.1','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Google\x20TTS\x20%s\x20file\x20created','unlink','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','no\x20find\x20by\x20configured'];(function(_0x1d91a5,_0x327d72){var _0x45050e=function(_0x1bb842){while(--_0x1bb842){_0x1d91a5['push'](_0x1d91a5['shift']());}};_0x45050e(++_0x327d72);}(_0x9c5a,0x1b6));var _0xa9c5=function(_0x3b9070,_0x41d85c){_0x3b9070=_0x3b9070-0x0;var _0x562026=_0x9c5a[_0x3b9070];return _0x562026;};'use strict';var fs=require('fs');var path=require(_0xa9c5('0x0'));var util=require(_0xa9c5('0x1'));var _=require(_0xa9c5('0x2'));var sh=require(_0xa9c5('0x3'));var odbc=require(_0xa9c5('0x4'))();var rs=require('randomstring');var moment=require(_0xa9c5('0x5'));var Mustache=require(_0xa9c5('0x6'));var rp=require('request-promise');var logger=require(_0xa9c5('0x7'))(_0xa9c5('0x8'));var config=require('../../config/environment');var scripts=require('./scripts');var FILES_PATH='/var/opt/motion2/server/files';var recursiveMapAttributes=['rawHeaders',_0xa9c5('0x9')];var verticesWithRetry=[_0xa9c5('0xa'),_0xa9c5('0xb'),_0xa9c5('0xc')];var AGIVertices=function(_0x4750e8,_0x1cdf01,_0x472dcf){this['channel']=_0x4750e8;this[_0xa9c5('0xd')]=_0x1cdf01;this[_0xa9c5('0xe')]=_0x472dcf;};AGIVertices[_0xa9c5('0xf')][_0xa9c5('0x10')]=function(_0x179d82,_0x2b11e2){this[_0xa9c5('0xd')][_0xa9c5('0x11')](_0x179d82)[_0xa9c5('0x12')](function(_0x3a99b6){_0x2b11e2(null,_0x3a99b6?_0x3a99b6[_0xa9c5('0x13')]:![]);})[_0xa9c5('0x14')](function(_0x21f705){_0x2b11e2(_0x21f705);});};AGIVertices[_0xa9c5('0xf')][_0xa9c5('0x15')]=function(_0x579d40,_0x2f17bf){this[_0xa9c5('0xd')][_0xa9c5('0x16')](_0x579d40)['then'](function(_0x855fc1){_0x2f17bf(null,_0x855fc1?_0x855fc1[_0xa9c5('0x13')]:![]);})[_0xa9c5('0x14')](function(_0xd4c8e9){_0x2f17bf(_0xd4c8e9);});};AGIVertices[_0xa9c5('0xf')][_0xa9c5('0x17')]=function(_0x415143,_0x23f27e){this[_0xa9c5('0xd')][_0xa9c5('0x18')](_0x415143)[_0xa9c5('0x12')](function(_0x467db0){_0x23f27e(null,_0x467db0?_0x467db0[_0xa9c5('0x13')]:![]);})[_0xa9c5('0x14')](function(_0x25e226){_0x23f27e(_0x25e226);});};AGIVertices['prototype'][_0xa9c5('0x19')]=function(_0x343ba1,_0xb9a776){this[_0xa9c5('0xd')]['getSquareOdbcById'](_0x343ba1)[_0xa9c5('0x12')](function(_0x432db6){_0xb9a776(null,_0x432db6?_0x432db6[_0xa9c5('0x1a')]:![]);})[_0xa9c5('0x14')](function(_0x2bf928){_0xb9a776(_0x2bf928);});};AGIVertices[_0xa9c5('0xf')][_0xa9c5('0x1b')]=function(_0x306b14,_0x1ac1b3){this['rpc']['getUserById'](_0x306b14)[_0xa9c5('0x12')](function(_0x447d86){_0x1ac1b3(null,_0x447d86?_0x447d86[_0xa9c5('0x13')]:![]);})[_0xa9c5('0x14')](function(_0x573a94){_0x1ac1b3(_0x573a94);});};AGIVertices[_0xa9c5('0xf')][_0xa9c5('0x1c')]=function(_0x480e1e,_0x2c1036){this[_0xa9c5('0xd')][_0xa9c5('0x1d')](_0x480e1e)[_0xa9c5('0x12')](function(_0x3cf84d){_0x2c1036(null,_0x3cf84d?_0x3cf84d[_0xa9c5('0x13')]:![]);})[_0xa9c5('0x14')](function(_0x4eecd4){_0x2c1036(_0x4eecd4);});};AGIVertices[_0xa9c5('0xf')][_0xa9c5('0x1e')]=function(_0x264233,_0x1cd87a){var _0x37cdec=this;this[_0xa9c5('0xd')][_0xa9c5('0x1f')](_0x264233)[_0xa9c5('0x12')](function(_0x275729){_0x1cd87a(null,_0x275729?_0x37cdec[_0xa9c5('0x20')](_0x275729[_0xa9c5('0x21')]):![]);})[_0xa9c5('0x14')](function(_0x4f1f80){_0x1cd87a(_0x4f1f80);});};AGIVertices[_0xa9c5('0xf')][_0xa9c5('0x22')]=function(_0x3dcc82,_0x46e0ca){this[_0xa9c5('0xd')][_0xa9c5('0x23')](_0x3dcc82)[_0xa9c5('0x12')](function(_0x16c690){_0x46e0ca(null,_0x16c690?_0x16c690:![]);})[_0xa9c5('0x14')](function(_0x260f07){_0x46e0ca(_0x260f07);});};AGIVertices[_0xa9c5('0xf')][_0xa9c5('0x24')]=function(_0x3e667a,_0x2552e0,_0x5d2171){this[_0xa9c5('0xe')]['sendMailMessage'](_0x3e667a,_0x2552e0)[_0xa9c5('0x12')](function(){_0x5d2171(null);})[_0xa9c5('0x14')](function(_0x454423){_0x5d2171(_0x454423);});};AGIVertices[_0xa9c5('0xf')][_0xa9c5('0x25')]=function(_0x5e2064,_0x42ca5e){this[_0xa9c5('0xd')]['getIntervalById'](_0x5e2064)[_0xa9c5('0x12')](function(_0x51b032){if(_0x51b032){if(_0x51b032[_0xa9c5('0x26')]){_0x42ca5e(null,[_0x51b032[_0xa9c5('0x27')]]);}else{_0x42ca5e(null,_[_0xa9c5('0x28')](_0x51b032[_0xa9c5('0x29')],'interval'));}}else{_0x42ca5e(null,![]);}})[_0xa9c5('0x14')](function(_0x5b8290){_0x42ca5e(_0x5b8290);});};AGIVertices[_0xa9c5('0xf')][_0xa9c5('0x20')]=function(_0x58acda){return util['format']('%s/sounds/converted/%s',FILES_PATH,_0x58acda);};AGIVertices[_0xa9c5('0xf')][_0xa9c5('0x2a')]=function(_0x253655,_0x47118b,_0x40f317){odbc[_0xa9c5('0x2b')](_0x253655,function(_0x2b2540){if(_0x2b2540){logger[_0xa9c5('0x2c')](_0xa9c5('0x2d'),_0x2b2540);_0x40f317(_0x2b2540);}else{logger['info'](_0xa9c5('0x2e'));odbc[_0xa9c5('0x2f')](_0x47118b,function(_0x2daa89,_0x495f59){if(_0x2daa89){logger[_0xa9c5('0x30')](_0xa9c5('0x31'),_0x47118b);_0x40f317(_0x2daa89);}else{logger[_0xa9c5('0x30')](_0xa9c5('0x32'),_0x47118b);odbc[_0xa9c5('0x33')](function(_0x209c3f){if(_0x209c3f){logger[_0xa9c5('0x2c')](_0xa9c5('0x34'),_0x209c3f);}_0x40f317(null,_0x495f59);});}});}});};AGIVertices['prototype']['getSmsAccount']=function(_0x2be2de,_0x93af67){this[_0xa9c5('0xd')]['getSmsAccountById'](_0x2be2de)[_0xa9c5('0x12')](function(_0x33d626){_0x93af67(null,_0x33d626?_0x33d626:![]);})[_0xa9c5('0x14')](function(_0x30820b){_0x93af67(_0x30820b);});};AGIVertices[_0xa9c5('0xf')][_0xa9c5('0x35')]=function(_0xded5c5,_0x46adf9){this[_0xa9c5('0xd')]['createSmsMessage'](_0xded5c5)[_0xa9c5('0x12')](function(_0x22b740){_0x46adf9(null,_0x22b740);})['catch'](function(_0x17b4c0){_0x46adf9(_0x17b4c0);});};AGIVertices[_0xa9c5('0xf')][_0xa9c5('0x36')]=function(_0xb20d09,_0x18fbb6,_0x43ef53){this['rpc'][_0xa9c5('0x36')]({'uniqueid':this[_0xa9c5('0x37')][_0xa9c5('0x38')],'node':_0xb20d09[_0xa9c5('0x39')],'application':_0xb20d09[_0xa9c5('0x3a')],'data':_0x18fbb6||null,'project_name':this[_0xa9c5('0x37')]['arg_1'],'callerid':this[_0xa9c5('0x37')][_0xa9c5('0x3b')]})[_0xa9c5('0x12')](function(_0x357b91){if(_0x43ef53){_0x43ef53(null,_0x357b91);}})[_0xa9c5('0x14')](function(_0x3d7c4e){if(_0x43ef53){_0x43ef53(_0x3d7c4e);}});};AGIVertices['prototype']['createSquareRecording']=function(_0xc2da6b,_0x6e8efc,_0x239518,_0x4ea043){this[_0xa9c5('0xd')][_0xa9c5('0x3c')]({'uniqueid':this['channel']['uniqueid'],'callerid':this[_0xa9c5('0x37')][_0xa9c5('0x3b')],'calleridname':this[_0xa9c5('0x37')][_0xa9c5('0x3d')],'context':this['channel'][_0xa9c5('0x3e')],'extension':this[_0xa9c5('0x37')][_0xa9c5('0x3f')],'priority':this['channel'][_0xa9c5('0x40')],'accountcode':this[_0xa9c5('0x37')][_0xa9c5('0x41')],'dnid':this[_0xa9c5('0x37')][_0xa9c5('0x42')],'projectName':this[_0xa9c5('0x37')]['arg_1'],'saveName':_0x6e8efc,'filename':_0xc2da6b[_0xa9c5('0x43')]||_0x6e8efc,'savePath':_0x239518})[_0xa9c5('0x12')](function(_0x2c3767){_0x4ea043(null,_0x2c3767);})[_0xa9c5('0x14')](function(_0x2fb3da){_0x4ea043(_0x2fb3da);});};AGIVertices[_0xa9c5('0xf')][_0xa9c5('0x44')]=function(_0x188986,_0x342981,_0x4bc747){this[_0xa9c5('0xd')]['createSquareMessage']({'uniqueid':this['channel'][_0xa9c5('0x38')],'body':_0x188986,'direction':_0x342981})[_0xa9c5('0x12')](function(_0xf78f3f){if(_0x4bc747){_0x4bc747(null,_0xf78f3f);}})['catch'](function(_0x1c1136){if(_0x4bc747){_0x4bc747(_0x1c1136);}});};AGIVertices['prototype']['createCmContact']=function(_0xdc11bd,_0x9cd12f){this[_0xa9c5('0xd')][_0xa9c5('0x45')]({'firstName':_[_0xa9c5('0x46')](_0xdc11bd['name'])||_[_0xa9c5('0x47')](_0xdc11bd[_0xa9c5('0x13')])?_0xa9c5('0x48')+Math[_0xa9c5('0x49')]():_0xdc11bd['name'],'lastName':_[_0xa9c5('0x46')](_0xdc11bd[_0xa9c5('0x4a')])||_[_0xa9c5('0x47')](_0xdc11bd[_0xa9c5('0x4a')])?null:_0xdc11bd['lastName'],'phone':_0xdc11bd['phone'],'ListId':_0xdc11bd['list_id'],'scheduledat':_0xdc11bd[_0xa9c5('0x4b')],'callbackUniqueid':this['channel'][_0xa9c5('0x38')],'tags':'callback','description':_0xa9c5('0x4c')+_0xdc11bd[_0xa9c5('0x4b')][_0xa9c5('0x4d')](),'priority':_0xdc11bd[_0xa9c5('0x4e')]})[_0xa9c5('0x12')](function(_0x19608f){_0x9cd12f(null,_0x19608f);})['catch'](function(_0x533013){_0x9cd12f(_0x533013);});};AGIVertices['prototype'][_0xa9c5('0x4f')]=function(_0x334e52,_0x456e7d){this['rpc'][_0xa9c5('0x50')](_0x334e52)[_0xa9c5('0x12')](function(_0x2d1647){_0x456e7d(null,_0x2d1647?_0x2d1647['name']:![]);})[_0xa9c5('0x14')](function(_0x36b7d7){_0x456e7d(_0x36b7d7);});};AGIVertices[_0xa9c5('0xf')][_0xa9c5('0x51')]=function(_0x451186,_0x22a386,_0x4cd970){var _0x338aa8={'role':_0xa9c5('0x52')};_0x338aa8[_0x451186]=this[_0xa9c5('0x37')][_0xa9c5('0x3b')];this['rpc'][_0xa9c5('0x51')](_0x338aa8,_0x22a386,this[_0xa9c5('0x37')][_0xa9c5('0x38')])[_0xa9c5('0x12')](function(_0x43399a){_0x4cd970(null,_[_0xa9c5('0x47')](_0x43399a)?![]:!![]);})[_0xa9c5('0x14')](function(_0x30426c){logger[_0xa9c5('0x2c')](_0x30426c);_0x4cd970(null,![]);});};AGIVertices[_0xa9c5('0xf')]['agentUnpause']=function(_0x311169,_0x41fe3f){var _0x55b8ed={'role':_0xa9c5('0x52')};_0x55b8ed[_0x311169]=this[_0xa9c5('0x37')][_0xa9c5('0x3b')];this[_0xa9c5('0xd')][_0xa9c5('0x53')](_0x55b8ed)[_0xa9c5('0x12')](function(_0x24ccc2){_0x41fe3f(null,_[_0xa9c5('0x47')](_0x24ccc2)?![]:!![]);})[_0xa9c5('0x14')](function(_0x2a166e){logger['error'](_0x2a166e);_0x41fe3f(null,![]);});};AGIVertices['prototype'][_0xa9c5('0x54')]=function(_0x7b56e4,_0xaaf293){var _0x5ee4fa={'role':_0xa9c5('0x52')};_0x5ee4fa[_0x7b56e4]=this[_0xa9c5('0x37')][_0xa9c5('0x3b')];this[_0xa9c5('0xd')][_0xa9c5('0x54')](_0x5ee4fa)[_0xa9c5('0x12')](function(_0x3b70fc){_0xaaf293(null,_['isNil'](_0x3b70fc)?![]:!![]);})[_0xa9c5('0x14')](function(_0x351a58){logger[_0xa9c5('0x2c')](_0x351a58);_0xaaf293(null,![]);});};AGIVertices['prototype']['agentLogin']=function(_0x6f62e3,_0x2db22a){var _0x534f3c={'role':_0xa9c5('0x52')};_0x534f3c[_0x6f62e3]=this[_0xa9c5('0x37')][_0xa9c5('0x3b')];var _0x59a97d=_0x6f62e3!=_0xa9c5('0x55')?util[_0xa9c5('0x56')](_0xa9c5('0x57'),'LOCAL',this['channel'][_0xa9c5('0x3b')]):undefined;this['rpc'][_0xa9c5('0x58')](_0x534f3c,_0x59a97d)[_0xa9c5('0x12')](function(_0x4eb44c){_0x2db22a(null,_[_0xa9c5('0x47')](_0x4eb44c)?![]:!![]);})[_0xa9c5('0x14')](function(_0x4f0cd8){logger[_0xa9c5('0x2c')](_0x4f0cd8);_0x2db22a(null,![]);});};AGIVertices[_0xa9c5('0xf')][_0xa9c5('0x59')]=function(_0x386f25,_0x570891){sh['exec'](_[_0xa9c5('0x5a')](_0x386f25),function(_0x11b84c,_0x388d96){var _0x23be45=_0x388d96[_0xa9c5('0x5b')](/(\r\n|\n|\r)/gm,'');_0x570891(null,_0x23be45);});};AGIVertices[_0xa9c5('0xf')][_0xa9c5('0x5c')]=function(_0x4e8bc5,_0x311bf1){scripts[_0xa9c5('0x5c')](_0x4e8bc5[_0xa9c5('0x5d')],_0x4e8bc5['google_cloud_tts_text_type']||'text',_0x4e8bc5[_0xa9c5('0x5e')],_0x4e8bc5[_0xa9c5('0x5f')]||_0xa9c5('0x60'),_0x4e8bc5['ssmlGender']||_0xa9c5('0x61'),_0x4e8bc5[_0xa9c5('0x62')]||_0xa9c5('0x63'))[_0xa9c5('0x12')](function(_0x5381a6){_0x311bf1(null,_0x5381a6);})[_0xa9c5('0x14')](function(_0x47cac2){_0x311bf1(_0x47cac2);});};AGIVertices[_0xa9c5('0xf')][_0xa9c5('0x64')]=function(_0x1a449d,_0x1b2f3e){scripts[_0xa9c5('0x64')](_0x1a449d[_0xa9c5('0x5e')],_0x1a449d[_0xa9c5('0x65')]||'en',0x1)['then'](function(_0x2de28a){_0x1b2f3e(null,_0x2de28a);})[_0xa9c5('0x14')](function(_0x3b6786){_0x1b2f3e(_0x3b6786);});};AGIVertices[_0xa9c5('0xf')][_0xa9c5('0x66')]=function(_0x54badb,_0x892532){var _0x2e1055={'uri':_0x54badb[_0xa9c5('0x67')],'method':_0x54badb['method'],'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x54badb['timeout'])===_0xa9c5('0x68')&&parseInt(_0x54badb[_0xa9c5('0x69')])>=0x1?parseInt(_0x54badb[_0xa9c5('0x69')])*0x3e8:0x5*0x3e8};if(_[_0xa9c5('0x6a')]([_0xa9c5('0x6b'),_0xa9c5('0x6c')],_0x2e1055[_0xa9c5('0x6d')][_0xa9c5('0x6e')]())){try{_0x2e1055['body']=_0x54badb[_0xa9c5('0x9')]?JSON[_0xa9c5('0x6f')](_0x54badb[_0xa9c5('0x9')]):{};}catch(_0x5df344){logger[_0xa9c5('0x2c')](_0xa9c5('0x70'),_0x5df344);}}try{_0x2e1055[_0xa9c5('0x71')]=_0x54badb[_0xa9c5('0x72')]?JSON[_0xa9c5('0x6f')](_0x54badb['rawHeaders']):{};}catch(_0x4e1a24){logger[_0xa9c5('0x2c')](_0xa9c5('0x73'),_0x4e1a24);}if(_0x54badb[_0xa9c5('0x74')]){try{var _0x2d6723=require(_0x54badb[_0xa9c5('0x74')])['sync'](this,_0x2e1055);_0x2e1055[_0xa9c5('0x75')]=Mustache['render'](_0x54badb[_0xa9c5('0x67')],_0x2d6723,{},['$$','$$']);if(_0x2e1055[_0xa9c5('0x71')]){_0x2e1055[_0xa9c5('0x71')]=JSON['parse'](Mustache[_0xa9c5('0x76')](JSON[_0xa9c5('0x77')](_0x2e1055['headers']),_0x2d6723,{},['$$','$$']));}if(_0x2e1055[_0xa9c5('0x78')]){_0x2e1055['body']=JSON[_0xa9c5('0x6f')](Mustache[_0xa9c5('0x76')](JSON[_0xa9c5('0x77')](_0x2e1055[_0xa9c5('0x78')]),_0x2d6723,{},['$$','$$']));}}catch(_0x565db7){logger[_0xa9c5('0x2c')](_0xa9c5('0x79'),_0x565db7);}}rp(_0x2e1055)['then'](function(_0x3268ab){var _0x570712={'statusCode':_0x3268ab[_0xa9c5('0x7a')]||0xc8,'statusMessage':_0x3268ab[_0xa9c5('0x7b')]||'OK','headers':_0x3268ab[_0xa9c5('0x71')]||{},'body':_0x3268ab['body']||{}};_0x892532(null,_0x570712);})['catch'](function(_0x5e559c){var _0xeb4ebe={'statusCode':_0x5e559c[_0xa9c5('0x7a')]||0x1f4,'statusMessage':_0x5e559c[_0xa9c5('0x7c')]||_0xa9c5('0x7d'),'headers':_0x5e559c[_0xa9c5('0x7e')][_0xa9c5('0x71')]||{},'body':_0x5e559c[_0xa9c5('0x7e')]['body']||{}};_0x892532(null,_0xeb4ebe);});};AGIVertices[_0xa9c5('0xf')][_0xa9c5('0x7f')]=function(_0x4c6cd7,_0x1919b6){scripts[_0xa9c5('0x7f')](this['channel'][_0xa9c5('0x38')],_0x4c6cd7[_0xa9c5('0x80')],_0x4c6cd7[_0xa9c5('0x5e')],_0x4c6cd7[_0xa9c5('0x81')]||'en')[_0xa9c5('0x12')](function(_0x3ff6ab){_0x1919b6(null,_0x3ff6ab);})[_0xa9c5('0x14')](function(_0x381ee3){_0x1919b6(_0x381ee3);});};AGIVertices[_0xa9c5('0xf')][_0xa9c5('0x82')]=function(_0xc644d4,_0x1073c1){scripts[_0xa9c5('0x82')](this[_0xa9c5('0x37')],_0xc644d4)[_0xa9c5('0x12')](function(_0x4da0f9){_0x1073c1(null,_0x4da0f9);})[_0xa9c5('0x14')](function(_0x2211ee){_0x1073c1(_0x2211ee);});};AGIVertices[_0xa9c5('0xf')][_0xa9c5('0x83')]=function(_0x1f5b54,_0x1835ca){scripts[_0xa9c5('0x83')](_0x1f5b54[_0xa9c5('0x80')],_0x1f5b54[_0xa9c5('0x5e')],_0x1f5b54[_0xa9c5('0x84')]||_0xa9c5('0x60'),_0x1f5b54[_0xa9c5('0x85')])['then'](function(_0x463d68){_0x1835ca(null,_0x463d68);})[_0xa9c5('0x14')](function(_0x40bb7f){_0x1835ca(_0x40bb7f);});};AGIVertices[_0xa9c5('0xf')][_0xa9c5('0x86')]=function(_0x21a202,_0x4647b8,_0x5d107b){scripts[_0xa9c5('0x86')](_0x4647b8,_0x21a202[_0xa9c5('0x80')],_0x21a202[_0xa9c5('0x87')]||_0xa9c5('0x60'),this[_0xa9c5('0x88')](_0x21a202[_0xa9c5('0x89')])?_0x21a202[_0xa9c5('0x89')]:undefined)[_0xa9c5('0x12')](function(_0x12cd16){_0x5d107b(null,_0x12cd16);})[_0xa9c5('0x14')](function(_0x42488a){_0x5d107b(_0x42488a);});};AGIVertices['prototype']['awsPolly']=function(_0x9c7e59,_0x300c2b){scripts[_0xa9c5('0x8a')](_0x9c7e59[_0xa9c5('0x8b')],_0x9c7e59[_0xa9c5('0x8c')],_0x9c7e59['aws_polly_region'],_0x9c7e59[_0xa9c5('0x8d')]||'Amy',_0x9c7e59[_0xa9c5('0x5e')],_0x9c7e59['aws_text_type']||'text')['then'](function(_0x15967c){_0x300c2b(null,_0x15967c);})[_0xa9c5('0x14')](function(_0x2273e6){_0x300c2b(_0x2273e6);});};AGIVertices[_0xa9c5('0xf')]['awsLex']=function(_0x42bfcf,_0x2a9c9e){scripts['awsLex'](this[_0xa9c5('0x37')]['uniqueid'],_0x42bfcf['aws_access_key_id'],_0x42bfcf['aws_secret_access_key'],_0x42bfcf[_0xa9c5('0x8e')],_0x42bfcf['text'],_0x42bfcf[_0xa9c5('0x8f')])[_0xa9c5('0x12')](function(_0x3ec214){_0x2a9c9e(null,_0x3ec214);})[_0xa9c5('0x14')](function(_0x154872){_0x2a9c9e(_0x154872);});};AGIVertices['prototype'][_0xa9c5('0x90')]=function(_0x17cf82,_0x42d953,_0x40b381){scripts[_0xa9c5('0x90')](_0x42d953,_0x17cf82[_0xa9c5('0x80')],_0x17cf82['google_asr_language']||_0xa9c5('0x60'))[_0xa9c5('0x12')](function(_0x1386f9){_0x40b381(null,_0x1386f9);})[_0xa9c5('0x14')](function(_0xeeb143){_0x40b381(_0xeeb143);});};AGIVertices[_0xa9c5('0xf')][_0xa9c5('0x91')]=function(_0x370f64,_0x45dea8,_0x46af6d){scripts[_0xa9c5('0x91')](_0x45dea8,_0x370f64[_0xa9c5('0x92')],_0x370f64['appsecret'],_0x370f64[_0xa9c5('0x75')])[_0xa9c5('0x12')](function(_0x1eb456){_0x46af6d(null,_0x1eb456);})[_0xa9c5('0x14')](function(_0x5deaff){_0x46af6d(_0x5deaff);});};AGIVertices[_0xa9c5('0xf')][_0xa9c5('0x93')]=function(_0x450460){var _0x2fe357=_['includes'](verticesWithRetry,_0x450460[_0xa9c5('0x3a')])?_0x450460:_[_0xa9c5('0x94')](_0x450460);for(var _0x1acd48 in _0x2fe357){if(_0x2fe357[_0xa9c5('0x95')](_0x1acd48)){if(_0x2fe357[_0x1acd48]&&_['isString'](_0x2fe357[_0x1acd48])){if(_['includes'](recursiveMapAttributes,_0x1acd48)){_0x2fe357[_0x1acd48]=this[_0xa9c5('0x96')](_0x2fe357[_0x1acd48]);}else{_0x2fe357[_0x1acd48]=this[_0xa9c5('0x97')](_0x2fe357[_0x1acd48]);}}}}return _0x2fe357;};AGIVertices[_0xa9c5('0xf')][_0xa9c5('0x98')]=function(_0x398a30){for(var _0x4b0ceb in _0x398a30){if(_0x398a30[_0xa9c5('0x95')](_0x4b0ceb)){if(_[_0xa9c5('0x99')](_0x398a30[_0x4b0ceb])){this[_0xa9c5('0x98')](_0x398a30[_0x4b0ceb]);}else if(_[_0xa9c5('0x9a')](_0x398a30[_0x4b0ceb])){for(var _0x2aa3ab=0x0;_0x2aa3ab<_0x398a30[_0x4b0ceb]['length'];_0x2aa3ab++){this['recursiveNodeIndex'](_0x398a30[_0x4b0ceb][_0x2aa3ab]);}}else if(_[_0xa9c5('0x9b')](_0x398a30[_0x4b0ceb])){_0x398a30[_0x4b0ceb]=this['replaceAllVariables'](_0x398a30[_0x4b0ceb]);}}}};AGIVertices[_0xa9c5('0xf')][_0xa9c5('0x9c')]=function(_0x1a1356,_0x3e3669){for(var _0x19f203 in _0x1a1356){if(_0x1a1356['hasOwnProperty'](_0x19f203)){if(_[_0xa9c5('0x99')](_0x1a1356[_0x19f203])){if(!_[_0xa9c5('0x46')](_0x1a1356[_0x19f203])){this[_0xa9c5('0x9c')](_0x1a1356[_0x19f203],util[_0xa9c5('0x56')]('%s.%s',_0x3e3669,_0x19f203));}}else if(_[_0xa9c5('0x9a')](_0x1a1356[_0x19f203])){for(var _0x194e71=0x0;_0x194e71<_0x1a1356[_0x19f203][_0xa9c5('0x9d')];_0x194e71++){this[_0xa9c5('0x9c')](_0x1a1356[_0x19f203][_0x194e71],util['format']('%s.%s',_0x3e3669,_0x19f203+'['+_0x194e71+']'));}}else{if(!_['isNil'](_0x1a1356[_0x19f203])){this[_0xa9c5('0x37')][_0xa9c5('0x9e')](util['format'](_0xa9c5('0x9f'),_0x3e3669,_0x19f203),_0x1a1356[_0x19f203]);}}}}};AGIVertices['prototype'][_0xa9c5('0x96')]=function(_0x5eb6e4){try{var _0x1d1161=JSON[_0xa9c5('0x6f')](_0x5eb6e4);this[_0xa9c5('0x98')](_0x1d1161);return JSON[_0xa9c5('0x77')](_0x1d1161);}catch(_0x452c98){return this[_0xa9c5('0x97')](_0x5eb6e4);}};AGIVertices[_0xa9c5('0xf')][_0xa9c5('0x97')]=function(_0x1016e3){var _0x25aa16=_0x1016e3[_0xa9c5('0xa0')]('{');for(var _0x186a98=0x1;_0x186a98<_0x25aa16[_0xa9c5('0x9d')];_0x186a98+=0x1){var _0x4c45ea=_0x25aa16[_0x186a98][_0xa9c5('0xa0')]('}');if(_0x4c45ea[_0xa9c5('0x9d')]>0x1){_0x1016e3=_0x1016e3[_0xa9c5('0xa1')]('{'+_0x4c45ea[0x0]+'}',this['channel'][_0xa9c5('0x10')](_0x4c45ea[0x0])['extra']||_0x4c45ea[0x0]);}}if(_0x25aa16[_0xa9c5('0x9d')]===0x1){return _0x1016e3[_0xa9c5('0x4d')]();}return this[_0xa9c5('0x97')](_0x1016e3);};AGIVertices['prototype'][_0xa9c5('0xa2')]=function(_0x2f04df,_0x382a3f){var _0x2646ce=this[_0xa9c5('0x37')][_0xa9c5('0x10')](_0x2f04df);if(_0x2646ce[_0xa9c5('0xa3')]===-0x1){return _0x2646ce;}logger[_0xa9c5('0x30')](util[_0xa9c5('0x56')](_0xa9c5('0xa4'),_0x382a3f,_0x2646ce[_0xa9c5('0xa5')]));return this[_0xa9c5('0x37')][_0xa9c5('0x9e')](_0x382a3f,_0x2646ce['extra']);};AGIVertices[_0xa9c5('0xf')][_0xa9c5('0x88')]=function(_0x34c75d){return _0x34c75d&&_0x34c75d!=='0'&&_0x34c75d!=='-1'&&_0x34c75d!=='';};AGIVertices[_0xa9c5('0xf')]['maxRetry']=function(_0x3d3fde){this[_0xa9c5('0x36')]['sync'](this,_0x3d3fde,'-');_0x3d3fde[_0xa9c5('0xa6')]=_0x3d3fde[_0xa9c5('0xa7')];return{'code':0xc8,'result':'-'};};AGIVertices['prototype'][_0xa9c5('0x8')]=function(_0xc846a0){logger[_0xa9c5('0x30')](util[_0xa9c5('0x56')](_0xa9c5('0xa8'),_0xc846a0[_0xa9c5('0x39')]));return this[_0xa9c5('0x37')]['agi']([_0xc846a0[_0xa9c5('0xa9')],_0xc846a0[_0xa9c5('0xaa')]]);};AGIVertices[_0xa9c5('0xf')][_0xa9c5('0xab')]=function(_0x3b8ed9){logger['info'](util[_0xa9c5('0x56')]('Enter\x20in\x20ANSWER\x20(%s)\x20block',_0x3b8ed9['label']));if(this[_0xa9c5('0x88')](_0x3b8ed9[_0xa9c5('0x69')])){logger[_0xa9c5('0x30')](util[_0xa9c5('0x56')](_0xa9c5('0xac'),_0x3b8ed9[_0xa9c5('0x69')]));var _0x995d0c=this[_0xa9c5('0x37')]['wait'](_0x3b8ed9[_0xa9c5('0x69')]);if(_0x995d0c[_0xa9c5('0xa3')]===-0x1){return _0x995d0c;}}return this[_0xa9c5('0x37')][_0xa9c5('0xab')]();};AGIVertices['prototype'][_0xa9c5('0xad')]=function(_0x3beb25){logger['info'](util[_0xa9c5('0x56')](_0xa9c5('0xae'),_0x3beb25['label']));if(!this[_0xa9c5('0x88')](_0x3beb25[_0xa9c5('0xaf')])){return this[_0xa9c5('0x37')][_0xa9c5('0x2c')](_0x3beb25,'no\x20list\x20selected');}_0x3beb25[_0xa9c5('0x4b')]=moment();if(this[_0xa9c5('0x88')](_0x3beb25[_0xa9c5('0xb0')])){_0x3beb25['scheduledAt']=moment()[_0xa9c5('0xb1')](_0x3beb25[_0xa9c5('0xb0')],_0xa9c5('0xb2'));}if(!this[_0xa9c5('0x88')](_0x3beb25[_0xa9c5('0x4e')])){_0x3beb25[_0xa9c5('0x4e')]=0x2;}this[_0xa9c5('0x45')][_0xa9c5('0xb3')](this,_0x3beb25);return this['channel'][_0xa9c5('0xb4')](util[_0xa9c5('0x56')](_0xa9c5('0xb5'),_0x3beb25[_0xa9c5('0xb6')],_0x3beb25['list_id'],_0x3beb25[_0xa9c5('0x4b')]));};AGIVertices[_0xa9c5('0xf')][_0xa9c5('0xb7')]=function(_0x5bad74){logger[_0xa9c5('0x30')](util[_0xa9c5('0x56')](_0xa9c5('0xb8'),_0x5bad74[_0xa9c5('0x39')]));var _0x1fc934=this[_0xa9c5('0x37')]['exec'](_0x5bad74[_0xa9c5('0xb9')],_0x5bad74['options']);if(_0x1fc934['result']===-0x1){return _0x1fc934;}return this['channel'][_0xa9c5('0xb4')](util[_0xa9c5('0x56')](_0xa9c5('0xba'),_0x5bad74[_0xa9c5('0xb9')],_0x5bad74[_0xa9c5('0x7e')]));};AGIVertices[_0xa9c5('0xf')]['lumenvoxtts']=function(_0x14a2b2){logger[_0xa9c5('0x30')](util[_0xa9c5('0x56')](_0xa9c5('0xbb'),_0x14a2b2[_0xa9c5('0x39')]));if(!this['isConfigured'](_0x14a2b2['text'])){return this[_0xa9c5('0x37')][_0xa9c5('0xb4')]('no\x20text\x20configured');}var _0x394d76='\x22'+_0x14a2b2[_0xa9c5('0x5e')]+'\x22';if(this['isConfigured'](_0x14a2b2['options'])){_0x394d76+=','+_0x14a2b2['options'];}var _0x5a1f51=this['channel'][_0xa9c5('0xbc')]('MRCPSynth',_0x394d76);if(_0x5a1f51[_0xa9c5('0xa3')]===-0x1){return _0x5a1f51;}return this[_0xa9c5('0x37')][_0xa9c5('0xb4')](util[_0xa9c5('0x56')](_0xa9c5('0xbd'),_0x394d76));};AGIVertices[_0xa9c5('0xf')]['sestektts']=function(_0x32c244){logger[_0xa9c5('0x30')](util['format'](_0xa9c5('0xbe'),_0x32c244[_0xa9c5('0x39')]));if(!this['isConfigured'](_0x32c244[_0xa9c5('0x5e')])){return this['channel'][_0xa9c5('0xb4')]('no\x20text\x20configured');}var _0x5f3b20='\x22'+_0x32c244[_0xa9c5('0x5e')]+'\x22';if(this[_0xa9c5('0x88')](_0x32c244[_0xa9c5('0x7e')])){_0x5f3b20+=','+_0x32c244[_0xa9c5('0x7e')];}var _0x4e2aa8=this[_0xa9c5('0x37')][_0xa9c5('0xbc')]('MRCPSynth',_0x5f3b20);if(_0x4e2aa8['result']===-0x1){return _0x4e2aa8;}return this[_0xa9c5('0x37')]['noop'](util[_0xa9c5('0x56')](_0xa9c5('0xbd'),_0x5f3b20));};AGIVertices[_0xa9c5('0xf')][_0xa9c5('0xbf')]=function(_0x5d1497){logger[_0xa9c5('0x30')](util[_0xa9c5('0x56')](_0xa9c5('0xc0'),_0x5d1497['label']));if(!this['isConfigured'](_0x5d1497['grammar'])){return this[_0xa9c5('0x37')][_0xa9c5('0xb4')](_0xa9c5('0xc1'));}var _0x4d4d58=_0x5d1497['grammar'];if(this[_0xa9c5('0x88')](_0x5d1497[_0xa9c5('0x7e')])){_0x4d4d58+=','+_0x5d1497[_0xa9c5('0x7e')];}var _0x3de8fe=this['channel']['exec'](_0xa9c5('0xc2'),_0x4d4d58);if(_0x3de8fe[_0xa9c5('0xa3')]===-0x1){return _0x3de8fe;}var _0x297918=this['getAndSetVariable']('RECOG_CONFIDENCE()','LUMENVOX_ASR_CONFIDENCE');if(_0x297918[_0xa9c5('0xa3')]===-0x1){return _0x297918;}var _0x14f083=this[_0xa9c5('0xa2')](_0xa9c5('0xc3'),_0xa9c5('0xc4'));if(_0x14f083['result']===-0x1){return _0x14f083;}var _0x130991=this[_0xa9c5('0xa2')]('RECOG_INSTANCE()',_0xa9c5('0xc5'));if(_0x130991[_0xa9c5('0xa3')]===-0x1){return _0x130991;}return this['channel'][_0xa9c5('0xb4')](util['format'](_0xa9c5('0xc6'),_0x4d4d58));};AGIVertices['prototype'][_0xa9c5('0xc7')]=function(_0x254c40){logger[_0xa9c5('0x30')](util['format']('Enter\x20in\x20SESTEKASR\x20(%s)\x20block',_0x254c40[_0xa9c5('0x39')]));if(!this[_0xa9c5('0x88')](_0x254c40[_0xa9c5('0xc8')])){return this[_0xa9c5('0x37')]['noop'](_0xa9c5('0xc1'));}var _0x49978e=_0x254c40[_0xa9c5('0xc8')];if(this[_0xa9c5('0x88')](_0x254c40['options'])){_0x49978e+=','+_0x254c40[_0xa9c5('0x7e')];}var _0x2ea59d=this[_0xa9c5('0x37')][_0xa9c5('0xbc')](_0xa9c5('0xc2'),_0x49978e);if(_0x2ea59d[_0xa9c5('0xa3')]===-0x1){return _0x2ea59d;}var _0x2756f3=this[_0xa9c5('0xa2')]('RECOG_CONFIDENCE()',_0xa9c5('0xc9'));if(_0x2756f3[_0xa9c5('0xa3')]===-0x1){return _0x2756f3;}var _0x16e861=this['getAndSetVariable'](_0xa9c5('0xc3'),'SESTEK_ASR_TRANSCRIPT');if(_0x16e861[_0xa9c5('0xa3')]===-0x1){return _0x16e861;}var _0x49fed9=this[_0xa9c5('0xa2')]('RECOG_INSTANCE()',_0xa9c5('0xca'));if(_0x49fed9['result']===-0x1){return _0x49fed9;}return this['channel'][_0xa9c5('0xb4')](util[_0xa9c5('0x56')](_0xa9c5('0xc6'),_0x49978e));};AGIVertices[_0xa9c5('0xf')][_0xa9c5('0xcb')]=function(_0x90f740){logger[_0xa9c5('0x30')](util[_0xa9c5('0x56')](_0xa9c5('0xcc'),_0x90f740['label']));if(!this[_0xa9c5('0x88')](_0x90f740[_0xa9c5('0xcd')])){return this[_0xa9c5('0x37')][_0xa9c5('0x2c')](_0x90f740,'no\x20database\x20selected');}var _0x3904ab=this[_0xa9c5('0x19')]['sync'](this,_0x90f740[_0xa9c5('0xcd')]);if(!_0x3904ab){return this[_0xa9c5('0x37')]['error'](_0x90f740,'no\x20odbc\x20database\x20found');}if(!this[_0xa9c5('0x88')](_0x90f740['query'])){return this[_0xa9c5('0x37')]['error'](_0x90f740,'no\x20query\x20configured');}var _0x165756=_0x90f740[_0xa9c5('0x2f')][_0xa9c5('0x5b')](/(\r\n|\n|\r)/gm,'\x20');this[_0xa9c5('0x37')][_0xa9c5('0xb4')](util['format'](_0xa9c5('0xce'),_0x165756));var _0x5ba997=this[_0xa9c5('0x2a')][_0xa9c5('0xb3')](this,_0x3904ab,_0x165756);this[_0xa9c5('0x36')]['sync'](this,_0x90f740,_0x165756);if(!this[_0xa9c5('0x88')](_0x90f740[_0xa9c5('0xcf')])){return this[_0xa9c5('0x37')][_0xa9c5('0xb4')](_0xa9c5('0xd0'));}var _0x30f90b=this[_0xa9c5('0x10')][_0xa9c5('0xb3')](this,_0x90f740[_0xa9c5('0xcf')]);if(!_0x30f90b){return this['channel'][_0xa9c5('0x2c')](_0x90f740,_0xa9c5('0xd1'));}var _0x34fe87=this;_0x5ba997[_0xa9c5('0xd2')](function(_0x3ee22c,_0x39fe0d){Object[_0xa9c5('0xd3')](_0x3ee22c)[_0xa9c5('0xd2')](function(_0xa3ac39){_0x34fe87[_0xa9c5('0x37')]['setVariable'](util[_0xa9c5('0x56')]('%s[%s][%s]',_0x30f90b,_0x39fe0d,_0xa3ac39),_0x3ee22c[_0xa3ac39]);});});this[_0xa9c5('0x37')]['setVariable'](util[_0xa9c5('0x56')](_0xa9c5('0xd4'),_0x30f90b),_0x5ba997['length']);return this[_0xa9c5('0x37')][_0xa9c5('0xb4')](util['format']('variable\x20%s\x20set',_0x30f90b));};AGIVertices['prototype']['dial']=function(_0x2498d9){logger['debug'](util['format'](_0xa9c5('0xd5'),_0x2498d9['label']));if(!this[_0xa9c5('0x88')](_0x2498d9[_0xa9c5('0xd6')])){return this[_0xa9c5('0x37')]['error'](_0x2498d9,_0xa9c5('0xd7'));}var _0x3543ac=this[_0xa9c5('0x1b')][_0xa9c5('0xb3')](this,_0x2498d9[_0xa9c5('0xd6')]);if(!_0x3543ac){return this['channel']['error'](_0x2498d9,_0xa9c5('0xd8'));}var _0x19d5fe=this[_0xa9c5('0x37')][_0xa9c5('0xbc')]('DIAL',[util[_0xa9c5('0x56')](_0xa9c5('0xd9'),_0x3543ac),_0x2498d9[_0xa9c5('0x69')],_0x2498d9[_0xa9c5('0xda')],_0x2498d9['url']]);if(_0x19d5fe[_0xa9c5('0xa3')]===-0x1){return _0x19d5fe;}return this[_0xa9c5('0x37')][_0xa9c5('0xb4')](util[_0xa9c5('0x56')]('Executed\x20command\x20%s',_0xa9c5('0xdb')));};AGIVertices[_0xa9c5('0xf')]['dialogflow']=function(_0x569051){logger[_0xa9c5('0x30')](util[_0xa9c5('0x56')]('Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block',_0x569051['label']));if(!this[_0xa9c5('0x88')](_0x569051['key'])){return this[_0xa9c5('0x37')]['noop']('no\x20key\x20configured');}if(!this[_0xa9c5('0x88')](_0x569051[_0xa9c5('0x5e')])){return this[_0xa9c5('0x37')]['noop'](_0xa9c5('0xdc'));}this[_0xa9c5('0x37')]['bot']=!![];this[_0xa9c5('0x36')](_0x569051);this[_0xa9c5('0x44')](_0x569051[_0xa9c5('0x5e')],'in');this[_0xa9c5('0x37')]['noop'](util[_0xa9c5('0x56')](_0xa9c5('0xdd'),_0x569051[_0xa9c5('0x5e')]));var _0x57d167=this[_0xa9c5('0x7f')][_0xa9c5('0xb3')](this,_0x569051);if(_0x57d167){for(var _0x1c9718 in _0x57d167){if(_0x57d167[_0xa9c5('0x95')](_0x1c9718)){this[_0xa9c5('0x37')]['setVariable'](util[_0xa9c5('0x56')](_0xa9c5('0xde'),_0x1c9718[_0xa9c5('0x6e')]()),_0x57d167[_0x1c9718]);}}this[_0xa9c5('0x44')](_0x57d167['speech'],_0xa9c5('0xdf'));return this[_0xa9c5('0x37')][_0xa9c5('0xb4')](util[_0xa9c5('0x56')](_0xa9c5('0xe0'),_0x57d167[_0xa9c5('0xe1')]));}return this['channel'][_0xa9c5('0x2c')](_0x569051,'Dialogflow\x20is\x20unreachable');};AGIVertices[_0xa9c5('0xf')][_0xa9c5('0xe2')]=function(_0x4a5997){logger['info'](util[_0xa9c5('0x56')]('Enter\x20in\x20SESTEKNDA\x20(%s)\x20block',_0x4a5997[_0xa9c5('0x39')]));if(!this['isConfigured'](_0x4a5997['ndauth_url'])){return this[_0xa9c5('0x37')]['noop']('no\x20ndauth\x20url\x20configured');}if(!this['isConfigured'](_0x4a5997[_0xa9c5('0xe3')])){return this[_0xa9c5('0x37')]['noop'](_0xa9c5('0xe4'));}if(!this[_0xa9c5('0x88')](_0x4a5997[_0xa9c5('0xe5')])){return this[_0xa9c5('0x37')][_0xa9c5('0xb4')](_0xa9c5('0xe6'));}if(!this[_0xa9c5('0x88')](_0x4a5997[_0xa9c5('0xe7')])){return this[_0xa9c5('0x37')]['noop'](_0xa9c5('0xdc'));}this['channel'][_0xa9c5('0xe8')]=!![];this[_0xa9c5('0x36')](_0x4a5997);this[_0xa9c5('0x44')](_0x4a5997[_0xa9c5('0x5e')],'in');this['channel'][_0xa9c5('0xb4')](util[_0xa9c5('0x56')]('Trying\x20SestekNDA:\x20%s',_0x4a5997[_0xa9c5('0x5e')]));var _0x4f36d=this[_0xa9c5('0x82')][_0xa9c5('0xb3')](this,_0x4a5997);if(_0x4f36d){for(var _0x492437 in _0x4f36d){if(_0x4f36d['hasOwnProperty'](_0x492437)){this[_0xa9c5('0x37')][_0xa9c5('0x9e')](util[_0xa9c5('0x56')]('SESTEK_NDA_%s',_0x492437['toUpperCase']()),_0x4f36d[_0x492437]);}}this[_0xa9c5('0x44')](_0x4f36d[_0xa9c5('0xe1')],_0xa9c5('0xdf'));if(_0x4f36d[_0xa9c5('0xe9')]){this[_0xa9c5('0x37')][_0xa9c5('0xb4')](util[_0xa9c5('0x56')](_0xa9c5('0xea'),_0x4f36d[_0xa9c5('0xe9')]));var _0x460a9b=this[_0xa9c5('0x37')][_0xa9c5('0xeb')](_0x4f36d[_0xa9c5('0xe9')]);try{fs['unlink'](_0x4f36d[_0xa9c5('0xe9')]+_0xa9c5('0xec'));}catch(_0x4642fa){logger['error'](_0x4642fa);}return _0x460a9b;}else{return this['channel']['noop'](util[_0xa9c5('0x56')]('SestekNDA\x20Result\x20%s',_0x4f36d[_0xa9c5('0xe1')]));}}return this[_0xa9c5('0x37')]['error'](_0x4a5997,'SestekNDA\x20is\x20unreachable');};AGIVertices['prototype']['end']=function(_0x3fc6c5){logger[_0xa9c5('0x30')](util[_0xa9c5('0x56')](_0xa9c5('0xed'),_0x3fc6c5[_0xa9c5('0x39')]));return this['channel']['noop']('end');};AGIVertices[_0xa9c5('0xf')]['ext_dial']=function(_0x528d1f){logger[_0xa9c5('0x30')](util[_0xa9c5('0x56')](_0xa9c5('0xee'),_0x528d1f[_0xa9c5('0x39')]));var _0x23f5ce='';if(_0x528d1f[_0xa9c5('0xef')]){if(!this['isConfigured'](_0x528d1f['trunk_id'])){return this[_0xa9c5('0x37')][_0xa9c5('0x2c')](_0x528d1f,_0xa9c5('0xf0'));}else{var _0xa59391=parseInt(_0x528d1f[_0xa9c5('0xef')],0xa);if(isNaN(_0xa59391)){_0x23f5ce=_0x528d1f[_0xa9c5('0xef')];}else{_0x23f5ce=this[_0xa9c5('0x1c')][_0xa9c5('0xb3')](this,_0x528d1f['trunk_id']);if(!_0x23f5ce){return this[_0xa9c5('0x37')][_0xa9c5('0x2c')](_0x528d1f,_0xa9c5('0xf1'));}}}}else if(_0x528d1f[_0xa9c5('0xf2')]){_0x23f5ce=_0x528d1f[_0xa9c5('0xf2')];}else{return this[_0xa9c5('0x37')][_0xa9c5('0x2c')](_0x528d1f,_0xa9c5('0xf0'));}var _0x3f731c=this[_0xa9c5('0x37')][_0xa9c5('0xbc')](_0xa9c5('0xdb'),[util[_0xa9c5('0x56')]('SIP/%s/%s',_0x23f5ce,_0x528d1f[_0xa9c5('0xb6')]),_0x528d1f[_0xa9c5('0x69')],_0x528d1f[_0xa9c5('0xda')],_0x528d1f['url']]);if(_0x3f731c[_0xa9c5('0xa3')]===-0x1){return _0x3f731c;}return this['channel'][_0xa9c5('0xb4')](util[_0xa9c5('0x56')](_0xa9c5('0xf3'),'DIAL'));};AGIVertices[_0xa9c5('0xf')][_0xa9c5('0xf4')]=function(_0x4dad14){logger['info'](util[_0xa9c5('0x56')](_0xa9c5('0xf5'),_0x4dad14['label']));return this[_0xa9c5('0x37')]['noop']('finally');};AGIVertices[_0xa9c5('0xf')][_0xa9c5('0xb')]=function(_0x24b137){logger[_0xa9c5('0x30')](util['format']('Enter\x20in\x20GETDIGITS\x20(%s)\x20block',_0x24b137[_0xa9c5('0x39')]));if(_0x24b137['retry']===0x0){return this[_0xa9c5('0xa7')](_0x24b137);}_0x24b137[_0xa9c5('0xa6')]-=0x1;if(!this[_0xa9c5('0x88')](_0x24b137[_0xa9c5('0xf6')])){return this['channel'][_0xa9c5('0x2c')](_0x24b137,_0xa9c5('0xf7'));}var _0x4323ff=this['getSound'][_0xa9c5('0xb3')](this,_0x24b137['file_id']);if(!_0x4323ff){return this[_0xa9c5('0x37')][_0xa9c5('0x2c')](_0x24b137,_0xa9c5('0xf8'));}if(!this[_0xa9c5('0x88')](_0x24b137['variable_id'])){return this[_0xa9c5('0x37')][_0xa9c5('0x2c')](_0xa9c5('0xd0'));}var _0x139a03=this[_0xa9c5('0x37')][_0xa9c5('0xf9')](_0x4323ff,_0x24b137[_0xa9c5('0xfa')],_0x24b137['maxdigit']);var _0x21dd05=_0x139a03['result']?_0x139a03['result'][_0xa9c5('0x4d')]():'';logger[_0xa9c5('0x30')](_0xa9c5('0xfb'),JSON[_0xa9c5('0x77')](_0x139a03));if(_0x139a03[_0xa9c5('0xa3')]===-0x1){this[_0xa9c5('0x36')]['sync'](this,_0x24b137,_0x21dd05);return _0x139a03;}else if(_0x139a03[_0xa9c5('0xa5')]===_0xa9c5('0x69')){_0x139a03[_0xa9c5('0xa3')]=_0x21dd05[_0xa9c5('0x9d')]>=parseInt(_0x24b137['mindigit'])?'x':'i';}else{_0x139a03[_0xa9c5('0xa3')]=_0x21dd05[_0xa9c5('0x9d')]>=parseInt(_0x24b137[_0xa9c5('0xfc')])&&_0x21dd05[_0xa9c5('0x9d')]<=parseInt(_0x24b137[_0xa9c5('0xfd')])?'x':'i';}var _0x3e66a3=this[_0xa9c5('0x10')][_0xa9c5('0xb3')](this,_0x24b137['variable_id']);if(!_0x3e66a3){return this[_0xa9c5('0x37')]['error'](_0x24b137,_0xa9c5('0xd1'));}this[_0xa9c5('0x37')][_0xa9c5('0x9e')](_0x3e66a3,_0x21dd05);if(this[_0xa9c5('0x88')](_0x24b137[_0xa9c5('0xfe')])){var _0xc76354=parseInt(_0x24b137['hiddendigitsnum'],0xa);var _0x2731ef=rs[_0xa9c5('0xff')]({'charset':'*','length':_0xc76354});var _0x3e7830=_0x21dd05[_0xa9c5('0x9d')];if(_0x3e7830>0x0){if(_0x3e7830>_0xc76354){this['createSquareDetailsReport'][_0xa9c5('0xb3')](this,_0x24b137,_0x24b137[_0xa9c5('0x100')]===_0xa9c5('0x101')?_0x2731ef+_0x21dd05[_0xa9c5('0x102')](_0xc76354):_0x21dd05[_0xa9c5('0x102')](0x0,_0x3e7830-_0xc76354)+_0x2731ef);}else{this[_0xa9c5('0x36')][_0xa9c5('0xb3')](this,_0x24b137,rs['generate']({'charset':'*','length':_0x3e7830}));}}else{this[_0xa9c5('0x36')][_0xa9c5('0xb3')](this,_0x24b137,'');}}else{this['createSquareDetailsReport'][_0xa9c5('0xb3')](this,_0x24b137,_0x21dd05);}return _0x139a03;};AGIVertices[_0xa9c5('0xf')][_0xa9c5('0xc')]=function(_0x319713){logger[_0xa9c5('0x30')](util[_0xa9c5('0x56')](_0xa9c5('0x103'),_0x319713[_0xa9c5('0x39')]));return this['getdigits'](_0x319713);};AGIVertices[_0xa9c5('0xf')][_0xa9c5('0x104')]=function(_0x576e9c){logger['info'](util['format']('Enter\x20in\x20GOAL\x20(%s)\x20block',_0x576e9c[_0xa9c5('0x39')]));this[_0xa9c5('0x36')][_0xa9c5('0xb3')](this,_0x576e9c,_0x576e9c[_0xa9c5('0x105')]);return this[_0xa9c5('0x37')][_0xa9c5('0xb4')](util['format'](_0xa9c5('0x106'),_0x576e9c['goalname']));};AGIVertices[_0xa9c5('0xf')][_0xa9c5('0x107')]=function(_0x2c8f14){logger[_0xa9c5('0x30')](util['format']('[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block',_0x2c8f14[_0xa9c5('0x39')]));if(!this['isConfigured'](_0x2c8f14['aws_access_key_id'])||!this[_0xa9c5('0x88')](_0x2c8f14[_0xa9c5('0x8c')])){return this[_0xa9c5('0x37')]['noop'](_0xa9c5('0x108'));}if(!this[_0xa9c5('0x88')](_0x2c8f14['text'])){return this[_0xa9c5('0x37')]['noop'](_0xa9c5('0xdc'));}this[_0xa9c5('0x37')][_0xa9c5('0xb4')](util[_0xa9c5('0x56')](_0xa9c5('0x109'),_0x2c8f14[_0xa9c5('0x5e')]));var _0x3f6c04=this[_0xa9c5('0x8a')]['sync'](this,_0x2c8f14);if(_0x3f6c04){this[_0xa9c5('0x37')][_0xa9c5('0xb4')](util['format'](_0xa9c5('0x10a'),_0x3f6c04));var _0x257fcc=this[_0xa9c5('0x37')][_0xa9c5('0xeb')](_0x3f6c04);try{fs['unlink'](_0x3f6c04+_0xa9c5('0xec'));}catch(_0x425a31){logger[_0xa9c5('0x2c')](_0x425a31);}return _0x257fcc;}return this['channel']['error'](_0x2c8f14,_0xa9c5('0x10b'));};AGIVertices[_0xa9c5('0xf')][_0xa9c5('0x10c')]=function(_0x4efd8d){logger[_0xa9c5('0x30')](util[_0xa9c5('0x56')](_0xa9c5('0x10d'),_0x4efd8d[_0xa9c5('0x39')]));if(!this['isConfigured'](_0x4efd8d[_0xa9c5('0x8b')])||!this[_0xa9c5('0x88')](_0x4efd8d['aws_secret_access_key'])){return this[_0xa9c5('0x37')][_0xa9c5('0xb4')](_0xa9c5('0x108'));}if(!this['isConfigured'](_0x4efd8d['aws_bot_name'])){return this['channel'][_0xa9c5('0xb4')](_0xa9c5('0x10e'));}if(!this[_0xa9c5('0x88')](_0x4efd8d['text'])){return this[_0xa9c5('0x37')][_0xa9c5('0xb4')]('no\x20text\x20configured');}this['channel']['bot']=!![];this[_0xa9c5('0x36')](_0x4efd8d);this[_0xa9c5('0x44')](_0x4efd8d['text'],'in');this[_0xa9c5('0x37')]['noop'](util['format']('Trying\x20Amazon\x20Lex:\x20%s',_0x4efd8d['text']));var _0xf86c57=this[_0xa9c5('0x10f')]['sync'](this,_0x4efd8d);if(_0xf86c57){for(var _0x232f48 in _0xf86c57){if(_0xf86c57[_0xa9c5('0x95')](_0x232f48)&&_['isString'](_0xf86c57[_0x232f48])){this[_0xa9c5('0x37')]['setVariable'](util[_0xa9c5('0x56')]('AWS_LEX_%s',_0x232f48[_0xa9c5('0x6e')]()),_0xf86c57[_0x232f48]);}}if(_[_0xa9c5('0x47')](_0xf86c57['message'])){return this['channel']['noop']('Amazon\x20Lex\x20ready\x20for\x20fulfillment');}else{this[_0xa9c5('0x44')](_0xf86c57['message'],'out');return this['channel'][_0xa9c5('0xb4')](util[_0xa9c5('0x56')](_0xa9c5('0x110'),_0xf86c57['message']));}}return this[_0xa9c5('0x37')][_0xa9c5('0x2c')](_0x4efd8d,'Amazon\x20Lex\x20is\x20unreachable');};AGIVertices[_0xa9c5('0xf')][_0xa9c5('0x111')]=function(_0x4eb9a6){logger['info'](util[_0xa9c5('0x56')](_0xa9c5('0x112'),_0x4eb9a6[_0xa9c5('0x39')],_0x4eb9a6['timeout']));if(!this['isConfigured'](_0x4eb9a6[_0xa9c5('0x80')])){return this['channel']['noop'](_0xa9c5('0x113'));}var _0x2b1c0a=_0xa9c5('0x114');var _0x1172c9=util['format'](_0xa9c5('0x115'),FILES_PATH,rs[_0xa9c5('0xff')](0x4));var _0x329cbb=util[_0xa9c5('0x56')](_0xa9c5('0x9f'),_0x1172c9,_0x2b1c0a);var _0x21cbdb=!![];if(_0x4eb9a6[_0xa9c5('0x116')]==='NOBEEP'){_0x21cbdb=![];}var _0x3f09e5=this[_0xa9c5('0x37')]['recordFile'](_0x1172c9,_0x2b1c0a,_0x4eb9a6['intKey'],_0x4eb9a6[_0xa9c5('0x69')],undefined,_0x21cbdb);if(_0x3f09e5[_0xa9c5('0xa3')]!==-0x1){this[_0xa9c5('0x37')][_0xa9c5('0xb4')](util['format'](_0xa9c5('0x117'),_0x329cbb));var _0x162885=this[_0xa9c5('0x90')]['sync'](this,_0x4eb9a6,_0x329cbb);if(_0x162885){for(var _0x49f53f in _0x162885){if(_0x162885[_0xa9c5('0x95')](_0x49f53f)){this[_0xa9c5('0x37')][_0xa9c5('0x9e')](util['format'](_0xa9c5('0x118'),_0x49f53f['toUpperCase']()),_0x162885[_0x49f53f]);}}return this[_0xa9c5('0x37')]['noop'](util[_0xa9c5('0x56')](_0xa9c5('0x119'),JSON['stringify'](_0x162885)));}}return _0x3f09e5;};AGIVertices['prototype'][_0xa9c5('0x11a')]=function(_0x47ecf2){logger[_0xa9c5('0x30')](util[_0xa9c5('0x56')](_0xa9c5('0x11b'),_0x47ecf2[_0xa9c5('0x39')]));if(!this[_0xa9c5('0x88')](_0x47ecf2[_0xa9c5('0x92')])){return this[_0xa9c5('0x37')]['noop'](_0xa9c5('0x11c'));}if(!this[_0xa9c5('0x88')](_0x47ecf2[_0xa9c5('0x11d')])){return this[_0xa9c5('0x37')][_0xa9c5('0xb4')](_0xa9c5('0x11e'));}var _0x1e5ead=_0xa9c5('0x114');var _0x3fafd8=util[_0xa9c5('0x56')](_0xa9c5('0x115'),FILES_PATH,rs[_0xa9c5('0xff')](0x4));var _0x56682d=util[_0xa9c5('0x56')](_0xa9c5('0x9f'),_0x3fafd8,_0x1e5ead);var _0xa1dfbd=!![];if(_0x47ecf2[_0xa9c5('0x116')]===_0xa9c5('0x11f')){_0xa1dfbd=![];}var _0x4d2d4f=this['channel'][_0xa9c5('0x120')](_0x3fafd8,_0x1e5ead,_0x47ecf2[_0xa9c5('0x121')],_0x47ecf2[_0xa9c5('0x69')],undefined,_0xa1dfbd);if(_0x4d2d4f[_0xa9c5('0xa3')]!==-0x1){this['channel']['noop'](util[_0xa9c5('0x56')](_0xa9c5('0x122'),_0x56682d));var _0x1f1415=this[_0xa9c5('0x91')][_0xa9c5('0xb3')](this,_0x47ecf2,_0x56682d);if(_0x1f1415){for(var _0xdce185 in _0x1f1415){if(_0x1f1415[_0xa9c5('0x95')](_0xdce185)){this[_0xa9c5('0x37')][_0xa9c5('0x9e')](util[_0xa9c5('0x56')](_0xa9c5('0x123'),_0xdce185['toUpperCase']()),_0x1f1415[_0xdce185]);}}return this['channel'][_0xa9c5('0xb4')](util[_0xa9c5('0x56')](_0xa9c5('0x124'),JSON[_0xa9c5('0x77')](_0x1f1415)));}}return _0x4d2d4f;};AGIVertices[_0xa9c5('0xf')][_0xa9c5('0x125')]=function(_0x5e7cec){logger[_0xa9c5('0x30')](util['format'](_0xa9c5('0x126'),_0x5e7cec[_0xa9c5('0x39')]));return this[_0xa9c5('0x37')][_0xa9c5('0x127')](_0x5e7cec['context'],_0x5e7cec['extension'],_0x5e7cec[_0xa9c5('0x40')]);};AGIVertices['prototype'][_0xa9c5('0x128')]=function(_0x1224cd){logger[_0xa9c5('0x30')](util[_0xa9c5('0x56')](_0xa9c5('0x129'),_0x1224cd['label']));if(!this[_0xa9c5('0x88')](_0x1224cd[_0xa9c5('0x12a')])){return this[_0xa9c5('0x37')][_0xa9c5('0x2c')](_0x1224cd,'no\x20condition\x20configured');}try{var _0x4ef164=eval(_0x1224cd[_0xa9c5('0x12a')])?_0xa9c5('0x12b'):'false';this[_0xa9c5('0x37')]['noop'](util[_0xa9c5('0x56')](_0xa9c5('0x12c'),_0x1224cd['condition'],_0x4ef164));return{'code':0xc8,'result':_0x4ef164};}catch(_0x2bec03){return{'code':0xc8,'result':_0xa9c5('0x12d')};}};AGIVertices[_0xa9c5('0xf')][_0xa9c5('0x12e')]=function(_0x5d30e0){logger[_0xa9c5('0x30')](util[_0xa9c5('0x56')]('Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block',_0x5d30e0[_0xa9c5('0x39')]));if(!this[_0xa9c5('0x88')](_0x5d30e0['interval_id'])){return this[_0xa9c5('0x37')]['error'](_0x5d30e0,'no\x20interval\x20configured');}var _0x562a98=this[_0xa9c5('0x25')]['sync'](this,_0x5d30e0[_0xa9c5('0x12f')]);if(!_0x562a98){return this['channel'][_0xa9c5('0x2c')](_0x5d30e0,_0xa9c5('0x130'));}for(var _0x56ebd5=0x0;_0x56ebd5<_0x562a98[_0xa9c5('0x9d')];_0x56ebd5+=0x1){var _0x3bc6f2=this[_0xa9c5('0x37')][_0xa9c5('0x10')](util[_0xa9c5('0x56')](_0xa9c5('0x131'),_0x562a98[_0x56ebd5]));if(_0x3bc6f2['result']===-0x1){return _0x3bc6f2;}logger[_0xa9c5('0x30')](util[_0xa9c5('0x56')](_0xa9c5('0x132'),_0x562a98[_0x56ebd5],_0x3bc6f2[_0xa9c5('0xa5')]));if(_0x3bc6f2[_0xa9c5('0xa5')]===_0xa9c5('0x12b')){logger[_0xa9c5('0x30')](util[_0xa9c5('0x56')](_0xa9c5('0x132'),_0x562a98[_0x56ebd5],_0xa9c5('0x12b')));this['channel']['noop'](util[_0xa9c5('0x56')](_0xa9c5('0x132'),_0x562a98[_0x56ebd5],_0xa9c5('0x12b')));return{'code':0xc8,'result':'true'};}else{logger[_0xa9c5('0x30')](util[_0xa9c5('0x56')]('IFTIME\x20%s\x20%s',_0x562a98[_0x56ebd5],_0xa9c5('0x12d')));this[_0xa9c5('0x37')][_0xa9c5('0xb4')](util[_0xa9c5('0x56')]('IFTIME\x20%s\x20%s',_0x562a98[_0x56ebd5],_0xa9c5('0x12d')));}}return{'code':0xc8,'result':_0xa9c5('0x12d')};};AGIVertices['prototype'][_0xa9c5('0x133')]=function(_0x1d6458){logger[_0xa9c5('0x30')](util[_0xa9c5('0x56')](_0xa9c5('0x134'),_0x1d6458['label']));return this[_0xa9c5('0x37')][_0xa9c5('0x133')]();};AGIVertices['prototype'][_0xa9c5('0x135')]=function(_0x130f8d){logger[_0xa9c5('0x30')](util[_0xa9c5('0x56')](_0xa9c5('0x136'),_0x130f8d[_0xa9c5('0x39')]));if(!this['isConfigured'](_0x130f8d['key'])){return this['channel'][_0xa9c5('0xb4')](_0xa9c5('0x113'));}var _0x3e3128=_0xa9c5('0x114');var _0x34c7e0=util[_0xa9c5('0x56')]('%s/recordings/%s',FILES_PATH,rs[_0xa9c5('0xff')](0x4));var _0x22ea93=util['format'](_0xa9c5('0x9f'),_0x34c7e0,_0x3e3128);var _0x2f4b14=!![];if(_0x130f8d[_0xa9c5('0x116')]===_0xa9c5('0x11f')){_0x2f4b14=![];}var _0x221c04=this[_0xa9c5('0x37')][_0xa9c5('0x120')](_0x34c7e0,_0x3e3128,_0x130f8d[_0xa9c5('0x121')],_0x130f8d[_0xa9c5('0x69')],undefined,_0x2f4b14);if(_0x221c04[_0xa9c5('0xa3')]!==-0x1){this[_0xa9c5('0x37')][_0xa9c5('0xb4')](util['format'](_0xa9c5('0x137'),_0x22ea93));var _0x1d0f42=this[_0xa9c5('0x86')][_0xa9c5('0xb3')](this,_0x130f8d,_0x22ea93);if(_0x1d0f42){for(var _0x5c90f2 in _0x1d0f42){if(_0x1d0f42[_0xa9c5('0x95')](_0x5c90f2)){this[_0xa9c5('0x37')][_0xa9c5('0x9e')](util[_0xa9c5('0x56')](_0xa9c5('0x138'),_0x5c90f2[_0xa9c5('0x6e')]()),_0x1d0f42[_0x5c90f2]);}}return this[_0xa9c5('0x37')][_0xa9c5('0xb4')](util[_0xa9c5('0x56')]('IspeechASR\x20Result\x20%s',JSON['stringify'](_0x1d0f42)));}}return _0x221c04;};AGIVertices[_0xa9c5('0xf')]['ispeechtts']=function(_0x4553fb){logger[_0xa9c5('0x30')](util[_0xa9c5('0x56')](_0xa9c5('0x139'),_0x4553fb[_0xa9c5('0x39')]));if(!this[_0xa9c5('0x88')](_0x4553fb[_0xa9c5('0x80')])){return this[_0xa9c5('0x37')]['noop'](_0xa9c5('0x113'));}if(!this[_0xa9c5('0x88')](_0x4553fb[_0xa9c5('0x5e')])){return this[_0xa9c5('0x37')][_0xa9c5('0xb4')](_0xa9c5('0xdc'));}this['channel']['noop'](util[_0xa9c5('0x56')](_0xa9c5('0x13a'),_0x4553fb[_0xa9c5('0x5e')]));var _0x4777dc=this['ispeechTTS'][_0xa9c5('0xb3')](this,_0x4553fb);if(_0x4777dc){this[_0xa9c5('0x37')][_0xa9c5('0xb4')](util[_0xa9c5('0x56')](_0xa9c5('0x137'),_0x4777dc));var _0xa32556=this[_0xa9c5('0x37')][_0xa9c5('0xeb')](_0x4777dc,_0x4553fb[_0xa9c5('0x121')]);try{fs['unlink'](_0x4777dc+_0xa9c5('0xec'));}catch(_0x896ebe){logger[_0xa9c5('0x2c')](_0x896ebe);}return _0xa32556;}return this[_0xa9c5('0x37')]['error'](_0x4553fb,_0xa9c5('0x13b'));};AGIVertices[_0xa9c5('0xf')]['login']=function(_0x40dfbe){logger['info'](util[_0xa9c5('0x56')]('Enter\x20in\x20LOGIN\x20(%s)\x20block',_0x40dfbe[_0xa9c5('0x39')]));if(!this['isConfigured'](_0x40dfbe[_0xa9c5('0x13c')])){return this[_0xa9c5('0x37')]['error'](_0x40dfbe,'no\x20find\x20by\x20configured');}logger['info'](util[_0xa9c5('0x56')](_0xa9c5('0x13d'),this[_0xa9c5('0x37')][_0xa9c5('0x3b')],_0x40dfbe[_0xa9c5('0x13c')]));var _0x382a98=this['agentLogin']['sync'](this,_0x40dfbe[_0xa9c5('0x13c')]);if(_0x382a98){logger[_0xa9c5('0x30')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0xa9c5('0x37')]['callerid'],_0x40dfbe[_0xa9c5('0x13c')]));this['channel'][_0xa9c5('0xb4')](util[_0xa9c5('0x56')](_0xa9c5('0x13e'),this[_0xa9c5('0x37')][_0xa9c5('0x3b')],_0x40dfbe[_0xa9c5('0x13c')]));return{'code':0xc8,'result':_0xa9c5('0x13f')};}else{logger[_0xa9c5('0x30')](util[_0xa9c5('0x56')](_0xa9c5('0x140'),this[_0xa9c5('0x37')]['callerid'],_0x40dfbe[_0xa9c5('0x13c')]));this[_0xa9c5('0x37')][_0xa9c5('0xb4')](util[_0xa9c5('0x56')](_0xa9c5('0x140'),this['channel'][_0xa9c5('0x3b')],_0x40dfbe[_0xa9c5('0x13c')]));return{'code':0xc8,'result':_0xa9c5('0x141')};}};AGIVertices[_0xa9c5('0xf')][_0xa9c5('0x142')]=function(_0x53383f){logger['info'](util[_0xa9c5('0x56')]('Enter\x20in\x20LOGOUT\x20(%s)\x20block',_0x53383f[_0xa9c5('0x39')]));if(!this[_0xa9c5('0x88')](_0x53383f[_0xa9c5('0x13c')])){return this[_0xa9c5('0x37')]['error'](_0x53383f,'no\x20find\x20by\x20configured');}logger[_0xa9c5('0x30')](util['format'](_0xa9c5('0x13d'),this[_0xa9c5('0x37')][_0xa9c5('0x3b')],_0x53383f[_0xa9c5('0x13c')]));var _0x43d0b2=this[_0xa9c5('0x54')][_0xa9c5('0xb3')](this,_0x53383f[_0xa9c5('0x13c')]);if(_0x43d0b2){logger[_0xa9c5('0x30')](util[_0xa9c5('0x56')](_0xa9c5('0x13e'),this[_0xa9c5('0x37')][_0xa9c5('0x3b')],_0x53383f[_0xa9c5('0x13c')]));this[_0xa9c5('0x37')][_0xa9c5('0xb4')](util[_0xa9c5('0x56')](_0xa9c5('0x13e'),this[_0xa9c5('0x37')][_0xa9c5('0x3b')],_0x53383f[_0xa9c5('0x13c')]));return{'code':0xc8,'result':_0xa9c5('0x13f')};}else{logger[_0xa9c5('0x30')](util['format'](_0xa9c5('0x140'),this[_0xa9c5('0x37')][_0xa9c5('0x3b')],_0x53383f[_0xa9c5('0x13c')]));this[_0xa9c5('0x37')]['noop'](util[_0xa9c5('0x56')](_0xa9c5('0x140'),this[_0xa9c5('0x37')][_0xa9c5('0x3b')],_0x53383f[_0xa9c5('0x13c')]));return{'code':0xc8,'result':_0xa9c5('0x141')};}};AGIVertices[_0xa9c5('0xf')][_0xa9c5('0x143')]=function(_0x551faa){logger[_0xa9c5('0x30')](util['format'](_0xa9c5('0x144'),_0x551faa['label']));if(!this['isConfigured'](_0x551faa[_0xa9c5('0x145')])){return this['channel'][_0xa9c5('0x2c')](_0x551faa,_0xa9c5('0x146'));}this[_0xa9c5('0x37')][_0xa9c5('0xb4')](util[_0xa9c5('0x56')](_0xa9c5('0x147'),_0x551faa[_0xa9c5('0x145')]));var _0x87bdd8=eval(_0x551faa[_0xa9c5('0x145')]);if(!this['isConfigured'](_0x551faa['variable_id'])){return this[_0xa9c5('0x37')]['noop'](_0xa9c5('0xd0'));}var _0x179d01=this[_0xa9c5('0x10')][_0xa9c5('0xb3')](this,_0x551faa[_0xa9c5('0xcf')]);if(!_0x179d01){return this['channel'][_0xa9c5('0x2c')](_0x551faa,_0xa9c5('0xd1'));}if(_[_0xa9c5('0x9a')](_0x87bdd8)){var _0x20afd3=this;_0x87bdd8[_0xa9c5('0xd2')](function(_0x284572,_0x16dd30){_0x20afd3[_0xa9c5('0x37')][_0xa9c5('0x9e')](util[_0xa9c5('0x56')]('%s[%s]',_0x179d01,_0x16dd30),_0x284572);});return this[_0xa9c5('0x37')][_0xa9c5('0xb4')](util[_0xa9c5('0x56')](_0xa9c5('0x148'),_0x179d01));}else{return this[_0xa9c5('0x37')][_0xa9c5('0x9e')](_0x179d01,_0x87bdd8);}};AGIVertices['prototype'][_0xa9c5('0xa')]=function(_0xf52a7d){logger[_0xa9c5('0x30')](util[_0xa9c5('0x56')](_0xa9c5('0x149'),_0xf52a7d['label']));if(_0xf52a7d[_0xa9c5('0xa6')]===0x0){return this[_0xa9c5('0xa7')](_0xf52a7d);}_0xf52a7d['retry']-=0x1;if(!this[_0xa9c5('0x88')](_0xf52a7d['file_id'])){return this['channel'][_0xa9c5('0x2c')](_0xf52a7d,_0xa9c5('0xf7'));}var _0x3475db=this[_0xa9c5('0x1e')]['sync'](this,_0xf52a7d[_0xa9c5('0xf6')]);if(!_0x3475db){return this[_0xa9c5('0x37')][_0xa9c5('0x2c')](_0xf52a7d,_0xa9c5('0xf8'));}var _0x2fd62a=this[_0xa9c5('0x37')]['getData'](_0x3475db,_0xf52a7d[_0xa9c5('0xfa')],_0xf52a7d['digit']);var _0x22e203=_0x2fd62a['result'];if(_0x2fd62a[_0xa9c5('0xa3')]===-0x1){this[_0xa9c5('0x36')][_0xa9c5('0xb3')](this,_0xf52a7d,'-1');return _0x2fd62a;}else if(_0x2fd62a[_0xa9c5('0xa5')]===_0xa9c5('0x69')){_0x2fd62a[_0xa9c5('0xa3')]=_0x2fd62a[_0xa9c5('0xa3')]['length']>0x0?_0x2fd62a[_0xa9c5('0xa3')]:'t';}else if(_[_0xa9c5('0x46')](_0x2fd62a[_0xa9c5('0xa3')])){_0x2fd62a[_0xa9c5('0xa3')]='#';_0x22e203='#';}if(!this[_0xa9c5('0x88')](_0xf52a7d['variable_id'])){this['channel']['noop'](_0xa9c5('0xd0'));}else{var _0x4bdf45=this[_0xa9c5('0x10')][_0xa9c5('0xb3')](this,_0xf52a7d['variable_id']);if(!_0x4bdf45){return this[_0xa9c5('0x37')][_0xa9c5('0x2c')](_0xf52a7d,'no\x20variable\x20found');}this[_0xa9c5('0x37')][_0xa9c5('0x9e')](_0x4bdf45,_0x22e203);}this[_0xa9c5('0x36')][_0xa9c5('0xb3')](this,_0xf52a7d,_0x22e203);return _0x2fd62a;};AGIVertices['prototype']['noop']=function(_0x534803){logger[_0xa9c5('0x30')](util[_0xa9c5('0x56')](_0xa9c5('0x14a'),_0x534803[_0xa9c5('0x39')]));return this['channel']['noop'](_0x534803[_0xa9c5('0x14b')]||_0x534803[_0xa9c5('0x39')]);};AGIVertices[_0xa9c5('0xf')][_0xa9c5('0x14c')]=function(_0x352f14){logger[_0xa9c5('0x30')](util['format'](_0xa9c5('0x14d'),_0x352f14[_0xa9c5('0x39')]));if(!this['isConfigured'](_0x352f14['findBy'])){return this[_0xa9c5('0x37')][_0xa9c5('0x2c')](_0x352f14,'no\x20find\x20by\x20configured');}logger[_0xa9c5('0x30')](util[_0xa9c5('0x56')](_0xa9c5('0x13d'),this['channel'][_0xa9c5('0x3b')],_0x352f14['findBy']));var _0x5750ea=this[_0xa9c5('0x4f')][_0xa9c5('0xb3')](this,_0x352f14[_0xa9c5('0x14e')]);var _0x5e7324=this[_0xa9c5('0x51')]['sync'](this,_0x352f14['findBy'],_0x5750ea);if(_0x5e7324){logger[_0xa9c5('0x30')](util[_0xa9c5('0x56')](_0xa9c5('0x13e'),this['channel'][_0xa9c5('0x3b')],_0x352f14['findBy']));this[_0xa9c5('0x37')]['noop'](util['format'](_0xa9c5('0x13e'),this[_0xa9c5('0x37')][_0xa9c5('0x3b')],_0x352f14['findBy']));return{'code':0xc8,'result':'success'};}else{logger['info'](util[_0xa9c5('0x56')](_0xa9c5('0x140'),this[_0xa9c5('0x37')][_0xa9c5('0x3b')],_0x352f14[_0xa9c5('0x13c')]));this[_0xa9c5('0x37')][_0xa9c5('0xb4')](util[_0xa9c5('0x56')](_0xa9c5('0x13e'),this[_0xa9c5('0x37')][_0xa9c5('0x3b')],_0x352f14[_0xa9c5('0x13c')]));return{'code':0xc8,'result':_0xa9c5('0x141')};}};AGIVertices['prototype'][_0xa9c5('0x14f')]=function(_0x5ab29b){logger[_0xa9c5('0x30')](util['format'](_0xa9c5('0x150'),_0x5ab29b[_0xa9c5('0x39')]));if(!this[_0xa9c5('0x88')](_0x5ab29b[_0xa9c5('0xf6')])){return this[_0xa9c5('0x37')][_0xa9c5('0x2c')](_0x5ab29b,'no\x20file\x20audio\x20selected');}var _0x3803d3=this[_0xa9c5('0x1e')][_0xa9c5('0xb3')](this,_0x5ab29b['file_id']);if(!_0x3803d3){return this[_0xa9c5('0x37')][_0xa9c5('0x2c')](_0x5ab29b,_0xa9c5('0xf8'));}var _0x123253=this['channel'][_0xa9c5('0xbc')](_0xa9c5('0x151'),[_0x3803d3,_0x5ab29b[_0xa9c5('0xda')]]);if(_0x123253['result']===-0x1){return _0x123253;}return this['channel'][_0xa9c5('0xb4')](util['format']('Executed\x20command\x20%s\x20%s',_0xa9c5('0x151'),_0x3803d3));};AGIVertices[_0xa9c5('0xf')]['queue']=function(_0x33f3a4){logger[_0xa9c5('0x30')](util['format'](_0xa9c5('0x152'),_0x33f3a4[_0xa9c5('0x39')]));if(!this[_0xa9c5('0x88')](_0x33f3a4[_0xa9c5('0x153')])){return this['channel'][_0xa9c5('0x2c')](_0x33f3a4,_0xa9c5('0x154'));}var _0x3b1aef='';var _0x3d223d=parseInt(_0x33f3a4['queue_id'],0xa);if(isNaN(_0x3d223d)){_0x3b1aef=_0x33f3a4[_0xa9c5('0x153')];}else{_0x3b1aef=this['getVoiceQueue'][_0xa9c5('0xb3')](this,_0x33f3a4[_0xa9c5('0x153')]);if(!_0x3b1aef){return this[_0xa9c5('0x37')][_0xa9c5('0x2c')](_0x33f3a4,_0xa9c5('0x155'));}}var _0x1e49fc='';if(this[_0xa9c5('0x88')](_0x33f3a4[_0xa9c5('0xf6')])){var _0x3c0a5f=this[_0xa9c5('0x1e')]['sync'](this,_0x33f3a4[_0xa9c5('0xf6')]);if(_0x3c0a5f){_0x1e49fc=_0x3c0a5f;}}this[_0xa9c5('0x36')][_0xa9c5('0xb3')](this,_0x33f3a4,_0x3b1aef);if(_0x33f3a4[_0xa9c5('0xda')][_0xa9c5('0x156')]('x')<0x0){_0x33f3a4[_0xa9c5('0xda')]+='x';}if(_0x33f3a4[_0xa9c5('0xda')][_0xa9c5('0x156')]('X')<0x0){_0x33f3a4[_0xa9c5('0xda')]+='X';}this['channel'][_0xa9c5('0x9e')](_0xa9c5('0x157'),_0x3b1aef?_0x3b1aef[_0xa9c5('0x158')]():'');var _0x318e30=this['channel'][_0xa9c5('0xbc')](_0xa9c5('0x159'),[_0x3b1aef,_0x33f3a4[_0xa9c5('0xda')],_0x33f3a4[_0xa9c5('0x67')],_0x1e49fc,_0x33f3a4[_0xa9c5('0x69')],_0x33f3a4[_0xa9c5('0x8')],_0x33f3a4['macro'],_0x33f3a4[_0xa9c5('0x15a')],'',_0x33f3a4[_0xa9c5('0x15b')]]);if(_0x318e30[_0xa9c5('0xa3')]===-0x1){return _0x318e30;}return this[_0xa9c5('0x37')][_0xa9c5('0xb4')](util['format'](_0xa9c5('0xba'),_0xa9c5('0x159'),_0x3b1aef));};AGIVertices[_0xa9c5('0xf')][_0xa9c5('0x15c')]=function(_0x7f1474){logger[_0xa9c5('0x30')](util[_0xa9c5('0x56')](_0xa9c5('0x15d'),_0x7f1474[_0xa9c5('0x39')]));var _0x1140d8=_0x7f1474['recordingFormat']||_0xa9c5('0x114');var _0x244335=util[_0xa9c5('0x56')](_0xa9c5('0x15e'),this['channel'][_0xa9c5('0x38')],rs['generate'](0x5));var _0x289a7a=util[_0xa9c5('0x56')](_0xa9c5('0x15f'),FILES_PATH,_0x244335,_0x1140d8);var _0x4292f5=util['format'](_0xa9c5('0x115'),FILES_PATH,_0x244335);this[_0xa9c5('0x3c')][_0xa9c5('0xb3')](this,_0x7f1474,_0x244335,_0x289a7a);this[_0xa9c5('0x37')][_0xa9c5('0x9e')]('RECORDING_SAVENAME',_0x244335);logger[_0xa9c5('0x30')](_0xa9c5('0x160'),_0x4292f5,_0x1140d8,_0x7f1474[_0xa9c5('0x161')],_0x7f1474[_0xa9c5('0x69')]);return this[_0xa9c5('0x37')][_0xa9c5('0x120')](_0x4292f5,_0x1140d8,_0x7f1474[_0xa9c5('0x161')],_0x7f1474[_0xa9c5('0x69')],undefined,!![]);};AGIVertices[_0xa9c5('0xf')][_0xa9c5('0x162')]=function(_0x5d31bb){logger[_0xa9c5('0x30')](util[_0xa9c5('0x56')](_0xa9c5('0x163'),_0x5d31bb[_0xa9c5('0x39')]));if(!this['isConfigured'](_0x5d31bb[_0xa9c5('0x67')])){return this[_0xa9c5('0x37')]['noop'](_0xa9c5('0x164'));}var _0x4e07e4=this[_0xa9c5('0x66')][_0xa9c5('0xb3')](this,_0x5d31bb);logger[_0xa9c5('0x30')](util[_0xa9c5('0x56')](_0xa9c5('0x165'),util[_0xa9c5('0x166')](_0x4e07e4,{'showHidden':![],'depth':null})));if(!this['isConfigured'](_0x5d31bb['variable_id'])){return this['channel'][_0xa9c5('0xb4')](_0xa9c5('0x167'));}var _0x3fdd32=this[_0xa9c5('0x10')][_0xa9c5('0xb3')](this,_0x5d31bb[_0xa9c5('0xcf')]);if(!_0x3fdd32){return this['channel']['error'](_0x5d31bb,'no\x20variable\x20found');}this['channel']['setVariable'](util['format'](_0xa9c5('0x168'),_0x3fdd32),_0x4e07e4[_0xa9c5('0x7a')]?_0x4e07e4[_0xa9c5('0x7a')]:'200');this[_0xa9c5('0x37')][_0xa9c5('0x9e')](util[_0xa9c5('0x56')]('%s_STATUS_MESSAGE',_0x3fdd32),_0x4e07e4['statusMessage']?_0x4e07e4[_0xa9c5('0x7b')]:'OK');if(_0x4e07e4[_0xa9c5('0x78')]){try{this[_0xa9c5('0x9c')](_0x4e07e4[_0xa9c5('0x78')],_0x3fdd32);}catch(_0xfabac){logger['error'](util[_0xa9c5('0x56')](_0xa9c5('0x169'),_0x3fdd32));}}return this[_0xa9c5('0x37')][_0xa9c5('0xb4')](util[_0xa9c5('0x56')](_0xa9c5('0x16a'),_0x3fdd32));};AGIVertices[_0xa9c5('0xf')]['saydigits']=function(_0x4e1e3c){logger[_0xa9c5('0x30')](util[_0xa9c5('0x56')]('Enter\x20in\x20SAYDIGITS\x20(%s)\x20block',_0x4e1e3c['label']));return this[_0xa9c5('0x37')][_0xa9c5('0x16b')](_0x4e1e3c[_0xa9c5('0x16c')][_0xa9c5('0x5b')](/\s+/g,''),_0x4e1e3c[_0xa9c5('0x161')]);};AGIVertices[_0xa9c5('0xf')][_0xa9c5('0x16d')]=function(_0x2b7f53){logger[_0xa9c5('0x30')](util[_0xa9c5('0x56')](_0xa9c5('0x16e'),_0x2b7f53[_0xa9c5('0x39')]));return this[_0xa9c5('0x37')][_0xa9c5('0x16f')](_0x2b7f53[_0xa9c5('0x68')][_0xa9c5('0x5b')](/\s+/g,''),_0x2b7f53[_0xa9c5('0x161')]);};AGIVertices[_0xa9c5('0xf')][_0xa9c5('0x170')]=function(_0xc50425){logger[_0xa9c5('0x30')](util[_0xa9c5('0x56')]('Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block',_0xc50425[_0xa9c5('0x39')]));return this[_0xa9c5('0x37')]['sayPhonetic'](_0xc50425[_0xa9c5('0x5e')],_0xc50425[_0xa9c5('0x161')]);};AGIVertices[_0xa9c5('0xf')]['sendMail']=function(_0x1bad93){logger['info'](util[_0xa9c5('0x56')](_0xa9c5('0x171'),_0x1bad93[_0xa9c5('0x39')]));if(!this['isConfigured'](_0x1bad93[_0xa9c5('0x172')])){return this[_0xa9c5('0x37')][_0xa9c5('0xb4')](_0xa9c5('0x173'));}var _0x465d84=this[_0xa9c5('0x22')][_0xa9c5('0xb3')](this,_0x1bad93[_0xa9c5('0x172')]);if(!_0x465d84||!_0x465d84[_0xa9c5('0x174')]){return this[_0xa9c5('0x37')][_0xa9c5('0x2c')](_0x1bad93,'no\x20mail\x20account\x20found');}var _0x1aa3b3={'from':util['format'](_0xa9c5('0x175'),_0x465d84[_0xa9c5('0x13')],_0x465d84[_0xa9c5('0x176')]||_0x465d84[_0xa9c5('0x174')][_0xa9c5('0x177')]),'to':_0x1bad93['to']||'','cc':_0x1bad93['cc']||'','bcc':_0x1bad93[_0xa9c5('0x178')]||'','subject':_0x1bad93[_0xa9c5('0x179')],'html':_0x1bad93[_0xa9c5('0x5e')],'text':_0x1bad93['text']};var _0x5c85f3={'tls':{'rejectUnauthorized':![]}};if(_0x465d84[_0xa9c5('0x174')]['service']){_0x5c85f3['service']=_0x465d84[_0xa9c5('0x174')]['service'];}else{_0x5c85f3['host']=_0x465d84[_0xa9c5('0x174')][_0xa9c5('0x17a')];_0x5c85f3[_0xa9c5('0x17b')]=_0x465d84[_0xa9c5('0x174')]['port'];_0x5c85f3['secure']=_0x465d84[_0xa9c5('0x174')][_0xa9c5('0x17c')];}if(_0x465d84[_0xa9c5('0x174')][_0xa9c5('0x17d')]){_0x5c85f3[_0xa9c5('0x17e')]={'user':_0x465d84['Smtp'][_0xa9c5('0x177')],'pass':_0x465d84[_0xa9c5('0x174')][_0xa9c5('0x17f')]};}if(this[_0xa9c5('0x88')](_0x1bad93[_0xa9c5('0x180')])){}logger['debug'](_0xa9c5('0x181'),JSON['stringify'](_0x1aa3b3));this[_0xa9c5('0x36')][_0xa9c5('0xb3')](this,_0x1bad93,_0x1bad93[_0xa9c5('0x172')]);this[_0xa9c5('0x37')][_0xa9c5('0xb4')](util['format'](_0xa9c5('0x182'),_0x465d84[_0xa9c5('0x13')]));this[_0xa9c5('0x24')][_0xa9c5('0xb3')](this,_0x5c85f3,_0x1aa3b3);return this[_0xa9c5('0x37')][_0xa9c5('0xb4')](_0xa9c5('0x183'));};AGIVertices[_0xa9c5('0xf')][_0xa9c5('0x184')]=function(_0x33cebe){logger[_0xa9c5('0x30')](util['format'](_0xa9c5('0x185'),_0x33cebe[_0xa9c5('0x39')]));return this[_0xa9c5('0x37')][_0xa9c5('0xb4')]('SENDFAX\x20block\x20not\x20implemented');};AGIVertices[_0xa9c5('0xf')][_0xa9c5('0x186')]=function(_0xbbd959){logger[_0xa9c5('0x30')](util[_0xa9c5('0x56')]('Enter\x20in\x20SENDSMS\x20(%s)\x20block',_0xbbd959['label']));if(!this[_0xa9c5('0x88')](_0xbbd959[_0xa9c5('0x187')])){return this[_0xa9c5('0x37')][_0xa9c5('0xb4')](_0xa9c5('0x188'));}var _0x4859ed=this['getSmsAccount']['sync'](this,_0xbbd959[_0xa9c5('0x187')]);if(!_0x4859ed){return this['channel'][_0xa9c5('0x2c')](_0xbbd959,_0xa9c5('0x189'));}var _0x56311d={'body':_0xbbd959['sms_text'],'phone':_0xbbd959['to']||'','SmsAccountId':_0x4859ed['id']};logger[_0xa9c5('0x18a')]('sendSMS\x20message',JSON[_0xa9c5('0x77')](_0x56311d));this[_0xa9c5('0x36')][_0xa9c5('0xb3')](this,_0xbbd959,_0xbbd959[_0xa9c5('0x187')]);this[_0xa9c5('0x37')][_0xa9c5('0xb4')](util[_0xa9c5('0x56')](_0xa9c5('0x18b'),_0x4859ed[_0xa9c5('0x13')]));this[_0xa9c5('0x35')][_0xa9c5('0xb3')](this,_0x56311d);return this[_0xa9c5('0x37')]['noop']('Sms\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0xa9c5('0xf')]['set']=function(_0x8fac8e){logger[_0xa9c5('0x30')](util[_0xa9c5('0x56')]('Enter\x20in\x20SET\x20(%s)\x20block',_0x8fac8e[_0xa9c5('0x39')]));if(!this[_0xa9c5('0x88')](_0x8fac8e[_0xa9c5('0xcf')])){return this[_0xa9c5('0x37')]['error'](_0x8fac8e,_0xa9c5('0x18c'));}var _0x57b527=this[_0xa9c5('0x10')][_0xa9c5('0xb3')](this,_0x8fac8e[_0xa9c5('0xcf')]);if(!_0x57b527){return this['channel'][_0xa9c5('0x2c')](_0x8fac8e,_0xa9c5('0xd1'));}return this[_0xa9c5('0x37')][_0xa9c5('0x9e')](_0x57b527,_0x8fac8e['variable_value']);};AGIVertices[_0xa9c5('0xf')]['start']=function(_0x28e4c6){logger[_0xa9c5('0x30')](util[_0xa9c5('0x56')]('Enter\x20in\x20START\x20(%s)\x20block',_0x28e4c6[_0xa9c5('0x39')]));this[_0xa9c5('0x37')]['noop'](_0xa9c5('0x18d'));if(_0x28e4c6[_0xa9c5('0xab')]===_0xa9c5('0x18e')){this[_0xa9c5('0x37')][_0xa9c5('0xb4')](_0xa9c5('0x18f'));return this[_0xa9c5('0x37')]['answer']();}return this[_0xa9c5('0x37')][_0xa9c5('0xb4')](_0xa9c5('0x190'));};AGIVertices['prototype'][_0xa9c5('0x191')]=function(_0xb6510a){logger[_0xa9c5('0x30')](util[_0xa9c5('0x56')](_0xa9c5('0x192'),_0xb6510a[_0xa9c5('0x39')]));if(!this[_0xa9c5('0x88')](_0xb6510a[_0xa9c5('0x193')])){return this[_0xa9c5('0x37')][_0xa9c5('0x2c')](_0xb6510a,_0xa9c5('0x194'));}var _0x4e472f=this[_0xa9c5('0x17')][_0xa9c5('0xb3')](this,_0xb6510a[_0xa9c5('0x193')]);if(!this[_0xa9c5('0x88')](_0x4e472f)){return this[_0xa9c5('0x37')][_0xa9c5('0x2c')](_0xb6510a,util['format'](_0xa9c5('0x195'),_0xb6510a[_0xa9c5('0x193')]));}if(_0x4e472f===this[_0xa9c5('0x37')][_0xa9c5('0x196')]){return this['channel'][_0xa9c5('0x2c')](_0xb6510a,_0xa9c5('0x197'));}this[_0xa9c5('0x36')][_0xa9c5('0xb3')](this,_0xb6510a,_0x4e472f);var _0x83e182=this[_0xa9c5('0x37')]['exec'](_0xa9c5('0x198'),util[_0xa9c5('0x56')](_0xa9c5('0x199'),config[_0xa9c5('0x8')][_0xa9c5('0x17a')]||_0xa9c5('0x19a'),_0x4e472f,this[_0xa9c5('0x37')][_0xa9c5('0x196')]));if(_0x83e182[_0xa9c5('0xa3')]===-0x1){return _0x83e182;}return this['channel']['noop'](util[_0xa9c5('0x56')](_0xa9c5('0xba'),_0xa9c5('0x198'),_0x4e472f));};AGIVertices['prototype'][_0xa9c5('0x19b')]=function(_0x2e85c7){logger[_0xa9c5('0x30')](util[_0xa9c5('0x56')](_0xa9c5('0x19c'),_0x2e85c7[_0xa9c5('0x39')]));var _0xd9beb6=this[_0xa9c5('0x59')]['sync'](this,_0x2e85c7['command']);this[_0xa9c5('0x36')]['sync'](this,_0x2e85c7,_0x2e85c7[_0xa9c5('0xa9')]);if(this[_0xa9c5('0x88')](_0x2e85c7[_0xa9c5('0xcf')])){var _0x6b94fa=this[_0xa9c5('0x10')][_0xa9c5('0xb3')](this,_0x2e85c7[_0xa9c5('0xcf')]);if(_0x6b94fa){this[_0xa9c5('0x37')][_0xa9c5('0x9e')](_0x6b94fa,_0xd9beb6);return this[_0xa9c5('0x37')]['noop'](util[_0xa9c5('0x56')](_0xa9c5('0x19d'),_0x2e85c7[_0xa9c5('0xa9')],_0x6b94fa));}}return this[_0xa9c5('0x37')]['noop'](util[_0xa9c5('0x56')](_0xa9c5('0x19e'),_0x2e85c7[_0xa9c5('0xa9')]));};AGIVertices[_0xa9c5('0xf')][_0xa9c5('0x19f')]=function(_0x1f9fd6){logger[_0xa9c5('0x30')](util[_0xa9c5('0x56')](_0xa9c5('0x1a0'),_0x1f9fd6[_0xa9c5('0x39')]));if(!this[_0xa9c5('0x88')](_0x1f9fd6[_0xa9c5('0x5d')])){return this[_0xa9c5('0x37')][_0xa9c5('0xb4')](_0xa9c5('0x1a1'));}if(!this[_0xa9c5('0x88')](_0x1f9fd6[_0xa9c5('0x5e')])){return this[_0xa9c5('0x37')][_0xa9c5('0xb4')](_0xa9c5('0xdc'));}this[_0xa9c5('0x37')][_0xa9c5('0xb4')](util[_0xa9c5('0x56')](_0xa9c5('0x1a2'),_0x1f9fd6[_0xa9c5('0x5e')]));var _0x5654a9=this['googleCloudTTS'][_0xa9c5('0xb3')](this,_0x1f9fd6);if(_0x5654a9){this[_0xa9c5('0x37')]['noop'](util[_0xa9c5('0x56')](_0xa9c5('0x1a3'),_0x5654a9));var _0x1ff575=this[_0xa9c5('0x37')][_0xa9c5('0xeb')](_0x5654a9);try{fs['unlink'](_0x5654a9+'.wav');}catch(_0x1d14ad){logger['error'](_0x1d14ad);}return _0x1ff575;}return this[_0xa9c5('0x37')][_0xa9c5('0x2c')](_0x1f9fd6,'Google\x20Cloud\x20TTS\x20is\x20unreachable');};AGIVertices[_0xa9c5('0xf')][_0xa9c5('0x1a4')]=function(_0x54af23){logger[_0xa9c5('0x30')](util[_0xa9c5('0x56')](_0xa9c5('0x1a5'),_0x54af23[_0xa9c5('0x39')]));if(!this[_0xa9c5('0x88')](_0x54af23['text'])){return this[_0xa9c5('0x37')][_0xa9c5('0xb4')](_0xa9c5('0xdc'));}this[_0xa9c5('0x37')][_0xa9c5('0xb4')](util[_0xa9c5('0x56')]('Trying\x20Google\x20TTS\x20%s',_0x54af23[_0xa9c5('0x5e')]));var _0x5780b6=this[_0xa9c5('0x64')][_0xa9c5('0xb3')](this,_0x54af23);if(_0x5780b6){this[_0xa9c5('0x37')][_0xa9c5('0xb4')](util[_0xa9c5('0x56')](_0xa9c5('0x1a6'),_0x5780b6));var _0x5a312f=this[_0xa9c5('0x37')][_0xa9c5('0xeb')](_0x5780b6);try{fs[_0xa9c5('0x1a7')](_0x5780b6+_0xa9c5('0xec'));}catch(_0xfda2d3){logger[_0xa9c5('0x2c')](_0xfda2d3);}return _0x5a312f;}return this[_0xa9c5('0x37')][_0xa9c5('0x2c')](_0x54af23,_0xa9c5('0x1a8'));};AGIVertices[_0xa9c5('0xf')][_0xa9c5('0x1a9')]=function(_0x1d190d){logger[_0xa9c5('0x30')](util[_0xa9c5('0x56')](_0xa9c5('0x1aa'),_0x1d190d[_0xa9c5('0x39')]));if(!this[_0xa9c5('0x88')](_0x1d190d['findBy'])){return this[_0xa9c5('0x37')]['error'](_0x1d190d,_0xa9c5('0x1ab'));}logger[_0xa9c5('0x30')](util['format'](_0xa9c5('0x13d'),this['channel'][_0xa9c5('0x3b')],_0x1d190d[_0xa9c5('0x13c')]));var _0x549dcb=this[_0xa9c5('0x53')]['sync'](this,_0x1d190d[_0xa9c5('0x13c')]);if(_0x549dcb){logger['info'](util['format'](_0xa9c5('0x13e'),this[_0xa9c5('0x37')][_0xa9c5('0x3b')],_0x1d190d[_0xa9c5('0x13c')]));this['channel']['noop'](util['format'](_0xa9c5('0x13e'),this['channel'][_0xa9c5('0x3b')],_0x1d190d[_0xa9c5('0x13c')]));return{'code':0xc8,'result':_0xa9c5('0x13f')};}else{logger['info'](util[_0xa9c5('0x56')](_0xa9c5('0x140'),this[_0xa9c5('0x37')][_0xa9c5('0x3b')],_0x1d190d[_0xa9c5('0x13c')]));this[_0xa9c5('0x37')]['noop'](util[_0xa9c5('0x56')](_0xa9c5('0x140'),this[_0xa9c5('0x37')][_0xa9c5('0x3b')],_0x1d190d['findBy']));return{'code':0xc8,'result':_0xa9c5('0x141')};}};AGIVertices[_0xa9c5('0xf')][_0xa9c5('0x1ac')]=function(_0x2d8205){logger[_0xa9c5('0x30')](util[_0xa9c5('0x56')](_0xa9c5('0x1ad'),_0x2d8205[_0xa9c5('0x39')]));var _0x5085cf=this[_0xa9c5('0x37')][_0xa9c5('0xbc')](_0xa9c5('0x1ae'),[_0x2d8205[_0xa9c5('0x1af')],_0x2d8205['options']]);if(_0x5085cf[_0xa9c5('0xa3')]===-0x1){return _0x5085cf;}return this['channel'][_0xa9c5('0xb4')](util[_0xa9c5('0x56')](_0xa9c5('0xba'),_0xa9c5('0x1ae'),_0x2d8205[_0xa9c5('0x1af')]));};AGIVertices[_0xa9c5('0xf')]['vswitch']=function(_0x48b84a){logger[_0xa9c5('0x30')](util[_0xa9c5('0x56')]('Enter\x20in\x20SWITCH\x20(%s)\x20block',_0x48b84a[_0xa9c5('0x39')]));if(!this[_0xa9c5('0x88')](_0x48b84a['variable_id'])){return this[_0xa9c5('0x37')][_0xa9c5('0x2c')](_0x48b84a,_0xa9c5('0x18c'));}var _0x5a8dd6=this[_0xa9c5('0x10')][_0xa9c5('0xb3')](this,_0x48b84a[_0xa9c5('0xcf')]);if(!_0x5a8dd6){return this[_0xa9c5('0x37')][_0xa9c5('0x2c')](_0x48b84a,_0xa9c5('0xd1'));}var _0x4e4de8=this[_0xa9c5('0x37')][_0xa9c5('0x10')](_0x5a8dd6);return{'code':0xc8,'result':_0x4e4de8[_0xa9c5('0xa5')]?_0x4e4de8[_0xa9c5('0xa5')]:'-'};};String[_0xa9c5('0xf')][_0xa9c5('0xa1')]=function(_0x1ff808,_0x1e23c8){return this[_0xa9c5('0xa0')](_0x1ff808)[_0xa9c5('0x1b0')](_0x1e23c8);};module['exports']=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index 1a6e472..ce2cb61 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 _0xa8a8=['blindtransfer','syncBlindTransfer','custom:agentConnectPreview','milliseconds','diff','seconds','prototype','interface','ACW','mandatoryDisposition','QueuePause','then','getAgent','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','stopAcw','lastPauseAt','YYYY-MM-DD\x20HH:mm:ss','queue','updateAcw','update','[%s][UPDATE][ACWTIME:%s]','catch','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','error','finally','[ACW][START]\x20%s','message','uniqueid','[TIMER][STOP][AGENT:%s]','[%s][UPDATE][ERRORS:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','[%s][HANGUP:UNIQUEID]','startAcw','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','syncHangup','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','isNil','transfereeuniqueid','transfertargetuniqueid','secondtransfereruniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','syncAgentRingNoAnswer','autopause','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','util','lodash','moment','../ami','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','bind','hanguprequest','hangup','agentringnoanswer','attendedtransfer','syncAttendedTransfer'];(function(_0x7d90af,_0x719c8c){var _0x1dbe28=function(_0x1a35d2){while(--_0x1a35d2){_0x7d90af['push'](_0x7d90af['shift']());}};_0x1dbe28(++_0x719c8c);}(_0xa8a8,0xec));var _0x8a8a=function(_0x20738a,_0x196feb){_0x20738a=_0x20738a-0x0;var _0x5246b3=_0xa8a8[_0x20738a];return _0x5246b3;};'use strict';var util=require(_0x8a8a('0x0'));var _=require(_0x8a8a('0x1'));var moment=require(_0x8a8a('0x2'));var ami=require(_0x8a8a('0x3'));var logger=require('../../../config/logger')(_0x8a8a('0x4'));var RpcUser=require(_0x8a8a('0x5'));var RpcVoiceAgentReport=require(_0x8a8a('0x6'));function Acw(_0x3ed1de){this[_0x8a8a('0x7')]=_0x3ed1de[_0x8a8a('0x7')];this[_0x8a8a('0x8')]=_0x3ed1de[_0x8a8a('0x8')];this[_0x8a8a('0x9')]=_0x3ed1de[_0x8a8a('0x9')];this[_0x8a8a('0xa')]={};ami['on'](_0x8a8a('0xb'),this[_0x8a8a('0xc')][_0x8a8a('0xd')](this));ami['on'](_0x8a8a('0xe'),this['syncHangupRequest']['bind'](this));ami['on'](_0x8a8a('0xf'),this['syncHangup'][_0x8a8a('0xd')](this));ami['on'](_0x8a8a('0x10'),this['syncAgentRingNoAnswer'][_0x8a8a('0xd')](this));ami['on'](_0x8a8a('0x11'),this[_0x8a8a('0x12')]['bind'](this));ami['on'](_0x8a8a('0x13'),this[_0x8a8a('0x14')][_0x8a8a('0xd')](this));ami['on'](_0x8a8a('0x15'),this['syncAgentConnectPreview'][_0x8a8a('0xd')](this));}function getDiff(_0x4e5d74){var _0x25e1d5=moment()[_0x8a8a('0x16')](0x0);var _0x787eec=moment(_0x4e5d74)[_0x8a8a('0x16')](0x0);return _0x25e1d5[_0x8a8a('0x17')](_0x787eec,_0x8a8a('0x18'));}Acw[_0x8a8a('0x19')]['startAcw']=function(_0x1ed3be){try{var _0x568b83=this;var _0x1f36b6=this[_0x8a8a('0xa')][_0x1ed3be][_0x8a8a('0x1a')];var _0x4291e9=this[_0x8a8a('0xa')][_0x1ed3be]['queue'];var _0x9d55f9=this[_0x8a8a('0x7')][_0x4291e9];var _0x262ca9=![];var _0x2bce13=_0x8a8a('0x1b');if(_0x9d55f9[_0x8a8a('0x1c')]){if(_0x9d55f9['mandatoryDispositionPause']['name']){_0x262ca9=!![];_0x2bce13=_0x9d55f9['mandatoryDispositionPause']['name'];}}ami['Action']({'action':_0x8a8a('0x1d'),'interface':_0x1f36b6,'paused':!![],'reason':_0x2bce13})[_0x8a8a('0x1e')](function(_0xe0f449){if(_0x568b83[_0x8a8a('0x8')][_0x1f36b6]){return RpcUser[_0x8a8a('0x1f')](_0x568b83[_0x8a8a('0x8')][_0x1f36b6]['id'])[_0x8a8a('0x1e')](function(_0xe0321c){if(_0xe0321c&&!_0xe0321c[_0x8a8a('0x20')]){logger[_0x8a8a('0x21')](_0x8a8a('0x22'),_0x1ed3be,_0x1f36b6,_0x4291e9);var _0x3aa2bb=_0x568b83[_0x8a8a('0xa')][_0x1ed3be][_0x8a8a('0x23')]&&_0x568b83[_0x8a8a('0xa')][_0x1ed3be]['destlinkedid']?_0x568b83[_0x8a8a('0xa')][_0x1ed3be][_0x8a8a('0x24')]:_0x1ed3be;return RpcUser[_0x8a8a('0x25')](_0x568b83[_0x8a8a('0x8')][_0x1f36b6],_0x2bce13,_0x3aa2bb)[_0x8a8a('0x1e')](function(_0x251315){if(!_0x262ca9){_0x568b83[_0x8a8a('0x9')][_0x1f36b6]={};logger['info'](_0x8a8a('0x26'),_0x1ed3be,_0x568b83[_0x8a8a('0x7')][_0x4291e9][_0x8a8a('0x27')],_0x1f36b6,_0x4291e9);_0x568b83['timers'][_0x1f36b6]['timer']=setTimeout(_0x568b83[_0x8a8a('0x28')][_0x8a8a('0xd')](_0x568b83,_0x1f36b6),_0x568b83['voiceQueues'][_0x4291e9]['acwTimeout']*0x3e8);_0x568b83['timers'][_0x1f36b6][_0x8a8a('0x29')]=moment()['format'](_0x8a8a('0x2a'));_0x568b83[_0x8a8a('0x9')][_0x1f36b6]['uniqueid']=_0x1ed3be;_0x568b83[_0x8a8a('0x9')][_0x1f36b6][_0x8a8a('0x2b')]=_0x4291e9;_0x568b83[_0x8a8a('0x9')][_0x1f36b6][_0x8a8a('0x2c')]=function(){var _0x41802e=getDiff(_0x568b83[_0x8a8a('0x9')][_0x1f36b6][_0x8a8a('0x29')]);clearTimeout(_0x568b83[_0x8a8a('0x9')][_0x1f36b6]['timer']);_0x568b83['timers'][_0x1f36b6]['timer']=![];RpcVoiceAgentReport[_0x8a8a('0x2d')]({'acwtime':_0x41802e},_0x568b83[_0x8a8a('0x9')][_0x1f36b6]['uniqueid'],_0x1f36b6)[_0x8a8a('0x1e')](function(_0x304e83){logger['info'](_0x8a8a('0x2e'),_0x1ed3be,_0x41802e,_0x304e83);})[_0x8a8a('0x2f')](function(_0x63b9be){logger['error']('[%s][UPDATE][ERRORS:%s]',_0x1ed3be,_0x63b9be);});delete _0x568b83[_0x8a8a('0x9')][_0x1f36b6];};}});}else{logger['info'](_0x8a8a('0x30'),_0x1ed3be,_0x1f36b6,_0x4291e9);}});}})[_0x8a8a('0x2f')](function(_0x3ecbca){logger[_0x8a8a('0x31')](_0x8a8a('0x26'),_0x1ed3be,_0x568b83[_0x8a8a('0x7')][_0x4291e9][_0x8a8a('0x27')],_0x1f36b6,_0x4291e9);})[_0x8a8a('0x32')](function(){delete _0x568b83[_0x8a8a('0xa')][_0x1ed3be];});}catch(_0xf7d4d7){logger[_0x8a8a('0x31')](_0x8a8a('0x33'),_0xf7d4d7[_0x8a8a('0x34')]);}};Acw[_0x8a8a('0x19')][_0x8a8a('0x28')]=function(_0xac4c53){try{var _0x8e3017=this;if(_0x8e3017[_0x8a8a('0x9')][_0xac4c53]){_0x8e3017['timers'][_0xac4c53]['timer']=![];var _0x53da01=_0x8e3017[_0x8a8a('0x9')][_0xac4c53][_0x8a8a('0x35')];var _0x376de3=_0x8e3017[_0x8a8a('0x9')][_0xac4c53][_0x8a8a('0x2b')];var _0x508e67=_0x8e3017['voiceQueues'][_0x376de3][_0x8a8a('0x27')];logger['info'](_0x8a8a('0x36'),_0xac4c53);RpcUser['saveUnpause'](this['agents'][_0xac4c53]);RpcVoiceAgentReport[_0x8a8a('0x2d')]({'acwtime':_0x508e67,'agentacw':!![]},_0x53da01,_0xac4c53)[_0x8a8a('0x1e')](function(_0x285e2c){logger[_0x8a8a('0x21')](_0x8a8a('0x2e'),_0x53da01,_0x508e67,_0x285e2c);})[_0x8a8a('0x2f')](function(_0x20584a){logger['error'](_0x8a8a('0x37'),_0x53da01,_0x20584a);});}else{logger[_0x8a8a('0x31')](_0x8a8a('0x38'),_0xac4c53);if(_0x8e3017['timers']){logger[_0x8a8a('0x21')](_0x8a8a('0x39'),JSON[_0x8a8a('0x3a')](_0x8e3017['timers']));}}}catch(_0x3fda48){logger[_0x8a8a('0x31')](_0x8a8a('0x3b'),_0x3fda48[_0x8a8a('0x34')]);}};Acw[_0x8a8a('0x19')][_0x8a8a('0xc')]=function(_0x4ffdd9){try{if(this['voiceQueues'][_0x4ffdd9[_0x8a8a('0x2b')]]&&(this['voiceQueues'][_0x4ffdd9[_0x8a8a('0x2b')]][_0x8a8a('0x4')]||this['voiceQueues'][_0x4ffdd9['queue']][_0x8a8a('0x1c')])){if(this[_0x8a8a('0x8')][_0x4ffdd9[_0x8a8a('0x1a')]]){this[_0x8a8a('0xa')][_0x4ffdd9['uniqueid']]={'queue':_0x4ffdd9[_0x8a8a('0x2b')],'interface':_0x4ffdd9['interface'],'destlinkedid':_0x4ffdd9[_0x8a8a('0x24')]};}}}catch(_0x1629dc){logger['error'](_0x8a8a('0x3c'),_0x1629dc[_0x8a8a('0x34')]);}};Acw[_0x8a8a('0x19')]['syncAgentConnectPreview']=function(_0x177f89){try{if(this[_0x8a8a('0x7')][_0x177f89[_0x8a8a('0x2b')]]&&(this['voiceQueues'][_0x177f89['queue']][_0x8a8a('0x4')]||this[_0x8a8a('0x7')][_0x177f89[_0x8a8a('0x2b')]]['mandatoryDisposition'])){if(this[_0x8a8a('0x8')][_0x177f89[_0x8a8a('0x1a')]]){this[_0x8a8a('0xa')][_0x177f89[_0x8a8a('0x35')]]={'queue':_0x177f89[_0x8a8a('0x2b')],'interface':_0x177f89[_0x8a8a('0x1a')]};}}}catch(_0x13c233){logger[_0x8a8a('0x31')](_0x8a8a('0x3d'),_0x13c233[_0x8a8a('0x34')]);}};Acw[_0x8a8a('0x19')]['syncHangupRequest']=function(_0x1ad19b){try{if(this[_0x8a8a('0xa')][_0x1ad19b[_0x8a8a('0x35')]]&&_[_0x8a8a('0x3e')](this[_0x8a8a('0xa')][_0x1ad19b[_0x8a8a('0x35')]]['attended'])){logger[_0x8a8a('0x21')](_0x8a8a('0x3f'),_0x1ad19b[_0x8a8a('0x35')]);this[_0x8a8a('0x40')](_0x1ad19b['uniqueid']);}else if(this[_0x8a8a('0xa')][_0x1ad19b[_0x8a8a('0x41')]]&&_[_0x8a8a('0x3e')](this['channels'][_0x1ad19b['linkedid']][_0x8a8a('0x23')])){logger[_0x8a8a('0x21')](_0x8a8a('0x42'),_0x1ad19b[_0x8a8a('0x41')]);this[_0x8a8a('0x40')](_0x1ad19b[_0x8a8a('0x41')]);}}catch(_0x1d1b5c){logger[_0x8a8a('0x31')](_0x8a8a('0x43'),_0x1d1b5c['message']);}};Acw['prototype'][_0x8a8a('0x44')]=function(_0x10f689){try{if(this['channels'][_0x10f689['uniqueid']]&&this[_0x8a8a('0xa')][_0x10f689['uniqueid']][_0x8a8a('0x23')]){logger['info'](_0x8a8a('0x45'),_0x10f689[_0x8a8a('0x35')]);this[_0x8a8a('0x40')](_0x10f689[_0x8a8a('0x35')]);}else if(this[_0x8a8a('0xa')][_0x10f689[_0x8a8a('0x41')]]&&this[_0x8a8a('0xa')][_0x10f689[_0x8a8a('0x41')]][_0x8a8a('0x23')]){logger[_0x8a8a('0x21')]('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0x10f689[_0x8a8a('0x41')]);this[_0x8a8a('0x40')](_0x10f689[_0x8a8a('0x41')]);}}catch(_0x1e3bf5){logger[_0x8a8a('0x31')]('[ACW][syncHangup]\x20%s',_0x1e3bf5[_0x8a8a('0x34')]);}};Acw[_0x8a8a('0x19')]['syncAttendedTransfer']=function(_0x5c5cb6){try{if(!_[_0x8a8a('0x46')](this[_0x8a8a('0xa')][_0x5c5cb6[_0x8a8a('0x47')]])){this[_0x8a8a('0x40')](_0x5c5cb6[_0x8a8a('0x47')]);if(this[_0x8a8a('0xa')][_0x5c5cb6['secondtransfereruniqueid']]){this['channels'][_0x5c5cb6['secondtransfereruniqueid']][_0x8a8a('0x23')]=!![];this['channels'][_0x5c5cb6[_0x8a8a('0x48')]]=this[_0x8a8a('0xa')][_0x5c5cb6['secondtransfereruniqueid']];delete this[_0x8a8a('0xa')][_0x5c5cb6[_0x8a8a('0x49')]];}}else if(!_[_0x8a8a('0x46')](this[_0x8a8a('0xa')][_0x5c5cb6['transfertargetuniqueid']])){this[_0x8a8a('0x40')](_0x5c5cb6['transfertargetuniqueid']);if(this[_0x8a8a('0xa')][_0x5c5cb6[_0x8a8a('0x4a')]]){this['channels'][_0x5c5cb6[_0x8a8a('0x4a')]][_0x8a8a('0x23')]=!![];this[_0x8a8a('0xa')][_0x5c5cb6[_0x8a8a('0x47')]]=this['channels'][_0x5c5cb6[_0x8a8a('0x4a')]];delete this[_0x8a8a('0xa')][_0x5c5cb6[_0x8a8a('0x4a')]];}}}catch(_0x5b029e){logger['error'](_0x8a8a('0x4b'),_0x5b029e['message']);}};Acw['prototype']['syncBlindTransfer']=function(_0x395564){try{if(this[_0x8a8a('0xa')][_0x395564['transfereruniqueid']]){logger[_0x8a8a('0x21')]('[%s][BLINDTRANSFER:UNIQUEID]',JSON['stringify'](_0x395564[_0x8a8a('0x4c')]));this[_0x8a8a('0x40')](_0x395564['transfereruniqueid']);}else if(this[_0x8a8a('0xa')][_0x395564[_0x8a8a('0x4d')]]){logger[_0x8a8a('0x21')](_0x8a8a('0x4e'),JSON[_0x8a8a('0x3a')](_0x395564[_0x8a8a('0x4d')]));this['startAcw'](_0x395564[_0x8a8a('0x4d')]);}}catch(_0x402b5f){logger['error'](_0x8a8a('0x4f'),_0x402b5f[_0x8a8a('0x34')]);}};Acw[_0x8a8a('0x19')][_0x8a8a('0x50')]=function(_0x3c2f8d){try{if(this[_0x8a8a('0x7')][_0x3c2f8d[_0x8a8a('0x2b')]]&&this[_0x8a8a('0x7')][_0x3c2f8d[_0x8a8a('0x2b')]][_0x8a8a('0x51')]==='all'){if(this[_0x8a8a('0x8')][_0x3c2f8d[_0x8a8a('0x1a')]]){logger['info'](_0x8a8a('0x52'),_0x3c2f8d[_0x8a8a('0x35')],_0x3c2f8d[_0x8a8a('0x1a')],_0x3c2f8d[_0x8a8a('0x2b')]);return RpcUser[_0x8a8a('0x25')](this['agents'][_0x3c2f8d[_0x8a8a('0x1a')]],_0x8a8a('0x53'),_0x3c2f8d[_0x8a8a('0x35')]);}}}catch(_0x2984eb){logger[_0x8a8a('0x31')](_0x8a8a('0x54'),_0x2984eb[_0x8a8a('0x34')]);}};module['exports']=Acw; \ No newline at end of file +var _0xeec6=['savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','stopAcw','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','queue','updateAcw','timer','update','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[ACW][START]\x20%s','message','[TIMER][STOP][AGENT:%s]','saveUnpause','[ACW][STOP]\x20%s','interface','attended','[%s][HANGUP:UNIQUEID]','linkedid','isUndefined','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','syncHangup','[ACW][syncHangup]\x20%s','syncAttendedTransfer','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','transfereruniqueid','stringify','[%s][BLINDTRANSFER:LINKEDID]','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','util','lodash','moment','../ami','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','bind','syncHangupRequest','hangup','syncAgentRingNoAnswer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','startAcw','ACW','mandatoryDisposition','mandatoryDispositionPause','name','QueuePause','then','getAgent','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','destlinkedid'];(function(_0x465683,_0x3def21){var _0x4a9122=function(_0x20ccb9){while(--_0x20ccb9){_0x465683['push'](_0x465683['shift']());}};_0x4a9122(++_0x3def21);}(_0xeec6,0x1c2));var _0x6eec=function(_0x5b013d,_0xc7691c){_0x5b013d=_0x5b013d-0x0;var _0x2b6eef=_0xeec6[_0x5b013d];return _0x2b6eef;};'use strict';var util=require(_0x6eec('0x0'));var _=require(_0x6eec('0x1'));var moment=require(_0x6eec('0x2'));var ami=require(_0x6eec('0x3'));var logger=require('../../../config/logger')(_0x6eec('0x4'));var RpcUser=require(_0x6eec('0x5'));var RpcVoiceAgentReport=require(_0x6eec('0x6'));function Acw(_0x2d7a15){this[_0x6eec('0x7')]=_0x2d7a15[_0x6eec('0x7')];this['agents']=_0x2d7a15[_0x6eec('0x8')];this[_0x6eec('0x9')]=_0x2d7a15['timers'];this[_0x6eec('0xa')]={};ami['on'](_0x6eec('0xb'),this[_0x6eec('0xc')][_0x6eec('0xd')](this));ami['on']('hanguprequest',this[_0x6eec('0xe')][_0x6eec('0xd')](this));ami['on'](_0x6eec('0xf'),this['syncHangup']['bind'](this));ami['on']('agentringnoanswer',this[_0x6eec('0x10')][_0x6eec('0xd')](this));ami['on']('attendedtransfer',this['syncAttendedTransfer'][_0x6eec('0xd')](this));ami['on']('blindtransfer',this[_0x6eec('0x11')][_0x6eec('0xd')](this));ami['on'](_0x6eec('0x12'),this[_0x6eec('0x13')][_0x6eec('0xd')](this));}function getDiff(_0x49fccb){var _0x25e2a5=moment()[_0x6eec('0x14')](0x0);var _0x462dbb=moment(_0x49fccb)[_0x6eec('0x14')](0x0);return _0x25e2a5[_0x6eec('0x15')](_0x462dbb,_0x6eec('0x16'));}Acw[_0x6eec('0x17')][_0x6eec('0x18')]=function(_0x34a7fc){try{var _0x2ac797=this;var _0x5e2a9b=this[_0x6eec('0xa')][_0x34a7fc]['interface'];var _0x38c9a4=this[_0x6eec('0xa')][_0x34a7fc]['queue'];var _0x3ee353=this[_0x6eec('0x7')][_0x38c9a4];var _0xb1eab7=![];var _0x56c78b=_0x6eec('0x19');if(_0x3ee353[_0x6eec('0x1a')]){if(_0x3ee353[_0x6eec('0x1b')][_0x6eec('0x1c')]){_0xb1eab7=!![];_0x56c78b=_0x3ee353[_0x6eec('0x1b')][_0x6eec('0x1c')];}}ami['Action']({'action':_0x6eec('0x1d'),'interface':_0x5e2a9b,'paused':!![],'reason':_0x56c78b})[_0x6eec('0x1e')](function(_0x132652){if(_0x2ac797[_0x6eec('0x8')][_0x5e2a9b]){return RpcUser[_0x6eec('0x1f')](_0x2ac797[_0x6eec('0x8')][_0x5e2a9b]['id'])['then'](function(_0x6e40b3){if(_0x6e40b3&&!_0x6e40b3[_0x6eec('0x20')]){logger[_0x6eec('0x21')](_0x6eec('0x22'),_0x34a7fc,_0x5e2a9b,_0x38c9a4);var _0x409b26=_0x2ac797[_0x6eec('0xa')][_0x34a7fc]['attended']&&_0x2ac797[_0x6eec('0xa')][_0x34a7fc][_0x6eec('0x23')]?_0x2ac797[_0x6eec('0xa')][_0x34a7fc][_0x6eec('0x23')]:_0x34a7fc;return RpcUser[_0x6eec('0x24')](_0x2ac797[_0x6eec('0x8')][_0x5e2a9b],_0x56c78b,_0x409b26)[_0x6eec('0x1e')](function(_0x20bed3){if(!_0xb1eab7){_0x2ac797[_0x6eec('0x9')][_0x5e2a9b]={};logger['info'](_0x6eec('0x25'),_0x34a7fc,_0x2ac797[_0x6eec('0x7')][_0x38c9a4][_0x6eec('0x26')],_0x5e2a9b,_0x38c9a4);_0x2ac797[_0x6eec('0x9')][_0x5e2a9b]['timer']=setTimeout(_0x2ac797[_0x6eec('0x27')][_0x6eec('0xd')](_0x2ac797,_0x5e2a9b),_0x2ac797['voiceQueues'][_0x38c9a4]['acwTimeout']*0x3e8);_0x2ac797[_0x6eec('0x9')][_0x5e2a9b]['lastPauseAt']=moment()[_0x6eec('0x28')](_0x6eec('0x29'));_0x2ac797[_0x6eec('0x9')][_0x5e2a9b][_0x6eec('0x2a')]=_0x34a7fc;_0x2ac797[_0x6eec('0x9')][_0x5e2a9b][_0x6eec('0x2b')]=_0x38c9a4;_0x2ac797[_0x6eec('0x9')][_0x5e2a9b][_0x6eec('0x2c')]=function(){var _0x1abd19=getDiff(_0x2ac797[_0x6eec('0x9')][_0x5e2a9b]['lastPauseAt']);clearTimeout(_0x2ac797[_0x6eec('0x9')][_0x5e2a9b]['timer']);_0x2ac797[_0x6eec('0x9')][_0x5e2a9b][_0x6eec('0x2d')]=![];RpcVoiceAgentReport[_0x6eec('0x2e')]({'acwtime':_0x1abd19},_0x2ac797['timers'][_0x5e2a9b]['uniqueid'],_0x5e2a9b)['then'](function(_0x183ce3){logger[_0x6eec('0x21')](_0x6eec('0x2f'),_0x34a7fc,_0x1abd19,_0x183ce3);})[_0x6eec('0x30')](function(_0x20c794){logger[_0x6eec('0x31')](_0x6eec('0x32'),_0x34a7fc,_0x20c794);});delete _0x2ac797[_0x6eec('0x9')][_0x5e2a9b];};}});}else{logger[_0x6eec('0x21')](_0x6eec('0x33'),_0x34a7fc,_0x5e2a9b,_0x38c9a4);}});}})[_0x6eec('0x30')](function(_0x4382df){logger['error'](_0x6eec('0x25'),_0x34a7fc,_0x2ac797[_0x6eec('0x7')][_0x38c9a4][_0x6eec('0x26')],_0x5e2a9b,_0x38c9a4);})['finally'](function(){delete _0x2ac797[_0x6eec('0xa')][_0x34a7fc];});}catch(_0x193732){logger[_0x6eec('0x31')](_0x6eec('0x34'),_0x193732[_0x6eec('0x35')]);}};Acw[_0x6eec('0x17')]['stopAcw']=function(_0x45cfb6){try{var _0x1f10ff=this;if(_0x1f10ff[_0x6eec('0x9')][_0x45cfb6]){_0x1f10ff['timers'][_0x45cfb6]['timer']=![];var _0x28e5fa=_0x1f10ff[_0x6eec('0x9')][_0x45cfb6][_0x6eec('0x2a')];var _0x3f79d1=_0x1f10ff[_0x6eec('0x9')][_0x45cfb6]['queue'];var _0x223dfa=_0x1f10ff[_0x6eec('0x7')][_0x3f79d1][_0x6eec('0x26')];logger[_0x6eec('0x21')](_0x6eec('0x36'),_0x45cfb6);RpcUser[_0x6eec('0x37')](this[_0x6eec('0x8')][_0x45cfb6]);RpcVoiceAgentReport[_0x6eec('0x2e')]({'acwtime':_0x223dfa,'agentacw':!![]},_0x28e5fa,_0x45cfb6)['then'](function(_0x2f7a75){logger[_0x6eec('0x21')]('[%s][UPDATE][ACWTIME:%s]',_0x28e5fa,_0x223dfa,_0x2f7a75);})['catch'](function(_0x160fc0){logger[_0x6eec('0x31')](_0x6eec('0x32'),_0x28e5fa,_0x160fc0);});}else{logger[_0x6eec('0x31')]('[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer',_0x45cfb6);if(_0x1f10ff['timers']){logger[_0x6eec('0x21')]('[ACW][TIMERS]',JSON['stringify'](_0x1f10ff[_0x6eec('0x9')]));}}}catch(_0xe523b9){logger[_0x6eec('0x31')](_0x6eec('0x38'),_0xe523b9[_0x6eec('0x35')]);}};Acw['prototype'][_0x6eec('0xc')]=function(_0x3a4d25){try{if(this['voiceQueues'][_0x3a4d25[_0x6eec('0x2b')]]&&(this[_0x6eec('0x7')][_0x3a4d25['queue']][_0x6eec('0x4')]||this[_0x6eec('0x7')][_0x3a4d25['queue']][_0x6eec('0x1a')])){if(this[_0x6eec('0x8')][_0x3a4d25[_0x6eec('0x39')]]){this[_0x6eec('0xa')][_0x3a4d25['uniqueid']]={'queue':_0x3a4d25[_0x6eec('0x2b')],'interface':_0x3a4d25[_0x6eec('0x39')],'destlinkedid':_0x3a4d25[_0x6eec('0x23')]};}}}catch(_0x165498){logger[_0x6eec('0x31')]('[ACW][syncAgentConnect]\x20%s',_0x165498['message']);}};Acw[_0x6eec('0x17')][_0x6eec('0x13')]=function(_0x3703b5){try{if(this[_0x6eec('0x7')][_0x3703b5[_0x6eec('0x2b')]]&&(this['voiceQueues'][_0x3703b5[_0x6eec('0x2b')]]['acw']||this[_0x6eec('0x7')][_0x3703b5[_0x6eec('0x2b')]][_0x6eec('0x1a')])){if(this['agents'][_0x3703b5[_0x6eec('0x39')]]){this[_0x6eec('0xa')][_0x3703b5[_0x6eec('0x2a')]]={'queue':_0x3703b5[_0x6eec('0x2b')],'interface':_0x3703b5[_0x6eec('0x39')]};}}}catch(_0x4be225){logger[_0x6eec('0x31')]('[ACW][syncAgentConnectPreview]\x20%s',_0x4be225['message']);}};Acw[_0x6eec('0x17')]['syncHangupRequest']=function(_0x245a1b){try{if(this[_0x6eec('0xa')][_0x245a1b[_0x6eec('0x2a')]]&&_['isUndefined'](this['channels'][_0x245a1b[_0x6eec('0x2a')]][_0x6eec('0x3a')])){logger[_0x6eec('0x21')](_0x6eec('0x3b'),_0x245a1b[_0x6eec('0x2a')]);this[_0x6eec('0x18')](_0x245a1b[_0x6eec('0x2a')]);}else if(this[_0x6eec('0xa')][_0x245a1b[_0x6eec('0x3c')]]&&_[_0x6eec('0x3d')](this['channels'][_0x245a1b['linkedid']][_0x6eec('0x3a')])){logger[_0x6eec('0x21')](_0x6eec('0x3e'),_0x245a1b['linkedid']);this[_0x6eec('0x18')](_0x245a1b[_0x6eec('0x3c')]);}}catch(_0x16c0da){logger[_0x6eec('0x31')](_0x6eec('0x3f'),_0x16c0da[_0x6eec('0x35')]);}};Acw[_0x6eec('0x17')][_0x6eec('0x40')]=function(_0x5a6e05){try{if(this[_0x6eec('0xa')][_0x5a6e05[_0x6eec('0x2a')]]&&this[_0x6eec('0xa')][_0x5a6e05[_0x6eec('0x2a')]]['attended']){logger['info']('[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]',_0x5a6e05[_0x6eec('0x2a')]);this[_0x6eec('0x18')](_0x5a6e05[_0x6eec('0x2a')]);}else if(this[_0x6eec('0xa')][_0x5a6e05['linkedid']]&&this['channels'][_0x5a6e05[_0x6eec('0x3c')]][_0x6eec('0x3a')]){logger[_0x6eec('0x21')]('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0x5a6e05[_0x6eec('0x3c')]);this[_0x6eec('0x18')](_0x5a6e05[_0x6eec('0x3c')]);}}catch(_0xf957c1){logger[_0x6eec('0x31')](_0x6eec('0x41'),_0xf957c1[_0x6eec('0x35')]);}};Acw[_0x6eec('0x17')][_0x6eec('0x42')]=function(_0x4e921a){try{if(!_[_0x6eec('0x43')](this['channels'][_0x4e921a[_0x6eec('0x44')]])){this[_0x6eec('0x18')](_0x4e921a[_0x6eec('0x44')]);if(this[_0x6eec('0xa')][_0x4e921a[_0x6eec('0x45')]]){this[_0x6eec('0xa')][_0x4e921a[_0x6eec('0x45')]]['attended']=!![];this[_0x6eec('0xa')][_0x4e921a['transfertargetuniqueid']]=this[_0x6eec('0xa')][_0x4e921a['secondtransfereruniqueid']];delete this[_0x6eec('0xa')][_0x4e921a[_0x6eec('0x45')]];}}else if(!_[_0x6eec('0x43')](this[_0x6eec('0xa')][_0x4e921a[_0x6eec('0x46')]])){this[_0x6eec('0x18')](_0x4e921a[_0x6eec('0x46')]);if(this[_0x6eec('0xa')][_0x4e921a[_0x6eec('0x47')]]){this[_0x6eec('0xa')][_0x4e921a['origtransfereruniqueid']]['attended']=!![];this[_0x6eec('0xa')][_0x4e921a[_0x6eec('0x44')]]=this[_0x6eec('0xa')][_0x4e921a[_0x6eec('0x47')]];delete this[_0x6eec('0xa')][_0x4e921a['origtransfereruniqueid']];}}}catch(_0x1d8fb1){logger[_0x6eec('0x31')]('[ACW][syncAttendedTransfer]\x20%s',_0x1d8fb1['message']);}};Acw['prototype'][_0x6eec('0x11')]=function(_0x3dfd47){try{if(this['channels'][_0x3dfd47[_0x6eec('0x48')]]){logger[_0x6eec('0x21')]('[%s][BLINDTRANSFER:UNIQUEID]',JSON[_0x6eec('0x49')](_0x3dfd47[_0x6eec('0x48')]));this[_0x6eec('0x18')](_0x3dfd47[_0x6eec('0x48')]);}else if(this['channels'][_0x3dfd47['transfererlinkedid']]){logger[_0x6eec('0x21')](_0x6eec('0x4a'),JSON[_0x6eec('0x49')](_0x3dfd47[_0x6eec('0x4b')]));this[_0x6eec('0x18')](_0x3dfd47[_0x6eec('0x4b')]);}}catch(_0x169607){logger[_0x6eec('0x31')](_0x6eec('0x4c'),_0x169607[_0x6eec('0x35')]);}};Acw[_0x6eec('0x17')][_0x6eec('0x10')]=function(_0x2799ca){try{if(this[_0x6eec('0x7')][_0x2799ca[_0x6eec('0x2b')]]&&this[_0x6eec('0x7')][_0x2799ca[_0x6eec('0x2b')]]['autopause']===_0x6eec('0x4d')){if(this[_0x6eec('0x8')][_0x2799ca['interface']]){logger[_0x6eec('0x21')](_0x6eec('0x4e'),_0x2799ca['uniqueid'],_0x2799ca[_0x6eec('0x39')],_0x2799ca[_0x6eec('0x2b')]);return RpcUser[_0x6eec('0x24')](this[_0x6eec('0x8')][_0x2799ca['interface']],_0x6eec('0x4f'),_0x2799ca[_0x6eec('0x2a')]);}}}catch(_0x3a9a5b){logger[_0x6eec('0x31')](_0x6eec('0x50'),_0x3a9a5b[_0x6eec('0x35')]);}};module['exports']=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 1c26caf..b137621 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 _0x77ca=['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','actionDeviceStateList','devicestatelist','sippeerstatus','actionQueueSummary','queuesummary','actionCoreShowChannels','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','connect','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','actionSipPeerStatus','catch','log','close','exports','asterisk-manager','bluebird','moment','util','lodash','asterisk','port','username','password','Action'];(function(_0x12a554,_0x3d7ef8){var _0x244ba0=function(_0x5eb5ff){while(--_0x5eb5ff){_0x12a554['push'](_0x12a554['shift']());}};_0x244ba0(++_0x3d7ef8);}(_0x77ca,0x107));var _0xa77c=function(_0x38a7b1,_0x4e6237){_0x38a7b1=_0x38a7b1-0x0;var _0x5308ec=_0x77ca[_0x38a7b1];return _0x5308ec;};'use strict';var Manager=require(_0xa77c('0x0'));var BPromise=require(_0xa77c('0x1'));var moment=require(_0xa77c('0x2'));var util=require(_0xa77c('0x3'));var _=require(_0xa77c('0x4'));var logger=require('../../config/logger')('ami');var config=require('../../config/environment');var ami=new Manager(config[_0xa77c('0x5')][_0xa77c('0x6')],config[_0xa77c('0x5')]['ip'],config[_0xa77c('0x5')][_0xa77c('0x7')],config[_0xa77c('0x5')][_0xa77c('0x8')],!![]);ami['keepConnected']();ami[_0xa77c('0x9')]=BPromise['promisify'](ami[_0xa77c('0xa')]);function error(_0xc8f1c5){logger[_0xa77c('0xb')](util[_0xa77c('0xc')](_0xa77c('0xd'),config[_0xa77c('0x5')]['username'],config[_0xa77c('0x5')]['ip'],config[_0xa77c('0x5')][_0xa77c('0x6')],util[_0xa77c('0xe')](_0xc8f1c5,![],null)));}function close(){logger['error'](util[_0xa77c('0xc')](_0xa77c('0xf'),config[_0xa77c('0x5')][_0xa77c('0x7')],config[_0xa77c('0x5')]['ip'],config['asterisk'][_0xa77c('0x6')]));}ami[_0xa77c('0x10')]=function(){return function(){return ami[_0xa77c('0x9')]({'action':'sipshowregistry'});};};ami[_0xa77c('0x11')]=function(){return function(){return ami[_0xa77c('0x9')]({'action':_0xa77c('0x12')});};};ami['actionSipPeerStatus']=function(){return function(){return ami['Action']({'action':_0xa77c('0x13')});};};ami[_0xa77c('0x14')]=function(){return function(){return ami[_0xa77c('0x9')]({'action':_0xa77c('0x15')});};};ami[_0xa77c('0x16')]=function(){return function(){return ami['Action']({'action':_0xa77c('0x17')});};};function connect(_0x1feb86){logger[_0xa77c('0x18')](util[_0xa77c('0xc')](_0xa77c('0x19'),config[_0xa77c('0x5')][_0xa77c('0x7')],config[_0xa77c('0x5')]['ip'],config['asterisk']['port']));ami[_0xa77c('0x1a')](_0xa77c('0xb'),error);ami[_0xa77c('0x1a')]('close',close);}ami['on'](_0xa77c('0x1b'),connect);ami['on'](_0xa77c('0x1c'),function(_0x495a52){logger[_0xa77c('0x18')](util[_0xa77c('0xc')](_0xa77c('0x1d'),config['asterisk']['username'],config[_0xa77c('0x5')]['ip'],config[_0xa77c('0x5')][_0xa77c('0x6')],util[_0xa77c('0xe')](_0x495a52,![],null)));});ami['on'](_0xa77c('0x1e'),function(_0x1bf496){logger[_0xa77c('0x18')](util[_0xa77c('0xc')](_0xa77c('0x1f'),config[_0xa77c('0x5')][_0xa77c('0x7')],config[_0xa77c('0x5')]['ip'],config[_0xa77c('0x5')]['port']));return BPromise[_0xa77c('0x20')]()['then'](ami[_0xa77c('0x10')]())['then'](ami[_0xa77c('0x11')]())[_0xa77c('0x21')](ami[_0xa77c('0x22')]())['then'](ami[_0xa77c('0x14')]())['then'](ami[_0xa77c('0x16')]())[_0xa77c('0x23')](function(_0x2a6b39){console[_0xa77c('0x24')](_0x2a6b39);});});ami['once']('error',error);ami[_0xa77c('0x1a')](_0xa77c('0x25'),close);module[_0xa77c('0x26')]=ami; \ No newline at end of file +var _0x5a49=['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','actionDeviceStateList','devicestatelist','actionSipPeerStatus','sippeerstatus','queuesummary','actionCoreShowChannels','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','then','actionQueueSummary','catch','log','exports','bluebird','util','lodash','../../config/logger','../../config/environment','asterisk','port','username'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5a49,0x188));var _0x95a4=function(_0x54411d,_0xef4978){_0x54411d=_0x54411d-0x0;var _0x36bc4e=_0x5a49[_0x54411d];return _0x36bc4e;};'use strict';var Manager=require('asterisk-manager');var BPromise=require(_0x95a4('0x0'));var moment=require('moment');var util=require(_0x95a4('0x1'));var _=require(_0x95a4('0x2'));var logger=require(_0x95a4('0x3'))('ami');var config=require(_0x95a4('0x4'));var ami=new Manager(config[_0x95a4('0x5')][_0x95a4('0x6')],config[_0x95a4('0x5')]['ip'],config[_0x95a4('0x5')][_0x95a4('0x7')],config['asterisk']['password'],!![]);ami[_0x95a4('0x8')]();ami[_0x95a4('0x9')]=BPromise[_0x95a4('0xa')](ami[_0x95a4('0xb')]);function error(_0x3a08d0){logger[_0x95a4('0xc')](util[_0x95a4('0xd')](_0x95a4('0xe'),config[_0x95a4('0x5')][_0x95a4('0x7')],config['asterisk']['ip'],config['asterisk']['port'],util[_0x95a4('0xf')](_0x3a08d0,![],null)));}function close(){logger[_0x95a4('0xc')](util[_0x95a4('0xd')](_0x95a4('0x10'),config['asterisk'][_0x95a4('0x7')],config[_0x95a4('0x5')]['ip'],config[_0x95a4('0x5')]['port']));}ami[_0x95a4('0x11')]=function(){return function(){return ami['Action']({'action':_0x95a4('0x12')});};};ami[_0x95a4('0x13')]=function(){return function(){return ami['Action']({'action':_0x95a4('0x14')});};};ami[_0x95a4('0x15')]=function(){return function(){return ami[_0x95a4('0x9')]({'action':_0x95a4('0x16')});};};ami['actionQueueSummary']=function(){return function(){return ami[_0x95a4('0x9')]({'action':_0x95a4('0x17')});};};ami[_0x95a4('0x18')]=function(){return function(){return ami['Action']({'action':_0x95a4('0x19')});};};function connect(_0x40ea58){logger[_0x95a4('0x1a')](util['format'](_0x95a4('0x1b'),config[_0x95a4('0x5')]['username'],config[_0x95a4('0x5')]['ip'],config[_0x95a4('0x5')][_0x95a4('0x6')]));ami[_0x95a4('0x1c')](_0x95a4('0xc'),error);ami[_0x95a4('0x1c')](_0x95a4('0x1d'),close);}ami['on'](_0x95a4('0x1e'),connect);ami['on'](_0x95a4('0x1f'),function(_0x1cbc21){logger[_0x95a4('0x1a')](util[_0x95a4('0xd')](_0x95a4('0x20'),config[_0x95a4('0x5')][_0x95a4('0x7')],config['asterisk']['ip'],config[_0x95a4('0x5')][_0x95a4('0x6')],util[_0x95a4('0xf')](_0x1cbc21,![],null)));});ami['on'](_0x95a4('0x21'),function(_0x417852){logger[_0x95a4('0x1a')](util[_0x95a4('0xd')](_0x95a4('0x22'),config[_0x95a4('0x5')][_0x95a4('0x7')],config[_0x95a4('0x5')]['ip'],config['asterisk'][_0x95a4('0x6')]));return BPromise['resolve']()[_0x95a4('0x23')](ami['actionSipShowRegistry']())[_0x95a4('0x23')](ami['actionDeviceStateList']())[_0x95a4('0x23')](ami[_0x95a4('0x15')]())[_0x95a4('0x23')](ami[_0x95a4('0x24')]())[_0x95a4('0x23')](ami[_0x95a4('0x18')]())[_0x95a4('0x25')](function(_0x3032e1){console[_0x95a4('0x26')](_0x3032e1);});});ami[_0x95a4('0x1c')](_0x95a4('0xc'),error);ami[_0x95a4('0x1c')]('close',close);module[_0x95a4('0x27')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index b8ac318..6d42d40 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 _0x8899=['http','Request','request','then','debug','rpc','memberReport','error','message','result','catch','jayson/promise','bluebird','../../config/logger','ami','client'];(function(_0xd93cbe,_0x11202e){var _0xe0bb40=function(_0x50f4cc){while(--_0x50f4cc){_0xd93cbe['push'](_0xd93cbe['shift']());}};_0xe0bb40(++_0x11202e);}(_0x8899,0xfb));var _0x9889=function(_0xa0cfa2,_0x57f72c){_0xa0cfa2=_0xa0cfa2-0x0;var _0x2f550e=_0x8899[_0xa0cfa2];return _0x2f550e;};'use strict';var jayson=require(_0x9889('0x0'));var BPromise=require(_0x9889('0x1'));var logger=require(_0x9889('0x2'))(_0x9889('0x3'));var client=jayson[_0x9889('0x4')][_0x9889('0x5')]({'port':0x2329});client[_0x9889('0x6')]=function(_0x50691a,_0x4638a7){return new BPromise(function(_0x5c600d,_0x4354f3){return client[_0x9889('0x7')](_0x50691a,_0x4638a7)[_0x9889('0x8')](function(_0x5f1b76){logger[_0x9889('0x9')](_0x9889('0xa'),_0x9889('0xb'),_0x50691a,_0x4638a7,_0x5f1b76);if(_0x5f1b76[_0x9889('0xc')]){logger[_0x9889('0xc')](_0x9889('0xa'),_0x9889('0xb'),_0x50691a,_0x5f1b76[_0x9889('0xc')]['message'],_0x4638a7);return _0x4354f3(_0x5f1b76['error'][_0x9889('0xd')]);}else{return _0x5c600d(_0x5f1b76[_0x9889('0xe')]);}})[_0x9889('0xf')](function(_0x9a5897){logger[_0x9889('0xc')]('rpc','memberReport',_0x50691a,_0x9a5897,_0x4638a7);return _0x4354f3(_0x9a5897);});});};module['exports']=client; \ No newline at end of file +var _0xc6c4=['../../config/logger','ami','client','http','Request','rpc','error','memberReport','message','result','catch','exports','jayson/promise','bluebird'];(function(_0xa261f5,_0x37ed4e){var _0x4a889b=function(_0x2e1c9f){while(--_0x2e1c9f){_0xa261f5['push'](_0xa261f5['shift']());}};_0x4a889b(++_0x37ed4e);}(_0xc6c4,0xc2));var _0x4c6c=function(_0x325c43,_0x1fc5a4){_0x325c43=_0x325c43-0x0;var _0x152e36=_0xc6c4[_0x325c43];return _0x152e36;};'use strict';var jayson=require(_0x4c6c('0x0'));var BPromise=require(_0x4c6c('0x1'));var logger=require(_0x4c6c('0x2'))(_0x4c6c('0x3'));var client=jayson[_0x4c6c('0x4')][_0x4c6c('0x5')]({'port':0x2329});client[_0x4c6c('0x6')]=function(_0x1e6820,_0x35e9f7){return new BPromise(function(_0x455705,_0x56c021){return client['request'](_0x1e6820,_0x35e9f7)['then'](function(_0x4d39de){logger['debug'](_0x4c6c('0x7'),'memberReport',_0x1e6820,_0x35e9f7,_0x4d39de);if(_0x4d39de[_0x4c6c('0x8')]){logger['error']('rpc',_0x4c6c('0x9'),_0x1e6820,_0x4d39de[_0x4c6c('0x8')][_0x4c6c('0xa')],_0x35e9f7);return _0x56c021(_0x4d39de[_0x4c6c('0x8')]['message']);}else{return _0x455705(_0x4d39de[_0x4c6c('0xb')]);}})[_0x4c6c('0xc')](function(_0x25337a){logger[_0x4c6c('0x8')]('rpc',_0x4c6c('0x9'),_0x1e6820,_0x25337a,_0x35e9f7);return _0x56c021(_0x25337a);});});};module[_0x4c6c('0xd')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/action.js b/server/services/ami/dialer/action.js index 53b76b5..c305d15 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 _0x2f3a=['callbackuniqueid','callbackat','recallme','originatecalleridnum','prototype','getCaller','\x22%s\x22\x20<%s>','voiceQueue','dialCutDigit','queue','exports','util','isNil','string','name','Contact','phone','lastName','number','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','firstName','format','YYYY-MM-DD\x20HH:mm:ss','callback'];(function(_0x66643f,_0x3df440){var _0x57eb57=function(_0x14d66e){while(--_0x14d66e){_0x66643f['push'](_0x66643f['shift']());}};_0x57eb57(++_0x3df440);}(_0x2f3a,0xfb));var _0xa2f3=function(_0x21b432,_0x3b059d){_0x21b432=_0x21b432-0x0;var _0x16a6cb=_0x2f3a[_0x21b432];return _0x16a6cb;};'use strict';var util=require(_0xa2f3('0x0'));var _=require('lodash');var moment=require('moment');function checkNameSurname(_0x18d845,_0x377db3,_0x5551cd){var _0x2b064c='';if(!_[_0xa2f3('0x1')](_0x377db3)&&_0xa2f3('0x2')===typeof _0x377db3){_0x2b064c+=_0x377db3;}if(!_['isNil'](_0x5551cd)&&_0xa2f3('0x2')===typeof _0x5551cd){_0x2b064c+='\x20'+_0x5551cd;}if(_0x2b064c!==''){return _0x2b064c;}return _0x18d845;}function Action(_0x589d0f,_0xfe0b09,_0x1ddec0){this['voiceQueue']=_0x589d0f;this['uniqueid']=_0x1ddec0||undefined;this[_0xa2f3('0x3')]=checkNameSurname(_0xfe0b09[_0xa2f3('0x4')][_0xa2f3('0x5')],_0xfe0b09[_0xa2f3('0x4')]['firstName'],_0xfe0b09[_0xa2f3('0x4')][_0xa2f3('0x6')]);this[_0xa2f3('0x7')]=_0xfe0b09[_0xa2f3('0x4')][_0xa2f3('0x5')];this['queue']=_0x589d0f[_0xa2f3('0x3')];this[_0xa2f3('0x8')]=_0xfe0b09['active']||![];this[_0xa2f3('0x9')]=_0x589d0f[_0xa2f3('0x9')];this[_0xa2f3('0xa')]=_0x589d0f['dialQueueTimeout']||0x3;this[_0xa2f3('0xb')]=_0xfe0b09[_0xa2f3('0xb')];this[_0xa2f3('0xc')]=_0xfe0b09[_0xa2f3('0xc')];this[_0xa2f3('0xd')]=_0xfe0b09[_0xa2f3('0xd')];this[_0xa2f3('0xe')]=_0xfe0b09[_0xa2f3('0xe')];this[_0xa2f3('0xf')]=_0xfe0b09['countnosuchnumberretry'];this[_0xa2f3('0x10')]=_0xfe0b09[_0xa2f3('0x10')];this[_0xa2f3('0x11')]=_0xfe0b09['countabandonedretry'];this[_0xa2f3('0x12')]=_0xfe0b09[_0xa2f3('0x12')];this['countagentrejectretry']=_0xfe0b09['countagentrejectretry'];this[_0xa2f3('0x13')]=_0xfe0b09[_0xa2f3('0x13')];this[_0xa2f3('0x14')]=_0xfe0b09[_0xa2f3('0x14')];this[_0xa2f3('0x15')]=_0xfe0b09[_0xa2f3('0x15')];this[_0xa2f3('0x16')]=_0xfe0b09[_0xa2f3('0x16')];this['CampaignId']=_0xfe0b09[_0xa2f3('0x17')];this[_0xa2f3('0x18')]=_0xfe0b09['id'];this['ContactFirstName']=_0xfe0b09['Contact'][_0xa2f3('0x19')]||'';this['starttime']=moment()[_0xa2f3('0x1a')](_0xa2f3('0x1b'));this['callback']=_0xfe0b09[_0xa2f3('0x1c')];this[_0xa2f3('0x1d')]=_0xfe0b09[_0xa2f3('0x1d')];this[_0xa2f3('0x1e')]=_0xfe0b09[_0xa2f3('0x1e')];this[_0xa2f3('0x1f')]=_0xfe0b09[_0xa2f3('0x1f')];this[_0xa2f3('0x20')]='';this['originatecalleridname']='';}Action[_0xa2f3('0x21')][_0xa2f3('0x22')]=function(){return util[_0xa2f3('0x1a')](_0xa2f3('0x23'),this[_0xa2f3('0x3')],this[_0xa2f3('0x24')][_0xa2f3('0x25')]>0x0?this['number']['substring'](this[_0xa2f3('0x24')][_0xa2f3('0x25')]):this[_0xa2f3('0x7')]);};Action[_0xa2f3('0x21')]['getQueue']=function(){return this[_0xa2f3('0x26')];};module[_0xa2f3('0x27')]=Action; \ No newline at end of file +var _0x2572=['ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','format','YYYY-MM-DD\x20HH:mm:ss','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','dialCutDigit','substring','queue','exports','util','lodash','moment','isNil','string','voiceQueue','uniqueid','name','Contact','phone','firstName','number','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry','countabandonedretry','countagentrejectretry'];(function(_0x344752,_0x15a989){var _0x399496=function(_0x3784ba){while(--_0x3784ba){_0x344752['push'](_0x344752['shift']());}};_0x399496(++_0x15a989);}(_0x2572,0x110));var _0x2257=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0x2572[_0x134c2e];return _0x2825db;};'use strict';var util=require(_0x2257('0x0'));var _=require(_0x2257('0x1'));var moment=require(_0x2257('0x2'));function checkNameSurname(_0x2143a8,_0x2682b5,_0x9a1f42){var _0x1b6556='';if(!_[_0x2257('0x3')](_0x2682b5)&&_0x2257('0x4')===typeof _0x2682b5){_0x1b6556+=_0x2682b5;}if(!_['isNil'](_0x9a1f42)&&_0x2257('0x4')===typeof _0x9a1f42){_0x1b6556+='\x20'+_0x9a1f42;}if(_0x1b6556!==''){return _0x1b6556;}return _0x2143a8;}function Action(_0x3fcebd,_0x43ffe5,_0xa5bd9){this[_0x2257('0x5')]=_0x3fcebd;this[_0x2257('0x6')]=_0xa5bd9||undefined;this[_0x2257('0x7')]=checkNameSurname(_0x43ffe5[_0x2257('0x8')][_0x2257('0x9')],_0x43ffe5['Contact'][_0x2257('0xa')],_0x43ffe5[_0x2257('0x8')]['lastName']);this[_0x2257('0xb')]=_0x43ffe5[_0x2257('0x8')][_0x2257('0x9')];this['queue']=_0x3fcebd[_0x2257('0x7')];this[_0x2257('0xc')]=_0x43ffe5[_0x2257('0xc')]||![];this[_0x2257('0xd')]=_0x3fcebd['type'];this[_0x2257('0xe')]=_0x3fcebd['dialQueueTimeout']||0x3;this['scheduledat']=_0x43ffe5[_0x2257('0xf')];this[_0x2257('0x10')]=_0x43ffe5[_0x2257('0x10')];this[_0x2257('0x11')]=_0x43ffe5[_0x2257('0x11')];this[_0x2257('0x12')]=_0x43ffe5[_0x2257('0x12')];this['countnosuchnumberretry']=_0x43ffe5['countnosuchnumberretry'];this[_0x2257('0x13')]=_0x43ffe5[_0x2257('0x13')];this[_0x2257('0x14')]=_0x43ffe5[_0x2257('0x14')];this['countmachineretry']=_0x43ffe5['countmachineretry'];this[_0x2257('0x15')]=_0x43ffe5['countagentrejectretry'];this['ContactId']=_0x43ffe5['ContactId'];this[_0x2257('0x16')]=_0x43ffe5[_0x2257('0x16')];this[_0x2257('0x17')]=_0x43ffe5[_0x2257('0x17')];this[_0x2257('0x18')]=_0x43ffe5[_0x2257('0x18')];this[_0x2257('0x19')]=_0x43ffe5[_0x2257('0x19')];this[_0x2257('0x1a')]=_0x43ffe5['id'];this[_0x2257('0x1b')]=_0x43ffe5[_0x2257('0x8')][_0x2257('0xa')]||'';this['starttime']=moment()[_0x2257('0x1c')](_0x2257('0x1d'));this['callback']=_0x43ffe5['callback'];this[_0x2257('0x1e')]=_0x43ffe5['callbackuniqueid'];this[_0x2257('0x1f')]=_0x43ffe5[_0x2257('0x1f')];this[_0x2257('0x20')]=_0x43ffe5[_0x2257('0x20')];this[_0x2257('0x21')]='';this[_0x2257('0x22')]='';}Action[_0x2257('0x23')][_0x2257('0x24')]=function(){return util[_0x2257('0x1c')](_0x2257('0x25'),this['name'],this[_0x2257('0x5')][_0x2257('0x26')]>0x0?this['number'][_0x2257('0x27')](this[_0x2257('0x5')]['dialCutDigit']):this[_0x2257('0xb')]);};Action[_0x2257('0x23')]['getQueue']=function(){return this[_0x2257('0x28')];};module[_0x2257('0x29')]=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/agentComplete.js b/server/services/ami/dialer/agentComplete.js index ec45b97..7029f81 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 _0xe085=['lodash','moment','milliseconds','diff','state','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','answertime','endtime','format','holdtime','talktime','membername','reason','callback','callbackuniqueid','callbackat','ContactId','VoiceQueueId','originatecalleridnum','originatecalleridname','exports','util'];(function(_0x325a28,_0x4fc547){var _0x2fc21e=function(_0x54628b){while(--_0x54628b){_0x325a28['push'](_0x325a28['shift']());}};_0x2fc21e(++_0x4fc547);}(_0xe085,0x1d8));var _0x5e08=function(_0x8cd7e0,_0xcbe78c){_0x8cd7e0=_0x8cd7e0-0x0;var _0xa7acc6=_0xe085[_0x8cd7e0];return _0xa7acc6;};'use strict';var util=require(_0x5e08('0x0'));var _=require(_0x5e08('0x1'));var moment=require(_0x5e08('0x2'));function getSeconds(_0x32d47d,_0x5b2078){var _0x4d837c=moment(_0x32d47d)[_0x5e08('0x3')](0x0);var _0xa9bb5d=moment(_0x5b2078)[_0x5e08('0x3')](0x0);return _0x4d837c[_0x5e08('0x4')](_0xa9bb5d,'seconds');}function AgentComplete(_0xb33098,_0x376092){this[_0x5e08('0x5')]=0x4;this['statedesc']=_0x5e08('0x6');this[_0x5e08('0x7')]=_0xb33098[_0x5e08('0x7')];this[_0x5e08('0x8')]=_0xb33098[_0x5e08('0x8')];this[_0x5e08('0x9')]=_0xb33098[_0x5e08('0x8')]===_0x5e08('0xa')?_0x5e08('0xb'):_0xb33098[_0x5e08('0x8')];this['countbusyretry']=_0xb33098[_0x5e08('0xc')];this[_0x5e08('0xd')]=_0xb33098[_0x5e08('0xd')];this[_0x5e08('0xe')]=_0xb33098[_0x5e08('0xe')];this[_0x5e08('0xf')]=_0xb33098[_0x5e08('0xc')]+_0xb33098['countcongestionretry']+_0xb33098[_0x5e08('0xe')]+_0xb33098[_0x5e08('0x10')]+_0xb33098[_0x5e08('0x11')]+_0xb33098['countabandonedretry']+_0xb33098[_0x5e08('0x12')]+_0xb33098[_0x5e08('0x13')];this[_0x5e08('0x10')]=_0xb33098['countnosuchnumberretry'];this[_0x5e08('0x11')]=_0xb33098[_0x5e08('0x11')];this[_0x5e08('0x14')]=_0xb33098[_0x5e08('0x14')];this[_0x5e08('0x12')]=_0xb33098['countmachineretry'];this[_0x5e08('0x13')]=_0xb33098[_0x5e08('0x13')];this[_0x5e08('0x15')]=_0x376092[_0x5e08('0x15')];this[_0x5e08('0x16')]=_0xb33098[_0x5e08('0x17')];this[_0x5e08('0x18')]=_0xb33098[_0x5e08('0x19')];this['starttime']=_0xb33098[_0x5e08('0x1a')];this[_0x5e08('0x1b')]=_0xb33098[_0x5e08('0x1b')];this[_0x5e08('0x1c')]=_0xb33098[_0x5e08('0x1c')];this[_0x5e08('0x1d')]=moment()[_0x5e08('0x1e')]('YYYY-MM-DD\x20HH:mm:ss');this['ringtime']=getSeconds(_0xb33098[_0x5e08('0x1b')],_0xb33098[_0x5e08('0x1a')]);this[_0x5e08('0x1f')]=getSeconds(_0xb33098[_0x5e08('0x1c')],_0xb33098[_0x5e08('0x1b')]);this[_0x5e08('0x20')]=getSeconds(this['endtime'],_0xb33098[_0x5e08('0x1c')]);this[_0x5e08('0xb')]=_0x376092[_0x5e08('0xb')];this[_0x5e08('0x21')]=_0x376092['membername'];this[_0x5e08('0x22')]=_0x376092[_0x5e08('0x22')];this[_0x5e08('0x23')]=_0xb33098[_0x5e08('0x23')];this[_0x5e08('0x24')]=_0xb33098['callbackuniqueid'];this['callbackat']=_0xb33098[_0x5e08('0x25')];this['recallme']=_0xb33098['recallme'];this[_0x5e08('0x26')]=_0xb33098[_0x5e08('0x26')];this['ListId']=_0xb33098['ListId'];this['UserId']=_0xb33098['UserId'];this[_0x5e08('0x27')]=_0xb33098['VoiceQueueId'];this['CampaignId']=_0xb33098['CampaignId'];this[_0x5e08('0x28')]=_0xb33098['originatecalleridnum']||'';this['originatecalleridname']=_0xb33098[_0x5e08('0x29')]||'';}module[_0x5e08('0x2a')]=AgentComplete; \ No newline at end of file +var _0xe782=['moment','milliseconds','diff','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry','countabandonedretry','countagentrejectretry','countnosuchnumberretry','countmachineretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','answertime','endtime','format','ringtime','holdtime','reason','callback','callbackuniqueid','callbackat','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','util','lodash'];(function(_0x3b30bd,_0x4438c5){var _0xcfa991=function(_0x1f0bd0){while(--_0x1f0bd0){_0x3b30bd['push'](_0x3b30bd['shift']());}};_0xcfa991(++_0x4438c5);}(_0xe782,0xae));var _0x2e78=function(_0x496e41,_0x36d744){_0x496e41=_0x496e41-0x0;var _0x411e7c=_0xe782[_0x496e41];return _0x411e7c;};'use strict';var util=require(_0x2e78('0x0'));var _=require(_0x2e78('0x1'));var moment=require(_0x2e78('0x2'));function getSeconds(_0x894e97,_0x80bca4){var _0x18bafc=moment(_0x894e97)[_0x2e78('0x3')](0x0);var _0x48e8b6=moment(_0x80bca4)['milliseconds'](0x0);return _0x18bafc[_0x2e78('0x4')](_0x48e8b6,'seconds');}function AgentComplete(_0x2ce825,_0x51cde4){this[_0x2e78('0x5')]=0x4;this[_0x2e78('0x6')]=_0x2e78('0x7');this[_0x2e78('0x8')]=_0x2ce825[_0x2e78('0x8')];this[_0x2e78('0x9')]=_0x2ce825[_0x2e78('0x9')];this[_0x2e78('0xa')]=_0x2ce825[_0x2e78('0x9')]===_0x2e78('0xb')?_0x2e78('0xc'):_0x2ce825[_0x2e78('0x9')];this['countbusyretry']=_0x2ce825[_0x2e78('0xd')];this[_0x2e78('0xe')]=_0x2ce825[_0x2e78('0xe')];this['countnoanswerretry']=_0x2ce825[_0x2e78('0xf')];this['countglobal']=_0x2ce825[_0x2e78('0xd')]+_0x2ce825['countcongestionretry']+_0x2ce825[_0x2e78('0xf')]+_0x2ce825['countnosuchnumberretry']+_0x2ce825[_0x2e78('0x10')]+_0x2ce825[_0x2e78('0x11')]+_0x2ce825['countmachineretry']+_0x2ce825[_0x2e78('0x12')];this[_0x2e78('0x13')]=_0x2ce825[_0x2e78('0x13')];this[_0x2e78('0x10')]=_0x2ce825['countdropretry'];this[_0x2e78('0x11')]=_0x2ce825[_0x2e78('0x11')];this[_0x2e78('0x14')]=_0x2ce825['countmachineretry'];this['countagentrejectretry']=_0x2ce825['countagentrejectretry'];this[_0x2e78('0x15')]=_0x51cde4[_0x2e78('0x15')];this[_0x2e78('0x16')]=_0x2ce825[_0x2e78('0x17')];this[_0x2e78('0x18')]=_0x2ce825[_0x2e78('0x19')];this[_0x2e78('0x1a')]=_0x2ce825[_0x2e78('0x1a')];this['responsetime']=_0x2ce825[_0x2e78('0x1b')];this[_0x2e78('0x1c')]=_0x2ce825[_0x2e78('0x1c')];this[_0x2e78('0x1d')]=moment()[_0x2e78('0x1e')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x2e78('0x1f')]=getSeconds(_0x2ce825[_0x2e78('0x1b')],_0x2ce825[_0x2e78('0x1a')]);this[_0x2e78('0x20')]=getSeconds(_0x2ce825[_0x2e78('0x1c')],_0x2ce825[_0x2e78('0x1b')]);this['talktime']=getSeconds(this[_0x2e78('0x1d')],_0x2ce825[_0x2e78('0x1c')]);this[_0x2e78('0xc')]=_0x51cde4[_0x2e78('0xc')];this['membername']=_0x51cde4['membername'];this['reason']=_0x51cde4[_0x2e78('0x21')];this[_0x2e78('0x22')]=_0x2ce825[_0x2e78('0x22')];this[_0x2e78('0x23')]=_0x2ce825['callbackuniqueid'];this[_0x2e78('0x24')]=_0x2ce825[_0x2e78('0x24')];this['recallme']=_0x2ce825['recallme'];this[_0x2e78('0x25')]=_0x2ce825[_0x2e78('0x25')];this[_0x2e78('0x26')]=_0x2ce825[_0x2e78('0x26')];this[_0x2e78('0x27')]=_0x2ce825['UserId'];this[_0x2e78('0x28')]=_0x2ce825['VoiceQueueId'];this[_0x2e78('0x29')]=_0x2ce825[_0x2e78('0x29')];this[_0x2e78('0x2a')]=_0x2ce825[_0x2e78('0x2a')]||'';this[_0x2e78('0x2b')]=_0x2ce825[_0x2e78('0x2b')]||'';}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 e29ce1b..0c6dc3a 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 _0xfb2e=['talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','lodash','moment','diff','seconds','uniqueid','scheduledat','type','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime'];(function(_0x20a005,_0x3267c4){var _0x318723=function(_0x4dd1e8){while(--_0x4dd1e8){_0x20a005['push'](_0x20a005['shift']());}};_0x318723(++_0x3267c4);}(_0xfb2e,0x15a));var _0xefb2=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0xfb2e[_0x4709c0];return _0x13348b;};'use strict';var util=require('util');var _=require(_0xefb2('0x0'));var moment=require(_0xefb2('0x1'));function getSeconds(_0x331ae2,_0x430ca4){var _0x1abd95=moment(_0x331ae2)['milliseconds'](0x0);var _0x186a49=moment(_0x430ca4)['milliseconds'](0x0);return _0x1abd95[_0xefb2('0x2')](_0x186a49,_0xefb2('0x3'));}function Final(_0x414a21){this[_0xefb2('0x4')]=_0x414a21[_0xefb2('0x4')];this[_0xefb2('0x5')]=_0x414a21['scheduledat'];this['type']=_0x414a21[_0xefb2('0x6')];this['campaigntype']=_0x414a21[_0xefb2('0x6')]==='outbound'?_0xefb2('0x7'):_0x414a21['type'];this[_0xefb2('0x8')]=_0x414a21['countbusyretry'];this[_0xefb2('0x9')]=_0x414a21[_0xefb2('0x9')];this[_0xefb2('0xa')]=_0x414a21[_0xefb2('0xa')];this[_0xefb2('0xb')]=_0x414a21[_0xefb2('0x8')]+_0x414a21[_0xefb2('0x9')]+_0x414a21[_0xefb2('0xa')]+_0x414a21[_0xefb2('0xc')]+_0x414a21[_0xefb2('0xd')]+_0x414a21[_0xefb2('0xe')]+_0x414a21['countmachineretry']+_0x414a21['countagentrejectretry'];this[_0xefb2('0xc')]=_0x414a21['countnosuchnumberretry'];this[_0xefb2('0xd')]=_0x414a21[_0xefb2('0xd')];this[_0xefb2('0xe')]=_0x414a21[_0xefb2('0xe')];this[_0xefb2('0xf')]=_0x414a21[_0xefb2('0xf')];this[_0xefb2('0x10')]=_0x414a21[_0xefb2('0x10')];this[_0xefb2('0x7')]=_0x414a21['queue'];this[_0xefb2('0x11')]=_0x414a21['calleridname'];this['calleridnum']=_0x414a21[_0xefb2('0x12')];this[_0xefb2('0x13')]=_0x414a21[_0xefb2('0x13')];this[_0xefb2('0x14')]=_0x414a21[_0xefb2('0x14')];this[_0xefb2('0x15')]=_0x414a21['responsetime'];this[_0xefb2('0x16')]=_0x414a21['ringtime']||0x0;this[_0xefb2('0x17')]=_0x414a21[_0xefb2('0x17')]||0x0;this[_0xefb2('0x18')]=_0x414a21[_0xefb2('0x18')]||0x0;this[_0xefb2('0x19')]=_0x414a21['callback'];this['callbackuniqueid']=_0x414a21[_0xefb2('0x1a')];this['callbackat']=_0x414a21[_0xefb2('0x1b')];this[_0xefb2('0x1c')]=_0x414a21[_0xefb2('0x1c')];this['ContactId']=_0x414a21[_0xefb2('0x1d')];this['ListId']=_0x414a21[_0xefb2('0x1e')];this[_0xefb2('0x1f')]=_0x414a21['UserId'];this[_0xefb2('0x20')]=_0x414a21[_0xefb2('0x20')];this[_0xefb2('0x21')]=_0x414a21[_0xefb2('0x21')];this[_0xefb2('0x22')]=_0x414a21[_0xefb2('0x22')]||'';this[_0xefb2('0x23')]=_0x414a21[_0xefb2('0x23')]||'';}module[_0xefb2('0x24')]=Final; \ No newline at end of file +var _0xac21=['UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xac21,0x1be));var _0x1ac2=function(_0x214162,_0x23435b){_0x214162=_0x214162-0x0;var _0x99ef7e=_0xac21[_0x214162];return _0x99ef7e;};'use strict';var util=require(_0x1ac2('0x0'));var _=require(_0x1ac2('0x1'));var moment=require(_0x1ac2('0x2'));function getSeconds(_0x1ebcb7,_0x2495f5){var _0x131a3f=moment(_0x1ebcb7)['milliseconds'](0x0);var _0x4552eb=moment(_0x2495f5)[_0x1ac2('0x3')](0x0);return _0x131a3f[_0x1ac2('0x4')](_0x4552eb,_0x1ac2('0x5'));}function Final(_0x2836b3){this[_0x1ac2('0x6')]=_0x2836b3[_0x1ac2('0x6')];this['scheduledat']=_0x2836b3[_0x1ac2('0x7')];this[_0x1ac2('0x8')]=_0x2836b3['type'];this[_0x1ac2('0x9')]=_0x2836b3[_0x1ac2('0x8')]===_0x1ac2('0xa')?_0x1ac2('0xb'):_0x2836b3[_0x1ac2('0x8')];this[_0x1ac2('0xc')]=_0x2836b3[_0x1ac2('0xc')];this['countcongestionretry']=_0x2836b3['countcongestionretry'];this[_0x1ac2('0xd')]=_0x2836b3[_0x1ac2('0xd')];this[_0x1ac2('0xe')]=_0x2836b3['countbusyretry']+_0x2836b3['countcongestionretry']+_0x2836b3[_0x1ac2('0xd')]+_0x2836b3[_0x1ac2('0xf')]+_0x2836b3[_0x1ac2('0x10')]+_0x2836b3[_0x1ac2('0x11')]+_0x2836b3[_0x1ac2('0x12')]+_0x2836b3[_0x1ac2('0x13')];this[_0x1ac2('0xf')]=_0x2836b3[_0x1ac2('0xf')];this[_0x1ac2('0x10')]=_0x2836b3[_0x1ac2('0x10')];this[_0x1ac2('0x11')]=_0x2836b3['countabandonedretry'];this[_0x1ac2('0x12')]=_0x2836b3['countmachineretry'];this[_0x1ac2('0x13')]=_0x2836b3[_0x1ac2('0x13')];this[_0x1ac2('0xb')]=_0x2836b3[_0x1ac2('0xb')];this[_0x1ac2('0x14')]=_0x2836b3[_0x1ac2('0x14')];this[_0x1ac2('0x15')]=_0x2836b3[_0x1ac2('0x15')];this[_0x1ac2('0x16')]=_0x2836b3[_0x1ac2('0x16')];this[_0x1ac2('0x17')]=_0x2836b3['responsetime'];this[_0x1ac2('0x18')]=_0x2836b3[_0x1ac2('0x17')];this['ringtime']=_0x2836b3[_0x1ac2('0x19')]||0x0;this['holdtime']=_0x2836b3[_0x1ac2('0x1a')]||0x0;this[_0x1ac2('0x1b')]=_0x2836b3[_0x1ac2('0x1b')]||0x0;this[_0x1ac2('0x1c')]=_0x2836b3[_0x1ac2('0x1c')];this[_0x1ac2('0x1d')]=_0x2836b3[_0x1ac2('0x1d')];this[_0x1ac2('0x1e')]=_0x2836b3[_0x1ac2('0x1e')];this['recallme']=_0x2836b3[_0x1ac2('0x1f')];this[_0x1ac2('0x20')]=_0x2836b3['ContactId'];this['ListId']=_0x2836b3[_0x1ac2('0x21')];this['UserId']=_0x2836b3[_0x1ac2('0x22')];this[_0x1ac2('0x23')]=_0x2836b3[_0x1ac2('0x23')];this['CampaignId']=_0x2836b3[_0x1ac2('0x24')];this[_0x1ac2('0x25')]=_0x2836b3['originatecalleridnum']||'';this[_0x1ac2('0x26')]=_0x2836b3['originatecalleridname']||'';}module[_0x1ac2('0x27')]=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/hangup.js b/server/services/ami/dialer/hangup.js index c2d68ff..1fcf7c2 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 _0xc9da=['responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','holdtime','talktime','membername','IVR','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','util','milliseconds','diff','state','statedesc','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','uniqueid','calleridname','name','calleridnum','number','starttime'];(function(_0x511739,_0x21ae0c){var _0x3fbbc4=function(_0xd0ee01){while(--_0xd0ee01){_0x511739['push'](_0x511739['shift']());}};_0x3fbbc4(++_0x21ae0c);}(_0xc9da,0x147));var _0xac9d=function(_0x4a747d,_0x3b747f){_0x4a747d=_0x4a747d-0x0;var _0x3a5b5c=_0xc9da[_0x4a747d];return _0x3a5b5c;};'use strict';var util=require(_0xac9d('0x0'));var _=require('lodash');var moment=require('moment');function getSeconds(_0x1b40cf,_0x3a5b34){var _0x2ed5de=moment(_0x1b40cf)[_0xac9d('0x1')](0x0);var _0x1e064e=moment(_0x3a5b34)[_0xac9d('0x1')](0x0);return _0x2ed5de[_0xac9d('0x2')](_0x1e064e,'seconds');}function Hangup(_0x413de6,_0x2c4f81){this[_0xac9d('0x3')]=0x4;this[_0xac9d('0x4')]='Answer';this[_0xac9d('0x5')]=_0x413de6[_0xac9d('0x5')];this[_0xac9d('0x6')]=_0x413de6[_0xac9d('0x6')];this[_0xac9d('0x7')]=_0x413de6[_0xac9d('0x6')]===_0xac9d('0x8')?_0xac9d('0x9'):_0x413de6[_0xac9d('0x6')];this[_0xac9d('0xa')]=_0x413de6[_0xac9d('0xa')];this[_0xac9d('0xb')]=_0x413de6[_0xac9d('0xb')];this[_0xac9d('0xc')]=_0x413de6['countnoanswerretry'];this[_0xac9d('0xd')]=_0x413de6[_0xac9d('0xa')]+_0x413de6[_0xac9d('0xb')]+_0x413de6[_0xac9d('0xc')]+_0x413de6[_0xac9d('0xe')]+_0x413de6[_0xac9d('0xf')]+_0x413de6[_0xac9d('0x10')]+_0x413de6['countmachineretry']+_0x413de6[_0xac9d('0x11')];this['countnosuchnumberretry']=_0x413de6[_0xac9d('0xe')];this['countdropretry']=_0x413de6[_0xac9d('0xf')];this[_0xac9d('0x10')]=_0x413de6[_0xac9d('0x10')];this['countmachineretry']=_0x413de6[_0xac9d('0x12')];this[_0xac9d('0x11')]=_0x413de6[_0xac9d('0x11')];this[_0xac9d('0x13')]=_0x2c4f81[_0xac9d('0x13')];this[_0xac9d('0x14')]=_0x413de6[_0xac9d('0x15')];this[_0xac9d('0x16')]=_0x413de6[_0xac9d('0x17')];this[_0xac9d('0x18')]=_0x413de6[_0xac9d('0x18')];this[_0xac9d('0x19')]=_0x413de6[_0xac9d('0x19')];this[_0xac9d('0x1a')]=moment()[_0xac9d('0x1b')](_0xac9d('0x1c'));this['ringtime']=getSeconds(_0x413de6['responsetime'],_0x413de6['starttime']);this[_0xac9d('0x1d')]=0x0;this[_0xac9d('0x1e')]=getSeconds(this['endtime'],_0x413de6['responsetime']);this[_0xac9d('0x9')]=_0x413de6[_0xac9d('0x9')];this[_0xac9d('0x1f')]=_0xac9d('0x20');this[_0xac9d('0x21')]=_0x2c4f81['cause-txt'];this[_0xac9d('0x22')]=_0x413de6[_0xac9d('0x22')];this[_0xac9d('0x23')]=_0x413de6[_0xac9d('0x23')];this['callbackat']=_0x413de6[_0xac9d('0x24')];this[_0xac9d('0x25')]=_0x413de6[_0xac9d('0x25')];this[_0xac9d('0x26')]=_0x413de6['ContactId'];this[_0xac9d('0x27')]=_0x413de6['ListId'];this[_0xac9d('0x28')]=_0x413de6[_0xac9d('0x28')];this[_0xac9d('0x29')]=_0x413de6[_0xac9d('0x29')];this[_0xac9d('0x2a')]=_0x413de6[_0xac9d('0x2a')];}module[_0xac9d('0x2b')]=Hangup; \ No newline at end of file +var _0x2f04=['ringtime','responsetime','holdtime','talktime','IVR','reason','cause-txt','callback','callbackuniqueid','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','lodash','moment','milliseconds','diff','seconds','state','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','uniqueid','calleridname','name','calleridnum','number','starttime','endtime','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0x2f04,0x177));var _0x42f0=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x2f04[_0x5d6456];return _0x4d66c1;};'use strict';var util=require('util');var _=require(_0x42f0('0x0'));var moment=require(_0x42f0('0x1'));function getSeconds(_0x117286,_0x54497a){var _0x300dc7=moment(_0x117286)['milliseconds'](0x0);var _0x514267=moment(_0x54497a)[_0x42f0('0x2')](0x0);return _0x300dc7[_0x42f0('0x3')](_0x514267,_0x42f0('0x4'));}function Hangup(_0x38225d,_0x5e60e9){this[_0x42f0('0x5')]=0x4;this['statedesc']=_0x42f0('0x6');this[_0x42f0('0x7')]=_0x38225d[_0x42f0('0x7')];this[_0x42f0('0x8')]=_0x38225d[_0x42f0('0x8')];this[_0x42f0('0x9')]=_0x38225d['type']===_0x42f0('0xa')?_0x42f0('0xb'):_0x38225d['type'];this['countbusyretry']=_0x38225d[_0x42f0('0xc')];this['countcongestionretry']=_0x38225d[_0x42f0('0xd')];this[_0x42f0('0xe')]=_0x38225d[_0x42f0('0xe')];this[_0x42f0('0xf')]=_0x38225d[_0x42f0('0xc')]+_0x38225d[_0x42f0('0xd')]+_0x38225d[_0x42f0('0xe')]+_0x38225d[_0x42f0('0x10')]+_0x38225d[_0x42f0('0x11')]+_0x38225d['countabandonedretry']+_0x38225d[_0x42f0('0x12')]+_0x38225d[_0x42f0('0x13')];this[_0x42f0('0x10')]=_0x38225d['countnosuchnumberretry'];this[_0x42f0('0x11')]=_0x38225d[_0x42f0('0x11')];this[_0x42f0('0x14')]=_0x38225d[_0x42f0('0x14')];this[_0x42f0('0x12')]=_0x38225d[_0x42f0('0x12')];this[_0x42f0('0x13')]=_0x38225d['countagentrejectretry'];this[_0x42f0('0x15')]=_0x5e60e9[_0x42f0('0x15')];this[_0x42f0('0x16')]=_0x38225d[_0x42f0('0x17')];this[_0x42f0('0x18')]=_0x38225d[_0x42f0('0x19')];this[_0x42f0('0x1a')]=_0x38225d[_0x42f0('0x1a')];this['responsetime']=_0x38225d['responsetime'];this[_0x42f0('0x1b')]=moment()[_0x42f0('0x1c')](_0x42f0('0x1d'));this[_0x42f0('0x1e')]=getSeconds(_0x38225d[_0x42f0('0x1f')],_0x38225d[_0x42f0('0x1a')]);this[_0x42f0('0x20')]=0x0;this[_0x42f0('0x21')]=getSeconds(this['endtime'],_0x38225d[_0x42f0('0x1f')]);this[_0x42f0('0xb')]=_0x38225d[_0x42f0('0xb')];this['membername']=_0x42f0('0x22');this[_0x42f0('0x23')]=_0x5e60e9[_0x42f0('0x24')];this[_0x42f0('0x25')]=_0x38225d[_0x42f0('0x25')];this[_0x42f0('0x26')]=_0x38225d[_0x42f0('0x26')];this['callbackat']=_0x38225d['callbackat'];this[_0x42f0('0x27')]=_0x38225d['recallme'];this[_0x42f0('0x28')]=_0x38225d[_0x42f0('0x28')];this['ListId']=_0x38225d[_0x42f0('0x29')];this[_0x42f0('0x2a')]=_0x38225d[_0x42f0('0x2a')];this[_0x42f0('0x2b')]=_0x38225d['VoiceQueueId'];this['CampaignId']=_0x38225d[_0x42f0('0x2c')];}module['exports']=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/history.js b/server/services/ami/dialer/history.js index bce6de5..cc96c6c 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 _0x8a62=['outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','name','calleridnum','number','starttime','responsetime','endtime','ringtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','exports','util','lodash','milliseconds','seconds','uniqueid','scheduledat','type','campaigntype'];(function(_0xcac539,_0x21f8e5){var _0x23f53b=function(_0x41ca44){while(--_0x41ca44){_0xcac539['push'](_0xcac539['shift']());}};_0x23f53b(++_0x21f8e5);}(_0x8a62,0x130));var _0x28a6=function(_0x53727a,_0x1e44ee){_0x53727a=_0x53727a-0x0;var _0x4a9764=_0x8a62[_0x53727a];return _0x4a9764;};'use strict';var util=require(_0x28a6('0x0'));var _=require(_0x28a6('0x1'));var moment=require('moment');function getSeconds(_0x3bfdc7,_0x33ce9e){var _0x34b4d3=moment(_0x3bfdc7)[_0x28a6('0x2')](0x0);var _0x30393b=moment(_0x33ce9e)[_0x28a6('0x2')](0x0);return _0x34b4d3['diff'](_0x30393b,_0x28a6('0x3'));}function History(_0x1652fc){this[_0x28a6('0x4')]=_0x1652fc[_0x28a6('0x4')];this[_0x28a6('0x5')]=_0x1652fc[_0x28a6('0x5')]||undefined;this[_0x28a6('0x6')]=_0x1652fc[_0x28a6('0x6')];this[_0x28a6('0x7')]=_0x1652fc[_0x28a6('0x6')]===_0x28a6('0x8')?_0x28a6('0x9'):_0x1652fc[_0x28a6('0x6')];this[_0x28a6('0xa')]=_0x1652fc['countbusyretry'];this[_0x28a6('0xb')]=_0x1652fc['countcongestionretry'];this['countnoanswerretry']=_0x1652fc[_0x28a6('0xc')];this[_0x28a6('0xd')]=_0x1652fc[_0x28a6('0xa')]+_0x1652fc[_0x28a6('0xb')]+_0x1652fc[_0x28a6('0xc')]+_0x1652fc[_0x28a6('0xe')]+_0x1652fc[_0x28a6('0xf')]+_0x1652fc[_0x28a6('0x10')]+_0x1652fc[_0x28a6('0x11')]+_0x1652fc[_0x28a6('0x12')];this[_0x28a6('0xe')]=_0x1652fc[_0x28a6('0xe')];this[_0x28a6('0xf')]=_0x1652fc['countdropretry'];this[_0x28a6('0x10')]=_0x1652fc['countabandonedretry'];this[_0x28a6('0x11')]=_0x1652fc[_0x28a6('0x11')];this['countagentrejectretry']=_0x1652fc['countagentrejectretry'];this[_0x28a6('0x9')]=_0x1652fc[_0x28a6('0x9')];this[_0x28a6('0x13')]=_0x1652fc[_0x28a6('0x14')];this[_0x28a6('0x15')]=_0x1652fc[_0x28a6('0x16')];this[_0x28a6('0x17')]=_0x1652fc[_0x28a6('0x17')];this[_0x28a6('0x18')]=_0x1652fc[_0x28a6('0x18')];this[_0x28a6('0x19')]=_0x1652fc[_0x28a6('0x18')];this[_0x28a6('0x1a')]=getSeconds(_0x1652fc[_0x28a6('0x18')],_0x1652fc['starttime']);this['holdtime']=0x0;this[_0x28a6('0x1b')]=0x0;this[_0x28a6('0x1c')]=_0x1652fc['callback'];this[_0x28a6('0x1d')]=_0x1652fc['callbackuniqueid'];this[_0x28a6('0x1e')]=_0x1652fc[_0x28a6('0x1e')];this['recallme']=_0x1652fc[_0x28a6('0x1f')];this[_0x28a6('0x20')]=_0x1652fc[_0x28a6('0x20')];this[_0x28a6('0x21')]=_0x1652fc['ListId'];this[_0x28a6('0x22')]=_0x1652fc[_0x28a6('0x22')];this[_0x28a6('0x23')]=_0x1652fc[_0x28a6('0x23')];this[_0x28a6('0x24')]=_0x1652fc[_0x28a6('0x24')];this['originatecalleridnum']=_0x1652fc[_0x28a6('0x25')]||'';this['originatecalleridname']=_0x1652fc['originatecalleridname']||'';}module[_0x28a6('0x26')]=History; \ No newline at end of file +var _0xa15b=['recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','milliseconds','diff','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','name','responsetime','endtime','ringtime','starttime','holdtime','talktime','callbackuniqueid','callbackat'];(function(_0x3beaa7,_0x26e2d7){var _0x4e87e2=function(_0x48a569){while(--_0x48a569){_0x3beaa7['push'](_0x3beaa7['shift']());}};_0x4e87e2(++_0x26e2d7);}(_0xa15b,0x17b));var _0xba15=function(_0xa7d96f,_0x30ebb5){_0xa7d96f=_0xa7d96f-0x0;var _0x30ce34=_0xa15b[_0xa7d96f];return _0x30ce34;};'use strict';var util=require(_0xba15('0x0'));var _=require('lodash');var moment=require('moment');function getSeconds(_0xb0133e,_0x158a35){var _0x5f06bb=moment(_0xb0133e)['milliseconds'](0x0);var _0x13b9e9=moment(_0x158a35)[_0xba15('0x1')](0x0);return _0x5f06bb[_0xba15('0x2')](_0x13b9e9,'seconds');}function History(_0x2db834){this[_0xba15('0x3')]=_0x2db834[_0xba15('0x3')];this[_0xba15('0x4')]=_0x2db834['scheduledat']||undefined;this[_0xba15('0x5')]=_0x2db834[_0xba15('0x5')];this[_0xba15('0x6')]=_0x2db834[_0xba15('0x5')]===_0xba15('0x7')?_0xba15('0x8'):_0x2db834[_0xba15('0x5')];this['countbusyretry']=_0x2db834[_0xba15('0x9')];this[_0xba15('0xa')]=_0x2db834['countcongestionretry'];this[_0xba15('0xb')]=_0x2db834[_0xba15('0xb')];this[_0xba15('0xc')]=_0x2db834[_0xba15('0x9')]+_0x2db834['countcongestionretry']+_0x2db834['countnoanswerretry']+_0x2db834[_0xba15('0xd')]+_0x2db834['countdropretry']+_0x2db834['countabandonedretry']+_0x2db834['countmachineretry']+_0x2db834['countagentrejectretry'];this[_0xba15('0xd')]=_0x2db834[_0xba15('0xd')];this['countdropretry']=_0x2db834[_0xba15('0xe')];this['countabandonedretry']=_0x2db834[_0xba15('0xf')];this[_0xba15('0x10')]=_0x2db834[_0xba15('0x10')];this[_0xba15('0x11')]=_0x2db834[_0xba15('0x11')];this[_0xba15('0x8')]=_0x2db834[_0xba15('0x8')];this[_0xba15('0x12')]=_0x2db834[_0xba15('0x13')];this['calleridnum']=_0x2db834['number'];this['starttime']=_0x2db834['starttime'];this[_0xba15('0x14')]=_0x2db834['responsetime'];this[_0xba15('0x15')]=_0x2db834[_0xba15('0x14')];this[_0xba15('0x16')]=getSeconds(_0x2db834[_0xba15('0x14')],_0x2db834[_0xba15('0x17')]);this[_0xba15('0x18')]=0x0;this[_0xba15('0x19')]=0x0;this['callback']=_0x2db834['callback'];this[_0xba15('0x1a')]=_0x2db834['callbackuniqueid'];this[_0xba15('0x1b')]=_0x2db834['callbackat'];this['recallme']=_0x2db834[_0xba15('0x1c')];this[_0xba15('0x1d')]=_0x2db834[_0xba15('0x1d')];this[_0xba15('0x1e')]=_0x2db834[_0xba15('0x1e')];this[_0xba15('0x1f')]=_0x2db834[_0xba15('0x1f')];this[_0xba15('0x20')]=_0x2db834['VoiceQueueId'];this[_0xba15('0x21')]=_0x2db834[_0xba15('0x21')];this[_0xba15('0x22')]=_0x2db834[_0xba15('0x22')]||'';this['originatecalleridname']=_0x2db834[_0xba15('0x23')]||'';}module[_0xba15('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 d0bc0eb..c336826 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 _0x9c34=['tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','contactsId','optionPredictive','startPredictive','startProgressive','queueBooked','queueBookedRR','agentconnect','syncAgentConnect','queuecallerabandon','syncQueueCallerAbandon','bind','originateresponse','syncOriginateResponse','syncAgentComplete','syncHangup','syncNewExten','varset','syncQueueMember','syncQueueStatusComplete','loopCampaigns','isUndefined','\x20AGENTS\x20NOT\x20LOGGED','NOT_ACTIVE','name','Interval','Intervals','message','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','isEmpty','[ifTime][Action]','Error','stringify','milliseconds','diff','seconds','emit','type','outbound','strategy','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','abandoned','waiting','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundUnknownCallsDay','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangAbandonmentRate','Trunk','active','callerid','format','voice:queue:%s','ivr','campaign:ivr:%s','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAnsweredCalls','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgHoldtime','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCallToSecond','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangBusyFactor','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','clearing\x20variable\x20start\x20predictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','error','stack','length','hasOwnProperty','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','inspect','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','contactsRescheduled','contacts','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','state','statedesc','endtime','loopClearZombieChannels','clearZombieChannels','uniqueId','[actions]','isNil','channel','catch','No\x20such\x20channel','updateOriginated','[Dialer][checkChannel]','queue','countReScheduled','resolve','then','[countReScheduled]\x20','[checkIsBlackList]\x20','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','[unlockContact]\x20','getContactDialer','getContactDialerIvr','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[updateOriginated]\x20object\x20originated\x20is\x20negative','loggerHandler','emptyContact','notFound','saveInDb','pick','ContactId','ListId','VoiceQueueId','CampaignId','[emptyContact][createHistory]','[emptyContact]','isSuccess','Success','isTrunkReachable','SIP/%s','status','reachable','unmonitored','syncVarSet','variable','amdstatus','xcally-motion-dialer','value','HANGUP','uniqueid','outboundAnswerCallsDay','HangupInAMD','membername','AMD','dialAMDActive','MACHINE','amd','[syncMachine]','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','Machine','[syncMachineIvr]','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','cause-txt','reason','agiafterat','dialQueueProject2','YYYY-MM-DD\x20HH:mm:ss','[syncAgentComplete][createHistory]','[syncAgentComplete]','answertime','droptime','responsetime','dialQueueTimeout','dropreason','TIMEOUT','countdropretry','dialDropMaxRetry','queueCallerAbandonCreateState','add','minutes','[rescheduleContact][Drop]','Drop','starttime','calleridname','calleridnum','log','CRIS\x20evt\x2010.1','CRIS\x20queueCallerAbandon\x2010.1','CRIS\x20createHistory\x2010.1','[syncAgentComplete][createHistory][10]','predictiveIntervalDroppedCallsCallersExit','Abandoned','CALLEREXIT','countabandonedretry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','actions','actionid','locked','paused','stateinterface','merge','queueStatusComplete','run','idHopper','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','_rr','unlockRR','Agent:\x20','contactAgent-idHopper:\x20','[booked][RR][finaly]','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[unlock3][syncQueueStatusComplete]','syncCampaigns','checkIsTrunkReachable','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTime','checkIfTimeIntervals','Failure','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','\x20Intervals\x20is\x20empty\x20','timezones','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','isArray','push','Action','iftime\x20%s,%s','interval','indexOf','true','command','content','all','GLOBAL_INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','Timezone:\x20','checkDialMethod','progressive','handlePower','dialPowerLevel','Queue','method\x20not\x20recognized','launchHandleIvr','handleIvr','dialGlobalInterval','dialTimezone','[syncQueueSummary]','[syncCampaigns]','pow','replace','random','match','actionOriginate','object','originate','voiceQueue\x20is\x20undefine','Contact','phone','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialAgiAfterHangupAgent','XMD-AMDINITIALSILENCE','dialAMDGreeting','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-CAMPAIGNID','createdAt','updatedAt','%s%s','XMD-','toUpper','dialRandomLastDigitCallerIdNumber','TrunkBackup','XMD-ORIGINATECALLERIDNAME','originatecalleridname','originatecalleridnum','dialCutDigit','substring','SIP/%s/%s%s','trim','from-sip','outboundOriginateFailureCallsDay','OriginateError','[originate][error]','originate\x20action\x20Error','getQueue','callProgressDetecting','[callProgressDetecting]\x20','checkRetriveMax','countbusyretry','countnoanswerretry','countagentrejectretry','dialGlobalMaxRetry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','countcongestionretry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','countnosuchnumberretry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialDropRetryFrequency','countmachineretry','dialMachineRetryFrequency','[rescheduleContact][Machine]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','countglobal','[syncAgentComplete][createHistory][0]','reason\x200\x20no\x20such\x20number....','NoAnswer','[syncAgentComplete][createHistory][3]','createStateFinal','reason\x203\x20ringing\x20no\x20answer','Busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','Congestion','[syncAgentComplete][createHistory][8]','dialCongestionMaxRetry','reason\x208\x20congestion','stateGlobal','outboundAbandonedCallsDay','reason\x2011\x20abandoned','outboundRejectCallsDay','AgentReject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalMinThreshold','available','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','averageHandleTime','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval',')\x20are\x20less\x20than\x20threshold\x20(','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20more\x20than\x20threshold\x20(','abandonmentRate','agentBusyFactor','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','outboundQueuePauses','[CatchErlangB]','floor','one\x20call\x20every:','[handlePredictive]','checkContactBlack','UserId','recallme','[booked][checkContactBlack]','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','scheduledat','dialRecallMeTimeout','Agent','voicePause','Contact\x20updated','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','[Originate][HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','outboundBlacklistCallsDay','BLACKLIST','[Originate][historyBlacklist]','limitCalls','temp','RUNNING','[actionOriginate]\x20','Contact.phone','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','not_inuse','checkIsBlackList','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','[actionOriginatePredictive]\x20','--------\x20Drop\x20Rate\x20--------','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','[abandonmentRate]','m\x20=\x20','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','----\x20Agent\x20Busy\x20Factor\x20----','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','Ts\x20=\x20','Umin\x20=\x20','exports','util','bluebird','uuid','moment','md5','dialer','../../../config/logger','booked','predictive','predictiveCalls','syncQueueSummary','redis','defaults','localhost','socket.io-emitter','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/voiceQueueRt','./history','./agentComplete','./queueCallerAbandon','./hangup','XCALLY_IP_AGI','rrmemory','roundrobin','prototype','enqueue'];(function(_0x129307,_0x34f356){var _0x17cdb7=function(_0x344a9b){while(--_0x344a9b){_0x129307['push'](_0x129307['shift']());}};_0x17cdb7(++_0x34f356);}(_0x9c34,0x1f1));var _0x49c3=function(_0x4fa5ea,_0x4139ba){_0x4fa5ea=_0x4fa5ea-0x0;var _0x4acaa3=_0x9c34[_0x4fa5ea];return _0x4acaa3;};'use strict';var util=require(_0x49c3('0x0'));var _=require('lodash');var BPromise=require(_0x49c3('0x1'));var uuid=require(_0x49c3('0x2'));var moment=require(_0x49c3('0x3'));var rr=require('rr');var md5=require(_0x49c3('0x4'));var Redis=require('ioredis');var config=require('../../../config/environment/');var logger=require('../../../config/logger')(_0x49c3('0x5'));var loggerBooked=require(_0x49c3('0x6'))(_0x49c3('0x7'));var loggerPredictive=require('../../../config/logger')(_0x49c3('0x8'));var loggerPredictiveCalls=require(_0x49c3('0x6'))(_0x49c3('0x9'));var loggerSyncQueueSummary=require(_0x49c3('0x6'))(_0x49c3('0xa'));var ami=require('../ami');config[_0x49c3('0xb')]=_[_0x49c3('0xc')](config[_0x49c3('0xb')],{'host':_0x49c3('0xd'),'port':0x18eb});var io=require(_0x49c3('0xe'))(new Redis(config['redis']));var cmHopper=require('../rpc/cmHopper');var cmHopperFinal=require(_0x49c3('0xf'));var cmHopperHistory=require(_0x49c3('0x10'));var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require(_0x49c3('0x11'));var Action=require('./action');var History=require(_0x49c3('0x12'));var Final=require('./final');var AgentComplete=require(_0x49c3('0x13'));var QueueCallerAbandon=require(_0x49c3('0x14'));var Hangup=require(_0x49c3('0x15'));var ipAgi=process['env'][_0x49c3('0x16')]||'127.0.0.1';var strategy={'rrmemory':_0x49c3('0x17'),'roundrobin':_0x49c3('0x18')};var Sequence=function(){};Sequence[_0x49c3('0x19')][_0x49c3('0x1a')]=function(_0x168d6e){this[_0x49c3('0x1b')]=this[_0x49c3('0x1b')]?this['tail'][_0x49c3('0x1c')](_0x168d6e):_0x168d6e();};function Dialer(_0x452a44,_0x3cbcea){this[_0x49c3('0x1d')]=new Sequence();this[_0x49c3('0x1e')]=_0x3cbcea;this[_0x49c3('0x1f')]=_0x452a44[_0x49c3('0x1f')];this[_0x49c3('0x20')]=_0x452a44[_0x49c3('0x20')];this[_0x49c3('0x21')]=_0x452a44['agents'];this['trunks']=_0x452a44[_0x49c3('0x22')];this[_0x49c3('0x23')]=config[_0x49c3('0x23')]||0x2;this[_0x49c3('0x24')]={};this['actions']={};this[_0x49c3('0x25')]={};this['uniqueId']={};this[_0x49c3('0x26')]={};this[_0x49c3('0x27')]={};this[_0x49c3('0x28')]={};this['ivrOriginated']={};this[_0x49c3('0x29')]={};this[_0x49c3('0x2a')]={};ami['on'](_0x49c3('0x2b'),this[_0x49c3('0x2c')]['bind'](this));ami['on'](_0x49c3('0x2d'),this[_0x49c3('0x2e')][_0x49c3('0x2f')](this));ami['on'](_0x49c3('0x30'),this[_0x49c3('0x31')][_0x49c3('0x2f')](this));ami['on']('agentcomplete',this[_0x49c3('0x32')][_0x49c3('0x2f')](this));ami['on']('custom:queuesummary',this[_0x49c3('0xa')][_0x49c3('0x2f')](this));ami['on']('hangup',this[_0x49c3('0x33')][_0x49c3('0x2f')](this));ami['on']('newexten',this[_0x49c3('0x34')]['bind'](this));ami['on'](_0x49c3('0x35'),this['syncVarSet'][_0x49c3('0x2f')](this));ami['on']('queuemember',this[_0x49c3('0x36')]['bind'](this));ami['on']('queuestatuscomplete',this[_0x49c3('0x37')][_0x49c3('0x2f')](this));this[_0x49c3('0x38')]();this['loopClearZombieChannels']();}function isNotNull(_0x101c6f){return _0x101c6f!==null&&!_[_0x49c3('0x39')](_0x101c6f);}function checkIsLoggedIn(_0x41b5df,_0x3a5855){return function(){if(_0x3a5855<=0x0){_0x41b5df['message']='AGENTS_NOT_LOGGED';throw _0x41b5df['name']+_0x49c3('0x3a');}};}function isActive(_0x554a7a){return _0x554a7a;}function checkIsActive(_0xac1204,_0x19c4f9){return function(){if(!isActive(_0x19c4f9)){_0xac1204['message']=_0x49c3('0x3b');throw _0xac1204[_0x49c3('0x3c')]+'\x20NOT\x20Active';}};}function checkInterval(_0x2e54b0){return function(){if(!isNotNull(_0x2e54b0[_0x49c3('0x3d')])){_0x2e54b0['message']='INTERVAL_IS_NULL';throw _0x2e54b0['name']+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_0x2e54b0[_0x49c3('0x3d')][_0x49c3('0x3e')])){_0x2e54b0[_0x49c3('0x3f')]=_0x49c3('0x40');throw _0x2e54b0[_0x49c3('0x3c')]+_0x49c3('0x41');}if(!isNotNull(_[_0x49c3('0x42')](_0x2e54b0[_0x49c3('0x3d')][_0x49c3('0x3e')]))){_0x2e54b0[_0x49c3('0x3f')]=_0x49c3('0x40');throw _0x2e54b0[_0x49c3('0x3c')]+_0x49c3('0x41');}};}function msgResponse(_0x22171a,_0x3dfdb8,_0x14caf2){return{'action':_0x22171a,'response':_0x3dfdb8,'message':_0x14caf2,'stack':_0x14caf2};}function myreject(_0x5c34d2){return function(_0xf6a709){return _0x5c34d2(msgResponse(_0x49c3('0x43'),_0x49c3('0x44'),JSON[_0x49c3('0x45')](_0xf6a709)));};}function getSeconds(_0x20ca5a,_0x469cf0){var _0x1fb6c6=moment(_0x20ca5a)[_0x49c3('0x46')](0x0);var _0x5716cf=moment(_0x469cf0)['milliseconds'](0x0);return _0x1fb6c6[_0x49c3('0x47')](_0x5716cf,_0x49c3('0x48'));}function emit(_0x1c950e,_0x3641ae,_0x1ca507){io['to'](_0x1c950e)[_0x49c3('0x49')](_0x3641ae,_0x1ca507);}function emitVoiceQueueSummary(_0x4c1bd0){if(_0x4c1bd0[_0x49c3('0x4a')]===_0x49c3('0x4b')){var _0x17eea6={'id':_0x4c1bd0['id'],'name':_0x4c1bd0['name'],'strategy':_0x4c1bd0[_0x49c3('0x4c')],'answered':_0x4c1bd0['answered'],'available':_0x4c1bd0['available'],'loggedIn':_0x4c1bd0[_0x49c3('0x4d')],'pTalking':_0x4c1bd0[_0x49c3('0x4e')],'sumBillable':_0x4c1bd0[_0x49c3('0x4f')],'sumDuration':_0x4c1bd0[_0x49c3('0x50')],'sumHoldTime':_0x4c1bd0[_0x49c3('0x51')]||0x0,'talking':_0x4c1bd0[_0x49c3('0x52')],'total':_0x4c1bd0[_0x49c3('0x53')],'type':_0x4c1bd0[_0x49c3('0x4a')],'unmanaged':_0x4c1bd0['unmanaged'],'abandoned':_0x4c1bd0[_0x49c3('0x54')],'waiting':_0x4c1bd0[_0x49c3('0x55')],'loggedInDb':_0x4c1bd0['loggedInDb'],'dialActive':_0x4c1bd0[_0x49c3('0x56')],'dialMethod':_0x4c1bd0[_0x49c3('0x57')],'dialOriginateCallerIdName':_0x4c1bd0[_0x49c3('0x58')],'dialOriginateCallerIdNumber':_0x4c1bd0[_0x49c3('0x59')],'dialOriginateTimeout':_0x4c1bd0[_0x49c3('0x5a')],'dialPrefix':_0x4c1bd0[_0x49c3('0x5b')],'outboundAnswerAgiCallsDay':_0x4c1bd0[_0x49c3('0x5c')],'outboundAnswerCallsDay':_0x4c1bd0['outboundAnswerCallsDay'],'outboundBlacklistCallsDay':_0x4c1bd0['outboundBlacklistCallsDay'],'outboundBusyCallsDay':_0x4c1bd0[_0x49c3('0x5d')],'outboundCongestionCallsDay':_0x4c1bd0[_0x49c3('0x5e')],'outboundDropCallsDayACS':_0x4c1bd0[_0x49c3('0x5f')],'outboundDropCallsDayCallersExit':_0x4c1bd0[_0x49c3('0x60')],'outboundDropCallsDayTimeout':_0x4c1bd0[_0x49c3('0x61')],'outboundNoAnswerCallsDay':_0x4c1bd0[_0x49c3('0x62')],'outboundNoSuchCallsDay':_0x4c1bd0[_0x49c3('0x63')],'outboundOriginateFailureCallsDay':_0x4c1bd0['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0x4c1bd0[_0x49c3('0x64')],'outboundRejectCallsDay':_0x4c1bd0['outboundRejectCallsDay'],'outboundUnknownCallsDay':_0x4c1bd0[_0x49c3('0x65')],'predictiveIntervalAnsweredCalls':_0x4c1bd0['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0x4c1bd0['predictiveIntervalAvgHoldtime'],'predictiveIntervalAvgTalktime':_0x4c1bd0[_0x49c3('0x66')],'predictiveIntervalDroppedCallsCallersExit':_0x4c1bd0['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x4c1bd0[_0x49c3('0x67')],'predictiveIntervalErlangCalls':_0x4c1bd0[_0x49c3('0x68')],'predictiveIntervalErlangCallsDroppedCalls':_0x4c1bd0[_0x49c3('0x69')],'predictiveIntervalHitRate':_0x4c1bd0[_0x49c3('0x6a')],'predictiveIntervalMultiplicativeFactor':_0x4c1bd0['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0x4c1bd0[_0x49c3('0x6b')],'predictiveIntervalAvailable':_0x4c1bd0[_0x49c3('0x6c')],'predictiveIntervalTotalCalls':_0x4c1bd0[_0x49c3('0x6d')],'message':_0x4c1bd0[_0x49c3('0x3f')],'originated':_0x4c1bd0[_0x49c3('0x6e')],'erlangCalls':_0x4c1bd0[_0x49c3('0x6f')],'erlangCallToSecond':_0x4c1bd0['erlangCallToSecond'],'erlangAbandonmentRate':_0x4c1bd0[_0x49c3('0x70')],'erlangBusyFactor':_0x4c1bd0['erlangBusyFactor'],'startPredictive':_0x4c1bd0[_0x49c3('0x27')],'startProgressive':_0x4c1bd0['startProgressive']};if(_0x4c1bd0[_0x49c3('0x71')]){_0x17eea6[_0x49c3('0x71')]={'id':_0x4c1bd0[_0x49c3('0x71')]['id'],'name':_0x4c1bd0[_0x49c3('0x71')][_0x49c3('0x3c')],'active':_0x4c1bd0[_0x49c3('0x71')][_0x49c3('0x72')],'callerid':_0x4c1bd0['Trunk'][_0x49c3('0x73')]};}if(_0x4c1bd0[_0x49c3('0x3d')]){_0x17eea6['Interval']={'id':_0x4c1bd0[_0x49c3('0x3d')]['id'],'name':_0x4c1bd0[_0x49c3('0x3d')][_0x49c3('0x3c')]};}var _0x25b328=md5(JSON[_0x49c3('0x45')](_0x17eea6));if(_0x4c1bd0[_0x49c3('0x4')]!==_0x25b328){_0x4c1bd0[_0x49c3('0x4')]=_0x25b328;emit(util[_0x49c3('0x74')](_0x49c3('0x75'),_0x17eea6['name']),'voice_queue:save',_0x17eea6);}}}function emitCampaignSummary(_0x37dafa){if(_0x37dafa['type']===_0x49c3('0x76')){emit(util[_0x49c3('0x74')](_0x49c3('0x77'),_0x37dafa[_0x49c3('0x3c')]),'campaign:save',_0x37dafa);}}function checkGetDataPredictive(_0x3cce55){if(isNotNull(_0x3cce55)){if(!_[_0x49c3('0x42')](_0x3cce55)){loggerPredictive[_0x49c3('0x78')](_0x49c3('0x79'));loggerPredictive[_0x49c3('0x78')](_0x49c3('0x7a'),_0x3cce55[_0x49c3('0x6d')]);loggerPredictive['info'](_0x49c3('0x7b'),_0x3cce55[_0x49c3('0x7c')]);loggerPredictive[_0x49c3('0x78')](_0x49c3('0x7d'),_0x3cce55[_0x49c3('0x67')]);loggerPredictive[_0x49c3('0x78')](_0x49c3('0x7e'),_0x3cce55['predictiveIntervalDroppedCallsCallersExit']);loggerPredictive[_0x49c3('0x78')](_0x49c3('0x7f'),_0x3cce55[_0x49c3('0x80')]);loggerPredictive[_0x49c3('0x78')]('AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3cce55['predictiveIntervalAvgTalktime']);loggerPredictive['info']('---------------------------');if(_0x3cce55['predictiveIntervalTotalCalls']>0x0){if(!_[_0x49c3('0x39')](_0x3cce55['predictiveIntervalAvgTalktime'])&&_0x3cce55[_0x49c3('0x66')]>0x0){return!![];}else{loggerPredictive['info'](_0x49c3('0x81'));}if(!_[_0x49c3('0x39')](_0x3cce55['predictiveIntervalAvgHoldtime'])&&_0x3cce55[_0x49c3('0x80')]>0x0){return!![];}else{loggerPredictive[_0x49c3('0x78')]('Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive');}}else{loggerPredictive[_0x49c3('0x78')]('Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive');}}else{loggerPredictive[_0x49c3('0x78')]('History\x20information\x20are\x20empty');}}else{loggerPredictive[_0x49c3('0x78')]('History\x20information\x20are\x20empty');}return![];}function mergeDataErlangB(_0x26a1c6){return function(_0x2e60a0){loggerPredictive['info'](_0x49c3('0x82'));loggerPredictive[_0x49c3('0x78')](_0x49c3('0x83'),_0x2e60a0[_0x49c3('0x6f')]);loggerPredictive[_0x49c3('0x78')](_0x49c3('0x84'),_0x2e60a0[_0x49c3('0x85')]);loggerPredictive[_0x49c3('0x78')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x2e60a0[_0x49c3('0x70')]);loggerPredictive[_0x49c3('0x78')](_0x49c3('0x86'),_0x2e60a0[_0x49c3('0x87')]);loggerPredictive[_0x49c3('0x78')](_0x49c3('0x88'),_0x2e60a0[_0x49c3('0x70')]);loggerPredictive['info']('---------------------------');_['merge'](_0x26a1c6,_0x2e60a0);};}function getDiff(_0x3395ae){var _0x3ae845=moment()[_0x49c3('0x46')](0x0);var _0x11ad1e=moment(_0x3395ae)[_0x49c3('0x46')](0x0);return _0x3ae845[_0x49c3('0x47')](_0x11ad1e,_0x49c3('0x48'));}function ifInterval(_0x196ac2,_0x4a646a){if(_[_0x49c3('0x39')](_0x4a646a)){return![];}if(getDiff(_0x4a646a)<_0x196ac2*0x3c){return!![];}else{return![];}}function freeVariablesPredictive(_0x47720a){if(isNotNull(_0x47720a)){if(!_['isUndefined'](_0x47720a[_0x49c3('0x28')])){_0x47720a[_0x49c3('0x28')]=undefined;loggerPredictive[_0x49c3('0x78')](_0x47720a[_0x49c3('0x3c')],'clearing\x20variable\x20start\x20progressive');}if(!_['isUndefined'](_0x47720a['startPredictive'])){_0x47720a[_0x49c3('0x27')]=undefined;loggerPredictive['info'](_0x47720a[_0x49c3('0x3c')],_0x49c3('0x89'));}if(!_[_0x49c3('0x39')](_0x47720a[_0x49c3('0x8a')])){clearInterval(_0x47720a[_0x49c3('0x8a')]);_0x47720a[_0x49c3('0x8a')]=undefined;loggerPredictive[_0x49c3('0x78')](_0x47720a[_0x49c3('0x3c')],_0x49c3('0x8b'));}}}function erlangb(_0x258d25,_0x3ea744){if(_0x3ea744===0x0){return 0x0;}var _0x3850cc=0x1;for(var _0x1632b7=0x1;_0x1632b7<=_0x3ea744;_0x1632b7+=0x1){_0x3850cc=0x1+_0x3850cc*_0x1632b7/_0x258d25;}return 0x1/_0x3850cc;}function isVoiceQueueOutbound(_0x5cb01c){return _0x5cb01c===_0x49c3('0x4b');}function isNotPreview(_0x531d9a){return _0x531d9a!==_0x49c3('0x1e');}function isCampaignIvr(_0xf043a5){return _0xf043a5===_0x49c3('0x76');}function getCallerId(_0x12ae0a,_0x4dc496,_0x310546){if(!_['isUndefined'](_0x310546)&&_0x49c3('0x8c')===typeof _0x310546&&!_[_0x49c3('0x42')](_0x310546)){if(!_[_0x49c3('0x39')](_0x4dc496)&&'string'===typeof _0x4dc496&&!_[_0x49c3('0x42')](_0x4dc496)){return util['format'](_0x49c3('0x8d'),_0x4dc496,_0x310546);}return util[_0x49c3('0x74')](_0x49c3('0x8d'),_0x310546,_0x310546);}if(!_[_0x49c3('0x39')](_0x12ae0a)&&_0x49c3('0x8c')===typeof _0x12ae0a&&!_[_0x49c3('0x42')](_0x12ae0a)){return _0x12ae0a;}return _0x49c3('0x8e');}function loggerCatchQueueSummary(_0x400d1a,_0x506108){return function(_0x237161){freeVariablesPredictive(_0x506108);emitVoiceQueueSummary(_0x506108);emitCampaignSummary(_0x506108);loggerSyncQueueSummary[_0x49c3('0x8f')](_0x400d1a,util['inspect'](_0x237161,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x418485,_0x1edb31){return function(_0x1d8714){loggerPredictive['error'](_0x1edb31[_0x49c3('0x3c')],_0x418485);loggerPredictive[_0x49c3('0x8f')](_0x1d8714[_0x49c3('0x90')]);freeVariablesPredictive(_0x1edb31);};}function loggerCatch(_0xba8680){return function(_0x326689){logger[_0x49c3('0x8f')](_0xba8680,util['inspect'](_0x326689,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x2da2dd){return _0x2da2dd&&!_[_0x49c3('0x39')](_0x2da2dd)&&_0x2da2dd[_0x49c3('0x91')]>0x0;}function decremetOriginate(_0x247718){if(!_['isUndefined'](_0x247718)&&_0x247718!==null){if(_0x247718[_0x49c3('0x92')](_0x49c3('0x6e'))){if(_0x247718['originated']>0x0){_0x247718[_0x49c3('0x6e')]-=0x1;}else{logger[_0x49c3('0x8f')](_0x49c3('0x93'));}}}else{logger[_0x49c3('0x8f')](_0x49c3('0x94'));}}function checkContactLowerLimitOriginate(_0x1a804b,_0x40168d,_0x346a18){if(_0x40168d>_0x346a18){for(var _0x59ad88=0x0;_0x59ad88<_0x40168d-_0x346a18;_0x59ad88+=0x1){decremetOriginate(_0x1a804b);}}}function loggerGetContactDialer(_0x4106c1,_0x47df48,_0x401a46){return function(_0x20edb4){checkContactLowerLimitOriginate(_0x47df48,_0x401a46,0x0);logger['error'](_0x4106c1,util[_0x49c3('0x95')](_0x20edb4,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x41e50e){return function(_0x56d4f6){if(isNotNull(_0x56d4f6)&&isNotNull(_0x56d4f6[0x0])){if(_0x56d4f6[0x0]['contactsRescheduled']>0x0){_0x41e50e[_0x49c3('0x3f')]=_0x49c3('0x96');logger[_0x49c3('0x78')](_0x49c3('0x97')+_0x41e50e['name'],_0x56d4f6[0x0][_0x49c3('0x98')],_0x49c3('0x99'));}else{_0x41e50e[_0x49c3('0x3f')]=_0x49c3('0x9a');logger['info'](_0x49c3('0x9b')+_0x41e50e[_0x49c3('0x3c')]);}}};}function notSendMessagesQueue(_0x565f94){if(_0x565f94[_0x49c3('0x9c')]){freeVariablesPredictive(_0x565f94);if(_0x565f94[_0x49c3('0x6e')]===0x0&&_0x565f94[_0x49c3('0x52')]===0x0&&_0x565f94[_0x49c3('0x55')]===0x0&&(_0x565f94[_0x49c3('0x4e')]||0x0)===0x0){_0x565f94['sendMessageOneNotActive']=![];_0x565f94['available']=0x0;_0x565f94[_0x49c3('0x3f')]=_0x49c3('0x3b');loggerSyncQueueSummary['error'](_0x49c3('0x9d'),_0x565f94['name'],'is\x20not\x20active');}else{_0x565f94[_0x49c3('0x3f')]='IS_DISACTIVED';loggerSyncQueueSummary['error'](_0x49c3('0x9d'),_0x565f94[_0x49c3('0x3c')],_0x49c3('0x9e'));}emitVoiceQueueSummary(_0x565f94);}}function notSendMessagesCampaign(_0x441a85){if(_0x441a85[_0x49c3('0x9c')]){if(_0x441a85[_0x49c3('0x6e')]===0x0){_0x441a85[_0x49c3('0x9c')]=![];_0x441a85[_0x49c3('0x3f')]=_0x49c3('0x3b');loggerSyncQueueSummary[_0x49c3('0x8f')](_0x49c3('0x9f'),_0x441a85[_0x49c3('0x3c')],'is\x20not\x20active');}else{_0x441a85[_0x49c3('0x3f')]='IS_DISACTIVED';loggerSyncQueueSummary[_0x49c3('0x8f')](_0x49c3('0x9f'),_0x441a85[_0x49c3('0x3c')],_0x49c3('0x9e'));}emitCampaignSummary(_0x441a85);}}function createObjHistory(_0x1c1763,_0x4b3dfc,_0x54f67d,_0x322efb,_0x365779){_0x1c1763[_0x49c3('0x3f')]=_0x54f67d;var _0x1cf7db=new Action(_0x1c1763,_0x4b3dfc);var _0x5e7592=new History(_0x1cf7db);_0x5e7592[_0x49c3('0xa0')]=_0x322efb;_0x5e7592[_0x49c3('0xa1')]=_0x365779;_0x5e7592[_0x49c3('0xa2')]=_0x1cf7db['starttime'];return _0x5e7592;}Dialer[_0x49c3('0x19')][_0x49c3('0xa3')]=function(){var _0x22719a=this;setInterval(function(){_0x22719a[_0x49c3('0xa4')](_0x22719a[_0x49c3('0xa5')],'[uniqueid]');_0x22719a[_0x49c3('0xa4')](_0x22719a['actions'],_0x49c3('0xa6'));},0x32c8);};Dialer['prototype'][_0x49c3('0xa4')]=function(_0x4ca949,_0x192f1c){var _0xfe436b=this;for(var _0x326594 in _0x4ca949){if(_0x4ca949[_0x49c3('0x92')](_0x326594)){this['sequence'][_0x49c3('0x1a')](function(){if(!_[_0x49c3('0xa7')](_0x4ca949[_0x326594])){return ami['Action']({'action':'status','channel':_0x4ca949[_0x326594][_0x49c3('0xa8')]})[_0x49c3('0xa9')](function(_0x2a5126){if(_0x2a5126[_0x49c3('0x3f')]===_0x49c3('0xaa')){setTimeout(function(){if(_0x4ca949[_0x326594]&&_0x4ca949[_0x326594]['type']!=='ivr'){_0xfe436b[_0x49c3('0xab')](_0xfe436b[_0x49c3('0x1f')][_0x4ca949[_0x326594]['queue']]);logger[_0x49c3('0x8f')](_0x49c3('0xac'),_0x192f1c,_0x326594,_0x4ca949[_0x326594][_0x49c3('0xad')]);delete _0x4ca949[_0x326594];}if(_0x4ca949[_0x326594]&&_0x4ca949[_0x326594][_0x49c3('0x4a')]==='ivr'){_0xfe436b[_0x49c3('0xab')](_0xfe436b[_0x49c3('0x20')][_0x4ca949[_0x326594][_0x49c3('0xad')]]);logger[_0x49c3('0x8f')]('[Dialer][checkChannel][ivr]',_0x192f1c,_0x326594,_0x4ca949[_0x326594]['queue']);delete _0x4ca949[_0x326594];}},0x2328);}});}});}}};Dialer[_0x49c3('0x19')][_0x49c3('0xae')]=function(_0x5ae52e){return BPromise[_0x49c3('0xaf')]()[_0x49c3('0xb0')](cmHopper[_0x49c3('0xae')](_0x5ae52e))[_0x49c3('0xa9')](loggerCatch(_0x49c3('0xb1')));};Dialer[_0x49c3('0x19')]['checkIsBlackList']=function(_0x1d6946){return BPromise[_0x49c3('0xaf')]()[_0x49c3('0xb0')](cmHopperBlack['checkIsBlackList'](_0x1d6946))[_0x49c3('0xa9')](loggerCatch(_0x49c3('0xb2')));};Dialer[_0x49c3('0x19')]['checkIsBlackListIvr']=function(_0x43d1e2){return BPromise[_0x49c3('0xaf')]()[_0x49c3('0xb0')](cmHopperBlack[_0x49c3('0xb3')](_0x43d1e2))[_0x49c3('0xa9')](loggerCatch(_0x49c3('0xb4')));};Dialer[_0x49c3('0x19')]['averageHandleTime']=function(_0x481c0c){return BPromise[_0x49c3('0xaf')]()[_0x49c3('0xb0')](cmHopperHistory[_0x49c3('0xb5')](_0x481c0c))[_0x49c3('0xa9')](loggerCatch(_0x49c3('0xb6')));};Dialer[_0x49c3('0x19')][_0x49c3('0xb7')]=function(_0x88da24){return BPromise['resolve']()['then'](cmHopper[_0x49c3('0xb7')](_0x88da24))['catch'](loggerCatch('[rescheduleContact]\x20'));};Dialer['prototype']['unlockContact']=function(_0x24ac1a,_0x212db0,_0xa1644e){return BPromise['resolve']()[_0x49c3('0xb0')](cmHopper['unlockContact'](_0x24ac1a,_0x212db0,_0xa1644e))[_0x49c3('0xa9')](loggerCatch(_0x49c3('0xb8')));};Dialer['prototype'][_0x49c3('0xb9')]=function(_0xd3a4cb,_0x444129,_0x2a590e,_0x24a344){return BPromise[_0x49c3('0xaf')]()[_0x49c3('0xb0')](cmHopper[_0x49c3('0xb9')](_0xd3a4cb,_0x444129,_0x2a590e,_0x24a344))[_0x49c3('0xa9')](loggerCatch('[getContactDialer]\x20'));};Dialer[_0x49c3('0x19')][_0x49c3('0xba')]=function(_0x2c4e30,_0x119f23,_0x36906d){return BPromise[_0x49c3('0xaf')]()[_0x49c3('0xb0')](cmHopper[_0x49c3('0xba')](_0x2c4e30,_0x119f23,_0x36906d))['catch'](loggerCatch('[getContactDialer]\x20'));};Dialer[_0x49c3('0x19')][_0x49c3('0xbb')]=function(_0x3478ca){return BPromise['resolve']()['then'](voiceQueueRt['getVoiceQueueRtPauses'](_0x3478ca))[_0x49c3('0xa9')](loggerCatch(_0x49c3('0xbc')));};Dialer[_0x49c3('0x19')][_0x49c3('0xbd')]=function(_0x4e2dd4){return BPromise[_0x49c3('0xaf')]()['then'](cmHopper['moveContactManagedDialer'](_0x4e2dd4))['catch'](loggerCatch(_0x49c3('0xbe')));};Dialer['prototype'][_0x49c3('0xbf')]=function(_0x10ee07){return BPromise[_0x49c3('0xaf')]()[_0x49c3('0xb0')](cmHopperHistory[_0x49c3('0xbf')](_0x10ee07))[_0x49c3('0xa9')](loggerCatch('[createHistory]\x20'));};Dialer[_0x49c3('0x19')][_0x49c3('0xab')]=function(_0x1f95eb){if(!_['isUndefined'](_0x1f95eb)&&_0x1f95eb!==null){if(_0x1f95eb[_0x49c3('0x92')](_0x49c3('0x6e'))){if(_0x1f95eb[_0x49c3('0x6e')]>0x0){_0x1f95eb['originated']-=0x1;}else{logger['error'](_0x49c3('0xc0'));}}}else{logger[_0x49c3('0x8f')]('[updateOriginated]\x20is\x20null\x20or\x20undefined');}};Dialer[_0x49c3('0x19')][_0x49c3('0xc1')]=function(_0x276e2a,_0x4362fc){var _0x50d8b4=this;return function(_0x272a8b){_0x50d8b4[_0x49c3('0xab')](_0x4362fc);logger[_0x49c3('0x8f')](_0x276e2a,util[_0x49c3('0x95')](_0x272a8b,{'showHidden':![],'depth':null}));};};Dialer[_0x49c3('0x19')][_0x49c3('0xc2')]=function(_0x4dfb9c,_0x50df95,_0x4de550){var _0x3c5ecf={'state':0x19,'statedesc':_0x49c3('0xc3')};this[_0x49c3('0xab')](_0x50df95);this[_0x49c3('0xc4')](_['merge'](_0x3c5ecf,_[_0x49c3('0xc5')](_0x4de550,[_0x49c3('0xc6'),_0x49c3('0xc7'),'UserId',_0x49c3('0xc8'),_0x49c3('0xc9')])),_0x49c3('0xca'),_0x49c3('0xcb'));logger[_0x49c3('0x8f')](_0x4dfb9c);};Dialer['prototype'][_0x49c3('0xcc')]=function(_0x4aeefd){return _0x4aeefd===_0x49c3('0xcd');};Dialer[_0x49c3('0x19')][_0x49c3('0xce')]=function(_0x52b5f7){return!_[_0x49c3('0x39')](_0x52b5f7)&&_0x52b5f7&&!_['isUndefined'](_0x52b5f7[_0x49c3('0x3c')])&&!_[_0x49c3('0x39')](_0x52b5f7[_0x49c3('0x72')])&&_0x52b5f7[_0x49c3('0x72')]&&(this[_0x49c3('0x22')][util['format'](_0x49c3('0xcf'),_0x52b5f7['name'])][_0x49c3('0xd0')]===_0x49c3('0xd1')||this[_0x49c3('0x22')][util[_0x49c3('0x74')](_0x49c3('0xcf'),_0x52b5f7['name'])][_0x49c3('0xd0')]===_0x49c3('0xd2'));};Dialer[_0x49c3('0x19')][_0x49c3('0xc4')]=function(_0x57558d,_0x48babc,_0xd6bf31){this[_0x49c3('0xbf')](_0x57558d)[_0x49c3('0xa9')](loggerCatch(_0x48babc));this[_0x49c3('0xbd')](_0x57558d)['catch'](loggerCatch(_0xd6bf31));};Dialer[_0x49c3('0x19')][_0x49c3('0xd3')]=function(_0x475c68){var _0x558340=this[_0x49c3('0xa5')][_0x475c68['uniqueid']];var _0x2b0fed;if(!_[_0x49c3('0xa7')](_0x475c68)&&!_['isNil'](_0x475c68[_0x49c3('0xd4')])&&!_[_0x49c3('0xa7')](_0x475c68[_0x49c3('0xd4')][_0x49c3('0xd5')])&&_0x475c68['exten']===_0x49c3('0xd6')&&_0x558340){if(_0x558340[_0x49c3('0x4a')]!==_0x49c3('0x76')&&this[_0x49c3('0x1f')][_0x558340[_0x49c3('0xad')]]['dialAMDActive']&&_0x475c68[_0x49c3('0xd7')]===_0x49c3('0xd8')){delete this['uniqueId'][_0x475c68[_0x49c3('0xd9')]];this[_0x49c3('0xab')](this['voiceQueues'][_0x558340[_0x49c3('0xad')]]);this[_0x49c3('0x1f')][_0x558340[_0x49c3('0xad')]][_0x49c3('0xda')]+=0x1;this[_0x49c3('0x1f')][_0x558340[_0x49c3('0xad')]][_0x49c3('0x5c')]+=0x1;_0x2b0fed=new Hangup(_0x558340,_0x475c68);_0x2b0fed[_0x49c3('0xa0')]=0x12;_0x2b0fed['statedesc']=_0x49c3('0xdb');_0x2b0fed[_0x49c3('0xdc')]=_0x49c3('0xdd');this[_0x49c3('0xc4')](_0x2b0fed,'[syncHangupInAMD][createHistory]','[syncHangupInAMD]');}if(_0x558340[_0x49c3('0x4a')]!==_0x49c3('0x76')&&this[_0x49c3('0x1f')][_0x558340[_0x49c3('0xad')]][_0x49c3('0xde')]&&_0x475c68[_0x49c3('0xd7')]===_0x49c3('0xdf')){delete this[_0x49c3('0xa5')][_0x475c68[_0x49c3('0xd9')]];this[_0x49c3('0xab')](this[_0x49c3('0x1f')][_0x558340[_0x49c3('0xad')]]);this[_0x49c3('0x1f')][_0x558340[_0x49c3('0xad')]][_0x49c3('0xda')]+=0x1;this[_0x49c3('0x1f')][_0x558340[_0x49c3('0xad')]][_0x49c3('0x5c')]+=0x1;_0x2b0fed=new Hangup(_0x558340,_0x475c68);_0x2b0fed[_0x49c3('0xa0')]=0x13;_0x2b0fed[_0x49c3('0xa1')]='Machine';_0x2b0fed[_0x49c3('0xdc')]=_0x49c3('0xdd');_0x2b0fed[_0x49c3('0xe0')]=!![];this[_0x49c3('0xc4')](_0x2b0fed,'[syncMachine][createHistory]',_0x49c3('0xe1'));}if(_0x558340[_0x49c3('0x4a')]===_0x49c3('0x76')&&this['campaigns'][_0x558340[_0x49c3('0xad')]][_0x49c3('0xde')]&&_0x475c68[_0x49c3('0xd7')]===_0x49c3('0xd8')){delete this['uniqueId'][_0x475c68[_0x49c3('0xd9')]];this['updateOriginated'](this[_0x49c3('0x20')][_0x558340[_0x49c3('0xad')]]);_0x2b0fed=new Hangup(_0x558340,_0x475c68);_0x2b0fed['state']=0x12;_0x2b0fed[_0x49c3('0xa1')]=_0x49c3('0xdb');_0x2b0fed[_0x49c3('0xdc')]=_0x49c3('0xdd');this[_0x49c3('0xc4')](_0x2b0fed,_0x49c3('0xe2'),_0x49c3('0xe3'));}if(_0x558340[_0x49c3('0x4a')]===_0x49c3('0x76')&&this[_0x49c3('0x20')][_0x558340['queue']][_0x49c3('0xde')]&&_0x475c68[_0x49c3('0xd7')]===_0x49c3('0xdf')){delete this['uniqueId'][_0x475c68[_0x49c3('0xd9')]];this['updateOriginated'](this[_0x49c3('0x20')][_0x558340[_0x49c3('0xad')]]);_0x2b0fed=new Hangup(_0x558340,_0x475c68);_0x2b0fed[_0x49c3('0xa0')]=0x13;_0x2b0fed[_0x49c3('0xa1')]=_0x49c3('0xe4');_0x2b0fed['membername']=_0x49c3('0xdd');_0x2b0fed['amd']=!![];this[_0x49c3('0xc4')](_0x2b0fed,'[syncMachineIvr][createHistory]',_0x49c3('0xe5'));}}};Dialer['prototype'][_0x49c3('0x33')]=function(_0x151bfc){var _0x392db1=this[_0x49c3('0xa5')][_0x151bfc[_0x49c3('0xd9')]];var _0x203321=this;var _0xa3622a;if(_0x392db1&&_0x392db1[_0x49c3('0x4a')]==='ivr'){delete this[_0x49c3('0xa5')][_0x151bfc[_0x49c3('0xd9')]];this['updateOriginated'](this[_0x49c3('0x20')][_0x392db1[_0x49c3('0xad')]]);this[_0x49c3('0x20')][_0x392db1[_0x49c3('0xad')]]['ivrAnswerCallsDay']+=0x1;_0xa3622a=new Hangup(_0x392db1,_0x151bfc);this[_0x49c3('0xbf')](_0xa3622a)[_0x49c3('0xa9')](loggerCatch('[syncHangupIvr][createHistory]'));this[_0x49c3('0xbd')](_0xa3622a)['catch'](loggerCatch(_0x49c3('0xe6')));}if(_0x392db1&&_0x392db1['type']!==_0x49c3('0x76')&&isNotNull(this[_0x49c3('0x1f')][_0x392db1[_0x49c3('0xad')]][_0x49c3('0xe7')])){delete this['uniqueId'][_0x151bfc['uniqueid']];this[_0x49c3('0xab')](this['voiceQueues'][_0x392db1[_0x49c3('0xad')]]);this['voiceQueues'][_0x392db1[_0x49c3('0xad')]][_0x49c3('0xda')]+=0x1;this[_0x49c3('0x1f')][_0x392db1[_0x49c3('0xad')]][_0x49c3('0x5c')]+=0x1;_0xa3622a=new Hangup(_0x392db1,_0x151bfc);_0xa3622a[_0x49c3('0xa0')]=0x10;_0xa3622a[_0x49c3('0xa1')]=_0x49c3('0xe8');_0xa3622a[_0x49c3('0xdc')]=_0x49c3('0xe9');this[_0x49c3('0xbf')](_0xa3622a)[_0x49c3('0xa9')](loggerCatch('[syncHangupIvr][createHistory]'));this[_0x49c3('0xbd')](_0xa3622a)[_0x49c3('0xa9')](loggerCatch(_0x49c3('0xe6')));}if(_0x392db1&&_0x392db1[_0x49c3('0x4a')]!=='ivr'&&!isNotNull(this[_0x49c3('0x1f')][_0x392db1[_0x49c3('0xad')]][_0x49c3('0xe7')])){delete this['uniqueId'][_0x151bfc[_0x49c3('0xd9')]];this[_0x49c3('0xab')](this[_0x49c3('0x1f')][_0x392db1[_0x49c3('0xad')]]);this[_0x49c3('0x1f')][_0x392db1[_0x49c3('0xad')]][_0x49c3('0x65')]+=0x1;_0xa3622a=new Hangup(_0x392db1,_0x151bfc);_0xa3622a[_0x49c3('0xa0')]=0xc;_0xa3622a['statedesc']=_0x151bfc[_0x49c3('0xea')];_0xa3622a[_0x49c3('0xdc')]='Unknow';this[_0x49c3('0xbf')](_0xa3622a)[_0x49c3('0xa9')](loggerCatch('[syncHangupIvr][createHistory]'));this[_0x49c3('0xbd')](_0xa3622a)['catch'](loggerCatch(_0x49c3('0xe6')));}};Dialer[_0x49c3('0x19')][_0x49c3('0x32')]=function(_0x10f2a8){var _0x3f3461=this['uniqueId'][_0x10f2a8[_0x49c3('0xd9')]];var _0x448193=this;if(this[_0x49c3('0x1f')][_0x10f2a8[_0x49c3('0xad')]]){if(_0x3f3461&&_0x3f3461[_0x49c3('0x4a')]!==_0x49c3('0x76')){delete this[_0x49c3('0xa5')][_0x10f2a8[_0x49c3('0xd9')]];this['voiceQueues'][_0x10f2a8['queue']]['outboundAnswerCallsDay']+=0x1;var _0x5c0644=new AgentComplete(_0x3f3461,_0x10f2a8);if(_0x10f2a8[_0x49c3('0xeb')]==='agent'){_0x5c0644[_0x49c3('0xec')]=this[_0x49c3('0x1f')][_0x10f2a8['queue']][_0x49c3('0xed')]&&this[_0x49c3('0x1f')][_0x10f2a8[_0x49c3('0xad')]]['dialAgiAfterHangupAgent']?moment()[_0x49c3('0x74')](_0x49c3('0xee')):undefined;}this[_0x49c3('0xbf')](_0x5c0644)[_0x49c3('0xa9')](loggerCatch(_0x49c3('0xef')));this[_0x49c3('0xbd')](_0x5c0644)[_0x49c3('0xa9')](loggerCatch(_0x49c3('0xf0')));}}};Dialer[_0x49c3('0x19')][_0x49c3('0x2c')]=function(_0x5391c8){if(this[_0x49c3('0x1f')][_0x5391c8[_0x49c3('0xad')]]){if(this['uniqueId'][_0x5391c8[_0x49c3('0xd9')]]&&this[_0x49c3('0xa5')][_0x5391c8[_0x49c3('0xd9')]][_0x49c3('0x4a')]!==_0x49c3('0x76')){this[_0x49c3('0xab')](this[_0x49c3('0x1f')][_0x5391c8[_0x49c3('0xad')]]);this['uniqueId'][_0x5391c8[_0x49c3('0xd9')]][_0x49c3('0xf1')]=moment()['format'](_0x49c3('0xee'));}}};Dialer[_0x49c3('0x19')]['queueCallerAbandonCreateState']=function(_0x2e43ce){this['createHistory'](_0x2e43ce)[_0x49c3('0xa9')](loggerCatch(_0x49c3('0xef')));this[_0x49c3('0xbd')](_0x2e43ce)['catch'](loggerCatch('[syncQueueCallerAbandon]\x20[Drop]'));};Dialer[_0x49c3('0x19')][_0x49c3('0x2e')]=function(_0x5c94a8){var _0x2d59e5=this[_0x49c3('0xa5')][_0x5c94a8[_0x49c3('0xd9')]];var _0x21e313=this;if(this[_0x49c3('0x1f')][_0x5c94a8[_0x49c3('0xad')]]){if(_0x2d59e5&&_0x2d59e5[_0x49c3('0x4a')]!=='ivr'){delete this['uniqueId'][_0x5c94a8[_0x49c3('0xd9')]];this[_0x49c3('0xab')](this['voiceQueues'][_0x5c94a8[_0x49c3('0xad')]]);_0x2d59e5[_0x49c3('0xf2')]=moment()['format'](_0x49c3('0xee'));var _0x50ec99=new QueueCallerAbandon(_0x2d59e5,_0x5c94a8);if(getSeconds(_0x2d59e5['droptime'],_0x2d59e5[_0x49c3('0xf3')])>=_0x2d59e5[_0x49c3('0xf4')]){this[_0x49c3('0x1f')][_0x5c94a8['queue']][_0x49c3('0x67')]+=0x1;this['voiceQueues'][_0x5c94a8[_0x49c3('0xad')]]['outboundDropCallsDayTimeout']+=0x1;this['voiceQueues'][_0x5c94a8[_0x49c3('0xad')]]['predictiveIntervalErlangCallsDroppedCalls']+=0x1;_0x50ec99[_0x49c3('0xa0')]=0xa;_0x50ec99[_0x49c3('0xa1')]='Drop';_0x50ec99[_0x49c3('0xf5')]=_0x49c3('0xf6');_0x50ec99[_0x49c3('0xec')]=this[_0x49c3('0x1f')][_0x5c94a8['queue']]['dialQueueProject2']?moment()[_0x49c3('0x74')](_0x49c3('0xee')):undefined;_0x50ec99[_0x49c3('0xf7')]+=0x1;if(_0x50ec99[_0x49c3('0xf7')]>=this[_0x49c3('0x1f')][_0x5c94a8['queue']][_0x49c3('0xf8')]){this[_0x49c3('0xf9')](_0x50ec99);}else{this[_0x49c3('0xb7')]({'active':![],'countdropretry':_0x50ec99[_0x49c3('0xf7')],'scheduledat':moment()[_0x49c3('0xfa')](this[_0x49c3('0x1f')][_0x5c94a8[_0x49c3('0xad')]]['dialDropRetryFrequency'],_0x49c3('0xfb'))[_0x49c3('0x74')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2d59e5['ContactId'],'ListId':_0x2d59e5[_0x49c3('0xc7')],'VoiceQueueId':_0x2d59e5['VoiceQueueId']||undefined,'CampaignId':_0x2d59e5[_0x49c3('0xc9')]||undefined})['catch'](loggerCatch(_0x49c3('0xfc')));var _0x1b03fd=new History(_0x50ec99);_0x1b03fd[_0x49c3('0xa0')]=0xa;_0x1b03fd[_0x49c3('0xa1')]=_0x49c3('0xfd');_0x1b03fd['starttime']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x1b03fd[_0x49c3('0xa2')]=_0x1b03fd[_0x49c3('0xfe')];_0x1b03fd[_0x49c3('0xff')]=_0x50ec99[_0x49c3('0xff')];_0x1b03fd['calleridnum']=_0x50ec99[_0x49c3('0x100')];console[_0x49c3('0x101')](_0x49c3('0x102'),_0x5c94a8);console[_0x49c3('0x101')](_0x49c3('0x103'),_0x50ec99);console[_0x49c3('0x101')](_0x49c3('0x104'),_0x1b03fd);this[_0x49c3('0xbf')](_0x1b03fd)[_0x49c3('0xa9')](loggerCatch(_0x49c3('0x105')));}}else{this[_0x49c3('0x1f')][_0x5c94a8[_0x49c3('0xad')]][_0x49c3('0x106')]+=0x1;this[_0x49c3('0x1f')][_0x5c94a8[_0x49c3('0xad')]][_0x49c3('0x60')]+=0x1;_0x50ec99['state']=0xb;_0x50ec99['statedesc']=_0x49c3('0x107');_0x50ec99['dropreason']=_0x49c3('0x108');_0x50ec99[_0x49c3('0x109')]+=0x1;if(_0x50ec99['countabandonedretry']>=this[_0x49c3('0x1f')][_0x5c94a8['queue']][_0x49c3('0x10a')]){this['queueCallerAbandonCreateState'](_0x50ec99);}else{this[_0x49c3('0xb7')]({'active':![],'countabandonedretry':_0x50ec99[_0x49c3('0x109')],'scheduledat':moment()['add'](this[_0x49c3('0x1f')][_0x5c94a8[_0x49c3('0xad')]][_0x49c3('0x10b')],_0x49c3('0xfb'))[_0x49c3('0x74')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2d59e5[_0x49c3('0xc6')],'ListId':_0x2d59e5[_0x49c3('0xc7')],'VoiceQueueId':_0x2d59e5[_0x49c3('0xc8')]||undefined,'CampaignId':_0x2d59e5[_0x49c3('0xc9')]||undefined})[_0x49c3('0xa9')](loggerCatch(_0x49c3('0x10c')));var _0x1b03fd=new History(_0x50ec99);_0x1b03fd[_0x49c3('0xa0')]=0xb;_0x1b03fd[_0x49c3('0xa1')]=_0x49c3('0x107');_0x1b03fd[_0x49c3('0xfe')]=moment()[_0x49c3('0x74')](_0x49c3('0xee'));_0x1b03fd[_0x49c3('0xa2')]=_0x1b03fd['starttime'];console[_0x49c3('0x101')]('CRIS\x20createHistory\x2011',_0x1b03fd);this[_0x49c3('0xbf')](_0x1b03fd)[_0x49c3('0xa9')](loggerCatch(_0x49c3('0x10d')));}}}}};Dialer[_0x49c3('0x19')][_0x49c3('0x34')]=function(_0x5daf5c){if(this[_0x49c3('0x10e')][_0x5daf5c[_0x49c3('0xd9')]]){this[_0x49c3('0x10e')][_0x5daf5c[_0x49c3('0xd9')]][_0x49c3('0xa8')]=_0x5daf5c[_0x49c3('0xa8')];}if(this[_0x49c3('0xa5')][_0x5daf5c[_0x49c3('0xd9')]]){this[_0x49c3('0xa5')][_0x5daf5c['uniqueid']][_0x49c3('0xa8')]=_0x5daf5c[_0x49c3('0xa8')];}};Dialer['prototype'][_0x49c3('0x36')]=function(_0xd4c46f){if(strategy[this[_0x49c3('0x1f')][this['actions'][_0xd4c46f[_0x49c3('0x10f')]][_0x49c3('0xad')]][_0x49c3('0x4c')]]===_0x49c3('0x18')){if(this[_0x49c3('0x10e')][_0xd4c46f['actionid']]&&_[_0x49c3('0xa7')](this[_0x49c3('0x10e')][_0xd4c46f[_0x49c3('0x10f')]][_0x49c3('0x110')])&&_0xd4c46f[_0x49c3('0xd0')]==='1'&&_0xd4c46f[_0x49c3('0x111')]==='0'){if(this['agents'][_0xd4c46f['stateinterface']]){if(!this[_0x49c3('0x21')][_0xd4c46f[_0x49c3('0x112')]][_0x49c3('0x110')]){this[_0x49c3('0x21')][_0xd4c46f[_0x49c3('0x112')]][_0x49c3('0x110')]=!![];this['actions'][_0xd4c46f['actionid']]['locked']=!![];this['actions'][_0xd4c46f[_0x49c3('0x10f')]]['stateinterface']=_0xd4c46f[_0x49c3('0x112')];}}}}else if((strategy[this[_0x49c3('0x1f')][this[_0x49c3('0x10e')][_0xd4c46f[_0x49c3('0x10f')]][_0x49c3('0xad')]][_0x49c3('0x4c')]]||_0x49c3('0x17'))===_0x49c3('0x17')){if(this[_0x49c3('0x10e')][_0xd4c46f[_0x49c3('0x10f')]]){if(this[_0x49c3('0x21')][_0xd4c46f[_0x49c3('0x112')]]){this[_0x49c3('0x10e')][_0xd4c46f[_0x49c3('0x10f')]][_0x49c3('0x112')]=_0xd4c46f[_0x49c3('0x112')];if(_['isNil'](this['queueBooked'][this['actions'][_0xd4c46f[_0x49c3('0x10f')]][_0x49c3('0xad')]])){this[_0x49c3('0x29')][this['actions'][_0xd4c46f['actionid']][_0x49c3('0xad')]]=[];}this[_0x49c3('0x29')][this[_0x49c3('0x10e')][_0xd4c46f[_0x49c3('0x10f')]][_0x49c3('0xad')]]['push'](_[_0x49c3('0x113')](_[_0x49c3('0xc5')](this[_0x49c3('0x10e')][_0xd4c46f[_0x49c3('0x10f')]],['idHopper','stateinterface']),{'status':_0xd4c46f[_0x49c3('0xd0')],'paused':_0xd4c46f[_0x49c3('0x111')]}));}}}};function unlockQueueStatus(_0x2e8bd3,_0x50ba1d){setTimeout(function(){if(_[_0x49c3('0x39')](_0x2e8bd3[_0x49c3('0x114')])){loggerBooked[_0x49c3('0x8f')]('[unlockQueueStatus][undefined]',_0x50ba1d);}_0x2e8bd3[_0x49c3('0x114')]=!![];loggerBooked[_0x49c3('0x78')]('[booked][unlockQueueStatus]',_0x50ba1d,JSON[_0x49c3('0x45')](_['pick'](_0x2e8bd3,[_0x49c3('0x3c'),_0x49c3('0x114')])));},0x1f3);}Dialer[_0x49c3('0x19')]['syncQueueStatusComplete']=function(_0x512c5c){var _0x303847=this;var _0x4bffc9=_0x303847[_0x49c3('0x1f')][_0x303847[_0x49c3('0x10e')][_0x512c5c['actionid']][_0x49c3('0xad')]];if(strategy[this['voiceQueues'][this[_0x49c3('0x10e')][_0x512c5c['actionid']][_0x49c3('0xad')]][_0x49c3('0x4c')]]===_0x49c3('0x18')){if(this['actions'][_0x512c5c['actionid']]&&this[_0x49c3('0x10e')][_0x512c5c[_0x49c3('0x10f')]][_0x49c3('0x112')]){this[_0x49c3('0x1e')][_0x49c3('0x115')](this[_0x49c3('0x10e')][_0x512c5c['actionid']][_0x49c3('0x116')],this['actions'][_0x512c5c[_0x49c3('0x10f')]][_0x49c3('0x112')])[_0x49c3('0xa9')](function(_0x1e2109){logger[_0x49c3('0x8f')](_0x49c3('0x117'),util[_0x49c3('0x95')](_0x1e2109,{'showHidden':![],'depth':null}));})[_0x49c3('0x1c')](function(){_0x303847[_0x49c3('0xab')](_0x303847[_0x49c3('0x1f')][_0x303847[_0x49c3('0x10e')][_0x512c5c['actionid']]['queue']]);_0x303847[_0x49c3('0x21')][_0x303847[_0x49c3('0x10e')][_0x512c5c[_0x49c3('0x10f')]]['stateinterface']][_0x49c3('0x110')]=![];delete _0x303847['actions'][_0x512c5c[_0x49c3('0x10f')]];unlockQueueStatus(_0x4bffc9);});}else{this[_0x49c3('0xab')](this[_0x49c3('0x1f')][this['actions'][_0x512c5c['actionid']][_0x49c3('0xad')]]);this['rescheduleContact']({'active':![],'ContactId':this[_0x49c3('0x10e')][_0x512c5c[_0x49c3('0x10f')]][_0x49c3('0xc6')],'ListId':this[_0x49c3('0x10e')][_0x512c5c['actionid']]['ListId'],'VoiceQueueId':this[_0x49c3('0x10e')][_0x512c5c[_0x49c3('0x10f')]]['VoiceQueueId']||undefined,'CampaignId':this[_0x49c3('0x10e')][_0x512c5c['actionid']]['CampaignId']||undefined})[_0x49c3('0xa9')](loggerCatch(_0x49c3('0x118')));delete this[_0x49c3('0x10e')][_0x512c5c[_0x49c3('0x10f')]];unlockQueueStatus(_0x4bffc9);}}else if((strategy[this[_0x49c3('0x1f')][this[_0x49c3('0x10e')][_0x512c5c[_0x49c3('0x10f')]][_0x49c3('0xad')]][_0x49c3('0x4c')]]||_0x49c3('0x17'))===_0x49c3('0x17')){var _0x253f00;if(this['actions'][_0x512c5c[_0x49c3('0x10f')]]&&!_[_0x49c3('0x42')](this[_0x49c3('0x29')][this[_0x49c3('0x10e')][_0x512c5c['actionid']][_0x49c3('0xad')]])){if(this['queueBookedRR'][_0x303847[_0x49c3('0x10e')][_0x512c5c[_0x49c3('0x10f')]][_0x49c3('0xad')]]){this[_0x49c3('0x2a')][_0x303847['actions'][_0x512c5c[_0x49c3('0x10f')]][_0x49c3('0xad')]]=this[_0x49c3('0x2a')][this['actions'][_0x512c5c[_0x49c3('0x10f')]][_0x49c3('0xad')]]?this[_0x49c3('0x2a')][this['actions'][_0x512c5c['actionid']][_0x49c3('0xad')]]:this['queueBooked'][this[_0x49c3('0x10e')][_0x512c5c[_0x49c3('0x10f')]][_0x49c3('0xad')]]?this[_0x49c3('0x29')][this[_0x49c3('0x10e')][_0x512c5c['actionid']][_0x49c3('0xad')]][_0x49c3('0x119')]||0x0:0x0;}this[_0x49c3('0x29')][this[_0x49c3('0x10e')][_0x512c5c['actionid']][_0x49c3('0xad')]]['_rr']=this['queueBookedRR'][this[_0x49c3('0x10e')][_0x512c5c[_0x49c3('0x10f')]][_0x49c3('0xad')]];for(var _0x2502b0=0x0;_0x2502b0=0x0?!![]:![];})['catch'](myreject(_0x4814a0)));}}else{_0x455a0f['push'](ami[_0x49c3('0x132')]({'action':_0x49c3('0x137'),'command':util[_0x49c3('0x74')]('iftime\x20%s,%s',_0x364c5a,!_[_0x49c3('0x39')](config['timezones'][_0x38efb2])?_0x38efb2:'')})[_0x49c3('0xb0')](function(_0x36c223){return _0x36c223[_0x49c3('0x138')][_0x49c3('0x135')](_0x49c3('0x136'))>=0x0?!![]:![];})[_0x49c3('0xa9')](myreject(_0x4814a0)));}BPromise[_0x49c3('0x139')](_0x455a0f)[_0x49c3('0xb0')](function(_0x159dc0){var _0x4ff2f9=_['some'](_0x159dc0);if(_0x4ff2f9){return _0x13fb10(_0x4ff2f9);}else{_0x32a839[_0x49c3('0x3f')]=_0x3c52e9?_0x49c3('0x13a'):'INTERVAL_IS_OVERTIME';return _0x4814a0(msgResponse(_0x49c3('0x13b'),_0x49c3('0x129'),_0x49c3('0x13c')+_0x3c52e9+'\x20'+_0x336bb2+'\x20Interval\x20is\x20overtime:\x20'+util['inspect'](_0x364c5a,{'showHidden':![],'depth':null})+_0x49c3('0x13d')+_0x38efb2));}})['catch'](function(_0x4b269b){return _0x4814a0(msgResponse('ifTime','Failure',JSON[_0x49c3('0x45')](_0x4b269b)));});});};Dialer['prototype'][_0x49c3('0x13e')]=function(_0x317947){var _0xa1b3bd=this;return function(){switch(_0x317947[_0x49c3('0x57')]){case _0x49c3('0x13f'):freeVariablesPredictive(_0x317947);_0xa1b3bd['handlePower'](_0x317947,0x1);break;case'power':freeVariablesPredictive(_0x317947);_0xa1b3bd[_0x49c3('0x140')](_0x317947,_0x317947[_0x49c3('0x141')]);break;case _0x49c3('0x8'):_0xa1b3bd[_0x49c3('0x8')](_0x317947);break;case'booked':freeVariablesPredictive(_0x317947);_0xa1b3bd[_0x49c3('0x140')](_0x317947,0x1);break;default:freeVariablesPredictive(_0x317947);logger[_0x49c3('0x8f')](_0x49c3('0x142'),_0x317947[_0x49c3('0x3c')],_0x49c3('0x143'));}};};Dialer['prototype'][_0x49c3('0x144')]=function(_0x322841){var _0xe2353=this;return function(){_0xe2353[_0x49c3('0x145')](_0x322841);};};Dialer[_0x49c3('0x19')]['syncQueueSummary']=function(_0x3bdd94){var _0x54e2f5=this;if(isNotPreview(_0x3bdd94[_0x49c3('0x57')])){if(isVoiceQueueOutbound(_0x3bdd94[_0x49c3('0x4a')])&&isActive(_0x3bdd94[_0x49c3('0x56')])){_0x3bdd94[_0x49c3('0x9c')]=!![];BPromise['resolve']()['then'](checkIsLoggedIn(_0x3bdd94,_0x3bdd94[_0x49c3('0x4d')]))['then'](checkIsActive(_0x3bdd94,_0x3bdd94[_0x49c3('0x56')]))['then'](checkInterval(_0x3bdd94))[_0x49c3('0xb0')](_0x54e2f5[_0x49c3('0x123')](_0x3bdd94))[_0x49c3('0xb0')](_0x54e2f5['checkIfTime'](_0x3bdd94[_0x49c3('0x146')],_0x3bdd94[_0x49c3('0x147')],_0x3bdd94[_0x49c3('0x3c')],_0x3bdd94))['then'](_0x54e2f5[_0x49c3('0x128')](_0x3bdd94[_0x49c3('0x3d')],_0x3bdd94['dialTimezone'],_0x3bdd94[_0x49c3('0x3c')],_0x3bdd94))[_0x49c3('0xb0')](_0x54e2f5[_0x49c3('0x13e')](_0x3bdd94))[_0x49c3('0xa9')](loggerCatchQueueSummary(_0x49c3('0x148'),_0x3bdd94));}else{notSendMessagesQueue(_0x3bdd94);}}else{freeVariablesPredictive(_0x3bdd94);}};Dialer[_0x49c3('0x19')][_0x49c3('0x122')]=function(){var _0x4425c9=this;var _0x2f22db;for(var _0xc6ec21 in this[_0x49c3('0x20')]){if(this[_0x49c3('0x20')][_0x49c3('0x92')](_0xc6ec21)){_0x2f22db=this[_0x49c3('0x20')][_0xc6ec21];if(isCampaignIvr(_0x2f22db[_0x49c3('0x4a')])&&isActive(_0x2f22db[_0x49c3('0x72')])){_0x2f22db[_0x49c3('0x9c')]=!![];BPromise['resolve']()[_0x49c3('0xb0')](checkIsActive(_0x2f22db,_0x2f22db[_0x49c3('0x72')]))[_0x49c3('0xb0')](checkInterval(_0x2f22db))[_0x49c3('0xb0')](_0x4425c9['checkIsTrunkReachable'](_0x2f22db))['then'](_0x4425c9[_0x49c3('0x126')](_0x2f22db['dialGlobalInterval'],_0x2f22db[_0x49c3('0x147')],_0x2f22db['name'],_0x2f22db))[_0x49c3('0xb0')](_0x4425c9['checkIfTimeIntervals'](_0x2f22db[_0x49c3('0x3d')],_0x2f22db[_0x49c3('0x147')],_0x2f22db['name'],_0x2f22db))['then'](_0x4425c9[_0x49c3('0x144')](_0x2f22db))[_0x49c3('0xa9')](loggerCatchQueueSummary(_0x49c3('0x149'),_0x2f22db));}else{notSendMessagesCampaign(_0x2f22db);}}}};function getCallerIdRandom(_0x10c219,_0x4b2b39){var _0x2950ba,_0x583456,_0x5c9fcb;if(_0x4b2b39<=0x0){_0x4b2b39=0x1;}_0x2950ba=new RegExp('\x5cw{0,'+_0x4b2b39+'}$');_0x583456=Math[_0x49c3('0x14a')](0xa,_0x4b2b39-0x1);_0x5c9fcb=Math[_0x49c3('0x14a')](0xa,_0x4b2b39)-0x1;return util[_0x49c3('0x74')]('%s',_[_0x49c3('0x14b')](_0x10c219,_0x2950ba,_[_0x49c3('0x14c')](_0x583456,_0x5c9fcb)));}function extractCalleridName(_0x25f11f){var _0x45d2e7=_0x25f11f['match'](/"(.*?)"/);return _0x45d2e7?_0x45d2e7[0x1]:_0x25f11f;}function extractCalleridNumber(_0x232d9c){var _0x18b01e=_0x232d9c[_0x49c3('0x14d')](/<(.*?)>/);return _0x18b01e?_0x18b01e[0x1]:_0x232d9c;}Dialer[_0x49c3('0x19')][_0x49c3('0x14e')]=function(_0x119938,_0x229cbd){var _0x1b5df5=this;var _0x1a9e98=uuid['v4']();this[_0x49c3('0x10e')][_0x1a9e98]=new Action(_0x119938,_0x229cbd,_0x1a9e98);return new BPromise(function(_0x4ec9e9,_0x52259d){if(_[_0x49c3('0x39')](_0x119938)&&_0x49c3('0x14f')!==typeof _0x119938){return _0x52259d(msgResponse(_0x49c3('0x150'),_0x49c3('0x129'),_0x49c3('0x151')));}if(_[_0x49c3('0x39')](_0x229cbd[_0x49c3('0x152')][_0x49c3('0x153')])||_0x229cbd[_0x49c3('0x152')]['phone']===null){return _0x52259d(msgResponse(_0x49c3('0x150'),_0x49c3('0x129'),_0x49c3('0x154')));}var _0x3e4c7e={'XMD-CALLERID':_0x1b5df5[_0x49c3('0x10e')][_0x1a9e98][_0x49c3('0x155')](),'XMD-AGI':_0x119938[_0x49c3('0xe7')]?util[_0x49c3('0x74')](_0x49c3('0x156'),ipAgi,_0x119938[_0x49c3('0xe7')]):_0x49c3('0x157'),'XMD-AGIAFTER':_0x119938[_0x49c3('0xed')]?util['format'](_0x49c3('0x156'),ipAgi,_0x119938[_0x49c3('0xed')]):'NONE','XMD-QUEUE':_0x119938[_0x49c3('0x4a')]==='outbound'?util[_0x49c3('0x74')](_0x49c3('0x158'),_0x119938[_0x49c3('0x3c')],_0x119938[_0x49c3('0x159')]||'',_0x119938[_0x49c3('0x15a')]?'c':'',_0x119938[_0x49c3('0xf4')]||0x3):_0x49c3('0x157'),'XMD-CONTACTID':_0x229cbd[_0x49c3('0xc6')],'XMD-CDRTYPE':_0x49c3('0x5'),'CALLERID(all)':_0x1b5df5['actions'][_0x1a9e98][_0x49c3('0x155')](),'XMD-AMD':_0x119938[_0x49c3('0xde')]?'ACTIVE':_0x49c3('0x157'),'XMD-DESTINATION':'xcally-motion-dialer'};if(_0x119938['dialAMDActive']){_0x3e4c7e[_0x49c3('0x15b')]=_0x119938['dialAMDInitialSilence']||0x9c4;_0x3e4c7e['XMD-AMDGREETING']=_0x119938[_0x49c3('0x15c')]||0x5dc;_0x3e4c7e['XMD-AMDAFTERGREETINGSILENCE']=_0x119938[_0x49c3('0x15d')]||0x320;_0x3e4c7e[_0x49c3('0x15e')]=_0x119938[_0x49c3('0x15f')]||0x1388;_0x3e4c7e[_0x49c3('0x160')]=_0x119938[_0x49c3('0x161')]||0x64;_0x3e4c7e[_0x49c3('0x162')]=_0x119938['dialAMDBetweenWordsSilence']||0x32;_0x3e4c7e['XMD-AMDMAXIMUMNUMBEROFWORDS']=_0x119938[_0x49c3('0x163')]||0x3;_0x3e4c7e[_0x49c3('0x164')]=_0x119938[_0x49c3('0x165')]||0x100;_0x3e4c7e[_0x49c3('0x166')]=_0x119938[_0x49c3('0x167')]||0x1388;}if(_0x119938[_0x49c3('0x4a')]===_0x49c3('0x4b')){_0x3e4c7e['XMD-VOICEQUEUEID']=_0x229cbd[_0x49c3('0xc8')];}else{_0x3e4c7e[_0x49c3('0x168')]=_0x229cbd[_0x49c3('0xc9')];}for(var _0x158512 in _0x229cbd[_0x49c3('0x152')]){if(_0x229cbd['Contact'][_0x49c3('0x92')](_0x158512)){if(isNotNull(_0x229cbd['Contact'][_0x158512])&&_0x158512!=='id'&&_0x158512!=='tags'&&_0x158512!==_0x49c3('0x169')&&_0x158512!==_0x49c3('0x16a')){_0x3e4c7e[util[_0x49c3('0x74')](_0x49c3('0x16b'),_0x49c3('0x16c'),_[_0x49c3('0x16d')](_0x158512))]=_0x229cbd[_0x49c3('0x152')][_0x158512];}}}var _0xbefcd9=_0x1b5df5[_0x49c3('0xce')](_0x119938[_0x49c3('0x71')])?getCallerId(_0x119938[_0x49c3('0x71')][_0x49c3('0x73')],_0x119938[_0x49c3('0x58')],_0x119938[_0x49c3('0x16e')]>0x0?getCallerIdRandom(_0x119938[_0x49c3('0x59')],_0x119938[_0x49c3('0x16e')]):_0x119938[_0x49c3('0x59')]):getCallerId(_[_0x49c3('0xa7')](_0x119938[_0x49c3('0x16f')])?_0x119938[_0x49c3('0x71')]['callerid']:_0x119938[_0x49c3('0x16f')][_0x49c3('0x73')],_0x119938['dialOriginateCallerIdName'],_0x119938[_0x49c3('0x16e')]>0x0?getCallerIdRandom(_0x119938['dialOriginateCallerIdNumber'],_0x119938['dialRandomLastDigitCallerIdNumber']):_0x119938[_0x49c3('0x59')]);if(_0xbefcd9){_0x3e4c7e[_0x49c3('0x170')]=_0x1b5df5[_0x49c3('0x10e')][_0x1a9e98][_0x49c3('0x171')]=extractCalleridName(_0xbefcd9);_0x3e4c7e['XMD-ORIGINATECALLERIDNUM']=_0x1b5df5[_0x49c3('0x10e')][_0x1a9e98][_0x49c3('0x172')]=extractCalleridNumber(_0xbefcd9);}return ami[_0x49c3('0x132')]({'actionid':_0x1a9e98,'action':_0x49c3('0x150'),'channel':_0x1b5df5[_0x49c3('0xce')](_0x119938['Trunk'])?util[_0x49c3('0x74')]('SIP/%s/%s%s',_0x119938[_0x49c3('0x71')][_0x49c3('0x3c')],isNotNull(_0x119938[_0x49c3('0x5b')])?_0x119938[_0x49c3('0x5b')]['trim']()||'':'',_0x119938[_0x49c3('0x173')]>0x0?_0x229cbd[_0x49c3('0x152')]['phone'][_0x49c3('0x174')](_0x119938['dialCutDigit']):_0x229cbd['Contact']['phone']):util[_0x49c3('0x74')](_0x49c3('0x175'),_[_0x49c3('0xa7')](_0x119938[_0x49c3('0x16f')])?_0x119938[_0x49c3('0x71')][_0x49c3('0x3c')]:_0x119938[_0x49c3('0x16f')]['name'],isNotNull(_0x119938['dialPrefix'])?_0x119938[_0x49c3('0x5b')][_0x49c3('0x176')]()||'':'',_0x119938['dialCutDigit']>0x0?_0x229cbd['Contact'][_0x49c3('0x153')][_0x49c3('0x174')](_0x119938['dialCutDigit']):_0x229cbd[_0x49c3('0x152')][_0x49c3('0x153')]),'callerid':_0xbefcd9,'Exten':_0x49c3('0xd6'),'Context':_0x49c3('0x177'),'Priority':'1','variable':_0x3e4c7e,'timeout':(_0x119938[_0x49c3('0x5a')]||0x1e)*0x3e8,'async':!![],'channelid':_0x1a9e98})[_0x49c3('0xb0')](function(_0x4a599a){return _0x4ec9e9(_0x4a599a);})[_0x49c3('0xa9')](function(_0x4ee504){_0x119938[_0x49c3('0x178')]+=0x1;var _0x47966d=new History(_0x1b5df5[_0x49c3('0x10e')][_0x1a9e98]);logger[_0x49c3('0x8f')](util[_0x49c3('0x74')]('[originateError]:\x20%s',JSON[_0x49c3('0x45')](_0x4ee504)));_0x47966d[_0x49c3('0xa0')]=0xe;_0x47966d[_0x49c3('0xa1')]=_0x49c3('0x179');_0x47966d['starttime']=moment()[_0x49c3('0x74')](_0x49c3('0xee'));_0x47966d['endtime']=_0x47966d[_0x49c3('0xfe')];_0x1b5df5[_0x49c3('0xbf')](_0x47966d)[_0x49c3('0xa9')](loggerCatch(_0x49c3('0x17a')));_0x1b5df5[_0x49c3('0xbd')](_0x47966d)[_0x49c3('0xa9')](loggerCatch('[originate][error]'))[_0x49c3('0x1c')](function(){delete _0x1b5df5[_0x49c3('0x10e')][_0x1a9e98];return _0x52259d(msgResponse(_0x49c3('0x150'),'Error',_0x49c3('0x17b')));});});});};Dialer[_0x49c3('0x19')][_0x49c3('0x31')]=function(_0x591064){var _0x92092=this[_0x49c3('0x10e')][_0x591064[_0x49c3('0x10f')]];var _0x10bb48=this;if(_0x92092){delete this[_0x49c3('0x10e')][_0x591064['actionid']];_0x92092[_0x49c3('0xf3')]=moment()[_0x49c3('0x74')](_0x49c3('0xee'));var _0x5f3eaf=_0x92092['type']===_0x49c3('0x76')?this[_0x49c3('0x20')][_0x92092[_0x49c3('0xad')]]:this[_0x49c3('0x1f')][_0x92092[_0x49c3('0x17c')]()];if(!this[_0x49c3('0xcc')](_0x591064['response'])){this[_0x49c3('0xab')](_0x5f3eaf);return this[_0x49c3('0x17d')](_0x92092,_0x5f3eaf,_0x591064)['then'](function(_0x30da8c){})[_0x49c3('0xa9')](loggerCatch(_0x49c3('0x17e')));}else{this['uniqueId'][_0x591064[_0x49c3('0xd9')]]=_0x92092;}}};Dialer['prototype'][_0x49c3('0x17f')]=function(_0x53d1de,_0x5d8451,_0x163aaf){var _0x3953a7=new History(_0x5d8451);if(_0x3953a7[_0x49c3('0x180')]+_0x3953a7['countcongestionretry']+_0x3953a7[_0x49c3('0x181')]+_0x3953a7['countnosuchnumberretry']+_0x3953a7['countdropretry']+_0x3953a7[_0x49c3('0x109')]+_0x3953a7['countmachineretry']+_0x3953a7[_0x49c3('0x182')]>=_0x163aaf[_0x49c3('0x183')]-0x1){return!![];}switch(_0x53d1de){case 0x3:if(_0x3953a7[_0x49c3('0x181')]>=_0x163aaf[_0x49c3('0x184')]-0x1){return!![];}else{this[_0x49c3('0xb7')]({'active':![],'countnoanswerretry':_0x3953a7['countnoanswerretry']+=0x1,'scheduledat':moment()[_0x49c3('0xfa')](_0x163aaf[_0x49c3('0x185')],_0x49c3('0xfb'))[_0x49c3('0x74')](_0x49c3('0xee')),'ContactId':_0x3953a7[_0x49c3('0xc6')],'ListId':_0x3953a7[_0x49c3('0xc7')],'VoiceQueueId':_0x3953a7[_0x49c3('0xc8')]||undefined,'CampaignId':_0x3953a7['CampaignId']||undefined})[_0x49c3('0xa9')](loggerCatch(_0x49c3('0x186')));}break;case 0x5:if(_0x3953a7[_0x49c3('0x180')]>=_0x163aaf[_0x49c3('0x187')]-0x1){return!![];}else{this[_0x49c3('0xb7')]({'active':![],'countbusyretry':_0x3953a7['countbusyretry']+=0x1,'scheduledat':moment()[_0x49c3('0xfa')](_0x163aaf[_0x49c3('0x188')],'minutes')['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x3953a7[_0x49c3('0xc6')],'ListId':_0x3953a7['ListId'],'VoiceQueueId':_0x3953a7[_0x49c3('0xc8')]||undefined,'CampaignId':_0x3953a7['CampaignId']||undefined})[_0x49c3('0xa9')](loggerCatch(_0x49c3('0x189')));}break;case 0x8:if(_0x3953a7[_0x49c3('0x18a')]>=_0x163aaf['dialCongestionMaxRetry']-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countcongestionretry':_0x3953a7[_0x49c3('0x18a')]+=0x1,'scheduledat':moment()[_0x49c3('0xfa')](_0x163aaf[_0x49c3('0x18b')],_0x49c3('0xfb'))['format'](_0x49c3('0xee')),'ContactId':_0x3953a7[_0x49c3('0xc6')],'ListId':_0x3953a7[_0x49c3('0xc7')],'VoiceQueueId':_0x3953a7[_0x49c3('0xc8')]||undefined,'CampaignId':_0x3953a7[_0x49c3('0xc9')]||undefined})[_0x49c3('0xa9')](loggerCatch(_0x49c3('0x18c')));}break;case 0x0:if(_0x3953a7[_0x49c3('0x18d')]>=_0x163aaf[_0x49c3('0x18e')]-0x1){return!![];}else{this[_0x49c3('0xb7')]({'active':![],'countnosuchnumberretry':_0x3953a7[_0x49c3('0x18d')]+=0x1,'scheduledat':moment()[_0x49c3('0xfa')](_0x163aaf[_0x49c3('0x18f')],_0x49c3('0xfb'))['format'](_0x49c3('0xee')),'ContactId':_0x3953a7[_0x49c3('0xc6')],'ListId':_0x3953a7['ListId'],'VoiceQueueId':_0x3953a7['VoiceQueueId']||undefined,'CampaignId':_0x3953a7['CampaignId']||undefined})[_0x49c3('0xa9')](loggerCatch(_0x49c3('0x190')));}break;case 0xa:if(_0x3953a7[_0x49c3('0xf7')]>=_0x163aaf['dialDropMaxRetry']-0x1){return!![];}else{this[_0x49c3('0xb7')]({'active':![],'countdropretry':_0x3953a7[_0x49c3('0xf7')]+=0x1,'scheduledat':moment()[_0x49c3('0xfa')](_0x163aaf[_0x49c3('0x191')],_0x49c3('0xfb'))[_0x49c3('0x74')](_0x49c3('0xee')),'ContactId':_0x3953a7[_0x49c3('0xc6')],'ListId':_0x3953a7[_0x49c3('0xc7')],'VoiceQueueId':_0x3953a7[_0x49c3('0xc8')]||undefined,'CampaignId':_0x3953a7[_0x49c3('0xc9')]||undefined})[_0x49c3('0xa9')](loggerCatch(_0x49c3('0xfc')));}break;case 0xb:if(_0x3953a7[_0x49c3('0x109')]>=_0x163aaf[_0x49c3('0x10a')]-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countabandonedretry':_0x3953a7[_0x49c3('0x109')]+=0x1,'scheduledat':moment()[_0x49c3('0xfa')](_0x163aaf['dialAbandonedRetryFrequency'],_0x49c3('0xfb'))[_0x49c3('0x74')](_0x49c3('0xee')),'ContactId':_0x3953a7[_0x49c3('0xc6')],'ListId':_0x3953a7[_0x49c3('0xc7')],'VoiceQueueId':_0x3953a7[_0x49c3('0xc8')]||undefined,'CampaignId':_0x3953a7[_0x49c3('0xc9')]||undefined})['catch'](loggerCatch(_0x49c3('0x10c')));}break;case 0x13:if(_0x3953a7[_0x49c3('0x192')]>=_0x163aaf['dialMachineMaxRetry']-0x1){return!![];}else{this[_0x49c3('0xb7')]({'active':![],'countmachineretry':_0x3953a7[_0x49c3('0x192')]+=0x1,'scheduledat':moment()[_0x49c3('0xfa')](_0x163aaf[_0x49c3('0x193')],'minutes')[_0x49c3('0x74')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x3953a7[_0x49c3('0xc6')],'ListId':_0x3953a7['ListId'],'VoiceQueueId':_0x3953a7['VoiceQueueId']||undefined,'CampaignId':_0x3953a7[_0x49c3('0xc9')]||undefined})[_0x49c3('0xa9')](loggerCatch(_0x49c3('0x194')));}break;case 0x14:if(_0x3953a7['countagentrejectretry']>=_0x163aaf[_0x49c3('0x195')]-0x1){return!![];}else{this[_0x49c3('0xb7')]({'active':![],'countagentrejectretry':_0x3953a7[_0x49c3('0x182')]+=0x1,'scheduledat':moment()[_0x49c3('0xfa')](_0x163aaf[_0x49c3('0x196')],'minutes')[_0x49c3('0x74')](_0x49c3('0xee')),'ContactId':_0x3953a7[_0x49c3('0xc6')],'ListId':_0x3953a7['ListId'],'VoiceQueueId':_0x3953a7[_0x49c3('0xc8')]||undefined,'CampaignId':_0x3953a7['CampaignId']||undefined})['catch'](loggerCatch(_0x49c3('0x197')));}break;default:return!![];}};Dialer[_0x49c3('0x19')]['callProgressDetecting']=function(_0x2a831b,_0x5b4391,_0x200f19){var _0x456c58=this;var _0x554f82=new History(_0x2a831b);return new BPromise(function(_0x52d53f,_0x144b4a){if(_[_0x49c3('0x39')](_0x5b4391)&&_0x49c3('0x14f')!==typeof _0x5b4391){return _0x144b4a(msgResponse(_0x49c3('0x198'),_0x49c3('0x129'),_0x49c3('0x199')));}if(_[_0x49c3('0x39')](_0x200f19)&&_0x49c3('0x14f')!==typeof _0x200f19){return _0x144b4a(msgResponse('[callProgressDetecting]',_0x49c3('0x129'),_0x49c3('0x19a')));}switch(_0x200f19[_0x49c3('0xeb')]){case'0':_0x5b4391[_0x49c3('0x63')]+=0x1;_0x554f82['state']=0x0;_0x554f82['statedesc']='NoSuchNumber';_0x554f82[_0x49c3('0x18d')]+=0x1;_0x554f82[_0x49c3('0x19b')]+=0x1;_0x456c58[_0x49c3('0xbf')](_0x554f82)[_0x49c3('0xa9')](loggerCatch(_0x49c3('0x19c')));if(_0x456c58[_0x49c3('0x17f')](0x0,_0x2a831b,_0x5b4391)){if(_0x554f82[_0x49c3('0x180')]+_0x554f82[_0x49c3('0x18a')]+_0x554f82[_0x49c3('0x181')]+_0x554f82[_0x49c3('0x18d')]+_0x554f82[_0x49c3('0xf7')]+_0x554f82[_0x49c3('0x109')]+_0x554f82[_0x49c3('0x192')]+_0x554f82[_0x49c3('0x182')]>=_0x5b4391[_0x49c3('0x183')]){_0x456c58['stateGlobal'](_0x554f82,_0x52d53f,_0x144b4a,_0x49c3('0x19d'));}else{_0x456c58['createStateFinal'](_0x554f82,_0x52d53f,_0x144b4a,'reason\x200\x20no\x20such\x20number....');}}break;case'3':_0x5b4391['outboundNoAnswerCallsDay']+=0x1;_0x554f82[_0x49c3('0xa0')]=0x3;_0x554f82[_0x49c3('0xa1')]=_0x49c3('0x19e');_0x554f82[_0x49c3('0x181')]+=0x1;_0x554f82['countglobal']+=0x1;_0x456c58[_0x49c3('0xbf')](_0x554f82)[_0x49c3('0xa9')](loggerCatch(_0x49c3('0x19f')));if(_0x456c58[_0x49c3('0x17f')](0x3,_0x2a831b,_0x5b4391)){if(_0x554f82[_0x49c3('0x181')]>=_0x5b4391[_0x49c3('0x184')]){_0x456c58[_0x49c3('0x1a0')](_0x554f82,_0x52d53f,_0x144b4a,_0x49c3('0x1a1'));}else{_0x456c58['stateGlobal'](_0x554f82,_0x52d53f,_0x144b4a,_0x49c3('0x1a1'));}}break;case'5':_0x5b4391[_0x49c3('0x5d')]+=0x1;_0x554f82[_0x49c3('0xa0')]=0x5;_0x554f82[_0x49c3('0xa1')]=_0x49c3('0x1a2');_0x554f82[_0x49c3('0x180')]+=0x1;_0x554f82[_0x49c3('0x19b')]+=0x1;_0x456c58[_0x49c3('0xbf')](_0x554f82)[_0x49c3('0xa9')](loggerCatch(_0x49c3('0x1a3')));if(_0x456c58[_0x49c3('0x17f')](0x5,_0x2a831b,_0x5b4391)){if(_0x554f82[_0x49c3('0x180')]>=_0x5b4391[_0x49c3('0x187')]){_0x456c58[_0x49c3('0x1a0')](_0x554f82,_0x52d53f,_0x144b4a,_0x49c3('0x1a4'));}else{_0x456c58['stateGlobal'](_0x554f82,_0x52d53f,_0x144b4a,'reason\x205\x20busy');}}break;case'8':_0x5b4391[_0x49c3('0x5e')]+=0x1;_0x554f82['state']=0x8;_0x554f82['statedesc']=_0x49c3('0x1a5');_0x554f82[_0x49c3('0x18a')]+=0x1;_0x554f82[_0x49c3('0x19b')]+=0x1;_0x456c58[_0x49c3('0xbf')](_0x554f82)[_0x49c3('0xa9')](loggerCatch(_0x49c3('0x1a6')));if(_0x456c58[_0x49c3('0x17f')](0x8,_0x2a831b,_0x5b4391)){if(_0x554f82['countcongestionretry']>=_0x5b4391[_0x49c3('0x1a7')]){_0x456c58[_0x49c3('0x1a0')](_0x554f82,_0x52d53f,_0x144b4a,_0x49c3('0x1a8'));}else{_0x456c58[_0x49c3('0x1a9')](_0x554f82,_0x52d53f,_0x144b4a,_0x49c3('0x1a8'));}}break;case'11':_0x5b4391[_0x49c3('0x1aa')]+=0x1;_0x554f82[_0x49c3('0xa0')]=0xb;_0x554f82[_0x49c3('0xa1')]='Abandoned';_0x554f82['countabandonedretry']+=0x1;_0x554f82[_0x49c3('0x19b')]+=0x1;_0x456c58[_0x49c3('0xbf')](_0x554f82)['catch'](loggerCatch(_0x49c3('0x10d')));if(_0x456c58[_0x49c3('0x17f')](0xb,_0x2a831b,_0x5b4391)){if(_0x554f82[_0x49c3('0x109')]>=_0x5b4391[_0x49c3('0x10a')]){_0x456c58['createStateFinal'](_0x554f82,_0x52d53f,_0x144b4a,_0x49c3('0x1ab'));}else{_0x456c58[_0x49c3('0x1a9')](_0x554f82,_0x52d53f,_0x144b4a,_0x49c3('0x1ab'));}}break;case'20':_0x5b4391[_0x49c3('0x1ac')]+=0x1;_0x554f82[_0x49c3('0xa0')]=0x14;_0x554f82['statedesc']=_0x49c3('0x1ad');_0x554f82[_0x49c3('0x182')]+=0x1;_0x554f82['countglobal']+=0x1;_0x456c58[_0x49c3('0xbf')](_0x554f82)[_0x49c3('0xa9')](loggerCatch(_0x49c3('0x1ae')));if(_0x456c58[_0x49c3('0x17f')](0x14,_0x2a831b,_0x5b4391)){if(_0x554f82[_0x49c3('0x182')]>=_0x5b4391[_0x49c3('0x195')]){_0x456c58[_0x49c3('0x1a0')](_0x554f82,_0x52d53f,_0x144b4a,_0x49c3('0x1af'));}else{_0x456c58[_0x49c3('0x1a9')](_0x554f82,_0x52d53f,_0x144b4a,_0x49c3('0x1af'));}}break;default:_0x5b4391[_0x49c3('0x65')]+=0x1;_0x554f82[_0x49c3('0xa0')]=0xc;_0x554f82[_0x49c3('0xa1')]=_0x200f19['reason'];_0x456c58['createHistory'](_0x554f82)['catch'](loggerCatch('[syncAgentComplete][createHistory][?]'));if(_0x456c58[_0x49c3('0x17f')](_0x200f19[_0x49c3('0xeb')],_0x2a831b,_0x5b4391)){if(_0x554f82[_0x49c3('0x180')]+_0x554f82[_0x49c3('0x18a')]+_0x554f82[_0x49c3('0x181')]+_0x554f82[_0x49c3('0x18d')]+_0x554f82[_0x49c3('0xf7')]+_0x554f82[_0x49c3('0x109')]+_0x554f82[_0x49c3('0x192')]+_0x554f82['countagentrejectretry']>=_0x5b4391[_0x49c3('0x183')]){_0x456c58[_0x49c3('0x1a9')](_0x554f82,_0x52d53f,_0x144b4a,_0x200f19[_0x49c3('0xeb')]);}else{_0x456c58[_0x49c3('0x1a0')](_0x554f82,_0x52d53f,_0x144b4a,_0x200f19['reason']);}}}});};Dialer[_0x49c3('0x19')][_0x49c3('0x1a9')]=function(_0x2dc6c2,_0x504401,_0x356bc6,_0x5a65e3){var _0x4ea142=new Final(_0x2dc6c2);_0x4ea142['state']=0xf;_0x4ea142['statedesc']=_0x49c3('0x1b0');this[_0x49c3('0x1a0')](_0x4ea142,_0x504401,_0x356bc6,_0x5a65e3);};Dialer[_0x49c3('0x19')][_0x49c3('0x1a0')]=function(_0x2b0646,_0xe011ee,_0x5c558d,_0x3f5f4d){this[_0x49c3('0xbd')](_0x2b0646)['then'](function(_0x29817a){return _0xe011ee(msgResponse('[callProgressDetecting]',_0x49c3('0xcd'),_0x3f5f4d));})[_0x49c3('0xa9')](function(_0xf5800d){return _0x5c558d(msgResponse(_0x49c3('0x1b1'),_0x49c3('0x129'),_0x49c3('0x1b2')));});};Dialer['prototype'][_0x49c3('0x8')]=function(_0xd10f2b){var _0x5c272f=this;var _0x475133=_0xd10f2b[_0x49c3('0x1b3')]/0x64;var _0x3914af=_0xd10f2b[_0x49c3('0x61')]/(_0xd10f2b['outboundDropCallsDayTimeout']+_0xd10f2b['outboundAnswerCallsDay']);var _0x595f74=Math[_0x49c3('0x1b4')](_0xd10f2b[_0x49c3('0x6c')]*(_0xd10f2b['predictiveIntervalMaxThreshold']/0x64));var _0xc3f0cb=Math['round'](_0xd10f2b[_0x49c3('0x6c')]*(_0xd10f2b[_0x49c3('0x1b5')]/0x64));var _0x5d415c=_0xd10f2b[_0x49c3('0x1b6')]+_0xd10f2b[_0x49c3('0x52')];var _0x344fac=Math['floor'](_0xd10f2b[_0x49c3('0x6f')]*_0xd10f2b[_0x49c3('0x70')]*_0xd10f2b[_0x49c3('0x6a')]*_0xd10f2b[_0x49c3('0x1b7')]);if(_[_0x49c3('0x39')](_0xd10f2b[_0x49c3('0x28')])){if(!_['isUndefined'](_0xd10f2b[_0x49c3('0x27')])){_0xd10f2b[_0x49c3('0x27')]=undefined;loggerPredictive[_0x49c3('0x8f')](_0x49c3('0x1b8'),'check\x20predictive\x20is\x20not\x20undefine');}if(!_[_0x49c3('0x39')](_0xd10f2b['handlePredictive'])){loggerPredictive[_0x49c3('0x8f')](_0x49c3('0x1b8'),_0x49c3('0x1b9'));clearInterval(_0xd10f2b[_0x49c3('0x8a')]);_0xd10f2b['handlePredictive']=undefined;}_0xd10f2b['startProgressive']=moment()[_0x49c3('0x74')](_0x49c3('0xee'));loggerPredictive['info'](_0xd10f2b[_0x49c3('0x3c')],_0x49c3('0x1ba'),_0xd10f2b['startProgressive']);this['handlePower'](_0xd10f2b,0x1);}else if(ifInterval(_0xd10f2b[_0x49c3('0x1bb')],_0xd10f2b[_0x49c3('0x28')])){this['handlePower'](_0xd10f2b,0x1);loggerPredictiveCalls[_0x49c3('0x78')]('[startMethodPredictive][StartProgressive][Loop]',_0xd10f2b[_0x49c3('0x28')],_0xd10f2b[_0x49c3('0x3c')]);_0xd10f2b[_0x49c3('0x6f')]=0x0;_0xd10f2b[_0x49c3('0x69')]=0x0;}else if(_0x475133<_0x3914af&&_0xd10f2b[_0x49c3('0x1bc')]===_0x49c3('0x1bd')){freeVariablesPredictive(_0xd10f2b);loggerPredictive['info'](_0x49c3('0x1be'),_0x49c3('0x1bf'),_0x3914af,_0x49c3('0x28'),_0xd10f2b['name']);}else if(_0x344fac<_0xd10f2b['predictiveIntervalErlangCallsDroppedCalls']&&_0xd10f2b[_0x49c3('0x1bc')]===_0x49c3('0x1bd')){freeVariablesPredictive(_0xd10f2b);loggerPredictive['info'](_0x49c3('0x1c0'),'Max\x20Drop\x20',_0x344fac,_0x49c3('0x1c1'),_0xd10f2b['predictiveIntervalErlangCallsDroppedCalls'],'startProgressive',_0xd10f2b[_0x49c3('0x3c')]);}else if(!ifInterval(_0xd10f2b['dialPredictiveInterval'],_0xd10f2b[_0x49c3('0x28')])&&_[_0x49c3('0x39')](_0xd10f2b[_0x49c3('0x27')])&&!_[_0x49c3('0x39')](_0xd10f2b[_0x49c3('0x28')])){_0xd10f2b[_0x49c3('0x27')]=moment()[_0x49c3('0x74')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x49c3('0x78')](_0xd10f2b[_0x49c3('0x3c')],_0x49c3('0x1c2'),_0xd10f2b[_0x49c3('0x27')]);this[_0x49c3('0x1c3')](_0xd10f2b['dialPredictiveInterval'])['then'](this[_0x49c3('0x1c4')](_0xd10f2b))['then'](mergeDataErlangB(_0xd10f2b))[_0x49c3('0xb0')](this[_0x49c3('0x1c5')](_0xd10f2b))[_0x49c3('0xa9')](loggerCatchPredictive(_0x49c3('0x1c6'),_0xd10f2b));}else if(!ifInterval(_0xd10f2b['dialPredictiveInterval'],_0xd10f2b[_0x49c3('0x27')])){_0xd10f2b[_0x49c3('0x69')]=0x0;_0xd10f2b[_0x49c3('0x27')]=moment()[_0x49c3('0x74')](_0x49c3('0xee'));loggerPredictive[_0x49c3('0x78')](_0xd10f2b[_0x49c3('0x3c')],_0x49c3('0x1c7'),_0xd10f2b[_0x49c3('0x27')]);clearInterval(_0xd10f2b[_0x49c3('0x8a')]);_0xd10f2b[_0x49c3('0x8a')]=undefined;this[_0x49c3('0x1c3')](_0xd10f2b[_0x49c3('0x1bb')])[_0x49c3('0xb0')](this[_0x49c3('0x1c4')](_0xd10f2b))[_0x49c3('0xb0')](mergeDataErlangB(_0xd10f2b))[_0x49c3('0xb0')](this[_0x49c3('0x1c5')](_0xd10f2b))['catch'](loggerCatchPredictive(_0x49c3('0x1c8'),_0xd10f2b));}else if(_0xd10f2b['predictiveIntervalAvailable']&&_0x5d415c<_0xd10f2b[_0x49c3('0x6c')]-_0xc3f0cb){freeVariablesPredictive(_0xd10f2b);loggerPredictive['info'](_0xd10f2b[_0x49c3('0x3c')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x5d415c,_0x49c3('0x1c9'),_0xd10f2b['predictiveIntervalAvailable'],'-',_0xc3f0cb,'=',_0xd10f2b[_0x49c3('0x6c')]-_0xc3f0cb,')');}else if(_0xd10f2b[_0x49c3('0x6c')]&&_0x5d415c>_0xd10f2b[_0x49c3('0x6c')]+_0x595f74){freeVariablesPredictive(_0xd10f2b);loggerPredictive['info'](_0xd10f2b[_0x49c3('0x3c')],_0x49c3('0x1ca'),_0x5d415c,_0x49c3('0x1cb'),_0xd10f2b[_0x49c3('0x6c')],'+',_0x595f74,'=',_0xd10f2b[_0x49c3('0x6c')]+_0x595f74,')');}};Dialer[_0x49c3('0x19')][_0x49c3('0x1c4')]=function(_0x4f68a6){var _0x2eedea=this;return function(_0x1df3cf){return new BPromise(function(_0xa4b82e,_0x2523df){_[_0x49c3('0x113')](_0x4f68a6,_0x1df3cf[0x0]);if(checkGetDataPredictive(_0x1df3cf[0x0])){var _0x45c23d=_0x4f68a6['predictiveIntervalAvailable']=_0x4f68a6[_0x49c3('0x52')]+_0x4f68a6[_0x49c3('0x1b6')];var _0x3990be=_0x4f68a6[_0x49c3('0x1bb')]*0x3c;var _0xaca038=_0x1df3cf[0x0][_0x49c3('0x66')]+_0x1df3cf[0x0][_0x49c3('0x80')];var _0xd90638=(_0x1df3cf[0x0][_0x49c3('0x7c')]+_0x1df3cf[0x0][_0x49c3('0x67')]+_0x1df3cf[0x0][_0x49c3('0x106')])/_0x1df3cf[0x0]['predictiveIntervalTotalCalls'];_0x4f68a6[_0x49c3('0x6a')]=_0xd90638>0x0?_0xd90638:0x1;switch(_0x4f68a6['dialPredictiveOptimization']){case'dropRate':var _0x2104f8=_0x4f68a6[_0x49c3('0x1b3')]/0x64;return _0x2eedea[_0x49c3('0x1cc')](_0x45c23d,_0x3990be,_0xaca038,_0xd90638,_0x2104f8)['then'](function(_0x323e63){return _0xa4b82e(_0x323e63);});case _0x49c3('0x1cd'):var _0x50053b=_0x4f68a6[_0x49c3('0x1b3')]/0x64;return _0x2eedea[_0x49c3('0x1ce')](_0x45c23d,_0x3990be,_0xaca038,_0xd90638,_0x50053b)[_0x49c3('0xb0')](function(_0x1cfba0){return _0xa4b82e(_0x1cfba0);});default:return _0x2523df(msgResponse(_0x49c3('0x1cf'),_0x49c3('0x129'),_0x49c3('0x1d0')));}}else{return _0x2523df(msgResponse('[getDataPredictive]','Failure',_0x49c3('0x1d1')));}});};};Dialer[_0x49c3('0x19')]['getDataPredictiveOld']=function(_0x3bb86f){var _0x495177=this;return function(_0x57d79e){return new BPromise(function(_0x3f54af,_0x581782){_[_0x49c3('0x113')](_0x3bb86f,_0x57d79e[0x0]);if(checkGetDataPredictive(_0x57d79e[0x0])){loggerPredictive['info'](JSON[_0x49c3('0x45')](_0x57d79e[0x0]));if(_0x3bb86f[_0x49c3('0x1bc')]===_0x49c3('0x1bd')){return _0x495177[_0x49c3('0xbb')](_0x3bb86f['id'])[_0x49c3('0xb0')](function(_0x106c21){var _0x46ce14=_0x3bb86f['loggedIn']-_0x106c21[0x0][_0x49c3('0x1d2')];var _0x4fd26a=_0x3bb86f[_0x49c3('0x1bb')]*0x3c;var _0x5bae34=_0x57d79e[0x0][_0x49c3('0x66')]+_0x57d79e[0x0][_0x49c3('0x80')];var _0x4af048=(_0x57d79e[0x0][_0x49c3('0x7c')]+_0x57d79e[0x0][_0x49c3('0x67')]+_0x57d79e[0x0][_0x49c3('0x106')])/_0x57d79e[0x0][_0x49c3('0x6d')];var _0x2ed732=_0x3bb86f[_0x49c3('0x1b3')]/0x64;_0x3bb86f['predictiveIntervalPauses']=_0x106c21[0x0][_0x49c3('0x1d2')]||0x0;_0x3bb86f['predictiveIntervalHitRate']=_0x4af048>0x0?_0x4af048:0x1;return _0x495177[_0x49c3('0x1cc')](_0x46ce14,_0x4fd26a,_0x5bae34,_0x4af048,_0x2ed732);})[_0x49c3('0xb0')](function(_0x2cdab0){return _0x3f54af(_0x2cdab0);})[_0x49c3('0xa9')](function(_0x43890a){return _0x581782(msgResponse(_0x49c3('0x1d3'),_0x49c3('0x129'),JSON[_0x49c3('0x45')](_0x43890a)));});}if(_0x3bb86f[_0x49c3('0x1bc')]==='agentBusyFactor'){return _0x495177['getVoiceQueueRtPauses'](_0x3bb86f['id'])['then'](function(_0x3367bf){var _0x1dc548=_0x3bb86f['loggedIn']-_0x3367bf[0x0][_0x49c3('0x1d2')];var _0x269c3a=_0x3bb86f[_0x49c3('0x1bb')]*0x3c;var _0xb76569=_0x57d79e[0x0][_0x49c3('0x66')]+_0x57d79e[0x0][_0x49c3('0x80')];var _0x8c7954=(_0x57d79e[0x0]['predictiveIntervalAnsweredCalls']+_0x57d79e[0x0][_0x49c3('0x67')]+_0x57d79e[0x0][_0x49c3('0x106')])/_0x57d79e[0x0][_0x49c3('0x6d')];var _0x4fbd93=_0x3bb86f[_0x49c3('0x1b3')]/0x64;_0x3bb86f[_0x49c3('0x6b')]=_0x3367bf[0x0][_0x49c3('0x1d2')]||0x0;_0x3bb86f[_0x49c3('0x6a')]=_0x8c7954>0x0?_0x8c7954:0x1;return _0x495177[_0x49c3('0x1ce')](_0x1dc548,_0x269c3a,_0xb76569,_0x8c7954,_0x4fbd93);})[_0x49c3('0xb0')](function(_0xae3c3e){return _0x3f54af(_0xae3c3e);})[_0x49c3('0xa9')](function(_0x3e7200){return _0x581782(msgResponse(_0x49c3('0x1d3'),_0x49c3('0x129'),JSON[_0x49c3('0x45')](_0x3e7200)));});}}else{return _0x581782(msgResponse('[getDataPredictive]','Failure',_0x49c3('0x1d1')));}});};};Dialer[_0x49c3('0x19')][_0x49c3('0x1c5')]=function(_0x2d3865){var _0x59dd20=this;return function(){var _0x152efb=0x0;var _0x393b01=Math[_0x49c3('0x1d4')](_0x2d3865['erlangCallToSecond']*0x3e8);if(_0x393b01>0x0){_0x393b01=_0x393b01<0x64?0x64:_0x393b01;loggerPredictive[_0x49c3('0x78')](_0x2d3865['name'],_0x49c3('0x1d5'),_0x393b01,'milliseconds');_0x2d3865[_0x49c3('0x8a')]=setInterval(function(){_0x59dd20[_0x49c3('0x8a')](_0x2d3865);loggerPredictiveCalls[_0x49c3('0x78')](_0x49c3('0x1d6'),_0x152efb+=0x1);},_0x393b01);}else{loggerPredictive[_0x49c3('0x78')](_0x2d3865[_0x49c3('0x3c')],'fail\x20to\x20scheduled\x20calls');}};};Dialer['prototype'][_0x49c3('0x1d7')]=function(_0x133e24,_0x30d623){var _0x551406=this;return function(_0x38993f){if(_['isEmpty'](_0x38993f)){if(_['isNil'](_0x30d623[_0x49c3('0x1d8')])||!_0x30d623[_0x49c3('0x1d9')]){if(_0x133e24[_0x49c3('0x57')]===_0x49c3('0x7')){_0x133e24[_0x49c3('0x114')]=_['isUndefined'](_0x133e24[_0x49c3('0x114')])?!![]:_0x133e24[_0x49c3('0x114')];var _0x1a5657=uuid['v4']();_0x551406[_0x49c3('0x10e')][_0x1a5657]=new Action(_0x133e24,_0x30d623,_0x1a5657);loggerBooked[_0x49c3('0x78')](_0x49c3('0x1da'),_0x1a5657,'queueStatusComplete:\x20',JSON[_0x49c3('0x45')](_0x133e24[_0x49c3('0x114')]),_0x49c3('0x1db'),_0x133e24['name']);if(_0x133e24[_0x49c3('0x114')]){_0x133e24[_0x49c3('0x114')]=![];_0x551406['queueBooked'][_0x551406['actions'][_0x1a5657][_0x49c3('0xad')]]=[];ami[_0x49c3('0x132')]({'actionid':_0x1a5657,'action':_0x49c3('0x1dc'),'queue':_0x133e24[_0x49c3('0x3c')]})['catch'](function(_0x2b4c8a){_0x551406['updateOriginated'](_0x133e24);_0x551406[_0x49c3('0xb7')]({'active':![],'ContactId':_0x551406['actions'][_0x1a5657][_0x49c3('0xc6')],'ListId':_0x551406['actions'][_0x1a5657]['ListId'],'VoiceQueueId':_0x551406[_0x49c3('0x10e')][_0x1a5657][_0x49c3('0xc8')]||undefined,'CampaignId':_0x551406[_0x49c3('0x10e')][_0x1a5657][_0x49c3('0xc9')]||undefined})[_0x49c3('0xa9')](loggerCatch(_0x49c3('0x1dd')));delete _0x551406[_0x49c3('0x10e')][_0x1a5657];});}else{loggerBooked[_0x49c3('0x78')](_0x49c3('0x1de'),JSON[_0x49c3('0x45')](_0x133e24['queueStatusComplete']),_0x49c3('0x1db'),_0x133e24[_0x49c3('0x3c')]);_0x551406[_0x49c3('0xab')](_0x133e24);_0x551406['rescheduleContact']({'active':![],'ContactId':_0x551406[_0x49c3('0x10e')][_0x1a5657][_0x49c3('0xc6')],'ListId':_0x551406[_0x49c3('0x10e')][_0x1a5657][_0x49c3('0xc7')],'VoiceQueueId':_0x551406[_0x49c3('0x10e')][_0x1a5657][_0x49c3('0xc8')]||undefined,'CampaignId':_0x551406[_0x49c3('0x10e')][_0x1a5657]['CampaignId']||undefined})[_0x49c3('0xa9')](loggerCatch(_0x49c3('0x1dd')));delete _0x551406[_0x49c3('0x10e')][_0x1a5657];}}else{return _0x551406[_0x49c3('0x14e')](_0x133e24,_0x30d623);}}else{if(getDiff(_0x30d623[_0x49c3('0x1df')])<_0x133e24[_0x49c3('0x1e0')]*0x3c){if(_0x30d623[_0x49c3('0x1e1')]&&!_0x30d623[_0x49c3('0x1e1')][_0x49c3('0x1e2')]){_0x551406[_0x49c3('0x1e')][_0x49c3('0x115')](_0x30d623['id'])[_0x49c3('0x1c')](function(){_0x551406[_0x49c3('0xab')](_0x133e24);});}else{_0x551406['unlockContact']({'active':![]},_0x30d623['id'],0x1)[_0x49c3('0x1c')](function(){console['log'](_0x49c3('0x1e3'));_0x551406['updateOriginated'](_0x133e24);});}}else{_0x133e24[_0x49c3('0x64')]+=0x1;_0x551406[_0x49c3('0xab')](_0x133e24);if(_0x133e24['dialRecallInQueue']){_0x551406['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0x30d623[_0x49c3('0xc6')],'ListId':_0x30d623['ListId'],'VoiceQueueId':_0x30d623[_0x49c3('0xc8')]||undefined,'CampaignId':_0x30d623['CampaignId']||undefined})[_0x49c3('0xa9')](loggerCatch(_0x49c3('0x1e4')));_0x551406[_0x49c3('0xbf')](createObjHistory(_0x133e24,_0x30d623,_0x49c3('0x1e5'),0x17,'RecallInQueue'))['catch'](loggerCatch(_0x49c3('0x1e6')));}else{_0x551406[_0x49c3('0xc4')](createObjHistory(_0x133e24,_0x30d623,'RECALLFAILEDTIMEOUT',0x16,_0x49c3('0x1e7')),_0x49c3('0x1e8'),'[Originate][HistoryRecallClose]');}}}}else{_0x133e24[_0x49c3('0x1e9')]+=0x1;_0x551406['saveInDb'](createObjHistory(_0x133e24,_0x30d623,_0x49c3('0x1ea'),0xd,'Blacklist'),_0x49c3('0x1eb'),'[Originate][MoveBlacklist]');throw'inBlackList';}};};Dialer[_0x49c3('0x19')][_0x49c3('0x145')]=function(_0x581637){var _0x235f8b=this;var _0x58fbd4=[];var _0x40bdc5=_0x581637[_0x49c3('0x1ec')]-_0x581637[_0x49c3('0x6e')]-_0x581637['temp'];emitCampaignSummary(_0x581637);if(_0x40bdc5>0x0){if(_0x40bdc5>this[_0x49c3('0x23')]){_0x40bdc5=this['maxNumberOriginate'];}_0x581637[_0x49c3('0x1ed')]+=_0x40bdc5;this[_0x49c3('0xba')](_0x581637['id'],_0x40bdc5,_0x581637['dialOrderByScheduledAt'])[_0x49c3('0xb0')](function(_0x397b4e){_0x581637[_0x49c3('0x1ed')]-=_0x40bdc5;_0x581637['temp']=_0x581637['temp']>0x0?_0x581637[_0x49c3('0x1ed')]:0x0;if(!checkContactEmpty(_0x397b4e)){_0x581637[_0x49c3('0x3f')]='AVAILABLE_CONTACTS_FINISHED';logger[_0x49c3('0x78')]('[getContactCampaign2][Empty]'+_0x581637[_0x49c3('0x3c')]);}else{_0x581637[_0x49c3('0x6e')]+=_0x397b4e[_0x49c3('0x91')];_0x581637[_0x49c3('0x3f')]=_0x49c3('0x1ee');for(var _0x1bc2ce=0x0;_0x1bc2ce<_0x397b4e[_0x49c3('0x91')];_0x1bc2ce+=0x1){_0x581637['ivrTotalCallsDays']+=0x1;if(_['isNil'](_0x397b4e[_0x1bc2ce])||_[_0x49c3('0xa7')](_0x397b4e[_0x1bc2ce][_0x49c3('0x152')])||_[_0x49c3('0xa7')](_0x397b4e[_0x1bc2ce][_0x49c3('0x152')][_0x49c3('0x153')])){_0x235f8b[_0x49c3('0xc2')](_0x49c3('0x1ef'),_0x581637,_0x397b4e[_0x1bc2ce]);}else{_0x235f8b[_0x49c3('0xb3')](_['pick'](_0x397b4e[_0x1bc2ce],['CampaignId',_0x49c3('0x1f0')]))['then'](_0x235f8b[_0x49c3('0x1d7')](_0x581637,_0x397b4e[_0x1bc2ce]))[_0x49c3('0xa9')](_0x235f8b[_0x49c3('0xc1')](_0x49c3('0x1f1'),_0x581637));}}}})[_0x49c3('0xa9')](loggerGetContactDialer(_0x49c3('0x1f2'),_0x581637,_0x40bdc5));}};Dialer[_0x49c3('0x19')][_0x49c3('0x140')]=function(_0x176ab3,_0x381939){var _0x120423=this;var _0x3fdff7=[];var _0x47c043=_0x381939>=0x1?_0x381939:0x1;var _0x376216=[];if(_0x176ab3[_0x49c3('0x57')]===_0x49c3('0x7')){_0x47c043=0x1;}var _0x599cac=Math['floor'](_0x176ab3[_0x49c3('0x1b6')]*_0x47c043)-_0x176ab3[_0x49c3('0x6e')]-_0x176ab3[_0x49c3('0x1ed')];emitVoiceQueueSummary(_0x176ab3);if(_0x176ab3[_0x49c3('0x1f3')]>0x0){var _0x3bc586=_0x176ab3['dialLimitQueue']-_0x176ab3[_0x49c3('0x6e')]-_0x176ab3['talking']-_0x176ab3[_0x49c3('0x1ed')]-_0x176ab3['pTalking'];if(_0x599cac>_0x3bc586){_0x599cac=_0x3bc586;}}if(_0x599cac>0x0){if(_0x176ab3[_0x49c3('0x57')]===_0x49c3('0x7')){_0x599cac=0x1;}if(_0x599cac>this[_0x49c3('0x23')]){_0x599cac=this[_0x49c3('0x23')];}_0x176ab3[_0x49c3('0x1ed')]+=_0x599cac;for(var _0x70c7ad in this['agents']){if(this[_0x49c3('0x21')]['hasOwnProperty'](_0x70c7ad)){if(this[_0x49c3('0x21')][_0x70c7ad][_0x49c3('0xa0')]===_0x49c3('0x1f4')&&this[_0x49c3('0x21')][_0x70c7ad]['status']===_0x49c3('0xd1')){_0x3fdff7[_0x49c3('0x131')](this[_0x49c3('0x21')][_0x70c7ad]['id']);}}}this['getContactDialer'](_0x176ab3['id'],_0x3fdff7,_0x599cac,_0x176ab3['dialOrderByScheduledAt'])['then'](function(_0x4422c2){_0x176ab3[_0x49c3('0x1ed')]-=_0x599cac;_0x176ab3[_0x49c3('0x1ed')]=_0x176ab3['temp']>0x0?_0x176ab3[_0x49c3('0x1ed')]:0x0;if(!checkContactEmpty(_0x4422c2)){_0x120423[_0x49c3('0xae')](_0x176ab3)[_0x49c3('0xb0')](sendMessageReschedule(_0x176ab3))[_0x49c3('0xa9')](loggerCatch(_0x49c3('0xb1')));}else{_0x176ab3[_0x49c3('0x6e')]+=_0x4422c2[_0x49c3('0x91')];_0x176ab3[_0x49c3('0x3f')]=_0x176ab3['dialMethod']===_0x49c3('0x7')?'ACTIVE':_0x49c3('0x1ee');for(var _0x3ad3ca=0x0;_0x3ad3ca<_0x4422c2[_0x49c3('0x91')];_0x3ad3ca+=0x1){if(_[_0x49c3('0xa7')](_0x4422c2[_0x3ad3ca])||_['isNil'](_0x4422c2[_0x3ad3ca][_0x49c3('0x152')])||_[_0x49c3('0xa7')](_0x4422c2[_0x3ad3ca]['Contact'][_0x49c3('0x153')])){_0x120423[_0x49c3('0xc2')](_0x49c3('0x1ef'),_0x176ab3,_0x4422c2[_0x3ad3ca]);}else{_0x120423[_0x49c3('0x1f5')](_[_0x49c3('0xc5')](_0x4422c2[_0x3ad3ca],[_0x49c3('0xc8'),_0x49c3('0x1f0')]))['then'](_0x120423[_0x49c3('0x1d7')](_0x176ab3,_0x4422c2[_0x3ad3ca]))['catch'](_0x120423[_0x49c3('0xc1')](_0x49c3('0x1ef'),_0x176ab3));}}}})[_0x49c3('0xa9')](loggerGetContactDialer(_0x49c3('0x1f6'),_0x176ab3,_0x599cac));}};Dialer['prototype']['handlePredictive']=function(_0x465920){var _0x8153d2=this;if(_0x465920[_0x49c3('0x1f3')]>0x0){var _0x495786=_0x465920[_0x49c3('0x1f3')]-_0x465920[_0x49c3('0x6e')]-_0x465920[_0x49c3('0x52')];if(_0x495786>0x0){this[_0x49c3('0x1f7')](_0x465920);}else{loggerPredictiveCalls[_0x49c3('0x78')](_0x49c3('0x1f8'));}}else{this[_0x49c3('0x1f7')](_0x465920);}};Dialer[_0x49c3('0x19')]['tryOriginatePredictive']=function(_0x1947ad){var _0x61876c=this;var _0x41b3fc=[];_0x1947ad[_0x49c3('0x6e')]+=0x1;for(var _0x57f1f1 in this['agents']){if(this['agents'][_0x49c3('0x92')](_0x57f1f1)){if(this['agents'][_0x57f1f1][_0x49c3('0xa0')]===_0x49c3('0x1f4')&&this[_0x49c3('0x21')][_0x57f1f1][_0x49c3('0xd0')]==='reachable'){_0x41b3fc[_0x49c3('0x131')](this['agents'][_0x57f1f1]['id']);}}}this['getContactDialer'](_0x1947ad['id'],_0x41b3fc,0x1,_0x1947ad['dialOrderByScheduledAt'])['then'](function(_0x378120){if(!checkContactEmpty(_0x378120)){checkContactLowerLimitOriginate(_0x1947ad,0x1,0x0);_0x61876c[_0x49c3('0xae')](_0x1947ad)['then'](sendMessageReschedule(_0x1947ad))[_0x49c3('0xa9')](loggerCatch(_0x49c3('0xb1')));}else{_0x1947ad[_0x49c3('0x3f')]=_0x49c3('0x1ee');if(_[_0x49c3('0xa7')](_0x378120[0x0])||_['isNil'](_0x378120[0x0]['Contact'])||_[_0x49c3('0xa7')](_0x378120[0x0][_0x49c3('0x152')][_0x49c3('0x153')])){_0x61876c[_0x49c3('0xc2')]('[actionOriginate]\x20',_0x1947ad,_0x378120[0x0]);}else{_0x61876c['checkIsBlackList'](_[_0x49c3('0xc5')](_0x378120[0x0],['VoiceQueueId',_0x49c3('0x1f0')]))[_0x49c3('0xb0')](_0x61876c['checkContactBlack'](_0x1947ad,_0x378120[0x0]))['catch'](_0x61876c['loggerHandler'](_0x49c3('0x1f9'),_0x1947ad));}}})[_0x49c3('0xa9')](loggerGetContactDialer('[getContactDialerPredictive]',_0x1947ad,0x1));emitVoiceQueueSummary(_0x1947ad);};Dialer[_0x49c3('0x19')]['abandonmentRate']=function(_0x48c591,_0x433c4c,_0x2ee436,_0x3900f0,_0x2ef359,_0x4dc679){loggerPredictive['info'](_0x49c3('0x1fa'));loggerPredictive[_0x49c3('0x78')]('M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x48c591);loggerPredictive['info'](_0x49c3('0x1fb'),_0x433c4c);loggerPredictive['info'](_0x49c3('0x1fc'),_0x2ee436);loggerPredictive[_0x49c3('0x78')]('P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3900f0);loggerPredictive[_0x49c3('0x78')](_0x49c3('0x1fd'),_0x2ef359);loggerPredictive[_0x49c3('0x78')](_0x49c3('0x1fe'));return new BPromise(function(_0x36477e,_0x4d6b68){if(_0x48c591<=0x0||isNaN(_0x48c591)){return _0x4d6b68(msgResponse(_0x49c3('0x1ff'),_0x49c3('0x44'),_0x49c3('0x200')+_0x48c591));}if(_0x2ee436<=0x0||isNaN(_0x2ee436)){return _0x4d6b68(msgResponse(_0x49c3('0x1ff'),_0x49c3('0x44'),'Ts\x20=\x20'+_0x2ee436));}if(_0x3900f0<=0x0||isNaN(_0x3900f0)){return _0x4d6b68(msgResponse(_0x49c3('0x1ff'),'Error',_0x49c3('0x201')+_0x3900f0));}if(_0x433c4c<=0x0||isNaN(_0x433c4c)){return _0x4d6b68(msgResponse(_0x49c3('0x1ff'),_0x49c3('0x44'),_0x49c3('0x202')+_0x433c4c));}if(_0x2ef359<=0x0||isNaN(_0x2ef359)){return _0x4d6b68(msgResponse(_0x49c3('0x1ff'),_0x49c3('0x44'),_0x49c3('0x203')+_0x2ef359));}_0x4dc679=_0x4dc679||0x0;var _0x12a374=0x1/_0x2ee436;var _0xdbea88=0x0;var _0x1aa40c=0x0;var _0x4f537e=0x0;var _0x450bfb=0x0;for(var _0x5a477f=0x0;_0x4f537e<_0x2ef359;_0x5a477f+=0x1){_0x1aa40c=_0x5a477f/_0x433c4c;_0xdbea88=(_0x3900f0*_0x1aa40c+_0x4dc679)/_0x12a374;_0x4f537e=erlangb(_0xdbea88,_0x48c591);_0x450bfb=_0xdbea88/_0x48c591*(0x1-erlangb(_0xdbea88,_0x48c591));}return _0x36477e({'erlangCalls':_0x5a477f,'erlangCallToSecond':_0x433c4c/_0x5a477f,'erlangAbandonmentRate':_0x4f537e,'erlangBusyFactor':_0x450bfb});});};Dialer['prototype'][_0x49c3('0x1ce')]=function(_0x5b85eb,_0x307741,_0x39c5c7,_0x6f9a4,_0x2b4f03,_0xb8cdbc){loggerPredictive[_0x49c3('0x78')](_0x49c3('0x204'));loggerPredictive[_0x49c3('0x78')](_0x49c3('0x205'),_0x5b85eb);loggerPredictive[_0x49c3('0x78')](_0x49c3('0x1fb'),_0x307741);loggerPredictive[_0x49c3('0x78')](_0x49c3('0x1fc'),_0x39c5c7);loggerPredictive[_0x49c3('0x78')](_0x49c3('0x206'),_0x6f9a4);loggerPredictive[_0x49c3('0x78')](_0x49c3('0x207'),_0x2b4f03);loggerPredictive[_0x49c3('0x78')](_0x49c3('0x1fe'));return new BPromise(function(_0x4f6669,_0xb80cda){if(_0x5b85eb<=0x0||isNaN(_0x5b85eb)){return _0xb80cda(msgResponse(_0x49c3('0x208'),_0x49c3('0x44'),'m\x20=\x20'+_0x5b85eb));}if(_0x39c5c7<=0x0||isNaN(_0x39c5c7)){return _0xb80cda(msgResponse('[busyFactor]','Error',_0x49c3('0x209')+_0x39c5c7));}if(_0x6f9a4<=0x0||isNaN(_0x6f9a4)){return _0xb80cda(msgResponse(_0x49c3('0x208'),_0x49c3('0x44'),_0x49c3('0x201')+_0x6f9a4));}if(_0x307741<=0x0||isNaN(_0x307741)){return _0xb80cda(msgResponse(_0x49c3('0x208'),_0x49c3('0x44'),_0x49c3('0x202')+_0x307741));}if(_0x2b4f03<=0x0||isNaN(_0x2b4f03)){return _0xb80cda(msgResponse(_0x49c3('0x208'),'Error',_0x49c3('0x20a')+_0x2b4f03));}_0xb8cdbc=_0xb8cdbc||0x0;var _0x69b08c=0x1/_0x39c5c7;var _0x6cc54f=0x0;var _0x409553=0x0;var _0x4599d1=0x0;var _0x3e2a24=0x0;for(var _0x5f1d91=0x0;_0x3e2a24<_0x2b4f03;_0x5f1d91+=0x1){_0x409553=_0x5f1d91/_0x307741;_0x6cc54f=(_0x6f9a4*_0x409553+_0xb8cdbc)/_0x69b08c;_0x4599d1=erlangb(_0x6cc54f,_0x5b85eb);_0x3e2a24=_0x6cc54f/_0x5b85eb*(0x1-erlangb(_0x6cc54f,_0x5b85eb));}return _0x4f6669({'erlangCalls':_0x5f1d91,'erlangCallToSecond':_0x307741/_0x5f1d91,'erlangAbandonmentRate':_0x4599d1,'erlangBusyFactor':_0x3e2a24});});};module[_0x49c3('0x20b')]=Dialer; \ No newline at end of file +var _0x70e0=['\x22\x22\x20<>','inspect','stack','error','[decremetOriginate]\x20is\x20null\x20or\x20undefined','RESCHEDULED_CONTACTS','contactsRescheduled','contacts','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','NOT_ACTIVE','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','IS_DISACTIVED','is\x20disactive','state','statedesc','endtime','starttime','prototype','uniqueId','[uniqueid]','clearZombieChannels','actions','[actions]','hasOwnProperty','sequence','isNil','Action','status','catch','No\x20such\x20channel','updateOriginated','queue','[Dialer][checkChannel][ivr]','countReScheduled','resolve','then','[countReScheduled]\x20','checkIsBlackList','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','averageHandleTime','rescheduleContact','[rescheduleContact]\x20','unlockContact','getContactDialer','[getContactDialer]\x20','getContactDialerIvr','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','createHistory','[createHistory]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','saveInDb','ContactId','UserId','VoiceQueueId','CampaignId','[emptyContact][createHistory]','[emptyContact]','Success','isTrunkReachable','SIP/%s','reachable','moveContactManagedDialer','variable','amdstatus','exten','xcally-motion-dialer','dialAMDActive','value','HANGUP','uniqueid','AMD','[syncHangupInAMD][createHistory]','MACHINE','membername','[syncMachine][createHistory]','[syncMachine]','HangupInAMD','[syncHangupInAMDIvr]','Machine','[syncMachineIvr]','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','dialQueueProject','outboundUnknownCallsDay','cause-txt','Unknow','[syncHangupIvr]','agent','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','YYYY-MM-DD\x20HH:mm:ss','[syncAgentComplete]','answertime','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','droptime','dialQueueTimeout','outboundDropCallsDayTimeout','Drop','dropreason','countdropretry','countglobal','dialDropMaxRetry','add','dialDropRetryFrequency','minutes','calleridname','calleridnum','log','CRIS\x20evt\x2010.3','CRIS\x20queueCallerAbandon\x2010.3','CRIS\x20createHistory\x2010.3','[syncAgentComplete][createHistory][10]','outboundDropCallsDayCallersExit','Abandoned','CALLEREXIT','countabandonedretry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','ListId','[rescheduleContact][Abandoned]','CRIS\x20createHistory\x2011','[syncAgentComplete][createHistory][11]','channel','actionid','roundrobin','locked','paused','stateinterface','rrmemory','pick','idHopper','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','run','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','queueBookedRR','length','_rr','unlockRR','Agent:\x20','[booked][RR][finaly]','contactAgent-idHopper:\x20','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','loopCampaigns','checkIsTrunkReachable','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','checkIfTimeIntervals','ifTime','Failure','INTERVAL_IS_EMPTY','\x20Intervals\x20is\x20empty\x20','TIMEZONE_UNKNOW','iftime\x20%s,%s','interval','timezones','indexOf','true','push','command','content','all','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','checkDialMethod','progressive','handlePower','power','dialPowerLevel','predictive','booked','Queue','launchHandleIvr','handleIvr','dialActive','dialGlobalInterval','dialTimezone','[syncQueueSummary]','syncCampaigns','[syncCampaigns]','\x5cw{0,','pow','replace','random','match','actionOriginate','originate','voiceQueue\x20is\x20undefine','Contact','phone','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialer','ACTIVE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','outbound','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','createdAt','updatedAt','%s%s','XMD-','toUpper','dialRandomLastDigitCallerIdNumber','TrunkBackup','XMD-ORIGINATECALLERIDNAME','originatecalleridname','originatecalleridnum','dialCutDigit','substring','trim','from-sip','dialOriginateTimeout','[originateError]:\x20%s','OriginateError','[originate][error]','originate\x20action\x20Error','responsetime','getQueue','response','[callProgressDetecting]\x20','checkRetriveMax','countbusyretry','countnoanswerretry','countnosuchnumberretry','countmachineretry','countagentrejectretry','dialGlobalMaxRetry','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','countcongestionretry','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','callProgressDetecting','object','entity\x20is\x20undefine','[callProgressDetecting]','evt\x20is\x20undefine','NoSuchNumber','[syncAgentComplete][createHistory][0]','stateGlobal','createStateFinal','reason\x200\x20no\x20such\x20number....','NoAnswer','[syncAgentComplete][createHistory][3]','dialNoAnswerMaxRetry','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','[syncAgentComplete][createHistory][20]','dialAgentRejectMaxRetry','reason\x2020\x20agentreject','reason','[syncAgentComplete][createHistory][?]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalMinThreshold','floor','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dropRate','Dropped\x20calls\x20day','predictiveIntervalErlangCallsDroppedCalls','dialPredictiveOptimization','Max\x20Drop\x20','started\x20in\x20predictive\x20at','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','abandonmentRate','agentBusyFactor','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','outboundQueuePauses','[CatchErlangB]','one\x20call\x20every:','[handlePredictive]','checkContactBlack','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','scheduledat','dialRecallMeTimeout','Agent','voicePause','Contact\x20updated','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','limitCalls','temp','dialOrderByScheduledAt','RUNNING','ivrTotalCallsDays','[actionOriginate]\x20','dialLimitQueue','pTalking','not_inuse','[getContactDialer2]','[handlePredictive][limitChannel]','tryOriginatePredictive','Contact.phone','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\x20=\x20','p\x20=\x20','----\x20Agent\x20Busy\x20Factor\x20----','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','Ts\x20=\x20','interval\x20=\x20','Umin\x20=\x20','exports','util','lodash','bluebird','md5','ioredis','../../../config/environment/','../../../config/logger','syncQueueSummary','../ami','redis','defaults','localhost','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','./action','./history','./final','./agentComplete','./queueCallerAbandon','./hangup','127.0.0.1','enqueue','tail','finally','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','optionPredictive','startPredictive','startProgressive','queueBooked','agentconnect','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','agentcomplete','syncAgentComplete','syncHangup','newexten','syncNewExten','syncVarSet','queuemember','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopClearZombieChannels','isUndefined','message','AGENTS_NOT_LOGGED','name','Interval','INTERVAL_IS_NULL','Intervals','\x20INTERVAL_IS_NULL','isEmpty','[ifTime][Action]','Error','milliseconds','diff','seconds','emit','type','strategy','available','loggedIn','sumBillable','sumHoldTime','talking','total','unmanaged','waiting','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundCongestionCallsDay','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalHitRate','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangBusyFactor','Trunk','active','callerid','stringify','voice:queue:%s','voice_queue:save','ivr','format','campaign:ivr:%s','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgHoldtime','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCallToSecond','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangAbandonmentRate','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','merge','clearing\x20variable\x20start\x20progressive','clearing\x20variable\x20start\x20predictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','preview','string','\x22%s\x22\x20<%s>'];(function(_0xb2106d,_0x274ec7){var _0x1db696=function(_0x398a6d){while(--_0x398a6d){_0xb2106d['push'](_0xb2106d['shift']());}};_0x1db696(++_0x274ec7);}(_0x70e0,0x17b));var _0x070e=function(_0x622fbd,_0x580312){_0x622fbd=_0x622fbd-0x0;var _0x5c71d2=_0x70e0[_0x622fbd];return _0x5c71d2;};'use strict';var util=require(_0x070e('0x0'));var _=require(_0x070e('0x1'));var BPromise=require(_0x070e('0x2'));var uuid=require('uuid');var moment=require('moment');var rr=require('rr');var md5=require(_0x070e('0x3'));var Redis=require(_0x070e('0x4'));var config=require(_0x070e('0x5'));var logger=require(_0x070e('0x6'))('dialer');var loggerBooked=require(_0x070e('0x6'))('booked');var loggerPredictive=require(_0x070e('0x6'))('predictive');var loggerPredictiveCalls=require('../../../config/logger')('predictiveCalls');var loggerSyncQueueSummary=require(_0x070e('0x6'))(_0x070e('0x7'));var ami=require(_0x070e('0x8'));config[_0x070e('0x9')]=_[_0x070e('0xa')](config[_0x070e('0x9')],{'host':_0x070e('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var cmHopper=require(_0x070e('0xc'));var cmHopperFinal=require(_0x070e('0xd'));var cmHopperHistory=require(_0x070e('0xe'));var cmHopperBlack=require(_0x070e('0xf'));var voiceQueueRt=require(_0x070e('0x10'));var Action=require(_0x070e('0x11'));var History=require(_0x070e('0x12'));var Final=require(_0x070e('0x13'));var AgentComplete=require(_0x070e('0x14'));var QueueCallerAbandon=require(_0x070e('0x15'));var Hangup=require(_0x070e('0x16'));var ipAgi=process['env']['XCALLY_IP_AGI']||_0x070e('0x17');var strategy={'rrmemory':'rrmemory','roundrobin':'roundrobin'};var Sequence=function(){};Sequence['prototype'][_0x070e('0x18')]=function(_0x14c3fd){this['tail']=this['tail']?this[_0x070e('0x19')][_0x070e('0x1a')](_0x14c3fd):_0x14c3fd();};function Dialer(_0x180897,_0x19d9da){this['sequence']=new Sequence();this['preview']=_0x19d9da;this[_0x070e('0x1b')]=_0x180897[_0x070e('0x1b')];this[_0x070e('0x1c')]=_0x180897[_0x070e('0x1c')];this[_0x070e('0x1d')]=_0x180897['agents'];this[_0x070e('0x1e')]=_0x180897[_0x070e('0x1e')];this[_0x070e('0x1f')]=config[_0x070e('0x1f')]||0x2;this[_0x070e('0x20')]={};this['actions']={};this['contactsId']={};this['uniqueId']={};this[_0x070e('0x21')]={};this[_0x070e('0x22')]={};this[_0x070e('0x23')]={};this['ivrOriginated']={};this[_0x070e('0x24')]={};this['queueBookedRR']={};ami['on'](_0x070e('0x25'),this[_0x070e('0x26')][_0x070e('0x27')](this));ami['on'](_0x070e('0x28'),this[_0x070e('0x29')][_0x070e('0x27')](this));ami['on'](_0x070e('0x2a'),this[_0x070e('0x2b')]['bind'](this));ami['on'](_0x070e('0x2c'),this[_0x070e('0x2d')][_0x070e('0x27')](this));ami['on']('custom:queuesummary',this[_0x070e('0x7')]['bind'](this));ami['on']('hangup',this[_0x070e('0x2e')][_0x070e('0x27')](this));ami['on'](_0x070e('0x2f'),this[_0x070e('0x30')][_0x070e('0x27')](this));ami['on']('varset',this[_0x070e('0x31')][_0x070e('0x27')](this));ami['on'](_0x070e('0x32'),this[_0x070e('0x33')][_0x070e('0x27')](this));ami['on'](_0x070e('0x34'),this[_0x070e('0x35')][_0x070e('0x27')](this));this['loopCampaigns']();this[_0x070e('0x36')]();}function isNotNull(_0x351641){return _0x351641!==null&&!_[_0x070e('0x37')](_0x351641);}function checkIsLoggedIn(_0x56fc12,_0x5c5f0d){return function(){if(_0x5c5f0d<=0x0){_0x56fc12[_0x070e('0x38')]=_0x070e('0x39');throw _0x56fc12[_0x070e('0x3a')]+'\x20AGENTS\x20NOT\x20LOGGED';}};}function isActive(_0x3fa994){return _0x3fa994;}function checkIsActive(_0x1741a1,_0x3a9425){return function(){if(!isActive(_0x3a9425)){_0x1741a1[_0x070e('0x38')]='NOT_ACTIVE';throw _0x1741a1['name']+'\x20NOT\x20Active';}};}function checkInterval(_0x59c5b4){return function(){if(!isNotNull(_0x59c5b4[_0x070e('0x3b')])){_0x59c5b4['message']=_0x070e('0x3c');throw _0x59c5b4[_0x070e('0x3a')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_0x59c5b4['Interval'][_0x070e('0x3d')])){_0x59c5b4[_0x070e('0x38')]='INTERVAL_IS_NULL';throw _0x59c5b4['name']+_0x070e('0x3e');}if(!isNotNull(_[_0x070e('0x3f')](_0x59c5b4[_0x070e('0x3b')][_0x070e('0x3d')]))){_0x59c5b4[_0x070e('0x38')]='INTERVAL_IS_NULL';throw _0x59c5b4['name']+_0x070e('0x3e');}};}function msgResponse(_0x3011c4,_0x4bb439,_0xf57ed){return{'action':_0x3011c4,'response':_0x4bb439,'message':_0xf57ed,'stack':_0xf57ed};}function myreject(_0xf11439){return function(_0x4deaf8){return _0xf11439(msgResponse(_0x070e('0x40'),_0x070e('0x41'),JSON['stringify'](_0x4deaf8)));};}function getSeconds(_0x2d6bb6,_0x34746e){var _0x4ba6f0=moment(_0x2d6bb6)['milliseconds'](0x0);var _0x5ddbe9=moment(_0x34746e)[_0x070e('0x42')](0x0);return _0x4ba6f0[_0x070e('0x43')](_0x5ddbe9,_0x070e('0x44'));}function emit(_0x334733,_0x33c5f8,_0x5e3827){io['to'](_0x334733)[_0x070e('0x45')](_0x33c5f8,_0x5e3827);}function emitVoiceQueueSummary(_0xa1bb20){if(_0xa1bb20[_0x070e('0x46')]==='outbound'){var _0x268c5d={'id':_0xa1bb20['id'],'name':_0xa1bb20[_0x070e('0x3a')],'strategy':_0xa1bb20[_0x070e('0x47')],'answered':_0xa1bb20['answered'],'available':_0xa1bb20[_0x070e('0x48')],'loggedIn':_0xa1bb20[_0x070e('0x49')],'pTalking':_0xa1bb20['pTalking'],'sumBillable':_0xa1bb20[_0x070e('0x4a')],'sumDuration':_0xa1bb20['sumDuration'],'sumHoldTime':_0xa1bb20[_0x070e('0x4b')]||0x0,'talking':_0xa1bb20[_0x070e('0x4c')],'total':_0xa1bb20[_0x070e('0x4d')],'type':_0xa1bb20[_0x070e('0x46')],'unmanaged':_0xa1bb20[_0x070e('0x4e')],'abandoned':_0xa1bb20['abandoned'],'waiting':_0xa1bb20[_0x070e('0x4f')],'loggedInDb':_0xa1bb20['loggedInDb'],'dialActive':_0xa1bb20['dialActive'],'dialMethod':_0xa1bb20[_0x070e('0x50')],'dialOriginateCallerIdName':_0xa1bb20[_0x070e('0x51')],'dialOriginateCallerIdNumber':_0xa1bb20[_0x070e('0x52')],'dialOriginateTimeout':_0xa1bb20['dialOriginateTimeout'],'dialPrefix':_0xa1bb20[_0x070e('0x53')],'outboundAnswerAgiCallsDay':_0xa1bb20[_0x070e('0x54')],'outboundAnswerCallsDay':_0xa1bb20[_0x070e('0x55')],'outboundBlacklistCallsDay':_0xa1bb20[_0x070e('0x56')],'outboundBusyCallsDay':_0xa1bb20['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0xa1bb20[_0x070e('0x57')],'outboundDropCallsDayACS':_0xa1bb20['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0xa1bb20['outboundDropCallsDayCallersExit'],'outboundDropCallsDayTimeout':_0xa1bb20['outboundDropCallsDayTimeout'],'outboundNoAnswerCallsDay':_0xa1bb20[_0x070e('0x58')],'outboundNoSuchCallsDay':_0xa1bb20[_0x070e('0x59')],'outboundOriginateFailureCallsDay':_0xa1bb20[_0x070e('0x5a')],'outboundReCallsDay':_0xa1bb20[_0x070e('0x5b')],'outboundRejectCallsDay':_0xa1bb20[_0x070e('0x5c')],'outboundUnknownCallsDay':_0xa1bb20['outboundUnknownCallsDay'],'predictiveIntervalAnsweredCalls':_0xa1bb20[_0x070e('0x5d')],'predictiveIntervalAvgHoldtime':_0xa1bb20['predictiveIntervalAvgHoldtime'],'predictiveIntervalAvgTalktime':_0xa1bb20[_0x070e('0x5e')],'predictiveIntervalDroppedCallsCallersExit':_0xa1bb20[_0x070e('0x5f')],'predictiveIntervalDroppedCallsTimeout':_0xa1bb20[_0x070e('0x60')],'predictiveIntervalErlangCalls':_0xa1bb20['predictiveIntervalErlangCalls'],'predictiveIntervalErlangCallsDroppedCalls':_0xa1bb20['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0xa1bb20[_0x070e('0x61')],'predictiveIntervalMultiplicativeFactor':_0xa1bb20['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0xa1bb20[_0x070e('0x62')],'predictiveIntervalAvailable':_0xa1bb20[_0x070e('0x63')],'predictiveIntervalTotalCalls':_0xa1bb20[_0x070e('0x64')],'message':_0xa1bb20['message'],'originated':_0xa1bb20[_0x070e('0x65')],'erlangCalls':_0xa1bb20[_0x070e('0x66')],'erlangCallToSecond':_0xa1bb20['erlangCallToSecond'],'erlangAbandonmentRate':_0xa1bb20['erlangAbandonmentRate'],'erlangBusyFactor':_0xa1bb20[_0x070e('0x67')],'startPredictive':_0xa1bb20[_0x070e('0x22')],'startProgressive':_0xa1bb20[_0x070e('0x23')]};if(_0xa1bb20[_0x070e('0x68')]){_0x268c5d[_0x070e('0x68')]={'id':_0xa1bb20['Trunk']['id'],'name':_0xa1bb20[_0x070e('0x68')][_0x070e('0x3a')],'active':_0xa1bb20[_0x070e('0x68')][_0x070e('0x69')],'callerid':_0xa1bb20[_0x070e('0x68')][_0x070e('0x6a')]};}if(_0xa1bb20[_0x070e('0x3b')]){_0x268c5d[_0x070e('0x3b')]={'id':_0xa1bb20[_0x070e('0x3b')]['id'],'name':_0xa1bb20[_0x070e('0x3b')][_0x070e('0x3a')]};}var _0x3be553=md5(JSON[_0x070e('0x6b')](_0x268c5d));if(_0xa1bb20[_0x070e('0x3')]!==_0x3be553){_0xa1bb20[_0x070e('0x3')]=_0x3be553;emit(util['format'](_0x070e('0x6c'),_0x268c5d[_0x070e('0x3a')]),_0x070e('0x6d'),_0x268c5d);}}}function emitCampaignSummary(_0x249e3f){if(_0x249e3f[_0x070e('0x46')]===_0x070e('0x6e')){emit(util[_0x070e('0x6f')](_0x070e('0x70'),_0x249e3f[_0x070e('0x3a')]),'campaign:save',_0x249e3f);}}function checkGetDataPredictive(_0x251696){if(isNotNull(_0x251696)){if(!_['isEmpty'](_0x251696)){loggerPredictive[_0x070e('0x71')](_0x070e('0x72'));loggerPredictive['info'](_0x070e('0x73'),_0x251696[_0x070e('0x64')]);loggerPredictive[_0x070e('0x71')](_0x070e('0x74'),_0x251696[_0x070e('0x5d')]);loggerPredictive[_0x070e('0x71')](_0x070e('0x75'),_0x251696['predictiveIntervalDroppedCallsTimeout']);loggerPredictive[_0x070e('0x71')]('Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x251696['predictiveIntervalDroppedCallsCallersExit']);loggerPredictive[_0x070e('0x71')](_0x070e('0x76'),_0x251696[_0x070e('0x77')]);loggerPredictive[_0x070e('0x71')](_0x070e('0x78'),_0x251696[_0x070e('0x5e')]);loggerPredictive[_0x070e('0x71')](_0x070e('0x79'));if(_0x251696['predictiveIntervalTotalCalls']>0x0){if(!_[_0x070e('0x37')](_0x251696['predictiveIntervalAvgTalktime'])&&_0x251696['predictiveIntervalAvgTalktime']>0x0){return!![];}else{loggerPredictive[_0x070e('0x71')](_0x070e('0x7a'));}if(!_['isUndefined'](_0x251696[_0x070e('0x77')])&&_0x251696[_0x070e('0x77')]>0x0){return!![];}else{loggerPredictive[_0x070e('0x71')](_0x070e('0x7b'));}}else{loggerPredictive[_0x070e('0x71')](_0x070e('0x7c'));}}else{loggerPredictive[_0x070e('0x71')]('History\x20information\x20are\x20empty');}}else{loggerPredictive['info']('History\x20information\x20are\x20empty');}return![];}function mergeDataErlangB(_0x3087e5){return function(_0x1948a5){loggerPredictive[_0x070e('0x71')](_0x070e('0x7d'));loggerPredictive['info'](_0x070e('0x7e'),_0x1948a5['erlangCalls']);loggerPredictive[_0x070e('0x71')](_0x070e('0x7f'),_0x1948a5[_0x070e('0x80')]);loggerPredictive[_0x070e('0x71')](_0x070e('0x81'),_0x1948a5[_0x070e('0x82')]);loggerPredictive['info'](_0x070e('0x83'),_0x1948a5[_0x070e('0x67')]);loggerPredictive[_0x070e('0x71')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1948a5[_0x070e('0x82')]);loggerPredictive[_0x070e('0x71')]('---------------------------');_[_0x070e('0x84')](_0x3087e5,_0x1948a5);};}function getDiff(_0x4e8dfc){var _0xc89f90=moment()['milliseconds'](0x0);var _0x4cb86f=moment(_0x4e8dfc)['milliseconds'](0x0);return _0xc89f90[_0x070e('0x43')](_0x4cb86f,_0x070e('0x44'));}function ifInterval(_0x1100d8,_0x122198){if(_[_0x070e('0x37')](_0x122198)){return![];}if(getDiff(_0x122198)<_0x1100d8*0x3c){return!![];}else{return![];}}function freeVariablesPredictive(_0x3a00bb){if(isNotNull(_0x3a00bb)){if(!_['isUndefined'](_0x3a00bb[_0x070e('0x23')])){_0x3a00bb['startProgressive']=undefined;loggerPredictive[_0x070e('0x71')](_0x3a00bb['name'],_0x070e('0x85'));}if(!_[_0x070e('0x37')](_0x3a00bb['startPredictive'])){_0x3a00bb[_0x070e('0x22')]=undefined;loggerPredictive['info'](_0x3a00bb[_0x070e('0x3a')],_0x070e('0x86'));}if(!_[_0x070e('0x37')](_0x3a00bb[_0x070e('0x87')])){clearInterval(_0x3a00bb[_0x070e('0x87')]);_0x3a00bb[_0x070e('0x87')]=undefined;loggerPredictive[_0x070e('0x71')](_0x3a00bb[_0x070e('0x3a')],_0x070e('0x88'));}}}function erlangb(_0x3332d0,_0x40c560){if(_0x40c560===0x0){return 0x0;}var _0x16887c=0x1;for(var _0x455bf2=0x1;_0x455bf2<=_0x40c560;_0x455bf2+=0x1){_0x16887c=0x1+_0x16887c*_0x455bf2/_0x3332d0;}return 0x1/_0x16887c;}function isVoiceQueueOutbound(_0x20bcf3){return _0x20bcf3==='outbound';}function isNotPreview(_0x45bf20){return _0x45bf20!==_0x070e('0x89');}function isCampaignIvr(_0x381c83){return _0x381c83===_0x070e('0x6e');}function getCallerId(_0x5712d1,_0x2ccd8d,_0x4e8e58){if(!_[_0x070e('0x37')](_0x4e8e58)&&_0x070e('0x8a')===typeof _0x4e8e58&&!_[_0x070e('0x3f')](_0x4e8e58)){if(!_[_0x070e('0x37')](_0x2ccd8d)&&'string'===typeof _0x2ccd8d&&!_[_0x070e('0x3f')](_0x2ccd8d)){return util[_0x070e('0x6f')](_0x070e('0x8b'),_0x2ccd8d,_0x4e8e58);}return util[_0x070e('0x6f')]('\x22%s\x22\x20<%s>',_0x4e8e58,_0x4e8e58);}if(!_[_0x070e('0x37')](_0x5712d1)&&'string'===typeof _0x5712d1&&!_[_0x070e('0x3f')](_0x5712d1)){return _0x5712d1;}return _0x070e('0x8c');}function loggerCatchQueueSummary(_0x3a1ad2,_0x150bf6){return function(_0x2a20d4){freeVariablesPredictive(_0x150bf6);emitVoiceQueueSummary(_0x150bf6);emitCampaignSummary(_0x150bf6);loggerSyncQueueSummary['error'](_0x3a1ad2,util[_0x070e('0x8d')](_0x2a20d4,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x2e38c6,_0x8cc913){return function(_0x114bcf){loggerPredictive['error'](_0x8cc913[_0x070e('0x3a')],_0x2e38c6);loggerPredictive['error'](_0x114bcf[_0x070e('0x8e')]);freeVariablesPredictive(_0x8cc913);};}function loggerCatch(_0x44e465){return function(_0x1214d2){logger['error'](_0x44e465,util[_0x070e('0x8d')](_0x1214d2,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x4d344c){return _0x4d344c&&!_[_0x070e('0x37')](_0x4d344c)&&_0x4d344c['length']>0x0;}function decremetOriginate(_0x381271){if(!_[_0x070e('0x37')](_0x381271)&&_0x381271!==null){if(_0x381271['hasOwnProperty'](_0x070e('0x65'))){if(_0x381271['originated']>0x0){_0x381271[_0x070e('0x65')]-=0x1;}else{logger[_0x070e('0x8f')]('[decremetOriginate]\x20object\x20originated\x20is\x20negative');}}}else{logger['error'](_0x070e('0x90'));}}function checkContactLowerLimitOriginate(_0x3022cd,_0xf67cfd,_0x17cf15){if(_0xf67cfd>_0x17cf15){for(var _0x25f1d0=0x0;_0x25f1d0<_0xf67cfd-_0x17cf15;_0x25f1d0+=0x1){decremetOriginate(_0x3022cd);}}}function loggerGetContactDialer(_0x26c5c3,_0x280d62,_0x332c8a){return function(_0x25b599){checkContactLowerLimitOriginate(_0x280d62,_0x332c8a,0x0);logger[_0x070e('0x8f')](_0x26c5c3,util[_0x070e('0x8d')](_0x25b599,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x25670e){return function(_0x1d3af4){if(isNotNull(_0x1d3af4)&&isNotNull(_0x1d3af4[0x0])){if(_0x1d3af4[0x0]['contactsRescheduled']>0x0){_0x25670e[_0x070e('0x38')]=_0x070e('0x91');logger['info']('[getContactDialer2][ReScheduled]'+_0x25670e[_0x070e('0x3a')],_0x1d3af4[0x0][_0x070e('0x92')],_0x070e('0x93'));}else{_0x25670e[_0x070e('0x38')]=_0x070e('0x94');logger[_0x070e('0x71')](_0x070e('0x95')+_0x25670e[_0x070e('0x3a')]);}}};}function notSendMessagesQueue(_0x24ac0f){if(_0x24ac0f[_0x070e('0x96')]){freeVariablesPredictive(_0x24ac0f);if(_0x24ac0f[_0x070e('0x65')]===0x0&&_0x24ac0f[_0x070e('0x4c')]===0x0&&_0x24ac0f[_0x070e('0x4f')]===0x0&&(_0x24ac0f['pTalking']||0x0)===0x0){_0x24ac0f['sendMessageOneNotActive']=![];_0x24ac0f['available']=0x0;_0x24ac0f[_0x070e('0x38')]=_0x070e('0x97');loggerSyncQueueSummary[_0x070e('0x8f')](_0x070e('0x98'),_0x24ac0f['name'],_0x070e('0x99'));}else{_0x24ac0f[_0x070e('0x38')]=_0x070e('0x9a');loggerSyncQueueSummary[_0x070e('0x8f')](_0x070e('0x98'),_0x24ac0f[_0x070e('0x3a')],'is\x20disactive');}emitVoiceQueueSummary(_0x24ac0f);}}function notSendMessagesCampaign(_0xb2954d){if(_0xb2954d['sendMessageOneNotActive']){if(_0xb2954d[_0x070e('0x65')]===0x0){_0xb2954d[_0x070e('0x96')]=![];_0xb2954d[_0x070e('0x38')]=_0x070e('0x97');loggerSyncQueueSummary[_0x070e('0x8f')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0xb2954d[_0x070e('0x3a')],_0x070e('0x99'));}else{_0xb2954d['message']=_0x070e('0x9a');loggerSyncQueueSummary[_0x070e('0x8f')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0xb2954d[_0x070e('0x3a')],_0x070e('0x9b'));}emitCampaignSummary(_0xb2954d);}}function createObjHistory(_0xf0aef8,_0x4da906,_0x40d7e6,_0xe8c476,_0x134b72){_0xf0aef8[_0x070e('0x38')]=_0x40d7e6;var _0x2082a8=new Action(_0xf0aef8,_0x4da906);var _0x17975c=new History(_0x2082a8);_0x17975c[_0x070e('0x9c')]=_0xe8c476;_0x17975c[_0x070e('0x9d')]=_0x134b72;_0x17975c[_0x070e('0x9e')]=_0x2082a8[_0x070e('0x9f')];return _0x17975c;}Dialer[_0x070e('0xa0')][_0x070e('0x36')]=function(){var _0x18c27a=this;setInterval(function(){_0x18c27a['clearZombieChannels'](_0x18c27a[_0x070e('0xa1')],_0x070e('0xa2'));_0x18c27a[_0x070e('0xa3')](_0x18c27a[_0x070e('0xa4')],_0x070e('0xa5'));},0x32c8);};Dialer[_0x070e('0xa0')]['clearZombieChannels']=function(_0x55f135,_0x4a8563){var _0x3c9abf=this;for(var _0x44a9f0 in _0x55f135){if(_0x55f135[_0x070e('0xa6')](_0x44a9f0)){this[_0x070e('0xa7')]['enqueue'](function(){if(!_[_0x070e('0xa8')](_0x55f135[_0x44a9f0])){return ami[_0x070e('0xa9')]({'action':_0x070e('0xaa'),'channel':_0x55f135[_0x44a9f0]['channel']})[_0x070e('0xab')](function(_0x48c011){if(_0x48c011[_0x070e('0x38')]===_0x070e('0xac')){setTimeout(function(){if(_0x55f135[_0x44a9f0]&&_0x55f135[_0x44a9f0]['type']!=='ivr'){_0x3c9abf[_0x070e('0xad')](_0x3c9abf[_0x070e('0x1b')][_0x55f135[_0x44a9f0]['queue']]);logger[_0x070e('0x8f')]('[Dialer][checkChannel]',_0x4a8563,_0x44a9f0,_0x55f135[_0x44a9f0]['queue']);delete _0x55f135[_0x44a9f0];}if(_0x55f135[_0x44a9f0]&&_0x55f135[_0x44a9f0]['type']===_0x070e('0x6e')){_0x3c9abf[_0x070e('0xad')](_0x3c9abf[_0x070e('0x1c')][_0x55f135[_0x44a9f0][_0x070e('0xae')]]);logger[_0x070e('0x8f')](_0x070e('0xaf'),_0x4a8563,_0x44a9f0,_0x55f135[_0x44a9f0][_0x070e('0xae')]);delete _0x55f135[_0x44a9f0];}},0x2328);}});}});}}};Dialer[_0x070e('0xa0')][_0x070e('0xb0')]=function(_0xdcc60a){return BPromise[_0x070e('0xb1')]()[_0x070e('0xb2')](cmHopper[_0x070e('0xb0')](_0xdcc60a))[_0x070e('0xab')](loggerCatch(_0x070e('0xb3')));};Dialer[_0x070e('0xa0')][_0x070e('0xb4')]=function(_0x3f9e15){return BPromise[_0x070e('0xb1')]()[_0x070e('0xb2')](cmHopperBlack[_0x070e('0xb4')](_0x3f9e15))[_0x070e('0xab')](loggerCatch('[checkIsBlackList]\x20'));};Dialer[_0x070e('0xa0')][_0x070e('0xb5')]=function(_0x449337){return BPromise[_0x070e('0xb1')]()['then'](cmHopperBlack[_0x070e('0xb5')](_0x449337))[_0x070e('0xab')](loggerCatch(_0x070e('0xb6')));};Dialer[_0x070e('0xa0')][_0x070e('0xb7')]=function(_0x2ceb4f){return BPromise['resolve']()['then'](cmHopperHistory['avgHandleTime'](_0x2ceb4f))[_0x070e('0xab')](loggerCatch('[averageHandleTime]\x20'));};Dialer[_0x070e('0xa0')][_0x070e('0xb8')]=function(_0x4dba5f){return BPromise[_0x070e('0xb1')]()[_0x070e('0xb2')](cmHopper['rescheduleContact'](_0x4dba5f))['catch'](loggerCatch(_0x070e('0xb9')));};Dialer[_0x070e('0xa0')][_0x070e('0xba')]=function(_0x38f600,_0x6149cc,_0x49d071){return BPromise[_0x070e('0xb1')]()['then'](cmHopper[_0x070e('0xba')](_0x38f600,_0x6149cc,_0x49d071))[_0x070e('0xab')](loggerCatch('[unlockContact]\x20'));};Dialer[_0x070e('0xa0')][_0x070e('0xbb')]=function(_0x356448,_0x16e190,_0x174ca6,_0x32b286){return BPromise['resolve']()[_0x070e('0xb2')](cmHopper[_0x070e('0xbb')](_0x356448,_0x16e190,_0x174ca6,_0x32b286))[_0x070e('0xab')](loggerCatch(_0x070e('0xbc')));};Dialer[_0x070e('0xa0')]['getContactDialerIvr']=function(_0x2531f7,_0x3f03aa,_0x35491d){return BPromise[_0x070e('0xb1')]()[_0x070e('0xb2')](cmHopper[_0x070e('0xbd')](_0x2531f7,_0x3f03aa,_0x35491d))[_0x070e('0xab')](loggerCatch(_0x070e('0xbc')));};Dialer[_0x070e('0xa0')][_0x070e('0xbe')]=function(_0x1e14b5){return BPromise[_0x070e('0xb1')]()[_0x070e('0xb2')](voiceQueueRt[_0x070e('0xbe')](_0x1e14b5))[_0x070e('0xab')](loggerCatch(_0x070e('0xbf')));};Dialer['prototype']['moveContactManagedDialer']=function(_0x32e1fa){return BPromise[_0x070e('0xb1')]()['then'](cmHopper['moveContactManagedDialer'](_0x32e1fa))['catch'](loggerCatch('[moveContactManagedDialer]\x20'));};Dialer[_0x070e('0xa0')][_0x070e('0xc0')]=function(_0x171283){return BPromise[_0x070e('0xb1')]()[_0x070e('0xb2')](cmHopperHistory[_0x070e('0xc0')](_0x171283))[_0x070e('0xab')](loggerCatch(_0x070e('0xc1')));};Dialer[_0x070e('0xa0')][_0x070e('0xad')]=function(_0x51f064){if(!_[_0x070e('0x37')](_0x51f064)&&_0x51f064!==null){if(_0x51f064[_0x070e('0xa6')]('originated')){if(_0x51f064[_0x070e('0x65')]>0x0){_0x51f064[_0x070e('0x65')]-=0x1;}else{logger[_0x070e('0x8f')](_0x070e('0xc2'));}}}else{logger['error'](_0x070e('0xc3'));}};Dialer[_0x070e('0xa0')][_0x070e('0xc4')]=function(_0x46d83e,_0x51b43f){var _0x4096ae=this;return function(_0x14a769){_0x4096ae[_0x070e('0xad')](_0x51b43f);logger[_0x070e('0x8f')](_0x46d83e,util[_0x070e('0x8d')](_0x14a769,{'showHidden':![],'depth':null}));};};Dialer[_0x070e('0xa0')][_0x070e('0xc5')]=function(_0xb2cca5,_0x3d5862,_0x1a41f2){var _0x2dcccf={'state':0x19,'statedesc':'notFound'};this[_0x070e('0xad')](_0x3d5862);this[_0x070e('0xc6')](_['merge'](_0x2dcccf,_['pick'](_0x1a41f2,[_0x070e('0xc7'),'ListId',_0x070e('0xc8'),_0x070e('0xc9'),_0x070e('0xca')])),_0x070e('0xcb'),_0x070e('0xcc'));logger[_0x070e('0x8f')](_0xb2cca5);};Dialer[_0x070e('0xa0')]['isSuccess']=function(_0x20493c){return _0x20493c===_0x070e('0xcd');};Dialer[_0x070e('0xa0')][_0x070e('0xce')]=function(_0x4a9c99){return!_['isUndefined'](_0x4a9c99)&&_0x4a9c99&&!_[_0x070e('0x37')](_0x4a9c99[_0x070e('0x3a')])&&!_[_0x070e('0x37')](_0x4a9c99['active'])&&_0x4a9c99[_0x070e('0x69')]&&(this[_0x070e('0x1e')][util['format'](_0x070e('0xcf'),_0x4a9c99[_0x070e('0x3a')])][_0x070e('0xaa')]===_0x070e('0xd0')||this[_0x070e('0x1e')][util[_0x070e('0x6f')]('SIP/%s',_0x4a9c99['name'])][_0x070e('0xaa')]==='unmonitored');};Dialer[_0x070e('0xa0')][_0x070e('0xc6')]=function(_0x4cf2b8,_0x377b8b,_0x4b80b9){this[_0x070e('0xc0')](_0x4cf2b8)[_0x070e('0xab')](loggerCatch(_0x377b8b));this[_0x070e('0xd1')](_0x4cf2b8)[_0x070e('0xab')](loggerCatch(_0x4b80b9));};Dialer[_0x070e('0xa0')][_0x070e('0x31')]=function(_0x5b30df){var _0x434723=this[_0x070e('0xa1')][_0x5b30df['uniqueid']];var _0x4d275a;if(!_[_0x070e('0xa8')](_0x5b30df)&&!_[_0x070e('0xa8')](_0x5b30df[_0x070e('0xd2')])&&!_[_0x070e('0xa8')](_0x5b30df[_0x070e('0xd2')][_0x070e('0xd3')])&&_0x5b30df[_0x070e('0xd4')]===_0x070e('0xd5')&&_0x434723){if(_0x434723['type']!==_0x070e('0x6e')&&this[_0x070e('0x1b')][_0x434723[_0x070e('0xae')]][_0x070e('0xd6')]&&_0x5b30df[_0x070e('0xd7')]===_0x070e('0xd8')){delete this[_0x070e('0xa1')][_0x5b30df[_0x070e('0xd9')]];this['updateOriginated'](this[_0x070e('0x1b')][_0x434723[_0x070e('0xae')]]);this[_0x070e('0x1b')][_0x434723[_0x070e('0xae')]][_0x070e('0x55')]+=0x1;this[_0x070e('0x1b')][_0x434723[_0x070e('0xae')]][_0x070e('0x54')]+=0x1;_0x4d275a=new Hangup(_0x434723,_0x5b30df);_0x4d275a[_0x070e('0x9c')]=0x12;_0x4d275a[_0x070e('0x9d')]='HangupInAMD';_0x4d275a['membername']=_0x070e('0xda');this[_0x070e('0xc6')](_0x4d275a,_0x070e('0xdb'),'[syncHangupInAMD]');}if(_0x434723[_0x070e('0x46')]!==_0x070e('0x6e')&&this['voiceQueues'][_0x434723[_0x070e('0xae')]][_0x070e('0xd6')]&&_0x5b30df[_0x070e('0xd7')]===_0x070e('0xdc')){delete this[_0x070e('0xa1')][_0x5b30df[_0x070e('0xd9')]];this['updateOriginated'](this['voiceQueues'][_0x434723[_0x070e('0xae')]]);this[_0x070e('0x1b')][_0x434723['queue']][_0x070e('0x55')]+=0x1;this[_0x070e('0x1b')][_0x434723[_0x070e('0xae')]][_0x070e('0x54')]+=0x1;_0x4d275a=new Hangup(_0x434723,_0x5b30df);_0x4d275a[_0x070e('0x9c')]=0x13;_0x4d275a[_0x070e('0x9d')]='Machine';_0x4d275a[_0x070e('0xdd')]=_0x070e('0xda');_0x4d275a['amd']=!![];this[_0x070e('0xc6')](_0x4d275a,_0x070e('0xde'),_0x070e('0xdf'));}if(_0x434723[_0x070e('0x46')]==='ivr'&&this['campaigns'][_0x434723[_0x070e('0xae')]][_0x070e('0xd6')]&&_0x5b30df[_0x070e('0xd7')]===_0x070e('0xd8')){delete this[_0x070e('0xa1')][_0x5b30df[_0x070e('0xd9')]];this[_0x070e('0xad')](this[_0x070e('0x1c')][_0x434723[_0x070e('0xae')]]);_0x4d275a=new Hangup(_0x434723,_0x5b30df);_0x4d275a[_0x070e('0x9c')]=0x12;_0x4d275a['statedesc']=_0x070e('0xe0');_0x4d275a[_0x070e('0xdd')]=_0x070e('0xda');this[_0x070e('0xc6')](_0x4d275a,'[syncHangupInAMDIvr][createHistory]',_0x070e('0xe1'));}if(_0x434723[_0x070e('0x46')]==='ivr'&&this['campaigns'][_0x434723[_0x070e('0xae')]][_0x070e('0xd6')]&&_0x5b30df[_0x070e('0xd7')]==='MACHINE'){delete this[_0x070e('0xa1')][_0x5b30df[_0x070e('0xd9')]];this[_0x070e('0xad')](this[_0x070e('0x1c')][_0x434723[_0x070e('0xae')]]);_0x4d275a=new Hangup(_0x434723,_0x5b30df);_0x4d275a['state']=0x13;_0x4d275a[_0x070e('0x9d')]=_0x070e('0xe2');_0x4d275a['membername']=_0x070e('0xda');_0x4d275a['amd']=!![];this['saveInDb'](_0x4d275a,'[syncMachineIvr][createHistory]',_0x070e('0xe3'));}}};Dialer[_0x070e('0xa0')][_0x070e('0x2e')]=function(_0x398557){var _0x4f5c50=this[_0x070e('0xa1')][_0x398557[_0x070e('0xd9')]];var _0x500fa9=this;var _0x3c6a6e;if(_0x4f5c50&&_0x4f5c50[_0x070e('0x46')]===_0x070e('0x6e')){delete this[_0x070e('0xa1')][_0x398557[_0x070e('0xd9')]];this[_0x070e('0xad')](this['campaigns'][_0x4f5c50[_0x070e('0xae')]]);this['campaigns'][_0x4f5c50[_0x070e('0xae')]][_0x070e('0xe4')]+=0x1;_0x3c6a6e=new Hangup(_0x4f5c50,_0x398557);this[_0x070e('0xc0')](_0x3c6a6e)['catch'](loggerCatch(_0x070e('0xe5')));this[_0x070e('0xd1')](_0x3c6a6e)[_0x070e('0xab')](loggerCatch('[syncHangupIvr]'));}if(_0x4f5c50&&_0x4f5c50[_0x070e('0x46')]!==_0x070e('0x6e')&&isNotNull(this['voiceQueues'][_0x4f5c50[_0x070e('0xae')]][_0x070e('0xe6')])){delete this['uniqueId'][_0x398557['uniqueid']];this['updateOriginated'](this['voiceQueues'][_0x4f5c50[_0x070e('0xae')]]);this[_0x070e('0x1b')][_0x4f5c50[_0x070e('0xae')]][_0x070e('0x55')]+=0x1;this[_0x070e('0x1b')][_0x4f5c50[_0x070e('0xae')]][_0x070e('0x54')]+=0x1;_0x3c6a6e=new Hangup(_0x4f5c50,_0x398557);_0x3c6a6e[_0x070e('0x9c')]=0x10;_0x3c6a6e['statedesc']='AnswerAGI';_0x3c6a6e['membername']='AGI';this[_0x070e('0xc0')](_0x3c6a6e)[_0x070e('0xab')](loggerCatch(_0x070e('0xe5')));this[_0x070e('0xd1')](_0x3c6a6e)[_0x070e('0xab')](loggerCatch('[syncHangupIvr]'));}if(_0x4f5c50&&_0x4f5c50['type']!==_0x070e('0x6e')&&!isNotNull(this[_0x070e('0x1b')][_0x4f5c50['queue']][_0x070e('0xe6')])){delete this[_0x070e('0xa1')][_0x398557[_0x070e('0xd9')]];this[_0x070e('0xad')](this[_0x070e('0x1b')][_0x4f5c50[_0x070e('0xae')]]);this['voiceQueues'][_0x4f5c50[_0x070e('0xae')]][_0x070e('0xe7')]+=0x1;_0x3c6a6e=new Hangup(_0x4f5c50,_0x398557);_0x3c6a6e[_0x070e('0x9c')]=0xc;_0x3c6a6e['statedesc']=_0x398557[_0x070e('0xe8')];_0x3c6a6e[_0x070e('0xdd')]=_0x070e('0xe9');this[_0x070e('0xc0')](_0x3c6a6e)['catch'](loggerCatch(_0x070e('0xe5')));this[_0x070e('0xd1')](_0x3c6a6e)['catch'](loggerCatch(_0x070e('0xea')));}};Dialer[_0x070e('0xa0')]['syncAgentComplete']=function(_0x369de9){var _0x4ff695=this[_0x070e('0xa1')][_0x369de9['uniqueid']];var _0x1f9ef1=this;if(this['voiceQueues'][_0x369de9['queue']]){if(_0x4ff695&&_0x4ff695[_0x070e('0x46')]!=='ivr'){delete this['uniqueId'][_0x369de9[_0x070e('0xd9')]];this[_0x070e('0x1b')][_0x369de9[_0x070e('0xae')]][_0x070e('0x55')]+=0x1;var _0x1a339e=new AgentComplete(_0x4ff695,_0x369de9);if(_0x369de9['reason']===_0x070e('0xeb')){_0x1a339e[_0x070e('0xec')]=this[_0x070e('0x1b')][_0x369de9[_0x070e('0xae')]][_0x070e('0xed')]&&this[_0x070e('0x1b')][_0x369de9['queue']][_0x070e('0xee')]?moment()[_0x070e('0x6f')](_0x070e('0xef')):undefined;}this[_0x070e('0xc0')](_0x1a339e)['catch'](loggerCatch('[syncAgentComplete][createHistory]'));this[_0x070e('0xd1')](_0x1a339e)[_0x070e('0xab')](loggerCatch(_0x070e('0xf0')));}}};Dialer[_0x070e('0xa0')][_0x070e('0x26')]=function(_0x150ff2){if(this['voiceQueues'][_0x150ff2[_0x070e('0xae')]]){if(this[_0x070e('0xa1')][_0x150ff2[_0x070e('0xd9')]]&&this[_0x070e('0xa1')][_0x150ff2[_0x070e('0xd9')]][_0x070e('0x46')]!=='ivr'){this['updateOriginated'](this[_0x070e('0x1b')][_0x150ff2[_0x070e('0xae')]]);this[_0x070e('0xa1')][_0x150ff2[_0x070e('0xd9')]][_0x070e('0xf1')]=moment()[_0x070e('0x6f')](_0x070e('0xef'));}}};Dialer['prototype'][_0x070e('0xf2')]=function(_0x5e244a){this[_0x070e('0xc0')](_0x5e244a)['catch'](loggerCatch('[syncAgentComplete][createHistory]'));this['moveContactManagedDialer'](_0x5e244a)[_0x070e('0xab')](loggerCatch(_0x070e('0xf3')));};Dialer[_0x070e('0xa0')][_0x070e('0x29')]=function(_0xec8bee){var _0x2016e8=this[_0x070e('0xa1')][_0xec8bee[_0x070e('0xd9')]];var _0x39cbf7=this;if(this['voiceQueues'][_0xec8bee[_0x070e('0xae')]]){if(_0x2016e8&&_0x2016e8[_0x070e('0x46')]!==_0x070e('0x6e')){delete this[_0x070e('0xa1')][_0xec8bee[_0x070e('0xd9')]];this[_0x070e('0xad')](this[_0x070e('0x1b')][_0xec8bee[_0x070e('0xae')]]);_0x2016e8[_0x070e('0xf4')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');var _0x2615f9=new QueueCallerAbandon(_0x2016e8,_0xec8bee);if(getSeconds(_0x2016e8[_0x070e('0xf4')],_0x2016e8['responsetime'])>=_0x2016e8[_0x070e('0xf5')]){this['voiceQueues'][_0xec8bee['queue']][_0x070e('0x60')]+=0x1;this[_0x070e('0x1b')][_0xec8bee['queue']][_0x070e('0xf6')]+=0x1;this[_0x070e('0x1b')][_0xec8bee[_0x070e('0xae')]]['predictiveIntervalErlangCallsDroppedCalls']+=0x1;_0x2615f9['state']=0xa;_0x2615f9[_0x070e('0x9d')]=_0x070e('0xf7');_0x2615f9[_0x070e('0xf8')]='TIMEOUT';_0x2615f9[_0x070e('0xec')]=this[_0x070e('0x1b')][_0xec8bee['queue']][_0x070e('0xed')]?moment()[_0x070e('0x6f')](_0x070e('0xef')):undefined;_0x2615f9[_0x070e('0xf9')]+=0x1;_0x2615f9[_0x070e('0xfa')]+=0x1;if(_0x2615f9[_0x070e('0xf9')]>=this[_0x070e('0x1b')][_0xec8bee[_0x070e('0xae')]][_0x070e('0xfb')]){this[_0x070e('0xf2')](_0x2615f9);}else{this[_0x070e('0xb8')]({'active':![],'countdropretry':_0x2615f9[_0x070e('0xf9')],'scheduledat':moment()[_0x070e('0xfc')](this[_0x070e('0x1b')][_0xec8bee[_0x070e('0xae')]][_0x070e('0xfd')],_0x070e('0xfe'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2016e8['ContactId'],'ListId':_0x2016e8['ListId'],'VoiceQueueId':_0x2016e8[_0x070e('0xc9')]||undefined,'CampaignId':_0x2016e8[_0x070e('0xca')]||undefined})[_0x070e('0xab')](loggerCatch('[rescheduleContact][Drop]'));var _0x4294d2=new History(_0x2615f9);_0x4294d2[_0x070e('0x9c')]=0xa;_0x4294d2[_0x070e('0x9d')]='Drop';_0x4294d2[_0x070e('0x9f')]=moment()[_0x070e('0x6f')](_0x070e('0xef'));_0x4294d2[_0x070e('0x9e')]=_0x4294d2['starttime'];_0x4294d2[_0x070e('0xff')]=_0x2615f9[_0x070e('0xff')];_0x4294d2[_0x070e('0x100')]=_0x2615f9['calleridnum'];console[_0x070e('0x101')](_0x070e('0x102'),_0xec8bee);console[_0x070e('0x101')](_0x070e('0x103'),_0x2615f9);console[_0x070e('0x101')](_0x070e('0x104'),_0x4294d2);this[_0x070e('0xc0')](_0x4294d2)[_0x070e('0xab')](loggerCatch(_0x070e('0x105')));}}else{this['voiceQueues'][_0xec8bee['queue']][_0x070e('0x5f')]+=0x1;this['voiceQueues'][_0xec8bee['queue']][_0x070e('0x106')]+=0x1;_0x2615f9[_0x070e('0x9c')]=0xb;_0x2615f9[_0x070e('0x9d')]=_0x070e('0x107');_0x2615f9[_0x070e('0xf8')]=_0x070e('0x108');_0x2615f9['countabandonedretry']+=0x1;if(_0x2615f9[_0x070e('0x109')]>=this[_0x070e('0x1b')][_0xec8bee[_0x070e('0xae')]][_0x070e('0x10a')]){this['queueCallerAbandonCreateState'](_0x2615f9);}else{this[_0x070e('0xb8')]({'active':![],'countabandonedretry':_0x2615f9['countabandonedretry'],'scheduledat':moment()[_0x070e('0xfc')](this[_0x070e('0x1b')][_0xec8bee[_0x070e('0xae')]][_0x070e('0x10b')],_0x070e('0xfe'))[_0x070e('0x6f')](_0x070e('0xef')),'ContactId':_0x2016e8[_0x070e('0xc7')],'ListId':_0x2016e8[_0x070e('0x10c')],'VoiceQueueId':_0x2016e8['VoiceQueueId']||undefined,'CampaignId':_0x2016e8[_0x070e('0xca')]||undefined})[_0x070e('0xab')](loggerCatch(_0x070e('0x10d')));var _0x4294d2=new History(_0x2615f9);_0x4294d2[_0x070e('0x9c')]=0xb;_0x4294d2[_0x070e('0x9d')]=_0x070e('0x107');_0x4294d2[_0x070e('0x9f')]=moment()['format'](_0x070e('0xef'));_0x4294d2[_0x070e('0x9e')]=_0x4294d2['starttime'];console['log'](_0x070e('0x10e'),_0x4294d2);this[_0x070e('0xc0')](_0x4294d2)[_0x070e('0xab')](loggerCatch(_0x070e('0x10f')));}}}}};Dialer[_0x070e('0xa0')][_0x070e('0x30')]=function(_0x545fb5){if(this['actions'][_0x545fb5[_0x070e('0xd9')]]){this[_0x070e('0xa4')][_0x545fb5['uniqueid']][_0x070e('0x110')]=_0x545fb5['channel'];}if(this[_0x070e('0xa1')][_0x545fb5[_0x070e('0xd9')]]){this['uniqueId'][_0x545fb5[_0x070e('0xd9')]][_0x070e('0x110')]=_0x545fb5['channel'];}};Dialer['prototype'][_0x070e('0x33')]=function(_0x486fb3){if(strategy[this[_0x070e('0x1b')][this[_0x070e('0xa4')][_0x486fb3[_0x070e('0x111')]]['queue']][_0x070e('0x47')]]===_0x070e('0x112')){if(this['actions'][_0x486fb3[_0x070e('0x111')]]&&_[_0x070e('0xa8')](this[_0x070e('0xa4')][_0x486fb3[_0x070e('0x111')]][_0x070e('0x113')])&&_0x486fb3[_0x070e('0xaa')]==='1'&&_0x486fb3[_0x070e('0x114')]==='0'){if(this[_0x070e('0x1d')][_0x486fb3[_0x070e('0x115')]]){if(!this[_0x070e('0x1d')][_0x486fb3['stateinterface']][_0x070e('0x113')]){this[_0x070e('0x1d')][_0x486fb3[_0x070e('0x115')]]['locked']=!![];this['actions'][_0x486fb3[_0x070e('0x111')]][_0x070e('0x113')]=!![];this[_0x070e('0xa4')][_0x486fb3[_0x070e('0x111')]]['stateinterface']=_0x486fb3[_0x070e('0x115')];}}}}else if((strategy[this['voiceQueues'][this['actions'][_0x486fb3[_0x070e('0x111')]]['queue']][_0x070e('0x47')]]||_0x070e('0x116'))===_0x070e('0x116')){if(this[_0x070e('0xa4')][_0x486fb3['actionid']]){if(this[_0x070e('0x1d')][_0x486fb3['stateinterface']]){this[_0x070e('0xa4')][_0x486fb3[_0x070e('0x111')]][_0x070e('0x115')]=_0x486fb3[_0x070e('0x115')];if(_[_0x070e('0xa8')](this[_0x070e('0x24')][this[_0x070e('0xa4')][_0x486fb3[_0x070e('0x111')]][_0x070e('0xae')]])){this[_0x070e('0x24')][this[_0x070e('0xa4')][_0x486fb3[_0x070e('0x111')]][_0x070e('0xae')]]=[];}this[_0x070e('0x24')][this[_0x070e('0xa4')][_0x486fb3[_0x070e('0x111')]]['queue']]['push'](_[_0x070e('0x84')](_[_0x070e('0x117')](this['actions'][_0x486fb3[_0x070e('0x111')]],[_0x070e('0x118'),'stateinterface']),{'status':_0x486fb3[_0x070e('0xaa')],'paused':_0x486fb3[_0x070e('0x114')]}));}}}};function unlockQueueStatus(_0x538e3c,_0x3c0fb3){setTimeout(function(){if(_[_0x070e('0x37')](_0x538e3c[_0x070e('0x119')])){loggerBooked[_0x070e('0x8f')](_0x070e('0x11a'),_0x3c0fb3);}_0x538e3c[_0x070e('0x119')]=!![];loggerBooked['info'](_0x070e('0x11b'),_0x3c0fb3,JSON[_0x070e('0x6b')](_[_0x070e('0x117')](_0x538e3c,['name',_0x070e('0x119')])));},0x1f3);}Dialer[_0x070e('0xa0')][_0x070e('0x35')]=function(_0x1a6a01){var _0x59d1ed=this;var _0x5b49d7=_0x59d1ed[_0x070e('0x1b')][_0x59d1ed[_0x070e('0xa4')][_0x1a6a01[_0x070e('0x111')]][_0x070e('0xae')]];if(strategy[this[_0x070e('0x1b')][this[_0x070e('0xa4')][_0x1a6a01[_0x070e('0x111')]]['queue']][_0x070e('0x47')]]===_0x070e('0x112')){if(this[_0x070e('0xa4')][_0x1a6a01[_0x070e('0x111')]]&&this[_0x070e('0xa4')][_0x1a6a01[_0x070e('0x111')]][_0x070e('0x115')]){this[_0x070e('0x89')][_0x070e('0x11c')](this[_0x070e('0xa4')][_0x1a6a01[_0x070e('0x111')]][_0x070e('0x118')],this[_0x070e('0xa4')][_0x1a6a01[_0x070e('0x111')]][_0x070e('0x115')])['catch'](function(_0x3ae484){logger[_0x070e('0x8f')](_0x070e('0x11d'),util[_0x070e('0x8d')](_0x3ae484,{'showHidden':![],'depth':null}));})[_0x070e('0x1a')](function(){_0x59d1ed[_0x070e('0xad')](_0x59d1ed[_0x070e('0x1b')][_0x59d1ed['actions'][_0x1a6a01[_0x070e('0x111')]][_0x070e('0xae')]]);_0x59d1ed[_0x070e('0x1d')][_0x59d1ed[_0x070e('0xa4')][_0x1a6a01[_0x070e('0x111')]][_0x070e('0x115')]][_0x070e('0x113')]=![];delete _0x59d1ed[_0x070e('0xa4')][_0x1a6a01[_0x070e('0x111')]];unlockQueueStatus(_0x5b49d7);});}else{this['updateOriginated'](this[_0x070e('0x1b')][this[_0x070e('0xa4')][_0x1a6a01[_0x070e('0x111')]][_0x070e('0xae')]]);this[_0x070e('0xb8')]({'active':![],'ContactId':this[_0x070e('0xa4')][_0x1a6a01[_0x070e('0x111')]][_0x070e('0xc7')],'ListId':this[_0x070e('0xa4')][_0x1a6a01[_0x070e('0x111')]][_0x070e('0x10c')],'VoiceQueueId':this[_0x070e('0xa4')][_0x1a6a01[_0x070e('0x111')]][_0x070e('0xc9')]||undefined,'CampaignId':this[_0x070e('0xa4')][_0x1a6a01[_0x070e('0x111')]][_0x070e('0xca')]||undefined})[_0x070e('0xab')](loggerCatch(_0x070e('0x11e')));delete this[_0x070e('0xa4')][_0x1a6a01[_0x070e('0x111')]];unlockQueueStatus(_0x5b49d7);}}else if((strategy[this[_0x070e('0x1b')][this['actions'][_0x1a6a01[_0x070e('0x111')]][_0x070e('0xae')]][_0x070e('0x47')]]||_0x070e('0x116'))==='rrmemory'){var _0x3adefc;if(this['actions'][_0x1a6a01[_0x070e('0x111')]]&&!_['isEmpty'](this['queueBooked'][this[_0x070e('0xa4')][_0x1a6a01[_0x070e('0x111')]][_0x070e('0xae')]])){if(this['queueBookedRR'][_0x59d1ed[_0x070e('0xa4')][_0x1a6a01['actionid']][_0x070e('0xae')]]){this[_0x070e('0x11f')][_0x59d1ed['actions'][_0x1a6a01[_0x070e('0x111')]]['queue']]=this[_0x070e('0x11f')][this[_0x070e('0xa4')][_0x1a6a01[_0x070e('0x111')]]['queue']]?this['queueBookedRR'][this[_0x070e('0xa4')][_0x1a6a01['actionid']][_0x070e('0xae')]]:this[_0x070e('0x24')][this[_0x070e('0xa4')][_0x1a6a01[_0x070e('0x111')]][_0x070e('0xae')]]?this[_0x070e('0x24')][this['actions'][_0x1a6a01['actionid']][_0x070e('0xae')]]['_rr']||0x0:0x0;}this['queueBooked'][this[_0x070e('0xa4')][_0x1a6a01[_0x070e('0x111')]][_0x070e('0xae')]]['_rr']=this[_0x070e('0x11f')][this[_0x070e('0xa4')][_0x1a6a01[_0x070e('0x111')]]['queue']];for(var _0x4c239b=0x0;_0x4c239b=0x0?!![]:![];})[_0x070e('0xab')](myreject(_0x559a4a)));}}else{_0x7406a1[_0x070e('0x138')](ami[_0x070e('0xa9')]({'action':_0x070e('0x139'),'command':util[_0x070e('0x6f')](_0x070e('0x133'),_0x4542a8,!_[_0x070e('0x37')](config[_0x070e('0x135')][_0x3c7c2e])?_0x3c7c2e:'')})[_0x070e('0xb2')](function(_0x5f31f8){return _0x5f31f8[_0x070e('0x13a')][_0x070e('0x136')]('true')>=0x0?!![]:![];})['catch'](myreject(_0x559a4a)));}BPromise[_0x070e('0x13b')](_0x7406a1)[_0x070e('0xb2')](function(_0x3fb145){var _0x4527b9=_['some'](_0x3fb145);if(_0x4527b9){return _0x819236(_0x4527b9);}else{_0x59e648[_0x070e('0x38')]=_0x43b79d?_0x070e('0x13c'):_0x070e('0x13d');return _0x559a4a(msgResponse(_0x070e('0x13e'),_0x070e('0x12f'),_0x070e('0x13f')+_0x43b79d+'\x20'+_0x188811+'\x20Interval\x20is\x20overtime:\x20'+util[_0x070e('0x8d')](_0x4542a8,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0x3c7c2e));}})[_0x070e('0xab')](function(_0x835606){return _0x559a4a(msgResponse(_0x070e('0x12e'),_0x070e('0x12f'),JSON[_0x070e('0x6b')](_0x835606)));});});};Dialer[_0x070e('0xa0')][_0x070e('0x140')]=function(_0x560176){var _0x3f9ec8=this;return function(){switch(_0x560176[_0x070e('0x50')]){case _0x070e('0x141'):freeVariablesPredictive(_0x560176);_0x3f9ec8[_0x070e('0x142')](_0x560176,0x1);break;case _0x070e('0x143'):freeVariablesPredictive(_0x560176);_0x3f9ec8[_0x070e('0x142')](_0x560176,_0x560176[_0x070e('0x144')]);break;case _0x070e('0x145'):_0x3f9ec8[_0x070e('0x145')](_0x560176);break;case _0x070e('0x146'):freeVariablesPredictive(_0x560176);_0x3f9ec8[_0x070e('0x142')](_0x560176,0x1);break;default:freeVariablesPredictive(_0x560176);logger[_0x070e('0x8f')](_0x070e('0x147'),_0x560176[_0x070e('0x3a')],'method\x20not\x20recognized');}};};Dialer[_0x070e('0xa0')][_0x070e('0x148')]=function(_0x4f75aa){var _0x2e62ac=this;return function(){_0x2e62ac[_0x070e('0x149')](_0x4f75aa);};};Dialer[_0x070e('0xa0')][_0x070e('0x7')]=function(_0x5c3c33){var _0x31190d=this;if(isNotPreview(_0x5c3c33[_0x070e('0x50')])){if(isVoiceQueueOutbound(_0x5c3c33['type'])&&isActive(_0x5c3c33[_0x070e('0x14a')])){_0x5c3c33[_0x070e('0x96')]=!![];BPromise[_0x070e('0xb1')]()[_0x070e('0xb2')](checkIsLoggedIn(_0x5c3c33,_0x5c3c33[_0x070e('0x49')]))['then'](checkIsActive(_0x5c3c33,_0x5c3c33[_0x070e('0x14a')]))[_0x070e('0xb2')](checkInterval(_0x5c3c33))[_0x070e('0xb2')](_0x31190d[_0x070e('0x129')](_0x5c3c33))['then'](_0x31190d[_0x070e('0x12c')](_0x5c3c33[_0x070e('0x14b')],_0x5c3c33[_0x070e('0x14c')],_0x5c3c33['name'],_0x5c3c33))[_0x070e('0xb2')](_0x31190d[_0x070e('0x12d')](_0x5c3c33['Interval'],_0x5c3c33[_0x070e('0x14c')],_0x5c3c33[_0x070e('0x3a')],_0x5c3c33))[_0x070e('0xb2')](_0x31190d[_0x070e('0x140')](_0x5c3c33))['catch'](loggerCatchQueueSummary(_0x070e('0x14d'),_0x5c3c33));}else{notSendMessagesQueue(_0x5c3c33);}}else{freeVariablesPredictive(_0x5c3c33);}};Dialer['prototype'][_0x070e('0x14e')]=function(){var _0x208148=this;var _0x449eca;for(var _0x57110b in this['campaigns']){if(this['campaigns'][_0x070e('0xa6')](_0x57110b)){_0x449eca=this[_0x070e('0x1c')][_0x57110b];if(isCampaignIvr(_0x449eca['type'])&&isActive(_0x449eca[_0x070e('0x69')])){_0x449eca[_0x070e('0x96')]=!![];BPromise[_0x070e('0xb1')]()[_0x070e('0xb2')](checkIsActive(_0x449eca,_0x449eca[_0x070e('0x69')]))[_0x070e('0xb2')](checkInterval(_0x449eca))[_0x070e('0xb2')](_0x208148['checkIsTrunkReachable'](_0x449eca))[_0x070e('0xb2')](_0x208148['checkIfTime'](_0x449eca[_0x070e('0x14b')],_0x449eca[_0x070e('0x14c')],_0x449eca[_0x070e('0x3a')],_0x449eca))[_0x070e('0xb2')](_0x208148['checkIfTimeIntervals'](_0x449eca[_0x070e('0x3b')],_0x449eca[_0x070e('0x14c')],_0x449eca[_0x070e('0x3a')],_0x449eca))['then'](_0x208148[_0x070e('0x148')](_0x449eca))['catch'](loggerCatchQueueSummary(_0x070e('0x14f'),_0x449eca));}else{notSendMessagesCampaign(_0x449eca);}}}};function getCallerIdRandom(_0x6ff58a,_0x275a2c){var _0x4d4f9e,_0xfb9f07,_0x4c3f6f;if(_0x275a2c<=0x0){_0x275a2c=0x1;}_0x4d4f9e=new RegExp(_0x070e('0x150')+_0x275a2c+'}$');_0xfb9f07=Math[_0x070e('0x151')](0xa,_0x275a2c-0x1);_0x4c3f6f=Math[_0x070e('0x151')](0xa,_0x275a2c)-0x1;return util[_0x070e('0x6f')]('%s',_[_0x070e('0x152')](_0x6ff58a,_0x4d4f9e,_[_0x070e('0x153')](_0xfb9f07,_0x4c3f6f)));}function extractCalleridName(_0x141cae){var _0x1fdbbe=_0x141cae[_0x070e('0x154')](/"(.*?)"/);return _0x1fdbbe?_0x1fdbbe[0x1]:_0x141cae;}function extractCalleridNumber(_0x5e10c3){var _0x15fc52=_0x5e10c3[_0x070e('0x154')](/<(.*?)>/);return _0x15fc52?_0x15fc52[0x1]:_0x5e10c3;}Dialer['prototype'][_0x070e('0x155')]=function(_0x2e556f,_0x2ff71b){var _0x370948=this;var _0xd1b431=uuid['v4']();this[_0x070e('0xa4')][_0xd1b431]=new Action(_0x2e556f,_0x2ff71b,_0xd1b431);return new BPromise(function(_0x461d58,_0x221814){if(_[_0x070e('0x37')](_0x2e556f)&&'object'!==typeof _0x2e556f){return _0x221814(msgResponse(_0x070e('0x156'),_0x070e('0x12f'),_0x070e('0x157')));}if(_['isUndefined'](_0x2ff71b[_0x070e('0x158')][_0x070e('0x159')])||_0x2ff71b[_0x070e('0x158')][_0x070e('0x159')]===null){return _0x221814(msgResponse(_0x070e('0x156'),_0x070e('0x12f'),_0x070e('0x15a')));}var _0x5e5921={'XMD-CALLERID':_0x370948[_0x070e('0xa4')][_0xd1b431][_0x070e('0x15b')](),'XMD-AGI':_0x2e556f[_0x070e('0xe6')]?util[_0x070e('0x6f')](_0x070e('0x15c'),ipAgi,_0x2e556f['dialQueueProject']):_0x070e('0x15d'),'XMD-AGIAFTER':_0x2e556f[_0x070e('0xed')]?util['format']('\x22agi://%s/square,%s\x22',ipAgi,_0x2e556f['dialQueueProject2']):_0x070e('0x15d'),'XMD-QUEUE':_0x2e556f[_0x070e('0x46')]==='outbound'?util['format'](_0x070e('0x15e'),_0x2e556f['name'],_0x2e556f[_0x070e('0x15f')]||'',_0x2e556f[_0x070e('0xee')]?'c':'',_0x2e556f[_0x070e('0xf5')]||0x3):_0x070e('0x15d'),'XMD-CONTACTID':_0x2ff71b[_0x070e('0xc7')],'XMD-CDRTYPE':_0x070e('0x160'),'CALLERID(all)':_0x370948[_0x070e('0xa4')][_0xd1b431]['getCaller'](),'XMD-AMD':_0x2e556f[_0x070e('0xd6')]?_0x070e('0x161'):_0x070e('0x15d'),'XMD-DESTINATION':_0x070e('0xd5')};if(_0x2e556f['dialAMDActive']){_0x5e5921['XMD-AMDINITIALSILENCE']=_0x2e556f[_0x070e('0x162')]||0x9c4;_0x5e5921[_0x070e('0x163')]=_0x2e556f[_0x070e('0x164')]||0x5dc;_0x5e5921['XMD-AMDAFTERGREETINGSILENCE']=_0x2e556f[_0x070e('0x165')]||0x320;_0x5e5921[_0x070e('0x166')]=_0x2e556f[_0x070e('0x167')]||0x1388;_0x5e5921[_0x070e('0x168')]=_0x2e556f['dialAMDMinWordLength']||0x64;_0x5e5921['XMD-AMDBETWEENWORDSSILENCE']=_0x2e556f[_0x070e('0x169')]||0x32;_0x5e5921[_0x070e('0x16a')]=_0x2e556f[_0x070e('0x16b')]||0x3;_0x5e5921[_0x070e('0x16c')]=_0x2e556f[_0x070e('0x16d')]||0x100;_0x5e5921['XMD-AMDMAXIMUMWORDLENGTH']=_0x2e556f['dialAMDMaximumWordLength']||0x1388;}if(_0x2e556f['type']===_0x070e('0x16e')){_0x5e5921[_0x070e('0x16f')]=_0x2ff71b[_0x070e('0xc9')];}else{_0x5e5921[_0x070e('0x170')]=_0x2ff71b['CampaignId'];}for(var _0x418922 in _0x2ff71b['Contact']){if(_0x2ff71b['Contact'][_0x070e('0xa6')](_0x418922)){if(isNotNull(_0x2ff71b[_0x070e('0x158')][_0x418922])&&_0x418922!=='id'&&_0x418922!=='tags'&&_0x418922!==_0x070e('0x171')&&_0x418922!==_0x070e('0x172')){_0x5e5921[util[_0x070e('0x6f')](_0x070e('0x173'),_0x070e('0x174'),_[_0x070e('0x175')](_0x418922))]=_0x2ff71b['Contact'][_0x418922];}}}var _0x237251=_0x370948[_0x070e('0xce')](_0x2e556f[_0x070e('0x68')])?getCallerId(_0x2e556f['Trunk'][_0x070e('0x6a')],_0x2e556f[_0x070e('0x51')],_0x2e556f[_0x070e('0x176')]>0x0?getCallerIdRandom(_0x2e556f['dialOriginateCallerIdNumber'],_0x2e556f[_0x070e('0x176')]):_0x2e556f[_0x070e('0x52')]):getCallerId(_[_0x070e('0xa8')](_0x2e556f[_0x070e('0x177')])?_0x2e556f[_0x070e('0x68')][_0x070e('0x6a')]:_0x2e556f[_0x070e('0x177')][_0x070e('0x6a')],_0x2e556f[_0x070e('0x51')],_0x2e556f[_0x070e('0x176')]>0x0?getCallerIdRandom(_0x2e556f[_0x070e('0x52')],_0x2e556f['dialRandomLastDigitCallerIdNumber']):_0x2e556f[_0x070e('0x52')]);if(_0x237251){_0x5e5921[_0x070e('0x178')]=_0x370948[_0x070e('0xa4')][_0xd1b431][_0x070e('0x179')]=extractCalleridName(_0x237251);_0x5e5921['XMD-ORIGINATECALLERIDNUM']=_0x370948[_0x070e('0xa4')][_0xd1b431][_0x070e('0x17a')]=extractCalleridNumber(_0x237251);}return ami['Action']({'actionid':_0xd1b431,'action':_0x070e('0x156'),'channel':_0x370948[_0x070e('0xce')](_0x2e556f['Trunk'])?util[_0x070e('0x6f')]('SIP/%s/%s%s',_0x2e556f[_0x070e('0x68')]['name'],isNotNull(_0x2e556f['dialPrefix'])?_0x2e556f[_0x070e('0x53')]['trim']()||'':'',_0x2e556f[_0x070e('0x17b')]>0x0?_0x2ff71b[_0x070e('0x158')][_0x070e('0x159')][_0x070e('0x17c')](_0x2e556f[_0x070e('0x17b')]):_0x2ff71b[_0x070e('0x158')]['phone']):util['format']('SIP/%s/%s%s',_['isNil'](_0x2e556f[_0x070e('0x177')])?_0x2e556f['Trunk'][_0x070e('0x3a')]:_0x2e556f[_0x070e('0x177')][_0x070e('0x3a')],isNotNull(_0x2e556f[_0x070e('0x53')])?_0x2e556f[_0x070e('0x53')][_0x070e('0x17d')]()||'':'',_0x2e556f['dialCutDigit']>0x0?_0x2ff71b[_0x070e('0x158')][_0x070e('0x159')][_0x070e('0x17c')](_0x2e556f[_0x070e('0x17b')]):_0x2ff71b[_0x070e('0x158')][_0x070e('0x159')]),'callerid':_0x237251,'Exten':'xcally-motion-dialer','Context':_0x070e('0x17e'),'Priority':'1','variable':_0x5e5921,'timeout':(_0x2e556f[_0x070e('0x17f')]||0x1e)*0x3e8,'async':!![],'channelid':_0xd1b431})[_0x070e('0xb2')](function(_0x52f5bd){return _0x461d58(_0x52f5bd);})[_0x070e('0xab')](function(_0x34e9da){_0x2e556f[_0x070e('0x5a')]+=0x1;var _0x2b68de=new History(_0x370948[_0x070e('0xa4')][_0xd1b431]);logger[_0x070e('0x8f')](util[_0x070e('0x6f')](_0x070e('0x180'),JSON[_0x070e('0x6b')](_0x34e9da)));_0x2b68de[_0x070e('0x9c')]=0xe;_0x2b68de[_0x070e('0x9d')]=_0x070e('0x181');_0x2b68de[_0x070e('0x9f')]=moment()[_0x070e('0x6f')](_0x070e('0xef'));_0x2b68de[_0x070e('0x9e')]=_0x2b68de[_0x070e('0x9f')];_0x370948[_0x070e('0xc0')](_0x2b68de)[_0x070e('0xab')](loggerCatch(_0x070e('0x182')));_0x370948['moveContactManagedDialer'](_0x2b68de)[_0x070e('0xab')](loggerCatch('[originate][error]'))['finally'](function(){delete _0x370948[_0x070e('0xa4')][_0xd1b431];return _0x221814(msgResponse('originate',_0x070e('0x41'),_0x070e('0x183')));});});});};Dialer[_0x070e('0xa0')][_0x070e('0x2b')]=function(_0x1acab9){var _0xbf521=this[_0x070e('0xa4')][_0x1acab9[_0x070e('0x111')]];var _0x42032b=this;if(_0xbf521){delete this[_0x070e('0xa4')][_0x1acab9['actionid']];_0xbf521[_0x070e('0x184')]=moment()[_0x070e('0x6f')](_0x070e('0xef'));var _0x24cc9e=_0xbf521[_0x070e('0x46')]==='ivr'?this[_0x070e('0x1c')][_0xbf521[_0x070e('0xae')]]:this[_0x070e('0x1b')][_0xbf521[_0x070e('0x185')]()];if(!this['isSuccess'](_0x1acab9[_0x070e('0x186')])){this[_0x070e('0xad')](_0x24cc9e);return this['callProgressDetecting'](_0xbf521,_0x24cc9e,_0x1acab9)[_0x070e('0xb2')](function(_0x123b7c){})[_0x070e('0xab')](loggerCatch(_0x070e('0x187')));}else{this['uniqueId'][_0x1acab9[_0x070e('0xd9')]]=_0xbf521;}}};Dialer[_0x070e('0xa0')][_0x070e('0x188')]=function(_0x58c561,_0x219eb1,_0x48ba9a){var _0x32e8b5=new History(_0x219eb1);if(_0x32e8b5[_0x070e('0x189')]+_0x32e8b5['countcongestionretry']+_0x32e8b5[_0x070e('0x18a')]+_0x32e8b5[_0x070e('0x18b')]+_0x32e8b5[_0x070e('0xf9')]+_0x32e8b5[_0x070e('0x109')]+_0x32e8b5[_0x070e('0x18c')]+_0x32e8b5[_0x070e('0x18d')]>=_0x48ba9a[_0x070e('0x18e')]-0x1){return!![];}switch(_0x58c561){case 0x3:if(_0x32e8b5['countnoanswerretry']>=_0x48ba9a['dialNoAnswerMaxRetry']-0x1){return!![];}else{this[_0x070e('0xb8')]({'active':![],'countnoanswerretry':_0x32e8b5[_0x070e('0x18a')]+=0x1,'scheduledat':moment()[_0x070e('0xfc')](_0x48ba9a['dialNoAnswerRetryFrequency'],'minutes')[_0x070e('0x6f')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x32e8b5['ContactId'],'ListId':_0x32e8b5[_0x070e('0x10c')],'VoiceQueueId':_0x32e8b5[_0x070e('0xc9')]||undefined,'CampaignId':_0x32e8b5[_0x070e('0xca')]||undefined})[_0x070e('0xab')](loggerCatch('[rescheduleContact][NoAnswer]'));}break;case 0x5:if(_0x32e8b5['countbusyretry']>=_0x48ba9a[_0x070e('0x18f')]-0x1){return!![];}else{this[_0x070e('0xb8')]({'active':![],'countbusyretry':_0x32e8b5[_0x070e('0x189')]+=0x1,'scheduledat':moment()[_0x070e('0xfc')](_0x48ba9a[_0x070e('0x190')],'minutes')[_0x070e('0x6f')](_0x070e('0xef')),'ContactId':_0x32e8b5[_0x070e('0xc7')],'ListId':_0x32e8b5['ListId'],'VoiceQueueId':_0x32e8b5[_0x070e('0xc9')]||undefined,'CampaignId':_0x32e8b5['CampaignId']||undefined})[_0x070e('0xab')](loggerCatch(_0x070e('0x191')));}break;case 0x8:if(_0x32e8b5[_0x070e('0x192')]>=_0x48ba9a[_0x070e('0x193')]-0x1){return!![];}else{this[_0x070e('0xb8')]({'active':![],'countcongestionretry':_0x32e8b5['countcongestionretry']+=0x1,'scheduledat':moment()['add'](_0x48ba9a[_0x070e('0x194')],_0x070e('0xfe'))[_0x070e('0x6f')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x32e8b5['ContactId'],'ListId':_0x32e8b5[_0x070e('0x10c')],'VoiceQueueId':_0x32e8b5[_0x070e('0xc9')]||undefined,'CampaignId':_0x32e8b5[_0x070e('0xca')]||undefined})[_0x070e('0xab')](loggerCatch(_0x070e('0x195')));}break;case 0x0:if(_0x32e8b5[_0x070e('0x18b')]>=_0x48ba9a[_0x070e('0x196')]-0x1){return!![];}else{this[_0x070e('0xb8')]({'active':![],'countnosuchnumberretry':_0x32e8b5[_0x070e('0x18b')]+=0x1,'scheduledat':moment()[_0x070e('0xfc')](_0x48ba9a[_0x070e('0x197')],_0x070e('0xfe'))[_0x070e('0x6f')](_0x070e('0xef')),'ContactId':_0x32e8b5[_0x070e('0xc7')],'ListId':_0x32e8b5['ListId'],'VoiceQueueId':_0x32e8b5[_0x070e('0xc9')]||undefined,'CampaignId':_0x32e8b5[_0x070e('0xca')]||undefined})[_0x070e('0xab')](loggerCatch('[rescheduleContact][NoSuchNumber]'));}break;case 0xa:if(_0x32e8b5['countdropretry']>=_0x48ba9a['dialDropMaxRetry']-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countdropretry':_0x32e8b5[_0x070e('0xf9')]+=0x1,'scheduledat':moment()[_0x070e('0xfc')](_0x48ba9a[_0x070e('0xfd')],_0x070e('0xfe'))[_0x070e('0x6f')](_0x070e('0xef')),'ContactId':_0x32e8b5[_0x070e('0xc7')],'ListId':_0x32e8b5[_0x070e('0x10c')],'VoiceQueueId':_0x32e8b5[_0x070e('0xc9')]||undefined,'CampaignId':_0x32e8b5['CampaignId']||undefined})['catch'](loggerCatch('[rescheduleContact][Drop]'));}break;case 0xb:if(_0x32e8b5['countabandonedretry']>=_0x48ba9a[_0x070e('0x10a')]-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countabandonedretry':_0x32e8b5[_0x070e('0x109')]+=0x1,'scheduledat':moment()[_0x070e('0xfc')](_0x48ba9a[_0x070e('0x10b')],_0x070e('0xfe'))[_0x070e('0x6f')](_0x070e('0xef')),'ContactId':_0x32e8b5[_0x070e('0xc7')],'ListId':_0x32e8b5[_0x070e('0x10c')],'VoiceQueueId':_0x32e8b5['VoiceQueueId']||undefined,'CampaignId':_0x32e8b5[_0x070e('0xca')]||undefined})[_0x070e('0xab')](loggerCatch(_0x070e('0x10d')));}break;case 0x13:if(_0x32e8b5[_0x070e('0x18c')]>=_0x48ba9a[_0x070e('0x198')]-0x1){return!![];}else{this[_0x070e('0xb8')]({'active':![],'countmachineretry':_0x32e8b5[_0x070e('0x18c')]+=0x1,'scheduledat':moment()[_0x070e('0xfc')](_0x48ba9a[_0x070e('0x199')],_0x070e('0xfe'))[_0x070e('0x6f')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x32e8b5[_0x070e('0xc7')],'ListId':_0x32e8b5[_0x070e('0x10c')],'VoiceQueueId':_0x32e8b5['VoiceQueueId']||undefined,'CampaignId':_0x32e8b5[_0x070e('0xca')]||undefined})['catch'](loggerCatch('[rescheduleContact][Machine]'));}break;case 0x14:if(_0x32e8b5[_0x070e('0x18d')]>=_0x48ba9a['dialAgentRejectMaxRetry']-0x1){return!![];}else{this[_0x070e('0xb8')]({'active':![],'countagentrejectretry':_0x32e8b5[_0x070e('0x18d')]+=0x1,'scheduledat':moment()[_0x070e('0xfc')](_0x48ba9a['dialAgentRejectRetryFrequency'],_0x070e('0xfe'))['format'](_0x070e('0xef')),'ContactId':_0x32e8b5['ContactId'],'ListId':_0x32e8b5[_0x070e('0x10c')],'VoiceQueueId':_0x32e8b5[_0x070e('0xc9')]||undefined,'CampaignId':_0x32e8b5[_0x070e('0xca')]||undefined})['catch'](loggerCatch('[rescheduleContact][AgentReject]'));}break;default:return!![];}};Dialer[_0x070e('0xa0')][_0x070e('0x19a')]=function(_0x1b356b,_0x6c74f6,_0x4b0134){var _0x24338f=this;var _0x315c44=new History(_0x1b356b);return new BPromise(function(_0x37718b,_0x1c085f){if(_[_0x070e('0x37')](_0x6c74f6)&&_0x070e('0x19b')!==typeof _0x6c74f6){return _0x1c085f(msgResponse('[callProgressDetecting]',_0x070e('0x12f'),_0x070e('0x19c')));}if(_['isUndefined'](_0x4b0134)&&_0x070e('0x19b')!==typeof _0x4b0134){return _0x1c085f(msgResponse(_0x070e('0x19d'),_0x070e('0x12f'),_0x070e('0x19e')));}switch(_0x4b0134['reason']){case'0':_0x6c74f6['outboundNoSuchCallsDay']+=0x1;_0x315c44[_0x070e('0x9c')]=0x0;_0x315c44[_0x070e('0x9d')]=_0x070e('0x19f');_0x315c44[_0x070e('0x18b')]+=0x1;_0x315c44[_0x070e('0xfa')]+=0x1;_0x24338f['createHistory'](_0x315c44)[_0x070e('0xab')](loggerCatch(_0x070e('0x1a0')));if(_0x24338f[_0x070e('0x188')](0x0,_0x1b356b,_0x6c74f6)){if(_0x315c44[_0x070e('0x189')]+_0x315c44[_0x070e('0x192')]+_0x315c44['countnoanswerretry']+_0x315c44[_0x070e('0x18b')]+_0x315c44[_0x070e('0xf9')]+_0x315c44[_0x070e('0x109')]+_0x315c44[_0x070e('0x18c')]+_0x315c44['countagentrejectretry']>=_0x6c74f6[_0x070e('0x18e')]){_0x24338f[_0x070e('0x1a1')](_0x315c44,_0x37718b,_0x1c085f,'reason\x200\x20no\x20such\x20number....');}else{_0x24338f[_0x070e('0x1a2')](_0x315c44,_0x37718b,_0x1c085f,_0x070e('0x1a3'));}}break;case'3':_0x6c74f6[_0x070e('0x58')]+=0x1;_0x315c44[_0x070e('0x9c')]=0x3;_0x315c44[_0x070e('0x9d')]=_0x070e('0x1a4');_0x315c44[_0x070e('0x18a')]+=0x1;_0x315c44[_0x070e('0xfa')]+=0x1;_0x24338f[_0x070e('0xc0')](_0x315c44)['catch'](loggerCatch(_0x070e('0x1a5')));if(_0x24338f[_0x070e('0x188')](0x3,_0x1b356b,_0x6c74f6)){if(_0x315c44[_0x070e('0x18a')]>=_0x6c74f6[_0x070e('0x1a6')]){_0x24338f[_0x070e('0x1a2')](_0x315c44,_0x37718b,_0x1c085f,_0x070e('0x1a7'));}else{_0x24338f[_0x070e('0x1a1')](_0x315c44,_0x37718b,_0x1c085f,'reason\x203\x20ringing\x20no\x20answer');}}break;case'5':_0x6c74f6[_0x070e('0x1a8')]+=0x1;_0x315c44[_0x070e('0x9c')]=0x5;_0x315c44[_0x070e('0x9d')]='Busy';_0x315c44[_0x070e('0x189')]+=0x1;_0x315c44[_0x070e('0xfa')]+=0x1;_0x24338f[_0x070e('0xc0')](_0x315c44)[_0x070e('0xab')](loggerCatch(_0x070e('0x1a9')));if(_0x24338f[_0x070e('0x188')](0x5,_0x1b356b,_0x6c74f6)){if(_0x315c44[_0x070e('0x189')]>=_0x6c74f6[_0x070e('0x18f')]){_0x24338f[_0x070e('0x1a2')](_0x315c44,_0x37718b,_0x1c085f,_0x070e('0x1aa'));}else{_0x24338f['stateGlobal'](_0x315c44,_0x37718b,_0x1c085f,'reason\x205\x20busy');}}break;case'8':_0x6c74f6[_0x070e('0x57')]+=0x1;_0x315c44[_0x070e('0x9c')]=0x8;_0x315c44[_0x070e('0x9d')]='Congestion';_0x315c44[_0x070e('0x192')]+=0x1;_0x315c44[_0x070e('0xfa')]+=0x1;_0x24338f[_0x070e('0xc0')](_0x315c44)['catch'](loggerCatch(_0x070e('0x1ab')));if(_0x24338f[_0x070e('0x188')](0x8,_0x1b356b,_0x6c74f6)){if(_0x315c44[_0x070e('0x192')]>=_0x6c74f6[_0x070e('0x193')]){_0x24338f['createStateFinal'](_0x315c44,_0x37718b,_0x1c085f,_0x070e('0x1ac'));}else{_0x24338f[_0x070e('0x1a1')](_0x315c44,_0x37718b,_0x1c085f,_0x070e('0x1ac'));}}break;case'11':_0x6c74f6[_0x070e('0x1ad')]+=0x1;_0x315c44[_0x070e('0x9c')]=0xb;_0x315c44[_0x070e('0x9d')]='Abandoned';_0x315c44['countabandonedretry']+=0x1;_0x315c44[_0x070e('0xfa')]+=0x1;_0x24338f['createHistory'](_0x315c44)[_0x070e('0xab')](loggerCatch(_0x070e('0x10f')));if(_0x24338f['checkRetriveMax'](0xb,_0x1b356b,_0x6c74f6)){if(_0x315c44[_0x070e('0x109')]>=_0x6c74f6[_0x070e('0x10a')]){_0x24338f[_0x070e('0x1a2')](_0x315c44,_0x37718b,_0x1c085f,'reason\x2011\x20abandoned');}else{_0x24338f[_0x070e('0x1a1')](_0x315c44,_0x37718b,_0x1c085f,'reason\x2011\x20abandoned');}}break;case'20':_0x6c74f6['outboundRejectCallsDay']+=0x1;_0x315c44[_0x070e('0x9c')]=0x14;_0x315c44[_0x070e('0x9d')]='AgentReject';_0x315c44[_0x070e('0x18d')]+=0x1;_0x315c44[_0x070e('0xfa')]+=0x1;_0x24338f['createHistory'](_0x315c44)[_0x070e('0xab')](loggerCatch(_0x070e('0x1ae')));if(_0x24338f['checkRetriveMax'](0x14,_0x1b356b,_0x6c74f6)){if(_0x315c44[_0x070e('0x18d')]>=_0x6c74f6[_0x070e('0x1af')]){_0x24338f[_0x070e('0x1a2')](_0x315c44,_0x37718b,_0x1c085f,'reason\x2020\x20agentreject');}else{_0x24338f['stateGlobal'](_0x315c44,_0x37718b,_0x1c085f,_0x070e('0x1b0'));}}break;default:_0x6c74f6[_0x070e('0xe7')]+=0x1;_0x315c44[_0x070e('0x9c')]=0xc;_0x315c44[_0x070e('0x9d')]=_0x4b0134[_0x070e('0x1b1')];_0x24338f[_0x070e('0xc0')](_0x315c44)[_0x070e('0xab')](loggerCatch(_0x070e('0x1b2')));if(_0x24338f[_0x070e('0x188')](_0x4b0134['reason'],_0x1b356b,_0x6c74f6)){if(_0x315c44[_0x070e('0x189')]+_0x315c44['countcongestionretry']+_0x315c44[_0x070e('0x18a')]+_0x315c44[_0x070e('0x18b')]+_0x315c44[_0x070e('0xf9')]+_0x315c44[_0x070e('0x109')]+_0x315c44[_0x070e('0x18c')]+_0x315c44[_0x070e('0x18d')]>=_0x6c74f6[_0x070e('0x18e')]){_0x24338f['stateGlobal'](_0x315c44,_0x37718b,_0x1c085f,_0x4b0134[_0x070e('0x1b1')]);}else{_0x24338f[_0x070e('0x1a2')](_0x315c44,_0x37718b,_0x1c085f,_0x4b0134['reason']);}}}});};Dialer[_0x070e('0xa0')][_0x070e('0x1a1')]=function(_0x4245a1,_0x27fbb6,_0x200a93,_0x214d1e){var _0x2062f4=new Final(_0x4245a1);_0x2062f4[_0x070e('0x9c')]=0xf;_0x2062f4[_0x070e('0x9d')]='Global';this['createStateFinal'](_0x2062f4,_0x27fbb6,_0x200a93,_0x214d1e);};Dialer[_0x070e('0xa0')][_0x070e('0x1a2')]=function(_0x14f568,_0x1cf653,_0x3a0537,_0x36b5ef){this[_0x070e('0xd1')](_0x14f568)[_0x070e('0xb2')](function(_0x1b9077){return _0x1cf653(msgResponse(_0x070e('0x19d'),_0x070e('0xcd'),_0x36b5ef));})[_0x070e('0xab')](function(_0x15413b){return _0x3a0537(msgResponse('[moveContactManagedDialer][0]','Failure',_0x070e('0x1b3')));});};Dialer[_0x070e('0xa0')][_0x070e('0x145')]=function(_0x516d34){var _0x1d24d1=this;var _0x2e9832=_0x516d34[_0x070e('0x1b4')]/0x64;var _0x1f70af=_0x516d34['outboundDropCallsDayTimeout']/(_0x516d34[_0x070e('0xf6')]+_0x516d34['outboundAnswerCallsDay']);var _0x4688d1=Math[_0x070e('0x1b5')](_0x516d34[_0x070e('0x63')]*(_0x516d34['predictiveIntervalMaxThreshold']/0x64));var _0x224bd4=Math[_0x070e('0x1b5')](_0x516d34[_0x070e('0x63')]*(_0x516d34[_0x070e('0x1b6')]/0x64));var _0x47d1aa=_0x516d34['available']+_0x516d34[_0x070e('0x4c')];var _0x1395d9=Math[_0x070e('0x1b7')](_0x516d34[_0x070e('0x66')]*_0x516d34['erlangAbandonmentRate']*_0x516d34[_0x070e('0x61')]*_0x516d34[_0x070e('0x1b8')]);if(_[_0x070e('0x37')](_0x516d34[_0x070e('0x23')])){if(!_[_0x070e('0x37')](_0x516d34['startPredictive'])){_0x516d34['startPredictive']=undefined;loggerPredictive[_0x070e('0x8f')](_0x070e('0x1b9'),_0x070e('0x1ba'));}if(!_[_0x070e('0x37')](_0x516d34[_0x070e('0x87')])){loggerPredictive[_0x070e('0x8f')](_0x070e('0x1b9'),_0x070e('0x1bb'));clearInterval(_0x516d34[_0x070e('0x87')]);_0x516d34['handlePredictive']=undefined;}_0x516d34[_0x070e('0x23')]=moment()['format'](_0x070e('0xef'));loggerPredictive[_0x070e('0x71')](_0x516d34[_0x070e('0x3a')],'collection\x20data\x20in\x20progressive\x20at',_0x516d34['startProgressive']);this[_0x070e('0x142')](_0x516d34,0x1);}else if(ifInterval(_0x516d34[_0x070e('0x1bc')],_0x516d34['startProgressive'])){this[_0x070e('0x142')](_0x516d34,0x1);loggerPredictiveCalls[_0x070e('0x71')](_0x070e('0x1bd'),_0x516d34[_0x070e('0x23')],_0x516d34[_0x070e('0x3a')]);_0x516d34['erlangCalls']=0x0;_0x516d34['predictiveIntervalErlangCallsDroppedCalls']=0x0;}else if(_0x2e9832<_0x1f70af&&_0x516d34['dialPredictiveOptimization']===_0x070e('0x1be')){freeVariablesPredictive(_0x516d34);loggerPredictive[_0x070e('0x71')]('[stopMethodPredictive][ReStartProgressive][ExceededDropDay]',_0x070e('0x1bf'),_0x1f70af,_0x070e('0x23'),_0x516d34[_0x070e('0x3a')]);}else if(_0x1395d9<_0x516d34[_0x070e('0x1c0')]&&_0x516d34[_0x070e('0x1c1')]==='dropRate'){freeVariablesPredictive(_0x516d34);loggerPredictive[_0x070e('0x71')]('[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]',_0x070e('0x1c2'),_0x1395d9,'Drop\x20in\x20this\x20interval',_0x516d34[_0x070e('0x1c0')],_0x070e('0x23'),_0x516d34['name']);}else if(!ifInterval(_0x516d34['dialPredictiveInterval'],_0x516d34[_0x070e('0x23')])&&_['isUndefined'](_0x516d34['startPredictive'])&&!_[_0x070e('0x37')](_0x516d34[_0x070e('0x23')])){_0x516d34[_0x070e('0x22')]=moment()[_0x070e('0x6f')](_0x070e('0xef'));loggerPredictive[_0x070e('0x71')](_0x516d34[_0x070e('0x3a')],_0x070e('0x1c3'),_0x516d34[_0x070e('0x22')]);this['averageHandleTime'](_0x516d34['dialPredictiveInterval'])[_0x070e('0xb2')](this[_0x070e('0x1c4')](_0x516d34))[_0x070e('0xb2')](mergeDataErlangB(_0x516d34))[_0x070e('0xb2')](this[_0x070e('0x1c5')](_0x516d34))[_0x070e('0xab')](loggerCatchPredictive(_0x070e('0x1c6'),_0x516d34));}else if(!ifInterval(_0x516d34[_0x070e('0x1bc')],_0x516d34[_0x070e('0x22')])){_0x516d34[_0x070e('0x1c0')]=0x0;_0x516d34[_0x070e('0x22')]=moment()[_0x070e('0x6f')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x070e('0x71')](_0x516d34[_0x070e('0x3a')],'recalculate\x20predictive\x20at',_0x516d34[_0x070e('0x22')]);clearInterval(_0x516d34[_0x070e('0x87')]);_0x516d34[_0x070e('0x87')]=undefined;this[_0x070e('0xb7')](_0x516d34[_0x070e('0x1bc')])[_0x070e('0xb2')](this['getDataPredictive'](_0x516d34))[_0x070e('0xb2')](mergeDataErlangB(_0x516d34))[_0x070e('0xb2')](this[_0x070e('0x1c5')](_0x516d34))[_0x070e('0xab')](loggerCatchPredictive('Predictive\x20for\x20every\x20interval',_0x516d34));}else if(_0x516d34[_0x070e('0x63')]&&_0x47d1aa<_0x516d34[_0x070e('0x63')]-_0x224bd4){freeVariablesPredictive(_0x516d34);loggerPredictive[_0x070e('0x71')](_0x516d34[_0x070e('0x3a')],_0x070e('0x1c7'),_0x47d1aa,_0x070e('0x1c8'),_0x516d34[_0x070e('0x63')],'-',_0x224bd4,'=',_0x516d34[_0x070e('0x63')]-_0x224bd4,')');}else if(_0x516d34[_0x070e('0x63')]&&_0x47d1aa>_0x516d34[_0x070e('0x63')]+_0x4688d1){freeVariablesPredictive(_0x516d34);loggerPredictive[_0x070e('0x71')](_0x516d34[_0x070e('0x3a')],_0x070e('0x1c7'),_0x47d1aa,_0x070e('0x1c9'),_0x516d34[_0x070e('0x63')],'+',_0x4688d1,'=',_0x516d34[_0x070e('0x63')]+_0x4688d1,')');}};Dialer[_0x070e('0xa0')][_0x070e('0x1c4')]=function(_0x236678){var _0x44a756=this;return function(_0x315d3c){return new BPromise(function(_0xb8b11c,_0x4223cf){_[_0x070e('0x84')](_0x236678,_0x315d3c[0x0]);if(checkGetDataPredictive(_0x315d3c[0x0])){var _0x429e4e=_0x236678[_0x070e('0x63')]=_0x236678[_0x070e('0x4c')]+_0x236678[_0x070e('0x48')];var _0x8159e2=_0x236678[_0x070e('0x1bc')]*0x3c;var _0x248086=_0x315d3c[0x0]['predictiveIntervalAvgTalktime']+_0x315d3c[0x0]['predictiveIntervalAvgHoldtime'];var _0x552911=(_0x315d3c[0x0][_0x070e('0x5d')]+_0x315d3c[0x0][_0x070e('0x60')]+_0x315d3c[0x0][_0x070e('0x5f')])/_0x315d3c[0x0][_0x070e('0x64')];_0x236678[_0x070e('0x61')]=_0x552911>0x0?_0x552911:0x1;switch(_0x236678['dialPredictiveOptimization']){case _0x070e('0x1be'):var _0x5d5a8c=_0x236678['dialPredictiveOptimizationPercentage']/0x64;return _0x44a756[_0x070e('0x1ca')](_0x429e4e,_0x8159e2,_0x248086,_0x552911,_0x5d5a8c)[_0x070e('0xb2')](function(_0x1c9857){return _0xb8b11c(_0x1c9857);});case _0x070e('0x1cb'):var _0x43c5e5=_0x236678[_0x070e('0x1b4')]/0x64;return _0x44a756[_0x070e('0x1cc')](_0x429e4e,_0x8159e2,_0x248086,_0x552911,_0x43c5e5)['then'](function(_0x151aac){return _0xb8b11c(_0x151aac);});default:return _0x4223cf(msgResponse(_0x070e('0x1cd'),'Failure',_0x070e('0x1ce')));}}else{return _0x4223cf(msgResponse(_0x070e('0x1cd'),_0x070e('0x12f'),_0x070e('0x1cf')));}});};};Dialer[_0x070e('0xa0')][_0x070e('0x1d0')]=function(_0x124f6e){var _0x398510=this;return function(_0x4ef09c){return new BPromise(function(_0x23552f,_0x3663a4){_[_0x070e('0x84')](_0x124f6e,_0x4ef09c[0x0]);if(checkGetDataPredictive(_0x4ef09c[0x0])){loggerPredictive[_0x070e('0x71')](JSON[_0x070e('0x6b')](_0x4ef09c[0x0]));if(_0x124f6e[_0x070e('0x1c1')]===_0x070e('0x1be')){return _0x398510[_0x070e('0xbe')](_0x124f6e['id'])[_0x070e('0xb2')](function(_0x42a0e8){var _0x131c67=_0x124f6e[_0x070e('0x49')]-_0x42a0e8[0x0]['outboundQueuePauses'];var _0x1886e6=_0x124f6e['dialPredictiveInterval']*0x3c;var _0x28a41c=_0x4ef09c[0x0][_0x070e('0x5e')]+_0x4ef09c[0x0][_0x070e('0x77')];var _0x13b5a0=(_0x4ef09c[0x0][_0x070e('0x5d')]+_0x4ef09c[0x0][_0x070e('0x60')]+_0x4ef09c[0x0][_0x070e('0x5f')])/_0x4ef09c[0x0][_0x070e('0x64')];var _0x1a7088=_0x124f6e[_0x070e('0x1b4')]/0x64;_0x124f6e[_0x070e('0x62')]=_0x42a0e8[0x0][_0x070e('0x1d1')]||0x0;_0x124f6e[_0x070e('0x61')]=_0x13b5a0>0x0?_0x13b5a0:0x1;return _0x398510['abandonmentRate'](_0x131c67,_0x1886e6,_0x28a41c,_0x13b5a0,_0x1a7088);})[_0x070e('0xb2')](function(_0x4d8945){return _0x23552f(_0x4d8945);})[_0x070e('0xab')](function(_0x214579){return _0x3663a4(msgResponse(_0x070e('0x1d2'),'Failure',JSON[_0x070e('0x6b')](_0x214579)));});}if(_0x124f6e[_0x070e('0x1c1')]===_0x070e('0x1cb')){return _0x398510[_0x070e('0xbe')](_0x124f6e['id'])[_0x070e('0xb2')](function(_0x2c72d6){var _0x50e921=_0x124f6e[_0x070e('0x49')]-_0x2c72d6[0x0][_0x070e('0x1d1')];var _0x287fcd=_0x124f6e[_0x070e('0x1bc')]*0x3c;var _0x5f0d77=_0x4ef09c[0x0]['predictiveIntervalAvgTalktime']+_0x4ef09c[0x0][_0x070e('0x77')];var _0xf8d6f0=(_0x4ef09c[0x0][_0x070e('0x5d')]+_0x4ef09c[0x0][_0x070e('0x60')]+_0x4ef09c[0x0][_0x070e('0x5f')])/_0x4ef09c[0x0][_0x070e('0x64')];var _0x1a882a=_0x124f6e['dialPredictiveOptimizationPercentage']/0x64;_0x124f6e['predictiveIntervalPauses']=_0x2c72d6[0x0][_0x070e('0x1d1')]||0x0;_0x124f6e[_0x070e('0x61')]=_0xf8d6f0>0x0?_0xf8d6f0:0x1;return _0x398510[_0x070e('0x1cc')](_0x50e921,_0x287fcd,_0x5f0d77,_0xf8d6f0,_0x1a882a);})['then'](function(_0x2ab9a5){return _0x23552f(_0x2ab9a5);})[_0x070e('0xab')](function(_0x3f6b1f){return _0x3663a4(msgResponse(_0x070e('0x1d2'),_0x070e('0x12f'),JSON[_0x070e('0x6b')](_0x3f6b1f)));});}}else{return _0x3663a4(msgResponse(_0x070e('0x1cd'),'Failure',_0x070e('0x1cf')));}});};};Dialer['prototype'][_0x070e('0x1c5')]=function(_0x285744){var _0x2295cd=this;return function(){var _0x1d8163=0x0;var _0x551c57=Math[_0x070e('0x1b7')](_0x285744[_0x070e('0x80')]*0x3e8);if(_0x551c57>0x0){_0x551c57=_0x551c57<0x64?0x64:_0x551c57;loggerPredictive[_0x070e('0x71')](_0x285744['name'],_0x070e('0x1d3'),_0x551c57,_0x070e('0x42'));_0x285744['handlePredictive']=setInterval(function(){_0x2295cd['handlePredictive'](_0x285744);loggerPredictiveCalls['info'](_0x070e('0x1d4'),_0x1d8163+=0x1);},_0x551c57);}else{loggerPredictive[_0x070e('0x71')](_0x285744[_0x070e('0x3a')],'fail\x20to\x20scheduled\x20calls');}};};Dialer[_0x070e('0xa0')][_0x070e('0x1d5')]=function(_0x417366,_0x1106aa){var _0x357658=this;return function(_0x17aca1){if(_[_0x070e('0x3f')](_0x17aca1)){if(_[_0x070e('0xa8')](_0x1106aa['UserId'])||!_0x1106aa[_0x070e('0x1d6')]){if(_0x417366[_0x070e('0x50')]===_0x070e('0x146')){_0x417366[_0x070e('0x119')]=_[_0x070e('0x37')](_0x417366[_0x070e('0x119')])?!![]:_0x417366[_0x070e('0x119')];var _0x4a3d79=uuid['v4']();_0x357658[_0x070e('0xa4')][_0x4a3d79]=new Action(_0x417366,_0x1106aa,_0x4a3d79);loggerBooked[_0x070e('0x71')](_0x070e('0x1d7'),_0x4a3d79,_0x070e('0x1d8'),JSON[_0x070e('0x6b')](_0x417366['queueStatusComplete']),_0x070e('0x1d9'),_0x417366['name']);if(_0x417366[_0x070e('0x119')]){_0x417366['queueStatusComplete']=![];_0x357658[_0x070e('0x24')][_0x357658[_0x070e('0xa4')][_0x4a3d79][_0x070e('0xae')]]=[];ami[_0x070e('0xa9')]({'actionid':_0x4a3d79,'action':_0x070e('0x1da'),'queue':_0x417366['name']})['catch'](function(_0xc73371){_0x357658[_0x070e('0xad')](_0x417366);_0x357658[_0x070e('0xb8')]({'active':![],'ContactId':_0x357658[_0x070e('0xa4')][_0x4a3d79][_0x070e('0xc7')],'ListId':_0x357658[_0x070e('0xa4')][_0x4a3d79]['ListId'],'VoiceQueueId':_0x357658[_0x070e('0xa4')][_0x4a3d79][_0x070e('0xc9')]||undefined,'CampaignId':_0x357658[_0x070e('0xa4')][_0x4a3d79][_0x070e('0xca')]||undefined})['catch'](loggerCatch(_0x070e('0x1db')));delete _0x357658[_0x070e('0xa4')][_0x4a3d79];});}else{loggerBooked['info']('[booked][checkContactBlack][else]',JSON[_0x070e('0x6b')](_0x417366['queueStatusComplete']),'Queue:\x20',_0x417366['name']);_0x357658['updateOriginated'](_0x417366);_0x357658[_0x070e('0xb8')]({'active':![],'ContactId':_0x357658[_0x070e('0xa4')][_0x4a3d79][_0x070e('0xc7')],'ListId':_0x357658[_0x070e('0xa4')][_0x4a3d79][_0x070e('0x10c')],'VoiceQueueId':_0x357658[_0x070e('0xa4')][_0x4a3d79][_0x070e('0xc9')]||undefined,'CampaignId':_0x357658[_0x070e('0xa4')][_0x4a3d79][_0x070e('0xca')]||undefined})[_0x070e('0xab')](loggerCatch(_0x070e('0x1db')));delete _0x357658[_0x070e('0xa4')][_0x4a3d79];}}else{return _0x357658[_0x070e('0x155')](_0x417366,_0x1106aa);}}else{if(getDiff(_0x1106aa[_0x070e('0x1dc')])<_0x417366[_0x070e('0x1dd')]*0x3c){if(_0x1106aa[_0x070e('0x1de')]&&!_0x1106aa[_0x070e('0x1de')][_0x070e('0x1df')]){_0x357658[_0x070e('0x89')]['run'](_0x1106aa['id'])['finally'](function(){_0x357658['updateOriginated'](_0x417366);});}else{_0x357658['unlockContact']({'active':![]},_0x1106aa['id'],0x1)[_0x070e('0x1a')](function(){console[_0x070e('0x101')](_0x070e('0x1e0'));_0x357658[_0x070e('0xad')](_0x417366);});}}else{_0x417366['outboundReCallsDay']+=0x1;_0x357658['updateOriginated'](_0x417366);if(_0x417366[_0x070e('0x1e1')]){_0x357658[_0x070e('0xb8')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x1106aa[_0x070e('0xc7')],'ListId':_0x1106aa[_0x070e('0x10c')],'VoiceQueueId':_0x1106aa[_0x070e('0xc9')]||undefined,'CampaignId':_0x1106aa['CampaignId']||undefined})['catch'](loggerCatch(_0x070e('0x1e2')));_0x357658['createHistory'](createObjHistory(_0x417366,_0x1106aa,'RECALLINQUEUE',0x17,'RecallInQueue'))[_0x070e('0xab')](loggerCatch('[Originate][HistoryDialRecallInQueue][historyCatch]'));}else{_0x357658[_0x070e('0xc6')](createObjHistory(_0x417366,_0x1106aa,_0x070e('0x1e3'),0x16,_0x070e('0x1e4')),_0x070e('0x1e5'),_0x070e('0x1e6'));}}}}else{_0x417366[_0x070e('0x56')]+=0x1;_0x357658[_0x070e('0xc6')](createObjHistory(_0x417366,_0x1106aa,'BLACKLIST',0xd,_0x070e('0x1e7')),_0x070e('0x1e8'),_0x070e('0x1e9'));throw _0x070e('0x1ea');}};};Dialer[_0x070e('0xa0')]['handleIvr']=function(_0x1b3737){var _0x3442c3=this;var _0x15e879=[];var _0xcb1589=_0x1b3737[_0x070e('0x1eb')]-_0x1b3737[_0x070e('0x65')]-_0x1b3737['temp'];emitCampaignSummary(_0x1b3737);if(_0xcb1589>0x0){if(_0xcb1589>this[_0x070e('0x1f')]){_0xcb1589=this['maxNumberOriginate'];}_0x1b3737[_0x070e('0x1ec')]+=_0xcb1589;this['getContactDialerIvr'](_0x1b3737['id'],_0xcb1589,_0x1b3737[_0x070e('0x1ed')])[_0x070e('0xb2')](function(_0x52f13e){_0x1b3737['temp']-=_0xcb1589;_0x1b3737[_0x070e('0x1ec')]=_0x1b3737[_0x070e('0x1ec')]>0x0?_0x1b3737[_0x070e('0x1ec')]:0x0;if(!checkContactEmpty(_0x52f13e)){_0x1b3737[_0x070e('0x38')]=_0x070e('0x94');logger['info']('[getContactCampaign2][Empty]'+_0x1b3737[_0x070e('0x3a')]);}else{_0x1b3737[_0x070e('0x65')]+=_0x52f13e[_0x070e('0x120')];_0x1b3737['message']=_0x070e('0x1ee');for(var _0x6721c2=0x0;_0x6721c2<_0x52f13e[_0x070e('0x120')];_0x6721c2+=0x1){_0x1b3737[_0x070e('0x1ef')]+=0x1;if(_[_0x070e('0xa8')](_0x52f13e[_0x6721c2])||_[_0x070e('0xa8')](_0x52f13e[_0x6721c2][_0x070e('0x158')])||_[_0x070e('0xa8')](_0x52f13e[_0x6721c2][_0x070e('0x158')][_0x070e('0x159')])){_0x3442c3[_0x070e('0xc5')](_0x070e('0x1f0'),_0x1b3737,_0x52f13e[_0x6721c2]);}else{_0x3442c3['checkIsBlackListIvr'](_[_0x070e('0x117')](_0x52f13e[_0x6721c2],[_0x070e('0xca'),'Contact.phone']))['then'](_0x3442c3[_0x070e('0x1d5')](_0x1b3737,_0x52f13e[_0x6721c2]))['catch'](_0x3442c3[_0x070e('0xc4')]('[actionOriginateIvr]\x20',_0x1b3737));}}}})[_0x070e('0xab')](loggerGetContactDialer('[getContactCampaign2]',_0x1b3737,_0xcb1589));}};Dialer[_0x070e('0xa0')][_0x070e('0x142')]=function(_0x65b87a,_0x1bba37){var _0x5bbb2d=this;var _0x1a380a=[];var _0x308e56=_0x1bba37>=0x1?_0x1bba37:0x1;var _0x53f9ee=[];if(_0x65b87a[_0x070e('0x50')]==='booked'){_0x308e56=0x1;}var _0x39c142=Math[_0x070e('0x1b7')](_0x65b87a[_0x070e('0x48')]*_0x308e56)-_0x65b87a['originated']-_0x65b87a[_0x070e('0x1ec')];emitVoiceQueueSummary(_0x65b87a);if(_0x65b87a[_0x070e('0x1f1')]>0x0){var _0x586369=_0x65b87a[_0x070e('0x1f1')]-_0x65b87a[_0x070e('0x65')]-_0x65b87a[_0x070e('0x4c')]-_0x65b87a[_0x070e('0x1ec')]-_0x65b87a[_0x070e('0x1f2')];if(_0x39c142>_0x586369){_0x39c142=_0x586369;}}if(_0x39c142>0x0){if(_0x65b87a[_0x070e('0x50')]===_0x070e('0x146')){_0x39c142=0x1;}if(_0x39c142>this['maxNumberOriginate']){_0x39c142=this[_0x070e('0x1f')];}_0x65b87a[_0x070e('0x1ec')]+=_0x39c142;for(var _0x4b852d in this[_0x070e('0x1d')]){if(this[_0x070e('0x1d')][_0x070e('0xa6')](_0x4b852d)){if(this[_0x070e('0x1d')][_0x4b852d][_0x070e('0x9c')]===_0x070e('0x1f3')&&this[_0x070e('0x1d')][_0x4b852d][_0x070e('0xaa')]===_0x070e('0xd0')){_0x1a380a[_0x070e('0x138')](this['agents'][_0x4b852d]['id']);}}}this[_0x070e('0xbb')](_0x65b87a['id'],_0x1a380a,_0x39c142,_0x65b87a[_0x070e('0x1ed')])[_0x070e('0xb2')](function(_0x5bdf1b){_0x65b87a[_0x070e('0x1ec')]-=_0x39c142;_0x65b87a[_0x070e('0x1ec')]=_0x65b87a[_0x070e('0x1ec')]>0x0?_0x65b87a[_0x070e('0x1ec')]:0x0;if(!checkContactEmpty(_0x5bdf1b)){_0x5bbb2d[_0x070e('0xb0')](_0x65b87a)['then'](sendMessageReschedule(_0x65b87a))['catch'](loggerCatch(_0x070e('0xb3')));}else{_0x65b87a['originated']+=_0x5bdf1b[_0x070e('0x120')];_0x65b87a['message']=_0x65b87a['dialMethod']===_0x070e('0x146')?'ACTIVE':_0x070e('0x1ee');for(var _0x9370cc=0x0;_0x9370cc<_0x5bdf1b[_0x070e('0x120')];_0x9370cc+=0x1){if(_[_0x070e('0xa8')](_0x5bdf1b[_0x9370cc])||_[_0x070e('0xa8')](_0x5bdf1b[_0x9370cc][_0x070e('0x158')])||_[_0x070e('0xa8')](_0x5bdf1b[_0x9370cc][_0x070e('0x158')][_0x070e('0x159')])){_0x5bbb2d[_0x070e('0xc5')](_0x070e('0x1f0'),_0x65b87a,_0x5bdf1b[_0x9370cc]);}else{_0x5bbb2d[_0x070e('0xb4')](_[_0x070e('0x117')](_0x5bdf1b[_0x9370cc],['VoiceQueueId','Contact.phone']))['then'](_0x5bbb2d[_0x070e('0x1d5')](_0x65b87a,_0x5bdf1b[_0x9370cc]))[_0x070e('0xab')](_0x5bbb2d[_0x070e('0xc4')](_0x070e('0x1f0'),_0x65b87a));}}}})['catch'](loggerGetContactDialer(_0x070e('0x1f4'),_0x65b87a,_0x39c142));}};Dialer[_0x070e('0xa0')][_0x070e('0x87')]=function(_0x228ad6){var _0x661e9d=this;if(_0x228ad6['dialLimitQueue']>0x0){var _0x1476c4=_0x228ad6[_0x070e('0x1f1')]-_0x228ad6[_0x070e('0x65')]-_0x228ad6[_0x070e('0x4c')];if(_0x1476c4>0x0){this['tryOriginatePredictive'](_0x228ad6);}else{loggerPredictiveCalls[_0x070e('0x71')](_0x070e('0x1f5'));}}else{this[_0x070e('0x1f6')](_0x228ad6);}};Dialer['prototype'][_0x070e('0x1f6')]=function(_0x419251){var _0xab0a1e=this;var _0x2114d5=[];_0x419251[_0x070e('0x65')]+=0x1;for(var _0xd53e36 in this[_0x070e('0x1d')]){if(this[_0x070e('0x1d')][_0x070e('0xa6')](_0xd53e36)){if(this[_0x070e('0x1d')][_0xd53e36][_0x070e('0x9c')]==='not_inuse'&&this[_0x070e('0x1d')][_0xd53e36][_0x070e('0xaa')]===_0x070e('0xd0')){_0x2114d5['push'](this[_0x070e('0x1d')][_0xd53e36]['id']);}}}this['getContactDialer'](_0x419251['id'],_0x2114d5,0x1,_0x419251[_0x070e('0x1ed')])[_0x070e('0xb2')](function(_0x587c9e){if(!checkContactEmpty(_0x587c9e)){checkContactLowerLimitOriginate(_0x419251,0x1,0x0);_0xab0a1e[_0x070e('0xb0')](_0x419251)[_0x070e('0xb2')](sendMessageReschedule(_0x419251))[_0x070e('0xab')](loggerCatch(_0x070e('0xb3')));}else{_0x419251['message']='RUNNING';if(_[_0x070e('0xa8')](_0x587c9e[0x0])||_[_0x070e('0xa8')](_0x587c9e[0x0][_0x070e('0x158')])||_[_0x070e('0xa8')](_0x587c9e[0x0][_0x070e('0x158')][_0x070e('0x159')])){_0xab0a1e[_0x070e('0xc5')](_0x070e('0x1f0'),_0x419251,_0x587c9e[0x0]);}else{_0xab0a1e[_0x070e('0xb4')](_['pick'](_0x587c9e[0x0],[_0x070e('0xc9'),_0x070e('0x1f7')]))[_0x070e('0xb2')](_0xab0a1e[_0x070e('0x1d5')](_0x419251,_0x587c9e[0x0]))['catch'](_0xab0a1e[_0x070e('0xc4')](_0x070e('0x1f8'),_0x419251));}}})[_0x070e('0xab')](loggerGetContactDialer(_0x070e('0x1f9'),_0x419251,0x1));emitVoiceQueueSummary(_0x419251);};Dialer[_0x070e('0xa0')][_0x070e('0x1ca')]=function(_0x11cec2,_0x2cc8b3,_0x22fd35,_0x936b78,_0x2477fe,_0x5ef561){loggerPredictive[_0x070e('0x71')]('--------\x20Drop\x20Rate\x20--------');loggerPredictive['info']('M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x11cec2);loggerPredictive['info'](_0x070e('0x1fa'),_0x2cc8b3);loggerPredictive[_0x070e('0x71')](_0x070e('0x1fb'),_0x22fd35);loggerPredictive[_0x070e('0x71')]('P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x936b78);loggerPredictive[_0x070e('0x71')](_0x070e('0x1fc'),_0x2477fe);loggerPredictive[_0x070e('0x71')]('---------------------------');return new BPromise(function(_0x161add,_0x554eeb){if(_0x11cec2<=0x0||isNaN(_0x11cec2)){return _0x554eeb(msgResponse(_0x070e('0x1fd'),_0x070e('0x41'),_0x070e('0x1fe')+_0x11cec2));}if(_0x22fd35<=0x0||isNaN(_0x22fd35)){return _0x554eeb(msgResponse('[abandonmentRate]',_0x070e('0x41'),'Ts\x20=\x20'+_0x22fd35));}if(_0x936b78<=0x0||isNaN(_0x936b78)){return _0x554eeb(msgResponse(_0x070e('0x1fd'),_0x070e('0x41'),_0x070e('0x1ff')+_0x936b78));}if(_0x2cc8b3<=0x0||isNaN(_0x2cc8b3)){return _0x554eeb(msgResponse('[abandonmentRate]',_0x070e('0x41'),'interval\x20=\x20'+_0x2cc8b3));}if(_0x2477fe<=0x0||isNaN(_0x2477fe)){return _0x554eeb(msgResponse(_0x070e('0x1fd'),_0x070e('0x41'),'Amax\x20=\x20'+_0x2477fe));}_0x5ef561=_0x5ef561||0x0;var _0x271de6=0x1/_0x22fd35;var _0x59244c=0x0;var _0x6e8a3c=0x0;var _0x30dac2=0x0;var _0xa8cab8=0x0;for(var _0x1ef2a5=0x0;_0x30dac2<_0x2477fe;_0x1ef2a5+=0x1){_0x6e8a3c=_0x1ef2a5/_0x2cc8b3;_0x59244c=(_0x936b78*_0x6e8a3c+_0x5ef561)/_0x271de6;_0x30dac2=erlangb(_0x59244c,_0x11cec2);_0xa8cab8=_0x59244c/_0x11cec2*(0x1-erlangb(_0x59244c,_0x11cec2));}return _0x161add({'erlangCalls':_0x1ef2a5,'erlangCallToSecond':_0x2cc8b3/_0x1ef2a5,'erlangAbandonmentRate':_0x30dac2,'erlangBusyFactor':_0xa8cab8});});};Dialer[_0x070e('0xa0')]['busyFactor']=function(_0x15454f,_0xe5f08,_0x3f38ec,_0x3d898e,_0x2b66aa,_0x1ab3ae){loggerPredictive[_0x070e('0x71')](_0x070e('0x200'));loggerPredictive[_0x070e('0x71')]('M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x15454f);loggerPredictive['info'](_0x070e('0x1fa'),_0xe5f08);loggerPredictive[_0x070e('0x71')](_0x070e('0x1fb'),_0x3f38ec);loggerPredictive['info'](_0x070e('0x201'),_0x3d898e);loggerPredictive[_0x070e('0x71')]('Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x2b66aa);loggerPredictive[_0x070e('0x71')](_0x070e('0x79'));return new BPromise(function(_0x430386,_0xfb91fc){if(_0x15454f<=0x0||isNaN(_0x15454f)){return _0xfb91fc(msgResponse('[busyFactor]',_0x070e('0x41'),_0x070e('0x1fe')+_0x15454f));}if(_0x3f38ec<=0x0||isNaN(_0x3f38ec)){return _0xfb91fc(msgResponse(_0x070e('0x202'),'Error',_0x070e('0x203')+_0x3f38ec));}if(_0x3d898e<=0x0||isNaN(_0x3d898e)){return _0xfb91fc(msgResponse('[busyFactor]',_0x070e('0x41'),'p\x20=\x20'+_0x3d898e));}if(_0xe5f08<=0x0||isNaN(_0xe5f08)){return _0xfb91fc(msgResponse(_0x070e('0x202'),_0x070e('0x41'),_0x070e('0x204')+_0xe5f08));}if(_0x2b66aa<=0x0||isNaN(_0x2b66aa)){return _0xfb91fc(msgResponse(_0x070e('0x202'),_0x070e('0x41'),_0x070e('0x205')+_0x2b66aa));}_0x1ab3ae=_0x1ab3ae||0x0;var _0x23f6a2=0x1/_0x3f38ec;var _0x32acf7=0x0;var _0x1ad516=0x0;var _0x5c52ec=0x0;var _0x54571b=0x0;for(var _0x427f82=0x0;_0x54571b<_0x2b66aa;_0x427f82+=0x1){_0x1ad516=_0x427f82/_0xe5f08;_0x32acf7=(_0x3d898e*_0x1ad516+_0x1ab3ae)/_0x23f6a2;_0x5c52ec=erlangb(_0x32acf7,_0x15454f);_0x54571b=_0x32acf7/_0x15454f*(0x1-erlangb(_0x32acf7,_0x15454f));}return _0x430386({'erlangCalls':_0x427f82,'erlangCallToSecond':_0xe5f08/_0x427f82,'erlangAbandonmentRate':_0x5c52ec,'erlangBusyFactor':_0x54571b});});};module[_0x070e('0x206')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/queueCallerAbandon.js b/server/services/ami/dialer/queueCallerAbandon.js index f99eb21..5778818 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 _0x0725=['membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','scheduledat','type','campaigntype','countbusyretry','countnoanswerretry','countglobal','countcongestionretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','uniqueid','calleridname','name','calleridnum','number','responsetime','droptime','endtime','starttime','holdtime','queue'];(function(_0x2aadcb,_0x18c38f){var _0x23d389=function(_0xfef752){while(--_0xfef752){_0x2aadcb['push'](_0x2aadcb['shift']());}};_0x23d389(++_0x18c38f);}(_0x0725,0x188));var _0x5072=function(_0xd05cb2,_0x1aad32){_0xd05cb2=_0xd05cb2-0x0;var _0x88aadc=_0x0725[_0xd05cb2];return _0x88aadc;};'use strict';var util=require(_0x5072('0x0'));var _=require(_0x5072('0x1'));var moment=require(_0x5072('0x2'));function getSeconds(_0x3ab746,_0x321918){var _0x5c1413=moment(_0x3ab746)['milliseconds'](0x0);var _0xd54858=moment(_0x321918)[_0x5072('0x3')](0x0);return _0x5c1413[_0x5072('0x4')](_0xd54858,'seconds');}function QueueCallerAbandon(_0x2b8eb,_0x232862){this[_0x5072('0x5')]=_0x2b8eb['scheduledat'];this[_0x5072('0x6')]=_0x2b8eb['type'];this[_0x5072('0x7')]=_0x2b8eb[_0x5072('0x6')]==='outbound'?'queue':_0x2b8eb[_0x5072('0x6')];this['countbusyretry']=_0x2b8eb[_0x5072('0x8')];this['countcongestionretry']=_0x2b8eb['countcongestionretry'];this[_0x5072('0x9')]=_0x2b8eb[_0x5072('0x9')];this[_0x5072('0xa')]=_0x2b8eb[_0x5072('0x8')]+_0x2b8eb[_0x5072('0xb')]+_0x2b8eb['countnoanswerretry']+_0x2b8eb[_0x5072('0xc')]+_0x2b8eb[_0x5072('0xd')]+_0x2b8eb[_0x5072('0xe')]+_0x2b8eb['countmachineretry']+_0x2b8eb[_0x5072('0xf')];this[_0x5072('0xc')]=_0x2b8eb[_0x5072('0xc')];this[_0x5072('0xd')]=_0x2b8eb['countdropretry'];this[_0x5072('0xe')]=_0x2b8eb[_0x5072('0xe')];this[_0x5072('0x10')]=_0x2b8eb['countmachineretry'];this[_0x5072('0xf')]=_0x2b8eb[_0x5072('0xf')];this[_0x5072('0x11')]=_0x232862[_0x5072('0x11')];this[_0x5072('0x12')]=_0x2b8eb[_0x5072('0x13')];this[_0x5072('0x14')]=_0x2b8eb[_0x5072('0x15')];this['starttime']=_0x2b8eb['starttime'];this[_0x5072('0x16')]=_0x2b8eb['responsetime'];this['droptime']=_0x2b8eb[_0x5072('0x17')];this[_0x5072('0x18')]=this[_0x5072('0x17')];this['ringtime']=getSeconds(_0x2b8eb['responsetime'],_0x2b8eb[_0x5072('0x19')]);this[_0x5072('0x1a')]=getSeconds(this[_0x5072('0x17')],_0x2b8eb[_0x5072('0x16')]);this['talktime']=0x0;this['queue']=_0x232862[_0x5072('0x1b')];this[_0x5072('0x1c')]=_0x232862[_0x5072('0x1d')];this[_0x5072('0x1e')]=_0x232862[_0x5072('0x1e')];this['callback']=_0x2b8eb[_0x5072('0x1f')];this[_0x5072('0x20')]=_0x2b8eb[_0x5072('0x20')];this[_0x5072('0x21')]=_0x2b8eb[_0x5072('0x21')];this[_0x5072('0x22')]=_0x2b8eb[_0x5072('0x22')];this[_0x5072('0x23')]=_0x2b8eb['ContactId'];this[_0x5072('0x24')]=_0x2b8eb[_0x5072('0x24')];this['UserId']=_0x2b8eb['UserId'];this[_0x5072('0x25')]=_0x2b8eb[_0x5072('0x25')];this[_0x5072('0x26')]=_0x2b8eb[_0x5072('0x26')];this[_0x5072('0x27')]=_0x2b8eb[_0x5072('0x27')]||'';this[_0x5072('0x28')]=_0x2b8eb[_0x5072('0x28')]||'';}module[_0x5072('0x29')]=QueueCallerAbandon; \ No newline at end of file +var _0xe00f=['CampaignId','originatecalleridnum','exports','util','milliseconds','diff','seconds','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countglobal','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','uniqueid','calleridname','calleridnum','number','starttime','responsetime','droptime','endtime','ringtime','holdtime','talktime','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId'];(function(_0x5c9939,_0x5f1deb){var _0x6ce458=function(_0x40dd6c){while(--_0x40dd6c){_0x5c9939['push'](_0x5c9939['shift']());}};_0x6ce458(++_0x5f1deb);}(_0xe00f,0x7e));var _0xfe00=function(_0x2c0dc0,_0x19900d){_0x2c0dc0=_0x2c0dc0-0x0;var _0x4c0990=_0xe00f[_0x2c0dc0];return _0x4c0990;};'use strict';var util=require(_0xfe00('0x0'));var _=require('lodash');var moment=require('moment');function getSeconds(_0x282107,_0x2728d9){var _0x5f5312=moment(_0x282107)['milliseconds'](0x0);var _0xaa6f4=moment(_0x2728d9)[_0xfe00('0x1')](0x0);return _0x5f5312[_0xfe00('0x2')](_0xaa6f4,_0xfe00('0x3'));}function QueueCallerAbandon(_0x458b4a,_0x5afa24){this[_0xfe00('0x4')]=_0x458b4a[_0xfe00('0x4')];this[_0xfe00('0x5')]=_0x458b4a['type'];this[_0xfe00('0x6')]=_0x458b4a[_0xfe00('0x5')]===_0xfe00('0x7')?_0xfe00('0x8'):_0x458b4a['type'];this[_0xfe00('0x9')]=_0x458b4a[_0xfe00('0x9')];this[_0xfe00('0xa')]=_0x458b4a[_0xfe00('0xa')];this['countnoanswerretry']=_0x458b4a['countnoanswerretry'];this[_0xfe00('0xb')]=_0x458b4a[_0xfe00('0x9')]+_0x458b4a[_0xfe00('0xa')]+_0x458b4a[_0xfe00('0xc')]+_0x458b4a[_0xfe00('0xd')]+_0x458b4a[_0xfe00('0xe')]+_0x458b4a[_0xfe00('0xf')]+_0x458b4a['countmachineretry']+_0x458b4a[_0xfe00('0x10')];this[_0xfe00('0xd')]=_0x458b4a[_0xfe00('0xd')];this[_0xfe00('0xe')]=_0x458b4a[_0xfe00('0xe')];this[_0xfe00('0xf')]=_0x458b4a['countabandonedretry'];this[_0xfe00('0x11')]=_0x458b4a[_0xfe00('0x11')];this[_0xfe00('0x10')]=_0x458b4a[_0xfe00('0x10')];this[_0xfe00('0x12')]=_0x5afa24['uniqueid'];this[_0xfe00('0x13')]=_0x458b4a['name'];this[_0xfe00('0x14')]=_0x458b4a[_0xfe00('0x15')];this[_0xfe00('0x16')]=_0x458b4a[_0xfe00('0x16')];this[_0xfe00('0x17')]=_0x458b4a[_0xfe00('0x17')];this[_0xfe00('0x18')]=_0x458b4a[_0xfe00('0x18')];this[_0xfe00('0x19')]=this[_0xfe00('0x18')];this[_0xfe00('0x1a')]=getSeconds(_0x458b4a[_0xfe00('0x17')],_0x458b4a[_0xfe00('0x16')]);this[_0xfe00('0x1b')]=getSeconds(this[_0xfe00('0x18')],_0x458b4a[_0xfe00('0x17')]);this[_0xfe00('0x1c')]=0x0;this[_0xfe00('0x8')]=_0x5afa24['queue'];this[_0xfe00('0x1d')]=_0x5afa24[_0xfe00('0x1e')];this[_0xfe00('0x1f')]=_0x5afa24[_0xfe00('0x1f')];this['callback']=_0x458b4a[_0xfe00('0x20')];this[_0xfe00('0x21')]=_0x458b4a[_0xfe00('0x21')];this[_0xfe00('0x22')]=_0x458b4a['callbackat'];this[_0xfe00('0x23')]=_0x458b4a[_0xfe00('0x23')];this[_0xfe00('0x24')]=_0x458b4a['ContactId'];this[_0xfe00('0x25')]=_0x458b4a['ListId'];this['UserId']=_0x458b4a['UserId'];this['VoiceQueueId']=_0x458b4a['VoiceQueueId'];this[_0xfe00('0x26')]=_0x458b4a['CampaignId'];this[_0xfe00('0x27')]=_0x458b4a[_0xfe00('0x27')]||'';this['originatecalleridname']=_0x458b4a['originatecalleridname']||'';}module[_0xfe00('0x28')]=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 71d8b2e..5a607d5 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 _0xa659=['moment','uniqueid','channel','format','tech','Trunk','name','fax','localstationid','path','AttachmentId','lodash'];(function(_0x5ca353,_0x21eb37){var _0x4f2fe5=function(_0x14cd1b){while(--_0x14cd1b){_0x5ca353['push'](_0x5ca353['shift']());}};_0x4f2fe5(++_0x21eb37);}(_0xa659,0x14f));var _0x9a65=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa659[_0x3dd15e];return _0x231fd0;};'use strict';var util=require('util');var _=require(_0x9a65('0x0'));var moment=require(_0x9a65('0x1'));function Action(_0x279e9b,_0x1b57fd,_0x3607a1){this[_0x9a65('0x2')]=_0x279e9b||undefined;this[_0x9a65('0x3')]=util[_0x9a65('0x4')]('%s/%s/%s',_0x1b57fd[_0x9a65('0x5')],_0x1b57fd[_0x9a65('0x6')][_0x9a65('0x7')],_0x3607a1[_0x9a65('0x8')]);this[_0x9a65('0x9')]=_0x1b57fd[_0x9a65('0x9')];this['headerinfo']=_0x1b57fd['headerinfo'];this[_0x9a65('0xa')]=_0x3607a1[_0x9a65('0xa')];this['AttachmentId']=_0x3607a1[_0x9a65('0xb')];}module['exports']=Action; \ No newline at end of file +var _0xaaf8=['tech','Trunk','fax','localstationid','path','AttachmentId','util','lodash','uniqueid','channel','format','%s/%s/%s'];(function(_0x3b150c,_0x2f93f8){var _0x5cd414=function(_0x26305e){while(--_0x26305e){_0x3b150c['push'](_0x3b150c['shift']());}};_0x5cd414(++_0x2f93f8);}(_0xaaf8,0x7e));var _0x8aaf=function(_0x277fa3,_0x3b2dde){_0x277fa3=_0x277fa3-0x0;var _0x2e4520=_0xaaf8[_0x277fa3];return _0x2e4520;};'use strict';var util=require(_0x8aaf('0x0'));var _=require(_0x8aaf('0x1'));var moment=require('moment');function Action(_0x2b63b7,_0x3b386b,_0x4b18b0){this[_0x8aaf('0x2')]=_0x2b63b7||undefined;this[_0x8aaf('0x3')]=util[_0x8aaf('0x4')](_0x8aaf('0x5'),_0x3b386b[_0x8aaf('0x6')],_0x3b386b[_0x8aaf('0x7')]['name'],_0x4b18b0[_0x8aaf('0x8')]);this[_0x8aaf('0x9')]=_0x3b386b['localstationid'];this['headerinfo']=_0x3b386b['headerinfo'];this[_0x8aaf('0xa')]=_0x4b18b0[_0x8aaf('0xa')];this[_0x8aaf('0xb')]=_0x4b18b0['AttachmentId'];}module['exports']=Action; \ No newline at end of file diff --git a/server/services/ami/fax/index.js b/server/services/ami/fax/index.js index 1d55e03..ac1124b 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 _0x2826=['Fax\x20received','[Fax][execOriginate][failure]','checkTrunk','Trunk','format','execute','%s/%s.tif','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','execOriginate','addVariables','ext','isTrunkReachable','isNil','active','SIP/%s','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20work]','Trunk\x20not\x20working','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','exports','util','lodash','bluebird','moment','path','tiff2pdf','./util/gs','../ami','./rpcDb','./channel','./util/util','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','faxAccounts','trunks','actions','newchannel','syncNewchannel','bind','syncVarSet','newstate','syncNewState','newexten','syncNewExten','syncFaxStatus','syncReceiveFax','hangup','syncHangup','originateresponse','syncOriginateResponse','prototype','context','from-voip-provider','hasOwnProperty','exten','localstationid','channels','uniqueid','channel','name','\x20syncNewchannel\x20','variable','value','channelstate','channelstatedesc','operation','status','filename','info','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','create','parse','.pdf','application/pdf','then','fax','error','catch','\x20receiveFax\x20','stringify','pick','AttachmentId','update','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','faxstatus','faxstatusstring','send','FaxAccountId','[Fax][execOriginate][success]'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x2826,0x103));var _0x6282=function(_0x502fb0,_0x2c46eb){_0x502fb0=_0x502fb0-0x0;var _0x39e759=_0x2826[_0x502fb0];return _0x39e759;};'use strict';var util=require(_0x6282('0x0'));var _=require(_0x6282('0x1'));var BPromise=require(_0x6282('0x2'));var uuid=require('uuid');var moment=require(_0x6282('0x3'));var path=require(_0x6282('0x4'));var tiff2pdf=require(_0x6282('0x5'));var gs=require(_0x6282('0x6'));var logger=require('../../../config/logger')('fax');var ami=require(_0x6282('0x7'));var rpcDb=require(_0x6282('0x8'));var Channel=require(_0x6282('0x9'));var ut=require(_0x6282('0xa'));var Action=require(_0x6282('0xb'));var faxAccount=require(_0x6282('0xc'));var attachment=require(_0x6282('0xd'));var faxMessage=require(_0x6282('0xe'));function Fax(_0x199c31){this['channels']={};this[_0x6282('0xf')]=_0x199c31[_0x6282('0xf')];this[_0x6282('0x10')]=_0x199c31[_0x6282('0x10')];this[_0x6282('0x11')]={};ami['on'](_0x6282('0x12'),this[_0x6282('0x13')][_0x6282('0x14')](this));ami['on']('varset',this[_0x6282('0x15')][_0x6282('0x14')](this));ami['on'](_0x6282('0x16'),this[_0x6282('0x17')]['bind'](this));ami['on'](_0x6282('0x18'),this[_0x6282('0x19')][_0x6282('0x14')](this));ami['on']('faxstatus',this[_0x6282('0x1a')][_0x6282('0x14')](this));ami['on']('receivefax',this[_0x6282('0x1b')][_0x6282('0x14')](this));ami['on'](_0x6282('0x1c'),this[_0x6282('0x1d')][_0x6282('0x14')](this));ami['on'](_0x6282('0x1e'),this[_0x6282('0x1f')][_0x6282('0x14')](this));}Fax[_0x6282('0x20')]['syncNewchannel']=function(_0x55123f){if(_0x55123f[_0x6282('0x21')]===_0x6282('0x22')){for(var _0x387fe1 in this[_0x6282('0xf')]){if(this['faxAccounts'][_0x6282('0x23')](_0x387fe1)){if(_0x55123f[_0x6282('0x24')]===this[_0x6282('0xf')][_0x387fe1][_0x6282('0x25')]){this[_0x6282('0x26')][_0x55123f['uniqueid']]={};this[_0x6282('0x26')][_0x55123f[_0x6282('0x27')]][_0x6282('0x28')]=_0x55123f[_0x6282('0x28')];this[_0x6282('0x26')][_0x55123f['uniqueid']]['id']=this[_0x6282('0xf')][_0x387fe1]['id'];this[_0x6282('0x26')][_0x55123f[_0x6282('0x27')]][_0x6282('0x29')]=this['faxAccounts'][_0x387fe1][_0x6282('0x29')];logger['info'](_0x55123f[_0x6282('0x27')],_0x6282('0x2a'));}}}}if(this[_0x6282('0x11')][_0x55123f[_0x6282('0x27')]]){this['channels'][_0x55123f[_0x6282('0x27')]]={};this[_0x6282('0x26')][_0x55123f['uniqueid']]['channel']=_0x55123f[_0x6282('0x28')];logger['info'](_0x55123f[_0x6282('0x27')],'\x20syncNewchannel\x20');}};Fax['prototype']['syncVarSet']=function(_0x1493af){if(this[_0x6282('0x26')][_0x1493af[_0x6282('0x27')]]){for(var _0x111c97 in _0x1493af[_0x6282('0x2b')]){if(_0x1493af['variable'][_0x6282('0x23')](_0x111c97)){this[_0x6282('0x26')][_0x1493af[_0x6282('0x27')]][_0x111c97]=_0x1493af[_0x6282('0x2c')];}}}};Fax['prototype'][_0x6282('0x17')]=function(_0x5c4f3f){if(this[_0x6282('0x26')][_0x5c4f3f[_0x6282('0x27')]]){this['channels'][_0x5c4f3f[_0x6282('0x27')]]['channelstate']=_0x5c4f3f[_0x6282('0x2d')];this[_0x6282('0x26')][_0x5c4f3f['uniqueid']]['channelstatedesc']=_0x5c4f3f[_0x6282('0x2e')];}};Fax[_0x6282('0x20')][_0x6282('0x19')]=function(_0x25ee34){if(this['channels'][_0x25ee34[_0x6282('0x27')]]){for(var _0x55c528 in _0x25ee34[_0x6282('0x2b')]){if(_0x25ee34[_0x6282('0x2b')]['hasOwnProperty'](_0x55c528)){this['channels'][_0x25ee34[_0x6282('0x27')]][_0x55c528]=_0x25ee34[_0x6282('0x2c')];}}}};Fax[_0x6282('0x20')][_0x6282('0x1a')]=function(_0x2321a0){if(this['channels'][_0x2321a0[_0x6282('0x27')]]){this[_0x6282('0x26')][_0x2321a0[_0x6282('0x27')]][_0x6282('0x2f')]=_0x2321a0[_0x6282('0x2f')];this[_0x6282('0x26')][_0x2321a0[_0x6282('0x27')]][_0x6282('0x30')]=_0x2321a0[_0x6282('0x30')];this[_0x6282('0x26')][_0x2321a0[_0x6282('0x27')]][_0x6282('0x25')]=_0x2321a0[_0x6282('0x25')];this['channels'][_0x2321a0[_0x6282('0x27')]]['filename']=_0x2321a0[_0x6282('0x31')];logger[_0x6282('0x32')](_0x2321a0[_0x6282('0x27')],_0x6282('0x33'));}};Fax['prototype'][_0x6282('0x1b')]=function(_0x33bfe6){var _0x5533fe=this;if(this[_0x6282('0x26')][_0x33bfe6[_0x6282('0x27')]]){var _0x54a2fa=this[_0x6282('0x26')][_0x33bfe6[_0x6282('0x27')]]['id'];this['channels'][_0x33bfe6['uniqueid']][_0x6282('0x34')]=_0x33bfe6[_0x6282('0x34')];this['channels'][_0x33bfe6['uniqueid']][_0x6282('0x35')]=_0x33bfe6[_0x6282('0x35')];this['channels'][_0x33bfe6[_0x6282('0x27')]][_0x6282('0x25')]=_0x33bfe6[_0x6282('0x25')];this[_0x6282('0x26')][_0x33bfe6['uniqueid']]['resolution']=_0x33bfe6[_0x6282('0x36')];this['channels'][_0x33bfe6['uniqueid']][_0x6282('0x37')]=_0x33bfe6[_0x6282('0x37')];this[_0x6282('0x26')][_0x33bfe6['uniqueid']][_0x6282('0x31')]=_0x33bfe6[_0x6282('0x31')];this[_0x6282('0x26')][_0x33bfe6[_0x6282('0x27')]][_0x6282('0x38')]=_0x33bfe6[_0x6282('0x38')];if(this[_0x6282('0x26')][_0x33bfe6['uniqueid']][_0x6282('0x35')]>0x0){tiff2pdf(_0x33bfe6[_0x6282('0x31')],_0x6282('0x39'),function(_0x1e9c27){logger['info'](_0x33bfe6['uniqueid'],_0x6282('0x3a'),_0x1e9c27[_0x6282('0x3b')]);attachment[_0x6282('0x3c')]({'name':path[_0x6282('0x3d')](_0x33bfe6[_0x6282('0x31')])[_0x6282('0x29')],'basename':path[_0x6282('0x3d')](_0x33bfe6[_0x6282('0x31')])[_0x6282('0x29')]+_0x6282('0x3e'),'type':_0x6282('0x3f')})[_0x6282('0x40')](function(_0x497d70){faxAccount['notify'](_0x54a2fa,{'from':_0x33bfe6[_0x6282('0x38')],'mapKey':_0x6282('0x41'),'body':path[_0x6282('0x3d')](_0x33bfe6[_0x6282('0x31')])[_0x6282('0x29')]+_0x6282('0x3e'),'AttachmentId':_0x497d70['id']})['catch'](function(_0x513795){logger[_0x6282('0x42')](_0x33bfe6[_0x6282('0x27')],'\x20notify\x20',JSON['stringify'](_0x513795));});})[_0x6282('0x43')](function(_0x40dd22){logger[_0x6282('0x42')](_0x33bfe6[_0x6282('0x27')],_0x6282('0x44'),JSON[_0x6282('0x45')](_0x40dd22));});});}logger[_0x6282('0x32')](_0x33bfe6[_0x6282('0x27')],_0x6282('0x44'));}};Fax[_0x6282('0x20')]['syncOriginateResponse']=function(_0x1667cd){if(this[_0x6282('0x11')][_0x1667cd[_0x6282('0x27')]]){_['merge'](this[_0x6282('0x26')][_0x1667cd[_0x6282('0x27')]],_[_0x6282('0x46')](_0x1667cd,['response','reason']));}};function updateStatus(_0x4fb24c){if(_0x4fb24c[_0x6282('0x47')]){faxMessage[_0x6282('0x48')](_0x4fb24c[_0x6282('0x47')],{'failMessage':_0x6282('0x49')})[_0x6282('0x40')](function(_0x479018){ut[_0x6282('0x4a')](_0x6282('0x4b'),_0x479018);})[_0x6282('0x43')](function(_0x1a9251){ut[_0x6282('0x4a')](_0x6282('0x4c'),_0x1a9251);});}else{ut['logger']('[Fax][Message][Error][NoUpdate2]');}}Fax['prototype'][_0x6282('0x4d')]=function(_0x96e419,_0x38a3f7,_0x1d2ad5){var _0x53ca5a=this;var _0xe242fb={};if(_0x38a3f7){_0xe242fb={'read':_0x38a3f7};}else{_0xe242fb={'failMessage':_0x1d2ad5};}if(this[_0x6282('0x11')][_0x96e419]['AttachmentId']){faxMessage['update'](this[_0x6282('0x11')][_0x96e419][_0x6282('0x47')],_0xe242fb)['then'](function(_0x318af6){ut['logger'](_0x6282('0x4e'),_0x318af6);})[_0x6282('0x43')](function(_0x51d913){ut[_0x6282('0x4a')](_0x6282('0x4f'),_0x51d913);})['finally'](function(){delete _0x53ca5a[_0x6282('0x26')][_0x96e419];delete _0x53ca5a[_0x6282('0x11')][_0x96e419];});}else{ut[_0x6282('0x4a')](_0x6282('0x50'));delete this[_0x6282('0x26')][_0x96e419];delete this[_0x6282('0x11')][_0x96e419];}};Fax['prototype'][_0x6282('0x1d')]=function(_0x26c76f){var _0x458c54=this;if(this[_0x6282('0x26')][_0x26c76f[_0x6282('0x27')]]){if(this[_0x6282('0x11')][_0x26c76f['uniqueid']]){this[_0x6282('0x26')][_0x26c76f['uniqueid']]['id']=this[_0x6282('0x11')][_0x26c76f['uniqueid']]['id'];this['channels'][_0x26c76f[_0x6282('0x27')]][_0x6282('0x29')]=this[_0x6282('0x11')][_0x26c76f[_0x6282('0x27')]][_0x6282('0x29')];}logger['info'](_0x26c76f[_0x6282('0x27')],this[_0x6282('0x11')][_0x26c76f[_0x6282('0x27')]]?_0x6282('0x51'):_0x6282('0x52'),JSON[_0x6282('0x45')](this[_0x6282('0x26')][_0x26c76f[_0x6282('0x27')]]));if(this[_0x6282('0x11')][_0x26c76f['uniqueid']]){if(this[_0x6282('0x26')][_0x26c76f[_0x6282('0x27')]][_0x6282('0x53')]>0x0&&this[_0x6282('0x26')][_0x26c76f[_0x6282('0x27')]][_0x6282('0x54')]==='SUCCESS'){this[_0x6282('0x4d')](_0x26c76f[_0x6282('0x27')],!![]);}else{this['updateStatus'](_0x26c76f[_0x6282('0x27')],![],this[_0x6282('0x26')][_0x26c76f[_0x6282('0x27')]][_0x6282('0x55')]?'SENDING\x20FAILED:\x20'+this[_0x6282('0x26')][_0x26c76f[_0x6282('0x27')]]['faxstatusstring']:'SENDING\x20FAILED');}}}};Fax['prototype'][_0x6282('0x56')]=function(_0xefd960){var _0x263f13=this;return new BPromise(function(_0x2b5780,_0x136500){_0x263f13['execOriginate'](_0xefd960,_0x263f13[_0x6282('0xf')][_0xefd960[_0x6282('0x57')]])['then'](function(_0xc6aab7){ut[_0x6282('0x4a')](_0x6282('0x58'),_0xc6aab7);_0x2b5780(ut[_0x6282('0x3b')](_0x6282('0x59')));})[_0x6282('0x43')](function(_0x2c4764){ut[_0x6282('0x4a')](_0x6282('0x5a'),_0x2c4764);updateStatus(_0xefd960);_0x136500(ut[_0x6282('0x3b')]('Fax\x20failed'));});});};Fax['prototype']['checkAfterSend']=function(_0x55db9c){var _0x52cfaa=this;return new BPromise(function(_0x341c0f,_0x512a01){var _0x9e5dea=_0x52cfaa[_0x6282('0x5b')](_0x52cfaa['faxAccounts'][_0x55db9c['FaxAccountId']][_0x6282('0x5c')],_0x55db9c);if(_0x9e5dea['isValid']){_0x341c0f(ut[_0x6282('0x3b')]('Trunk\x20Reachable'));}else{_0x512a01(ut[_0x6282('0x3b')](_0x9e5dea[_0x6282('0x3b')]));}});};function originate(_0x446048,_0x5489ca,_0x239ecc){return new BPromise(function(_0xd96e7a,_0x5a71fe){if(_0x239ecc){var _0x1e3fb0=util[_0x6282('0x5d')]('gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit',path[_0x6282('0x3d')](_0x446048[_0x6282('0x4')])[_0x6282('0x29')],_0x446048[_0x6282('0x4')]);gs[_0x6282('0x5e')](_0x1e3fb0)[_0x6282('0x40')](function(){_0x446048[_0x6282('0x4')]=util[_0x6282('0x5d')](_0x6282('0x5f'),path[_0x6282('0x3d')](_0x446048[_0x6282('0x4')])['dir'],path[_0x6282('0x3d')](_0x446048[_0x6282('0x4')])[_0x6282('0x29')]);_0x5489ca[_0x6282('0x60')]=_0x446048[_0x6282('0x4')];ut[_0x6282('0x4a')](_0x6282('0x61'),'');ami[_0x6282('0x62')](ut[_0x6282('0x63')](_0x446048,_0x5489ca))[_0x6282('0x40')](function(_0x7e4156){_0xd96e7a(_0x7e4156);})[_0x6282('0x43')](function(_0x484fdf){_0x5a71fe(_0x484fdf);});})['catch'](function(_0x1c68cf){_0x5a71fe(_0x1c68cf);});}else{ami['Action'](ut[_0x6282('0x63')](_0x446048,_0x5489ca))[_0x6282('0x40')](function(_0x30cd75){_0xd96e7a(_0x30cd75);})['catch'](function(_0x5ef3df){_0x5a71fe(_0x5ef3df);});}});}Fax[_0x6282('0x20')][_0x6282('0x64')]=function(_0x14174b,_0x59c2bc){var _0x54826c=this;return new BPromise(function(_0x3d2096,_0x141943){var _0x4d9fbd=uuid['v4']();var _0x32186e=ut[_0x6282('0x65')](_0x14174b,_0x59c2bc);_0x54826c[_0x6282('0x11')][_0x4d9fbd]=new Action(_0x4d9fbd,_0x59c2bc,_0x14174b);var _0x4417e5=_0x54826c[_0x6282('0x11')][_0x4d9fbd];if(path[_0x6282('0x3d')](_0x14174b[_0x6282('0x4')])[_0x6282('0x66')]===_0x6282('0x3e')){originate(_0x4417e5,_0x32186e,!![])['then'](function(_0x128963){_0x3d2096(_0x128963);})['catch'](function(_0x1fe831){_0x141943(_0x1fe831);});}else{originate(_0x4417e5,_0x32186e,![])[_0x6282('0x40')](function(_0x21706b){_0x3d2096(_0x21706b);})[_0x6282('0x43')](function(_0x5aa39a){_0x141943(_0x5aa39a);});}});};Fax[_0x6282('0x20')][_0x6282('0x67')]=function(_0x326a1d){return!_[_0x6282('0x68')](_0x326a1d)&&!_[_0x6282('0x68')](_0x326a1d[_0x6282('0x29')])&&!_[_0x6282('0x68')](_0x326a1d[_0x6282('0x69')])&&_0x326a1d['active']&&!_['isNil'](this['trunks'][util[_0x6282('0x5d')](_0x6282('0x6a'),_0x326a1d[_0x6282('0x29')])])&&!_[_0x6282('0x68')](this[_0x6282('0x10')][util[_0x6282('0x5d')]('SIP/%s',_0x326a1d[_0x6282('0x29')])][_0x6282('0x30')])&&(this[_0x6282('0x10')][util[_0x6282('0x5d')]('SIP/%s',_0x326a1d['name'])][_0x6282('0x30')]==='reachable'||this['trunks'][util['format'](_0x6282('0x6a'),_0x326a1d[_0x6282('0x29')])][_0x6282('0x30')]===_0x6282('0x6b'));};Fax[_0x6282('0x20')][_0x6282('0x5b')]=function(_0x3da2d,_0x3131b8){if(!this[_0x6282('0x67')](_0x3da2d)){ut['logger'](_0x6282('0x6c'),_[_0x6282('0x68')](_0x3da2d)?'':_0x3da2d['name']+'\x20Trunk\x20is\x20not\x20active');return{'isValid':![],'message':_0x6282('0x6d')};}if(_['isNil'](_0x3131b8[_0x6282('0x41')])){ut[_0x6282('0x4a')](_0x6282('0x6e'),JSON[_0x6282('0x45')](_0x3131b8));return{'isValid':![],'message':_0x6282('0x6f')};}if(_[_0x6282('0x68')](_0x3131b8[_0x6282('0x4')])){ut[_0x6282('0x4a')](_0x6282('0x70'),JSON['stringify'](_0x3131b8));return{'isValid':![],'message':_0x6282('0x71')};}return{'isValid':!![],'message':_0x6282('0x72')};};module[_0x6282('0x73')]=Fax; \ No newline at end of file +var _0x36fe=['stringify','\x20receiveFax\x20','merge','pick','response','AttachmentId','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','update','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','execOriginate','FaxAccountId','[Fax][execOriginate][success]','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','checkTrunk','Trunk','isValid','Trunk\x20Reachable','format','execute','%s/%s.tif','dir','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','isTrunkReachable','isNil','active','SIP/%s','reachable','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','exports','util','lodash','uuid','moment','path','tiff2pdf','./util/gs','../../../config/logger','../ami','./channel','./util/util','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','actions','newchannel','syncNewchannel','varset','syncVarSet','bind','newstate','newexten','syncNewExten','faxstatus','receivefax','syncHangup','originateresponse','syncOriginateResponse','prototype','context','from-voip-provider','hasOwnProperty','exten','uniqueid','channel','name','info','\x20syncNewchannel\x20','variable','channelstate','channelstatedesc','value','operation','status','localstationid','filename','\x20syncFaxStatus\x20','syncReceiveFax','remotestationid','pagestransferred','resolution','transferrate','/var/opt/motion2/server/files/attachments/','message','parse','.pdf','application/pdf','then','notify','calleridnum','fax','catch','error'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x36fe,0x131));var _0xe36f=function(_0x2bf5d1,_0x14e28f){_0x2bf5d1=_0x2bf5d1-0x0;var _0x3472c6=_0x36fe[_0x2bf5d1];return _0x3472c6;};'use strict';var util=require(_0xe36f('0x0'));var _=require(_0xe36f('0x1'));var BPromise=require('bluebird');var uuid=require(_0xe36f('0x2'));var moment=require(_0xe36f('0x3'));var path=require(_0xe36f('0x4'));var tiff2pdf=require(_0xe36f('0x5'));var gs=require(_0xe36f('0x6'));var logger=require(_0xe36f('0x7'))('fax');var ami=require(_0xe36f('0x8'));var rpcDb=require('./rpcDb');var Channel=require(_0xe36f('0x9'));var ut=require(_0xe36f('0xa'));var Action=require(_0xe36f('0xb'));var faxAccount=require(_0xe36f('0xc'));var attachment=require(_0xe36f('0xd'));var faxMessage=require(_0xe36f('0xe'));function Fax(_0x1c0037){this[_0xe36f('0xf')]={};this[_0xe36f('0x10')]=_0x1c0037[_0xe36f('0x10')];this[_0xe36f('0x11')]=_0x1c0037[_0xe36f('0x11')];this[_0xe36f('0x12')]={};ami['on'](_0xe36f('0x13'),this[_0xe36f('0x14')]['bind'](this));ami['on'](_0xe36f('0x15'),this[_0xe36f('0x16')][_0xe36f('0x17')](this));ami['on'](_0xe36f('0x18'),this['syncNewState']['bind'](this));ami['on'](_0xe36f('0x19'),this[_0xe36f('0x1a')][_0xe36f('0x17')](this));ami['on'](_0xe36f('0x1b'),this['syncFaxStatus'][_0xe36f('0x17')](this));ami['on'](_0xe36f('0x1c'),this['syncReceiveFax'][_0xe36f('0x17')](this));ami['on']('hangup',this[_0xe36f('0x1d')][_0xe36f('0x17')](this));ami['on'](_0xe36f('0x1e'),this[_0xe36f('0x1f')]['bind'](this));}Fax[_0xe36f('0x20')][_0xe36f('0x14')]=function(_0x1c14eb){if(_0x1c14eb[_0xe36f('0x21')]===_0xe36f('0x22')){for(var _0x3f5544 in this['faxAccounts']){if(this[_0xe36f('0x10')][_0xe36f('0x23')](_0x3f5544)){if(_0x1c14eb[_0xe36f('0x24')]===this[_0xe36f('0x10')][_0x3f5544]['localstationid']){this[_0xe36f('0xf')][_0x1c14eb[_0xe36f('0x25')]]={};this[_0xe36f('0xf')][_0x1c14eb[_0xe36f('0x25')]][_0xe36f('0x26')]=_0x1c14eb['channel'];this[_0xe36f('0xf')][_0x1c14eb[_0xe36f('0x25')]]['id']=this[_0xe36f('0x10')][_0x3f5544]['id'];this[_0xe36f('0xf')][_0x1c14eb[_0xe36f('0x25')]][_0xe36f('0x27')]=this[_0xe36f('0x10')][_0x3f5544][_0xe36f('0x27')];logger[_0xe36f('0x28')](_0x1c14eb[_0xe36f('0x25')],'\x20syncNewchannel\x20');}}}}if(this['actions'][_0x1c14eb[_0xe36f('0x25')]]){this[_0xe36f('0xf')][_0x1c14eb[_0xe36f('0x25')]]={};this[_0xe36f('0xf')][_0x1c14eb[_0xe36f('0x25')]][_0xe36f('0x26')]=_0x1c14eb[_0xe36f('0x26')];logger['info'](_0x1c14eb[_0xe36f('0x25')],_0xe36f('0x29'));}};Fax[_0xe36f('0x20')][_0xe36f('0x16')]=function(_0x6692c2){if(this[_0xe36f('0xf')][_0x6692c2[_0xe36f('0x25')]]){for(var _0x1b7395 in _0x6692c2[_0xe36f('0x2a')]){if(_0x6692c2[_0xe36f('0x2a')][_0xe36f('0x23')](_0x1b7395)){this[_0xe36f('0xf')][_0x6692c2['uniqueid']][_0x1b7395]=_0x6692c2['value'];}}}};Fax[_0xe36f('0x20')]['syncNewState']=function(_0x4f7d2d){if(this['channels'][_0x4f7d2d['uniqueid']]){this[_0xe36f('0xf')][_0x4f7d2d[_0xe36f('0x25')]][_0xe36f('0x2b')]=_0x4f7d2d[_0xe36f('0x2b')];this[_0xe36f('0xf')][_0x4f7d2d['uniqueid']][_0xe36f('0x2c')]=_0x4f7d2d[_0xe36f('0x2c')];}};Fax[_0xe36f('0x20')][_0xe36f('0x1a')]=function(_0x40e664){if(this['channels'][_0x40e664[_0xe36f('0x25')]]){for(var _0x5771cc in _0x40e664[_0xe36f('0x2a')]){if(_0x40e664[_0xe36f('0x2a')][_0xe36f('0x23')](_0x5771cc)){this['channels'][_0x40e664[_0xe36f('0x25')]][_0x5771cc]=_0x40e664[_0xe36f('0x2d')];}}}};Fax[_0xe36f('0x20')]['syncFaxStatus']=function(_0x10db00){if(this['channels'][_0x10db00[_0xe36f('0x25')]]){this[_0xe36f('0xf')][_0x10db00[_0xe36f('0x25')]][_0xe36f('0x2e')]=_0x10db00['operation'];this['channels'][_0x10db00[_0xe36f('0x25')]][_0xe36f('0x2f')]=_0x10db00[_0xe36f('0x2f')];this[_0xe36f('0xf')][_0x10db00[_0xe36f('0x25')]][_0xe36f('0x30')]=_0x10db00[_0xe36f('0x30')];this[_0xe36f('0xf')][_0x10db00[_0xe36f('0x25')]][_0xe36f('0x31')]=_0x10db00[_0xe36f('0x31')];logger[_0xe36f('0x28')](_0x10db00[_0xe36f('0x25')],_0xe36f('0x32'));}};Fax[_0xe36f('0x20')][_0xe36f('0x33')]=function(_0x1b5f2b){var _0x4a2202=this;if(this[_0xe36f('0xf')][_0x1b5f2b['uniqueid']]){var _0x58af30=this[_0xe36f('0xf')][_0x1b5f2b['uniqueid']]['id'];this[_0xe36f('0xf')][_0x1b5f2b[_0xe36f('0x25')]]['remotestationid']=_0x1b5f2b[_0xe36f('0x34')];this[_0xe36f('0xf')][_0x1b5f2b[_0xe36f('0x25')]][_0xe36f('0x35')]=_0x1b5f2b[_0xe36f('0x35')];this[_0xe36f('0xf')][_0x1b5f2b[_0xe36f('0x25')]][_0xe36f('0x30')]=_0x1b5f2b[_0xe36f('0x30')];this[_0xe36f('0xf')][_0x1b5f2b['uniqueid']]['resolution']=_0x1b5f2b[_0xe36f('0x36')];this['channels'][_0x1b5f2b[_0xe36f('0x25')]][_0xe36f('0x37')]=_0x1b5f2b['transferrate'];this[_0xe36f('0xf')][_0x1b5f2b[_0xe36f('0x25')]][_0xe36f('0x31')]=_0x1b5f2b[_0xe36f('0x31')];this['channels'][_0x1b5f2b['uniqueid']]['calleridnum']=_0x1b5f2b['calleridnum'];if(this[_0xe36f('0xf')][_0x1b5f2b['uniqueid']][_0xe36f('0x35')]>0x0){tiff2pdf(_0x1b5f2b[_0xe36f('0x31')],_0xe36f('0x38'),function(_0x3cb07e){logger[_0xe36f('0x28')](_0x1b5f2b[_0xe36f('0x25')],'\x20result\x20conversion\x20file\x20',_0x3cb07e[_0xe36f('0x39')]);attachment['create']({'name':path['parse'](_0x1b5f2b['filename'])[_0xe36f('0x27')],'basename':path[_0xe36f('0x3a')](_0x1b5f2b[_0xe36f('0x31')])[_0xe36f('0x27')]+_0xe36f('0x3b'),'type':_0xe36f('0x3c')})[_0xe36f('0x3d')](function(_0x2d0b2e){faxAccount[_0xe36f('0x3e')](_0x58af30,{'from':_0x1b5f2b[_0xe36f('0x3f')],'mapKey':_0xe36f('0x40'),'body':path[_0xe36f('0x3a')](_0x1b5f2b[_0xe36f('0x31')])['name']+'.pdf','AttachmentId':_0x2d0b2e['id']})[_0xe36f('0x41')](function(_0x35cbe0){logger[_0xe36f('0x42')](_0x1b5f2b[_0xe36f('0x25')],'\x20notify\x20',JSON[_0xe36f('0x43')](_0x35cbe0));});})[_0xe36f('0x41')](function(_0x558ca9){logger[_0xe36f('0x42')](_0x1b5f2b['uniqueid'],_0xe36f('0x44'),JSON[_0xe36f('0x43')](_0x558ca9));});});}logger[_0xe36f('0x28')](_0x1b5f2b['uniqueid'],_0xe36f('0x44'));}};Fax[_0xe36f('0x20')]['syncOriginateResponse']=function(_0x3aca95){if(this['actions'][_0x3aca95[_0xe36f('0x25')]]){_[_0xe36f('0x45')](this['channels'][_0x3aca95[_0xe36f('0x25')]],_[_0xe36f('0x46')](_0x3aca95,[_0xe36f('0x47'),'reason']));}};function updateStatus(_0x42d871){if(_0x42d871[_0xe36f('0x48')]){faxMessage['update'](_0x42d871[_0xe36f('0x48')],{'failMessage':_0xe36f('0x49')})['then'](function(_0x552a8a){ut[_0xe36f('0x4a')](_0xe36f('0x4b'),_0x552a8a);})['catch'](function(_0x4cc867){ut[_0xe36f('0x4a')](_0xe36f('0x4c'),_0x4cc867);});}else{ut[_0xe36f('0x4a')](_0xe36f('0x4d'));}}Fax[_0xe36f('0x20')][_0xe36f('0x4e')]=function(_0x1f7424,_0x3b816e,_0x2273d8){var _0x40bc3b=this;var _0x26c282={};if(_0x3b816e){_0x26c282={'read':_0x3b816e};}else{_0x26c282={'failMessage':_0x2273d8};}if(this[_0xe36f('0x12')][_0x1f7424][_0xe36f('0x48')]){faxMessage[_0xe36f('0x4f')](this[_0xe36f('0x12')][_0x1f7424]['AttachmentId'],_0x26c282)[_0xe36f('0x3d')](function(_0x1bd1a8){ut['logger'](_0xe36f('0x50'),_0x1bd1a8);})[_0xe36f('0x41')](function(_0x1160c7){ut[_0xe36f('0x4a')](_0xe36f('0x51'),_0x1160c7);})[_0xe36f('0x52')](function(){delete _0x40bc3b[_0xe36f('0xf')][_0x1f7424];delete _0x40bc3b[_0xe36f('0x12')][_0x1f7424];});}else{ut[_0xe36f('0x4a')](_0xe36f('0x53'));delete this['channels'][_0x1f7424];delete this[_0xe36f('0x12')][_0x1f7424];}};Fax[_0xe36f('0x20')][_0xe36f('0x1d')]=function(_0x550e70){var _0x1633f4=this;if(this[_0xe36f('0xf')][_0x550e70[_0xe36f('0x25')]]){if(this[_0xe36f('0x12')][_0x550e70['uniqueid']]){this['channels'][_0x550e70['uniqueid']]['id']=this['actions'][_0x550e70[_0xe36f('0x25')]]['id'];this['channels'][_0x550e70[_0xe36f('0x25')]][_0xe36f('0x27')]=this[_0xe36f('0x12')][_0x550e70[_0xe36f('0x25')]][_0xe36f('0x27')];}logger[_0xe36f('0x28')](_0x550e70['uniqueid'],this[_0xe36f('0x12')][_0x550e70[_0xe36f('0x25')]]?_0xe36f('0x54'):_0xe36f('0x55'),JSON['stringify'](this[_0xe36f('0xf')][_0x550e70['uniqueid']]));if(this[_0xe36f('0x12')][_0x550e70[_0xe36f('0x25')]]){if(this['channels'][_0x550e70[_0xe36f('0x25')]][_0xe36f('0x56')]>0x0&&this['channels'][_0x550e70[_0xe36f('0x25')]][_0xe36f('0x1b')]===_0xe36f('0x57')){this[_0xe36f('0x4e')](_0x550e70[_0xe36f('0x25')],!![]);}else{this['updateStatus'](_0x550e70[_0xe36f('0x25')],![],this[_0xe36f('0xf')][_0x550e70[_0xe36f('0x25')]][_0xe36f('0x58')]?_0xe36f('0x59')+this[_0xe36f('0xf')][_0x550e70[_0xe36f('0x25')]][_0xe36f('0x58')]:_0xe36f('0x5a'));}}}};Fax['prototype'][_0xe36f('0x5b')]=function(_0x4cf58c){var _0x208ec6=this;return new BPromise(function(_0x581343,_0x45f006){_0x208ec6[_0xe36f('0x5c')](_0x4cf58c,_0x208ec6[_0xe36f('0x10')][_0x4cf58c[_0xe36f('0x5d')]])[_0xe36f('0x3d')](function(_0x35e980){ut[_0xe36f('0x4a')](_0xe36f('0x5e'),_0x35e980);_0x581343(ut[_0xe36f('0x39')]('Fax\x20received'));})[_0xe36f('0x41')](function(_0x538b08){ut['logger'](_0xe36f('0x5f'),_0x538b08);updateStatus(_0x4cf58c);_0x45f006(ut['message'](_0xe36f('0x60')));});});};Fax[_0xe36f('0x20')][_0xe36f('0x61')]=function(_0x10c7f9){var _0x312c65=this;return new BPromise(function(_0x426ef0,_0x39a2e2){var _0x170fb5=_0x312c65[_0xe36f('0x62')](_0x312c65['faxAccounts'][_0x10c7f9[_0xe36f('0x5d')]][_0xe36f('0x63')],_0x10c7f9);if(_0x170fb5[_0xe36f('0x64')]){_0x426ef0(ut[_0xe36f('0x39')](_0xe36f('0x65')));}else{_0x39a2e2(ut[_0xe36f('0x39')](_0x170fb5[_0xe36f('0x39')]));}});};function originate(_0x431743,_0x5d6e16,_0x5a2167){return new BPromise(function(_0x1de66b,_0xcd3ff6){if(_0x5a2167){var _0x5d24df=util[_0xe36f('0x66')]('gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit',path[_0xe36f('0x3a')](_0x431743['path'])[_0xe36f('0x27')],_0x431743[_0xe36f('0x4')]);gs[_0xe36f('0x67')](_0x5d24df)['then'](function(){_0x431743[_0xe36f('0x4')]=util[_0xe36f('0x66')](_0xe36f('0x68'),path[_0xe36f('0x3a')](_0x431743[_0xe36f('0x4')])[_0xe36f('0x69')],path[_0xe36f('0x3a')](_0x431743[_0xe36f('0x4')])[_0xe36f('0x27')]);_0x5d6e16['XMF-PATH']=_0x431743[_0xe36f('0x4')];ut['logger'](_0xe36f('0x6a'),'');ami[_0xe36f('0x6b')](ut[_0xe36f('0x6c')](_0x431743,_0x5d6e16))[_0xe36f('0x3d')](function(_0xd6bd59){_0x1de66b(_0xd6bd59);})[_0xe36f('0x41')](function(_0x4431e1){_0xcd3ff6(_0x4431e1);});})[_0xe36f('0x41')](function(_0x45c595){_0xcd3ff6(_0x45c595);});}else{ami[_0xe36f('0x6b')](ut[_0xe36f('0x6c')](_0x431743,_0x5d6e16))[_0xe36f('0x3d')](function(_0x181342){_0x1de66b(_0x181342);})['catch'](function(_0x68abd6){_0xcd3ff6(_0x68abd6);});}});}Fax[_0xe36f('0x20')][_0xe36f('0x5c')]=function(_0x57336b,_0x48212e){var _0x4bb380=this;return new BPromise(function(_0x14713f,_0x45674f){var _0x3662d4=uuid['v4']();var _0x4df6d1=ut[_0xe36f('0x6d')](_0x57336b,_0x48212e);_0x4bb380[_0xe36f('0x12')][_0x3662d4]=new Action(_0x3662d4,_0x48212e,_0x57336b);var _0x132d2e=_0x4bb380[_0xe36f('0x12')][_0x3662d4];if(path['parse'](_0x57336b[_0xe36f('0x4')])['ext']==='.pdf'){originate(_0x132d2e,_0x4df6d1,!![])[_0xe36f('0x3d')](function(_0xab1287){_0x14713f(_0xab1287);})[_0xe36f('0x41')](function(_0x21ce16){_0x45674f(_0x21ce16);});}else{originate(_0x132d2e,_0x4df6d1,![])['then'](function(_0x31aba5){_0x14713f(_0x31aba5);})[_0xe36f('0x41')](function(_0x52e26d){_0x45674f(_0x52e26d);});}});};Fax[_0xe36f('0x20')][_0xe36f('0x6e')]=function(_0x2128ef){return!_[_0xe36f('0x6f')](_0x2128ef)&&!_[_0xe36f('0x6f')](_0x2128ef['name'])&&!_[_0xe36f('0x6f')](_0x2128ef['active'])&&_0x2128ef[_0xe36f('0x70')]&&!_[_0xe36f('0x6f')](this[_0xe36f('0x11')][util[_0xe36f('0x66')]('SIP/%s',_0x2128ef[_0xe36f('0x27')])])&&!_[_0xe36f('0x6f')](this[_0xe36f('0x11')][util[_0xe36f('0x66')](_0xe36f('0x71'),_0x2128ef[_0xe36f('0x27')])][_0xe36f('0x2f')])&&(this[_0xe36f('0x11')][util['format'](_0xe36f('0x71'),_0x2128ef[_0xe36f('0x27')])][_0xe36f('0x2f')]===_0xe36f('0x72')||this['trunks'][util[_0xe36f('0x66')]('SIP/%s',_0x2128ef[_0xe36f('0x27')])][_0xe36f('0x2f')]===_0xe36f('0x73'));};Fax['prototype'][_0xe36f('0x62')]=function(_0x24213e,_0x328050){if(!this[_0xe36f('0x6e')](_0x24213e)){ut[_0xe36f('0x4a')](_0xe36f('0x74'),_[_0xe36f('0x6f')](_0x24213e)?'':_0x24213e[_0xe36f('0x27')]+_0xe36f('0x75'));return{'isValid':![],'message':_0xe36f('0x76')};}if(_['isNil'](_0x328050[_0xe36f('0x40')])){ut[_0xe36f('0x4a')](_0xe36f('0x77'),JSON['stringify'](_0x328050));return{'isValid':![],'message':_0xe36f('0x78')};}if(_[_0xe36f('0x6f')](_0x328050[_0xe36f('0x4')])){ut[_0xe36f('0x4a')](_0xe36f('0x79'),JSON['stringify'](_0x328050));return{'isValid':![],'message':_0xe36f('0x7a')};}return{'isValid':!![],'message':'Is\x20Valid'};};module[_0xe36f('0x7b')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index aa96002..0885721 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 _0xaf80=['error','inspect','notify','resolve','then','catch','[Notify]\x20','util','../../../config/logger','preview','lodash'];(function(_0x2ca980,_0x2e8c30){var _0xc5c3f7=function(_0x79ec28){while(--_0x79ec28){_0x2ca980['push'](_0x2ca980['shift']());}};_0xc5c3f7(++_0x2e8c30);}(_0xaf80,0x167));var _0x0af8=function(_0x102e80,_0x5bf53b){_0x102e80=_0x102e80-0x0;var _0xc0aa0e=_0xaf80[_0x102e80];return _0xc0aa0e;};'use strict';var util=require(_0x0af8('0x0'));var BPromise=require('bluebird');var logger=require(_0x0af8('0x1'))(_0x0af8('0x2'));var _=require(_0x0af8('0x3'));var faxAccount=require('../rpc/faxAccount');function loggerCatch(_0x42a5fd){return function(_0x4d521c){logger[_0x0af8('0x4')](_0x42a5fd,util[_0x0af8('0x5')](_0x4d521c,{'showHidden':![],'depth':null}));};}exports[_0x0af8('0x6')]=function(_0x55d2a0,_0x36f741){return BPromise[_0x0af8('0x7')]()[_0x0af8('0x8')](faxAccount[_0x0af8('0x6')](_0x55d2a0,_0x36f741))[_0x0af8('0x9')](loggerCatch(_0x0af8('0xa')));}; \ No newline at end of file +var _0x99a5=['error','inspect','notify','util','bluebird','../../../config/logger','preview','lodash','../rpc/faxAccount'];(function(_0x204133,_0x5a58ec){var _0x44b6fb=function(_0x261174){while(--_0x261174){_0x204133['push'](_0x204133['shift']());}};_0x44b6fb(++_0x5a58ec);}(_0x99a5,0xd2));var _0x599a=function(_0x4201de,_0x43ac07){_0x4201de=_0x4201de-0x0;var _0x3fef97=_0x99a5[_0x4201de];return _0x3fef97;};'use strict';var util=require(_0x599a('0x0'));var BPromise=require(_0x599a('0x1'));var logger=require(_0x599a('0x2'))(_0x599a('0x3'));var _=require(_0x599a('0x4'));var faxAccount=require(_0x599a('0x5'));function loggerCatch(_0x3dc9d5){return function(_0x713e39){logger[_0x599a('0x6')](_0x3dc9d5,util[_0x599a('0x7')](_0x713e39,{'showHidden':![],'depth':null}));};}exports['notify']=function(_0x15c61e,_0x3747af){return BPromise['resolve']()['then'](faxAccount[_0x599a('0x8')](_0x15c61e,_0x3747af))['catch'](loggerCatch('[Notify]\x20'));}; \ 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 ec918c1..c12c654 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 _0x2519=['util','../../../../config/logger','fax','bluebird','child_process','exec','execute','info','Exec\x20gs','\x20Error\x20:','inspect'];(function(_0x4f6464,_0x19ce0b){var _0x2970c0=function(_0x30b705){while(--_0x30b705){_0x4f6464['push'](_0x4f6464['shift']());}};_0x2970c0(++_0x19ce0b);}(_0x2519,0x176));var _0x9251=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x2519[_0x20a584];return _0x4b41a8;};'use strict';var util=require(_0x9251('0x0'));var logger=require(_0x9251('0x1'))(_0x9251('0x2'));var BPromise=require(_0x9251('0x3'));var exec=require(_0x9251('0x4'))[_0x9251('0x5')];exports[_0x9251('0x6')]=function(_0xd52a50){return new BPromise(function(_0x37eb0c,_0x1a4adc){exec(_0xd52a50,function(_0x320935,_0x129575,_0x257ffb){logger[_0x9251('0x7')](_0x9251('0x8'),_0x129575);if(_0x320935){logger[_0x9251('0x7')](_0x9251('0x8'),_0x9251('0x9'),util[_0x9251('0xa')](_0x320935,{'showHidden':![],'depth':null}),_0x129575,_0x257ffb);_0x1a4adc(_0x320935);}_0x37eb0c(_0x129575);});});}; \ No newline at end of file +var _0x6309=['bluebird','child_process','execute','info','Exec\x20gs','\x20Error\x20:','util','../../../../config/logger','fax'];(function(_0x4f85c7,_0x513e99){var _0x4b62e9=function(_0x47641f){while(--_0x47641f){_0x4f85c7['push'](_0x4f85c7['shift']());}};_0x4b62e9(++_0x513e99);}(_0x6309,0x72));var _0x9630=function(_0x26efac,_0x21ab8a){_0x26efac=_0x26efac-0x0;var _0x8482e4=_0x6309[_0x26efac];return _0x8482e4;};'use strict';var util=require(_0x9630('0x0'));var logger=require(_0x9630('0x1'))(_0x9630('0x2'));var BPromise=require(_0x9630('0x3'));var exec=require(_0x9630('0x4'))['exec'];exports[_0x9630('0x5')]=function(_0x2de296){return new BPromise(function(_0x2bb7ec,_0xf44e40){exec(_0x2de296,function(_0xcec72f,_0x4ce40f,_0x817f15){logger[_0x9630('0x6')](_0x9630('0x7'),_0x4ce40f);if(_0xcec72f){logger[_0x9630('0x6')](_0x9630('0x7'),_0x9630('0x8'),util['inspect'](_0xcec72f,{'showHidden':![],'depth':null}),_0x4ce40f,_0x817f15);_0xf44e40(_0xcec72f);}_0x2bb7ec(_0x4ce40f);});});}; \ 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 aae18e1..11393c1 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 _0xbee3=['uniqueid','originate','channel','xcally-motion-fax','from-sip','\x22%s\x22\x20<%s>','lodash','fax','message','logger','inspect','addVariables','ecm','headerinfo','minrate','maxrate','format','modem','gateway','faxdetect','t38timeout','localstationid','path'];(function(_0x2bbb33,_0x431da6){var _0x4521e9=function(_0x3ac25e){while(--_0x3ac25e){_0x2bbb33['push'](_0x2bbb33['shift']());}};_0x4521e9(++_0x431da6);}(_0xbee3,0xd5));var _0x3bee=function(_0x14fbb1,_0x31e2b6){_0x14fbb1=_0x14fbb1-0x0;var _0x16fdf2=_0xbee3[_0x14fbb1];return _0x16fdf2;};'use strict';var util=require('util');var _=require(_0x3bee('0x0'));var moment=require('moment');var logger=require('../../../../config/logger')(_0x3bee('0x1'));exports[_0x3bee('0x2')]=function(_0x4945a7){return{'message':_0x4945a7};};exports[_0x3bee('0x3')]=function(_0x1956c1,_0x1cf379){logger['info'](_0x1956c1,util[_0x3bee('0x4')](_0x1cf379,{'showHidden':![],'depth':null}));};exports[_0x3bee('0x5')]=function(_0x4c5ef5,_0x2fdeec){var _0x28d912={'XMF-ECM':_0x2fdeec[_0x3bee('0x6')],'XMF-HEADERINFO':_0x2fdeec[_0x3bee('0x7')],'XMF-MINRATE':_0x2fdeec[_0x3bee('0x8')],'XMF-MAXRATE':_0x2fdeec[_0x3bee('0x9')],'XMF-MODEM':util[_0x3bee('0xa')]('\x22%s\x22',_0x2fdeec[_0x3bee('0xb')]),'XMF-GATEWAY':_0x2fdeec[_0x3bee('0xc')],'XMF-FAXDETECT':_0x2fdeec[_0x3bee('0xd')],'XMF-T38TIMEOUT':_0x2fdeec[_0x3bee('0xe')],'XMF-LOCALSTATIONID':_0x2fdeec[_0x3bee('0xf')],'XMF-PATH':_0x4c5ef5[_0x3bee('0x10')]};return _0x28d912;};exports['variablesAction']=function(_0x32c0b,_0x5bb283){return{'actionid':_0x32c0b[_0x3bee('0x11')],'action':_0x3bee('0x12'),'channel':_0x32c0b[_0x3bee('0x13')],'Exten':_0x3bee('0x14'),'Context':_0x3bee('0x15'),'Priority':'1','callerid':util[_0x3bee('0xa')](_0x3bee('0x16'),_0x32c0b['headerinfo']?_0x32c0b[_0x3bee('0x7')]:'',_0x32c0b[_0x3bee('0xf')]),'variable':_0x5bb283,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x32c0b[_0x3bee('0x11')]};}; \ No newline at end of file +var _0x34e5=['logger','info','inspect','addVariables','headerinfo','minrate','maxrate','modem','faxdetect','localstationid','path','variablesAction','uniqueid','originate','channel','xcally-motion-fax','format','\x22%s\x22\x20<%s>','lodash','../../../../config/logger','fax','message'];(function(_0x419dfc,_0x1cb79c){var _0x423e9d=function(_0x34fc37){while(--_0x34fc37){_0x419dfc['push'](_0x419dfc['shift']());}};_0x423e9d(++_0x1cb79c);}(_0x34e5,0x172));var _0x534e=function(_0x4eb178,_0x2b5847){_0x4eb178=_0x4eb178-0x0;var _0x336568=_0x34e5[_0x4eb178];return _0x336568;};'use strict';var util=require('util');var _=require(_0x534e('0x0'));var moment=require('moment');var logger=require(_0x534e('0x1'))(_0x534e('0x2'));exports[_0x534e('0x3')]=function(_0x246650){return{'message':_0x246650};};exports[_0x534e('0x4')]=function(_0x50b790,_0x11a158){logger[_0x534e('0x5')](_0x50b790,util[_0x534e('0x6')](_0x11a158,{'showHidden':![],'depth':null}));};exports[_0x534e('0x7')]=function(_0x436a92,_0x2d0370){var _0x2760e7={'XMF-ECM':_0x2d0370['ecm'],'XMF-HEADERINFO':_0x2d0370[_0x534e('0x8')],'XMF-MINRATE':_0x2d0370[_0x534e('0x9')],'XMF-MAXRATE':_0x2d0370[_0x534e('0xa')],'XMF-MODEM':util['format']('\x22%s\x22',_0x2d0370[_0x534e('0xb')]),'XMF-GATEWAY':_0x2d0370['gateway'],'XMF-FAXDETECT':_0x2d0370[_0x534e('0xc')],'XMF-T38TIMEOUT':_0x2d0370['t38timeout'],'XMF-LOCALSTATIONID':_0x2d0370[_0x534e('0xd')],'XMF-PATH':_0x436a92[_0x534e('0xe')]};return _0x2760e7;};exports[_0x534e('0xf')]=function(_0x529726,_0x1b7a5a){return{'actionid':_0x529726[_0x534e('0x10')],'action':_0x534e('0x11'),'channel':_0x529726[_0x534e('0x12')],'Exten':_0x534e('0x13'),'Context':'from-sip','Priority':'1','callerid':util[_0x534e('0x14')](_0x534e('0x15'),_0x529726[_0x534e('0x8')]?_0x529726[_0x534e('0x8')]:'',_0x529726[_0x534e('0xd')]),'variable':_0x1b7a5a,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x529726[_0x534e('0x10')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 767a2e2..6e2b810 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 _0x5e58=['moment','./server','./realtime','./report','./acw','./preview','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/freshsales','./rpc/integrations/servicenow','hour','get','resolve','then','getAgents','initAgents','getTelephones','initTelephones','getVoiceQueues','initVoiceQueues','getTriggers','initTriggers','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','getSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','initFreshsalesAccounts','getServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','initVoiceQueueHopperHistory','getCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','log','listen','sync','bluebird','util'];(function(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0x5e58,0x1d3));var _0x85e5=function(_0x2fd93c,_0x3d8354){_0x2fd93c=_0x2fd93c-0x0;var _0x127a71=_0x5e58[_0x2fd93c];return _0x127a71;};'use strict';var BPromise=require(_0x85e5('0x0'));var util=require(_0x85e5('0x1'));var moment=require(_0x85e5('0x2'));var server=require(_0x85e5('0x3'));var Realtime=require(_0x85e5('0x4'));var Report=require(_0x85e5('0x5'));var Acw=require(_0x85e5('0x6'));var Trigger=require('./trigger');var Dialer=require('./dialer');var Preview=require(_0x85e5('0x7'));var Fax=require('./fax');var user=require('./rpc/user');var voiceQueue=require(_0x85e5('0x8'));var voiceQueueReport=require(_0x85e5('0x9'));var voiceCallReport=require(_0x85e5('0xa'));var trunk=require(_0x85e5('0xb'));var trigger=require(_0x85e5('0xc'));var template=require(_0x85e5('0xd'));var cmHopperHistory=require(_0x85e5('0xe'));var campaign=require('./rpc/campaign');var voiceExtension=require('./rpc/voiceExtension');var faxAccount=require(_0x85e5('0xf'));var zendesk=require(_0x85e5('0x10'));var salesforce=require(_0x85e5('0x11'));var sugarcrm=require('./rpc/integrations/sugarcrm');var freshdesk=require('./rpc/integrations/freshdesk');var desk=require(_0x85e5('0x12'));var zoho=require(_0x85e5('0x13'));var vtiger=require('./rpc/integrations/vtiger');var freshsales=require(_0x85e5('0x14'));var servicenow=require(_0x85e5('0x15'));var dynamics365=require('./rpc/integrations/dynamics365');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()['get'](_0x85e5('0x16'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x85e5('0x17')](_0x85e5('0x16'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0x85e5('0x18')]()[_0x85e5('0x19')](user[_0x85e5('0x1a')]())['then'](realtime[_0x85e5('0x1b')]())[_0x85e5('0x19')](user[_0x85e5('0x1c')]())[_0x85e5('0x19')](realtime[_0x85e5('0x1d')]())['then'](trunk['getTrunks']())[_0x85e5('0x19')](realtime['initTrunks']())[_0x85e5('0x19')](voiceQueue[_0x85e5('0x1e')]())[_0x85e5('0x19')](realtime[_0x85e5('0x1f')]())[_0x85e5('0x19')](trigger[_0x85e5('0x20')]())[_0x85e5('0x19')](realtime[_0x85e5('0x21')]())[_0x85e5('0x19')](template['getTemplates']())['then'](realtime[_0x85e5('0x22')]())['then'](zendesk[_0x85e5('0x23')]())[_0x85e5('0x19')](realtime[_0x85e5('0x24')]())[_0x85e5('0x19')](salesforce[_0x85e5('0x25')]())['then'](realtime['initSalesforceAccounts']())[_0x85e5('0x19')](sugarcrm[_0x85e5('0x26')]())['then'](realtime['initSugarcrmAccounts']())[_0x85e5('0x19')](freshdesk[_0x85e5('0x27')]())['then'](realtime[_0x85e5('0x28')]())[_0x85e5('0x19')](desk[_0x85e5('0x29')]())[_0x85e5('0x19')](realtime[_0x85e5('0x2a')]())['then'](zoho[_0x85e5('0x2b')]())[_0x85e5('0x19')](realtime[_0x85e5('0x2c')]())[_0x85e5('0x19')](vtiger[_0x85e5('0x2d')]())[_0x85e5('0x19')](realtime[_0x85e5('0x2e')]())['then'](freshsales['getFreshsalesAccounts']())['then'](realtime[_0x85e5('0x2f')]())[_0x85e5('0x19')](servicenow[_0x85e5('0x30')]())[_0x85e5('0x19')](realtime['initServicenowAccounts']())[_0x85e5('0x19')](dynamics365[_0x85e5('0x31')]())[_0x85e5('0x19')](realtime[_0x85e5('0x32')]())[_0x85e5('0x19')](campaign[_0x85e5('0x33')]())['then'](realtime[_0x85e5('0x34')]())[_0x85e5('0x19')](voiceExtension[_0x85e5('0x35')]())[_0x85e5('0x19')](realtime[_0x85e5('0x36')]())[_0x85e5('0x19')](faxAccount[_0x85e5('0x37')]())[_0x85e5('0x19')](realtime[_0x85e5('0x38')]())[_0x85e5('0x19')](function(){return realtime;});}function initParams(){return BPromise['resolve']()[_0x85e5('0x19')](voiceQueueReport[_0x85e5('0x39')]())['then'](realtime[_0x85e5('0x3a')]())['then'](cmHopperHistory['getVoiceQueueHopperHistory']())[_0x85e5('0x19')](realtime[_0x85e5('0x3b')]())[_0x85e5('0x19')](cmHopperHistory[_0x85e5('0x3c')]())[_0x85e5('0x19')](realtime['initCampaignHopperHistory']())[_0x85e5('0x19')](voiceCallReport[_0x85e5('0x3d')]())[_0x85e5('0x19')](realtime[_0x85e5('0x3e')]())[_0x85e5('0x19')](function(_0x11253a){})[_0x85e5('0x3f')](function(_0x2439bb){console[_0x85e5('0x40')](_0x2439bb);});}function main(){return server[_0x85e5('0x41')](realtime,preview,fax)[_0x85e5('0x19')](function(_0x3bcb82){return initRealtime();})[_0x85e5('0x19')](function(){return initParams();})[_0x85e5('0x19')](function(){report[_0x85e5('0x42')]();setInterval(initRealtime,0x1388);})['catch'](function(_0x146369){console[_0x85e5('0x40')](_0x146369);});}main(); \ No newline at end of file +var _0xab10=['getVoiceExtensions','initVoiceExtensions','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','log','listen','sync','bluebird','util','moment','./server','./realtime','./acw','./trigger','./dialer','./preview','./fax','./rpc/voiceQueue','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','get','hour','resolve','getAgents','then','getTelephones','initTelephones','getTrunks','initTrunks','getVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','getZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','initDynamics365Accounts','getCampaigns','initCampaigns'];(function(_0x16d10f,_0x2ba2d5){var _0x50c823=function(_0x44e43f){while(--_0x44e43f){_0x16d10f['push'](_0x16d10f['shift']());}};_0x50c823(++_0x2ba2d5);}(_0xab10,0x181));var _0x0ab1=function(_0x4ed3d9,_0x5d7c5d){_0x4ed3d9=_0x4ed3d9-0x0;var _0x2a7ee3=_0xab10[_0x4ed3d9];return _0x2a7ee3;};'use strict';var BPromise=require(_0x0ab1('0x0'));var util=require(_0x0ab1('0x1'));var moment=require(_0x0ab1('0x2'));var server=require(_0x0ab1('0x3'));var Realtime=require(_0x0ab1('0x4'));var Report=require('./report');var Acw=require(_0x0ab1('0x5'));var Trigger=require(_0x0ab1('0x6'));var Dialer=require(_0x0ab1('0x7'));var Preview=require(_0x0ab1('0x8'));var Fax=require(_0x0ab1('0x9'));var user=require('./rpc/user');var voiceQueue=require(_0x0ab1('0xa'));var voiceQueueReport=require('./rpc/voiceQueueReport');var voiceCallReport=require(_0x0ab1('0xb'));var trunk=require(_0x0ab1('0xc'));var trigger=require(_0x0ab1('0xd'));var template=require('./rpc/template');var cmHopperHistory=require('./rpc/cmHopperHistory');var campaign=require(_0x0ab1('0xe'));var voiceExtension=require(_0x0ab1('0xf'));var faxAccount=require(_0x0ab1('0x10'));var zendesk=require(_0x0ab1('0x11'));var salesforce=require(_0x0ab1('0x12'));var sugarcrm=require(_0x0ab1('0x13'));var freshdesk=require(_0x0ab1('0x14'));var desk=require('./rpc/integrations/desk');var zoho=require(_0x0ab1('0x15'));var vtiger=require(_0x0ab1('0x16'));var freshsales=require(_0x0ab1('0x17'));var servicenow=require(_0x0ab1('0x18'));var dynamics365=require(_0x0ab1('0x19'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x0ab1('0x1a')](_0x0ab1('0x1b'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x0ab1('0x1a')](_0x0ab1('0x1b'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0x0ab1('0x1c')]()['then'](user[_0x0ab1('0x1d')]())[_0x0ab1('0x1e')](realtime['initAgents']())['then'](user[_0x0ab1('0x1f')]())[_0x0ab1('0x1e')](realtime[_0x0ab1('0x20')]())[_0x0ab1('0x1e')](trunk[_0x0ab1('0x21')]())['then'](realtime[_0x0ab1('0x22')]())[_0x0ab1('0x1e')](voiceQueue[_0x0ab1('0x23')]())[_0x0ab1('0x1e')](realtime['initVoiceQueues']())[_0x0ab1('0x1e')](trigger[_0x0ab1('0x24')]())['then'](realtime[_0x0ab1('0x25')]())['then'](template[_0x0ab1('0x26')]())[_0x0ab1('0x1e')](realtime[_0x0ab1('0x27')]())[_0x0ab1('0x1e')](zendesk[_0x0ab1('0x28')]())[_0x0ab1('0x1e')](realtime['initZendeskAccounts']())[_0x0ab1('0x1e')](salesforce[_0x0ab1('0x29')]())[_0x0ab1('0x1e')](realtime[_0x0ab1('0x2a')]())[_0x0ab1('0x1e')](sugarcrm[_0x0ab1('0x2b')]())[_0x0ab1('0x1e')](realtime[_0x0ab1('0x2c')]())['then'](freshdesk[_0x0ab1('0x2d')]())[_0x0ab1('0x1e')](realtime[_0x0ab1('0x2e')]())[_0x0ab1('0x1e')](desk[_0x0ab1('0x2f')]())['then'](realtime[_0x0ab1('0x30')]())['then'](zoho[_0x0ab1('0x31')]())['then'](realtime[_0x0ab1('0x32')]())[_0x0ab1('0x1e')](vtiger[_0x0ab1('0x33')]())[_0x0ab1('0x1e')](realtime['initVtigerAccounts']())[_0x0ab1('0x1e')](freshsales[_0x0ab1('0x34')]())[_0x0ab1('0x1e')](realtime[_0x0ab1('0x35')]())[_0x0ab1('0x1e')](servicenow[_0x0ab1('0x36')]())[_0x0ab1('0x1e')](realtime[_0x0ab1('0x37')]())['then'](dynamics365['getDynamics365Accounts']())['then'](realtime[_0x0ab1('0x38')]())[_0x0ab1('0x1e')](campaign[_0x0ab1('0x39')]())['then'](realtime[_0x0ab1('0x3a')]())['then'](voiceExtension[_0x0ab1('0x3b')]())[_0x0ab1('0x1e')](realtime[_0x0ab1('0x3c')]())[_0x0ab1('0x1e')](faxAccount['getFaxAccounts']())[_0x0ab1('0x1e')](realtime[_0x0ab1('0x3d')]())['then'](function(){return realtime;});}function initParams(){return BPromise[_0x0ab1('0x1c')]()[_0x0ab1('0x1e')](voiceQueueReport[_0x0ab1('0x3e')]())[_0x0ab1('0x1e')](realtime[_0x0ab1('0x3f')]())[_0x0ab1('0x1e')](cmHopperHistory[_0x0ab1('0x40')]())[_0x0ab1('0x1e')](realtime[_0x0ab1('0x41')]())[_0x0ab1('0x1e')](cmHopperHistory[_0x0ab1('0x42')]())['then'](realtime[_0x0ab1('0x43')]())['then'](voiceCallReport[_0x0ab1('0x44')]())[_0x0ab1('0x1e')](realtime[_0x0ab1('0x45')]())[_0x0ab1('0x1e')](function(_0x1c1e01){})[_0x0ab1('0x46')](function(_0x2a47a1){console[_0x0ab1('0x47')](_0x2a47a1);});}function main(){return server[_0x0ab1('0x48')](realtime,preview,fax)[_0x0ab1('0x1e')](function(_0x56674b){return initRealtime();})['then'](function(){return initParams();})[_0x0ab1('0x1e')](function(){report[_0x0ab1('0x49')]();setInterval(initRealtime,0x1388);})[_0x0ab1('0x46')](function(_0x1798d6){console[_0x0ab1('0x47')](_0x1798d6);});}main(); \ No newline at end of file diff --git a/server/services/ami/model/agent.js b/server/services/ami/model/agent.js index a94217e..163ddf7 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 _0x5e35=['statePause','toNumber','format','voiceStatusCallerIdNumber','interface','stringify','user:%s','emit','user:save','util','moment','md5','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','email','accountcode','fullname','unknown','stateTime','status','address','phone','mobile','online','voiceStatus','voiceStatusTime','onhold','local','prototype','updateStatusRealtime','state','toLowerCase','not_inuse','inuse','talking'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x5e35,0x1e9));var _0x55e3=function(_0x88cd7b,_0x4c884c){_0x88cd7b=_0x88cd7b-0x0;var _0x56fcc8=_0x5e35[_0x88cd7b];return _0x56fcc8;};'use strict';var _=require('lodash');var util=require(_0x55e3('0x0'));var moment=require(_0x55e3('0x1'));var md5=require(_0x55e3('0x2'));var Redis=require(_0x55e3('0x3'));var config=require(_0x55e3('0x4'));config[_0x55e3('0x5')]=_[_0x55e3('0x6')](config[_0x55e3('0x5')],{'host':_0x55e3('0x7'),'port':0x18eb});var io=require(_0x55e3('0x8'))(new Redis(config[_0x55e3('0x5')]));function Agent(_0x3eeee6){this['id']=_0x3eeee6['id']||0x0;this['name']=_0x3eeee6[_0x55e3('0x9')]||'';this[_0x55e3('0xa')]=_0x3eeee6[_0x55e3('0xa')]||'';this[_0x55e3('0xb')]=_0x3eeee6[_0x55e3('0xb')]||'';this['fullname']=_0x3eeee6[_0x55e3('0xc')]||'';this['state']=_0x55e3('0xd');this[_0x55e3('0xe')]=0x0;this[_0x55e3('0xf')]=_0x55e3('0xd');this[_0x55e3('0x10')]='';this[_0x55e3('0x11')]='';this[_0x55e3('0x12')]='';this['interface']='';this[_0x55e3('0x13')]=_0x3eeee6[_0x55e3('0x13')]||![];this[_0x55e3('0x14')]=_0x55e3('0xd');this[_0x55e3('0x15')]=0x0;this['voiceStatusCallerIdNumber']='';this['voiceStatusQueue']='';this[_0x55e3('0x16')]=![];this[_0x55e3('0x17')]=![];this[_0x55e3('0x2')]='';}Agent[_0x55e3('0x18')][_0x55e3('0x19')]=function(_0x5cb9ac){var _0x2a63e2;if(_0x5cb9ac&&_0x5cb9ac[_0x55e3('0x1a')]){_0x2a63e2=_0x5cb9ac[_0x55e3('0x1a')][_0x55e3('0x1b')]();switch(_0x2a63e2){case _0x55e3('0x1c'):_0x2a63e2='idle';break;case _0x55e3('0x1d'):_0x2a63e2=_0x55e3('0x1e');break;}}if(_0x2a63e2&&this[_0x55e3('0x14')]!==_0x2a63e2||_0x5cb9ac[_0x55e3('0x1f')]){this[_0x55e3('0x15')]=_[_0x55e3('0x20')](moment()[_0x55e3('0x21')]('x'));}if(_0x2a63e2){this['voiceStatus']=_0x2a63e2;}var _0x1f1d48={'id':this['id'],'name':this['name'],'email':this[_0x55e3('0xa')],'accountcode':this[_0x55e3('0xb')],'fullname':this['fullname'],'state':this[_0x55e3('0x1a')],'stateTime':this['stateTime'],'status':this[_0x55e3('0xf')],'address':this[_0x55e3('0x10')],'online':this['online'],'voiceStatus':this[_0x55e3('0x14')],'voiceStatusTime':this[_0x55e3('0x15')],'voiceStatusCallerIdNumber':this[_0x55e3('0x22')],'voiceStatusQueue':this['voiceStatusQueue'],'interface':this[_0x55e3('0x23')],'onhold':this[_0x55e3('0x16')]};var _0xabe917=md5(JSON[_0x55e3('0x24')](_0x1f1d48));if(this[_0x55e3('0x2')]!==_0xabe917){this[_0x55e3('0x2')]=_0xabe917;io['to'](util[_0x55e3('0x21')](_0x55e3('0x25'),_0x1f1d48[_0x55e3('0x9')]))[_0x55e3('0x26')](_0x55e3('0x27'),_0x1f1d48);}};module['exports']=Agent; \ No newline at end of file +var _0x2164=['moment','md5','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','email','accountcode','fullname','state','unknown','stateTime','status','address','mobile','interface','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','onhold','local','prototype','updateStatusRealtime','toLowerCase','not_inuse','inuse','talking','statePause','toNumber','stringify','user:%s','emit','user:save','exports','lodash'];(function(_0x540cc1,_0x48df67){var _0x154b04=function(_0x5a6008){while(--_0x5a6008){_0x540cc1['push'](_0x540cc1['shift']());}};_0x154b04(++_0x48df67);}(_0x2164,0xe9));var _0x4216=function(_0x5b3563,_0x23b2b0){_0x5b3563=_0x5b3563-0x0;var _0x3f3b67=_0x2164[_0x5b3563];return _0x3f3b67;};'use strict';var _=require(_0x4216('0x0'));var util=require('util');var moment=require(_0x4216('0x1'));var md5=require(_0x4216('0x2'));var Redis=require(_0x4216('0x3'));var config=require(_0x4216('0x4'));config[_0x4216('0x5')]=_[_0x4216('0x6')](config[_0x4216('0x5')],{'host':_0x4216('0x7'),'port':0x18eb});var io=require(_0x4216('0x8'))(new Redis(config[_0x4216('0x5')]));function Agent(_0xea0d01){this['id']=_0xea0d01['id']||0x0;this[_0x4216('0x9')]=_0xea0d01[_0x4216('0x9')]||'';this['email']=_0xea0d01[_0x4216('0xa')]||'';this['accountcode']=_0xea0d01[_0x4216('0xb')]||'';this[_0x4216('0xc')]=_0xea0d01['fullname']||'';this[_0x4216('0xd')]=_0x4216('0xe');this[_0x4216('0xf')]=0x0;this[_0x4216('0x10')]=_0x4216('0xe');this[_0x4216('0x11')]='';this['phone']='';this[_0x4216('0x12')]='';this[_0x4216('0x13')]='';this[_0x4216('0x14')]=_0xea0d01[_0x4216('0x14')]||![];this[_0x4216('0x15')]=_0x4216('0xe');this[_0x4216('0x16')]=0x0;this[_0x4216('0x17')]='';this['voiceStatusQueue']='';this[_0x4216('0x18')]=![];this[_0x4216('0x19')]=![];this['md5']='';}Agent[_0x4216('0x1a')][_0x4216('0x1b')]=function(_0x106684){var _0x2269ea;if(_0x106684&&_0x106684[_0x4216('0xd')]){_0x2269ea=_0x106684['state'][_0x4216('0x1c')]();switch(_0x2269ea){case _0x4216('0x1d'):_0x2269ea='idle';break;case _0x4216('0x1e'):_0x2269ea=_0x4216('0x1f');break;}}if(_0x2269ea&&this[_0x4216('0x15')]!==_0x2269ea||_0x106684[_0x4216('0x20')]){this[_0x4216('0x16')]=_[_0x4216('0x21')](moment()['format']('x'));}if(_0x2269ea){this[_0x4216('0x15')]=_0x2269ea;}var _0x59a58f={'id':this['id'],'name':this[_0x4216('0x9')],'email':this[_0x4216('0xa')],'accountcode':this[_0x4216('0xb')],'fullname':this[_0x4216('0xc')],'state':this[_0x4216('0xd')],'stateTime':this[_0x4216('0xf')],'status':this[_0x4216('0x10')],'address':this[_0x4216('0x11')],'online':this[_0x4216('0x14')],'voiceStatus':this[_0x4216('0x15')],'voiceStatusTime':this[_0x4216('0x16')],'voiceStatusCallerIdNumber':this[_0x4216('0x17')],'voiceStatusQueue':this['voiceStatusQueue'],'interface':this[_0x4216('0x13')],'onhold':this['onhold']};var _0x1a6228=md5(JSON[_0x4216('0x22')](_0x59a58f));if(this[_0x4216('0x2')]!==_0x1a6228){this[_0x4216('0x2')]=_0x1a6228;io['to'](util['format'](_0x4216('0x23'),_0x59a58f['name']))[_0x4216('0x24')](_0x4216('0x25'),_0x59a58f);}};module[_0x4216('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 bf36e83..9d48205 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 _0xd8b0=['dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDGreeting','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','name','campaign','originated','temp','ivrAnswerCallsDay','ivrTotalCallsDays','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency'];(function(_0x5caf7e,_0x52e1bc){var _0x5c3435=function(_0xb77e11){while(--_0xb77e11){_0x5caf7e['push'](_0x5caf7e['shift']());}};_0x5c3435(++_0x52e1bc);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';function Campaign(_0x5d04de){this['id']=_0x5d04de['id']||0x0;this[_0x0d8b('0x0')]=_0x5d04de['name']||'';this['type']=_0x5d04de['type']||_0x0d8b('0x1');this[_0x0d8b('0x2')]=0x0;this[_0x0d8b('0x3')]=0x0;this[_0x0d8b('0x4')]=0x0;this[_0x0d8b('0x5')]=0x0;this['message']='';this['sendMessageOneNotActive']=!![];this[_0x0d8b('0x6')]=_0x5d04de[_0x0d8b('0x6')];this[_0x0d8b('0x7')]=_0x5d04de['limitCalls'];this[_0x0d8b('0x8')]=_0x5d04de[_0x0d8b('0x8')]||null;this['dialGlobalInterval']=_0x5d04de[_0x0d8b('0x9')]?_0x5d04de[_0x0d8b('0x9')]:null;this[_0x0d8b('0xa')]=_0x5d04de[_0x0d8b('0xa')];this[_0x0d8b('0xb')]=_0x5d04de[_0x0d8b('0xb')];this[_0x0d8b('0xc')]=_0x5d04de[_0x0d8b('0xc')]||0x1e;this['dialCongestionMaxRetry']=_0x5d04de[_0x0d8b('0xd')];this['dialCongestionRetryFrequency']=_0x5d04de[_0x0d8b('0xe')];this[_0x0d8b('0xf')]=_0x5d04de[_0x0d8b('0xf')];this[_0x0d8b('0x10')]=_0x5d04de[_0x0d8b('0x10')];this[_0x0d8b('0x11')]=_0x5d04de[_0x0d8b('0x11')];this[_0x0d8b('0x12')]=_0x5d04de[_0x0d8b('0x12')];this[_0x0d8b('0x13')]=_0x5d04de[_0x0d8b('0x13')];this[_0x0d8b('0x14')]=_0x5d04de[_0x0d8b('0x14')]||_0x0d8b('0x15');this['dialPrefix']=_0x5d04de[_0x0d8b('0x16')]||undefined;this[_0x0d8b('0x17')]=_0x5d04de[_0x0d8b('0x17')]||undefined;this[_0x0d8b('0x18')]=_0x5d04de[_0x0d8b('0x18')]||undefined;this['TrunkBackup']=_0x5d04de[_0x0d8b('0x19')]?_0x5d04de[_0x0d8b('0x19')]:undefined;this[_0x0d8b('0x1a')]=_0x5d04de[_0x0d8b('0x1a')]?_0x5d04de[_0x0d8b('0x1a')]:undefined;this[_0x0d8b('0x1b')]=_0x5d04de[_0x0d8b('0x1b')]?_0x5d04de[_0x0d8b('0x1b')]:undefined;this['SquareProject']=_0x5d04de[_0x0d8b('0x1c')]?_0x5d04de[_0x0d8b('0x1c')]:undefined;this[_0x0d8b('0x1d')]=_0x5d04de[_0x0d8b('0x1c')]?_0x5d04de[_0x0d8b('0x1c')][_0x0d8b('0x0')]:undefined;this[_0x0d8b('0x1e')]=_0x5d04de[_0x0d8b('0x1e')]||![];this['dialAMDInitialSilence']=_0x5d04de['dialAMDInitialSilence'];this[_0x0d8b('0x1f')]=_0x5d04de['dialAMDGreeting'];this['dialAMDAfterGreetingSilence']=_0x5d04de['dialAMDAfterGreetingSilence'];this[_0x0d8b('0x20')]=_0x5d04de[_0x0d8b('0x20')];this[_0x0d8b('0x21')]=_0x5d04de[_0x0d8b('0x21')];this[_0x0d8b('0x22')]=_0x5d04de[_0x0d8b('0x22')];this[_0x0d8b('0x23')]=_0x5d04de[_0x0d8b('0x23')];this[_0x0d8b('0x24')]=_0x5d04de['dialAMDSilenceThreshold'];this[_0x0d8b('0x25')]=_0x5d04de[_0x0d8b('0x25')];}module['exports']=Campaign; \ No newline at end of file +var _0x2032=['ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialNoAnswerRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','name','type','campaign','originated','ivrAnswerCallsDay'];(function(_0x57b0a3,_0x4b9cf2){var _0x2ab4b3=function(_0x256753){while(--_0x256753){_0x57b0a3['push'](_0x57b0a3['shift']());}};_0x2ab4b3(++_0x4b9cf2);}(_0x2032,0xd9));var _0x2203=function(_0x25ed89,_0x2ba892){_0x25ed89=_0x25ed89-0x0;var _0x3404ff=_0x2032[_0x25ed89];return _0x3404ff;};'use strict';function Campaign(_0x4d6c97){this['id']=_0x4d6c97['id']||0x0;this[_0x2203('0x0')]=_0x4d6c97[_0x2203('0x0')]||'';this[_0x2203('0x1')]=_0x4d6c97['type']||_0x2203('0x2');this[_0x2203('0x3')]=0x0;this['temp']=0x0;this[_0x2203('0x4')]=0x0;this[_0x2203('0x5')]=0x0;this[_0x2203('0x6')]='';this[_0x2203('0x7')]=!![];this[_0x2203('0x8')]=_0x4d6c97[_0x2203('0x8')];this[_0x2203('0x9')]=_0x4d6c97[_0x2203('0x9')];this[_0x2203('0xa')]=_0x4d6c97[_0x2203('0xa')]||null;this[_0x2203('0xb')]=_0x4d6c97['dialGlobalInterval']?_0x4d6c97['dialGlobalInterval']:null;this[_0x2203('0xc')]=_0x4d6c97['dialOriginateCallerIdName'];this[_0x2203('0xd')]=_0x4d6c97[_0x2203('0xd')];this[_0x2203('0xe')]=_0x4d6c97['dialOriginateTimeout']||0x1e;this[_0x2203('0xf')]=_0x4d6c97['dialCongestionMaxRetry'];this[_0x2203('0x10')]=_0x4d6c97['dialCongestionRetryFrequency'];this[_0x2203('0x11')]=_0x4d6c97[_0x2203('0x11')];this['dialBusyRetryFrequency']=_0x4d6c97['dialBusyRetryFrequency'];this['dialNoAnswerMaxRetry']=_0x4d6c97['dialNoAnswerMaxRetry'];this['dialNoAnswerRetryFrequency']=_0x4d6c97[_0x2203('0x12')];this['dialGlobalMaxRetry']=_0x4d6c97['dialGlobalMaxRetry'];this[_0x2203('0x13')]=_0x4d6c97[_0x2203('0x13')]||_0x2203('0x14');this[_0x2203('0x15')]=_0x4d6c97[_0x2203('0x15')]||undefined;this[_0x2203('0x16')]=_0x4d6c97[_0x2203('0x16')]||undefined;this[_0x2203('0x17')]=_0x4d6c97[_0x2203('0x17')]||undefined;this[_0x2203('0x18')]=_0x4d6c97['TrunkBackup']?_0x4d6c97[_0x2203('0x18')]:undefined;this[_0x2203('0x19')]=_0x4d6c97['Trunk']?_0x4d6c97[_0x2203('0x19')]:undefined;this[_0x2203('0x1a')]=_0x4d6c97['Interval']?_0x4d6c97[_0x2203('0x1a')]:undefined;this['SquareProject']=_0x4d6c97[_0x2203('0x1b')]?_0x4d6c97[_0x2203('0x1b')]:undefined;this[_0x2203('0x1c')]=_0x4d6c97[_0x2203('0x1b')]?_0x4d6c97[_0x2203('0x1b')][_0x2203('0x0')]:undefined;this['dialAMDActive']=_0x4d6c97[_0x2203('0x1d')]||![];this['dialAMDInitialSilence']=_0x4d6c97['dialAMDInitialSilence'];this[_0x2203('0x1e')]=_0x4d6c97['dialAMDGreeting'];this[_0x2203('0x1f')]=_0x4d6c97[_0x2203('0x1f')];this['dialAMDTotalAnalysisTime']=_0x4d6c97[_0x2203('0x20')];this['dialAMDMinWordLength']=_0x4d6c97['dialAMDMinWordLength'];this[_0x2203('0x21')]=_0x4d6c97[_0x2203('0x21')];this[_0x2203('0x22')]=_0x4d6c97[_0x2203('0x22')];this[_0x2203('0x23')]=_0x4d6c97[_0x2203('0x23')];this[_0x2203('0x24')]=_0x4d6c97[_0x2203('0x24')];}module['exports']=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index 785118c..56daf1f 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 _0x3e2a=['accountcode','context','linkedid','answered','answertime','endtime','unmanaged','abandoned','lastdata','duration','holdtime','type','monitorFilename','queue','monitors','transferconnectedlinenum','mohtime','exports','starttime','channel','destinationchannel','calleridnum','calleridname','connectedlinenum','connectedlinename'];(function(_0x28448b,_0x452375){var _0x4e86d8=function(_0x386bdc){while(--_0x386bdc){_0x28448b['push'](_0x28448b['shift']());}};_0x4e86d8(++_0x452375);}(_0x3e2a,0x10c));var _0xa3e2=function(_0x299b84,_0x5c2a71){_0x299b84=_0x299b84-0x0;var _0x1983d2=_0x3e2a[_0x299b84];return _0x1983d2;};'use strict';function Channel(){this[_0xa3e2('0x0')]=null;this[_0xa3e2('0x1')]='';this[_0xa3e2('0x2')]='';this[_0xa3e2('0x3')]=0x0;this[_0xa3e2('0x4')]='';this[_0xa3e2('0x5')]=undefined;this[_0xa3e2('0x6')]=undefined;this[_0xa3e2('0x7')]=0x0;this[_0xa3e2('0x8')]='';this['uniqueid']=0x0;this[_0xa3e2('0x9')]=0x0;this['exten']=0x0;this[_0xa3e2('0xa')]=![];this[_0xa3e2('0xb')]=null;this[_0xa3e2('0xc')]=null;this[_0xa3e2('0xd')]=![];this[_0xa3e2('0xe')]=![];this['lastapplication']='';this[_0xa3e2('0xf')]='';this[_0xa3e2('0x10')]=0x0;this['billableseconds']=0x0;this[_0xa3e2('0x11')]=0x0;this[_0xa3e2('0x12')]=null;this['tag']=null;this['disposition']=null;this['monitor']=![];this[_0xa3e2('0x13')]=null;this[_0xa3e2('0x14')]=null;this[_0xa3e2('0x15')]=[];this['transfercalleridnum']=undefined;this[_0xa3e2('0x16')]=undefined;this[_0xa3e2('0x17')]=0x0;}module[_0xa3e2('0x18')]=Channel; \ No newline at end of file +var _0x3eae=['endtime','abandoned','lastdata','duration','billableseconds','type','tag','disposition','monitor','monitorFilename','queue','monitors','transfercalleridnum','exports','destinationchannel','calleridnum','connectedlinenum','connectedlinename','accountcode','linkedid','exten','answertime'];(function(_0x27c3d2,_0x16f3f7){var _0x11e763=function(_0x16c2a7){while(--_0x16c2a7){_0x27c3d2['push'](_0x27c3d2['shift']());}};_0x11e763(++_0x16f3f7);}(_0x3eae,0x66));var _0xe3ea=function(_0x2fcf18,_0x10009a){_0x2fcf18=_0x2fcf18-0x0;var _0x4c68cc=_0x3eae[_0x2fcf18];return _0x4c68cc;};'use strict';function Channel(){this['starttime']=null;this['channel']='';this[_0xe3ea('0x0')]='';this[_0xe3ea('0x1')]=0x0;this['calleridname']='';this[_0xe3ea('0x2')]=undefined;this[_0xe3ea('0x3')]=undefined;this[_0xe3ea('0x4')]=0x0;this['context']='';this['uniqueid']=0x0;this[_0xe3ea('0x5')]=0x0;this[_0xe3ea('0x6')]=0x0;this['answered']=![];this[_0xe3ea('0x7')]=null;this[_0xe3ea('0x8')]=null;this['unmanaged']=![];this[_0xe3ea('0x9')]=![];this['lastapplication']='';this[_0xe3ea('0xa')]='';this[_0xe3ea('0xb')]=0x0;this[_0xe3ea('0xc')]=0x0;this['holdtime']=0x0;this[_0xe3ea('0xd')]=null;this[_0xe3ea('0xe')]=null;this[_0xe3ea('0xf')]=null;this[_0xe3ea('0x10')]=![];this[_0xe3ea('0x11')]=null;this[_0xe3ea('0x12')]=null;this[_0xe3ea('0x13')]=[];this[_0xe3ea('0x14')]=undefined;this['transferconnectedlinenum']=undefined;this['mohtime']=0x0;}module[_0xe3ea('0x15')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index 26d9c34..5a5c569 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 _0x3d6d=['type','serverUrl','exports','name','username','remoteUri','authType','password','consumerSecret','token','tokenSecret'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x3d6d,0xb3));var _0xd3d6=function(_0x296144,_0x26bbbf){_0x296144=_0x296144-0x0;var _0x5329b1=_0x3d6d[_0x296144];return _0x5329b1;};'use strict';function DeskAccount(_0x249683){this['id']=_0x249683['id']||0x0;this[_0xd3d6('0x0')]=_0x249683[_0xd3d6('0x0')]||'';this[_0xd3d6('0x1')]=_0x249683[_0xd3d6('0x1')]||'';this[_0xd3d6('0x2')]=_0x249683[_0xd3d6('0x2')]||'';this[_0xd3d6('0x3')]=_0x249683[_0xd3d6('0x3')]||'';this[_0xd3d6('0x4')]=_0x249683[_0xd3d6('0x4')]||'';this['consumerKey']=_0x249683['consumerKey']||'';this[_0xd3d6('0x5')]=_0x249683[_0xd3d6('0x5')]||'';this[_0xd3d6('0x6')]=_0x249683[_0xd3d6('0x6')]||'';this[_0xd3d6('0x7')]=_0x249683['tokenSecret']||'';this[_0xd3d6('0x8')]=_0x249683[_0xd3d6('0x8')]||'';this[_0xd3d6('0x9')]=_0x249683[_0xd3d6('0x9')]||'';this['Configurations']=_0x249683['Configurations']||{};}module[_0xd3d6('0xa')]=DeskAccount; \ No newline at end of file +var _0x1c3b=['exports','name','remoteUri','authType','password','consumerKey','consumerSecret','type','serverUrl','Configurations'];(function(_0x500649,_0x669569){var _0xec40d8=function(_0x1deca4){while(--_0x1deca4){_0x500649['push'](_0x500649['shift']());}};_0xec40d8(++_0x669569);}(_0x1c3b,0xab));var _0xb1c3=function(_0x71e173,_0x229ae5){_0x71e173=_0x71e173-0x0;var _0x23dcb7=_0x1c3b[_0x71e173];return _0x23dcb7;};'use strict';function DeskAccount(_0x2e067d){this['id']=_0x2e067d['id']||0x0;this[_0xb1c3('0x0')]=_0x2e067d[_0xb1c3('0x0')]||'';this['username']=_0x2e067d['username']||'';this[_0xb1c3('0x1')]=_0x2e067d[_0xb1c3('0x1')]||'';this[_0xb1c3('0x2')]=_0x2e067d[_0xb1c3('0x2')]||'';this[_0xb1c3('0x3')]=_0x2e067d[_0xb1c3('0x3')]||'';this['consumerKey']=_0x2e067d[_0xb1c3('0x4')]||'';this[_0xb1c3('0x5')]=_0x2e067d[_0xb1c3('0x5')]||'';this['token']=_0x2e067d['token']||'';this['tokenSecret']=_0x2e067d['tokenSecret']||'';this[_0xb1c3('0x6')]=_0x2e067d['type']||'';this[_0xb1c3('0x7')]=_0x2e067d[_0xb1c3('0x7')]||'';this[_0xb1c3('0x8')]=_0x2e067d['Configurations']||{};}module[_0xb1c3('0x9')]=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index 35480cb..fe4ec9f 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 _0x80d3=['tenantId','clientId','clientSecret','serverUrl','Configurations','exports','name','username','password','remoteUri'];(function(_0x289e64,_0x5adb3c){var _0x30246c=function(_0x1bf7f6){while(--_0x1bf7f6){_0x289e64['push'](_0x289e64['shift']());}};_0x30246c(++_0x5adb3c);}(_0x80d3,0xf6));var _0x380d=function(_0x317239,_0x4e9c7f){_0x317239=_0x317239-0x0;var _0x41643f=_0x80d3[_0x317239];return _0x41643f;};'use strict';function Dynamics365Account(_0x3f410a){this['id']=_0x3f410a['id']||0x0;this[_0x380d('0x0')]=_0x3f410a['name']||'';this[_0x380d('0x1')]=_0x3f410a[_0x380d('0x1')]||'';this[_0x380d('0x2')]=_0x3f410a[_0x380d('0x2')]||'';this[_0x380d('0x3')]=_0x3f410a[_0x380d('0x3')]||'';this[_0x380d('0x4')]=_0x3f410a[_0x380d('0x4')]||'';this[_0x380d('0x5')]=_0x3f410a[_0x380d('0x5')]||'';this[_0x380d('0x6')]=_0x3f410a[_0x380d('0x6')]||{};this['serverUrl']=_0x3f410a[_0x380d('0x7')]||'';this[_0x380d('0x8')]=_0x3f410a[_0x380d('0x8')]||{};}module[_0x380d('0x9')]=Dynamics365Account; \ No newline at end of file +var _0xe538=['name','username','password','remoteUri','tenantId','clientId','clientSecret','serverUrl','Configurations','exports'];(function(_0x944f73,_0x5cbd33){var _0x3af9c3=function(_0x4ec413){while(--_0x4ec413){_0x944f73['push'](_0x944f73['shift']());}};_0x3af9c3(++_0x5cbd33);}(_0xe538,0x17c));var _0x8e53=function(_0x52b91f,_0x499757){_0x52b91f=_0x52b91f-0x0;var _0x15f8f5=_0xe538[_0x52b91f];return _0x15f8f5;};'use strict';function Dynamics365Account(_0x479513){this['id']=_0x479513['id']||0x0;this[_0x8e53('0x0')]=_0x479513[_0x8e53('0x0')]||'';this[_0x8e53('0x1')]=_0x479513[_0x8e53('0x1')]||'';this[_0x8e53('0x2')]=_0x479513[_0x8e53('0x2')]||'';this[_0x8e53('0x3')]=_0x479513[_0x8e53('0x3')]||'';this[_0x8e53('0x4')]=_0x479513['tenantId']||'';this[_0x8e53('0x5')]=_0x479513['clientId']||'';this[_0x8e53('0x6')]=_0x479513[_0x8e53('0x6')]||{};this['serverUrl']=_0x479513[_0x8e53('0x7')]||'';this[_0x8e53('0x8')]=_0x479513['Configurations']||{};}module[_0x8e53('0x9')]=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index 6d5a7b0..0319a5a 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 _0x7d62=['faxdetect','SIP','Trunk','ListId','key','exports','name','description','ecm','headerinfo','localstationid','maxrate','modem','v17,v27,v29','gateway'];(function(_0x56bc73,_0x43cfc6){var _0x4cd9b7=function(_0x2d6c65){while(--_0x2d6c65){_0x56bc73['push'](_0x56bc73['shift']());}};_0x4cd9b7(++_0x43cfc6);}(_0x7d62,0x123));var _0x27d6=function(_0x22b028,_0x5e2090){_0x22b028=_0x22b028-0x0;var _0x128ebd=_0x7d62[_0x22b028];return _0x128ebd;};'use strict';function FaxAccount(_0x3548e4){this['id']=_0x3548e4['id']||0x0;this[_0x27d6('0x0')]=_0x3548e4[_0x27d6('0x0')]||'';this[_0x27d6('0x1')]=_0x3548e4['description'];this['ecm']=_0x3548e4[_0x27d6('0x2')];this[_0x27d6('0x3')]=_0x3548e4[_0x27d6('0x3')];this['localstationid']=_0x3548e4[_0x27d6('0x4')];this['minrate']=_0x3548e4['minrate']||0x960;this[_0x27d6('0x5')]=_0x3548e4[_0x27d6('0x5')]||0x3840;this[_0x27d6('0x6')]=_0x3548e4[_0x27d6('0x6')]||_0x27d6('0x7');this[_0x27d6('0x8')]=_0x3548e4[_0x27d6('0x8')]||'no';this[_0x27d6('0x9')]=_0x3548e4[_0x27d6('0x9')]||'no';this['t38timeout']=_0x3548e4['t38timeout']||0x1388;this['tech']=_0x3548e4['tech']||_0x27d6('0xa');this[_0x27d6('0xb')]=_0x3548e4[_0x27d6('0xb')]?_0x3548e4[_0x27d6('0xb')]:undefined;this['ListId']=_0x3548e4[_0x27d6('0xc')];this[_0x27d6('0xd')]=_0x3548e4[_0x27d6('0xd')];}module[_0x27d6('0xe')]=FaxAccount; \ No newline at end of file +var _0x81c0=['exports','name','description','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId','key'];(function(_0x2e1497,_0x3da62b){var _0x243454=function(_0x5df41b){while(--_0x5df41b){_0x2e1497['push'](_0x2e1497['shift']());}};_0x243454(++_0x3da62b);}(_0x81c0,0x1e1));var _0x081c=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x81c0[_0x3bf83f];return _0x22c4a9;};'use strict';function FaxAccount(_0x495ec1){this['id']=_0x495ec1['id']||0x0;this[_0x081c('0x0')]=_0x495ec1['name']||'';this[_0x081c('0x1')]=_0x495ec1[_0x081c('0x1')];this['ecm']=_0x495ec1['ecm'];this['headerinfo']=_0x495ec1['headerinfo'];this['localstationid']=_0x495ec1[_0x081c('0x2')];this['minrate']=_0x495ec1[_0x081c('0x3')]||0x960;this[_0x081c('0x4')]=_0x495ec1[_0x081c('0x4')]||0x3840;this[_0x081c('0x5')]=_0x495ec1['modem']||_0x081c('0x6');this[_0x081c('0x7')]=_0x495ec1['gateway']||'no';this[_0x081c('0x8')]=_0x495ec1[_0x081c('0x8')]||'no';this[_0x081c('0x9')]=_0x495ec1[_0x081c('0x9')]||0x1388;this[_0x081c('0xa')]=_0x495ec1['tech']||_0x081c('0xb');this[_0x081c('0xc')]=_0x495ec1['Trunk']?_0x495ec1[_0x081c('0xc')]:undefined;this[_0x081c('0xd')]=_0x495ec1[_0x081c('0xd')];this[_0x081c('0xe')]=_0x495ec1['key'];}module[_0x081c('0xf')]=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index e4a1d65..0e3e1b9 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 _0xb824=['exports','name','username','token','remoteUri','serverUrl','Configurations'];(function(_0x3fbebd,_0xd765b5){var _0x4aba4f=function(_0xe8a147){while(--_0xe8a147){_0x3fbebd['push'](_0x3fbebd['shift']());}};_0x4aba4f(++_0xd765b5);}(_0xb824,0xe1));var _0x4b82=function(_0x473c76,_0x54219e){_0x473c76=_0x473c76-0x0;var _0x318c90=_0xb824[_0x473c76];return _0x318c90;};'use strict';function FreshdeskAccount(_0x5bc226){this['id']=_0x5bc226['id']||0x0;this[_0x4b82('0x0')]=_0x5bc226['name']||'';this[_0x4b82('0x1')]=_0x5bc226[_0x4b82('0x1')]||'';this['apiKey']=_0x5bc226[_0x4b82('0x2')]||'';this[_0x4b82('0x3')]=_0x5bc226[_0x4b82('0x3')]||'';this['serverUrl']=_0x5bc226[_0x4b82('0x4')]||'';this[_0x4b82('0x5')]=_0x5bc226['Configurations']||{};}module[_0x4b82('0x6')]=FreshdeskAccount; \ No newline at end of file +var _0x0f85=['Configurations','name','username','token','remoteUri'];(function(_0x347bf8,_0x3eb017){var _0x46f908=function(_0x13f8cd){while(--_0x13f8cd){_0x347bf8['push'](_0x347bf8['shift']());}};_0x46f908(++_0x3eb017);}(_0x0f85,0x182));var _0x50f8=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x0f85[_0x5d6456];return _0x4d66c1;};'use strict';function FreshdeskAccount(_0x4e783c){this['id']=_0x4e783c['id']||0x0;this['name']=_0x4e783c[_0x50f8('0x0')]||'';this[_0x50f8('0x1')]=_0x4e783c[_0x50f8('0x1')]||'';this['apiKey']=_0x4e783c[_0x50f8('0x2')]||'';this[_0x50f8('0x3')]=_0x4e783c['remoteUri']||'';this['serverUrl']=_0x4e783c['serverUrl']||'';this['Configurations']=_0x4e783c[_0x50f8('0x4')]||{};}module['exports']=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index b1330fd..0c68b68 100644 --- a/server/services/ami/model/freshsalesAccount.js +++ b/server/services/ami/model/freshsalesAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x61fa=['exports','name','username','token','remoteUri','serverUrl','Configurations'];(function(_0x485599,_0x3bf1b9){var _0x2c491b=function(_0xd574f8){while(--_0xd574f8){_0x485599['push'](_0x485599['shift']());}};_0x2c491b(++_0x3bf1b9);}(_0x61fa,0x1ba));var _0xa61f=function(_0x1b338e,_0x25ac31){_0x1b338e=_0x1b338e-0x0;var _0x3ae2f4=_0x61fa[_0x1b338e];return _0x3ae2f4;};'use strict';function FreshsalesAccount(_0x2ffff7){this['id']=_0x2ffff7['id']||0x0;this[_0xa61f('0x0')]=_0x2ffff7['name']||'';this[_0xa61f('0x1')]=_0x2ffff7['username']||'';this['apiKey']=_0x2ffff7[_0xa61f('0x2')]||'';this[_0xa61f('0x3')]=_0x2ffff7[_0xa61f('0x3')]||'';this[_0xa61f('0x4')]=_0x2ffff7[_0xa61f('0x4')]||'';this[_0xa61f('0x5')]=_0x2ffff7[_0xa61f('0x5')]||{};}module[_0xa61f('0x6')]=FreshsalesAccount; \ No newline at end of file +var _0x266b=['name','apiKey','token','remoteUri','serverUrl','Configurations'];(function(_0x1c0459,_0x2c3dd8){var _0x2689c2=function(_0x133556){while(--_0x133556){_0x1c0459['push'](_0x1c0459['shift']());}};_0x2689c2(++_0x2c3dd8);}(_0x266b,0xc6));var _0xb266=function(_0x3bc188,_0x5557fb){_0x3bc188=_0x3bc188-0x0;var _0x4e1000=_0x266b[_0x3bc188];return _0x4e1000;};'use strict';function FreshsalesAccount(_0x1e0193){this['id']=_0x1e0193['id']||0x0;this[_0xb266('0x0')]=_0x1e0193['name']||'';this['username']=_0x1e0193['username']||'';this[_0xb266('0x1')]=_0x1e0193[_0xb266('0x2')]||'';this[_0xb266('0x3')]=_0x1e0193[_0xb266('0x3')]||'';this[_0xb266('0x4')]=_0x1e0193['serverUrl']||'';this[_0xb266('0x5')]=_0x1e0193[_0xb266('0x5')]||{};}module['exports']=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index afe9c96..6339a88 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 _0xa5ad=['queuecallercomplete','queuecallerexitAt','channel','connectedlinenum','connectedlinename','accountcode','context','exten','priority','holdtime','assigned','lastAssignedTo','exports','calleridname','queue','queuecallerjoinAt','position','count','queuecallerabandon','queuecallerabandonAt'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xa5ad,0xe9));var _0xda5a=function(_0x1b713c,_0xf7c95c){_0x1b713c=_0x1b713c-0x0;var _0x316fcd=_0xa5ad[_0x1b713c];return _0x316fcd;};'use strict';function QueueReport(){this['type']='inbound';this['uniqueid']='';this['calleridnum']='';this[_0xda5a('0x0')]='';this[_0xda5a('0x1')]='';this[_0xda5a('0x2')]=null;this['queuecallerleaveAt']=null;this[_0xda5a('0x3')]=0x1;this[_0xda5a('0x4')]=0x1;this[_0xda5a('0x5')]=![];this[_0xda5a('0x6')]=null;this[_0xda5a('0x7')]=![];this['queuecallercompleteAt']=null;this['queuecallerexit']=![];this[_0xda5a('0x8')]=null;this['originalposition']=0x1;this[_0xda5a('0x9')]='';this[_0xda5a('0xa')]='';this[_0xda5a('0xb')]='';this[_0xda5a('0xc')]='';this[_0xda5a('0xd')]='';this[_0xda5a('0xe')]='';this[_0xda5a('0xf')]='';this[_0xda5a('0x10')]=0x0;this[_0xda5a('0x11')]=![];this[_0xda5a('0x12')]='';this['mohtime']=0x0;this['variables']={};}module[_0xda5a('0x13')]=QueueReport; \ No newline at end of file +var _0xfa28=['inbound','calleridnum','queue','queuecallerleaveAt','position','count','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','originalposition','channel','connectedlinenum','connectedlinename','accountcode','exten','priority','holdtime','lastAssignedTo','mohtime','variables'];(function(_0x412c8f,_0x11ec94){var _0x27c005=function(_0x127059){while(--_0x127059){_0x412c8f['push'](_0x412c8f['shift']());}};_0x27c005(++_0x11ec94);}(_0xfa28,0x1b8));var _0x8fa2=function(_0x2b5513,_0x3fe5cd){_0x2b5513=_0x2b5513-0x0;var _0x578fd2=_0xfa28[_0x2b5513];return _0x578fd2;};'use strict';function QueueReport(){this['type']=_0x8fa2('0x0');this['uniqueid']='';this[_0x8fa2('0x1')]='';this['calleridname']='';this[_0x8fa2('0x2')]='';this['queuecallerjoinAt']=null;this[_0x8fa2('0x3')]=null;this[_0x8fa2('0x4')]=0x1;this[_0x8fa2('0x5')]=0x1;this[_0x8fa2('0x6')]=![];this[_0x8fa2('0x7')]=null;this[_0x8fa2('0x8')]=![];this[_0x8fa2('0x9')]=null;this[_0x8fa2('0xa')]=![];this['queuecallerexitAt']=null;this[_0x8fa2('0xb')]=0x1;this[_0x8fa2('0xc')]='';this[_0x8fa2('0xd')]='';this[_0x8fa2('0xe')]='';this[_0x8fa2('0xf')]='';this['context']='';this[_0x8fa2('0x10')]='';this[_0x8fa2('0x11')]='';this[_0x8fa2('0x12')]=0x0;this['assigned']=![];this[_0x8fa2('0x13')]='';this[_0x8fa2('0x14')]=0x0;this[_0x8fa2('0x15')]={};}module['exports']=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index 1278cc8..63b3745 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 _0x80b6=['exports','name','username','remoteUri','clientId','clientSecret','securityToken','type','integrationTab','serverUrl','Configurations'];(function(_0x56bd4b,_0x46fa99){var _0x2db689=function(_0x4d7af8){while(--_0x4d7af8){_0x56bd4b['push'](_0x56bd4b['shift']());}};_0x2db689(++_0x46fa99);}(_0x80b6,0xe8));var _0x680b=function(_0x3a0250,_0x1ce4f1){_0x3a0250=_0x3a0250-0x0;var _0x275671=_0x80b6[_0x3a0250];return _0x275671;};'use strict';function SalesforceAccount(_0x152147){this['id']=_0x152147['id']||0x0;this[_0x680b('0x0')]=_0x152147[_0x680b('0x0')]||'';this[_0x680b('0x1')]=_0x152147[_0x680b('0x1')]||'';this['remoteUri']=_0x152147[_0x680b('0x2')]||'';this['password']=_0x152147['password']||'';this[_0x680b('0x3')]=_0x152147[_0x680b('0x3')]||'';this[_0x680b('0x4')]=_0x152147[_0x680b('0x4')]||'';this[_0x680b('0x5')]=_0x152147['securityToken']||'';this['type']=_0x152147[_0x680b('0x6')]||_0x680b('0x7');this['serverUrl']=_0x152147[_0x680b('0x8')]||'';this['Configurations']=_0x152147[_0x680b('0x9')]||{};}module[_0x680b('0xa')]=SalesforceAccount; \ No newline at end of file +var _0x7de5=['password','clientId','securityToken','type','integrationTab','serverUrl','Configurations','exports','name','username','remoteUri'];(function(_0x122144,_0x5c9c96){var _0x27593f=function(_0x41a8c8){while(--_0x41a8c8){_0x122144['push'](_0x122144['shift']());}};_0x27593f(++_0x5c9c96);}(_0x7de5,0x8c));var _0x57de=function(_0x57275e,_0x52d51b){_0x57275e=_0x57275e-0x0;var _0xfe8d69=_0x7de5[_0x57275e];return _0xfe8d69;};'use strict';function SalesforceAccount(_0x48ceb7){this['id']=_0x48ceb7['id']||0x0;this['name']=_0x48ceb7[_0x57de('0x0')]||'';this[_0x57de('0x1')]=_0x48ceb7[_0x57de('0x1')]||'';this['remoteUri']=_0x48ceb7[_0x57de('0x2')]||'';this['password']=_0x48ceb7[_0x57de('0x3')]||'';this[_0x57de('0x4')]=_0x48ceb7[_0x57de('0x4')]||'';this['clientSecret']=_0x48ceb7['clientSecret']||'';this[_0x57de('0x5')]=_0x48ceb7['securityToken']||'';this[_0x57de('0x6')]=_0x48ceb7[_0x57de('0x6')]||_0x57de('0x7');this[_0x57de('0x8')]=_0x48ceb7[_0x57de('0x8')]||'';this['Configurations']=_0x48ceb7[_0x57de('0x9')]||{};}module[_0x57de('0xa')]=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index ad977a0..5db93e6 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 _0xee70=['remoteUri','serverUrl','Configurations','exports','name','username','password'];(function(_0x43b6ba,_0x38616c){var _0x308895=function(_0x5a385b){while(--_0x5a385b){_0x43b6ba['push'](_0x43b6ba['shift']());}};_0x308895(++_0x38616c);}(_0xee70,0xc1));var _0x0ee7=function(_0x2a6b4b,_0x3d063e){_0x2a6b4b=_0x2a6b4b-0x0;var _0x47c88a=_0xee70[_0x2a6b4b];return _0x47c88a;};'use strict';function ServicenowAccount(_0x1c35ba){this['id']=_0x1c35ba['id']||0x0;this['name']=_0x1c35ba[_0x0ee7('0x0')]||'';this[_0x0ee7('0x1')]=_0x1c35ba[_0x0ee7('0x1')]||'';this[_0x0ee7('0x2')]=_0x1c35ba['password']||'';this[_0x0ee7('0x3')]=_0x1c35ba['remoteUri']||'';this[_0x0ee7('0x4')]=_0x1c35ba[_0x0ee7('0x4')]||'';this[_0x0ee7('0x5')]=_0x1c35ba[_0x0ee7('0x5')]||{};}module[_0x0ee7('0x6')]=ServicenowAccount; \ No newline at end of file +var _0x7b53=['name','username','password','serverUrl','Configurations','exports'];(function(_0x1caf6a,_0x26a5bf){var _0x1bf493=function(_0x3982f5){while(--_0x3982f5){_0x1caf6a['push'](_0x1caf6a['shift']());}};_0x1bf493(++_0x26a5bf);}(_0x7b53,0x78));var _0x37b5=function(_0x9a8464,_0x239acc){_0x9a8464=_0x9a8464-0x0;var _0x43b6=_0x7b53[_0x9a8464];return _0x43b6;};'use strict';function ServicenowAccount(_0x59ba20){this['id']=_0x59ba20['id']||0x0;this['name']=_0x59ba20[_0x37b5('0x0')]||'';this[_0x37b5('0x1')]=_0x59ba20[_0x37b5('0x1')]||'';this['password']=_0x59ba20[_0x37b5('0x2')]||'';this['remoteUri']=_0x59ba20['remoteUri']||'';this[_0x37b5('0x3')]=_0x59ba20[_0x37b5('0x3')]||'';this[_0x37b5('0x4')]=_0x59ba20[_0x37b5('0x4')]||{};}module[_0x37b5('0x5')]=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index 2fbe09f..34d2dcf 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 _0x1f3c=['name','username','password','remoteUri','serverUrl','Configurations','exports'];(function(_0x3f30a2,_0x18678e){var _0x4675ca=function(_0x2ef93f){while(--_0x2ef93f){_0x3f30a2['push'](_0x3f30a2['shift']());}};_0x4675ca(++_0x18678e);}(_0x1f3c,0x103));var _0xc1f3=function(_0x47aa64,_0xfb8a07){_0x47aa64=_0x47aa64-0x0;var _0x549c7a=_0x1f3c[_0x47aa64];return _0x549c7a;};'use strict';function SugarcrmAccount(_0x306210){this['id']=_0x306210['id']||0x0;this['name']=_0x306210[_0xc1f3('0x0')]||'';this[_0xc1f3('0x1')]=_0x306210['username']||'';this[_0xc1f3('0x2')]=_0x306210[_0xc1f3('0x2')]||'';this[_0xc1f3('0x3')]=_0x306210[_0xc1f3('0x3')]||'';this['serverUrl']=_0x306210[_0xc1f3('0x4')]||'';this[_0xc1f3('0x5')]=_0x306210[_0xc1f3('0x5')]||{};}module[_0xc1f3('0x6')]=SugarcrmAccount; \ No newline at end of file +var _0xeefe=['exports','name','username','password','remoteUri','Configurations'];(function(_0x1b4dff,_0x59e189){var _0x4f98a5=function(_0x3cd5bd){while(--_0x3cd5bd){_0x1b4dff['push'](_0x1b4dff['shift']());}};_0x4f98a5(++_0x59e189);}(_0xeefe,0x17b));var _0xeeef=function(_0x2c80ad,_0x55292c){_0x2c80ad=_0x2c80ad-0x0;var _0xc7e30f=_0xeefe[_0x2c80ad];return _0xc7e30f;};'use strict';function SugarcrmAccount(_0x4b3b9e){this['id']=_0x4b3b9e['id']||0x0;this[_0xeeef('0x0')]=_0x4b3b9e[_0xeeef('0x0')]||'';this[_0xeeef('0x1')]=_0x4b3b9e[_0xeeef('0x1')]||'';this[_0xeeef('0x2')]=_0x4b3b9e['password']||'';this[_0xeeef('0x3')]=_0x4b3b9e['remoteUri']||'';this['serverUrl']=_0x4b3b9e['serverUrl']||'';this[_0xeeef('0x4')]=_0x4b3b9e[_0xeeef('0x4')]||{};}module[_0xeeef('0x5')]=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index 374d570..2a365e8 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 _0xb1c1=['exports','name','accountcode','unknown','status','address'];(function(_0x524c48,_0x4468d6){var _0x292e85=function(_0xfde3a6){while(--_0xfde3a6){_0x524c48['push'](_0x524c48['shift']());}};_0x292e85(++_0x4468d6);}(_0xb1c1,0x187));var _0x1b1c=function(_0x1042c2,_0x58eecb){_0x1042c2=_0x1042c2-0x0;var _0x446de6=_0xb1c1[_0x1042c2];return _0x446de6;};'use strict';function Telephone(_0x161e4e){this['id']=_0x161e4e['id']||0x0;this[_0x1b1c('0x0')]=_0x161e4e[_0x1b1c('0x0')]||'';this[_0x1b1c('0x1')]=_0x161e4e[_0x1b1c('0x1')]||'';this['state']=_0x1b1c('0x2');this['stateTime']=0x0;this[_0x1b1c('0x3')]=_0x1b1c('0x2');this[_0x1b1c('0x4')]='';}module[_0x1b1c('0x5')]=Telephone; \ No newline at end of file +var _0xc761=['stateTime','status','address','name','state','unknown'];(function(_0x61aa2c,_0x14c46d){var _0x5e8f58=function(_0x3a45cf){while(--_0x3a45cf){_0x61aa2c['push'](_0x61aa2c['shift']());}};_0x5e8f58(++_0x14c46d);}(_0xc761,0x1c5));var _0x1c76=function(_0x4eafed,_0x26e2bc){_0x4eafed=_0x4eafed-0x0;var _0x159c85=_0xc761[_0x4eafed];return _0x159c85;};'use strict';function Telephone(_0x5832f5){this['id']=_0x5832f5['id']||0x0;this[_0x1c76('0x0')]=_0x5832f5[_0x1c76('0x0')]||'';this['accountcode']=_0x5832f5['accountcode']||'';this[_0x1c76('0x1')]=_0x1c76('0x2');this[_0x1c76('0x3')]=0x0;this[_0x1c76('0x4')]=_0x1c76('0x2');this[_0x1c76('0x5')]='';}module['exports']=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index 75a89b4..3a1395d 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 _0xade4=['html','name'];(function(_0x533132,_0xf5b6fa){var _0x1a7447=function(_0x44d580){while(--_0x44d580){_0x533132['push'](_0x533132['shift']());}};_0x1a7447(++_0xf5b6fa);}(_0xade4,0x159));var _0x4ade=function(_0x14099d,_0x46fe27){_0x14099d=_0x14099d-0x0;var _0x1cff6c=_0xade4[_0x14099d];return _0x1cff6c;};'use strict';function template(_0x3f6709){this['id']=_0x3f6709['id']||0x0;this[_0x4ade('0x0')]=_0x3f6709['name']||'';this[_0x4ade('0x1')]=_0x3f6709[_0x4ade('0x1')]||'';}module['exports']=template; \ No newline at end of file +var _0x42b0=['html','exports','name'];(function(_0x2ed1ad,_0x1fb8a1){var _0x1deb5e=function(_0x4a5d76){while(--_0x4a5d76){_0x2ed1ad['push'](_0x2ed1ad['shift']());}};_0x1deb5e(++_0x1fb8a1);}(_0x42b0,0xbc));var _0x042b=function(_0x4956f2,_0xb602ca){_0x4956f2=_0x4956f2-0x0;var _0x1da579=_0x42b0[_0x4956f2];return _0x1da579;};'use strict';function template(_0x18c419){this['id']=_0x18c419['id']||0x0;this[_0x042b('0x0')]=_0x18c419['name']||'';this[_0x042b('0x1')]=_0x18c419['html']||'';}module[_0x042b('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 8847246..0314fe8 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 _0x9957=['AnyConditions','Actions','exports','name','channel','voice','status','AllConditions'];(function(_0x42c118,_0x197006){var _0x112ebd=function(_0x337411){while(--_0x337411){_0x42c118['push'](_0x42c118['shift']());}};_0x112ebd(++_0x197006);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';function Trigger(_0x202794){this['id']=_0x202794['id']||0x0;this[_0x7995('0x0')]=_0x202794[_0x7995('0x0')]||'';this[_0x7995('0x1')]=_0x202794['channel']||_0x7995('0x2');this[_0x7995('0x3')]=_0x202794[_0x7995('0x3')]||![];this[_0x7995('0x4')]=_0x202794['AllConditions']||[];this[_0x7995('0x5')]=_0x202794[_0x7995('0x5')]||[];this[_0x7995('0x6')]=_0x202794[_0x7995('0x6')]||[];}module[_0x7995('0x7')]=Trigger; \ No newline at end of file +var _0x4b84=['name','channel','status','AllConditions','Actions'];(function(_0x305a8a,_0x27e284){var _0x587b5e=function(_0x1be3f0){while(--_0x1be3f0){_0x305a8a['push'](_0x305a8a['shift']());}};_0x587b5e(++_0x27e284);}(_0x4b84,0x1cc));var _0x44b8=function(_0x2b7764,_0x2606f1){_0x2b7764=_0x2b7764-0x0;var _0x848dcb=_0x4b84[_0x2b7764];return _0x848dcb;};'use strict';function Trigger(_0x90ff31){this['id']=_0x90ff31['id']||0x0;this[_0x44b8('0x0')]=_0x90ff31['name']||'';this['channel']=_0x90ff31[_0x44b8('0x1')]||'voice';this['status']=_0x90ff31[_0x44b8('0x2')]||![];this[_0x44b8('0x3')]=_0x90ff31[_0x44b8('0x3')]||[];this['AnyConditions']=_0x90ff31['AnyConditions']||[];this['Actions']=_0x90ff31[_0x44b8('0x4')]||[];}module['exports']=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index 7c97f5f..224302c 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 _0x0b81=['status','registry','indexOf','port','domain','domainport','refresh','stateRegistry','registrationtime','address','exports','active','name','state','unknown','stateTime'];(function(_0x387495,_0xdefebd){var _0x7a2d0f=function(_0x41d96d){while(--_0x41d96d){_0x387495['push'](_0x387495['shift']());}};_0x7a2d0f(++_0xdefebd);}(_0x0b81,0x1db));var _0x10b8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0b81[_0x3dd15e];return _0x231fd0;};'use strict';function Trunk(_0xa40cf6){this['id']=_0xa40cf6['id']||0x0;this[_0x10b8('0x0')]=_0xa40cf6[_0x10b8('0x0')]||![];this[_0x10b8('0x1')]=_0xa40cf6[_0x10b8('0x1')]||'';this[_0x10b8('0x2')]=_0x10b8('0x3');this[_0x10b8('0x4')]=0x0;this[_0x10b8('0x5')]='unknown';this['registry']=_0xa40cf6[_0x10b8('0x6')]&&_0xa40cf6[_0x10b8('0x6')][_0x10b8('0x7')](':')?_0xa40cf6[_0x10b8('0x6')]['split'](':')[0x0]:'';this['host']='';this[_0x10b8('0x8')]='';this[_0x10b8('0x9')]='';this[_0x10b8('0xa')]='';this[_0x10b8('0xb')]='';this[_0x10b8('0xc')]=_0x10b8('0x3');this[_0x10b8('0xd')]='';this[_0x10b8('0xe')]='';}module[_0x10b8('0xf')]=Trunk; \ No newline at end of file +var _0x0db1=['stateTime','status','registry','indexOf','split','host','port','domain','domainport','refresh','registrationtime','address','exports','active','name','unknown'];(function(_0x523918,_0x338492){var _0x15bacf=function(_0x23ff72){while(--_0x23ff72){_0x523918['push'](_0x523918['shift']());}};_0x15bacf(++_0x338492);}(_0x0db1,0x1dd));var _0x10db=function(_0x546e17,_0x18f835){_0x546e17=_0x546e17-0x0;var _0x766b46=_0x0db1[_0x546e17];return _0x766b46;};'use strict';function Trunk(_0x4b7619){this['id']=_0x4b7619['id']||0x0;this[_0x10db('0x0')]=_0x4b7619['active']||![];this[_0x10db('0x1')]=_0x4b7619['name']||'';this['state']=_0x10db('0x2');this[_0x10db('0x3')]=0x0;this[_0x10db('0x4')]=_0x10db('0x2');this['registry']=_0x4b7619[_0x10db('0x5')]&&_0x4b7619[_0x10db('0x5')][_0x10db('0x6')](':')?_0x4b7619['registry'][_0x10db('0x7')](':')[0x0]:'';this[_0x10db('0x8')]='';this[_0x10db('0x9')]='';this[_0x10db('0xa')]='';this[_0x10db('0xb')]='';this[_0x10db('0xc')]='';this['stateRegistry']='unknown';this[_0x10db('0xd')]='';this[_0x10db('0xe')]='';}module[_0x10db('0xf')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index 4ac0ec3..21f659e 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 _0x61a9=['recordingFormat','none','mandatoryDisposition','exports','exten'];(function(_0x2067a8,_0xf7e5e7){var _0x469a3e=function(_0x3182ae){while(--_0x3182ae){_0x2067a8['push'](_0x2067a8['shift']());}};_0x469a3e(++_0xf7e5e7);}(_0x61a9,0x13a));var _0x961a=function(_0x2f5818,_0x2595ee){_0x2f5818=_0x2f5818-0x0;var _0xef138a=_0x61a9[_0x2f5818];return _0xef138a;};'use strict';function voiceExtension(_0x297eb6){this['id']=_0x297eb6['id']||0x0;this[_0x961a('0x0')]=_0x297eb6[_0x961a('0x0')]||'';this[_0x961a('0x1')]=_0x297eb6[_0x961a('0x1')]||_0x961a('0x2');this[_0x961a('0x3')]=_0x297eb6[_0x961a('0x3')]||![];}module[_0x961a('0x4')]=voiceExtension; \ No newline at end of file +var _0xbd46=['recordingFormat','none','mandatoryDisposition','exports','exten'];(function(_0xc5340a,_0x49ccf8){var _0x145e90=function(_0x654002){while(--_0x654002){_0xc5340a['push'](_0xc5340a['shift']());}};_0x145e90(++_0x49ccf8);}(_0xbd46,0x135));var _0x6bd4=function(_0x295a3d,_0x56d487){_0x295a3d=_0x295a3d-0x0;var _0x23a732=_0xbd46[_0x295a3d];return _0x23a732;};'use strict';function voiceExtension(_0x204b3a){this['id']=_0x204b3a['id']||0x0;this[_0x6bd4('0x0')]=_0x204b3a[_0x6bd4('0x0')]||'';this['recordingFormat']=_0x204b3a[_0x6bd4('0x1')]||_0x6bd4('0x2');this['mandatoryDisposition']=_0x204b3a[_0x6bd4('0x3')]||![];}module[_0x6bd4('0x4')]=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index d35778b..b33da23 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 _0xd104=['predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','unknown','inuse','busy','invalid','unavailable','ringing','ringinuse','onhold','wav','wav49','rrmemory','roundrobin','name','monitor_format','type','inbound','waiting','talking','total','answered','sumDuration','sumHoldTime','sumBillable','unmanaged','abandoned','loggedIn','available','acw','acwTimeout','autopause','sendMessageOneNotActive','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayTimeout','outboundAbandonedDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime'];(function(_0x5c7ca8,_0xbbee47){var _0xbd8b39=function(_0x583ead){while(--_0x583ead){_0x5c7ca8['push'](_0x5c7ca8['shift']());}};_0xbd8b39(++_0xbbee47);}(_0xd104,0x90));var _0x4d10=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xd104[_0x397e5f];return _0x5302b8;};'use strict';var statusDesc=[_0x4d10('0x0'),'not_inuse',_0x4d10('0x1'),_0x4d10('0x2'),_0x4d10('0x3'),_0x4d10('0x4'),_0x4d10('0x5'),_0x4d10('0x6'),_0x4d10('0x7')];var monitorFormat={'wav':_0x4d10('0x8'),'wav49':_0x4d10('0x9'),'gsm':'gsm'};var strategy={'rrmemory':_0x4d10('0xa'),'roundrobin':_0x4d10('0xb')};function VoiceQueue(_0x485996){this['id']=_0x485996['id']||0x0;this[_0x4d10('0xc')]=_0x485996[_0x4d10('0xc')]||'';this[_0x4d10('0xd')]=_0x485996[_0x4d10('0xd')]||'';this[_0x4d10('0xe')]=_0x485996[_0x4d10('0xe')]||_0x4d10('0xf');this[_0x4d10('0x10')]=0x0;this[_0x4d10('0x11')]=0x0;this[_0x4d10('0x12')]=0x0;this[_0x4d10('0x13')]=0x0;this[_0x4d10('0x14')]=0x0;this[_0x4d10('0x15')]=0x0;this[_0x4d10('0x16')]=0x0;this[_0x4d10('0x17')]=0x0;this[_0x4d10('0x18')]=0x0;this[_0x4d10('0x19')]=0x0;this[_0x4d10('0x1a')]=0x0;this[_0x4d10('0x1b')]=_0x485996[_0x4d10('0x1b')]||![];this['acwTimeout']=_0x485996[_0x4d10('0x1c')]||0xa;this[_0x4d10('0x1d')]=_0x485996[_0x4d10('0x1d')]||'no';this[_0x4d10('0x1e')]=!![];this['message']='';this[_0x4d10('0x1f')]=0x0;this[_0x4d10('0x20')]=0x0;this[_0x4d10('0x21')]=_0x485996['dialTimezone']||null;this['dialGlobalInterval']=_0x485996[_0x4d10('0x22')]?_0x485996[_0x4d10('0x22')]:null;this[_0x4d10('0x23')]=_0x485996[_0x4d10('0x23')];this[_0x4d10('0x24')]=_0x485996['dialMethod']||_0x4d10('0x25');this['dialLimitChannel']=_0x485996[_0x4d10('0x26')]||0x0;this['dialLimitQueue']=_0x485996[_0x4d10('0x27')]||0x0;this['dialPowerLevel']=_0x485996['dialPowerLevel']||0x1;this[_0x4d10('0x28')]=_0x485996[_0x4d10('0x28')]||'dropRate';this[_0x4d10('0x29')]=_0x485996[_0x4d10('0x29')]||0.03;this[_0x4d10('0x2a')]=_0x485996[_0x4d10('0x2a')]||0x258;this[_0x4d10('0x2b')]=_0x485996['dialOriginateCallerIdName']||_0x4d10('0x2c');this[_0x4d10('0x2d')]=_0x485996[_0x4d10('0x2d')]||_0x4d10('0x2c');this['dialOriginateTimeout']=_0x485996[_0x4d10('0x2e')]||0x1e;this['dialQueueOptions']=_0x485996[_0x4d10('0x2f')]||_0x4d10('0x30');this['dialQueueTimeout']=_0x485996[_0x4d10('0x31')]||0x3;this['dialQueueProject']=_0x485996[_0x4d10('0x32')]||undefined;this[_0x4d10('0x33')]=_0x485996[_0x4d10('0x33')]||0x3;this[_0x4d10('0x34')]=_0x485996['dialCongestionRetryFrequency']||0x96;this[_0x4d10('0x35')]=_0x485996[_0x4d10('0x35')]||0x3;this[_0x4d10('0x36')]=_0x485996[_0x4d10('0x36')]||0x96;this['dialNoAnswerMaxRetry']=_0x485996[_0x4d10('0x37')]||0x3;this[_0x4d10('0x38')]=_0x485996['dialNoAnswerRetryFrequency']||0x96;this[_0x4d10('0x39')]=_0x485996[_0x4d10('0x39')]||0x3;this[_0x4d10('0x3a')]=_0x485996['dialNoSuchNumberRetryFrequency']||0x96;this['dialDropMaxRetry']=_0x485996[_0x4d10('0x3b')]||0x3;this[_0x4d10('0x3c')]=_0x485996['dialDropRetryFrequency']||0x96;this[_0x4d10('0x3d')]=_0x485996['dialAbandonedMaxRetry']||0x3;this[_0x4d10('0x3e')]=_0x485996['dialAbandonedRetryFrequency']||0x96;this['dialMachineMaxRetry']=_0x485996[_0x4d10('0x3f')]||0x3;this[_0x4d10('0x40')]=_0x485996['dialMachineRetryFrequency']||0x96;this[_0x4d10('0x41')]=_0x485996['dialAgentRejectMaxRetry']||0x3;this[_0x4d10('0x42')]=_0x485996[_0x4d10('0x42')]||0x96;this['dialGlobalMaxRetry']=_0x485996[_0x4d10('0x43')]||0x4;this[_0x4d10('0x44')]=_0x485996[_0x4d10('0x44')]?_0x485996[_0x4d10('0x44')]:undefined;this[_0x4d10('0x45')]=_0x485996[_0x4d10('0x45')]?_0x485996[_0x4d10('0x45')]:undefined;this[_0x4d10('0x46')]=_0x485996[_0x4d10('0x46')]||undefined;this[_0x4d10('0x47')]=_0x485996[_0x4d10('0x47')]?_0x485996['Interval']:undefined;this[_0x4d10('0x48')]=_0x485996[_0x4d10('0x48')]||_0x4d10('0x49');this[_0x4d10('0x4a')]=_0x485996[_0x4d10('0x4a')]||undefined;this[_0x4d10('0x4b')]=_0x485996['dialCutDigit']||undefined;this[_0x4d10('0x4c')]=strategy[_0x485996[_0x4d10('0x4c')]]||_0x4d10('0xa');this[_0x4d10('0x4d')]=!![];this['dialAMDActive']=_0x485996[_0x4d10('0x4e')]||![];this[_0x4d10('0x4f')]=_0x485996['dialAMDInitialSilence'];this[_0x4d10('0x50')]=_0x485996[_0x4d10('0x50')];this[_0x4d10('0x51')]=_0x485996['dialAMDAfterGreetingSilence'];this['dialAMDTotalAnalysisTime']=_0x485996[_0x4d10('0x52')];this['dialAMDMinWordLength']=_0x485996[_0x4d10('0x53')];this[_0x4d10('0x54')]=_0x485996[_0x4d10('0x54')];this[_0x4d10('0x55')]=_0x485996[_0x4d10('0x55')];this[_0x4d10('0x56')]=_0x485996[_0x4d10('0x56')];this[_0x4d10('0x57')]=_0x485996[_0x4d10('0x57')];this[_0x4d10('0x58')]=0x0;this[_0x4d10('0x59')]=0x0;this[_0x4d10('0x5a')]=_0x485996[_0x4d10('0x5a')];this['outboundAnswerCallsDay']=0x0;this[_0x4d10('0x5b')]=0x0;this[_0x4d10('0x5c')]=0x0;this[_0x4d10('0x5d')]=0x0;this[_0x4d10('0x5e')]=0x0;this[_0x4d10('0x5f')]=0x0;this[_0x4d10('0x60')]=0x0;this[_0x4d10('0x61')]=0x0;this[_0x4d10('0x62')]=0x0;this['outboundDropCallsDayCallersExit']=0x0;this[_0x4d10('0x63')]=0x0;this['outboundDropCallsDayACS']=0x0;this['outboundReCallsDay']=0x0;this[_0x4d10('0x64')]=0x0;this[_0x4d10('0x65')]=undefined;this[_0x4d10('0x66')]=undefined;this[_0x4d10('0x67')]=undefined;this[_0x4d10('0x68')]=1.05;this['predictiveIntervalTotalCalls']=0x0;this['predictiveIntervalAnsweredCalls']=0x0;this[_0x4d10('0x69')]=0x0;this[_0x4d10('0x6a')]=0x0;this[_0x4d10('0x6b')]=0x0;this[_0x4d10('0x6c')]=0x0;this[_0x4d10('0x6d')]=0x0;this['predictiveIntervalAvailable']=0x0;this[_0x4d10('0x6e')]=_0x485996[_0x4d10('0x6f')]||0x14;this[_0x4d10('0x70')]=_0x485996[_0x4d10('0x6f')]||0xa;this[_0x4d10('0x71')]=0x0;this[_0x4d10('0x72')]=0x0;this[_0x4d10('0x73')]=0x1;this[_0x4d10('0x74')]=0x0;this[_0x4d10('0x75')]=0x0;this['erlangAbandonmentRate']=0x0;this[_0x4d10('0x76')]=0x0;this[_0x4d10('0x77')]=_0x485996['dialRecallMeTimeout']||0x1e;this[_0x4d10('0x78')]=_0x485996[_0x4d10('0x78')]||![];this['dialQueueProject2']=_0x485996['dialQueueProject2']||undefined;this[_0x4d10('0x79')]=_0x485996[_0x4d10('0x79')]||![];this[_0x4d10('0x7a')]=_0x485996[_0x4d10('0x7a')]||![];this['monitor_format']=monitorFormat[_0x485996['monitor_format']]?monitorFormat[_0x485996[_0x4d10('0xd')]]:undefined;this[_0x4d10('0x7b')]=_0x485996['mandatoryDisposition']||![];this[_0x4d10('0x7c')]=_0x485996[_0x4d10('0x7c')]?_0x485996[_0x4d10('0x7c')]:undefined;}module[_0x4d10('0x7d')]=VoiceQueue; \ No newline at end of file +var _0x7120=['dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive','startPredictive','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalPauses','predictiveIntervalAvailable','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangBusyFactor','dialRecallMeTimeout','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','unknown','not_inuse','busy','invalid','unavailable','ringinuse','onhold','wav','wav49','gsm','rrmemory','roundrobin','name','monitor_format','type','inbound','answered','sumDuration','sumHoldTime','sumBillable','unmanaged','abandoned','loggedIn','available','acwTimeout','autopause','sendMessageOneNotActive','message','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive'];(function(_0x487d0a,_0x1b7cb4){var _0x3d740c=function(_0xa714f2){while(--_0xa714f2){_0x487d0a['push'](_0x487d0a['shift']());}};_0x3d740c(++_0x1b7cb4);}(_0x7120,0x18a));var _0x0712=function(_0x1c194e,_0x35c586){_0x1c194e=_0x1c194e-0x0;var _0x272cef=_0x7120[_0x1c194e];return _0x272cef;};'use strict';var statusDesc=[_0x0712('0x0'),_0x0712('0x1'),'inuse',_0x0712('0x2'),_0x0712('0x3'),_0x0712('0x4'),'ringing',_0x0712('0x5'),_0x0712('0x6')];var monitorFormat={'wav':_0x0712('0x7'),'wav49':_0x0712('0x8'),'gsm':_0x0712('0x9')};var strategy={'rrmemory':_0x0712('0xa'),'roundrobin':_0x0712('0xb')};function VoiceQueue(_0x548781){this['id']=_0x548781['id']||0x0;this[_0x0712('0xc')]=_0x548781[_0x0712('0xc')]||'';this['monitor_format']=_0x548781[_0x0712('0xd')]||'';this[_0x0712('0xe')]=_0x548781[_0x0712('0xe')]||_0x0712('0xf');this['waiting']=0x0;this['talking']=0x0;this['total']=0x0;this[_0x0712('0x10')]=0x0;this[_0x0712('0x11')]=0x0;this[_0x0712('0x12')]=0x0;this[_0x0712('0x13')]=0x0;this[_0x0712('0x14')]=0x0;this[_0x0712('0x15')]=0x0;this[_0x0712('0x16')]=0x0;this[_0x0712('0x17')]=0x0;this['acw']=_0x548781['acw']||![];this[_0x0712('0x18')]=_0x548781['acwTimeout']||0xa;this[_0x0712('0x19')]=_0x548781[_0x0712('0x19')]||'no';this[_0x0712('0x1a')]=!![];this[_0x0712('0x1b')]='';this['originated']=0x0;this[_0x0712('0x1c')]=0x0;this[_0x0712('0x1d')]=_0x548781[_0x0712('0x1d')]||null;this[_0x0712('0x1e')]=_0x548781[_0x0712('0x1e')]?_0x548781['dialGlobalInterval']:null;this['dialActive']=_0x548781[_0x0712('0x1f')];this['dialMethod']=_0x548781[_0x0712('0x20')]||_0x0712('0x21');this['dialLimitChannel']=_0x548781[_0x0712('0x22')]||0x0;this[_0x0712('0x23')]=_0x548781['dialLimitQueue']||0x0;this[_0x0712('0x24')]=_0x548781['dialPowerLevel']||0x1;this[_0x0712('0x25')]=_0x548781[_0x0712('0x25')]||_0x0712('0x26');this['dialPredictiveOptimizationPercentage']=_0x548781[_0x0712('0x27')]||0.03;this[_0x0712('0x28')]=_0x548781[_0x0712('0x28')]||0x258;this[_0x0712('0x29')]=_0x548781[_0x0712('0x29')]||_0x0712('0x2a');this['dialOriginateCallerIdNumber']=_0x548781[_0x0712('0x2b')]||_0x0712('0x2a');this[_0x0712('0x2c')]=_0x548781[_0x0712('0x2c')]||0x1e;this[_0x0712('0x2d')]=_0x548781['dialQueueOptions']||_0x0712('0x2e');this['dialQueueTimeout']=_0x548781['dialQueueTimeout']||0x3;this[_0x0712('0x2f')]=_0x548781[_0x0712('0x2f')]||undefined;this['dialCongestionMaxRetry']=_0x548781[_0x0712('0x30')]||0x3;this[_0x0712('0x31')]=_0x548781['dialCongestionRetryFrequency']||0x96;this[_0x0712('0x32')]=_0x548781[_0x0712('0x32')]||0x3;this[_0x0712('0x33')]=_0x548781[_0x0712('0x33')]||0x96;this['dialNoAnswerMaxRetry']=_0x548781['dialNoAnswerMaxRetry']||0x3;this[_0x0712('0x34')]=_0x548781[_0x0712('0x34')]||0x96;this['dialNoSuchNumberMaxRetry']=_0x548781[_0x0712('0x35')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x548781[_0x0712('0x36')]||0x96;this[_0x0712('0x37')]=_0x548781[_0x0712('0x37')]||0x3;this['dialDropRetryFrequency']=_0x548781[_0x0712('0x38')]||0x96;this[_0x0712('0x39')]=_0x548781[_0x0712('0x39')]||0x3;this[_0x0712('0x3a')]=_0x548781['dialAbandonedRetryFrequency']||0x96;this[_0x0712('0x3b')]=_0x548781['dialMachineMaxRetry']||0x3;this['dialMachineRetryFrequency']=_0x548781[_0x0712('0x3c')]||0x96;this[_0x0712('0x3d')]=_0x548781[_0x0712('0x3d')]||0x3;this['dialAgentRejectRetryFrequency']=_0x548781[_0x0712('0x3e')]||0x96;this[_0x0712('0x3f')]=_0x548781['dialGlobalMaxRetry']||0x4;this['Trunk']=_0x548781[_0x0712('0x40')]?_0x548781['Trunk']:undefined;this[_0x0712('0x41')]=_0x548781[_0x0712('0x41')]?_0x548781[_0x0712('0x41')]:undefined;this['dialPrefix']=_0x548781['dialPrefix']||undefined;this[_0x0712('0x42')]=_0x548781[_0x0712('0x42')]?_0x548781[_0x0712('0x42')]:undefined;this['dialOrderByScheduledAt']=_0x548781[_0x0712('0x43')]||_0x0712('0x44');this[_0x0712('0x45')]=_0x548781[_0x0712('0x45')]||undefined;this[_0x0712('0x46')]=_0x548781[_0x0712('0x46')]||undefined;this[_0x0712('0x47')]=strategy[_0x548781[_0x0712('0x47')]]||'rrmemory';this[_0x0712('0x48')]=!![];this['dialAMDActive']=_0x548781[_0x0712('0x49')]||![];this[_0x0712('0x4a')]=_0x548781['dialAMDInitialSilence'];this[_0x0712('0x4b')]=_0x548781['dialAMDGreeting'];this[_0x0712('0x4c')]=_0x548781[_0x0712('0x4c')];this[_0x0712('0x4d')]=_0x548781[_0x0712('0x4d')];this[_0x0712('0x4e')]=_0x548781[_0x0712('0x4e')];this['dialAMDBetweenWordsSilence']=_0x548781[_0x0712('0x4f')];this[_0x0712('0x50')]=_0x548781[_0x0712('0x50')];this[_0x0712('0x51')]=_0x548781[_0x0712('0x51')];this[_0x0712('0x52')]=_0x548781[_0x0712('0x52')];this[_0x0712('0x53')]=0x0;this['pTalking']=0x0;this['timeout']=_0x548781[_0x0712('0x54')];this[_0x0712('0x55')]=0x0;this[_0x0712('0x56')]=0x0;this[_0x0712('0x57')]=0x0;this[_0x0712('0x58')]=0x0;this['outboundCongestionCallsDay']=0x0;this[_0x0712('0x59')]=0x0;this[_0x0712('0x5a')]=0x0;this[_0x0712('0x5b')]=0x0;this['outboundOriginateFailureCallsDay']=0x0;this[_0x0712('0x5c')]=0x0;this[_0x0712('0x5d')]=0x0;this[_0x0712('0x5e')]=0x0;this[_0x0712('0x5f')]=0x0;this[_0x0712('0x60')]=0x0;this[_0x0712('0x61')]=undefined;this[_0x0712('0x62')]=undefined;this['handlePredictive']=undefined;this['predictiveIntervalMultiplicativeFactor']=1.05;this['predictiveIntervalTotalCalls']=0x0;this[_0x0712('0x63')]=0x0;this[_0x0712('0x64')]=0x0;this['predictiveIntervalDroppedCallsTimeout']=0x0;this[_0x0712('0x65')]=0x0;this['predictiveIntervalAvgTalktime']=0x0;this[_0x0712('0x66')]=0x0;this[_0x0712('0x67')]=0x0;this['predictiveIntervalMaxThreshold']=_0x548781[_0x0712('0x68')]||0x14;this[_0x0712('0x69')]=_0x548781[_0x0712('0x68')]||0xa;this['predictiveIntervalErlangCalls']=0x0;this[_0x0712('0x6a')]=0x0;this[_0x0712('0x6b')]=0x1;this[_0x0712('0x6c')]=0x0;this['erlangCallToSecond']=0x0;this['erlangAbandonmentRate']=0x0;this[_0x0712('0x6d')]=0x0;this[_0x0712('0x6e')]=_0x548781[_0x0712('0x6e')]||0x1e;this['dialRecallInQueue']=_0x548781['dialRecallInQueue']||![];this[_0x0712('0x6f')]=_0x548781[_0x0712('0x6f')]||undefined;this[_0x0712('0x70')]=_0x548781[_0x0712('0x70')]||![];this[_0x0712('0x71')]=_0x548781[_0x0712('0x71')]||![];this['monitor_format']=monitorFormat[_0x548781['monitor_format']]?monitorFormat[_0x548781['monitor_format']]:undefined;this[_0x0712('0x72')]=_0x548781[_0x0712('0x72')]||![];this[_0x0712('0x73')]=_0x548781[_0x0712('0x73')]?_0x548781[_0x0712('0x73')]:undefined;}module[_0x0712('0x74')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index 73e8f66..0921e84 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 _0xf0cd=['accessKey','remoteUri','serverUrl','exports','name','username'];(function(_0x25c92b,_0x41b368){var _0xc59d85=function(_0x10b32d){while(--_0x10b32d){_0x25c92b['push'](_0x25c92b['shift']());}};_0xc59d85(++_0x41b368);}(_0xf0cd,0x154));var _0xdf0c=function(_0x19710b,_0x3b2c21){_0x19710b=_0x19710b-0x0;var _0x44f6c7=_0xf0cd[_0x19710b];return _0x44f6c7;};'use strict';function VtigerAccount(_0x2f047c){this['id']=_0x2f047c['id']||0x0;this[_0xdf0c('0x0')]=_0x2f047c[_0xdf0c('0x0')]||'';this[_0xdf0c('0x1')]=_0x2f047c[_0xdf0c('0x1')]||'';this[_0xdf0c('0x2')]=_0x2f047c[_0xdf0c('0x2')]||'';this[_0xdf0c('0x3')]=_0x2f047c[_0xdf0c('0x3')]||'';this[_0xdf0c('0x4')]=_0x2f047c[_0xdf0c('0x4')]||'';this['Configurations']=_0x2f047c['Configurations']||{};}module[_0xdf0c('0x5')]=VtigerAccount; \ No newline at end of file +var _0x9f9c=['exports','name','username','accessKey','remoteUri','serverUrl','Configurations'];(function(_0x525c7b,_0x488fcc){var _0x27b33e=function(_0x56d43b){while(--_0x56d43b){_0x525c7b['push'](_0x525c7b['shift']());}};_0x27b33e(++_0x488fcc);}(_0x9f9c,0xa9));var _0xc9f9=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x9f9c[_0x4565bf];return _0x5610ba;};'use strict';function VtigerAccount(_0x571af8){this['id']=_0x571af8['id']||0x0;this[_0xc9f9('0x0')]=_0x571af8['name']||'';this[_0xc9f9('0x1')]=_0x571af8[_0xc9f9('0x1')]||'';this[_0xc9f9('0x2')]=_0x571af8[_0xc9f9('0x2')]||'';this['remoteUri']=_0x571af8[_0xc9f9('0x3')]||'';this['serverUrl']=_0x571af8[_0xc9f9('0x4')]||'';this[_0xc9f9('0x5')]=_0x571af8['Configurations']||{};}module[_0xc9f9('0x6')]=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index 3b91229..6eaeda7 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 _0xadb5=['token','remoteUri','authType','type','integrationTab','serverUrl','Configurations','exports','name','username','password'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xadb5,0xad));var _0x5adb=function(_0xe73f8f,_0x5ea02c){_0xe73f8f=_0xe73f8f-0x0;var _0x3fb9ab=_0xadb5[_0xe73f8f];return _0x3fb9ab;};'use strict';function ZendeskAccount(_0x1f969c){this['id']=_0x1f969c['id']||0x0;this[_0x5adb('0x0')]=_0x1f969c['name']||'';this[_0x5adb('0x1')]=_0x1f969c[_0x5adb('0x1')]||'';this[_0x5adb('0x2')]=_0x1f969c['password']||'';this[_0x5adb('0x3')]=_0x1f969c[_0x5adb('0x3')]||'';this[_0x5adb('0x4')]=_0x1f969c['remoteUri']||'';this[_0x5adb('0x5')]=_0x1f969c[_0x5adb('0x5')]||'';this[_0x5adb('0x6')]=_0x1f969c[_0x5adb('0x6')]||_0x5adb('0x7');this[_0x5adb('0x8')]=_0x1f969c[_0x5adb('0x8')]||'';this[_0x5adb('0x9')]=_0x1f969c[_0x5adb('0x9')]||{};}module[_0x5adb('0xa')]=ZendeskAccount; \ No newline at end of file +var _0x7a54=['serverUrl','Configurations','name','username','password','token','remoteUri','authType','type','integrationTab'];(function(_0x1602fb,_0x20b6b3){var _0x461831=function(_0x4a19f1){while(--_0x4a19f1){_0x1602fb['push'](_0x1602fb['shift']());}};_0x461831(++_0x20b6b3);}(_0x7a54,0x106));var _0x47a5=function(_0x4471b3,_0x345485){_0x4471b3=_0x4471b3-0x0;var _0x450d92=_0x7a54[_0x4471b3];return _0x450d92;};'use strict';function ZendeskAccount(_0xe384a5){this['id']=_0xe384a5['id']||0x0;this[_0x47a5('0x0')]=_0xe384a5[_0x47a5('0x0')]||'';this['username']=_0xe384a5[_0x47a5('0x1')]||'';this[_0x47a5('0x2')]=_0xe384a5['password']||'';this[_0x47a5('0x3')]=_0xe384a5[_0x47a5('0x3')]||'';this[_0x47a5('0x4')]=_0xe384a5[_0x47a5('0x4')]||'';this[_0x47a5('0x5')]=_0xe384a5['authType']||'';this[_0x47a5('0x6')]=_0xe384a5['type']||_0x47a5('0x7');this[_0x47a5('0x8')]=_0xe384a5['serverUrl']||'';this[_0x47a5('0x9')]=_0xe384a5['Configurations']||{};}module['exports']=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index a5572e1..949f9cf 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 _0x5236=['exports','name','description','host','zone','clientId','clientSecret','serverUrl','code','refreshToken','Configurations'];(function(_0x1fa6dd,_0x51f867){var _0x16b1cc=function(_0x3e9a09){while(--_0x3e9a09){_0x1fa6dd['push'](_0x1fa6dd['shift']());}};_0x16b1cc(++_0x51f867);}(_0x5236,0x109));var _0x6523=function(_0x51bf59,_0x5af179){_0x51bf59=_0x51bf59-0x0;var _0x31bc5f=_0x5236[_0x51bf59];return _0x31bc5f;};'use strict';function ZohoAccount(_0x1e2507){this['id']=_0x1e2507['id']||0x0;this[_0x6523('0x0')]=_0x1e2507[_0x6523('0x0')]||'';this[_0x6523('0x1')]=_0x1e2507[_0x6523('0x1')]||'';this['host']=_0x1e2507[_0x6523('0x2')]||'';this[_0x6523('0x3')]=_0x1e2507['zone']||'';this[_0x6523('0x4')]=_0x1e2507[_0x6523('0x4')]||'';this[_0x6523('0x5')]=_0x1e2507[_0x6523('0x5')]||'';this[_0x6523('0x6')]=_0x1e2507['serverUrl']||'';this[_0x6523('0x7')]=_0x1e2507[_0x6523('0x7')]||'';this[_0x6523('0x8')]=_0x1e2507['refreshToken']||'';this[_0x6523('0x9')]=_0x1e2507[_0x6523('0x9')]||{};}module[_0x6523('0xa')]=ZohoAccount; \ No newline at end of file +var _0x5706=['name','description','host','zone','clientId','clientSecret','serverUrl','code','refreshToken','Configurations','exports'];(function(_0x156e4a,_0x510ca3){var _0x79319f=function(_0x2aa210){while(--_0x2aa210){_0x156e4a['push'](_0x156e4a['shift']());}};_0x79319f(++_0x510ca3);}(_0x5706,0xb0));var _0x6570=function(_0xdaf360,_0x5bb5b6){_0xdaf360=_0xdaf360-0x0;var _0x5bf63b=_0x5706[_0xdaf360];return _0x5bf63b;};'use strict';function ZohoAccount(_0x146f4a){this['id']=_0x146f4a['id']||0x0;this[_0x6570('0x0')]=_0x146f4a[_0x6570('0x0')]||'';this['description']=_0x146f4a[_0x6570('0x1')]||'';this['host']=_0x146f4a[_0x6570('0x2')]||'';this[_0x6570('0x3')]=_0x146f4a[_0x6570('0x3')]||'';this[_0x6570('0x4')]=_0x146f4a[_0x6570('0x4')]||'';this[_0x6570('0x5')]=_0x146f4a[_0x6570('0x5')]||'';this[_0x6570('0x6')]=_0x146f4a[_0x6570('0x6')]||'';this[_0x6570('0x7')]=_0x146f4a['code']||'';this['refreshToken']=_0x146f4a[_0x6570('0x8')]||'';this[_0x6570('0x9')]=_0x146f4a[_0x6570('0x9')]||{};}module[_0x6570('0xa')]=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index 7959597..197f4ca 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 _0xb09d=['calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','\x22%s\x22\x20<%s>','number','exports','lodash','moment','isNil','string','idContact','queue','name','type','membername','Agent','channelAgent','format','SIP/%s','calleridname','Contact','phone','lastName','active'];(function(_0x419d19,_0x2c1364){var _0x1f3897=function(_0x206bbe){while(--_0x206bbe){_0x419d19['push'](_0x419d19['shift']());}};_0x1f3897(++_0x2c1364);}(_0xb09d,0x1ce));var _0xdb09=function(_0x22f66e,_0x2f6220){_0x22f66e=_0x22f66e-0x0;var _0x36a52e=_0xb09d[_0x22f66e];return _0x36a52e;};'use strict';var util=require('util');var _=require(_0xdb09('0x0'));var moment=require(_0xdb09('0x1'));function checkNameSurname(_0x28da27,_0x26e05a,_0x36b585){var _0x9d988e='';if(!_[_0xdb09('0x2')](_0x26e05a)&&_0xdb09('0x3')===typeof _0x26e05a){_0x9d988e+=_0x26e05a;}if(!_[_0xdb09('0x2')](_0x36b585)&&_0xdb09('0x3')===typeof _0x36b585){_0x9d988e+='\x20'+_0x36b585;}if(_0x9d988e!==''){return _0x9d988e;}return _0x28da27;}function Action(_0x587bb9,_0x459f7d,_0x3e07d4,_0x5092b9,_0x3a73d1){this['uniqueid']=_0x3e07d4||undefined;this[_0xdb09('0x4')]=_0x587bb9['id'];this[_0xdb09('0x5')]=_0x459f7d[_0xdb09('0x6')];this[_0xdb09('0x7')]=_0x459f7d['type'];this['campaigntype']=_0xdb09('0x5');this['dialAnswer']=![];this[_0xdb09('0x8')]=_['isNil'](_0x587bb9[_0xdb09('0x9')])?undefined:_0x587bb9[_0xdb09('0x9')][_0xdb09('0x6')];this[_0xdb09('0xa')]=this[_0xdb09('0x8')]?util[_0xdb09('0xb')](_0xdb09('0xc'),this[_0xdb09('0x8')]):_0x5092b9||undefined;this[_0xdb09('0xd')]=checkNameSurname(_0x587bb9[_0xdb09('0xe')][_0xdb09('0xf')],_0x587bb9[_0xdb09('0xe')]['firstName'],_0x587bb9[_0xdb09('0xe')][_0xdb09('0x10')]);this[_0xdb09('0x11')]=_0x587bb9[_0xdb09('0x11')]||![];this[_0xdb09('0x12')]=_0x587bb9['Contact'][_0xdb09('0xf')];this[_0xdb09('0x13')]=_0x587bb9[_0xdb09('0x13')];this[_0xdb09('0x14')]=_0x587bb9[_0xdb09('0x14')]||0x0;this[_0xdb09('0x15')]=_0x587bb9['countcongestionretry']||0x0;this[_0xdb09('0x16')]=_0x587bb9[_0xdb09('0x16')]||0x0;this[_0xdb09('0x17')]=(_0x587bb9['countbusyretry']||0x0)+(_0x587bb9[_0xdb09('0x15')]||0x0)+(_0x587bb9[_0xdb09('0x16')]||0x0);this[_0xdb09('0x18')]=_0x587bb9['countnosuchnumberretry']||0x0;this[_0xdb09('0x19')]=_0x587bb9[_0xdb09('0x19')]||0x0;this[_0xdb09('0x1a')]=_0x587bb9['countabandonedretry']||0x0;this[_0xdb09('0x1b')]=_0x587bb9[_0xdb09('0x1b')]||0x0;this[_0xdb09('0x1c')]=_0x587bb9[_0xdb09('0x1c')]||0x0;this['callback']=_0x587bb9[_0xdb09('0x1d')];this[_0xdb09('0x1e')]=_0x587bb9[_0xdb09('0x1e')];this['callbackat']=_0x587bb9[_0xdb09('0x1f')];this[_0xdb09('0x20')]=_0x587bb9[_0xdb09('0x20')];this[_0xdb09('0x21')]=_0x587bb9['ContactId'];this['ListId']=_0x587bb9[_0xdb09('0x22')];this[_0xdb09('0x23')]=_[_0xdb09('0x2')](_0x587bb9[_0xdb09('0x9')])?_0x587bb9[_0xdb09('0x23')]:_0x587bb9['Agent']['id'];this[_0xdb09('0x24')]=_0x587bb9[_0xdb09('0x24')];this['originatecalleridnum']='';this['originatecalleridname']='';}Action['prototype']['getCaller']=function(){return util[_0xdb09('0xb')](_0xdb09('0x25'),this['calleridname'],this[_0xdb09('0x26')]);};module[_0xdb09('0x27')]=Action; \ No newline at end of file +var _0x54b7=['Agent','channelAgent','format','calleridname','Contact','phone','lastName','active','scheduledat','countbusyretry','countnoanswerretry','countglobal','countcongestionretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridname','getCaller','\x22%s\x22\x20<%s>','number','exports','util','lodash','moment','isNil','string','uniqueid','idContact','queue','name','type','campaigntype','membername'];(function(_0x4463b4,_0x53a15f){var _0x287d77=function(_0x1cbf81){while(--_0x1cbf81){_0x4463b4['push'](_0x4463b4['shift']());}};_0x287d77(++_0x53a15f);}(_0x54b7,0x121));var _0x754b=function(_0xf52c7f,_0x5a709e){_0xf52c7f=_0xf52c7f-0x0;var _0x2a5e5a=_0x54b7[_0xf52c7f];return _0x2a5e5a;};'use strict';var util=require(_0x754b('0x0'));var _=require(_0x754b('0x1'));var moment=require(_0x754b('0x2'));function checkNameSurname(_0x106b73,_0x2bed15,_0x4bb7bc){var _0x3cffc0='';if(!_[_0x754b('0x3')](_0x2bed15)&&_0x754b('0x4')===typeof _0x2bed15){_0x3cffc0+=_0x2bed15;}if(!_[_0x754b('0x3')](_0x4bb7bc)&&_0x754b('0x4')===typeof _0x4bb7bc){_0x3cffc0+='\x20'+_0x4bb7bc;}if(_0x3cffc0!==''){return _0x3cffc0;}return _0x106b73;}function Action(_0x43220f,_0xde35e6,_0x273f1a,_0x56743a,_0x19cae0){this[_0x754b('0x5')]=_0x273f1a||undefined;this[_0x754b('0x6')]=_0x43220f['id'];this[_0x754b('0x7')]=_0xde35e6[_0x754b('0x8')];this['type']=_0xde35e6[_0x754b('0x9')];this[_0x754b('0xa')]='queue';this['dialAnswer']=![];this[_0x754b('0xb')]=_[_0x754b('0x3')](_0x43220f['Agent'])?undefined:_0x43220f[_0x754b('0xc')][_0x754b('0x8')];this[_0x754b('0xd')]=this[_0x754b('0xb')]?util[_0x754b('0xe')]('SIP/%s',this[_0x754b('0xb')]):_0x56743a||undefined;this[_0x754b('0xf')]=checkNameSurname(_0x43220f[_0x754b('0x10')][_0x754b('0x11')],_0x43220f[_0x754b('0x10')]['firstName'],_0x43220f[_0x754b('0x10')][_0x754b('0x12')]);this['active']=_0x43220f[_0x754b('0x13')]||![];this['calleridnum']=_0x43220f[_0x754b('0x10')][_0x754b('0x11')];this[_0x754b('0x14')]=_0x43220f[_0x754b('0x14')];this['countbusyretry']=_0x43220f[_0x754b('0x15')]||0x0;this['countcongestionretry']=_0x43220f['countcongestionretry']||0x0;this['countnoanswerretry']=_0x43220f[_0x754b('0x16')]||0x0;this[_0x754b('0x17')]=(_0x43220f[_0x754b('0x15')]||0x0)+(_0x43220f[_0x754b('0x18')]||0x0)+(_0x43220f['countnoanswerretry']||0x0);this[_0x754b('0x19')]=_0x43220f[_0x754b('0x19')]||0x0;this[_0x754b('0x1a')]=_0x43220f[_0x754b('0x1a')]||0x0;this['countabandonedretry']=_0x43220f[_0x754b('0x1b')]||0x0;this[_0x754b('0x1c')]=_0x43220f['countmachineretry']||0x0;this[_0x754b('0x1d')]=_0x43220f[_0x754b('0x1d')]||0x0;this[_0x754b('0x1e')]=_0x43220f[_0x754b('0x1e')];this[_0x754b('0x1f')]=_0x43220f[_0x754b('0x1f')];this[_0x754b('0x20')]=_0x43220f['callbackat'];this[_0x754b('0x21')]=_0x43220f[_0x754b('0x21')];this[_0x754b('0x22')]=_0x43220f[_0x754b('0x22')];this[_0x754b('0x23')]=_0x43220f[_0x754b('0x23')];this['UserId']=_['isNil'](_0x43220f[_0x754b('0xc')])?_0x43220f[_0x754b('0x24')]:_0x43220f[_0x754b('0xc')]['id'];this[_0x754b('0x25')]=_0x43220f[_0x754b('0x25')];this['originatecalleridnum']='';this[_0x754b('0x26')]='';}Action['prototype'][_0x754b('0x27')]=function(){return util[_0x754b('0xe')](_0x754b('0x28'),this[_0x754b('0xf')],this[_0x754b('0x29')]);};module[_0x754b('0x2a')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 3151ac5..ae81cb9 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 _0xda70=['\x20Trunk\x20is\x20not\x20active','\x20Trunk\x20Backup\x20is\x20not\x20active','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','substring','dialCutDigit','trim','getCallerId','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','merge','toLowerVariables','variablesAction','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','channel','actionid','logLookAgent','clone','isFailure','response','rejected','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','statedesc','channelstate','transfer','[syncHangup][talking][cause]','destuniqueid','addVariable','variables','keys','variable','value','inspect','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','uuid','moment','md5','ioredis','../../../config/environment','../../../config/logger','preview','actionPreview','../ami','./rpcDb','./action','./util/util','redis','defaults','localhost','socket.io-emitter','prototype','enqueue','tail','finally','campaignsPreview','trunks','actions','agents','originateresponse','syncOriginateResponse','hangup','syncHangup','hanguprequest','syncHangupRequest','bind','dialend','syncDialEnd','newexten','syncNewExten','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','emit','type','name','answered','available','loggedIn','sumBillable','sumDuration','sumHoldTime','total','unmanaged','abandoned','waiting','loggedInDb','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','outboundAbandonedCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','message','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','Trunk','callerid','Interval','stringify','format','voice_queue:save','info','voice:queue:%s','voice_queue_channel:remove','sendMessageOneNotActive','pTalking','paused','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','IS_DISACTIVED','\x20is\x20disactive','loopCampaigns','syncCampaigns','hasOwnProperty','booked','clockClearZombieChannels','clearZombieChannels','outbound','dialActive','setMessage','recallMe','clearZombieChannel','sequence','isNil','Queue','queue','originated:\x20','dialAnswer','pick','contactId','ListId','Action','status','catch','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','size','getContactRecallMe','length','scheduledat','dialRecallMeTimeout','Agent','voicePause','run','then','[RecallMe]','logger2','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','RecallFailedTimeout','createCustomerFinal','[HistoryRecallClose]','[getContactRecallMe]','AGENTS_NOT_LOGGED','isActive','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ACTIVE','callProgressDetectingCustomer','countnosuchnumberretry','countglobal','totalGlobal','[callProgressDetectingCustomer][logNoSuch]','dialGlobalMaxRetry','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','rescheduleContact','scheduledAt','dialNoSuchNumberRetryFrequency','linkedid','ANSWER','answertime','[syncHangup][talking][increment]','uniqueid','\x20Queue','pTalking:\x20','custom:agentconnect','buildObj','connect','acw','custom:agentConnectPreview','buildAcw','custom:agentcomplete','complete','decrementTalkink','[16]','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','talktime','[syncHangup][talking][decrement]','BUSY','countbusyretry','Busy','cloneAction','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','dialBusyRetryFrequency','unlockAgent','activeContact','NOANSWER','outboundNoAnswerCallsDay','NoAnswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','countnoanswerretry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','CONGESTION','countcongestionretry','Congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','CANCEL','countagentrejectretry','AgentReject','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','ABANDONED','countabandonedretry','Abandoned','countabandonedetry','dialAbandonedMaxRety','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedRetryFrequency','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','cause-txt','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','isUndefined','object','logAgent','NoSuchNumber','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','reason','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','checkInBlack','Contact','phone','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','idContact','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','logBlacklist','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','active','SIP/%s','reachable','unmonitored','execRun','unlockContact','recallme','validateContact','VoiceQueueId','Contact.phone','Call\x20unsuccessful','[Preview][getContactPreview]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','campaign\x20Name:\x20'];(function(_0x5e590b,_0x45a5b5){var _0x5bb18e=function(_0x2dec92){while(--_0x2dec92){_0x5e590b['push'](_0x5e590b['shift']());}};_0x5bb18e(++_0x45a5b5);}(_0xda70,0x183));var _0x0da7=function(_0x3c6125,_0x3b2a9c){_0x3c6125=_0x3c6125-0x0;var _0x2f47b8=_0xda70[_0x3c6125];return _0x2f47b8;};'use strict';var util=require(_0x0da7('0x0'));var _=require(_0x0da7('0x1'));var BPromise=require('bluebird');var uuid=require(_0x0da7('0x2'));var moment=require(_0x0da7('0x3'));var md5=require(_0x0da7('0x4'));var Redis=require(_0x0da7('0x5'));var config=require(_0x0da7('0x6'));var logger=require(_0x0da7('0x7'))(_0x0da7('0x8'));var loggerAction=require(_0x0da7('0x7'))(_0x0da7('0x9'));var ami=require(_0x0da7('0xa'));var rpcDb=require(_0x0da7('0xb'));var Action=require(_0x0da7('0xc'));var ut=require(_0x0da7('0xd'));config[_0x0da7('0xe')]=_[_0x0da7('0xf')](config[_0x0da7('0xe')],{'host':_0x0da7('0x10'),'port':0x18eb});var io=require(_0x0da7('0x11'))(new Redis(config['redis']));var Sequence=function(){};Sequence[_0x0da7('0x12')][_0x0da7('0x13')]=function(_0xdbf6bf){this[_0x0da7('0x14')]=this[_0x0da7('0x14')]?this['tail'][_0x0da7('0x15')](_0xdbf6bf):_0xdbf6bf();};function Preview(_0x400cac){this['sequence']=new Sequence();this[_0x0da7('0x16')]=_0x400cac['voiceQueues'];this[_0x0da7('0x17')]=_0x400cac[_0x0da7('0x17')];this[_0x0da7('0x18')]={};this[_0x0da7('0x19')]=_0x400cac['agents'];this['clockClearZombieChannels']=0x0;ami['on'](_0x0da7('0x1a'),this[_0x0da7('0x1b')]['bind'](this));ami['on'](_0x0da7('0x1c'),this[_0x0da7('0x1d')]['bind'](this));ami['on'](_0x0da7('0x1e'),this[_0x0da7('0x1f')][_0x0da7('0x20')](this));ami['on'](_0x0da7('0x21'),this[_0x0da7('0x22')][_0x0da7('0x20')](this));ami['on'](_0x0da7('0x23'),this[_0x0da7('0x24')][_0x0da7('0x20')](this));ami['on'](_0x0da7('0x25'),this[_0x0da7('0x26')][_0x0da7('0x20')](this));ami['on'](_0x0da7('0x27'),this[_0x0da7('0x28')][_0x0da7('0x20')](this));ami['on']('blindtransfer',this[_0x0da7('0x29')][_0x0da7('0x20')](this));this['loopCampaigns'](this[_0x0da7('0x16')]);}function emit(_0x3066f5,_0x20106f,_0x3ec36c){io['to'](_0x3066f5)[_0x0da7('0x2a')](_0x20106f,_0x3ec36c);}function emitCampaignPreview(_0x435c77){if(_0x435c77[_0x0da7('0x2b')]==='outbound'){var _0x3bebc4={'id':_0x435c77['id'],'name':_0x435c77[_0x0da7('0x2c')],'strategy':_0x435c77['strategy'],'answered':_0x435c77[_0x0da7('0x2d')],'available':_0x435c77[_0x0da7('0x2e')],'loggedIn':_0x435c77[_0x0da7('0x2f')],'pTalking':_0x435c77['pTalking'],'sumBillable':_0x435c77[_0x0da7('0x30')],'sumDuration':_0x435c77[_0x0da7('0x31')],'sumHoldTime':_0x435c77[_0x0da7('0x32')]||0x0,'talking':_0x435c77['talking'],'total':_0x435c77[_0x0da7('0x33')],'type':_0x435c77[_0x0da7('0x2b')],'unmanaged':_0x435c77[_0x0da7('0x34')],'abandoned':_0x435c77[_0x0da7('0x35')],'waiting':_0x435c77[_0x0da7('0x36')],'loggedInDb':_0x435c77[_0x0da7('0x37')],'dialActive':_0x435c77['dialActive'],'dialMethod':_0x435c77[_0x0da7('0x38')],'dialOriginateCallerIdName':_0x435c77[_0x0da7('0x39')],'dialOriginateCallerIdNumber':_0x435c77[_0x0da7('0x3a')],'dialOriginateTimeout':_0x435c77[_0x0da7('0x3b')],'dialPrefix':_0x435c77[_0x0da7('0x3c')],'outboundAnswerAgiCallsDay':_0x435c77[_0x0da7('0x3d')],'outboundAnswerCallsDay':_0x435c77[_0x0da7('0x3e')],'outboundBlacklistCallsDay':_0x435c77[_0x0da7('0x3f')],'outboundBusyCallsDay':_0x435c77[_0x0da7('0x40')],'outboundCongestionCallsDay':_0x435c77[_0x0da7('0x41')],'outboundDropCallsDayACS':_0x435c77['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x435c77[_0x0da7('0x42')],'outboundDropCallsDayTimeout':_0x435c77[_0x0da7('0x43')],'outboundNoAnswerCallsDay':_0x435c77['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0x435c77[_0x0da7('0x44')],'outboundOriginateFailureCallsDay':_0x435c77[_0x0da7('0x45')],'outboundReCallsDay':_0x435c77[_0x0da7('0x46')],'outboundRejectCallsDay':_0x435c77[_0x0da7('0x47')],'outboundUnknownCallsDay':_0x435c77[_0x0da7('0x48')],'outboundAbandonedCallsDay':_0x435c77[_0x0da7('0x49')],'predictiveIntervalAnsweredCalls':_0x435c77[_0x0da7('0x4a')],'predictiveIntervalAvgHoldtime':_0x435c77['predictiveIntervalAvgHoldtime'],'predictiveIntervalAvgTalktime':_0x435c77[_0x0da7('0x4b')],'predictiveIntervalDroppedCallsCallersExit':_0x435c77[_0x0da7('0x4c')],'predictiveIntervalDroppedCallsTimeout':_0x435c77[_0x0da7('0x4d')],'predictiveIntervalErlangCalls':_0x435c77[_0x0da7('0x4e')],'predictiveIntervalErlangCallsDroppedCalls':_0x435c77[_0x0da7('0x4f')],'predictiveIntervalHitRate':_0x435c77[_0x0da7('0x50')],'predictiveIntervalMultiplicativeFactor':_0x435c77[_0x0da7('0x51')],'predictiveIntervalPauses':_0x435c77[_0x0da7('0x52')],'predictiveIntervalAvailable':_0x435c77[_0x0da7('0x53')],'predictiveIntervalTotalCalls':_0x435c77[_0x0da7('0x54')],'message':_0x435c77[_0x0da7('0x55')],'originated':_0x435c77[_0x0da7('0x56')],'erlangCalls':_0x435c77[_0x0da7('0x57')],'erlangCallToSecond':_0x435c77[_0x0da7('0x58')],'erlangAbandonmentRate':_0x435c77[_0x0da7('0x59')],'erlangBusyFactor':_0x435c77[_0x0da7('0x5a')],'startPredictive':_0x435c77['startPredictive'],'startProgressive':_0x435c77['startProgressive']};if(_0x435c77[_0x0da7('0x5b')]){_0x3bebc4[_0x0da7('0x5b')]={'id':_0x435c77[_0x0da7('0x5b')]['id'],'name':_0x435c77[_0x0da7('0x5b')]['name'],'active':_0x435c77['Trunk']['active'],'callerid':_0x435c77[_0x0da7('0x5b')][_0x0da7('0x5c')]};}if(_0x435c77['Interval']){_0x3bebc4[_0x0da7('0x5d')]={'id':_0x435c77[_0x0da7('0x5d')]['id'],'name':_0x435c77[_0x0da7('0x5d')][_0x0da7('0x2c')]};}var _0x451ae8=md5(JSON[_0x0da7('0x5e')](_0x3bebc4));if(_0x435c77[_0x0da7('0x4')]!==_0x451ae8){_0x435c77[_0x0da7('0x4')]=_0x451ae8;emit(util[_0x0da7('0x5f')]('voice:queue:%s',_0x3bebc4[_0x0da7('0x2c')]),_0x0da7('0x60'),_0x3bebc4);}}}function emitVoiceQueueChannelRemove(_0x4cc4f1){logger[_0x0da7('0x61')]('[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event',JSON[_0x0da7('0x5e')](_0x4cc4f1));emit(util[_0x0da7('0x5f')](_0x0da7('0x62'),_0x4cc4f1[_0x0da7('0x2c')]),_0x0da7('0x63'),_0x4cc4f1);}function notSendMessagesQueue(_0x49dc5d){if(_0x49dc5d[_0x0da7('0x64')]){if(_0x49dc5d[_0x0da7('0x56')]===0x0&&_0x49dc5d[_0x0da7('0x65')]===0x0){_0x49dc5d[_0x0da7('0x64')]=![];_0x49dc5d[_0x0da7('0x2e')]=0x0;_0x49dc5d[_0x0da7('0x66')]=0x0;_0x49dc5d[_0x0da7('0x55')]='NOT_ACTIVE';ut[_0x0da7('0x67')](_0x0da7('0x68'),_0x49dc5d['name']+'\x20is\x20not\x20active');}else{_0x49dc5d[_0x0da7('0x55')]=_0x0da7('0x69');ut[_0x0da7('0x67')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x49dc5d[_0x0da7('0x2c')]+_0x0da7('0x6a'));}emitCampaignPreview(_0x49dc5d);}}Preview[_0x0da7('0x12')][_0x0da7('0x6b')]=function(){var _0x50a36e=this;setInterval(function(){_0x50a36e[_0x0da7('0x6c')]();},0x7cf);};Preview['prototype'][_0x0da7('0x6c')]=function(){var _0x1a1641=this['campaignsPreview'];this['clockClearZombieChannels']+=0x1;for(var _0x345469 in _0x1a1641){if(_0x1a1641[_0x0da7('0x6d')](_0x345469)&&(_0x1a1641[_0x345469][_0x0da7('0x38')]===_0x0da7('0x8')||_0x1a1641[_0x345469][_0x0da7('0x38')]===_0x0da7('0x6e'))&&_0x1a1641[_0x345469][_0x0da7('0x2b')]==='outbound'){if(this[_0x0da7('0x6f')]>0x7){this[_0x0da7('0x6f')]=0x0;this[_0x0da7('0x70')]();}}if(_0x1a1641[_0x0da7('0x6d')](_0x345469)&&_0x1a1641[_0x345469][_0x0da7('0x38')]===_0x0da7('0x8')&&_0x1a1641[_0x345469][_0x0da7('0x2b')]===_0x0da7('0x71')){if(_0x1a1641[_0x345469][_0x0da7('0x72')]){this[_0x0da7('0x73')](_0x1a1641[_0x345469]);this[_0x0da7('0x74')](_0x1a1641[_0x345469]);}else{notSendMessagesQueue(_0x1a1641[_0x345469]);}}}};Preview['prototype'][_0x0da7('0x75')]=function(_0x51ee1c){var _0x2f86bb=this;this[_0x0da7('0x76')]['enqueue'](function(){if(!_[_0x0da7('0x77')](_0x2f86bb[_0x0da7('0x18')][_0x51ee1c])){loggerAction[_0x0da7('0x61')]('[clearZombieChannels][talking]',_0x51ee1c,_0x0da7('0x78'),_0x2f86bb['actions'][_0x51ee1c][_0x0da7('0x79')],_0x0da7('0x7a'),JSON['stringify'](_0x2f86bb[_0x0da7('0x16')][_0x2f86bb[_0x0da7('0x18')][_0x51ee1c][_0x0da7('0x79')]][_0x0da7('0x56')]),'pTalking:\x20',JSON['stringify'](_0x2f86bb['campaignsPreview'][_0x2f86bb[_0x0da7('0x18')][_0x51ee1c][_0x0da7('0x79')]][_0x0da7('0x65')]),JSON[_0x0da7('0x5e')](_0x2f86bb[_0x0da7('0x18')][_0x51ee1c][_0x0da7('0x7b')]),JSON[_0x0da7('0x5e')](_[_0x0da7('0x7c')](_0x2f86bb[_0x0da7('0x18')][_0x51ee1c],[_0x0da7('0x7d'),'UserId','VoiceQueueId',_0x0da7('0x7e')])));return ami[_0x0da7('0x7f')]({'action':_0x0da7('0x80'),'channel':_0x2f86bb[_0x0da7('0x18')][_0x51ee1c]['channel']})[_0x0da7('0x81')](function(_0x51b165){if(_0x51b165[_0x0da7('0x55')]===_0x0da7('0x82')){setTimeout(function(){if(_0x2f86bb['actions'][_0x51ee1c]){ut[_0x0da7('0x83')](_0x2f86bb[_0x0da7('0x16')][_0x2f86bb[_0x0da7('0x18')][_0x51ee1c][_0x0da7('0x79')]],_0x0da7('0x84'));if(_0x2f86bb['actions'][_0x51ee1c][_0x0da7('0x7b')]===!![]){ut['decrementTalkink'](_0x2f86bb['campaignsPreview'][_0x2f86bb[_0x0da7('0x18')][_0x51ee1c]['queue']],_0x0da7('0x84'));ut[_0x0da7('0x85')](_0x0da7('0x86')+_0x51ee1c,_0x2f86bb[_0x0da7('0x18')][_0x51ee1c]['queue']);}ut[_0x0da7('0x85')](_0x0da7('0x87')+_0x51ee1c,_0x2f86bb['actions'][_0x51ee1c][_0x0da7('0x79')]);delete _0x2f86bb[_0x0da7('0x18')][_0x51ee1c];}},0x2328);}});}});};Preview['prototype']['clearZombieChannels']=function(){var _0x16e0cb=this;loggerAction['info']('[action]',_[_0x0da7('0x88')](this[_0x0da7('0x18')]));for(var _0x2c2977 in this['actions']){if(_0x16e0cb[_0x0da7('0x18')][_0x0da7('0x6d')](_0x2c2977)){_0x16e0cb[_0x0da7('0x75')](_0x2c2977);}}};Preview[_0x0da7('0x12')]['recallMe']=function(_0x223b7f){var _0x2487f9=this;rpcDb[_0x0da7('0x89')](_0x223b7f['id'],ut['agentReadyId'](this['agents']))['then'](function(_0x469a1a){if(!_[_0x0da7('0x77')](_0x469a1a)){for(var _0x3f4ea6=0x0;_0x3f4ea6<_0x469a1a[_0x0da7('0x8a')];_0x3f4ea6+=0x1){if(ut['getDiff'](_0x469a1a[_0x3f4ea6][_0x0da7('0x8b')])<_0x223b7f[_0x0da7('0x8c')]*0x3c){if(_0x469a1a[_0x3f4ea6]['Agent']&&!_0x469a1a[_0x3f4ea6][_0x0da7('0x8d')][_0x0da7('0x8e')]){_0x2487f9[_0x0da7('0x8f')](_0x469a1a[_0x3f4ea6]['id'])[_0x0da7('0x90')](ut['logger2'](_0x0da7('0x91')))['catch'](ut[_0x0da7('0x92')]('[RecallMe]'));}else{rpcDb[_0x0da7('0x93')](_0x469a1a[_0x3f4ea6]['id']);}}else{var _0x28e6c7=new Action(_0x469a1a[_0x3f4ea6],_0x223b7f);_0x28e6c7[_0x0da7('0x94')]=moment()['format'](_0x0da7('0x95'));_0x223b7f[_0x0da7('0x46')]+=0x1;ut[_0x0da7('0x96')](_0x28e6c7,0x17,_0x0da7('0x97'));if(_0x223b7f[_0x0da7('0x98')]){rpcDb[_0x0da7('0x99')](ut[_0x0da7('0x9a')](_0x469a1a[_0x3f4ea6]));rpcDb[_0x0da7('0x9b')](_0x28e6c7,'[HistoryDialRecallInQueue][historyCatch]');}else{ut[_0x0da7('0x96')](_0x28e6c7,0x16,_0x0da7('0x9c'));rpcDb[_0x0da7('0x9b')](_0x28e6c7,'[HistoryRecallClose]');rpcDb[_0x0da7('0x9d')](_0x28e6c7,_0x0da7('0x9e'));}}}}})[_0x0da7('0x81')](ut[_0x0da7('0x92')](_0x0da7('0x9f')));};Preview['prototype'][_0x0da7('0x73')]=function(_0x5ae3e4){_0x5ae3e4[_0x0da7('0x64')]=!![];if(ut['IsNotLoggedIn'](_0x5ae3e4[_0x0da7('0x2f')])){_0x5ae3e4[_0x0da7('0x55')]=_0x0da7('0xa0');}else if(!ut[_0x0da7('0xa1')](_0x5ae3e4['dialActive'])){_0x5ae3e4[_0x0da7('0x55')]='NOT_ACTIVE';}else if(!this[_0x0da7('0xa2')](_0x5ae3e4[_0x0da7('0x5b')])){if(!this[_0x0da7('0xa2')](_0x5ae3e4[_0x0da7('0xa3')])){_0x5ae3e4[_0x0da7('0x55')]=_0x0da7('0xa4');}else{_0x5ae3e4[_0x0da7('0x55')]=_0x0da7('0xa5');}}else{_0x5ae3e4['message']=_0x0da7('0xa5');}emitCampaignPreview(_0x5ae3e4);};Preview[_0x0da7('0x12')][_0x0da7('0xa6')]=function(_0x129c95,_0x209225,_0x447a5f){var _0xe06095=this;var _0x1e1003=this[_0x0da7('0x18')][_0x209225];var _0x3486a5=this['campaignsPreview'][_0x1e1003[_0x0da7('0x79')]];var _0x5da448;if(_0x3486a5){switch(_0x447a5f){case'1':_0x3486a5[_0x0da7('0x44')]+=0x1;_0x1e1003[_0x0da7('0xa7')]+=0x1;_0x1e1003[_0x0da7('0xa8')]=ut[_0x0da7('0xa9')](_0x1e1003);ut[_0x0da7('0x96')](_0x1e1003,0x0,'NoSuchNumber');rpcDb[_0x0da7('0x9b')](_0x1e1003,_0x0da7('0xaa'));if(ut[_0x0da7('0xa9')](_0x1e1003)>=_0x3486a5[_0x0da7('0xab')]){_0x5da448=ut['cloneAction'](_0x1e1003,0xf,_0x0da7('0xac'));rpcDb[_0x0da7('0x9d')](_0x5da448,_0x0da7('0xad'));}else{if(_0x1e1003[_0x0da7('0xa7')]>=_0x3486a5[_0x0da7('0xae')]){rpcDb['createCustomerFinal'](_0x1e1003,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{rpcDb[_0x0da7('0xaf')](ut[_0x0da7('0xb0')](_0x1e1003,_0x0da7('0xa7'),_0x3486a5[_0x0da7('0xb1')]),_0x1e1003['unlockAgent'],_0x1e1003['activeContact']);}}delete this['actions'][_0x129c95[_0x0da7('0xb2')]];break;case _0x0da7('0xb3'):var _0x4860e4=moment()[_0x0da7('0x5f')](_0x0da7('0x95'));_0x1e1003['responsetime']=_0x4860e4;_0x1e1003[_0x0da7('0xb4')]=_0x4860e4;_0x1e1003['dialAnswer']=!![];_0x3486a5[_0x0da7('0x65')]+=0x1;logger[_0x0da7('0x61')](_0x0da7('0xb5'),_0x1e1003[_0x0da7('0xb6')],_0x0da7('0xb7'),_0x3486a5['name'],_0x0da7('0xb8'),_0x3486a5[_0x0da7('0x65')]);ami['emit'](_0x0da7('0xb9'),ut[_0x0da7('0xba')](_0x1e1003,_0x0da7('0xbb')));if(_0x3486a5[_0x0da7('0xbc')]){ami['emit'](_0x0da7('0xbd'),ut[_0x0da7('0xbe')](_0x1e1003));}break;case'16':ami['emit'](_0x0da7('0xbf'),ut['buildObj'](_0x1e1003,_0x0da7('0xc0')));emitVoiceQueueChannelRemove(ut[_0x0da7('0xba')](_0x1e1003,_0x0da7('0xc0')));_0x3486a5[_0x0da7('0x3e')]+=0x1;_0x3486a5[_0x0da7('0x33')]+=0x1;_0x3486a5[_0x0da7('0x2d')]+=0x1;ut[_0x0da7('0xc1')](_0x3486a5,_0x0da7('0xc2'));_0x1e1003['countglobal']=ut[_0x0da7('0xa9')](_0x1e1003);ut['logCustomer'](_0x1e1003,0x4,_0x0da7('0xc3'));rpcDb[_0x0da7('0x9b')](_0x1e1003,_0x0da7('0xc4'));rpcDb['createCustomerFinal'](_0x1e1003,_0x0da7('0xc5'));rpcDb[_0x0da7('0xc6')](_0x1e1003);_0x3486a5[_0x0da7('0x31')]+=_0x1e1003[_0x0da7('0xc7')];_0x3486a5[_0x0da7('0x30')]+=_0x1e1003[_0x0da7('0xc7')];logger[_0x0da7('0x61')](_0x0da7('0xc8'),_0x1e1003[_0x0da7('0xb6')],_0x0da7('0xb7'),_0x3486a5[_0x0da7('0x2c')],_0x0da7('0xb8'),_0x3486a5['pTalking']);delete this[_0x0da7('0x18')][_0x129c95[_0x0da7('0xb2')]];break;case _0x0da7('0xc9'):_0x3486a5['outboundBusyCallsDay']+=0x1;_0x1e1003[_0x0da7('0xca')]+=0x1;_0x1e1003[_0x0da7('0xa8')]=ut[_0x0da7('0xa9')](_0x1e1003);ut[_0x0da7('0x96')](_0x1e1003,0x5,_0x0da7('0xcb'));rpcDb[_0x0da7('0x9b')](_0x1e1003,'[callProgressDetectingCustomer][logBusy]');if(ut['totalGlobal'](_0x1e1003)>=_0x3486a5['dialGlobalMaxRetry']){_0x5da448=ut[_0x0da7('0xcc')](_0x1e1003,0xf,_0x0da7('0xac'));rpcDb[_0x0da7('0x9d')](_0x5da448,_0x0da7('0xcd'));}else{if(_0x1e1003[_0x0da7('0xca')]>=_0x3486a5[_0x0da7('0xce')]){rpcDb[_0x0da7('0x9d')](_0x1e1003,'[callProgressDetectingCustomer][logBusy]');}else{rpcDb[_0x0da7('0xaf')](ut[_0x0da7('0xb0')](_0x1e1003,_0x0da7('0xca'),_0x3486a5[_0x0da7('0xcf')]),_0x1e1003[_0x0da7('0xd0')],_0x1e1003[_0x0da7('0xd1')]);}}break;case _0x0da7('0xd2'):_0x3486a5[_0x0da7('0xd3')]+=0x1;_0x1e1003['countnoanswerretry']+=0x1;_0x1e1003[_0x0da7('0xa8')]=ut['totalGlobal'](_0x1e1003);ut[_0x0da7('0x96')](_0x1e1003,0x3,_0x0da7('0xd4'));rpcDb[_0x0da7('0x9b')](_0x1e1003,_0x0da7('0xd5'));if(ut[_0x0da7('0xa9')](_0x1e1003)>=_0x3486a5[_0x0da7('0xab')]){_0x5da448=ut['cloneAction'](_0x1e1003,0xf,_0x0da7('0xac'));rpcDb[_0x0da7('0x9d')](_0x5da448,_0x0da7('0xd6'));}else{if(_0x1e1003[_0x0da7('0xd7')]>=_0x3486a5[_0x0da7('0xd8')]){rpcDb[_0x0da7('0x9d')](_0x1e1003,_0x0da7('0xd5'));}else{rpcDb[_0x0da7('0xaf')](ut['scheduledAt'](_0x1e1003,'countnoanswerretry',_0x3486a5[_0x0da7('0xd9')]),_0x1e1003[_0x0da7('0xd0')],_0x1e1003[_0x0da7('0xd1')]);}}break;case _0x0da7('0xda'):_0x3486a5[_0x0da7('0x41')]+=0x1;_0x1e1003[_0x0da7('0xdb')]+=0x1;_0x1e1003[_0x0da7('0xa8')]=ut['totalGlobal'](_0x1e1003);ut[_0x0da7('0x96')](_0x1e1003,0x8,_0x0da7('0xdc'));rpcDb[_0x0da7('0x9b')](_0x1e1003,_0x0da7('0xdd'));if(ut['totalGlobal'](_0x1e1003)>=_0x3486a5[_0x0da7('0xab')]){_0x5da448=ut['cloneAction'](_0x1e1003,0xf,_0x0da7('0xac'));rpcDb[_0x0da7('0x9d')](_0x5da448,_0x0da7('0xde'));}else{if(_0x1e1003[_0x0da7('0xdb')]>=_0x3486a5[_0x0da7('0xdf')]){rpcDb[_0x0da7('0x9d')](_0x1e1003,'[callProgressDetectingCustomer][logCongestion]');}else{rpcDb[_0x0da7('0xaf')](ut[_0x0da7('0xb0')](_0x1e1003,_0x0da7('0xdb'),_0x3486a5['dialBusyRetryFrequency']),_0x1e1003['unlockAgent'],_0x1e1003['activeContact']);}}break;case _0x0da7('0xe0'):_0x3486a5[_0x0da7('0x47')]+=0x1;_0x1e1003[_0x0da7('0xe1')]+=0x1;_0x1e1003[_0x0da7('0xa8')]=ut[_0x0da7('0xa9')](_0x1e1003);ut[_0x0da7('0x96')](_0x1e1003,0x14,_0x0da7('0xe2'));rpcDb[_0x0da7('0x9b')](_0x1e1003,'[syncHangupRequest][logAgentReject]');if(ut['totalGlobal'](_0x1e1003)>=_0x3486a5[_0x0da7('0xab')]){_0x5da448=ut[_0x0da7('0xcc')](_0x1e1003,0x14,'AgentReject');rpcDb[_0x0da7('0x9d')](_0x5da448,_0x0da7('0xe3'));}else{if(_0x1e1003['countagentrejectretry']>=_0x3486a5[_0x0da7('0xe4')]){rpcDb['createCustomerFinal'](_0x1e1003,_0x0da7('0xe3'));}else{rpcDb[_0x0da7('0xaf')](ut['scheduledAt'](_0x1e1003,_0x0da7('0xe1'),_0x3486a5[_0x0da7('0xe5')]),_0x1e1003['unlockAgent'],_0x1e1003[_0x0da7('0xd1')]);}}break;case _0x0da7('0xe6'):_0x3486a5['outboundAbandonedCallsDay']+=0x1;_0x1e1003[_0x0da7('0xe7')]+=0x1;_0x1e1003[_0x0da7('0xa8')]=ut[_0x0da7('0xa9')](_0x1e1003);ut[_0x0da7('0x96')](_0x1e1003,0xb,_0x0da7('0xe8'));rpcDb['createCustomerHistory'](_0x1e1003,'[callProgressDetectingCustomer][logAbandoned]');if(ut[_0x0da7('0xa9')](_0x1e1003)>=_0x3486a5[_0x0da7('0xab')]){_0x5da448=ut[_0x0da7('0xcc')](_0x1e1003,0xf,'Global');rpcDb[_0x0da7('0x9d')](_0x5da448,'[callProgressDetectingCustomer][logAbandoned]');}else{if(_0x1e1003[_0x0da7('0xe9')]>=_0x3486a5[_0x0da7('0xea')]){rpcDb[_0x0da7('0x9d')](_0x1e1003,_0x0da7('0xeb'));}else{rpcDb[_0x0da7('0xaf')](ut[_0x0da7('0xb0')](_0x1e1003,_0x0da7('0xe7'),_0x3486a5[_0x0da7('0xec')]),_0x1e1003[_0x0da7('0xd0')],_0x1e1003[_0x0da7('0xd1')]);}}break;default:if(_0x1e1003['dialAnswer']){ut[_0x0da7('0xc1')](_0x3486a5,_0x0da7('0xed'));ut[_0x0da7('0x85')](_0x0da7('0xee')+_0x3486a5[_0x0da7('0x2c')],_0x129c95);}_0x3486a5[_0x0da7('0x48')]+=0x1;_0x1e1003['countglobal']=ut['totalGlobal'](_0x1e1003);ut['logCustomer'](_0x1e1003,0xc,_0x129c95[_0x0da7('0xef')]||_0x129c95['dialstatus']);rpcDb[_0x0da7('0x9b')](_0x1e1003,_0x0da7('0xf0'));if(ut[_0x0da7('0xa9')](_0x1e1003)>=_0x3486a5[_0x0da7('0xab')]){_0x5da448=ut[_0x0da7('0xcc')](_0x1e1003,0xf,'Global');rpcDb[_0x0da7('0x9d')](_0x5da448,_0x0da7('0xf1'));}else{rpcDb[_0x0da7('0x9d')](_0x1e1003,_0x0da7('0xf1'));}delete this[_0x0da7('0x18')][_0x129c95[_0x0da7('0xb2')]];}if(!(_0x1e1003['dialAnswer']&&_0x447a5f==='16')){ut['updateOriginated'](_0x3486a5,_0x0da7('0xf2'));logger[_0x0da7('0x61')]('[originated][decrement][callProgressDetectingCustomer]',_0x1e1003['uniqueid'],_0x0da7('0xb7'),_0x3486a5['name'],_0x0da7('0x7a'),_0x3486a5['originated']);}if(_0x447a5f!==_0x0da7('0xb3')){delete this[_0x0da7('0x18')][_0x129c95['linkedid']];delete this[_0x0da7('0x18')][_0x129c95[_0x0da7('0xf3')]];}}};Preview['prototype'][_0x0da7('0xf4')]=function(_0x529f8f,_0x360f34,_0x2acc5f){if(_[_0x0da7('0xf5')](_0x360f34)&&_0x0da7('0xf6')!==typeof _0x360f34){return;}if(_[_0x0da7('0xf5')](_0x2acc5f)&&_0x0da7('0xf6')!==typeof _0x2acc5f){return;}switch(_0x2acc5f['reason']){case'0':ut[_0x0da7('0xf7')](_0x529f8f,0x0,_0x0da7('0xf8'));rpcDb[_0x0da7('0xf9')](_0x529f8f,_0x0da7('0xfa'));break;case'3':ut[_0x0da7('0xf7')](_0x529f8f,0x3,_0x0da7('0xd4'));rpcDb[_0x0da7('0xf9')](_0x529f8f,_0x0da7('0xfb'));break;case'5':ut[_0x0da7('0xf7')](_0x529f8f,0x5,'Busy');rpcDb['createAgentHistory'](_0x529f8f,_0x0da7('0xfc'));break;case'8':ut[_0x0da7('0xf7')](_0x529f8f,0x8,_0x0da7('0xdc'));rpcDb['createAgentHistory'](_0x529f8f,_0x0da7('0xfd'));break;case'22':ut[_0x0da7('0xf7')](_0x529f8f,0x16,_0x0da7('0xfe'));rpcDb[_0x0da7('0xf9')](_0x529f8f,_0x0da7('0xff'));break;default:ut[_0x0da7('0xf7')](_0x529f8f,0xc,_0x2acc5f[_0x0da7('0x100')]);rpcDb[_0x0da7('0xf9')](_0x529f8f,_0x0da7('0xfd'));}ut[_0x0da7('0x83')](_0x360f34,_0x0da7('0x101'));logger[_0x0da7('0x61')](_0x0da7('0x102'),_0x529f8f[_0x0da7('0xb6')],'\x20Queue',_0x360f34['name'],_0x0da7('0x7a'),_0x360f34[_0x0da7('0x56')]);delete this[_0x0da7('0x18')][_0x529f8f[_0x0da7('0xb6')]];};Preview[_0x0da7('0x12')][_0x0da7('0x103')]=function(_0x6de383,_0x13b8f1,_0x4aecc1,_0xcb016b,_0x119fcd){var _0x1fb544=this;return new BPromise(function(_0x230588,_0x516b03){if(_[_0x0da7('0x77')](_0x13b8f1)||_[_0x0da7('0x77')](_0x13b8f1[_0x0da7('0x104')])||_[_0x0da7('0x77')](_0x13b8f1[_0x0da7('0x104')][_0x0da7('0x105')])||_['isNil'](_0x13b8f1['VoiceQueueId'])){_0x516b03(ut[_0x0da7('0x55')](_0x0da7('0x106'),_0xcb016b,_0x119fcd));return;}var _0x50f3a6=uuid['v4']();var _0x6e5475=_0x1fb544[_0x0da7('0x16')][_0x13b8f1[_0x0da7('0x78')][_0x0da7('0x2c')]];var _0x322617=_0x4aecc1?_0x1fb544[_0x0da7('0x19')][_0x4aecc1]['id']:undefined;_0x1fb544[_0x0da7('0x18')][_0x50f3a6]=new Action(_0x13b8f1,_0x6e5475,_0x50f3a6,_0x4aecc1,_0x322617);var _0x5d0ab6=_0x1fb544[_0x0da7('0x18')][_0x50f3a6];_0x5d0ab6['unlockAgent']=_0xcb016b;_0x5d0ab6[_0x0da7('0xd1')]=_0x119fcd;_0x5d0ab6[_0x0da7('0x107')]=_0x4aecc1;if(_[_0x0da7('0x108')](_0x6de383)){_0x1fb544[_0x0da7('0x109')](_0x5d0ab6,_0x6e5475,_0x13b8f1,_0x4aecc1)['then'](function(_0x5df8b2){logger[_0x0da7('0x61')](_0x0da7('0x10a'),_0x0da7('0x10b')+_0x5d0ab6[_0x0da7('0x79')]+_0x0da7('0x10c')+_0x5d0ab6[_0x0da7('0x10d')],JSON[_0x0da7('0x5e')](_0x5df8b2));ami[_0x0da7('0x2a')](_0x0da7('0x10e'),ut['buildObj'](_0x5d0ab6,_0x0da7('0x10f')));_0x230588(ut[_0x0da7('0x55')](_0x0da7('0x110')));})[_0x0da7('0x81')](function(_0xfffce4){ut['logger'](_0x0da7('0x111'),_0xfffce4);_0x516b03(ut[_0x0da7('0x55')](_0x0da7('0x112'),_0xcb016b,_0x119fcd));});}else{_0x6e5475['outboundBlacklistCallsDay']+=0x1;ut[_0x0da7('0x113')](_0x5d0ab6);rpcDb[_0x0da7('0x114')](_0x5d0ab6,_0x0da7('0x115'));delete _0x1fb544[_0x0da7('0x18')][_0x50f3a6];_0x516b03(ut[_0x0da7('0x55')](_0x0da7('0x116'),_0xcb016b,_0x119fcd));}});};Preview[_0x0da7('0x12')][_0x0da7('0xa2')]=function(_0x497885){return!_[_0x0da7('0x77')](_0x497885)&&!_[_0x0da7('0x77')](_0x497885[_0x0da7('0x2c')])&&!_[_0x0da7('0x77')](_0x497885[_0x0da7('0x117')])&&_0x497885[_0x0da7('0x117')]&&!_['isNil'](this[_0x0da7('0x17')][util['format'](_0x0da7('0x118'),_0x497885[_0x0da7('0x2c')])])&&!_[_0x0da7('0x77')](this[_0x0da7('0x17')][util[_0x0da7('0x5f')]('SIP/%s',_0x497885[_0x0da7('0x2c')])][_0x0da7('0x80')])&&(this['trunks'][util[_0x0da7('0x5f')](_0x0da7('0x118'),_0x497885[_0x0da7('0x2c')])][_0x0da7('0x80')]===_0x0da7('0x119')||this['trunks'][util[_0x0da7('0x5f')]('SIP/%s',_0x497885[_0x0da7('0x2c')])][_0x0da7('0x80')]===_0x0da7('0x11a'));};Preview['prototype']['run']=function(_0x120461,_0x260310){var _0x21e237=this;return new BPromise(function(_0x3a7b61,_0x49b7a5){_0x21e237[_0x0da7('0x11b')](_0x120461,_0x260310)['then'](function(_0x584b0a){_0x3a7b61(_[_0x0da7('0x7c')](_0x584b0a,['message']));})[_0x0da7('0x81')](function(_0x529697){if(_0x529697['unlock']){rpcDb[_0x0da7('0x11c')](_0x120461);}if(_0x529697[_0x0da7('0x117')]){rpcDb[_0x0da7('0x93')](_0x120461);}_0x49b7a5(_[_0x0da7('0x7c')](_0x529697,[_0x0da7('0x55')]));});});};Preview[_0x0da7('0x12')][_0x0da7('0x11b')]=function(_0x36ed36,_0x3e6ce4){var _0x496f00=this;return new BPromise(function(_0x8c7cef,_0x11992e){var _0x57a8ab,_0x57032d;rpcDb['getContactPreview'](_0x36ed36)[_0x0da7('0x90')](function(_0x3f5767){if(!_[_0x0da7('0x77')](_0x3f5767[0x0])){_0x57032d=_0x3f5767[0x0][_0x0da7('0x11d')]?![]:!![];_0x57a8ab=_0x3f5767[0x0][_0x0da7('0x11d')]?!![]:![];_0x57a8ab=_0x3e6ce4?!![]:_0x57a8ab;}var _0x2d7058=_0x496f00[_0x0da7('0x11e')](_0x3f5767);if(_0x2d7058['isValid']){rpcDb['checkIsBlackList'](_[_0x0da7('0x7c')](_0x3f5767[0x0],[_0x0da7('0x11f'),_0x0da7('0x120')]))[_0x0da7('0x90')](function(_0x31511b){_0x496f00[_0x0da7('0x103')](_0x31511b,_0x3f5767[0x0],_0x3e6ce4,_0x57032d,_0x57a8ab)[_0x0da7('0x90')](function(_0x5367ba){_0x8c7cef(_0x5367ba);})[_0x0da7('0x81')](function(_0x3117c8){_0x11992e(_0x3117c8);});})[_0x0da7('0x81')](function(_0x53e01b){ut[_0x0da7('0x67')]('[Preview][checkIsBlackList]',_0x53e01b);_0x11992e(ut[_0x0da7('0x55')](_0x0da7('0x121'),_0x57032d,_0x57a8ab));});}else{_0x11992e(ut['message'](_0x2d7058[_0x0da7('0x55')],_0x57032d,_0x57a8ab));}})[_0x0da7('0x81')](function(_0x4755da){ut[_0x0da7('0x67')](_0x0da7('0x122'),_0x4755da);_0x11992e(ut[_0x0da7('0x55')]('Call\x20unsuccessful',![],!![]));});});};Preview[_0x0da7('0x12')][_0x0da7('0x11e')]=function(_0x45335f){if(_[_0x0da7('0x77')](_0x45335f)||_[_0x0da7('0x108')](_0x45335f)||!_['isNil'](_0x45335f[0x0][_0x0da7('0x8d')])&&_[_0x0da7('0x77')](_0x45335f[0x0][_0x0da7('0x8d')]['name'])){ut['logger']('[Preview][validateContact][Empty\x20Contact]',_0x45335f);return{'isValid':![],'message':_0x0da7('0x123')};}var _0x71c12=this[_0x0da7('0x16')][_0x45335f[0x0][_0x0da7('0x78')][_0x0da7('0x2c')]];_0x71c12[_0x0da7('0x55')]=_0x0da7('0xa5');if(_[_0x0da7('0x77')](_0x71c12)){ut['logger'](_0x0da7('0x124'),_0x71c12);return{'isValid':![],'message':_0x0da7('0x125')};}if(!this['isTrunkReachable'](_0x71c12[_0x0da7('0x5b')])){ut[_0x0da7('0x67')]('[Preview][validateContact][Trunk\x20not\x20work]',_0x0da7('0x126')+_0x71c12[_0x0da7('0x2c')]+_0x0da7('0x127'));if(!this[_0x0da7('0xa2')](_0x71c12[_0x0da7('0xa3')])){ut[_0x0da7('0x67')]('[Preview][validateContact][Trunk\x20not\x20work]',_0x71c12[_0x0da7('0x2c')]+_0x0da7('0x128'));return{'isValid':![],'message':'Trunk\x20not\x20work'};}}if(!ut['isActive'](_0x71c12[_0x0da7('0x72')])){ut[_0x0da7('0x67')](_0x0da7('0x129'),_0x71c12[_0x0da7('0x2c')]+_0x0da7('0x12a'));return{'isValid':![],'message':_0x0da7('0x126')+_0x71c12[_0x0da7('0x2c')]+_0x0da7('0x12a')};}return{'isValid':!![],'message':_0x0da7('0x12b')};};Preview[_0x0da7('0x12')][_0x0da7('0x109')]=function(_0x9c837c,_0x4f44c4,_0x540fc4,_0x55537d){var _0x3977da=this;return new BPromise(function(_0x366ad4,_0x1db13){var _0x589841=_0x9c837c[_0x0da7('0xb6')];var _0x567d16=_0x3977da['isTrunkReachable'](_0x4f44c4['Trunk'])?util[_0x0da7('0x5f')](_0x0da7('0x12c'),_0x4f44c4[_0x0da7('0x5b')][_0x0da7('0x2c')],_[_0x0da7('0x77')](_0x4f44c4[_0x0da7('0x3c')])?'':_0x4f44c4[_0x0da7('0x3c')]['trim']()||'',_0x4f44c4['dialCutDigit']>0x0?_0x540fc4[_0x0da7('0x104')][_0x0da7('0x105')][_0x0da7('0x12d')](_0x4f44c4[_0x0da7('0x12e')]):_0x540fc4[_0x0da7('0x104')]['phone']):util[_0x0da7('0x5f')]('SIP/%s/%s%s',_[_0x0da7('0x77')](_0x4f44c4[_0x0da7('0xa3')])?_0x4f44c4[_0x0da7('0x5b')]['name']:_0x4f44c4[_0x0da7('0xa3')]['name'],_['isNil'](_0x4f44c4[_0x0da7('0x3c')])?'':_0x4f44c4['dialPrefix'][_0x0da7('0x12f')]()||'',_0x4f44c4[_0x0da7('0x12e')]>0x0?_0x540fc4[_0x0da7('0x104')][_0x0da7('0x105')][_0x0da7('0x12d')](_0x4f44c4[_0x0da7('0x12e')]):_0x540fc4[_0x0da7('0x104')]['phone']);var _0x55dcbd=_0x3977da['isTrunkReachable'](_0x4f44c4[_0x0da7('0x5b')])?ut[_0x0da7('0x130')](_0x4f44c4[_0x0da7('0x5b')][_0x0da7('0x5c')],_0x4f44c4[_0x0da7('0x39')],_0x4f44c4[_0x0da7('0x131')]>0x0?ut[_0x0da7('0x132')](_0x4f44c4['dialOriginateCallerIdNumber'],_0x4f44c4[_0x0da7('0x131')]):_0x4f44c4[_0x0da7('0x3a')]):ut[_0x0da7('0x130')](_[_0x0da7('0x77')](_0x4f44c4[_0x0da7('0xa3')])?_0x4f44c4[_0x0da7('0x5b')][_0x0da7('0x5c')]:_0x4f44c4['TrunkBackup'][_0x0da7('0x5c')],_0x4f44c4[_0x0da7('0x39')],_0x4f44c4[_0x0da7('0x131')]>0x0?ut[_0x0da7('0x132')](_0x4f44c4[_0x0da7('0x3a')],_0x4f44c4[_0x0da7('0x131')]):_0x4f44c4['dialOriginateCallerIdNumber']);if(_0x55dcbd){_0x9c837c[_0x0da7('0x133')]=ut[_0x0da7('0x134')](_0x55dcbd);_0x9c837c[_0x0da7('0x135')]=ut[_0x0da7('0x136')](_0x55dcbd);}var _0x7f2274=ut['addVariables'](_0x4f44c4,_0x540fc4,_0x567d16,_0x55dcbd,_0x589841,_0x9c837c);_[_0x0da7('0x137')](_0x9c837c,ut[_0x0da7('0x138')](_0x7f2274));_0x9c837c['starttime']=moment()['format'](_0x0da7('0x95'));ami[_0x0da7('0x7f')](ut[_0x0da7('0x139')](_0x9c837c,_0x4f44c4,_0x7f2274,_0x9c837c[_0x0da7('0xd1')],_0x55537d))[_0x0da7('0x90')](function(_0x4f3e51){_0x4f44c4['originated']+=0x1;logger[_0x0da7('0x61')](_0x0da7('0x13a'),_0x589841,_0x0da7('0xb7'),_0x4f44c4[_0x0da7('0x2c')],'originated:\x20',_0x4f44c4[_0x0da7('0x56')]);_0x366ad4(_0x4f3e51);})[_0x0da7('0x81')](function(_0x12c491){ut[_0x0da7('0xf7')](_0x9c837c,0xe,_0x0da7('0x13b'));rpcDb[_0x0da7('0xf9')](_0x9c837c,_0x0da7('0x13c'));_0x1db13(_0x12c491);});});};Preview[_0x0da7('0x12')][_0x0da7('0x24')]=function(_0x1b0b25){if(this[_0x0da7('0x18')][_0x1b0b25[_0x0da7('0xb2')]]){this[_0x0da7('0x18')][_0x1b0b25[_0x0da7('0xb2')]][_0x0da7('0x13d')]=_0x1b0b25['channel'];}};Preview[_0x0da7('0x12')][_0x0da7('0x1b')]=function(_0x76fad){var _0x5c513e=this;var _0x3026cc=this[_0x0da7('0x18')][_0x76fad[_0x0da7('0x13e')]];if(_0x3026cc){if(_0x3026cc[_0x0da7('0x107')]&&this[_0x0da7('0x19')][_0x3026cc['lookAgent']]){ut[_0x0da7('0x13f')](_0x3026cc,this[_0x0da7('0x19')][_0x3026cc[_0x0da7('0x107')]][_0x0da7('0x2c')],this[_0x0da7('0x19')][_0x3026cc[_0x0da7('0x107')]]['id']);}var _0x5755c7=_[_0x0da7('0x140')](_0x3026cc);_0x5755c7['responsetime']=moment()[_0x0da7('0x5f')](_0x0da7('0x95'));var _0x444333=_0x5c513e[_0x0da7('0x16')][_0x3026cc[_0x0da7('0x79')]];if(ut[_0x0da7('0x141')](_0x76fad[_0x0da7('0x142')])){if(_0x3026cc[_0x0da7('0xd0')]){rpcDb[_0x0da7('0x11c')](_0x3026cc[_0x0da7('0x10d')]);}if(_0x3026cc[_0x0da7('0xd1')]){rpcDb[_0x0da7('0x93')](_0x3026cc['idContact']);}ami[_0x0da7('0x2a')]('custom:agentringnoanswer',ut['buildObj'](_0x3026cc,_0x0da7('0x143')));this[_0x0da7('0xf4')](_0x5755c7,_0x444333,_0x76fad);}else{_0x3026cc['starttime']=moment()[_0x0da7('0x5f')]('YYYY-MM-DD\x20HH:mm:ss');ut[_0x0da7('0xf7')](_0x5755c7,0x4,_0x0da7('0xc3'));rpcDb[_0x0da7('0xf9')](_0x5755c7,_0x0da7('0x144'));}}};Preview[_0x0da7('0x12')]['syncHangup']=function(_0x3396a0){var _0x5eb9c8=this;var _0x87a065=this[_0x0da7('0x18')][_0x3396a0[_0x0da7('0xb2')]];var _0x50b2e3;if(_0x87a065){_0x50b2e3=this[_0x0da7('0x16')][_0x87a065[_0x0da7('0x79')]];logger[_0x0da7('0x61')](_0x0da7('0x145'),_0x3396a0['linkedid'],_0x0da7('0xb7'),_0x50b2e3[_0x0da7('0x2c')],_0x0da7('0xb8'),_0x50b2e3['pTalking']);}if(this[_0x0da7('0x18')][_0x3396a0['linkedid']]&&_0x3396a0[_0x0da7('0xb2')]!==_0x3396a0['uniqueid']){if(_0x3396a0[_0x0da7('0x146')]==='16'&&this[_0x0da7('0x18')][_0x3396a0['linkedid']][_0x0da7('0x7b')]){this[_0x0da7('0xa6')](_0x3396a0,_0x3396a0[_0x0da7('0xb2')],_0x3396a0['cause']);}else if(this['actions'][_0x3396a0[_0x0da7('0xb2')]][_0x0da7('0x7b')]){logger['info']('[syncHangup][talking][cause]',_0x3396a0['linkedid'],_0x3396a0['cause'],_0x0da7('0xb7'),_0x50b2e3[_0x0da7('0x2c')],'pTalking:\x20',_0x50b2e3[_0x0da7('0x65')]);this[_0x0da7('0xa6')](_0x3396a0,_0x3396a0[_0x0da7('0xb2')],_0x3396a0['cause']);}}else if(_0x87a065&&_['isNil'](_0x87a065[_0x0da7('0x147')])&&_0x50b2e3['dialQueueProject']&&_0x3396a0[_0x0da7('0xb2')]===_0x3396a0[_0x0da7('0xb6')]&&_[_0x0da7('0x77')](_0x3396a0[_0x0da7('0x100')])&&_0x3396a0[_0x0da7('0x146')]==='16'&&_0x3396a0[_0x0da7('0x148')]==='6'&&_[_0x0da7('0xf5')](_0x87a065[_0x0da7('0x149')])){if(_0x87a065[_0x0da7('0xd0')]){rpcDb['unlockContact'](_0x87a065['idContact']);}if(_0x87a065[_0x0da7('0xd1')]){rpcDb[_0x0da7('0x93')](_0x87a065[_0x0da7('0x10d')]);}_0x3396a0[_0x0da7('0x100')]='22';this[_0x0da7('0xf4')](_0x87a065,_0x50b2e3,_0x3396a0);}else if(_0x87a065&&_0x87a065[_0x0da7('0x149')]){if(_0x3396a0[_0x0da7('0x146')]==='16'&&this[_0x0da7('0x18')][_0x3396a0[_0x0da7('0xb2')]][_0x0da7('0x7b')]){logger['info']('[syncHangup][talking][transfer]',_0x3396a0['linkedid'],_0x3396a0[_0x0da7('0x146')],_0x0da7('0xb7'),_0x50b2e3[_0x0da7('0x2c')],'pTalking:\x20',_0x50b2e3['pTalking']);this['callProgressDetectingCustomer'](_0x3396a0,_0x3396a0[_0x0da7('0xb2')],_0x3396a0[_0x0da7('0x146')]);}else if(this[_0x0da7('0x18')][_0x3396a0['linkedid']][_0x0da7('0x7b')]){logger[_0x0da7('0x61')](_0x0da7('0x14a'),_0x3396a0[_0x0da7('0xb2')],_0x3396a0[_0x0da7('0x146')],_0x0da7('0xb7'),_0x50b2e3['name'],_0x0da7('0xb8'),_0x50b2e3[_0x0da7('0x65')]);this[_0x0da7('0xa6')](_0x3396a0,_0x3396a0[_0x0da7('0xb2')],_0x3396a0[_0x0da7('0x146')]);}}};Preview[_0x0da7('0x12')][_0x0da7('0x22')]=function(_0x394a0a){if(this[_0x0da7('0x18')][_0x394a0a[_0x0da7('0xf3')]]&&_0x394a0a['destlinkedid']!==_0x394a0a[_0x0da7('0x14b')]){this[_0x0da7('0xa6')](_0x394a0a,_0x394a0a['destlinkedid'],_0x394a0a['dialstatus']);}};Preview['prototype']['syncHangupRequest']=function(_0x417963){if(this[_0x0da7('0x18')][_0x417963[_0x0da7('0xb2')]]&&_0x417963[_0x0da7('0xb2')]!==_0x417963[_0x0da7('0xb6')]&&!this[_0x0da7('0x18')][_0x417963[_0x0da7('0xb2')]][_0x0da7('0x7b')]){if(_0x417963['cause']==='1'){this['callProgressDetectingCustomer'](_0x417963,_0x417963[_0x0da7('0xb2')],_0x417963[_0x0da7('0x146')]);}}};Preview[_0x0da7('0x12')][_0x0da7('0x14c')]=function(_0x5d10d5,_0x30f15e,_0x2d0e84){if(this[_0x0da7('0x18')][_0x5d10d5]){if(_[_0x0da7('0x77')](this['actions'][_0x5d10d5][_0x0da7('0x14d')])){this[_0x0da7('0x18')][_0x5d10d5][_0x0da7('0x14d')]={};}this[_0x0da7('0x18')][_0x5d10d5][_0x0da7('0x14d')][_0x30f15e]=_0x2d0e84;}};Preview[_0x0da7('0x12')][_0x0da7('0x26')]=function(_0x40c739){try{if(!_['isNil'](_0x40c739)){if(ut['filterKey'](_[_0x0da7('0x14e')](_0x40c739[_0x0da7('0x14f')])[0x0])){this['addVariable'](_0x40c739[_0x0da7('0xb6')],_[_0x0da7('0x14e')](_0x40c739['variable'])[0x0],_0x40c739[_0x0da7('0x150')]);}}}catch(_0x219c08){logger['error']('[syncVarSet][Preview]',util[_0x0da7('0x151')](_0x219c08,{'showHidden':![],'depth':null}));}};Preview[_0x0da7('0x12')][_0x0da7('0x28')]=function(_0x1b7bf9){if(_0x1b7bf9){if(this[_0x0da7('0x18')][_0x1b7bf9[_0x0da7('0x152')]]){this[_0x0da7('0x18')][_0x1b7bf9['transfertargetlinkedid']][_0x0da7('0x149')]=!![];}}};Preview[_0x0da7('0x12')][_0x0da7('0x29')]=function(_0x50aa33){if(_0x50aa33){if(this[_0x0da7('0x18')][_0x50aa33[_0x0da7('0x153')]]){this[_0x0da7('0x18')][_0x50aa33['transfererlinkedid']][_0x0da7('0x149')]=!![];}}};module[_0x0da7('0x154')]=Preview; \ No newline at end of file +var _0x379d=['dialAnswer','contactId','UserId','VoiceQueueId','ListId','Action','status','channel','catch','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','decrementTalkink','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','[action]','size','recallMe','getContactRecallMe','agentReadyId','then','getDiff','Agent','voicePause','run','logger2','[RecallMe]','disableContact','format','YYYY-MM-DD\x20HH:mm:ss','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','IsNotLoggedIn','loggedIn','AGENTS_NOT_LOGGED','isActive','dialActive','isTrunkReachable','TRUNK_IS_NOT_REACHABLE','ACTIVE','callProgressDetectingCustomer','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','[callProgressDetectingCustomer][logNoSuch]','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','rescheduleContact','scheduledAt','dialNoSuchNumberRetryFrequency','unlockAgent','activeContact','linkedid','ANSWER','answertime','uniqueid','\x20Queue','custom:agentconnect','buildObj','connect','acw','buildAcw','custom:agentcomplete','complete','answered','[16]','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','talktime','sumBillable','[syncHangup][talking][decrement]','countbusyretry','Busy','dialGlobalMaxRetry','cloneAction','dialBusyMaxRetry','[callProgressDetectingCustomer][logBusy]','dialBusyRetryFrequency','NOANSWER','outboundNoAnswerCallsDay','countnoanswerretry','NoAnswer','dialNoAnswerMaxRetry','[callProgressDetectingCustomer][logNoAnswer]','dialNoAnswerRetryFrequency','CONGESTION','countcongestionretry','Congestion','dialCongestionMaxRetry','[callProgressDetectingCustomer][logCongestion]','CANCEL','AgentReject','countagentrejectretry','dialAgentRejectMaxRetry','ABANDONED','outboundAbandonedCallsDay','countabandonedretry','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','dialAbandonedRetryFrequency','[Dialer][decrementTalkink][no\x20Hangup][Preview]','dialstatus','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','object','reason','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','checkInBlack','Contact','phone','Contact\x20is\x20undefined','lookAgent','isEmpty','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','custom:agentcalled','called','[Preview][execCall][failure]','Call\x20failed','logBlacklist','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','SIP/%s','unmonitored','execRun','unlockContact','pick','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','Contact.phone','[Preview][checkIsBlackList]','Call\x20unsuccessful','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','TrunkBackup','[Preview][validateContact][Trunk\x20not\x20work]','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20work','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','execCall','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','getCallerId','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','getCallerIdRandom','originatecalleridname','originatecalleridnum','merge','toLowerVariables','starttime','variablesAction','OriginateError','[originateFailure][logOriginateFailure]','syncNewExten','syncOriginateResponse','actionid','logLookAgent','clone','responsetime','isFailure','response','idContact','custom:agentringnoanswer','rejected','syncHangup','[syncHangup][talking]','cause','[syncHangup][talking][cause]','statedesc','channelstate','isUndefined','transfer','[syncHangup][talking][transfer]','destuniqueid','syncHangupRequest','variables','filterKey','keys','variable','value','inspect','syncAttendedTransfer','transfertargetlinkedid','transfererlinkedid','exports','lodash','uuid','moment','md5','ioredis','../../../config/environment','preview','actionPreview','./rpcDb','./util/util','redis','defaults','localhost','socket.io-emitter','prototype','enqueue','tail','finally','sequence','campaignsPreview','trunks','actions','agents','bind','hangup','hanguprequest','dialend','syncDialEnd','newexten','varset','syncVarSet','blindtransfer','syncBlindTransfer','loopCampaigns','emit','type','outbound','name','available','pTalking','sumHoldTime','total','unmanaged','abandoned','loggedInDb','dialMethod','dialOriginateCallerIdName','dialOriginateTimeout','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalPauses','predictiveIntervalTotalCalls','message','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startProgressive','Trunk','active','callerid','Interval','stringify','voice:queue:%s','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','voice_queue_channel:remove','sendMessageOneNotActive','originated','paused','NOT_ACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','IS_DISACTIVED','\x20is\x20disactive','syncCampaigns','hasOwnProperty','clockClearZombieChannels','setMessage','clearZombieChannel','isNil','info','Queue','queue','originated:\x20','pTalking:\x20'];(function(_0x57da6a,_0x1bc1b5){var _0x570ef7=function(_0x4ad126){while(--_0x4ad126){_0x57da6a['push'](_0x57da6a['shift']());}};_0x570ef7(++_0x1bc1b5);}(_0x379d,0xe2));var _0xd379=function(_0x322408,_0x34d007){_0x322408=_0x322408-0x0;var _0x3d30=_0x379d[_0x322408];return _0x3d30;};'use strict';var util=require('util');var _=require(_0xd379('0x0'));var BPromise=require('bluebird');var uuid=require(_0xd379('0x1'));var moment=require(_0xd379('0x2'));var md5=require(_0xd379('0x3'));var Redis=require(_0xd379('0x4'));var config=require(_0xd379('0x5'));var logger=require('../../../config/logger')(_0xd379('0x6'));var loggerAction=require('../../../config/logger')(_0xd379('0x7'));var ami=require('../ami');var rpcDb=require(_0xd379('0x8'));var Action=require('./action');var ut=require(_0xd379('0x9'));config[_0xd379('0xa')]=_[_0xd379('0xb')](config['redis'],{'host':_0xd379('0xc'),'port':0x18eb});var io=require(_0xd379('0xd'))(new Redis(config[_0xd379('0xa')]));var Sequence=function(){};Sequence[_0xd379('0xe')][_0xd379('0xf')]=function(_0x21656e){this[_0xd379('0x10')]=this['tail']?this['tail'][_0xd379('0x11')](_0x21656e):_0x21656e();};function Preview(_0x1208ab){this[_0xd379('0x12')]=new Sequence();this[_0xd379('0x13')]=_0x1208ab['voiceQueues'];this['trunks']=_0x1208ab[_0xd379('0x14')];this[_0xd379('0x15')]={};this[_0xd379('0x16')]=_0x1208ab['agents'];this['clockClearZombieChannels']=0x0;ami['on']('originateresponse',this['syncOriginateResponse'][_0xd379('0x17')](this));ami['on'](_0xd379('0x18'),this['syncHangup'][_0xd379('0x17')](this));ami['on'](_0xd379('0x19'),this['syncHangupRequest'][_0xd379('0x17')](this));ami['on'](_0xd379('0x1a'),this[_0xd379('0x1b')]['bind'](this));ami['on'](_0xd379('0x1c'),this['syncNewExten'][_0xd379('0x17')](this));ami['on'](_0xd379('0x1d'),this[_0xd379('0x1e')][_0xd379('0x17')](this));ami['on']('attendedtransfer',this['syncAttendedTransfer'][_0xd379('0x17')](this));ami['on'](_0xd379('0x1f'),this[_0xd379('0x20')][_0xd379('0x17')](this));this[_0xd379('0x21')](this[_0xd379('0x13')]);}function emit(_0x242b66,_0x2566c8,_0x46f5d4){io['to'](_0x242b66)[_0xd379('0x22')](_0x2566c8,_0x46f5d4);}function emitCampaignPreview(_0x3ff2a6){if(_0x3ff2a6[_0xd379('0x23')]===_0xd379('0x24')){var _0x16f121={'id':_0x3ff2a6['id'],'name':_0x3ff2a6[_0xd379('0x25')],'strategy':_0x3ff2a6['strategy'],'answered':_0x3ff2a6['answered'],'available':_0x3ff2a6[_0xd379('0x26')],'loggedIn':_0x3ff2a6['loggedIn'],'pTalking':_0x3ff2a6[_0xd379('0x27')],'sumBillable':_0x3ff2a6['sumBillable'],'sumDuration':_0x3ff2a6['sumDuration'],'sumHoldTime':_0x3ff2a6[_0xd379('0x28')]||0x0,'talking':_0x3ff2a6['talking'],'total':_0x3ff2a6[_0xd379('0x29')],'type':_0x3ff2a6[_0xd379('0x23')],'unmanaged':_0x3ff2a6[_0xd379('0x2a')],'abandoned':_0x3ff2a6[_0xd379('0x2b')],'waiting':_0x3ff2a6['waiting'],'loggedInDb':_0x3ff2a6[_0xd379('0x2c')],'dialActive':_0x3ff2a6['dialActive'],'dialMethod':_0x3ff2a6[_0xd379('0x2d')],'dialOriginateCallerIdName':_0x3ff2a6[_0xd379('0x2e')],'dialOriginateCallerIdNumber':_0x3ff2a6['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x3ff2a6[_0xd379('0x2f')],'dialPrefix':_0x3ff2a6['dialPrefix'],'outboundAnswerAgiCallsDay':_0x3ff2a6['outboundAnswerAgiCallsDay'],'outboundAnswerCallsDay':_0x3ff2a6[_0xd379('0x30')],'outboundBlacklistCallsDay':_0x3ff2a6[_0xd379('0x31')],'outboundBusyCallsDay':_0x3ff2a6[_0xd379('0x32')],'outboundCongestionCallsDay':_0x3ff2a6[_0xd379('0x33')],'outboundDropCallsDayACS':_0x3ff2a6[_0xd379('0x34')],'outboundDropCallsDayCallersExit':_0x3ff2a6[_0xd379('0x35')],'outboundDropCallsDayTimeout':_0x3ff2a6['outboundDropCallsDayTimeout'],'outboundNoAnswerCallsDay':_0x3ff2a6['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0x3ff2a6[_0xd379('0x36')],'outboundOriginateFailureCallsDay':_0x3ff2a6[_0xd379('0x37')],'outboundReCallsDay':_0x3ff2a6[_0xd379('0x38')],'outboundRejectCallsDay':_0x3ff2a6[_0xd379('0x39')],'outboundUnknownCallsDay':_0x3ff2a6[_0xd379('0x3a')],'outboundAbandonedCallsDay':_0x3ff2a6['outboundAbandonedCallsDay'],'predictiveIntervalAnsweredCalls':_0x3ff2a6[_0xd379('0x3b')],'predictiveIntervalAvgHoldtime':_0x3ff2a6['predictiveIntervalAvgHoldtime'],'predictiveIntervalAvgTalktime':_0x3ff2a6[_0xd379('0x3c')],'predictiveIntervalDroppedCallsCallersExit':_0x3ff2a6[_0xd379('0x3d')],'predictiveIntervalDroppedCallsTimeout':_0x3ff2a6[_0xd379('0x3e')],'predictiveIntervalErlangCalls':_0x3ff2a6['predictiveIntervalErlangCalls'],'predictiveIntervalErlangCallsDroppedCalls':_0x3ff2a6[_0xd379('0x3f')],'predictiveIntervalHitRate':_0x3ff2a6['predictiveIntervalHitRate'],'predictiveIntervalMultiplicativeFactor':_0x3ff2a6['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0x3ff2a6[_0xd379('0x40')],'predictiveIntervalAvailable':_0x3ff2a6['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0x3ff2a6[_0xd379('0x41')],'message':_0x3ff2a6[_0xd379('0x42')],'originated':_0x3ff2a6['originated'],'erlangCalls':_0x3ff2a6[_0xd379('0x43')],'erlangCallToSecond':_0x3ff2a6[_0xd379('0x44')],'erlangAbandonmentRate':_0x3ff2a6[_0xd379('0x45')],'erlangBusyFactor':_0x3ff2a6[_0xd379('0x46')],'startPredictive':_0x3ff2a6['startPredictive'],'startProgressive':_0x3ff2a6[_0xd379('0x47')]};if(_0x3ff2a6[_0xd379('0x48')]){_0x16f121['Trunk']={'id':_0x3ff2a6['Trunk']['id'],'name':_0x3ff2a6[_0xd379('0x48')][_0xd379('0x25')],'active':_0x3ff2a6[_0xd379('0x48')][_0xd379('0x49')],'callerid':_0x3ff2a6[_0xd379('0x48')][_0xd379('0x4a')]};}if(_0x3ff2a6[_0xd379('0x4b')]){_0x16f121[_0xd379('0x4b')]={'id':_0x3ff2a6[_0xd379('0x4b')]['id'],'name':_0x3ff2a6[_0xd379('0x4b')][_0xd379('0x25')]};}var _0x230cf6=md5(JSON[_0xd379('0x4c')](_0x16f121));if(_0x3ff2a6['md5']!==_0x230cf6){_0x3ff2a6['md5']=_0x230cf6;emit(util['format'](_0xd379('0x4d'),_0x16f121[_0xd379('0x25')]),'voice_queue:save',_0x16f121);}}}function emitVoiceQueueChannelRemove(_0x57fea7){logger['info'](_0xd379('0x4e'),JSON['stringify'](_0x57fea7));emit(util['format']('voice:queue:%s',_0x57fea7[_0xd379('0x25')]),_0xd379('0x4f'),_0x57fea7);}function notSendMessagesQueue(_0x368000){if(_0x368000[_0xd379('0x50')]){if(_0x368000[_0xd379('0x51')]===0x0&&_0x368000[_0xd379('0x27')]===0x0){_0x368000[_0xd379('0x50')]=![];_0x368000[_0xd379('0x26')]=0x0;_0x368000[_0xd379('0x52')]=0x0;_0x368000['message']=_0xd379('0x53');ut[_0xd379('0x54')](_0xd379('0x55'),_0x368000[_0xd379('0x25')]+'\x20is\x20not\x20active');}else{_0x368000['message']=_0xd379('0x56');ut[_0xd379('0x54')](_0xd379('0x55'),_0x368000[_0xd379('0x25')]+_0xd379('0x57'));}emitCampaignPreview(_0x368000);}}Preview[_0xd379('0xe')][_0xd379('0x21')]=function(){var _0x2ccbba=this;setInterval(function(){_0x2ccbba[_0xd379('0x58')]();},0x7cf);};Preview['prototype'][_0xd379('0x58')]=function(){var _0x59a89d=this['campaignsPreview'];this['clockClearZombieChannels']+=0x1;for(var _0x2ec3c9 in _0x59a89d){if(_0x59a89d[_0xd379('0x59')](_0x2ec3c9)&&(_0x59a89d[_0x2ec3c9][_0xd379('0x2d')]===_0xd379('0x6')||_0x59a89d[_0x2ec3c9][_0xd379('0x2d')]==='booked')&&_0x59a89d[_0x2ec3c9][_0xd379('0x23')]===_0xd379('0x24')){if(this['clockClearZombieChannels']>0x7){this[_0xd379('0x5a')]=0x0;this['clearZombieChannels']();}}if(_0x59a89d[_0xd379('0x59')](_0x2ec3c9)&&_0x59a89d[_0x2ec3c9]['dialMethod']===_0xd379('0x6')&&_0x59a89d[_0x2ec3c9][_0xd379('0x23')]===_0xd379('0x24')){if(_0x59a89d[_0x2ec3c9]['dialActive']){this[_0xd379('0x5b')](_0x59a89d[_0x2ec3c9]);this['recallMe'](_0x59a89d[_0x2ec3c9]);}else{notSendMessagesQueue(_0x59a89d[_0x2ec3c9]);}}}};Preview[_0xd379('0xe')][_0xd379('0x5c')]=function(_0x5ca3c4){var _0x3c925b=this;this[_0xd379('0x12')]['enqueue'](function(){if(!_[_0xd379('0x5d')](_0x3c925b[_0xd379('0x15')][_0x5ca3c4])){loggerAction[_0xd379('0x5e')]('[clearZombieChannels][talking]',_0x5ca3c4,_0xd379('0x5f'),_0x3c925b[_0xd379('0x15')][_0x5ca3c4][_0xd379('0x60')],_0xd379('0x61'),JSON[_0xd379('0x4c')](_0x3c925b[_0xd379('0x13')][_0x3c925b['actions'][_0x5ca3c4][_0xd379('0x60')]][_0xd379('0x51')]),_0xd379('0x62'),JSON['stringify'](_0x3c925b[_0xd379('0x13')][_0x3c925b[_0xd379('0x15')][_0x5ca3c4][_0xd379('0x60')]][_0xd379('0x27')]),JSON['stringify'](_0x3c925b[_0xd379('0x15')][_0x5ca3c4][_0xd379('0x63')]),JSON[_0xd379('0x4c')](_['pick'](_0x3c925b[_0xd379('0x15')][_0x5ca3c4],[_0xd379('0x64'),_0xd379('0x65'),_0xd379('0x66'),_0xd379('0x67')])));return ami[_0xd379('0x68')]({'action':_0xd379('0x69'),'channel':_0x3c925b[_0xd379('0x15')][_0x5ca3c4][_0xd379('0x6a')]})[_0xd379('0x6b')](function(_0x992e12){if(_0x992e12[_0xd379('0x42')]===_0xd379('0x6c')){setTimeout(function(){if(_0x3c925b[_0xd379('0x15')][_0x5ca3c4]){ut[_0xd379('0x6d')](_0x3c925b[_0xd379('0x13')][_0x3c925b[_0xd379('0x15')][_0x5ca3c4][_0xd379('0x60')]],_0xd379('0x6e'));if(_0x3c925b[_0xd379('0x15')][_0x5ca3c4][_0xd379('0x63')]===!![]){ut[_0xd379('0x6f')](_0x3c925b[_0xd379('0x13')][_0x3c925b['actions'][_0x5ca3c4]['queue']],_0xd379('0x6e'));ut[_0xd379('0x70')](_0xd379('0x71')+_0x5ca3c4,_0x3c925b[_0xd379('0x15')][_0x5ca3c4][_0xd379('0x60')]);}ut[_0xd379('0x70')](_0xd379('0x72')+_0x5ca3c4,_0x3c925b['actions'][_0x5ca3c4][_0xd379('0x60')]);delete _0x3c925b[_0xd379('0x15')][_0x5ca3c4];}},0x2328);}});}});};Preview[_0xd379('0xe')]['clearZombieChannels']=function(){var _0x2a8520=this;loggerAction[_0xd379('0x5e')](_0xd379('0x73'),_[_0xd379('0x74')](this[_0xd379('0x15')]));for(var _0x2d1cf4 in this[_0xd379('0x15')]){if(_0x2a8520[_0xd379('0x15')]['hasOwnProperty'](_0x2d1cf4)){_0x2a8520[_0xd379('0x5c')](_0x2d1cf4);}}};Preview[_0xd379('0xe')][_0xd379('0x75')]=function(_0x4b1f9e){var _0x5a067c=this;rpcDb[_0xd379('0x76')](_0x4b1f9e['id'],ut[_0xd379('0x77')](this[_0xd379('0x16')]))[_0xd379('0x78')](function(_0x2940bb){if(!_['isNil'](_0x2940bb)){for(var _0x362d52=0x0;_0x362d52<_0x2940bb['length'];_0x362d52+=0x1){if(ut[_0xd379('0x79')](_0x2940bb[_0x362d52]['scheduledat'])<_0x4b1f9e['dialRecallMeTimeout']*0x3c){if(_0x2940bb[_0x362d52]['Agent']&&!_0x2940bb[_0x362d52][_0xd379('0x7a')][_0xd379('0x7b')]){_0x5a067c[_0xd379('0x7c')](_0x2940bb[_0x362d52]['id'])[_0xd379('0x78')](ut[_0xd379('0x7d')](_0xd379('0x7e')))[_0xd379('0x6b')](ut['logger2'](_0xd379('0x7e')));}else{rpcDb[_0xd379('0x7f')](_0x2940bb[_0x362d52]['id']);}}else{var _0x2466f6=new Action(_0x2940bb[_0x362d52],_0x4b1f9e);_0x2466f6['starttime']=moment()[_0xd379('0x80')](_0xd379('0x81'));_0x4b1f9e[_0xd379('0x38')]+=0x1;ut[_0xd379('0x82')](_0x2466f6,0x17,_0xd379('0x83'));if(_0x4b1f9e[_0xd379('0x84')]){rpcDb[_0xd379('0x85')](ut[_0xd379('0x86')](_0x2940bb[_0x362d52]));rpcDb[_0xd379('0x87')](_0x2466f6,_0xd379('0x88'));}else{ut[_0xd379('0x82')](_0x2466f6,0x16,'RecallFailedTimeout');rpcDb[_0xd379('0x87')](_0x2466f6,_0xd379('0x89'));rpcDb[_0xd379('0x8a')](_0x2466f6,'[HistoryRecallClose]');}}}}})['catch'](ut[_0xd379('0x7d')](_0xd379('0x8b')));};Preview[_0xd379('0xe')]['setMessage']=function(_0x39ef48){_0x39ef48[_0xd379('0x50')]=!![];if(ut[_0xd379('0x8c')](_0x39ef48[_0xd379('0x8d')])){_0x39ef48[_0xd379('0x42')]=_0xd379('0x8e');}else if(!ut[_0xd379('0x8f')](_0x39ef48[_0xd379('0x90')])){_0x39ef48[_0xd379('0x42')]=_0xd379('0x53');}else if(!this[_0xd379('0x91')](_0x39ef48[_0xd379('0x48')])){if(!this['isTrunkReachable'](_0x39ef48['TrunkBackup'])){_0x39ef48[_0xd379('0x42')]=_0xd379('0x92');}else{_0x39ef48['message']=_0xd379('0x93');}}else{_0x39ef48[_0xd379('0x42')]=_0xd379('0x93');}emitCampaignPreview(_0x39ef48);};Preview[_0xd379('0xe')][_0xd379('0x94')]=function(_0x44f610,_0x3e3c5c,_0x22563d){var _0x29ba3d=this;var _0x2c3ebd=this['actions'][_0x3e3c5c];var _0x485747=this[_0xd379('0x13')][_0x2c3ebd[_0xd379('0x60')]];var _0x22b1e3;if(_0x485747){switch(_0x22563d){case'1':_0x485747[_0xd379('0x36')]+=0x1;_0x2c3ebd[_0xd379('0x95')]+=0x1;_0x2c3ebd[_0xd379('0x96')]=ut[_0xd379('0x97')](_0x2c3ebd);ut['logCustomer'](_0x2c3ebd,0x0,_0xd379('0x98'));rpcDb[_0xd379('0x87')](_0x2c3ebd,_0xd379('0x99'));if(ut[_0xd379('0x97')](_0x2c3ebd)>=_0x485747['dialGlobalMaxRetry']){_0x22b1e3=ut['cloneAction'](_0x2c3ebd,0xf,_0xd379('0x9a'));rpcDb[_0xd379('0x8a')](_0x22b1e3,_0xd379('0x9b'));}else{if(_0x2c3ebd[_0xd379('0x95')]>=_0x485747[_0xd379('0x9c')]){rpcDb['createCustomerFinal'](_0x2c3ebd,_0xd379('0x9b'));}else{rpcDb[_0xd379('0x9d')](ut[_0xd379('0x9e')](_0x2c3ebd,_0xd379('0x95'),_0x485747[_0xd379('0x9f')]),_0x2c3ebd[_0xd379('0xa0')],_0x2c3ebd[_0xd379('0xa1')]);}}delete this['actions'][_0x44f610[_0xd379('0xa2')]];break;case _0xd379('0xa3'):var _0x6fcf61=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x2c3ebd['responsetime']=_0x6fcf61;_0x2c3ebd[_0xd379('0xa4')]=_0x6fcf61;_0x2c3ebd['dialAnswer']=!![];_0x485747[_0xd379('0x27')]+=0x1;logger[_0xd379('0x5e')]('[syncHangup][talking][increment]',_0x2c3ebd[_0xd379('0xa5')],_0xd379('0xa6'),_0x485747[_0xd379('0x25')],'pTalking:\x20',_0x485747['pTalking']);ami[_0xd379('0x22')](_0xd379('0xa7'),ut[_0xd379('0xa8')](_0x2c3ebd,_0xd379('0xa9')));if(_0x485747[_0xd379('0xaa')]){ami['emit']('custom:agentConnectPreview',ut[_0xd379('0xab')](_0x2c3ebd));}break;case'16':ami[_0xd379('0x22')](_0xd379('0xac'),ut['buildObj'](_0x2c3ebd,'complete'));emitVoiceQueueChannelRemove(ut['buildObj'](_0x2c3ebd,_0xd379('0xad')));_0x485747[_0xd379('0x30')]+=0x1;_0x485747[_0xd379('0x29')]+=0x1;_0x485747[_0xd379('0xae')]+=0x1;ut[_0xd379('0x6f')](_0x485747,_0xd379('0xaf'));_0x2c3ebd[_0xd379('0x96')]=ut[_0xd379('0x97')](_0x2c3ebd);ut[_0xd379('0x82')](_0x2c3ebd,0x4,_0xd379('0xb0'));rpcDb[_0xd379('0x87')](_0x2c3ebd,_0xd379('0xb1'));rpcDb['createCustomerFinal'](_0x2c3ebd,_0xd379('0xb2'));rpcDb[_0xd379('0xb3')](_0x2c3ebd);_0x485747['sumDuration']+=_0x2c3ebd[_0xd379('0xb4')];_0x485747[_0xd379('0xb5')]+=_0x2c3ebd[_0xd379('0xb4')];logger[_0xd379('0x5e')](_0xd379('0xb6'),_0x2c3ebd[_0xd379('0xa5')],_0xd379('0xa6'),_0x485747[_0xd379('0x25')],_0xd379('0x62'),_0x485747['pTalking']);delete this[_0xd379('0x15')][_0x44f610[_0xd379('0xa2')]];break;case'BUSY':_0x485747['outboundBusyCallsDay']+=0x1;_0x2c3ebd[_0xd379('0xb7')]+=0x1;_0x2c3ebd[_0xd379('0x96')]=ut[_0xd379('0x97')](_0x2c3ebd);ut[_0xd379('0x82')](_0x2c3ebd,0x5,_0xd379('0xb8'));rpcDb[_0xd379('0x87')](_0x2c3ebd,'[callProgressDetectingCustomer][logBusy]');if(ut[_0xd379('0x97')](_0x2c3ebd)>=_0x485747[_0xd379('0xb9')]){_0x22b1e3=ut[_0xd379('0xba')](_0x2c3ebd,0xf,'Global');rpcDb['createCustomerFinal'](_0x22b1e3,'[callProgressDetectingCustomer][logBusyGlobal]');}else{if(_0x2c3ebd[_0xd379('0xb7')]>=_0x485747[_0xd379('0xbb')]){rpcDb['createCustomerFinal'](_0x2c3ebd,_0xd379('0xbc'));}else{rpcDb[_0xd379('0x9d')](ut[_0xd379('0x9e')](_0x2c3ebd,'countbusyretry',_0x485747[_0xd379('0xbd')]),_0x2c3ebd[_0xd379('0xa0')],_0x2c3ebd[_0xd379('0xa1')]);}}break;case _0xd379('0xbe'):_0x485747[_0xd379('0xbf')]+=0x1;_0x2c3ebd[_0xd379('0xc0')]+=0x1;_0x2c3ebd[_0xd379('0x96')]=ut[_0xd379('0x97')](_0x2c3ebd);ut[_0xd379('0x82')](_0x2c3ebd,0x3,_0xd379('0xc1'));rpcDb[_0xd379('0x87')](_0x2c3ebd,'[callProgressDetectingCustomer][logNoAnswer]');if(ut[_0xd379('0x97')](_0x2c3ebd)>=_0x485747['dialGlobalMaxRetry']){_0x22b1e3=ut[_0xd379('0xba')](_0x2c3ebd,0xf,'Global');rpcDb[_0xd379('0x8a')](_0x22b1e3,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0x2c3ebd[_0xd379('0xc0')]>=_0x485747[_0xd379('0xc2')]){rpcDb[_0xd379('0x8a')](_0x2c3ebd,_0xd379('0xc3'));}else{rpcDb[_0xd379('0x9d')](ut['scheduledAt'](_0x2c3ebd,_0xd379('0xc0'),_0x485747[_0xd379('0xc4')]),_0x2c3ebd['unlockAgent'],_0x2c3ebd[_0xd379('0xa1')]);}}break;case _0xd379('0xc5'):_0x485747[_0xd379('0x33')]+=0x1;_0x2c3ebd[_0xd379('0xc6')]+=0x1;_0x2c3ebd[_0xd379('0x96')]=ut[_0xd379('0x97')](_0x2c3ebd);ut['logCustomer'](_0x2c3ebd,0x8,_0xd379('0xc7'));rpcDb[_0xd379('0x87')](_0x2c3ebd,'[callProgressDetectingCustomer][logCongestion]');if(ut[_0xd379('0x97')](_0x2c3ebd)>=_0x485747['dialGlobalMaxRetry']){_0x22b1e3=ut[_0xd379('0xba')](_0x2c3ebd,0xf,_0xd379('0x9a'));rpcDb['createCustomerFinal'](_0x22b1e3,'[callProgressDetectingCustomer][logCongestionGlobal]');}else{if(_0x2c3ebd[_0xd379('0xc6')]>=_0x485747[_0xd379('0xc8')]){rpcDb[_0xd379('0x8a')](_0x2c3ebd,_0xd379('0xc9'));}else{rpcDb['rescheduleContact'](ut[_0xd379('0x9e')](_0x2c3ebd,_0xd379('0xc6'),_0x485747['dialBusyRetryFrequency']),_0x2c3ebd['unlockAgent'],_0x2c3ebd[_0xd379('0xa1')]);}}break;case _0xd379('0xca'):_0x485747[_0xd379('0x39')]+=0x1;_0x2c3ebd['countagentrejectretry']+=0x1;_0x2c3ebd[_0xd379('0x96')]=ut[_0xd379('0x97')](_0x2c3ebd);ut[_0xd379('0x82')](_0x2c3ebd,0x14,'AgentReject');rpcDb[_0xd379('0x87')](_0x2c3ebd,'[syncHangupRequest][logAgentReject]');if(ut[_0xd379('0x97')](_0x2c3ebd)>=_0x485747[_0xd379('0xb9')]){_0x22b1e3=ut[_0xd379('0xba')](_0x2c3ebd,0x14,_0xd379('0xcb'));rpcDb[_0xd379('0x8a')](_0x22b1e3,'[callProgressDetectingCustomer][logAgentReject]');}else{if(_0x2c3ebd[_0xd379('0xcc')]>=_0x485747[_0xd379('0xcd')]){rpcDb[_0xd379('0x8a')](_0x2c3ebd,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb[_0xd379('0x9d')](ut['scheduledAt'](_0x2c3ebd,'countagentrejectretry',_0x485747['dialAgentRejectRetryFrequency']),_0x2c3ebd['unlockAgent'],_0x2c3ebd[_0xd379('0xa1')]);}}break;case _0xd379('0xce'):_0x485747[_0xd379('0xcf')]+=0x1;_0x2c3ebd[_0xd379('0xd0')]+=0x1;_0x2c3ebd[_0xd379('0x96')]=ut['totalGlobal'](_0x2c3ebd);ut['logCustomer'](_0x2c3ebd,0xb,'Abandoned');rpcDb[_0xd379('0x87')](_0x2c3ebd,_0xd379('0xd1'));if(ut[_0xd379('0x97')](_0x2c3ebd)>=_0x485747[_0xd379('0xb9')]){_0x22b1e3=ut['cloneAction'](_0x2c3ebd,0xf,_0xd379('0x9a'));rpcDb[_0xd379('0x8a')](_0x22b1e3,'[callProgressDetectingCustomer][logAbandoned]');}else{if(_0x2c3ebd[_0xd379('0xd2')]>=_0x485747[_0xd379('0xd3')]){rpcDb[_0xd379('0x8a')](_0x2c3ebd,_0xd379('0xd1'));}else{rpcDb[_0xd379('0x9d')](ut[_0xd379('0x9e')](_0x2c3ebd,_0xd379('0xd0'),_0x485747[_0xd379('0xd4')]),_0x2c3ebd['unlockAgent'],_0x2c3ebd[_0xd379('0xa1')]);}}break;default:if(_0x2c3ebd['dialAnswer']){ut[_0xd379('0x6f')](_0x485747,'[default]');ut['loggerError'](_0xd379('0xd5')+_0x485747[_0xd379('0x25')],_0x44f610);}_0x485747[_0xd379('0x3a')]+=0x1;_0x2c3ebd[_0xd379('0x96')]=ut[_0xd379('0x97')](_0x2c3ebd);ut[_0xd379('0x82')](_0x2c3ebd,0xc,_0x44f610['cause-txt']||_0x44f610[_0xd379('0xd6')]);rpcDb[_0xd379('0x87')](_0x2c3ebd,_0xd379('0xd7'));if(ut[_0xd379('0x97')](_0x2c3ebd)>=_0x485747[_0xd379('0xb9')]){_0x22b1e3=ut['cloneAction'](_0x2c3ebd,0xf,'Global');rpcDb[_0xd379('0x8a')](_0x22b1e3,_0xd379('0xd8'));}else{rpcDb['createCustomerFinal'](_0x2c3ebd,_0xd379('0xd8'));}delete this[_0xd379('0x15')][_0x44f610['linkedid']];}if(!(_0x2c3ebd[_0xd379('0x63')]&&_0x22563d==='16')){ut[_0xd379('0x6d')](_0x485747,_0xd379('0xd9'));logger['info'](_0xd379('0xda'),_0x2c3ebd['uniqueid'],_0xd379('0xa6'),_0x485747[_0xd379('0x25')],_0xd379('0x61'),_0x485747[_0xd379('0x51')]);}if(_0x22563d!=='ANSWER'){delete this[_0xd379('0x15')][_0x44f610[_0xd379('0xa2')]];delete this[_0xd379('0x15')][_0x44f610[_0xd379('0xdb')]];}}};Preview['prototype'][_0xd379('0xdc')]=function(_0x206938,_0x18bdef,_0xf69bbf){if(_['isUndefined'](_0x18bdef)&&'object'!==typeof _0x18bdef){return;}if(_['isUndefined'](_0xf69bbf)&&_0xd379('0xdd')!==typeof _0xf69bbf){return;}switch(_0xf69bbf[_0xd379('0xde')]){case'0':ut[_0xd379('0xdf')](_0x206938,0x0,_0xd379('0x98'));rpcDb[_0xd379('0xe0')](_0x206938,_0xd379('0xe1'));break;case'3':ut[_0xd379('0xdf')](_0x206938,0x3,'NoAnswer');rpcDb[_0xd379('0xe0')](_0x206938,_0xd379('0xe2'));break;case'5':ut['logAgent'](_0x206938,0x5,'Busy');rpcDb[_0xd379('0xe0')](_0x206938,_0xd379('0xe3'));break;case'8':ut[_0xd379('0xdf')](_0x206938,0x8,'Congestion');rpcDb[_0xd379('0xe0')](_0x206938,_0xd379('0xe4'));break;case'22':ut['logAgent'](_0x206938,0x16,_0xd379('0xe5'));rpcDb[_0xd379('0xe0')](_0x206938,_0xd379('0xe6'));break;default:ut['logAgent'](_0x206938,0xc,_0xf69bbf[_0xd379('0xde')]);rpcDb['createAgentHistory'](_0x206938,'[callProgressDetectingAgent][logCongestion]');}ut[_0xd379('0x6d')](_0x18bdef,_0xd379('0xe7'));logger['info'](_0xd379('0xe8'),_0x206938[_0xd379('0xa5')],_0xd379('0xa6'),_0x18bdef[_0xd379('0x25')],_0xd379('0x61'),_0x18bdef[_0xd379('0x51')]);delete this[_0xd379('0x15')][_0x206938[_0xd379('0xa5')]];};Preview['prototype'][_0xd379('0xe9')]=function(_0x57ba10,_0x2c3724,_0x1cf4b8,_0x3a1c67,_0x281207){var _0x23fa7e=this;return new BPromise(function(_0x34f1c1,_0x303b8b){if(_['isNil'](_0x2c3724)||_[_0xd379('0x5d')](_0x2c3724['Contact'])||_['isNil'](_0x2c3724[_0xd379('0xea')][_0xd379('0xeb')])||_['isNil'](_0x2c3724['VoiceQueueId'])){_0x303b8b(ut[_0xd379('0x42')](_0xd379('0xec'),_0x3a1c67,_0x281207));return;}var _0x20e533=uuid['v4']();var _0x495973=_0x23fa7e['campaignsPreview'][_0x2c3724[_0xd379('0x5f')][_0xd379('0x25')]];var _0x4b7a4c=_0x1cf4b8?_0x23fa7e[_0xd379('0x16')][_0x1cf4b8]['id']:undefined;_0x23fa7e[_0xd379('0x15')][_0x20e533]=new Action(_0x2c3724,_0x495973,_0x20e533,_0x1cf4b8,_0x4b7a4c);var _0x3f2132=_0x23fa7e[_0xd379('0x15')][_0x20e533];_0x3f2132[_0xd379('0xa0')]=_0x3a1c67;_0x3f2132[_0xd379('0xa1')]=_0x281207;_0x3f2132[_0xd379('0xed')]=_0x1cf4b8;if(_[_0xd379('0xee')](_0x57ba10)){_0x23fa7e['execCall'](_0x3f2132,_0x495973,_0x2c3724,_0x1cf4b8)[_0xd379('0x78')](function(_0x4c2beb){logger[_0xd379('0x5e')](_0xd379('0xef'),_0xd379('0xf0')+_0x3f2132['queue']+_0xd379('0xf1')+_0x3f2132['idContact'],JSON[_0xd379('0x4c')](_0x4c2beb));ami[_0xd379('0x22')](_0xd379('0xf2'),ut[_0xd379('0xa8')](_0x3f2132,_0xd379('0xf3')));_0x34f1c1(ut[_0xd379('0x42')]('Calling'));})['catch'](function(_0x4ec602){ut['logger'](_0xd379('0xf4'),_0x4ec602);_0x303b8b(ut[_0xd379('0x42')](_0xd379('0xf5'),_0x3a1c67,_0x281207));});}else{_0x495973['outboundBlacklistCallsDay']+=0x1;ut[_0xd379('0xf6')](_0x3f2132);rpcDb[_0xd379('0xf7')](_0x3f2132,_0xd379('0xf8'));delete _0x23fa7e['actions'][_0x20e533];_0x303b8b(ut['message'](_0xd379('0xf9'),_0x3a1c67,_0x281207));}});};Preview['prototype'][_0xd379('0x91')]=function(_0x17158d){return!_[_0xd379('0x5d')](_0x17158d)&&!_[_0xd379('0x5d')](_0x17158d[_0xd379('0x25')])&&!_['isNil'](_0x17158d[_0xd379('0x49')])&&_0x17158d[_0xd379('0x49')]&&!_[_0xd379('0x5d')](this[_0xd379('0x14')][util[_0xd379('0x80')](_0xd379('0xfa'),_0x17158d[_0xd379('0x25')])])&&!_[_0xd379('0x5d')](this[_0xd379('0x14')][util['format']('SIP/%s',_0x17158d[_0xd379('0x25')])][_0xd379('0x69')])&&(this[_0xd379('0x14')][util['format'](_0xd379('0xfa'),_0x17158d[_0xd379('0x25')])][_0xd379('0x69')]==='reachable'||this[_0xd379('0x14')][util[_0xd379('0x80')](_0xd379('0xfa'),_0x17158d['name'])][_0xd379('0x69')]===_0xd379('0xfb'));};Preview[_0xd379('0xe')][_0xd379('0x7c')]=function(_0x3ca9e1,_0x2d266f){var _0x9fe123=this;return new BPromise(function(_0x2e2f40,_0xc36e06){_0x9fe123[_0xd379('0xfc')](_0x3ca9e1,_0x2d266f)[_0xd379('0x78')](function(_0x3dd99b){_0x2e2f40(_['pick'](_0x3dd99b,[_0xd379('0x42')]));})[_0xd379('0x6b')](function(_0x40d6d6){if(_0x40d6d6['unlock']){rpcDb[_0xd379('0xfd')](_0x3ca9e1);}if(_0x40d6d6[_0xd379('0x49')]){rpcDb[_0xd379('0x7f')](_0x3ca9e1);}_0xc36e06(_[_0xd379('0xfe')](_0x40d6d6,[_0xd379('0x42')]));});});};Preview[_0xd379('0xe')][_0xd379('0xfc')]=function(_0x59c574,_0x26a5fc){var _0x4bcf09=this;return new BPromise(function(_0x15782f,_0x1eea03){var _0x361c91,_0x31472b;rpcDb[_0xd379('0xff')](_0x59c574)[_0xd379('0x78')](function(_0x1972d9){if(!_[_0xd379('0x5d')](_0x1972d9[0x0])){_0x31472b=_0x1972d9[0x0]['recallme']?![]:!![];_0x361c91=_0x1972d9[0x0][_0xd379('0x100')]?!![]:![];_0x361c91=_0x26a5fc?!![]:_0x361c91;}var _0x595614=_0x4bcf09[_0xd379('0x101')](_0x1972d9);if(_0x595614[_0xd379('0x102')]){rpcDb[_0xd379('0x103')](_[_0xd379('0xfe')](_0x1972d9[0x0],[_0xd379('0x66'),_0xd379('0x104')]))[_0xd379('0x78')](function(_0x44964a){_0x4bcf09[_0xd379('0xe9')](_0x44964a,_0x1972d9[0x0],_0x26a5fc,_0x31472b,_0x361c91)['then'](function(_0x3f4359){_0x15782f(_0x3f4359);})['catch'](function(_0x251279){_0x1eea03(_0x251279);});})['catch'](function(_0x277ed3){ut[_0xd379('0x54')](_0xd379('0x105'),_0x277ed3);_0x1eea03(ut[_0xd379('0x42')](_0xd379('0x106'),_0x31472b,_0x361c91));});}else{_0x1eea03(ut[_0xd379('0x42')](_0x595614[_0xd379('0x42')],_0x31472b,_0x361c91));}})[_0xd379('0x6b')](function(_0x416533){ut[_0xd379('0x54')]('[Preview][getContactPreview]',_0x416533);_0x1eea03(ut[_0xd379('0x42')](_0xd379('0x106'),![],!![]));});});};Preview[_0xd379('0xe')][_0xd379('0x101')]=function(_0x3f3451){if(_[_0xd379('0x5d')](_0x3f3451)||_[_0xd379('0xee')](_0x3f3451)||!_[_0xd379('0x5d')](_0x3f3451[0x0][_0xd379('0x7a')])&&_[_0xd379('0x5d')](_0x3f3451[0x0][_0xd379('0x7a')][_0xd379('0x25')])){ut[_0xd379('0x54')]('[Preview][validateContact][Empty\x20Contact]',_0x3f3451);return{'isValid':![],'message':_0xd379('0x107')};}var _0x378048=this['campaignsPreview'][_0x3f3451[0x0]['Queue'][_0xd379('0x25')]];_0x378048['message']='ACTIVE';if(_[_0xd379('0x5d')](_0x378048)){ut[_0xd379('0x54')](_0xd379('0x108'),_0x378048);return{'isValid':![],'message':_0xd379('0x109')};}if(!this[_0xd379('0x91')](_0x378048[_0xd379('0x48')])){ut['logger']('[Preview][validateContact][Trunk\x20not\x20work]',_0xd379('0x10a')+_0x378048[_0xd379('0x25')]+_0xd379('0x10b'));if(!this[_0xd379('0x91')](_0x378048[_0xd379('0x10c')])){ut[_0xd379('0x54')](_0xd379('0x10d'),_0x378048['name']+_0xd379('0x10e'));return{'isValid':![],'message':_0xd379('0x10f')};}}if(!ut['isActive'](_0x378048[_0xd379('0x90')])){ut[_0xd379('0x54')](_0xd379('0x110'),_0x378048[_0xd379('0x25')]+_0xd379('0x111'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x378048[_0xd379('0x25')]+_0xd379('0x111')};}return{'isValid':!![],'message':_0xd379('0x112')};};Preview[_0xd379('0xe')][_0xd379('0x113')]=function(_0x50e3fd,_0x204c4b,_0x54c5af,_0x543e98){var _0x1386a8=this;return new BPromise(function(_0xd4ec62,_0x51e955){var _0x4a44d5=_0x50e3fd[_0xd379('0xa5')];var _0x3c67c4=_0x1386a8[_0xd379('0x91')](_0x204c4b[_0xd379('0x48')])?util['format'](_0xd379('0x114'),_0x204c4b[_0xd379('0x48')][_0xd379('0x25')],_[_0xd379('0x5d')](_0x204c4b[_0xd379('0x115')])?'':_0x204c4b[_0xd379('0x115')][_0xd379('0x116')]()||'',_0x204c4b[_0xd379('0x117')]>0x0?_0x54c5af[_0xd379('0xea')]['phone'][_0xd379('0x118')](_0x204c4b[_0xd379('0x117')]):_0x54c5af[_0xd379('0xea')]['phone']):util['format'](_0xd379('0x114'),_['isNil'](_0x204c4b['TrunkBackup'])?_0x204c4b[_0xd379('0x48')]['name']:_0x204c4b[_0xd379('0x10c')][_0xd379('0x25')],_[_0xd379('0x5d')](_0x204c4b['dialPrefix'])?'':_0x204c4b['dialPrefix'][_0xd379('0x116')]()||'',_0x204c4b[_0xd379('0x117')]>0x0?_0x54c5af[_0xd379('0xea')][_0xd379('0xeb')][_0xd379('0x118')](_0x204c4b[_0xd379('0x117')]):_0x54c5af[_0xd379('0xea')][_0xd379('0xeb')]);var _0x3a0408=_0x1386a8[_0xd379('0x91')](_0x204c4b[_0xd379('0x48')])?ut[_0xd379('0x119')](_0x204c4b[_0xd379('0x48')][_0xd379('0x4a')],_0x204c4b['dialOriginateCallerIdName'],_0x204c4b[_0xd379('0x11a')]>0x0?ut['getCallerIdRandom'](_0x204c4b[_0xd379('0x11b')],_0x204c4b['dialRandomLastDigitCallerIdNumber']):_0x204c4b[_0xd379('0x11b')]):ut[_0xd379('0x119')](_['isNil'](_0x204c4b['TrunkBackup'])?_0x204c4b[_0xd379('0x48')][_0xd379('0x4a')]:_0x204c4b['TrunkBackup']['callerid'],_0x204c4b[_0xd379('0x2e')],_0x204c4b[_0xd379('0x11a')]>0x0?ut[_0xd379('0x11c')](_0x204c4b[_0xd379('0x11b')],_0x204c4b[_0xd379('0x11a')]):_0x204c4b[_0xd379('0x11b')]);if(_0x3a0408){_0x50e3fd[_0xd379('0x11d')]=ut['extractCalleridName'](_0x3a0408);_0x50e3fd[_0xd379('0x11e')]=ut['extractCalleridNumber'](_0x3a0408);}var _0xacbb8d=ut['addVariables'](_0x204c4b,_0x54c5af,_0x3c67c4,_0x3a0408,_0x4a44d5,_0x50e3fd);_[_0xd379('0x11f')](_0x50e3fd,ut[_0xd379('0x120')](_0xacbb8d));_0x50e3fd[_0xd379('0x121')]=moment()[_0xd379('0x80')]('YYYY-MM-DD\x20HH:mm:ss');ami[_0xd379('0x68')](ut[_0xd379('0x122')](_0x50e3fd,_0x204c4b,_0xacbb8d,_0x50e3fd[_0xd379('0xa1')],_0x543e98))[_0xd379('0x78')](function(_0x2986e1){_0x204c4b[_0xd379('0x51')]+=0x1;logger['info']('[originated][increment]',_0x4a44d5,_0xd379('0xa6'),_0x204c4b[_0xd379('0x25')],_0xd379('0x61'),_0x204c4b[_0xd379('0x51')]);_0xd4ec62(_0x2986e1);})[_0xd379('0x6b')](function(_0x4f9fa4){ut[_0xd379('0xdf')](_0x50e3fd,0xe,_0xd379('0x123'));rpcDb['createAgentHistory'](_0x50e3fd,_0xd379('0x124'));_0x51e955(_0x4f9fa4);});});};Preview[_0xd379('0xe')][_0xd379('0x125')]=function(_0x5b375e){if(this[_0xd379('0x15')][_0x5b375e['linkedid']]){this[_0xd379('0x15')][_0x5b375e[_0xd379('0xa2')]]['channel']=_0x5b375e[_0xd379('0x6a')];}};Preview[_0xd379('0xe')][_0xd379('0x126')]=function(_0x43f51f){var _0x1e626a=this;var _0x3bda77=this[_0xd379('0x15')][_0x43f51f[_0xd379('0x127')]];if(_0x3bda77){if(_0x3bda77[_0xd379('0xed')]&&this[_0xd379('0x16')][_0x3bda77[_0xd379('0xed')]]){ut[_0xd379('0x128')](_0x3bda77,this[_0xd379('0x16')][_0x3bda77[_0xd379('0xed')]][_0xd379('0x25')],this[_0xd379('0x16')][_0x3bda77[_0xd379('0xed')]]['id']);}var _0x28dc43=_[_0xd379('0x129')](_0x3bda77);_0x28dc43[_0xd379('0x12a')]=moment()[_0xd379('0x80')](_0xd379('0x81'));var _0x2057bb=_0x1e626a[_0xd379('0x13')][_0x3bda77['queue']];if(ut[_0xd379('0x12b')](_0x43f51f[_0xd379('0x12c')])){if(_0x3bda77[_0xd379('0xa0')]){rpcDb[_0xd379('0xfd')](_0x3bda77[_0xd379('0x12d')]);}if(_0x3bda77[_0xd379('0xa1')]){rpcDb[_0xd379('0x7f')](_0x3bda77['idContact']);}ami['emit'](_0xd379('0x12e'),ut[_0xd379('0xa8')](_0x3bda77,_0xd379('0x12f')));this[_0xd379('0xdc')](_0x28dc43,_0x2057bb,_0x43f51f);}else{_0x3bda77[_0xd379('0x121')]=moment()[_0xd379('0x80')](_0xd379('0x81'));ut[_0xd379('0xdf')](_0x28dc43,0x4,_0xd379('0xb0'));rpcDb['createAgentHistory'](_0x28dc43,'[callProgressDetectingAgent][logAnswer]');}}};Preview[_0xd379('0xe')][_0xd379('0x130')]=function(_0x2de484){var _0x292751=this;var _0x39cf91=this[_0xd379('0x15')][_0x2de484['linkedid']];var _0x157f2a;if(_0x39cf91){_0x157f2a=this['campaignsPreview'][_0x39cf91[_0xd379('0x60')]];logger[_0xd379('0x5e')](_0xd379('0x131'),_0x2de484[_0xd379('0xa2')],'\x20Queue',_0x157f2a['name'],_0xd379('0x62'),_0x157f2a[_0xd379('0x27')]);}if(this[_0xd379('0x15')][_0x2de484[_0xd379('0xa2')]]&&_0x2de484[_0xd379('0xa2')]!==_0x2de484[_0xd379('0xa5')]){if(_0x2de484['cause']==='16'&&this[_0xd379('0x15')][_0x2de484[_0xd379('0xa2')]][_0xd379('0x63')]){this[_0xd379('0x94')](_0x2de484,_0x2de484[_0xd379('0xa2')],_0x2de484[_0xd379('0x132')]);}else if(this[_0xd379('0x15')][_0x2de484['linkedid']][_0xd379('0x63')]){logger[_0xd379('0x5e')](_0xd379('0x133'),_0x2de484[_0xd379('0xa2')],_0x2de484['cause'],_0xd379('0xa6'),_0x157f2a['name'],_0xd379('0x62'),_0x157f2a['pTalking']);this[_0xd379('0x94')](_0x2de484,_0x2de484[_0xd379('0xa2')],_0x2de484[_0xd379('0x132')]);}}else if(_0x39cf91&&_[_0xd379('0x5d')](_0x39cf91[_0xd379('0x134')])&&_0x157f2a['dialQueueProject']&&_0x2de484['linkedid']===_0x2de484['uniqueid']&&_['isNil'](_0x2de484['reason'])&&_0x2de484[_0xd379('0x132')]==='16'&&_0x2de484[_0xd379('0x135')]==='6'&&_[_0xd379('0x136')](_0x39cf91['transfer'])){if(_0x39cf91[_0xd379('0xa0')]){rpcDb[_0xd379('0xfd')](_0x39cf91['idContact']);}if(_0x39cf91[_0xd379('0xa1')]){rpcDb['disableContact'](_0x39cf91['idContact']);}_0x2de484[_0xd379('0xde')]='22';this[_0xd379('0xdc')](_0x39cf91,_0x157f2a,_0x2de484);}else if(_0x39cf91&&_0x39cf91[_0xd379('0x137')]){if(_0x2de484[_0xd379('0x132')]==='16'&&this[_0xd379('0x15')][_0x2de484[_0xd379('0xa2')]]['dialAnswer']){logger['info'](_0xd379('0x138'),_0x2de484['linkedid'],_0x2de484[_0xd379('0x132')],_0xd379('0xa6'),_0x157f2a['name'],'pTalking:\x20',_0x157f2a['pTalking']);this[_0xd379('0x94')](_0x2de484,_0x2de484[_0xd379('0xa2')],_0x2de484['cause']);}else if(this[_0xd379('0x15')][_0x2de484[_0xd379('0xa2')]][_0xd379('0x63')]){logger['info']('[syncHangup][talking][cause]',_0x2de484['linkedid'],_0x2de484['cause'],_0xd379('0xa6'),_0x157f2a['name'],_0xd379('0x62'),_0x157f2a['pTalking']);this[_0xd379('0x94')](_0x2de484,_0x2de484['linkedid'],_0x2de484['cause']);}}};Preview['prototype'][_0xd379('0x1b')]=function(_0x19577f){if(this[_0xd379('0x15')][_0x19577f[_0xd379('0xdb')]]&&_0x19577f[_0xd379('0xdb')]!==_0x19577f[_0xd379('0x139')]){this['callProgressDetectingCustomer'](_0x19577f,_0x19577f[_0xd379('0xdb')],_0x19577f[_0xd379('0xd6')]);}};Preview[_0xd379('0xe')][_0xd379('0x13a')]=function(_0x2d38a7){if(this[_0xd379('0x15')][_0x2d38a7[_0xd379('0xa2')]]&&_0x2d38a7[_0xd379('0xa2')]!==_0x2d38a7[_0xd379('0xa5')]&&!this[_0xd379('0x15')][_0x2d38a7[_0xd379('0xa2')]][_0xd379('0x63')]){if(_0x2d38a7[_0xd379('0x132')]==='1'){this[_0xd379('0x94')](_0x2d38a7,_0x2d38a7[_0xd379('0xa2')],_0x2d38a7[_0xd379('0x132')]);}}};Preview[_0xd379('0xe')]['addVariable']=function(_0x200164,_0x27d97c,_0xaa6465){if(this[_0xd379('0x15')][_0x200164]){if(_[_0xd379('0x5d')](this[_0xd379('0x15')][_0x200164]['variables'])){this[_0xd379('0x15')][_0x200164][_0xd379('0x13b')]={};}this[_0xd379('0x15')][_0x200164][_0xd379('0x13b')][_0x27d97c]=_0xaa6465;}};Preview['prototype'][_0xd379('0x1e')]=function(_0x33e145){try{if(!_[_0xd379('0x5d')](_0x33e145)){if(ut[_0xd379('0x13c')](_[_0xd379('0x13d')](_0x33e145[_0xd379('0x13e')])[0x0])){this['addVariable'](_0x33e145[_0xd379('0xa5')],_[_0xd379('0x13d')](_0x33e145[_0xd379('0x13e')])[0x0],_0x33e145[_0xd379('0x13f')]);}}}catch(_0x396338){logger['error']('[syncVarSet][Preview]',util[_0xd379('0x140')](_0x396338,{'showHidden':![],'depth':null}));}};Preview[_0xd379('0xe')][_0xd379('0x141')]=function(_0x19f80b){if(_0x19f80b){if(this[_0xd379('0x15')][_0x19f80b[_0xd379('0x142')]]){this[_0xd379('0x15')][_0x19f80b[_0xd379('0x142')]][_0xd379('0x137')]=!![];}}};Preview[_0xd379('0xe')][_0xd379('0x20')]=function(_0xde275){if(_0xde275){if(this[_0xd379('0x15')][_0xde275[_0xd379('0x143')]]){this[_0xd379('0x15')][_0xde275[_0xd379('0x143')]][_0xd379('0x137')]=!![];}}};module[_0xd379('0x144')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 7077324..0ed097c 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 _0xe14b=['xcally-motion-preview','assigned','lastAssignedTo','[voiceQueueReport]\x20','getContactRecallMe','[rescheduleContactInQueue]\x20','util','bluebird','lodash','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','catch','[createHistory]\x20','resolve','then','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','createCustomerFinal','rescheduleContact','active','countReScheduled','unlockContact','disableContact','[activeContact]\x20','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','context'];(function(_0x49a57c,_0x2eb02c){var _0x4e0316=function(_0x37e2e5){while(--_0x37e2e5){_0x49a57c['push'](_0x49a57c['shift']());}};_0x4e0316(++_0x2eb02c);}(_0xe14b,0x93));var _0xbe14=function(_0xb7a459,_0xc13228){_0xb7a459=_0xb7a459-0x0;var _0x104ab5=_0xe14b[_0xb7a459];return _0x104ab5;};'use strict';var util=require(_0xbe14('0x0'));var BPromise=require(_0xbe14('0x1'));var logger=require('../../../config/logger')('preview');var _=require(_0xbe14('0x2'));var cmHopper=require(_0xbe14('0x3'));var cmHopperFinal=require('../rpc/cmHopperFinal');var cmHopperHistory=require(_0xbe14('0x4'));var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require('../rpc/voiceQueueRt');var agentReportPreview=require(_0xbe14('0x5'));var voiceQueueReport=require(_0xbe14('0x6'));function loggerCatch(_0x1fe204){return function(_0x1ff100){logger[_0xbe14('0x7')](_0x1fe204,util[_0xbe14('0x8')](_0x1ff100,{'showHidden':![],'depth':null}));};}function create(_0x196fca){return BPromise['resolve']()['then'](cmHopperHistory['createHistory'](_0x196fca))[_0xbe14('0x9')](loggerCatch(_0xbe14('0xa')));}function createAgent(_0xd68cd7){return BPromise[_0xbe14('0xb')]()['then'](agentReportPreview['createHistory'](_0xd68cd7))[_0xbe14('0x9')](loggerCatch(_0xbe14('0xa')));}function moveContact(_0x4935cc){return BPromise[_0xbe14('0xb')]()[_0xbe14('0xc')](cmHopper[_0xbe14('0xd')](_0x4935cc,!![]))[_0xbe14('0x9')](loggerCatch(_0xbe14('0xe')));}exports[_0xbe14('0xf')]=function(_0x23a730){return BPromise[_0xbe14('0xb')]()[_0xbe14('0xc')](cmHopperBlack[_0xbe14('0xf')](_0x23a730))[_0xbe14('0x9')](loggerCatch(_0xbe14('0x10')));};exports[_0xbe14('0x11')]=function(_0x530538){return BPromise['resolve']()[_0xbe14('0xc')](cmHopper[_0xbe14('0x11')](_0x530538))[_0xbe14('0x9')](loggerCatch(_0xbe14('0x12')));};exports['createHistory']=function(_0x21c789,_0xe9c3ec){create(_0x21c789)[_0xbe14('0x9')](loggerCatch(_0xe9c3ec));moveContact(_0x21c789)[_0xbe14('0x9')](loggerCatch(_0xe9c3ec));};exports[_0xbe14('0x13')]=function(_0x29ab73,_0x17ae86){createAgent(_0x29ab73)['catch'](loggerCatch(_0x17ae86));};exports[_0xbe14('0x14')]=function(_0x456ca8,_0x329588){create(_0x456ca8)[_0xbe14('0x9')](loggerCatch(_0x329588));};exports[_0xbe14('0x15')]=function(_0x37e4c1,_0x59a9e3){moveContact(_0x37e4c1)[_0xbe14('0x9')](loggerCatch(_0x59a9e3));};exports[_0xbe14('0x16')]=function(_0x417c8d,_0xc12977,_0x188ec4){if(_0xc12977){_0x417c8d['UserId']=null;}if(_0x188ec4){_0x417c8d[_0xbe14('0x17')]=![];}return BPromise['resolve']()[_0xbe14('0xc')](cmHopper['rescheduleContact'](_0x417c8d))[_0xbe14('0x9')](loggerCatch('[rescheduleContact]\x20'));};exports[_0xbe14('0x18')]=function(_0x3d3608){return BPromise['resolve']()[_0xbe14('0xc')](cmHopper['countReScheduled'](_0x3d3608))[_0xbe14('0x9')](loggerCatch('[countReScheduled]\x20'));};exports[_0xbe14('0x19')]=function(_0x5fa043){return BPromise[_0xbe14('0xb')]()[_0xbe14('0xc')](cmHopper[_0xbe14('0x19')]({'UserId':null},_0x5fa043,0x1))[_0xbe14('0x9')](loggerCatch('[unlockContact]\x20'));};exports[_0xbe14('0x1a')]=function(_0x1ba46a){return BPromise[_0xbe14('0xb')]()[_0xbe14('0xc')](cmHopper['unlockContact']({'active':![]},_0x1ba46a,0x1))[_0xbe14('0x9')](loggerCatch(_0xbe14('0x1b')));};exports['crateCustomerReportQueue']=function(_0x3c3613){var _0x3b3e84={};_0x3b3e84[_0xbe14('0x1c')]=_0x3c3613[_0xbe14('0x1c')];_0x3b3e84[_0xbe14('0x1d')]=_0x3c3613[_0xbe14('0x1d')];_0x3b3e84[_0xbe14('0x1e')]=_0x3c3613[_0xbe14('0x1e')];_0x3b3e84[_0xbe14('0x1f')]=_0x3c3613[_0xbe14('0x1f')];_0x3b3e84[_0xbe14('0x20')]=_0x3c3613[_0xbe14('0x20')];_0x3b3e84[_0xbe14('0x21')]=_0x3c3613[_0xbe14('0x22')];_0x3b3e84[_0xbe14('0x23')]=_0x3c3613[_0xbe14('0x22')];_0x3b3e84[_0xbe14('0x24')]=0x1;_0x3b3e84[_0xbe14('0x25')]=_0x3c3613[_0xbe14('0x26')];_0x3b3e84[_0xbe14('0x27')]=_0x3c3613['membername'];_0x3b3e84[_0xbe14('0x28')]='from-sip';_0x3b3e84['exten']=_0xbe14('0x29');_0x3b3e84['holdtime']=0x0;_0x3b3e84[_0xbe14('0x2a')]=0x1;_0x3b3e84[_0xbe14('0x2b')]=_0x3c3613['membername'];_0x3b3e84['queuecallerexitreason']='COMPLETED';return BPromise[_0xbe14('0xb')]()[_0xbe14('0xc')](voiceQueueReport['create'](_0x3b3e84))[_0xbe14('0x9')](loggerCatch(_0xbe14('0x2c')));};exports[_0xbe14('0x2d')]=function(_0x1aa849,_0x29c23e){return BPromise['resolve']()['then'](cmHopper[_0xbe14('0x2d')](_0x1aa849,_0x29c23e))['catch'](loggerCatch('[GetContactRecallMe]\x20'));};exports['rescheduleContactInQueue']=function(_0x163ef7){return BPromise[_0xbe14('0xb')]()[_0xbe14('0xc')](cmHopper[_0xbe14('0x16')](_0x163ef7,!![],!![]))[_0xbe14('0x9')](loggerCatch(_0xbe14('0x2e')));}; \ No newline at end of file +var _0xe0ae=['preview','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/agentReportPreview','error','inspect','then','[createHistory]\x20','resolve','createHistory','catch','moveContactManagedDialer','[moveContactManagedDialer]\x20','[checkIsBlackList]\x20','getContactPreview','createAgentHistory','createCustomerHistory','rescheduleContact','UserId','active','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','disableContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','answertime','queuecallercomplete','queuecallercompleteAt','connectedlinename','context','from-sip','exten','xcally-motion-preview','holdtime','assigned','lastAssignedTo','membername','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','[rescheduleContactInQueue]\x20','../../../config/logger'];(function(_0x7a2d49,_0x173c45){var _0x5948fc=function(_0x1f1552){while(--_0x1f1552){_0x7a2d49['push'](_0x7a2d49['shift']());}};_0x5948fc(++_0x173c45);}(_0xe0ae,0xa1));var _0xee0a=function(_0x2dbcef,_0x1cfecb){_0x2dbcef=_0x2dbcef-0x0;var _0x5a90ea=_0xe0ae[_0x2dbcef];return _0x5a90ea;};'use strict';var util=require('util');var BPromise=require('bluebird');var logger=require(_0xee0a('0x0'))(_0xee0a('0x1'));var _=require('lodash');var cmHopper=require(_0xee0a('0x2'));var cmHopperFinal=require('../rpc/cmHopperFinal');var cmHopperHistory=require(_0xee0a('0x3'));var cmHopperBlack=require(_0xee0a('0x4'));var voiceQueueRt=require('../rpc/voiceQueueRt');var agentReportPreview=require(_0xee0a('0x5'));var voiceQueueReport=require('../rpc/voiceQueueReport');function loggerCatch(_0x5bef07){return function(_0x39a302){logger[_0xee0a('0x6')](_0x5bef07,util[_0xee0a('0x7')](_0x39a302,{'showHidden':![],'depth':null}));};}function create(_0x344355){return BPromise['resolve']()[_0xee0a('0x8')](cmHopperHistory['createHistory'](_0x344355))['catch'](loggerCatch(_0xee0a('0x9')));}function createAgent(_0x3d0b3f){return BPromise[_0xee0a('0xa')]()['then'](agentReportPreview[_0xee0a('0xb')](_0x3d0b3f))[_0xee0a('0xc')](loggerCatch('[createHistory]\x20'));}function moveContact(_0x305987){return BPromise['resolve']()[_0xee0a('0x8')](cmHopper[_0xee0a('0xd')](_0x305987,!![]))['catch'](loggerCatch(_0xee0a('0xe')));}exports['checkIsBlackList']=function(_0x32fad9){return BPromise[_0xee0a('0xa')]()['then'](cmHopperBlack['checkIsBlackList'](_0x32fad9))[_0xee0a('0xc')](loggerCatch(_0xee0a('0xf')));};exports[_0xee0a('0x10')]=function(_0x427b5c){return BPromise[_0xee0a('0xa')]()['then'](cmHopper[_0xee0a('0x10')](_0x427b5c))[_0xee0a('0xc')](loggerCatch('[getContactPreview]\x20'));};exports[_0xee0a('0xb')]=function(_0x35d1e4,_0x1bc8e1){create(_0x35d1e4)[_0xee0a('0xc')](loggerCatch(_0x1bc8e1));moveContact(_0x35d1e4)['catch'](loggerCatch(_0x1bc8e1));};exports[_0xee0a('0x11')]=function(_0x1d7a8a,_0x14ef67){createAgent(_0x1d7a8a)['catch'](loggerCatch(_0x14ef67));};exports[_0xee0a('0x12')]=function(_0x1ffdb5,_0xe1f346){create(_0x1ffdb5)[_0xee0a('0xc')](loggerCatch(_0xe1f346));};exports['createCustomerFinal']=function(_0xe9d5d4,_0x10c224){moveContact(_0xe9d5d4)[_0xee0a('0xc')](loggerCatch(_0x10c224));};exports[_0xee0a('0x13')]=function(_0x5c981e,_0x2abfbd,_0xff2f14){if(_0x2abfbd){_0x5c981e[_0xee0a('0x14')]=null;}if(_0xff2f14){_0x5c981e[_0xee0a('0x15')]=![];}return BPromise[_0xee0a('0xa')]()[_0xee0a('0x8')](cmHopper[_0xee0a('0x13')](_0x5c981e))['catch'](loggerCatch(_0xee0a('0x16')));};exports[_0xee0a('0x17')]=function(_0x27989c){return BPromise[_0xee0a('0xa')]()['then'](cmHopper[_0xee0a('0x17')](_0x27989c))[_0xee0a('0xc')](loggerCatch(_0xee0a('0x18')));};exports[_0xee0a('0x19')]=function(_0x4c61e2){return BPromise['resolve']()['then'](cmHopper[_0xee0a('0x19')]({'UserId':null},_0x4c61e2,0x1))['catch'](loggerCatch('[unlockContact]\x20'));};exports[_0xee0a('0x1a')]=function(_0x2c8965){return BPromise[_0xee0a('0xa')]()['then'](cmHopper[_0xee0a('0x19')]({'active':![]},_0x2c8965,0x1))[_0xee0a('0xc')](loggerCatch(_0xee0a('0x1b')));};exports[_0xee0a('0x1c')]=function(_0x2e7f18){var _0x45538d={};_0x45538d[_0xee0a('0x1d')]=_0x2e7f18[_0xee0a('0x1d')];_0x45538d[_0xee0a('0x1e')]=_0x2e7f18[_0xee0a('0x1e')];_0x45538d['calleridnum']=_0x2e7f18[_0xee0a('0x1f')];_0x45538d[_0xee0a('0x20')]=_0x2e7f18[_0xee0a('0x20')];_0x45538d[_0xee0a('0x21')]=_0x2e7f18[_0xee0a('0x21')];_0x45538d[_0xee0a('0x22')]=_0x2e7f18['answertime'];_0x45538d[_0xee0a('0x23')]=_0x2e7f18[_0xee0a('0x24')];_0x45538d[_0xee0a('0x25')]=0x1;_0x45538d[_0xee0a('0x26')]=_0x2e7f18['endtime'];_0x45538d[_0xee0a('0x27')]=_0x2e7f18['membername'];_0x45538d[_0xee0a('0x28')]=_0xee0a('0x29');_0x45538d[_0xee0a('0x2a')]=_0xee0a('0x2b');_0x45538d[_0xee0a('0x2c')]=0x0;_0x45538d[_0xee0a('0x2d')]=0x1;_0x45538d[_0xee0a('0x2e')]=_0x2e7f18[_0xee0a('0x2f')];_0x45538d['queuecallerexitreason']=_0xee0a('0x30');return BPromise[_0xee0a('0xa')]()['then'](voiceQueueReport[_0xee0a('0x31')](_0x45538d))[_0xee0a('0xc')](loggerCatch(_0xee0a('0x32')));};exports['getContactRecallMe']=function(_0x131b60,_0x2a81a0){return BPromise[_0xee0a('0xa')]()['then'](cmHopper[_0xee0a('0x33')](_0x131b60,_0x2a81a0))[_0xee0a('0xc')](loggerCatch(_0xee0a('0x34')));};exports['rescheduleContactInQueue']=function(_0x47a59c){return BPromise[_0xee0a('0xa')]()[_0xee0a('0x8')](cmHopper[_0xee0a('0x13')](_0x47a59c,!![],!![]))[_0xee0a('0xc')](loggerCatch(_0xee0a('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 311c92a..75a0007 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 _0x5ad3=['variablesAction','RECALL','uniqueid','originate','channelAgent','from-sip','timeout','totalGlobal','countcongestionretry','countnoanswerretry','cloneAction','Global','scheduledAt','active','scheduledat','add','ListId','VoiceQueueId','isNil','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','lastevent','queue','interface','buildAcw','agentReadyId','status','reachable','push','getDiff','seconds','createBody','CampaignId','filterKey','idContact','type','campaigntype','countbusyretry','countglobal','callbackuniqueid','callbackat','recallme','xmd-voicequeueid','xmd-queue','xmd-listid','xmd-dialtimeout','xmd-dialoptions','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','replace','extractCalleridName','match','extractCalleridNumber','util','lodash','moment','../../../../config/logger','env','XCALLY_IP_AGI','127.0.0.1','milliseconds','diff','loggerCatch','inspect','info','loggerError','logger2','isUndefined','string','isEmpty','\x22%s\x22\x20<%s>','format','isActive','Queue','name','calleridname','calleridnum','ContactId','dialer','dialOriginateTimeout','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','\x22agi://%s/square,%s\x22','dialQueueProject','NONE','originatecalleridnum','originatecalleridname','xcally-motion-preview','_XCALLY_MIXMONITOR_UNIQUEID','hasOwnProperty','tags','updatedAt','%s%s','toUpper','toLowerVariables','toLower','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','error','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','state','statedesc','Blacklist','starttime','responsetime','endtime','logAgent','YYYY-MM-DD\x20HH:mm:ss','ringtime','logLookAgent','membername','UserId','talktime','answertime','isFailure'];(function(_0xf405ad,_0x1afcdf){var _0x45c5a7=function(_0x4d32df){while(--_0x4d32df){_0xf405ad['push'](_0xf405ad['shift']());}};_0x45c5a7(++_0x1afcdf);}(_0x5ad3,0x1e2));var _0x35ad=function(_0x4c8c4d,_0x170fc3){_0x4c8c4d=_0x4c8c4d-0x0;var _0x7c72d2=_0x5ad3[_0x4c8c4d];return _0x7c72d2;};'use strict';var util=require(_0x35ad('0x0'));var _=require(_0x35ad('0x1'));var moment=require(_0x35ad('0x2'));var logger=require(_0x35ad('0x3'))('preview');var ipAgi=process[_0x35ad('0x4')][_0x35ad('0x5')]||_0x35ad('0x6');function getSeconds(_0x69a0b3,_0x450f55){var _0x1fed0d=moment(_0x69a0b3)[_0x35ad('0x7')](0x0);var _0x436dcb=moment(_0x450f55)[_0x35ad('0x7')](0x0);return _0x1fed0d[_0x35ad('0x8')](_0x436dcb,'seconds');}exports[_0x35ad('0x9')]=function(_0x3cec3e){return function(_0x3f1f55){logger['error'](_0x3cec3e,util[_0x35ad('0xa')](_0x3f1f55,{'showHidden':![],'depth':null}));};};exports['logger']=function(_0x5a29e3,_0x2efae0){logger[_0x35ad('0xb')](_0x5a29e3,util['inspect'](_0x2efae0,{'showHidden':![],'depth':null}));};exports[_0x35ad('0xc')]=function(_0x3a70a9,_0x4ad760){logger['error'](_0x3a70a9,util[_0x35ad('0xa')](_0x4ad760,{'showHidden':![],'depth':null}));};exports[_0x35ad('0xd')]=function(_0x4cf6bd){return function(_0x3c4dd5){logger[_0x35ad('0xb')](_0x4cf6bd,util['inspect'](_0x3c4dd5,{'showHidden':![],'depth':null}));};};exports['message']=function(_0x5ba1aa,_0x2e81c8,_0x3cda5e){return{'message':_0x5ba1aa,'unlock':_0x2e81c8,'active':_0x3cda5e};};exports['getCallerId']=function(_0x3e2676,_0x2ebceb,_0x591917){if(!_[_0x35ad('0xe')](_0x591917)&&'string'===typeof _0x591917&&!_['isEmpty'](_0x591917)){if(!_[_0x35ad('0xe')](_0x2ebceb)&&_0x35ad('0xf')===typeof _0x2ebceb&&!_[_0x35ad('0x10')](_0x2ebceb)){return util['format'](_0x35ad('0x11'),_0x2ebceb,_0x591917);}return util[_0x35ad('0x12')](_0x35ad('0x11'),_0x591917,_0x591917);}if(!_[_0x35ad('0xe')](_0x3e2676)&&_0x35ad('0xf')===typeof _0x3e2676&&!_[_0x35ad('0x10')](_0x3e2676)){return _0x3e2676;}return'\x22\x22\x20<>';};exports[_0x35ad('0x13')]=function(_0x2876ad){if(_['isNil'](_0x2876ad)){return![];}return _0x2876ad;};exports['addVariables']=function(_0x3251d9,_0x398853,_0x578b1b,_0x21f611,_0x32735e,_0x496620){var _0x37c03d={'XMD-QUEUE':_0x398853[_0x35ad('0x14')]?_0x398853[_0x35ad('0x14')][_0x35ad('0x15')]:'','XMD-CALLERID':_0x21f611,'XMD-CALLERID-PREVIEW':_0x496620?util[_0x35ad('0x12')](_0x35ad('0x11'),_0x496620[_0x35ad('0x16')],_0x496620[_0x35ad('0x17')]):_0x21f611,'XMD-DIALID':_0x32735e,'XMD-CONTACTID':_0x398853[_0x35ad('0x18')],'XMD-CDRTYPE':_0x35ad('0x19'),'CALLERID(all)':_0x21f611,'XMD-VOICEQUEUEID':_0x398853['VoiceQueueId'],'XMD-DIALCHANNEL':_0x578b1b,'XMD-DIALTIMEOUT':_0x3251d9[_0x35ad('0x1a')]||0x1e,'XMD-DIALOPTIONS':util[_0x35ad('0x12')]('\x22rtTxX%s%s\x22',_0x3251d9[_0x35ad('0x1b')]?'g':'',_[_0x35ad('0x10')](_0x3251d9[_0x35ad('0x1c')])?'':_0x35ad('0x1d')),'XMD-DIALURL':_0x3251d9[_0x35ad('0x1e')]||'','XMD-AGI':_0x3251d9['dialQueueProject']?util[_0x35ad('0x12')](_0x35ad('0x1f'),ipAgi,_0x3251d9[_0x35ad('0x20')]):_0x35ad('0x21'),'XMD-AGIAFTER':_0x3251d9[_0x35ad('0x1b')]?util[_0x35ad('0x12')](_0x35ad('0x1f'),ipAgi,_0x3251d9[_0x35ad('0x1b')]):'NONE','XMD-ORIGINATECALLERIDNUM':_0x496620?_0x496620[_0x35ad('0x22')]:'','XMD-ORIGINATECALLERIDNAME':_0x496620?_0x496620[_0x35ad('0x23')]:'','XMD-DESTINATION':_0x35ad('0x24')};if(!_[_0x35ad('0x10')](_0x3251d9[_0x35ad('0x1c')])){_0x37c03d[util['format']('%s','_XCALLY_MIXMONITOR_FORMAT')]=_0x3251d9[_0x35ad('0x1c')];_0x37c03d[util['format']('%s',_0x35ad('0x25'))]=_0x32735e;}if(_0x398853&&_0x398853['Contact']){for(var _0x53603f in _0x398853['Contact']){if(_0x398853['Contact'][_0x35ad('0x26')](_0x53603f)){if(!_['isNil'](_0x398853['Contact'][_0x53603f])&&_0x53603f!=='id'&&_0x53603f!==_0x35ad('0x27')&&_0x53603f!=='createdAt'&&_0x53603f!==_0x35ad('0x28')){_0x37c03d[util['format'](_0x35ad('0x29'),'XMD-',_[_0x35ad('0x2a')](_0x53603f))]=_0x398853['Contact'][_0x53603f];}}}}return _0x37c03d;};exports[_0x35ad('0x2b')]=function(_0x2766dd){var _0x899f83={};for(var _0x4b6ec2 in _0x2766dd){if(_0x2766dd[_0x35ad('0x26')](_0x4b6ec2)){_0x899f83[util[_0x35ad('0x12')]('%s',_[_0x35ad('0x2c')](_0x4b6ec2))]=_0x2766dd[_0x4b6ec2];}}return{'variables':_0x899f83};};exports[_0x35ad('0x2d')]=function(_0x3cb239,_0x5cba25){if(!_['isNil'](_0x3cb239)){if(_0x3cb239[_0x35ad('0x26')](_0x35ad('0x2e'))){if(_0x3cb239[_0x35ad('0x2e')]>0x0){_0x3cb239[_0x35ad('0x2e')]-=0x1;}else{logger['error'](_0x35ad('0x2f'),_0x5cba25);}}}else{logger[_0x35ad('0x30')](_0x35ad('0x31'),_0x5cba25);}};exports[_0x35ad('0x32')]=function(_0x264135){var _0x3b7b52=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x264135[_0x35ad('0x33')]=0xd;_0x264135[_0x35ad('0x34')]=_0x35ad('0x35');_0x264135[_0x35ad('0x36')]=_0x3b7b52;_0x264135[_0x35ad('0x37')]=_0x3b7b52;_0x264135[_0x35ad('0x38')]=_0x3b7b52;};exports[_0x35ad('0x39')]=function(_0x2288f3,_0x4625dd,_0x549231){var _0x459d2f=moment()['format'](_0x35ad('0x3a'));_0x2288f3[_0x35ad('0x33')]=_0x4625dd;_0x2288f3[_0x35ad('0x34')]=_0x549231;_0x2288f3[_0x35ad('0x37')]=_0x459d2f;_0x2288f3[_0x35ad('0x3b')]=getSeconds(_0x2288f3[_0x35ad('0x37')],_0x2288f3[_0x35ad('0x36')]);};exports[_0x35ad('0x3c')]=function(_0x15894b,_0x5dd327,_0x200e4d){_0x15894b[_0x35ad('0x3d')]=_0x5dd327;_0x15894b[_0x35ad('0x3e')]=_0x200e4d;};exports['logCustomer']=function(_0x19d82d,_0x3c7cb7,_0x9ffec4){var _0x5e137e=moment()[_0x35ad('0x12')](_0x35ad('0x3a'));_0x19d82d[_0x35ad('0x33')]=_0x3c7cb7;_0x19d82d[_0x35ad('0x34')]=_0x9ffec4;_0x19d82d[_0x35ad('0x37')]=_0x19d82d[_0x35ad('0x37')]?_0x19d82d[_0x35ad('0x37')]:_0x5e137e;_0x19d82d['endtime']=_0x19d82d[_0x35ad('0x38')]?_0x19d82d['endtime']:_0x5e137e;_0x19d82d[_0x35ad('0x3b')]=getSeconds(_0x19d82d[_0x35ad('0x37')]||0x0,_0x19d82d[_0x35ad('0x36')]||0x0);_0x19d82d[_0x35ad('0x3f')]=_0x19d82d[_0x35ad('0x40')]?getSeconds(_0x19d82d[_0x35ad('0x38')],_0x19d82d[_0x35ad('0x40')]):0x0;};exports[_0x35ad('0x41')]=function(_0x1f44ec){return _0x1f44ec==='Failure';};exports[_0x35ad('0x42')]=function(_0x253d02,_0xd184f7,_0x4786fc,_0xb087aa,_0x5a5509){var _0x331cd5=_0xb087aa?_0x35ad('0x43'):_0x253d02['calleridname'];_0x331cd5=_0x5a5509?'BOOKED':_0x331cd5;return{'actionid':_0x253d02[_0x35ad('0x44')],'action':_0x35ad('0x45'),'channel':_0x253d02[_0x35ad('0x46')],'callerid':util[_0x35ad('0x12')]('\x22%s\x22\x20<%s>',_0x331cd5,_0x253d02[_0x35ad('0x17')]),'Exten':_0x35ad('0x24'),'Context':_0x35ad('0x47'),'Priority':'1','variable':_0x4786fc,'timeout':(_0xd184f7[_0x35ad('0x48')]||0x1e)*0x3e8,'async':!![],'channelid':_0x253d02[_0x35ad('0x44')]};};exports[_0x35ad('0x49')]=function(_0x3ea556){return _0x3ea556['countbusyretry']+_0x3ea556[_0x35ad('0x4a')]+_0x3ea556[_0x35ad('0x4b')];};exports[_0x35ad('0x4c')]=function(_0x5733d9){var _0x5e3f96=_['clone'](_0x5733d9);_0x5e3f96[_0x35ad('0x33')]=0xf;_0x5e3f96[_0x35ad('0x34')]=_0x35ad('0x4d');return _0x5e3f96;};exports[_0x35ad('0x4e')]=function(_0x4f8058,_0x29e4c7,_0x46c462){var _0x3583ca={};_0x3583ca[_0x29e4c7]=_0x4f8058[_0x29e4c7];_0x3583ca[_0x35ad('0x4f')]=![];_0x3583ca[_0x35ad('0x50')]=moment()[_0x35ad('0x51')](_0x46c462,'minutes')['format'](_0x35ad('0x3a'));_0x3583ca[_0x35ad('0x18')]=_0x4f8058['ContactId'];_0x3583ca['ListId']=_0x4f8058[_0x35ad('0x52')];_0x3583ca[_0x35ad('0x53')]=_0x4f8058[_0x35ad('0x53')]||undefined;return _0x3583ca;};exports['decrementTalkink']=function(_0x486a11,_0xa35ee4){if(!_[_0x35ad('0x54')](_0x486a11)){if(_0x486a11[_0x35ad('0x55')]>0x0){_0x486a11['pTalking']-=0x1;}else{logger[_0x35ad('0x30')](_0xa35ee4,_0x35ad('0x56'));}}else{logger[_0x35ad('0x30')](_0xa35ee4,_0x35ad('0x57'));}};exports[_0x35ad('0x58')]=function(_0x46def2){if(_0x46def2<=0x0){return!![];}return![];};exports['buildObj']=function(_0x119b99,_0x22415d){_0x119b99[_0x35ad('0x59')]=_0x22415d;_0x119b99['name']=_0x119b99[_0x35ad('0x5a')];_0x119b99[_0x35ad('0x5b')]=_0x119b99[_0x35ad('0x46')];return _0x119b99;};exports[_0x35ad('0x5c')]=function(_0x564a01){var _0x53496d={};_0x53496d[_0x35ad('0x5a')]=_0x564a01[_0x35ad('0x5a')];_0x53496d[_0x35ad('0x5b')]=_0x564a01[_0x35ad('0x46')];_0x53496d[_0x35ad('0x44')]=_0x564a01['uniqueid'];return _0x53496d;};exports[_0x35ad('0x5d')]=function(_0x39fa94){var _0x45a7e2=[];for(var _0xae2c85 in _0x39fa94){if(_0x39fa94[_0x35ad('0x26')](_0xae2c85)){if(!_[_0x35ad('0x54')](_0x39fa94[_0xae2c85])&&_0x39fa94[_0xae2c85]['state']==='not_inuse'&&_0x39fa94[_0xae2c85][_0x35ad('0x5e')]===_0x35ad('0x5f')){_0x45a7e2[_0x35ad('0x60')](_0x39fa94[_0xae2c85]['id']);}}}return _0x45a7e2;};exports[_0x35ad('0x61')]=function(_0x1043cd){var _0x12774d=moment()[_0x35ad('0x7')](0x0);var _0x5cef35=moment(_0x1043cd)[_0x35ad('0x7')](0x0);return _0x12774d[_0x35ad('0x8')](_0x5cef35,_0x35ad('0x62'));};exports[_0x35ad('0x63')]=function(_0x522054){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x522054[_0x35ad('0x18')],'ListId':_0x522054[_0x35ad('0x52')],'VoiceQueueId':_0x522054['VoiceQueueId']||undefined,'CampaignId':_0x522054[_0x35ad('0x64')]||undefined};};exports[_0x35ad('0x65')]=function(_0x1da9ca){if(_0x1da9ca===_0x35ad('0x44')||_0x1da9ca===_0x35ad('0x66')||_0x1da9ca===_0x35ad('0x5a')||_0x1da9ca===_0x35ad('0x67')||_0x1da9ca===_0x35ad('0x68')||_0x1da9ca==='dialAnswer'||_0x1da9ca===_0x35ad('0x3d')||_0x1da9ca===_0x35ad('0x46')||_0x1da9ca===_0x35ad('0x16')||_0x1da9ca==='active'||_0x1da9ca===_0x35ad('0x17')||_0x1da9ca==='scheduledat'||_0x1da9ca===_0x35ad('0x69')||_0x1da9ca===_0x35ad('0x4a')||_0x1da9ca===_0x35ad('0x4b')||_0x1da9ca===_0x35ad('0x6a')||_0x1da9ca==='callback'||_0x1da9ca===_0x35ad('0x6b')||_0x1da9ca===_0x35ad('0x6c')||_0x1da9ca===_0x35ad('0x6d')||_0x1da9ca===_0x35ad('0x18')||_0x1da9ca===_0x35ad('0x52')||_0x1da9ca==='UserId'||_0x1da9ca===_0x35ad('0x53')||_0x1da9ca==='sipcallid'||_0x1da9ca===_0x35ad('0x6e')||_0x1da9ca===_0x35ad('0x6f')||_0x1da9ca==='xmd-phone'||_0x1da9ca===_0x35ad('0x70')||_0x1da9ca==='xmd-dialurl'||_0x1da9ca===_0x35ad('0x71')||_0x1da9ca===_0x35ad('0x72')||_0x1da9ca==='xmd-dialid'||_0x1da9ca===_0x35ad('0x73')||_0x1da9ca===_0x35ad('0x74')||_0x1da9ca===_0x35ad('0x75')||_0x1da9ca===_0x35ad('0x76')||_0x1da9ca===_0x35ad('0x77')||_0x1da9ca===_0x35ad('0x78')||_0x1da9ca===_0x35ad('0x79')||_0x1da9ca==='rtpaudioqosbridged'||_0x1da9ca===_0x35ad('0x7a')||_0x1da9ca===_0x35ad('0x7b')||_0x1da9ca===_0x35ad('0x7c')||_0x1da9ca===_0x35ad('0x7d')||_0x1da9ca===_0x35ad('0x7e')||_0x1da9ca===_0x35ad('0x7f')||_0x1da9ca===_0x35ad('0x79')||_0x1da9ca==='rtpaudioqosbridged'||_0x1da9ca===_0x35ad('0x7a')||_0x1da9ca===_0x35ad('0x7b')||_0x1da9ca===_0x35ad('0x7c')||_0x1da9ca===_0x35ad('0x7d')||_0x1da9ca===_0x35ad('0x7e')||_0x1da9ca==='rtpaudioqosrttbridged'||_0x1da9ca===_0x35ad('0x80')||_0x1da9ca===_0x35ad('0x81')||_0x1da9ca==='state'||_0x1da9ca===_0x35ad('0x34')){return![];}return!![];};exports[_0x35ad('0x82')]=function(_0x891ab4,_0x286543){var _0x4bd652,_0x351f14,_0x59fb4e;if(_0x286543<=0x0){_0x286543=0x1;}_0x4bd652=new RegExp(_0x35ad('0x83')+_0x286543+'}$');_0x351f14=Math[_0x35ad('0x84')](0xa,_0x286543-0x1);_0x59fb4e=Math[_0x35ad('0x84')](0xa,_0x286543)-0x1;return util['format']('%s',_[_0x35ad('0x85')](_0x891ab4,_0x4bd652,_['random'](_0x351f14,_0x59fb4e)));};exports[_0x35ad('0x86')]=function(_0x554ca4){var _0x5ad236=_0x554ca4[_0x35ad('0x87')](/"(.*?)"/);return _0x5ad236?_0x5ad236[0x1]:_0x554ca4;};exports[_0x35ad('0x88')]=function(_0x58fed1){var _0x29337b=_0x58fed1[_0x35ad('0x87')](/<(.*?)>/);return _0x29337b?_0x29337b[0x1]:_0x58fed1;}; \ No newline at end of file +var _0x1c3d=['idContact','dialAnswer','active','countbusyretry','countglobal','callback','callbackuniqueid','recallme','sipcallid','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqosjitter','bridgepeer','bridgepvtcallid','\x5cw{0,','pow','replace','random','match','lodash','moment','../../../../config/logger','preview','env','milliseconds','seconds','loggerCatch','error','inspect','logger','loggerError','logger2','getCallerId','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','isNil','name','calleridname','calleridnum','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','\x22agi://%s/square,%s\x22','NONE','dialQueueProject2','originatecalleridnum','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','tags','createdAt','updatedAt','%s%s','XMD-','toLowerVariables','toLower','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','Blacklist','responsetime','logAgent','ringtime','logLookAgent','membername','UserId','logCustomer','endtime','starttime','talktime','answertime','variablesAction','RECALL','originate','xcally-motion-preview','uniqueid','totalGlobal','countcongestionretry','countagentrejectretry','countnosuchnumberretry','cloneAction','Global','scheduledAt','scheduledat','add','minutes','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','buildObj','lastevent','interface','buildAcw','queue','channelAgent','agentReadyId','not_inuse','status','reachable','push','getDiff','diff','CampaignId'];(function(_0x406115,_0x19f7a1){var _0xbbabdb=function(_0x28554d){while(--_0x28554d){_0x406115['push'](_0x406115['shift']());}};_0xbbabdb(++_0x19f7a1);}(_0x1c3d,0x1b8));var _0xd1c3=function(_0x2f366c,_0xcd026c){_0x2f366c=_0x2f366c-0x0;var _0x22296c=_0x1c3d[_0x2f366c];return _0x22296c;};'use strict';var util=require('util');var _=require(_0xd1c3('0x0'));var moment=require(_0xd1c3('0x1'));var logger=require(_0xd1c3('0x2'))(_0xd1c3('0x3'));var ipAgi=process[_0xd1c3('0x4')]['XCALLY_IP_AGI']||'127.0.0.1';function getSeconds(_0xffc3d0,_0x3cc8a4){var _0x793c5c=moment(_0xffc3d0)[_0xd1c3('0x5')](0x0);var _0x14093d=moment(_0x3cc8a4)[_0xd1c3('0x5')](0x0);return _0x793c5c['diff'](_0x14093d,_0xd1c3('0x6'));}exports[_0xd1c3('0x7')]=function(_0x5db2f0){return function(_0x1afc71){logger[_0xd1c3('0x8')](_0x5db2f0,util[_0xd1c3('0x9')](_0x1afc71,{'showHidden':![],'depth':null}));};};exports[_0xd1c3('0xa')]=function(_0x39f628,_0x5f1d25){logger['info'](_0x39f628,util[_0xd1c3('0x9')](_0x5f1d25,{'showHidden':![],'depth':null}));};exports[_0xd1c3('0xb')]=function(_0xcb381b,_0x1afad3){logger[_0xd1c3('0x8')](_0xcb381b,util[_0xd1c3('0x9')](_0x1afad3,{'showHidden':![],'depth':null}));};exports[_0xd1c3('0xc')]=function(_0x280405){return function(_0x159691){logger['info'](_0x280405,util[_0xd1c3('0x9')](_0x159691,{'showHidden':![],'depth':null}));};};exports['message']=function(_0x5eb3c1,_0x11d1f3,_0x57a55e){return{'message':_0x5eb3c1,'unlock':_0x11d1f3,'active':_0x57a55e};};exports[_0xd1c3('0xd')]=function(_0x1f30ff,_0x37d175,_0x52e7bc){if(!_[_0xd1c3('0xe')](_0x52e7bc)&&_0xd1c3('0xf')===typeof _0x52e7bc&&!_[_0xd1c3('0x10')](_0x52e7bc)){if(!_[_0xd1c3('0xe')](_0x37d175)&&_0xd1c3('0xf')===typeof _0x37d175&&!_[_0xd1c3('0x10')](_0x37d175)){return util[_0xd1c3('0x11')](_0xd1c3('0x12'),_0x37d175,_0x52e7bc);}return util[_0xd1c3('0x11')](_0xd1c3('0x12'),_0x52e7bc,_0x52e7bc);}if(!_['isUndefined'](_0x1f30ff)&&'string'===typeof _0x1f30ff&&!_[_0xd1c3('0x10')](_0x1f30ff)){return _0x1f30ff;}return _0xd1c3('0x13');};exports[_0xd1c3('0x14')]=function(_0x54a450){if(_[_0xd1c3('0x15')](_0x54a450)){return![];}return _0x54a450;};exports['addVariables']=function(_0x9c9d4d,_0xac3076,_0x1dcb29,_0x588f4e,_0x4b3efc,_0x7942b7){var _0x1b5fae={'XMD-QUEUE':_0xac3076['Queue']?_0xac3076['Queue'][_0xd1c3('0x16')]:'','XMD-CALLERID':_0x588f4e,'XMD-CALLERID-PREVIEW':_0x7942b7?util[_0xd1c3('0x11')](_0xd1c3('0x12'),_0x7942b7[_0xd1c3('0x17')],_0x7942b7[_0xd1c3('0x18')]):_0x588f4e,'XMD-DIALID':_0x4b3efc,'XMD-CONTACTID':_0xac3076[_0xd1c3('0x19')],'XMD-CDRTYPE':_0xd1c3('0x1a'),'CALLERID(all)':_0x588f4e,'XMD-VOICEQUEUEID':_0xac3076[_0xd1c3('0x1b')],'XMD-DIALCHANNEL':_0x1dcb29,'XMD-DIALTIMEOUT':_0x9c9d4d[_0xd1c3('0x1c')]||0x1e,'XMD-DIALOPTIONS':util[_0xd1c3('0x11')]('\x22rtTxX%s%s\x22',_0x9c9d4d['dialQueueProject2']?'g':'',_[_0xd1c3('0x10')](_0x9c9d4d[_0xd1c3('0x1d')])?'':_0xd1c3('0x1e')),'XMD-DIALURL':_0x9c9d4d[_0xd1c3('0x1f')]||'','XMD-AGI':_0x9c9d4d['dialQueueProject']?util[_0xd1c3('0x11')](_0xd1c3('0x20'),ipAgi,_0x9c9d4d['dialQueueProject']):_0xd1c3('0x21'),'XMD-AGIAFTER':_0x9c9d4d[_0xd1c3('0x22')]?util[_0xd1c3('0x11')](_0xd1c3('0x20'),ipAgi,_0x9c9d4d[_0xd1c3('0x22')]):_0xd1c3('0x21'),'XMD-ORIGINATECALLERIDNUM':_0x7942b7?_0x7942b7[_0xd1c3('0x23')]:'','XMD-ORIGINATECALLERIDNAME':_0x7942b7?_0x7942b7['originatecalleridname']:'','XMD-DESTINATION':'xcally-motion-preview'};if(!_[_0xd1c3('0x10')](_0x9c9d4d[_0xd1c3('0x1d')])){_0x1b5fae[util[_0xd1c3('0x11')]('%s',_0xd1c3('0x24'))]=_0x9c9d4d[_0xd1c3('0x1d')];_0x1b5fae[util['format']('%s',_0xd1c3('0x25'))]=_0x4b3efc;}if(_0xac3076&&_0xac3076[_0xd1c3('0x26')]){for(var _0x5ce257 in _0xac3076[_0xd1c3('0x26')]){if(_0xac3076['Contact'][_0xd1c3('0x27')](_0x5ce257)){if(!_[_0xd1c3('0x15')](_0xac3076[_0xd1c3('0x26')][_0x5ce257])&&_0x5ce257!=='id'&&_0x5ce257!==_0xd1c3('0x28')&&_0x5ce257!==_0xd1c3('0x29')&&_0x5ce257!==_0xd1c3('0x2a')){_0x1b5fae[util[_0xd1c3('0x11')](_0xd1c3('0x2b'),_0xd1c3('0x2c'),_['toUpper'](_0x5ce257))]=_0xac3076[_0xd1c3('0x26')][_0x5ce257];}}}}return _0x1b5fae;};exports[_0xd1c3('0x2d')]=function(_0x55d395){var _0x349906={};for(var _0x5c9a8e in _0x55d395){if(_0x55d395[_0xd1c3('0x27')](_0x5c9a8e)){_0x349906[util[_0xd1c3('0x11')]('%s',_[_0xd1c3('0x2e')](_0x5c9a8e))]=_0x55d395[_0x5c9a8e];}}return{'variables':_0x349906};};exports['updateOriginated']=function(_0x3931fe,_0x127497){if(!_[_0xd1c3('0x15')](_0x3931fe)){if(_0x3931fe[_0xd1c3('0x27')](_0xd1c3('0x2f'))){if(_0x3931fe[_0xd1c3('0x2f')]>0x0){_0x3931fe[_0xd1c3('0x2f')]-=0x1;}else{logger[_0xd1c3('0x8')](_0xd1c3('0x30'),_0x127497);}}}else{logger['error']('[updateOriginated]\x20is\x20null\x20or\x20undefined',_0x127497);}};exports[_0xd1c3('0x31')]=function(_0x5cc6a2){var _0x1bd072=moment()[_0xd1c3('0x11')](_0xd1c3('0x32'));_0x5cc6a2[_0xd1c3('0x33')]=0xd;_0x5cc6a2[_0xd1c3('0x34')]=_0xd1c3('0x35');_0x5cc6a2['starttime']=_0x1bd072;_0x5cc6a2[_0xd1c3('0x36')]=_0x1bd072;_0x5cc6a2['endtime']=_0x1bd072;};exports[_0xd1c3('0x37')]=function(_0x500841,_0x292a57,_0x5eaa6d){var _0x59527e=moment()[_0xd1c3('0x11')](_0xd1c3('0x32'));_0x500841[_0xd1c3('0x33')]=_0x292a57;_0x500841['statedesc']=_0x5eaa6d;_0x500841[_0xd1c3('0x36')]=_0x59527e;_0x500841[_0xd1c3('0x38')]=getSeconds(_0x500841[_0xd1c3('0x36')],_0x500841['starttime']);};exports[_0xd1c3('0x39')]=function(_0x14d766,_0x21b01a,_0x343b76){_0x14d766[_0xd1c3('0x3a')]=_0x21b01a;_0x14d766[_0xd1c3('0x3b')]=_0x343b76;};exports[_0xd1c3('0x3c')]=function(_0x5744f0,_0x20c891,_0x357855){var _0x58d588=moment()['format'](_0xd1c3('0x32'));_0x5744f0[_0xd1c3('0x33')]=_0x20c891;_0x5744f0[_0xd1c3('0x34')]=_0x357855;_0x5744f0[_0xd1c3('0x36')]=_0x5744f0[_0xd1c3('0x36')]?_0x5744f0['responsetime']:_0x58d588;_0x5744f0[_0xd1c3('0x3d')]=_0x5744f0[_0xd1c3('0x3d')]?_0x5744f0[_0xd1c3('0x3d')]:_0x58d588;_0x5744f0[_0xd1c3('0x38')]=getSeconds(_0x5744f0[_0xd1c3('0x36')]||0x0,_0x5744f0[_0xd1c3('0x3e')]||0x0);_0x5744f0[_0xd1c3('0x3f')]=_0x5744f0[_0xd1c3('0x40')]?getSeconds(_0x5744f0[_0xd1c3('0x3d')],_0x5744f0[_0xd1c3('0x40')]):0x0;};exports['isFailure']=function(_0x16b731){return _0x16b731==='Failure';};exports[_0xd1c3('0x41')]=function(_0x4537f6,_0x13237c,_0x480dcc,_0x3e3116,_0x767ff7){var _0x261a89=_0x3e3116?_0xd1c3('0x42'):_0x4537f6[_0xd1c3('0x17')];_0x261a89=_0x767ff7?'BOOKED':_0x261a89;return{'actionid':_0x4537f6['uniqueid'],'action':_0xd1c3('0x43'),'channel':_0x4537f6['channelAgent'],'callerid':util[_0xd1c3('0x11')](_0xd1c3('0x12'),_0x261a89,_0x4537f6[_0xd1c3('0x18')]),'Exten':_0xd1c3('0x44'),'Context':'from-sip','Priority':'1','variable':_0x480dcc,'timeout':(_0x13237c['timeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x4537f6[_0xd1c3('0x45')]};};exports[_0xd1c3('0x46')]=function(_0x375bd5){return _0x375bd5['countbusyretry']+_0x375bd5[_0xd1c3('0x47')]+_0x375bd5['countnoanswerretry']+_0x375bd5[_0xd1c3('0x48')]+_0x375bd5[_0xd1c3('0x49')];};exports[_0xd1c3('0x4a')]=function(_0x163406){var _0x5ae29b=_['clone'](_0x163406);_0x5ae29b[_0xd1c3('0x33')]=0xf;_0x5ae29b[_0xd1c3('0x34')]=_0xd1c3('0x4b');return _0x5ae29b;};exports[_0xd1c3('0x4c')]=function(_0xbaf0b7,_0xae72ab,_0x3adfd4){var _0x2e0da5={};_0x2e0da5[_0xae72ab]=_0xbaf0b7[_0xae72ab];_0x2e0da5['active']=![];_0x2e0da5[_0xd1c3('0x4d')]=moment()[_0xd1c3('0x4e')](_0x3adfd4,_0xd1c3('0x4f'))[_0xd1c3('0x11')](_0xd1c3('0x32'));_0x2e0da5['ContactId']=_0xbaf0b7['ContactId'];_0x2e0da5[_0xd1c3('0x50')]=_0xbaf0b7['ListId'];_0x2e0da5[_0xd1c3('0x1b')]=_0xbaf0b7[_0xd1c3('0x1b')]||undefined;return _0x2e0da5;};exports[_0xd1c3('0x51')]=function(_0x558439,_0x306d47){if(!_[_0xd1c3('0x15')](_0x558439)){if(_0x558439[_0xd1c3('0x52')]>0x0){_0x558439[_0xd1c3('0x52')]-=0x1;}else{logger[_0xd1c3('0x8')](_0x306d47,_0xd1c3('0x53'));}}else{logger[_0xd1c3('0x8')](_0x306d47,_0xd1c3('0x54'));}};exports[_0xd1c3('0x55')]=function(_0x1a70b2){if(_0x1a70b2<=0x0){return!![];}return![];};exports[_0xd1c3('0x56')]=function(_0x438b96,_0x1abd16){_0x438b96[_0xd1c3('0x57')]=_0x1abd16;_0x438b96['name']=_0x438b96['queue'];_0x438b96[_0xd1c3('0x58')]=_0x438b96['channelAgent'];return _0x438b96;};exports[_0xd1c3('0x59')]=function(_0x4579c0){var _0x33f942={};_0x33f942[_0xd1c3('0x5a')]=_0x4579c0[_0xd1c3('0x5a')];_0x33f942[_0xd1c3('0x58')]=_0x4579c0[_0xd1c3('0x5b')];_0x33f942[_0xd1c3('0x45')]=_0x4579c0[_0xd1c3('0x45')];return _0x33f942;};exports[_0xd1c3('0x5c')]=function(_0x1dfbd5){var _0x5b5d21=[];for(var _0x246e02 in _0x1dfbd5){if(_0x1dfbd5[_0xd1c3('0x27')](_0x246e02)){if(!_[_0xd1c3('0x15')](_0x1dfbd5[_0x246e02])&&_0x1dfbd5[_0x246e02]['state']===_0xd1c3('0x5d')&&_0x1dfbd5[_0x246e02][_0xd1c3('0x5e')]===_0xd1c3('0x5f')){_0x5b5d21[_0xd1c3('0x60')](_0x1dfbd5[_0x246e02]['id']);}}}return _0x5b5d21;};exports[_0xd1c3('0x61')]=function(_0x48aae1){var _0x1d794a=moment()[_0xd1c3('0x5')](0x0);var _0x2adb07=moment(_0x48aae1)[_0xd1c3('0x5')](0x0);return _0x1d794a[_0xd1c3('0x62')](_0x2adb07,'seconds');};exports['createBody']=function(_0x2d3731){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x2d3731['ContactId'],'ListId':_0x2d3731['ListId'],'VoiceQueueId':_0x2d3731['VoiceQueueId']||undefined,'CampaignId':_0x2d3731[_0xd1c3('0x63')]||undefined};};exports['filterKey']=function(_0x1289ec){if(_0x1289ec===_0xd1c3('0x45')||_0x1289ec===_0xd1c3('0x64')||_0x1289ec==='queue'||_0x1289ec==='type'||_0x1289ec==='campaigntype'||_0x1289ec===_0xd1c3('0x65')||_0x1289ec===_0xd1c3('0x3a')||_0x1289ec===_0xd1c3('0x5b')||_0x1289ec===_0xd1c3('0x17')||_0x1289ec===_0xd1c3('0x66')||_0x1289ec===_0xd1c3('0x18')||_0x1289ec===_0xd1c3('0x4d')||_0x1289ec===_0xd1c3('0x67')||_0x1289ec==='countcongestionretry'||_0x1289ec==='countnoanswerretry'||_0x1289ec===_0xd1c3('0x68')||_0x1289ec===_0xd1c3('0x69')||_0x1289ec===_0xd1c3('0x6a')||_0x1289ec==='callbackat'||_0x1289ec===_0xd1c3('0x6b')||_0x1289ec===_0xd1c3('0x19')||_0x1289ec===_0xd1c3('0x50')||_0x1289ec===_0xd1c3('0x3b')||_0x1289ec===_0xd1c3('0x1b')||_0x1289ec===_0xd1c3('0x6c')||_0x1289ec==='xmd-voicequeueid'||_0x1289ec===_0xd1c3('0x6d')||_0x1289ec===_0xd1c3('0x6e')||_0x1289ec===_0xd1c3('0x6f')||_0x1289ec===_0xd1c3('0x70')||_0x1289ec===_0xd1c3('0x71')||_0x1289ec===_0xd1c3('0x72')||_0x1289ec===_0xd1c3('0x73')||_0x1289ec===_0xd1c3('0x74')||_0x1289ec===_0xd1c3('0x75')||_0x1289ec===_0xd1c3('0x76')||_0x1289ec==='xmd-callerid'||_0x1289ec==='xmd-agiafter'||_0x1289ec===_0xd1c3('0x77')||_0x1289ec===_0xd1c3('0x78')||_0x1289ec===_0xd1c3('0x79')||_0x1289ec==='rtpaudioqosjitter'||_0x1289ec===_0xd1c3('0x7a')||_0x1289ec===_0xd1c3('0x7b')||_0x1289ec===_0xd1c3('0x7c')||_0x1289ec===_0xd1c3('0x7d')||_0x1289ec===_0xd1c3('0x7e')||_0x1289ec===_0xd1c3('0x78')||_0x1289ec===_0xd1c3('0x79')||_0x1289ec===_0xd1c3('0x7f')||_0x1289ec==='rtpaudioqosjitterbridged'||_0x1289ec==='rtpaudioqosloss'||_0x1289ec===_0xd1c3('0x7c')||_0x1289ec===_0xd1c3('0x7d')||_0x1289ec===_0xd1c3('0x7e')||_0x1289ec===_0xd1c3('0x80')||_0x1289ec===_0xd1c3('0x81')||_0x1289ec==='state'||_0x1289ec===_0xd1c3('0x34')){return![];}return!![];};exports['getCallerIdRandom']=function(_0x3b42ae,_0x463b33){var _0x2c722e,_0x5378bc,_0x16b9fd;if(_0x463b33<=0x0){_0x463b33=0x1;}_0x2c722e=new RegExp(_0xd1c3('0x82')+_0x463b33+'}$');_0x5378bc=Math[_0xd1c3('0x83')](0xa,_0x463b33-0x1);_0x16b9fd=Math['pow'](0xa,_0x463b33)-0x1;return util[_0xd1c3('0x11')]('%s',_[_0xd1c3('0x84')](_0x3b42ae,_0x2c722e,_[_0xd1c3('0x85')](_0x5378bc,_0x16b9fd)));};exports['extractCalleridName']=function(_0x25872e){var _0x11f751=_0x25872e[_0xd1c3('0x86')](/"(.*?)"/);return _0x11f751?_0x11f751[0x1]:_0x25872e;};exports['extractCalleridNumber']=function(_0x51cd50){var _0x21b619=_0x51cd50['match'](/<(.*?)>/);return _0x21b619?_0x21b619[0x1]:_0x51cd50;}; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 0cf2259..635ce09 100644 --- a/server/services/ami/properties.js +++ b/server/services/ami/properties.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['number','boolean','queuepause','reload','voicequeuechannel','voicequeuechannelhangup','queueadd','string'];(function(_0x2f7e5e,_0x50028b){var _0x3db059=function(_0x10e211){while(--_0x10e211){_0x2f7e5e['push'](_0x2f7e5e['shift']());}};_0x3db059(++_0x50028b);}(_0x7a54,0x106));var _0x47a5=function(_0x6dbb26,_0x5b1081){_0x6dbb26=_0x6dbb26-0x0;var _0x3e98a0=_0x7a54[_0x6dbb26];return _0x3e98a0;};'use strict';exports[_0x47a5('0x0')]={'queue':{'type':_0x47a5('0x1'),'required':!![]},'interface':{'type':_0x47a5('0x1'),'required':!![]},'membername':{'type':'string','required':!![]},'penalty':{'type':_0x47a5('0x2'),'required':![]},'paused':{'type':_0x47a5('0x3'),'required':![]}};exports['queueremove']={'queue':{'type':_0x47a5('0x1'),'required':!![]},'interface':{'type':_0x47a5('0x1'),'required':!![]}};exports[_0x47a5('0x4')]={'interface':{'type':_0x47a5('0x1'),'required':!![]},'paused':{'type':_0x47a5('0x3')},'reason':{'type':'string','required':![]}};exports[_0x47a5('0x5')]={'module':{'type':'string','required':![]}};exports[_0x47a5('0x6')]={'uniqueid':{'type':_0x47a5('0x1'),'required':!![]}};exports['voicechannel']={'uniqueid':{'type':_0x47a5('0x1'),'required':!![]},'filename':{'type':'string'},'format':{'type':'string'},'mixmonitorid':{'type':'string'}};exports[_0x47a5('0x7')]={'uniqueid':{'type':_0x47a5('0x1'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':_0x47a5('0x1'),'required':!![]},'exten':{'type':'string','required':!![]},'context':{'type':'string'}}; \ No newline at end of file +var _0xb10b=['voicequeuechannelhangup','queueadd','string','number','queueremove','queuepause','boolean','reload','voicechannel'];(function(_0x27de44,_0x27864c){var _0x23d632=function(_0x171997){while(--_0x171997){_0x27de44['push'](_0x27de44['shift']());}};_0x23d632(++_0x27864c);}(_0xb10b,0x12a));var _0xbb10=function(_0x49155d,_0x2bb881){_0x49155d=_0x49155d-0x0;var _0x4c5f0f=_0xb10b[_0x49155d];return _0x4c5f0f;};'use strict';exports[_0xbb10('0x0')]={'queue':{'type':'string','required':!![]},'interface':{'type':_0xbb10('0x1'),'required':!![]},'membername':{'type':_0xbb10('0x1'),'required':!![]},'penalty':{'type':_0xbb10('0x2'),'required':![]},'paused':{'type':'boolean','required':![]}};exports[_0xbb10('0x3')]={'queue':{'type':_0xbb10('0x1'),'required':!![]},'interface':{'type':_0xbb10('0x1'),'required':!![]}};exports[_0xbb10('0x4')]={'interface':{'type':_0xbb10('0x1'),'required':!![]},'paused':{'type':_0xbb10('0x5')},'reason':{'type':'string','required':![]}};exports[_0xbb10('0x6')]={'module':{'type':_0xbb10('0x1'),'required':![]}};exports['voicequeuechannel']={'uniqueid':{'type':_0xbb10('0x1'),'required':!![]}};exports[_0xbb10('0x7')]={'uniqueid':{'type':_0xbb10('0x1'),'required':!![]},'filename':{'type':_0xbb10('0x1')},'format':{'type':_0xbb10('0x1')},'mixmonitorid':{'type':_0xbb10('0x1')}};exports[_0xbb10('0x8')]={'uniqueid':{'type':_0xbb10('0x1'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':'string','required':!![]},'exten':{'type':_0xbb10('0x1'),'required':!![]},'context':{'type':_0xbb10('0x1')}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index 2dd216f..b4dc9ac 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 _0xf112=['isUndefined','initTelephones','name','initTrunks','initTriggers','initTemplates','templates','zendeskAccounts','initFreshdeskAccounts','initZohoAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','initDynamics365Accounts','merge','initVoiceQueueReports','queuecallerexit','queuecallerabandon','queuecallerleaveAt','diff','queuecallerjoinAt','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','seconds','queuecallercomplete','initVoiceCallReports','duration','disposition','billableseconds','initCampaigns','initVoiceExtensions','voiceExtensions','initCampaignHopperHistory','initFaxAccounts','exports','bluebird','util','../model/agent','../model/telephone','../model/trunk','../model/voiceQueue','../model/template','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/zohoAccount','../model/vtigerAccount','../model/servicenowAccount','../model/faxAccount','agents','telephones','trunks','voiceQueues','triggers','campaigns','outbound','channels','outboundChannels','timers','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','hasOwnProperty','mapKeys','format','SIP/%s','isNil','interface','total','answered','sumHoldTime','sumDuration','sumBillable','isEmpty','ivrTotalCallsDays','unmanaged','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','mergeFromDatabase','initAgents','length'];(function(_0x2db179,_0x322e47){var _0x3272cd=function(_0x35d24e){while(--_0x35d24e){_0x2db179['push'](_0x2db179['shift']());}};_0x3272cd(++_0x322e47);}(_0xf112,0x1ac));var _0x2f11=function(_0x15876a,_0x15383d){_0x15876a=_0x15876a-0x0;var _0xbd900f=_0xf112[_0x15876a];return _0xbd900f;};'use strict';var BPromise=require(_0x2f11('0x0'));var util=require(_0x2f11('0x1'));var _=require('lodash');var moment=require('moment');var Agent=require(_0x2f11('0x2'));var Telephone=require(_0x2f11('0x3'));var Trunk=require(_0x2f11('0x4'));var VoiceQueue=require(_0x2f11('0x5'));var Trigger=require('../model/trigger');var Template=require(_0x2f11('0x6'));var Campaign=require(_0x2f11('0x7'));var VoiceExtension=require(_0x2f11('0x8'));var ZendeskAccount=require(_0x2f11('0x9'));var SalesforceAccount=require(_0x2f11('0xa'));var FreshdeskAccount=require(_0x2f11('0xb'));var SugarcrmAccount=require('../model/sugarcrmAccount');var ZohoAccount=require(_0x2f11('0xc'));var DeskAccount=require('../model/deskAccount');var VtigerAccount=require(_0x2f11('0xd'));var ServicenowAccount=require(_0x2f11('0xe'));var Dynamics365Account=require('../model/dynamics365Account');var FreshsalesAccount=require('../model/freshsalesAccount');var FaxAccount=require(_0x2f11('0xf'));var Realtime=function(){this[_0x2f11('0x10')]={};this[_0x2f11('0x11')]={};this[_0x2f11('0x12')]={};this[_0x2f11('0x13')]={};this[_0x2f11('0x14')]={};this[_0x2f11('0x15')]={};this['templates']={};this[_0x2f11('0x16')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this[_0x2f11('0x17')]={};this['queueChannels']={};this[_0x2f11('0x18')]={};this[_0x2f11('0x19')]={};this['zendeskAccounts']={};this[_0x2f11('0x1a')]={};this[_0x2f11('0x1b')]={};this[_0x2f11('0x1c')]={};this[_0x2f11('0x1d')]={};this[_0x2f11('0x1e')]={};this[_0x2f11('0x1f')]={};this[_0x2f11('0x20')]={};this[_0x2f11('0x21')]={};this[_0x2f11('0x22')]={};this[_0x2f11('0x23')]={};};function freeIsNotKey(_0x491dea,_0x470c95,_0x3549dc){var _0x3169e9=_['mapKeys'](_0x491dea,function(_0x39ccef,_0x40d6f0){return _0x39ccef[_0x3549dc];});for(var _0x2e8bb7 in _0x470c95){if(_0x470c95[_0x2f11('0x24')](_0x2e8bb7)){if(!_0x3169e9[_0x2e8bb7]){delete _0x470c95[_0x2e8bb7];}}}}function freeIsNotKeySip(_0x1e4f17,_0x5bc359){var _0x279062=_[_0x2f11('0x25')](_0x1e4f17,function(_0x274e53,_0x48d1d2){return util[_0x2f11('0x26')](_0x2f11('0x27'),_0x274e53['name']);});for(var _0x4a761d in _0x5bc359){if(_0x5bc359[_0x2f11('0x24')](_0x4a761d)){if(!_0x279062[_0x4a761d]){delete _0x5bc359[_0x4a761d];}}}}function freeIsNotKeyAgent(_0x2d2466,_0x25b9fc){var _0xe4db95=_['mapKeys'](_0x2d2466,function(_0x3f5073,_0x25a6b0){var _0x5cba58=_[_0x2f11('0x28')](_0x3f5073[_0x2f11('0x29')])?util[_0x2f11('0x26')](_0x2f11('0x27'),_0x3f5073['name']):_0x3f5073[_0x2f11('0x29')];return _0x5cba58;});for(var _0x269746 in _0x25b9fc){if(_0x25b9fc[_0x2f11('0x24')](_0x269746)){if(!_0xe4db95[_0x269746]){delete _0x25b9fc[_0x269746];}}}}function clearVoiceCallReports(_0x118411){_0x118411[_0x2f11('0x2a')]=0x0;_0x118411[_0x2f11('0x2b')]=0x0;_0x118411[_0x2f11('0x2c')]=0x0;_0x118411[_0x2f11('0x2d')]=0x0;_0x118411[_0x2f11('0x2e')]=0x0;}function clearCampaigns(_0x2cfa65){if(!_[_0x2f11('0x2f')](_0x2cfa65)){for(var _0x46b452 in _0x2cfa65){if(_0x2cfa65[_0x2f11('0x24')](_0x46b452)){_0x2cfa65[_0x46b452][_0x2f11('0x30')]=0x0;_0x2cfa65[_0x46b452]['ivrAnswerCallsDay']=0x0;}}}}function clearVoiceQueues(_0x3a5b17){if(!_[_0x2f11('0x2f')](_0x3a5b17)){for(var _0x182aa6 in _0x3a5b17){if(_0x3a5b17[_0x2f11('0x24')](_0x182aa6)){_0x3a5b17[_0x182aa6][_0x2f11('0x2a')]=0x0;_0x3a5b17[_0x182aa6][_0x2f11('0x2b')]=0x0;_0x3a5b17[_0x182aa6][_0x2f11('0x31')]=0x0;_0x3a5b17[_0x182aa6]['abandoned']=0x0;_0x3a5b17[_0x182aa6][_0x2f11('0x2c')]=0x0;_0x3a5b17[_0x182aa6][_0x2f11('0x2d')]=0x0;_0x3a5b17[_0x182aa6][_0x2f11('0x2e')]=0x0;_0x3a5b17[_0x182aa6][_0x2f11('0x32')]=0x0;_0x3a5b17[_0x182aa6][_0x2f11('0x33')]=0x0;_0x3a5b17[_0x182aa6]['outboundBusyCallsDay']=0x0;_0x3a5b17[_0x182aa6]['outboundCongestionCallsDay']=0x0;_0x3a5b17[_0x182aa6]['outboundNoSuchCallsDay']=0x0;_0x3a5b17[_0x182aa6]['outboundUnknownCallsDay']=0x0;_0x3a5b17[_0x182aa6]['outboundDropCallsDayTimeout']=0x0;_0x3a5b17[_0x182aa6][_0x2f11('0x34')]=0x0;_0x3a5b17[_0x182aa6][_0x2f11('0x35')]=0x0;_0x3a5b17[_0x182aa6]['outboundOriginateFailureCallsDay']=0x0;_0x3a5b17[_0x182aa6][_0x2f11('0x36')]=0x0;_0x3a5b17[_0x182aa6][_0x2f11('0x37')]=0x0;_0x3a5b17[_0x182aa6]['outboundAnswerAgiCallsDay']=0x0;_0x3a5b17[_0x182aa6][_0x2f11('0x38')]=0x0;_0x3a5b17[_0x182aa6][_0x2f11('0x39')]=!![];}}}}Realtime[_0x2f11('0x3a')][_0x2f11('0x3b')]=function(_0x574209,_0x2d2710){for(var _0x25cd77 in _0x2d2710){if(_0x574209[_0x2f11('0x24')](_0x25cd77)){_0x574209[_0x25cd77]=_0x2d2710[_0x25cd77];}}};Realtime[_0x2f11('0x3a')][_0x2f11('0x3c')]=function(){var _0x209f90=this;return function(_0x1494af){if(_0x1494af){freeIsNotKeyAgent(_0x1494af,_0x209f90['agents']);for(var _0x19225b=0x0,_0x4c6fb8={},_0x1b0f56={};_0x19225b<_0x1494af[_0x2f11('0x3d')];_0x19225b+=0x1){_0x4c6fb8=_0x1494af[_0x19225b];var _0x559476=_[_0x2f11('0x28')](_0x4c6fb8[_0x2f11('0x29')])?util[_0x2f11('0x26')](_0x2f11('0x27'),_0x4c6fb8['name']):_0x4c6fb8[_0x2f11('0x29')];if(_[_0x2f11('0x3e')](_0x209f90[_0x2f11('0x10')][_0x559476])){_0x209f90['agents'][_0x559476]=new Agent(_0x4c6fb8);}else{_0x209f90[_0x2f11('0x3b')](_0x209f90[_0x2f11('0x10')][_0x559476],_0x4c6fb8);}}}return _0x209f90[_0x2f11('0x10')];};};Realtime[_0x2f11('0x3a')][_0x2f11('0x3f')]=function(){var _0xa9ed37=this;return function(_0x465810){if(_0x465810){freeIsNotKeySip(_0x465810,_0xa9ed37['telephones']);for(var _0x1cef86=0x0,_0x116546={},_0x120702={};_0x1cef86<_0x465810[_0x2f11('0x3d')];_0x1cef86+=0x1){_0x116546=_0x465810[_0x1cef86];if(_[_0x2f11('0x3e')](_0xa9ed37[_0x2f11('0x11')][util[_0x2f11('0x26')](_0x2f11('0x27'),_0x116546[_0x2f11('0x40')])])){_0xa9ed37[_0x2f11('0x11')][util[_0x2f11('0x26')](_0x2f11('0x27'),_0x116546['name'])]=new Telephone(_0x116546);}else{_0xa9ed37[_0x2f11('0x3b')](_0xa9ed37[_0x2f11('0x11')][util[_0x2f11('0x26')](_0x2f11('0x27'),_0x116546[_0x2f11('0x40')])],_0x116546);}}}return _0xa9ed37[_0x2f11('0x11')];};};Realtime[_0x2f11('0x3a')][_0x2f11('0x41')]=function(){var _0x2e09c3=this;return function(_0x52c4cd){if(_0x52c4cd){freeIsNotKeySip(_0x52c4cd,_0x2e09c3[_0x2f11('0x12')]);for(var _0x136ede=0x0,_0x208eec={},_0x113c2c={};_0x136ede<_0x52c4cd[_0x2f11('0x3d')];_0x136ede+=0x1){_0x208eec=_0x52c4cd[_0x136ede];if(_[_0x2f11('0x3e')](_0x2e09c3[_0x2f11('0x12')][util[_0x2f11('0x26')](_0x2f11('0x27'),_0x208eec[_0x2f11('0x40')])])){_0x2e09c3['trunks'][util[_0x2f11('0x26')](_0x2f11('0x27'),_0x208eec[_0x2f11('0x40')])]=new Trunk(_0x208eec);}else{_0x2e09c3[_0x2f11('0x3b')](_0x2e09c3[_0x2f11('0x12')][util[_0x2f11('0x26')]('SIP/%s',_0x208eec[_0x2f11('0x40')])],_0x208eec);}}}return _0x2e09c3[_0x2f11('0x12')];};};Realtime[_0x2f11('0x3a')]['initVoiceQueues']=function(){var _0x824436=this;return function(_0x39c616){if(_0x39c616){freeIsNotKey(_0x39c616,_0x824436[_0x2f11('0x13')],_0x2f11('0x40'));for(var _0x40875a=0x0,_0x5c2b79={},_0x3ae1b9={};_0x40875a<_0x39c616[_0x2f11('0x3d')];_0x40875a+=0x1){_0x5c2b79=_0x39c616[_0x40875a];if(_[_0x2f11('0x3e')](_0x824436['voiceQueues'][_0x5c2b79[_0x2f11('0x40')]])){_0x824436[_0x2f11('0x13')][_0x5c2b79[_0x2f11('0x40')]]=new VoiceQueue(_0x5c2b79);}else{_0x824436[_0x2f11('0x3b')](_0x824436[_0x2f11('0x13')][_0x5c2b79[_0x2f11('0x40')]],_0x5c2b79);}}}return _0x824436[_0x2f11('0x13')];};};Realtime[_0x2f11('0x3a')][_0x2f11('0x42')]=function(){var _0x2db3ec=this;return function(_0x3089d6){if(_0x3089d6){freeIsNotKey(_0x3089d6,_0x2db3ec[_0x2f11('0x14')],'id');for(var _0x46554d=0x0,_0x30451d={},_0x5a680b={};_0x46554d<_0x3089d6['length'];_0x46554d+=0x1){_0x30451d=_0x3089d6[_0x46554d];if(_['isUndefined'](_0x2db3ec['triggers'][_0x30451d['id']])){_0x2db3ec[_0x2f11('0x14')][_0x30451d['id']]=new Trigger(_0x30451d);}else{_0x2db3ec['mergeFromDatabase'](_0x2db3ec[_0x2f11('0x14')][_0x30451d['id']],_0x30451d);}}}return _0x2db3ec[_0x2f11('0x14')];};};Realtime[_0x2f11('0x3a')][_0x2f11('0x43')]=function(){var _0x2508b6=this;return function(_0x17813f){if(_0x17813f){freeIsNotKey(_0x17813f,_0x2508b6[_0x2f11('0x44')],'id');for(var _0x3bdfe6=0x0,_0x28f374={},_0xcf9494={};_0x3bdfe6<_0x17813f[_0x2f11('0x3d')];_0x3bdfe6+=0x1){_0x28f374=_0x17813f[_0x3bdfe6];if(_[_0x2f11('0x3e')](_0x2508b6[_0x2f11('0x44')][_0x28f374['id']])){_0x2508b6[_0x2f11('0x44')][_0x28f374['id']]=new Template(_0x28f374);}else{_0x2508b6['mergeFromDatabase'](_0x2508b6[_0x2f11('0x44')][_0x28f374['id']],_0x28f374);}}}return _0x2508b6[_0x2f11('0x44')];};};Realtime['prototype']['initZendeskAccounts']=function(){var _0x27da48=this;return function(_0x300f23){if(_0x300f23){freeIsNotKey(_0x300f23,_0x27da48[_0x2f11('0x45')],'id');for(var _0xd4bc35=0x0,_0xf749ef={},_0x5c7529={};_0xd4bc35<_0x300f23[_0x2f11('0x3d')];_0xd4bc35+=0x1){_0xf749ef=_0x300f23[_0xd4bc35];if(_[_0x2f11('0x3e')](_0x27da48[_0x2f11('0x45')][_0xf749ef['id']])){_0x27da48[_0x2f11('0x45')][_0xf749ef['id']]=new ZendeskAccount(_0xf749ef);}else{_0x27da48[_0x2f11('0x3b')](_0x27da48['zendeskAccounts'][_0xf749ef['id']],_0xf749ef);}}}return _0x27da48[_0x2f11('0x45')];};};Realtime[_0x2f11('0x3a')]['initSalesforceAccounts']=function(){var _0x25f78d=this;return function(_0x12000e){if(_0x12000e){freeIsNotKey(_0x12000e,_0x25f78d[_0x2f11('0x1a')],'id');for(var _0x1a4a08=0x0,_0x4f82e5={},_0x35e0ff={};_0x1a4a08<_0x12000e['length'];_0x1a4a08+=0x1){_0x4f82e5=_0x12000e[_0x1a4a08];if(_[_0x2f11('0x3e')](_0x25f78d['salesforceAccounts'][_0x4f82e5['id']])){_0x25f78d[_0x2f11('0x1a')][_0x4f82e5['id']]=new SalesforceAccount(_0x4f82e5);}else{_0x25f78d[_0x2f11('0x3b')](_0x25f78d[_0x2f11('0x1a')][_0x4f82e5['id']],_0x4f82e5);}}}return _0x25f78d[_0x2f11('0x1a')];};};Realtime[_0x2f11('0x3a')][_0x2f11('0x46')]=function(){var _0x23c343=this;return function(_0x493435){if(_0x493435){freeIsNotKey(_0x493435,_0x23c343[_0x2f11('0x1c')],'id');for(var _0x43a687=0x0,_0x5f56bb={},_0x57293c={};_0x43a687<_0x493435[_0x2f11('0x3d')];_0x43a687+=0x1){_0x5f56bb=_0x493435[_0x43a687];if(_[_0x2f11('0x3e')](_0x23c343['freshdeskAccounts'][_0x5f56bb['id']])){_0x23c343[_0x2f11('0x1c')][_0x5f56bb['id']]=new FreshdeskAccount(_0x5f56bb);}else{_0x23c343['mergeFromDatabase'](_0x23c343[_0x2f11('0x1c')][_0x5f56bb['id']],_0x5f56bb);}}}return _0x23c343['freshdeskAccounts'];};};Realtime[_0x2f11('0x3a')][_0x2f11('0x47')]=function(){var _0x1d027f=this;return function(_0x1aa0d8){if(_0x1aa0d8){freeIsNotKey(_0x1aa0d8,_0x1d027f[_0x2f11('0x1d')],'id');for(var _0x16257f=0x0,_0x524184={},_0xa924ca={};_0x16257f<_0x1aa0d8[_0x2f11('0x3d')];_0x16257f+=0x1){_0x524184=_0x1aa0d8[_0x16257f];if(_[_0x2f11('0x3e')](_0x1d027f['zohoAccounts'][_0x524184['id']])){_0x1d027f['zohoAccounts'][_0x524184['id']]=new ZohoAccount(_0x524184);}else{_0x1d027f['mergeFromDatabase'](_0x1d027f[_0x2f11('0x1d')][_0x524184['id']],_0x524184);}}}return _0x1d027f[_0x2f11('0x1d')];};};Realtime[_0x2f11('0x3a')][_0x2f11('0x48')]=function(){var _0x147b0f=this;return function(_0x5a20c8){if(_0x5a20c8){freeIsNotKey(_0x5a20c8,_0x147b0f['deskAccounts'],'id');for(var _0x4ce4b9=0x0,_0x15db8d={},_0x2d2240={};_0x4ce4b9<_0x5a20c8['length'];_0x4ce4b9+=0x1){_0x15db8d=_0x5a20c8[_0x4ce4b9];if(_['isUndefined'](_0x147b0f[_0x2f11('0x1e')][_0x15db8d['id']])){_0x147b0f[_0x2f11('0x1e')][_0x15db8d['id']]=new DeskAccount(_0x15db8d);}else{_0x147b0f[_0x2f11('0x3b')](_0x147b0f['deskAccounts'][_0x15db8d['id']],_0x15db8d);}}}return _0x147b0f['deskAccounts'];};};Realtime[_0x2f11('0x3a')][_0x2f11('0x49')]=function(){var _0x5d645d=this;return function(_0x1d6fdd){if(_0x1d6fdd){freeIsNotKey(_0x1d6fdd,_0x5d645d[_0x2f11('0x1b')],'id');for(var _0x29b978=0x0,_0x4fb660={},_0x1c30b1={};_0x29b978<_0x1d6fdd[_0x2f11('0x3d')];_0x29b978+=0x1){_0x4fb660=_0x1d6fdd[_0x29b978];if(_[_0x2f11('0x3e')](_0x5d645d[_0x2f11('0x1b')][_0x4fb660['id']])){_0x5d645d[_0x2f11('0x1b')][_0x4fb660['id']]=new SugarcrmAccount(_0x4fb660);}else{_0x5d645d['mergeFromDatabase'](_0x5d645d['sugarcrmAccounts'][_0x4fb660['id']],_0x4fb660);}}}return _0x5d645d['sugarcrmAccounts'];};};Realtime[_0x2f11('0x3a')][_0x2f11('0x4a')]=function(){var _0x9f7dfc=this;return function(_0x4c68b2){if(_0x4c68b2){freeIsNotKey(_0x4c68b2,_0x9f7dfc[_0x2f11('0x1f')],'id');for(var _0x2f3e42=0x0,_0x3c909b={},_0x9277dc={};_0x2f3e42<_0x4c68b2[_0x2f11('0x3d')];_0x2f3e42+=0x1){_0x3c909b=_0x4c68b2[_0x2f3e42];if(_[_0x2f11('0x3e')](_0x9f7dfc[_0x2f11('0x1f')][_0x3c909b['id']])){_0x9f7dfc[_0x2f11('0x1f')][_0x3c909b['id']]=new VtigerAccount(_0x3c909b);}else{_0x9f7dfc['mergeFromDatabase'](_0x9f7dfc[_0x2f11('0x1f')][_0x3c909b['id']],_0x3c909b);}}}return _0x9f7dfc[_0x2f11('0x1f')];};};Realtime['prototype']['initServicenowAccounts']=function(){var _0x12db7b=this;return function(_0x3532bb){if(_0x3532bb){freeIsNotKey(_0x3532bb,_0x12db7b[_0x2f11('0x20')],'id');for(var _0x28cbc2=0x0,_0x2d0657={},_0x1e9e25={};_0x28cbc2<_0x3532bb[_0x2f11('0x3d')];_0x28cbc2+=0x1){_0x2d0657=_0x3532bb[_0x28cbc2];if(_[_0x2f11('0x3e')](_0x12db7b[_0x2f11('0x20')][_0x2d0657['id']])){_0x12db7b[_0x2f11('0x20')][_0x2d0657['id']]=new ServicenowAccount(_0x2d0657);}else{_0x12db7b[_0x2f11('0x3b')](_0x12db7b[_0x2f11('0x20')][_0x2d0657['id']],_0x2d0657);}}}return _0x12db7b[_0x2f11('0x20')];};};Realtime[_0x2f11('0x3a')][_0x2f11('0x4b')]=function(){var _0x483959=this;return function(_0x20cfde){if(_0x20cfde){freeIsNotKey(_0x20cfde,_0x483959['dynamics365Accounts'],'id');for(var _0x59522d=0x0,_0xc17c23={},_0x47a427={};_0x59522d<_0x20cfde['length'];_0x59522d+=0x1){_0xc17c23=_0x20cfde[_0x59522d];if(_[_0x2f11('0x3e')](_0x483959[_0x2f11('0x21')][_0xc17c23['id']])){_0x483959[_0x2f11('0x21')][_0xc17c23['id']]=new Dynamics365Account(_0xc17c23);}else{_0x483959['mergeFromDatabase'](_0x483959[_0x2f11('0x21')][_0xc17c23['id']],_0xc17c23);}}}return _0x483959[_0x2f11('0x21')];};};Realtime[_0x2f11('0x3a')]['initFreshsalesAccounts']=function(){var _0x2356a2=this;return function(_0x1292be){if(_0x1292be){freeIsNotKey(_0x1292be,_0x2356a2['freshsalesAccounts'],'id');for(var _0x2b9afa=0x0,_0x159813={},_0x3bfd2e={};_0x2b9afa<_0x1292be[_0x2f11('0x3d')];_0x2b9afa+=0x1){_0x159813=_0x1292be[_0x2b9afa];if(_[_0x2f11('0x3e')](_0x2356a2[_0x2f11('0x22')][_0x159813['id']])){_0x2356a2[_0x2f11('0x22')][_0x159813['id']]=new FreshsalesAccount(_0x159813);}else{_0x2356a2['mergeFromDatabase'](_0x2356a2['freshsalesAccounts'][_0x159813['id']],_0x159813);}}}return _0x2356a2[_0x2f11('0x22')];};};Realtime['prototype']['initVoiceQueueHopperHistory']=function(){var _0x1d7229=this;return function(_0x508569){for(var _0x4b8cbb=0x0;_0x4b8cbb<_0x508569[_0x2f11('0x3d')];_0x4b8cbb+=0x1){_[_0x2f11('0x4c')](_0x1d7229[_0x2f11('0x13')][_0x508569[_0x4b8cbb][_0x2f11('0x40')]],_0x508569[_0x4b8cbb]);}return _0x1d7229[_0x2f11('0x13')];};};Realtime[_0x2f11('0x3a')][_0x2f11('0x4d')]=function(){var _0x5bce5b=this;return function(_0x4aa94d){clearVoiceQueues(_0x5bce5b['voiceQueues']);if(_0x4aa94d){_0x4aa94d=_['groupBy'](_0x4aa94d,'uniqueid');for(var _0x2ee93d in _0x4aa94d){if(_0x4aa94d[_0x2f11('0x24')](_0x2ee93d)){var _0x41595d={};for(var _0x551fc5=0x0;_0x551fc5<_0x4aa94d[_0x2ee93d]['length'];_0x551fc5+=0x1){var _0x19e035=_0x4aa94d[_0x2ee93d][_0x551fc5]['queue'];if(_0x5bce5b['voiceQueues'][_0x19e035]){if(_0x4aa94d[_0x2ee93d][_0x551fc5][_0x2f11('0x4e')]){_0x5bce5b['voiceQueues'][_0x19e035][_0x2f11('0x31')]+=0x1;}if(_0x4aa94d[_0x2ee93d][_0x551fc5][_0x2f11('0x4f')]){_0x5bce5b[_0x2f11('0x13')][_0x19e035]['abandoned']+=0x1;}_0x5bce5b[_0x2f11('0x13')][_0x19e035][_0x2f11('0x2c')]+=moment(_0x4aa94d[_0x2ee93d][_0x551fc5][_0x2f11('0x50')])[_0x2f11('0x51')](moment(_0x4aa94d[_0x2ee93d][_0x551fc5][_0x2f11('0x52')]),'seconds')||0x0;if(_0x551fc5===_0x4aa94d[_0x2ee93d][_0x2f11('0x3d')]-0x1){_0x5bce5b[_0x2f11('0x13')][_0x19e035][_0x2f11('0x2d')]+=moment(_0x4aa94d[_0x2ee93d][_0x551fc5][_0x2f11('0x53')]||_0x4aa94d[_0x2ee93d][_0x551fc5][_0x2f11('0x54')]||_0x4aa94d[_0x2ee93d][_0x551fc5][_0x2f11('0x55')])[_0x2f11('0x51')](moment(_0x4aa94d[_0x2ee93d][_0x551fc5]['queuecallerjoinAt']),_0x2f11('0x56'))||0x0;_0x5bce5b[_0x2f11('0x13')][_0x19e035][_0x2f11('0x2a')]+=0x1;if(_0x4aa94d[_0x2ee93d][_0x551fc5][_0x2f11('0x57')]){_0x5bce5b[_0x2f11('0x13')][_0x19e035]['answered']+=0x1;_0x5bce5b[_0x2f11('0x13')][_0x19e035][_0x2f11('0x2e')]+=moment(_0x4aa94d[_0x2ee93d][_0x551fc5][_0x2f11('0x53')])[_0x2f11('0x51')](moment(_0x4aa94d[_0x2ee93d][_0x551fc5][_0x2f11('0x50')]),_0x2f11('0x56'))||0x0;}}else{_0x5bce5b['voiceQueues'][_0x19e035]['sumDuration']+=_0x5bce5b[_0x2f11('0x13')][_0x19e035]['sumHoldTime']||0x0;}}}}}}return _0x5bce5b['voiceQueues'];};};Realtime[_0x2f11('0x3a')][_0x2f11('0x58')]=function(){var _0x23562f=this;return function(_0x345ea8){clearVoiceCallReports(_0x23562f[_0x2f11('0x16')]);if(_0x345ea8){for(var _0x305b27=0x0;_0x305b27<_0x345ea8['length'];_0x305b27+=0x1){_0x23562f[_0x2f11('0x16')]['total']+=0x1;_0x23562f['outbound'][_0x2f11('0x2d')]+=_0x345ea8[_0x305b27][_0x2f11('0x59')];if(_0x345ea8[_0x305b27][_0x2f11('0x5a')]==='ANSWERED'){_0x23562f['outbound'][_0x2f11('0x2b')]+=0x1;_0x23562f[_0x2f11('0x16')]['sumHoldTime']+=_0x345ea8[_0x305b27][_0x2f11('0x59')]-_0x345ea8[_0x305b27][_0x2f11('0x5b')]||0x0;_0x23562f[_0x2f11('0x16')]['sumBillable']+=_0x345ea8[_0x305b27][_0x2f11('0x5b')];}}}return _0x23562f[_0x2f11('0x16')];};};Realtime[_0x2f11('0x3a')][_0x2f11('0x5c')]=function(){var _0x38dc1f=this;return function(_0x5ee1c7){if(_0x5ee1c7){freeIsNotKey(_0x5ee1c7,_0x38dc1f['campaigns'],_0x2f11('0x40'));for(var _0x1b32b0=0x0,_0x453900={};_0x1b32b0<_0x5ee1c7[_0x2f11('0x3d')];_0x1b32b0+=0x1){_0x453900=_0x5ee1c7[_0x1b32b0];if(_['isUndefined'](_0x38dc1f['campaigns'][_0x453900[_0x2f11('0x40')]])){_0x38dc1f['campaigns'][_0x453900[_0x2f11('0x40')]]=new Campaign(_0x453900);}else{_0x38dc1f[_0x2f11('0x3b')](_0x38dc1f['campaigns'][_0x453900['name']],_0x453900);}}}return _0x38dc1f[_0x2f11('0x15')];};};Realtime[_0x2f11('0x3a')][_0x2f11('0x5d')]=function(){var _0x3389=this;return function(_0x191f30){if(_0x191f30){freeIsNotKey(_0x191f30,_0x3389['voiceExtensions'],'id');for(var _0x48b2a8=0x0,_0x588522={};_0x48b2a8<_0x191f30[_0x2f11('0x3d')];_0x48b2a8+=0x1){_0x588522=_0x191f30[_0x48b2a8];if(_[_0x2f11('0x3e')](_0x3389[_0x2f11('0x5e')][_0x588522['id']])){_0x3389[_0x2f11('0x5e')][_0x588522['id']]=new VoiceExtension(_0x588522);}else{_0x3389[_0x2f11('0x3b')](_0x3389[_0x2f11('0x5e')][_0x588522['id']],_0x588522);}}}return _0x3389[_0x2f11('0x5e')];};};Realtime['prototype'][_0x2f11('0x5f')]=function(){var _0x594f11=this;return function(_0x848982){clearCampaigns(_0x594f11[_0x2f11('0x15')]);for(var _0x117db2=0x0;_0x117db2<_0x848982[_0x2f11('0x3d')];_0x117db2+=0x1){_['merge'](_0x594f11[_0x2f11('0x15')][_0x848982[_0x117db2]['name']],_0x848982[_0x117db2]);}return _0x594f11['campaigns'];};};Realtime['prototype'][_0x2f11('0x60')]=function(){var _0x30704e=this;return function(_0x305ddb){if(_0x305ddb){freeIsNotKey(_0x305ddb,_0x30704e[_0x2f11('0x23')],'id');for(var _0x5449f5=0x0,_0x15cdbc={},_0x266adf={};_0x5449f5<_0x305ddb[_0x2f11('0x3d')];_0x5449f5+=0x1){_0x15cdbc=_0x305ddb[_0x5449f5];if(_[_0x2f11('0x3e')](_0x30704e['faxAccounts'][_0x15cdbc['id']])){_0x30704e[_0x2f11('0x23')][_0x15cdbc['id']]=new FaxAccount(_0x15cdbc);}else{_0x30704e['mergeFromDatabase'](_0x30704e[_0x2f11('0x23')][_0x15cdbc['id']],_0x15cdbc);}}}return _0x30704e[_0x2f11('0x23')];};};module[_0x2f11('0x61')]=Realtime; \ No newline at end of file +var _0xff46=['initTelephones','initTrunks','triggers','initTemplates','initZendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','initZohoAccounts','zohoAccounts','initVtigerAccounts','vtigerAccounts','initServicenowAccounts','servicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','initVoiceQueueReports','groupBy','uniqueid','queue','queuecallerexit','queuecallerabandon','abandoned','queuecallerjoinAt','seconds','queuecallerabandonAt','diff','queuecallercompleteAt','queuecallerleaveAt','initVoiceCallReports','outbound','duration','billableseconds','initCampaigns','voiceExtensions','initCampaignHopperHistory','merge','initFaxAccounts','exports','bluebird','util','lodash','../model/agent','../model/telephone','../model/trunk','../model/template','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','telephones','trunks','voiceQueues','campaigns','templates','channels','queueChannels','outboundChannels','zendeskAccounts','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','deskAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','hasOwnProperty','format','SIP/%s','name','isNil','interface','total','answered','sumHoldTime','sumDuration','sumBillable','isEmpty','ivrAnswerCallsDay','unmanaged','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','mergeFromDatabase','agents','length','isUndefined'];(function(_0x1996c0,_0x591f79){var _0x75d80c=function(_0x574ff6){while(--_0x574ff6){_0x1996c0['push'](_0x1996c0['shift']());}};_0x75d80c(++_0x591f79);}(_0xff46,0x8f));var _0x6ff4=function(_0x56880d,_0x315eb5){_0x56880d=_0x56880d-0x0;var _0x3ebe18=_0xff46[_0x56880d];return _0x3ebe18;};'use strict';var BPromise=require(_0x6ff4('0x0'));var util=require(_0x6ff4('0x1'));var _=require(_0x6ff4('0x2'));var moment=require('moment');var Agent=require(_0x6ff4('0x3'));var Telephone=require(_0x6ff4('0x4'));var Trunk=require(_0x6ff4('0x5'));var VoiceQueue=require('../model/voiceQueue');var Trigger=require('../model/trigger');var Template=require(_0x6ff4('0x6'));var Campaign=require(_0x6ff4('0x7'));var VoiceExtension=require(_0x6ff4('0x8'));var ZendeskAccount=require(_0x6ff4('0x9'));var SalesforceAccount=require(_0x6ff4('0xa'));var FreshdeskAccount=require(_0x6ff4('0xb'));var SugarcrmAccount=require(_0x6ff4('0xc'));var ZohoAccount=require(_0x6ff4('0xd'));var DeskAccount=require('../model/deskAccount');var VtigerAccount=require('../model/vtigerAccount');var ServicenowAccount=require(_0x6ff4('0xe'));var Dynamics365Account=require(_0x6ff4('0xf'));var FreshsalesAccount=require(_0x6ff4('0x10'));var FaxAccount=require('../model/faxAccount');var Realtime=function(){this['agents']={};this[_0x6ff4('0x11')]={};this[_0x6ff4('0x12')]={};this[_0x6ff4('0x13')]={};this['triggers']={};this[_0x6ff4('0x14')]={};this[_0x6ff4('0x15')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this[_0x6ff4('0x16')]={};this[_0x6ff4('0x17')]={};this[_0x6ff4('0x18')]={};this['timers']={};this[_0x6ff4('0x19')]={};this[_0x6ff4('0x1a')]={};this[_0x6ff4('0x1b')]={};this[_0x6ff4('0x1c')]={};this['zohoAccounts']={};this[_0x6ff4('0x1d')]={};this['vtigerAccounts']={};this['servicenowAccounts']={};this[_0x6ff4('0x1e')]={};this[_0x6ff4('0x1f')]={};this[_0x6ff4('0x20')]={};};function freeIsNotKey(_0x132551,_0x3f363d,_0x481d20){var _0x537ea1=_[_0x6ff4('0x21')](_0x132551,function(_0x37e783,_0x417f08){return _0x37e783[_0x481d20];});for(var _0x41e789 in _0x3f363d){if(_0x3f363d[_0x6ff4('0x22')](_0x41e789)){if(!_0x537ea1[_0x41e789]){delete _0x3f363d[_0x41e789];}}}}function freeIsNotKeySip(_0x55ddfc,_0x4177ff){var _0x1e64ac=_[_0x6ff4('0x21')](_0x55ddfc,function(_0x37b964,_0x19f869){return util[_0x6ff4('0x23')](_0x6ff4('0x24'),_0x37b964[_0x6ff4('0x25')]);});for(var _0x19acd6 in _0x4177ff){if(_0x4177ff[_0x6ff4('0x22')](_0x19acd6)){if(!_0x1e64ac[_0x19acd6]){delete _0x4177ff[_0x19acd6];}}}}function freeIsNotKeyAgent(_0x5bafff,_0x497c36){var _0x460ac7=_[_0x6ff4('0x21')](_0x5bafff,function(_0xdbf6dd,_0x3c6688){var _0x5c9f3a=_[_0x6ff4('0x26')](_0xdbf6dd[_0x6ff4('0x27')])?util['format'](_0x6ff4('0x24'),_0xdbf6dd[_0x6ff4('0x25')]):_0xdbf6dd[_0x6ff4('0x27')];return _0x5c9f3a;});for(var _0x30590b in _0x497c36){if(_0x497c36['hasOwnProperty'](_0x30590b)){if(!_0x460ac7[_0x30590b]){delete _0x497c36[_0x30590b];}}}}function clearVoiceCallReports(_0x311027){_0x311027[_0x6ff4('0x28')]=0x0;_0x311027[_0x6ff4('0x29')]=0x0;_0x311027[_0x6ff4('0x2a')]=0x0;_0x311027[_0x6ff4('0x2b')]=0x0;_0x311027[_0x6ff4('0x2c')]=0x0;}function clearCampaigns(_0x462f6e){if(!_[_0x6ff4('0x2d')](_0x462f6e)){for(var _0x3b4e51 in _0x462f6e){if(_0x462f6e[_0x6ff4('0x22')](_0x3b4e51)){_0x462f6e[_0x3b4e51]['ivrTotalCallsDays']=0x0;_0x462f6e[_0x3b4e51][_0x6ff4('0x2e')]=0x0;}}}}function clearVoiceQueues(_0x1051ea){if(!_['isEmpty'](_0x1051ea)){for(var _0x29b2a2 in _0x1051ea){if(_0x1051ea[_0x6ff4('0x22')](_0x29b2a2)){_0x1051ea[_0x29b2a2][_0x6ff4('0x28')]=0x0;_0x1051ea[_0x29b2a2][_0x6ff4('0x29')]=0x0;_0x1051ea[_0x29b2a2][_0x6ff4('0x2f')]=0x0;_0x1051ea[_0x29b2a2]['abandoned']=0x0;_0x1051ea[_0x29b2a2]['sumHoldTime']=0x0;_0x1051ea[_0x29b2a2][_0x6ff4('0x2b')]=0x0;_0x1051ea[_0x29b2a2][_0x6ff4('0x2c')]=0x0;_0x1051ea[_0x29b2a2][_0x6ff4('0x30')]=0x0;_0x1051ea[_0x29b2a2][_0x6ff4('0x31')]=0x0;_0x1051ea[_0x29b2a2]['outboundBusyCallsDay']=0x0;_0x1051ea[_0x29b2a2][_0x6ff4('0x32')]=0x0;_0x1051ea[_0x29b2a2][_0x6ff4('0x33')]=0x0;_0x1051ea[_0x29b2a2][_0x6ff4('0x34')]=0x0;_0x1051ea[_0x29b2a2][_0x6ff4('0x35')]=0x0;_0x1051ea[_0x29b2a2][_0x6ff4('0x36')]=0x0;_0x1051ea[_0x29b2a2][_0x6ff4('0x37')]=0x0;_0x1051ea[_0x29b2a2][_0x6ff4('0x38')]=0x0;_0x1051ea[_0x29b2a2][_0x6ff4('0x39')]=0x0;_0x1051ea[_0x29b2a2]['outboundReCallsDay']=0x0;_0x1051ea[_0x29b2a2][_0x6ff4('0x30')]=0x0;_0x1051ea[_0x29b2a2][_0x6ff4('0x3a')]=0x0;_0x1051ea[_0x29b2a2][_0x6ff4('0x3b')]=!![];}}}}Realtime[_0x6ff4('0x3c')][_0x6ff4('0x3d')]=function(_0x382fc1,_0x3e8533){for(var _0x189cb0 in _0x3e8533){if(_0x382fc1['hasOwnProperty'](_0x189cb0)){_0x382fc1[_0x189cb0]=_0x3e8533[_0x189cb0];}}};Realtime[_0x6ff4('0x3c')]['initAgents']=function(){var _0x7a4356=this;return function(_0x42e13a){if(_0x42e13a){freeIsNotKeyAgent(_0x42e13a,_0x7a4356[_0x6ff4('0x3e')]);for(var _0x1cac14=0x0,_0x1c0e0b={},_0x16eb7d={};_0x1cac14<_0x42e13a[_0x6ff4('0x3f')];_0x1cac14+=0x1){_0x1c0e0b=_0x42e13a[_0x1cac14];var _0x31e946=_[_0x6ff4('0x26')](_0x1c0e0b[_0x6ff4('0x27')])?util[_0x6ff4('0x23')](_0x6ff4('0x24'),_0x1c0e0b[_0x6ff4('0x25')]):_0x1c0e0b['interface'];if(_[_0x6ff4('0x40')](_0x7a4356[_0x6ff4('0x3e')][_0x31e946])){_0x7a4356[_0x6ff4('0x3e')][_0x31e946]=new Agent(_0x1c0e0b);}else{_0x7a4356[_0x6ff4('0x3d')](_0x7a4356[_0x6ff4('0x3e')][_0x31e946],_0x1c0e0b);}}}return _0x7a4356[_0x6ff4('0x3e')];};};Realtime['prototype'][_0x6ff4('0x41')]=function(){var _0x2fca92=this;return function(_0x3027dd){if(_0x3027dd){freeIsNotKeySip(_0x3027dd,_0x2fca92['telephones']);for(var _0x41e8a8=0x0,_0x486251={},_0x65298a={};_0x41e8a8<_0x3027dd[_0x6ff4('0x3f')];_0x41e8a8+=0x1){_0x486251=_0x3027dd[_0x41e8a8];if(_['isUndefined'](_0x2fca92[_0x6ff4('0x11')][util[_0x6ff4('0x23')](_0x6ff4('0x24'),_0x486251[_0x6ff4('0x25')])])){_0x2fca92['telephones'][util[_0x6ff4('0x23')](_0x6ff4('0x24'),_0x486251[_0x6ff4('0x25')])]=new Telephone(_0x486251);}else{_0x2fca92[_0x6ff4('0x3d')](_0x2fca92['telephones'][util[_0x6ff4('0x23')](_0x6ff4('0x24'),_0x486251[_0x6ff4('0x25')])],_0x486251);}}}return _0x2fca92[_0x6ff4('0x11')];};};Realtime[_0x6ff4('0x3c')][_0x6ff4('0x42')]=function(){var _0x12ac81=this;return function(_0x199df0){if(_0x199df0){freeIsNotKeySip(_0x199df0,_0x12ac81['trunks']);for(var _0x509e8f=0x0,_0x51dbb1={},_0x1c220c={};_0x509e8f<_0x199df0[_0x6ff4('0x3f')];_0x509e8f+=0x1){_0x51dbb1=_0x199df0[_0x509e8f];if(_['isUndefined'](_0x12ac81[_0x6ff4('0x12')][util[_0x6ff4('0x23')](_0x6ff4('0x24'),_0x51dbb1[_0x6ff4('0x25')])])){_0x12ac81['trunks'][util[_0x6ff4('0x23')](_0x6ff4('0x24'),_0x51dbb1[_0x6ff4('0x25')])]=new Trunk(_0x51dbb1);}else{_0x12ac81['mergeFromDatabase'](_0x12ac81[_0x6ff4('0x12')][util['format'](_0x6ff4('0x24'),_0x51dbb1['name'])],_0x51dbb1);}}}return _0x12ac81[_0x6ff4('0x12')];};};Realtime[_0x6ff4('0x3c')]['initVoiceQueues']=function(){var _0x375d5d=this;return function(_0x34e0b3){if(_0x34e0b3){freeIsNotKey(_0x34e0b3,_0x375d5d[_0x6ff4('0x13')],'name');for(var _0x15c7b5=0x0,_0x37e11a={},_0x18e691={};_0x15c7b5<_0x34e0b3[_0x6ff4('0x3f')];_0x15c7b5+=0x1){_0x37e11a=_0x34e0b3[_0x15c7b5];if(_[_0x6ff4('0x40')](_0x375d5d[_0x6ff4('0x13')][_0x37e11a['name']])){_0x375d5d[_0x6ff4('0x13')][_0x37e11a['name']]=new VoiceQueue(_0x37e11a);}else{_0x375d5d[_0x6ff4('0x3d')](_0x375d5d[_0x6ff4('0x13')][_0x37e11a[_0x6ff4('0x25')]],_0x37e11a);}}}return _0x375d5d[_0x6ff4('0x13')];};};Realtime[_0x6ff4('0x3c')]['initTriggers']=function(){var _0x1c94bf=this;return function(_0x4be10a){if(_0x4be10a){freeIsNotKey(_0x4be10a,_0x1c94bf[_0x6ff4('0x43')],'id');for(var _0x1ed01d=0x0,_0x3bfbf9={},_0x4bd107={};_0x1ed01d<_0x4be10a[_0x6ff4('0x3f')];_0x1ed01d+=0x1){_0x3bfbf9=_0x4be10a[_0x1ed01d];if(_[_0x6ff4('0x40')](_0x1c94bf['triggers'][_0x3bfbf9['id']])){_0x1c94bf['triggers'][_0x3bfbf9['id']]=new Trigger(_0x3bfbf9);}else{_0x1c94bf[_0x6ff4('0x3d')](_0x1c94bf[_0x6ff4('0x43')][_0x3bfbf9['id']],_0x3bfbf9);}}}return _0x1c94bf['triggers'];};};Realtime['prototype'][_0x6ff4('0x44')]=function(){var _0x3a9819=this;return function(_0xc6001e){if(_0xc6001e){freeIsNotKey(_0xc6001e,_0x3a9819['templates'],'id');for(var _0x181a86=0x0,_0x3bb496={},_0x5e91e5={};_0x181a86<_0xc6001e[_0x6ff4('0x3f')];_0x181a86+=0x1){_0x3bb496=_0xc6001e[_0x181a86];if(_[_0x6ff4('0x40')](_0x3a9819[_0x6ff4('0x15')][_0x3bb496['id']])){_0x3a9819[_0x6ff4('0x15')][_0x3bb496['id']]=new Template(_0x3bb496);}else{_0x3a9819[_0x6ff4('0x3d')](_0x3a9819[_0x6ff4('0x15')][_0x3bb496['id']],_0x3bb496);}}}return _0x3a9819[_0x6ff4('0x15')];};};Realtime['prototype'][_0x6ff4('0x45')]=function(){var _0x3af7b0=this;return function(_0x370fc2){if(_0x370fc2){freeIsNotKey(_0x370fc2,_0x3af7b0[_0x6ff4('0x19')],'id');for(var _0x3604e3=0x0,_0x16631d={},_0x50e54a={};_0x3604e3<_0x370fc2[_0x6ff4('0x3f')];_0x3604e3+=0x1){_0x16631d=_0x370fc2[_0x3604e3];if(_[_0x6ff4('0x40')](_0x3af7b0[_0x6ff4('0x19')][_0x16631d['id']])){_0x3af7b0[_0x6ff4('0x19')][_0x16631d['id']]=new ZendeskAccount(_0x16631d);}else{_0x3af7b0[_0x6ff4('0x3d')](_0x3af7b0[_0x6ff4('0x19')][_0x16631d['id']],_0x16631d);}}}return _0x3af7b0[_0x6ff4('0x19')];};};Realtime[_0x6ff4('0x3c')][_0x6ff4('0x46')]=function(){var _0x2c5e61=this;return function(_0x2d9750){if(_0x2d9750){freeIsNotKey(_0x2d9750,_0x2c5e61[_0x6ff4('0x1a')],'id');for(var _0xe929b0=0x0,_0x39e79a={},_0x58d94a={};_0xe929b0<_0x2d9750['length'];_0xe929b0+=0x1){_0x39e79a=_0x2d9750[_0xe929b0];if(_[_0x6ff4('0x40')](_0x2c5e61[_0x6ff4('0x1a')][_0x39e79a['id']])){_0x2c5e61[_0x6ff4('0x1a')][_0x39e79a['id']]=new SalesforceAccount(_0x39e79a);}else{_0x2c5e61[_0x6ff4('0x3d')](_0x2c5e61[_0x6ff4('0x1a')][_0x39e79a['id']],_0x39e79a);}}}return _0x2c5e61[_0x6ff4('0x1a')];};};Realtime[_0x6ff4('0x3c')][_0x6ff4('0x47')]=function(){var _0x35e966=this;return function(_0xfce201){if(_0xfce201){freeIsNotKey(_0xfce201,_0x35e966[_0x6ff4('0x1c')],'id');for(var _0x2ce6f5=0x0,_0x4d9381={},_0x37449c={};_0x2ce6f5<_0xfce201[_0x6ff4('0x3f')];_0x2ce6f5+=0x1){_0x4d9381=_0xfce201[_0x2ce6f5];if(_[_0x6ff4('0x40')](_0x35e966['freshdeskAccounts'][_0x4d9381['id']])){_0x35e966['freshdeskAccounts'][_0x4d9381['id']]=new FreshdeskAccount(_0x4d9381);}else{_0x35e966[_0x6ff4('0x3d')](_0x35e966[_0x6ff4('0x1c')][_0x4d9381['id']],_0x4d9381);}}}return _0x35e966[_0x6ff4('0x1c')];};};Realtime['prototype'][_0x6ff4('0x48')]=function(){var _0x114cfb=this;return function(_0x3af956){if(_0x3af956){freeIsNotKey(_0x3af956,_0x114cfb[_0x6ff4('0x49')],'id');for(var _0x4f0f09=0x0,_0x23ad46={},_0x39353d={};_0x4f0f09<_0x3af956[_0x6ff4('0x3f')];_0x4f0f09+=0x1){_0x23ad46=_0x3af956[_0x4f0f09];if(_['isUndefined'](_0x114cfb[_0x6ff4('0x49')][_0x23ad46['id']])){_0x114cfb[_0x6ff4('0x49')][_0x23ad46['id']]=new ZohoAccount(_0x23ad46);}else{_0x114cfb[_0x6ff4('0x3d')](_0x114cfb['zohoAccounts'][_0x23ad46['id']],_0x23ad46);}}}return _0x114cfb[_0x6ff4('0x49')];};};Realtime[_0x6ff4('0x3c')]['initDeskAccounts']=function(){var _0xc19e97=this;return function(_0x47faf6){if(_0x47faf6){freeIsNotKey(_0x47faf6,_0xc19e97[_0x6ff4('0x1d')],'id');for(var _0x37032c=0x0,_0x48f986={},_0x2136d6={};_0x37032c<_0x47faf6[_0x6ff4('0x3f')];_0x37032c+=0x1){_0x48f986=_0x47faf6[_0x37032c];if(_[_0x6ff4('0x40')](_0xc19e97[_0x6ff4('0x1d')][_0x48f986['id']])){_0xc19e97[_0x6ff4('0x1d')][_0x48f986['id']]=new DeskAccount(_0x48f986);}else{_0xc19e97[_0x6ff4('0x3d')](_0xc19e97['deskAccounts'][_0x48f986['id']],_0x48f986);}}}return _0xc19e97[_0x6ff4('0x1d')];};};Realtime[_0x6ff4('0x3c')]['initSugarcrmAccounts']=function(){var _0x2dd95d=this;return function(_0x3789de){if(_0x3789de){freeIsNotKey(_0x3789de,_0x2dd95d[_0x6ff4('0x1b')],'id');for(var _0x3ac748=0x0,_0x3a8a23={},_0x598440={};_0x3ac748<_0x3789de['length'];_0x3ac748+=0x1){_0x3a8a23=_0x3789de[_0x3ac748];if(_['isUndefined'](_0x2dd95d[_0x6ff4('0x1b')][_0x3a8a23['id']])){_0x2dd95d[_0x6ff4('0x1b')][_0x3a8a23['id']]=new SugarcrmAccount(_0x3a8a23);}else{_0x2dd95d[_0x6ff4('0x3d')](_0x2dd95d[_0x6ff4('0x1b')][_0x3a8a23['id']],_0x3a8a23);}}}return _0x2dd95d['sugarcrmAccounts'];};};Realtime['prototype'][_0x6ff4('0x4a')]=function(){var _0x1fe267=this;return function(_0x4273a5){if(_0x4273a5){freeIsNotKey(_0x4273a5,_0x1fe267[_0x6ff4('0x4b')],'id');for(var _0x17e26a=0x0,_0x41a757={},_0x4f15f3={};_0x17e26a<_0x4273a5[_0x6ff4('0x3f')];_0x17e26a+=0x1){_0x41a757=_0x4273a5[_0x17e26a];if(_['isUndefined'](_0x1fe267['vtigerAccounts'][_0x41a757['id']])){_0x1fe267[_0x6ff4('0x4b')][_0x41a757['id']]=new VtigerAccount(_0x41a757);}else{_0x1fe267['mergeFromDatabase'](_0x1fe267['vtigerAccounts'][_0x41a757['id']],_0x41a757);}}}return _0x1fe267[_0x6ff4('0x4b')];};};Realtime['prototype'][_0x6ff4('0x4c')]=function(){var _0x2c27db=this;return function(_0xdf6ab3){if(_0xdf6ab3){freeIsNotKey(_0xdf6ab3,_0x2c27db[_0x6ff4('0x4d')],'id');for(var _0x59a657=0x0,_0x49760a={},_0x1c1567={};_0x59a657<_0xdf6ab3['length'];_0x59a657+=0x1){_0x49760a=_0xdf6ab3[_0x59a657];if(_['isUndefined'](_0x2c27db[_0x6ff4('0x4d')][_0x49760a['id']])){_0x2c27db[_0x6ff4('0x4d')][_0x49760a['id']]=new ServicenowAccount(_0x49760a);}else{_0x2c27db[_0x6ff4('0x3d')](_0x2c27db['servicenowAccounts'][_0x49760a['id']],_0x49760a);}}}return _0x2c27db[_0x6ff4('0x4d')];};};Realtime[_0x6ff4('0x3c')][_0x6ff4('0x4e')]=function(){var _0x50c973=this;return function(_0x2ea0d7){if(_0x2ea0d7){freeIsNotKey(_0x2ea0d7,_0x50c973['dynamics365Accounts'],'id');for(var _0x12687a=0x0,_0xc7a32={},_0xe3f114={};_0x12687a<_0x2ea0d7[_0x6ff4('0x3f')];_0x12687a+=0x1){_0xc7a32=_0x2ea0d7[_0x12687a];if(_[_0x6ff4('0x40')](_0x50c973['dynamics365Accounts'][_0xc7a32['id']])){_0x50c973[_0x6ff4('0x1e')][_0xc7a32['id']]=new Dynamics365Account(_0xc7a32);}else{_0x50c973[_0x6ff4('0x3d')](_0x50c973[_0x6ff4('0x1e')][_0xc7a32['id']],_0xc7a32);}}}return _0x50c973[_0x6ff4('0x1e')];};};Realtime['prototype'][_0x6ff4('0x4f')]=function(){var _0x3898c0=this;return function(_0x285700){if(_0x285700){freeIsNotKey(_0x285700,_0x3898c0[_0x6ff4('0x1f')],'id');for(var _0x1d5570=0x0,_0x3892c9={},_0x41f7cd={};_0x1d5570<_0x285700[_0x6ff4('0x3f')];_0x1d5570+=0x1){_0x3892c9=_0x285700[_0x1d5570];if(_[_0x6ff4('0x40')](_0x3898c0[_0x6ff4('0x1f')][_0x3892c9['id']])){_0x3898c0[_0x6ff4('0x1f')][_0x3892c9['id']]=new FreshsalesAccount(_0x3892c9);}else{_0x3898c0[_0x6ff4('0x3d')](_0x3898c0[_0x6ff4('0x1f')][_0x3892c9['id']],_0x3892c9);}}}return _0x3898c0[_0x6ff4('0x1f')];};};Realtime[_0x6ff4('0x3c')][_0x6ff4('0x50')]=function(){var _0x37e036=this;return function(_0x3fbf64){for(var _0x3d8faf=0x0;_0x3d8faf<_0x3fbf64['length'];_0x3d8faf+=0x1){_['merge'](_0x37e036[_0x6ff4('0x13')][_0x3fbf64[_0x3d8faf][_0x6ff4('0x25')]],_0x3fbf64[_0x3d8faf]);}return _0x37e036[_0x6ff4('0x13')];};};Realtime[_0x6ff4('0x3c')][_0x6ff4('0x51')]=function(){var _0x2af132=this;return function(_0x3758a5){clearVoiceQueues(_0x2af132[_0x6ff4('0x13')]);if(_0x3758a5){_0x3758a5=_[_0x6ff4('0x52')](_0x3758a5,_0x6ff4('0x53'));for(var _0x792f56 in _0x3758a5){if(_0x3758a5[_0x6ff4('0x22')](_0x792f56)){var _0x467e4d={};for(var _0x2c0ba8=0x0;_0x2c0ba8<_0x3758a5[_0x792f56][_0x6ff4('0x3f')];_0x2c0ba8+=0x1){var _0x1437af=_0x3758a5[_0x792f56][_0x2c0ba8][_0x6ff4('0x54')];if(_0x2af132[_0x6ff4('0x13')][_0x1437af]){if(_0x3758a5[_0x792f56][_0x2c0ba8][_0x6ff4('0x55')]){_0x2af132[_0x6ff4('0x13')][_0x1437af]['unmanaged']+=0x1;}if(_0x3758a5[_0x792f56][_0x2c0ba8][_0x6ff4('0x56')]){_0x2af132['voiceQueues'][_0x1437af][_0x6ff4('0x57')]+=0x1;}_0x2af132[_0x6ff4('0x13')][_0x1437af][_0x6ff4('0x2a')]+=moment(_0x3758a5[_0x792f56][_0x2c0ba8]['queuecallerleaveAt'])['diff'](moment(_0x3758a5[_0x792f56][_0x2c0ba8][_0x6ff4('0x58')]),_0x6ff4('0x59'))||0x0;if(_0x2c0ba8===_0x3758a5[_0x792f56][_0x6ff4('0x3f')]-0x1){_0x2af132[_0x6ff4('0x13')][_0x1437af]['sumDuration']+=moment(_0x3758a5[_0x792f56][_0x2c0ba8]['queuecallercompleteAt']||_0x3758a5[_0x792f56][_0x2c0ba8][_0x6ff4('0x5a')]||_0x3758a5[_0x792f56][_0x2c0ba8]['queuecallerexitAt'])[_0x6ff4('0x5b')](moment(_0x3758a5[_0x792f56][_0x2c0ba8][_0x6ff4('0x58')]),'seconds')||0x0;_0x2af132[_0x6ff4('0x13')][_0x1437af][_0x6ff4('0x28')]+=0x1;if(_0x3758a5[_0x792f56][_0x2c0ba8]['queuecallercomplete']){_0x2af132[_0x6ff4('0x13')][_0x1437af]['answered']+=0x1;_0x2af132['voiceQueues'][_0x1437af][_0x6ff4('0x2c')]+=moment(_0x3758a5[_0x792f56][_0x2c0ba8][_0x6ff4('0x5c')])['diff'](moment(_0x3758a5[_0x792f56][_0x2c0ba8][_0x6ff4('0x5d')]),_0x6ff4('0x59'))||0x0;}}else{_0x2af132[_0x6ff4('0x13')][_0x1437af][_0x6ff4('0x2b')]+=_0x2af132[_0x6ff4('0x13')][_0x1437af][_0x6ff4('0x2a')]||0x0;}}}}}}return _0x2af132[_0x6ff4('0x13')];};};Realtime[_0x6ff4('0x3c')][_0x6ff4('0x5e')]=function(){var _0x440d3b=this;return function(_0x523c99){clearVoiceCallReports(_0x440d3b[_0x6ff4('0x5f')]);if(_0x523c99){for(var _0x520eb7=0x0;_0x520eb7<_0x523c99[_0x6ff4('0x3f')];_0x520eb7+=0x1){_0x440d3b['outbound'][_0x6ff4('0x28')]+=0x1;_0x440d3b[_0x6ff4('0x5f')][_0x6ff4('0x2b')]+=_0x523c99[_0x520eb7][_0x6ff4('0x60')];if(_0x523c99[_0x520eb7]['disposition']==='ANSWERED'){_0x440d3b[_0x6ff4('0x5f')][_0x6ff4('0x29')]+=0x1;_0x440d3b[_0x6ff4('0x5f')][_0x6ff4('0x2a')]+=_0x523c99[_0x520eb7][_0x6ff4('0x60')]-_0x523c99[_0x520eb7][_0x6ff4('0x61')]||0x0;_0x440d3b[_0x6ff4('0x5f')][_0x6ff4('0x2c')]+=_0x523c99[_0x520eb7][_0x6ff4('0x61')];}}}return _0x440d3b[_0x6ff4('0x5f')];};};Realtime[_0x6ff4('0x3c')][_0x6ff4('0x62')]=function(){var _0x195633=this;return function(_0x2117ab){if(_0x2117ab){freeIsNotKey(_0x2117ab,_0x195633[_0x6ff4('0x14')],'name');for(var _0x296f77=0x0,_0x3a0dfd={};_0x296f77<_0x2117ab[_0x6ff4('0x3f')];_0x296f77+=0x1){_0x3a0dfd=_0x2117ab[_0x296f77];if(_[_0x6ff4('0x40')](_0x195633['campaigns'][_0x3a0dfd[_0x6ff4('0x25')]])){_0x195633[_0x6ff4('0x14')][_0x3a0dfd['name']]=new Campaign(_0x3a0dfd);}else{_0x195633[_0x6ff4('0x3d')](_0x195633[_0x6ff4('0x14')][_0x3a0dfd['name']],_0x3a0dfd);}}}return _0x195633['campaigns'];};};Realtime['prototype']['initVoiceExtensions']=function(){var _0x5ccdda=this;return function(_0x4dc8de){if(_0x4dc8de){freeIsNotKey(_0x4dc8de,_0x5ccdda[_0x6ff4('0x63')],'id');for(var _0x54a4ba=0x0,_0x5051ca={};_0x54a4ba<_0x4dc8de[_0x6ff4('0x3f')];_0x54a4ba+=0x1){_0x5051ca=_0x4dc8de[_0x54a4ba];if(_[_0x6ff4('0x40')](_0x5ccdda[_0x6ff4('0x63')][_0x5051ca['id']])){_0x5ccdda[_0x6ff4('0x63')][_0x5051ca['id']]=new VoiceExtension(_0x5051ca);}else{_0x5ccdda[_0x6ff4('0x3d')](_0x5ccdda[_0x6ff4('0x63')][_0x5051ca['id']],_0x5051ca);}}}return _0x5ccdda[_0x6ff4('0x63')];};};Realtime[_0x6ff4('0x3c')][_0x6ff4('0x64')]=function(){var _0x237707=this;return function(_0x3965d6){clearCampaigns(_0x237707[_0x6ff4('0x14')]);for(var _0xa596a1=0x0;_0xa596a1<_0x3965d6[_0x6ff4('0x3f')];_0xa596a1+=0x1){_[_0x6ff4('0x65')](_0x237707[_0x6ff4('0x14')][_0x3965d6[_0xa596a1][_0x6ff4('0x25')]],_0x3965d6[_0xa596a1]);}return _0x237707['campaigns'];};};Realtime['prototype'][_0x6ff4('0x66')]=function(){var _0x3671aa=this;return function(_0x1b3d7e){if(_0x1b3d7e){freeIsNotKey(_0x1b3d7e,_0x3671aa[_0x6ff4('0x20')],'id');for(var _0xd883df=0x0,_0x22db89={},_0x32ec90={};_0xd883df<_0x1b3d7e[_0x6ff4('0x3f')];_0xd883df+=0x1){_0x22db89=_0x1b3d7e[_0xd883df];if(_['isUndefined'](_0x3671aa[_0x6ff4('0x20')][_0x22db89['id']])){_0x3671aa[_0x6ff4('0x20')][_0x22db89['id']]=new FaxAccount(_0x22db89);}else{_0x3671aa['mergeFromDatabase'](_0x3671aa[_0x6ff4('0x20')][_0x22db89['id']],_0x22db89);}}}return _0x3671aa[_0x6ff4('0x20')];};};module[_0x6ff4('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 08ae02c..1366afc 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 _0xcd4e=['lastapplication','lastdata','context','from-voip-provider','calleridpreview','calleridnum','destinationchannel','channel','callerid','originatecalleridnum','disposition','calleridname','monitors','monitorFilename','connectedlinename','membername','xcally-motion-dialer','isArray','forEach','startsWith','Local','substring','mobile','phone','indexOf','lastIndexOf','attendedTransfer','exports','bluebird','lodash','moment','util','../../../config/logger','../ami','../rpc/voiceAgentReport','../rpc/voiceDialReport','../rpc/voiceQueueReport','../rpc/voiceRecording','./voiceQueueReport','./voiceAgentReport','./voiceDialReport','./userReport','agents','telephones','prototype','sync','realtime','xdr','disabled','custom:voiceQueueReport','voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','voiceAgentReport','voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','findAgent','accountcode','name','isNil','find','interface','format','SIP/%s','length','connectedlinenum','assigned','lastAssignedTo','queuecallerexit','queuecallerexitAt','YYYY-MM-DD\x20HH:mm:ss','create','destination','exten','type'];(function(_0x374edc,_0x31d6de){var _0x5e6d3b=function(_0x112358){while(--_0x112358){_0x374edc['push'](_0x374edc['shift']());}};_0x5e6d3b(++_0x31d6de);}(_0xcd4e,0x1f0));var _0xecd4=function(_0x29140f,_0x46a216){_0x29140f=_0x29140f-0x0;var _0x3ceecd=_0xcd4e[_0x29140f];return _0x3ceecd;};'use strict';var BPromise=require(_0xecd4('0x0'));var _=require(_0xecd4('0x1'));var moment=require(_0xecd4('0x2'));var util=require(_0xecd4('0x3'));var config=require('../../../config/environment');var logger=require(_0xecd4('0x4'))('ami');var ami=require(_0xecd4('0x5'));var RpcVoiceAgentReport=require(_0xecd4('0x6'));var RpcVoiceCallReport=require('../rpc/voiceCallReport');var RpcVoiceDialReport=require(_0xecd4('0x7'));var RpcMemberReport=require('../rpc/memberReport');var RpcVoiceQueueReport=require(_0xecd4('0x8'));var RpcVoiceRecording=require(_0xecd4('0x9'));var RpcVoiceTransferReport=require('../rpc/voiceTransferReport');var VoiceQueueReport=require(_0xecd4('0xa'));var VoiceCallReport=require('./voiceCallReport');var VoiceAgentReport=require(_0xecd4('0xb'));var VoiceDialReport=require(_0xecd4('0xc'));var UserReport=require(_0xecd4('0xd'));function Report(_0x1b6e68){this['realtime']=_0x1b6e68;this[_0xecd4('0xe')]=_0x1b6e68['agents'];this[_0xecd4('0xf')]=_0x1b6e68[_0xecd4('0xf')];}Report[_0xecd4('0x10')][_0xecd4('0x11')]=function(_0x4118b0){var _0x176a8f=new VoiceQueueReport(this['realtime']);var _0x43e003=new VoiceAgentReport(this[_0xecd4('0x12')]);var _0x31de12=new VoiceDialReport(this[_0xecd4('0x12')]);var _0x4dc40b=new VoiceCallReport(this[_0xecd4('0x12')]);var _0x28c0a8=new UserReport(this[_0xecd4('0x12')]);if(config[_0xecd4('0x13')]&&config[_0xecd4('0x13')][_0xecd4('0x14')]){ami['on'](_0xecd4('0x15'),this[_0xecd4('0x16')][_0xecd4('0x17')](this));ami['on'](_0xecd4('0x18'),this[_0xecd4('0x19')][_0xecd4('0x17')](this));ami['on']('custom:voiceAgentReport',this[_0xecd4('0x1a')][_0xecd4('0x17')](this));ami['on']('custom:voiceDialReport',this[_0xecd4('0x1b')][_0xecd4('0x17')](this));ami['on'](_0xecd4('0x1c'),this[_0xecd4('0x1d')]['bind'](this));ami['on'](_0xecd4('0x1e'),this['attendedTransfer'][_0xecd4('0x17')](this));}};Report[_0xecd4('0x10')][_0xecd4('0x1f')]=function(_0x192e97){var _0x23fb27=undefined;_0x23fb27=_['find'](this['agents'],function(_0x5cbb53){return _0x5cbb53[_0xecd4('0x20')]==_0x192e97||_0x5cbb53[_0xecd4('0x21')]==_0x192e97;});if(_[_0xecd4('0x22')](_0x23fb27)){var _0x1a534c=_[_0xecd4('0x23')](this[_0xecd4('0xf')],function(_0xc6f906){return _0xc6f906[_0xecd4('0x20')]==_0x192e97||_0xc6f906[_0xecd4('0x21')]==_0x192e97;});if(_0x1a534c){_0x23fb27=_[_0xecd4('0x23')](this[_0xecd4('0xe')],function(_0x456eb0){return _0x456eb0[_0xecd4('0x24')]==util[_0xecd4('0x25')](_0xecd4('0x26'),_0x1a534c[_0xecd4('0x21')]);});}}return _0x23fb27;};Report[_0xecd4('0x10')][_0xecd4('0x16')]=function(_0x38fcc9){for(var _0x50a520=0x0;_0x50a520<_0x38fcc9[_0xecd4('0x27')];_0x50a520+=0x1){var _0x5aa62a=this[_0xecd4('0x1f')](_0x38fcc9[_0x50a520][_0xecd4('0x28')]);if(_0x5aa62a){_0x38fcc9[_0x50a520]['accountcode']=_0x5aa62a['accountcode'];_0x38fcc9[_0x50a520][_0xecd4('0x29')]=!![];_0x38fcc9[_0x50a520][_0xecd4('0x2a')]=_0x5aa62a['name'];_0x38fcc9[_0x50a520][_0xecd4('0x24')]=_[_0xecd4('0x22')](_0x5aa62a['interface'])?util[_0xecd4('0x25')](_0xecd4('0x26'),_0x5aa62a[_0xecd4('0x21')]):_0x5aa62a['interface'];if(_0x38fcc9[_0x50a520]['queuecallercomplete']){_0x38fcc9[_0x50a520]['queuecallercompleteAt']=moment()[_0xecd4('0x25')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x38fcc9[_0x50a520][_0xecd4('0x2b')]){_0x38fcc9[_0x50a520][_0xecd4('0x2c')]=moment()[_0xecd4('0x25')](_0xecd4('0x2d'));}RpcMemberReport[_0xecd4('0x16')](_0x38fcc9[_0x50a520]);}RpcVoiceQueueReport[_0xecd4('0x2e')](_0x38fcc9[_0x50a520]);}};function extractCalleridNumber(_0x219a29){var _0x5c5298=_0x219a29['match'](/<(.*?)>/);return _0x5c5298?_0x5c5298[0x1]:_0x219a29;}Report[_0xecd4('0x10')][_0xecd4('0x19')]=function(_0x4f76b3){_0x4f76b3[_0xecd4('0x2f')]=_0x4f76b3[_0xecd4('0x2f')]||_0x4f76b3[_0xecd4('0x30')];if(_0x4f76b3[_0xecd4('0x31')]=='dialer'){_0x4f76b3[_0xecd4('0x32')]='queue';_0x4f76b3[_0xecd4('0x33')]=_0x4f76b3['queue'];if(_0x4f76b3[_0xecd4('0x34')]==_0xecd4('0x35')){_0x4f76b3[_0xecd4('0x20')]='';_0x4f76b3[_0xecd4('0x2f')]=extractCalleridNumber(_0x4f76b3['callerid']);}else if(_0x4f76b3[_0xecd4('0x34')]=='from-sip'){if(_0x4f76b3[_0xecd4('0x2f')]=='xcally-motion-preview'){_0x4f76b3[_0xecd4('0x2f')]=extractCalleridNumber(_0x4f76b3[_0xecd4('0x36')]);_0x4f76b3[_0xecd4('0x37')]=_0x4f76b3['originatecalleridnum'];_0x4f76b3[_0xecd4('0x38')]=[_0x4f76b3[_0xecd4('0x39')],_0x4f76b3[_0xecd4('0x39')]=_0x4f76b3[_0xecd4('0x38')]][0x0];_0x4f76b3[_0xecd4('0x3a')]=_0x4f76b3[_0xecd4('0x36')];}else{_0x4f76b3[_0xecd4('0x2f')]=_0x4f76b3[_0xecd4('0x37')];_0x4f76b3['calleridnum']=_0x4f76b3[_0xecd4('0x3b')];if(_0x4f76b3[_0xecd4('0x3c')]=='ANSWERED'){_0x4f76b3[_0xecd4('0x20')]=_0x4f76b3[_0xecd4('0x28')];}else{_0x4f76b3[_0xecd4('0x20')]='';}}}}else{_0x4f76b3['callerid']=util[_0xecd4('0x25')]('\x22%s\x22\x20<%s>',_0x4f76b3[_0xecd4('0x3d')],_0x4f76b3[_0xecd4('0x37')]);}RpcVoiceCallReport['create'](_0x4f76b3);if(_0x4f76b3['monitor']){for(var _0x3af776=0x0;_0x3af776<_0x4f76b3[_0xecd4('0x3e')]['length'];_0x3af776+=0x1){_0x4f76b3[_0xecd4('0x3f')]=_0x4f76b3[_0xecd4('0x3e')][_0x3af776]['filename'];_0x4f76b3['createdAt']=_0x4f76b3[_0xecd4('0x3e')][_0x3af776]['createdAt'];if(_0x4f76b3[_0xecd4('0x30')]=='xcally-motion-preview'){_0x4f76b3[_0xecd4('0x37')]=_0x4f76b3[_0xecd4('0x28')];_0x4f76b3[_0xecd4('0x3d')]=_0x4f76b3[_0xecd4('0x40')];_0x4f76b3[_0xecd4('0x28')]=_0x4f76b3[_0xecd4('0x20')];_0x4f76b3[_0xecd4('0x40')]=_0x4f76b3[_0xecd4('0x41')];_0x4f76b3['exten']=_0x4f76b3[_0xecd4('0x3b')];}else if(_0x4f76b3[_0xecd4('0x30')]==_0xecd4('0x42')){_0x4f76b3[_0xecd4('0x37')]=_0x4f76b3[_0xecd4('0x2f')];_0x4f76b3['exten']=_0x4f76b3[_0xecd4('0x3b')];}RpcVoiceRecording[_0xecd4('0x2e')](_0x4f76b3);}}};Report['prototype'][_0xecd4('0x1a')]=function(_0x5355b5){if(_[_0xecd4('0x43')](_0x5355b5)){_0x5355b5[_0xecd4('0x44')](function(_0x34000e){RpcVoiceAgentReport[_0xecd4('0x2e')](_0x34000e);});}else{RpcVoiceAgentReport[_0xecd4('0x2e')](_0x5355b5);}};Report['prototype'][_0xecd4('0x1b')]=function(_0x26c6bc){RpcVoiceDialReport['create'](_0x26c6bc);var _0x18f362=undefined;var _0x7817bf=_0x26c6bc[_0xecd4('0x39')];if(_[_0xecd4('0x45')](_0x7817bf,_0xecd4('0x46'))){var _0x3ad545=_0x7817bf[_0xecd4('0x47')](_0x7817bf['indexOf']('/')+0x1,_0x7817bf['indexOf']('@'));_0x18f362=_[_0xecd4('0x23')](this[_0xecd4('0xe')],function(_0x40e867){return _0x40e867[_0xecd4('0x48')]==_0x3ad545||_0x40e867[_0xecd4('0x49')]==_0x3ad545||_0x40e867[_0xecd4('0x20')]==_0x3ad545;});}else{var _0x3ad545=_0x7817bf[_0xecd4('0x47')](_0x7817bf[_0xecd4('0x4a')]('/')+0x1,_0x7817bf[_0xecd4('0x4b')]('-'));_0x18f362=this[_0xecd4('0x1f')](_0x3ad545);}if(_0x18f362){_0x26c6bc[_0xecd4('0x24')]=_[_0xecd4('0x22')](_0x18f362['interface'])?util[_0xecd4('0x25')](_0xecd4('0x26'),_0x18f362[_0xecd4('0x21')]):_0x18f362[_0xecd4('0x24')];_0x26c6bc[_0xecd4('0x41')]=_0x18f362[_0xecd4('0x21')];_0x26c6bc['accountcode']=_0x18f362['accountcode'];RpcMemberReport[_0xecd4('0x1b')](_0x26c6bc);}};Report[_0xecd4('0x10')]['blindTransfer']=function(_0x567759){RpcVoiceTransferReport[_0xecd4('0x1d')](_0x567759);};Report['prototype'][_0xecd4('0x4c')]=function(_0x441ddb){RpcVoiceTransferReport['attendedTransfer'](_0x441ddb);};module[_0xecd4('0x4d')]=Report; \ No newline at end of file +var _0x1184=['find','name','isNil','interface','SIP/%s','connectedlinenum','accountcode','assigned','lastAssignedTo','queuecallercomplete','queuecallercompleteAt','format','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','destination','dialer','lastapplication','lastdata','queue','context','from-voip-provider','callerid','calleridpreview','calleridnum','originatecalleridnum','destinationchannel','channel','disposition','\x22%s\x22\x20<%s>','calleridname','monitor','monitors','length','monitorFilename','createdAt','exten','xcally-motion-preview','connectedlinename','membername','xcally-motion-dialer','create','isArray','forEach','Local','substring','indexOf','mobile','phone','attendedTransfer','exports','bluebird','ami','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceRecording','./voiceQueueReport','./voiceAgentReport','./voiceDialReport','./userReport','realtime','agents','telephones','prototype','xdr','voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','custom:voiceAgentReport','voiceAgentReport','voiceDialReport','blindtransfer','findAgent'];(function(_0x2e08e7,_0x36163e){var _0x8a6778=function(_0x3f5445){while(--_0x3f5445){_0x2e08e7['push'](_0x2e08e7['shift']());}};_0x8a6778(++_0x36163e);}(_0x1184,0x1b4));var _0x4118=function(_0x144712,_0x13e8c3){_0x144712=_0x144712-0x0;var _0x201d67=_0x1184[_0x144712];return _0x201d67;};'use strict';var BPromise=require(_0x4118('0x0'));var _=require('lodash');var moment=require('moment');var util=require('util');var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0x4118('0x1'));var ami=require(_0x4118('0x2'));var RpcVoiceAgentReport=require(_0x4118('0x3'));var RpcVoiceCallReport=require(_0x4118('0x4'));var RpcVoiceDialReport=require(_0x4118('0x5'));var RpcMemberReport=require(_0x4118('0x6'));var RpcVoiceQueueReport=require('../rpc/voiceQueueReport');var RpcVoiceRecording=require(_0x4118('0x7'));var RpcVoiceTransferReport=require('../rpc/voiceTransferReport');var VoiceQueueReport=require(_0x4118('0x8'));var VoiceCallReport=require('./voiceCallReport');var VoiceAgentReport=require(_0x4118('0x9'));var VoiceDialReport=require(_0x4118('0xa'));var UserReport=require(_0x4118('0xb'));function Report(_0x5edff9){this[_0x4118('0xc')]=_0x5edff9;this['agents']=_0x5edff9[_0x4118('0xd')];this[_0x4118('0xe')]=_0x5edff9[_0x4118('0xe')];}Report[_0x4118('0xf')]['sync']=function(_0x16f9d8){var _0x39fa74=new VoiceQueueReport(this[_0x4118('0xc')]);var _0x2defb6=new VoiceAgentReport(this[_0x4118('0xc')]);var _0x2f73e8=new VoiceDialReport(this[_0x4118('0xc')]);var _0x59e4d2=new VoiceCallReport(this[_0x4118('0xc')]);var _0x4d5cd1=new UserReport(this[_0x4118('0xc')]);if(config[_0x4118('0x10')]&&config[_0x4118('0x10')]['disabled']){ami['on']('custom:voiceQueueReport',this[_0x4118('0x11')][_0x4118('0x12')](this));ami['on'](_0x4118('0x13'),this[_0x4118('0x14')][_0x4118('0x12')](this));ami['on'](_0x4118('0x15'),this[_0x4118('0x16')][_0x4118('0x12')](this));ami['on']('custom:voiceDialReport',this[_0x4118('0x17')]['bind'](this));ami['on'](_0x4118('0x18'),this['blindTransfer'][_0x4118('0x12')](this));ami['on']('attendedtransfer',this['attendedTransfer'][_0x4118('0x12')](this));}};Report[_0x4118('0xf')][_0x4118('0x19')]=function(_0x14687d){var _0x302e54=undefined;_0x302e54=_[_0x4118('0x1a')](this[_0x4118('0xd')],function(_0x59224a){return _0x59224a['accountcode']==_0x14687d||_0x59224a[_0x4118('0x1b')]==_0x14687d;});if(_[_0x4118('0x1c')](_0x302e54)){var _0x24e79e=_[_0x4118('0x1a')](this[_0x4118('0xe')],function(_0x5d8767){return _0x5d8767['accountcode']==_0x14687d||_0x5d8767[_0x4118('0x1b')]==_0x14687d;});if(_0x24e79e){_0x302e54=_[_0x4118('0x1a')](this['agents'],function(_0x3d9112){return _0x3d9112[_0x4118('0x1d')]==util['format'](_0x4118('0x1e'),_0x24e79e['name']);});}}return _0x302e54;};Report[_0x4118('0xf')][_0x4118('0x11')]=function(_0x35041b){for(var _0x475cad=0x0;_0x475cad<_0x35041b['length'];_0x475cad+=0x1){var _0x3d6f47=this['findAgent'](_0x35041b[_0x475cad][_0x4118('0x1f')]);if(_0x3d6f47){_0x35041b[_0x475cad][_0x4118('0x20')]=_0x3d6f47[_0x4118('0x20')];_0x35041b[_0x475cad][_0x4118('0x21')]=!![];_0x35041b[_0x475cad][_0x4118('0x22')]=_0x3d6f47[_0x4118('0x1b')];_0x35041b[_0x475cad][_0x4118('0x1d')]=_['isNil'](_0x3d6f47[_0x4118('0x1d')])?util['format']('SIP/%s',_0x3d6f47[_0x4118('0x1b')]):_0x3d6f47['interface'];if(_0x35041b[_0x475cad][_0x4118('0x23')]){_0x35041b[_0x475cad][_0x4118('0x24')]=moment()[_0x4118('0x25')](_0x4118('0x26'));}if(_0x35041b[_0x475cad][_0x4118('0x27')]){_0x35041b[_0x475cad][_0x4118('0x28')]=moment()['format'](_0x4118('0x26'));}RpcMemberReport[_0x4118('0x11')](_0x35041b[_0x475cad]);}RpcVoiceQueueReport['create'](_0x35041b[_0x475cad]);}};function extractCalleridNumber(_0x2324f8){var _0x3bc803=_0x2324f8['match'](/<(.*?)>/);return _0x3bc803?_0x3bc803[0x1]:_0x2324f8;}Report[_0x4118('0xf')][_0x4118('0x14')]=function(_0x26eedd){_0x26eedd[_0x4118('0x29')]=_0x26eedd[_0x4118('0x29')]||_0x26eedd['exten'];if(_0x26eedd['type']==_0x4118('0x2a')){_0x26eedd[_0x4118('0x2b')]='queue';_0x26eedd[_0x4118('0x2c')]=_0x26eedd[_0x4118('0x2d')];if(_0x26eedd[_0x4118('0x2e')]==_0x4118('0x2f')){_0x26eedd[_0x4118('0x20')]='';_0x26eedd[_0x4118('0x29')]=extractCalleridNumber(_0x26eedd[_0x4118('0x30')]);}else if(_0x26eedd[_0x4118('0x2e')]=='from-sip'){if(_0x26eedd['destination']=='xcally-motion-preview'){_0x26eedd[_0x4118('0x29')]=extractCalleridNumber(_0x26eedd[_0x4118('0x31')]);_0x26eedd[_0x4118('0x32')]=_0x26eedd[_0x4118('0x33')];_0x26eedd[_0x4118('0x34')]=[_0x26eedd['channel'],_0x26eedd[_0x4118('0x35')]=_0x26eedd[_0x4118('0x34')]][0x0];_0x26eedd['callerid']=_0x26eedd[_0x4118('0x31')];}else{_0x26eedd[_0x4118('0x29')]=_0x26eedd['calleridnum'];_0x26eedd[_0x4118('0x32')]=_0x26eedd[_0x4118('0x33')];if(_0x26eedd[_0x4118('0x36')]=='ANSWERED'){_0x26eedd[_0x4118('0x20')]=_0x26eedd[_0x4118('0x1f')];}else{_0x26eedd[_0x4118('0x20')]='';}}}}else{_0x26eedd[_0x4118('0x30')]=util['format'](_0x4118('0x37'),_0x26eedd[_0x4118('0x38')],_0x26eedd[_0x4118('0x32')]);}RpcVoiceCallReport['create'](_0x26eedd);if(_0x26eedd[_0x4118('0x39')]){for(var _0x23acb6=0x0;_0x23acb6<_0x26eedd[_0x4118('0x3a')][_0x4118('0x3b')];_0x23acb6+=0x1){_0x26eedd[_0x4118('0x3c')]=_0x26eedd['monitors'][_0x23acb6]['filename'];_0x26eedd[_0x4118('0x3d')]=_0x26eedd[_0x4118('0x3a')][_0x23acb6][_0x4118('0x3d')];if(_0x26eedd[_0x4118('0x3e')]==_0x4118('0x3f')){_0x26eedd[_0x4118('0x32')]=_0x26eedd['connectedlinenum'];_0x26eedd['calleridname']=_0x26eedd[_0x4118('0x40')];_0x26eedd[_0x4118('0x1f')]=_0x26eedd['accountcode'];_0x26eedd[_0x4118('0x40')]=_0x26eedd[_0x4118('0x41')];_0x26eedd['exten']=_0x26eedd[_0x4118('0x33')];}else if(_0x26eedd[_0x4118('0x3e')]==_0x4118('0x42')){_0x26eedd[_0x4118('0x32')]=_0x26eedd['destination'];_0x26eedd[_0x4118('0x3e')]=_0x26eedd[_0x4118('0x33')];}RpcVoiceRecording[_0x4118('0x43')](_0x26eedd);}}};Report[_0x4118('0xf')][_0x4118('0x16')]=function(_0xcee077){if(_[_0x4118('0x44')](_0xcee077)){_0xcee077[_0x4118('0x45')](function(_0x1e8ae4){RpcVoiceAgentReport[_0x4118('0x43')](_0x1e8ae4);});}else{RpcVoiceAgentReport[_0x4118('0x43')](_0xcee077);}};Report[_0x4118('0xf')][_0x4118('0x17')]=function(_0x46c00e){RpcVoiceDialReport[_0x4118('0x43')](_0x46c00e);var _0x413f44=undefined;var _0x40355a=_0x46c00e[_0x4118('0x35')];if(_['startsWith'](_0x40355a,_0x4118('0x46'))){var _0xe84395=_0x40355a[_0x4118('0x47')](_0x40355a[_0x4118('0x48')]('/')+0x1,_0x40355a[_0x4118('0x48')]('@'));_0x413f44=_[_0x4118('0x1a')](this[_0x4118('0xd')],function(_0x1f9af4){return _0x1f9af4[_0x4118('0x49')]==_0xe84395||_0x1f9af4[_0x4118('0x4a')]==_0xe84395||_0x1f9af4['accountcode']==_0xe84395;});}else{var _0xe84395=_0x40355a['substring'](_0x40355a['indexOf']('/')+0x1,_0x40355a['lastIndexOf']('-'));_0x413f44=this[_0x4118('0x19')](_0xe84395);}if(_0x413f44){_0x46c00e[_0x4118('0x1d')]=_[_0x4118('0x1c')](_0x413f44['interface'])?util['format'](_0x4118('0x1e'),_0x413f44['name']):_0x413f44[_0x4118('0x1d')];_0x46c00e[_0x4118('0x41')]=_0x413f44[_0x4118('0x1b')];_0x46c00e['accountcode']=_0x413f44['accountcode'];RpcMemberReport[_0x4118('0x17')](_0x46c00e);}};Report[_0x4118('0xf')]['blindTransfer']=function(_0x1498cc){RpcVoiceTransferReport['blindTransfer'](_0x1498cc);};Report[_0x4118('0xf')][_0x4118('0x4b')]=function(_0x280618){RpcVoiceTransferReport['attendedTransfer'](_0x280618);};module[_0x4118('0x4c')]=Report; \ No newline at end of file diff --git a/server/services/ami/report/userReport.js b/server/services/ami/report/userReport.js index e70ff0e..34c3852 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 _0x8671=['indexOf','mobile','[syncDeviceState][UserReport]','peer','registered','status','address','[syncPeerStatus][UserReport]','exports','lodash','util','ioredis','../../../config/logger','ami','../ami','redis','defaults','localhost','trunks','agents','telephones','syncRegistry','bind','registry','devicestatechange','peerstatus','syncPeerStatus','loopSyncRealTimeShow','resolve','actionSipShowRegistry','then','actionDeviceStateList','actionSipPeerStatus','catch','[loopSyncRealTimeShow]','error','prototype','isNotNull','isUndefined','emit','find','username','stateRegistry','omit','event','state','format','trunk:%s','name','trunk:save','[syncRegistry][UserReport]','inspect','syncDeviceState','device','local','toLowerCase','inuse','stateTime','toNumber','updateStatusRealtime','telephone:%s','telephone:save','startsWith','Queue','Local','substring'];(function(_0x6bb690,_0x380370){var _0x1a8f02=function(_0x2f8e9a){while(--_0x2f8e9a){_0x6bb690['push'](_0x6bb690['shift']());}};_0x1a8f02(++_0x380370);}(_0x8671,0x195));var _0x1867=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x8671[_0x1ac595];return _0x455fff;};'use strict';var _=require(_0x1867('0x0'));var moment=require('moment');var BPromise=require('bluebird');var util=require(_0x1867('0x1'));var Redis=require(_0x1867('0x2'));var config=require('../../../config/environment');var logger=require(_0x1867('0x3'))(_0x1867('0x4'));var ami=require(_0x1867('0x5'));config[_0x1867('0x6')]=_[_0x1867('0x7')](config[_0x1867('0x6')],{'host':_0x1867('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x1867('0x6')]));function UserReport(_0x11dd9a){this['trunks']=_0x11dd9a[_0x1867('0x9')];this[_0x1867('0xa')]=_0x11dd9a[_0x1867('0xa')];this[_0x1867('0xb')]=_0x11dd9a[_0x1867('0xb')];ami['on']('registryentry',this[_0x1867('0xc')][_0x1867('0xd')](this));ami['on'](_0x1867('0xe'),this['syncRegistry'][_0x1867('0xd')](this));ami['on'](_0x1867('0xf'),this['syncDeviceState'][_0x1867('0xd')](this));ami['on'](_0x1867('0x10'),this[_0x1867('0x11')][_0x1867('0xd')](this));this[_0x1867('0x12')]();return BPromise[_0x1867('0x13')]()['then'](ami[_0x1867('0x14')]())[_0x1867('0x15')](ami[_0x1867('0x16')]())[_0x1867('0x15')](ami[_0x1867('0x17')]())[_0x1867('0x18')](loggerCatch(_0x1867('0x19')));}function loggerCatch(_0x284b77){return function(_0x199fc9){logger[_0x1867('0x1a')](_0x284b77,util['inspect'](_0x199fc9,{'showHidden':![],'depth':null}));};}UserReport[_0x1867('0x1b')][_0x1867('0x12')]=function(){setInterval(function(){BPromise[_0x1867('0x13')]()['then'](ami[_0x1867('0x14')]())['then'](ami[_0x1867('0x16')]())['then'](ami[_0x1867('0x17')]())[_0x1867('0x18')](loggerCatch('[loopSyncRealTimeShow]'));},0x32c8);};UserReport['prototype'][_0x1867('0x1c')]=function(_0x1cb0b3){return _0x1cb0b3!==null&&!_[_0x1867('0x1d')](_0x1cb0b3);};UserReport[_0x1867('0x1b')]['emit']=function(_0x5e8f52,_0x48a733,_0x2a26d3){io['to'](_0x5e8f52)[_0x1867('0x1e')](_0x48a733,_0x2a26d3);};UserReport[_0x1867('0x1b')][_0x1867('0xc')]=function(_0xe812a3){try{if(this[_0x1867('0x1c')](_0xe812a3)){var _0x17166d=_[_0x1867('0x1f')](this[_0x1867('0x9')],{'registry':_0xe812a3[_0x1867('0x20')]});if(_0x17166d){_0xe812a3[_0x1867('0x21')]=_0xe812a3['state'];_['merge'](_0x17166d,_[_0x1867('0x22')](_0xe812a3,[_0x1867('0x23'),'actionid',_0x1867('0x20'),_0x1867('0x24')]));this[_0x1867('0x1e')](util[_0x1867('0x25')](_0x1867('0x26'),_0x17166d[_0x1867('0x27')]),_0x1867('0x28'),_0x17166d);}}}catch(_0x5afebe){logger[_0x1867('0x1a')](_0x1867('0x29'),util[_0x1867('0x2a')](_0x5afebe,{'showHidden':![],'depth':null}));}};UserReport[_0x1867('0x1b')][_0x1867('0x2b')]=function(_0x401079){try{if(this[_0x1867('0x1c')](_0x401079)){if(this[_0x1867('0xa')][_0x401079[_0x1867('0x2c')]]){if(!this[_0x1867('0xa')][_0x401079['device']][_0x1867('0x2d')]||_0x401079[_0x1867('0x24')][_0x1867('0x2e')]()==_0x1867('0x2f')){this[_0x1867('0xa')][_0x401079[_0x1867('0x2c')]][_0x1867('0x2d')]=![];if(this[_0x1867('0xa')][_0x401079['device']][_0x1867('0x24')]!==_0x401079['state'][_0x1867('0x2e')]()){this[_0x1867('0xa')][_0x401079[_0x1867('0x2c')]][_0x1867('0x30')]=_[_0x1867('0x31')](moment()[_0x1867('0x25')]('x'));}this['agents'][_0x401079[_0x1867('0x2c')]][_0x1867('0x24')]=_0x401079[_0x1867('0x24')][_0x1867('0x2e')]();this[_0x1867('0xa')][_0x401079['device']][_0x1867('0x32')](_0x401079);}}else if(this[_0x1867('0xb')][_0x401079[_0x1867('0x2c')]]){if(this[_0x1867('0xb')][_0x401079[_0x1867('0x2c')]]['state']!==_0x401079[_0x1867('0x24')][_0x1867('0x2e')]()){this['telephones'][_0x401079[_0x1867('0x2c')]][_0x1867('0x30')]=_[_0x1867('0x31')](moment()[_0x1867('0x25')]('x'));}this['telephones'][_0x401079[_0x1867('0x2c')]][_0x1867('0x24')]=_0x401079[_0x1867('0x24')][_0x1867('0x2e')]();this[_0x1867('0x1e')](util[_0x1867('0x25')](_0x1867('0x33'),this['telephones'][_0x401079[_0x1867('0x2c')]][_0x1867('0x27')]),_0x1867('0x34'),this['telephones'][_0x401079[_0x1867('0x2c')]]);}else if(this[_0x1867('0x9')][_0x401079[_0x1867('0x2c')]]){if(this[_0x1867('0x9')][_0x401079['device']][_0x1867('0x24')]!==_0x401079[_0x1867('0x24')][_0x1867('0x2e')]()){this[_0x1867('0x9')][_0x401079['device']][_0x1867('0x30')]=_[_0x1867('0x31')](moment()['format']('x'));}this[_0x1867('0x9')][_0x401079[_0x1867('0x2c')]][_0x1867('0x24')]=_0x401079['state']['toLowerCase']();this[_0x1867('0x1e')](util['format'](_0x1867('0x26'),this['trunks'][_0x401079[_0x1867('0x2c')]][_0x1867('0x27')]),_0x1867('0x28'),this[_0x1867('0x9')][_0x401079['device']]);}else if(_[_0x1867('0x35')](_0x401079[_0x1867('0x2c')],_0x1867('0x36'))){}else if(_[_0x1867('0x35')](_0x401079['device'],_0x1867('0x37'))){var _0x1cc8a6=_0x401079[_0x1867('0x2c')];var _0x1c4472=_0x1cc8a6[_0x1867('0x38')](_0x1cc8a6[_0x1867('0x39')]('/')+0x1,_0x1cc8a6['indexOf']('@'));var _0x2565ac=_[_0x1867('0x1f')](this['agents'],function(_0x464fda){return _0x464fda[_0x1867('0x3a')]==_0x1c4472||_0x464fda['phone']==_0x1c4472||_0x464fda['accountcode']==_0x1c4472;});if(_0x2565ac){if(_0x2565ac[_0x1867('0x24')]!==_0x401079['state'][_0x1867('0x2e')]()){_0x2565ac['stateTime']=_[_0x1867('0x31')](moment()[_0x1867('0x25')]('x'));}_0x2565ac['state']=_0x401079['state'][_0x1867('0x2e')]();_0x2565ac[_0x1867('0x2d')]=!![];_0x2565ac[_0x1867('0x32')](_0x401079);}}else{}}}catch(_0xd9cb94){logger['error'](_0x1867('0x3b'),util[_0x1867('0x2a')](_0xd9cb94,{'showHidden':![],'depth':null}));}};UserReport[_0x1867('0x1b')][_0x1867('0x11')]=function(_0x2a56dd){try{if(this[_0x1867('0x1c')](_0x2a56dd)&&this[_0x1867('0x1c')](_0x2a56dd[_0x1867('0x10')])){if(this[_0x1867('0xa')][_0x2a56dd[_0x1867('0x3c')]]){if(!this[_0x1867('0xa')][_0x2a56dd[_0x1867('0x3c')]][_0x1867('0x2d')]||_0x2a56dd[_0x1867('0x10')][_0x1867('0x2e')]()==_0x1867('0x3d')){this['agents'][_0x2a56dd[_0x1867('0x3c')]][_0x1867('0x2d')]=![];this['agents'][_0x2a56dd[_0x1867('0x3c')]][_0x1867('0x3e')]=_0x2a56dd['peerstatus']['toLowerCase']();this[_0x1867('0xa')][_0x2a56dd[_0x1867('0x3c')]][_0x1867('0x3f')]=_0x2a56dd[_0x1867('0x3f')];this[_0x1867('0xa')][_0x2a56dd[_0x1867('0x3c')]][_0x1867('0x32')](_0x2a56dd);}}else if(this[_0x1867('0xb')][_0x2a56dd[_0x1867('0x3c')]]){this['telephones'][_0x2a56dd[_0x1867('0x3c')]][_0x1867('0x3e')]=_0x2a56dd[_0x1867('0x10')][_0x1867('0x2e')]();this[_0x1867('0xb')][_0x2a56dd[_0x1867('0x3c')]]['address']=_0x2a56dd[_0x1867('0x3f')];this[_0x1867('0x1e')](util[_0x1867('0x25')](_0x1867('0x33'),this[_0x1867('0xb')][_0x2a56dd[_0x1867('0x3c')]]['name']),_0x1867('0x34'),this[_0x1867('0xb')][_0x2a56dd[_0x1867('0x3c')]]);}else if(this[_0x1867('0x9')][_0x2a56dd['peer']]){this[_0x1867('0x9')][_0x2a56dd[_0x1867('0x3c')]][_0x1867('0x3e')]=_0x2a56dd[_0x1867('0x10')]['toLowerCase']();this[_0x1867('0x9')][_0x2a56dd[_0x1867('0x3c')]][_0x1867('0x3f')]=_0x2a56dd[_0x1867('0x3f')];this[_0x1867('0x1e')](util['format']('trunk:%s',this[_0x1867('0x9')][_0x2a56dd[_0x1867('0x3c')]]['name']),_0x1867('0x28'),this[_0x1867('0x9')][_0x2a56dd[_0x1867('0x3c')]]);}else{}}}catch(_0x11e79a){logger['error'](_0x1867('0x40'),util['inspect'](_0x11e79a,{'showHidden':![],'depth':null}));}};module[_0x1867('0x41')]=UserReport; \ No newline at end of file +var _0xbeba=['phone','accountcode','[syncDeviceState][UserReport]','syncPeerStatus','peer','local','registered','status','address','[syncPeerStatus][UserReport]','bluebird','ioredis','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','localhost','socket.io-emitter','trunks','agents','telephones','registryentry','syncRegistry','bind','registry','devicestatechange','peerstatus','resolve','then','actionDeviceStateList','actionSipPeerStatus','catch','[loopSyncRealTimeShow]','error','prototype','loopSyncRealTimeShow','actionSipShowRegistry','isNotNull','isUndefined','emit','username','stateRegistry','state','event','format','trunk:%s','name','trunk:save','inspect','syncDeviceState','device','toLowerCase','updateStatusRealtime','stateTime','toNumber','telephone:%s','telephone:save','startsWith','Queue','Local','substring','indexOf','find','mobile'];(function(_0x147221,_0x4e067f){var _0x37fad0=function(_0x3d4f18){while(--_0x3d4f18){_0x147221['push'](_0x147221['shift']());}};_0x37fad0(++_0x4e067f);}(_0xbeba,0xd0));var _0xabeb=function(_0x83029,_0x534fb){_0x83029=_0x83029-0x0;var _0x1c560b=_0xbeba[_0x83029];return _0x1c560b;};'use strict';var _=require('lodash');var moment=require('moment');var BPromise=require(_0xabeb('0x0'));var util=require('util');var Redis=require(_0xabeb('0x1'));var config=require(_0xabeb('0x2'));var logger=require(_0xabeb('0x3'))(_0xabeb('0x4'));var ami=require(_0xabeb('0x5'));config[_0xabeb('0x6')]=_[_0xabeb('0x7')](config['redis'],{'host':_0xabeb('0x8'),'port':0x18eb});var io=require(_0xabeb('0x9'))(new Redis(config['redis']));function UserReport(_0x5c7949){this[_0xabeb('0xa')]=_0x5c7949[_0xabeb('0xa')];this['agents']=_0x5c7949[_0xabeb('0xb')];this[_0xabeb('0xc')]=_0x5c7949[_0xabeb('0xc')];ami['on'](_0xabeb('0xd'),this[_0xabeb('0xe')][_0xabeb('0xf')](this));ami['on'](_0xabeb('0x10'),this[_0xabeb('0xe')]['bind'](this));ami['on'](_0xabeb('0x11'),this['syncDeviceState'][_0xabeb('0xf')](this));ami['on'](_0xabeb('0x12'),this['syncPeerStatus']['bind'](this));this['loopSyncRealTimeShow']();return BPromise[_0xabeb('0x13')]()[_0xabeb('0x14')](ami['actionSipShowRegistry']())['then'](ami[_0xabeb('0x15')]())[_0xabeb('0x14')](ami[_0xabeb('0x16')]())[_0xabeb('0x17')](loggerCatch(_0xabeb('0x18')));}function loggerCatch(_0x39b64a){return function(_0x13685e){logger[_0xabeb('0x19')](_0x39b64a,util['inspect'](_0x13685e,{'showHidden':![],'depth':null}));};}UserReport[_0xabeb('0x1a')][_0xabeb('0x1b')]=function(){setInterval(function(){BPromise[_0xabeb('0x13')]()[_0xabeb('0x14')](ami[_0xabeb('0x1c')]())[_0xabeb('0x14')](ami[_0xabeb('0x15')]())[_0xabeb('0x14')](ami[_0xabeb('0x16')]())[_0xabeb('0x17')](loggerCatch(_0xabeb('0x18')));},0x32c8);};UserReport[_0xabeb('0x1a')][_0xabeb('0x1d')]=function(_0x3fb9aa){return _0x3fb9aa!==null&&!_[_0xabeb('0x1e')](_0x3fb9aa);};UserReport[_0xabeb('0x1a')][_0xabeb('0x1f')]=function(_0x5b4e35,_0x5eb9b3,_0x46ca68){io['to'](_0x5b4e35)['emit'](_0x5eb9b3,_0x46ca68);};UserReport[_0xabeb('0x1a')][_0xabeb('0xe')]=function(_0x175ac1){try{if(this[_0xabeb('0x1d')](_0x175ac1)){var _0x28ed32=_['find'](this[_0xabeb('0xa')],{'registry':_0x175ac1[_0xabeb('0x20')]});if(_0x28ed32){_0x175ac1[_0xabeb('0x21')]=_0x175ac1[_0xabeb('0x22')];_['merge'](_0x28ed32,_['omit'](_0x175ac1,[_0xabeb('0x23'),'actionid',_0xabeb('0x20'),_0xabeb('0x22')]));this[_0xabeb('0x1f')](util[_0xabeb('0x24')](_0xabeb('0x25'),_0x28ed32[_0xabeb('0x26')]),_0xabeb('0x27'),_0x28ed32);}}}catch(_0x2f1149){logger[_0xabeb('0x19')]('[syncRegistry][UserReport]',util[_0xabeb('0x28')](_0x2f1149,{'showHidden':![],'depth':null}));}};UserReport[_0xabeb('0x1a')][_0xabeb('0x29')]=function(_0x46bec1){try{if(this[_0xabeb('0x1d')](_0x46bec1)){if(this[_0xabeb('0xb')][_0x46bec1[_0xabeb('0x2a')]]){if(!this[_0xabeb('0xb')][_0x46bec1[_0xabeb('0x2a')]]['local']||_0x46bec1['state'][_0xabeb('0x2b')]()=='inuse'){this[_0xabeb('0xb')][_0x46bec1[_0xabeb('0x2a')]]['local']=![];if(this[_0xabeb('0xb')][_0x46bec1[_0xabeb('0x2a')]]['state']!==_0x46bec1[_0xabeb('0x22')][_0xabeb('0x2b')]()){this[_0xabeb('0xb')][_0x46bec1[_0xabeb('0x2a')]]['stateTime']=_['toNumber'](moment()[_0xabeb('0x24')]('x'));}this[_0xabeb('0xb')][_0x46bec1['device']][_0xabeb('0x22')]=_0x46bec1[_0xabeb('0x22')]['toLowerCase']();this[_0xabeb('0xb')][_0x46bec1[_0xabeb('0x2a')]][_0xabeb('0x2c')](_0x46bec1);}}else if(this['telephones'][_0x46bec1['device']]){if(this[_0xabeb('0xc')][_0x46bec1[_0xabeb('0x2a')]][_0xabeb('0x22')]!==_0x46bec1['state'][_0xabeb('0x2b')]()){this[_0xabeb('0xc')][_0x46bec1[_0xabeb('0x2a')]][_0xabeb('0x2d')]=_[_0xabeb('0x2e')](moment()['format']('x'));}this[_0xabeb('0xc')][_0x46bec1[_0xabeb('0x2a')]][_0xabeb('0x22')]=_0x46bec1[_0xabeb('0x22')][_0xabeb('0x2b')]();this['emit'](util[_0xabeb('0x24')](_0xabeb('0x2f'),this[_0xabeb('0xc')][_0x46bec1[_0xabeb('0x2a')]][_0xabeb('0x26')]),_0xabeb('0x30'),this[_0xabeb('0xc')][_0x46bec1[_0xabeb('0x2a')]]);}else if(this[_0xabeb('0xa')][_0x46bec1[_0xabeb('0x2a')]]){if(this[_0xabeb('0xa')][_0x46bec1[_0xabeb('0x2a')]][_0xabeb('0x22')]!==_0x46bec1[_0xabeb('0x22')][_0xabeb('0x2b')]()){this[_0xabeb('0xa')][_0x46bec1[_0xabeb('0x2a')]][_0xabeb('0x2d')]=_['toNumber'](moment()[_0xabeb('0x24')]('x'));}this[_0xabeb('0xa')][_0x46bec1[_0xabeb('0x2a')]]['state']=_0x46bec1[_0xabeb('0x22')][_0xabeb('0x2b')]();this[_0xabeb('0x1f')](util[_0xabeb('0x24')](_0xabeb('0x25'),this['trunks'][_0x46bec1[_0xabeb('0x2a')]][_0xabeb('0x26')]),_0xabeb('0x27'),this[_0xabeb('0xa')][_0x46bec1[_0xabeb('0x2a')]]);}else if(_[_0xabeb('0x31')](_0x46bec1[_0xabeb('0x2a')],_0xabeb('0x32'))){}else if(_[_0xabeb('0x31')](_0x46bec1['device'],_0xabeb('0x33'))){var _0x24fa6b=_0x46bec1[_0xabeb('0x2a')];var _0x5a52b8=_0x24fa6b[_0xabeb('0x34')](_0x24fa6b[_0xabeb('0x35')]('/')+0x1,_0x24fa6b[_0xabeb('0x35')]('@'));var _0x114d9d=_[_0xabeb('0x36')](this[_0xabeb('0xb')],function(_0x1d9d5f){return _0x1d9d5f[_0xabeb('0x37')]==_0x5a52b8||_0x1d9d5f[_0xabeb('0x38')]==_0x5a52b8||_0x1d9d5f[_0xabeb('0x39')]==_0x5a52b8;});if(_0x114d9d){if(_0x114d9d[_0xabeb('0x22')]!==_0x46bec1[_0xabeb('0x22')]['toLowerCase']()){_0x114d9d[_0xabeb('0x2d')]=_[_0xabeb('0x2e')](moment()['format']('x'));}_0x114d9d['state']=_0x46bec1['state'][_0xabeb('0x2b')]();_0x114d9d['local']=!![];_0x114d9d[_0xabeb('0x2c')](_0x46bec1);}}else{}}}catch(_0xf27142){logger[_0xabeb('0x19')](_0xabeb('0x3a'),util[_0xabeb('0x28')](_0xf27142,{'showHidden':![],'depth':null}));}};UserReport[_0xabeb('0x1a')][_0xabeb('0x3b')]=function(_0x15213c){try{if(this[_0xabeb('0x1d')](_0x15213c)&&this['isNotNull'](_0x15213c[_0xabeb('0x12')])){if(this[_0xabeb('0xb')][_0x15213c[_0xabeb('0x3c')]]){if(!this[_0xabeb('0xb')][_0x15213c['peer']][_0xabeb('0x3d')]||_0x15213c[_0xabeb('0x12')][_0xabeb('0x2b')]()==_0xabeb('0x3e')){this['agents'][_0x15213c[_0xabeb('0x3c')]][_0xabeb('0x3d')]=![];this[_0xabeb('0xb')][_0x15213c[_0xabeb('0x3c')]][_0xabeb('0x3f')]=_0x15213c['peerstatus']['toLowerCase']();this[_0xabeb('0xb')][_0x15213c[_0xabeb('0x3c')]][_0xabeb('0x40')]=_0x15213c[_0xabeb('0x40')];this[_0xabeb('0xb')][_0x15213c[_0xabeb('0x3c')]][_0xabeb('0x2c')](_0x15213c);}}else if(this['telephones'][_0x15213c['peer']]){this[_0xabeb('0xc')][_0x15213c[_0xabeb('0x3c')]][_0xabeb('0x3f')]=_0x15213c['peerstatus'][_0xabeb('0x2b')]();this[_0xabeb('0xc')][_0x15213c[_0xabeb('0x3c')]][_0xabeb('0x40')]=_0x15213c['address'];this[_0xabeb('0x1f')](util['format']('telephone:%s',this[_0xabeb('0xc')][_0x15213c[_0xabeb('0x3c')]][_0xabeb('0x26')]),_0xabeb('0x30'),this[_0xabeb('0xc')][_0x15213c[_0xabeb('0x3c')]]);}else if(this[_0xabeb('0xa')][_0x15213c[_0xabeb('0x3c')]]){this[_0xabeb('0xa')][_0x15213c[_0xabeb('0x3c')]]['status']=_0x15213c[_0xabeb('0x12')][_0xabeb('0x2b')]();this[_0xabeb('0xa')][_0x15213c[_0xabeb('0x3c')]][_0xabeb('0x40')]=_0x15213c['address'];this[_0xabeb('0x1f')](util[_0xabeb('0x24')](_0xabeb('0x25'),this['trunks'][_0x15213c[_0xabeb('0x3c')]][_0xabeb('0x26')]),_0xabeb('0x27'),this[_0xabeb('0xa')][_0x15213c[_0xabeb('0x3c')]]);}else{}}}catch(_0x58cae0){logger[_0xabeb('0x19')](_0xabeb('0x41'),util[_0xabeb('0x28')](_0x58cae0,{'showHidden':![],'depth':null}));}};module['exports']=UserReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceAgentReport.js b/server/services/ami/report/voiceAgentReport.js index da8fdd0..abf3a5e 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 _0x62b0=['destuniqueid','format','YYYY-MM-DD\x20HH:mm:ss','called','queue','type','inbound','omit','event','user:%s','error','[syncAgentCalled][VoiceAgentReport]','inspect','hasOwnProperty','agentconnectAt','lastevent','connect','holdtime','connectedlinenum','connectedlinename','destchannelstatedesc','interface','pick','membername','user:agentconnect','custom:agentconnect','agentcomplete','agentringnoanswerAt','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','custom:agentringnoanswer','[syncAgentRingNoAnswer][VoiceAgentReport]','reason','abandoned','custom:agentqueuecallerabandon','complete','talktime','transfer','agent','acw','acwTimeout','destconnectedlinenum','user:agentcomplete','[syncAgentComplete][VoiceAgentReport]','addVariable','keys','variable','[syncVarSet][VoiceAgentReport]','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','memberpenalty','memberrealtime','isNil','includes','custom:voiceAgentReport','values','[syncHangup][VoiceAgentReport]','transfereeuniqueid','origtransfereruniqueid','diff','seconds','secondtransfereruniqueid','[syncAttendedTransfer][VoiceAgentReport]','agentcompleteAt','[syncBlindTransfer][VoiceAgentReport]','channel','lastIndexOf','[syncMusicOnHoldStart][VoiceAgentReport]','substring','[syncMusicOnHoldStop][VoiceAgentReport]','exports','lodash','moment','util','ioredis','../../../config/logger','ami','../ami','redis','defaults','channels','voiceQueues','agents','variables','agentcalled','bind','agentconnect','syncAgentConnect','agentringnoanswer','syncAgentRingNoAnswer','queuecallerabandon','syncQueueCallerAbandon','syncAgentComplete','varset','syncVarSet','hangup','syncHangup','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','syncAttendedTransfer','blindtransfer','syncBlindTransfer','emit','prototype','isNotNull','isUndefined','uniqueid'];(function(_0x3f3eec,_0x1dd43f){var _0x53ca01=function(_0x18717a){while(--_0x18717a){_0x3f3eec['push'](_0x3f3eec['shift']());}};_0x53ca01(++_0x1dd43f);}(_0x62b0,0xcc));var _0x062b=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x62b0[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x062b('0x0'));var moment=require(_0x062b('0x1'));var util=require(_0x062b('0x2'));var Redis=require(_0x062b('0x3'));var config=require('../../../config/environment');var logger=require(_0x062b('0x4'))(_0x062b('0x5'));var ami=require(_0x062b('0x6'));config[_0x062b('0x7')]=_[_0x062b('0x8')](config[_0x062b('0x7')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function VoiceAgentReport(_0x38c776){this[_0x062b('0x9')]={};this[_0x062b('0xa')]=_0x38c776[_0x062b('0xa')];this[_0x062b('0xb')]=_0x38c776[_0x062b('0xb')];this[_0x062b('0xc')]={};ami['on'](_0x062b('0xd'),this['syncAgentCalled'][_0x062b('0xe')](this));ami['on'](_0x062b('0xf'),this[_0x062b('0x10')]['bind'](this));ami['on'](_0x062b('0x11'),this[_0x062b('0x12')][_0x062b('0xe')](this));ami['on'](_0x062b('0x13'),this[_0x062b('0x14')]['bind'](this));ami['on']('agentcomplete',this[_0x062b('0x15')][_0x062b('0xe')](this));ami['on'](_0x062b('0x16'),this[_0x062b('0x17')][_0x062b('0xe')](this));ami['on'](_0x062b('0x18'),this[_0x062b('0x19')][_0x062b('0xe')](this));ami['on'](_0x062b('0x1a'),this[_0x062b('0x1b')]['bind'](this));ami['on'](_0x062b('0x1c'),this[_0x062b('0x1d')]['bind'](this));ami['on']('attendedtransfer',this[_0x062b('0x1e')][_0x062b('0xe')](this));ami['on'](_0x062b('0x1f'),this[_0x062b('0x20')][_0x062b('0xe')](this));}VoiceAgentReport['prototype'][_0x062b('0x21')]=function(_0x5c83dc,_0x4ddf26,_0x14f92b){io['to'](_0x5c83dc)[_0x062b('0x21')](_0x4ddf26,_0x14f92b);};VoiceAgentReport[_0x062b('0x22')][_0x062b('0x23')]=function(_0x5bcf12){return _0x5bcf12!==null&&!_[_0x062b('0x24')](_0x5bcf12);};VoiceAgentReport[_0x062b('0x22')]['syncAgentCalled']=function(_0x132efb){try{if(this['isNotNull'](_0x132efb)){if(_[_0x062b('0x24')](this['channels'][_0x132efb['uniqueid']])){this['channels'][_0x132efb[_0x062b('0x25')]]={};}if(_[_0x062b('0x24')](this['channels'][_0x132efb[_0x062b('0x25')]][_0x132efb[_0x062b('0x26')]])){this[_0x062b('0x9')][_0x132efb[_0x062b('0x25')]][_0x132efb[_0x062b('0x26')]]={'agentcalledAt':moment()[_0x062b('0x27')](_0x062b('0x28')),'lastevent':_0x062b('0x29'),'variables':this[_0x062b('0xc')][_0x132efb['uniqueid']],'type':this[_0x062b('0xa')][_0x132efb[_0x062b('0x2a')]]?this[_0x062b('0xa')][_0x132efb[_0x062b('0x2a')]][_0x062b('0x2b')]||_0x062b('0x2c'):_0x062b('0x2c')};}_['merge'](this['channels'][_0x132efb['uniqueid']][_0x132efb[_0x062b('0x26')]],_[_0x062b('0x2d')](_0x132efb,[_0x062b('0x2e'),'privilege']));ami['emit']('custom:agentcalled',this['channels'][_0x132efb[_0x062b('0x25')]][_0x132efb[_0x062b('0x26')]]);this[_0x062b('0x21')](util[_0x062b('0x27')](_0x062b('0x2f'),_0x132efb['membername']),'user:called',this['channels'][_0x132efb[_0x062b('0x25')]][_0x132efb['destuniqueid']]);}}catch(_0x4d8223){logger[_0x062b('0x30')](_0x062b('0x31'),util[_0x062b('0x32')](_0x4d8223,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x062b('0x22')][_0x062b('0x10')]=function(_0x3e3225){try{if(this[_0x062b('0x23')](_0x3e3225)){if(this[_0x062b('0x9')][_0x3e3225[_0x062b('0x25')]]){for(var _0x37023e in this['channels'][_0x3e3225[_0x062b('0x25')]]){if(this[_0x062b('0x9')][_0x3e3225[_0x062b('0x25')]][_0x062b('0x33')](_0x37023e)){if(_0x3e3225[_0x062b('0x26')]===_0x37023e){this[_0x062b('0x9')][_0x3e3225[_0x062b('0x25')]][_0x37023e][_0x062b('0x34')]=moment()[_0x062b('0x27')](_0x062b('0x28'));this[_0x062b('0x9')][_0x3e3225[_0x062b('0x25')]][_0x37023e][_0x062b('0x35')]=_0x062b('0x36');this[_0x062b('0x9')][_0x3e3225[_0x062b('0x25')]][_0x37023e][_0x062b('0x37')]=_0x3e3225['holdtime'];this['channels'][_0x3e3225[_0x062b('0x25')]][_0x37023e][_0x062b('0x38')]=_0x3e3225[_0x062b('0x38')];this[_0x062b('0x9')][_0x3e3225[_0x062b('0x25')]][_0x37023e][_0x062b('0x39')]=_0x3e3225['connectedlinename'];this[_0x062b('0x9')][_0x3e3225['uniqueid']][_0x37023e]['destchannelstate']=_0x3e3225['destchannelstate'];this['channels'][_0x3e3225['uniqueid']][_0x37023e][_0x062b('0x3a')]=_0x3e3225[_0x062b('0x3a')];_['merge'](this[_0x062b('0xb')][_0x3e3225[_0x062b('0x3b')]],_[_0x062b('0x3c')](_0x3e3225,['queue','destconnectedlinenum']));this[_0x062b('0x21')](util[_0x062b('0x27')]('user:%s',_0x3e3225[_0x062b('0x3d')]),_0x062b('0x3e'),this[_0x062b('0x9')][_0x3e3225['uniqueid']][_0x3e3225[_0x062b('0x26')]]);ami[_0x062b('0x21')](_0x062b('0x3f'),this[_0x062b('0x9')][_0x3e3225['uniqueid']][_0x37023e]);}else if(!this[_0x062b('0x9')][_0x3e3225['uniqueid']][_0x37023e][_0x062b('0x11')]&&!this[_0x062b('0x9')][_0x3e3225[_0x062b('0x25')]][_0x37023e][_0x062b('0x40')]){this[_0x062b('0x9')][_0x3e3225[_0x062b('0x25')]][_0x37023e]['agentringnoanswer']=!![];this['channels'][_0x3e3225[_0x062b('0x25')]][_0x37023e][_0x062b('0x41')]=moment()[_0x062b('0x27')](_0x062b('0x28'));this['channels'][_0x3e3225[_0x062b('0x25')]][_0x37023e]['reason']='answered_elsewhere';this['channels'][_0x3e3225[_0x062b('0x25')]][_0x37023e][_0x062b('0x35')]=_0x062b('0x42');this['channels'][_0x3e3225['uniqueid']][_0x37023e][_0x062b('0x43')]=_0x3e3225[_0x062b('0x26')];this[_0x062b('0x9')][_0x3e3225['uniqueid']][_0x37023e][_0x062b('0x44')]=_0x3e3225[_0x062b('0x3d')];ami[_0x062b('0x21')]('custom:agentansweredelsewhere',this[_0x062b('0x9')][_0x3e3225[_0x062b('0x25')]][_0x37023e]);}}}}}}catch(_0x16c28a){logger[_0x062b('0x30')]('[syncAgentConnect][VoiceAgentReport]',util[_0x062b('0x32')](_0x16c28a,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x062b('0x12')]=function(_0x31c68f){try{if(this[_0x062b('0x23')](_0x31c68f)){if(this['channels'][_0x31c68f[_0x062b('0x25')]]&&this[_0x062b('0x9')][_0x31c68f[_0x062b('0x25')]][_0x31c68f['destuniqueid']]){this[_0x062b('0x9')][_0x31c68f[_0x062b('0x25')]][_0x31c68f[_0x062b('0x26')]][_0x062b('0x11')]=!![];this[_0x062b('0x9')][_0x31c68f[_0x062b('0x25')]][_0x31c68f[_0x062b('0x26')]]['agentringnoanswerAt']=moment()[_0x062b('0x27')](_0x062b('0x28'));this[_0x062b('0x9')][_0x31c68f[_0x062b('0x25')]][_0x31c68f[_0x062b('0x26')]]['reason']='rejected';this[_0x062b('0x9')][_0x31c68f['uniqueid']][_0x31c68f['destuniqueid']][_0x062b('0x35')]='rejected';ami[_0x062b('0x21')](_0x062b('0x45'),this['channels'][_0x31c68f[_0x062b('0x25')]][_0x31c68f[_0x062b('0x26')]]);}}}catch(_0xf3fc51){logger[_0x062b('0x30')](_0x062b('0x46'),util['inspect'](_0xf3fc51,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x062b('0x14')]=function(_0x5dc285){try{if(this[_0x062b('0x23')](_0x5dc285)){if(this[_0x062b('0x9')][_0x5dc285['uniqueid']]){for(var _0x54d1ee in this[_0x062b('0x9')][_0x5dc285[_0x062b('0x25')]]){if(this['channels'][_0x5dc285['uniqueid']]['hasOwnProperty'](_0x54d1ee)&&!this['channels'][_0x5dc285[_0x062b('0x25')]][_0x54d1ee][_0x062b('0x11')]&&!this[_0x062b('0x9')][_0x5dc285[_0x062b('0x25')]][_0x54d1ee][_0x062b('0x40')]){this['channels'][_0x5dc285['uniqueid']][_0x54d1ee][_0x062b('0x11')]=!![];this[_0x062b('0x9')][_0x5dc285[_0x062b('0x25')]][_0x54d1ee][_0x062b('0x41')]=moment()[_0x062b('0x27')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x5dc285[_0x062b('0x25')]][_0x54d1ee][_0x062b('0x47')]=_0x062b('0x48');this[_0x062b('0x9')][_0x5dc285[_0x062b('0x25')]][_0x54d1ee]['lastevent']=_0x062b('0x48');ami[_0x062b('0x21')](_0x062b('0x49'),this[_0x062b('0x9')][_0x5dc285[_0x062b('0x25')]][_0x54d1ee]);}}}}}catch(_0x29cefc){logger[_0x062b('0x30')]('[syncQueueCallerAbandon][VoiceAgentReport]',util['inspect'](_0x29cefc,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x062b('0x15')]=function(_0x15abac){try{if(this[_0x062b('0x23')](_0x15abac)){if(this['channels'][_0x15abac[_0x062b('0x25')]]){for(var _0xeffa6c in this[_0x062b('0x9')][_0x15abac[_0x062b('0x25')]]){if(this[_0x062b('0x9')][_0x15abac[_0x062b('0x25')]][_0x062b('0x33')](_0xeffa6c)){if(this[_0x062b('0x9')][_0x15abac['uniqueid']][_0xeffa6c][_0x062b('0x34')]&&!this[_0x062b('0x9')][_0x15abac[_0x062b('0x25')]][_0xeffa6c]['agentcomplete']){this[_0x062b('0x9')][_0x15abac[_0x062b('0x25')]][_0xeffa6c]['agentcomplete']=!![];this[_0x062b('0x9')][_0x15abac[_0x062b('0x25')]][_0xeffa6c]['agentcompleteAt']=moment()[_0x062b('0x27')](_0x062b('0x28'));this[_0x062b('0x9')][_0x15abac[_0x062b('0x25')]][_0xeffa6c][_0x062b('0x35')]=_0x062b('0x4a');this[_0x062b('0x9')][_0x15abac[_0x062b('0x25')]][_0xeffa6c][_0x062b('0x4b')]=_0x15abac['talktime'];this[_0x062b('0x9')][_0x15abac[_0x062b('0x25')]][_0xeffa6c]['reason']=_0x15abac[_0x062b('0x47')]==_0x062b('0x4c')?_0x062b('0x4d'):_0x15abac[_0x062b('0x47')];if(this[_0x062b('0xa')][_0x15abac[_0x062b('0x2a')]]&&this['voiceQueues'][_0x15abac[_0x062b('0x2a')]][_0x062b('0x4e')]){this[_0x062b('0x9')][_0x15abac['uniqueid']][_0xeffa6c]['agentacw']=!![];this[_0x062b('0x9')][_0x15abac[_0x062b('0x25')]][_0xeffa6c]['acwtime']=this[_0x062b('0xa')][_0x15abac['queue']][_0x062b('0x4f')];}this[_0x062b('0xb')][_0x15abac[_0x062b('0x3b')]]=_[_0x062b('0x2d')](this['agents'][_0x15abac[_0x062b('0x3b')]],[_0x062b('0x2a'),_0x062b('0x50')]);this[_0x062b('0x21')](util[_0x062b('0x27')](_0x062b('0x2f'),_0x15abac[_0x062b('0x3d')]),_0x062b('0x51'),this['channels'][_0x15abac[_0x062b('0x25')]][_0xeffa6c]);ami[_0x062b('0x21')]('custom:agentcomplete',this['channels'][_0x15abac[_0x062b('0x25')]][_0xeffa6c]);}}}}}}catch(_0x17fe61){logger[_0x062b('0x30')](_0x062b('0x52'),util[_0x062b('0x32')](_0x17fe61,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x062b('0x17')]=function(_0x245598){try{if(this['isNotNull'](_0x245598)){this[_0x062b('0x53')](_0x245598['uniqueid'],_[_0x062b('0x54')](_0x245598[_0x062b('0x55')])[0x0],_0x245598['value']);if(this[_0x062b('0x9')][_0x245598[_0x062b('0x25')]]){for(var _0x3e99bc in this[_0x062b('0x9')][_0x245598[_0x062b('0x25')]]){if(this[_0x062b('0x9')][_0x245598[_0x062b('0x25')]]['hasOwnProperty'](_0x3e99bc)){if(_[_0x062b('0x24')](this[_0x062b('0x9')][_0x245598[_0x062b('0x25')]][_0x3e99bc]['variables'])){this[_0x062b('0x9')][_0x245598[_0x062b('0x25')]][_0x3e99bc][_0x062b('0xc')]={};}this[_0x062b('0x9')][_0x245598[_0x062b('0x25')]][_0x3e99bc][_0x062b('0xc')]=this[_0x062b('0xc')][_0x245598['uniqueid']];}}}}}catch(_0x2b2cb9){logger[_0x062b('0x30')](_0x062b('0x56'),util[_0x062b('0x32')](_0x2b2cb9,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x062b('0x53')]=function(_0x2d7599,_0x4847d4,_0x568353){var _0x4e0bd3=[_0x062b('0x57'),'rtpaudioqosbridged',_0x062b('0x58'),_0x062b('0x59'),'rtpaudioqosloss',_0x062b('0x5a'),'rtpaudioqosrtt',_0x062b('0x5b'),_0x062b('0x5c'),_0x062b('0x5d'),_0x062b('0x5e'),_0x062b('0x5f'),_0x062b('0x60'),_0x062b('0x61'),_0x062b('0x62'),_0x062b('0x63'),_0x062b('0x3d'),_0x062b('0x64'),_0x062b('0x65')];if(!_[_0x062b('0x66')](_0x4847d4)&&!_[_0x062b('0x67')](_0x4e0bd3,_0x4847d4)){if(_[_0x062b('0x24')](this[_0x062b('0xc')][_0x2d7599])){this['variables'][_0x2d7599]={};}this[_0x062b('0xc')][_0x2d7599][_0x4847d4]=_0x568353;}};VoiceAgentReport[_0x062b('0x22')][_0x062b('0x19')]=function(_0x5e25b7){try{if(this['isNotNull'](_0x5e25b7)){if(this[_0x062b('0x9')][_0x5e25b7['uniqueid']]){for(var _0x2fe191 in this[_0x062b('0x9')][_0x5e25b7[_0x062b('0x25')]]){if(this[_0x062b('0x9')][_0x5e25b7[_0x062b('0x25')]][_0x062b('0x33')](_0x2fe191)){if(this['channels'][_0x5e25b7[_0x062b('0x25')]][_0x2fe191][_0x062b('0x47')]==_0x062b('0x4c')&&this[_0x062b('0x9')][_0x5e25b7['uniqueid']][_0x2fe191][_0x062b('0x40')]){this[_0x062b('0x9')][_0x5e25b7[_0x062b('0x25')]][_0x2fe191]['agentcompleteAt']=moment()[_0x062b('0x27')](_0x062b('0x28'));}}}ami['emit'](_0x062b('0x68'),_[_0x062b('0x69')](this['channels'][_0x5e25b7['uniqueid']]));delete this[_0x062b('0x9')][_0x5e25b7['uniqueid']];}if(this[_0x062b('0xc')][_0x5e25b7[_0x062b('0x25')]]){delete this[_0x062b('0xc')][_0x5e25b7['uniqueid']];}}}catch(_0x3698e8){logger[_0x062b('0x30')](_0x062b('0x6a'),util[_0x062b('0x32')](_0x3698e8,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x062b('0x22')][_0x062b('0x1e')]=function(_0x299b70){try{if(this[_0x062b('0x23')](_0x299b70)){if(this[_0x062b('0x9')][_0x299b70[_0x062b('0x6b')]]){for(var _0x274a9e in this['channels'][_0x299b70['transfereeuniqueid']]){if(this[_0x062b('0x9')][_0x299b70['transfereeuniqueid']]['hasOwnProperty'](_0x274a9e)){if(_0x299b70[_0x062b('0x6c')]===_0x274a9e){var _0x1f34f8=moment();this[_0x062b('0x9')][_0x299b70[_0x062b('0x6b')]][_0x274a9e][_0x062b('0x40')]=!![];this[_0x062b('0x9')][_0x299b70['transfereeuniqueid']][_0x274a9e]['agentcompleteAt']=moment()['format'](_0x062b('0x28'));this[_0x062b('0x9')][_0x299b70[_0x062b('0x6b')]][_0x274a9e][_0x062b('0x47')]=_0x062b('0x4c');this[_0x062b('0x9')][_0x299b70[_0x062b('0x6b')]][_0x274a9e][_0x062b('0x35')]=_0x062b('0x4a');this['channels'][_0x299b70[_0x062b('0x6b')]][_0x274a9e][_0x062b('0x4b')]=_0x1f34f8[_0x062b('0x6d')](this['channels'][_0x299b70[_0x062b('0x6b')]][_0x274a9e]['agentconnectAt'],_0x062b('0x6e'));}}}}if(this['channels'][_0x299b70[_0x062b('0x6f')]]){var _0x47ca89=this[_0x062b('0x9')][_0x299b70[_0x062b('0x6f')]];this[_0x062b('0x9')][_0x299b70['secondtransfereruniqueid']]=this['channels'][_0x299b70[_0x062b('0x6b')]];this[_0x062b('0x9')][_0x299b70[_0x062b('0x6b')]]=_0x47ca89;}}}catch(_0x3b95d9){logger[_0x062b('0x30')](_0x062b('0x70'),util[_0x062b('0x32')](_0x3b95d9,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x062b('0x20')]=function(_0x36c8f3){try{if(this[_0x062b('0x23')](_0x36c8f3)){if(this[_0x062b('0x9')][_0x36c8f3[_0x062b('0x6b')]]){for(var _0x5ba513 in this[_0x062b('0x9')][_0x36c8f3['transfereeuniqueid']]){if(this[_0x062b('0x9')][_0x36c8f3['transfereeuniqueid']][_0x062b('0x33')](_0x5ba513)){if(_0x36c8f3['transfereruniqueid']===_0x5ba513){var _0x396ea7=moment();this[_0x062b('0x9')][_0x36c8f3[_0x062b('0x6b')]][_0x5ba513][_0x062b('0x40')]=!![];this[_0x062b('0x9')][_0x36c8f3[_0x062b('0x6b')]][_0x5ba513][_0x062b('0x71')]=_0x396ea7;this[_0x062b('0x9')][_0x36c8f3['transfereeuniqueid']][_0x5ba513][_0x062b('0x47')]=_0x062b('0x4c');this[_0x062b('0x9')][_0x36c8f3[_0x062b('0x6b')]][_0x5ba513][_0x062b('0x35')]=_0x062b('0x4a');this[_0x062b('0x9')][_0x36c8f3['transfereeuniqueid']][_0x5ba513][_0x062b('0x4b')]=_0x396ea7[_0x062b('0x6d')](this[_0x062b('0x9')][_0x36c8f3[_0x062b('0x6b')]][_0x5ba513]['agentconnectAt'],'seconds');}}}}}}catch(_0x377707){logger[_0x062b('0x30')](_0x062b('0x72'),util[_0x062b('0x32')](_0x377707,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x062b('0x22')][_0x062b('0x1b')]=function(_0x4104c7){var _0x2cef35='';try{if(this[_0x062b('0x23')](_0x4104c7)){if(_0x4104c7[_0x062b('0x73')]){_0x2cef35=_0x4104c7['channel']['substring'](0x0,_0x4104c7[_0x062b('0x73')][_0x062b('0x74')]('-'));if(this['agents'][_0x2cef35]){this['agents'][_0x2cef35]['onhold']=!![];}}}}catch(_0x3d46a0){logger['error'](_0x062b('0x75'),util[_0x062b('0x32')](_0x3d46a0,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x062b('0x22')][_0x062b('0x1d')]=function(_0x4a7d50){var _0x3b0589='';try{if(this['isNotNull'](_0x4a7d50)){if(_0x4a7d50[_0x062b('0x73')]){_0x3b0589=_0x4a7d50[_0x062b('0x73')][_0x062b('0x76')](0x0,_0x4a7d50[_0x062b('0x73')][_0x062b('0x74')]('-'));if(this[_0x062b('0xb')][_0x3b0589]){this[_0x062b('0xb')][_0x3b0589]['onhold']=![];}}}}catch(_0x44ff48){logger['error'](_0x062b('0x77'),util[_0x062b('0x32')](_0x44ff48,{'showHidden':![],'depth':null}));}};module[_0x062b('0x78')]=VoiceAgentReport; \ No newline at end of file +var _0xce7c=['agentcalled','syncAgentCalled','bind','agentconnect','agentringnoanswer','syncAgentRingNoAnswer','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','varset','syncVarSet','syncHangup','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','syncAttendedTransfer','blindtransfer','syncBlindTransfer','prototype','emit','isNotNull','isUndefined','uniqueid','destuniqueid','YYYY-MM-DD\x20HH:mm:ss','called','queue','type','inbound','merge','omit','event','privilege','custom:agentcalled','format','user:%s','membername','user:called','error','[syncAgentCalled][VoiceAgentReport]','hasOwnProperty','agentconnectAt','lastevent','holdtime','connectedlinenum','connectedlinename','destchannelstate','destchannelstatedesc','interface','pick','destconnectedlinenum','user:agentconnect','custom:agentconnect','agentringnoanswerAt','reason','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','custom:agentansweredelsewhere','[syncAgentConnect][VoiceAgentReport]','inspect','rejected','custom:agentringnoanswer','[syncAgentRingNoAnswer][VoiceAgentReport]','abandoned','custom:agentqueuecallerabandon','[syncQueueCallerAbandon][VoiceAgentReport]','agentcompleteAt','talktime','transfer','agent','acw','acwTimeout','user:agentcomplete','custom:agentcomplete','[syncAgentComplete][VoiceAgentReport]','addVariable','keys','variable','value','[syncVarSet][VoiceAgentReport]','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','memberdynamic','memberinterface','memberlastcall','memberrealtime','includes','custom:voiceAgentReport','transfereeuniqueid','origtransfereruniqueid','complete','seconds','secondtransfereruniqueid','transfereruniqueid','diff','[syncBlindTransfer][VoiceAgentReport]','substring','lastIndexOf','onhold','[syncMusicOnHoldStart][VoiceAgentReport]','channel','[syncMusicOnHoldStop][VoiceAgentReport]','exports','lodash','moment','util','ioredis','../../../config/environment','ami','../ami','redis','localhost','socket.io-emitter','channels','voiceQueues','agents','variables'];(function(_0x3e8eb7,_0x125dcc){var _0x511099=function(_0x45c2c1){while(--_0x45c2c1){_0x3e8eb7['push'](_0x3e8eb7['shift']());}};_0x511099(++_0x125dcc);}(_0xce7c,0xee));var _0xcce7=function(_0x2440df,_0x453be8){_0x2440df=_0x2440df-0x0;var _0x1fa6fb=_0xce7c[_0x2440df];return _0x1fa6fb;};'use strict';var _=require(_0xcce7('0x0'));var moment=require(_0xcce7('0x1'));var util=require(_0xcce7('0x2'));var Redis=require(_0xcce7('0x3'));var config=require(_0xcce7('0x4'));var logger=require('../../../config/logger')(_0xcce7('0x5'));var ami=require(_0xcce7('0x6'));config[_0xcce7('0x7')]=_['defaults'](config[_0xcce7('0x7')],{'host':_0xcce7('0x8'),'port':0x18eb});var io=require(_0xcce7('0x9'))(new Redis(config['redis']));function VoiceAgentReport(_0x27eb14){this[_0xcce7('0xa')]={};this['voiceQueues']=_0x27eb14[_0xcce7('0xb')];this['agents']=_0x27eb14[_0xcce7('0xc')];this[_0xcce7('0xd')]={};ami['on'](_0xcce7('0xe'),this[_0xcce7('0xf')][_0xcce7('0x10')](this));ami['on'](_0xcce7('0x11'),this['syncAgentConnect'][_0xcce7('0x10')](this));ami['on'](_0xcce7('0x12'),this[_0xcce7('0x13')][_0xcce7('0x10')](this));ami['on']('queuecallerabandon',this[_0xcce7('0x14')][_0xcce7('0x10')](this));ami['on'](_0xcce7('0x15'),this[_0xcce7('0x16')][_0xcce7('0x10')](this));ami['on'](_0xcce7('0x17'),this[_0xcce7('0x18')]['bind'](this));ami['on']('hangup',this[_0xcce7('0x19')]['bind'](this));ami['on'](_0xcce7('0x1a'),this[_0xcce7('0x1b')]['bind'](this));ami['on'](_0xcce7('0x1c'),this[_0xcce7('0x1d')][_0xcce7('0x10')](this));ami['on']('attendedtransfer',this[_0xcce7('0x1e')][_0xcce7('0x10')](this));ami['on'](_0xcce7('0x1f'),this[_0xcce7('0x20')][_0xcce7('0x10')](this));}VoiceAgentReport[_0xcce7('0x21')][_0xcce7('0x22')]=function(_0x997a59,_0x4e72c1,_0x48d8d8){io['to'](_0x997a59)[_0xcce7('0x22')](_0x4e72c1,_0x48d8d8);};VoiceAgentReport['prototype'][_0xcce7('0x23')]=function(_0x5b676c){return _0x5b676c!==null&&!_['isUndefined'](_0x5b676c);};VoiceAgentReport['prototype']['syncAgentCalled']=function(_0x4a43c5){try{if(this[_0xcce7('0x23')](_0x4a43c5)){if(_[_0xcce7('0x24')](this[_0xcce7('0xa')][_0x4a43c5['uniqueid']])){this[_0xcce7('0xa')][_0x4a43c5[_0xcce7('0x25')]]={};}if(_['isUndefined'](this['channels'][_0x4a43c5[_0xcce7('0x25')]][_0x4a43c5[_0xcce7('0x26')]])){this[_0xcce7('0xa')][_0x4a43c5[_0xcce7('0x25')]][_0x4a43c5[_0xcce7('0x26')]]={'agentcalledAt':moment()['format'](_0xcce7('0x27')),'lastevent':_0xcce7('0x28'),'variables':this[_0xcce7('0xd')][_0x4a43c5[_0xcce7('0x25')]],'type':this[_0xcce7('0xb')][_0x4a43c5[_0xcce7('0x29')]]?this[_0xcce7('0xb')][_0x4a43c5[_0xcce7('0x29')]][_0xcce7('0x2a')]||_0xcce7('0x2b'):_0xcce7('0x2b')};}_[_0xcce7('0x2c')](this['channels'][_0x4a43c5[_0xcce7('0x25')]][_0x4a43c5[_0xcce7('0x26')]],_[_0xcce7('0x2d')](_0x4a43c5,[_0xcce7('0x2e'),_0xcce7('0x2f')]));ami[_0xcce7('0x22')](_0xcce7('0x30'),this[_0xcce7('0xa')][_0x4a43c5[_0xcce7('0x25')]][_0x4a43c5['destuniqueid']]);this[_0xcce7('0x22')](util[_0xcce7('0x31')](_0xcce7('0x32'),_0x4a43c5[_0xcce7('0x33')]),_0xcce7('0x34'),this[_0xcce7('0xa')][_0x4a43c5[_0xcce7('0x25')]][_0x4a43c5['destuniqueid']]);}}catch(_0x2aec32){logger[_0xcce7('0x35')](_0xcce7('0x36'),util['inspect'](_0x2aec32,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xcce7('0x21')]['syncAgentConnect']=function(_0x3e8942){try{if(this[_0xcce7('0x23')](_0x3e8942)){if(this['channels'][_0x3e8942['uniqueid']]){for(var _0x360980 in this['channels'][_0x3e8942[_0xcce7('0x25')]]){if(this[_0xcce7('0xa')][_0x3e8942['uniqueid']][_0xcce7('0x37')](_0x360980)){if(_0x3e8942[_0xcce7('0x26')]===_0x360980){this[_0xcce7('0xa')][_0x3e8942[_0xcce7('0x25')]][_0x360980][_0xcce7('0x38')]=moment()[_0xcce7('0x31')](_0xcce7('0x27'));this['channels'][_0x3e8942[_0xcce7('0x25')]][_0x360980][_0xcce7('0x39')]='connect';this[_0xcce7('0xa')][_0x3e8942[_0xcce7('0x25')]][_0x360980][_0xcce7('0x3a')]=_0x3e8942[_0xcce7('0x3a')];this[_0xcce7('0xa')][_0x3e8942[_0xcce7('0x25')]][_0x360980][_0xcce7('0x3b')]=_0x3e8942[_0xcce7('0x3b')];this[_0xcce7('0xa')][_0x3e8942[_0xcce7('0x25')]][_0x360980][_0xcce7('0x3c')]=_0x3e8942[_0xcce7('0x3c')];this['channels'][_0x3e8942['uniqueid']][_0x360980][_0xcce7('0x3d')]=_0x3e8942[_0xcce7('0x3d')];this['channels'][_0x3e8942[_0xcce7('0x25')]][_0x360980]['destchannelstatedesc']=_0x3e8942[_0xcce7('0x3e')];_['merge'](this[_0xcce7('0xc')][_0x3e8942[_0xcce7('0x3f')]],_[_0xcce7('0x40')](_0x3e8942,[_0xcce7('0x29'),_0xcce7('0x41')]));this[_0xcce7('0x22')](util[_0xcce7('0x31')](_0xcce7('0x32'),_0x3e8942[_0xcce7('0x33')]),_0xcce7('0x42'),this[_0xcce7('0xa')][_0x3e8942[_0xcce7('0x25')]][_0x3e8942[_0xcce7('0x26')]]);ami[_0xcce7('0x22')](_0xcce7('0x43'),this[_0xcce7('0xa')][_0x3e8942['uniqueid']][_0x360980]);}else if(!this[_0xcce7('0xa')][_0x3e8942[_0xcce7('0x25')]][_0x360980][_0xcce7('0x12')]&&!this[_0xcce7('0xa')][_0x3e8942[_0xcce7('0x25')]][_0x360980]['agentcomplete']){this[_0xcce7('0xa')][_0x3e8942['uniqueid']][_0x360980][_0xcce7('0x12')]=!![];this[_0xcce7('0xa')][_0x3e8942[_0xcce7('0x25')]][_0x360980][_0xcce7('0x44')]=moment()[_0xcce7('0x31')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x3e8942[_0xcce7('0x25')]][_0x360980][_0xcce7('0x45')]=_0xcce7('0x46');this[_0xcce7('0xa')][_0x3e8942['uniqueid']][_0x360980][_0xcce7('0x39')]=_0xcce7('0x46');this['channels'][_0x3e8942[_0xcce7('0x25')]][_0x360980][_0xcce7('0x47')]=_0x3e8942[_0xcce7('0x26')];this[_0xcce7('0xa')][_0x3e8942[_0xcce7('0x25')]][_0x360980][_0xcce7('0x48')]=_0x3e8942[_0xcce7('0x33')];ami[_0xcce7('0x22')](_0xcce7('0x49'),this[_0xcce7('0xa')][_0x3e8942[_0xcce7('0x25')]][_0x360980]);}}}}}}catch(_0x268ec0){logger['error'](_0xcce7('0x4a'),util[_0xcce7('0x4b')](_0x268ec0,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xcce7('0x21')]['syncAgentRingNoAnswer']=function(_0x497f2b){try{if(this[_0xcce7('0x23')](_0x497f2b)){if(this[_0xcce7('0xa')][_0x497f2b['uniqueid']]&&this[_0xcce7('0xa')][_0x497f2b[_0xcce7('0x25')]][_0x497f2b[_0xcce7('0x26')]]){this[_0xcce7('0xa')][_0x497f2b[_0xcce7('0x25')]][_0x497f2b['destuniqueid']][_0xcce7('0x12')]=!![];this[_0xcce7('0xa')][_0x497f2b['uniqueid']][_0x497f2b['destuniqueid']][_0xcce7('0x44')]=moment()['format'](_0xcce7('0x27'));this['channels'][_0x497f2b['uniqueid']][_0x497f2b[_0xcce7('0x26')]]['reason']=_0xcce7('0x4c');this[_0xcce7('0xa')][_0x497f2b['uniqueid']][_0x497f2b[_0xcce7('0x26')]][_0xcce7('0x39')]=_0xcce7('0x4c');ami['emit'](_0xcce7('0x4d'),this[_0xcce7('0xa')][_0x497f2b[_0xcce7('0x25')]][_0x497f2b[_0xcce7('0x26')]]);}}}catch(_0x4f6b03){logger[_0xcce7('0x35')](_0xcce7('0x4e'),util[_0xcce7('0x4b')](_0x4f6b03,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0xcce7('0x14')]=function(_0x1b082b){try{if(this[_0xcce7('0x23')](_0x1b082b)){if(this[_0xcce7('0xa')][_0x1b082b[_0xcce7('0x25')]]){for(var _0x42e2e1 in this['channels'][_0x1b082b[_0xcce7('0x25')]]){if(this[_0xcce7('0xa')][_0x1b082b[_0xcce7('0x25')]][_0xcce7('0x37')](_0x42e2e1)&&!this[_0xcce7('0xa')][_0x1b082b[_0xcce7('0x25')]][_0x42e2e1][_0xcce7('0x12')]&&!this[_0xcce7('0xa')][_0x1b082b[_0xcce7('0x25')]][_0x42e2e1][_0xcce7('0x15')]){this[_0xcce7('0xa')][_0x1b082b[_0xcce7('0x25')]][_0x42e2e1][_0xcce7('0x12')]=!![];this[_0xcce7('0xa')][_0x1b082b[_0xcce7('0x25')]][_0x42e2e1][_0xcce7('0x44')]=moment()[_0xcce7('0x31')](_0xcce7('0x27'));this['channels'][_0x1b082b[_0xcce7('0x25')]][_0x42e2e1][_0xcce7('0x45')]=_0xcce7('0x4f');this[_0xcce7('0xa')][_0x1b082b[_0xcce7('0x25')]][_0x42e2e1][_0xcce7('0x39')]=_0xcce7('0x4f');ami[_0xcce7('0x22')](_0xcce7('0x50'),this[_0xcce7('0xa')][_0x1b082b[_0xcce7('0x25')]][_0x42e2e1]);}}}}}catch(_0x4f10d5){logger[_0xcce7('0x35')](_0xcce7('0x51'),util[_0xcce7('0x4b')](_0x4f10d5,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xcce7('0x21')][_0xcce7('0x16')]=function(_0x1adb58){try{if(this[_0xcce7('0x23')](_0x1adb58)){if(this[_0xcce7('0xa')][_0x1adb58[_0xcce7('0x25')]]){for(var _0x37681a in this[_0xcce7('0xa')][_0x1adb58['uniqueid']]){if(this['channels'][_0x1adb58[_0xcce7('0x25')]][_0xcce7('0x37')](_0x37681a)){if(this[_0xcce7('0xa')][_0x1adb58[_0xcce7('0x25')]][_0x37681a][_0xcce7('0x38')]&&!this[_0xcce7('0xa')][_0x1adb58[_0xcce7('0x25')]][_0x37681a][_0xcce7('0x15')]){this[_0xcce7('0xa')][_0x1adb58[_0xcce7('0x25')]][_0x37681a][_0xcce7('0x15')]=!![];this[_0xcce7('0xa')][_0x1adb58['uniqueid']][_0x37681a][_0xcce7('0x52')]=moment()[_0xcce7('0x31')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x1adb58[_0xcce7('0x25')]][_0x37681a][_0xcce7('0x39')]='complete';this[_0xcce7('0xa')][_0x1adb58[_0xcce7('0x25')]][_0x37681a][_0xcce7('0x53')]=_0x1adb58[_0xcce7('0x53')];this['channels'][_0x1adb58[_0xcce7('0x25')]][_0x37681a]['reason']=_0x1adb58[_0xcce7('0x45')]==_0xcce7('0x54')?_0xcce7('0x55'):_0x1adb58[_0xcce7('0x45')];if(this[_0xcce7('0xb')][_0x1adb58[_0xcce7('0x29')]]&&this[_0xcce7('0xb')][_0x1adb58[_0xcce7('0x29')]][_0xcce7('0x56')]){this[_0xcce7('0xa')][_0x1adb58['uniqueid']][_0x37681a]['agentacw']=!![];this[_0xcce7('0xa')][_0x1adb58[_0xcce7('0x25')]][_0x37681a]['acwtime']=this[_0xcce7('0xb')][_0x1adb58[_0xcce7('0x29')]][_0xcce7('0x57')];}this['agents'][_0x1adb58['interface']]=_[_0xcce7('0x2d')](this['agents'][_0x1adb58[_0xcce7('0x3f')]],[_0xcce7('0x29'),_0xcce7('0x41')]);this[_0xcce7('0x22')](util[_0xcce7('0x31')]('user:%s',_0x1adb58['membername']),_0xcce7('0x58'),this[_0xcce7('0xa')][_0x1adb58[_0xcce7('0x25')]][_0x37681a]);ami[_0xcce7('0x22')](_0xcce7('0x59'),this['channels'][_0x1adb58[_0xcce7('0x25')]][_0x37681a]);}}}}}}catch(_0x3fe49e){logger[_0xcce7('0x35')](_0xcce7('0x5a'),util['inspect'](_0x3fe49e,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xcce7('0x21')][_0xcce7('0x18')]=function(_0x5ba302){try{if(this[_0xcce7('0x23')](_0x5ba302)){this[_0xcce7('0x5b')](_0x5ba302[_0xcce7('0x25')],_[_0xcce7('0x5c')](_0x5ba302[_0xcce7('0x5d')])[0x0],_0x5ba302[_0xcce7('0x5e')]);if(this['channels'][_0x5ba302['uniqueid']]){for(var _0x12d1e0 in this[_0xcce7('0xa')][_0x5ba302['uniqueid']]){if(this[_0xcce7('0xa')][_0x5ba302['uniqueid']][_0xcce7('0x37')](_0x12d1e0)){if(_[_0xcce7('0x24')](this[_0xcce7('0xa')][_0x5ba302[_0xcce7('0x25')]][_0x12d1e0][_0xcce7('0xd')])){this[_0xcce7('0xa')][_0x5ba302['uniqueid']][_0x12d1e0][_0xcce7('0xd')]={};}this[_0xcce7('0xa')][_0x5ba302[_0xcce7('0x25')]][_0x12d1e0]['variables']=this['variables'][_0x5ba302[_0xcce7('0x25')]];}}}}}catch(_0x2fd832){logger['error'](_0xcce7('0x5f'),util['inspect'](_0x2fd832,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xcce7('0x21')][_0xcce7('0x5b')]=function(_0x42775c,_0x25c1a7,_0x2e2216){var _0x3efdfc=['rtpaudioqos','rtpaudioqosbridged',_0xcce7('0x60'),_0xcce7('0x61'),'rtpaudioqosloss',_0xcce7('0x62'),_0xcce7('0x63'),_0xcce7('0x64'),_0xcce7('0x65'),_0xcce7('0x66'),_0xcce7('0x67'),_0xcce7('0x68'),'membercalls',_0xcce7('0x69'),_0xcce7('0x6a'),_0xcce7('0x6b'),'membername','memberpenalty',_0xcce7('0x6c')];if(!_['isNil'](_0x25c1a7)&&!_[_0xcce7('0x6d')](_0x3efdfc,_0x25c1a7)){if(_[_0xcce7('0x24')](this['variables'][_0x42775c])){this[_0xcce7('0xd')][_0x42775c]={};}this[_0xcce7('0xd')][_0x42775c][_0x25c1a7]=_0x2e2216;}};VoiceAgentReport[_0xcce7('0x21')][_0xcce7('0x19')]=function(_0x48f87f){try{if(this[_0xcce7('0x23')](_0x48f87f)){if(this[_0xcce7('0xa')][_0x48f87f[_0xcce7('0x25')]]){for(var _0x539522 in this['channels'][_0x48f87f[_0xcce7('0x25')]]){if(this[_0xcce7('0xa')][_0x48f87f[_0xcce7('0x25')]][_0xcce7('0x37')](_0x539522)){if(this[_0xcce7('0xa')][_0x48f87f['uniqueid']][_0x539522][_0xcce7('0x45')]==_0xcce7('0x54')&&this['channels'][_0x48f87f[_0xcce7('0x25')]][_0x539522][_0xcce7('0x15')]){this['channels'][_0x48f87f[_0xcce7('0x25')]][_0x539522][_0xcce7('0x52')]=moment()[_0xcce7('0x31')](_0xcce7('0x27'));}}}ami[_0xcce7('0x22')](_0xcce7('0x6e'),_['values'](this['channels'][_0x48f87f[_0xcce7('0x25')]]));delete this['channels'][_0x48f87f[_0xcce7('0x25')]];}if(this[_0xcce7('0xd')][_0x48f87f[_0xcce7('0x25')]]){delete this[_0xcce7('0xd')][_0x48f87f['uniqueid']];}}}catch(_0x2acaed){logger[_0xcce7('0x35')]('[syncHangup][VoiceAgentReport]',util[_0xcce7('0x4b')](_0x2acaed,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xcce7('0x21')][_0xcce7('0x1e')]=function(_0x213244){try{if(this[_0xcce7('0x23')](_0x213244)){if(this[_0xcce7('0xa')][_0x213244[_0xcce7('0x6f')]]){for(var _0x5b62ed in this[_0xcce7('0xa')][_0x213244['transfereeuniqueid']]){if(this[_0xcce7('0xa')][_0x213244[_0xcce7('0x6f')]][_0xcce7('0x37')](_0x5b62ed)){if(_0x213244[_0xcce7('0x70')]===_0x5b62ed){var _0xd8fa68=moment();this[_0xcce7('0xa')][_0x213244[_0xcce7('0x6f')]][_0x5b62ed]['agentcomplete']=!![];this['channels'][_0x213244[_0xcce7('0x6f')]][_0x5b62ed][_0xcce7('0x52')]=moment()[_0xcce7('0x31')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xcce7('0xa')][_0x213244[_0xcce7('0x6f')]][_0x5b62ed][_0xcce7('0x45')]=_0xcce7('0x54');this[_0xcce7('0xa')][_0x213244['transfereeuniqueid']][_0x5b62ed][_0xcce7('0x39')]=_0xcce7('0x71');this[_0xcce7('0xa')][_0x213244[_0xcce7('0x6f')]][_0x5b62ed][_0xcce7('0x53')]=_0xd8fa68['diff'](this[_0xcce7('0xa')][_0x213244['transfereeuniqueid']][_0x5b62ed][_0xcce7('0x38')],_0xcce7('0x72'));}}}}if(this[_0xcce7('0xa')][_0x213244['secondtransfereruniqueid']]){var _0x456404=this[_0xcce7('0xa')][_0x213244[_0xcce7('0x73')]];this[_0xcce7('0xa')][_0x213244[_0xcce7('0x73')]]=this[_0xcce7('0xa')][_0x213244[_0xcce7('0x6f')]];this[_0xcce7('0xa')][_0x213244[_0xcce7('0x6f')]]=_0x456404;}}}catch(_0x819c2c){logger[_0xcce7('0x35')]('[syncAttendedTransfer][VoiceAgentReport]',util[_0xcce7('0x4b')](_0x819c2c,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xcce7('0x21')]['syncBlindTransfer']=function(_0x58ae20){try{if(this[_0xcce7('0x23')](_0x58ae20)){if(this['channels'][_0x58ae20[_0xcce7('0x6f')]]){for(var _0x188e75 in this[_0xcce7('0xa')][_0x58ae20['transfereeuniqueid']]){if(this[_0xcce7('0xa')][_0x58ae20[_0xcce7('0x6f')]][_0xcce7('0x37')](_0x188e75)){if(_0x58ae20[_0xcce7('0x74')]===_0x188e75){var _0x221370=moment();this['channels'][_0x58ae20[_0xcce7('0x6f')]][_0x188e75]['agentcomplete']=!![];this[_0xcce7('0xa')][_0x58ae20['transfereeuniqueid']][_0x188e75][_0xcce7('0x52')]=_0x221370;this[_0xcce7('0xa')][_0x58ae20[_0xcce7('0x6f')]][_0x188e75][_0xcce7('0x45')]='transfer';this['channels'][_0x58ae20[_0xcce7('0x6f')]][_0x188e75]['lastevent']=_0xcce7('0x71');this[_0xcce7('0xa')][_0x58ae20[_0xcce7('0x6f')]][_0x188e75][_0xcce7('0x53')]=_0x221370[_0xcce7('0x75')](this[_0xcce7('0xa')][_0x58ae20[_0xcce7('0x6f')]][_0x188e75][_0xcce7('0x38')],_0xcce7('0x72'));}}}}}}catch(_0x5dc791){logger[_0xcce7('0x35')](_0xcce7('0x76'),util[_0xcce7('0x4b')](_0x5dc791,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0xcce7('0x1b')]=function(_0x3c472b){var _0x3489c2='';try{if(this[_0xcce7('0x23')](_0x3c472b)){if(_0x3c472b['channel']){_0x3489c2=_0x3c472b['channel'][_0xcce7('0x77')](0x0,_0x3c472b['channel'][_0xcce7('0x78')]('-'));if(this[_0xcce7('0xc')][_0x3489c2]){this['agents'][_0x3489c2][_0xcce7('0x79')]=!![];}}}}catch(_0x1bd89f){logger[_0xcce7('0x35')](_0xcce7('0x7a'),util[_0xcce7('0x4b')](_0x1bd89f,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xcce7('0x21')][_0xcce7('0x1d')]=function(_0x1593bd){var _0x50c519='';try{if(this[_0xcce7('0x23')](_0x1593bd)){if(_0x1593bd[_0xcce7('0x7b')]){_0x50c519=_0x1593bd['channel'][_0xcce7('0x77')](0x0,_0x1593bd['channel']['lastIndexOf']('-'));if(this['agents'][_0x50c519]){this['agents'][_0x50c519][_0xcce7('0x79')]=![];}}}}catch(_0x4cfa2a){logger[_0xcce7('0x35')](_0xcce7('0x7c'),util[_0xcce7('0x4b')](_0x4cfa2a,{'showHidden':![],'depth':null}));}};module[_0xcce7('0x7d')]=VoiceAgentReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceCallReport.js b/server/services/ami/report/voiceCallReport.js index a388e80..134f21f 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 _0x1159=['YYYY-MM-DD\x20HH:mm:ss','disposition','toNumber','channelstate','context','from-sip','channel','split','exten','user:%s','user:agentconnect','accountcode','application','toLowerCase','applicationdata','isUndefined','starttime','subtract','duration','seconds','format','includes','lastapplication','lastdata','startsWith','cdr(','match','[syncNewExten][VoiceCallReport]','answered','answertime','holdtime','diff','calleridnum','xcally-motion-preview','connectedlinenum','connectedlinename','destinationchannel','name','UserId','membername','inspect','syncMixMonitorFilename','.wav49','.WAV','monitorFilename','monitors','isNil','push','rec','value','variable','xmd-callerid','callerid','xmd-cdrtype','xmd-queue','xmd-originatecalleridnum','originatecalleridnum','xmd-destination','xmd-callerid-preview','xmcs-queue','sipcallid','sipcalluniqueid','parse','sipcalllinkedid','[syncVarSet][VoiceCallReport]','endtime','billableseconds','omit','destconnectedlinenum','emit','user:agentcomplete','custom:voiceCallReport','[syncHangup][VoiceCallReport]','transfereeuniqueid','transfercalleridnum','transferconnectedlinenum','transfertargetcalleridnum','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','transfereecalleridnum','extension','BlindTransfer','transfererchannel','[syncBlindTransfer][VoiceCallReport]','mohstarttime','[syncMusicOnHoldStart][VoiceCallReport]','mohtime','[syncMusicOnHoldStop][VoiceCallReport]','exports','bluebird','util','path','ioredis','../../../config/environment','../../../config/logger','ami','../ami','../model/channel','not_inuse','inuse','busy','invalid','unavailable','ringing','ringinuse','set','queue','playback','NO\x20ANSWER','FAILED','ANSWERED','BUSY','redis','defaults','socket.io-emitter','channels','agents','syncNewExten','bind','newchannel','syncNewChannel','newstate','syncNewState','varset','syncVarSet','hangup','syncHangup','newcallerid','syncNewCallerId','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','resolve','then','actionCoreShowChannels','catch','log','prototype','isNotNull','uniqueid','linkedid','merge','pick','keys','error','[syncNewCallerId][VoiceCallReport]','OutgoingSpoolFailed'];(function(_0x30cb8a,_0x413da8){var _0x28f4f5=function(_0x1baa88){while(--_0x1baa88){_0x30cb8a['push'](_0x30cb8a['shift']());}};_0x28f4f5(++_0x413da8);}(_0x1159,0xf3));var _0x9115=function(_0x2a4ae6,_0x5f4ad5){_0x2a4ae6=_0x2a4ae6-0x0;var _0x4102f9=_0x1159[_0x2a4ae6];return _0x4102f9;};'use strict';var BPromise=require(_0x9115('0x0'));var _=require('lodash');var moment=require('moment');var util=require(_0x9115('0x1'));var path=require(_0x9115('0x2'));var Redis=require(_0x9115('0x3'));var config=require(_0x9115('0x4'));var logger=require(_0x9115('0x5'))(_0x9115('0x6'));var ami=require(_0x9115('0x7'));var Channel=require(_0x9115('0x8'));var statusDesc=['unknown',_0x9115('0x9'),_0x9115('0xa'),_0x9115('0xb'),_0x9115('0xc'),_0x9115('0xd'),_0x9115('0xe'),_0x9115('0xf'),'onhold'];var applications=[_0x9115('0x10'),_0x9115('0x11'),'agi','dial',_0x9115('0x12'),'voicemail'];var dispositions=[_0x9115('0x13'),_0x9115('0x14'),_0x9115('0x14'),_0x9115('0x13'),'NO\x20ANSWER',_0x9115('0x13'),_0x9115('0x15'),_0x9115('0x16'),_0x9115('0x14'),_0x9115('0x14'),_0x9115('0x14')];var actions={};config[_0x9115('0x17')]=_[_0x9115('0x18')](config[_0x9115('0x17')],{'host':'localhost','port':0x18eb});var io=require(_0x9115('0x19'))(new Redis(config['redis']));function VoiceCallReport(_0x1bfd8c){this['channels']=_0x1bfd8c[_0x9115('0x1a')];this[_0x9115('0x1b')]=_0x1bfd8c[_0x9115('0x1b')];ami['on']('coreshowchannel',this['syncNewExten']['bind'](this));ami['on']('newexten',this[_0x9115('0x1c')][_0x9115('0x1d')](this));ami['on'](_0x9115('0x1e'),this[_0x9115('0x1f')]['bind'](this));ami['on'](_0x9115('0x20'),this[_0x9115('0x21')][_0x9115('0x1d')](this));ami['on'](_0x9115('0x22'),this[_0x9115('0x23')][_0x9115('0x1d')](this));ami['on'](_0x9115('0x24'),this[_0x9115('0x25')][_0x9115('0x1d')](this));ami['on'](_0x9115('0x26'),this[_0x9115('0x27')]['bind'](this));ami['on'](_0x9115('0x28'),this[_0x9115('0x29')][_0x9115('0x1d')](this));ami['on'](_0x9115('0x2a'),this[_0x9115('0x2b')][_0x9115('0x1d')](this));ami['on'](_0x9115('0x2c'),this[_0x9115('0x2d')][_0x9115('0x1d')](this));ami['on'](_0x9115('0x2e'),this[_0x9115('0x2f')][_0x9115('0x1d')](this));return BPromise[_0x9115('0x30')]()[_0x9115('0x31')](ami[_0x9115('0x32')]())[_0x9115('0x33')](function(_0x3ffd2d){console[_0x9115('0x34')](_0x3ffd2d);});}VoiceCallReport[_0x9115('0x35')][_0x9115('0x36')]=function(_0x470666){return _0x470666!==null&&!_['isUndefined'](_0x470666);};VoiceCallReport[_0x9115('0x35')]['emit']=function(_0x2eae39,_0x1940a1,_0x27644c){io['to'](_0x2eae39)['emit'](_0x1940a1,_0x27644c);};VoiceCallReport[_0x9115('0x35')][_0x9115('0x27')]=function(_0x511ef){try{if(this['isNotNull'](_0x511ef)){if(_0x511ef[_0x9115('0x37')]===_0x511ef[_0x9115('0x38')]){if(!_['isUndefined'](this[_0x9115('0x1a')][_0x511ef['uniqueid']])){_[_0x9115('0x39')](this[_0x9115('0x1a')][_0x511ef[_0x9115('0x37')]],_[_0x9115('0x3a')](_0x511ef,_[_0x9115('0x3b')](this[_0x9115('0x1a')][_0x511ef[_0x9115('0x37')]])));}}}}catch(_0x418d21){logger[_0x9115('0x3c')](_0x9115('0x3d'),util['inspect'](_0x418d21,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x9115('0x35')][_0x9115('0x1f')]=function(_0x1f134c){try{if(this[_0x9115('0x36')](_0x1f134c)){if(_0x1f134c[_0x9115('0x37')]===_0x1f134c[_0x9115('0x38')]&&_0x1f134c['channel']!=_0x9115('0x3e')){if(_['isUndefined'](this[_0x9115('0x1a')][_0x1f134c[_0x9115('0x37')]])){this[_0x9115('0x1a')][_0x1f134c[_0x9115('0x37')]]=new Channel();this[_0x9115('0x1a')][_0x1f134c[_0x9115('0x37')]]['starttime']=moment()['format'](_0x9115('0x3f'));this[_0x9115('0x1a')][_0x1f134c[_0x9115('0x37')]][_0x9115('0x40')]=dispositions[_[_0x9115('0x41')](_0x1f134c[_0x9115('0x42')])];_[_0x9115('0x39')](this[_0x9115('0x1a')][_0x1f134c[_0x9115('0x37')]],_[_0x9115('0x3a')](_0x1f134c,_[_0x9115('0x3b')](this[_0x9115('0x1a')][_0x1f134c[_0x9115('0x37')]])));if(_0x1f134c[_0x9115('0x43')]===_0x9115('0x44')){if(this['agents'][_0x1f134c[_0x9115('0x45')][_0x9115('0x46')]('-')[0x0]]){this[_0x9115('0x1b')][_0x1f134c[_0x9115('0x45')]['split']('-')[0x0]]['destconnectedlinenum']=_0x1f134c[_0x9115('0x47')];this['emit'](util['format'](_0x9115('0x48'),this[_0x9115('0x1b')][_0x1f134c[_0x9115('0x45')][_0x9115('0x46')]('-')[0x0]]['name']),_0x9115('0x49'),{'destaccountcode':this[_0x9115('0x1b')][_0x1f134c['channel'][_0x9115('0x46')]('-')[0x0]][_0x9115('0x4a')],'destconnectedlinenum':_0x1f134c[_0x9115('0x47')]});}}}}}}catch(_0x5f0a0d){logger[_0x9115('0x3c')]('[syncNewChannel][VoiceCallReport]',util['inspect'](_0x5f0a0d,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x9115('0x1c')]=function(_0x45d7d8){try{if(this[_0x9115('0x36')](_0x45d7d8)){if(_0x45d7d8[_0x9115('0x37')]===_0x45d7d8[_0x9115('0x38')]&&_0x45d7d8['exten']!='h'&&_0x45d7d8['channel']!=_0x9115('0x3e')){_0x45d7d8[_0x9115('0x4b')]=_0x45d7d8[_0x9115('0x4b')][_0x9115('0x4c')]();_0x45d7d8[_0x9115('0x4d')]=(_0x45d7d8['appdata']||_0x45d7d8['applicationdata'])[_0x9115('0x4c')]();if(_[_0x9115('0x4e')](this['channels'][_0x45d7d8[_0x9115('0x37')]])){this[_0x9115('0x1a')][_0x45d7d8[_0x9115('0x37')]]=new Channel();this[_0x9115('0x1a')][_0x45d7d8[_0x9115('0x37')]][_0x9115('0x4f')]=_0x45d7d8['duration']?moment()[_0x9115('0x50')](moment[_0x9115('0x51')](_0x45d7d8[_0x9115('0x51')])[_0x9115('0x52')](),'seconds')[_0x9115('0x53')](_0x9115('0x3f')):moment()[_0x9115('0x53')](_0x9115('0x3f'));this['channels'][_0x45d7d8['uniqueid']]['disposition']=_0x9115('0x13');}_[_0x9115('0x39')](this[_0x9115('0x1a')][_0x45d7d8[_0x9115('0x37')]],_['pick'](_0x45d7d8,_[_0x9115('0x3b')](this[_0x9115('0x1a')][_0x45d7d8[_0x9115('0x37')]])));if(_[_0x9115('0x54')](applications,_0x45d7d8[_0x9115('0x4b')])){this['channels'][_0x45d7d8[_0x9115('0x37')]][_0x9115('0x55')]=_0x45d7d8[_0x9115('0x4b')];this[_0x9115('0x1a')][_0x45d7d8[_0x9115('0x37')]][_0x9115('0x56')]=_0x45d7d8[_0x9115('0x4d')];if(_0x45d7d8[_0x9115('0x4b')]==='set'&&_[_0x9115('0x57')](_0x45d7d8[_0x9115('0x4d')],_0x9115('0x58'))){var _0x97543c=_0x45d7d8[_0x9115('0x4d')]['split']('=');var _0x1e30dc=_0x97543c[0x0][_0x9115('0x59')](/cdr\((.*)\)/);if(_0x1e30dc){this[_0x9115('0x1a')][_0x45d7d8['uniqueid']][_0x1e30dc[0x1]]=_0x97543c[0x1];}}else if(_0x45d7d8[_0x9115('0x4b')]===_0x9115('0x11')){this[_0x9115('0x1a')][_0x45d7d8[_0x9115('0x37')]][_0x9115('0x11')]=_0x45d7d8[_0x9115('0x4d')][_0x9115('0x46')](',')[0x0];}}}}}catch(_0x50a631){logger[_0x9115('0x3c')](_0x9115('0x5a'),util['inspect'](_0x50a631,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x9115('0x35')][_0x9115('0x21')]=function(_0x520326){try{if(this[_0x9115('0x36')](_0x520326)){if(_0x520326[_0x9115('0x37')]!==_0x520326['linkedid']){if(this[_0x9115('0x1a')][_0x520326['linkedid']]){if(_0x520326['channelstate']==='6'){if(!this['channels'][_0x520326[_0x9115('0x38')]]['answered']){var _0x5e2e9f=moment();this['channels'][_0x520326[_0x9115('0x38')]][_0x9115('0x5b')]=!![];this[_0x9115('0x1a')][_0x520326[_0x9115('0x38')]][_0x9115('0x5c')]=_0x5e2e9f[_0x9115('0x53')](_0x9115('0x3f'));if(this[_0x9115('0x1a')][_0x520326[_0x9115('0x38')]][_0x9115('0x4f')]){this[_0x9115('0x1a')][_0x520326[_0x9115('0x38')]][_0x9115('0x5d')]=_0x5e2e9f[_0x9115('0x5e')](this[_0x9115('0x1a')][_0x520326[_0x9115('0x38')]]['starttime'],_0x9115('0x52'));}}this[_0x9115('0x1a')][_0x520326[_0x9115('0x38')]]['linkedid']=_0x520326['uniqueid'];if(_0x520326[_0x9115('0x5f')]!==_0x9115('0x60')){this[_0x9115('0x1a')][_0x520326[_0x9115('0x38')]][_0x9115('0x61')]=_0x520326[_0x9115('0x5f')];}this[_0x9115('0x1a')][_0x520326[_0x9115('0x38')]][_0x9115('0x62')]=_0x520326['calleridname'];this['channels'][_0x520326[_0x9115('0x38')]][_0x9115('0x63')]=_0x520326[_0x9115('0x45')];this[_0x9115('0x1a')][_0x520326['linkedid']][_0x9115('0x40')]=dispositions[_[_0x9115('0x41')](_0x520326[_0x9115('0x42')])];if(this['agents'][_0x520326[_0x9115('0x45')]['split']('-')[0x0]]){this[_0x9115('0x1a')][_0x520326[_0x9115('0x38')]]['UserId']=this[_0x9115('0x1b')][_0x520326[_0x9115('0x45')]['split']('-')[0x0]]['id'];this[_0x9115('0x1a')][_0x520326['linkedid']]['membername']=this[_0x9115('0x1b')][_0x520326[_0x9115('0x45')]['split']('-')[0x0]][_0x9115('0x64')];}}}}else{if(this[_0x9115('0x1a')][_0x520326[_0x9115('0x37')]]){if(_0x520326[_0x9115('0x42')]==='6'){if(this[_0x9115('0x1b')][_0x520326[_0x9115('0x45')]['split']('-')[0x0]]){this[_0x9115('0x1a')][_0x520326[_0x9115('0x37')]][_0x9115('0x65')]=this['agents'][_0x520326[_0x9115('0x45')]['split']('-')[0x0]]['id'];this['channels'][_0x520326[_0x9115('0x37')]][_0x9115('0x66')]=this['agents'][_0x520326[_0x9115('0x45')][_0x9115('0x46')]('-')[0x0]]['name'];}}}}}}catch(_0x1bee44){logger[_0x9115('0x3c')]('[syncNewState][VoiceCallReport]',util[_0x9115('0x67')](_0x1bee44,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x9115('0x35')][_0x9115('0x68')]=function(_0x314606,_0xd0c22a){if(this[_0x9115('0x1a')][_0x314606]){this[_0x9115('0x1a')][_0x314606]['monitor']=!![];if(_['endsWith'](_0xd0c22a,_0x9115('0x69'))){_0xd0c22a=_0xd0c22a['replace'](_0x9115('0x69'),_0x9115('0x6a'));}this['channels'][_0x314606][_0x9115('0x6b')]=_0xd0c22a;var _0x40671c=_['find'](this[_0x9115('0x1a')][_0x314606][_0x9115('0x6c')],{'filename':_0xd0c22a});if(_[_0x9115('0x6d')](_0x40671c)){this[_0x9115('0x1a')][_0x314606][_0x9115('0x6c')][_0x9115('0x6e')]({'filename':_0xd0c22a,'createdAt':moment()[_0x9115('0x53')](_0x9115('0x3f')),'mixmonitorid':'','status':_0x9115('0x6f')});}}};VoiceCallReport[_0x9115('0x35')]['syncVarSet']=function(_0x29298c){try{if(this[_0x9115('0x36')](_0x29298c)){if(this[_0x9115('0x1a')][_0x29298c[_0x9115('0x37')]]&&_0x29298c['channel']!=_0x9115('0x3e')){if(this[_0x9115('0x36')](_0x29298c['variable'])){if(this[_0x9115('0x36')](_0x29298c['variable']['mixmonitor_filename'])){this[_0x9115('0x68')](_0x29298c[_0x9115('0x37')],_0x29298c[_0x9115('0x70')]);}else if(this[_0x9115('0x36')](_0x29298c[_0x9115('0x71')]['xmd-phone'])){this[_0x9115('0x1a')][_0x29298c[_0x9115('0x37')]][_0x9115('0x5f')]=_0x29298c[_0x9115('0x70')];}else if(this[_0x9115('0x36')](_0x29298c[_0x9115('0x71')][_0x9115('0x72')])){this[_0x9115('0x1a')][_0x29298c['uniqueid']][_0x9115('0x73')]=_0x29298c[_0x9115('0x70')];}else if(this[_0x9115('0x36')](_0x29298c[_0x9115('0x71')][_0x9115('0x74')])){this[_0x9115('0x1a')][_0x29298c[_0x9115('0x37')]]['type']=_0x29298c['value'];}else if(this[_0x9115('0x36')](_0x29298c['variable'][_0x9115('0x75')])){this[_0x9115('0x1a')][_0x29298c['uniqueid']][_0x9115('0x11')]=_0x29298c['value'][_0x9115('0x46')](',')[0x0];}else if(this['isNotNull'](_0x29298c['variable'][_0x9115('0x76')])){this[_0x9115('0x1a')][_0x29298c['uniqueid']][_0x9115('0x77')]=_0x29298c[_0x9115('0x70')];}else if(this[_0x9115('0x36')](_0x29298c[_0x9115('0x71')][_0x9115('0x78')])){this[_0x9115('0x1a')][_0x29298c[_0x9115('0x37')]]['destination']=_0x29298c['value'];}else if(this['isNotNull'](_0x29298c[_0x9115('0x71')][_0x9115('0x79')])){this[_0x9115('0x1a')][_0x29298c[_0x9115('0x37')]]['calleridpreview']=_0x29298c[_0x9115('0x70')];}else if(this['isNotNull'](_0x29298c[_0x9115('0x71')][_0x9115('0x7a')])){this['channels'][_0x29298c[_0x9115('0x37')]][_0x9115('0x11')]=_0x29298c[_0x9115('0x70')];}else if(this[_0x9115('0x36')](_0x29298c['variable'][_0x9115('0x7b')])){this[_0x9115('0x1a')][_0x29298c[_0x9115('0x37')]][_0x9115('0x7c')]=_0x29298c[_0x9115('0x70')];}}}else if(this[_0x9115('0x36')](_0x29298c[_0x9115('0x71')]['mixmonitor_filename'])){if(_0x29298c[_0x9115('0x70')]){var _0xc812ae=path[_0x9115('0x7d')](_0x29298c[_0x9115('0x70')])[_0x9115('0x64')];this[_0x9115('0x68')](_0xc812ae,_0x29298c[_0x9115('0x70')]);}}else if(this[_0x9115('0x1a')][_0x29298c[_0x9115('0x38')]]){if(this[_0x9115('0x36')](_0x29298c[_0x9115('0x71')])){if(this[_0x9115('0x36')](_0x29298c[_0x9115('0x71')][_0x9115('0x7b')])){this[_0x9115('0x1a')][_0x29298c['linkedid']][_0x9115('0x7e')]=_0x29298c[_0x9115('0x70')];}}}}}catch(_0x505b1a){logger['error'](_0x9115('0x7f'),util['inspect'](_0x505b1a,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x9115('0x35')][_0x9115('0x25')]=function(_0x1c34d6){try{if(this[_0x9115('0x36')](_0x1c34d6)){if(this[_0x9115('0x1a')][_0x1c34d6[_0x9115('0x37')]]){var _0x3462be=moment();this[_0x9115('0x1a')][_0x1c34d6[_0x9115('0x37')]][_0x9115('0x80')]=_0x3462be[_0x9115('0x53')](_0x9115('0x3f'));this['channels'][_0x1c34d6[_0x9115('0x37')]]['duration']=_0x3462be[_0x9115('0x5e')](this['channels'][_0x1c34d6[_0x9115('0x37')]][_0x9115('0x4f')],_0x9115('0x52'));if(this['channels'][_0x1c34d6[_0x9115('0x37')]][_0x9115('0x5b')]){this['channels'][_0x1c34d6[_0x9115('0x37')]]['billableseconds']=_0x3462be[_0x9115('0x5e')](this[_0x9115('0x1a')][_0x1c34d6[_0x9115('0x37')]][_0x9115('0x5c')],_0x9115('0x52'));this[_0x9115('0x1a')][_0x1c34d6[_0x9115('0x37')]]['holdtime']=this[_0x9115('0x1a')][_0x1c34d6['uniqueid']][_0x9115('0x51')]-this[_0x9115('0x1a')][_0x1c34d6['uniqueid']][_0x9115('0x81')];}if(_0x1c34d6[_0x9115('0x43')]==='from-sip'){if(this['agents'][_0x1c34d6[_0x9115('0x45')][_0x9115('0x46')]('-')[0x0]]){this[_0x9115('0x1b')][_0x1c34d6[_0x9115('0x45')][_0x9115('0x46')]('-')[0x0]]=_[_0x9115('0x82')](this[_0x9115('0x1b')][_0x1c34d6['channel'][_0x9115('0x46')]('-')[0x0]],[_0x9115('0x83')]);this[_0x9115('0x84')](util[_0x9115('0x53')](_0x9115('0x48'),this[_0x9115('0x1b')][_0x1c34d6[_0x9115('0x45')][_0x9115('0x46')]('-')[0x0]][_0x9115('0x64')]),_0x9115('0x85'),{'destaccountcode':this['agents'][_0x1c34d6[_0x9115('0x45')][_0x9115('0x46')]('-')[0x0]][_0x9115('0x4a')]});}}ami[_0x9115('0x84')](_0x9115('0x86'),this[_0x9115('0x1a')][_0x1c34d6[_0x9115('0x37')]]);delete this[_0x9115('0x1a')][_0x1c34d6[_0x9115('0x37')]];}}}catch(_0xa81a81){logger['error'](_0x9115('0x87'),util['inspect'](_0xa81a81,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x9115('0x35')][_0x9115('0x29')]=function(_0x652503){try{if(this[_0x9115('0x36')](_0x652503)){if(this['channels'][_0x652503[_0x9115('0x88')]]){this['channels'][_0x652503[_0x9115('0x88')]][_0x9115('0x89')]=_0x652503['origtransferercalleridnum'];this[_0x9115('0x1a')][_0x652503[_0x9115('0x88')]][_0x9115('0x8a')]=_0x652503[_0x9115('0x8b')];if(this['channels'][_0x652503['secondtransfereruniqueid']]){var _0x3592ca=this[_0x9115('0x1a')][_0x652503[_0x9115('0x8c')]];this[_0x9115('0x1a')][_0x652503[_0x9115('0x8c')]]=this[_0x9115('0x1a')][_0x652503[_0x9115('0x88')]];this['channels'][_0x652503[_0x9115('0x88')]]=_0x3592ca;}}else if(this[_0x9115('0x1a')][_0x652503[_0x9115('0x8d')]]){this[_0x9115('0x1a')][_0x652503['transfertargetuniqueid']][_0x9115('0x89')]=_0x652503['origtransferercalleridnum'];this['channels'][_0x652503[_0x9115('0x8d')]][_0x9115('0x8a')]=_0x652503[_0x9115('0x8b')];if(this['channels'][_0x652503[_0x9115('0x8e')]]){var _0x3592ca=this[_0x9115('0x1a')][_0x652503[_0x9115('0x8e')]];this['channels'][_0x652503['origtransfereruniqueid']]=this['channels'][_0x652503['transfertargetuniqueid']];this['channels'][_0x652503[_0x9115('0x8d')]]=_0x3592ca;}}}}catch(_0x138f3b){logger[_0x9115('0x3c')]('[syncAttendedTransfer][VoiceCallReport]',util['inspect'](_0x138f3b,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x9115('0x2b')]=function(_0x4f2ded){try{if(this['isNotNull'](_0x4f2ded)){if(this['channels'][_0x4f2ded[_0x9115('0x88')]]){this['channels'][_0x4f2ded[_0x9115('0x88')]][_0x9115('0x89')]=_0x4f2ded[_0x9115('0x8f')];this[_0x9115('0x1a')][_0x4f2ded[_0x9115('0x88')]]['transferconnectedlinenum']=_0x4f2ded[_0x9115('0x90')];this[_0x9115('0x25')]({'event':_0x9115('0x91'),'uniqueid':_0x4f2ded[_0x9115('0x88')],'context':_0x4f2ded['context'],'channel':_0x4f2ded[_0x9115('0x92')]});}}}catch(_0x3ce84d){logger['error'](_0x9115('0x93'),util['inspect'](_0x3ce84d,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x9115('0x2d')]=function(_0x2d3128){try{if(this[_0x9115('0x36')](_0x2d3128)){if(this['channels'][_0x2d3128[_0x9115('0x37')]]){if(!_[_0x9115('0x6d')](this[_0x9115('0x1a')][_0x2d3128[_0x9115('0x37')]]['answertime'])){this[_0x9115('0x1a')][_0x2d3128[_0x9115('0x37')]][_0x9115('0x94')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}}}}catch(_0x56e811){logger[_0x9115('0x3c')](_0x9115('0x95'),util[_0x9115('0x67')](_0x56e811,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x9115('0x35')][_0x9115('0x2f')]=function(_0x37641b){try{if(this[_0x9115('0x36')](_0x37641b)){if(this[_0x9115('0x1a')][_0x37641b[_0x9115('0x37')]]){if(!_['isNil'](this[_0x9115('0x1a')][_0x37641b['uniqueid']][_0x9115('0x94')])){this[_0x9115('0x1a')][_0x37641b['uniqueid']][_0x9115('0x96')]+=moment()['milliseconds'](0x0)[_0x9115('0x5e')](this[_0x9115('0x1a')][_0x37641b[_0x9115('0x37')]]['mohstarttime'],_0x9115('0x52'));delete this[_0x9115('0x1a')][_0x37641b[_0x9115('0x37')]][_0x9115('0x94')];}}}}catch(_0x423914){logger['error'](_0x9115('0x97'),util[_0x9115('0x67')](_0x423914,{'showHidden':![],'depth':null}));}};module[_0x9115('0x98')]=VoiceCallReport; \ No newline at end of file +var _0xfcb8=['lastapplication','startsWith','cdr(','match','queue','[syncNewExten][VoiceCallReport]','answered','answertime','starttime','holdtime','diff','calleridnum','xcally-motion-preview','connectedlinenum','calleridname','destinationchannel','disposition','UserId','membername','[syncNewState][VoiceCallReport]','syncMixMonitorFilename','monitor','endsWith','.wav49','replace','.WAV','monitorFilename','find','monitors','push','rec','variable','mixmonitor_filename','xmd-phone','value','xmd-callerid','callerid','xmd-cdrtype','xmd-queue','xmd-originatecalleridnum','originatecalleridnum','xmd-destination','xmd-callerid-preview','sipcallid','parse','sipcalllinkedid','endtime','billableseconds','from-sip','omit','user:agentcomplete','accountcode','transfereeuniqueid','transfercalleridnum','origtransferercalleridnum','transferconnectedlinenum','transfertargetcalleridnum','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[syncAttendedTransfer][VoiceCallReport]','transfereecalleridnum','extension','BlindTransfer','[syncBlindTransfer][VoiceCallReport]','isNil','mohstarttime','[syncMusicOnHoldStart][VoiceCallReport]','mohtime','milliseconds','[syncMusicOnHoldStop][VoiceCallReport]','exports','bluebird','lodash','moment','ioredis','../../../config/environment','../../../config/logger','ami','../ami','../model/channel','unknown','not_inuse','busy','invalid','ringing','ringinuse','onhold','set','agi','dial','playback','voicemail','NO\x20ANSWER','FAILED','ANSWERED','BUSY','defaults','redis','socket.io-emitter','channels','coreshowchannel','syncNewExten','bind','newexten','newchannel','syncNewChannel','syncNewState','syncVarSet','hangup','syncHangup','newcallerid','syncNewCallerId','syncAttendedTransfer','blindtransfer','musiconholdstart','syncMusicOnHoldStart','syncMusicOnHoldStop','resolve','then','actionCoreShowChannels','catch','prototype','isNotNull','uniqueid','isUndefined','merge','pick','keys','error','[syncNewCallerId][VoiceCallReport]','linkedid','channel','format','toNumber','channelstate','context','agents','split','destconnectedlinenum','exten','emit','user:%s','name','inspect','OutgoingSpoolFailed','application','toLowerCase','applicationdata','appdata','duration','subtract','seconds','YYYY-MM-DD\x20HH:mm:ss','includes'];(function(_0x2e6ef8,_0x3813bd){var _0x3221d2=function(_0x1f6fbc){while(--_0x1f6fbc){_0x2e6ef8['push'](_0x2e6ef8['shift']());}};_0x3221d2(++_0x3813bd);}(_0xfcb8,0x17e));var _0x8fcb=function(_0x171fdc,_0x16ae91){_0x171fdc=_0x171fdc-0x0;var _0x3782ea=_0xfcb8[_0x171fdc];return _0x3782ea;};'use strict';var BPromise=require(_0x8fcb('0x0'));var _=require(_0x8fcb('0x1'));var moment=require(_0x8fcb('0x2'));var util=require('util');var path=require('path');var Redis=require(_0x8fcb('0x3'));var config=require(_0x8fcb('0x4'));var logger=require(_0x8fcb('0x5'))(_0x8fcb('0x6'));var ami=require(_0x8fcb('0x7'));var Channel=require(_0x8fcb('0x8'));var statusDesc=[_0x8fcb('0x9'),_0x8fcb('0xa'),'inuse',_0x8fcb('0xb'),_0x8fcb('0xc'),'unavailable',_0x8fcb('0xd'),_0x8fcb('0xe'),_0x8fcb('0xf')];var applications=[_0x8fcb('0x10'),'queue',_0x8fcb('0x11'),_0x8fcb('0x12'),_0x8fcb('0x13'),_0x8fcb('0x14')];var dispositions=[_0x8fcb('0x15'),_0x8fcb('0x16'),_0x8fcb('0x16'),_0x8fcb('0x15'),_0x8fcb('0x15'),'NO\x20ANSWER',_0x8fcb('0x17'),_0x8fcb('0x18'),_0x8fcb('0x16'),_0x8fcb('0x16'),_0x8fcb('0x16')];var actions={};config['redis']=_[_0x8fcb('0x19')](config[_0x8fcb('0x1a')],{'host':'localhost','port':0x18eb});var io=require(_0x8fcb('0x1b'))(new Redis(config[_0x8fcb('0x1a')]));function VoiceCallReport(_0x399e4a){this[_0x8fcb('0x1c')]=_0x399e4a[_0x8fcb('0x1c')];this['agents']=_0x399e4a['agents'];ami['on'](_0x8fcb('0x1d'),this[_0x8fcb('0x1e')][_0x8fcb('0x1f')](this));ami['on'](_0x8fcb('0x20'),this[_0x8fcb('0x1e')][_0x8fcb('0x1f')](this));ami['on'](_0x8fcb('0x21'),this[_0x8fcb('0x22')]['bind'](this));ami['on']('newstate',this[_0x8fcb('0x23')][_0x8fcb('0x1f')](this));ami['on']('varset',this[_0x8fcb('0x24')][_0x8fcb('0x1f')](this));ami['on'](_0x8fcb('0x25'),this[_0x8fcb('0x26')][_0x8fcb('0x1f')](this));ami['on'](_0x8fcb('0x27'),this[_0x8fcb('0x28')][_0x8fcb('0x1f')](this));ami['on']('attendedtransfer',this[_0x8fcb('0x29')][_0x8fcb('0x1f')](this));ami['on'](_0x8fcb('0x2a'),this['syncBlindTransfer'][_0x8fcb('0x1f')](this));ami['on'](_0x8fcb('0x2b'),this[_0x8fcb('0x2c')][_0x8fcb('0x1f')](this));ami['on']('musiconholdstop',this[_0x8fcb('0x2d')][_0x8fcb('0x1f')](this));return BPromise[_0x8fcb('0x2e')]()[_0x8fcb('0x2f')](ami[_0x8fcb('0x30')]())[_0x8fcb('0x31')](function(_0x4ccde0){console['log'](_0x4ccde0);});}VoiceCallReport[_0x8fcb('0x32')][_0x8fcb('0x33')]=function(_0xdd046c){return _0xdd046c!==null&&!_['isUndefined'](_0xdd046c);};VoiceCallReport[_0x8fcb('0x32')]['emit']=function(_0x2ee9bc,_0x4f1a20,_0x4bdc83){io['to'](_0x2ee9bc)['emit'](_0x4f1a20,_0x4bdc83);};VoiceCallReport[_0x8fcb('0x32')][_0x8fcb('0x28')]=function(_0x294d21){try{if(this[_0x8fcb('0x33')](_0x294d21)){if(_0x294d21[_0x8fcb('0x34')]===_0x294d21['linkedid']){if(!_[_0x8fcb('0x35')](this[_0x8fcb('0x1c')][_0x294d21['uniqueid']])){_[_0x8fcb('0x36')](this[_0x8fcb('0x1c')][_0x294d21[_0x8fcb('0x34')]],_[_0x8fcb('0x37')](_0x294d21,_[_0x8fcb('0x38')](this[_0x8fcb('0x1c')][_0x294d21['uniqueid']])));}}}}catch(_0x5dd5b2){logger[_0x8fcb('0x39')](_0x8fcb('0x3a'),util['inspect'](_0x5dd5b2,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x8fcb('0x22')]=function(_0x433f5f){try{if(this['isNotNull'](_0x433f5f)){if(_0x433f5f['uniqueid']===_0x433f5f[_0x8fcb('0x3b')]&&_0x433f5f[_0x8fcb('0x3c')]!='OutgoingSpoolFailed'){if(_[_0x8fcb('0x35')](this[_0x8fcb('0x1c')][_0x433f5f[_0x8fcb('0x34')]])){this[_0x8fcb('0x1c')][_0x433f5f[_0x8fcb('0x34')]]=new Channel();this['channels'][_0x433f5f['uniqueid']]['starttime']=moment()[_0x8fcb('0x3d')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x433f5f[_0x8fcb('0x34')]]['disposition']=dispositions[_[_0x8fcb('0x3e')](_0x433f5f[_0x8fcb('0x3f')])];_[_0x8fcb('0x36')](this['channels'][_0x433f5f['uniqueid']],_['pick'](_0x433f5f,_[_0x8fcb('0x38')](this['channels'][_0x433f5f[_0x8fcb('0x34')]])));if(_0x433f5f[_0x8fcb('0x40')]==='from-sip'){if(this[_0x8fcb('0x41')][_0x433f5f[_0x8fcb('0x3c')]['split']('-')[0x0]]){this[_0x8fcb('0x41')][_0x433f5f[_0x8fcb('0x3c')][_0x8fcb('0x42')]('-')[0x0]][_0x8fcb('0x43')]=_0x433f5f[_0x8fcb('0x44')];this[_0x8fcb('0x45')](util[_0x8fcb('0x3d')](_0x8fcb('0x46'),this[_0x8fcb('0x41')][_0x433f5f[_0x8fcb('0x3c')][_0x8fcb('0x42')]('-')[0x0]][_0x8fcb('0x47')]),'user:agentconnect',{'destaccountcode':this['agents'][_0x433f5f[_0x8fcb('0x3c')][_0x8fcb('0x42')]('-')[0x0]]['accountcode'],'destconnectedlinenum':_0x433f5f[_0x8fcb('0x44')]});}}}}}}catch(_0x11d124){logger['error']('[syncNewChannel][VoiceCallReport]',util[_0x8fcb('0x48')](_0x11d124,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x8fcb('0x32')][_0x8fcb('0x1e')]=function(_0x3a9831){try{if(this[_0x8fcb('0x33')](_0x3a9831)){if(_0x3a9831[_0x8fcb('0x34')]===_0x3a9831[_0x8fcb('0x3b')]&&_0x3a9831[_0x8fcb('0x44')]!='h'&&_0x3a9831[_0x8fcb('0x3c')]!=_0x8fcb('0x49')){_0x3a9831['application']=_0x3a9831[_0x8fcb('0x4a')][_0x8fcb('0x4b')]();_0x3a9831[_0x8fcb('0x4c')]=(_0x3a9831[_0x8fcb('0x4d')]||_0x3a9831['applicationdata'])[_0x8fcb('0x4b')]();if(_['isUndefined'](this[_0x8fcb('0x1c')][_0x3a9831[_0x8fcb('0x34')]])){this[_0x8fcb('0x1c')][_0x3a9831[_0x8fcb('0x34')]]=new Channel();this[_0x8fcb('0x1c')][_0x3a9831[_0x8fcb('0x34')]]['starttime']=_0x3a9831[_0x8fcb('0x4e')]?moment()[_0x8fcb('0x4f')](moment['duration'](_0x3a9831[_0x8fcb('0x4e')])['seconds'](),_0x8fcb('0x50'))['format'](_0x8fcb('0x51')):moment()['format'](_0x8fcb('0x51'));this[_0x8fcb('0x1c')][_0x3a9831[_0x8fcb('0x34')]]['disposition']=_0x8fcb('0x15');}_[_0x8fcb('0x36')](this[_0x8fcb('0x1c')][_0x3a9831[_0x8fcb('0x34')]],_[_0x8fcb('0x37')](_0x3a9831,_['keys'](this[_0x8fcb('0x1c')][_0x3a9831['uniqueid']])));if(_[_0x8fcb('0x52')](applications,_0x3a9831[_0x8fcb('0x4a')])){this[_0x8fcb('0x1c')][_0x3a9831[_0x8fcb('0x34')]][_0x8fcb('0x53')]=_0x3a9831[_0x8fcb('0x4a')];this['channels'][_0x3a9831[_0x8fcb('0x34')]]['lastdata']=_0x3a9831[_0x8fcb('0x4c')];if(_0x3a9831[_0x8fcb('0x4a')]===_0x8fcb('0x10')&&_[_0x8fcb('0x54')](_0x3a9831[_0x8fcb('0x4c')],_0x8fcb('0x55'))){var _0x4d09b8=_0x3a9831[_0x8fcb('0x4c')]['split']('=');var _0x4f0914=_0x4d09b8[0x0][_0x8fcb('0x56')](/cdr\((.*)\)/);if(_0x4f0914){this['channels'][_0x3a9831['uniqueid']][_0x4f0914[0x1]]=_0x4d09b8[0x1];}}else if(_0x3a9831[_0x8fcb('0x4a')]===_0x8fcb('0x57')){this[_0x8fcb('0x1c')][_0x3a9831[_0x8fcb('0x34')]][_0x8fcb('0x57')]=_0x3a9831['applicationdata']['split'](',')[0x0];}}}}}catch(_0x1fb38d){logger[_0x8fcb('0x39')](_0x8fcb('0x58'),util['inspect'](_0x1fb38d,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype']['syncNewState']=function(_0x487078){try{if(this[_0x8fcb('0x33')](_0x487078)){if(_0x487078['uniqueid']!==_0x487078[_0x8fcb('0x3b')]){if(this[_0x8fcb('0x1c')][_0x487078[_0x8fcb('0x3b')]]){if(_0x487078[_0x8fcb('0x3f')]==='6'){if(!this[_0x8fcb('0x1c')][_0x487078[_0x8fcb('0x3b')]][_0x8fcb('0x59')]){var _0x2cdfb4=moment();this[_0x8fcb('0x1c')][_0x487078[_0x8fcb('0x3b')]][_0x8fcb('0x59')]=!![];this[_0x8fcb('0x1c')][_0x487078[_0x8fcb('0x3b')]][_0x8fcb('0x5a')]=_0x2cdfb4['format'](_0x8fcb('0x51'));if(this['channels'][_0x487078[_0x8fcb('0x3b')]][_0x8fcb('0x5b')]){this[_0x8fcb('0x1c')][_0x487078['linkedid']][_0x8fcb('0x5c')]=_0x2cdfb4[_0x8fcb('0x5d')](this[_0x8fcb('0x1c')][_0x487078[_0x8fcb('0x3b')]]['starttime'],_0x8fcb('0x50'));}}this[_0x8fcb('0x1c')][_0x487078[_0x8fcb('0x3b')]]['linkedid']=_0x487078[_0x8fcb('0x34')];if(_0x487078[_0x8fcb('0x5e')]!==_0x8fcb('0x5f')){this['channels'][_0x487078[_0x8fcb('0x3b')]][_0x8fcb('0x60')]=_0x487078[_0x8fcb('0x5e')];}this[_0x8fcb('0x1c')][_0x487078[_0x8fcb('0x3b')]]['connectedlinename']=_0x487078[_0x8fcb('0x61')];this[_0x8fcb('0x1c')][_0x487078[_0x8fcb('0x3b')]][_0x8fcb('0x62')]=_0x487078['channel'];this[_0x8fcb('0x1c')][_0x487078[_0x8fcb('0x3b')]][_0x8fcb('0x63')]=dispositions[_[_0x8fcb('0x3e')](_0x487078[_0x8fcb('0x3f')])];if(this[_0x8fcb('0x41')][_0x487078['channel'][_0x8fcb('0x42')]('-')[0x0]]){this[_0x8fcb('0x1c')][_0x487078['linkedid']][_0x8fcb('0x64')]=this[_0x8fcb('0x41')][_0x487078[_0x8fcb('0x3c')][_0x8fcb('0x42')]('-')[0x0]]['id'];this[_0x8fcb('0x1c')][_0x487078[_0x8fcb('0x3b')]][_0x8fcb('0x65')]=this[_0x8fcb('0x41')][_0x487078[_0x8fcb('0x3c')][_0x8fcb('0x42')]('-')[0x0]][_0x8fcb('0x47')];}}}}else{if(this['channels'][_0x487078[_0x8fcb('0x34')]]){if(_0x487078['channelstate']==='6'){if(this[_0x8fcb('0x41')][_0x487078[_0x8fcb('0x3c')][_0x8fcb('0x42')]('-')[0x0]]){this['channels'][_0x487078[_0x8fcb('0x34')]][_0x8fcb('0x64')]=this['agents'][_0x487078[_0x8fcb('0x3c')]['split']('-')[0x0]]['id'];this['channels'][_0x487078[_0x8fcb('0x34')]][_0x8fcb('0x65')]=this[_0x8fcb('0x41')][_0x487078['channel'][_0x8fcb('0x42')]('-')[0x0]][_0x8fcb('0x47')];}}}}}}catch(_0x20c934){logger[_0x8fcb('0x39')](_0x8fcb('0x66'),util[_0x8fcb('0x48')](_0x20c934,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x8fcb('0x32')][_0x8fcb('0x67')]=function(_0x50da34,_0x9ff72c){if(this[_0x8fcb('0x1c')][_0x50da34]){this['channels'][_0x50da34][_0x8fcb('0x68')]=!![];if(_[_0x8fcb('0x69')](_0x9ff72c,_0x8fcb('0x6a'))){_0x9ff72c=_0x9ff72c[_0x8fcb('0x6b')](_0x8fcb('0x6a'),_0x8fcb('0x6c'));}this['channels'][_0x50da34][_0x8fcb('0x6d')]=_0x9ff72c;var _0x173503=_[_0x8fcb('0x6e')](this['channels'][_0x50da34][_0x8fcb('0x6f')],{'filename':_0x9ff72c});if(_['isNil'](_0x173503)){this[_0x8fcb('0x1c')][_0x50da34]['monitors'][_0x8fcb('0x70')]({'filename':_0x9ff72c,'createdAt':moment()[_0x8fcb('0x3d')](_0x8fcb('0x51')),'mixmonitorid':'','status':_0x8fcb('0x71')});}}};VoiceCallReport[_0x8fcb('0x32')][_0x8fcb('0x24')]=function(_0x51be1c){try{if(this[_0x8fcb('0x33')](_0x51be1c)){if(this['channels'][_0x51be1c[_0x8fcb('0x34')]]&&_0x51be1c[_0x8fcb('0x3c')]!='OutgoingSpoolFailed'){if(this[_0x8fcb('0x33')](_0x51be1c[_0x8fcb('0x72')])){if(this[_0x8fcb('0x33')](_0x51be1c['variable'][_0x8fcb('0x73')])){this[_0x8fcb('0x67')](_0x51be1c[_0x8fcb('0x34')],_0x51be1c['value']);}else if(this['isNotNull'](_0x51be1c[_0x8fcb('0x72')][_0x8fcb('0x74')])){this[_0x8fcb('0x1c')][_0x51be1c['uniqueid']][_0x8fcb('0x5e')]=_0x51be1c[_0x8fcb('0x75')];}else if(this[_0x8fcb('0x33')](_0x51be1c['variable'][_0x8fcb('0x76')])){this['channels'][_0x51be1c[_0x8fcb('0x34')]][_0x8fcb('0x77')]=_0x51be1c[_0x8fcb('0x75')];}else if(this[_0x8fcb('0x33')](_0x51be1c['variable'][_0x8fcb('0x78')])){this['channels'][_0x51be1c[_0x8fcb('0x34')]]['type']=_0x51be1c[_0x8fcb('0x75')];}else if(this[_0x8fcb('0x33')](_0x51be1c[_0x8fcb('0x72')][_0x8fcb('0x79')])){this[_0x8fcb('0x1c')][_0x51be1c[_0x8fcb('0x34')]][_0x8fcb('0x57')]=_0x51be1c[_0x8fcb('0x75')][_0x8fcb('0x42')](',')[0x0];}else if(this[_0x8fcb('0x33')](_0x51be1c[_0x8fcb('0x72')][_0x8fcb('0x7a')])){this[_0x8fcb('0x1c')][_0x51be1c[_0x8fcb('0x34')]][_0x8fcb('0x7b')]=_0x51be1c[_0x8fcb('0x75')];}else if(this['isNotNull'](_0x51be1c[_0x8fcb('0x72')][_0x8fcb('0x7c')])){this[_0x8fcb('0x1c')][_0x51be1c[_0x8fcb('0x34')]]['destination']=_0x51be1c[_0x8fcb('0x75')];}else if(this[_0x8fcb('0x33')](_0x51be1c[_0x8fcb('0x72')][_0x8fcb('0x7d')])){this[_0x8fcb('0x1c')][_0x51be1c[_0x8fcb('0x34')]]['calleridpreview']=_0x51be1c[_0x8fcb('0x75')];}else if(this['isNotNull'](_0x51be1c[_0x8fcb('0x72')]['xmcs-queue'])){this[_0x8fcb('0x1c')][_0x51be1c[_0x8fcb('0x34')]]['queue']=_0x51be1c[_0x8fcb('0x75')];}else if(this[_0x8fcb('0x33')](_0x51be1c[_0x8fcb('0x72')][_0x8fcb('0x7e')])){this['channels'][_0x51be1c[_0x8fcb('0x34')]]['sipcalluniqueid']=_0x51be1c[_0x8fcb('0x75')];}}}else if(this[_0x8fcb('0x33')](_0x51be1c[_0x8fcb('0x72')]['mixmonitor_filename'])){if(_0x51be1c[_0x8fcb('0x75')]){var _0x38a48e=path[_0x8fcb('0x7f')](_0x51be1c[_0x8fcb('0x75')])[_0x8fcb('0x47')];this[_0x8fcb('0x67')](_0x38a48e,_0x51be1c['value']);}}else if(this[_0x8fcb('0x1c')][_0x51be1c[_0x8fcb('0x3b')]]){if(this[_0x8fcb('0x33')](_0x51be1c[_0x8fcb('0x72')])){if(this[_0x8fcb('0x33')](_0x51be1c['variable'][_0x8fcb('0x7e')])){this[_0x8fcb('0x1c')][_0x51be1c['linkedid']][_0x8fcb('0x80')]=_0x51be1c[_0x8fcb('0x75')];}}}}}catch(_0x37533c){logger[_0x8fcb('0x39')]('[syncVarSet][VoiceCallReport]',util[_0x8fcb('0x48')](_0x37533c,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x8fcb('0x26')]=function(_0x472018){try{if(this[_0x8fcb('0x33')](_0x472018)){if(this[_0x8fcb('0x1c')][_0x472018['uniqueid']]){var _0x394ae5=moment();this[_0x8fcb('0x1c')][_0x472018[_0x8fcb('0x34')]][_0x8fcb('0x81')]=_0x394ae5[_0x8fcb('0x3d')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x8fcb('0x1c')][_0x472018['uniqueid']][_0x8fcb('0x4e')]=_0x394ae5[_0x8fcb('0x5d')](this[_0x8fcb('0x1c')][_0x472018[_0x8fcb('0x34')]][_0x8fcb('0x5b')],_0x8fcb('0x50'));if(this[_0x8fcb('0x1c')][_0x472018[_0x8fcb('0x34')]][_0x8fcb('0x59')]){this[_0x8fcb('0x1c')][_0x472018[_0x8fcb('0x34')]]['billableseconds']=_0x394ae5[_0x8fcb('0x5d')](this[_0x8fcb('0x1c')][_0x472018[_0x8fcb('0x34')]][_0x8fcb('0x5a')],_0x8fcb('0x50'));this[_0x8fcb('0x1c')][_0x472018['uniqueid']]['holdtime']=this['channels'][_0x472018[_0x8fcb('0x34')]][_0x8fcb('0x4e')]-this[_0x8fcb('0x1c')][_0x472018['uniqueid']][_0x8fcb('0x82')];}if(_0x472018['context']===_0x8fcb('0x83')){if(this[_0x8fcb('0x41')][_0x472018['channel'][_0x8fcb('0x42')]('-')[0x0]]){this[_0x8fcb('0x41')][_0x472018[_0x8fcb('0x3c')][_0x8fcb('0x42')]('-')[0x0]]=_[_0x8fcb('0x84')](this[_0x8fcb('0x41')][_0x472018[_0x8fcb('0x3c')]['split']('-')[0x0]],['destconnectedlinenum']);this[_0x8fcb('0x45')](util[_0x8fcb('0x3d')](_0x8fcb('0x46'),this['agents'][_0x472018[_0x8fcb('0x3c')][_0x8fcb('0x42')]('-')[0x0]][_0x8fcb('0x47')]),_0x8fcb('0x85'),{'destaccountcode':this[_0x8fcb('0x41')][_0x472018[_0x8fcb('0x3c')][_0x8fcb('0x42')]('-')[0x0]][_0x8fcb('0x86')]});}}ami[_0x8fcb('0x45')]('custom:voiceCallReport',this[_0x8fcb('0x1c')][_0x472018[_0x8fcb('0x34')]]);delete this[_0x8fcb('0x1c')][_0x472018[_0x8fcb('0x34')]];}}}catch(_0xb65ca0){logger['error']('[syncHangup][VoiceCallReport]',util[_0x8fcb('0x48')](_0xb65ca0,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x8fcb('0x32')][_0x8fcb('0x29')]=function(_0xab71b3){try{if(this[_0x8fcb('0x33')](_0xab71b3)){if(this[_0x8fcb('0x1c')][_0xab71b3['transfereeuniqueid']]){this['channels'][_0xab71b3[_0x8fcb('0x87')]][_0x8fcb('0x88')]=_0xab71b3[_0x8fcb('0x89')];this[_0x8fcb('0x1c')][_0xab71b3['transfereeuniqueid']][_0x8fcb('0x8a')]=_0xab71b3[_0x8fcb('0x8b')];if(this[_0x8fcb('0x1c')][_0xab71b3[_0x8fcb('0x8c')]]){var _0x2a20c0=this[_0x8fcb('0x1c')][_0xab71b3['secondtransfereruniqueid']];this['channels'][_0xab71b3[_0x8fcb('0x8c')]]=this[_0x8fcb('0x1c')][_0xab71b3[_0x8fcb('0x87')]];this[_0x8fcb('0x1c')][_0xab71b3[_0x8fcb('0x87')]]=_0x2a20c0;}}else if(this[_0x8fcb('0x1c')][_0xab71b3[_0x8fcb('0x8d')]]){this[_0x8fcb('0x1c')][_0xab71b3[_0x8fcb('0x8d')]][_0x8fcb('0x88')]=_0xab71b3[_0x8fcb('0x89')];this[_0x8fcb('0x1c')][_0xab71b3[_0x8fcb('0x8d')]][_0x8fcb('0x8a')]=_0xab71b3[_0x8fcb('0x8b')];if(this[_0x8fcb('0x1c')][_0xab71b3[_0x8fcb('0x8e')]]){var _0x2a20c0=this[_0x8fcb('0x1c')][_0xab71b3[_0x8fcb('0x8e')]];this[_0x8fcb('0x1c')][_0xab71b3[_0x8fcb('0x8e')]]=this[_0x8fcb('0x1c')][_0xab71b3[_0x8fcb('0x8d')]];this[_0x8fcb('0x1c')][_0xab71b3[_0x8fcb('0x8d')]]=_0x2a20c0;}}}}catch(_0x2dc09e){logger['error'](_0x8fcb('0x8f'),util[_0x8fcb('0x48')](_0x2dc09e,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype']['syncBlindTransfer']=function(_0x3622a3){try{if(this[_0x8fcb('0x33')](_0x3622a3)){if(this[_0x8fcb('0x1c')][_0x3622a3['transfereeuniqueid']]){this['channels'][_0x3622a3['transfereeuniqueid']][_0x8fcb('0x88')]=_0x3622a3[_0x8fcb('0x90')];this[_0x8fcb('0x1c')][_0x3622a3[_0x8fcb('0x87')]][_0x8fcb('0x8a')]=_0x3622a3[_0x8fcb('0x91')];this[_0x8fcb('0x26')]({'event':_0x8fcb('0x92'),'uniqueid':_0x3622a3[_0x8fcb('0x87')],'context':_0x3622a3[_0x8fcb('0x40')],'channel':_0x3622a3['transfererchannel']});}}}catch(_0x205c8b){logger[_0x8fcb('0x39')](_0x8fcb('0x93'),util[_0x8fcb('0x48')](_0x205c8b,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x8fcb('0x2c')]=function(_0x2c7340){try{if(this[_0x8fcb('0x33')](_0x2c7340)){if(this['channels'][_0x2c7340['uniqueid']]){if(!_[_0x8fcb('0x94')](this[_0x8fcb('0x1c')][_0x2c7340[_0x8fcb('0x34')]][_0x8fcb('0x5a')])){this[_0x8fcb('0x1c')][_0x2c7340[_0x8fcb('0x34')]][_0x8fcb('0x95')]=moment()[_0x8fcb('0x3d')](_0x8fcb('0x51'));}}}}catch(_0x418651){logger[_0x8fcb('0x39')](_0x8fcb('0x96'),util[_0x8fcb('0x48')](_0x418651,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x8fcb('0x32')][_0x8fcb('0x2d')]=function(_0x27caff){try{if(this['isNotNull'](_0x27caff)){if(this[_0x8fcb('0x1c')][_0x27caff[_0x8fcb('0x34')]]){if(!_[_0x8fcb('0x94')](this[_0x8fcb('0x1c')][_0x27caff[_0x8fcb('0x34')]][_0x8fcb('0x95')])){this[_0x8fcb('0x1c')][_0x27caff[_0x8fcb('0x34')]][_0x8fcb('0x97')]+=moment()[_0x8fcb('0x98')](0x0)[_0x8fcb('0x5d')](this['channels'][_0x27caff[_0x8fcb('0x34')]][_0x8fcb('0x95')],_0x8fcb('0x50'));delete this[_0x8fcb('0x1c')][_0x27caff[_0x8fcb('0x34')]][_0x8fcb('0x95')];}}}}catch(_0x571e46){logger[_0x8fcb('0x39')](_0x8fcb('0x99'),util['inspect'](_0x571e46,{'showHidden':![],'depth':null}));}};module[_0x8fcb('0x9a')]=VoiceCallReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceDialReport.js b/server/services/ami/report/voiceDialReport.js index 12cd7e8..cb24d7d 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 _0x9b2e=['connect','[syncDialEnd][VoiceDialReport]','addVariable','keys','variable','value','[syncVarSet][VoiceDialReport]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','sipuri','bridgepeer','membercalls','memberdynamic','memberinterface','membername','memberpenalty','memberrealtime','isNil','variables','duration','endtime','seconds','complete','answered','diff','starttime','billableseconds','sumHoldTime','holdtime','sumBillable','sumDuration','custom:voiceDialReport','custom:dialend','voice_outbound:save','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','stringify','voice_outbound_channel:remove','[syncHangup][VoiceDialReport]','exports','moment','ioredis','../../../config/environment','../../../config/logger','ami','../ami','redis','localhost','channels','outbound','dialbegin','syncDialBegin','dialend','syncDialEnd','bind','syncVarSet','hangup','syncHangup','prototype','isNotNull','isUndefined','emit','uniqueid','format','YYYY-MM-DD\x20HH:mm:ss','called','channel','lastIndexOf','omit','voice:outbound','voice_outbound_channel:save','custom:dialbegin','error','[syncDialBegin][VoiceDialReport]','inspect','dialstatus','connectedlinenum','connectedlinename','answertime','lastevent'];(function(_0x52aba0,_0x5d8055){var _0x5200c3=function(_0x1a28a8){while(--_0x1a28a8){_0x52aba0['push'](_0x52aba0['shift']());}};_0x5200c3(++_0x5d8055);}(_0x9b2e,0x7c));var _0xe9b2=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x9b2e[_0x3ab51d];return _0x29a04e;};'use strict';var _=require('lodash');var moment=require(_0xe9b2('0x0'));var util=require('util');var Redis=require(_0xe9b2('0x1'));var config=require(_0xe9b2('0x2'));var logger=require(_0xe9b2('0x3'))(_0xe9b2('0x4'));var ami=require(_0xe9b2('0x5'));config['redis']=_['defaults'](config[_0xe9b2('0x6')],{'host':_0xe9b2('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xe9b2('0x6')]));function VoiceDialReport(_0x3fbae5){this[_0xe9b2('0x8')]=_0x3fbae5['outboundChannels'];this['outbound']=_0x3fbae5[_0xe9b2('0x9')];this['variables']={};ami['on'](_0xe9b2('0xa'),this[_0xe9b2('0xb')]['bind'](this));ami['on'](_0xe9b2('0xc'),this[_0xe9b2('0xd')][_0xe9b2('0xe')](this));ami['on']('varset',this[_0xe9b2('0xf')][_0xe9b2('0xe')](this));ami['on'](_0xe9b2('0x10'),this[_0xe9b2('0x11')]['bind'](this));}VoiceDialReport[_0xe9b2('0x12')][_0xe9b2('0x13')]=function(_0x4a39a3){return _0x4a39a3!==null&&!_[_0xe9b2('0x14')](_0x4a39a3);};VoiceDialReport[_0xe9b2('0x12')][_0xe9b2('0x15')]=function(_0x2ed13e,_0x384b02,_0x38ce94){io['to'](_0x2ed13e)[_0xe9b2('0x15')](_0x384b02,_0x38ce94);};VoiceDialReport[_0xe9b2('0x12')][_0xe9b2('0xb')]=function(_0x5c32ed){try{if(this[_0xe9b2('0x13')](_0x5c32ed)){if(this[_0xe9b2('0x8')][_0x5c32ed['uniqueid']]){_['merge'](this['channels'][_0x5c32ed[_0xe9b2('0x16')]],{'starttime':moment()[_0xe9b2('0x17')](_0xe9b2('0x18')),'lastevent':_0xe9b2('0x19'),'interface':_0x5c32ed[_0xe9b2('0x1a')]['substring'](0x0,_0x5c32ed['channel'][_0xe9b2('0x1b')]('-')),'membername':_0x5c32ed['channel']['substring'](_0x5c32ed['channel'][_0xe9b2('0x1b')]('/')+0x1,_0x5c32ed[_0xe9b2('0x1a')][_0xe9b2('0x1b')]('-'))},_[_0xe9b2('0x1c')](_0x5c32ed,['event','privilege']));this[_0xe9b2('0x15')](_0xe9b2('0x1d'),_0xe9b2('0x1e'),this[_0xe9b2('0x8')][_0x5c32ed[_0xe9b2('0x16')]]);ami['emit'](_0xe9b2('0x1f'),this['channels'][_0x5c32ed[_0xe9b2('0x16')]]);}}}catch(_0x3b0807){logger[_0xe9b2('0x20')](_0xe9b2('0x21'),util[_0xe9b2('0x22')](_0x3b0807,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xe9b2('0x12')][_0xe9b2('0xd')]=function(_0xa968f9){try{if(this['isNotNull'](_0xa968f9)){if(this[_0xe9b2('0x8')][_0xa968f9['uniqueid']]){this[_0xe9b2('0x8')][_0xa968f9[_0xe9b2('0x16')]][_0xe9b2('0x23')]=_0xa968f9['dialstatus'];if(_0xa968f9['dialstatus']==='ANSWER'){this[_0xe9b2('0x8')][_0xa968f9[_0xe9b2('0x16')]][_0xe9b2('0x24')]=_0xa968f9[_0xe9b2('0x24')];this[_0xe9b2('0x8')][_0xa968f9[_0xe9b2('0x16')]]['connectedlinename']=_0xa968f9[_0xe9b2('0x25')];this[_0xe9b2('0x8')][_0xa968f9[_0xe9b2('0x16')]][_0xe9b2('0x26')]=moment()[_0xe9b2('0x17')](_0xe9b2('0x18'));this['channels'][_0xa968f9[_0xe9b2('0x16')]][_0xe9b2('0x27')]=_0xe9b2('0x28');ami[_0xe9b2('0x15')]('custom:dialconnect',this['channels'][_0xa968f9[_0xe9b2('0x16')]]);}this[_0xe9b2('0x15')](_0xe9b2('0x1d'),_0xe9b2('0x1e'),this[_0xe9b2('0x8')][_0xa968f9[_0xe9b2('0x16')]]);}}}catch(_0x370c9a){logger[_0xe9b2('0x20')](_0xe9b2('0x29'),util[_0xe9b2('0x22')](_0x370c9a,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xe9b2('0x12')]['syncVarSet']=function(_0x5a71be){try{if(this[_0xe9b2('0x13')](_0x5a71be)){this[_0xe9b2('0x2a')](_0x5a71be[_0xe9b2('0x16')],_[_0xe9b2('0x2b')](_0x5a71be[_0xe9b2('0x2c')])[0x0],_0x5a71be[_0xe9b2('0x2d')]);if(this[_0xe9b2('0x13')](_0x5a71be['variable'])&&this[_0xe9b2('0x13')](_0x5a71be[_0xe9b2('0x2c')]['outboundrouteid'])){if(_[_0xe9b2('0x14')](this[_0xe9b2('0x8')][_0x5a71be[_0xe9b2('0x16')]])){this[_0xe9b2('0x8')][_0x5a71be['uniqueid']]={'routeId':_0x5a71be[_0xe9b2('0x2d')],'variables':this['variables'][_0x5a71be[_0xe9b2('0x16')]]};this['emit']('voice:outbound',_0xe9b2('0x1e'),this[_0xe9b2('0x8')][_0x5a71be[_0xe9b2('0x16')]]);}}}}catch(_0x3f8bb7){logger[_0xe9b2('0x20')](_0xe9b2('0x2e'),util['inspect'](_0x3f8bb7,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xe9b2('0x12')][_0xe9b2('0x2a')]=function(_0x658338,_0x53b589,_0x4aae9d){var _0x20e4aa=[_0xe9b2('0x2f'),_0xe9b2('0x30'),'rtpaudioqosjitter',_0xe9b2('0x31'),_0xe9b2('0x32'),_0xe9b2('0x33'),'rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid',_0xe9b2('0x34'),_0xe9b2('0x35'),'bridgepvtcallid',_0xe9b2('0x36'),_0xe9b2('0x37'),_0xe9b2('0x38'),'memberlastcall',_0xe9b2('0x39'),_0xe9b2('0x3a'),_0xe9b2('0x3b')];if(!_[_0xe9b2('0x3c')](_0x53b589)&&!_['includes'](_0x20e4aa,_0x53b589)){if(_[_0xe9b2('0x14')](this[_0xe9b2('0x3d')][_0x658338])){this['variables'][_0x658338]={};}this[_0xe9b2('0x3d')][_0x658338][_0x53b589]=_0x4aae9d;}};VoiceDialReport[_0xe9b2('0x12')][_0xe9b2('0x11')]=function(_0x48f4f6){try{if(this[_0xe9b2('0x13')](_0x48f4f6)){if(this['channels'][_0x48f4f6[_0xe9b2('0x16')]]){this[_0xe9b2('0x8')][_0x48f4f6[_0xe9b2('0x16')]]['endtime']=moment()['format'](_0xe9b2('0x18'));this[_0xe9b2('0x8')][_0x48f4f6[_0xe9b2('0x16')]][_0xe9b2('0x3e')]=moment(this['channels'][_0x48f4f6['uniqueid']][_0xe9b2('0x3f')])['diff'](this[_0xe9b2('0x8')][_0x48f4f6['uniqueid']]['starttime'],_0xe9b2('0x40'));this[_0xe9b2('0x8')][_0x48f4f6[_0xe9b2('0x16')]]['lastevent']=_0xe9b2('0x41');this[_0xe9b2('0x9')]['total']+=0x1;if(this['channels'][_0x48f4f6[_0xe9b2('0x16')]]['answertime']){this[_0xe9b2('0x9')][_0xe9b2('0x42')]+=0x1;this[_0xe9b2('0x8')][_0x48f4f6[_0xe9b2('0x16')]]['holdtime']=moment(this[_0xe9b2('0x8')][_0x48f4f6[_0xe9b2('0x16')]]['answertime'])[_0xe9b2('0x43')](this[_0xe9b2('0x8')][_0x48f4f6[_0xe9b2('0x16')]][_0xe9b2('0x44')],_0xe9b2('0x40'));this[_0xe9b2('0x8')][_0x48f4f6[_0xe9b2('0x16')]][_0xe9b2('0x45')]=moment(this[_0xe9b2('0x8')][_0x48f4f6[_0xe9b2('0x16')]][_0xe9b2('0x3f')])[_0xe9b2('0x43')](this[_0xe9b2('0x8')][_0x48f4f6[_0xe9b2('0x16')]][_0xe9b2('0x26')],_0xe9b2('0x40'));this[_0xe9b2('0x9')][_0xe9b2('0x46')]+=this[_0xe9b2('0x8')][_0x48f4f6[_0xe9b2('0x16')]][_0xe9b2('0x47')]||0x0;this['outbound'][_0xe9b2('0x48')]+=this[_0xe9b2('0x8')][_0x48f4f6['uniqueid']][_0xe9b2('0x45')];}this[_0xe9b2('0x9')][_0xe9b2('0x49')]+=this[_0xe9b2('0x8')][_0x48f4f6[_0xe9b2('0x16')]][_0xe9b2('0x3e')];ami[_0xe9b2('0x15')](_0xe9b2('0x4a'),this[_0xe9b2('0x8')][_0x48f4f6[_0xe9b2('0x16')]]);ami[_0xe9b2('0x15')](_0xe9b2('0x4b'),this[_0xe9b2('0x8')][_0x48f4f6[_0xe9b2('0x16')]]);this[_0xe9b2('0x15')]('voice:outbound',_0xe9b2('0x4c'),this[_0xe9b2('0x9')]);logger['info'](_0xe9b2('0x4d'),JSON[_0xe9b2('0x4e')](this[_0xe9b2('0x8')][_0x48f4f6['uniqueid']]));this[_0xe9b2('0x15')](_0xe9b2('0x1d'),_0xe9b2('0x4f'),this[_0xe9b2('0x8')][_0x48f4f6[_0xe9b2('0x16')]]);delete this[_0xe9b2('0x8')][_0x48f4f6[_0xe9b2('0x16')]];}if(this[_0xe9b2('0x3d')][_0x48f4f6['uniqueid']]){delete this[_0xe9b2('0x3d')][_0x48f4f6['uniqueid']];}}}catch(_0x44358e){logger[_0xe9b2('0x20')](_0xe9b2('0x50'),util[_0xe9b2('0x22')](_0x44358e,{'showHidden':![],'depth':null}));}};module[_0xe9b2('0x51')]=VoiceDialReport; \ No newline at end of file +var _0xc3b8=['memberlastcall','membername','memberpenalty','memberrealtime','includes','endtime','starttime','seconds','complete','total','answered','holdtime','diff','sumHoldTime','sumBillable','sumDuration','duration','custom:voiceDialReport','custom:dialend','stringify','voice_outbound_channel:remove','exports','lodash','moment','util','ioredis','../../../config/environment','../../../config/logger','ami','redis','defaults','localhost','socket.io-emitter','channels','outboundChannels','outbound','variables','dialbegin','bind','syncDialEnd','syncVarSet','hangup','syncHangup','prototype','isUndefined','emit','syncDialBegin','isNotNull','merge','YYYY-MM-DD\x20HH:mm:ss','called','channel','substring','lastIndexOf','event','voice:outbound','voice_outbound_channel:save','uniqueid','custom:dialbegin','[syncDialBegin][VoiceDialReport]','inspect','dialstatus','ANSWER','connectedlinenum','connectedlinename','answertime','format','lastevent','connect','error','[syncDialEnd][VoiceDialReport]','addVariable','keys','variable','value','outboundrouteid','[syncVarSet][VoiceDialReport]','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrttbridged','sipuri','bridgepeer','bridgepvtcallid','memberdynamic'];(function(_0x81be10,_0x416796){var _0x2333a2=function(_0x20ef7d){while(--_0x20ef7d){_0x81be10['push'](_0x81be10['shift']());}};_0x2333a2(++_0x416796);}(_0xc3b8,0x118));var _0x8c3b=function(_0x2293df,_0x475ee6){_0x2293df=_0x2293df-0x0;var _0x278975=_0xc3b8[_0x2293df];return _0x278975;};'use strict';var _=require(_0x8c3b('0x0'));var moment=require(_0x8c3b('0x1'));var util=require(_0x8c3b('0x2'));var Redis=require(_0x8c3b('0x3'));var config=require(_0x8c3b('0x4'));var logger=require(_0x8c3b('0x5'))(_0x8c3b('0x6'));var ami=require('../ami');config[_0x8c3b('0x7')]=_[_0x8c3b('0x8')](config['redis'],{'host':_0x8c3b('0x9'),'port':0x18eb});var io=require(_0x8c3b('0xa'))(new Redis(config[_0x8c3b('0x7')]));function VoiceDialReport(_0x1f2efe){this[_0x8c3b('0xb')]=_0x1f2efe[_0x8c3b('0xc')];this[_0x8c3b('0xd')]=_0x1f2efe[_0x8c3b('0xd')];this[_0x8c3b('0xe')]={};ami['on'](_0x8c3b('0xf'),this['syncDialBegin'][_0x8c3b('0x10')](this));ami['on']('dialend',this[_0x8c3b('0x11')][_0x8c3b('0x10')](this));ami['on']('varset',this[_0x8c3b('0x12')][_0x8c3b('0x10')](this));ami['on'](_0x8c3b('0x13'),this[_0x8c3b('0x14')][_0x8c3b('0x10')](this));}VoiceDialReport[_0x8c3b('0x15')]['isNotNull']=function(_0x4d79c4){return _0x4d79c4!==null&&!_[_0x8c3b('0x16')](_0x4d79c4);};VoiceDialReport[_0x8c3b('0x15')][_0x8c3b('0x17')]=function(_0x420e83,_0x41f062,_0x39f052){io['to'](_0x420e83)[_0x8c3b('0x17')](_0x41f062,_0x39f052);};VoiceDialReport[_0x8c3b('0x15')][_0x8c3b('0x18')]=function(_0x21727a){try{if(this[_0x8c3b('0x19')](_0x21727a)){if(this['channels'][_0x21727a['uniqueid']]){_[_0x8c3b('0x1a')](this[_0x8c3b('0xb')][_0x21727a['uniqueid']],{'starttime':moment()['format'](_0x8c3b('0x1b')),'lastevent':_0x8c3b('0x1c'),'interface':_0x21727a[_0x8c3b('0x1d')][_0x8c3b('0x1e')](0x0,_0x21727a[_0x8c3b('0x1d')][_0x8c3b('0x1f')]('-')),'membername':_0x21727a['channel'][_0x8c3b('0x1e')](_0x21727a[_0x8c3b('0x1d')][_0x8c3b('0x1f')]('/')+0x1,_0x21727a[_0x8c3b('0x1d')][_0x8c3b('0x1f')]('-'))},_['omit'](_0x21727a,[_0x8c3b('0x20'),'privilege']));this[_0x8c3b('0x17')](_0x8c3b('0x21'),_0x8c3b('0x22'),this[_0x8c3b('0xb')][_0x21727a[_0x8c3b('0x23')]]);ami[_0x8c3b('0x17')](_0x8c3b('0x24'),this[_0x8c3b('0xb')][_0x21727a[_0x8c3b('0x23')]]);}}}catch(_0x386c89){logger['error'](_0x8c3b('0x25'),util[_0x8c3b('0x26')](_0x386c89,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype']['syncDialEnd']=function(_0x2221c9){try{if(this[_0x8c3b('0x19')](_0x2221c9)){if(this[_0x8c3b('0xb')][_0x2221c9['uniqueid']]){this[_0x8c3b('0xb')][_0x2221c9['uniqueid']][_0x8c3b('0x27')]=_0x2221c9[_0x8c3b('0x27')];if(_0x2221c9[_0x8c3b('0x27')]===_0x8c3b('0x28')){this[_0x8c3b('0xb')][_0x2221c9[_0x8c3b('0x23')]][_0x8c3b('0x29')]=_0x2221c9['connectedlinenum'];this[_0x8c3b('0xb')][_0x2221c9[_0x8c3b('0x23')]]['connectedlinename']=_0x2221c9[_0x8c3b('0x2a')];this[_0x8c3b('0xb')][_0x2221c9[_0x8c3b('0x23')]][_0x8c3b('0x2b')]=moment()[_0x8c3b('0x2c')](_0x8c3b('0x1b'));this[_0x8c3b('0xb')][_0x2221c9[_0x8c3b('0x23')]][_0x8c3b('0x2d')]=_0x8c3b('0x2e');ami[_0x8c3b('0x17')]('custom:dialconnect',this['channels'][_0x2221c9[_0x8c3b('0x23')]]);}this[_0x8c3b('0x17')](_0x8c3b('0x21'),'voice_outbound_channel:save',this[_0x8c3b('0xb')][_0x2221c9['uniqueid']]);}}}catch(_0x4e401e){logger[_0x8c3b('0x2f')](_0x8c3b('0x30'),util[_0x8c3b('0x26')](_0x4e401e,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x8c3b('0x15')][_0x8c3b('0x12')]=function(_0x395466){try{if(this['isNotNull'](_0x395466)){this[_0x8c3b('0x31')](_0x395466[_0x8c3b('0x23')],_[_0x8c3b('0x32')](_0x395466[_0x8c3b('0x33')])[0x0],_0x395466[_0x8c3b('0x34')]);if(this[_0x8c3b('0x19')](_0x395466['variable'])&&this[_0x8c3b('0x19')](_0x395466[_0x8c3b('0x33')][_0x8c3b('0x35')])){if(_[_0x8c3b('0x16')](this[_0x8c3b('0xb')][_0x395466[_0x8c3b('0x23')]])){this[_0x8c3b('0xb')][_0x395466['uniqueid']]={'routeId':_0x395466[_0x8c3b('0x34')],'variables':this['variables'][_0x395466[_0x8c3b('0x23')]]};this[_0x8c3b('0x17')](_0x8c3b('0x21'),_0x8c3b('0x22'),this['channels'][_0x395466[_0x8c3b('0x23')]]);}}}}catch(_0x1de39a){logger['error'](_0x8c3b('0x36'),util[_0x8c3b('0x26')](_0x1de39a,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x8c3b('0x15')]['addVariable']=function(_0x1a6f45,_0x156619,_0x3b7fb9){var _0x1a2fa9=[_0x8c3b('0x37'),'rtpaudioqosbridged',_0x8c3b('0x38'),_0x8c3b('0x39'),'rtpaudioqosloss',_0x8c3b('0x3a'),'rtpaudioqosrtt',_0x8c3b('0x3b'),'sipcallid',_0x8c3b('0x3c'),_0x8c3b('0x3d'),_0x8c3b('0x3e'),'membercalls',_0x8c3b('0x3f'),'memberinterface',_0x8c3b('0x40'),_0x8c3b('0x41'),_0x8c3b('0x42'),_0x8c3b('0x43')];if(!_['isNil'](_0x156619)&&!_[_0x8c3b('0x44')](_0x1a2fa9,_0x156619)){if(_['isUndefined'](this[_0x8c3b('0xe')][_0x1a6f45])){this[_0x8c3b('0xe')][_0x1a6f45]={};}this[_0x8c3b('0xe')][_0x1a6f45][_0x156619]=_0x3b7fb9;}};VoiceDialReport[_0x8c3b('0x15')][_0x8c3b('0x14')]=function(_0x33ff5f){try{if(this[_0x8c3b('0x19')](_0x33ff5f)){if(this[_0x8c3b('0xb')][_0x33ff5f[_0x8c3b('0x23')]]){this[_0x8c3b('0xb')][_0x33ff5f[_0x8c3b('0x23')]][_0x8c3b('0x45')]=moment()['format'](_0x8c3b('0x1b'));this[_0x8c3b('0xb')][_0x33ff5f['uniqueid']]['duration']=moment(this['channels'][_0x33ff5f[_0x8c3b('0x23')]][_0x8c3b('0x45')])['diff'](this[_0x8c3b('0xb')][_0x33ff5f[_0x8c3b('0x23')]][_0x8c3b('0x46')],_0x8c3b('0x47'));this[_0x8c3b('0xb')][_0x33ff5f[_0x8c3b('0x23')]][_0x8c3b('0x2d')]=_0x8c3b('0x48');this[_0x8c3b('0xd')][_0x8c3b('0x49')]+=0x1;if(this[_0x8c3b('0xb')][_0x33ff5f['uniqueid']][_0x8c3b('0x2b')]){this['outbound'][_0x8c3b('0x4a')]+=0x1;this['channels'][_0x33ff5f['uniqueid']][_0x8c3b('0x4b')]=moment(this[_0x8c3b('0xb')][_0x33ff5f['uniqueid']][_0x8c3b('0x2b')])[_0x8c3b('0x4c')](this[_0x8c3b('0xb')][_0x33ff5f['uniqueid']][_0x8c3b('0x46')],_0x8c3b('0x47'));this[_0x8c3b('0xb')][_0x33ff5f[_0x8c3b('0x23')]]['billableseconds']=moment(this[_0x8c3b('0xb')][_0x33ff5f[_0x8c3b('0x23')]][_0x8c3b('0x45')])[_0x8c3b('0x4c')](this[_0x8c3b('0xb')][_0x33ff5f[_0x8c3b('0x23')]][_0x8c3b('0x2b')],_0x8c3b('0x47'));this[_0x8c3b('0xd')][_0x8c3b('0x4d')]+=this[_0x8c3b('0xb')][_0x33ff5f[_0x8c3b('0x23')]][_0x8c3b('0x4b')]||0x0;this[_0x8c3b('0xd')][_0x8c3b('0x4e')]+=this[_0x8c3b('0xb')][_0x33ff5f[_0x8c3b('0x23')]]['billableseconds'];}this[_0x8c3b('0xd')][_0x8c3b('0x4f')]+=this['channels'][_0x33ff5f[_0x8c3b('0x23')]][_0x8c3b('0x50')];ami[_0x8c3b('0x17')](_0x8c3b('0x51'),this[_0x8c3b('0xb')][_0x33ff5f[_0x8c3b('0x23')]]);ami['emit'](_0x8c3b('0x52'),this['channels'][_0x33ff5f['uniqueid']]);this[_0x8c3b('0x17')](_0x8c3b('0x21'),'voice_outbound:save',this[_0x8c3b('0xd')]);logger['info']('[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event',JSON[_0x8c3b('0x53')](this[_0x8c3b('0xb')][_0x33ff5f['uniqueid']]));this['emit']('voice:outbound',_0x8c3b('0x54'),this['channels'][_0x33ff5f[_0x8c3b('0x23')]]);delete this[_0x8c3b('0xb')][_0x33ff5f['uniqueid']];}if(this[_0x8c3b('0xe')][_0x33ff5f[_0x8c3b('0x23')]]){delete this['variables'][_0x33ff5f['uniqueid']];}}}catch(_0x466e95){logger['error']('[syncHangup][VoiceDialReport]',util[_0x8c3b('0x26')](_0x466e95,{'showHidden':![],'depth':null}));}};module[_0x8c3b('0x55')]=VoiceDialReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceQueueReport.js b/server/services/ami/report/voiceQueueReport.js index 01a6d1e..68d0062 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 _0xe26b=['toLowerCase','local/','linkedid','seconds','FORWARDTRANSFER','transfertype','FORWARD','destexten','transferuniqueid','COMPLETEDBY','toUpperCase','[syncAgentComplete][VoiceQueueReport]','addVariable','variable','value','queuestatus','queueposition','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberpenalty','includes','length','unmanaged','diff','sumDuration','milliseconds','lastevent','custom:queuecallerunmanaged','custom:queuecallerabandon','custom:voiceQueueReport','[syncHangup][VoiceQueueReport]','syncAttendedTransfer','transfereeuniqueid','transferexten','secondtransfererexten','secondtransfereruniqueid','ATTENDED','transfertargetuniqueid','ATTENDEDTRANSFER','origtransfereruniqueid','[syncAttendedTransfer][VoiceQueueReport]','BLINDTRANSFER','BLIND','BlindTransfer','context','transfererchannel','[syncBlindTransfer][VoiceQueueReport]','mohstarttime','[syncMusicOnHoldStart][VoiceQueueReport]','syncMusicOnHoldStop','[syncMusicOnHoldStop][VoiceQueueReport]','exports','lodash','moment','bluebird','util','md5','ioredis','../../../config/environment','ami','../ami','../model/queueReport','defaults','redis','localhost','socket.io-emitter','prototype','tail','finally','sequence','queueReports','agents','channels','queueChannels','flagQueueSummary','variables','queuesummary','syncQueueSummary','bind','queuesummarycomplete','syncQueueSummaryComplete','queuecallerjoin','syncQueueCallerJoin','queuecallerabandon','syncQueueCallerAbandon','queuecallerleave','syncQueueCallerLeave','agentcomplete','syncAgentComplete','agentconnect','syncAgentConnect','syncVarSet','hangup','syncHangup','fullybooted','syncMusicOnHoldStart','musiconholdstop','loopQueueSummary','loopQueueShow','isUndefined','isEmpty','hasOwnProperty','originated','talking','waiting','clearZombieChannels','switch','isNil','channel','catch','message','No\x20such\x20channel','error','[voiceQueueReport][checkChannel]','[voiceQueueReport][checkQueueReport]','[voiceQueueReport][checkVariables]','syncFullyBooted','[FullyBooted]\x20clear\x20realtime','clearQueueReport','voiceQueues','campaigns','emitVoiceQueueChannelRemove','inspect','emit','emitVoiceQueueChannelSave','voice:queue:%s','name','voice_queue_channel:save','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','stringify','format','voice_queue_channel:remove','emitVoiceQueueSummary','type','strategy','answered','available','loggedIn','sumBillable','sumHoldTime','total','abandoned','Trunk','callerid','Interval','voice_queue:save','Action','queues','[queues]','then','[queuesummary]','isNotNull','queue','countBy','callers','toNumber','loggedin','custom:queuesummary','[syncQueueSummary][VoiceQueueReport]','syncNewExten','uniqueid','inbound','queuecallerjoinAt','YYYY-MM-DD\x20HH:mm:ss','position','count','merge','pick','keys','push','[syncQueueCallerJoin][VoiceQueueReport]','last','queuecallercomplete','holdtime','originalposition','queuecallerexitreason','lastAssignedTo','queuecallerleaveAt','connectedlinenum','connectedlinename','[syncQueueCallerLeave][VoiceQueueReport]','COMPLETEDBYAGENT','[syncAgentConnect][VoiceQueueReport]','queuecallerabandonAt','assigned','membername','queuecallerexit','queuecallerexitAt','transfer','reason','COMPLETED','startsWith'];(function(_0x833c88,_0x3b3238){var _0x3cefaf=function(_0x3045ca){while(--_0x3045ca){_0x833c88['push'](_0x833c88['shift']());}};_0x3cefaf(++_0x3b3238);}(_0xe26b,0x10c));var _0xbe26=function(_0x361f8f,_0x4257d1){_0x361f8f=_0x361f8f-0x0;var _0x818722=_0xe26b[_0x361f8f];return _0x818722;};'use strict';var _=require(_0xbe26('0x0'));var moment=require(_0xbe26('0x1'));var BPromise=require(_0xbe26('0x2'));var util=require(_0xbe26('0x3'));var md5=require(_0xbe26('0x4'));var Redis=require(_0xbe26('0x5'));var config=require(_0xbe26('0x6'));var logger=require('../../../config/logger')(_0xbe26('0x7'));var ami=require(_0xbe26('0x8'));var QueueReport=require(_0xbe26('0x9'));config['redis']=_[_0xbe26('0xa')](config[_0xbe26('0xb')],{'host':_0xbe26('0xc'),'port':0x18eb});var io=require(_0xbe26('0xd'))(new Redis(config['redis']));var Sequence=function(){};Sequence[_0xbe26('0xe')]['enqueue']=function(_0x2147fd){this[_0xbe26('0xf')]=this[_0xbe26('0xf')]?this[_0xbe26('0xf')][_0xbe26('0x10')](_0x2147fd):_0x2147fd();};function VoiceQueueReport(_0x6b5790){this[_0xbe26('0x11')]=new Sequence();this[_0xbe26('0x12')]={};this[_0xbe26('0x13')]=_0x6b5790['agents'];this[_0xbe26('0x14')]=_0x6b5790[_0xbe26('0x15')];this['voiceQueues']=_0x6b5790['voiceQueues'];this[_0xbe26('0x16')]=!![];this['campaigns']=_0x6b5790['campaigns'];this[_0xbe26('0x17')]={};ami['on'](_0xbe26('0x18'),this[_0xbe26('0x19')][_0xbe26('0x1a')](this));ami['on'](_0xbe26('0x1b'),this[_0xbe26('0x1c')]['bind'](this));ami['on'](_0xbe26('0x1d'),this[_0xbe26('0x1e')]['bind'](this));ami['on'](_0xbe26('0x1f'),this[_0xbe26('0x20')]['bind'](this));ami['on'](_0xbe26('0x21'),this[_0xbe26('0x22')]['bind'](this));ami['on'](_0xbe26('0x23'),this[_0xbe26('0x24')][_0xbe26('0x1a')](this));ami['on'](_0xbe26('0x25'),this[_0xbe26('0x26')][_0xbe26('0x1a')](this));ami['on']('varset',this[_0xbe26('0x27')][_0xbe26('0x1a')](this));ami['on'](_0xbe26('0x28'),this[_0xbe26('0x29')][_0xbe26('0x1a')](this));ami['on'](_0xbe26('0x2a'),this['syncFullyBooted'][_0xbe26('0x1a')](this));ami['on']('musiconholdstart',this[_0xbe26('0x2b')][_0xbe26('0x1a')](this));ami['on'](_0xbe26('0x2c'),this['syncMusicOnHoldStop'][_0xbe26('0x1a')](this));ami['on']('attendedtransfer',this['syncAttendedTransfer'][_0xbe26('0x1a')](this));ami['on']('blindtransfer',this['syncBlindTransfer']['bind'](this));this[_0xbe26('0x2d')]();this[_0xbe26('0x2e')]();}function isNotNull(_0x147d29){return _0x147d29!==null&&!_[_0xbe26('0x2f')](_0x147d29);}function clearChannels(_0x3df985){if(!_[_0xbe26('0x30')](_0x3df985)){for(var _0x1da6aa in _0x3df985){if(_0x3df985[_0xbe26('0x31')](_0x1da6aa)){delete _0x3df985[_0x1da6aa];}}}}function clearCampaigns(_0x3c2831){if(!_[_0xbe26('0x30')](_0x3c2831)){for(var _0x35e873 in _0x3c2831){if(_0x3c2831[_0xbe26('0x31')](_0x35e873)){_0x3c2831[_0x35e873][_0xbe26('0x32')]=0x0;}}}}function clearVoiceQueues(_0x4980b7){if(!_[_0xbe26('0x30')](_0x4980b7)){for(var _0x48e53b in _0x4980b7){if(_0x4980b7[_0xbe26('0x31')](_0x48e53b)){_0x4980b7[_0x48e53b]['originated']=0x0;_0x4980b7[_0x48e53b][_0xbe26('0x33')]=0x0;_0x4980b7[_0x48e53b]['pTalking']=0x0;_0x4980b7[_0x48e53b][_0xbe26('0x34')]=0x0;_0x4980b7[_0x48e53b]['queueStatusComplete']=!![];}}}}function clearAgentBooked(_0x344e48){if(!_[_0xbe26('0x30')](_0x344e48)){for(var _0x10a731 in _0x344e48){if(_0x344e48[_0xbe26('0x31')](_0x10a731)){_0x344e48[_0x10a731]['unlockRR']=!![];}}}}VoiceQueueReport[_0xbe26('0xe')][_0xbe26('0x35')]=function(){var _0x52a8eb=this;for(var _0x5a0be4 in this[_0xbe26('0x14')]){if(this[_0xbe26('0x14')][_0xbe26('0x31')](_0x5a0be4)&&!this['channels'][_0x5a0be4][_0xbe26('0x36')]){this[_0xbe26('0x11')]['enqueue'](function(){if(!_[_0xbe26('0x37')](_0x52a8eb['channels'][_0x5a0be4])){return ami['Action']({'action':'status','channel':_0x52a8eb['channels'][_0x5a0be4][_0xbe26('0x38')]})[_0xbe26('0x39')](function(_0x48394f){if(_0x48394f[_0xbe26('0x3a')]===_0xbe26('0x3b')){setTimeout(function(){if(_0x52a8eb[_0xbe26('0x14')][_0x5a0be4]){delete _0x52a8eb['channels'][_0x5a0be4];logger[_0xbe26('0x3c')](_0xbe26('0x3d'),_0x5a0be4);}if(_0x52a8eb[_0xbe26('0x12')][_0x5a0be4]){delete _0x52a8eb[_0xbe26('0x12')][_0x5a0be4];logger[_0xbe26('0x3c')](_0xbe26('0x3e'),_0x5a0be4);}if(_0x52a8eb[_0xbe26('0x17')][_0x5a0be4]){delete _0x52a8eb['variables'][_0x5a0be4];logger['error'](_0xbe26('0x3f'),_0x5a0be4);}},0x1f40);}});}});}}};VoiceQueueReport[_0xbe26('0xe')][_0xbe26('0x40')]=function(){logger['error'](_0xbe26('0x41'));clearChannels(this[_0xbe26('0x14')]);this[_0xbe26('0x42')](this[_0xbe26('0x12')]);clearAgentBooked(this[_0xbe26('0x13')]);clearVoiceQueues(this[_0xbe26('0x43')]);clearCampaigns(this[_0xbe26('0x44')]);};VoiceQueueReport[_0xbe26('0xe')]['clearQueueReport']=function(_0x40d218){var _0x385223=this;if(!_[_0xbe26('0x30')](_0x40d218)){for(var _0x1aae29 in _0x40d218){if(_0x40d218[_0xbe26('0x31')](_0x1aae29)){_0x385223[_0xbe26('0x45')](_0x40d218[_0x1aae29]);delete _0x40d218[_0x1aae29];}}}};function loggerCatch(_0x50ff0e){return function(_0x4fea42){logger['error'](_0x50ff0e,util[_0xbe26('0x46')](_0x4fea42,{'showHidden':![],'depth':null}));};}VoiceQueueReport[_0xbe26('0xe')]['emit']=function(_0x1d9e49,_0x448c0b,_0x157b5b){io['to'](_0x1d9e49)[_0xbe26('0x47')](_0x448c0b,_0x157b5b);};VoiceQueueReport[_0xbe26('0xe')][_0xbe26('0x48')]=function(_0x326243){this['emit'](util['format'](_0xbe26('0x49'),_0x326243[_0xbe26('0x4a')]),_0xbe26('0x4b'),_0x326243);};VoiceQueueReport['prototype'][_0xbe26('0x45')]=function(_0x55482e){logger['info'](_0xbe26('0x4c'),JSON[_0xbe26('0x4d')](_0x55482e));this[_0xbe26('0x47')](util[_0xbe26('0x4e')](_0xbe26('0x49'),_0x55482e[_0xbe26('0x4a')]),_0xbe26('0x4f'),_0x55482e);};VoiceQueueReport[_0xbe26('0xe')][_0xbe26('0x50')]=function(_0x5ed0f3){if(_0x5ed0f3[_0xbe26('0x51')]==='inbound'){var _0x285fa7={'id':_0x5ed0f3['id'],'name':_0x5ed0f3[_0xbe26('0x4a')],'strategy':_0x5ed0f3[_0xbe26('0x52')],'answered':_0x5ed0f3[_0xbe26('0x53')],'available':_0x5ed0f3[_0xbe26('0x54')],'loggedIn':_0x5ed0f3[_0xbe26('0x55')],'pTalking':_0x5ed0f3['pTalking'],'sumBillable':_0x5ed0f3[_0xbe26('0x56')],'sumDuration':_0x5ed0f3['sumDuration'],'sumHoldTime':_0x5ed0f3[_0xbe26('0x57')]||0x0,'talking':_0x5ed0f3[_0xbe26('0x33')],'total':_0x5ed0f3[_0xbe26('0x58')],'type':_0x5ed0f3['type'],'unmanaged':_0x5ed0f3['unmanaged'],'abandoned':_0x5ed0f3[_0xbe26('0x59')],'waiting':_0x5ed0f3['waiting']};if(_0x5ed0f3[_0xbe26('0x5a')]){_0x285fa7[_0xbe26('0x5a')]={'id':_0x5ed0f3['Trunk']['id'],'name':_0x5ed0f3[_0xbe26('0x5a')][_0xbe26('0x4a')],'active':_0x5ed0f3['Trunk']['active'],'callerid':_0x5ed0f3['Trunk'][_0xbe26('0x5b')]};}if(_0x5ed0f3['Interval']){_0x285fa7[_0xbe26('0x5c')]={'id':_0x5ed0f3[_0xbe26('0x5c')]['id'],'name':_0x5ed0f3[_0xbe26('0x5c')][_0xbe26('0x4a')]};}var _0x4459bd=md5(JSON[_0xbe26('0x4d')](_0x285fa7));if(_0x5ed0f3[_0xbe26('0x4')]!==_0x4459bd){_0x5ed0f3[_0xbe26('0x4')]=_0x4459bd;this[_0xbe26('0x47')](util['format'](_0xbe26('0x49'),_0x285fa7[_0xbe26('0x4a')]),_0xbe26('0x5d'),_0x285fa7);}}};VoiceQueueReport[_0xbe26('0xe')]['isNotNull']=function(_0xa40d60){return _0xa40d60!==null&&!_[_0xbe26('0x2f')](_0xa40d60);};VoiceQueueReport['prototype'][_0xbe26('0x2e')]=function(){var _0x5a380c=this;setInterval(function(){_0x5a380c[_0xbe26('0x35')]();ami[_0xbe26('0x5e')]({'action':_0xbe26('0x5f')})[_0xbe26('0x39')](loggerCatch(_0xbe26('0x60')));},0x2710);};VoiceQueueReport['prototype'][_0xbe26('0x2d')]=function(){var _0x5f00c5=this;setInterval(function(){if(_0x5f00c5[_0xbe26('0x16')]){return ami[_0xbe26('0x5e')]({'action':_0xbe26('0x18')})[_0xbe26('0x61')](function(_0x439b63){_0x5f00c5[_0xbe26('0x16')]=![];})[_0xbe26('0x39')](loggerCatch(_0xbe26('0x62')));}},0x3e8);};VoiceQueueReport['prototype'][_0xbe26('0x19')]=function(_0x2c63ae){try{if(this[_0xbe26('0x63')](_0x2c63ae)&&this['isNotNull'](_0x2c63ae['queue'])){if(this[_0xbe26('0x43')][_0x2c63ae[_0xbe26('0x64')]]){var _0x6f0d03=_[_0xbe26('0x65')](this[_0xbe26('0x14')],'queue')[_0x2c63ae[_0xbe26('0x64')]]||0x0;var _0x4b0d58=_0x6f0d03-_0x2c63ae[_0xbe26('0x66')];if(this[_0xbe26('0x43')][_0x2c63ae['queue']][_0xbe26('0x34')]!==_[_0xbe26('0x67')](_0x2c63ae[_0xbe26('0x66')])||this[_0xbe26('0x43')][_0x2c63ae[_0xbe26('0x64')]][_0xbe26('0x55')]!==_[_0xbe26('0x67')](_0x2c63ae[_0xbe26('0x68')])||this[_0xbe26('0x43')][_0x2c63ae[_0xbe26('0x64')]][_0xbe26('0x54')]!==_['toNumber'](_0x2c63ae[_0xbe26('0x54')])||this['voiceQueues'][_0x2c63ae[_0xbe26('0x64')]][_0xbe26('0x33')]!==_0x4b0d58){this['voiceQueues'][_0x2c63ae[_0xbe26('0x64')]][_0xbe26('0x34')]=_[_0xbe26('0x67')](_0x2c63ae[_0xbe26('0x66')]);this[_0xbe26('0x43')][_0x2c63ae[_0xbe26('0x64')]]['loggedIn']=_[_0xbe26('0x67')](_0x2c63ae[_0xbe26('0x68')]);this[_0xbe26('0x43')][_0x2c63ae[_0xbe26('0x64')]]['available']=_[_0xbe26('0x67')](_0x2c63ae[_0xbe26('0x54')]);this['voiceQueues'][_0x2c63ae[_0xbe26('0x64')]][_0xbe26('0x33')]=_0x4b0d58>0x0?_0x4b0d58:0x0;this[_0xbe26('0x43')][_0x2c63ae['queue']][_0xbe26('0x33')]=this['voiceQueues'][_0x2c63ae['queue']][_0xbe26('0x33')]>_[_0xbe26('0x67')](_0x2c63ae[_0xbe26('0x68')])?_[_0xbe26('0x67')](_0x2c63ae['loggedin']):this[_0xbe26('0x43')][_0x2c63ae['queue']][_0xbe26('0x33')];this[_0xbe26('0x50')](this['voiceQueues'][_0x2c63ae[_0xbe26('0x64')]]);}ami[_0xbe26('0x47')](_0xbe26('0x69'),this[_0xbe26('0x43')][_0x2c63ae['queue']]);}}}catch(_0x5ebd42){logger[_0xbe26('0x3c')](_0xbe26('0x6a'),util[_0xbe26('0x46')](_0x5ebd42,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xbe26('0xe')][_0xbe26('0x1c')]=function(_0x14f9ca){this[_0xbe26('0x16')]=!![];};VoiceQueueReport['prototype'][_0xbe26('0x6b')]=function(_0x3db0a3){};VoiceQueueReport[_0xbe26('0xe')]['syncQueueCallerJoin']=function(_0x59d459){try{if(this[_0xbe26('0x63')](_0x59d459)){if(_[_0xbe26('0x2f')](this[_0xbe26('0x12')][_0x59d459[_0xbe26('0x6c')]])){this[_0xbe26('0x12')][_0x59d459[_0xbe26('0x6c')]]=[];this[_0xbe26('0x14')][_0x59d459['uniqueid']]={};}var _0xc8e5da=new QueueReport();_0xc8e5da[_0xbe26('0x4a')]=_0x59d459[_0xbe26('0x64')];_0xc8e5da[_0xbe26('0x51')]=this[_0xbe26('0x43')][_0xc8e5da['name']]&&this[_0xbe26('0x43')][_0xc8e5da['name']][_0xbe26('0x51')]?this[_0xbe26('0x43')][_0xc8e5da['name']][_0xbe26('0x51')]||'inbound':_0xbe26('0x6d');_0xc8e5da['queue']=_0x59d459[_0xbe26('0x64')];_0xc8e5da[_0xbe26('0x6e')]=moment()[_0xbe26('0x4e')](_0xbe26('0x6f'));_0xc8e5da['position']=_0x59d459[_0xbe26('0x70')];_0xc8e5da['count']=_0x59d459[_0xbe26('0x71')];_[_0xbe26('0x72')](_0xc8e5da,_[_0xbe26('0x73')](_0x59d459,_[_0xbe26('0x74')](_0xc8e5da)));this[_0xbe26('0x12')][_0x59d459[_0xbe26('0x6c')]][_0xbe26('0x75')](_0xc8e5da);this[_0xbe26('0x14')][_0x59d459[_0xbe26('0x6c')]]=_0xc8e5da;this['emitVoiceQueueChannelSave'](_0xc8e5da);}}catch(_0x1bfba6){logger[_0xbe26('0x3c')](_0xbe26('0x76'),util['inspect'](_0x1bfba6,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xbe26('0xe')]['syncQueueCallerAbandon']=function(_0x1bcadf){try{if(this[_0xbe26('0x63')](_0x1bcadf)){if(this[_0xbe26('0x12')][_0x1bcadf['uniqueid']]){var _0x3efaa2=_[_0xbe26('0x77')](this[_0xbe26('0x12')][_0x1bcadf[_0xbe26('0x6c')]]);_0x3efaa2[_0xbe26('0x78')]=![];_0x3efaa2['queuecallercompleteAt']=null;_0x3efaa2['holdtime']=_0x1bcadf[_0xbe26('0x79')];_0x3efaa2[_0xbe26('0x7a')]=_0x1bcadf[_0xbe26('0x7a')];_0x3efaa2['queuecallerabandon']=!![];_0x3efaa2['queuecallerabandonAt']=moment()[_0xbe26('0x4e')](_0xbe26('0x6f'));_0x3efaa2[_0xbe26('0x7b')]='ABANDONED';_0x3efaa2[_0xbe26('0x7c')]=null;this[_0xbe26('0x14')][_0x1bcadf[_0xbe26('0x6c')]]=_0x3efaa2;this[_0xbe26('0x45')](_0x3efaa2);}}}catch(_0x579484){logger['error']('[syncQueueCallerAbandon][VoiceQueueReport]',util[_0xbe26('0x46')](_0x579484,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xbe26('0xe')][_0xbe26('0x22')]=function(_0x57429c){try{if(this[_0xbe26('0x63')](_0x57429c)){if(this['queueReports'][_0x57429c[_0xbe26('0x6c')]]){var _0x48677f=_['last'](this[_0xbe26('0x12')][_0x57429c[_0xbe26('0x6c')]]);_0x48677f[_0xbe26('0x7d')]=moment()['format'](_0xbe26('0x6f'));_0x48677f[_0xbe26('0x7e')]=_0x57429c[_0xbe26('0x7e')];_0x48677f[_0xbe26('0x7f')]=_0x57429c[_0xbe26('0x7f')];this[_0xbe26('0x14')][_0x57429c[_0xbe26('0x6c')]]=_0x48677f;this[_0xbe26('0x48')](_0x48677f);}}}catch(_0x3a944b){logger['error'](_0xbe26('0x80'),util[_0xbe26('0x46')](_0x3a944b,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xbe26('0xe')]['syncAgentConnect']=function(_0x413089){try{if(this[_0xbe26('0x63')](_0x413089)){if(this[_0xbe26('0x12')][_0x413089['uniqueid']]){var _0x4ba21b=_[_0xbe26('0x77')](this[_0xbe26('0x12')][_0x413089['uniqueid']]);_0x4ba21b['queuecallercomplete']=!![];_0x4ba21b['queuecallerexitreason']=_0xbe26('0x81');}}}catch(_0x3991c6){logger[_0xbe26('0x3c')](_0xbe26('0x82'),util[_0xbe26('0x46')](_0x3991c6,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xbe26('0xe')]['syncAgentComplete']=function(_0x83578c){try{if(this[_0xbe26('0x63')](_0x83578c)){if(this[_0xbe26('0x12')][_0x83578c[_0xbe26('0x6c')]]){var _0x480b41=_[_0xbe26('0x77')](this[_0xbe26('0x12')][_0x83578c[_0xbe26('0x6c')]]);_0x480b41[_0xbe26('0x1f')]=![];_0x480b41[_0xbe26('0x83')]=null;_0x480b41[_0xbe26('0x84')]=!![];_0x480b41[_0xbe26('0x7c')]=_0x83578c[_0xbe26('0x85')];_0x480b41[_0xbe26('0x79')]=_0x83578c[_0xbe26('0x79')];_0x480b41[_0xbe26('0x78')]=!![];_0x480b41[_0xbe26('0x86')]=![];_0x480b41[_0xbe26('0x87')]=null;if(!_0x480b41[_0xbe26('0x88')]){if(_0x83578c[_0xbe26('0x89')]==_0xbe26('0x88')){_0x480b41[_0xbe26('0x7b')]=_0xbe26('0x8a');}else{if(_[_0xbe26('0x8b')](_0x83578c[_0xbe26('0x38')][_0xbe26('0x8c')](),_0xbe26('0x8d'))){if(this[_0xbe26('0x12')][_0x83578c[_0xbe26('0x8e')]]){var _0x11db24=_[_0xbe26('0x77')](this[_0xbe26('0x12')][_0x83578c[_0xbe26('0x8e')]]);_0x11db24[_0xbe26('0x78')]=![];_0x11db24[_0xbe26('0x86')]=!![];_0x11db24[_0xbe26('0x87')]=moment(_0x480b41[_0xbe26('0x6e')])['add'](_0x83578c['holdtime'],_0xbe26('0x8f'))['format']('YYYY-MM-DD\x20HH:mm:ss');_0x11db24[_0xbe26('0x7b')]=_0xbe26('0x90');_0x11db24[_0xbe26('0x88')]=!![];_0x11db24[_0xbe26('0x91')]=_0xbe26('0x92');_0x11db24['transferexten']=_0x83578c[_0xbe26('0x93')];_0x11db24[_0xbe26('0x94')]=_0x83578c[_0xbe26('0x6c')];var _0x5a8384=this['queueReports'][_0x83578c[_0xbe26('0x8e')]];this[_0xbe26('0x12')][_0x83578c[_0xbe26('0x8e')]]=this['queueReports'][_0x83578c[_0xbe26('0x6c')]];this[_0xbe26('0x12')][_0x83578c[_0xbe26('0x6c')]]=_0x5a8384;}}else{_0x480b41[_0xbe26('0x7b')]=_0xbe26('0x95')+_0x83578c[_0xbe26('0x89')][_0xbe26('0x96')]();}}}this['channels'][_0x83578c[_0xbe26('0x6c')]]=_0x480b41;this[_0xbe26('0x45')](_0x480b41);}}}catch(_0x59f1e7){logger['error'](_0xbe26('0x97'),util[_0xbe26('0x46')](_0x59f1e7,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xbe26('0xe')][_0xbe26('0x27')]=function(_0xaa7c2c){try{if(this[_0xbe26('0x63')](_0xaa7c2c)){this[_0xbe26('0x98')](_0xaa7c2c[_0xbe26('0x6c')],_['keys'](_0xaa7c2c[_0xbe26('0x99')])[0x0],_0xaa7c2c[_0xbe26('0x9a')]);if(this[_0xbe26('0x12')][_0xaa7c2c['uniqueid']]){var _0x1e8172=_[_0xbe26('0x77')](this[_0xbe26('0x12')][_0xaa7c2c['uniqueid']]);if(_0x1e8172){if(this['isNotNull'](_0xaa7c2c[_0xbe26('0x99')])&&this[_0xbe26('0x63')](_0xaa7c2c[_0xbe26('0x99')][_0xbe26('0x9b')])){switch(_0xaa7c2c[_0xbe26('0x9a')]){case'CONTINUE':_0x1e8172[_0xbe26('0x86')]=![];_0x1e8172[_0xbe26('0x87')]=null;break;default:_0x1e8172[_0xbe26('0x86')]=!![];_0x1e8172[_0xbe26('0x87')]=moment()[_0xbe26('0x4e')](_0xbe26('0x6f'));_0x1e8172[_0xbe26('0x7d')]=moment()[_0xbe26('0x4e')](_0xbe26('0x6f'));}_0x1e8172[_0xbe26('0x1f')]=![];_0x1e8172[_0xbe26('0x83')]=null;_0x1e8172['queuecallerexitreason']=_0xaa7c2c[_0xbe26('0x9a')];this[_0xbe26('0x14')][_0xaa7c2c[_0xbe26('0x6c')]]=_0x1e8172;this['emitVoiceQueueChannelRemove'](_0x1e8172);}else if(this[_0xbe26('0x63')](_0xaa7c2c['variable'])&&this[_0xbe26('0x63')](_0xaa7c2c[_0xbe26('0x99')][_0xbe26('0x9c')])){if(!_0x1e8172['queuecallerabandon']){_0x1e8172[_0xbe26('0x86')]=!![];_0x1e8172[_0xbe26('0x87')]=moment()[_0xbe26('0x4e')](_0xbe26('0x6f'));_0x1e8172['queuecallerexitreason']='EXITWITHKEY';_0x1e8172[_0xbe26('0x7d')]=moment()[_0xbe26('0x4e')](_0xbe26('0x6f'));this['channels'][_0xaa7c2c['uniqueid']]=_0x1e8172;}}_0x1e8172[_0xbe26('0x17')]=this[_0xbe26('0x17')][_0xaa7c2c[_0xbe26('0x6c')]];}}}}catch(_0x511c1c){logger['error']('[syncVarSet][VoiceQueueReport]',util['inspect'](_0x511c1c,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xbe26('0xe')][_0xbe26('0x98')]=function(_0x4dcad6,_0x2bd6c1,_0x42a81f){var _0x86c680=[_0xbe26('0x9d'),'rtpaudioqosbridged',_0xbe26('0x9e'),_0xbe26('0x9f'),_0xbe26('0xa0'),_0xbe26('0xa1'),_0xbe26('0xa2'),_0xbe26('0xa3'),_0xbe26('0xa4'),_0xbe26('0xa5'),_0xbe26('0xa6'),_0xbe26('0xa7'),_0xbe26('0xa8'),_0xbe26('0xa9'),_0xbe26('0xaa'),'memberlastcall',_0xbe26('0x85'),_0xbe26('0xab'),'memberrealtime'];if(!_[_0xbe26('0x37')](_0x2bd6c1)&&!_[_0xbe26('0xac')](_0x86c680,_0x2bd6c1)){if(_[_0xbe26('0x2f')](this[_0xbe26('0x17')][_0x4dcad6])){this['variables'][_0x4dcad6]={};}this[_0xbe26('0x17')][_0x4dcad6][_0x2bd6c1]=_0x42a81f;}};VoiceQueueReport[_0xbe26('0xe')][_0xbe26('0x29')]=function(_0x278925){try{if(this[_0xbe26('0x63')](_0x278925)){if(this[_0xbe26('0x12')][_0x278925['uniqueid']]){for(var _0x59bd4e=0x0,_0x328a9e={};_0x59bd4e0x0?_0x4daf9d:0x0;this[_0xe6ef('0x15')][_0x2fdb18[_0xe6ef('0x61')]][_0xe6ef('0x31')]=this['voiceQueues'][_0x2fdb18[_0xe6ef('0x61')]]['talking']>_[_0xe6ef('0x64')](_0x2fdb18[_0xe6ef('0x65')])?_[_0xe6ef('0x64')](_0x2fdb18[_0xe6ef('0x65')]):this[_0xe6ef('0x15')][_0x2fdb18[_0xe6ef('0x61')]][_0xe6ef('0x31')];this[_0xe6ef('0x4a')](this[_0xe6ef('0x15')][_0x2fdb18['queue']]);}ami['emit'](_0xe6ef('0x66'),this[_0xe6ef('0x15')][_0x2fdb18[_0xe6ef('0x61')]]);}}}catch(_0x193329){logger[_0xe6ef('0x3b')]('[syncQueueSummary][VoiceQueueReport]',util['inspect'](_0x193329,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xe6ef('0xc')][_0xe6ef('0x67')]=function(_0x247289){this[_0xe6ef('0x5f')]=!![];};VoiceQueueReport['prototype']['syncNewExten']=function(_0x22f637){};VoiceQueueReport[_0xe6ef('0xc')]['syncQueueCallerJoin']=function(_0x1838eb){try{if(this[_0xe6ef('0x5b')](_0x1838eb)){if(_[_0xe6ef('0x2e')](this[_0xe6ef('0x11')][_0x1838eb[_0xe6ef('0x68')]])){this[_0xe6ef('0x11')][_0x1838eb[_0xe6ef('0x68')]]=[];this['channels'][_0x1838eb[_0xe6ef('0x68')]]={};}var _0x355870=new QueueReport();_0x355870[_0xe6ef('0x47')]=_0x1838eb[_0xe6ef('0x61')];_0x355870[_0xe6ef('0x4b')]=this[_0xe6ef('0x15')][_0x355870[_0xe6ef('0x47')]]&&this[_0xe6ef('0x15')][_0x355870[_0xe6ef('0x47')]][_0xe6ef('0x4b')]?this['voiceQueues'][_0x355870['name']]['type']||_0xe6ef('0x4c'):_0xe6ef('0x4c');_0x355870[_0xe6ef('0x61')]=_0x1838eb[_0xe6ef('0x61')];_0x355870[_0xe6ef('0x69')]=moment()['format'](_0xe6ef('0x6a'));_0x355870['position']=_0x1838eb[_0xe6ef('0x6b')];_0x355870[_0xe6ef('0x6c')]=_0x1838eb[_0xe6ef('0x6c')];_[_0xe6ef('0x6d')](_0x355870,_['pick'](_0x1838eb,_[_0xe6ef('0x6e')](_0x355870)));this[_0xe6ef('0x11')][_0x1838eb[_0xe6ef('0x68')]][_0xe6ef('0x6f')](_0x355870);this[_0xe6ef('0x13')][_0x1838eb[_0xe6ef('0x68')]]=_0x355870;this[_0xe6ef('0x70')](_0x355870);}}catch(_0x1afbfe){logger['error'](_0xe6ef('0x71'),util[_0xe6ef('0x43')](_0x1afbfe,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xe6ef('0xc')][_0xe6ef('0x1f')]=function(_0x570173){try{if(this[_0xe6ef('0x5b')](_0x570173)){if(this[_0xe6ef('0x11')][_0x570173[_0xe6ef('0x68')]]){var _0x394d4f=_[_0xe6ef('0x72')](this[_0xe6ef('0x11')][_0x570173[_0xe6ef('0x68')]]);_0x394d4f['queuecallercomplete']=![];_0x394d4f[_0xe6ef('0x73')]=null;_0x394d4f[_0xe6ef('0x74')]=_0x570173[_0xe6ef('0x74')];_0x394d4f[_0xe6ef('0x75')]=_0x570173[_0xe6ef('0x75')];_0x394d4f[_0xe6ef('0x1e')]=!![];_0x394d4f[_0xe6ef('0x76')]=moment()[_0xe6ef('0x45')](_0xe6ef('0x6a'));_0x394d4f[_0xe6ef('0x77')]=_0xe6ef('0x78');_0x394d4f[_0xe6ef('0x79')]=null;this[_0xe6ef('0x13')][_0x570173[_0xe6ef('0x68')]]=_0x394d4f;this[_0xe6ef('0x42')](_0x394d4f);}}}catch(_0x16eab1){logger[_0xe6ef('0x3b')](_0xe6ef('0x7a'),util['inspect'](_0x16eab1,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xe6ef('0xc')][_0xe6ef('0x21')]=function(_0x24fef1){try{if(this['isNotNull'](_0x24fef1)){if(this[_0xe6ef('0x11')][_0x24fef1['uniqueid']]){var _0x48a019=_[_0xe6ef('0x72')](this[_0xe6ef('0x11')][_0x24fef1['uniqueid']]);_0x48a019[_0xe6ef('0x7b')]=moment()[_0xe6ef('0x45')]('YYYY-MM-DD\x20HH:mm:ss');_0x48a019[_0xe6ef('0x7c')]=_0x24fef1['connectedlinenum'];_0x48a019['connectedlinename']=_0x24fef1[_0xe6ef('0x7d')];this[_0xe6ef('0x13')][_0x24fef1['uniqueid']]=_0x48a019;this[_0xe6ef('0x70')](_0x48a019);}}}catch(_0xd3beeb){logger[_0xe6ef('0x3b')](_0xe6ef('0x7e'),util[_0xe6ef('0x43')](_0xd3beeb,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xe6ef('0xc')][_0xe6ef('0x24')]=function(_0x156dfd){try{if(this['isNotNull'](_0x156dfd)){if(this[_0xe6ef('0x11')][_0x156dfd['uniqueid']]){var _0x32acb4=_[_0xe6ef('0x72')](this[_0xe6ef('0x11')][_0x156dfd[_0xe6ef('0x68')]]);_0x32acb4[_0xe6ef('0x7f')]=!![];_0x32acb4[_0xe6ef('0x77')]=_0xe6ef('0x80');}}}catch(_0x8d88f9){logger[_0xe6ef('0x3b')](_0xe6ef('0x81'),util['inspect'](_0x8d88f9,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xe6ef('0xc')]['syncAgentComplete']=function(_0x318bde){try{if(this[_0xe6ef('0x5b')](_0x318bde)){if(this[_0xe6ef('0x11')][_0x318bde[_0xe6ef('0x68')]]){var _0x14fde3=_[_0xe6ef('0x72')](this['queueReports'][_0x318bde['uniqueid']]);_0x14fde3[_0xe6ef('0x1e')]=![];_0x14fde3['queuecallerabandonAt']=null;_0x14fde3['assigned']=!![];_0x14fde3[_0xe6ef('0x79')]=_0x318bde[_0xe6ef('0x82')];_0x14fde3[_0xe6ef('0x74')]=_0x318bde[_0xe6ef('0x74')];_0x14fde3['queuecallercomplete']=!![];_0x14fde3['queuecallerexit']=![];_0x14fde3[_0xe6ef('0x83')]=null;if(!_0x14fde3[_0xe6ef('0x84')]){if(_0x318bde['reason']==_0xe6ef('0x84')){_0x14fde3[_0xe6ef('0x77')]=_0xe6ef('0x85');}else{if(_[_0xe6ef('0x86')](_0x318bde[_0xe6ef('0x37')]['toLowerCase'](),'local/')){if(this[_0xe6ef('0x11')][_0x318bde['linkedid']]){var _0x44b970=_[_0xe6ef('0x72')](this[_0xe6ef('0x11')][_0x318bde[_0xe6ef('0x87')]]);_0x44b970[_0xe6ef('0x7f')]=![];_0x44b970[_0xe6ef('0x88')]=!![];_0x44b970[_0xe6ef('0x83')]=moment(_0x14fde3[_0xe6ef('0x69')])['add'](_0x318bde[_0xe6ef('0x74')],_0xe6ef('0x89'))[_0xe6ef('0x45')](_0xe6ef('0x6a'));_0x44b970['queuecallerexitreason']=_0xe6ef('0x8a');_0x44b970[_0xe6ef('0x84')]=!![];_0x44b970['transfertype']=_0xe6ef('0x8b');_0x44b970[_0xe6ef('0x8c')]=_0x318bde[_0xe6ef('0x8d')];_0x44b970['transferuniqueid']=_0x318bde[_0xe6ef('0x68')];var _0x4cfd1c=this[_0xe6ef('0x11')][_0x318bde[_0xe6ef('0x87')]];this['queueReports'][_0x318bde[_0xe6ef('0x87')]]=this[_0xe6ef('0x11')][_0x318bde['uniqueid']];this[_0xe6ef('0x11')][_0x318bde[_0xe6ef('0x68')]]=_0x4cfd1c;}}else{_0x14fde3[_0xe6ef('0x77')]=_0xe6ef('0x8e')+_0x318bde[_0xe6ef('0x8f')][_0xe6ef('0x90')]();}}}this['channels'][_0x318bde[_0xe6ef('0x68')]]=_0x14fde3;this[_0xe6ef('0x42')](_0x14fde3);}}}catch(_0x25a9c7){logger[_0xe6ef('0x3b')]('[syncAgentComplete][VoiceQueueReport]',util[_0xe6ef('0x43')](_0x25a9c7,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xe6ef('0x91')]=function(_0x4f4339){try{if(this[_0xe6ef('0x5b')](_0x4f4339)){this[_0xe6ef('0x92')](_0x4f4339['uniqueid'],_[_0xe6ef('0x6e')](_0x4f4339[_0xe6ef('0x93')])[0x0],_0x4f4339[_0xe6ef('0x94')]);if(this[_0xe6ef('0x11')][_0x4f4339[_0xe6ef('0x68')]]){var _0xfb90d0=_[_0xe6ef('0x72')](this[_0xe6ef('0x11')][_0x4f4339['uniqueid']]);if(_0xfb90d0){if(this['isNotNull'](_0x4f4339[_0xe6ef('0x93')])&&this[_0xe6ef('0x5b')](_0x4f4339[_0xe6ef('0x93')]['queuestatus'])){switch(_0x4f4339[_0xe6ef('0x94')]){case _0xe6ef('0x95'):_0xfb90d0[_0xe6ef('0x88')]=![];_0xfb90d0[_0xe6ef('0x83')]=null;break;default:_0xfb90d0['queuecallerexit']=!![];_0xfb90d0[_0xe6ef('0x83')]=moment()[_0xe6ef('0x45')]('YYYY-MM-DD\x20HH:mm:ss');_0xfb90d0[_0xe6ef('0x7b')]=moment()[_0xe6ef('0x45')](_0xe6ef('0x6a'));}_0xfb90d0[_0xe6ef('0x1e')]=![];_0xfb90d0[_0xe6ef('0x76')]=null;_0xfb90d0[_0xe6ef('0x77')]=_0x4f4339[_0xe6ef('0x94')];this[_0xe6ef('0x13')][_0x4f4339[_0xe6ef('0x68')]]=_0xfb90d0;this['emitVoiceQueueChannelRemove'](_0xfb90d0);}else if(this['isNotNull'](_0x4f4339[_0xe6ef('0x93')])&&this[_0xe6ef('0x5b')](_0x4f4339[_0xe6ef('0x93')][_0xe6ef('0x96')])){if(!_0xfb90d0[_0xe6ef('0x1e')]){_0xfb90d0[_0xe6ef('0x88')]=!![];_0xfb90d0[_0xe6ef('0x83')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0xfb90d0[_0xe6ef('0x77')]='EXITWITHKEY';_0xfb90d0[_0xe6ef('0x7b')]=moment()['format'](_0xe6ef('0x6a'));this['channels'][_0x4f4339['uniqueid']]=_0xfb90d0;}}_0xfb90d0[_0xe6ef('0x17')]=this['variables'][_0x4f4339[_0xe6ef('0x68')]];}}}}catch(_0x52eda0){logger[_0xe6ef('0x3b')](_0xe6ef('0x97'),util[_0xe6ef('0x43')](_0x52eda0,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xe6ef('0xc')][_0xe6ef('0x92')]=function(_0x3a6c35,_0x2b6929,_0x558812){var _0x3cd324=[_0xe6ef('0x98'),_0xe6ef('0x99'),_0xe6ef('0x9a'),_0xe6ef('0x9b'),_0xe6ef('0x9c'),'rtpaudioqoslossbridged','rtpaudioqosrtt',_0xe6ef('0x9d'),_0xe6ef('0x9e'),_0xe6ef('0x9f'),_0xe6ef('0xa0'),_0xe6ef('0xa1'),'membercalls',_0xe6ef('0xa2'),_0xe6ef('0xa3'),_0xe6ef('0xa4'),_0xe6ef('0x82'),'memberpenalty','memberrealtime'];if(!_[_0xe6ef('0x34')](_0x2b6929)&&!_['includes'](_0x3cd324,_0x2b6929)){if(_[_0xe6ef('0x2e')](this[_0xe6ef('0x17')][_0x3a6c35])){this[_0xe6ef('0x17')][_0x3a6c35]={};}this[_0xe6ef('0x17')][_0x3a6c35][_0x2b6929]=_0x558812;}};VoiceQueueReport[_0xe6ef('0xc')][_0xe6ef('0xa5')]=function(_0x3ee15b){try{if(this[_0xe6ef('0x5b')](_0x3ee15b)){if(this[_0xe6ef('0x11')][_0x3ee15b[_0xe6ef('0x68')]]){for(var _0x394f62=0x0,_0xd633b5={};_0x394f62=0x0?moment(_0xfce6a5[_0xbbd8('0x18')])[_0xbbd8('0x19')](_0xfce6a5[_0xbbd8('0x17')],'seconds'):null,'data1':_0xbbd8('0x1b'),'data2':_0xfce6a5[_0xbbd8('0x13')],'data3':_0xfce6a5[_0xbbd8('0x1c')],'data4':_0xfce6a5[_0xbbd8('0x1d')]||null,'role':_0xbbd8('0x12'),'internal':_0xfce6a5[_0xbbd8('0x13')]?_[_0xbbd8('0x14')](_0xfce6a5['accountcode']):undefined,'uniqueid':_0xfce6a5[_0xbbd8('0x1e')]},'log':_0xbbd8('0x8')});}; \ No newline at end of file +var _0x8d1e=['interface','format','TALKING','queuecallerleaveAt','diff','calleridnum','exten','queue','agent','accountcode','toNumber','uniqueid','voiceDialReport','Request','endtime','starttime','seconds','util','../client','queuecallercompleteAt','queuecallerexitAt','CreateMemberReport','voice','isNil'];(function(_0x4a690d,_0x51473d){var _0x31e44c=function(_0x442593){while(--_0x442593){_0x4a690d['push'](_0x4a690d['shift']());}};_0x31e44c(++_0x51473d);}(_0x8d1e,0xd1));var _0xe8d1=function(_0x4ad0f7,_0x1920b0){_0x4ad0f7=_0x4ad0f7-0x0;var _0x30f5c8=_0x8d1e[_0x4ad0f7];return _0x30f5c8;};'use strict';var moment=require('moment');var _=require('lodash');var util=require(_0xe8d1('0x0'));var client=require(_0xe8d1('0x1'));exports['voiceQueueReport']=function(_0x369d56){var _0x4352b3=_0x369d56[_0xe8d1('0x2')]||_0x369d56[_0xe8d1('0x3')];return client['Request'](_0xe8d1('0x4'),{'body':{'channel':_0xe8d1('0x5'),'membername':_0x369d56['lastAssignedTo'],'interface':_[_0xe8d1('0x6')](_0x369d56[_0xe8d1('0x7')])?util[_0xe8d1('0x8')]('SIP/%s',_0x369d56['lastAssignedTo']):_0x369d56[_0xe8d1('0x7')],'type':_0xe8d1('0x9'),'enterAt':_0x369d56[_0xe8d1('0xa')],'exitAt':_0x4352b3,'duration':moment(_0x4352b3)[_0xe8d1('0xb')](_0x369d56[_0xe8d1('0xa')],'seconds'),'data1':'inbound','data2':_0x369d56[_0xe8d1('0xc')],'data3':_0x369d56[_0xe8d1('0xd')],'data4':null,'data5':_0x369d56[_0xe8d1('0xe')],'role':_0xe8d1('0xf'),'internal':_0x369d56[_0xe8d1('0x10')]?_[_0xe8d1('0x11')](_0x369d56['accountcode']):undefined,'uniqueid':_0x369d56[_0xe8d1('0x12')]},'log':_0xe8d1('0x4')});};exports[_0xe8d1('0x13')]=function(_0x136a64){return client[_0xe8d1('0x14')](_0xe8d1('0x4'),{'body':{'channel':_0xe8d1('0x5'),'membername':_0x136a64['membername'],'interface':_0x136a64[_0xe8d1('0x7')],'type':_0xe8d1('0x9'),'enterAt':_0x136a64['starttime'],'exitAt':_0x136a64['endtime'],'duration':moment(_0x136a64[_0xe8d1('0x15')])[_0xe8d1('0xb')](_0x136a64[_0xe8d1('0x16')],_0xe8d1('0x17'))>=0x0?moment(_0x136a64[_0xe8d1('0x15')])['diff'](_0x136a64[_0xe8d1('0x16')],'seconds'):null,'data1':'outbound','data2':_0x136a64[_0xe8d1('0x10')],'data3':_0x136a64['exten'],'data4':_0x136a64['dialstring']||null,'role':'agent','internal':_0x136a64['accountcode']?_[_0xe8d1('0x11')](_0x136a64['accountcode']):undefined,'uniqueid':_0x136a64[_0xe8d1('0x12')]},'log':_0xe8d1('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index cb8edd4..e6c088c 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 _0xd64b=['GetTemplate','name','html','../client','Request'];(function(_0x222ac3,_0x36ee56){var _0x27bc3c=function(_0x2a80d0){while(--_0x2a80d0){_0x222ac3['push'](_0x222ac3['shift']());}};_0x27bc3c(++_0x36ee56);}(_0xd64b,0xc1));var _0xbd64=function(_0x3ccc5f,_0x17ba72){_0x3ccc5f=_0x3ccc5f-0x0;var _0x15de37=_0xd64b[_0x3ccc5f];return _0x15de37;};'use strict';var client=require(_0xbd64('0x0'));exports['getTemplates']=function(_0xf0de04){return function(_0x4bfb7c){return client[_0xbd64('0x1')](_0xbd64('0x2'),{'options':{'raw':!![],'attributes':['id',_0xbd64('0x3'),_0xbd64('0x4')]},'log':_0xbd64('0x2')});};}; \ No newline at end of file +var _0xac4a=['getTemplates','Request','GetTemplate','../client'];(function(_0x28c1c0,_0x2398aa){var _0x2ff1e3=function(_0x23dfb3){while(--_0x23dfb3){_0x28c1c0['push'](_0x28c1c0['shift']());}};_0x2ff1e3(++_0x2398aa);}(_0xac4a,0x13f));var _0xaac4=function(_0x32c8ea,_0x3a9393){_0x32c8ea=_0x32c8ea-0x0;var _0xa21204=_0xac4a[_0x32c8ea];return _0xa21204;};'use strict';var client=require(_0xaac4('0x0'));exports[_0xaac4('0x1')]=function(_0x2e2ad0){return function(_0x132fc3){return client[_0xaac4('0x2')](_0xaac4('0x3'),{'options':{'raw':!![],'attributes':['id','name','html']},'log':_0xaac4('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index 98efe0e..c66e10e 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 _0x6180=['data4','data5','data6','data7','../client','getTriggers','Request','GetTrigger','channel','status','Condition','AllConditions','field','operator','value','AnyConditions','Action','action','data2','data3'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x6180,0x1d0));var _0x0618=function(_0x37d225,_0x2ed664){_0x37d225=_0x37d225-0x0;var _0x26834b=_0x6180[_0x37d225];return _0x26834b;};'use strict';var client=require(_0x0618('0x0'));exports[_0x0618('0x1')]=function(_0x2f2fec){return function(_0x1256ce){return client[_0x0618('0x2')](_0x0618('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x0618('0x4'),_0x0618('0x5')],'include':[{'model':_0x0618('0x6'),'as':_0x0618('0x7'),'attributes':['id',_0x0618('0x8'),_0x0618('0x9'),_0x0618('0xa')]},{'model':'Condition','as':_0x0618('0xb'),'attributes':['id',_0x0618('0x8'),_0x0618('0x9'),_0x0618('0xa')]},{'model':_0x0618('0xc'),'as':'Actions','attributes':['id',_0x0618('0xd'),'data1',_0x0618('0xe'),_0x0618('0xf'),_0x0618('0x10'),_0x0618('0x11'),_0x0618('0x12'),_0x0618('0x13')]}]},'log':'GetTrigger'});};}; \ No newline at end of file +var _0x8a69=['status','Condition','field','operator','value','AnyConditions','Action','Actions','action','data1','data2','data3','data4','data5','data6','data7','GetTrigger','../client','Request','name','channel'];(function(_0x386351,_0xd003f9){var _0x21e16f=function(_0x388ea4){while(--_0x388ea4){_0x386351['push'](_0x386351['shift']());}};_0x21e16f(++_0xd003f9);}(_0x8a69,0x7a));var _0x98a6=function(_0x149adf,_0x50e6b5){_0x149adf=_0x149adf-0x0;var _0x1d5212=_0x8a69[_0x149adf];return _0x1d5212;};'use strict';var client=require(_0x98a6('0x0'));exports['getTriggers']=function(_0x4df91b){return function(_0x208f41){return client[_0x98a6('0x1')]('GetTrigger',{'options':{'raw':![],'attributes':['id',_0x98a6('0x2'),_0x98a6('0x3'),_0x98a6('0x4')],'include':[{'model':_0x98a6('0x5'),'as':'AllConditions','attributes':['id',_0x98a6('0x6'),_0x98a6('0x7'),_0x98a6('0x8')]},{'model':_0x98a6('0x5'),'as':_0x98a6('0x9'),'attributes':['id',_0x98a6('0x6'),_0x98a6('0x7'),_0x98a6('0x8')]},{'model':_0x98a6('0xa'),'as':_0x98a6('0xb'),'attributes':['id',_0x98a6('0xc'),_0x98a6('0xd'),_0x98a6('0xe'),_0x98a6('0xf'),_0x98a6('0x10'),_0x98a6('0x11'),_0x98a6('0x12'),_0x98a6('0x13')]}]},'log':_0x98a6('0x14')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index 3303f52..b6fdfd8 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 _0x6c28=['registry','../client','GetTrunk','name'];(function(_0x3926a5,_0x3fd455){var _0x443596=function(_0x3d316e){while(--_0x3d316e){_0x3926a5['push'](_0x3926a5['shift']());}};_0x443596(++_0x3fd455);}(_0x6c28,0x109));var _0x86c2=function(_0xf82956,_0x32f267){_0xf82956=_0xf82956-0x0;var _0x4d98f1=_0x6c28[_0xf82956];return _0x4d98f1;};'use strict';var client=require(_0x86c2('0x0'));exports['getTrunks']=function(_0x16960b){return function(_0x4cd952){return client['Request'](_0x86c2('0x1'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x86c2('0x2'),_0x86c2('0x3')]},'log':'GetTrunk'});};}; \ No newline at end of file +var _0xc04d=['Request','GetTrunk','name','registry','../client'];(function(_0x232b67,_0x3dc89e){var _0x39fcc0=function(_0x3e20c6){while(--_0x3e20c6){_0x232b67['push'](_0x232b67['shift']());}};_0x39fcc0(++_0x3dc89e);}(_0xc04d,0x1e4));var _0xdc04=function(_0xa3fadc,_0xd1e16){_0xa3fadc=_0xa3fadc-0x0;var _0x23ecb8=_0xc04d[_0xa3fadc];return _0x23ecb8;};'use strict';var client=require(_0xdc04('0x0'));exports['getTrunks']=function(_0xf07224){return function(_0x3bbe3a){return client[_0xdc04('0x1')](_0xdc04('0x2'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0xdc04('0x3'),_0xdc04('0x4')]},'log':_0xdc04('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index 948125b..a691ff1 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 _0x6947=['name','email','accountcode','fullname','online','pauseType','lastPauseAt','phone','mobile','interface','telephone','getTelephones','savePause','Request','saveUnpause','getAgent','ShowUser','voicePause','../client','getAgents','GetUser','agent'];(function(_0xd8b84c,_0x2e6222){var _0x5b9c23=function(_0x2d26b4){while(--_0x2d26b4){_0xd8b84c['push'](_0xd8b84c['shift']());}};_0x5b9c23(++_0x2e6222);}(_0x6947,0x80));var _0x7694=function(_0x523e52,_0x3279cb){_0x523e52=_0x523e52-0x0;var _0x4e6de1=_0x6947[_0x523e52];return _0x4e6de1;};'use strict';var client=require(_0x7694('0x0'));exports[_0x7694('0x1')]=function(){return function(){return client['Request'](_0x7694('0x2'),{'options':{'raw':![],'where':{'role':_0x7694('0x3')},'attributes':['id',_0x7694('0x4'),_0x7694('0x5'),_0x7694('0x6'),_0x7694('0x7'),_0x7694('0x8'),'lastLoginAt',_0x7694('0x9'),_0x7694('0xa'),'voicePause',_0x7694('0xb'),_0x7694('0xc'),_0x7694('0xd')]},'log':_0x7694('0x1')});};};exports['getTelephones']=function(){return function(){return client['Request'](_0x7694('0x2'),{'options':{'raw':!![],'where':{'role':_0x7694('0xe')},'attributes':['id',_0x7694('0x4'),_0x7694('0x6'),'internal']},'log':_0x7694('0xf')});};};exports[_0x7694('0x10')]=function(_0x3bb1f1,_0x587084,_0x5aa8cd){return client[_0x7694('0x11')]('PauseUser',{'body':{'type':_0x587084,'uniqueid':_0x5aa8cd},'options':{'where':{'id':_0x3bb1f1['id']}},'log':_0x7694('0x10')});};exports[_0x7694('0x12')]=function(_0xdaf2c8){return client['Request']('UnpauseUser',{'body':{},'options':{'where':{'id':_0xdaf2c8['id']}},'log':_0x7694('0x10')});};exports[_0x7694('0x13')]=function(_0x5be173){return client['Request'](_0x7694('0x14'),{'options':{'raw':![],'where':{'role':_0x7694('0x3'),'id':_0x5be173},'attributes':['id',_0x7694('0x4'),_0x7694('0x5'),_0x7694('0x6'),'fullname',_0x7694('0x8'),'lastLoginAt',_0x7694('0x9'),_0x7694('0xa'),_0x7694('0x15'),'interface']},'log':_0x7694('0x13')});}; \ No newline at end of file +var _0x8c69=['getAgents','GetUser','agent','name','email','fullname','online','pauseType','phone','mobile','getTelephones','telephone','savePause','PauseUser','saveUnpause','Request','UnpauseUser','ShowUser','accountcode','lastPauseAt','voicePause','interface','getAgent'];(function(_0x7afa26,_0x1b156c){var _0x2360ec=function(_0x51e9ad){while(--_0x51e9ad){_0x7afa26['push'](_0x7afa26['shift']());}};_0x2360ec(++_0x1b156c);}(_0x8c69,0x12b));var _0x98c6=function(_0x24317c,_0x3fa2d4){_0x24317c=_0x24317c-0x0;var _0x11ddb0=_0x8c69[_0x24317c];return _0x11ddb0;};'use strict';var client=require('../client');exports[_0x98c6('0x0')]=function(){return function(){return client['Request'](_0x98c6('0x1'),{'options':{'raw':![],'where':{'role':_0x98c6('0x2')},'attributes':['id',_0x98c6('0x3'),_0x98c6('0x4'),'accountcode',_0x98c6('0x5'),_0x98c6('0x6'),'lastLoginAt',_0x98c6('0x7'),'lastPauseAt','voicePause',_0x98c6('0x8'),_0x98c6('0x9'),'interface']},'log':_0x98c6('0x0')});};};exports[_0x98c6('0xa')]=function(){return function(){return client['Request'](_0x98c6('0x1'),{'options':{'raw':!![],'where':{'role':_0x98c6('0xb')},'attributes':['id',_0x98c6('0x3'),'accountcode','internal']},'log':_0x98c6('0xa')});};};exports[_0x98c6('0xc')]=function(_0x1fb8f9,_0x352b34,_0x1602b4){return client['Request'](_0x98c6('0xd'),{'body':{'type':_0x352b34,'uniqueid':_0x1602b4},'options':{'where':{'id':_0x1fb8f9['id']}},'log':_0x98c6('0xc')});};exports[_0x98c6('0xe')]=function(_0x175eab){return client[_0x98c6('0xf')](_0x98c6('0x10'),{'body':{},'options':{'where':{'id':_0x175eab['id']}},'log':_0x98c6('0xc')});};exports['getAgent']=function(_0x4f1097){return client[_0x98c6('0xf')](_0x98c6('0x11'),{'options':{'raw':![],'where':{'role':'agent','id':_0x4f1097},'attributes':['id',_0x98c6('0x3'),_0x98c6('0x4'),_0x98c6('0x12'),_0x98c6('0x5'),'online','lastLoginAt','pauseType',_0x98c6('0x13'),_0x98c6('0x14'),_0x98c6('0x15')]},'log':_0x98c6('0x16')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index 560c277..9ea31d3 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 _0x2af4=['CreateVoiceAgentReport','update','Request','UpdateVoiceAgentReport','create'];(function(_0x585e40,_0xf069b9){var _0x3a6999=function(_0x51dff2){while(--_0x51dff2){_0x585e40['push'](_0x585e40['shift']());}};_0x3a6999(++_0xf069b9);}(_0x2af4,0x1e4));var _0x42af=function(_0x5dab66,_0x3f5096){_0x5dab66=_0x5dab66-0x0;var _0x2aeaff=_0x2af4[_0x5dab66];return _0x2aeaff;};'use strict';var client=require('../client');exports[_0x42af('0x0')]=function(_0x2eb5a1){return client['Request'](_0x42af('0x1'),{'body':_0x2eb5a1,'log':'CreateVoiceAgentReport'});};exports[_0x42af('0x2')]=function(_0x2e8431,_0x528486,_0x5b7bcd){return client[_0x42af('0x3')](_0x42af('0x4'),{'body':_0x2e8431,'options':{'where':{'uniqueid':_0x528486,'interface':_0x5b7bcd,'agentcomplete':!![]}},'log':'UpdateVoiceAgentReport'});}; \ No newline at end of file +var _0x95ef=['create','Request','CreateVoiceAgentReport','UpdateVoiceAgentReport'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x95ef,0xb4));var _0xf95e=function(_0x4f5345,_0x51a6fe){_0x4f5345=_0x4f5345-0x0;var _0x4fbdbd=_0x95ef[_0x4f5345];return _0x4fbdbd;};'use strict';var client=require('../client');exports[_0xf95e('0x0')]=function(_0x3b6c3a){return client[_0xf95e('0x1')](_0xf95e('0x2'),{'body':_0x3b6c3a,'log':'CreateVoiceAgentReport'});};exports['update']=function(_0x57d52d,_0x55743a,_0x37b2c3){return client[_0xf95e('0x1')](_0xf95e('0x3'),{'body':_0x57d52d,'options':{'where':{'uniqueid':_0x55743a,'interface':_0x37b2c3,'agentcomplete':!![]}},'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 c5cc3db..073e253 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 _0x5219=['GetVoiceCallReport','outbound','startOf','day','format','endOf','YYYY-MM-DD\x20HH:mm:ss','type','duration','billableseconds','GetVoiceCallReports','moment','util','../client','create','Request','CreateVoiceCallReport','merge','DOCUMENTATION','getVoiceCallReports'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x5219,0x14b));var _0x9521=function(_0xa74c56,_0x5cacb0){_0xa74c56=_0xa74c56-0x0;var _0x275cf1=_0x5219[_0xa74c56];return _0x275cf1;};'use strict';var moment=require(_0x9521('0x0'));var util=require(_0x9521('0x1'));var _=require('lodash');var client=require(_0x9521('0x2'));exports[_0x9521('0x3')]=function(_0x4cd3ef){return client[_0x9521('0x4')](_0x9521('0x5'),{'body':_[_0x9521('0x6')](_0x4cd3ef,{'source':_0x4cd3ef['calleridnum'],'destinationcontext':_0x4cd3ef['context'],'callerid':_0x4cd3ef['callerid'],'amaflags':_0x9521('0x7')}),'log':_0x9521('0x5')});};exports[_0x9521('0x8')]=function(){return function(){return client[_0x9521('0x4')](_0x9521('0x9'),{'options':{'where':{'type':[_0x9521('0xa')],'createdAt':{'$between':[moment()[_0x9521('0xb')](_0x9521('0xc'))[_0x9521('0xd')]('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0x9521('0xe')]('day')['format'](_0x9521('0xf'))]}},'attributes':[_0x9521('0x10'),'disposition',_0x9521('0x11'),_0x9521('0x12')]},'log':_0x9521('0x13')});};}; \ No newline at end of file +var _0xf3ad=['CreateVoiceCallReport','merge','calleridnum','DOCUMENTATION','GetVoiceCallReport','outbound','startOf','day','YYYY-MM-DD\x20HH:mm:ss','endOf','format','disposition','duration','billableseconds','GetVoiceCallReports','moment','lodash','../client','create','Request'];(function(_0x52dd39,_0xdb90a5){var _0x1d4076=function(_0x19c184){while(--_0x19c184){_0x52dd39['push'](_0x52dd39['shift']());}};_0x1d4076(++_0xdb90a5);}(_0xf3ad,0x1b3));var _0xdf3a=function(_0x24f20c,_0x5c73a6){_0x24f20c=_0x24f20c-0x0;var _0x2fdfd1=_0xf3ad[_0x24f20c];return _0x2fdfd1;};'use strict';var moment=require(_0xdf3a('0x0'));var util=require('util');var _=require(_0xdf3a('0x1'));var client=require(_0xdf3a('0x2'));exports[_0xdf3a('0x3')]=function(_0x42327b){return client[_0xdf3a('0x4')](_0xdf3a('0x5'),{'body':_[_0xdf3a('0x6')](_0x42327b,{'source':_0x42327b[_0xdf3a('0x7')],'destinationcontext':_0x42327b['context'],'callerid':_0x42327b['callerid'],'amaflags':_0xdf3a('0x8')}),'log':_0xdf3a('0x5')});};exports['getVoiceCallReports']=function(){return function(){return client['Request'](_0xdf3a('0x9'),{'options':{'where':{'type':[_0xdf3a('0xa')],'createdAt':{'$between':[moment()[_0xdf3a('0xb')](_0xdf3a('0xc'))['format'](_0xdf3a('0xd')),moment()[_0xdf3a('0xe')](_0xdf3a('0xc'))[_0xdf3a('0xf')](_0xdf3a('0xd'))]}},'attributes':['type',_0xdf3a('0x10'),_0xdf3a('0x11'),_0xdf3a('0x12')]},'log':_0xdf3a('0x13')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index 5eb7581..4b080e1 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 _0xf83e=['Request','CreateVoiceDialReport','../client','create'];(function(_0x349dc1,_0x76e8c5){var _0x16732d=function(_0x46bf85){while(--_0x46bf85){_0x349dc1['push'](_0x349dc1['shift']());}};_0x16732d(++_0x76e8c5);}(_0xf83e,0x196));var _0xef83=function(_0x4517cf,_0x3aaaca){_0x4517cf=_0x4517cf-0x0;var _0x408bf4=_0xf83e[_0x4517cf];return _0x408bf4;};'use strict';var client=require(_0xef83('0x0'));exports[_0xef83('0x1')]=function(_0x53cf0d){return client[_0xef83('0x2')]('CreateVoiceDialReport',{'body':_0x53cf0d,'log':_0xef83('0x3')});}; \ No newline at end of file +var _0x41d0=['create','Request','CreateVoiceDialReport','../client'];(function(_0xbbc76f,_0x4bed2f){var _0x524d0b=function(_0x356be3){while(--_0x356be3){_0xbbc76f['push'](_0xbbc76f['shift']());}};_0x524d0b(++_0x4bed2f);}(_0x41d0,0x14b));var _0x041d=function(_0x338442,_0x1974d1){_0x338442=_0x338442-0x0;var _0x11179b=_0x41d0[_0x338442];return _0x11179b;};'use strict';var client=require(_0x041d('0x0'));exports[_0x041d('0x1')]=function(_0x5b85b9){return client[_0x041d('0x2')](_0x041d('0x3'),{'body':_0x5b85b9,'log':_0x041d('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index f3c528a..4ce206f 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 _0xf1a7=['GetVoiceExtension','exten','recordingFormat','getVoiceExtensions'];(function(_0x3a9fdb,_0x205d53){var _0x18fc17=function(_0x489f1d){while(--_0x489f1d){_0x3a9fdb['push'](_0x3a9fdb['shift']());}};_0x18fc17(++_0x205d53);}(_0xf1a7,0x8f));var _0x7f1a=function(_0xd12079,_0x353401){_0xd12079=_0xd12079-0x0;var _0x18ca2a=_0xf1a7[_0xd12079];return _0x18ca2a;};'use strict';var client=require('../client');exports[_0x7f1a('0x0')]=function(){return function(){return client['Request'](_0x7f1a('0x1'),{'options':{'raw':!![],'attributes':['id',_0x7f1a('0x2'),_0x7f1a('0x3')],'where':{'VoiceExtensionId':null}},'log':_0x7f1a('0x0')});};}; \ No newline at end of file +var _0x0664=['getVoiceExtensions','GetVoiceExtension','exten'];(function(_0x1805ab,_0x1c2736){var _0x4e4633=function(_0x2f6c7d){while(--_0x2f6c7d){_0x1805ab['push'](_0x1805ab['shift']());}};_0x4e4633(++_0x1c2736);}(_0x0664,0x93));var _0x4066=function(_0x14e1ea,_0x485b35){_0x14e1ea=_0x14e1ea-0x0;var _0x1e760b=_0x0664[_0x14e1ea];return _0x1e760b;};'use strict';var client=require('../client');exports[_0x4066('0x0')]=function(){return function(){return client['Request'](_0x4066('0x1'),{'options':{'raw':!![],'attributes':['id',_0x4066('0x2'),'recordingFormat'],'where':{'VoiceExtensionId':null}},'log':_0x4066('0x0')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 3e8f63c..fe2e147 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 _0x42ca=['Interval','interval','../client','getVoiceQueues','Request','GetVoiceQueue','name','acwTimeout','autopause','monitor_format','type','dialActive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialGlobalInterval','dialPrefix','dialAMDActive','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedRetryFrequency','dialMachineRetryFrequency','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','Trunk','callerid','active','Pause','TrunkBackup'];(function(_0x4c906a,_0x196f4d){var _0x346df7=function(_0x418b03){while(--_0x418b03){_0x4c906a['push'](_0x4c906a['shift']());}};_0x346df7(++_0x196f4d);}(_0x42ca,0xbc));var _0xa42c=function(_0x2384bb,_0x39682f){_0x2384bb=_0x2384bb-0x0;var _0x299201=_0x42ca[_0x2384bb];return _0x299201;};'use strict';var client=require(_0xa42c('0x0'));exports[_0xa42c('0x1')]=function(){return function(){return client[_0xa42c('0x2')](_0xa42c('0x3'),{'options':{'raw':![],'attributes':['id',_0xa42c('0x4'),'acw',_0xa42c('0x5'),_0xa42c('0x6'),_0xa42c('0x7'),_0xa42c('0x8'),_0xa42c('0x9'),'dialMethod',_0xa42c('0xa'),_0xa42c('0xb'),_0xa42c('0xc'),_0xa42c('0xd'),_0xa42c('0xe'),_0xa42c('0xf'),_0xa42c('0x10'),_0xa42c('0x11'),_0xa42c('0x12'),_0xa42c('0x13'),_0xa42c('0x14'),_0xa42c('0x15'),'dialCongestionMaxRetry',_0xa42c('0x16'),_0xa42c('0x17'),_0xa42c('0x18'),_0xa42c('0x19'),_0xa42c('0x1a'),_0xa42c('0x1b'),'dialTimezone',_0xa42c('0x1c'),_0xa42c('0x1d'),'dialCheckDuplicateType',_0xa42c('0x1e'),'dialAMDInitialSilence','dialAMDGreeting',_0xa42c('0x1f'),_0xa42c('0x20'),_0xa42c('0x21'),_0xa42c('0x22'),_0xa42c('0x23'),_0xa42c('0x24'),_0xa42c('0x25'),_0xa42c('0x26'),_0xa42c('0x27'),_0xa42c('0x28'),_0xa42c('0x29'),_0xa42c('0x2a'),_0xa42c('0x2b'),'dialQueueProject2',_0xa42c('0x7'),_0xa42c('0x2c'),_0xa42c('0x2d'),_0xa42c('0x2e'),'dialNoSuchNumberMaxRetry',_0xa42c('0x2f'),_0xa42c('0x30'),_0xa42c('0x31'),'dialAbandonedMaxRetry',_0xa42c('0x32'),'dialMachineMaxRetry',_0xa42c('0x33'),'dialAgentRejectMaxRetry',_0xa42c('0x34'),_0xa42c('0x35'),_0xa42c('0x36'),'dialPredictiveIntervalMinThreshold'],'include':[{'model':_0xa42c('0x37'),'as':_0xa42c('0x37'),'attributes':['id',_0xa42c('0x4'),_0xa42c('0x38'),_0xa42c('0x39')]},{'model':_0xa42c('0x3a'),'as':'mandatoryDispositionPause','attributes':['id',_0xa42c('0x4')]},{'model':_0xa42c('0x37'),'as':_0xa42c('0x3b'),'attributes':['id',_0xa42c('0x4'),_0xa42c('0x38'),_0xa42c('0x39')]},{'model':'Interval','as':_0xa42c('0x3c'),'attributes':['id',_0xa42c('0x4')],'include':[{'model':'Interval','as':'Intervals','attributes':['id',_0xa42c('0x4'),_0xa42c('0x3d')]}]}]},'log':_0xa42c('0x1')});};}; \ No newline at end of file +var _0xb977=['dialPredictiveOptimizationPercentage','dialOriginateCallerIdName','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialBusyMaxRetry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','monitor_format','strategy','dialNoSuchNumberMaxRetry','dialDropMaxRetry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','Trunk','callerid','Pause','mandatoryDispositionPause','Interval','getVoiceQueues','GetVoiceQueue','name','acw','autopause','dialMethod','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xb977,0xe2));var _0x7b97=function(_0x5e10c9,_0x4f8d92){_0x5e10c9=_0x5e10c9-0x0;var _0x428104=_0xb977[_0x5e10c9];return _0x428104;};'use strict';var client=require('../client');exports[_0x7b97('0x0')]=function(){return function(){return client['Request'](_0x7b97('0x1'),{'options':{'raw':![],'attributes':['id',_0x7b97('0x2'),_0x7b97('0x3'),'acwTimeout',_0x7b97('0x4'),'monitor_format','type','dialActive',_0x7b97('0x5'),'dialLimitChannel',_0x7b97('0x6'),_0x7b97('0x7'),_0x7b97('0x8'),_0x7b97('0x9'),'dialPredictiveInterval',_0x7b97('0xa'),'dialOriginateCallerIdNumber',_0x7b97('0xb'),_0x7b97('0xc'),_0x7b97('0xd'),_0x7b97('0xe'),'dialCongestionMaxRetry','dialCongestionRetryFrequency',_0x7b97('0xf'),'dialBusyRetryFrequency',_0x7b97('0x10'),_0x7b97('0x11'),_0x7b97('0x12'),_0x7b97('0x13'),_0x7b97('0x14'),_0x7b97('0x15'),'dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence',_0x7b97('0x16'),_0x7b97('0x17'),_0x7b97('0x18'),_0x7b97('0x19'),'dialAMDBetweenWordsSilence',_0x7b97('0x1a'),_0x7b97('0x1b'),'dialAMDMaximumWordLength','timeout','dialRecallMeTimeout',_0x7b97('0x1c'),_0x7b97('0x1d'),_0x7b97('0x1e'),'dialAgiAfterHangupClient','dialQueueProject2',_0x7b97('0x1f'),_0x7b97('0x20'),'dialRandomLastDigitCallerIdNumber','dialCutDigit',_0x7b97('0x21'),'dialNoSuchNumberRetryFrequency',_0x7b97('0x22'),'dialDropRetryFrequency',_0x7b97('0x23'),_0x7b97('0x24'),_0x7b97('0x25'),'dialMachineRetryFrequency',_0x7b97('0x26'),_0x7b97('0x27'),_0x7b97('0x28'),_0x7b97('0x29'),'dialPredictiveIntervalMinThreshold'],'include':[{'model':_0x7b97('0x2a'),'as':_0x7b97('0x2a'),'attributes':['id',_0x7b97('0x2'),_0x7b97('0x2b'),'active']},{'model':_0x7b97('0x2c'),'as':_0x7b97('0x2d'),'attributes':['id',_0x7b97('0x2')]},{'model':_0x7b97('0x2a'),'as':'TrunkBackup','attributes':['id','name',_0x7b97('0x2b'),'active']},{'model':'Interval','as':_0x7b97('0x2e'),'attributes':['id',_0x7b97('0x2')],'include':[{'model':_0x7b97('0x2e'),'as':'Intervals','attributes':['id',_0x7b97('0x2'),'interval']}]}]},'log':_0x7b97('0x0')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index 1b8b1b0..62f37ae 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 _0x07fa=['Request','CreateVoiceQueueReport','getVoiceQueueReports','day','format','endOf','queue','queuecallerjoinAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','queuecallerabandon','queuecallerabandonAt','GetVoiceQueueReports','lodash','../client','create'];(function(_0x22460f,_0x4c0d2d){var _0x489d69=function(_0x59b4c2){while(--_0x59b4c2){_0x22460f['push'](_0x22460f['shift']());}};_0x489d69(++_0x4c0d2d);}(_0x07fa,0x177));var _0xa07f=function(_0x5627e1,_0x1b2dbf){_0x5627e1=_0x5627e1-0x0;var _0x2f013f=_0x07fa[_0x5627e1];return _0x2f013f;};'use strict';var moment=require('moment');var _=require(_0xa07f('0x0'));var client=require(_0xa07f('0x1'));exports[_0xa07f('0x2')]=function(_0x9d9c1e){return client[_0xa07f('0x3')]('CreateVoiceQueueReport',{'body':_0x9d9c1e,'log':_0xa07f('0x4')});};exports[_0xa07f('0x5')]=function(){return function(){return client['Request']('GetVoiceQueueReport',{'options':{'where':{'createdAt':{'$between':[moment()['startOf'](_0xa07f('0x6'))[_0xa07f('0x7')]('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0xa07f('0x8')]('day')['format']('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':['uniqueid',_0xa07f('0x9'),_0xa07f('0xa'),'queuecallerleaveAt',_0xa07f('0xb'),_0xa07f('0xc'),_0xa07f('0xd'),_0xa07f('0xe'),_0xa07f('0xf'),_0xa07f('0x10')]},'log':_0xa07f('0x11')});};}; \ No newline at end of file +var _0x428e=['queuecallerjoinAt','queuecallerleaveAt','queuecallercomplete','queuecallerexitAt','queuecallerabandon','queuecallerabandonAt','GetVoiceQueueReports','moment','lodash','../client','create','Request','CreateVoiceQueueReport','getVoiceQueueReports','GetVoiceQueueReport','startOf','format','YYYY-MM-DD\x20HH:mm:ss','endOf','day','uniqueid','queue'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x428e,0x1eb));var _0xe428=function(_0x1fd675,_0x165dfe){_0x1fd675=_0x1fd675-0x0;var _0x16b554=_0x428e[_0x1fd675];return _0x16b554;};'use strict';var moment=require(_0xe428('0x0'));var _=require(_0xe428('0x1'));var client=require(_0xe428('0x2'));exports[_0xe428('0x3')]=function(_0x414178){return client[_0xe428('0x4')](_0xe428('0x5'),{'body':_0x414178,'log':_0xe428('0x5')});};exports[_0xe428('0x6')]=function(){return function(){return client[_0xe428('0x4')](_0xe428('0x7'),{'options':{'where':{'createdAt':{'$between':[moment()[_0xe428('0x8')]('day')[_0xe428('0x9')](_0xe428('0xa')),moment()[_0xe428('0xb')](_0xe428('0xc'))['format'](_0xe428('0xa'))]}},'attributes':[_0xe428('0xd'),_0xe428('0xe'),_0xe428('0xf'),_0xe428('0x10'),_0xe428('0x11'),'queuecallercompleteAt','queuecallerexit',_0xe428('0x12'),_0xe428('0x13'),_0xe428('0x14')]},'log':_0xe428('0x15')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueRt.js b/server/services/ami/rpc/voiceQueueRt.js index a94298c..9db296e 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 _0xea2f=['GetVoiceQueueRtPauses','../client','getVoiceQueueRtPauses','Request'];(function(_0x3a8ecb,_0x5d0c40){var _0x42166e=function(_0x2f644c){while(--_0x2f644c){_0x3a8ecb['push'](_0x3a8ecb['shift']());}};_0x42166e(++_0x5d0c40);}(_0xea2f,0x181));var _0xfea2=function(_0x1dc8a7,_0x125dab){_0x1dc8a7=_0x1dc8a7-0x0;var _0x24f963=_0xea2f[_0x1dc8a7];return _0x24f963;};'use strict';var client=require(_0xfea2('0x0'));exports[_0xfea2('0x1')]=function(_0x121d4f){return function(){return client[_0xfea2('0x2')](_0xfea2('0x3'),{'options':{'where':{'VoiceQueueId':_0x121d4f,'paused':!![]},'raw':!![]},'log':_0xfea2('0x1')});};}; \ No newline at end of file +var _0x01aa=['Request','GetVoiceQueueRtPauses','../client','getVoiceQueueRtPauses'];(function(_0x52d09c,_0x2cd08a){var _0x555f8f=function(_0x43ca3e){while(--_0x43ca3e){_0x52d09c['push'](_0x52d09c['shift']());}};_0x555f8f(++_0x2cd08a);}(_0x01aa,0x1ce));var _0xa01a=function(_0x12ec61,_0x404ae1){_0x12ec61=_0x12ec61-0x0;var _0x4a9347=_0x01aa[_0x12ec61];return _0x4a9347;};'use strict';var client=require(_0xa01a('0x0'));exports[_0xa01a('0x1')]=function(_0x322fe0){return function(){return client[_0xa01a('0x2')](_0xa01a('0x3'),{'options':{'where':{'VoiceQueueId':_0x322fe0,'paused':!![]},'raw':!![]},'log':_0xa01a('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index db60e1a..5fc3ebc 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 _0x6c47=['merge','monitorFilename','CreateVoiceRecording','lodash','../client'];(function(_0x5df39d,_0xd9bf3e){var _0x456379=function(_0x272296){while(--_0x272296){_0x5df39d['push'](_0x5df39d['shift']());}};_0x456379(++_0xd9bf3e);}(_0x6c47,0x161));var _0x76c4=function(_0x334a94,_0x5b9bf5){_0x334a94=_0x334a94-0x0;var _0x24abc7=_0x6c47[_0x334a94];return _0x24abc7;};'use strict';var _=require(_0x76c4('0x0'));var client=require(_0x76c4('0x1'));exports['create']=function(_0x520aed){return client['Request']('CreateVoiceRecording',{'body':_[_0x76c4('0x2')](_0x520aed,{'value':_0x520aed[_0x76c4('0x3')]}),'log':_0x76c4('0x4')});}; \ No newline at end of file +var _0xa233=['create','CreateVoiceRecording','merge','lodash','../client'];(function(_0x1e89d,_0x2afd0b){var _0x5719b1=function(_0x3c46a0){while(--_0x3c46a0){_0x1e89d['push'](_0x1e89d['shift']());}};_0x5719b1(++_0x2afd0b);}(_0xa233,0x9e));var _0x3a23=function(_0x515940,_0x55a4a3){_0x515940=_0x515940-0x0;var _0x16aa49=_0xa233[_0x515940];return _0x16aa49;};'use strict';var _=require(_0x3a23('0x0'));var client=require(_0x3a23('0x1'));exports[_0x3a23('0x2')]=function(_0x45bf27){return client['Request'](_0x3a23('0x3'),{'body':_[_0x3a23('0x4')](_0x45bf27,{'value':_0x45bf27['monitorFilename']}),'log':_0x3a23('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index 8d8ba0b..f207e06 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 _0x7b4f=['transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereelinkedid','isexternal','context','extension','blind','attendedTransfer','result','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransferercontext','origtransfererexten','attended','../client','CreateVoiceTransferReport','transfererchannel','transferercalleridnum'];(function(_0x428916,_0x417eaa){var _0x3959a5=function(_0x1e484a){while(--_0x1e484a){_0x428916['push'](_0x428916['shift']());}};_0x3959a5(++_0x417eaa);}(_0x7b4f,0x71));var _0xf7b4=function(_0x810e4d,_0x909ef4){_0x810e4d=_0x810e4d-0x0;var _0x13f01c=_0x7b4f[_0x810e4d];return _0x13f01c;};'use strict';var client=require(_0xf7b4('0x0'));exports['blindTransfer']=function(_0x4a73b6){return client['Request'](_0xf7b4('0x1'),{'body':{'result':_0x4a73b6['result'],'transfererchannel':_0x4a73b6[_0xf7b4('0x2')],'transferercalleridnum':_0x4a73b6[_0xf7b4('0x3')],'transferercalleridname':_0x4a73b6[_0xf7b4('0x4')],'transfererconnectedlinenum':_0x4a73b6[_0xf7b4('0x5')],'transfererconnectedlinename':_0x4a73b6[_0xf7b4('0x6')],'transfereraccountcode':_0x4a73b6[_0xf7b4('0x7')],'transferercontext':_0x4a73b6[_0xf7b4('0x8')],'transfererexten':_0x4a73b6[_0xf7b4('0x9')],'transfererlinkedid':_0x4a73b6[_0xf7b4('0xa')],'transfereechannel':_0x4a73b6[_0xf7b4('0xb')],'transfereecalleridnum':_0x4a73b6[_0xf7b4('0xc')],'transfereecalleridname':_0x4a73b6['transfereecalleridname'],'transfereeconnectedlinenum':_0x4a73b6[_0xf7b4('0xd')],'transfereeconnectedlinename':_0x4a73b6[_0xf7b4('0xe')],'transfereeaccountcode':_0x4a73b6[_0xf7b4('0xf')],'transfereecontext':_0x4a73b6['transfereecontext'],'transfereeexten':_0x4a73b6['transfereeexten'],'transfereelinkedid':_0x4a73b6[_0xf7b4('0x10')],'isexternal':_0x4a73b6[_0xf7b4('0x11')],'context':_0x4a73b6[_0xf7b4('0x12')],'extension':_0x4a73b6[_0xf7b4('0x13')],'type':_0xf7b4('0x14')},'log':_0xf7b4('0x1')});};exports[_0xf7b4('0x15')]=function(_0x4ae827){return client['Request']('CreateVoiceTransferReport',{'body':{'result':_0x4ae827[_0xf7b4('0x16')],'transfererchannel':_0x4ae827['origtransfererchannel'],'transferercalleridnum':_0x4ae827[_0xf7b4('0x17')],'transferercalleridname':_0x4ae827[_0xf7b4('0x18')],'transfererconnectedlinenum':_0x4ae827[_0xf7b4('0x19')],'transfererconnectedlinename':_0x4ae827['secondtransfererconnectedlinename'],'transfereraccountcode':_0x4ae827['origtransfereraccountcode'],'transferercontext':_0x4ae827['secondtransferercontext'],'transfererexten':_0x4ae827[_0xf7b4('0x1a')],'transfererlinkedid':_0x4ae827[_0xf7b4('0x1b')],'transfereechannel':_0x4ae827[_0xf7b4('0x1c')],'transfereecalleridnum':_0x4ae827[_0xf7b4('0x1d')],'transfereecalleridname':_0x4ae827[_0xf7b4('0x1e')],'transfereeconnectedlinenum':_0x4ae827[_0xf7b4('0x1f')],'transfereeconnectedlinename':_0x4ae827[_0xf7b4('0x20')],'transfereeaccountcode':_0x4ae827['transfertargetaccountcode'],'transfereecontext':_0x4ae827[_0xf7b4('0x21')],'transfereeexten':_0x4ae827[_0xf7b4('0x22')],'transfereelinkedid':_0x4ae827[_0xf7b4('0x23')],'isexternal':_0x4ae827[_0xf7b4('0x11')],'context':_0x4ae827[_0xf7b4('0x24')],'extension':_0x4ae827[_0xf7b4('0x25')],'type':_0xf7b4('0x26')},'log':_0xf7b4('0x1')});}; \ No newline at end of file +var _0x5eaf=['transfereeexten','transfereelinkedid','isexternal','context','extension','blind','CreateVoiceTransferReport','attendedTransfer','result','origtransfererchannel','origtransferercalleridname','secondtransfererconnectedlinenum','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetcontext','origtransferercontext','origtransfererexten','attended','../client','Request','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext'];(function(_0x5a70c6,_0x366537){var _0x47c1d7=function(_0x44e492){while(--_0x44e492){_0x5a70c6['push'](_0x5a70c6['shift']());}};_0x47c1d7(++_0x366537);}(_0x5eaf,0x108));var _0xf5ea=function(_0x109634,_0x395d4b){_0x109634=_0x109634-0x0;var _0x118c0d=_0x5eaf[_0x109634];return _0x118c0d;};'use strict';var client=require(_0xf5ea('0x0'));exports['blindTransfer']=function(_0x5bdba1){return client[_0xf5ea('0x1')]('CreateVoiceTransferReport',{'body':{'result':_0x5bdba1['result'],'transfererchannel':_0x5bdba1[_0xf5ea('0x2')],'transferercalleridnum':_0x5bdba1[_0xf5ea('0x3')],'transferercalleridname':_0x5bdba1[_0xf5ea('0x4')],'transfererconnectedlinenum':_0x5bdba1['transfererconnectedlinenum'],'transfererconnectedlinename':_0x5bdba1[_0xf5ea('0x5')],'transfereraccountcode':_0x5bdba1[_0xf5ea('0x6')],'transferercontext':_0x5bdba1[_0xf5ea('0x7')],'transfererexten':_0x5bdba1['transfererexten'],'transfererlinkedid':_0x5bdba1[_0xf5ea('0x8')],'transfereechannel':_0x5bdba1[_0xf5ea('0x9')],'transfereecalleridnum':_0x5bdba1[_0xf5ea('0xa')],'transfereecalleridname':_0x5bdba1[_0xf5ea('0xb')],'transfereeconnectedlinenum':_0x5bdba1[_0xf5ea('0xc')],'transfereeconnectedlinename':_0x5bdba1[_0xf5ea('0xd')],'transfereeaccountcode':_0x5bdba1[_0xf5ea('0xe')],'transfereecontext':_0x5bdba1[_0xf5ea('0xf')],'transfereeexten':_0x5bdba1[_0xf5ea('0x10')],'transfereelinkedid':_0x5bdba1[_0xf5ea('0x11')],'isexternal':_0x5bdba1[_0xf5ea('0x12')],'context':_0x5bdba1[_0xf5ea('0x13')],'extension':_0x5bdba1[_0xf5ea('0x14')],'type':_0xf5ea('0x15')},'log':_0xf5ea('0x16')});};exports[_0xf5ea('0x17')]=function(_0x10cd01){return client[_0xf5ea('0x1')](_0xf5ea('0x16'),{'body':{'result':_0x10cd01[_0xf5ea('0x18')],'transfererchannel':_0x10cd01[_0xf5ea('0x19')],'transferercalleridnum':_0x10cd01['origtransferercalleridnum'],'transferercalleridname':_0x10cd01[_0xf5ea('0x1a')],'transfererconnectedlinenum':_0x10cd01[_0xf5ea('0x1b')],'transfererconnectedlinename':_0x10cd01['secondtransfererconnectedlinename'],'transfereraccountcode':_0x10cd01[_0xf5ea('0x1c')],'transferercontext':_0x10cd01[_0xf5ea('0x1d')],'transfererexten':_0x10cd01[_0xf5ea('0x1e')],'transfererlinkedid':_0x10cd01['origtransfererlinkedid'],'transfereechannel':_0x10cd01[_0xf5ea('0x1f')],'transfereecalleridnum':_0x10cd01[_0xf5ea('0x20')],'transfereecalleridname':_0x10cd01[_0xf5ea('0x21')],'transfereeconnectedlinenum':_0x10cd01[_0xf5ea('0x22')],'transfereeconnectedlinename':_0x10cd01[_0xf5ea('0x23')],'transfereeaccountcode':_0x10cd01['transfertargetaccountcode'],'transfereecontext':_0x10cd01[_0xf5ea('0x24')],'transfereeexten':_0x10cd01['transfertargetexten'],'transfereelinkedid':_0x10cd01['transfertargetlinkedid'],'isexternal':_0x10cd01[_0xf5ea('0x12')],'context':_0x10cd01[_0xf5ea('0x25')],'extension':_0x10cd01[_0xf5ea('0x26')],'type':_0xf5ea('0x27')},'log':_0xf5ea('0x16')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index 1f34657..85ccf32 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 _0xec3d=['outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','callerid','Interval','push','values','channels','length','find','uniqueid','channel','filename','wav','MixMonitor','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','toLowerCase','isNil','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','rec','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','voicechannel','map','resolve','StopMixMonitor','destinationchannel','stop','%s.%s','StopMixMonitor\x20Success','queueChannels','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect','exten','context','telephones','trunks','outboundChannels','campaigns','Event\x20name\x20mandatory','emit','custom:','event','faxAccounts','send','checkAfterSend','server','http','127.0.0.1','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','validate','bluebird','../../../config/environment','../properties','../ami','listen','format','%s/%s','SIP','name','timers','timer','agents','updateStatusRealtime','error','asterisk','username','ami\x20disconnected','pick','module','action','Reload','Action','message','isConnected','join','command','Command','then','catch','voiceQueues','strategy','available','loggedIn','sumBillable','sumHoldTime','talking','total','type','abandoned','waiting','loggedInDb','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay'];(function(_0x597f69,_0x105356){var _0x4c04bb=function(_0x42c440){while(--_0x42c440){_0x597f69['push'](_0x597f69['shift']());}};_0x4c04bb(++_0x105356);}(_0xec3d,0xd6));var _0xdec3=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xec3d[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xdec3('0x0'));var util=require(_0xdec3('0x1'));var jayson=require(_0xdec3('0x2'));var schema=require(_0xdec3('0x3'));var BPromise=require(_0xdec3('0x4'));var moment=require('moment');var config=require(_0xdec3('0x5'));var properties=require(_0xdec3('0x6'));var ami=require(_0xdec3('0x7'));exports[_0xdec3('0x8')]=function(_0xe2816e,_0x4ce04c,_0x380275){return new BPromise(function(_0x5ee0c5,_0x294ac0){var _0x55677b={'QueuePause':function(_0x4e9005){return new Promise(function(_0x533720,_0xe1cfe6){var _0x3bdc5f=util[_0xdec3('0x9')](_0xdec3('0xa'),_0xdec3('0xb'),_0x4e9005[_0xdec3('0xc')]);if(_0xe2816e[_0xdec3('0xd')]&&_0xe2816e[_0xdec3('0xd')][_0x3bdc5f]&&_0xe2816e[_0xdec3('0xd')][_0x3bdc5f][_0xdec3('0xe')]){_0xe2816e[_0xdec3('0xd')][_0x3bdc5f]['updateAcw']();}if(_0xe2816e[_0xdec3('0xf')][_0x3bdc5f]){_0xe2816e[_0xdec3('0xf')][_0x3bdc5f][_0xdec3('0x10')]({'statePause':_0x4e9005['pause']?!![]:![]});}_0x533720({'code':0xc8,'message':'QueuePause'});});},'Reload':function(_0x1df858){var _0x1ca001=this;return new Promise(function(_0x365798,_0xd218a5){if(ami['isConnected']()==![]){return _0xd218a5(_0x1ca001[_0xdec3('0x11')](0x1f4,[config[_0xdec3('0x12')]['ip'],config[_0xdec3('0x12')][_0xdec3('0x13')],_0xdec3('0x14')]['join']('\x20')));}_0x1df858=_[_0xdec3('0x15')](_0x1df858,_['keys'](properties[_0xdec3('0x16')]));_0x1df858[_0xdec3('0x17')]=_0xdec3('0x18');return ami[_0xdec3('0x19')](_0x1df858)['then'](function(_0x438e52){_0x365798({'code':0xc8,'message':_0x438e52[_0xdec3('0x1a')]});})['catch'](function(_0x4a6287){_0xd218a5(_0x1ca001['error'](0x1f5,_0x4a6287['message']));});});},'Command':function(_0x277536){var _0x186325=this;return new Promise(function(_0x40cdc7,_0x114dba){if(ami[_0xdec3('0x1b')]()==![]){return _0x114dba(_0x186325['error'](0x1f4,[config[_0xdec3('0x12')]['ip'],config[_0xdec3('0x12')]['username'],'ami\x20disconnected'][_0xdec3('0x1c')]('\x20')));}_0x277536=_[_0xdec3('0x15')](_0x277536,_0xdec3('0x1d'));_0x277536[_0xdec3('0x17')]=_0xdec3('0x1e');return ami['Action'](_0x277536)[_0xdec3('0x1f')](function(_0x87df50){_0x40cdc7({'code':0xc8,'message':_0x87df50['content']});})[_0xdec3('0x20')](function(_0x408a3f){_0x114dba(_0x186325['error'](0x1f5,_0x408a3f[_0xdec3('0x1a')]));});});},'VoiceQueues':function(_0x25865e){return new Promise(function(_0x36c710,_0x4e01a9){var _0x33adbb=[];for(var _0x4d650e in _0xe2816e[_0xdec3('0x21')]){if(_0xe2816e[_0xdec3('0x21')]['hasOwnProperty'](_0x4d650e)){var _0x46b564=_0xe2816e[_0xdec3('0x21')][_0x4d650e];var _0x48e909={'id':_0x46b564['id'],'name':_0x46b564[_0xdec3('0xc')],'strategy':_0x46b564[_0xdec3('0x22')],'answered':_0x46b564['answered'],'available':_0x46b564[_0xdec3('0x23')],'loggedIn':_0x46b564[_0xdec3('0x24')],'pTalking':_0x46b564['pTalking'],'sumBillable':_0x46b564[_0xdec3('0x25')],'sumDuration':_0x46b564['sumDuration'],'sumHoldTime':_0x46b564[_0xdec3('0x26')]||0x0,'talking':_0x46b564[_0xdec3('0x27')],'total':_0x46b564[_0xdec3('0x28')],'type':_0x46b564[_0xdec3('0x29')],'unmanaged':_0x46b564['unmanaged'],'abandoned':_0x46b564[_0xdec3('0x2a')],'waiting':_0x46b564[_0xdec3('0x2b')],'loggedInDb':_0x46b564[_0xdec3('0x2c')]};if(_0x46b564[_0xdec3('0x29')]===_0xdec3('0x2d')){_0x48e909[_0xdec3('0x2e')]=_0x46b564[_0xdec3('0x2e')];_0x48e909[_0xdec3('0x2f')]=_0x46b564[_0xdec3('0x2f')];_0x48e909['dialOriginateCallerIdName']=_0x46b564[_0xdec3('0x30')];_0x48e909[_0xdec3('0x31')]=_0x46b564[_0xdec3('0x31')];_0x48e909[_0xdec3('0x32')]=_0x46b564[_0xdec3('0x32')];_0x48e909['dialPrefix']=_0x46b564[_0xdec3('0x33')];_0x48e909[_0xdec3('0x34')]=_0x46b564['outboundAnswerAgiCallsDay'];_0x48e909['outboundAnswerCallsDay']=_0x46b564[_0xdec3('0x35')];_0x48e909[_0xdec3('0x36')]=_0x46b564[_0xdec3('0x36')];_0x48e909[_0xdec3('0x37')]=_0x46b564[_0xdec3('0x37')];_0x48e909['outboundCongestionCallsDay']=_0x46b564[_0xdec3('0x38')];_0x48e909[_0xdec3('0x39')]=_0x46b564[_0xdec3('0x39')];_0x48e909[_0xdec3('0x3a')]=_0x46b564[_0xdec3('0x3a')];_0x48e909[_0xdec3('0x3b')]=_0x46b564['outboundDropCallsDayTimeout'];_0x48e909[_0xdec3('0x3c')]=_0x46b564[_0xdec3('0x3c')];_0x48e909[_0xdec3('0x3d')]=_0x46b564[_0xdec3('0x3d')];_0x48e909[_0xdec3('0x3e')]=_0x46b564[_0xdec3('0x3e')];_0x48e909[_0xdec3('0x3f')]=_0x46b564['outboundReCallsDay'];_0x48e909[_0xdec3('0x40')]=_0x46b564[_0xdec3('0x40')];_0x48e909['outboundUnknownCallsDay']=_0x46b564[_0xdec3('0x41')];_0x48e909['predictiveIntervalAnsweredCalls']=_0x46b564[_0xdec3('0x42')];_0x48e909['predictiveIntervalAvgHoldtime']=_0x46b564[_0xdec3('0x43')];_0x48e909[_0xdec3('0x44')]=_0x46b564[_0xdec3('0x44')];_0x48e909[_0xdec3('0x45')]=_0x46b564[_0xdec3('0x45')];_0x48e909[_0xdec3('0x46')]=_0x46b564[_0xdec3('0x46')];_0x48e909['predictiveIntervalErlangCalls']=_0x46b564[_0xdec3('0x47')];_0x48e909[_0xdec3('0x48')]=_0x46b564['predictiveIntervalErlangCallsDroppedCalls'];_0x48e909[_0xdec3('0x49')]=_0x46b564[_0xdec3('0x49')];_0x48e909[_0xdec3('0x4a')]=_0x46b564[_0xdec3('0x4a')];_0x48e909[_0xdec3('0x4b')]=_0x46b564[_0xdec3('0x4b')];_0x48e909[_0xdec3('0x4c')]=_0x46b564[_0xdec3('0x4c')];_0x48e909[_0xdec3('0x4d')]=_0x46b564[_0xdec3('0x4d')];_0x48e909['message']=_0x46b564[_0xdec3('0x1a')];_0x48e909[_0xdec3('0x4e')]=_0x46b564['originated'];_0x48e909[_0xdec3('0x4f')]=_0x46b564[_0xdec3('0x4f')];_0x48e909[_0xdec3('0x50')]=_0x46b564[_0xdec3('0x50')];_0x48e909[_0xdec3('0x51')]=_0x46b564[_0xdec3('0x51')];_0x48e909[_0xdec3('0x52')]=_0x46b564[_0xdec3('0x52')];_0x48e909[_0xdec3('0x53')]=_0x46b564[_0xdec3('0x53')];_0x48e909[_0xdec3('0x54')]=_0x46b564[_0xdec3('0x54')];}if(_0x46b564[_0xdec3('0x55')]){_0x48e909[_0xdec3('0x55')]={'id':_0x46b564['Trunk']['id'],'name':_0x46b564[_0xdec3('0x55')][_0xdec3('0xc')],'active':_0x46b564[_0xdec3('0x55')]['active'],'callerid':_0x46b564[_0xdec3('0x55')][_0xdec3('0x56')]};}if(_0x46b564['Interval']){_0x48e909['Interval']={'id':_0x46b564[_0xdec3('0x57')]['id'],'name':_0x46b564[_0xdec3('0x57')][_0xdec3('0xc')]};}_0x33adbb[_0xdec3('0x58')](_0x48e909);}}_0x36c710({'count':_0x33adbb['length'],'rows':_0x33adbb});});},'VoiceChannels':function(_0x15049d){return new Promise(function(_0x182295,_0x44d2e7){var _0x214bb7=_[_0xdec3('0x59')](_0xe2816e[_0xdec3('0x5a')]);_0x182295({'count':_0x214bb7[_0xdec3('0x5b')],'rows':_0x214bb7});});},'VoiceChannelMixMonitor':function(_0x4ed92e){var _0x5db583=this;return new Promise(function(_0x42c7a2,_0x143c19){if(ami[_0xdec3('0x1b')]()==![]){return _0x143c19(_0x5db583['error'](0x1f4,[config[_0xdec3('0x12')]['ip'],config[_0xdec3('0x12')][_0xdec3('0x13')],_0xdec3('0x14')][_0xdec3('0x1c')]('\x20')));}var _0x2e9621=schema(properties['voicechannel'])['validate'](_0x4ed92e);if(_0x2e9621[_0xdec3('0x5b')]>0x0){return _0x143c19(_0x5db583[_0xdec3('0x11')](0x1f4,_['map'](_0x2e9621,_0xdec3('0x1a'))[_0xdec3('0x1c')](',\x20')));}var _0x339f89=_[_0xdec3('0x5c')](_0xe2816e[_0xdec3('0x5a')],{'uniqueid':_0x4ed92e[_0xdec3('0x5d')]});if(_0x339f89&&_0x339f89[_0xdec3('0x5e')]){var _0x1f51f9=util['format']('%s.%s',_0x4ed92e[_0xdec3('0x5f')]||_0x4ed92e['uniqueid'],_0x4ed92e[_0xdec3('0x9')]||_0xdec3('0x60'));return ami['Action']({'action':_0xdec3('0x61'),'channel':_0x339f89[_0xdec3('0x5e')],'file':_0x1f51f9,'options':_0xdec3('0x62')})[_0xdec3('0x1f')](function(_0x43dfa6){var _0x1f937e=_[_0xdec3('0x5c')](_0x339f89[_0xdec3('0x63')],{'filename':_0xdec3('0x64')+_0x1f51f9[_0xdec3('0x65')]()});if(_[_0xdec3('0x66')](_0x1f937e)){_0x339f89['monitors'][_0xdec3('0x58')]({'filename':_0xdec3('0x64')+_0x1f51f9[_0xdec3('0x65')](),'createdAt':moment()['format'](_0xdec3('0x67')),'mixmonitorid':_0x43dfa6[_0xdec3('0x68')],'status':_0xdec3('0x69')});}else{_0x1f937e[_0xdec3('0x68')]=_0x43dfa6[_0xdec3('0x68')];_0x1f937e[_0xdec3('0x6a')]='rec';}_0x42c7a2({'code':0xc8,'message':[_0x4ed92e[_0xdec3('0x5d')],_0xdec3('0x6b'),_0x43dfa6[_0xdec3('0x68')]]['join']('\x20'),'mixmonitorid':_0x43dfa6['mixmonitorid']});})['catch'](function(_0x20d85d){_0x143c19(_0x5db583[_0xdec3('0x11')](0x1f5,[_0x4ed92e[_0xdec3('0x5d')],_0x20d85d['message'][_0xdec3('0x65')]()][_0xdec3('0x1c')]('\x20')));});}else{return _0x143c19(_0x5db583[_0xdec3('0x11')](0x1f5,_0xdec3('0x6c')));}});},'VoiceChannelStopMixMonitor':function(_0x5b5078){var _0x5c5353=this;return new Promise(function(_0x2e9438,_0x4cd5c6){if(ami[_0xdec3('0x1b')]()==![]){return _0x4cd5c6(_0x5c5353[_0xdec3('0x11')](0x1f4,[config[_0xdec3('0x12')]['ip'],config[_0xdec3('0x12')][_0xdec3('0x13')],_0xdec3('0x14')]['join']('\x20')));}var _0x32ca3f=schema(properties[_0xdec3('0x6d')])[_0xdec3('0x3')](_0x5b5078);if(_0x32ca3f[_0xdec3('0x5b')]>0x0){return _0x4cd5c6(_0x5c5353[_0xdec3('0x11')](0x1f4,_[_0xdec3('0x6e')](_0x32ca3f,_0xdec3('0x1a'))[_0xdec3('0x1c')](',\x20')));}var _0x5deb34=_[_0xdec3('0x5c')](_0xe2816e['channels'],{'uniqueid':_0x5b5078['uniqueid']});if(_0x5deb34){return BPromise[_0xdec3('0x6f')]()[_0xdec3('0x1f')](function(){if(_0x5deb34[_0xdec3('0x5e')]){return ami[_0xdec3('0x19')]({'action':_0xdec3('0x70'),'channel':_0x5deb34['channel'],'mixmonitorid':_0x5b5078[_0xdec3('0x68')]})[_0xdec3('0x20')](function(_0x153e0d){});}})[_0xdec3('0x1f')](function(){if(_0x5deb34[_0xdec3('0x71')]){return ami[_0xdec3('0x19')]({'action':_0xdec3('0x70'),'channel':_0x5deb34[_0xdec3('0x71')],'mixmonitorid':_0x5b5078[_0xdec3('0x68')]})[_0xdec3('0x20')](function(_0x53e822){});}})[_0xdec3('0x1f')](function(_0x353abc){var _0x22d6b7=_[_0xdec3('0x5c')](_0x5deb34['monitors'],{'mixmonitorid':_0x5b5078['mixmonitorid']});if(_0x22d6b7){_0x22d6b7['status']=_0xdec3('0x72');}})[_0xdec3('0x1f')](function(){var _0x7459a5=util[_0xdec3('0x9')](_0xdec3('0x73'),_0x5b5078[_0xdec3('0x5f')]||_0x5b5078[_0xdec3('0x5d')],_0x5b5078[_0xdec3('0x9')]||_0xdec3('0x60'));var _0x175f0e=_[_0xdec3('0x5c')](_0x5deb34['monitors'],{'filename':_0xdec3('0x64')+_0x7459a5[_0xdec3('0x65')]()});if(_0x175f0e){_0x175f0e[_0xdec3('0x6a')]=_0xdec3('0x72');}})[_0xdec3('0x1f')](function(){_0x2e9438({'code':0xc8,'message':[_0x5b5078['uniqueid'],_0xdec3('0x74')][_0xdec3('0x1c')]('\x20')});})[_0xdec3('0x20')](function(_0x3de675){_0x4cd5c6(_0x5c5353[_0xdec3('0x11')](0x1f5,[_0x5b5078['uniqueid'],_0x3de675[_0xdec3('0x1a')][_0xdec3('0x65')]()][_0xdec3('0x1c')]('\x20')));});}else{return _0x4cd5c6(_0x5c5353[_0xdec3('0x11')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannels':function(_0x54185c){return new Promise(function(_0x1cfc28,_0x46f885){var _0x30be1b=_['values'](_0xe2816e['queueChannels']);_0x1cfc28({'count':_0x30be1b[_0xdec3('0x5b')],'rows':_0x30be1b});});},'VoiceQueuesChannel':function(_0x41eeba){var _0x5860d8=this;return new Promise(function(_0x5f05ff,_0xb2a528){var _0x4cbbe1=schema(properties['voicequeuechannel'])[_0xdec3('0x3')](_0x41eeba);if(_0x4cbbe1[_0xdec3('0x5b')]>0x0){return _0xb2a528(_0x5860d8['error'](0x1f4,_[_0xdec3('0x6e')](_0x4cbbe1,_0xdec3('0x1a'))[_0xdec3('0x1c')](',\x20')));}var _0x40632d=_[_0xdec3('0x5c')](_0xe2816e[_0xdec3('0x75')],{'uniqueid':_0x41eeba['uniqueid']});if(_0x40632d){_0x5f05ff(_0x40632d);}else{return _0xb2a528(_0x5860d8[_0xdec3('0x11')](0x1f5,_0xdec3('0x6c')));}});},'VoiceQueuesChannelHangup':function(_0x52e5c0){var _0x45884b=this;return new Promise(function(_0x21d9c7,_0x204575){if(ami['isConnected']()==![]){return _0x204575(_0x45884b['error'](0x1f4,[config[_0xdec3('0x12')]['ip'],config[_0xdec3('0x12')][_0xdec3('0x13')],'ami\x20disconnected'][_0xdec3('0x1c')]('\x20')));}var _0x5c393e=schema(properties[_0xdec3('0x76')])[_0xdec3('0x3')](_0x52e5c0);if(_0x5c393e['length']>0x0){return _0x204575(_0x45884b[_0xdec3('0x11')](0x1f4,_[_0xdec3('0x6e')](_0x5c393e,_0xdec3('0x1a'))['join'](',\x20')));}var _0x4e96c1=_[_0xdec3('0x5c')](_0xe2816e[_0xdec3('0x75')],{'uniqueid':_0x52e5c0[_0xdec3('0x5d')]});if(_0x4e96c1&&_0x4e96c1['channel']){return ami['Action']({'action':_0xdec3('0x77'),'channel':_0x4e96c1[_0xdec3('0x5e')]})[_0xdec3('0x1f')](function(_0x157da7){_0x21d9c7({'code':0xc8,'message':[_0x52e5c0[_0xdec3('0x5d')],_0x157da7['message']['toLowerCase']()][_0xdec3('0x1c')]('\x20')});})[_0xdec3('0x20')](function(_0x42a05e){_0x204575(_0x45884b[_0xdec3('0x11')](0x1f5,[_0x52e5c0[_0xdec3('0x5d')],_0x42a05e[_0xdec3('0x1a')][_0xdec3('0x65')]()][_0xdec3('0x1c')]('\x20')));});}else{return _0x204575(_0x45884b[_0xdec3('0x11')](0x1f5,_0xdec3('0x6c')));}});},'VoiceQueuesChannelRedirect':function(_0xe49a50){var _0xa604bc=this;return new Promise(function(_0x182fc3,_0x4d5fef){if(ami[_0xdec3('0x1b')]()==![]){return _0x4d5fef(_0xa604bc[_0xdec3('0x11')](0x1f4,[config[_0xdec3('0x12')]['ip'],config['asterisk'][_0xdec3('0x13')],'ami\x20disconnected'][_0xdec3('0x1c')]('\x20')));}var _0x465275=schema(properties[_0xdec3('0x78')])['validate'](_0xe49a50);if(_0x465275[_0xdec3('0x5b')]>0x0){return _0x4d5fef(_0xa604bc[_0xdec3('0x11')](0x1f4,_[_0xdec3('0x6e')](_0x465275,_0xdec3('0x1a'))[_0xdec3('0x1c')](',\x20')));}var _0x3e00d9=_['find'](_0xe2816e['queueChannels'],{'uniqueid':_0xe49a50[_0xdec3('0x5d')]});if(_0x3e00d9&&_0x3e00d9[_0xdec3('0x5e')]){return ami[_0xdec3('0x19')]({'action':_0xdec3('0x79'),'channel':_0x3e00d9[_0xdec3('0x5e')],'exten':_0xe49a50[_0xdec3('0x7a')],'context':_0xe49a50[_0xdec3('0x7b')]||_0x3e00d9[_0xdec3('0x7b')],'priority':0x1})[_0xdec3('0x1f')](function(_0x168365){_0x182fc3({'code':0xc8,'message':[_0xe49a50[_0xdec3('0x5d')],_0x168365[_0xdec3('0x1a')]['toLowerCase']()][_0xdec3('0x1c')]('\x20')});})[_0xdec3('0x20')](function(_0x5a5a87){_0x4d5fef(_0xa604bc[_0xdec3('0x11')](0x1f5,[_0xe49a50[_0xdec3('0x5d')],_0x5a5a87[_0xdec3('0x1a')]['toLowerCase']()][_0xdec3('0x1c')]('\x20')));});}else{return _0x4d5fef(_0xa604bc['error'](0x1f5,_0xdec3('0x6c')));}});},'Agents':function(_0x4330ce){return new Promise(function(_0x54c6fd,_0x565113){var _0x511f5c=_[_0xdec3('0x59')](_0xe2816e[_0xdec3('0xf')]);_0x54c6fd({'count':_0x511f5c['length'],'rows':_0x511f5c});});},'Telephones':function(_0x136a6d){return new Promise(function(_0x7c9b48,_0x5b4fa3){var _0xf26c0f=_[_0xdec3('0x59')](_0xe2816e[_0xdec3('0x7c')]);_0x7c9b48({'count':_0xf26c0f[_0xdec3('0x5b')],'rows':_0xf26c0f});});},'Trunks':function(_0x20c8c8){return new Promise(function(_0x45ea96,_0x17c199){var _0x269c64=_[_0xdec3('0x59')](_0xe2816e[_0xdec3('0x7d')]);_0x45ea96({'count':_0x269c64[_0xdec3('0x5b')],'rows':_0x269c64});});},'OutboundChannels':function(_0x47c546){return new Promise(function(_0x2c32eb,_0x3a56ad){var _0x5dd6bb=_['values'](_0xe2816e[_0xdec3('0x7e')]);_0x2c32eb({'count':_0x5dd6bb[_0xdec3('0x5b')],'rows':_0x5dd6bb});});},'Outbound':function(_0x1dc5c6){return new Promise(function(_0xeb02ad,_0xd982bc){_0xeb02ad(_0xe2816e[_0xdec3('0x2d')]);});},'Campaigns':function(_0x175439){return new Promise(function(_0x48b75e,_0x437e3e){var _0x196d86=_['values'](_0xe2816e[_0xdec3('0x7f')]);_0x48b75e({'count':_0x196d86[_0xdec3('0x5b')],'rows':_0x196d86});});},'VoiceQueuesPreview':function(_0x38903f){var _0x763cff=this;return new Promise(function(_0x15ae84,_0x57fe29){_0x4ce04c['run'](_0x38903f['id'])['then'](function(_0x44ed8a){_0x15ae84({'code':0xc8,'message':_0x44ed8a[_0xdec3('0x1a')]});})[_0xdec3('0x20')](function(_0x549eab){_0x57fe29(_0x763cff['error'](0x1f4,_0x549eab[_0xdec3('0x1a')]));});});},'EventManager':function(_0x4bf115){var _0x5c2eb1=this;return new Promise(function(_0x579a82,_0x2807d2){if(!_0x4bf115['event']){return _0x2807d2(_0x5c2eb1[_0xdec3('0x11')](0x1f4,_0xdec3('0x80')));}ami[_0xdec3('0x81')](_0xdec3('0x82')+_0x4bf115[_0xdec3('0x83')],_0x4bf115[_0xdec3('0x1a')]);_0x579a82({'code':0xc8,'message':_0x4bf115});});},'FaxAccounts':function(_0x4f3fef){return new Promise(function(_0x4d5d31,_0x309747){var _0x43111c=_['values'](_0xe2816e[_0xdec3('0x84')]);_0x4d5d31({'count':_0x43111c[_0xdec3('0x5b')],'rows':_0x43111c});});},'SendFax':function(_0x5f339a){var _0x277286=this;return new Promise(function(_0x9a8037,_0x578a14){_0x380275[_0xdec3('0x85')](_0x5f339a)[_0xdec3('0x1f')](function(_0x3e3b1a){_0x9a8037({'code':0xc8,'message':_0x3e3b1a[_0xdec3('0x1a')]});})[_0xdec3('0x20')](function(_0x15afa4){_0x578a14(_0x277286['error'](0x1f4,_0x15afa4[_0xdec3('0x1a')]));});});},'CheckAfterSend':function(_0x1141f0){var _0xee189b=this;return new Promise(function(_0x393181,_0xbf5782){_0x380275[_0xdec3('0x86')](_0x1141f0)['then'](function(_0x126fd4){_0x393181({'code':0xc8,'message':_0x126fd4[_0xdec3('0x1a')]});})['catch'](function(_0x4198b7){_0xbf5782(_0xee189b[_0xdec3('0x11')](0x1f4,_0x4198b7[_0xdec3('0x1a')]));});});}};var _0x1eb3c5=jayson[_0xdec3('0x87')](_0x55677b)[_0xdec3('0x88')]();_0x1eb3c5['on'](_0xdec3('0x11'),function(_0xb0dfcd){return _0x294ac0(_0xb0dfcd);});_0x1eb3c5['listen'](0x232a,_0xdec3('0x89'),function(){console['log']('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x5ee0c5(_0xdec3('0x8a')+0x232a);});});}; \ No newline at end of file +var _0xe3dd=['dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','Trunk','callerid','Interval','push','length','values','map','find','channels','channel','%s.%s','filename','uniqueid','MixMonitor','ai(mixmonitorid)','/var/spool/asterisk/monitor/','toLowerCase','isNil','monitors','mixmonitorid','rec','status','Channel\x20doesn\x27t\x20exist','voicechannel','resolve','StopMixMonitor','destinationchannel','stop','wav','StopMixMonitor\x20Success','voicequeuechannel','queueChannels','Hangup','voicequeuechannelredirect','Redirect','exten','context','telephones','trunks','outbound','campaigns','run','event','Event\x20name\x20mandatory','emit','custom:','faxAccounts','send','checkAfterSend','server','127.0.0.1','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','validate','bluebird','../../../config/environment','../properties','../ami','listen','format','SIP','name','timers','timer','agents','updateStatusRealtime','QueuePause','asterisk','pick','keys','module','Action','then','message','catch','error','isConnected','username','ami\x20disconnected','join','action','Command','content','voiceQueues','hasOwnProperty','strategy','answered','available','loggedIn','pTalking','sumDuration','talking','total','type','unmanaged','abandoned','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber'];(function(_0xad167e,_0xcdbdaf){var _0xc11880=function(_0x271f0b){while(--_0x271f0b){_0xad167e['push'](_0xad167e['shift']());}};_0xc11880(++_0xcdbdaf);}(_0xe3dd,0x1ed));var _0xde3d=function(_0x5c5c15,_0x335238){_0x5c5c15=_0x5c5c15-0x0;var _0x90d4c3=_0xe3dd[_0x5c5c15];return _0x90d4c3;};'use strict';var _=require(_0xde3d('0x0'));var util=require(_0xde3d('0x1'));var jayson=require(_0xde3d('0x2'));var schema=require(_0xde3d('0x3'));var BPromise=require(_0xde3d('0x4'));var moment=require('moment');var config=require(_0xde3d('0x5'));var properties=require(_0xde3d('0x6'));var ami=require(_0xde3d('0x7'));exports[_0xde3d('0x8')]=function(_0x4446b5,_0x5a77a1,_0x4d87ed){return new BPromise(function(_0x819fd0,_0x28b0de){var _0x33b24c={'QueuePause':function(_0x11a06f){return new Promise(function(_0x50c489,_0x4bdd29){var _0x4a3e2f=util[_0xde3d('0x9')]('%s/%s',_0xde3d('0xa'),_0x11a06f[_0xde3d('0xb')]);if(_0x4446b5[_0xde3d('0xc')]&&_0x4446b5[_0xde3d('0xc')][_0x4a3e2f]&&_0x4446b5['timers'][_0x4a3e2f][_0xde3d('0xd')]){_0x4446b5['timers'][_0x4a3e2f]['updateAcw']();}if(_0x4446b5[_0xde3d('0xe')][_0x4a3e2f]){_0x4446b5[_0xde3d('0xe')][_0x4a3e2f][_0xde3d('0xf')]({'statePause':_0x11a06f['pause']?!![]:![]});}_0x50c489({'code':0xc8,'message':_0xde3d('0x10')});});},'Reload':function(_0x4bdc59){var _0x1924dc=this;return new Promise(function(_0x2ee8c0,_0x222f26){if(ami['isConnected']()==![]){return _0x222f26(_0x1924dc['error'](0x1f4,[config[_0xde3d('0x11')]['ip'],config[_0xde3d('0x11')]['username'],'ami\x20disconnected']['join']('\x20')));}_0x4bdc59=_[_0xde3d('0x12')](_0x4bdc59,_[_0xde3d('0x13')](properties[_0xde3d('0x14')]));_0x4bdc59['action']='Reload';return ami[_0xde3d('0x15')](_0x4bdc59)[_0xde3d('0x16')](function(_0x4e134a){_0x2ee8c0({'code':0xc8,'message':_0x4e134a[_0xde3d('0x17')]});})[_0xde3d('0x18')](function(_0x163090){_0x222f26(_0x1924dc[_0xde3d('0x19')](0x1f5,_0x163090[_0xde3d('0x17')]));});});},'Command':function(_0x229ae4){var _0x35d0e5=this;return new Promise(function(_0x41b89e,_0x458c44){if(ami[_0xde3d('0x1a')]()==![]){return _0x458c44(_0x35d0e5[_0xde3d('0x19')](0x1f4,[config[_0xde3d('0x11')]['ip'],config[_0xde3d('0x11')][_0xde3d('0x1b')],_0xde3d('0x1c')][_0xde3d('0x1d')]('\x20')));}_0x229ae4=_[_0xde3d('0x12')](_0x229ae4,'command');_0x229ae4[_0xde3d('0x1e')]=_0xde3d('0x1f');return ami[_0xde3d('0x15')](_0x229ae4)[_0xde3d('0x16')](function(_0xedede6){_0x41b89e({'code':0xc8,'message':_0xedede6[_0xde3d('0x20')]});})[_0xde3d('0x18')](function(_0x14bfea){_0x458c44(_0x35d0e5[_0xde3d('0x19')](0x1f5,_0x14bfea[_0xde3d('0x17')]));});});},'VoiceQueues':function(_0x30387c){return new Promise(function(_0x2814a2,_0x448909){var _0x548b3a=[];for(var _0x4039e8 in _0x4446b5[_0xde3d('0x21')]){if(_0x4446b5[_0xde3d('0x21')][_0xde3d('0x22')](_0x4039e8)){var _0x3ec06d=_0x4446b5[_0xde3d('0x21')][_0x4039e8];var _0x30796f={'id':_0x3ec06d['id'],'name':_0x3ec06d[_0xde3d('0xb')],'strategy':_0x3ec06d[_0xde3d('0x23')],'answered':_0x3ec06d[_0xde3d('0x24')],'available':_0x3ec06d[_0xde3d('0x25')],'loggedIn':_0x3ec06d[_0xde3d('0x26')],'pTalking':_0x3ec06d[_0xde3d('0x27')],'sumBillable':_0x3ec06d['sumBillable'],'sumDuration':_0x3ec06d[_0xde3d('0x28')],'sumHoldTime':_0x3ec06d['sumHoldTime']||0x0,'talking':_0x3ec06d[_0xde3d('0x29')],'total':_0x3ec06d[_0xde3d('0x2a')],'type':_0x3ec06d[_0xde3d('0x2b')],'unmanaged':_0x3ec06d[_0xde3d('0x2c')],'abandoned':_0x3ec06d[_0xde3d('0x2d')],'waiting':_0x3ec06d['waiting'],'loggedInDb':_0x3ec06d[_0xde3d('0x2e')]};if(_0x3ec06d['type']==='outbound'){_0x30796f[_0xde3d('0x2f')]=_0x3ec06d['dialActive'];_0x30796f[_0xde3d('0x30')]=_0x3ec06d[_0xde3d('0x30')];_0x30796f[_0xde3d('0x31')]=_0x3ec06d[_0xde3d('0x31')];_0x30796f[_0xde3d('0x32')]=_0x3ec06d[_0xde3d('0x32')];_0x30796f[_0xde3d('0x33')]=_0x3ec06d[_0xde3d('0x33')];_0x30796f[_0xde3d('0x34')]=_0x3ec06d['dialPrefix'];_0x30796f[_0xde3d('0x35')]=_0x3ec06d[_0xde3d('0x35')];_0x30796f['outboundAnswerCallsDay']=_0x3ec06d[_0xde3d('0x36')];_0x30796f['outboundBlacklistCallsDay']=_0x3ec06d['outboundBlacklistCallsDay'];_0x30796f[_0xde3d('0x37')]=_0x3ec06d[_0xde3d('0x37')];_0x30796f[_0xde3d('0x38')]=_0x3ec06d[_0xde3d('0x38')];_0x30796f['outboundDropCallsDayACS']=_0x3ec06d[_0xde3d('0x39')];_0x30796f[_0xde3d('0x3a')]=_0x3ec06d[_0xde3d('0x3a')];_0x30796f[_0xde3d('0x3b')]=_0x3ec06d[_0xde3d('0x3b')];_0x30796f[_0xde3d('0x3c')]=_0x3ec06d['outboundNoAnswerCallsDay'];_0x30796f[_0xde3d('0x3d')]=_0x3ec06d[_0xde3d('0x3d')];_0x30796f[_0xde3d('0x3e')]=_0x3ec06d[_0xde3d('0x3e')];_0x30796f[_0xde3d('0x3f')]=_0x3ec06d[_0xde3d('0x3f')];_0x30796f[_0xde3d('0x40')]=_0x3ec06d[_0xde3d('0x40')];_0x30796f[_0xde3d('0x41')]=_0x3ec06d[_0xde3d('0x41')];_0x30796f[_0xde3d('0x42')]=_0x3ec06d[_0xde3d('0x42')];_0x30796f[_0xde3d('0x43')]=_0x3ec06d[_0xde3d('0x43')];_0x30796f[_0xde3d('0x44')]=_0x3ec06d[_0xde3d('0x44')];_0x30796f['predictiveIntervalDroppedCallsCallersExit']=_0x3ec06d[_0xde3d('0x45')];_0x30796f[_0xde3d('0x46')]=_0x3ec06d[_0xde3d('0x46')];_0x30796f[_0xde3d('0x47')]=_0x3ec06d[_0xde3d('0x47')];_0x30796f['predictiveIntervalErlangCallsDroppedCalls']=_0x3ec06d[_0xde3d('0x48')];_0x30796f['predictiveIntervalHitRate']=_0x3ec06d[_0xde3d('0x49')];_0x30796f[_0xde3d('0x4a')]=_0x3ec06d[_0xde3d('0x4a')];_0x30796f[_0xde3d('0x4b')]=_0x3ec06d[_0xde3d('0x4b')];_0x30796f[_0xde3d('0x4c')]=_0x3ec06d[_0xde3d('0x4c')];_0x30796f[_0xde3d('0x4d')]=_0x3ec06d['predictiveIntervalTotalCalls'];_0x30796f[_0xde3d('0x17')]=_0x3ec06d[_0xde3d('0x17')];_0x30796f[_0xde3d('0x4e')]=_0x3ec06d[_0xde3d('0x4e')];_0x30796f[_0xde3d('0x4f')]=_0x3ec06d[_0xde3d('0x4f')];_0x30796f[_0xde3d('0x50')]=_0x3ec06d[_0xde3d('0x50')];_0x30796f[_0xde3d('0x51')]=_0x3ec06d[_0xde3d('0x51')];_0x30796f[_0xde3d('0x52')]=_0x3ec06d[_0xde3d('0x52')];_0x30796f[_0xde3d('0x53')]=_0x3ec06d[_0xde3d('0x53')];_0x30796f['startProgressive']=_0x3ec06d['startProgressive'];}if(_0x3ec06d[_0xde3d('0x54')]){_0x30796f[_0xde3d('0x54')]={'id':_0x3ec06d['Trunk']['id'],'name':_0x3ec06d[_0xde3d('0x54')][_0xde3d('0xb')],'active':_0x3ec06d[_0xde3d('0x54')]['active'],'callerid':_0x3ec06d[_0xde3d('0x54')][_0xde3d('0x55')]};}if(_0x3ec06d[_0xde3d('0x56')]){_0x30796f[_0xde3d('0x56')]={'id':_0x3ec06d[_0xde3d('0x56')]['id'],'name':_0x3ec06d[_0xde3d('0x56')][_0xde3d('0xb')]};}_0x548b3a[_0xde3d('0x57')](_0x30796f);}}_0x2814a2({'count':_0x548b3a[_0xde3d('0x58')],'rows':_0x548b3a});});},'VoiceChannels':function(_0x53379a){return new Promise(function(_0x503faa,_0x23dea1){var _0x4a1d28=_[_0xde3d('0x59')](_0x4446b5['channels']);_0x503faa({'count':_0x4a1d28[_0xde3d('0x58')],'rows':_0x4a1d28});});},'VoiceChannelMixMonitor':function(_0x28591e){var _0x4c44c0=this;return new Promise(function(_0x57b8c2,_0x12e172){if(ami['isConnected']()==![]){return _0x12e172(_0x4c44c0[_0xde3d('0x19')](0x1f4,[config[_0xde3d('0x11')]['ip'],config[_0xde3d('0x11')][_0xde3d('0x1b')],_0xde3d('0x1c')][_0xde3d('0x1d')]('\x20')));}var _0x35d820=schema(properties['voicechannel'])[_0xde3d('0x3')](_0x28591e);if(_0x35d820[_0xde3d('0x58')]>0x0){return _0x12e172(_0x4c44c0[_0xde3d('0x19')](0x1f4,_[_0xde3d('0x5a')](_0x35d820,_0xde3d('0x17'))[_0xde3d('0x1d')](',\x20')));}var _0x5d5e6a=_[_0xde3d('0x5b')](_0x4446b5[_0xde3d('0x5c')],{'uniqueid':_0x28591e['uniqueid']});if(_0x5d5e6a&&_0x5d5e6a[_0xde3d('0x5d')]){var _0x24a2a0=util['format'](_0xde3d('0x5e'),_0x28591e[_0xde3d('0x5f')]||_0x28591e[_0xde3d('0x60')],_0x28591e[_0xde3d('0x9')]||'wav');return ami[_0xde3d('0x15')]({'action':_0xde3d('0x61'),'channel':_0x5d5e6a[_0xde3d('0x5d')],'file':_0x24a2a0,'options':_0xde3d('0x62')})[_0xde3d('0x16')](function(_0x588027){var _0x4579e2=_[_0xde3d('0x5b')](_0x5d5e6a['monitors'],{'filename':_0xde3d('0x63')+_0x24a2a0[_0xde3d('0x64')]()});if(_[_0xde3d('0x65')](_0x4579e2)){_0x5d5e6a[_0xde3d('0x66')][_0xde3d('0x57')]({'filename':_0xde3d('0x63')+_0x24a2a0[_0xde3d('0x64')](),'createdAt':moment()[_0xde3d('0x9')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x588027[_0xde3d('0x67')],'status':_0xde3d('0x68')});}else{_0x4579e2['mixmonitorid']=_0x588027[_0xde3d('0x67')];_0x4579e2[_0xde3d('0x69')]=_0xde3d('0x68');}_0x57b8c2({'code':0xc8,'message':[_0x28591e['uniqueid'],'MixMonitor\x20Success',_0x588027['mixmonitorid']]['join']('\x20'),'mixmonitorid':_0x588027[_0xde3d('0x67')]});})['catch'](function(_0x56a487){_0x12e172(_0x4c44c0[_0xde3d('0x19')](0x1f5,[_0x28591e[_0xde3d('0x60')],_0x56a487['message'][_0xde3d('0x64')]()]['join']('\x20')));});}else{return _0x12e172(_0x4c44c0[_0xde3d('0x19')](0x1f5,_0xde3d('0x6a')));}});},'VoiceChannelStopMixMonitor':function(_0xcc84e){var _0x5b36d9=this;return new Promise(function(_0x5b6f7e,_0x17d16c){if(ami[_0xde3d('0x1a')]()==![]){return _0x17d16c(_0x5b36d9['error'](0x1f4,[config['asterisk']['ip'],config[_0xde3d('0x11')][_0xde3d('0x1b')],'ami\x20disconnected'][_0xde3d('0x1d')]('\x20')));}var _0x546dea=schema(properties[_0xde3d('0x6b')])[_0xde3d('0x3')](_0xcc84e);if(_0x546dea[_0xde3d('0x58')]>0x0){return _0x17d16c(_0x5b36d9[_0xde3d('0x19')](0x1f4,_[_0xde3d('0x5a')](_0x546dea,'message')[_0xde3d('0x1d')](',\x20')));}var _0x5b12a6=_[_0xde3d('0x5b')](_0x4446b5[_0xde3d('0x5c')],{'uniqueid':_0xcc84e[_0xde3d('0x60')]});if(_0x5b12a6){return BPromise[_0xde3d('0x6c')]()['then'](function(){if(_0x5b12a6[_0xde3d('0x5d')]){return ami[_0xde3d('0x15')]({'action':_0xde3d('0x6d'),'channel':_0x5b12a6[_0xde3d('0x5d')],'mixmonitorid':_0xcc84e['mixmonitorid']})[_0xde3d('0x18')](function(_0x1d867d){});}})['then'](function(){if(_0x5b12a6['destinationchannel']){return ami['Action']({'action':'StopMixMonitor','channel':_0x5b12a6[_0xde3d('0x6e')],'mixmonitorid':_0xcc84e['mixmonitorid']})[_0xde3d('0x18')](function(_0x5d6398){});}})[_0xde3d('0x16')](function(_0x2d27fb){var _0x4aa82e=_[_0xde3d('0x5b')](_0x5b12a6[_0xde3d('0x66')],{'mixmonitorid':_0xcc84e['mixmonitorid']});if(_0x4aa82e){_0x4aa82e[_0xde3d('0x69')]=_0xde3d('0x6f');}})[_0xde3d('0x16')](function(){var _0x571586=util[_0xde3d('0x9')](_0xde3d('0x5e'),_0xcc84e['filename']||_0xcc84e['uniqueid'],_0xcc84e[_0xde3d('0x9')]||_0xde3d('0x70'));var _0x264c13=_[_0xde3d('0x5b')](_0x5b12a6[_0xde3d('0x66')],{'filename':_0xde3d('0x63')+_0x571586['toLowerCase']()});if(_0x264c13){_0x264c13[_0xde3d('0x69')]='stop';}})['then'](function(){_0x5b6f7e({'code':0xc8,'message':[_0xcc84e[_0xde3d('0x60')],_0xde3d('0x71')][_0xde3d('0x1d')]('\x20')});})[_0xde3d('0x18')](function(_0x3ed4b3){_0x17d16c(_0x5b36d9['error'](0x1f5,[_0xcc84e[_0xde3d('0x60')],_0x3ed4b3[_0xde3d('0x17')][_0xde3d('0x64')]()]['join']('\x20')));});}else{return _0x17d16c(_0x5b36d9[_0xde3d('0x19')](0x1f5,_0xde3d('0x6a')));}});},'VoiceQueuesChannels':function(_0x1cd648){return new Promise(function(_0xa40af1,_0x113ac1){var _0x223c81=_['values'](_0x4446b5['queueChannels']);_0xa40af1({'count':_0x223c81[_0xde3d('0x58')],'rows':_0x223c81});});},'VoiceQueuesChannel':function(_0x2fd44d){var _0x267eee=this;return new Promise(function(_0x21983f,_0x420edf){var _0x2aa999=schema(properties[_0xde3d('0x72')])[_0xde3d('0x3')](_0x2fd44d);if(_0x2aa999[_0xde3d('0x58')]>0x0){return _0x420edf(_0x267eee[_0xde3d('0x19')](0x1f4,_[_0xde3d('0x5a')](_0x2aa999,_0xde3d('0x17'))[_0xde3d('0x1d')](',\x20')));}var _0x1124c9=_['find'](_0x4446b5[_0xde3d('0x73')],{'uniqueid':_0x2fd44d[_0xde3d('0x60')]});if(_0x1124c9){_0x21983f(_0x1124c9);}else{return _0x420edf(_0x267eee[_0xde3d('0x19')](0x1f5,_0xde3d('0x6a')));}});},'VoiceQueuesChannelHangup':function(_0x1a011b){var _0x2d132e=this;return new Promise(function(_0x1aeef2,_0x11c2f1){if(ami['isConnected']()==![]){return _0x11c2f1(_0x2d132e[_0xde3d('0x19')](0x1f4,[config['asterisk']['ip'],config[_0xde3d('0x11')][_0xde3d('0x1b')],'ami\x20disconnected']['join']('\x20')));}var _0x12b482=schema(properties['voicequeuechannelhangup'])[_0xde3d('0x3')](_0x1a011b);if(_0x12b482[_0xde3d('0x58')]>0x0){return _0x11c2f1(_0x2d132e[_0xde3d('0x19')](0x1f4,_['map'](_0x12b482,'message')[_0xde3d('0x1d')](',\x20')));}var _0x87ef8a=_[_0xde3d('0x5b')](_0x4446b5[_0xde3d('0x73')],{'uniqueid':_0x1a011b[_0xde3d('0x60')]});if(_0x87ef8a&&_0x87ef8a['channel']){return ami['Action']({'action':_0xde3d('0x74'),'channel':_0x87ef8a[_0xde3d('0x5d')]})[_0xde3d('0x16')](function(_0x39b8cc){_0x1aeef2({'code':0xc8,'message':[_0x1a011b[_0xde3d('0x60')],_0x39b8cc[_0xde3d('0x17')][_0xde3d('0x64')]()][_0xde3d('0x1d')]('\x20')});})['catch'](function(_0x53d408){_0x11c2f1(_0x2d132e[_0xde3d('0x19')](0x1f5,[_0x1a011b[_0xde3d('0x60')],_0x53d408['message']['toLowerCase']()][_0xde3d('0x1d')]('\x20')));});}else{return _0x11c2f1(_0x2d132e[_0xde3d('0x19')](0x1f5,_0xde3d('0x6a')));}});},'VoiceQueuesChannelRedirect':function(_0x3245d0){var _0x5defd7=this;return new Promise(function(_0x58d5ef,_0x585a9){if(ami[_0xde3d('0x1a')]()==![]){return _0x585a9(_0x5defd7[_0xde3d('0x19')](0x1f4,[config[_0xde3d('0x11')]['ip'],config['asterisk'][_0xde3d('0x1b')],_0xde3d('0x1c')][_0xde3d('0x1d')]('\x20')));}var _0x327497=schema(properties[_0xde3d('0x75')])['validate'](_0x3245d0);if(_0x327497[_0xde3d('0x58')]>0x0){return _0x585a9(_0x5defd7['error'](0x1f4,_[_0xde3d('0x5a')](_0x327497,_0xde3d('0x17'))[_0xde3d('0x1d')](',\x20')));}var _0x456879=_[_0xde3d('0x5b')](_0x4446b5['queueChannels'],{'uniqueid':_0x3245d0[_0xde3d('0x60')]});if(_0x456879&&_0x456879['channel']){return ami['Action']({'action':_0xde3d('0x76'),'channel':_0x456879['channel'],'exten':_0x3245d0[_0xde3d('0x77')],'context':_0x3245d0[_0xde3d('0x78')]||_0x456879[_0xde3d('0x78')],'priority':0x1})[_0xde3d('0x16')](function(_0x46ee0b){_0x58d5ef({'code':0xc8,'message':[_0x3245d0[_0xde3d('0x60')],_0x46ee0b[_0xde3d('0x17')][_0xde3d('0x64')]()][_0xde3d('0x1d')]('\x20')});})['catch'](function(_0x51537f){_0x585a9(_0x5defd7[_0xde3d('0x19')](0x1f5,[_0x3245d0[_0xde3d('0x60')],_0x51537f[_0xde3d('0x17')]['toLowerCase']()][_0xde3d('0x1d')]('\x20')));});}else{return _0x585a9(_0x5defd7['error'](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'Agents':function(_0x41c174){return new Promise(function(_0x4ab32f,_0x1954e1){var _0x157348=_[_0xde3d('0x59')](_0x4446b5[_0xde3d('0xe')]);_0x4ab32f({'count':_0x157348[_0xde3d('0x58')],'rows':_0x157348});});},'Telephones':function(_0x5e17e1){return new Promise(function(_0x138dfd,_0x4aadde){var _0x1a4a97=_['values'](_0x4446b5[_0xde3d('0x79')]);_0x138dfd({'count':_0x1a4a97[_0xde3d('0x58')],'rows':_0x1a4a97});});},'Trunks':function(_0x17495d){return new Promise(function(_0x1d2132,_0x1f4b6b){var _0x595bfe=_['values'](_0x4446b5[_0xde3d('0x7a')]);_0x1d2132({'count':_0x595bfe['length'],'rows':_0x595bfe});});},'OutboundChannels':function(_0x518b7b){return new Promise(function(_0x4839ba,_0xbcb092){var _0x537ad9=_[_0xde3d('0x59')](_0x4446b5['outboundChannels']);_0x4839ba({'count':_0x537ad9[_0xde3d('0x58')],'rows':_0x537ad9});});},'Outbound':function(_0x23a5b1){return new Promise(function(_0xae2a94,_0x4692f4){_0xae2a94(_0x4446b5[_0xde3d('0x7b')]);});},'Campaigns':function(_0xf8d342){return new Promise(function(_0x2e2f5f,_0x3ad5af){var _0x4e069d=_['values'](_0x4446b5[_0xde3d('0x7c')]);_0x2e2f5f({'count':_0x4e069d[_0xde3d('0x58')],'rows':_0x4e069d});});},'VoiceQueuesPreview':function(_0x2b2c8f){var _0x49cd04=this;return new Promise(function(_0x49b0ff,_0x5bbd3d){_0x5a77a1[_0xde3d('0x7d')](_0x2b2c8f['id'])[_0xde3d('0x16')](function(_0x274712){_0x49b0ff({'code':0xc8,'message':_0x274712[_0xde3d('0x17')]});})[_0xde3d('0x18')](function(_0x48d0f1){_0x5bbd3d(_0x49cd04[_0xde3d('0x19')](0x1f4,_0x48d0f1[_0xde3d('0x17')]));});});},'EventManager':function(_0x17e84a){var _0x444f91=this;return new Promise(function(_0x28c919,_0x3d5982){if(!_0x17e84a[_0xde3d('0x7e')]){return _0x3d5982(_0x444f91[_0xde3d('0x19')](0x1f4,_0xde3d('0x7f')));}ami[_0xde3d('0x80')](_0xde3d('0x81')+_0x17e84a['event'],_0x17e84a[_0xde3d('0x17')]);_0x28c919({'code':0xc8,'message':_0x17e84a});});},'FaxAccounts':function(_0x1a971e){return new Promise(function(_0x4ba9ec,_0x4aeb8e){var _0x2e8027=_[_0xde3d('0x59')](_0x4446b5[_0xde3d('0x82')]);_0x4ba9ec({'count':_0x2e8027[_0xde3d('0x58')],'rows':_0x2e8027});});},'SendFax':function(_0x301be7){var _0x54d320=this;return new Promise(function(_0x18b9b0,_0x346b6b){_0x4d87ed[_0xde3d('0x83')](_0x301be7)[_0xde3d('0x16')](function(_0x48a4a8){_0x18b9b0({'code':0xc8,'message':_0x48a4a8[_0xde3d('0x17')]});})[_0xde3d('0x18')](function(_0x400c47){_0x346b6b(_0x54d320[_0xde3d('0x19')](0x1f4,_0x400c47[_0xde3d('0x17')]));});});},'CheckAfterSend':function(_0x335538){var _0x3fe4cd=this;return new Promise(function(_0x2aee92,_0x3dd042){_0x4d87ed[_0xde3d('0x84')](_0x335538)[_0xde3d('0x16')](function(_0x5e5485){_0x2aee92({'code':0xc8,'message':_0x5e5485['message']});})[_0xde3d('0x18')](function(_0x4b914b){_0x3dd042(_0x3fe4cd[_0xde3d('0x19')](0x1f4,_0x4b914b[_0xde3d('0x17')]));});});}};var _0x27f53d=jayson[_0xde3d('0x85')](_0x33b24c)['http']();_0x27f53d['on']('error',function(_0x10422a){return _0x28b0de(_0x10422a);});_0x27f53d['listen'](0x232a,_0xde3d('0x86'),function(){console['log']('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x819fd0(_0xde3d('0x87')+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 636b2bc..4f73604 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 _0x6bab=['xmd-contactid2','format','user:%s','name','trigger:%s','action','toLowerCase','merge','resolve','createContact','error','bluebird','util','lodash','ioredis','../../../../config/logger','trigger','../../rpc/cmContact','redis','defaults','localhost','info','stringify','emit','exec','data1','calleridnum','routeId','firstName','calleridname','','uniqueid','destcalleridname','destcalleridnum','phone','then','showContact'];(function(_0x5c0ff6,_0x22cdd2){var _0x1135cd=function(_0x55d5b0){while(--_0x55d5b0){_0x5c0ff6['push'](_0x5c0ff6['shift']());}};_0x1135cd(++_0x22cdd2);}(_0x6bab,0x1c7));var _0xb6ba=function(_0x5ce3c8,_0x2503bd){_0x5ce3c8=_0x5ce3c8-0x0;var _0xa76867=_0x6bab[_0x5ce3c8];return _0xa76867;};'use strict';var BPromise=require(_0xb6ba('0x0'));var util=require(_0xb6ba('0x1'));var _=require(_0xb6ba('0x2'));var Redis=require(_0xb6ba('0x3'));var config=require('../../../../config/environment');var logger=require(_0xb6ba('0x4'))(_0xb6ba('0x5'));var cmContactRpc=require(_0xb6ba('0x6'));config[_0xb6ba('0x7')]=_[_0xb6ba('0x8')](config['redis'],{'host':_0xb6ba('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xb6ba('0x7')]));function emit(_0x389a0d,_0x3fd283,_0xbce6f){logger[_0xb6ba('0xa')](_0x389a0d,_0x3fd283,JSON[_0xb6ba('0xb')](_0xbce6f));io['to'](_0x389a0d)[_0xb6ba('0xc')](_0x3fd283,_0xbce6f);}exports[_0xb6ba('0xd')]=function(_0x36bdc2,_0x5ae28b,_0x16cb3a){_0x16cb3a['autoCreate']=0x0;if(_0x5ae28b['data2']&&parseInt(_0x5ae28b['data2'],0xa)){var _0x31e74b={'ListId':parseInt(_0x5ae28b[_0xb6ba('0xe')],0xa),'phone':_0x16cb3a[_0xb6ba('0xf')]};if(_['isNil'](_0x16cb3a[_0xb6ba('0x10')])){_0x31e74b[_0xb6ba('0x11')]=_0x16cb3a[_0xb6ba('0x12')]&&_0x16cb3a[_0xb6ba('0x12')]!==_0xb6ba('0x13')?_0x16cb3a[_0xb6ba('0x12')]:_0x16cb3a[_0xb6ba('0xf')]||_0x16cb3a[_0xb6ba('0x14')];}else{_0x31e74b[_0xb6ba('0x11')]=_0x16cb3a[_0xb6ba('0x15')]&&_0x16cb3a[_0xb6ba('0x15')]!==_0xb6ba('0x13')?_0x16cb3a[_0xb6ba('0x15')]:_0x16cb3a[_0xb6ba('0x16')]||_0x16cb3a[_0xb6ba('0x14')];_0x31e74b[_0xb6ba('0x17')]=_0x16cb3a[_0xb6ba('0x15')]&&_0x16cb3a[_0xb6ba('0x15')]!==_0xb6ba('0x13')?_0x16cb3a['destcalleridname']:_0x16cb3a[_0xb6ba('0x16')]||_0x16cb3a['uniqueid'];}BPromise['resolve']()[_0xb6ba('0x18')](cmContactRpc[_0xb6ba('0x19')]({'where':_['omit'](_0x31e74b,[_0xb6ba('0x11')])}))[_0xb6ba('0x18')](function(_0x53b217){if(_0x53b217){_0x16cb3a[_0xb6ba('0x1a')]=_0x53b217['id'];emit(util[_0xb6ba('0x1b')](_0xb6ba('0x1c'),_0x36bdc2[_0xb6ba('0x1d')]),util[_0xb6ba('0x1b')](_0xb6ba('0x1e'),_0x5ae28b[_0xb6ba('0x1f')][_0xb6ba('0x20')]()),_[_0xb6ba('0x21')](_0x16cb3a,{'ListId':parseInt(_0x5ae28b[_0xb6ba('0xe')],0xa)}));return;}else{return BPromise[_0xb6ba('0x22')]()[_0xb6ba('0x18')](cmContactRpc[_0xb6ba('0x23')](_0x31e74b));}})[_0xb6ba('0x18')](function(_0x164bd2){if(_0x164bd2){_0x16cb3a[_0xb6ba('0x1a')]=_0x164bd2['id'];emit(util['format']('user:%s',_0x36bdc2[_0xb6ba('0x1d')]),util['format'](_0xb6ba('0x1e'),_0x5ae28b[_0xb6ba('0x1f')][_0xb6ba('0x20')]()),_[_0xb6ba('0x21')](_0x16cb3a,{'ListId':parseInt(_0x5ae28b[_0xb6ba('0xe')],0xa)}));}})['catch'](function(_0x5ce5d7){logger[_0xb6ba('0x24')]('Error\x20creating\x20contact',JSON[_0xb6ba('0xb')](_0x5ce5d7));});}else{if(_0x36bdc2){emit(util[_0xb6ba('0x1b')](_0xb6ba('0x1c'),_0x36bdc2[_0xb6ba('0x1d')]),util[_0xb6ba('0x1b')](_0xb6ba('0x1e'),_0x5ae28b[_0xb6ba('0x1f')][_0xb6ba('0x20')]()),_['merge']({'ListId':parseInt(_0x5ae28b[_0xb6ba('0xe')],0xa)},_0x16cb3a));}}}; \ No newline at end of file +var _0x8814=['isNil','firstName','calleridname','','uniqueid','destcalleridname','destcalleridnum','omit','then','format','toLowerCase','merge','resolve','createContact','user:%s','name','trigger:%s','action','error','Error\x20creating\x20contact','bluebird','ioredis','../../../../config/logger','trigger','../../rpc/cmContact','redis','localhost','socket.io-emitter','info','stringify','emit','exec','data2','data1','calleridnum'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0x8814,0x1b8));var _0x4881=function(_0xbf8ebe,_0x3b69a5){_0xbf8ebe=_0xbf8ebe-0x0;var _0x1e25e8=_0x8814[_0xbf8ebe];return _0x1e25e8;};'use strict';var BPromise=require(_0x4881('0x0'));var util=require('util');var _=require('lodash');var Redis=require(_0x4881('0x1'));var config=require('../../../../config/environment');var logger=require(_0x4881('0x2'))(_0x4881('0x3'));var cmContactRpc=require(_0x4881('0x4'));config[_0x4881('0x5')]=_['defaults'](config[_0x4881('0x5')],{'host':_0x4881('0x6'),'port':0x18eb});var io=require(_0x4881('0x7'))(new Redis(config[_0x4881('0x5')]));function emit(_0x4bcf00,_0x1151b4,_0x505b8a){logger[_0x4881('0x8')](_0x4bcf00,_0x1151b4,JSON[_0x4881('0x9')](_0x505b8a));io['to'](_0x4bcf00)[_0x4881('0xa')](_0x1151b4,_0x505b8a);}exports[_0x4881('0xb')]=function(_0x5baef8,_0xda4edd,_0x3b05bf){_0x3b05bf['autoCreate']=0x0;if(_0xda4edd[_0x4881('0xc')]&&parseInt(_0xda4edd[_0x4881('0xc')],0xa)){var _0x1431dc={'ListId':parseInt(_0xda4edd[_0x4881('0xd')],0xa),'phone':_0x3b05bf[_0x4881('0xe')]};if(_[_0x4881('0xf')](_0x3b05bf['routeId'])){_0x1431dc[_0x4881('0x10')]=_0x3b05bf[_0x4881('0x11')]&&_0x3b05bf[_0x4881('0x11')]!==_0x4881('0x12')?_0x3b05bf['calleridname']:_0x3b05bf[_0x4881('0xe')]||_0x3b05bf[_0x4881('0x13')];}else{_0x1431dc[_0x4881('0x10')]=_0x3b05bf[_0x4881('0x14')]&&_0x3b05bf[_0x4881('0x14')]!==_0x4881('0x12')?_0x3b05bf['destcalleridname']:_0x3b05bf['destcalleridnum']||_0x3b05bf['uniqueid'];_0x1431dc['phone']=_0x3b05bf[_0x4881('0x14')]&&_0x3b05bf[_0x4881('0x14')]!==''?_0x3b05bf[_0x4881('0x14')]:_0x3b05bf[_0x4881('0x15')]||_0x3b05bf[_0x4881('0x13')];}BPromise['resolve']()['then'](cmContactRpc['showContact']({'where':_[_0x4881('0x16')](_0x1431dc,['firstName'])}))[_0x4881('0x17')](function(_0x3d455b){if(_0x3d455b){_0x3b05bf['xmd-contactid2']=_0x3d455b['id'];emit(util['format']('user:%s',_0x5baef8['name']),util[_0x4881('0x18')]('trigger:%s',_0xda4edd['action'][_0x4881('0x19')]()),_[_0x4881('0x1a')](_0x3b05bf,{'ListId':parseInt(_0xda4edd[_0x4881('0xd')],0xa)}));return;}else{return BPromise[_0x4881('0x1b')]()[_0x4881('0x17')](cmContactRpc[_0x4881('0x1c')](_0x1431dc));}})['then'](function(_0x56dd31){if(_0x56dd31){_0x3b05bf['xmd-contactid2']=_0x56dd31['id'];emit(util[_0x4881('0x18')](_0x4881('0x1d'),_0x5baef8[_0x4881('0x1e')]),util[_0x4881('0x18')](_0x4881('0x1f'),_0xda4edd[_0x4881('0x20')]['toLowerCase']()),_[_0x4881('0x1a')](_0x3b05bf,{'ListId':parseInt(_0xda4edd[_0x4881('0xd')],0xa)}));}})['catch'](function(_0x221836){logger[_0x4881('0x21')](_0x4881('0x22'),JSON[_0x4881('0x9')](_0x221836));});}else{if(_0x5baef8){emit(util[_0x4881('0x18')]('user:%s',_0x5baef8[_0x4881('0x1e')]),util[_0x4881('0x18')](_0x4881('0x1f'),_0xda4edd['action'][_0x4881('0x19')]()),_[_0x4881('0x1a')]({'ListId':parseInt(_0xda4edd['data1'],0xa)},_0x3b05bf));}}}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index e1fcd92..b42a2c4 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 _0x8309=['custom:agentringnoanswer','custom:agentcomplete','custom:queuecallerabandon','custom:dialbegin','syncAgentDial','custom:dialend','custom:closedinteraction','custom:outgoingmessage','custom:acceptmessage','emit','info','stringify','prototype','checkTriggers','interface','hasOwnProperty','status','checkTrigger','merge','variables','Actions','action','toLowerCase','contactmanager','motionbar','browser','popup','data2','html','render','template\x20not\x20found','uri','buildUri','isNil','data3','data4','location','uriLocation','windowWidth','data5','800','windowHeight','data6','winApplication','winArguments','format','data1','jscripty','user:%s','name','trigger:%s','exec','integration','urlforward','script','parse','query','search','AllConditions','every','checkConditions','channel','AnyConditions','length','some','field','account','chat','ChatWebsiteId','operator','value','upperFirst','AccountId','interaction','event','queue','membername','lastevent','routeId','exports','util','url','mustache','ioredis','./urlforward','./cmContact','../rpc/cmContact','../../../config/environment','../../../config/logger','trigger','../ami','redis','defaults','localhost','socket.io-emitter','winapp','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','dynamics365Accounts','freshsalesAccounts','servicenowAccounts','syncCustomEvent','bind'];(function(_0x1f8273,_0x2e6c41){var _0x3fb362=function(_0x1fc447){while(--_0x1fc447){_0x1f8273['push'](_0x1f8273['shift']());}};_0x3fb362(++_0x2e6c41);}(_0x8309,0xc1));var _0x9830=function(_0x196e86,_0x150961){_0x196e86=_0x196e86-0x0;var _0x54a40c=_0x8309[_0x196e86];return _0x54a40c;};'use strict';var util=require(_0x9830('0x0'));var _=require('lodash');var url=require(_0x9830('0x1'));var Mustache=require(_0x9830('0x2'));var Redis=require(_0x9830('0x3'));var urlforward=require(_0x9830('0x4'));var integration=require('./integration');var cmContact=require(_0x9830('0x5'));var script=require('./script');var cmContactRpc=require(_0x9830('0x6'));var config=require(_0x9830('0x7'));var logger=require(_0x9830('0x8'))(_0x9830('0x9'));var ami=require(_0x9830('0xa'));config[_0x9830('0xb')]=_[_0x9830('0xc')](config[_0x9830('0xb')],{'host':_0x9830('0xd'),'port':0x18eb});var io=require(_0x9830('0xe'))(new Redis(config[_0x9830('0xb')]));var operators={'equals':function(_0x2df49c,_0x2fdd6a){return _0x2df49c==_0x2fdd6a;},'not_equals':function(_0x2e720b,_0x5c2f39){return _0x2e720b!=_0x5c2f39;}};var barAndWebActions=['popup','url',_0x9830('0xf')];function Trigger(_0x57dc07){this['triggers']=_0x57dc07[_0x9830('0x10')];this[_0x9830('0x11')]=_0x57dc07[_0x9830('0x11')];this[_0x9830('0x12')]=_0x57dc07[_0x9830('0x12')];this[_0x9830('0x13')]=_0x57dc07[_0x9830('0x13')];this['voiceExtensions']=_0x57dc07[_0x9830('0x14')];this[_0x9830('0x15')]=_0x57dc07[_0x9830('0x15')];this[_0x9830('0x16')]=_0x57dc07[_0x9830('0x16')];this[_0x9830('0x17')]=_0x57dc07[_0x9830('0x17')];this[_0x9830('0x18')]=_0x57dc07[_0x9830('0x18')];this[_0x9830('0x19')]=_0x57dc07['zohoAccounts'];this[_0x9830('0x1a')]=_0x57dc07['deskAccounts'];this[_0x9830('0x1b')]=_0x57dc07[_0x9830('0x1b')];this['servicenowAccounts']=_0x57dc07['servicenowAccounts'];this['dynamics365Accounts']=_0x57dc07[_0x9830('0x1c')];this[_0x9830('0x1d')]=_0x57dc07[_0x9830('0x1d')];this['accounts']={'zendesk':this['zendeskAccounts'],'salesforce':this['salesforceAccounts'],'freshdesk':this['freshdeskAccounts'],'sugarcrm':this['sugarcrmAccounts'],'zoho':this[_0x9830('0x19')],'desk':this[_0x9830('0x1a')],'vtiger':this[_0x9830('0x1b')],'dynamics365':this['dynamics365Accounts'],'freshsales':this['freshsalesAccounts'],'servicenow':this[_0x9830('0x1e')]};ami['on']('custom:agentcalled',this[_0x9830('0x1f')][_0x9830('0x20')](this));ami['on']('custom:agentconnect',this['syncCustomEvent'][_0x9830('0x20')](this));ami['on'](_0x9830('0x21'),this['syncCustomEvent'][_0x9830('0x20')](this));ami['on'](_0x9830('0x22'),this[_0x9830('0x1f')]['bind'](this));ami['on'](_0x9830('0x23'),this['syncCustomEvent'][_0x9830('0x20')](this));ami['on'](_0x9830('0x24'),this[_0x9830('0x25')][_0x9830('0x20')](this));ami['on']('custom:dialconnect',this['syncAgentDial'][_0x9830('0x20')](this));ami['on'](_0x9830('0x26'),this[_0x9830('0x25')][_0x9830('0x20')](this));ami['on']('custom:newinteraction',this[_0x9830('0x1f')][_0x9830('0x20')](this));ami['on'](_0x9830('0x27'),this[_0x9830('0x1f')][_0x9830('0x20')](this));ami['on']('custom:incomingmessage',this[_0x9830('0x1f')][_0x9830('0x20')](this));ami['on'](_0x9830('0x28'),this[_0x9830('0x1f')]['bind'](this));ami['on'](_0x9830('0x29'),this[_0x9830('0x1f')]['bind'](this));ami['on']('custom:rejectmessage',this[_0x9830('0x1f')]['bind'](this));}Trigger['prototype'][_0x9830('0x2a')]=function(_0x1c6c39,_0x569f6e,_0x252295){logger[_0x9830('0x2b')](_0x1c6c39,_0x569f6e,JSON[_0x9830('0x2c')](_0x252295));io['to'](_0x1c6c39)[_0x9830('0x2a')](_0x569f6e,_0x252295);};Trigger[_0x9830('0x2d')]['syncCustomEvent']=function(_0x33e6de){var _0x5cad3f=_['clone'](_0x33e6de);this[_0x9830('0x2e')](_0x5cad3f);};Trigger['prototype'][_0x9830('0x25')]=function(_0x4c8ed0){if(this[_0x9830('0x11')][_0x4c8ed0[_0x9830('0x2f')]]){this[_0x9830('0x1f')](_0x4c8ed0);}};Trigger['prototype'][_0x9830('0x2e')]=function(_0xc93e74){var _0xac95a;for(var _0x58a158 in this['triggers']){if(this[_0x9830('0x10')][_0x9830('0x30')](_0x58a158)){if(this[_0x9830('0x10')][_0x58a158][_0x9830('0x31')]){_0xac95a=this[_0x9830('0x32')](this[_0x9830('0x10')][_0x58a158],_0xc93e74);if(_0xac95a){_[_0x9830('0x33')](_0xc93e74,_0xc93e74[_0x9830('0x34')]);for(var _0x170270=0x0,_0x247ea1,_0x28a849,_0x302de5;_0x1702700x0){_0x59644e=_[_0xb282('0x26')](_0x2a4491,_0x280940);}return _0x59644e;}function getCustomFields(_0xe337b8,_0x433ad5){var _0x4cee93=[];var _0xfddd2e={'custom_fields':{}};if(_0xe337b8[_0xb282('0x25')]>0x0){_['forEach'](_0xe337b8,function(_0x1b15b5){if(_0x1b15b5[_0xb282('0x27')]===_0xb282('0x28')&&_0x1b15b5[_0xb282('0x29')]&&!_0x1b15b5[_0xb282('0x2a')]){_0xfddd2e[_0x1b15b5['nameField'][_0xb282('0x2b')]()]=_0x1b15b5['content'][_0xb282('0x2c')]();}else if(_0x1b15b5[_0xb282('0x27')]===_0xb282('0x28')&&_0x1b15b5['idField']&&_0x1b15b5[_0xb282('0x2a')]){_0xfddd2e['custom_fields'][_0x1b15b5[_0xb282('0x2d')]]=_0x1b15b5[_0xb282('0x2e')][_0xb282('0x2c')]();}else if(_0x1b15b5[_0xb282('0x27')]===_0xb282('0x2f')&&_0x1b15b5[_0xb282('0x30')]&&_0x1b15b5['idField']&&_0x1b15b5[_0xb282('0x2a')]){_0x433ad5[_0x1b15b5[_0xb282('0x30')]]&&(_0xfddd2e['custom_fields'][_0x1b15b5['idField']]=_0x433ad5[_0x1b15b5[_0xb282('0x30')]][_0xb282('0x2c')]());}else if(_0x1b15b5[_0xb282('0x27')]==='customVariable'&&_0x1b15b5['Variable']&&_0x1b15b5['Variable'][_0xb282('0x31')]&&_0x1b15b5[_0xb282('0x2d')]&&_0x1b15b5[_0xb282('0x2a')]){_0x433ad5[_0x1b15b5[_0xb282('0x32')][_0xb282('0x31')][_0xb282('0x2b')]()]&&(_0xfddd2e[_0xb282('0x33')][_0x1b15b5['idField']]=_0x433ad5[_0x1b15b5[_0xb282('0x32')]['name'][_0xb282('0x2b')]()][_0xb282('0x2c')]());}});}if(_0xfddd2e[_0xb282('0x34')]){_0xfddd2e['priority']=Number(_0xfddd2e[_0xb282('0x34')]);}return _0xfddd2e;}function getTicket(_0x4beef2,_0x3bd325,_0x13eb0f,_0x1deac2,_0x246c85){logger['info']('Creating\x20new\x20ticket...');var _0x397fa1=_[_0xb282('0x35')]({'subject':intUtil[_0xb282('0x36')](_0x1deac2[_0xb282('0x37')],_0x246c85,'\x20'),'type':'phone','status':_0xb282('0x38'),'labels':['xCALLY',_0xb282('0x39'),_0xb282('0x3a')]['concat'](getTags(_0x1deac2[_0xb282('0x3b')],_0xb282('0x31'))),'description':intUtil[_0xb282('0x36')](_0x1deac2[_0xb282('0x3c')],_0x246c85,'\x0a'),'_links':{'assigned_user':{'href':util[_0xb282('0xd')](_0xb282('0x3d'),_0x3bd325['id']),'class':_0xb282('0x3e')}},'message':{'direction':'in','body':intUtil[_0xb282('0x36')](_0x1deac2[_0xb282('0x3c')],_0x246c85,'\x0a')}},getCustomFields(_0x1deac2[_0xb282('0x3f')],_0x246c85));return request({'uri':util[_0xb282('0xd')](_0xb282('0x40'),_0x4beef2[_0xb282('0xf')],_0x13eb0f['id']),'method':_0xb282('0x23'),'body':_0x397fa1});}exports[_0xb282('0x41')]=function(_0x182f87,_0x2416a4,_0x7332d2,_0x573da7,_0x310ad1,_0x58109a){var _0x3053a3,_0x2997dc;_0x58109a[_0xb282('0xf')]=intUtil[_0xb282('0x42')](_0x58109a[_0xb282('0xf')]);_0x58109a[_0xb282('0x43')]=intUtil['stripTrailingSlash'](_0x58109a['serverUrl']);if(_0x310ad1&&_0x310ad1[_0xb282('0x44')]){logger['info'](_0xb282('0x45'),_0xb282('0x46'));_0x2416a4['recordingURL']=util[_0xb282('0xd')](_0xb282('0x47'),_0x58109a[_0xb282('0x43')],_0x2416a4['uniqueid'],md5(_0x2416a4['uniqueid']));}else{_0x2416a4[_0xb282('0x48')]='';}headers['Authorization']=getAuth(_0x58109a);return getUser(_0x58109a,_0x573da7[_0xb282('0x49')])[_0xb282('0x10')](function(_0x76255){_0x3053a3=_0x76255;logger[_0xb282('0x13')](_0xb282('0x4a'),_0x3053a3['id']);return getEndUser(_0x58109a,_0x2416a4[_0xb282('0x4b')],_0x2416a4['calleridnum']);})[_0xb282('0x10')](function(_0xb0cf81){_0x2997dc=_0xb0cf81;logger[_0xb282('0x13')]('The\x20Enduser\x20ID\x20is:',_0x2997dc['id']);return getTicket(_0x58109a,_0x3053a3,_0x2997dc,_0x7332d2,_0x2416a4);})[_0xb282('0x10')](function(_0x48e5e2){if(_0x48e5e2){logger[_0xb282('0x13')]('Ticket\x20created!');logger[_0xb282('0x13')]('The\x20Ticket\x20ID\x20is:',_0x48e5e2['id']);switch(_0x58109a['type']){case'integrationTab':logger[_0xb282('0x13')](_0xb282('0x45'),_0xb282('0x4c'));emit(util[_0xb282('0xd')]('user:%s',_0x573da7['name']),'trigger:desk:display',{'recordId':_0x48e5e2['id']});break;case _0xb282('0x4d'):logger[_0xb282('0x13')](_0xb282('0x45'),_0xb282('0x4e'));emit(util['format'](_0xb282('0x4f'),_0x573da7[_0xb282('0x31')]),'trigger:browser:url',{'uri':util[_0xb282('0xd')](_0xb282('0x50'),_0x48e5e2['id'])});break;default:logger[_0xb282('0x51')](_0xb282('0x45'),_0xb282('0x52'));}}})['catch'](function(_0x6a295c){console[_0xb282('0x51')](_0x6a295c);logger[_0xb282('0x51')](_0xb282('0x45'),JSON[_0xb282('0x16')](_0x6a295c));});};exports[_0xb282('0x53')]=function(_0x4cde65,_0x87d777,_0x574653,_0x4554f1,_0x1e6ade,_0x5ca27b,_0x33b658){var _0x3dd8cb,_0x5380fe;_0x5ca27b['remoteUri']=intUtil['stripTrailingSlash'](_0x5ca27b[_0xb282('0xf')]);_0x5ca27b[_0xb282('0x43')]=intUtil[_0xb282('0x42')](_0x5ca27b['serverUrl']);if(_0x33b658&&_0x33b658[_0xb282('0x54')]&&_0x33b658['recordingFormat']!==_0xb282('0x55')){logger[_0xb282('0x13')]('[OUTBOUND]',_0xb282('0x46'));_0x87d777['recordingURL']=util[_0xb282('0xd')](_0xb282('0x47'),_0x5ca27b[_0xb282('0x43')],_0x87d777[_0xb282('0x56')],md5(_0x87d777[_0xb282('0x56')]));}headers[_0xb282('0x57')]=getAuth(_0x5ca27b);return getUser(_0x5ca27b,_0x4554f1['email'])[_0xb282('0x10')](function(_0x595387){_0x3dd8cb=_0x595387;logger[_0xb282('0x13')](_0xb282('0x4a'),_0x3dd8cb['id']);return getEndUser(_0x5ca27b,_0x87d777['destcalleridname'],_0x87d777['destcalleridnum']);})[_0xb282('0x10')](function(_0x20a0b6){_0x5380fe=_0x20a0b6;logger[_0xb282('0x13')]('The\x20Enduser\x20ID\x20is:',_0x5380fe['id']);return getTicket(_0x5ca27b,_0x3dd8cb,_0x5380fe,_0x574653,_0x87d777);})['then'](function(_0x40ae87){if(_0x40ae87){logger[_0xb282('0x13')](_0xb282('0x58'));logger['info'](_0xb282('0x59'),_0x40ae87['id']);switch(_0x5ca27b['type']){case _0xb282('0x5a'):logger[_0xb282('0x13')](_0xb282('0x45'),_0xb282('0x4c'));emit(util[_0xb282('0xd')](_0xb282('0x4f'),_0x4554f1[_0xb282('0x31')]),'trigger:desk:display',{'recordId':_0x40ae87['id']});break;case _0xb282('0x4d'):logger[_0xb282('0x13')](_0xb282('0x45'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0xb282('0x4f'),_0x4554f1[_0xb282('0x31')]),_0xb282('0x5b'),{'uri':util['format']('%s/agent/tickets/%s',_0x5ca27b[_0xb282('0xf')],_0x40ae87['id'])});break;default:logger[_0xb282('0x51')]('[OUTBOUND]',_0xb282('0x52'));}}})[_0xb282('0x5c')](function(_0x15c7b7){logger['error'](_0xb282('0x5d'),JSON[_0xb282('0x16')](_0x15c7b7));});};exports['abandoned']=function(_0x214052,_0x20e01e,_0x33b5ec,_0x26c9a6,_0x4ea7a6,_0x4a129d){var _0xfdf710,_0x3c88ff;_0x4a129d['remoteUri']=intUtil[_0xb282('0x42')](_0x4a129d[_0xb282('0xf')]);_0x4a129d[_0xb282('0x43')]=intUtil[_0xb282('0x42')](_0x4a129d[_0xb282('0x43')]);if(_0x4ea7a6&&_0x4ea7a6[_0xb282('0x44')]){logger[_0xb282('0x13')](_0xb282('0x5e'),'Recording\x20is\x20enabled!');_0x20e01e[_0xb282('0x48')]=util[_0xb282('0xd')](_0xb282('0x47'),_0x4a129d['serverUrl'],_0x20e01e[_0xb282('0x56')],md5(_0x20e01e[_0xb282('0x56')]));}else{_0x20e01e['recordingURL']='';}headers['Authorization']=getAuth(_0x4a129d);return getUser(_0x4a129d)[_0xb282('0x10')](function(_0x1ef276){_0xfdf710=_0x1ef276;logger[_0xb282('0x13')](_0xb282('0x4a'),_0xfdf710['id']);return getEndUser(_0x4a129d,_0x20e01e[_0xb282('0x4b')],_0x20e01e[_0xb282('0x5f')]);})[_0xb282('0x10')](function(_0xbb4060){_0x3c88ff=_0xbb4060;logger[_0xb282('0x13')](_0xb282('0x60'),_0x3c88ff['id']);return getTicket(_0x4a129d,_0xfdf710,_0x3c88ff,_0x33b5ec,_0x20e01e);})[_0xb282('0x10')](function(_0x3a6712){if(_0x3a6712){logger[_0xb282('0x13')](_0xb282('0x58'));logger[_0xb282('0x13')](_0xb282('0x59'),_0x3a6712['id']);}})['catch'](function(_0x2cffa2){logger[_0xb282('0x51')](_0xb282('0x5e'),JSON[_0xb282('0x16')](_0x2cffa2));});}; \ No newline at end of file +var _0x8603=['Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','remoteUri','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','%s/users/me','debug','[HTTP]','stringify','GET','authType','basic','username','password','token','%s/token:%s','Basic\x20%s','toString','base64','Searching\x20enduser\x20with\x20phone','%s/customers/search','total_entries','%s/customers','POST','work','map','length','forEach','string','nameField','customField','toLowerCase','idField','content','type','variableName','custom_fields','customVariable','Variable','name','priority','Creating\x20new\x20ticket...','merge','getString','phone','xCALLY','Motion','concat','Tags','Descriptions','/api/v2/users/%d','Fields','%s/customers/%d/cases','queue','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','newTab','https://xcally.desk.com/web/agent/case/%d','error','catch','outbound','recordingFormat','none','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','user:%s','trigger:desk:display','Desk\x20account\x20type\x20not\x20recognized','abandoned','monitor_format','[ABANDONED]','request-promise','md5','util','../../../../config/environment','../../../../config/logger','desk','defaults','localhost','socket.io-emitter','redis','application/json','validateEmail','info','format','%s/users','then','find','_embedded','entries','Agent\x20found!'];(function(_0x5e88c8,_0x176845){var _0x40a1c0=function(_0x5cb138){while(--_0x5cb138){_0x5e88c8['push'](_0x5e88c8['shift']());}};_0x40a1c0(++_0x176845);}(_0x8603,0x190));var _0x3860=function(_0x2cd793,_0x2f6819){_0x2cd793=_0x2cd793-0x0;var _0x5554ab=_0x8603[_0x2cd793];return _0x5554ab;};'use strict';var _=require('lodash');var rp=require(_0x3860('0x0'));var md5=require(_0x3860('0x1'));var util=require(_0x3860('0x2'));var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0x3860('0x3'));var logger=require(_0x3860('0x4'))(_0x3860('0x5'));config['redis']=_[_0x3860('0x6')](config['redis'],{'host':_0x3860('0x7'),'port':0x18eb});var io=require(_0x3860('0x8'))(new Redis(config[_0x3860('0x9')]));function emit(_0xd3ce26,_0x472bf2,_0x4aba10){io['to'](_0xd3ce26)['emit'](_0x472bf2,_0x4aba10);}var headers={'Content-Type':'application/json','Accept':_0x3860('0xa')};function getUser(_0x441dc4,_0x52c277){if(intUtil[_0x3860('0xb')](_0x52c277)===!![]){logger[_0x3860('0xc')]('Getting\x20agent\x20with\x20email',_0x52c277);return request({'uri':util[_0x3860('0xd')](_0x3860('0xe'),_0x441dc4['remoteUri'])})[_0x3860('0xf')](function(_0x16ca69){if(_0x16ca69['total_entries']){return _[_0x3860('0x10')](_0x16ca69[_0x3860('0x11')][_0x3860('0x12')],{'email':_0x52c277});}})[_0x3860('0xf')](function(_0x3f3630){if(_0x3f3630){logger[_0x3860('0xc')](_0x3860('0x13'));return _0x3f3630;}else{logger[_0x3860('0xc')](_0x3860('0x14'));return request({'uri':util[_0x3860('0xd')]('%s/users/me',_0x441dc4[_0x3860('0x15')])});}});}else{logger[_0x3860('0xc')](_0x3860('0x16'));return request({'uri':util[_0x3860('0xd')](_0x3860('0x17'),_0x441dc4[_0x3860('0x15')])});}}function request(_0x2d8a3a){logger[_0x3860('0x18')](_0x3860('0x19'),JSON[_0x3860('0x1a')](_0x2d8a3a));return rp(_[_0x3860('0x6')](_0x2d8a3a,{'method':_0x3860('0x1b'),'headers':headers,'json':!![]}));}function getAuth(_0x4b6b15){var _0x4863bd;if(_0x4b6b15[_0x3860('0x1c')]===_0x3860('0x1d')){_0x4863bd=util[_0x3860('0xd')]('%s:%s',_0x4b6b15[_0x3860('0x1e')],_0x4b6b15[_0x3860('0x1f')]);}else if(_0x4b6b15[_0x3860('0x1c')]===_0x3860('0x20')){_0x4863bd=util[_0x3860('0xd')](_0x3860('0x21'),_0x4b6b15[_0x3860('0x1e')],_0x4b6b15[_0x3860('0x20')]);}return util[_0x3860('0xd')](_0x3860('0x22'),new Buffer(_0x4863bd)[_0x3860('0x23')](_0x3860('0x24')));}function getEndUser(_0x280ea9,_0x9eaaa1,_0xd33a51){logger['info'](_0x3860('0x25'),_0xd33a51);return request({'uri':util[_0x3860('0xd')](_0x3860('0x26'),_0x280ea9[_0x3860('0x15')]),'qs':{'phone':_0xd33a51}})[_0x3860('0xf')](function(_0x56a6d1){if(_0x56a6d1[_0x3860('0x27')]){logger['info']('Enduser\x20found!');return _0x56a6d1[_0x3860('0x11')][_0x3860('0x12')][0x0];}else{logger['info']('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util['format'](_0x3860('0x28'),_0x280ea9[_0x3860('0x15')]),'method':_0x3860('0x29'),'body':{'first_name':_0x9eaaa1,'title':_0x9eaaa1,'phone_numbers':[{'type':_0x3860('0x2a'),'value':_0xd33a51}]}});}});}function getTags(_0x9332a5,_0x228d34){var _0x544b9a=[];if(_0x9332a5&&_0x9332a5['length']>0x0){_0x544b9a=_[_0x3860('0x2b')](_0x9332a5,_0x228d34);}return _0x544b9a;}function getCustomFields(_0x1f1809,_0x5a9af2){var _0x2551f4=[];var _0x3d5143={'custom_fields':{}};if(_0x1f1809[_0x3860('0x2c')]>0x0){_[_0x3860('0x2d')](_0x1f1809,function(_0x3628f7){if(_0x3628f7['type']===_0x3860('0x2e')&&_0x3628f7[_0x3860('0x2f')]&&!_0x3628f7[_0x3860('0x30')]){_0x3d5143[_0x3628f7['nameField'][_0x3860('0x31')]()]=_0x3628f7['content'][_0x3860('0x23')]();}else if(_0x3628f7['type']===_0x3860('0x2e')&&_0x3628f7[_0x3860('0x32')]&&_0x3628f7[_0x3860('0x30')]){_0x3d5143['custom_fields'][_0x3628f7[_0x3860('0x32')]]=_0x3628f7[_0x3860('0x33')]['toString']();}else if(_0x3628f7[_0x3860('0x34')]==='variable'&&_0x3628f7[_0x3860('0x35')]&&_0x3628f7[_0x3860('0x32')]&&_0x3628f7[_0x3860('0x30')]){_0x5a9af2[_0x3628f7[_0x3860('0x35')]]&&(_0x3d5143[_0x3860('0x36')][_0x3628f7[_0x3860('0x32')]]=_0x5a9af2[_0x3628f7[_0x3860('0x35')]]['toString']());}else if(_0x3628f7[_0x3860('0x34')]===_0x3860('0x37')&&_0x3628f7['Variable']&&_0x3628f7[_0x3860('0x38')][_0x3860('0x39')]&&_0x3628f7[_0x3860('0x32')]&&_0x3628f7['customField']){_0x5a9af2[_0x3628f7['Variable'][_0x3860('0x39')][_0x3860('0x31')]()]&&(_0x3d5143[_0x3860('0x36')][_0x3628f7[_0x3860('0x32')]]=_0x5a9af2[_0x3628f7['Variable']['name'][_0x3860('0x31')]()][_0x3860('0x23')]());}});}if(_0x3d5143[_0x3860('0x3a')]){_0x3d5143[_0x3860('0x3a')]=Number(_0x3d5143[_0x3860('0x3a')]);}return _0x3d5143;}function getTicket(_0x4df2a9,_0x424424,_0xbfa744,_0x5a7b5b,_0x59c662){logger[_0x3860('0xc')](_0x3860('0x3b'));var _0x295752=_[_0x3860('0x3c')]({'subject':intUtil[_0x3860('0x3d')](_0x5a7b5b['Subjects'],_0x59c662,'\x20'),'type':_0x3860('0x3e'),'status':'new','labels':[_0x3860('0x3f'),_0x3860('0x40'),'CTI'][_0x3860('0x41')](getTags(_0x5a7b5b[_0x3860('0x42')],'name')),'description':intUtil[_0x3860('0x3d')](_0x5a7b5b[_0x3860('0x43')],_0x59c662,'\x0a'),'_links':{'assigned_user':{'href':util[_0x3860('0xd')](_0x3860('0x44'),_0x424424['id']),'class':'user'}},'message':{'direction':'in','body':intUtil[_0x3860('0x3d')](_0x5a7b5b[_0x3860('0x43')],_0x59c662,'\x0a')}},getCustomFields(_0x5a7b5b[_0x3860('0x45')],_0x59c662));return request({'uri':util['format'](_0x3860('0x46'),_0x4df2a9['remoteUri'],_0xbfa744['id']),'method':_0x3860('0x29'),'body':_0x295752});}exports[_0x3860('0x47')]=function(_0x405bfc,_0x3f613f,_0x2220c8,_0x3f4216,_0x4e0a44,_0xbbbf01){var _0x3d0b7d,_0x5dc78f;_0xbbbf01['remoteUri']=intUtil[_0x3860('0x48')](_0xbbbf01[_0x3860('0x15')]);_0xbbbf01['serverUrl']=intUtil[_0x3860('0x48')](_0xbbbf01[_0x3860('0x49')]);if(_0x4e0a44&&_0x4e0a44['monitor_format']){logger[_0x3860('0xc')](_0x3860('0x4a'),_0x3860('0x4b'));_0x3f613f[_0x3860('0x4c')]=util[_0x3860('0xd')](_0x3860('0x4d'),_0xbbbf01[_0x3860('0x49')],_0x3f613f[_0x3860('0x4e')],md5(_0x3f613f[_0x3860('0x4e')]));}else{_0x3f613f[_0x3860('0x4c')]='';}headers[_0x3860('0x4f')]=getAuth(_0xbbbf01);return getUser(_0xbbbf01,_0x3f4216[_0x3860('0x50')])[_0x3860('0xf')](function(_0x57b91d){_0x3d0b7d=_0x57b91d;logger[_0x3860('0xc')]('The\x20User\x20ID\x20is:',_0x3d0b7d['id']);return getEndUser(_0xbbbf01,_0x3f613f[_0x3860('0x51')],_0x3f613f[_0x3860('0x52')]);})[_0x3860('0xf')](function(_0xbad34b){_0x5dc78f=_0xbad34b;logger[_0x3860('0xc')](_0x3860('0x53'),_0x5dc78f['id']);return getTicket(_0xbbbf01,_0x3d0b7d,_0x5dc78f,_0x2220c8,_0x3f613f);})[_0x3860('0xf')](function(_0x27ef92){if(_0x27ef92){logger['info'](_0x3860('0x54'));logger[_0x3860('0xc')](_0x3860('0x55'),_0x27ef92['id']);switch(_0xbbbf01['type']){case _0x3860('0x56'):logger[_0x3860('0xc')](_0x3860('0x4a'),_0x3860('0x57'));emit(util['format']('user:%s',_0x3f4216[_0x3860('0x39')]),'trigger:desk:display',{'recordId':_0x27ef92['id']});break;case _0x3860('0x58'):logger[_0x3860('0xc')](_0x3860('0x4a'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x3860('0xd')]('user:%s',_0x3f4216[_0x3860('0x39')]),'trigger:browser:url',{'uri':util[_0x3860('0xd')](_0x3860('0x59'),_0x27ef92['id'])});break;default:logger[_0x3860('0x5a')]('[QUEUE]','Desk\x20account\x20type\x20not\x20recognized');}}})[_0x3860('0x5b')](function(_0x2de249){console['error'](_0x2de249);logger[_0x3860('0x5a')]('[QUEUE]',JSON[_0x3860('0x1a')](_0x2de249));});};exports[_0x3860('0x5c')]=function(_0x254631,_0x233eee,_0x426497,_0xe93a04,_0x3fad85,_0x5a9987,_0x2fb762){var _0x73222c,_0x3367ce;_0x5a9987[_0x3860('0x15')]=intUtil[_0x3860('0x48')](_0x5a9987[_0x3860('0x15')]);_0x5a9987['serverUrl']=intUtil[_0x3860('0x48')](_0x5a9987[_0x3860('0x49')]);if(_0x2fb762&&_0x2fb762[_0x3860('0x5d')]&&_0x2fb762[_0x3860('0x5d')]!==_0x3860('0x5e')){logger[_0x3860('0xc')](_0x3860('0x5f'),_0x3860('0x4b'));_0x233eee['recordingURL']=util[_0x3860('0xd')](_0x3860('0x4d'),_0x5a9987['serverUrl'],_0x233eee[_0x3860('0x4e')],md5(_0x233eee[_0x3860('0x4e')]));}headers[_0x3860('0x4f')]=getAuth(_0x5a9987);return getUser(_0x5a9987,_0xe93a04['email'])[_0x3860('0xf')](function(_0x5f4b87){_0x73222c=_0x5f4b87;logger[_0x3860('0xc')](_0x3860('0x60'),_0x73222c['id']);return getEndUser(_0x5a9987,_0x233eee[_0x3860('0x61')],_0x233eee[_0x3860('0x62')]);})[_0x3860('0xf')](function(_0x1cee19){_0x3367ce=_0x1cee19;logger[_0x3860('0xc')](_0x3860('0x53'),_0x3367ce['id']);return getTicket(_0x5a9987,_0x73222c,_0x3367ce,_0x426497,_0x233eee);})[_0x3860('0xf')](function(_0x151492){if(_0x151492){logger[_0x3860('0xc')](_0x3860('0x54'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x151492['id']);switch(_0x5a9987['type']){case _0x3860('0x56'):logger['info']('[QUEUE]',_0x3860('0x57'));emit(util[_0x3860('0xd')](_0x3860('0x63'),_0xe93a04[_0x3860('0x39')]),_0x3860('0x64'),{'recordId':_0x151492['id']});break;case _0x3860('0x58'):logger['info']('[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x3860('0xd')](_0x3860('0x63'),_0xe93a04[_0x3860('0x39')]),'trigger:browser:url',{'uri':util[_0x3860('0xd')]('%s/agent/tickets/%s',_0x5a9987[_0x3860('0x15')],_0x151492['id'])});break;default:logger[_0x3860('0x5a')]('[OUTBOUND]',_0x3860('0x65'));}}})[_0x3860('0x5b')](function(_0xfe45d8){logger[_0x3860('0x5a')]('[OUTBOUND]',JSON[_0x3860('0x1a')](_0xfe45d8));});};exports[_0x3860('0x66')]=function(_0x17f248,_0x508208,_0x552fdc,_0x26e54b,_0x2ba958,_0xe67023){var _0x1ca0e7,_0x28a8b4;_0xe67023[_0x3860('0x15')]=intUtil['stripTrailingSlash'](_0xe67023[_0x3860('0x15')]);_0xe67023[_0x3860('0x49')]=intUtil['stripTrailingSlash'](_0xe67023[_0x3860('0x49')]);if(_0x2ba958&&_0x2ba958[_0x3860('0x67')]){logger[_0x3860('0xc')](_0x3860('0x68'),_0x3860('0x4b'));_0x508208[_0x3860('0x4c')]=util['format'](_0x3860('0x4d'),_0xe67023[_0x3860('0x49')],_0x508208[_0x3860('0x4e')],md5(_0x508208[_0x3860('0x4e')]));}else{_0x508208[_0x3860('0x4c')]='';}headers[_0x3860('0x4f')]=getAuth(_0xe67023);return getUser(_0xe67023)['then'](function(_0x1ae31b){_0x1ca0e7=_0x1ae31b;logger[_0x3860('0xc')](_0x3860('0x60'),_0x1ca0e7['id']);return getEndUser(_0xe67023,_0x508208['calleridname'],_0x508208['calleridnum']);})[_0x3860('0xf')](function(_0x2d425d){_0x28a8b4=_0x2d425d;logger[_0x3860('0xc')](_0x3860('0x53'),_0x28a8b4['id']);return getTicket(_0xe67023,_0x1ca0e7,_0x28a8b4,_0x552fdc,_0x508208);})[_0x3860('0xf')](function(_0x501ed0){if(_0x501ed0){logger['info'](_0x3860('0x54'));logger[_0x3860('0xc')]('The\x20Ticket\x20ID\x20is:',_0x501ed0['id']);}})['catch'](function(_0x2fd2ec){logger[_0x3860('0x5a')]('[ABANDONED]',JSON[_0x3860('0x1a')](_0x2fd2ec));});}; \ 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 14d4554..5058f81 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 _0x0e2d=['isdisabled','info','userId','systemuserid',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','length','toLowerCase','outbound','destcalleridnum','calleridnum','contacts','headers','substring','lastIndexOf','enduserId','telephone1','contactid',']\x20Enduser\x20created!',']\x20Enduser\x20Created!','forEach','string','nameField','customField','idField','indexOf','ticketType','incidents','Descriptions','/systemusers(','Fields','phonecall','phonecalls','getString','Subjects','/contacts(','callDirection','queue','odata-entityid','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','trigger:browser:url','stripTrailingSlash','serverUrl','abandoned','tenantId','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','[OUTBOUND]',']\x20The\x20User\x20email\x20is:',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Error\x20running\x20Dynamics365\x20integration','inspect','lodash','bluebird','request-promise','util','./util','ioredis','dynamics365','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','POST','clientId','remoteUri','username','clientSecret','then','access_token','catch','error','toUpperCase','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','isNil','validateEmail','email','internalemailaddress'];(function(_0x519756,_0x288785){var _0x37047e=function(_0x3d64a7){while(--_0x3d64a7){_0x519756['push'](_0x519756['shift']());}};_0x37047e(++_0x288785);}(_0x0e2d,0x9a));var _0xd0e2=function(_0x2fe6b0,_0x18aa5b){_0x2fe6b0=_0x2fe6b0-0x0;var _0x1ad640=_0x0e2d[_0x2fe6b0];return _0x1ad640;};'use strict';var _=require(_0xd0e2('0x0'));var BPromise=require(_0xd0e2('0x1'));var rp=require(_0xd0e2('0x2'));var util=require(_0xd0e2('0x3'));var intUtil=require(_0xd0e2('0x4'));var md5=require('md5');var Redis=require(_0xd0e2('0x5'));var logger=require('../../../../config/logger')(_0xd0e2('0x6'));var config=require(_0xd0e2('0x7'));config[_0xd0e2('0x8')]=_[_0xd0e2('0x9')](config[_0xd0e2('0x8')],{'host':_0xd0e2('0xa'),'port':0x18eb});var io=require(_0xd0e2('0xb'))(new Redis(config[_0xd0e2('0x8')]));function getAuthToken(_0x2e771e,_0x4adea8,_0x148714){var _0x293396={'method':_0xd0e2('0xc'),'uri':_0x4adea8,'form':{'client_id':_0x2e771e[_0xd0e2('0xd')],'resource':_0x2e771e[_0xd0e2('0xe')],'username':_0x2e771e[_0xd0e2('0xf')],'password':_0x2e771e['password'],'grant_type':'password','client_secret':_0x2e771e[_0xd0e2('0x10')]},'json':!![]};return rp(_0x293396)[_0xd0e2('0x11')](function(_0x243a4f){return _0x243a4f[_0xd0e2('0x12')];})[_0xd0e2('0x13')](function(_0x957800){logger[_0xd0e2('0x14')]('['+[_0x148714[_0xd0e2('0x15')]()]+']\x20Wrong\x20credentials!');return _0x957800[_0xd0e2('0x16')];});}function getUser(_0x57f423,_0x13e03,_0x5843f0,_0x117d42,_0x26e66e,_0x4ae584){return new BPromise(function(_0xd973a,_0x9b58ba){return getAuthToken(_0x13e03,_0x117d42,_0x4ae584)[_0xd0e2('0x11')](function(_0x3071e3){var _0xc9ef78={'method':_0xd0e2('0x17'),'uri':_0x26e66e+_0xd0e2('0x18'),'headers':{'Authorization':_0xd0e2('0x19')+_0x3071e3,'OData-Version':_0xd0e2('0x1a')},'json':!![]};return rp(_0xc9ef78);})[_0xd0e2('0x11')](function(_0x4bec64){var _0x44bc11=_0x4bec64[_0xd0e2('0x1b')];var _0x28d284=![];var _0x387d2c=null;if(!_[_0xd0e2('0x1c')](_0x5843f0)){if(intUtil[_0xd0e2('0x1d')](_0x5843f0[_0xd0e2('0x1e')])){_0x57f423['userEmail']=_0x5843f0['email'];for(_0x387d2c=0x0;_0x387d2c<_0x44bc11['length'];_0x387d2c++){if(_0x44bc11[_0x387d2c][_0xd0e2('0x1f')]===_0x5843f0[_0xd0e2('0x1e')]&&!_0x44bc11[_0x387d2c][_0xd0e2('0x20')]){_0x28d284=!![];logger[_0xd0e2('0x21')]('['+[_0x4ae584[_0xd0e2('0x15')]()]+']\x20Agent\x20found\x20'+_0x44bc11[_0x387d2c]['systemuserid']+'!');_0x57f423[_0xd0e2('0x22')]=_0x44bc11[_0x387d2c][_0xd0e2('0x23')];}}}}if(!_0x28d284){logger[_0xd0e2('0x21')]('['+[_0x4ae584[_0xd0e2('0x15')]()]+_0xd0e2('0x24'));_0x57f423['userEmail']=_0x13e03[_0xd0e2('0xf')];for(_0x387d2c=0x0;_0x387d2c<_0x44bc11[_0xd0e2('0x25')];_0x387d2c++){if(_0x44bc11[_0x387d2c]['internalemailaddress']===_0x13e03['username']){_0x57f423['userId']=_0x44bc11[_0x387d2c][_0xd0e2('0x23')];}}}_0xd973a(_0x57f423);})[_0xd0e2('0x13')](function(_0x9ea23e){_0x9b58ba(_0x9ea23e['message']);});});}function createEndUser(_0x70e6ae,_0x388dca,_0x58512b,_0x3497c3,_0x4e4289,_0x1a5ecc){return new BPromise(function(_0x589234,_0x3a4abd){return getAuthToken(_0x388dca,_0x58512b,_0x1a5ecc)[_0xd0e2('0x11')](function(_0x82219b){var _0x2ed32f=_0x1a5ecc[_0xd0e2('0x26')]()===_0xd0e2('0x27')?_0x4e4289[_0xd0e2('0x28')]:_0x4e4289[_0xd0e2('0x29')];var _0x1f8a85={'method':'POST','uri':_0x3497c3+_0xd0e2('0x2a'),'body':{'telephone1':_0x2ed32f,'fullname':_0x2ed32f,'firstname':_0x2ed32f,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':'/systemusers('+_0x70e6ae[_0xd0e2('0x22')]+')'},'headers':{'Authorization':_0xd0e2('0x19')+_0x82219b,'OData-Version':_0xd0e2('0x1a')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x1f8a85);})[_0xd0e2('0x11')](function(_0x538218){var _0x1140b2=_0x538218[_0xd0e2('0x2b')]['odata-entityid'];var _0x105536=_0x1140b2[_0xd0e2('0x2c')](_0x1140b2['lastIndexOf']('(')+0x1,_0x1140b2[_0xd0e2('0x2d')](')'));_0x70e6ae[_0xd0e2('0x2e')]=_0x105536;_0x589234(_0x70e6ae);})['catch'](function(_0x21c29c){_0x3a4abd(_0x21c29c[_0xd0e2('0x16')]);});});}function getEndUser(_0x1376d4,_0x18ebc8,_0x10d8bf,_0x468433,_0x316ff2,_0x4c1260){return new BPromise(function(_0x2499f2,_0x2999ac){return getAuthToken(_0x18ebc8,_0x10d8bf,_0x4c1260)[_0xd0e2('0x11')](function(_0x57c5b1){var _0x2e73da={'method':'GET','uri':_0x468433+'contacts?$select=telephone1','headers':{'Authorization':_0xd0e2('0x19')+_0x57c5b1,'If-None-Match':null,'OData-Version':_0xd0e2('0x1a')},'json':!![]};return rp(_0x2e73da);})[_0xd0e2('0x11')](function(_0x2171b1){var _0x56073f=null;if(_0x2171b1){var _0x2e555e=_0x2171b1[_0xd0e2('0x1b')];var _0x4b0995=![];for(_0x56073f=0x0;_0x56073f<_0x2e555e[_0xd0e2('0x25')];_0x56073f++){var _0x26ecf6=_0x4c1260[_0xd0e2('0x26')]()===_0xd0e2('0x27')?_0x316ff2[_0xd0e2('0x28')]:_0x316ff2[_0xd0e2('0x29')];if(_0x2e555e[_0x56073f][_0xd0e2('0x2f')]===_0x26ecf6){_0x4b0995=!![];_0x1376d4[_0xd0e2('0x2e')]=_0x2e555e[_0x56073f][_0xd0e2('0x30')];}}if(_0x4b0995){_0x2499f2(_0x1376d4);}else{return createEndUser(_0x1376d4,_0x18ebc8,_0x10d8bf,_0x468433,_0x316ff2,_0x4c1260)[_0xd0e2('0x11')](function(_0x1047bb){logger[_0xd0e2('0x21')]('['+[_0x4c1260[_0xd0e2('0x15')]()]+_0xd0e2('0x31'),_0x1047bb['enduserId']);_0x2499f2(_0x1047bb);});}}else{return createEndUser(_0x1376d4,_0x18ebc8,_0x10d8bf,_0x468433,_0x316ff2,_0x4c1260)[_0xd0e2('0x11')](function(_0x23d48a){logger[_0xd0e2('0x21')]('['+[_0x4c1260[_0xd0e2('0x15')]()]+_0xd0e2('0x32'),_0x23d48a['enduserId']);_0x2499f2(_0x23d48a);});}});});}function getCustomFields(_0x1960c2,_0x3a8b0f,_0x12d297){var _0x5ef554={};if(_0x1960c2['length']>0x0){_[_0xd0e2('0x33')](_0x1960c2,function(_0x1017ab){if(_0x1017ab['type']===_0xd0e2('0x34')&&_0x1017ab[_0xd0e2('0x35')]&&!_0x1017ab[_0xd0e2('0x36')]){var _0xe8d1d3=_0x1017ab[_0xd0e2('0x37')][_0xd0e2('0x26')]();var _0x2482ad=_0xe8d1d3[_0xd0e2('0x2c')](0x0,_0xe8d1d3[_0xd0e2('0x38')]('_'));var _0x5ca292=_0xe8d1d3[_0xd0e2('0x2c')](_0xe8d1d3['indexOf']('_')+0x1);if(_0x2482ad===_0x12d297){_0x5ef554[_0x5ca292]=_0x1017ab['content'];}}});}return _0x5ef554;}function getTicket(_0x78dafc,_0x24d3a6,_0x194e5b,_0x232d2b,_0x350913,_0x153488,_0x3d4ee0){return new BPromise(function(_0x25bdcb,_0x2ee7b9){var _0x558709;return getAuthToken(_0x24d3a6,_0x194e5b,_0x3d4ee0)[_0xd0e2('0x11')](function(_0x4e17ef){if(_0x153488[_0xd0e2('0x39')]==='incident'){_0x558709={'method':_0xd0e2('0xc'),'uri':_0x232d2b+_0xd0e2('0x3a'),'body':Object['assign']({},{'title':intUtil['getString'](_0x153488['Subjects'],_0x350913,'\x20'),'description':intUtil['getString'](_0x153488[_0xd0e2('0x3b')],_0x350913,'\x0a'),'customerid_contact@odata.bind':'/contacts('+_0x78dafc[_0xd0e2('0x2e')]+')','ownerid@odata.bind':_0xd0e2('0x3c')+_0x78dafc[_0xd0e2('0x22')]+')','caseorigincode':'1'},getCustomFields(_0x153488[_0xd0e2('0x3d')],_0x350913,_0x153488[_0xd0e2('0x39')])),'headers':{'Authorization':_0xd0e2('0x19')+_0x4e17ef,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}if(_0x153488[_0xd0e2('0x39')]===_0xd0e2('0x3e')){_0x558709={'method':_0xd0e2('0xc'),'uri':_0x232d2b+_0xd0e2('0x3f'),'body':Object['assign']({},{'subject':intUtil[_0xd0e2('0x40')](_0x153488[_0xd0e2('0x41')],_0x350913,'\x20'),'phonenumber':String(_0x350913[_0xd0e2('0x29')]),'description':intUtil['getString'](_0x153488[_0xd0e2('0x3b')],_0x350913,'\x0a'),'regardingobjectid_contact@odata.bind':_0xd0e2('0x42')+_0x78dafc['enduserId']+')','ownerid@odata.bind':_0xd0e2('0x3c')+_0x78dafc['userId']+')','directioncode':_0x78dafc[_0xd0e2('0x43')]===_0xd0e2('0x44')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':'/systemusers('+_0x78dafc[_0xd0e2('0x22')]+')','participationtypemask':_0x78dafc[_0xd0e2('0x43')]==='queue'?0x2:0x1},{'partyid_contact@odata.bind':_0xd0e2('0x42')+_0x78dafc[_0xd0e2('0x2e')]+')','participationtypemask':_0x78dafc[_0xd0e2('0x43')]===_0xd0e2('0x44')?0x1:0x2}]},getCustomFields(_0x153488[_0xd0e2('0x3d')],_0x350913,_0x153488[_0xd0e2('0x39')])),'headers':{'Authorization':_0xd0e2('0x19')+_0x4e17ef,'OData-Version':_0xd0e2('0x1a')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x558709);})['then'](function(_0x220924){var _0x3ff315=_0x220924[_0xd0e2('0x2b')][_0xd0e2('0x45')];var _0x116042=_0x3ff315[_0xd0e2('0x2c')](_0x3ff315[_0xd0e2('0x2d')]('(')+0x1,_0x3ff315[_0xd0e2('0x2d')](')'));_0x78dafc[_0xd0e2('0x46')]=_0x116042;_0x25bdcb(_0x78dafc);})[_0xd0e2('0x13')](function(_0x523187){_0x2ee7b9(_0x523187[_0xd0e2('0x16')]);});});}function emit(_0x50edb3,_0x11c984,_0x4261cb,_0x1fb98a){var _0x35112a={'uri':util[_0xd0e2('0x47')](_0xd0e2('0x48'),_0x50edb3,_0x4261cb,_0x1fb98a)};io['to'](util[_0xd0e2('0x47')](_0xd0e2('0x49'),_0x11c984))['emit'](_0xd0e2('0x4a'),_0x35112a);}exports['cs']=function(_0x5e9b9c,_0x227a10,_0x43306d,_0x241974,_0x43e9b5,_0x5d882c,_0x497f3d,_0x5cd037){var _0x53c6b2={};_0x5d882c['remoteUri']=intUtil[_0xd0e2('0x4b')](_0x5d882c['remoteUri']);_0x5d882c[_0xd0e2('0x4c')]=intUtil[_0xd0e2('0x4b')](_0x5d882c[_0xd0e2('0x4c')]);_0x53c6b2[_0xd0e2('0x43')]=_0x5cd037===_0xd0e2('0x44')||_0x5cd037===_0xd0e2('0x4d')?_0xd0e2('0x44'):_0xd0e2('0x27');var _0xf703b=util[_0xd0e2('0x47')]('%s/api/data/v9.0/',_0x5d882c[_0xd0e2('0xe')]);var _0xded09=util[_0xd0e2('0x47')]('https://login.microsoftonline.com/%s/oauth2/token',_0x5d882c[_0xd0e2('0x4e')]);var _0x4a04e9=util[_0xd0e2('0x47')](_0xd0e2('0x4f'),_0x5d882c[_0xd0e2('0x4c')],_0x227a10['uniqueid'],md5(_0x227a10[_0xd0e2('0x50')]));if(_0x43e9b5&&_0x43e9b5[_0xd0e2('0x51')]){logger[_0xd0e2('0x21')](_0xd0e2('0x52'),_0xd0e2('0x53'));_0x227a10[_0xd0e2('0x54')]=_0x4a04e9;}else if(_0x497f3d&&_0x497f3d[_0xd0e2('0x55')]&&_0x497f3d['recordingFormat']!=='none'){logger[_0xd0e2('0x21')](_0xd0e2('0x56'),_0xd0e2('0x53'));_0x227a10[_0xd0e2('0x54')]=_0x4a04e9;}else{_0x227a10[_0xd0e2('0x54')]='';}return getUser(_0x53c6b2,_0x5d882c,_0x241974,_0xded09,_0xf703b,_0x5cd037)[_0xd0e2('0x11')](function(_0x48ebe2){logger['info']('['+_0x5cd037[_0xd0e2('0x15')]()+']\x20The\x20User\x20ID\x20is:',_0x48ebe2['userId']);logger[_0xd0e2('0x21')]('['+_0x5cd037['toUpperCase']()+_0xd0e2('0x57'),_0x48ebe2['userEmail']);return getEndUser(_0x48ebe2,_0x5d882c,_0xded09,_0xf703b,_0x227a10,_0x5cd037);})[_0xd0e2('0x11')](function(_0xf1734a){logger[_0xd0e2('0x21')]('['+_0x5cd037[_0xd0e2('0x15')]()+_0xd0e2('0x58'),_0xf1734a[_0xd0e2('0x2e')]);logger['info']('['+_0x5cd037[_0xd0e2('0x15')]()+_0xd0e2('0x59'),_0x227a10[_0xd0e2('0x29')]);return getTicket(_0xf1734a,_0x5d882c,_0xded09,_0xf703b,_0x227a10,_0x43306d,_0x5cd037);})[_0xd0e2('0x11')](function(_0xccc1c7){logger['info'](util[_0xd0e2('0x47')]('['+_0x5cd037[_0xd0e2('0x15')]()+_0xd0e2('0x5a'),_0x43306d[_0xd0e2('0x39')],_0xccc1c7[_0xd0e2('0x46')]));logger[_0xd0e2('0x21')](util['format']('['+_0x5cd037[_0xd0e2('0x15')]()+']\x20Call\x20direction:\x20%s',_0x5cd037));if(_0x5cd037!=='abandoned'){logger[_0xd0e2('0x21')]('['+_0x5cd037['toUpperCase']()+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x5d882c[_0xd0e2('0xe')],_0x241974['name'],_0x43306d[_0xd0e2('0x39')],_0xccc1c7[_0xd0e2('0x46')]);}})[_0xd0e2('0x13')](function(_0x36915d){logger['error']('['+_0x5cd037[_0xd0e2('0x15')]()+_0xd0e2('0x5b'),util[_0xd0e2('0x5c')](_0x36915d,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xd1df=['contacts?$select=telephone1','toLowerCase','destcalleridnum','forEach','type','string','nameField','customField','idField','indexOf','content','ticketType','getString','Descriptions','/contacts(','Fields','assign','Subjects','callDirection','queue','headers','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','stripTrailingSlash','serverUrl','abandoned','https://login.microsoftonline.com/%s/oauth2/token','tenantId','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','[OUTBOUND]','recordingURL','toUpperCase',']\x20The\x20User\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s','ticketId',']\x20Call\x20direction:\x20%s','error','inspect','lodash','bluebird','request-promise','./util','md5','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','defaults','redis','socket.io-emitter','POST','clientId','remoteUri','password','clientSecret','then','access_token','catch','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!','username','outbound','calleridnum','/systemusers(','odata-entityid','substring','lastIndexOf','enduserId','GET'];(function(_0x381a28,_0x4eb359){var _0x5e572d=function(_0x46b8bf){while(--_0x46b8bf){_0x381a28['push'](_0x381a28['shift']());}};_0x5e572d(++_0x4eb359);}(_0xd1df,0x85));var _0xfd1d=function(_0x5724f0,_0x4cf002){_0x5724f0=_0x5724f0-0x0;var _0x4c56cc=_0xd1df[_0x5724f0];return _0x4c56cc;};'use strict';var _=require(_0xfd1d('0x0'));var BPromise=require(_0xfd1d('0x1'));var rp=require(_0xfd1d('0x2'));var util=require('util');var intUtil=require(_0xfd1d('0x3'));var md5=require(_0xfd1d('0x4'));var Redis=require(_0xfd1d('0x5'));var logger=require(_0xfd1d('0x6'))(_0xfd1d('0x7'));var config=require(_0xfd1d('0x8'));config['redis']=_[_0xfd1d('0x9')](config[_0xfd1d('0xa')],{'host':'localhost','port':0x18eb});var io=require(_0xfd1d('0xb'))(new Redis(config['redis']));function getAuthToken(_0x17a781,_0x152b9b,_0x4a8423){var _0x1942ec={'method':_0xfd1d('0xc'),'uri':_0x152b9b,'form':{'client_id':_0x17a781[_0xfd1d('0xd')],'resource':_0x17a781[_0xfd1d('0xe')],'username':_0x17a781['username'],'password':_0x17a781['password'],'grant_type':_0xfd1d('0xf'),'client_secret':_0x17a781[_0xfd1d('0x10')]},'json':!![]};return rp(_0x1942ec)[_0xfd1d('0x11')](function(_0x258264){return _0x258264[_0xfd1d('0x12')];})[_0xfd1d('0x13')](function(_0x1d2d19){logger['error']('['+[_0x4a8423['toUpperCase']()]+']\x20Wrong\x20credentials!');return _0x1d2d19[_0xfd1d('0x14')];});}function getUser(_0x877788,_0x141ac8,_0x59f82c,_0x7cb528,_0x180f1f,_0x36a958){return new BPromise(function(_0x453fcb,_0x1e7f55){return getAuthToken(_0x141ac8,_0x7cb528,_0x36a958)[_0xfd1d('0x11')](function(_0x5c92ab){var _0x428681={'method':'GET','uri':_0x180f1f+_0xfd1d('0x15'),'headers':{'Authorization':_0xfd1d('0x16')+_0x5c92ab,'OData-Version':_0xfd1d('0x17')},'json':!![]};return rp(_0x428681);})[_0xfd1d('0x11')](function(_0x2cf883){var _0x276066=_0x2cf883[_0xfd1d('0x18')];var _0x42daaf=![];var _0x19b24b=null;if(!_['isNil'](_0x59f82c)){if(intUtil[_0xfd1d('0x19')](_0x59f82c[_0xfd1d('0x1a')])){_0x877788[_0xfd1d('0x1b')]=_0x59f82c['email'];for(_0x19b24b=0x0;_0x19b24b<_0x276066[_0xfd1d('0x1c')];_0x19b24b++){if(_0x276066[_0x19b24b][_0xfd1d('0x1d')]===_0x59f82c[_0xfd1d('0x1a')]&&!_0x276066[_0x19b24b][_0xfd1d('0x1e')]){_0x42daaf=!![];logger[_0xfd1d('0x1f')]('['+[_0x36a958['toUpperCase']()]+_0xfd1d('0x20')+_0x276066[_0x19b24b][_0xfd1d('0x21')]+'!');_0x877788[_0xfd1d('0x22')]=_0x276066[_0x19b24b][_0xfd1d('0x21')];}}}}if(!_0x42daaf){logger[_0xfd1d('0x1f')]('['+[_0x36a958['toUpperCase']()]+_0xfd1d('0x23'));_0x877788[_0xfd1d('0x1b')]=_0x141ac8[_0xfd1d('0x24')];for(_0x19b24b=0x0;_0x19b24b<_0x276066[_0xfd1d('0x1c')];_0x19b24b++){if(_0x276066[_0x19b24b][_0xfd1d('0x1d')]===_0x141ac8[_0xfd1d('0x24')]){_0x877788['userId']=_0x276066[_0x19b24b]['systemuserid'];}}}_0x453fcb(_0x877788);})[_0xfd1d('0x13')](function(_0x342f35){_0x1e7f55(_0x342f35[_0xfd1d('0x14')]);});});}function createEndUser(_0x1050df,_0x410baf,_0x9a34b6,_0x58dd76,_0xd453b,_0x4570f1){return new BPromise(function(_0x2b0704,_0x52f5fa){return getAuthToken(_0x410baf,_0x9a34b6,_0x4570f1)[_0xfd1d('0x11')](function(_0x26e63f){var _0x3c5c55=_0x4570f1['toLowerCase']()===_0xfd1d('0x25')?_0xd453b['destcalleridnum']:_0xd453b[_0xfd1d('0x26')];var _0x5b1a47={'method':_0xfd1d('0xc'),'uri':_0x58dd76+'contacts','body':{'telephone1':_0x3c5c55,'fullname':_0x3c5c55,'firstname':_0x3c5c55,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0xfd1d('0x27')+_0x1050df[_0xfd1d('0x22')]+')'},'headers':{'Authorization':_0xfd1d('0x16')+_0x26e63f,'OData-Version':_0xfd1d('0x17')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x5b1a47);})[_0xfd1d('0x11')](function(_0x29fb34){var _0x56d467=_0x29fb34['headers'][_0xfd1d('0x28')];var _0x63bd21=_0x56d467[_0xfd1d('0x29')](_0x56d467[_0xfd1d('0x2a')]('(')+0x1,_0x56d467[_0xfd1d('0x2a')](')'));_0x1050df[_0xfd1d('0x2b')]=_0x63bd21;_0x2b0704(_0x1050df);})[_0xfd1d('0x13')](function(_0x8ec271){_0x52f5fa(_0x8ec271[_0xfd1d('0x14')]);});});}function getEndUser(_0x2f54b3,_0x423130,_0x31ddbf,_0x456892,_0x2e7fb6,_0x57af96){return new BPromise(function(_0x9be8d4,_0x4e4ec3){return getAuthToken(_0x423130,_0x31ddbf,_0x57af96)['then'](function(_0xb4cd66){var _0x37f39f={'method':_0xfd1d('0x2c'),'uri':_0x456892+_0xfd1d('0x2d'),'headers':{'Authorization':_0xfd1d('0x16')+_0xb4cd66,'If-None-Match':null,'OData-Version':_0xfd1d('0x17')},'json':!![]};return rp(_0x37f39f);})[_0xfd1d('0x11')](function(_0x528e18){var _0x39b3db=null;if(_0x528e18){var _0x5dfe1c=_0x528e18[_0xfd1d('0x18')];var _0x88ed07=![];for(_0x39b3db=0x0;_0x39b3db<_0x5dfe1c[_0xfd1d('0x1c')];_0x39b3db++){var _0x20f86f=_0x57af96[_0xfd1d('0x2e')]()===_0xfd1d('0x25')?_0x2e7fb6[_0xfd1d('0x2f')]:_0x2e7fb6[_0xfd1d('0x26')];if(_0x5dfe1c[_0x39b3db]['telephone1']===_0x20f86f){_0x88ed07=!![];_0x2f54b3[_0xfd1d('0x2b')]=_0x5dfe1c[_0x39b3db]['contactid'];}}if(_0x88ed07){_0x9be8d4(_0x2f54b3);}else{return createEndUser(_0x2f54b3,_0x423130,_0x31ddbf,_0x456892,_0x2e7fb6,_0x57af96)[_0xfd1d('0x11')](function(_0x23a665){logger['info']('['+[_0x57af96['toUpperCase']()]+']\x20Enduser\x20created!',_0x23a665[_0xfd1d('0x2b')]);_0x9be8d4(_0x23a665);});}}else{return createEndUser(_0x2f54b3,_0x423130,_0x31ddbf,_0x456892,_0x2e7fb6,_0x57af96)[_0xfd1d('0x11')](function(_0x390668){logger[_0xfd1d('0x1f')]('['+[_0x57af96['toUpperCase']()]+']\x20Enduser\x20Created!',_0x390668['enduserId']);_0x9be8d4(_0x390668);});}});});}function getCustomFields(_0xd6880a,_0x238de5,_0x92da0b){var _0x300770={};if(_0xd6880a[_0xfd1d('0x1c')]>0x0){_[_0xfd1d('0x30')](_0xd6880a,function(_0x2bafcd){if(_0x2bafcd[_0xfd1d('0x31')]===_0xfd1d('0x32')&&_0x2bafcd[_0xfd1d('0x33')]&&!_0x2bafcd[_0xfd1d('0x34')]){var _0x3a63d7=_0x2bafcd[_0xfd1d('0x35')][_0xfd1d('0x2e')]();var _0x26885b=_0x3a63d7[_0xfd1d('0x29')](0x0,_0x3a63d7['indexOf']('_'));var _0x539988=_0x3a63d7['substring'](_0x3a63d7[_0xfd1d('0x36')]('_')+0x1);if(_0x26885b===_0x92da0b){_0x300770[_0x539988]=_0x2bafcd[_0xfd1d('0x37')];}}});}return _0x300770;}function getTicket(_0x537224,_0x486403,_0x1012d6,_0x1499c8,_0x845afa,_0x1e9a71,_0x1a35a4){return new BPromise(function(_0x1a3c0e,_0x36bd20){var _0x375c2b;return getAuthToken(_0x486403,_0x1012d6,_0x1a35a4)[_0xfd1d('0x11')](function(_0x3742d1){if(_0x1e9a71[_0xfd1d('0x38')]==='incident'){_0x375c2b={'method':_0xfd1d('0xc'),'uri':_0x1499c8+'incidents','body':Object['assign']({},{'title':intUtil['getString'](_0x1e9a71['Subjects'],_0x845afa,'\x20'),'description':intUtil[_0xfd1d('0x39')](_0x1e9a71[_0xfd1d('0x3a')],_0x845afa,'\x0a'),'customerid_contact@odata.bind':_0xfd1d('0x3b')+_0x537224[_0xfd1d('0x2b')]+')','ownerid@odata.bind':_0xfd1d('0x27')+_0x537224[_0xfd1d('0x22')]+')','caseorigincode':'1'},getCustomFields(_0x1e9a71[_0xfd1d('0x3c')],_0x845afa,_0x1e9a71[_0xfd1d('0x38')])),'headers':{'Authorization':'Bearer\x20'+_0x3742d1,'OData-Version':_0xfd1d('0x17')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x1e9a71['ticketType']==='phonecall'){_0x375c2b={'method':_0xfd1d('0xc'),'uri':_0x1499c8+'phonecalls','body':Object[_0xfd1d('0x3d')]({},{'subject':intUtil['getString'](_0x1e9a71[_0xfd1d('0x3e')],_0x845afa,'\x20'),'phonenumber':String(_0x845afa[_0xfd1d('0x26')]),'description':intUtil[_0xfd1d('0x39')](_0x1e9a71['Descriptions'],_0x845afa,'\x0a'),'regardingobjectid_contact@odata.bind':_0xfd1d('0x3b')+_0x537224[_0xfd1d('0x2b')]+')','ownerid@odata.bind':_0xfd1d('0x27')+_0x537224[_0xfd1d('0x22')]+')','directioncode':_0x537224[_0xfd1d('0x3f')]===_0xfd1d('0x40')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0xfd1d('0x27')+_0x537224['userId']+')','participationtypemask':_0x537224[_0xfd1d('0x3f')]===_0xfd1d('0x40')?0x2:0x1},{'partyid_contact@odata.bind':_0xfd1d('0x3b')+_0x537224['enduserId']+')','participationtypemask':_0x537224[_0xfd1d('0x3f')]==='queue'?0x1:0x2}]},getCustomFields(_0x1e9a71[_0xfd1d('0x3c')],_0x845afa,_0x1e9a71[_0xfd1d('0x38')])),'headers':{'Authorization':_0xfd1d('0x16')+_0x3742d1,'OData-Version':_0xfd1d('0x17')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x375c2b);})[_0xfd1d('0x11')](function(_0x44748e){var _0x2f1850=_0x44748e[_0xfd1d('0x41')][_0xfd1d('0x28')];var _0x49e4c3=_0x2f1850[_0xfd1d('0x29')](_0x2f1850[_0xfd1d('0x2a')]('(')+0x1,_0x2f1850['lastIndexOf'](')'));_0x537224['ticketId']=_0x49e4c3;_0x1a3c0e(_0x537224);})[_0xfd1d('0x13')](function(_0x20fe9d){_0x36bd20(_0x20fe9d[_0xfd1d('0x14')]);});});}function emit(_0x513a8d,_0x151e79,_0x195b00,_0x4205a7){var _0xa85f12={'uri':util[_0xfd1d('0x42')](_0xfd1d('0x43'),_0x513a8d,_0x195b00,_0x4205a7)};io['to'](util[_0xfd1d('0x42')]('user:%s',_0x151e79))['emit']('trigger:browser:url',_0xa85f12);}exports['cs']=function(_0x1bdb66,_0x35d44a,_0x12dddb,_0x1ea376,_0xe91708,_0x531feb,_0x6dfb87,_0x409a81){var _0x1a457b={};_0x531feb[_0xfd1d('0xe')]=intUtil[_0xfd1d('0x44')](_0x531feb[_0xfd1d('0xe')]);_0x531feb[_0xfd1d('0x45')]=intUtil[_0xfd1d('0x44')](_0x531feb[_0xfd1d('0x45')]);_0x1a457b[_0xfd1d('0x3f')]=_0x409a81==='queue'||_0x409a81===_0xfd1d('0x46')?_0xfd1d('0x40'):'outbound';var _0x388056=util['format']('%s/api/data/v9.0/',_0x531feb[_0xfd1d('0xe')]);var _0x1c182c=util['format'](_0xfd1d('0x47'),_0x531feb[_0xfd1d('0x48')]);var _0x2ca65a=util[_0xfd1d('0x42')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x531feb[_0xfd1d('0x45')],_0x35d44a[_0xfd1d('0x49')],md5(_0x35d44a['uniqueid']));if(_0xe91708&&_0xe91708[_0xfd1d('0x4a')]){logger[_0xfd1d('0x1f')](_0xfd1d('0x4b'),_0xfd1d('0x4c'));_0x35d44a['recordingURL']=_0x2ca65a;}else if(_0x6dfb87&&_0x6dfb87[_0xfd1d('0x4d')]&&_0x6dfb87[_0xfd1d('0x4d')]!==_0xfd1d('0x4e')){logger[_0xfd1d('0x1f')](_0xfd1d('0x4f'),_0xfd1d('0x4c'));_0x35d44a[_0xfd1d('0x50')]=_0x2ca65a;}else{_0x35d44a['recordingURL']='';}return getUser(_0x1a457b,_0x531feb,_0x1ea376,_0x1c182c,_0x388056,_0x409a81)['then'](function(_0x145af5){logger['info']('['+_0x409a81[_0xfd1d('0x51')]()+_0xfd1d('0x52'),_0x145af5[_0xfd1d('0x22')]);logger[_0xfd1d('0x1f')]('['+_0x409a81[_0xfd1d('0x51')]()+']\x20The\x20User\x20email\x20is:',_0x145af5['userEmail']);return getEndUser(_0x145af5,_0x531feb,_0x1c182c,_0x388056,_0x35d44a,_0x409a81);})[_0xfd1d('0x11')](function(_0x440b02){logger[_0xfd1d('0x1f')]('['+_0x409a81['toUpperCase']()+']\x20The\x20Enduser\x20ID\x20is:',_0x440b02[_0xfd1d('0x2b')]);logger[_0xfd1d('0x1f')]('['+_0x409a81[_0xfd1d('0x51')]()+_0xfd1d('0x53'),_0x35d44a[_0xfd1d('0x26')]);return getTicket(_0x440b02,_0x531feb,_0x1c182c,_0x388056,_0x35d44a,_0x12dddb,_0x409a81);})[_0xfd1d('0x11')](function(_0x25d09e){logger[_0xfd1d('0x1f')](util[_0xfd1d('0x42')]('['+_0x409a81['toUpperCase']()+_0xfd1d('0x54'),_0x12dddb['ticketType'],_0x25d09e[_0xfd1d('0x55')]));logger[_0xfd1d('0x1f')](util['format']('['+_0x409a81[_0xfd1d('0x51')]()+_0xfd1d('0x56'),_0x409a81));if(_0x409a81!=='abandoned'){logger[_0xfd1d('0x1f')]('['+_0x409a81['toUpperCase']()+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x531feb[_0xfd1d('0xe')],_0x1ea376['name'],_0x12dddb[_0xfd1d('0x38')],_0x25d09e[_0xfd1d('0x55')]);}})[_0xfd1d('0x13')](function(_0x7730b9){logger[_0xfd1d('0x57')]('['+_0x409a81[_0xfd1d('0x51')]()+']\x20Error\x20running\x20Dynamics365\x20integration',util[_0xfd1d('0x58')](_0x7730b9,{'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 7e895b3..22c02cf 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 _0x70a4=['Caller\x20-\x20%s','calleridname','calleridnum','getString','Subjects','Descriptions','Tags','name','Fields','custom_fields','mapValues','value','%s/api/v2/tickets','POST','Ticket\x20created!','validateEmail','%s/api/v2/agents','remoteUri','then','length','find','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20created.','Basic\x20%s','apiKey','toString','[HTTP]','stringify','GET','map','forEach','type','string','nameField','customField','content','idField','push','variable','variableName','customVariable','Variable','toLowerCase','queue','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','catch','outbound','recordingFormat','none','Authorization','destcalleridnum','The\x20Enduser\x20ID\x20is:','[OUTBOUND]','error','abandoned','[ABANDONED]','lodash','request-promise','util','ioredis','../../../../config/environment','../../../../config/logger','freshdesk','defaults','redis','localhost','socket.io-emitter','application/json','info','merge','format'];(function(_0x229285,_0x269d79){var _0x15f03a=function(_0x4fd78a){while(--_0x4fd78a){_0x229285['push'](_0x229285['shift']());}};_0x15f03a(++_0x269d79);}(_0x70a4,0x159));var _0x470a=function(_0x3bbe4f,_0xc01772){_0x3bbe4f=_0x3bbe4f-0x0;var _0xebea9f=_0x70a4[_0x3bbe4f];return _0xebea9f;};'use strict';var _=require(_0x470a('0x0'));var rp=require(_0x470a('0x1'));var md5=require('md5');var util=require(_0x470a('0x2'));var Redis=require(_0x470a('0x3'));var intUtil=require('./util');var config=require(_0x470a('0x4'));var logger=require(_0x470a('0x5'))(_0x470a('0x6'));config['redis']=_[_0x470a('0x7')](config[_0x470a('0x8')],{'host':_0x470a('0x9'),'port':0x18eb});var io=require(_0x470a('0xa'))(new Redis(config[_0x470a('0x8')]));var headers={'Content-Type':'application/json','Accept':_0x470a('0xb')};function emit(_0x457b1f,_0x1c018f,_0x18d9df){io['to'](_0x457b1f)['emit'](_0x1c018f,_0x18d9df);}function getTicket(_0x5e53bc,_0x3f59c7,_0x54019f,_0x2a6140,_0x53fb3c){logger[_0x470a('0xc')]('Creating\x20new\x20ticket...');var _0x5b2e2d=_[_0x470a('0xd')]({'responder_id':_0x3f59c7['id'],'requester_id':_0x54019f['id'],'name':util[_0x470a('0xe')](_0x470a('0xf'),_0x53fb3c[_0x470a('0x10')]),'phone':_0x53fb3c[_0x470a('0x11')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x470a('0x12')](_0x2a6140[_0x470a('0x13')],_0x53fb3c,'\x20'),'description':intUtil[_0x470a('0x12')](_0x2a6140[_0x470a('0x14')],_0x53fb3c,'
'),'tags':getTags(_0x2a6140[_0x470a('0x15')],_0x470a('0x16'))},getCustomFields(_0x2a6140[_0x470a('0x17')],_0x53fb3c));_0x5b2e2d[_0x470a('0x18')]=_[_0x470a('0x19')](_['keyBy'](_0x5b2e2d[_0x470a('0x18')],'id'),_0x470a('0x1a'));return request({'uri':util[_0x470a('0xe')](_0x470a('0x1b'),_0x5e53bc['remoteUri']),'method':_0x470a('0x1c'),'body':_0x5b2e2d})['then'](function(_0x27745f){logger['info'](_0x470a('0x1d'));return _0x27745f;});}function getUser(_0x50c1cd,_0x50bfaa){if(intUtil[_0x470a('0x1e')](_0x50bfaa)){return request({'uri':util['format'](_0x470a('0x1f'),_0x50c1cd[_0x470a('0x20')]),'qs':{'email':_0x50bfaa}})[_0x470a('0x21')](function(_0x40c8de){if(_0x40c8de[_0x470a('0x22')]){logger[_0x470a('0xc')]('Agent\x20found!');return _[_0x470a('0x23')](_0x40c8de,function(_0x28c22d){return _0x28c22d[_0x470a('0x24')][_0x470a('0x25')]===_0x50bfaa;});}else{logger[_0x470a('0xc')](_0x470a('0x26'));return request({'uri':util[_0x470a('0xe')]('%s/api/v2/agents/me',_0x50c1cd['remoteUri'])})['then'](function(_0x1a03e9){logger[_0x470a('0xc')](_0x470a('0x27'));return _0x1a03e9;});}});}else{logger[_0x470a('0xc')](_0x470a('0x28'));return request({'uri':util['format'](_0x470a('0x29'),_0x50c1cd[_0x470a('0x20')])})['then'](function(_0x1c23ca){logger[_0x470a('0xc')](_0x470a('0x27'));return _0x1c23ca;});}}function getEndUser(_0x5cdda8,_0x3f6ea5,_0x2f53b1){logger['info'](_0x470a('0x2a'),_0x2f53b1);return request({'uri':util[_0x470a('0xe')]('%s/api/v2/contacts',_0x5cdda8[_0x470a('0x20')]),'qs':{'phone':_0x2f53b1}})[_0x470a('0x21')](function(_0x49c3bb){if(_0x49c3bb[_0x470a('0x22')]){logger['info']('Enduser\x20found!');return _[_0x470a('0x23')](_0x49c3bb,{'phone':_0x2f53b1});}else{logger[_0x470a('0xc')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0x470a('0xe')](_0x470a('0x2b'),_0x5cdda8['remoteUri']),'method':_0x470a('0x1c'),'body':{'name':_0x3f6ea5,'phone':_0x2f53b1}})['then'](function(_0x252f46){logger['info'](_0x470a('0x2c'));return _0x252f46;});}});}function getAuth(_0x40c655){return util['format'](_0x470a('0x2d'),new Buffer(_0x40c655[_0x470a('0x2e')]+':X')[_0x470a('0x2f')]('base64'));}function request(_0x37bf1a){logger['debug'](_0x470a('0x30'),JSON[_0x470a('0x31')](_0x37bf1a));return rp(_[_0x470a('0x7')](_0x37bf1a,{'method':_0x470a('0x32'),'headers':headers,'json':!![]}));}function getTags(_0x1f0c62,_0x3fbd35){var _0x121954=[];if(_0x1f0c62&&_0x1f0c62[_0x470a('0x22')]>0x0){_0x121954=_[_0x470a('0x33')](_0x1f0c62,_0x3fbd35);}return _0x121954;}function getCustomFields(_0x4062a6,_0x550c9f){var _0x45e461=[];var _0x6bc16={'custom_fields':[]};if(_0x4062a6[_0x470a('0x22')]>0x0){_[_0x470a('0x34')](_0x4062a6,function(_0x5f771d){if(_0x5f771d[_0x470a('0x35')]===_0x470a('0x36')&&_0x5f771d[_0x470a('0x37')]&&!_0x5f771d[_0x470a('0x38')]){_0x6bc16[_0x5f771d['nameField']['toLowerCase']()]=_0x5f771d[_0x470a('0x39')][_0x470a('0x2f')]();}else if(_0x5f771d['type']===_0x470a('0x36')&&_0x5f771d[_0x470a('0x3a')]&&_0x5f771d[_0x470a('0x38')]){_0x6bc16[_0x470a('0x18')][_0x470a('0x3b')]({'id':_0x5f771d[_0x470a('0x3a')],'value':_0x5f771d[_0x470a('0x39')][_0x470a('0x2f')]()});}else if(_0x5f771d['type']===_0x470a('0x3c')&&_0x5f771d[_0x470a('0x3d')]&&_0x5f771d[_0x470a('0x3a')]&&_0x5f771d['customField']){_0x550c9f[_0x5f771d[_0x470a('0x3d')]]&&_0x6bc16[_0x470a('0x18')][_0x470a('0x3b')]({'id':_0x5f771d[_0x470a('0x3a')],'value':_0x550c9f[_0x5f771d['variableName']][_0x470a('0x2f')]()});}else if(_0x5f771d[_0x470a('0x35')]===_0x470a('0x3e')&&_0x5f771d[_0x470a('0x3f')]&&_0x5f771d[_0x470a('0x3f')][_0x470a('0x16')]&&_0x5f771d[_0x470a('0x3a')]&&_0x5f771d['customField']){_0x550c9f[_0x5f771d['Variable'][_0x470a('0x16')][_0x470a('0x40')]()]&&_0x6bc16['custom_fields']['push']({'id':_0x5f771d[_0x470a('0x3a')],'value':_0x550c9f[_0x5f771d[_0x470a('0x3f')][_0x470a('0x16')][_0x470a('0x40')]()][_0x470a('0x2f')]()});}});}return _0x6bc16;}exports[_0x470a('0x41')]=function(_0x1a7d0c,_0x555981,_0x59a63c,_0x5cedec,_0x50c639,_0x388f89){var _0x356fab,_0x4e4da2;_0x388f89['remoteUri']=intUtil[_0x470a('0x42')](_0x388f89['remoteUri']);_0x388f89[_0x470a('0x43')]=intUtil['stripTrailingSlash'](_0x388f89[_0x470a('0x43')]);if(_0x50c639&&_0x50c639[_0x470a('0x44')]){logger['info']('[QUEUE]',_0x470a('0x45'));_0x555981[_0x470a('0x46')]=util[_0x470a('0xe')](_0x470a('0x47'),_0x388f89[_0x470a('0x43')],_0x555981[_0x470a('0x48')],md5(_0x555981['uniqueid']));}else{_0x555981[_0x470a('0x46')]='';}headers['Authorization']=getAuth(_0x388f89);return getUser(_0x388f89,_0x5cedec[_0x470a('0x25')])['then'](function(_0x1af084){_0x356fab=_0x1af084;logger[_0x470a('0xc')](_0x470a('0x49'),_0x356fab['id']);return getEndUser(_0x388f89,_0x555981['calleridname'],_0x555981[_0x470a('0x11')]);})[_0x470a('0x21')](function(_0x230bd4){_0x4e4da2=_0x230bd4;logger[_0x470a('0xc')]('The\x20Enduser\x20ID\x20is:',_0x4e4da2['id']);return getTicket(_0x388f89,_0x356fab,_0x4e4da2,_0x59a63c,_0x555981);})['then'](function(_0xbcda35){if(_0xbcda35&&_0xbcda35['id']){logger[_0x470a('0xc')](_0x470a('0x1d'));logger[_0x470a('0xc')](_0x470a('0x4a'),_0xbcda35['id']);logger[_0x470a('0xc')]('[QUEUE]',_0x470a('0x4b'));emit(util[_0x470a('0xe')](_0x470a('0x4c'),_0x5cedec['name']),_0x470a('0x4d'),{'uri':util[_0x470a('0xe')](_0x470a('0x4e'),_0x388f89[_0x470a('0x20')],_0xbcda35['id'])});}})[_0x470a('0x4f')](function(_0x29a20b){logger['error']('[QUEUE]',JSON[_0x470a('0x31')](_0x29a20b));});};exports[_0x470a('0x50')]=function(_0x2a0b33,_0xbdc535,_0x4e565e,_0x3ce225,_0x1d7f2e,_0xb93e2f,_0x3d8bcb){var _0x3e7be5,_0x15469d;_0xb93e2f['remoteUri']=intUtil[_0x470a('0x42')](_0xb93e2f['remoteUri']);_0xb93e2f[_0x470a('0x43')]=intUtil[_0x470a('0x42')](_0xb93e2f[_0x470a('0x43')]);if(_0x3d8bcb&&_0x3d8bcb[_0x470a('0x51')]&&_0x3d8bcb[_0x470a('0x51')]!==_0x470a('0x52')){logger[_0x470a('0xc')]('[OUTBOUND]',_0x470a('0x45'));_0xbdc535[_0x470a('0x46')]=util[_0x470a('0xe')](_0x470a('0x47'),_0xb93e2f[_0x470a('0x43')],_0xbdc535[_0x470a('0x48')],md5(_0xbdc535[_0x470a('0x48')]));}headers[_0x470a('0x53')]=getAuth(_0xb93e2f);return getUser(_0xb93e2f,_0x3ce225[_0x470a('0x25')])[_0x470a('0x21')](function(_0x27ccdb){_0x3e7be5=_0x27ccdb;logger['info'](_0x470a('0x49'),_0x3e7be5['id']);return getEndUser(_0xb93e2f,_0xbdc535['destcalleridname'],_0xbdc535[_0x470a('0x54')]);})[_0x470a('0x21')](function(_0x43a80a){_0x15469d=_0x43a80a;logger[_0x470a('0xc')](_0x470a('0x55'),_0x15469d['id']);return getTicket(_0xb93e2f,_0x3e7be5,_0x15469d,_0x4e565e,_0xbdc535);})[_0x470a('0x21')](function(_0x5cc9aa){if(_0x5cc9aa&&_0x5cc9aa['id']){logger[_0x470a('0xc')](_0x470a('0x1d'));logger[_0x470a('0xc')](_0x470a('0x4a'),_0x5cc9aa['id']);logger[_0x470a('0xc')](_0x470a('0x56'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format']('user:%s',_0x3ce225[_0x470a('0x16')]),_0x470a('0x4d'),{'uri':util[_0x470a('0xe')]('%s/helpdesk/tickets/%d',_0xb93e2f[_0x470a('0x20')],_0x5cc9aa['id'])});}})['catch'](function(_0xf36252){logger[_0x470a('0x57')](_0x470a('0x56'),JSON[_0x470a('0x31')](_0xf36252));});};exports[_0x470a('0x58')]=function(_0x363d5a,_0x2595fe,_0x240dec,_0x4c2e2e,_0x3625ec,_0x21e1d5){var _0x1c9b59,_0x44767b;_0x21e1d5[_0x470a('0x20')]=intUtil['stripTrailingSlash'](_0x21e1d5[_0x470a('0x20')]);_0x21e1d5[_0x470a('0x43')]=intUtil[_0x470a('0x42')](_0x21e1d5[_0x470a('0x43')]);if(_0x3625ec&&_0x3625ec[_0x470a('0x44')]){logger['info'](_0x470a('0x59'),_0x470a('0x45'));_0x2595fe['recordingURL']=util['format'](_0x470a('0x47'),_0x21e1d5[_0x470a('0x43')],_0x2595fe[_0x470a('0x48')],md5(_0x2595fe[_0x470a('0x48')]));}else{_0x2595fe[_0x470a('0x46')]='';}headers['Authorization']=getAuth(_0x21e1d5);return getUser(_0x21e1d5,'')[_0x470a('0x21')](function(_0x3ed9ab){_0x1c9b59=_0x3ed9ab;logger['info'](_0x470a('0x49'),_0x1c9b59['id']);return getEndUser(_0x21e1d5,_0x2595fe[_0x470a('0x10')],_0x2595fe[_0x470a('0x11')]);})[_0x470a('0x21')](function(_0x171bdb){_0x44767b=_0x171bdb;logger[_0x470a('0xc')](_0x470a('0x55'),_0x44767b['id']);return getTicket(_0x21e1d5,_0x1c9b59,_0x44767b,_0x240dec,_0x2595fe);})['then'](function(_0x16a65f){if(_0x16a65f){logger['info']('Ticket\x20created!');logger[_0x470a('0xc')]('The\x20Ticket\x20ID\x20is:',_0x16a65f['id']);}})[_0x470a('0x4f')](function(_0x30c92e){logger[_0x470a('0x57')]('[ABANDONED]',JSON[_0x470a('0x31')](_0x30c92e));});}; \ No newline at end of file +var _0xf736=['variableName','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','uniqueid','Authorization','The\x20User\x20ID\x20is:','calleridname','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','%s/helpdesk/tickets/%d','error','outbound','recordingFormat','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','user:%s','trigger:browser:url','catch','abandoned','[ABANDONED]','request-promise','md5','util','./util','../../../../config/environment','freshdesk','redis','defaults','socket.io-emitter','application/json','emit','info','Creating\x20new\x20ticket...','merge','calleridnum','getString','Descriptions','name','Fields','custom_fields','mapValues','keyBy','value','format','%s/api/v2/tickets','remoteUri','POST','then','validateEmail','%s/api/v2/agents','length','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20found!','find','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','Basic\x20%s','apiKey','toString','base64','debug','[HTTP]','stringify','map','forEach','nameField','customField','toLowerCase','type','string','idField','push','content','variable'];(function(_0x433a86,_0x175b5c){var _0x23000c=function(_0x4b1fa0){while(--_0x4b1fa0){_0x433a86['push'](_0x433a86['shift']());}};_0x23000c(++_0x175b5c);}(_0xf736,0xd4));var _0x6f73=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf736[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var rp=require(_0x6f73('0x0'));var md5=require(_0x6f73('0x1'));var util=require(_0x6f73('0x2'));var Redis=require('ioredis');var intUtil=require(_0x6f73('0x3'));var config=require(_0x6f73('0x4'));var logger=require('../../../../config/logger')(_0x6f73('0x5'));config[_0x6f73('0x6')]=_[_0x6f73('0x7')](config[_0x6f73('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x6f73('0x8'))(new Redis(config[_0x6f73('0x6')]));var headers={'Content-Type':'application/json','Accept':_0x6f73('0x9')};function emit(_0x1f83a2,_0x55f0e6,_0x56b8d1){io['to'](_0x1f83a2)[_0x6f73('0xa')](_0x55f0e6,_0x56b8d1);}function getTicket(_0x383292,_0xaab470,_0x7b466e,_0x5a95f8,_0x501be1){logger[_0x6f73('0xb')](_0x6f73('0xc'));var _0x181a3d=_[_0x6f73('0xd')]({'responder_id':_0xaab470['id'],'requester_id':_0x7b466e['id'],'name':util['format']('Caller\x20-\x20%s',_0x501be1['calleridname']),'phone':_0x501be1[_0x6f73('0xe')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x6f73('0xf')](_0x5a95f8['Subjects'],_0x501be1,'\x20'),'description':intUtil[_0x6f73('0xf')](_0x5a95f8[_0x6f73('0x10')],_0x501be1,'
'),'tags':getTags(_0x5a95f8['Tags'],_0x6f73('0x11'))},getCustomFields(_0x5a95f8[_0x6f73('0x12')],_0x501be1));_0x181a3d[_0x6f73('0x13')]=_[_0x6f73('0x14')](_[_0x6f73('0x15')](_0x181a3d['custom_fields'],'id'),_0x6f73('0x16'));return request({'uri':util[_0x6f73('0x17')](_0x6f73('0x18'),_0x383292[_0x6f73('0x19')]),'method':_0x6f73('0x1a'),'body':_0x181a3d})[_0x6f73('0x1b')](function(_0x56f57d){logger[_0x6f73('0xb')]('Ticket\x20created!');return _0x56f57d;});}function getUser(_0x438d2a,_0x531ae9){if(intUtil[_0x6f73('0x1c')](_0x531ae9)){return request({'uri':util[_0x6f73('0x17')](_0x6f73('0x1d'),_0x438d2a[_0x6f73('0x19')]),'qs':{'email':_0x531ae9}})[_0x6f73('0x1b')](function(_0x37048a){if(_0x37048a[_0x6f73('0x1e')]){logger['info']('Agent\x20found!');return _['find'](_0x37048a,function(_0x38be34){return _0x38be34[_0x6f73('0x1f')][_0x6f73('0x20')]===_0x531ae9;});}else{logger[_0x6f73('0xb')](_0x6f73('0x21'));return request({'uri':util[_0x6f73('0x17')](_0x6f73('0x22'),_0x438d2a['remoteUri'])})[_0x6f73('0x1b')](function(_0x219dad){logger['info'](_0x6f73('0x23'));return _0x219dad;});}});}else{logger['info'](_0x6f73('0x24'));return request({'uri':util['format'](_0x6f73('0x22'),_0x438d2a[_0x6f73('0x19')])})['then'](function(_0x37343c){logger[_0x6f73('0xb')]('Admin\x20account\x20selected.');return _0x37343c;});}}function getEndUser(_0x1eaa41,_0x2a2111,_0x1b030f){logger['info'](_0x6f73('0x25'),_0x1b030f);return request({'uri':util[_0x6f73('0x17')](_0x6f73('0x26'),_0x1eaa41[_0x6f73('0x19')]),'qs':{'phone':_0x1b030f}})['then'](function(_0xced653){if(_0xced653[_0x6f73('0x1e')]){logger[_0x6f73('0xb')](_0x6f73('0x27'));return _[_0x6f73('0x28')](_0xced653,{'phone':_0x1b030f});}else{logger['info'](_0x6f73('0x29'));return request({'uri':util[_0x6f73('0x17')]('%s/api/v2/contacts',_0x1eaa41['remoteUri']),'method':_0x6f73('0x1a'),'body':{'name':_0x2a2111,'phone':_0x1b030f}})['then'](function(_0x6eb989){logger[_0x6f73('0xb')](_0x6f73('0x2a'));return _0x6eb989;});}});}function getAuth(_0x3c681b){return util[_0x6f73('0x17')](_0x6f73('0x2b'),new Buffer(_0x3c681b[_0x6f73('0x2c')]+':X')[_0x6f73('0x2d')](_0x6f73('0x2e')));}function request(_0x2d87ac){logger[_0x6f73('0x2f')](_0x6f73('0x30'),JSON[_0x6f73('0x31')](_0x2d87ac));return rp(_[_0x6f73('0x7')](_0x2d87ac,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x341e4,_0x5990d8){var _0x257437=[];if(_0x341e4&&_0x341e4['length']>0x0){_0x257437=_[_0x6f73('0x32')](_0x341e4,_0x5990d8);}return _0x257437;}function getCustomFields(_0x28defa,_0x3e76d1){var _0x495bc3=[];var _0x5016a5={'custom_fields':[]};if(_0x28defa[_0x6f73('0x1e')]>0x0){_[_0x6f73('0x33')](_0x28defa,function(_0xf22c4f){if(_0xf22c4f['type']==='string'&&_0xf22c4f[_0x6f73('0x34')]&&!_0xf22c4f[_0x6f73('0x35')]){_0x5016a5[_0xf22c4f['nameField'][_0x6f73('0x36')]()]=_0xf22c4f['content'][_0x6f73('0x2d')]();}else if(_0xf22c4f[_0x6f73('0x37')]===_0x6f73('0x38')&&_0xf22c4f[_0x6f73('0x39')]&&_0xf22c4f[_0x6f73('0x35')]){_0x5016a5[_0x6f73('0x13')][_0x6f73('0x3a')]({'id':_0xf22c4f[_0x6f73('0x39')],'value':_0xf22c4f[_0x6f73('0x3b')][_0x6f73('0x2d')]()});}else if(_0xf22c4f[_0x6f73('0x37')]===_0x6f73('0x3c')&&_0xf22c4f['variableName']&&_0xf22c4f[_0x6f73('0x39')]&&_0xf22c4f[_0x6f73('0x35')]){_0x3e76d1[_0xf22c4f[_0x6f73('0x3d')]]&&_0x5016a5[_0x6f73('0x13')]['push']({'id':_0xf22c4f['idField'],'value':_0x3e76d1[_0xf22c4f[_0x6f73('0x3d')]][_0x6f73('0x2d')]()});}else if(_0xf22c4f[_0x6f73('0x37')]==='customVariable'&&_0xf22c4f[_0x6f73('0x3e')]&&_0xf22c4f[_0x6f73('0x3e')]['name']&&_0xf22c4f[_0x6f73('0x39')]&&_0xf22c4f[_0x6f73('0x35')]){_0x3e76d1[_0xf22c4f[_0x6f73('0x3e')][_0x6f73('0x11')][_0x6f73('0x36')]()]&&_0x5016a5[_0x6f73('0x13')]['push']({'id':_0xf22c4f['idField'],'value':_0x3e76d1[_0xf22c4f['Variable']['name'][_0x6f73('0x36')]()][_0x6f73('0x2d')]()});}});}return _0x5016a5;}exports[_0x6f73('0x3f')]=function(_0x149e39,_0x332fc6,_0x5d0c19,_0x5e2a37,_0x172410,_0x3082fb){var _0x557e6f,_0x2ff48f;_0x3082fb[_0x6f73('0x19')]=intUtil[_0x6f73('0x40')](_0x3082fb[_0x6f73('0x19')]);_0x3082fb[_0x6f73('0x41')]=intUtil[_0x6f73('0x40')](_0x3082fb[_0x6f73('0x41')]);if(_0x172410&&_0x172410[_0x6f73('0x42')]){logger[_0x6f73('0xb')]('[QUEUE]',_0x6f73('0x43'));_0x332fc6[_0x6f73('0x44')]=util[_0x6f73('0x17')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3082fb[_0x6f73('0x41')],_0x332fc6[_0x6f73('0x45')],md5(_0x332fc6[_0x6f73('0x45')]));}else{_0x332fc6['recordingURL']='';}headers[_0x6f73('0x46')]=getAuth(_0x3082fb);return getUser(_0x3082fb,_0x5e2a37['email'])[_0x6f73('0x1b')](function(_0x4d3351){_0x557e6f=_0x4d3351;logger[_0x6f73('0xb')](_0x6f73('0x47'),_0x557e6f['id']);return getEndUser(_0x3082fb,_0x332fc6[_0x6f73('0x48')],_0x332fc6['calleridnum']);})[_0x6f73('0x1b')](function(_0x275fab){_0x2ff48f=_0x275fab;logger[_0x6f73('0xb')]('The\x20Enduser\x20ID\x20is:',_0x2ff48f['id']);return getTicket(_0x3082fb,_0x557e6f,_0x2ff48f,_0x5d0c19,_0x332fc6);})[_0x6f73('0x1b')](function(_0x3af40c){if(_0x3af40c&&_0x3af40c['id']){logger[_0x6f73('0xb')](_0x6f73('0x49'));logger[_0x6f73('0xb')](_0x6f73('0x4a'),_0x3af40c['id']);logger['info'](_0x6f73('0x4b'),_0x6f73('0x4c'));emit(util['format']('user:%s',_0x5e2a37[_0x6f73('0x11')]),'trigger:browser:url',{'uri':util['format'](_0x6f73('0x4d'),_0x3082fb[_0x6f73('0x19')],_0x3af40c['id'])});}})['catch'](function(_0x5aecc4){logger[_0x6f73('0x4e')]('[QUEUE]',JSON[_0x6f73('0x31')](_0x5aecc4));});};exports[_0x6f73('0x4f')]=function(_0x1ef0bf,_0x29e5df,_0x39b173,_0x1bda8a,_0x49b8fa,_0x3f0173,_0x3ab6fe){var _0x5e7588,_0x2234a0;_0x3f0173[_0x6f73('0x19')]=intUtil['stripTrailingSlash'](_0x3f0173[_0x6f73('0x19')]);_0x3f0173[_0x6f73('0x41')]=intUtil[_0x6f73('0x40')](_0x3f0173[_0x6f73('0x41')]);if(_0x3ab6fe&&_0x3ab6fe[_0x6f73('0x50')]&&_0x3ab6fe[_0x6f73('0x50')]!=='none'){logger[_0x6f73('0xb')](_0x6f73('0x51'),_0x6f73('0x43'));_0x29e5df[_0x6f73('0x44')]=util[_0x6f73('0x17')](_0x6f73('0x52'),_0x3f0173['serverUrl'],_0x29e5df[_0x6f73('0x45')],md5(_0x29e5df[_0x6f73('0x45')]));}headers[_0x6f73('0x46')]=getAuth(_0x3f0173);return getUser(_0x3f0173,_0x1bda8a['email'])['then'](function(_0x317dde){_0x5e7588=_0x317dde;logger['info'](_0x6f73('0x47'),_0x5e7588['id']);return getEndUser(_0x3f0173,_0x29e5df[_0x6f73('0x53')],_0x29e5df[_0x6f73('0x54')]);})[_0x6f73('0x1b')](function(_0x5ef0a5){_0x2234a0=_0x5ef0a5;logger[_0x6f73('0xb')](_0x6f73('0x55'),_0x2234a0['id']);return getTicket(_0x3f0173,_0x5e7588,_0x2234a0,_0x39b173,_0x29e5df);})[_0x6f73('0x1b')](function(_0x13b48f){if(_0x13b48f&&_0x13b48f['id']){logger[_0x6f73('0xb')](_0x6f73('0x49'));logger[_0x6f73('0xb')](_0x6f73('0x4a'),_0x13b48f['id']);logger[_0x6f73('0xb')]('[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0x6f73('0x56'),_0x1bda8a[_0x6f73('0x11')]),_0x6f73('0x57'),{'uri':util[_0x6f73('0x17')](_0x6f73('0x4d'),_0x3f0173[_0x6f73('0x19')],_0x13b48f['id'])});}})[_0x6f73('0x58')](function(_0x59e004){logger['error'](_0x6f73('0x51'),JSON['stringify'](_0x59e004));});};exports[_0x6f73('0x59')]=function(_0x54200d,_0x39f7fd,_0x3b2883,_0x27c225,_0x4e3ff7,_0x4f6abd){var _0x27a4e7,_0x188fbb;_0x4f6abd[_0x6f73('0x19')]=intUtil[_0x6f73('0x40')](_0x4f6abd[_0x6f73('0x19')]);_0x4f6abd[_0x6f73('0x41')]=intUtil['stripTrailingSlash'](_0x4f6abd[_0x6f73('0x41')]);if(_0x4e3ff7&&_0x4e3ff7[_0x6f73('0x42')]){logger[_0x6f73('0xb')](_0x6f73('0x5a'),_0x6f73('0x43'));_0x39f7fd[_0x6f73('0x44')]=util[_0x6f73('0x17')](_0x6f73('0x52'),_0x4f6abd[_0x6f73('0x41')],_0x39f7fd[_0x6f73('0x45')],md5(_0x39f7fd[_0x6f73('0x45')]));}else{_0x39f7fd['recordingURL']='';}headers[_0x6f73('0x46')]=getAuth(_0x4f6abd);return getUser(_0x4f6abd,'')[_0x6f73('0x1b')](function(_0x2633b7){_0x27a4e7=_0x2633b7;logger[_0x6f73('0xb')](_0x6f73('0x47'),_0x27a4e7['id']);return getEndUser(_0x4f6abd,_0x39f7fd[_0x6f73('0x48')],_0x39f7fd[_0x6f73('0xe')]);})[_0x6f73('0x1b')](function(_0x55b19f){_0x188fbb=_0x55b19f;logger[_0x6f73('0xb')]('The\x20Enduser\x20ID\x20is:',_0x188fbb['id']);return getTicket(_0x4f6abd,_0x27a4e7,_0x188fbb,_0x3b2883,_0x39f7fd);})[_0x6f73('0x1b')](function(_0x1e1608){if(_0x1e1608){logger[_0x6f73('0xb')](_0x6f73('0x49'));logger[_0x6f73('0xb')](_0x6f73('0x4a'),_0x1e1608['id']);}})[_0x6f73('0x58')](function(_0x1f184b){logger[_0x6f73('0x4e')](_0x6f73('0x5a'),JSON[_0x6f73('0x31')](_0x1f184b));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/freshsales.js b/server/services/ami/trigger/integration/freshsales.js index 3e72cdc..51392f6 100644 --- a/server/services/ami/trigger/integration/freshsales.js +++ b/server/services/ami/trigger/integration/freshsales.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x94bc=['apiKey','remoteUri','stripTrailingSlash','serverUrl','username','toLowerCase','outbound','calleridnum','callDirection','abandoned','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','inspect','lodash','request-promise','md5','util','moment','bluebird','ioredis','./util','../../../../config/environment','../../../../config/logger','freshsales','redis','defaults','localhost','socket.io-emitter','GET','/api/selector/owners','headers','info','Getting\x20admin\x20information','users','email','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','Getting\x20user\x20list','then','agentEmail','userEmail','length','userId','User\x20found:','Admin\x20selected','error','message','/api/contacts/filters','filters','Getting\x20contact\x20list','/api/contacts/view/','Searching\x20contact\x20with\x20phone','contactNumber','contacts','mobile_number','endUserId','Contact\x20created:','POST','/api/contacts','format','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','toUpperCase','Creating\x20new\x20task','/api/tasks','Subjects','getString','Descriptions','Contact','add','Task\x20created:','ticketId','/contacts/','user:%s','trigger:browser:url','Token\x20token='];(function(_0x2ceea8,_0x542b4f){var _0x44f71a=function(_0x5035df){while(--_0x5035df){_0x2ceea8['push'](_0x2ceea8['shift']());}};_0x44f71a(++_0x542b4f);}(_0x94bc,0x17a));var _0xc94b=function(_0x332251,_0x3c134f){_0x332251=_0x332251-0x0;var _0x592e7d=_0x94bc[_0x332251];return _0x592e7d;};'use strict';var _=require(_0xc94b('0x0'));var rp=require(_0xc94b('0x1'));var md5=require(_0xc94b('0x2'));var util=require(_0xc94b('0x3'));var moment=require(_0xc94b('0x4'));var Promise=require(_0xc94b('0x5'));var Redis=require(_0xc94b('0x6'));var intUtil=require(_0xc94b('0x7'));var config=require(_0xc94b('0x8'));var logger=require(_0xc94b('0x9'))(_0xc94b('0xa'));config[_0xc94b('0xb')]=_[_0xc94b('0xc')](config[_0xc94b('0xb')],{'host':_0xc94b('0xd'),'port':0x18eb});var io=require(_0xc94b('0xe'))(new Redis(config['redis']));function getAdminId(_0xc1598d,_0x15a735,_0x129c0d,_0x361008){return new Promise(function(_0x1ff8a9,_0x494ed2){var _0x219523=![];var _0x1966fc={'method':_0xc94b('0xf'),'uri':_0x361008+_0xc94b('0x10'),'json':!![]};_0x1966fc[_0xc94b('0x11')]=_0x129c0d;logger[_0xc94b('0x12')](_0xc94b('0x13'));return rp(_0x1966fc)['then'](function(_0x5630c8){if(_0x5630c8){var _0x13cb40=_0x5630c8[_0xc94b('0x14')];var _0x1421cc=null;for(_0x1421cc=0x0;_0x1421cc<_0x13cb40['length'];_0x1421cc++){if(_0x13cb40[_0x1421cc][_0xc94b('0x15')]===_0xc1598d[_0xc94b('0x16')]){_0xc1598d[_0xc94b('0x17')]=_0x13cb40[_0x1421cc]['id'];_0x219523=!![];}}if(_0x219523){logger[_0xc94b('0x12')](_0xc94b('0x18'),_0xc1598d['adminId']);_0x1ff8a9(_0xc1598d);}else{_0x494ed2({'statusCode':0x194,'message':_0xc94b('0x19')});}}else{_0x494ed2({'statusCode':0x194,'message':_0xc94b('0x19')});}})[_0xc94b('0x1a')](function(_0x1ecec1){logger['error']('['+[_0x15a735['toUpperCase']()]+']',_0x1ecec1['message']);_0x494ed2(_0x1ecec1);});});}function getUser(_0x2f64c9,_0x370edf,_0x20a1b6){return function(_0x12f0fa){return new Promise(function(_0x3d55f6,_0xe3b68a){var _0x3913c3={'method':_0xc94b('0xf'),'uri':_0x20a1b6+_0xc94b('0x10'),'json':!![]};_0x3913c3[_0xc94b('0x11')]=_0x370edf;logger['info'](_0xc94b('0x1b'));return rp(_0x3913c3)[_0xc94b('0x1c')](function(_0x5ae265){if(_0x5ae265){var _0x843c33=_0x5ae265[_0xc94b('0x14')];var _0x1d6159=![];var _0x2da786=null;if(_0x12f0fa[_0xc94b('0x1d')]!==null){logger[_0xc94b('0x12')]('Getting\x20user\x20with\x20email',_0x12f0fa['agentEmail']);_0x12f0fa[_0xc94b('0x1e')]=_0x12f0fa['agentEmail'];for(_0x2da786=0x0;_0x2da786<_0x843c33[_0xc94b('0x1f')];_0x2da786++){if(_0x843c33[_0x2da786]['email']===_0x12f0fa[_0xc94b('0x1d')]){_0x1d6159=!![];_0x12f0fa[_0xc94b('0x20')]=_0x843c33[_0x2da786]['id'];logger[_0xc94b('0x12')](_0xc94b('0x21'),_0x12f0fa['userId']);}}}if(!_0x1d6159){logger[_0xc94b('0x12')](_0xc94b('0x22'));_0x12f0fa[_0xc94b('0x1e')]=_0x12f0fa[_0xc94b('0x16')];_0x12f0fa[_0xc94b('0x20')]=_0x12f0fa[_0xc94b('0x17')];_0x1d6159=!![];}if(_0x1d6159){_0x3d55f6(_0x12f0fa);}else{_0xe3b68a({'statusCode':0x194,'message':_0xc94b('0x19')});}}else{_0xe3b68a({'statusCode':0x194,'message':_0xc94b('0x19')});}})[_0xc94b('0x1a')](function(_0x1819a5){logger[_0xc94b('0x23')]('['+[_0x2f64c9['toUpperCase']()]+']',_0x1819a5[_0xc94b('0x24')]);_0xe3b68a(_0x1819a5);});});};}function getEndUser(_0x2ec91e,_0x5be882,_0x4cd6ee){return function(_0x4075b8){return new Promise(function(_0x1cbe6b,_0x5e0add){var _0x562094=0x0;var _0x273713={'method':_0xc94b('0xf'),'uri':_0x4cd6ee+_0xc94b('0x25'),'json':!![]};_0x273713['headers']=_0x5be882;logger[_0xc94b('0x12')]('Getting\x20contacts\x20filter');return rp(_0x273713)['then'](function(_0x5eece7){_0x5eece7[_0xc94b('0x26')]['forEach'](function(_0x39422a){if(_0x39422a['name']==='All\x20Contacts'){_0x562094=_0x39422a['id'];}});})[_0xc94b('0x1c')](function(){logger[_0xc94b('0x12')](_0xc94b('0x27'));var _0x54ce36={'method':_0xc94b('0xf'),'uri':_0x4cd6ee+_0xc94b('0x28')+_0x562094,'json':!![]};_0x54ce36['headers']=_0x5be882;return rp(_0x54ce36);})[_0xc94b('0x1c')](function(_0x3f5126){logger[_0xc94b('0x12')](_0xc94b('0x29'),_0x4075b8[_0xc94b('0x2a')]);if(_0x3f5126['contacts'][_0xc94b('0x1f')]>0x0){var _0x3a8a86=_['find'](_0x3f5126[_0xc94b('0x2b')],function(_0x54746e){if(_0x54746e['work_number']===_0x4075b8[_0xc94b('0x2a')]||_0x54746e[_0xc94b('0x2c')]===_0x4075b8[_0xc94b('0x2a')]){return _0x54746e;}});if(_0x3a8a86){_0x4075b8[_0xc94b('0x2d')]=_0x3a8a86['id'];logger['info']('Contact\x20found:',_0x4075b8['endUserId']);_0x1cbe6b(_0x4075b8);}else{return createEndUser(_0x4075b8,_0x2ec91e,_0x5be882,_0x4cd6ee)[_0xc94b('0x1c')](function(_0x3c3de3){logger[_0xc94b('0x12')](_0xc94b('0x2e'),_0x4075b8['endUserId']);_0x1cbe6b(_0x3c3de3);});}}else{return createEndUser(_0x4075b8,_0x2ec91e,_0x5be882,_0x4cd6ee)[_0xc94b('0x1c')](function(_0x272712){logger[_0xc94b('0x12')](_0xc94b('0x2e'),_0x4075b8[_0xc94b('0x2d')]);_0x1cbe6b(_0x272712);});}})[_0xc94b('0x1a')](function(_0x3dabea){throw new Error(_0x3dabea[_0xc94b('0x24')]);});});};}function createEndUser(_0x277633,_0x13b866,_0x1a16e3,_0x28f2e5){return new Promise(function(_0x3ead41,_0x209f01){var _0x5c1f69=moment();var _0x3642a0={'method':_0xc94b('0x2f'),'uri':_0x28f2e5+_0xc94b('0x30'),'body':{'contact':{'last_name':_0x277633[_0xc94b('0x2a')],'work_number':_0x277633[_0xc94b('0x2a')],'mobile_number':_0x277633['contactNumber'],'owner_id':_0x277633[_0xc94b('0x20')],'created_at':_0x5c1f69[_0xc94b('0x31')](_0xc94b('0x32'))}},'json':!![]};_0x3642a0[_0xc94b('0x11')]=_0x1a16e3;logger[_0xc94b('0x12')](_0xc94b('0x33'));return rp(_0x3642a0)[_0xc94b('0x1c')](function(_0x1d406c){_0x277633[_0xc94b('0x2d')]=_0x1d406c[_0xc94b('0x34')]['id'];_0x3ead41(_0x277633);})[_0xc94b('0x1a')](function(_0x4af70a){logger[_0xc94b('0x23')]('['+[_0x13b866[_0xc94b('0x35')]()]+']',_0x4af70a[_0xc94b('0x24')]);_0x209f01(_0x4af70a['message']);});});}function getTicket(_0x522f7f,_0x3a3803,_0x53f9af,_0x41dd55,_0x3baf60){return function(_0xb07bf0){logger[_0xc94b('0x12')](_0xc94b('0x36'));return new Promise(function(_0x4b6b48,_0x3e057f){var _0x59d40c=moment();var _0x4c59d7={'method':_0xc94b('0x2f'),'uri':_0x53f9af+_0xc94b('0x37'),'body':{'title':intUtil['getString'](_0x41dd55[_0xc94b('0x38')],_0x3baf60,'\x20'),'description':intUtil[_0xc94b('0x39')](_0x41dd55[_0xc94b('0x3a')],_0x3baf60,'\x0a'),'owner_id':_0xb07bf0[_0xc94b('0x20')],'creater_id':_0xb07bf0[_0xc94b('0x17')],'targetable_id':_0xb07bf0[_0xc94b('0x2d')],'targetable_type':_0xc94b('0x3b'),'created_at':_0x59d40c[_0xc94b('0x31')](_0xc94b('0x32')),'due_date':_0x59d40c[_0xc94b('0x3c')](0x1e,'m')[_0xc94b('0x31')](_0xc94b('0x32'))},'json':!![]};_0x4c59d7['headers']=_0x3a3803;return rp(_0x4c59d7)['then'](function(_0x299395){_0xb07bf0['ticketId']=_0x299395['task']['id'];logger[_0xc94b('0x12')](_0xc94b('0x3d'),_0xb07bf0[_0xc94b('0x3e')]);_0x4b6b48(_0xb07bf0);})[_0xc94b('0x1a')](function(_0x53b5a2){logger[_0xc94b('0x23')]('['+[_0x522f7f['toUpperCase']()]+']',_0x53b5a2['message']);_0x3e057f(_0x53b5a2[_0xc94b('0x24')]);});});};}function emit(_0xd909c,_0x483965,_0x35471d){var _0x264805={'uri':_0xd909c+_0xc94b('0x3f')+_0x35471d};io['to'](util['format'](_0xc94b('0x40'),_0x483965))['emit'](_0xc94b('0x41'),_0x264805);}exports['cs']=function(_0x59e431,_0x54a37f,_0x4ce0b2,_0x3995a6,_0x5443fb,_0x58e9be,_0x1d8ade,_0x2182e3){var _0x1c2a19={};var _0x1e159b={'Authorization':_0xc94b('0x42')+_0x58e9be[_0xc94b('0x43')]};_0x58e9be[_0xc94b('0x44')]=intUtil[_0xc94b('0x45')](_0x58e9be[_0xc94b('0x44')]);_0x58e9be['serverUrl']=intUtil['stripTrailingSlash'](_0x58e9be[_0xc94b('0x46')]);var _0x43db20=_0x58e9be[_0xc94b('0x44')];_0x1c2a19[_0xc94b('0x16')]=_0x58e9be[_0xc94b('0x47')];_0x1c2a19[_0xc94b('0x2a')]=_0x2182e3[_0xc94b('0x48')]()===_0xc94b('0x49')?_0x54a37f['destcalleridnum']:_0x54a37f[_0xc94b('0x4a')];_0x1c2a19[_0xc94b('0x4b')]=_0x2182e3==='queue'||_0x2182e3===_0xc94b('0x4c')?_0xc94b('0x4d'):_0xc94b('0x49');if(_0x3995a6){_0x1c2a19[_0xc94b('0x1d')]=_0x3995a6[_0xc94b('0x15')];}var _0x17a4b8=util['format'](_0xc94b('0x4e'),_0x58e9be[_0xc94b('0x46')],_0x54a37f[_0xc94b('0x4f')],md5(_0x54a37f['uniqueid']));if(_0x5443fb&&_0x5443fb[_0xc94b('0x50')]){logger[_0xc94b('0x12')]('[QUEUE]',_0xc94b('0x51'));_0x54a37f[_0xc94b('0x52')]=_0x17a4b8;}else if(_0x1d8ade&&_0x1d8ade[_0xc94b('0x53')]&&_0x1d8ade[_0xc94b('0x53')]!==_0xc94b('0x54')){logger['info'](_0xc94b('0x55'),'Recording\x20is\x20enabled!');_0x54a37f['recordingURL']=_0x17a4b8;}else{_0x54a37f['recordingURL']='';}return getAdminId(_0x1c2a19,_0x2182e3,_0x1e159b,_0x43db20)[_0xc94b('0x1c')](getUser(_0x2182e3,_0x1e159b,_0x43db20))[_0xc94b('0x1c')](getEndUser(_0x2182e3,_0x1e159b,_0x43db20))[_0xc94b('0x1c')](getTicket(_0x2182e3,_0x1e159b,_0x43db20,_0x4ce0b2,_0x54a37f))[_0xc94b('0x1c')](function(_0x178c73){logger[_0xc94b('0x12')](util['format'](_0xc94b('0x56'),_0x178c73[_0xc94b('0x3e')]));if(_0x2182e3!==_0xc94b('0x4c')){logger[_0xc94b('0x12')]('['+[_0x2182e3[_0xc94b('0x35')]()]+']',_0xc94b('0x57'));emit(_0x43db20,_0x3995a6['name'],_0x178c73[_0xc94b('0x2d')]);}})['catch'](function(_0x252c02){logger[_0xc94b('0x23')]('['+[_0x2182e3[_0xc94b('0x35')]()]+']\x20Error\x20running\x20Freshsales\x20integration',util[_0xc94b('0x58')](_0x252c02,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xb932=['abandoned','Displaying\x20task\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20Freshsales\x20integration','lodash','util','moment','bluebird','ioredis','./util','../../../../config/logger','freshsales','redis','defaults','localhost','GET','/api/selector/owners','headers','info','Getting\x20admin\x20information','users','length','email','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','Getting\x20user\x20list','agentEmail','userEmail','userId','User\x20found:','Admin\x20selected','message','/api/contacts/filters','Getting\x20contacts\x20filter','then','filters','forEach','name','All\x20Contacts','Getting\x20contact\x20list','/api/contacts/view/','Searching\x20contact\x20with\x20phone','contactNumber','contacts','find','work_number','endUserId','Contact\x20found:','Contact\x20created:','POST','format','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','Creating\x20new\x20task','Contact','add','ticketId','task','/contacts/','user:%s','emit','trigger:browser:url','Token\x20token=','remoteUri','stripTrailingSlash','serverUrl','username','outbound','destcalleridnum','calleridnum','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','[OUTBOUND]','recordingURL','The\x20ticket\x20ID\x20is:\x20%s'];(function(_0x34e79d,_0x1fb826){var _0x56afa8=function(_0x5177f4){while(--_0x5177f4){_0x34e79d['push'](_0x34e79d['shift']());}};_0x56afa8(++_0x1fb826);}(_0xb932,0x1a7));var _0x2b93=function(_0x44a3e1,_0xe3ee25){_0x44a3e1=_0x44a3e1-0x0;var _0x50c3f1=_0xb932[_0x44a3e1];return _0x50c3f1;};'use strict';var _=require(_0x2b93('0x0'));var rp=require('request-promise');var md5=require('md5');var util=require(_0x2b93('0x1'));var moment=require(_0x2b93('0x2'));var Promise=require(_0x2b93('0x3'));var Redis=require(_0x2b93('0x4'));var intUtil=require(_0x2b93('0x5'));var config=require('../../../../config/environment');var logger=require(_0x2b93('0x6'))(_0x2b93('0x7'));config[_0x2b93('0x8')]=_[_0x2b93('0x9')](config[_0x2b93('0x8')],{'host':_0x2b93('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x2b93('0x8')]));function getAdminId(_0x356e1a,_0x333917,_0x23af58,_0x1c6940){return new Promise(function(_0x390d2d,_0x1e5f74){var _0x56a7a2=![];var _0x15d36c={'method':_0x2b93('0xb'),'uri':_0x1c6940+_0x2b93('0xc'),'json':!![]};_0x15d36c[_0x2b93('0xd')]=_0x23af58;logger[_0x2b93('0xe')](_0x2b93('0xf'));return rp(_0x15d36c)['then'](function(_0x4fab3f){if(_0x4fab3f){var _0x5a4c74=_0x4fab3f[_0x2b93('0x10')];var _0x1d0706=null;for(_0x1d0706=0x0;_0x1d0706<_0x5a4c74[_0x2b93('0x11')];_0x1d0706++){if(_0x5a4c74[_0x1d0706][_0x2b93('0x12')]===_0x356e1a[_0x2b93('0x13')]){_0x356e1a[_0x2b93('0x14')]=_0x5a4c74[_0x1d0706]['id'];_0x56a7a2=!![];}}if(_0x56a7a2){logger['info'](_0x2b93('0x15'),_0x356e1a[_0x2b93('0x14')]);_0x390d2d(_0x356e1a);}else{_0x1e5f74({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x1e5f74({'statusCode':0x194,'message':_0x2b93('0x16')});}})[_0x2b93('0x17')](function(_0x35f10e){logger[_0x2b93('0x18')]('['+[_0x333917[_0x2b93('0x19')]()]+']',_0x35f10e['message']);_0x1e5f74(_0x35f10e);});});}function getUser(_0x22f38e,_0x34b9fe,_0x193a50){return function(_0x4d3bb8){return new Promise(function(_0x200540,_0x587772){var _0x161bfd={'method':_0x2b93('0xb'),'uri':_0x193a50+_0x2b93('0xc'),'json':!![]};_0x161bfd[_0x2b93('0xd')]=_0x34b9fe;logger['info'](_0x2b93('0x1a'));return rp(_0x161bfd)['then'](function(_0xe51a3c){if(_0xe51a3c){var _0x203d8b=_0xe51a3c[_0x2b93('0x10')];var _0x628444=![];var _0x514048=null;if(_0x4d3bb8[_0x2b93('0x1b')]!==null){logger[_0x2b93('0xe')]('Getting\x20user\x20with\x20email',_0x4d3bb8[_0x2b93('0x1b')]);_0x4d3bb8[_0x2b93('0x1c')]=_0x4d3bb8[_0x2b93('0x1b')];for(_0x514048=0x0;_0x514048<_0x203d8b[_0x2b93('0x11')];_0x514048++){if(_0x203d8b[_0x514048][_0x2b93('0x12')]===_0x4d3bb8[_0x2b93('0x1b')]){_0x628444=!![];_0x4d3bb8[_0x2b93('0x1d')]=_0x203d8b[_0x514048]['id'];logger[_0x2b93('0xe')](_0x2b93('0x1e'),_0x4d3bb8[_0x2b93('0x1d')]);}}}if(!_0x628444){logger['info'](_0x2b93('0x1f'));_0x4d3bb8[_0x2b93('0x1c')]=_0x4d3bb8[_0x2b93('0x13')];_0x4d3bb8[_0x2b93('0x1d')]=_0x4d3bb8[_0x2b93('0x14')];_0x628444=!![];}if(_0x628444){_0x200540(_0x4d3bb8);}else{_0x587772({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x587772({'statusCode':0x194,'message':_0x2b93('0x16')});}})['catch'](function(_0x4ac782){logger[_0x2b93('0x18')]('['+[_0x22f38e[_0x2b93('0x19')]()]+']',_0x4ac782[_0x2b93('0x20')]);_0x587772(_0x4ac782);});});};}function getEndUser(_0x4d4ed2,_0x237482,_0x5cc54b){return function(_0x1e6c6f){return new Promise(function(_0xb7727e,_0x3041a9){var _0x4bdc3c=0x0;var _0xe8db8f={'method':_0x2b93('0xb'),'uri':_0x5cc54b+_0x2b93('0x21'),'json':!![]};_0xe8db8f[_0x2b93('0xd')]=_0x237482;logger[_0x2b93('0xe')](_0x2b93('0x22'));return rp(_0xe8db8f)[_0x2b93('0x23')](function(_0x4fda25){_0x4fda25[_0x2b93('0x24')][_0x2b93('0x25')](function(_0x6a0ef0){if(_0x6a0ef0[_0x2b93('0x26')]===_0x2b93('0x27')){_0x4bdc3c=_0x6a0ef0['id'];}});})[_0x2b93('0x23')](function(){logger['info'](_0x2b93('0x28'));var _0x2cf3e3={'method':_0x2b93('0xb'),'uri':_0x5cc54b+_0x2b93('0x29')+_0x4bdc3c,'json':!![]};_0x2cf3e3[_0x2b93('0xd')]=_0x237482;return rp(_0x2cf3e3);})[_0x2b93('0x23')](function(_0x29a3e0){logger['info'](_0x2b93('0x2a'),_0x1e6c6f[_0x2b93('0x2b')]);if(_0x29a3e0[_0x2b93('0x2c')][_0x2b93('0x11')]>0x0){var _0x38a13b=_[_0x2b93('0x2d')](_0x29a3e0[_0x2b93('0x2c')],function(_0x1d43de){if(_0x1d43de[_0x2b93('0x2e')]===_0x1e6c6f[_0x2b93('0x2b')]||_0x1d43de['mobile_number']===_0x1e6c6f[_0x2b93('0x2b')]){return _0x1d43de;}});if(_0x38a13b){_0x1e6c6f[_0x2b93('0x2f')]=_0x38a13b['id'];logger[_0x2b93('0xe')](_0x2b93('0x30'),_0x1e6c6f['endUserId']);_0xb7727e(_0x1e6c6f);}else{return createEndUser(_0x1e6c6f,_0x4d4ed2,_0x237482,_0x5cc54b)[_0x2b93('0x23')](function(_0x285030){logger[_0x2b93('0xe')](_0x2b93('0x31'),_0x1e6c6f['endUserId']);_0xb7727e(_0x285030);});}}else{return createEndUser(_0x1e6c6f,_0x4d4ed2,_0x237482,_0x5cc54b)[_0x2b93('0x23')](function(_0x153f36){logger['info'](_0x2b93('0x31'),_0x1e6c6f[_0x2b93('0x2f')]);_0xb7727e(_0x153f36);});}})['catch'](function(_0x5a8f18){throw new Error(_0x5a8f18[_0x2b93('0x20')]);});});};}function createEndUser(_0x2134b6,_0xa9a872,_0x389caa,_0x57d0be){return new Promise(function(_0x301024,_0x35808f){var _0x12df0b=moment();var _0x2759da={'method':_0x2b93('0x32'),'uri':_0x57d0be+'/api/contacts','body':{'contact':{'last_name':_0x2134b6[_0x2b93('0x2b')],'work_number':_0x2134b6[_0x2b93('0x2b')],'mobile_number':_0x2134b6[_0x2b93('0x2b')],'owner_id':_0x2134b6[_0x2b93('0x1d')],'created_at':_0x12df0b[_0x2b93('0x33')](_0x2b93('0x34'))}},'json':!![]};_0x2759da[_0x2b93('0xd')]=_0x389caa;logger[_0x2b93('0xe')](_0x2b93('0x35'));return rp(_0x2759da)[_0x2b93('0x23')](function(_0x286bd8){_0x2134b6[_0x2b93('0x2f')]=_0x286bd8['contact']['id'];_0x301024(_0x2134b6);})['catch'](function(_0x51007f){logger[_0x2b93('0x18')]('['+[_0xa9a872['toUpperCase']()]+']',_0x51007f['message']);_0x35808f(_0x51007f['message']);});});}function getTicket(_0x390cb9,_0x2e2774,_0x277f17,_0x16c4c1,_0x574c2c){return function(_0x1214da){logger['info'](_0x2b93('0x36'));return new Promise(function(_0x3a7f12,_0x43e60a){var _0x70cf42=moment();var _0x25e376={'method':_0x2b93('0x32'),'uri':_0x277f17+'/api/tasks','body':{'title':intUtil['getString'](_0x16c4c1['Subjects'],_0x574c2c,'\x20'),'description':intUtil['getString'](_0x16c4c1['Descriptions'],_0x574c2c,'\x0a'),'owner_id':_0x1214da[_0x2b93('0x1d')],'creater_id':_0x1214da['adminId'],'targetable_id':_0x1214da[_0x2b93('0x2f')],'targetable_type':_0x2b93('0x37'),'created_at':_0x70cf42[_0x2b93('0x33')](_0x2b93('0x34')),'due_date':_0x70cf42[_0x2b93('0x38')](0x1e,'m')['format'](_0x2b93('0x34'))},'json':!![]};_0x25e376[_0x2b93('0xd')]=_0x2e2774;return rp(_0x25e376)['then'](function(_0x2b23e5){_0x1214da[_0x2b93('0x39')]=_0x2b23e5[_0x2b93('0x3a')]['id'];logger[_0x2b93('0xe')]('Task\x20created:',_0x1214da[_0x2b93('0x39')]);_0x3a7f12(_0x1214da);})[_0x2b93('0x17')](function(_0x279209){logger[_0x2b93('0x18')]('['+[_0x390cb9['toUpperCase']()]+']',_0x279209[_0x2b93('0x20')]);_0x43e60a(_0x279209[_0x2b93('0x20')]);});});};}function emit(_0x3f9e99,_0x11a12b,_0x21bdb4){var _0x2b8485={'uri':_0x3f9e99+_0x2b93('0x3b')+_0x21bdb4};io['to'](util[_0x2b93('0x33')](_0x2b93('0x3c'),_0x11a12b))[_0x2b93('0x3d')](_0x2b93('0x3e'),_0x2b8485);}exports['cs']=function(_0x54dd33,_0x11a3ee,_0x20ce41,_0x111e65,_0x3093dc,_0x563c40,_0x5d501b,_0x595b29){var _0x42d6d7={};var _0x4f6364={'Authorization':_0x2b93('0x3f')+_0x563c40['apiKey']};_0x563c40[_0x2b93('0x40')]=intUtil[_0x2b93('0x41')](_0x563c40[_0x2b93('0x40')]);_0x563c40[_0x2b93('0x42')]=intUtil[_0x2b93('0x41')](_0x563c40[_0x2b93('0x42')]);var _0x2d81bf=_0x563c40['remoteUri'];_0x42d6d7[_0x2b93('0x13')]=_0x563c40[_0x2b93('0x43')];_0x42d6d7[_0x2b93('0x2b')]=_0x595b29['toLowerCase']()===_0x2b93('0x44')?_0x11a3ee[_0x2b93('0x45')]:_0x11a3ee[_0x2b93('0x46')];_0x42d6d7['callDirection']=_0x595b29===_0x2b93('0x47')||_0x595b29==='abandoned'?_0x2b93('0x47'):_0x2b93('0x44');if(_0x111e65){_0x42d6d7[_0x2b93('0x1b')]=_0x111e65['email'];}var _0x28ce3f=util[_0x2b93('0x33')](_0x2b93('0x48'),_0x563c40[_0x2b93('0x42')],_0x11a3ee[_0x2b93('0x49')],md5(_0x11a3ee[_0x2b93('0x49')]));if(_0x3093dc&&_0x3093dc['monitor_format']){logger[_0x2b93('0xe')](_0x2b93('0x4a'),_0x2b93('0x4b'));_0x11a3ee['recordingURL']=_0x28ce3f;}else if(_0x5d501b&&_0x5d501b[_0x2b93('0x4c')]&&_0x5d501b[_0x2b93('0x4c')]!==_0x2b93('0x4d')){logger['info'](_0x2b93('0x4e'),_0x2b93('0x4b'));_0x11a3ee[_0x2b93('0x4f')]=_0x28ce3f;}else{_0x11a3ee[_0x2b93('0x4f')]='';}return getAdminId(_0x42d6d7,_0x595b29,_0x4f6364,_0x2d81bf)['then'](getUser(_0x595b29,_0x4f6364,_0x2d81bf))[_0x2b93('0x23')](getEndUser(_0x595b29,_0x4f6364,_0x2d81bf))[_0x2b93('0x23')](getTicket(_0x595b29,_0x4f6364,_0x2d81bf,_0x20ce41,_0x11a3ee))['then'](function(_0x257494){logger['info'](util[_0x2b93('0x33')](_0x2b93('0x50'),_0x257494[_0x2b93('0x39')]));if(_0x595b29!==_0x2b93('0x51')){logger['info']('['+[_0x595b29[_0x2b93('0x19')]()]+']',_0x2b93('0x52'));emit(_0x2d81bf,_0x111e65[_0x2b93('0x26')],_0x257494[_0x2b93('0x2f')]);}})[_0x2b93('0x17')](function(_0x530802){logger[_0x2b93('0x18')]('['+[_0x595b29['toUpperCase']()]+_0x2b93('0x53'),util['inspect'](_0x530802,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/index.js b/server/services/ami/trigger/integration/index.js index 7c3a080..33699f1 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 _0xa9e0=['./vtiger','./servicenow','./dynamics365','./freshsales','salesforce','sugarcrm','freshdesk','vtiger','servicenow','exec','toLowerCase','data1','data2','find','Configurations','data3','queue','routeId','log','abandoned','zendesk','zoho','desk','freshsales','dynamics365','unknown\x20integration','../../../../config/logger','error','[EXEC]','%s\x20configuration\x20#%s\x20not\x20found','format','%s\x20account\x20#%s\x20not\x20found','lodash','util','./zendesk','./freshdesk','./desk'];(function(_0x281b6a,_0x35dc06){var _0xe5b1b7=function(_0x20f3dd){while(--_0x20f3dd){_0x281b6a['push'](_0x281b6a['shift']());}};_0xe5b1b7(++_0x35dc06);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xa9e0[_0x2bf141];return _0x48277b;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var zendesk=require(_0x0a9e('0x2'));var salesforce=require('./salesforce');var sugarcrm=require('./sugarcrm');var freshdesk=require(_0x0a9e('0x3'));var zoho=require('./zoho');var desk=require(_0x0a9e('0x4'));var vtiger=require(_0x0a9e('0x5'));var servicenow=require(_0x0a9e('0x6'));var dynamics365=require(_0x0a9e('0x7'));var freshsales=require(_0x0a9e('0x8'));var integrations=['zendesk',_0x0a9e('0x9'),_0x0a9e('0xa'),_0x0a9e('0xb'),'zoho','desk',_0x0a9e('0xc'),'dynamics365','freshsales',_0x0a9e('0xd')];exports[_0x0a9e('0xe')]=function(_0x307b3e,_0x3ab53f,_0xfeb75b,_0xbd1168,_0x4a4c56,_0x50dfb2){if(_0xfeb75b){if(_['includes'](integrations,_0x307b3e['data1'][_0x0a9e('0xf')]())){try{var _0x36471c=null;var _0xd5b662='';var _0x26d672=_0xfeb75b[_0x307b3e[_0x0a9e('0x10')][_0x0a9e('0xf')]()];if(_0x26d672){var _0x5db4b0=_0x26d672[_0x307b3e[_0x0a9e('0x11')]];if(_0x5db4b0){var _0x239b12=_[_0x0a9e('0x12')](_0x5db4b0[_0x0a9e('0x13')],{'id':parseInt(_0x307b3e[_0x0a9e('0x14')],0xa)});if(_0x239b12){if(_0xbd1168){if(_0x4a4c56&&_0x3ab53f[_0x0a9e('0x15')]){_0xd5b662='queue';}else if(_0x3ab53f[_0x0a9e('0x16')]){_0xd5b662='outbound';}else{console[_0x0a9e('0x17')]('EVENT\x20UNKNOWN',_0x3ab53f);}}else{_0xd5b662=_0x0a9e('0x18');}switch(_0x307b3e[_0x0a9e('0x10')]['toLowerCase']()){case _0x0a9e('0x19'):zendesk[_0xd5b662](_0x307b3e,_0x3ab53f,_0x239b12,_0xbd1168,_0x4a4c56,_0x5db4b0,_0x50dfb2);break;case'salesforce':salesforce[_0xd5b662](_0x307b3e,_0x3ab53f,_0x239b12,_0xbd1168,_0x4a4c56,_0x5db4b0,_0x50dfb2);break;case _0x0a9e('0xa'):sugarcrm[_0xd5b662](_0x307b3e,_0x3ab53f,_0x239b12,_0xbd1168,_0x4a4c56,_0x5db4b0,_0x50dfb2);break;case _0x0a9e('0xb'):freshdesk[_0xd5b662](_0x307b3e,_0x3ab53f,_0x239b12,_0xbd1168,_0x4a4c56,_0x5db4b0,_0x50dfb2);break;case _0x0a9e('0x1a'):zoho[_0xd5b662](_0x307b3e,_0x3ab53f,_0x239b12,_0xbd1168,_0x4a4c56,_0x5db4b0,_0x50dfb2);break;case _0x0a9e('0x1b'):desk[_0xd5b662](_0x307b3e,_0x3ab53f,_0x239b12,_0xbd1168,_0x4a4c56,_0x5db4b0,_0x50dfb2);break;case _0x0a9e('0xc'):vtiger[_0xd5b662](_0x307b3e,_0x3ab53f,_0x239b12,_0xbd1168,_0x4a4c56,_0x5db4b0,_0x50dfb2);break;case _0x0a9e('0x1c'):freshsales['cs'](_0x307b3e,_0x3ab53f,_0x239b12,_0xbd1168,_0x4a4c56,_0x5db4b0,_0x50dfb2,_0xd5b662);case _0x0a9e('0xd'):servicenow['cs'](_0x307b3e,_0x3ab53f,_0x239b12,_0xbd1168,_0x4a4c56,_0x5db4b0,_0x50dfb2,_0xd5b662);break;case _0x0a9e('0x1d'):dynamics365['cs'](_0x307b3e,_0x3ab53f,_0x239b12,_0xbd1168,_0x4a4c56,_0x5db4b0,_0x50dfb2,_0xd5b662);break;default:console[_0x0a9e('0x17')](_0x0a9e('0x1e'));}}else{_0x36471c=require(_0x0a9e('0x1f'))(_0x307b3e[_0x0a9e('0x10')]['toLowerCase']());_0x36471c[_0x0a9e('0x20')](_0x0a9e('0x21'),util['format'](_0x0a9e('0x22'),_0x307b3e['data1']['toLowerCase'](),_0x307b3e[_0x0a9e('0x14')]));}}else{_0x36471c=require(_0x0a9e('0x1f'))(_0x307b3e[_0x0a9e('0x10')][_0x0a9e('0xf')]());_0x36471c['error'](_0x0a9e('0x21'),util[_0x0a9e('0x23')](_0x0a9e('0x24'),_0x307b3e[_0x0a9e('0x10')][_0x0a9e('0xf')](),_0x307b3e[_0x0a9e('0x11')]));}}else{}}catch(_0x16b1ca){console['error'](_0x16b1ca);}}}}; \ No newline at end of file +var _0xa9e0=['./vtiger','./servicenow','./dynamics365','./freshsales','salesforce','sugarcrm','freshdesk','vtiger','servicenow','exec','toLowerCase','data1','data2','find','Configurations','data3','queue','routeId','log','abandoned','zendesk','zoho','desk','freshsales','dynamics365','unknown\x20integration','../../../../config/logger','error','[EXEC]','%s\x20configuration\x20#%s\x20not\x20found','format','%s\x20account\x20#%s\x20not\x20found','lodash','util','./zendesk','./freshdesk','./desk'];(function(_0x408021,_0x2cd42c){var _0x2ac5de=function(_0x37beae){while(--_0x37beae){_0x408021['push'](_0x408021['shift']());}};_0x2ac5de(++_0x2cd42c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0xa9e0[_0x25bea7];return _0x175952;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var zendesk=require(_0x0a9e('0x2'));var salesforce=require('./salesforce');var sugarcrm=require('./sugarcrm');var freshdesk=require(_0x0a9e('0x3'));var zoho=require('./zoho');var desk=require(_0x0a9e('0x4'));var vtiger=require(_0x0a9e('0x5'));var servicenow=require(_0x0a9e('0x6'));var dynamics365=require(_0x0a9e('0x7'));var freshsales=require(_0x0a9e('0x8'));var integrations=['zendesk',_0x0a9e('0x9'),_0x0a9e('0xa'),_0x0a9e('0xb'),'zoho','desk',_0x0a9e('0xc'),'dynamics365','freshsales',_0x0a9e('0xd')];exports[_0x0a9e('0xe')]=function(_0x307b3e,_0x3ab53f,_0xfeb75b,_0xbd1168,_0x4a4c56,_0x50dfb2){if(_0xfeb75b){if(_['includes'](integrations,_0x307b3e['data1'][_0x0a9e('0xf')]())){try{var _0x36471c=null;var _0xd5b662='';var _0x26d672=_0xfeb75b[_0x307b3e[_0x0a9e('0x10')][_0x0a9e('0xf')]()];if(_0x26d672){var _0x5db4b0=_0x26d672[_0x307b3e[_0x0a9e('0x11')]];if(_0x5db4b0){var _0x239b12=_[_0x0a9e('0x12')](_0x5db4b0[_0x0a9e('0x13')],{'id':parseInt(_0x307b3e[_0x0a9e('0x14')],0xa)});if(_0x239b12){if(_0xbd1168){if(_0x4a4c56&&_0x3ab53f[_0x0a9e('0x15')]){_0xd5b662='queue';}else if(_0x3ab53f[_0x0a9e('0x16')]){_0xd5b662='outbound';}else{console[_0x0a9e('0x17')]('EVENT\x20UNKNOWN',_0x3ab53f);}}else{_0xd5b662=_0x0a9e('0x18');}switch(_0x307b3e[_0x0a9e('0x10')]['toLowerCase']()){case _0x0a9e('0x19'):zendesk[_0xd5b662](_0x307b3e,_0x3ab53f,_0x239b12,_0xbd1168,_0x4a4c56,_0x5db4b0,_0x50dfb2);break;case'salesforce':salesforce[_0xd5b662](_0x307b3e,_0x3ab53f,_0x239b12,_0xbd1168,_0x4a4c56,_0x5db4b0,_0x50dfb2);break;case _0x0a9e('0xa'):sugarcrm[_0xd5b662](_0x307b3e,_0x3ab53f,_0x239b12,_0xbd1168,_0x4a4c56,_0x5db4b0,_0x50dfb2);break;case _0x0a9e('0xb'):freshdesk[_0xd5b662](_0x307b3e,_0x3ab53f,_0x239b12,_0xbd1168,_0x4a4c56,_0x5db4b0,_0x50dfb2);break;case _0x0a9e('0x1a'):zoho[_0xd5b662](_0x307b3e,_0x3ab53f,_0x239b12,_0xbd1168,_0x4a4c56,_0x5db4b0,_0x50dfb2);break;case _0x0a9e('0x1b'):desk[_0xd5b662](_0x307b3e,_0x3ab53f,_0x239b12,_0xbd1168,_0x4a4c56,_0x5db4b0,_0x50dfb2);break;case _0x0a9e('0xc'):vtiger[_0xd5b662](_0x307b3e,_0x3ab53f,_0x239b12,_0xbd1168,_0x4a4c56,_0x5db4b0,_0x50dfb2);break;case _0x0a9e('0x1c'):freshsales['cs'](_0x307b3e,_0x3ab53f,_0x239b12,_0xbd1168,_0x4a4c56,_0x5db4b0,_0x50dfb2,_0xd5b662);case _0x0a9e('0xd'):servicenow['cs'](_0x307b3e,_0x3ab53f,_0x239b12,_0xbd1168,_0x4a4c56,_0x5db4b0,_0x50dfb2,_0xd5b662);break;case _0x0a9e('0x1d'):dynamics365['cs'](_0x307b3e,_0x3ab53f,_0x239b12,_0xbd1168,_0x4a4c56,_0x5db4b0,_0x50dfb2,_0xd5b662);break;default:console[_0x0a9e('0x17')](_0x0a9e('0x1e'));}}else{_0x36471c=require(_0x0a9e('0x1f'))(_0x307b3e[_0x0a9e('0x10')]['toLowerCase']());_0x36471c[_0x0a9e('0x20')](_0x0a9e('0x21'),util['format'](_0x0a9e('0x22'),_0x307b3e['data1']['toLowerCase'](),_0x307b3e[_0x0a9e('0x14')]));}}else{_0x36471c=require(_0x0a9e('0x1f'))(_0x307b3e[_0x0a9e('0x10')][_0x0a9e('0xf')]());_0x36471c['error'](_0x0a9e('0x21'),util[_0x0a9e('0x23')](_0x0a9e('0x24'),_0x307b3e[_0x0a9e('0x10')][_0x0a9e('0xf')](),_0x307b3e[_0x0a9e('0x11')]));}}else{}}catch(_0x16b1ca){console['error'](_0x16b1ca);}}}}; \ 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 cc8b6bb..bcbdb1e 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 _0xc0c4=['remoteUri','https://login.salesforce.com','clientId','clientSecret','login','username','Connection\x20established.','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridname','calleridnum','Fields','queue','[QUEUE]\x20Ticket\x20%s\x20created','integrationTab','user:%s','newTab','trigger:browser:url','%s/%s/e','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','stringify','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','Salesforce\x20account\x20type\x20not\x20recognized','abandoned','[ABANDONED]','Recording\x20is\x20enabled!','lodash','moment','bluebird','jsforce','util','ioredis','./util','../../../../config/environment','salesforce','redis','defaults','socket.io-emitter','emit','ticketType','Task','assign','getString','Subjects','Descriptions','WhoId','Case','isNil','validateEmail','sobject','User','find','execute','then','length','Email','info','Agent\x20%s\x20found.','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','user_id','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','Contact','Lead','contact','lead','Phone','Enduser\x20with\x20phone\x20%s\x20found.','Enduser\x20with\x20phone\x20%s\x20not\x20found.','','format','Caller\x20-\x20%s','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','Company','upperFirst','create','type','string','idField','content','toString','variable','variableName','customVariable','Variable','name','toLowerCase','concat','securityToken','Connection'];(function(_0x39aedf,_0x2f5df8){var _0x39356c=function(_0x1411c9){while(--_0x1411c9){_0x39aedf['push'](_0x39aedf['shift']());}};_0x39356c(++_0x2f5df8);}(_0xc0c4,0x97));var _0x4c0c=function(_0x11000e,_0x5853e1){_0x11000e=_0x11000e-0x0;var _0x217f44=_0xc0c4[_0x11000e];return _0x217f44;};'use strict';var _=require(_0x4c0c('0x0'));var rp=require('request-promise');var moment=require(_0x4c0c('0x1'));var BPromise=require(_0x4c0c('0x2'));var md5=require('md5');var jsforce=require(_0x4c0c('0x3'));var util=require(_0x4c0c('0x4'));var Redis=require(_0x4c0c('0x5'));var intUtil=require(_0x4c0c('0x6'));var config=require(_0x4c0c('0x7'));var logger=require('../../../../config/logger')(_0x4c0c('0x8'));config[_0x4c0c('0x9')]=_[_0x4c0c('0xa')](config[_0x4c0c('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0x4c0c('0xb'))(new Redis(config[_0x4c0c('0x9')]));function emit(_0xf25834,_0x3931d2,_0x26d0a8){io['to'](_0xf25834)[_0x4c0c('0xc')](_0x3931d2,_0x26d0a8);}function getTicket(_0x36f854,_0x373882,_0x33e46d,_0x3e8545,_0x12fdb2,_0x18fc54,_0xabe82a,_0x4da086){var _0x1a357a={};if(_0x3e8545[_0x4c0c('0xd')]===_0x4c0c('0xe')){_0x1a357a=Object[_0x4c0c('0xf')]({},{'OwnerId':_0x373882['id'],'ActivityDate':moment['utc'](),'IsReminderSet':![],'IsRecurrence':![],'Subject':intUtil[_0x4c0c('0x10')](_0x3e8545[_0x4c0c('0x11')],_0x12fdb2,'\x20'),'Description':intUtil[_0x4c0c('0x10')](_0x3e8545[_0x4c0c('0x12')],_0x12fdb2,'\x0a')},getCustomFields(_0x18fc54,_0x12fdb2));if(_0x33e46d){_0x1a357a[_0x4c0c('0x13')]=_0x33e46d['id'];}}else if(_0x3e8545['ticketType']===_0x4c0c('0x14')){_0x1a357a=Object[_0x4c0c('0xf')]({},{'OwnerId':_0x373882['id'],'Subject':intUtil[_0x4c0c('0x10')](_0x3e8545[_0x4c0c('0x11')],_0x12fdb2,'\x20'),'Description':intUtil[_0x4c0c('0x10')](_0x3e8545[_0x4c0c('0x12')],_0x12fdb2,'\x0a')},getCustomFields(_0x18fc54,_0x12fdb2));if(_0x33e46d){_0x1a357a['ContactId']=_0x33e46d['id'];}}return _0xabe82a['sobject'](_0x3e8545[_0x4c0c('0xd')])['create'](_0x1a357a);}function getUser(_0x32af71,_0x3c09ed,_0x2aefce){if(!_[_0x4c0c('0x15')](_0x3c09ed)&&intUtil[_0x4c0c('0x16')](_0x3c09ed)){var _0x52092c={'Email':_0x3c09ed};var _0x25dfa5={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x2aefce[_0x4c0c('0x17')](_0x4c0c('0x18'))[_0x4c0c('0x19')](_0x52092c,_0x25dfa5)[_0x4c0c('0x1a')]()[_0x4c0c('0x1b')](function(_0x2ad9fe){if(_0x2ad9fe[_0x4c0c('0x1c')]){var _0x1a144f=_[_0x4c0c('0x19')](_0x2ad9fe,function(_0x5efa29){return _0x5efa29[_0x4c0c('0x1d')]===_0x3c09ed;});if(_0x1a144f){logger[_0x4c0c('0x1e')](_0x4c0c('0x1f'),_0x3c09ed);return BPromise[_0x4c0c('0x20')]({'id':_0x1a144f['Id'],'name':_0x1a144f[_0x4c0c('0x21')]});}}else{logger[_0x4c0c('0x1e')](_0x4c0c('0x22'),_0x3c09ed);return _0x2aefce[_0x4c0c('0x23')]()[_0x4c0c('0x1b')](function(_0x3aec10){return BPromise['resolve']({'id':_0x3aec10[_0x4c0c('0x24')],'name':_0x3aec10['display_name']});});}});}else{logger[_0x4c0c('0x1e')](_0x4c0c('0x22'),_0x3c09ed);return _0x2aefce[_0x4c0c('0x23')]()[_0x4c0c('0x1b')](function(_0x5ad4cf){return BPromise[_0x4c0c('0x20')]({'id':_0x5ad4cf[_0x4c0c('0x24')],'name':_0x5ad4cf['display_name']});});}}function getEndUser(_0x3de284,_0x450488,_0x3f0277,_0x52aa8e,_0x190776){var _0x281661={'Phone':_0x52aa8e};var _0x39da97={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x4c0c('0x20')]()[_0x4c0c('0x1b')](function(){if(_0x450488['ticketType']===_0x4c0c('0xe')){logger[_0x4c0c('0x1e')](_0x4c0c('0x25'),_0x52aa8e,_0x450488[_0x4c0c('0x26')]);switch(_0x450488[_0x4c0c('0x26')]){case _0x4c0c('0x27'):return _0x190776[_0x4c0c('0x17')](_0x4c0c('0x28'))[_0x4c0c('0x19')](_0x281661,_0x39da97)[_0x4c0c('0x1a')]()[_0x4c0c('0x1b')](function(_0x42eac6){if(_0x42eac6&&_0x42eac6['length']){return _0x42eac6;}else{return _0x190776[_0x4c0c('0x17')](_0x4c0c('0x29'))[_0x4c0c('0x19')](_0x281661,_0x39da97);}});case _0x4c0c('0x2a'):return _0x190776[_0x4c0c('0x17')](_0x4c0c('0x28'))['find'](_0x281661,_0x39da97)['execute']();case _0x4c0c('0x2b'):return _0x190776[_0x4c0c('0x17')](_0x4c0c('0x29'))['find'](_0x281661,_0x39da97);default:return null;}}else if(_0x450488['ticketType']===_0x4c0c('0x14')){logger['info'](_0x4c0c('0x25'),_0x52aa8e,'contact');return _0x190776[_0x4c0c('0x17')](_0x4c0c('0x28'))[_0x4c0c('0x19')](_0x281661,_0x39da97)[_0x4c0c('0x1a')]();}})['then'](function(_0x3ae280){if(_0x3ae280&&_0x3ae280['length']){var _0xcc51c0=_[_0x4c0c('0x19')](_0x3ae280,function(_0x477fe1){return _0x477fe1[_0x4c0c('0x2c')]===_0x52aa8e;});if(_0xcc51c0){return BPromise[_0x4c0c('0x20')]({'id':_0xcc51c0['Id'],'name':_0xcc51c0[_0x4c0c('0x21')],'phone':_0xcc51c0[_0x4c0c('0x2c')]});}}})[_0x4c0c('0x1b')](function(_0x3a4f7c){if(_0x3a4f7c){logger[_0x4c0c('0x1e')](_0x4c0c('0x2d'),_0x52aa8e);return BPromise['resolve'](_0x3a4f7c);}else{logger[_0x4c0c('0x1e')](_0x4c0c('0x2e'),_0x52aa8e);var _0x3dc3c4={'LastName':_0x3f0277!==_0x4c0c('0x2f')?_0x3f0277:util[_0x4c0c('0x30')](_0x4c0c('0x31'),_0x52aa8e),'Phone':_0x52aa8e};if(_0x450488[_0x4c0c('0x32')]){if(_0x450488[_0x4c0c('0x32')]===_0x4c0c('0x2a')){logger['info'](_0x4c0c('0x33'),_0x52aa8e,_0x450488[_0x4c0c('0x32')]);}else if(_0x450488[_0x4c0c('0x32')]===_0x4c0c('0x2b')&&_0x450488[_0x4c0c('0xd')]==='Task'){logger['info'](_0x4c0c('0x33'),_0x52aa8e,_0x450488['moduleCreate']);_0x3dc3c4[_0x4c0c('0x34')]='No\x20Company';}else{return null;}}return _0x190776[_0x4c0c('0x17')](_[_0x4c0c('0x35')](_0x450488[_0x4c0c('0x32')]))[_0x4c0c('0x36')](_0x3dc3c4);}});}function getCustomFields(_0x460b34,_0x5cdb4d){var _0x82dd57={};if(_0x460b34[_0x4c0c('0x1c')]>0x0){_['forEach'](_0x460b34,function(_0x2b2e61){if(_0x2b2e61[_0x4c0c('0x37')]===_0x4c0c('0x38')&&_0x2b2e61[_0x4c0c('0x39')]){_0x82dd57[_0x2b2e61['idField']]=_0x2b2e61[_0x4c0c('0x3a')][_0x4c0c('0x3b')]();}else if(_0x2b2e61[_0x4c0c('0x37')]===_0x4c0c('0x3c')&&_0x2b2e61['variableName']&&_0x2b2e61['idField']){_0x5cdb4d[_0x2b2e61[_0x4c0c('0x3d')]]&&(_0x82dd57[_0x2b2e61[_0x4c0c('0x39')]]=_0x5cdb4d[_0x2b2e61[_0x4c0c('0x3d')]][_0x4c0c('0x3b')]());}else if(_0x2b2e61[_0x4c0c('0x37')]===_0x4c0c('0x3e')&&_0x2b2e61[_0x4c0c('0x3f')]&&_0x2b2e61[_0x4c0c('0x3f')]['name']&&_0x2b2e61[_0x4c0c('0x39')]){_0x5cdb4d[_0x2b2e61[_0x4c0c('0x3f')][_0x4c0c('0x40')][_0x4c0c('0x41')]()]&&(_0x82dd57[_0x2b2e61[_0x4c0c('0x39')]]=_0x5cdb4d[_0x2b2e61[_0x4c0c('0x3f')][_0x4c0c('0x40')][_0x4c0c('0x41')]()][_0x4c0c('0x3b')]());}});}return _0x82dd57;}function getConnection(_0x4fe174){var _0x4274bc=_0x4fe174['password'][_0x4c0c('0x42')](_0x4fe174[_0x4c0c('0x43')]);var _0x4fd563=new jsforce[(_0x4c0c('0x44'))]({'oauth2':{'loginUrl':_0x4fe174[_0x4c0c('0x45')]||_0x4c0c('0x46'),'clientId':_0x4fe174[_0x4c0c('0x47')],'clientSecret':_0x4fe174[_0x4c0c('0x48')]}});return _0x4fd563[_0x4c0c('0x49')](_0x4fe174[_0x4c0c('0x4a')],_0x4274bc)[_0x4c0c('0x1b')](function(){logger[_0x4c0c('0x1e')](_0x4c0c('0x4b'));return _0x4fd563;});}exports['queue']=function(_0x5ad806,_0x29dfa9,_0xd85515,_0x100869,_0x18c09f,_0x2ebf21){var _0x3321b5,_0x276d0a,_0x3229b9,_0x5a65da;_0x2ebf21['serverUrl']=intUtil[_0x4c0c('0x4c')](_0x2ebf21[_0x4c0c('0x4d')]);_0x2ebf21['remoteUri']=intUtil[_0x4c0c('0x4c')](_0x2ebf21[_0x4c0c('0x45')]);if(_0x18c09f&&_0x18c09f[_0x4c0c('0x4e')]){logger['info'](_0x4c0c('0x4f'),'Recording\x20is\x20enabled!');_0x29dfa9[_0x4c0c('0x50')]=util[_0x4c0c('0x30')](_0x4c0c('0x51'),_0x2ebf21[_0x4c0c('0x4d')],_0x29dfa9[_0x4c0c('0x52')],md5(_0x29dfa9[_0x4c0c('0x52')]));}else{_0x29dfa9[_0x4c0c('0x50')]='';}return getConnection(_0x2ebf21)[_0x4c0c('0x1b')](function(_0x52be1f){_0x5a65da=_0x52be1f;return getUser(_0x2ebf21,_0x100869[_0x4c0c('0x53')],_0x5a65da);})[_0x4c0c('0x1b')](function(_0x3391ed){_0x3321b5=_0x3391ed;return getEndUser(_0x2ebf21,_0xd85515,_0x29dfa9[_0x4c0c('0x54')],_0x29dfa9[_0x4c0c('0x55')],_0x5a65da);})[_0x4c0c('0x1b')](function(_0x227584){_0x276d0a=_0x227584;return getTicket(_0x2ebf21,_0x3321b5,_0x276d0a,_0xd85515,_0x29dfa9,_0xd85515[_0x4c0c('0x56')],_0x5a65da,_0x4c0c('0x57'));})[_0x4c0c('0x1b')](function(_0x1f0a38){_0x3229b9=_0x1f0a38;logger['info'](_0x4c0c('0x58'),_0x3229b9['id']);logger[_0x4c0c('0x1e')]('[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x3229b9['id'],_0x100869[_0x4c0c('0x40')],_0x2ebf21['type']);switch(_0x2ebf21[_0x4c0c('0x37')]){case _0x4c0c('0x59'):emit(util['format'](_0x4c0c('0x5a'),_0x100869['name']),'trigger:salesforce:display',{'recordId':_0x3229b9['id']});break;case _0x4c0c('0x5b'):emit(util[_0x4c0c('0x30')](_0x4c0c('0x5a'),_0x100869['name']),_0x4c0c('0x5c'),{'uri':util[_0x4c0c('0x30')](_0x4c0c('0x5d'),_0x5a65da[_0x4c0c('0x5e')],_0x3229b9['id'])});break;default:logger[_0x4c0c('0x5f')](_0x4c0c('0x60'));}})[_0x4c0c('0x61')](function(_0x2d13e1){logger[_0x4c0c('0x5f')](_0x4c0c('0x4f'),JSON[_0x4c0c('0x62')](_0x2d13e1));});};exports[_0x4c0c('0x63')]=function(_0x28f866,_0x46949b,_0x90318,_0x396b2e,_0x301ece,_0x31bbb7,_0x1562d0){var _0xf35304,_0x55e734,_0x24aa95,_0x3878b7;_0x31bbb7[_0x4c0c('0x4d')]=intUtil[_0x4c0c('0x4c')](_0x31bbb7[_0x4c0c('0x4d')]);_0x31bbb7[_0x4c0c('0x45')]=intUtil[_0x4c0c('0x4c')](_0x31bbb7[_0x4c0c('0x45')]);if(_0x1562d0&&_0x1562d0['recordingFormat']&&_0x1562d0[_0x4c0c('0x64')]!==_0x4c0c('0x65')){logger[_0x4c0c('0x1e')](_0x4c0c('0x66'),'Recording\x20is\x20enabled!');_0x46949b[_0x4c0c('0x50')]=util[_0x4c0c('0x30')](_0x4c0c('0x51'),_0x31bbb7[_0x4c0c('0x4d')],_0x46949b[_0x4c0c('0x52')],md5(_0x46949b['uniqueid']));}return getConnection(_0x31bbb7)[_0x4c0c('0x1b')](function(_0x3ad991){_0x3878b7=_0x3ad991;return getUser(_0x31bbb7,_0x396b2e[_0x4c0c('0x53')],_0x3878b7);})[_0x4c0c('0x1b')](function(_0x112001){_0xf35304=_0x112001;return getEndUser(_0x31bbb7,_0x90318,_0x46949b[_0x4c0c('0x67')],_0x46949b[_0x4c0c('0x68')],_0x3878b7);})['then'](function(_0x26ceb6){_0x55e734=_0x26ceb6;return getTicket(_0x31bbb7,_0xf35304,_0x55e734,_0x90318,_0x46949b,_0x90318[_0x4c0c('0x56')],_0x3878b7,_0x4c0c('0x63'));})[_0x4c0c('0x1b')](function(_0x1c1dc5){_0x24aa95=_0x1c1dc5;logger['info'](_0x4c0c('0x69'),_0x24aa95['id']);logger[_0x4c0c('0x1e')]('[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x24aa95['id'],_0x396b2e[_0x4c0c('0x40')],_0x31bbb7['type']);switch(_0x31bbb7[_0x4c0c('0x37')]){case _0x4c0c('0x59'):emit(util[_0x4c0c('0x30')]('user:%s',_0x396b2e[_0x4c0c('0x40')]),'trigger:salesforce:display',{'recordId':_0x24aa95['id']});break;case'newTab':emit(util[_0x4c0c('0x30')](_0x4c0c('0x5a'),_0x396b2e[_0x4c0c('0x40')]),_0x4c0c('0x5c'),{'uri':util['format'](_0x4c0c('0x5d'),_0x3878b7[_0x4c0c('0x5e')],_0x24aa95['id'])});break;default:logger['error']('[OUTBOUND]',_0x4c0c('0x6a'));}})[_0x4c0c('0x61')](function(_0x59500a){logger[_0x4c0c('0x5f')](_0x4c0c('0x66'),JSON[_0x4c0c('0x62')](_0x59500a));});};exports[_0x4c0c('0x6b')]=function(_0x47f6ef,_0x811ec9,_0x2b93f9,_0x20fe90,_0x6a81c1,_0x37b88b){var _0x462a7d,_0xcee810,_0xc5a169,_0x1f126b;_0x37b88b[_0x4c0c('0x4d')]=intUtil['stripTrailingSlash'](_0x37b88b['serverUrl']);_0x37b88b[_0x4c0c('0x45')]=intUtil[_0x4c0c('0x4c')](_0x37b88b[_0x4c0c('0x45')]);if(_0x6a81c1&&_0x6a81c1[_0x4c0c('0x4e')]){logger[_0x4c0c('0x1e')](_0x4c0c('0x6c'),_0x4c0c('0x6d'));_0x811ec9['recordingURL']=util[_0x4c0c('0x30')](_0x4c0c('0x51'),_0x37b88b['serverUrl'],_0x811ec9[_0x4c0c('0x52')],md5(_0x811ec9[_0x4c0c('0x52')]));}else{_0x811ec9[_0x4c0c('0x50')]='';}return getConnection(_0x37b88b)[_0x4c0c('0x1b')](function(_0x405ea5){_0x1f126b=_0x405ea5;if(!_[_0x4c0c('0x15')](_0x20fe90)){return getUser(_0x37b88b,_0x20fe90[_0x4c0c('0x40')],_0x1f126b);}else{return getUser(_0x37b88b,null,_0x1f126b);}})[_0x4c0c('0x1b')](function(_0x325881){_0x462a7d=_0x325881;return getEndUser(_0x37b88b,_0x2b93f9,_0x811ec9[_0x4c0c('0x54')],_0x811ec9['calleridnum'],_0x1f126b);})[_0x4c0c('0x1b')](function(_0x18cc80){_0xcee810=_0x18cc80;return getTicket(_0x37b88b,_0x462a7d,_0xcee810,_0x2b93f9,_0x811ec9,_0x2b93f9[_0x4c0c('0x56')],_0x1f126b);})['then'](function(_0x1102c7){_0xc5a169=_0x1102c7;logger[_0x4c0c('0x1e')]('[ABANDONED]\x20Ticket\x20%s\x20created.',_0xc5a169['id']);logger[_0x4c0c('0x1e')]('[ABANDONED]\x20Integration\x20account\x20type\x20%s.',_0x37b88b[_0x4c0c('0x37')]);})[_0x4c0c('0x61')](function(_0x216f89){logger[_0x4c0c('0x5f')](_0x4c0c('0x6c'),JSON[_0x4c0c('0x62')](_0x216f89));});}; \ No newline at end of file +var _0xaf31=['Variable','toLowerCase','name','password','concat','securityToken','Connection','remoteUri','https://login.salesforce.com','clientId','clientSecret','queue','serverUrl','stripTrailingSlash','monitor_format','Recording\x20is\x20enabled!','recordingURL','format','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','calleridname','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','trigger:salesforce:display','newTab','trigger:browser:url','%s/%s/e','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','[QUEUE]','stringify','outbound','recordingFormat','none','[OUTBOUND]','email','destcalleridname','destcalleridnum','Salesforce\x20account\x20type\x20not\x20recognized','abandoned','[ABANDONED]','calleridnum','[ABANDONED]\x20Ticket\x20%s\x20created.','[ABANDONED]\x20Integration\x20account\x20type\x20%s.','lodash','moment','bluebird','jsforce','ioredis','./util','../../../../config/environment','salesforce','redis','defaults','localhost','socket.io-emitter','emit','ticketType','Task','utc','Subjects','getString','Descriptions','WhoId','ContactId','sobject','create','isNil','validateEmail','User','find','execute','then','length','Email','info','resolve','Name','identity','user_id','display_name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','Contact','Lead','contact','Case','Phone','Enduser\x20with\x20phone\x20%s\x20not\x20found.','Caller\x20-\x20%s','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','lead','Company','No\x20Company','upperFirst','forEach','type','string','idField','content','toString','variableName'];(function(_0x22e11c,_0x32ef49){var _0x4fd8ed=function(_0x1098b7){while(--_0x1098b7){_0x22e11c['push'](_0x22e11c['shift']());}};_0x4fd8ed(++_0x32ef49);}(_0xaf31,0x174));var _0x1af3=function(_0x6cacb,_0x9a3c15){_0x6cacb=_0x6cacb-0x0;var _0x525e8f=_0xaf31[_0x6cacb];return _0x525e8f;};'use strict';var _=require(_0x1af3('0x0'));var rp=require('request-promise');var moment=require(_0x1af3('0x1'));var BPromise=require(_0x1af3('0x2'));var md5=require('md5');var jsforce=require(_0x1af3('0x3'));var util=require('util');var Redis=require(_0x1af3('0x4'));var intUtil=require(_0x1af3('0x5'));var config=require(_0x1af3('0x6'));var logger=require('../../../../config/logger')(_0x1af3('0x7'));config[_0x1af3('0x8')]=_[_0x1af3('0x9')](config[_0x1af3('0x8')],{'host':_0x1af3('0xa'),'port':0x18eb});var io=require(_0x1af3('0xb'))(new Redis(config[_0x1af3('0x8')]));function emit(_0x30bf63,_0x4f2bc2,_0xab2bfa){io['to'](_0x30bf63)[_0x1af3('0xc')](_0x4f2bc2,_0xab2bfa);}function getTicket(_0x121d76,_0x24743a,_0x20e7fb,_0x322d93,_0x42763d,_0x2cbea0,_0x106233,_0x1a0998){var _0xd12b74={};if(_0x322d93[_0x1af3('0xd')]===_0x1af3('0xe')){_0xd12b74=Object['assign']({},{'OwnerId':_0x24743a['id'],'ActivityDate':moment[_0x1af3('0xf')](),'IsReminderSet':![],'IsRecurrence':![],'Subject':intUtil['getString'](_0x322d93[_0x1af3('0x10')],_0x42763d,'\x20'),'Description':intUtil[_0x1af3('0x11')](_0x322d93[_0x1af3('0x12')],_0x42763d,'\x0a')},getCustomFields(_0x2cbea0,_0x42763d));if(_0x20e7fb){_0xd12b74[_0x1af3('0x13')]=_0x20e7fb['id'];}}else if(_0x322d93[_0x1af3('0xd')]==='Case'){_0xd12b74=Object['assign']({},{'OwnerId':_0x24743a['id'],'Subject':intUtil['getString'](_0x322d93[_0x1af3('0x10')],_0x42763d,'\x20'),'Description':intUtil[_0x1af3('0x11')](_0x322d93['Descriptions'],_0x42763d,'\x0a')},getCustomFields(_0x2cbea0,_0x42763d));if(_0x20e7fb){_0xd12b74[_0x1af3('0x14')]=_0x20e7fb['id'];}}return _0x106233[_0x1af3('0x15')](_0x322d93[_0x1af3('0xd')])[_0x1af3('0x16')](_0xd12b74);}function getUser(_0x9f7765,_0x3157a7,_0x472272){if(!_[_0x1af3('0x17')](_0x3157a7)&&intUtil[_0x1af3('0x18')](_0x3157a7)){var _0x56d1e6={'Email':_0x3157a7};var _0x341f44={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x472272[_0x1af3('0x15')](_0x1af3('0x19'))[_0x1af3('0x1a')](_0x56d1e6,_0x341f44)[_0x1af3('0x1b')]()[_0x1af3('0x1c')](function(_0x5a03c9){if(_0x5a03c9[_0x1af3('0x1d')]){var _0x3a86b9=_[_0x1af3('0x1a')](_0x5a03c9,function(_0x2bef3c){return _0x2bef3c[_0x1af3('0x1e')]===_0x3157a7;});if(_0x3a86b9){logger[_0x1af3('0x1f')]('Agent\x20%s\x20found.',_0x3157a7);return BPromise[_0x1af3('0x20')]({'id':_0x3a86b9['Id'],'name':_0x3a86b9[_0x1af3('0x21')]});}}else{logger['info']('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x3157a7);return _0x472272[_0x1af3('0x22')]()[_0x1af3('0x1c')](function(_0x3261e7){return BPromise[_0x1af3('0x20')]({'id':_0x3261e7[_0x1af3('0x23')],'name':_0x3261e7[_0x1af3('0x24')]});});}});}else{logger['info'](_0x1af3('0x25'),_0x3157a7);return _0x472272[_0x1af3('0x22')]()['then'](function(_0x2b69c6){return BPromise['resolve']({'id':_0x2b69c6[_0x1af3('0x23')],'name':_0x2b69c6[_0x1af3('0x24')]});});}}function getEndUser(_0xfe8869,_0x2fa95b,_0x30e4c9,_0x74f23d,_0x1bbf06){var _0x155b61={'Phone':_0x74f23d};var _0x26d1f3={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x1af3('0x20')]()[_0x1af3('0x1c')](function(){if(_0x2fa95b[_0x1af3('0xd')]==='Task'){logger[_0x1af3('0x1f')](_0x1af3('0x26'),_0x74f23d,_0x2fa95b[_0x1af3('0x27')]);switch(_0x2fa95b[_0x1af3('0x27')]){case'contact_lead':return _0x1bbf06[_0x1af3('0x15')](_0x1af3('0x28'))[_0x1af3('0x1a')](_0x155b61,_0x26d1f3)[_0x1af3('0x1b')]()[_0x1af3('0x1c')](function(_0x52157f){if(_0x52157f&&_0x52157f[_0x1af3('0x1d')]){return _0x52157f;}else{return _0x1bbf06[_0x1af3('0x15')](_0x1af3('0x29'))['find'](_0x155b61,_0x26d1f3);}});case _0x1af3('0x2a'):return _0x1bbf06[_0x1af3('0x15')]('Contact')[_0x1af3('0x1a')](_0x155b61,_0x26d1f3)[_0x1af3('0x1b')]();case'lead':return _0x1bbf06[_0x1af3('0x15')](_0x1af3('0x29'))[_0x1af3('0x1a')](_0x155b61,_0x26d1f3);default:return null;}}else if(_0x2fa95b[_0x1af3('0xd')]===_0x1af3('0x2b')){logger[_0x1af3('0x1f')](_0x1af3('0x26'),_0x74f23d,_0x1af3('0x2a'));return _0x1bbf06[_0x1af3('0x15')](_0x1af3('0x28'))[_0x1af3('0x1a')](_0x155b61,_0x26d1f3)[_0x1af3('0x1b')]();}})[_0x1af3('0x1c')](function(_0x18261d){if(_0x18261d&&_0x18261d[_0x1af3('0x1d')]){var _0x462165=_[_0x1af3('0x1a')](_0x18261d,function(_0x40ee23){return _0x40ee23[_0x1af3('0x2c')]===_0x74f23d;});if(_0x462165){return BPromise[_0x1af3('0x20')]({'id':_0x462165['Id'],'name':_0x462165[_0x1af3('0x21')],'phone':_0x462165[_0x1af3('0x2c')]});}}})[_0x1af3('0x1c')](function(_0x18750d){if(_0x18750d){logger[_0x1af3('0x1f')]('Enduser\x20with\x20phone\x20%s\x20found.',_0x74f23d);return BPromise[_0x1af3('0x20')](_0x18750d);}else{logger[_0x1af3('0x1f')](_0x1af3('0x2d'),_0x74f23d);var _0x1569d5={'LastName':_0x30e4c9!==''?_0x30e4c9:util['format'](_0x1af3('0x2e'),_0x74f23d),'Phone':_0x74f23d};if(_0x2fa95b[_0x1af3('0x2f')]){if(_0x2fa95b[_0x1af3('0x2f')]===_0x1af3('0x2a')){logger[_0x1af3('0x1f')](_0x1af3('0x30'),_0x74f23d,_0x2fa95b[_0x1af3('0x2f')]);}else if(_0x2fa95b['moduleCreate']===_0x1af3('0x31')&&_0x2fa95b[_0x1af3('0xd')]===_0x1af3('0xe')){logger[_0x1af3('0x1f')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x74f23d,_0x2fa95b[_0x1af3('0x2f')]);_0x1569d5[_0x1af3('0x32')]=_0x1af3('0x33');}else{return null;}}return _0x1bbf06[_0x1af3('0x15')](_[_0x1af3('0x34')](_0x2fa95b[_0x1af3('0x2f')]))[_0x1af3('0x16')](_0x1569d5);}});}function getCustomFields(_0x4d5328,_0x323ec8){var _0x4cfe53={};if(_0x4d5328[_0x1af3('0x1d')]>0x0){_[_0x1af3('0x35')](_0x4d5328,function(_0x1b75cc){if(_0x1b75cc[_0x1af3('0x36')]===_0x1af3('0x37')&&_0x1b75cc[_0x1af3('0x38')]){_0x4cfe53[_0x1b75cc[_0x1af3('0x38')]]=_0x1b75cc[_0x1af3('0x39')][_0x1af3('0x3a')]();}else if(_0x1b75cc['type']==='variable'&&_0x1b75cc[_0x1af3('0x3b')]&&_0x1b75cc[_0x1af3('0x38')]){_0x323ec8[_0x1b75cc[_0x1af3('0x3b')]]&&(_0x4cfe53[_0x1b75cc['idField']]=_0x323ec8[_0x1b75cc[_0x1af3('0x3b')]][_0x1af3('0x3a')]());}else if(_0x1b75cc['type']==='customVariable'&&_0x1b75cc[_0x1af3('0x3c')]&&_0x1b75cc[_0x1af3('0x3c')]['name']&&_0x1b75cc['idField']){_0x323ec8[_0x1b75cc[_0x1af3('0x3c')]['name'][_0x1af3('0x3d')]()]&&(_0x4cfe53[_0x1b75cc[_0x1af3('0x38')]]=_0x323ec8[_0x1b75cc[_0x1af3('0x3c')][_0x1af3('0x3e')]['toLowerCase']()]['toString']());}});}return _0x4cfe53;}function getConnection(_0x228843){var _0x236ac8=_0x228843[_0x1af3('0x3f')][_0x1af3('0x40')](_0x228843[_0x1af3('0x41')]);var _0x502a18=new jsforce[(_0x1af3('0x42'))]({'oauth2':{'loginUrl':_0x228843[_0x1af3('0x43')]||_0x1af3('0x44'),'clientId':_0x228843[_0x1af3('0x45')],'clientSecret':_0x228843[_0x1af3('0x46')]}});return _0x502a18['login'](_0x228843['username'],_0x236ac8)[_0x1af3('0x1c')](function(){logger['info']('Connection\x20established.');return _0x502a18;});}exports[_0x1af3('0x47')]=function(_0x101f71,_0x40037a,_0xb8c826,_0x54a9dd,_0x41f598,_0xc0e487){var _0x28e1ab,_0xd27fbf,_0x259daf,_0x6526bf;_0xc0e487[_0x1af3('0x48')]=intUtil['stripTrailingSlash'](_0xc0e487[_0x1af3('0x48')]);_0xc0e487[_0x1af3('0x43')]=intUtil[_0x1af3('0x49')](_0xc0e487[_0x1af3('0x43')]);if(_0x41f598&&_0x41f598[_0x1af3('0x4a')]){logger[_0x1af3('0x1f')]('[QUEUE]',_0x1af3('0x4b'));_0x40037a[_0x1af3('0x4c')]=util[_0x1af3('0x4d')](_0x1af3('0x4e'),_0xc0e487[_0x1af3('0x48')],_0x40037a[_0x1af3('0x4f')],md5(_0x40037a[_0x1af3('0x4f')]));}else{_0x40037a['recordingURL']='';}return getConnection(_0xc0e487)[_0x1af3('0x1c')](function(_0x2f5ebd){_0x6526bf=_0x2f5ebd;return getUser(_0xc0e487,_0x54a9dd['email'],_0x6526bf);})[_0x1af3('0x1c')](function(_0x152bf4){_0x28e1ab=_0x152bf4;return getEndUser(_0xc0e487,_0xb8c826,_0x40037a[_0x1af3('0x50')],_0x40037a['calleridnum'],_0x6526bf);})[_0x1af3('0x1c')](function(_0x3788cd){_0xd27fbf=_0x3788cd;return getTicket(_0xc0e487,_0x28e1ab,_0xd27fbf,_0xb8c826,_0x40037a,_0xb8c826['Fields'],_0x6526bf,_0x1af3('0x47'));})[_0x1af3('0x1c')](function(_0x139d97){_0x259daf=_0x139d97;logger[_0x1af3('0x1f')](_0x1af3('0x51'),_0x259daf['id']);logger['info'](_0x1af3('0x52'),_0x259daf['id'],_0x54a9dd[_0x1af3('0x3e')],_0xc0e487[_0x1af3('0x36')]);switch(_0xc0e487['type']){case _0x1af3('0x53'):emit(util['format'](_0x1af3('0x54'),_0x54a9dd[_0x1af3('0x3e')]),_0x1af3('0x55'),{'recordId':_0x259daf['id']});break;case _0x1af3('0x56'):emit(util['format']('user:%s',_0x54a9dd[_0x1af3('0x3e')]),_0x1af3('0x57'),{'uri':util[_0x1af3('0x4d')](_0x1af3('0x58'),_0x6526bf[_0x1af3('0x59')],_0x259daf['id'])});break;default:logger[_0x1af3('0x5a')](_0x1af3('0x5b'));}})[_0x1af3('0x5c')](function(_0x5e4127){logger[_0x1af3('0x5a')](_0x1af3('0x5d'),JSON[_0x1af3('0x5e')](_0x5e4127));});};exports[_0x1af3('0x5f')]=function(_0x48dc54,_0x408ebb,_0x41ca98,_0x416d1e,_0x14fe83,_0x118eca,_0x9a592a){var _0x5be297,_0x447120,_0x169e03,_0x20bb3d;_0x118eca[_0x1af3('0x48')]=intUtil['stripTrailingSlash'](_0x118eca[_0x1af3('0x48')]);_0x118eca[_0x1af3('0x43')]=intUtil[_0x1af3('0x49')](_0x118eca['remoteUri']);if(_0x9a592a&&_0x9a592a[_0x1af3('0x60')]&&_0x9a592a[_0x1af3('0x60')]!==_0x1af3('0x61')){logger[_0x1af3('0x1f')](_0x1af3('0x62'),'Recording\x20is\x20enabled!');_0x408ebb['recordingURL']=util[_0x1af3('0x4d')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x118eca[_0x1af3('0x48')],_0x408ebb[_0x1af3('0x4f')],md5(_0x408ebb['uniqueid']));}return getConnection(_0x118eca)[_0x1af3('0x1c')](function(_0x6d9818){_0x20bb3d=_0x6d9818;return getUser(_0x118eca,_0x416d1e[_0x1af3('0x63')],_0x20bb3d);})['then'](function(_0x4285fc){_0x5be297=_0x4285fc;return getEndUser(_0x118eca,_0x41ca98,_0x408ebb[_0x1af3('0x64')],_0x408ebb[_0x1af3('0x65')],_0x20bb3d);})[_0x1af3('0x1c')](function(_0x310bd6){_0x447120=_0x310bd6;return getTicket(_0x118eca,_0x5be297,_0x447120,_0x41ca98,_0x408ebb,_0x41ca98['Fields'],_0x20bb3d,_0x1af3('0x5f'));})[_0x1af3('0x1c')](function(_0x3dd02d){_0x169e03=_0x3dd02d;logger['info']('[OUTBOUND]\x20Ticket\x20%s\x20created.',_0x169e03['id']);logger[_0x1af3('0x1f')]('[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x169e03['id'],_0x416d1e[_0x1af3('0x3e')],_0x118eca[_0x1af3('0x36')]);switch(_0x118eca[_0x1af3('0x36')]){case _0x1af3('0x53'):emit(util['format'](_0x1af3('0x54'),_0x416d1e[_0x1af3('0x3e')]),_0x1af3('0x55'),{'recordId':_0x169e03['id']});break;case _0x1af3('0x56'):emit(util[_0x1af3('0x4d')](_0x1af3('0x54'),_0x416d1e[_0x1af3('0x3e')]),'trigger:browser:url',{'uri':util[_0x1af3('0x4d')](_0x1af3('0x58'),_0x20bb3d['instanceUrl'],_0x169e03['id'])});break;default:logger[_0x1af3('0x5a')](_0x1af3('0x62'),_0x1af3('0x66'));}})[_0x1af3('0x5c')](function(_0x5226f1){logger[_0x1af3('0x5a')](_0x1af3('0x62'),JSON['stringify'](_0x5226f1));});};exports[_0x1af3('0x67')]=function(_0x573aa6,_0x27b750,_0x890ebd,_0x33bc45,_0x4f244d,_0x3b34a1){var _0x2e63cd,_0x10f9d1,_0x1586ba,_0xf72941;_0x3b34a1[_0x1af3('0x48')]=intUtil[_0x1af3('0x49')](_0x3b34a1[_0x1af3('0x48')]);_0x3b34a1['remoteUri']=intUtil[_0x1af3('0x49')](_0x3b34a1[_0x1af3('0x43')]);if(_0x4f244d&&_0x4f244d['monitor_format']){logger[_0x1af3('0x1f')](_0x1af3('0x68'),_0x1af3('0x4b'));_0x27b750[_0x1af3('0x4c')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3b34a1[_0x1af3('0x48')],_0x27b750[_0x1af3('0x4f')],md5(_0x27b750['uniqueid']));}else{_0x27b750[_0x1af3('0x4c')]='';}return getConnection(_0x3b34a1)[_0x1af3('0x1c')](function(_0x15b90){_0xf72941=_0x15b90;if(!_[_0x1af3('0x17')](_0x33bc45)){return getUser(_0x3b34a1,_0x33bc45[_0x1af3('0x3e')],_0xf72941);}else{return getUser(_0x3b34a1,null,_0xf72941);}})[_0x1af3('0x1c')](function(_0x46a385){_0x2e63cd=_0x46a385;return getEndUser(_0x3b34a1,_0x890ebd,_0x27b750[_0x1af3('0x50')],_0x27b750[_0x1af3('0x69')],_0xf72941);})['then'](function(_0x4b652e){_0x10f9d1=_0x4b652e;return getTicket(_0x3b34a1,_0x2e63cd,_0x10f9d1,_0x890ebd,_0x27b750,_0x890ebd['Fields'],_0xf72941);})[_0x1af3('0x1c')](function(_0x2ede93){_0x1586ba=_0x2ede93;logger['info'](_0x1af3('0x6a'),_0x1586ba['id']);logger[_0x1af3('0x1f')](_0x1af3('0x6b'),_0x3b34a1[_0x1af3('0x36')]);})[_0x1af3('0x5c')](function(_0x14382a){logger[_0x1af3('0x5a')](_0x1af3('0x68'),JSON[_0x1af3('0x5e')](_0x14382a));});}; \ 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 6b21db0..b7c70dd 100644 --- a/server/services/ami/trigger/integration/servicenow.js +++ b/server/services/ami/trigger/integration/servicenow.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','then','],\x20getUser\x20entity','userId','adminEmail','],\x20getUser\x20crm','catch','],\x20createEndUser\x20input\x20crm','POST','sys_user?','user','endUserNumber','true','System','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','length','forEach','type','customField','idField','content','toString','toLowerCase','variable','variableName','Variable','name',']\x20getTicket\x20input\x20crm','outbound','incident','assign','getString','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema',']\x20getTicket\x20crm','label','Incident','ticketId','Incident\x20-\x20','ticketNumber','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','emit','trigger:browser:url','password','sysparm_limit=1','sysparm_display_value=true','serverUrl','stripTrailingSlash','%s/api/now/table/','remoteUri','email','destcalleridnum','calleridnum','queue','abandoned','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','[OUTBOUND]','recordingURL','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s',']\x20Error\x20running\x20ServiceNow\x20integration','lodash','bluebird','request-promise','ioredis','../../../../config/environment','../../../../config/logger','servicenow','redis','defaults','localhost','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','adminId','result','sys_id','info','toUpperCase','],\x20getAdminUser\x20crm','error','message'];(function(_0x33032e,_0x31411a){var _0x13316b=function(_0x2fb049){while(--_0x2fb049){_0x33032e['push'](_0x33032e['shift']());}};_0x13316b(++_0x31411a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0xa9e0[_0x110c3d];return _0x226d67;};'use strict';var _=require(_0x0a9e('0x0'));var Promise=require(_0x0a9e('0x1'));var rp=require(_0x0a9e('0x2'));var util=require('util');var md5=require('md5');var Redis=require(_0x0a9e('0x3'));var intUtil=require('./util');var config=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));config[_0x0a9e('0x7')]=_[_0x0a9e('0x8')](config['redis'],{'host':_0x0a9e('0x9'),'port':0x18eb});var io=require(_0x0a9e('0xa'))(new Redis(config[_0x0a9e('0x7')]));function getAdminUser(_0x5f41ea,_0x503809,_0xe42b77,_0x56465b,_0x52cace,_0x39753a){return new Promise(function(_0xf81284,_0x307b3e){var _0x3ab53f={'method':_0x0a9e('0xb'),'uri':_0x56465b+_0x0a9e('0xc')+'&'+_0x52cace+'&'+_0x39753a,'auth':_0x503809,'json':!![]};return rp(_0x3ab53f)['then'](function(_0x50dfb2){if(_0x50dfb2['result']['length']>0x0){_0xe42b77[_0x0a9e('0xd')]=_0x50dfb2[_0x0a9e('0xe')][0x0][_0x0a9e('0xf')];}logger[_0x0a9e('0x10')]('['+[_0x5f41ea[_0x0a9e('0x11')]()]+_0x0a9e('0x12'),_0xe42b77);_0xf81284(_0xe42b77);})['catch'](function(_0x4283ce){logger[_0x0a9e('0x13')]('['+[_0x5f41ea[_0x0a9e('0x11')]()]+']',_0x4283ce[_0x0a9e('0x14')]);_0x307b3e(_0x4283ce[_0x0a9e('0x14')]);});});}function getUser(_0x4d5611,_0x52a03d,_0x22dccb,_0x5d0880,_0x1985b6){return function(_0x519dfd){logger[_0x0a9e('0x10')]('['+[_0x4d5611[_0x0a9e('0x11')]()]+'],\x20getUser\x20input\x20crm',_0x519dfd);return new Promise(function(_0x225616,_0x5a0a06){if(intUtil[_0x0a9e('0x15')](_0x519dfd[_0x0a9e('0x16')])){var _0x106033={'method':_0x0a9e('0xb'),'uri':_0x22dccb+_0x0a9e('0x17')+_0x519dfd[_0x0a9e('0x16')]+'&'+_0x5d0880+'&'+_0x1985b6,'auth':_0x52a03d,'json':!![]};logger[_0x0a9e('0x10')]('['+[_0x4d5611[_0x0a9e('0x11')]()]+_0x0a9e('0x18'),_0x106033);return rp(_0x106033)[_0x0a9e('0x19')](function(_0x1c696a){logger[_0x0a9e('0x10')]('['+[_0x4d5611['toUpperCase']()]+_0x0a9e('0x1a'),_0x1c696a);if(_0x1c696a[_0x0a9e('0xe')]['length']>0x0&&String(_0x1c696a[_0x0a9e('0xe')][0x0]['active'])==='true'){_0x519dfd[_0x0a9e('0x1b')]=_0x1c696a[_0x0a9e('0xe')][0x0][_0x0a9e('0xf')];}else{_0x519dfd[_0x0a9e('0x1b')]=_0x519dfd['adminId'];_0x519dfd[_0x0a9e('0x16')]=_0x519dfd[_0x0a9e('0x1c')];}logger[_0x0a9e('0x10')]('['+[_0x4d5611[_0x0a9e('0x11')]()]+_0x0a9e('0x1d'),_0x519dfd);_0x225616(_0x519dfd);})[_0x0a9e('0x1e')](function(_0x16b1ca){logger['error']('['+[_0x4d5611['toUpperCase']()]+']',_0x16b1ca[_0x0a9e('0x14')]);_0x5a0a06(_0x16b1ca[_0x0a9e('0x14')]);});}else{logger[_0x0a9e('0x10')]('['+[_0x4d5611[_0x0a9e('0x11')]()]+']\x20using\x20admin\x20profile');_0x519dfd[_0x0a9e('0x1b')]=_0x519dfd['adminId'];_0x519dfd[_0x0a9e('0x16')]=_0x519dfd['adminEmail'];_0x225616(_0x519dfd);}});};}function createEndUser(_0x1dc186,_0x34dc65,_0x25fba9,_0x14433c,_0x140511){logger[_0x0a9e('0x10')]('['+[_0x1dc186[_0x0a9e('0x11')]()]+_0x0a9e('0x1f'),_0x25fba9);return new Promise(function(_0x5a101a,_0x3652a7){var _0x468813={'method':_0x0a9e('0x20'),'uri':_0x14433c+_0x0a9e('0x21')+_0x140511,'body':{'user_name':_0x25fba9['endUserNumber'],'roles':_0x0a9e('0x22'),'first_name':_0x25fba9[_0x0a9e('0x23')],'active':_0x0a9e('0x24'),'date_format':_0x0a9e('0x25'),'phone':_0x25fba9[_0x0a9e('0x23')]},'auth':_0x34dc65,'json':!![]};return rp(_0x468813)[_0x0a9e('0x19')](function(_0x296f41){logger[_0x0a9e('0x10')]('['+[_0x1dc186[_0x0a9e('0x11')]()]+'],\x20EndUser\x20schema',_0x296f41[_0x0a9e('0xe')]);_0x25fba9['endUserId']=_0x296f41[_0x0a9e('0xe')][_0x0a9e('0xf')];_0x5a101a(_0x25fba9);})[_0x0a9e('0x1e')](function(_0x33bdb7){logger[_0x0a9e('0x13')]('['+[_0x1dc186['toUpperCase']()]+']',_0x33bdb7[_0x0a9e('0x14')]);_0x3652a7(_0x33bdb7[_0x0a9e('0x14')]);});});}function getEndUser(_0x40cb85,_0x2da5c0,_0x2b45ea,_0x409319,_0x332d35){return function(_0x39e565){logger['info']('['+[_0x40cb85[_0x0a9e('0x11')]()]+'],\x20getEndUser\x20input\x20crm',_0x39e565);return new Promise(function(_0x2cc7a0,_0x14b13f){var _0x2b7e7f={'method':_0x0a9e('0xb'),'uri':_0x2b45ea+'sys_user?sysparm_query=phone%3D'+_0x39e565[_0x0a9e('0x23')]+'&'+_0x409319+'&'+_0x332d35,'auth':_0x2da5c0,'json':!![]};return rp(_0x2b7e7f)[_0x0a9e('0x19')](function(_0x1fa90d){if(_0x1fa90d[_0x0a9e('0xe')]['length']>0x0){_0x39e565['endUserId']=_0x1fa90d[_0x0a9e('0xe')][0x0]['sys_id'];logger[_0x0a9e('0x10')]('['+[_0x40cb85[_0x0a9e('0x11')]()]+_0x0a9e('0x26'),_0x39e565);_0x2cc7a0(_0x39e565);}else{return createEndUser(_0x40cb85,_0x2da5c0,_0x39e565,_0x2b45ea,_0x409319)[_0x0a9e('0x19')](function(_0x4f41ae){logger[_0x0a9e('0x10')]('['+[_0x40cb85[_0x0a9e('0x11')]()]+_0x0a9e('0x27'),_0x4f41ae);_0x2cc7a0(_0x4f41ae);});}})['catch'](function(_0x1dbf74){logger[_0x0a9e('0x13')]('['+[_0x40cb85[_0x0a9e('0x11')]()]+']',_0x1dbf74['message']);_0x14b13f(_0x1dbf74['message']);});});};}function getCustomFields(_0x11b61d,_0x40d766){var _0x5adda1={};if(_0x11b61d[_0x0a9e('0x28')]>0x0){_[_0x0a9e('0x29')](_0x11b61d,function(_0x2e1b3a){if(_0x2e1b3a[_0x0a9e('0x2a')]==='string'&&_0x2e1b3a['nameField']&&!_0x2e1b3a[_0x0a9e('0x2b')]){_0x5adda1[_0x2e1b3a[_0x0a9e('0x2c')]['toLowerCase']()]=_0x2e1b3a[_0x0a9e('0x2d')][_0x0a9e('0x2e')]();}else if(_0x2e1b3a[_0x0a9e('0x2a')]==='string'&&_0x2e1b3a[_0x0a9e('0x2c')]&&_0x2e1b3a[_0x0a9e('0x2b')]){_0x5adda1[_0x2e1b3a[_0x0a9e('0x2c')][_0x0a9e('0x2f')]()]=_0x2e1b3a[_0x0a9e('0x2d')][_0x0a9e('0x2e')]();}else if(_0x2e1b3a[_0x0a9e('0x2a')]===_0x0a9e('0x30')&&_0x2e1b3a[_0x0a9e('0x31')]&&_0x2e1b3a[_0x0a9e('0x2c')]&&_0x2e1b3a[_0x0a9e('0x2b')]){_0x5adda1[_0x2e1b3a[_0x0a9e('0x2c')][_0x0a9e('0x2f')]()]=_0x40d766[_0x2e1b3a[_0x0a9e('0x31')]][_0x0a9e('0x2e')]();}else if(_0x2e1b3a['type']==='customVariable'&&_0x2e1b3a[_0x0a9e('0x32')]&&_0x2e1b3a[_0x0a9e('0x32')][_0x0a9e('0x33')]&&_0x2e1b3a[_0x0a9e('0x2c')]&&_0x2e1b3a[_0x0a9e('0x2b')]){_0x5adda1[_0x2e1b3a[_0x0a9e('0x2c')][_0x0a9e('0x2f')]()]=_0x40d766[_0x2e1b3a[_0x0a9e('0x32')][_0x0a9e('0x33')][_0x0a9e('0x2f')]()][_0x0a9e('0x2e')]();}});}return _0x5adda1;}function getTicket(_0x35ed4a,_0x5026aa,_0x117c99,_0x138b8b,_0xdd268f,_0xfbd5ad){return function(_0x2e8caf){logger[_0x0a9e('0x10')]('['+[_0x35ed4a[_0x0a9e('0x11')]()]+_0x0a9e('0x34'),_0x2e8caf);return new Promise(function(_0x59afe8,_0x2e9d90){var _0x48fd45=_0x35ed4a[_0x0a9e('0x2f')]()===_0x0a9e('0x35')?_0x2e8caf[_0x0a9e('0x1b')]:_0x2e8caf['endUserId'];var _0x14bec2={'method':_0x0a9e('0x20'),'uri':_0x117c99+_0x0a9e('0x36')+'?'+_0xfbd5ad,'body':Object[_0x0a9e('0x37')]({},{'active':_0x0a9e('0x24'),'caller_id':_0x48fd45,'assigned_to':_0x2e8caf[_0x0a9e('0x1b')],'short_description':intUtil[_0x0a9e('0x38')](_0x138b8b['Subjects'],_0xdd268f,'\x20'),'description':intUtil[_0x0a9e('0x38')](_0x138b8b[_0x0a9e('0x39')],_0xdd268f,'\x0a')},getCustomFields(_0x138b8b[_0x0a9e('0x3a')],_0xdd268f)),'auth':_0x5026aa,'json':!![]};return rp(_0x14bec2)[_0x0a9e('0x19')](function(_0x409789){logger[_0x0a9e('0x10')]('['+[_0x35ed4a[_0x0a9e('0x11')]()]+_0x0a9e('0x3b'),_0x409789[_0x0a9e('0xe')]);_0x2e8caf['ticketId']=_0x409789[_0x0a9e('0xe')][_0x0a9e('0xf')];_0x2e8caf['ticketNumber']=_0x409789['result']['number'];logger[_0x0a9e('0x10')]('['+[_0x35ed4a[_0x0a9e('0x11')]()]+_0x0a9e('0x3c'),_0x2e8caf);_0x59afe8(_0x2e8caf);})[_0x0a9e('0x1e')](function(_0x61bb17){logger[_0x0a9e('0x13')]('['+[_0x35ed4a[_0x0a9e('0x11')]()]+']',_0x61bb17[_0x0a9e('0x14')]);_0x2e9d90(_0x61bb17['message']);});});};}function createRemoteTag(_0x4b1b9f,_0x53975a,_0x39d77d,_0x204173){return new Promise(function(_0x14d602,_0x5bb3ed){var _0x2b69d9={'method':_0x0a9e('0x20'),'uri':_0x39d77d+'label'+'?'+_0x204173,'body':{'short_description':_0x4b1b9f,'global':!![],'active':!![],'name':_0x4b1b9f},'auth':_0x53975a,'json':!![]};return rp(_0x2b69d9)['then'](function(_0x2ef381){var _0x59c6ff=_0x2ef381[_0x0a9e('0xe')]['sys_id'];_0x14d602(_0x59c6ff);});});}function getRemoteTag(_0x2e5e62,_0x3c20b2,_0x439340,_0x53613a,_0x2f82da){return new Promise(function(_0x1bf38a,_0x508b47){var _0x50f687={'method':_0x0a9e('0xb'),'uri':_0x439340+_0x0a9e('0x3d')+'?sysparm_query=name%3D'+_0x2e5e62+'&'+_0x53613a,'auth':_0x3c20b2,'json':!![]};return rp(_0x50f687)[_0x0a9e('0x19')](function(_0x5ce9ac){if(_0x5ce9ac[_0x0a9e('0xe')]['length']>0x0){var _0xe22ccc=_0x5ce9ac['result'][0x0]['sys_id'];_0x1bf38a(_0xe22ccc);}else{return createRemoteTag(_0x2e5e62,_0x3c20b2,_0x439340,_0x53613a)['then'](function(_0x2da03c){_0x1bf38a(_0x2da03c);});}});});}function assignTagToIncident(_0x47de4c,_0x2f7092,_0x65432,_0x3cfd00,_0x19b4df){return new Promise(function(_0x232830,_0x272738){var _0xd10662={'method':_0x0a9e('0x20'),'uri':_0x65432+'label_entry'+'?'+_0x19b4df,'body':{'label':_0x47de4c,'table':_0x0a9e('0x36'),'id_type':_0x0a9e('0x3e'),'table_key':_0x3cfd00[_0x0a9e('0x3f')],'title':_0x0a9e('0x40')+_0x3cfd00[_0x0a9e('0x41')],'id_display':_0x3cfd00[_0x0a9e('0x41')]},'auth':_0x2f7092,'json':!![]};return rp(_0xd10662)['then'](function(_0x956fbe){_0x232830();})[_0x0a9e('0x1e')](function(){_0x232830();});});}function manageTags(_0x5239ef,_0x3649cc,_0x5cc8fb,_0x20c668,_0x5ba1f9,_0x4b3c1a,_0x5674ee){return new Promise(function(_0x273cb5,_0x49d231){var _0x2244d6=[];_0x3649cc[_0x0a9e('0x29')](function(_0x261adb){_0x2244d6[_0x0a9e('0x42')](getRemoteTag(_0x261adb,_0x5cc8fb,_0x20c668,_0x4b3c1a,_0x5674ee));});return Promise[_0x0a9e('0x43')](_0x2244d6)[_0x0a9e('0x19')](function(_0x49eed0){if(_0x49eed0[_0x0a9e('0x28')]){logger['info']('['+[_0x5239ef[_0x0a9e('0x11')]()]+_0x0a9e('0x44'),_0x49eed0);var _0x51aaf7=[];_0x49eed0['forEach'](function(_0x453360){_0x51aaf7[_0x0a9e('0x42')](assignTagToIncident(_0x453360,_0x5cc8fb,_0x20c668,_0x5ba1f9,_0x4b3c1a));});return Promise[_0x0a9e('0x43')](_0x51aaf7)[_0x0a9e('0x19')](function(){_0x273cb5();})['catch'](function(){_0x273cb5();});}else{_0x273cb5();}});});}function getTags(_0x1d0dc8,_0xe05a5a,_0x54327c,_0x797b45,_0x17e88c,_0x88dcbf){return function(_0x409b29){return new Promise(function(_0x401837,_0x4d4a35){var _0x176840=[];var _0x2937e0=_0x797b45[_0x0a9e('0x45')];if(_0x2937e0&&_0x2937e0['length']>0x0){_0x176840=_[_0x0a9e('0x46')](_0x2937e0,'name');}if(_0x176840['length']>0x0){return manageTags(_0x1d0dc8,_0x176840,_0xe05a5a,_0x54327c,_0x409b29,_0x17e88c,_0x88dcbf)[_0x0a9e('0x19')](function(){_0x401837(_0x409b29);});}else{_0x401837(_0x409b29);}});};}function emit(_0x4556c5,_0x9375fb,_0x19c995){var _0x186f39=_0x0a9e('0x47')+_0x0a9e('0x48')+_0x0a9e('0x49')+_0x0a9e('0x4a');var _0x1cc4f3={'uri':_0x4556c5+_0x0a9e('0x4b')+_0x19c995+_0x186f39};io['to'](util[_0x0a9e('0x4c')](_0x0a9e('0x4d'),_0x9375fb))[_0x0a9e('0x4e')](_0x0a9e('0x4f'),_0x1cc4f3);}exports['cs']=function(_0x412a72,_0x2a28c0,_0x4257c9,_0x5150a4,_0x1b0b98,_0x295763,_0x243d12,_0x4edbb0){var _0x1148a1={};var _0x30944e={'user':_0x295763['username'],'pass':_0x295763[_0x0a9e('0x50')]};var _0x56e31e=_0x0a9e('0x51');var _0x427946=_0x0a9e('0x52');_0x295763['remoteUri']=intUtil['stripTrailingSlash'](_0x295763['remoteUri']);_0x295763[_0x0a9e('0x53')]=intUtil[_0x0a9e('0x54')](_0x295763[_0x0a9e('0x53')]);var _0x23a7d3=util[_0x0a9e('0x4c')](_0x0a9e('0x55'),_0x295763[_0x0a9e('0x56')]);_0x1148a1[_0x0a9e('0x16')]=!_['isNil'](_0x5150a4)?_0x5150a4[_0x0a9e('0x57')]:null;_0x1148a1[_0x0a9e('0x1c')]=_0x295763[_0x0a9e('0x57')];_0x1148a1['endUserNumber']=_0x4edbb0[_0x0a9e('0x2f')]()==='outbound'?_0x2a28c0[_0x0a9e('0x58')]:_0x2a28c0[_0x0a9e('0x59')];_0x1148a1['callDirection']=_0x4edbb0===_0x0a9e('0x5a')||_0x4edbb0===_0x0a9e('0x5b')?_0x0a9e('0x5a'):_0x0a9e('0x35');var _0x542ece=util[_0x0a9e('0x4c')](_0x0a9e('0x5c'),_0x295763[_0x0a9e('0x53')],_0x2a28c0[_0x0a9e('0x5d')],md5(_0x2a28c0['uniqueid']));if(_0x1b0b98&&_0x1b0b98[_0x0a9e('0x5e')]){logger[_0x0a9e('0x10')](_0x0a9e('0x5f'),_0x0a9e('0x60'));_0x2a28c0['recordingURL']=_0x542ece;}else if(_0x243d12&&_0x243d12[_0x0a9e('0x61')]&&_0x243d12[_0x0a9e('0x61')]!==_0x0a9e('0x62')){logger[_0x0a9e('0x10')](_0x0a9e('0x63'),_0x0a9e('0x60'));_0x2a28c0[_0x0a9e('0x64')]=_0x542ece;}else{_0x2a28c0[_0x0a9e('0x64')]='';}return getAdminUser(_0x4edbb0,_0x30944e,_0x1148a1,_0x23a7d3,_0x427946,_0x56e31e)[_0x0a9e('0x19')](getUser(_0x4edbb0,_0x30944e,_0x23a7d3,_0x427946,_0x56e31e))[_0x0a9e('0x19')](getEndUser(_0x4edbb0,_0x30944e,_0x23a7d3,_0x427946,_0x56e31e))[_0x0a9e('0x19')](getTicket(_0x4edbb0,_0x30944e,_0x23a7d3,_0x4257c9,_0x2a28c0,_0x427946))[_0x0a9e('0x19')](function(_0x25744a){logger[_0x0a9e('0x10')](util['format'](_0x0a9e('0x65'),_0x25744a[_0x0a9e('0x3f')]));logger[_0x0a9e('0x10')](util['format'](_0x0a9e('0x66'),_0x4edbb0));if(_0x4edbb0!==_0x0a9e('0x5b')){logger[_0x0a9e('0x10')]('['+[_0x4edbb0[_0x0a9e('0x11')]()]+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x295763['remoteUri'],_0x5150a4[_0x0a9e('0x33')],_0x25744a[_0x0a9e('0x3f')]);}})['catch'](function(_0x45108c){logger['error']('['+[_0x4edbb0[_0x0a9e('0x11')]()]+_0x0a9e('0x67'),util['inspect'](_0x45108c,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xa9e0=['validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','then','],\x20getUser\x20entity','userId','adminEmail','],\x20getUser\x20crm','catch','],\x20createEndUser\x20input\x20crm','POST','sys_user?','user','endUserNumber','true','System','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','length','forEach','type','customField','idField','content','toString','toLowerCase','variable','variableName','Variable','name',']\x20getTicket\x20input\x20crm','outbound','incident','assign','getString','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema',']\x20getTicket\x20crm','label','Incident','ticketId','Incident\x20-\x20','ticketNumber','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','emit','trigger:browser:url','password','sysparm_limit=1','sysparm_display_value=true','serverUrl','stripTrailingSlash','%s/api/now/table/','remoteUri','email','destcalleridnum','calleridnum','queue','abandoned','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','[OUTBOUND]','recordingURL','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s',']\x20Error\x20running\x20ServiceNow\x20integration','lodash','bluebird','request-promise','ioredis','../../../../config/environment','../../../../config/logger','servicenow','redis','defaults','localhost','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','adminId','result','sys_id','info','toUpperCase','],\x20getAdminUser\x20crm','error','message'];(function(_0x3054be,_0x1bdc8b){var _0x3df150=function(_0x56cfbf){while(--_0x56cfbf){_0x3054be['push'](_0x3054be['shift']());}};_0x3df150(++_0x1bdc8b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0xa9e0[_0x134c2e];return _0x2825db;};'use strict';var _=require(_0x0a9e('0x0'));var Promise=require(_0x0a9e('0x1'));var rp=require(_0x0a9e('0x2'));var util=require('util');var md5=require('md5');var Redis=require(_0x0a9e('0x3'));var intUtil=require('./util');var config=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));config[_0x0a9e('0x7')]=_[_0x0a9e('0x8')](config['redis'],{'host':_0x0a9e('0x9'),'port':0x18eb});var io=require(_0x0a9e('0xa'))(new Redis(config[_0x0a9e('0x7')]));function getAdminUser(_0x5f41ea,_0x503809,_0xe42b77,_0x56465b,_0x52cace,_0x39753a){return new Promise(function(_0xf81284,_0x307b3e){var _0x3ab53f={'method':_0x0a9e('0xb'),'uri':_0x56465b+_0x0a9e('0xc')+'&'+_0x52cace+'&'+_0x39753a,'auth':_0x503809,'json':!![]};return rp(_0x3ab53f)['then'](function(_0x50dfb2){if(_0x50dfb2['result']['length']>0x0){_0xe42b77[_0x0a9e('0xd')]=_0x50dfb2[_0x0a9e('0xe')][0x0][_0x0a9e('0xf')];}logger[_0x0a9e('0x10')]('['+[_0x5f41ea[_0x0a9e('0x11')]()]+_0x0a9e('0x12'),_0xe42b77);_0xf81284(_0xe42b77);})['catch'](function(_0x4283ce){logger[_0x0a9e('0x13')]('['+[_0x5f41ea[_0x0a9e('0x11')]()]+']',_0x4283ce[_0x0a9e('0x14')]);_0x307b3e(_0x4283ce[_0x0a9e('0x14')]);});});}function getUser(_0x4d5611,_0x52a03d,_0x22dccb,_0x5d0880,_0x1985b6){return function(_0x519dfd){logger[_0x0a9e('0x10')]('['+[_0x4d5611[_0x0a9e('0x11')]()]+'],\x20getUser\x20input\x20crm',_0x519dfd);return new Promise(function(_0x225616,_0x5a0a06){if(intUtil[_0x0a9e('0x15')](_0x519dfd[_0x0a9e('0x16')])){var _0x106033={'method':_0x0a9e('0xb'),'uri':_0x22dccb+_0x0a9e('0x17')+_0x519dfd[_0x0a9e('0x16')]+'&'+_0x5d0880+'&'+_0x1985b6,'auth':_0x52a03d,'json':!![]};logger[_0x0a9e('0x10')]('['+[_0x4d5611[_0x0a9e('0x11')]()]+_0x0a9e('0x18'),_0x106033);return rp(_0x106033)[_0x0a9e('0x19')](function(_0x1c696a){logger[_0x0a9e('0x10')]('['+[_0x4d5611['toUpperCase']()]+_0x0a9e('0x1a'),_0x1c696a);if(_0x1c696a[_0x0a9e('0xe')]['length']>0x0&&String(_0x1c696a[_0x0a9e('0xe')][0x0]['active'])==='true'){_0x519dfd[_0x0a9e('0x1b')]=_0x1c696a[_0x0a9e('0xe')][0x0][_0x0a9e('0xf')];}else{_0x519dfd[_0x0a9e('0x1b')]=_0x519dfd['adminId'];_0x519dfd[_0x0a9e('0x16')]=_0x519dfd[_0x0a9e('0x1c')];}logger[_0x0a9e('0x10')]('['+[_0x4d5611[_0x0a9e('0x11')]()]+_0x0a9e('0x1d'),_0x519dfd);_0x225616(_0x519dfd);})[_0x0a9e('0x1e')](function(_0x16b1ca){logger['error']('['+[_0x4d5611['toUpperCase']()]+']',_0x16b1ca[_0x0a9e('0x14')]);_0x5a0a06(_0x16b1ca[_0x0a9e('0x14')]);});}else{logger[_0x0a9e('0x10')]('['+[_0x4d5611[_0x0a9e('0x11')]()]+']\x20using\x20admin\x20profile');_0x519dfd[_0x0a9e('0x1b')]=_0x519dfd['adminId'];_0x519dfd[_0x0a9e('0x16')]=_0x519dfd['adminEmail'];_0x225616(_0x519dfd);}});};}function createEndUser(_0x1dc186,_0x34dc65,_0x25fba9,_0x14433c,_0x140511){logger[_0x0a9e('0x10')]('['+[_0x1dc186[_0x0a9e('0x11')]()]+_0x0a9e('0x1f'),_0x25fba9);return new Promise(function(_0x5a101a,_0x3652a7){var _0x468813={'method':_0x0a9e('0x20'),'uri':_0x14433c+_0x0a9e('0x21')+_0x140511,'body':{'user_name':_0x25fba9['endUserNumber'],'roles':_0x0a9e('0x22'),'first_name':_0x25fba9[_0x0a9e('0x23')],'active':_0x0a9e('0x24'),'date_format':_0x0a9e('0x25'),'phone':_0x25fba9[_0x0a9e('0x23')]},'auth':_0x34dc65,'json':!![]};return rp(_0x468813)[_0x0a9e('0x19')](function(_0x296f41){logger[_0x0a9e('0x10')]('['+[_0x1dc186[_0x0a9e('0x11')]()]+'],\x20EndUser\x20schema',_0x296f41[_0x0a9e('0xe')]);_0x25fba9['endUserId']=_0x296f41[_0x0a9e('0xe')][_0x0a9e('0xf')];_0x5a101a(_0x25fba9);})[_0x0a9e('0x1e')](function(_0x33bdb7){logger[_0x0a9e('0x13')]('['+[_0x1dc186['toUpperCase']()]+']',_0x33bdb7[_0x0a9e('0x14')]);_0x3652a7(_0x33bdb7[_0x0a9e('0x14')]);});});}function getEndUser(_0x40cb85,_0x2da5c0,_0x2b45ea,_0x409319,_0x332d35){return function(_0x39e565){logger['info']('['+[_0x40cb85[_0x0a9e('0x11')]()]+'],\x20getEndUser\x20input\x20crm',_0x39e565);return new Promise(function(_0x2cc7a0,_0x14b13f){var _0x2b7e7f={'method':_0x0a9e('0xb'),'uri':_0x2b45ea+'sys_user?sysparm_query=phone%3D'+_0x39e565[_0x0a9e('0x23')]+'&'+_0x409319+'&'+_0x332d35,'auth':_0x2da5c0,'json':!![]};return rp(_0x2b7e7f)[_0x0a9e('0x19')](function(_0x1fa90d){if(_0x1fa90d[_0x0a9e('0xe')]['length']>0x0){_0x39e565['endUserId']=_0x1fa90d[_0x0a9e('0xe')][0x0]['sys_id'];logger[_0x0a9e('0x10')]('['+[_0x40cb85[_0x0a9e('0x11')]()]+_0x0a9e('0x26'),_0x39e565);_0x2cc7a0(_0x39e565);}else{return createEndUser(_0x40cb85,_0x2da5c0,_0x39e565,_0x2b45ea,_0x409319)[_0x0a9e('0x19')](function(_0x4f41ae){logger[_0x0a9e('0x10')]('['+[_0x40cb85[_0x0a9e('0x11')]()]+_0x0a9e('0x27'),_0x4f41ae);_0x2cc7a0(_0x4f41ae);});}})['catch'](function(_0x1dbf74){logger[_0x0a9e('0x13')]('['+[_0x40cb85[_0x0a9e('0x11')]()]+']',_0x1dbf74['message']);_0x14b13f(_0x1dbf74['message']);});});};}function getCustomFields(_0x11b61d,_0x40d766){var _0x5adda1={};if(_0x11b61d[_0x0a9e('0x28')]>0x0){_[_0x0a9e('0x29')](_0x11b61d,function(_0x2e1b3a){if(_0x2e1b3a[_0x0a9e('0x2a')]==='string'&&_0x2e1b3a['nameField']&&!_0x2e1b3a[_0x0a9e('0x2b')]){_0x5adda1[_0x2e1b3a[_0x0a9e('0x2c')]['toLowerCase']()]=_0x2e1b3a[_0x0a9e('0x2d')][_0x0a9e('0x2e')]();}else if(_0x2e1b3a[_0x0a9e('0x2a')]==='string'&&_0x2e1b3a[_0x0a9e('0x2c')]&&_0x2e1b3a[_0x0a9e('0x2b')]){_0x5adda1[_0x2e1b3a[_0x0a9e('0x2c')][_0x0a9e('0x2f')]()]=_0x2e1b3a[_0x0a9e('0x2d')][_0x0a9e('0x2e')]();}else if(_0x2e1b3a[_0x0a9e('0x2a')]===_0x0a9e('0x30')&&_0x2e1b3a[_0x0a9e('0x31')]&&_0x2e1b3a[_0x0a9e('0x2c')]&&_0x2e1b3a[_0x0a9e('0x2b')]){_0x5adda1[_0x2e1b3a[_0x0a9e('0x2c')][_0x0a9e('0x2f')]()]=_0x40d766[_0x2e1b3a[_0x0a9e('0x31')]][_0x0a9e('0x2e')]();}else if(_0x2e1b3a['type']==='customVariable'&&_0x2e1b3a[_0x0a9e('0x32')]&&_0x2e1b3a[_0x0a9e('0x32')][_0x0a9e('0x33')]&&_0x2e1b3a[_0x0a9e('0x2c')]&&_0x2e1b3a[_0x0a9e('0x2b')]){_0x5adda1[_0x2e1b3a[_0x0a9e('0x2c')][_0x0a9e('0x2f')]()]=_0x40d766[_0x2e1b3a[_0x0a9e('0x32')][_0x0a9e('0x33')][_0x0a9e('0x2f')]()][_0x0a9e('0x2e')]();}});}return _0x5adda1;}function getTicket(_0x35ed4a,_0x5026aa,_0x117c99,_0x138b8b,_0xdd268f,_0xfbd5ad){return function(_0x2e8caf){logger[_0x0a9e('0x10')]('['+[_0x35ed4a[_0x0a9e('0x11')]()]+_0x0a9e('0x34'),_0x2e8caf);return new Promise(function(_0x59afe8,_0x2e9d90){var _0x48fd45=_0x35ed4a[_0x0a9e('0x2f')]()===_0x0a9e('0x35')?_0x2e8caf[_0x0a9e('0x1b')]:_0x2e8caf['endUserId'];var _0x14bec2={'method':_0x0a9e('0x20'),'uri':_0x117c99+_0x0a9e('0x36')+'?'+_0xfbd5ad,'body':Object[_0x0a9e('0x37')]({},{'active':_0x0a9e('0x24'),'caller_id':_0x48fd45,'assigned_to':_0x2e8caf[_0x0a9e('0x1b')],'short_description':intUtil[_0x0a9e('0x38')](_0x138b8b['Subjects'],_0xdd268f,'\x20'),'description':intUtil[_0x0a9e('0x38')](_0x138b8b[_0x0a9e('0x39')],_0xdd268f,'\x0a')},getCustomFields(_0x138b8b[_0x0a9e('0x3a')],_0xdd268f)),'auth':_0x5026aa,'json':!![]};return rp(_0x14bec2)[_0x0a9e('0x19')](function(_0x409789){logger[_0x0a9e('0x10')]('['+[_0x35ed4a[_0x0a9e('0x11')]()]+_0x0a9e('0x3b'),_0x409789[_0x0a9e('0xe')]);_0x2e8caf['ticketId']=_0x409789[_0x0a9e('0xe')][_0x0a9e('0xf')];_0x2e8caf['ticketNumber']=_0x409789['result']['number'];logger[_0x0a9e('0x10')]('['+[_0x35ed4a[_0x0a9e('0x11')]()]+_0x0a9e('0x3c'),_0x2e8caf);_0x59afe8(_0x2e8caf);})[_0x0a9e('0x1e')](function(_0x61bb17){logger[_0x0a9e('0x13')]('['+[_0x35ed4a[_0x0a9e('0x11')]()]+']',_0x61bb17[_0x0a9e('0x14')]);_0x2e9d90(_0x61bb17['message']);});});};}function createRemoteTag(_0x4b1b9f,_0x53975a,_0x39d77d,_0x204173){return new Promise(function(_0x14d602,_0x5bb3ed){var _0x2b69d9={'method':_0x0a9e('0x20'),'uri':_0x39d77d+'label'+'?'+_0x204173,'body':{'short_description':_0x4b1b9f,'global':!![],'active':!![],'name':_0x4b1b9f},'auth':_0x53975a,'json':!![]};return rp(_0x2b69d9)['then'](function(_0x2ef381){var _0x59c6ff=_0x2ef381[_0x0a9e('0xe')]['sys_id'];_0x14d602(_0x59c6ff);});});}function getRemoteTag(_0x2e5e62,_0x3c20b2,_0x439340,_0x53613a,_0x2f82da){return new Promise(function(_0x1bf38a,_0x508b47){var _0x50f687={'method':_0x0a9e('0xb'),'uri':_0x439340+_0x0a9e('0x3d')+'?sysparm_query=name%3D'+_0x2e5e62+'&'+_0x53613a,'auth':_0x3c20b2,'json':!![]};return rp(_0x50f687)[_0x0a9e('0x19')](function(_0x5ce9ac){if(_0x5ce9ac[_0x0a9e('0xe')]['length']>0x0){var _0xe22ccc=_0x5ce9ac['result'][0x0]['sys_id'];_0x1bf38a(_0xe22ccc);}else{return createRemoteTag(_0x2e5e62,_0x3c20b2,_0x439340,_0x53613a)['then'](function(_0x2da03c){_0x1bf38a(_0x2da03c);});}});});}function assignTagToIncident(_0x47de4c,_0x2f7092,_0x65432,_0x3cfd00,_0x19b4df){return new Promise(function(_0x232830,_0x272738){var _0xd10662={'method':_0x0a9e('0x20'),'uri':_0x65432+'label_entry'+'?'+_0x19b4df,'body':{'label':_0x47de4c,'table':_0x0a9e('0x36'),'id_type':_0x0a9e('0x3e'),'table_key':_0x3cfd00[_0x0a9e('0x3f')],'title':_0x0a9e('0x40')+_0x3cfd00[_0x0a9e('0x41')],'id_display':_0x3cfd00[_0x0a9e('0x41')]},'auth':_0x2f7092,'json':!![]};return rp(_0xd10662)['then'](function(_0x956fbe){_0x232830();})[_0x0a9e('0x1e')](function(){_0x232830();});});}function manageTags(_0x5239ef,_0x3649cc,_0x5cc8fb,_0x20c668,_0x5ba1f9,_0x4b3c1a,_0x5674ee){return new Promise(function(_0x273cb5,_0x49d231){var _0x2244d6=[];_0x3649cc[_0x0a9e('0x29')](function(_0x261adb){_0x2244d6[_0x0a9e('0x42')](getRemoteTag(_0x261adb,_0x5cc8fb,_0x20c668,_0x4b3c1a,_0x5674ee));});return Promise[_0x0a9e('0x43')](_0x2244d6)[_0x0a9e('0x19')](function(_0x49eed0){if(_0x49eed0[_0x0a9e('0x28')]){logger['info']('['+[_0x5239ef[_0x0a9e('0x11')]()]+_0x0a9e('0x44'),_0x49eed0);var _0x51aaf7=[];_0x49eed0['forEach'](function(_0x453360){_0x51aaf7[_0x0a9e('0x42')](assignTagToIncident(_0x453360,_0x5cc8fb,_0x20c668,_0x5ba1f9,_0x4b3c1a));});return Promise[_0x0a9e('0x43')](_0x51aaf7)[_0x0a9e('0x19')](function(){_0x273cb5();})['catch'](function(){_0x273cb5();});}else{_0x273cb5();}});});}function getTags(_0x1d0dc8,_0xe05a5a,_0x54327c,_0x797b45,_0x17e88c,_0x88dcbf){return function(_0x409b29){return new Promise(function(_0x401837,_0x4d4a35){var _0x176840=[];var _0x2937e0=_0x797b45[_0x0a9e('0x45')];if(_0x2937e0&&_0x2937e0['length']>0x0){_0x176840=_[_0x0a9e('0x46')](_0x2937e0,'name');}if(_0x176840['length']>0x0){return manageTags(_0x1d0dc8,_0x176840,_0xe05a5a,_0x54327c,_0x409b29,_0x17e88c,_0x88dcbf)[_0x0a9e('0x19')](function(){_0x401837(_0x409b29);});}else{_0x401837(_0x409b29);}});};}function emit(_0x4556c5,_0x9375fb,_0x19c995){var _0x186f39=_0x0a9e('0x47')+_0x0a9e('0x48')+_0x0a9e('0x49')+_0x0a9e('0x4a');var _0x1cc4f3={'uri':_0x4556c5+_0x0a9e('0x4b')+_0x19c995+_0x186f39};io['to'](util[_0x0a9e('0x4c')](_0x0a9e('0x4d'),_0x9375fb))[_0x0a9e('0x4e')](_0x0a9e('0x4f'),_0x1cc4f3);}exports['cs']=function(_0x412a72,_0x2a28c0,_0x4257c9,_0x5150a4,_0x1b0b98,_0x295763,_0x243d12,_0x4edbb0){var _0x1148a1={};var _0x30944e={'user':_0x295763['username'],'pass':_0x295763[_0x0a9e('0x50')]};var _0x56e31e=_0x0a9e('0x51');var _0x427946=_0x0a9e('0x52');_0x295763['remoteUri']=intUtil['stripTrailingSlash'](_0x295763['remoteUri']);_0x295763[_0x0a9e('0x53')]=intUtil[_0x0a9e('0x54')](_0x295763[_0x0a9e('0x53')]);var _0x23a7d3=util[_0x0a9e('0x4c')](_0x0a9e('0x55'),_0x295763[_0x0a9e('0x56')]);_0x1148a1[_0x0a9e('0x16')]=!_['isNil'](_0x5150a4)?_0x5150a4[_0x0a9e('0x57')]:null;_0x1148a1[_0x0a9e('0x1c')]=_0x295763[_0x0a9e('0x57')];_0x1148a1['endUserNumber']=_0x4edbb0[_0x0a9e('0x2f')]()==='outbound'?_0x2a28c0[_0x0a9e('0x58')]:_0x2a28c0[_0x0a9e('0x59')];_0x1148a1['callDirection']=_0x4edbb0===_0x0a9e('0x5a')||_0x4edbb0===_0x0a9e('0x5b')?_0x0a9e('0x5a'):_0x0a9e('0x35');var _0x542ece=util[_0x0a9e('0x4c')](_0x0a9e('0x5c'),_0x295763[_0x0a9e('0x53')],_0x2a28c0[_0x0a9e('0x5d')],md5(_0x2a28c0['uniqueid']));if(_0x1b0b98&&_0x1b0b98[_0x0a9e('0x5e')]){logger[_0x0a9e('0x10')](_0x0a9e('0x5f'),_0x0a9e('0x60'));_0x2a28c0['recordingURL']=_0x542ece;}else if(_0x243d12&&_0x243d12[_0x0a9e('0x61')]&&_0x243d12[_0x0a9e('0x61')]!==_0x0a9e('0x62')){logger[_0x0a9e('0x10')](_0x0a9e('0x63'),_0x0a9e('0x60'));_0x2a28c0[_0x0a9e('0x64')]=_0x542ece;}else{_0x2a28c0[_0x0a9e('0x64')]='';}return getAdminUser(_0x4edbb0,_0x30944e,_0x1148a1,_0x23a7d3,_0x427946,_0x56e31e)[_0x0a9e('0x19')](getUser(_0x4edbb0,_0x30944e,_0x23a7d3,_0x427946,_0x56e31e))[_0x0a9e('0x19')](getEndUser(_0x4edbb0,_0x30944e,_0x23a7d3,_0x427946,_0x56e31e))[_0x0a9e('0x19')](getTicket(_0x4edbb0,_0x30944e,_0x23a7d3,_0x4257c9,_0x2a28c0,_0x427946))[_0x0a9e('0x19')](function(_0x25744a){logger[_0x0a9e('0x10')](util['format'](_0x0a9e('0x65'),_0x25744a[_0x0a9e('0x3f')]));logger[_0x0a9e('0x10')](util['format'](_0x0a9e('0x66'),_0x4edbb0));if(_0x4edbb0!==_0x0a9e('0x5b')){logger[_0x0a9e('0x10')]('['+[_0x4edbb0[_0x0a9e('0x11')]()]+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x295763['remoteUri'],_0x5150a4[_0x0a9e('0x33')],_0x25744a[_0x0a9e('0x3f')]);}})['catch'](function(_0x45108c){logger['error']('['+[_0x4edbb0[_0x0a9e('0x11')]()]+_0x0a9e('0x67'),util['inspect'](_0x45108c,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/sugarcrm.js b/server/services/ami/trigger/integration/sugarcrm.js index 348dd1e..65cac1f 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 _0x69af=['contacts','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','trigger:browser:url','error','[QUEUE]','outbound','recordingFormat','[OUTBOUND]','destcalleridname','destcalleridnum','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','catch','abandoned','[ABANDONED]','The\x20User\x20ID\x20is:','Inbound','lodash','bluebird','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','sugarcrm','redis','localhost','socket.io-emitter','POST','emit','info','Creating\x20new\x20ticket...','name','getString','Subjects','assigned_user_id','description','Descriptions','slice','replace','duration_minutes','parent_id','parent_type','Contacts','parent_name','direction','length','forEach','variableName','push','idField','set_entry','JSON','Calls','Basic\x20%s','apiKey','toString','base64','get_server_info','isNil','Getting\x20agent\x20with\x20name','get_entry_list','stringify','Employees','format','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','entry_list','name_value_list','value','Agent\x20found!','resolve','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Caller\x20-\x20%s','Enduser\x20created.','first_name','debug','[HTTP]','merge','type','string','nameField','customField','toLowerCase','custom_fields','content','variable','customVariable','Variable','login','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','queue','remoteUri','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','calleridname','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users'];(function(_0x3bb854,_0x2fa23e){var _0x2ea95e=function(_0x1a367f){while(--_0x1a367f){_0x3bb854['push'](_0x3bb854['shift']());}};_0x2ea95e(++_0x2fa23e);}(_0x69af,0x182));var _0xf69a=function(_0x4a925f,_0x3de657){_0x4a925f=_0x4a925f-0x0;var _0x327688=_0x69af[_0x4a925f];return _0x327688;};'use strict';var _=require(_0xf69a('0x0'));var rp=require('request-promise');var BPromise=require(_0xf69a('0x1'));var md5=require(_0xf69a('0x2'));var util=require(_0xf69a('0x3'));var Redis=require(_0xf69a('0x4'));var intUtil=require(_0xf69a('0x5'));var config=require(_0xf69a('0x6'));var logger=require(_0xf69a('0x7'))(_0xf69a('0x8'));config[_0xf69a('0x9')]=_['defaults'](config[_0xf69a('0x9')],{'host':_0xf69a('0xa'),'port':0x18eb});var io=require(_0xf69a('0xb'))(new Redis(config[_0xf69a('0x9')]));var def={'method':_0xf69a('0xc'),'json':!![]};function emit(_0x64b64e,_0x38e5ca,_0x230e1b){io['to'](_0x64b64e)[_0xf69a('0xd')](_0x38e5ca,_0x230e1b);}function getTicket(_0x1188c5,_0x89a981,_0x1cc996,_0x1ded3d,_0x23aa5f,_0x1ef90d,_0xed4b47,_0x532517){logger[_0xf69a('0xe')](_0xf69a('0xf'));var _0x472c95=new Date();var _0x150b13=[{'name':_0xf69a('0x10'),'value':intUtil[_0xf69a('0x11')](_0x1ded3d[_0xf69a('0x12')],_0x23aa5f,'\x20')},{'name':_0xf69a('0x13'),'value':_0x89a981['id']},{'name':'created_by','value':_0x89a981['id']},{'name':_0xf69a('0x14'),'value':intUtil[_0xf69a('0x11')](_0x1ded3d[_0xf69a('0x15')],_0x23aa5f,'\x0a')},{'name':'date_start','value':_0x472c95['toISOString']()[_0xf69a('0x16')](0x0,0x13)[_0xf69a('0x17')]('T','\x20')},{'name':'duration_hours','value':'0'},{'name':_0xf69a('0x18'),'value':'15'},{'name':_0xf69a('0x19'),'value':_0x1cc996['id']},{'name':_0xf69a('0x1a'),'value':_0xf69a('0x1b')},{'name':_0xf69a('0x1c'),'value':_0x1cc996[_0xf69a('0x10')]},{'name':_0xf69a('0x1d'),'value':_0x532517}];if(_0x1ef90d[_0xf69a('0x1e')]){_[_0xf69a('0x1f')](_0x1ef90d,function(_0x3aa925){if(_0x23aa5f[_0x3aa925[_0xf69a('0x20')]]){_0x150b13[_0xf69a('0x21')]({'name':_0x3aa925[_0xf69a('0x22')],'value':_0x23aa5f[_0x3aa925['variableName']]});}});}return request({'form':{'method':_0xf69a('0x23'),'input_type':_0xf69a('0x24'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0xed4b47['id'],'module_name':_0xf69a('0x25'),'name_value_list':_0x150b13})}});}function getAuth(_0x56fa90){return util['format'](_0xf69a('0x26'),new Buffer(_0x56fa90[_0xf69a('0x27')]+':X')[_0xf69a('0x28')](_0xf69a('0x29')));}function getServerInfo(_0x58953b){return request({'form':{'method':_0xf69a('0x2a'),'input_type':_0xf69a('0x24'),'response_type':_0xf69a('0x24'),'rest_data':JSON['stringify']({'session':_0x58953b['id']})}});}function getUser(_0x4c92b,_0x539a51,_0x3096c7){if(!_[_0xf69a('0x2b')](_0x539a51)){logger[_0xf69a('0xe')](_0xf69a('0x2c'),_0x539a51);return request({'form':{'method':_0xf69a('0x2d'),'input_type':'JSON','response_type':_0xf69a('0x24'),'rest_data':JSON[_0xf69a('0x2e')]({'session':_0x3096c7['id'],'module_name':_0xf69a('0x2f'),'query':util[_0xf69a('0x30')](_0xf69a('0x31'),_0x539a51),'order_by':'','offset':'0','select_fields':['id',_0xf69a('0x10'),_0xf69a('0x32')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xf69a('0x33')](function(_0x59bb3c){if(_0x59bb3c[_0xf69a('0x34')][_0xf69a('0x1e')]){var _0x4a78f7=_['find'](_0x59bb3c[_0xf69a('0x34')],function(_0x196b7e){return _0x196b7e[_0xf69a('0x35')][_0xf69a('0x32')][_0xf69a('0x36')]===_0x539a51;});if(_0x4a78f7){logger[_0xf69a('0xe')](_0xf69a('0x37'));return BPromise[_0xf69a('0x38')]({'id':_0x4a78f7['name_value_list']['id'][_0xf69a('0x36')],'name':_0x4a78f7[_0xf69a('0x35')][_0xf69a('0x10')][_0xf69a('0x36')]});}}logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0xf69a('0x38')]({'id':_0x3096c7['name_value_list']['user_id'][_0xf69a('0x36')],'name':_0x3096c7['name_value_list'][_0xf69a('0x32')][_0xf69a('0x36')]});});}else{logger[_0xf69a('0xe')](_0xf69a('0x39'));return BPromise[_0xf69a('0x38')]({'id':_0x3096c7[_0xf69a('0x35')]['user_id'][_0xf69a('0x36')],'name':_0x3096c7[_0xf69a('0x35')][_0xf69a('0x32')][_0xf69a('0x36')]});}}function getEndUser(_0x4d7153,_0x37a78b,_0x555a9e,_0x40e316){logger[_0xf69a('0xe')](_0xf69a('0x3a'),_0x555a9e);return request({'form':{'method':_0xf69a('0x2d'),'input_type':_0xf69a('0x24'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x40e316['id'],'module_name':_0xf69a('0x1b'),'query':util[_0xf69a('0x30')]('contacts.phone_home\x20=\x20\x22%s\x22',_0x555a9e),'order_by':'','offset':'0','select_fields':['id',_0xf69a('0x10'),_0xf69a('0x3b')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xf69a('0x33')](function(_0x53f6d9){if(_0x53f6d9[_0xf69a('0x34')]['length']){var _0x53b49d=_['find'](_0x53f6d9['entry_list'],function(_0x388336){return _0x388336[_0xf69a('0x35')][_0xf69a('0x3b')]['value']===_0x555a9e;});if(_0x53b49d){logger[_0xf69a('0xe')](_0xf69a('0x3c'));return BPromise['resolve']({'id':_0x53b49d[_0xf69a('0x35')]['id'][_0xf69a('0x36')],'name':_0x53b49d[_0xf69a('0x35')][_0xf69a('0x10')][_0xf69a('0x36')],'phone':_0x53b49d['name_value_list'][_0xf69a('0x3b')][_0xf69a('0x36')]});}}else{logger[_0xf69a('0xe')](_0xf69a('0x3d'));return request({'form':{'method':_0xf69a('0x23'),'input_type':_0xf69a('0x24'),'response_type':_0xf69a('0x24'),'rest_data':JSON[_0xf69a('0x2e')]({'session':_0x40e316['id'],'module_name':_0xf69a('0x1b'),'name_value_list':[{'name':'first_name','value':_0x37a78b!==''?_0x37a78b:util['format'](_0xf69a('0x3e'),_0x555a9e)},{'name':_0xf69a('0x3b'),'value':_0x555a9e}]})}})[_0xf69a('0x33')](function(_0x2e8710){logger['info'](_0xf69a('0x3f'));return BPromise[_0xf69a('0x38')]({'id':_0x2e8710['id'],'name':_0x2e8710[_0xf69a('0x34')][_0xf69a('0x40')]['value'],'phone':_0x2e8710[_0xf69a('0x34')][_0xf69a('0x3b')][_0xf69a('0x36')]});});}});}function request(_0x3179b1){logger[_0xf69a('0x41')](_0xf69a('0x42'),JSON['stringify'](_0x3179b1));return rp(_[_0xf69a('0x43')](def,_0x3179b1));}function getTags(_0x3e5c41,_0x10736b){var _0x37aae6=[];if(_0x3e5c41&&_0x3e5c41[_0xf69a('0x1e')]>0x0){_0x37aae6=_['map'](_0x3e5c41,_0x10736b);}return _0x37aae6;}function getCustomFields(_0x2ba0c1,_0x286eec){var _0x2d75f0=[];var _0x50e8ed={'custom_fields':[]};if(_0x2ba0c1[_0xf69a('0x1e')]>0x0){_[_0xf69a('0x1f')](_0x2ba0c1,function(_0x4cf5b4){if(_0x4cf5b4[_0xf69a('0x44')]===_0xf69a('0x45')&&_0x4cf5b4[_0xf69a('0x46')]&&!_0x4cf5b4[_0xf69a('0x47')]){_0x50e8ed[_0x4cf5b4['nameField'][_0xf69a('0x48')]()]=_0x4cf5b4['content'][_0xf69a('0x28')]();}else if(_0x4cf5b4[_0xf69a('0x44')]===_0xf69a('0x45')&&_0x4cf5b4['idField']&&_0x4cf5b4[_0xf69a('0x47')]){_0x50e8ed[_0xf69a('0x49')][_0xf69a('0x21')]({'id':_0x4cf5b4['idField'],'value':_0x4cf5b4[_0xf69a('0x4a')][_0xf69a('0x28')]()});}else if(_0x4cf5b4['type']===_0xf69a('0x4b')&&_0x4cf5b4['variableName']&&_0x4cf5b4[_0xf69a('0x22')]&&_0x4cf5b4[_0xf69a('0x47')]){_0x286eec[_0x4cf5b4['variableName']]&&_0x50e8ed[_0xf69a('0x49')]['push']({'id':_0x4cf5b4['idField'],'value':_0x286eec[_0x4cf5b4['variableName']][_0xf69a('0x28')]()});}else if(_0x4cf5b4[_0xf69a('0x44')]===_0xf69a('0x4c')&&_0x4cf5b4[_0xf69a('0x4d')]&&_0x4cf5b4[_0xf69a('0x4d')][_0xf69a('0x10')]&&_0x4cf5b4[_0xf69a('0x22')]&&_0x4cf5b4[_0xf69a('0x47')]){_0x286eec[_0x4cf5b4[_0xf69a('0x4d')][_0xf69a('0x10')][_0xf69a('0x48')]()]&&_0x50e8ed['custom_fields'][_0xf69a('0x21')]({'id':_0x4cf5b4['idField'],'value':_0x286eec[_0x4cf5b4[_0xf69a('0x4d')][_0xf69a('0x10')][_0xf69a('0x48')]()][_0xf69a('0x28')]()});}});}return _0x50e8ed;}function getConnection(_0x50192f){return request({'method':'POST','form':{'method':_0xf69a('0x4e'),'input_type':_0xf69a('0x24'),'response_type':_0xf69a('0x24'),'rest_data':JSON[_0xf69a('0x2e')]({'user_auth':{'user_name':_0x50192f['username'],'password':_0x50192f[_0xf69a('0x4f')],'encryption':_0xf69a('0x50')},'application':_0xf69a('0x51')})}})[_0xf69a('0x33')](function(_0x54e009){var _0x5de29=_0x54e009;if(_0x5de29['id']){def[_0xf69a('0x52')]=_0x5de29['id'];return BPromise[_0xf69a('0x38')](_0x5de29);}else{throw new Error(util['format'](_0xf69a('0x53'),_0x50192f['id']));}});}function setRelationship(_0x3db39e,_0x4b2d4b,_0x530757,_0x37b984){return request({'form':{'method':_0xf69a('0x54'),'input_type':_0xf69a('0x24'),'response_type':'JSON','rest_data':JSON[_0xf69a('0x2e')]({'session':_0x3db39e['id'],'module_name':'Calls','module_id':_0x530757['id'],'link_field_name':_0x37b984,'related_ids':[_0x4b2d4b['id']]})}});}exports[_0xf69a('0x55')]=function(_0x23a2d0,_0x3a26fc,_0x498217,_0x5c4371,_0x37d5ab,_0x195fc4){var _0x29108b,_0x5642a6,_0x3d0af0,_0x2248b4;_0x195fc4[_0xf69a('0x56')]=intUtil[_0xf69a('0x57')](_0x195fc4[_0xf69a('0x56')]);_0x195fc4[_0xf69a('0x58')]=intUtil[_0xf69a('0x57')](_0x195fc4['serverUrl']);def[_0xf69a('0x59')]=util[_0xf69a('0x30')](_0xf69a('0x5a'),_0x195fc4['remoteUri']);if(_0x37d5ab&&_0x37d5ab[_0xf69a('0x5b')]){logger['info']('[QUEUE]',_0xf69a('0x5c'));_0x3a26fc[_0xf69a('0x5d')]=util[_0xf69a('0x30')](_0xf69a('0x5e'),_0x195fc4[_0xf69a('0x58')],_0x3a26fc[_0xf69a('0x5f')],md5(_0x3a26fc[_0xf69a('0x5f')]));}else{_0x3a26fc['recordingURL']='';}return getConnection(_0x195fc4)['then'](function(_0x117020){_0x2248b4=_0x117020;return getUser(_0x195fc4,_0x5c4371[_0xf69a('0x10')],_0x2248b4);})[_0xf69a('0x33')](function(_0x1e0ed1){_0x29108b=_0x1e0ed1;logger['info']('The\x20User\x20ID\x20is:',_0x29108b['id']);return getEndUser(_0x195fc4,_0x3a26fc[_0xf69a('0x60')],_0x3a26fc['calleridnum'],_0x2248b4);})[_0xf69a('0x33')](function(_0x2ea802){_0x5642a6=_0x2ea802;logger['info'](_0xf69a('0x61'),_0x5642a6['id']);return getTicket(_0x195fc4,_0x29108b,_0x5642a6,_0x498217,_0x3a26fc,_0x498217[_0xf69a('0x62')],_0x2248b4,'Inbound');})[_0xf69a('0x33')](function(_0x40448c){_0x3d0af0=_0x40448c;logger[_0xf69a('0xe')](_0xf69a('0x63'));logger['info'](_0xf69a('0x64'),_0x3d0af0['id']);return setRelationship(_0x2248b4,_0x29108b,_0x3d0af0,_0xf69a('0x65'));})[_0xf69a('0x33')](function(){return setRelationship(_0x2248b4,_0x5642a6,_0x3d0af0,_0xf69a('0x66'));})[_0xf69a('0x33')](function(){return getServerInfo(_0x2248b4);})[_0xf69a('0x33')](function(_0xee4000){var _0x2c7709=parseInt(_0xee4000[_0xf69a('0x67')][_0xf69a('0x68')](0x0));var _0x2b41fc=util['format'](_0xf69a('0x69'),_0x195fc4[_0xf69a('0x56')],_0x3d0af0['id']);if(_0x2c7709>0x6){_0x2b41fc=util[_0xf69a('0x30')](_0xf69a('0x6a'),_0x195fc4[_0xf69a('0x56')],_0x3d0af0['id']);}logger['info']('[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xf69a('0x30')]('user:%s',_0x5c4371[_0xf69a('0x10')]),_0xf69a('0x6b'),{'uri':_0x2b41fc});})['catch'](function(_0x193edb){logger[_0xf69a('0x6c')](_0xf69a('0x6d'),JSON[_0xf69a('0x2e')](_0x193edb));});};exports[_0xf69a('0x6e')]=function(_0x366b82,_0x30060d,_0x12df07,_0x400e4e,_0xc7e526,_0x389ebb,_0x2be62d){var _0x16baaf,_0x2081e3,_0x180383,_0x1332cf;_0x389ebb['remoteUri']=intUtil['stripTrailingSlash'](_0x389ebb['remoteUri']);_0x389ebb['serverUrl']=intUtil[_0xf69a('0x57')](_0x389ebb[_0xf69a('0x58')]);def['uri']=util[_0xf69a('0x30')](_0xf69a('0x5a'),_0x389ebb[_0xf69a('0x56')]);if(_0x2be62d&&_0x2be62d[_0xf69a('0x6f')]&&_0x2be62d[_0xf69a('0x6f')]!=='none'){logger['info'](_0xf69a('0x70'),_0xf69a('0x5c'));_0x30060d[_0xf69a('0x5d')]=util[_0xf69a('0x30')](_0xf69a('0x5e'),_0x389ebb['serverUrl'],_0x30060d[_0xf69a('0x5f')],md5(_0x30060d[_0xf69a('0x5f')]));}return getConnection(_0x389ebb)['then'](function(_0x38f86f){_0x1332cf=_0x38f86f;return getUser(_0x389ebb,_0x400e4e[_0xf69a('0x10')],_0x1332cf);})[_0xf69a('0x33')](function(_0x1c6916){_0x16baaf=_0x1c6916;logger['info']('The\x20User\x20ID\x20is:',_0x16baaf['id']);return getEndUser(_0x389ebb,_0x30060d[_0xf69a('0x71')],_0x30060d[_0xf69a('0x72')],_0x1332cf);})[_0xf69a('0x33')](function(_0x5169af){_0x2081e3=_0x5169af;logger[_0xf69a('0xe')]('The\x20Enduser\x20ID\x20is:',_0x2081e3['id']);return getTicket(_0x389ebb,_0x16baaf,_0x2081e3,_0x12df07,_0x30060d,_0x12df07['Fields'],_0x1332cf,'Outbound');})[_0xf69a('0x33')](function(_0x39d0bc){_0x180383=_0x39d0bc;logger[_0xf69a('0xe')]('Ticket\x20created!');logger[_0xf69a('0xe')](_0xf69a('0x64'),_0x180383['id']);return setRelationship(_0x1332cf,_0x16baaf,_0x180383,_0xf69a('0x65'));})['then'](function(){return setRelationship(_0x1332cf,_0x2081e3,_0x180383,_0xf69a('0x66'));})['then'](function(){return getServerInfo(_0x1332cf);})['then'](function(_0x2e4a68){var _0x2b2bc4=parseInt(_0x2e4a68[_0xf69a('0x67')][_0xf69a('0x68')](0x0));var _0x3e051e=util[_0xf69a('0x30')](_0xf69a('0x69'),_0x389ebb[_0xf69a('0x56')],_0x180383['id']);if(_0x2b2bc4>0x6){_0x3e051e=util[_0xf69a('0x30')](_0xf69a('0x6a'),_0x389ebb[_0xf69a('0x56')],_0x180383['id']);}logger[_0xf69a('0xe')](_0xf69a('0x70'),_0xf69a('0x73'));emit(util[_0xf69a('0x30')](_0xf69a('0x74'),_0x400e4e[_0xf69a('0x10')]),_0xf69a('0x6b'),{'uri':_0x3e051e});})[_0xf69a('0x75')](function(_0x2bde81){logger[_0xf69a('0x6c')](_0xf69a('0x70'),JSON['stringify'](_0x2bde81));});};exports[_0xf69a('0x76')]=function(_0x394d0f,_0x16a15c,_0x4584ac,_0x12076d,_0x4b2a1b,_0x4e6bd5){var _0x520547,_0x15392c,_0x4c22fe,_0x3df3c8;_0x4e6bd5[_0xf69a('0x56')]=intUtil[_0xf69a('0x57')](_0x4e6bd5[_0xf69a('0x56')]);_0x4e6bd5[_0xf69a('0x58')]=intUtil[_0xf69a('0x57')](_0x4e6bd5['serverUrl']);def[_0xf69a('0x59')]=util[_0xf69a('0x30')]('%s/service/v4_1/rest.php',_0x4e6bd5['remoteUri']);if(_0x4b2a1b&&_0x4b2a1b[_0xf69a('0x5b')]){logger[_0xf69a('0xe')](_0xf69a('0x77'),'Recording\x20is\x20enabled!');_0x16a15c[_0xf69a('0x5d')]=util[_0xf69a('0x30')](_0xf69a('0x5e'),_0x4e6bd5[_0xf69a('0x58')],_0x16a15c[_0xf69a('0x5f')],md5(_0x16a15c[_0xf69a('0x5f')]));}else{_0x16a15c[_0xf69a('0x5d')]='';}return getConnection(_0x4e6bd5)[_0xf69a('0x33')](function(_0x325a52){_0x3df3c8=_0x325a52;if(!_[_0xf69a('0x2b')](_0x12076d)){return getUser(_0x4e6bd5,_0x12076d[_0xf69a('0x10')],_0x3df3c8);}else{return getUser(_0x4e6bd5,null,_0x3df3c8);}})['then'](function(_0x555e73){_0x520547=_0x555e73;logger[_0xf69a('0xe')](_0xf69a('0x78'),_0x520547['id']);return getEndUser(_0x4e6bd5,_0x16a15c[_0xf69a('0x60')],_0x16a15c['calleridnum'],_0x3df3c8);})[_0xf69a('0x33')](function(_0x2a9e89){_0x15392c=_0x2a9e89;logger[_0xf69a('0xe')](_0xf69a('0x61'),_0x15392c['id']);return getTicket(_0x4e6bd5,_0x520547,_0x15392c,_0x4584ac,_0x16a15c,_0x4584ac['Fields'],_0x3df3c8,_0xf69a('0x79'));})['then'](function(_0x1b2454){_0x4c22fe=_0x1b2454;logger[_0xf69a('0xe')]('Ticket\x20created!');logger[_0xf69a('0xe')](_0xf69a('0x64'),_0x4c22fe['id']);return setRelationship(_0x3df3c8,_0x520547,_0x4c22fe,'users');})['then'](function(){return setRelationship(_0x3df3c8,_0x15392c,_0x4c22fe,_0xf69a('0x66'));})[_0xf69a('0x33')](function(){return getServerInfo(_0x3df3c8);})['catch'](function(_0x3004f8){logger[_0xf69a('0x6c')](_0xf69a('0x77'),JSON['stringify'](_0x3004f8));});}; \ No newline at end of file +var _0x5dcd=['[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch','error','outbound','uri','recordingFormat','[OUTBOUND]','destcalleridname','The\x20Enduser\x20ID\x20is:','Outbound','Ticket\x20created!','abandoned','stripTrailingSlash','[ABANDONED]','calleridnum','lodash','request-promise','bluebird','util','ioredis','./util','../../../../config/environment','sugarcrm','redis','localhost','socket.io-emitter','POST','emit','Creating\x20new\x20ticket...','name','getString','assigned_user_id','description','Descriptions','slice','replace','duration_hours','duration_minutes','parent_id','parent_type','Contacts','parent_name','forEach','variableName','push','set_entry','JSON','stringify','format','Basic\x20%s','apiKey','toString','base64','info','Getting\x20agent\x20with\x20name','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','find','entry_list','name_value_list','Agent\x20found!','resolve','value','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','user_name','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','get_entry_list','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','then','length','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','Caller\x20-\x20%s','[HTTP]','merge','map','type','string','customField','nameField','toLowerCase','content','idField','custom_fields','Variable','login','username','PLAIN','xCALLY\x20Motion\x20integration','Calls','queue','serverUrl','%s/service/v4_1/rest.php','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridname','Fields','Inbound','The\x20Ticket\x20ID\x20is:','users','contacts','version','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','remoteUri','%s/#bwc/index.php?module=Calls&action=EditView&record=%s'];(function(_0x1b664d,_0x1d8695){var _0x43af6b=function(_0x7fe8b2){while(--_0x7fe8b2){_0x1b664d['push'](_0x1b664d['shift']());}};_0x43af6b(++_0x1d8695);}(_0x5dcd,0xf8));var _0xd5dc=function(_0x3d5bc2,_0x436cf6){_0x3d5bc2=_0x3d5bc2-0x0;var _0x5151e2=_0x5dcd[_0x3d5bc2];return _0x5151e2;};'use strict';var _=require(_0xd5dc('0x0'));var rp=require(_0xd5dc('0x1'));var BPromise=require(_0xd5dc('0x2'));var md5=require('md5');var util=require(_0xd5dc('0x3'));var Redis=require(_0xd5dc('0x4'));var intUtil=require(_0xd5dc('0x5'));var config=require(_0xd5dc('0x6'));var logger=require('../../../../config/logger')(_0xd5dc('0x7'));config[_0xd5dc('0x8')]=_['defaults'](config[_0xd5dc('0x8')],{'host':_0xd5dc('0x9'),'port':0x18eb});var io=require(_0xd5dc('0xa'))(new Redis(config['redis']));var def={'method':_0xd5dc('0xb'),'json':!![]};function emit(_0x1ae996,_0x1ba422,_0x10cac3){io['to'](_0x1ae996)[_0xd5dc('0xc')](_0x1ba422,_0x10cac3);}function getTicket(_0xb68234,_0x39fbb1,_0x2be8ca,_0x330fc2,_0x3fcec4,_0x425f07,_0x3903ca,_0x56f40c){logger['info'](_0xd5dc('0xd'));var _0x5a2f4d=new Date();var _0x2c11dd=[{'name':_0xd5dc('0xe'),'value':intUtil[_0xd5dc('0xf')](_0x330fc2['Subjects'],_0x3fcec4,'\x20')},{'name':_0xd5dc('0x10'),'value':_0x39fbb1['id']},{'name':'created_by','value':_0x39fbb1['id']},{'name':_0xd5dc('0x11'),'value':intUtil['getString'](_0x330fc2[_0xd5dc('0x12')],_0x3fcec4,'\x0a')},{'name':'date_start','value':_0x5a2f4d['toISOString']()[_0xd5dc('0x13')](0x0,0x13)[_0xd5dc('0x14')]('T','\x20')},{'name':_0xd5dc('0x15'),'value':'0'},{'name':_0xd5dc('0x16'),'value':'15'},{'name':_0xd5dc('0x17'),'value':_0x2be8ca['id']},{'name':_0xd5dc('0x18'),'value':_0xd5dc('0x19')},{'name':_0xd5dc('0x1a'),'value':_0x2be8ca[_0xd5dc('0xe')]},{'name':'direction','value':_0x56f40c}];if(_0x425f07['length']){_[_0xd5dc('0x1b')](_0x425f07,function(_0x31794a){if(_0x3fcec4[_0x31794a[_0xd5dc('0x1c')]]){_0x2c11dd[_0xd5dc('0x1d')]({'name':_0x31794a['idField'],'value':_0x3fcec4[_0x31794a['variableName']]});}});}return request({'form':{'method':_0xd5dc('0x1e'),'input_type':_0xd5dc('0x1f'),'response_type':_0xd5dc('0x1f'),'rest_data':JSON[_0xd5dc('0x20')]({'session':_0x3903ca['id'],'module_name':'Calls','name_value_list':_0x2c11dd})}});}function getAuth(_0x4c5c32){return util[_0xd5dc('0x21')](_0xd5dc('0x22'),new Buffer(_0x4c5c32[_0xd5dc('0x23')]+':X')[_0xd5dc('0x24')](_0xd5dc('0x25')));}function getServerInfo(_0x96b620){return request({'form':{'method':'get_server_info','input_type':_0xd5dc('0x1f'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x96b620['id']})}});}function getUser(_0x45b6fb,_0x398954,_0x540893){if(!_['isNil'](_0x398954)){logger[_0xd5dc('0x26')](_0xd5dc('0x27'),_0x398954);return request({'form':{'method':'get_entry_list','input_type':_0xd5dc('0x1f'),'response_type':_0xd5dc('0x1f'),'rest_data':JSON[_0xd5dc('0x20')]({'session':_0x540893['id'],'module_name':_0xd5dc('0x28'),'query':util['format'](_0xd5dc('0x29'),_0x398954),'order_by':'','offset':'0','select_fields':['id',_0xd5dc('0xe'),'user_name'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x175fd1){if(_0x175fd1['entry_list']['length']){var _0x31de66=_[_0xd5dc('0x2a')](_0x175fd1[_0xd5dc('0x2b')],function(_0x4ca713){return _0x4ca713[_0xd5dc('0x2c')]['user_name']['value']===_0x398954;});if(_0x31de66){logger[_0xd5dc('0x26')](_0xd5dc('0x2d'));return BPromise[_0xd5dc('0x2e')]({'id':_0x31de66[_0xd5dc('0x2c')]['id'][_0xd5dc('0x2f')],'name':_0x31de66['name_value_list'][_0xd5dc('0xe')][_0xd5dc('0x2f')]});}}logger[_0xd5dc('0x26')](_0xd5dc('0x30'));return BPromise['resolve']({'id':_0x540893['name_value_list'][_0xd5dc('0x31')]['value'],'name':_0x540893[_0xd5dc('0x2c')][_0xd5dc('0x32')]['value']});});}else{logger['info'](_0xd5dc('0x33'));return BPromise['resolve']({'id':_0x540893[_0xd5dc('0x2c')][_0xd5dc('0x31')]['value'],'name':_0x540893[_0xd5dc('0x2c')]['user_name'][_0xd5dc('0x2f')]});}}function getEndUser(_0x32624c,_0x5c4fe1,_0x340fd6,_0x31b948){logger['info'](_0xd5dc('0x34'),_0x340fd6);return request({'form':{'method':_0xd5dc('0x35'),'input_type':'JSON','response_type':_0xd5dc('0x1f'),'rest_data':JSON[_0xd5dc('0x20')]({'session':_0x31b948['id'],'module_name':_0xd5dc('0x19'),'query':util[_0xd5dc('0x21')](_0xd5dc('0x36'),_0x340fd6),'order_by':'','offset':'0','select_fields':['id',_0xd5dc('0xe'),_0xd5dc('0x37')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xd5dc('0x38')](function(_0x16ed3d){if(_0x16ed3d[_0xd5dc('0x2b')][_0xd5dc('0x39')]){var _0x23b27c=_['find'](_0x16ed3d['entry_list'],function(_0x55155d){return _0x55155d[_0xd5dc('0x2c')][_0xd5dc('0x37')]['value']===_0x340fd6;});if(_0x23b27c){logger['info']('Enduser\x20found!');return BPromise[_0xd5dc('0x2e')]({'id':_0x23b27c[_0xd5dc('0x2c')]['id']['value'],'name':_0x23b27c[_0xd5dc('0x2c')][_0xd5dc('0xe')]['value'],'phone':_0x23b27c[_0xd5dc('0x2c')][_0xd5dc('0x37')][_0xd5dc('0x2f')]});}}else{logger[_0xd5dc('0x26')](_0xd5dc('0x3a'));return request({'form':{'method':_0xd5dc('0x1e'),'input_type':_0xd5dc('0x1f'),'response_type':_0xd5dc('0x1f'),'rest_data':JSON[_0xd5dc('0x20')]({'session':_0x31b948['id'],'module_name':'Contacts','name_value_list':[{'name':_0xd5dc('0x3b'),'value':_0x5c4fe1!==''?_0x5c4fe1:util['format'](_0xd5dc('0x3c'),_0x340fd6)},{'name':_0xd5dc('0x37'),'value':_0x340fd6}]})}})[_0xd5dc('0x38')](function(_0x4d6d20){logger[_0xd5dc('0x26')]('Enduser\x20created.');return BPromise[_0xd5dc('0x2e')]({'id':_0x4d6d20['id'],'name':_0x4d6d20[_0xd5dc('0x2b')][_0xd5dc('0x3b')][_0xd5dc('0x2f')],'phone':_0x4d6d20[_0xd5dc('0x2b')][_0xd5dc('0x37')][_0xd5dc('0x2f')]});});}});}function request(_0x2126d7){logger['debug'](_0xd5dc('0x3d'),JSON[_0xd5dc('0x20')](_0x2126d7));return rp(_[_0xd5dc('0x3e')](def,_0x2126d7));}function getTags(_0x277ca1,_0x348d63){var _0x2c438f=[];if(_0x277ca1&&_0x277ca1[_0xd5dc('0x39')]>0x0){_0x2c438f=_[_0xd5dc('0x3f')](_0x277ca1,_0x348d63);}return _0x2c438f;}function getCustomFields(_0x5028c1,_0x4f4cf8){var _0x556a32=[];var _0x70f4f9={'custom_fields':[]};if(_0x5028c1[_0xd5dc('0x39')]>0x0){_[_0xd5dc('0x1b')](_0x5028c1,function(_0x50f8b8){if(_0x50f8b8[_0xd5dc('0x40')]===_0xd5dc('0x41')&&_0x50f8b8['nameField']&&!_0x50f8b8[_0xd5dc('0x42')]){_0x70f4f9[_0x50f8b8[_0xd5dc('0x43')][_0xd5dc('0x44')]()]=_0x50f8b8[_0xd5dc('0x45')][_0xd5dc('0x24')]();}else if(_0x50f8b8[_0xd5dc('0x40')]===_0xd5dc('0x41')&&_0x50f8b8[_0xd5dc('0x46')]&&_0x50f8b8[_0xd5dc('0x42')]){_0x70f4f9[_0xd5dc('0x47')][_0xd5dc('0x1d')]({'id':_0x50f8b8[_0xd5dc('0x46')],'value':_0x50f8b8[_0xd5dc('0x45')][_0xd5dc('0x24')]()});}else if(_0x50f8b8[_0xd5dc('0x40')]==='variable'&&_0x50f8b8[_0xd5dc('0x1c')]&&_0x50f8b8['idField']&&_0x50f8b8[_0xd5dc('0x42')]){_0x4f4cf8[_0x50f8b8[_0xd5dc('0x1c')]]&&_0x70f4f9['custom_fields'][_0xd5dc('0x1d')]({'id':_0x50f8b8[_0xd5dc('0x46')],'value':_0x4f4cf8[_0x50f8b8[_0xd5dc('0x1c')]][_0xd5dc('0x24')]()});}else if(_0x50f8b8[_0xd5dc('0x40')]==='customVariable'&&_0x50f8b8[_0xd5dc('0x48')]&&_0x50f8b8['Variable']['name']&&_0x50f8b8[_0xd5dc('0x46')]&&_0x50f8b8[_0xd5dc('0x42')]){_0x4f4cf8[_0x50f8b8[_0xd5dc('0x48')][_0xd5dc('0xe')][_0xd5dc('0x44')]()]&&_0x70f4f9[_0xd5dc('0x47')][_0xd5dc('0x1d')]({'id':_0x50f8b8['idField'],'value':_0x4f4cf8[_0x50f8b8['Variable'][_0xd5dc('0xe')][_0xd5dc('0x44')]()][_0xd5dc('0x24')]()});}});}return _0x70f4f9;}function getConnection(_0x431574){return request({'method':_0xd5dc('0xb'),'form':{'method':_0xd5dc('0x49'),'input_type':_0xd5dc('0x1f'),'response_type':'JSON','rest_data':JSON[_0xd5dc('0x20')]({'user_auth':{'user_name':_0x431574[_0xd5dc('0x4a')],'password':_0x431574['password'],'encryption':_0xd5dc('0x4b')},'application':_0xd5dc('0x4c')})}})[_0xd5dc('0x38')](function(_0x5a489b){var _0x561a5b=_0x5a489b;if(_0x561a5b['id']){def['sessionID']=_0x561a5b['id'];return BPromise[_0xd5dc('0x2e')](_0x561a5b);}else{throw new Error(util['format']('Account\x20%d\x20is\x20not\x20valid',_0x431574['id']));}});}function setRelationship(_0x5802d6,_0x140c5c,_0x20aef7,_0x2c2a5f){return request({'form':{'method':'set_relationship','input_type':'JSON','response_type':_0xd5dc('0x1f'),'rest_data':JSON[_0xd5dc('0x20')]({'session':_0x5802d6['id'],'module_name':_0xd5dc('0x4d'),'module_id':_0x20aef7['id'],'link_field_name':_0x2c2a5f,'related_ids':[_0x140c5c['id']]})}});}exports[_0xd5dc('0x4e')]=function(_0x3c1c82,_0x7dca9d,_0x58227d,_0x367d67,_0xf2d2cb,_0x36764e){var _0xd3e8ae,_0x5bc743,_0x295e72,_0x45ee8d;_0x36764e['remoteUri']=intUtil['stripTrailingSlash'](_0x36764e['remoteUri']);_0x36764e[_0xd5dc('0x4f')]=intUtil['stripTrailingSlash'](_0x36764e[_0xd5dc('0x4f')]);def['uri']=util[_0xd5dc('0x21')](_0xd5dc('0x50'),_0x36764e['remoteUri']);if(_0xf2d2cb&&_0xf2d2cb[_0xd5dc('0x51')]){logger[_0xd5dc('0x26')]('[QUEUE]',_0xd5dc('0x52'));_0x7dca9d[_0xd5dc('0x53')]=util[_0xd5dc('0x21')](_0xd5dc('0x54'),_0x36764e['serverUrl'],_0x7dca9d[_0xd5dc('0x55')],md5(_0x7dca9d[_0xd5dc('0x55')]));}else{_0x7dca9d['recordingURL']='';}return getConnection(_0x36764e)[_0xd5dc('0x38')](function(_0x42098f){_0x45ee8d=_0x42098f;return getUser(_0x36764e,_0x367d67[_0xd5dc('0xe')],_0x45ee8d);})[_0xd5dc('0x38')](function(_0x4ec8e1){_0xd3e8ae=_0x4ec8e1;logger['info'](_0xd5dc('0x56'),_0xd3e8ae['id']);return getEndUser(_0x36764e,_0x7dca9d[_0xd5dc('0x57')],_0x7dca9d['calleridnum'],_0x45ee8d);})[_0xd5dc('0x38')](function(_0x2e50e7){_0x5bc743=_0x2e50e7;logger[_0xd5dc('0x26')]('The\x20Enduser\x20ID\x20is:',_0x5bc743['id']);return getTicket(_0x36764e,_0xd3e8ae,_0x5bc743,_0x58227d,_0x7dca9d,_0x58227d[_0xd5dc('0x58')],_0x45ee8d,_0xd5dc('0x59'));})['then'](function(_0x404726){_0x295e72=_0x404726;logger[_0xd5dc('0x26')]('Ticket\x20created!');logger[_0xd5dc('0x26')](_0xd5dc('0x5a'),_0x295e72['id']);return setRelationship(_0x45ee8d,_0xd3e8ae,_0x295e72,_0xd5dc('0x5b'));})['then'](function(){return setRelationship(_0x45ee8d,_0x5bc743,_0x295e72,_0xd5dc('0x5c'));})['then'](function(){return getServerInfo(_0x45ee8d);})[_0xd5dc('0x38')](function(_0x150258){var _0x5772e9=parseInt(_0x150258[_0xd5dc('0x5d')]['charAt'](0x0));var _0x4ea014=util[_0xd5dc('0x21')](_0xd5dc('0x5e'),_0x36764e[_0xd5dc('0x5f')],_0x295e72['id']);if(_0x5772e9>0x6){_0x4ea014=util[_0xd5dc('0x21')](_0xd5dc('0x60'),_0x36764e['remoteUri'],_0x295e72['id']);}logger[_0xd5dc('0x26')](_0xd5dc('0x61'),_0xd5dc('0x62'));emit(util['format'](_0xd5dc('0x63'),_0x367d67[_0xd5dc('0xe')]),_0xd5dc('0x64'),{'uri':_0x4ea014});})[_0xd5dc('0x65')](function(_0x3d5c9a){logger[_0xd5dc('0x66')](_0xd5dc('0x61'),JSON[_0xd5dc('0x20')](_0x3d5c9a));});};exports[_0xd5dc('0x67')]=function(_0x12f067,_0x26a803,_0x514fb3,_0x49c6ef,_0x592e3a,_0x2bfe9f,_0x599bb0){var _0x494cd0,_0x431d0e,_0x477e2c,_0x6c2b83;_0x2bfe9f[_0xd5dc('0x5f')]=intUtil['stripTrailingSlash'](_0x2bfe9f[_0xd5dc('0x5f')]);_0x2bfe9f[_0xd5dc('0x4f')]=intUtil['stripTrailingSlash'](_0x2bfe9f[_0xd5dc('0x4f')]);def[_0xd5dc('0x68')]=util[_0xd5dc('0x21')]('%s/service/v4_1/rest.php',_0x2bfe9f['remoteUri']);if(_0x599bb0&&_0x599bb0[_0xd5dc('0x69')]&&_0x599bb0['recordingFormat']!=='none'){logger[_0xd5dc('0x26')](_0xd5dc('0x6a'),'Recording\x20is\x20enabled!');_0x26a803['recordingURL']=util[_0xd5dc('0x21')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2bfe9f[_0xd5dc('0x4f')],_0x26a803['uniqueid'],md5(_0x26a803[_0xd5dc('0x55')]));}return getConnection(_0x2bfe9f)[_0xd5dc('0x38')](function(_0x586dd3){_0x6c2b83=_0x586dd3;return getUser(_0x2bfe9f,_0x49c6ef[_0xd5dc('0xe')],_0x6c2b83);})[_0xd5dc('0x38')](function(_0x44b73a){_0x494cd0=_0x44b73a;logger[_0xd5dc('0x26')](_0xd5dc('0x56'),_0x494cd0['id']);return getEndUser(_0x2bfe9f,_0x26a803[_0xd5dc('0x6b')],_0x26a803['destcalleridnum'],_0x6c2b83);})['then'](function(_0x35a0b4){_0x431d0e=_0x35a0b4;logger[_0xd5dc('0x26')](_0xd5dc('0x6c'),_0x431d0e['id']);return getTicket(_0x2bfe9f,_0x494cd0,_0x431d0e,_0x514fb3,_0x26a803,_0x514fb3[_0xd5dc('0x58')],_0x6c2b83,_0xd5dc('0x6d'));})[_0xd5dc('0x38')](function(_0x18de19){_0x477e2c=_0x18de19;logger[_0xd5dc('0x26')](_0xd5dc('0x6e'));logger[_0xd5dc('0x26')](_0xd5dc('0x5a'),_0x477e2c['id']);return setRelationship(_0x6c2b83,_0x494cd0,_0x477e2c,_0xd5dc('0x5b'));})['then'](function(){return setRelationship(_0x6c2b83,_0x431d0e,_0x477e2c,_0xd5dc('0x5c'));})['then'](function(){return getServerInfo(_0x6c2b83);})[_0xd5dc('0x38')](function(_0x5519ef){var _0x5b8d4e=parseInt(_0x5519ef[_0xd5dc('0x5d')]['charAt'](0x0));var _0x103dac=util['format']('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x2bfe9f['remoteUri'],_0x477e2c['id']);if(_0x5b8d4e>0x6){_0x103dac=util[_0xd5dc('0x21')](_0xd5dc('0x60'),_0x2bfe9f['remoteUri'],_0x477e2c['id']);}logger[_0xd5dc('0x26')](_0xd5dc('0x6a'),_0xd5dc('0x62'));emit(util[_0xd5dc('0x21')](_0xd5dc('0x63'),_0x49c6ef[_0xd5dc('0xe')]),_0xd5dc('0x64'),{'uri':_0x103dac});})['catch'](function(_0x3509c1){logger[_0xd5dc('0x66')](_0xd5dc('0x6a'),JSON[_0xd5dc('0x20')](_0x3509c1));});};exports[_0xd5dc('0x6f')]=function(_0x368820,_0x14b3c8,_0x491a0c,_0x380e8a,_0x403ea7,_0x1ac311){var _0xd72ffd,_0x213df4,_0x318275,_0x3b8b40;_0x1ac311[_0xd5dc('0x5f')]=intUtil[_0xd5dc('0x70')](_0x1ac311[_0xd5dc('0x5f')]);_0x1ac311[_0xd5dc('0x4f')]=intUtil[_0xd5dc('0x70')](_0x1ac311[_0xd5dc('0x4f')]);def[_0xd5dc('0x68')]=util[_0xd5dc('0x21')](_0xd5dc('0x50'),_0x1ac311[_0xd5dc('0x5f')]);if(_0x403ea7&&_0x403ea7[_0xd5dc('0x51')]){logger[_0xd5dc('0x26')](_0xd5dc('0x71'),_0xd5dc('0x52'));_0x14b3c8[_0xd5dc('0x53')]=util[_0xd5dc('0x21')](_0xd5dc('0x54'),_0x1ac311[_0xd5dc('0x4f')],_0x14b3c8[_0xd5dc('0x55')],md5(_0x14b3c8[_0xd5dc('0x55')]));}else{_0x14b3c8['recordingURL']='';}return getConnection(_0x1ac311)['then'](function(_0xa46d1d){_0x3b8b40=_0xa46d1d;if(!_['isNil'](_0x380e8a)){return getUser(_0x1ac311,_0x380e8a[_0xd5dc('0xe')],_0x3b8b40);}else{return getUser(_0x1ac311,null,_0x3b8b40);}})[_0xd5dc('0x38')](function(_0x331c1f){_0xd72ffd=_0x331c1f;logger[_0xd5dc('0x26')]('The\x20User\x20ID\x20is:',_0xd72ffd['id']);return getEndUser(_0x1ac311,_0x14b3c8[_0xd5dc('0x57')],_0x14b3c8[_0xd5dc('0x72')],_0x3b8b40);})['then'](function(_0x4967da){_0x213df4=_0x4967da;logger['info'](_0xd5dc('0x6c'),_0x213df4['id']);return getTicket(_0x1ac311,_0xd72ffd,_0x213df4,_0x491a0c,_0x14b3c8,_0x491a0c[_0xd5dc('0x58')],_0x3b8b40,_0xd5dc('0x59'));})[_0xd5dc('0x38')](function(_0x27731f){_0x318275=_0x27731f;logger[_0xd5dc('0x26')](_0xd5dc('0x6e'));logger[_0xd5dc('0x26')](_0xd5dc('0x5a'),_0x318275['id']);return setRelationship(_0x3b8b40,_0xd72ffd,_0x318275,_0xd5dc('0x5b'));})[_0xd5dc('0x38')](function(){return setRelationship(_0x3b8b40,_0x213df4,_0x318275,'contacts');})['then'](function(){return getServerInfo(_0x3b8b40);})[_0xd5dc('0x65')](function(_0x28a26c){logger[_0xd5dc('0x66')](_0xd5dc('0x71'),JSON[_0xd5dc('0x20')](_0x28a26c));});}; \ 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 4534bac..c923cd5 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 _0x07c3=['join','stripTrailingSlash','substring','validateEmail','isNil','util','getString','length','type','string','push','content','variable','variableName','toString','customVariable','Variable','name','toLowerCase','keyType','key','format','%s:\x20%s'];(function(_0x42bc91,_0x41f40a){var _0x3f5507=function(_0x20cfaf){while(--_0x20cfaf){_0x42bc91['push'](_0x42bc91['shift']());}};_0x3f5507(++_0x41f40a);}(_0x07c3,0xeb));var _0x307c=function(_0x289891,_0x49a0fa){_0x289891=_0x289891-0x0;var _0x31cf2e=_0x07c3[_0x289891];return _0x31cf2e;};'use strict';var _=require('lodash');var util=require(_0x307c('0x0'));exports[_0x307c('0x1')]=function(_0x1bbf8e,_0x392467,_0x20c91c){var _0x1eec0d=[];if(_0x1bbf8e[_0x307c('0x2')]>0x0){var _0x469519=_['sortBy'](_0x1bbf8e,['id']);for(var _0x5be162=0x0;_0x5be162<_0x469519[_0x307c('0x2')];_0x5be162++){var _0x51e874=_0x469519[_0x5be162];if(_0x51e874[_0x307c('0x3')]===_0x307c('0x4')){_0x1eec0d[_0x307c('0x5')](_0x51e874[_0x307c('0x6')]);}else if(_0x51e874[_0x307c('0x3')]===_0x307c('0x7')&&_0x51e874[_0x307c('0x8')]){_0x392467[_0x51e874[_0x307c('0x8')]]&&_0x1eec0d[_0x307c('0x5')](_0x392467[_0x51e874[_0x307c('0x8')]][_0x307c('0x9')]());}else if(_0x51e874[_0x307c('0x3')]===_0x307c('0xa')&&_0x51e874[_0x307c('0xb')]&&_0x51e874[_0x307c('0xb')][_0x307c('0xc')]){_0x392467[_0x51e874[_0x307c('0xb')][_0x307c('0xc')][_0x307c('0xd')]()]&&_0x1eec0d[_0x307c('0x5')](_0x392467[_0x51e874[_0x307c('0xb')][_0x307c('0xc')]['toLowerCase']()][_0x307c('0x9')]());}else if(_0x51e874[_0x307c('0x3')]==='keyValue'){if(_0x51e874[_0x307c('0xe')]===_0x307c('0x4')&&_0x51e874[_0x307c('0xf')]){_0x1eec0d['push'](util[_0x307c('0x10')](_0x307c('0x11'),_0x51e874[_0x307c('0xf')],_0x51e874['keyContent']));}else if(_0x51e874[_0x307c('0xe')]===_0x307c('0x7')&&_0x51e874[_0x307c('0x8')]&&_0x51e874[_0x307c('0xf')]){_0x392467[_0x51e874[_0x307c('0x8')]]&&_0x1eec0d[_0x307c('0x5')](util[_0x307c('0x10')]('%s:\x20%s',_0x51e874[_0x307c('0xf')],_0x392467[_0x51e874[_0x307c('0x8')]]));}else if(_0x51e874[_0x307c('0xe')]===_0x307c('0xa')&&_0x51e874[_0x307c('0xb')]&&_0x51e874[_0x307c('0xb')][_0x307c('0xc')]&&_0x51e874['key']){_0x392467[_0x51e874['Variable'][_0x307c('0xc')][_0x307c('0xd')]()]&&_0x1eec0d[_0x307c('0x5')](util[_0x307c('0x10')](_0x307c('0x11'),_0x51e874[_0x307c('0xf')],_0x392467[_0x51e874['Variable'][_0x307c('0xc')][_0x307c('0xd')]()]));}}}}return _0x1eec0d[_0x307c('0x12')](_0x20c91c);};exports[_0x307c('0x13')]=function(_0x2933c5){var _0x55545e=_0x2933c5['slice'](-0x1);if(_0x55545e==='/'){_0x2933c5=_0x2933c5[_0x307c('0x14')](0x0,_0x2933c5['lastIndexOf'](_0x55545e));}return _0x2933c5;};exports[_0x307c('0x15')]=function(_0x3645aa){if(!_[_0x307c('0x16')](_0x3645aa)&&_0x3645aa!==''){var _0x5c5096=/^(([^<>()\[\]\\.,;:\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 _0x5c5096['test'](String(_0x3645aa)['toLowerCase']());}else{return![];}}; \ No newline at end of file +var _0x88fd=['%s:\x20%s','format','keyType','customVariable','join','stripTrailingSlash','slice','substring','validateEmail','isNil','test','lodash','getString','length','sortBy','type','string','content','variable','variableName','push','toString','Variable','name','toLowerCase','keyValue','key'];(function(_0x97a2e4,_0x2495eb){var _0x3fcdb4=function(_0x3e3aa9){while(--_0x3e3aa9){_0x97a2e4['push'](_0x97a2e4['shift']());}};_0x3fcdb4(++_0x2495eb);}(_0x88fd,0xe3));var _0xd88f=function(_0x45bd34,_0x68d447){_0x45bd34=_0x45bd34-0x0;var _0x2d085f=_0x88fd[_0x45bd34];return _0x2d085f;};'use strict';var _=require(_0xd88f('0x0'));var util=require('util');exports[_0xd88f('0x1')]=function(_0x1a0e52,_0x114eeb,_0x33665f){var _0x2ff278=[];if(_0x1a0e52[_0xd88f('0x2')]>0x0){var _0x3c8985=_[_0xd88f('0x3')](_0x1a0e52,['id']);for(var _0x55b5c9=0x0;_0x55b5c9<_0x3c8985[_0xd88f('0x2')];_0x55b5c9++){var _0x547f58=_0x3c8985[_0x55b5c9];if(_0x547f58[_0xd88f('0x4')]===_0xd88f('0x5')){_0x2ff278['push'](_0x547f58[_0xd88f('0x6')]);}else if(_0x547f58[_0xd88f('0x4')]===_0xd88f('0x7')&&_0x547f58[_0xd88f('0x8')]){_0x114eeb[_0x547f58[_0xd88f('0x8')]]&&_0x2ff278[_0xd88f('0x9')](_0x114eeb[_0x547f58[_0xd88f('0x8')]][_0xd88f('0xa')]());}else if(_0x547f58['type']==='customVariable'&&_0x547f58['Variable']&&_0x547f58[_0xd88f('0xb')][_0xd88f('0xc')]){_0x114eeb[_0x547f58[_0xd88f('0xb')][_0xd88f('0xc')][_0xd88f('0xd')]()]&&_0x2ff278['push'](_0x114eeb[_0x547f58[_0xd88f('0xb')]['name'][_0xd88f('0xd')]()][_0xd88f('0xa')]());}else if(_0x547f58['type']===_0xd88f('0xe')){if(_0x547f58['keyType']===_0xd88f('0x5')&&_0x547f58[_0xd88f('0xf')]){_0x2ff278['push'](util['format'](_0xd88f('0x10'),_0x547f58[_0xd88f('0xf')],_0x547f58['keyContent']));}else if(_0x547f58['keyType']===_0xd88f('0x7')&&_0x547f58[_0xd88f('0x8')]&&_0x547f58[_0xd88f('0xf')]){_0x114eeb[_0x547f58[_0xd88f('0x8')]]&&_0x2ff278['push'](util[_0xd88f('0x11')](_0xd88f('0x10'),_0x547f58[_0xd88f('0xf')],_0x114eeb[_0x547f58[_0xd88f('0x8')]]));}else if(_0x547f58[_0xd88f('0x12')]===_0xd88f('0x13')&&_0x547f58[_0xd88f('0xb')]&&_0x547f58[_0xd88f('0xb')]['name']&&_0x547f58[_0xd88f('0xf')]){_0x114eeb[_0x547f58[_0xd88f('0xb')][_0xd88f('0xc')][_0xd88f('0xd')]()]&&_0x2ff278['push'](util[_0xd88f('0x11')]('%s:\x20%s',_0x547f58[_0xd88f('0xf')],_0x114eeb[_0x547f58[_0xd88f('0xb')][_0xd88f('0xc')][_0xd88f('0xd')]()]));}}}}return _0x2ff278[_0xd88f('0x14')](_0x33665f);};exports[_0xd88f('0x15')]=function(_0x51125e){var _0x2e1774=_0x51125e[_0xd88f('0x16')](-0x1);if(_0x2e1774==='/'){_0x51125e=_0x51125e[_0xd88f('0x17')](0x0,_0x51125e['lastIndexOf'](_0x2e1774));}return _0x51125e;};exports[_0xd88f('0x18')]=function(_0x326495){if(!_[_0xd88f('0x19')](_0x326495)&&_0x326495!==''){var _0x481f0c=/^(([^<>()\[\]\\.,;:\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 _0x481f0c[_0xd88f('0x1a')](String(_0x326495)[_0xd88f('0xd')]());}else{return![];}}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/vtiger.js b/server/services/ami/trigger/integration/vtiger.js index 2109bc4..6163fd8 100644 --- a/server/services/ami/trigger/integration/vtiger.js +++ b/server/services/ami/trigger/integration/vtiger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x34e8=['user:%s','trigger:browser:url','[QUEUE]','outbound','serverUrl','recordingFormat','[OUTBOUND]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','monitor_format','[ABANDONED]','lodash','request-promise','bluebird','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','localhost','emit','length','forEach','type','string','idField','content','toString','variable','variableName','customVariable','Variable','name','info','Creating\x20new\x20ticket...','merge','Open','getString','Descriptions','%s/webservice.php','remoteUri','username','sessionName','stringify','then','resolve','result','catch','statusCode','error','[vTiger],\x20%s,\x20%s,\x20%s','validateEmail','GET','format','query','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','admin','getUser','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','Enduser\x20created.','phone','accessKey','success','login','token','Account\x20%d\x20is\x20not\x20valid','[HTTP]','queue','stripTrailingSlash','Recording\x20is\x20enabled!','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','Fields','The\x20Ticket\x20ID\x20is:','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x34e8,0x12c));var _0x834e=function(_0x14c73d,_0x152e3d){_0x14c73d=_0x14c73d-0x0;var _0x49834f=_0x34e8[_0x14c73d];return _0x49834f;};'use strict';var _=require(_0x834e('0x0'));var rp=require(_0x834e('0x1'));var BPromise=require(_0x834e('0x2'));var md5=require(_0x834e('0x3'));var util=require('util');var Redis=require(_0x834e('0x4'));var intUtil=require(_0x834e('0x5'));var config=require(_0x834e('0x6'));var logger=require(_0x834e('0x7'))(_0x834e('0x8'));config[_0x834e('0x9')]=_[_0x834e('0xa')](config['redis'],{'host':_0x834e('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x834e('0x9')]));function emit(_0x3cc2e3,_0x3a3ef6,_0x2e69e2){io['to'](_0x3cc2e3)[_0x834e('0xc')](_0x3a3ef6,_0x2e69e2);}function getCustomFields(_0x23501c,_0x363786){var _0x1af45a={};if(_0x23501c[_0x834e('0xd')]>0x0){_[_0x834e('0xe')](_0x23501c,function(_0x1e41fe){if(_0x1e41fe[_0x834e('0xf')]===_0x834e('0x10')&&_0x1e41fe[_0x834e('0x11')]){_0x1af45a[_0x1e41fe[_0x834e('0x11')]]=_0x1e41fe[_0x834e('0x12')][_0x834e('0x13')]();}else if(_0x1e41fe['type']===_0x834e('0x14')&&_0x1e41fe[_0x834e('0x15')]&&_0x1e41fe['idField']&&_0x363786[_0x1e41fe[_0x834e('0x15')]]){_0x1af45a[_0x1e41fe[_0x834e('0x11')]]=_0x363786[_0x1e41fe[_0x834e('0x15')]][_0x834e('0x13')]();}else if(_0x1e41fe['type']===_0x834e('0x16')&&_0x1e41fe[_0x834e('0x17')]&&_0x1e41fe['Variable'][_0x834e('0x18')]&&_0x1e41fe['idField']&&_0x363786[_0x1e41fe[_0x834e('0x17')][_0x834e('0x18')]['toLowerCase']()]){_0x1af45a[_0x1e41fe[_0x834e('0x11')]]=_0x363786[_0x1e41fe[_0x834e('0x17')][_0x834e('0x18')]['toLowerCase']()][_0x834e('0x13')]();}});}return _0x1af45a;}function createTicket(_0x211e9a,_0x34e41a,_0xb993a1,_0x237947,_0x254677,_0x1dd214,_0x595515){logger[_0x834e('0x19')](_0x834e('0x1a'));var _0x113ff4=_[_0x834e('0x1b')]({'parent_id':'','assigned_user_id':_0x34e41a['id'],'ticketpriorities':'Normal','ticketstatus':_0x834e('0x1c'),'ticket_title':intUtil[_0x834e('0x1d')](_0x237947['Subjects'],_0x254677,'\x20'),'description':intUtil[_0x834e('0x1d')](_0x237947[_0x834e('0x1e')],_0x254677,'\x0a'),'contact_id':_0xb993a1['id']},getCustomFields(_0x1dd214,_0x254677));var _0x8d406e={'method':'POST','uri':util['format'](_0x834e('0x1f'),_0x211e9a[_0x834e('0x20')]),'form':{'operation':'create','username':_0x211e9a[_0x834e('0x21')],'sessionName':_0x595515[_0x834e('0x22')],'elementType':'HelpDesk','element':JSON[_0x834e('0x23')](_0x113ff4)},'json':!![]};return request(_0x8d406e)[_0x834e('0x24')](function(_0x338636){if(_0x338636['success']){return BPromise[_0x834e('0x25')]({'id':_0x338636[_0x834e('0x26')]['id']});}else{throw new Error(util['format']('Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s',JSON[_0x834e('0x23')](_0x338636['error'])));}})[_0x834e('0x27')](function(_0x3f1b0b){var _0x3db026=_0x3f1b0b[_0x834e('0x28')]||0x1f4;logger[_0x834e('0x29')](_0x834e('0x2a'),'createTicket',_0x3db026,JSON['stringify'](_0x3f1b0b));});}function getUser(_0x4dc64a,_0x58c1d7,_0x2c7a8d){if(intUtil[_0x834e('0x2b')](_0x58c1d7)){logger[_0x834e('0x19')]('Getting\x20agent\x20with\x20email',_0x58c1d7);return request({'method':_0x834e('0x2c'),'uri':util[_0x834e('0x2d')](_0x834e('0x1f'),_0x4dc64a[_0x834e('0x20')]),'qs':{'operation':_0x834e('0x2e'),'username':_0x4dc64a[_0x834e('0x21')],'sessionName':_0x2c7a8d[_0x834e('0x22')],'query':util[_0x834e('0x2d')](_0x834e('0x2f'),_0x58c1d7)},'json':!![]})['then'](function(_0xef9ec2){if(_0xef9ec2['success']&&_0xef9ec2[_0x834e('0x26')][_0x834e('0xd')]){logger[_0x834e('0x19')](_0x834e('0x30'));return BPromise[_0x834e('0x25')]({'id':_0xef9ec2[_0x834e('0x26')][0x0]['id'],'email':_0xef9ec2[_0x834e('0x26')][0x0][_0x834e('0x31')],'name':_0xef9ec2[_0x834e('0x26')][0x0][_0x834e('0x32')]+'\x20'+_0xef9ec2['result'][_0x834e('0x33')]});}else{logger[_0x834e('0x19')](_0x834e('0x34'));return BPromise[_0x834e('0x25')]({'id':_0x2c7a8d['userId'],'email':_0x4dc64a[_0x834e('0x21')],'name':_0x834e('0x35')});}})['catch'](function(_0x496533){var _0x59385a=_0x496533[_0x834e('0x28')]||0x1f4;logger[_0x834e('0x29')](_0x834e('0x2a'),_0x834e('0x36'),_0x59385a,JSON[_0x834e('0x23')](_0x496533));});}else{logger[_0x834e('0x19')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x834e('0x25')]({'id':_0x2c7a8d['userId'],'email':_0x4dc64a[_0x834e('0x21')],'name':_0x834e('0x35')})['catch'](function(_0x18ac3b){var _0x2f56c7=_0x18ac3b['statusCode']||0x1f4;logger['error'](_0x834e('0x2a'),_0x834e('0x36'),_0x2f56c7,JSON[_0x834e('0x23')](_0x18ac3b));});}}function getEndUser(_0x130c23,_0x3c49bd,_0x4ca43c,_0x1c5ed6){logger['info']('Searching\x20end\x20user\x20with\x20phone',_0x4ca43c);return request({'method':_0x834e('0x2c'),'uri':util['format'](_0x834e('0x1f'),_0x130c23[_0x834e('0x20')]),'qs':{'operation':_0x834e('0x2e'),'username':_0x130c23[_0x834e('0x21')],'sessionName':_0x1c5ed6[_0x834e('0x22')],'query':util['format'](_0x834e('0x37'),_0x4ca43c,_0x4ca43c,_0x4ca43c,_0x4ca43c,_0x4ca43c)},'json':!![]})[_0x834e('0x24')](function(_0x38f266){if(_0x38f266['success']&&_0x38f266[_0x834e('0x26')][_0x834e('0xd')]){logger['info'](_0x834e('0x38'));return BPromise['resolve']({'id':_0x38f266[_0x834e('0x26')][0x0]['id'],'name':_0x38f266[_0x834e('0x26')][0x0]['firstname']+'\x20'+_0x38f266['result'][0x0][_0x834e('0x39')],'phone':_0x4ca43c});}else{logger[_0x834e('0x19')](_0x834e('0x3a'));return request({'method':_0x834e('0x3b'),'uri':util[_0x834e('0x2d')](_0x834e('0x1f'),_0x130c23[_0x834e('0x20')]),'form':{'operation':'create','sessionName':_0x1c5ed6[_0x834e('0x22')],'elementType':'Contacts','element':JSON[_0x834e('0x23')]({'lastname':_0x3c49bd,'phone':_0x4ca43c,'assigned_user_id':'\x20'})},'json':!![]})['then'](function(_0x1df5b0){logger['info'](_0x834e('0x3c'));return BPromise[_0x834e('0x25')]({'id':_0x1df5b0['result']['id'],'name':_0x1df5b0[_0x834e('0x26')][_0x834e('0x39')],'phone':_0x1df5b0[_0x834e('0x26')][_0x834e('0x3d')]});})[_0x834e('0x27')](function(_0x1a7149){var _0xfa28da=_0x1a7149[_0x834e('0x28')]||0x1f4;logger[_0x834e('0x29')](_0x834e('0x2a'),'getEndUser',_0xfa28da,JSON[_0x834e('0x23')](_0x1a7149));});}});}function getConnection(_0x6fff27){var _0x47a8a9=_0x6fff27[_0x834e('0x21')];var _0x42fd90=_0x6fff27[_0x834e('0x3e')];return request({'method':_0x834e('0x2c'),'uri':util[_0x834e('0x2d')](_0x834e('0x1f'),_0x6fff27['remoteUri']),'qs':{'operation':'getchallenge','username':_0x47a8a9},'json':!![]})[_0x834e('0x24')](function(_0x1a5444){if(_0x1a5444[_0x834e('0x3f')]){return request({'method':_0x834e('0x3b'),'uri':util[_0x834e('0x2d')](_0x834e('0x1f'),_0x6fff27[_0x834e('0x20')]),'form':{'operation':_0x834e('0x40'),'username':_0x47a8a9,'accessKey':md5(_0x1a5444[_0x834e('0x26')][_0x834e('0x41')]+_0x42fd90)},'json':!![]});}})[_0x834e('0x24')](function(_0x385435){if(_0x385435[_0x834e('0x3f')]){return BPromise[_0x834e('0x25')](_0x385435[_0x834e('0x26')]);}else{throw new Error(util[_0x834e('0x2d')](_0x834e('0x42'),_0x6fff27['id']));}})[_0x834e('0x27')](function(_0x420841){var _0x1adf86=_0x420841['statusCode']||0x1f4;logger[_0x834e('0x29')](_0x834e('0x2a'),'getConnection',_0x1adf86,JSON[_0x834e('0x23')](_0x420841));});}function request(_0x3b0988){logger['info'](_0x834e('0x43'),JSON[_0x834e('0x23')](_0x3b0988));return rp(_0x3b0988);}exports[_0x834e('0x44')]=function(_0x35636e,_0x4288e4,_0xb77aab,_0x4549ba,_0x4a8b32,_0x1ad7fe){var _0x8bc6c6,_0x3e0550,_0x363675,_0x86ad2b;_0x1ad7fe[_0x834e('0x20')]=intUtil[_0x834e('0x45')](_0x1ad7fe[_0x834e('0x20')]);if(_0x4a8b32&&_0x4a8b32['monitor_format']){logger[_0x834e('0x19')]('[QUEUE]',_0x834e('0x46'));_0x4288e4['recordingURL']=util[_0x834e('0x2d')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1ad7fe['serverUrl'],_0x4288e4[_0x834e('0x47')],md5(_0x4288e4[_0x834e('0x47')]));}else{_0x4288e4['recordingURL']='';}return getConnection(_0x1ad7fe)['then'](function(_0x2c8155){_0x86ad2b=_0x2c8155;return getUser(_0x1ad7fe,_0x4549ba[_0x834e('0x48')],_0x86ad2b);})[_0x834e('0x24')](function(_0x387365){_0x8bc6c6=_0x387365;logger[_0x834e('0x19')](_0x834e('0x49'),_0x8bc6c6['id']);return getEndUser(_0x1ad7fe,_0x4288e4[_0x834e('0x4a')],_0x4288e4[_0x834e('0x4b')],_0x86ad2b);})['then'](function(_0x142334){_0x3e0550=_0x142334;logger[_0x834e('0x19')]('The\x20Enduser\x20ID\x20is:',_0x3e0550['id']);return createTicket(_0x1ad7fe,_0x8bc6c6,_0x3e0550,_0xb77aab,_0x4288e4,_0xb77aab[_0x834e('0x4c')],_0x86ad2b);})['then'](function(_0x3e58ef){_0x363675=_0x3e58ef;logger[_0x834e('0x19')]('Ticket\x20created!');logger[_0x834e('0x19')](_0x834e('0x4d'),_0x363675['id']);var _0x2de29a=util[_0x834e('0x2d')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x1ad7fe[_0x834e('0x20')],_[_0x834e('0x4e')](_0x363675['id'],'x')[0x1]);logger[_0x834e('0x19')]('[QUEUE]',_0x834e('0x4f'));emit(util[_0x834e('0x2d')](_0x834e('0x50'),_0x4549ba[_0x834e('0x18')]),_0x834e('0x51'),{'uri':_0x2de29a});})[_0x834e('0x27')](function(_0x3a1426){logger[_0x834e('0x29')](_0x834e('0x52'),JSON[_0x834e('0x23')](_0x3a1426));});};exports[_0x834e('0x53')]=function(_0x1dfa95,_0x1b7045,_0x1659c8,_0x460a7a,_0x17b8e3,_0x297cce,_0x14ed83){var _0x193a15,_0x3e3467,_0xed4081,_0x2cb233;_0x297cce['remoteUri']=intUtil[_0x834e('0x45')](_0x297cce[_0x834e('0x20')]);_0x297cce[_0x834e('0x54')]=intUtil[_0x834e('0x45')](_0x297cce['serverUrl']);if(_0x14ed83&&_0x14ed83[_0x834e('0x55')]&&_0x14ed83['recordingFormat']!=='none'){logger[_0x834e('0x19')](_0x834e('0x56'),_0x834e('0x46'));_0x1b7045[_0x834e('0x57')]=util[_0x834e('0x2d')](_0x834e('0x58'),_0x297cce[_0x834e('0x54')],_0x1b7045[_0x834e('0x47')],md5(_0x1b7045['uniqueid']));}return getConnection(_0x297cce)[_0x834e('0x24')](function(_0x5a99e6){_0x2cb233=_0x5a99e6;return getUser(_0x297cce,_0x460a7a[_0x834e('0x48')],_0x2cb233);})[_0x834e('0x24')](function(_0x514fe5){_0x193a15=_0x514fe5;logger['info'](_0x834e('0x49'),_0x193a15['id']);return getEndUser(_0x297cce,_0x1b7045[_0x834e('0x59')],_0x1b7045[_0x834e('0x5a')],_0x2cb233);})[_0x834e('0x24')](function(_0x2c41bd){_0x3e3467=_0x2c41bd;logger['info'](_0x834e('0x5b'),_0x3e3467['id']);return createTicket(_0x297cce,_0x193a15,_0x3e3467,_0x1659c8,_0x1b7045,_0x1659c8[_0x834e('0x4c')],_0x2cb233);})[_0x834e('0x24')](function(_0x228a60){_0xed4081=_0x228a60;logger[_0x834e('0x19')](_0x834e('0x5c'));logger[_0x834e('0x19')](_0x834e('0x4d'),_0xed4081['id']);var _0x376f72=util[_0x834e('0x2d')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x297cce[_0x834e('0x20')],_[_0x834e('0x4e')](_0xed4081['id'],'x')[0x1]);logger[_0x834e('0x19')](_0x834e('0x56'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x834e('0x2d')]('user:%s',_0x460a7a['name']),'trigger:browser:url',{'uri':_0x376f72});})[_0x834e('0x27')](function(_0x332d8f){logger['error'](_0x834e('0x56'),JSON[_0x834e('0x23')](_0x332d8f));});};exports['abandoned']=function(_0x353246,_0x18ccb2,_0x4b88e7,_0x5df169,_0x346be5,_0x2a42a3){var _0x8bc7d9,_0x44c909,_0x1d8e7,_0x493239;_0x2a42a3[_0x834e('0x20')]=intUtil['stripTrailingSlash'](_0x2a42a3[_0x834e('0x20')]);_0x2a42a3[_0x834e('0x54')]=intUtil[_0x834e('0x45')](_0x2a42a3['serverUrl']);if(_0x346be5&&_0x346be5[_0x834e('0x5d')]){logger[_0x834e('0x19')]('[ABANDONED]',_0x834e('0x46'));_0x18ccb2[_0x834e('0x57')]=util[_0x834e('0x2d')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2a42a3[_0x834e('0x54')],_0x18ccb2[_0x834e('0x47')],md5(_0x18ccb2[_0x834e('0x47')]));}else{_0x18ccb2[_0x834e('0x57')]='';}return getConnection(_0x2a42a3)[_0x834e('0x24')](function(_0x29bfd7){_0x493239=_0x29bfd7;return getUser(_0x2a42a3,'',_0x493239);})[_0x834e('0x24')](function(_0x23b5d9){_0x8bc7d9=_0x23b5d9;logger[_0x834e('0x19')](_0x834e('0x49'),_0x8bc7d9['id']);return getEndUser(_0x2a42a3,_0x18ccb2['calleridname'],_0x18ccb2['calleridnum'],_0x493239);})['then'](function(_0x36ede9){_0x44c909=_0x36ede9;logger[_0x834e('0x19')](_0x834e('0x5b'),_0x44c909['id']);return createTicket(_0x2a42a3,_0x8bc7d9,_0x44c909,_0x4b88e7,_0x18ccb2,_0x4b88e7[_0x834e('0x4c')],_0x493239);})[_0x834e('0x24')](function(_0x5758fb){_0x1d8e7=_0x5758fb;logger['info'](_0x834e('0x5c'));logger[_0x834e('0x19')](_0x834e('0x4d'),_0x1d8e7['id']);})[_0x834e('0x27')](function(_0x40a705){logger['error'](_0x834e('0x5e'),JSON[_0x834e('0x23')](_0x40a705));});}; \ No newline at end of file +var _0x9957=['query','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','Agent\x20found!','email1','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','catch','GET','%s/webservice.php','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','lastname','getEndUser','accessKey','login','token','Account\x20%d\x20is\x20not\x20valid','getConnection','queue','stripTrailingSlash','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','Fields','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','split','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','The\x20Enduser\x20ID\x20is:','user:%s','abandoned','[ABANDONED]','Ticket\x20created!','lodash','request-promise','bluebird','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','length','forEach','type','idField','toString','variable','variableName','customVariable','Variable','name','toLowerCase','Creating\x20new\x20ticket...','Normal','Subjects','getString','Descriptions','POST','format','remoteUri','create','username','sessionName','HelpDesk','stringify','then','resolve','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','error','statusCode','[vTiger],\x20%s,\x20%s,\x20%s','createTicket','validateEmail','info','Getting\x20agent\x20with\x20email'];(function(_0x31579f,_0x2db992){var _0x1a96e9=function(_0xabdb78){while(--_0xabdb78){_0x31579f['push'](_0x31579f['shift']());}};_0x1a96e9(++_0x2db992);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require(_0x7995('0x0'));var rp=require(_0x7995('0x1'));var BPromise=require(_0x7995('0x2'));var md5=require(_0x7995('0x3'));var util=require('util');var Redis=require(_0x7995('0x4'));var intUtil=require(_0x7995('0x5'));var config=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('vTiger');config[_0x7995('0x8')]=_[_0x7995('0x9')](config[_0x7995('0x8')],{'host':_0x7995('0xa'),'port':0x18eb});var io=require(_0x7995('0xb'))(new Redis(config[_0x7995('0x8')]));function emit(_0x4996ca,_0x465276,_0x1cad37){io['to'](_0x4996ca)['emit'](_0x465276,_0x1cad37);}function getCustomFields(_0xa2e5f0,_0x3116fb){var _0x18c8a3={};if(_0xa2e5f0[_0x7995('0xc')]>0x0){_[_0x7995('0xd')](_0xa2e5f0,function(_0x1e400a){if(_0x1e400a[_0x7995('0xe')]==='string'&&_0x1e400a[_0x7995('0xf')]){_0x18c8a3[_0x1e400a[_0x7995('0xf')]]=_0x1e400a['content'][_0x7995('0x10')]();}else if(_0x1e400a[_0x7995('0xe')]===_0x7995('0x11')&&_0x1e400a[_0x7995('0x12')]&&_0x1e400a[_0x7995('0xf')]&&_0x3116fb[_0x1e400a[_0x7995('0x12')]]){_0x18c8a3[_0x1e400a[_0x7995('0xf')]]=_0x3116fb[_0x1e400a['variableName']]['toString']();}else if(_0x1e400a[_0x7995('0xe')]===_0x7995('0x13')&&_0x1e400a[_0x7995('0x14')]&&_0x1e400a[_0x7995('0x14')][_0x7995('0x15')]&&_0x1e400a[_0x7995('0xf')]&&_0x3116fb[_0x1e400a[_0x7995('0x14')][_0x7995('0x15')]['toLowerCase']()]){_0x18c8a3[_0x1e400a[_0x7995('0xf')]]=_0x3116fb[_0x1e400a['Variable'][_0x7995('0x15')][_0x7995('0x16')]()][_0x7995('0x10')]();}});}return _0x18c8a3;}function createTicket(_0x291317,_0x1e1415,_0x37a7d4,_0x4faa60,_0x54c9ae,_0x2536c8,_0x5e6f90){logger['info'](_0x7995('0x17'));var _0x3d463e=_['merge']({'parent_id':'','assigned_user_id':_0x1e1415['id'],'ticketpriorities':_0x7995('0x18'),'ticketstatus':'Open','ticket_title':intUtil['getString'](_0x4faa60[_0x7995('0x19')],_0x54c9ae,'\x20'),'description':intUtil[_0x7995('0x1a')](_0x4faa60[_0x7995('0x1b')],_0x54c9ae,'\x0a'),'contact_id':_0x37a7d4['id']},getCustomFields(_0x2536c8,_0x54c9ae));var _0x1a8568={'method':_0x7995('0x1c'),'uri':util[_0x7995('0x1d')]('%s/webservice.php',_0x291317[_0x7995('0x1e')]),'form':{'operation':_0x7995('0x1f'),'username':_0x291317[_0x7995('0x20')],'sessionName':_0x5e6f90[_0x7995('0x21')],'elementType':_0x7995('0x22'),'element':JSON[_0x7995('0x23')](_0x3d463e)},'json':!![]};return request(_0x1a8568)[_0x7995('0x24')](function(_0x472195){if(_0x472195['success']){return BPromise[_0x7995('0x25')]({'id':_0x472195[_0x7995('0x26')]['id']});}else{throw new Error(util[_0x7995('0x1d')](_0x7995('0x27'),JSON[_0x7995('0x23')](_0x472195[_0x7995('0x28')])));}})['catch'](function(_0x47625f){var _0x5911c3=_0x47625f[_0x7995('0x29')]||0x1f4;logger[_0x7995('0x28')](_0x7995('0x2a'),_0x7995('0x2b'),_0x5911c3,JSON[_0x7995('0x23')](_0x47625f));});}function getUser(_0x4b6f99,_0x9b2a15,_0x514445){if(intUtil[_0x7995('0x2c')](_0x9b2a15)){logger[_0x7995('0x2d')](_0x7995('0x2e'),_0x9b2a15);return request({'method':'GET','uri':util['format']('%s/webservice.php',_0x4b6f99[_0x7995('0x1e')]),'qs':{'operation':_0x7995('0x2f'),'username':_0x4b6f99[_0x7995('0x20')],'sessionName':_0x514445[_0x7995('0x21')],'query':util[_0x7995('0x1d')](_0x7995('0x30'),_0x9b2a15)},'json':!![]})['then'](function(_0x481c74){if(_0x481c74[_0x7995('0x31')]&&_0x481c74['result'][_0x7995('0xc')]){logger[_0x7995('0x2d')](_0x7995('0x32'));return BPromise[_0x7995('0x25')]({'id':_0x481c74[_0x7995('0x26')][0x0]['id'],'email':_0x481c74['result'][0x0][_0x7995('0x33')],'name':_0x481c74[_0x7995('0x26')][0x0]['first_name']+'\x20'+_0x481c74['result']['last_name']});}else{logger[_0x7995('0x2d')](_0x7995('0x34'));return BPromise['resolve']({'id':_0x514445[_0x7995('0x35')],'email':_0x4b6f99['username'],'name':_0x7995('0x36')});}})[_0x7995('0x37')](function(_0x177cb4){var _0x5014d2=_0x177cb4['statusCode']||0x1f4;logger[_0x7995('0x28')]('[vTiger],\x20%s,\x20%s,\x20%s','getUser',_0x5014d2,JSON[_0x7995('0x23')](_0x177cb4));});}else{logger[_0x7995('0x2d')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x7995('0x25')]({'id':_0x514445[_0x7995('0x35')],'email':_0x4b6f99[_0x7995('0x20')],'name':_0x7995('0x36')})[_0x7995('0x37')](function(_0x53002a){var _0x2d4285=_0x53002a[_0x7995('0x29')]||0x1f4;logger[_0x7995('0x28')](_0x7995('0x2a'),'getUser',_0x2d4285,JSON[_0x7995('0x23')](_0x53002a));});}}function getEndUser(_0x235df7,_0x3eb04f,_0xe5ea43,_0x1f5bee){logger[_0x7995('0x2d')]('Searching\x20end\x20user\x20with\x20phone',_0xe5ea43);return request({'method':_0x7995('0x38'),'uri':util[_0x7995('0x1d')](_0x7995('0x39'),_0x235df7[_0x7995('0x1e')]),'qs':{'operation':_0x7995('0x2f'),'username':_0x235df7[_0x7995('0x20')],'sessionName':_0x1f5bee[_0x7995('0x21')],'query':util[_0x7995('0x1d')](_0x7995('0x3a'),_0xe5ea43,_0xe5ea43,_0xe5ea43,_0xe5ea43,_0xe5ea43)},'json':!![]})[_0x7995('0x24')](function(_0x6fe77b){if(_0x6fe77b[_0x7995('0x31')]&&_0x6fe77b[_0x7995('0x26')]['length']){logger['info'](_0x7995('0x3b'));return BPromise[_0x7995('0x25')]({'id':_0x6fe77b['result'][0x0]['id'],'name':_0x6fe77b['result'][0x0][_0x7995('0x3c')]+'\x20'+_0x6fe77b['result'][0x0]['lastname'],'phone':_0xe5ea43});}else{logger[_0x7995('0x2d')](_0x7995('0x3d'));return request({'method':_0x7995('0x1c'),'uri':util['format'](_0x7995('0x39'),_0x235df7['remoteUri']),'form':{'operation':_0x7995('0x1f'),'sessionName':_0x1f5bee['sessionName'],'elementType':'Contacts','element':JSON[_0x7995('0x23')]({'lastname':_0x3eb04f,'phone':_0xe5ea43,'assigned_user_id':'\x20'})},'json':!![]})[_0x7995('0x24')](function(_0xc04e5){logger[_0x7995('0x2d')]('Enduser\x20created.');return BPromise[_0x7995('0x25')]({'id':_0xc04e5[_0x7995('0x26')]['id'],'name':_0xc04e5[_0x7995('0x26')][_0x7995('0x3e')],'phone':_0xc04e5['result']['phone']});})[_0x7995('0x37')](function(_0x55791b){var _0x23c41d=_0x55791b['statusCode']||0x1f4;logger[_0x7995('0x28')]('[vTiger],\x20%s,\x20%s,\x20%s',_0x7995('0x3f'),_0x23c41d,JSON[_0x7995('0x23')](_0x55791b));});}});}function getConnection(_0x4d9245){var _0x3e9e62=_0x4d9245[_0x7995('0x20')];var _0x314145=_0x4d9245[_0x7995('0x40')];return request({'method':'GET','uri':util[_0x7995('0x1d')](_0x7995('0x39'),_0x4d9245[_0x7995('0x1e')]),'qs':{'operation':'getchallenge','username':_0x3e9e62},'json':!![]})[_0x7995('0x24')](function(_0x44f516){if(_0x44f516[_0x7995('0x31')]){return request({'method':_0x7995('0x1c'),'uri':util[_0x7995('0x1d')]('%s/webservice.php',_0x4d9245[_0x7995('0x1e')]),'form':{'operation':_0x7995('0x41'),'username':_0x3e9e62,'accessKey':md5(_0x44f516['result'][_0x7995('0x42')]+_0x314145)},'json':!![]});}})['then'](function(_0x1d87f9){if(_0x1d87f9[_0x7995('0x31')]){return BPromise[_0x7995('0x25')](_0x1d87f9[_0x7995('0x26')]);}else{throw new Error(util[_0x7995('0x1d')](_0x7995('0x43'),_0x4d9245['id']));}})[_0x7995('0x37')](function(_0x4d46bc){var _0x427dcf=_0x4d46bc[_0x7995('0x29')]||0x1f4;logger[_0x7995('0x28')]('[vTiger],\x20%s,\x20%s,\x20%s',_0x7995('0x44'),_0x427dcf,JSON[_0x7995('0x23')](_0x4d46bc));});}function request(_0x12d4b8){logger['info']('[HTTP]',JSON['stringify'](_0x12d4b8));return rp(_0x12d4b8);}exports[_0x7995('0x45')]=function(_0x1fd1ca,_0x4cf5db,_0x1cd85,_0x29f300,_0x31f27c,_0x1a9bd7){var _0xc04004,_0x528c8e,_0x29ee32,_0x4ab09f;_0x1a9bd7[_0x7995('0x1e')]=intUtil[_0x7995('0x46')](_0x1a9bd7[_0x7995('0x1e')]);if(_0x31f27c&&_0x31f27c['monitor_format']){logger['info']('[QUEUE]','Recording\x20is\x20enabled!');_0x4cf5db[_0x7995('0x47')]=util[_0x7995('0x1d')](_0x7995('0x48'),_0x1a9bd7[_0x7995('0x49')],_0x4cf5db[_0x7995('0x4a')],md5(_0x4cf5db[_0x7995('0x4a')]));}else{_0x4cf5db[_0x7995('0x47')]='';}return getConnection(_0x1a9bd7)[_0x7995('0x24')](function(_0x328671){_0x4ab09f=_0x328671;return getUser(_0x1a9bd7,_0x29f300[_0x7995('0x4b')],_0x4ab09f);})[_0x7995('0x24')](function(_0x133c63){_0xc04004=_0x133c63;logger[_0x7995('0x2d')](_0x7995('0x4c'),_0xc04004['id']);return getEndUser(_0x1a9bd7,_0x4cf5db[_0x7995('0x4d')],_0x4cf5db[_0x7995('0x4e')],_0x4ab09f);})[_0x7995('0x24')](function(_0x223e08){_0x528c8e=_0x223e08;logger[_0x7995('0x2d')]('The\x20Enduser\x20ID\x20is:',_0x528c8e['id']);return createTicket(_0x1a9bd7,_0xc04004,_0x528c8e,_0x1cd85,_0x4cf5db,_0x1cd85[_0x7995('0x4f')],_0x4ab09f);})[_0x7995('0x24')](function(_0x3b8a54){_0x29ee32=_0x3b8a54;logger[_0x7995('0x2d')]('Ticket\x20created!');logger['info'](_0x7995('0x50'),_0x29ee32['id']);var _0x197b52=util[_0x7995('0x1d')](_0x7995('0x51'),_0x1a9bd7['remoteUri'],_[_0x7995('0x52')](_0x29ee32['id'],'x')[0x1]);logger[_0x7995('0x2d')](_0x7995('0x53'),_0x7995('0x54'));emit(util['format']('user:%s',_0x29f300[_0x7995('0x15')]),_0x7995('0x55'),{'uri':_0x197b52});})[_0x7995('0x37')](function(_0x1d69ce){logger[_0x7995('0x28')](_0x7995('0x53'),JSON[_0x7995('0x23')](_0x1d69ce));});};exports[_0x7995('0x56')]=function(_0x984c23,_0x50caf5,_0x18f230,_0x3ec5a8,_0xdf9e38,_0x1ecfdb,_0x59c5aa){var _0x51bf6a,_0x3053fd,_0xebb5c8,_0x47d5d7;_0x1ecfdb[_0x7995('0x1e')]=intUtil[_0x7995('0x46')](_0x1ecfdb[_0x7995('0x1e')]);_0x1ecfdb[_0x7995('0x49')]=intUtil[_0x7995('0x46')](_0x1ecfdb['serverUrl']);if(_0x59c5aa&&_0x59c5aa[_0x7995('0x57')]&&_0x59c5aa['recordingFormat']!==_0x7995('0x58')){logger[_0x7995('0x2d')](_0x7995('0x59'),_0x7995('0x5a'));_0x50caf5[_0x7995('0x47')]=util[_0x7995('0x1d')](_0x7995('0x48'),_0x1ecfdb[_0x7995('0x49')],_0x50caf5[_0x7995('0x4a')],md5(_0x50caf5[_0x7995('0x4a')]));}return getConnection(_0x1ecfdb)[_0x7995('0x24')](function(_0x234d8d){_0x47d5d7=_0x234d8d;return getUser(_0x1ecfdb,_0x3ec5a8['email'],_0x47d5d7);})[_0x7995('0x24')](function(_0x23bbc1){_0x51bf6a=_0x23bbc1;logger[_0x7995('0x2d')](_0x7995('0x4c'),_0x51bf6a['id']);return getEndUser(_0x1ecfdb,_0x50caf5[_0x7995('0x5b')],_0x50caf5['destcalleridnum'],_0x47d5d7);})['then'](function(_0x268fde){_0x3053fd=_0x268fde;logger[_0x7995('0x2d')](_0x7995('0x5c'),_0x3053fd['id']);return createTicket(_0x1ecfdb,_0x51bf6a,_0x3053fd,_0x18f230,_0x50caf5,_0x18f230[_0x7995('0x4f')],_0x47d5d7);})['then'](function(_0x22d317){_0xebb5c8=_0x22d317;logger['info']('Ticket\x20created!');logger[_0x7995('0x2d')](_0x7995('0x50'),_0xebb5c8['id']);var _0x3f0a71=util[_0x7995('0x1d')](_0x7995('0x51'),_0x1ecfdb[_0x7995('0x1e')],_[_0x7995('0x52')](_0xebb5c8['id'],'x')[0x1]);logger[_0x7995('0x2d')](_0x7995('0x59'),_0x7995('0x54'));emit(util['format'](_0x7995('0x5d'),_0x3ec5a8[_0x7995('0x15')]),_0x7995('0x55'),{'uri':_0x3f0a71});})['catch'](function(_0x1fe1cb){logger[_0x7995('0x28')](_0x7995('0x59'),JSON[_0x7995('0x23')](_0x1fe1cb));});};exports[_0x7995('0x5e')]=function(_0x51ab1e,_0x550a10,_0x3adfd2,_0x2f94c4,_0x1fdff6,_0x435a1b){var _0x535131,_0x5e8b4c,_0xd07c1c,_0xfe1105;_0x435a1b[_0x7995('0x1e')]=intUtil[_0x7995('0x46')](_0x435a1b['remoteUri']);_0x435a1b[_0x7995('0x49')]=intUtil[_0x7995('0x46')](_0x435a1b['serverUrl']);if(_0x1fdff6&&_0x1fdff6['monitor_format']){logger[_0x7995('0x2d')](_0x7995('0x5f'),'Recording\x20is\x20enabled!');_0x550a10[_0x7995('0x47')]=util['format'](_0x7995('0x48'),_0x435a1b[_0x7995('0x49')],_0x550a10['uniqueid'],md5(_0x550a10['uniqueid']));}else{_0x550a10[_0x7995('0x47')]='';}return getConnection(_0x435a1b)['then'](function(_0x31b9e6){_0xfe1105=_0x31b9e6;return getUser(_0x435a1b,'',_0xfe1105);})[_0x7995('0x24')](function(_0x3dd197){_0x535131=_0x3dd197;logger[_0x7995('0x2d')](_0x7995('0x4c'),_0x535131['id']);return getEndUser(_0x435a1b,_0x550a10[_0x7995('0x4d')],_0x550a10[_0x7995('0x4e')],_0xfe1105);})[_0x7995('0x24')](function(_0x29e0ee){_0x5e8b4c=_0x29e0ee;logger[_0x7995('0x2d')](_0x7995('0x5c'),_0x5e8b4c['id']);return createTicket(_0x435a1b,_0x535131,_0x5e8b4c,_0x3adfd2,_0x550a10,_0x3adfd2[_0x7995('0x4f')],_0xfe1105);})[_0x7995('0x24')](function(_0x1ff436){_0xd07c1c=_0x1ff436;logger[_0x7995('0x2d')](_0x7995('0x60'));logger[_0x7995('0x2d')](_0x7995('0x50'),_0xd07c1c['id']);})[_0x7995('0x37')](function(_0xa2fc8e){logger[_0x7995('0x28')](_0x7995('0x5f'),JSON[_0x7995('0x23')](_0xa2fc8e));});}; \ 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 cc728b5..7b86f41 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 _0xd5ec=['agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','user','type:user\x20role:end-user\x20phone:%s','length','filter','end-user','first','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Enduser\x20created.','authType','password','%s:%s','token','%s/token:%s','username','Basic\x20%s','toString','base64','[HTTP]','stringify','GET','map','forEach','type','string','nameField','customField','toLowerCase','content','idField','custom_fields','push','variable','variableName','customVariable','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','trigger:browser:url','%s/agent/tickets/%s','Zendesk\x20account\x20type\x20not\x20recognized','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','none','[OUTBOUND]','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','error','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','abandoned','[ABANDONED]','[ABANDONED]\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','md5','util','./util','../../../../config/environment','../../../../config/logger','zendesk','redis','defaults','localhost','socket.io-emitter','emit','application/json','Creating\x20new\x20ticket...','%s/tickets.json','remoteUri','POST','Tags','name','getString','Descriptions','Fields','then','info','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','format','%s/search.json','type:user\x20role:agent\x20email:%s','Agent\x20found!','results'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xd5ec,0xb8));var _0xcd5e=function(_0x383356,_0x33d2f5){_0x383356=_0x383356-0x0;var _0x32ee5a=_0xd5ec[_0x383356];return _0x32ee5a;};'use strict';var _=require(_0xcd5e('0x0'));var rp=require(_0xcd5e('0x1'));var md5=require(_0xcd5e('0x2'));var util=require(_0xcd5e('0x3'));var Redis=require('ioredis');var intUtil=require(_0xcd5e('0x4'));var config=require(_0xcd5e('0x5'));var logger=require(_0xcd5e('0x6'))(_0xcd5e('0x7'));config[_0xcd5e('0x8')]=_[_0xcd5e('0x9')](config[_0xcd5e('0x8')],{'host':_0xcd5e('0xa'),'port':0x18eb});var io=require(_0xcd5e('0xb'))(new Redis(config[_0xcd5e('0x8')]));function emit(_0x111456,_0x4e90b7,_0x52ce05){io['to'](_0x111456)[_0xcd5e('0xc')](_0x4e90b7,_0x52ce05);}var headers={'Content-Type':_0xcd5e('0xd'),'Accept':_0xcd5e('0xd')};function getTicket(_0x4da8e3,_0x19d97f,_0x20ca0a,_0x281e7e,_0x3c04fc){logger['info'](_0xcd5e('0xe'));return request({'uri':util['format'](_0xcd5e('0xf'),_0x4da8e3[_0xcd5e('0x10')]),'method':_0xcd5e('0x11'),'body':{'ticket':_['merge']({'requester_id':_0x20ca0a['id'],'submitter_id':_0x19d97f?_0x19d97f['id']:undefined,'assignee_id':_0x19d97f?_0x19d97f['id']:undefined,'tags':getTags(_0x281e7e[_0xcd5e('0x12')],_0xcd5e('0x13')),'subject':intUtil[_0xcd5e('0x14')](_0x281e7e['Subjects'],_0x3c04fc,'\x20'),'description':intUtil[_0xcd5e('0x14')](_0x281e7e[_0xcd5e('0x15')],_0x3c04fc,'\x0a'),'comment':{'public':![],'body':intUtil[_0xcd5e('0x14')](_0x281e7e[_0xcd5e('0x15')],_0x3c04fc,'\x0a')}},getCustomFields(_0x281e7e[_0xcd5e('0x16')],_0x3c04fc))}})[_0xcd5e('0x17')](function(_0x5a17c8){logger[_0xcd5e('0x18')](_0xcd5e('0x19'));return _0x5a17c8[_0xcd5e('0x1a')];});}function getUser(_0x4fdb02,_0x493cb5){if(intUtil[_0xcd5e('0x1b')](_0x493cb5)){logger['info'](_0xcd5e('0x1c'),_0x493cb5);return request({'uri':util[_0xcd5e('0x1d')](_0xcd5e('0x1e'),_0x4fdb02[_0xcd5e('0x10')]),'qs':{'query':util[_0xcd5e('0x1d')](_0xcd5e('0x1f'),_0x493cb5)}})[_0xcd5e('0x17')](function(_0x315ee){if(_0x315ee['count']){logger[_0xcd5e('0x18')](_0xcd5e('0x20'));return _['find'](_0x315ee[_0xcd5e('0x21')],{'email':_0x493cb5,'role':_0xcd5e('0x22')});}else{logger[_0xcd5e('0x18')](_0xcd5e('0x23'));return request({'uri':util['format'](_0xcd5e('0x24'),_0x4fdb02[_0xcd5e('0x10')])})[_0xcd5e('0x17')](function(_0x49305e){logger['info'](_0xcd5e('0x25'));return _0x49305e[_0xcd5e('0x26')];});}});}else{logger[_0xcd5e('0x18')](_0xcd5e('0x23'));return request({'uri':util[_0xcd5e('0x1d')](_0xcd5e('0x24'),_0x4fdb02[_0xcd5e('0x10')])})['then'](function(_0x3a05f9){logger[_0xcd5e('0x18')](_0xcd5e('0x25'));return _0x3a05f9[_0xcd5e('0x26')];});}}function getEndUser(_0x57e339,_0x3053cf,_0x3706ed){logger[_0xcd5e('0x18')]('Searching\x20enduser\x20with\x20phone',_0x3706ed);return request({'uri':util[_0xcd5e('0x1d')](_0xcd5e('0x1e'),_0x57e339[_0xcd5e('0x10')]),'qs':{'query':util[_0xcd5e('0x1d')](_0xcd5e('0x27'),_0x3706ed)}})[_0xcd5e('0x17')](function(_0x572527){var _0x5a4539;if(_0x572527[_0xcd5e('0x21')][_0xcd5e('0x28')]){_0x572527[_0xcd5e('0x21')]=_[_0xcd5e('0x29')](_0x572527[_0xcd5e('0x21')],{'suspended':![],'role':_0xcd5e('0x2a')});if(_0x572527[_0xcd5e('0x21')][_0xcd5e('0x28')]){_0x5a4539=_[_0xcd5e('0x2b')](_0x572527['results']);}}if(_0x5a4539){logger['info']('Enduser\x20found!');return _0x5a4539;}else{logger[_0xcd5e('0x18')](_0xcd5e('0x2c'));return request({'uri':util['format'](_0xcd5e('0x2d'),_0x57e339['remoteUri']),'method':_0xcd5e('0x11'),'body':{'user':{'role':_0xcd5e('0x2a'),'name':util[_0xcd5e('0x1d')]('Caller\x20-\x20%s',_0x3053cf||_0x3706ed),'phone':_0x3706ed}}})[_0xcd5e('0x17')](function(_0x3c2d2b){logger[_0xcd5e('0x18')](_0xcd5e('0x2e'));return _0x3c2d2b[_0xcd5e('0x26')];});}});}function getAuth(_0x49f356){var _0x1538bf;if(_0x49f356[_0xcd5e('0x2f')]===_0xcd5e('0x30')){_0x1538bf=util[_0xcd5e('0x1d')](_0xcd5e('0x31'),_0x49f356['username'],_0x49f356[_0xcd5e('0x30')]);}else if(_0x49f356[_0xcd5e('0x2f')]===_0xcd5e('0x32')){_0x1538bf=util[_0xcd5e('0x1d')](_0xcd5e('0x33'),_0x49f356[_0xcd5e('0x34')],_0x49f356[_0xcd5e('0x32')]);}return util[_0xcd5e('0x1d')](_0xcd5e('0x35'),new Buffer(_0x1538bf)[_0xcd5e('0x36')](_0xcd5e('0x37')));}function request(_0x1af318){logger['debug'](_0xcd5e('0x38'),JSON[_0xcd5e('0x39')](_0x1af318));return rp(_[_0xcd5e('0x9')](_0x1af318,{'method':_0xcd5e('0x3a'),'headers':headers,'json':!![]}));}function getTags(_0x34e3b1,_0x39eea1){var _0xd427c5=[];if(_0x34e3b1&&_0x34e3b1[_0xcd5e('0x28')]>0x0){_0xd427c5=_[_0xcd5e('0x3b')](_0x34e3b1,_0x39eea1);}return _0xd427c5;}function getCustomFields(_0x20e108,_0x2980dd){var _0x3e01cb=[];var _0x1ddb57={'custom_fields':[]};if(_0x20e108[_0xcd5e('0x28')]>0x0){_[_0xcd5e('0x3c')](_0x20e108,function(_0x512266){if(_0x512266[_0xcd5e('0x3d')]===_0xcd5e('0x3e')&&_0x512266[_0xcd5e('0x3f')]&&!_0x512266[_0xcd5e('0x40')]){_0x1ddb57[_0x512266[_0xcd5e('0x3f')][_0xcd5e('0x41')]()]=_0x512266[_0xcd5e('0x42')][_0xcd5e('0x36')]();}else if(_0x512266[_0xcd5e('0x3d')]===_0xcd5e('0x3e')&&_0x512266[_0xcd5e('0x43')]&&_0x512266[_0xcd5e('0x40')]){_0x1ddb57[_0xcd5e('0x44')][_0xcd5e('0x45')]({'id':_0x512266[_0xcd5e('0x43')],'value':_0x512266['content']['toString']()});}else if(_0x512266[_0xcd5e('0x3d')]===_0xcd5e('0x46')&&_0x512266['variableName']&&_0x512266[_0xcd5e('0x43')]&&_0x512266[_0xcd5e('0x40')]){_0x2980dd[_0x512266['variableName']]&&_0x1ddb57['custom_fields'][_0xcd5e('0x45')]({'id':_0x512266[_0xcd5e('0x43')],'value':_0x2980dd[_0x512266[_0xcd5e('0x47')]][_0xcd5e('0x36')]()});}else if(_0x512266['type']===_0xcd5e('0x48')&&_0x512266[_0xcd5e('0x49')]&&_0x512266[_0xcd5e('0x49')][_0xcd5e('0x13')]&&_0x512266[_0xcd5e('0x43')]&&_0x512266[_0xcd5e('0x40')]){_0x2980dd[_0x512266['Variable'][_0xcd5e('0x13')][_0xcd5e('0x41')]()]&&_0x1ddb57[_0xcd5e('0x44')][_0xcd5e('0x45')]({'id':_0x512266[_0xcd5e('0x43')],'value':_0x2980dd[_0x512266['Variable'][_0xcd5e('0x13')][_0xcd5e('0x41')]()]['toString']()});}});}return _0x1ddb57;}exports[_0xcd5e('0x4a')]=function(_0x37b602,_0x16b417,_0x30e78b,_0x138510,_0xac1c07,_0xca5628){var _0x4968e9,_0x4d8436;_0xca5628[_0xcd5e('0x10')]=intUtil[_0xcd5e('0x4b')](_0xca5628['remoteUri']);_0xca5628[_0xcd5e('0x4c')]=intUtil[_0xcd5e('0x4b')](_0xca5628['serverUrl']);if(_0xac1c07&&_0xac1c07[_0xcd5e('0x4d')]){logger[_0xcd5e('0x18')](_0xcd5e('0x4e'),_0xcd5e('0x4f'));_0x16b417['recordingURL']=util['format'](_0xcd5e('0x50'),_0xca5628[_0xcd5e('0x4c')],_0x16b417[_0xcd5e('0x51')],md5(_0x16b417[_0xcd5e('0x51')]));}else{_0x16b417[_0xcd5e('0x52')]='';}headers[_0xcd5e('0x53')]=getAuth(_0xca5628);return getUser(_0xca5628,_0x138510[_0xcd5e('0x54')])['then'](function(_0x9a250e){_0x4968e9=_0x9a250e;logger[_0xcd5e('0x18')](_0xcd5e('0x55'),_0x4968e9['id']);return getEndUser(_0xca5628,_0x16b417[_0xcd5e('0x56')],_0x16b417[_0xcd5e('0x57')]);})[_0xcd5e('0x17')](function(_0x21816c){_0x4d8436=_0x21816c;logger['info'](_0xcd5e('0x58'),_0x4d8436['id']);return getTicket(_0xca5628,_0x4968e9,_0x4d8436,_0x30e78b,_0x16b417);})[_0xcd5e('0x17')](function(_0x57802f){if(_0x57802f){logger['info'](_0xcd5e('0x59'),_0x57802f['id']);switch(_0xca5628[_0xcd5e('0x3d')]){case _0xcd5e('0x5a'):logger[_0xcd5e('0x18')](_0xcd5e('0x4e'),_0xcd5e('0x5b'));return request({'uri':util[_0xcd5e('0x1d')](_0xcd5e('0x5c'),_0xca5628[_0xcd5e('0x10')],_0x4968e9['id'],_0x57802f['id']),'method':_0xcd5e('0x11')});case'newTab':logger[_0xcd5e('0x18')](_0xcd5e('0x4e'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format']('user:%s',_0x138510[_0xcd5e('0x13')]),_0xcd5e('0x5d'),{'uri':util['format'](_0xcd5e('0x5e'),_0xca5628[_0xcd5e('0x10')],_0x57802f['id'])});break;default:logger['error']('[QUEUE]',_0xcd5e('0x5f'));}}})['catch'](function(_0x3a3e58){logger['error'](_0xcd5e('0x60'),util[_0xcd5e('0x61')](_0x3a3e58,{'showHidden':!![],'depth':null}));});};exports[_0xcd5e('0x62')]=function(_0x4e5f0c,_0x3a23d5,_0x5a60d6,_0x7c74bb,_0x54babc,_0x6b946d,_0x3dd5c7){var _0x437f1e,_0x49089d;_0x6b946d[_0xcd5e('0x10')]=intUtil[_0xcd5e('0x4b')](_0x6b946d[_0xcd5e('0x10')]);_0x6b946d[_0xcd5e('0x4c')]=intUtil[_0xcd5e('0x4b')](_0x6b946d[_0xcd5e('0x4c')]);if(_0x3dd5c7&&_0x3dd5c7[_0xcd5e('0x63')]&&_0x3dd5c7[_0xcd5e('0x63')]!==_0xcd5e('0x64')){logger[_0xcd5e('0x18')](_0xcd5e('0x65'),_0xcd5e('0x4f'));_0x3a23d5[_0xcd5e('0x52')]=util[_0xcd5e('0x1d')](_0xcd5e('0x50'),_0x6b946d[_0xcd5e('0x4c')],_0x3a23d5[_0xcd5e('0x51')],md5(_0x3a23d5[_0xcd5e('0x51')]));}headers['Authorization']=getAuth(_0x6b946d);return getUser(_0x6b946d,_0x7c74bb[_0xcd5e('0x54')])['then'](function(_0x2b1cd4){_0x437f1e=_0x2b1cd4;logger[_0xcd5e('0x18')](_0xcd5e('0x55'),_0x437f1e['id']);return getEndUser(_0x6b946d,_0x3a23d5['destcalleridname'],_0x3a23d5['destcalleridnum']);})[_0xcd5e('0x17')](function(_0x28ea2e){_0x49089d=_0x28ea2e;logger[_0xcd5e('0x18')](_0xcd5e('0x58'),_0x49089d['id']);return getTicket(_0x6b946d,_0x437f1e,_0x49089d,_0x5a60d6,_0x3a23d5);})['then'](function(_0x5c1b79){if(_0x5c1b79){logger[_0xcd5e('0x18')](_0xcd5e('0x59'),_0x5c1b79['id']);switch(_0x6b946d[_0xcd5e('0x3d')]){case _0xcd5e('0x5a'):logger['info']('[OUTBOUND]','Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0xcd5e('0x1d')](_0xcd5e('0x5c'),_0x6b946d['remoteUri'],_0x437f1e['id'],_0x5c1b79['id']),'method':'POST'});case _0xcd5e('0x66'):logger[_0xcd5e('0x18')](_0xcd5e('0x65'),_0xcd5e('0x67'));emit(util[_0xcd5e('0x1d')]('user:%s',_0x7c74bb[_0xcd5e('0x13')]),_0xcd5e('0x5d'),{'uri':util[_0xcd5e('0x1d')]('%s/agent/tickets/%s',_0x6b946d[_0xcd5e('0x10')],_0x5c1b79['id'])});break;default:logger[_0xcd5e('0x68')](_0xcd5e('0x65'),_0xcd5e('0x5f'));}}})['catch'](function(_0x29e04e){logger['error'](_0xcd5e('0x69'),util[_0xcd5e('0x61')](_0x29e04e,{'showHidden':!![],'depth':null}));});};exports[_0xcd5e('0x6a')]=function(_0x29c888,_0x460318,_0x278235,_0x4bdbfd,_0x15174b,_0x10dd21){var _0x1e2c19,_0x339bfd;_0x10dd21[_0xcd5e('0x10')]=intUtil['stripTrailingSlash'](_0x10dd21['remoteUri']);_0x10dd21[_0xcd5e('0x4c')]=intUtil[_0xcd5e('0x4b')](_0x10dd21[_0xcd5e('0x4c')]);if(_0x15174b&&_0x15174b[_0xcd5e('0x4d')]){logger[_0xcd5e('0x18')](_0xcd5e('0x6b'),'Recording\x20is\x20enabled!');_0x460318[_0xcd5e('0x52')]=util[_0xcd5e('0x1d')](_0xcd5e('0x50'),_0x10dd21[_0xcd5e('0x4c')],_0x460318['uniqueid'],md5(_0x460318[_0xcd5e('0x51')]));}else{_0x460318[_0xcd5e('0x52')]='';}headers[_0xcd5e('0x53')]=getAuth(_0x10dd21);return getUser(_0x10dd21)['then'](function(_0x3f4097){_0x1e2c19=_0x3f4097;logger[_0xcd5e('0x18')](_0xcd5e('0x55'),_0x1e2c19['id']);return getEndUser(_0x10dd21,_0x460318['calleridname'],_0x460318[_0xcd5e('0x57')]);})['then'](function(_0x5e08ba){_0x339bfd=_0x5e08ba;logger[_0xcd5e('0x18')](_0xcd5e('0x58'),_0x339bfd['id']);return getTicket(_0x10dd21,_0x1e2c19,_0x339bfd,_0x278235,_0x460318);})[_0xcd5e('0x17')](function(_0x1810d0){if(_0x1810d0){logger[_0xcd5e('0x18')](_0xcd5e('0x59'),_0x1810d0['id']);}})['catch'](function(_0x18ecf4){logger['error'](_0xcd5e('0x6c'),util[_0xcd5e('0x61')](_0x18ecf4,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x27c5=['%s/users.json','Caller\x20-\x20%s','Enduser\x20created.','authType','password','token','%s/token:%s','username','Basic\x20%s','toString','base64','[HTTP]','stringify','map','forEach','type','string','customField','nameField','toLowerCase','push','idField','variableName','custom_fields','customVariable','Variable','name','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','The\x20User\x20ID\x20is:','calleridnum','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent...','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','Zendesk\x20account\x20type\x20not\x20recognized','catch','error','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','none','[OUTBOUND]','Authorization','email','destcalleridname','destcalleridnum','%s/channels/voice/agents/%d/tickets/%d/display.json','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','abandoned','[ABANDONED]','calleridname','The\x20Enduser\x20ID\x20is:','[ABANDONED]\x20Error\x20running\x20Zendesk\x20integration','md5','util','ioredis','../../../../config/environment','../../../../config/logger','zendesk','redis','defaults','localhost','emit','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','POST','merge','getString','Subjects','Descriptions','Fields','validateEmail','Getting\x20agent\x20with\x20email','type:user\x20role:agent\x20email:%s','then','Agent\x20found!','find','results','Admin\x20account\x20selected.','%s/users/me.json','user','Searching\x20enduser\x20with\x20phone','%s/search.json','length','end-user','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x27c5,0x173));var _0x527c=function(_0xa741fa,_0x14b888){_0xa741fa=_0xa741fa-0x0;var _0xfa882c=_0x27c5[_0xa741fa];return _0xfa882c;};'use strict';var _=require('lodash');var rp=require('request-promise');var md5=require(_0x527c('0x0'));var util=require(_0x527c('0x1'));var Redis=require(_0x527c('0x2'));var intUtil=require('./util');var config=require(_0x527c('0x3'));var logger=require(_0x527c('0x4'))(_0x527c('0x5'));config[_0x527c('0x6')]=_[_0x527c('0x7')](config[_0x527c('0x6')],{'host':_0x527c('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x527c('0x6')]));function emit(_0x5a68e8,_0x2db820,_0x5e07ba){io['to'](_0x5a68e8)[_0x527c('0x9')](_0x2db820,_0x5e07ba);}var headers={'Content-Type':_0x527c('0xa'),'Accept':_0x527c('0xa')};function getTicket(_0x49465c,_0x36be3a,_0x99813d,_0x1961cd,_0x369374){logger[_0x527c('0xb')](_0x527c('0xc'));return request({'uri':util[_0x527c('0xd')](_0x527c('0xe'),_0x49465c[_0x527c('0xf')]),'method':_0x527c('0x10'),'body':{'ticket':_[_0x527c('0x11')]({'requester_id':_0x99813d['id'],'submitter_id':_0x36be3a?_0x36be3a['id']:undefined,'assignee_id':_0x36be3a?_0x36be3a['id']:undefined,'tags':getTags(_0x1961cd['Tags'],'name'),'subject':intUtil[_0x527c('0x12')](_0x1961cd[_0x527c('0x13')],_0x369374,'\x20'),'description':intUtil[_0x527c('0x12')](_0x1961cd[_0x527c('0x14')],_0x369374,'\x0a'),'comment':{'public':![],'body':intUtil['getString'](_0x1961cd[_0x527c('0x14')],_0x369374,'\x0a')}},getCustomFields(_0x1961cd[_0x527c('0x15')],_0x369374))}})['then'](function(_0x514a2f){logger[_0x527c('0xb')]('Ticket\x20created!');return _0x514a2f['ticket'];});}function getUser(_0x1eef2b,_0x18f4b5){if(intUtil[_0x527c('0x16')](_0x18f4b5)){logger['info'](_0x527c('0x17'),_0x18f4b5);return request({'uri':util[_0x527c('0xd')]('%s/search.json',_0x1eef2b[_0x527c('0xf')]),'qs':{'query':util['format'](_0x527c('0x18'),_0x18f4b5)}})[_0x527c('0x19')](function(_0x54ab11){if(_0x54ab11['count']){logger[_0x527c('0xb')](_0x527c('0x1a'));return _[_0x527c('0x1b')](_0x54ab11[_0x527c('0x1c')],{'email':_0x18f4b5,'role':'agent'});}else{logger[_0x527c('0xb')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x527c('0xd')]('%s/users/me.json',_0x1eef2b[_0x527c('0xf')])})['then'](function(_0x44c231){logger[_0x527c('0xb')](_0x527c('0x1d'));return _0x44c231['user'];});}});}else{logger[_0x527c('0xb')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x527c('0xd')](_0x527c('0x1e'),_0x1eef2b[_0x527c('0xf')])})[_0x527c('0x19')](function(_0x21cb25){logger[_0x527c('0xb')](_0x527c('0x1d'));return _0x21cb25[_0x527c('0x1f')];});}}function getEndUser(_0x5f354f,_0x432f31,_0x1379e5){logger['info'](_0x527c('0x20'),_0x1379e5);return request({'uri':util['format'](_0x527c('0x21'),_0x5f354f[_0x527c('0xf')]),'qs':{'query':util[_0x527c('0xd')]('type:user\x20role:end-user\x20phone:%s',_0x1379e5)}})['then'](function(_0x796051){var _0x5f00bd;if(_0x796051[_0x527c('0x1c')][_0x527c('0x22')]){_0x796051[_0x527c('0x1c')]=_['filter'](_0x796051[_0x527c('0x1c')],{'suspended':![],'role':_0x527c('0x23')});if(_0x796051['results'][_0x527c('0x22')]){_0x5f00bd=_['first'](_0x796051[_0x527c('0x1c')]);}}if(_0x5f00bd){logger[_0x527c('0xb')]('Enduser\x20found!');return _0x5f00bd;}else{logger['info'](_0x527c('0x24'));return request({'uri':util[_0x527c('0xd')](_0x527c('0x25'),_0x5f354f[_0x527c('0xf')]),'method':'POST','body':{'user':{'role':_0x527c('0x23'),'name':util['format'](_0x527c('0x26'),_0x432f31||_0x1379e5),'phone':_0x1379e5}}})[_0x527c('0x19')](function(_0x1613f3){logger[_0x527c('0xb')](_0x527c('0x27'));return _0x1613f3[_0x527c('0x1f')];});}});}function getAuth(_0x15846a){var _0x5805df;if(_0x15846a[_0x527c('0x28')]==='password'){_0x5805df=util[_0x527c('0xd')]('%s:%s',_0x15846a['username'],_0x15846a[_0x527c('0x29')]);}else if(_0x15846a[_0x527c('0x28')]===_0x527c('0x2a')){_0x5805df=util['format'](_0x527c('0x2b'),_0x15846a[_0x527c('0x2c')],_0x15846a['token']);}return util['format'](_0x527c('0x2d'),new Buffer(_0x5805df)[_0x527c('0x2e')](_0x527c('0x2f')));}function request(_0x5b69b8){logger['debug'](_0x527c('0x30'),JSON[_0x527c('0x31')](_0x5b69b8));return rp(_['defaults'](_0x5b69b8,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x27e8a8,_0x37f8be){var _0x20d83b=[];if(_0x27e8a8&&_0x27e8a8['length']>0x0){_0x20d83b=_[_0x527c('0x32')](_0x27e8a8,_0x37f8be);}return _0x20d83b;}function getCustomFields(_0x171911,_0xbbeba9){var _0x3f1373=[];var _0x10b718={'custom_fields':[]};if(_0x171911[_0x527c('0x22')]>0x0){_[_0x527c('0x33')](_0x171911,function(_0xc13723){if(_0xc13723[_0x527c('0x34')]===_0x527c('0x35')&&_0xc13723['nameField']&&!_0xc13723[_0x527c('0x36')]){_0x10b718[_0xc13723[_0x527c('0x37')][_0x527c('0x38')]()]=_0xc13723['content'][_0x527c('0x2e')]();}else if(_0xc13723[_0x527c('0x34')]===_0x527c('0x35')&&_0xc13723['idField']&&_0xc13723[_0x527c('0x36')]){_0x10b718['custom_fields'][_0x527c('0x39')]({'id':_0xc13723[_0x527c('0x3a')],'value':_0xc13723['content'][_0x527c('0x2e')]()});}else if(_0xc13723['type']==='variable'&&_0xc13723['variableName']&&_0xc13723[_0x527c('0x3a')]&&_0xc13723[_0x527c('0x36')]){_0xbbeba9[_0xc13723[_0x527c('0x3b')]]&&_0x10b718[_0x527c('0x3c')][_0x527c('0x39')]({'id':_0xc13723[_0x527c('0x3a')],'value':_0xbbeba9[_0xc13723[_0x527c('0x3b')]][_0x527c('0x2e')]()});}else if(_0xc13723[_0x527c('0x34')]===_0x527c('0x3d')&&_0xc13723['Variable']&&_0xc13723[_0x527c('0x3e')][_0x527c('0x3f')]&&_0xc13723[_0x527c('0x3a')]&&_0xc13723[_0x527c('0x36')]){_0xbbeba9[_0xc13723[_0x527c('0x3e')][_0x527c('0x3f')][_0x527c('0x38')]()]&&_0x10b718[_0x527c('0x3c')][_0x527c('0x39')]({'id':_0xc13723[_0x527c('0x3a')],'value':_0xbbeba9[_0xc13723[_0x527c('0x3e')]['name']['toLowerCase']()]['toString']()});}});}return _0x10b718;}exports[_0x527c('0x40')]=function(_0x26ba35,_0x4a0c0b,_0x534935,_0x4d4c6d,_0x58f849,_0x55d480){var _0x4d25ea,_0x1e37a7;_0x55d480[_0x527c('0xf')]=intUtil[_0x527c('0x41')](_0x55d480[_0x527c('0xf')]);_0x55d480['serverUrl']=intUtil[_0x527c('0x41')](_0x55d480[_0x527c('0x42')]);if(_0x58f849&&_0x58f849[_0x527c('0x43')]){logger[_0x527c('0xb')](_0x527c('0x44'),_0x527c('0x45'));_0x4a0c0b['recordingURL']=util['format'](_0x527c('0x46'),_0x55d480[_0x527c('0x42')],_0x4a0c0b[_0x527c('0x47')],md5(_0x4a0c0b['uniqueid']));}else{_0x4a0c0b[_0x527c('0x48')]='';}headers['Authorization']=getAuth(_0x55d480);return getUser(_0x55d480,_0x4d4c6d['email'])['then'](function(_0x2f1e4f){_0x4d25ea=_0x2f1e4f;logger['info'](_0x527c('0x49'),_0x4d25ea['id']);return getEndUser(_0x55d480,_0x4a0c0b['calleridname'],_0x4a0c0b[_0x527c('0x4a')]);})[_0x527c('0x19')](function(_0x54ad19){_0x1e37a7=_0x54ad19;logger['info']('The\x20Enduser\x20ID\x20is:',_0x1e37a7['id']);return getTicket(_0x55d480,_0x4d25ea,_0x1e37a7,_0x534935,_0x4a0c0b);})[_0x527c('0x19')](function(_0x21c8b8){if(_0x21c8b8){logger[_0x527c('0xb')](_0x527c('0x4b'),_0x21c8b8['id']);switch(_0x55d480['type']){case'integrationTab':logger[_0x527c('0xb')](_0x527c('0x44'),_0x527c('0x4c'));return request({'uri':util[_0x527c('0xd')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x55d480[_0x527c('0xf')],_0x4d25ea['id'],_0x21c8b8['id']),'method':_0x527c('0x10')});case _0x527c('0x4d'):logger['info'](_0x527c('0x44'),_0x527c('0x4e'));emit(util[_0x527c('0xd')](_0x527c('0x4f'),_0x4d4c6d[_0x527c('0x3f')]),_0x527c('0x50'),{'uri':util[_0x527c('0xd')](_0x527c('0x51'),_0x55d480['remoteUri'],_0x21c8b8['id'])});break;default:logger['error'](_0x527c('0x44'),_0x527c('0x52'));}}})[_0x527c('0x53')](function(_0x1153f2){logger[_0x527c('0x54')](_0x527c('0x55'),util[_0x527c('0x56')](_0x1153f2,{'showHidden':!![],'depth':null}));});};exports[_0x527c('0x57')]=function(_0x1eb08b,_0x142aed,_0x1c1d20,_0x5cc256,_0x1d8862,_0x37f6f0,_0x5dc3c5){var _0x127dbd,_0x587b27;_0x37f6f0[_0x527c('0xf')]=intUtil['stripTrailingSlash'](_0x37f6f0[_0x527c('0xf')]);_0x37f6f0[_0x527c('0x42')]=intUtil[_0x527c('0x41')](_0x37f6f0[_0x527c('0x42')]);if(_0x5dc3c5&&_0x5dc3c5[_0x527c('0x58')]&&_0x5dc3c5[_0x527c('0x58')]!==_0x527c('0x59')){logger[_0x527c('0xb')](_0x527c('0x5a'),_0x527c('0x45'));_0x142aed[_0x527c('0x48')]=util[_0x527c('0xd')](_0x527c('0x46'),_0x37f6f0['serverUrl'],_0x142aed[_0x527c('0x47')],md5(_0x142aed[_0x527c('0x47')]));}headers[_0x527c('0x5b')]=getAuth(_0x37f6f0);return getUser(_0x37f6f0,_0x5cc256[_0x527c('0x5c')])['then'](function(_0x556ae3){_0x127dbd=_0x556ae3;logger[_0x527c('0xb')]('The\x20User\x20ID\x20is:',_0x127dbd['id']);return getEndUser(_0x37f6f0,_0x142aed[_0x527c('0x5d')],_0x142aed[_0x527c('0x5e')]);})[_0x527c('0x19')](function(_0x2d3628){_0x587b27=_0x2d3628;logger[_0x527c('0xb')]('The\x20Enduser\x20ID\x20is:',_0x587b27['id']);return getTicket(_0x37f6f0,_0x127dbd,_0x587b27,_0x1c1d20,_0x142aed);})['then'](function(_0x354c64){if(_0x354c64){logger['info'](_0x527c('0x4b'),_0x354c64['id']);switch(_0x37f6f0[_0x527c('0x34')]){case'integrationTab':logger[_0x527c('0xb')](_0x527c('0x5a'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0x527c('0xd')](_0x527c('0x5f'),_0x37f6f0[_0x527c('0xf')],_0x127dbd['id'],_0x354c64['id']),'method':'POST'});case _0x527c('0x4d'):logger[_0x527c('0xb')](_0x527c('0x5a'),_0x527c('0x4e'));emit(util['format'](_0x527c('0x4f'),_0x5cc256[_0x527c('0x3f')]),_0x527c('0x50'),{'uri':util[_0x527c('0xd')](_0x527c('0x51'),_0x37f6f0[_0x527c('0xf')],_0x354c64['id'])});break;default:logger['error']('[OUTBOUND]','Zendesk\x20account\x20type\x20not\x20recognized');}}})['catch'](function(_0xd80c33){logger[_0x527c('0x54')](_0x527c('0x60'),util[_0x527c('0x56')](_0xd80c33,{'showHidden':!![],'depth':null}));});};exports[_0x527c('0x61')]=function(_0x1272a8,_0x4bc39b,_0x2b9350,_0x230771,_0xbd7f9a,_0x20a2c7){var _0xd95449,_0x12c315;_0x20a2c7[_0x527c('0xf')]=intUtil[_0x527c('0x41')](_0x20a2c7['remoteUri']);_0x20a2c7[_0x527c('0x42')]=intUtil[_0x527c('0x41')](_0x20a2c7[_0x527c('0x42')]);if(_0xbd7f9a&&_0xbd7f9a[_0x527c('0x43')]){logger[_0x527c('0xb')](_0x527c('0x62'),_0x527c('0x45'));_0x4bc39b[_0x527c('0x48')]=util[_0x527c('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x20a2c7[_0x527c('0x42')],_0x4bc39b[_0x527c('0x47')],md5(_0x4bc39b[_0x527c('0x47')]));}else{_0x4bc39b[_0x527c('0x48')]='';}headers[_0x527c('0x5b')]=getAuth(_0x20a2c7);return getUser(_0x20a2c7)['then'](function(_0x4e8e3a){_0xd95449=_0x4e8e3a;logger[_0x527c('0xb')](_0x527c('0x49'),_0xd95449['id']);return getEndUser(_0x20a2c7,_0x4bc39b[_0x527c('0x63')],_0x4bc39b['calleridnum']);})[_0x527c('0x19')](function(_0x352826){_0x12c315=_0x352826;logger[_0x527c('0xb')](_0x527c('0x64'),_0x12c315['id']);return getTicket(_0x20a2c7,_0xd95449,_0x12c315,_0x2b9350,_0x4bc39b);})['then'](function(_0x4e5ecd){if(_0x4e5ecd){logger[_0x527c('0xb')](_0x527c('0x4b'),_0x4e5ecd['id']);}})[_0x527c('0x53')](function(_0x244171){logger[_0x527c('0x54')](_0x527c('0x65'),util['inspect'](_0x244171,{'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 830e2a1..01a2ca2 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 _0x385c=['clientSecret','refresh_token','then','add','expires_in','seconds','Failing\x20creating\x20the\x20access_token','stack','info','Search\x20user','GET','Zoho-oauthtoken\x20','isArrayLikeObject','findIndex','users','email','Agent\x20found!','Using\x20the\x20admin\x20account!','profile','Administrator','user','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','error','data','catch','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','code','SUCCESS','details','enduserType','Error:\x20','log','CREATE\x20ERROR','contact_lead','uri','https://www.zohoapis.','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','contact','nothing','lead','Leads','Creating\x20new\x20call...','Owner','administrator','getString','Subjects','Description','Descriptions','Who_Id','First_Name','Last_Name','What_Id','Full_Name','$se_module','talktime','Call_Duration','utc','format','mm:ss','answertime','endtime','YYYY-MM-DDTHH:mm:ss','starttime','Call_Result','connect','Answered','rejected','Rejected','Abandoned','Call_Start_Time','outbound','Call_Type','Inbound','Fields','/crm/v2/Calls','Call\x20created!','err','host','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','recordingURL','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','com','The\x20User\x20ID\x20is:','calleridnum','user:%s','trigger:browser:url','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','Outbound','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','https://crm.','[ABANDONED]','calleridname','The\x20Call\x20ID\x20is:','./util','ioredis','../../../../config/environment','../../../../config/logger','zoho','redis','socket.io-emitter','emit','debug','[HTTP]','stringify','length','forEach','type','string','idField','variableName','Variable','name','toLowerCase','isNil','access_token','isBefore','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','POST','refreshToken'];(function(_0x3824fb,_0x511e11){var _0x1ab1c3=function(_0x5ccc56){while(--_0x5ccc56){_0x3824fb['push'](_0x3824fb['shift']());}};_0x1ab1c3(++_0x511e11);}(_0x385c,0xff));var _0xc385=function(_0xb9002e,_0x31c3e2){_0xb9002e=_0xb9002e-0x0;var _0x376be4=_0x385c[_0xb9002e];return _0x376be4;};'use strict';var _=require('lodash');var rp=require('request-promise');var md5=require('md5');var util=require('util');var intUtil=require(_0xc385('0x0'));var moment=require('moment');var Redis=require(_0xc385('0x1'));var BPromise=require('bluebird');var config=require(_0xc385('0x2'));var logger=require(_0xc385('0x3'))(_0xc385('0x4'));config[_0xc385('0x5')]=_['defaults'](config[_0xc385('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0xc385('0x6'))(new Redis(config[_0xc385('0x5')]));function emit(_0x2bb187,_0x1864b0,_0x4f88a9){io['to'](_0x2bb187)[_0xc385('0x7')](_0x1864b0,_0x4f88a9);}function request(_0x21b9f4){logger[_0xc385('0x8')](_0xc385('0x9'),JSON[_0xc385('0xa')](_0x21b9f4));return rp(_0x21b9f4);}function getCustomFields(_0x11cdb7,_0x442f15){var _0x4b94bf={};if(_0x11cdb7[_0xc385('0xb')]>0x0){_[_0xc385('0xc')](_0x11cdb7,function(_0x39e25c){if(_0x39e25c[_0xc385('0xd')]===_0xc385('0xe')&&_0x39e25c[_0xc385('0xf')]){_0x4b94bf[_0x39e25c[_0xc385('0xf')]]=_0x39e25c['content']['toString']();}else if(_0x39e25c[_0xc385('0xd')]==='variable'&&_0x39e25c[_0xc385('0x10')]&&_0x39e25c[_0xc385('0xf')]&&_0x442f15[_0x39e25c[_0xc385('0x10')]]){_0x4b94bf[_0x39e25c[_0xc385('0xf')]]=_0x442f15[_0x39e25c[_0xc385('0x10')]]['toString']();}else if(_0x39e25c[_0xc385('0xd')]==='customVariable'&&_0x39e25c[_0xc385('0x11')]&&_0x39e25c[_0xc385('0x11')][_0xc385('0x12')]&&_0x39e25c[_0xc385('0xf')]&&_0x442f15[_0x39e25c[_0xc385('0x11')][_0xc385('0x12')][_0xc385('0x13')]()]){_0x4b94bf[_0x39e25c['idField']]=_0x442f15[_0x39e25c['Variable'][_0xc385('0x12')][_0xc385('0x13')]()]['toString']();}});}return _0x4b94bf;}function getName(_0xa5f3dc){if(_0xa5f3dc['indexOf']('\x20')>0x0){var _0x156725=_0xa5f3dc['split'](/ (.+)/);if(_0x156725[0x1]){return _0x156725;}}return[_0xa5f3dc,_0xa5f3dc];}var accountsTokens={};function getAccessToken(_0x3e4fcd){return new Promise(function(_0x55bc48,_0x38e222){if(!_[_0xc385('0x14')](accountsTokens[_0x3e4fcd['id']])&&!_[_0xc385('0x14')](accountsTokens[_0x3e4fcd['id']][_0xc385('0x15')])){if(moment()[_0xc385('0x16')](accountsTokens[_0x3e4fcd['id']]['expires_in'])){_0x55bc48(accountsTokens[_0x3e4fcd['id']][_0xc385('0x15')]);}}var _0x32c274;switch(_0x3e4fcd[_0xc385('0x17')]){case'US':_0x32c274=_0xc385('0x18');break;case'AU':_0x32c274=_0xc385('0x19');break;case'EU':_0x32c274=_0xc385('0x1a');break;case'IN':_0x32c274='https://accounts.zoho.in';break;case'CN':_0x32c274='https://accounts.zoho.com.cn';break;default:_0x32c274=_0xc385('0x1a');break;}var _0xa616b5={'method':_0xc385('0x1b'),'uri':_0x32c274+'/oauth/v2/token','qs':{'refresh_token':_0x3e4fcd[_0xc385('0x1c')],'client_id':_0x3e4fcd['clientId'],'client_secret':_0x3e4fcd[_0xc385('0x1d')],'grant_type':_0xc385('0x1e')},'json':!![]};return rp(_0xa616b5)[_0xc385('0x1f')](function(_0x58db22){accountsTokens[_0x3e4fcd['id']]={'access_token':_0x58db22[_0xc385('0x15')],'expires_in':moment()[_0xc385('0x20')](_0x58db22[_0xc385('0x21')],_0xc385('0x22'))};_0x55bc48(_0x58db22[_0xc385('0x15')]);})['catch'](function(_0x41907d){logger['error'](_0xc385('0x23'),_0x41907d[_0xc385('0x24')]);_0x38e222(_0x41907d);});});}function getUser(_0x4b1c5f,_0x248ef5,_0x34429b,_0xfb744d){logger[_0xc385('0x25')](_0xc385('0x26'));return request({'method':_0xc385('0x27'),'uri':util['format']('https://www.zohoapis.%s/crm/v2/users',_0x248ef5),'qs':{'type':'ActiveUsers'},'headers':{'Authorization':_0xc385('0x28')+_0x4b1c5f},'json':!![]})['then'](function(_0x4f8e9b){if(_0x4f8e9b['users']){var _0x2a17ce=-0x1;if(_[_0xc385('0x29')](_0x4f8e9b['users'])){if(!_['isNil'](_0xfb744d)){_0x2a17ce=_[_0xc385('0x2a')](_0x4f8e9b[_0xc385('0x2b')],function(_0x519843){return _0x519843[_0xc385('0x2c')]===_0xfb744d;});}if(_0x2a17ce>=0x0){logger[_0xc385('0x25')](_0xc385('0x2d'));}else{logger[_0xc385('0x25')](_0xc385('0x2e'));_0x2a17ce=_[_0xc385('0x2a')](_0x4f8e9b[_0xc385('0x2b')],function(_0x371e4f){return _0x371e4f[_0xc385('0x2f')][_0xc385('0x12')]===_0xc385('0x30');});}return _0x4f8e9b['users'][_0x2a17ce];}else{if(_0x4f8e9b['user'][_0xc385('0x2f')][_0xc385('0x12')]==='Administrator'){logger[_0xc385('0x25')](_0xc385('0x2e'));user=_0x4f8e9b[_0xc385('0x31')];return user;}else{logger['error'](_0xc385('0x32'),JSON[_0xc385('0xa')](_0x4f8e9b));throw new Error(_0xc385('0x33')+JSON['stringify'](_0x4f8e9b));}}}else{logger[_0xc385('0x34')](_0xc385('0x32'),JSON[_0xc385('0xa')](_0x4f8e9b));throw new Error(_0xc385('0x33')+JSON[_0xc385('0xa')](_0x4f8e9b));}})['catch'](function(_0x5730cb){console[_0xc385('0x34')](_0x5730cb);});}function getZohoUser(_0x17e0f7,_0x436bad){return new BPromise(function(_0x1736d7,_0x1fd526){request(_0x17e0f7)[_0xc385('0x1f')](function(_0x11f394){var _0x7ed657=null;if(_0x11f394){_0x7ed657=_0x11f394[_0xc385('0x35')][0x0];_0x7ed657['enduserType']=_0x436bad;}_0x1736d7(_0x7ed657);})[_0xc385('0x36')](function(_0x25ff0b){_0x1fd526(_0x25ff0b);});});}function createEndUser(_0x4df4c5,_0x51df6e,_0x1d71b5,_0x5eb94a,_0x3fdad0,_0x188ffc){var _0x1d71b5=getName(_0x1d71b5);return request({'method':_0xc385('0x1b'),'uri':'https://www.zohoapis.'+_0x51df6e+_0xc385('0x37')+_[_0xc385('0x38')](_0x188ffc[_0xc385('0x39')])+'s','body':{'data':[{'Last_Name':_0x1d71b5[0x1],'First_Name':_0x1d71b5[0x0],'Phone':_0x5eb94a,'Owner':{'name':!_['isNil'](_0x3fdad0[_0xc385('0x3a')][_0xc385('0x12')])?_0x3fdad0[_0xc385('0x3a')][_0xc385('0x12')]:!_[_0xc385('0x14')](_0x3fdad0['first_name'])?_0x3fdad0[_0xc385('0x3b')]+'\x20'+_0x3fdad0[_0xc385('0x3c')]:_0x3fdad0['last_name'],'id':_0x3fdad0['id']}}]},'headers':{'Authorization':_0xc385('0x28')+_0x4df4c5},'json':!![]})[_0xc385('0x1f')](function(_0x46f750){if(_0x46f750&&_0x46f750[_0xc385('0x35')][0x0][_0xc385('0x3d')]===_0xc385('0x3e')){var _0x5b68d7=_0x46f750[_0xc385('0x35')][0x0][_0xc385('0x3f')];_0x5b68d7[_0xc385('0x40')]=_[_0xc385('0x38')](_0x188ffc[_0xc385('0x39')])+'s';return _0x5b68d7;}logger[_0xc385('0x34')]('The\x20failing\x20result\x20is',JSON[_0xc385('0xa')](data));throw new Error(_0xc385('0x41')+JSON[_0xc385('0xa')](data));})[_0xc385('0x36')](function(_0x2e2bd5){console[_0xc385('0x42')](_0xc385('0x43'),_0x2e2bd5);});}function getEndUser(_0x204c8d,_0x5371bc,_0x4d3f80,_0x5045ec,_0x2141b3,_0x5afb44,_0x13a712){var _0x412076={'method':_0xc385('0x27'),'uri':'','headers':{'Authorization':_0xc385('0x28')+_0x204c8d},'json':!![]};switch(_0x13a712['moduleSearch']){case _0xc385('0x44'):_0x412076[_0xc385('0x45')]=_0xc385('0x46')+_0x5371bc+_0xc385('0x47')+_0x2141b3+'))';return getZohoUser(_0x412076,_0xc385('0x48'))[_0xc385('0x1f')](function(_0x3c08b1){if(_0x3c08b1)return _0x3c08b1;_0x412076[_0xc385('0x45')]=_0xc385('0x46')+_0x5371bc+_0xc385('0x49')+_0x2141b3+'))';return getZohoUser(_0x412076,'Leads')[_0xc385('0x1f')](function(_0x2b9311){if(_0x2b9311)return _0x2b9311;if(_0x13a712[_0xc385('0x39')]!='nothing'){return createEndUser(_0x204c8d,_0x5371bc,_0x5045ec,_0x2141b3,_0x5afb44,_0x13a712);}else{return{};}});});break;case _0xc385('0x4a'):_0x412076[_0xc385('0x45')]=_0xc385('0x46')+_0x5371bc+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x2141b3+'))';return getZohoUser(_0x412076,_0xc385('0x48'))[_0xc385('0x1f')](function(_0x6e8969){if(_0x6e8969)return _0x6e8969;if(_0x13a712['moduleCreate']!=_0xc385('0x4b')){return createEndUser(_0x204c8d,_0x5371bc,_0x5045ec,_0x2141b3,_0x5afb44,_0x13a712);}else{return{};}});break;case _0xc385('0x4c'):_0x412076[_0xc385('0x45')]=_0xc385('0x46')+_0x5371bc+_0xc385('0x49')+_0x2141b3+'))';return getZohoUser(_0x412076,_0xc385('0x4d'))[_0xc385('0x1f')](function(_0x4a87f9){if(_0x4a87f9)return _0x4a87f9;if(_0x13a712[_0xc385('0x39')]!=_0xc385('0x4b')){return createEndUser(_0x204c8d,_0x5371bc,_0x5045ec,_0x2141b3,_0x5afb44,_0x13a712);}else{return{};}});break;}}function getCall(_0x305b47,_0x1d3485,_0x1b1798,_0x38ae3c,_0x8f2728,_0x328668,_0x53456e,_0x3f900d){logger[_0xc385('0x25')](_0xc385('0x4e'));var _0x48ee05={};_0x48ee05[_0xc385('0x4f')]={'name':!_[_0xc385('0x14')](_0x38ae3c[_0xc385('0x3a')][_0xc385('0x12')])&&!_['isNil'](_0x38ae3c[_0xc385('0x2f')][_0xc385('0x12')])&&_0x38ae3c[_0xc385('0x2f')][_0xc385('0x12')]===_0xc385('0x50')?_0x38ae3c['role']['name']:!_[_0xc385('0x14')](_0x38ae3c[_0xc385('0x3b')])?_0x38ae3c[_0xc385('0x3b')]+'\x20'+_0x38ae3c[_0xc385('0x3c')]:_0x38ae3c[_0xc385('0x3c')],'id':_0x38ae3c['id']};_0x48ee05['Subject']=intUtil[_0xc385('0x51')](_0x328668[_0xc385('0x52')],_0x53456e,'\x20');_0x48ee05[_0xc385('0x53')]=intUtil[_0xc385('0x51')](_0x328668[_0xc385('0x54')],_0x53456e,'\x0a');if(_0x8f2728[_0xc385('0x40')]===_0xc385('0x48')){_0x48ee05[_0xc385('0x55')]={'name':!_[_0xc385('0x14')](_0x8f2728['Full_Name'])?_0x8f2728['Full_Name']:!_[_0xc385('0x14')](_0x8f2728[_0xc385('0x56')])?_0x8f2728[_0xc385('0x56')]+'\x20'+_0x8f2728[_0xc385('0x57')]:_0x8f2728[_0xc385('0x57')],'id':_0x8f2728['id']};}if(_0x8f2728[_0xc385('0x40')]===_0xc385('0x4d')){_0x48ee05[_0xc385('0x58')]={'name':!_['isNil'](_0x8f2728[_0xc385('0x59')])?_0x8f2728['Full_Name']:!_[_0xc385('0x14')](_0x8f2728[_0xc385('0x56')])?_0x8f2728[_0xc385('0x56')]+'\x20'+_0x8f2728['Last_Name']:_0x8f2728[_0xc385('0x57')],'id':_0x8f2728['id']};_0x48ee05[_0xc385('0x5a')]=_[_0xc385('0x38')](_0x8f2728[_0xc385('0x40')]);}if(_0x53456e[_0xc385('0x5b')]){_0x48ee05[_0xc385('0x5c')]=moment[_0xc385('0x5d')](parseInt(_0x53456e[_0xc385('0x5b')])*0x3e8)[_0xc385('0x5e')](_0xc385('0x5f'));}else if(_0x53456e[_0xc385('0x60')]&&_0x53456e[_0xc385('0x61')]){_0x48ee05[_0xc385('0x5c')]=moment[_0xc385('0x5d')](moment(_0x53456e[_0xc385('0x61')],_0xc385('0x62'))['diff'](moment(_0x53456e[_0xc385('0x63')],_0xc385('0x62'))))['format'](_0xc385('0x5f'));}switch(_0x53456e['lastevent']){case'called':_0x48ee05[_0xc385('0x64')]='Called';break;case'complete':case _0xc385('0x65'):_0x48ee05['Call_Result']=_0xc385('0x66');break;case _0xc385('0x67'):_0x48ee05[_0xc385('0x64')]=_0xc385('0x68');break;case'abandoned':_0x48ee05[_0xc385('0x64')]=_0xc385('0x69');break;default:}_0x48ee05[_0xc385('0x6a')]=(_0x3f900d===_0xc385('0x6b')?moment(_0x53456e[_0xc385('0x63')])['format'](_0xc385('0x62')):moment(_0x53456e['agentcalledAt'])[_0xc385('0x5e')](_0xc385('0x62')))||moment()[_0xc385('0x5e')](_0xc385('0x62'));_0x48ee05[_0xc385('0x6c')]=_0x3f900d||_0xc385('0x6d');_0x48ee05=_['merge'](_0x48ee05,getCustomFields(_0x328668[_0xc385('0x6e')],_0x53456e));return request({'method':_0xc385('0x1b'),'uri':_0xc385('0x46')+_0x1d3485+_0xc385('0x6f'),'headers':{'Authorization':_0xc385('0x28')+_0x305b47},'body':{'data':[_0x48ee05]},'json':!![]})['then'](function(_0x377a29){if(_0x377a29&&_0x377a29[_0xc385('0x35')][0x0][_0xc385('0x3d')]===_0xc385('0x3e')){logger['info'](_0xc385('0x70'));return{'id':_0x377a29[_0xc385('0x35')][0x0][_0xc385('0x3f')]['id']};}})[_0xc385('0x36')](function(_0xcbe7d3){logger[_0xc385('0x25')](_0xc385('0x71'),_0xcbe7d3['stack']);console[_0xc385('0x42')](_0xc385('0x71'),_0xcbe7d3);});}exports['queue']=function(_0x58d190,_0x2535c1,_0x3068ac,_0x1d475e,_0x5aebdb,_0x2b9acd){var _0x461d31,_0x1e8e65,_0x2f3d67;_0x2b9acd[_0xc385('0x72')]=intUtil[_0xc385('0x73')](_0x2b9acd['host']);_0x2b9acd[_0xc385('0x74')]=intUtil[_0xc385('0x73')](_0x2b9acd['serverUrl']);if(_0x5aebdb&&_0x5aebdb[_0xc385('0x75')]){logger[_0xc385('0x25')](_0xc385('0x76'),'Recording\x20is\x20enabled!');_0x2535c1[_0xc385('0x77')]=_0x2b9acd['serverUrl']+_0xc385('0x78')+_0x2535c1[_0xc385('0x79')]+_0xc385('0x7a')+md5(_0x2535c1[_0xc385('0x79')]);}else{_0x2535c1[_0xc385('0x77')]='';}var _0x1752d3=_0x2b9acd['host']===_0xc385('0x7b')?'eu':_0xc385('0x7c');return getAccessToken(_0x2b9acd)[_0xc385('0x1f')](function(_0x317e59){_0x2f3d67=_0x317e59;return getUser(_0x2f3d67,_0x1752d3,_0x2b9acd,_0x1d475e[_0xc385('0x2c')]);})[_0xc385('0x1f')](function(_0x3aee04){_0x461d31=_0x3aee04;logger['info'](_0xc385('0x7d'),_0x461d31['id']);return getEndUser(_0x2f3d67,_0x1752d3,_0x2b9acd,_0x2535c1['calleridname'],_0x2535c1[_0xc385('0x7e')],_0x461d31,_0x3068ac);})[_0xc385('0x1f')](function(_0x29ebce){_0x1e8e65=_0x29ebce;return getCall(_0x2f3d67,_0x1752d3,_0x2b9acd,_0x461d31,_0x1e8e65,_0x3068ac,_0x2535c1,'Inbound');})[_0xc385('0x1f')](function(_0x58325e){if(_0x58325e){logger[_0xc385('0x25')]('The\x20Call\x20ID\x20is:',_0x58325e['id']);logger[_0xc385('0x25')](_0xc385('0x76'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0xc385('0x7f'),_0x1d475e[_0xc385('0x12')]),_0xc385('0x80'),{'uri':'https://crm.'+_0x2b9acd['host']+_0xc385('0x81')+_0x58325e['id']});}})[_0xc385('0x36')](function(_0x4149cf){logger['error'](_0xc385('0x76'),JSON[_0xc385('0xa')](_0x4149cf));});};exports[_0xc385('0x6b')]=function(_0x1c9838,_0x4008d3,_0x5a1616,_0x1f280c,_0x77f78,_0x1afc0d,_0xb5ebd2){var _0x185335,_0x14c50e,_0x3b3c2f;_0x1afc0d[_0xc385('0x72')]=intUtil['stripTrailingSlash'](_0x1afc0d[_0xc385('0x72')]);_0x1afc0d['serverUrl']=intUtil['stripTrailingSlash'](_0x1afc0d[_0xc385('0x74')]);if(_0xb5ebd2&&_0xb5ebd2[_0xc385('0x82')]&&_0xb5ebd2['recordingFormat']!==_0xc385('0x83')){logger[_0xc385('0x25')](_0xc385('0x84'),_0xc385('0x85'));_0x4008d3[_0xc385('0x77')]=_0x1afc0d[_0xc385('0x74')]+'/api/voice/recordings/'+_0x4008d3['uniqueid']+'/downloads?type=uniqueid&token='+md5(_0x4008d3[_0xc385('0x79')]);}var _0x3de327=_0x1afc0d['host']===_0xc385('0x7b')?'eu':_0xc385('0x7c');return getAccessToken(_0x1afc0d)['then'](function(_0x34a3aa){_0x3b3c2f=_0x34a3aa;return getUser(_0x3b3c2f,_0x3de327,_0x1afc0d,_0x1f280c[_0xc385('0x2c')]);})['then'](function(_0x528a51){_0x185335=_0x528a51;logger[_0xc385('0x25')](_0xc385('0x7d'),_0x185335['id']);return getEndUser(_0x3b3c2f,_0x3de327,_0x1afc0d,_0x4008d3[_0xc385('0x86')],_0x4008d3[_0xc385('0x87')],_0x185335,_0x5a1616);})[_0xc385('0x1f')](function(_0x2693fa){_0x14c50e=_0x2693fa;return getCall(_0x3b3c2f,_0x3de327,_0x1afc0d,_0x185335,_0x14c50e,_0x5a1616,_0x4008d3,_0xc385('0x88'));})[_0xc385('0x1f')](function(_0x396af7){if(_0x396af7){logger[_0xc385('0x25')]('The\x20Call\x20ID\x20is:',_0x396af7['id']);logger[_0xc385('0x25')](_0xc385('0x84'),_0xc385('0x89'));emit(util[_0xc385('0x5e')]('user:%s',_0x1f280c[_0xc385('0x12')]),_0xc385('0x80'),{'uri':_0xc385('0x8a')+_0x1afc0d[_0xc385('0x72')]+_0xc385('0x81')+_0x396af7['id']});}})[_0xc385('0x36')](function(_0x2f5143){logger['error'](_0xc385('0x84'),JSON[_0xc385('0xa')](_0x2f5143));});};exports['abandoned']=function(_0x16eca2,_0x392975,_0x477026,_0x59c666,_0x494b10,_0x28215c){var _0x44afb4,_0x5b2b67,_0x32f187;_0x28215c[_0xc385('0x72')]=intUtil[_0xc385('0x73')](_0x28215c[_0xc385('0x72')]);_0x28215c[_0xc385('0x74')]=intUtil[_0xc385('0x73')](_0x28215c[_0xc385('0x74')]);if(_0x494b10&&_0x494b10[_0xc385('0x75')]){logger['info'](_0xc385('0x8b'),_0xc385('0x85'));_0x392975['recordingURL']=_0x28215c[_0xc385('0x74')]+_0xc385('0x78')+_0x392975['uniqueid']+'/downloads?type=uniqueid&token='+md5(_0x392975['uniqueid']);}else{_0x392975['recordingURL']='';}var _0x4d28cc=_0x28215c[_0xc385('0x72')]===_0xc385('0x7b')?'eu':'com';return getAccessToken(_0x28215c)[_0xc385('0x1f')](function(_0x5d309e){_0x32f187=_0x5d309e;return getUser(_0x32f187,_0x4d28cc,_0x28215c);})[_0xc385('0x1f')](function(_0xd3f0e0){_0x44afb4=_0xd3f0e0;logger['info'](_0xc385('0x7d'),_0x44afb4['id']);return getEndUser(_0x32f187,_0x4d28cc,_0x28215c,_0x392975[_0xc385('0x8c')],_0x392975[_0xc385('0x7e')],_0x44afb4,_0x477026);})[_0xc385('0x1f')](function(_0x5afaab){_0x5b2b67=_0x5afaab;return getCall(_0x32f187,_0x4d28cc,_0x28215c,_0x44afb4,_0x5b2b67,_0x477026,_0x392975,'Inbound');})[_0xc385('0x1f')](function(_0x5047b6){if(_0x5047b6){logger['info'](_0xc385('0x8d'),_0x5047b6['id']);}})[_0xc385('0x36')](function(_0x585807){logger[_0xc385('0x34')](_0xc385('0x8b'),JSON[_0xc385('0xa')](_0x585807));});}; \ No newline at end of file +var _0x8e90=['add','expires_in','seconds','error','stack','info','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','users','isArrayLikeObject','isNil','findIndex','email','Agent\x20found!','profile','Administrator','Using\x20the\x20admin\x20account!','user','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','catch','data','enduserType','POST','https://www.zohoapis.','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','Zoho-oauthtoken\x20','code','details','log','CREATE\x20ERROR','moduleSearch','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','nothing','contact','lead','/crm/v2/Leads/search?criteria=((Phone:equals:','Creating\x20new\x20call...','Owner','administrator','getString','Subjects','Description','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','Leads','talktime','utc','mm:ss','answertime','endtime','Call_Duration','YYYY-MM-DDTHH:mm:ss','diff','lastevent','called','Call_Result','Called','complete','connect','Answered','Rejected','abandoned','Abandoned','Call_Start_Time','outbound','agentcalledAt','Call_Type','merge','Fields','/crm/v2/Calls','SUCCESS','err','queue','host','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','com','The\x20User\x20ID\x20is:','calleridname','calleridnum','Inbound','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','/crm/EntityInfo.do?module=Calls&id=','[QUEUE]','recordingFormat','none','[OUTBOUND]','/api/voice/recordings/','Outbound','The\x20Call\x20ID\x20is:','lodash','request-promise','md5','util','./util','moment','bluebird','../../../../config/environment','../../../../config/logger','zoho','redis','defaults','localhost','debug','[HTTP]','stringify','forEach','string','idField','content','type','variable','variableName','toString','customVariable','Variable','name','toLowerCase','indexOf','access_token','isBefore','zone','https://accounts.zoho.com','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','/oauth/v2/token','refreshToken','clientSecret','refresh_token','then'];(function(_0x523e38,_0x1be9b0){var _0x45dfb5=function(_0x24d4f1){while(--_0x24d4f1){_0x523e38['push'](_0x523e38['shift']());}};_0x45dfb5(++_0x1be9b0);}(_0x8e90,0x109));var _0x08e9=function(_0x5597a0,_0x35c11e){_0x5597a0=_0x5597a0-0x0;var _0x2fc8d6=_0x8e90[_0x5597a0];return _0x2fc8d6;};'use strict';var _=require(_0x08e9('0x0'));var rp=require(_0x08e9('0x1'));var md5=require(_0x08e9('0x2'));var util=require(_0x08e9('0x3'));var intUtil=require(_0x08e9('0x4'));var moment=require(_0x08e9('0x5'));var Redis=require('ioredis');var BPromise=require(_0x08e9('0x6'));var config=require(_0x08e9('0x7'));var logger=require(_0x08e9('0x8'))(_0x08e9('0x9'));config[_0x08e9('0xa')]=_[_0x08e9('0xb')](config['redis'],{'host':_0x08e9('0xc'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function emit(_0x23d417,_0x1adb76,_0x1575c4){io['to'](_0x23d417)['emit'](_0x1adb76,_0x1575c4);}function request(_0x1957c9){logger[_0x08e9('0xd')](_0x08e9('0xe'),JSON[_0x08e9('0xf')](_0x1957c9));return rp(_0x1957c9);}function getCustomFields(_0x11a659,_0x3bf99f){var _0x44ea3c={};if(_0x11a659['length']>0x0){_[_0x08e9('0x10')](_0x11a659,function(_0x121cef){if(_0x121cef['type']===_0x08e9('0x11')&&_0x121cef[_0x08e9('0x12')]){_0x44ea3c[_0x121cef[_0x08e9('0x12')]]=_0x121cef[_0x08e9('0x13')]['toString']();}else if(_0x121cef[_0x08e9('0x14')]===_0x08e9('0x15')&&_0x121cef[_0x08e9('0x16')]&&_0x121cef[_0x08e9('0x12')]&&_0x3bf99f[_0x121cef[_0x08e9('0x16')]]){_0x44ea3c[_0x121cef[_0x08e9('0x12')]]=_0x3bf99f[_0x121cef[_0x08e9('0x16')]][_0x08e9('0x17')]();}else if(_0x121cef['type']===_0x08e9('0x18')&&_0x121cef['Variable']&&_0x121cef[_0x08e9('0x19')][_0x08e9('0x1a')]&&_0x121cef[_0x08e9('0x12')]&&_0x3bf99f[_0x121cef[_0x08e9('0x19')][_0x08e9('0x1a')][_0x08e9('0x1b')]()]){_0x44ea3c[_0x121cef[_0x08e9('0x12')]]=_0x3bf99f[_0x121cef[_0x08e9('0x19')][_0x08e9('0x1a')][_0x08e9('0x1b')]()][_0x08e9('0x17')]();}});}return _0x44ea3c;}function getName(_0x39c197){if(_0x39c197[_0x08e9('0x1c')]('\x20')>0x0){var _0x23f51d=_0x39c197['split'](/ (.+)/);if(_0x23f51d[0x1]){return _0x23f51d;}}return[_0x39c197,_0x39c197];}var accountsTokens={};function getAccessToken(_0x3443f7){return new Promise(function(_0x39ef64,_0x38505d){if(!_['isNil'](accountsTokens[_0x3443f7['id']])&&!_['isNil'](accountsTokens[_0x3443f7['id']][_0x08e9('0x1d')])){if(moment()[_0x08e9('0x1e')](accountsTokens[_0x3443f7['id']]['expires_in'])){_0x39ef64(accountsTokens[_0x3443f7['id']]['access_token']);}}var _0x5456dc;switch(_0x3443f7[_0x08e9('0x1f')]){case'US':_0x5456dc=_0x08e9('0x20');break;case'AU':_0x5456dc='https://accounts.zoho.com.au';break;case'EU':_0x5456dc='https://accounts.zoho.eu';break;case'IN':_0x5456dc=_0x08e9('0x21');break;case'CN':_0x5456dc=_0x08e9('0x22');break;default:_0x5456dc=_0x08e9('0x23');break;}var _0xa45a8d={'method':'POST','uri':_0x5456dc+_0x08e9('0x24'),'qs':{'refresh_token':_0x3443f7[_0x08e9('0x25')],'client_id':_0x3443f7['clientId'],'client_secret':_0x3443f7[_0x08e9('0x26')],'grant_type':_0x08e9('0x27')},'json':!![]};return rp(_0xa45a8d)[_0x08e9('0x28')](function(_0x5782a5){accountsTokens[_0x3443f7['id']]={'access_token':_0x5782a5[_0x08e9('0x1d')],'expires_in':moment()[_0x08e9('0x29')](_0x5782a5[_0x08e9('0x2a')],_0x08e9('0x2b'))};_0x39ef64(_0x5782a5[_0x08e9('0x1d')]);})['catch'](function(_0x5db558){logger[_0x08e9('0x2c')]('Failing\x20creating\x20the\x20access_token',_0x5db558[_0x08e9('0x2d')]);_0x38505d(_0x5db558);});});}function getUser(_0x38f02c,_0x12234a,_0x3ed3c2,_0x23b219){logger[_0x08e9('0x2e')]('Search\x20user');return request({'method':_0x08e9('0x2f'),'uri':util[_0x08e9('0x30')](_0x08e9('0x31'),_0x12234a),'qs':{'type':_0x08e9('0x32')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x38f02c},'json':!![]})['then'](function(_0x5cd22a){if(_0x5cd22a[_0x08e9('0x33')]){var _0x4f562e=-0x1;if(_[_0x08e9('0x34')](_0x5cd22a[_0x08e9('0x33')])){if(!_[_0x08e9('0x35')](_0x23b219)){_0x4f562e=_[_0x08e9('0x36')](_0x5cd22a[_0x08e9('0x33')],function(_0x2a0afe){return _0x2a0afe[_0x08e9('0x37')]===_0x23b219;});}if(_0x4f562e>=0x0){logger[_0x08e9('0x2e')](_0x08e9('0x38'));}else{logger[_0x08e9('0x2e')]('Using\x20the\x20admin\x20account!');_0x4f562e=_[_0x08e9('0x36')](_0x5cd22a['users'],function(_0x3ec75e){return _0x3ec75e[_0x08e9('0x39')][_0x08e9('0x1a')]===_0x08e9('0x3a');});}return _0x5cd22a[_0x08e9('0x33')][_0x4f562e];}else{if(_0x5cd22a['user'][_0x08e9('0x39')][_0x08e9('0x1a')]===_0x08e9('0x3a')){logger[_0x08e9('0x2e')](_0x08e9('0x3b'));user=_0x5cd22a[_0x08e9('0x3c')];return user;}else{logger[_0x08e9('0x2c')](_0x08e9('0x3d'),JSON['stringify'](_0x5cd22a));throw new Error(_0x08e9('0x3e')+JSON[_0x08e9('0xf')](_0x5cd22a));}}}else{logger[_0x08e9('0x2c')](_0x08e9('0x3d'),JSON[_0x08e9('0xf')](_0x5cd22a));throw new Error(_0x08e9('0x3e')+JSON[_0x08e9('0xf')](_0x5cd22a));}})[_0x08e9('0x3f')](function(_0x99c24a){console[_0x08e9('0x2c')](_0x99c24a);});}function getZohoUser(_0x4d84e6,_0x58a757){return new BPromise(function(_0x39ccdc,_0x1bdb56){request(_0x4d84e6)[_0x08e9('0x28')](function(_0x133b18){var _0x38d5b5=null;if(_0x133b18){_0x38d5b5=_0x133b18[_0x08e9('0x40')][0x0];_0x38d5b5[_0x08e9('0x41')]=_0x58a757;}_0x39ccdc(_0x38d5b5);})[_0x08e9('0x3f')](function(_0x4b3d8b){_0x1bdb56(_0x4b3d8b);});});}function createEndUser(_0x4b2fde,_0x28cb00,_0x534668,_0x12cc78,_0x4327cb,_0x2a48ef){var _0x534668=getName(_0x534668);return request({'method':_0x08e9('0x42'),'uri':_0x08e9('0x43')+_0x28cb00+_0x08e9('0x44')+_[_0x08e9('0x45')](_0x2a48ef[_0x08e9('0x46')])+'s','body':{'data':[{'Last_Name':_0x534668[0x1],'First_Name':_0x534668[0x0],'Phone':_0x12cc78,'Owner':{'name':!_[_0x08e9('0x35')](_0x4327cb[_0x08e9('0x47')]['name'])?_0x4327cb[_0x08e9('0x47')]['name']:!_[_0x08e9('0x35')](_0x4327cb[_0x08e9('0x48')])?_0x4327cb[_0x08e9('0x48')]+'\x20'+_0x4327cb[_0x08e9('0x49')]:_0x4327cb[_0x08e9('0x49')],'id':_0x4327cb['id']}}]},'headers':{'Authorization':_0x08e9('0x4a')+_0x4b2fde},'json':!![]})[_0x08e9('0x28')](function(_0x2fe4ba){if(_0x2fe4ba&&_0x2fe4ba[_0x08e9('0x40')][0x0][_0x08e9('0x4b')]==='SUCCESS'){var _0x3fa8cd=_0x2fe4ba[_0x08e9('0x40')][0x0][_0x08e9('0x4c')];_0x3fa8cd[_0x08e9('0x41')]=_[_0x08e9('0x45')](_0x2a48ef[_0x08e9('0x46')])+'s';return _0x3fa8cd;}logger[_0x08e9('0x2c')](_0x08e9('0x3d'),JSON[_0x08e9('0xf')](data));throw new Error('Error:\x20'+JSON[_0x08e9('0xf')](data));})[_0x08e9('0x3f')](function(_0x11ffe7){console[_0x08e9('0x4d')](_0x08e9('0x4e'),_0x11ffe7);});}function getEndUser(_0x4eb492,_0x49b422,_0xdcc9f1,_0x32adcc,_0x28542a,_0x52542c,_0x552f89){var _0x2d908a={'method':_0x08e9('0x2f'),'uri':'','headers':{'Authorization':_0x08e9('0x4a')+_0x4eb492},'json':!![]};switch(_0x552f89[_0x08e9('0x4f')]){case _0x08e9('0x50'):_0x2d908a[_0x08e9('0x51')]=_0x08e9('0x43')+_0x49b422+_0x08e9('0x52')+_0x28542a+'))';return getZohoUser(_0x2d908a,_0x08e9('0x53'))['then'](function(_0x21e242){if(_0x21e242)return _0x21e242;_0x2d908a[_0x08e9('0x51')]=_0x08e9('0x43')+_0x49b422+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x28542a+'))';return getZohoUser(_0x2d908a,'Leads')['then'](function(_0x3196c0){if(_0x3196c0)return _0x3196c0;if(_0x552f89[_0x08e9('0x46')]!=_0x08e9('0x54')){return createEndUser(_0x4eb492,_0x49b422,_0x32adcc,_0x28542a,_0x52542c,_0x552f89);}else{return{};}});});break;case _0x08e9('0x55'):_0x2d908a[_0x08e9('0x51')]=_0x08e9('0x43')+_0x49b422+_0x08e9('0x52')+_0x28542a+'))';return getZohoUser(_0x2d908a,_0x08e9('0x53'))[_0x08e9('0x28')](function(_0x4f8bfd){if(_0x4f8bfd)return _0x4f8bfd;if(_0x552f89[_0x08e9('0x46')]!=_0x08e9('0x54')){return createEndUser(_0x4eb492,_0x49b422,_0x32adcc,_0x28542a,_0x52542c,_0x552f89);}else{return{};}});break;case _0x08e9('0x56'):_0x2d908a[_0x08e9('0x51')]=_0x08e9('0x43')+_0x49b422+_0x08e9('0x57')+_0x28542a+'))';return getZohoUser(_0x2d908a,'Leads')[_0x08e9('0x28')](function(_0x1ed336){if(_0x1ed336)return _0x1ed336;if(_0x552f89['moduleCreate']!='nothing'){return createEndUser(_0x4eb492,_0x49b422,_0x32adcc,_0x28542a,_0x52542c,_0x552f89);}else{return{};}});break;}}function getCall(_0x52349d,_0x570822,_0x57ffb8,_0x2e8cb4,_0x5437b1,_0xeffbfc,_0x2710f1,_0x569294){logger[_0x08e9('0x2e')](_0x08e9('0x58'));var _0x1d9336={};_0x1d9336[_0x08e9('0x59')]={'name':!_[_0x08e9('0x35')](_0x2e8cb4[_0x08e9('0x47')]['name'])&&!_[_0x08e9('0x35')](_0x2e8cb4['profile'][_0x08e9('0x1a')])&&_0x2e8cb4['profile'][_0x08e9('0x1a')]===_0x08e9('0x5a')?_0x2e8cb4[_0x08e9('0x47')][_0x08e9('0x1a')]:!_[_0x08e9('0x35')](_0x2e8cb4['first_name'])?_0x2e8cb4[_0x08e9('0x48')]+'\x20'+_0x2e8cb4[_0x08e9('0x49')]:_0x2e8cb4[_0x08e9('0x49')],'id':_0x2e8cb4['id']};_0x1d9336['Subject']=intUtil[_0x08e9('0x5b')](_0xeffbfc[_0x08e9('0x5c')],_0x2710f1,'\x20');_0x1d9336[_0x08e9('0x5d')]=intUtil[_0x08e9('0x5b')](_0xeffbfc[_0x08e9('0x5e')],_0x2710f1,'\x0a');if(_0x5437b1[_0x08e9('0x41')]===_0x08e9('0x53')){_0x1d9336[_0x08e9('0x5f')]={'name':!_[_0x08e9('0x35')](_0x5437b1[_0x08e9('0x60')])?_0x5437b1[_0x08e9('0x60')]:!_[_0x08e9('0x35')](_0x5437b1[_0x08e9('0x61')])?_0x5437b1[_0x08e9('0x61')]+'\x20'+_0x5437b1['Last_Name']:_0x5437b1[_0x08e9('0x62')],'id':_0x5437b1['id']};}if(_0x5437b1[_0x08e9('0x41')]===_0x08e9('0x63')){_0x1d9336['What_Id']={'name':!_[_0x08e9('0x35')](_0x5437b1[_0x08e9('0x60')])?_0x5437b1[_0x08e9('0x60')]:!_['isNil'](_0x5437b1['First_Name'])?_0x5437b1['First_Name']+'\x20'+_0x5437b1['Last_Name']:_0x5437b1[_0x08e9('0x62')],'id':_0x5437b1['id']};_0x1d9336['$se_module']=_[_0x08e9('0x45')](_0x5437b1[_0x08e9('0x41')]);}if(_0x2710f1[_0x08e9('0x64')]){_0x1d9336['Call_Duration']=moment[_0x08e9('0x65')](parseInt(_0x2710f1['talktime'])*0x3e8)[_0x08e9('0x30')](_0x08e9('0x66'));}else if(_0x2710f1[_0x08e9('0x67')]&&_0x2710f1[_0x08e9('0x68')]){_0x1d9336[_0x08e9('0x69')]=moment['utc'](moment(_0x2710f1[_0x08e9('0x68')],_0x08e9('0x6a'))[_0x08e9('0x6b')](moment(_0x2710f1['starttime'],_0x08e9('0x6a'))))[_0x08e9('0x30')]('mm:ss');}switch(_0x2710f1[_0x08e9('0x6c')]){case _0x08e9('0x6d'):_0x1d9336[_0x08e9('0x6e')]=_0x08e9('0x6f');break;case _0x08e9('0x70'):case _0x08e9('0x71'):_0x1d9336[_0x08e9('0x6e')]=_0x08e9('0x72');break;case'rejected':_0x1d9336[_0x08e9('0x6e')]=_0x08e9('0x73');break;case _0x08e9('0x74'):_0x1d9336['Call_Result']=_0x08e9('0x75');break;default:}_0x1d9336[_0x08e9('0x76')]=(_0x569294===_0x08e9('0x77')?moment(_0x2710f1['starttime'])['format']('YYYY-MM-DDTHH:mm:ss'):moment(_0x2710f1[_0x08e9('0x78')])[_0x08e9('0x30')](_0x08e9('0x6a')))||moment()[_0x08e9('0x30')](_0x08e9('0x6a'));_0x1d9336[_0x08e9('0x79')]=_0x569294||'Inbound';_0x1d9336=_[_0x08e9('0x7a')](_0x1d9336,getCustomFields(_0xeffbfc[_0x08e9('0x7b')],_0x2710f1));return request({'method':_0x08e9('0x42'),'uri':_0x08e9('0x43')+_0x570822+_0x08e9('0x7c'),'headers':{'Authorization':_0x08e9('0x4a')+_0x52349d},'body':{'data':[_0x1d9336]},'json':!![]})[_0x08e9('0x28')](function(_0x35a37d){if(_0x35a37d&&_0x35a37d[_0x08e9('0x40')][0x0][_0x08e9('0x4b')]===_0x08e9('0x7d')){logger[_0x08e9('0x2e')]('Call\x20created!');return{'id':_0x35a37d['data'][0x0]['details']['id']};}})[_0x08e9('0x3f')](function(_0x2bd708){logger['info'](_0x08e9('0x7e'),_0x2bd708[_0x08e9('0x2d')]);console[_0x08e9('0x4d')](_0x08e9('0x7e'),_0x2bd708);});}exports[_0x08e9('0x7f')]=function(_0x406bc3,_0x1e93c9,_0x15aaab,_0x276db5,_0x2e36a2,_0x53e9a1){var _0x591807,_0x27abb4,_0x491943;_0x53e9a1[_0x08e9('0x80')]=intUtil[_0x08e9('0x81')](_0x53e9a1[_0x08e9('0x80')]);_0x53e9a1[_0x08e9('0x82')]=intUtil[_0x08e9('0x81')](_0x53e9a1[_0x08e9('0x82')]);if(_0x2e36a2&&_0x2e36a2[_0x08e9('0x83')]){logger['info']('[QUEUE]',_0x08e9('0x84'));_0x1e93c9[_0x08e9('0x85')]=_0x53e9a1[_0x08e9('0x82')]+'/api/voice/recordings/'+_0x1e93c9[_0x08e9('0x86')]+_0x08e9('0x87')+md5(_0x1e93c9[_0x08e9('0x86')]);}else{_0x1e93c9[_0x08e9('0x85')]='';}var _0x18230e=_0x53e9a1['host']===_0x08e9('0x88')?'eu':_0x08e9('0x89');return getAccessToken(_0x53e9a1)['then'](function(_0x56f71e){_0x491943=_0x56f71e;return getUser(_0x491943,_0x18230e,_0x53e9a1,_0x276db5['email']);})[_0x08e9('0x28')](function(_0x5d2215){_0x591807=_0x5d2215;logger[_0x08e9('0x2e')](_0x08e9('0x8a'),_0x591807['id']);return getEndUser(_0x491943,_0x18230e,_0x53e9a1,_0x1e93c9[_0x08e9('0x8b')],_0x1e93c9[_0x08e9('0x8c')],_0x591807,_0x15aaab);})[_0x08e9('0x28')](function(_0x3993e1){_0x27abb4=_0x3993e1;return getCall(_0x491943,_0x18230e,_0x53e9a1,_0x591807,_0x27abb4,_0x15aaab,_0x1e93c9,_0x08e9('0x8d'));})[_0x08e9('0x28')](function(_0x395e1b){if(_0x395e1b){logger[_0x08e9('0x2e')]('The\x20Call\x20ID\x20is:',_0x395e1b['id']);logger['info']('[QUEUE]',_0x08e9('0x8e'));emit(util[_0x08e9('0x30')](_0x08e9('0x8f'),_0x276db5[_0x08e9('0x1a')]),_0x08e9('0x90'),{'uri':'https://crm.'+_0x53e9a1['host']+_0x08e9('0x91')+_0x395e1b['id']});}})[_0x08e9('0x3f')](function(_0x2f7576){logger[_0x08e9('0x2c')](_0x08e9('0x92'),JSON[_0x08e9('0xf')](_0x2f7576));});};exports[_0x08e9('0x77')]=function(_0x51b03d,_0x3019bc,_0x11bd0f,_0x2ff742,_0x46aba7,_0x30844b,_0x2e1391){var _0x233e2d,_0x22bf60,_0x9ee191;_0x30844b[_0x08e9('0x80')]=intUtil[_0x08e9('0x81')](_0x30844b[_0x08e9('0x80')]);_0x30844b['serverUrl']=intUtil[_0x08e9('0x81')](_0x30844b[_0x08e9('0x82')]);if(_0x2e1391&&_0x2e1391[_0x08e9('0x93')]&&_0x2e1391[_0x08e9('0x93')]!==_0x08e9('0x94')){logger[_0x08e9('0x2e')](_0x08e9('0x95'),_0x08e9('0x84'));_0x3019bc['recordingURL']=_0x30844b[_0x08e9('0x82')]+_0x08e9('0x96')+_0x3019bc[_0x08e9('0x86')]+_0x08e9('0x87')+md5(_0x3019bc['uniqueid']);}var _0x553f6f=_0x30844b[_0x08e9('0x80')]===_0x08e9('0x88')?'eu':_0x08e9('0x89');return getAccessToken(_0x30844b)[_0x08e9('0x28')](function(_0xce671a){_0x9ee191=_0xce671a;return getUser(_0x9ee191,_0x553f6f,_0x30844b,_0x2ff742[_0x08e9('0x37')]);})[_0x08e9('0x28')](function(_0x31c615){_0x233e2d=_0x31c615;logger[_0x08e9('0x2e')](_0x08e9('0x8a'),_0x233e2d['id']);return getEndUser(_0x9ee191,_0x553f6f,_0x30844b,_0x3019bc['destcalleridname'],_0x3019bc['destcalleridnum'],_0x233e2d,_0x11bd0f);})[_0x08e9('0x28')](function(_0x3e6198){_0x22bf60=_0x3e6198;return getCall(_0x9ee191,_0x553f6f,_0x30844b,_0x233e2d,_0x22bf60,_0x11bd0f,_0x3019bc,_0x08e9('0x97'));})[_0x08e9('0x28')](function(_0x179ba4){if(_0x179ba4){logger[_0x08e9('0x2e')](_0x08e9('0x98'),_0x179ba4['id']);logger[_0x08e9('0x2e')](_0x08e9('0x95'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format']('user:%s',_0x2ff742['name']),'trigger:browser:url',{'uri':'https://crm.'+_0x30844b[_0x08e9('0x80')]+'/crm/EntityInfo.do?module=Calls&id='+_0x179ba4['id']});}})[_0x08e9('0x3f')](function(_0x235e14){logger[_0x08e9('0x2c')](_0x08e9('0x95'),JSON[_0x08e9('0xf')](_0x235e14));});};exports[_0x08e9('0x74')]=function(_0x598a64,_0x413ee5,_0xa33bdf,_0x1ea27c,_0x1c06d4,_0x425bde){var _0x479160,_0x19127a,_0x5ed050;_0x425bde[_0x08e9('0x80')]=intUtil[_0x08e9('0x81')](_0x425bde['host']);_0x425bde['serverUrl']=intUtil[_0x08e9('0x81')](_0x425bde[_0x08e9('0x82')]);if(_0x1c06d4&&_0x1c06d4['monitor_format']){logger[_0x08e9('0x2e')]('[ABANDONED]','Recording\x20is\x20enabled!');_0x413ee5[_0x08e9('0x85')]=_0x425bde[_0x08e9('0x82')]+_0x08e9('0x96')+_0x413ee5[_0x08e9('0x86')]+_0x08e9('0x87')+md5(_0x413ee5[_0x08e9('0x86')]);}else{_0x413ee5[_0x08e9('0x85')]='';}var _0x32a92e=_0x425bde[_0x08e9('0x80')]===_0x08e9('0x88')?'eu':'com';return getAccessToken(_0x425bde)[_0x08e9('0x28')](function(_0x4fa6e3){_0x5ed050=_0x4fa6e3;return getUser(_0x5ed050,_0x32a92e,_0x425bde);})[_0x08e9('0x28')](function(_0x2d7f71){_0x479160=_0x2d7f71;logger[_0x08e9('0x2e')](_0x08e9('0x8a'),_0x479160['id']);return getEndUser(_0x5ed050,_0x32a92e,_0x425bde,_0x413ee5[_0x08e9('0x8b')],_0x413ee5['calleridnum'],_0x479160,_0xa33bdf);})[_0x08e9('0x28')](function(_0x4b023a){_0x19127a=_0x4b023a;return getCall(_0x5ed050,_0x32a92e,_0x425bde,_0x479160,_0x19127a,_0xa33bdf,_0x413ee5,_0x08e9('0x8d'));})[_0x08e9('0x28')](function(_0x119217){if(_0x119217){logger[_0x08e9('0x2e')]('The\x20Call\x20ID\x20is:',_0x119217['id']);}})[_0x08e9('0x3f')](function(_0x451a58){logger[_0x08e9('0x2c')]('[ABANDONED]',JSON[_0x08e9('0xf')](_0x451a58));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/script/index.js b/server/services/ami/trigger/script/index.js index 31ae213..3acc577 100644 --- a/server/services/ami/trigger/script/index.js +++ b/server/services/ami/trigger/script/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['mustache','trigger','exec','data2','Script','data3','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','shelljs'];(function(_0x4db477,_0x1f327e){var _0x4edc81=function(_0x3ad2dc){while(--_0x3ad2dc){_0x4db477['push'](_0x4db477['shift']());}};_0x4edc81(++_0x1f327e);}(_0x7a54,0x106));var _0x47a5=function(_0x328059,_0x55f72f){_0x328059=_0x328059-0x0;var _0x262876=_0x7a54[_0x328059];return _0x262876;};'use strict';var util=require(_0x47a5('0x0'));var sh=require(_0x47a5('0x1'));var Mustache=require(_0x47a5('0x2'));var logger=require('../../../../config/logger')(_0x47a5('0x3'));exports[_0x47a5('0x4')]=function(_0x4880bf,_0x5f7f12){var _0x11bf85=_0x4880bf[_0x47a5('0x5')]?_0x4880bf[_0x47a5('0x5')]:_0x47a5('0x6');var _0x545a97=_0x4880bf[_0x47a5('0x7')]?Mustache['render'](_0x4880bf[_0x47a5('0x7')],_0x5f7f12):_0x5f7f12;sh[_0x47a5('0x4')](_0x545a97,function(_0x506eda,_0x194fb0,_0x5077f3){if(_0x506eda!==0x0){logger['error'](util['format'](_0x47a5('0x8'),_0x11bf85,_0x545a97,_0x506eda,_0x5077f3));}else{logger[_0x47a5('0x9')](util['format'](_0x47a5('0xa'),_0x11bf85,_0x545a97,_0x194fb0));}});}; \ No newline at end of file +var _0x7a54=['mustache','trigger','exec','data2','Script','data3','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','shelljs'];(function(_0x292c46,_0x487b2c){var _0x37f58b=function(_0x38f269){while(--_0x38f269){_0x292c46['push'](_0x292c46['shift']());}};_0x37f58b(++_0x487b2c);}(_0x7a54,0x106));var _0x47a5=function(_0x1940af,_0x490c6f){_0x1940af=_0x1940af-0x0;var _0x12afda=_0x7a54[_0x1940af];return _0x12afda;};'use strict';var util=require(_0x47a5('0x0'));var sh=require(_0x47a5('0x1'));var Mustache=require(_0x47a5('0x2'));var logger=require('../../../../config/logger')(_0x47a5('0x3'));exports[_0x47a5('0x4')]=function(_0x4880bf,_0x5f7f12){var _0x11bf85=_0x4880bf[_0x47a5('0x5')]?_0x4880bf[_0x47a5('0x5')]:_0x47a5('0x6');var _0x545a97=_0x4880bf[_0x47a5('0x7')]?Mustache['render'](_0x4880bf[_0x47a5('0x7')],_0x5f7f12):_0x5f7f12;sh[_0x47a5('0x4')](_0x545a97,function(_0x506eda,_0x194fb0,_0x5077f3){if(_0x506eda!==0x0){logger['error'](util['format'](_0x47a5('0x8'),_0x11bf85,_0x545a97,_0x506eda,_0x5077f3));}else{logger[_0x47a5('0x9')](util['format'](_0x47a5('0xa'),_0x11bf85,_0x545a97,_0x194fb0));}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/urlforward/index.js b/server/services/ami/trigger/urlforward/index.js index 1b88382..616120e 100644 --- a/server/services/ami/trigger/urlforward/index.js +++ b/server/services/ami/trigger/urlforward/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['lodash','mustache','../../../../config/logger','trigger','exec','data1','toUpperCase','render','data2','number','data5','headers','data6','parse','stack','GET','DELETE','POST','PUT','data7','body','error','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','then','isNil',',\x20request\x20body:\x20','object','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','message','request-promise','util'];(function(_0x2e753d,_0x3068a0){var _0x234788=function(_0x185e66){while(--_0x185e66){_0x2e753d['push'](_0x2e753d['shift']());}};_0x234788(++_0x3068a0);}(_0x5f2f,0x73));var _0xf5f2=function(_0x2f7cc0,_0xa7ddc9){_0x2f7cc0=_0x2f7cc0-0x0;var _0x42ac73=_0x5f2f[_0x2f7cc0];return _0x42ac73;};'use strict';var rp=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var _=require(_0xf5f2('0x2'));var Mustache=require(_0xf5f2('0x3'));var logger=require(_0xf5f2('0x4'))(_0xf5f2('0x5'));exports[_0xf5f2('0x6')]=function(_0x107cf,_0x501fbd){var _0x4854b6,_0x1665c7;var _0x192215={'method':_0x107cf[_0xf5f2('0x7')][_0xf5f2('0x8')](),'uri':Mustache[_0xf5f2('0x9')](_0x107cf[_0xf5f2('0xa')],_0x501fbd),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x107cf['data5'])===_0xf5f2('0xb')&&parseInt(_0x107cf[_0xf5f2('0xc')])>=0x1&&parseInt(_0x107cf[_0xf5f2('0xc')])<=0xa?parseInt(_0x107cf['data5'])*0x3e8:0x5*0x3e8};try{_0x192215[_0xf5f2('0xd')]=_0x107cf[_0xf5f2('0xe')]?JSON[_0xf5f2('0xf')](Mustache['render'](_0x107cf[_0xf5f2('0xe')],_0x501fbd)):{};}catch(_0x4ebbbe){logger['error'](_0x4ebbbe[_0xf5f2('0x10')]);}switch(_0x107cf[_0xf5f2('0x7')]['toUpperCase']()){case _0xf5f2('0x11'):case _0xf5f2('0x12'):_0x4854b6=null;_0x192215['qs']=_0x501fbd;break;case _0xf5f2('0x13'):case _0xf5f2('0x14'):if(_0x107cf[_0xf5f2('0x15')]){try{_0x4854b6=JSON[_0xf5f2('0xf')](Mustache['render'](_0x107cf[_0xf5f2('0x15')],_0x501fbd));_0x192215[_0xf5f2('0x16')]=_0x4854b6;}catch(_0x269909){logger[_0xf5f2('0x17')](_0x269909[_0xf5f2('0x10')]);logger['error'](_0xf5f2('0x18'));}}else{_0x4854b6=_0x501fbd;_0x192215[_0xf5f2('0x16')]=_0x4854b6;}break;}logger[_0xf5f2('0x19')](util[_0xf5f2('0x1a')](_0xf5f2('0x1b'),_0x107cf[_0xf5f2('0x7')],_0x107cf[_0xf5f2('0xa')],JSON[_0xf5f2('0x1c')](_0x192215)));rp(_0x192215)[_0xf5f2('0x1d')](function(_0x228ace){_0x4854b6=!_[_0xf5f2('0x1e')](_0x4854b6)?_0xf5f2('0x1f')+_0x4854b6:'';_0x1665c7=typeof _0x228ace[_0xf5f2('0x16')]===_0xf5f2('0x20')?JSON[_0xf5f2('0x1c')](_0x228ace[_0xf5f2('0x16')]):_0x228ace[_0xf5f2('0x16')];logger['info'](util[_0xf5f2('0x1a')](_0xf5f2('0x21'),_0x107cf['data1'],_0x107cf['data2'],_0x228ace[_0xf5f2('0x22')],_0x1665c7));})[_0xf5f2('0x23')](function(_0x4ae323){logger[_0xf5f2('0x17')](util[_0xf5f2('0x1a')](_0xf5f2('0x24'),_0x107cf[_0xf5f2('0x7')],_0x107cf[_0xf5f2('0xa')],_0x4ae323['statusCode'],_0x4ae323[_0xf5f2('0x25')],_0x4ae323[_0xf5f2('0x26')]));});}; \ No newline at end of file +var _0xb10b=['number','headers','data6','parse','error','stack','DELETE','POST','PUT','data7','body','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','data2','stringify','then','isNil',',\x20request\x20body:\x20','object','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','data1','statusCode','name','message','request-promise','lodash','mustache','../../../../config/logger','exec','toUpperCase','render','data5'];(function(_0x4f44d6,_0x4bc54e){var _0x57aa01=function(_0x5a3b36){while(--_0x5a3b36){_0x4f44d6['push'](_0x4f44d6['shift']());}};_0x57aa01(++_0x4bc54e);}(_0xb10b,0x12a));var _0xbb10=function(_0x1a26d7,_0xb59032){_0x1a26d7=_0x1a26d7-0x0;var _0xa7c428=_0xb10b[_0x1a26d7];return _0xa7c428;};'use strict';var rp=require(_0xbb10('0x0'));var util=require('util');var _=require(_0xbb10('0x1'));var Mustache=require(_0xbb10('0x2'));var logger=require(_0xbb10('0x3'))('trigger');exports[_0xbb10('0x4')]=function(_0x9bbed,_0x460981){var _0x22320e,_0x49baf4;var _0x312b72={'method':_0x9bbed['data1'][_0xbb10('0x5')](),'uri':Mustache[_0xbb10('0x6')](_0x9bbed['data2'],_0x460981),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x9bbed[_0xbb10('0x7')])===_0xbb10('0x8')&&parseInt(_0x9bbed[_0xbb10('0x7')])>=0x1&&parseInt(_0x9bbed[_0xbb10('0x7')])<=0xa?parseInt(_0x9bbed[_0xbb10('0x7')])*0x3e8:0x5*0x3e8};try{_0x312b72[_0xbb10('0x9')]=_0x9bbed[_0xbb10('0xa')]?JSON[_0xbb10('0xb')](Mustache['render'](_0x9bbed['data6'],_0x460981)):{};}catch(_0x20bd61){logger[_0xbb10('0xc')](_0x20bd61[_0xbb10('0xd')]);}switch(_0x9bbed['data1'][_0xbb10('0x5')]()){case'GET':case _0xbb10('0xe'):_0x22320e=null;_0x312b72['qs']=_0x460981;break;case _0xbb10('0xf'):case _0xbb10('0x10'):if(_0x9bbed[_0xbb10('0x11')]){try{_0x22320e=JSON[_0xbb10('0xb')](Mustache[_0xbb10('0x6')](_0x9bbed['data7'],_0x460981));_0x312b72[_0xbb10('0x12')]=_0x22320e;}catch(_0x42d7e4){logger[_0xbb10('0xc')](_0x42d7e4[_0xbb10('0xd')]);logger[_0xbb10('0xc')](_0xbb10('0x13'));}}else{_0x22320e=_0x460981;_0x312b72[_0xbb10('0x12')]=_0x22320e;}break;}logger[_0xbb10('0x14')](util[_0xbb10('0x15')](_0xbb10('0x16'),_0x9bbed['data1'],_0x9bbed[_0xbb10('0x17')],JSON[_0xbb10('0x18')](_0x312b72)));rp(_0x312b72)[_0xbb10('0x19')](function(_0x42db98){_0x22320e=!_[_0xbb10('0x1a')](_0x22320e)?_0xbb10('0x1b')+_0x22320e:'';_0x49baf4=typeof _0x42db98[_0xbb10('0x12')]===_0xbb10('0x1c')?JSON[_0xbb10('0x18')](_0x42db98[_0xbb10('0x12')]):_0x42db98['body'];logger[_0xbb10('0x14')](util[_0xbb10('0x15')](_0xbb10('0x1d'),_0x9bbed[_0xbb10('0x1e')],_0x9bbed[_0xbb10('0x17')],_0x42db98[_0xbb10('0x1f')],_0x49baf4));})['catch'](function(_0x12f888){logger[_0xbb10('0xc')](util['format']('%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s',_0x9bbed[_0xbb10('0x1e')],_0x9bbed[_0xbb10('0x17')],_0x12f888[_0xbb10('0x1f')],_0x12f888[_0xbb10('0x20')],_0x12f888[_0xbb10('0x21')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index 8c706c4..6f98089 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 _0x295f=['Request','request','then','rpc','error','message','result','catch','exports','bluebird','../../config/logger','routing','http'];(function(_0x1b2ff7,_0x12a034){var _0x31656a=function(_0x1165a5){while(--_0x1165a5){_0x1b2ff7['push'](_0x1b2ff7['shift']());}};_0x31656a(++_0x12a034);}(_0x295f,0x168));var _0xf295=function(_0x2509c1,_0x5ab7c1){_0x2509c1=_0x2509c1-0x0;var _0xb127db=_0x295f[_0x2509c1];return _0xb127db;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0xf295('0x0'));var logger=require(_0xf295('0x1'))(_0xf295('0x2'));var client=jayson['client'][_0xf295('0x3')]({'port':0x2329});client[_0xf295('0x4')]=function(_0x59a1c5,_0x511ab5){return new BPromise(function(_0x269439,_0x21da99){return client[_0xf295('0x5')](_0x59a1c5,_0x511ab5)[_0xf295('0x6')](function(_0x36b69d){logger['debug'](_0xf295('0x7'),_0xf295('0x2'),_0x59a1c5,_0x511ab5,_0x36b69d);if(_0x36b69d[_0xf295('0x8')]){logger[_0xf295('0x8')](_0xf295('0x7'),_0xf295('0x2'),_0x59a1c5,_0x36b69d[_0xf295('0x8')][_0xf295('0x9')],_0x511ab5);return _0x21da99(_0x36b69d[_0xf295('0x8')][_0xf295('0x9')]);}else{return _0x269439(_0x36b69d[_0xf295('0xa')]);}})[_0xf295('0xb')](function(_0x5ae127){logger[_0xf295('0x8')](_0xf295('0x7'),'routing',_0x59a1c5,_0x5ae127,_0x511ab5);return _0x21da99(_0x5ae127);});});};module[_0xf295('0xc')]=client; \ No newline at end of file +var _0xbec5=['Request','request','debug','rpc','error','message','result','catch','jayson/promise','bluebird','routing','client','http'];(function(_0x2aefb6,_0x1bd384){var _0x202772=function(_0x507d3f){while(--_0x507d3f){_0x2aefb6['push'](_0x2aefb6['shift']());}};_0x202772(++_0x1bd384);}(_0xbec5,0xe5));var _0x5bec=function(_0x274638,_0x578968){_0x274638=_0x274638-0x0;var _0x5755df=_0xbec5[_0x274638];return _0x5755df;};'use strict';var jayson=require(_0x5bec('0x0'));var BPromise=require(_0x5bec('0x1'));var logger=require('../../config/logger')(_0x5bec('0x2'));var client=jayson[_0x5bec('0x3')][_0x5bec('0x4')]({'port':0x2329});client[_0x5bec('0x5')]=function(_0x244027,_0x4ee982){return new BPromise(function(_0x1f8933,_0x376cdb){return client[_0x5bec('0x6')](_0x244027,_0x4ee982)['then'](function(_0x3ed67a){logger[_0x5bec('0x7')](_0x5bec('0x8'),_0x5bec('0x2'),_0x244027,_0x4ee982,_0x3ed67a);if(_0x3ed67a[_0x5bec('0x9')]){logger[_0x5bec('0x9')](_0x5bec('0x8'),_0x5bec('0x2'),_0x244027,_0x3ed67a['error'][_0x5bec('0xa')],_0x4ee982);return _0x376cdb(_0x3ed67a['error'][_0x5bec('0xa')]);}else{return _0x1f8933(_0x3ed67a[_0x5bec('0xb')]);}})[_0x5bec('0xc')](function(_0x4a5482){logger[_0x5bec('0x9')](_0x5bec('0x8'),_0x5bec('0x2'),_0x244027,_0x4a5482,_0x4ee982);return _0x376cdb(_0x4a5482);});});};module['exports']=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index f105f9d..0cdb29c 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 _0x5697=['./rpc/mailAccount','initMailAccounts','listen','then','Setting','loginMailFrequency','catch','log','bluebird','./realtime','./lib/email'];(function(_0x4a94b1,_0x4f2518){var _0x20949f=function(_0x1c4aa6){while(--_0x1c4aa6){_0x4a94b1['push'](_0x4a94b1['shift']());}};_0x20949f(++_0x4f2518);}(_0x5697,0x1b5));var _0x7569=function(_0x559a80,_0x3d193d){_0x559a80=_0x559a80-0x0;var _0x42f555=_0x5697[_0x559a80];return _0x42f555;};'use strict';var BPromise=require(_0x7569('0x0'));var server=require('./server');var Realtime=require(_0x7569('0x1'));var EmailChannel=require(_0x7569('0x2'));var mailAccount=require(_0x7569('0x3'));var realtime=new Realtime();var email=new EmailChannel(realtime);var db=require('../../mysqldb')['db'];function initRealtime(){return BPromise['resolve']()['then'](mailAccount['getMailAccounts']())['then'](realtime[_0x7569('0x4')]())['then'](function(){email['refresh'](realtime['mailAccounts']);return realtime;});}function main(){return server[_0x7569('0x5')](realtime,email)[_0x7569('0x6')](function(_0x30b7e2){return initRealtime();})[_0x7569('0x6')](function(_0x3c0470){return db[_0x7569('0x7')]['findOne']({'attributes':['id',_0x7569('0x8')],'raw':!![]});})['then'](function(_0x9458b7){return setInterval(initRealtime,_0x9458b7[_0x7569('0x8')]*0x3e8);})[_0x7569('0x9')](function(_0xa4f75a){console[_0x7569('0xa')](_0xa4f75a);});}main(); \ No newline at end of file +var _0xfc65=['catch','bluebird','./lib/email','./rpc/mailAccount','../../mysqldb','resolve','then','getMailAccounts','initMailAccounts','refresh','mailAccounts','listen','Setting','findOne','loginMailFrequency'];(function(_0x334599,_0x4b1cfa){var _0x4cdff2=function(_0x297be7){while(--_0x297be7){_0x334599['push'](_0x334599['shift']());}};_0x4cdff2(++_0x4b1cfa);}(_0xfc65,0x1e1));var _0x5fc6=function(_0x1cfbac,_0x4b087a){_0x1cfbac=_0x1cfbac-0x0;var _0x555297=_0xfc65[_0x1cfbac];return _0x555297;};'use strict';var BPromise=require(_0x5fc6('0x0'));var server=require('./server');var Realtime=require('./realtime');var EmailChannel=require(_0x5fc6('0x1'));var mailAccount=require(_0x5fc6('0x2'));var realtime=new Realtime();var email=new EmailChannel(realtime);var db=require(_0x5fc6('0x3'))['db'];function initRealtime(){return BPromise[_0x5fc6('0x4')]()[_0x5fc6('0x5')](mailAccount[_0x5fc6('0x6')]())[_0x5fc6('0x5')](realtime[_0x5fc6('0x7')]())[_0x5fc6('0x5')](function(){email[_0x5fc6('0x8')](realtime[_0x5fc6('0x9')]);return realtime;});}function main(){return server[_0x5fc6('0xa')](realtime,email)[_0x5fc6('0x5')](function(_0x572941){return initRealtime();})[_0x5fc6('0x5')](function(_0x1f1409){return db[_0x5fc6('0xb')][_0x5fc6('0xc')]({'attributes':['id',_0x5fc6('0xd')],'raw':!![]});})[_0x5fc6('0x5')](function(_0x23c4e2){return setInterval(initRealtime,_0x23c4e2[_0x5fc6('0xd')]*0x3e8);})[_0x5fc6('0xe')](function(_0x29781f){console['log'](_0x29781f);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 8f182dc..5b087f5 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 _0xc0f9=['info','mailAccounts','smtp','prototype','name','key','active','Imap','status','messageStatus','isNil','md5','emit','mailAccount:update','hasOwnProperty','imapAccounts','box','bind','handleImapEmail','end','handleImapEnd','error','handleImapError','disabled','handleImapBox','connected','total','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','from','notify','catch','stringify','send','verifySmtp','Smtp','verify','verified','lodash','bluebird','ioredis','../../../config/environment','../../../config/logger','email','redis','defaults','socket.io-emitter','./imap','./smtp','../rpc/mailAccount'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xc0f9,0x1f2));var _0x9c0f=function(_0x4ffa03,_0x363a82){_0x4ffa03=_0x4ffa03-0x0;var _0x30d661=_0xc0f9[_0x4ffa03];return _0x30d661;};'use strict';var _=require(_0x9c0f('0x0'));var moment=require('moment');var BPromise=require(_0x9c0f('0x1'));var md5=require('md5');var Redis=require(_0x9c0f('0x2'));var config=require(_0x9c0f('0x3'));var logger=require(_0x9c0f('0x4'))(_0x9c0f('0x5'));config[_0x9c0f('0x6')]=_[_0x9c0f('0x7')](config[_0x9c0f('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x9c0f('0x8'))(new Redis(config['redis']));var EmailImap=require(_0x9c0f('0x9'));var EmailSmtp=require(_0x9c0f('0xa'));var mailAccount=require(_0x9c0f('0xb'));var md5Accounts={};function EmailChannel(_0x16f921){logger[_0x9c0f('0xc')]('start\x20email\x20channel');this[_0x9c0f('0xd')]=_0x16f921[_0x9c0f('0xd')];this['imapAccounts']={};this[_0x9c0f('0xe')]=new EmailSmtp();}EmailChannel[_0x9c0f('0xf')]['emit']=function(_0x3bdeea){var _0x306cfd=this[_0x9c0f('0xd')][_0x3bdeea];var _0x1434f7={'id':_0x306cfd['id'],'name':_0x306cfd[_0x9c0f('0x10')],'key':_0x306cfd[_0x9c0f('0x11')],'active':_0x306cfd[_0x9c0f('0x12')],'Imap':{'status':_0x306cfd[_0x9c0f('0x13')][_0x9c0f('0x14')],'messageStatus':_0x306cfd[_0x9c0f('0x13')][_0x9c0f('0x15')],'total':_0x306cfd[_0x9c0f('0x13')]['total']}};if(_[_0x9c0f('0x16')](md5Accounts[_0x3bdeea])){md5Accounts[_0x3bdeea]={};}var _0x1d5699=md5(JSON['stringify'](_0x1434f7));if(md5Accounts[_0x3bdeea][_0x9c0f('0x17')]!==_0x1d5699){md5Accounts[_0x3bdeea][_0x9c0f('0x17')]=_0x1d5699;io[_0x9c0f('0x18')](_0x9c0f('0x19'),_0x1434f7);}};EmailChannel[_0x9c0f('0xf')]['refresh']=function(_0x517527){for(var _0x1e6adb in _0x517527){if(_0x517527[_0x9c0f('0x1a')](_0x1e6adb)){if(_0x517527[_0x1e6adb][_0x9c0f('0x13')]&&_0x517527[_0x1e6adb][_0x9c0f('0x12')]){var _0x553728=_0x517527[_0x1e6adb][_0x9c0f('0x13')];if(!this[_0x9c0f('0x1b')][_0x9c0f('0x1a')](_0x553728['id'])){this[_0x9c0f('0x1b')][_0x553728['id']]=new EmailImap(_0x553728,_0x517527[_0x1e6adb][_0x9c0f('0x5')]);this['imapAccounts'][_0x553728['id']]['on'](_0x9c0f('0x1c'),this['handleImapBox'][_0x9c0f('0x1d')](this,_0x1e6adb));this[_0x9c0f('0x1b')][_0x553728['id']]['on'](_0x9c0f('0x5'),this[_0x9c0f('0x1e')]['bind'](this,_0x1e6adb));this[_0x9c0f('0x1b')][_0x553728['id']]['on'](_0x9c0f('0x1f'),this[_0x9c0f('0x20')]['bind'](this,_0x1e6adb));this[_0x9c0f('0x1b')][_0x553728['id']]['on'](_0x9c0f('0x21'),this[_0x9c0f('0x22')]['bind'](this,_0x1e6adb));}}else{if(_[_0x9c0f('0x16')](this['mailAccounts'][_0x1e6adb]['Imap'])){this[_0x9c0f('0xd')][_0x1e6adb][_0x9c0f('0x13')]={};}this[_0x9c0f('0xd')][_0x1e6adb]['Imap'][_0x9c0f('0x14')]=_0x9c0f('0x23');this[_0x9c0f('0xd')][_0x1e6adb]['Imap'][_0x9c0f('0x15')]='';this[_0x9c0f('0x18')](_0x1e6adb);}}}};EmailChannel[_0x9c0f('0xf')][_0x9c0f('0x24')]=function(_0x29e9db,_0x2ef1ad){if(this[_0x9c0f('0xd')][_0x29e9db]){this[_0x9c0f('0xd')][_0x29e9db][_0x9c0f('0x13')]['status']=_0x9c0f('0x25');this['mailAccounts'][_0x29e9db][_0x9c0f('0x13')][_0x9c0f('0x15')]=_0x2ef1ad[_0x9c0f('0x10')];if(_0x2ef1ad['messages']){this[_0x9c0f('0xd')][_0x29e9db][_0x9c0f('0x13')][_0x9c0f('0x26')]=_0x2ef1ad[_0x9c0f('0x27')][_0x9c0f('0x26')];}return this[_0x9c0f('0x18')](_0x29e9db);}};EmailChannel[_0x9c0f('0xf')][_0x9c0f('0x1e')]=function(_0x2b53a1,_0x17afee){logger[_0x9c0f('0xc')](_0x9c0f('0x28'),_0x17afee[_0x9c0f('0x29')],_0x17afee['lastName'],_0x17afee[_0x9c0f('0x2a')],_0x2b53a1);if(this['mailAccounts'][_0x2b53a1]){return mailAccount[_0x9c0f('0x2b')](_0x2b53a1,_0x17afee)['then'](function(_0x561ab2){if(_0x561ab2){logger[_0x9c0f('0xc')]('Mail\x20accepted\x20from\x20routing');}})[_0x9c0f('0x2c')](function(_0x2bf9e0){logger[_0x9c0f('0x21')]('Mail\x20not\x20accepted\x20from\x20routing\x20%s',JSON[_0x9c0f('0x2d')](_0x2bf9e0));});}};EmailChannel[_0x9c0f('0xf')][_0x9c0f('0x20')]=function(_0x2d4022){if(this[_0x9c0f('0xd')][_0x2d4022]&&this[_0x9c0f('0xd')][_0x2d4022]['Imap']){if(this[_0x9c0f('0x1b')][this[_0x9c0f('0xd')][_0x2d4022][_0x9c0f('0x13')]['id']]){delete this['imapAccounts'][this[_0x9c0f('0xd')][_0x2d4022][_0x9c0f('0x13')]['id']];}this[_0x9c0f('0xd')][_0x2d4022]['Imap']['lastSync']=moment();this['emit'](_0x2d4022);}};EmailChannel[_0x9c0f('0xf')][_0x9c0f('0x22')]=function(_0x5a8d5d,_0xe98230){if(this[_0x9c0f('0xd')][_0x5a8d5d]){this[_0x9c0f('0xd')][_0x5a8d5d][_0x9c0f('0x13')]['status']=_0x9c0f('0x21');this['mailAccounts'][_0x5a8d5d][_0x9c0f('0x13')][_0x9c0f('0x15')]=_0xe98230;return this['emit'](_0x5a8d5d);}};EmailChannel[_0x9c0f('0xf')]['sendMail']=function(_0x1f3145,_0x455ee6){return this['smtp'][_0x9c0f('0x2e')](_0x1f3145,_0x455ee6);};EmailChannel[_0x9c0f('0xf')][_0x9c0f('0x2f')]=function(_0x465aa3){var _0x1e49eb=this;if(this['mailAccounts'][_0x465aa3['id']]){if(_[_0x9c0f('0x16')](this[_0x9c0f('0xd')][_0x465aa3['id']][_0x9c0f('0x30')])){this['mailAccounts'][_0x465aa3['id']]['Smtp']={};}this[_0x9c0f('0xd')][_0x465aa3['id']][_0x9c0f('0x30')]['lastSync']=moment();return new BPromise(function(_0x436d1d,_0x4113c5){return _0x1e49eb[_0x9c0f('0xe')][_0x9c0f('0x31')](_0x465aa3)['then'](function(_0x2351f4){_0x1e49eb[_0x9c0f('0xd')][_0x465aa3['id']][_0x9c0f('0x30')]['status']=_0x9c0f('0x32');_0x1e49eb[_0x9c0f('0xd')][_0x465aa3['id']][_0x9c0f('0x30')][_0x9c0f('0x15')]='';_0x1e49eb[_0x9c0f('0x18')](_0x465aa3['id']);_0x436d1d(_0x2351f4);})['catch'](function(_0x596103){_0x1e49eb[_0x9c0f('0xd')][_0x465aa3['id']][_0x9c0f('0x30')][_0x9c0f('0x14')]=_0x9c0f('0x21');_0x1e49eb[_0x9c0f('0xd')][_0x465aa3['id']][_0x9c0f('0x30')][_0x9c0f('0x15')]=_0x596103;_0x1e49eb[_0x9c0f('0x18')](_0x465aa3['id']);_0x4113c5(_0x596103);});});}return this[_0x9c0f('0xe')]['verify'](_0x465aa3);};module['exports']=EmailChannel; \ No newline at end of file +var _0x7993=['firstName','notify','Mail\x20not\x20accepted\x20from\x20routing\x20%s','stringify','lastSync','sendMail','send','verifySmtp','Smtp','verified','verify','lodash','moment','bluebird','ioredis','../../../config/environment','../../../config/logger','email','redis','localhost','socket.io-emitter','./imap','./smtp','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','prototype','emit','name','key','active','status','Imap','isNil','md5','mailAccount:update','hasOwnProperty','box','handleImapBox','bind','handleImapEmail','end','handleImapEnd','error','handleImapError','connected','messageStatus','messages','total'];(function(_0x1f0178,_0x2acb5a){var _0x3bcd39=function(_0x554914){while(--_0x554914){_0x1f0178['push'](_0x1f0178['shift']());}};_0x3bcd39(++_0x2acb5a);}(_0x7993,0x1df));var _0x3799=function(_0x316223,_0xed9871){_0x316223=_0x316223-0x0;var _0x175aab=_0x7993[_0x316223];return _0x175aab;};'use strict';var _=require(_0x3799('0x0'));var moment=require(_0x3799('0x1'));var BPromise=require(_0x3799('0x2'));var md5=require('md5');var Redis=require(_0x3799('0x3'));var config=require(_0x3799('0x4'));var logger=require(_0x3799('0x5'))(_0x3799('0x6'));config[_0x3799('0x7')]=_['defaults'](config[_0x3799('0x7')],{'host':_0x3799('0x8'),'port':0x18eb});var io=require(_0x3799('0x9'))(new Redis(config[_0x3799('0x7')]));var EmailImap=require(_0x3799('0xa'));var EmailSmtp=require(_0x3799('0xb'));var mailAccount=require(_0x3799('0xc'));var md5Accounts={};function EmailChannel(_0x2b1549){logger[_0x3799('0xd')](_0x3799('0xe'));this['mailAccounts']=_0x2b1549[_0x3799('0xf')];this[_0x3799('0x10')]={};this[_0x3799('0x11')]=new EmailSmtp();}EmailChannel[_0x3799('0x12')][_0x3799('0x13')]=function(_0x32f552){var _0x26ea80=this['mailAccounts'][_0x32f552];var _0x9955c0={'id':_0x26ea80['id'],'name':_0x26ea80[_0x3799('0x14')],'key':_0x26ea80[_0x3799('0x15')],'active':_0x26ea80[_0x3799('0x16')],'Imap':{'status':_0x26ea80['Imap'][_0x3799('0x17')],'messageStatus':_0x26ea80[_0x3799('0x18')]['messageStatus'],'total':_0x26ea80['Imap']['total']}};if(_[_0x3799('0x19')](md5Accounts[_0x32f552])){md5Accounts[_0x32f552]={};}var _0x29e287=md5(JSON['stringify'](_0x9955c0));if(md5Accounts[_0x32f552][_0x3799('0x1a')]!==_0x29e287){md5Accounts[_0x32f552]['md5']=_0x29e287;io[_0x3799('0x13')](_0x3799('0x1b'),_0x9955c0);}};EmailChannel[_0x3799('0x12')]['refresh']=function(_0x329fbc){for(var _0x615ab7 in _0x329fbc){if(_0x329fbc['hasOwnProperty'](_0x615ab7)){if(_0x329fbc[_0x615ab7][_0x3799('0x18')]&&_0x329fbc[_0x615ab7][_0x3799('0x16')]){var _0x61f65=_0x329fbc[_0x615ab7][_0x3799('0x18')];if(!this[_0x3799('0x10')][_0x3799('0x1c')](_0x61f65['id'])){this[_0x3799('0x10')][_0x61f65['id']]=new EmailImap(_0x61f65,_0x329fbc[_0x615ab7][_0x3799('0x6')]);this['imapAccounts'][_0x61f65['id']]['on'](_0x3799('0x1d'),this[_0x3799('0x1e')][_0x3799('0x1f')](this,_0x615ab7));this['imapAccounts'][_0x61f65['id']]['on'](_0x3799('0x6'),this[_0x3799('0x20')][_0x3799('0x1f')](this,_0x615ab7));this[_0x3799('0x10')][_0x61f65['id']]['on'](_0x3799('0x21'),this[_0x3799('0x22')][_0x3799('0x1f')](this,_0x615ab7));this[_0x3799('0x10')][_0x61f65['id']]['on'](_0x3799('0x23'),this[_0x3799('0x24')][_0x3799('0x1f')](this,_0x615ab7));}}else{if(_['isNil'](this[_0x3799('0xf')][_0x615ab7]['Imap'])){this[_0x3799('0xf')][_0x615ab7][_0x3799('0x18')]={};}this['mailAccounts'][_0x615ab7]['Imap'][_0x3799('0x17')]='disabled';this[_0x3799('0xf')][_0x615ab7][_0x3799('0x18')]['messageStatus']='';this['emit'](_0x615ab7);}}}};EmailChannel['prototype'][_0x3799('0x1e')]=function(_0x2cd551,_0x283fb2){if(this[_0x3799('0xf')][_0x2cd551]){this[_0x3799('0xf')][_0x2cd551][_0x3799('0x18')][_0x3799('0x17')]=_0x3799('0x25');this[_0x3799('0xf')][_0x2cd551][_0x3799('0x18')][_0x3799('0x26')]=_0x283fb2[_0x3799('0x14')];if(_0x283fb2['messages']){this[_0x3799('0xf')][_0x2cd551][_0x3799('0x18')]['total']=_0x283fb2[_0x3799('0x27')][_0x3799('0x28')];}return this[_0x3799('0x13')](_0x2cd551);}};EmailChannel[_0x3799('0x12')][_0x3799('0x20')]=function(_0x4fff64,_0x78de05){logger['info']('New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s',_0x78de05[_0x3799('0x29')],_0x78de05['lastName'],_0x78de05['from'],_0x4fff64);if(this[_0x3799('0xf')][_0x4fff64]){return mailAccount[_0x3799('0x2a')](_0x4fff64,_0x78de05)['then'](function(_0x1f3e34){if(_0x1f3e34){logger[_0x3799('0xd')]('Mail\x20accepted\x20from\x20routing');}})['catch'](function(_0x5e8544){logger[_0x3799('0x23')](_0x3799('0x2b'),JSON[_0x3799('0x2c')](_0x5e8544));});}};EmailChannel['prototype'][_0x3799('0x22')]=function(_0x1e5d5c){if(this[_0x3799('0xf')][_0x1e5d5c]&&this[_0x3799('0xf')][_0x1e5d5c][_0x3799('0x18')]){if(this[_0x3799('0x10')][this[_0x3799('0xf')][_0x1e5d5c][_0x3799('0x18')]['id']]){delete this[_0x3799('0x10')][this[_0x3799('0xf')][_0x1e5d5c][_0x3799('0x18')]['id']];}this['mailAccounts'][_0x1e5d5c][_0x3799('0x18')][_0x3799('0x2d')]=moment();this['emit'](_0x1e5d5c);}};EmailChannel[_0x3799('0x12')][_0x3799('0x24')]=function(_0x2b34ef,_0x48a9f8){if(this[_0x3799('0xf')][_0x2b34ef]){this[_0x3799('0xf')][_0x2b34ef]['Imap'][_0x3799('0x17')]='error';this[_0x3799('0xf')][_0x2b34ef][_0x3799('0x18')][_0x3799('0x26')]=_0x48a9f8;return this['emit'](_0x2b34ef);}};EmailChannel[_0x3799('0x12')][_0x3799('0x2e')]=function(_0x8a41ba,_0x3dc72e){return this[_0x3799('0x11')][_0x3799('0x2f')](_0x8a41ba,_0x3dc72e);};EmailChannel[_0x3799('0x12')][_0x3799('0x30')]=function(_0x20f2bd){var _0x468fae=this;if(this['mailAccounts'][_0x20f2bd['id']]){if(_['isNil'](this[_0x3799('0xf')][_0x20f2bd['id']][_0x3799('0x31')])){this[_0x3799('0xf')][_0x20f2bd['id']][_0x3799('0x31')]={};}this[_0x3799('0xf')][_0x20f2bd['id']][_0x3799('0x31')][_0x3799('0x2d')]=moment();return new BPromise(function(_0x14d0fb,_0x14ad1a){return _0x468fae[_0x3799('0x11')]['verify'](_0x20f2bd)['then'](function(_0x46daa3){_0x468fae['mailAccounts'][_0x20f2bd['id']][_0x3799('0x31')][_0x3799('0x17')]=_0x3799('0x32');_0x468fae[_0x3799('0xf')][_0x20f2bd['id']][_0x3799('0x31')][_0x3799('0x26')]='';_0x468fae[_0x3799('0x13')](_0x20f2bd['id']);_0x14d0fb(_0x46daa3);})['catch'](function(_0x21f059){_0x468fae[_0x3799('0xf')][_0x20f2bd['id']][_0x3799('0x31')][_0x3799('0x17')]=_0x3799('0x23');_0x468fae[_0x3799('0xf')][_0x20f2bd['id']][_0x3799('0x31')]['messageStatus']=_0x21f059;_0x468fae[_0x3799('0x13')](_0x20f2bd['id']);_0x14ad1a(_0x21f059);});});}return this['smtp'][_0x3799('0x33')](_0x20f2bd);};module['exports']=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index 1da8717..4301beb 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 _0x7d91=['once','ready','handleReady','end','handleEnd','error','handleError','bind','connect','inherits','prototype','connTimeout','authTimeout','service','user','password','host','port','tls','email','anonymous@xcally.com','openBox','handleOpenBox','emit','search','UNSEEN','handleReadUnseen','fetch','message','handleFetchMessage','handleFetchError','closeBox','handleCloseBox','body','handleMessageBody','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','parser','handleFetchEnd','stringify','textCode','upperFirst','util','imap','randomstring','iconv','Iconv','events','EventEmitter','../../../config/logger','mailbox','INBOX','account','getAccount'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7d91,0x17c));var _0x17d9=function(_0x1624f2,_0x4de405){_0x1624f2=_0x1624f2-0x0;var _0x8b4df8=_0x7d91[_0x1624f2];return _0x8b4df8;};'use strict';var fs=require('fs');var path=require('path');var util=require(_0x17d9('0x0'));var Imap=require(_0x17d9('0x1'));var _=require('lodash');var rs=require(_0x17d9('0x2'));var simpleParser=require('mailparser')['simpleParser'];var Iconv=require(_0x17d9('0x3'))[_0x17d9('0x4')];var EventEmitter=require(_0x17d9('0x5'))[_0x17d9('0x6')];var utils=require('./utils');var logger=require(_0x17d9('0x7'))('email');function EmailImap(_0x551a77,_0x22c4c4){this[_0x17d9('0x8')]=_0x17d9('0x9');this[_0x17d9('0xa')]=this[_0x17d9('0xb')](_0x551a77,_0x22c4c4);this['imap']=new Imap(this[_0x17d9('0xa')]);this[_0x17d9('0x1')][_0x17d9('0xc')](_0x17d9('0xd'),this[_0x17d9('0xe')]['bind'](this));this[_0x17d9('0x1')][_0x17d9('0xc')](_0x17d9('0xf'),this[_0x17d9('0x10')]['bind'](this));this[_0x17d9('0x1')]['on'](_0x17d9('0x11'),this[_0x17d9('0x12')][_0x17d9('0x13')](this));this[_0x17d9('0x1')][_0x17d9('0x14')]();}util[_0x17d9('0x15')](EmailImap,EventEmitter);EmailImap[_0x17d9('0x16')]['getAccount']=function(_0x52d69f,_0x5a0e90){var _0x153093={'connTimeout':_0x52d69f[_0x17d9('0x17')]?_0x52d69f['connTimeout']*0x3e8:0x2710,'authTimeout':_0x52d69f[_0x17d9('0x18')]?_0x52d69f[_0x17d9('0x18')]*0x3e8:0x1388};if(_['isNil'](_0x52d69f[_0x17d9('0x19')])){if(_0x52d69f['authentication']){_0x153093[_0x17d9('0x1a')]=_0x52d69f[_0x17d9('0x1a')];_0x153093[_0x17d9('0x1b')]=_0x52d69f[_0x17d9('0x1b')];}_0x153093[_0x17d9('0x1c')]=_0x52d69f[_0x17d9('0x1c')];_0x153093['port']=_0x52d69f[_0x17d9('0x1d')]||0x3e1;if(_0x52d69f['tls']){_0x153093[_0x17d9('0x1e')]=!![];}else{_0x153093[_0x17d9('0x1e')]=![];_0x153093['autotls']='required';}}else{_0x153093[_0x17d9('0x1a')]=_0x52d69f[_0x17d9('0x1a')];_0x153093[_0x17d9('0x1b')]=_0x52d69f[_0x17d9('0x1b')];_0x153093[_0x17d9('0x1c')]=utils['getHost'](_0x52d69f['service']);_0x153093[_0x17d9('0x1d')]=0x3e1;_0x153093['tls']=!![];}_0x153093[_0x17d9('0x1f')]=_0x5a0e90||_0x52d69f['user']||_0x17d9('0x20');return _0x153093;};EmailImap[_0x17d9('0x16')][_0x17d9('0xe')]=function(){this['imap'][_0x17d9('0x21')](this[_0x17d9('0x8')],![],this['handleOpenBox'][_0x17d9('0x13')](this));};EmailImap[_0x17d9('0x16')][_0x17d9('0x22')]=function(_0x1a47ba,_0x5f4171){if(_0x1a47ba){this[_0x17d9('0x12')](_0x1a47ba,!![]);}else{this[_0x17d9('0x23')]('box',_0x5f4171);this['readUnseen']();}};EmailImap[_0x17d9('0x16')]['handleCloseBox']=function(_0x37cc01){if(_0x37cc01){this[_0x17d9('0x12')](_0x37cc01,!![]);}else{this[_0x17d9('0x1')][_0x17d9('0xf')]();}};EmailImap[_0x17d9('0x16')]['readUnseen']=function(){this[_0x17d9('0x1')][_0x17d9('0x24')]([_0x17d9('0x25')],this[_0x17d9('0x26')][_0x17d9('0x13')](this));};EmailImap['prototype']['handleReadUnseen']=function(_0xc9c80,_0x13d21a){if(_0xc9c80){this[_0x17d9('0x12')](_0xc9c80,!![]);}else{if(_0x13d21a['length']){try{var _0x3b1be9=this[_0x17d9('0x1')][_0x17d9('0x27')](_0x13d21a,{'bodies':'','markSeen':!![]});_0x3b1be9['on'](_0x17d9('0x28'),this[_0x17d9('0x29')][_0x17d9('0x13')](this));_0x3b1be9['once'](_0x17d9('0x11'),this[_0x17d9('0x2a')][_0x17d9('0x13')](this));_0x3b1be9[_0x17d9('0xc')](_0x17d9('0xf'),this['handleFetchEnd']['bind'](this));}catch(_0x1df747){logger[_0x17d9('0x11')](_0x1df747);}}else{this[_0x17d9('0x1')][_0x17d9('0x2b')](!![],this[_0x17d9('0x2c')][_0x17d9('0x13')](this));}}};EmailImap[_0x17d9('0x16')][_0x17d9('0x29')]=function(_0x179916,_0x53bd8b){_0x179916['on'](_0x17d9('0x2d'),this[_0x17d9('0x2e')]['bind'](this));_0x179916[_0x17d9('0xc')](_0x17d9('0x2f'),this[_0x17d9('0x30')][_0x17d9('0x13')](this));_0x179916[_0x17d9('0xc')](_0x17d9('0xf'),this[_0x17d9('0x31')]['bind'](this));};EmailImap['prototype'][_0x17d9('0x2e')]=function(_0x292d2a,_0x1a6853){simpleParser(_0x292d2a,{'Iconv':Iconv},this[_0x17d9('0x32')]['bind'](this));};EmailImap[_0x17d9('0x16')][_0x17d9('0x30')]=function(_0x9007f1){};EmailImap[_0x17d9('0x16')][_0x17d9('0x31')]=function(){};EmailImap[_0x17d9('0x16')]['handleSimpleParser']=function(_0x3e885e,_0x596634){if(_0x3e885e){logger[_0x17d9('0x11')](_0x3e885e);}else{var _0x4d2e8c=this;utils[_0x17d9('0x33')](this[_0x17d9('0xa')],_0x596634,function(_0x236b32){_0x4d2e8c[_0x17d9('0x23')](_0x17d9('0x1f'),_0x236b32);});}};EmailImap[_0x17d9('0x16')][_0x17d9('0x34')]=function(){this[_0x17d9('0x1')][_0x17d9('0x2b')](!![],this[_0x17d9('0x2c')][_0x17d9('0x13')](this));};EmailImap['prototype'][_0x17d9('0x2a')]=function(_0x3db3b2){this[_0x17d9('0x12')](_0x3db3b2);this[_0x17d9('0x1')][_0x17d9('0x2b')](!![],this[_0x17d9('0x2c')][_0x17d9('0x13')](this));};EmailImap['prototype'][_0x17d9('0x10')]=function(){this[_0x17d9('0x23')]('end');};EmailImap[_0x17d9('0x16')][_0x17d9('0x12')]=function(_0x2a47fe,_0x4fcb84){logger[_0x17d9('0x11')](_0x17d9('0x12'),this[_0x17d9('0xa')][_0x17d9('0x1f')],JSON[_0x17d9('0x35')](_0x2a47fe));var _0x2e6c0b='';if(_0x2a47fe){if(_0x2a47fe[_0x17d9('0x36')]){_0x2e6c0b=_0x2a47fe[_0x17d9('0x36')];}else{for(var _0x258733 in _0x2a47fe){if(_0x2a47fe['hasOwnProperty'](_0x258733)){_0x2e6c0b+=_[_0x17d9('0x37')](_0x258733)+':\x20'+_0x2a47fe[_0x258733]+'\x0a';}}}}if(_0x4fcb84){this[_0x17d9('0x1')][_0x17d9('0xf')]();}else{this[_0x17d9('0x23')](_0x17d9('0x11'),_0x2e6c0b);this[_0x17d9('0x23')]('end');}};module['exports']=EmailImap; \ No newline at end of file +var _0x631e=['handleCloseBox','readUnseen','search','UNSEEN','handleReadUnseen','fetch','message','handleFetchMessage','handleFetchError','once','handleFetchEnd','body','handleMessageBody','attributes','handleMessageEnd','handleSimpleParser','handleMessageAttributes','error','parser','closeBox','emit','stringify','textCode','hasOwnProperty','upperFirst','exports','path','util','imap','lodash','Iconv','events','EventEmitter','./utils','mailbox','INBOX','account','ready','handleReady','end','handleEnd','handleError','bind','inherits','getAccount','connTimeout','authTimeout','isNil','service','authentication','user','password','host','port','tls','autotls','required','getHost','email','openBox','handleOpenBox','box','prototype'];(function(_0x599f34,_0x375ce0){var _0x128e0e=function(_0x1c793c){while(--_0x1c793c){_0x599f34['push'](_0x599f34['shift']());}};_0x128e0e(++_0x375ce0);}(_0x631e,0x194));var _0xe631=function(_0x402252,_0x36b2be){_0x402252=_0x402252-0x0;var _0x5f0178=_0x631e[_0x402252];return _0x5f0178;};'use strict';var fs=require('fs');var path=require(_0xe631('0x0'));var util=require(_0xe631('0x1'));var Imap=require(_0xe631('0x2'));var _=require(_0xe631('0x3'));var rs=require('randomstring');var simpleParser=require('mailparser')['simpleParser'];var Iconv=require('iconv')[_0xe631('0x4')];var EventEmitter=require(_0xe631('0x5'))[_0xe631('0x6')];var utils=require(_0xe631('0x7'));var logger=require('../../../config/logger')('email');function EmailImap(_0x5e3698,_0x3593ab){this[_0xe631('0x8')]=_0xe631('0x9');this[_0xe631('0xa')]=this['getAccount'](_0x5e3698,_0x3593ab);this['imap']=new Imap(this[_0xe631('0xa')]);this['imap']['once'](_0xe631('0xb'),this[_0xe631('0xc')]['bind'](this));this[_0xe631('0x2')]['once'](_0xe631('0xd'),this[_0xe631('0xe')]['bind'](this));this[_0xe631('0x2')]['on']('error',this[_0xe631('0xf')][_0xe631('0x10')](this));this[_0xe631('0x2')]['connect']();}util[_0xe631('0x11')](EmailImap,EventEmitter);EmailImap['prototype'][_0xe631('0x12')]=function(_0x1a4259,_0x2f14ea){var _0x283ebd={'connTimeout':_0x1a4259[_0xe631('0x13')]?_0x1a4259['connTimeout']*0x3e8:0x2710,'authTimeout':_0x1a4259[_0xe631('0x14')]?_0x1a4259[_0xe631('0x14')]*0x3e8:0x1388};if(_[_0xe631('0x15')](_0x1a4259[_0xe631('0x16')])){if(_0x1a4259[_0xe631('0x17')]){_0x283ebd[_0xe631('0x18')]=_0x1a4259[_0xe631('0x18')];_0x283ebd[_0xe631('0x19')]=_0x1a4259[_0xe631('0x19')];}_0x283ebd['host']=_0x1a4259[_0xe631('0x1a')];_0x283ebd[_0xe631('0x1b')]=_0x1a4259['port']||0x3e1;if(_0x1a4259[_0xe631('0x1c')]){_0x283ebd[_0xe631('0x1c')]=!![];}else{_0x283ebd[_0xe631('0x1c')]=![];_0x283ebd[_0xe631('0x1d')]=_0xe631('0x1e');}}else{_0x283ebd[_0xe631('0x18')]=_0x1a4259[_0xe631('0x18')];_0x283ebd['password']=_0x1a4259['password'];_0x283ebd[_0xe631('0x1a')]=utils[_0xe631('0x1f')](_0x1a4259[_0xe631('0x16')]);_0x283ebd[_0xe631('0x1b')]=0x3e1;_0x283ebd['tls']=!![];}_0x283ebd[_0xe631('0x20')]=_0x2f14ea||_0x1a4259[_0xe631('0x18')]||'anonymous@xcally.com';return _0x283ebd;};EmailImap['prototype'][_0xe631('0xc')]=function(){this[_0xe631('0x2')][_0xe631('0x21')](this[_0xe631('0x8')],![],this['handleOpenBox'][_0xe631('0x10')](this));};EmailImap['prototype'][_0xe631('0x22')]=function(_0x39b7cd,_0xc28974){if(_0x39b7cd){this[_0xe631('0xf')](_0x39b7cd,!![]);}else{this['emit'](_0xe631('0x23'),_0xc28974);this['readUnseen']();}};EmailImap[_0xe631('0x24')][_0xe631('0x25')]=function(_0xdb7058){if(_0xdb7058){this[_0xe631('0xf')](_0xdb7058,!![]);}else{this[_0xe631('0x2')][_0xe631('0xd')]();}};EmailImap['prototype'][_0xe631('0x26')]=function(){this['imap'][_0xe631('0x27')]([_0xe631('0x28')],this[_0xe631('0x29')][_0xe631('0x10')](this));};EmailImap[_0xe631('0x24')][_0xe631('0x29')]=function(_0x3e1d72,_0x49c237){if(_0x3e1d72){this['handleError'](_0x3e1d72,!![]);}else{if(_0x49c237['length']){try{var _0x12fabd=this[_0xe631('0x2')][_0xe631('0x2a')](_0x49c237,{'bodies':'','markSeen':!![]});_0x12fabd['on'](_0xe631('0x2b'),this[_0xe631('0x2c')][_0xe631('0x10')](this));_0x12fabd['once']('error',this[_0xe631('0x2d')]['bind'](this));_0x12fabd[_0xe631('0x2e')](_0xe631('0xd'),this[_0xe631('0x2f')][_0xe631('0x10')](this));}catch(_0x1c5017){logger['error'](_0x1c5017);}}else{this['imap']['closeBox'](!![],this['handleCloseBox'][_0xe631('0x10')](this));}}};EmailImap[_0xe631('0x24')][_0xe631('0x2c')]=function(_0x1835b3,_0xe9300c){_0x1835b3['on'](_0xe631('0x30'),this[_0xe631('0x31')]['bind'](this));_0x1835b3[_0xe631('0x2e')](_0xe631('0x32'),this['handleMessageAttributes']['bind'](this));_0x1835b3[_0xe631('0x2e')](_0xe631('0xd'),this[_0xe631('0x33')]['bind'](this));};EmailImap[_0xe631('0x24')][_0xe631('0x31')]=function(_0x546493,_0x3a9ce1){simpleParser(_0x546493,{'Iconv':Iconv},this[_0xe631('0x34')][_0xe631('0x10')](this));};EmailImap[_0xe631('0x24')][_0xe631('0x35')]=function(_0x3d343d){};EmailImap[_0xe631('0x24')][_0xe631('0x33')]=function(){};EmailImap[_0xe631('0x24')]['handleSimpleParser']=function(_0x3a28b1,_0x2444d7){if(_0x3a28b1){logger[_0xe631('0x36')](_0x3a28b1);}else{var _0x1cb27f=this;utils[_0xe631('0x37')](this[_0xe631('0xa')],_0x2444d7,function(_0x534d9a){_0x1cb27f['emit'](_0xe631('0x20'),_0x534d9a);});}};EmailImap[_0xe631('0x24')]['handleFetchEnd']=function(){this[_0xe631('0x2')][_0xe631('0x38')](!![],this['handleCloseBox'][_0xe631('0x10')](this));};EmailImap[_0xe631('0x24')][_0xe631('0x2d')]=function(_0x385ea0){this[_0xe631('0xf')](_0x385ea0);this[_0xe631('0x2')]['closeBox'](!![],this[_0xe631('0x25')][_0xe631('0x10')](this));};EmailImap[_0xe631('0x24')]['handleEnd']=function(){this[_0xe631('0x39')](_0xe631('0xd'));};EmailImap[_0xe631('0x24')]['handleError']=function(_0xf33ddb,_0x62e73b){logger['error'](_0xe631('0xf'),this[_0xe631('0xa')][_0xe631('0x20')],JSON[_0xe631('0x3a')](_0xf33ddb));var _0x9efff0='';if(_0xf33ddb){if(_0xf33ddb[_0xe631('0x3b')]){_0x9efff0=_0xf33ddb[_0xe631('0x3b')];}else{for(var _0x278d1c in _0xf33ddb){if(_0xf33ddb[_0xe631('0x3c')](_0x278d1c)){_0x9efff0+=_[_0xe631('0x3d')](_0x278d1c)+':\x20'+_0xf33ddb[_0x278d1c]+'\x0a';}}}}if(_0x62e73b){this[_0xe631('0x2')]['end']();}else{this[_0xe631('0x39')](_0xe631('0x36'),_0x9efff0);this[_0xe631('0x39')](_0xe631('0xd'));}};module[_0xe631('0x3e')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index 3636161..b2c324d 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 _0xba29=['nodemailer','bluebird','nodemailer-plugin-inline-base64','send','createTransport','sendMail','verify','toString','Not\x20verifired','exports'];(function(_0x584b3e,_0x401737){var _0x5ac470=function(_0x4e4dea){while(--_0x4e4dea){_0x584b3e['push'](_0x584b3e['shift']());}};_0x5ac470(++_0x401737);}(_0xba29,0xaa));var _0x9ba2=function(_0x54c34c,_0x43a949){_0x54c34c=_0x54c34c-0x0;var _0x2f1b82=_0xba29[_0x54c34c];return _0x2f1b82;};'use strict';var nodemailer=require(_0x9ba2('0x0'));var BPromise=require(_0x9ba2('0x1'));var inlineBase64=require(_0x9ba2('0x2'));function EmailSmtp(){}EmailSmtp['prototype'][_0x9ba2('0x3')]=function(_0x273a0e,_0x27111a){return new BPromise(function(_0x13c6f0,_0x4bbbc9){var _0x158021=nodemailer[_0x9ba2('0x4')](_0x273a0e);_0x158021['use']('compile',inlineBase64());_0x158021[_0x9ba2('0x5')](_0x27111a,function(_0x181ece,_0x1c9716){if(_0x181ece){_0x4bbbc9(_0x181ece['toString']());}else{_0x13c6f0(_0x1c9716);}});});};EmailSmtp['prototype']['verify']=function(_0x4e8384){return new BPromise(function(_0x44c1f4,_0x11c539){var _0x583156=nodemailer['createTransport'](_0x4e8384);_0x583156[_0x9ba2('0x6')](function(_0x43bb49,_0xa01bde){if(_0x43bb49){_0x11c539(_0x43bb49[_0x9ba2('0x7')]());}else{if(_0xa01bde){_0x44c1f4(_0xa01bde);}else{_0x11c539(_0x9ba2('0x8'));}}});});};module[_0x9ba2('0x9')]=EmailSmtp; \ No newline at end of file +var _0x89bf=['sendMail','toString','verify','Not\x20verifired','nodemailer','createTransport','compile'];(function(_0x1e90b4,_0x14ce86){var _0x4d52f8=function(_0x1dc612){while(--_0x1dc612){_0x1e90b4['push'](_0x1e90b4['shift']());}};_0x4d52f8(++_0x14ce86);}(_0x89bf,0x74));var _0xf89b=function(_0x5b6d95,_0x83bf55){_0x5b6d95=_0x5b6d95-0x0;var _0x3f746a=_0x89bf[_0x5b6d95];return _0x3f746a;};'use strict';var nodemailer=require(_0xf89b('0x0'));var BPromise=require('bluebird');var inlineBase64=require('nodemailer-plugin-inline-base64');function EmailSmtp(){}EmailSmtp['prototype']['send']=function(_0x59f35a,_0x3f02d9){return new BPromise(function(_0x2b81e0,_0x5c00cd){var _0x161018=nodemailer[_0xf89b('0x1')](_0x59f35a);_0x161018['use'](_0xf89b('0x2'),inlineBase64());_0x161018[_0xf89b('0x3')](_0x3f02d9,function(_0x40d7ff,_0x3e739d){if(_0x40d7ff){_0x5c00cd(_0x40d7ff[_0xf89b('0x4')]());}else{_0x2b81e0(_0x3e739d);}});});};EmailSmtp['prototype'][_0xf89b('0x5')]=function(_0x219a7a){return new BPromise(function(_0x164e90,_0x2a90b2){var _0x26e97b=nodemailer[_0xf89b('0x1')](_0x219a7a);_0x26e97b[_0xf89b('0x5')](function(_0x169a6c,_0x7ece0c){if(_0x169a6c){_0x2a90b2(_0x169a6c[_0xf89b('0x4')]());}else{if(_0x7ece0c){_0x164e90(_0x7ece0c);}else{_0x2a90b2(_0xf89b('0x6'));}}});});};module['exports']=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index 61ee8ba..1562542 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 _0x3120=['Empty\x20message

','getHost','hotmail','imap-mail.outlook.com','outlook365','127.0.0.1','lodash','moment','randomstring','path','util','node-tnef','../../../config/logger','../../../config/environment','head','value','address','generate','@xcally.com','name','length','slice','join','Anonymous','split','anonymous','html','test','body','textAsHtml','replace'];(function(_0x3c7b63,_0xb89867){var _0x13a5e8=function(_0x1af52b){while(--_0x1af52b){_0x3c7b63['push'](_0x3c7b63['shift']());}};_0x13a5e8(++_0xb89867);}(_0x3120,0xef));var _0x0312=function(_0x35077f,_0x3ad6f9){_0x35077f=_0x35077f-0x0;var _0x40bd21=_0x3120[_0x35077f];return _0x40bd21;};'use strict';var _=require(_0x0312('0x0'));var moment=require(_0x0312('0x1'));var random=require(_0x0312('0x2'));var fs=require('fs');var path=require(_0x0312('0x3'));var util=require(_0x0312('0x4'));var tnef=require(_0x0312('0x5'));var logger=require(_0x0312('0x6'))('email');var config=require(_0x0312('0x7'));function getAddress(_0x5265bd){var _0x1d7589=_[_0x0312('0x8')](_0x5265bd[_0x0312('0x9')]);return _0x1d7589&&_0x1d7589[_0x0312('0xa')]?_0x1d7589[_0x0312('0xa')]:'anonymous'+random[_0x0312('0xb')](0x6)+_0x0312('0xc');}function getFirstName(_0x19eecd){var _0xf100fa=_[_0x0312('0x8')](_0x19eecd[_0x0312('0x9')]);if(_0xf100fa&&_0xf100fa['name']){var _0x5b41ad=_0xf100fa[_0x0312('0xd')]['split'](/\s+/);return _0x5b41ad[_0x0312('0xe')]?_0x5b41ad[_0x0312('0xf')](0x0,-0x1)[_0x0312('0x10')]('\x20'):_0xf100fa[_0x0312('0xd')];}return _0x0312('0x11');}function getLastName(_0x11cf22){var _0xe56b4e=_[_0x0312('0x8')](_0x11cf22['value']);if(_0xe56b4e&&_0xe56b4e[_0x0312('0xd')]){var _0x259e44=_0xe56b4e[_0x0312('0xd')][_0x0312('0x12')](/\s+/);return _0x259e44[_0x0312('0xe')]>0x1?_0x259e44['pop']():'';}return'';}function getMails(_0x921308,_0x38c202){var _0x1ff3b4='';for(var _0x4e2e72=0x0;_0x4e2e72<_0x38c202[_0x0312('0x9')][_0x0312('0xe')];_0x4e2e72+=0x1){if(_0x38c202[_0x0312('0x9')][_0x4e2e72][_0x0312('0xa')]!==_0x921308){if(!_['isEmpty'](_0x1ff3b4)){_0x1ff3b4+=',';}_0x1ff3b4+=_0x38c202['value'][_0x4e2e72][_0x0312('0xd')]||_0x38c202['value'][_0x4e2e72]['address']||'';_0x1ff3b4+='\x20<';_0x1ff3b4+=_0x38c202[_0x0312('0x9')][_0x4e2e72][_0x0312('0xa')]?_0x38c202[_0x0312('0x9')][_0x4e2e72][_0x0312('0xa')]:_0x0312('0x13')+random[_0x0312('0xb')](0x6)+_0x0312('0xc');_0x1ff3b4+='>';}}return _0x1ff3b4;}function parseEmail(_0x912e62,_0x423c78,_0x3c171e){if(_0x423c78[_0x0312('0x14')]){var _0x2e452b=/)<[^<]*)*<\/script>/gi;while(_0x2e452b[_0x0312('0x15')](_0x423c78[_0x0312('0x14')])){_0x423c78['html']=_0x423c78['html']['replace'](_0x2e452b,'');}_0x3c171e[_0x0312('0x16')]=_0x423c78[_0x0312('0x14')];}else{_0x3c171e['body']=_0x423c78[_0x0312('0x17')];}if(_0x3c171e['body']){_0x3c171e[_0x0312('0x16')]=_0x3c171e[_0x0312('0x16')][_0x0312('0x18')](/Empty\x20message

';if(_0x4697ab[_0x0312('0x39')]){for(var _0x5ee3b6=0x0;_0x5ee3b6<_0x4697ab[_0x0312('0x39')]['length'];_0x5ee3b6++){var _0x36ded0=_0x4697ab[_0x0312('0x39')][_0x5ee3b6];_0x551723['message'][_0x0312('0x1f')][_0x0312('0x3a')]({'filename':_0x36ded0[_0x0312('0x3b')],'content':new Buffer(_0x36ded0['Data'])});}}}_0x317f8f(parseEmail(_0x2cb5be,_0x107f7f,_0x551723));});}else{_0x107f7f[_0x0312('0x14')]=_0x0312('0x3c');_0x317f8f(parseEmail(_0x2cb5be,_0x107f7f,_0x551723));}}else{_0x317f8f(parseEmail(_0x2cb5be,_0x107f7f,_0x551723));}};exports[_0x0312('0x3d')]=function(_0x3292eb){switch(_0x3292eb){case'gmail':return'imap.gmail.com';case'yahoo':return'imap.mail.yahoo.com';case _0x0312('0x3e'):return _0x0312('0x3f');case _0x0312('0x40'):return'outlook.office365.com';}return _0x0312('0x41');}; \ No newline at end of file +var _0x23bc=['generate','@xcally.com','head','value','name','split','length','join','Anonymous','html','test','replace','body','textAsHtml','0x1?_0x4b8b25['pop']():'';}return'';}function getMails(_0x1fa212,_0xb6ab6b){var _0x127fd2='';for(var _0x4ba833=0x0;_0x4ba833<_0xb6ab6b[_0xc23b('0xb')][_0xc23b('0xe')];_0x4ba833+=0x1){if(_0xb6ab6b['value'][_0x4ba833][_0xc23b('0x6')]!==_0x1fa212){if(!_['isEmpty'](_0x127fd2)){_0x127fd2+=',';}_0x127fd2+=_0xb6ab6b[_0xc23b('0xb')][_0x4ba833][_0xc23b('0xc')]||_0xb6ab6b[_0xc23b('0xb')][_0x4ba833][_0xc23b('0x6')]||'';_0x127fd2+='\x20<';_0x127fd2+=_0xb6ab6b[_0xc23b('0xb')][_0x4ba833]['address']?_0xb6ab6b[_0xc23b('0xb')][_0x4ba833][_0xc23b('0x6')]:'anonymous'+random['generate'](0x6)+_0xc23b('0x9');_0x127fd2+='>';}}return _0x127fd2;}function parseEmail(_0x35fd04,_0x79ee25,_0x473677){if(_0x79ee25[_0xc23b('0x11')]){var _0x5d1622=/)<[^<]*)*<\/script>/gi;while(_0x5d1622[_0xc23b('0x12')](_0x79ee25[_0xc23b('0x11')])){_0x79ee25[_0xc23b('0x11')]=_0x79ee25[_0xc23b('0x11')][_0xc23b('0x13')](_0x5d1622,'');}_0x473677['body']=_0x79ee25[_0xc23b('0x11')];}else{_0x473677[_0xc23b('0x14')]=_0x79ee25[_0xc23b('0x15')];}if(_0x473677[_0xc23b('0x14')]){_0x473677[_0xc23b('0x14')]=_0x473677[_0xc23b('0x14')][_0xc23b('0x13')](/Empty\x20message

';if(_0xeabb3[_0xc23b('0x35')]){for(var _0x480d8c=0x0;_0x480d8c<_0xeabb3[_0xc23b('0x35')]['length'];_0x480d8c++){var _0x326699=_0xeabb3['Attachments'][_0x480d8c];_0xb8c494[_0xc23b('0x17')][_0xc23b('0x1d')][_0xc23b('0x28')]({'filename':_0x326699[_0xc23b('0x36')],'content':new Buffer(_0x326699[_0xc23b('0x37')])});}}}_0x3153ca(parseEmail(_0x19a6d8,_0x1c90dc,_0xb8c494));});}else{_0x1c90dc[_0xc23b('0x11')]='

Empty\x20message

';_0x3153ca(parseEmail(_0x19a6d8,_0x1c90dc,_0xb8c494));}}else{_0x3153ca(parseEmail(_0x19a6d8,_0x1c90dc,_0xb8c494));}};exports[_0xc23b('0x38')]=function(_0x398c62){switch(_0x398c62){case'gmail':return _0xc23b('0x39');case _0xc23b('0x3a'):return _0xc23b('0x3b');case _0xc23b('0x3c'):return _0xc23b('0x3d');case _0xc23b('0x3e'):return _0xc23b('0x3f');}return'127.0.0.1';}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index 24deaa0..e6952b0 100644 --- a/server/services/email/model/mailAccount.js +++ b/server/services/email/model/mailAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc55a=['Smtp','exports','lodash','name','key','SERV','active','Imap'];(function(_0xd2ba55,_0x21b25a){var _0x3f0763=function(_0x2e58d6){while(--_0x2e58d6){_0xd2ba55['push'](_0xd2ba55['shift']());}};_0x3f0763(++_0x21b25a);}(_0xc55a,0x132));var _0xac55=function(_0x4b73a2,_0x40b5fe){_0x4b73a2=_0x4b73a2-0x0;var _0x383c66=_0xc55a[_0x4b73a2];return _0x383c66;};'use strict';var _=require(_0xac55('0x0'));function MailAccount(_0x594a11){this['id']=_0x594a11['id']||0x0;this[_0xac55('0x1')]=_0x594a11[_0xac55('0x1')]||'Service';this[_0xac55('0x2')]=_0x594a11['key']||_0xac55('0x3');this[_0xac55('0x4')]=_0x594a11[_0xac55('0x4')]||![];this['Imap']=_0x594a11[_0xac55('0x5')]||[];this[_0xac55('0x6')]=_0x594a11[_0xac55('0x6')]||[];}module[_0xac55('0x7')]=MailAccount; \ No newline at end of file +var _0x9ea1=['active','Imap','Smtp','lodash','name','Service','key','SERV'];(function(_0x17430b,_0x2b1d31){var _0x19a5a4=function(_0x2d93ad){while(--_0x2d93ad){_0x17430b['push'](_0x17430b['shift']());}};_0x19a5a4(++_0x2b1d31);}(_0x9ea1,0x83));var _0x19ea=function(_0x333dc6,_0x33d719){_0x333dc6=_0x333dc6-0x0;var _0x516c5a=_0x9ea1[_0x333dc6];return _0x516c5a;};'use strict';var _=require(_0x19ea('0x0'));function MailAccount(_0x536451){this['id']=_0x536451['id']||0x0;this['name']=_0x536451[_0x19ea('0x1')]||_0x19ea('0x2');this[_0x19ea('0x3')]=_0x536451[_0x19ea('0x3')]||_0x19ea('0x4');this[_0x19ea('0x5')]=_0x536451[_0x19ea('0x5')]||![];this[_0x19ea('0x6')]=_0x536451[_0x19ea('0x6')]||[];this['Smtp']=_0x536451[_0x19ea('0x7')]||[];}module['exports']=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index 9f41a1d..3d9a3d6 100644 --- a/server/services/email/realtime/index.js +++ b/server/services/email/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8a7b=['length','isUndefined','merge','exports','lodash','mailAccounts','prototype','hasOwnProperty','initMailAccounts'];(function(_0x5c296c,_0x1d2332){var _0x716997=function(_0x389aca){while(--_0x389aca){_0x5c296c['push'](_0x5c296c['shift']());}};_0x716997(++_0x1d2332);}(_0x8a7b,0xca));var _0xb8a7=function(_0x516961,_0x35b1fc){_0x516961=_0x516961-0x0;var _0x4a70ce=_0x8a7b[_0x516961];return _0x4a70ce;};'use strict';var _=require(_0xb8a7('0x0'));var MailAccount=require('../model/mailAccount');var Realtime=function(){this[_0xb8a7('0x1')]={};};function freeIsNotKey(_0x53a61d,_0x431946,_0x1dc1e7){var _0x14f7fa=_['mapKeys'](_0x53a61d,function(_0x331593,_0x555d93){return _0x331593[_0x1dc1e7];});for(var _0x392313 in _0x431946){if(_0x431946['hasOwnProperty'](_0x392313)){if(!_0x14f7fa[_0x392313]){delete _0x431946[_0x392313];}}}}Realtime[_0xb8a7('0x2')]['mergeFromDatabase']=function(_0x248a6a,_0x6fa2fb){for(var _0xded3f in _0x6fa2fb){if(_0x248a6a[_0xb8a7('0x3')](_0xded3f)){_0x248a6a[_0xded3f]=_0x6fa2fb[_0xded3f];}}};Realtime['prototype'][_0xb8a7('0x4')]=function(){var _0x54f907=this;return function(_0x332212){if(_0x332212){freeIsNotKey(_0x332212,_0x54f907[_0xb8a7('0x1')],'id');for(var _0x3843a6=0x0,_0xce1ff4={},_0x14c258={};_0x3843a6<_0x332212[_0xb8a7('0x5')];_0x3843a6+=0x1){_0xce1ff4=_0x332212[_0x3843a6];if(_[_0xb8a7('0x6')](_0x54f907[_0xb8a7('0x1')][_0xce1ff4['id']])){_0x54f907['mailAccounts'][_0xce1ff4['id']]=new MailAccount(_0xce1ff4);}else{_[_0xb8a7('0x7')](_0x54f907[_0xb8a7('0x1')][_0xce1ff4['id']],_0xce1ff4);}}}return _0x54f907[_0xb8a7('0x1')];};};module[_0xb8a7('0x8')]=Realtime; \ No newline at end of file +var _0xe384=['merge','../model/mailAccount','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initMailAccounts','length','mailAccounts'];(function(_0x36bfe3,_0x358938){var _0x9b0436=function(_0x86e47d){while(--_0x86e47d){_0x36bfe3['push'](_0x36bfe3['shift']());}};_0x9b0436(++_0x358938);}(_0xe384,0x10f));var _0x4e38=function(_0x131439,_0x4e8b78){_0x131439=_0x131439-0x0;var _0x2bd6f1=_0xe384[_0x131439];return _0x2bd6f1;};'use strict';var _=require('lodash');var MailAccount=require(_0x4e38('0x0'));var Realtime=function(){this['mailAccounts']={};};function freeIsNotKey(_0x49ec24,_0x179ed5,_0x2a2e4d){var _0x494eb8=_[_0x4e38('0x1')](_0x49ec24,function(_0x461463,_0xfa7b76){return _0x461463[_0x2a2e4d];});for(var _0x4f5970 in _0x179ed5){if(_0x179ed5[_0x4e38('0x2')](_0x4f5970)){if(!_0x494eb8[_0x4f5970]){delete _0x179ed5[_0x4f5970];}}}}Realtime[_0x4e38('0x3')][_0x4e38('0x4')]=function(_0x1f35d4,_0x52b3f7){for(var _0x4b2e8c in _0x52b3f7){if(_0x1f35d4[_0x4e38('0x2')](_0x4b2e8c)){_0x1f35d4[_0x4b2e8c]=_0x52b3f7[_0x4b2e8c];}}};Realtime[_0x4e38('0x3')][_0x4e38('0x5')]=function(){var _0x478ea5=this;return function(_0x56a9a3){if(_0x56a9a3){freeIsNotKey(_0x56a9a3,_0x478ea5['mailAccounts'],'id');for(var _0x1e2ef0=0x0,_0x135c1f={},_0x338377={};_0x1e2ef0<_0x56a9a3[_0x4e38('0x6')];_0x1e2ef0+=0x1){_0x135c1f=_0x56a9a3[_0x1e2ef0];if(_['isUndefined'](_0x478ea5[_0x4e38('0x7')][_0x135c1f['id']])){_0x478ea5['mailAccounts'][_0x135c1f['id']]=new MailAccount(_0x135c1f);}else{_[_0x4e38('0x8')](_0x478ea5[_0x4e38('0x7')][_0x135c1f['id']],_0x135c1f);}}}return _0x478ea5[_0x4e38('0x7')];};};module['exports']=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index d8d3562..4203240 100644 --- a/server/services/email/rpc/mailAccount.js +++ b/server/services/email/rpc/mailAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1c88=['MailServerOut','Smtp','getMailAccount','notify','NotifyMailAccount','../client','Request','GetMailAccount','name','active','key','ListId','TemplateId','MailServerIn','Imap'];(function(_0x422905,_0x3bce3a){var _0x33dc6c=function(_0x4852c9){while(--_0x4852c9){_0x422905['push'](_0x422905['shift']());}};_0x33dc6c(++_0x3bce3a);}(_0x1c88,0x1a9));var _0x81c8=function(_0x50e593,_0x3ae998){_0x50e593=_0x50e593-0x0;var _0x3821d0=_0x1c88[_0x50e593];return _0x3821d0;};'use strict';var client=require(_0x81c8('0x0'));exports['getMailAccounts']=function(){return function(){return client[_0x81c8('0x1')](_0x81c8('0x2'),{'options':{'attributes':['id',_0x81c8('0x3'),'service','email',_0x81c8('0x4'),_0x81c8('0x5'),_0x81c8('0x6'),_0x81c8('0x7')],'raw':![],'include':[{'model':_0x81c8('0x8'),'as':_0x81c8('0x9')},{'model':_0x81c8('0xa'),'as':_0x81c8('0xb')}]},'log':_0x81c8('0xc')});};};exports[_0x81c8('0xd')]=function(_0x191c40,_0x1ba4cb){return client[_0x81c8('0x1')]('NotifyMailAccount',{'account':{'id':_0x191c40},'body':_0x1ba4cb,'log':_0x81c8('0xe')});}; \ No newline at end of file +var _0xe14b=['Smtp','getMailAccount','notify','NotifyMailAccount','../client','getMailAccounts','name','service','active','TemplateId','MailServerIn','Imap','MailServerOut'];(function(_0xec6875,_0x24e815){var _0x67b750=function(_0x3e0858){while(--_0x3e0858){_0xec6875['push'](_0xec6875['shift']());}};_0x67b750(++_0x24e815);}(_0xe14b,0x93));var _0xbe14=function(_0x55452b,_0x3b9f75){_0x55452b=_0x55452b-0x0;var _0x49b464=_0xe14b[_0x55452b];return _0x49b464;};'use strict';var client=require(_0xbe14('0x0'));exports[_0xbe14('0x1')]=function(){return function(){return client['Request']('GetMailAccount',{'options':{'attributes':['id',_0xbe14('0x2'),_0xbe14('0x3'),'email',_0xbe14('0x4'),'key','ListId',_0xbe14('0x5')],'raw':![],'include':[{'model':_0xbe14('0x6'),'as':_0xbe14('0x7')},{'model':_0xbe14('0x8'),'as':_0xbe14('0x9')}]},'log':_0xbe14('0xa')});};};exports[_0xbe14('0xb')]=function(_0x566ae7,_0x50f909){return client['Request'](_0xbe14('0xc'),{'account':{'id':_0x566ae7},'body':_0x50f909,'log':_0xbe14('0xc')});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index 6c4df59..364a15c 100644 --- a/server/services/email/server/index.js +++ b/server/services/email/server/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfeee=['http','listen','127.0.0.1','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','bluebird','lodash','../../../config/logger','email','sendMail','account','message','then','verifySmtp','Verified','catch','error','values','Imap','password','Smtp','pass','server'];(function(_0x231e16,_0x67347b){var _0x570a7c=function(_0x2c35b4){while(--_0x2c35b4){_0x231e16['push'](_0x231e16['shift']());}};_0x570a7c(++_0x67347b);}(_0xfeee,0x1e8));var _0xefee=function(_0x1d760b,_0x47f9fe){_0x1d760b=_0x1d760b-0x0;var _0x18fb17=_0xfeee[_0x1d760b];return _0x18fb17;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0xefee('0x0'));var _=require(_0xefee('0x1'));var logger=require(_0xefee('0x2'))(_0xefee('0x3'));exports['listen']=function(_0x46cadb,_0x36994e){return new BPromise(function(_0x39e40a,_0x353773){var _0x56de6c={'SendMail':function(_0x5777c8){var _0x1455b1=this;return new Promise(function(_0x56ae5d,_0x250c20){_0x36994e[_0xefee('0x4')](_0x5777c8[_0xefee('0x5')],_0x5777c8[_0xefee('0x6')])[_0xefee('0x7')](function(_0x2e93f5){_0x56ae5d({'code':0xc8,'message':_0x2e93f5});})['catch'](function(_0x2391fc){_0x250c20(_0x1455b1['error'](0x1f4,_0x2391fc));});});},'VerifySmtp':function(_0x1ba145){var _0x5631a4=this;return new Promise(function(_0x54e114,_0x295a7b){_0x36994e[_0xefee('0x8')](_0x1ba145[_0xefee('0x5')])[_0xefee('0x7')](function(_0x1b8765){_0x54e114({'code':0xc8,'message':_0xefee('0x9')});})[_0xefee('0xa')](function(_0x329405){_0x295a7b(_0x5631a4[_0xefee('0xb')](0x1f4,_0x329405));});});},'MailAccounts':function(_0x89c3c8){return new Promise(function(_0x53f1a5,_0x5357c9){var _0x534df2=_[_0xefee('0xc')](_0x46cadb['mailAccounts']);for(var _0x271cdc=0x0;_0x271cdc<_0x534df2['length'];_0x271cdc+=0x1){if(_0x534df2[_0x271cdc][_0xefee('0xd')]&&_0x534df2[_0x271cdc][_0xefee('0xd')][_0xefee('0xe')]){delete _0x534df2[_0x271cdc][_0xefee('0xd')][_0xefee('0xe')];}if(_0x534df2[_0x271cdc][_0xefee('0xf')]&&_0x534df2[_0x271cdc][_0xefee('0xf')][_0xefee('0x10')]){delete _0x534df2[_0x271cdc][_0xefee('0xf')]['pass'];}}_0x53f1a5({'count':_0x534df2['length'],'rows':_0x534df2});});}};var _0x56cf4b=jayson[_0xefee('0x11')](_0x56de6c)[_0xefee('0x12')]();_0x56cf4b['on'](_0xefee('0xb'),function(_0x2a6cab){logger[_0xefee('0xb')](JSON['stringify'](_0x2a6cab));return _0x353773(_0x2a6cab);});_0x56cf4b[_0xefee('0x13')](0x232b,_0xefee('0x14'),function(){console['log'](_0xefee('0x15'),0x232b);return _0x39e40a(_0xefee('0x16')+0x232b);});});}; \ No newline at end of file +var _0x1565=['email','listen','sendMail','account','then','verifySmtp','Verified','catch','error','values','mailAccounts','length','Imap','password','pass','Smtp','server','http','stringify','127.0.0.1','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','bluebird','lodash','../../../config/logger'];(function(_0x66171,_0xfa776b){var _0x49bb58=function(_0x12a81f){while(--_0x12a81f){_0x66171['push'](_0x66171['shift']());}};_0x49bb58(++_0xfa776b);}(_0x1565,0x18d));var _0x5156=function(_0x2db23c,_0x51dda0){_0x2db23c=_0x2db23c-0x0;var _0x5c24ca=_0x1565[_0x2db23c];return _0x5c24ca;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0x5156('0x0'));var _=require(_0x5156('0x1'));var logger=require(_0x5156('0x2'))(_0x5156('0x3'));exports[_0x5156('0x4')]=function(_0x4ebd14,_0x532ed7){return new BPromise(function(_0x107e85,_0xd065cc){var _0xc834dd={'SendMail':function(_0x3a89){var _0x541d80=this;return new Promise(function(_0x5183b4,_0x4ae660){_0x532ed7[_0x5156('0x5')](_0x3a89[_0x5156('0x6')],_0x3a89['message'])[_0x5156('0x7')](function(_0x2a2ce0){_0x5183b4({'code':0xc8,'message':_0x2a2ce0});})['catch'](function(_0x24ef10){_0x4ae660(_0x541d80['error'](0x1f4,_0x24ef10));});});},'VerifySmtp':function(_0x33d1bb){var _0x5013c1=this;return new Promise(function(_0x59747f,_0x5b2388){_0x532ed7[_0x5156('0x8')](_0x33d1bb[_0x5156('0x6')])[_0x5156('0x7')](function(_0x33f2eb){_0x59747f({'code':0xc8,'message':_0x5156('0x9')});})[_0x5156('0xa')](function(_0x180825){_0x5b2388(_0x5013c1[_0x5156('0xb')](0x1f4,_0x180825));});});},'MailAccounts':function(_0x541680){return new Promise(function(_0xe42078,_0x32045c){var _0x1605cb=_[_0x5156('0xc')](_0x4ebd14[_0x5156('0xd')]);for(var _0x200555=0x0;_0x200555<_0x1605cb[_0x5156('0xe')];_0x200555+=0x1){if(_0x1605cb[_0x200555][_0x5156('0xf')]&&_0x1605cb[_0x200555][_0x5156('0xf')][_0x5156('0x10')]){delete _0x1605cb[_0x200555][_0x5156('0xf')]['password'];}if(_0x1605cb[_0x200555]['Smtp']&&_0x1605cb[_0x200555]['Smtp'][_0x5156('0x11')]){delete _0x1605cb[_0x200555][_0x5156('0x12')]['pass'];}}_0xe42078({'count':_0x1605cb[_0x5156('0xe')],'rows':_0x1605cb});});}};var _0x3b27a5=jayson[_0x5156('0x13')](_0xc834dd)[_0x5156('0x14')]();_0x3b27a5['on'](_0x5156('0xb'),function(_0x2cea73){logger[_0x5156('0xb')](JSON[_0x5156('0x15')](_0x2cea73));return _0xd065cc(_0x2cea73);});_0x3b27a5[_0x5156('0x4')](0x232b,_0x5156('0x16'),function(){console['log'](_0x5156('0x17'),0x232b);return _0x107e85(_0x5156('0x18')+0x232b);});});}; \ No newline at end of file diff --git a/server/services/express/index.js b/server/services/express/index.js index d638478..6c09b93 100644 --- a/server/services/express/index.js +++ b/server/services/express/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x083e=['sticky-session','ioredis','../../config/environment','timeout','listen','socket.io','websocket','polling','defaults','redis','localhost','socket.io-redis','../../config/triggers','default','../../config/socketio','../../config/express','../../routes','once','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','lodash','express'];(function(_0x4eb8b5,_0x1c8793){var _0x5acd9c=function(_0x19f95e){while(--_0x19f95e){_0x4eb8b5['push'](_0x4eb8b5['shift']());}};_0x5acd9c(++_0x1c8793);}(_0x083e,0x166));var _0xe083=function(_0x405385,_0x56f573){_0x405385=_0x405385-0x0;var _0x43837b=_0x083e[_0x405385];return _0x43837b;};'use strict';var _=require(_0xe083('0x0'));var http=require('http');var express=require(_0xe083('0x1'));var sticky=require(_0xe083('0x2'));var Redis=require(_0xe083('0x3'));var config=require(_0xe083('0x4'));var app=express();var server=http['createServer'](app);server[_0xe083('0x5')]=0xdbba0;if(sticky[_0xe083('0x6')](server,config['port'])){var socketio=require(_0xe083('0x7'))(server,{'transports':[_0xe083('0x8'),_0xe083('0x9')]});config['redis']=_[_0xe083('0xa')](config[_0xe083('0xb')],{'host':_0xe083('0xc'),'port':0x18eb});socketio['adapter'](require(_0xe083('0xd'))({'pubClient':new Redis(config[_0xe083('0xb')]),'subClient':new Redis(config[_0xe083('0xb')])}));require(_0xe083('0xe'))[_0xe083('0xf')]();require(_0xe083('0x10'))[_0xe083('0xf')](socketio);require(_0xe083('0x11'))[_0xe083('0xf')](app);require(_0xe083('0x12'))[_0xe083('0xf')](app);}else{server[_0xe083('0x13')](_0xe083('0x14'),function(){console[_0xe083('0x15')](_0xe083('0x16'),config['port']);});}exports=module[_0xe083('0x17')]=app; \ No newline at end of file +var _0x814b=['../../routes','log','port','lodash','http','express','sticky-session','ioredis','../../config/environment','createServer','timeout','listen','polling','redis','defaults','localhost','adapter','default','../../config/express'];(function(_0x2edd9e,_0x2d707c){var _0x1d1f7c=function(_0x1032f2){while(--_0x1032f2){_0x2edd9e['push'](_0x2edd9e['shift']());}};_0x1d1f7c(++_0x2d707c);}(_0x814b,0x17f));var _0xb814=function(_0x30033a,_0x5ce4a6){_0x30033a=_0x30033a-0x0;var _0x5e3518=_0x814b[_0x30033a];return _0x5e3518;};'use strict';var _=require(_0xb814('0x0'));var http=require(_0xb814('0x1'));var express=require(_0xb814('0x2'));var sticky=require(_0xb814('0x3'));var Redis=require(_0xb814('0x4'));var config=require(_0xb814('0x5'));var app=express();var server=http[_0xb814('0x6')](app);server[_0xb814('0x7')]=0xdbba0;if(sticky[_0xb814('0x8')](server,config['port'])){var socketio=require('socket.io')(server,{'transports':['websocket',_0xb814('0x9')]});config[_0xb814('0xa')]=_[_0xb814('0xb')](config[_0xb814('0xa')],{'host':_0xb814('0xc'),'port':0x18eb});socketio[_0xb814('0xd')](require('socket.io-redis')({'pubClient':new Redis(config[_0xb814('0xa')]),'subClient':new Redis(config['redis'])}));require('../../config/triggers')[_0xb814('0xe')]();require('../../config/socketio')['default'](socketio);require(_0xb814('0xf'))[_0xb814('0xe')](app);require(_0xb814('0x10'))[_0xb814('0xe')](app);}else{server['once']('listening',function(){console[_0xb814('0x11')]('Express\x20server\x20listening\x20on\x20port\x20%d!',config[_0xb814('0x12')]);});}exports=module['exports']=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index bbccd2f..c3ccd18 100644 --- a/server/services/routing/client.js +++ b/server/services/routing/client.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8a28=['exports','jayson/promise','bluebird','../../config/logger','routing','client','http','Request','request','then','rpc','error','message','result'];(function(_0x246b1f,_0x27deaf){var _0x4e31f8=function(_0x3a9c66){while(--_0x3a9c66){_0x246b1f['push'](_0x246b1f['shift']());}};_0x4e31f8(++_0x27deaf);}(_0x8a28,0xfd));var _0x88a2=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0x8a28[_0x1cfa0d];return _0xe33279;};'use strict';var jayson=require(_0x88a2('0x0'));var BPromise=require(_0x88a2('0x1'));var logger=require(_0x88a2('0x2'))(_0x88a2('0x3'));var client=jayson[_0x88a2('0x4')][_0x88a2('0x5')]({'port':0x2329});client[_0x88a2('0x6')]=function(_0x3fc89d,_0x5d5b92){return new BPromise(function(_0x2f482e,_0x238f2a){return client[_0x88a2('0x7')](_0x3fc89d,_0x5d5b92)[_0x88a2('0x8')](function(_0x29ce92){logger['debug'](_0x88a2('0x9'),'routing',_0x3fc89d,_0x5d5b92,_0x29ce92);if(_0x29ce92[_0x88a2('0xa')]){logger[_0x88a2('0xa')](_0x88a2('0x9'),_0x88a2('0x3'),_0x3fc89d,_0x29ce92[_0x88a2('0xa')][_0x88a2('0xb')],_0x5d5b92);return _0x238f2a(_0x29ce92[_0x88a2('0xa')][_0x88a2('0xb')]);}else{return _0x2f482e(_0x29ce92[_0x88a2('0xc')]);}})['catch'](function(_0x5b3d7f){logger[_0x88a2('0xa')](_0x88a2('0x9'),_0x88a2('0x3'),_0x3fc89d,_0x5b3d7f,_0x5d5b92);return _0x238f2a(_0x5b3d7f);});});};module[_0x88a2('0xd')]=client; \ No newline at end of file +var _0xae79=['catch','exports','jayson/promise','bluebird','../../config/logger','routing','client','http','Request','request','then','debug','error','rpc','result'];(function(_0x19b3f0,_0x4b18e2){var _0x1dfd43=function(_0x198a9e){while(--_0x198a9e){_0x19b3f0['push'](_0x19b3f0['shift']());}};_0x1dfd43(++_0x4b18e2);}(_0xae79,0x1d3));var _0x9ae7=function(_0x30d49e,_0x487878){_0x30d49e=_0x30d49e-0x0;var _0x49d10b=_0xae79[_0x30d49e];return _0x49d10b;};'use strict';var jayson=require(_0x9ae7('0x0'));var BPromise=require(_0x9ae7('0x1'));var logger=require(_0x9ae7('0x2'))(_0x9ae7('0x3'));var client=jayson[_0x9ae7('0x4')][_0x9ae7('0x5')]({'port':0x2329});client[_0x9ae7('0x6')]=function(_0x43f4d9,_0x988f5e){return new BPromise(function(_0x27817e,_0x3bb7d0){return client[_0x9ae7('0x7')](_0x43f4d9,_0x988f5e)[_0x9ae7('0x8')](function(_0x396863){logger[_0x9ae7('0x9')]('rpc',_0x9ae7('0x3'),_0x43f4d9,_0x988f5e,_0x396863);if(_0x396863[_0x9ae7('0xa')]){logger[_0x9ae7('0xa')](_0x9ae7('0xb'),_0x9ae7('0x3'),_0x43f4d9,_0x396863[_0x9ae7('0xa')]['message'],_0x988f5e);return _0x3bb7d0(_0x396863[_0x9ae7('0xa')]['message']);}else{return _0x27817e(_0x396863[_0x9ae7('0xc')]);}})[_0x9ae7('0xd')](function(_0x26f825){logger[_0x9ae7('0xa')](_0x9ae7('0xb'),_0x9ae7('0x3'),_0x43f4d9,_0x26f825,_0x988f5e);return _0x3bb7d0(_0x26f825);});});};module[_0x9ae7('0xe')]=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index 456b3b2..2d5248d 100644 --- a/server/services/routing/index.js +++ b/server/services/routing/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfea1=['bluebird','./server','./realtime','./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/smsQueue','./rpc/faxQueue','resolve','then','getIntervals','initIntervals','initOpenchannelQueues','initChatQueues','getSmsQueues','getMailQueues','initMailQueues','getFaxQueues','catch','log'];(function(_0x8bc276,_0x33ce4e){var _0x12d273=function(_0x3c6df9){while(--_0x3c6df9){_0x8bc276['push'](_0x8bc276['shift']());}};_0x12d273(++_0x33ce4e);}(_0xfea1,0x64));var _0x1fea=function(_0x2bf1d6,_0x410efd){_0x2bf1d6=_0x2bf1d6-0x0;var _0x1be08a=_0xfea1[_0x2bf1d6];return _0x1be08a;};'use strict';var BPromise=require(_0x1fea('0x0'));var server=require(_0x1fea('0x1'));var Realtime=require(_0x1fea('0x2'));var user=require('./rpc/user');var interval=require(_0x1fea('0x3'));var openchannelQueue=require(_0x1fea('0x4'));var chatQueue=require(_0x1fea('0x5'));var smsQueue=require(_0x1fea('0x6'));var mailQueue=require('./rpc/mailQueue');var faxQueue=require(_0x1fea('0x7'));var realtime=new Realtime();function initRealtime(){return BPromise[_0x1fea('0x8')]()[_0x1fea('0x9')](user['getAgents']())[_0x1fea('0x9')](realtime['initAgents']())['then'](interval[_0x1fea('0xa')]())[_0x1fea('0x9')](realtime[_0x1fea('0xb')]())['then'](openchannelQueue['getOpenchannelQueues']())['then'](realtime[_0x1fea('0xc')]())[_0x1fea('0x9')](chatQueue['getChatQueues']())[_0x1fea('0x9')](realtime[_0x1fea('0xd')]())[_0x1fea('0x9')](smsQueue[_0x1fea('0xe')]())[_0x1fea('0x9')](realtime['initSmsQueues']())[_0x1fea('0x9')](mailQueue[_0x1fea('0xf')]())[_0x1fea('0x9')](realtime[_0x1fea('0x10')]())[_0x1fea('0x9')](faxQueue[_0x1fea('0x11')]())[_0x1fea('0x9')](realtime['initFaxQueues']())[_0x1fea('0x9')](function(){return realtime;});}function main(){return server['listen'](realtime)[_0x1fea('0x9')](function(_0x25cc91){return initRealtime();})['then'](function(_0xa894ec){return setInterval(initRealtime,0x1388);})[_0x1fea('0x12')](function(_0x1c708e){console[_0x1fea('0x13')](_0x1c708e);});}main(); \ No newline at end of file +var _0xacc7=['./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/smsQueue','./rpc/mailQueue','resolve','then','initAgents','getIntervals','initIntervals','getOpenchannelQueues','initOpenchannelQueues','getChatQueues','getSmsQueues','initSmsQueues','getMailQueues','initMailQueues','log','bluebird','./realtime','./rpc/user'];(function(_0x13982d,_0x47c357){var _0x59e1d7=function(_0x5505ed){while(--_0x5505ed){_0x13982d['push'](_0x13982d['shift']());}};_0x59e1d7(++_0x47c357);}(_0xacc7,0x177));var _0x7acc=function(_0x2a9548,_0x2742f6){_0x2a9548=_0x2a9548-0x0;var _0xf55c55=_0xacc7[_0x2a9548];return _0xf55c55;};'use strict';var BPromise=require(_0x7acc('0x0'));var server=require('./server');var Realtime=require(_0x7acc('0x1'));var user=require(_0x7acc('0x2'));var interval=require(_0x7acc('0x3'));var openchannelQueue=require(_0x7acc('0x4'));var chatQueue=require(_0x7acc('0x5'));var smsQueue=require(_0x7acc('0x6'));var mailQueue=require(_0x7acc('0x7'));var faxQueue=require('./rpc/faxQueue');var realtime=new Realtime();function initRealtime(){return BPromise[_0x7acc('0x8')]()[_0x7acc('0x9')](user['getAgents']())['then'](realtime[_0x7acc('0xa')]())[_0x7acc('0x9')](interval[_0x7acc('0xb')]())[_0x7acc('0x9')](realtime[_0x7acc('0xc')]())[_0x7acc('0x9')](openchannelQueue[_0x7acc('0xd')]())[_0x7acc('0x9')](realtime[_0x7acc('0xe')]())[_0x7acc('0x9')](chatQueue[_0x7acc('0xf')]())[_0x7acc('0x9')](realtime['initChatQueues']())[_0x7acc('0x9')](smsQueue[_0x7acc('0x10')]())['then'](realtime[_0x7acc('0x11')]())[_0x7acc('0x9')](mailQueue[_0x7acc('0x12')]())['then'](realtime[_0x7acc('0x13')]())[_0x7acc('0x9')](faxQueue['getFaxQueues']())['then'](realtime['initFaxQueues']())[_0x7acc('0x9')](function(){return realtime;});}function main(){return server['listen'](realtime)[_0x7acc('0x9')](function(_0x245366){return initRealtime();})[_0x7acc('0x9')](function(_0x488c77){return setInterval(initRealtime,0x1388);})['catch'](function(_0x218c10){console[_0x7acc('0x14')](_0x218c10);});}main(); \ No newline at end of file diff --git a/server/services/routing/lib/rule-engine.js b/server/services/routing/lib/rule-engine.js index 83c7c6c..0d922b2 100644 --- a/server/services/routing/lib/rule-engine.js +++ b/server/services/routing/lib/rule-engine.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8c91=['call','matchPath','noop','findRules','matches','priority','map','condition','toString','object','lodash','util','EventEmitter','init','isNil','ignoreFactChanges','inherits','prototype','rules','activeRules','register','concat','isObject','push','sync','filter','orderBy','asc','execute','clone','consequence','ruleRef','name','index_','nextTick','next','restart','length'];(function(_0x32f1cb,_0x4ecb17){var _0x4cde17=function(_0x56c003){while(--_0x56c003){_0x32f1cb['push'](_0x32f1cb['shift']());}};_0x4cde17(++_0x4ecb17);}(_0x8c91,0x1ac));var _0x18c9=function(_0x1a5a1d,_0x5ed242){_0x1a5a1d=_0x1a5a1d-0x0;var _0x46b983=_0x8c91[_0x1a5a1d];return _0x46b983;};'use strict';var _=require(_0x18c9('0x0'));var util=require(_0x18c9('0x1'));var EventEmitter=require('events')[_0x18c9('0x2')];function RuleEngine(_0x9afb,_0x29d301){this[_0x18c9('0x3')]();if(!_[_0x18c9('0x4')](_0x9afb)){this['register'](_0x9afb);}if(_0x29d301){this[_0x18c9('0x5')]=_0x29d301[_0x18c9('0x5')];}return this;}util[_0x18c9('0x6')](RuleEngine,EventEmitter);RuleEngine[_0x18c9('0x7')]['init']=function(_0x316df8){this[_0x18c9('0x8')]=[];this[_0x18c9('0x9')]=[];};RuleEngine[_0x18c9('0x7')][_0x18c9('0xa')]=function(_0x3b131f){if(Array['isArray'](_0x3b131f)){this[_0x18c9('0x8')]=this[_0x18c9('0x8')][_0x18c9('0xb')](_0x3b131f);}else if(_0x3b131f!==null&&_[_0x18c9('0xc')](_0x3b131f)){this[_0x18c9('0x8')][_0x18c9('0xd')](_0x3b131f);}this[_0x18c9('0xe')]();};RuleEngine[_0x18c9('0x7')]['sync']=function(){this[_0x18c9('0x9')]=this[_0x18c9('0x8')][_0x18c9('0xf')](function(_0x20c070){if(_[_0x18c9('0x4')](_0x20c070['on'])){_0x20c070['on']=!![];}if(_0x20c070['on']===!![]){return _0x20c070;}});this['activeRules']=_[_0x18c9('0x10')](this['activeRules'],['p'],[_0x18c9('0x11')]);};RuleEngine[_0x18c9('0x7')][_0x18c9('0x12')]=function(_0x1e0d7b,_0x2b97e3){var _0x5db46e=![];_0x1e0d7b['result']=!![];var _0x1b791e=_['clone'](_0x1e0d7b);var _0xa839b8=_[_0x18c9('0x13')](_0x1e0d7b);var _0x5af69f=this[_0x18c9('0x9')];var _0x34666e=[];var _0x2b78eb=this[_0x18c9('0x5')];(function FnRuleLoop(_0x1d14c9){var _0x1ba2ee={'rules':function(){return _0x5af69f;},'rule':function(){return _0x5af69f[_0x1d14c9];},'when':function(_0x42e2d9){if(_0x42e2d9){var _0x2fb6b9=_0x5af69f[_0x1d14c9][_0x18c9('0x14')];_0x2fb6b9[_0x18c9('0x15')]=_0x5af69f[_0x1d14c9]['id']||_0x5af69f[_0x1d14c9][_0x18c9('0x16')]||_0x18c9('0x17')+_0x1d14c9;process[_0x18c9('0x18')](function(){_0x34666e['push'](_0x2fb6b9[_0x18c9('0x15')]);_0x2fb6b9['call'](_0x1b791e,_0x1ba2ee);});}else{process['nextTick'](function(){_0x1ba2ee[_0x18c9('0x19')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x5db46e=!![];return FnRuleLoop(0x0);},'next':function(_0x2dc063){if(!_0x2b78eb&&!_['isEqual'](_0xa839b8,_0x1b791e)){_0xa839b8=_[_0x18c9('0x13')](_0x1b791e);process[_0x18c9('0x18')](function(){_0x1ba2ee[_0x18c9('0x1a')]();});}else{process[_0x18c9('0x18')](function(){if(_[_0x18c9('0x4')](_0x2dc063)){return FnRuleLoop(_0x1d14c9+0x1);}else{return FnRuleLoop(_0x2dc063);}});}}};if(_0x1d14c9<_0x5af69f[_0x18c9('0x1b')]&&_0x5db46e===![]){var _0x356e20=_0x5af69f[_0x1d14c9]['condition'];_0x356e20[_0x18c9('0x1c')](_0x1b791e,_0x1ba2ee);}else{process[_0x18c9('0x18')](function(){_0x1b791e[_0x18c9('0x1d')]=_0x34666e;return _0x2b97e3?_0x2b97e3(_0x1b791e):_[_0x18c9('0x1e')]();});}}(0x0));};RuleEngine['prototype'][_0x18c9('0x1f')]=function(_0x5f1aa7){if(_[_0x18c9('0x4')](_0x5f1aa7)){return this[_0x18c9('0x8')];}else{var _0x522140=_[_0x18c9('0x20')](_0x5f1aa7);return _[_0x18c9('0xf')](this[_0x18c9('0x8')],_0x522140);}};RuleEngine[_0x18c9('0x7')]['turn']=function(_0x5c3dee,_0x3beeb7){var _0x58dfbc=_0x5c3dee==='on'||_0x5c3dee==='ON'?!![]:![];var _0x32596d=this[_0x18c9('0x1f')](_0x3beeb7);for(var _0x42c687=0x0,_0x181f0c=_0x32596d[_0x18c9('0x1b')];_0x42c687<_0x181f0c;_0x42c687+=0x1){_0x32596d[_0x42c687]['on']=_0x58dfbc;}this['sync']();};RuleEngine['prototype']['prioritize']=function(_0x1696f0,_0x8f9566){_0x1696f0=parseInt(_0x1696f0,0xa);var _0x5e5111=this[_0x18c9('0x1f')](_0x8f9566);for(var _0x2c24ef=0x0,_0x74e6de=_0x5e5111[_0x18c9('0x1b')];_0x2c24ef<_0x74e6de;_0x2c24ef+=0x1){_0x5e5111[_0x2c24ef][_0x18c9('0x21')]=_0x1696f0;}this[_0x18c9('0xe')]();};RuleEngine[_0x18c9('0x7')]['toJSON']=function(){var _0x4957ee=this['rules'];if(_0x4957ee instanceof Array){_0x4957ee=_0x4957ee[_0x18c9('0x22')](function(_0x583985){_0x583985[_0x18c9('0x23')]=_0x583985[_0x18c9('0x23')][_0x18c9('0x24')]();_0x583985['consequence']=_0x583985[_0x18c9('0x14')][_0x18c9('0x24')]();return _0x583985;});}else if(!_[_0x18c9('0x4')](_0x4957ee)){_0x4957ee[_0x18c9('0x23')]=_0x4957ee[_0x18c9('0x23')][_0x18c9('0x24')]();_0x4957ee[_0x18c9('0x14')]=_0x4957ee['consequence']['toString']();}return _0x4957ee;};RuleEngine[_0x18c9('0x7')]['fromJSON']=function(_0x14a43c){this[_0x18c9('0x3')]();if(_['isString'](_0x14a43c)){_0x14a43c=JSON['parse'](_0x14a43c);}if(_0x14a43c instanceof Array){_0x14a43c=_0x14a43c[_0x18c9('0x22')](function(_0x1fafae){_0x1fafae[_0x18c9('0x23')]=eval('('+_0x1fafae[_0x18c9('0x23')]+')');_0x1fafae[_0x18c9('0x14')]=eval('('+_0x1fafae[_0x18c9('0x14')]+')');return _0x1fafae;});}else if(_0x14a43c!==null&&typeof _0x14a43c==_0x18c9('0x25')){_0x14a43c[_0x18c9('0x23')]=eval('('+_0x14a43c[_0x18c9('0x23')]+')');_0x14a43c['consequence']=eval('('+_0x14a43c[_0x18c9('0x14')]+')');}this['register'](_0x14a43c);};module['exports']=RuleEngine; \ No newline at end of file +var _0xaf21=['isNil','orderBy','asc','result','clone','name','index_','nextTick','ruleRef','call','next','length','condition','matchPath','noop','findRules','matches','turn','prioritize','priority','toJSON','map','consequence','toString','fromJSON','isString','object','exports','util','events','init','register','ignoreFactChanges','inherits','rules','prototype','isArray','concat','isObject','push','sync','activeRules','filter'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xaf21,0x19f));var _0x1af2=function(_0x32df39,_0x277df7){_0x32df39=_0x32df39-0x0;var _0x1aa36f=_0xaf21[_0x32df39];return _0x1aa36f;};'use strict';var _=require('lodash');var util=require(_0x1af2('0x0'));var EventEmitter=require(_0x1af2('0x1'))['EventEmitter'];function RuleEngine(_0x4a8eea,_0x57ad5c){this[_0x1af2('0x2')]();if(!_['isNil'](_0x4a8eea)){this[_0x1af2('0x3')](_0x4a8eea);}if(_0x57ad5c){this[_0x1af2('0x4')]=_0x57ad5c['ignoreFactChanges'];}return this;}util[_0x1af2('0x5')](RuleEngine,EventEmitter);RuleEngine['prototype'][_0x1af2('0x2')]=function(_0x151a7c){this[_0x1af2('0x6')]=[];this['activeRules']=[];};RuleEngine[_0x1af2('0x7')][_0x1af2('0x3')]=function(_0xbac158){if(Array[_0x1af2('0x8')](_0xbac158)){this[_0x1af2('0x6')]=this[_0x1af2('0x6')][_0x1af2('0x9')](_0xbac158);}else if(_0xbac158!==null&&_[_0x1af2('0xa')](_0xbac158)){this[_0x1af2('0x6')][_0x1af2('0xb')](_0xbac158);}this[_0x1af2('0xc')]();};RuleEngine[_0x1af2('0x7')][_0x1af2('0xc')]=function(){this[_0x1af2('0xd')]=this[_0x1af2('0x6')][_0x1af2('0xe')](function(_0x1a0de2){if(_[_0x1af2('0xf')](_0x1a0de2['on'])){_0x1a0de2['on']=!![];}if(_0x1a0de2['on']===!![]){return _0x1a0de2;}});this[_0x1af2('0xd')]=_[_0x1af2('0x10')](this[_0x1af2('0xd')],['p'],[_0x1af2('0x11')]);};RuleEngine['prototype']['execute']=function(_0xba69de,_0x5207eb){var _0x46e84f=![];_0xba69de[_0x1af2('0x12')]=!![];var _0xd2e204=_['clone'](_0xba69de);var _0x23a25f=_[_0x1af2('0x13')](_0xba69de);var _0x2623d5=this[_0x1af2('0xd')];var _0x12ce62=[];var _0x5b5071=this[_0x1af2('0x4')];(function FnRuleLoop(_0x10f9ea){var _0x166366={'rules':function(){return _0x2623d5;},'rule':function(){return _0x2623d5[_0x10f9ea];},'when':function(_0x59059f){if(_0x59059f){var _0x2a890c=_0x2623d5[_0x10f9ea]['consequence'];_0x2a890c['ruleRef']=_0x2623d5[_0x10f9ea]['id']||_0x2623d5[_0x10f9ea][_0x1af2('0x14')]||_0x1af2('0x15')+_0x10f9ea;process[_0x1af2('0x16')](function(){_0x12ce62[_0x1af2('0xb')](_0x2a890c[_0x1af2('0x17')]);_0x2a890c[_0x1af2('0x18')](_0xd2e204,_0x166366);});}else{process['nextTick'](function(){_0x166366[_0x1af2('0x19')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x46e84f=!![];return FnRuleLoop(0x0);},'next':function(_0x502fd2){if(!_0x5b5071&&!_['isEqual'](_0x23a25f,_0xd2e204)){_0x23a25f=_['clone'](_0xd2e204);process[_0x1af2('0x16')](function(){_0x166366['restart']();});}else{process[_0x1af2('0x16')](function(){if(_[_0x1af2('0xf')](_0x502fd2)){return FnRuleLoop(_0x10f9ea+0x1);}else{return FnRuleLoop(_0x502fd2);}});}}};if(_0x10f9ea<_0x2623d5[_0x1af2('0x1a')]&&_0x46e84f===![]){var _0x497581=_0x2623d5[_0x10f9ea][_0x1af2('0x1b')];_0x497581[_0x1af2('0x18')](_0xd2e204,_0x166366);}else{process[_0x1af2('0x16')](function(){_0xd2e204[_0x1af2('0x1c')]=_0x12ce62;return _0x5207eb?_0x5207eb(_0xd2e204):_[_0x1af2('0x1d')]();});}}(0x0));};RuleEngine[_0x1af2('0x7')][_0x1af2('0x1e')]=function(_0x1569dc){if(_[_0x1af2('0xf')](_0x1569dc)){return this[_0x1af2('0x6')];}else{var _0x357eec=_[_0x1af2('0x1f')](_0x1569dc);return _[_0x1af2('0xe')](this[_0x1af2('0x6')],_0x357eec);}};RuleEngine['prototype'][_0x1af2('0x20')]=function(_0x381ae2,_0x430eae){var _0x4cb585=_0x381ae2==='on'||_0x381ae2==='ON'?!![]:![];var _0x29e7df=this[_0x1af2('0x1e')](_0x430eae);for(var _0x212607=0x0,_0x46ab1e=_0x29e7df[_0x1af2('0x1a')];_0x212607<_0x46ab1e;_0x212607+=0x1){_0x29e7df[_0x212607]['on']=_0x4cb585;}this[_0x1af2('0xc')]();};RuleEngine['prototype'][_0x1af2('0x21')]=function(_0x211500,_0x505c4d){_0x211500=parseInt(_0x211500,0xa);var _0x2a81c5=this[_0x1af2('0x1e')](_0x505c4d);for(var _0x1309f1=0x0,_0x461215=_0x2a81c5['length'];_0x1309f1<_0x461215;_0x1309f1+=0x1){_0x2a81c5[_0x1309f1][_0x1af2('0x22')]=_0x211500;}this[_0x1af2('0xc')]();};RuleEngine[_0x1af2('0x7')][_0x1af2('0x23')]=function(){var _0xc155a9=this[_0x1af2('0x6')];if(_0xc155a9 instanceof Array){_0xc155a9=_0xc155a9[_0x1af2('0x24')](function(_0x10ced6){_0x10ced6[_0x1af2('0x1b')]=_0x10ced6['condition']['toString']();_0x10ced6[_0x1af2('0x25')]=_0x10ced6[_0x1af2('0x25')][_0x1af2('0x26')]();return _0x10ced6;});}else if(!_[_0x1af2('0xf')](_0xc155a9)){_0xc155a9['condition']=_0xc155a9[_0x1af2('0x1b')][_0x1af2('0x26')]();_0xc155a9[_0x1af2('0x25')]=_0xc155a9['consequence'][_0x1af2('0x26')]();}return _0xc155a9;};RuleEngine[_0x1af2('0x7')][_0x1af2('0x27')]=function(_0x3a2d63){this['init']();if(_[_0x1af2('0x28')](_0x3a2d63)){_0x3a2d63=JSON['parse'](_0x3a2d63);}if(_0x3a2d63 instanceof Array){_0x3a2d63=_0x3a2d63['map'](function(_0x3cbc07){_0x3cbc07[_0x1af2('0x1b')]=eval('('+_0x3cbc07[_0x1af2('0x1b')]+')');_0x3cbc07[_0x1af2('0x25')]=eval('('+_0x3cbc07[_0x1af2('0x25')]+')');return _0x3cbc07;});}else if(_0x3a2d63!==null&&typeof _0x3a2d63==_0x1af2('0x29')){_0x3a2d63[_0x1af2('0x1b')]=eval('('+_0x3a2d63[_0x1af2('0x1b')]+')');_0x3a2d63[_0x1af2('0x25')]=eval('('+_0x3a2d63[_0x1af2('0x25')]+')');}this[_0x1af2('0x3')](_0x3a2d63);};module[_0x1af2('0x2a')]=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index 2000bab..2e4a1aa 100644 --- a/server/services/routing/mailRpc/index.js +++ b/server/services/routing/mailRpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['result','catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','http','request','error','message'];(function(_0x448c24,_0x5229d1){var _0x3fbe06=function(_0x2c6f7b){while(--_0x2c6f7b){_0x448c24['push'](_0x448c24['shift']());}};_0x3fbe06(++_0x5229d1);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var BPromise=require(_0x7995('0x0'));var jayson=require(_0x7995('0x1'));var client=jayson[_0x7995('0x2')][_0x7995('0x3')]({'port':0x232b});function request(_0x5b96eb,_0x86c128){return new BPromise(function(_0x3c58eb,_0x1902b4){return client[_0x7995('0x4')](_0x5b96eb,_0x86c128)['then'](function(_0x744bea){if(_0x744bea[_0x7995('0x5')]){return _0x1902b4(_0x744bea[_0x7995('0x5')][_0x7995('0x6')]);}else{return _0x3c58eb(_0x744bea[_0x7995('0x7')]);}})[_0x7995('0x8')](function(_0x4996ca){return _0x1902b4(_0x4996ca);});});}exports[_0x7995('0x9')]=function(_0x1cad37,_0x4a64f7){return request(_0x7995('0xa'),{'account':_0x1cad37,'message':_0x4a64f7});}; \ No newline at end of file +var _0x9957=['result','catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','http','request','error','message'];(function(_0x3f5805,_0x3f6651){var _0x349f29=function(_0x3e8d88){while(--_0x3e8d88){_0x3f5805['push'](_0x3f5805['shift']());}};_0x349f29(++_0x3f6651);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'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/routing/model/agent.js b/server/services/routing/model/agent.js index 1580c12..63b1338 100644 --- a/server/services/routing/model/agent.js +++ b/server/services/routing/model/agent.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x153f=['localhost','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatCapacity','chatCurrentCapacity','mailStatus','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','updateRealtime','prototype','getChannelStatus','CurrentCapacity','Capacity','working','idle','mail','chat','openchannel','fax','sms','length','Status','StatusTime','toNumber','format','chatStatusTime','faxStatus','smsCurrentCapacity','stringify','emit','exports','lodash','moment','md5','ioredis','../../../config/environment','redis','defaults'];(function(_0x1064bc,_0x206f12){var _0x5edc45=function(_0x5087bd){while(--_0x5087bd){_0x1064bc['push'](_0x1064bc['shift']());}};_0x5edc45(++_0x206f12);}(_0x153f,0x15b));var _0xf153=function(_0x2dadc1,_0x8028f3){_0x2dadc1=_0x2dadc1-0x0;var _0x45352c=_0x153f[_0x2dadc1];return _0x45352c;};'use strict';var _=require(_0xf153('0x0'));var moment=require(_0xf153('0x1'));var md5=require(_0xf153('0x2'));var Redis=require(_0xf153('0x3'));var config=require(_0xf153('0x4'));config[_0xf153('0x5')]=_[_0xf153('0x6')](config['redis'],{'host':_0xf153('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xf153('0x5')]));function Agent(_0x2fcb1a){this['id']=_0x2fcb1a['id']||0x0;this[_0xf153('0x8')]=_0x2fcb1a[_0xf153('0x8')]||'';this[_0xf153('0x9')]=_0x2fcb1a['online']||!![];this[_0xf153('0xa')]=_0x2fcb1a[_0xf153('0xa')]||![];this[_0xf153('0xb')]=_0x2fcb1a[_0xf153('0xb')]||![];this[_0xf153('0xc')]=_0x2fcb1a[_0xf153('0xc')]||![];this[_0xf153('0xd')]=_0x2fcb1a[_0xf153('0xd')]||![];this[_0xf153('0xe')]=_0x2fcb1a[_0xf153('0xe')]||![];this['openchannelPause']=_0x2fcb1a[_0xf153('0xf')]||![];this[_0xf153('0x10')]=_0xf153('0x11');this['chatStatusTime']=0x0;this[_0xf153('0x12')]=_0x2fcb1a[_0xf153('0x12')]||0x0;this[_0xf153('0x13')]=0x0;this[_0xf153('0x14')]=_0xf153('0x11');this[_0xf153('0x15')]=0x0;this[_0xf153('0x16')]=_0x2fcb1a[_0xf153('0x16')]||0x0;this[_0xf153('0x17')]=0x0;this['faxStatus']=_0xf153('0x11');this[_0xf153('0x18')]=0x0;this[_0xf153('0x19')]=_0x2fcb1a[_0xf153('0x19')]||0x0;this[_0xf153('0x1a')]=0x0;this[_0xf153('0x1b')]=_0xf153('0x11');this[_0xf153('0x1c')]=0x0;this['smsCapacity']=_0x2fcb1a[_0xf153('0x1d')]||0x0;this['smsCurrentCapacity']=0x0;this[_0xf153('0x1e')]=_0xf153('0x11');this[_0xf153('0x1f')]=0x0;this[_0xf153('0x20')]=_0x2fcb1a['openchannelCapacity']||0x0;this[_0xf153('0x21')]=0x0;this[_0xf153('0x22')]=![];this[_0xf153('0x23')]=undefined;this[_0xf153('0x2')]='';this[_0xf153('0x24')]();}Agent[_0xf153('0x25')][_0xf153('0x26')]=function(_0x2db2c7){if(this[_0x2db2c7+_0xf153('0x27')]>0x0){if(this[_0x2db2c7+_0xf153('0x28')]>0x0&&this[_0x2db2c7+_0xf153('0x27')]>=this[_0x2db2c7+_0xf153('0x28')]){return'maxcapacity';}else{return _0xf153('0x29');}}else{return _0xf153('0x2a');}};Agent[_0xf153('0x25')][_0xf153('0x24')]=function(){var _0x5c9f44=[_0xf153('0x2b'),_0xf153('0x2c'),_0xf153('0x2d'),_0xf153('0x2e'),_0xf153('0x2f')];for(var _0x1570fc=0x0;_0x1570fc<_0x5c9f44[_0xf153('0x30')];_0x1570fc+=0x1){var _0x35cfe3=this[_0xf153('0x26')](_0x5c9f44[_0x1570fc]);if(this[_0x5c9f44[_0x1570fc]+_0xf153('0x31')]!==_0x35cfe3){this[_0x5c9f44[_0x1570fc]+_0xf153('0x32')]=_[_0xf153('0x33')](moment()[_0xf153('0x34')]('x'));}this[_0x5c9f44[_0x1570fc]+_0xf153('0x31')]=_0x35cfe3;}var _0x17f7a4={'id':this['id'],'name':this['name'],'online':this[_0xf153('0x9')],'voicePause':this[_0xf153('0xa')],'chatPause':this['chatPause'],'mailPause':this[_0xf153('0xc')],'smsPause':this[_0xf153('0xe')],'faxPause':this['faxPause'],'openchannelPause':this[_0xf153('0xf')],'chatStatus':this[_0xf153('0x10')],'chatStatusTime':this[_0xf153('0x35')],'chatCapacity':this[_0xf153('0x12')],'chatCurrentCapacity':this[_0xf153('0x13')],'mailStatus':this[_0xf153('0x14')],'mailStatusTime':this[_0xf153('0x15')],'mailCapacity':this[_0xf153('0x16')],'mailCurrentCapacity':this[_0xf153('0x17')],'faxStatus':this[_0xf153('0x36')],'faxStatusTime':this[_0xf153('0x18')],'faxCapacity':this[_0xf153('0x19')],'faxCurrentCapacity':this['faxCurrentCapacity'],'smsStatus':this[_0xf153('0x1b')],'smsStatusTime':this[_0xf153('0x1c')],'smsCapacity':this[_0xf153('0x1d')],'smsCurrentCapacity':this[_0xf153('0x37')],'openchannelStatus':this['openchannelStatus'],'openchannelStatusTime':this['openchannelStatusTime'],'openchannelCapacity':this[_0xf153('0x20')],'openchannelCurrentCapacity':this['openchannelCurrentCapacity'],'busy':this['busy'],'busyQueue':this[_0xf153('0x23')]};var _0x4ab958=md5(JSON[_0xf153('0x38')](_0x17f7a4));if(this['md5']!==_0x4ab958){this[_0xf153('0x2')]=_0x4ab958;io[_0xf153('0x39')]('user:save',_0x17f7a4);}};module[_0xf153('0x3a')]=Agent; \ No newline at end of file +var _0xcb91=['emit','exports','md5','ioredis','../../../config/environment','redis','localhost','name','online','voicePause','chatPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatusTime','smsCapacity','smsCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCurrentCapacity','busy','busyQueue','updateRealtime','prototype','getChannelStatus','Capacity','maxcapacity','mail','chat','openchannel','Status','StatusTime','toNumber','mailPause','mailStatus','faxStatus','stringify'];(function(_0x59c4b8,_0x45453a){var _0x8147e2=function(_0xc77ef5){while(--_0xc77ef5){_0x59c4b8['push'](_0x59c4b8['shift']());}};_0x8147e2(++_0x45453a);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x1e9424,_0x191cba){_0x1e9424=_0x1e9424-0x0;var _0x1bd96c=_0xcb91[_0x1e9424];return _0x1bd96c;};'use strict';var _=require('lodash');var moment=require('moment');var md5=require(_0x1cb9('0x0'));var Redis=require(_0x1cb9('0x1'));var config=require(_0x1cb9('0x2'));config[_0x1cb9('0x3')]=_['defaults'](config[_0x1cb9('0x3')],{'host':_0x1cb9('0x4'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x1cb9('0x3')]));function Agent(_0x1b26cd){this['id']=_0x1b26cd['id']||0x0;this['name']=_0x1b26cd[_0x1cb9('0x5')]||'';this[_0x1cb9('0x6')]=_0x1b26cd['online']||!![];this[_0x1cb9('0x7')]=_0x1b26cd[_0x1cb9('0x7')]||![];this['chatPause']=_0x1b26cd[_0x1cb9('0x8')]||![];this['mailPause']=_0x1b26cd['mailPause']||![];this[_0x1cb9('0x9')]=_0x1b26cd[_0x1cb9('0x9')]||![];this[_0x1cb9('0xa')]=_0x1b26cd[_0x1cb9('0xa')]||![];this[_0x1cb9('0xb')]=_0x1b26cd['openchannelPause']||![];this[_0x1cb9('0xc')]=_0x1cb9('0xd');this[_0x1cb9('0xe')]=0x0;this[_0x1cb9('0xf')]=_0x1b26cd[_0x1cb9('0xf')]||0x0;this['chatCurrentCapacity']=0x0;this['mailStatus']='unknown';this[_0x1cb9('0x10')]=0x0;this[_0x1cb9('0x11')]=_0x1b26cd[_0x1cb9('0x11')]||0x0;this[_0x1cb9('0x12')]=0x0;this['faxStatus']=_0x1cb9('0xd');this[_0x1cb9('0x13')]=0x0;this[_0x1cb9('0x14')]=_0x1b26cd[_0x1cb9('0x14')]||0x0;this[_0x1cb9('0x15')]=0x0;this['smsStatus']='unknown';this[_0x1cb9('0x16')]=0x0;this[_0x1cb9('0x17')]=_0x1b26cd[_0x1cb9('0x17')]||0x0;this[_0x1cb9('0x18')]=0x0;this[_0x1cb9('0x19')]=_0x1cb9('0xd');this[_0x1cb9('0x1a')]=0x0;this['openchannelCapacity']=_0x1b26cd['openchannelCapacity']||0x0;this[_0x1cb9('0x1b')]=0x0;this[_0x1cb9('0x1c')]=![];this[_0x1cb9('0x1d')]=undefined;this[_0x1cb9('0x0')]='';this[_0x1cb9('0x1e')]();}Agent[_0x1cb9('0x1f')][_0x1cb9('0x20')]=function(_0x4ac422){if(this[_0x4ac422+'CurrentCapacity']>0x0){if(this[_0x4ac422+_0x1cb9('0x21')]>0x0&&this[_0x4ac422+'CurrentCapacity']>=this[_0x4ac422+_0x1cb9('0x21')]){return _0x1cb9('0x22');}else{return'working';}}else{return'idle';}};Agent[_0x1cb9('0x1f')][_0x1cb9('0x1e')]=function(){var _0x103a63=[_0x1cb9('0x23'),_0x1cb9('0x24'),_0x1cb9('0x25'),'fax','sms'];for(var _0x6c6f61=0x0;_0x6c6f61<_0x103a63['length'];_0x6c6f61+=0x1){var _0x10a419=this[_0x1cb9('0x20')](_0x103a63[_0x6c6f61]);if(this[_0x103a63[_0x6c6f61]+_0x1cb9('0x26')]!==_0x10a419){this[_0x103a63[_0x6c6f61]+_0x1cb9('0x27')]=_[_0x1cb9('0x28')](moment()['format']('x'));}this[_0x103a63[_0x6c6f61]+_0x1cb9('0x26')]=_0x10a419;}var _0x9df250={'id':this['id'],'name':this['name'],'online':this[_0x1cb9('0x6')],'voicePause':this[_0x1cb9('0x7')],'chatPause':this[_0x1cb9('0x8')],'mailPause':this[_0x1cb9('0x29')],'smsPause':this[_0x1cb9('0xa')],'faxPause':this[_0x1cb9('0x9')],'openchannelPause':this[_0x1cb9('0xb')],'chatStatus':this[_0x1cb9('0xc')],'chatStatusTime':this[_0x1cb9('0xe')],'chatCapacity':this[_0x1cb9('0xf')],'chatCurrentCapacity':this['chatCurrentCapacity'],'mailStatus':this[_0x1cb9('0x2a')],'mailStatusTime':this['mailStatusTime'],'mailCapacity':this[_0x1cb9('0x11')],'mailCurrentCapacity':this['mailCurrentCapacity'],'faxStatus':this[_0x1cb9('0x2b')],'faxStatusTime':this[_0x1cb9('0x13')],'faxCapacity':this[_0x1cb9('0x14')],'faxCurrentCapacity':this[_0x1cb9('0x15')],'smsStatus':this['smsStatus'],'smsStatusTime':this[_0x1cb9('0x16')],'smsCapacity':this['smsCapacity'],'smsCurrentCapacity':this[_0x1cb9('0x18')],'openchannelStatus':this[_0x1cb9('0x19')],'openchannelStatusTime':this[_0x1cb9('0x1a')],'openchannelCapacity':this['openchannelCapacity'],'openchannelCurrentCapacity':this[_0x1cb9('0x1b')],'busy':this['busy'],'busyQueue':this[_0x1cb9('0x1d')]};var _0x58f4f5=md5(JSON[_0x1cb9('0x2c')](_0x9df250));if(this[_0x1cb9('0x0')]!==_0x58f4f5){this[_0x1cb9('0x0')]=_0x58f4f5;io[_0x1cb9('0x2d')]('user:save',_0x9df250);}};module[_0x1cb9('0x2e')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index 70bba26..4fc3def 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 _0xd76c=['md5','util','ioredis','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','Agents','loggedIn','paused','length','online','available','stringify','format','chat:queue:%s','emit','exports','lodash'];(function(_0x5a972e,_0x2db978){var _0x37074e=function(_0x257651){while(--_0x257651){_0x5a972e['push'](_0x5a972e['shift']());}};_0x37074e(++_0x2db978);}(_0xd76c,0x195));var _0xcd76=function(_0x4ec9e3,_0x15fbf4){_0x4ec9e3=_0x4ec9e3-0x0;var _0x2883ce=_0xd76c[_0x4ec9e3];return _0x2883ce;};'use strict';var _=require(_0xcd76('0x0'));var md5=require(_0xcd76('0x1'));var util=require(_0xcd76('0x2'));var Redis=require(_0xcd76('0x3'));var config=require('../../../config/environment');config[_0xcd76('0x4')]=_[_0xcd76('0x5')](config[_0xcd76('0x4')],{'host':_0xcd76('0x6'),'port':0x18eb});var io=require(_0xcd76('0x7'))(new Redis(config[_0xcd76('0x4')]));function ChatQueue(_0x1bb250){this['id']=_0x1bb250['id']||0x0;this['name']=_0x1bb250[_0xcd76('0x8')]||'';this[_0xcd76('0x9')]=_0x1bb250[_0xcd76('0x9')]||0xa;this['strategy']=_0x1bb250[_0xcd76('0xa')]||'beepall';this['Agents']=_0x1bb250['Agents'];this[_0xcd76('0xb')]={};this[_0xcd76('0xc')]=0x0;this['md5']='';this[_0xcd76('0xd')]();this[_0xcd76('0xe')]();}ChatQueue[_0xcd76('0xf')]['updateRouting']=function(){var _0xe01446=this['mapAgentsId'][_0xcd76('0x10')];this[_0xcd76('0xb')]=_[_0xcd76('0x11')](this[_0xcd76('0x12')],'id');this[_0xcd76('0xb')][_0xcd76('0x10')]=_0xe01446;};ChatQueue[_0xcd76('0xf')][_0xcd76('0xe')]=function(){this[_0xcd76('0x13')]=0x0;this[_0xcd76('0x14')]=0x0;for(var _0x3daf46=0x0;_0x3daf46=0x0?this[_0xcd76('0x17')]:0x0;var _0x4801bf={'id':this['id'],'available':this[_0xcd76('0x17')],'loggedIn':this[_0xcd76('0x13')],'name':this['name'],'paused':this[_0xcd76('0x14')],'waiting':this[_0xcd76('0xc')]};var _0x501a00=md5(JSON[_0xcd76('0x18')](_0x4801bf));if(this[_0xcd76('0x1')]!==_0x501a00){this[_0xcd76('0x1')]=_0x501a00;io['to'](util[_0xcd76('0x19')](_0xcd76('0x1a'),_0x4801bf[_0xcd76('0x8')]))[_0xcd76('0x1b')]('chat_queue:save',_0x4801bf);}};module[_0xcd76('0x1c')]=ChatQueue; \ No newline at end of file +var _0x7502=['../../../config/environment','redis','defaults','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','updateRealtime','updateRouting','mapAgentsId','loggedIn','length','online','chatPause','paused','available','stringify','format','emit','chat_queue:save','exports','lodash','md5','util','ioredis'];(function(_0x321e87,_0x47e8d9){var _0x17b210=function(_0x26c4d7){while(--_0x26c4d7){_0x321e87['push'](_0x321e87['shift']());}};_0x17b210(++_0x47e8d9);}(_0x7502,0x184));var _0x2750=function(_0x32bd7c,_0x5e9180){_0x32bd7c=_0x32bd7c-0x0;var _0x25bebb=_0x7502[_0x32bd7c];return _0x25bebb;};'use strict';var _=require(_0x2750('0x0'));var md5=require(_0x2750('0x1'));var util=require(_0x2750('0x2'));var Redis=require(_0x2750('0x3'));var config=require(_0x2750('0x4'));config[_0x2750('0x5')]=_[_0x2750('0x6')](config[_0x2750('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x2750('0x7'))(new Redis(config[_0x2750('0x5')]));function ChatQueue(_0x22668b){this['id']=_0x22668b['id']||0x0;this['name']=_0x22668b[_0x2750('0x8')]||'';this[_0x2750('0x9')]=_0x22668b[_0x2750('0x9')]||0xa;this['strategy']=_0x22668b[_0x2750('0xa')]||_0x2750('0xb');this[_0x2750('0xc')]=_0x22668b[_0x2750('0xc')];this['mapAgentsId']={};this[_0x2750('0xd')]=0x0;this['md5']='';this['updateRouting']();this[_0x2750('0xe')]();}ChatQueue['prototype'][_0x2750('0xf')]=function(){var _0x26365d=this[_0x2750('0x10')]['_rr'];this[_0x2750('0x10')]=_['map'](this[_0x2750('0xc')],'id');this[_0x2750('0x10')]['_rr']=_0x26365d;};ChatQueue['prototype'][_0x2750('0xe')]=function(){this[_0x2750('0x11')]=0x0;this['paused']=0x0;for(var _0x38b396=0x0;_0x38b396=0x0?this['available']:0x0;var _0x216864={'id':this['id'],'available':this[_0x2750('0x16')],'loggedIn':this[_0x2750('0x11')],'name':this['name'],'paused':this[_0x2750('0x15')],'waiting':this['waiting']};var _0x3c6167=md5(JSON[_0x2750('0x17')](_0x216864));if(this['md5']!==_0x3c6167){this['md5']=_0x3c6167;io['to'](util[_0x2750('0x18')]('chat:queue:%s',_0x216864['name']))[_0x2750('0x19')](_0x2750('0x1a'),_0x216864);}};module[_0x2750('0x1b')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index 441bacd..f6bf289 100644 --- a/server/services/routing/model/faxQueue.js +++ b/server/services/routing/model/faxQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['available','stringify','format','emit','exports','lodash','md5','util','redis','localhost','socket.io-emitter','name','timeout','beepall','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','map','Agents','_rr','loggedIn','paused','length','faxPause'];(function(_0x236f50,_0x291099){var _0x5501d7=function(_0x152fad){while(--_0x152fad){_0x236f50['push'](_0x236f50['shift']());}};_0x5501d7(++_0x291099);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xa9e0[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0x0a9e('0x0'));var md5=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x0a9e('0x3')]=_['defaults'](config[_0x0a9e('0x3')],{'host':_0x0a9e('0x4'),'port':0x18eb});var io=require(_0x0a9e('0x5'))(new Redis(config[_0x0a9e('0x3')]));function FaxQueue(_0x981158){this['id']=_0x981158['id']||0x0;this['name']=_0x981158[_0x0a9e('0x6')]||'';this[_0x0a9e('0x7')]=_0x981158[_0x0a9e('0x7')]||0xa;this['strategy']=_0x981158['strategy']||_0x0a9e('0x8');this['Agents']=_0x981158['Agents'];this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]=0x0;this[_0x0a9e('0x1')]='';this[_0x0a9e('0xb')]();this[_0x0a9e('0xc')]();}FaxQueue[_0x0a9e('0xd')]['updateRouting']=function(){var _0x50dfb2=this['mapAgentsId']['_rr'];this[_0x0a9e('0x9')]=_[_0x0a9e('0xe')](this[_0x0a9e('0xf')],'id');this[_0x0a9e('0x9')][_0x0a9e('0x10')]=_0x50dfb2;};FaxQueue[_0x0a9e('0xd')]['updateRealtime']=function(){this[_0x0a9e('0x11')]=0x0;this[_0x0a9e('0x12')]=0x0;for(var _0x2b4227=0x0;_0x2b4227=0x0?this[_0x0a9e('0x15')]:0x0;var _0x478723={'id':this['id'],'available':this[_0x0a9e('0x15')],'loggedIn':this[_0x0a9e('0x11')],'name':this[_0x0a9e('0x6')],'paused':this[_0x0a9e('0x12')],'waiting':this[_0x0a9e('0xa')]};var _0x20559e=md5(JSON[_0x0a9e('0x16')](_0x478723));if(this[_0x0a9e('0x1')]!==_0x20559e){this[_0x0a9e('0x1')]=_0x20559e;io['to'](util[_0x0a9e('0x17')]('fax:queue:%s',_0x478723[_0x0a9e('0x6')]))[_0x0a9e('0x18')]('fax_queue:save',_0x478723);}};module[_0x0a9e('0x19')]=FaxQueue; \ No newline at end of file +var _0xa9e0=['available','stringify','format','emit','exports','lodash','md5','util','redis','localhost','socket.io-emitter','name','timeout','beepall','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','map','Agents','_rr','loggedIn','paused','length','faxPause'];(function(_0xe9150f,_0x2afb04){var _0x10e88c=function(_0x33d82d){while(--_0x33d82d){_0xe9150f['push'](_0xe9150f['shift']());}};_0x10e88c(++_0x2afb04);}(_0xa9e0,0x123));var _0x0a9e=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0xa9e0[_0x411add];return _0x238242;};'use strict';var _=require(_0x0a9e('0x0'));var md5=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x0a9e('0x3')]=_['defaults'](config[_0x0a9e('0x3')],{'host':_0x0a9e('0x4'),'port':0x18eb});var io=require(_0x0a9e('0x5'))(new Redis(config[_0x0a9e('0x3')]));function FaxQueue(_0x981158){this['id']=_0x981158['id']||0x0;this['name']=_0x981158[_0x0a9e('0x6')]||'';this[_0x0a9e('0x7')]=_0x981158[_0x0a9e('0x7')]||0xa;this['strategy']=_0x981158['strategy']||_0x0a9e('0x8');this['Agents']=_0x981158['Agents'];this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]=0x0;this[_0x0a9e('0x1')]='';this[_0x0a9e('0xb')]();this[_0x0a9e('0xc')]();}FaxQueue[_0x0a9e('0xd')]['updateRouting']=function(){var _0x50dfb2=this['mapAgentsId']['_rr'];this[_0x0a9e('0x9')]=_[_0x0a9e('0xe')](this[_0x0a9e('0xf')],'id');this[_0x0a9e('0x9')][_0x0a9e('0x10')]=_0x50dfb2;};FaxQueue[_0x0a9e('0xd')]['updateRealtime']=function(){this[_0x0a9e('0x11')]=0x0;this[_0x0a9e('0x12')]=0x0;for(var _0x2b4227=0x0;_0x2b4227=0x0?this[_0x0a9e('0x15')]:0x0;var _0x478723={'id':this['id'],'available':this[_0x0a9e('0x15')],'loggedIn':this[_0x0a9e('0x11')],'name':this[_0x0a9e('0x6')],'paused':this[_0x0a9e('0x12')],'waiting':this[_0x0a9e('0xa')]};var _0x20559e=md5(JSON[_0x0a9e('0x16')](_0x478723));if(this[_0x0a9e('0x1')]!==_0x20559e){this[_0x0a9e('0x1')]=_0x20559e;io['to'](util[_0x0a9e('0x17')]('fax:queue:%s',_0x478723[_0x0a9e('0x6')]))[_0x0a9e('0x18')]('fax_queue:save',_0x478723);}};module[_0x0a9e('0x19')]=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index e019fa8..31cec6e 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 _0x3782=['name'];(function(_0x77eab6,_0x59ca63){var _0x1934d=function(_0x93a9da){while(--_0x93a9da){_0x77eab6['push'](_0x77eab6['shift']());}};_0x1934d(++_0x59ca63);}(_0x3782,0x1f0));var _0x2378=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x3782[_0x321bb2];return _0x9c12ed;};'use strict';function Interval(_0x5dc524){this['id']=_0x5dc524['id']||0x0;this[_0x2378('0x0')]=_0x5dc524[_0x2378('0x0')]||'';this['Intervals']=_0x5dc524['Intervals']||{};}module['exports']=Interval; \ No newline at end of file +var _0x8fe2=['name','Intervals','exports'];(function(_0x96950,_0x7759a2){var _0x5e6515=function(_0x1d54dc){while(--_0x1d54dc){_0x96950['push'](_0x96950['shift']());}};_0x5e6515(++_0x7759a2);}(_0x8fe2,0x174));var _0x28fe=function(_0x4a0801,_0x55b298){_0x4a0801=_0x4a0801-0x0;var _0x47306d=_0x8fe2[_0x4a0801];return _0x47306d;};'use strict';function Interval(_0x46227d){this['id']=_0x46227d['id']||0x0;this[_0x28fe('0x0')]=_0x46227d[_0x28fe('0x0')]||'';this['Intervals']=_0x46227d[_0x28fe('0x1')]||{};}module[_0x28fe('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 4deaf0e..7ee731b 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 _0x50b4=['updateRealtime','prototype','_rr','length','online','loggedIn','mailPause','available','paused','waiting','stringify','format','mail:queue:%s','emit','mail_queue:save','exports','md5','util','../../../config/environment','redis','defaults','localhost','name','timeout','strategy','beepall','Agents','mapAgentsId','updateRouting'];(function(_0x544f3d,_0x2e086e){var _0x2201b1=function(_0x5bf17b){while(--_0x5bf17b){_0x544f3d['push'](_0x544f3d['shift']());}};_0x2201b1(++_0x2e086e);}(_0x50b4,0x67));var _0x450b=function(_0x5abe06,_0x131a9b){_0x5abe06=_0x5abe06-0x0;var _0xf0f180=_0x50b4[_0x5abe06];return _0xf0f180;};'use strict';var _=require('lodash');var md5=require(_0x450b('0x0'));var util=require(_0x450b('0x1'));var Redis=require('ioredis');var config=require(_0x450b('0x2'));config[_0x450b('0x3')]=_[_0x450b('0x4')](config[_0x450b('0x3')],{'host':_0x450b('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x450b('0x3')]));function MailQueue(_0x4de76e){this['id']=_0x4de76e['id']||0x0;this[_0x450b('0x6')]=_0x4de76e[_0x450b('0x6')]||'';this[_0x450b('0x7')]=_0x4de76e[_0x450b('0x7')]||0xa;this[_0x450b('0x8')]=_0x4de76e[_0x450b('0x8')]||_0x450b('0x9');this[_0x450b('0xa')]=_0x4de76e[_0x450b('0xa')];this[_0x450b('0xb')]={};this['waiting']=0x0;this[_0x450b('0x0')]='';this[_0x450b('0xc')]();this[_0x450b('0xd')]();}MailQueue[_0x450b('0xe')]['updateRouting']=function(){var _0x2adb84=this[_0x450b('0xb')]['_rr'];this['mapAgentsId']=_['map'](this[_0x450b('0xa')],'id');this['mapAgentsId'][_0x450b('0xf')]=_0x2adb84;};MailQueue[_0x450b('0xe')]['updateRealtime']=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x5ed2be=0x0;_0x5ed2be=0x0?this[_0x450b('0x14')]:0x0;var _0x4e6cd9={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this[_0x450b('0x15')],'waiting':this[_0x450b('0x16')]};var _0x32b7b3=md5(JSON[_0x450b('0x17')](_0x4e6cd9));if(this[_0x450b('0x0')]!==_0x32b7b3){this[_0x450b('0x0')]=_0x32b7b3;io['to'](util[_0x450b('0x18')](_0x450b('0x19'),_0x4e6cd9['name']))[_0x450b('0x1a')](_0x450b('0x1b'),_0x4e6cd9);}};module[_0x450b('0x1c')]=MailQueue; \ No newline at end of file +var _0x22d5=['stringify','format','mail:queue:%s','emit','exports','lodash','md5','util','ioredis','redis','localhost','socket.io-emitter','name','timeout','beepall','Agents','mapAgentsId','waiting','updateRouting','prototype','_rr','map','loggedIn','paused','length','online','mailPause','available'];(function(_0x1c6ce4,_0x48d64f){var _0xa52659=function(_0x57d7e8){while(--_0x57d7e8){_0x1c6ce4['push'](_0x1c6ce4['shift']());}};_0xa52659(++_0x48d64f);}(_0x22d5,0x1e1));var _0x522d=function(_0x64a811,_0x4887b7){_0x64a811=_0x64a811-0x0;var _0x3d8099=_0x22d5[_0x64a811];return _0x3d8099;};'use strict';var _=require(_0x522d('0x0'));var md5=require(_0x522d('0x1'));var util=require(_0x522d('0x2'));var Redis=require(_0x522d('0x3'));var config=require('../../../config/environment');config[_0x522d('0x4')]=_['defaults'](config[_0x522d('0x4')],{'host':_0x522d('0x5'),'port':0x18eb});var io=require(_0x522d('0x6'))(new Redis(config['redis']));function MailQueue(_0x4bdc85){this['id']=_0x4bdc85['id']||0x0;this[_0x522d('0x7')]=_0x4bdc85[_0x522d('0x7')]||'';this[_0x522d('0x8')]=_0x4bdc85['timeout']||0xa;this['strategy']=_0x4bdc85['strategy']||_0x522d('0x9');this[_0x522d('0xa')]=_0x4bdc85['Agents'];this[_0x522d('0xb')]={};this[_0x522d('0xc')]=0x0;this[_0x522d('0x1')]='';this[_0x522d('0xd')]();this['updateRealtime']();}MailQueue[_0x522d('0xe')][_0x522d('0xd')]=function(){var _0x1aa447=this['mapAgentsId'][_0x522d('0xf')];this[_0x522d('0xb')]=_[_0x522d('0x10')](this['Agents'],'id');this[_0x522d('0xb')][_0x522d('0xf')]=_0x1aa447;};MailQueue[_0x522d('0xe')]['updateRealtime']=function(){this[_0x522d('0x11')]=0x0;this[_0x522d('0x12')]=0x0;for(var _0x563631=0x0;_0x563631=0x0?this['available']:0x0;var _0x41b9ff={'id':this['id'],'available':this[_0x522d('0x16')],'loggedIn':this[_0x522d('0x11')],'name':this[_0x522d('0x7')],'paused':this[_0x522d('0x12')],'waiting':this[_0x522d('0xc')]};var _0x75831b=md5(JSON[_0x522d('0x17')](_0x41b9ff));if(this[_0x522d('0x1')]!==_0x75831b){this[_0x522d('0x1')]=_0x75831b;io['to'](util[_0x522d('0x18')](_0x522d('0x19'),_0x41b9ff['name']))[_0x522d('0x1a')]('mail_queue:save',_0x41b9ff);}};module[_0x522d('0x1b')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index 6390d7c..664e614 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 _0x390b=['socket.io-emitter','redis','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','map','loggedIn','length','online','openchannelPause','paused','available','name','stringify','format','openchannel:queue:%s','exports','lodash','md5','util','ioredis','../../../config/environment'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x390b,0xf7));var _0xb390=function(_0x246c42,_0x251653){_0x246c42=_0x246c42-0x0;var _0x190b1d=_0x390b[_0x246c42];return _0x190b1d;};'use strict';var _=require(_0xb390('0x0'));var md5=require(_0xb390('0x1'));var util=require(_0xb390('0x2'));var Redis=require(_0xb390('0x3'));var config=require(_0xb390('0x4'));config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xb390('0x5'))(new Redis(config[_0xb390('0x6')]));function OpenchannelQueue(_0x2d8782){this['id']=_0x2d8782['id']||0x0;this['name']=_0x2d8782['name']||'';this['timeout']=_0x2d8782[_0xb390('0x7')]||0xa;this[_0xb390('0x8')]=_0x2d8782['strategy']||_0xb390('0x9');this[_0xb390('0xa')]=_0x2d8782[_0xb390('0xa')];this[_0xb390('0xb')]={};this[_0xb390('0xc')]=0x0;this['md5']='';this[_0xb390('0xd')]();this[_0xb390('0xe')]();}OpenchannelQueue[_0xb390('0xf')][_0xb390('0xd')]=function(){var _0x3dd523=this['mapAgentsId']['_rr'];this[_0xb390('0xb')]=_[_0xb390('0x10')](this[_0xb390('0xa')],'id');this[_0xb390('0xb')]['_rr']=_0x3dd523;};OpenchannelQueue['prototype'][_0xb390('0xe')]=function(){this[_0xb390('0x11')]=0x0;this['paused']=0x0;for(var _0x3b50ee=0x0;_0x3b50ee=0x0?this[_0xb390('0x16')]:0x0;var _0x5de504={'id':this['id'],'available':this[_0xb390('0x16')],'loggedIn':this[_0xb390('0x11')],'name':this[_0xb390('0x17')],'paused':this['paused'],'waiting':this['waiting']};var _0x5c6b9a=md5(JSON[_0xb390('0x18')](_0x5de504));if(this[_0xb390('0x1')]!==_0x5c6b9a){this[_0xb390('0x1')]=_0x5c6b9a;io['to'](util[_0xb390('0x19')](_0xb390('0x1a'),_0x5de504[_0xb390('0x17')]))['emit']('openchannel_queue:save',_0x5de504);}};module[_0xb390('0x1b')]=OpenchannelQueue; \ No newline at end of file +var _0x6321=['name','timeout','strategy','beepall','Agents','waiting','prototype','updateRouting','mapAgentsId','_rr','loggedIn','paused','online','openchannelPause','available','stringify','format','openchannel:queue:%s','emit','exports','lodash','md5','util','ioredis','redis','defaults','socket.io-emitter'];(function(_0x44fd81,_0x4003db){var _0x32d50c=function(_0x41ab3e){while(--_0x41ab3e){_0x44fd81['push'](_0x44fd81['shift']());}};_0x32d50c(++_0x4003db);}(_0x6321,0xb6));var _0x1632=function(_0x3adcc,_0x39ca25){_0x3adcc=_0x3adcc-0x0;var _0x119615=_0x6321[_0x3adcc];return _0x119615;};'use strict';var _=require(_0x1632('0x0'));var md5=require(_0x1632('0x1'));var util=require(_0x1632('0x2'));var Redis=require(_0x1632('0x3'));var config=require('../../../config/environment');config[_0x1632('0x4')]=_[_0x1632('0x5')](config[_0x1632('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x1632('0x6'))(new Redis(config[_0x1632('0x4')]));function OpenchannelQueue(_0x160348){this['id']=_0x160348['id']||0x0;this[_0x1632('0x7')]=_0x160348[_0x1632('0x7')]||'';this[_0x1632('0x8')]=_0x160348[_0x1632('0x8')]||0xa;this[_0x1632('0x9')]=_0x160348[_0x1632('0x9')]||_0x1632('0xa');this[_0x1632('0xb')]=_0x160348[_0x1632('0xb')];this['mapAgentsId']={};this[_0x1632('0xc')]=0x0;this['md5']='';this['updateRouting']();this['updateRealtime']();}OpenchannelQueue[_0x1632('0xd')][_0x1632('0xe')]=function(){var _0x8310c0=this[_0x1632('0xf')][_0x1632('0x10')];this['mapAgentsId']=_['map'](this[_0x1632('0xb')],'id');this[_0x1632('0xf')][_0x1632('0x10')]=_0x8310c0;};OpenchannelQueue[_0x1632('0xd')]['updateRealtime']=function(){this[_0x1632('0x11')]=0x0;this[_0x1632('0x12')]=0x0;for(var _0x1dc076=0x0;_0x1dc076=0x0?this['available']:0x0;var _0x5442c7={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0x1632('0x7')],'paused':this[_0x1632('0x12')],'waiting':this[_0x1632('0xc')]};var _0xd6eab4=md5(JSON[_0x1632('0x16')](_0x5442c7));if(this[_0x1632('0x1')]!==_0xd6eab4){this['md5']=_0xd6eab4;io['to'](util[_0x1632('0x17')](_0x1632('0x18'),_0x5442c7[_0x1632('0x7')]))[_0x1632('0x19')]('openchannel_queue:save',_0x5442c7);}};module[_0x1632('0x1a')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index ce302ef..f689d8d 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 _0xb10b=['length','online','loggedIn','smsPause','available','stringify','format','sms:queue:%s','emit','sms_queue:save','lodash','util','ioredis','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','prototype','updateRouting','_rr','map','updateRealtime','paused'];(function(_0x30033a,_0x5ce4a6){var _0x5e3518=function(_0x11494a){while(--_0x11494a){_0x30033a['push'](_0x30033a['shift']());}};_0x5e3518(++_0x5ce4a6);}(_0xb10b,0x12a));var _0xbb10=function(_0x4a94d0,_0x374e5d){_0x4a94d0=_0x4a94d0-0x0;var _0x50128a=_0xb10b[_0x4a94d0];return _0x50128a;};'use strict';var _=require(_0xbb10('0x0'));var md5=require('md5');var util=require(_0xbb10('0x1'));var Redis=require(_0xbb10('0x2'));var config=require(_0xbb10('0x3'));config['redis']=_[_0xbb10('0x4')](config[_0xbb10('0x5')],{'host':_0xbb10('0x6'),'port':0x18eb});var io=require(_0xbb10('0x7'))(new Redis(config[_0xbb10('0x5')]));function SmsQueue(_0x312b72){this['id']=_0x312b72['id']||0x0;this['name']=_0x312b72[_0xbb10('0x8')]||'';this[_0xbb10('0x9')]=_0x312b72['timeout']||0xa;this[_0xbb10('0xa')]=_0x312b72[_0xbb10('0xa')]||_0xbb10('0xb');this[_0xbb10('0xc')]=_0x312b72[_0xbb10('0xc')];this[_0xbb10('0xd')]={};this[_0xbb10('0xe')]=0x0;this[_0xbb10('0xf')]='';this['updateRouting']();this['updateRealtime']();}SmsQueue[_0xbb10('0x10')][_0xbb10('0x11')]=function(){var _0xce64f3=this['mapAgentsId'][_0xbb10('0x12')];this['mapAgentsId']=_[_0xbb10('0x13')](this[_0xbb10('0xc')],'id');this[_0xbb10('0xd')][_0xbb10('0x12')]=_0xce64f3;};SmsQueue[_0xbb10('0x10')][_0xbb10('0x14')]=function(){this['loggedIn']=0x0;this[_0xbb10('0x15')]=0x0;for(var _0x42d7e4=0x0;_0x42d7e4=0x0?this[_0xbb10('0x1a')]:0x0;var _0x1682a4={'id':this['id'],'available':this[_0xbb10('0x1a')],'loggedIn':this[_0xbb10('0x18')],'name':this[_0xbb10('0x8')],'paused':this[_0xbb10('0x15')],'waiting':this['waiting']};var _0x5ff0cf=md5(JSON[_0xbb10('0x1b')](_0x1682a4));if(this[_0xbb10('0xf')]!==_0x5ff0cf){this[_0xbb10('0xf')]=_0x5ff0cf;io['to'](util[_0xbb10('0x1c')](_0xbb10('0x1d'),_0x1682a4['name']))[_0xbb10('0x1e')](_0xbb10('0x1f'),_0x1682a4);}};module['exports']=SmsQueue; \ No newline at end of file +var _0x0713=['smsPause','paused','available','stringify','sms:queue:%s','emit','sms_queue:save','exports','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','md5','updateRouting','updateRealtime','prototype','mapAgentsId','_rr','map','loggedIn','length','online'];(function(_0x2f0dae,_0x1fcb1d){var _0x508d97=function(_0x208dc3){while(--_0x208dc3){_0x2f0dae['push'](_0x2f0dae['shift']());}};_0x508d97(++_0x1fcb1d);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var md5=require('md5');var util=require(_0x3071('0x0'));var Redis=require(_0x3071('0x1'));var config=require(_0x3071('0x2'));config[_0x3071('0x3')]=_[_0x3071('0x4')](config['redis'],{'host':_0x3071('0x5'),'port':0x18eb});var io=require(_0x3071('0x6'))(new Redis(config[_0x3071('0x3')]));function SmsQueue(_0x3137c8){this['id']=_0x3137c8['id']||0x0;this[_0x3071('0x7')]=_0x3137c8[_0x3071('0x7')]||'';this[_0x3071('0x8')]=_0x3137c8[_0x3071('0x8')]||0xa;this[_0x3071('0x9')]=_0x3137c8[_0x3071('0x9')]||_0x3071('0xa');this[_0x3071('0xb')]=_0x3137c8[_0x3071('0xb')];this['mapAgentsId']={};this[_0x3071('0xc')]=0x0;this[_0x3071('0xd')]='';this[_0x3071('0xe')]();this[_0x3071('0xf')]();}SmsQueue[_0x3071('0x10')]['updateRouting']=function(){var _0x2ace21=this[_0x3071('0x11')][_0x3071('0x12')];this[_0x3071('0x11')]=_[_0x3071('0x13')](this['Agents'],'id');this['mapAgentsId'][_0x3071('0x12')]=_0x2ace21;};SmsQueue['prototype'][_0x3071('0xf')]=function(){this[_0x3071('0x14')]=0x0;this['paused']=0x0;for(var _0x104e73=0x0;_0x104e73=0x0?this[_0x3071('0x19')]:0x0;var _0x1068d9={'id':this['id'],'available':this[_0x3071('0x19')],'loggedIn':this[_0x3071('0x14')],'name':this[_0x3071('0x7')],'paused':this[_0x3071('0x18')],'waiting':this[_0x3071('0xc')]};var _0x502a16=md5(JSON[_0x3071('0x1a')](_0x1068d9));if(this[_0x3071('0xd')]!==_0x502a16){this[_0x3071('0xd')]=_0x502a16;io['to'](util['format'](_0x3071('0x1b'),_0x1068d9['name']))[_0x3071('0x1c')](_0x3071('0x1d'),_0x1068d9);}};module[_0x3071('0x1e')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index 628b14b..8afe329 100644 --- a/server/services/routing/model/whatsappQueue.js +++ b/server/services/routing/model/whatsappQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3339=['name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','prototype','_rr','map','updateRealtime','loggedIn','paused','length','online','whatsappPause','available','md5','format','whatsapp:queue:%s','emit','whatsapp_queue:save','lodash','util','ioredis','redis','defaults','localhost','socket.io-emitter'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3339,0xcb));var _0x9333=function(_0x26037a,_0x108f0d){_0x26037a=_0x26037a-0x0;var _0x53d1d0=_0x3339[_0x26037a];return _0x53d1d0;};'use strict';var _=require(_0x9333('0x0'));var md5=require('md5');var util=require(_0x9333('0x1'));var Redis=require(_0x9333('0x2'));var config=require('../../../config/environment');config[_0x9333('0x3')]=_[_0x9333('0x4')](config[_0x9333('0x3')],{'host':_0x9333('0x5'),'port':0x18eb});var io=require(_0x9333('0x6'))(new Redis(config[_0x9333('0x3')]));function WhatsappQueue(_0x5690ea){this['id']=_0x5690ea['id']||0x0;this[_0x9333('0x7')]=_0x5690ea[_0x9333('0x7')]||'';this[_0x9333('0x8')]=_0x5690ea['timeout']||0xa;this['strategy']=_0x5690ea[_0x9333('0x9')]||_0x9333('0xa');this[_0x9333('0xb')]=_0x5690ea['Agents'];this[_0x9333('0xc')]={};this[_0x9333('0xd')]=0x0;this['md5']='';this[_0x9333('0xe')]();this['updateRealtime']();}WhatsappQueue[_0x9333('0xf')]['updateRouting']=function(){var _0x14efb0=this[_0x9333('0xc')][_0x9333('0x10')];this['mapAgentsId']=_[_0x9333('0x11')](this[_0x9333('0xb')],'id');this[_0x9333('0xc')][_0x9333('0x10')]=_0x14efb0;};WhatsappQueue[_0x9333('0xf')][_0x9333('0x12')]=function(){this[_0x9333('0x13')]=0x0;this[_0x9333('0x14')]=0x0;for(var _0x2e9506=0x0;_0x2e9506=0x0?this[_0x9333('0x18')]:0x0;var _0xd50aa7={'id':this['id'],'available':this[_0x9333('0x18')],'loggedIn':this[_0x9333('0x13')],'name':this[_0x9333('0x7')],'paused':this[_0x9333('0x14')],'waiting':this['waiting']};var _0x461cb2=md5(JSON['stringify'](_0xd50aa7));if(this['md5']!==_0x461cb2){this[_0x9333('0x19')]=_0x461cb2;io['to'](util[_0x9333('0x1a')](_0x9333('0x1b'),_0xd50aa7['name']))[_0x9333('0x1c')](_0x9333('0x1d'),_0xd50aa7);}};module['exports']=WhatsappQueue; \ No newline at end of file +var _0x2882=['mapAgentsId','updateRouting','updateRealtime','prototype','map','_rr','paused','length','loggedIn','available','stringify','emit','whatsapp_queue:save','lodash','md5','util','ioredis','../../../config/environment','defaults','redis','socket.io-emitter','name','timeout','strategy','beepall','Agents'];(function(_0x45d55e,_0x2fede3){var _0x29812a=function(_0x3c6830){while(--_0x3c6830){_0x45d55e['push'](_0x45d55e['shift']());}};_0x29812a(++_0x2fede3);}(_0x2882,0x1e1));var _0x2288=function(_0x161bf7,_0x206b80){_0x161bf7=_0x161bf7-0x0;var _0x14ac58=_0x2882[_0x161bf7];return _0x14ac58;};'use strict';var _=require(_0x2288('0x0'));var md5=require(_0x2288('0x1'));var util=require(_0x2288('0x2'));var Redis=require(_0x2288('0x3'));var config=require(_0x2288('0x4'));config['redis']=_[_0x2288('0x5')](config[_0x2288('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x2288('0x7'))(new Redis(config['redis']));function WhatsappQueue(_0x70ca61){this['id']=_0x70ca61['id']||0x0;this[_0x2288('0x8')]=_0x70ca61[_0x2288('0x8')]||'';this[_0x2288('0x9')]=_0x70ca61[_0x2288('0x9')]||0xa;this['strategy']=_0x70ca61[_0x2288('0xa')]||_0x2288('0xb');this['Agents']=_0x70ca61[_0x2288('0xc')];this[_0x2288('0xd')]={};this['waiting']=0x0;this['md5']='';this[_0x2288('0xe')]();this[_0x2288('0xf')]();}WhatsappQueue[_0x2288('0x10')][_0x2288('0xe')]=function(){var _0x290562=this[_0x2288('0xd')]['_rr'];this['mapAgentsId']=_[_0x2288('0x11')](this[_0x2288('0xc')],'id');this[_0x2288('0xd')][_0x2288('0x12')]=_0x290562;};WhatsappQueue[_0x2288('0x10')][_0x2288('0xf')]=function(){this['loggedIn']=0x0;this[_0x2288('0x13')]=0x0;for(var _0x505d48=0x0;_0x505d48=0x0?this[_0x2288('0x16')]:0x0;var _0x5ce5f0={'id':this['id'],'available':this[_0x2288('0x16')],'loggedIn':this[_0x2288('0x15')],'name':this[_0x2288('0x8')],'paused':this[_0x2288('0x13')],'waiting':this['waiting']};var _0x39c663=md5(JSON[_0x2288('0x17')](_0x5ce5f0));if(this[_0x2288('0x1')]!==_0x39c663){this['md5']=_0x39c663;io['to'](util['format']('whatsapp:queue:%s',_0x5ce5f0['name']))[_0x2288('0x18')](_0x2288('0x19'),_0x5ce5f0);}};module['exports']=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index 0f45678..38ae0fa 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 _0xb9b5=['../model/agent','../model/interval','../model/openchannelQueue','../model/chatQueue','../model/smsQueue','../model/mailQueue','agents','intervals','openchannelQueues','smsQueues','mailQueues','faxQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','faxQueuesWaitingInteractions','mapKeys','hasOwnProperty','mergeFromDatabase','length','isUndefined','prototype','initIntervals','initOpenchannelQueues','updateRouting','updateRealtime','initChatQueues','chatQueues','initMailQueues','initFaxQueues','exports','bluebird','util','lodash','moment'];(function(_0x3a55a1,_0x1b284d){var _0x5c605b=function(_0x55f48b){while(--_0x55f48b){_0x3a55a1['push'](_0x3a55a1['shift']());}};_0x5c605b(++_0x1b284d);}(_0xb9b5,0x1c3));var _0x5b9b=function(_0x3fd3a3,_0x36c863){_0x3fd3a3=_0x3fd3a3-0x0;var _0xa3e4d5=_0xb9b5[_0x3fd3a3];return _0xa3e4d5;};'use strict';var BPromise=require(_0x5b9b('0x0'));var util=require(_0x5b9b('0x1'));var _=require(_0x5b9b('0x2'));var moment=require(_0x5b9b('0x3'));var Agent=require(_0x5b9b('0x4'));var Interval=require(_0x5b9b('0x5'));var OpenchannelQueue=require(_0x5b9b('0x6'));var ChatQueue=require(_0x5b9b('0x7'));var SmsQueue=require(_0x5b9b('0x8'));var MailQueue=require(_0x5b9b('0x9'));var FaxQueue=require('../model/faxQueue');var Realtime=function(){this[_0x5b9b('0xa')]={};this[_0x5b9b('0xb')]={};this[_0x5b9b('0xc')]={};this['chatQueues']={};this[_0x5b9b('0xd')]={};this[_0x5b9b('0xe')]={};this[_0x5b9b('0xf')]={};this[_0x5b9b('0x10')]={};this[_0x5b9b('0x11')]={};this[_0x5b9b('0x12')]={};this['smsQueuesWaitingInteractions']={};this[_0x5b9b('0x13')]={};};function freeIsNotKey(_0x399252,_0x1ac64b,_0x412445){var _0x1b1ff1=_[_0x5b9b('0x14')](_0x399252,function(_0x57611c,_0x14150f){return _0x57611c[_0x412445];});for(var _0x16fa25 in _0x1ac64b){if(_0x1ac64b[_0x5b9b('0x15')](_0x16fa25)){if(!_0x1b1ff1[_0x16fa25]){delete _0x1ac64b[_0x16fa25];}}}}Realtime['prototype'][_0x5b9b('0x16')]=function(_0x2328b9,_0x1bd299){for(var _0x1b8b8c in _0x1bd299){if(_0x2328b9[_0x5b9b('0x15')](_0x1b8b8c)){_0x2328b9[_0x1b8b8c]=_0x1bd299[_0x1b8b8c];}}};Realtime['prototype']['initAgents']=function(){var _0x3f4268=this;return function(_0x120039){if(_0x120039){freeIsNotKey(_0x120039,_0x3f4268[_0x5b9b('0xa')],'id');for(var _0x168d7a=0x0,_0x31b1d1={},_0x2e3468={};_0x168d7a<_0x120039[_0x5b9b('0x17')];_0x168d7a+=0x1){_0x31b1d1=_0x120039[_0x168d7a];if(_[_0x5b9b('0x18')](_0x3f4268[_0x5b9b('0xa')][_0x31b1d1['id']])){_0x3f4268['agents'][_0x31b1d1['id']]=new Agent(_0x31b1d1);}else{_0x3f4268[_0x5b9b('0x16')](_0x3f4268['agents'][_0x31b1d1['id']],_0x31b1d1);}}}return _0x3f4268[_0x5b9b('0xa')];};};Realtime[_0x5b9b('0x19')][_0x5b9b('0x1a')]=function(){var _0x502337=this;return function(_0x28a869){if(_0x28a869){freeIsNotKey(_0x28a869,_0x502337[_0x5b9b('0xb')],'id');for(var _0x4b87d4=0x0,_0x43c8f5={},_0x6cbc2f={};_0x4b87d4<_0x28a869[_0x5b9b('0x17')];_0x4b87d4+=0x1){_0x43c8f5=_0x28a869[_0x4b87d4];if(_[_0x5b9b('0x18')](_0x502337[_0x5b9b('0xb')][_0x43c8f5['id']])){_0x502337[_0x5b9b('0xb')][_0x43c8f5['id']]=new Interval(_0x43c8f5);}else{_0x502337[_0x5b9b('0x16')](_0x502337[_0x5b9b('0xb')][_0x43c8f5['id']],_0x43c8f5);}}}return _0x502337[_0x5b9b('0xb')];};};Realtime[_0x5b9b('0x19')][_0x5b9b('0x1b')]=function(){var _0x3b238f=this;return function(_0x18fd42){if(_0x18fd42){freeIsNotKey(_0x18fd42,_0x3b238f[_0x5b9b('0xc')],'id');for(var _0x38aba1=0x0,_0x22f648={},_0x131e41={};_0x38aba1<_0x18fd42[_0x5b9b('0x17')];_0x38aba1+=0x1){_0x22f648=_0x18fd42[_0x38aba1];if(_[_0x5b9b('0x18')](_0x3b238f[_0x5b9b('0xc')][_0x22f648['id']])){_0x3b238f['openchannelQueues'][_0x22f648['id']]=new OpenchannelQueue(_0x22f648);}else{_0x3b238f[_0x5b9b('0x16')](_0x3b238f[_0x5b9b('0xc')][_0x22f648['id']],_0x22f648);}_0x3b238f['openchannelQueues'][_0x22f648['id']][_0x5b9b('0x1c')]();_0x3b238f[_0x5b9b('0xc')][_0x22f648['id']][_0x5b9b('0x1d')]();}}return _0x3b238f[_0x5b9b('0xc')];};};Realtime['prototype'][_0x5b9b('0x1e')]=function(){var _0x37ccbe=this;return function(_0x2816d8){if(_0x2816d8){freeIsNotKey(_0x2816d8,_0x37ccbe[_0x5b9b('0x1f')],'id');for(var _0x3281bb=0x0,_0x4617d1={},_0xa1bca1={};_0x3281bb<_0x2816d8[_0x5b9b('0x17')];_0x3281bb+=0x1){_0x4617d1=_0x2816d8[_0x3281bb];if(_[_0x5b9b('0x18')](_0x37ccbe[_0x5b9b('0x1f')][_0x4617d1['id']])){_0x37ccbe[_0x5b9b('0x1f')][_0x4617d1['id']]=new ChatQueue(_0x4617d1);}else{_0x37ccbe['mergeFromDatabase'](_0x37ccbe[_0x5b9b('0x1f')][_0x4617d1['id']],_0x4617d1);}_0x37ccbe[_0x5b9b('0x1f')][_0x4617d1['id']][_0x5b9b('0x1c')]();_0x37ccbe[_0x5b9b('0x1f')][_0x4617d1['id']]['updateRealtime']();}}return _0x37ccbe[_0x5b9b('0x1f')];};};Realtime[_0x5b9b('0x19')]['initSmsQueues']=function(){var _0x95a508=this;return function(_0x551b69){if(_0x551b69){freeIsNotKey(_0x551b69,_0x95a508[_0x5b9b('0xd')],'id');for(var _0x5defbe=0x0,_0x5279d1={},_0x5ea215={};_0x5defbe<_0x551b69[_0x5b9b('0x17')];_0x5defbe+=0x1){_0x5279d1=_0x551b69[_0x5defbe];if(_[_0x5b9b('0x18')](_0x95a508['smsQueues'][_0x5279d1['id']])){_0x95a508[_0x5b9b('0xd')][_0x5279d1['id']]=new SmsQueue(_0x5279d1);}else{_0x95a508[_0x5b9b('0x16')](_0x95a508[_0x5b9b('0xd')][_0x5279d1['id']],_0x5279d1);}_0x95a508[_0x5b9b('0xd')][_0x5279d1['id']][_0x5b9b('0x1c')]();_0x95a508[_0x5b9b('0xd')][_0x5279d1['id']][_0x5b9b('0x1d')]();}}return _0x95a508[_0x5b9b('0xd')];};};Realtime[_0x5b9b('0x19')][_0x5b9b('0x20')]=function(){var _0x1c6542=this;return function(_0x10404e){if(_0x10404e){freeIsNotKey(_0x10404e,_0x1c6542[_0x5b9b('0xe')],'id');for(var _0x53d105=0x0,_0x1d3930={},_0x7db1da={};_0x53d105<_0x10404e[_0x5b9b('0x17')];_0x53d105+=0x1){_0x1d3930=_0x10404e[_0x53d105];if(_[_0x5b9b('0x18')](_0x1c6542[_0x5b9b('0xe')][_0x1d3930['id']])){_0x1c6542[_0x5b9b('0xe')][_0x1d3930['id']]=new MailQueue(_0x1d3930);}else{_0x1c6542[_0x5b9b('0x16')](_0x1c6542['mailQueues'][_0x1d3930['id']],_0x1d3930);}_0x1c6542[_0x5b9b('0xe')][_0x1d3930['id']]['updateRouting']();_0x1c6542[_0x5b9b('0xe')][_0x1d3930['id']][_0x5b9b('0x1d')]();}}return _0x1c6542[_0x5b9b('0xe')];};};Realtime[_0x5b9b('0x19')][_0x5b9b('0x21')]=function(){var _0x174f28=this;return function(_0x106692){if(_0x106692){freeIsNotKey(_0x106692,_0x174f28[_0x5b9b('0xf')],'id');for(var _0x2551c9=0x0,_0x556b03={},_0x4a5bd1={};_0x2551c9<_0x106692['length'];_0x2551c9+=0x1){_0x556b03=_0x106692[_0x2551c9];if(_[_0x5b9b('0x18')](_0x174f28[_0x5b9b('0xf')][_0x556b03['id']])){_0x174f28[_0x5b9b('0xf')][_0x556b03['id']]=new FaxQueue(_0x556b03);}else{_0x174f28['mergeFromDatabase'](_0x174f28['faxQueues'][_0x556b03['id']],_0x556b03);}_0x174f28[_0x5b9b('0xf')][_0x556b03['id']]['updateRouting']();_0x174f28[_0x5b9b('0xf')][_0x556b03['id']][_0x5b9b('0x1d')]();}}return _0x174f28[_0x5b9b('0xf')];};};module[_0x5b9b('0x22')]=Realtime; \ No newline at end of file +var _0x5f2c=['initAgents','length','isUndefined','initIntervals','mergeFromDatabase','updateRouting','updateRealtime','chatQueues','initSmsQueues','initFaxQueues','exports','util','lodash','moment','../model/interval','../model/openchannelQueue','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','agents','intervals','openchannelQueues','smsQueues','mailQueues','faxQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','mapKeys','hasOwnProperty','prototype'];(function(_0x141c05,_0x319076){var _0x25fa28=function(_0x56f1c0){while(--_0x56f1c0){_0x141c05['push'](_0x141c05['shift']());}};_0x25fa28(++_0x319076);}(_0x5f2c,0x15f));var _0xc5f2=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x5f2c[_0x126558];return _0x1f6d14;};'use strict';var BPromise=require('bluebird');var util=require(_0xc5f2('0x0'));var _=require(_0xc5f2('0x1'));var moment=require(_0xc5f2('0x2'));var Agent=require('../model/agent');var Interval=require(_0xc5f2('0x3'));var OpenchannelQueue=require(_0xc5f2('0x4'));var ChatQueue=require(_0xc5f2('0x5'));var SmsQueue=require(_0xc5f2('0x6'));var MailQueue=require(_0xc5f2('0x7'));var FaxQueue=require(_0xc5f2('0x8'));var Realtime=function(){this[_0xc5f2('0x9')]={};this[_0xc5f2('0xa')]={};this[_0xc5f2('0xb')]={};this['chatQueues']={};this[_0xc5f2('0xc')]={};this[_0xc5f2('0xd')]={};this[_0xc5f2('0xe')]={};this[_0xc5f2('0xf')]={};this[_0xc5f2('0x10')]={};this[_0xc5f2('0x11')]={};this[_0xc5f2('0x12')]={};this[_0xc5f2('0x13')]={};};function freeIsNotKey(_0x2b747e,_0x46e17f,_0xf5c71b){var _0x110003=_[_0xc5f2('0x14')](_0x2b747e,function(_0x480c8f,_0x53bf7a){return _0x480c8f[_0xf5c71b];});for(var _0x1bde4a in _0x46e17f){if(_0x46e17f[_0xc5f2('0x15')](_0x1bde4a)){if(!_0x110003[_0x1bde4a]){delete _0x46e17f[_0x1bde4a];}}}}Realtime[_0xc5f2('0x16')]['mergeFromDatabase']=function(_0x319e61,_0x566ed9){for(var _0x43d974 in _0x566ed9){if(_0x319e61[_0xc5f2('0x15')](_0x43d974)){_0x319e61[_0x43d974]=_0x566ed9[_0x43d974];}}};Realtime[_0xc5f2('0x16')][_0xc5f2('0x17')]=function(){var _0x2a1c05=this;return function(_0x4a9b6c){if(_0x4a9b6c){freeIsNotKey(_0x4a9b6c,_0x2a1c05[_0xc5f2('0x9')],'id');for(var _0x2037cb=0x0,_0x3710e8={},_0xf54b7b={};_0x2037cb<_0x4a9b6c[_0xc5f2('0x18')];_0x2037cb+=0x1){_0x3710e8=_0x4a9b6c[_0x2037cb];if(_[_0xc5f2('0x19')](_0x2a1c05['agents'][_0x3710e8['id']])){_0x2a1c05[_0xc5f2('0x9')][_0x3710e8['id']]=new Agent(_0x3710e8);}else{_0x2a1c05['mergeFromDatabase'](_0x2a1c05[_0xc5f2('0x9')][_0x3710e8['id']],_0x3710e8);}}}return _0x2a1c05[_0xc5f2('0x9')];};};Realtime[_0xc5f2('0x16')][_0xc5f2('0x1a')]=function(){var _0x5e5bb7=this;return function(_0x4e1627){if(_0x4e1627){freeIsNotKey(_0x4e1627,_0x5e5bb7[_0xc5f2('0xa')],'id');for(var _0x34674f=0x0,_0xc65642={},_0x19a333={};_0x34674f<_0x4e1627[_0xc5f2('0x18')];_0x34674f+=0x1){_0xc65642=_0x4e1627[_0x34674f];if(_['isUndefined'](_0x5e5bb7[_0xc5f2('0xa')][_0xc65642['id']])){_0x5e5bb7['intervals'][_0xc65642['id']]=new Interval(_0xc65642);}else{_0x5e5bb7[_0xc5f2('0x1b')](_0x5e5bb7[_0xc5f2('0xa')][_0xc65642['id']],_0xc65642);}}}return _0x5e5bb7[_0xc5f2('0xa')];};};Realtime[_0xc5f2('0x16')]['initOpenchannelQueues']=function(){var _0x5d72d1=this;return function(_0xbc002d){if(_0xbc002d){freeIsNotKey(_0xbc002d,_0x5d72d1[_0xc5f2('0xb')],'id');for(var _0x4a7c79=0x0,_0x5e04f5={},_0x11ea6b={};_0x4a7c79<_0xbc002d[_0xc5f2('0x18')];_0x4a7c79+=0x1){_0x5e04f5=_0xbc002d[_0x4a7c79];if(_['isUndefined'](_0x5d72d1[_0xc5f2('0xb')][_0x5e04f5['id']])){_0x5d72d1[_0xc5f2('0xb')][_0x5e04f5['id']]=new OpenchannelQueue(_0x5e04f5);}else{_0x5d72d1[_0xc5f2('0x1b')](_0x5d72d1['openchannelQueues'][_0x5e04f5['id']],_0x5e04f5);}_0x5d72d1[_0xc5f2('0xb')][_0x5e04f5['id']][_0xc5f2('0x1c')]();_0x5d72d1[_0xc5f2('0xb')][_0x5e04f5['id']][_0xc5f2('0x1d')]();}}return _0x5d72d1[_0xc5f2('0xb')];};};Realtime[_0xc5f2('0x16')]['initChatQueues']=function(){var _0xeac50d=this;return function(_0x454e0c){if(_0x454e0c){freeIsNotKey(_0x454e0c,_0xeac50d['chatQueues'],'id');for(var _0x55c878=0x0,_0x46886e={},_0x1bbc0b={};_0x55c878<_0x454e0c[_0xc5f2('0x18')];_0x55c878+=0x1){_0x46886e=_0x454e0c[_0x55c878];if(_[_0xc5f2('0x19')](_0xeac50d[_0xc5f2('0x1e')][_0x46886e['id']])){_0xeac50d[_0xc5f2('0x1e')][_0x46886e['id']]=new ChatQueue(_0x46886e);}else{_0xeac50d['mergeFromDatabase'](_0xeac50d[_0xc5f2('0x1e')][_0x46886e['id']],_0x46886e);}_0xeac50d['chatQueues'][_0x46886e['id']][_0xc5f2('0x1c')]();_0xeac50d[_0xc5f2('0x1e')][_0x46886e['id']][_0xc5f2('0x1d')]();}}return _0xeac50d[_0xc5f2('0x1e')];};};Realtime['prototype'][_0xc5f2('0x1f')]=function(){var _0x3469bb=this;return function(_0x3619c7){if(_0x3619c7){freeIsNotKey(_0x3619c7,_0x3469bb[_0xc5f2('0xc')],'id');for(var _0x219df9=0x0,_0x4dc64a={},_0x48cbc3={};_0x219df9<_0x3619c7[_0xc5f2('0x18')];_0x219df9+=0x1){_0x4dc64a=_0x3619c7[_0x219df9];if(_['isUndefined'](_0x3469bb[_0xc5f2('0xc')][_0x4dc64a['id']])){_0x3469bb['smsQueues'][_0x4dc64a['id']]=new SmsQueue(_0x4dc64a);}else{_0x3469bb['mergeFromDatabase'](_0x3469bb[_0xc5f2('0xc')][_0x4dc64a['id']],_0x4dc64a);}_0x3469bb['smsQueues'][_0x4dc64a['id']][_0xc5f2('0x1c')]();_0x3469bb[_0xc5f2('0xc')][_0x4dc64a['id']][_0xc5f2('0x1d')]();}}return _0x3469bb[_0xc5f2('0xc')];};};Realtime[_0xc5f2('0x16')]['initMailQueues']=function(){var _0x3c46c0=this;return function(_0x3c98d9){if(_0x3c98d9){freeIsNotKey(_0x3c98d9,_0x3c46c0['mailQueues'],'id');for(var _0x4fda09=0x0,_0x120afd={},_0xb5418={};_0x4fda09<_0x3c98d9[_0xc5f2('0x18')];_0x4fda09+=0x1){_0x120afd=_0x3c98d9[_0x4fda09];if(_[_0xc5f2('0x19')](_0x3c46c0[_0xc5f2('0xd')][_0x120afd['id']])){_0x3c46c0[_0xc5f2('0xd')][_0x120afd['id']]=new MailQueue(_0x120afd);}else{_0x3c46c0[_0xc5f2('0x1b')](_0x3c46c0['mailQueues'][_0x120afd['id']],_0x120afd);}_0x3c46c0['mailQueues'][_0x120afd['id']][_0xc5f2('0x1c')]();_0x3c46c0[_0xc5f2('0xd')][_0x120afd['id']][_0xc5f2('0x1d')]();}}return _0x3c46c0['mailQueues'];};};Realtime[_0xc5f2('0x16')][_0xc5f2('0x20')]=function(){var _0x3a4ec5=this;return function(_0x410000){if(_0x410000){freeIsNotKey(_0x410000,_0x3a4ec5[_0xc5f2('0xe')],'id');for(var _0x4dab1c=0x0,_0x17d623={},_0x46232a={};_0x4dab1c<_0x410000[_0xc5f2('0x18')];_0x4dab1c+=0x1){_0x17d623=_0x410000[_0x4dab1c];if(_[_0xc5f2('0x19')](_0x3a4ec5[_0xc5f2('0xe')][_0x17d623['id']])){_0x3a4ec5[_0xc5f2('0xe')][_0x17d623['id']]=new FaxQueue(_0x17d623);}else{_0x3a4ec5[_0xc5f2('0x1b')](_0x3a4ec5[_0xc5f2('0xe')][_0x17d623['id']],_0x17d623);}_0x3a4ec5[_0xc5f2('0xe')][_0x17d623['id']][_0xc5f2('0x1c')]();_0x3a4ec5[_0xc5f2('0xe')][_0x17d623['id']][_0xc5f2('0x1d')]();}}return _0x3a4ec5[_0xc5f2('0xe')];};};module[_0xc5f2('0x21')]=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index 03d94e1..d3af7df 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 _0x75b9=['update','addTags','Request','addTagsToChatInteraction','../client'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0x75b9,0x108));var _0x975b=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x75b9[_0x321bb2];return _0x9c12ed;};'use strict';var client=require(_0x975b('0x0'));exports[_0x975b('0x1')]=function(_0x471947,_0x3d48fb){return client['Request']('UpdateChatInteraction',{'body':_0x3d48fb,'options':{'where':{'id':_0x471947}},'log':'updateChatInteraction'});};exports[_0x975b('0x2')]=function(_0x5ca52f,_0x5ba0d5){return client[_0x975b('0x3')]('AddTagsToChatInteraction',{'body':_0x5ba0d5,'options':{'where':{'id':_0x5ca52f}},'log':_0x975b('0x4')});}; \ No newline at end of file +var _0x9b46=['update','Request','UpdateChatInteraction','AddTagsToChatInteraction','addTagsToChatInteraction','../client'];(function(_0x1a4a49,_0xb4a484){var _0x1908b0=function(_0x2f527d){while(--_0x2f527d){_0x1a4a49['push'](_0x1a4a49['shift']());}};_0x1908b0(++_0xb4a484);}(_0x9b46,0x1c1));var _0x69b4=function(_0x560684,_0x4fe7fd){_0x560684=_0x560684-0x0;var _0x51ec93=_0x9b46[_0x560684];return _0x51ec93;};'use strict';var client=require(_0x69b4('0x0'));exports[_0x69b4('0x1')]=function(_0x521d3a,_0xa705e){return client[_0x69b4('0x2')](_0x69b4('0x3'),{'body':_0xa705e,'options':{'where':{'id':_0x521d3a}},'log':'updateChatInteraction'});};exports['addTags']=function(_0x2c67d7,_0x52d133){return client[_0x69b4('0x2')](_0x69b4('0x4'),{'body':_0x52d133,'options':{'where':{'id':_0x2c67d7}},'log':_0x69b4('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index 9ac6e05..de71295 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 _0x619f=['CreateChatMessage','createChatMessage','../client','Request'];(function(_0x56be45,_0x10cd0e){var _0x1b75d3=function(_0x314616){while(--_0x314616){_0x56be45['push'](_0x56be45['shift']());}};_0x1b75d3(++_0x10cd0e);}(_0x619f,0x176));var _0xf619=function(_0x36bf94,_0x4f208b){_0x36bf94=_0x36bf94-0x0;var _0x472a7e=_0x619f[_0x36bf94];return _0x472a7e;};'use strict';var client=require(_0xf619('0x0'));exports['create']=function(_0x1fa64e){return client[_0xf619('0x1')](_0xf619('0x2'),{'body':_0x1fa64e,'log':_0xf619('0x3')});}; \ No newline at end of file +var _0x47d0=['create','Request','CreateChatMessage','createChatMessage','../client'];(function(_0x25c090,_0x1c4184){var _0x37b693=function(_0x43e0a2){while(--_0x43e0a2){_0x25c090['push'](_0x25c090['shift']());}};_0x37b693(++_0x1c4184);}(_0x47d0,0xf9));var _0x047d=function(_0x4b5b18,_0x56eb51){_0x4b5b18=_0x4b5b18-0x0;var _0x4892e8=_0x47d0[_0x4b5b18];return _0x4892e8;};'use strict';var client=require(_0x047d('0x0'));exports[_0x047d('0x1')]=function(_0x350ff2){return client[_0x047d('0x2')](_0x047d('0x3'),{'body':_0x350ff2,'log':_0x047d('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index bee9a68..98cac4c 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 _0xb13d=['strategy','Agents','chatPause','../client','getChatQueues','Request','GetChatQueue','name','timeout'];(function(_0x879195,_0x96d988){var _0xefa735=function(_0x58b74f){while(--_0x58b74f){_0x879195['push'](_0x879195['shift']());}};_0xefa735(++_0x96d988);}(_0xb13d,0x1e0));var _0xdb13=function(_0x4d661d,_0x323a83){_0x4d661d=_0x4d661d-0x0;var _0x4f7d4d=_0xb13d[_0x4d661d];return _0x4f7d4d;};'use strict';var client=require(_0xdb13('0x0'));exports[_0xdb13('0x1')]=function(){return function(){return client[_0xdb13('0x2')](_0xdb13('0x3'),{'options':{'raw':![],'attributes':['id',_0xdb13('0x4'),_0xdb13('0x5'),_0xdb13('0x6')],'include':[{'model':'User','as':_0xdb13('0x7'),'attributes':['id','name','online',_0xdb13('0x8')]}]},'log':_0xdb13('0x1')});};}; \ No newline at end of file +var _0x3c7f=['name','strategy','User','online','chatPause','../client','getChatQueues','Request','GetChatQueue'];(function(_0x1d1814,_0x14d89e){var _0x43708b=function(_0x432ce4){while(--_0x432ce4){_0x1d1814['push'](_0x1d1814['shift']());}};_0x43708b(++_0x14d89e);}(_0x3c7f,0x71));var _0xf3c7=function(_0x2712d3,_0x313a41){_0x2712d3=_0x2712d3-0x0;var _0x379f1e=_0x3c7f[_0x2712d3];return _0x379f1e;};'use strict';var client=require(_0xf3c7('0x0'));exports[_0xf3c7('0x1')]=function(){return function(){return client[_0xf3c7('0x2')](_0xf3c7('0x3'),{'options':{'raw':![],'attributes':['id',_0xf3c7('0x4'),'timeout',_0xf3c7('0x5')],'include':[{'model':_0xf3c7('0x6'),'as':'Agents','attributes':['id',_0xf3c7('0x4'),_0xf3c7('0x7'),_0xf3c7('0x8')]}]},'log':'getChatQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index ff5fd0e..af091e1 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 _0xbc82=['../client','CreateChatQueueReport','UpdateChatQueueReport'];(function(_0xff3357,_0x3b4152){var _0x16d529=function(_0x38d7f7){while(--_0x38d7f7){_0xff3357['push'](_0xff3357['shift']());}};_0x16d529(++_0x3b4152);}(_0xbc82,0x13e));var _0x2bc8=function(_0x4fd360,_0x435775){_0x4fd360=_0x4fd360-0x0;var _0x5c93d7=_0xbc82[_0x4fd360];return _0x5c93d7;};'use strict';var client=require(_0x2bc8('0x0'));exports['create']=function(_0x5cd5de){return client['Request'](_0x2bc8('0x1'),{'body':_0x5cd5de,'log':'CreateChatQueueReport'});};exports['update']=function(_0x1320a5,_0x5c8329){return client['Request'](_0x2bc8('0x2'),{'body':_0x5c8329,'options':{'where':{'uniqueid':_0x1320a5},'order':[['id','DESC']],'limit':0x1},'log':'UpdateChatQueueReport'});}; \ No newline at end of file +var _0xdb4b=['Request','CreateChatQueueReport','update','UpdateChatQueueReport','DESC','create'];(function(_0x295205,_0x53c467){var _0x37a5ee=function(_0x4b8a88){while(--_0x4b8a88){_0x295205['push'](_0x295205['shift']());}};_0x37a5ee(++_0x53c467);}(_0xdb4b,0xd7));var _0xbdb4=function(_0x58ac34,_0x5b5bfb){_0x58ac34=_0x58ac34-0x0;var _0x3921ab=_0xdb4b[_0x58ac34];return _0x3921ab;};'use strict';var client=require('../client');exports[_0xbdb4('0x0')]=function(_0x5110a9){return client[_0xbdb4('0x1')](_0xbdb4('0x2'),{'body':_0x5110a9,'log':_0xbdb4('0x2')});};exports[_0xbdb4('0x3')]=function(_0x47a78c,_0x3cc8c2){return client[_0xbdb4('0x1')](_0xbdb4('0x4'),{'body':_0x3cc8c2,'options':{'where':{'uniqueid':_0x47a78c},'order':[['id',_0xbdb4('0x5')]],'limit':0x1},'log':_0xbdb4('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index b9d1ec6..434e20e 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 _0x0a48=['update','UpdateFaxInteraction','addTags','Request','AddTagsToFaxInteraction'];(function(_0x45f6cb,_0x531af6){var _0x5b7f93=function(_0x1296ba){while(--_0x1296ba){_0x45f6cb['push'](_0x45f6cb['shift']());}};_0x5b7f93(++_0x531af6);}(_0x0a48,0x1ae));var _0x80a4=function(_0x51543d,_0x204989){_0x51543d=_0x51543d-0x0;var _0x4a62cb=_0x0a48[_0x51543d];return _0x4a62cb;};'use strict';var client=require('../client');exports[_0x80a4('0x0')]=function(_0x1e2bea,_0x372bc3){return client['Request'](_0x80a4('0x1'),{'body':_0x372bc3,'options':{'where':{'id':_0x1e2bea}},'log':'updateFaxInteraction'});};exports[_0x80a4('0x2')]=function(_0x2cc8d1,_0x5632fe){return client[_0x80a4('0x3')](_0x80a4('0x4'),{'body':_0x5632fe,'options':{'where':{'id':_0x2cc8d1}},'log':'addTagsToFaxInteraction'});}; \ No newline at end of file +var _0x3221=['AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','update','updateFaxInteraction','addTags','Request'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x3221,0xe2));var _0x1322=function(_0x20f71f,_0x400188){_0x20f71f=_0x20f71f-0x0;var _0x32f58f=_0x3221[_0x20f71f];return _0x32f58f;};'use strict';var client=require(_0x1322('0x0'));exports[_0x1322('0x1')]=function(_0x535b05,_0x2b9f90){return client['Request']('UpdateFaxInteraction',{'body':_0x2b9f90,'options':{'where':{'id':_0x535b05}},'log':_0x1322('0x2')});};exports[_0x1322('0x3')]=function(_0x299367,_0x15f69b){return client[_0x1322('0x4')](_0x1322('0x5'),{'body':_0x15f69b,'options':{'where':{'id':_0x299367}},'log':_0x1322('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index 6bb4697..3ec05a9 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 _0x1ae4=['CreateFaxMessage','../client','create','Request'];(function(_0x32f193,_0x612afc){var _0x5bb92e=function(_0x555645){while(--_0x555645){_0x32f193['push'](_0x32f193['shift']());}};_0x5bb92e(++_0x612afc);}(_0x1ae4,0xa9));var _0x41ae=function(_0x1d49d5,_0xed4ffd){_0x1d49d5=_0x1d49d5-0x0;var _0x1c7a31=_0x1ae4[_0x1d49d5];return _0x1c7a31;};'use strict';var client=require(_0x41ae('0x0'));exports[_0x41ae('0x1')]=function(_0x5c346c){return client[_0x41ae('0x2')](_0x41ae('0x3'),{'body':_0x5c346c,'log':'createFaxMessage'});}; \ No newline at end of file +var _0x2fbb=['../client','create','Request','CreateFaxMessage'];(function(_0x2cdc2c,_0x591033){var _0x497bb5=function(_0x27f00c){while(--_0x27f00c){_0x2cdc2c['push'](_0x2cdc2c['shift']());}};_0x497bb5(++_0x591033);}(_0x2fbb,0x194));var _0xb2fb=function(_0xef615d,_0x361299){_0xef615d=_0xef615d-0x0;var _0x1a18bb=_0x2fbb[_0xef615d];return _0x1a18bb;};'use strict';var client=require(_0xb2fb('0x0'));exports[_0xb2fb('0x1')]=function(_0x5eb13c){return client[_0xb2fb('0x2')](_0xb2fb('0x3'),{'body':_0x5eb13c,'log':'createFaxMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index 3fcd43f..d247f15 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 _0x702f=['faxPause','../client','getFaxQueues','Request','GetFaxQueue','strategy','User','name','online'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x702f,0xf4));var _0xf702=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x702f[_0x2641f9];return _0x585741;};'use strict';var client=require(_0xf702('0x0'));exports[_0xf702('0x1')]=function(){return function(){return client[_0xf702('0x2')](_0xf702('0x3'),{'options':{'raw':![],'attributes':['id','name','timeout',_0xf702('0x4')],'include':[{'model':_0xf702('0x5'),'as':'Agents','attributes':['id',_0xf702('0x6'),_0xf702('0x7'),_0xf702('0x8')]}]},'log':_0xf702('0x1')});};}; \ No newline at end of file +var _0x41a6=['Request','name','User','Agents','online','faxPause','getFaxQueues'];(function(_0x4b9c73,_0x28f25d){var _0x71144d=function(_0x406577){while(--_0x406577){_0x4b9c73['push'](_0x4b9c73['shift']());}};_0x71144d(++_0x28f25d);}(_0x41a6,0x195));var _0x641a=function(_0x453ddf,_0x1d2619){_0x453ddf=_0x453ddf-0x0;var _0x291fc4=_0x41a6[_0x453ddf];return _0x291fc4;};'use strict';var client=require('../client');exports[_0x641a('0x0')]=function(){return function(){return client[_0x641a('0x1')]('GetFaxQueue',{'options':{'raw':![],'attributes':['id',_0x641a('0x2'),'timeout','strategy'],'include':[{'model':_0x641a('0x3'),'as':_0x641a('0x4'),'attributes':['id',_0x641a('0x2'),_0x641a('0x5'),_0x641a('0x6')]}]},'log':_0x641a('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index 2761739..3bab331 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 _0xcfee=['UpdateFaxQueueReport','../client','create','Request','CreateFaxQueueReport','update'];(function(_0x2d91f2,_0x4b56ae){var _0x1ba446=function(_0x1668e0){while(--_0x1668e0){_0x2d91f2['push'](_0x2d91f2['shift']());}};_0x1ba446(++_0x4b56ae);}(_0xcfee,0x10f));var _0xecfe=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0xcfee[_0x413feb];return _0x40ee88;};'use strict';var client=require(_0xecfe('0x0'));exports[_0xecfe('0x1')]=function(_0xa09dce){return client[_0xecfe('0x2')](_0xecfe('0x3'),{'body':_0xa09dce,'log':_0xecfe('0x3')});};exports[_0xecfe('0x4')]=function(_0x47d510,_0x16c69b){return client[_0xecfe('0x2')](_0xecfe('0x5'),{'body':_0x16c69b,'options':{'where':{'uniqueid':_0x47d510},'order':[['id','DESC']],'limit':0x1},'log':'UpdateFaxQueueReport'});}; \ No newline at end of file +var _0xdd32=['create','Request','update','UpdateFaxQueueReport','DESC'];(function(_0x99a230,_0xe70e96){var _0xd903cf=function(_0x2bf598){while(--_0x2bf598){_0x99a230['push'](_0x99a230['shift']());}};_0xd903cf(++_0xe70e96);}(_0xdd32,0x14a));var _0x2dd3=function(_0x3098db,_0x537080){_0x3098db=_0x3098db-0x0;var _0xcde0a4=_0xdd32[_0x3098db];return _0xcde0a4;};'use strict';var client=require('../client');exports[_0x2dd3('0x0')]=function(_0x10a0b9){return client[_0x2dd3('0x1')]('CreateFaxQueueReport',{'body':_0x10a0b9,'log':'CreateFaxQueueReport'});};exports[_0x2dd3('0x2')]=function(_0x4e9c13,_0x428223){return client[_0x2dd3('0x1')](_0x2dd3('0x3'),{'body':_0x428223,'options':{'where':{'uniqueid':_0x4e9c13},'order':[['id',_0x2dd3('0x4')]],'limit':0x1},'log':_0x2dd3('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index 6e70d22..4c8d25d 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 _0x6599=['Interval','getIntervals','Request','GetInterval','name'];(function(_0x143062,_0x3eafd2){var _0x4ee38a=function(_0x1c4437){while(--_0x1c4437){_0x143062['push'](_0x143062['shift']());}};_0x4ee38a(++_0x3eafd2);}(_0x6599,0xb0));var _0x9659=function(_0x42bdad,_0x12836c){_0x42bdad=_0x42bdad-0x0;var _0x122626=_0x6599[_0x42bdad];return _0x122626;};'use strict';var client=require('../client');exports[_0x9659('0x0')]=function(){return function(){return client[_0x9659('0x1')](_0x9659('0x2'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x9659('0x3')],'include':[{'model':_0x9659('0x4'),'as':'Intervals','attributes':['id',_0x9659('0x3'),'interval']}]},'log':_0x9659('0x0')});};}; \ No newline at end of file +var _0xd757=['getIntervals','Request','GetInterval','Intervals','name','../client'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xd757,0x1e5));var _0x7d75=function(_0xa56179,_0x1265b5){_0xa56179=_0xa56179-0x0;var _0x4113e0=_0xd757[_0xa56179];return _0x4113e0;};'use strict';var client=require(_0x7d75('0x0'));exports[_0x7d75('0x1')]=function(){return function(){return client[_0x7d75('0x2')](_0x7d75('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id','name'],'include':[{'model':'Interval','as':_0x7d75('0x4'),'attributes':['id',_0x7d75('0x5'),'interval']}]},'log':_0x7d75('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index 3db2fd1..9d5ea90 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 _0x78ed=['addTags','AddTagsToMailInteraction','addTagsToChatInteraction','Request','UpdateMailInteraction','updateMailInteraction'];(function(_0x11065a,_0x8022d5){var _0xbf4add=function(_0x8f05){while(--_0x8f05){_0x11065a['push'](_0x11065a['shift']());}};_0xbf4add(++_0x8022d5);}(_0x78ed,0x15f));var _0xd78e=function(_0x20f7a7,_0x37e3ee){_0x20f7a7=_0x20f7a7-0x0;var _0x489372=_0x78ed[_0x20f7a7];return _0x489372;};'use strict';var client=require('../client');exports['update']=function(_0x77a831,_0x480ed7){return client[_0xd78e('0x0')](_0xd78e('0x1'),{'body':_0x480ed7,'options':{'where':{'id':_0x77a831}},'log':_0xd78e('0x2')});};exports[_0xd78e('0x3')]=function(_0x3905dd,_0x57b947){return client[_0xd78e('0x0')](_0xd78e('0x4'),{'body':_0x57b947,'options':{'where':{'id':_0x3905dd}},'log':_0xd78e('0x5')});}; \ No newline at end of file +var _0x3c42=['update','UpdateMailInteraction','updateMailInteraction','addTags','addTagsToChatInteraction','../client'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3c42,0xa7));var _0x23c4=function(_0x1d53c7,_0x38d427){_0x1d53c7=_0x1d53c7-0x0;var _0x4d0100=_0x3c42[_0x1d53c7];return _0x4d0100;};'use strict';var client=require(_0x23c4('0x0'));exports[_0x23c4('0x1')]=function(_0x1d1934,_0x4dccec){return client['Request'](_0x23c4('0x2'),{'body':_0x4dccec,'options':{'where':{'id':_0x1d1934}},'log':_0x23c4('0x3')});};exports[_0x23c4('0x4')]=function(_0x511fa5,_0x347fab){return client['Request']('AddTagsToMailInteraction',{'body':_0x347fab,'options':{'where':{'id':_0x511fa5}},'log':_0x23c4('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index a39d7c9..074f560 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 _0x4d42=['Request','CreateMailMessage','createMailMessage','../client'];(function(_0x237587,_0x5ca4cb){var _0x1ae730=function(_0x1d471e){while(--_0x1d471e){_0x237587['push'](_0x237587['shift']());}};_0x1ae730(++_0x5ca4cb);}(_0x4d42,0x1c3));var _0x24d4=function(_0x208c90,_0x42ab87){_0x208c90=_0x208c90-0x0;var _0x506f61=_0x4d42[_0x208c90];return _0x506f61;};'use strict';var client=require(_0x24d4('0x0'));exports['create']=function(_0xcf8369){return client[_0x24d4('0x1')](_0x24d4('0x2'),{'body':_0xcf8369,'log':_0x24d4('0x3')});}; \ No newline at end of file +var _0x4491=['create','Request','CreateMailMessage','createMailMessage','../client'];(function(_0x139a3c,_0x4fc883){var _0x2b375b=function(_0x525dbf){while(--_0x525dbf){_0x139a3c['push'](_0x139a3c['shift']());}};_0x2b375b(++_0x4fc883);}(_0x4491,0xc2));var _0x1449=function(_0x29ff8c,_0x447c70){_0x29ff8c=_0x29ff8c-0x0;var _0x81165a=_0x4491[_0x29ff8c];return _0x81165a;};'use strict';var client=require(_0x1449('0x0'));exports[_0x1449('0x1')]=function(_0x39f92f){return client[_0x1449('0x2')](_0x1449('0x3'),{'body':_0x39f92f,'log':_0x1449('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index bed4fa4..da7918f 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 _0x7cf9=['Agents','mailPause','../client','getMailQueues','Request','name','timeout','User'];(function(_0x1d4501,_0x61c755){var _0x537d5c=function(_0x5adf34){while(--_0x5adf34){_0x1d4501['push'](_0x1d4501['shift']());}};_0x537d5c(++_0x61c755);}(_0x7cf9,0x11a));var _0x97cf=function(_0x89bd89,_0x1e4f02){_0x89bd89=_0x89bd89-0x0;var _0x7a7566=_0x7cf9[_0x89bd89];return _0x7a7566;};'use strict';var client=require(_0x97cf('0x0'));exports[_0x97cf('0x1')]=function(){return function(){return client[_0x97cf('0x2')]('GetMailQueue',{'options':{'raw':![],'attributes':['id',_0x97cf('0x3'),_0x97cf('0x4'),'strategy'],'include':[{'model':_0x97cf('0x5'),'as':_0x97cf('0x6'),'attributes':['id',_0x97cf('0x3'),'online',_0x97cf('0x7')]}]},'log':_0x97cf('0x1')});};}; \ No newline at end of file +var _0x886f=['online','mailPause','../client','getMailQueues','GetMailQueue','name','strategy','User','Agents'];(function(_0x1576ed,_0xfd8bab){var _0x4e5b48=function(_0x4770c7){while(--_0x4770c7){_0x1576ed['push'](_0x1576ed['shift']());}};_0x4e5b48(++_0xfd8bab);}(_0x886f,0x185));var _0xf886=function(_0x3257ff,_0xf7bc49){_0x3257ff=_0x3257ff-0x0;var _0x3d9d26=_0x886f[_0x3257ff];return _0x3d9d26;};'use strict';var client=require(_0xf886('0x0'));exports[_0xf886('0x1')]=function(){return function(){return client['Request'](_0xf886('0x2'),{'options':{'raw':![],'attributes':['id',_0xf886('0x3'),'timeout',_0xf886('0x4')],'include':[{'model':_0xf886('0x5'),'as':_0xf886('0x6'),'attributes':['id',_0xf886('0x3'),_0xf886('0x7'),_0xf886('0x8')]}]},'log':'getMailQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index 05e1cce..08ed76a 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 _0x9ff5=['update','UpdateMailQueueReport','DESC','../client','Request','CreateMailQueueReport'];(function(_0x46f628,_0x21cafe){var _0x466eba=function(_0x18310e){while(--_0x18310e){_0x46f628['push'](_0x46f628['shift']());}};_0x466eba(++_0x21cafe);}(_0x9ff5,0x12f));var _0x59ff=function(_0x589aee,_0x140a03){_0x589aee=_0x589aee-0x0;var _0x2f5ed4=_0x9ff5[_0x589aee];return _0x2f5ed4;};'use strict';var client=require(_0x59ff('0x0'));exports['create']=function(_0x4b2421){return client[_0x59ff('0x1')](_0x59ff('0x2'),{'body':_0x4b2421,'log':_0x59ff('0x2')});};exports[_0x59ff('0x3')]=function(_0x43cefb,_0x118c24){return client[_0x59ff('0x1')](_0x59ff('0x4'),{'body':_0x118c24,'options':{'where':{'uniqueid':_0x43cefb},'order':[['id',_0x59ff('0x5')]],'limit':0x1},'log':_0x59ff('0x4')});}; \ No newline at end of file +var _0x0324=['update','UpdateMailQueueReport','../client','Request','CreateMailQueueReport'];(function(_0x1bdf67,_0x5b084f){var _0x1a39b8=function(_0x1268df){while(--_0x1268df){_0x1bdf67['push'](_0x1bdf67['shift']());}};_0x1a39b8(++_0x5b084f);}(_0x0324,0x1f1));var _0x4032=function(_0x3cbcc8,_0x2fcbe3){_0x3cbcc8=_0x3cbcc8-0x0;var _0x92443a=_0x0324[_0x3cbcc8];return _0x92443a;};'use strict';var client=require(_0x4032('0x0'));exports['create']=function(_0x23c4be){return client[_0x4032('0x1')](_0x4032('0x2'),{'body':_0x23c4be,'log':_0x4032('0x2')});};exports[_0x4032('0x3')]=function(_0x18e1df,_0x580586){return client[_0x4032('0x1')](_0x4032('0x4'),{'body':_0x580586,'options':{'where':{'uniqueid':_0x18e1df},'order':[['id','DESC']],'limit':0x1},'log':_0x4032('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index b6e0a22..c1f7d8a 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 _0x9efe=['AddTagsToOpenchannelInteraction','../client','update','Request','UpdateOpenchannelInteraction','addTags'];(function(_0xe66cf2,_0x32ba5f){var _0x2d84e7=function(_0x58a7d8){while(--_0x58a7d8){_0xe66cf2['push'](_0xe66cf2['shift']());}};_0x2d84e7(++_0x32ba5f);}(_0x9efe,0xcd));var _0xe9ef=function(_0x26ec1c,_0x274d1b){_0x26ec1c=_0x26ec1c-0x0;var _0x3759c0=_0x9efe[_0x26ec1c];return _0x3759c0;};'use strict';var client=require(_0xe9ef('0x0'));exports[_0xe9ef('0x1')]=function(_0x36ccab,_0x5082e9){return client[_0xe9ef('0x2')](_0xe9ef('0x3'),{'body':_0x5082e9,'options':{'where':{'id':_0x36ccab}},'log':'updateOpenchannelInteraction'});};exports[_0xe9ef('0x4')]=function(_0x565a60,_0x5c0a96){return client['Request'](_0xe9ef('0x5'),{'body':_0x5c0a96,'options':{'where':{'id':_0x565a60}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0xa9d5=['addTagsToChatInteraction','../client','update','UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags','Request','AddTagsToOpenchannelInteraction'];(function(_0x476bf4,_0x2a3755){var _0x788ffe=function(_0x13fa11){while(--_0x13fa11){_0x476bf4['push'](_0x476bf4['shift']());}};_0x788ffe(++_0x2a3755);}(_0xa9d5,0x1d9));var _0x5a9d=function(_0x541daa,_0x1dafe1){_0x541daa=_0x541daa-0x0;var _0x404919=_0xa9d5[_0x541daa];return _0x404919;};'use strict';var client=require(_0x5a9d('0x0'));exports[_0x5a9d('0x1')]=function(_0x2e5cfc,_0x3a0731){return client['Request'](_0x5a9d('0x2'),{'body':_0x3a0731,'options':{'where':{'id':_0x2e5cfc}},'log':_0x5a9d('0x3')});};exports[_0x5a9d('0x4')]=function(_0xd19463,_0x337411){return client[_0x5a9d('0x5')](_0x5a9d('0x6'),{'body':_0x337411,'options':{'where':{'id':_0xd19463}},'log':_0x5a9d('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index f66d415..8fec37f 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 _0x34e8=['../client','create','Request','createOpenchannelMessage'];(function(_0xeabcde,_0x3b1765){var _0x253d84=function(_0x1a7b61){while(--_0x1a7b61){_0xeabcde['push'](_0xeabcde['shift']());}};_0x253d84(++_0x3b1765);}(_0x34e8,0x12c));var _0x834e=function(_0x3d737b,_0x1c9817){_0x3d737b=_0x3d737b-0x0;var _0x34910f=_0x34e8[_0x3d737b];return _0x34910f;};'use strict';var client=require(_0x834e('0x0'));exports[_0x834e('0x1')]=function(_0x8b339){return client[_0x834e('0x2')]('CreateOpenchannelMessage',{'body':_0x8b339,'log':_0x834e('0x3')});}; \ No newline at end of file +var _0xbdb7=['CreateOpenchannelMessage','createOpenchannelMessage','../client','create','Request'];(function(_0x13f7a1,_0x3e890d){var _0x2de175=function(_0x4a71b7){while(--_0x4a71b7){_0x13f7a1['push'](_0x13f7a1['shift']());}};_0x2de175(++_0x3e890d);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x55e9e9,_0x1afc74){_0x55e9e9=_0x55e9e9-0x0;var _0x39cb0c=_0xbdb7[_0x55e9e9];return _0x39cb0c;};'use strict';var client=require(_0x7bdb('0x0'));exports[_0x7bdb('0x1')]=function(_0x44467d){return client[_0x7bdb('0x2')](_0x7bdb('0x3'),{'body':_0x44467d,'log':_0x7bdb('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index f12448e..9ce407a 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 _0xd3e4=['openchannelPause','../client','getOpenchannelQueues','GetOpenchannelQueue','name','strategy','User','Agents','online'];(function(_0x4fe165,_0x168e2f){var _0xa0e338=function(_0x3f3cf1){while(--_0x3f3cf1){_0x4fe165['push'](_0x4fe165['shift']());}};_0xa0e338(++_0x168e2f);}(_0xd3e4,0x9a));var _0x4d3e=function(_0x73ba1f,_0x588ccb){_0x73ba1f=_0x73ba1f-0x0;var _0x2e2725=_0xd3e4[_0x73ba1f];return _0x2e2725;};'use strict';var client=require(_0x4d3e('0x0'));exports[_0x4d3e('0x1')]=function(){return function(){return client['Request'](_0x4d3e('0x2'),{'options':{'raw':![],'attributes':['id',_0x4d3e('0x3'),'timeout',_0x4d3e('0x4')],'include':[{'model':_0x4d3e('0x5'),'as':_0x4d3e('0x6'),'attributes':['id',_0x4d3e('0x3'),_0x4d3e('0x7'),_0x4d3e('0x8')]}]},'log':_0x4d3e('0x1')});};}; \ No newline at end of file +var _0xdad9=['openchannelPause','../client','getOpenchannelQueues','Request','name','timeout','strategy','Agents','online'];(function(_0x227745,_0x171942){var _0x4c4a55=function(_0x361c82){while(--_0x361c82){_0x227745['push'](_0x227745['shift']());}};_0x4c4a55(++_0x171942);}(_0xdad9,0xe2));var _0x9dad=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xdad9[_0x122ef9];return _0x42fba0;};'use strict';var client=require(_0x9dad('0x0'));exports[_0x9dad('0x1')]=function(){return function(){return client[_0x9dad('0x2')]('GetOpenchannelQueue',{'options':{'raw':![],'attributes':['id',_0x9dad('0x3'),_0x9dad('0x4'),_0x9dad('0x5')],'include':[{'model':'User','as':_0x9dad('0x6'),'attributes':['id',_0x9dad('0x3'),_0x9dad('0x7'),_0x9dad('0x8')]}]},'log':_0x9dad('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index 0294555..deedac6 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 _0xb095=['CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport','DESC','../client','create'];(function(_0x5dd921,_0x4b9fdd){var _0x62b488=function(_0x4b87ab){while(--_0x4b87ab){_0x5dd921['push'](_0x5dd921['shift']());}};_0x62b488(++_0x4b9fdd);}(_0xb095,0x1d2));var _0x5b09=function(_0x4cea61,_0x54f6ac){_0x4cea61=_0x4cea61-0x0;var _0x4a6769=_0xb095[_0x4cea61];return _0x4a6769;};'use strict';var client=require(_0x5b09('0x0'));exports[_0x5b09('0x1')]=function(_0x37d59c){return client['Request']('CreateOpenchannelQueueReport',{'body':_0x37d59c,'log':_0x5b09('0x2')});};exports[_0x5b09('0x3')]=function(_0x121cc7,_0x3973be){return client['Request'](_0x5b09('0x4'),{'body':_0x3973be,'options':{'where':{'uniqueid':_0x121cc7},'order':[['id',_0x5b09('0x5')]],'limit':0x1},'log':_0x5b09('0x4')});}; \ No newline at end of file +var _0x924f=['DESC','create','Request','CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport'];(function(_0x39d545,_0x4fb847){var _0x1d8139=function(_0x7c16d2){while(--_0x7c16d2){_0x39d545['push'](_0x39d545['shift']());}};_0x1d8139(++_0x4fb847);}(_0x924f,0xb5));var _0xf924=function(_0x5617e2,_0x1ffcd7){_0x5617e2=_0x5617e2-0x0;var _0x27b60d=_0x924f[_0x5617e2];return _0x27b60d;};'use strict';var client=require('../client');exports[_0xf924('0x0')]=function(_0xb22d14){return client[_0xf924('0x1')]('CreateOpenchannelQueueReport',{'body':_0xb22d14,'log':_0xf924('0x2')});};exports[_0xf924('0x3')]=function(_0x3c0d0a,_0xc646f9){return client[_0xf924('0x1')](_0xf924('0x4'),{'body':_0xc646f9,'options':{'where':{'uniqueid':_0x3c0d0a},'order':[['id',_0xf924('0x5')]],'limit':0x1},'log':_0xf924('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index 786438f..204bc16 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 _0x083e=['Request','AddTagsToSmsInteraction','addTagsToSmsInteraction','../client','UpdateSmsInteraction','updateSmsInteraction','addTags'];(function(_0x75f869,_0x3690d6){var _0x10af8b=function(_0x22d3ff){while(--_0x22d3ff){_0x75f869['push'](_0x75f869['shift']());}};_0x10af8b(++_0x3690d6);}(_0x083e,0xc7));var _0xe083=function(_0xec034,_0x16c358){_0xec034=_0xec034-0x0;var _0x2c5a19=_0x083e[_0xec034];return _0x2c5a19;};'use strict';var client=require(_0xe083('0x0'));exports['update']=function(_0x596e35,_0x4d2698){return client['Request'](_0xe083('0x1'),{'body':_0x4d2698,'options':{'where':{'id':_0x596e35}},'log':_0xe083('0x2')});};exports[_0xe083('0x3')]=function(_0x298891,_0x41af8d){return client[_0xe083('0x4')](_0xe083('0x5'),{'body':_0x41af8d,'options':{'where':{'id':_0x298891}},'log':_0xe083('0x6')});}; \ No newline at end of file +var _0x868c=['AddTagsToSmsInteraction','../client','update','Request','updateSmsInteraction','addTags'];(function(_0x491773,_0x1c33af){var _0x542004=function(_0x4ab024){while(--_0x4ab024){_0x491773['push'](_0x491773['shift']());}};_0x542004(++_0x1c33af);}(_0x868c,0x1e1));var _0xc868=function(_0x15ca1a,_0x30fc82){_0x15ca1a=_0x15ca1a-0x0;var _0x507626=_0x868c[_0x15ca1a];return _0x507626;};'use strict';var client=require(_0xc868('0x0'));exports[_0xc868('0x1')]=function(_0x5c535a,_0xeccdc6){return client[_0xc868('0x2')]('UpdateSmsInteraction',{'body':_0xeccdc6,'options':{'where':{'id':_0x5c535a}},'log':_0xc868('0x3')});};exports[_0xc868('0x4')]=function(_0x4c4ea2,_0x41afde){return client[_0xc868('0x2')](_0xc868('0x5'),{'body':_0x41afde,'options':{'where':{'id':_0x4c4ea2}},'log':'addTagsToSmsInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index 50b4a5b..2f91b6e 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 _0xbd76=['createSmsMessage','../client','create','Request','CreateSmsMessage'];(function(_0x27bb65,_0x46c5b1){var _0x4a91fb=function(_0x2f1eab){while(--_0x2f1eab){_0x27bb65['push'](_0x27bb65['shift']());}};_0x4a91fb(++_0x46c5b1);}(_0xbd76,0x105));var _0x6bd7=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0xbd76[_0x126558];return _0x1f6d14;};'use strict';var client=require(_0x6bd7('0x0'));exports[_0x6bd7('0x1')]=function(_0x17a064){return client[_0x6bd7('0x2')](_0x6bd7('0x3'),{'body':_0x17a064,'log':_0x6bd7('0x4')});}; \ No newline at end of file +var _0xe3f2=['createSmsMessage','../client','create','Request'];(function(_0x340c0f,_0x3f434a){var _0x4e5d8f=function(_0x4e00ea){while(--_0x4e00ea){_0x340c0f['push'](_0x340c0f['shift']());}};_0x4e5d8f(++_0x3f434a);}(_0xe3f2,0x101));var _0x2e3f=function(_0x40a194,_0x2844ce){_0x40a194=_0x40a194-0x0;var _0x25f755=_0xe3f2[_0x40a194];return _0x25f755;};'use strict';var client=require(_0x2e3f('0x0'));exports[_0x2e3f('0x1')]=function(_0x1f18fb){return client[_0x2e3f('0x2')]('CreateSmsMessage',{'body':_0x1f18fb,'log':_0x2e3f('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 3bcadd4..b357c6d 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 _0xdbb9=['name','strategy','User','Agents','online','smsPause','getSmsQueues','Request','GetSmsQueue'];(function(_0x5f368f,_0x20b6c9){var _0x56f5bd=function(_0x13c5c2){while(--_0x13c5c2){_0x5f368f['push'](_0x5f368f['shift']());}};_0x56f5bd(++_0x20b6c9);}(_0xdbb9,0xf9));var _0x9dbb=function(_0x1fddcd,_0x1251e2){_0x1fddcd=_0x1fddcd-0x0;var _0x130ec7=_0xdbb9[_0x1fddcd];return _0x130ec7;};'use strict';var client=require('../client');exports[_0x9dbb('0x0')]=function(){return function(){return client[_0x9dbb('0x1')](_0x9dbb('0x2'),{'options':{'raw':![],'attributes':['id',_0x9dbb('0x3'),'timeout',_0x9dbb('0x4')],'include':[{'model':_0x9dbb('0x5'),'as':_0x9dbb('0x6'),'attributes':['id',_0x9dbb('0x3'),_0x9dbb('0x7'),_0x9dbb('0x8')]}]},'log':'getSmsQueues'});};}; \ No newline at end of file +var _0xe451=['User','Agents','name','smsPause','getSmsQueues','Request','strategy'];(function(_0x4a34e0,_0x29ff2f){var _0xb5ce1d=function(_0x225c39){while(--_0x225c39){_0x4a34e0['push'](_0x4a34e0['shift']());}};_0xb5ce1d(++_0x29ff2f);}(_0xe451,0xec));var _0x1e45=function(_0x5bc158,_0x20ba90){_0x5bc158=_0x5bc158-0x0;var _0x288d43=_0xe451[_0x5bc158];return _0x288d43;};'use strict';var client=require('../client');exports['getSmsQueues']=function(){return function(){return client[_0x1e45('0x0')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id','name','timeout',_0x1e45('0x1')],'include':[{'model':_0x1e45('0x2'),'as':_0x1e45('0x3'),'attributes':['id',_0x1e45('0x4'),'online',_0x1e45('0x5')]}]},'log':_0x1e45('0x6')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index d182eed..d5f3857 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 _0xc933=['CreateSmsQueueReport','update','UpdateSmsQueueReport','../client','create','Request'];(function(_0x34728a,_0x5abf7e){var _0x25c1dd=function(_0x33b555){while(--_0x33b555){_0x34728a['push'](_0x34728a['shift']());}};_0x25c1dd(++_0x5abf7e);}(_0xc933,0xf9));var _0x3c93=function(_0x2d2ae3,_0x21ae6d){_0x2d2ae3=_0x2d2ae3-0x0;var _0x8a5de2=_0xc933[_0x2d2ae3];return _0x8a5de2;};'use strict';var client=require(_0x3c93('0x0'));exports[_0x3c93('0x1')]=function(_0x24928e){return client[_0x3c93('0x2')](_0x3c93('0x3'),{'body':_0x24928e,'log':'CreateSmsQueueReport'});};exports[_0x3c93('0x4')]=function(_0x12d6ad,_0x20d680){return client[_0x3c93('0x2')](_0x3c93('0x5'),{'body':_0x20d680,'options':{'where':{'uniqueid':_0x12d6ad},'order':[['id','DESC']],'limit':0x1},'log':_0x3c93('0x5')});}; \ No newline at end of file +var _0xd48a=['../client','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport'];(function(_0x4e93a9,_0x413f30){var _0x43013c=function(_0x3a0cf3){while(--_0x3a0cf3){_0x4e93a9['push'](_0x4e93a9['shift']());}};_0x43013c(++_0x413f30);}(_0xd48a,0x96));var _0xad48=function(_0x529722,_0x3005f0){_0x529722=_0x529722-0x0;var _0x235da3=_0xd48a[_0x529722];return _0x235da3;};'use strict';var client=require(_0xad48('0x0'));exports['create']=function(_0x28e680){return client[_0xad48('0x1')](_0xad48('0x2'),{'body':_0x28e680,'log':_0xad48('0x2')});};exports[_0xad48('0x3')]=function(_0x378556,_0x534d93){return client[_0xad48('0x1')](_0xad48('0x4'),{'body':_0x534d93,'options':{'where':{'uniqueid':_0x378556},'order':[['id','DESC']],'limit':0x1},'log':_0xad48('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 8608735..656e068 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 _0x3f0b=['openchannelPause','chatCapacity','mailCapacity','faxCapacity','openchannelCapacity','../client','getAgents','Request','name','online','chatPause','mailPause','faxPause'];(function(_0x12aba8,_0x40a036){var _0x2aac66=function(_0x3e56b7){while(--_0x3e56b7){_0x12aba8['push'](_0x12aba8['shift']());}};_0x2aac66(++_0x40a036);}(_0x3f0b,0x18b));var _0xb3f0=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0x3f0b[_0x36eaaa];return _0x461349;};'use strict';var client=require(_0xb3f0('0x0'));exports[_0xb3f0('0x1')]=function(){return function(){return client[_0xb3f0('0x2')]('GetUser',{'options':{'raw':!![],'where':{'role':'agent'},'attributes':['id',_0xb3f0('0x3'),_0xb3f0('0x4'),'pauseType','lastPauseAt','voicePause',_0xb3f0('0x5'),_0xb3f0('0x6'),_0xb3f0('0x7'),'smsPause',_0xb3f0('0x8'),_0xb3f0('0x9'),_0xb3f0('0xa'),_0xb3f0('0xb'),'smsCapacity',_0xb3f0('0xc')]},'log':_0xb3f0('0x1')});};}; \ No newline at end of file +var _0xca05=['GetUser','agent','online','pauseType','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatCapacity','mailCapacity','faxCapacity','smsCapacity','openchannelCapacity','../client','getAgents','Request'];(function(_0x119d25,_0x588c8){var _0x39cf30=function(_0x31c68c){while(--_0x31c68c){_0x119d25['push'](_0x119d25['shift']());}};_0x39cf30(++_0x588c8);}(_0xca05,0x12f));var _0x5ca0=function(_0x559a80,_0x3d193d){_0x559a80=_0x559a80-0x0;var _0x42f555=_0xca05[_0x559a80];return _0x42f555;};'use strict';var client=require(_0x5ca0('0x0'));exports[_0x5ca0('0x1')]=function(){return function(){return client[_0x5ca0('0x2')](_0x5ca0('0x3'),{'options':{'raw':!![],'where':{'role':_0x5ca0('0x4')},'attributes':['id','name',_0x5ca0('0x5'),_0x5ca0('0x6'),'lastPauseAt',_0x5ca0('0x7'),_0x5ca0('0x8'),_0x5ca0('0x9'),_0x5ca0('0xa'),_0x5ca0('0xb'),_0x5ca0('0xc'),_0x5ca0('0xd'),_0x5ca0('0xe'),_0x5ca0('0xf'),_0x5ca0('0x10'),_0x5ca0('0x11')]},'log':_0x5ca0('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappInteraction.js b/server/services/routing/rpc/whatsappInteraction.js index e5ab3fa..183db25 100644 --- a/server/services/routing/rpc/whatsappInteraction.js +++ b/server/services/routing/rpc/whatsappInteraction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x47d6=['Request','AddTagsToWhatsappInteraction','../client','update','UpdateWhatsappInteraction','updateWhatsappInteraction','addTags'];(function(_0x7293b4,_0x410974){var _0x37897c=function(_0x47e265){while(--_0x47e265){_0x7293b4['push'](_0x7293b4['shift']());}};_0x37897c(++_0x410974);}(_0x47d6,0x1de));var _0x647d=function(_0x597a29,_0x414329){_0x597a29=_0x597a29-0x0;var _0x30dcec=_0x47d6[_0x597a29];return _0x30dcec;};'use strict';var client=require(_0x647d('0x0'));exports[_0x647d('0x1')]=function(_0xaf144e,_0x549430){return client['Request'](_0x647d('0x2'),{'body':_0x549430,'options':{'where':{'id':_0xaf144e}},'log':_0x647d('0x3')});};exports[_0x647d('0x4')]=function(_0x583a19,_0x198584){return client[_0x647d('0x5')](_0x647d('0x6'),{'body':_0x198584,'options':{'where':{'id':_0x583a19}},'log':'addTagsToWhatsappInteraction'});}; \ No newline at end of file +var _0xe43c=['update','Request','UpdateWhatsappInteraction','addTags','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client'];(function(_0x1bc013,_0x7771c6){var _0x55df36=function(_0x1c02e0){while(--_0x1c02e0){_0x1bc013['push'](_0x1bc013['shift']());}};_0x55df36(++_0x7771c6);}(_0xe43c,0x180));var _0xce43=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0xe43c[_0x209941];return _0x1e8729;};'use strict';var client=require(_0xce43('0x0'));exports[_0xce43('0x1')]=function(_0x159823,_0x207c20){return client[_0xce43('0x2')](_0xce43('0x3'),{'body':_0x207c20,'options':{'where':{'id':_0x159823}},'log':'updateWhatsappInteraction'});};exports[_0xce43('0x4')]=function(_0x4eed68,_0x32b4d4){return client[_0xce43('0x2')](_0xce43('0x5'),{'body':_0x32b4d4,'options':{'where':{'id':_0x4eed68}},'log':_0xce43('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index 575d92f..e18fb12 100644 --- a/server/services/routing/rpc/whatsappMessage.js +++ b/server/services/routing/rpc/whatsappMessage.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2910=['Request','CreateWhatsappMessage','create'];(function(_0x131ffe,_0x2e53f3){var _0x278487=function(_0x208aa4){while(--_0x208aa4){_0x131ffe['push'](_0x131ffe['shift']());}};_0x278487(++_0x2e53f3);}(_0x2910,0x158));var _0x0291=function(_0x451f88,_0x5c061a){_0x451f88=_0x451f88-0x0;var _0x2cc2b7=_0x2910[_0x451f88];return _0x2cc2b7;};'use strict';var client=require('../client');exports[_0x0291('0x0')]=function(_0x38a6ed){return client[_0x0291('0x1')](_0x0291('0x2'),{'body':_0x38a6ed,'log':'createWhatsappMessage'});}; \ No newline at end of file +var _0x7192=['../client','create','CreateWhatsappMessage','createWhatsappMessage'];(function(_0x48ceab,_0x5db1a6){var _0x2f1254=function(_0x39eb92){while(--_0x39eb92){_0x48ceab['push'](_0x48ceab['shift']());}};_0x2f1254(++_0x5db1a6);}(_0x7192,0x6c));var _0x2719=function(_0x1831f1,_0x40e2ad){_0x1831f1=_0x1831f1-0x0;var _0x1f94c2=_0x7192[_0x1831f1];return _0x1f94c2;};'use strict';var client=require(_0x2719('0x0'));exports[_0x2719('0x1')]=function(_0x1eb84c){return client['Request'](_0x2719('0x2'),{'body':_0x1eb84c,'log':_0x2719('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index 8bb5456..1ba74b8 100644 --- a/server/services/routing/rpc/whatsappQueue.js +++ b/server/services/routing/rpc/whatsappQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x19e1=['User','name','online','../client','getWhatsappQueues','Request','GetWhatsappQueue','strategy'];(function(_0x5d2bd6,_0x377005){var _0x796b32=function(_0x40014c){while(--_0x40014c){_0x5d2bd6['push'](_0x5d2bd6['shift']());}};_0x796b32(++_0x377005);}(_0x19e1,0x163));var _0x119e=function(_0x3b594b,_0x5835c3){_0x3b594b=_0x3b594b-0x0;var _0x1ea5f8=_0x19e1[_0x3b594b];return _0x1ea5f8;};'use strict';var client=require(_0x119e('0x0'));exports[_0x119e('0x1')]=function(){return function(){return client[_0x119e('0x2')](_0x119e('0x3'),{'options':{'raw':![],'attributes':['id','name','timeout',_0x119e('0x4')],'include':[{'model':_0x119e('0x5'),'as':'Agents','attributes':['id',_0x119e('0x6'),_0x119e('0x7'),'whatsappPause']}]},'log':_0x119e('0x1')});};}; \ No newline at end of file +var _0xa74f=['strategy','User','Agents','online','Request','timeout'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa74f,0x9a));var _0xfa74=function(_0x152fe3,_0x12b0c8){_0x152fe3=_0x152fe3-0x0;var _0xc5bb39=_0xa74f[_0x152fe3];return _0xc5bb39;};'use strict';var client=require('../client');exports['getWhatsappQueues']=function(){return function(){return client[_0xfa74('0x0')]('GetWhatsappQueue',{'options':{'raw':![],'attributes':['id','name',_0xfa74('0x1'),_0xfa74('0x2')],'include':[{'model':_0xfa74('0x3'),'as':_0xfa74('0x4'),'attributes':['id','name',_0xfa74('0x5'),'whatsappPause']}]},'log':'getWhatsappQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index bce7b7f..136d469 100644 --- a/server/services/routing/rpc/whatsappQueueReport.js +++ b/server/services/routing/rpc/whatsappQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1462=['Request','CreateWhatsappQueueReport','update','UpdateWhatsappQueueReport','DESC','create'];(function(_0x5520c7,_0xbee449){var _0x3b0590=function(_0x1bb4f9){while(--_0x1bb4f9){_0x5520c7['push'](_0x5520c7['shift']());}};_0x3b0590(++_0xbee449);}(_0x1462,0x143));var _0x2146=function(_0xc107be,_0x522cb3){_0xc107be=_0xc107be-0x0;var _0x4e13eb=_0x1462[_0xc107be];return _0x4e13eb;};'use strict';var client=require('../client');exports[_0x2146('0x0')]=function(_0x24cd4a){return client[_0x2146('0x1')]('CreateWhatsappQueueReport',{'body':_0x24cd4a,'log':_0x2146('0x2')});};exports[_0x2146('0x3')]=function(_0x1cfd9a,_0x26dc12){return client[_0x2146('0x1')](_0x2146('0x4'),{'body':_0x26dc12,'options':{'where':{'uniqueid':_0x1cfd9a},'order':[['id',_0x2146('0x5')]],'limit':0x1},'log':_0x2146('0x4')});}; \ No newline at end of file +var _0x6025=['update','Request','UpdateWhatsappQueueReport','DESC','../client','create','CreateWhatsappQueueReport'];(function(_0x41e040,_0x307b72){var _0x440108=function(_0x254524){while(--_0x254524){_0x41e040['push'](_0x41e040['shift']());}};_0x440108(++_0x307b72);}(_0x6025,0x115));var _0x5602=function(_0x4fc3c9,_0x1f68b2){_0x4fc3c9=_0x4fc3c9-0x0;var _0x549508=_0x6025[_0x4fc3c9];return _0x549508;};'use strict';var client=require(_0x5602('0x0'));exports[_0x5602('0x1')]=function(_0x16d540){return client['Request'](_0x5602('0x2'),{'body':_0x16d540,'log':_0x5602('0x2')});};exports[_0x5602('0x3')]=function(_0x3e50f6,_0xfb3293){return client[_0x5602('0x4')](_0x5602('0x5'),{'body':_0xfb3293,'options':{'where':{'uniqueid':_0x3e50f6},'order':[['id',_0x5602('0x6')]],'limit':0x1},'log':_0x5602('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/server/applications/agent.js b/server/services/routing/server/applications/agent.js index da7209a..e814a84 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 _0x2ddd=['[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','lodash','util','seq-queue','../../../../config/logger','./strategy','string','number','timeout\x20is\x20a\x20number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','validate','length','error','[%s][AGENT]\x20%s','map','stop','find','agents','timeout','createQueue','atimeout','START:%s','end','close','rules','complete','[%s][AGENT]\x20ROUTING\x20END','next','agent'];(function(_0x57add2,_0x4f2b7d){var _0x4e3670=function(_0x3311b){while(--_0x3311b){_0x57add2['push'](_0x57add2['shift']());}};_0x4e3670(++_0x4f2b7d);}(_0x2ddd,0x19b));var _0xd2dd=function(_0x737a1f,_0x235fef){_0x737a1f=_0x737a1f-0x0;var _0x16eba1=_0x2ddd[_0x737a1f];return _0x16eba1;};'use strict';var schema=require('validate');var _=require(_0xd2dd('0x0'));var util=require(_0xd2dd('0x1'));var seqqueue=require(_0xd2dd('0x2'));var logger=require(_0xd2dd('0x3'))('routing');var strategy=require(_0xd2dd('0x4'));var queue=schema({'name':{'type':_0xd2dd('0x5'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0xd2dd('0x6'),'message':_0xd2dd('0x7')}});function writeLog(_0x71432d,_0x3dd410,_0x139459){return logger[_0xd2dd('0x8')](util[_0xd2dd('0x9')](_0xd2dd('0xa'),_0x71432d,_0x3dd410[_0xd2dd('0xb')],_0x139459));}function handleFindAgent(_0x4be5bf){return function(_0x1c68e6){return _0x1c68e6[_0xd2dd('0xb')][_0xd2dd('0xc')]()===_0x4be5bf['toLowerCase']();};}exports[_0xd2dd('0xd')]=function(_0x578cb5,_0x13e539,_0x17ea26,_0x56e382){return function(_0x426c75){try{var _0x5abbe3={'name':_0x13e539[0x0],'timeout':_0x13e539[0x1]};var _0x19d87e=queue[_0xd2dd('0xe')](_0x5abbe3,{'typecast':!![]});if(_0x19d87e[_0xd2dd('0xf')]){logger[_0xd2dd('0x10')](_0xd2dd('0x11'),_0x578cb5,_[_0xd2dd('0x12')](_0x19d87e,'message')['join'](',\x20'));_0x426c75[_0xd2dd('0x13')]();}else{var _0x1b5d2a=_[_0xd2dd('0x14')](_0x17ea26[_0xd2dd('0x15')],handleFindAgent(_0x5abbe3[_0xd2dd('0xb')]));if(_0x1b5d2a){var _0x5a6ada=(_0x5abbe3[_0xd2dd('0x16')]||0xa)*0x3e8;var _0x152c9d,_0x339008;var _0x446816=seqqueue[_0xd2dd('0x17')](_0x5a6ada);_0x446816['id']=_0x578cb5;_0x446816[_0xd2dd('0x18')]=_0x5a6ada;_0x446816['channel']=_0x56e382['channel'];writeLog(_0x578cb5,_0x1b5d2a,util[_0xd2dd('0x9')](_0xd2dd('0x19'),_0x5a6ada));_0x17ea26['rules'][_0x578cb5]['on'](_0xd2dd('0x1a'),function(){logger[_0xd2dd('0x8')]('[%s][AGENT]\x20ROUTING\x20STOPPED',_0x578cb5);clearTimeout(_0x339008);_0x339008=undefined;_0x446816[_0xd2dd('0x1b')]();if(_0x17ea26[_0xd2dd('0x1c')][_0x578cb5]){delete _0x17ea26[_0xd2dd('0x1c')][_0x578cb5];}_0x426c75[_0xd2dd('0x13')]();});_0x17ea26[_0xd2dd('0x1c')][_0x578cb5]['on'](_0xd2dd('0x1d'),function(){if(_0x17ea26['rules'][_0x578cb5]){delete _0x17ea26[_0xd2dd('0x1c')][_0x578cb5];}});_0x339008=setTimeout(function(){logger['info'](_0xd2dd('0x1e'),_0x578cb5);clearTimeout(_0x339008);_0x446816[_0xd2dd('0x1b')]();_0x426c75[_0xd2dd('0x1f')]();},_0x5a6ada);strategy[_0xd2dd('0x20')](_0x446816,_0x1b5d2a,_0x17ea26,_0x56e382);}else{logger[_0xd2dd('0x10')](_0xd2dd('0x21'),_0x578cb5,_0x5abbe3[_0xd2dd('0xb')]);_0x426c75['stop']();}}}catch(_0x3fd7fe){console[_0xd2dd('0x22')](_0x3fd7fe);logger['error'](_0xd2dd('0x23'),_0x578cb5,_0x3fd7fe[_0xd2dd('0x24')]);_0x426c75[_0xd2dd('0x13')]();}};}; \ No newline at end of file +var _0xcd75=['atimeout','channel','START:%s','end','[%s][AGENT]\x20ROUTING\x20STOPPED','rules','stop','complete','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','[%s][QUEUE]\x20%s','stack','validate','util','seq-queue','./strategy','number','timeout\x20is\x20a\x20number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','length','error','[%s][AGENT]\x20%s','message','join','agents','timeout','createQueue'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcd75,0x10d));var _0x5cd7=function(_0x1f699f,_0x74bc14){_0x1f699f=_0x1f699f-0x0;var _0x4428b3=_0xcd75[_0x1f699f];return _0x4428b3;};'use strict';var schema=require(_0x5cd7('0x0'));var _=require('lodash');var util=require(_0x5cd7('0x1'));var seqqueue=require(_0x5cd7('0x2'));var logger=require('../../../../config/logger')('routing');var strategy=require(_0x5cd7('0x3'));var queue=schema({'name':{'type':'string','required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0x5cd7('0x4'),'message':_0x5cd7('0x5')}});function writeLog(_0x143d1a,_0x3e89bf,_0x21b1f4){return logger[_0x5cd7('0x6')](util[_0x5cd7('0x7')](_0x5cd7('0x8'),_0x143d1a,_0x3e89bf[_0x5cd7('0x9')],_0x21b1f4));}function handleFindAgent(_0x34da58){return function(_0x3f21b1){return _0x3f21b1[_0x5cd7('0x9')][_0x5cd7('0xa')]()===_0x34da58[_0x5cd7('0xa')]();};}exports['consequence']=function(_0x584b6c,_0x1f5009,_0x5e967f,_0x4815ef){return function(_0x5a6817){try{var _0x4e0c77={'name':_0x1f5009[0x0],'timeout':_0x1f5009[0x1]};var _0x5da982=queue[_0x5cd7('0x0')](_0x4e0c77,{'typecast':!![]});if(_0x5da982[_0x5cd7('0xb')]){logger[_0x5cd7('0xc')](_0x5cd7('0xd'),_0x584b6c,_['map'](_0x5da982,_0x5cd7('0xe'))[_0x5cd7('0xf')](',\x20'));_0x5a6817['stop']();}else{var _0x560ea5=_['find'](_0x5e967f[_0x5cd7('0x10')],handleFindAgent(_0x4e0c77[_0x5cd7('0x9')]));if(_0x560ea5){var _0x587cc8=(_0x4e0c77[_0x5cd7('0x11')]||0xa)*0x3e8;var _0x5cd849,_0x1fd5ce;var _0x54bd24=seqqueue[_0x5cd7('0x12')](_0x587cc8);_0x54bd24['id']=_0x584b6c;_0x54bd24[_0x5cd7('0x13')]=_0x587cc8;_0x54bd24[_0x5cd7('0x14')]=_0x4815ef['channel'];writeLog(_0x584b6c,_0x560ea5,util[_0x5cd7('0x7')](_0x5cd7('0x15'),_0x587cc8));_0x5e967f['rules'][_0x584b6c]['on'](_0x5cd7('0x16'),function(){logger[_0x5cd7('0x6')](_0x5cd7('0x17'),_0x584b6c);clearTimeout(_0x1fd5ce);_0x1fd5ce=undefined;_0x54bd24['close']();if(_0x5e967f[_0x5cd7('0x18')][_0x584b6c]){delete _0x5e967f[_0x5cd7('0x18')][_0x584b6c];}_0x5a6817[_0x5cd7('0x19')]();});_0x5e967f['rules'][_0x584b6c]['on'](_0x5cd7('0x1a'),function(){if(_0x5e967f[_0x5cd7('0x18')][_0x584b6c]){delete _0x5e967f[_0x5cd7('0x18')][_0x584b6c];}});_0x1fd5ce=setTimeout(function(){logger[_0x5cd7('0x6')]('[%s][AGENT]\x20ROUTING\x20END',_0x584b6c);clearTimeout(_0x1fd5ce);_0x54bd24['close']();_0x5a6817[_0x5cd7('0x1b')]();},_0x587cc8);strategy[_0x5cd7('0x1c')](_0x54bd24,_0x560ea5,_0x5e967f,_0x4815ef);}else{logger[_0x5cd7('0xc')](_0x5cd7('0x1d'),_0x584b6c,_0x4e0c77[_0x5cd7('0x9')]);_0x5a6817[_0x5cd7('0x19')]();}}}catch(_0xc0bd94){console['log'](_0xc0bd94);logger['error'](_0x5cd7('0x1e'),_0x584b6c,_0xc0bd94[_0x5cd7('0x1f')]);_0x5a6817[_0x5cd7('0x19')]();}};}; \ 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 f8e4b58..c88c8ea 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 _0xc94c=['InteractionId','isEmpty','Message','create','then','[%s][AMAZONLEX]\x20%s','body','catch','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','$LATEST','message','toString','amazonlex','dialogState','Failed','next','stringify','error','lodash','./utils','../../../../config/logger','routing','../../rpc/smsMessage','interaction','UserId','info','YYYY-MM-DD\x20HH:mm:ss','chat','ChatWebsiteId','account','upperFirst','AccountId'];(function(_0x1c546c,_0x5c57cb){var _0x2cc384=function(_0x4dee11){while(--_0x4dee11){_0x1c546c['push'](_0x1c546c['shift']());}};_0x2cc384(++_0x5c57cb);}(_0xc94c,0x173));var _0xcc94=function(_0x26c8c8,_0x5bdf41){_0x26c8c8=_0x26c8c8-0x0;var _0x519e92=_0xc94c[_0x26c8c8];return _0x519e92;};'use strict';var _=require(_0xcc94('0x0'));var moment=require('moment');var AWS=require('aws-sdk');var utils=require(_0xcc94('0x1'));var logger=require(_0xcc94('0x2'))(_0xcc94('0x3'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0xcc94('0x4')),'faxMessage':require('../../rpc/faxMessage')};exports['consequence']=function(_0x27c6d6,_0x44eabd){return function(_0x4fe34b){try{if(!_['isNil'](this[_0xcc94('0x5')][_0xcc94('0x6')])){logger[_0xcc94('0x7')]('[%s][AMAZONLEX]\x20%s',_0x27c6d6,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x4fe34b['next']();}var _0x4430c9={'ContactId':this['contact']['id'],'sentAt':moment()['format'](_0xcc94('0x8')),'direction':'out'};var _0x139ebc=this['channel'];if(_0x139ebc===_0xcc94('0x9')){_0x4430c9[_0xcc94('0xa')]=this[_0xcc94('0xb')]['id'];}else{_0x4430c9[_[_0xcc94('0xc')](_0x139ebc)+_0xcc94('0xd')]=this[_0xcc94('0xb')]['id'];}_0x4430c9[_['upperFirst'](_0x139ebc)+_0xcc94('0xe')]=this[_0xcc94('0x5')]['id'];if(this[_0xcc94('0x5')]['created']){var _0x32a731=_0x44eabd[0x4];if(!_[_0xcc94('0xf')](_0x32a731)){_0x4430c9['body']=utils['getMustacheRender'](_0x32a731,this);return rpc[_0x139ebc+_0xcc94('0x10')][_0xcc94('0x11')](_0x4430c9)[_0xcc94('0x12')](function(_0x1a7df1){logger[_0xcc94('0x7')](_0xcc94('0x13'),_0x27c6d6,_0x4430c9[_0xcc94('0x14')]);})[_0xcc94('0x15')](function(_0x434024){logger['error'](_0xcc94('0x13'),_0x27c6d6,JSON['stringify'](_0x434024));})[_0xcc94('0x16')](function(){logger[_0xcc94('0x7')](_0xcc94('0x17'),_0x27c6d6);_0x4fe34b[_0xcc94('0x18')]();});}else{logger['info'](_0xcc94('0x19'),_0x27c6d6);_0x4fe34b[_0xcc94('0x18')]();}}else{var _0x12f7c7=this;var _0x68902e=new AWS['LexRuntime']({'accessKeyId':_0x44eabd[0x0],'secretAccessKey':_0x44eabd[0x1],'region':_0x44eabd[0x2]});var _0x384e66={'botAlias':_0xcc94('0x1a'),'botName':_0x44eabd[0x3],'inputText':this[_0xcc94('0x1b')][_0xcc94('0x14')],'userId':this[_0xcc94('0x5')]['id'][_0xcc94('0x1c')]()};_0x68902e['postText'](_0x384e66,function(_0x39da31,_0x41619c){if(_0x39da31){logger['error'](_0xcc94('0x13'),_0x27c6d6,_0x39da31[_0xcc94('0x1b')]);_0x4fe34b['next']();}else if(_0x41619c&&_0x41619c[_0xcc94('0x1b')]){_0x12f7c7[_0xcc94('0x14')][_0xcc94('0x1d')]=_0x41619c;_0x4430c9[_0xcc94('0x14')]=_0x41619c[_0xcc94('0x1b')];return rpc[_0x139ebc+_0xcc94('0x10')][_0xcc94('0x11')](_0x4430c9)['then'](function(_0x4a188d){logger[_0xcc94('0x7')](_0xcc94('0x13'),_0x27c6d6,_0x4430c9[_0xcc94('0x14')]);if(_0x41619c[_0xcc94('0x1e')]==_0xcc94('0x1f')){_0x4fe34b[_0xcc94('0x20')]();}else{_0x4fe34b[_0xcc94('0x18')]();}})[_0xcc94('0x15')](function(_0x576e71){logger['error'](_0xcc94('0x13'),_0x27c6d6,JSON[_0xcc94('0x21')](_0x576e71));_0x4fe34b[_0xcc94('0x20')]();});}else{_0x4fe34b[_0xcc94('0x20')]();}});}}catch(_0x6bf9a2){logger[_0xcc94('0x22')](_0xcc94('0x13'),_0x27c6d6,JSON[_0xcc94('0x21')](_0x6bf9a2));_0x4fe34b[_0xcc94('0x18')]();}};}; \ No newline at end of file +var _0xcf15=['[%s][AMAZONLEX]\x20%s','stringify','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','$LATEST','message','body','toString','postText','amazonlex','then','dialogState','Failed','lodash','aws-sdk','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','consequence','isNil','UserId','info','next','format','YYYY-MM-DD\x20HH:mm:ss','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','interaction','created','Message','create','catch','error'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xcf15,0x1c6));var _0x5cf1=function(_0x372c47,_0x4b4701){_0x372c47=_0x372c47-0x0;var _0x1cbd3a=_0xcf15[_0x372c47];return _0x1cbd3a;};'use strict';var _=require(_0x5cf1('0x0'));var moment=require('moment');var AWS=require(_0x5cf1('0x1'));var utils=require('./utils');var logger=require(_0x5cf1('0x2'))(_0x5cf1('0x3'));var rpc={'chatMessage':require(_0x5cf1('0x4')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x5cf1('0x5')),'smsMessage':require(_0x5cf1('0x6')),'faxMessage':require(_0x5cf1('0x7'))};exports[_0x5cf1('0x8')]=function(_0x2cb1c6,_0x165b98){return function(_0x2760c0){try{if(!_[_0x5cf1('0x9')](this['interaction'][_0x5cf1('0xa')])){logger[_0x5cf1('0xb')]('[%s][AMAZONLEX]\x20%s',_0x2cb1c6,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x2760c0[_0x5cf1('0xc')]();}var _0x13357b={'ContactId':this['contact']['id'],'sentAt':moment()[_0x5cf1('0xd')](_0x5cf1('0xe')),'direction':'out'};var _0x2e19f3=this['channel'];if(_0x2e19f3==='chat'){_0x13357b[_0x5cf1('0xf')]=this[_0x5cf1('0x10')]['id'];}else{_0x13357b[_[_0x5cf1('0x11')](_0x2e19f3)+_0x5cf1('0x12')]=this['account']['id'];}_0x13357b[_[_0x5cf1('0x11')](_0x2e19f3)+_0x5cf1('0x13')]=this[_0x5cf1('0x14')]['id'];if(this['interaction'][_0x5cf1('0x15')]){var _0x383288=_0x165b98[0x4];if(!_['isEmpty'](_0x383288)){_0x13357b['body']=utils['getMustacheRender'](_0x383288,this);return rpc[_0x2e19f3+_0x5cf1('0x16')][_0x5cf1('0x17')](_0x13357b)['then'](function(_0x5f4a68){logger[_0x5cf1('0xb')]('[%s][AMAZONLEX]\x20%s',_0x2cb1c6,_0x13357b['body']);})[_0x5cf1('0x18')](function(_0x2ec4cb){logger[_0x5cf1('0x19')](_0x5cf1('0x1a'),_0x2cb1c6,JSON[_0x5cf1('0x1b')](_0x2ec4cb));})['finally'](function(){logger[_0x5cf1('0xb')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x2cb1c6);_0x2760c0[_0x5cf1('0x1c')]();});}else{logger['info'](_0x5cf1('0x1d'),_0x2cb1c6);_0x2760c0[_0x5cf1('0x1c')]();}}else{var _0x4538ed=this;var _0x5cd585=new AWS[(_0x5cf1('0x1e'))]({'accessKeyId':_0x165b98[0x0],'secretAccessKey':_0x165b98[0x1],'region':_0x165b98[0x2]});var _0x3eee8c={'botAlias':_0x5cf1('0x1f'),'botName':_0x165b98[0x3],'inputText':this[_0x5cf1('0x20')][_0x5cf1('0x21')],'userId':this[_0x5cf1('0x14')]['id'][_0x5cf1('0x22')]()};_0x5cd585[_0x5cf1('0x23')](_0x3eee8c,function(_0x4d2c81,_0x17aba9){if(_0x4d2c81){logger['error'](_0x5cf1('0x1a'),_0x2cb1c6,_0x4d2c81[_0x5cf1('0x20')]);_0x2760c0[_0x5cf1('0xc')]();}else if(_0x17aba9&&_0x17aba9[_0x5cf1('0x20')]){_0x4538ed[_0x5cf1('0x21')][_0x5cf1('0x24')]=_0x17aba9;_0x13357b[_0x5cf1('0x21')]=_0x17aba9[_0x5cf1('0x20')];return rpc[_0x2e19f3+_0x5cf1('0x16')][_0x5cf1('0x17')](_0x13357b)[_0x5cf1('0x25')](function(_0x1f52de){logger['info'](_0x5cf1('0x1a'),_0x2cb1c6,_0x13357b['body']);if(_0x17aba9[_0x5cf1('0x26')]==_0x5cf1('0x27')){_0x2760c0[_0x5cf1('0xc')]();}else{_0x2760c0[_0x5cf1('0x1c')]();}})[_0x5cf1('0x18')](function(_0x2d3acf){logger[_0x5cf1('0x19')](_0x5cf1('0x1a'),_0x2cb1c6,JSON[_0x5cf1('0x1b')](_0x2d3acf));_0x2760c0['next']();});}else{_0x2760c0[_0x5cf1('0xc')]();}});}}catch(_0x1f0514){logger[_0x5cf1('0x19')](_0x5cf1('0x1a'),_0x2cb1c6,JSON[_0x5cf1('0x1b')](_0x1f0514));_0x2760c0[_0x5cf1('0x1c')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/autoreply.js b/server/services/routing/server/applications/autoreply.js index 47ca0ae..79d6acf 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 _0x0713=['authentication','auth','user','pass','inReplyTo','messageId','replace','body','','sendMailMessage','then','create','stringify','catch','error','[RPC][%s][AUTOREPLY]\x20%s','finally','Message','[%s][AUTOREPLY]\x20%s','stop','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../mailRpc','consequence','isNil','interaction','created','info','Autoreply\x20already\x20sent','next','channel','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','message','phone','subject','startsWith','Re:','Re:\x20','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','mail','Smtp','service','host','port','secure'];(function(_0x211a69,_0x3063af){var _0x271cf4=function(_0x42a614){while(--_0x42a614){_0x211a69['push'](_0x211a69['shift']());}};_0x271cf4(++_0x3063af);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var moment=require('moment');var utils=require(_0x3071('0x0'));var logger=require(_0x3071('0x1'))(_0x3071('0x2'));var rpc={'chatMessage':require(_0x3071('0x3')),'openchannelMessage':require(_0x3071('0x4')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x3071('0x5')),'faxMessage':require(_0x3071('0x6'))};var mailRpc=require(_0x3071('0x7'));exports[_0x3071('0x8')]=function(_0xabd7b6,_0x41cf76){return function(_0x1d3dd6){try{if(_0x41cf76[0x0]==='1'&&(_[_0x3071('0x9')](this[_0x3071('0xa')][_0x3071('0xb')])||!this[_0x3071('0xa')][_0x3071('0xb')])){logger[_0x3071('0xc')]('[%s][AUTOREPLY]\x20%s',_0xabd7b6,_0x3071('0xd'));return _0x1d3dd6[_0x3071('0xe')]();}var _0x937259=this[_0x3071('0xf')];var _0x1ce844={'body':utils['getMustacheRender'](_0x41cf76[0x1],this),'ContactId':this[_0x3071('0x10')]['id'],'sentAt':moment()[_0x3071('0x11')](_0x3071('0x12')),'direction':_0x3071('0x13')};if(this[_0x3071('0x14')]){_0x1ce844['to']=this['message']['from']||'';_0x1ce844['cc']=this[_0x3071('0x14')]['cc']||'';_0x1ce844['from']=this[_0x3071('0x14')]['to']||'';_0x1ce844[_0x3071('0x15')]=this['message'][_0x3071('0x15')]||'';_0x1ce844['read']=!![];if(this[_0x3071('0x14')][_0x3071('0x16')]){_0x1ce844[_0x3071('0x16')]='';_0x1ce844[_0x3071('0x16')]+=_[_0x3071('0x17')](this[_0x3071('0x14')][_0x3071('0x16')],_0x3071('0x18'))?'':_0x3071('0x19');_0x1ce844[_0x3071('0x16')]+=this['message'][_0x3071('0x16')];}}if(this[_0x3071('0xf')]===_0x3071('0x1a')){_0x1ce844[_0x3071('0x1b')]=this[_0x3071('0x1c')]['id'];}else{_0x1ce844[_[_0x3071('0x1d')](this[_0x3071('0xf')])+_0x3071('0x1e')]=this['account']['id'];}_0x1ce844[_[_0x3071('0x1d')](this[_0x3071('0xf')])+_0x3071('0x1f')]=this['interaction']['id'];if(rpc[this[_0x3071('0xf')]+'Message']){if(this[_0x3071('0xf')]===_0x3071('0x20')){var _0x3762d8={'tls':{'rejectUnauthorized':![]}};if(this[_0x3071('0x1c')][_0x3071('0x21')][_0x3071('0x22')]){_0x3762d8[_0x3071('0x22')]=this[_0x3071('0x1c')]['Smtp']['service'];}else{_0x3762d8[_0x3071('0x23')]=this[_0x3071('0x1c')][_0x3071('0x21')][_0x3071('0x23')];_0x3762d8[_0x3071('0x24')]=this[_0x3071('0x1c')][_0x3071('0x21')][_0x3071('0x24')];_0x3762d8[_0x3071('0x25')]=this['account'][_0x3071('0x21')][_0x3071('0x25')];}if(this[_0x3071('0x1c')]['Smtp'][_0x3071('0x26')]){_0x3762d8[_0x3071('0x27')]={'user':this[_0x3071('0x1c')][_0x3071('0x21')][_0x3071('0x28')],'pass':this[_0x3071('0x1c')][_0x3071('0x21')][_0x3071('0x29')]};}_0x1ce844[_0x3071('0x2a')]=this[_0x3071('0x14')][_0x3071('0x2b')];_0x1ce844['html']=''+_[_0x3071('0x2c')](_0x1ce844[_0x3071('0x2d')],_0x3071('0x2e'),_0x3071('0x2f'))+_0x3071('0x30');return mailRpc[_0x3071('0x31')](_0x3762d8,_0x1ce844)[_0x3071('0x32')](function(_0x1ccc41){logger['info']('[%s][AUTOREPLY]\x20SMTP\x20SENT',_0xabd7b6);_0x1ce844['messageId']=_0x1ccc41[_0x3071('0x14')][_0x3071('0x2b')];return rpc[_0x937259+'Message'][_0x3071('0x33')](_0x1ce844);})[_0x3071('0x32')](function(_0x25250e){logger[_0x3071('0xc')]('[%s][AUTOREPLY]\x20%s',_0xabd7b6,JSON[_0x3071('0x34')](_0x25250e));})[_0x3071('0x35')](function(_0x602719){logger[_0x3071('0x36')](_0x3071('0x37'),_0xabd7b6,JSON[_0x3071('0x34')](_0x602719));})[_0x3071('0x38')](function(){_0x1d3dd6[_0x3071('0xe')]();});}else{return rpc[this['channel']+_0x3071('0x39')]['create'](_0x1ce844)['then'](function(_0x1a1a64){logger[_0x3071('0xc')]('[%s][AUTOREPLY]\x20%s',_0xabd7b6,_0x1ce844[_0x3071('0x2d')]);})[_0x3071('0x35')](function(_0x265d76){logger[_0x3071('0x36')](_0x3071('0x3a'),_0xabd7b6,JSON[_0x3071('0x34')](_0x265d76));})['finally'](function(){_0x1d3dd6[_0x3071('0xe')]();});}}}catch(_0xd7971f){logger['error'](_0x3071('0x3a'),_0xabd7b6,JSON['stringify'](_0xd7971f));_0x1d3dd6[_0x3071('0x3b')]();}};}; \ No newline at end of file +var _0x9c44=['message','from','phone','read','subject','startsWith','Re:','Re:\x20','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','Message','mail','service','host','Smtp','secure','authentication','user','pass','inReplyTo','messageId','html','','replace','body','','[%s][AUTOREPLY]\x20SMTP\x20SENT','create','then','catch','error','[RPC][%s][AUTOREPLY]\x20%s','stringify','next','stop','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../mailRpc','isNil','interaction','created','info','[%s][AUTOREPLY]\x20%s','channel','getMustacheRender','contact','out'];(function(_0x171de5,_0x260fd1){var _0x1c2d68=function(_0x111adc){while(--_0x111adc){_0x171de5['push'](_0x171de5['shift']());}};_0x1c2d68(++_0x260fd1);}(_0x9c44,0x178));var _0x49c4=function(_0x543084,_0x4337f5){_0x543084=_0x543084-0x0;var _0x306a57=_0x9c44[_0x543084];return _0x306a57;};'use strict';var _=require('lodash');var moment=require('moment');var utils=require(_0x49c4('0x0'));var logger=require(_0x49c4('0x1'))(_0x49c4('0x2'));var rpc={'chatMessage':require(_0x49c4('0x3')),'openchannelMessage':require(_0x49c4('0x4')),'mailMessage':require(_0x49c4('0x5')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require('../../rpc/faxMessage')};var mailRpc=require(_0x49c4('0x6'));exports['consequence']=function(_0xc1278f,_0x6030ae){return function(_0x69bc41){try{if(_0x6030ae[0x0]==='1'&&(_[_0x49c4('0x7')](this[_0x49c4('0x8')]['created'])||!this[_0x49c4('0x8')][_0x49c4('0x9')])){logger[_0x49c4('0xa')](_0x49c4('0xb'),_0xc1278f,'Autoreply\x20already\x20sent');return _0x69bc41['next']();}var _0x451ea6=this[_0x49c4('0xc')];var _0x58cad7={'body':utils[_0x49c4('0xd')](_0x6030ae[0x1],this),'ContactId':this[_0x49c4('0xe')]['id'],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x49c4('0xf')};if(this[_0x49c4('0x10')]){_0x58cad7['to']=this['message'][_0x49c4('0x11')]||'';_0x58cad7['cc']=this[_0x49c4('0x10')]['cc']||'';_0x58cad7['from']=this[_0x49c4('0x10')]['to']||'';_0x58cad7[_0x49c4('0x12')]=this[_0x49c4('0x10')][_0x49c4('0x12')]||'';_0x58cad7[_0x49c4('0x13')]=!![];if(this[_0x49c4('0x10')][_0x49c4('0x14')]){_0x58cad7[_0x49c4('0x14')]='';_0x58cad7['subject']+=_[_0x49c4('0x15')](this[_0x49c4('0x10')][_0x49c4('0x14')],_0x49c4('0x16'))?'':_0x49c4('0x17');_0x58cad7['subject']+=this[_0x49c4('0x10')][_0x49c4('0x14')];}}if(this['channel']==='chat'){_0x58cad7[_0x49c4('0x18')]=this[_0x49c4('0x19')]['id'];}else{_0x58cad7[_[_0x49c4('0x1a')](this['channel'])+_0x49c4('0x1b')]=this['account']['id'];}_0x58cad7[_[_0x49c4('0x1a')](this[_0x49c4('0xc')])+_0x49c4('0x1c')]=this[_0x49c4('0x8')]['id'];if(rpc[this[_0x49c4('0xc')]+_0x49c4('0x1d')]){if(this[_0x49c4('0xc')]===_0x49c4('0x1e')){var _0x2197d2={'tls':{'rejectUnauthorized':![]}};if(this['account']['Smtp']['service']){_0x2197d2[_0x49c4('0x1f')]=this['account']['Smtp'][_0x49c4('0x1f')];}else{_0x2197d2[_0x49c4('0x20')]=this[_0x49c4('0x19')][_0x49c4('0x21')]['host'];_0x2197d2['port']=this[_0x49c4('0x19')][_0x49c4('0x21')]['port'];_0x2197d2[_0x49c4('0x22')]=this[_0x49c4('0x19')][_0x49c4('0x21')][_0x49c4('0x22')];}if(this['account']['Smtp'][_0x49c4('0x23')]){_0x2197d2['auth']={'user':this[_0x49c4('0x19')][_0x49c4('0x21')][_0x49c4('0x24')],'pass':this[_0x49c4('0x19')]['Smtp'][_0x49c4('0x25')]};}_0x58cad7[_0x49c4('0x26')]=this[_0x49c4('0x10')][_0x49c4('0x27')];_0x58cad7[_0x49c4('0x28')]=_0x49c4('0x29')+_[_0x49c4('0x2a')](_0x58cad7[_0x49c4('0x2b')],_0x49c4('0x2c'),_0x49c4('0x2d'))+_0x49c4('0x2e');return mailRpc['sendMailMessage'](_0x2197d2,_0x58cad7)['then'](function(_0x59eb84){logger[_0x49c4('0xa')](_0x49c4('0x2f'),_0xc1278f);_0x58cad7[_0x49c4('0x27')]=_0x59eb84[_0x49c4('0x10')][_0x49c4('0x27')];return rpc[_0x451ea6+'Message'][_0x49c4('0x30')](_0x58cad7);})[_0x49c4('0x31')](function(_0x2e7a69){logger[_0x49c4('0xa')]('[%s][AUTOREPLY]\x20%s',_0xc1278f,JSON['stringify'](_0x2e7a69));})[_0x49c4('0x32')](function(_0x9a1bed){logger[_0x49c4('0x33')](_0x49c4('0x34'),_0xc1278f,JSON[_0x49c4('0x35')](_0x9a1bed));})['finally'](function(){_0x69bc41[_0x49c4('0x36')]();});}else{return rpc[this[_0x49c4('0xc')]+_0x49c4('0x1d')]['create'](_0x58cad7)['then'](function(_0x85dce2){logger[_0x49c4('0xa')](_0x49c4('0xb'),_0xc1278f,_0x58cad7[_0x49c4('0x2b')]);})[_0x49c4('0x32')](function(_0x2cf897){logger[_0x49c4('0x33')](_0x49c4('0xb'),_0xc1278f,JSON[_0x49c4('0x35')](_0x2cf897));})['finally'](function(){_0x69bc41[_0x49c4('0x36')]();});}}}catch(_0x5b96df){logger[_0x49c4('0x33')](_0x49c4('0xb'),_0xc1278f,JSON[_0x49c4('0x35')](_0x5b96df));_0x69bc41[_0x49c4('0x37')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/close.js b/server/services/routing/server/applications/close.js index 0abc3dc..07794b2 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 _0x7366=['../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','consequence','info','[%s][CLOSE]\x20reason\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','system','Interaction','channel','interaction','catch','stringify','finally','stop','error','[%s][CLOSE]\x20%s','moment','../../../../config/logger','routing','../../rpc/chatInteraction'];(function(_0xc87d08,_0x59c9be){var _0x30a714=function(_0x437c0d){while(--_0x437c0d){_0xc87d08['push'](_0xc87d08['shift']());}};_0x30a714(++_0x59c9be);}(_0x7366,0x9d));var _0x6736=function(_0x134557,_0x19ea33){_0x134557=_0x134557-0x0;var _0x1ab4eb=_0x7366[_0x134557];return _0x1ab4eb;};'use strict';var moment=require(_0x6736('0x0'));var logger=require(_0x6736('0x1'))(_0x6736('0x2'));var rpc={'chatInteraction':require(_0x6736('0x3')),'openchannelInteraction':require(_0x6736('0x4')),'smsInteraction':require(_0x6736('0x5')),'mailInteraction':require(_0x6736('0x6')),'faxInteraction':require(_0x6736('0x7'))};exports[_0x6736('0x8')]=function(_0x5b72a8,_0xe9150b,_0x5ec475,_0x595d6f){return function(_0x54040b){try{logger[_0x6736('0x9')](_0x6736('0xa'),_0x5b72a8,_0xe9150b[0x0]);var _0x4f4944={'closed':0x1,'closedAt':moment()[_0x6736('0xb')](_0x6736('0xc')),'closeReason':_0x6736('0xd'),'disposition':_0xe9150b[0x0]};if(rpc[_0x595d6f['channel']+_0x6736('0xe')]){rpc[_0x595d6f[_0x6736('0xf')]+_0x6736('0xe')]['update'](_0x595d6f[_0x6736('0x10')]['id'],_0x4f4944)['then'](function(_0x2155c4){logger[_0x6736('0x9')]('[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!',_0x5b72a8,_0x595d6f[_0x6736('0x10')]['id']);})[_0x6736('0x11')](function(_0x5d21f8){logger['error']('[%s][CLOSE]\x20%s',_0x5b72a8,JSON[_0x6736('0x12')](_0x5d21f8));})[_0x6736('0x13')](function(){_0x54040b[_0x6736('0x14')]();});}}catch(_0x43bcc7){logger[_0x6736('0x15')](_0x6736('0x16'),_0x5b72a8,JSON[_0x6736('0x12')](_0x43bcc7));_0x54040b[_0x6736('0x14')]();}};}; \ No newline at end of file +var _0x0bb4=['then','info','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','catch','error','[%s][CLOSE]\x20%s','stringify','finally','stop','moment','../../../../config/logger','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','consequence','[%s][CLOSE]\x20reason\x20%s','YYYY-MM-DD\x20HH:mm:ss','channel','Interaction','update','interaction'];(function(_0x5f2a06,_0x2320ce){var _0xcea0ab=function(_0x216225){while(--_0x216225){_0x5f2a06['push'](_0x5f2a06['shift']());}};_0xcea0ab(++_0x2320ce);}(_0x0bb4,0x77));var _0x40bb=function(_0x343cae,_0x3de738){_0x343cae=_0x343cae-0x0;var _0x181dfd=_0x0bb4[_0x343cae];return _0x181dfd;};'use strict';var moment=require(_0x40bb('0x0'));var logger=require(_0x40bb('0x1'))('routing');var rpc={'chatInteraction':require(_0x40bb('0x2')),'openchannelInteraction':require(_0x40bb('0x3')),'smsInteraction':require(_0x40bb('0x4')),'mailInteraction':require(_0x40bb('0x5')),'faxInteraction':require('../../rpc/faxInteraction')};exports[_0x40bb('0x6')]=function(_0x54fef0,_0x266cf4,_0x57a115,_0xa8c628){return function(_0xe75667){try{logger['info'](_0x40bb('0x7'),_0x54fef0,_0x266cf4[0x0]);var _0x1243f4={'closed':0x1,'closedAt':moment()['format'](_0x40bb('0x8')),'closeReason':'system','disposition':_0x266cf4[0x0]};if(rpc[_0xa8c628[_0x40bb('0x9')]+_0x40bb('0xa')]){rpc[_0xa8c628[_0x40bb('0x9')]+_0x40bb('0xa')][_0x40bb('0xb')](_0xa8c628[_0x40bb('0xc')]['id'],_0x1243f4)[_0x40bb('0xd')](function(_0x1ad45c){logger[_0x40bb('0xe')](_0x40bb('0xf'),_0x54fef0,_0xa8c628[_0x40bb('0xc')]['id']);})[_0x40bb('0x10')](function(_0x1505a9){logger[_0x40bb('0x11')](_0x40bb('0x12'),_0x54fef0,JSON[_0x40bb('0x13')](_0x1505a9));})[_0x40bb('0x14')](function(){_0xe75667['stop']();});}}catch(_0x55cac9){logger[_0x40bb('0x11')](_0x40bb('0x12'),_0x54fef0,JSON[_0x40bb('0x13')](_0x55cac9));_0xe75667[_0x40bb('0x15')]();}};}; \ 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 3477d04..cecee04 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 _0xd871=['then','[%s][DIALOGFLOW]\x20%s','catch','error','finally','info','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','message','result','fulfillment','speech','create','metadata','endConversation','stop','stringify','lodash','moment','./utils','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','consequence','isNil','interaction','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','chat','account','upperFirst','InteractionId','isEmpty','body','Message'];(function(_0x3983bd,_0x510100){var _0x3575d3=function(_0x118bbd){while(--_0x118bbd){_0x3983bd['push'](_0x3983bd['shift']());}};_0x3575d3(++_0x510100);}(_0xd871,0x1f1));var _0x1d87=function(_0xf06844,_0x4dcba8){_0xf06844=_0xf06844-0x0;var _0x1e52e1=_0xd871[_0xf06844];return _0x1e52e1;};'use strict';var _=require(_0x1d87('0x0'));var moment=require(_0x1d87('0x1'));var apiai=require('apiai-promise');var md5=require('md5');var utils=require(_0x1d87('0x2'));var logger=require('../../../../config/logger')(_0x1d87('0x3'));var rpc={'chatMessage':require(_0x1d87('0x4')),'openchannelMessage':require(_0x1d87('0x5')),'mailMessage':require(_0x1d87('0x6')),'smsMessage':require(_0x1d87('0x7')),'faxMessage':require('../../rpc/faxMessage')};exports[_0x1d87('0x8')]=function(_0x64e9fd,_0x4778d6){return function(_0x22b273){try{if(!_[_0x1d87('0x9')](this[_0x1d87('0xa')]['UserId'])){logger['info']('[%s][DIALOGFLOW]\x20%s',_0x64e9fd,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x22b273[_0x1d87('0xb')]();}var _0x495f90={'ContactId':this[_0x1d87('0xc')]['id'],'sentAt':moment()[_0x1d87('0xd')](_0x1d87('0xe')),'direction':_0x1d87('0xf')};var _0x389b45=this['channel'];if(_0x389b45===_0x1d87('0x10')){_0x495f90['ChatWebsiteId']=this[_0x1d87('0x11')]['id'];}else{_0x495f90[_[_0x1d87('0x12')](_0x389b45)+'AccountId']=this['account']['id'];}_0x495f90[_[_0x1d87('0x12')](_0x389b45)+_0x1d87('0x13')]=this[_0x1d87('0xa')]['id'];if(this[_0x1d87('0xa')]['created']){var _0x65251e=_0x4778d6[0x2];if(!_[_0x1d87('0x14')](_0x65251e)){_0x495f90[_0x1d87('0x15')]=utils['getMustacheRender'](_0x65251e,this);return rpc[_0x389b45+_0x1d87('0x16')]['create'](_0x495f90)[_0x1d87('0x17')](function(_0x3a9edc){logger['info'](_0x1d87('0x18'),_0x64e9fd,_0x495f90[_0x1d87('0x15')]);})[_0x1d87('0x19')](function(_0xa6f2f7){logger[_0x1d87('0x1a')](_0x1d87('0x18'),_0x64e9fd,JSON['stringify'](_0xa6f2f7));})[_0x1d87('0x1b')](function(){logger[_0x1d87('0x1c')](_0x1d87('0x1d'),_0x64e9fd);_0x22b273['stop']();});}else{logger['info'](_0x1d87('0x1e'),_0x64e9fd);_0x22b273['stop']();}}else{var _0x47b2ed=this;var _0x4b677f=apiai(_0x4778d6[0x0],{'language':_0x4778d6[0x1]||'en'});return _0x4b677f['textRequest'](this[_0x1d87('0x1f')][_0x1d87('0x15')],{'sessionId':md5(this[_0x1d87('0xa')]['id'])})[_0x1d87('0x17')](function(_0x346361){_0x47b2ed['body']['dialogflow']=_0x346361;_0x495f90['body']=_0x346361[_0x1d87('0x20')][_0x1d87('0x21')][_0x1d87('0x22')];return rpc[_0x389b45+_0x1d87('0x16')][_0x1d87('0x23')](_0x495f90)['then'](function(_0x3f894d){logger[_0x1d87('0x1c')]('[%s][DIALOGFLOW]\x20%s',_0x64e9fd,_0x495f90['body']);if(_0x346361['result'][_0x1d87('0x24')][_0x1d87('0x25')]){_0x22b273['next']();}else{_0x22b273[_0x1d87('0x26')]();}})[_0x1d87('0x19')](function(_0x1bca10){logger[_0x1d87('0x1a')](_0x1d87('0x18'),_0x64e9fd,JSON[_0x1d87('0x27')](_0x1bca10));_0x22b273['next']();});})[_0x1d87('0x19')](function(_0x4220b4){logger[_0x1d87('0x1a')](_0x1d87('0x18'),_0x64e9fd,_0x4220b4[_0x1d87('0x1f')]);_0x22b273[_0x1d87('0xb')]();});}}catch(_0x445d72){logger[_0x1d87('0x1a')](_0x1d87('0x18'),_0x64e9fd,JSON[_0x1d87('0x27')](_0x445d72));_0x22b273[_0x1d87('0x26')]();}};}; \ No newline at end of file +var _0x25f3=['metadata','catch','stringify','lodash','moment','apiai-promise','./utils','../../../../config/logger','routing','../../rpc/mailMessage','../../rpc/smsMessage','isNil','info','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','chat','ChatWebsiteId','account','AccountId','upperFirst','InteractionId','interaction','isEmpty','body','getMustacheRender','Message','then','error','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','textRequest','message','dialogflow','fulfillment','speech','create','result'];(function(_0x345705,_0x2829c1){var _0x22c250=function(_0x4ae124){while(--_0x4ae124){_0x345705['push'](_0x345705['shift']());}};_0x22c250(++_0x2829c1);}(_0x25f3,0x87));var _0x325f=function(_0x2faf6c,_0x2cc16c){_0x2faf6c=_0x2faf6c-0x0;var _0x5b8e97=_0x25f3[_0x2faf6c];return _0x5b8e97;};'use strict';var _=require(_0x325f('0x0'));var moment=require(_0x325f('0x1'));var apiai=require(_0x325f('0x2'));var md5=require('md5');var utils=require(_0x325f('0x3'));var logger=require(_0x325f('0x4'))(_0x325f('0x5'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x325f('0x6')),'smsMessage':require(_0x325f('0x7')),'faxMessage':require('../../rpc/faxMessage')};exports['consequence']=function(_0x503b57,_0x5bc11b){return function(_0x43d309){try{if(!_[_0x325f('0x8')](this['interaction']['UserId'])){logger[_0x325f('0x9')](_0x325f('0xa'),_0x503b57,_0x325f('0xb'));return _0x43d309[_0x325f('0xc')]();}var _0x3b592b={'ContactId':this['contact']['id'],'sentAt':moment()[_0x325f('0xd')](_0x325f('0xe')),'direction':_0x325f('0xf')};var _0x4e5b7f=this[_0x325f('0x10')];if(_0x4e5b7f===_0x325f('0x11')){_0x3b592b[_0x325f('0x12')]=this[_0x325f('0x13')]['id'];}else{_0x3b592b[_['upperFirst'](_0x4e5b7f)+_0x325f('0x14')]=this[_0x325f('0x13')]['id'];}_0x3b592b[_[_0x325f('0x15')](_0x4e5b7f)+_0x325f('0x16')]=this[_0x325f('0x17')]['id'];if(this['interaction']['created']){var _0x4668f9=_0x5bc11b[0x2];if(!_[_0x325f('0x18')](_0x4668f9)){_0x3b592b[_0x325f('0x19')]=utils[_0x325f('0x1a')](_0x4668f9,this);return rpc[_0x4e5b7f+_0x325f('0x1b')]['create'](_0x3b592b)[_0x325f('0x1c')](function(_0xffad26){logger['info'](_0x325f('0xa'),_0x503b57,_0x3b592b[_0x325f('0x19')]);})['catch'](function(_0x36f54f){logger[_0x325f('0x1d')](_0x325f('0xa'),_0x503b57,JSON['stringify'](_0x36f54f));})[_0x325f('0x1e')](function(){logger['info'](_0x325f('0x1f'),_0x503b57);_0x43d309[_0x325f('0x20')]();});}else{logger[_0x325f('0x9')](_0x325f('0x21'),_0x503b57);_0x43d309[_0x325f('0x20')]();}}else{var _0x56eed5=this;var _0x52ea20=apiai(_0x5bc11b[0x0],{'language':_0x5bc11b[0x1]||'en'});return _0x52ea20[_0x325f('0x22')](this[_0x325f('0x23')][_0x325f('0x19')],{'sessionId':md5(this['interaction']['id'])})['then'](function(_0x21b27a){_0x56eed5[_0x325f('0x19')][_0x325f('0x24')]=_0x21b27a;_0x3b592b[_0x325f('0x19')]=_0x21b27a['result'][_0x325f('0x25')][_0x325f('0x26')];return rpc[_0x4e5b7f+_0x325f('0x1b')][_0x325f('0x27')](_0x3b592b)[_0x325f('0x1c')](function(_0x3aa98a){logger[_0x325f('0x9')](_0x325f('0xa'),_0x503b57,_0x3b592b[_0x325f('0x19')]);if(_0x21b27a[_0x325f('0x28')][_0x325f('0x29')]['endConversation']){_0x43d309[_0x325f('0xc')]();}else{_0x43d309[_0x325f('0x20')]();}})[_0x325f('0x2a')](function(_0x5af43a){logger[_0x325f('0x1d')](_0x325f('0xa'),_0x503b57,JSON[_0x325f('0x2b')](_0x5af43a));_0x43d309['next']();});})[_0x325f('0x2a')](function(_0x547672){logger[_0x325f('0x1d')](_0x325f('0xa'),_0x503b57,_0x547672[_0x325f('0x23')]);_0x43d309[_0x325f('0xc')]();});}}catch(_0x1b2484){logger[_0x325f('0x1d')]('[%s][DIALOGFLOW]\x20%s',_0x503b57,JSON[_0x325f('0x2b')](_0x1b2484));_0x43d309['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotoif.js b/server/services/routing/server/applications/gotoif.js index e5533d4..a0e1850 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 _0x65f6=['lodash','html-to-text','./utils','../../../../config/logger','routing','string','priority\x20true\x20is\x20a\x20number','number','priority\x20false\x20is\x20a\x20number','consequence','fromString','replace','length','[%s][GOTOIF]\x20%s','message','condition','priorityFalse','info','next','findIndex','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','stop','error','stringify','validate'];(function(_0x26da89,_0x264785){var _0xc95b7b=function(_0x230e5b){while(--_0x230e5b){_0x26da89['push'](_0x26da89['shift']());}};_0xc95b7b(++_0x264785);}(_0x65f6,0x11d));var _0x665f=function(_0x4227e8,_0x4103e1){_0x4227e8=_0x4227e8-0x0;var _0x47ebe7=_0x65f6[_0x4227e8];return _0x47ebe7;};'use strict';var schema=require(_0x665f('0x0'));var _=require(_0x665f('0x1'));var htmlToText=require(_0x665f('0x2'));var utils=require(_0x665f('0x3'));var logger=require(_0x665f('0x4'))(_0x665f('0x5'));var gotoif=schema({'condition':{'type':_0x665f('0x6'),'required':!![],'message':'condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'priorityTrue':{'type':'number','message':_0x665f('0x7')},'priorityFalse':{'type':_0x665f('0x8'),'message':_0x665f('0x9')}});exports[_0x665f('0xa')]=function(_0x56c7ec,_0x1302e3){return function(_0x1d8e4f){try{var _0x7faa8a={'condition':htmlToText[_0x665f('0xb')](utils['getMustacheRender'](_0x1302e3[0x0],this),{'wordwrap':![]})[_0x665f('0xc')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x1302e3[0x1],'priorityFalse':_0x1302e3[0x2]};var _0x29b9d7=gotoif['validate'](_0x7faa8a,{'typecast':!![]});if(_0x29b9d7[_0x665f('0xd')]){logger['error'](_0x665f('0xe'),_0x56c7ec,_['map'](_0x29b9d7,_0x665f('0xf'))['join'](',\x20'));_0x1d8e4f['stop']();}else{try{var _0x284767=eval('('+_0x7faa8a[_0x665f('0x10')]+')');var _0x43bd9a=_0x284767?_0x7faa8a['priorityTrue']:_0x7faa8a[_0x665f('0x11')];logger[_0x665f('0x12')]('[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s',_0x56c7ec,_0x7faa8a[_0x665f('0x10')],_0x284767,_0x43bd9a||_0x665f('0x13'));if(_0x43bd9a){var _0x148311=_[_0x665f('0x14')](_0x1d8e4f['rules'](),{'p':_0x43bd9a});if(_0x148311>=0x0){logger[_0x665f('0x12')](_0x665f('0x15'),_0x56c7ec,_0x43bd9a||_0x665f('0x13'),_0x148311);_0x1d8e4f[_0x665f('0x13')](_0x148311);}else{logger[_0x665f('0x12')](_0x665f('0x16'),_0x56c7ec,_0x43bd9a||'next');_0x1d8e4f[_0x665f('0x17')]();}}else{_0x1d8e4f[_0x665f('0x13')]();}}catch(_0x434199){logger[_0x665f('0x18')]('[%s][GOTOIF]\x20eval\x20error:\x20%s',_0x56c7ec,_0x434199['message']);_0x1d8e4f['stop']();}}}catch(_0x11da2d){logger[_0x665f('0x18')](_0x665f('0xe'),_0x56c7ec,JSON[_0x665f('0x19')](_0x11da2d));_0x1d8e4f['stop']();}};}; \ No newline at end of file +var _0x89d4=['routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','fromString','getMustacheRender','replace','length','error','message','join','stop','condition','priorityTrue','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','findIndex','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','stringify','validate','html-to-text','./utils'];(function(_0x610a81,_0x34f514){var _0x53b967=function(_0x1cc41d){while(--_0x1cc41d){_0x610a81['push'](_0x610a81['shift']());}};_0x53b967(++_0x34f514);}(_0x89d4,0x11b));var _0x489d=function(_0x57975f,_0x388556){_0x57975f=_0x57975f-0x0;var _0x4793b8=_0x89d4[_0x57975f];return _0x4793b8;};'use strict';var schema=require(_0x489d('0x0'));var _=require('lodash');var htmlToText=require(_0x489d('0x1'));var utils=require(_0x489d('0x2'));var logger=require('../../../../config/logger')(_0x489d('0x3'));var gotoif=schema({'condition':{'type':_0x489d('0x4'),'required':!![],'message':_0x489d('0x5')},'priorityTrue':{'type':_0x489d('0x6'),'message':_0x489d('0x7')},'priorityFalse':{'type':_0x489d('0x6'),'message':_0x489d('0x8')}});exports['consequence']=function(_0x3fe280,_0x327689){return function(_0x4f22f4){try{var _0xdda00d={'condition':htmlToText[_0x489d('0x9')](utils[_0x489d('0xa')](_0x327689[0x0],this),{'wordwrap':![]})[_0x489d('0xb')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x327689[0x1],'priorityFalse':_0x327689[0x2]};var _0x35baab=gotoif[_0x489d('0x0')](_0xdda00d,{'typecast':!![]});if(_0x35baab[_0x489d('0xc')]){logger[_0x489d('0xd')]('[%s][GOTOIF]\x20%s',_0x3fe280,_['map'](_0x35baab,_0x489d('0xe'))[_0x489d('0xf')](',\x20'));_0x4f22f4[_0x489d('0x10')]();}else{try{var _0x566e35=eval('('+_0xdda00d[_0x489d('0x11')]+')');var _0x575994=_0x566e35?_0xdda00d[_0x489d('0x12')]:_0xdda00d['priorityFalse'];logger[_0x489d('0x13')](_0x489d('0x14'),_0x3fe280,_0xdda00d[_0x489d('0x11')],_0x566e35,_0x575994||_0x489d('0x15'));if(_0x575994){var _0x44019f=_[_0x489d('0x16')](_0x4f22f4[_0x489d('0x17')](),{'p':_0x575994});if(_0x44019f>=0x0){logger[_0x489d('0x13')](_0x489d('0x18'),_0x3fe280,_0x575994||_0x489d('0x15'),_0x44019f);_0x4f22f4[_0x489d('0x15')](_0x44019f);}else{logger[_0x489d('0x13')]('[%s][GOTOIF]\x20priority\x20%s\x20not\x20found',_0x3fe280,_0x575994||_0x489d('0x15'));_0x4f22f4[_0x489d('0x10')]();}}else{_0x4f22f4['next']();}}catch(_0x3839fe){logger[_0x489d('0xd')]('[%s][GOTOIF]\x20eval\x20error:\x20%s',_0x3fe280,_0x3839fe['message']);_0x4f22f4[_0x489d('0x10')]();}}}catch(_0x11ba1a){logger['error']('[%s][GOTOIF]\x20%s',_0x3fe280,JSON[_0x489d('0x19')](_0x11ba1a));_0x4f22f4['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 dabafd3..967b38b 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 _0x9f69=['priority','findIndex','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','stringify','validate','../../../../config/logger','routing','number','consequence','error','[%s][GOTOP]\x20%s','map','message','stop','info'];(function(_0x2e04ef,_0x31a596){var _0x5722b0=function(_0x386fbd){while(--_0x386fbd){_0x2e04ef['push'](_0x2e04ef['shift']());}};_0x5722b0(++_0x31a596);}(_0x9f69,0xd2));var _0x99f6=function(_0x55e111,_0x391f5a){_0x55e111=_0x55e111-0x0;var _0x30d69c=_0x9f69[_0x55e111];return _0x30d69c;};'use strict';var schema=require(_0x99f6('0x0'));var _=require('lodash');var logger=require(_0x99f6('0x1'))(_0x99f6('0x2'));var gotop=schema({'priority':{'type':_0x99f6('0x3'),'required':!![],'message':'priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required'}});exports[_0x99f6('0x4')]=function(_0xeeda17,_0x34587d){return function(_0x27b70d){try{var _0x3ebfd7={'priority':_0x34587d[0x0]};var _0x13848f=gotop[_0x99f6('0x0')](_0x3ebfd7,{'typecast':!![]});if(_0x13848f['length']){logger[_0x99f6('0x5')](_0x99f6('0x6'),_0xeeda17,_[_0x99f6('0x7')](_0x13848f,_0x99f6('0x8'))['join'](',\x20'));_0x27b70d[_0x99f6('0x9')]();}else{logger[_0x99f6('0xa')]('[%s][GOTOP]\x20priority\x20%s',_0xeeda17,_0x3ebfd7[_0x99f6('0xb')]);if(_0x3ebfd7[_0x99f6('0xb')]){var _0x3a9ccb=_[_0x99f6('0xc')](_0x27b70d[_0x99f6('0xd')](),{'p':_0x3ebfd7[_0x99f6('0xb')]});if(_0x3a9ccb>=0x0){logger['info'](_0x99f6('0xe'),_0xeeda17,_0x3ebfd7['priority']||_0x99f6('0xf'),_0x3a9ccb);_0x27b70d[_0x99f6('0xf')](_0x3a9ccb);}else{logger[_0x99f6('0xa')]('[%s][GOTOP]\x20priority\x20%s\x20not\x20found',_0xeeda17,_0x3ebfd7[_0x99f6('0xb')]||_0x99f6('0xf'));_0x27b70d['stop']();}}else{_0x27b70d['next']();}}}catch(_0x117199){logger['error'](_0x99f6('0x6'),_0xeeda17,JSON[_0x99f6('0x10')](_0x117199));_0x27b70d[_0x99f6('0x9')]();}};}; \ No newline at end of file +var _0xee14=['[%s][GOTOP]\x20%s','map','message','join','stop','info','[%s][GOTOP]\x20priority\x20%s','findIndex','rules','priority','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','error','stringify','validate','../../../../config/logger','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','length'];(function(_0x33e975,_0x3c9c10){var _0x2185ce=function(_0x41d8ee){while(--_0x41d8ee){_0x33e975['push'](_0x33e975['shift']());}};_0x2185ce(++_0x3c9c10);}(_0xee14,0x173));var _0x4ee1=function(_0x288260,_0x59857d){_0x288260=_0x288260-0x0;var _0x1f5318=_0xee14[_0x288260];return _0x1f5318;};'use strict';var schema=require(_0x4ee1('0x0'));var _=require('lodash');var logger=require(_0x4ee1('0x1'))(_0x4ee1('0x2'));var gotop=schema({'priority':{'type':_0x4ee1('0x3'),'required':!![],'message':_0x4ee1('0x4')}});exports[_0x4ee1('0x5')]=function(_0x812d18,_0x4c9ba6){return function(_0x470f36){try{var _0x6a2308={'priority':_0x4c9ba6[0x0]};var _0x1d0354=gotop[_0x4ee1('0x0')](_0x6a2308,{'typecast':!![]});if(_0x1d0354[_0x4ee1('0x6')]){logger['error'](_0x4ee1('0x7'),_0x812d18,_[_0x4ee1('0x8')](_0x1d0354,_0x4ee1('0x9'))[_0x4ee1('0xa')](',\x20'));_0x470f36[_0x4ee1('0xb')]();}else{logger[_0x4ee1('0xc')](_0x4ee1('0xd'),_0x812d18,_0x6a2308['priority']);if(_0x6a2308['priority']){var _0x103347=_[_0x4ee1('0xe')](_0x470f36[_0x4ee1('0xf')](),{'p':_0x6a2308[_0x4ee1('0x10')]});if(_0x103347>=0x0){logger[_0x4ee1('0xc')]('[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x812d18,_0x6a2308['priority']||_0x4ee1('0x11'),_0x103347);_0x470f36[_0x4ee1('0x11')](_0x103347);}else{logger[_0x4ee1('0xc')](_0x4ee1('0x12'),_0x812d18,_0x6a2308[_0x4ee1('0x10')]||_0x4ee1('0x11'));_0x470f36[_0x4ee1('0xb')]();}}else{_0x470f36[_0x4ee1('0x11')]();}}}catch(_0x547108){logger[_0x4ee1('0x13')](_0x4ee1('0x7'),_0x812d18,JSON[_0x4ee1('0x14')](_0x547108));_0x470f36['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 b3546ab..de542ec 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 _0xd111=['../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','consequence','getMustacheRender','contact','channel','chat','ChatWebsiteId','upperFirst','AccountId','account','interaction','create','body','next','catch','error','[%s][MESSAGE]\x20%s','stringify','stop','lodash','./utils'];(function(_0x3d2154,_0x66516f){var _0x3336f5=function(_0x100f35){while(--_0x100f35){_0x3d2154['push'](_0x3d2154['shift']());}};_0x3336f5(++_0x66516f);}(_0xd111,0x1c6));var _0x1d11=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd111[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x1d11('0x0'));var utils=require(_0x1d11('0x1'));var logger=require(_0x1d11('0x2'))('routing');var rpc={'chatMessage':require(_0x1d11('0x3')),'openchannelMessage':require(_0x1d11('0x4')),'mailMessage':require(_0x1d11('0x5')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require('../../rpc/faxMessage')};exports[_0x1d11('0x6')]=function(_0x27a041,_0x50c7b8){return function(_0x3acf2a){try{var _0x152fb5={'body':utils[_0x1d11('0x7')](_0x50c7b8[0x0],this),'ContactId':this[_0x1d11('0x8')]['id']};if(this[_0x1d11('0x9')]===_0x1d11('0xa')){_0x152fb5[_0x1d11('0xb')]=this['account']['id'];}else{_0x152fb5[_[_0x1d11('0xc')](this[_0x1d11('0x9')])+_0x1d11('0xd')]=this[_0x1d11('0xe')]['id'];}_0x152fb5[_['upperFirst'](this['channel'])+'InteractionId']=this[_0x1d11('0xf')]['id'];if(rpc[this['channel']+'Message']){return rpc[this[_0x1d11('0x9')]+'Message'][_0x1d11('0x10')](_0x152fb5)['then'](function(_0x24c9cd){logger['info']('[%s][MESSAGE]\x20%s',_0x27a041,_0x152fb5[_0x1d11('0x11')]);_0x3acf2a[_0x1d11('0x12')]();})[_0x1d11('0x13')](function(_0x192806){logger[_0x1d11('0x14')](_0x1d11('0x15'),_0x27a041,JSON[_0x1d11('0x16')](_0x192806));_0x3acf2a[_0x1d11('0x17')]();});}}catch(_0x57759b){logger[_0x1d11('0x14')](_0x1d11('0x15'),_0x27a041,JSON[_0x1d11('0x16')](_0x57759b));_0x3acf2a[_0x1d11('0x17')]();}};}; \ No newline at end of file +var _0xc21e=['../../rpc/smsMessage','consequence','getMustacheRender','contact','channel','ChatWebsiteId','account','AccountId','upperFirst','interaction','Message','create','then','info','[%s][MESSAGE]\x20%s','next','catch','error','stringify','stop','lodash','./utils','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage'];(function(_0x47fd36,_0x41535d){var _0x21a0fc=function(_0x44c07c){while(--_0x44c07c){_0x47fd36['push'](_0x47fd36['shift']());}};_0x21a0fc(++_0x41535d);}(_0xc21e,0x140));var _0xec21=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xc21e[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0xec21('0x0'));var utils=require(_0xec21('0x1'));var logger=require('../../../../config/logger')('routing');var rpc={'chatMessage':require(_0xec21('0x2')),'openchannelMessage':require(_0xec21('0x3')),'mailMessage':require(_0xec21('0x4')),'smsMessage':require(_0xec21('0x5')),'faxMessage':require('../../rpc/faxMessage')};exports[_0xec21('0x6')]=function(_0x217acd,_0x2c1786){return function(_0x52fcf7){try{var _0xe2c74={'body':utils[_0xec21('0x7')](_0x2c1786[0x0],this),'ContactId':this[_0xec21('0x8')]['id']};if(this[_0xec21('0x9')]==='chat'){_0xe2c74[_0xec21('0xa')]=this[_0xec21('0xb')]['id'];}else{_0xe2c74[_['upperFirst'](this[_0xec21('0x9')])+_0xec21('0xc')]=this[_0xec21('0xb')]['id'];}_0xe2c74[_[_0xec21('0xd')](this['channel'])+'InteractionId']=this[_0xec21('0xe')]['id'];if(rpc[this[_0xec21('0x9')]+'Message']){return rpc[this[_0xec21('0x9')]+_0xec21('0xf')][_0xec21('0x10')](_0xe2c74)[_0xec21('0x11')](function(_0x454244){logger[_0xec21('0x12')](_0xec21('0x13'),_0x217acd,_0xe2c74['body']);_0x52fcf7[_0xec21('0x14')]();})[_0xec21('0x15')](function(_0x564f42){logger[_0xec21('0x16')](_0xec21('0x13'),_0x217acd,JSON[_0xec21('0x17')](_0x564f42));_0x52fcf7[_0xec21('0x18')]();});}}catch(_0x4b05c6){logger[_0xec21('0x16')](_0xec21('0x13'),_0x217acd,JSON[_0xec21('0x17')](_0x4b05c6));_0x52fcf7['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 b604ce9..cd1426c 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 _0x06b6=['stop','./utils','../../../../config/logger','consequence','info','[%s][NOOP]\x20%s','getMustacheRender','next','error','stringify'];(function(_0x18c1e2,_0x5b4682){var _0x5ed93c=function(_0x248153){while(--_0x248153){_0x18c1e2['push'](_0x18c1e2['shift']());}};_0x5ed93c(++_0x5b4682);}(_0x06b6,0xe7));var _0x606b=function(_0x14f83c,_0x509c7c){_0x14f83c=_0x14f83c-0x0;var _0x2de6d1=_0x06b6[_0x14f83c];return _0x2de6d1;};'use strict';var utils=require(_0x606b('0x0'));var logger=require(_0x606b('0x1'))('routing');exports[_0x606b('0x2')]=function(_0x1edfec,_0x36d4fc){return function(_0x5012ba){try{logger[_0x606b('0x3')](_0x606b('0x4'),_0x1edfec,utils[_0x606b('0x5')](_0x36d4fc[0x0],this));_0x5012ba[_0x606b('0x6')]();}catch(_0x122c0e){logger[_0x606b('0x7')](_0x606b('0x4'),_0x1edfec,JSON[_0x606b('0x8')](_0x122c0e));_0x5012ba[_0x606b('0x9')]();}};}; \ No newline at end of file +var _0xc7ef=['routing','consequence','info','[%s][NOOP]\x20%s','getMustacheRender','next','error','stringify','stop','./utils','../../../../config/logger'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xc7ef,0x1cc));var _0xfc7e=function(_0x5361e4,_0x1a7ac1){_0x5361e4=_0x5361e4-0x0;var _0x371493=_0xc7ef[_0x5361e4];return _0x371493;};'use strict';var utils=require(_0xfc7e('0x0'));var logger=require(_0xfc7e('0x1'))(_0xfc7e('0x2'));exports[_0xfc7e('0x3')]=function(_0x499229,_0x5bf58b){return function(_0x105c0f){try{logger[_0xfc7e('0x4')](_0xfc7e('0x5'),_0x499229,utils[_0xfc7e('0x6')](_0x5bf58b[0x0],this));_0x105c0f[_0xfc7e('0x7')]();}catch(_0x50a88b){logger[_0xfc7e('0x8')]('[%s][NOOP]\x20%s',_0x499229,JSON[_0xfc7e('0x9')](_0x50a88b));_0x105c0f[_0xfc7e('0xa')]();}};}; \ 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 1a9a323..dc179bb 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 _0x878f=['interaction','MessageId','message','chat','AccountId','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','create','create\x20queue\x20report','waiting','accepted','[%s][STOP:QUEUE][NAME:%s]','QueueReport','catch','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','update','toLowerCase','validate','length','error','[%s][QUEUE]\x20%s','map','join','stop','find','Queues','createQueue','qtimeout','rules','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','[%s][QUEUE]\x20APPLICATION\x20END','next','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','stack','lodash','util','seq-queue','moment','ioredis','../../../../config/environment','../../../../config/logger','routing','./strategy','redis','defaults','socket.io-emitter','from','emit','queue_id','queue','account','%sQueuesWaitingInteractions','pick','format','%s:queue:%s','%s_queue_waiting_interaction:%s','save','remove','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel','QueueId'];(function(_0x1d89cf,_0x4aa07c){var _0x4f0adf=function(_0x1cc4d8){while(--_0x1cc4d8){_0x1d89cf['push'](_0x1d89cf['shift']());}};_0x4f0adf(++_0x4aa07c);}(_0x878f,0x173));var _0xf878=function(_0x3ddf3f,_0xfc9c8a){_0x3ddf3f=_0x3ddf3f-0x0;var _0x45ecc7=_0x878f[_0x3ddf3f];return _0x45ecc7;};'use strict';var schema=require('validate');var _=require(_0xf878('0x0'));var util=require(_0xf878('0x1'));var seqqueue=require(_0xf878('0x2'));var moment=require(_0xf878('0x3'));var Redis=require(_0xf878('0x4'));var config=require(_0xf878('0x5'));var logger=require(_0xf878('0x6'))(_0xf878('0x7'));var strategy=require(_0xf878('0x8'));config[_0xf878('0x9')]=_[_0xf878('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xf878('0xb'))(new Redis(config[_0xf878('0x9')]));var attributes=['id','queue_id','account','queue',_0xf878('0xc'),'joinAt'];function emit(_0x4a9d79,_0x307653,_0x2e6931){io['to'](_0x4a9d79)[_0xf878('0xd')](_0x307653,_0x2e6931);}function emitChannelQueueInteraction(_0x52edde,_0xb2863e,_0x1399a3,_0x531b9c,_0xdf76,_0x4f7e7f,_0x31d3d2,_0x97c396){var _0x339c9c=_['clone'](_0x1399a3);_0x339c9c[_0xf878('0xe')]=_0x97c396;_0x339c9c[_0xf878('0xf')]=_0xb2863e;_0x339c9c[_0xf878('0x10')]=_0x531b9c;_0x339c9c['id']=_0xdf76;if(_0x4f7e7f){_0x31d3d2[util['format'](_0xf878('0x11'),_0x52edde)][_0xdf76]=_[_0xf878('0x12')](_0x339c9c,attributes);}else{delete _0x31d3d2[util[_0xf878('0x13')]('%sQueuesWaitingInteractions',_0x52edde)][_0xdf76];}emit(util['format'](_0xf878('0x14'),_0x52edde,_0xb2863e),util[_0xf878('0x13')](_0xf878('0x15'),_0x52edde,_0x4f7e7f?_0xf878('0x16'):_0xf878('0x17')),_[_0xf878('0x12')](_0x339c9c,attributes));}var rpc={'openchannelQueueReport':require(_0xf878('0x18')),'mailQueueReport':require(_0xf878('0x19')),'chatQueueReport':require(_0xf878('0x1a')),'smsQueueReport':require(_0xf878('0x1b')),'faxQueueReport':require(_0xf878('0x1c'))};var queue=schema({'name':{'type':'string','required':!![],'message':_0xf878('0x1d')},'timeout':{'type':_0xf878('0x1e'),'message':_0xf878('0x1f')}});function startRouting(_0x622ea8,_0x3714f6,_0x237d15,_0x17089c){if(_0x622ea8&&_0x3714f6&&_0x237d15){_0x3714f6['waiting']+=0x1;var _0x73f6bf={'uniqueid':_0x622ea8,'from':_0x237d15[_0xf878('0x20')]?_0x237d15[_0xf878('0x20')]['from']:'','joinAt':moment()[_0xf878('0x13')](_0xf878('0x21')),'ContactId':_0x237d15[_0xf878('0x22')]?_0x237d15[_0xf878('0x22')]['id']:null,'ListId':_0x237d15[_0xf878('0x23')]?_0x237d15[_0xf878('0x23')]['id']:null};_0x73f6bf[_[_0xf878('0x24')](_0x237d15[_0xf878('0x25')])+_0xf878('0x26')]=_0x3714f6['id']||null;_0x73f6bf[_[_0xf878('0x24')](_0x237d15[_0xf878('0x25')])+'InteractionId']=_0x237d15[_0xf878('0x27')]?_0x237d15['interaction']['id']:null;_0x73f6bf[_[_0xf878('0x24')](_0x237d15[_0xf878('0x25')])+_0xf878('0x28')]=_0x237d15[_0xf878('0x29')]?_0x237d15[_0xf878('0x29')]['id']:null;_0x73f6bf[_['upperFirst'](_0x237d15['channel'])+(_0x237d15['channel']!==_0xf878('0x2a')?_0xf878('0x2b'):_0xf878('0x2c'))]=_0x237d15['account']?_0x237d15[_0xf878('0x10')]['id']:null;logger[_0xf878('0x2d')](util[_0xf878('0x13')](_0xf878('0x2e'),_0x622ea8,_0x3714f6[_0xf878('0x2f')]));emitChannelQueueInteraction(_0x237d15['channel'],_0x3714f6['name'],_0x73f6bf,_0x237d15[_0xf878('0x10')][_0xf878('0x2f')],_0x237d15['message']['id'],!![],_0x17089c,_0x3714f6['id']);if(rpc[_0x237d15[_0xf878('0x25')]+'QueueReport']){return rpc[_0x237d15[_0xf878('0x25')]+'QueueReport'][_0xf878('0x30')](_0x73f6bf)['catch'](function(_0x2630fb){logger['error'](_0xf878('0x31'));});}}}function stopRouting(_0x2cadd3,_0x233a00,_0x1f5331,_0x27c53b){if(_0x2cadd3&&_0x233a00){_0x233a00[_0xf878('0x32')]-=0x1;var _0x5aed48={'leaveAt':moment()[_0xf878('0x13')](_0xf878('0x21')),'acceptAt':moment()[_0xf878('0x13')](_0xf878('0x21')),'reason':_0xf878('0x33')};logger['info'](util[_0xf878('0x13')](_0xf878('0x34'),_0x2cadd3,_0x233a00['name']));emitChannelQueueInteraction(_0x1f5331[_0xf878('0x25')],_0x233a00[_0xf878('0x2f')],_0x1f5331[_0xf878('0x20')],_0x1f5331[_0xf878('0x10')][_0xf878('0x2f')],_0x1f5331['message']['id'],![],_0x27c53b,_0x233a00['id']);if(rpc[_0x1f5331[_0xf878('0x25')]+_0xf878('0x35')]){return rpc[_0x1f5331[_0xf878('0x25')]+_0xf878('0x35')]['update'](_0x2cadd3,_0x5aed48)[_0xf878('0x36')](function(_0x5a6330){logger['error'](_0xf878('0x37'));});}}}function endRouting(_0x2c628e,_0x8b6230,_0x105416,_0x20f415){if(_0x2c628e&&_0x8b6230){_0x8b6230['waiting']-=0x1;var _0xc2d7ef={'leaveAt':moment()['format'](_0xf878('0x21')),'exitAt':moment()[_0xf878('0x13')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0xf878('0x38')};logger[_0xf878('0x2d')](util['format'](_0xf878('0x39'),_0x2c628e,_0x8b6230[_0xf878('0x2f')]));emitChannelQueueInteraction(_0x105416['channel'],_0x8b6230[_0xf878('0x2f')],_0x105416[_0xf878('0x20')],_0x105416[_0xf878('0x10')][_0xf878('0x2f')],_0x105416[_0xf878('0x29')]['id'],![],_0x20f415);if(rpc[_0x105416[_0xf878('0x25')]+_0xf878('0x35')]){return rpc[_0x105416['channel']+_0xf878('0x35')][_0xf878('0x3a')](_0x2c628e,_0xc2d7ef)['catch'](function(_0x226e8b){logger['error']('update\x20queue\x20report');});}}}function handleFindQueue(_0x2ec109){return function(_0x379fc1){return _0x379fc1[_0xf878('0x2f')][_0xf878('0x3b')]()===_0x2ec109[_0xf878('0x3b')]();};}exports['consequence']=function(_0x3629c3,_0x4c4ae4,_0xb09736,_0x2801b0){return function(_0x4f6be1){try{var _0x5517c9={'name':_0x4c4ae4[0x0],'timeout':_0x4c4ae4[0x1]};var _0x180594=queue[_0xf878('0x3c')](_0x5517c9,{'typecast':!![]});if(_0x180594[_0xf878('0x3d')]){logger[_0xf878('0x3e')](_0xf878('0x3f'),_0x3629c3,_[_0xf878('0x40')](_0x180594,_0xf878('0x29'))[_0xf878('0x41')](',\x20'));_0x4f6be1[_0xf878('0x42')]();}else{var _0x5444eb=_[_0xf878('0x43')](_0xb09736[_0x2801b0[_0xf878('0x25')]+_0xf878('0x44')],handleFindQueue(_0x5517c9[_0xf878('0x2f')]));if(_0x5444eb){startRouting(_0x3629c3,_0x5444eb,_0x2801b0,_0xb09736);var _0x3714a6=(_0x5444eb[_0xf878('0x38')]||0xa)*0x3e8;var _0x47dbfa=(_0x5517c9[_0xf878('0x38')]||0x14)*0x3e8;var _0xf055ce,_0x1f57d0;if(_0x3714a6>_0x47dbfa){_0x47dbfa=_0x3714a6;}var _0xc49e70=seqqueue[_0xf878('0x45')](_0x3714a6);_0xc49e70['id']=_0x3629c3;_0xc49e70['atimeout']=_0x3714a6;_0xc49e70[_0xf878('0x46')]=_0x47dbfa;_0xc49e70[_0xf878('0x25')]=_0x2801b0[_0xf878('0x25')];_0xb09736[_0xf878('0x47')][_0x3629c3]['on']('end',function(){logger[_0xf878('0x2d')](_0xf878('0x48'),_0x3629c3);stopRouting(_0x3629c3,_0x5444eb,_0x2801b0,_0xb09736);clearTimeout(_0xf055ce);_0xf055ce=undefined;_0xc49e70[_0xf878('0x49')](!![]);if(_0xb09736['rules'][_0x3629c3]){delete _0xb09736['rules'][_0x3629c3];}_0x4f6be1[_0xf878('0x42')]();});_0xb09736['rules'][_0x3629c3]['on']('complete',function(){if(_0xb09736['rules'][_0x3629c3]){delete _0xb09736[_0xf878('0x47')][_0x3629c3];}});_0xf055ce=setTimeout(function(){logger['info'](_0xf878('0x4a'),_0x3629c3);endRouting(_0x3629c3,_0x5444eb,_0x2801b0,_0xb09736);clearTimeout(_0xf055ce);_0xc49e70[_0xf878('0x49')](!![]);_0x4f6be1[_0xf878('0x4b')]();},_0x47dbfa);switch(_0x5444eb[_0xf878('0x4c')]){case _0xf878('0x4d'):strategy[_0xf878('0x4d')](_0xc49e70,_0x5444eb,_0xb09736,_0x2801b0);break;default:strategy[_0xf878('0x4e')](_0xc49e70,_0x5444eb,_0xb09736,_0x2801b0);}}else{logger['error'](_0xf878('0x4f'),_0x3629c3,_0x5517c9[_0xf878('0x2f')]);_0x4f6be1[_0xf878('0x42')]();}}}catch(_0x227dd7){console[_0xf878('0x50')](_0x227dd7);logger['error']('[%s][QUEUE]\x20%s',_0x3629c3,_0x227dd7[_0xf878('0x51')]);_0x4f6be1[_0xf878('0x42')]();}};}; \ No newline at end of file +var _0xac4a=['accepted','[%s][STOP:QUEUE][NAME:%s]','update','update\x20queue\x20report','timeout','toLowerCase','consequence','length','[%s][QUEUE]\x20%s','map','stop','find','atimeout','qtimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','[%s][QUEUE]\x20APPLICATION\x20END','rrmemory','beepall','log','stack','validate','lodash','util','seq-queue','moment','ioredis','routing','./strategy','redis','socket.io-emitter','queue_id','account','joinAt','clone','queue','%sQueuesWaitingInteractions','pick','format','%s:queue:%s','%s_queue_waiting_interaction:%s','save','remove','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/smsQueueReport','string','number','timeout\x20is\x20a\x20number','waiting','body','from','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','QueueId','channel','InteractionId','interaction','MessageId','chat','AccountId','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','message','QueueReport','catch','error','create\x20queue\x20report'];(function(_0x1f68fe,_0x501166){var _0x22e3aa=function(_0x58cbad){while(--_0x58cbad){_0x1f68fe['push'](_0x1f68fe['shift']());}};_0x22e3aa(++_0x501166);}(_0xac4a,0x13f));var _0xaac4=function(_0x3ed767,_0x16f1c4){_0x3ed767=_0x3ed767-0x0;var _0x267fe5=_0xac4a[_0x3ed767];return _0x267fe5;};'use strict';var schema=require(_0xaac4('0x0'));var _=require(_0xaac4('0x1'));var util=require(_0xaac4('0x2'));var seqqueue=require(_0xaac4('0x3'));var moment=require(_0xaac4('0x4'));var Redis=require(_0xaac4('0x5'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0xaac4('0x6'));var strategy=require(_0xaac4('0x7'));config[_0xaac4('0x8')]=_['defaults'](config[_0xaac4('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0xaac4('0x9'))(new Redis(config['redis']));var attributes=['id',_0xaac4('0xa'),_0xaac4('0xb'),'queue','from',_0xaac4('0xc')];function emit(_0x50d114,_0x452573,_0x59b992){io['to'](_0x50d114)['emit'](_0x452573,_0x59b992);}function emitChannelQueueInteraction(_0xeb6b9a,_0x22cea4,_0x38d1d0,_0x5f393e,_0x3a983c,_0x4e0f72,_0x508e14,_0x2348c2){var _0x2e2d02=_[_0xaac4('0xd')](_0x38d1d0);_0x2e2d02['queue_id']=_0x2348c2;_0x2e2d02[_0xaac4('0xe')]=_0x22cea4;_0x2e2d02[_0xaac4('0xb')]=_0x5f393e;_0x2e2d02['id']=_0x3a983c;if(_0x4e0f72){_0x508e14[util['format'](_0xaac4('0xf'),_0xeb6b9a)][_0x3a983c]=_[_0xaac4('0x10')](_0x2e2d02,attributes);}else{delete _0x508e14[util[_0xaac4('0x11')](_0xaac4('0xf'),_0xeb6b9a)][_0x3a983c];}emit(util[_0xaac4('0x11')](_0xaac4('0x12'),_0xeb6b9a,_0x22cea4),util[_0xaac4('0x11')](_0xaac4('0x13'),_0xeb6b9a,_0x4e0f72?_0xaac4('0x14'):_0xaac4('0x15')),_[_0xaac4('0x10')](_0x2e2d02,attributes));}var rpc={'openchannelQueueReport':require(_0xaac4('0x16')),'mailQueueReport':require(_0xaac4('0x17')),'chatQueueReport':require('../../rpc/chatQueueReport'),'smsQueueReport':require(_0xaac4('0x18')),'faxQueueReport':require('../../rpc/faxQueueReport')};var queue=schema({'name':{'type':_0xaac4('0x19'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0xaac4('0x1a'),'message':_0xaac4('0x1b')}});function startRouting(_0xa22b76,_0x271bcb,_0x3cbcb1,_0x2f3deb){if(_0xa22b76&&_0x271bcb&&_0x3cbcb1){_0x271bcb[_0xaac4('0x1c')]+=0x1;var _0x25b946={'uniqueid':_0xa22b76,'from':_0x3cbcb1[_0xaac4('0x1d')]?_0x3cbcb1['body'][_0xaac4('0x1e')]:'','joinAt':moment()['format'](_0xaac4('0x1f')),'ContactId':_0x3cbcb1[_0xaac4('0x20')]?_0x3cbcb1[_0xaac4('0x20')]['id']:null,'ListId':_0x3cbcb1[_0xaac4('0x21')]?_0x3cbcb1[_0xaac4('0x21')]['id']:null};_0x25b946[_[_0xaac4('0x22')](_0x3cbcb1['channel'])+_0xaac4('0x23')]=_0x271bcb['id']||null;_0x25b946[_[_0xaac4('0x22')](_0x3cbcb1[_0xaac4('0x24')])+_0xaac4('0x25')]=_0x3cbcb1[_0xaac4('0x26')]?_0x3cbcb1[_0xaac4('0x26')]['id']:null;_0x25b946[_[_0xaac4('0x22')](_0x3cbcb1['channel'])+_0xaac4('0x27')]=_0x3cbcb1['message']?_0x3cbcb1['message']['id']:null;_0x25b946[_['upperFirst'](_0x3cbcb1['channel'])+(_0x3cbcb1[_0xaac4('0x24')]!==_0xaac4('0x28')?_0xaac4('0x29'):_0xaac4('0x2a'))]=_0x3cbcb1[_0xaac4('0xb')]?_0x3cbcb1[_0xaac4('0xb')]['id']:null;logger[_0xaac4('0x2b')](util[_0xaac4('0x11')](_0xaac4('0x2c'),_0xa22b76,_0x271bcb[_0xaac4('0x2d')]));emitChannelQueueInteraction(_0x3cbcb1['channel'],_0x271bcb[_0xaac4('0x2d')],_0x25b946,_0x3cbcb1[_0xaac4('0xb')][_0xaac4('0x2d')],_0x3cbcb1[_0xaac4('0x2e')]['id'],!![],_0x2f3deb,_0x271bcb['id']);if(rpc[_0x3cbcb1[_0xaac4('0x24')]+_0xaac4('0x2f')]){return rpc[_0x3cbcb1['channel']+_0xaac4('0x2f')]['create'](_0x25b946)[_0xaac4('0x30')](function(_0xab5d04){logger[_0xaac4('0x31')](_0xaac4('0x32'));});}}}function stopRouting(_0x48bf50,_0x5000e1,_0x58f748,_0x20abcc){if(_0x48bf50&&_0x5000e1){_0x5000e1[_0xaac4('0x1c')]-=0x1;var _0x2df196={'leaveAt':moment()[_0xaac4('0x11')](_0xaac4('0x1f')),'acceptAt':moment()[_0xaac4('0x11')](_0xaac4('0x1f')),'reason':_0xaac4('0x33')};logger[_0xaac4('0x2b')](util[_0xaac4('0x11')](_0xaac4('0x34'),_0x48bf50,_0x5000e1[_0xaac4('0x2d')]));emitChannelQueueInteraction(_0x58f748[_0xaac4('0x24')],_0x5000e1[_0xaac4('0x2d')],_0x58f748[_0xaac4('0x1d')],_0x58f748['account']['name'],_0x58f748[_0xaac4('0x2e')]['id'],![],_0x20abcc,_0x5000e1['id']);if(rpc[_0x58f748[_0xaac4('0x24')]+_0xaac4('0x2f')]){return rpc[_0x58f748['channel']+_0xaac4('0x2f')][_0xaac4('0x35')](_0x48bf50,_0x2df196)[_0xaac4('0x30')](function(_0x1bce61){logger[_0xaac4('0x31')](_0xaac4('0x36'));});}}}function endRouting(_0x418939,_0x53b7cb,_0x36591a,_0x31ec51){if(_0x418939&&_0x53b7cb){_0x53b7cb[_0xaac4('0x1c')]-=0x1;var _0x5d64a2={'leaveAt':moment()[_0xaac4('0x11')]('YYYY-MM-DD\x20HH:mm:ss'),'exitAt':moment()['format'](_0xaac4('0x1f')),'reason':_0xaac4('0x37')};logger[_0xaac4('0x2b')](util['format']('[%s][END:QUEUE][NAME:%s]',_0x418939,_0x53b7cb[_0xaac4('0x2d')]));emitChannelQueueInteraction(_0x36591a[_0xaac4('0x24')],_0x53b7cb[_0xaac4('0x2d')],_0x36591a[_0xaac4('0x1d')],_0x36591a[_0xaac4('0xb')][_0xaac4('0x2d')],_0x36591a['message']['id'],![],_0x31ec51);if(rpc[_0x36591a['channel']+_0xaac4('0x2f')]){return rpc[_0x36591a[_0xaac4('0x24')]+'QueueReport'][_0xaac4('0x35')](_0x418939,_0x5d64a2)[_0xaac4('0x30')](function(_0x210d26){logger['error'](_0xaac4('0x36'));});}}}function handleFindQueue(_0x4a4773){return function(_0x2259fc){return _0x2259fc['name'][_0xaac4('0x38')]()===_0x4a4773[_0xaac4('0x38')]();};}exports[_0xaac4('0x39')]=function(_0x33bf83,_0x51e59d,_0x247fea,_0x4a59a8){return function(_0x50f410){try{var _0xaa7749={'name':_0x51e59d[0x0],'timeout':_0x51e59d[0x1]};var _0x31e240=queue[_0xaac4('0x0')](_0xaa7749,{'typecast':!![]});if(_0x31e240[_0xaac4('0x3a')]){logger[_0xaac4('0x31')](_0xaac4('0x3b'),_0x33bf83,_[_0xaac4('0x3c')](_0x31e240,_0xaac4('0x2e'))['join'](',\x20'));_0x50f410[_0xaac4('0x3d')]();}else{var _0x36ac31=_[_0xaac4('0x3e')](_0x247fea[_0x4a59a8[_0xaac4('0x24')]+'Queues'],handleFindQueue(_0xaa7749[_0xaac4('0x2d')]));if(_0x36ac31){startRouting(_0x33bf83,_0x36ac31,_0x4a59a8,_0x247fea);var _0x12944f=(_0x36ac31[_0xaac4('0x37')]||0xa)*0x3e8;var _0x48faff=(_0xaa7749[_0xaac4('0x37')]||0x14)*0x3e8;var _0xf7fc2b,_0x141eb9;if(_0x12944f>_0x48faff){_0x48faff=_0x12944f;}var _0x2b9030=seqqueue['createQueue'](_0x12944f);_0x2b9030['id']=_0x33bf83;_0x2b9030[_0xaac4('0x3f')]=_0x12944f;_0x2b9030[_0xaac4('0x40')]=_0x48faff;_0x2b9030[_0xaac4('0x24')]=_0x4a59a8['channel'];_0x247fea[_0xaac4('0x41')][_0x33bf83]['on'](_0xaac4('0x42'),function(){logger[_0xaac4('0x2b')](_0xaac4('0x43'),_0x33bf83);stopRouting(_0x33bf83,_0x36ac31,_0x4a59a8,_0x247fea);clearTimeout(_0xf7fc2b);_0xf7fc2b=undefined;_0x2b9030[_0xaac4('0x44')](!![]);if(_0x247fea[_0xaac4('0x41')][_0x33bf83]){delete _0x247fea[_0xaac4('0x41')][_0x33bf83];}_0x50f410[_0xaac4('0x3d')]();});_0x247fea[_0xaac4('0x41')][_0x33bf83]['on']('complete',function(){if(_0x247fea[_0xaac4('0x41')][_0x33bf83]){delete _0x247fea[_0xaac4('0x41')][_0x33bf83];}});_0xf7fc2b=setTimeout(function(){logger[_0xaac4('0x2b')](_0xaac4('0x45'),_0x33bf83);endRouting(_0x33bf83,_0x36ac31,_0x4a59a8,_0x247fea);clearTimeout(_0xf7fc2b);_0x2b9030[_0xaac4('0x44')](!![]);_0x50f410['next']();},_0x48faff);switch(_0x36ac31['strategy']){case _0xaac4('0x46'):strategy[_0xaac4('0x46')](_0x2b9030,_0x36ac31,_0x247fea,_0x4a59a8);break;default:strategy[_0xaac4('0x47')](_0x2b9030,_0x36ac31,_0x247fea,_0x4a59a8);}}else{logger[_0xaac4('0x31')]('[%s][QUEUE]\x20queue\x20not\x20found\x20%s',_0x33bf83,_0xaa7749[_0xaac4('0x2d')]);_0x50f410['stop']();}}}catch(_0x216eb2){console[_0xaac4('0x48')](_0x216eb2);logger['error'](_0xaac4('0x3b'),_0x33bf83,_0x216eb2[_0xaac4('0x49')]);_0x50f410[_0xaac4('0x3d')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/agent.js b/server/services/routing/server/applications/strategy/agent.js index fb7c1d3..6fba113 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 _0x68ef=['[%s][AGENT]\x20timeout\x20with\x20%s','STOP','exports','lodash','./util','../../../../../config/logger','routing','notificationId','squeue','agent','realtime','push','handleRun','handleTimeout','bind','timeout','drained','prototype','[%s][AGENT]\x20try\x20with\x20%s','isNil','agents','info','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','channel','busy','busyQueue','writeLog','RINGING','forcedOwnership',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available'];(function(_0xe30235,_0x21f212){var _0x11da7f=function(_0x5e88f6){while(--_0x5e88f6){_0xe30235['push'](_0xe30235['shift']());}};_0x11da7f(++_0x21f212);}(_0x68ef,0x196));var _0xf68e=function(_0x190c5b,_0x50e7c1){_0x190c5b=_0x190c5b-0x0;var _0x1ef1bb=_0x68ef[_0x190c5b];return _0x1ef1bb;};'use strict';var _=require(_0xf68e('0x0'));var uuid=require('uuid');var util=require(_0xf68e('0x1'));var logger=require(_0xf68e('0x2'))(_0xf68e('0x3'));var Agent=function(_0x4e8672,_0x1d2af0,_0x352711,_0x44d760){this[_0xf68e('0x4')]=uuid['v4']();this[_0xf68e('0x5')]=_0x4e8672;this[_0xf68e('0x6')]=_0x1d2af0;this[_0xf68e('0x7')]=_0x352711;this[_0xf68e('0x3')]=_0x44d760;this[_0xf68e('0x5')][_0xf68e('0x8')](this[_0xf68e('0x9')]['bind'](this),this[_0xf68e('0xa')][_0xf68e('0xb')](this));this['squeue']['on'](_0xf68e('0xc'),this[_0xf68e('0xa')][_0xf68e('0xb')](this));this[_0xf68e('0x5')]['on'](_0xf68e('0xd'),this['handleDrained'][_0xf68e('0xb')](this));};Agent[_0xf68e('0xe')][_0xf68e('0x8')]=function(){this['squeue'][_0xf68e('0x8')](this['handleRun']['bind'](this),this[_0xf68e('0xa')][_0xf68e('0xb')](this));};Agent[_0xf68e('0xe')]['handleDrained']=function(){this[_0xf68e('0xa')](!![]);};Agent[_0xf68e('0xe')][_0xf68e('0x9')]=function(_0x5b6d57){logger['info'](_0xf68e('0xf'),this['squeue']['id'],this['agent']['id']);if(_[_0xf68e('0x10')](this[_0xf68e('0x7')][_0xf68e('0x11')][this[_0xf68e('0x6')]['id']])){logger[_0xf68e('0x12')](_0xf68e('0x13'),this[_0xf68e('0x5')]['id'],this['agent']['id']);setTimeout(this[_0xf68e('0x8')]['bind'](this),0x3e8);}else{if(this[_0xf68e('0x3')]['forcedOwnership']||util['isAgentAvailable'](this['squeue']['id'],this[_0xf68e('0x7')]['agents'][this['agent']['id']],this[_0xf68e('0x5')][_0xf68e('0x14')],![])){this[_0xf68e('0x7')][_0xf68e('0x11')][this[_0xf68e('0x6')]['id']][_0xf68e('0x15')]=!![];this[_0xf68e('0x7')][_0xf68e('0x11')][this[_0xf68e('0x6')]['id']][_0xf68e('0x16')]=undefined;util['showNotification'](this[_0xf68e('0x4')],this[_0xf68e('0x5')]['id'],this[_0xf68e('0x7')][_0xf68e('0x11')][this[_0xf68e('0x6')]['id']],null,this['routing']);util[_0xf68e('0x17')](this['squeue']['id'],this[_0xf68e('0x7')][_0xf68e('0x11')][this[_0xf68e('0x6')]['id']],_0xf68e('0x18')+(this[_0xf68e('0x3')][_0xf68e('0x19')]?_0xf68e('0x1a'):''));}else{logger[_0xf68e('0x12')](_0xf68e('0x1b'),this[_0xf68e('0x5')]['id'],this['agent']['id']);setTimeout(this['push'][_0xf68e('0xb')](this),0x3e8);}}};Agent[_0xf68e('0xe')][_0xf68e('0xa')]=function(_0x6b0254){if(_[_0xf68e('0x10')](this[_0xf68e('0x7')][_0xf68e('0x11')][this['agent']['id']])){return logger['info'](_0xf68e('0x13'),this[_0xf68e('0x5')]['id'],this['agent']['id']);}else{logger['info'](_0xf68e('0x1c'),this['squeue']['id'],this['agent']['id']);util['hideNotification'](this[_0xf68e('0x4')],this[_0xf68e('0x5')]['id'],this['realtime'][_0xf68e('0x11')][this[_0xf68e('0x6')]['id']],null,this['routing']);this[_0xf68e('0x7')]['agents'][this[_0xf68e('0x6')]['id']][_0xf68e('0x15')]=![];this[_0xf68e('0x7')]['agents'][this[_0xf68e('0x6')]['id']][_0xf68e('0x16')]=undefined;util[_0xf68e('0x17')](this[_0xf68e('0x5')]['id'],this[_0xf68e('0x7')][_0xf68e('0x11')][this[_0xf68e('0x6')]['id']],_0x6b0254?_0xf68e('0x1d'):'TIMEOUT');}if(!_0x6b0254){setTimeout(this[_0xf68e('0x8')][_0xf68e('0xb')](this),0x3e8);}};function agent(_0x56772e,_0x40631d,_0x53c8e3,_0x3d4ddf){return new Agent(_0x56772e,_0x40631d,_0x53c8e3,_0x3d4ddf);}module[_0xf68e('0x1e')]=agent; \ No newline at end of file +var _0x63de=['RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','isNil','hideNotification','STOP','TIMEOUT','lodash','./util','../../../../../config/logger','routing','notificationId','agent','realtime','squeue','handleRun','bind','handleTimeout','drained','prototype','push','handleDrained','info','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','busy','busyQueue','writeLog'];(function(_0x59fe26,_0x4ea3a8){var _0x47e689=function(_0x3f8486){while(--_0x3f8486){_0x59fe26['push'](_0x59fe26['shift']());}};_0x47e689(++_0x4ea3a8);}(_0x63de,0xb5));var _0xe63d=function(_0x12dd1d,_0x1203d3){_0x12dd1d=_0x12dd1d-0x0;var _0x5f375d=_0x63de[_0x12dd1d];return _0x5f375d;};'use strict';var _=require(_0xe63d('0x0'));var uuid=require('uuid');var util=require(_0xe63d('0x1'));var logger=require(_0xe63d('0x2'))(_0xe63d('0x3'));var Agent=function(_0x284fcb,_0x3288e8,_0x37c1bc,_0x58b01c){this[_0xe63d('0x4')]=uuid['v4']();this['squeue']=_0x284fcb;this[_0xe63d('0x5')]=_0x3288e8;this[_0xe63d('0x6')]=_0x37c1bc;this[_0xe63d('0x3')]=_0x58b01c;this[_0xe63d('0x7')]['push'](this[_0xe63d('0x8')][_0xe63d('0x9')](this),this['handleTimeout'][_0xe63d('0x9')](this));this[_0xe63d('0x7')]['on']('timeout',this[_0xe63d('0xa')][_0xe63d('0x9')](this));this[_0xe63d('0x7')]['on'](_0xe63d('0xb'),this['handleDrained'][_0xe63d('0x9')](this));};Agent[_0xe63d('0xc')][_0xe63d('0xd')]=function(){this[_0xe63d('0x7')][_0xe63d('0xd')](this[_0xe63d('0x8')][_0xe63d('0x9')](this),this[_0xe63d('0xa')][_0xe63d('0x9')](this));};Agent[_0xe63d('0xc')][_0xe63d('0xe')]=function(){this[_0xe63d('0xa')](!![]);};Agent[_0xe63d('0xc')][_0xe63d('0x8')]=function(_0xa42184){logger[_0xe63d('0xf')]('[%s][AGENT]\x20try\x20with\x20%s',this[_0xe63d('0x7')]['id'],this[_0xe63d('0x5')]['id']);if(_['isNil'](this[_0xe63d('0x6')][_0xe63d('0x10')][this[_0xe63d('0x5')]['id']])){logger['info'](_0xe63d('0x11'),this[_0xe63d('0x7')]['id'],this[_0xe63d('0x5')]['id']);setTimeout(this['push'][_0xe63d('0x9')](this),0x3e8);}else{if(this[_0xe63d('0x3')][_0xe63d('0x12')]||util['isAgentAvailable'](this[_0xe63d('0x7')]['id'],this[_0xe63d('0x6')][_0xe63d('0x10')][this[_0xe63d('0x5')]['id']],this[_0xe63d('0x7')]['channel'],![])){this[_0xe63d('0x6')]['agents'][this[_0xe63d('0x5')]['id']][_0xe63d('0x13')]=!![];this[_0xe63d('0x6')][_0xe63d('0x10')][this[_0xe63d('0x5')]['id']][_0xe63d('0x14')]=undefined;util['showNotification'](this[_0xe63d('0x4')],this[_0xe63d('0x7')]['id'],this['realtime']['agents'][this[_0xe63d('0x5')]['id']],null,this[_0xe63d('0x3')]);util[_0xe63d('0x15')](this[_0xe63d('0x7')]['id'],this[_0xe63d('0x6')]['agents'][this[_0xe63d('0x5')]['id']],_0xe63d('0x16')+(this['routing'][_0xe63d('0x12')]?_0xe63d('0x17'):''));}else{logger[_0xe63d('0xf')](_0xe63d('0x18'),this[_0xe63d('0x7')]['id'],this[_0xe63d('0x5')]['id']);setTimeout(this[_0xe63d('0xd')][_0xe63d('0x9')](this),0x3e8);}}};Agent[_0xe63d('0xc')][_0xe63d('0xa')]=function(_0x1bae82){if(_[_0xe63d('0x19')](this[_0xe63d('0x6')][_0xe63d('0x10')][this[_0xe63d('0x5')]['id']])){return logger[_0xe63d('0xf')](_0xe63d('0x11'),this[_0xe63d('0x7')]['id'],this['agent']['id']);}else{logger[_0xe63d('0xf')]('[%s][AGENT]\x20timeout\x20with\x20%s',this[_0xe63d('0x7')]['id'],this[_0xe63d('0x5')]['id']);util[_0xe63d('0x1a')](this[_0xe63d('0x4')],this[_0xe63d('0x7')]['id'],this['realtime'][_0xe63d('0x10')][this[_0xe63d('0x5')]['id']],null,this[_0xe63d('0x3')]);this[_0xe63d('0x6')][_0xe63d('0x10')][this['agent']['id']]['busy']=![];this['realtime'][_0xe63d('0x10')][this[_0xe63d('0x5')]['id']][_0xe63d('0x14')]=undefined;util[_0xe63d('0x15')](this[_0xe63d('0x7')]['id'],this[_0xe63d('0x6')]['agents'][this['agent']['id']],_0x1bae82?_0xe63d('0x1b'):_0xe63d('0x1c'));}if(!_0x1bae82){setTimeout(this[_0xe63d('0xd')]['bind'](this),0x3e8);}};function agent(_0x571078,_0x3d27ae,_0x2eb734,_0x473189){return new Agent(_0x571078,_0x3d27ae,_0x2eb734,_0x473189);}module['exports']=agent; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/beepall.js b/server/services/routing/server/applications/strategy/beepall.js index 91ee0f7..8503d0d 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 _0x9282=['Agents','info','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','realtime','writeLog','agents','RINGING','busy','busyQueue','name','showNotification','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','[%s][QUEUE]\x20EMPTY','hideNotification','STOP','TIMEOUT','exports','./util','../../../../../config/logger','routing','notificationId','squeue','push','bind','handleTimeout','timeout','drained','handleRun','handleDrained','isNil','queue'];(function(_0xafad74,_0x2b4c7b){var _0x109efd=function(_0x49fc00){while(--_0x49fc00){_0xafad74['push'](_0xafad74['shift']());}};_0x109efd(++_0x2b4c7b);}(_0x9282,0x1a4));var _0x2928=function(_0x35655f,_0x23dfc3){_0x35655f=_0x35655f-0x0;var _0x1f2ae8=_0x9282[_0x35655f];return _0x1f2ae8;};'use strict';var _=require('lodash');var uuid=require('uuid');var util=require(_0x2928('0x0'));var logger=require(_0x2928('0x1'))(_0x2928('0x2'));var Beepall=function(_0x46cc69,_0x595d3f,_0x128896,_0x17043b){this[_0x2928('0x3')]=uuid['v4']();this[_0x2928('0x4')]=_0x46cc69;this['queue']=_0x595d3f;this['realtime']=_0x128896;this[_0x2928('0x2')]=_0x17043b;this[_0x2928('0x4')][_0x2928('0x5')](this['handleRun'][_0x2928('0x6')](this),this[_0x2928('0x7')][_0x2928('0x6')](this));this[_0x2928('0x4')]['on'](_0x2928('0x8'),this['handleTimeout'][_0x2928('0x6')](this));this[_0x2928('0x4')]['on'](_0x2928('0x9'),this['handleDrained'][_0x2928('0x6')](this));};Beepall['prototype'][_0x2928('0x5')]=function(){this[_0x2928('0x4')][_0x2928('0x5')](this[_0x2928('0xa')][_0x2928('0x6')](this),this[_0x2928('0x7')][_0x2928('0x6')](this));};Beepall['prototype'][_0x2928('0xb')]=function(_0x3eca77){this[_0x2928('0x7')](!![]);};Beepall['prototype']['handleRun']=function(_0xc64819){var _0x172d03=!![];if(!_[_0x2928('0xc')](this[_0x2928('0xd')])&&!_[_0x2928('0xc')](this[_0x2928('0xd')][_0x2928('0xe')])&&this['queue'][_0x2928('0xe')]['length']>0x0){for(var _0x18e096=0x0,_0x1a422f;_0x18e0960x0){for(var _0x2a4323=0x0,_0x2cec31;_0x2a43230x0&&_0x335c59[_0x181226+'CurrentCapacity']>=_0x335c59[_0x181226+_0x3f2f('0x24')]){writeLog(_0x525d7d,_0x335c59,_0x181226['toUpperCase']()+'\x20MAXCAPACITY');return![];}}return!![];};exports[_0x3f2f('0x25')]=function(_0x3bcc4f,_0x422763,_0x195c0d,_0x304cce,_0x57d989){return sendNotification(!![],_0x3bcc4f,_0x422763,_0x195c0d,_0x304cce,_0x57d989);};exports['hideNotification']=function(_0xb839b,_0x394251,_0x13195f,_0x449674,_0x1717a9){return sendNotification(![],_0xb839b,_0x394251,_0x13195f,_0x449674,_0x1717a9);};exports[_0x3f2f('0x26')]=writeLog; \ No newline at end of file +var _0x4cf8=['I\x20can\x27t\x20render\x20your\x20template','error','[%s][QUEUE]\x20%s','message','notification:%s','save','info','isAgentAvailable','busy','online','OFFLINE','Pause','PAUSE','hasOwnProperty','Capacity','CurrentCapacity','toUpperCase','\x20MAXCAPACITY','showNotification','hideNotification','writeLog','lodash','util','../utils','mustache','ioredis','../../../../../config/environment','../../../../../config/logger','routing','redis','defaults','localhost','emit','format','user:%s','user:save','split','\x20interaction','name','account','notificationSound','notificationShake','body','queue','msg','getMustacheRender'];(function(_0x287953,_0x497f6a){var _0x44146e=function(_0x280c8b){while(--_0x280c8b){_0x287953['push'](_0x287953['shift']());}};_0x44146e(++_0x497f6a);}(_0x4cf8,0x1e1));var _0x84cf=function(_0xd63e3a,_0x1bd6eb){_0xd63e3a=_0xd63e3a-0x0;var _0x19c178=_0x4cf8[_0xd63e3a];return _0x19c178;};'use strict';var _=require(_0x84cf('0x0'));var util=require(_0x84cf('0x1'));var utils=require(_0x84cf('0x2'));var Mustache=require(_0x84cf('0x3'));var Redis=require(_0x84cf('0x4'));var config=require(_0x84cf('0x5'));var logger=require(_0x84cf('0x6'))(_0x84cf('0x7'));config[_0x84cf('0x8')]=_[_0x84cf('0x9')](config[_0x84cf('0x8')],{'host':_0x84cf('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function emit(_0x455345,_0x56c5cc,_0x15ba85){io['to'](_0x455345)[_0x84cf('0xb')](_0x56c5cc,_0x15ba85);}function sendNotification(_0x51b84c,_0x2e0b79,_0x39c6bc,_0x489063,_0xfb5398,_0x1b223d){io['to'](util[_0x84cf('0xc')](_0x84cf('0xd'),_0x489063['name']))[_0x84cf('0xb')](_0x84cf('0xe'),_0x489063);var _0x4db0a7=_0x1b223d||{};var _0x51d315=_0x39c6bc[_0x84cf('0xf')]('.');var _0x27efbf={'uniqueid':_0x2e0b79,'channel':_0x51d315[0x0],'id':_0x51d315[0x1],'title':_0x51d315[0x0]+_0x84cf('0x10'),'interactionId':_0x51d315[0x2],'queue':_0xfb5398?_0xfb5398[_0x84cf('0x11')]:null,'sound':_0x4db0a7[_0x84cf('0x12')][_0x84cf('0x13')],'shake':_0x4db0a7[_0x84cf('0x12')][_0x84cf('0x14')]};try{if(!_0x4db0a7[_0x84cf('0x15')]){_0x4db0a7[_0x84cf('0x15')]={};}if(_0xfb5398){_0x4db0a7[_0x84cf('0x15')][_0x84cf('0x16')]=_0xfb5398;}else if(_0x4db0a7[_0x84cf('0x15')][_0x84cf('0x16')]){delete _0x4db0a7[_0x84cf('0x15')][_0x84cf('0x16')];}_0x27efbf[_0x84cf('0x17')]=utils[_0x84cf('0x18')](_0x4db0a7[_0x84cf('0x12')]['notificationTemplate'],_0x4db0a7);}catch(_0x441590){_0x27efbf[_0x84cf('0x17')]=_0x84cf('0x19');logger[_0x84cf('0x1a')](util[_0x84cf('0xc')](_0x84cf('0x1b'),_0x2e0b79,_0x441590[_0x84cf('0x1c')]));}io['to'](util['format']('user:%s',_0x489063[_0x84cf('0x11')]))[_0x84cf('0xb')](util[_0x84cf('0xc')](_0x84cf('0x1d'),_0x51b84c?_0x84cf('0x1e'):'remove'),_0x27efbf);}function writeLog(_0x39a37b,_0x448b5d,_0x3ca1be){return logger[_0x84cf('0x1f')](util[_0x84cf('0xc')]('[%s][QUEUE][AGENT:%s][STATUS:%s]',_0x39a37b,_0x448b5d[_0x84cf('0x11')],_0x3ca1be));}exports[_0x84cf('0x20')]=function(_0x475b19,_0x23e1e7,_0x3e5e94,_0x29e9e1){if(_0x23e1e7[_0x84cf('0x21')]){writeLog(_0x475b19,_0x23e1e7,'BUSY');return![];}if(!_0x23e1e7[_0x84cf('0x22')]){writeLog(_0x475b19,_0x23e1e7,_0x84cf('0x23'));return![];}if(_0x23e1e7[_0x3e5e94+_0x84cf('0x24')]){writeLog(_0x475b19,_0x23e1e7,_0x84cf('0x25'));return![];}if(_0x29e9e1&&_0x23e1e7[_0x84cf('0x26')](_0x3e5e94+_0x84cf('0x27'))&&_0x23e1e7[_0x84cf('0x26')](_0x3e5e94+_0x84cf('0x28'))){if(_0x23e1e7[_0x3e5e94+_0x84cf('0x27')]>0x0&&_0x23e1e7[_0x3e5e94+_0x84cf('0x28')]>=_0x23e1e7[_0x3e5e94+'Capacity']){writeLog(_0x475b19,_0x23e1e7,_0x3e5e94[_0x84cf('0x29')]()+_0x84cf('0x2a'));return![];}}return!![];};exports[_0x84cf('0x2b')]=function(_0x41a5db,_0x58f07e,_0x1595dd,_0x5a428c,_0x29455e){return sendNotification(!![],_0x41a5db,_0x58f07e,_0x1595dd,_0x5a428c,_0x29455e);};exports[_0x84cf('0x2c')]=function(_0x43b41b,_0xc15298,_0x51adcf,_0x20de4b,_0x2e4653){return sendNotification(![],_0x43b41b,_0xc15298,_0x51adcf,_0x20de4b,_0x2e4653);};exports[_0x84cf('0x2d')]=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 c2bf3ba..f6528f8 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 _0x8d3a=['exec','info','replace','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','error','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','validate','shelljs','lodash','./utils','../../../../config/logger','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','[%s][SYSTEM]\x20%s','message','next','[%s][SYSTEM]\x20commnad:\x20%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8d3a,0xab));var _0xa8d3=function(_0x71458a,_0x517e81){_0x71458a=_0x71458a-0x0;var _0x1ca55a=_0x8d3a[_0x71458a];return _0x1ca55a;};'use strict';var schema=require(_0xa8d3('0x0'));var sh=require(_0xa8d3('0x1'));var _=require(_0xa8d3('0x2'));var utils=require(_0xa8d3('0x3'));var logger=require(_0xa8d3('0x4'))('routing');var system=schema({'command':{'type':_0xa8d3('0x5'),'required':!![],'message':_0xa8d3('0x6')}});exports[_0xa8d3('0x7')]=function(_0x1289bd,_0x3bf8d7){return function(_0x5ac18b){try{var _0x35ce88={'command':_0x3bf8d7[0x0]};var _0x3895ad=system[_0xa8d3('0x0')](_0x35ce88,{'typecast':!![]});if(_0x3895ad[_0xa8d3('0x8')]){logger['error'](_0xa8d3('0x9'),_0x1289bd,_['map'](_0x3895ad,_0xa8d3('0xa'))['join'](',\x20'));logger['info']('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x1289bd);_0x5ac18b[_0xa8d3('0xb')]();}else{var _0x505623=this;var _0x187836=utils['getMustacheRender'](_0x3bf8d7[0x0],this);logger['info'](_0xa8d3('0xc'),_0x1289bd,_0x187836);sh[_0xa8d3('0xd')](_['trim'](_0x187836),function(_0x554e56,_0x1a4d21){logger[_0xa8d3('0xe')]('[%s][SYSTEM]\x20result\x20code:\x20%s',_0x1289bd,_0x554e56);if(_0x554e56==0x0){var _0xa5125b=_0x1a4d21[_0xa8d3('0xf')](/(\r\n|\n|\r)/gm,'');if(_[_0xa8d3('0x10')](_0x3bf8d7[0x1])||_[_0xa8d3('0x11')](_0x3bf8d7[0x1])){logger[_0xa8d3('0xe')](_0xa8d3('0x12'),_0x1289bd);_0x505623[_0xa8d3('0x13')][_0x3bf8d7[0x1]]=_0xa5125b;}else{logger[_0xa8d3('0xe')](_0xa8d3('0x14'),_0x1289bd,_0x3bf8d7[0x1],_0xa5125b);_0x505623[_0xa8d3('0x13')][_0x3bf8d7[0x1]]=_0xa5125b;}}_0x5ac18b['next']();});}}catch(_0x1d5166){logger[_0xa8d3('0x15')](_0xa8d3('0x9'),_0x1289bd,_['isObject'](_0x1d5166)?JSON['stringify'](_0x1d5166):_0x1d5166);logger['info'](_0xa8d3('0x16'),_0x1289bd);_0x5ac18b[_0xa8d3('0xb')]();}};}; \ No newline at end of file +var _0xb5ec=['replace','isNil','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','stringify','shelljs','lodash','./utils','../../../../config/logger','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','validate','length','error','[%s][SYSTEM]\x20%s','map','message','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s'];(function(_0x4f0a4b,_0x464b33){var _0xec8623=function(_0x25b736){while(--_0x25b736){_0x4f0a4b['push'](_0x4f0a4b['shift']());}};_0xec8623(++_0x464b33);}(_0xb5ec,0x1d6));var _0xcb5e=function(_0x1b079d,_0x123cd6){_0x1b079d=_0x1b079d-0x0;var _0x429358=_0xb5ec[_0x1b079d];return _0x429358;};'use strict';var schema=require('validate');var sh=require(_0xcb5e('0x0'));var _=require(_0xcb5e('0x1'));var utils=require(_0xcb5e('0x2'));var logger=require(_0xcb5e('0x3'))(_0xcb5e('0x4'));var system=schema({'command':{'type':_0xcb5e('0x5'),'required':!![],'message':_0xcb5e('0x6')}});exports[_0xcb5e('0x7')]=function(_0x477b32,_0x582b0a){return function(_0x408fad){try{var _0x8c0f50={'command':_0x582b0a[0x0]};var _0x4c1192=system[_0xcb5e('0x8')](_0x8c0f50,{'typecast':!![]});if(_0x4c1192[_0xcb5e('0x9')]){logger[_0xcb5e('0xa')](_0xcb5e('0xb'),_0x477b32,_[_0xcb5e('0xc')](_0x4c1192,_0xcb5e('0xd'))[_0xcb5e('0xe')](',\x20'));logger[_0xcb5e('0xf')](_0xcb5e('0x10'),_0x477b32);_0x408fad[_0xcb5e('0x11')]();}else{var _0x486a45=this;var _0x2ab55f=utils[_0xcb5e('0x12')](_0x582b0a[0x0],this);logger[_0xcb5e('0xf')](_0xcb5e('0x13'),_0x477b32,_0x2ab55f);sh[_0xcb5e('0x14')](_[_0xcb5e('0x15')](_0x2ab55f),function(_0x4e04c2,_0x420427){logger[_0xcb5e('0xf')](_0xcb5e('0x16'),_0x477b32,_0x4e04c2);if(_0x4e04c2==0x0){var _0x4d57a2=_0x420427[_0xcb5e('0x17')](/(\r\n|\n|\r)/gm,'');if(_[_0xcb5e('0x18')](_0x582b0a[0x1])||_['isEmpty'](_0x582b0a[0x1])){logger[_0xcb5e('0xf')](_0xcb5e('0x19'),_0x477b32);_0x486a45[_0xcb5e('0x1a')][_0x582b0a[0x1]]=_0x4d57a2;}else{logger['info'](_0xcb5e('0x1b'),_0x477b32,_0x582b0a[0x1],_0x4d57a2);_0x486a45['body'][_0x582b0a[0x1]]=_0x4d57a2;}}_0x408fad['next']();});}}catch(_0x116e6e){logger[_0xcb5e('0xa')](_0xcb5e('0xb'),_0x477b32,_['isObject'](_0x116e6e)?JSON[_0xcb5e('0x1c')](_0x116e6e):_0x116e6e);logger[_0xcb5e('0xf')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x477b32);_0x408fad[_0xcb5e('0x11')]();}};}; \ 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 3bc0962..3373991 100644 --- a/server/services/routing/server/applications/tag.js +++ b/server/services/routing/server/applications/tag.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['join','info','next','Interaction','channel','addTags','interaction','then','catch','stringify','finally','isObject','validate','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../../../config/logger','routing','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][TAG]\x20%s','map','message'];(function(_0x26fa08,_0x2bfb58){var _0x40c774=function(_0x497e5d){while(--_0x497e5d){_0x26fa08['push'](_0x26fa08['shift']());}};_0x40c774(++_0x2bfb58);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var schema=require(_0x7995('0x0'));var _=require(_0x7995('0x1'));var rpc={'chatInteraction':require(_0x7995('0x2')),'openchannelInteraction':require(_0x7995('0x3')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0x7995('0x4')),'faxInteraction':require(_0x7995('0x5'))};var logger=require(_0x7995('0x6'))(_0x7995('0x7'));var tag=schema({'tag':{'type':'number','required':!![],'message':_0x7995('0x8')}});exports[_0x7995('0x9')]=function(_0x137b6b,_0x219534,_0xbda126,_0x326741){return function(_0x4996ca){try{var _0x465276={'tag':_0x219534[0x0]};var _0x1cad37=tag['validate'](_0x465276,{'typecast':!![]});if(_0x1cad37[_0x7995('0xa')]){logger[_0x7995('0xb')](_0x7995('0xc'),_0x137b6b,_[_0x7995('0xd')](_0x1cad37,_0x7995('0xe'))[_0x7995('0xf')](',\x20'));logger[_0x7995('0x10')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x137b6b);_0x4996ca[_0x7995('0x11')]();}else{var _0x41c652={'ids':[_0x219534[0x0]]};if(rpc[_0x326741['channel']+_0x7995('0x12')]){rpc[_0x326741[_0x7995('0x13')]+_0x7995('0x12')][_0x7995('0x14')](_0x326741[_0x7995('0x15')]['id'],_0x41c652)[_0x7995('0x16')](function(_0x2bbe7a){logger['info']('[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s',_0x137b6b,_0x219534[0x1],_0x326741[_0x7995('0x13')],_0x326741[_0x7995('0x15')]['id']);})[_0x7995('0x17')](function(_0x321ae8){logger[_0x7995('0xb')](_0x7995('0xc'),_0x137b6b,JSON[_0x7995('0x18')](_0x321ae8));logger[_0x7995('0x10')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x137b6b);})[_0x7995('0x19')](function(){_0x4996ca['next']();});}}}catch(_0x2f832e){logger[_0x7995('0xb')](_0x7995('0xc'),_0x137b6b,_[_0x7995('0x1a')](_0x2f832e)?JSON[_0x7995('0x18')](_0x2f832e):_0x2f832e);logger[_0x7995('0x10')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x137b6b);_0x4996ca['next']();}};}; \ No newline at end of file +var _0x9957=['join','info','next','Interaction','channel','addTags','interaction','then','catch','stringify','finally','isObject','validate','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../../../config/logger','routing','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][TAG]\x20%s','map','message'];(function(_0x1b2ea2,_0x19c7a1){var _0x40f25c=function(_0x2d74cd){while(--_0x2d74cd){_0x1b2ea2['push'](_0x1b2ea2['shift']());}};_0x40f25c(++_0x19c7a1);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'use strict';var schema=require(_0x7995('0x0'));var _=require(_0x7995('0x1'));var rpc={'chatInteraction':require(_0x7995('0x2')),'openchannelInteraction':require(_0x7995('0x3')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0x7995('0x4')),'faxInteraction':require(_0x7995('0x5'))};var logger=require(_0x7995('0x6'))(_0x7995('0x7'));var tag=schema({'tag':{'type':'number','required':!![],'message':_0x7995('0x8')}});exports[_0x7995('0x9')]=function(_0x137b6b,_0x219534,_0xbda126,_0x326741){return function(_0x4996ca){try{var _0x465276={'tag':_0x219534[0x0]};var _0x1cad37=tag['validate'](_0x465276,{'typecast':!![]});if(_0x1cad37[_0x7995('0xa')]){logger[_0x7995('0xb')](_0x7995('0xc'),_0x137b6b,_[_0x7995('0xd')](_0x1cad37,_0x7995('0xe'))[_0x7995('0xf')](',\x20'));logger[_0x7995('0x10')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x137b6b);_0x4996ca[_0x7995('0x11')]();}else{var _0x41c652={'ids':[_0x219534[0x0]]};if(rpc[_0x326741['channel']+_0x7995('0x12')]){rpc[_0x326741[_0x7995('0x13')]+_0x7995('0x12')][_0x7995('0x14')](_0x326741[_0x7995('0x15')]['id'],_0x41c652)[_0x7995('0x16')](function(_0x2bbe7a){logger['info']('[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s',_0x137b6b,_0x219534[0x1],_0x326741[_0x7995('0x13')],_0x326741[_0x7995('0x15')]['id']);})[_0x7995('0x17')](function(_0x321ae8){logger[_0x7995('0xb')](_0x7995('0xc'),_0x137b6b,JSON[_0x7995('0x18')](_0x321ae8));logger[_0x7995('0x10')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x137b6b);})[_0x7995('0x19')](function(){_0x4996ca['next']();});}}}catch(_0x2f832e){logger[_0x7995('0xb')](_0x7995('0xc'),_0x137b6b,_[_0x7995('0x1a')](_0x2f832e)?JSON[_0x7995('0x18')](_0x2f832e):_0x2f832e);logger[_0x7995('0x10')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x137b6b);_0x4996ca['next']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/utils.js b/server/services/routing/server/applications/utils.js index 6482a93..3bfbc22 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 _0xbf83=['render','merge','message','account','interaction','list','mustache','exports'];(function(_0x1bd2a6,_0x45f0fc){var _0x525206=function(_0x3ae097){while(--_0x3ae097){_0x1bd2a6['push'](_0x1bd2a6['shift']());}};_0x525206(++_0x45f0fc);}(_0xbf83,0x11e));var _0x3bf8=function(_0xf5dc4a,_0x5445b0){_0xf5dc4a=_0xf5dc4a-0x0;var _0x556b7c=_0xbf83[_0xf5dc4a];return _0x556b7c;};'use strict';var Mustache=require(_0x3bf8('0x0'));var _=require('lodash');module[_0x3bf8('0x1')]={'getMustacheRender':function(_0x375502,_0x3cbf10){return Mustache[_0x3bf8('0x2')](_0x375502,_[_0x3bf8('0x3')](_0x3cbf10['body'],{'contact':_0x3cbf10['contact'],'message':_0x3cbf10[_0x3bf8('0x4')],'account':_0x3cbf10[_0x3bf8('0x5')],'interaction':_0x3cbf10[_0x3bf8('0x6')],'list':_0x3cbf10[_0x3bf8('0x7')]}))||'';}}; \ No newline at end of file +var _0x3379=['render','merge','body','contact','account','interaction','list','mustache','lodash','exports'];(function(_0xf55690,_0x33ee5b){var _0x5c75c2=function(_0x505713){while(--_0x505713){_0xf55690['push'](_0xf55690['shift']());}};_0x5c75c2(++_0x33ee5b);}(_0x3379,0x115));var _0x9337=function(_0xbe85f7,_0x33236e){_0xbe85f7=_0xbe85f7-0x0;var _0x3dd9c7=_0x3379[_0xbe85f7];return _0x3dd9c7;};'use strict';var Mustache=require(_0x9337('0x0'));var _=require(_0x9337('0x1'));module[_0x9337('0x2')]={'getMustacheRender':function(_0x3338dd,_0x5a6194){return Mustache[_0x9337('0x3')](_0x3338dd,_[_0x9337('0x4')](_0x5a6194[_0x9337('0x5')],{'contact':_0x5a6194[_0x9337('0x6')],'message':_0x5a6194['message'],'account':_0x5a6194[_0x9337('0x7')],'interaction':_0x5a6194[_0x9337('0x8')],'list':_0x5a6194[_0x9337('0x9')]}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index aff388e..ebb1e0d 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 _0x83c2=['CurrentCapacity','updateRealtime','values','chatQueues','name','paused','waiting','mailQueues','available','loggedIn','openchannelQueues','smsQueues','faxQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','faxQueuesWaitingInteractions','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','util','path','jayson/promise','bluebird','uuid','../../../config/logger','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../lib/rule-engine','format','%s.%s.%s','IntervalId','isNil','map','Intervals','interval','listen','rules','channel','message','interaction','applications','isArray','length','app','.js','toLowerCase','autoreply','appdata','push','slice','join','split','amazonlex','tag','TagId','%s:%s:%s','./interval','condition','intervals','./applications/','consequence','priority','Push\x20new\x20rule','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','execute','info','Applications\x20executed','stringify','complete','stack','routing\x20is\x20empty','emit','QueueReport','update','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','agent','agents','end','hasOwnProperty','capacity'];(function(_0x401e3d,_0x55ac65){var _0x2bbc4e=function(_0x275c96){while(--_0x275c96){_0x401e3d['push'](_0x401e3d['shift']());}};_0x2bbc4e(++_0x55ac65);}(_0x83c2,0x17d));var _0x283c=function(_0x5216e0,_0x4f8cb9){_0x5216e0=_0x5216e0-0x0;var _0x5b3f40=_0x83c2[_0x5216e0];return _0x5b3f40;};'use strict';var _=require('lodash');var util=require(_0x283c('0x0'));var path=require(_0x283c('0x1'));var fs=require('fs');var jayson=require(_0x283c('0x2'));var BPromise=require(_0x283c('0x3'));var uuid=require(_0x283c('0x4'));var config=require('../../../config/environment');var logger=require(_0x283c('0x5'))('routing');var rpc={'openchannelQueueReport':require(_0x283c('0x6'))};var rpc={'openchannelQueueReport':require('../rpc/openchannelQueueReport'),'mailQueueReport':require(_0x283c('0x7')),'chatQueueReport':require(_0x283c('0x8')),'smsQueueReport':require(_0x283c('0x9')),'faxQueueReport':require(_0x283c('0xa'))};var RuleEngine=require(_0x283c('0xb'));function getId(_0x48c91a,_0x4fe540,_0x52f675){return util[_0x283c('0xc')](_0x283c('0xd'),_0x48c91a,_0x4fe540||0x0,_0x52f675||0x0);}function getIntervals(_0x233e1a,_0x46299e){var _0x5b6700=[];if(!_['isNil'](_0x46299e[_0x283c('0xe')])&&!_['isNil'](_0x233e1a[_0x46299e[_0x283c('0xe')]])&&!_[_0x283c('0xf')](_0x233e1a[_0x46299e[_0x283c('0xe')]]['Intervals'])){_0x5b6700=_[_0x283c('0x10')](_0x233e1a[_0x46299e['IntervalId']][_0x283c('0x11')],_0x283c('0x12'));}else if(!_['isNil'](_0x46299e['interval'])){_0x5b6700=[_0x46299e[_0x283c('0x12')]];}return _0x5b6700;}exports[_0x283c('0x13')]=function(_0x296bf5){_0x296bf5[_0x283c('0x14')]={};return new BPromise(function(_0x267632,_0x55d5b3){var _0x24fec0={'Start':function(_0x45bf62){var _0x1915db=this;return new Promise(function(_0x6a4518,_0x4eb6b6){if(_0x45bf62){try{var _0x178b40=[];var _0x4625d7=getId(_0x45bf62[_0x283c('0x15')],_0x45bf62[_0x283c('0x16')]?_0x45bf62[_0x283c('0x16')]['id']:0x0,_0x45bf62[_0x283c('0x17')]?_0x45bf62['interaction']['id']:0x0);if(_0x45bf62[_0x283c('0x18')]&&_[_0x283c('0x19')](_0x45bf62[_0x283c('0x18')])&&_0x45bf62[_0x283c('0x18')][_0x283c('0x1a')]){for(var _0x5140ce=0x0;_0x5140ce<_0x45bf62[_0x283c('0x18')]['length'];_0x5140ce+=0x1){var _0x2a3322=_0x45bf62[_0x283c('0x18')][_0x5140ce];if(fs['existsSync'](path['join'](__dirname,_0x283c('0x18'),_0x2a3322[_0x283c('0x1b')]+_0x283c('0x1c')))){var _0x38ad79=[];switch(_0x2a3322[_0x283c('0x1b')][_0x283c('0x1d')]()){case _0x283c('0x1e'):var _0x2cc01b=_0x2a3322[_0x283c('0x1f')]['split'](',');_0x38ad79[_0x283c('0x20')](_0x2cc01b[0x0]);_0x38ad79[_0x283c('0x20')](_0x2cc01b[_0x283c('0x21')](0x1,_0x2cc01b['length'])[_0x283c('0x22')](','));break;case'dialogflow':var _0x58ed91=_0x2a3322['appdata'][_0x283c('0x23')](',');_0x38ad79[_0x283c('0x20')](_0x58ed91[0x0]);_0x38ad79[_0x283c('0x20')](_0x58ed91[0x1]);_0x38ad79[_0x283c('0x20')](_0x58ed91[_0x283c('0x21')](0x2,_0x58ed91[_0x283c('0x1a')])[_0x283c('0x22')](','));break;case _0x283c('0x24'):var _0x2fe280=_0x2a3322[_0x283c('0x1f')][_0x283c('0x23')](',');_0x38ad79[_0x283c('0x20')](_0x2fe280[0x0]);_0x38ad79['push'](_0x2fe280[0x1]);_0x38ad79[_0x283c('0x20')](_0x2fe280[0x2]);_0x38ad79[_0x283c('0x20')](_0x2fe280[0x3]);_0x38ad79['push'](_0x2fe280[_0x283c('0x21')](0x4,_0x2fe280[_0x283c('0x1a')])[_0x283c('0x22')](','));break;case'message':_0x38ad79[_0x283c('0x20')](_0x2a3322[_0x283c('0x1f')]);break;case _0x283c('0x25'):_0x38ad79[_0x283c('0x20')](_0x2a3322[_0x283c('0x26')]);_0x38ad79[_0x283c('0x20')](_0x2a3322['appdata']);break;default:_0x38ad79=_[_0x283c('0xf')](_0x2a3322[_0x283c('0x1f')])?[]:_0x2a3322[_0x283c('0x1f')][_0x283c('0x23')](',');}var _0x5cc1df={'id':util['format'](_0x283c('0x27'),_0x4625d7,_0x2a3322['id'],_0x2a3322[_0x283c('0x1b')]),'condition':require(_0x283c('0x28'))[_0x283c('0x29')](_0x4625d7,getIntervals(_0x296bf5[_0x283c('0x2a')],_0x2a3322),_0x296bf5),'consequence':require(_0x283c('0x2b')+_0x2a3322[_0x283c('0x1b')])[_0x283c('0x2c')](_0x4625d7,_0x38ad79,_0x296bf5,_0x45bf62),'p':_0x2a3322[_0x283c('0x2d')]||0x0};logger['info'](_0x283c('0x2e'),_0x5cc1df['id'],'on\x20interval',getIntervals(_0x296bf5['intervals'],_0x2a3322)['join'](_0x283c('0x2f')));_0x178b40['push'](_0x5cc1df);}else{logger[_0x283c('0x30')](_0x283c('0x31'),path[_0x283c('0x22')](__dirname,_0x283c('0x18'),_0x2a3322[_0x283c('0x1b')]+_0x283c('0x1c')));}}_0x296bf5[_0x283c('0x14')][_0x4625d7]=new RuleEngine(_0x178b40);_0x296bf5[_0x283c('0x14')][_0x4625d7][_0x283c('0x32')](_0x45bf62,function(_0x4be646){logger[_0x283c('0x33')](_0x283c('0x34'),JSON[_0x283c('0x35')](_0x4be646['matchPath']));if(_0x296bf5[_0x283c('0x14')][_0x4625d7]){_0x296bf5[_0x283c('0x14')][_0x4625d7]['emit'](_0x283c('0x36'));}});return _0x6a4518({'code':0xc8,'message':_0x45bf62});}else{logger[_0x283c('0x33')]('No\x20applications\x20to\x20execute');return _0x6a4518({'code':0xc8,'message':_0x45bf62});}}catch(_0x463dfe){logger[_0x283c('0x30')](_0x463dfe[_0x283c('0x37')]);return _0x4eb6b6(_0x1915db['error'](0x1f4,_0x463dfe));}}return _0x4eb6b6(_0x283c('0x38'));});},'AcceptMessage':function(_0x3b3aa5){var _0x56f46b=this;return new Promise(function(_0x51dc81,_0x30c6e1){if(_0x3b3aa5['message']&&_0x3b3aa5[_0x283c('0x16')]['id']){try{var _0x4d6bae=getId(_0x3b3aa5['channel'],_0x3b3aa5[_0x283c('0x16')]?_0x3b3aa5[_0x283c('0x16')]['id']:0x0,_0x3b3aa5[_0x283c('0x17')]?_0x3b3aa5[_0x283c('0x17')]['id']:0x0);if(_0x296bf5[_0x283c('0x14')][_0x4d6bae]){_0x296bf5['rules'][_0x4d6bae][_0x283c('0x39')]('end');if(rpc[_0x3b3aa5[_0x283c('0x15')]+_0x283c('0x3a')]){rpc[_0x3b3aa5['channel']+_0x283c('0x3a')][_0x283c('0x3b')](_0x4d6bae,{'UserId':_0x3b3aa5[_0x283c('0x16')][_0x283c('0x3c')]})[_0x283c('0x3d')](function(_0x25549f){logger[_0x283c('0x30')](_0x283c('0x3e'));});}}return _0x51dc81({'code':0xc8,'message':_0x3b3aa5});}catch(_0xa26f09){logger[_0x283c('0x30')](_0xa26f09[_0x283c('0x37')]);return _0x30c6e1(_0x56f46b[_0x283c('0x30')](0x1f4,_0xa26f09));}}logger['error'](_0x283c('0x3f'));return _0x30c6e1(_0x56f46b[_0x283c('0x30')](0x1f4,_0x283c('0x3f')));});},'RejectMessage':function(_0x36f6b1){var _0x35e9f2=this;return new Promise(function(_0x48e96c,_0x1815a6){if(_0x36f6b1['agent']&&_0x36f6b1[_0x283c('0x40')]['id']){try{if(_0x296bf5[_0x283c('0x41')][_0x36f6b1[_0x283c('0x40')]['id']]){_0x296bf5[_0x283c('0x41')][_0x36f6b1[_0x283c('0x40')]['id']]['busy']=![];_0x296bf5[_0x283c('0x41')][_0x36f6b1[_0x283c('0x40')]['id']]['busyQueue']=undefined;}return _0x48e96c({'code':0xc8,'message':_0x36f6b1});}catch(_0x20f58e){logger[_0x283c('0x30')](_0x20f58e[_0x283c('0x37')]);return _0x1815a6(_0x35e9f2['error'](0x1f4,_0x20f58e));}}logger[_0x283c('0x30')](_0x283c('0x3f'));return _0x1815a6(_0x35e9f2[_0x283c('0x30')](0x1f4,'message\x20is\x20empty'));});},'AbandonInteraction':function(_0x2b60c2){var _0x467dda=this;return new Promise(function(_0x40008a,_0x4d98e5){if(_0x2b60c2[_0x283c('0x15')]&&_0x2b60c2[_0x283c('0x17')]&&_0x2b60c2[_0x283c('0x17')]['id']){try{var _0x9b1282=getId(_0x2b60c2[_0x283c('0x15')],_0x2b60c2['message']?_0x2b60c2[_0x283c('0x16')]['id']:0x0,_0x2b60c2[_0x283c('0x17')]?_0x2b60c2[_0x283c('0x17')]['id']:0x0);if(_0x296bf5[_0x283c('0x14')][_0x9b1282]){_0x296bf5[_0x283c('0x14')][_0x9b1282][_0x283c('0x39')](_0x283c('0x42'));}return _0x40008a({'code':0xc8,'message':_0x2b60c2});}catch(_0xc900f8){logger[_0x283c('0x30')](_0xc900f8[_0x283c('0x37')]);return _0x4d98e5(_0x467dda[_0x283c('0x30')](0x1f4,_0xc900f8));}}logger[_0x283c('0x30')]('message\x20is\x20empty');return _0x4d98e5(_0x467dda[_0x283c('0x30')](0x1f4,_0x283c('0x3f')));});},'AgentCapacity':function(_0x4875a7){var _0x2ea77b=this;return new Promise(function(_0x28aeec,_0x51f63a){if(_0x296bf5['agents'][_0x283c('0x43')](_0x4875a7['id'])){for(var _0x340e1a in _0x4875a7[_0x283c('0x44')]){if(_0x4875a7[_0x283c('0x44')][_0x283c('0x43')](_0x340e1a)){if(_0x296bf5[_0x283c('0x41')][_0x4875a7['id']][_0x283c('0x43')](_0x340e1a+_0x283c('0x45'))){_0x296bf5[_0x283c('0x41')][_0x4875a7['id']][_0x340e1a+_0x283c('0x45')]=parseInt(_0x4875a7[_0x283c('0x44')][_0x340e1a],0xa);}}}_0x296bf5['agents'][_0x4875a7['id']][_0x283c('0x46')]();return _0x28aeec({'code':0xc8,'message':_0x296bf5['agents'][_0x4875a7['id']]});}else{return _0x51f63a(_0x2ea77b[_0x283c('0x30')](0x1f4,'agent\x20not\x20found'));}});},'Agents':function(_0x23574d){return new Promise(function(_0x238474,_0x3a12ba){var _0x2c12f6=_[_0x283c('0x47')](_0x296bf5[_0x283c('0x41')]);_0x238474({'count':_0x2c12f6[_0x283c('0x1a')],'rows':_0x2c12f6});});},'ChatQueues':function(_0x1af169){return new Promise(function(_0x330c46,_0x427bef){var _0x5d97ab=[];for(var _0x54547b in _0x296bf5[_0x283c('0x48')]){if(_0x296bf5[_0x283c('0x48')]['hasOwnProperty'](_0x54547b)){var _0x175c39=_0x296bf5[_0x283c('0x48')][_0x54547b];var _0x32719e={'id':_0x175c39['id'],'available':_0x175c39['available'],'loggedIn':_0x175c39['loggedIn'],'name':_0x175c39[_0x283c('0x49')],'paused':_0x175c39[_0x283c('0x4a')],'waiting':_0x175c39[_0x283c('0x4b')]};_0x5d97ab[_0x283c('0x20')](_0x32719e);}}_0x330c46({'count':_0x5d97ab['length'],'rows':_0x5d97ab});});},'MailQueues':function(_0x596665){return new Promise(function(_0x1e48ba,_0x97613f){var _0x5a2476=[];for(var _0x4a39ee in _0x296bf5['mailQueues']){if(_0x296bf5[_0x283c('0x4c')][_0x283c('0x43')](_0x4a39ee)){var _0x2b0ca4=_0x296bf5[_0x283c('0x4c')][_0x4a39ee];var _0x3a4cb8={'id':_0x2b0ca4['id'],'available':_0x2b0ca4[_0x283c('0x4d')],'loggedIn':_0x2b0ca4[_0x283c('0x4e')],'name':_0x2b0ca4[_0x283c('0x49')],'paused':_0x2b0ca4['paused'],'waiting':_0x2b0ca4['waiting']};_0x5a2476[_0x283c('0x20')](_0x3a4cb8);}}_0x1e48ba({'count':_0x5a2476['length'],'rows':_0x5a2476});});},'OpenchannelQueues':function(_0x251411){return new Promise(function(_0x6bd953,_0x5b5784){var _0x2070c2=[];for(var _0x3b2068 in _0x296bf5[_0x283c('0x4f')]){if(_0x296bf5[_0x283c('0x4f')][_0x283c('0x43')](_0x3b2068)){var _0x4de7b6=_0x296bf5[_0x283c('0x4f')][_0x3b2068];var _0x32755e={'id':_0x4de7b6['id'],'available':_0x4de7b6[_0x283c('0x4d')],'loggedIn':_0x4de7b6['loggedIn'],'name':_0x4de7b6[_0x283c('0x49')],'paused':_0x4de7b6[_0x283c('0x4a')],'waiting':_0x4de7b6[_0x283c('0x4b')]};_0x2070c2[_0x283c('0x20')](_0x32755e);}}_0x6bd953({'count':_0x2070c2[_0x283c('0x1a')],'rows':_0x2070c2});});},'SmsQueues':function(_0xf74830){return new Promise(function(_0x30cd4d,_0x153cc8){var _0x222bcd=[];for(var _0x159191 in _0x296bf5['smsQueues']){if(_0x296bf5[_0x283c('0x50')][_0x283c('0x43')](_0x159191)){var _0x270b90=_0x296bf5['smsQueues'][_0x159191];var _0x3e1794={'id':_0x270b90['id'],'available':_0x270b90[_0x283c('0x4d')],'loggedIn':_0x270b90['loggedIn'],'name':_0x270b90['name'],'paused':_0x270b90[_0x283c('0x4a')],'waiting':_0x270b90[_0x283c('0x4b')]};_0x222bcd['push'](_0x3e1794);}}_0x30cd4d({'count':_0x222bcd[_0x283c('0x1a')],'rows':_0x222bcd});});},'FaxQueues':function(_0x1b7164){return new Promise(function(_0x14637f,_0x164fb2){var _0x5de3d5=[];for(var _0x4e4176 in _0x296bf5[_0x283c('0x51')]){if(_0x296bf5[_0x283c('0x51')][_0x283c('0x43')](_0x4e4176)){var _0x813d5=_0x296bf5['faxQueues'][_0x4e4176];var _0xb7244a={'id':_0x813d5['id'],'available':_0x813d5[_0x283c('0x4d')],'loggedIn':_0x813d5['loggedIn'],'name':_0x813d5['name'],'paused':_0x813d5[_0x283c('0x4a')],'waiting':_0x813d5[_0x283c('0x4b')]};_0x5de3d5[_0x283c('0x20')](_0xb7244a);}}_0x14637f({'count':_0x5de3d5[_0x283c('0x1a')],'rows':_0x5de3d5});});},'ChatQueuesWaitingInteractions':function(_0x694b39){return new Promise(function(_0x1a0b33,_0xa01ed6){var _0x1133f0=_[_0x283c('0x47')](_0x296bf5[_0x283c('0x52')]);_0x1a0b33({'count':_0x1133f0['length'],'rows':_0x1133f0});});},'MailQueuesWaitingInteractions':function(_0x3a6130){return new Promise(function(_0x4a09fe,_0x336e5e){var _0x3b7201=_[_0x283c('0x47')](_0x296bf5[_0x283c('0x53')]);_0x4a09fe({'count':_0x3b7201[_0x283c('0x1a')],'rows':_0x3b7201});});},'OpenchannelQueuesWaitingInteractions':function(_0x155fc5){return new Promise(function(_0x540caa,_0x236800){var _0x214386=_[_0x283c('0x47')](_0x296bf5[_0x283c('0x54')]);_0x540caa({'count':_0x214386[_0x283c('0x1a')],'rows':_0x214386});});},'SmsQueuesWaitingInteractions':function(_0x33db20){return new Promise(function(_0x28565d,_0x493e4e){var _0x3fd472=_[_0x283c('0x47')](_0x296bf5['smsQueuesWaitingInteractions']);_0x28565d({'count':_0x3fd472[_0x283c('0x1a')],'rows':_0x3fd472});});},'FaxQueuesWaitingInteractions':function(_0x4643f0){return new Promise(function(_0x327155,_0x5a9cb0){var _0xe8cf36=_[_0x283c('0x47')](_0x296bf5[_0x283c('0x55')]);_0x327155({'count':_0xe8cf36['length'],'rows':_0xe8cf36});});}};var _0x10896d=jayson['server'](_0x24fec0)['http']();_0x10896d['on'](_0x283c('0x30'),function(_0x25a188){logger[_0x283c('0x30')](JSON[_0x283c('0x35')](_0x25a188));return _0x55d5b3(_0x25a188);});_0x10896d[_0x283c('0x13')](0x232c,_0x283c('0x56'),function(){console[_0x283c('0x57')](_0x283c('0x58'),0x232c);return _0x267632(_0x283c('0x59')+0x232c);});});}; \ No newline at end of file +var _0xad49=['../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','format','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','channel','interaction','applications','isArray','length','join','app','.js','autoreply','appdata','split','push','slice','dialogflow','amazonlex','message','tag','TagId','%s:%s:%s','./interval','intervals','./applications/','consequence','priority','info','Push\x20new\x20rule','on\x20interval','\x20|\x20','Please\x20create\x20a\x20new\x20file\x20under','rules','execute','Applications\x20executed','matchPath','emit','complete','error','stack','end','QueueReport','update','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','agent','busy','busyQueue','hasOwnProperty','capacity','CurrentCapacity','agents','agent\x20not\x20found','values','chatQueues','available','loggedIn','paused','waiting','mailQueues','name','openchannelQueues','smsQueues','faxQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','server','stringify','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','lodash','jayson/promise','bluebird','uuid','../../../config/environment','routing'];(function(_0x1e17eb,_0x2e15c5){var _0x4de4c7=function(_0x52d003){while(--_0x52d003){_0x1e17eb['push'](_0x1e17eb['shift']());}};_0x4de4c7(++_0x2e15c5);}(_0xad49,0x15e));var _0x9ad4=function(_0x321e97,_0x3d88d5){_0x321e97=_0x321e97-0x0;var _0x591f04=_0xad49[_0x321e97];return _0x591f04;};'use strict';var _=require(_0x9ad4('0x0'));var util=require('util');var path=require('path');var fs=require('fs');var jayson=require(_0x9ad4('0x1'));var BPromise=require(_0x9ad4('0x2'));var uuid=require(_0x9ad4('0x3'));var config=require(_0x9ad4('0x4'));var logger=require('../../../config/logger')(_0x9ad4('0x5'));var rpc={'openchannelQueueReport':require(_0x9ad4('0x6'))};var rpc={'openchannelQueueReport':require('../rpc/openchannelQueueReport'),'mailQueueReport':require(_0x9ad4('0x7')),'chatQueueReport':require(_0x9ad4('0x8')),'smsQueueReport':require(_0x9ad4('0x9')),'faxQueueReport':require(_0x9ad4('0xa'))};var RuleEngine=require('../lib/rule-engine');function getId(_0x292f8b,_0x252792,_0x1376f5){return util[_0x9ad4('0xb')](_0x9ad4('0xc'),_0x292f8b,_0x252792||0x0,_0x1376f5||0x0);}function getIntervals(_0x216b39,_0x2c8bca){var _0xd504f9=[];if(!_[_0x9ad4('0xd')](_0x2c8bca['IntervalId'])&&!_['isNil'](_0x216b39[_0x2c8bca[_0x9ad4('0xe')]])&&!_[_0x9ad4('0xd')](_0x216b39[_0x2c8bca[_0x9ad4('0xe')]][_0x9ad4('0xf')])){_0xd504f9=_[_0x9ad4('0x10')](_0x216b39[_0x2c8bca[_0x9ad4('0xe')]][_0x9ad4('0xf')],'interval');}else if(!_[_0x9ad4('0xd')](_0x2c8bca[_0x9ad4('0x11')])){_0xd504f9=[_0x2c8bca[_0x9ad4('0x11')]];}return _0xd504f9;}exports['listen']=function(_0x564571){_0x564571['rules']={};return new BPromise(function(_0x53e6f6,_0x192130){var _0x54c460={'Start':function(_0x2c42d0){var _0x25d013=this;return new Promise(function(_0x116a23,_0x71fb4c){if(_0x2c42d0){try{var _0xb0bf70=[];var _0x80c072=getId(_0x2c42d0[_0x9ad4('0x12')],_0x2c42d0['message']?_0x2c42d0['message']['id']:0x0,_0x2c42d0[_0x9ad4('0x13')]?_0x2c42d0[_0x9ad4('0x13')]['id']:0x0);if(_0x2c42d0[_0x9ad4('0x14')]&&_[_0x9ad4('0x15')](_0x2c42d0[_0x9ad4('0x14')])&&_0x2c42d0[_0x9ad4('0x14')]['length']){for(var _0x4fb258=0x0;_0x4fb258<_0x2c42d0[_0x9ad4('0x14')][_0x9ad4('0x16')];_0x4fb258+=0x1){var _0x54cebd=_0x2c42d0[_0x9ad4('0x14')][_0x4fb258];if(fs['existsSync'](path[_0x9ad4('0x17')](__dirname,'applications',_0x54cebd[_0x9ad4('0x18')]+_0x9ad4('0x19')))){var _0x1d8739=[];switch(_0x54cebd[_0x9ad4('0x18')]['toLowerCase']()){case _0x9ad4('0x1a'):var _0x15920b=_0x54cebd[_0x9ad4('0x1b')][_0x9ad4('0x1c')](',');_0x1d8739[_0x9ad4('0x1d')](_0x15920b[0x0]);_0x1d8739[_0x9ad4('0x1d')](_0x15920b[_0x9ad4('0x1e')](0x1,_0x15920b[_0x9ad4('0x16')])[_0x9ad4('0x17')](','));break;case _0x9ad4('0x1f'):var _0x36d586=_0x54cebd['appdata'][_0x9ad4('0x1c')](',');_0x1d8739[_0x9ad4('0x1d')](_0x36d586[0x0]);_0x1d8739[_0x9ad4('0x1d')](_0x36d586[0x1]);_0x1d8739[_0x9ad4('0x1d')](_0x36d586[_0x9ad4('0x1e')](0x2,_0x36d586[_0x9ad4('0x16')])[_0x9ad4('0x17')](','));break;case _0x9ad4('0x20'):var _0xd3564c=_0x54cebd['appdata']['split'](',');_0x1d8739[_0x9ad4('0x1d')](_0xd3564c[0x0]);_0x1d8739['push'](_0xd3564c[0x1]);_0x1d8739[_0x9ad4('0x1d')](_0xd3564c[0x2]);_0x1d8739[_0x9ad4('0x1d')](_0xd3564c[0x3]);_0x1d8739[_0x9ad4('0x1d')](_0xd3564c['slice'](0x4,_0xd3564c[_0x9ad4('0x16')])['join'](','));break;case _0x9ad4('0x21'):_0x1d8739['push'](_0x54cebd[_0x9ad4('0x1b')]);break;case _0x9ad4('0x22'):_0x1d8739[_0x9ad4('0x1d')](_0x54cebd[_0x9ad4('0x23')]);_0x1d8739[_0x9ad4('0x1d')](_0x54cebd['appdata']);break;default:_0x1d8739=_[_0x9ad4('0xd')](_0x54cebd[_0x9ad4('0x1b')])?[]:_0x54cebd[_0x9ad4('0x1b')][_0x9ad4('0x1c')](',');}var _0x399632={'id':util[_0x9ad4('0xb')](_0x9ad4('0x24'),_0x80c072,_0x54cebd['id'],_0x54cebd[_0x9ad4('0x18')]),'condition':require(_0x9ad4('0x25'))['condition'](_0x80c072,getIntervals(_0x564571[_0x9ad4('0x26')],_0x54cebd),_0x564571),'consequence':require(_0x9ad4('0x27')+_0x54cebd[_0x9ad4('0x18')])[_0x9ad4('0x28')](_0x80c072,_0x1d8739,_0x564571,_0x2c42d0),'p':_0x54cebd[_0x9ad4('0x29')]||0x0};logger[_0x9ad4('0x2a')](_0x9ad4('0x2b'),_0x399632['id'],_0x9ad4('0x2c'),getIntervals(_0x564571[_0x9ad4('0x26')],_0x54cebd)[_0x9ad4('0x17')](_0x9ad4('0x2d')));_0xb0bf70[_0x9ad4('0x1d')](_0x399632);}else{logger['error'](_0x9ad4('0x2e'),path[_0x9ad4('0x17')](__dirname,_0x9ad4('0x14'),_0x54cebd[_0x9ad4('0x18')]+'.js'));}}_0x564571[_0x9ad4('0x2f')][_0x80c072]=new RuleEngine(_0xb0bf70);_0x564571[_0x9ad4('0x2f')][_0x80c072][_0x9ad4('0x30')](_0x2c42d0,function(_0x1dce86){logger['info'](_0x9ad4('0x31'),JSON['stringify'](_0x1dce86[_0x9ad4('0x32')]));if(_0x564571[_0x9ad4('0x2f')][_0x80c072]){_0x564571[_0x9ad4('0x2f')][_0x80c072][_0x9ad4('0x33')](_0x9ad4('0x34'));}});return _0x116a23({'code':0xc8,'message':_0x2c42d0});}else{logger[_0x9ad4('0x2a')]('No\x20applications\x20to\x20execute');return _0x116a23({'code':0xc8,'message':_0x2c42d0});}}catch(_0x51eb14){logger[_0x9ad4('0x35')](_0x51eb14[_0x9ad4('0x36')]);return _0x71fb4c(_0x25d013[_0x9ad4('0x35')](0x1f4,_0x51eb14));}}return _0x71fb4c('routing\x20is\x20empty');});},'AcceptMessage':function(_0x1aee5a){var _0x159820=this;return new Promise(function(_0x19f6d3,_0x4a38f0){if(_0x1aee5a[_0x9ad4('0x21')]&&_0x1aee5a['message']['id']){try{var _0xdd8d22=getId(_0x1aee5a[_0x9ad4('0x12')],_0x1aee5a['message']?_0x1aee5a['message']['id']:0x0,_0x1aee5a[_0x9ad4('0x13')]?_0x1aee5a[_0x9ad4('0x13')]['id']:0x0);if(_0x564571['rules'][_0xdd8d22]){_0x564571[_0x9ad4('0x2f')][_0xdd8d22][_0x9ad4('0x33')](_0x9ad4('0x37'));if(rpc[_0x1aee5a[_0x9ad4('0x12')]+_0x9ad4('0x38')]){rpc[_0x1aee5a[_0x9ad4('0x12')]+_0x9ad4('0x38')][_0x9ad4('0x39')](_0xdd8d22,{'UserId':_0x1aee5a[_0x9ad4('0x21')][_0x9ad4('0x3a')]})[_0x9ad4('0x3b')](function(_0x32bc59){logger['error'](_0x9ad4('0x3c'));});}}return _0x19f6d3({'code':0xc8,'message':_0x1aee5a});}catch(_0x29a6e5){logger[_0x9ad4('0x35')](_0x29a6e5[_0x9ad4('0x36')]);return _0x4a38f0(_0x159820['error'](0x1f4,_0x29a6e5));}}logger[_0x9ad4('0x35')](_0x9ad4('0x3d'));return _0x4a38f0(_0x159820[_0x9ad4('0x35')](0x1f4,'message\x20is\x20empty'));});},'RejectMessage':function(_0x415c26){var _0x417b3a=this;return new Promise(function(_0x1b51ab,_0x21a1cc){if(_0x415c26[_0x9ad4('0x3e')]&&_0x415c26[_0x9ad4('0x3e')]['id']){try{if(_0x564571['agents'][_0x415c26[_0x9ad4('0x3e')]['id']]){_0x564571['agents'][_0x415c26[_0x9ad4('0x3e')]['id']][_0x9ad4('0x3f')]=![];_0x564571['agents'][_0x415c26['agent']['id']][_0x9ad4('0x40')]=undefined;}return _0x1b51ab({'code':0xc8,'message':_0x415c26});}catch(_0x5bd6f2){logger['error'](_0x5bd6f2[_0x9ad4('0x36')]);return _0x21a1cc(_0x417b3a[_0x9ad4('0x35')](0x1f4,_0x5bd6f2));}}logger[_0x9ad4('0x35')]('message\x20is\x20empty');return _0x21a1cc(_0x417b3a[_0x9ad4('0x35')](0x1f4,_0x9ad4('0x3d')));});},'AbandonInteraction':function(_0x10bdbd){var _0x531379=this;return new Promise(function(_0x4d1002,_0x398ea6){if(_0x10bdbd['channel']&&_0x10bdbd[_0x9ad4('0x13')]&&_0x10bdbd['interaction']['id']){try{var _0x34ef8f=getId(_0x10bdbd[_0x9ad4('0x12')],_0x10bdbd['message']?_0x10bdbd[_0x9ad4('0x21')]['id']:0x0,_0x10bdbd[_0x9ad4('0x13')]?_0x10bdbd[_0x9ad4('0x13')]['id']:0x0);if(_0x564571[_0x9ad4('0x2f')][_0x34ef8f]){_0x564571[_0x9ad4('0x2f')][_0x34ef8f]['emit'](_0x9ad4('0x37'));}return _0x4d1002({'code':0xc8,'message':_0x10bdbd});}catch(_0x476467){logger[_0x9ad4('0x35')](_0x476467[_0x9ad4('0x36')]);return _0x398ea6(_0x531379[_0x9ad4('0x35')](0x1f4,_0x476467));}}logger[_0x9ad4('0x35')]('message\x20is\x20empty');return _0x398ea6(_0x531379[_0x9ad4('0x35')](0x1f4,'message\x20is\x20empty'));});},'AgentCapacity':function(_0x42750a){var _0x506304=this;return new Promise(function(_0x1db9f8,_0x1efb32){if(_0x564571['agents'][_0x9ad4('0x41')](_0x42750a['id'])){for(var _0x4f8e0f in _0x42750a[_0x9ad4('0x42')]){if(_0x42750a[_0x9ad4('0x42')][_0x9ad4('0x41')](_0x4f8e0f)){if(_0x564571['agents'][_0x42750a['id']]['hasOwnProperty'](_0x4f8e0f+_0x9ad4('0x43'))){_0x564571['agents'][_0x42750a['id']][_0x4f8e0f+_0x9ad4('0x43')]=parseInt(_0x42750a[_0x9ad4('0x42')][_0x4f8e0f],0xa);}}}_0x564571[_0x9ad4('0x44')][_0x42750a['id']]['updateRealtime']();return _0x1db9f8({'code':0xc8,'message':_0x564571[_0x9ad4('0x44')][_0x42750a['id']]});}else{return _0x1efb32(_0x506304['error'](0x1f4,_0x9ad4('0x45')));}});},'Agents':function(_0x295adf){return new Promise(function(_0x18b75a,_0x1c50c3){var _0x1bd4e6=_[_0x9ad4('0x46')](_0x564571['agents']);_0x18b75a({'count':_0x1bd4e6[_0x9ad4('0x16')],'rows':_0x1bd4e6});});},'ChatQueues':function(_0x1c6cd8){return new Promise(function(_0xbf2861,_0x148948){var _0x27c980=[];for(var _0x5d89ab in _0x564571[_0x9ad4('0x47')]){if(_0x564571[_0x9ad4('0x47')][_0x9ad4('0x41')](_0x5d89ab)){var _0x11bd64=_0x564571['chatQueues'][_0x5d89ab];var _0x266059={'id':_0x11bd64['id'],'available':_0x11bd64[_0x9ad4('0x48')],'loggedIn':_0x11bd64[_0x9ad4('0x49')],'name':_0x11bd64['name'],'paused':_0x11bd64[_0x9ad4('0x4a')],'waiting':_0x11bd64[_0x9ad4('0x4b')]};_0x27c980['push'](_0x266059);}}_0xbf2861({'count':_0x27c980[_0x9ad4('0x16')],'rows':_0x27c980});});},'MailQueues':function(_0x338f09){return new Promise(function(_0x212ae5,_0x152144){var _0x358d09=[];for(var _0x123ac3 in _0x564571[_0x9ad4('0x4c')]){if(_0x564571[_0x9ad4('0x4c')][_0x9ad4('0x41')](_0x123ac3)){var _0x39df71=_0x564571[_0x9ad4('0x4c')][_0x123ac3];var _0x545f0b={'id':_0x39df71['id'],'available':_0x39df71['available'],'loggedIn':_0x39df71[_0x9ad4('0x49')],'name':_0x39df71[_0x9ad4('0x4d')],'paused':_0x39df71[_0x9ad4('0x4a')],'waiting':_0x39df71[_0x9ad4('0x4b')]};_0x358d09[_0x9ad4('0x1d')](_0x545f0b);}}_0x212ae5({'count':_0x358d09[_0x9ad4('0x16')],'rows':_0x358d09});});},'OpenchannelQueues':function(_0x453277){return new Promise(function(_0x10bf91,_0x3ee6b5){var _0x11225b=[];for(var _0x53c14a in _0x564571[_0x9ad4('0x4e')]){if(_0x564571[_0x9ad4('0x4e')][_0x9ad4('0x41')](_0x53c14a)){var _0x403dce=_0x564571[_0x9ad4('0x4e')][_0x53c14a];var _0x6ca06c={'id':_0x403dce['id'],'available':_0x403dce['available'],'loggedIn':_0x403dce[_0x9ad4('0x49')],'name':_0x403dce[_0x9ad4('0x4d')],'paused':_0x403dce['paused'],'waiting':_0x403dce[_0x9ad4('0x4b')]};_0x11225b['push'](_0x6ca06c);}}_0x10bf91({'count':_0x11225b[_0x9ad4('0x16')],'rows':_0x11225b});});},'SmsQueues':function(_0x1e0ea7){return new Promise(function(_0x26d289,_0x5c9cb2){var _0x377f27=[];for(var _0x100838 in _0x564571['smsQueues']){if(_0x564571[_0x9ad4('0x4f')]['hasOwnProperty'](_0x100838)){var _0x28cd4d=_0x564571[_0x9ad4('0x4f')][_0x100838];var _0x555028={'id':_0x28cd4d['id'],'available':_0x28cd4d[_0x9ad4('0x48')],'loggedIn':_0x28cd4d[_0x9ad4('0x49')],'name':_0x28cd4d[_0x9ad4('0x4d')],'paused':_0x28cd4d['paused'],'waiting':_0x28cd4d[_0x9ad4('0x4b')]};_0x377f27[_0x9ad4('0x1d')](_0x555028);}}_0x26d289({'count':_0x377f27['length'],'rows':_0x377f27});});},'FaxQueues':function(_0x21ab43){return new Promise(function(_0x39f145,_0x50affc){var _0x57f30d=[];for(var _0x3eac9b in _0x564571[_0x9ad4('0x50')]){if(_0x564571[_0x9ad4('0x50')][_0x9ad4('0x41')](_0x3eac9b)){var _0x4bfbc1=_0x564571[_0x9ad4('0x50')][_0x3eac9b];var _0x460b41={'id':_0x4bfbc1['id'],'available':_0x4bfbc1[_0x9ad4('0x48')],'loggedIn':_0x4bfbc1[_0x9ad4('0x49')],'name':_0x4bfbc1['name'],'paused':_0x4bfbc1[_0x9ad4('0x4a')],'waiting':_0x4bfbc1[_0x9ad4('0x4b')]};_0x57f30d[_0x9ad4('0x1d')](_0x460b41);}}_0x39f145({'count':_0x57f30d[_0x9ad4('0x16')],'rows':_0x57f30d});});},'ChatQueuesWaitingInteractions':function(_0x568701){return new Promise(function(_0x42868c,_0x19cafd){var _0x2021c5=_[_0x9ad4('0x46')](_0x564571[_0x9ad4('0x51')]);_0x42868c({'count':_0x2021c5['length'],'rows':_0x2021c5});});},'MailQueuesWaitingInteractions':function(_0x4f0d84){return new Promise(function(_0x2d32e2,_0x13dc08){var _0x28ae45=_['values'](_0x564571[_0x9ad4('0x52')]);_0x2d32e2({'count':_0x28ae45[_0x9ad4('0x16')],'rows':_0x28ae45});});},'OpenchannelQueuesWaitingInteractions':function(_0x255b62){return new Promise(function(_0x2c22e2,_0x3ac119){var _0x31f117=_[_0x9ad4('0x46')](_0x564571[_0x9ad4('0x53')]);_0x2c22e2({'count':_0x31f117[_0x9ad4('0x16')],'rows':_0x31f117});});},'SmsQueuesWaitingInteractions':function(_0x52d236){return new Promise(function(_0x448405,_0x10be6f){var _0x556eca=_[_0x9ad4('0x46')](_0x564571['smsQueuesWaitingInteractions']);_0x448405({'count':_0x556eca[_0x9ad4('0x16')],'rows':_0x556eca});});},'FaxQueuesWaitingInteractions':function(_0x62a275){return new Promise(function(_0x4a337b,_0x2f9eb0){var _0x1137a4=_[_0x9ad4('0x46')](_0x564571['faxQueuesWaitingInteractions']);_0x4a337b({'count':_0x1137a4[_0x9ad4('0x16')],'rows':_0x1137a4});});}};var _0x116b3c=jayson[_0x9ad4('0x54')](_0x54c460)['http']();_0x116b3c['on'](_0x9ad4('0x35'),function(_0x30c0bc){logger['error'](JSON[_0x9ad4('0x55')](_0x30c0bc));return _0x192130(_0x30c0bc);});_0x116b3c['listen'](0x232c,_0x9ad4('0x56'),function(){console[_0x9ad4('0x57')](_0x9ad4('0x58'),0x232c);return _0x53e6f6('RPC\x20listening\x20on\x20port:'+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index 3986e13..cd75bbe 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 _0x49b6=['[%s][INTERVAL]\x20%s','all','then','some','info','when','[%s][INTERVAL]\x20%s\x20%s','\x20|\x20','bluebird','jayson/promise','lodash','../../../config/logger','routing','request','error','message','catch','condition','rules','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','push','Command','format','iftime\x20%s','true'];(function(_0x530db1,_0x2b9531){var _0x31c1f2=function(_0x1c77b3){while(--_0x1c77b3){_0x530db1['push'](_0x530db1['shift']());}};_0x31c1f2(++_0x2b9531);}(_0x49b6,0xaa));var _0x649b=function(_0x16270b,_0x4ff120){_0x16270b=_0x16270b-0x0;var _0x2cd122=_0x49b6[_0x16270b];return _0x2cd122;};'use strict';var util=require('util');var BPromise=require(_0x649b('0x0'));var jayson=require(_0x649b('0x1'));var _=require(_0x649b('0x2'));var logger=require(_0x649b('0x3'))(_0x649b('0x4'));var client=jayson['client']['http']({'port':0x232a});function request(_0xa68abb,_0x361d85){return new BPromise(function(_0x5848ff,_0x3bc09b){return client[_0x649b('0x5')](_0xa68abb,_0x361d85)['then'](function(_0x420cc9){if(_0x420cc9[_0x649b('0x6')]){return _0x3bc09b(_0x420cc9[_0x649b('0x6')][_0x649b('0x7')]);}else{return _0x5848ff(_0x420cc9['result']);}})[_0x649b('0x8')](function(_0x3b53e0){return _0x3bc09b(_0x3b53e0);});});}exports[_0x649b('0x9')]=function(_0x2ff518,_0x62413e,_0x23c58a){return function(_0x104b78){if(_0x23c58a[_0x649b('0xa')]&&!_0x23c58a[_0x649b('0xa')][_0x2ff518]){logger['info'](_0x649b('0xb'),_0x2ff518);return _0x104b78[_0x649b('0xc')]();}var _0x47e4c9=[];for(var _0x1b6d97=0x0;_0x1b6d97<_0x62413e[_0x649b('0xd')];_0x1b6d97+=0x1){_0x47e4c9[_0x649b('0xe')](request(_0x649b('0xf'),{'command':util[_0x649b('0x10')](_0x649b('0x11'),_0x62413e[_0x1b6d97])})['then'](function(_0x184b0f){return _0x184b0f&&_0x184b0f[_0x649b('0x7')]&&_0x184b0f[_0x649b('0x7')]['indexOf'](_0x649b('0x12'))>=0x0?!![]:![];})[_0x649b('0x8')](function(_0x175e54){logger['error'](_0x649b('0x13'),_0x2ff518,_0x62413e[_0x1b6d97]);}));}BPromise[_0x649b('0x14')](_0x47e4c9)[_0x649b('0x15')](function(_0x197350){var _0x3e675a=_[_0x649b('0x16')](_0x197350);logger[_0x649b('0x17')]('[%s][INTERVAL]\x20%s\x20%s',_0x2ff518,_0x62413e['join']('\x20|\x20'),_0x3e675a);_0x104b78[_0x649b('0x18')](_0x3e675a);})['catch'](function(_0x4badfb){console['log'](_0x4badfb);logger[_0x649b('0x6')](_0x649b('0x19'),_0x2ff518,_0x62413e['join'](_0x649b('0x1a')),_0x4badfb['stack']);_0x104b78[_0x649b('0xc')]();});};}; \ No newline at end of file +var _0xa97b=['Command','format','indexOf','true','[%s][INTERVAL]\x20%s','all','some','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','stack','stop','util','bluebird','lodash','../../../config/logger','routing','client','request','then','error','message','catch','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','push'];(function(_0x192134,_0x797285){var _0x1249c2=function(_0x431e50){while(--_0x431e50){_0x192134['push'](_0x192134['shift']());}};_0x1249c2(++_0x797285);}(_0xa97b,0x135));var _0xba97=function(_0x4077c5,_0x48ac0b){_0x4077c5=_0x4077c5-0x0;var _0x568bf5=_0xa97b[_0x4077c5];return _0x568bf5;};'use strict';var util=require(_0xba97('0x0'));var BPromise=require(_0xba97('0x1'));var jayson=require('jayson/promise');var _=require(_0xba97('0x2'));var logger=require(_0xba97('0x3'))(_0xba97('0x4'));var client=jayson[_0xba97('0x5')]['http']({'port':0x232a});function request(_0x3e9323,_0x23b28c){return new BPromise(function(_0x43cfee,_0x3ca4dc){return client[_0xba97('0x6')](_0x3e9323,_0x23b28c)[_0xba97('0x7')](function(_0x3cef38){if(_0x3cef38['error']){return _0x3ca4dc(_0x3cef38[_0xba97('0x8')][_0xba97('0x9')]);}else{return _0x43cfee(_0x3cef38['result']);}})[_0xba97('0xa')](function(_0x4665be){return _0x3ca4dc(_0x4665be);});});}exports['condition']=function(_0x53245f,_0x15c3d9,_0x505c7a){return function(_0x2b27b8){if(_0x505c7a[_0xba97('0xb')]&&!_0x505c7a[_0xba97('0xb')][_0x53245f]){logger[_0xba97('0xc')](_0xba97('0xd'),_0x53245f);return _0x2b27b8['stop']();}var _0x35dcfd=[];for(var _0x62e59c=0x0;_0x62e59c<_0x15c3d9['length'];_0x62e59c+=0x1){_0x35dcfd[_0xba97('0xe')](request(_0xba97('0xf'),{'command':util[_0xba97('0x10')]('iftime\x20%s',_0x15c3d9[_0x62e59c])})['then'](function(_0xf93759){return _0xf93759&&_0xf93759[_0xba97('0x9')]&&_0xf93759['message'][_0xba97('0x11')](_0xba97('0x12'))>=0x0?!![]:![];})[_0xba97('0xa')](function(_0x235101){logger[_0xba97('0x8')](_0xba97('0x13'),_0x53245f,_0x15c3d9[_0x62e59c]);}));}BPromise[_0xba97('0x14')](_0x35dcfd)[_0xba97('0x7')](function(_0x24d604){var _0x4bb9c7=_[_0xba97('0x15')](_0x24d604);logger['info'](_0xba97('0x16'),_0x53245f,_0x15c3d9[_0xba97('0x17')](_0xba97('0x18')),_0x4bb9c7);_0x2b27b8['when'](_0x4bb9c7);})[_0xba97('0xa')](function(_0x1e4567){console['log'](_0x1e4567);logger['error']('[%s][INTERVAL]\x20%s\x20%s',_0x53245f,_0x15c3d9[_0xba97('0x17')](_0xba97('0x18')),_0x1e4567[_0xba97('0x19')]);_0x2b27b8[_0xba97('0x1a')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index 2d30089..0dbba4d 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 _0xf567=['agententerreason','clone','ATTENDED','secondtransfererexten','transfertargetuniqueid','calleridname','hangup','agent','lodash','util','./utils','info','AGENT|%s|%s|%s|%s|%s|%s|%s|%s','uniqueid','channel','queue','interface','calleridnum','connectedlinenum','getVoiceQueueByName','then','type','agentacw','agentcomplete','acw','acwtime','acwTimeout','request','CreateVoiceAgentReport','destuniqueid','agentcalled','agentcalledAt','now','called','connectedlinename','stack','isNil','agentringnoanswer','agentringnoanswerAt','timeout','reason','holdtime','ringtime','talktime','error','forIn','abandoned','agentconnect','agentconnectAt','lastevent','connect','answered_elsewhere','answeredelsewheredestinationuniqueid','membername','agentcompleteAt','diffTime','complete','blindtransfer','transfereruniqueid','transfer','transfertype','blind','transferexten','extension','transferuniqueid','secondtransfereruniqueid','origtransfereruniqueid','transfereeuniqueid'];(function(_0x970c4,_0x512095){var _0x4d3ae5=function(_0x18391f){while(--_0x18391f){_0x970c4['push'](_0x970c4['shift']());}};_0x4d3ae5(++_0x512095);}(_0xf567,0x118));var _0x7f56=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xf567[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0x7f56('0x0'));var util=require(_0x7f56('0x1'));var utils=require(_0x7f56('0x2'));var agents={};var transfers={};function writeDB(_0x543f60,_0x1cba45){utils[_0x7f56('0x3')](util['format'](_0x7f56('0x4'),_0x543f60[_0x7f56('0x5')],_0x543f60[_0x7f56('0x6')],_0x543f60[_0x7f56('0x7')],_0x543f60['membername'],_0x543f60[_0x7f56('0x8')],_0x543f60[_0x7f56('0x9')],_0x543f60[_0x7f56('0xa')],_0x543f60['lastevent']));if(_0x543f60[_0x7f56('0x7')]){utils[_0x7f56('0xb')](_0x543f60[_0x7f56('0x7')])[_0x7f56('0xc')](function(_0x3ac422){if(_0x3ac422){_0x543f60[_0x7f56('0xd')]=_0x3ac422[_0x7f56('0xd')];_0x543f60[_0x7f56('0xe')]=_0x543f60[_0x7f56('0xf')]?_0x3ac422[_0x7f56('0x10')]:![];_0x543f60[_0x7f56('0x11')]=_0x543f60[_0x7f56('0xe')]?_0x3ac422[_0x7f56('0x12')]:0x0;}utils[_0x7f56('0x13')](_0x7f56('0x14'),_0x543f60);});}else{utils[_0x7f56('0x13')](_0x7f56('0x14'),_0x543f60);}if(_0x1cba45){delete transfers[_0x543f60[_0x7f56('0x5')]];}else{delete agents[_0x543f60[_0x7f56('0x15')]];}}exports[_0x7f56('0x16')]=function(_0x1fefee){try{agents[_0x1fefee[_0x7f56('0x15')]]=_0x1fefee;agents[_0x1fefee['destuniqueid']][_0x7f56('0x17')]=utils[_0x7f56('0x18')]();agents[_0x1fefee[_0x7f56('0x15')]]['lastevent']=_0x7f56('0x19');agents[_0x1fefee[_0x7f56('0x15')]]['connectedlinenum']=null;agents[_0x1fefee[_0x7f56('0x15')]][_0x7f56('0x1a')]=null;}catch(_0x4ad41a){utils['error'](_0x4ad41a[_0x7f56('0x1b')]);}};exports['agentringnoanswer']=function(_0x415b6f){try{if(!_[_0x7f56('0x1c')](agents[_0x415b6f['destuniqueid']])){agents[_0x415b6f[_0x7f56('0x15')]][_0x7f56('0x1d')]=!![];agents[_0x415b6f[_0x7f56('0x15')]][_0x7f56('0x1e')]=utils[_0x7f56('0x18')]();agents[_0x415b6f[_0x7f56('0x15')]]['lastevent']=_0x7f56('0x1f');agents[_0x415b6f['destuniqueid']][_0x7f56('0x20')]='timeout';agents[_0x415b6f[_0x7f56('0x15')]][_0x7f56('0x21')]=_0x415b6f[_0x7f56('0x22')]?parseInt(_0x415b6f[_0x7f56('0x22')])/0x3e8:0x0;agents[_0x415b6f[_0x7f56('0x15')]][_0x7f56('0x23')]=0x0;writeDB(agents[_0x415b6f[_0x7f56('0x15')]]);}}catch(_0x3f54f8){utils[_0x7f56('0x24')](_0x3f54f8[_0x7f56('0x1b')]);}};exports['queuecallerabandon']=function(_0x19bc9f){try{_[_0x7f56('0x25')](agents,function(_0x2943fe,_0x3c8658){if(_0x2943fe[_0x7f56('0x5')]==_0x19bc9f[_0x7f56('0x5')]){_0x2943fe[_0x7f56('0x1d')]=!![];_0x2943fe['agentringnoanswerAt']=utils['now']();_0x2943fe['lastevent']=_0x7f56('0x26');_0x2943fe['reason']=_0x7f56('0x26');_0x2943fe[_0x7f56('0x21')]=_0x19bc9f[_0x7f56('0x21')];_0x2943fe['talktime']=0x0;writeDB(_0x2943fe);}});}catch(_0x236120){utils[_0x7f56('0x24')](_0x236120[_0x7f56('0x1b')]);}};exports[_0x7f56('0x27')]=function(_0x5ea887){try{if(agents[_0x5ea887[_0x7f56('0x15')]]){agents[_0x5ea887[_0x7f56('0x15')]][_0x7f56('0x28')]=utils['now']();agents[_0x5ea887[_0x7f56('0x15')]][_0x7f56('0xa')]=_0x5ea887['connectedlinenum'];agents[_0x5ea887['destuniqueid']]['connectedlinename']=_0x5ea887[_0x7f56('0x1a')];agents[_0x5ea887['destuniqueid']]['holdtime']=_0x5ea887[_0x7f56('0x22')];agents[_0x5ea887['destuniqueid']][_0x7f56('0x29')]=_0x7f56('0x2a');_[_0x7f56('0x25')](agents,function(_0x523805,_0x134cfb){if(_0x523805[_0x7f56('0x15')]!=_0x5ea887[_0x7f56('0x15')]&&_0x523805['uniqueid']==_0x5ea887[_0x7f56('0x5')]){_0x523805[_0x7f56('0x23')]=0x0;_0x523805[_0x7f56('0x21')]=_0x5ea887[_0x7f56('0x22')];_0x523805[_0x7f56('0x1d')]=!![];_0x523805[_0x7f56('0x1e')]=utils[_0x7f56('0x18')]();_0x523805[_0x7f56('0x29')]=_0x7f56('0x2b');_0x523805[_0x7f56('0x20')]=_0x7f56('0x2b');_0x523805[_0x7f56('0x2c')]=_0x5ea887['destuniqueid'];_0x523805['answeredelsewheremembername']=_0x5ea887[_0x7f56('0x2d')];writeDB(_0x523805);}});}}catch(_0x5f22b2){utils[_0x7f56('0x24')](_0x5f22b2[_0x7f56('0x1b')]);}};exports['agentcomplete']=function(_0x444c9b){try{if(!_[_0x7f56('0x1c')](agents[_0x444c9b['destuniqueid']])){agents[_0x444c9b[_0x7f56('0x15')]][_0x7f56('0xf')]=!![];agents[_0x444c9b['destuniqueid']][_0x7f56('0x2e')]=utils[_0x7f56('0x18')]();agents[_0x444c9b[_0x7f56('0x15')]]['talktime']=utils[_0x7f56('0x2f')](agents[_0x444c9b['destuniqueid']][_0x7f56('0x2e')],agents[_0x444c9b['destuniqueid']][_0x7f56('0x28')]);agents[_0x444c9b[_0x7f56('0x15')]]['reason']=_0x444c9b['reason'];agents[_0x444c9b['destuniqueid']][_0x7f56('0x29')]=_0x7f56('0x30');writeDB(agents[_0x444c9b['destuniqueid']]);}}catch(_0x471e8b){utils[_0x7f56('0x24')](_0x471e8b[_0x7f56('0x1b')]);}};exports[_0x7f56('0x31')]=function(_0x3aaf4d){try{if(!_[_0x7f56('0x1c')](agents[_0x3aaf4d[_0x7f56('0x32')]])){agents[_0x3aaf4d[_0x7f56('0x32')]][_0x7f56('0x33')]=!![];agents[_0x3aaf4d[_0x7f56('0x32')]][_0x7f56('0x34')]=_0x7f56('0x35');agents[_0x3aaf4d[_0x7f56('0x32')]][_0x7f56('0x36')]=_0x3aaf4d[_0x7f56('0x37')];agents[_0x3aaf4d[_0x7f56('0x32')]][_0x7f56('0x38')]=agents[_0x3aaf4d[_0x7f56('0x32')]][_0x7f56('0x5')];}}catch(_0xe02966){utils[_0x7f56('0x24')](_0xe02966[_0x7f56('0x1b')]);}};exports['attendedtransfer']=function(_0x2df274){try{if(_0x2df274['origtransfereruniqueid']==_0x2df274['origtransfererlinkedid']){if(!_[_0x7f56('0x1c')](agents[_0x2df274[_0x7f56('0x39')]])){agents[_0x2df274[_0x7f56('0x39')]][_0x7f56('0x33')]=!![];agents[_0x2df274[_0x7f56('0x39')]][_0x7f56('0x34')]='ATTENDED';agents[_0x2df274[_0x7f56('0x39')]][_0x7f56('0x36')]=_0x2df274['origtransfererexten'];agents[_0x2df274[_0x7f56('0x39')]][_0x7f56('0x38')]=_0x2df274[_0x7f56('0x3a')];}if(_0x2df274[_0x7f56('0x3b')]&&agents[_0x2df274[_0x7f56('0x3b')]]){agents[_0x2df274[_0x7f56('0x3b')]][_0x7f56('0x3c')]=0x1;transfers[_0x2df274[_0x7f56('0x3b')]]=_[_0x7f56('0x3d')](agents[_0x2df274[_0x7f56('0x3b')]]);transfers[_0x2df274[_0x7f56('0x3b')]]['calleridnum']=agents[_0x2df274['secondtransfereruniqueid']][_0x7f56('0x9')];transfers[_0x2df274[_0x7f56('0x3b')]]['calleridname']=agents[_0x2df274[_0x7f56('0x39')]]['calleridname'];transfers[_0x2df274[_0x7f56('0x3b')]][_0x7f56('0x17')]=utils[_0x7f56('0x18')]();transfers[_0x2df274['transfereeuniqueid']][_0x7f56('0x28')]=utils['now']();transfers[_0x2df274['transfereeuniqueid']][_0x7f56('0x21')]=0x0;transfers[_0x2df274[_0x7f56('0x3b')]]['agententerreason']=0x2;}}else if(_0x2df274[_0x7f56('0x39')]==_0x2df274['secondtransfererlinkedid']){if(!_[_0x7f56('0x1c')](agents[_0x2df274[_0x7f56('0x3a')]])){agents[_0x2df274[_0x7f56('0x3a')]][_0x7f56('0x33')]=!![];agents[_0x2df274['origtransfereruniqueid']][_0x7f56('0x34')]=_0x7f56('0x3e');agents[_0x2df274[_0x7f56('0x3a')]][_0x7f56('0x36')]=_0x2df274[_0x7f56('0x3f')];agents[_0x2df274[_0x7f56('0x3a')]][_0x7f56('0x38')]=_0x2df274[_0x7f56('0x39')];}if(_0x2df274[_0x7f56('0x40')]&&agents[_0x2df274['transfertargetuniqueid']]){agents[_0x2df274['transfertargetuniqueid']][_0x7f56('0x3c')]=0x1;transfers[_0x2df274['transfertargetuniqueid']]=_[_0x7f56('0x3d')](agents[_0x2df274[_0x7f56('0x40')]]);transfers[_0x2df274['transfertargetuniqueid']][_0x7f56('0x9')]=agents[_0x2df274[_0x7f56('0x3a')]]['calleridnum'];transfers[_0x2df274[_0x7f56('0x40')]][_0x7f56('0x41')]=agents[_0x2df274[_0x7f56('0x3a')]]['calleridname'];transfers[_0x2df274[_0x7f56('0x40')]][_0x7f56('0x17')]=utils[_0x7f56('0x18')]();transfers[_0x2df274[_0x7f56('0x40')]]['agentconnectAt']=utils[_0x7f56('0x18')]();transfers[_0x2df274['transfertargetuniqueid']][_0x7f56('0x21')]=0x0;transfers[_0x2df274[_0x7f56('0x40')]][_0x7f56('0x3c')]=0x2;}}}catch(_0x39de6e){utils[_0x7f56('0x24')](_0x39de6e[_0x7f56('0x1b')]);}};exports[_0x7f56('0x42')]=function(_0x250315){try{if(transfers[_0x250315[_0x7f56('0x5')]]){transfers[_0x250315[_0x7f56('0x5')]][_0x7f56('0xf')]=!![];transfers[_0x250315[_0x7f56('0x5')]][_0x7f56('0x2e')]=utils[_0x7f56('0x18')]();transfers[_0x250315[_0x7f56('0x5')]][_0x7f56('0x23')]=utils[_0x7f56('0x2f')](transfers[_0x250315[_0x7f56('0x5')]]['agentcompleteAt'],transfers[_0x250315[_0x7f56('0x5')]][_0x7f56('0x28')]);transfers[_0x250315['uniqueid']][_0x7f56('0x20')]='agent';transfers[_0x250315[_0x7f56('0x5')]]['lastevent']=_0x7f56('0x30');writeDB(transfers[_0x250315['uniqueid']],!![]);}if(agents[_0x250315[_0x7f56('0x5')]]&&agents[_0x250315[_0x7f56('0x5')]][_0x7f56('0x28')]){agents[_0x250315['uniqueid']][_0x7f56('0xf')]=!![];agents[_0x250315[_0x7f56('0x5')]][_0x7f56('0x2e')]=utils[_0x7f56('0x18')]();agents[_0x250315[_0x7f56('0x5')]][_0x7f56('0x23')]=utils[_0x7f56('0x2f')](agents[_0x250315[_0x7f56('0x5')]][_0x7f56('0x2e')],agents[_0x250315[_0x7f56('0x5')]][_0x7f56('0x28')]);agents[_0x250315[_0x7f56('0x5')]][_0x7f56('0x20')]=agents[_0x250315[_0x7f56('0x5')]][_0x7f56('0x33')]?_0x7f56('0x33'):_0x7f56('0x43');agents[_0x250315[_0x7f56('0x5')]][_0x7f56('0x29')]=_0x7f56('0x30');writeDB(agents[_0x250315[_0x7f56('0x5')]]);}}catch(_0xab66a7){utils[_0x7f56('0x24')](_0xab66a7[_0x7f56('0x1b')]);}}; \ No newline at end of file +var _0x11e3=['acwtime','acwTimeout','request','CreateVoiceAgentReport','destuniqueid','agentcalledAt','now','connectedlinename','error','agentringnoanswer','agentringnoanswerAt','timeout','reason','holdtime','ringtime','stack','queuecallerabandon','agentconnect','agentconnectAt','connect','forIn','talktime','answered_elsewhere','answeredelsewheremembername','membername','isNil','agentcompleteAt','diffTime','complete','transfereruniqueid','transfer','transfertype','transferexten','extension','transferuniqueid','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','ATTENDED','transfereeuniqueid','agententerreason','clone','calleridname','secondtransfererlinkedid','secondtransfererexten','transfertargetuniqueid','agent','lodash','util','./utils','info','format','uniqueid','channel','interface','calleridnum','connectedlinenum','lastevent','queue','getVoiceQueueByName','then','type','agentacw','agentcomplete'];(function(_0x13032f,_0x350a6b){var _0x6be26e=function(_0x1972ec){while(--_0x1972ec){_0x13032f['push'](_0x13032f['shift']());}};_0x6be26e(++_0x350a6b);}(_0x11e3,0x6f));var _0x311e=function(_0x2ff6a3,_0x4f3774){_0x2ff6a3=_0x2ff6a3-0x0;var _0x553189=_0x11e3[_0x2ff6a3];return _0x553189;};'use strict';var _=require(_0x311e('0x0'));var util=require(_0x311e('0x1'));var utils=require(_0x311e('0x2'));var agents={};var transfers={};function writeDB(_0x34bbaa,_0x4b29b7){utils[_0x311e('0x3')](util[_0x311e('0x4')]('AGENT|%s|%s|%s|%s|%s|%s|%s|%s',_0x34bbaa[_0x311e('0x5')],_0x34bbaa[_0x311e('0x6')],_0x34bbaa['queue'],_0x34bbaa['membername'],_0x34bbaa[_0x311e('0x7')],_0x34bbaa[_0x311e('0x8')],_0x34bbaa[_0x311e('0x9')],_0x34bbaa[_0x311e('0xa')]));if(_0x34bbaa[_0x311e('0xb')]){utils[_0x311e('0xc')](_0x34bbaa[_0x311e('0xb')])[_0x311e('0xd')](function(_0x46c888){if(_0x46c888){_0x34bbaa[_0x311e('0xe')]=_0x46c888[_0x311e('0xe')];_0x34bbaa[_0x311e('0xf')]=_0x34bbaa[_0x311e('0x10')]?_0x46c888['acw']:![];_0x34bbaa[_0x311e('0x11')]=_0x34bbaa['agentacw']?_0x46c888[_0x311e('0x12')]:0x0;}utils[_0x311e('0x13')](_0x311e('0x14'),_0x34bbaa);});}else{utils[_0x311e('0x13')]('CreateVoiceAgentReport',_0x34bbaa);}if(_0x4b29b7){delete transfers[_0x34bbaa['uniqueid']];}else{delete agents[_0x34bbaa[_0x311e('0x15')]];}}exports['agentcalled']=function(_0x4b8991){try{agents[_0x4b8991[_0x311e('0x15')]]=_0x4b8991;agents[_0x4b8991[_0x311e('0x15')]][_0x311e('0x16')]=utils[_0x311e('0x17')]();agents[_0x4b8991[_0x311e('0x15')]][_0x311e('0xa')]='called';agents[_0x4b8991[_0x311e('0x15')]]['connectedlinenum']=null;agents[_0x4b8991['destuniqueid']][_0x311e('0x18')]=null;}catch(_0x4e6108){utils[_0x311e('0x19')](_0x4e6108['stack']);}};exports[_0x311e('0x1a')]=function(_0x1505fe){try{if(!_['isNil'](agents[_0x1505fe[_0x311e('0x15')]])){agents[_0x1505fe[_0x311e('0x15')]][_0x311e('0x1a')]=!![];agents[_0x1505fe['destuniqueid']][_0x311e('0x1b')]=utils[_0x311e('0x17')]();agents[_0x1505fe[_0x311e('0x15')]][_0x311e('0xa')]=_0x311e('0x1c');agents[_0x1505fe['destuniqueid']][_0x311e('0x1d')]='timeout';agents[_0x1505fe[_0x311e('0x15')]][_0x311e('0x1e')]=_0x1505fe[_0x311e('0x1f')]?parseInt(_0x1505fe['ringtime'])/0x3e8:0x0;agents[_0x1505fe[_0x311e('0x15')]]['talktime']=0x0;writeDB(agents[_0x1505fe[_0x311e('0x15')]]);}}catch(_0x28d8e3){utils[_0x311e('0x19')](_0x28d8e3[_0x311e('0x20')]);}};exports[_0x311e('0x21')]=function(_0x3916d4){try{_['forIn'](agents,function(_0x3e2ae7,_0x573bbb){if(_0x3e2ae7[_0x311e('0x5')]==_0x3916d4[_0x311e('0x5')]){_0x3e2ae7[_0x311e('0x1a')]=!![];_0x3e2ae7[_0x311e('0x1b')]=utils['now']();_0x3e2ae7[_0x311e('0xa')]='abandoned';_0x3e2ae7[_0x311e('0x1d')]='abandoned';_0x3e2ae7[_0x311e('0x1e')]=_0x3916d4[_0x311e('0x1e')];_0x3e2ae7['talktime']=0x0;writeDB(_0x3e2ae7);}});}catch(_0x1dbee8){utils[_0x311e('0x19')](_0x1dbee8[_0x311e('0x20')]);}};exports[_0x311e('0x22')]=function(_0x12f736){try{if(agents[_0x12f736[_0x311e('0x15')]]){agents[_0x12f736[_0x311e('0x15')]][_0x311e('0x23')]=utils['now']();agents[_0x12f736[_0x311e('0x15')]][_0x311e('0x9')]=_0x12f736[_0x311e('0x9')];agents[_0x12f736[_0x311e('0x15')]][_0x311e('0x18')]=_0x12f736[_0x311e('0x18')];agents[_0x12f736[_0x311e('0x15')]][_0x311e('0x1e')]=_0x12f736[_0x311e('0x1f')];agents[_0x12f736[_0x311e('0x15')]][_0x311e('0xa')]=_0x311e('0x24');_[_0x311e('0x25')](agents,function(_0x595730,_0xa3139f){if(_0x595730[_0x311e('0x15')]!=_0x12f736[_0x311e('0x15')]&&_0x595730[_0x311e('0x5')]==_0x12f736[_0x311e('0x5')]){_0x595730[_0x311e('0x26')]=0x0;_0x595730[_0x311e('0x1e')]=_0x12f736['ringtime'];_0x595730['agentringnoanswer']=!![];_0x595730[_0x311e('0x1b')]=utils['now']();_0x595730[_0x311e('0xa')]=_0x311e('0x27');_0x595730[_0x311e('0x1d')]=_0x311e('0x27');_0x595730['answeredelsewheredestinationuniqueid']=_0x12f736[_0x311e('0x15')];_0x595730[_0x311e('0x28')]=_0x12f736[_0x311e('0x29')];writeDB(_0x595730);}});}}catch(_0x4673aa){utils['error'](_0x4673aa[_0x311e('0x20')]);}};exports[_0x311e('0x10')]=function(_0x13c928){try{if(!_[_0x311e('0x2a')](agents[_0x13c928[_0x311e('0x15')]])){agents[_0x13c928[_0x311e('0x15')]][_0x311e('0x10')]=!![];agents[_0x13c928['destuniqueid']][_0x311e('0x2b')]=utils[_0x311e('0x17')]();agents[_0x13c928[_0x311e('0x15')]]['talktime']=utils[_0x311e('0x2c')](agents[_0x13c928[_0x311e('0x15')]][_0x311e('0x2b')],agents[_0x13c928[_0x311e('0x15')]][_0x311e('0x23')]);agents[_0x13c928[_0x311e('0x15')]][_0x311e('0x1d')]=_0x13c928[_0x311e('0x1d')];agents[_0x13c928[_0x311e('0x15')]]['lastevent']=_0x311e('0x2d');writeDB(agents[_0x13c928[_0x311e('0x15')]]);}}catch(_0x1ddbb9){utils[_0x311e('0x19')](_0x1ddbb9['stack']);}};exports['blindtransfer']=function(_0x1e11f5){try{if(!_[_0x311e('0x2a')](agents[_0x1e11f5[_0x311e('0x2e')]])){agents[_0x1e11f5['transfereruniqueid']][_0x311e('0x2f')]=!![];agents[_0x1e11f5[_0x311e('0x2e')]][_0x311e('0x30')]='blind';agents[_0x1e11f5[_0x311e('0x2e')]][_0x311e('0x31')]=_0x1e11f5[_0x311e('0x32')];agents[_0x1e11f5['transfereruniqueid']][_0x311e('0x33')]=agents[_0x1e11f5[_0x311e('0x2e')]][_0x311e('0x5')];}}catch(_0x226e5d){utils[_0x311e('0x19')](_0x226e5d[_0x311e('0x20')]);}};exports['attendedtransfer']=function(_0x13428e){try{if(_0x13428e[_0x311e('0x34')]==_0x13428e[_0x311e('0x35')]){if(!_[_0x311e('0x2a')](agents[_0x13428e[_0x311e('0x36')]])){agents[_0x13428e['secondtransfereruniqueid']][_0x311e('0x2f')]=!![];agents[_0x13428e[_0x311e('0x36')]][_0x311e('0x30')]=_0x311e('0x37');agents[_0x13428e['secondtransfereruniqueid']]['transferexten']=_0x13428e['origtransfererexten'];agents[_0x13428e['secondtransfereruniqueid']][_0x311e('0x33')]=_0x13428e[_0x311e('0x34')];}if(_0x13428e[_0x311e('0x38')]&&agents[_0x13428e[_0x311e('0x38')]]){agents[_0x13428e[_0x311e('0x38')]][_0x311e('0x39')]=0x1;transfers[_0x13428e[_0x311e('0x38')]]=_[_0x311e('0x3a')](agents[_0x13428e['transfereeuniqueid']]);transfers[_0x13428e['transfereeuniqueid']][_0x311e('0x8')]=agents[_0x13428e[_0x311e('0x36')]]['calleridnum'];transfers[_0x13428e[_0x311e('0x38')]][_0x311e('0x3b')]=agents[_0x13428e['secondtransfereruniqueid']][_0x311e('0x3b')];transfers[_0x13428e[_0x311e('0x38')]]['agentcalledAt']=utils['now']();transfers[_0x13428e[_0x311e('0x38')]][_0x311e('0x23')]=utils[_0x311e('0x17')]();transfers[_0x13428e['transfereeuniqueid']][_0x311e('0x1e')]=0x0;transfers[_0x13428e[_0x311e('0x38')]]['agententerreason']=0x2;}}else if(_0x13428e['secondtransfereruniqueid']==_0x13428e[_0x311e('0x3c')]){if(!_[_0x311e('0x2a')](agents[_0x13428e[_0x311e('0x34')]])){agents[_0x13428e['origtransfereruniqueid']][_0x311e('0x2f')]=!![];agents[_0x13428e[_0x311e('0x34')]]['transfertype']=_0x311e('0x37');agents[_0x13428e['origtransfereruniqueid']]['transferexten']=_0x13428e[_0x311e('0x3d')];agents[_0x13428e['origtransfereruniqueid']]['transferuniqueid']=_0x13428e[_0x311e('0x36')];}if(_0x13428e[_0x311e('0x3e')]&&agents[_0x13428e[_0x311e('0x3e')]]){agents[_0x13428e['transfertargetuniqueid']][_0x311e('0x39')]=0x1;transfers[_0x13428e[_0x311e('0x3e')]]=_[_0x311e('0x3a')](agents[_0x13428e[_0x311e('0x3e')]]);transfers[_0x13428e[_0x311e('0x3e')]][_0x311e('0x8')]=agents[_0x13428e[_0x311e('0x34')]][_0x311e('0x8')];transfers[_0x13428e[_0x311e('0x3e')]]['calleridname']=agents[_0x13428e[_0x311e('0x34')]][_0x311e('0x3b')];transfers[_0x13428e[_0x311e('0x3e')]][_0x311e('0x16')]=utils[_0x311e('0x17')]();transfers[_0x13428e[_0x311e('0x3e')]][_0x311e('0x23')]=utils[_0x311e('0x17')]();transfers[_0x13428e[_0x311e('0x3e')]][_0x311e('0x1e')]=0x0;transfers[_0x13428e[_0x311e('0x3e')]][_0x311e('0x39')]=0x2;}}}catch(_0x559a38){utils['error'](_0x559a38['stack']);}};exports['hangup']=function(_0x500e78){try{if(transfers[_0x500e78[_0x311e('0x5')]]){transfers[_0x500e78[_0x311e('0x5')]][_0x311e('0x10')]=!![];transfers[_0x500e78['uniqueid']][_0x311e('0x2b')]=utils[_0x311e('0x17')]();transfers[_0x500e78[_0x311e('0x5')]][_0x311e('0x26')]=utils[_0x311e('0x2c')](transfers[_0x500e78[_0x311e('0x5')]][_0x311e('0x2b')],transfers[_0x500e78[_0x311e('0x5')]][_0x311e('0x23')]);transfers[_0x500e78[_0x311e('0x5')]]['reason']='agent';transfers[_0x500e78[_0x311e('0x5')]][_0x311e('0xa')]=_0x311e('0x2d');writeDB(transfers[_0x500e78[_0x311e('0x5')]],!![]);}if(agents[_0x500e78[_0x311e('0x5')]]&&agents[_0x500e78[_0x311e('0x5')]][_0x311e('0x23')]){agents[_0x500e78[_0x311e('0x5')]]['agentcomplete']=!![];agents[_0x500e78[_0x311e('0x5')]][_0x311e('0x2b')]=utils[_0x311e('0x17')]();agents[_0x500e78[_0x311e('0x5')]][_0x311e('0x26')]=utils[_0x311e('0x2c')](agents[_0x500e78[_0x311e('0x5')]][_0x311e('0x2b')],agents[_0x500e78['uniqueid']][_0x311e('0x23')]);agents[_0x500e78[_0x311e('0x5')]]['reason']=agents[_0x500e78[_0x311e('0x5')]][_0x311e('0x2f')]?_0x311e('0x2f'):_0x311e('0x3f');agents[_0x500e78['uniqueid']][_0x311e('0xa')]=_0x311e('0x2d');writeDB(agents[_0x500e78[_0x311e('0x5')]]);}}catch(_0x5d3813){utils[_0x311e('0x19')](_0x5d3813['stack']);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index f2514af..b67029b 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 _0x91fc=['destination','callerid','disposition','getUserByInternal','then','UserId','CreateVoiceCallReport','request','newchannel','linkedid','calleridnum','exten','context','now','DOCUMENTATION','stack','newstate','isNil','channelstate','systemanswertime','transfer','answertime','toNumber','error','hangup','calleridname','duration','diffTime','endtime','billableseconds','attendedtransfer','transfereechannel','localtwolinkedid','destinationchannel','secondtransfererchannel','userfield','_attended','origtransfererchannel','musiconholdstart','musiconholdstartAt','mohtime','varset','variable','xmd-phone','value','\x22\x20<','xmd-callerid','xmd-queue','lastapplication','Queue','lastdata','queue','xmd-contactid','ContactId','xmd-cdrtype','sipcallid','newexten','set','startsWith','appdata','toLowerCase','cdr','split','lastIndexOf','includes','noop','gotoif','application','util','NO\x20ANSWER','FAILED','ANSWERED','BUSY','info','format','uniqueid','channel','type','accountcode','source'];(function(_0x350079,_0x510691){var _0x220852=function(_0x4e7d34){while(--_0x4e7d34){_0x350079['push'](_0x350079['shift']());}};_0x220852(++_0x510691);}(_0x91fc,0x134));var _0xc91f=function(_0x3d0870,_0x8e053c){_0x3d0870=_0x3d0870-0x0;var _0x3735bf=_0x91fc[_0x3d0870];return _0x3735bf;};'use strict';var _=require('lodash');var util=require(_0xc91f('0x0'));var utils=require('./utils');var dispositions=[_0xc91f('0x1'),_0xc91f('0x2'),_0xc91f('0x2'),_0xc91f('0x1'),'NO\x20ANSWER','NO\x20ANSWER',_0xc91f('0x3'),_0xc91f('0x4'),_0xc91f('0x2'),_0xc91f('0x2'),_0xc91f('0x2')];var channels={};function writeDB(_0x3a9d9e){utils[_0xc91f('0x5')](util[_0xc91f('0x6')]('CALL|%s|%s|%s|%s|%s|%s|%s|%s',_0x3a9d9e[_0xc91f('0x7')],_0x3a9d9e[_0xc91f('0x8')],_0x3a9d9e[_0xc91f('0x9')],_0x3a9d9e[_0xc91f('0xa')],_0x3a9d9e[_0xc91f('0xb')],_0x3a9d9e[_0xc91f('0xc')],_0x3a9d9e[_0xc91f('0xd')],_0x3a9d9e[_0xc91f('0xe')]));if(_0x3a9d9e[_0xc91f('0xa')]){utils[_0xc91f('0xf')](_0x3a9d9e[_0xc91f('0xa')])[_0xc91f('0x10')](function(_0x22b441){if(_0x22b441){_0x3a9d9e[_0xc91f('0x11')]=_0x22b441['id'];}utils['request'](_0xc91f('0x12'),_0x3a9d9e);});}else{utils[_0xc91f('0x13')](_0xc91f('0x12'),_0x3a9d9e);}if(channels[_0x3a9d9e[_0xc91f('0x7')]]){delete channels[_0x3a9d9e['uniqueid']];}}exports[_0xc91f('0x14')]=function(_0x469ef6){try{if(_0x469ef6[_0xc91f('0x7')]==_0x469ef6[_0xc91f('0x15')]&&_0x469ef6[_0xc91f('0x8')]!='OutgoingSpoolFailed'){channels[_0x469ef6[_0xc91f('0x7')]]={'uniqueid':_0x469ef6['uniqueid'],'accountcode':_0x469ef6[_0xc91f('0xa')],'source':_0x469ef6[_0xc91f('0x16')],'destination':_0x469ef6[_0xc91f('0x17')],'destinationcontext':_0x469ef6[_0xc91f('0x18')],'channel':_0x469ef6['channel'],'starttime':utils[_0xc91f('0x19')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':'NO\x20ANSWER','amaflags':_0xc91f('0x1a')};}}catch(_0x4fc798){utils['error'](_0x4fc798[_0xc91f('0x1b')]);}};exports[_0xc91f('0x1c')]=function(_0x2e2703){try{if(!_[_0xc91f('0x1d')](channels[_0x2e2703[_0xc91f('0x7')]])&&_0x2e2703[_0xc91f('0x1e')]==0x6){if(_[_0xc91f('0x1d')](channels[_0x2e2703['uniqueid']][_0xc91f('0x1f')])){channels[_0x2e2703[_0xc91f('0x7')]]['systemanswertime']=utils[_0xc91f('0x19')]();}}else if(!_[_0xc91f('0x1d')](channels[_0x2e2703['linkedid']])&&_0x2e2703['channelstate']==0x6&&_0x2e2703[_0xc91f('0x18')]!=_0xc91f('0x20')){channels[_0x2e2703[_0xc91f('0x15')]][_0xc91f('0xa')]=_0x2e2703[_0xc91f('0xa')];channels[_0x2e2703[_0xc91f('0x15')]]['destinationchannel']=_0x2e2703[_0xc91f('0x8')];if(_['isNil'](channels[_0x2e2703[_0xc91f('0x15')]]['answertime'])){channels[_0x2e2703[_0xc91f('0x15')]][_0xc91f('0x21')]=utils['now']();}channels[_0x2e2703['linkedid']]['disposition']=dispositions[_[_0xc91f('0x22')](_0x2e2703['channelstate'])]||_0xc91f('0x3');}}catch(_0x4bc1a4){utils[_0xc91f('0x23')](_0x4bc1a4[_0xc91f('0x1b')]);}};exports[_0xc91f('0x24')]=function(_0x12fd23){try{if(!_[_0xc91f('0x1d')](channels[_0x12fd23['uniqueid']])){if(_[_0xc91f('0x1d')](channels[_0x12fd23[_0xc91f('0x7')]][_0xc91f('0xd')])){channels[_0x12fd23[_0xc91f('0x7')]][_0xc91f('0xd')]=_0x12fd23[_0xc91f('0x25')]+'\x20<'+_0x12fd23[_0xc91f('0x16')]+'>';}channels[_0x12fd23[_0xc91f('0x7')]]['endtime']=utils[_0xc91f('0x19')]();channels[_0x12fd23['uniqueid']][_0xc91f('0x26')]=utils[_0xc91f('0x27')](channels[_0x12fd23[_0xc91f('0x7')]][_0xc91f('0x28')],channels[_0x12fd23[_0xc91f('0x7')]]['starttime']);channels[_0x12fd23[_0xc91f('0x7')]][_0xc91f('0x29')]=channels[_0x12fd23[_0xc91f('0x7')]][_0xc91f('0x21')]?utils['diffTime'](channels[_0x12fd23[_0xc91f('0x7')]][_0xc91f('0x28')],channels[_0x12fd23[_0xc91f('0x7')]][_0xc91f('0x21')]):0x0;writeDB(channels[_0x12fd23['uniqueid']]);}}catch(_0x178f70){utils[_0xc91f('0x23')](_0x178f70[_0xc91f('0x1b')]);}};exports[_0xc91f('0x2a')]=function(_0x3bff2e){try{if(!_[_0xc91f('0x1d')](channels[_0x3bff2e['localtwolinkedid']])){if(channels[_0x3bff2e['localtwolinkedid']]['channel']==_0x3bff2e[_0xc91f('0x2b')]){channels[_0x3bff2e[_0xc91f('0x2c')]][_0xc91f('0x2d')]=_0x3bff2e[_0xc91f('0x2e')];channels[_0x3bff2e[_0xc91f('0x2c')]][_0xc91f('0x2f')]=_0xc91f('0x30');}else if(channels[_0x3bff2e[_0xc91f('0x2c')]]['channel']=_0x3bff2e['transfertargetchannel']){channels[_0x3bff2e[_0xc91f('0x2c')]][_0xc91f('0x2d')]=_0x3bff2e[_0xc91f('0x31')];channels[_0x3bff2e['localtwolinkedid']][_0xc91f('0x2f')]=_0xc91f('0x30');}}}catch(_0x571210){utils[_0xc91f('0x23')](_0x571210[_0xc91f('0x1b')]);}};exports[_0xc91f('0x32')]=function(_0x5b65ea){try{if(!_[_0xc91f('0x1d')](channels[_0x5b65ea[_0xc91f('0x7')]])){channels[_0x5b65ea[_0xc91f('0x7')]][_0xc91f('0x33')]=utils[_0xc91f('0x19')]();}}catch(_0x4bb9d5){utils['error'](_0x4bb9d5[_0xc91f('0x1b')]);}};exports['musiconholdstop']=function(_0x1e83b2){try{if(!_['isNil'](channels[_0x1e83b2[_0xc91f('0x7')]])){if(!_['isNil'](channels[_0x1e83b2['uniqueid']][_0xc91f('0x33')])){channels[_0x1e83b2[_0xc91f('0x7')]][_0xc91f('0x34')]+=utils['diffTime'](utils[_0xc91f('0x19')](),channels[_0x1e83b2[_0xc91f('0x7')]]['musiconholdstartAt']);delete channels[_0x1e83b2[_0xc91f('0x7')]][_0xc91f('0x33')];}}}catch(_0x43243b){utils[_0xc91f('0x23')](_0x43243b[_0xc91f('0x1b')]);}};exports[_0xc91f('0x35')]=function(_0x2a2f50){try{if(!_['isNil'](channels[_0x2a2f50[_0xc91f('0x7')]])){if(!_[_0xc91f('0x1d')](_0x2a2f50[_0xc91f('0x36')]['xmd-originatecalleridnum'])){channels[_0x2a2f50[_0xc91f('0x7')]][_0xc91f('0xb')]=_0x2a2f50['value'];}if(!_[_0xc91f('0x1d')](_0x2a2f50['variable'][_0xc91f('0x37')])){channels[_0x2a2f50[_0xc91f('0x7')]]['destination']=_0x2a2f50[_0xc91f('0x38')];channels[_0x2a2f50[_0xc91f('0x7')]][_0xc91f('0xd')]='\x22'+_0x2a2f50['value']+_0xc91f('0x39')+_0x2a2f50['value']+'>';}if(!_[_0xc91f('0x1d')](_0x2a2f50[_0xc91f('0x36')]['xmd-callerid-preview'])||!_['isNil'](_0x2a2f50['variable'][_0xc91f('0x3a')])){channels[_0x2a2f50[_0xc91f('0x7')]][_0xc91f('0xd')]=_0x2a2f50[_0xc91f('0x38')];}if(!_[_0xc91f('0x1d')](_0x2a2f50[_0xc91f('0x36')][_0xc91f('0x3b')])||!_['isNil'](_0x2a2f50['variable']['xmcs-queue'])){channels[_0x2a2f50[_0xc91f('0x7')]][_0xc91f('0x3c')]=_0xc91f('0x3d');channels[_0x2a2f50[_0xc91f('0x7')]][_0xc91f('0x3e')]=_0x2a2f50['value'];channels[_0x2a2f50[_0xc91f('0x7')]][_0xc91f('0x3f')]=!![];}if(!_['isNil'](_0x2a2f50[_0xc91f('0x36')][_0xc91f('0x40')])){channels[_0x2a2f50[_0xc91f('0x7')]][_0xc91f('0x41')]=_0x2a2f50[_0xc91f('0x38')];}if(!_[_0xc91f('0x1d')](_0x2a2f50['variable'][_0xc91f('0x42')])){channels[_0x2a2f50[_0xc91f('0x7')]][_0xc91f('0x9')]=_0x2a2f50[_0xc91f('0x38')];}if(!_[_0xc91f('0x1d')](_0x2a2f50['variable']['outboundrouteid'])){channels[_0x2a2f50[_0xc91f('0x7')]]['routeid']=_0x2a2f50[_0xc91f('0x38')];}if(!_[_0xc91f('0x1d')](_0x2a2f50[_0xc91f('0x36')][_0xc91f('0x43')])){channels[_0x2a2f50[_0xc91f('0x7')]]['sipcallid']=_0x2a2f50['value'];}}}catch(_0x14a03f){utils['error'](_0x14a03f[_0xc91f('0x1b')]);}};exports[_0xc91f('0x44')]=function(_0x38a2ed){try{if(!_[_0xc91f('0x1d')](channels[_0x38a2ed[_0xc91f('0x7')]])){if(_0x38a2ed['application']['toLowerCase']()==_0xc91f('0x45')&&_[_0xc91f('0x46')](_0x38a2ed[_0xc91f('0x47')][_0xc91f('0x48')](),_0xc91f('0x49'))){var _0x388ad9=_0x38a2ed['appdata'][_0xc91f('0x4a')]('=');var _0x5848b8=_0x388ad9[0x0]['substring'](_0x388ad9[0x0][_0xc91f('0x4b')]('(')+0x1,_0x388ad9[0x0][_0xc91f('0x4b')](')'));var _0x375839=_0x388ad9[0x1];channels[_0x38a2ed[_0xc91f('0x7')]][_0x5848b8]=_0x375839;}if(!_[_0xc91f('0x4c')]([_0xc91f('0x24'),_0xc91f('0x4d'),'execif',_0xc91f('0x45'),_0xc91f('0x4e')],_0x38a2ed[_0xc91f('0x4f')][_0xc91f('0x48')]())){channels[_0x38a2ed[_0xc91f('0x7')]][_0xc91f('0x3c')]=_0x38a2ed[_0xc91f('0x4f')];channels[_0x38a2ed[_0xc91f('0x7')]][_0xc91f('0x3e')]=_0x38a2ed['appdata'];}}}catch(_0x35490f){utils['error'](_0x35490f[_0xc91f('0x1b')]);}}; \ No newline at end of file +var _0x844d=['disposition','getUserByInternal','then','UserId','CreateVoiceCallReport','request','linkedid','OutgoingSpoolFailed','calleridnum','exten','context','now','DOCUMENTATION','error','isNil','systemanswertime','destinationchannel','answertime','toNumber','stack','hangup','endtime','duration','diffTime','starttime','billableseconds','attendedtransfer','localtwolinkedid','secondtransfererchannel','userfield','_attended','transfertargetchannel','origtransfererchannel','musiconholdstartAt','musiconholdstop','variable','value','xmd-phone','xmd-callerid-preview','xmd-callerid','xmcs-queue','lastdata','queue','ContactId','xmd-cdrtype','outboundrouteid','routeid','sipcallid','newexten','toLowerCase','set','startsWith','appdata','cdr','split','substring','lastIndexOf','includes','noop','execif','application','lastapplication','lodash','util','./utils','FAILED','NO\x20ANSWER','ANSWERED','info','format','uniqueid','channel','type','accountcode','source','destination','callerid'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x844d,0xd8));var _0xd844=function(_0x2fff83,_0x29d5fe){_0x2fff83=_0x2fff83-0x0;var _0xa2a722=_0x844d[_0x2fff83];return _0xa2a722;};'use strict';var _=require(_0xd844('0x0'));var util=require(_0xd844('0x1'));var utils=require(_0xd844('0x2'));var dispositions=['NO\x20ANSWER',_0xd844('0x3'),_0xd844('0x3'),_0xd844('0x4'),_0xd844('0x4'),_0xd844('0x4'),_0xd844('0x5'),'BUSY',_0xd844('0x3'),_0xd844('0x3'),_0xd844('0x3')];var channels={};function writeDB(_0x5c152b){utils[_0xd844('0x6')](util[_0xd844('0x7')]('CALL|%s|%s|%s|%s|%s|%s|%s|%s',_0x5c152b[_0xd844('0x8')],_0x5c152b[_0xd844('0x9')],_0x5c152b[_0xd844('0xa')],_0x5c152b[_0xd844('0xb')],_0x5c152b[_0xd844('0xc')],_0x5c152b[_0xd844('0xd')],_0x5c152b[_0xd844('0xe')],_0x5c152b[_0xd844('0xf')]));if(_0x5c152b['accountcode']){utils[_0xd844('0x10')](_0x5c152b[_0xd844('0xb')])[_0xd844('0x11')](function(_0xb80aca){if(_0xb80aca){_0x5c152b[_0xd844('0x12')]=_0xb80aca['id'];}utils['request'](_0xd844('0x13'),_0x5c152b);});}else{utils[_0xd844('0x14')](_0xd844('0x13'),_0x5c152b);}if(channels[_0x5c152b[_0xd844('0x8')]]){delete channels[_0x5c152b[_0xd844('0x8')]];}}exports['newchannel']=function(_0x2307cc){try{if(_0x2307cc[_0xd844('0x8')]==_0x2307cc[_0xd844('0x15')]&&_0x2307cc[_0xd844('0x9')]!=_0xd844('0x16')){channels[_0x2307cc['uniqueid']]={'uniqueid':_0x2307cc['uniqueid'],'accountcode':_0x2307cc['accountcode'],'source':_0x2307cc[_0xd844('0x17')],'destination':_0x2307cc[_0xd844('0x18')],'destinationcontext':_0x2307cc[_0xd844('0x19')],'channel':_0x2307cc[_0xd844('0x9')],'starttime':utils[_0xd844('0x1a')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':'NO\x20ANSWER','amaflags':_0xd844('0x1b')};}}catch(_0x155dcb){utils[_0xd844('0x1c')](_0x155dcb['stack']);}};exports['newstate']=function(_0x105cc3){try{if(!_[_0xd844('0x1d')](channels[_0x105cc3[_0xd844('0x8')]])&&_0x105cc3['channelstate']==0x6){if(_[_0xd844('0x1d')](channels[_0x105cc3[_0xd844('0x8')]][_0xd844('0x1e')])){channels[_0x105cc3[_0xd844('0x8')]][_0xd844('0x1e')]=utils[_0xd844('0x1a')]();}}else if(!_['isNil'](channels[_0x105cc3['linkedid']])&&_0x105cc3['channelstate']==0x6&&_0x105cc3[_0xd844('0x19')]!='transfer'){channels[_0x105cc3[_0xd844('0x15')]][_0xd844('0xb')]=_0x105cc3[_0xd844('0xb')];channels[_0x105cc3[_0xd844('0x15')]][_0xd844('0x1f')]=_0x105cc3[_0xd844('0x9')];if(_[_0xd844('0x1d')](channels[_0x105cc3['linkedid']][_0xd844('0x20')])){channels[_0x105cc3[_0xd844('0x15')]][_0xd844('0x20')]=utils[_0xd844('0x1a')]();}channels[_0x105cc3['linkedid']]['disposition']=dispositions[_[_0xd844('0x21')](_0x105cc3['channelstate'])]||_0xd844('0x5');}}catch(_0x2d467c){utils[_0xd844('0x1c')](_0x2d467c[_0xd844('0x22')]);}};exports[_0xd844('0x23')]=function(_0x273a01){try{if(!_[_0xd844('0x1d')](channels[_0x273a01[_0xd844('0x8')]])){if(_['isNil'](channels[_0x273a01['uniqueid']][_0xd844('0xe')])){channels[_0x273a01['uniqueid']][_0xd844('0xe')]=_0x273a01['calleridname']+'\x20<'+_0x273a01[_0xd844('0x17')]+'>';}channels[_0x273a01[_0xd844('0x8')]][_0xd844('0x24')]=utils[_0xd844('0x1a')]();channels[_0x273a01[_0xd844('0x8')]][_0xd844('0x25')]=utils[_0xd844('0x26')](channels[_0x273a01[_0xd844('0x8')]][_0xd844('0x24')],channels[_0x273a01[_0xd844('0x8')]][_0xd844('0x27')]);channels[_0x273a01[_0xd844('0x8')]][_0xd844('0x28')]=channels[_0x273a01['uniqueid']][_0xd844('0x20')]?utils['diffTime'](channels[_0x273a01[_0xd844('0x8')]][_0xd844('0x24')],channels[_0x273a01[_0xd844('0x8')]]['answertime']):0x0;writeDB(channels[_0x273a01[_0xd844('0x8')]]);}}catch(_0x1ffa2e){utils[_0xd844('0x1c')](_0x1ffa2e[_0xd844('0x22')]);}};exports[_0xd844('0x29')]=function(_0x3e7839){try{if(!_[_0xd844('0x1d')](channels[_0x3e7839[_0xd844('0x2a')]])){if(channels[_0x3e7839[_0xd844('0x2a')]][_0xd844('0x9')]==_0x3e7839['transfereechannel']){channels[_0x3e7839['localtwolinkedid']]['destinationchannel']=_0x3e7839[_0xd844('0x2b')];channels[_0x3e7839[_0xd844('0x2a')]][_0xd844('0x2c')]=_0xd844('0x2d');}else if(channels[_0x3e7839['localtwolinkedid']][_0xd844('0x9')]=_0x3e7839[_0xd844('0x2e')]){channels[_0x3e7839[_0xd844('0x2a')]][_0xd844('0x1f')]=_0x3e7839[_0xd844('0x2f')];channels[_0x3e7839[_0xd844('0x2a')]][_0xd844('0x2c')]=_0xd844('0x2d');}}}catch(_0x40b2b9){utils['error'](_0x40b2b9[_0xd844('0x22')]);}};exports['musiconholdstart']=function(_0x21210d){try{if(!_[_0xd844('0x1d')](channels[_0x21210d[_0xd844('0x8')]])){channels[_0x21210d[_0xd844('0x8')]][_0xd844('0x30')]=utils['now']();}}catch(_0x5d996c){utils[_0xd844('0x1c')](_0x5d996c[_0xd844('0x22')]);}};exports[_0xd844('0x31')]=function(_0x46647e){try{if(!_[_0xd844('0x1d')](channels[_0x46647e['uniqueid']])){if(!_[_0xd844('0x1d')](channels[_0x46647e[_0xd844('0x8')]][_0xd844('0x30')])){channels[_0x46647e['uniqueid']]['mohtime']+=utils[_0xd844('0x26')](utils[_0xd844('0x1a')](),channels[_0x46647e[_0xd844('0x8')]][_0xd844('0x30')]);delete channels[_0x46647e[_0xd844('0x8')]]['musiconholdstartAt'];}}}catch(_0x58c156){utils['error'](_0x58c156[_0xd844('0x22')]);}};exports['varset']=function(_0x1b5e7a){try{if(!_[_0xd844('0x1d')](channels[_0x1b5e7a[_0xd844('0x8')]])){if(!_[_0xd844('0x1d')](_0x1b5e7a[_0xd844('0x32')]['xmd-originatecalleridnum'])){channels[_0x1b5e7a[_0xd844('0x8')]][_0xd844('0xc')]=_0x1b5e7a[_0xd844('0x33')];}if(!_[_0xd844('0x1d')](_0x1b5e7a['variable'][_0xd844('0x34')])){channels[_0x1b5e7a['uniqueid']][_0xd844('0xd')]=_0x1b5e7a[_0xd844('0x33')];channels[_0x1b5e7a['uniqueid']][_0xd844('0xe')]='\x22'+_0x1b5e7a['value']+'\x22\x20<'+_0x1b5e7a[_0xd844('0x33')]+'>';}if(!_['isNil'](_0x1b5e7a[_0xd844('0x32')][_0xd844('0x35')])||!_['isNil'](_0x1b5e7a[_0xd844('0x32')][_0xd844('0x36')])){channels[_0x1b5e7a[_0xd844('0x8')]][_0xd844('0xe')]=_0x1b5e7a[_0xd844('0x33')];}if(!_[_0xd844('0x1d')](_0x1b5e7a[_0xd844('0x32')]['xmd-queue'])||!_[_0xd844('0x1d')](_0x1b5e7a[_0xd844('0x32')][_0xd844('0x37')])){channels[_0x1b5e7a[_0xd844('0x8')]]['lastapplication']='Queue';channels[_0x1b5e7a[_0xd844('0x8')]][_0xd844('0x38')]=_0x1b5e7a[_0xd844('0x33')];channels[_0x1b5e7a['uniqueid']][_0xd844('0x39')]=!![];}if(!_[_0xd844('0x1d')](_0x1b5e7a[_0xd844('0x32')]['xmd-contactid'])){channels[_0x1b5e7a['uniqueid']][_0xd844('0x3a')]=_0x1b5e7a[_0xd844('0x33')];}if(!_['isNil'](_0x1b5e7a[_0xd844('0x32')][_0xd844('0x3b')])){channels[_0x1b5e7a[_0xd844('0x8')]][_0xd844('0xa')]=_0x1b5e7a[_0xd844('0x33')];}if(!_[_0xd844('0x1d')](_0x1b5e7a[_0xd844('0x32')][_0xd844('0x3c')])){channels[_0x1b5e7a[_0xd844('0x8')]][_0xd844('0x3d')]=_0x1b5e7a['value'];}if(!_[_0xd844('0x1d')](_0x1b5e7a[_0xd844('0x32')]['sipcallid'])){channels[_0x1b5e7a[_0xd844('0x8')]][_0xd844('0x3e')]=_0x1b5e7a['value'];}}}catch(_0x2621e8){utils[_0xd844('0x1c')](_0x2621e8['stack']);}};exports[_0xd844('0x3f')]=function(_0x420465){try{if(!_[_0xd844('0x1d')](channels[_0x420465['uniqueid']])){if(_0x420465['application'][_0xd844('0x40')]()==_0xd844('0x41')&&_[_0xd844('0x42')](_0x420465[_0xd844('0x43')]['toLowerCase'](),_0xd844('0x44'))){var _0x203915=_0x420465[_0xd844('0x43')][_0xd844('0x45')]('=');var _0x5299b5=_0x203915[0x0][_0xd844('0x46')](_0x203915[0x0][_0xd844('0x47')]('(')+0x1,_0x203915[0x0]['lastIndexOf'](')'));var _0x30022a=_0x203915[0x1];channels[_0x420465[_0xd844('0x8')]][_0x5299b5]=_0x30022a;}if(!_[_0xd844('0x48')]([_0xd844('0x23'),_0xd844('0x49'),_0xd844('0x4a'),_0xd844('0x41'),'gotoif'],_0x420465[_0xd844('0x4b')][_0xd844('0x40')]())){channels[_0x420465['uniqueid']][_0xd844('0x4c')]=_0x420465[_0xd844('0x4b')];channels[_0x420465['uniqueid']][_0xd844('0x38')]=_0x420465[_0xd844('0x43')];}}}catch(_0x33b31b){utils[_0xd844('0x1c')](_0x33b31b[_0xd844('0x22')]);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index 8047e6d..727c450 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 _0x3c6c=['SHUTDOWN','fullybooted','error','./utils','connect','info','CONNECTED','shutdown'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x3c6c,0x7b));var _0xc3c6=function(_0x75bc72,_0x37bb81){_0x75bc72=_0x75bc72-0x0;var _0x2e6a16=_0x3c6c[_0x75bc72];return _0x2e6a16;};'use strict';var utils=require(_0xc3c6('0x0'));var _=require('lodash');exports[_0xc3c6('0x1')]=function(){utils[_0xc3c6('0x2')](_0xc3c6('0x3'));};exports[_0xc3c6('0x4')]=function(){utils[_0xc3c6('0x2')](_0xc3c6('0x5'));};exports[_0xc3c6('0x6')]=function(){utils[_0xc3c6('0x2')]('FULLYBOOTED');};exports[_0xc3c6('0x7')]=function(_0x4a2ca1){utils[_0xc3c6('0x7')](_0x4a2ca1);};exports['close']=function(){utils['info']('CLOSE');};exports['managerevent']=function(_0x4f39dd){}; \ No newline at end of file +var _0xabce=['lodash','connect','info','CONNECTED','SHUTDOWN','fullybooted','close','CLOSE','managerevent','./utils'];(function(_0x1bb0c1,_0x1be24d){var _0x399bd3=function(_0x48f73d){while(--_0x48f73d){_0x1bb0c1['push'](_0x1bb0c1['shift']());}};_0x399bd3(++_0x1be24d);}(_0xabce,0x103));var _0xeabc=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0xabce[_0x2d8fc2];return _0x3a9e53;};'use strict';var utils=require(_0xeabc('0x0'));var _=require(_0xeabc('0x1'));exports[_0xeabc('0x2')]=function(){utils[_0xeabc('0x3')](_0xeabc('0x4'));};exports['shutdown']=function(){utils['info'](_0xeabc('0x5'));};exports[_0xeabc('0x6')]=function(){utils[_0xeabc('0x3')]('FULLYBOOTED');};exports['error']=function(_0x1b07a8){utils['error'](_0x1b07a8);};exports[_0xeabc('0x7')]=function(){utils['info'](_0xeabc('0x8'));};exports[_0xeabc('0x9')]=function(_0x8434c5){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index 3c77190..8b25800 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 _0x6b9d=['duration','diffTime','holdtime','endtime','lodash','util','./utils','info','format','DIAL|%s|%s|%s|%s|%s|%s','uniqueid','channel','dialstring','connectedlinenum','dialstatus','request','CreateVoiceDialReport','newexten','application','toLowerCase','set','startsWith','appdata','error','stack','isNil','variable','outboundrouteid','value','dialbegin','assign','starttime','lastevent','dialend','ANSWER','answertime','now','connect','hangup','complete'];(function(_0x2a5911,_0x2c17cf){var _0x579e83=function(_0x2750f6){while(--_0x2750f6){_0x2a5911['push'](_0x2a5911['shift']());}};_0x579e83(++_0x2c17cf);}(_0x6b9d,0x1e4));var _0xd6b9=function(_0x5b3b9b,_0x1c71b0){_0x5b3b9b=_0x5b3b9b-0x0;var _0x47c1d7=_0x6b9d[_0x5b3b9b];return _0x47c1d7;};'use strict';var _=require(_0xd6b9('0x0'));var util=require(_0xd6b9('0x1'));var utils=require(_0xd6b9('0x2'));var dials={};function writeDB(_0x431668){utils[_0xd6b9('0x3')](util[_0xd6b9('0x4')](_0xd6b9('0x5'),_0x431668[_0xd6b9('0x6')],_0x431668[_0xd6b9('0x7')],_0x431668[_0xd6b9('0x8')],_0x431668['calleridnum'],_0x431668[_0xd6b9('0x9')],_0x431668[_0xd6b9('0xa')]));utils[_0xd6b9('0xb')](_0xd6b9('0xc'),_0x431668);delete dials[_0x431668[_0xd6b9('0x6')]];}exports[_0xd6b9('0xd')]=function(_0x11214c){try{if(_0x11214c[_0xd6b9('0xe')][_0xd6b9('0xf')]()==_0xd6b9('0x10')&&_[_0xd6b9('0x11')](_0x11214c['appdata'][_0xd6b9('0xf')](),'cdr(routeid)')){var _0x12bd4f=_0x11214c[_0xd6b9('0x12')]['split']('=');dials[_0x11214c[_0xd6b9('0x6')]]={'routeId':_0x12bd4f[0x1]};}}catch(_0x3e5ec0){utils[_0xd6b9('0x13')](_0x3e5ec0[_0xd6b9('0x14')]);}};exports['varset']=function(_0x253b83){try{if(!_[_0xd6b9('0x15')](_0x253b83[_0xd6b9('0x16')][_0xd6b9('0x17')])){dials[_0x253b83[_0xd6b9('0x6')]]={'routeId':_0x253b83[_0xd6b9('0x18')]};}}catch(_0x525ed6){utils['error'](_0x525ed6['stack']);}};exports[_0xd6b9('0x19')]=function(_0xd3e051){try{if(!_[_0xd6b9('0x15')](dials[_0xd3e051['uniqueid']])){dials[_0xd3e051[_0xd6b9('0x6')]]=_[_0xd6b9('0x1a')](dials[_0xd3e051[_0xd6b9('0x6')]],_0xd3e051);dials[_0xd3e051[_0xd6b9('0x6')]][_0xd6b9('0x1b')]=utils['now']();dials[_0xd3e051['uniqueid']][_0xd6b9('0x1c')]='called';}}catch(_0x1c24d1){utils[_0xd6b9('0x13')](_0x1c24d1[_0xd6b9('0x14')]);}};exports[_0xd6b9('0x1d')]=function(_0x3e812d){try{if(!_['isNil'](dials[_0x3e812d[_0xd6b9('0x6')]])){dials[_0x3e812d['uniqueid']][_0xd6b9('0xa')]=_0x3e812d[_0xd6b9('0xa')];if(_0x3e812d[_0xd6b9('0xa')]==_0xd6b9('0x1e')){dials[_0x3e812d[_0xd6b9('0x6')]]=_['assign'](dials[_0x3e812d[_0xd6b9('0x6')]],_0x3e812d);dials[_0x3e812d['uniqueid']][_0xd6b9('0x1f')]=utils[_0xd6b9('0x20')]();dials[_0x3e812d[_0xd6b9('0x6')]]['lastevent']=_0xd6b9('0x21');}}}catch(_0x4028a1){utils['error'](_0x4028a1[_0xd6b9('0x14')]);}};exports[_0xd6b9('0x22')]=function(_0x24c924){try{if(!_[_0xd6b9('0x15')](dials[_0x24c924[_0xd6b9('0x6')]])){dials[_0x24c924[_0xd6b9('0x6')]]=_[_0xd6b9('0x1a')](dials[_0x24c924[_0xd6b9('0x6')]],{'endtime':utils[_0xd6b9('0x20')](),'lastevent':_0xd6b9('0x23')});dials[_0x24c924['uniqueid']][_0xd6b9('0x24')]=utils[_0xd6b9('0x25')](dials[_0x24c924[_0xd6b9('0x6')]]['endtime'],dials[_0x24c924[_0xd6b9('0x6')]][_0xd6b9('0x1b')]);dials[_0x24c924[_0xd6b9('0x6')]][_0xd6b9('0x26')]=utils[_0xd6b9('0x25')](dials[_0x24c924[_0xd6b9('0x6')]]['answertime']||dials[_0x24c924[_0xd6b9('0x6')]][_0xd6b9('0x27')],dials[_0x24c924[_0xd6b9('0x6')]][_0xd6b9('0x1b')]);dials[_0x24c924[_0xd6b9('0x6')]]['billableseconds']=dials[_0x24c924[_0xd6b9('0x6')]][_0xd6b9('0x1f')]?utils[_0xd6b9('0x25')](dials[_0x24c924[_0xd6b9('0x6')]][_0xd6b9('0x27')],dials[_0x24c924[_0xd6b9('0x6')]]['answertime']):0x0;writeDB(dials[_0x24c924[_0xd6b9('0x6')]]);}}catch(_0x310aa7){utils[_0xd6b9('0x13')](_0x310aa7['stack']);}}; \ No newline at end of file +var _0x43e5=['stack','varset','isNil','variable','outboundrouteid','starttime','now','called','dialend','dialstatus','ANSWER','assign','lastevent','connect','complete','duration','diffTime','endtime','answertime','lodash','info','format','DIAL|%s|%s|%s|%s|%s|%s','uniqueid','channel','dialstring','connectedlinenum','request','CreateVoiceDialReport','newexten','toLowerCase','set','startsWith','cdr(routeid)','appdata','split','error'];(function(_0x5995d2,_0x2c250d){var _0x21342d=function(_0x2a0dc4){while(--_0x2a0dc4){_0x5995d2['push'](_0x5995d2['shift']());}};_0x21342d(++_0x2c250d);}(_0x43e5,0x160));var _0x543e=function(_0x343acc,_0x2ada1c){_0x343acc=_0x343acc-0x0;var _0x1380f8=_0x43e5[_0x343acc];return _0x1380f8;};'use strict';var _=require(_0x543e('0x0'));var util=require('util');var utils=require('./utils');var dials={};function writeDB(_0x4a82ff){utils[_0x543e('0x1')](util[_0x543e('0x2')](_0x543e('0x3'),_0x4a82ff[_0x543e('0x4')],_0x4a82ff[_0x543e('0x5')],_0x4a82ff[_0x543e('0x6')],_0x4a82ff['calleridnum'],_0x4a82ff[_0x543e('0x7')],_0x4a82ff['dialstatus']));utils[_0x543e('0x8')](_0x543e('0x9'),_0x4a82ff);delete dials[_0x4a82ff[_0x543e('0x4')]];}exports[_0x543e('0xa')]=function(_0x1ebaca){try{if(_0x1ebaca['application'][_0x543e('0xb')]()==_0x543e('0xc')&&_[_0x543e('0xd')](_0x1ebaca['appdata'][_0x543e('0xb')](),_0x543e('0xe'))){var _0x45f197=_0x1ebaca[_0x543e('0xf')][_0x543e('0x10')]('=');dials[_0x1ebaca[_0x543e('0x4')]]={'routeId':_0x45f197[0x1]};}}catch(_0x4d79da){utils[_0x543e('0x11')](_0x4d79da[_0x543e('0x12')]);}};exports[_0x543e('0x13')]=function(_0x2fec69){try{if(!_[_0x543e('0x14')](_0x2fec69[_0x543e('0x15')][_0x543e('0x16')])){dials[_0x2fec69['uniqueid']]={'routeId':_0x2fec69['value']};}}catch(_0x6fe67f){utils[_0x543e('0x11')](_0x6fe67f[_0x543e('0x12')]);}};exports['dialbegin']=function(_0x2d3985){try{if(!_['isNil'](dials[_0x2d3985[_0x543e('0x4')]])){dials[_0x2d3985[_0x543e('0x4')]]=_['assign'](dials[_0x2d3985[_0x543e('0x4')]],_0x2d3985);dials[_0x2d3985['uniqueid']][_0x543e('0x17')]=utils[_0x543e('0x18')]();dials[_0x2d3985[_0x543e('0x4')]]['lastevent']=_0x543e('0x19');}}catch(_0x15d70d){utils[_0x543e('0x11')](_0x15d70d[_0x543e('0x12')]);}};exports[_0x543e('0x1a')]=function(_0x3c44f8){try{if(!_[_0x543e('0x14')](dials[_0x3c44f8['uniqueid']])){dials[_0x3c44f8[_0x543e('0x4')]][_0x543e('0x1b')]=_0x3c44f8['dialstatus'];if(_0x3c44f8['dialstatus']==_0x543e('0x1c')){dials[_0x3c44f8[_0x543e('0x4')]]=_[_0x543e('0x1d')](dials[_0x3c44f8[_0x543e('0x4')]],_0x3c44f8);dials[_0x3c44f8[_0x543e('0x4')]]['answertime']=utils[_0x543e('0x18')]();dials[_0x3c44f8[_0x543e('0x4')]][_0x543e('0x1e')]=_0x543e('0x1f');}}}catch(_0x438bdc){utils[_0x543e('0x11')](_0x438bdc[_0x543e('0x12')]);}};exports['hangup']=function(_0x508bcc){try{if(!_[_0x543e('0x14')](dials[_0x508bcc[_0x543e('0x4')]])){dials[_0x508bcc[_0x543e('0x4')]]=_[_0x543e('0x1d')](dials[_0x508bcc[_0x543e('0x4')]],{'endtime':utils[_0x543e('0x18')](),'lastevent':_0x543e('0x20')});dials[_0x508bcc[_0x543e('0x4')]][_0x543e('0x21')]=utils[_0x543e('0x22')](dials[_0x508bcc['uniqueid']][_0x543e('0x23')],dials[_0x508bcc['uniqueid']]['starttime']);dials[_0x508bcc[_0x543e('0x4')]]['holdtime']=utils['diffTime'](dials[_0x508bcc[_0x543e('0x4')]][_0x543e('0x24')]||dials[_0x508bcc['uniqueid']][_0x543e('0x23')],dials[_0x508bcc[_0x543e('0x4')]][_0x543e('0x17')]);dials[_0x508bcc[_0x543e('0x4')]]['billableseconds']=dials[_0x508bcc[_0x543e('0x4')]][_0x543e('0x24')]?utils[_0x543e('0x22')](dials[_0x508bcc[_0x543e('0x4')]]['endtime'],dials[_0x508bcc[_0x543e('0x4')]][_0x543e('0x24')]):0x0;writeDB(dials[_0x508bcc['uniqueid']]);}}catch(_0xcd3b90){utils[_0x543e('0x11')](_0xcd3b90[_0x543e('0x12')]);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index a287c7d..6424f38 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 _0x2ed3=['./calls.controller','./queues.controller','./recordings.controller','./dials.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','agentcalled','agentringnoanswer','agentconnect','agentcomplete','queuecallerabandon','queuecallerjoin','queuecallerleave','musiconholdstart','musiconholdstop','newstate','hangup','cdr','blindtransfer','attendedtransfer','varset','newexten','newchannel','dialbegin','asterisk-manager','../../config/environment','./utils','asterisk','port','keepConnected','xdr','info','XDR\x20DISABLED','./agents.controller'];(function(_0x2d0b0b,_0x1b0097){var _0xd6f2d7=function(_0x2906dc){while(--_0x2906dc){_0x2d0b0b['push'](_0x2d0b0b['shift']());}};_0xd6f2d7(++_0x1b0097);}(_0x2ed3,0x96));var _0x32ed=function(_0x310504,_0x26ad95){_0x310504=_0x310504-0x0;var _0x5b36d0=_0x2ed3[_0x310504];return _0x5b36d0;};var AsteriskManager=require(_0x32ed('0x0'));var config=require(_0x32ed('0x1'));var utils=require(_0x32ed('0x2'));var ami=new AsteriskManager(config[_0x32ed('0x3')][_0x32ed('0x4')],config[_0x32ed('0x3')]['ip'],config['asterisk']['username'],config['asterisk']['password'],!![]);ami[_0x32ed('0x5')]();if(config[_0x32ed('0x6')]&&config[_0x32ed('0x6')]['disabled']){utils[_0x32ed('0x7')](_0x32ed('0x8'));}else{var agents=require(_0x32ed('0x9'));var calls=require(_0x32ed('0xa'));var queues=require(_0x32ed('0xb'));var recordings=require(_0x32ed('0xc'));var members=require('./members.controller');var dials=require(_0x32ed('0xd'));var transfers=require('./transfers.controller');var core=require(_0x32ed('0xe'));ami['on']('connect',core[_0x32ed('0xf')]);ami['on'](_0x32ed('0x10'),core[_0x32ed('0x10')]);ami['on'](_0x32ed('0x11'),core[_0x32ed('0x11')]);ami['on']('error',core[_0x32ed('0x12')]);ami['on'](_0x32ed('0x13'),core[_0x32ed('0x13')]);ami['on'](_0x32ed('0x14'),core['managerevent']);ami['on'](_0x32ed('0x15'),function(_0x13d9ca){try{members[_0x32ed('0x15')](_0x13d9ca);}catch(_0x1ff83a){utils[_0x32ed('0x12')](_0x1ff83a);}});ami['on'](_0x32ed('0x16'),function(_0x3afb39){try{agents[_0x32ed('0x16')](_0x3afb39);}catch(_0x3c953d){utils['error'](_0x3c953d);}});ami['on']('agentringnoanswer',function(_0x3e2d91){try{agents[_0x32ed('0x17')](_0x3e2d91);}catch(_0x520ebc){utils[_0x32ed('0x12')](_0x520ebc);}});ami['on'](_0x32ed('0x18'),function(_0x338d33){try{agents['agentconnect'](_0x338d33);queues[_0x32ed('0x18')](_0x338d33);}catch(_0x481236){utils['error'](_0x481236);}});ami['on'](_0x32ed('0x19'),function(_0x1c14af){try{agents[_0x32ed('0x19')](_0x1c14af);queues[_0x32ed('0x19')](_0x1c14af);members[_0x32ed('0x19')](_0x1c14af);}catch(_0x1bd6d8){utils[_0x32ed('0x12')](_0x1bd6d8);}});ami['on'](_0x32ed('0x1a'),function(_0x59533a){try{agents[_0x32ed('0x1a')](_0x59533a);queues[_0x32ed('0x1a')](_0x59533a);}catch(_0x4a4723){utils['error'](_0x4a4723);}});ami['on']('queuecallerjoin',function(_0x129c91){try{queues[_0x32ed('0x1b')](_0x129c91);recordings[_0x32ed('0x1b')](_0x129c91);}catch(_0x4ac492){utils['error'](_0x4ac492);}});ami['on'](_0x32ed('0x1c'),function(_0x1711aa){try{queues[_0x32ed('0x1c')](_0x1711aa);}catch(_0x584c40){utils[_0x32ed('0x12')](_0x584c40);}});ami['on'](_0x32ed('0x1d'),function(_0x248db6){try{queues['musiconholdstart'](_0x248db6);calls[_0x32ed('0x1d')](_0x248db6);}catch(_0x1be1ae){utils[_0x32ed('0x12')](_0x1be1ae);}});ami['on']('musiconholdstop',function(_0x1b045e){try{queues['musiconholdstop'](_0x1b045e);calls[_0x32ed('0x1e')](_0x1b045e);}catch(_0x42f08f){utils[_0x32ed('0x12')](_0x42f08f);}});ami['on'](_0x32ed('0x1f'),function(_0x9b42fa){try{calls[_0x32ed('0x1f')](_0x9b42fa);recordings[_0x32ed('0x1f')](_0x9b42fa);}catch(_0x5e8524){utils[_0x32ed('0x12')](_0x5e8524);}});ami['on'](_0x32ed('0x20'),function(_0x34656a){try{calls['hangup'](_0x34656a);recordings[_0x32ed('0x20')](_0x34656a);dials[_0x32ed('0x20')](_0x34656a);agents['hangup'](_0x34656a);queues[_0x32ed('0x20')](_0x34656a);}catch(_0x46f3be){utils[_0x32ed('0x12')](_0x46f3be);}});ami['on']('cdr',function(_0x45e824){try{members[_0x32ed('0x21')](_0x45e824);}catch(_0x314fac){utils['error'](_0x314fac);}});ami['on']('blindtransfer',function(_0x1a8fe6){try{queues[_0x32ed('0x22')](_0x1a8fe6);agents[_0x32ed('0x22')](_0x1a8fe6);transfers[_0x32ed('0x22')](_0x1a8fe6);}catch(_0x4064af){utils[_0x32ed('0x12')](_0x4064af);}});ami['on']('attendedtransfer',function(_0x2d1c60){try{queues['attendedtransfer'](_0x2d1c60);transfers['attendedtransfer'](_0x2d1c60);agents['attendedtransfer'](_0x2d1c60);calls[_0x32ed('0x23')](_0x2d1c60);}catch(_0x7df5f3){utils[_0x32ed('0x12')](_0x7df5f3);}});ami['on'](_0x32ed('0x24'),function(_0x5ccea8){try{queues[_0x32ed('0x24')](_0x5ccea8);recordings[_0x32ed('0x24')](_0x5ccea8);calls[_0x32ed('0x24')](_0x5ccea8);dials[_0x32ed('0x24')](_0x5ccea8);}catch(_0x392722){utils[_0x32ed('0x12')](_0x392722);}});ami['on'](_0x32ed('0x25'),function(_0x313257){try{calls[_0x32ed('0x25')](_0x313257);recordings[_0x32ed('0x25')](_0x313257);dials[_0x32ed('0x25')](_0x313257);}catch(_0x59c25e){utils[_0x32ed('0x12')](_0x59c25e);}});ami['on']('newchannel',function(_0x552604){try{calls[_0x32ed('0x26')](_0x552604);recordings[_0x32ed('0x26')](_0x552604);}catch(_0xfca002){utils[_0x32ed('0x12')](_0xfca002);}});ami['on'](_0x32ed('0x27'),function(_0x143b9b){try{dials[_0x32ed('0x27')](_0x143b9b);}catch(_0x1c817f){utils[_0x32ed('0x12')](_0x1c817f);}});ami['on']('dialend',function(_0x1a3292){try{dials['dialend'](_0x1a3292);}catch(_0x1eb370){utils['error'](_0x1eb370);}});} \ No newline at end of file +var _0x550c=['keepConnected','xdr','disabled','info','./calls.controller','./queues.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','agentcalled','agentringnoanswer','agentcomplete','queuecallerabandon','queuecallerjoin','queuecallerleave','musiconholdstop','newstate','hangup','cdr','blindtransfer','attendedtransfer','varset','newexten','newchannel','dialbegin','dialend','port','asterisk','username','password'];(function(_0x3ccc44,_0x207b0c){var _0x5d74bb=function(_0x59989a){while(--_0x59989a){_0x3ccc44['push'](_0x3ccc44['shift']());}};_0x5d74bb(++_0x207b0c);}(_0x550c,0x19e));var _0xc550=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x550c[_0x3dd15e];return _0x231fd0;};var AsteriskManager=require('asterisk-manager');var config=require('../../config/environment');var utils=require('./utils');var ami=new AsteriskManager(config['asterisk'][_0xc550('0x0')],config['asterisk']['ip'],config[_0xc550('0x1')][_0xc550('0x2')],config[_0xc550('0x1')][_0xc550('0x3')],!![]);ami[_0xc550('0x4')]();if(config[_0xc550('0x5')]&&config[_0xc550('0x5')][_0xc550('0x6')]){utils[_0xc550('0x7')]('XDR\x20DISABLED');}else{var agents=require('./agents.controller');var calls=require(_0xc550('0x8'));var queues=require(_0xc550('0x9'));var recordings=require(_0xc550('0xa'));var members=require(_0xc550('0xb'));var dials=require(_0xc550('0xc'));var transfers=require(_0xc550('0xd'));var core=require('./core.controller');ami['on'](_0xc550('0xe'),core[_0xc550('0xe')]);ami['on'](_0xc550('0xf'),core[_0xc550('0xf')]);ami['on'](_0xc550('0x10'),core[_0xc550('0x10')]);ami['on'](_0xc550('0x11'),core[_0xc550('0x11')]);ami['on'](_0xc550('0x12'),core[_0xc550('0x12')]);ami['on'](_0xc550('0x13'),core['managerevent']);ami['on'](_0xc550('0x14'),function(_0x4e5fcb){try{members[_0xc550('0x14')](_0x4e5fcb);}catch(_0x321b94){utils['error'](_0x321b94);}});ami['on'](_0xc550('0x15'),function(_0x79a9dc){try{agents[_0xc550('0x15')](_0x79a9dc);}catch(_0x190af2){utils[_0xc550('0x11')](_0x190af2);}});ami['on'](_0xc550('0x16'),function(_0x25cf45){try{agents[_0xc550('0x16')](_0x25cf45);}catch(_0x5464fd){utils[_0xc550('0x11')](_0x5464fd);}});ami['on']('agentconnect',function(_0x4c2f49){try{agents['agentconnect'](_0x4c2f49);queues['agentconnect'](_0x4c2f49);}catch(_0x37b3e4){utils['error'](_0x37b3e4);}});ami['on'](_0xc550('0x17'),function(_0x41880c){try{agents[_0xc550('0x17')](_0x41880c);queues[_0xc550('0x17')](_0x41880c);members[_0xc550('0x17')](_0x41880c);}catch(_0x519e08){utils[_0xc550('0x11')](_0x519e08);}});ami['on'](_0xc550('0x18'),function(_0x2de206){try{agents[_0xc550('0x18')](_0x2de206);queues['queuecallerabandon'](_0x2de206);}catch(_0x63df8a){utils[_0xc550('0x11')](_0x63df8a);}});ami['on']('queuecallerjoin',function(_0x1a7083){try{queues['queuecallerjoin'](_0x1a7083);recordings[_0xc550('0x19')](_0x1a7083);}catch(_0x19b621){utils[_0xc550('0x11')](_0x19b621);}});ami['on'](_0xc550('0x1a'),function(_0x23d68b){try{queues[_0xc550('0x1a')](_0x23d68b);}catch(_0x4ded67){utils[_0xc550('0x11')](_0x4ded67);}});ami['on']('musiconholdstart',function(_0x270c6b){try{queues['musiconholdstart'](_0x270c6b);calls['musiconholdstart'](_0x270c6b);}catch(_0x340b85){utils[_0xc550('0x11')](_0x340b85);}});ami['on'](_0xc550('0x1b'),function(_0x1f3e52){try{queues[_0xc550('0x1b')](_0x1f3e52);calls[_0xc550('0x1b')](_0x1f3e52);}catch(_0x36db8f){utils[_0xc550('0x11')](_0x36db8f);}});ami['on'](_0xc550('0x1c'),function(_0x6b95c3){try{calls[_0xc550('0x1c')](_0x6b95c3);recordings[_0xc550('0x1c')](_0x6b95c3);}catch(_0x30955e){utils['error'](_0x30955e);}});ami['on']('hangup',function(_0x36d195){try{calls['hangup'](_0x36d195);recordings[_0xc550('0x1d')](_0x36d195);dials[_0xc550('0x1d')](_0x36d195);agents[_0xc550('0x1d')](_0x36d195);queues['hangup'](_0x36d195);}catch(_0x81ec96){utils[_0xc550('0x11')](_0x81ec96);}});ami['on'](_0xc550('0x1e'),function(_0x277d24){try{members[_0xc550('0x1e')](_0x277d24);}catch(_0x497d08){utils[_0xc550('0x11')](_0x497d08);}});ami['on'](_0xc550('0x1f'),function(_0x517743){try{queues[_0xc550('0x1f')](_0x517743);agents[_0xc550('0x1f')](_0x517743);transfers[_0xc550('0x1f')](_0x517743);}catch(_0x77a628){utils[_0xc550('0x11')](_0x77a628);}});ami['on'](_0xc550('0x20'),function(_0x3aae24){try{queues['attendedtransfer'](_0x3aae24);transfers['attendedtransfer'](_0x3aae24);agents[_0xc550('0x20')](_0x3aae24);calls['attendedtransfer'](_0x3aae24);}catch(_0x3609b1){utils[_0xc550('0x11')](_0x3609b1);}});ami['on'](_0xc550('0x21'),function(_0x166619){try{queues['varset'](_0x166619);recordings[_0xc550('0x21')](_0x166619);calls[_0xc550('0x21')](_0x166619);dials[_0xc550('0x21')](_0x166619);}catch(_0xed339d){utils[_0xc550('0x11')](_0xed339d);}});ami['on'](_0xc550('0x22'),function(_0x2432a7){try{calls[_0xc550('0x22')](_0x2432a7);recordings['newexten'](_0x2432a7);dials[_0xc550('0x22')](_0x2432a7);}catch(_0x3ebd65){utils[_0xc550('0x11')](_0x3ebd65);}});ami['on'](_0xc550('0x23'),function(_0x712e7a){try{calls[_0xc550('0x23')](_0x712e7a);recordings[_0xc550('0x23')](_0x712e7a);}catch(_0x596446){utils['error'](_0x596446);}});ami['on']('dialbegin',function(_0x20779b){try{dials[_0xc550('0x24')](_0x20779b);}catch(_0x50afce){utils[_0xc550('0x11')](_0x50afce);}});ami['on'](_0xc550('0x25'),function(_0x19e719){try{dials['dialend'](_0x19e719);}catch(_0x288164){utils[_0xc550('0x11')](_0x288164);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index 3fb4024..0458f1d 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 _0x2b50=['then','catch','error','some','startsWith','devicestatechange','BUSY','device','voice','TALKING','now','agent','NOT_INUSE','isNil','duration','diffTime','exitAt','enterAt','agentcomplete','assign','queue','cdr','data1','source','data3','destinationchannel','destination','util','./utils','Local/_attended@transfer','Queue:','info','format','MEMBER|%s|%s|%s|%s|%s|%s','uniqueid','interface','channel','data2','membername','type','getUserByInterface','name','internal','request','CreateMemberReport','getUserByName','split'];(function(_0x25d5d1,_0x10540a){var _0xf38950=function(_0x5a39f5){while(--_0x5a39f5){_0x25d5d1['push'](_0x25d5d1['shift']());}};_0xf38950(++_0x10540a);}(_0x2b50,0x193));var _0x02b5=function(_0x2bb503,_0x231e43){_0x2bb503=_0x2bb503-0x0;var _0xf582ed=_0x2b50[_0x2bb503];return _0xf582ed;};'use strict';var _=require('lodash');var util=require(_0x02b5('0x0'));var utils=require(_0x02b5('0x1'));var members={};var exclude=[_0x02b5('0x2'),_0x02b5('0x3')];function writeDB(_0x10f0ca){utils[_0x02b5('0x4')](util[_0x02b5('0x5')](_0x02b5('0x6'),_0x10f0ca[_0x02b5('0x7')],_0x10f0ca[_0x02b5('0x8')],_0x10f0ca[_0x02b5('0x9')],_0x10f0ca[_0x02b5('0xa')],_0x10f0ca[_0x02b5('0xb')],_0x10f0ca[_0x02b5('0xc')]));if(_0x10f0ca[_0x02b5('0x8')]){utils[_0x02b5('0xd')](_0x10f0ca['interface'])['then'](function(_0x5b0439){if(_0x5b0439){_0x10f0ca[_0x02b5('0xb')]=_0x5b0439[_0x02b5('0xe')];_0x10f0ca['internal']=_0x5b0439[_0x02b5('0xf')];utils[_0x02b5('0x10')](_0x02b5('0x11'),_0x10f0ca);}else{utils[_0x02b5('0x12')](_0x10f0ca[_0x02b5('0x8')][_0x02b5('0x13')]('/')[0x1])[_0x02b5('0x14')](function(_0x236c0b){if(_0x236c0b){_0x10f0ca[_0x02b5('0xb')]=_0x236c0b[_0x02b5('0xe')];_0x10f0ca[_0x02b5('0xf')]=_0x236c0b[_0x02b5('0xf')];utils['request'](_0x02b5('0x11'),_0x10f0ca);}});}})[_0x02b5('0x15')](function(_0xd6a298){utils[_0x02b5('0x16')](_0xd6a298);});}delete members[_0x10f0ca[_0x02b5('0x8')]];}function startsWith(_0x1f1079,_0x3670ae){return _[_0x02b5('0x17')](_0x1f1079,function(_0x205bcb){return _[_0x02b5('0x18')](_0x3670ae,_0x205bcb);});}exports[_0x02b5('0x19')]=function(_0x5e59d6){switch(_0x5e59d6['state']){case'INUSE':case _0x02b5('0x1a'):if(!startsWith(exclude,_0x5e59d6[_0x02b5('0x1b')])){members[_0x5e59d6[_0x02b5('0x1b')]]={'channel':_0x02b5('0x1c'),'interface':_0x5e59d6[_0x02b5('0x1b')],'type':_0x02b5('0x1d'),'enterAt':utils[_0x02b5('0x1e')](),'role':_0x02b5('0x1f')};}break;case _0x02b5('0x20'):if(!_[_0x02b5('0x21')](members[_0x5e59d6['device']])){members[_0x5e59d6['device']]['exitAt']=utils[_0x02b5('0x1e')]();members[_0x5e59d6[_0x02b5('0x1b')]][_0x02b5('0x22')]=utils[_0x02b5('0x23')](members[_0x5e59d6['device']][_0x02b5('0x24')],members[_0x5e59d6[_0x02b5('0x1b')]][_0x02b5('0x25')]);if(members[_0x5e59d6[_0x02b5('0x1b')]][_0x02b5('0x7')]){writeDB(members[_0x5e59d6[_0x02b5('0x1b')]]);}}default:break;}};exports[_0x02b5('0x26')]=function(_0x207baf){if(!_['isNil'](members[_0x207baf[_0x02b5('0x8')]])){members[_0x207baf[_0x02b5('0x8')]]=_[_0x02b5('0x27')](members[_0x207baf[_0x02b5('0x8')]],{'data4':_0x207baf[_0x02b5('0x28')],'uniqueid':_0x207baf[_0x02b5('0x7')]});}};exports[_0x02b5('0x29')]=function(_0x1ad397){if(_0x1ad397[_0x02b5('0x9')]){var _0x37b2e2=_0x1ad397[_0x02b5('0x9')][_0x02b5('0x13')]('-')[0x0];if(!_[_0x02b5('0x21')](members[_0x37b2e2])){members[_0x37b2e2]=_[_0x02b5('0x27')](members[_0x37b2e2],{'data1':members[_0x37b2e2][_0x02b5('0x2a')]||_0x1ad397[_0x02b5('0xc')],'data2':members[_0x37b2e2][_0x02b5('0xa')]||_0x1ad397[_0x02b5('0x2b')],'data3':members[_0x37b2e2][_0x02b5('0x2c')]||_0x1ad397['destination'],'uniqueid':members[_0x37b2e2]['uniqueid']||_0x1ad397['uniqueid']});if(members[_0x37b2e2][_0x02b5('0x24')]){writeDB(members[_0x37b2e2]);}}}if(_0x1ad397['destinationchannel']){var _0x4dc58e=_0x1ad397[_0x02b5('0x2d')][_0x02b5('0x13')]('-')[0x0];if(!_[_0x02b5('0x21')](members[_0x4dc58e])){members[_0x4dc58e]=_['assign'](members[_0x4dc58e],{'data1':members[_0x4dc58e][_0x02b5('0x2a')]||_0x1ad397[_0x02b5('0xc')],'data2':members[_0x4dc58e][_0x02b5('0xa')]||_0x1ad397[_0x02b5('0x2b')],'data3':members[_0x4dc58e][_0x02b5('0x2c')]||_0x1ad397[_0x02b5('0x2e')],'uniqueid':members[_0x4dc58e][_0x02b5('0x7')]||_0x1ad397['uniqueid']});if(members[_0x4dc58e][_0x02b5('0x24')]){writeDB(members[_0x4dc58e]);}}}}; \ No newline at end of file +var _0xcca3=['enterAt','agentcomplete','assign','channel','data1','destinationchannel','type','source','data3','destination','lodash','./utils','Local/_attended@transfer','info','format','uniqueid','interface','data2','membername','getUserByInterface','name','internal','request','split','then','CreateMemberReport','catch','error','some','startsWith','devicestatechange','state','BUSY','device','voice','agent','NOT_INUSE','isNil','exitAt','now','duration','diffTime'];(function(_0x31c387,_0xece6e6){var _0xa298ad=function(_0x336882){while(--_0x336882){_0x31c387['push'](_0x31c387['shift']());}};_0xa298ad(++_0xece6e6);}(_0xcca3,0x184));var _0x3cca=function(_0x27d771,_0x1a50b2){_0x27d771=_0x27d771-0x0;var _0x2ba087=_0xcca3[_0x27d771];return _0x2ba087;};'use strict';var _=require(_0x3cca('0x0'));var util=require('util');var utils=require(_0x3cca('0x1'));var members={};var exclude=[_0x3cca('0x2'),'Queue:'];function writeDB(_0x53e87e){utils[_0x3cca('0x3')](util[_0x3cca('0x4')]('MEMBER|%s|%s|%s|%s|%s|%s',_0x53e87e[_0x3cca('0x5')],_0x53e87e[_0x3cca('0x6')],_0x53e87e['channel'],_0x53e87e[_0x3cca('0x7')],_0x53e87e[_0x3cca('0x8')],_0x53e87e['type']));if(_0x53e87e[_0x3cca('0x6')]){utils[_0x3cca('0x9')](_0x53e87e[_0x3cca('0x6')])['then'](function(_0x2f43c3){if(_0x2f43c3){_0x53e87e['membername']=_0x2f43c3[_0x3cca('0xa')];_0x53e87e[_0x3cca('0xb')]=_0x2f43c3['internal'];utils[_0x3cca('0xc')]('CreateMemberReport',_0x53e87e);}else{utils['getUserByName'](_0x53e87e[_0x3cca('0x6')][_0x3cca('0xd')]('/')[0x1])[_0x3cca('0xe')](function(_0x5567d3){if(_0x5567d3){_0x53e87e[_0x3cca('0x8')]=_0x5567d3[_0x3cca('0xa')];_0x53e87e[_0x3cca('0xb')]=_0x5567d3['internal'];utils[_0x3cca('0xc')](_0x3cca('0xf'),_0x53e87e);}});}})[_0x3cca('0x10')](function(_0x46eb4e){utils[_0x3cca('0x11')](_0x46eb4e);});}delete members[_0x53e87e['interface']];}function startsWith(_0x41822c,_0x1d88e8){return _[_0x3cca('0x12')](_0x41822c,function(_0x862261){return _[_0x3cca('0x13')](_0x1d88e8,_0x862261);});}exports[_0x3cca('0x14')]=function(_0x5834e4){switch(_0x5834e4[_0x3cca('0x15')]){case'INUSE':case _0x3cca('0x16'):if(!startsWith(exclude,_0x5834e4[_0x3cca('0x17')])){members[_0x5834e4[_0x3cca('0x17')]]={'channel':_0x3cca('0x18'),'interface':_0x5834e4[_0x3cca('0x17')],'type':'TALKING','enterAt':utils['now'](),'role':_0x3cca('0x19')};}break;case _0x3cca('0x1a'):if(!_[_0x3cca('0x1b')](members[_0x5834e4[_0x3cca('0x17')]])){members[_0x5834e4['device']][_0x3cca('0x1c')]=utils[_0x3cca('0x1d')]();members[_0x5834e4[_0x3cca('0x17')]][_0x3cca('0x1e')]=utils[_0x3cca('0x1f')](members[_0x5834e4['device']][_0x3cca('0x1c')],members[_0x5834e4[_0x3cca('0x17')]][_0x3cca('0x20')]);if(members[_0x5834e4[_0x3cca('0x17')]][_0x3cca('0x5')]){writeDB(members[_0x5834e4['device']]);}}default:break;}};exports[_0x3cca('0x21')]=function(_0x5d7849){if(!_[_0x3cca('0x1b')](members[_0x5d7849[_0x3cca('0x6')]])){members[_0x5d7849[_0x3cca('0x6')]]=_[_0x3cca('0x22')](members[_0x5d7849[_0x3cca('0x6')]],{'data4':_0x5d7849['queue'],'uniqueid':_0x5d7849[_0x3cca('0x5')]});}};exports['cdr']=function(_0xde13db){if(_0xde13db[_0x3cca('0x23')]){var _0x3b8aaf=_0xde13db['channel']['split']('-')[0x0];if(!_[_0x3cca('0x1b')](members[_0x3b8aaf])){members[_0x3b8aaf]=_[_0x3cca('0x22')](members[_0x3b8aaf],{'data1':members[_0x3b8aaf][_0x3cca('0x24')]||_0xde13db['type'],'data2':members[_0x3b8aaf][_0x3cca('0x7')]||_0xde13db['source'],'data3':members[_0x3b8aaf]['data3']||_0xde13db['destination'],'uniqueid':members[_0x3b8aaf][_0x3cca('0x5')]||_0xde13db['uniqueid']});if(members[_0x3b8aaf]['exitAt']){writeDB(members[_0x3b8aaf]);}}}if(_0xde13db[_0x3cca('0x25')]){var _0xafbe2=_0xde13db[_0x3cca('0x25')][_0x3cca('0xd')]('-')[0x0];if(!_[_0x3cca('0x1b')](members[_0xafbe2])){members[_0xafbe2]=_[_0x3cca('0x22')](members[_0xafbe2],{'data1':members[_0xafbe2][_0x3cca('0x24')]||_0xde13db[_0x3cca('0x26')],'data2':members[_0xafbe2][_0x3cca('0x7')]||_0xde13db[_0x3cca('0x27')],'data3':members[_0xafbe2][_0x3cca('0x28')]||_0xde13db[_0x3cca('0x29')],'uniqueid':members[_0xafbe2][_0x3cca('0x5')]||_0xde13db['uniqueid']});if(members[_0xafbe2][_0x3cca('0x1c')]){writeDB(members[_0xafbe2]);}}}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 30c0eeb..b5870e5 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 _0xce7e=['./utils','info','format','QUEUE|%s|%s|%s|%s|%s|%s|%s','uniqueid','lastAssignedTo','calleridnum','queue','getVoiceQueueByName','type','request','CreateVoiceQueueReport','transfereduniqueid','assign','position','hangup','queuecallerleaveAt','queuecallerabandon','queuecallercomplete','queuecallercompleteAt','COMPLETEDBYAGENT','varset','isNil','variable','queuestatus','value','toUpperCase','CONTINUE','queuecallerexit','queuecallerexitAt','queuecallerexitreason','queueposition','now','EXITWITHKEY','queuecallerabandonAt','ABANDONED','queuecallerleave','holdtime','queuecallerjoinAt','count','connectedlinenum','connectedlinename','agentconnect','assigned','accountcode','destaccountcode','agentcomplete','membername','reason','transfer','TRANSFER','blindtransfer','transfereeuniqueid','transfertype','transferexten','extension','transferuniqueid','attendedtransfer','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','origtransfererexten','ATTENDEDTRANSFER','transfereelinkedid','clone','transfertargetuniqueid','queuecallerenterreason','calleridname','mohtime','secondtransfereruniqueid','ATTENDED','secondtransfererexten','transfertargetlinkedid','error','stack','musiconholdstart','musiconholdstartAt','lodash','util'];(function(_0x418473,_0x2f4ef1){var _0x3e85d4=function(_0x2aa789){while(--_0x2aa789){_0x418473['push'](_0x418473['shift']());}};_0x3e85d4(++_0x2f4ef1);}(_0xce7e,0x189));var _0xece7=function(_0x260d40,_0x12855a){_0x260d40=_0x260d40-0x0;var _0x4665ca=_0xce7e[_0x260d40];return _0x4665ca;};'use strict';var _=require(_0xece7('0x0'));var util=require(_0xece7('0x1'));var utils=require(_0xece7('0x2'));var queues={};function writeDB(_0x86a48b){utils[_0xece7('0x3')](util[_0xece7('0x4')](_0xece7('0x5'),_0x86a48b[_0xece7('0x6')],_0x86a48b['channel'],_0x86a48b['queue'],_0x86a48b[_0xece7('0x7')],_0x86a48b[_0xece7('0x8')],_0x86a48b['accountcode'],_0x86a48b['queuecallerexitreason']));if(_0x86a48b[_0xece7('0x9')]){utils[_0xece7('0xa')](_0x86a48b[_0xece7('0x9')])['then'](function(_0x2bce89){if(_0x2bce89){_0x86a48b['type']=_0x2bce89[_0xece7('0xb')];}utils[_0xece7('0xc')](_0xece7('0xd'),_0x86a48b);});}else{utils[_0xece7('0xc')](_0xece7('0xd'),_0x86a48b);}if(_0x86a48b['transfereduniqueid']){delete queues[_0x86a48b[_0xece7('0xe')]];}else{delete queues[_0x86a48b[_0xece7('0x6')]];}}exports['queuecallerjoin']=function(_0xd9e30e){queues[_0xd9e30e[_0xece7('0x6')]]=_[_0xece7('0xf')](_0xd9e30e,{'originalposition':_0xd9e30e[_0xece7('0x10')],'queuecallerjoinAt':utils['now'](),'mohtime':0x0});};exports[_0xece7('0x11')]=function(_0x21f0e3){if(!_['isNil'](queues[_0x21f0e3['uniqueid']])){if(queues[_0x21f0e3['uniqueid']][_0xece7('0x12')]){if(!queues[_0x21f0e3['uniqueid']][_0xece7('0x13')]&&!queues[_0x21f0e3['uniqueid']]['queuecallerexit']){queues[_0x21f0e3[_0xece7('0x6')]][_0xece7('0x14')]=!![];queues[_0x21f0e3[_0xece7('0x6')]][_0xece7('0x15')]=utils['now']();queues[_0x21f0e3[_0xece7('0x6')]]['queuecallerexitreason']=_0xece7('0x16');}writeDB(queues[_0x21f0e3[_0xece7('0x6')]]);}else{if(queues[_0x21f0e3[_0xece7('0x6')]][_0xece7('0xe')]){queues[queues[_0x21f0e3[_0xece7('0x6')]][_0xece7('0xe')]]=queues[_0x21f0e3[_0xece7('0x6')]];queues[queues[_0x21f0e3[_0xece7('0x6')]][_0xece7('0xe')]]['queuecallerenterreason']=0x2;delete queues[_0x21f0e3['uniqueid']];}}}};exports[_0xece7('0x17')]=function(_0x34fb53){if(!_[_0xece7('0x18')](_0x34fb53[_0xece7('0x19')][_0xece7('0x1a')])&&_0x34fb53[_0xece7('0x1b')][_0xece7('0x1c')]()!==_0xece7('0x1d')){if(!_['isNil'](queues[_0x34fb53[_0xece7('0x6')]])){queues[_0x34fb53[_0xece7('0x6')]][_0xece7('0x13')]=![];queues[_0x34fb53['uniqueid']]['queuecallerabandonAt']=null;queues[_0x34fb53[_0xece7('0x6')]][_0xece7('0x1e')]=!![];queues[_0x34fb53[_0xece7('0x6')]][_0xece7('0x1f')]=utils['now']();queues[_0x34fb53[_0xece7('0x6')]][_0xece7('0x20')]=_0x34fb53[_0xece7('0x1b')]['toUpperCase']();writeDB(queues[_0x34fb53[_0xece7('0x6')]]);}}else if(!_[_0xece7('0x18')](_0x34fb53[_0xece7('0x19')][_0xece7('0x21')])){if(!_[_0xece7('0x18')](queues[_0x34fb53[_0xece7('0x6')]])&&!queues[_0x34fb53[_0xece7('0x6')]]['queuecallerabandon']){queues[_0x34fb53[_0xece7('0x6')]][_0xece7('0x13')]=![];queues[_0x34fb53[_0xece7('0x6')]]['queuecallerabandonAt']=null;queues[_0x34fb53[_0xece7('0x6')]][_0xece7('0x1e')]=!![];queues[_0x34fb53[_0xece7('0x6')]]['queuecallerexitAt']=utils[_0xece7('0x22')]();queues[_0x34fb53['uniqueid']][_0xece7('0x20')]=_0xece7('0x23');}}};exports['queuecallerabandon']=function(_0x957568){if(!_[_0xece7('0x18')](queues[_0x957568[_0xece7('0x6')]])){queues[_0x957568[_0xece7('0x6')]][_0xece7('0x1e')]=![];queues[_0x957568[_0xece7('0x6')]][_0xece7('0x1f')]=null;queues[_0x957568['uniqueid']]['queuecallerabandon']=!![];queues[_0x957568[_0xece7('0x6')]][_0xece7('0x24')]=utils[_0xece7('0x22')]();queues[_0x957568[_0xece7('0x6')]][_0xece7('0x20')]=_0xece7('0x25');}};exports[_0xece7('0x26')]=function(_0x539dc9){if(!_[_0xece7('0x18')](queues[_0x539dc9[_0xece7('0x6')]])){queues[_0x539dc9[_0xece7('0x6')]]['queuecallerleave']=!![];queues[_0x539dc9[_0xece7('0x6')]][_0xece7('0x12')]=utils[_0xece7('0x22')]();queues[_0x539dc9[_0xece7('0x6')]][_0xece7('0x27')]=utils['diffTime'](queues[_0x539dc9['uniqueid']][_0xece7('0x12')],queues[_0x539dc9['uniqueid']][_0xece7('0x28')]);queues[_0x539dc9[_0xece7('0x6')]][_0xece7('0x10')]=_0x539dc9[_0xece7('0x10')];queues[_0x539dc9[_0xece7('0x6')]][_0xece7('0x29')]=_0x539dc9[_0xece7('0x29')];queues[_0x539dc9[_0xece7('0x6')]]['connectedlinenum']=_0x539dc9[_0xece7('0x2a')];queues[_0x539dc9['uniqueid']][_0xece7('0x2b')]=_0x539dc9[_0xece7('0x2b')];}};exports[_0xece7('0x2c')]=function(_0xa7f9e3){if(!_[_0xece7('0x18')](queues[_0xa7f9e3['uniqueid']])){queues[_0xa7f9e3['uniqueid']][_0xece7('0x13')]=![];queues[_0xa7f9e3[_0xece7('0x6')]][_0xece7('0x13')]=![];queues[_0xa7f9e3[_0xece7('0x6')]][_0xece7('0x24')]=null;queues[_0xa7f9e3['uniqueid']][_0xece7('0x1e')]=![];queues[_0xa7f9e3[_0xece7('0x6')]][_0xece7('0x20')]=null;queues[_0xa7f9e3[_0xece7('0x6')]]['queuecallerexitAt']=null;queues[_0xa7f9e3[_0xece7('0x6')]][_0xece7('0x2d')]=!![];queues[_0xa7f9e3['uniqueid']][_0xece7('0x2e')]=_0xa7f9e3[_0xece7('0x2f')];queues[_0xa7f9e3[_0xece7('0x6')]][_0xece7('0x7')]=_0xa7f9e3['membername'];}};exports[_0xece7('0x30')]=function(_0x33aef9){if(!_['isNil'](queues[_0x33aef9[_0xece7('0x6')]])){if(queues[_0x33aef9[_0xece7('0x6')]][_0xece7('0x12')]){queues[_0x33aef9['uniqueid']][_0xece7('0x13')]=![];queues[_0x33aef9[_0xece7('0x6')]][_0xece7('0x13')]=![];queues[_0x33aef9[_0xece7('0x6')]]['queuecallerabandonAt']=null;queues[_0x33aef9[_0xece7('0x6')]]['queuecallerexit']=![];queues[_0x33aef9[_0xece7('0x6')]]['queuecallerexitAt']=null;queues[_0x33aef9[_0xece7('0x6')]][_0xece7('0x2d')]=!![];queues[_0x33aef9['uniqueid']][_0xece7('0x7')]=_0x33aef9[_0xece7('0x31')];queues[_0x33aef9[_0xece7('0x6')]][_0xece7('0x14')]=!![];queues[_0x33aef9[_0xece7('0x6')]][_0xece7('0x15')]=utils[_0xece7('0x22')]();if(_0x33aef9[_0xece7('0x32')]==_0xece7('0x33')){if(!queues[_0x33aef9['uniqueid']][_0xece7('0x33')]){queues[_0x33aef9[_0xece7('0x6')]][_0xece7('0x20')]=_0xece7('0x34');}}else{queues[_0x33aef9['uniqueid']]['queuecallerexitreason']='COMPLETEDBY'+_0x33aef9['reason'][_0xece7('0x1c')]();}writeDB(queues[_0x33aef9[_0xece7('0x6')]]);}}};exports[_0xece7('0x35')]=function(_0x296939){if(!_[_0xece7('0x18')](queues[_0x296939[_0xece7('0x36')]])){queues[_0x296939[_0xece7('0x36')]][_0xece7('0x33')]=!![];queues[_0x296939[_0xece7('0x36')]][_0xece7('0x37')]='BLIND';queues[_0x296939[_0xece7('0x36')]][_0xece7('0x38')]=_0x296939[_0xece7('0x39')];queues[_0x296939[_0xece7('0x36')]][_0xece7('0x3a')]=_0x296939['transfereeuniqueid'];queues[_0x296939[_0xece7('0x36')]][_0xece7('0x20')]='BLINDTRANSFER';}};exports[_0xece7('0x3b')]=function(_0x1f8404){try{if(_0x1f8404[_0xece7('0x3c')]==_0x1f8404[_0xece7('0x3d')]){if(!_[_0xece7('0x18')](queues[_0x1f8404[_0xece7('0x3e')]])){queues[_0x1f8404[_0xece7('0x3e')]]['transfer']=!![];queues[_0x1f8404[_0xece7('0x3e')]]['transfertype']='ATTENDED';queues[_0x1f8404[_0xece7('0x3e')]][_0xece7('0x38')]=_0x1f8404[_0xece7('0x3f')];queues[_0x1f8404[_0xece7('0x3e')]][_0xece7('0x3a')]=_0x1f8404[_0xece7('0x3c')];queues[_0x1f8404[_0xece7('0x3e')]][_0xece7('0x20')]=_0xece7('0x40');}if(!_['isNil'](queues[_0x1f8404[_0xece7('0x3d')]])){if(_0x1f8404[_0xece7('0x41')]&&queues[_0x1f8404[_0xece7('0x41')]]){queues[_0x1f8404[_0xece7('0x41')]]['queuecallerenterreason']=0x1;queues[_0x1f8404['transfereeuniqueid']]=_[_0xece7('0x42')](queues[_0x1f8404['transfereelinkedid']]);queues[_0x1f8404[_0xece7('0x36')]]['transfereduniqueid']=_0x1f8404[_0xece7('0x43')];queues[_0x1f8404[_0xece7('0x36')]][_0xece7('0x44')]=0x2;queues[_0x1f8404[_0xece7('0x36')]][_0xece7('0x8')]=queues[_0x1f8404[_0xece7('0x3e')]][_0xece7('0x8')];queues[_0x1f8404[_0xece7('0x36')]][_0xece7('0x45')]=queues[_0x1f8404[_0xece7('0x3e')]][_0xece7('0x45')];queues[_0x1f8404[_0xece7('0x36')]][_0xece7('0x28')]=utils[_0xece7('0x22')]();queues[_0x1f8404['transfereeuniqueid']]['queuecallerleaveAt']=utils[_0xece7('0x22')]();queues[_0x1f8404[_0xece7('0x36')]]['holdtime']=0x0;queues[_0x1f8404[_0xece7('0x36')]][_0xece7('0x46')]=0x0;}else{queues[_0x1f8404['origtransfererlinkedid']]['transfereduniqueid']=_0x1f8404[_0xece7('0x3e')];}}}else if(_0x1f8404[_0xece7('0x47')]==_0x1f8404[_0xece7('0x3e')]){if(!_['isNil'](queues[_0x1f8404[_0xece7('0x3d')]])){queues[_0x1f8404[_0xece7('0x3d')]][_0xece7('0x33')]=!![];queues[_0x1f8404['origtransfererlinkedid']]['transfertype']=_0xece7('0x48');queues[_0x1f8404['origtransfererlinkedid']][_0xece7('0x38')]=_0x1f8404[_0xece7('0x49')];queues[_0x1f8404[_0xece7('0x3d')]][_0xece7('0x3a')]=_0x1f8404[_0xece7('0x47')];queues[_0x1f8404[_0xece7('0x3d')]][_0xece7('0x20')]='ATTENDEDTRANSFER';}if(!_['isNil'](queues[_0x1f8404[_0xece7('0x3e')]])){if(_0x1f8404[_0xece7('0x4a')]&&queues[_0x1f8404['transfertargetlinkedid']]){queues[_0x1f8404[_0xece7('0x4a')]][_0xece7('0x44')]=0x1;queues[_0x1f8404[_0xece7('0x43')]]=_[_0xece7('0x42')](queues[_0x1f8404[_0xece7('0x4a')]]);queues[_0x1f8404[_0xece7('0x43')]][_0xece7('0xe')]=_0x1f8404[_0xece7('0x43')];queues[_0x1f8404[_0xece7('0x43')]][_0xece7('0x44')]=0x2;queues[_0x1f8404[_0xece7('0x43')]]['calleridnum']=queues[_0x1f8404['origtransfererlinkedid']][_0xece7('0x8')];queues[_0x1f8404[_0xece7('0x43')]][_0xece7('0x45')]=queues[_0x1f8404['origtransfererlinkedid']][_0xece7('0x45')];queues[_0x1f8404[_0xece7('0x43')]][_0xece7('0x28')]=utils[_0xece7('0x22')]();queues[_0x1f8404[_0xece7('0x43')]]['queuecallerleaveAt']=utils[_0xece7('0x22')]();queues[_0x1f8404[_0xece7('0x43')]][_0xece7('0x27')]=0x0;queues[_0x1f8404[_0xece7('0x43')]][_0xece7('0x46')]=0x0;}else{queues[_0x1f8404[_0xece7('0x3e')]][_0xece7('0xe')]=_0x1f8404[_0xece7('0x3d')];}}}}catch(_0x8b1c50){utils[_0xece7('0x4b')](_0x8b1c50[_0xece7('0x4c')]);}};exports[_0xece7('0x4d')]=function(_0x37ac60){if(!_['isNil'](queues[_0x37ac60[_0xece7('0x6')]])){queues[_0x37ac60[_0xece7('0x6')]][_0xece7('0x4e')]=utils[_0xece7('0x22')]();}};exports['musiconholdstop']=function(_0x3ed92f){if(!_[_0xece7('0x18')](queues[_0x3ed92f['uniqueid']])){if(!_[_0xece7('0x18')](queues[_0x3ed92f[_0xece7('0x6')]][_0xece7('0x4e')])){queues[_0x3ed92f['uniqueid']]['mohtime']+=utils['diffTime'](utils[_0xece7('0x22')](),queues[_0x3ed92f['uniqueid']]['musiconholdstartAt']);delete queues[_0x3ed92f[_0xece7('0x6')]][_0xece7('0x4e')];}}}; \ No newline at end of file +var _0x8124=['queuecallerexitAt','EXITWITHKEY','ABANDONED','holdtime','diffTime','position','connectedlinenum','connectedlinename','agentconnect','assigned','destaccountcode','membername','agentcomplete','transfer','TRANSFER','reason','transfereeuniqueid','BLIND','transferexten','extension','transferuniqueid','BLINDTRANSFER','attendedtransfer','origtransfereruniqueid','secondtransfererlinkedid','transfertype','ATTENDED','origtransfererexten','origtransfererlinkedid','transfereelinkedid','queuecallerenterreason','transfertargetuniqueid','calleridname','secondtransfereruniqueid','secondtransfererexten','ATTENDEDTRANSFER','transfertargetlinkedid','clone','queuecallerjoinAt','musiconholdstop','musiconholdstartAt','mohtime','lodash','util','./utils','format','uniqueid','channel','queue','lastAssignedTo','calleridnum','accountcode','queuecallerexitreason','then','type','request','CreateVoiceQueueReport','transfereduniqueid','assign','now','isNil','queuecallerleaveAt','queuecallerabandon','queuecallercomplete','queuecallercompleteAt','COMPLETEDBYAGENT','varset','variable','queuestatus','value','toUpperCase','CONTINUE','queuecallerabandonAt','queuecallerexit','queueposition'];(function(_0x5271d3,_0x42327c){var _0x262107=function(_0xa6edbc){while(--_0xa6edbc){_0x5271d3['push'](_0x5271d3['shift']());}};_0x262107(++_0x42327c);}(_0x8124,0x1a1));var _0x4812=function(_0x594e11,_0x28f652){_0x594e11=_0x594e11-0x0;var _0x5418ad=_0x8124[_0x594e11];return _0x5418ad;};'use strict';var _=require(_0x4812('0x0'));var util=require(_0x4812('0x1'));var utils=require(_0x4812('0x2'));var queues={};function writeDB(_0x2b1332){utils['info'](util[_0x4812('0x3')]('QUEUE|%s|%s|%s|%s|%s|%s|%s',_0x2b1332[_0x4812('0x4')],_0x2b1332[_0x4812('0x5')],_0x2b1332[_0x4812('0x6')],_0x2b1332[_0x4812('0x7')],_0x2b1332[_0x4812('0x8')],_0x2b1332[_0x4812('0x9')],_0x2b1332[_0x4812('0xa')]));if(_0x2b1332[_0x4812('0x6')]){utils['getVoiceQueueByName'](_0x2b1332['queue'])[_0x4812('0xb')](function(_0x24f59f){if(_0x24f59f){_0x2b1332[_0x4812('0xc')]=_0x24f59f[_0x4812('0xc')];}utils[_0x4812('0xd')](_0x4812('0xe'),_0x2b1332);});}else{utils['request'](_0x4812('0xe'),_0x2b1332);}if(_0x2b1332[_0x4812('0xf')]){delete queues[_0x2b1332[_0x4812('0xf')]];}else{delete queues[_0x2b1332['uniqueid']];}}exports['queuecallerjoin']=function(_0x241e20){queues[_0x241e20[_0x4812('0x4')]]=_[_0x4812('0x10')](_0x241e20,{'originalposition':_0x241e20['position'],'queuecallerjoinAt':utils[_0x4812('0x11')](),'mohtime':0x0});};exports['hangup']=function(_0x3fbd27){if(!_[_0x4812('0x12')](queues[_0x3fbd27[_0x4812('0x4')]])){if(queues[_0x3fbd27[_0x4812('0x4')]][_0x4812('0x13')]){if(!queues[_0x3fbd27['uniqueid']][_0x4812('0x14')]&&!queues[_0x3fbd27[_0x4812('0x4')]]['queuecallerexit']){queues[_0x3fbd27[_0x4812('0x4')]][_0x4812('0x15')]=!![];queues[_0x3fbd27[_0x4812('0x4')]][_0x4812('0x16')]=utils[_0x4812('0x11')]();queues[_0x3fbd27['uniqueid']][_0x4812('0xa')]=_0x4812('0x17');}writeDB(queues[_0x3fbd27[_0x4812('0x4')]]);}else{if(queues[_0x3fbd27[_0x4812('0x4')]]['transfereduniqueid']){queues[queues[_0x3fbd27[_0x4812('0x4')]][_0x4812('0xf')]]=queues[_0x3fbd27[_0x4812('0x4')]];queues[queues[_0x3fbd27[_0x4812('0x4')]][_0x4812('0xf')]]['queuecallerenterreason']=0x2;delete queues[_0x3fbd27[_0x4812('0x4')]];}}}};exports[_0x4812('0x18')]=function(_0x36f0c5){if(!_[_0x4812('0x12')](_0x36f0c5[_0x4812('0x19')][_0x4812('0x1a')])&&_0x36f0c5[_0x4812('0x1b')][_0x4812('0x1c')]()!==_0x4812('0x1d')){if(!_['isNil'](queues[_0x36f0c5[_0x4812('0x4')]])){queues[_0x36f0c5[_0x4812('0x4')]][_0x4812('0x14')]=![];queues[_0x36f0c5[_0x4812('0x4')]][_0x4812('0x1e')]=null;queues[_0x36f0c5[_0x4812('0x4')]][_0x4812('0x1f')]=!![];queues[_0x36f0c5[_0x4812('0x4')]]['queuecallerexitAt']=utils['now']();queues[_0x36f0c5[_0x4812('0x4')]]['queuecallerexitreason']=_0x36f0c5[_0x4812('0x1b')]['toUpperCase']();writeDB(queues[_0x36f0c5[_0x4812('0x4')]]);}}else if(!_[_0x4812('0x12')](_0x36f0c5[_0x4812('0x19')][_0x4812('0x20')])){if(!_['isNil'](queues[_0x36f0c5['uniqueid']])&&!queues[_0x36f0c5['uniqueid']][_0x4812('0x14')]){queues[_0x36f0c5[_0x4812('0x4')]]['queuecallerabandon']=![];queues[_0x36f0c5['uniqueid']][_0x4812('0x1e')]=null;queues[_0x36f0c5[_0x4812('0x4')]][_0x4812('0x1f')]=!![];queues[_0x36f0c5['uniqueid']][_0x4812('0x21')]=utils['now']();queues[_0x36f0c5['uniqueid']][_0x4812('0xa')]=_0x4812('0x22');}}};exports[_0x4812('0x14')]=function(_0x4de328){if(!_[_0x4812('0x12')](queues[_0x4de328[_0x4812('0x4')]])){queues[_0x4de328[_0x4812('0x4')]]['queuecallerexit']=![];queues[_0x4de328[_0x4812('0x4')]][_0x4812('0x21')]=null;queues[_0x4de328['uniqueid']][_0x4812('0x14')]=!![];queues[_0x4de328[_0x4812('0x4')]]['queuecallerabandonAt']=utils[_0x4812('0x11')]();queues[_0x4de328[_0x4812('0x4')]]['queuecallerexitreason']=_0x4812('0x23');}};exports['queuecallerleave']=function(_0xcb9312){if(!_[_0x4812('0x12')](queues[_0xcb9312['uniqueid']])){queues[_0xcb9312[_0x4812('0x4')]]['queuecallerleave']=!![];queues[_0xcb9312['uniqueid']][_0x4812('0x13')]=utils[_0x4812('0x11')]();queues[_0xcb9312['uniqueid']][_0x4812('0x24')]=utils[_0x4812('0x25')](queues[_0xcb9312[_0x4812('0x4')]][_0x4812('0x13')],queues[_0xcb9312[_0x4812('0x4')]]['queuecallerjoinAt']);queues[_0xcb9312[_0x4812('0x4')]]['position']=_0xcb9312[_0x4812('0x26')];queues[_0xcb9312[_0x4812('0x4')]]['count']=_0xcb9312['count'];queues[_0xcb9312[_0x4812('0x4')]][_0x4812('0x27')]=_0xcb9312[_0x4812('0x27')];queues[_0xcb9312[_0x4812('0x4')]]['connectedlinename']=_0xcb9312[_0x4812('0x28')];}};exports[_0x4812('0x29')]=function(_0x50a90d){if(!_[_0x4812('0x12')](queues[_0x50a90d['uniqueid']])){queues[_0x50a90d[_0x4812('0x4')]][_0x4812('0x14')]=![];queues[_0x50a90d[_0x4812('0x4')]][_0x4812('0x14')]=![];queues[_0x50a90d[_0x4812('0x4')]][_0x4812('0x1e')]=null;queues[_0x50a90d['uniqueid']]['queuecallerexit']=![];queues[_0x50a90d[_0x4812('0x4')]][_0x4812('0xa')]=null;queues[_0x50a90d[_0x4812('0x4')]][_0x4812('0x21')]=null;queues[_0x50a90d[_0x4812('0x4')]][_0x4812('0x2a')]=!![];queues[_0x50a90d[_0x4812('0x4')]][_0x4812('0x9')]=_0x50a90d[_0x4812('0x2b')];queues[_0x50a90d[_0x4812('0x4')]][_0x4812('0x7')]=_0x50a90d[_0x4812('0x2c')];}};exports[_0x4812('0x2d')]=function(_0x5d1b49){if(!_[_0x4812('0x12')](queues[_0x5d1b49[_0x4812('0x4')]])){if(queues[_0x5d1b49[_0x4812('0x4')]][_0x4812('0x13')]){queues[_0x5d1b49[_0x4812('0x4')]][_0x4812('0x14')]=![];queues[_0x5d1b49['uniqueid']]['queuecallerabandon']=![];queues[_0x5d1b49[_0x4812('0x4')]][_0x4812('0x1e')]=null;queues[_0x5d1b49[_0x4812('0x4')]][_0x4812('0x1f')]=![];queues[_0x5d1b49[_0x4812('0x4')]][_0x4812('0x21')]=null;queues[_0x5d1b49[_0x4812('0x4')]][_0x4812('0x2a')]=!![];queues[_0x5d1b49[_0x4812('0x4')]]['lastAssignedTo']=_0x5d1b49['membername'];queues[_0x5d1b49[_0x4812('0x4')]][_0x4812('0x15')]=!![];queues[_0x5d1b49[_0x4812('0x4')]][_0x4812('0x16')]=utils[_0x4812('0x11')]();if(_0x5d1b49['reason']==_0x4812('0x2e')){if(!queues[_0x5d1b49[_0x4812('0x4')]][_0x4812('0x2e')]){queues[_0x5d1b49['uniqueid']][_0x4812('0xa')]=_0x4812('0x2f');}}else{queues[_0x5d1b49[_0x4812('0x4')]]['queuecallerexitreason']='COMPLETEDBY'+_0x5d1b49[_0x4812('0x30')][_0x4812('0x1c')]();}writeDB(queues[_0x5d1b49[_0x4812('0x4')]]);}}};exports['blindtransfer']=function(_0x208c81){if(!_[_0x4812('0x12')](queues[_0x208c81[_0x4812('0x31')]])){queues[_0x208c81['transfereeuniqueid']]['transfer']=!![];queues[_0x208c81[_0x4812('0x31')]]['transfertype']=_0x4812('0x32');queues[_0x208c81[_0x4812('0x31')]][_0x4812('0x33')]=_0x208c81[_0x4812('0x34')];queues[_0x208c81['transfereeuniqueid']][_0x4812('0x35')]=_0x208c81[_0x4812('0x31')];queues[_0x208c81[_0x4812('0x31')]][_0x4812('0xa')]=_0x4812('0x36');}};exports[_0x4812('0x37')]=function(_0x5aff11){try{if(_0x5aff11[_0x4812('0x38')]==_0x5aff11['origtransfererlinkedid']){if(!_[_0x4812('0x12')](queues[_0x5aff11[_0x4812('0x39')]])){queues[_0x5aff11[_0x4812('0x39')]][_0x4812('0x2e')]=!![];queues[_0x5aff11['secondtransfererlinkedid']][_0x4812('0x3a')]=_0x4812('0x3b');queues[_0x5aff11[_0x4812('0x39')]]['transferexten']=_0x5aff11[_0x4812('0x3c')];queues[_0x5aff11[_0x4812('0x39')]][_0x4812('0x35')]=_0x5aff11['origtransfereruniqueid'];queues[_0x5aff11[_0x4812('0x39')]]['queuecallerexitreason']='ATTENDEDTRANSFER';}if(!_[_0x4812('0x12')](queues[_0x5aff11[_0x4812('0x3d')]])){if(_0x5aff11[_0x4812('0x3e')]&&queues[_0x5aff11[_0x4812('0x3e')]]){queues[_0x5aff11[_0x4812('0x3e')]][_0x4812('0x3f')]=0x1;queues[_0x5aff11[_0x4812('0x31')]]=_['clone'](queues[_0x5aff11[_0x4812('0x3e')]]);queues[_0x5aff11[_0x4812('0x31')]][_0x4812('0xf')]=_0x5aff11[_0x4812('0x40')];queues[_0x5aff11[_0x4812('0x31')]][_0x4812('0x3f')]=0x2;queues[_0x5aff11['transfereeuniqueid']]['calleridnum']=queues[_0x5aff11[_0x4812('0x39')]][_0x4812('0x8')];queues[_0x5aff11[_0x4812('0x31')]][_0x4812('0x41')]=queues[_0x5aff11[_0x4812('0x39')]][_0x4812('0x41')];queues[_0x5aff11[_0x4812('0x31')]]['queuecallerjoinAt']=utils[_0x4812('0x11')]();queues[_0x5aff11[_0x4812('0x31')]]['queuecallerleaveAt']=utils[_0x4812('0x11')]();queues[_0x5aff11[_0x4812('0x31')]]['holdtime']=0x0;queues[_0x5aff11[_0x4812('0x31')]]['mohtime']=0x0;}else{queues[_0x5aff11[_0x4812('0x3d')]][_0x4812('0xf')]=_0x5aff11[_0x4812('0x39')];}}}else if(_0x5aff11[_0x4812('0x42')]==_0x5aff11['secondtransfererlinkedid']){if(!_['isNil'](queues[_0x5aff11[_0x4812('0x3d')]])){queues[_0x5aff11[_0x4812('0x3d')]][_0x4812('0x2e')]=!![];queues[_0x5aff11[_0x4812('0x3d')]][_0x4812('0x3a')]=_0x4812('0x3b');queues[_0x5aff11[_0x4812('0x3d')]][_0x4812('0x33')]=_0x5aff11[_0x4812('0x43')];queues[_0x5aff11[_0x4812('0x3d')]][_0x4812('0x35')]=_0x5aff11[_0x4812('0x42')];queues[_0x5aff11['origtransfererlinkedid']][_0x4812('0xa')]=_0x4812('0x44');}if(!_[_0x4812('0x12')](queues[_0x5aff11[_0x4812('0x39')]])){if(_0x5aff11['transfertargetlinkedid']&&queues[_0x5aff11[_0x4812('0x45')]]){queues[_0x5aff11['transfertargetlinkedid']][_0x4812('0x3f')]=0x1;queues[_0x5aff11[_0x4812('0x40')]]=_[_0x4812('0x46')](queues[_0x5aff11[_0x4812('0x45')]]);queues[_0x5aff11[_0x4812('0x40')]]['transfereduniqueid']=_0x5aff11[_0x4812('0x40')];queues[_0x5aff11[_0x4812('0x40')]][_0x4812('0x3f')]=0x2;queues[_0x5aff11[_0x4812('0x40')]][_0x4812('0x8')]=queues[_0x5aff11[_0x4812('0x3d')]][_0x4812('0x8')];queues[_0x5aff11[_0x4812('0x40')]][_0x4812('0x41')]=queues[_0x5aff11[_0x4812('0x3d')]][_0x4812('0x41')];queues[_0x5aff11['transfertargetuniqueid']][_0x4812('0x47')]=utils[_0x4812('0x11')]();queues[_0x5aff11[_0x4812('0x40')]]['queuecallerleaveAt']=utils[_0x4812('0x11')]();queues[_0x5aff11['transfertargetuniqueid']][_0x4812('0x24')]=0x0;queues[_0x5aff11['transfertargetuniqueid']]['mohtime']=0x0;}else{queues[_0x5aff11['secondtransfererlinkedid']][_0x4812('0xf')]=_0x5aff11['origtransfererlinkedid'];}}}}catch(_0x1ac825){utils['error'](_0x1ac825['stack']);}};exports['musiconholdstart']=function(_0x6809b7){if(!_[_0x4812('0x12')](queues[_0x6809b7[_0x4812('0x4')]])){queues[_0x6809b7[_0x4812('0x4')]]['musiconholdstartAt']=utils[_0x4812('0x11')]();}};exports[_0x4812('0x48')]=function(_0x4d41f7){if(!_[_0x4812('0x12')](queues[_0x4d41f7['uniqueid']])){if(!_[_0x4812('0x12')](queues[_0x4d41f7[_0x4812('0x4')]][_0x4812('0x49')])){queues[_0x4d41f7[_0x4812('0x4')]][_0x4812('0x4a')]+=utils[_0x4812('0x25')](utils[_0x4812('0x11')](),queues[_0x4d41f7[_0x4812('0x4')]][_0x4812('0x49')]);delete queues[_0x4d41f7['uniqueid']]['musiconholdstartAt'];}}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 634f447..23b292d 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 _0xcb91=['uniqueid','channelstate','transfer','error','varset','variable','mixmonitor_filename','endsWith','value','.wav49','replace','.WAV','find','monitors','push','hangup','calleridnum','calleridname','connectedlinenum','connectedlinename','type','outbound','clone','newexten','toLowerCase','startsWith','appdata','cdr','split','substring','lastIndexOf','queuecallerjoin','queue','debug','accountcode','getUserByInternal','then','name','UserId','CreateVoiceRecording','request','newchannel','linkedid','exten','context','channel','stack','newstate','isNil'];(function(_0x4ed92f,_0x4f3a34){var _0x4e4ecb=function(_0x1c2748){while(--_0x1c2748){_0x4ed92f['push'](_0x4ed92f['shift']());}};_0x4e4ecb(++_0x4f3a34);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x337748,_0x402b05){_0x337748=_0x337748-0x0;var _0x3bb03f=_0xcb91[_0x337748];return _0x3bb03f;};'use strict';var _=require('lodash');var utils=require('./utils');var recordings={};function writeDB(_0x26fe42){utils[_0x1cb9('0x0')](_0x26fe42);if(_0x26fe42[_0x1cb9('0x1')]){utils[_0x1cb9('0x2')](_0x26fe42['accountcode'])[_0x1cb9('0x3')](function(_0x2c17b8){if(_0x2c17b8){_0x26fe42['membername']=_0x2c17b8[_0x1cb9('0x4')];_0x26fe42[_0x1cb9('0x5')]=_0x2c17b8['id'];}utils['request'](_0x1cb9('0x6'),_0x26fe42);});}else{utils[_0x1cb9('0x7')]('CreateVoiceRecording',_0x26fe42);}}exports[_0x1cb9('0x8')]=function(_0x12567c){try{if(_0x12567c['uniqueid']==_0x12567c[_0x1cb9('0x9')]){recordings[_0x12567c['uniqueid']]={'uniqueid':_0x12567c['uniqueid'],'accountcode':_0x12567c[_0x1cb9('0x1')],'exten':_0x12567c[_0x1cb9('0xa')],'context':_0x12567c[_0x1cb9('0xb')],'channel':_0x12567c[_0x1cb9('0xc')],'monitors':[]};}}catch(_0x2fc627){utils['error'](_0x2fc627[_0x1cb9('0xd')]);}};exports[_0x1cb9('0xe')]=function(_0x3af35f){try{if(!_[_0x1cb9('0xf')](recordings[_0x3af35f[_0x1cb9('0x10')]])&&_0x3af35f['channelstate']==0x6){}else if(!_['isNil'](recordings[_0x3af35f['linkedid']])&&_0x3af35f[_0x1cb9('0x11')]==0x6&&_0x3af35f[_0x1cb9('0xb')]!=_0x1cb9('0x12')){recordings[_0x3af35f[_0x1cb9('0x9')]]['accountcode']=_0x3af35f[_0x1cb9('0x1')];}}catch(_0x6ef389){utils[_0x1cb9('0x13')](_0x6ef389[_0x1cb9('0xd')]);}};exports[_0x1cb9('0x14')]=function(_0x5806d8){try{if(!_['isNil'](_0x5806d8[_0x1cb9('0x15')])&&!_[_0x1cb9('0xf')](_0x5806d8[_0x1cb9('0x15')][_0x1cb9('0x16')])){if(_[_0x1cb9('0x17')](_0x5806d8[_0x1cb9('0x18')],_0x1cb9('0x19'))){_0x5806d8['value']=_0x5806d8['value'][_0x1cb9('0x1a')](_0x1cb9('0x19'),_0x1cb9('0x1b'));}if(recordings[_0x5806d8[_0x1cb9('0x9')]]){var _0x280a84=_[_0x1cb9('0x1c')](recordings[_0x5806d8[_0x1cb9('0x9')]]['monitors'],{'value':_0x5806d8['value']});if(_[_0x1cb9('0xf')](_0x280a84)){recordings[_0x5806d8['linkedid']][_0x1cb9('0x1d')][_0x1cb9('0x1e')]({'value':_0x5806d8['value']});}}}}catch(_0x599275){utils[_0x1cb9('0x13')](_0x599275[_0x1cb9('0xd')]);}};exports[_0x1cb9('0x1f')]=function(_0x4601b8){try{if(!_[_0x1cb9('0xf')](recordings[_0x4601b8[_0x1cb9('0x10')]])){recordings[_0x4601b8['uniqueid']]['calleridnum']=_0x4601b8[_0x1cb9('0x20')];recordings[_0x4601b8['uniqueid']][_0x1cb9('0x21')]=_0x4601b8[_0x1cb9('0x21')];recordings[_0x4601b8[_0x1cb9('0x10')]][_0x1cb9('0x22')]=_0x4601b8[_0x1cb9('0x22')];recordings[_0x4601b8['uniqueid']][_0x1cb9('0x23')]=_0x4601b8[_0x1cb9('0x23')];if(recordings[_0x4601b8['uniqueid']][_0x1cb9('0x24')]==_0x1cb9('0x25')&&recordings[_0x4601b8[_0x1cb9('0x10')]][_0x1cb9('0x1')]){recordings[_0x4601b8[_0x1cb9('0x10')]][_0x1cb9('0x22')]=recordings[_0x4601b8[_0x1cb9('0x10')]][_0x1cb9('0x1')];recordings[_0x4601b8[_0x1cb9('0x10')]][_0x1cb9('0x23')]='';}recordings[_0x4601b8['uniqueid']][_0x1cb9('0x1d')]['forEach'](_0x110282=>{var _0x4efebc=_[_0x1cb9('0x26')](recordings[_0x4601b8[_0x1cb9('0x10')]]);_0x4efebc[_0x1cb9('0x18')]=_0x110282[_0x1cb9('0x18')];writeDB(_0x4efebc);});delete recordings[_0x4601b8['uniqueid']];}}catch(_0x1c701f){utils['error'](_0x1c701f[_0x1cb9('0xd')]);}};exports[_0x1cb9('0x27')]=function(_0x4220d7){try{if(!_['isNil'](recordings[_0x4220d7[_0x1cb9('0x10')]])){if(_0x4220d7['application'][_0x1cb9('0x28')]()=='set'&&_[_0x1cb9('0x29')](_0x4220d7[_0x1cb9('0x2a')][_0x1cb9('0x28')](),_0x1cb9('0x2b'))){var _0x56c3e0=_0x4220d7[_0x1cb9('0x2a')][_0x1cb9('0x2c')]('=');var _0x3467d5=_0x56c3e0[0x0][_0x1cb9('0x2d')](_0x56c3e0[0x0][_0x1cb9('0x2e')]('(')+0x1,_0x56c3e0[0x0][_0x1cb9('0x2e')](')'));var _0xc6d5fd=_0x56c3e0[0x1];recordings[_0x4220d7[_0x1cb9('0x10')]][_0x3467d5]=_0xc6d5fd;}}}catch(_0x386e8b){utils[_0x1cb9('0x13')](_0x386e8b[_0x1cb9('0xd')]);}};exports[_0x1cb9('0x2f')]=function(_0x29f149){try{if(!_['isNil'](recordings[_0x29f149['uniqueid']])){recordings[_0x29f149[_0x1cb9('0x10')]][_0x1cb9('0x30')]=_0x29f149[_0x1cb9('0x30')];}}catch(_0x29f451){utils[_0x1cb9('0x13')](_0x29f451[_0x1cb9('0xd')]);}}; \ No newline at end of file +var _0x008c=['then','membername','name','UserId','request','CreateVoiceRecording','newchannel','uniqueid','error','newstate','isNil','channelstate','linkedid','transfer','stack','variable','mixmonitor_filename','value','replace','.WAV','monitors','hangup','calleridnum','calleridname','connectedlinename','connectedlinenum','forEach','clone','newexten','application','toLowerCase','set','startsWith','cdr','appdata','split','substring','lastIndexOf','queuecallerjoin','queue','lodash','./utils','debug','accountcode'];(function(_0x599f41,_0x4db732){var _0x2e4d58=function(_0x14c882){while(--_0x14c882){_0x599f41['push'](_0x599f41['shift']());}};_0x2e4d58(++_0x4db732);}(_0x008c,0x188));var _0xc008=function(_0x17bcce,_0x39ec4a){_0x17bcce=_0x17bcce-0x0;var _0x47fccb=_0x008c[_0x17bcce];return _0x47fccb;};'use strict';var _=require(_0xc008('0x0'));var utils=require(_0xc008('0x1'));var recordings={};function writeDB(_0x15aadc){utils[_0xc008('0x2')](_0x15aadc);if(_0x15aadc[_0xc008('0x3')]){utils['getUserByInternal'](_0x15aadc[_0xc008('0x3')])[_0xc008('0x4')](function(_0x10b33c){if(_0x10b33c){_0x15aadc[_0xc008('0x5')]=_0x10b33c[_0xc008('0x6')];_0x15aadc[_0xc008('0x7')]=_0x10b33c['id'];}utils[_0xc008('0x8')](_0xc008('0x9'),_0x15aadc);});}else{utils[_0xc008('0x8')]('CreateVoiceRecording',_0x15aadc);}}exports[_0xc008('0xa')]=function(_0x5aa09b){try{if(_0x5aa09b[_0xc008('0xb')]==_0x5aa09b['linkedid']){recordings[_0x5aa09b['uniqueid']]={'uniqueid':_0x5aa09b[_0xc008('0xb')],'accountcode':_0x5aa09b[_0xc008('0x3')],'exten':_0x5aa09b['exten'],'context':_0x5aa09b['context'],'channel':_0x5aa09b['channel'],'monitors':[]};}}catch(_0x1eacfa){utils[_0xc008('0xc')](_0x1eacfa['stack']);}};exports[_0xc008('0xd')]=function(_0x332fd4){try{if(!_[_0xc008('0xe')](recordings[_0x332fd4[_0xc008('0xb')]])&&_0x332fd4[_0xc008('0xf')]==0x6){}else if(!_[_0xc008('0xe')](recordings[_0x332fd4[_0xc008('0x10')]])&&_0x332fd4['channelstate']==0x6&&_0x332fd4['context']!=_0xc008('0x11')){recordings[_0x332fd4['linkedid']][_0xc008('0x3')]=_0x332fd4[_0xc008('0x3')];}}catch(_0x2073ef){utils[_0xc008('0xc')](_0x2073ef[_0xc008('0x12')]);}};exports['varset']=function(_0x5e894e){try{if(!_['isNil'](_0x5e894e[_0xc008('0x13')])&&!_[_0xc008('0xe')](_0x5e894e[_0xc008('0x13')][_0xc008('0x14')])){if(_['endsWith'](_0x5e894e['value'],'.wav49')){_0x5e894e['value']=_0x5e894e[_0xc008('0x15')][_0xc008('0x16')]('.wav49',_0xc008('0x17'));}if(recordings[_0x5e894e['linkedid']]){var _0x4bd611=_['find'](recordings[_0x5e894e['linkedid']][_0xc008('0x18')],{'value':_0x5e894e['value']});if(_['isNil'](_0x4bd611)){recordings[_0x5e894e['linkedid']]['monitors']['push']({'value':_0x5e894e[_0xc008('0x15')]});}}}}catch(_0x4777a6){utils[_0xc008('0xc')](_0x4777a6[_0xc008('0x12')]);}};exports[_0xc008('0x19')]=function(_0x110128){try{if(!_['isNil'](recordings[_0x110128[_0xc008('0xb')]])){recordings[_0x110128['uniqueid']]['calleridnum']=_0x110128[_0xc008('0x1a')];recordings[_0x110128[_0xc008('0xb')]][_0xc008('0x1b')]=_0x110128[_0xc008('0x1b')];recordings[_0x110128['uniqueid']]['connectedlinenum']=_0x110128['connectedlinenum'];recordings[_0x110128[_0xc008('0xb')]][_0xc008('0x1c')]=_0x110128[_0xc008('0x1c')];if(recordings[_0x110128[_0xc008('0xb')]]['type']=='outbound'&&recordings[_0x110128['uniqueid']]['accountcode']){recordings[_0x110128['uniqueid']][_0xc008('0x1d')]=recordings[_0x110128[_0xc008('0xb')]][_0xc008('0x3')];recordings[_0x110128['uniqueid']][_0xc008('0x1c')]='';}recordings[_0x110128[_0xc008('0xb')]][_0xc008('0x18')][_0xc008('0x1e')](_0x4c5dec=>{var _0xcdb32b=_[_0xc008('0x1f')](recordings[_0x110128['uniqueid']]);_0xcdb32b['value']=_0x4c5dec['value'];writeDB(_0xcdb32b);});delete recordings[_0x110128[_0xc008('0xb')]];}}catch(_0x267abd){utils[_0xc008('0xc')](_0x267abd[_0xc008('0x12')]);}};exports[_0xc008('0x20')]=function(_0xceebc3){try{if(!_[_0xc008('0xe')](recordings[_0xceebc3[_0xc008('0xb')]])){if(_0xceebc3[_0xc008('0x21')][_0xc008('0x22')]()==_0xc008('0x23')&&_[_0xc008('0x24')](_0xceebc3['appdata'][_0xc008('0x22')](),_0xc008('0x25'))){var _0x499754=_0xceebc3[_0xc008('0x26')][_0xc008('0x27')]('=');var _0x383be7=_0x499754[0x0][_0xc008('0x28')](_0x499754[0x0][_0xc008('0x29')]('(')+0x1,_0x499754[0x0][_0xc008('0x29')](')'));var _0x7cfbc5=_0x499754[0x1];recordings[_0xceebc3[_0xc008('0xb')]][_0x383be7]=_0x7cfbc5;}}}catch(_0x29d4b3){utils['error'](_0x29d4b3[_0xc008('0x12')]);}};exports[_0xc008('0x2a')]=function(_0x459df4){try{if(!_[_0xc008('0xe')](recordings[_0x459df4[_0xc008('0xb')]])){recordings[_0x459df4[_0xc008('0xb')]][_0xc008('0x2b')]=_0x459df4['queue'];}}catch(_0x35f360){utils[_0xc008('0xc')](_0x35f360['stack']);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index cd3988a..01bf7f5 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 _0x6548=['blind','error','stack','attendedtransfer','assign','origtransfererchannel','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','isNil','transfereechannel','transfertargetcalleridnum','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetlinkedid','lodash','info','format','CreateVoiceTransferReport','type'];(function(_0x41f688,_0x59b64b){var _0x1e7baf=function(_0x33e681){while(--_0x33e681){_0x41f688['push'](_0x41f688['shift']());}};_0x1e7baf(++_0x59b64b);}(_0x6548,0x133));var _0x8654=function(_0x4a42f0,_0x2da65d){_0x4a42f0=_0x4a42f0-0x0;var _0x3dc532=_0x6548[_0x4a42f0];return _0x3dc532;};'use strict';var _=require(_0x8654('0x0'));var util=require('util');var utils=require('./utils');function writeDB(_0x477fff){utils[_0x8654('0x1')](util[_0x8654('0x2')]('TRANSFER|%s',_0x477fff['type']));utils['request'](_0x8654('0x3'),_0x477fff);}exports['blindtransfer']=function(_0x2c300d){try{_0x2c300d[_0x8654('0x4')]=_0x8654('0x5');writeDB(_0x2c300d);}catch(_0x18efe2){utils[_0x8654('0x6')](_0x18efe2[_0x8654('0x7')]);}};exports[_0x8654('0x8')]=function(_0x4b44aa){try{_0x4b44aa=_[_0x8654('0x9')](_0x4b44aa,{'transfererchannel':_0x4b44aa[_0x8654('0xa')],'transferercalleridnum':_0x4b44aa['origtransferercalleridnum'],'transferercalleridname':_0x4b44aa[_0x8654('0xb')],'transfererconnectedlinenum':_0x4b44aa[_0x8654('0xc')],'transfererconnectedlinename':_0x4b44aa[_0x8654('0xd')],'transfereraccountcode':_0x4b44aa['origtransfereraccountcode'],'transferercontext':_0x4b44aa['secondtransferercontext'],'transfererexten':_0x4b44aa[_0x8654('0xe')],'transfererlinkedid':_0x4b44aa[_0x8654('0xf')],'context':_0x4b44aa[_0x8654('0x10')],'extension':_0x4b44aa[_0x8654('0x11')],'type':'attended'});if(_[_0x8654('0x12')](_0x4b44aa[_0x8654('0x13')])){_0x4b44aa=_[_0x8654('0x9')](_0x4b44aa,{'transfereechannel':_0x4b44aa['transfertargetchannel'],'transfereecalleridnum':_0x4b44aa[_0x8654('0x14')],'transfereecalleridname':_0x4b44aa['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x4b44aa[_0x8654('0x15')],'transfereeconnectedlinename':_0x4b44aa[_0x8654('0x16')],'transfereeaccountcode':_0x4b44aa['transfertargetaccountcode'],'transfereecontext':_0x4b44aa['transfertargetcontext'],'transfereeexten':_0x4b44aa['transfertargetexten'],'transfereelinkedid':_0x4b44aa[_0x8654('0x17')]});}writeDB(_0x4b44aa);}catch(_0x24bec4){utils[_0x8654('0x6')](_0x24bec4[_0x8654('0x7')]);}}; \ No newline at end of file +var _0x7a72=['secondtransfererconnectedlinename','origtransfereraccountcode','secondtransfererexten','origtransfererlinkedid','origtransfererexten','attended','transfereechannel','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetcontext','transfertargetlinkedid','error','util','./utils','info','TRANSFER|%s','request','blindtransfer','type','blind','stack','assign','origtransfererchannel','origtransferercalleridnum','secondtransfererconnectedlinenum'];(function(_0x1f008a,_0x37ff6f){var _0x4f702f=function(_0x4f5d51){while(--_0x4f5d51){_0x1f008a['push'](_0x1f008a['shift']());}};_0x4f702f(++_0x37ff6f);}(_0x7a72,0x1be));var _0x27a7=function(_0x319a95,_0x244782){_0x319a95=_0x319a95-0x0;var _0x2b886a=_0x7a72[_0x319a95];return _0x2b886a;};'use strict';var _=require('lodash');var util=require(_0x27a7('0x0'));var utils=require(_0x27a7('0x1'));function writeDB(_0x47e485){utils[_0x27a7('0x2')](util['format'](_0x27a7('0x3'),_0x47e485['type']));utils[_0x27a7('0x4')]('CreateVoiceTransferReport',_0x47e485);}exports[_0x27a7('0x5')]=function(_0x5e56ac){try{_0x5e56ac[_0x27a7('0x6')]=_0x27a7('0x7');writeDB(_0x5e56ac);}catch(_0x5d7305){utils['error'](_0x5d7305[_0x27a7('0x8')]);}};exports['attendedtransfer']=function(_0x24e755){try{_0x24e755=_[_0x27a7('0x9')](_0x24e755,{'transfererchannel':_0x24e755[_0x27a7('0xa')],'transferercalleridnum':_0x24e755[_0x27a7('0xb')],'transferercalleridname':_0x24e755['origtransferercalleridname'],'transfererconnectedlinenum':_0x24e755[_0x27a7('0xc')],'transfererconnectedlinename':_0x24e755[_0x27a7('0xd')],'transfereraccountcode':_0x24e755[_0x27a7('0xe')],'transferercontext':_0x24e755['secondtransferercontext'],'transfererexten':_0x24e755[_0x27a7('0xf')],'transfererlinkedid':_0x24e755[_0x27a7('0x10')],'context':_0x24e755['origtransferercontext'],'extension':_0x24e755[_0x27a7('0x11')],'type':_0x27a7('0x12')});if(_['isNil'](_0x24e755[_0x27a7('0x13')])){_0x24e755=_[_0x27a7('0x9')](_0x24e755,{'transfereechannel':_0x24e755[_0x27a7('0x14')],'transfereecalleridnum':_0x24e755[_0x27a7('0x15')],'transfereecalleridname':_0x24e755[_0x27a7('0x16')],'transfereeconnectedlinenum':_0x24e755[_0x27a7('0x17')],'transfereeconnectedlinename':_0x24e755['transfertargetconnectedlinename'],'transfereeaccountcode':_0x24e755['transfertargetaccountcode'],'transfereecontext':_0x24e755[_0x27a7('0x18')],'transfereeexten':_0x24e755['transfertargetexten'],'transfereelinkedid':_0x24e755[_0x27a7('0x19')]});}writeDB(_0x24e755);}catch(_0x560929){utils[_0x27a7('0x1a')](_0x560929[_0x27a7('0x8')]);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index 8f40f42..f09a688 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 _0xf125=['addTime','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','diff','sumTime','now','isAfter','isBefore','jayson/promise','moment','bluebird','client','http','../../config/logger','xdr','info','debug','error','stack','request','then','stringify','catch','GetUser','name','interface','result','NOTFOUND','length','getUserByInterface','getUserByName','type','acw','acwTimeout','GETVOICEQUEUEBYNAME|'];(function(_0xe1441d,_0x36fb8e){var _0x2ef242=function(_0x52bf2d){while(--_0x52bf2d){_0xe1441d['push'](_0xe1441d['shift']());}};_0x2ef242(++_0x36fb8e);}(_0xf125,0x10d));var _0x5f12=function(_0x1a7cb2,_0x47afc5){_0x1a7cb2=_0x1a7cb2-0x0;var _0x3f8438=_0xf125[_0x1a7cb2];return _0x3f8438;};'use strict';var jayson=require(_0x5f12('0x0'));var moment=require(_0x5f12('0x1'));var BPromise=require(_0x5f12('0x2'));var client=jayson[_0x5f12('0x3')][_0x5f12('0x4')]({'port':0x2329});var logger=require(_0x5f12('0x5'))(_0x5f12('0x6'));exports[_0x5f12('0x7')]=function(_0x3aa08f){logger[_0x5f12('0x7')](_0x3aa08f);};exports[_0x5f12('0x8')]=function(_0x1a4ea3){logger[_0x5f12('0x8')](JSON['stringify'](_0x1a4ea3));};exports[_0x5f12('0x9')]=function(_0x483774){logger[_0x5f12('0x9')](_0x483774[_0x5f12('0xa')]);};exports[_0x5f12('0xb')]=function(_0x4a8552,_0x4b63c8){return client['request'](_0x4a8552,{'body':_0x4b63c8})[_0x5f12('0xc')](function(_0x4ebb8a){logger[_0x5f12('0x8')](JSON[_0x5f12('0xd')](_0x4ebb8a));})[_0x5f12('0xe')](function(_0x35a204){logger[_0x5f12('0x9')](_0x35a204[_0x5f12('0xa')]);});};function getUser(_0x52b477){return client[_0x5f12('0xb')](_0x5f12('0xf'),{'options':{'raw':!![],'attributes':['id','internal',_0x5f12('0x10'),_0x5f12('0x11')],'where':_0x52b477,'limit':0x1}})[_0x5f12('0xc')](function(_0xae3f1a){logger['info']('GETUSER|'+JSON[_0x5f12('0xd')](_0x52b477)+'|'+(_0xae3f1a[_0x5f12('0x12')]['length']?'FOUND':_0x5f12('0x13')));return _0xae3f1a['result'][_0x5f12('0x14')]?_0xae3f1a['result'][0x0]:null;});}exports['getUserByInternal']=function(_0x4f8448){return new BPromise(function(_0x4eaf52,_0x1225da){if(_0x4f8448){return getUser({'internal':_0x4f8448})[_0x5f12('0xc')](function(_0x4cf212){return _0x4eaf52(_0x4cf212);})['catch'](function(_0x3aa205){logger[_0x5f12('0x9')](_0x3aa205[_0x5f12('0xa')]);return _0x4eaf52(null);});}else{return _0x4eaf52(null);}});};exports[_0x5f12('0x15')]=function(_0x238ba2){return new BPromise(function(_0x49dd99,_0x6f8b22){if(_0x238ba2){return getUser({'interface':_0x238ba2})[_0x5f12('0xc')](function(_0x52af0f){return _0x49dd99(_0x52af0f);})[_0x5f12('0xe')](function(_0x41298e){logger[_0x5f12('0x9')](_0x41298e[_0x5f12('0xa')]);return _0x49dd99(null);});}else{return _0x49dd99(null);}});};exports[_0x5f12('0x16')]=function(_0x486e4d){return new BPromise(function(_0x48b0ab,_0x26a1d7){if(_0x486e4d){return getUser({'name':_0x486e4d})[_0x5f12('0xc')](function(_0x5ea9f6){return _0x48b0ab(_0x5ea9f6);})['catch'](function(_0x1cf4e6){logger[_0x5f12('0x9')](_0x1cf4e6[_0x5f12('0xa')]);return _0x48b0ab(null);});}else{return _0x48b0ab(null);}});};exports['getVoiceQueueByName']=function(_0x3f7e72){return new BPromise(function(_0x2a4b57,_0x4d1540){if(_0x3f7e72){return client[_0x5f12('0xb')]('GetVoiceQueue',{'options':{'raw':!![],'attributes':['id',_0x5f12('0x10'),_0x5f12('0x17'),_0x5f12('0x18'),_0x5f12('0x19')],'where':{'name':_0x3f7e72},'limit':0x1}})['then'](function(_0x135d80){logger['info'](_0x5f12('0x1a')+_0x3f7e72+'|'+(_0x135d80[_0x5f12('0x12')]['length']?'FOUND':_0x5f12('0x13')));return _0x2a4b57(_0x135d80[_0x5f12('0x12')][_0x5f12('0x14')]?_0x135d80[_0x5f12('0x12')][0x0]:null);})[_0x5f12('0xe')](function(_0x55288e){logger[_0x5f12('0x9')](_0x55288e[_0x5f12('0xa')]);return _0x2a4b57(null);});}else{return _0x2a4b57(null);}});};exports[_0x5f12('0x1b')]=function(_0xaafac4,_0x37e7de){return moment(_0xaafac4)['add'](_0x37e7de,_0x5f12('0x1c'))[_0x5f12('0x1d')](_0x5f12('0x1e'));};exports[_0x5f12('0x1f')]=function(_0x55510a,_0x706579){return moment(_0x55510a)['subtract'](_0x706579,'seconds')[_0x5f12('0x1d')](_0x5f12('0x1e'));};exports['diffTime']=function(_0x20b39b,_0x28f076){return moment(_0x20b39b)[_0x5f12('0x20')](moment(_0x28f076),_0x5f12('0x1c'));};exports[_0x5f12('0x21')]=function(_0x77c15e,_0x5ab1bc){return parseInt(_0x77c15e,0xa)+parseInt(_0x5ab1bc,0xa);};exports[_0x5f12('0x22')]=function(){return moment()[_0x5f12('0x1d')](_0x5f12('0x1e'));};exports[_0x5f12('0x23')]=function(_0x413c2f,_0x39f932){if(_0x39f932){return moment(_0x413c2f)[_0x5f12('0x23')](_0x39f932);}else{return!![];}};exports[_0x5f12('0x24')]=function(_0x15a46c,_0x4d2f41){if(_0x4d2f41){return moment(_0x15a46c)[_0x5f12('0x24')](_0x4d2f41);}else if(_0x15a46c){return!![];}else{return![];}}; \ No newline at end of file +var _0x3813=['name','interface','then','GETUSER|','result','length','NOTFOUND','getUserByInternal','getUserByInterface','getUserByName','GetVoiceQueue','type','acwTimeout','GETVOICEQUEUEBYNAME|','FOUND','addTime','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','diff','sumTime','isAfter','isBefore','jayson/promise','moment','bluebird','http','../../config/logger','xdr','info','debug','error','stringify','catch','stack','request','GetUser','internal'];(function(_0x29cd76,_0x357ac2){var _0x41bf87=function(_0x47cb4a){while(--_0x47cb4a){_0x29cd76['push'](_0x29cd76['shift']());}};_0x41bf87(++_0x357ac2);}(_0x3813,0x181));var _0x3381=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x3813[_0x20a584];return _0x4b41a8;};'use strict';var jayson=require(_0x3381('0x0'));var moment=require(_0x3381('0x1'));var BPromise=require(_0x3381('0x2'));var client=jayson['client'][_0x3381('0x3')]({'port':0x2329});var logger=require(_0x3381('0x4'))(_0x3381('0x5'));exports[_0x3381('0x6')]=function(_0x290542){logger[_0x3381('0x6')](_0x290542);};exports[_0x3381('0x7')]=function(_0x19be9f){logger[_0x3381('0x7')](JSON['stringify'](_0x19be9f));};exports[_0x3381('0x8')]=function(_0x3fb857){logger[_0x3381('0x8')](_0x3fb857['stack']);};exports['request']=function(_0x39e54f,_0x499b5e){return client['request'](_0x39e54f,{'body':_0x499b5e})['then'](function(_0x287b3e){logger[_0x3381('0x7')](JSON[_0x3381('0x9')](_0x287b3e));})[_0x3381('0xa')](function(_0x36748f){logger['error'](_0x36748f[_0x3381('0xb')]);});};function getUser(_0x4f1216){return client[_0x3381('0xc')](_0x3381('0xd'),{'options':{'raw':!![],'attributes':['id',_0x3381('0xe'),_0x3381('0xf'),_0x3381('0x10')],'where':_0x4f1216,'limit':0x1}})[_0x3381('0x11')](function(_0x2e598e){logger[_0x3381('0x6')](_0x3381('0x12')+JSON[_0x3381('0x9')](_0x4f1216)+'|'+(_0x2e598e[_0x3381('0x13')][_0x3381('0x14')]?'FOUND':_0x3381('0x15')));return _0x2e598e[_0x3381('0x13')]['length']?_0x2e598e[_0x3381('0x13')][0x0]:null;});}exports[_0x3381('0x16')]=function(_0x413ffa){return new BPromise(function(_0x13f038,_0x1a337c){if(_0x413ffa){return getUser({'internal':_0x413ffa})[_0x3381('0x11')](function(_0x23a2be){return _0x13f038(_0x23a2be);})['catch'](function(_0x270e73){logger[_0x3381('0x8')](_0x270e73[_0x3381('0xb')]);return _0x13f038(null);});}else{return _0x13f038(null);}});};exports[_0x3381('0x17')]=function(_0x556e20){return new BPromise(function(_0x579d5f,_0x4473fa){if(_0x556e20){return getUser({'interface':_0x556e20})['then'](function(_0x4e63ee){return _0x579d5f(_0x4e63ee);})['catch'](function(_0x10d470){logger['error'](_0x10d470[_0x3381('0xb')]);return _0x579d5f(null);});}else{return _0x579d5f(null);}});};exports[_0x3381('0x18')]=function(_0x13439d){return new BPromise(function(_0x1451b0,_0x234998){if(_0x13439d){return getUser({'name':_0x13439d})[_0x3381('0x11')](function(_0xfa88ef){return _0x1451b0(_0xfa88ef);})[_0x3381('0xa')](function(_0x2a50b0){logger[_0x3381('0x8')](_0x2a50b0[_0x3381('0xb')]);return _0x1451b0(null);});}else{return _0x1451b0(null);}});};exports['getVoiceQueueByName']=function(_0x3e96c0){return new BPromise(function(_0x1f895c,_0x4caf41){if(_0x3e96c0){return client[_0x3381('0xc')](_0x3381('0x19'),{'options':{'raw':!![],'attributes':['id',_0x3381('0xf'),_0x3381('0x1a'),'acw',_0x3381('0x1b')],'where':{'name':_0x3e96c0},'limit':0x1}})[_0x3381('0x11')](function(_0x212708){logger[_0x3381('0x6')](_0x3381('0x1c')+_0x3e96c0+'|'+(_0x212708[_0x3381('0x13')][_0x3381('0x14')]?_0x3381('0x1d'):_0x3381('0x15')));return _0x1f895c(_0x212708['result']['length']?_0x212708[_0x3381('0x13')][0x0]:null);})[_0x3381('0xa')](function(_0x512d0a){logger[_0x3381('0x8')](_0x512d0a[_0x3381('0xb')]);return _0x1f895c(null);});}else{return _0x1f895c(null);}});};exports[_0x3381('0x1e')]=function(_0x48b0ca,_0x461044){return moment(_0x48b0ca)['add'](_0x461044,_0x3381('0x1f'))[_0x3381('0x20')](_0x3381('0x21'));};exports[_0x3381('0x22')]=function(_0x393d45,_0x2761e9){return moment(_0x393d45)[_0x3381('0x23')](_0x2761e9,_0x3381('0x1f'))[_0x3381('0x20')](_0x3381('0x21'));};exports['diffTime']=function(_0x3dc178,_0x50eefd){return moment(_0x3dc178)[_0x3381('0x24')](moment(_0x50eefd),'seconds');};exports[_0x3381('0x25')]=function(_0x3029aa,_0x3859aa){return parseInt(_0x3029aa,0xa)+parseInt(_0x3859aa,0xa);};exports['now']=function(){return moment()['format'](_0x3381('0x21'));};exports[_0x3381('0x26')]=function(_0x213032,_0x2b928d){if(_0x2b928d){return moment(_0x213032)[_0x3381('0x26')](_0x2b928d);}else{return!![];}};exports['isBefore']=function(_0x141dc1,_0xb08d81){if(_0xb08d81){return moment(_0x141dc1)[_0x3381('0x27')](_0xb08d81);}else if(_0x141dc1){return!![];}else{return![];}}; \ No newline at end of file